From: Andrea Amorese Date: Mon, 20 Dec 2021 08:42:55 +0000 (+0100) Subject: Built motion from commit 1fbb9c67.|2.5.33 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.mail?a=commitdiff_plain;h=ef5bd0825187f94cdf44d7a20c7c74b8f1a5753c;p=motion2.git Built motion from commit 1fbb9c67.|2.5.33 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index c84d003..0e6ccb5 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-12-17T12:59:41.284Z", + "time": "2021-12-20T08:13:10.733Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index a73bfba..c72d2d8 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-12-17T12:59:41.284Z", + "time": "2021-12-20T08:13:10.733Z", "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 5b80bcb..ae349ec 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 _0x4fc5=['contactManager','integration','motionbar','urlForward','browser','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','exports','VIRTUAL','STRING'];(function(_0x4aabdd,_0x1fd1a0){var _0x3865bf=function(_0xb30e01){while(--_0xb30e01){_0x4aabdd['push'](_0x4aabdd['shift']());}};_0x3865bf(++_0x1fd1a0);}(_0x4fc5,0x195));var _0x54fc=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0x4fc5[_0x4d7a70];return _0x3aafbb;};'use strict';var Sequelize=require('sequelize');module[_0x54fc('0x0')]={'name':{'type':Sequelize[_0x54fc('0x1')],'get':function(_0x534801){return this['getDataValue']('action');}},'action':{'type':Sequelize[_0x54fc('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0x54fc('0x3'),_0x54fc('0x4'),_0x54fc('0x5'),'jscripty',_0x54fc('0x6'),_0x54fc('0x7'),'bot','script']],'msg':_0x54fc('0x8')}},'comment':_0x54fc('0x8')},'data1':{'type':Sequelize[_0x54fc('0x2')](0x1000),'comment':_0x54fc('0x9')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x54fc('0xa')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x54fc('0xb')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x54fc('0x2')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9d99=['bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9d99,0x1d0));var _0x99d9=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x9d99[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0x99d9('0x0'));module[_0x99d9('0x1')]={'name':{'type':Sequelize[_0x99d9('0x2')],'get':function(_0x520a86){return this[_0x99d9('0x3')](_0x99d9('0x4'));}},'action':{'type':Sequelize[_0x99d9('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x99d9('0x6'),_0x99d9('0x7'),_0x99d9('0x8'),_0x99d9('0x9'),_0x99d9('0xa'),_0x99d9('0xb'),_0x99d9('0xc'),_0x99d9('0xd')]],'msg':_0x99d9('0xe')}},'comment':_0x99d9('0xe')},'data1':{'type':Sequelize[_0x99d9('0x5')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x99d9('0x5')](0x1000),'comment':_0x99d9('0xf')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x99d9('0x10')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x99d9('0x5')](0x1000)},'data6':{'type':Sequelize[_0x99d9('0x5')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index e6910f6..038dcca 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 _0xf3ce=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','end','stack','name','send','body','Action','params','destroy','find','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service'];(function(_0x3a47b1,_0x318a5e){var _0x464796=function(_0x755bd2){while(--_0x755bd2){_0x3a47b1['push'](_0x3a47b1['shift']());}};_0x464796(++_0x318a5e);}(_0xf3ce,0xae));var _0xef3c=function(_0x1a72b8,_0x1e4f4b){_0x1a72b8=_0x1a72b8-0x0;var _0x39f72d=_0xf3ce[_0x1a72b8];return _0x39f72d;};'use strict';var emlformat=require(_0xef3c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef3c('0x1'));var jsonpatch=require(_0xef3c('0x2'));var rp=require('request-promise');var moment=require(_0xef3c('0x3'));var BPromise=require(_0xef3c('0x4'));var Mustache=require('mustache');var util=require(_0xef3c('0x5'));var path=require(_0xef3c('0x6'));var sox=require(_0xef3c('0x7'));var csv=require(_0xef3c('0x8'));var ejs=require(_0xef3c('0x9'));var fs=require('fs');var fs_extra=require(_0xef3c('0xa'));var _=require(_0xef3c('0xb'));var squel=require(_0xef3c('0xc'));var crypto=require(_0xef3c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xef3c('0xe'));var toCsv=require(_0xef3c('0x8'));var querystring=require(_0xef3c('0xf'));var Papa=require(_0xef3c('0x10'));var Redis=require('ioredis');var authService=require(_0xef3c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xef3c('0x12'));var hardwareService=require(_0xef3c('0x13'));var logger=require(_0xef3c('0x14'))(_0xef3c('0x15'));var utils=require('../../config/utils');var config=require(_0xef3c('0x16'));var licenseUtil=require(_0xef3c('0x17'));var db=require(_0xef3c('0x18'))['db'];function respondWithStatusCode(_0x5dd9c3,_0x3942ba){_0x3942ba=_0x3942ba||0xcc;return function(_0xe4eae3){if(_0xe4eae3){return _0x5dd9c3[_0xef3c('0x19')](_0x3942ba);}return _0x5dd9c3[_0xef3c('0x1a')](_0x3942ba)['end']();};}function respondWithResult(_0x43f706,_0x3f2a36){_0x3f2a36=_0x3f2a36||0xc8;return function(_0x168803){if(_0x168803){return _0x43f706['status'](_0x3f2a36)[_0xef3c('0x1b')](_0x168803);}};}function respondWithFilteredResult(_0x2771d9,_0x39af50){return function(_0x293827){if(_0x293827){var _0x26f482=typeof _0x39af50['offset']===_0xef3c('0x1c')&&typeof _0x39af50[_0xef3c('0x1d')]===_0xef3c('0x1c');var _0x4aba88=_0x293827[_0xef3c('0x1e')];var _0x509899=_0x26f482?0x0:_0x39af50['offset'];var _0xcda445=_0x26f482?_0x293827[_0xef3c('0x1e')]:_0x39af50[_0xef3c('0x1f')]+_0x39af50['limit'];var _0x3da949;if(_0xcda445>=_0x4aba88){_0xcda445=_0x4aba88;_0x3da949=0xc8;}else{_0x3da949=0xce;}_0x2771d9[_0xef3c('0x1a')](_0x3da949);return _0x2771d9['set'](_0xef3c('0x20'),_0x509899+'-'+_0xcda445+'/'+_0x4aba88)['json'](_0x293827);}return null;};}function patchUpdates(_0x3ca41f){return function(_0x4fc4c9){try{jsonpatch[_0xef3c('0x21')](_0x4fc4c9,_0x3ca41f,!![]);}catch(_0x272f66){return BPromise[_0xef3c('0x22')](_0x272f66);}return _0x4fc4c9[_0xef3c('0x23')]();};}function saveUpdates(_0x5cef67,_0x1b3dd8){return function(_0x91a298){if(_0x91a298){return _0x91a298[_0xef3c('0x24')](_0x5cef67)[_0xef3c('0x25')](function(_0x16907f){return _0x16907f;});}return null;};}function removeEntity(_0x2809c9,_0xa08c40){return function(_0x228339){if(_0x228339){return _0x228339['destroy']()['then'](function(){_0x2809c9['status'](0xcc)[_0xef3c('0x26')]();});}};}function handleEntityNotFound(_0x5339fa,_0x163ff6){return function(_0x43b467){if(!_0x43b467){_0x5339fa[_0xef3c('0x19')](0x194);}return _0x43b467;};}function handleError(_0x3dace0,_0x1e0f5b){_0x1e0f5b=_0x1e0f5b||0x1f4;return function(_0x401bd8){logger['error'](_0x401bd8[_0xef3c('0x27')]);if(_0x401bd8[_0xef3c('0x28')]){delete _0x401bd8[_0xef3c('0x28')];}_0x3dace0[_0xef3c('0x1a')](_0x1e0f5b)[_0xef3c('0x29')](_0x401bd8);};}exports[_0xef3c('0x24')]=function(_0x18f245,_0x138b10){if(_0x18f245[_0xef3c('0x2a')]['id']){delete _0x18f245[_0xef3c('0x2a')]['id'];}return db[_0xef3c('0x2b')]['find']({'where':{'id':_0x18f245[_0xef3c('0x2c')]['id']}})['then'](handleEntityNotFound(_0x138b10,null))[_0xef3c('0x25')](saveUpdates(_0x18f245['body'],null))[_0xef3c('0x25')](respondWithResult(_0x138b10,null))['catch'](handleError(_0x138b10,null));};exports[_0xef3c('0x2d')]=function(_0x28e644,_0x5cff87){return db['Action'][_0xef3c('0x2e')]({'where':{'id':_0x28e644[_0xef3c('0x2c')]['id']}})[_0xef3c('0x25')](handleEntityNotFound(_0x5cff87,null))[_0xef3c('0x25')](removeEntity(_0x5cff87,null))[_0xef3c('0x2f')](handleError(_0x5cff87,null));}; \ No newline at end of file +var _0x8abe=['Action','find','params','catch','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','body'];(function(_0x1f472a,_0x501f29){var _0x52ffd2=function(_0x300303){while(--_0x300303){_0x1f472a['push'](_0x1f472a['shift']());}};_0x52ffd2(++_0x501f29);}(_0x8abe,0x64));var _0xe8ab=function(_0x146f98,_0x244654){_0x146f98=_0x146f98-0x0;var _0x3b3be0=_0x8abe[_0x146f98];return _0x3b3be0;};'use strict';var emlformat=require(_0xe8ab('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe8ab('0x1'));var jsonpatch=require(_0xe8ab('0x2'));var rp=require(_0xe8ab('0x3'));var moment=require('moment');var BPromise=require(_0xe8ab('0x4'));var Mustache=require(_0xe8ab('0x5'));var util=require(_0xe8ab('0x6'));var path=require(_0xe8ab('0x7'));var sox=require('sox');var csv=require(_0xe8ab('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe8ab('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe8ab('0xa'));var jsforce=require(_0xe8ab('0xb'));var deskjs=require(_0xe8ab('0xc'));var toCsv=require(_0xe8ab('0x8'));var querystring=require(_0xe8ab('0xd'));var Papa=require(_0xe8ab('0xe'));var Redis=require('ioredis');var authService=require(_0xe8ab('0xf'));var qs=require(_0xe8ab('0x10'));var as=require(_0xe8ab('0x11'));var hardwareService=require(_0xe8ab('0x12'));var logger=require(_0xe8ab('0x13'))(_0xe8ab('0x14'));var utils=require(_0xe8ab('0x15'));var config=require(_0xe8ab('0x16'));var licenseUtil=require(_0xe8ab('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c2fdc,_0x21e058){_0x21e058=_0x21e058||0xcc;return function(_0x469a03){if(_0x469a03){return _0x3c2fdc[_0xe8ab('0x18')](_0x21e058);}return _0x3c2fdc[_0xe8ab('0x19')](_0x21e058)[_0xe8ab('0x1a')]();};}function respondWithResult(_0x4bfd9e,_0x15c7af){_0x15c7af=_0x15c7af||0xc8;return function(_0x4e864c){if(_0x4e864c){return _0x4bfd9e[_0xe8ab('0x19')](_0x15c7af)[_0xe8ab('0x1b')](_0x4e864c);}};}function respondWithFilteredResult(_0x228ea2,_0x6641c){return function(_0x5b894a){if(_0x5b894a){var _0x1e127e=typeof _0x6641c['offset']===_0xe8ab('0x1c')&&typeof _0x6641c[_0xe8ab('0x1d')]===_0xe8ab('0x1c');var _0xfb16c=_0x5b894a[_0xe8ab('0x1e')];var _0x4f36e2=_0x1e127e?0x0:_0x6641c[_0xe8ab('0x1f')];var _0x1a3a28=_0x1e127e?_0x5b894a['count']:_0x6641c[_0xe8ab('0x1f')]+_0x6641c[_0xe8ab('0x1d')];var _0x2f1c9b;if(_0x1a3a28>=_0xfb16c){_0x1a3a28=_0xfb16c;_0x2f1c9b=0xc8;}else{_0x2f1c9b=0xce;}_0x228ea2['status'](_0x2f1c9b);return _0x228ea2[_0xe8ab('0x20')](_0xe8ab('0x21'),_0x4f36e2+'-'+_0x1a3a28+'/'+_0xfb16c)[_0xe8ab('0x1b')](_0x5b894a);}return null;};}function patchUpdates(_0x363c76){return function(_0x3d9550){try{jsonpatch[_0xe8ab('0x22')](_0x3d9550,_0x363c76,!![]);}catch(_0x4b9da6){return BPromise[_0xe8ab('0x23')](_0x4b9da6);}return _0x3d9550[_0xe8ab('0x24')]();};}function saveUpdates(_0x17e4e1,_0x6ee0aa){return function(_0x3dd225){if(_0x3dd225){return _0x3dd225[_0xe8ab('0x25')](_0x17e4e1)[_0xe8ab('0x26')](function(_0x459fa1){return _0x459fa1;});}return null;};}function removeEntity(_0x245709,_0x2f8713){return function(_0x2fa240){if(_0x2fa240){return _0x2fa240[_0xe8ab('0x27')]()[_0xe8ab('0x26')](function(){_0x245709[_0xe8ab('0x19')](0xcc)[_0xe8ab('0x1a')]();});}};}function handleEntityNotFound(_0x497b1d,_0x325c84){return function(_0x1daeae){if(!_0x1daeae){_0x497b1d[_0xe8ab('0x18')](0x194);}return _0x1daeae;};}function handleError(_0x2eabcf,_0x643cc5){_0x643cc5=_0x643cc5||0x1f4;return function(_0x329e8e){logger['error'](_0x329e8e[_0xe8ab('0x28')]);if(_0x329e8e[_0xe8ab('0x29')]){delete _0x329e8e['name'];}_0x2eabcf['status'](_0x643cc5)[_0xe8ab('0x2a')](_0x329e8e);};}exports[_0xe8ab('0x25')]=function(_0x10d383,_0x9162ee){if(_0x10d383[_0xe8ab('0x2b')]['id']){delete _0x10d383[_0xe8ab('0x2b')]['id'];}return db[_0xe8ab('0x2c')][_0xe8ab('0x2d')]({'where':{'id':_0x10d383[_0xe8ab('0x2e')]['id']}})[_0xe8ab('0x26')](handleEntityNotFound(_0x9162ee,null))['then'](saveUpdates(_0x10d383[_0xe8ab('0x2b')],null))[_0xe8ab('0x26')](respondWithResult(_0x9162ee,null))[_0xe8ab('0x2f')](handleError(_0x9162ee,null));};exports[_0xe8ab('0x27')]=function(_0x462874,_0x5896fc){return db[_0xe8ab('0x2c')][_0xe8ab('0x2d')]({'where':{'id':_0x462874['params']['id']}})[_0xe8ab('0x26')](handleEntityNotFound(_0x5896fc,null))[_0xe8ab('0x26')](removeEntity(_0x5896fc,null))[_0xe8ab('0x2f')](handleError(_0x5896fc,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index ad73068..fd4321e 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 _0xa66e=['../../config/environment','./action.attributes','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa66e,0xf4));var _0xea66=function(_0x276ec5,_0x160eeb){_0x276ec5=_0x276ec5-0x0;var _0x5199ba=_0xa66e[_0x276ec5];return _0x5199ba;};'use strict';var _=require(_0xea66('0x0'));var util=require(_0xea66('0x1'));var logger=require(_0xea66('0x2'))(_0xea66('0x3'));var moment=require(_0xea66('0x4'));var BPromise=require(_0xea66('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea66('0x6'));var rimraf=require(_0xea66('0x7'));var config=require(_0xea66('0x8'));var attributes=require(_0xea66('0x9'));module['exports']=function(_0x256407,_0x20a440){return _0x256407['define'](_0xea66('0xa'),attributes,{'tableName':_0xea66('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66bf=['tools_actions','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./action.attributes','exports','define','Action'];(function(_0x371a1d,_0x3591f3){var _0x4ba340=function(_0x57cfbc){while(--_0x57cfbc){_0x371a1d['push'](_0x371a1d['shift']());}};_0x4ba340(++_0x3591f3);}(_0x66bf,0x1c9));var _0xf66b=function(_0x36a06a,_0x1e480a){_0x36a06a=_0x36a06a-0x0;var _0x12cba9=_0x66bf[_0x36a06a];return _0x12cba9;};'use strict';var _=require(_0xf66b('0x0'));var util=require(_0xf66b('0x1'));var logger=require(_0xf66b('0x2'))(_0xf66b('0x3'));var moment=require('moment');var BPromise=require(_0xf66b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf66b('0x5'));var config=require(_0xf66b('0x6'));var attributes=require(_0xf66b('0x7'));module[_0xf66b('0x8')]=function(_0x4e31b6,_0x30617f){return _0x4e31b6[_0xf66b('0x9')](_0xf66b('0xa'),attributes,{'tableName':_0xf66b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index b2bae6f..b770e26 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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x55b609,_0x3a6ce2){var _0x51ed5f=function(_0x9583ad){while(--_0x9583ad){_0x55b609['push'](_0x55b609['shift']());}};_0x51ed5f(++_0x3a6ce2);}(_0x1261,0x144));var _0x1126=function(_0x4186fa,_0x26a01c){_0x4186fa=_0x4186fa-0x0;var _0x136990=_0x1261[_0x4186fa];return _0x136990;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x53ec,0x192));var _0xc53e=function(_0x614ef4,_0x28a060){_0x614ef4=_0x614ef4-0x0;var _0x35e8e2=_0x53ec[_0x614ef4];return _0x35e8e2;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 2621a56..deb0b89 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 _0xe767=['../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x29f241,_0x1e8fd8){var _0x5d0ca8=function(_0x2cfdd7){while(--_0x2cfdd7){_0x29f241['push'](_0x29f241['shift']());}};_0x5d0ca8(++_0x1e8fd8);}(_0xe767,0x1b2));var _0x7e76=function(_0xeb1cdb,_0x4d869f){_0xeb1cdb=_0xeb1cdb-0x0;var _0x27a961=_0xe767[_0xeb1cdb];return _0x27a961;};'use strict';var multer=require(_0x7e76('0x0'));var util=require(_0x7e76('0x1'));var path=require(_0x7e76('0x2'));var timeout=require(_0x7e76('0x3'));var express=require(_0x7e76('0x4'));var router=express[_0x7e76('0x5')]();var fs_extra=require(_0x7e76('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7e76('0x7'));var config=require(_0x7e76('0x8'));var controller=require(_0x7e76('0x9'));router[_0x7e76('0xa')](_0x7e76('0xb'),auth['isAuthenticated'](),controller[_0x7e76('0xc')]);router[_0x7e76('0xd')]('/:id',auth[_0x7e76('0xe')](),controller[_0x7e76('0xf')]);module[_0x7e76('0x10')]=router; \ No newline at end of file +var _0x8e17=['put','/:id','update','delete','isAuthenticated','destroy','exports','multer','path','express','../../components/interaction/service','./action.controller'];(function(_0x40dcd1,_0x5cd1da){var _0x5c056b=function(_0x87a3a7){while(--_0x87a3a7){_0x40dcd1['push'](_0x40dcd1['shift']());}};_0x5c056b(++_0x5cd1da);}(_0x8e17,0xa3));var _0x78e1=function(_0x44d29e,_0x56835c){_0x44d29e=_0x44d29e-0x0;var _0x59224e=_0x8e17[_0x44d29e];return _0x59224e;};'use strict';var multer=require(_0x78e1('0x0'));var util=require('util');var path=require(_0x78e1('0x1'));var timeout=require('connect-timeout');var express=require(_0x78e1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x78e1('0x3'));var config=require('../../config/environment');var controller=require(_0x78e1('0x4'));router[_0x78e1('0x5')](_0x78e1('0x6'),auth['isAuthenticated'](),controller[_0x78e1('0x7')]);router[_0x78e1('0x8')]('/:id',auth[_0x78e1('0x9')](),controller[_0x78e1('0xa')]);module[_0x78e1('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 6262d3c..bb71173 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(_0x12059b,_0xd0124e){var _0x2da823=function(_0x2086ed){while(--_0x2086ed){_0x12059b['push'](_0x12059b['shift']());}};_0x2da823(++_0xd0124e);}(_0x5d17,0x114));var _0x75d1=function(_0x3acb67,_0xbe0faa){_0x3acb67=_0x3acb67-0x0;var _0x534936=_0x5d17[_0x3acb67];return _0x534936;};'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 _0x425d=['sequelize','STRING','TEXT'];(function(_0x100c9c,_0x2183f3){var _0x566727=function(_0x2d4972){while(--_0x2d4972){_0x100c9c['push'](_0x100c9c['shift']());}};_0x566727(++_0x2183f3);}(_0x425d,0x1e0));var _0xd425=function(_0x8f7825,_0xaa0ca0){_0x8f7825=_0x8f7825-0x0;var _0x29a7c9=_0x425d[_0x8f7825];return _0x29a7c9;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'name':{'type':Sequelize[_0xd425('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd425('0x1')]},'parent':{'type':Sequelize[_0xd425('0x1')]},'table':{'type':Sequelize[_0xd425('0x1')]},'conditions':{'type':Sequelize[_0xd425('0x2')]},'joins':{'type':Sequelize[_0xd425('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 92e2857..d7e9c28 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 _0x2aac=['lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','stack','name','send','index','AnalyticCustomReport','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','map','options','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','rules','field','condition','value','merge','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','metric','function','format','replace','groupBy','group','orderBy','order','DESC','alias','joins','parentKey','foreignTable','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MIN(%s)','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','ROUND(%s)','keyBy','MetricId','includes','%s.%s\x20=\x20%s.%s','output','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20EMPTY','operator','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x328b78,_0x21d218){var _0x4221a6=function(_0x50e80f){while(--_0x50e80f){_0x328b78['push'](_0x328b78['shift']());}};_0x4221a6(++_0x21d218);}(_0x2aac,0x1e4));var _0xc2aa=function(_0x29e55c,_0x413523){_0x29e55c=_0x29e55c-0x0;var _0x320af1=_0x2aac[_0x29e55c];return _0x320af1;};'use strict';var emlformat=require(_0xc2aa('0x0'));var rimraf=require(_0xc2aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc2aa('0x2'));var rp=require(_0xc2aa('0x3'));var moment=require(_0xc2aa('0x4'));var BPromise=require(_0xc2aa('0x5'));var Mustache=require(_0xc2aa('0x6'));var util=require(_0xc2aa('0x7'));var path=require(_0xc2aa('0x8'));var sox=require(_0xc2aa('0x9'));var csv=require('to-csv');var ejs=require(_0xc2aa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc2aa('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc2aa('0xc'));var deskjs=require(_0xc2aa('0xd'));var toCsv=require(_0xc2aa('0xe'));var querystring=require(_0xc2aa('0xf'));var Papa=require(_0xc2aa('0x10'));var Redis=require(_0xc2aa('0x11'));var authService=require(_0xc2aa('0x12'));var qs=require(_0xc2aa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc2aa('0x14'));var utils=require('../../config/utils');var config=require(_0xc2aa('0x15'));var licenseUtil=require(_0xc2aa('0x16'));var db=require(_0xc2aa('0x17'))['db'];var dbH=require(_0xc2aa('0x17'))[_0xc2aa('0x18')];function respondWithStatusCode(_0x224e44,_0x10bad1){_0x10bad1=_0x10bad1||0xcc;return function(_0x299bb1){if(_0x299bb1){return _0x224e44['sendStatus'](_0x10bad1);}return _0x224e44[_0xc2aa('0x19')](_0x10bad1)[_0xc2aa('0x1a')]();};}function respondWithResult(_0x19865b,_0x13adb1){_0x13adb1=_0x13adb1||0xc8;return function(_0x4e7f54){if(_0x4e7f54){return _0x19865b[_0xc2aa('0x19')](_0x13adb1)[_0xc2aa('0x1b')](_0x4e7f54);}};}function respondWithFilteredResult(_0x1c48ca,_0x566c73){return function(_0x4fd7d0){if(_0x4fd7d0){var _0x6a7750=typeof _0x566c73[_0xc2aa('0x1c')]===_0xc2aa('0x1d')&&typeof _0x566c73[_0xc2aa('0x1e')]==='undefined';var _0x20e0c3=_0x4fd7d0[_0xc2aa('0x1f')];var _0x1320bd=_0x6a7750?0x0:_0x566c73[_0xc2aa('0x1c')];var _0x291748=_0x6a7750?_0x4fd7d0[_0xc2aa('0x1f')]:_0x566c73[_0xc2aa('0x1c')]+_0x566c73[_0xc2aa('0x1e')];var _0x2c8b09;if(_0x291748>=_0x20e0c3){_0x291748=_0x20e0c3;_0x2c8b09=0xc8;}else{_0x2c8b09=0xce;}_0x1c48ca[_0xc2aa('0x19')](_0x2c8b09);return _0x1c48ca[_0xc2aa('0x20')](_0xc2aa('0x21'),_0x1320bd+'-'+_0x291748+'/'+_0x20e0c3)[_0xc2aa('0x1b')](_0x4fd7d0);}return null;};}function patchUpdates(_0x47fb7e){return function(_0x485f0c){try{jsonpatch[_0xc2aa('0x22')](_0x485f0c,_0x47fb7e,!![]);}catch(_0x26c72a){return BPromise[_0xc2aa('0x23')](_0x26c72a);}return _0x485f0c[_0xc2aa('0x24')]();};}function saveUpdates(_0x5a52ab,_0x5b2708){return function(_0x243d6d){if(_0x243d6d){return _0x243d6d[_0xc2aa('0x25')](_0x5a52ab)[_0xc2aa('0x26')](function(_0x1c8659){return _0x1c8659;});}return null;};}function removeEntity(_0x4864f1,_0x1cc648){return function(_0x311843){if(_0x311843){return _0x311843[_0xc2aa('0x27')]()['then'](function(){var _0x47f886=_0x311843[_0xc2aa('0x28')]({'plain':!![]});var _0x52e8b4=_0xc2aa('0x29');return db[_0xc2aa('0x2a')][_0xc2aa('0x27')]({'where':{'type':_0x52e8b4,'resourceId':_0x47f886['id']}})[_0xc2aa('0x26')](function(){return _0x311843;});})[_0xc2aa('0x26')](function(){_0x4864f1['status'](0xcc)[_0xc2aa('0x1a')]();});}};}function handleEntityNotFound(_0x57f2bd,_0x429d3a){return function(_0x50c708){if(!_0x50c708){_0x57f2bd['sendStatus'](0x194);}return _0x50c708;};}function handleError(_0x7752b0,_0x246c2a){_0x246c2a=_0x246c2a||0x1f4;return function(_0x41c976){logger['error'](_0x41c976[_0xc2aa('0x2b')]);if(_0x41c976['name']){delete _0x41c976[_0xc2aa('0x2c')];}_0x7752b0[_0xc2aa('0x19')](_0x246c2a)[_0xc2aa('0x2d')](_0x41c976);};}exports[_0xc2aa('0x2e')]=function(_0xd76d76,_0x549779){var _0x51e720={},_0x138e89={},_0x268b91={'count':0x0,'rows':[]};var _0x567723=_['map'](db[_0xc2aa('0x2f')][_0xc2aa('0x30')],function(_0x1ee8e0){return{'name':_0x1ee8e0['fieldName'],'type':_0x1ee8e0[_0xc2aa('0x31')]['key']};});_0x138e89[_0xc2aa('0x32')]=_['map'](_0x567723,_0xc2aa('0x2c'));_0x138e89['query']=_[_0xc2aa('0x33')](_0xd76d76[_0xc2aa('0x34')]);_0x138e89[_0xc2aa('0x35')]=_[_0xc2aa('0x36')](_0x138e89[_0xc2aa('0x32')],_0x138e89[_0xc2aa('0x34')]);_0x51e720[_0xc2aa('0x37')]=_[_0xc2aa('0x36')](_0x138e89[_0xc2aa('0x32')],qs[_0xc2aa('0x38')](_0xd76d76[_0xc2aa('0x34')][_0xc2aa('0x38')]));_0x51e720['attributes']=_0x51e720['attributes']['length']?_0x51e720[_0xc2aa('0x37')]:_0x138e89['model'];if(!_0xd76d76[_0xc2aa('0x34')][_0xc2aa('0x39')](_0xc2aa('0x3a'))){_0x51e720[_0xc2aa('0x1e')]=qs[_0xc2aa('0x1e')](_0xd76d76[_0xc2aa('0x34')][_0xc2aa('0x1e')]);_0x51e720[_0xc2aa('0x1c')]=qs[_0xc2aa('0x1c')](_0xd76d76['query'][_0xc2aa('0x1c')]);}_0x51e720['order']=qs[_0xc2aa('0x3b')](_0xd76d76[_0xc2aa('0x34')][_0xc2aa('0x3b')]);_0x51e720[_0xc2aa('0x3c')]=qs[_0xc2aa('0x35')](_[_0xc2aa('0x3d')](_0xd76d76[_0xc2aa('0x34')],_0x138e89[_0xc2aa('0x35')]),_0x567723);if(_0xd76d76[_0xc2aa('0x34')][_0xc2aa('0x3e')]){_0x51e720[_0xc2aa('0x3c')]=_['merge'](_0x51e720['where'],{'$or':_[_0xc2aa('0x3f')](_0x567723,function(_0xfd5ba9){if(_0xfd5ba9['type']!=='VIRTUAL'){var _0x7b826c={};_0x7b826c[_0xfd5ba9[_0xc2aa('0x2c')]]={'$like':'%'+_0xd76d76[_0xc2aa('0x34')][_0xc2aa('0x3e')]+'%'};return _0x7b826c;}})});}_0x51e720=_['merge']({},_0x51e720,_0xd76d76[_0xc2aa('0x40')]);var _0x507544={'where':_0x51e720[_0xc2aa('0x3c')]};return db[_0xc2aa('0x2f')][_0xc2aa('0x1f')](_0x507544)['then'](function(_0x3b5613){_0x268b91['count']=_0x3b5613;if(_0xd76d76[_0xc2aa('0x34')]['includeAll']){_0x51e720[_0xc2aa('0x41')]=[{'all':!![]}];}return db[_0xc2aa('0x2f')][_0xc2aa('0x42')](_0x51e720);})[_0xc2aa('0x26')](function(_0x287633){_0x268b91[_0xc2aa('0x43')]=_0x287633;return _0x268b91;})[_0xc2aa('0x26')](respondWithFilteredResult(_0x549779,_0x51e720))[_0xc2aa('0x44')](handleError(_0x549779,null));};exports['show']=function(_0x9e7699,_0x50a868){var _0x224c16={'raw':![],'where':{'id':_0x9e7699[_0xc2aa('0x45')]['id']}},_0x4fda7d={};_0x4fda7d['model']=_['keys'](db[_0xc2aa('0x2f')][_0xc2aa('0x30')]);_0x4fda7d['query']=_[_0xc2aa('0x33')](_0x9e7699[_0xc2aa('0x34')]);_0x4fda7d[_0xc2aa('0x35')]=_[_0xc2aa('0x36')](_0x4fda7d['model'],_0x4fda7d[_0xc2aa('0x34')]);_0x224c16[_0xc2aa('0x37')]=_[_0xc2aa('0x36')](_0x4fda7d[_0xc2aa('0x32')],qs[_0xc2aa('0x38')](_0x9e7699['query'][_0xc2aa('0x38')]));_0x224c16[_0xc2aa('0x37')]=_0x224c16['attributes'][_0xc2aa('0x46')]?_0x224c16[_0xc2aa('0x37')]:_0x4fda7d[_0xc2aa('0x32')];if(_0x9e7699[_0xc2aa('0x34')]['includeAll']){_0x224c16['include']=[{'all':!![]}];}_0x224c16=_['merge']({},_0x224c16,_0x9e7699[_0xc2aa('0x40')]);return db[_0xc2aa('0x2f')][_0xc2aa('0x47')](_0x224c16)[_0xc2aa('0x26')](handleEntityNotFound(_0x50a868,null))['then'](respondWithResult(_0x50a868,null))[_0xc2aa('0x44')](handleError(_0x50a868,null));};exports[_0xc2aa('0x48')]=function(_0x51c400,_0xac5453){return db[_0xc2aa('0x2f')]['create'](_0x51c400[_0xc2aa('0x49')],{})[_0xc2aa('0x26')](function(_0x5cb0c7){var _0x263842=_0x51c400[_0xc2aa('0x4a')]['get']({'plain':!![]});if(!_0x263842)throw new Error(_0xc2aa('0x4b'));if(_0x263842[_0xc2aa('0x4c')]===_0xc2aa('0x4a')){var _0x31b2da=_0x5cb0c7[_0xc2aa('0x28')]({'plain':!![]});var _0x431d8b=_0xc2aa('0x4d');return db['UserProfileSection'][_0xc2aa('0x47')]({'where':{'name':_0x431d8b,'userProfileId':_0x263842[_0xc2aa('0x4e')]},'raw':!![]})['then'](function(_0x59570b){if(_0x59570b&&_0x59570b[_0xc2aa('0x4f')]===0x0){return db[_0xc2aa('0x2a')][_0xc2aa('0x48')]({'name':_0x31b2da[_0xc2aa('0x2c')],'resourceId':_0x31b2da['id'],'type':_0xc2aa('0x29'),'sectionId':_0x59570b['id']},{})[_0xc2aa('0x26')](function(){return _0x5cb0c7;});}else{return _0x5cb0c7;}})[_0xc2aa('0x44')](function(_0x406391){logger[_0xc2aa('0x50')](_0xc2aa('0x51'),_0x406391);throw _0x406391;});}return _0x5cb0c7;})[_0xc2aa('0x26')](respondWithResult(_0xac5453,0xc9))['catch'](handleError(_0xac5453,null));};exports['update']=function(_0x587228,_0x543bb9){if(_0x587228['body']['id']){delete _0x587228[_0xc2aa('0x49')]['id'];}return db[_0xc2aa('0x2f')][_0xc2aa('0x47')]({'where':{'id':_0x587228[_0xc2aa('0x45')]['id']}})[_0xc2aa('0x26')](handleEntityNotFound(_0x543bb9,null))[_0xc2aa('0x26')](saveUpdates(_0x587228[_0xc2aa('0x49')],null))['then'](respondWithResult(_0x543bb9,null))[_0xc2aa('0x44')](handleError(_0x543bb9,null));};exports[_0xc2aa('0x27')]=function(_0x4f0dcc,_0x23ff44){return db[_0xc2aa('0x2f')][_0xc2aa('0x47')]({'where':{'id':_0x4f0dcc[_0xc2aa('0x45')]['id']}})[_0xc2aa('0x26')](handleEntityNotFound(_0x23ff44,null))['then'](removeEntity(_0x23ff44,null))[_0xc2aa('0x44')](handleError(_0x23ff44,null));};exports[_0xc2aa('0x52')]=function(_0x15e99c,_0x124538){var _0x530eea=0xa;var _0x46ad69=[_0xc2aa('0x53'),_0xc2aa('0x54'),_0xc2aa('0x55'),_0xc2aa('0x56')];var _0x7053f6={'SUM':_0xc2aa('0x57'),'COUNT':_0xc2aa('0x58'),'COUNT DISTINCT':_0xc2aa('0x59'),'MAX':_0xc2aa('0x5a'),'MIN':'MIN(%s)','AVG':_0xc2aa('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc2aa('0x5c')};var _0x1e179c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xc2aa('0x5d'),'HOUR':_0xc2aa('0x5e'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc2aa('0x5f')};var _0x13754e=function(_0x2d1147){return!_['includes']([_0xc2aa('0x60'),_0xc2aa('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2d1147);};var _0x28757a=function(_0x2596dc){if(!_0x2596dc||!_0x2596dc[_0xc2aa('0x62')][_0xc2aa('0x46')]){return'';}for(var _0xda531a='(',_0x59c26a=0x0;_0x59c26a<_0x2596dc[_0xc2aa('0x62')][_0xc2aa('0x46')];_0x59c26a+=0x1){_0x59c26a>0x0&&(_0xda531a+='\x20'+_0x2596dc['operator']+'\x20');_0xda531a+=_0x2596dc[_0xc2aa('0x62')][_0x59c26a]['group']?_0x28757a(_0x2596dc[_0xc2aa('0x62')][_0x59c26a]['group']):_0x2596dc[_0xc2aa('0x62')][_0x59c26a][_0xc2aa('0x63')]+'\x20'+_0x2596dc[_0xc2aa('0x62')][_0x59c26a][_0xc2aa('0x64')]+(_0x13754e(_0x2596dc['rules'][_0x59c26a][_0xc2aa('0x64')])?'\x20'+_0x2596dc[_0xc2aa('0x62')][_0x59c26a][_0xc2aa('0x65')]:'');}return _0xda531a+')';};var _0x37e9ff={'where':{'id':_0x15e99c[_0xc2aa('0x45')]['id']}},_0x1ebf51,_0x225ae7,_0x31091c,_0x21e2cd,_0x551acc;_0x37e9ff=_[_0xc2aa('0x66')]({},_0x37e9ff,_0x15e99c[_0xc2aa('0x40')]);return db[_0xc2aa('0x2f')][_0xc2aa('0x47')](_0x37e9ff)[_0xc2aa('0x26')](function(_0x4a7618){if(_0x4a7618){_0x1ebf51=_0x4a7618;return _0x4a7618[_0xc2aa('0x67')]();}return null;})[_0xc2aa('0x26')](function(_0x43c1c1){if(_0x43c1c1){if(!_0x43c1c1['length']){throw new db[(_0xc2aa('0x68'))][(_0xc2aa('0x69'))](_0xc2aa('0x6a'),0x193);}_0x225ae7=_0x43c1c1;return db[_0xc2aa('0x6b')][_0xc2aa('0x42')]({'raw':!![]});}return null;})[_0xc2aa('0x26')](function(_0xf72366){if(_0xf72366){_0x31091c=_['keyBy'](_0xf72366,'id');var _0x1a7c8d;var _0x28f777=squel[_0xc2aa('0x6c')]();_0x28f777[_0xc2aa('0x6d')](_0x1ebf51[_0xc2aa('0x6e')]);for(var _0x17c9bb=0x0;_0x17c9bb<_0x225ae7[_0xc2aa('0x46')];_0x17c9bb+=0x1){_0x1a7c8d=_0x225ae7[_0x17c9bb]['MetricId']?_0x31091c[_0x225ae7[_0x17c9bb]['MetricId']][_0xc2aa('0x6f')]:_0x225ae7[_0x17c9bb]['field'];_0x1a7c8d=_0x225ae7[_0x17c9bb][_0xc2aa('0x70')]?_['replace'](_0x7053f6[_0x225ae7[_0x17c9bb]['function']],'%s',_0x1a7c8d):_0x1a7c8d;_0x1a7c8d=_0x225ae7[_0x17c9bb][_0xc2aa('0x71')]?_[_0xc2aa('0x72')](_0x1e179c[_0x225ae7[_0x17c9bb][_0xc2aa('0x71')]],'%s',_0x1a7c8d):_0x1a7c8d;if(_0x225ae7[_0x17c9bb][_0xc2aa('0x73')]){_0x28f777[_0xc2aa('0x74')](_0x1a7c8d);}_0x225ae7[_0x17c9bb][_0xc2aa('0x75')]&&_0x28f777[_0xc2aa('0x76')](_0x1a7c8d,_0x225ae7[_0x17c9bb][_0xc2aa('0x75')]===_0xc2aa('0x77')?![]:!![]);_0x28f777[_0xc2aa('0x63')](_0x1a7c8d,_0x225ae7[_0x17c9bb][_0xc2aa('0x78')]||_0x1a7c8d);}if(_0x1ebf51[_0xc2aa('0x79')]){_0x1ebf51[_0xc2aa('0x79')]=JSON['parse'](_0x1ebf51[_0xc2aa('0x79')]);for(var _0x157f58=0x0;_0x157f58<_0x1ebf51['joins'][_0xc2aa('0x46')];_0x157f58+=0x1){if(_0x1ebf51[_0xc2aa('0x79')][_0x157f58][_0xc2aa('0x31')]&&_['includes'](_0x46ad69,_0x1ebf51[_0xc2aa('0x79')][_0x157f58]['type'])&&_0x1ebf51[_0xc2aa('0x79')][_0x157f58][_0xc2aa('0x7a')]&&_0x1ebf51[_0xc2aa('0x79')][_0x157f58][_0xc2aa('0x7b')]&&_0x1ebf51['joins'][_0x157f58][_0xc2aa('0x7c')]){_0x28f777[_0x1ebf51[_0xc2aa('0x79')][_0x157f58][_0xc2aa('0x31')]](_0x1ebf51[_0xc2aa('0x79')][_0x157f58][_0xc2aa('0x7b')],null,util[_0xc2aa('0x71')]('%s.%s\x20=\x20%s.%s',_0x1ebf51['table'],_0x1ebf51['joins'][_0x157f58][_0xc2aa('0x7a')],_0x1ebf51['joins'][_0x157f58][_0xc2aa('0x7b')],_0x1ebf51[_0xc2aa('0x79')][_0x157f58][_0xc2aa('0x7c')]));}}}if(_0x1ebf51[_0xc2aa('0x7d')]){_0x1ebf51['conditions']=JSON[_0xc2aa('0x7e')](_0x1ebf51[_0xc2aa('0x7d')]);_0x28f777[_0xc2aa('0x3c')](_0x28757a(_0x1ebf51[_0xc2aa('0x7d')][_0xc2aa('0x74')]));}_0x551acc=_0x28f777[_0xc2aa('0x7f')]();_0x28f777[_0xc2aa('0x1e')](_0x530eea);_0x28f777[_0xc2aa('0x1c')](0x0);logger[_0xc2aa('0x80')](_0xc2aa('0x81'),_0x28f777[_0xc2aa('0x82')]());return dbH[_0xc2aa('0x83')][_0xc2aa('0x34')](_0x28f777[_0xc2aa('0x82')](),{'type':dbH[_0xc2aa('0x83')][_0xc2aa('0x84')][_0xc2aa('0x85')]});}})[_0xc2aa('0x26')](respondWithResult(_0x124538,null))[_0xc2aa('0x44')](handleError(_0x124538,null));};function runReport(_0x4e1df2,_0x68afe,_0x221236){var _0x4e8d5c=_0x68afe[_0xc2aa('0x2c')];var _0xa5504b=0xa;var _0x25fc00=[_0xc2aa('0x53'),'left_join',_0xc2aa('0x55'),_0xc2aa('0x56')];var _0x4ef361={'SUM':'SUM(%s)','COUNT':_0xc2aa('0x58'),'COUNT DISTINCT':_0xc2aa('0x59'),'MAX':_0xc2aa('0x5a'),'MIN':_0xc2aa('0x86'),'AVG':_0xc2aa('0x5b'),'GROUP_CONCAT':_0xc2aa('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x406b58={'SEC_TO_TIME':_0xc2aa('0x88'),'DATE':_0xc2aa('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0xc2aa('0x89'),'UNIX_TIMESTAMP':_0xc2aa('0x5f')};var _0x5e87a2=function(_0x56eb62){return!_['includes']([_0xc2aa('0x60'),_0xc2aa('0x61'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x56eb62);};var _0x505c22=function(_0x2d1f8c){if(!_0x2d1f8c||!_0x2d1f8c[_0xc2aa('0x62')][_0xc2aa('0x46')]){return'';}for(var _0x43a8f3='(',_0x224f8e=0x0;_0x224f8e<_0x2d1f8c[_0xc2aa('0x62')][_0xc2aa('0x46')];_0x224f8e+=0x1){_0x224f8e>0x0&&(_0x43a8f3+='\x20'+_0x2d1f8c['operator']+'\x20');_0x43a8f3+=_0x2d1f8c['rules'][_0x224f8e][_0xc2aa('0x74')]?_0x505c22(_0x2d1f8c[_0xc2aa('0x62')][_0x224f8e][_0xc2aa('0x74')]):_0x2d1f8c[_0xc2aa('0x62')][_0x224f8e]['field']+'\x20'+_0x2d1f8c[_0xc2aa('0x62')][_0x224f8e][_0xc2aa('0x64')]+(_0x5e87a2(_0x2d1f8c['rules'][_0x224f8e][_0xc2aa('0x64')])?'\x20'+_0x2d1f8c['rules'][_0x224f8e]['value']:'');}return _0x43a8f3+')';};var _0x525c7f={'where':{'id':_0x4e1df2['id']}},_0x5f1aa1,_0xc1f937,_0x44f10f,_0x24d146,_0x3748b4;_0x525c7f=_[_0xc2aa('0x66')]({},_0x525c7f,_0x221236);return db['AnalyticCustomReport'][_0xc2aa('0x47')](_0x525c7f)[_0xc2aa('0x26')](function(_0x2ea8eb){if(_0x2ea8eb){_0x5f1aa1=_0x2ea8eb;return _0x2ea8eb[_0xc2aa('0x67')]();}return null;})[_0xc2aa('0x26')](function(_0x1ab5bb){if(_0x1ab5bb){if(!_0x1ab5bb[_0xc2aa('0x46')]){throw new db[(_0xc2aa('0x68'))]['ValidationErrorItem'](_0xc2aa('0x6a'),0x193);}_0xc1f937=_0x1ab5bb;return db[_0xc2aa('0x6b')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x5b780b){if(_0x5b780b){_0x44f10f=_[_0xc2aa('0x8a')](_0x5b780b,'id');var _0x2bf8ba;var _0x1511d9=squel[_0xc2aa('0x6c')]();_0x1511d9[_0xc2aa('0x6d')](_0x5f1aa1['table']);for(var _0x38f69e=0x0;_0x38f69e<_0xc1f937[_0xc2aa('0x46')];_0x38f69e+=0x1){_0x2bf8ba=_0xc1f937[_0x38f69e][_0xc2aa('0x8b')]?_0x44f10f[_0xc1f937[_0x38f69e][_0xc2aa('0x8b')]]['metric']:_0xc1f937[_0x38f69e][_0xc2aa('0x63')];_0x2bf8ba=_0xc1f937[_0x38f69e]['function']?_['replace'](_0x4ef361[_0xc1f937[_0x38f69e]['function']],'%s',_0x2bf8ba):_0x2bf8ba;_0x2bf8ba=_0xc1f937[_0x38f69e][_0xc2aa('0x71')]?_['replace'](_0x406b58[_0xc1f937[_0x38f69e][_0xc2aa('0x71')]],'%s',_0x2bf8ba):_0x2bf8ba;if(_0xc1f937[_0x38f69e][_0xc2aa('0x73')]){_0x1511d9[_0xc2aa('0x74')](_0x2bf8ba);}_0xc1f937[_0x38f69e]['orderBy']&&_0x1511d9['order'](_0x2bf8ba,_0xc1f937[_0x38f69e][_0xc2aa('0x75')]===_0xc2aa('0x77')?![]:!![]);_0x1511d9['field'](_0x2bf8ba,_0xc1f937[_0x38f69e][_0xc2aa('0x78')]||_0x2bf8ba);}if(_0x5f1aa1[_0xc2aa('0x79')]){_0x5f1aa1[_0xc2aa('0x79')]=JSON[_0xc2aa('0x7e')](_0x5f1aa1[_0xc2aa('0x79')]);for(var _0x37cb61=0x0;_0x37cb61<_0x5f1aa1[_0xc2aa('0x79')][_0xc2aa('0x46')];_0x37cb61+=0x1){if(_0x5f1aa1[_0xc2aa('0x79')][_0x37cb61][_0xc2aa('0x31')]&&_[_0xc2aa('0x8c')](_0x25fc00,_0x5f1aa1[_0xc2aa('0x79')][_0x37cb61][_0xc2aa('0x31')])&&_0x5f1aa1['joins'][_0x37cb61][_0xc2aa('0x7a')]&&_0x5f1aa1[_0xc2aa('0x79')][_0x37cb61][_0xc2aa('0x7b')]&&_0x5f1aa1[_0xc2aa('0x79')][_0x37cb61][_0xc2aa('0x7c')]){_0x1511d9[_0x5f1aa1['joins'][_0x37cb61]['type']](_0x5f1aa1['joins'][_0x37cb61][_0xc2aa('0x7b')],null,util[_0xc2aa('0x71')](_0xc2aa('0x8d'),_0x5f1aa1[_0xc2aa('0x6e')],_0x5f1aa1[_0xc2aa('0x79')][_0x37cb61][_0xc2aa('0x7a')],_0x5f1aa1[_0xc2aa('0x79')][_0x37cb61][_0xc2aa('0x7b')],_0x5f1aa1[_0xc2aa('0x79')][_0x37cb61][_0xc2aa('0x7c')]));}}}if(_0x5f1aa1[_0xc2aa('0x7d')]){_0x5f1aa1['conditions']=JSON[_0xc2aa('0x7e')](_0x5f1aa1[_0xc2aa('0x7d')]);_0x1511d9['where'](_0x505c22(_0x5f1aa1['conditions'][_0xc2aa('0x74')]));}_0x3748b4=_0x1511d9[_0xc2aa('0x7f')]();_0x1511d9[_0xc2aa('0x1e')](_0xa5504b);_0x1511d9['offset'](0x0);return;}})[_0xc2aa('0x26')](function(){if(_0x68afe[_0xc2aa('0x8e')]==='web'){return null;}var _0x31b8fc=_[_0xc2aa('0x66')](_0x68afe,{'name':_0x68afe[_0xc2aa('0x8f')]||_0x68afe[_0xc2aa('0x2c')]||_0x5f1aa1[_0xc2aa('0x2c')],'basename':_0x4e8d5c,'savename':util['format'](_0xc2aa('0x90'),_0x68afe[_0xc2aa('0x2c')]||_0x5f1aa1[_0xc2aa('0x2c')],require(_0xc2aa('0x91'))[_0xc2aa('0x92')](0x4),_0x68afe['output']||_0xc2aa('0x93')),'reportId':_0x5f1aa1['id'],'reportType':'custom'});return db[_0xc2aa('0x94')]['create'](_0x31b8fc,{'raw':!![]});})[_0xc2aa('0x26')](function(_0x53b0a5){if(_0x5f1aa1[_0xc2aa('0x6e')]===_0xc2aa('0x95')){_0x3748b4['where'](_0x5f1aa1[_0xc2aa('0x6e')]+_0xc2aa('0x96'),_0x68afe[_0xc2aa('0x97')],_0x68afe[_0xc2aa('0x98')]);}else{_0x3748b4['where'](_0x5f1aa1[_0xc2aa('0x6e')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x68afe[_0xc2aa('0x97')],_0x68afe[_0xc2aa('0x98')]);}if(_0x53b0a5){logger[_0xc2aa('0x99')](_0xc2aa('0x9a'),_0x3748b4['toString']());require('child_process')[_0xc2aa('0x9b')](path[_0xc2aa('0x53')](__dirname,_0xc2aa('0x9c'),_0x53b0a5['output']),[_0x53b0a5['id'],_0x3748b4['toString'](),path[_0xc2aa('0x53')](__dirname,_0xc2aa('0x9d'),_0x53b0a5['savename']),_0x4e8d5c]);return _0x53b0a5;}else{var _0x418d52=squel[_0xc2aa('0x6c')]();_0x418d52[_0xc2aa('0x6d')]('('+_0x3748b4[_0xc2aa('0x82')]()+')',_0xc2aa('0x9e'));_0x418d52[_0xc2aa('0x63')](_0xc2aa('0x9f'),'count');_0x3748b4[_0xc2aa('0x1e')](_0x68afe[_0xc2aa('0x1e')]||_0xa5504b);_0x3748b4[_0xc2aa('0x1c')](_0x68afe[_0xc2aa('0x1c')]||0x0);return dbH['sequelize'][_0xc2aa('0x34')](_0x418d52[_0xc2aa('0x82')](),{'type':dbH[_0xc2aa('0x83')][_0xc2aa('0x84')][_0xc2aa('0x85')]})['then'](function(_0x3d91e4){if(!_0x3d91e4[_0xc2aa('0x46')]){_0x24d146=0x0;}else{_0x24d146=_0x3d91e4[0x0][_0xc2aa('0x1f')]||0x0;}return dbH[_0xc2aa('0x83')][_0xc2aa('0x34')](_0x3748b4[_0xc2aa('0x82')](),{'type':dbH[_0xc2aa('0x83')][_0xc2aa('0x84')][_0xc2aa('0x85')]});})['then'](function(_0x556677){return{'rows':_0x556677||[],'count':_0x24d146};});}});}exports[_0xc2aa('0xa0')]=function(_0x209765,_0x12e043){return runReport(_0x209765[_0xc2aa('0x45')],_0x209765[_0xc2aa('0x34')],_0x209765[_0xc2aa('0x40')])[_0xc2aa('0x26')](respondWithResult(_0x12e043,null))['catch'](handleError(_0x12e043,null));};exports[_0xc2aa('0xa1')]=runReport;exports[_0xc2aa('0x34')]=function(_0x3db551,_0x2e1f05){var _0x10a148=0xa;var _0x44c295=['join',_0xc2aa('0x54'),_0xc2aa('0x55'),'cross_join'];var _0x2b7437={'SUM':_0xc2aa('0x57'),'COUNT':_0xc2aa('0x58'),'COUNT DISTINCT':_0xc2aa('0x59'),'MAX':_0xc2aa('0x5a'),'MIN':_0xc2aa('0x86'),'AVG':_0xc2aa('0x5b'),'GROUP_CONCAT':_0xc2aa('0x87'),'GROUP_CONCAT ASC':_0xc2aa('0xa2'),'GROUP_CONCAT DESC':_0xc2aa('0x5c')};var _0x5e5403={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xc2aa('0x5e'),'ROUND':_0xc2aa('0x89'),'UNIX_TIMESTAMP':_0xc2aa('0x5f')};var _0x48e704=function(_0x40e514){return!_[_0xc2aa('0x8c')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xc2aa('0xa3')],_0x40e514);};var _0x4d2093=function(_0x4c12bc){if(!_0x4c12bc||!_0x4c12bc[_0xc2aa('0x62')]['length']){return'';}for(var _0x321ae0='(',_0x5b204c=0x0;_0x5b204c<_0x4c12bc[_0xc2aa('0x62')]['length'];_0x5b204c+=0x1){_0x5b204c>0x0&&(_0x321ae0+='\x20'+_0x4c12bc[_0xc2aa('0xa4')]+'\x20');_0x321ae0+=_0x4c12bc['rules'][_0x5b204c][_0xc2aa('0x74')]?_0x4d2093(_0x4c12bc['rules'][_0x5b204c][_0xc2aa('0x74')]):_0x4c12bc[_0xc2aa('0x62')][_0x5b204c][_0xc2aa('0x63')]+'\x20'+_0x4c12bc[_0xc2aa('0x62')][_0x5b204c][_0xc2aa('0x64')]+(_0x48e704(_0x4c12bc['rules'][_0x5b204c][_0xc2aa('0x64')])?'\x20'+_0x4c12bc[_0xc2aa('0x62')][_0x5b204c][_0xc2aa('0x65')]:'');}return _0x321ae0+')';};var _0x53af77={'where':{'id':_0x3db551[_0xc2aa('0x45')]['id']}},_0x1f1bb1,_0x41aa76,_0xc7ac24,_0x53f378,_0x301cd5;_0x53af77=_['merge']({},_0x53af77,_0x3db551['options']);return db['AnalyticCustomReport'][_0xc2aa('0x47')](_0x53af77)[_0xc2aa('0x26')](function(_0x326961){if(_0x326961){_0x1f1bb1=_0x326961;return _0x326961[_0xc2aa('0x67')]();}return null;})[_0xc2aa('0x26')](function(_0x141717){if(_0x141717){if(!_0x141717[_0xc2aa('0x46')]){throw new db['Sequelize']['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x41aa76=_0x141717;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xc2aa('0x26')](function(_0x3a61e9){if(_0x3a61e9){_0xc7ac24=_['keyBy'](_0x3a61e9,'id');var _0x3cb0e8;var _0x53b24f=squel[_0xc2aa('0x6c')]();_0x53b24f['from'](_0x1f1bb1[_0xc2aa('0x6e')]);for(var _0x47aa99=0x0;_0x47aa99<_0x41aa76[_0xc2aa('0x46')];_0x47aa99+=0x1){_0x3cb0e8=_0x41aa76[_0x47aa99][_0xc2aa('0x8b')]?_0xc7ac24[_0x41aa76[_0x47aa99][_0xc2aa('0x8b')]]['metric']:_0x41aa76[_0x47aa99][_0xc2aa('0x63')];_0x3cb0e8=_0x41aa76[_0x47aa99][_0xc2aa('0x70')]?_['replace'](_0x2b7437[_0x41aa76[_0x47aa99]['function']],'%s',_0x3cb0e8):_0x3cb0e8;_0x3cb0e8=_0x41aa76[_0x47aa99][_0xc2aa('0x71')]?_['replace'](_0x5e5403[_0x41aa76[_0x47aa99]['format']],'%s',_0x3cb0e8):_0x3cb0e8;if(_0x41aa76[_0x47aa99][_0xc2aa('0x73')]){_0x53b24f['group'](_0x3cb0e8);}_0x41aa76[_0x47aa99][_0xc2aa('0x75')]&&_0x53b24f[_0xc2aa('0x76')](_0x3cb0e8,_0x41aa76[_0x47aa99][_0xc2aa('0x75')]===_0xc2aa('0x77')?![]:!![]);_0x53b24f[_0xc2aa('0x63')](_0x3cb0e8,_0x41aa76[_0x47aa99]['alias']||_0x3cb0e8);}if(_0x1f1bb1[_0xc2aa('0x79')]){_0x1f1bb1[_0xc2aa('0x79')]=JSON[_0xc2aa('0x7e')](_0x1f1bb1[_0xc2aa('0x79')]);for(var _0x30b247=0x0;_0x30b247<_0x1f1bb1[_0xc2aa('0x79')][_0xc2aa('0x46')];_0x30b247+=0x1){if(_0x1f1bb1[_0xc2aa('0x79')][_0x30b247][_0xc2aa('0x31')]&&_[_0xc2aa('0x8c')](_0x44c295,_0x1f1bb1['joins'][_0x30b247][_0xc2aa('0x31')])&&_0x1f1bb1[_0xc2aa('0x79')][_0x30b247][_0xc2aa('0x7a')]&&_0x1f1bb1[_0xc2aa('0x79')][_0x30b247][_0xc2aa('0x7b')]&&_0x1f1bb1[_0xc2aa('0x79')][_0x30b247]['foreignKey']){_0x53b24f[_0x1f1bb1[_0xc2aa('0x79')][_0x30b247][_0xc2aa('0x31')]](_0x1f1bb1[_0xc2aa('0x79')][_0x30b247]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1f1bb1['table'],_0x1f1bb1[_0xc2aa('0x79')][_0x30b247][_0xc2aa('0x7a')],_0x1f1bb1[_0xc2aa('0x79')][_0x30b247][_0xc2aa('0x7b')],_0x1f1bb1[_0xc2aa('0x79')][_0x30b247][_0xc2aa('0x7c')]));}}}if(_0x1f1bb1[_0xc2aa('0x7d')]){_0x1f1bb1['conditions']=JSON[_0xc2aa('0x7e')](_0x1f1bb1[_0xc2aa('0x7d')]);_0x53b24f[_0xc2aa('0x3c')](_0x4d2093(_0x1f1bb1[_0xc2aa('0x7d')][_0xc2aa('0x74')]));}_0x301cd5=_0x53b24f['clone']();_0x53b24f[_0xc2aa('0x1e')](_0x10a148);_0x53b24f['offset'](0x0);logger[_0xc2aa('0x80')](_0xc2aa('0x81'),_0x53b24f['toString']());return dbH[_0xc2aa('0x83')][_0xc2aa('0x34')](_0x53b24f['toString'](),{'type':dbH[_0xc2aa('0x83')][_0xc2aa('0x84')][_0xc2aa('0x85')]});}})[_0xc2aa('0x26')](function(){return{'sql':_0x301cd5[_0xc2aa('0x82')]()};})[_0xc2aa('0x26')](respondWithResult(_0x2e1f05,null))['catch'](handleError(_0x2e1f05,null));}; \ No newline at end of file +var _0x58db=['findAll','%s.%s\x20=\x20%s.%s','output','web','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','fork','../../components/export/','../../files/reports','savename','toString','countTable','COUNT(*)','SELECT','run','runReport','AnalyticMetric','groupBy','clone','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','offset','undefined','limit','count','json','apply','reject','then','destroy','CustomReports','UserProfileResource','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','rows','catch','show','params','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','body','join','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','alias','joins','parse','foreignKey','foreignTable','parentKey','conditions','debug','Limited\x20Query:','sequelize','QueryTypes','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','operator','Sequelize'];(function(_0xab1d90,_0x4fb07f){var _0x2965d7=function(_0x43057c){while(--_0x43057c){_0xab1d90['push'](_0xab1d90['shift']());}};_0x2965d7(++_0x4fb07f);}(_0x58db,0x161));var _0xb58d=function(_0x1dcab6,_0x454e59){_0x1dcab6=_0x1dcab6-0x0;var _0x1d7dc1=_0x58db[_0x1dcab6];return _0x1d7dc1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb58d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb58d('0x1'));var rp=require('request-promise');var moment=require(_0xb58d('0x2'));var BPromise=require(_0xb58d('0x3'));var Mustache=require('mustache');var util=require(_0xb58d('0x4'));var path=require(_0xb58d('0x5'));var sox=require(_0xb58d('0x6'));var csv=require(_0xb58d('0x7'));var ejs=require(_0xb58d('0x8'));var fs=require('fs');var fs_extra=require(_0xb58d('0x9'));var _=require(_0xb58d('0xa'));var squel=require(_0xb58d('0xb'));var crypto=require(_0xb58d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb58d('0xd'));var toCsv=require(_0xb58d('0x7'));var querystring=require(_0xb58d('0xe'));var Papa=require(_0xb58d('0xf'));var Redis=require(_0xb58d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb58d('0x11'));var as=require(_0xb58d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb58d('0x13'))(_0xb58d('0x14'));var utils=require(_0xb58d('0x15'));var config=require(_0xb58d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb58d('0x17'))['db'];var dbH=require(_0xb58d('0x17'))[_0xb58d('0x18')];function respondWithStatusCode(_0x121ddd,_0x451a3d){_0x451a3d=_0x451a3d||0xcc;return function(_0x1f98a3){if(_0x1f98a3){return _0x121ddd[_0xb58d('0x19')](_0x451a3d);}return _0x121ddd[_0xb58d('0x1a')](_0x451a3d)['end']();};}function respondWithResult(_0x222648,_0x189cf0){_0x189cf0=_0x189cf0||0xc8;return function(_0x47e05a){if(_0x47e05a){return _0x222648[_0xb58d('0x1a')](_0x189cf0)['json'](_0x47e05a);}};}function respondWithFilteredResult(_0x6d8cc3,_0x83db1e){return function(_0x32078a){if(_0x32078a){var _0x4509bc=typeof _0x83db1e[_0xb58d('0x1b')]===_0xb58d('0x1c')&&typeof _0x83db1e[_0xb58d('0x1d')]==='undefined';var _0x470738=_0x32078a[_0xb58d('0x1e')];var _0x2d9f5e=_0x4509bc?0x0:_0x83db1e[_0xb58d('0x1b')];var _0x370e83=_0x4509bc?_0x32078a[_0xb58d('0x1e')]:_0x83db1e[_0xb58d('0x1b')]+_0x83db1e['limit'];var _0x351e53;if(_0x370e83>=_0x470738){_0x370e83=_0x470738;_0x351e53=0xc8;}else{_0x351e53=0xce;}_0x6d8cc3[_0xb58d('0x1a')](_0x351e53);return _0x6d8cc3['set']('Content-Range',_0x2d9f5e+'-'+_0x370e83+'/'+_0x470738)[_0xb58d('0x1f')](_0x32078a);}return null;};}function patchUpdates(_0x3a0fdb){return function(_0x4acd8e){try{jsonpatch[_0xb58d('0x20')](_0x4acd8e,_0x3a0fdb,!![]);}catch(_0x3273c0){return BPromise[_0xb58d('0x21')](_0x3273c0);}return _0x4acd8e['save']();};}function saveUpdates(_0x40afff,_0x2c5d1a){return function(_0x297c51){if(_0x297c51){return _0x297c51['update'](_0x40afff)[_0xb58d('0x22')](function(_0x12973f){return _0x12973f;});}return null;};}function removeEntity(_0x22bbbc,_0x905ea7){return function(_0x3a32d4){if(_0x3a32d4){return _0x3a32d4[_0xb58d('0x23')]()[_0xb58d('0x22')](function(){var _0x2ae9fa=_0x3a32d4['get']({'plain':!![]});var _0x207fe3=_0xb58d('0x24');return db[_0xb58d('0x25')][_0xb58d('0x23')]({'where':{'type':_0x207fe3,'resourceId':_0x2ae9fa['id']}})['then'](function(){return _0x3a32d4;});})[_0xb58d('0x22')](function(){_0x22bbbc[_0xb58d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x334bad,_0x59e48a){return function(_0x166e82){if(!_0x166e82){_0x334bad[_0xb58d('0x19')](0x194);}return _0x166e82;};}function handleError(_0x395a0c,_0x5770ad){_0x5770ad=_0x5770ad||0x1f4;return function(_0x2acee6){logger[_0xb58d('0x26')](_0x2acee6[_0xb58d('0x27')]);if(_0x2acee6[_0xb58d('0x28')]){delete _0x2acee6[_0xb58d('0x28')];}_0x395a0c[_0xb58d('0x1a')](_0x5770ad)[_0xb58d('0x29')](_0x2acee6);};}exports[_0xb58d('0x2a')]=function(_0x5aa1bb,_0x81c377){var _0x61b0a5={},_0x5c5b9c={},_0x56adf6={'count':0x0,'rows':[]};var _0x24a3a9=_[_0xb58d('0x2b')](db[_0xb58d('0x2c')][_0xb58d('0x2d')],function(_0x3fb970){return{'name':_0x3fb970['fieldName'],'type':_0x3fb970[_0xb58d('0x2e')][_0xb58d('0x2f')]};});_0x5c5b9c[_0xb58d('0x30')]=_['map'](_0x24a3a9,_0xb58d('0x28'));_0x5c5b9c[_0xb58d('0x31')]=_[_0xb58d('0x32')](_0x5aa1bb[_0xb58d('0x31')]);_0x5c5b9c['filters']=_[_0xb58d('0x33')](_0x5c5b9c[_0xb58d('0x30')],_0x5c5b9c[_0xb58d('0x31')]);_0x61b0a5[_0xb58d('0x34')]=_[_0xb58d('0x33')](_0x5c5b9c[_0xb58d('0x30')],qs[_0xb58d('0x35')](_0x5aa1bb[_0xb58d('0x31')][_0xb58d('0x35')]));_0x61b0a5[_0xb58d('0x34')]=_0x61b0a5[_0xb58d('0x34')][_0xb58d('0x36')]?_0x61b0a5['attributes']:_0x5c5b9c[_0xb58d('0x30')];if(!_0x5aa1bb[_0xb58d('0x31')][_0xb58d('0x37')](_0xb58d('0x38'))){_0x61b0a5[_0xb58d('0x1d')]=qs[_0xb58d('0x1d')](_0x5aa1bb[_0xb58d('0x31')]['limit']);_0x61b0a5[_0xb58d('0x1b')]=qs[_0xb58d('0x1b')](_0x5aa1bb[_0xb58d('0x31')][_0xb58d('0x1b')]);}_0x61b0a5['order']=qs[_0xb58d('0x39')](_0x5aa1bb[_0xb58d('0x31')][_0xb58d('0x39')]);_0x61b0a5['where']=qs[_0xb58d('0x3a')](_[_0xb58d('0x3b')](_0x5aa1bb[_0xb58d('0x31')],_0x5c5b9c[_0xb58d('0x3a')]),_0x24a3a9);if(_0x5aa1bb['query'][_0xb58d('0x3c')]){_0x61b0a5[_0xb58d('0x3d')]=_[_0xb58d('0x3e')](_0x61b0a5[_0xb58d('0x3d')],{'$or':_[_0xb58d('0x2b')](_0x24a3a9,function(_0x3c7228){if(_0x3c7228[_0xb58d('0x2e')]!=='VIRTUAL'){var _0x30b1cf={};_0x30b1cf[_0x3c7228[_0xb58d('0x28')]]={'$like':'%'+_0x5aa1bb[_0xb58d('0x31')][_0xb58d('0x3c')]+'%'};return _0x30b1cf;}})});}_0x61b0a5=_[_0xb58d('0x3e')]({},_0x61b0a5,_0x5aa1bb[_0xb58d('0x3f')]);var _0x4e2c5e={'where':_0x61b0a5['where']};return db['AnalyticCustomReport']['count'](_0x4e2c5e)[_0xb58d('0x22')](function(_0x5a8817){_0x56adf6['count']=_0x5a8817;if(_0x5aa1bb['query'][_0xb58d('0x40')]){_0x61b0a5['include']=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x61b0a5);})[_0xb58d('0x22')](function(_0x49a396){_0x56adf6[_0xb58d('0x41')]=_0x49a396;return _0x56adf6;})[_0xb58d('0x22')](respondWithFilteredResult(_0x81c377,_0x61b0a5))[_0xb58d('0x42')](handleError(_0x81c377,null));};exports[_0xb58d('0x43')]=function(_0x366c14,_0x8eec1){var _0x8e060c={'raw':![],'where':{'id':_0x366c14[_0xb58d('0x44')]['id']}},_0x34f3c5={};_0x34f3c5[_0xb58d('0x30')]=_['keys'](db[_0xb58d('0x2c')][_0xb58d('0x2d')]);_0x34f3c5['query']=_[_0xb58d('0x32')](_0x366c14[_0xb58d('0x31')]);_0x34f3c5[_0xb58d('0x3a')]=_[_0xb58d('0x33')](_0x34f3c5[_0xb58d('0x30')],_0x34f3c5[_0xb58d('0x31')]);_0x8e060c[_0xb58d('0x34')]=_['intersection'](_0x34f3c5[_0xb58d('0x30')],qs[_0xb58d('0x35')](_0x366c14['query'][_0xb58d('0x35')]));_0x8e060c[_0xb58d('0x34')]=_0x8e060c[_0xb58d('0x34')][_0xb58d('0x36')]?_0x8e060c[_0xb58d('0x34')]:_0x34f3c5['model'];if(_0x366c14[_0xb58d('0x31')][_0xb58d('0x40')]){_0x8e060c['include']=[{'all':!![]}];}_0x8e060c=_['merge']({},_0x8e060c,_0x366c14[_0xb58d('0x3f')]);return db['AnalyticCustomReport'][_0xb58d('0x45')](_0x8e060c)[_0xb58d('0x22')](handleEntityNotFound(_0x8eec1,null))[_0xb58d('0x22')](respondWithResult(_0x8eec1,null))[_0xb58d('0x42')](handleError(_0x8eec1,null));};exports['create']=function(_0x493b5c,_0x39398c){return db[_0xb58d('0x2c')][_0xb58d('0x46')](_0x493b5c['body'],{})[_0xb58d('0x22')](function(_0x262778){var _0x3fe6c5=_0x493b5c['user'][_0xb58d('0x47')]({'plain':!![]});if(!_0x3fe6c5)throw new Error(_0xb58d('0x48'));if(_0x3fe6c5[_0xb58d('0x49')]===_0xb58d('0x4a')){var _0x194e2d=_0x262778[_0xb58d('0x47')]({'plain':!![]});var _0x3c2fe5='Reports';return db[_0xb58d('0x4b')][_0xb58d('0x45')]({'where':{'name':_0x3c2fe5,'userProfileId':_0x3fe6c5[_0xb58d('0x4c')]},'raw':!![]})['then'](function(_0x3ff890){if(_0x3ff890&&_0x3ff890[_0xb58d('0x4d')]===0x0){return db[_0xb58d('0x25')][_0xb58d('0x46')]({'name':_0x194e2d[_0xb58d('0x28')],'resourceId':_0x194e2d['id'],'type':'CustomReports','sectionId':_0x3ff890['id']},{})[_0xb58d('0x22')](function(){return _0x262778;});}else{return _0x262778;}})[_0xb58d('0x42')](function(_0x110846){logger[_0xb58d('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x110846);throw _0x110846;});}return _0x262778;})[_0xb58d('0x22')](respondWithResult(_0x39398c,0xc9))[_0xb58d('0x42')](handleError(_0x39398c,null));};exports[_0xb58d('0x4e')]=function(_0x4b1e6f,_0x1d0ec5){if(_0x4b1e6f['body']['id']){delete _0x4b1e6f[_0xb58d('0x4f')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x4b1e6f[_0xb58d('0x44')]['id']}})[_0xb58d('0x22')](handleEntityNotFound(_0x1d0ec5,null))[_0xb58d('0x22')](saveUpdates(_0x4b1e6f[_0xb58d('0x4f')],null))[_0xb58d('0x22')](respondWithResult(_0x1d0ec5,null))[_0xb58d('0x42')](handleError(_0x1d0ec5,null));};exports[_0xb58d('0x23')]=function(_0x16d915,_0xc23802){return db[_0xb58d('0x2c')][_0xb58d('0x45')]({'where':{'id':_0x16d915['params']['id']}})[_0xb58d('0x22')](handleEntityNotFound(_0xc23802,null))[_0xb58d('0x22')](removeEntity(_0xc23802,null))['catch'](handleError(_0xc23802,null));};exports['preview']=function(_0x5cb697,_0x1c0cd3){var _0xdad07b=0xa;var _0x4173d1=[_0xb58d('0x50'),_0xb58d('0x51'),_0xb58d('0x52'),'cross_join'];var _0x142781={'SUM':_0xb58d('0x53'),'COUNT':_0xb58d('0x54'),'COUNT DISTINCT':_0xb58d('0x55'),'MAX':_0xb58d('0x56'),'MIN':_0xb58d('0x57'),'AVG':_0xb58d('0x58'),'GROUP_CONCAT':_0xb58d('0x59'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xb58d('0x5a')};var _0x22bc2c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xb58d('0x5b'),'HOUR':_0xb58d('0x5c'),'ROUND':_0xb58d('0x5d'),'UNIX_TIMESTAMP':_0xb58d('0x5e')};var _0x209664=function(_0x4ef979){return!_[_0xb58d('0x5f')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xb58d('0x60')],_0x4ef979);};var _0x17ef31=function(_0x444a77){if(!_0x444a77||!_0x444a77[_0xb58d('0x61')][_0xb58d('0x36')]){return'';}for(var _0x499c67='(',_0x5814bd=0x0;_0x5814bd<_0x444a77[_0xb58d('0x61')][_0xb58d('0x36')];_0x5814bd+=0x1){_0x5814bd>0x0&&(_0x499c67+='\x20'+_0x444a77['operator']+'\x20');_0x499c67+=_0x444a77[_0xb58d('0x61')][_0x5814bd][_0xb58d('0x62')]?_0x17ef31(_0x444a77['rules'][_0x5814bd]['group']):_0x444a77[_0xb58d('0x61')][_0x5814bd][_0xb58d('0x63')]+'\x20'+_0x444a77['rules'][_0x5814bd][_0xb58d('0x64')]+(_0x209664(_0x444a77[_0xb58d('0x61')][_0x5814bd][_0xb58d('0x64')])?'\x20'+_0x444a77[_0xb58d('0x61')][_0x5814bd][_0xb58d('0x65')]:'');}return _0x499c67+')';};var _0x2ae01f={'where':{'id':_0x5cb697[_0xb58d('0x44')]['id']}},_0x1c9524,_0xc062fe,_0x1e9228,_0x2bf942,_0x259bdb;_0x2ae01f=_[_0xb58d('0x3e')]({},_0x2ae01f,_0x5cb697[_0xb58d('0x3f')]);return db[_0xb58d('0x2c')][_0xb58d('0x45')](_0x2ae01f)['then'](function(_0x86113d){if(_0x86113d){_0x1c9524=_0x86113d;return _0x86113d[_0xb58d('0x66')]();}return null;})['then'](function(_0x3312cd){if(_0x3312cd){if(!_0x3312cd[_0xb58d('0x36')]){throw new db['Sequelize'][(_0xb58d('0x67'))](_0xb58d('0x68'),0x193);}_0xc062fe=_0x3312cd;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xb58d('0x22')](function(_0x219b46){if(_0x219b46){_0x1e9228=_[_0xb58d('0x69')](_0x219b46,'id');var _0x12b760;var _0x6f2eb=squel[_0xb58d('0x6a')]();_0x6f2eb[_0xb58d('0x6b')](_0x1c9524[_0xb58d('0x6c')]);for(var _0x4f5fff=0x0;_0x4f5fff<_0xc062fe[_0xb58d('0x36')];_0x4f5fff+=0x1){_0x12b760=_0xc062fe[_0x4f5fff][_0xb58d('0x6d')]?_0x1e9228[_0xc062fe[_0x4f5fff]['MetricId']][_0xb58d('0x6e')]:_0xc062fe[_0x4f5fff]['field'];_0x12b760=_0xc062fe[_0x4f5fff][_0xb58d('0x6f')]?_[_0xb58d('0x70')](_0x142781[_0xc062fe[_0x4f5fff][_0xb58d('0x6f')]],'%s',_0x12b760):_0x12b760;_0x12b760=_0xc062fe[_0x4f5fff]['format']?_['replace'](_0x22bc2c[_0xc062fe[_0x4f5fff][_0xb58d('0x71')]],'%s',_0x12b760):_0x12b760;if(_0xc062fe[_0x4f5fff]['groupBy']){_0x6f2eb[_0xb58d('0x62')](_0x12b760);}_0xc062fe[_0x4f5fff][_0xb58d('0x72')]&&_0x6f2eb[_0xb58d('0x73')](_0x12b760,_0xc062fe[_0x4f5fff][_0xb58d('0x72')]===_0xb58d('0x74')?![]:!![]);_0x6f2eb[_0xb58d('0x63')](_0x12b760,_0xc062fe[_0x4f5fff][_0xb58d('0x75')]||_0x12b760);}if(_0x1c9524['joins']){_0x1c9524[_0xb58d('0x76')]=JSON[_0xb58d('0x77')](_0x1c9524['joins']);for(var _0x148ed9=0x0;_0x148ed9<_0x1c9524[_0xb58d('0x76')][_0xb58d('0x36')];_0x148ed9+=0x1){if(_0x1c9524[_0xb58d('0x76')][_0x148ed9]['type']&&_['includes'](_0x4173d1,_0x1c9524['joins'][_0x148ed9][_0xb58d('0x2e')])&&_0x1c9524[_0xb58d('0x76')][_0x148ed9]['parentKey']&&_0x1c9524['joins'][_0x148ed9]['foreignTable']&&_0x1c9524[_0xb58d('0x76')][_0x148ed9][_0xb58d('0x78')]){_0x6f2eb[_0x1c9524[_0xb58d('0x76')][_0x148ed9][_0xb58d('0x2e')]](_0x1c9524[_0xb58d('0x76')][_0x148ed9][_0xb58d('0x79')],null,util[_0xb58d('0x71')]('%s.%s\x20=\x20%s.%s',_0x1c9524[_0xb58d('0x6c')],_0x1c9524[_0xb58d('0x76')][_0x148ed9][_0xb58d('0x7a')],_0x1c9524[_0xb58d('0x76')][_0x148ed9][_0xb58d('0x79')],_0x1c9524[_0xb58d('0x76')][_0x148ed9][_0xb58d('0x78')]));}}}if(_0x1c9524['conditions']){_0x1c9524['conditions']=JSON[_0xb58d('0x77')](_0x1c9524[_0xb58d('0x7b')]);_0x6f2eb[_0xb58d('0x3d')](_0x17ef31(_0x1c9524[_0xb58d('0x7b')][_0xb58d('0x62')]));}_0x259bdb=_0x6f2eb['clone']();_0x6f2eb[_0xb58d('0x1d')](_0xdad07b);_0x6f2eb[_0xb58d('0x1b')](0x0);logger[_0xb58d('0x7c')](_0xb58d('0x7d'),_0x6f2eb['toString']());return dbH[_0xb58d('0x7e')][_0xb58d('0x31')](_0x6f2eb['toString'](),{'type':dbH[_0xb58d('0x7e')][_0xb58d('0x7f')]['SELECT']});}})[_0xb58d('0x22')](respondWithResult(_0x1c0cd3,null))['catch'](handleError(_0x1c0cd3,null));};function runReport(_0x1420a4,_0x4856d7,_0x1522c1){var _0xcc67f4=_0x4856d7[_0xb58d('0x28')];var _0x3c0476=0xa;var _0x3ce39a=[_0xb58d('0x50'),'left_join',_0xb58d('0x52'),_0xb58d('0x80')];var _0xe4cb31={'SUM':'SUM(%s)','COUNT':_0xb58d('0x54'),'COUNT DISTINCT':_0xb58d('0x55'),'MAX':_0xb58d('0x56'),'MIN':_0xb58d('0x57'),'AVG':_0xb58d('0x58'),'GROUP_CONCAT':_0xb58d('0x59'),'GROUP_CONCAT ASC':_0xb58d('0x81'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x59b69d={'SEC_TO_TIME':_0xb58d('0x82'),'DATE':_0xb58d('0x5b'),'HOUR':_0xb58d('0x5c'),'ROUND':_0xb58d('0x5d'),'UNIX_TIMESTAMP':_0xb58d('0x5e')};var _0x2f2f6e=function(_0x5b5362){return!_['includes']([_0xb58d('0x83'),_0xb58d('0x84'),_0xb58d('0x85'),_0xb58d('0x60')],_0x5b5362);};var _0x10070e=function(_0x2ae20b){if(!_0x2ae20b||!_0x2ae20b[_0xb58d('0x61')]['length']){return'';}for(var _0x42c52b='(',_0x1448d6=0x0;_0x1448d6<_0x2ae20b['rules']['length'];_0x1448d6+=0x1){_0x1448d6>0x0&&(_0x42c52b+='\x20'+_0x2ae20b[_0xb58d('0x86')]+'\x20');_0x42c52b+=_0x2ae20b[_0xb58d('0x61')][_0x1448d6][_0xb58d('0x62')]?_0x10070e(_0x2ae20b[_0xb58d('0x61')][_0x1448d6][_0xb58d('0x62')]):_0x2ae20b[_0xb58d('0x61')][_0x1448d6][_0xb58d('0x63')]+'\x20'+_0x2ae20b[_0xb58d('0x61')][_0x1448d6]['condition']+(_0x2f2f6e(_0x2ae20b[_0xb58d('0x61')][_0x1448d6]['condition'])?'\x20'+_0x2ae20b[_0xb58d('0x61')][_0x1448d6][_0xb58d('0x65')]:'');}return _0x42c52b+')';};var _0x526e7d={'where':{'id':_0x1420a4['id']}},_0x306ca1,_0x309720,_0x7dc8a8,_0x2acff3,_0xaadb48;_0x526e7d=_[_0xb58d('0x3e')]({},_0x526e7d,_0x1522c1);return db[_0xb58d('0x2c')][_0xb58d('0x45')](_0x526e7d)[_0xb58d('0x22')](function(_0x5e672e){if(_0x5e672e){_0x306ca1=_0x5e672e;return _0x5e672e['getFields']();}return null;})[_0xb58d('0x22')](function(_0x1dec0a){if(_0x1dec0a){if(!_0x1dec0a[_0xb58d('0x36')]){throw new db[(_0xb58d('0x87'))]['ValidationErrorItem'](_0xb58d('0x68'),0x193);}_0x309720=_0x1dec0a;return db['AnalyticMetric'][_0xb58d('0x88')]({'raw':!![]});}return null;})['then'](function(_0x5cb9bd){if(_0x5cb9bd){_0x7dc8a8=_['keyBy'](_0x5cb9bd,'id');var _0x1a253e;var _0xef0108=squel[_0xb58d('0x6a')]();_0xef0108[_0xb58d('0x6b')](_0x306ca1[_0xb58d('0x6c')]);for(var _0x53fee4=0x0;_0x53fee4<_0x309720[_0xb58d('0x36')];_0x53fee4+=0x1){_0x1a253e=_0x309720[_0x53fee4][_0xb58d('0x6d')]?_0x7dc8a8[_0x309720[_0x53fee4][_0xb58d('0x6d')]][_0xb58d('0x6e')]:_0x309720[_0x53fee4][_0xb58d('0x63')];_0x1a253e=_0x309720[_0x53fee4]['function']?_[_0xb58d('0x70')](_0xe4cb31[_0x309720[_0x53fee4][_0xb58d('0x6f')]],'%s',_0x1a253e):_0x1a253e;_0x1a253e=_0x309720[_0x53fee4][_0xb58d('0x71')]?_['replace'](_0x59b69d[_0x309720[_0x53fee4]['format']],'%s',_0x1a253e):_0x1a253e;if(_0x309720[_0x53fee4]['groupBy']){_0xef0108[_0xb58d('0x62')](_0x1a253e);}_0x309720[_0x53fee4][_0xb58d('0x72')]&&_0xef0108[_0xb58d('0x73')](_0x1a253e,_0x309720[_0x53fee4]['orderBy']===_0xb58d('0x74')?![]:!![]);_0xef0108['field'](_0x1a253e,_0x309720[_0x53fee4]['alias']||_0x1a253e);}if(_0x306ca1[_0xb58d('0x76')]){_0x306ca1[_0xb58d('0x76')]=JSON[_0xb58d('0x77')](_0x306ca1['joins']);for(var _0x494e2f=0x0;_0x494e2f<_0x306ca1['joins'][_0xb58d('0x36')];_0x494e2f+=0x1){if(_0x306ca1[_0xb58d('0x76')][_0x494e2f][_0xb58d('0x2e')]&&_[_0xb58d('0x5f')](_0x3ce39a,_0x306ca1[_0xb58d('0x76')][_0x494e2f][_0xb58d('0x2e')])&&_0x306ca1[_0xb58d('0x76')][_0x494e2f][_0xb58d('0x7a')]&&_0x306ca1[_0xb58d('0x76')][_0x494e2f][_0xb58d('0x79')]&&_0x306ca1['joins'][_0x494e2f][_0xb58d('0x78')]){_0xef0108[_0x306ca1['joins'][_0x494e2f][_0xb58d('0x2e')]](_0x306ca1[_0xb58d('0x76')][_0x494e2f][_0xb58d('0x79')],null,util[_0xb58d('0x71')](_0xb58d('0x89'),_0x306ca1[_0xb58d('0x6c')],_0x306ca1['joins'][_0x494e2f][_0xb58d('0x7a')],_0x306ca1[_0xb58d('0x76')][_0x494e2f][_0xb58d('0x79')],_0x306ca1[_0xb58d('0x76')][_0x494e2f][_0xb58d('0x78')]));}}}if(_0x306ca1[_0xb58d('0x7b')]){_0x306ca1[_0xb58d('0x7b')]=JSON[_0xb58d('0x77')](_0x306ca1[_0xb58d('0x7b')]);_0xef0108['where'](_0x10070e(_0x306ca1['conditions'][_0xb58d('0x62')]));}_0xaadb48=_0xef0108['clone']();_0xef0108[_0xb58d('0x1d')](_0x3c0476);_0xef0108[_0xb58d('0x1b')](0x0);return;}})[_0xb58d('0x22')](function(){if(_0x4856d7[_0xb58d('0x8a')]===_0xb58d('0x8b')){return null;}var _0x55e4f2=_['merge'](_0x4856d7,{'name':_0x4856d7['fullPath']||_0x4856d7[_0xb58d('0x28')]||_0x306ca1[_0xb58d('0x28')],'basename':_0xcc67f4,'savename':util[_0xb58d('0x71')](_0xb58d('0x8c'),_0x4856d7[_0xb58d('0x28')]||_0x306ca1[_0xb58d('0x28')],require(_0xb58d('0x8d'))[_0xb58d('0x8e')](0x4),_0x4856d7[_0xb58d('0x8a')]||_0xb58d('0x8f')),'reportId':_0x306ca1['id'],'reportType':'custom'});return db[_0xb58d('0x90')][_0xb58d('0x46')](_0x55e4f2,{'raw':!![]});})['then'](function(_0x102726){if(_0x306ca1[_0xb58d('0x6c')]===_0xb58d('0x91')){_0xaadb48[_0xb58d('0x3d')](_0x306ca1[_0xb58d('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4856d7[_0xb58d('0x92')],_0x4856d7[_0xb58d('0x93')]);}else{_0xaadb48[_0xb58d('0x3d')](_0x306ca1[_0xb58d('0x6c')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4856d7[_0xb58d('0x92')],_0x4856d7[_0xb58d('0x93')]);}if(_0x102726){logger[_0xb58d('0x94')](_0xb58d('0x95'),_0xaadb48['toString']());require('child_process')[_0xb58d('0x96')](path[_0xb58d('0x50')](__dirname,_0xb58d('0x97'),_0x102726['output']),[_0x102726['id'],_0xaadb48['toString'](),path[_0xb58d('0x50')](__dirname,_0xb58d('0x98'),_0x102726[_0xb58d('0x99')]),_0xcc67f4]);return _0x102726;}else{var _0x1aa336=squel[_0xb58d('0x6a')]();_0x1aa336[_0xb58d('0x6b')]('('+_0xaadb48[_0xb58d('0x9a')]()+')',_0xb58d('0x9b'));_0x1aa336[_0xb58d('0x63')](_0xb58d('0x9c'),_0xb58d('0x1e'));_0xaadb48[_0xb58d('0x1d')](_0x4856d7[_0xb58d('0x1d')]||_0x3c0476);_0xaadb48['offset'](_0x4856d7['offset']||0x0);return dbH['sequelize'][_0xb58d('0x31')](_0x1aa336[_0xb58d('0x9a')](),{'type':dbH[_0xb58d('0x7e')]['QueryTypes']['SELECT']})[_0xb58d('0x22')](function(_0x1c2b65){if(!_0x1c2b65[_0xb58d('0x36')]){_0x2acff3=0x0;}else{_0x2acff3=_0x1c2b65[0x0][_0xb58d('0x1e')]||0x0;}return dbH[_0xb58d('0x7e')][_0xb58d('0x31')](_0xaadb48[_0xb58d('0x9a')](),{'type':dbH[_0xb58d('0x7e')]['QueryTypes'][_0xb58d('0x9d')]});})[_0xb58d('0x22')](function(_0x59966d){return{'rows':_0x59966d||[],'count':_0x2acff3};});}});}exports[_0xb58d('0x9e')]=function(_0x474c50,_0x5456b7){return runReport(_0x474c50[_0xb58d('0x44')],_0x474c50[_0xb58d('0x31')],_0x474c50[_0xb58d('0x3f')])[_0xb58d('0x22')](respondWithResult(_0x5456b7,null))[_0xb58d('0x42')](handleError(_0x5456b7,null));};exports[_0xb58d('0x9f')]=runReport;exports[_0xb58d('0x31')]=function(_0x4ad73d,_0x5f2f2f){var _0x33119f=0xa;var _0x2d1771=[_0xb58d('0x50'),_0xb58d('0x51'),_0xb58d('0x52'),_0xb58d('0x80')];var _0x57e009={'SUM':_0xb58d('0x53'),'COUNT':_0xb58d('0x54'),'COUNT DISTINCT':_0xb58d('0x55'),'MAX':_0xb58d('0x56'),'MIN':_0xb58d('0x57'),'AVG':_0xb58d('0x58'),'GROUP_CONCAT':_0xb58d('0x59'),'GROUP_CONCAT ASC':_0xb58d('0x81'),'GROUP_CONCAT DESC':_0xb58d('0x5a')};var _0x52d4a6={'SEC_TO_TIME':_0xb58d('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xb58d('0x5d'),'UNIX_TIMESTAMP':_0xb58d('0x5e')};var _0x1ec7eb=function(_0x1d44cd){return!_[_0xb58d('0x5f')](['IS\x20NULL',_0xb58d('0x84'),_0xb58d('0x85'),_0xb58d('0x60')],_0x1d44cd);};var _0x232bec=function(_0x37930b){if(!_0x37930b||!_0x37930b[_0xb58d('0x61')][_0xb58d('0x36')]){return'';}for(var _0x4a4e3a='(',_0x351b48=0x0;_0x351b48<_0x37930b['rules'][_0xb58d('0x36')];_0x351b48+=0x1){_0x351b48>0x0&&(_0x4a4e3a+='\x20'+_0x37930b[_0xb58d('0x86')]+'\x20');_0x4a4e3a+=_0x37930b[_0xb58d('0x61')][_0x351b48]['group']?_0x232bec(_0x37930b[_0xb58d('0x61')][_0x351b48][_0xb58d('0x62')]):_0x37930b['rules'][_0x351b48][_0xb58d('0x63')]+'\x20'+_0x37930b[_0xb58d('0x61')][_0x351b48][_0xb58d('0x64')]+(_0x1ec7eb(_0x37930b['rules'][_0x351b48][_0xb58d('0x64')])?'\x20'+_0x37930b[_0xb58d('0x61')][_0x351b48][_0xb58d('0x65')]:'');}return _0x4a4e3a+')';};var _0xb13981={'where':{'id':_0x4ad73d[_0xb58d('0x44')]['id']}},_0x45a112,_0x43e577,_0x19ed56,_0xf497d4,_0x37665e;_0xb13981=_[_0xb58d('0x3e')]({},_0xb13981,_0x4ad73d[_0xb58d('0x3f')]);return db[_0xb58d('0x2c')][_0xb58d('0x45')](_0xb13981)[_0xb58d('0x22')](function(_0x56743d){if(_0x56743d){_0x45a112=_0x56743d;return _0x56743d['getFields']();}return null;})['then'](function(_0x5bf8f8){if(_0x5bf8f8){if(!_0x5bf8f8[_0xb58d('0x36')]){throw new db['Sequelize'][(_0xb58d('0x67'))](_0xb58d('0x68'),0x193);}_0x43e577=_0x5bf8f8;return db[_0xb58d('0xa0')][_0xb58d('0x88')]({'raw':!![]});}return null;})[_0xb58d('0x22')](function(_0x5bd25c){if(_0x5bd25c){_0x19ed56=_[_0xb58d('0x69')](_0x5bd25c,'id');var _0x50350b;var _0x5a359e=squel[_0xb58d('0x6a')]();_0x5a359e[_0xb58d('0x6b')](_0x45a112['table']);for(var _0x1df351=0x0;_0x1df351<_0x43e577[_0xb58d('0x36')];_0x1df351+=0x1){_0x50350b=_0x43e577[_0x1df351][_0xb58d('0x6d')]?_0x19ed56[_0x43e577[_0x1df351][_0xb58d('0x6d')]][_0xb58d('0x6e')]:_0x43e577[_0x1df351][_0xb58d('0x63')];_0x50350b=_0x43e577[_0x1df351][_0xb58d('0x6f')]?_[_0xb58d('0x70')](_0x57e009[_0x43e577[_0x1df351][_0xb58d('0x6f')]],'%s',_0x50350b):_0x50350b;_0x50350b=_0x43e577[_0x1df351][_0xb58d('0x71')]?_[_0xb58d('0x70')](_0x52d4a6[_0x43e577[_0x1df351][_0xb58d('0x71')]],'%s',_0x50350b):_0x50350b;if(_0x43e577[_0x1df351][_0xb58d('0xa1')]){_0x5a359e[_0xb58d('0x62')](_0x50350b);}_0x43e577[_0x1df351][_0xb58d('0x72')]&&_0x5a359e['order'](_0x50350b,_0x43e577[_0x1df351][_0xb58d('0x72')]===_0xb58d('0x74')?![]:!![]);_0x5a359e[_0xb58d('0x63')](_0x50350b,_0x43e577[_0x1df351]['alias']||_0x50350b);}if(_0x45a112[_0xb58d('0x76')]){_0x45a112[_0xb58d('0x76')]=JSON[_0xb58d('0x77')](_0x45a112[_0xb58d('0x76')]);for(var _0x17c96c=0x0;_0x17c96c<_0x45a112[_0xb58d('0x76')]['length'];_0x17c96c+=0x1){if(_0x45a112[_0xb58d('0x76')][_0x17c96c][_0xb58d('0x2e')]&&_[_0xb58d('0x5f')](_0x2d1771,_0x45a112[_0xb58d('0x76')][_0x17c96c][_0xb58d('0x2e')])&&_0x45a112['joins'][_0x17c96c][_0xb58d('0x7a')]&&_0x45a112['joins'][_0x17c96c]['foreignTable']&&_0x45a112[_0xb58d('0x76')][_0x17c96c][_0xb58d('0x78')]){_0x5a359e[_0x45a112[_0xb58d('0x76')][_0x17c96c][_0xb58d('0x2e')]](_0x45a112[_0xb58d('0x76')][_0x17c96c]['foreignTable'],null,util[_0xb58d('0x71')](_0xb58d('0x89'),_0x45a112[_0xb58d('0x6c')],_0x45a112[_0xb58d('0x76')][_0x17c96c][_0xb58d('0x7a')],_0x45a112[_0xb58d('0x76')][_0x17c96c][_0xb58d('0x79')],_0x45a112[_0xb58d('0x76')][_0x17c96c][_0xb58d('0x78')]));}}}if(_0x45a112[_0xb58d('0x7b')]){_0x45a112['conditions']=JSON['parse'](_0x45a112[_0xb58d('0x7b')]);_0x5a359e[_0xb58d('0x3d')](_0x232bec(_0x45a112[_0xb58d('0x7b')][_0xb58d('0x62')]));}_0x37665e=_0x5a359e[_0xb58d('0xa2')]();_0x5a359e['limit'](_0x33119f);_0x5a359e[_0xb58d('0x1b')](0x0);logger[_0xb58d('0x7c')]('Limited\x20Query:',_0x5a359e['toString']());return dbH[_0xb58d('0x7e')]['query'](_0x5a359e[_0xb58d('0x9a')](),{'type':dbH[_0xb58d('0x7e')][_0xb58d('0x7f')][_0xb58d('0x9d')]});}})[_0xb58d('0x22')](function(){return{'sql':_0x37665e[_0xb58d('0x9a')]()};})[_0xb58d('0x22')](respondWithResult(_0x5f2f2f,null))['catch'](handleError(_0x5f2f2f,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index c72ed0f..9c8300a 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 _0x1ada=['./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x5e01ba,_0x316153){var _0x553736=function(_0x37365c){while(--_0x37365c){_0x5e01ba['push'](_0x5e01ba['shift']());}};_0x553736(++_0x316153);}(_0x1ada,0x107));var _0xa1ad=function(_0x3ed921,_0x23b1a2){_0x3ed921=_0x3ed921-0x0;var _0x153c88=_0x1ada[_0x3ed921];return _0x153c88;};'use strict';var _=require(_0xa1ad('0x0'));var util=require(_0xa1ad('0x1'));var logger=require('../../config/logger')(_0xa1ad('0x2'));var moment=require(_0xa1ad('0x3'));var BPromise=require('bluebird');var rp=require(_0xa1ad('0x4'));var fs=require('fs');var path=require(_0xa1ad('0x5'));var rimraf=require(_0xa1ad('0x6'));var config=require('../../config/environment');var attributes=require(_0xa1ad('0x7'));module['exports']=function(_0x9f2494,_0x63da43){return _0x9f2494['define'](_0xa1ad('0x8'),attributes,{'tableName':_0xa1ad('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a58=['AnalyticCustomReport','lodash','util','../../config/logger','api','moment','path','rimraf','./analyticCustomReport.attributes','exports','define'];(function(_0x4aafc3,_0x363832){var _0x16f9c8=function(_0x4793ad){while(--_0x4793ad){_0x4aafc3['push'](_0x4aafc3['shift']());}};_0x16f9c8(++_0x363832);}(_0x7a58,0x1c4));var _0x87a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x87a5('0x0'));var util=require(_0x87a5('0x1'));var logger=require(_0x87a5('0x2'))(_0x87a5('0x3'));var moment=require(_0x87a5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x87a5('0x5'));var rimraf=require(_0x87a5('0x6'));var config=require('../../config/environment');var attributes=require(_0x87a5('0x7'));module[_0x87a5('0x8')]=function(_0xb0d34d,_0x2c9002){return _0xb0d34d[_0x87a5('0x9')](_0x87a5('0xa'),attributes,{'tableName':'analytics_custom_reports','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 668cc20..61fd4bf 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 _0xaa44=['request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xaa44,0x190));var _0x4aa4=function(_0xcc0b79,_0x74a2f7){_0xcc0b79=_0xcc0b79-0x0;var _0x2643a4=_0xaa44[_0xcc0b79];return _0x2643a4;};'use strict';var _=require('lodash');var util=require(_0x4aa4('0x0'));var moment=require(_0x4aa4('0x1'));var BPromise=require(_0x4aa4('0x2'));var rs=require(_0x4aa4('0x3'));var fs=require('fs');var Redis=require(_0x4aa4('0x4'));var db=require(_0x4aa4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4aa4('0x6'))('rpc');var config=require(_0x4aa4('0x7'));var jayson=require(_0x4aa4('0x8'));var client=jayson[_0x4aa4('0x9')][_0x4aa4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46564b,_0x6821d6,_0xa7a88b){return new BPromise(function(_0x2ff6d1,_0x3dcb10){return client[_0x4aa4('0xb')](_0x46564b,_0xa7a88b)['then'](function(_0x5b0a3a){logger[_0x4aa4('0xc')](_0x4aa4('0xd'),_0x6821d6,_0x4aa4('0xe'));logger[_0x4aa4('0xf')](_0x4aa4('0x10'),_0x6821d6,_0x4aa4('0xe'),JSON[_0x4aa4('0x11')](_0x5b0a3a));if(_0x5b0a3a[_0x4aa4('0x12')]){if(_0x5b0a3a[_0x4aa4('0x12')][_0x4aa4('0x13')]===0x1f4){logger[_0x4aa4('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x6821d6,_0x5b0a3a['error'][_0x4aa4('0x14')]);return _0x3dcb10(_0x5b0a3a[_0x4aa4('0x12')][_0x4aa4('0x14')]);}logger[_0x4aa4('0x12')](_0x4aa4('0xd'),_0x6821d6,_0x5b0a3a[_0x4aa4('0x12')][_0x4aa4('0x14')]);return _0x2ff6d1(_0x5b0a3a[_0x4aa4('0x12')][_0x4aa4('0x14')]);}else{logger[_0x4aa4('0xc')](_0x4aa4('0xd'),_0x6821d6,'request\x20sent');_0x2ff6d1(_0x5b0a3a[_0x4aa4('0x15')][_0x4aa4('0x14')]);}})[_0x4aa4('0x16')](function(_0x5d1b33){logger[_0x4aa4('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x6821d6,_0x5d1b33);_0x3dcb10(_0x5d1b33);});});} \ No newline at end of file +var _0x82a9=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x58f0e3,_0xb32673){var _0x5d85c7=function(_0x47497e){while(--_0x47497e){_0x58f0e3['push'](_0x58f0e3['shift']());}};_0x5d85c7(++_0xb32673);}(_0x82a9,0x131));var _0x982a=function(_0x164c83,_0x5b6ab6){_0x164c83=_0x164c83-0x0;var _0x39df56=_0x82a9[_0x164c83];return _0x39df56;};'use strict';var _=require('lodash');var util=require(_0x982a('0x0'));var moment=require(_0x982a('0x1'));var BPromise=require(_0x982a('0x2'));var rs=require(_0x982a('0x3'));var fs=require('fs');var Redis=require(_0x982a('0x4'));var db=require(_0x982a('0x5'))['db'];var utils=require(_0x982a('0x6'));var logger=require('../../config/logger')(_0x982a('0x7'));var config=require(_0x982a('0x8'));var jayson=require(_0x982a('0x9'));var client=jayson[_0x982a('0xa')][_0x982a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a1659,_0x28860a,_0x493fba){return new BPromise(function(_0x34cad9,_0x5c293a){return client[_0x982a('0xc')](_0x1a1659,_0x493fba)[_0x982a('0xd')](function(_0x16cd9f){logger[_0x982a('0xe')](_0x982a('0xf'),_0x28860a,'request\x20sent');logger['debug'](_0x982a('0x10'),_0x28860a,'request\x20sent',JSON[_0x982a('0x11')](_0x16cd9f));if(_0x16cd9f[_0x982a('0x12')]){if(_0x16cd9f[_0x982a('0x12')][_0x982a('0x13')]===0x1f4){logger[_0x982a('0x12')](_0x982a('0xf'),_0x28860a,_0x16cd9f[_0x982a('0x12')]['message']);return _0x5c293a(_0x16cd9f[_0x982a('0x12')][_0x982a('0x14')]);}logger[_0x982a('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x28860a,_0x16cd9f[_0x982a('0x12')][_0x982a('0x14')]);return _0x34cad9(_0x16cd9f[_0x982a('0x12')][_0x982a('0x14')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x28860a,_0x982a('0x15'));_0x34cad9(_0x16cd9f[_0x982a('0x16')][_0x982a('0x14')]);}})[_0x982a('0x17')](function(_0x43c472){logger[_0x982a('0x12')]('AnalyticCustomReport,\x20%s,\x20%s',_0x28860a,_0x43c472);_0x5c293a(_0x43c472);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 9febf91..390b543 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 _0x9cfc=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','preview','/:id/run','/:id/query','query','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x23450d,_0x132dc7){var _0x4c3382=function(_0x1bef02){while(--_0x1bef02){_0x23450d['push'](_0x23450d['shift']());}};_0x4c3382(++_0x132dc7);}(_0x9cfc,0x189));var _0xc9cf=function(_0x4726b4,_0x11d33b){_0x4726b4=_0x4726b4-0x0;var _0x210bac=_0x9cfc[_0x4726b4];return _0x210bac;};'use strict';var multer=require('multer');var util=require(_0xc9cf('0x0'));var path=require(_0xc9cf('0x1'));var timeout=require(_0xc9cf('0x2'));var express=require('express');var router=express[_0xc9cf('0x3')]();var fs_extra=require(_0xc9cf('0x4'));var auth=require(_0xc9cf('0x5'));var interaction=require(_0xc9cf('0x6'));var config=require(_0xc9cf('0x7'));var controller=require(_0xc9cf('0x8'));router[_0xc9cf('0x9')]('/',auth[_0xc9cf('0xa')](),controller[_0xc9cf('0xb')]);router[_0xc9cf('0x9')](_0xc9cf('0xc'),auth[_0xc9cf('0xa')](),controller[_0xc9cf('0xd')]);router[_0xc9cf('0x9')]('/:id/preview',auth[_0xc9cf('0xa')](),controller[_0xc9cf('0xe')]);router[_0xc9cf('0x9')](_0xc9cf('0xf'),auth[_0xc9cf('0xa')](),controller['run']);router[_0xc9cf('0x9')](_0xc9cf('0x10'),auth['isAuthenticated'](),controller[_0xc9cf('0x11')]);router[_0xc9cf('0x12')]('/',auth[_0xc9cf('0xa')](),controller[_0xc9cf('0x13')]);router[_0xc9cf('0x14')](_0xc9cf('0xc'),auth[_0xc9cf('0xa')](),controller[_0xc9cf('0x15')]);router[_0xc9cf('0x16')](_0xc9cf('0xc'),auth[_0xc9cf('0xa')](),controller[_0xc9cf('0x17')]);module[_0xc9cf('0x18')]=router; \ No newline at end of file +var _0x86d7=['../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','/:id','show','get','/:id/preview','run','/:id/query','query','post','create','put','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x298b27,_0x47ab26){var _0x2074bb=function(_0x33dcbd){while(--_0x33dcbd){_0x298b27['push'](_0x298b27['shift']());}};_0x2074bb(++_0x47ab26);}(_0x86d7,0x168));var _0x786d=function(_0x382500,_0x43e04e){_0x382500=_0x382500-0x0;var _0x4aa842=_0x86d7[_0x382500];return _0x4aa842;};'use strict';var multer=require(_0x786d('0x0'));var util=require(_0x786d('0x1'));var path=require(_0x786d('0x2'));var timeout=require(_0x786d('0x3'));var express=require(_0x786d('0x4'));var router=express[_0x786d('0x5')]();var fs_extra=require(_0x786d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x786d('0x7'));var config=require(_0x786d('0x8'));var controller=require(_0x786d('0x9'));router['get']('/',auth[_0x786d('0xa')](),controller[_0x786d('0xb')]);router['get'](_0x786d('0xc'),auth['isAuthenticated'](),controller[_0x786d('0xd')]);router[_0x786d('0xe')](_0x786d('0xf'),auth[_0x786d('0xa')](),controller['preview']);router['get']('/:id/run',auth[_0x786d('0xa')](),controller[_0x786d('0x10')]);router[_0x786d('0xe')](_0x786d('0x11'),auth['isAuthenticated'](),controller[_0x786d('0x12')]);router[_0x786d('0x13')]('/',auth[_0x786d('0xa')](),controller[_0x786d('0x14')]);router[_0x786d('0x15')]('/:id',auth[_0x786d('0xa')](),controller['update']);router['delete'](_0x786d('0xc'),auth[_0x786d('0xa')](),controller[_0x786d('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 c65b28a..6f23ed1 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 _0xbd51=['sequelize','STRING'];(function(_0xa0d6e8,_0x41e320){var _0x4ba300=function(_0x5ad796){while(--_0x5ad796){_0xa0d6e8['push'](_0xa0d6e8['shift']());}};_0x4ba300(++_0x41e320);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x322cc4,_0x545dfb){_0x322cc4=_0x322cc4-0x0;var _0x59febd=_0xbd51[_0x322cc4];return _0x59febd;};'use strict';var Sequelize=require(_0x1bd5('0x0'));module['exports']={'name':{'type':Sequelize[_0x1bd5('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1bd5('0x1')]},'parent':{'type':Sequelize[_0x1bd5('0x1')]},'table':{'type':Sequelize[_0x1bd5('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x1fedb6,_0x5441cb){var _0x3d50e5=function(_0x1928d6){while(--_0x1928d6){_0x1fedb6['push'](_0x1fedb6['shift']());}};_0x3d50e5(++_0x5441cb);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3e531a,_0x28a82a){_0x3e531a=_0x3e531a-0x0;var _0x3c2574=_0x5fc3[_0x3e531a];return _0x3c2574;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 28fd51a..e4e253b 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 _0x46ed=['SEC_TO_TIME(%s)','value','AnalyticMetric','select','DESC','output','fullPath','%s-%s.%s','randomstring','csv','default','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','sequelize','runReport','left_join','COUNT(%s)','MIN(%s)','AVG(%s)','Limited\x20Query:','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','params','find','create','body','user','Reports','UserProfileSection','userProfileId','autoAssociation','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','order','alias','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','QueryTypes','SELECT'];(function(_0x2a6c0d,_0x596838){var _0x4c9f43=function(_0x5a30b9){while(--_0x5a30b9){_0x2a6c0d['push'](_0x2a6c0d['shift']());}};_0x4c9f43(++_0x596838);}(_0x46ed,0x168));var _0xd46e=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x46ed[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0xf3048c,_0x27dbfb){_0x27dbfb=_0x27dbfb||0xcc;return function(_0x53b309){if(_0x53b309){return _0xf3048c['sendStatus'](_0x27dbfb);}return _0xf3048c[_0xd46e('0x1a')](_0x27dbfb)[_0xd46e('0x1b')]();};}function respondWithResult(_0x1e9aae,_0x3fdf88){_0x3fdf88=_0x3fdf88||0xc8;return function(_0x50c7c3){if(_0x50c7c3){return _0x1e9aae[_0xd46e('0x1a')](_0x3fdf88)[_0xd46e('0x1c')](_0x50c7c3);}};}function respondWithFilteredResult(_0x417402,_0x3d72ce){return function(_0x36a317){if(_0x36a317){var _0x47fa8f=typeof _0x3d72ce[_0xd46e('0x1d')]===_0xd46e('0x1e')&&typeof _0x3d72ce[_0xd46e('0x1f')]==='undefined';var _0x5ddd04=_0x36a317[_0xd46e('0x20')];var _0x1bd574=_0x47fa8f?0x0:_0x3d72ce['offset'];var _0x4fd1f2=_0x47fa8f?_0x36a317[_0xd46e('0x20')]:_0x3d72ce[_0xd46e('0x1d')]+_0x3d72ce[_0xd46e('0x1f')];var _0x2273c5;if(_0x4fd1f2>=_0x5ddd04){_0x4fd1f2=_0x5ddd04;_0x2273c5=0xc8;}else{_0x2273c5=0xce;}_0x417402[_0xd46e('0x1a')](_0x2273c5);return _0x417402[_0xd46e('0x21')](_0xd46e('0x22'),_0x1bd574+'-'+_0x4fd1f2+'/'+_0x5ddd04)[_0xd46e('0x1c')](_0x36a317);}return null;};}function patchUpdates(_0xb4940){return function(_0x3c7e91){try{jsonpatch[_0xd46e('0x23')](_0x3c7e91,_0xb4940,!![]);}catch(_0x5ba94d){return BPromise[_0xd46e('0x24')](_0x5ba94d);}return _0x3c7e91[_0xd46e('0x25')]();};}function saveUpdates(_0x79aa51,_0x45ce0b){return function(_0x128246){if(_0x128246){return _0x128246[_0xd46e('0x26')](_0x79aa51)[_0xd46e('0x27')](function(_0x8a1be){return _0x8a1be;});}return null;};}function removeEntity(_0x62dea5,_0x4cf899){return function(_0x314570){if(_0x314570){return _0x314570['destroy']()['then'](function(){var _0x371054=_0x314570[_0xd46e('0x28')]({'plain':!![]});var _0x21135f=_0xd46e('0x29');return db[_0xd46e('0x2a')][_0xd46e('0x2b')]({'where':{'type':_0x21135f,'resourceId':_0x371054['id']}})[_0xd46e('0x27')](function(){return _0x314570;});})['then'](function(){_0x62dea5[_0xd46e('0x1a')](0xcc)[_0xd46e('0x1b')]();});}};}function handleEntityNotFound(_0xddbce9,_0x17db79){return function(_0x96f15c){if(!_0x96f15c){_0xddbce9[_0xd46e('0x2c')](0x194);}return _0x96f15c;};}function handleError(_0x58aeef,_0x465d54){_0x465d54=_0x465d54||0x1f4;return function(_0x3a1ced){logger[_0xd46e('0x2d')](_0x3a1ced[_0xd46e('0x2e')]);if(_0x3a1ced[_0xd46e('0x2f')]){delete _0x3a1ced[_0xd46e('0x2f')];}_0x58aeef[_0xd46e('0x1a')](_0x465d54)[_0xd46e('0x30')](_0x3a1ced);};}exports[_0xd46e('0x31')]=function(_0x45ea47,_0x2ff785){var _0x504324={},_0x2f4a1b={},_0x5ed8dc={'count':0x0,'rows':[]};var _0x1248ce=_[_0xd46e('0x32')](db[_0xd46e('0x33')][_0xd46e('0x34')],function(_0x5ef248){return{'name':_0x5ef248[_0xd46e('0x35')],'type':_0x5ef248[_0xd46e('0x36')]['key']};});_0x2f4a1b[_0xd46e('0x37')]=_[_0xd46e('0x32')](_0x1248ce,'name');_0x2f4a1b[_0xd46e('0x38')]=_[_0xd46e('0x39')](_0x45ea47[_0xd46e('0x38')]);_0x2f4a1b['filters']=_['intersection'](_0x2f4a1b[_0xd46e('0x37')],_0x2f4a1b[_0xd46e('0x38')]);_0x504324[_0xd46e('0x3a')]=_[_0xd46e('0x3b')](_0x2f4a1b[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x504324['attributes']=_0x504324[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x504324[_0xd46e('0x3a')]:_0x2f4a1b[_0xd46e('0x37')];if(!_0x45ea47[_0xd46e('0x38')][_0xd46e('0x3e')](_0xd46e('0x3f'))){_0x504324['limit']=qs[_0xd46e('0x1f')](_0x45ea47[_0xd46e('0x38')]['limit']);_0x504324[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x1d')]);}_0x504324['order']=qs[_0xd46e('0x40')](_0x45ea47[_0xd46e('0x38')][_0xd46e('0x40')]);_0x504324[_0xd46e('0x41')]=qs[_0xd46e('0x42')](_[_0xd46e('0x43')](_0x45ea47[_0xd46e('0x38')],_0x2f4a1b[_0xd46e('0x42')]),_0x1248ce);if(_0x45ea47['query'][_0xd46e('0x44')]){_0x504324[_0xd46e('0x41')]=_[_0xd46e('0x45')](_0x504324[_0xd46e('0x41')],{'$or':_[_0xd46e('0x32')](_0x1248ce,function(_0x56f99c){if(_0x56f99c[_0xd46e('0x36')]!=='VIRTUAL'){var _0x55230d={};_0x55230d[_0x56f99c['name']]={'$like':'%'+_0x45ea47['query'][_0xd46e('0x44')]+'%'};return _0x55230d;}})});}_0x504324=_['merge']({},_0x504324,_0x45ea47[_0xd46e('0x46')]);var _0x40720e={'where':_0x504324['where']};return db[_0xd46e('0x33')][_0xd46e('0x20')](_0x40720e)[_0xd46e('0x27')](function(_0x31ba12){_0x5ed8dc[_0xd46e('0x20')]=_0x31ba12;if(_0x45ea47[_0xd46e('0x38')][_0xd46e('0x47')]){_0x504324[_0xd46e('0x48')]=[{'all':!![]}];}return db[_0xd46e('0x33')][_0xd46e('0x49')](_0x504324);})[_0xd46e('0x27')](function(_0x5ea048){_0x5ed8dc['rows']=_0x5ea048;return _0x5ed8dc;})['then'](respondWithFilteredResult(_0x2ff785,_0x504324))[_0xd46e('0x4a')](handleError(_0x2ff785,null));};exports['show']=function(_0x168d35,_0x272f5f){var _0x3fdf67={'raw':!![],'where':{'id':_0x168d35[_0xd46e('0x4b')]['id']}},_0x416505={};_0x416505[_0xd46e('0x37')]=_[_0xd46e('0x39')](db[_0xd46e('0x33')]['rawAttributes']);_0x416505[_0xd46e('0x38')]=_['keys'](_0x168d35[_0xd46e('0x38')]);_0x416505[_0xd46e('0x42')]=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],_0x416505[_0xd46e('0x38')]);_0x3fdf67['attributes']=_[_0xd46e('0x3b')](_0x416505[_0xd46e('0x37')],qs[_0xd46e('0x3c')](_0x168d35[_0xd46e('0x38')][_0xd46e('0x3c')]));_0x3fdf67['attributes']=_0x3fdf67[_0xd46e('0x3a')][_0xd46e('0x3d')]?_0x3fdf67[_0xd46e('0x3a')]:_0x416505[_0xd46e('0x37')];if(_0x168d35[_0xd46e('0x38')]['includeAll']){_0x3fdf67[_0xd46e('0x48')]=[{'all':!![]}];}_0x3fdf67=_[_0xd46e('0x45')]({},_0x3fdf67,_0x168d35[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fdf67)[_0xd46e('0x27')](handleEntityNotFound(_0x272f5f,null))[_0xd46e('0x27')](respondWithResult(_0x272f5f,null))[_0xd46e('0x4a')](handleError(_0x272f5f,null));};exports['create']=function(_0xf9dab,_0x71a8dc){return db[_0xd46e('0x33')][_0xd46e('0x4d')](_0xf9dab[_0xd46e('0x4e')],{})['then'](function(_0x4ae314){var _0x3a94cf=_0xf9dab[_0xd46e('0x4f')][_0xd46e('0x28')]({'plain':!![]});if(!_0x3a94cf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a94cf['role']===_0xd46e('0x4f')){var _0x9d8638=_0x4ae314['get']({'plain':!![]});var _0x2eee92=_0xd46e('0x50');return db[_0xd46e('0x51')][_0xd46e('0x4c')]({'where':{'name':_0x2eee92,'userProfileId':_0x3a94cf[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x27')](function(_0x80ed51){if(_0x80ed51&&_0x80ed51[_0xd46e('0x53')]===0x0){return db['UserProfileResource'][_0xd46e('0x4d')]({'name':_0x9d8638[_0xd46e('0x2f')],'resourceId':_0x9d8638['id'],'type':_0xd46e('0x29'),'sectionId':_0x80ed51['id']},{})[_0xd46e('0x27')](function(){return _0x4ae314;});}else{return _0x4ae314;}})['catch'](function(_0x56dd9a){logger[_0xd46e('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x56dd9a);throw _0x56dd9a;});}return _0x4ae314;})[_0xd46e('0x27')](respondWithResult(_0x71a8dc,0xc9))[_0xd46e('0x4a')](handleError(_0x71a8dc,null));};exports[_0xd46e('0x26')]=function(_0x31f7eb,_0x5a7870){if(_0x31f7eb[_0xd46e('0x4e')]['id']){delete _0x31f7eb['body']['id'];}return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x31f7eb[_0xd46e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7870,null))[_0xd46e('0x27')](saveUpdates(_0x31f7eb[_0xd46e('0x4e')],null))[_0xd46e('0x27')](respondWithResult(_0x5a7870,null))[_0xd46e('0x4a')](handleError(_0x5a7870,null));};exports[_0xd46e('0x2b')]=function(_0x2cc676,_0x2760ef){return db[_0xd46e('0x33')][_0xd46e('0x4c')]({'where':{'id':_0x2cc676[_0xd46e('0x4b')]['id']}})[_0xd46e('0x27')](handleEntityNotFound(_0x2760ef,null))[_0xd46e('0x27')](removeEntity(_0x2760ef,null))[_0xd46e('0x4a')](handleError(_0x2760ef,null));};exports[_0xd46e('0x54')]=function(_0x47a86c,_0x3ec709){var _0x37a22f=0xa;var _0xe0cd61=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0xaf9641={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x481dce={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x2dacb4=function(_0x2f9fcb){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x2f9fcb);};var _0x1aaa99=function(_0x272514){if(!_0x272514||!_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x476f09='(',_0x5067b7=0x0;_0x5067b7<_0x272514[_0xd46e('0x67')][_0xd46e('0x3d')];_0x5067b7+=0x1){_0x5067b7>0x0&&(_0x476f09+='\x20'+_0x272514[_0xd46e('0x68')]+'\x20');_0x476f09+=_0x272514['rules'][_0x5067b7][_0xd46e('0x69')]?_0x1aaa99(_0x272514[_0xd46e('0x67')][_0x5067b7]['group']):_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6a')]+'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['condition']+(_0x2dacb4(_0x272514[_0xd46e('0x67')][_0x5067b7][_0xd46e('0x6b')])?'\x20'+_0x272514[_0xd46e('0x67')][_0x5067b7]['value']:'');}return _0x476f09+')';};var _0xe5f8cd={'where':{'id':_0x47a86c[_0xd46e('0x4b')]['id']}},_0x516e7d,_0x32eed0,_0x148187,_0x35db1b,_0x4f3ba0;_0xe5f8cd=_[_0xd46e('0x45')]({},_0xe5f8cd,_0x47a86c[_0xd46e('0x46')]);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0xe5f8cd)[_0xd46e('0x27')](function(_0x16f906){if(_0x16f906){_0x516e7d=_0x16f906;return _0x16f906[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0x3e55a3){if(_0x3e55a3){if(!_0x3e55a3[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))](_0xd46e('0x6f'),0x193);}_0x32eed0=_0x3e55a3;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3e0ed5){if(_0x3e0ed5){_0x148187=_[_0xd46e('0x70')](_0x3e0ed5,'id');var _0x2fff69;var _0x249938=squel['select']();_0x249938[_0xd46e('0x71')](_0x516e7d[_0xd46e('0x72')]);for(var _0xfb4073=0x0;_0xfb4073<_0x32eed0[_0xd46e('0x3d')];_0xfb4073+=0x1){_0x2fff69=_0x32eed0[_0xfb4073]['MetricId']?_0x148187[_0x32eed0[_0xfb4073][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x32eed0[_0xfb4073]['field'];_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0xaf9641[_0x32eed0[_0xfb4073]['function']],'%s',_0x2fff69):_0x2fff69;_0x2fff69=_0x32eed0[_0xfb4073][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x481dce[_0x32eed0[_0xfb4073]['format']],'%s',_0x2fff69):_0x2fff69;if(_0x32eed0[_0xfb4073][_0xd46e('0x78')]){_0x249938['group'](_0x2fff69);}_0x32eed0[_0xfb4073][_0xd46e('0x79')]&&_0x249938[_0xd46e('0x7a')](_0x2fff69,_0x32eed0[_0xfb4073]['orderBy']==='DESC'?![]:!![]);_0x249938[_0xd46e('0x6a')](_0x2fff69,_0x32eed0[_0xfb4073][_0xd46e('0x7b')]||_0x2fff69);}if(_0x516e7d[_0xd46e('0x7c')]){_0x516e7d[_0xd46e('0x7c')]=JSON['parse'](_0x516e7d[_0xd46e('0x7c')]);for(var _0x372509=0x0;_0x372509<_0x516e7d['joins'][_0xd46e('0x3d')];_0x372509+=0x1){if(_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0xe0cd61,_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x36')])&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7d')]&&_0x516e7d[_0xd46e('0x7c')][_0x372509]['foreignTable']&&_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7e')]){_0x249938[_0x516e7d['joins'][_0x372509][_0xd46e('0x36')]](_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0x516e7d[_0xd46e('0x72')],_0x516e7d['joins'][_0x372509]['parentKey'],_0x516e7d[_0xd46e('0x7c')][_0x372509][_0xd46e('0x7f')],_0x516e7d['joins'][_0x372509]['foreignKey']));}}}if(_0x516e7d['conditions']){_0x516e7d[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x516e7d[_0xd46e('0x81')]);_0x249938['where'](_0x1aaa99(_0x516e7d[_0xd46e('0x81')][_0xd46e('0x69')]));}_0x4f3ba0=_0x249938[_0xd46e('0x83')]();_0x249938['limit'](_0x37a22f);_0x249938['offset'](0x0);logger['debug']('Limited\x20Query:',_0x249938[_0xd46e('0x84')]());return dbH['sequelize'][_0xd46e('0x38')](_0x249938['toString'](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](respondWithResult(_0x3ec709,null))[_0xd46e('0x4a')](handleError(_0x3ec709,null));};function runReport(_0xf16d87,_0x99872a,_0x57a7cc){var _0x586024=_0x99872a[_0xd46e('0x2f')];var _0x383919=0xa;var _0x114f2c=[_0xd46e('0x55'),'left_join',_0xd46e('0x56'),_0xd46e('0x57')];var _0x4ca21f={'SUM':_0xd46e('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':_0xd46e('0x5c'),'GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x5ef4cc={'SEC_TO_TIME':_0xd46e('0x87'),'DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':_0xd46e('0x61')};var _0x88460a=function(_0x3a3744){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),_0xd46e('0x64'),_0xd46e('0x65'),_0xd46e('0x66')],_0x3a3744);};var _0x3c476d=function(_0x1b2a6d){if(!_0x1b2a6d||!_0x1b2a6d[_0xd46e('0x67')][_0xd46e('0x3d')]){return'';}for(var _0x441f73='(',_0x1d2738=0x0;_0x1d2738<_0x1b2a6d['rules'][_0xd46e('0x3d')];_0x1d2738+=0x1){_0x1d2738>0x0&&(_0x441f73+='\x20'+_0x1b2a6d['operator']+'\x20');_0x441f73+=_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x69')]?_0x3c476d(_0x1b2a6d['rules'][_0x1d2738][_0xd46e('0x69')]):_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6a')]+'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')]+(_0x88460a(_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x6b')])?'\x20'+_0x1b2a6d[_0xd46e('0x67')][_0x1d2738][_0xd46e('0x88')]:'');}return _0x441f73+')';};var _0x3fa34d={'where':{'id':_0xf16d87['id']}},_0xc098c9,_0x5f5ba7,_0x493df5,_0x18e140,_0x459a0c;_0x3fa34d=_[_0xd46e('0x45')]({},_0x3fa34d,_0x57a7cc);return db[_0xd46e('0x33')][_0xd46e('0x4c')](_0x3fa34d)[_0xd46e('0x27')](function(_0x5b554e){if(_0x5b554e){_0xc098c9=_0x5b554e;return _0x5b554e[_0xd46e('0x6c')]();}return null;})[_0xd46e('0x27')](function(_0xa254f5){if(_0xa254f5){if(!_0xa254f5[_0xd46e('0x3d')]){throw new db[(_0xd46e('0x6d'))][(_0xd46e('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5f5ba7=_0xa254f5;return db[_0xd46e('0x89')][_0xd46e('0x49')]({'raw':!![]});}return null;})['then'](function(_0x3c8d68){if(_0x3c8d68){_0x493df5=_[_0xd46e('0x70')](_0x3c8d68,'id');var _0x9e222d;var _0x3da17e=squel[_0xd46e('0x8a')]();_0x3da17e[_0xd46e('0x71')](_0xc098c9[_0xd46e('0x72')]);for(var _0x282f71=0x0;_0x282f71<_0x5f5ba7[_0xd46e('0x3d')];_0x282f71+=0x1){_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x73')]?_0x493df5[_0x5f5ba7[_0x282f71][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x5f5ba7[_0x282f71][_0xd46e('0x6a')];_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x75')]?_['replace'](_0x4ca21f[_0x5f5ba7[_0x282f71]['function']],'%s',_0x9e222d):_0x9e222d;_0x9e222d=_0x5f5ba7[_0x282f71][_0xd46e('0x77')]?_[_0xd46e('0x76')](_0x5ef4cc[_0x5f5ba7[_0x282f71][_0xd46e('0x77')]],'%s',_0x9e222d):_0x9e222d;if(_0x5f5ba7[_0x282f71][_0xd46e('0x78')]){_0x3da17e[_0xd46e('0x69')](_0x9e222d);}_0x5f5ba7[_0x282f71][_0xd46e('0x79')]&&_0x3da17e['order'](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x3da17e[_0xd46e('0x6a')](_0x9e222d,_0x5f5ba7[_0x282f71][_0xd46e('0x7b')]||_0x9e222d);}if(_0xc098c9['joins']){_0xc098c9[_0xd46e('0x7c')]=JSON[_0xd46e('0x82')](_0xc098c9['joins']);for(var _0xdf967c=0x0;_0xdf967c<_0xc098c9['joins']['length'];_0xdf967c+=0x1){if(_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x114f2c,_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['type'])&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7d')]&&_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7f')]&&_0xc098c9['joins'][_0xdf967c]['foreignKey']){_0x3da17e[_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x36')]](_0xc098c9['joins'][_0xdf967c]['foreignTable'],null,util[_0xd46e('0x77')](_0xd46e('0x80'),_0xc098c9[_0xd46e('0x72')],_0xc098c9[_0xd46e('0x7c')][_0xdf967c]['parentKey'],_0xc098c9[_0xd46e('0x7c')][_0xdf967c][_0xd46e('0x7f')],_0xc098c9['joins'][_0xdf967c][_0xd46e('0x7e')]));}}}if(_0xc098c9[_0xd46e('0x81')]){_0xc098c9[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0xc098c9[_0xd46e('0x81')]);_0x3da17e[_0xd46e('0x41')](_0x3c476d(_0xc098c9['conditions'][_0xd46e('0x69')]));}_0x459a0c=_0x3da17e[_0xd46e('0x83')]();_0x3da17e['limit'](_0x383919);_0x3da17e['offset'](0x0);return;}})[_0xd46e('0x27')](function(){if(_0x99872a[_0xd46e('0x8c')]==='web'){return null;}var _0x5e637d=_[_0xd46e('0x45')](_0x99872a,{'name':_0x99872a[_0xd46e('0x8d')]||_0x99872a['name']||_0xc098c9[_0xd46e('0x2f')],'basename':_0x586024,'savename':util[_0xd46e('0x77')](_0xd46e('0x8e'),_0x99872a[_0xd46e('0x2f')]||_0xc098c9[_0xd46e('0x2f')],require(_0xd46e('0x8f'))['generate'](0x4),_0x99872a[_0xd46e('0x8c')]||_0xd46e('0x90')),'reportId':_0xc098c9['id'],'reportType':_0xd46e('0x91')});return db[_0xd46e('0x92')][_0xd46e('0x4d')](_0x5e637d,{'raw':!![]});})[_0xd46e('0x27')](function(_0x3311a6){if(_0xc098c9[_0xd46e('0x72')]===_0xd46e('0x93')){_0x459a0c[_0xd46e('0x41')](_0xc098c9[_0xd46e('0x72')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x99872a[_0xd46e('0x94')],_0x99872a['endDate']);}else{_0x459a0c['where'](_0xc098c9[_0xd46e('0x72')]+_0xd46e('0x95'),_0x99872a[_0xd46e('0x94')],_0x99872a[_0xd46e('0x96')]);}if(_0x3311a6){logger[_0xd46e('0x97')](_0xd46e('0x98'),_0x459a0c[_0xd46e('0x84')]());require(_0xd46e('0x99'))['fork'](path[_0xd46e('0x55')](__dirname,'../../components/export/',_0x3311a6[_0xd46e('0x8c')]),[_0x3311a6['id'],_0x459a0c[_0xd46e('0x84')](),path[_0xd46e('0x55')](__dirname,_0xd46e('0x9a'),_0x3311a6[_0xd46e('0x9b')]),_0x586024]);return _0x3311a6;}else{var _0x399918=squel[_0xd46e('0x8a')]();_0x399918[_0xd46e('0x71')]('('+_0x459a0c['toString']()+')',_0xd46e('0x9c'));_0x399918[_0xd46e('0x6a')](_0xd46e('0x9d'),'count');_0x459a0c[_0xd46e('0x1f')](_0x99872a[_0xd46e('0x1f')]||_0x383919);_0x459a0c[_0xd46e('0x1d')](_0x99872a['offset']||0x0);return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x399918[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]})['then'](function(_0x4967ff){if(!_0x4967ff[_0xd46e('0x3d')]){_0x18e140=0x0;}else{_0x18e140=_0x4967ff[0x0][_0xd46e('0x20')]||0x0;}return dbH['sequelize'][_0xd46e('0x38')](_0x459a0c[_0xd46e('0x84')](),{'type':dbH[_0xd46e('0x9e')][_0xd46e('0x85')][_0xd46e('0x86')]});})[_0xd46e('0x27')](function(_0x4bb76b){return{'rows':_0x4bb76b||[],'count':_0x18e140};});}});}exports['run']=function(_0x204a9f,_0x52ca5a){return runReport(_0x204a9f[_0xd46e('0x4b')],_0x204a9f[_0xd46e('0x38')],_0x204a9f['options'])[_0xd46e('0x27')](respondWithResult(_0x52ca5a,null))[_0xd46e('0x4a')](handleError(_0x52ca5a,null));};exports[_0xd46e('0x9f')]=runReport;exports[_0xd46e('0x38')]=function(_0x786ae,_0x537c73){var _0x1610bd=0xa;var _0x20cc4c=[_0xd46e('0x55'),_0xd46e('0xa0'),_0xd46e('0x56'),_0xd46e('0x57')];var _0x368742={'SUM':_0xd46e('0x58'),'COUNT':_0xd46e('0xa1'),'COUNT DISTINCT':_0xd46e('0x59'),'MAX':_0xd46e('0x5a'),'MIN':_0xd46e('0xa2'),'AVG':_0xd46e('0xa3'),'GROUP_CONCAT':_0xd46e('0x5b'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd46e('0x5d')};var _0x285cf8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xd46e('0x5e'),'HOUR':_0xd46e('0x5f'),'ROUND':_0xd46e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0xc87da2=function(_0x195f02){return!_[_0xd46e('0x62')]([_0xd46e('0x63'),'IS\x20NOT\x20NULL',_0xd46e('0x65'),_0xd46e('0x66')],_0x195f02);};var _0x44322f=function(_0x49959f){if(!_0x49959f||!_0x49959f['rules'][_0xd46e('0x3d')]){return'';}for(var _0x2094e5='(',_0x85aac1=0x0;_0x85aac1<_0x49959f[_0xd46e('0x67')][_0xd46e('0x3d')];_0x85aac1+=0x1){_0x85aac1>0x0&&(_0x2094e5+='\x20'+_0x49959f[_0xd46e('0x68')]+'\x20');_0x2094e5+=_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]?_0x44322f(_0x49959f['rules'][_0x85aac1][_0xd46e('0x69')]):_0x49959f['rules'][_0x85aac1][_0xd46e('0x6a')]+'\x20'+_0x49959f['rules'][_0x85aac1]['condition']+(_0xc87da2(_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x6b')])?'\x20'+_0x49959f[_0xd46e('0x67')][_0x85aac1][_0xd46e('0x88')]:'');}return _0x2094e5+')';};var _0x101a29={'where':{'id':_0x786ae[_0xd46e('0x4b')]['id']}},_0x3a44da,_0x417068,_0x52e73e,_0x206077,_0xe729b6;_0x101a29=_[_0xd46e('0x45')]({},_0x101a29,_0x786ae[_0xd46e('0x46')]);return db['AnalyticDefaultReport'][_0xd46e('0x4c')](_0x101a29)[_0xd46e('0x27')](function(_0x1d08bb){if(_0x1d08bb){_0x3a44da=_0x1d08bb;return _0x1d08bb['getFields']();}return null;})[_0xd46e('0x27')](function(_0x8c6ed1){if(_0x8c6ed1){if(!_0x8c6ed1['length']){throw new db['Sequelize']['ValidationErrorItem'](_0xd46e('0x6f'),0x193);}_0x417068=_0x8c6ed1;return db[_0xd46e('0x89')]['findAll']({'raw':!![]});}return null;})[_0xd46e('0x27')](function(_0x3a13f8){if(_0x3a13f8){_0x52e73e=_['keyBy'](_0x3a13f8,'id');var _0x5a8661;var _0x157fb0=squel[_0xd46e('0x8a')]();_0x157fb0[_0xd46e('0x71')](_0x3a44da[_0xd46e('0x72')]);for(var _0x50750f=0x0;_0x50750f<_0x417068['length'];_0x50750f+=0x1){_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x73')]?_0x52e73e[_0x417068[_0x50750f][_0xd46e('0x73')]][_0xd46e('0x74')]:_0x417068[_0x50750f][_0xd46e('0x6a')];_0x5a8661=_0x417068[_0x50750f][_0xd46e('0x75')]?_[_0xd46e('0x76')](_0x368742[_0x417068[_0x50750f][_0xd46e('0x75')]],'%s',_0x5a8661):_0x5a8661;_0x5a8661=_0x417068[_0x50750f]['format']?_[_0xd46e('0x76')](_0x285cf8[_0x417068[_0x50750f][_0xd46e('0x77')]],'%s',_0x5a8661):_0x5a8661;if(_0x417068[_0x50750f]['groupBy']){_0x157fb0[_0xd46e('0x69')](_0x5a8661);}_0x417068[_0x50750f][_0xd46e('0x79')]&&_0x157fb0[_0xd46e('0x7a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x79')]===_0xd46e('0x8b')?![]:!![]);_0x157fb0[_0xd46e('0x6a')](_0x5a8661,_0x417068[_0x50750f][_0xd46e('0x7b')]||_0x5a8661);}if(_0x3a44da[_0xd46e('0x7c')]){_0x3a44da['joins']=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x7c')]);for(var _0x3c819b=0x0;_0x3c819b<_0x3a44da[_0xd46e('0x7c')][_0xd46e('0x3d')];_0x3c819b+=0x1){if(_0x3a44da['joins'][_0x3c819b][_0xd46e('0x36')]&&_[_0xd46e('0x62')](_0x20cc4c,_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')])&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7d')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')]&&_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']){_0x157fb0[_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x36')]](_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3a44da[_0xd46e('0x72')],_0x3a44da['joins'][_0x3c819b][_0xd46e('0x7d')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b][_0xd46e('0x7f')],_0x3a44da[_0xd46e('0x7c')][_0x3c819b]['foreignKey']));}}}if(_0x3a44da[_0xd46e('0x81')]){_0x3a44da[_0xd46e('0x81')]=JSON[_0xd46e('0x82')](_0x3a44da[_0xd46e('0x81')]);_0x157fb0[_0xd46e('0x41')](_0x44322f(_0x3a44da[_0xd46e('0x81')][_0xd46e('0x69')]));}_0xe729b6=_0x157fb0[_0xd46e('0x83')]();_0x157fb0[_0xd46e('0x1f')](_0x1610bd);_0x157fb0['offset'](0x0);logger['debug'](_0xd46e('0xa4'),_0x157fb0['toString']());return dbH[_0xd46e('0x9e')][_0xd46e('0x38')](_0x157fb0[_0xd46e('0x84')](),{'type':dbH['sequelize'][_0xd46e('0x85')][_0xd46e('0x86')]});}})[_0xd46e('0x27')](function(){return{'sql':_0xe729b6['toString']()};})['then'](respondWithResult(_0x537c73,null))[_0xd46e('0x4a')](handleError(_0x537c73,null));}; \ No newline at end of file +var _0xe2fe=['set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','sendStatus','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','groupBy','orderBy','alias','joins','parse','type','foreignTable','%s.%s\x20=\x20%s.%s','table','parentKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20EMPTY','getFields','format','foreignKey','web','%s-%s.%s','randomstring','generate','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','../../components/export/','savename','countTable','COUNT(*)','run','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20NOT\x20EMPTY','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','dbH','status','json','offset','limit','undefined','count'];(function(_0x5933bb,_0x546730){var _0x193a96=function(_0x3b3ee4){while(--_0x3b3ee4){_0x5933bb['push'](_0x5933bb['shift']());}};_0x193a96(++_0x546730);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];var dbH=require(_0xee2f('0x10'))[_0xee2f('0x11')];function respondWithStatusCode(_0x100449,_0x131874){_0x131874=_0x131874||0xcc;return function(_0x3ab91f){if(_0x3ab91f){return _0x100449['sendStatus'](_0x131874);}return _0x100449[_0xee2f('0x12')](_0x131874)['end']();};}function respondWithResult(_0x36db10,_0x271c1d){_0x271c1d=_0x271c1d||0xc8;return function(_0x48b30c){if(_0x48b30c){return _0x36db10[_0xee2f('0x12')](_0x271c1d)[_0xee2f('0x13')](_0x48b30c);}};}function respondWithFilteredResult(_0x28b614,_0x1bbf7d){return function(_0x390c2c){if(_0x390c2c){var _0x58f42a=typeof _0x1bbf7d[_0xee2f('0x14')]==='undefined'&&typeof _0x1bbf7d[_0xee2f('0x15')]===_0xee2f('0x16');var _0x502eb6=_0x390c2c['count'];var _0x40b5bc=_0x58f42a?0x0:_0x1bbf7d['offset'];var _0x69db88=_0x58f42a?_0x390c2c[_0xee2f('0x17')]:_0x1bbf7d[_0xee2f('0x14')]+_0x1bbf7d['limit'];var _0x35e1a4;if(_0x69db88>=_0x502eb6){_0x69db88=_0x502eb6;_0x35e1a4=0xc8;}else{_0x35e1a4=0xce;}_0x28b614[_0xee2f('0x12')](_0x35e1a4);return _0x28b614[_0xee2f('0x18')](_0xee2f('0x19'),_0x40b5bc+'-'+_0x69db88+'/'+_0x502eb6)[_0xee2f('0x13')](_0x390c2c);}return null;};}function patchUpdates(_0x5d36d4){return function(_0x5e73ad){try{jsonpatch[_0xee2f('0x1a')](_0x5e73ad,_0x5d36d4,!![]);}catch(_0x3a1852){return BPromise[_0xee2f('0x1b')](_0x3a1852);}return _0x5e73ad[_0xee2f('0x1c')]();};}function saveUpdates(_0x472e3b,_0xf278cc){return function(_0x39a39c){if(_0x39a39c){return _0x39a39c['update'](_0x472e3b)[_0xee2f('0x1d')](function(_0x2c47c5){return _0x2c47c5;});}return null;};}function removeEntity(_0x15ceda,_0x70e308){return function(_0x820101){if(_0x820101){return _0x820101[_0xee2f('0x1e')]()[_0xee2f('0x1d')](function(){var _0x13013f=_0x820101[_0xee2f('0x1f')]({'plain':!![]});var _0x1e394f=_0xee2f('0x20');return db[_0xee2f('0x21')][_0xee2f('0x1e')]({'where':{'type':_0x1e394f,'resourceId':_0x13013f['id']}})[_0xee2f('0x1d')](function(){return _0x820101;});})['then'](function(){_0x15ceda['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bdbb,_0x18ff19){return function(_0x2cb0cb){if(!_0x2cb0cb){_0x18bdbb[_0xee2f('0x22')](0x194);}return _0x2cb0cb;};}function handleError(_0x892a4e,_0x3737fd){_0x3737fd=_0x3737fd||0x1f4;return function(_0x4d8398){logger[_0xee2f('0x23')](_0x4d8398['stack']);if(_0x4d8398[_0xee2f('0x24')]){delete _0x4d8398[_0xee2f('0x24')];}_0x892a4e[_0xee2f('0x12')](_0x3737fd)[_0xee2f('0x25')](_0x4d8398);};}exports[_0xee2f('0x26')]=function(_0x47d5a6,_0x310c0b){var _0xd16e35={},_0x56706e={},_0x4ee0e1={'count':0x0,'rows':[]};var _0xd1aaac=_['map'](db[_0xee2f('0x27')][_0xee2f('0x28')],function(_0x53d9b7){return{'name':_0x53d9b7[_0xee2f('0x29')],'type':_0x53d9b7['type']['key']};});_0x56706e['model']=_[_0xee2f('0x2a')](_0xd1aaac,_0xee2f('0x24'));_0x56706e['query']=_[_0xee2f('0x2b')](_0x47d5a6[_0xee2f('0x2c')]);_0x56706e[_0xee2f('0x2d')]=_[_0xee2f('0x2e')](_0x56706e[_0xee2f('0x2f')],_0x56706e['query']);_0xd16e35[_0xee2f('0x30')]=_['intersection'](_0x56706e[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x47d5a6[_0xee2f('0x2c')]['fields']));_0xd16e35[_0xee2f('0x30')]=_0xd16e35['attributes'][_0xee2f('0x32')]?_0xd16e35['attributes']:_0x56706e[_0xee2f('0x2f')];if(!_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x33')](_0xee2f('0x34'))){_0xd16e35[_0xee2f('0x15')]=qs[_0xee2f('0x15')](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x15')]);_0xd16e35[_0xee2f('0x14')]=qs[_0xee2f('0x14')](_0x47d5a6[_0xee2f('0x2c')]['offset']);}_0xd16e35[_0xee2f('0x35')]=qs['sort'](_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x36')]);_0xd16e35[_0xee2f('0x37')]=qs[_0xee2f('0x2d')](_[_0xee2f('0x38')](_0x47d5a6[_0xee2f('0x2c')],_0x56706e[_0xee2f('0x2d')]),_0xd1aaac);if(_0x47d5a6[_0xee2f('0x2c')]['filter']){_0xd16e35['where']=_['merge'](_0xd16e35[_0xee2f('0x37')],{'$or':_['map'](_0xd1aaac,function(_0x4501c4){if(_0x4501c4['type']!=='VIRTUAL'){var _0x5027a6={};_0x5027a6[_0x4501c4['name']]={'$like':'%'+_0x47d5a6[_0xee2f('0x2c')][_0xee2f('0x39')]+'%'};return _0x5027a6;}})});}_0xd16e35=_[_0xee2f('0x3a')]({},_0xd16e35,_0x47d5a6[_0xee2f('0x3b')]);var _0x4823a7={'where':_0xd16e35['where']};return db[_0xee2f('0x27')]['count'](_0x4823a7)['then'](function(_0x8204dc){_0x4ee0e1[_0xee2f('0x17')]=_0x8204dc;if(_0x47d5a6[_0xee2f('0x2c')]['includeAll']){_0xd16e35[_0xee2f('0x3c')]=[{'all':!![]}];}return db[_0xee2f('0x27')][_0xee2f('0x3d')](_0xd16e35);})['then'](function(_0x5896f6){_0x4ee0e1[_0xee2f('0x3e')]=_0x5896f6;return _0x4ee0e1;})[_0xee2f('0x1d')](respondWithFilteredResult(_0x310c0b,_0xd16e35))[_0xee2f('0x3f')](handleError(_0x310c0b,null));};exports[_0xee2f('0x40')]=function(_0x541fa0,_0x20697e){var _0x1df63d={'raw':!![],'where':{'id':_0x541fa0[_0xee2f('0x41')]['id']}},_0x242e91={};_0x242e91[_0xee2f('0x2f')]=_[_0xee2f('0x2b')](db[_0xee2f('0x27')][_0xee2f('0x28')]);_0x242e91[_0xee2f('0x2c')]=_[_0xee2f('0x2b')](_0x541fa0['query']);_0x242e91['filters']=_['intersection'](_0x242e91['model'],_0x242e91[_0xee2f('0x2c')]);_0x1df63d[_0xee2f('0x30')]=_[_0xee2f('0x2e')](_0x242e91[_0xee2f('0x2f')],qs[_0xee2f('0x31')](_0x541fa0['query'][_0xee2f('0x31')]));_0x1df63d[_0xee2f('0x30')]=_0x1df63d[_0xee2f('0x30')][_0xee2f('0x32')]?_0x1df63d['attributes']:_0x242e91['model'];if(_0x541fa0['query'][_0xee2f('0x42')]){_0x1df63d['include']=[{'all':!![]}];}_0x1df63d=_['merge']({},_0x1df63d,_0x541fa0['options']);return db['AnalyticDefaultReport'][_0xee2f('0x43')](_0x1df63d)[_0xee2f('0x1d')](handleEntityNotFound(_0x20697e,null))[_0xee2f('0x1d')](respondWithResult(_0x20697e,null))['catch'](handleError(_0x20697e,null));};exports[_0xee2f('0x44')]=function(_0x57f65d,_0x3d95b8){return db[_0xee2f('0x27')][_0xee2f('0x44')](_0x57f65d[_0xee2f('0x45')],{})[_0xee2f('0x1d')](function(_0x4978eb){var _0x533ad0=_0x57f65d[_0xee2f('0x46')]['get']({'plain':!![]});if(!_0x533ad0)throw new Error(_0xee2f('0x47'));if(_0x533ad0[_0xee2f('0x48')]===_0xee2f('0x46')){var _0x88e683=_0x4978eb['get']({'plain':!![]});var _0x5df503=_0xee2f('0x49');return db[_0xee2f('0x4a')][_0xee2f('0x43')]({'where':{'name':_0x5df503,'userProfileId':_0x533ad0[_0xee2f('0x4b')]},'raw':!![]})[_0xee2f('0x1d')](function(_0x2a450f){if(_0x2a450f&&_0x2a450f[_0xee2f('0x4c')]===0x0){return db[_0xee2f('0x21')][_0xee2f('0x44')]({'name':_0x88e683[_0xee2f('0x24')],'resourceId':_0x88e683['id'],'type':_0xee2f('0x20'),'sectionId':_0x2a450f['id']},{})[_0xee2f('0x1d')](function(){return _0x4978eb;});}else{return _0x4978eb;}})['catch'](function(_0x34cb51){logger[_0xee2f('0x23')](_0xee2f('0x4d'),_0x34cb51);throw _0x34cb51;});}return _0x4978eb;})[_0xee2f('0x1d')](respondWithResult(_0x3d95b8,0xc9))['catch'](handleError(_0x3d95b8,null));};exports[_0xee2f('0x4e')]=function(_0xb3bf3f,_0x3a476f){if(_0xb3bf3f[_0xee2f('0x45')]['id']){delete _0xb3bf3f[_0xee2f('0x45')]['id'];}return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0xb3bf3f['params']['id']}})['then'](handleEntityNotFound(_0x3a476f,null))[_0xee2f('0x1d')](saveUpdates(_0xb3bf3f[_0xee2f('0x45')],null))[_0xee2f('0x1d')](respondWithResult(_0x3a476f,null))[_0xee2f('0x3f')](handleError(_0x3a476f,null));};exports[_0xee2f('0x1e')]=function(_0x101e09,_0x20aaca){return db['AnalyticDefaultReport'][_0xee2f('0x43')]({'where':{'id':_0x101e09[_0xee2f('0x41')]['id']}})[_0xee2f('0x1d')](handleEntityNotFound(_0x20aaca,null))[_0xee2f('0x1d')](removeEntity(_0x20aaca,null))[_0xee2f('0x3f')](handleError(_0x20aaca,null));};exports[_0xee2f('0x4f')]=function(_0xcba6fc,_0x2b9636){var _0x1373a1=0xa;var _0x5d6c40=[_0xee2f('0x50'),'left_join',_0xee2f('0x51'),_0xee2f('0x52')];var _0x1dbbf2={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':_0xee2f('0x56'),'AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4fb159={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x1421da=function(_0xd967e9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),_0xee2f('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0xd967e9);};var _0x1708c5=function(_0x58e464){if(!_0x58e464||!_0x58e464[_0xee2f('0x5e')]['length']){return'';}for(var _0x7167f9='(',_0x59af84=0x0;_0x59af84<_0x58e464[_0xee2f('0x5e')][_0xee2f('0x32')];_0x59af84+=0x1){_0x59af84>0x0&&(_0x7167f9+='\x20'+_0x58e464[_0xee2f('0x5f')]+'\x20');_0x7167f9+=_0x58e464['rules'][_0x59af84][_0xee2f('0x60')]?_0x1708c5(_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x60')]):_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x61')]+'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x62')]+(_0x1421da(_0x58e464['rules'][_0x59af84][_0xee2f('0x62')])?'\x20'+_0x58e464[_0xee2f('0x5e')][_0x59af84][_0xee2f('0x63')]:'');}return _0x7167f9+')';};var _0x353bd9={'where':{'id':_0xcba6fc[_0xee2f('0x41')]['id']}},_0x5280c7,_0x3c9d47,_0x8ccc9d,_0x15c7ff,_0x191af8;_0x353bd9=_[_0xee2f('0x3a')]({},_0x353bd9,_0xcba6fc['options']);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x353bd9)['then'](function(_0x9252e3){if(_0x9252e3){_0x5280c7=_0x9252e3;return _0x9252e3['getFields']();}return null;})[_0xee2f('0x1d')](function(_0x4ed7c9){if(_0x4ed7c9){if(!_0x4ed7c9['length']){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x3c9d47=_0x4ed7c9;return db[_0xee2f('0x67')][_0xee2f('0x3d')]({'raw':!![]});}return null;})['then'](function(_0x238e7d){if(_0x238e7d){_0x8ccc9d=_[_0xee2f('0x68')](_0x238e7d,'id');var _0x42fae8;var _0x5d4fe8=squel[_0xee2f('0x69')]();_0x5d4fe8[_0xee2f('0x6a')](_0x5280c7['table']);for(var _0x1f1c55=0x0;_0x1f1c55<_0x3c9d47[_0xee2f('0x32')];_0x1f1c55+=0x1){_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]?_0x8ccc9d[_0x3c9d47[_0x1f1c55][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x3c9d47[_0x1f1c55][_0xee2f('0x61')];_0x42fae8=_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x1dbbf2[_0x3c9d47[_0x1f1c55][_0xee2f('0x6d')]],'%s',_0x42fae8):_0x42fae8;_0x42fae8=_0x3c9d47[_0x1f1c55]['format']?_['replace'](_0x4fb159[_0x3c9d47[_0x1f1c55]['format']],'%s',_0x42fae8):_0x42fae8;if(_0x3c9d47[_0x1f1c55][_0xee2f('0x6f')]){_0x5d4fe8[_0xee2f('0x60')](_0x42fae8);}_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]&&_0x5d4fe8[_0xee2f('0x35')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x5d4fe8[_0xee2f('0x61')](_0x42fae8,_0x3c9d47[_0x1f1c55][_0xee2f('0x71')]||_0x42fae8);}if(_0x5280c7['joins']){_0x5280c7[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x72')]);for(var _0x5a7b6c=0x0;_0x5a7b6c<_0x5280c7[_0xee2f('0x72')]['length'];_0x5a7b6c+=0x1){if(_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]&&_['includes'](_0x5d6c40,_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')])&&_0x5280c7['joins'][_0x5a7b6c]['parentKey']&&_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')]&&_0x5280c7['joins'][_0x5a7b6c]['foreignKey']){_0x5d4fe8[_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x74')]](_0x5280c7['joins'][_0x5a7b6c][_0xee2f('0x75')],null,util['format'](_0xee2f('0x76'),_0x5280c7[_0xee2f('0x77')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x78')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c][_0xee2f('0x75')],_0x5280c7[_0xee2f('0x72')][_0x5a7b6c]['foreignKey']));}}}if(_0x5280c7[_0xee2f('0x79')]){_0x5280c7[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x5280c7[_0xee2f('0x79')]);_0x5d4fe8[_0xee2f('0x37')](_0x1708c5(_0x5280c7['conditions'][_0xee2f('0x60')]));}_0x191af8=_0x5d4fe8[_0xee2f('0x7a')]();_0x5d4fe8[_0xee2f('0x15')](_0x1373a1);_0x5d4fe8[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x5d4fe8['toString']());return dbH['sequelize'][_0xee2f('0x2c')](_0x5d4fe8[_0xee2f('0x7d')](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](respondWithResult(_0x2b9636,null))[_0xee2f('0x3f')](handleError(_0x2b9636,null));};function runReport(_0x58c49e,_0x5b7b55,_0x2ad26d){var _0x27eabc=_0x5b7b55[_0xee2f('0x24')];var _0xc92046=0xa;var _0x38ee46=[_0xee2f('0x50'),_0xee2f('0x81'),_0xee2f('0x51'),_0xee2f('0x52')];var _0x21ac2d={'SUM':_0xee2f('0x53'),'COUNT':_0xee2f('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xee2f('0x56'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x2ea31f={'SEC_TO_TIME':_0xee2f('0x82'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':_0xee2f('0x5a')};var _0x18e191=function(_0x4fad8f){return!_['includes']([_0xee2f('0x5c'),_0xee2f('0x5d'),_0xee2f('0x84'),'IS\x20NOT\x20EMPTY'],_0x4fad8f);};var _0xd7c8f8=function(_0x4b0611){if(!_0x4b0611||!_0x4b0611[_0xee2f('0x5e')]['length']){return'';}for(var _0x378fc9='(',_0x25a3b9=0x0;_0x25a3b9<_0x4b0611[_0xee2f('0x5e')]['length'];_0x25a3b9+=0x1){_0x25a3b9>0x0&&(_0x378fc9+='\x20'+_0x4b0611['operator']+'\x20');_0x378fc9+=_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x60')]?_0xd7c8f8(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9]['group']):_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x61')]+'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')]+(_0x18e191(_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x62')])?'\x20'+_0x4b0611[_0xee2f('0x5e')][_0x25a3b9][_0xee2f('0x63')]:'');}return _0x378fc9+')';};var _0x449656={'where':{'id':_0x58c49e['id']}},_0x1db0b5,_0x9f06f9,_0x659080,_0x28bde7,_0x214f94;_0x449656=_['merge']({},_0x449656,_0x2ad26d);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x449656)[_0xee2f('0x1d')](function(_0x2f5ed7){if(_0x2f5ed7){_0x1db0b5=_0x2f5ed7;return _0x2f5ed7[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x34cd09){if(_0x34cd09){if(!_0x34cd09[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))](_0xee2f('0x66'),0x193);}_0x9f06f9=_0x34cd09;return db['AnalyticMetric'][_0xee2f('0x3d')]({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x1422e9){if(_0x1422e9){_0x659080=_[_0xee2f('0x68')](_0x1422e9,'id');var _0x53d769;var _0x15ca4e=squel[_0xee2f('0x69')]();_0x15ca4e[_0xee2f('0x6a')](_0x1db0b5['table']);for(var _0x4f02aa=0x0;_0x4f02aa<_0x9f06f9[_0xee2f('0x32')];_0x4f02aa+=0x1){_0x53d769=_0x9f06f9[_0x4f02aa]['MetricId']?_0x659080[_0x9f06f9[_0x4f02aa]['MetricId']]['metric']:_0x9f06f9[_0x4f02aa][_0xee2f('0x61')];_0x53d769=_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0x21ac2d[_0x9f06f9[_0x4f02aa][_0xee2f('0x6d')]],'%s',_0x53d769):_0x53d769;_0x53d769=_0x9f06f9[_0x4f02aa]['format']?_[_0xee2f('0x6e')](_0x2ea31f[_0x9f06f9[_0x4f02aa][_0xee2f('0x86')]],'%s',_0x53d769):_0x53d769;if(_0x9f06f9[_0x4f02aa][_0xee2f('0x6f')]){_0x15ca4e['group'](_0x53d769);}_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]&&_0x15ca4e['order'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x70')]==='DESC'?![]:!![]);_0x15ca4e['field'](_0x53d769,_0x9f06f9[_0x4f02aa][_0xee2f('0x71')]||_0x53d769);}if(_0x1db0b5['joins']){_0x1db0b5[_0xee2f('0x72')]=JSON['parse'](_0x1db0b5['joins']);for(var _0x149d7f=0x0;_0x149d7f<_0x1db0b5[_0xee2f('0x72')]['length'];_0x149d7f+=0x1){if(_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x74')]&&_['includes'](_0x38ee46,_0x1db0b5['joins'][_0x149d7f][_0xee2f('0x74')])&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['parentKey']&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')]&&_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]){_0x15ca4e[_0x1db0b5[_0xee2f('0x72')][_0x149d7f]['type']](_0x1db0b5['joins'][_0x149d7f]['foreignTable'],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x1db0b5[_0xee2f('0x77')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x78')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x75')],_0x1db0b5[_0xee2f('0x72')][_0x149d7f][_0xee2f('0x87')]));}}}if(_0x1db0b5[_0xee2f('0x79')]){_0x1db0b5[_0xee2f('0x79')]=JSON[_0xee2f('0x73')](_0x1db0b5[_0xee2f('0x79')]);_0x15ca4e[_0xee2f('0x37')](_0xd7c8f8(_0x1db0b5[_0xee2f('0x79')][_0xee2f('0x60')]));}_0x214f94=_0x15ca4e['clone']();_0x15ca4e['limit'](_0xc92046);_0x15ca4e[_0xee2f('0x14')](0x0);return;}})[_0xee2f('0x1d')](function(){if(_0x5b7b55['output']===_0xee2f('0x88')){return null;}var _0x444c39=_[_0xee2f('0x3a')](_0x5b7b55,{'name':_0x5b7b55['fullPath']||_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],'basename':_0x27eabc,'savename':util[_0xee2f('0x86')](_0xee2f('0x89'),_0x5b7b55[_0xee2f('0x24')]||_0x1db0b5[_0xee2f('0x24')],require(_0xee2f('0x8a'))[_0xee2f('0x8b')](0x4),_0x5b7b55[_0xee2f('0x8c')]||'csv'),'reportId':_0x1db0b5['id'],'reportType':_0xee2f('0x8d')});return db[_0xee2f('0x8e')][_0xee2f('0x44')](_0x444c39,{'raw':!![]});})[_0xee2f('0x1d')](function(_0xe7e196){if(_0x1db0b5[_0xee2f('0x77')]===_0xee2f('0x8f')){_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+_0xee2f('0x90'),_0x5b7b55[_0xee2f('0x91')],_0x5b7b55['endDate']);}else{_0x214f94[_0xee2f('0x37')](_0x1db0b5['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b7b55[_0xee2f('0x91')],_0x5b7b55[_0xee2f('0x92')]);}if(_0xe7e196){logger[_0xee2f('0x93')](_0xee2f('0x94'),_0x214f94[_0xee2f('0x7d')]());require(_0xee2f('0x95'))['fork'](path[_0xee2f('0x50')](__dirname,_0xee2f('0x96'),_0xe7e196['output']),[_0xe7e196['id'],_0x214f94[_0xee2f('0x7d')](),path[_0xee2f('0x50')](__dirname,'../../files/reports',_0xe7e196[_0xee2f('0x97')]),_0x27eabc]);return _0xe7e196;}else{var _0x26dd6c=squel[_0xee2f('0x69')]();_0x26dd6c[_0xee2f('0x6a')]('('+_0x214f94[_0xee2f('0x7d')]()+')',_0xee2f('0x98'));_0x26dd6c[_0xee2f('0x61')](_0xee2f('0x99'),_0xee2f('0x17'));_0x214f94[_0xee2f('0x15')](_0x5b7b55[_0xee2f('0x15')]||_0xc92046);_0x214f94[_0xee2f('0x14')](_0x5b7b55['offset']||0x0);return dbH[_0xee2f('0x7e')]['query'](_0x26dd6c['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')]['SELECT']})[_0xee2f('0x1d')](function(_0x472f83){if(!_0x472f83[_0xee2f('0x32')]){_0x28bde7=0x0;}else{_0x28bde7=_0x472f83[0x0]['count']||0x0;}return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x214f94['toString'](),{'type':dbH[_0xee2f('0x7e')][_0xee2f('0x7f')][_0xee2f('0x80')]});})[_0xee2f('0x1d')](function(_0x121a34){return{'rows':_0x121a34||[],'count':_0x28bde7};});}});}exports[_0xee2f('0x9a')]=function(_0x3d8c56,_0x5c8550){return runReport(_0x3d8c56[_0xee2f('0x41')],_0x3d8c56[_0xee2f('0x2c')],_0x3d8c56['options'])[_0xee2f('0x1d')](respondWithResult(_0x5c8550,null))[_0xee2f('0x3f')](handleError(_0x5c8550,null));};exports[_0xee2f('0x9b')]=runReport;exports['query']=function(_0x40fa57,_0x1fafcc){var _0x1163f1=0xa;var _0x162014=[_0xee2f('0x50'),_0xee2f('0x81'),'right_join',_0xee2f('0x52')];var _0xb93091={'SUM':_0xee2f('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xee2f('0x55'),'MIN':'MIN(%s)','AVG':_0xee2f('0x57'),'GROUP_CONCAT':_0xee2f('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xee2f('0x9c')};var _0x39922f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xee2f('0x59'),'ROUND':_0xee2f('0x83'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1c9f70=function(_0xa93dc9){return!_[_0xee2f('0x5b')]([_0xee2f('0x5c'),'IS\x20NOT\x20NULL',_0xee2f('0x84'),_0xee2f('0x9d')],_0xa93dc9);};var _0x44b06b=function(_0x541ac7){if(!_0x541ac7||!_0x541ac7[_0xee2f('0x5e')][_0xee2f('0x32')]){return'';}for(var _0xa89897='(',_0x2def5c=0x0;_0x2def5c<_0x541ac7['rules']['length'];_0x2def5c+=0x1){_0x2def5c>0x0&&(_0xa89897+='\x20'+_0x541ac7[_0xee2f('0x5f')]+'\x20');_0xa89897+=_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x60')]?_0x44b06b(_0x541ac7['rules'][_0x2def5c][_0xee2f('0x60')]):_0x541ac7[_0xee2f('0x5e')][_0x2def5c]['field']+'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')]+(_0x1c9f70(_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x62')])?'\x20'+_0x541ac7[_0xee2f('0x5e')][_0x2def5c][_0xee2f('0x63')]:'');}return _0xa89897+')';};var _0x3f9188={'where':{'id':_0x40fa57['params']['id']}},_0x236b63,_0x4ad336,_0x3370de,_0x3c8c20,_0xc9228;_0x3f9188=_[_0xee2f('0x3a')]({},_0x3f9188,_0x40fa57[_0xee2f('0x3b')]);return db[_0xee2f('0x27')][_0xee2f('0x43')](_0x3f9188)[_0xee2f('0x1d')](function(_0xa0dfdd){if(_0xa0dfdd){_0x236b63=_0xa0dfdd;return _0xa0dfdd[_0xee2f('0x85')]();}return null;})[_0xee2f('0x1d')](function(_0x298dfa){if(_0x298dfa){if(!_0x298dfa[_0xee2f('0x32')]){throw new db[(_0xee2f('0x64'))][(_0xee2f('0x65'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4ad336=_0x298dfa;return db[_0xee2f('0x67')]['findAll']({'raw':!![]});}return null;})[_0xee2f('0x1d')](function(_0x35a1c9){if(_0x35a1c9){_0x3370de=_['keyBy'](_0x35a1c9,'id');var _0x464e9e;var _0x738f35=squel[_0xee2f('0x69')]();_0x738f35[_0xee2f('0x6a')](_0x236b63[_0xee2f('0x77')]);for(var _0xe24a8a=0x0;_0xe24a8a<_0x4ad336['length'];_0xe24a8a+=0x1){_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]?_0x3370de[_0x4ad336[_0xe24a8a][_0xee2f('0x6b')]][_0xee2f('0x6c')]:_0x4ad336[_0xe24a8a][_0xee2f('0x61')];_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]?_[_0xee2f('0x6e')](_0xb93091[_0x4ad336[_0xe24a8a][_0xee2f('0x6d')]],'%s',_0x464e9e):_0x464e9e;_0x464e9e=_0x4ad336[_0xe24a8a][_0xee2f('0x86')]?_[_0xee2f('0x6e')](_0x39922f[_0x4ad336[_0xe24a8a][_0xee2f('0x86')]],'%s',_0x464e9e):_0x464e9e;if(_0x4ad336[_0xe24a8a]['groupBy']){_0x738f35[_0xee2f('0x60')](_0x464e9e);}_0x4ad336[_0xe24a8a][_0xee2f('0x70')]&&_0x738f35[_0xee2f('0x35')](_0x464e9e,_0x4ad336[_0xe24a8a]['orderBy']==='DESC'?![]:!![]);_0x738f35[_0xee2f('0x61')](_0x464e9e,_0x4ad336[_0xe24a8a][_0xee2f('0x71')]||_0x464e9e);}if(_0x236b63[_0xee2f('0x72')]){_0x236b63[_0xee2f('0x72')]=JSON[_0xee2f('0x73')](_0x236b63['joins']);for(var _0x1cee16=0x0;_0x1cee16<_0x236b63[_0xee2f('0x72')]['length'];_0x1cee16+=0x1){if(_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]&&_[_0xee2f('0x5b')](_0x162014,_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')])&&_0x236b63[_0xee2f('0x72')][_0x1cee16]['parentKey']&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')]&&_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]){_0x738f35[_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x74')]](_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],null,util[_0xee2f('0x86')](_0xee2f('0x76'),_0x236b63[_0xee2f('0x77')],_0x236b63['joins'][_0x1cee16][_0xee2f('0x78')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x75')],_0x236b63[_0xee2f('0x72')][_0x1cee16][_0xee2f('0x87')]));}}}if(_0x236b63[_0xee2f('0x79')]){_0x236b63['conditions']=JSON[_0xee2f('0x73')](_0x236b63[_0xee2f('0x79')]);_0x738f35[_0xee2f('0x37')](_0x44b06b(_0x236b63[_0xee2f('0x79')]['group']));}_0xc9228=_0x738f35[_0xee2f('0x7a')]();_0x738f35[_0xee2f('0x15')](_0x1163f1);_0x738f35[_0xee2f('0x14')](0x0);logger[_0xee2f('0x7b')](_0xee2f('0x7c'),_0x738f35[_0xee2f('0x7d')]());return dbH[_0xee2f('0x7e')][_0xee2f('0x2c')](_0x738f35['toString'](),{'type':dbH['sequelize'][_0xee2f('0x7f')][_0xee2f('0x80')]});}})[_0xee2f('0x1d')](function(){return{'sql':_0xc9228['toString']()};})[_0xee2f('0x1d')](respondWithResult(_0x1fafcc,null))['catch'](handleError(_0x1fafcc,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 09a3b94..45731d4 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 _0xe50f=['path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','util','../../config/logger','api','moment','bluebird'];(function(_0x2786bd,_0x4ba961){var _0x21b452=function(_0x81f500){while(--_0x81f500){_0x2786bd['push'](_0x2786bd['shift']());}};_0x21b452(++_0x4ba961);}(_0xe50f,0x10f));var _0xfe50=function(_0x32ec82,_0x975fc4){_0x32ec82=_0x32ec82-0x0;var _0x4dab9b=_0xe50f[_0x32ec82];return _0x4dab9b;};'use strict';var _=require('lodash');var util=require(_0xfe50('0x0'));var logger=require(_0xfe50('0x1'))(_0xfe50('0x2'));var moment=require(_0xfe50('0x3'));var BPromise=require(_0xfe50('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe50('0x5'));var rimraf=require(_0xfe50('0x6'));var config=require('../../config/environment');var attributes=require(_0xfe50('0x7'));module[_0xfe50('0x8')]=function(_0x5dd911,_0x1a59ea){return _0x5dd911[_0xfe50('0x9')](_0xfe50('0xa'),attributes,{'tableName':_0xfe50('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08a7=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xef0512,_0x95f97e){var _0xa27be3=function(_0x35d108){while(--_0x35d108){_0xef0512['push'](_0xef0512['shift']());}};_0xa27be3(++_0x95f97e);}(_0x08a7,0x159));var _0x708a=function(_0x50b568,_0x54e916){_0x50b568=_0x50b568-0x0;var _0x1a58f7=_0x08a7[_0x50b568];return _0x1a58f7;};'use strict';var _=require(_0x708a('0x0'));var util=require('util');var logger=require(_0x708a('0x1'))(_0x708a('0x2'));var moment=require(_0x708a('0x3'));var BPromise=require(_0x708a('0x4'));var rp=require(_0x708a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x708a('0x6'));var config=require(_0x708a('0x7'));var attributes=require(_0x708a('0x8'));module[_0x708a('0x9')]=function(_0x53ded7,_0x1aa90d){return _0x53ded7[_0x708a('0xa')](_0x708a('0xb'),attributes,{'tableName':_0x708a('0xc'),'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 bc07eb4..a951b6f 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 _0xe057=['../../config/environment','client','request','then','AnalyticDefaultReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x54c7ef,_0xa2c7ca){var _0x305b0f=function(_0xd73bb2){while(--_0xd73bb2){_0x54c7ef['push'](_0x54c7ef['shift']());}};_0x305b0f(++_0xa2c7ca);}(_0xe057,0xfd));var _0x7e05=function(_0x3d2219,_0x1dd447){_0x3d2219=_0x3d2219-0x0;var _0xa79b02=_0xe057[_0x3d2219];return _0xa79b02;};'use strict';var _=require('lodash');var util=require(_0x7e05('0x0'));var moment=require('moment');var BPromise=require(_0x7e05('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e05('0x2'));var db=require(_0x7e05('0x3'))['db'];var utils=require(_0x7e05('0x4'));var logger=require(_0x7e05('0x5'))(_0x7e05('0x6'));var config=require(_0x7e05('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7e05('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x576c46,_0x29425e,_0x2c2627){return new BPromise(function(_0x53d118,_0x206a96){return client[_0x7e05('0x9')](_0x576c46,_0x2c2627)[_0x7e05('0xa')](function(_0x5b09f4){logger['info'](_0x7e05('0xb'),_0x29425e,'request\x20sent');logger[_0x7e05('0xc')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x29425e,_0x7e05('0xd'),JSON[_0x7e05('0xe')](_0x5b09f4));if(_0x5b09f4[_0x7e05('0xf')]){if(_0x5b09f4[_0x7e05('0xf')][_0x7e05('0x10')]===0x1f4){logger['error'](_0x7e05('0xb'),_0x29425e,_0x5b09f4[_0x7e05('0xf')][_0x7e05('0x11')]);return _0x206a96(_0x5b09f4[_0x7e05('0xf')][_0x7e05('0x11')]);}logger[_0x7e05('0xf')](_0x7e05('0xb'),_0x29425e,_0x5b09f4[_0x7e05('0xf')][_0x7e05('0x11')]);return _0x53d118(_0x5b09f4[_0x7e05('0xf')][_0x7e05('0x11')]);}else{logger[_0x7e05('0x12')](_0x7e05('0xb'),_0x29425e,_0x7e05('0xd'));_0x53d118(_0x5b09f4[_0x7e05('0x13')]['message']);}})['catch'](function(_0x28a4e7){logger[_0x7e05('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x29425e,_0x28a4e7);_0x206a96(_0x28a4e7);});});} \ No newline at end of file +var _0x94ea=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0xcae8ed,_0x389595){var _0x1eda48=function(_0x1c1dfc){while(--_0x1c1dfc){_0xcae8ed['push'](_0xcae8ed['shift']());}};_0x1eda48(++_0x389595);}(_0x94ea,0x13e));var _0xa94e=function(_0x59ffd4,_0x4bda83){_0x59ffd4=_0x59ffd4-0x0;var _0x31fb33=_0x94ea[_0x59ffd4];return _0x31fb33;};'use strict';var _=require(_0xa94e('0x0'));var util=require(_0xa94e('0x1'));var moment=require(_0xa94e('0x2'));var BPromise=require(_0xa94e('0x3'));var rs=require(_0xa94e('0x4'));var fs=require('fs');var Redis=require(_0xa94e('0x5'));var db=require(_0xa94e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa94e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x329df7,_0xd9083d,_0x5152c5){return new BPromise(function(_0x4f4bae,_0x4d72c0){return client['request'](_0x329df7,_0x5152c5)[_0xa94e('0x8')](function(_0x4ef2c8){logger[_0xa94e('0x9')](_0xa94e('0xa'),_0xd9083d,_0xa94e('0xb'));logger[_0xa94e('0xc')](_0xa94e('0xd'),_0xd9083d,_0xa94e('0xb'),JSON[_0xa94e('0xe')](_0x4ef2c8));if(_0x4ef2c8[_0xa94e('0xf')]){if(_0x4ef2c8[_0xa94e('0xf')][_0xa94e('0x10')]===0x1f4){logger['error'](_0xa94e('0xa'),_0xd9083d,_0x4ef2c8['error'][_0xa94e('0x11')]);return _0x4d72c0(_0x4ef2c8[_0xa94e('0xf')]['message']);}logger[_0xa94e('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xd9083d,_0x4ef2c8['error']['message']);return _0x4f4bae(_0x4ef2c8[_0xa94e('0xf')][_0xa94e('0x11')]);}else{logger[_0xa94e('0x9')]('AnalyticDefaultReport,\x20%s,\x20%s',_0xd9083d,'request\x20sent');_0x4f4bae(_0x4ef2c8[_0xa94e('0x12')][_0xa94e('0x11')]);}})[_0xa94e('0x13')](function(_0x5563f8){logger[_0xa94e('0xf')](_0xa94e('0xa'),_0xd9083d,_0x5563f8);_0x4d72c0(_0x5563f8);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 514c5fe..9700a05 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 _0xcbd3=['/:id/run','run','/:id/query','query','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/preview','preview'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xcbd3,0x86));var _0x3cbd=function(_0x5c2497,_0x47d501){_0x5c2497=_0x5c2497-0x0;var _0xe4a83d=_0xcbd3[_0x5c2497];return _0xe4a83d;};'use strict';var multer=require('multer');var util=require(_0x3cbd('0x0'));var path=require(_0x3cbd('0x1'));var timeout=require(_0x3cbd('0x2'));var express=require(_0x3cbd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3cbd('0x4'));var interaction=require(_0x3cbd('0x5'));var config=require(_0x3cbd('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0x3cbd('0x7')]('/',auth[_0x3cbd('0x8')](),controller['index']);router['get'](_0x3cbd('0x9'),auth[_0x3cbd('0x8')](),controller[_0x3cbd('0xa')]);router[_0x3cbd('0x7')](_0x3cbd('0xb'),auth['isAuthenticated'](),controller[_0x3cbd('0xc')]);router[_0x3cbd('0x7')](_0x3cbd('0xd'),auth[_0x3cbd('0x8')](),controller[_0x3cbd('0xe')]);router[_0x3cbd('0x7')](_0x3cbd('0xf'),auth[_0x3cbd('0x8')](),controller[_0x3cbd('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3cbd('0x9'),auth[_0x3cbd('0x8')](),controller[_0x3cbd('0x11')]);router[_0x3cbd('0x12')](_0x3cbd('0x9'),auth['isAuthenticated'](),controller[_0x3cbd('0x13')]);module[_0x3cbd('0x14')]=router; \ No newline at end of file +var _0x9f7c=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','show','preview','run','/:id/query','post','create','/:id','exports','multer','util','connect-timeout'];(function(_0x5d7051,_0x58de99){var _0x4c0b47=function(_0x10dc37){while(--_0x10dc37){_0x5d7051['push'](_0x5d7051['shift']());}};_0x4c0b47(++_0x58de99);}(_0x9f7c,0x1eb));var _0xc9f7=function(_0x129028,_0x47ea77){_0x129028=_0x129028-0x0;var _0x43d441=_0x9f7c[_0x129028];return _0x43d441;};'use strict';var multer=require(_0xc9f7('0x0'));var util=require(_0xc9f7('0x1'));var path=require('path');var timeout=require(_0xc9f7('0x2'));var express=require(_0xc9f7('0x3'));var router=express[_0xc9f7('0x4')]();var fs_extra=require(_0xc9f7('0x5'));var auth=require(_0xc9f7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc9f7('0x7'));var controller=require(_0xc9f7('0x8'));router[_0xc9f7('0x9')]('/',auth[_0xc9f7('0xa')](),controller['index']);router[_0xc9f7('0x9')]('/:id',auth[_0xc9f7('0xa')](),controller[_0xc9f7('0xb')]);router['get']('/:id/preview',auth[_0xc9f7('0xa')](),controller[_0xc9f7('0xc')]);router[_0xc9f7('0x9')]('/:id/run',auth['isAuthenticated'](),controller[_0xc9f7('0xd')]);router[_0xc9f7('0x9')](_0xc9f7('0xe'),auth[_0xc9f7('0xa')](),controller['query']);router[_0xc9f7('0xf')]('/',auth[_0xc9f7('0xa')](),controller[_0xc9f7('0x10')]);router['put'](_0xc9f7('0x11'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xc9f7('0xa')](),controller['destroy']);module[_0xc9f7('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index cb77e36..ab42b81 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 _0x1717=['ENUM','xlsx','csv','DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x2c8ad6,_0x3326eb){var _0x123485=function(_0x1ca453){while(--_0x1ca453){_0x2c8ad6['push'](_0x2c8ad6['shift']());}};_0x123485(++_0x3326eb);}(_0x1717,0x158));var _0x7171=function(_0x348652,_0x1ab849){_0x348652=_0x348652-0x0;var _0x18a9ea=_0x1717[_0x348652];return _0x18a9ea;};'use strict';var Sequelize=require(_0x7171('0x0'));var moment=require(_0x7171('0x1'));module[_0x7171('0x2')]={'name':{'type':Sequelize[_0x7171('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x7171('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x7171('0x4')]('csv','pdf',_0x7171('0x5')),'allowNull':![],'defaultValue':_0x7171('0x6')},'savename':{'type':Sequelize[_0x7171('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x7171('0x7')]},'endDate':{'type':Sequelize[_0x7171('0x7')]},'status':{'type':Sequelize[_0x7171('0x3')],'defaultValue':_0x7171('0x8')},'type':{'type':Sequelize[_0x7171('0x4')](_0x7171('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x7171('0x9')},'reportId':{'type':Sequelize[_0x7171('0xa')](0xb)[_0x7171('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xceb9=['DATE','manual','scheduled','UNSIGNED','sequelize','STRING','ENUM','csv','pdf'];(function(_0x194d6d,_0x43781b){var _0x6d23cc=function(_0x6c57ad){while(--_0x6c57ad){_0x194d6d['push'](_0x194d6d['shift']());}};_0x6d23cc(++_0x43781b);}(_0xceb9,0x1c6));var _0x9ceb=function(_0x18556e,_0x43dcb7){_0x18556e=_0x18556e-0x0;var _0x562d04=_0xceb9[_0x18556e];return _0x562d04;};'use strict';var Sequelize=require(_0x9ceb('0x0'));var moment=require('moment');module['exports']={'name':{'type':Sequelize[_0x9ceb('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x9ceb('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x9ceb('0x2')](_0x9ceb('0x3'),_0x9ceb('0x4'),'xlsx'),'allowNull':![],'defaultValue':_0x9ceb('0x3')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x9ceb('0x5')]},'endDate':{'type':Sequelize[_0x9ceb('0x5')]},'status':{'type':Sequelize[_0x9ceb('0x1')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0x9ceb('0x6'),_0x9ceb('0x7')),'allowNull':![],'defaultValue':_0x9ceb('0x6')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x9ceb('0x8')]},'reportType':{'type':Sequelize[_0x9ceb('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index d843b7b..9b37b61 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 _0xca1d=['fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','crypto','to-csv','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','Content-Range','apply','reject','update','then','destroy','get','ExtractedReports','sendStatus','error','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','catch','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','format','%s.%s','output','rimraf'];(function(_0x426bc5,_0x45c990){var _0x113458=function(_0x582a10){while(--_0x582a10){_0x426bc5['push'](_0x426bc5['shift']());}};_0x113458(++_0x45c990);}(_0xca1d,0x16f));var _0xdca1=function(_0x22049a,_0x5cd97d){_0x22049a=_0x22049a-0x0;var _0x208177=_0xca1d[_0x22049a];return _0x208177;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdca1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdca1('0x1'));var rp=require(_0xdca1('0x2'));var moment=require(_0xdca1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdca1('0x4'));var util=require(_0xdca1('0x5'));var path=require(_0xdca1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdca1('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdca1('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdca1('0x9'));var querystring=require(_0xdca1('0xa'));var Papa=require(_0xdca1('0xb'));var Redis=require('ioredis');var authService=require(_0xdca1('0xc'));var qs=require(_0xdca1('0xd'));var as=require(_0xdca1('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdca1('0xf'))(_0xdca1('0x10'));var utils=require('../../config/utils');var config=require(_0xdca1('0x11'));var licenseUtil=require(_0xdca1('0x12'));var db=require(_0xdca1('0x13'))['db'];function respondWithStatusCode(_0x41a82b,_0x4ca55b){_0x4ca55b=_0x4ca55b||0xcc;return function(_0x1f0619){if(_0x1f0619){return _0x41a82b['sendStatus'](_0x4ca55b);}return _0x41a82b[_0xdca1('0x14')](_0x4ca55b)[_0xdca1('0x15')]();};}function respondWithResult(_0x2abdea,_0x2ab395){_0x2ab395=_0x2ab395||0xc8;return function(_0x29e73b){if(_0x29e73b){return _0x2abdea[_0xdca1('0x14')](_0x2ab395)[_0xdca1('0x16')](_0x29e73b);}};}function respondWithFilteredResult(_0x8059e0,_0x9d445a){return function(_0x1e0a74){if(_0x1e0a74){var _0x1bd2c7=typeof _0x9d445a[_0xdca1('0x17')]===_0xdca1('0x18')&&typeof _0x9d445a['limit']===_0xdca1('0x18');var _0x3415e1=_0x1e0a74[_0xdca1('0x19')];var _0x447694=_0x1bd2c7?0x0:_0x9d445a[_0xdca1('0x17')];var _0x461c83=_0x1bd2c7?_0x1e0a74[_0xdca1('0x19')]:_0x9d445a[_0xdca1('0x17')]+_0x9d445a[_0xdca1('0x1a')];var _0x26c5b3;if(_0x461c83>=_0x3415e1){_0x461c83=_0x3415e1;_0x26c5b3=0xc8;}else{_0x26c5b3=0xce;}_0x8059e0[_0xdca1('0x14')](_0x26c5b3);return _0x8059e0[_0xdca1('0x1b')](_0xdca1('0x1c'),_0x447694+'-'+_0x461c83+'/'+_0x3415e1)['json'](_0x1e0a74);}return null;};}function patchUpdates(_0x4fa52e){return function(_0x1c7519){try{jsonpatch[_0xdca1('0x1d')](_0x1c7519,_0x4fa52e,!![]);}catch(_0x36fa00){return BPromise[_0xdca1('0x1e')](_0x36fa00);}return _0x1c7519['save']();};}function saveUpdates(_0x30d9c0,_0x7f51ad){return function(_0xc400b4){if(_0xc400b4){return _0xc400b4[_0xdca1('0x1f')](_0x30d9c0)[_0xdca1('0x20')](function(_0x3f5b9f){return _0x3f5b9f;});}return null;};}function removeEntity(_0x53bbb2,_0x3ee3a2){return function(_0x214397){if(_0x214397){return _0x214397[_0xdca1('0x21')]()[_0xdca1('0x20')](function(){var _0x20b73e=_0x214397[_0xdca1('0x22')]({'plain':!![]});var _0x22de4f=_0xdca1('0x23');return db['UserProfileResource'][_0xdca1('0x21')]({'where':{'type':_0x22de4f,'resourceId':_0x20b73e['id']}})[_0xdca1('0x20')](function(){return _0x214397;});})['then'](function(){_0x53bbb2[_0xdca1('0x14')](0xcc)[_0xdca1('0x15')]();});}};}function handleEntityNotFound(_0x5e2e62,_0x34bd15){return function(_0x2074fc){if(!_0x2074fc){_0x5e2e62[_0xdca1('0x24')](0x194);}return _0x2074fc;};}function handleError(_0x3c8721,_0xbbbc4c){_0xbbbc4c=_0xbbbc4c||0x1f4;return function(_0x1767b0){logger[_0xdca1('0x25')](_0x1767b0['stack']);if(_0x1767b0[_0xdca1('0x26')]){delete _0x1767b0['name'];}_0x3c8721['status'](_0xbbbc4c)[_0xdca1('0x27')](_0x1767b0);};}exports['index']=function(_0x122ea9,_0x1bebdd){var _0x4bf208={},_0x478d74={},_0x172a78={'count':0x0,'rows':[]};var _0x4256a6=_[_0xdca1('0x28')](db[_0xdca1('0x29')][_0xdca1('0x2a')],function(_0x4a8f48){return{'name':_0x4a8f48[_0xdca1('0x2b')],'type':_0x4a8f48[_0xdca1('0x2c')][_0xdca1('0x2d')]};});_0x478d74[_0xdca1('0x2e')]=_[_0xdca1('0x28')](_0x4256a6,'name');_0x478d74[_0xdca1('0x2f')]=_[_0xdca1('0x30')](_0x122ea9[_0xdca1('0x2f')]);_0x478d74[_0xdca1('0x31')]=_[_0xdca1('0x32')](_0x478d74['model'],_0x478d74[_0xdca1('0x2f')]);_0x4bf208['attributes']=_['intersection'](_0x478d74['model'],qs['fields'](_0x122ea9[_0xdca1('0x2f')][_0xdca1('0x33')]));_0x4bf208[_0xdca1('0x34')]=_0x4bf208['attributes'][_0xdca1('0x35')]?_0x4bf208['attributes']:_0x478d74['model'];if(!_0x122ea9[_0xdca1('0x2f')][_0xdca1('0x36')](_0xdca1('0x37'))){_0x4bf208['limit']=qs['limit'](_0x122ea9[_0xdca1('0x2f')][_0xdca1('0x1a')]);_0x4bf208[_0xdca1('0x17')]=qs['offset'](_0x122ea9[_0xdca1('0x2f')][_0xdca1('0x17')]);}_0x4bf208[_0xdca1('0x38')]=qs[_0xdca1('0x39')](_0x122ea9['query']['sort']);_0x4bf208[_0xdca1('0x3a')]=qs[_0xdca1('0x31')](_[_0xdca1('0x3b')](_0x122ea9['query'],_0x478d74[_0xdca1('0x31')]),_0x4256a6);if(_0x122ea9[_0xdca1('0x2f')]['filter']){_0x4bf208['where']=_[_0xdca1('0x3c')](_0x4bf208[_0xdca1('0x3a')],{'$or':_[_0xdca1('0x28')](_0x4256a6,function(_0x464e9e){if(_0x464e9e[_0xdca1('0x2c')]!==_0xdca1('0x3d')){var _0x1629b4={};_0x1629b4[_0x464e9e[_0xdca1('0x26')]]={'$like':'%'+_0x122ea9[_0xdca1('0x2f')][_0xdca1('0x3e')]+'%'};return _0x1629b4;}})});}_0x4bf208=_['merge']({},_0x4bf208,_0x122ea9[_0xdca1('0x3f')]);var _0x5c48f5={'where':_0x4bf208[_0xdca1('0x3a')]};return db[_0xdca1('0x29')][_0xdca1('0x19')](_0x5c48f5)[_0xdca1('0x20')](function(_0x45d72b){_0x172a78['count']=_0x45d72b;if(_0x122ea9[_0xdca1('0x2f')][_0xdca1('0x40')]){_0x4bf208['include']=[{'all':!![]}];}return db[_0xdca1('0x29')]['findAll'](_0x4bf208);})[_0xdca1('0x20')](function(_0x53bebc){_0x172a78[_0xdca1('0x41')]=_0x53bebc;return _0x172a78;})[_0xdca1('0x20')](respondWithFilteredResult(_0x1bebdd,_0x4bf208))[_0xdca1('0x42')](handleError(_0x1bebdd,null));};exports['show']=function(_0x55616c,_0x2b48dc){var _0x2734cc={'raw':!![],'where':{'id':_0x55616c['params']['id']}},_0x5d941e={};_0x5d941e[_0xdca1('0x2e')]=_[_0xdca1('0x30')](db[_0xdca1('0x29')][_0xdca1('0x2a')]);_0x5d941e['query']=_[_0xdca1('0x30')](_0x55616c['query']);_0x5d941e[_0xdca1('0x31')]=_[_0xdca1('0x32')](_0x5d941e['model'],_0x5d941e['query']);_0x2734cc[_0xdca1('0x34')]=_[_0xdca1('0x32')](_0x5d941e[_0xdca1('0x2e')],qs[_0xdca1('0x33')](_0x55616c['query'][_0xdca1('0x33')]));_0x2734cc[_0xdca1('0x34')]=_0x2734cc[_0xdca1('0x34')][_0xdca1('0x35')]?_0x2734cc[_0xdca1('0x34')]:_0x5d941e[_0xdca1('0x2e')];if(_0x55616c[_0xdca1('0x2f')]['includeAll']){_0x2734cc[_0xdca1('0x43')]=[{'all':!![]}];}_0x2734cc=_[_0xdca1('0x3c')]({},_0x2734cc,_0x55616c[_0xdca1('0x3f')]);return db[_0xdca1('0x29')][_0xdca1('0x44')](_0x2734cc)[_0xdca1('0x20')](handleEntityNotFound(_0x2b48dc,null))[_0xdca1('0x20')](respondWithResult(_0x2b48dc,null))[_0xdca1('0x42')](handleError(_0x2b48dc,null));};exports[_0xdca1('0x45')]=function(_0x1081f2,_0xc9271){return db['AnalyticExtractedReport'][_0xdca1('0x45')](_0x1081f2[_0xdca1('0x46')],{})[_0xdca1('0x20')](function(_0x3446b4){var _0x25cb5c=_0x1081f2[_0xdca1('0x47')][_0xdca1('0x22')]({'plain':!![]});if(!_0x25cb5c)throw new Error(_0xdca1('0x48'));if(_0x25cb5c[_0xdca1('0x49')]===_0xdca1('0x47')){var _0x2dc757=_0x3446b4['get']({'plain':!![]});var _0x174811=_0xdca1('0x23');return db[_0xdca1('0x4a')][_0xdca1('0x44')]({'where':{'name':_0x174811,'userProfileId':_0x25cb5c['userProfileId']},'raw':!![]})[_0xdca1('0x20')](function(_0xcf7e79){if(_0xcf7e79&&_0xcf7e79[_0xdca1('0x4b')]===0x0){return db[_0xdca1('0x4c')][_0xdca1('0x45')]({'name':_0x2dc757[_0xdca1('0x26')],'resourceId':_0x2dc757['id'],'type':_0xcf7e79[_0xdca1('0x26')],'sectionId':_0xcf7e79['id']},{})[_0xdca1('0x20')](function(){return _0x3446b4;});}else{return _0x3446b4;}})[_0xdca1('0x42')](function(_0x226da4){logger['error'](_0xdca1('0x4d'),_0x226da4);throw _0x226da4;});}return _0x3446b4;})[_0xdca1('0x20')](respondWithResult(_0xc9271,0xc9))[_0xdca1('0x42')](handleError(_0xc9271,null));};exports[_0xdca1('0x1f')]=function(_0x4fa102,_0x5c19f8){if(_0x4fa102[_0xdca1('0x46')]['id']){delete _0x4fa102['body']['id'];}return db[_0xdca1('0x29')][_0xdca1('0x44')]({'where':{'id':_0x4fa102[_0xdca1('0x4e')]['id']}})[_0xdca1('0x20')](handleEntityNotFound(_0x5c19f8,null))[_0xdca1('0x20')](saveUpdates(_0x4fa102[_0xdca1('0x46')],null))['then'](respondWithResult(_0x5c19f8,null))[_0xdca1('0x42')](handleError(_0x5c19f8,null));};exports[_0xdca1('0x21')]=function(_0x493b94,_0x163b27){return db['AnalyticExtractedReport'][_0xdca1('0x44')]({'where':{'id':_0x493b94[_0xdca1('0x4e')]['id']}})['then'](handleEntityNotFound(_0x163b27,null))[_0xdca1('0x20')](removeEntity(_0x163b27,null))[_0xdca1('0x42')](handleError(_0x163b27,null));};exports[_0xdca1('0x4f')]=function(_0x492f9b,_0x2eee4a,_0x521689){return db[_0xdca1('0x29')]['find']({'where':{'id':_0x492f9b['params']['id']},'attributes':[_0xdca1('0x26'),_0xdca1('0x50'),_0xdca1('0x51'),'output'],'raw':!![]})[_0xdca1('0x20')](handleEntityNotFound(_0x2eee4a,null))[_0xdca1('0x20')](function(_0x2bb664){if(_0x2bb664){if(!fs[_0xdca1('0x52')](path[_0xdca1('0x53')](config[_0xdca1('0x54')],_0xdca1('0x55'),_0x2bb664[_0xdca1('0x51')]))){throw new db[(_0xdca1('0x56'))][(_0xdca1('0x57'))](_0xdca1('0x58'));}if(_0x492f9b['query']['exists']){return _0x2eee4a[_0xdca1('0x24')](0xc8);}return _0x2eee4a['download'](path[_0xdca1('0x53')](config[_0xdca1('0x54')],_0xdca1('0x55'),_0x2bb664['savename']),util[_0xdca1('0x59')](_0xdca1('0x5a'),_0x2bb664['basename']||_0x2bb664[_0xdca1('0x26')],_0x2bb664[_0xdca1('0x5b')]['toLowerCase']()));}})[_0xdca1('0x42')](handleError(_0x2eee4a,null));}; \ No newline at end of file +var _0x9860=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','lodash','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','index','map','AnalyticExtractedReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','catch','params','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','output','existsSync','join','root','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','eml-format','rimraf','zip-dir'];(function(_0x27d246,_0x2cea3f){var _0x375531=function(_0x26c281){while(--_0x26c281){_0x27d246['push'](_0x27d246['shift']());}};_0x375531(++_0x2cea3f);}(_0x9860,0xb5));var _0x0986=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9860[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x0986('0x0'));var rimraf=require(_0x0986('0x1'));var zipdir=require(_0x0986('0x2'));var jsonpatch=require(_0x0986('0x3'));var rp=require(_0x0986('0x4'));var moment=require(_0x0986('0x5'));var BPromise=require(_0x0986('0x6'));var Mustache=require(_0x0986('0x7'));var util=require('util');var path=require('path');var sox=require(_0x0986('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0986('0x9'));var squel=require('squel');var crypto=require(_0x0986('0xa'));var jsforce=require(_0x0986('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0986('0xc'));var querystring=require(_0x0986('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0986('0xe'));var qs=require(_0x0986('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0986('0x10'));var logger=require(_0x0986('0x11'))(_0x0986('0x12'));var utils=require('../../config/utils');var config=require(_0x0986('0x13'));var licenseUtil=require(_0x0986('0x14'));var db=require(_0x0986('0x15'))['db'];function respondWithStatusCode(_0x4a3c4c,_0x4d2548){_0x4d2548=_0x4d2548||0xcc;return function(_0x97311e){if(_0x97311e){return _0x4a3c4c[_0x0986('0x16')](_0x4d2548);}return _0x4a3c4c['status'](_0x4d2548)[_0x0986('0x17')]();};}function respondWithResult(_0xbd7e1e,_0xac3cc5){_0xac3cc5=_0xac3cc5||0xc8;return function(_0x15f9ef){if(_0x15f9ef){return _0xbd7e1e['status'](_0xac3cc5)[_0x0986('0x18')](_0x15f9ef);}};}function respondWithFilteredResult(_0x481cf8,_0x502228){return function(_0x48c918){if(_0x48c918){var _0x24a362=typeof _0x502228[_0x0986('0x19')]===_0x0986('0x1a')&&typeof _0x502228[_0x0986('0x1b')]===_0x0986('0x1a');var _0x34a144=_0x48c918[_0x0986('0x1c')];var _0x562535=_0x24a362?0x0:_0x502228['offset'];var _0x48efbc=_0x24a362?_0x48c918['count']:_0x502228[_0x0986('0x19')]+_0x502228[_0x0986('0x1b')];var _0x1c71e9;if(_0x48efbc>=_0x34a144){_0x48efbc=_0x34a144;_0x1c71e9=0xc8;}else{_0x1c71e9=0xce;}_0x481cf8[_0x0986('0x1d')](_0x1c71e9);return _0x481cf8[_0x0986('0x1e')](_0x0986('0x1f'),_0x562535+'-'+_0x48efbc+'/'+_0x34a144)[_0x0986('0x18')](_0x48c918);}return null;};}function patchUpdates(_0x5a8796){return function(_0x424409){try{jsonpatch[_0x0986('0x20')](_0x424409,_0x5a8796,!![]);}catch(_0x5a1632){return BPromise['reject'](_0x5a1632);}return _0x424409[_0x0986('0x21')]();};}function saveUpdates(_0x2046a7,_0x226c51){return function(_0x268a5f){if(_0x268a5f){return _0x268a5f[_0x0986('0x22')](_0x2046a7)[_0x0986('0x23')](function(_0x1126af){return _0x1126af;});}return null;};}function removeEntity(_0x5139b0,_0x5b1ba4){return function(_0xb9e336){if(_0xb9e336){return _0xb9e336[_0x0986('0x24')]()[_0x0986('0x23')](function(){var _0x296cba=_0xb9e336[_0x0986('0x25')]({'plain':!![]});var _0x2f288d=_0x0986('0x26');return db[_0x0986('0x27')][_0x0986('0x24')]({'where':{'type':_0x2f288d,'resourceId':_0x296cba['id']}})['then'](function(){return _0xb9e336;});})[_0x0986('0x23')](function(){_0x5139b0['status'](0xcc)[_0x0986('0x17')]();});}};}function handleEntityNotFound(_0x2ec433,_0x31f85f){return function(_0x20deef){if(!_0x20deef){_0x2ec433[_0x0986('0x16')](0x194);}return _0x20deef;};}function handleError(_0x9f2548,_0x4537da){_0x4537da=_0x4537da||0x1f4;return function(_0x3239ec){logger[_0x0986('0x28')](_0x3239ec[_0x0986('0x29')]);if(_0x3239ec[_0x0986('0x2a')]){delete _0x3239ec[_0x0986('0x2a')];}_0x9f2548[_0x0986('0x1d')](_0x4537da)['send'](_0x3239ec);};}exports[_0x0986('0x2b')]=function(_0x2ca8dd,_0x2ca101){var _0xb28d68={},_0x37d2d7={},_0x34ce3c={'count':0x0,'rows':[]};var _0x505a7e=_[_0x0986('0x2c')](db[_0x0986('0x2d')]['rawAttributes'],function(_0x1d8a0c){return{'name':_0x1d8a0c[_0x0986('0x2e')],'type':_0x1d8a0c['type'][_0x0986('0x2f')]};});_0x37d2d7[_0x0986('0x30')]=_[_0x0986('0x2c')](_0x505a7e,_0x0986('0x2a'));_0x37d2d7[_0x0986('0x31')]=_[_0x0986('0x32')](_0x2ca8dd['query']);_0x37d2d7[_0x0986('0x33')]=_[_0x0986('0x34')](_0x37d2d7['model'],_0x37d2d7['query']);_0xb28d68[_0x0986('0x35')]=_['intersection'](_0x37d2d7[_0x0986('0x30')],qs['fields'](_0x2ca8dd['query'][_0x0986('0x36')]));_0xb28d68['attributes']=_0xb28d68[_0x0986('0x35')]['length']?_0xb28d68[_0x0986('0x35')]:_0x37d2d7[_0x0986('0x30')];if(!_0x2ca8dd[_0x0986('0x31')][_0x0986('0x37')](_0x0986('0x38'))){_0xb28d68[_0x0986('0x1b')]=qs[_0x0986('0x1b')](_0x2ca8dd[_0x0986('0x31')][_0x0986('0x1b')]);_0xb28d68['offset']=qs[_0x0986('0x19')](_0x2ca8dd[_0x0986('0x31')]['offset']);}_0xb28d68['order']=qs[_0x0986('0x39')](_0x2ca8dd[_0x0986('0x31')][_0x0986('0x39')]);_0xb28d68[_0x0986('0x3a')]=qs['filters'](_[_0x0986('0x3b')](_0x2ca8dd['query'],_0x37d2d7[_0x0986('0x33')]),_0x505a7e);if(_0x2ca8dd[_0x0986('0x31')][_0x0986('0x3c')]){_0xb28d68[_0x0986('0x3a')]=_[_0x0986('0x3d')](_0xb28d68[_0x0986('0x3a')],{'$or':_['map'](_0x505a7e,function(_0x591896){if(_0x591896[_0x0986('0x3e')]!=='VIRTUAL'){var _0x5b8b2f={};_0x5b8b2f[_0x591896[_0x0986('0x2a')]]={'$like':'%'+_0x2ca8dd[_0x0986('0x31')][_0x0986('0x3c')]+'%'};return _0x5b8b2f;}})});}_0xb28d68=_[_0x0986('0x3d')]({},_0xb28d68,_0x2ca8dd[_0x0986('0x3f')]);var _0x122b93={'where':_0xb28d68[_0x0986('0x3a')]};return db[_0x0986('0x2d')][_0x0986('0x1c')](_0x122b93)[_0x0986('0x23')](function(_0x10f678){_0x34ce3c[_0x0986('0x1c')]=_0x10f678;if(_0x2ca8dd[_0x0986('0x31')][_0x0986('0x40')]){_0xb28d68['include']=[{'all':!![]}];}return db[_0x0986('0x2d')][_0x0986('0x41')](_0xb28d68);})['then'](function(_0x3d6935){_0x34ce3c[_0x0986('0x42')]=_0x3d6935;return _0x34ce3c;})[_0x0986('0x23')](respondWithFilteredResult(_0x2ca101,_0xb28d68))[_0x0986('0x43')](handleError(_0x2ca101,null));};exports['show']=function(_0x1ab724,_0x548522){var _0x3669d5={'raw':!![],'where':{'id':_0x1ab724[_0x0986('0x44')]['id']}},_0x1e9146={};_0x1e9146['model']=_[_0x0986('0x32')](db[_0x0986('0x2d')][_0x0986('0x45')]);_0x1e9146[_0x0986('0x31')]=_['keys'](_0x1ab724[_0x0986('0x31')]);_0x1e9146['filters']=_[_0x0986('0x34')](_0x1e9146[_0x0986('0x30')],_0x1e9146[_0x0986('0x31')]);_0x3669d5['attributes']=_[_0x0986('0x34')](_0x1e9146[_0x0986('0x30')],qs[_0x0986('0x36')](_0x1ab724[_0x0986('0x31')]['fields']));_0x3669d5[_0x0986('0x35')]=_0x3669d5[_0x0986('0x35')][_0x0986('0x46')]?_0x3669d5[_0x0986('0x35')]:_0x1e9146['model'];if(_0x1ab724[_0x0986('0x31')][_0x0986('0x40')]){_0x3669d5[_0x0986('0x47')]=[{'all':!![]}];}_0x3669d5=_[_0x0986('0x3d')]({},_0x3669d5,_0x1ab724[_0x0986('0x3f')]);return db[_0x0986('0x2d')][_0x0986('0x48')](_0x3669d5)[_0x0986('0x23')](handleEntityNotFound(_0x548522,null))[_0x0986('0x23')](respondWithResult(_0x548522,null))[_0x0986('0x43')](handleError(_0x548522,null));};exports['create']=function(_0x128c5a,_0x59a0a4){return db['AnalyticExtractedReport'][_0x0986('0x49')](_0x128c5a[_0x0986('0x4a')],{})[_0x0986('0x23')](function(_0x5b37a5){var _0x568e2=_0x128c5a[_0x0986('0x4b')][_0x0986('0x25')]({'plain':!![]});if(!_0x568e2)throw new Error(_0x0986('0x4c'));if(_0x568e2['role']===_0x0986('0x4b')){var _0x2d1972=_0x5b37a5[_0x0986('0x25')]({'plain':!![]});var _0x19ed28=_0x0986('0x26');return db[_0x0986('0x4d')][_0x0986('0x48')]({'where':{'name':_0x19ed28,'userProfileId':_0x568e2[_0x0986('0x4e')]},'raw':!![]})[_0x0986('0x23')](function(_0x1a5438){if(_0x1a5438&&_0x1a5438[_0x0986('0x4f')]===0x0){return db[_0x0986('0x27')][_0x0986('0x49')]({'name':_0x2d1972[_0x0986('0x2a')],'resourceId':_0x2d1972['id'],'type':_0x1a5438[_0x0986('0x2a')],'sectionId':_0x1a5438['id']},{})['then'](function(){return _0x5b37a5;});}else{return _0x5b37a5;}})[_0x0986('0x43')](function(_0x59852a){logger['error'](_0x0986('0x50'),_0x59852a);throw _0x59852a;});}return _0x5b37a5;})[_0x0986('0x23')](respondWithResult(_0x59a0a4,0xc9))[_0x0986('0x43')](handleError(_0x59a0a4,null));};exports['update']=function(_0x32f73a,_0x537be7){if(_0x32f73a[_0x0986('0x4a')]['id']){delete _0x32f73a['body']['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x32f73a[_0x0986('0x44')]['id']}})[_0x0986('0x23')](handleEntityNotFound(_0x537be7,null))['then'](saveUpdates(_0x32f73a['body'],null))[_0x0986('0x23')](respondWithResult(_0x537be7,null))[_0x0986('0x43')](handleError(_0x537be7,null));};exports[_0x0986('0x24')]=function(_0xf4fbbd,_0x1bdc5d){return db[_0x0986('0x2d')][_0x0986('0x48')]({'where':{'id':_0xf4fbbd[_0x0986('0x44')]['id']}})[_0x0986('0x23')](handleEntityNotFound(_0x1bdc5d,null))['then'](removeEntity(_0x1bdc5d,null))['catch'](handleError(_0x1bdc5d,null));};exports['download']=function(_0x49c79a,_0x575c54,_0xed9aad){return db[_0x0986('0x2d')]['find']({'where':{'id':_0x49c79a[_0x0986('0x44')]['id']},'attributes':[_0x0986('0x2a'),_0x0986('0x51'),'savename',_0x0986('0x52')],'raw':!![]})['then'](handleEntityNotFound(_0x575c54,null))['then'](function(_0x18a5c2){if(_0x18a5c2){if(!fs[_0x0986('0x53')](path[_0x0986('0x54')](config[_0x0986('0x55')],'server/files/reports',_0x18a5c2['savename']))){throw new db['Sequelize'][(_0x0986('0x56'))](_0x0986('0x57'));}if(_0x49c79a[_0x0986('0x31')][_0x0986('0x58')]){return _0x575c54[_0x0986('0x16')](0xc8);}return _0x575c54['download'](path[_0x0986('0x54')](config[_0x0986('0x55')],_0x0986('0x59'),_0x18a5c2['savename']),util[_0x0986('0x5a')](_0x0986('0x5b'),_0x18a5c2[_0x0986('0x51')]||_0x18a5c2[_0x0986('0x2a')],_0x18a5c2['output']['toLowerCase']()));}})[_0x0986('0x43')](handleError(_0x575c54,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d50cbb8..51c462e 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 _0x3d2a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','lodash','util'];(function(_0x2f6799,_0x4e7f00){var _0x3cb26f=function(_0x3c5a3d){while(--_0x3c5a3d){_0x2f6799['push'](_0x2f6799['shift']());}};_0x3cb26f(++_0x4e7f00);}(_0x3d2a,0x9a));var _0xa3d2=function(_0x3c4f1f,_0x20d3ec){_0x3c4f1f=_0x3c4f1f-0x0;var _0x19cb69=_0x3d2a[_0x3c4f1f];return _0x19cb69;};'use strict';var _=require(_0xa3d2('0x0'));var util=require(_0xa3d2('0x1'));var logger=require(_0xa3d2('0x2'))(_0xa3d2('0x3'));var moment=require(_0xa3d2('0x4'));var BPromise=require(_0xa3d2('0x5'));var rp=require(_0xa3d2('0x6'));var fs=require('fs');var path=require(_0xa3d2('0x7'));var rimraf=require(_0xa3d2('0x8'));var config=require(_0xa3d2('0x9'));var attributes=require(_0xa3d2('0xa'));module['exports']=function(_0xa65d9a,_0x49144b){return _0xa65d9a[_0xa3d2('0xb')](_0xa3d2('0xc'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb41=['define','analytics_extracted_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xdb41,0x9c));var _0x1db4=function(_0x1bd224,_0x4ff3cd){_0x1bd224=_0x1bd224-0x0;var _0x12f4e6=_0xdb41[_0x1bd224];return _0x12f4e6;};'use strict';var _=require(_0x1db4('0x0'));var util=require(_0x1db4('0x1'));var logger=require(_0x1db4('0x2'))('api');var moment=require(_0x1db4('0x3'));var BPromise=require(_0x1db4('0x4'));var rp=require(_0x1db4('0x5'));var fs=require('fs');var path=require(_0x1db4('0x6'));var rimraf=require('rimraf');var config=require(_0x1db4('0x7'));var attributes=require(_0x1db4('0x8'));module['exports']=function(_0x4d411c,_0x6948f4){return _0x4d411c[_0x1db4('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0x1db4('0xa'),'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 bbb6759..1d50c65 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 _0xe097=['request','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xe097,0x186));var _0x7e09=function(_0x2846cf,_0x4fd425){_0x2846cf=_0x2846cf-0x0;var _0x2a2909=_0xe097[_0x2846cf];return _0x2a2909;};'use strict';var _=require(_0x7e09('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7e09('0x1'));var rs=require(_0x7e09('0x2'));var fs=require('fs');var Redis=require(_0x7e09('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7e09('0x4'));var logger=require(_0x7e09('0x5'))(_0x7e09('0x6'));var config=require('../../config/environment');var jayson=require(_0x7e09('0x7'));var client=jayson[_0x7e09('0x8')][_0x7e09('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x216fc0,_0x2f2698,_0x11bd93){return new BPromise(function(_0x49cac2,_0x50c0da){return client[_0x7e09('0xa')](_0x216fc0,_0x11bd93)['then'](function(_0x35c1af){logger['info'](_0x7e09('0xb'),_0x2f2698,'request\x20sent');logger['debug'](_0x7e09('0xc'),_0x2f2698,_0x7e09('0xd'),JSON[_0x7e09('0xe')](_0x35c1af));if(_0x35c1af[_0x7e09('0xf')]){if(_0x35c1af[_0x7e09('0xf')][_0x7e09('0x10')]===0x1f4){logger[_0x7e09('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2f2698,_0x35c1af[_0x7e09('0xf')][_0x7e09('0x11')]);return _0x50c0da(_0x35c1af[_0x7e09('0xf')]['message']);}logger[_0x7e09('0xf')](_0x7e09('0xb'),_0x2f2698,_0x35c1af[_0x7e09('0xf')][_0x7e09('0x11')]);return _0x49cac2(_0x35c1af[_0x7e09('0xf')][_0x7e09('0x11')]);}else{logger[_0x7e09('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2f2698,'request\x20sent');_0x49cac2(_0x35c1af[_0x7e09('0x13')][_0x7e09('0x11')]);}})['catch'](function(_0x51737a){logger['error'](_0x7e09('0xb'),_0x2f2698,_0x51737a);_0x50c0da(_0x51737a);});});} \ No newline at end of file +var _0xb875=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x416840,_0x59a299){var _0x118276=function(_0x2cda8b){while(--_0x2cda8b){_0x416840['push'](_0x416840['shift']());}};_0x118276(++_0x59a299);}(_0xb875,0x167));var _0x5b87=function(_0x4911b4,_0x515321){_0x4911b4=_0x4911b4-0x0;var _0x4450f1=_0xb875[_0x4911b4];return _0x4450f1;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b87('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b87('0x2'))['db'];var utils=require(_0x5b87('0x3'));var logger=require('../../config/logger')(_0x5b87('0x4'));var config=require(_0x5b87('0x5'));var jayson=require(_0x5b87('0x6'));var client=jayson[_0x5b87('0x7')][_0x5b87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b27af,_0x1fc1a8,_0x46b1bf){return new BPromise(function(_0x1fb944,_0xb2888){return client['request'](_0x5b27af,_0x46b1bf)[_0x5b87('0x9')](function(_0x537f81){logger[_0x5b87('0xa')](_0x5b87('0xb'),_0x1fc1a8,_0x5b87('0xc'));logger[_0x5b87('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x1fc1a8,'request\x20sent',JSON[_0x5b87('0xe')](_0x537f81));if(_0x537f81[_0x5b87('0xf')]){if(_0x537f81['error'][_0x5b87('0x10')]===0x1f4){logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x537f81[_0x5b87('0xf')][_0x5b87('0x11')]);return _0xb2888(_0x537f81[_0x5b87('0xf')][_0x5b87('0x11')]);}logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x537f81['error'][_0x5b87('0x11')]);return _0x1fb944(_0x537f81['error'][_0x5b87('0x11')]);}else{logger[_0x5b87('0xa')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1fc1a8,'request\x20sent');_0x1fb944(_0x537f81[_0x5b87('0x12')]['message']);}})[_0x5b87('0x13')](function(_0x175452){logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x175452);_0xb2888(_0x175452);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index a1baa1e..ff11baf 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 _0xfa46=['multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x3564d6,_0x37d1cb){var _0x1f2267=function(_0xbf7dfb){while(--_0xbf7dfb){_0x3564d6['push'](_0x3564d6['shift']());}};_0x1f2267(++_0x37d1cb);}(_0xfa46,0x17a));var _0x6fa4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfa46[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x6fa4('0x0'));var util=require(_0x6fa4('0x1'));var path=require('path');var timeout=require(_0x6fa4('0x2'));var express=require(_0x6fa4('0x3'));var router=express['Router']();var fs_extra=require(_0x6fa4('0x4'));var auth=require(_0x6fa4('0x5'));var interaction=require(_0x6fa4('0x6'));var config=require(_0x6fa4('0x7'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x6fa4('0x8')](),controller[_0x6fa4('0x9')]);router[_0x6fa4('0xa')](_0x6fa4('0xb'),auth[_0x6fa4('0x8')](),controller[_0x6fa4('0xc')]);router[_0x6fa4('0xa')](_0x6fa4('0xd'),auth[_0x6fa4('0x8')](),controller[_0x6fa4('0xe')]);router[_0x6fa4('0xf')]('/',auth['isAuthenticated'](),controller[_0x6fa4('0x10')]);router[_0x6fa4('0x11')](_0x6fa4('0xb'),auth[_0x6fa4('0x8')](),controller['update']);router[_0x6fa4('0x12')](_0x6fa4('0xb'),auth[_0x6fa4('0x8')](),controller[_0x6fa4('0x13')]);module[_0x6fa4('0x14')]=router; \ No newline at end of file +var _0xc00a=['get','index','/:id','show','/:id/download','isAuthenticated','create','put','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller'];(function(_0x5aef95,_0x26fe83){var _0x139522=function(_0x4f760b){while(--_0x4f760b){_0x5aef95['push'](_0x5aef95['shift']());}};_0x139522(++_0x26fe83);}(_0xc00a,0xb6));var _0xac00=function(_0x29c7ed,_0x389f4b){_0x29c7ed=_0x29c7ed-0x0;var _0x22b24d=_0xc00a[_0x29c7ed];return _0x22b24d;};'use strict';var multer=require(_0xac00('0x0'));var util=require(_0xac00('0x1'));var path=require(_0xac00('0x2'));var timeout=require('connect-timeout');var express=require(_0xac00('0x3'));var router=express['Router']();var fs_extra=require(_0xac00('0x4'));var auth=require(_0xac00('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xac00('0x6'));var controller=require(_0xac00('0x7'));router[_0xac00('0x8')]('/',auth['isAuthenticated'](),controller[_0xac00('0x9')]);router[_0xac00('0x8')](_0xac00('0xa'),auth['isAuthenticated'](),controller[_0xac00('0xb')]);router[_0xac00('0x8')](_0xac00('0xc'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xac00('0xd')](),controller[_0xac00('0xe')]);router[_0xac00('0xf')](_0xac00('0xa'),auth['isAuthenticated'](),controller[_0xac00('0x10')]);router[_0xac00('0x11')](_0xac00('0xa'),auth[_0xac00('0xd')](),controller['destroy']);module[_0xac00('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 1710615..1ee8f05 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 _0x8a26=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x52f440,_0x4ce9e8){var _0x46ec17=function(_0x24df1f){while(--_0x24df1f){_0x52f440['push'](_0x52f440['shift']());}};_0x46ec17(++_0x4ce9e8);}(_0x8a26,0x174));var _0x68a2=function(_0x4ff45d,_0x4dbf60){_0x4ff45d=_0x4ff45d-0x0;var _0x202eba=_0x8a26[_0x4ff45d];return _0x202eba;};'use strict';var Sequelize=require(_0x68a2('0x0'));module[_0x68a2('0x1')]={'field':{'type':Sequelize[_0x68a2('0x2')]},'alias':{'type':Sequelize[_0x68a2('0x3')]},'function':{'type':Sequelize[_0x68a2('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x68a2('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1187=['STRING','BOOLEAN','sequelize','exports'];(function(_0x22e714,_0x38d207){var _0x1955ab=function(_0x173287){while(--_0x173287){_0x22e714['push'](_0x22e714['shift']());}};_0x1955ab(++_0x38d207);}(_0x1187,0x1d2));var _0x7118=function(_0x45e7dc,_0x2aff31){_0x45e7dc=_0x45e7dc-0x0;var _0xa11ba5=_0x1187[_0x45e7dc];return _0xa11ba5;};'use strict';var Sequelize=require(_0x7118('0x0'));module[_0x7118('0x1')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x7118('0x2')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x7118('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x7118('0x2')]},'custom':{'type':Sequelize[_0x7118('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 32814e9..49d29aa 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 _0x3e3f=['request-promise','util','path','sox','to-csv','ejs','fs-extra','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','end','json','offset','undefined','limit','status','set','apply','save','update','then','destroy','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','find','create','body','bulkCreate','params','addFields','AnalyticCustomReport','findOne','sequelize','CustomReportId','eml-format','rimraf'];(function(_0x28104c,_0x1f4282){var _0x3420ef=function(_0x51122c){while(--_0x51122c){_0x28104c['push'](_0x28104c['shift']());}};_0x3420ef(++_0x1f4282);}(_0x3e3f,0xe8));var _0xf3e3=function(_0x47e414,_0x2c42c3){_0x47e414=_0x47e414-0x0;var _0x17ee92=_0x3e3f[_0x47e414];return _0x17ee92;};'use strict';var emlformat=require(_0xf3e3('0x0'));var rimraf=require(_0xf3e3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf3e3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf3e3('0x3'));var path=require(_0xf3e3('0x4'));var sox=require(_0xf3e3('0x5'));var csv=require(_0xf3e3('0x6'));var ejs=require(_0xf3e3('0x7'));var fs=require('fs');var fs_extra=require(_0xf3e3('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf3e3('0x9'));var jsforce=require(_0xf3e3('0xa'));var deskjs=require(_0xf3e3('0xb'));var toCsv=require(_0xf3e3('0x6'));var querystring=require(_0xf3e3('0xc'));var Papa=require(_0xf3e3('0xd'));var Redis=require(_0xf3e3('0xe'));var authService=require(_0xf3e3('0xf'));var qs=require(_0xf3e3('0x10'));var as=require(_0xf3e3('0x11'));var hardwareService=require(_0xf3e3('0x12'));var logger=require(_0xf3e3('0x13'))(_0xf3e3('0x14'));var utils=require(_0xf3e3('0x15'));var config=require(_0xf3e3('0x16'));var licenseUtil=require(_0xf3e3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26c74a,_0x2b6d1d){_0x2b6d1d=_0x2b6d1d||0xcc;return function(_0xa9593e){if(_0xa9593e){return _0x26c74a[_0xf3e3('0x18')](_0x2b6d1d);}return _0x26c74a['status'](_0x2b6d1d)[_0xf3e3('0x19')]();};}function respondWithResult(_0xc62494,_0x3f5a17){_0x3f5a17=_0x3f5a17||0xc8;return function(_0x584364){if(_0x584364){return _0xc62494['status'](_0x3f5a17)[_0xf3e3('0x1a')](_0x584364);}};}function respondWithFilteredResult(_0x51c0d6,_0x2e8975){return function(_0x51bfc1){if(_0x51bfc1){var _0x25ab11=typeof _0x2e8975[_0xf3e3('0x1b')]===_0xf3e3('0x1c')&&typeof _0x2e8975[_0xf3e3('0x1d')]==='undefined';var _0x494fe9=_0x51bfc1['count'];var _0x50f72a=_0x25ab11?0x0:_0x2e8975[_0xf3e3('0x1b')];var _0x58ee93=_0x25ab11?_0x51bfc1['count']:_0x2e8975[_0xf3e3('0x1b')]+_0x2e8975[_0xf3e3('0x1d')];var _0xf0bb94;if(_0x58ee93>=_0x494fe9){_0x58ee93=_0x494fe9;_0xf0bb94=0xc8;}else{_0xf0bb94=0xce;}_0x51c0d6[_0xf3e3('0x1e')](_0xf0bb94);return _0x51c0d6[_0xf3e3('0x1f')]('Content-Range',_0x50f72a+'-'+_0x58ee93+'/'+_0x494fe9)[_0xf3e3('0x1a')](_0x51bfc1);}return null;};}function patchUpdates(_0x340798){return function(_0x3d86ad){try{jsonpatch[_0xf3e3('0x20')](_0x3d86ad,_0x340798,!![]);}catch(_0x55b85c){return BPromise['reject'](_0x55b85c);}return _0x3d86ad[_0xf3e3('0x21')]();};}function saveUpdates(_0x59e59f,_0x3098ad){return function(_0x55562e){if(_0x55562e){return _0x55562e[_0xf3e3('0x22')](_0x59e59f)[_0xf3e3('0x23')](function(_0xa8abca){return _0xa8abca;});}return null;};}function removeEntity(_0x13dc8a,_0x260b09){return function(_0x14073e){if(_0x14073e){return _0x14073e[_0xf3e3('0x24')]()[_0xf3e3('0x23')](function(){_0x13dc8a[_0xf3e3('0x1e')](0xcc)[_0xf3e3('0x19')]();});}};}function handleEntityNotFound(_0x403553,_0x2007bc){return function(_0x432d73){if(!_0x432d73){_0x403553[_0xf3e3('0x18')](0x194);}return _0x432d73;};}function handleError(_0x53ec7a,_0x39733d){_0x39733d=_0x39733d||0x1f4;return function(_0x350933){logger['error'](_0x350933[_0xf3e3('0x25')]);if(_0x350933[_0xf3e3('0x26')]){delete _0x350933['name'];}_0x53ec7a[_0xf3e3('0x1e')](_0x39733d)['send'](_0x350933);};}exports[_0xf3e3('0x27')]=function(_0x222253,_0x269500){var _0x31fcc5={},_0x38dd39={},_0x5aa895={'count':0x0,'rows':[]};var _0x4a7970=_[_0xf3e3('0x28')](db[_0xf3e3('0x29')][_0xf3e3('0x2a')],function(_0x136f11){return{'name':_0x136f11[_0xf3e3('0x2b')],'type':_0x136f11[_0xf3e3('0x2c')][_0xf3e3('0x2d')]};});_0x38dd39['model']=_[_0xf3e3('0x28')](_0x4a7970,_0xf3e3('0x26'));_0x38dd39['query']=_[_0xf3e3('0x2e')](_0x222253[_0xf3e3('0x2f')]);_0x38dd39[_0xf3e3('0x30')]=_[_0xf3e3('0x31')](_0x38dd39[_0xf3e3('0x32')],_0x38dd39[_0xf3e3('0x2f')]);_0x31fcc5[_0xf3e3('0x33')]=_[_0xf3e3('0x31')](_0x38dd39[_0xf3e3('0x32')],qs[_0xf3e3('0x34')](_0x222253[_0xf3e3('0x2f')][_0xf3e3('0x34')]));_0x31fcc5[_0xf3e3('0x33')]=_0x31fcc5[_0xf3e3('0x33')][_0xf3e3('0x35')]?_0x31fcc5[_0xf3e3('0x33')]:_0x38dd39[_0xf3e3('0x32')];if(!_0x222253[_0xf3e3('0x2f')]['hasOwnProperty'](_0xf3e3('0x36'))){_0x31fcc5[_0xf3e3('0x1d')]=qs[_0xf3e3('0x1d')](_0x222253[_0xf3e3('0x2f')][_0xf3e3('0x1d')]);_0x31fcc5[_0xf3e3('0x1b')]=qs[_0xf3e3('0x1b')](_0x222253[_0xf3e3('0x2f')][_0xf3e3('0x1b')]);}_0x31fcc5[_0xf3e3('0x37')]=qs[_0xf3e3('0x38')](_0x222253[_0xf3e3('0x2f')][_0xf3e3('0x38')]);_0x31fcc5['where']=qs[_0xf3e3('0x30')](_[_0xf3e3('0x39')](_0x222253[_0xf3e3('0x2f')],_0x38dd39[_0xf3e3('0x30')]),_0x4a7970);if(_0x222253[_0xf3e3('0x2f')][_0xf3e3('0x3a')]){_0x31fcc5[_0xf3e3('0x3b')]=_[_0xf3e3('0x3c')](_0x31fcc5['where'],{'$or':_['map'](_0x4a7970,function(_0x2cb97f){if(_0x2cb97f['type']!==_0xf3e3('0x3d')){var _0x57255a={};_0x57255a[_0x2cb97f['name']]={'$like':'%'+_0x222253[_0xf3e3('0x2f')][_0xf3e3('0x3a')]+'%'};return _0x57255a;}})});}_0x31fcc5=_[_0xf3e3('0x3c')]({},_0x31fcc5,_0x222253[_0xf3e3('0x3e')]);var _0x27a119={'where':_0x31fcc5[_0xf3e3('0x3b')]};return db[_0xf3e3('0x29')][_0xf3e3('0x3f')](_0x27a119)['then'](function(_0x3bd1f8){_0x5aa895[_0xf3e3('0x3f')]=_0x3bd1f8;if(_0x222253[_0xf3e3('0x2f')][_0xf3e3('0x40')]){_0x31fcc5[_0xf3e3('0x41')]=[{'all':!![]}];}return db[_0xf3e3('0x29')][_0xf3e3('0x42')](_0x31fcc5);})[_0xf3e3('0x23')](function(_0x49a028){_0x5aa895['rows']=_0x49a028;return _0x5aa895;})[_0xf3e3('0x23')](respondWithFilteredResult(_0x269500,_0x31fcc5))[_0xf3e3('0x43')](handleError(_0x269500,null));};exports['show']=function(_0x5618ce,_0x5d48a4){var _0x25a656={'raw':![],'where':{'id':_0x5618ce['params']['id']}},_0x217cf0={};_0x217cf0[_0xf3e3('0x32')]=_[_0xf3e3('0x2e')](db[_0xf3e3('0x29')]['rawAttributes']);_0x217cf0[_0xf3e3('0x2f')]=_['keys'](_0x5618ce['query']);_0x217cf0[_0xf3e3('0x30')]=_[_0xf3e3('0x31')](_0x217cf0[_0xf3e3('0x32')],_0x217cf0[_0xf3e3('0x2f')]);_0x25a656[_0xf3e3('0x33')]=_[_0xf3e3('0x31')](_0x217cf0[_0xf3e3('0x32')],qs['fields'](_0x5618ce[_0xf3e3('0x2f')][_0xf3e3('0x34')]));_0x25a656[_0xf3e3('0x33')]=_0x25a656[_0xf3e3('0x33')][_0xf3e3('0x35')]?_0x25a656['attributes']:_0x217cf0[_0xf3e3('0x32')];if(_0x5618ce[_0xf3e3('0x2f')][_0xf3e3('0x40')]){_0x25a656['include']=[{'all':!![]}];}_0x25a656=_[_0xf3e3('0x3c')]({},_0x25a656,_0x5618ce[_0xf3e3('0x3e')]);return db[_0xf3e3('0x29')][_0xf3e3('0x44')](_0x25a656)[_0xf3e3('0x23')](handleEntityNotFound(_0x5d48a4,null))[_0xf3e3('0x23')](respondWithResult(_0x5d48a4,null))[_0xf3e3('0x43')](handleError(_0x5d48a4,null));};exports['create']=function(_0x5e3311,_0x2ae3ed){return db['AnalyticFieldReport'][_0xf3e3('0x45')](_0x5e3311[_0xf3e3('0x46')],{})[_0xf3e3('0x23')](respondWithResult(_0x2ae3ed,0xc9))[_0xf3e3('0x43')](handleError(_0x2ae3ed,null));};exports[_0xf3e3('0x47')]=function(_0x4d06b4,_0x928888){return db[_0xf3e3('0x29')][_0xf3e3('0x47')](_0x4d06b4[_0xf3e3('0x46')],{'raw':![],'individualHooks':!![]})[_0xf3e3('0x23')](respondWithResult(_0x928888,0xc9))[_0xf3e3('0x43')](handleError(_0x928888,null));};exports['update']=function(_0x31a7d7,_0x1915b3){if(_0x31a7d7[_0xf3e3('0x46')]['id']){delete _0x31a7d7[_0xf3e3('0x46')]['id'];}return db[_0xf3e3('0x29')][_0xf3e3('0x44')]({'where':{'id':_0x31a7d7[_0xf3e3('0x48')]['id']}})['then'](handleEntityNotFound(_0x1915b3,null))[_0xf3e3('0x23')](saveUpdates(_0x31a7d7[_0xf3e3('0x46')],null))[_0xf3e3('0x23')](respondWithResult(_0x1915b3,null))[_0xf3e3('0x43')](handleError(_0x1915b3,null));};exports['destroy']=function(_0x7235af,_0x555054){return db[_0xf3e3('0x29')][_0xf3e3('0x44')]({'where':{'id':_0x7235af[_0xf3e3('0x48')]['id']}})['then'](handleEntityNotFound(_0x555054,null))[_0xf3e3('0x23')](removeEntity(_0x555054,null))['catch'](handleError(_0x555054,null));};exports['bulkDestroy']=function(_0x47c38e,_0x491558){return db[_0xf3e3('0x29')][_0xf3e3('0x24')]({'where':{'id':_0x47c38e['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x491558,0xcc))[_0xf3e3('0x43')](handleError(_0x491558,null));};exports[_0xf3e3('0x49')]=function(_0x56b2ea,_0x2a86f6,_0x17fb00){return db[_0xf3e3('0x4a')][_0xf3e3('0x4b')]({'where':{'id':_0x56b2ea['params']['id']}})[_0xf3e3('0x23')](handleEntityNotFound(_0x2a86f6,null))[_0xf3e3('0x23')](function(_0x5a2964){if(_0x5a2964){return db[_0xf3e3('0x4c')]['transaction'](function(_0x4707fb){return db[_0xf3e3('0x29')]['destroy']({'where':{'CustomReportId':_0x56b2ea['params']['id']},'transaction':_0x4707fb})[_0xf3e3('0x23')](function(_0xd6bc47){var _0x605fc6=_[_0xf3e3('0x28')](_0x56b2ea[_0xf3e3('0x46')],function(_0x506601){delete _0x506601['id'];_0x506601[_0xf3e3('0x4d')]=_0x56b2ea[_0xf3e3('0x48')]['id'];return _0x506601;});return db['AnalyticFieldReport'][_0xf3e3('0x47')](_0x605fc6,{'transaction':_0x4707fb});});})[_0xf3e3('0x23')](function(){return db['AnalyticFieldReport'][_0xf3e3('0x42')]({'where':{'CustomReportId':_0x56b2ea[_0xf3e3('0x48')]['id']}});});}})[_0xf3e3('0x23')](respondWithResult(_0x2a86f6,null))[_0xf3e3('0x43')](handleError(_0x2a86f6,null));}; \ No newline at end of file +var _0x4dc9=['apply','reject','save','update','destroy','then','end','error','name','send','index','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','AnalyticFieldReport','includeAll','include','rows','show','keys','rawAttributes','catch','create','body','bulkCreate','find','params','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range'];(function(_0x2ce725,_0x2949de){var _0x51dd02=function(_0x218ff0){while(--_0x218ff0){_0x2ce725['push'](_0x2ce725['shift']());}};_0x51dd02(++_0x2949de);}(_0x4dc9,0x141));var _0x94dc=function(_0x28e363,_0x33114f){_0x28e363=_0x28e363-0x0;var _0x112f36=_0x4dc9[_0x28e363];return _0x112f36;};'use strict';var emlformat=require(_0x94dc('0x0'));var rimraf=require(_0x94dc('0x1'));var zipdir=require(_0x94dc('0x2'));var jsonpatch=require(_0x94dc('0x3'));var rp=require(_0x94dc('0x4'));var moment=require(_0x94dc('0x5'));var BPromise=require(_0x94dc('0x6'));var Mustache=require(_0x94dc('0x7'));var util=require(_0x94dc('0x8'));var path=require(_0x94dc('0x9'));var sox=require(_0x94dc('0xa'));var csv=require(_0x94dc('0xb'));var ejs=require(_0x94dc('0xc'));var fs=require('fs');var fs_extra=require(_0x94dc('0xd'));var _=require(_0x94dc('0xe'));var squel=require(_0x94dc('0xf'));var crypto=require(_0x94dc('0x10'));var jsforce=require(_0x94dc('0x11'));var deskjs=require(_0x94dc('0x12'));var toCsv=require(_0x94dc('0xb'));var querystring=require('querystring');var Papa=require(_0x94dc('0x13'));var Redis=require(_0x94dc('0x14'));var authService=require(_0x94dc('0x15'));var qs=require(_0x94dc('0x16'));var as=require(_0x94dc('0x17'));var hardwareService=require(_0x94dc('0x18'));var logger=require(_0x94dc('0x19'))(_0x94dc('0x1a'));var utils=require('../../config/utils');var config=require(_0x94dc('0x1b'));var licenseUtil=require(_0x94dc('0x1c'));var db=require(_0x94dc('0x1d'))['db'];function respondWithStatusCode(_0x4cd0b4,_0x310d85){_0x310d85=_0x310d85||0xcc;return function(_0x71d23a){if(_0x71d23a){return _0x4cd0b4[_0x94dc('0x1e')](_0x310d85);}return _0x4cd0b4[_0x94dc('0x1f')](_0x310d85)['end']();};}function respondWithResult(_0x11256f,_0x793dbb){_0x793dbb=_0x793dbb||0xc8;return function(_0x55ab3c){if(_0x55ab3c){return _0x11256f['status'](_0x793dbb)[_0x94dc('0x20')](_0x55ab3c);}};}function respondWithFilteredResult(_0x2c4145,_0x4cd164){return function(_0x41095e){if(_0x41095e){var _0x4179a0=typeof _0x4cd164['offset']===_0x94dc('0x21')&&typeof _0x4cd164['limit']===_0x94dc('0x21');var _0x53813e=_0x41095e[_0x94dc('0x22')];var _0xb9c7a9=_0x4179a0?0x0:_0x4cd164[_0x94dc('0x23')];var _0x4a6c90=_0x4179a0?_0x41095e[_0x94dc('0x22')]:_0x4cd164[_0x94dc('0x23')]+_0x4cd164[_0x94dc('0x24')];var _0x2529b7;if(_0x4a6c90>=_0x53813e){_0x4a6c90=_0x53813e;_0x2529b7=0xc8;}else{_0x2529b7=0xce;}_0x2c4145['status'](_0x2529b7);return _0x2c4145[_0x94dc('0x25')](_0x94dc('0x26'),_0xb9c7a9+'-'+_0x4a6c90+'/'+_0x53813e)[_0x94dc('0x20')](_0x41095e);}return null;};}function patchUpdates(_0x28caf9){return function(_0x59e856){try{jsonpatch[_0x94dc('0x27')](_0x59e856,_0x28caf9,!![]);}catch(_0x403046){return BPromise[_0x94dc('0x28')](_0x403046);}return _0x59e856[_0x94dc('0x29')]();};}function saveUpdates(_0x1b3109,_0x4ce387){return function(_0xf80607){if(_0xf80607){return _0xf80607[_0x94dc('0x2a')](_0x1b3109)['then'](function(_0x5d58b3){return _0x5d58b3;});}return null;};}function removeEntity(_0x408252,_0x465285){return function(_0x2fa184){if(_0x2fa184){return _0x2fa184[_0x94dc('0x2b')]()[_0x94dc('0x2c')](function(){_0x408252['status'](0xcc)[_0x94dc('0x2d')]();});}};}function handleEntityNotFound(_0x5d8392,_0x4134bc){return function(_0x4c16b9){if(!_0x4c16b9){_0x5d8392[_0x94dc('0x1e')](0x194);}return _0x4c16b9;};}function handleError(_0x56d774,_0x25fae3){_0x25fae3=_0x25fae3||0x1f4;return function(_0x4a055c){logger[_0x94dc('0x2e')](_0x4a055c['stack']);if(_0x4a055c['name']){delete _0x4a055c[_0x94dc('0x2f')];}_0x56d774[_0x94dc('0x1f')](_0x25fae3)[_0x94dc('0x30')](_0x4a055c);};}exports[_0x94dc('0x31')]=function(_0x42e662,_0x28de6f){var _0x5776e5={},_0x42705c={},_0x17dec={'count':0x0,'rows':[]};var _0x5474e1=_['map'](db['AnalyticFieldReport']['rawAttributes'],function(_0x569fdd){return{'name':_0x569fdd['fieldName'],'type':_0x569fdd[_0x94dc('0x32')][_0x94dc('0x33')]};});_0x42705c[_0x94dc('0x34')]=_[_0x94dc('0x35')](_0x5474e1,_0x94dc('0x2f'));_0x42705c['query']=_['keys'](_0x42e662[_0x94dc('0x36')]);_0x42705c[_0x94dc('0x37')]=_[_0x94dc('0x38')](_0x42705c['model'],_0x42705c[_0x94dc('0x36')]);_0x5776e5['attributes']=_['intersection'](_0x42705c[_0x94dc('0x34')],qs[_0x94dc('0x39')](_0x42e662[_0x94dc('0x36')]['fields']));_0x5776e5[_0x94dc('0x3a')]=_0x5776e5[_0x94dc('0x3a')][_0x94dc('0x3b')]?_0x5776e5[_0x94dc('0x3a')]:_0x42705c[_0x94dc('0x34')];if(!_0x42e662[_0x94dc('0x36')][_0x94dc('0x3c')](_0x94dc('0x3d'))){_0x5776e5[_0x94dc('0x24')]=qs['limit'](_0x42e662[_0x94dc('0x36')][_0x94dc('0x24')]);_0x5776e5[_0x94dc('0x23')]=qs[_0x94dc('0x23')](_0x42e662[_0x94dc('0x36')][_0x94dc('0x23')]);}_0x5776e5[_0x94dc('0x3e')]=qs['sort'](_0x42e662[_0x94dc('0x36')][_0x94dc('0x3f')]);_0x5776e5[_0x94dc('0x40')]=qs[_0x94dc('0x37')](_[_0x94dc('0x41')](_0x42e662[_0x94dc('0x36')],_0x42705c[_0x94dc('0x37')]),_0x5474e1);if(_0x42e662[_0x94dc('0x36')]['filter']){_0x5776e5[_0x94dc('0x40')]=_['merge'](_0x5776e5['where'],{'$or':_['map'](_0x5474e1,function(_0x47c28b){if(_0x47c28b[_0x94dc('0x32')]!==_0x94dc('0x42')){var _0x5d4c09={};_0x5d4c09[_0x47c28b[_0x94dc('0x2f')]]={'$like':'%'+_0x42e662[_0x94dc('0x36')][_0x94dc('0x43')]+'%'};return _0x5d4c09;}})});}_0x5776e5=_[_0x94dc('0x44')]({},_0x5776e5,_0x42e662[_0x94dc('0x45')]);var _0x1f0933={'where':_0x5776e5[_0x94dc('0x40')]};return db[_0x94dc('0x46')][_0x94dc('0x22')](_0x1f0933)[_0x94dc('0x2c')](function(_0x34b11f){_0x17dec[_0x94dc('0x22')]=_0x34b11f;if(_0x42e662['query'][_0x94dc('0x47')]){_0x5776e5[_0x94dc('0x48')]=[{'all':!![]}];}return db[_0x94dc('0x46')]['findAll'](_0x5776e5);})[_0x94dc('0x2c')](function(_0x46aa86){_0x17dec[_0x94dc('0x49')]=_0x46aa86;return _0x17dec;})[_0x94dc('0x2c')](respondWithFilteredResult(_0x28de6f,_0x5776e5))['catch'](handleError(_0x28de6f,null));};exports[_0x94dc('0x4a')]=function(_0xfcf112,_0x405d8b){var _0x5c9003={'raw':![],'where':{'id':_0xfcf112['params']['id']}},_0xa74542={};_0xa74542['model']=_[_0x94dc('0x4b')](db['AnalyticFieldReport'][_0x94dc('0x4c')]);_0xa74542[_0x94dc('0x36')]=_[_0x94dc('0x4b')](_0xfcf112['query']);_0xa74542[_0x94dc('0x37')]=_[_0x94dc('0x38')](_0xa74542[_0x94dc('0x34')],_0xa74542[_0x94dc('0x36')]);_0x5c9003[_0x94dc('0x3a')]=_[_0x94dc('0x38')](_0xa74542['model'],qs[_0x94dc('0x39')](_0xfcf112[_0x94dc('0x36')][_0x94dc('0x39')]));_0x5c9003[_0x94dc('0x3a')]=_0x5c9003['attributes'][_0x94dc('0x3b')]?_0x5c9003[_0x94dc('0x3a')]:_0xa74542['model'];if(_0xfcf112['query'][_0x94dc('0x47')]){_0x5c9003[_0x94dc('0x48')]=[{'all':!![]}];}_0x5c9003=_[_0x94dc('0x44')]({},_0x5c9003,_0xfcf112[_0x94dc('0x45')]);return db[_0x94dc('0x46')]['find'](_0x5c9003)[_0x94dc('0x2c')](handleEntityNotFound(_0x405d8b,null))['then'](respondWithResult(_0x405d8b,null))[_0x94dc('0x4d')](handleError(_0x405d8b,null));};exports[_0x94dc('0x4e')]=function(_0x124798,_0x4011b6){return db['AnalyticFieldReport'][_0x94dc('0x4e')](_0x124798[_0x94dc('0x4f')],{})['then'](respondWithResult(_0x4011b6,0xc9))[_0x94dc('0x4d')](handleError(_0x4011b6,null));};exports[_0x94dc('0x50')]=function(_0x593a0e,_0x3afd35){return db[_0x94dc('0x46')][_0x94dc('0x50')](_0x593a0e[_0x94dc('0x4f')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3afd35,0xc9))[_0x94dc('0x4d')](handleError(_0x3afd35,null));};exports['update']=function(_0x2ae21a,_0x3f6035){if(_0x2ae21a['body']['id']){delete _0x2ae21a[_0x94dc('0x4f')]['id'];}return db[_0x94dc('0x46')][_0x94dc('0x51')]({'where':{'id':_0x2ae21a[_0x94dc('0x52')]['id']}})[_0x94dc('0x2c')](handleEntityNotFound(_0x3f6035,null))['then'](saveUpdates(_0x2ae21a[_0x94dc('0x4f')],null))[_0x94dc('0x2c')](respondWithResult(_0x3f6035,null))[_0x94dc('0x4d')](handleError(_0x3f6035,null));};exports['destroy']=function(_0x1d6c06,_0x43b474){return db[_0x94dc('0x46')][_0x94dc('0x51')]({'where':{'id':_0x1d6c06[_0x94dc('0x52')]['id']}})[_0x94dc('0x2c')](handleEntityNotFound(_0x43b474,null))[_0x94dc('0x2c')](removeEntity(_0x43b474,null))[_0x94dc('0x4d')](handleError(_0x43b474,null));};exports[_0x94dc('0x53')]=function(_0x26552a,_0x4502a5){return db[_0x94dc('0x46')][_0x94dc('0x2b')]({'where':{'id':_0x26552a[_0x94dc('0x36')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x94dc('0x2c')](respondWithResult(_0x4502a5,0xcc))[_0x94dc('0x4d')](handleError(_0x4502a5,null));};exports[_0x94dc('0x54')]=function(_0x4e8a33,_0x348e3e,_0x1a4bcb){return db[_0x94dc('0x55')][_0x94dc('0x56')]({'where':{'id':_0x4e8a33[_0x94dc('0x52')]['id']}})[_0x94dc('0x2c')](handleEntityNotFound(_0x348e3e,null))[_0x94dc('0x2c')](function(_0x571b1e){if(_0x571b1e){return db[_0x94dc('0x57')][_0x94dc('0x58')](function(_0x49f423){return db[_0x94dc('0x46')][_0x94dc('0x2b')]({'where':{'CustomReportId':_0x4e8a33[_0x94dc('0x52')]['id']},'transaction':_0x49f423})['then'](function(_0x44c578){var _0x39719f=_['map'](_0x4e8a33['body'],function(_0x393d48){delete _0x393d48['id'];_0x393d48['CustomReportId']=_0x4e8a33[_0x94dc('0x52')]['id'];return _0x393d48;});return db['AnalyticFieldReport'][_0x94dc('0x50')](_0x39719f,{'transaction':_0x49f423});});})[_0x94dc('0x2c')](function(){return db[_0x94dc('0x46')][_0x94dc('0x59')]({'where':{'CustomReportId':_0x4e8a33[_0x94dc('0x52')]['id']}});});}})['then'](respondWithResult(_0x348e3e,null))['catch'](handleError(_0x348e3e,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index abf3245..011661c 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 _0xc017=['moment','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','lodash','../../config/logger','api'];(function(_0x152e4d,_0x27a978){var _0x2bc74f=function(_0x51befe){while(--_0x51befe){_0x152e4d['push'](_0x152e4d['shift']());}};_0x2bc74f(++_0x27a978);}(_0xc017,0x135));var _0x7c01=function(_0xad95c0,_0x496021){_0xad95c0=_0xad95c0-0x0;var _0x1b30bd=_0xc017[_0xad95c0];return _0x1b30bd;};'use strict';var _=require(_0x7c01('0x0'));var util=require('util');var logger=require(_0x7c01('0x1'))(_0x7c01('0x2'));var moment=require(_0x7c01('0x3'));var BPromise=require('bluebird');var rp=require(_0x7c01('0x4'));var fs=require('fs');var path=require(_0x7c01('0x5'));var rimraf=require(_0x7c01('0x6'));var config=require(_0x7c01('0x7'));var attributes=require(_0x7c01('0x8'));module[_0x7c01('0x9')]=function(_0x242a32,_0x593534){return _0x242a32[_0x7c01('0xa')](_0x7c01('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe9e3=['./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment'];(function(_0xaf936c,_0x527c18){var _0x1f81cd=function(_0x4360ab){while(--_0x4360ab){_0xaf936c['push'](_0xaf936c['shift']());}};_0x1f81cd(++_0x527c18);}(_0xe9e3,0x1c6));var _0x3e9e=function(_0x41e507,_0x694b79){_0x41e507=_0x41e507-0x0;var _0x3bbe37=_0xe9e3[_0x41e507];return _0x3bbe37;};'use strict';var _=require(_0x3e9e('0x0'));var util=require('util');var logger=require(_0x3e9e('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e9e('0x2'));var fs=require('fs');var path=require(_0x3e9e('0x3'));var rimraf=require(_0x3e9e('0x4'));var config=require(_0x3e9e('0x5'));var attributes=require(_0x3e9e('0x6'));module[_0x3e9e('0x7')]=function(_0x571cb4,_0x4f5962){return _0x571cb4[_0x3e9e('0x8')]('AnalyticFieldReport',attributes,{'tableName':_0x3e9e('0x9'),'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 a5f7a5f..21dbc96 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 _0xa205=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4dd524,_0x2247e5){var _0x482629=function(_0x1fc3a0){while(--_0x1fc3a0){_0x4dd524['push'](_0x4dd524['shift']());}};_0x482629(++_0x2247e5);}(_0xa205,0x1f4));var _0x5a20=function(_0x4a45b4,_0x59804f){_0x4a45b4=_0x4a45b4-0x0;var _0x1a99c9=_0xa205[_0x4a45b4];return _0x1a99c9;};'use strict';var _=require(_0x5a20('0x0'));var util=require(_0x5a20('0x1'));var moment=require(_0x5a20('0x2'));var BPromise=require('bluebird');var rs=require(_0x5a20('0x3'));var fs=require('fs');var Redis=require(_0x5a20('0x4'));var db=require(_0x5a20('0x5'))['db'];var utils=require(_0x5a20('0x6'));var logger=require(_0x5a20('0x7'))('rpc');var config=require(_0x5a20('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5a20('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c13e0,_0x157d95,_0x5cb2c0){return new BPromise(function(_0x5934db,_0x15dbc2){return client['request'](_0x5c13e0,_0x5cb2c0)[_0x5a20('0xa')](function(_0x354dfc){logger[_0x5a20('0xb')](_0x5a20('0xc'),_0x157d95,_0x5a20('0xd'));logger[_0x5a20('0xe')](_0x5a20('0xf'),_0x157d95,_0x5a20('0xd'),JSON[_0x5a20('0x10')](_0x354dfc));if(_0x354dfc[_0x5a20('0x11')]){if(_0x354dfc[_0x5a20('0x11')][_0x5a20('0x12')]===0x1f4){logger[_0x5a20('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x157d95,_0x354dfc[_0x5a20('0x11')][_0x5a20('0x13')]);return _0x15dbc2(_0x354dfc['error'][_0x5a20('0x13')]);}logger[_0x5a20('0x11')](_0x5a20('0xc'),_0x157d95,_0x354dfc[_0x5a20('0x11')][_0x5a20('0x13')]);return _0x5934db(_0x354dfc[_0x5a20('0x11')][_0x5a20('0x13')]);}else{logger[_0x5a20('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x157d95,'request\x20sent');_0x5934db(_0x354dfc['result']['message']);}})['catch'](function(_0x155aed){logger[_0x5a20('0x11')](_0x5a20('0xc'),_0x157d95,_0x155aed);_0x15dbc2(_0x155aed);});});} \ No newline at end of file +var _0x0a14=['rpc','jayson/promise','client','request','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1b6aab,_0x5683f0){var _0x181f68=function(_0x127b26){while(--_0x127b26){_0x1b6aab['push'](_0x1b6aab['shift']());}};_0x181f68(++_0x5683f0);}(_0x0a14,0xfc));var _0x40a1=function(_0x450b9e,_0x2992d8){_0x450b9e=_0x450b9e-0x0;var _0x4ff728=_0x0a14[_0x450b9e];return _0x4ff728;};'use strict';var _=require(_0x40a1('0x0'));var util=require(_0x40a1('0x1'));var moment=require(_0x40a1('0x2'));var BPromise=require(_0x40a1('0x3'));var rs=require(_0x40a1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x40a1('0x5'))['db'];var utils=require(_0x40a1('0x6'));var logger=require(_0x40a1('0x7'))(_0x40a1('0x8'));var config=require('../../config/environment');var jayson=require(_0x40a1('0x9'));var client=jayson[_0x40a1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbd448a,_0x281e0d,_0x4f09e8){return new BPromise(function(_0x1b2749,_0x469e4d){return client[_0x40a1('0xb')](_0xbd448a,_0x4f09e8)['then'](function(_0x1d6d3b){logger[_0x40a1('0xc')](_0x40a1('0xd'),_0x281e0d,_0x40a1('0xe'));logger[_0x40a1('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x281e0d,_0x40a1('0xe'),JSON[_0x40a1('0x10')](_0x1d6d3b));if(_0x1d6d3b[_0x40a1('0x11')]){if(_0x1d6d3b[_0x40a1('0x11')]['code']===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x281e0d,_0x1d6d3b[_0x40a1('0x11')]['message']);return _0x469e4d(_0x1d6d3b['error'][_0x40a1('0x12')]);}logger[_0x40a1('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x281e0d,_0x1d6d3b[_0x40a1('0x11')][_0x40a1('0x12')]);return _0x1b2749(_0x1d6d3b[_0x40a1('0x11')][_0x40a1('0x12')]);}else{logger['info'](_0x40a1('0xd'),_0x281e0d,_0x40a1('0xe'));_0x1b2749(_0x1d6d3b[_0x40a1('0x13')][_0x40a1('0x12')]);}})['catch'](function(_0x4d1b1f){logger[_0x40a1('0x11')](_0x40a1('0xd'),_0x281e0d,_0x4d1b1f);_0x469e4d(_0x4d1b1f);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 7212f11..1aaa090 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(_0x4c656e,_0x34c72f){var _0x2e6cd0=function(_0xb950dd){while(--_0xb950dd){_0x4c656e['push'](_0x4c656e['shift']());}};_0x2e6cd0(++_0x34c72f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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(_0x3d7032,_0x4f483e){var _0x3bfc3c=function(_0x48afd2){while(--_0x48afd2){_0x3d7032['push'](_0x3d7032['shift']());}};_0x3bfc3c(++_0x4f483e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 4043034..b7435df 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 _0x2f38=['name','STRING','TEXT','exports'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x2f38,0x1a7));var _0x82f3=function(_0x38c113,_0xa20999){_0x38c113=_0x38c113-0x0;var _0x3aae67=_0x2f38[_0x38c113];return _0x3aae67;};'use strict';var Sequelize=require('sequelize');module[_0x82f3('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x82f3('0x1')},'table':{'type':Sequelize[_0x82f3('0x2')]},'metric':{'type':Sequelize[_0x82f3('0x3')]},'description':{'type':Sequelize[_0x82f3('0x2')]}}; \ No newline at end of file +var _0x4a1d=['exports','STRING','name','sequelize'];(function(_0x3c5aba,_0x2406ab){var _0x220e51=function(_0x117671){while(--_0x117671){_0x3c5aba['push'](_0x3c5aba['shift']());}};_0x220e51(++_0x2406ab);}(_0x4a1d,0x77));var _0xd4a1=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4a1d[_0x432682];return _0x463d05;};'use strict';var Sequelize=require(_0xd4a1('0x0'));module[_0xd4a1('0x1')]={'name':{'type':Sequelize[_0xd4a1('0x2')],'allowNull':![],'unique':_0xd4a1('0x3')},'table':{'type':Sequelize[_0xd4a1('0x2')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xd4a1('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index b964606..399a616 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 _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x705d48,_0x585b9d){var _0x551c4c=function(_0x1fd9e2){while(--_0x1fd9e2){_0x705d48['push'](_0x705d48['shift']());}};_0x551c4c(++_0x585b9d);}(_0x46ed,0x168));var _0xd46e=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x46ed[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));}; \ No newline at end of file +var _0x9957=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','Metrics','UserProfileResource','end','error','name','map','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','AnalyticMetric','include','findAll','rawAttributes','intersection','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){var _0x472195=_0x563799['get']({'plain':!![]});var _0x39df42=_0x7995('0x28');return db[_0x7995('0x29')][_0x7995('0x27')]({'where':{'type':_0x39df42,'resourceId':_0x472195['id']}})[_0x7995('0x26')](function(){return _0x563799;});})[_0x7995('0x26')](function(){_0x204507['status'](0xcc)[_0x7995('0x2a')]();});}};}function handleEntityNotFound(_0x5911c3,_0x229742){return function(_0x49bc7e){if(!_0x49bc7e){_0x5911c3[_0x7995('0x1b')](0x194);}return _0x49bc7e;};}function handleError(_0x132a42,_0x11c1eb){_0x11c1eb=_0x11c1eb||0x1f4;return function(_0x4b6f99){logger[_0x7995('0x2b')](_0x4b6f99['stack']);if(_0x4b6f99[_0x7995('0x2c')]){delete _0x4b6f99[_0x7995('0x2c')];}_0x132a42[_0x7995('0x1c')](_0x11c1eb)['send'](_0x4b6f99);};}exports['index']=function(_0x48e573,_0x3573be){var _0xe6b0b3={},_0x327a81={},_0x2b874d={'count':0x0,'rows':[]};var _0x2e3493=_[_0x7995('0x2d')](db['AnalyticMetric']['rawAttributes'],function(_0xfa8f15){return{'name':_0xfa8f15['fieldName'],'type':_0xfa8f15[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x327a81[_0x7995('0x30')]=_[_0x7995('0x2d')](_0x2e3493,_0x7995('0x2c'));_0x327a81['query']=_[_0x7995('0x31')](_0x48e573[_0x7995('0x32')]);_0x327a81['filters']=_['intersection'](_0x327a81['model'],_0x327a81[_0x7995('0x32')]);_0xe6b0b3[_0x7995('0x33')]=_['intersection'](_0x327a81[_0x7995('0x30')],qs['fields'](_0x48e573[_0x7995('0x32')][_0x7995('0x34')]));_0xe6b0b3[_0x7995('0x33')]=_0xe6b0b3['attributes']['length']?_0xe6b0b3[_0x7995('0x33')]:_0x327a81['model'];if(!_0x48e573['query'][_0x7995('0x35')](_0x7995('0x36'))){_0xe6b0b3['limit']=qs[_0x7995('0x21')](_0x48e573[_0x7995('0x32')][_0x7995('0x21')]);_0xe6b0b3[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x48e573['query'][_0x7995('0x20')]);}_0xe6b0b3[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x48e573[_0x7995('0x32')]['sort']);_0xe6b0b3[_0x7995('0x39')]=qs[_0x7995('0x3a')](_[_0x7995('0x3b')](_0x48e573[_0x7995('0x32')],_0x327a81[_0x7995('0x3a')]),_0x2e3493);if(_0x48e573[_0x7995('0x32')]['filter']){_0xe6b0b3[_0x7995('0x39')]=_[_0x7995('0x3c')](_0xe6b0b3[_0x7995('0x39')],{'$or':_[_0x7995('0x2d')](_0x2e3493,function(_0x2e04cd){if(_0x2e04cd[_0x7995('0x2e')]!==_0x7995('0x3d')){var _0x270c0e={};_0x270c0e[_0x2e04cd[_0x7995('0x2c')]]={'$like':'%'+_0x48e573[_0x7995('0x32')][_0x7995('0x3e')]+'%'};return _0x270c0e;}})});}_0xe6b0b3=_[_0x7995('0x3c')]({},_0xe6b0b3,_0x48e573[_0x7995('0x3f')]);var _0x53cda2={'where':_0xe6b0b3['where']};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x53cda2)['then'](function(_0x4b0855){_0x2b874d[_0x7995('0x1f')]=_0x4b0855;if(_0x48e573['query']['includeAll']){_0xe6b0b3[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x42')](_0xe6b0b3);})['then'](function(_0x46ac4f){_0x2b874d['rows']=_0x46ac4f;return _0x2b874d;})[_0x7995('0x26')](respondWithFilteredResult(_0x3573be,_0xe6b0b3))['catch'](handleError(_0x3573be,null));};exports['show']=function(_0x39c5b8,_0x403f54){var _0xc04e5={'raw':!![],'where':{'id':_0x39c5b8['params']['id']}},_0x3f1c35={};_0x3f1c35[_0x7995('0x30')]=_[_0x7995('0x31')](db[_0x7995('0x40')][_0x7995('0x43')]);_0x3f1c35['query']=_['keys'](_0x39c5b8[_0x7995('0x32')]);_0x3f1c35['filters']=_[_0x7995('0x44')](_0x3f1c35['model'],_0x3f1c35[_0x7995('0x32')]);_0xc04e5['attributes']=_[_0x7995('0x44')](_0x3f1c35[_0x7995('0x30')],qs['fields'](_0x39c5b8[_0x7995('0x32')][_0x7995('0x34')]));_0xc04e5[_0x7995('0x33')]=_0xc04e5[_0x7995('0x33')]['length']?_0xc04e5[_0x7995('0x33')]:_0x3f1c35[_0x7995('0x30')];if(_0x39c5b8[_0x7995('0x32')]['includeAll']){_0xc04e5[_0x7995('0x41')]=[{'all':!![]}];}_0xc04e5=_[_0x7995('0x3c')]({},_0xc04e5,_0x39c5b8[_0x7995('0x3f')]);return db[_0x7995('0x40')][_0x7995('0x45')](_0xc04e5)['then'](handleEntityNotFound(_0x403f54,null))[_0x7995('0x26')](respondWithResult(_0x403f54,null))[_0x7995('0x46')](handleError(_0x403f54,null));};exports['create']=function(_0x3d1dbb,_0x5843ba){return db[_0x7995('0x40')][_0x7995('0x47')](_0x3d1dbb[_0x7995('0x48')],{})[_0x7995('0x26')](function(_0xddf537){var _0x14b537=_0x3d1dbb[_0x7995('0x49')]['get']({'plain':!![]});if(!_0x14b537)throw new Error(_0x7995('0x4a'));if(_0x14b537[_0x7995('0x4b')]===_0x7995('0x49')){var _0x4ffc8a=_0xddf537[_0x7995('0x4c')]({'plain':!![]});var _0x1fe77e=_0x7995('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1fe77e,'userProfileId':_0x14b537['userProfileId']},'raw':!![]})[_0x7995('0x26')](function(_0x1fd1ca){if(_0x1fd1ca&&_0x1fd1ca['autoAssociation']===0x0){return db[_0x7995('0x29')][_0x7995('0x47')]({'name':_0x4ffc8a[_0x7995('0x2c')],'resourceId':_0x4ffc8a['id'],'type':_0x1fd1ca[_0x7995('0x2c')],'sectionId':_0x1fd1ca['id']},{})[_0x7995('0x26')](function(){return _0xddf537;});}else{return _0xddf537;}})['catch'](function(_0x29ee32){logger['error'](_0x7995('0x4d'),_0x29ee32);throw _0x29ee32;});}return _0xddf537;})[_0x7995('0x26')](respondWithResult(_0x5843ba,0xc9))[_0x7995('0x46')](handleError(_0x5843ba,null));};exports['update']=function(_0x5e1f34,_0x54e2b1){if(_0x5e1f34['body']['id']){delete _0x5e1f34[_0x7995('0x48')]['id'];}return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0x5e1f34[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x54e2b1,null))[_0x7995('0x26')](saveUpdates(_0x5e1f34[_0x7995('0x48')],null))[_0x7995('0x26')](respondWithResult(_0x54e2b1,null))[_0x7995('0x46')](handleError(_0x54e2b1,null));};exports[_0x7995('0x27')]=function(_0xa7af8c,_0x133c63){return db[_0x7995('0x40')][_0x7995('0x45')]({'where':{'id':_0xa7af8c[_0x7995('0x4e')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x133c63,null))[_0x7995('0x26')](removeEntity(_0x133c63,null))[_0x7995('0x46')](handleError(_0x133c63,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 4b79833..16ecc1b 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 _0xe626=['../../config/environment','define','analytics_metrics','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3fb07b,_0x2920ca){var _0x15cdb4=function(_0x93d9d5){while(--_0x93d9d5){_0x3fb07b['push'](_0x3fb07b['shift']());}};_0x15cdb4(++_0x2920ca);}(_0xe626,0x9d));var _0x6e62=function(_0x359812,_0x36a5b2){_0x359812=_0x359812-0x0;var _0x36a54a=_0xe626[_0x359812];return _0x36a54a;};'use strict';var _=require(_0x6e62('0x0'));var util=require(_0x6e62('0x1'));var logger=require(_0x6e62('0x2'))(_0x6e62('0x3'));var moment=require('moment');var BPromise=require(_0x6e62('0x4'));var rp=require(_0x6e62('0x5'));var fs=require('fs');var path=require(_0x6e62('0x6'));var rimraf=require(_0x6e62('0x7'));var config=require(_0x6e62('0x8'));var attributes=require('./analyticMetric.attributes');module['exports']=function(_0x4a778d,_0x2ee927){return _0x4a778d[_0x6e62('0x9')]('AnalyticMetric',attributes,{'tableName':_0x6e62('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4491=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticMetric','analytics_metrics','lodash'];(function(_0x4922d9,_0x263c9b){var _0x2e43c2=function(_0x4378b1){while(--_0x4378b1){_0x4922d9['push'](_0x4922d9['shift']());}};_0x2e43c2(++_0x263c9b);}(_0x4491,0x1bb));var _0x1449=function(_0x39bd53,_0x47d856){_0x39bd53=_0x39bd53-0x0;var _0x648c9=_0x4491[_0x39bd53];return _0x648c9;};'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('./analyticMetric.attributes');module[_0x1449('0x8')]=function(_0x557482,_0x1d45eb){return _0x557482[_0x1449('0x9')](_0x1449('0xa'),attributes,{'tableName':_0x1449('0xb'),'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 79e1786..6655865 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 _0x06c5=['jayson/promise','client','http','request','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x214a71,_0x2a2a1d){var _0x46dfe6=function(_0x38832a){while(--_0x38832a){_0x214a71['push'](_0x214a71['shift']());}};_0x46dfe6(++_0x2a2a1d);}(_0x06c5,0x86));var _0x506c=function(_0x4add77,_0x3be86e){_0x4add77=_0x4add77-0x0;var _0x53c5f0=_0x06c5[_0x4add77];return _0x53c5f0;};'use strict';var _=require(_0x506c('0x0'));var util=require(_0x506c('0x1'));var moment=require(_0x506c('0x2'));var BPromise=require(_0x506c('0x3'));var rs=require(_0x506c('0x4'));var fs=require('fs');var Redis=require(_0x506c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x506c('0x6'));var logger=require(_0x506c('0x7'))(_0x506c('0x8'));var config=require(_0x506c('0x9'));var jayson=require(_0x506c('0xa'));var client=jayson[_0x506c('0xb')][_0x506c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e7569,_0x280e13,_0x27aac5){return new BPromise(function(_0xc14989,_0x12615d){return client[_0x506c('0xd')](_0x2e7569,_0x27aac5)['then'](function(_0x486172){logger[_0x506c('0xe')](_0x506c('0xf'),_0x280e13,'request\x20sent');logger[_0x506c('0x10')](_0x506c('0x11'),_0x280e13,'request\x20sent',JSON[_0x506c('0x12')](_0x486172));if(_0x486172[_0x506c('0x13')]){if(_0x486172[_0x506c('0x13')][_0x506c('0x14')]===0x1f4){logger[_0x506c('0x13')](_0x506c('0xf'),_0x280e13,_0x486172[_0x506c('0x13')][_0x506c('0x15')]);return _0x12615d(_0x486172[_0x506c('0x13')]['message']);}logger[_0x506c('0x13')](_0x506c('0xf'),_0x280e13,_0x486172[_0x506c('0x13')][_0x506c('0x15')]);return _0xc14989(_0x486172[_0x506c('0x13')][_0x506c('0x15')]);}else{logger['info'](_0x506c('0xf'),_0x280e13,_0x506c('0x16'));_0xc14989(_0x486172['result'][_0x506c('0x15')]);}})[_0x506c('0x17')](function(_0x203980){logger[_0x506c('0x13')](_0x506c('0xf'),_0x280e13,_0x203980);_0x12615d(_0x203980);});});} \ No newline at end of file +var _0x60bd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring'];(function(_0x155857,_0x48f43d){var _0x1b0346=function(_0xd276ce){while(--_0xd276ce){_0x155857['push'](_0x155857['shift']());}};_0x1b0346(++_0x48f43d);}(_0x60bd,0x162));var _0xd60b=function(_0x24595e,_0x11cb9a){_0x24595e=_0x24595e-0x0;var _0x3339fc=_0x60bd[_0x24595e];return _0x3339fc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd60b('0x0'));var BPromise=require(_0xd60b('0x1'));var rs=require(_0xd60b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd60b('0x3'))['db'];var utils=require(_0xd60b('0x4'));var logger=require(_0xd60b('0x5'))(_0xd60b('0x6'));var config=require(_0xd60b('0x7'));var jayson=require(_0xd60b('0x8'));var client=jayson[_0xd60b('0x9')][_0xd60b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e7b31,_0x7630e4,_0x327114){return new BPromise(function(_0x56c70c,_0x479cd0){return client[_0xd60b('0xb')](_0x5e7b31,_0x327114)['then'](function(_0x14a255){logger[_0xd60b('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x7630e4,_0xd60b('0xd'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x7630e4,_0xd60b('0xd'),JSON[_0xd60b('0xe')](_0x14a255));if(_0x14a255[_0xd60b('0xf')]){if(_0x14a255[_0xd60b('0xf')][_0xd60b('0x10')]===0x1f4){logger[_0xd60b('0xf')](_0xd60b('0x11'),_0x7630e4,_0x14a255['error'][_0xd60b('0x12')]);return _0x479cd0(_0x14a255['error'][_0xd60b('0x12')]);}logger[_0xd60b('0xf')](_0xd60b('0x11'),_0x7630e4,_0x14a255[_0xd60b('0xf')][_0xd60b('0x12')]);return _0x56c70c(_0x14a255[_0xd60b('0xf')][_0xd60b('0x12')]);}else{logger['info'](_0xd60b('0x11'),_0x7630e4,'request\x20sent');_0x56c70c(_0x14a255[_0xd60b('0x13')][_0xd60b('0x12')]);}})[_0xd60b('0x14')](function(_0x1908c8){logger[_0xd60b('0xf')](_0xd60b('0x11'),_0x7630e4,_0x1908c8);_0x479cd0(_0x1908c8);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 2dad19a..17dc4f1 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 _0xb673=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','put','delete','destroy'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xb673,0xa5));var _0x3b67=function(_0x3aeabe,_0x5cb212){_0x3aeabe=_0x3aeabe-0x0;var _0x5b8a7a=_0xb673[_0x3aeabe];return _0x5b8a7a;};'use strict';var multer=require(_0x3b67('0x0'));var util=require(_0x3b67('0x1'));var path=require('path');var timeout=require(_0x3b67('0x2'));var express=require(_0x3b67('0x3'));var router=express[_0x3b67('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3b67('0x5'));var interaction=require(_0x3b67('0x6'));var config=require(_0x3b67('0x7'));var controller=require('./analyticMetric.controller');router[_0x3b67('0x8')]('/',auth['isAuthenticated'](),controller[_0x3b67('0x9')]);router[_0x3b67('0x8')](_0x3b67('0xa'),auth[_0x3b67('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3b67('0xc')]('/:id',auth[_0x3b67('0xb')](),controller['update']);router[_0x3b67('0xd')](_0x3b67('0xa'),auth[_0x3b67('0xb')](),controller[_0x3b67('0xe')]);module['exports']=router; \ No newline at end of file +var _0xc3a8=['update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x6105a6,_0x393b26){var _0x3b77cb=function(_0x36c9d4){while(--_0x36c9d4){_0x6105a6['push'](_0x6105a6['shift']());}};_0x3b77cb(++_0x393b26);}(_0xc3a8,0xe8));var _0x8c3a=function(_0x5d4db8,_0x4ad01b){_0x5d4db8=_0x5d4db8-0x0;var _0x415548=_0xc3a8[_0x5d4db8];return _0x415548;};'use strict';var multer=require(_0x8c3a('0x0'));var util=require(_0x8c3a('0x1'));var path=require(_0x8c3a('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c3a('0x3'));var router=express['Router']();var fs_extra=require(_0x8c3a('0x4'));var auth=require(_0x8c3a('0x5'));var interaction=require(_0x8c3a('0x6'));var config=require(_0x8c3a('0x7'));var controller=require('./analyticMetric.controller');router[_0x8c3a('0x8')]('/',auth[_0x8c3a('0x9')](),controller[_0x8c3a('0xa')]);router[_0x8c3a('0x8')](_0x8c3a('0xb'),auth[_0x8c3a('0x9')](),controller['show']);router[_0x8c3a('0xc')]('/',auth[_0x8c3a('0x9')](),controller[_0x8c3a('0xd')]);router[_0x8c3a('0xe')](_0x8c3a('0xb'),auth['isAuthenticated'](),controller[_0x8c3a('0xf')]);router[_0x8c3a('0x10')]('/:id',auth[_0x8c3a('0x9')](),controller[_0x8c3a('0x11')]);module[_0x8c3a('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index fdd7f8d..eb83c03 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 _0xc939=['TEXT'];(function(_0x50bace,_0x16f8b7){var _0x25dc5e=function(_0x52340c){while(--_0x52340c){_0x50bace['push'](_0x50bace['shift']());}};_0x25dc5e(++_0x16f8b7);}(_0xc939,0xb2));var _0x9c93=function(_0x118176,_0x435fef){_0x118176=_0x118176-0x0;var _0x1b3df1=_0xc939[_0x118176];return _0x1b3df1;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x9c93('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x6b03=['TEXT','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6b03,0xcb));var _0x36b0=function(_0x5eb4da,_0x55cc65){_0x5eb4da=_0x5eb4da-0x0;var _0x4757ab=_0x6b03[_0x5eb4da];return _0x4757ab;};'use strict';var Sequelize=require('sequelize');module[_0x36b0('0x0')]={'tree':{'type':Sequelize[_0x36b0('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 34aeae6..c34e692 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 _0x711f=['filter','merge','VIRTUAL','options','where','AnalyticTreeReport','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','fields','length','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','stack','name','send','map','fieldName','type','model','query','filters','attributes','intersection','hasOwnProperty','nolimit','sort'];(function(_0x31464b,_0x292eb3){var _0x48ba7c=function(_0x16dc3c){while(--_0x16dc3c){_0x31464b['push'](_0x31464b['shift']());}};_0x48ba7c(++_0x292eb3);}(_0x711f,0x148));var _0xf711=function(_0x8d6c7a,_0x2d4c3c){_0x8d6c7a=_0x8d6c7a-0x0;var _0x2c305a=_0x711f[_0x8d6c7a];return _0x2c305a;};'use strict';var emlformat=require(_0xf711('0x0'));var rimraf=require(_0xf711('0x1'));var zipdir=require(_0xf711('0x2'));var jsonpatch=require(_0xf711('0x3'));var rp=require(_0xf711('0x4'));var moment=require(_0xf711('0x5'));var BPromise=require(_0xf711('0x6'));var Mustache=require(_0xf711('0x7'));var util=require('util');var path=require(_0xf711('0x8'));var sox=require(_0xf711('0x9'));var csv=require('to-csv');var ejs=require(_0xf711('0xa'));var fs=require('fs');var fs_extra=require(_0xf711('0xb'));var _=require(_0xf711('0xc'));var squel=require(_0xf711('0xd'));var crypto=require(_0xf711('0xe'));var jsforce=require(_0xf711('0xf'));var deskjs=require(_0xf711('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf711('0x11'));var Papa=require('papaparse');var Redis=require(_0xf711('0x12'));var authService=require(_0xf711('0x13'));var qs=require(_0xf711('0x14'));var as=require(_0xf711('0x15'));var hardwareService=require(_0xf711('0x16'));var logger=require(_0xf711('0x17'))(_0xf711('0x18'));var utils=require(_0xf711('0x19'));var config=require(_0xf711('0x1a'));var licenseUtil=require(_0xf711('0x1b'));var db=require(_0xf711('0x1c'))['db'];function respondWithStatusCode(_0x34447f,_0x159bef){_0x159bef=_0x159bef||0xcc;return function(_0x5f07a0){if(_0x5f07a0){return _0x34447f[_0xf711('0x1d')](_0x159bef);}return _0x34447f['status'](_0x159bef)[_0xf711('0x1e')]();};}function respondWithResult(_0x12bf5a,_0x4daf85){_0x4daf85=_0x4daf85||0xc8;return function(_0x2fbc39){if(_0x2fbc39){return _0x12bf5a[_0xf711('0x1f')](_0x4daf85)[_0xf711('0x20')](_0x2fbc39);}};}function respondWithFilteredResult(_0x1779ef,_0x304fca){return function(_0xe4a9f9){if(_0xe4a9f9){var _0x2c30a6=typeof _0x304fca[_0xf711('0x21')]===_0xf711('0x22')&&typeof _0x304fca['limit']===_0xf711('0x22');var _0x744a2d=_0xe4a9f9[_0xf711('0x23')];var _0x2c6a2c=_0x2c30a6?0x0:_0x304fca[_0xf711('0x21')];var _0x156cf5=_0x2c30a6?_0xe4a9f9[_0xf711('0x23')]:_0x304fca[_0xf711('0x21')]+_0x304fca[_0xf711('0x24')];var _0x10efb1;if(_0x156cf5>=_0x744a2d){_0x156cf5=_0x744a2d;_0x10efb1=0xc8;}else{_0x10efb1=0xce;}_0x1779ef[_0xf711('0x1f')](_0x10efb1);return _0x1779ef[_0xf711('0x25')]('Content-Range',_0x2c6a2c+'-'+_0x156cf5+'/'+_0x744a2d)[_0xf711('0x20')](_0xe4a9f9);}return null;};}function patchUpdates(_0x112058){return function(_0x542caf){try{jsonpatch[_0xf711('0x26')](_0x542caf,_0x112058,!![]);}catch(_0x4ca64a){return BPromise[_0xf711('0x27')](_0x4ca64a);}return _0x542caf[_0xf711('0x28')]();};}function saveUpdates(_0x2c7818,_0x55907f){return function(_0x281a8d){if(_0x281a8d){return _0x281a8d['update'](_0x2c7818)[_0xf711('0x29')](function(_0x313800){return _0x313800;});}return null;};}function removeEntity(_0x58a860,_0x907546){return function(_0x42dcd3){if(_0x42dcd3){return _0x42dcd3[_0xf711('0x2a')]()['then'](function(){_0x58a860[_0xf711('0x1f')](0xcc)[_0xf711('0x1e')]();});}};}function handleEntityNotFound(_0x53ca13,_0x190a71){return function(_0x222525){if(!_0x222525){_0x53ca13[_0xf711('0x1d')](0x194);}return _0x222525;};}function handleError(_0x2e2967,_0x20f2e7){_0x20f2e7=_0x20f2e7||0x1f4;return function(_0x524273){logger['error'](_0x524273[_0xf711('0x2b')]);if(_0x524273[_0xf711('0x2c')]){delete _0x524273[_0xf711('0x2c')];}_0x2e2967[_0xf711('0x1f')](_0x20f2e7)[_0xf711('0x2d')](_0x524273);};}exports['index']=function(_0x4d551b,_0x51efed){var _0x5751c9={},_0x180905={},_0x384e99={'count':0x0,'rows':[]};var _0x46ea7b=_[_0xf711('0x2e')](db['AnalyticTreeReport']['rawAttributes'],function(_0x2dc1b7){return{'name':_0x2dc1b7[_0xf711('0x2f')],'type':_0x2dc1b7[_0xf711('0x30')]['key']};});_0x180905[_0xf711('0x31')]=_[_0xf711('0x2e')](_0x46ea7b,_0xf711('0x2c'));_0x180905[_0xf711('0x32')]=_['keys'](_0x4d551b[_0xf711('0x32')]);_0x180905[_0xf711('0x33')]=_['intersection'](_0x180905[_0xf711('0x31')],_0x180905[_0xf711('0x32')]);_0x5751c9[_0xf711('0x34')]=_[_0xf711('0x35')](_0x180905['model'],qs['fields'](_0x4d551b['query']['fields']));_0x5751c9['attributes']=_0x5751c9[_0xf711('0x34')]['length']?_0x5751c9[_0xf711('0x34')]:_0x180905['model'];if(!_0x4d551b[_0xf711('0x32')][_0xf711('0x36')](_0xf711('0x37'))){_0x5751c9[_0xf711('0x24')]=qs[_0xf711('0x24')](_0x4d551b['query']['limit']);_0x5751c9[_0xf711('0x21')]=qs[_0xf711('0x21')](_0x4d551b[_0xf711('0x32')][_0xf711('0x21')]);}_0x5751c9['order']=qs[_0xf711('0x38')](_0x4d551b[_0xf711('0x32')][_0xf711('0x38')]);_0x5751c9['where']=qs[_0xf711('0x33')](_['pick'](_0x4d551b[_0xf711('0x32')],_0x180905[_0xf711('0x33')]),_0x46ea7b);if(_0x4d551b[_0xf711('0x32')][_0xf711('0x39')]){_0x5751c9['where']=_[_0xf711('0x3a')](_0x5751c9['where'],{'$or':_[_0xf711('0x2e')](_0x46ea7b,function(_0x20e119){if(_0x20e119[_0xf711('0x30')]!==_0xf711('0x3b')){var _0x46c9b2={};_0x46c9b2[_0x20e119[_0xf711('0x2c')]]={'$like':'%'+_0x4d551b['query'][_0xf711('0x39')]+'%'};return _0x46c9b2;}})});}_0x5751c9=_['merge']({},_0x5751c9,_0x4d551b[_0xf711('0x3c')]);var _0x268cb3={'where':_0x5751c9[_0xf711('0x3d')]};return db[_0xf711('0x3e')][_0xf711('0x23')](_0x268cb3)['then'](function(_0x5d2875){_0x384e99[_0xf711('0x23')]=_0x5d2875;if(_0x4d551b[_0xf711('0x32')][_0xf711('0x3f')]){_0x5751c9[_0xf711('0x40')]=[{'all':!![]}];}return db[_0xf711('0x3e')][_0xf711('0x41')](_0x5751c9);})[_0xf711('0x29')](function(_0x4437e7){_0x384e99[_0xf711('0x42')]=_0x4437e7;return _0x384e99;})['then'](respondWithFilteredResult(_0x51efed,_0x5751c9))[_0xf711('0x43')](handleError(_0x51efed,null));};exports['show']=function(_0x334486,_0x37c672){var _0x2f683b={'raw':!![],'where':{'id':_0x334486[_0xf711('0x44')]['id']}},_0x5ef868={};_0x5ef868[_0xf711('0x31')]=_['keys'](db[_0xf711('0x3e')][_0xf711('0x45')]);_0x5ef868[_0xf711('0x32')]=_[_0xf711('0x46')](_0x334486['query']);_0x5ef868[_0xf711('0x33')]=_[_0xf711('0x35')](_0x5ef868[_0xf711('0x31')],_0x5ef868[_0xf711('0x32')]);_0x2f683b['attributes']=_['intersection'](_0x5ef868[_0xf711('0x31')],qs['fields'](_0x334486['query'][_0xf711('0x47')]));_0x2f683b[_0xf711('0x34')]=_0x2f683b[_0xf711('0x34')][_0xf711('0x48')]?_0x2f683b[_0xf711('0x34')]:_0x5ef868[_0xf711('0x31')];if(_0x334486[_0xf711('0x32')][_0xf711('0x3f')]){_0x2f683b[_0xf711('0x40')]=[{'all':!![]}];}_0x2f683b=_['merge']({},_0x2f683b,_0x334486[_0xf711('0x3c')]);return db[_0xf711('0x3e')][_0xf711('0x49')](_0x2f683b)['then'](handleEntityNotFound(_0x37c672,null))[_0xf711('0x29')](respondWithResult(_0x37c672,null))[_0xf711('0x43')](handleError(_0x37c672,null));};exports[_0xf711('0x4a')]=function(_0x4e759b,_0x242544){return db[_0xf711('0x3e')][_0xf711('0x4a')](_0x4e759b[_0xf711('0x4b')],{})[_0xf711('0x29')](respondWithResult(_0x242544,0xc9))[_0xf711('0x43')](handleError(_0x242544,null));};exports[_0xf711('0x4c')]=function(_0x1e3502,_0x36f610){if(_0x1e3502['body']['id']){delete _0x1e3502[_0xf711('0x4b')]['id'];}return db[_0xf711('0x3e')]['find']({'where':{'id':_0x1e3502[_0xf711('0x44')]['id']}})[_0xf711('0x29')](handleEntityNotFound(_0x36f610,null))['then'](saveUpdates(_0x1e3502[_0xf711('0x4b')],null))[_0xf711('0x29')](respondWithResult(_0x36f610,null))['catch'](handleError(_0x36f610,null));};exports[_0xf711('0x2a')]=function(_0x18f8eb,_0x50bf89){return db[_0xf711('0x3e')][_0xf711('0x49')]({'where':{'id':_0x18f8eb[_0xf711('0x44')]['id']}})[_0xf711('0x29')](handleEntityNotFound(_0x50bf89,null))[_0xf711('0x29')](removeEntity(_0x50bf89,null))[_0xf711('0x43')](handleError(_0x50bf89,null));}; \ No newline at end of file +var _0x4c19=['params','includeAll','find','create','body','rimraf','fast-json-patch','request-promise','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/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','AnalyticTreeReport','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x4c19,0x93));var _0x94c1=function(_0x45b4d9,_0x6228b9){_0x45b4d9=_0x45b4d9-0x0;var _0x54ae0e=_0x4c19[_0x45b4d9];return _0x54ae0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94c1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x94c1('0x1'));var rp=require(_0x94c1('0x2'));var moment=require('moment');var BPromise=require(_0x94c1('0x3'));var Mustache=require(_0x94c1('0x4'));var util=require('util');var path=require(_0x94c1('0x5'));var sox=require(_0x94c1('0x6'));var csv=require(_0x94c1('0x7'));var ejs=require(_0x94c1('0x8'));var fs=require('fs');var fs_extra=require(_0x94c1('0x9'));var _=require('lodash');var squel=require(_0x94c1('0xa'));var crypto=require(_0x94c1('0xb'));var jsforce=require(_0x94c1('0xc'));var deskjs=require(_0x94c1('0xd'));var toCsv=require(_0x94c1('0x7'));var querystring=require(_0x94c1('0xe'));var Papa=require(_0x94c1('0xf'));var Redis=require(_0x94c1('0x10'));var authService=require(_0x94c1('0x11'));var qs=require(_0x94c1('0x12'));var as=require(_0x94c1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x94c1('0x14'));var config=require(_0x94c1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x94c1('0x16'))['db'];function respondWithStatusCode(_0x21adf1,_0x1360e8){_0x1360e8=_0x1360e8||0xcc;return function(_0x3c350a){if(_0x3c350a){return _0x21adf1['sendStatus'](_0x1360e8);}return _0x21adf1[_0x94c1('0x17')](_0x1360e8)[_0x94c1('0x18')]();};}function respondWithResult(_0x30cfa5,_0x435f38){_0x435f38=_0x435f38||0xc8;return function(_0x21b028){if(_0x21b028){return _0x30cfa5[_0x94c1('0x17')](_0x435f38)[_0x94c1('0x19')](_0x21b028);}};}function respondWithFilteredResult(_0x9f858f,_0xc27a2e){return function(_0x5e023b){if(_0x5e023b){var _0x3f8ead=typeof _0xc27a2e[_0x94c1('0x1a')]===_0x94c1('0x1b')&&typeof _0xc27a2e[_0x94c1('0x1c')]===_0x94c1('0x1b');var _0x315742=_0x5e023b[_0x94c1('0x1d')];var _0x222db0=_0x3f8ead?0x0:_0xc27a2e['offset'];var _0x5ed13b=_0x3f8ead?_0x5e023b['count']:_0xc27a2e[_0x94c1('0x1a')]+_0xc27a2e[_0x94c1('0x1c')];var _0x4c4721;if(_0x5ed13b>=_0x315742){_0x5ed13b=_0x315742;_0x4c4721=0xc8;}else{_0x4c4721=0xce;}_0x9f858f['status'](_0x4c4721);return _0x9f858f[_0x94c1('0x1e')](_0x94c1('0x1f'),_0x222db0+'-'+_0x5ed13b+'/'+_0x315742)[_0x94c1('0x19')](_0x5e023b);}return null;};}function patchUpdates(_0x36970e){return function(_0x595b25){try{jsonpatch[_0x94c1('0x20')](_0x595b25,_0x36970e,!![]);}catch(_0x3d0478){return BPromise[_0x94c1('0x21')](_0x3d0478);}return _0x595b25[_0x94c1('0x22')]();};}function saveUpdates(_0x40af9f,_0x6a32c3){return function(_0x4b234f){if(_0x4b234f){return _0x4b234f[_0x94c1('0x23')](_0x40af9f)[_0x94c1('0x24')](function(_0x196818){return _0x196818;});}return null;};}function removeEntity(_0x49fddb,_0xa05ca4){return function(_0x25bba6){if(_0x25bba6){return _0x25bba6[_0x94c1('0x25')]()[_0x94c1('0x24')](function(){_0x49fddb[_0x94c1('0x17')](0xcc)[_0x94c1('0x18')]();});}};}function handleEntityNotFound(_0x187d6e,_0x2b7f05){return function(_0x33e1fd){if(!_0x33e1fd){_0x187d6e[_0x94c1('0x26')](0x194);}return _0x33e1fd;};}function handleError(_0xf721e3,_0xf5c187){_0xf5c187=_0xf5c187||0x1f4;return function(_0x1df841){logger[_0x94c1('0x27')](_0x1df841[_0x94c1('0x28')]);if(_0x1df841['name']){delete _0x1df841[_0x94c1('0x29')];}_0xf721e3[_0x94c1('0x17')](_0xf5c187)[_0x94c1('0x2a')](_0x1df841);};}exports[_0x94c1('0x2b')]=function(_0xc9995f,_0x55cdf9){var _0x300aaa={},_0x336b02={},_0x1a56ff={'count':0x0,'rows':[]};var _0x486f3a=_[_0x94c1('0x2c')](db[_0x94c1('0x2d')]['rawAttributes'],function(_0x43d754){return{'name':_0x43d754['fieldName'],'type':_0x43d754[_0x94c1('0x2e')]['key']};});_0x336b02[_0x94c1('0x2f')]=_['map'](_0x486f3a,_0x94c1('0x29'));_0x336b02[_0x94c1('0x30')]=_[_0x94c1('0x31')](_0xc9995f['query']);_0x336b02[_0x94c1('0x32')]=_[_0x94c1('0x33')](_0x336b02[_0x94c1('0x2f')],_0x336b02[_0x94c1('0x30')]);_0x300aaa[_0x94c1('0x34')]=_[_0x94c1('0x33')](_0x336b02[_0x94c1('0x2f')],qs[_0x94c1('0x35')](_0xc9995f['query'][_0x94c1('0x35')]));_0x300aaa[_0x94c1('0x34')]=_0x300aaa[_0x94c1('0x34')][_0x94c1('0x36')]?_0x300aaa['attributes']:_0x336b02[_0x94c1('0x2f')];if(!_0xc9995f[_0x94c1('0x30')]['hasOwnProperty'](_0x94c1('0x37'))){_0x300aaa[_0x94c1('0x1c')]=qs[_0x94c1('0x1c')](_0xc9995f[_0x94c1('0x30')][_0x94c1('0x1c')]);_0x300aaa[_0x94c1('0x1a')]=qs[_0x94c1('0x1a')](_0xc9995f['query'][_0x94c1('0x1a')]);}_0x300aaa['order']=qs[_0x94c1('0x38')](_0xc9995f['query']['sort']);_0x300aaa[_0x94c1('0x39')]=qs[_0x94c1('0x32')](_[_0x94c1('0x3a')](_0xc9995f[_0x94c1('0x30')],_0x336b02[_0x94c1('0x32')]),_0x486f3a);if(_0xc9995f[_0x94c1('0x30')][_0x94c1('0x3b')]){_0x300aaa[_0x94c1('0x39')]=_[_0x94c1('0x3c')](_0x300aaa[_0x94c1('0x39')],{'$or':_[_0x94c1('0x2c')](_0x486f3a,function(_0x23f586){if(_0x23f586[_0x94c1('0x2e')]!==_0x94c1('0x3d')){var _0x37e7e6={};_0x37e7e6[_0x23f586['name']]={'$like':'%'+_0xc9995f[_0x94c1('0x30')][_0x94c1('0x3b')]+'%'};return _0x37e7e6;}})});}_0x300aaa=_[_0x94c1('0x3c')]({},_0x300aaa,_0xc9995f[_0x94c1('0x3e')]);var _0x359275={'where':_0x300aaa[_0x94c1('0x39')]};return db[_0x94c1('0x2d')][_0x94c1('0x1d')](_0x359275)[_0x94c1('0x24')](function(_0x35f9b7){_0x1a56ff[_0x94c1('0x1d')]=_0x35f9b7;if(_0xc9995f['query']['includeAll']){_0x300aaa[_0x94c1('0x3f')]=[{'all':!![]}];}return db[_0x94c1('0x2d')]['findAll'](_0x300aaa);})[_0x94c1('0x24')](function(_0x4104e1){_0x1a56ff['rows']=_0x4104e1;return _0x1a56ff;})[_0x94c1('0x24')](respondWithFilteredResult(_0x55cdf9,_0x300aaa))[_0x94c1('0x40')](handleError(_0x55cdf9,null));};exports[_0x94c1('0x41')]=function(_0x8b0801,_0x67c8fd){var _0x223168={'raw':!![],'where':{'id':_0x8b0801[_0x94c1('0x42')]['id']}},_0x20d00a={};_0x20d00a[_0x94c1('0x2f')]=_[_0x94c1('0x31')](db[_0x94c1('0x2d')]['rawAttributes']);_0x20d00a['query']=_[_0x94c1('0x31')](_0x8b0801['query']);_0x20d00a[_0x94c1('0x32')]=_['intersection'](_0x20d00a[_0x94c1('0x2f')],_0x20d00a[_0x94c1('0x30')]);_0x223168[_0x94c1('0x34')]=_[_0x94c1('0x33')](_0x20d00a['model'],qs[_0x94c1('0x35')](_0x8b0801[_0x94c1('0x30')][_0x94c1('0x35')]));_0x223168['attributes']=_0x223168[_0x94c1('0x34')][_0x94c1('0x36')]?_0x223168[_0x94c1('0x34')]:_0x20d00a[_0x94c1('0x2f')];if(_0x8b0801[_0x94c1('0x30')][_0x94c1('0x43')]){_0x223168[_0x94c1('0x3f')]=[{'all':!![]}];}_0x223168=_[_0x94c1('0x3c')]({},_0x223168,_0x8b0801[_0x94c1('0x3e')]);return db[_0x94c1('0x2d')][_0x94c1('0x44')](_0x223168)['then'](handleEntityNotFound(_0x67c8fd,null))[_0x94c1('0x24')](respondWithResult(_0x67c8fd,null))['catch'](handleError(_0x67c8fd,null));};exports['create']=function(_0x500b02,_0x29b38b){return db[_0x94c1('0x2d')][_0x94c1('0x45')](_0x500b02[_0x94c1('0x46')],{})[_0x94c1('0x24')](respondWithResult(_0x29b38b,0xc9))[_0x94c1('0x40')](handleError(_0x29b38b,null));};exports[_0x94c1('0x23')]=function(_0x39c247,_0x528981){if(_0x39c247[_0x94c1('0x46')]['id']){delete _0x39c247[_0x94c1('0x46')]['id'];}return db[_0x94c1('0x2d')][_0x94c1('0x44')]({'where':{'id':_0x39c247[_0x94c1('0x42')]['id']}})[_0x94c1('0x24')](handleEntityNotFound(_0x528981,null))[_0x94c1('0x24')](saveUpdates(_0x39c247[_0x94c1('0x46')],null))[_0x94c1('0x24')](respondWithResult(_0x528981,null))[_0x94c1('0x40')](handleError(_0x528981,null));};exports[_0x94c1('0x25')]=function(_0x531f09,_0x2f9d5f){return db[_0x94c1('0x2d')][_0x94c1('0x44')]({'where':{'id':_0x531f09[_0x94c1('0x42')]['id']}})['then'](handleEntityNotFound(_0x2f9d5f,null))[_0x94c1('0x24')](removeEntity(_0x2f9d5f,null))[_0x94c1('0x40')](handleError(_0x2f9d5f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index d2737a6..baf2933 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 _0x42a1=['AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','define'];(function(_0x14cb58,_0x214d62){var _0x5f097e=function(_0x5b8666){while(--_0x5b8666){_0x14cb58['push'](_0x14cb58['shift']());}};_0x5f097e(++_0x214d62);}(_0x42a1,0x1e2));var _0x142a=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x42a1[_0x1deee5];return _0x1d6c3a;};'use strict';var _=require(_0x142a('0x0'));var util=require('util');var logger=require(_0x142a('0x1'))(_0x142a('0x2'));var moment=require(_0x142a('0x3'));var BPromise=require(_0x142a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x142a('0x5'));var rimraf=require(_0x142a('0x6'));var config=require(_0x142a('0x7'));var attributes=require(_0x142a('0x8'));module['exports']=function(_0x1b1fa3,_0x1dcfea){return _0x1b1fa3[_0x142a('0x9')](_0x142a('0xa'),attributes,{'tableName':_0x142a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x839f=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x839f,0x16b));var _0xf839=function(_0x4cc377,_0x221b18){_0x4cc377=_0x4cc377-0x0;var _0x54e397=_0x839f[_0x4cc377];return _0x54e397;};'use strict';var _=require(_0xf839('0x0'));var util=require(_0xf839('0x1'));var logger=require(_0xf839('0x2'))(_0xf839('0x3'));var moment=require(_0xf839('0x4'));var BPromise=require(_0xf839('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf839('0x6'));var rimraf=require(_0xf839('0x7'));var config=require(_0xf839('0x8'));var attributes=require(_0xf839('0x9'));module[_0xf839('0xa')]=function(_0x45c65a,_0x6ae79b){return _0x45c65a[_0xf839('0xb')](_0xf839('0xc'),attributes,{'tableName':_0xf839('0xd'),'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 a452606..553a275 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x18486c,_0x2d14d2){var _0x28e891=function(_0x52ec1b){while(--_0x52ec1b){_0x18486c['push'](_0x18486c['shift']());}};_0x28e891(++_0x2d14d2);}(_0x2ef3,0xba));var _0x32ef=function(_0x2def02,_0x23251d){_0x2def02=_0x2def02-0x0;var _0x218bbd=_0x2ef3[_0x2def02];return _0x218bbd;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +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(_0x2a2cc2,_0x2ae390){var _0x278fdc=function(_0x186dfc){while(--_0x186dfc){_0x2a2cc2['push'](_0x2a2cc2['shift']());}};_0x278fdc(++_0x2ae390);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'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 5490473..1bc7e83 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 _0x098d=['post','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','isAuthenticated','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x098d,0x196));var _0xd098=function(_0x178856,_0x41f045){_0x178856=_0x178856-0x0;var _0x3c7fe7=_0x098d[_0x178856];return _0x3c7fe7;};'use strict';var multer=require(_0xd098('0x0'));var util=require(_0xd098('0x1'));var path=require(_0xd098('0x2'));var timeout=require('connect-timeout');var express=require(_0xd098('0x3'));var router=express[_0xd098('0x4')]();var fs_extra=require(_0xd098('0x5'));var auth=require(_0xd098('0x6'));var interaction=require(_0xd098('0x7'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xd098('0x8')]('/',auth['isAuthenticated'](),controller[_0xd098('0x9')]);router[_0xd098('0x8')]('/:id',auth[_0xd098('0xa')](),controller[_0xd098('0xb')]);router[_0xd098('0xc')]('/',auth[_0xd098('0xa')](),controller[_0xd098('0xd')]);router['put'](_0xd098('0xe'),auth[_0xd098('0xa')](),controller[_0xd098('0xf')]);router[_0xd098('0x10')](_0xd098('0xe'),auth[_0xd098('0xa')](),controller[_0xd098('0x11')]);module[_0xd098('0x12')]=router; \ No newline at end of file +var _0xadfb=['post','create','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','/:id','show'];(function(_0x375aa1,_0x389dbb){var _0x236a19=function(_0x423189){while(--_0x423189){_0x375aa1['push'](_0x375aa1['shift']());}};_0x236a19(++_0x389dbb);}(_0xadfb,0xd6));var _0xbadf=function(_0x277a45,_0x52b0b8){_0x277a45=_0x277a45-0x0;var _0x2fa275=_0xadfb[_0x277a45];return _0x2fa275;};'use strict';var multer=require(_0xbadf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xbadf('0x1'));var express=require(_0xbadf('0x2'));var router=express[_0xbadf('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbadf('0x4'));var config=require(_0xbadf('0x5'));var controller=require(_0xbadf('0x6'));router['get']('/',auth[_0xbadf('0x7')](),controller['index']);router['get'](_0xbadf('0x8'),auth['isAuthenticated'](),controller[_0xbadf('0x9')]);router[_0xbadf('0xa')]('/',auth[_0xbadf('0x7')](),controller[_0xbadf('0xb')]);router['put'](_0xbadf('0x8'),auth[_0xbadf('0x7')](),controller[_0xbadf('0xc')]);router[_0xbadf('0xd')]('/:id',auth[_0xbadf('0x7')](),controller[_0xbadf('0xe')]);module[_0xbadf('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 2e486e8..33fecc4 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 _0x1928=['sequelize','exports','STRING'];(function(_0x20ee38,_0x2611cc){var _0x4e9173=function(_0x2d36d4){while(--_0x2d36d4){_0x20ee38['push'](_0x20ee38['shift']());}};_0x4e9173(++_0x2611cc);}(_0x1928,0x138));var _0x8192=function(_0x877345,_0x5678cd){_0x877345=_0x877345-0x0;var _0x5f07cf=_0x1928[_0x877345];return _0x5f07cf;};'use strict';var Sequelize=require(_0x8192('0x0'));module[_0x8192('0x1')]={'name':{'type':Sequelize[_0x8192('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8192('0x2')]}}; \ No newline at end of file +var _0x295f=['exports','STRING'];(function(_0x63e763,_0x14e831){var _0xa3b713=function(_0x1ac154){while(--_0x1ac154){_0x63e763['push'](_0x63e763['shift']());}};_0xa3b713(++_0x14e831);}(_0x295f,0x168));var _0xf295=function(_0xd94979,_0x319118){_0xd94979=_0xd94979-0x0;var _0x42fe35=_0x295f[_0xd94979];return _0x42fe35;};'use strict';var Sequelize=require('sequelize');module[_0xf295('0x0')]={'name':{'type':Sequelize[_0xf295('0x1')]},'basename':{'type':Sequelize[_0xf295('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 000cd37..1d0d35c 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 _0x415c=['update','then','destroy','stack','index','rawAttributes','fieldName','key','model','map','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','Attachment','includeAll','include','rows','catch','show','params','find','clone','get','createdAt','updatedAt','omit','body','create','originalname','basename','file','filename','download','ChatOfflineMessageId','join','root','server/files/attachments/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save'];(function(_0x14a0a0,_0x45d0cf){var _0x56b651=function(_0x1fae09){while(--_0x1fae09){_0x14a0a0['push'](_0x14a0a0['shift']());}};_0x56b651(++_0x45d0cf);}(_0x415c,0xe2));var _0xc415=function(_0x409cc5,_0x1979af){_0x409cc5=_0x409cc5-0x0;var _0x175a59=_0x415c[_0x409cc5];return _0x175a59;};'use strict';var emlformat=require(_0xc415('0x0'));var rimraf=require(_0xc415('0x1'));var zipdir=require(_0xc415('0x2'));var jsonpatch=require(_0xc415('0x3'));var rp=require(_0xc415('0x4'));var moment=require('moment');var BPromise=require(_0xc415('0x5'));var Mustache=require(_0xc415('0x6'));var util=require('util');var path=require(_0xc415('0x7'));var sox=require(_0xc415('0x8'));var csv=require(_0xc415('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc415('0xa'));var squel=require('squel');var crypto=require(_0xc415('0xb'));var jsforce=require(_0xc415('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc415('0x9'));var querystring=require(_0xc415('0xd'));var Papa=require(_0xc415('0xe'));var Redis=require(_0xc415('0xf'));var authService=require(_0xc415('0x10'));var qs=require(_0xc415('0x11'));var as=require(_0xc415('0x12'));var hardwareService=require(_0xc415('0x13'));var logger=require(_0xc415('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc415('0x15'));var db=require(_0xc415('0x16'))['db'];function respondWithStatusCode(_0x294c70,_0x18ee0a){_0x18ee0a=_0x18ee0a||0xcc;return function(_0x59bc2a){if(_0x59bc2a){return _0x294c70[_0xc415('0x17')](_0x18ee0a);}return _0x294c70[_0xc415('0x18')](_0x18ee0a)[_0xc415('0x19')]();};}function respondWithResult(_0x43f8d6,_0x38cd1d){_0x38cd1d=_0x38cd1d||0xc8;return function(_0x1f1de1){if(_0x1f1de1){return _0x43f8d6[_0xc415('0x18')](_0x38cd1d)[_0xc415('0x1a')](_0x1f1de1);}};}function respondWithFilteredResult(_0xd0fa44,_0x258495){return function(_0x2f6c40){if(_0x2f6c40){var _0x32a6c3=typeof _0x258495[_0xc415('0x1b')]===_0xc415('0x1c')&&typeof _0x258495['limit']===_0xc415('0x1c');var _0x457a0f=_0x2f6c40[_0xc415('0x1d')];var _0x255d71=_0x32a6c3?0x0:_0x258495['offset'];var _0x29a700=_0x32a6c3?_0x2f6c40[_0xc415('0x1d')]:_0x258495[_0xc415('0x1b')]+_0x258495[_0xc415('0x1e')];var _0x45176f;if(_0x29a700>=_0x457a0f){_0x29a700=_0x457a0f;_0x45176f=0xc8;}else{_0x45176f=0xce;}_0xd0fa44[_0xc415('0x18')](_0x45176f);return _0xd0fa44[_0xc415('0x1f')]('Content-Range',_0x255d71+'-'+_0x29a700+'/'+_0x457a0f)[_0xc415('0x1a')](_0x2f6c40);}return null;};}function patchUpdates(_0x349877){return function(_0x57a7c5){try{jsonpatch[_0xc415('0x20')](_0x57a7c5,_0x349877,!![]);}catch(_0x10875d){return BPromise[_0xc415('0x21')](_0x10875d);}return _0x57a7c5[_0xc415('0x22')]();};}function saveUpdates(_0x345c93,_0x1f8f00){return function(_0xe1f0ce){if(_0xe1f0ce){return _0xe1f0ce[_0xc415('0x23')](_0x345c93)[_0xc415('0x24')](function(_0x47203c){return _0x47203c;});}return null;};}function removeEntity(_0x5bc22b,_0x176b6b){return function(_0x405694){if(_0x405694){return _0x405694[_0xc415('0x25')]()[_0xc415('0x24')](function(){_0x5bc22b['status'](0xcc)[_0xc415('0x19')]();});}};}function handleEntityNotFound(_0x57dbfe,_0x460d5b){return function(_0x47375c){if(!_0x47375c){_0x57dbfe[_0xc415('0x17')](0x194);}return _0x47375c;};}function handleError(_0x46b0eb,_0x2024ac){_0x2024ac=_0x2024ac||0x1f4;return function(_0x15c232){logger['error'](_0x15c232[_0xc415('0x26')]);if(_0x15c232['name']){delete _0x15c232['name'];}_0x46b0eb[_0xc415('0x18')](_0x2024ac)['send'](_0x15c232);};}exports[_0xc415('0x27')]=function(_0x5638a6,_0x471c2b){var _0x509adc={},_0x2ee38b={},_0x2209e1={'count':0x0,'rows':[]};var _0x5c6bc0=_['map'](db['Attachment'][_0xc415('0x28')],function(_0x2c5110){return{'name':_0x2c5110[_0xc415('0x29')],'type':_0x2c5110['type'][_0xc415('0x2a')]};});_0x2ee38b[_0xc415('0x2b')]=_[_0xc415('0x2c')](_0x5c6bc0,_0xc415('0x2d'));_0x2ee38b['query']=_[_0xc415('0x2e')](_0x5638a6[_0xc415('0x2f')]);_0x2ee38b[_0xc415('0x30')]=_['intersection'](_0x2ee38b['model'],_0x2ee38b[_0xc415('0x2f')]);_0x509adc['attributes']=_[_0xc415('0x31')](_0x2ee38b[_0xc415('0x2b')],qs[_0xc415('0x32')](_0x5638a6[_0xc415('0x2f')][_0xc415('0x32')]));_0x509adc[_0xc415('0x33')]=_0x509adc[_0xc415('0x33')][_0xc415('0x34')]?_0x509adc[_0xc415('0x33')]:_0x2ee38b[_0xc415('0x2b')];if(!_0x5638a6['query'][_0xc415('0x35')](_0xc415('0x36'))){_0x509adc[_0xc415('0x1e')]=qs['limit'](_0x5638a6[_0xc415('0x2f')]['limit']);_0x509adc['offset']=qs[_0xc415('0x1b')](_0x5638a6['query'][_0xc415('0x1b')]);}_0x509adc[_0xc415('0x37')]=qs[_0xc415('0x38')](_0x5638a6[_0xc415('0x2f')][_0xc415('0x38')]);_0x509adc[_0xc415('0x39')]=qs[_0xc415('0x30')](_[_0xc415('0x3a')](_0x5638a6[_0xc415('0x2f')],_0x2ee38b[_0xc415('0x30')]),_0x5c6bc0);if(_0x5638a6[_0xc415('0x2f')][_0xc415('0x3b')]){_0x509adc[_0xc415('0x39')]=_[_0xc415('0x3c')](_0x509adc['where'],{'$or':_[_0xc415('0x2c')](_0x5c6bc0,function(_0x35bddd){if(_0x35bddd[_0xc415('0x3d')]!=='VIRTUAL'){var _0xfee81f={};_0xfee81f[_0x35bddd[_0xc415('0x2d')]]={'$like':'%'+_0x5638a6[_0xc415('0x2f')]['filter']+'%'};return _0xfee81f;}})});}_0x509adc=_[_0xc415('0x3c')]({},_0x509adc,_0x5638a6[_0xc415('0x3e')]);var _0x159edc={'where':_0x509adc[_0xc415('0x39')]};return db[_0xc415('0x3f')][_0xc415('0x1d')](_0x159edc)['then'](function(_0x20eb4b){_0x2209e1['count']=_0x20eb4b;if(_0x5638a6[_0xc415('0x2f')][_0xc415('0x40')]){_0x509adc[_0xc415('0x41')]=[{'all':!![]}];}return db[_0xc415('0x3f')]['findAll'](_0x509adc);})[_0xc415('0x24')](function(_0x51e252){_0x2209e1[_0xc415('0x42')]=_0x51e252;return _0x2209e1;})[_0xc415('0x24')](respondWithFilteredResult(_0x471c2b,_0x509adc))[_0xc415('0x43')](handleError(_0x471c2b,null));};exports[_0xc415('0x44')]=function(_0x3ecf23,_0x3c6ca0){var _0x4af4d3={'raw':!![],'where':{'id':_0x3ecf23[_0xc415('0x45')]['id']}},_0x4a196e={};_0x4a196e['model']=_[_0xc415('0x2e')](db['Attachment'][_0xc415('0x28')]);_0x4a196e[_0xc415('0x2f')]=_[_0xc415('0x2e')](_0x3ecf23['query']);_0x4a196e[_0xc415('0x30')]=_[_0xc415('0x31')](_0x4a196e[_0xc415('0x2b')],_0x4a196e[_0xc415('0x2f')]);_0x4af4d3['attributes']=_[_0xc415('0x31')](_0x4a196e[_0xc415('0x2b')],qs[_0xc415('0x32')](_0x3ecf23[_0xc415('0x2f')][_0xc415('0x32')]));_0x4af4d3['attributes']=_0x4af4d3[_0xc415('0x33')][_0xc415('0x34')]?_0x4af4d3[_0xc415('0x33')]:_0x4a196e['model'];if(_0x3ecf23[_0xc415('0x2f')][_0xc415('0x40')]){_0x4af4d3[_0xc415('0x41')]=[{'all':!![]}];}_0x4af4d3=_[_0xc415('0x3c')]({},_0x4af4d3,_0x3ecf23[_0xc415('0x3e')]);return db[_0xc415('0x3f')][_0xc415('0x46')](_0x4af4d3)[_0xc415('0x24')](handleEntityNotFound(_0x3c6ca0,null))[_0xc415('0x24')](respondWithResult(_0x3c6ca0,null))[_0xc415('0x43')](handleError(_0x3c6ca0,null));};exports[_0xc415('0x47')]=function(_0xf0c17d,_0x4c6c65){var _0x155b60={'where':{'id':_0xf0c17d[_0xc415('0x45')]['id']}},_0x315799={};_0x315799[_0xc415('0x2b')]=_[_0xc415('0x2e')](db[_0xc415('0x3f')][_0xc415('0x28')]);_0x155b60['attributes']=_[_0xc415('0x31')](_0x315799[_0xc415('0x2b')],qs[_0xc415('0x32')](_0xf0c17d['query']['fields']));_0x155b60[_0xc415('0x33')]=_0x155b60[_0xc415('0x33')][_0xc415('0x34')]?_0x155b60['attributes']:_0x315799[_0xc415('0x2b')];if(_0xf0c17d[_0xc415('0x2f')][_0xc415('0x40')]){_0x155b60['include']=[{'all':!![]}];}_0x155b60=_[_0xc415('0x3c')]({},_0x155b60,_0xf0c17d[_0xc415('0x3e')]);return db[_0xc415('0x3f')][_0xc415('0x46')](_0x155b60)[_0xc415('0x24')](handleEntityNotFound(_0x4c6c65,null))[_0xc415('0x24')](function(_0x2a75b5){if(_0x2a75b5){var _0x3240db=_0x2a75b5[_0xc415('0x48')]({'plain':!![]});_0x3240db=qs['omit'](_0x3240db,['id',_0xc415('0x49'),_0xc415('0x4a')]);_0xf0c17d['body']=_[_0xc415('0x4b')](_0xf0c17d[_0xc415('0x4c')],['id',_0xc415('0x49'),_0xc415('0x4a')]);return db[_0xc415('0x3f')][_0xc415('0x4d')](_[_0xc415('0x3c')](_0x3240db,_0xf0c17d[_0xc415('0x4c')]),{'include':_0xf0c17d[_0xc415('0x2f')][_0xc415('0x40')]?[{'all':!![]}]:undefined});}})[_0xc415('0x24')](respondWithResult(_0x4c6c65,0xc9))[_0xc415('0x43')](handleError(_0x4c6c65,null));};exports[_0xc415('0x23')]=function(_0x1d2b31,_0x53152e){if(_0x1d2b31[_0xc415('0x4c')]['id']){delete _0x1d2b31['body']['id'];}return db[_0xc415('0x3f')][_0xc415('0x46')]({'where':{'id':_0x1d2b31['params']['id']}})[_0xc415('0x24')](handleEntityNotFound(_0x53152e,null))['then'](saveUpdates(_0x1d2b31['body'],null))[_0xc415('0x24')](respondWithResult(_0x53152e,null))[_0xc415('0x43')](handleError(_0x53152e,null));};exports[_0xc415('0x25')]=function(_0x579034,_0x48922c){return db['Attachment']['find']({'where':{'id':_0x579034['params']['id']}})['then'](handleEntityNotFound(_0x48922c,null))[_0xc415('0x24')](removeEntity(_0x48922c,null))[_0xc415('0x43')](handleError(_0x48922c,null));};exports[_0xc415('0x4d')]=function(_0x58e261,_0x2ef88e,_0x1ba2a6){_0x58e261[_0xc415('0x4c')][_0xc415('0x2d')]=_0x58e261['file'][_0xc415('0x4e')];_0x58e261['body'][_0xc415('0x4f')]=_0x58e261[_0xc415('0x50')][_0xc415('0x51')];_0x58e261[_0xc415('0x4c')]['type']=_0x58e261[_0xc415('0x50')]['mimetype'];return db['Attachment'][_0xc415('0x4d')](_0x58e261[_0xc415('0x4c')])['then'](respondWithResult(_0x2ef88e,0xc9))['catch'](handleError(_0x2ef88e,null));};exports[_0xc415('0x52')]=function(_0x1fd34f,_0x354032,_0x1f62bc){return db[_0xc415('0x3f')]['findOne']({'where':{'id':_0x1fd34f[_0xc415('0x45')]['id']},'raw':!![]})[_0xc415('0x24')](handleEntityNotFound(_0x354032,null))[_0xc415('0x24')](function(_0x478916){if(_0x478916){var _0x364455=_0x478916[_0xc415('0x53')]!==null;var _0xf77a68=path[_0xc415('0x54')](config[_0xc415('0x55')],_0xc415('0x56'));if(_0x364455){_0xf77a68=path[_0xc415('0x54')](_0xf77a68,'offline-chat/');}var _0x5ebe02=path[_0xc415('0x54')](_0xf77a68,_0x478916[_0xc415('0x4f')]);return _0x354032[_0xc415('0x52')](_0x5ebe02);}})[_0xc415('0x43')](handleError(_0x354032,null));}; \ No newline at end of file +var _0x01db=['options','clone','params','find','get','omit','createdAt','updatedAt','body','originalname','basename','file','filename','mimetype','create','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','eml-format','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','Attachment','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','rawAttributes'];(function(_0x72cc4f,_0x38df3b){var _0x3c14d5=function(_0x10d93b){while(--_0x10d93b){_0x72cc4f['push'](_0x72cc4f['shift']());}};_0x3c14d5(++_0x38df3b);}(_0x01db,0x179));var _0xb01d=function(_0x139f8e,_0x55330d){_0x139f8e=_0x139f8e-0x0;var _0x5634ae=_0x01db[_0x139f8e];return _0x5634ae;};'use strict';var emlformat=require(_0xb01d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb01d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb01d('0x2'));var BPromise=require(_0xb01d('0x3'));var Mustache=require(_0xb01d('0x4'));var util=require(_0xb01d('0x5'));var path=require('path');var sox=require(_0xb01d('0x6'));var csv=require(_0xb01d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb01d('0x8'));var _=require(_0xb01d('0x9'));var squel=require(_0xb01d('0xa'));var crypto=require(_0xb01d('0xb'));var jsforce=require(_0xb01d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb01d('0x7'));var querystring=require('querystring');var Papa=require(_0xb01d('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb01d('0xe'));var as=require(_0xb01d('0xf'));var hardwareService=require(_0xb01d('0x10'));var logger=require(_0xb01d('0x11'))(_0xb01d('0x12'));var utils=require(_0xb01d('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb01d('0x14'))['db'];function respondWithStatusCode(_0xe75406,_0x439c8b){_0x439c8b=_0x439c8b||0xcc;return function(_0xdb0d3c){if(_0xdb0d3c){return _0xe75406[_0xb01d('0x15')](_0x439c8b);}return _0xe75406[_0xb01d('0x16')](_0x439c8b)[_0xb01d('0x17')]();};}function respondWithResult(_0x46d0db,_0x10046a){_0x10046a=_0x10046a||0xc8;return function(_0xef2ca7){if(_0xef2ca7){return _0x46d0db[_0xb01d('0x16')](_0x10046a)[_0xb01d('0x18')](_0xef2ca7);}};}function respondWithFilteredResult(_0x5e5b5b,_0x48d348){return function(_0x38441f){if(_0x38441f){var _0x39e13c=typeof _0x48d348[_0xb01d('0x19')]===_0xb01d('0x1a')&&typeof _0x48d348[_0xb01d('0x1b')]==='undefined';var _0x2e4b68=_0x38441f['count'];var _0x2aa02f=_0x39e13c?0x0:_0x48d348[_0xb01d('0x19')];var _0x232e70=_0x39e13c?_0x38441f[_0xb01d('0x1c')]:_0x48d348[_0xb01d('0x19')]+_0x48d348[_0xb01d('0x1b')];var _0x36d4e4;if(_0x232e70>=_0x2e4b68){_0x232e70=_0x2e4b68;_0x36d4e4=0xc8;}else{_0x36d4e4=0xce;}_0x5e5b5b['status'](_0x36d4e4);return _0x5e5b5b[_0xb01d('0x1d')](_0xb01d('0x1e'),_0x2aa02f+'-'+_0x232e70+'/'+_0x2e4b68)[_0xb01d('0x18')](_0x38441f);}return null;};}function patchUpdates(_0x394525){return function(_0x301487){try{jsonpatch[_0xb01d('0x1f')](_0x301487,_0x394525,!![]);}catch(_0x26ff2f){return BPromise['reject'](_0x26ff2f);}return _0x301487[_0xb01d('0x20')]();};}function saveUpdates(_0xca6f4c,_0x4975f7){return function(_0x4a4419){if(_0x4a4419){return _0x4a4419[_0xb01d('0x21')](_0xca6f4c)[_0xb01d('0x22')](function(_0x392ebb){return _0x392ebb;});}return null;};}function removeEntity(_0x5ae693,_0x1b7743){return function(_0x57f0cd){if(_0x57f0cd){return _0x57f0cd[_0xb01d('0x23')]()[_0xb01d('0x22')](function(){_0x5ae693[_0xb01d('0x16')](0xcc)[_0xb01d('0x17')]();});}};}function handleEntityNotFound(_0x50aa83,_0x1d66e2){return function(_0x2311c9){if(!_0x2311c9){_0x50aa83[_0xb01d('0x15')](0x194);}return _0x2311c9;};}function handleError(_0x37947e,_0x320d27){_0x320d27=_0x320d27||0x1f4;return function(_0x3ef8be){logger['error'](_0x3ef8be[_0xb01d('0x24')]);if(_0x3ef8be[_0xb01d('0x25')]){delete _0x3ef8be[_0xb01d('0x25')];}_0x37947e[_0xb01d('0x16')](_0x320d27)[_0xb01d('0x26')](_0x3ef8be);};}exports['index']=function(_0x413c5e,_0x39f63b){var _0x11ae55={},_0x29daf2={},_0xca8f29={'count':0x0,'rows':[]};var _0x4cf2b7=_[_0xb01d('0x27')](db[_0xb01d('0x28')]['rawAttributes'],function(_0x5a43ed){return{'name':_0x5a43ed[_0xb01d('0x29')],'type':_0x5a43ed[_0xb01d('0x2a')][_0xb01d('0x2b')]};});_0x29daf2[_0xb01d('0x2c')]=_[_0xb01d('0x27')](_0x4cf2b7,'name');_0x29daf2[_0xb01d('0x2d')]=_[_0xb01d('0x2e')](_0x413c5e[_0xb01d('0x2d')]);_0x29daf2['filters']=_[_0xb01d('0x2f')](_0x29daf2[_0xb01d('0x2c')],_0x29daf2[_0xb01d('0x2d')]);_0x11ae55[_0xb01d('0x30')]=_[_0xb01d('0x2f')](_0x29daf2[_0xb01d('0x2c')],qs[_0xb01d('0x31')](_0x413c5e['query'][_0xb01d('0x31')]));_0x11ae55['attributes']=_0x11ae55[_0xb01d('0x30')][_0xb01d('0x32')]?_0x11ae55[_0xb01d('0x30')]:_0x29daf2[_0xb01d('0x2c')];if(!_0x413c5e['query'][_0xb01d('0x33')](_0xb01d('0x34'))){_0x11ae55['limit']=qs[_0xb01d('0x1b')](_0x413c5e[_0xb01d('0x2d')][_0xb01d('0x1b')]);_0x11ae55[_0xb01d('0x19')]=qs[_0xb01d('0x19')](_0x413c5e['query'][_0xb01d('0x19')]);}_0x11ae55[_0xb01d('0x35')]=qs[_0xb01d('0x36')](_0x413c5e[_0xb01d('0x2d')][_0xb01d('0x36')]);_0x11ae55['where']=qs[_0xb01d('0x37')](_[_0xb01d('0x38')](_0x413c5e['query'],_0x29daf2[_0xb01d('0x37')]),_0x4cf2b7);if(_0x413c5e[_0xb01d('0x2d')][_0xb01d('0x39')]){_0x11ae55[_0xb01d('0x3a')]=_[_0xb01d('0x3b')](_0x11ae55['where'],{'$or':_[_0xb01d('0x27')](_0x4cf2b7,function(_0x56a8a6){if(_0x56a8a6[_0xb01d('0x2a')]!==_0xb01d('0x3c')){var _0x2866b1={};_0x2866b1[_0x56a8a6[_0xb01d('0x25')]]={'$like':'%'+_0x413c5e[_0xb01d('0x2d')]['filter']+'%'};return _0x2866b1;}})});}_0x11ae55=_[_0xb01d('0x3b')]({},_0x11ae55,_0x413c5e['options']);var _0x41fd58={'where':_0x11ae55['where']};return db['Attachment']['count'](_0x41fd58)[_0xb01d('0x22')](function(_0xe7526d){_0xca8f29['count']=_0xe7526d;if(_0x413c5e[_0xb01d('0x2d')][_0xb01d('0x3d')]){_0x11ae55[_0xb01d('0x3e')]=[{'all':!![]}];}return db['Attachment'][_0xb01d('0x3f')](_0x11ae55);})[_0xb01d('0x22')](function(_0x370a70){_0xca8f29[_0xb01d('0x40')]=_0x370a70;return _0xca8f29;})['then'](respondWithFilteredResult(_0x39f63b,_0x11ae55))[_0xb01d('0x41')](handleError(_0x39f63b,null));};exports[_0xb01d('0x42')]=function(_0x21a036,_0x955837){var _0x5921c6={'raw':!![],'where':{'id':_0x21a036['params']['id']}},_0x3e70e4={};_0x3e70e4[_0xb01d('0x2c')]=_[_0xb01d('0x2e')](db[_0xb01d('0x28')][_0xb01d('0x43')]);_0x3e70e4['query']=_[_0xb01d('0x2e')](_0x21a036[_0xb01d('0x2d')]);_0x3e70e4[_0xb01d('0x37')]=_['intersection'](_0x3e70e4[_0xb01d('0x2c')],_0x3e70e4[_0xb01d('0x2d')]);_0x5921c6[_0xb01d('0x30')]=_[_0xb01d('0x2f')](_0x3e70e4[_0xb01d('0x2c')],qs[_0xb01d('0x31')](_0x21a036['query'][_0xb01d('0x31')]));_0x5921c6['attributes']=_0x5921c6[_0xb01d('0x30')][_0xb01d('0x32')]?_0x5921c6[_0xb01d('0x30')]:_0x3e70e4[_0xb01d('0x2c')];if(_0x21a036[_0xb01d('0x2d')][_0xb01d('0x3d')]){_0x5921c6[_0xb01d('0x3e')]=[{'all':!![]}];}_0x5921c6=_[_0xb01d('0x3b')]({},_0x5921c6,_0x21a036[_0xb01d('0x44')]);return db[_0xb01d('0x28')]['find'](_0x5921c6)[_0xb01d('0x22')](handleEntityNotFound(_0x955837,null))[_0xb01d('0x22')](respondWithResult(_0x955837,null))[_0xb01d('0x41')](handleError(_0x955837,null));};exports[_0xb01d('0x45')]=function(_0x17b0b7,_0x26349a){var _0x528568={'where':{'id':_0x17b0b7[_0xb01d('0x46')]['id']}},_0x966cb4={};_0x966cb4[_0xb01d('0x2c')]=_[_0xb01d('0x2e')](db['Attachment'][_0xb01d('0x43')]);_0x528568[_0xb01d('0x30')]=_['intersection'](_0x966cb4[_0xb01d('0x2c')],qs[_0xb01d('0x31')](_0x17b0b7[_0xb01d('0x2d')][_0xb01d('0x31')]));_0x528568['attributes']=_0x528568[_0xb01d('0x30')][_0xb01d('0x32')]?_0x528568[_0xb01d('0x30')]:_0x966cb4[_0xb01d('0x2c')];if(_0x17b0b7['query'][_0xb01d('0x3d')]){_0x528568[_0xb01d('0x3e')]=[{'all':!![]}];}_0x528568=_['merge']({},_0x528568,_0x17b0b7[_0xb01d('0x44')]);return db[_0xb01d('0x28')][_0xb01d('0x47')](_0x528568)['then'](handleEntityNotFound(_0x26349a,null))[_0xb01d('0x22')](function(_0x1950c3){if(_0x1950c3){var _0x51dd0d=_0x1950c3[_0xb01d('0x48')]({'plain':!![]});_0x51dd0d=qs[_0xb01d('0x49')](_0x51dd0d,['id',_0xb01d('0x4a'),_0xb01d('0x4b')]);_0x17b0b7['body']=_[_0xb01d('0x49')](_0x17b0b7[_0xb01d('0x4c')],['id',_0xb01d('0x4a'),'updatedAt']);return db[_0xb01d('0x28')]['create'](_[_0xb01d('0x3b')](_0x51dd0d,_0x17b0b7[_0xb01d('0x4c')]),{'include':_0x17b0b7['query']['includeAll']?[{'all':!![]}]:undefined});}})[_0xb01d('0x22')](respondWithResult(_0x26349a,0xc9))['catch'](handleError(_0x26349a,null));};exports[_0xb01d('0x21')]=function(_0x3c7513,_0x486f36){if(_0x3c7513[_0xb01d('0x4c')]['id']){delete _0x3c7513[_0xb01d('0x4c')]['id'];}return db[_0xb01d('0x28')][_0xb01d('0x47')]({'where':{'id':_0x3c7513[_0xb01d('0x46')]['id']}})['then'](handleEntityNotFound(_0x486f36,null))[_0xb01d('0x22')](saveUpdates(_0x3c7513[_0xb01d('0x4c')],null))[_0xb01d('0x22')](respondWithResult(_0x486f36,null))[_0xb01d('0x41')](handleError(_0x486f36,null));};exports[_0xb01d('0x23')]=function(_0x45d024,_0x49efbe){return db[_0xb01d('0x28')][_0xb01d('0x47')]({'where':{'id':_0x45d024[_0xb01d('0x46')]['id']}})[_0xb01d('0x22')](handleEntityNotFound(_0x49efbe,null))[_0xb01d('0x22')](removeEntity(_0x49efbe,null))['catch'](handleError(_0x49efbe,null));};exports['create']=function(_0x5b396d,_0x2fe4f5,_0x5721f1){_0x5b396d[_0xb01d('0x4c')][_0xb01d('0x25')]=_0x5b396d['file'][_0xb01d('0x4d')];_0x5b396d[_0xb01d('0x4c')][_0xb01d('0x4e')]=_0x5b396d[_0xb01d('0x4f')][_0xb01d('0x50')];_0x5b396d[_0xb01d('0x4c')]['type']=_0x5b396d[_0xb01d('0x4f')][_0xb01d('0x51')];return db[_0xb01d('0x28')][_0xb01d('0x52')](_0x5b396d[_0xb01d('0x4c')])['then'](respondWithResult(_0x2fe4f5,0xc9))[_0xb01d('0x41')](handleError(_0x2fe4f5,null));};exports['download']=function(_0x19fa90,_0x5ae10e,_0x380759){return db['Attachment']['findOne']({'where':{'id':_0x19fa90['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5ae10e,null))[_0xb01d('0x22')](function(_0x24b62b){if(_0x24b62b){var _0x3cc2de=_0x24b62b[_0xb01d('0x53')]!==null;var _0xa0d867=path[_0xb01d('0x54')](config[_0xb01d('0x55')],_0xb01d('0x56'));if(_0x3cc2de){_0xa0d867=path[_0xb01d('0x54')](_0xa0d867,_0xb01d('0x57'));}var _0x5e4d74=path['join'](_0xa0d867,_0x24b62b[_0xb01d('0x4e')]);return _0x5ae10e[_0xb01d('0x58')](_0x5e4d74);}})[_0xb01d('0x41')](handleError(_0x5ae10e,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d211525..aa48b9c 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 _0xed6a=['rimraf','../../config/environment','./attachment.attributes','exports','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x15cc91,_0x4d6101){var _0x49cc93=function(_0x328d53){while(--_0x328d53){_0x15cc91['push'](_0x15cc91['shift']());}};_0x49cc93(++_0x4d6101);}(_0xed6a,0x14a));var _0xaed6=function(_0x109860,_0x5a9f22){_0x109860=_0x109860-0x0;var _0x85feaa=_0xed6a[_0x109860];return _0x85feaa;};'use strict';var _=require(_0xaed6('0x0'));var util=require(_0xaed6('0x1'));var logger=require(_0xaed6('0x2'))(_0xaed6('0x3'));var moment=require(_0xaed6('0x4'));var BPromise=require(_0xaed6('0x5'));var rp=require(_0xaed6('0x6'));var fs=require('fs');var path=require(_0xaed6('0x7'));var rimraf=require(_0xaed6('0x8'));var config=require(_0xaed6('0x9'));var attributes=require(_0xaed6('0xa'));module[_0xaed6('0xb')]=function(_0x1a4a43,_0x44a064){return _0x1a4a43['define']('Attachment',attributes,{'tableName':_0xaed6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x179b=['./attachment.attributes','define','Attachment','lodash','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x26eb3d,_0x2cfde2){var _0x4bd0c1=function(_0xb650cb){while(--_0xb650cb){_0x26eb3d['push'](_0x26eb3d['shift']());}};_0x4bd0c1(++_0x2cfde2);}(_0x179b,0x150));var _0xb179=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0x179b[_0x484c03];return _0x294127;};'use strict';var _=require(_0xb179('0x0'));var util=require('util');var logger=require(_0xb179('0x1'))(_0xb179('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb179('0x3'));var fs=require('fs');var path=require(_0xb179('0x4'));var rimraf=require('rimraf');var config=require(_0xb179('0x5'));var attributes=require(_0xb179('0x6'));module['exports']=function(_0x4972f7,_0x4073fd){return _0x4972f7[_0xb179('0x7')](_0xb179('0x8'),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 a39618d..128a7c7 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 _0xc577=['jayson/promise','client','http','request','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateAttachment','Attachment','create','body','options','raw','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc577,0x172));var _0x7c57=function(_0x3bfdde,_0x306be4){_0x3bfdde=_0x3bfdde-0x0;var _0x3f752a=_0xc577[_0x3bfdde];return _0x3f752a;};'use strict';var _=require(_0x7c57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7c57('0x1'));var rs=require(_0x7c57('0x2'));var fs=require('fs');var Redis=require(_0x7c57('0x3'));var db=require(_0x7c57('0x4'))['db'];var utils=require(_0x7c57('0x5'));var logger=require(_0x7c57('0x6'))(_0x7c57('0x7'));var config=require('../../config/environment');var jayson=require(_0x7c57('0x8'));var client=jayson[_0x7c57('0x9')][_0x7c57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bc454,_0x2f2c8f,_0x4bb81b){return new BPromise(function(_0x4e5cb2,_0x5c7ffb){return client[_0x7c57('0xb')](_0x2bc454,_0x4bb81b)['then'](function(_0x3ea732){logger[_0x7c57('0xc')](_0x7c57('0xd'),_0x2f2c8f,_0x7c57('0xe'));logger['debug'](_0x7c57('0xf'),_0x2f2c8f,_0x7c57('0xe'),JSON['stringify'](_0x3ea732));if(_0x3ea732[_0x7c57('0x10')]){if(_0x3ea732[_0x7c57('0x10')][_0x7c57('0x11')]===0x1f4){logger[_0x7c57('0x10')](_0x7c57('0xd'),_0x2f2c8f,_0x3ea732[_0x7c57('0x10')][_0x7c57('0x12')]);return _0x5c7ffb(_0x3ea732['error']['message']);}logger['error'](_0x7c57('0xd'),_0x2f2c8f,_0x3ea732[_0x7c57('0x10')][_0x7c57('0x12')]);return _0x4e5cb2(_0x3ea732[_0x7c57('0x10')][_0x7c57('0x12')]);}else{logger[_0x7c57('0xc')](_0x7c57('0xd'),_0x2f2c8f,_0x7c57('0xe'));_0x4e5cb2(_0x3ea732['result']['message']);}})[_0x7c57('0x13')](function(_0x2975f0){logger[_0x7c57('0x10')](_0x7c57('0xd'),_0x2f2c8f,_0x2975f0);_0x5c7ffb(_0x2975f0);});});}exports[_0x7c57('0x14')]=function(_0x48cf4f){var _0x20dd80=this;return new Promise(function(_0x30f5b1,_0x1f0eaf){return db[_0x7c57('0x15')][_0x7c57('0x16')](_0x48cf4f[_0x7c57('0x17')],{'raw':_0x48cf4f[_0x7c57('0x18')]?_0x48cf4f[_0x7c57('0x18')][_0x7c57('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x45221e){logger[_0x7c57('0xc')](_0x7c57('0x14'),_0x48cf4f);logger[_0x7c57('0x1a')]('CreateAttachment',_0x48cf4f,JSON['stringify'](_0x45221e));_0x30f5b1(_0x45221e);})['catch'](function(_0x140376){logger[_0x7c57('0x10')]('CreateAttachment',_0x140376[_0x7c57('0x12')],_0x48cf4f);_0x1f0eaf(_0x20dd80[_0x7c57('0x10')](0x1f4,_0x140376[_0x7c57('0x12')]));});});}; \ No newline at end of file +var _0x4a81=['info','result','catch','Attachment','create','options','CreateAttachment','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1c6601,_0x44e8e4){var _0x1d4bf0=function(_0x4fd511){while(--_0x4fd511){_0x1c6601['push'](_0x1c6601['shift']());}};_0x1d4bf0(++_0x44e8e4);}(_0x4a81,0x1b7));var _0x14a8=function(_0x3ce25c,_0x39ff13){_0x3ce25c=_0x3ce25c-0x0;var _0x3cb3af=_0x4a81[_0x3ce25c];return _0x3cb3af;};'use strict';var _=require(_0x14a8('0x0'));var util=require(_0x14a8('0x1'));var moment=require(_0x14a8('0x2'));var BPromise=require(_0x14a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14a8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x14a8('0x5'))(_0x14a8('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x14a8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x134295,_0x4f2829,_0x26e442){return new BPromise(function(_0x4271b5,_0x3ea48f){return client[_0x14a8('0x8')](_0x134295,_0x26e442)[_0x14a8('0x9')](function(_0x5d42cb){logger['info'](_0x14a8('0xa'),_0x4f2829,_0x14a8('0xb'));logger[_0x14a8('0xc')]('Attachment,\x20%s,\x20%s,\x20%s',_0x4f2829,_0x14a8('0xb'),JSON[_0x14a8('0xd')](_0x5d42cb));if(_0x5d42cb[_0x14a8('0xe')]){if(_0x5d42cb[_0x14a8('0xe')][_0x14a8('0xf')]===0x1f4){logger[_0x14a8('0xe')](_0x14a8('0xa'),_0x4f2829,_0x5d42cb[_0x14a8('0xe')]['message']);return _0x3ea48f(_0x5d42cb['error'][_0x14a8('0x10')]);}logger[_0x14a8('0xe')]('Attachment,\x20%s,\x20%s',_0x4f2829,_0x5d42cb[_0x14a8('0xe')]['message']);return _0x4271b5(_0x5d42cb[_0x14a8('0xe')][_0x14a8('0x10')]);}else{logger[_0x14a8('0x11')](_0x14a8('0xa'),_0x4f2829,_0x14a8('0xb'));_0x4271b5(_0x5d42cb[_0x14a8('0x12')]['message']);}})[_0x14a8('0x13')](function(_0x30de2c){logger['error'](_0x14a8('0xa'),_0x4f2829,_0x30de2c);_0x3ea48f(_0x30de2c);});});}exports['CreateAttachment']=function(_0x98e1d5){var _0x1dac45=this;return new Promise(function(_0x456b7f,_0x1069c8){return db[_0x14a8('0x14')][_0x14a8('0x15')](_0x98e1d5['body'],{'raw':_0x98e1d5[_0x14a8('0x16')]?_0x98e1d5[_0x14a8('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1956a2){logger['info'](_0x14a8('0x17'),_0x98e1d5);logger['debug'](_0x14a8('0x17'),_0x98e1d5,JSON['stringify'](_0x1956a2));_0x456b7f(_0x1956a2);})[_0x14a8('0x13')](function(_0x3afd58){logger[_0x14a8('0xe')](_0x14a8('0x17'),_0x3afd58['message'],_0x98e1d5);_0x1069c8(_0x1dac45[_0x14a8('0xe')](0x1f4,_0x3afd58['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 495e6e0..c0922a3 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x7583a5,_0x3e9c4e){var _0x167bd1=function(_0x248bf9){while(--_0x248bf9){_0x7583a5['push'](_0x7583a5['shift']());}};_0x167bd1(++_0x3e9c4e);}(_0xb10b,0x12a));var _0xbb10=function(_0x58a975,_0x4f7451){_0x58a975=_0x58a975-0x0;var _0x47f055=_0xb10b[_0x58a975];return _0x47f055;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x20e06c,_0x832c78){var _0x44a8d9=function(_0x428048){while(--_0x428048){_0x20e06c['push'](_0x20e06c['shift']());}};_0x44a8d9(++_0x832c78);}(_0xadb5,0xad));var _0x5adb=function(_0x4334dc,_0x1cd9da){_0x4334dc=_0x4334dc-0x0;var _0x186bf8=_0xadb5[_0x4334dc];return _0x186bf8;};'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('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('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 3283c48..db5a62d 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 _0x4384=['../../components/auth/service','signToken','../../config/utils','login','authenticate','/login','email','callback','google','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','find','map','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','clearBlockUser','getLicense','lodash','passport','passport-google-oauth20','../../config/environment'];(function(_0x31c8c3,_0xa85892){var _0x211f4e=function(_0x2bd83b){while(--_0x2bd83b){_0x31c8c3['push'](_0x31c8c3['shift']());}};_0x211f4e(++_0xa85892);}(_0x4384,0x15c));var _0x4438=function(_0x189317,_0x49f402){_0x189317=_0x189317-0x0;var _0x5f0ec7=_0x4384[_0x189317];return _0x5f0ec7;};'use strict';var _=require(_0x4438('0x0'));var passport=require(_0x4438('0x1'));var GoogleStrategy=require(_0x4438('0x2'))['Strategy'];var moment=require('moment');var db=require('../../mysqldb')['db'];var config=require(_0x4438('0x3'));var signToken=require(_0x4438('0x4'))[_0x4438('0x5')];var utils=require(_0x4438('0x6'));exports[_0x4438('0x7')]=passport[_0x4438('0x8')]('google',{'failureRedirect':_0x4438('0x9'),'scope':['profile',_0x4438('0xa')],'session':![]});exports[_0x4438('0xb')]=passport[_0x4438('0x8')](_0x4438('0xc'),{'failureRedirect':_0x4438('0x9'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config['google']?config[_0x4438('0xc')][_0x4438('0xd')]:'id','clientSecret':config[_0x4438('0xc')]?config[_0x4438('0xc')][_0x4438('0xe')]:_0x4438('0xf'),'callbackURL':config[_0x4438('0xc')]?config[_0x4438('0xc')][_0x4438('0x10')]:''},function(_0x3b9089,_0x58285a,_0x2a9998,_0x490261){var _0x110a5d,_0x44ef3d;return db[_0x4438('0x11')][_0x4438('0x12')]({'where':{'id':0x1},'attributes':[_0x4438('0x13'),_0x4438('0x14')],'raw':!![]})[_0x4438('0x15')](function(_0xa8e758){_0x110a5d=_0xa8e758;return db['User'][_0x4438('0x16')]({'where':{'email':_[_0x4438('0x17')](_0x2a9998['emails'],'value'),'role':{'$or':[_0x4438('0x18'),_0x4438('0x19'),'agent']}}});})[_0x4438('0x15')](function(_0x3fdb84){_0x44ef3d=_0x3fdb84;if(_0x44ef3d){if(_0x44ef3d['disabled']){return _0x490261(_0x4438('0x1a'));}else if(_0x110a5d[_0x4438('0x14')]>0x0){if(_0x44ef3d[_0x4438('0x1b')]){if(moment(_0x44ef3d[_0x4438('0x1c')])[_0x4438('0x1d')](_0x110a5d[_0x4438('0x14')],'minutes')>moment()){return _0x490261(_0x4438('0x1a'));}else{return utils[_0x4438('0x1e')](_0x44ef3d,0x0,![],null)['then'](function(){return utils[_0x4438('0x1f')](_0x44ef3d);})[_0x4438('0x15')](function(){return _0x490261(null,_0x44ef3d);});}}else{return utils['getLicense'](_0x44ef3d)[_0x4438('0x15')](function(){return _0x490261(null,_0x44ef3d);});}}else{return utils[_0x4438('0x1f')](_0x44ef3d)['then'](function(){return _0x490261(null,_0x44ef3d);});}}return _0x490261(_0x4438('0x1a'));})['catch'](function(_0x3bbc06){_0x490261(_0x3bbc06);});})); \ No newline at end of file +var _0xefa0=['callbackURL','Setting','findOne','blockDuration','then','User','find','emails','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../config/utils','login','/login','email','callback','authenticate','use','google','clientID','clientSecret'];(function(_0xa168ed,_0x3e11b3){var _0x32facf=function(_0x3bf853){while(--_0x3bf853){_0xa168ed['push'](_0xa168ed['shift']());}};_0x32facf(++_0x3e11b3);}(_0xefa0,0x1e8));var _0x0efa=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xefa0[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x0efa('0x0'));var passport=require('passport');var GoogleStrategy=require(_0x0efa('0x1'))[_0x0efa('0x2')];var moment=require(_0x0efa('0x3'));var db=require(_0x0efa('0x4'))['db'];var config=require(_0x0efa('0x5'));var signToken=require('../../components/auth/service')['signToken'];var utils=require(_0x0efa('0x6'));exports[_0x0efa('0x7')]=passport['authenticate']('google',{'failureRedirect':_0x0efa('0x8'),'scope':['profile',_0x0efa('0x9')],'session':![]});exports[_0x0efa('0xa')]=passport[_0x0efa('0xb')]('google',{'failureRedirect':_0x0efa('0x8'),'session':![]});passport[_0x0efa('0xc')](new GoogleStrategy({'clientID':config[_0x0efa('0xd')]?config[_0x0efa('0xd')][_0x0efa('0xe')]:'id','clientSecret':config['google']?config[_0x0efa('0xd')][_0x0efa('0xf')]:'secret','callbackURL':config[_0x0efa('0xd')]?config[_0x0efa('0xd')][_0x0efa('0x10')]:''},function(_0x4fbaff,_0x540ae5,_0xe275c5,_0x34d762){var _0x42e1cd,_0x2a4a27;return db[_0x0efa('0x11')][_0x0efa('0x12')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0efa('0x13')],'raw':!![]})[_0x0efa('0x14')](function(_0x48138b){_0x42e1cd=_0x48138b;return db[_0x0efa('0x15')][_0x0efa('0x16')]({'where':{'email':_['map'](_0xe275c5[_0x0efa('0x17')],'value'),'role':{'$or':[_0x0efa('0x18'),_0x0efa('0x19'),_0x0efa('0x1a')]}}});})[_0x0efa('0x14')](function(_0x5911e2){_0x2a4a27=_0x5911e2;if(_0x2a4a27){if(_0x2a4a27[_0x0efa('0x1b')]){return _0x34d762(_0x0efa('0x1c'));}else if(_0x42e1cd[_0x0efa('0x13')]>0x0){if(_0x2a4a27[_0x0efa('0x1d')]){if(moment(_0x2a4a27[_0x0efa('0x1e')])[_0x0efa('0x1f')](_0x42e1cd[_0x0efa('0x13')],_0x0efa('0x20'))>moment()){return _0x34d762(_0x0efa('0x1c'));}else{return utils[_0x0efa('0x21')](_0x2a4a27,0x0,![],null)[_0x0efa('0x14')](function(){return utils[_0x0efa('0x22')](_0x2a4a27);})[_0x0efa('0x14')](function(){return _0x34d762(null,_0x2a4a27);});}}else{return utils[_0x0efa('0x22')](_0x2a4a27)[_0x0efa('0x14')](function(){return _0x34d762(null,_0x2a4a27);});}}else{return utils[_0x0efa('0x22')](_0x2a4a27)[_0x0efa('0x14')](function(){return _0x34d762(null,_0x2a4a27);});}}return _0x34d762(_0x0efa('0x1c'));})[_0x0efa('0x23')](function(_0x3b7536){_0x34d762(_0x3b7536);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index e9c1988..6204ad9 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 _0x7c3a=['../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','isMiddleware','setTokenCookie','exports','Router','./authGoogle.controller'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x7c3a,0x18a));var _0xa7c3=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x7c3a[_0x326e79];return _0x37eb89;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0xa7c3('0x0')]();var controller=require(_0xa7c3('0x1'));var userController=require(_0xa7c3('0x2'));var authService=require(_0xa7c3('0x3'));router['get']('/',controller[_0xa7c3('0x4')]);router[_0xa7c3('0x5')](_0xa7c3('0x6'),controller[_0xa7c3('0x7')],authService[_0xa7c3('0x8')],userController[_0xa7c3('0x4')],authService[_0xa7c3('0x9')]);module[_0xa7c3('0xa')]=router; \ No newline at end of file +var _0x221b=['setTokenCookie','express','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','/callback','callback','isMiddleware','login'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x221b,0xbf));var _0xb221=function(_0x50d160,_0x447b4f){_0x50d160=_0x50d160-0x0;var _0x28172e=_0x221b[_0x50d160];return _0x28172e;};'use strict';var express=require(_0xb221('0x0'));var passport=require('passport');var router=express['Router']();var controller=require(_0xb221('0x1'));var userController=require(_0xb221('0x2'));var authService=require(_0xb221('0x3'));router[_0xb221('0x4')]('/',controller['login']);router[_0xb221('0x4')](_0xb221('0x5'),controller[_0xb221('0x6')],authService[_0xb221('0x7')],userController[_0xb221('0x8')],authService[_0xb221('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 4f4eea0..cf07e2d 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 _0x12dc=['previousPasswords','passwordHistoryLimit','resetPasswordToken','Password\x20reset!','use','util','passport','Strategy','lodash','moment','../../mysqldb','../../config/utils','findOne','blockDuration','then','password','role','disabled','blocked','blockedAt','loginAttempts','admin','user','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','clearBlockUser','getLicense','catch','MailAccount','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','email','toLowerCase','Setting','allowedLoginAttempts','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern'];(function(_0x319784,_0x47e6d4){var _0x1917da=function(_0x2cb921){while(--_0x2cb921){_0x319784['push'](_0x319784['shift']());}};_0x1917da(++_0x47e6d4);}(_0x12dc,0xab));var _0xc12d=function(_0x4e857f,_0x4a5fab){_0x4e857f=_0x4e857f-0x0;var _0x36489c=_0x12dc[_0x4e857f];return _0x36489c;};'use strict';var util=require(_0xc12d('0x0'));var passport=require(_0xc12d('0x1'));var LocalStrategy=require('passport-local')[_0xc12d('0x2')];var jayson=require('jayson/promise');var _=require(_0xc12d('0x3'));var rs=require('randomstring');var moment=require(_0xc12d('0x4'));var db=require(_0xc12d('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0xc12d('0x6'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x1b6318,_0x58120b,_0x26f6cb,_0x27fb19){var _0x2873bd,_0x17f424;return db['Setting'][_0xc12d('0x7')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc12d('0x8')],'raw':!![]})[_0xc12d('0x9')](function(_0x1ba497){_0x2873bd=_0x1ba497;return _0x1b6318[_0xc12d('0x7')]({'attributes':['id','name',_0xc12d('0xa'),'salt',_0xc12d('0xb'),_0xc12d('0xc'),_0xc12d('0xd'),_0xc12d('0xe'),_0xc12d('0xf')],'where':{'name':_0x58120b,'role':{'$or':[_0xc12d('0x10'),_0xc12d('0x11'),'agent']}}});})[_0xc12d('0x9')](function(_0x17c494){if(!_0x17c494||_0x17c494&&_0x17c494[_0xc12d('0x12')]!==_0x58120b){throw new Error(_0xc12d('0x13'));}else{_0x17f424=_0x17c494;return _0x17f424;}})[_0xc12d('0x9')](function(){_0x17f424['authenticate'](_0x26f6cb,function(_0x81ba53,_0x5c83e0){var _0x33137d=_0x17f424[_0xc12d('0xf')]+0x1;if(_0x81ba53){return _0x27fb19(_0x81ba53);}else if(!_0x5c83e0){if(_0x17f424['disabled']){return _0x27fb19(null,![],{'message':_0xc12d('0x13')});}else if(_0x2873bd['allowedLoginAttempts']>0x0){if(_0x17f424[_0xc12d('0xd')]){if(_0x2873bd[_0xc12d('0x8')]>0x0){if(moment(_0x17f424[_0xc12d('0xe')])[_0xc12d('0x14')](_0x2873bd['blockDuration'],'minutes')>moment()){return _0x27fb19(null,![],{'message':_0xc12d('0x13')});}else{return utils[_0xc12d('0x15')](_0x17f424,_0x33137d,![],null)[_0xc12d('0x9')](function(){return _0x27fb19(null,![],{'message':_0xc12d('0x13')});});}}else{return _0x27fb19(null,![],{'message':_0xc12d('0x13')});}}else{if(_0x33137d>=_0x2873bd['allowedLoginAttempts']){return utils['clearBlockUser'](_0x17f424,0x0,!![],moment())[_0xc12d('0x9')](function(){return _0x27fb19(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xc12d('0x15')](_0x17f424,_0x33137d,![],null)[_0xc12d('0x9')](function(){return _0x27fb19(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x27fb19(null,![],{'message':_0xc12d('0x13')});}}else{if(_0x17f424['disabled']){return _0x27fb19(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2873bd['allowedLoginAttempts']>0x0){if(_0x17f424[_0xc12d('0xd')]){if(_0x2873bd[_0xc12d('0x8')]>0x0){if(moment(_0x17f424[_0xc12d('0xe')])[_0xc12d('0x14')](_0x2873bd['blockDuration'],'minutes')>moment()){return _0x27fb19(null,![],{'message':_0xc12d('0x13')});}else{return utils['clearBlockUser'](_0x17f424,0x0,![],null)[_0xc12d('0x9')](function(){return utils[_0xc12d('0x16')](_0x17f424);})['then'](function(){return _0x27fb19(null,_0x17f424);});}}else{return _0x27fb19(null,![],{'message':_0xc12d('0x13')});}}else{return utils[_0xc12d('0x15')](_0x17f424,0x0,![],null)[_0xc12d('0x9')](function(){return utils[_0xc12d('0x16')](_0x17f424);})[_0xc12d('0x9')](function(){return _0x27fb19(null,_0x17f424);})[_0xc12d('0x17')](function(_0x50f501){return _0x27fb19(null,![],_0x50f501);});}}else{if(_0x17f424['blocked']){return _0x27fb19(null,![],{'message':_0xc12d('0x13')});}else{return utils[_0xc12d('0x16')](_0x17f424)['then'](function(){return _0x27fb19(null,_0x17f424);});}}}});})[_0xc12d('0x17')](function(_0x5d13d9){return _0x27fb19(null,![],_0x5d13d9);});}function sendServiceMail(_0x25072f){return db[_0xc12d('0x18')]['find']({'where':{'service':!![]},'attributes':['id',_0xc12d('0x12'),'email'],'include':[{'model':db[_0xc12d('0x19')],'as':_0xc12d('0x1a')}]})[_0xc12d('0x9')](function(_0x3aa0a8){if(!_0x3aa0a8){throw new Error(_0xc12d('0x1b'));}var _0x36f96a={'tls':{'rejectUnauthorized':![]}};if(_0x3aa0a8[_0xc12d('0x1a')][_0xc12d('0x1c')]){_0x36f96a[_0xc12d('0x1c')]=_0x3aa0a8[_0xc12d('0x1a')]['service'];}else{_0x36f96a['host']=_0x3aa0a8['Smtp'][_0xc12d('0x1d')];_0x36f96a[_0xc12d('0x1e')]=_0x3aa0a8[_0xc12d('0x1a')]['port'];_0x36f96a[_0xc12d('0x1f')]=_0x3aa0a8[_0xc12d('0x1a')][_0xc12d('0x1f')];}if(_0x3aa0a8[_0xc12d('0x1a')][_0xc12d('0x20')]){_0x36f96a[_0xc12d('0x21')]={'user':_0x3aa0a8[_0xc12d('0x1a')][_0xc12d('0x11')],'pass':_0x3aa0a8['Smtp'][_0xc12d('0x22')]};}var _0xa973ed={'account':_0x36f96a,'message':_[_0xc12d('0x23')]({'from':util[_0xc12d('0x24')]('\x22%s\x22\x20<%s>',_0x3aa0a8[_0xc12d('0x12')],_0x3aa0a8['email']||_0x3aa0a8[_0xc12d('0x1a')][_0xc12d('0x11')])},_0x25072f)};return client[_0xc12d('0x25')]('SendMail',_0xa973ed);})[_0xc12d('0x9')](function(_0xfc62ef){if(_0xfc62ef[_0xc12d('0x26')]){throw new Error(util[_0xc12d('0x24')](_0xc12d('0x27'),_0xfc62ef[_0xc12d('0x26')][_0xc12d('0x28')]||JSON[_0xc12d('0x29')](_0xfc62ef['error'])));}return!![];});}function handleError(_0x6db098,_0x391b68,_0x36332a){return _0x6db098[_0xc12d('0x2a')](_0x391b68||0x1f4)[_0xc12d('0x2b')]({'message':_0x36332a?_0x36332a['message']||_0x36332a:''});}exports[_0xc12d('0x2c')]=function(_0x21cd41,_0x1ac2dd,_0x551cf8){passport[_0xc12d('0x2d')](_0xc12d('0x2e'),function(_0x1bc9f0,_0x5e1f94,_0x4a7c97){var _0x4e8347=_0x1bc9f0||_0x4a7c97;if(_0x4e8347){return handleError(_0x1ac2dd,0x191,_0x4e8347);}if(!_0x5e1f94){return handleError(_0x1ac2dd,0x194,{'message':_0xc12d('0x2f')});}else{var _0x587484={'payload':{'id':_0x5e1f94['id'],'role':_0x5e1f94['role']},'options':{'expiresIn':0x15180}};return authService[_0xc12d('0x30')](_0x587484)[_0xc12d('0x9')](function(_0x7689a2){_0x1ac2dd['json']({'id':_0x5e1f94['id'],'token':_0x7689a2,'statusCall':'','isAlreadyLogged':_0x5e1f94[_0xc12d('0x31')]});});}})(_0x21cd41,_0x1ac2dd,_0x551cf8);};exports[_0xc12d('0x32')]=function(_0x125c4b,_0x1d7316,_0x3cdcd3){if(!_0x125c4b[_0xc12d('0x33')]['email']){return handleError(_0x1d7316,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x150698=rs['generate']();_0x125c4b['body'][_0xc12d('0x34')]=_0x125c4b[_0xc12d('0x33')][_0xc12d('0x34')]['trim']()[_0xc12d('0x35')]();var _0x1939be;return db[_0xc12d('0x36')][_0xc12d('0x7')]({'where':{'id':0x1},'attributes':[_0xc12d('0x37'),_0xc12d('0x8')],'raw':!![]})[_0xc12d('0x9')](function(_0x33a665){_0x1939be=_0x33a665;return db[_0xc12d('0x38')][_0xc12d('0x39')]({'where':{'email':_0x125c4b[_0xc12d('0x33')][_0xc12d('0x34')]}});})[_0xc12d('0x9')](function(_0x2e14e0){if(!_0x2e14e0){throw new Error(_0xc12d('0x3a'));}if(_0x2e14e0[_0xc12d('0xc')]){throw new Error(_0xc12d('0x3b'));}if(_0x2e14e0[_0xc12d('0xd')]){if(moment(_0x2e14e0[_0xc12d('0xe')])[_0xc12d('0x14')](_0x1939be[_0xc12d('0x8')],_0xc12d('0x3c'))>moment()){throw new Error(_0xc12d('0x3d'));}else{_0x2e14e0[_0xc12d('0xd')]=![];_0x2e14e0['blockedAt']=null;}}_0x2e14e0['resetPasswordToken']=_0x150698;_0x2e14e0['resetPasswordExpires']=Date[_0xc12d('0x3e')]()+0x36ee80;return _0x2e14e0[_0xc12d('0x3f')]();})[_0xc12d('0x9')](function(){return sendServiceMail({'to':_0x125c4b['body'][_0xc12d('0x34')],'subject':_0xc12d('0x40'),'text':_0xc12d('0x41')+_0xc12d('0x42')+_0xc12d('0x43')+_0x125c4b[_0xc12d('0x44')][_0xc12d('0x1d')]+_0xc12d('0x45')+_0x150698+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0xc12d('0x9')](function(){_0x1d7316['status'](0xc8)[_0xc12d('0x2b')]({'message':_0xc12d('0x46')});})[_0xc12d('0x17')](function(_0x20defb){return handleError(_0x1d7316,0x1f4,_0x20defb);});};exports[_0xc12d('0x47')]=function(_0x52cdaf,_0x3c23f6,_0x124c78){return db[_0xc12d('0x38')][_0xc12d('0x39')]({'where':{'resetPasswordToken':_0x52cdaf[_0xc12d('0x48')][_0xc12d('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xc12d('0x9')](function(_0x596704){if(!_0x596704){throw new Error(_0xc12d('0x4a'));}return db[_0xc12d('0x36')][_0xc12d('0x7')]({'attributes':['id',_0xc12d('0x4b'),_0xc12d('0x4c'),'passwordHistoryLimit']})['then'](function(_0x2e9a49){if(_0x2e9a49['securePassword'])authService[_0xc12d('0x4d')](_0x52cdaf[_0xc12d('0x33')][_0xc12d('0xa')]);if(!_0x2e9a49[_0xc12d('0x4c')]||!_0x596704[_0xc12d('0x4e')])return _0x596704;authService['validatePasswordHistory'](_0x52cdaf[_0xc12d('0x33')][_0xc12d('0xa')],_0x596704[_0xc12d('0x4e')],_0x2e9a49[_0xc12d('0x4f')]);return _0x596704;})['then'](function(){_0x596704[_0xc12d('0xa')]=_0x52cdaf[_0xc12d('0x33')][_0xc12d('0xa')];_0x596704[_0xc12d('0x50')]=null;_0x596704['resetPasswordExpires']=null;return _0x596704['save']();});})['then'](function(){_0x3c23f6[_0xc12d('0x2a')](0xc8)[_0xc12d('0x2b')]({'message':_0xc12d('0x51')});})[_0xc12d('0x17')](function(_0x231fe8){return handleError(_0x3c23f6,0x1f4,_0x231fe8);});};passport[_0xc12d('0x52')](new LocalStrategy({'usernameField':_0xc12d('0x12'),'passwordField':_0xc12d('0xa')},function(_0x30e6b8,_0x39be15,_0x3caea9){return localAuthenticate(db[_0xc12d('0x38')],_0x30e6b8,_0x39be15,_0x3caea9);})); \ No newline at end of file +var _0x75c5=['../../components/auth/service','client','http','Setting','findOne','blockDuration','then','name','salt','disabled','blocked','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','MailAccount','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','Smtp','host','port','secure','authentication','auth','format','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','email','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','blockedAt','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','lodash','randomstring','moment','../../mysqldb'];(function(_0x39cbdb,_0x255131){var _0x2bd8aa=function(_0x3c5484){while(--_0x3c5484){_0x39cbdb['push'](_0x39cbdb['shift']());}};_0x2bd8aa(++_0x255131);}(_0x75c5,0xfb));var _0x575c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75c5[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x575c('0x0'));var passport=require(_0x575c('0x1'));var LocalStrategy=require(_0x575c('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x575c('0x3'));var rs=require(_0x575c('0x4'));var moment=require(_0x575c('0x5'));var db=require(_0x575c('0x6'))['db'];var authService=require(_0x575c('0x7'));var utils=require('../../config/utils');var client=jayson[_0x575c('0x8')][_0x575c('0x9')]({'port':0x232b});function localAuthenticate(_0x62e644,_0xc786e7,_0x2d0629,_0x204764){var _0x163b31,_0x207199;return db[_0x575c('0xa')][_0x575c('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x575c('0xc')],'raw':!![]})[_0x575c('0xd')](function(_0x54767d){_0x163b31=_0x54767d;return _0x62e644[_0x575c('0xb')]({'attributes':['id',_0x575c('0xe'),'password',_0x575c('0xf'),'role',_0x575c('0x10'),_0x575c('0x11'),'blockedAt','loginAttempts'],'where':{'name':_0xc786e7,'role':{'$or':['admin',_0x575c('0x12'),_0x575c('0x13')]}}});})[_0x575c('0xd')](function(_0x1d71bb){if(!_0x1d71bb||_0x1d71bb&&_0x1d71bb[_0x575c('0xe')]!==_0xc786e7){throw new Error(_0x575c('0x14'));}else{_0x207199=_0x1d71bb;return _0x207199;}})['then'](function(){_0x207199[_0x575c('0x15')](_0x2d0629,function(_0x40a57c,_0xa2cd02){var _0x41edcb=_0x207199[_0x575c('0x16')]+0x1;if(_0x40a57c){return _0x204764(_0x40a57c);}else if(!_0xa2cd02){if(_0x207199[_0x575c('0x10')]){return _0x204764(null,![],{'message':_0x575c('0x14')});}else if(_0x163b31[_0x575c('0x17')]>0x0){if(_0x207199['blocked']){if(_0x163b31[_0x575c('0xc')]>0x0){if(moment(_0x207199['blockedAt'])[_0x575c('0x18')](_0x163b31[_0x575c('0xc')],_0x575c('0x19'))>moment()){return _0x204764(null,![],{'message':_0x575c('0x14')});}else{return utils[_0x575c('0x1a')](_0x207199,_0x41edcb,![],null)[_0x575c('0xd')](function(){return _0x204764(null,![],{'message':_0x575c('0x14')});});}}else{return _0x204764(null,![],{'message':_0x575c('0x14')});}}else{if(_0x41edcb>=_0x163b31[_0x575c('0x17')]){return utils[_0x575c('0x1a')](_0x207199,0x0,!![],moment())[_0x575c('0xd')](function(){return _0x204764(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x575c('0x1a')](_0x207199,_0x41edcb,![],null)['then'](function(){return _0x204764(null,![],{'message':_0x575c('0x14')});});}}}else{return _0x204764(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x207199[_0x575c('0x10')]){return _0x204764(null,![],{'message':_0x575c('0x14')});}else if(_0x163b31['allowedLoginAttempts']>0x0){if(_0x207199['blocked']){if(_0x163b31[_0x575c('0xc')]>0x0){if(moment(_0x207199['blockedAt'])[_0x575c('0x18')](_0x163b31['blockDuration'],_0x575c('0x19'))>moment()){return _0x204764(null,![],{'message':_0x575c('0x14')});}else{return utils[_0x575c('0x1a')](_0x207199,0x0,![],null)[_0x575c('0xd')](function(){return utils[_0x575c('0x1b')](_0x207199);})[_0x575c('0xd')](function(){return _0x204764(null,_0x207199);});}}else{return _0x204764(null,![],{'message':_0x575c('0x14')});}}else{return utils[_0x575c('0x1a')](_0x207199,0x0,![],null)[_0x575c('0xd')](function(){return utils[_0x575c('0x1b')](_0x207199);})[_0x575c('0xd')](function(){return _0x204764(null,_0x207199);})['catch'](function(_0x32c038){return _0x204764(null,![],_0x32c038);});}}else{if(_0x207199[_0x575c('0x11')]){return _0x204764(null,![],{'message':_0x575c('0x14')});}else{return utils[_0x575c('0x1b')](_0x207199)[_0x575c('0xd')](function(){return _0x204764(null,_0x207199);});}}}});})[_0x575c('0x1c')](function(_0x41497a){return _0x204764(null,![],_0x41497a);});}function sendServiceMail(_0x17b1cd){return db[_0x575c('0x1d')]['find']({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0x575c('0x1e')],'as':'Smtp'}]})[_0x575c('0xd')](function(_0x1bcd11){if(!_0x1bcd11){throw new Error(_0x575c('0x1f'));}var _0x594575={'tls':{'rejectUnauthorized':![]}};if(_0x1bcd11['Smtp'][_0x575c('0x20')]){_0x594575['service']=_0x1bcd11[_0x575c('0x21')][_0x575c('0x20')];}else{_0x594575['host']=_0x1bcd11[_0x575c('0x21')][_0x575c('0x22')];_0x594575[_0x575c('0x23')]=_0x1bcd11[_0x575c('0x21')][_0x575c('0x23')];_0x594575[_0x575c('0x24')]=_0x1bcd11[_0x575c('0x21')][_0x575c('0x24')];}if(_0x1bcd11[_0x575c('0x21')][_0x575c('0x25')]){_0x594575[_0x575c('0x26')]={'user':_0x1bcd11[_0x575c('0x21')]['user'],'pass':_0x1bcd11['Smtp']['pass']};}var _0x18f0ec={'account':_0x594575,'message':_['merge']({'from':util[_0x575c('0x27')]('\x22%s\x22\x20<%s>',_0x1bcd11[_0x575c('0xe')],_0x1bcd11['email']||_0x1bcd11[_0x575c('0x21')][_0x575c('0x12')])},_0x17b1cd)};return client[_0x575c('0x28')]('SendMail',_0x18f0ec);})[_0x575c('0xd')](function(_0x1e694e){if(_0x1e694e[_0x575c('0x29')]){throw new Error(util['format'](_0x575c('0x2a'),_0x1e694e[_0x575c('0x29')][_0x575c('0x2b')]||JSON[_0x575c('0x2c')](_0x1e694e[_0x575c('0x29')])));}return!![];});}function handleError(_0x3bdd1b,_0x50f9f1,_0x441865){return _0x3bdd1b[_0x575c('0x2d')](_0x50f9f1||0x1f4)[_0x575c('0x2e')]({'message':_0x441865?_0x441865[_0x575c('0x2b')]||_0x441865:''});}exports[_0x575c('0x2f')]=function(_0x1503dd,_0x5ca678,_0x5005f6){passport[_0x575c('0x15')](_0x575c('0x30'),function(_0x38c7c1,_0x59ea5e,_0x34acf5){var _0x4bbea=_0x38c7c1||_0x34acf5;if(_0x4bbea){return handleError(_0x5ca678,0x191,_0x4bbea);}if(!_0x59ea5e){return handleError(_0x5ca678,0x194,{'message':_0x575c('0x31')});}else{var _0x13e11f={'payload':{'id':_0x59ea5e['id'],'role':_0x59ea5e[_0x575c('0x32')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x13e11f)[_0x575c('0xd')](function(_0x563913){_0x5ca678[_0x575c('0x33')]({'id':_0x59ea5e['id'],'token':_0x563913,'statusCall':'','isAlreadyLogged':_0x59ea5e['online']});});}})(_0x1503dd,_0x5ca678,_0x5005f6);};exports['forgot']=function(_0x246816,_0x2a8c06,_0x13a789){if(!_0x246816['body'][_0x575c('0x34')]){return handleError(_0x2a8c06,0x1f4,{'message':_0x575c('0x35')});}var _0x76fe12=rs[_0x575c('0x36')]();_0x246816[_0x575c('0x37')][_0x575c('0x34')]=_0x246816[_0x575c('0x37')][_0x575c('0x34')][_0x575c('0x38')]()[_0x575c('0x39')]();var _0x245666;return db[_0x575c('0xa')][_0x575c('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x575c('0xc')],'raw':!![]})[_0x575c('0xd')](function(_0x10b9d2){_0x245666=_0x10b9d2;return db[_0x575c('0x3a')][_0x575c('0x3b')]({'where':{'email':_0x246816[_0x575c('0x37')][_0x575c('0x34')]}});})[_0x575c('0xd')](function(_0x56315a){if(!_0x56315a){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x56315a[_0x575c('0x10')]){throw new Error(_0x575c('0x3c'));}if(_0x56315a[_0x575c('0x11')]){if(moment(_0x56315a[_0x575c('0x3d')])['add'](_0x245666[_0x575c('0xc')],_0x575c('0x19'))>moment()){throw new Error(_0x575c('0x3e'));}else{_0x56315a[_0x575c('0x11')]=![];_0x56315a['blockedAt']=null;}}_0x56315a[_0x575c('0x3f')]=_0x76fe12;_0x56315a[_0x575c('0x40')]=Date['now']()+0x36ee80;return _0x56315a[_0x575c('0x41')]();})[_0x575c('0xd')](function(){return sendServiceMail({'to':_0x246816['body'][_0x575c('0x34')],'subject':_0x575c('0x42'),'text':_0x575c('0x43')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x575c('0x44')+_0x246816[_0x575c('0x45')][_0x575c('0x22')]+_0x575c('0x46')+_0x76fe12+'\x0a\x0a'+_0x575c('0x47')});})[_0x575c('0xd')](function(){_0x2a8c06[_0x575c('0x2d')](0xc8)[_0x575c('0x2e')]({'message':_0x575c('0x48')});})[_0x575c('0x1c')](function(_0x4fa6cc){return handleError(_0x2a8c06,0x1f4,_0x4fa6cc);});};exports[_0x575c('0x49')]=function(_0x3bf240,_0xf04b49,_0x7af69f){return db['User']['find']({'where':{'resetPasswordToken':_0x3bf240[_0x575c('0x4a')][_0x575c('0x4b')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x575c('0xd')](function(_0x2419b5){if(!_0x2419b5){throw new Error(_0x575c('0x4c'));}return db[_0x575c('0xa')][_0x575c('0xb')]({'attributes':['id',_0x575c('0x4d'),_0x575c('0x4e'),_0x575c('0x4f')]})[_0x575c('0xd')](function(_0x116bed){if(_0x116bed[_0x575c('0x4d')])authService[_0x575c('0x50')](_0x3bf240['body'][_0x575c('0x51')]);if(!_0x116bed['enforcePasswordHistory']||!_0x2419b5[_0x575c('0x52')])return _0x2419b5;authService[_0x575c('0x53')](_0x3bf240[_0x575c('0x37')][_0x575c('0x51')],_0x2419b5[_0x575c('0x52')],_0x116bed[_0x575c('0x4f')]);return _0x2419b5;})[_0x575c('0xd')](function(){_0x2419b5[_0x575c('0x51')]=_0x3bf240[_0x575c('0x37')][_0x575c('0x51')];_0x2419b5['resetPasswordToken']=null;_0x2419b5[_0x575c('0x40')]=null;return _0x2419b5[_0x575c('0x41')]();});})[_0x575c('0xd')](function(){_0xf04b49[_0x575c('0x2d')](0xc8)[_0x575c('0x2e')]({'message':_0x575c('0x54')});})[_0x575c('0x1c')](function(_0x3defd2){return handleError(_0xf04b49,0x1f4,_0x3defd2);});};passport[_0x575c('0x55')](new LocalStrategy({'usernameField':'name','passwordField':_0x575c('0x51')},function(_0x2b2999,_0x1226a1,_0x2392e6){return localAuthenticate(db['User'],_0x2b2999,_0x1226a1,_0x2392e6);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 493af29..82f421e 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 _0xf1b0=['/forgot','forgot','/reset/:token','reset','exports','./authLocal.controller','post'];(function(_0x2f1182,_0x5c96b5){var _0x500af0=function(_0x6f16dd){while(--_0x6f16dd){_0x2f1182['push'](_0x2f1182['shift']());}};_0x500af0(++_0x5c96b5);}(_0xf1b0,0x1d3));var _0x0f1b=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xf1b0[_0x245afe];return _0x4eefde;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0x0f1b('0x0'));router['post']('/',controller['login']);router[_0x0f1b('0x1')](_0x0f1b('0x2'),controller[_0x0f1b('0x3')]);router[_0x0f1b('0x1')](_0x0f1b('0x4'),controller[_0x0f1b('0x5')]);module[_0x0f1b('0x6')]=router; \ No newline at end of file +var _0x2c0f=['post','login','/forgot','forgot','/reset/:token','reset','express','./authLocal.controller'];(function(_0x72641b,_0x2e41a2){var _0x10beae=function(_0x51c006){while(--_0x51c006){_0x72641b['push'](_0x72641b['shift']());}};_0x10beae(++_0x2e41a2);}(_0x2c0f,0x12e));var _0xf2c0=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0x2c0f[_0x1b8b95];return _0x3657ae;};'use strict';var express=require(_0xf2c0('0x0'));var router=express['Router']();var controller=require(_0xf2c0('0x1'));router[_0xf2c0('0x2')]('/',controller[_0xf2c0('0x3')]);router[_0xf2c0('0x2')](_0xf2c0('0x4'),controller[_0xf2c0('0x5')]);router[_0xf2c0('0x2')](_0xf2c0('0x6'),controller[_0xf2c0('0x7')]);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 c93392f..81c9369 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 _0xbe14=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x5d9429,_0x17f06d){var _0x5a7f91=function(_0x4850f5){while(--_0x4850f5){_0x5d9429['push'](_0x5d9429['shift']());}};_0x5a7f91(++_0x17f06d);}(_0xbe14,0x1cb));var _0x4be1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbe14[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x4be1('0x0'));module[_0x4be1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4be1('0x2')]},'status':{'type':Sequelize[_0x4be1('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x4be1('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x6cb5=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x29c261,_0x3af39a){var _0x1a9335=function(_0x40d1e8){while(--_0x40d1e8){_0x29c261['push'](_0x29c261['shift']());}};_0x1a9335(++_0x3af39a);}(_0x6cb5,0xf9));var _0x56cb=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x6cb5[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0x56cb('0x0'));module[_0x56cb('0x1')]={'name':{'type':Sequelize[_0x56cb('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x56cb('0x2')]},'description':{'type':Sequelize[_0x56cb('0x2')]},'status':{'type':Sequelize[_0x56cb('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x56cb('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 c2eb25d..5751824 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 _0x28ae=['squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','sendStatus','name','index','Automation','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','params','options','find','create','body','addConditions','ids','omit','getConditions','Condition','filter','addActions','Action','getActions','findOne','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x4b017e,_0xc9257){var _0x72176f=function(_0x340716){while(--_0x340716){_0x4b017e['push'](_0x4b017e['shift']());}};_0x72176f(++_0xc9257);}(_0x28ae,0x18d));var _0xe28a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28ae[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe28a('0x0'));var zipdir=require(_0xe28a('0x1'));var jsonpatch=require(_0xe28a('0x2'));var rp=require(_0xe28a('0x3'));var moment=require(_0xe28a('0x4'));var BPromise=require(_0xe28a('0x5'));var Mustache=require(_0xe28a('0x6'));var util=require(_0xe28a('0x7'));var path=require(_0xe28a('0x8'));var sox=require(_0xe28a('0x9'));var csv=require(_0xe28a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe28a('0xb'));var _=require(_0xe28a('0xc'));var squel=require(_0xe28a('0xd'));var crypto=require(_0xe28a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe28a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe28a('0x10'));var Papa=require(_0xe28a('0x11'));var Redis=require('ioredis');var authService=require(_0xe28a('0x12'));var qs=require(_0xe28a('0x13'));var as=require(_0xe28a('0x14'));var hardwareService=require(_0xe28a('0x15'));var logger=require(_0xe28a('0x16'))(_0xe28a('0x17'));var utils=require('../../config/utils');var config=require(_0xe28a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe28a('0x19'))['db'];function respondWithStatusCode(_0xb4ce68,_0x3092ab){_0x3092ab=_0x3092ab||0xcc;return function(_0x478e1e){if(_0x478e1e){return _0xb4ce68['sendStatus'](_0x3092ab);}return _0xb4ce68[_0xe28a('0x1a')](_0x3092ab)['end']();};}function respondWithResult(_0x19740b,_0x9141ce){_0x9141ce=_0x9141ce||0xc8;return function(_0xa8321b){if(_0xa8321b){return _0x19740b[_0xe28a('0x1a')](_0x9141ce)[_0xe28a('0x1b')](_0xa8321b);}};}function respondWithFilteredResult(_0x2bc210,_0x3e22b4){return function(_0x3342e8){if(_0x3342e8){var _0x2619c0=typeof _0x3e22b4[_0xe28a('0x1c')]===_0xe28a('0x1d')&&typeof _0x3e22b4[_0xe28a('0x1e')]==='undefined';var _0x4aa906=_0x3342e8[_0xe28a('0x1f')];var _0x12fced=_0x2619c0?0x0:_0x3e22b4['offset'];var _0x625de6=_0x2619c0?_0x3342e8[_0xe28a('0x1f')]:_0x3e22b4[_0xe28a('0x1c')]+_0x3e22b4[_0xe28a('0x1e')];var _0x1156b9;if(_0x625de6>=_0x4aa906){_0x625de6=_0x4aa906;_0x1156b9=0xc8;}else{_0x1156b9=0xce;}_0x2bc210[_0xe28a('0x1a')](_0x1156b9);return _0x2bc210[_0xe28a('0x20')](_0xe28a('0x21'),_0x12fced+'-'+_0x625de6+'/'+_0x4aa906)['json'](_0x3342e8);}return null;};}function patchUpdates(_0xeca232){return function(_0x42c469){try{jsonpatch['apply'](_0x42c469,_0xeca232,!![]);}catch(_0x44a71c){return BPromise[_0xe28a('0x22')](_0x44a71c);}return _0x42c469['save']();};}function saveUpdates(_0x2c3d94,_0x10c12c){return function(_0x414acf){if(_0x414acf){return _0x414acf[_0xe28a('0x23')](_0x2c3d94)[_0xe28a('0x24')](function(_0x1fe627){return _0x1fe627;});}return null;};}function removeEntity(_0xe72f07,_0x50ff6c){return function(_0x49779a){if(_0x49779a){return _0x49779a[_0xe28a('0x25')]()[_0xe28a('0x24')](function(){_0xe72f07[_0xe28a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ba091,_0x4d4322){return function(_0x50bb45){if(!_0x50bb45){_0x3ba091[_0xe28a('0x26')](0x194);}return _0x50bb45;};}function handleError(_0x219dbc,_0x1c38ad){_0x1c38ad=_0x1c38ad||0x1f4;return function(_0x4dd534){logger['error'](_0x4dd534['stack']);if(_0x4dd534[_0xe28a('0x27')]){delete _0x4dd534[_0xe28a('0x27')];}_0x219dbc[_0xe28a('0x1a')](_0x1c38ad)['send'](_0x4dd534);};}exports[_0xe28a('0x28')]=function(_0x1533ee,_0x19dbf7){var _0x1f7bd7={},_0x358bf1={},_0x35edce={'count':0x0,'rows':[]};var _0x5789b9=_['map'](db[_0xe28a('0x29')][_0xe28a('0x2a')],function(_0x6ef02f){return{'name':_0x6ef02f[_0xe28a('0x2b')],'type':_0x6ef02f[_0xe28a('0x2c')][_0xe28a('0x2d')]};});_0x358bf1[_0xe28a('0x2e')]=_[_0xe28a('0x2f')](_0x5789b9,'name');_0x358bf1[_0xe28a('0x30')]=_[_0xe28a('0x31')](_0x1533ee[_0xe28a('0x30')]);_0x358bf1[_0xe28a('0x32')]=_[_0xe28a('0x33')](_0x358bf1[_0xe28a('0x2e')],_0x358bf1[_0xe28a('0x30')]);_0x1f7bd7[_0xe28a('0x34')]=_['intersection'](_0x358bf1[_0xe28a('0x2e')],qs[_0xe28a('0x35')](_0x1533ee['query']['fields']));_0x1f7bd7[_0xe28a('0x34')]=_0x1f7bd7[_0xe28a('0x34')][_0xe28a('0x36')]?_0x1f7bd7['attributes']:_0x358bf1[_0xe28a('0x2e')];if(!_0x1533ee['query'][_0xe28a('0x37')](_0xe28a('0x38'))){_0x1f7bd7[_0xe28a('0x1e')]=qs[_0xe28a('0x1e')](_0x1533ee[_0xe28a('0x30')]['limit']);_0x1f7bd7[_0xe28a('0x1c')]=qs[_0xe28a('0x1c')](_0x1533ee[_0xe28a('0x30')]['offset']);}_0x1f7bd7[_0xe28a('0x39')]=qs[_0xe28a('0x3a')](_0x1533ee[_0xe28a('0x30')][_0xe28a('0x3a')]);_0x1f7bd7[_0xe28a('0x3b')]=qs[_0xe28a('0x32')](_[_0xe28a('0x3c')](_0x1533ee['query'],_0x358bf1[_0xe28a('0x32')]),_0x5789b9);if(_0x1533ee[_0xe28a('0x30')]['filter']){_0x1f7bd7[_0xe28a('0x3b')]=_[_0xe28a('0x3d')](_0x1f7bd7[_0xe28a('0x3b')],{'$or':_['map'](_0x5789b9,function(_0x9692be){if(_0x9692be[_0xe28a('0x2c')]!==_0xe28a('0x3e')){var _0x5631f3={};_0x5631f3[_0x9692be['name']]={'$like':'%'+_0x1533ee[_0xe28a('0x30')]['filter']+'%'};return _0x5631f3;}})});}_0x1f7bd7=_['merge']({},_0x1f7bd7,_0x1533ee['options']);var _0x224c4b={'where':_0x1f7bd7[_0xe28a('0x3b')]};return db[_0xe28a('0x29')][_0xe28a('0x1f')](_0x224c4b)[_0xe28a('0x24')](function(_0x5a9fe0){_0x35edce[_0xe28a('0x1f')]=_0x5a9fe0;if(_0x1533ee['query'][_0xe28a('0x3f')]){_0x1f7bd7[_0xe28a('0x40')]=[{'all':!![]}];}return db[_0xe28a('0x29')]['findAll'](_0x1f7bd7);})['then'](function(_0x2de731){_0x35edce[_0xe28a('0x41')]=_0x2de731;return _0x35edce;})['then'](respondWithFilteredResult(_0x19dbf7,_0x1f7bd7))[_0xe28a('0x42')](handleError(_0x19dbf7,null));};exports['show']=function(_0x3c51fd,_0x110403){var _0x4db6d3={'raw':![],'where':{'id':_0x3c51fd[_0xe28a('0x43')]['id']}},_0x388018={};_0x388018['model']=_[_0xe28a('0x31')](db['Automation'][_0xe28a('0x2a')]);_0x388018[_0xe28a('0x30')]=_['keys'](_0x3c51fd['query']);_0x388018[_0xe28a('0x32')]=_[_0xe28a('0x33')](_0x388018[_0xe28a('0x2e')],_0x388018[_0xe28a('0x30')]);_0x4db6d3['attributes']=_[_0xe28a('0x33')](_0x388018['model'],qs[_0xe28a('0x35')](_0x3c51fd['query'][_0xe28a('0x35')]));_0x4db6d3[_0xe28a('0x34')]=_0x4db6d3['attributes'][_0xe28a('0x36')]?_0x4db6d3[_0xe28a('0x34')]:_0x388018[_0xe28a('0x2e')];if(_0x3c51fd[_0xe28a('0x30')]['includeAll']){_0x4db6d3[_0xe28a('0x40')]=[{'all':!![]}];}_0x4db6d3=_['merge']({},_0x4db6d3,_0x3c51fd[_0xe28a('0x44')]);return db[_0xe28a('0x29')][_0xe28a('0x45')](_0x4db6d3)[_0xe28a('0x24')](handleEntityNotFound(_0x110403,null))[_0xe28a('0x24')](respondWithResult(_0x110403,null))[_0xe28a('0x42')](handleError(_0x110403,null));};exports[_0xe28a('0x46')]=function(_0x920aa2,_0xc4fb47){return db[_0xe28a('0x29')][_0xe28a('0x46')](_0x920aa2['body'],{})[_0xe28a('0x24')](respondWithResult(_0xc4fb47,0xc9))[_0xe28a('0x42')](handleError(_0xc4fb47,null));};exports[_0xe28a('0x23')]=function(_0x376068,_0xc7466b){if(_0x376068[_0xe28a('0x47')]['id']){delete _0x376068[_0xe28a('0x47')]['id'];}return db[_0xe28a('0x29')][_0xe28a('0x45')]({'where':{'id':_0x376068[_0xe28a('0x43')]['id']}})[_0xe28a('0x24')](handleEntityNotFound(_0xc7466b,null))[_0xe28a('0x24')](saveUpdates(_0x376068['body'],null))[_0xe28a('0x24')](respondWithResult(_0xc7466b,null))[_0xe28a('0x42')](handleError(_0xc7466b,null));};exports['destroy']=function(_0x4bffb,_0x28297f){return db[_0xe28a('0x29')][_0xe28a('0x45')]({'where':{'id':_0x4bffb[_0xe28a('0x43')]['id']}})[_0xe28a('0x24')](handleEntityNotFound(_0x28297f,null))[_0xe28a('0x24')](removeEntity(_0x28297f,null))['catch'](handleError(_0x28297f,null));};exports[_0xe28a('0x48')]=function(_0x26deca,_0x3ee852,_0x5f1d3a){return db['Condition']['find']({'where':{'id':_0x26deca[_0xe28a('0x43')]['id']}})[_0xe28a('0x24')](handleEntityNotFound(_0x3ee852,null))[_0xe28a('0x24')](function(_0x1b2d39){if(_0x1b2d39){return _0x1b2d39[_0xe28a('0x48')](_0x26deca[_0xe28a('0x47')][_0xe28a('0x49')],_[_0xe28a('0x4a')](_0x26deca['body'],['ids','id'])||{});}})[_0xe28a('0x24')](respondWithResult(_0x3ee852,null))[_0xe28a('0x42')](handleError(_0x3ee852,null));};exports[_0xe28a('0x4b')]=function(_0x6872ee,_0x401e4b,_0x228e87){var _0x32cef5={};var _0x34d1e8={};var _0x5dfc35;var _0x34ab80;return db[_0xe28a('0x29')]['findOne']({'where':{'id':_0x6872ee[_0xe28a('0x43')]['id']}})[_0xe28a('0x24')](handleEntityNotFound(_0x401e4b,null))[_0xe28a('0x24')](function(_0x159105){if(_0x159105){_0x5dfc35=_0x159105;_0x34d1e8['model']=_[_0xe28a('0x31')](db[_0xe28a('0x4c')]['rawAttributes']);_0x34d1e8[_0xe28a('0x30')]=_[_0xe28a('0x31')](_0x6872ee[_0xe28a('0x30')]);_0x34d1e8[_0xe28a('0x32')]=_[_0xe28a('0x33')](_0x34d1e8[_0xe28a('0x2e')],_0x34d1e8[_0xe28a('0x30')]);_0x32cef5['attributes']=_['intersection'](_0x34d1e8[_0xe28a('0x2e')],qs[_0xe28a('0x35')](_0x6872ee[_0xe28a('0x30')]['fields']));_0x32cef5[_0xe28a('0x34')]=_0x32cef5[_0xe28a('0x34')][_0xe28a('0x36')]?_0x32cef5['attributes']:_0x34d1e8[_0xe28a('0x2e')];_0x32cef5['order']=qs[_0xe28a('0x3a')](_0x6872ee[_0xe28a('0x30')]['sort']);_0x32cef5[_0xe28a('0x3b')]=qs[_0xe28a('0x32')](_[_0xe28a('0x3c')](_0x6872ee[_0xe28a('0x30')],_0x34d1e8[_0xe28a('0x32')]));if(_0x6872ee[_0xe28a('0x30')][_0xe28a('0x4d')]){_0x32cef5[_0xe28a('0x3b')]=_[_0xe28a('0x3d')](_0x32cef5[_0xe28a('0x3b')],{'$or':_[_0xe28a('0x2f')](_0x32cef5[_0xe28a('0x34')],function(_0x4077c5){var _0x21aff5={};_0x21aff5[_0x4077c5]={'$like':'%'+_0x6872ee[_0xe28a('0x30')][_0xe28a('0x4d')]+'%'};return _0x21aff5;})});}_0x32cef5=_[_0xe28a('0x3d')]({},_0x32cef5,_0x6872ee[_0xe28a('0x44')]);return _0x5dfc35['getConditions'](_0x32cef5);}})[_0xe28a('0x24')](function(_0x582056){if(_0x582056){_0x34ab80=_0x582056[_0xe28a('0x36')];if(!_0x6872ee[_0xe28a('0x30')][_0xe28a('0x37')]('nolimit')){_0x32cef5[_0xe28a('0x1e')]=qs[_0xe28a('0x1e')](_0x6872ee[_0xe28a('0x30')]['limit']);_0x32cef5[_0xe28a('0x1c')]=qs[_0xe28a('0x1c')](_0x6872ee[_0xe28a('0x30')][_0xe28a('0x1c')]);}return _0x5dfc35[_0xe28a('0x4b')](_0x32cef5);}})['then'](function(_0x2fd63c){if(_0x2fd63c){return _0x2fd63c?{'count':_0x34ab80,'rows':_0x2fd63c}:null;}})[_0xe28a('0x24')](respondWithResult(_0x401e4b,null))[_0xe28a('0x42')](handleError(_0x401e4b,null));};exports[_0xe28a('0x4e')]=function(_0x2272ec,_0x84aab5,_0x333e3c){return db[_0xe28a('0x4f')]['find']({'where':{'id':_0x2272ec[_0xe28a('0x43')]['id']}})[_0xe28a('0x24')](handleEntityNotFound(_0x84aab5,null))['then'](function(_0x20b69c){if(_0x20b69c){return _0x20b69c[_0xe28a('0x4e')](_0x2272ec[_0xe28a('0x47')][_0xe28a('0x49')],_['omit'](_0x2272ec[_0xe28a('0x47')],[_0xe28a('0x49'),'id'])||{});}})[_0xe28a('0x24')](respondWithResult(_0x84aab5,null))['catch'](handleError(_0x84aab5,null));};exports[_0xe28a('0x50')]=function(_0x1119fc,_0x1f0ef4,_0x30795c){var _0x503aa3={};var _0x1b98d0={};var _0x202234;var _0x33325b;return db[_0xe28a('0x29')][_0xe28a('0x51')]({'where':{'id':_0x1119fc['params']['id']}})[_0xe28a('0x24')](handleEntityNotFound(_0x1f0ef4,null))[_0xe28a('0x24')](function(_0x5e4d1d){if(_0x5e4d1d){_0x202234=_0x5e4d1d;_0x1b98d0[_0xe28a('0x2e')]=_[_0xe28a('0x31')](db['Action'][_0xe28a('0x2a')]);_0x1b98d0['query']=_['keys'](_0x1119fc[_0xe28a('0x30')]);_0x1b98d0[_0xe28a('0x32')]=_[_0xe28a('0x33')](_0x1b98d0[_0xe28a('0x2e')],_0x1b98d0['query']);_0x503aa3[_0xe28a('0x34')]=_[_0xe28a('0x33')](_0x1b98d0[_0xe28a('0x2e')],qs['fields'](_0x1119fc[_0xe28a('0x30')]['fields']));_0x503aa3[_0xe28a('0x34')]=_0x503aa3['attributes'][_0xe28a('0x36')]?_0x503aa3[_0xe28a('0x34')]:_0x1b98d0[_0xe28a('0x2e')];_0x503aa3['order']=qs[_0xe28a('0x3a')](_0x1119fc[_0xe28a('0x30')][_0xe28a('0x3a')]);_0x503aa3[_0xe28a('0x3b')]=qs['filters'](_[_0xe28a('0x3c')](_0x1119fc[_0xe28a('0x30')],_0x1b98d0[_0xe28a('0x32')]));if(_0x1119fc[_0xe28a('0x30')][_0xe28a('0x4d')]){_0x503aa3[_0xe28a('0x3b')]=_[_0xe28a('0x3d')](_0x503aa3[_0xe28a('0x3b')],{'$or':_['map'](_0x503aa3['attributes'],function(_0x22d76d){var _0x4e369a={};_0x4e369a[_0x22d76d]={'$like':'%'+_0x1119fc[_0xe28a('0x30')][_0xe28a('0x4d')]+'%'};return _0x4e369a;})});}_0x503aa3=_[_0xe28a('0x3d')]({},_0x503aa3,_0x1119fc[_0xe28a('0x44')]);return _0x202234[_0xe28a('0x50')](_0x503aa3);}})['then'](function(_0x30a4bc){if(_0x30a4bc){_0x33325b=_0x30a4bc['length'];if(!_0x1119fc[_0xe28a('0x30')][_0xe28a('0x37')]('nolimit')){_0x503aa3[_0xe28a('0x1e')]=qs[_0xe28a('0x1e')](_0x1119fc[_0xe28a('0x30')][_0xe28a('0x1e')]);_0x503aa3[_0xe28a('0x1c')]=qs[_0xe28a('0x1c')](_0x1119fc['query'][_0xe28a('0x1c')]);}return _0x202234[_0xe28a('0x50')](_0x503aa3);}})[_0xe28a('0x24')](function(_0x475b0c){if(_0x475b0c){return _0x475b0c?{'count':_0x33325b,'rows':_0x475b0c}:null;}})[_0xe28a('0x24')](respondWithResult(_0x1f0ef4,null))[_0xe28a('0x42')](handleError(_0x1f0ef4,null));}; \ No newline at end of file +var _0x733d=['find','create','body','update','params','addConditions','ids','omit','getConditions','findOne','Condition','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Automation','includeAll','include','catch','show'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0x733d,0xb4));var _0xd733=function(_0xb983f5,_0x48a9f4){_0xb983f5=_0xb983f5-0x0;var _0x29d6ad=_0x733d[_0xb983f5];return _0x29d6ad;};'use strict';var emlformat=require(_0xd733('0x0'));var rimraf=require(_0xd733('0x1'));var zipdir=require(_0xd733('0x2'));var jsonpatch=require(_0xd733('0x3'));var rp=require(_0xd733('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd733('0x5'));var path=require(_0xd733('0x6'));var sox=require('sox');var csv=require(_0xd733('0x7'));var ejs=require(_0xd733('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd733('0x9'));var squel=require(_0xd733('0xa'));var crypto=require(_0xd733('0xb'));var jsforce=require(_0xd733('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd733('0x7'));var querystring=require(_0xd733('0xd'));var Papa=require(_0xd733('0xe'));var Redis=require(_0xd733('0xf'));var authService=require(_0xd733('0x10'));var qs=require(_0xd733('0x11'));var as=require(_0xd733('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd733('0x13'));var utils=require(_0xd733('0x14'));var config=require(_0xd733('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd733('0x16'))['db'];function respondWithStatusCode(_0xf45ed2,_0x1fb23c){_0x1fb23c=_0x1fb23c||0xcc;return function(_0x48823b){if(_0x48823b){return _0xf45ed2[_0xd733('0x17')](_0x1fb23c);}return _0xf45ed2[_0xd733('0x18')](_0x1fb23c)[_0xd733('0x19')]();};}function respondWithResult(_0x113307,_0x534b35){_0x534b35=_0x534b35||0xc8;return function(_0x6f16d7){if(_0x6f16d7){return _0x113307[_0xd733('0x18')](_0x534b35)[_0xd733('0x1a')](_0x6f16d7);}};}function respondWithFilteredResult(_0x3a03e3,_0x2785ed){return function(_0x44f509){if(_0x44f509){var _0x45d0c2=typeof _0x2785ed['offset']===_0xd733('0x1b')&&typeof _0x2785ed['limit']===_0xd733('0x1b');var _0x13df81=_0x44f509[_0xd733('0x1c')];var _0x23b0bf=_0x45d0c2?0x0:_0x2785ed[_0xd733('0x1d')];var _0x5ad23e=_0x45d0c2?_0x44f509[_0xd733('0x1c')]:_0x2785ed[_0xd733('0x1d')]+_0x2785ed[_0xd733('0x1e')];var _0x1f5f34;if(_0x5ad23e>=_0x13df81){_0x5ad23e=_0x13df81;_0x1f5f34=0xc8;}else{_0x1f5f34=0xce;}_0x3a03e3['status'](_0x1f5f34);return _0x3a03e3[_0xd733('0x1f')](_0xd733('0x20'),_0x23b0bf+'-'+_0x5ad23e+'/'+_0x13df81)['json'](_0x44f509);}return null;};}function patchUpdates(_0x5394ca){return function(_0x44cf4f){try{jsonpatch[_0xd733('0x21')](_0x44cf4f,_0x5394ca,!![]);}catch(_0x5efaa5){return BPromise[_0xd733('0x22')](_0x5efaa5);}return _0x44cf4f['save']();};}function saveUpdates(_0x1d0803,_0x30c99d){return function(_0x5e140f){if(_0x5e140f){return _0x5e140f['update'](_0x1d0803)[_0xd733('0x23')](function(_0x42d036){return _0x42d036;});}return null;};}function removeEntity(_0x513e34,_0x4f747c){return function(_0x5f03b9){if(_0x5f03b9){return _0x5f03b9[_0xd733('0x24')]()[_0xd733('0x23')](function(){_0x513e34['status'](0xcc)[_0xd733('0x19')]();});}};}function handleEntityNotFound(_0x18f318,_0x4c5795){return function(_0x5adb49){if(!_0x5adb49){_0x18f318[_0xd733('0x17')](0x194);}return _0x5adb49;};}function handleError(_0xeaa938,_0x540de5){_0x540de5=_0x540de5||0x1f4;return function(_0x28b161){logger[_0xd733('0x25')](_0x28b161[_0xd733('0x26')]);if(_0x28b161[_0xd733('0x27')]){delete _0x28b161[_0xd733('0x27')];}_0xeaa938['status'](_0x540de5)[_0xd733('0x28')](_0x28b161);};}exports[_0xd733('0x29')]=function(_0x3de843,_0x1bc3cf){var _0x16e136={},_0x5d794f={},_0x3f14d5={'count':0x0,'rows':[]};var _0x3e9dbe=_[_0xd733('0x2a')](db['Automation'][_0xd733('0x2b')],function(_0x1dd173){return{'name':_0x1dd173[_0xd733('0x2c')],'type':_0x1dd173[_0xd733('0x2d')]['key']};});_0x5d794f[_0xd733('0x2e')]=_[_0xd733('0x2a')](_0x3e9dbe,'name');_0x5d794f[_0xd733('0x2f')]=_[_0xd733('0x30')](_0x3de843['query']);_0x5d794f[_0xd733('0x31')]=_[_0xd733('0x32')](_0x5d794f[_0xd733('0x2e')],_0x5d794f['query']);_0x16e136[_0xd733('0x33')]=_['intersection'](_0x5d794f[_0xd733('0x2e')],qs[_0xd733('0x34')](_0x3de843[_0xd733('0x2f')][_0xd733('0x34')]));_0x16e136['attributes']=_0x16e136['attributes'][_0xd733('0x35')]?_0x16e136[_0xd733('0x33')]:_0x5d794f['model'];if(!_0x3de843[_0xd733('0x2f')][_0xd733('0x36')](_0xd733('0x37'))){_0x16e136[_0xd733('0x1e')]=qs[_0xd733('0x1e')](_0x3de843[_0xd733('0x2f')]['limit']);_0x16e136[_0xd733('0x1d')]=qs[_0xd733('0x1d')](_0x3de843['query'][_0xd733('0x1d')]);}_0x16e136[_0xd733('0x38')]=qs[_0xd733('0x39')](_0x3de843[_0xd733('0x2f')]['sort']);_0x16e136[_0xd733('0x3a')]=qs[_0xd733('0x31')](_[_0xd733('0x3b')](_0x3de843['query'],_0x5d794f['filters']),_0x3e9dbe);if(_0x3de843[_0xd733('0x2f')][_0xd733('0x3c')]){_0x16e136[_0xd733('0x3a')]=_[_0xd733('0x3d')](_0x16e136['where'],{'$or':_[_0xd733('0x2a')](_0x3e9dbe,function(_0x4dbf11){if(_0x4dbf11['type']!==_0xd733('0x3e')){var _0x9b6452={};_0x9b6452[_0x4dbf11[_0xd733('0x27')]]={'$like':'%'+_0x3de843[_0xd733('0x2f')][_0xd733('0x3c')]+'%'};return _0x9b6452;}})});}_0x16e136=_[_0xd733('0x3d')]({},_0x16e136,_0x3de843[_0xd733('0x3f')]);var _0x56d86d={'where':_0x16e136[_0xd733('0x3a')]};return db[_0xd733('0x40')][_0xd733('0x1c')](_0x56d86d)[_0xd733('0x23')](function(_0x2b1a11){_0x3f14d5['count']=_0x2b1a11;if(_0x3de843[_0xd733('0x2f')][_0xd733('0x41')]){_0x16e136[_0xd733('0x42')]=[{'all':!![]}];}return db[_0xd733('0x40')]['findAll'](_0x16e136);})['then'](function(_0x3e9150){_0x3f14d5['rows']=_0x3e9150;return _0x3f14d5;})['then'](respondWithFilteredResult(_0x1bc3cf,_0x16e136))[_0xd733('0x43')](handleError(_0x1bc3cf,null));};exports[_0xd733('0x44')]=function(_0x45ee62,_0x5bca76){var _0x474bb9={'raw':![],'where':{'id':_0x45ee62['params']['id']}},_0x5802b7={};_0x5802b7[_0xd733('0x2e')]=_['keys'](db['Automation']['rawAttributes']);_0x5802b7[_0xd733('0x2f')]=_[_0xd733('0x30')](_0x45ee62[_0xd733('0x2f')]);_0x5802b7[_0xd733('0x31')]=_[_0xd733('0x32')](_0x5802b7['model'],_0x5802b7[_0xd733('0x2f')]);_0x474bb9['attributes']=_[_0xd733('0x32')](_0x5802b7[_0xd733('0x2e')],qs[_0xd733('0x34')](_0x45ee62[_0xd733('0x2f')]['fields']));_0x474bb9[_0xd733('0x33')]=_0x474bb9['attributes'][_0xd733('0x35')]?_0x474bb9[_0xd733('0x33')]:_0x5802b7['model'];if(_0x45ee62['query']['includeAll']){_0x474bb9[_0xd733('0x42')]=[{'all':!![]}];}_0x474bb9=_[_0xd733('0x3d')]({},_0x474bb9,_0x45ee62[_0xd733('0x3f')]);return db['Automation'][_0xd733('0x45')](_0x474bb9)[_0xd733('0x23')](handleEntityNotFound(_0x5bca76,null))['then'](respondWithResult(_0x5bca76,null))['catch'](handleError(_0x5bca76,null));};exports[_0xd733('0x46')]=function(_0x117dd8,_0x3843c7){return db['Automation'][_0xd733('0x46')](_0x117dd8[_0xd733('0x47')],{})[_0xd733('0x23')](respondWithResult(_0x3843c7,0xc9))[_0xd733('0x43')](handleError(_0x3843c7,null));};exports[_0xd733('0x48')]=function(_0x4c1074,_0x3cd693){if(_0x4c1074['body']['id']){delete _0x4c1074[_0xd733('0x47')]['id'];}return db[_0xd733('0x40')][_0xd733('0x45')]({'where':{'id':_0x4c1074['params']['id']}})[_0xd733('0x23')](handleEntityNotFound(_0x3cd693,null))['then'](saveUpdates(_0x4c1074[_0xd733('0x47')],null))[_0xd733('0x23')](respondWithResult(_0x3cd693,null))[_0xd733('0x43')](handleError(_0x3cd693,null));};exports[_0xd733('0x24')]=function(_0x17d87a,_0x320f86){return db['Automation']['find']({'where':{'id':_0x17d87a[_0xd733('0x49')]['id']}})[_0xd733('0x23')](handleEntityNotFound(_0x320f86,null))[_0xd733('0x23')](removeEntity(_0x320f86,null))['catch'](handleError(_0x320f86,null));};exports['addConditions']=function(_0x1052df,_0x2b2dce,_0x48302c){return db['Condition'][_0xd733('0x45')]({'where':{'id':_0x1052df[_0xd733('0x49')]['id']}})[_0xd733('0x23')](handleEntityNotFound(_0x2b2dce,null))['then'](function(_0x528d98){if(_0x528d98){return _0x528d98[_0xd733('0x4a')](_0x1052df['body'][_0xd733('0x4b')],_[_0xd733('0x4c')](_0x1052df[_0xd733('0x47')],['ids','id'])||{});}})[_0xd733('0x23')](respondWithResult(_0x2b2dce,null))[_0xd733('0x43')](handleError(_0x2b2dce,null));};exports[_0xd733('0x4d')]=function(_0x4bb140,_0x1f1315,_0x354f78){var _0x28434b={};var _0x1e42ec={};var _0x13fe68;var _0x1f1b71;return db[_0xd733('0x40')][_0xd733('0x4e')]({'where':{'id':_0x4bb140[_0xd733('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f1315,null))['then'](function(_0x53328c){if(_0x53328c){_0x13fe68=_0x53328c;_0x1e42ec['model']=_[_0xd733('0x30')](db[_0xd733('0x4f')][_0xd733('0x2b')]);_0x1e42ec[_0xd733('0x2f')]=_['keys'](_0x4bb140[_0xd733('0x2f')]);_0x1e42ec[_0xd733('0x31')]=_[_0xd733('0x32')](_0x1e42ec['model'],_0x1e42ec[_0xd733('0x2f')]);_0x28434b[_0xd733('0x33')]=_[_0xd733('0x32')](_0x1e42ec[_0xd733('0x2e')],qs[_0xd733('0x34')](_0x4bb140[_0xd733('0x2f')][_0xd733('0x34')]));_0x28434b[_0xd733('0x33')]=_0x28434b[_0xd733('0x33')][_0xd733('0x35')]?_0x28434b[_0xd733('0x33')]:_0x1e42ec[_0xd733('0x2e')];_0x28434b[_0xd733('0x38')]=qs[_0xd733('0x39')](_0x4bb140[_0xd733('0x2f')][_0xd733('0x39')]);_0x28434b['where']=qs[_0xd733('0x31')](_[_0xd733('0x3b')](_0x4bb140[_0xd733('0x2f')],_0x1e42ec[_0xd733('0x31')]));if(_0x4bb140[_0xd733('0x2f')][_0xd733('0x3c')]){_0x28434b['where']=_[_0xd733('0x3d')](_0x28434b[_0xd733('0x3a')],{'$or':_['map'](_0x28434b[_0xd733('0x33')],function(_0x39072c){var _0x217a3b={};_0x217a3b[_0x39072c]={'$like':'%'+_0x4bb140[_0xd733('0x2f')]['filter']+'%'};return _0x217a3b;})});}_0x28434b=_[_0xd733('0x3d')]({},_0x28434b,_0x4bb140[_0xd733('0x3f')]);return _0x13fe68['getConditions'](_0x28434b);}})['then'](function(_0x73e670){if(_0x73e670){_0x1f1b71=_0x73e670['length'];if(!_0x4bb140['query'][_0xd733('0x36')]('nolimit')){_0x28434b[_0xd733('0x1e')]=qs[_0xd733('0x1e')](_0x4bb140[_0xd733('0x2f')][_0xd733('0x1e')]);_0x28434b['offset']=qs[_0xd733('0x1d')](_0x4bb140[_0xd733('0x2f')][_0xd733('0x1d')]);}return _0x13fe68[_0xd733('0x4d')](_0x28434b);}})[_0xd733('0x23')](function(_0x374f79){if(_0x374f79){return _0x374f79?{'count':_0x1f1b71,'rows':_0x374f79}:null;}})[_0xd733('0x23')](respondWithResult(_0x1f1315,null))[_0xd733('0x43')](handleError(_0x1f1315,null));};exports[_0xd733('0x50')]=function(_0x37e2d7,_0x587e7c,_0x787e8c){return db[_0xd733('0x51')][_0xd733('0x45')]({'where':{'id':_0x37e2d7[_0xd733('0x49')]['id']}})[_0xd733('0x23')](handleEntityNotFound(_0x587e7c,null))['then'](function(_0x1c3ad5){if(_0x1c3ad5){return _0x1c3ad5[_0xd733('0x50')](_0x37e2d7[_0xd733('0x47')][_0xd733('0x4b')],_[_0xd733('0x4c')](_0x37e2d7[_0xd733('0x47')],[_0xd733('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x587e7c,null))[_0xd733('0x43')](handleError(_0x587e7c,null));};exports['getActions']=function(_0x4a238f,_0x224f9c,_0x236aca){var _0x1c16b8={};var _0x324956={};var _0x459f97;var _0x2e1e16;return db[_0xd733('0x40')]['findOne']({'where':{'id':_0x4a238f[_0xd733('0x49')]['id']}})['then'](handleEntityNotFound(_0x224f9c,null))['then'](function(_0x4cefbf){if(_0x4cefbf){_0x459f97=_0x4cefbf;_0x324956['model']=_[_0xd733('0x30')](db[_0xd733('0x51')][_0xd733('0x2b')]);_0x324956[_0xd733('0x2f')]=_['keys'](_0x4a238f[_0xd733('0x2f')]);_0x324956[_0xd733('0x31')]=_[_0xd733('0x32')](_0x324956[_0xd733('0x2e')],_0x324956[_0xd733('0x2f')]);_0x1c16b8['attributes']=_[_0xd733('0x32')](_0x324956[_0xd733('0x2e')],qs[_0xd733('0x34')](_0x4a238f[_0xd733('0x2f')][_0xd733('0x34')]));_0x1c16b8[_0xd733('0x33')]=_0x1c16b8[_0xd733('0x33')]['length']?_0x1c16b8[_0xd733('0x33')]:_0x324956['model'];_0x1c16b8[_0xd733('0x38')]=qs[_0xd733('0x39')](_0x4a238f['query'][_0xd733('0x39')]);_0x1c16b8[_0xd733('0x3a')]=qs[_0xd733('0x31')](_[_0xd733('0x3b')](_0x4a238f[_0xd733('0x2f')],_0x324956[_0xd733('0x31')]));if(_0x4a238f[_0xd733('0x2f')][_0xd733('0x3c')]){_0x1c16b8[_0xd733('0x3a')]=_[_0xd733('0x3d')](_0x1c16b8[_0xd733('0x3a')],{'$or':_[_0xd733('0x2a')](_0x1c16b8[_0xd733('0x33')],function(_0x852ab3){var _0x4a46f5={};_0x4a46f5[_0x852ab3]={'$like':'%'+_0x4a238f['query']['filter']+'%'};return _0x4a46f5;})});}_0x1c16b8=_[_0xd733('0x3d')]({},_0x1c16b8,_0x4a238f[_0xd733('0x3f')]);return _0x459f97[_0xd733('0x52')](_0x1c16b8);}})[_0xd733('0x23')](function(_0x570539){if(_0x570539){_0x2e1e16=_0x570539[_0xd733('0x35')];if(!_0x4a238f['query']['hasOwnProperty']('nolimit')){_0x1c16b8[_0xd733('0x1e')]=qs[_0xd733('0x1e')](_0x4a238f[_0xd733('0x2f')][_0xd733('0x1e')]);_0x1c16b8[_0xd733('0x1d')]=qs[_0xd733('0x1d')](_0x4a238f[_0xd733('0x2f')]['offset']);}return _0x459f97[_0xd733('0x52')](_0x1c16b8);}})['then'](function(_0x5e65bf){if(_0x5e65bf){return _0x5e65bf?{'count':_0x2e1e16,'rows':_0x5e65bf}:null;}})[_0xd733('0x23')](respondWithResult(_0x224f9c,null))[_0xd733('0x43')](handleError(_0x224f9c,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 52f4cb7..f04e0ef 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 _0x6bf3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Automation','tools_automations','lodash'];(function(_0x3a2e3b,_0x30f342){var _0xd12bdb=function(_0x435766){while(--_0x435766){_0x3a2e3b['push'](_0x3a2e3b['shift']());}};_0xd12bdb(++_0x30f342);}(_0x6bf3,0x185));var _0x36bf=function(_0x5d799d,_0x1fba77){_0x5d799d=_0x5d799d-0x0;var _0x5de01b=_0x6bf3[_0x5d799d];return _0x5de01b;};'use strict';var _=require(_0x36bf('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x36bf('0x1'));var BPromise=require(_0x36bf('0x2'));var rp=require(_0x36bf('0x3'));var fs=require('fs');var path=require(_0x36bf('0x4'));var rimraf=require(_0x36bf('0x5'));var config=require(_0x36bf('0x6'));var attributes=require('./automation.attributes');module['exports']=function(_0x4596e8,_0x4be2e3){return _0x4596e8[_0x36bf('0x7')](_0x36bf('0x8'),attributes,{'tableName':_0x36bf('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dba=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Automation','tools_automations','lodash','util','../../config/logger'];(function(_0x330d27,_0x177c38){var _0x1ac997=function(_0x1d1063){while(--_0x1d1063){_0x330d27['push'](_0x330d27['shift']());}};_0x1ac997(++_0x177c38);}(_0x4dba,0x101));var _0xa4db=function(_0x32cc18,_0x32386d){_0x32cc18=_0x32cc18-0x0;var _0xba597e=_0x4dba[_0x32cc18];return _0xba597e;};'use strict';var _=require(_0xa4db('0x0'));var util=require(_0xa4db('0x1'));var logger=require(_0xa4db('0x2'))(_0xa4db('0x3'));var moment=require(_0xa4db('0x4'));var BPromise=require(_0xa4db('0x5'));var rp=require(_0xa4db('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4db('0x7'));var config=require(_0xa4db('0x8'));var attributes=require('./automation.attributes');module[_0xa4db('0x9')]=function(_0x125583,_0x1811ac){return _0x125583[_0xa4db('0xa')](_0xa4db('0xb'),attributes,{'tableName':_0xa4db('0xc'),'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 db6e88b..af6ae32 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 _0x5525=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0xab4642,_0xc56b1){var _0x803b4e=function(_0x2cd52e){while(--_0x2cd52e){_0xab4642['push'](_0xab4642['shift']());}};_0x803b4e(++_0xc56b1);}(_0x5525,0xd1));var _0x5552=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x5525[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0x5552('0x0'));var util=require(_0x5552('0x1'));var moment=require(_0x5552('0x2'));var BPromise=require(_0x5552('0x3'));var rs=require(_0x5552('0x4'));var fs=require('fs');var Redis=require(_0x5552('0x5'));var db=require(_0x5552('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5552('0x7'))(_0x5552('0x8'));var config=require('../../config/environment');var jayson=require(_0x5552('0x9'));var client=jayson[_0x5552('0xa')][_0x5552('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ce9f6,_0xb28442,_0x203b88){return new BPromise(function(_0x164626,_0x25a789){return client['request'](_0x1ce9f6,_0x203b88)[_0x5552('0xc')](function(_0x568e10){logger[_0x5552('0xd')]('Automation,\x20%s,\x20%s',_0xb28442,_0x5552('0xe'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0xb28442,_0x5552('0xe'),JSON['stringify'](_0x568e10));if(_0x568e10[_0x5552('0xf')]){if(_0x568e10[_0x5552('0xf')][_0x5552('0x10')]===0x1f4){logger[_0x5552('0xf')](_0x5552('0x11'),_0xb28442,_0x568e10['error'][_0x5552('0x12')]);return _0x25a789(_0x568e10['error']['message']);}logger[_0x5552('0xf')](_0x5552('0x11'),_0xb28442,_0x568e10['error']['message']);return _0x164626(_0x568e10[_0x5552('0xf')][_0x5552('0x12')]);}else{logger[_0x5552('0xd')](_0x5552('0x11'),_0xb28442,_0x5552('0xe'));_0x164626(_0x568e10[_0x5552('0x13')][_0x5552('0x12')]);}})[_0x5552('0x14')](function(_0x1fabec){logger['error'](_0x5552('0x11'),_0xb28442,_0x1fabec);_0x25a789(_0x1fabec);});});} \ No newline at end of file +var _0xa5c9=['util','moment','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash'];(function(_0x35b148,_0x26f36a){var _0x11c0b3=function(_0x77225b){while(--_0x77225b){_0x35b148['push'](_0x35b148['shift']());}};_0x11c0b3(++_0x26f36a);}(_0xa5c9,0x143));var _0x9a5c=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0xa5c9[_0x1dbaf7];return _0x593f05;};'use strict';var _=require(_0x9a5c('0x0'));var util=require(_0x9a5c('0x1'));var moment=require(_0x9a5c('0x2'));var BPromise=require(_0x9a5c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a5c('0x4'))['db'];var utils=require(_0x9a5c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x9a5c('0x6'));var client=jayson[_0x9a5c('0x7')][_0x9a5c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bb6f2,_0x594e67,_0x8de4e9){return new BPromise(function(_0x4ea491,_0xc96c1c){return client[_0x9a5c('0x9')](_0x3bb6f2,_0x8de4e9)['then'](function(_0x127932){logger[_0x9a5c('0xa')](_0x9a5c('0xb'),_0x594e67,'request\x20sent');logger['debug'](_0x9a5c('0xc'),_0x594e67,_0x9a5c('0xd'),JSON[_0x9a5c('0xe')](_0x127932));if(_0x127932[_0x9a5c('0xf')]){if(_0x127932[_0x9a5c('0xf')][_0x9a5c('0x10')]===0x1f4){logger[_0x9a5c('0xf')](_0x9a5c('0xb'),_0x594e67,_0x127932[_0x9a5c('0xf')][_0x9a5c('0x11')]);return _0xc96c1c(_0x127932[_0x9a5c('0xf')][_0x9a5c('0x11')]);}logger['error'](_0x9a5c('0xb'),_0x594e67,_0x127932[_0x9a5c('0xf')][_0x9a5c('0x11')]);return _0x4ea491(_0x127932['error'][_0x9a5c('0x11')]);}else{logger[_0x9a5c('0xa')]('Automation,\x20%s,\x20%s',_0x594e67,_0x9a5c('0xd'));_0x4ea491(_0x127932['result'][_0x9a5c('0x11')]);}})['catch'](function(_0x29d3cd){logger[_0x9a5c('0xf')]('Automation,\x20%s,\x20%s',_0x594e67,_0x29d3cd);_0xc96c1c(_0x29d3cd);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index db537b6..a689f9f 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 _0xa4de=['put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa4de,0x10d));var _0xea4d=function(_0x5d3313,_0x39c46e){_0x5d3313=_0x5d3313-0x0;var _0x40b46c=_0xa4de[_0x5d3313];return _0x40b46c;};'use strict';var multer=require(_0xea4d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xea4d('0x1'));var express=require(_0xea4d('0x2'));var router=express[_0xea4d('0x3')]();var fs_extra=require(_0xea4d('0x4'));var auth=require(_0xea4d('0x5'));var interaction=require(_0xea4d('0x6'));var config=require(_0xea4d('0x7'));var controller=require(_0xea4d('0x8'));router[_0xea4d('0x9')]('/',auth[_0xea4d('0xa')](),controller[_0xea4d('0xb')]);router[_0xea4d('0x9')]('/:id',auth[_0xea4d('0xa')](),controller['show']);router[_0xea4d('0x9')](_0xea4d('0xc'),auth[_0xea4d('0xa')](),controller[_0xea4d('0xd')]);router[_0xea4d('0x9')](_0xea4d('0xe'),auth[_0xea4d('0xa')](),controller[_0xea4d('0xf')]);router[_0xea4d('0x10')]('/',auth[_0xea4d('0xa')](),controller[_0xea4d('0x11')]);router[_0xea4d('0x10')]('/:id/conditions',auth[_0xea4d('0xa')](),controller[_0xea4d('0x12')]);router[_0xea4d('0x10')](_0xea4d('0xe'),auth[_0xea4d('0xa')](),controller['addActions']);router[_0xea4d('0x13')](_0xea4d('0x14'),auth['isAuthenticated'](),controller['update']);router[_0xea4d('0x15')](_0xea4d('0x14'),auth[_0xea4d('0xa')](),controller[_0xea4d('0x16')]);module[_0xea4d('0x17')]=router; \ No newline at end of file +var _0xf822=['addConditions','addActions','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','/:id/conditions','/:id/actions','getActions','post'];(function(_0x548483,_0x5e53ab){var _0x53afbd=function(_0x4c9f9c){while(--_0x4c9f9c){_0x548483['push'](_0x548483['shift']());}};_0x53afbd(++_0x5e53ab);}(_0xf822,0x19e));var _0x2f82=function(_0x2fc1ba,_0x5c4f1c){_0x2fc1ba=_0x2fc1ba-0x0;var _0x110364=_0xf822[_0x2fc1ba];return _0x110364;};'use strict';var multer=require(_0x2f82('0x0'));var util=require('util');var path=require(_0x2f82('0x1'));var timeout=require(_0x2f82('0x2'));var express=require(_0x2f82('0x3'));var router=express[_0x2f82('0x4')]();var fs_extra=require(_0x2f82('0x5'));var auth=require(_0x2f82('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2f82('0x7'));var controller=require(_0x2f82('0x8'));router[_0x2f82('0x9')]('/',auth['isAuthenticated'](),controller[_0x2f82('0xa')]);router['get'](_0x2f82('0xb'),auth[_0x2f82('0xc')](),controller[_0x2f82('0xd')]);router[_0x2f82('0x9')](_0x2f82('0xe'),auth[_0x2f82('0xc')](),controller['getConditions']);router[_0x2f82('0x9')](_0x2f82('0xf'),auth[_0x2f82('0xc')](),controller[_0x2f82('0x10')]);router[_0x2f82('0x11')]('/',auth[_0x2f82('0xc')](),controller['create']);router['post'](_0x2f82('0xe'),auth[_0x2f82('0xc')](),controller[_0x2f82('0x12')]);router[_0x2f82('0x11')]('/:id/actions',auth['isAuthenticated'](),controller[_0x2f82('0x13')]);router[_0x2f82('0x14')](_0x2f82('0xb'),auth['isAuthenticated'](),controller[_0x2f82('0x15')]);router[_0x2f82('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2f82('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 81323aa..9e120cc 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 _0x49b0=['onlyIfOpen','Active/Disactive\x20AMD','#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','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always'];(function(_0x21a510,_0x9273c0){var _0x237019=function(_0x3411ff){while(--_0x3411ff){_0x21a510['push'](_0x21a510['shift']());}};_0x237019(++_0x9273c0);}(_0x49b0,0x115));var _0x049b=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x49b0[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0x049b('0x0'));module[_0x049b('0x1')]={'name':{'type':Sequelize[_0x049b('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x049b('0x3')](_0x049b('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x049b('0x2')]},'active':{'type':Sequelize[_0x049b('0x5')],'defaultValue':0x0,'comment':_0x049b('0x6')},'limitCalls':{'type':Sequelize[_0x049b('0x7')](0x4)[_0x049b('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x049b('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x049b('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x049b('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x049b('0x7')](0x3)[_0x049b('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x049b('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x049b('0x7')](0x3)[_0x049b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x049b('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x049b('0x7')](0x5)[_0x049b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x049b('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x049b('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x049b('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x049b('0x7')](0x5)[_0x049b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x049b('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x049b('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x049b('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x049b('0x7')](0x5)[_0x049b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x049b('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x049b('0x7')](0x3)[_0x049b('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x049b('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x049b('0x2')],'defaultValue':_0x049b('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x049b('0x3')](_0x049b('0x12'),'never',_0x049b('0x13')),'defaultValue':_0x049b('0x12')},'dialAMDActive':{'type':Sequelize[_0x049b('0x5')],'defaultValue':0x0,'comment':_0x049b('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x049b('0x7')](0x9)[_0x049b('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x049b('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x049b('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x049b('0x7')](0x9)[_0x049b('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x049b('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x049b('0x7')](0x9)[_0x049b('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x049b('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x049b('0x7')](0x9)[_0x049b('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x049b('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x049b('0x7')](0x9)[_0x049b('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x049b('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x049b('0x7')](0x5)[_0x049b('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x049b('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x049b('0x7')](0x9)[_0x049b('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x049b('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x049b('0x3')](_0x049b('0x1b'),_0x049b('0x1c')),'defaultValue':_0x049b('0x1b')},'dialPrefix':{'type':Sequelize[_0x049b('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x049b('0x7')](0x3)[_0x049b('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x049b('0x1d')},'dialCutDigit':{'type':Sequelize[_0x049b('0x7')](0x3)[_0x049b('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x049b('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x049b('0x7')](0x3)[_0x049b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x049b('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x049b('0x7')](0x5)[_0x049b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x049b('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x049b('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x049b('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x049b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x049b('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x049b('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x049b('0x7')](0x3)[_0x049b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x049b('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x049b('0x7')](0x5)[_0x049b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x049b('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x049b('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x049b('0x7')](0x5)[_0x049b('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x049b('0x24')}}; \ No newline at end of file +var _0x0290=['Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN'];(function(_0x49f87a,_0x27f66c){var _0x4296da=function(_0x5df5e5){while(--_0x5df5e5){_0x49f87a['push'](_0x49f87a['shift']());}};_0x4296da(++_0x27f66c);}(_0x0290,0x157));var _0x0029=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x0290[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0x0029('0x0'));module[_0x0029('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x0029('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0029('0x3')](_0x0029('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x0029('0x5')]},'active':{'type':Sequelize[_0x0029('0x6')],'defaultValue':0x0,'comment':_0x0029('0x7')},'limitCalls':{'type':Sequelize[_0x0029('0x8')](0x4)[_0x0029('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0029('0xa')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0029('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x0029('0x8')](0x3)[_0x0029('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0029('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0029('0x8')](0x3)[_0x0029('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0029('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0029('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x0029('0x8')](0x3)[_0x0029('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0029('0x8')](0x5)[_0x0029('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0029('0x8')](0x3)[_0x0029('0x9')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0029('0x8')](0x5)[_0x0029('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0029('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0029('0x8')](0x3)[_0x0029('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x0029('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x0029('0x3')](_0x0029('0xe'),_0x0029('0xf'),_0x0029('0x10')),'defaultValue':_0x0029('0xe')},'dialAMDActive':{'type':Sequelize[_0x0029('0x6')],'defaultValue':0x0,'comment':_0x0029('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x0029('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0029('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x0029('0x8')](0x9)[_0x0029('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0029('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0029('0x8')](0x9)[_0x0029('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0029('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0029('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x0029('0x8')](0x9)[_0x0029('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0029('0x8')](0x9)[_0x0029('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0029('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x0029('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0029('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0029('0x8')](0x5)[_0x0029('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0029('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0029('0x8')](0x9)[_0x0029('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0029('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0029('0x3')](_0x0029('0x19'),_0x0029('0x1a')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x0029('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0029('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x0029('0x8')](0x3)[_0x0029('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0029('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0029('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0029('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0029('0x8')](0x5)[_0x0029('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x0029('0x8')](0x3)[_0x0029('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x0029('0x8')](0x5)[_0x0029('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0029('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0029('0x8')](0x3)[_0x0029('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0029('0x1e')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0029('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0029('0x1f')},'dialMachineMaxRetry':{'type':Sequelize[_0x0029('0x8')](0x3)[_0x0029('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x0029('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0029('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0029('0x8')](0x3)[_0x0029('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0029('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0029('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0029('0x22')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index cd4bb11..fc74396 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 _0xdacc=['ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','fromQuery','cm_contacts','cm_hopper_additional_phones','ci.item','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize','all','removeLists','destroy','getBlackLists','addBlackLists','spread','cm_hopper_black','push','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','error','name','send','map','Campaign','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','omit','updatedAt','body','createdAt','getHoppers','findOne','CmHopper','CampaignId','include','getHopperHistories','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','order','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','deletedAt\x20IS\x20NULL'];(function(_0x1dd6e7,_0x1cda2b){var _0xb53aa4=function(_0xd2ac7b){while(--_0xd2ac7b){_0x1dd6e7['push'](_0x1dd6e7['shift']());}};_0xb53aa4(++_0x1cda2b);}(_0xdacc,0x14f));var _0xcdac=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdacc[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdac('0x0'));var zipdir=require(_0xcdac('0x1'));var jsonpatch=require(_0xcdac('0x2'));var rp=require(_0xcdac('0x3'));var moment=require(_0xcdac('0x4'));var BPromise=require(_0xcdac('0x5'));var Mustache=require(_0xcdac('0x6'));var util=require('util');var path=require(_0xcdac('0x7'));var sox=require(_0xcdac('0x8'));var csv=require(_0xcdac('0x9'));var ejs=require(_0xcdac('0xa'));var fs=require('fs');var fs_extra=require(_0xcdac('0xb'));var _=require(_0xcdac('0xc'));var squel=require(_0xcdac('0xd'));var crypto=require(_0xcdac('0xe'));var jsforce=require(_0xcdac('0xf'));var deskjs=require(_0xcdac('0x10'));var toCsv=require(_0xcdac('0x9'));var querystring=require(_0xcdac('0x11'));var Papa=require(_0xcdac('0x12'));var Redis=require(_0xcdac('0x13'));var authService=require(_0xcdac('0x14'));var qs=require(_0xcdac('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdac('0x16'));var logger=require(_0xcdac('0x17'))('api');var utils=require(_0xcdac('0x18'));var config=require(_0xcdac('0x19'));var licenseUtil=require(_0xcdac('0x1a'));var db=require(_0xcdac('0x1b'))['db'];function respondWithStatusCode(_0x3f949d,_0x511f55){_0x511f55=_0x511f55||0xcc;return function(_0x517b76){if(_0x517b76){return _0x3f949d[_0xcdac('0x1c')](_0x511f55);}return _0x3f949d['status'](_0x511f55)[_0xcdac('0x1d')]();};}function respondWithResult(_0x50b59c,_0x5b3bdd){_0x5b3bdd=_0x5b3bdd||0xc8;return function(_0x2627f7){if(_0x2627f7){return _0x50b59c[_0xcdac('0x1e')](_0x5b3bdd)[_0xcdac('0x1f')](_0x2627f7);}};}function respondWithFilteredResult(_0x228096,_0x1ff7d3){return function(_0x2882cc){if(_0x2882cc){var _0x53a103=typeof _0x1ff7d3[_0xcdac('0x20')]===_0xcdac('0x21')&&typeof _0x1ff7d3['limit']===_0xcdac('0x21');var _0x46a5fb=_0x2882cc[_0xcdac('0x22')];var _0x3e1d2f=_0x53a103?0x0:_0x1ff7d3[_0xcdac('0x20')];var _0x25a2cd=_0x53a103?_0x2882cc[_0xcdac('0x22')]:_0x1ff7d3[_0xcdac('0x20')]+_0x1ff7d3['limit'];var _0x51544e;if(_0x25a2cd>=_0x46a5fb){_0x25a2cd=_0x46a5fb;_0x51544e=0xc8;}else{_0x51544e=0xce;}_0x228096[_0xcdac('0x1e')](_0x51544e);return _0x228096[_0xcdac('0x23')](_0xcdac('0x24'),_0x3e1d2f+'-'+_0x25a2cd+'/'+_0x46a5fb)[_0xcdac('0x1f')](_0x2882cc);}return null;};}function patchUpdates(_0xeb1f4){return function(_0x50bd6e){try{jsonpatch[_0xcdac('0x25')](_0x50bd6e,_0xeb1f4,!![]);}catch(_0x4013ab){return BPromise[_0xcdac('0x26')](_0x4013ab);}return _0x50bd6e[_0xcdac('0x27')]();};}function saveUpdates(_0x385e56,_0x280d96){return function(_0x383be3){if(_0x383be3){return _0x383be3[_0xcdac('0x28')](_0x385e56)[_0xcdac('0x29')](function(_0x14381d){return _0x14381d;});}return null;};}function removeEntity(_0x41bd76,_0x1fe6c9){return function(_0x129103){if(_0x129103){return _0x129103['destroy']()[_0xcdac('0x29')](function(){var _0x18f8b9=_0x129103[_0xcdac('0x2a')]({'plain':!![]});var _0x3be6c1=_0xcdac('0x2b');return db[_0xcdac('0x2c')]['destroy']({'where':{'type':_0x3be6c1,'resourceId':_0x18f8b9['id']}})[_0xcdac('0x29')](function(){return _0x129103;});})[_0xcdac('0x29')](function(){_0x41bd76['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x305be2,_0xf16e7a){return function(_0x20a058){if(!_0x20a058){_0x305be2[_0xcdac('0x1c')](0x194);}return _0x20a058;};}function handleError(_0x11806a,_0x262705){_0x262705=_0x262705||0x1f4;return function(_0x1a8071){logger[_0xcdac('0x2d')](_0x1a8071['stack']);if(_0x1a8071[_0xcdac('0x2e')]){delete _0x1a8071['name'];}_0x11806a[_0xcdac('0x1e')](_0x262705)[_0xcdac('0x2f')](_0x1a8071);};}exports['index']=function(_0xd56848,_0x50c585){var _0x15a380={},_0x46ca8a={},_0xd6953d={'count':0x0,'rows':[]};var _0x454899=_[_0xcdac('0x30')](db[_0xcdac('0x31')]['rawAttributes'],function(_0x8bef30){return{'name':_0x8bef30[_0xcdac('0x32')],'type':_0x8bef30[_0xcdac('0x33')]['key']};});_0x46ca8a[_0xcdac('0x34')]=_[_0xcdac('0x30')](_0x454899,_0xcdac('0x2e'));_0x46ca8a['query']=_[_0xcdac('0x35')](_0xd56848[_0xcdac('0x36')]);_0x46ca8a[_0xcdac('0x37')]=_[_0xcdac('0x38')](_0x46ca8a['model'],_0x46ca8a['query']);_0x15a380[_0xcdac('0x39')]=_[_0xcdac('0x38')](_0x46ca8a[_0xcdac('0x34')],qs['fields'](_0xd56848[_0xcdac('0x36')][_0xcdac('0x3a')]));_0x15a380[_0xcdac('0x39')]=_0x15a380[_0xcdac('0x39')][_0xcdac('0x3b')]?_0x15a380[_0xcdac('0x39')]:_0x46ca8a[_0xcdac('0x34')];if(!_0xd56848[_0xcdac('0x36')][_0xcdac('0x3c')](_0xcdac('0x3d'))){_0x15a380[_0xcdac('0x3e')]=qs[_0xcdac('0x3e')](_0xd56848[_0xcdac('0x36')]['limit']);_0x15a380[_0xcdac('0x20')]=qs[_0xcdac('0x20')](_0xd56848[_0xcdac('0x36')][_0xcdac('0x20')]);}_0x15a380['order']=qs[_0xcdac('0x3f')](_0xd56848[_0xcdac('0x36')][_0xcdac('0x3f')]);_0x15a380[_0xcdac('0x40')]=qs[_0xcdac('0x37')](_['pick'](_0xd56848[_0xcdac('0x36')],_0x46ca8a[_0xcdac('0x37')]),_0x454899);if(_0xd56848['query'][_0xcdac('0x41')]){_0x15a380['where']=_[_0xcdac('0x42')](_0x15a380['where'],{'$or':_[_0xcdac('0x30')](_0x454899,function(_0x28e9bc){if(_0x28e9bc[_0xcdac('0x33')]!==_0xcdac('0x43')){var _0x468033={};_0x468033[_0x28e9bc['name']]={'$like':'%'+_0xd56848[_0xcdac('0x36')][_0xcdac('0x41')]+'%'};return _0x468033;}})});}_0x15a380=_[_0xcdac('0x42')]({},_0x15a380,_0xd56848[_0xcdac('0x44')]);var _0x1200a3={'where':_0x15a380[_0xcdac('0x40')]};return db[_0xcdac('0x31')]['count'](_0x1200a3)[_0xcdac('0x29')](function(_0x33d40d){_0xd6953d[_0xcdac('0x22')]=_0x33d40d;if(_0xd56848[_0xcdac('0x36')][_0xcdac('0x45')]){_0x15a380['include']=[{'all':!![]}];}return db[_0xcdac('0x31')][_0xcdac('0x46')](_0x15a380);})[_0xcdac('0x29')](function(_0x5d7e9e){_0xd6953d[_0xcdac('0x47')]=_0x5d7e9e;return _0xd6953d;})[_0xcdac('0x29')](respondWithFilteredResult(_0x50c585,_0x15a380))['catch'](handleError(_0x50c585,null));};exports[_0xcdac('0x48')]=function(_0x43e0ef,_0x4b3e33){var _0xc33b9a={'raw':![],'where':{'id':_0x43e0ef[_0xcdac('0x49')]['id']}},_0x3e34b9={};_0x3e34b9[_0xcdac('0x34')]=_[_0xcdac('0x35')](db['Campaign'][_0xcdac('0x4a')]);_0x3e34b9[_0xcdac('0x36')]=_[_0xcdac('0x35')](_0x43e0ef[_0xcdac('0x36')]);_0x3e34b9[_0xcdac('0x37')]=_[_0xcdac('0x38')](_0x3e34b9[_0xcdac('0x34')],_0x3e34b9[_0xcdac('0x36')]);_0xc33b9a[_0xcdac('0x39')]=_['intersection'](_0x3e34b9[_0xcdac('0x34')],qs[_0xcdac('0x3a')](_0x43e0ef['query'][_0xcdac('0x3a')]));_0xc33b9a[_0xcdac('0x39')]=_0xc33b9a[_0xcdac('0x39')][_0xcdac('0x3b')]?_0xc33b9a[_0xcdac('0x39')]:_0x3e34b9[_0xcdac('0x34')];if(_0x43e0ef[_0xcdac('0x36')][_0xcdac('0x45')]){_0xc33b9a['include']=[{'all':!![]}];}_0xc33b9a=_['merge']({},_0xc33b9a,_0x43e0ef[_0xcdac('0x44')]);return db['Campaign'][_0xcdac('0x4b')](_0xc33b9a)[_0xcdac('0x29')](handleEntityNotFound(_0x4b3e33,null))[_0xcdac('0x29')](respondWithResult(_0x4b3e33,null))[_0xcdac('0x4c')](handleError(_0x4b3e33,null));};exports[_0xcdac('0x4d')]=function(_0x24a96a,_0x5e2f4c){return db[_0xcdac('0x31')]['create'](_0x24a96a['body'],{})[_0xcdac('0x29')](function(_0x3a0426){var _0x4dca75=_0x24a96a[_0xcdac('0x4e')]['get']({'plain':!![]});if(!_0x4dca75)throw new Error(_0xcdac('0x4f'));if(_0x4dca75[_0xcdac('0x50')]===_0xcdac('0x4e')){var _0x351b0c=_0x3a0426[_0xcdac('0x2a')]({'plain':!![]});var _0x159936=_0xcdac('0x2b');return db[_0xcdac('0x51')][_0xcdac('0x4b')]({'where':{'name':_0x159936,'userProfileId':_0x4dca75[_0xcdac('0x52')]},'raw':!![]})[_0xcdac('0x29')](function(_0x2cfdd3){if(_0x2cfdd3&&_0x2cfdd3[_0xcdac('0x53')]===0x0){return db[_0xcdac('0x2c')][_0xcdac('0x4d')]({'name':_0x351b0c['name'],'resourceId':_0x351b0c['id'],'type':_0x2cfdd3['name'],'sectionId':_0x2cfdd3['id']},{})[_0xcdac('0x29')](function(){return _0x3a0426;});}else{return _0x3a0426;}})[_0xcdac('0x4c')](function(_0x18c606){logger[_0xcdac('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18c606);throw _0x18c606;});}return _0x3a0426;})[_0xcdac('0x29')](respondWithResult(_0x5e2f4c,0xc9))[_0xcdac('0x4c')](handleError(_0x5e2f4c,null));};exports[_0xcdac('0x54')]=function(_0x47f0cf,_0x4409a5){var _0x626a3={'where':{'id':_0x47f0cf[_0xcdac('0x49')]['id']}},_0x3fde65={};_0x3fde65[_0xcdac('0x34')]=_[_0xcdac('0x35')](db[_0xcdac('0x31')][_0xcdac('0x4a')]);_0x626a3[_0xcdac('0x39')]=_[_0xcdac('0x38')](_0x3fde65[_0xcdac('0x34')],qs['fields'](_0x47f0cf[_0xcdac('0x36')][_0xcdac('0x3a')]));_0x626a3['attributes']=_0x626a3[_0xcdac('0x39')]['length']?_0x626a3[_0xcdac('0x39')]:_0x3fde65[_0xcdac('0x34')];if(_0x47f0cf[_0xcdac('0x36')][_0xcdac('0x45')]){_0x626a3['include']=[{'all':!![]}];}_0x626a3=_[_0xcdac('0x42')]({},_0x626a3,_0x47f0cf[_0xcdac('0x44')]);return db['Campaign'][_0xcdac('0x4b')](_0x626a3)[_0xcdac('0x29')](handleEntityNotFound(_0x4409a5,null))[_0xcdac('0x29')](function(_0x5ca8f4){if(_0x5ca8f4){var _0x5a7fb1=_0x5ca8f4[_0xcdac('0x2a')]({'plain':!![]});_0x5a7fb1=qs[_0xcdac('0x55')](_0x5a7fb1,['id','createdAt',_0xcdac('0x56')]);_0x47f0cf[_0xcdac('0x57')]=_[_0xcdac('0x55')](_0x47f0cf[_0xcdac('0x57')],['id',_0xcdac('0x58'),'updatedAt']);return db[_0xcdac('0x31')][_0xcdac('0x4d')](_[_0xcdac('0x42')](_0x5a7fb1,_0x47f0cf['body']),{'include':_0x47f0cf[_0xcdac('0x36')][_0xcdac('0x45')]?[{'all':!![]}]:undefined})[_0xcdac('0x29')](function(_0x433db8){var _0x322686=_0x47f0cf[_0xcdac('0x4e')][_0xcdac('0x2a')]({'plain':!![]});if(!_0x322686)throw new Error(_0xcdac('0x4f'));if(_0x322686[_0xcdac('0x50')]==='user'){var _0x53d747=_0x433db8[_0xcdac('0x2a')]({'plain':!![]});var _0x302acb='IvrCampaigns';return db[_0xcdac('0x51')]['find']({'where':{'name':_0x302acb,'userProfileId':_0x322686[_0xcdac('0x52')]},'raw':!![]})[_0xcdac('0x29')](function(_0x3c595f){if(_0x3c595f&&_0x3c595f[_0xcdac('0x53')]===0x0){return db[_0xcdac('0x2c')]['create']({'name':_0x53d747[_0xcdac('0x2e')],'resourceId':_0x53d747['id'],'type':_0x3c595f[_0xcdac('0x2e')],'sectionId':_0x3c595f['id']},{})['then'](function(){return _0x433db8;});}else{return _0x433db8;}})[_0xcdac('0x4c')](function(_0x3c5f4e){logger[_0xcdac('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c5f4e);throw _0x3c5f4e;});}return _0x433db8;});}})['then'](respondWithResult(_0x4409a5,0xc9))[_0xcdac('0x4c')](handleError(_0x4409a5,null));};exports[_0xcdac('0x28')]=function(_0x3c2680,_0x9ba15e){if(_0x3c2680[_0xcdac('0x57')]['id']){delete _0x3c2680['body']['id'];}return db[_0xcdac('0x31')]['find']({'where':{'id':_0x3c2680[_0xcdac('0x49')]['id']}})[_0xcdac('0x29')](handleEntityNotFound(_0x9ba15e,null))['then'](saveUpdates(_0x3c2680['body'],null))[_0xcdac('0x29')](respondWithResult(_0x9ba15e,null))['catch'](handleError(_0x9ba15e,null));};exports['destroy']=function(_0x37d330,_0x1ca55d){return db[_0xcdac('0x31')][_0xcdac('0x4b')]({'where':{'id':_0x37d330['params']['id']}})[_0xcdac('0x29')](handleEntityNotFound(_0x1ca55d,null))['then'](removeEntity(_0x1ca55d,null))[_0xcdac('0x4c')](handleError(_0x1ca55d,null));};exports[_0xcdac('0x59')]=function(_0xa4d8f0,_0x36dcde,_0x203942){var _0x6198c0={'raw':!![],'where':{}};var _0x3ebc6f={};var _0x4556a0={'count':0x0,'rows':[]};return db[_0xcdac('0x31')][_0xcdac('0x5a')]({'where':{'id':_0xa4d8f0['params']['id']}})[_0xcdac('0x29')](handleEntityNotFound(_0x36dcde,null))[_0xcdac('0x29')](function(_0x412745){if(_0x412745){_0x3ebc6f[_0xcdac('0x34')]=_[_0xcdac('0x35')](db[_0xcdac('0x5b')][_0xcdac('0x4a')]);_0x3ebc6f['query']=_[_0xcdac('0x35')](_0xa4d8f0[_0xcdac('0x36')]);_0x3ebc6f[_0xcdac('0x37')]=_[_0xcdac('0x38')](_0x3ebc6f[_0xcdac('0x34')],_0x3ebc6f[_0xcdac('0x36')]);_0x6198c0['attributes']=_[_0xcdac('0x38')](_0x3ebc6f[_0xcdac('0x34')],qs[_0xcdac('0x3a')](_0xa4d8f0[_0xcdac('0x36')][_0xcdac('0x3a')]));_0x6198c0[_0xcdac('0x39')]=_0x6198c0['attributes'][_0xcdac('0x3b')]?_0x6198c0[_0xcdac('0x39')]:_0x3ebc6f[_0xcdac('0x34')];if(!_0xa4d8f0[_0xcdac('0x36')][_0xcdac('0x3c')](_0xcdac('0x3d'))){_0x6198c0[_0xcdac('0x3e')]=qs[_0xcdac('0x3e')](_0xa4d8f0[_0xcdac('0x36')][_0xcdac('0x3e')]);_0x6198c0['offset']=qs[_0xcdac('0x20')](_0xa4d8f0[_0xcdac('0x36')][_0xcdac('0x20')]);}_0x6198c0['order']=qs['sort'](_0xa4d8f0[_0xcdac('0x36')][_0xcdac('0x3f')]);_0x6198c0[_0xcdac('0x40')]=qs[_0xcdac('0x37')](_['pick'](_0xa4d8f0[_0xcdac('0x36')],_0x3ebc6f['filters']));_0x6198c0['where'][_0xcdac('0x5c')]=_0x412745['id'];if(_0xa4d8f0['query']['filter']){_0x6198c0[_0xcdac('0x40')]=_[_0xcdac('0x42')](_0x6198c0[_0xcdac('0x40')],{'$or':_['map'](_0x6198c0[_0xcdac('0x39')],function(_0x5a0c6e){var _0x7f8407={};_0x7f8407[_0x5a0c6e]={'$like':'%'+_0xa4d8f0[_0xcdac('0x36')][_0xcdac('0x41')]+'%'};return _0x7f8407;})});}_0x6198c0=_[_0xcdac('0x42')]({},_0x6198c0,_0xa4d8f0[_0xcdac('0x44')]);return db[_0xcdac('0x5b')][_0xcdac('0x22')]({'where':_0x6198c0[_0xcdac('0x40')]})[_0xcdac('0x29')](function(_0x23cbcc){_0x4556a0['count']=_0x23cbcc;if(_0xa4d8f0[_0xcdac('0x36')][_0xcdac('0x45')]){_0x6198c0[_0xcdac('0x5d')]=[{'all':!![]}];}return db['CmHopper'][_0xcdac('0x46')](_0x6198c0);})[_0xcdac('0x29')](function(_0x5570ac){_0x4556a0[_0xcdac('0x47')]=_0x5570ac;return _0x4556a0;});}})[_0xcdac('0x29')](respondWithFilteredResult(_0x36dcde,_0x6198c0))[_0xcdac('0x4c')](handleError(_0x36dcde,null));};exports[_0xcdac('0x5e')]=function(_0x581378,_0x34d16b,_0x5bff13){var _0x8082c9={'raw':!![],'where':{}};var _0x3eaf83={};var _0x1da096={'count':0x0,'rows':[]};return db[_0xcdac('0x31')]['findOne']({'where':{'id':_0x581378[_0xcdac('0x49')]['id']}})[_0xcdac('0x29')](handleEntityNotFound(_0x34d16b,null))[_0xcdac('0x29')](function(_0x44bcc1){if(_0x44bcc1){_0x3eaf83[_0xcdac('0x34')]=_[_0xcdac('0x35')](db[_0xcdac('0x5f')][_0xcdac('0x4a')]);_0x3eaf83[_0xcdac('0x36')]=_[_0xcdac('0x35')](_0x581378['query']);_0x3eaf83['filters']=_[_0xcdac('0x38')](_0x3eaf83['model'],_0x3eaf83[_0xcdac('0x36')]);_0x8082c9[_0xcdac('0x39')]=_[_0xcdac('0x38')](_0x3eaf83[_0xcdac('0x34')],qs[_0xcdac('0x3a')](_0x581378['query'][_0xcdac('0x3a')]));_0x8082c9['attributes']=_0x8082c9[_0xcdac('0x39')]['length']?_0x8082c9[_0xcdac('0x39')]:_0x3eaf83[_0xcdac('0x34')];if(!_0x581378[_0xcdac('0x36')]['hasOwnProperty'](_0xcdac('0x3d'))){_0x8082c9[_0xcdac('0x3e')]=qs[_0xcdac('0x3e')](_0x581378['query'][_0xcdac('0x3e')]);_0x8082c9[_0xcdac('0x20')]=qs['offset'](_0x581378[_0xcdac('0x36')][_0xcdac('0x20')]);}_0x8082c9['order']=qs[_0xcdac('0x3f')](_0x581378[_0xcdac('0x36')]['sort']);_0x8082c9[_0xcdac('0x40')]=qs[_0xcdac('0x37')](_[_0xcdac('0x60')](_0x581378[_0xcdac('0x36')],_0x3eaf83[_0xcdac('0x37')]));_0x8082c9[_0xcdac('0x40')][_0xcdac('0x5c')]=_0x44bcc1['id'];if(_0x581378['query'][_0xcdac('0x41')]){_0x8082c9[_0xcdac('0x40')]=_['merge'](_0x8082c9[_0xcdac('0x40')],{'$or':_['map'](_0x8082c9['attributes'],function(_0xb35ad){var _0x171d26={};_0x171d26[_0xb35ad]={'$like':'%'+_0x581378[_0xcdac('0x36')][_0xcdac('0x41')]+'%'};return _0x171d26;})});}_0x8082c9=_['merge']({},_0x8082c9,_0x581378[_0xcdac('0x44')]);return db['CmHopperHistory']['count']({'where':_0x8082c9[_0xcdac('0x40')]})[_0xcdac('0x29')](function(_0x18683b){_0x1da096[_0xcdac('0x22')]=_0x18683b;if(_0x581378[_0xcdac('0x36')]['includeAll']){_0x8082c9[_0xcdac('0x5d')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xcdac('0x46')](_0x8082c9);})[_0xcdac('0x29')](function(_0x921f84){_0x1da096['rows']=_0x921f84;return _0x1da096;});}})['then'](respondWithFilteredResult(_0x34d16b,_0x8082c9))[_0xcdac('0x4c')](handleError(_0x34d16b,null));};exports[_0xcdac('0x61')]=function(_0x2972d7,_0x24736e,_0x4dcb09){var _0x42141d={'raw':!![],'where':{}};var _0x233ab0={};var _0xefe670={'count':0x0,'rows':[]};return db['Campaign'][_0xcdac('0x5a')]({'where':{'id':_0x2972d7[_0xcdac('0x49')]['id']}})[_0xcdac('0x29')](handleEntityNotFound(_0x24736e,null))[_0xcdac('0x29')](function(_0x6c5ae8){if(_0x6c5ae8){_0x233ab0['model']=_[_0xcdac('0x35')](db[_0xcdac('0x62')][_0xcdac('0x4a')]);_0x233ab0[_0xcdac('0x36')]=_[_0xcdac('0x35')](_0x2972d7[_0xcdac('0x36')]);_0x233ab0[_0xcdac('0x37')]=_['intersection'](_0x233ab0[_0xcdac('0x34')],_0x233ab0[_0xcdac('0x36')]);_0x42141d[_0xcdac('0x39')]=_[_0xcdac('0x38')](_0x233ab0['model'],qs[_0xcdac('0x3a')](_0x2972d7[_0xcdac('0x36')][_0xcdac('0x3a')]));_0x42141d['attributes']=_0x42141d[_0xcdac('0x39')]['length']?_0x42141d[_0xcdac('0x39')]:_0x233ab0[_0xcdac('0x34')];if(!_0x2972d7[_0xcdac('0x36')][_0xcdac('0x3c')]('nolimit')){_0x42141d[_0xcdac('0x3e')]=qs[_0xcdac('0x3e')](_0x2972d7[_0xcdac('0x36')]['limit']);_0x42141d[_0xcdac('0x20')]=qs[_0xcdac('0x20')](_0x2972d7[_0xcdac('0x36')]['offset']);}_0x42141d[_0xcdac('0x63')]=qs['sort'](_0x2972d7[_0xcdac('0x36')]['sort']);_0x42141d[_0xcdac('0x40')]=qs[_0xcdac('0x37')](_[_0xcdac('0x60')](_0x2972d7[_0xcdac('0x36')],_0x233ab0[_0xcdac('0x37')]));_0x42141d[_0xcdac('0x40')]['CampaignId']=_0x6c5ae8['id'];if(_0x2972d7[_0xcdac('0x36')][_0xcdac('0x41')]){_0x42141d[_0xcdac('0x40')]=_['merge'](_0x42141d[_0xcdac('0x40')],{'$or':_[_0xcdac('0x30')](_0x42141d[_0xcdac('0x39')],function(_0x2a79a6){var _0xd63fa0={};_0xd63fa0[_0x2a79a6]={'$like':'%'+_0x2972d7[_0xcdac('0x36')][_0xcdac('0x41')]+'%'};return _0xd63fa0;})});}_0x42141d=_[_0xcdac('0x42')]({},_0x42141d,_0x2972d7['options']);return db[_0xcdac('0x62')][_0xcdac('0x22')]({'where':_0x42141d['where']})['then'](function(_0x5a87c0){_0xefe670[_0xcdac('0x22')]=_0x5a87c0;if(_0x2972d7[_0xcdac('0x36')][_0xcdac('0x45')]){_0x42141d[_0xcdac('0x5d')]=[{'all':!![]}];}return db[_0xcdac('0x62')][_0xcdac('0x46')](_0x42141d);})[_0xcdac('0x29')](function(_0x48f8c2){_0xefe670[_0xcdac('0x47')]=_0x48f8c2;return _0xefe670;});}})[_0xcdac('0x29')](respondWithFilteredResult(_0x24736e,_0x42141d))[_0xcdac('0x4c')](handleError(_0x24736e,null));};exports[_0xcdac('0x64')]=function(_0x60ad9,_0x2f10ca,_0x2d2e0b){var _0x22b469={'raw':!![],'where':{}};var _0x2c5332={};var _0x4413dc={'count':0x0,'rows':[]};return db[_0xcdac('0x31')]['findOne']({'where':{'id':_0x60ad9[_0xcdac('0x49')]['id']}})['then'](handleEntityNotFound(_0x2f10ca,null))[_0xcdac('0x29')](function(_0x289d49){if(_0x289d49){_0x2c5332['model']=_[_0xcdac('0x35')](db[_0xcdac('0x65')][_0xcdac('0x4a')]);_0x2c5332[_0xcdac('0x36')]=_['keys'](_0x60ad9[_0xcdac('0x36')]);_0x2c5332[_0xcdac('0x37')]=_['intersection'](_0x2c5332[_0xcdac('0x34')],_0x2c5332['query']);_0x22b469[_0xcdac('0x39')]=_[_0xcdac('0x38')](_0x2c5332['model'],qs[_0xcdac('0x3a')](_0x60ad9[_0xcdac('0x36')][_0xcdac('0x3a')]));_0x22b469[_0xcdac('0x39')]=_0x22b469[_0xcdac('0x39')][_0xcdac('0x3b')]?_0x22b469[_0xcdac('0x39')]:_0x2c5332[_0xcdac('0x34')];if(!_0x60ad9['query'][_0xcdac('0x3c')](_0xcdac('0x3d'))){_0x22b469['limit']=qs['limit'](_0x60ad9[_0xcdac('0x36')]['limit']);_0x22b469[_0xcdac('0x20')]=qs[_0xcdac('0x20')](_0x60ad9[_0xcdac('0x36')][_0xcdac('0x20')]);}_0x22b469[_0xcdac('0x63')]=qs[_0xcdac('0x3f')](_0x60ad9[_0xcdac('0x36')][_0xcdac('0x3f')]);_0x22b469[_0xcdac('0x40')]=qs['filters'](_[_0xcdac('0x60')](_0x60ad9[_0xcdac('0x36')],_0x2c5332[_0xcdac('0x37')]));_0x22b469[_0xcdac('0x40')][_0xcdac('0x5c')]=_0x289d49['id'];if(_0x60ad9['query'][_0xcdac('0x41')]){_0x22b469['where']=_[_0xcdac('0x42')](_0x22b469[_0xcdac('0x40')],{'$or':_[_0xcdac('0x30')](_0x22b469[_0xcdac('0x39')],function(_0x3461f9){var _0x7ab8a3={};_0x7ab8a3[_0x3461f9]={'$like':'%'+_0x60ad9[_0xcdac('0x36')][_0xcdac('0x41')]+'%'};return _0x7ab8a3;})});}_0x22b469=_[_0xcdac('0x42')]({},_0x22b469,_0x60ad9[_0xcdac('0x44')]);return db['CmHopperBlack']['count']({'where':_0x22b469['where']})['then'](function(_0x5f3cab){_0x4413dc[_0xcdac('0x22')]=_0x5f3cab;if(_0x60ad9[_0xcdac('0x36')][_0xcdac('0x45')]){_0x22b469[_0xcdac('0x5d')]=[{'all':!![]}];}return db[_0xcdac('0x65')][_0xcdac('0x46')](_0x22b469);})[_0xcdac('0x29')](function(_0xd078ae){_0x4413dc[_0xcdac('0x47')]=_0xd078ae;return _0x4413dc;});}})[_0xcdac('0x29')](respondWithFilteredResult(_0x2f10ca,_0x22b469))[_0xcdac('0x4c')](handleError(_0x2f10ca,null));};exports[_0xcdac('0x66')]=function(_0x376491,_0x30215c,_0x20492b){var _0xc84ef4={};var _0xbc5a25={};var _0x438037;var _0x4ff151;return db['Campaign'][_0xcdac('0x5a')]({'where':{'id':_0x376491['params']['id']}})[_0xcdac('0x29')](handleEntityNotFound(_0x30215c,null))['then'](function(_0x36dfd0){if(_0x36dfd0){_0x438037=_0x36dfd0;_0xbc5a25[_0xcdac('0x34')]=_['keys'](db[_0xcdac('0x67')][_0xcdac('0x4a')]);_0xbc5a25[_0xcdac('0x36')]=_['keys'](_0x376491[_0xcdac('0x36')]);_0xbc5a25[_0xcdac('0x37')]=_[_0xcdac('0x38')](_0xbc5a25['model'],_0xbc5a25[_0xcdac('0x36')]);_0xc84ef4[_0xcdac('0x39')]=_[_0xcdac('0x38')](_0xbc5a25[_0xcdac('0x34')],qs['fields'](_0x376491[_0xcdac('0x36')][_0xcdac('0x3a')]));_0xc84ef4[_0xcdac('0x39')]=_0xc84ef4[_0xcdac('0x39')][_0xcdac('0x3b')]?_0xc84ef4['attributes']:_0xbc5a25[_0xcdac('0x34')];_0xc84ef4['order']=qs[_0xcdac('0x3f')](_0x376491[_0xcdac('0x36')][_0xcdac('0x3f')]);_0xc84ef4[_0xcdac('0x40')]=qs[_0xcdac('0x37')](_[_0xcdac('0x60')](_0x376491[_0xcdac('0x36')],_0xbc5a25['filters']));if(_0x376491[_0xcdac('0x36')][_0xcdac('0x41')]){_0xc84ef4[_0xcdac('0x40')]=_['merge'](_0xc84ef4['where'],{'$or':_[_0xcdac('0x30')](_0xc84ef4[_0xcdac('0x39')],function(_0x59cbfa){var _0x1093e7={};_0x1093e7[_0x59cbfa]={'$like':'%'+_0x376491[_0xcdac('0x36')][_0xcdac('0x41')]+'%'};return _0x1093e7;})});}_0xc84ef4=_[_0xcdac('0x42')]({},_0xc84ef4,_0x376491[_0xcdac('0x44')]);return _0x438037[_0xcdac('0x66')](_0xc84ef4);}})[_0xcdac('0x29')](function(_0x47025f){if(_0x47025f){_0x4ff151=_0x47025f[_0xcdac('0x3b')];if(!_0x376491['query']['hasOwnProperty']('nolimit')){_0xc84ef4[_0xcdac('0x3e')]=qs[_0xcdac('0x3e')](_0x376491[_0xcdac('0x36')][_0xcdac('0x3e')]);_0xc84ef4[_0xcdac('0x20')]=qs['offset'](_0x376491[_0xcdac('0x36')][_0xcdac('0x20')]);}return _0x438037['getLists'](_0xc84ef4);}})[_0xcdac('0x29')](function(_0x556a58){if(_0x556a58){return _0x556a58?{'count':_0x4ff151,'rows':_0x556a58}:null;}})[_0xcdac('0x29')](respondWithResult(_0x30215c,null))['catch'](handleError(_0x30215c,null));};exports[_0xcdac('0x68')]=function(_0x2961eb,_0x1fdb2f,_0x455454){var _0x20f0e8,_0xdbd221;var _0x578250=[];var _0x28c315=moment()[_0xcdac('0x69')](_0xcdac('0x6a'));return db[_0xcdac('0x31')][_0xcdac('0x4b')]({'where':{'id':_0x2961eb[_0xcdac('0x49')]['id']}})[_0xcdac('0x29')](handleEntityNotFound(_0x1fdb2f,null))[_0xcdac('0x29')](function(_0x2253f5){if(_0x2253f5){_0xdbd221=_0x2253f5;return _0x2253f5[_0xcdac('0x68')](_0x2961eb[_0xcdac('0x57')][_0xcdac('0x6b')],_[_0xcdac('0x55')](_0x2961eb[_0xcdac('0x57')],['ids','id'])||{});}return null;})['spread'](function(_0x3e8aae){var _0x1ae416;var _0x5012f9;_0x20f0e8=_0x3e8aae||[];var _0x34646f=[];if(_0x3e8aae){for(var _0x1a530a=0x0;_0x1a530a<_0x3e8aae[_0xcdac('0x3b')];_0x1a530a+=0x1){var _0x3ab76b=_0x3e8aae[_0x1a530a][_0xcdac('0x2a')]({'plain':!![]});_0xdbd221[_0xcdac('0x6c')]=_0x2961eb[_0xcdac('0x57')][_0xcdac('0x6c')]?_0x2961eb[_0xcdac('0x57')][_0xcdac('0x6c')]:_0xdbd221[_0xcdac('0x6c')];switch(_0xdbd221[_0xcdac('0x6c')]){case _0xcdac('0x6d'):_0x1ae416=squel[_0xcdac('0x6e')]()[_0xcdac('0x6f')](_0xcdac('0x70'))['fromQuery']([_0xcdac('0x71'),'scheduledAt',_0xcdac('0x72'),_0xcdac('0x73'),_0xcdac('0x5c'),_0xcdac('0x58'),_0xcdac('0x56')],squel[_0xcdac('0x74')]()[_0xcdac('0x75')](_0xcdac('0x71'),_0xcdac('0x71'))[_0xcdac('0x75')](_0xcdac('0x76'),_0xcdac('0x77'))['field']('id',_0xcdac('0x72'))['field'](_0x3ab76b[_0xcdac('0x78')][_0xcdac('0x79')](),_0xcdac('0x73'))['field'](_0x2961eb['params']['id'][_0xcdac('0x79')](),_0xcdac('0x5c'))['field']('\x27'+_0x28c315+'\x27',_0xcdac('0x58'))[_0xcdac('0x75')]('\x27'+_0x28c315+'\x27',_0xcdac('0x56'))[_0xcdac('0x7a')]('cm_contacts')['where'](_0xcdac('0x7b'))[_0xcdac('0x40')](_0xcdac('0x7c'),_0x3ab76b[_0xcdac('0x78')]['toString']())[_0xcdac('0x40')](_0xcdac('0x7d'))['where'](_0xcdac('0x7e'),squel[_0xcdac('0x74')]()[_0xcdac('0x75')](_0xcdac('0x7f'))[_0xcdac('0x7a')](_0xcdac('0x80'))[_0xcdac('0x40')]('CampaignId\x20=\x20?',_0x2961eb[_0xcdac('0x49')]['id'][_0xcdac('0x79')]()))[_0xcdac('0x40')](_0xcdac('0x7e'),squel[_0xcdac('0x74')]()[_0xcdac('0x75')](_0xcdac('0x81'))[_0xcdac('0x7a')]('cm_hopper')['where'](_0xcdac('0x82'),_0x2961eb['params']['id'][_0xcdac('0x79')]())))['toString']();break;case _0xcdac('0x83'):_0x1ae416=squel[_0xcdac('0x6e')]()[_0xcdac('0x6f')](_0xcdac('0x70'))[_0xcdac('0x84')]([_0xcdac('0x71'),'scheduledAt',_0xcdac('0x72'),_0xcdac('0x73'),_0xcdac('0x5c'),_0xcdac('0x58'),'updatedAt'],squel['select']()[_0xcdac('0x75')](_0xcdac('0x71'),'phone')[_0xcdac('0x75')](_0xcdac('0x76'),_0xcdac('0x77'))[_0xcdac('0x75')]('id',_0xcdac('0x72'))[_0xcdac('0x75')](_0x3ab76b[_0xcdac('0x78')][_0xcdac('0x79')](),_0xcdac('0x73'))[_0xcdac('0x75')](_0x2961eb['params']['id'][_0xcdac('0x79')](),_0xcdac('0x5c'))[_0xcdac('0x75')]('\x27'+_0x28c315+'\x27','createdAt')[_0xcdac('0x75')]('\x27'+_0x28c315+'\x27',_0xcdac('0x56'))[_0xcdac('0x7a')](_0xcdac('0x85'))[_0xcdac('0x40')]('deletedAt\x20IS\x20NULL')[_0xcdac('0x40')]('ListId\x20=\x20?',_0x3ab76b['CmListId'][_0xcdac('0x79')]())['where'](_0xcdac('0x7d'))[_0xcdac('0x40')](_0xcdac('0x7e'),squel[_0xcdac('0x74')]()[_0xcdac('0x75')](_0xcdac('0x81'))[_0xcdac('0x7a')](_0xcdac('0x70'))[_0xcdac('0x40')](_0xcdac('0x82'),_0x2961eb[_0xcdac('0x49')]['id'][_0xcdac('0x79')]())))[_0xcdac('0x79')]();break;default:_0x1ae416=squel[_0xcdac('0x6e')]()[_0xcdac('0x6f')](_0xcdac('0x70'))[_0xcdac('0x84')]([_0xcdac('0x71'),'scheduledAt',_0xcdac('0x72'),_0xcdac('0x73'),_0xcdac('0x5c'),'createdAt',_0xcdac('0x56')],squel[_0xcdac('0x74')]()[_0xcdac('0x75')]('phone',_0xcdac('0x71'))['field']('NOW()',_0xcdac('0x77'))[_0xcdac('0x75')]('id',_0xcdac('0x72'))[_0xcdac('0x75')](_0x3ab76b['CmListId'][_0xcdac('0x79')](),_0xcdac('0x73'))[_0xcdac('0x75')](_0x2961eb[_0xcdac('0x49')]['id'][_0xcdac('0x79')](),_0xcdac('0x5c'))['field']('\x27'+_0x28c315+'\x27',_0xcdac('0x58'))['field']('\x27'+_0x28c315+'\x27','updatedAt')[_0xcdac('0x7a')]('cm_contacts')[_0xcdac('0x40')](_0xcdac('0x7b'))[_0xcdac('0x40')](_0xcdac('0x7c'),_0x3ab76b[_0xcdac('0x78')][_0xcdac('0x79')]())['where'](_0xcdac('0x7d')))[_0xcdac('0x79')]();}_0x5012f9=squel[_0xcdac('0x6e')]()['into'](_0xcdac('0x86'))['fromQuery'](['cmHopperId',_0xcdac('0x77'),_0xcdac('0x71'),'OrderBy','createdAt',_0xcdac('0x56')],squel[_0xcdac('0x74')]()[_0xcdac('0x75')]('h.id','id')[_0xcdac('0x75')](_0xcdac('0x76'),_0xcdac('0x77'))['field'](_0xcdac('0x87'),_0xcdac('0x71'))[_0xcdac('0x75')]('ci.OrderBY',_0xcdac('0x88'))['field']('\x27'+_0x28c315+'\x27',_0xcdac('0x58'))['field']('\x27'+_0x28c315+'\x27','updatedAt')['from'](_0xcdac('0x89'),'ci')[_0xcdac('0x8a')](_0xcdac('0x70'),'h',_0xcdac('0x8b'))[_0xcdac('0x40')](_0xcdac('0x8c'),_0x3ab76b[_0xcdac('0x78')][_0xcdac('0x79')]())[_0xcdac('0x40')](_0xcdac('0x8d'),_0x2961eb[_0xcdac('0x49')]['id']['toString']())[_0xcdac('0x40')](_0xcdac('0x8e'),_0x28c315))['toString']();_0x34646f['push'](db[_0xcdac('0x8f')][_0xcdac('0x36')](_0x1ae416));_0x578250['push'](db['sequelize']['query'](_0x5012f9));}return BPromise[_0xcdac('0x90')](_0x34646f);}})[_0xcdac('0x29')](function(){return BPromise[_0xcdac('0x90')](_0x578250);})[_0xcdac('0x29')](function(){return _0x20f0e8;})[_0xcdac('0x29')](respondWithResult(_0x1fdb2f,null))[_0xcdac('0x4c')](handleError(_0x1fdb2f,null));};exports[_0xcdac('0x91')]=function(_0x59992a,_0x4790ae,_0x278f0f){return db['Campaign']['find']({'where':{'id':_0x59992a[_0xcdac('0x49')]['id']}})[_0xcdac('0x29')](handleEntityNotFound(_0x4790ae,null))['then'](function(_0x5bcbb9){if(_0x5bcbb9){return _0x5bcbb9['removeLists'](_0x59992a[_0xcdac('0x36')][_0xcdac('0x6b')]);}})[_0xcdac('0x29')](function(_0x2b245c){if(_0x2b245c){return db[_0xcdac('0x5b')][_0xcdac('0x92')]({'where':{'ListId':_0x59992a['query']['ids'],'CampaignId':_0x59992a[_0xcdac('0x49')]['id']}})['then'](function(){return _0x2b245c;});}})['then'](respondWithStatusCode(_0x4790ae,null))['catch'](handleError(_0x4790ae,null));};exports['getBlackLists']=function(_0x54f402,_0x3e5ddd,_0x57e390){var _0x2f2b71={};var _0x16792a={};var _0x5d153d;var _0x2af193;return db[_0xcdac('0x31')][_0xcdac('0x5a')]({'where':{'id':_0x54f402[_0xcdac('0x49')]['id']}})[_0xcdac('0x29')](handleEntityNotFound(_0x3e5ddd,null))[_0xcdac('0x29')](function(_0x45c0ac){if(_0x45c0ac){_0x5d153d=_0x45c0ac;_0x16792a['model']=_[_0xcdac('0x35')](db['CmList'][_0xcdac('0x4a')]);_0x16792a['query']=_[_0xcdac('0x35')](_0x54f402[_0xcdac('0x36')]);_0x16792a[_0xcdac('0x37')]=_[_0xcdac('0x38')](_0x16792a[_0xcdac('0x34')],_0x16792a[_0xcdac('0x36')]);_0x2f2b71[_0xcdac('0x39')]=_[_0xcdac('0x38')](_0x16792a[_0xcdac('0x34')],qs[_0xcdac('0x3a')](_0x54f402[_0xcdac('0x36')][_0xcdac('0x3a')]));_0x2f2b71[_0xcdac('0x39')]=_0x2f2b71[_0xcdac('0x39')]['length']?_0x2f2b71['attributes']:_0x16792a['model'];_0x2f2b71[_0xcdac('0x63')]=qs[_0xcdac('0x3f')](_0x54f402[_0xcdac('0x36')][_0xcdac('0x3f')]);_0x2f2b71['where']=qs[_0xcdac('0x37')](_[_0xcdac('0x60')](_0x54f402[_0xcdac('0x36')],_0x16792a[_0xcdac('0x37')]));if(_0x54f402[_0xcdac('0x36')]['filter']){_0x2f2b71['where']=_['merge'](_0x2f2b71[_0xcdac('0x40')],{'$or':_[_0xcdac('0x30')](_0x2f2b71[_0xcdac('0x39')],function(_0x5a405b){var _0x29d777={};_0x29d777[_0x5a405b]={'$like':'%'+_0x54f402[_0xcdac('0x36')][_0xcdac('0x41')]+'%'};return _0x29d777;})});}_0x2f2b71=_[_0xcdac('0x42')]({},_0x2f2b71,_0x54f402[_0xcdac('0x44')]);return _0x5d153d[_0xcdac('0x93')](_0x2f2b71);}})['then'](function(_0x2c58cf){if(_0x2c58cf){_0x2af193=_0x2c58cf[_0xcdac('0x3b')];if(!_0x54f402['query'][_0xcdac('0x3c')]('nolimit')){_0x2f2b71[_0xcdac('0x3e')]=qs['limit'](_0x54f402[_0xcdac('0x36')][_0xcdac('0x3e')]);_0x2f2b71[_0xcdac('0x20')]=qs[_0xcdac('0x20')](_0x54f402['query'][_0xcdac('0x20')]);}return _0x5d153d[_0xcdac('0x93')](_0x2f2b71);}})[_0xcdac('0x29')](function(_0x3ac782){if(_0x3ac782){return _0x3ac782?{'count':_0x2af193,'rows':_0x3ac782}:null;}})[_0xcdac('0x29')](respondWithResult(_0x3e5ddd,null))[_0xcdac('0x4c')](handleError(_0x3e5ddd,null));};exports['addBlackLists']=function(_0x36be30,_0x52fef2,_0x3d0dc5){var _0x50d708,_0x174167;var _0x368b98=[];var _0x2c95e4=moment()['format'](_0xcdac('0x6a'));return db[_0xcdac('0x31')][_0xcdac('0x4b')]({'where':{'id':_0x36be30[_0xcdac('0x49')]['id']}})[_0xcdac('0x29')](handleEntityNotFound(_0x52fef2,null))[_0xcdac('0x29')](function(_0xb14157){if(_0xb14157){_0x174167=_0xb14157;return _0xb14157[_0xcdac('0x94')](_0x36be30[_0xcdac('0x57')][_0xcdac('0x6b')],_[_0xcdac('0x55')](_0x36be30[_0xcdac('0x57')],['ids','id'])||{});}return null;})[_0xcdac('0x95')](function(_0xbc837e){var _0x8b0cfb;var _0x5ae854;_0x50d708=_0xbc837e||[];var _0x3ef2c6=[];if(_0xbc837e){for(var _0x5494c2=0x0;_0x5494c2<_0xbc837e[_0xcdac('0x3b')];_0x5494c2+=0x1){var _0x1843e7=_0xbc837e[_0x5494c2][_0xcdac('0x2a')]({'plain':!![]});_0x8b0cfb=squel['insert']()[_0xcdac('0x6f')](_0xcdac('0x96'))[_0xcdac('0x84')]([_0xcdac('0x71'),_0xcdac('0x72'),_0xcdac('0x73'),'CampaignId','createdAt','updatedAt'],squel['select']()['field'](_0xcdac('0x71'),_0xcdac('0x71'))[_0xcdac('0x75')]('id','ContactId')['field'](_0x1843e7['CmListId']['toString'](),_0xcdac('0x73'))['field'](_0x36be30[_0xcdac('0x49')]['id']['toString'](),_0xcdac('0x5c'))[_0xcdac('0x75')](_0xcdac('0x76'),_0xcdac('0x58'))[_0xcdac('0x75')](_0xcdac('0x76'),_0xcdac('0x56'))[_0xcdac('0x7a')](_0xcdac('0x85'))['where']('deletedAt\x20IS\x20NULL')[_0xcdac('0x40')](_0xcdac('0x7c'),_0x1843e7[_0xcdac('0x78')][_0xcdac('0x79')]())[_0xcdac('0x40')](_0xcdac('0x7d')))[_0xcdac('0x79')]();_0x3ef2c6[_0xcdac('0x97')](db[_0xcdac('0x8f')][_0xcdac('0x36')](_0x8b0cfb));}return BPromise[_0xcdac('0x90')](_0x3ef2c6);}})[_0xcdac('0x29')](function(){return _0x50d708;})[_0xcdac('0x29')](respondWithResult(_0x52fef2,null))[_0xcdac('0x4c')](handleError(_0x52fef2,null));};exports[_0xcdac('0x98')]=function(_0x2e37f6,_0x431534,_0x35a873){return db[_0xcdac('0x31')]['find']({'where':{'id':_0x2e37f6[_0xcdac('0x49')]['id']}})['then'](handleEntityNotFound(_0x431534,null))[_0xcdac('0x29')](function(_0x5ebbd6){if(_0x5ebbd6){return _0x5ebbd6[_0xcdac('0x98')](_0x2e37f6['query'][_0xcdac('0x6b')]);}})[_0xcdac('0x29')](function(_0x4317bd){if(_0x4317bd){return db[_0xcdac('0x65')]['destroy']({'where':{'ListId':_0x2e37f6[_0xcdac('0x36')][_0xcdac('0x6b')],'CampaignId':_0x2e37f6[_0xcdac('0x49')]['id']}})[_0xcdac('0x29')](function(){return _0x4317bd;});}})[_0xcdac('0x29')](respondWithStatusCode(_0x431534,null))[_0xcdac('0x4c')](handleError(_0x431534,null));}; \ No newline at end of file +var _0x0135=['stack','name','send','index','map','Campaign','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','length','include','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','rawAttributes','CampaignId','CmHopper','findAll','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','field','NOW()','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','cm_contacts','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','h.id','ci.OrderBY','OrderBy','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','YYYY-MM-DD\x20HH:mm:ss','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error'];(function(_0x28bfdc,_0x50fd27){var _0x25bf45=function(_0x17f94a){while(--_0x17f94a){_0x28bfdc['push'](_0x28bfdc['shift']());}};_0x25bf45(++_0x50fd27);}(_0x0135,0x188));var _0x5013=function(_0x34e33d,_0x46748b){_0x34e33d=_0x34e33d-0x0;var _0x488d61=_0x0135[_0x34e33d];return _0x488d61;};'use strict';var emlformat=require(_0x5013('0x0'));var rimraf=require(_0x5013('0x1'));var zipdir=require(_0x5013('0x2'));var jsonpatch=require(_0x5013('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5013('0x4'));var util=require('util');var path=require(_0x5013('0x5'));var sox=require('sox');var csv=require(_0x5013('0x6'));var ejs=require(_0x5013('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x5013('0x8'));var jsforce=require(_0x5013('0x9'));var deskjs=require(_0x5013('0xa'));var toCsv=require(_0x5013('0x6'));var querystring=require(_0x5013('0xb'));var Papa=require(_0x5013('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5013('0xd'));var hardwareService=require(_0x5013('0xe'));var logger=require(_0x5013('0xf'))(_0x5013('0x10'));var utils=require('../../config/utils');var config=require(_0x5013('0x11'));var licenseUtil=require(_0x5013('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7331b2,_0x4e7820){_0x4e7820=_0x4e7820||0xcc;return function(_0x28b75e){if(_0x28b75e){return _0x7331b2['sendStatus'](_0x4e7820);}return _0x7331b2[_0x5013('0x13')](_0x4e7820)[_0x5013('0x14')]();};}function respondWithResult(_0x10a237,_0x3b6e1c){_0x3b6e1c=_0x3b6e1c||0xc8;return function(_0x3bdf65){if(_0x3bdf65){return _0x10a237[_0x5013('0x13')](_0x3b6e1c)[_0x5013('0x15')](_0x3bdf65);}};}function respondWithFilteredResult(_0x47032e,_0x115869){return function(_0x2033ae){if(_0x2033ae){var _0x10442f=typeof _0x115869[_0x5013('0x16')]===_0x5013('0x17')&&typeof _0x115869['limit']===_0x5013('0x17');var _0x534765=_0x2033ae['count'];var _0x9b85ab=_0x10442f?0x0:_0x115869['offset'];var _0xb1ecd2=_0x10442f?_0x2033ae[_0x5013('0x18')]:_0x115869['offset']+_0x115869['limit'];var _0x500291;if(_0xb1ecd2>=_0x534765){_0xb1ecd2=_0x534765;_0x500291=0xc8;}else{_0x500291=0xce;}_0x47032e[_0x5013('0x13')](_0x500291);return _0x47032e['set'](_0x5013('0x19'),_0x9b85ab+'-'+_0xb1ecd2+'/'+_0x534765)['json'](_0x2033ae);}return null;};}function patchUpdates(_0x2972cd){return function(_0x20dfc9){try{jsonpatch[_0x5013('0x1a')](_0x20dfc9,_0x2972cd,!![]);}catch(_0x52f57d){return BPromise[_0x5013('0x1b')](_0x52f57d);}return _0x20dfc9[_0x5013('0x1c')]();};}function saveUpdates(_0x25f38c,_0x2c98d1){return function(_0x3f7d0d){if(_0x3f7d0d){return _0x3f7d0d[_0x5013('0x1d')](_0x25f38c)[_0x5013('0x1e')](function(_0x24e1cb){return _0x24e1cb;});}return null;};}function removeEntity(_0x46b7b4,_0x134546){return function(_0x4efc48){if(_0x4efc48){return _0x4efc48[_0x5013('0x1f')]()[_0x5013('0x1e')](function(){var _0x1b3c38=_0x4efc48[_0x5013('0x20')]({'plain':!![]});var _0x7110e2=_0x5013('0x21');return db[_0x5013('0x22')][_0x5013('0x1f')]({'where':{'type':_0x7110e2,'resourceId':_0x1b3c38['id']}})[_0x5013('0x1e')](function(){return _0x4efc48;});})[_0x5013('0x1e')](function(){_0x46b7b4[_0x5013('0x13')](0xcc)[_0x5013('0x14')]();});}};}function handleEntityNotFound(_0x383f51,_0x2e81a8){return function(_0x1694a7){if(!_0x1694a7){_0x383f51[_0x5013('0x23')](0x194);}return _0x1694a7;};}function handleError(_0x2bee7c,_0x14d4a5){_0x14d4a5=_0x14d4a5||0x1f4;return function(_0x2744d6){logger[_0x5013('0x24')](_0x2744d6[_0x5013('0x25')]);if(_0x2744d6[_0x5013('0x26')]){delete _0x2744d6['name'];}_0x2bee7c[_0x5013('0x13')](_0x14d4a5)[_0x5013('0x27')](_0x2744d6);};}exports[_0x5013('0x28')]=function(_0x58005e,_0x19feae){var _0x247563={},_0x593187={},_0xf0bb84={'count':0x0,'rows':[]};var _0x5f2eec=_[_0x5013('0x29')](db[_0x5013('0x2a')]['rawAttributes'],function(_0x4e5e3b){return{'name':_0x4e5e3b[_0x5013('0x2b')],'type':_0x4e5e3b[_0x5013('0x2c')][_0x5013('0x2d')]};});_0x593187['model']=_[_0x5013('0x29')](_0x5f2eec,_0x5013('0x26'));_0x593187[_0x5013('0x2e')]=_[_0x5013('0x2f')](_0x58005e['query']);_0x593187[_0x5013('0x30')]=_[_0x5013('0x31')](_0x593187[_0x5013('0x32')],_0x593187[_0x5013('0x2e')]);_0x247563[_0x5013('0x33')]=_[_0x5013('0x31')](_0x593187[_0x5013('0x32')],qs[_0x5013('0x34')](_0x58005e[_0x5013('0x2e')][_0x5013('0x34')]));_0x247563[_0x5013('0x33')]=_0x247563[_0x5013('0x33')]['length']?_0x247563[_0x5013('0x33')]:_0x593187[_0x5013('0x32')];if(!_0x58005e[_0x5013('0x2e')][_0x5013('0x35')](_0x5013('0x36'))){_0x247563[_0x5013('0x37')]=qs[_0x5013('0x37')](_0x58005e[_0x5013('0x2e')][_0x5013('0x37')]);_0x247563[_0x5013('0x16')]=qs[_0x5013('0x16')](_0x58005e[_0x5013('0x2e')][_0x5013('0x16')]);}_0x247563[_0x5013('0x38')]=qs[_0x5013('0x39')](_0x58005e[_0x5013('0x2e')]['sort']);_0x247563[_0x5013('0x3a')]=qs[_0x5013('0x30')](_[_0x5013('0x3b')](_0x58005e[_0x5013('0x2e')],_0x593187['filters']),_0x5f2eec);if(_0x58005e[_0x5013('0x2e')][_0x5013('0x3c')]){_0x247563[_0x5013('0x3a')]=_[_0x5013('0x3d')](_0x247563[_0x5013('0x3a')],{'$or':_[_0x5013('0x29')](_0x5f2eec,function(_0x35a7b5){if(_0x35a7b5['type']!==_0x5013('0x3e')){var _0x315318={};_0x315318[_0x35a7b5['name']]={'$like':'%'+_0x58005e['query'][_0x5013('0x3c')]+'%'};return _0x315318;}})});}_0x247563=_[_0x5013('0x3d')]({},_0x247563,_0x58005e[_0x5013('0x3f')]);var _0x4c14ac={'where':_0x247563[_0x5013('0x3a')]};return db[_0x5013('0x2a')][_0x5013('0x18')](_0x4c14ac)['then'](function(_0x4ace76){_0xf0bb84[_0x5013('0x18')]=_0x4ace76;if(_0x58005e[_0x5013('0x2e')][_0x5013('0x40')]){_0x247563['include']=[{'all':!![]}];}return db['Campaign']['findAll'](_0x247563);})[_0x5013('0x1e')](function(_0x8f3fc5){_0xf0bb84['rows']=_0x8f3fc5;return _0xf0bb84;})['then'](respondWithFilteredResult(_0x19feae,_0x247563))[_0x5013('0x41')](handleError(_0x19feae,null));};exports[_0x5013('0x42')]=function(_0x186341,_0x4c9721){var _0x616ca5={'raw':![],'where':{'id':_0x186341[_0x5013('0x43')]['id']}},_0x4cc0c8={};_0x4cc0c8[_0x5013('0x32')]=_[_0x5013('0x2f')](db['Campaign']['rawAttributes']);_0x4cc0c8[_0x5013('0x2e')]=_[_0x5013('0x2f')](_0x186341['query']);_0x4cc0c8[_0x5013('0x30')]=_[_0x5013('0x31')](_0x4cc0c8[_0x5013('0x32')],_0x4cc0c8[_0x5013('0x2e')]);_0x616ca5[_0x5013('0x33')]=_['intersection'](_0x4cc0c8[_0x5013('0x32')],qs[_0x5013('0x34')](_0x186341[_0x5013('0x2e')]['fields']));_0x616ca5[_0x5013('0x33')]=_0x616ca5['attributes'][_0x5013('0x44')]?_0x616ca5[_0x5013('0x33')]:_0x4cc0c8['model'];if(_0x186341[_0x5013('0x2e')]['includeAll']){_0x616ca5[_0x5013('0x45')]=[{'all':!![]}];}_0x616ca5=_[_0x5013('0x3d')]({},_0x616ca5,_0x186341[_0x5013('0x3f')]);return db[_0x5013('0x2a')][_0x5013('0x46')](_0x616ca5)[_0x5013('0x1e')](handleEntityNotFound(_0x4c9721,null))[_0x5013('0x1e')](respondWithResult(_0x4c9721,null))['catch'](handleError(_0x4c9721,null));};exports['create']=function(_0x7d419a,_0x701674){return db[_0x5013('0x2a')][_0x5013('0x47')](_0x7d419a[_0x5013('0x48')],{})[_0x5013('0x1e')](function(_0x3593f7){var _0x241058=_0x7d419a['user'][_0x5013('0x20')]({'plain':!![]});if(!_0x241058)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x241058[_0x5013('0x49')]===_0x5013('0x4a')){var _0x3843ba=_0x3593f7['get']({'plain':!![]});var _0x5c6843=_0x5013('0x21');return db[_0x5013('0x4b')][_0x5013('0x46')]({'where':{'name':_0x5c6843,'userProfileId':_0x241058[_0x5013('0x4c')]},'raw':!![]})[_0x5013('0x1e')](function(_0x4893a1){if(_0x4893a1&&_0x4893a1[_0x5013('0x4d')]===0x0){return db[_0x5013('0x22')][_0x5013('0x47')]({'name':_0x3843ba['name'],'resourceId':_0x3843ba['id'],'type':_0x4893a1[_0x5013('0x26')],'sectionId':_0x4893a1['id']},{})[_0x5013('0x1e')](function(){return _0x3593f7;});}else{return _0x3593f7;}})[_0x5013('0x41')](function(_0x522541){logger[_0x5013('0x24')](_0x5013('0x4e'),_0x522541);throw _0x522541;});}return _0x3593f7;})[_0x5013('0x1e')](respondWithResult(_0x701674,0xc9))[_0x5013('0x41')](handleError(_0x701674,null));};exports[_0x5013('0x4f')]=function(_0x2f3233,_0x131998){var _0x55102b={'where':{'id':_0x2f3233['params']['id']}},_0xc6c233={};_0xc6c233[_0x5013('0x32')]=_[_0x5013('0x2f')](db['Campaign']['rawAttributes']);_0x55102b[_0x5013('0x33')]=_[_0x5013('0x31')](_0xc6c233[_0x5013('0x32')],qs[_0x5013('0x34')](_0x2f3233[_0x5013('0x2e')]['fields']));_0x55102b[_0x5013('0x33')]=_0x55102b[_0x5013('0x33')]['length']?_0x55102b['attributes']:_0xc6c233[_0x5013('0x32')];if(_0x2f3233[_0x5013('0x2e')][_0x5013('0x40')]){_0x55102b['include']=[{'all':!![]}];}_0x55102b=_[_0x5013('0x3d')]({},_0x55102b,_0x2f3233[_0x5013('0x3f')]);return db[_0x5013('0x2a')][_0x5013('0x46')](_0x55102b)[_0x5013('0x1e')](handleEntityNotFound(_0x131998,null))[_0x5013('0x1e')](function(_0x5a6251){if(_0x5a6251){var _0x206c18=_0x5a6251[_0x5013('0x20')]({'plain':!![]});_0x206c18=qs[_0x5013('0x50')](_0x206c18,['id',_0x5013('0x51'),'updatedAt']);_0x2f3233[_0x5013('0x48')]=_[_0x5013('0x50')](_0x2f3233[_0x5013('0x48')],['id',_0x5013('0x51'),_0x5013('0x52')]);return db[_0x5013('0x2a')][_0x5013('0x47')](_['merge'](_0x206c18,_0x2f3233[_0x5013('0x48')]),{'include':_0x2f3233[_0x5013('0x2e')][_0x5013('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x18becb){var _0x1501b6=_0x2f3233[_0x5013('0x4a')][_0x5013('0x20')]({'plain':!![]});if(!_0x1501b6)throw new Error(_0x5013('0x53'));if(_0x1501b6[_0x5013('0x49')]==='user'){var _0x2b3ad7=_0x18becb[_0x5013('0x20')]({'plain':!![]});var _0x4e1c88=_0x5013('0x21');return db[_0x5013('0x4b')]['find']({'where':{'name':_0x4e1c88,'userProfileId':_0x1501b6['userProfileId']},'raw':!![]})[_0x5013('0x1e')](function(_0x18ad99){if(_0x18ad99&&_0x18ad99[_0x5013('0x4d')]===0x0){return db[_0x5013('0x22')][_0x5013('0x47')]({'name':_0x2b3ad7[_0x5013('0x26')],'resourceId':_0x2b3ad7['id'],'type':_0x18ad99[_0x5013('0x26')],'sectionId':_0x18ad99['id']},{})[_0x5013('0x1e')](function(){return _0x18becb;});}else{return _0x18becb;}})[_0x5013('0x41')](function(_0x143d9d){logger[_0x5013('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x143d9d);throw _0x143d9d;});}return _0x18becb;});}})[_0x5013('0x1e')](respondWithResult(_0x131998,0xc9))[_0x5013('0x41')](handleError(_0x131998,null));};exports['update']=function(_0x26c3a3,_0x51ccca){if(_0x26c3a3[_0x5013('0x48')]['id']){delete _0x26c3a3[_0x5013('0x48')]['id'];}return db[_0x5013('0x2a')][_0x5013('0x46')]({'where':{'id':_0x26c3a3[_0x5013('0x43')]['id']}})[_0x5013('0x1e')](handleEntityNotFound(_0x51ccca,null))[_0x5013('0x1e')](saveUpdates(_0x26c3a3[_0x5013('0x48')],null))[_0x5013('0x1e')](respondWithResult(_0x51ccca,null))['catch'](handleError(_0x51ccca,null));};exports[_0x5013('0x1f')]=function(_0x5e9f10,_0x181a02){return db[_0x5013('0x2a')][_0x5013('0x46')]({'where':{'id':_0x5e9f10[_0x5013('0x43')]['id']}})[_0x5013('0x1e')](handleEntityNotFound(_0x181a02,null))[_0x5013('0x1e')](removeEntity(_0x181a02,null))[_0x5013('0x41')](handleError(_0x181a02,null));};exports[_0x5013('0x54')]=function(_0x126da1,_0x277bf3,_0x42a9a2){var _0x5b3c7a={'raw':!![],'where':{}};var _0x2cc1bd={};var _0x2531c3={'count':0x0,'rows':[]};return db[_0x5013('0x2a')][_0x5013('0x55')]({'where':{'id':_0x126da1[_0x5013('0x43')]['id']}})[_0x5013('0x1e')](handleEntityNotFound(_0x277bf3,null))[_0x5013('0x1e')](function(_0x205c82){if(_0x205c82){_0x2cc1bd['model']=_[_0x5013('0x2f')](db['CmHopper'][_0x5013('0x56')]);_0x2cc1bd[_0x5013('0x2e')]=_[_0x5013('0x2f')](_0x126da1['query']);_0x2cc1bd[_0x5013('0x30')]=_[_0x5013('0x31')](_0x2cc1bd['model'],_0x2cc1bd['query']);_0x5b3c7a[_0x5013('0x33')]=_[_0x5013('0x31')](_0x2cc1bd[_0x5013('0x32')],qs[_0x5013('0x34')](_0x126da1[_0x5013('0x2e')]['fields']));_0x5b3c7a[_0x5013('0x33')]=_0x5b3c7a[_0x5013('0x33')]['length']?_0x5b3c7a[_0x5013('0x33')]:_0x2cc1bd[_0x5013('0x32')];if(!_0x126da1[_0x5013('0x2e')][_0x5013('0x35')](_0x5013('0x36'))){_0x5b3c7a[_0x5013('0x37')]=qs[_0x5013('0x37')](_0x126da1['query']['limit']);_0x5b3c7a['offset']=qs[_0x5013('0x16')](_0x126da1[_0x5013('0x2e')][_0x5013('0x16')]);}_0x5b3c7a[_0x5013('0x38')]=qs[_0x5013('0x39')](_0x126da1['query']['sort']);_0x5b3c7a[_0x5013('0x3a')]=qs[_0x5013('0x30')](_[_0x5013('0x3b')](_0x126da1['query'],_0x2cc1bd['filters']));_0x5b3c7a[_0x5013('0x3a')][_0x5013('0x57')]=_0x205c82['id'];if(_0x126da1[_0x5013('0x2e')][_0x5013('0x3c')]){_0x5b3c7a[_0x5013('0x3a')]=_[_0x5013('0x3d')](_0x5b3c7a[_0x5013('0x3a')],{'$or':_[_0x5013('0x29')](_0x5b3c7a[_0x5013('0x33')],function(_0x1c4471){var _0x52c4b7={};_0x52c4b7[_0x1c4471]={'$like':'%'+_0x126da1[_0x5013('0x2e')][_0x5013('0x3c')]+'%'};return _0x52c4b7;})});}_0x5b3c7a=_[_0x5013('0x3d')]({},_0x5b3c7a,_0x126da1['options']);return db[_0x5013('0x58')]['count']({'where':_0x5b3c7a['where']})[_0x5013('0x1e')](function(_0x260335){_0x2531c3[_0x5013('0x18')]=_0x260335;if(_0x126da1['query'][_0x5013('0x40')]){_0x5b3c7a[_0x5013('0x45')]=[{'all':!![]}];}return db['CmHopper'][_0x5013('0x59')](_0x5b3c7a);})[_0x5013('0x1e')](function(_0x598611){_0x2531c3[_0x5013('0x5a')]=_0x598611;return _0x2531c3;});}})[_0x5013('0x1e')](respondWithFilteredResult(_0x277bf3,_0x5b3c7a))[_0x5013('0x41')](handleError(_0x277bf3,null));};exports[_0x5013('0x5b')]=function(_0x1e3448,_0x3719b1,_0x5b92ee){var _0x3ec771={'raw':!![],'where':{}};var _0x4afd6a={};var _0x4b2326={'count':0x0,'rows':[]};return db[_0x5013('0x2a')]['findOne']({'where':{'id':_0x1e3448['params']['id']}})[_0x5013('0x1e')](handleEntityNotFound(_0x3719b1,null))[_0x5013('0x1e')](function(_0x50fb77){if(_0x50fb77){_0x4afd6a['model']=_['keys'](db[_0x5013('0x5c')][_0x5013('0x56')]);_0x4afd6a[_0x5013('0x2e')]=_['keys'](_0x1e3448[_0x5013('0x2e')]);_0x4afd6a['filters']=_[_0x5013('0x31')](_0x4afd6a['model'],_0x4afd6a[_0x5013('0x2e')]);_0x3ec771[_0x5013('0x33')]=_[_0x5013('0x31')](_0x4afd6a['model'],qs[_0x5013('0x34')](_0x1e3448[_0x5013('0x2e')][_0x5013('0x34')]));_0x3ec771[_0x5013('0x33')]=_0x3ec771['attributes'][_0x5013('0x44')]?_0x3ec771[_0x5013('0x33')]:_0x4afd6a[_0x5013('0x32')];if(!_0x1e3448[_0x5013('0x2e')][_0x5013('0x35')](_0x5013('0x36'))){_0x3ec771[_0x5013('0x37')]=qs['limit'](_0x1e3448['query'][_0x5013('0x37')]);_0x3ec771['offset']=qs[_0x5013('0x16')](_0x1e3448[_0x5013('0x2e')][_0x5013('0x16')]);}_0x3ec771['order']=qs['sort'](_0x1e3448[_0x5013('0x2e')][_0x5013('0x39')]);_0x3ec771['where']=qs[_0x5013('0x30')](_[_0x5013('0x3b')](_0x1e3448['query'],_0x4afd6a[_0x5013('0x30')]));_0x3ec771[_0x5013('0x3a')][_0x5013('0x57')]=_0x50fb77['id'];if(_0x1e3448[_0x5013('0x2e')][_0x5013('0x3c')]){_0x3ec771[_0x5013('0x3a')]=_[_0x5013('0x3d')](_0x3ec771[_0x5013('0x3a')],{'$or':_[_0x5013('0x29')](_0x3ec771[_0x5013('0x33')],function(_0x47ca5f){var _0x310751={};_0x310751[_0x47ca5f]={'$like':'%'+_0x1e3448[_0x5013('0x2e')][_0x5013('0x3c')]+'%'};return _0x310751;})});}_0x3ec771=_[_0x5013('0x3d')]({},_0x3ec771,_0x1e3448[_0x5013('0x3f')]);return db[_0x5013('0x5c')][_0x5013('0x18')]({'where':_0x3ec771[_0x5013('0x3a')]})[_0x5013('0x1e')](function(_0xf9eec1){_0x4b2326[_0x5013('0x18')]=_0xf9eec1;if(_0x1e3448[_0x5013('0x2e')][_0x5013('0x40')]){_0x3ec771[_0x5013('0x45')]=[{'all':!![]}];}return db[_0x5013('0x5c')][_0x5013('0x59')](_0x3ec771);})[_0x5013('0x1e')](function(_0x392869){_0x4b2326[_0x5013('0x5a')]=_0x392869;return _0x4b2326;});}})[_0x5013('0x1e')](respondWithFilteredResult(_0x3719b1,_0x3ec771))[_0x5013('0x41')](handleError(_0x3719b1,null));};exports['getHopperFinals']=function(_0xb0efbb,_0x576510,_0x1b3059){var _0x2f7e03={'raw':!![],'where':{}};var _0x115592={};var _0x5ca942={'count':0x0,'rows':[]};return db[_0x5013('0x2a')][_0x5013('0x55')]({'where':{'id':_0xb0efbb[_0x5013('0x43')]['id']}})[_0x5013('0x1e')](handleEntityNotFound(_0x576510,null))[_0x5013('0x1e')](function(_0x2ef0d4){if(_0x2ef0d4){_0x115592[_0x5013('0x32')]=_[_0x5013('0x2f')](db[_0x5013('0x5d')][_0x5013('0x56')]);_0x115592[_0x5013('0x2e')]=_['keys'](_0xb0efbb[_0x5013('0x2e')]);_0x115592[_0x5013('0x30')]=_['intersection'](_0x115592[_0x5013('0x32')],_0x115592['query']);_0x2f7e03[_0x5013('0x33')]=_[_0x5013('0x31')](_0x115592[_0x5013('0x32')],qs[_0x5013('0x34')](_0xb0efbb[_0x5013('0x2e')]['fields']));_0x2f7e03[_0x5013('0x33')]=_0x2f7e03[_0x5013('0x33')][_0x5013('0x44')]?_0x2f7e03[_0x5013('0x33')]:_0x115592[_0x5013('0x32')];if(!_0xb0efbb['query']['hasOwnProperty'](_0x5013('0x36'))){_0x2f7e03[_0x5013('0x37')]=qs[_0x5013('0x37')](_0xb0efbb[_0x5013('0x2e')]['limit']);_0x2f7e03['offset']=qs[_0x5013('0x16')](_0xb0efbb[_0x5013('0x2e')][_0x5013('0x16')]);}_0x2f7e03[_0x5013('0x38')]=qs[_0x5013('0x39')](_0xb0efbb[_0x5013('0x2e')][_0x5013('0x39')]);_0x2f7e03[_0x5013('0x3a')]=qs[_0x5013('0x30')](_[_0x5013('0x3b')](_0xb0efbb[_0x5013('0x2e')],_0x115592[_0x5013('0x30')]));_0x2f7e03[_0x5013('0x3a')][_0x5013('0x57')]=_0x2ef0d4['id'];if(_0xb0efbb['query'][_0x5013('0x3c')]){_0x2f7e03['where']=_[_0x5013('0x3d')](_0x2f7e03[_0x5013('0x3a')],{'$or':_[_0x5013('0x29')](_0x2f7e03[_0x5013('0x33')],function(_0x1835d6){var _0x240fcc={};_0x240fcc[_0x1835d6]={'$like':'%'+_0xb0efbb[_0x5013('0x2e')][_0x5013('0x3c')]+'%'};return _0x240fcc;})});}_0x2f7e03=_[_0x5013('0x3d')]({},_0x2f7e03,_0xb0efbb[_0x5013('0x3f')]);return db[_0x5013('0x5d')][_0x5013('0x18')]({'where':_0x2f7e03['where']})[_0x5013('0x1e')](function(_0x447702){_0x5ca942[_0x5013('0x18')]=_0x447702;if(_0xb0efbb['query']['includeAll']){_0x2f7e03[_0x5013('0x45')]=[{'all':!![]}];}return db[_0x5013('0x5d')][_0x5013('0x59')](_0x2f7e03);})['then'](function(_0x195cdd){_0x5ca942['rows']=_0x195cdd;return _0x5ca942;});}})['then'](respondWithFilteredResult(_0x576510,_0x2f7e03))['catch'](handleError(_0x576510,null));};exports[_0x5013('0x5e')]=function(_0x2604bb,_0x1c0695,_0x15a65e){var _0x18cce1={'raw':!![],'where':{}};var _0x2bde30={};var _0x155623={'count':0x0,'rows':[]};return db[_0x5013('0x2a')]['findOne']({'where':{'id':_0x2604bb['params']['id']}})[_0x5013('0x1e')](handleEntityNotFound(_0x1c0695,null))[_0x5013('0x1e')](function(_0x4bbad9){if(_0x4bbad9){_0x2bde30[_0x5013('0x32')]=_[_0x5013('0x2f')](db[_0x5013('0x5f')][_0x5013('0x56')]);_0x2bde30['query']=_[_0x5013('0x2f')](_0x2604bb['query']);_0x2bde30[_0x5013('0x30')]=_['intersection'](_0x2bde30[_0x5013('0x32')],_0x2bde30['query']);_0x18cce1[_0x5013('0x33')]=_[_0x5013('0x31')](_0x2bde30[_0x5013('0x32')],qs['fields'](_0x2604bb[_0x5013('0x2e')][_0x5013('0x34')]));_0x18cce1['attributes']=_0x18cce1[_0x5013('0x33')][_0x5013('0x44')]?_0x18cce1[_0x5013('0x33')]:_0x2bde30[_0x5013('0x32')];if(!_0x2604bb['query'][_0x5013('0x35')]('nolimit')){_0x18cce1[_0x5013('0x37')]=qs['limit'](_0x2604bb[_0x5013('0x2e')][_0x5013('0x37')]);_0x18cce1[_0x5013('0x16')]=qs[_0x5013('0x16')](_0x2604bb[_0x5013('0x2e')]['offset']);}_0x18cce1[_0x5013('0x38')]=qs[_0x5013('0x39')](_0x2604bb[_0x5013('0x2e')][_0x5013('0x39')]);_0x18cce1[_0x5013('0x3a')]=qs[_0x5013('0x30')](_[_0x5013('0x3b')](_0x2604bb[_0x5013('0x2e')],_0x2bde30[_0x5013('0x30')]));_0x18cce1['where'][_0x5013('0x57')]=_0x4bbad9['id'];if(_0x2604bb[_0x5013('0x2e')][_0x5013('0x3c')]){_0x18cce1['where']=_[_0x5013('0x3d')](_0x18cce1[_0x5013('0x3a')],{'$or':_[_0x5013('0x29')](_0x18cce1['attributes'],function(_0x4c1b51){var _0x2614a1={};_0x2614a1[_0x4c1b51]={'$like':'%'+_0x2604bb[_0x5013('0x2e')][_0x5013('0x3c')]+'%'};return _0x2614a1;})});}_0x18cce1=_[_0x5013('0x3d')]({},_0x18cce1,_0x2604bb[_0x5013('0x3f')]);return db['CmHopperBlack']['count']({'where':_0x18cce1[_0x5013('0x3a')]})['then'](function(_0xc9db55){_0x155623[_0x5013('0x18')]=_0xc9db55;if(_0x2604bb['query'][_0x5013('0x40')]){_0x18cce1[_0x5013('0x45')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x5013('0x59')](_0x18cce1);})[_0x5013('0x1e')](function(_0x4472ff){_0x155623['rows']=_0x4472ff;return _0x155623;});}})[_0x5013('0x1e')](respondWithFilteredResult(_0x1c0695,_0x18cce1))['catch'](handleError(_0x1c0695,null));};exports[_0x5013('0x60')]=function(_0x2f004b,_0x5b4cdc,_0x50c112){var _0x1caf33={};var _0x2d3679={};var _0x1a3202;var _0xf0371e;return db[_0x5013('0x2a')][_0x5013('0x55')]({'where':{'id':_0x2f004b[_0x5013('0x43')]['id']}})[_0x5013('0x1e')](handleEntityNotFound(_0x5b4cdc,null))[_0x5013('0x1e')](function(_0x1e42d1){if(_0x1e42d1){_0x1a3202=_0x1e42d1;_0x2d3679[_0x5013('0x32')]=_[_0x5013('0x2f')](db[_0x5013('0x61')][_0x5013('0x56')]);_0x2d3679[_0x5013('0x2e')]=_['keys'](_0x2f004b[_0x5013('0x2e')]);_0x2d3679['filters']=_[_0x5013('0x31')](_0x2d3679[_0x5013('0x32')],_0x2d3679[_0x5013('0x2e')]);_0x1caf33[_0x5013('0x33')]=_[_0x5013('0x31')](_0x2d3679[_0x5013('0x32')],qs[_0x5013('0x34')](_0x2f004b[_0x5013('0x2e')][_0x5013('0x34')]));_0x1caf33[_0x5013('0x33')]=_0x1caf33[_0x5013('0x33')][_0x5013('0x44')]?_0x1caf33['attributes']:_0x2d3679[_0x5013('0x32')];_0x1caf33[_0x5013('0x38')]=qs[_0x5013('0x39')](_0x2f004b['query'][_0x5013('0x39')]);_0x1caf33[_0x5013('0x3a')]=qs[_0x5013('0x30')](_[_0x5013('0x3b')](_0x2f004b[_0x5013('0x2e')],_0x2d3679['filters']));if(_0x2f004b[_0x5013('0x2e')][_0x5013('0x3c')]){_0x1caf33[_0x5013('0x3a')]=_[_0x5013('0x3d')](_0x1caf33[_0x5013('0x3a')],{'$or':_[_0x5013('0x29')](_0x1caf33[_0x5013('0x33')],function(_0x69e6a1){var _0x1f6a04={};_0x1f6a04[_0x69e6a1]={'$like':'%'+_0x2f004b['query'][_0x5013('0x3c')]+'%'};return _0x1f6a04;})});}_0x1caf33=_['merge']({},_0x1caf33,_0x2f004b['options']);return _0x1a3202['getLists'](_0x1caf33);}})['then'](function(_0x5da914){if(_0x5da914){_0xf0371e=_0x5da914[_0x5013('0x44')];if(!_0x2f004b['query']['hasOwnProperty'](_0x5013('0x36'))){_0x1caf33[_0x5013('0x37')]=qs[_0x5013('0x37')](_0x2f004b[_0x5013('0x2e')][_0x5013('0x37')]);_0x1caf33[_0x5013('0x16')]=qs['offset'](_0x2f004b[_0x5013('0x2e')]['offset']);}return _0x1a3202[_0x5013('0x60')](_0x1caf33);}})[_0x5013('0x1e')](function(_0x24bfc5){if(_0x24bfc5){return _0x24bfc5?{'count':_0xf0371e,'rows':_0x24bfc5}:null;}})[_0x5013('0x1e')](respondWithResult(_0x5b4cdc,null))[_0x5013('0x41')](handleError(_0x5b4cdc,null));};exports[_0x5013('0x62')]=function(_0x2bb636,_0x154ba9,_0xa0992e){var _0x4ab8f4,_0x2ff646;var _0x342925=[];var _0x295d7f=moment()[_0x5013('0x63')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x5013('0x2a')]['find']({'where':{'id':_0x2bb636['params']['id']}})['then'](handleEntityNotFound(_0x154ba9,null))[_0x5013('0x1e')](function(_0x4ec4d0){if(_0x4ec4d0){_0x2ff646=_0x4ec4d0;return _0x4ec4d0[_0x5013('0x62')](_0x2bb636[_0x5013('0x48')][_0x5013('0x64')],_[_0x5013('0x50')](_0x2bb636[_0x5013('0x48')],[_0x5013('0x64'),'id'])||{});}return null;})[_0x5013('0x65')](function(_0x3eac01){var _0x20db88;var _0x3e4139;_0x4ab8f4=_0x3eac01||[];var _0x18ab5f=[];if(_0x3eac01){for(var _0x485117=0x0;_0x485117<_0x3eac01['length'];_0x485117+=0x1){var _0x5a5582=_0x3eac01[_0x485117][_0x5013('0x20')]({'plain':!![]});_0x2ff646[_0x5013('0x66')]=_0x2bb636['body'][_0x5013('0x66')]?_0x2bb636[_0x5013('0x48')][_0x5013('0x66')]:_0x2ff646[_0x5013('0x66')];switch(_0x2ff646[_0x5013('0x66')]){case'always':_0x20db88=squel[_0x5013('0x67')]()[_0x5013('0x68')](_0x5013('0x69'))[_0x5013('0x6a')](['phone',_0x5013('0x6b'),_0x5013('0x6c'),_0x5013('0x6d'),_0x5013('0x57'),'createdAt','updatedAt'],squel[_0x5013('0x6e')]()['field'](_0x5013('0x6f'),_0x5013('0x6f'))[_0x5013('0x70')](_0x5013('0x71'),_0x5013('0x6b'))[_0x5013('0x70')]('id','ContactId')[_0x5013('0x70')](_0x5a5582['CmListId']['toString'](),_0x5013('0x6d'))[_0x5013('0x70')](_0x2bb636[_0x5013('0x43')]['id'][_0x5013('0x72')](),'CampaignId')['field']('\x27'+_0x295d7f+'\x27',_0x5013('0x51'))[_0x5013('0x70')]('\x27'+_0x295d7f+'\x27',_0x5013('0x52'))[_0x5013('0x73')]('cm_contacts')[_0x5013('0x3a')](_0x5013('0x74'))[_0x5013('0x3a')](_0x5013('0x75'),_0x5a5582[_0x5013('0x76')]['toString']())[_0x5013('0x3a')](_0x5013('0x77'))[_0x5013('0x3a')](_0x5013('0x78'),squel[_0x5013('0x6e')]()[_0x5013('0x70')]('COALESCE(calleridnum,\x27\x27)')[_0x5013('0x73')](_0x5013('0x79'))[_0x5013('0x3a')]('CampaignId\x20=\x20?',_0x2bb636['params']['id'][_0x5013('0x72')]()))[_0x5013('0x3a')](_0x5013('0x78'),squel[_0x5013('0x6e')]()[_0x5013('0x70')]('COALESCE(phone,\x27\x27)')[_0x5013('0x73')](_0x5013('0x69'))['where'](_0x5013('0x7a'),_0x2bb636[_0x5013('0x43')]['id'][_0x5013('0x72')]())))[_0x5013('0x72')]();break;case _0x5013('0x7b'):_0x20db88=squel[_0x5013('0x67')]()[_0x5013('0x68')]('cm_hopper')[_0x5013('0x6a')]([_0x5013('0x6f'),_0x5013('0x6b'),_0x5013('0x6c'),'ListId','CampaignId',_0x5013('0x51'),_0x5013('0x52')],squel['select']()['field'](_0x5013('0x6f'),_0x5013('0x6f'))[_0x5013('0x70')]('NOW()',_0x5013('0x6b'))[_0x5013('0x70')]('id',_0x5013('0x6c'))['field'](_0x5a5582[_0x5013('0x76')][_0x5013('0x72')](),_0x5013('0x6d'))[_0x5013('0x70')](_0x2bb636[_0x5013('0x43')]['id'][_0x5013('0x72')](),'CampaignId')[_0x5013('0x70')]('\x27'+_0x295d7f+'\x27','createdAt')[_0x5013('0x70')]('\x27'+_0x295d7f+'\x27',_0x5013('0x52'))['from'](_0x5013('0x7c'))['where'](_0x5013('0x74'))['where'](_0x5013('0x75'),_0x5a5582[_0x5013('0x76')][_0x5013('0x72')]())[_0x5013('0x3a')](_0x5013('0x77'))[_0x5013('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x5013('0x7d'))['from']('cm_hopper')[_0x5013('0x3a')](_0x5013('0x7a'),_0x2bb636['params']['id'][_0x5013('0x72')]())))[_0x5013('0x72')]();break;default:_0x20db88=squel[_0x5013('0x67')]()[_0x5013('0x68')](_0x5013('0x69'))['fromQuery'](['phone',_0x5013('0x6b'),_0x5013('0x6c'),_0x5013('0x6d'),_0x5013('0x57'),_0x5013('0x51'),_0x5013('0x52')],squel[_0x5013('0x6e')]()['field']('phone',_0x5013('0x6f'))[_0x5013('0x70')](_0x5013('0x71'),_0x5013('0x6b'))['field']('id',_0x5013('0x6c'))[_0x5013('0x70')](_0x5a5582['CmListId'][_0x5013('0x72')](),_0x5013('0x6d'))[_0x5013('0x70')](_0x2bb636[_0x5013('0x43')]['id']['toString'](),_0x5013('0x57'))[_0x5013('0x70')]('\x27'+_0x295d7f+'\x27',_0x5013('0x51'))[_0x5013('0x70')]('\x27'+_0x295d7f+'\x27',_0x5013('0x52'))[_0x5013('0x73')](_0x5013('0x7c'))[_0x5013('0x3a')]('deletedAt\x20IS\x20NULL')[_0x5013('0x3a')]('ListId\x20=\x20?',_0x5a5582[_0x5013('0x76')][_0x5013('0x72')]())['where'](_0x5013('0x77')))[_0x5013('0x72')]();}_0x3e4139=squel[_0x5013('0x67')]()['into'](_0x5013('0x7e'))[_0x5013('0x6a')]([_0x5013('0x7f'),_0x5013('0x6b'),_0x5013('0x6f'),'OrderBy',_0x5013('0x51'),_0x5013('0x52')],squel[_0x5013('0x6e')]()[_0x5013('0x70')](_0x5013('0x80'),'id')[_0x5013('0x70')](_0x5013('0x71'),_0x5013('0x6b'))[_0x5013('0x70')]('ci.item',_0x5013('0x6f'))[_0x5013('0x70')](_0x5013('0x81'),_0x5013('0x82'))[_0x5013('0x70')]('\x27'+_0x295d7f+'\x27','createdAt')['field']('\x27'+_0x295d7f+'\x27','updatedAt')['from']('cm_contact_has_items','ci')['join'](_0x5013('0x69'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x5013('0x3a')](_0x5013('0x83'),_0x5a5582['CmListId'][_0x5013('0x72')]())[_0x5013('0x3a')](_0x5013('0x84'),_0x2bb636[_0x5013('0x43')]['id']['toString']())[_0x5013('0x3a')](_0x5013('0x85'),_0x295d7f))[_0x5013('0x72')]();_0x18ab5f[_0x5013('0x86')](db[_0x5013('0x87')][_0x5013('0x2e')](_0x20db88));_0x342925['push'](db[_0x5013('0x87')][_0x5013('0x2e')](_0x3e4139));}return BPromise[_0x5013('0x88')](_0x18ab5f);}})[_0x5013('0x1e')](function(){return BPromise['all'](_0x342925);})[_0x5013('0x1e')](function(){return _0x4ab8f4;})[_0x5013('0x1e')](respondWithResult(_0x154ba9,null))[_0x5013('0x41')](handleError(_0x154ba9,null));};exports[_0x5013('0x89')]=function(_0x346b91,_0x25f791,_0x725ca9){return db[_0x5013('0x2a')][_0x5013('0x46')]({'where':{'id':_0x346b91[_0x5013('0x43')]['id']}})[_0x5013('0x1e')](handleEntityNotFound(_0x25f791,null))[_0x5013('0x1e')](function(_0x14dcec){if(_0x14dcec){return _0x14dcec[_0x5013('0x89')](_0x346b91['query'][_0x5013('0x64')]);}})[_0x5013('0x1e')](function(_0x12c8e1){if(_0x12c8e1){return db[_0x5013('0x58')][_0x5013('0x1f')]({'where':{'ListId':_0x346b91['query'][_0x5013('0x64')],'CampaignId':_0x346b91['params']['id']}})[_0x5013('0x1e')](function(){return _0x12c8e1;});}})['then'](respondWithStatusCode(_0x25f791,null))['catch'](handleError(_0x25f791,null));};exports[_0x5013('0x8a')]=function(_0x4aa572,_0x40dfee,_0x28903f){var _0x4959ef={};var _0x297ef8={};var _0x440ad4;var _0x1cc22b;return db[_0x5013('0x2a')][_0x5013('0x55')]({'where':{'id':_0x4aa572[_0x5013('0x43')]['id']}})[_0x5013('0x1e')](handleEntityNotFound(_0x40dfee,null))[_0x5013('0x1e')](function(_0x4d9ba1){if(_0x4d9ba1){_0x440ad4=_0x4d9ba1;_0x297ef8[_0x5013('0x32')]=_[_0x5013('0x2f')](db['CmList'][_0x5013('0x56')]);_0x297ef8[_0x5013('0x2e')]=_[_0x5013('0x2f')](_0x4aa572[_0x5013('0x2e')]);_0x297ef8[_0x5013('0x30')]=_[_0x5013('0x31')](_0x297ef8[_0x5013('0x32')],_0x297ef8['query']);_0x4959ef[_0x5013('0x33')]=_[_0x5013('0x31')](_0x297ef8[_0x5013('0x32')],qs[_0x5013('0x34')](_0x4aa572['query'][_0x5013('0x34')]));_0x4959ef[_0x5013('0x33')]=_0x4959ef['attributes'][_0x5013('0x44')]?_0x4959ef['attributes']:_0x297ef8[_0x5013('0x32')];_0x4959ef[_0x5013('0x38')]=qs[_0x5013('0x39')](_0x4aa572[_0x5013('0x2e')]['sort']);_0x4959ef[_0x5013('0x3a')]=qs[_0x5013('0x30')](_[_0x5013('0x3b')](_0x4aa572[_0x5013('0x2e')],_0x297ef8['filters']));if(_0x4aa572[_0x5013('0x2e')][_0x5013('0x3c')]){_0x4959ef[_0x5013('0x3a')]=_[_0x5013('0x3d')](_0x4959ef[_0x5013('0x3a')],{'$or':_[_0x5013('0x29')](_0x4959ef['attributes'],function(_0xfda157){var _0x44f0f6={};_0x44f0f6[_0xfda157]={'$like':'%'+_0x4aa572[_0x5013('0x2e')]['filter']+'%'};return _0x44f0f6;})});}_0x4959ef=_['merge']({},_0x4959ef,_0x4aa572[_0x5013('0x3f')]);return _0x440ad4[_0x5013('0x8a')](_0x4959ef);}})[_0x5013('0x1e')](function(_0x2944b6){if(_0x2944b6){_0x1cc22b=_0x2944b6[_0x5013('0x44')];if(!_0x4aa572['query'][_0x5013('0x35')](_0x5013('0x36'))){_0x4959ef[_0x5013('0x37')]=qs[_0x5013('0x37')](_0x4aa572[_0x5013('0x2e')][_0x5013('0x37')]);_0x4959ef['offset']=qs[_0x5013('0x16')](_0x4aa572[_0x5013('0x2e')][_0x5013('0x16')]);}return _0x440ad4['getBlackLists'](_0x4959ef);}})[_0x5013('0x1e')](function(_0x817dc6){if(_0x817dc6){return _0x817dc6?{'count':_0x1cc22b,'rows':_0x817dc6}:null;}})[_0x5013('0x1e')](respondWithResult(_0x40dfee,null))[_0x5013('0x41')](handleError(_0x40dfee,null));};exports['addBlackLists']=function(_0x1efa9f,_0x570a45,_0x545a3a){var _0x28c4e3,_0x220ec5;var _0x154759=[];var _0x1c0b1f=moment()[_0x5013('0x63')](_0x5013('0x8b'));return db[_0x5013('0x2a')][_0x5013('0x46')]({'where':{'id':_0x1efa9f[_0x5013('0x43')]['id']}})[_0x5013('0x1e')](handleEntityNotFound(_0x570a45,null))[_0x5013('0x1e')](function(_0x53f1d5){if(_0x53f1d5){_0x220ec5=_0x53f1d5;return _0x53f1d5[_0x5013('0x8c')](_0x1efa9f[_0x5013('0x48')][_0x5013('0x64')],_[_0x5013('0x50')](_0x1efa9f[_0x5013('0x48')],['ids','id'])||{});}return null;})['spread'](function(_0x2ede3a){var _0x4660d0;var _0x5185d0;_0x28c4e3=_0x2ede3a||[];var _0x5949f2=[];if(_0x2ede3a){for(var _0x56329e=0x0;_0x56329e<_0x2ede3a[_0x5013('0x44')];_0x56329e+=0x1){var _0x591c7b=_0x2ede3a[_0x56329e]['get']({'plain':!![]});_0x4660d0=squel[_0x5013('0x67')]()[_0x5013('0x68')](_0x5013('0x8d'))[_0x5013('0x6a')]([_0x5013('0x6f'),_0x5013('0x6c'),_0x5013('0x6d'),_0x5013('0x57'),_0x5013('0x51'),_0x5013('0x52')],squel[_0x5013('0x6e')]()[_0x5013('0x70')](_0x5013('0x6f'),_0x5013('0x6f'))['field']('id',_0x5013('0x6c'))[_0x5013('0x70')](_0x591c7b[_0x5013('0x76')][_0x5013('0x72')](),_0x5013('0x6d'))[_0x5013('0x70')](_0x1efa9f[_0x5013('0x43')]['id'][_0x5013('0x72')](),_0x5013('0x57'))['field'](_0x5013('0x71'),'createdAt')[_0x5013('0x70')](_0x5013('0x71'),'updatedAt')[_0x5013('0x73')](_0x5013('0x7c'))[_0x5013('0x3a')]('deletedAt\x20IS\x20NULL')[_0x5013('0x3a')](_0x5013('0x75'),_0x591c7b[_0x5013('0x76')]['toString']())[_0x5013('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x5013('0x72')]();_0x5949f2['push'](db[_0x5013('0x87')][_0x5013('0x2e')](_0x4660d0));}return BPromise[_0x5013('0x88')](_0x5949f2);}})[_0x5013('0x1e')](function(){return _0x28c4e3;})['then'](respondWithResult(_0x570a45,null))[_0x5013('0x41')](handleError(_0x570a45,null));};exports[_0x5013('0x8e')]=function(_0x3d7658,_0x47a8d5,_0x5f283){return db[_0x5013('0x2a')]['find']({'where':{'id':_0x3d7658[_0x5013('0x43')]['id']}})[_0x5013('0x1e')](handleEntityNotFound(_0x47a8d5,null))[_0x5013('0x1e')](function(_0xe7604a){if(_0xe7604a){return _0xe7604a[_0x5013('0x8e')](_0x3d7658[_0x5013('0x2e')]['ids']);}})[_0x5013('0x1e')](function(_0x707d98){if(_0x707d98){return db[_0x5013('0x5f')]['destroy']({'where':{'ListId':_0x3d7658[_0x5013('0x2e')][_0x5013('0x64')],'CampaignId':_0x3d7658[_0x5013('0x43')]['id']}})[_0x5013('0x1e')](function(){return _0x707d98;});}})['then'](respondWithStatusCode(_0x47a8d5,null))[_0x5013('0x41')](handleError(_0x47a8d5,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index a8b45ab..d165e81 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(_0x4dca4f,_0x3d3989){var _0xb1f24e=function(_0x125f21){while(--_0x125f21){_0x4dca4f['push'](_0x4dca4f['shift']());}};_0xb1f24e(++_0x3d3989);}(_0x7a54,0x106));var _0x47a5=function(_0x427a8e,_0x3cc38c){_0x427a8e=_0x427a8e-0x0;var _0x695ce8=_0x7a54[_0x427a8e];return _0x695ce8;};'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 _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','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 f4b1d54..3559631 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 _0x032a=['model','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetCampaign','Campaign','findAll','options','where','attributes','limit','map','include'];(function(_0x431a2c,_0x26f944){var _0x3438ec=function(_0xaf6060){while(--_0xaf6060){_0x431a2c['push'](_0x431a2c['shift']());}};_0x3438ec(++_0x26f944);}(_0x032a,0xf0));var _0xa032=function(_0x1406c8,_0x40a801){_0x1406c8=_0x1406c8-0x0;var _0x3ec6f8=_0x032a[_0x1406c8];return _0x3ec6f8;};'use strict';var _=require('lodash');var util=require(_0xa032('0x0'));var moment=require('moment');var BPromise=require(_0xa032('0x1'));var rs=require(_0xa032('0x2'));var fs=require('fs');var Redis=require(_0xa032('0x3'));var db=require(_0xa032('0x4'))['db'];var utils=require(_0xa032('0x5'));var logger=require(_0xa032('0x6'))(_0xa032('0x7'));var config=require(_0xa032('0x8'));var jayson=require(_0xa032('0x9'));var client=jayson[_0xa032('0xa')][_0xa032('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40128a,_0x54275c,_0x616437){return new BPromise(function(_0x4a5d8e,_0x5d0744){return client[_0xa032('0xc')](_0x40128a,_0x616437)['then'](function(_0x18283a){logger[_0xa032('0xd')](_0xa032('0xe'),_0x54275c,_0xa032('0xf'));logger[_0xa032('0x10')]('Campaign,\x20%s,\x20%s,\x20%s',_0x54275c,_0xa032('0xf'),JSON[_0xa032('0x11')](_0x18283a));if(_0x18283a['error']){if(_0x18283a[_0xa032('0x12')][_0xa032('0x13')]===0x1f4){logger[_0xa032('0x12')](_0xa032('0xe'),_0x54275c,_0x18283a[_0xa032('0x12')]['message']);return _0x5d0744(_0x18283a[_0xa032('0x12')][_0xa032('0x14')]);}logger[_0xa032('0x12')](_0xa032('0xe'),_0x54275c,_0x18283a[_0xa032('0x12')][_0xa032('0x14')]);return _0x4a5d8e(_0x18283a[_0xa032('0x12')][_0xa032('0x14')]);}else{logger[_0xa032('0xd')](_0xa032('0xe'),_0x54275c,'request\x20sent');_0x4a5d8e(_0x18283a[_0xa032('0x15')][_0xa032('0x14')]);}})[_0xa032('0x16')](function(_0x2caacd){logger[_0xa032('0x12')](_0xa032('0xe'),_0x54275c,_0x2caacd);_0x5d0744(_0x2caacd);});});}exports[_0xa032('0x17')]=function(_0x577406){var _0xff6817=this;return new Promise(function(_0x54fba7,_0x1d8cf4){return db[_0xa032('0x18')][_0xa032('0x19')]({'raw':_0x577406['options']?_0x577406[_0xa032('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x577406[_0xa032('0x1a')]?_0x577406[_0xa032('0x1a')][_0xa032('0x1b')]||null:null,'attributes':_0x577406[_0xa032('0x1a')]?_0x577406[_0xa032('0x1a')][_0xa032('0x1c')]||null:null,'limit':_0x577406['options']?_0x577406[_0xa032('0x1a')][_0xa032('0x1d')]||null:null,'include':_0x577406['options']?_0x577406[_0xa032('0x1a')]['include']?_[_0xa032('0x1e')](_0x577406['options'][_0xa032('0x1f')],function(_0x54cb71){return{'model':db[_0x54cb71[_0xa032('0x20')]],'as':_0x54cb71['as'],'attributes':_0x54cb71[_0xa032('0x1c')],'include':_0x54cb71['include']?_[_0xa032('0x1e')](_0x54cb71[_0xa032('0x1f')],function(_0x49be4a){return{'model':db[_0x49be4a['model']],'as':_0x49be4a['as'],'attributes':_0x49be4a[_0xa032('0x1c')],'include':_0x49be4a[_0xa032('0x1f')]?_[_0xa032('0x1e')](_0x49be4a['include'],function(_0x5c8fc4){return{'model':db[_0x5c8fc4[_0xa032('0x20')]],'as':_0x5c8fc4['as'],'attributes':_0x5c8fc4[_0xa032('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa032('0x21')](function(_0x32d896){logger['info'](_0xa032('0x17'),_0x577406);logger[_0xa032('0x10')](_0xa032('0x17'),_0x577406,JSON[_0xa032('0x11')](_0x32d896));_0x54fba7(_0x32d896);})[_0xa032('0x16')](function(_0x3b0161){logger['error'](_0xa032('0x17'),_0x3b0161[_0xa032('0x14')],_0x577406);_0x1d8cf4(_0xff6817[_0xa032('0x12')](0x1f4,_0x3b0161['message']));});});}; \ No newline at end of file +var _0x177a=['include','model','GetCampaign','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','raw','attributes','limit','map'];(function(_0x2c6575,_0x13c4ea){var _0x2c12a0=function(_0x2d6802){while(--_0x2d6802){_0x2c6575['push'](_0x2c6575['shift']());}};_0x2c12a0(++_0x13c4ea);}(_0x177a,0xdd));var _0xa177=function(_0x973559,_0x13866c){_0x973559=_0x973559-0x0;var _0x885b19=_0x177a[_0x973559];return _0x885b19;};'use strict';var _=require(_0xa177('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa177('0x1'));var rs=require(_0xa177('0x2'));var fs=require('fs');var Redis=require(_0xa177('0x3'));var db=require(_0xa177('0x4'))['db'];var utils=require(_0xa177('0x5'));var logger=require(_0xa177('0x6'))('rpc');var config=require(_0xa177('0x7'));var jayson=require(_0xa177('0x8'));var client=jayson[_0xa177('0x9')][_0xa177('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34b6a7,_0xb27b2,_0x331b53){return new BPromise(function(_0x11a535,_0x55bf0f){return client[_0xa177('0xb')](_0x34b6a7,_0x331b53)['then'](function(_0x2a8a12){logger[_0xa177('0xc')](_0xa177('0xd'),_0xb27b2,_0xa177('0xe'));logger[_0xa177('0xf')](_0xa177('0x10'),_0xb27b2,_0xa177('0xe'),JSON['stringify'](_0x2a8a12));if(_0x2a8a12[_0xa177('0x11')]){if(_0x2a8a12[_0xa177('0x11')][_0xa177('0x12')]===0x1f4){logger[_0xa177('0x11')](_0xa177('0xd'),_0xb27b2,_0x2a8a12[_0xa177('0x11')][_0xa177('0x13')]);return _0x55bf0f(_0x2a8a12['error']['message']);}logger[_0xa177('0x11')](_0xa177('0xd'),_0xb27b2,_0x2a8a12[_0xa177('0x11')][_0xa177('0x13')]);return _0x11a535(_0x2a8a12[_0xa177('0x11')][_0xa177('0x13')]);}else{logger[_0xa177('0xc')](_0xa177('0xd'),_0xb27b2,_0xa177('0xe'));_0x11a535(_0x2a8a12[_0xa177('0x14')][_0xa177('0x13')]);}})[_0xa177('0x15')](function(_0x5445da){logger[_0xa177('0x11')](_0xa177('0xd'),_0xb27b2,_0x5445da);_0x55bf0f(_0x5445da);});});}exports['GetCampaign']=function(_0x5e6ae3){var _0x2f30d4=this;return new Promise(function(_0x11b060,_0x4042b2){return db['Campaign']['findAll']({'raw':_0x5e6ae3['options']?_0x5e6ae3[_0xa177('0x16')][_0xa177('0x17')]===undefined?!![]:![]:!![],'where':_0x5e6ae3[_0xa177('0x16')]?_0x5e6ae3[_0xa177('0x16')]['where']||null:null,'attributes':_0x5e6ae3[_0xa177('0x16')]?_0x5e6ae3['options'][_0xa177('0x18')]||null:null,'limit':_0x5e6ae3['options']?_0x5e6ae3[_0xa177('0x16')][_0xa177('0x19')]||null:null,'include':_0x5e6ae3[_0xa177('0x16')]?_0x5e6ae3[_0xa177('0x16')]['include']?_[_0xa177('0x1a')](_0x5e6ae3[_0xa177('0x16')][_0xa177('0x1b')],function(_0x4bc686){return{'model':db[_0x4bc686['model']],'as':_0x4bc686['as'],'attributes':_0x4bc686['attributes'],'include':_0x4bc686['include']?_[_0xa177('0x1a')](_0x4bc686[_0xa177('0x1b')],function(_0x1cf775){return{'model':db[_0x1cf775[_0xa177('0x1c')]],'as':_0x1cf775['as'],'attributes':_0x1cf775[_0xa177('0x18')],'include':_0x1cf775['include']?_[_0xa177('0x1a')](_0x1cf775[_0xa177('0x1b')],function(_0x479587){return{'model':db[_0x479587['model']],'as':_0x479587['as'],'attributes':_0x479587[_0xa177('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55f460){logger['info'](_0xa177('0x1d'),_0x5e6ae3);logger['debug'](_0xa177('0x1d'),_0x5e6ae3,JSON[_0xa177('0x1e')](_0x55f460));_0x11b060(_0x55f460);})[_0xa177('0x15')](function(_0x5f20d4){logger[_0xa177('0x11')](_0xa177('0x1d'),_0x5f20d4['message'],_0x5e6ae3);_0x4042b2(_0x2f30d4[_0xa177('0x11')](0x1f4,_0x5f20d4[_0xa177('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 105f0ec..9691d96 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 _0x201c=['/:id','update','delete','destroy','removeLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','isAuthenticated','index','get','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','addBlackLists'];(function(_0x374598,_0x3f796f){var _0x5dffde=function(_0x514088){while(--_0x514088){_0x374598['push'](_0x374598['shift']());}};_0x5dffde(++_0x3f796f);}(_0x201c,0x17a));var _0xc201=function(_0x588da0,_0x2ff6da){_0x588da0=_0x588da0-0x0;var _0x5b6725=_0x201c[_0x588da0];return _0x5b6725;};'use strict';var multer=require(_0xc201('0x0'));var util=require(_0xc201('0x1'));var path=require(_0xc201('0x2'));var timeout=require(_0xc201('0x3'));var express=require(_0xc201('0x4'));var router=express[_0xc201('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc201('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc201('0x7'));var controller=require(_0xc201('0x8'));router['get']('/',auth[_0xc201('0x9')](),controller[_0xc201('0xa')]);router['get']('/:id',auth[_0xc201('0x9')](),controller['show']);router[_0xc201('0xb')]('/:id/hoppers',auth[_0xc201('0x9')](),controller['getHoppers']);router[_0xc201('0xb')]('/:id/hopper_histories',auth[_0xc201('0x9')](),controller[_0xc201('0xc')]);router[_0xc201('0xb')](_0xc201('0xd'),auth[_0xc201('0x9')](),controller[_0xc201('0xe')]);router[_0xc201('0xb')]('/:id/hopper_black',auth[_0xc201('0x9')](),controller[_0xc201('0xf')]);router[_0xc201('0xb')](_0xc201('0x10'),auth[_0xc201('0x9')](),controller['getLists']);router[_0xc201('0xb')](_0xc201('0x11'),auth[_0xc201('0x9')](),controller[_0xc201('0x12')]);router[_0xc201('0x13')]('/',auth[_0xc201('0x9')](),controller[_0xc201('0x14')]);router[_0xc201('0x13')](_0xc201('0x15'),auth[_0xc201('0x9')](),controller[_0xc201('0x16')]);router['post'](_0xc201('0x10'),auth[_0xc201('0x9')](),controller[_0xc201('0x17')]);router[_0xc201('0x13')]('/:id/blacklists',auth[_0xc201('0x9')](),controller[_0xc201('0x18')]);router['put'](_0xc201('0x19'),auth[_0xc201('0x9')](),controller[_0xc201('0x1a')]);router[_0xc201('0x1b')](_0xc201('0x19'),auth['isAuthenticated'](),controller[_0xc201('0x1c')]);router['delete']('/:id/lists',auth['isAuthenticated'](),controller[_0xc201('0x1d')]);router[_0xc201('0x1b')](_0xc201('0x11'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xc201('0x1e')]=router; \ No newline at end of file +var _0x9f47=['addBlackLists','put','/:id','update','delete','destroy','removeLists','removeBlackLists','exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','./campaign.controller','get','index','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/blacklists','post','/:id/clone','clone','/:id/lists'];(function(_0x213322,_0x3b6b24){var _0x1f66bb=function(_0x1907e8){while(--_0x1907e8){_0x213322['push'](_0x213322['shift']());}};_0x1f66bb(++_0x3b6b24);}(_0x9f47,0x1e9));var _0x79f4=function(_0x5162dd,_0x5a2734){_0x5162dd=_0x5162dd-0x0;var _0x307114=_0x9f47[_0x5162dd];return _0x307114;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x79f4('0x0'));var timeout=require(_0x79f4('0x1'));var express=require(_0x79f4('0x2'));var router=express[_0x79f4('0x3')]();var fs_extra=require(_0x79f4('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x79f4('0x5'));var controller=require(_0x79f4('0x6'));router[_0x79f4('0x7')]('/',auth['isAuthenticated'](),controller[_0x79f4('0x8')]);router[_0x79f4('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x79f4('0x7')](_0x79f4('0x9'),auth[_0x79f4('0xa')](),controller[_0x79f4('0xb')]);router[_0x79f4('0x7')](_0x79f4('0xc'),auth[_0x79f4('0xa')](),controller['getHopperHistories']);router['get'](_0x79f4('0xd'),auth[_0x79f4('0xa')](),controller[_0x79f4('0xe')]);router[_0x79f4('0x7')]('/:id/hopper_black',auth[_0x79f4('0xa')](),controller[_0x79f4('0xf')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router[_0x79f4('0x7')](_0x79f4('0x10'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x79f4('0x11')]('/',auth[_0x79f4('0xa')](),controller['create']);router[_0x79f4('0x11')](_0x79f4('0x12'),auth['isAuthenticated'](),controller[_0x79f4('0x13')]);router['post'](_0x79f4('0x14'),auth[_0x79f4('0xa')](),controller['addLists']);router[_0x79f4('0x11')]('/:id/blacklists',auth[_0x79f4('0xa')](),controller[_0x79f4('0x15')]);router[_0x79f4('0x16')](_0x79f4('0x17'),auth[_0x79f4('0xa')](),controller[_0x79f4('0x18')]);router[_0x79f4('0x19')](_0x79f4('0x17'),auth[_0x79f4('0xa')](),controller[_0x79f4('0x1a')]);router[_0x79f4('0x19')]('/:id/lists',auth[_0x79f4('0xa')](),controller[_0x79f4('0x1b')]);router[_0x79f4('0x19')](_0x79f4('0x10'),auth[_0x79f4('0xa')](),controller[_0x79f4('0x1c')]);module[_0x79f4('0x1d')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index dea02d2..5332520 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 _0xabd9=['getDataValue','exports','STRING','VIRTUAL'];(function(_0x44e62b,_0x2736f9){var _0xa4d07a=function(_0x5ab22f){while(--_0x5ab22f){_0x44e62b['push'](_0x44e62b['shift']());}};_0xa4d07a(++_0x2736f9);}(_0xabd9,0xed));var _0x9abd=function(_0xddfc8,_0x28f5a2){_0xddfc8=_0xddfc8-0x0;var _0x3a44a0=_0xabd9[_0xddfc8];return _0x3a44a0;};'use strict';var Sequelize=require('sequelize');module[_0x9abd('0x0')]={'key':{'type':Sequelize[_0x9abd('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x9abd('0x1')]},'name':{'type':Sequelize[_0x9abd('0x2')],'get':function(){return this[_0x9abd('0x3')]('key');}}}; \ No newline at end of file +var _0xb236=['key','exports','STRING','TEXT','VIRTUAL'];(function(_0x3bd0dc,_0xf35688){var _0x4d9f39=function(_0x56a099){while(--_0x56a099){_0x3bd0dc['push'](_0x3bd0dc['shift']());}};_0x4d9f39(++_0xf35688);}(_0xb236,0x10a));var _0x6b23=function(_0x278470,_0x16422e){_0x278470=_0x278470-0x0;var _0x2ea89a=_0xb236[_0x278470];return _0x2ea89a;};'use strict';var Sequelize=require('sequelize');module[_0x6b23('0x0')]={'key':{'type':Sequelize[_0x6b23('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x6b23('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x6b23('0x1')]},'name':{'type':Sequelize[_0x6b23('0x3')],'get':function(){return this['getDataValue'](_0x6b23('0x4'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 14b6dc3..d831d99 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 _0x0e04=['userProfileId','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','save','destroy','then','get','UserProfileResource','sendStatus','stack','send','CannedAnswer','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','includeAll','rows','catch','params','include','options','update','body','find','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CannedAnswers'];(function(_0x607b8f,_0x4e844b){var _0x400b16=function(_0x2bae9c){while(--_0x2bae9c){_0x607b8f['push'](_0x607b8f['shift']());}};_0x400b16(++_0x4e844b);}(_0x0e04,0x1b1));var _0x40e0=function(_0xa7a66f,_0x45c3b7){_0xa7a66f=_0xa7a66f-0x0;var _0x149ec7=_0x0e04[_0xa7a66f];return _0x149ec7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x40e0('0x0'));var zipdir=require(_0x40e0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x40e0('0x2'));var BPromise=require(_0x40e0('0x3'));var Mustache=require(_0x40e0('0x4'));var util=require(_0x40e0('0x5'));var path=require(_0x40e0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x40e0('0x7'));var fs=require('fs');var fs_extra=require(_0x40e0('0x8'));var _=require(_0x40e0('0x9'));var squel=require(_0x40e0('0xa'));var crypto=require(_0x40e0('0xb'));var jsforce=require(_0x40e0('0xc'));var deskjs=require(_0x40e0('0xd'));var toCsv=require(_0x40e0('0xe'));var querystring=require(_0x40e0('0xf'));var Papa=require(_0x40e0('0x10'));var Redis=require(_0x40e0('0x11'));var authService=require(_0x40e0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x40e0('0x13'));var hardwareService=require(_0x40e0('0x14'));var logger=require(_0x40e0('0x15'))('api');var utils=require(_0x40e0('0x16'));var config=require(_0x40e0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x40e0('0x18'))['db'];function respondWithStatusCode(_0x43c97d,_0x39708b){_0x39708b=_0x39708b||0xcc;return function(_0xf3c7c0){if(_0xf3c7c0){return _0x43c97d['sendStatus'](_0x39708b);}return _0x43c97d[_0x40e0('0x19')](_0x39708b)[_0x40e0('0x1a')]();};}function respondWithResult(_0x12c8bd,_0x18ba33){_0x18ba33=_0x18ba33||0xc8;return function(_0x2c0a7d){if(_0x2c0a7d){return _0x12c8bd[_0x40e0('0x19')](_0x18ba33)['json'](_0x2c0a7d);}};}function respondWithFilteredResult(_0x52e88a,_0x5eb77f){return function(_0x1bf1b7){if(_0x1bf1b7){var _0x4dbf56=typeof _0x5eb77f[_0x40e0('0x1b')]==='undefined'&&typeof _0x5eb77f['limit']===_0x40e0('0x1c');var _0x1f30f7=_0x1bf1b7[_0x40e0('0x1d')];var _0x5a3777=_0x4dbf56?0x0:_0x5eb77f[_0x40e0('0x1b')];var _0x1f4b66=_0x4dbf56?_0x1bf1b7[_0x40e0('0x1d')]:_0x5eb77f[_0x40e0('0x1b')]+_0x5eb77f[_0x40e0('0x1e')];var _0x46f0bc;if(_0x1f4b66>=_0x1f30f7){_0x1f4b66=_0x1f30f7;_0x46f0bc=0xc8;}else{_0x46f0bc=0xce;}_0x52e88a['status'](_0x46f0bc);return _0x52e88a[_0x40e0('0x1f')]('Content-Range',_0x5a3777+'-'+_0x1f4b66+'/'+_0x1f30f7)[_0x40e0('0x20')](_0x1bf1b7);}return null;};}function patchUpdates(_0x2643dd){return function(_0x260140){try{jsonpatch[_0x40e0('0x21')](_0x260140,_0x2643dd,!![]);}catch(_0x47ee47){return BPromise[_0x40e0('0x22')](_0x47ee47);}return _0x260140[_0x40e0('0x23')]();};}function saveUpdates(_0x1d8376,_0x58855d){return function(_0x2c2259){if(_0x2c2259){return _0x2c2259['update'](_0x1d8376)['then'](function(_0xcef69f){return _0xcef69f;});}return null;};}function removeEntity(_0x3b141b,_0x42c50d){return function(_0x41dca0){if(_0x41dca0){return _0x41dca0[_0x40e0('0x24')]()[_0x40e0('0x25')](function(){var _0x5853eb=_0x41dca0[_0x40e0('0x26')]({'plain':!![]});var _0x2fe477='CannedAnswers';return db[_0x40e0('0x27')]['destroy']({'where':{'type':_0x2fe477,'resourceId':_0x5853eb['id']}})[_0x40e0('0x25')](function(){return _0x41dca0;});})[_0x40e0('0x25')](function(){_0x3b141b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aaa2b,_0xe27310){return function(_0x45dcd2){if(!_0x45dcd2){_0x2aaa2b[_0x40e0('0x28')](0x194);}return _0x45dcd2;};}function handleError(_0x482c99,_0x57b40e){_0x57b40e=_0x57b40e||0x1f4;return function(_0x5911d7){logger['error'](_0x5911d7[_0x40e0('0x29')]);if(_0x5911d7['name']){delete _0x5911d7['name'];}_0x482c99[_0x40e0('0x19')](_0x57b40e)[_0x40e0('0x2a')](_0x5911d7);};}exports['index']=function(_0x2895a9,_0x78c530){var _0x24fad8={},_0x5b8243={},_0x32c7b9={'count':0x0,'rows':[]};var _0x37b88d=_['map'](db[_0x40e0('0x2b')][_0x40e0('0x2c')],function(_0x1eaa4b){return{'name':_0x1eaa4b[_0x40e0('0x2d')],'type':_0x1eaa4b[_0x40e0('0x2e')][_0x40e0('0x2f')]};});_0x5b8243[_0x40e0('0x30')]=_[_0x40e0('0x31')](_0x37b88d,'name');_0x5b8243[_0x40e0('0x32')]=_[_0x40e0('0x33')](_0x2895a9['query']);_0x5b8243[_0x40e0('0x34')]=_[_0x40e0('0x35')](_0x5b8243[_0x40e0('0x30')],_0x5b8243[_0x40e0('0x32')]);_0x24fad8[_0x40e0('0x36')]=_['intersection'](_0x5b8243[_0x40e0('0x30')],qs['fields'](_0x2895a9[_0x40e0('0x32')][_0x40e0('0x37')]));_0x24fad8[_0x40e0('0x36')]=_0x24fad8[_0x40e0('0x36')][_0x40e0('0x38')]?_0x24fad8['attributes']:_0x5b8243[_0x40e0('0x30')];if(!_0x2895a9['query'][_0x40e0('0x39')]('nolimit')){_0x24fad8['limit']=qs['limit'](_0x2895a9[_0x40e0('0x32')][_0x40e0('0x1e')]);_0x24fad8[_0x40e0('0x1b')]=qs[_0x40e0('0x1b')](_0x2895a9['query'][_0x40e0('0x1b')]);}_0x24fad8['order']=qs[_0x40e0('0x3a')](_0x2895a9[_0x40e0('0x32')][_0x40e0('0x3a')]);_0x24fad8[_0x40e0('0x3b')]=qs[_0x40e0('0x34')](_['pick'](_0x2895a9[_0x40e0('0x32')],_0x5b8243[_0x40e0('0x34')]),_0x37b88d);if(_0x2895a9['query'][_0x40e0('0x3c')]){_0x24fad8[_0x40e0('0x3b')]=_[_0x40e0('0x3d')](_0x24fad8[_0x40e0('0x3b')],{'$or':[{'key':{'$like':'%'+_0x2895a9[_0x40e0('0x32')][_0x40e0('0x3c')]+'%'}},{'value':{'$like':'%'+_0x2895a9[_0x40e0('0x32')][_0x40e0('0x3c')]+'%'}}]});}_0x24fad8=_[_0x40e0('0x3d')]({},_0x24fad8,_0x2895a9['options']);var _0x3a201d={'where':_0x24fad8[_0x40e0('0x3b')]};return db[_0x40e0('0x2b')]['count'](_0x3a201d)[_0x40e0('0x25')](function(_0x4f150f){_0x32c7b9['count']=_0x4f150f;if(_0x2895a9[_0x40e0('0x32')][_0x40e0('0x3e')]){_0x24fad8['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x24fad8);})[_0x40e0('0x25')](function(_0x26dd99){_0x32c7b9[_0x40e0('0x3f')]=_0x26dd99;return _0x32c7b9;})[_0x40e0('0x25')](respondWithFilteredResult(_0x78c530,_0x24fad8))[_0x40e0('0x40')](handleError(_0x78c530,null));};exports['show']=function(_0x475b74,_0x1b98f2){var _0x54c92d={'raw':!![],'where':{'id':_0x475b74[_0x40e0('0x41')]['id']}},_0xfed8d0={};_0xfed8d0[_0x40e0('0x30')]=_['keys'](db[_0x40e0('0x2b')][_0x40e0('0x2c')]);_0xfed8d0[_0x40e0('0x32')]=_[_0x40e0('0x33')](_0x475b74[_0x40e0('0x32')]);_0xfed8d0['filters']=_[_0x40e0('0x35')](_0xfed8d0[_0x40e0('0x30')],_0xfed8d0[_0x40e0('0x32')]);_0x54c92d['attributes']=_['intersection'](_0xfed8d0[_0x40e0('0x30')],qs[_0x40e0('0x37')](_0x475b74['query'][_0x40e0('0x37')]));_0x54c92d[_0x40e0('0x36')]=_0x54c92d[_0x40e0('0x36')][_0x40e0('0x38')]?_0x54c92d[_0x40e0('0x36')]:_0xfed8d0[_0x40e0('0x30')];if(_0x475b74[_0x40e0('0x32')][_0x40e0('0x3e')]){_0x54c92d[_0x40e0('0x42')]=[{'all':!![]}];}_0x54c92d=_[_0x40e0('0x3d')]({},_0x54c92d,_0x475b74[_0x40e0('0x43')]);return db[_0x40e0('0x2b')]['find'](_0x54c92d)[_0x40e0('0x25')](handleEntityNotFound(_0x1b98f2,null))[_0x40e0('0x25')](respondWithResult(_0x1b98f2,null))[_0x40e0('0x40')](handleError(_0x1b98f2,null));};exports[_0x40e0('0x44')]=function(_0x4dda25,_0x2c7604){if(_0x4dda25[_0x40e0('0x45')]['id']){delete _0x4dda25[_0x40e0('0x45')]['id'];}return db[_0x40e0('0x2b')][_0x40e0('0x46')]({'where':{'id':_0x4dda25[_0x40e0('0x41')]['id']}})[_0x40e0('0x25')](handleEntityNotFound(_0x2c7604,null))[_0x40e0('0x25')](saveUpdates(_0x4dda25[_0x40e0('0x45')],null))['then'](respondWithResult(_0x2c7604,null))['catch'](handleError(_0x2c7604,null));};exports[_0x40e0('0x24')]=function(_0x2ca7a7,_0x2cca2d){return db[_0x40e0('0x2b')][_0x40e0('0x46')]({'where':{'id':_0x2ca7a7['params']['id']}})[_0x40e0('0x25')](handleEntityNotFound(_0x2cca2d,null))['then'](removeEntity(_0x2cca2d,null))['catch'](handleError(_0x2cca2d,null));};exports['create']=function(_0x4d593b,_0x11669b){var _0x318d23={'key':_0x4d593b[_0x40e0('0x45')][_0x40e0('0x2f')]};if(_0x4d593b[_0x40e0('0x45')][_0x40e0('0x47')]){_0x318d23['MailAccountId']=_0x4d593b[_0x40e0('0x45')][_0x40e0('0x47')];}else if(_0x4d593b[_0x40e0('0x45')][_0x40e0('0x48')]){_0x318d23[_0x40e0('0x48')]=_0x4d593b['body'][_0x40e0('0x48')];}else if(_0x4d593b['body'][_0x40e0('0x49')]){_0x318d23['OpenchannelAccountId']=_0x4d593b[_0x40e0('0x45')][_0x40e0('0x49')];}else if(_0x4d593b['body']['ChatWebsiteId']){_0x318d23[_0x40e0('0x4a')]=_0x4d593b['body'][_0x40e0('0x4a')];}return db[_0x40e0('0x2b')][_0x40e0('0x46')]({'where':_0x318d23})[_0x40e0('0x25')](function(_0x1df2e4){if(_0x1df2e4){throw new db[(_0x40e0('0x4b'))][(_0x40e0('0x4c'))](_0x40e0('0x4d'));}return db[_0x40e0('0x2b')][_0x40e0('0x4e')](_0x4d593b[_0x40e0('0x45')]);})['then'](function(_0x584139){var _0x5b4816=_0x4d593b[_0x40e0('0x4f')][_0x40e0('0x26')]({'plain':!![]});if(!_0x5b4816)throw new Error(_0x40e0('0x50'));if(_0x5b4816[_0x40e0('0x51')]===_0x40e0('0x4f')){var _0x4b73c9=_0x584139['get']({'plain':!![]});return db['UserProfileSection'][_0x40e0('0x46')]({'where':{'name':_0x40e0('0x52'),'userProfileId':_0x5b4816[_0x40e0('0x53')]},'raw':!![]})['then'](function(_0x433908){if(_0x433908&&_0x433908['autoAssociation']===0x0){return db[_0x40e0('0x27')][_0x40e0('0x4e')]({'name':_0x4b73c9[_0x40e0('0x54')],'resourceId':_0x4b73c9['id'],'type':_0x433908[_0x40e0('0x54')],'sectionId':_0x433908['id']},{})['then'](function(){return _0x584139;});}else{return _0x584139;}})[_0x40e0('0x40')](function(_0x5343ea){logger['error'](_0x40e0('0x55'),_0x5343ea);throw _0x5343ea;});}return _0x584139;})[_0x40e0('0x25')](respondWithResult(_0x11669b,0xc9))['catch'](handleError(_0x11669b,null));}; \ No newline at end of file +var _0xbc5b=['findAll','rows','catch','show','params','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','index','CannedAnswer','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x41d80f,_0x32841d){var _0x317fe6=function(_0x4011a8){while(--_0x4011a8){_0x41d80f['push'](_0x41d80f['shift']());}};_0x317fe6(++_0x32841d);}(_0xbc5b,0x124));var _0xbbc5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbc5b[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0xbbc5('0x0'));var rimraf=require(_0xbbc5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbc5('0x2'));var rp=require(_0xbbc5('0x3'));var moment=require(_0xbbc5('0x4'));var BPromise=require(_0xbbc5('0x5'));var Mustache=require('mustache');var util=require(_0xbbc5('0x6'));var path=require('path');var sox=require(_0xbbc5('0x7'));var csv=require(_0xbbc5('0x8'));var ejs=require(_0xbbc5('0x9'));var fs=require('fs');var fs_extra=require(_0xbbc5('0xa'));var _=require(_0xbbc5('0xb'));var squel=require(_0xbbc5('0xc'));var crypto=require(_0xbbc5('0xd'));var jsforce=require(_0xbbc5('0xe'));var deskjs=require(_0xbbc5('0xf'));var toCsv=require(_0xbbc5('0x8'));var querystring=require(_0xbbc5('0x10'));var Papa=require('papaparse');var Redis=require(_0xbbc5('0x11'));var authService=require(_0xbbc5('0x12'));var qs=require(_0xbbc5('0x13'));var as=require(_0xbbc5('0x14'));var hardwareService=require(_0xbbc5('0x15'));var logger=require(_0xbbc5('0x16'))(_0xbbc5('0x17'));var utils=require(_0xbbc5('0x18'));var config=require(_0xbbc5('0x19'));var licenseUtil=require(_0xbbc5('0x1a'));var db=require(_0xbbc5('0x1b'))['db'];function respondWithStatusCode(_0x18907d,_0x3123e1){_0x3123e1=_0x3123e1||0xcc;return function(_0x1b0168){if(_0x1b0168){return _0x18907d[_0xbbc5('0x1c')](_0x3123e1);}return _0x18907d[_0xbbc5('0x1d')](_0x3123e1)[_0xbbc5('0x1e')]();};}function respondWithResult(_0x226e4b,_0x2c6214){_0x2c6214=_0x2c6214||0xc8;return function(_0x368600){if(_0x368600){return _0x226e4b[_0xbbc5('0x1d')](_0x2c6214)[_0xbbc5('0x1f')](_0x368600);}};}function respondWithFilteredResult(_0x18c243,_0x43ec18){return function(_0x137b28){if(_0x137b28){var _0x2ca92a=typeof _0x43ec18[_0xbbc5('0x20')]===_0xbbc5('0x21')&&typeof _0x43ec18[_0xbbc5('0x22')]===_0xbbc5('0x21');var _0x2153ca=_0x137b28[_0xbbc5('0x23')];var _0x534b43=_0x2ca92a?0x0:_0x43ec18[_0xbbc5('0x20')];var _0x290a12=_0x2ca92a?_0x137b28[_0xbbc5('0x23')]:_0x43ec18[_0xbbc5('0x20')]+_0x43ec18[_0xbbc5('0x22')];var _0x163e45;if(_0x290a12>=_0x2153ca){_0x290a12=_0x2153ca;_0x163e45=0xc8;}else{_0x163e45=0xce;}_0x18c243[_0xbbc5('0x1d')](_0x163e45);return _0x18c243[_0xbbc5('0x24')]('Content-Range',_0x534b43+'-'+_0x290a12+'/'+_0x2153ca)['json'](_0x137b28);}return null;};}function patchUpdates(_0x38c1b7){return function(_0x34349e){try{jsonpatch[_0xbbc5('0x25')](_0x34349e,_0x38c1b7,!![]);}catch(_0x14fc91){return BPromise[_0xbbc5('0x26')](_0x14fc91);}return _0x34349e[_0xbbc5('0x27')]();};}function saveUpdates(_0x283976,_0xc0b83d){return function(_0x552867){if(_0x552867){return _0x552867[_0xbbc5('0x28')](_0x283976)[_0xbbc5('0x29')](function(_0x1eb76e){return _0x1eb76e;});}return null;};}function removeEntity(_0x4bb99e,_0x1d58b1){return function(_0x6ec799){if(_0x6ec799){return _0x6ec799[_0xbbc5('0x2a')]()[_0xbbc5('0x29')](function(){var _0x59c07b=_0x6ec799[_0xbbc5('0x2b')]({'plain':!![]});var _0x68af89=_0xbbc5('0x2c');return db[_0xbbc5('0x2d')][_0xbbc5('0x2a')]({'where':{'type':_0x68af89,'resourceId':_0x59c07b['id']}})[_0xbbc5('0x29')](function(){return _0x6ec799;});})['then'](function(){_0x4bb99e[_0xbbc5('0x1d')](0xcc)[_0xbbc5('0x1e')]();});}};}function handleEntityNotFound(_0x4b6390,_0x56a1d7){return function(_0xfc6b5e){if(!_0xfc6b5e){_0x4b6390['sendStatus'](0x194);}return _0xfc6b5e;};}function handleError(_0x111819,_0x2f3121){_0x2f3121=_0x2f3121||0x1f4;return function(_0x1720a4){logger[_0xbbc5('0x2e')](_0x1720a4[_0xbbc5('0x2f')]);if(_0x1720a4[_0xbbc5('0x30')]){delete _0x1720a4[_0xbbc5('0x30')];}_0x111819[_0xbbc5('0x1d')](_0x2f3121)[_0xbbc5('0x31')](_0x1720a4);};}exports[_0xbbc5('0x32')]=function(_0xe92729,_0x5e33ba){var _0x4ed989={},_0x3440e2={},_0x2293cb={'count':0x0,'rows':[]};var _0x1eb990=_['map'](db[_0xbbc5('0x33')][_0xbbc5('0x34')],function(_0x3c262f){return{'name':_0x3c262f['fieldName'],'type':_0x3c262f[_0xbbc5('0x35')][_0xbbc5('0x36')]};});_0x3440e2['model']=_[_0xbbc5('0x37')](_0x1eb990,_0xbbc5('0x30'));_0x3440e2[_0xbbc5('0x38')]=_[_0xbbc5('0x39')](_0xe92729['query']);_0x3440e2[_0xbbc5('0x3a')]=_[_0xbbc5('0x3b')](_0x3440e2[_0xbbc5('0x3c')],_0x3440e2[_0xbbc5('0x38')]);_0x4ed989['attributes']=_[_0xbbc5('0x3b')](_0x3440e2[_0xbbc5('0x3c')],qs[_0xbbc5('0x3d')](_0xe92729[_0xbbc5('0x38')][_0xbbc5('0x3d')]));_0x4ed989[_0xbbc5('0x3e')]=_0x4ed989[_0xbbc5('0x3e')]['length']?_0x4ed989[_0xbbc5('0x3e')]:_0x3440e2[_0xbbc5('0x3c')];if(!_0xe92729['query']['hasOwnProperty']('nolimit')){_0x4ed989[_0xbbc5('0x22')]=qs[_0xbbc5('0x22')](_0xe92729[_0xbbc5('0x38')]['limit']);_0x4ed989[_0xbbc5('0x20')]=qs[_0xbbc5('0x20')](_0xe92729[_0xbbc5('0x38')][_0xbbc5('0x20')]);}_0x4ed989[_0xbbc5('0x3f')]=qs['sort'](_0xe92729[_0xbbc5('0x38')][_0xbbc5('0x40')]);_0x4ed989[_0xbbc5('0x41')]=qs[_0xbbc5('0x3a')](_[_0xbbc5('0x42')](_0xe92729[_0xbbc5('0x38')],_0x3440e2[_0xbbc5('0x3a')]),_0x1eb990);if(_0xe92729[_0xbbc5('0x38')][_0xbbc5('0x43')]){_0x4ed989[_0xbbc5('0x41')]=_['merge'](_0x4ed989[_0xbbc5('0x41')],{'$or':[{'key':{'$like':'%'+_0xe92729['query'][_0xbbc5('0x43')]+'%'}},{'value':{'$like':'%'+_0xe92729[_0xbbc5('0x38')][_0xbbc5('0x43')]+'%'}}]});}_0x4ed989=_[_0xbbc5('0x44')]({},_0x4ed989,_0xe92729[_0xbbc5('0x45')]);var _0x53a898={'where':_0x4ed989['where']};return db[_0xbbc5('0x33')]['count'](_0x53a898)[_0xbbc5('0x29')](function(_0x44d961){_0x2293cb['count']=_0x44d961;if(_0xe92729[_0xbbc5('0x38')][_0xbbc5('0x46')]){_0x4ed989[_0xbbc5('0x47')]=[{'all':!![]}];}return db['CannedAnswer'][_0xbbc5('0x48')](_0x4ed989);})[_0xbbc5('0x29')](function(_0x542e28){_0x2293cb[_0xbbc5('0x49')]=_0x542e28;return _0x2293cb;})['then'](respondWithFilteredResult(_0x5e33ba,_0x4ed989))[_0xbbc5('0x4a')](handleError(_0x5e33ba,null));};exports[_0xbbc5('0x4b')]=function(_0x4f4b74,_0x468f64){var _0x5347a6={'raw':!![],'where':{'id':_0x4f4b74[_0xbbc5('0x4c')]['id']}},_0x1bf427={};_0x1bf427[_0xbbc5('0x3c')]=_[_0xbbc5('0x39')](db[_0xbbc5('0x33')][_0xbbc5('0x34')]);_0x1bf427[_0xbbc5('0x38')]=_[_0xbbc5('0x39')](_0x4f4b74[_0xbbc5('0x38')]);_0x1bf427['filters']=_[_0xbbc5('0x3b')](_0x1bf427[_0xbbc5('0x3c')],_0x1bf427['query']);_0x5347a6['attributes']=_[_0xbbc5('0x3b')](_0x1bf427[_0xbbc5('0x3c')],qs[_0xbbc5('0x3d')](_0x4f4b74[_0xbbc5('0x38')]['fields']));_0x5347a6[_0xbbc5('0x3e')]=_0x5347a6['attributes']['length']?_0x5347a6[_0xbbc5('0x3e')]:_0x1bf427[_0xbbc5('0x3c')];if(_0x4f4b74[_0xbbc5('0x38')][_0xbbc5('0x46')]){_0x5347a6[_0xbbc5('0x47')]=[{'all':!![]}];}_0x5347a6=_[_0xbbc5('0x44')]({},_0x5347a6,_0x4f4b74[_0xbbc5('0x45')]);return db[_0xbbc5('0x33')][_0xbbc5('0x4d')](_0x5347a6)['then'](handleEntityNotFound(_0x468f64,null))['then'](respondWithResult(_0x468f64,null))[_0xbbc5('0x4a')](handleError(_0x468f64,null));};exports[_0xbbc5('0x28')]=function(_0x1e1e8e,_0x16cd29){if(_0x1e1e8e[_0xbbc5('0x4e')]['id']){delete _0x1e1e8e['body']['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x1e1e8e[_0xbbc5('0x4c')]['id']}})[_0xbbc5('0x29')](handleEntityNotFound(_0x16cd29,null))[_0xbbc5('0x29')](saveUpdates(_0x1e1e8e[_0xbbc5('0x4e')],null))[_0xbbc5('0x29')](respondWithResult(_0x16cd29,null))[_0xbbc5('0x4a')](handleError(_0x16cd29,null));};exports['destroy']=function(_0x2b4914,_0x5ed93a){return db['CannedAnswer']['find']({'where':{'id':_0x2b4914['params']['id']}})[_0xbbc5('0x29')](handleEntityNotFound(_0x5ed93a,null))['then'](removeEntity(_0x5ed93a,null))[_0xbbc5('0x4a')](handleError(_0x5ed93a,null));};exports['create']=function(_0x286fac,_0x582d38){var _0x490d15={'key':_0x286fac[_0xbbc5('0x4e')][_0xbbc5('0x36')]};if(_0x286fac[_0xbbc5('0x4e')][_0xbbc5('0x4f')]){_0x490d15['MailAccountId']=_0x286fac[_0xbbc5('0x4e')][_0xbbc5('0x4f')];}else if(_0x286fac[_0xbbc5('0x4e')][_0xbbc5('0x50')]){_0x490d15['SmsAccountId']=_0x286fac[_0xbbc5('0x4e')][_0xbbc5('0x50')];}else if(_0x286fac[_0xbbc5('0x4e')][_0xbbc5('0x51')]){_0x490d15[_0xbbc5('0x51')]=_0x286fac[_0xbbc5('0x4e')][_0xbbc5('0x51')];}else if(_0x286fac['body'][_0xbbc5('0x52')]){_0x490d15[_0xbbc5('0x52')]=_0x286fac[_0xbbc5('0x4e')]['ChatWebsiteId'];}return db[_0xbbc5('0x33')][_0xbbc5('0x4d')]({'where':_0x490d15})['then'](function(_0x358f90){if(_0x358f90){throw new db['Sequelize'][(_0xbbc5('0x53'))](_0xbbc5('0x54'));}return db[_0xbbc5('0x33')][_0xbbc5('0x55')](_0x286fac[_0xbbc5('0x4e')]);})[_0xbbc5('0x29')](function(_0x406352){var _0x19ff39=_0x286fac[_0xbbc5('0x56')]['get']({'plain':!![]});if(!_0x19ff39)throw new Error(_0xbbc5('0x57'));if(_0x19ff39['role']==='user'){var _0x2df2bc=_0x406352[_0xbbc5('0x2b')]({'plain':!![]});return db[_0xbbc5('0x58')][_0xbbc5('0x4d')]({'where':{'name':_0xbbc5('0x2c'),'userProfileId':_0x19ff39['userProfileId']},'raw':!![]})[_0xbbc5('0x29')](function(_0x37aa0e){if(_0x37aa0e&&_0x37aa0e[_0xbbc5('0x59')]===0x0){return db[_0xbbc5('0x2d')][_0xbbc5('0x55')]({'name':_0x2df2bc[_0xbbc5('0x30')],'resourceId':_0x2df2bc['id'],'type':_0x37aa0e['name'],'sectionId':_0x37aa0e['id']},{})[_0xbbc5('0x29')](function(){return _0x406352;});}else{return _0x406352;}})[_0xbbc5('0x4a')](function(_0x459b67){logger[_0xbbc5('0x2e')](_0xbbc5('0x5a'),_0x459b67);throw _0x459b67;});}return _0x406352;})[_0xbbc5('0x29')](respondWithResult(_0x582d38,0xc9))[_0xbbc5('0x4a')](handleError(_0x582d38,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index d2c39ed..924c7d5 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 _0xc167=['rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','path'];(function(_0x1c97cd,_0x312b50){var _0x41ed3a=function(_0x1713b0){while(--_0x1713b0){_0x1c97cd['push'](_0x1c97cd['shift']());}};_0x41ed3a(++_0x312b50);}(_0xc167,0xdb));var _0x7c16=function(_0x4cad3b,_0x166d85){_0x4cad3b=_0x4cad3b-0x0;var _0x5b69d6=_0xc167[_0x4cad3b];return _0x5b69d6;};'use strict';var _=require('lodash');var util=require(_0x7c16('0x0'));var logger=require('../../config/logger')(_0x7c16('0x1'));var moment=require(_0x7c16('0x2'));var BPromise=require(_0x7c16('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c16('0x4'));var rimraf=require(_0x7c16('0x5'));var config=require(_0x7c16('0x6'));var attributes=require(_0x7c16('0x7'));module[_0x7c16('0x8')]=function(_0x47cd33,_0x375700){return _0x47cd33[_0x7c16('0x9')](_0x7c16('0xa'),attributes,{'tableName':_0x7c16('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7c16('0xc'),'collate':_0x7c16('0xd')});}; \ No newline at end of file +var _0xa660=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa660,0x1c6));var _0x0a66=function(_0x87d914,_0x149b02){_0x87d914=_0x87d914-0x0;var _0x3a8edd=_0xa660[_0x87d914];return _0x3a8edd;};'use strict';var _=require(_0x0a66('0x0'));var util=require(_0x0a66('0x1'));var logger=require(_0x0a66('0x2'))('api');var moment=require(_0x0a66('0x3'));var BPromise=require(_0x0a66('0x4'));var rp=require(_0x0a66('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0a66('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x0a66('0x7')]=function(_0x165bd0,_0x4fc8a5){return _0x165bd0[_0x0a66('0x8')](_0x0a66('0x9'),attributes,{'tableName':_0x0a66('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0a66('0xb'),'collate':_0x0a66('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index d1630a7..27d4df9 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(_0x3924e0,_0x5a2db2){var _0x1052eb=function(_0x13ea84){while(--_0x13ea84){_0x3924e0['push'](_0x3924e0['shift']());}};_0x1052eb(++_0x5a2db2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x2aa5c5,_0x42f508){var _0xc9949c=function(_0x8d2d8a){while(--_0x8d2d8a){_0x2aa5c5['push'](_0x2aa5c5['shift']());}};_0xc9949c(++_0x42f508);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 bbe65bc..e9669fd 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 _0x9098=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9098,0x7d));var _0x8909=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x9098[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x8909('0x0'));var util=require('util');var path=require(_0x8909('0x1'));var timeout=require(_0x8909('0x2'));var express=require(_0x8909('0x3'));var router=express['Router']();var fs_extra=require(_0x8909('0x4'));var auth=require(_0x8909('0x5'));var interaction=require(_0x8909('0x6'));var config=require(_0x8909('0x7'));var controller=require(_0x8909('0x8'));router['get']('/',auth[_0x8909('0x9')](),controller[_0x8909('0xa')]);router['get'](_0x8909('0xb'),auth[_0x8909('0x9')](),controller[_0x8909('0xc')]);router[_0x8909('0xd')]('/',auth[_0x8909('0x9')](),controller['create']);router[_0x8909('0xe')](_0x8909('0xb'),auth[_0x8909('0x9')](),controller[_0x8909('0xf')]);router[_0x8909('0x10')](_0x8909('0xb'),auth[_0x8909('0x9')](),controller[_0x8909('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3e79=['../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','put','delete','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x4855fa,_0x490cf3){var _0x4b7a91=function(_0x456ec7){while(--_0x456ec7){_0x4855fa['push'](_0x4855fa['shift']());}};_0x4b7a91(++_0x490cf3);}(_0x3e79,0x104));var _0x93e7=function(_0x438f29,_0x2e29b7){_0x438f29=_0x438f29-0x0;var _0x59e746=_0x3e79[_0x438f29];return _0x59e746;};'use strict';var multer=require(_0x93e7('0x0'));var util=require(_0x93e7('0x1'));var path=require('path');var timeout=require(_0x93e7('0x2'));var express=require('express');var router=express[_0x93e7('0x3')]();var fs_extra=require(_0x93e7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x93e7('0x5'));var config=require(_0x93e7('0x6'));var controller=require(_0x93e7('0x7'));router[_0x93e7('0x8')]('/',auth[_0x93e7('0x9')](),controller[_0x93e7('0xa')]);router[_0x93e7('0x8')](_0x93e7('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x93e7('0x9')](),controller['create']);router[_0x93e7('0xc')]('/:id',auth[_0x93e7('0x9')](),controller['update']);router[_0x93e7('0xd')]('/:id',auth[_0x93e7('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index fd44a5d..19523e2 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 _0x255f=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x255f,0x185));var _0xf255=function(_0x48d0c7,_0x1f7517){_0x48d0c7=_0x48d0c7-0x0;var _0xb17aab=_0x255f[_0x48d0c7];return _0xb17aab;};'use strict';var Sequelize=require(_0xf255('0x0'));module['exports']={'calldate':{'type':Sequelize[_0xf255('0x1')],'allowNull':![],'defaultValue':_0xf255('0x2')},'clid':{'type':Sequelize[_0xf255('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0xf255('0x3')]},'dcontext':{'type':Sequelize[_0xf255('0x3')]},'channel':{'type':Sequelize[_0xf255('0x3')]},'dstchannel':{'type':Sequelize[_0xf255('0x3')]},'lastapp':{'type':Sequelize[_0xf255('0x3')]},'lastdata':{'type':Sequelize[_0xf255('0x3')]},'duration':{'type':Sequelize[_0xf255('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf255('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xf255('0x3')]},'uniqueid':{'type':Sequelize[_0xf255('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0xf255('0x3')]},'peeraccount':{'type':Sequelize[_0xf255('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0xf255('0x3')]}}; \ No newline at end of file +var _0x7e6b=['STRING','INTEGER','DATE','1970-01-01\x2000:00:01'];(function(_0x356127,_0x4873ac){var _0x5d4c75=function(_0x4fe60c){while(--_0x4fe60c){_0x356127['push'](_0x356127['shift']());}};_0x5d4c75(++_0x4873ac);}(_0x7e6b,0x186));var _0xb7e6=function(_0x25a0df,_0x5b4de4){_0x25a0df=_0x25a0df-0x0;var _0x30b5fd=_0x7e6b[_0x25a0df];return _0x30b5fd;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0xb7e6('0x0')],'allowNull':![],'defaultValue':_0xb7e6('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xb7e6('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb7e6('0x2')]},'dstchannel':{'type':Sequelize[_0xb7e6('0x2')]},'lastapp':{'type':Sequelize[_0xb7e6('0x2')]},'lastdata':{'type':Sequelize[_0xb7e6('0x2')]},'duration':{'type':Sequelize[_0xb7e6('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xb7e6('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xb7e6('0x2')]},'userfield':{'type':Sequelize[_0xb7e6('0x2')]},'uniqueid':{'type':Sequelize[_0xb7e6('0x2')]},'linkedid':{'type':Sequelize[_0xb7e6('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xb7e6('0x2')]},'type':{'type':Sequelize[_0xb7e6('0x2')]},'tag':{'type':Sequelize[_0xb7e6('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index b214b21..a2560c0 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 _0x7da7=['count','limit','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','Cdr','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','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'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7da7,0x10d));var _0x77da=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0x7da7[_0x174a72];return _0x32cecd;};'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(){_0x27b6c7['status'](0xcc)[_0x77da('0x23')]();});}};}function handleEntityNotFound(_0x2d009f,_0x835167){return function(_0xbd06b7){if(!_0xbd06b7){_0x2d009f['sendStatus'](0x194);}return _0xbd06b7;};}function handleError(_0x42240b,_0x167240){_0x167240=_0x167240||0x1f4;return function(_0x470c9f){logger[_0x77da('0x24')](_0x470c9f[_0x77da('0x25')]);if(_0x470c9f['name']){delete _0x470c9f[_0x77da('0x26')];}_0x42240b[_0x77da('0x18')](_0x167240)[_0x77da('0x27')](_0x470c9f);};}exports[_0x77da('0x28')]=function(_0x496ecd,_0x5b4638){var _0x4d395a={},_0x2258e9={},_0x30456a={'count':0x0,'rows':[]};var _0x410d09=_[_0x77da('0x29')](db[_0x77da('0x2a')]['rawAttributes'],function(_0x350b4e){return{'name':_0x350b4e[_0x77da('0x2b')],'type':_0x350b4e[_0x77da('0x2c')][_0x77da('0x2d')]};});_0x2258e9[_0x77da('0x2e')]=_[_0x77da('0x29')](_0x410d09,'name');_0x2258e9[_0x77da('0x2f')]=_[_0x77da('0x30')](_0x496ecd[_0x77da('0x2f')]);_0x2258e9[_0x77da('0x31')]=_[_0x77da('0x32')](_0x2258e9[_0x77da('0x2e')],_0x2258e9[_0x77da('0x2f')]);_0x4d395a[_0x77da('0x33')]=_['intersection'](_0x2258e9['model'],qs[_0x77da('0x34')](_0x496ecd[_0x77da('0x2f')]['fields']));_0x4d395a[_0x77da('0x33')]=_0x4d395a[_0x77da('0x33')][_0x77da('0x35')]?_0x4d395a[_0x77da('0x33')]:_0x2258e9[_0x77da('0x2e')];if(!_0x496ecd[_0x77da('0x2f')][_0x77da('0x36')]('nolimit')){_0x4d395a[_0x77da('0x1c')]=qs['limit'](_0x496ecd['query']['limit']);_0x4d395a[_0x77da('0x19')]=qs['offset'](_0x496ecd[_0x77da('0x2f')][_0x77da('0x19')]);}_0x4d395a[_0x77da('0x37')]=qs[_0x77da('0x38')](_0x496ecd[_0x77da('0x2f')][_0x77da('0x38')]);_0x4d395a[_0x77da('0x39')]=qs['filters'](_[_0x77da('0x3a')](_0x496ecd[_0x77da('0x2f')],_0x2258e9[_0x77da('0x31')]),_0x410d09);if(_0x496ecd[_0x77da('0x2f')][_0x77da('0x3b')]){_0x4d395a[_0x77da('0x39')]=_['merge'](_0x4d395a[_0x77da('0x39')],{'$or':_[_0x77da('0x29')](_0x410d09,function(_0x2cd190){if(_0x2cd190['type']!==_0x77da('0x3c')){var _0x505ffb={};_0x505ffb[_0x2cd190['name']]={'$like':'%'+_0x496ecd['query']['filter']+'%'};return _0x505ffb;}})});}_0x4d395a=_[_0x77da('0x3d')]({},_0x4d395a,_0x496ecd[_0x77da('0x3e')]);var _0xebdea1={'where':_0x4d395a['where']};return db[_0x77da('0x2a')]['count'](_0xebdea1)[_0x77da('0x21')](function(_0x517bd0){_0x30456a[_0x77da('0x1b')]=_0x517bd0;if(_0x496ecd[_0x77da('0x2f')][_0x77da('0x3f')]){_0x4d395a[_0x77da('0x40')]=[{'all':!![]}];}return db[_0x77da('0x2a')]['findAll'](_0x4d395a);})[_0x77da('0x21')](function(_0x1f48bd){_0x30456a[_0x77da('0x41')]=_0x1f48bd;return _0x30456a;})[_0x77da('0x21')](respondWithFilteredResult(_0x5b4638,_0x4d395a))[_0x77da('0x42')](handleError(_0x5b4638,null));};exports[_0x77da('0x43')]=function(_0x4ea24c,_0x319625){var _0x2f0495={'raw':!![],'where':{'id':_0x4ea24c[_0x77da('0x44')]['id']}},_0x21de41={};_0x21de41[_0x77da('0x2e')]=_[_0x77da('0x30')](db['Cdr'][_0x77da('0x45')]);_0x21de41['query']=_[_0x77da('0x30')](_0x4ea24c[_0x77da('0x2f')]);_0x21de41[_0x77da('0x31')]=_['intersection'](_0x21de41[_0x77da('0x2e')],_0x21de41[_0x77da('0x2f')]);_0x2f0495[_0x77da('0x33')]=_[_0x77da('0x32')](_0x21de41[_0x77da('0x2e')],qs[_0x77da('0x34')](_0x4ea24c[_0x77da('0x2f')][_0x77da('0x34')]));_0x2f0495[_0x77da('0x33')]=_0x2f0495['attributes'][_0x77da('0x35')]?_0x2f0495[_0x77da('0x33')]:_0x21de41[_0x77da('0x2e')];if(_0x4ea24c[_0x77da('0x2f')][_0x77da('0x3f')]){_0x2f0495[_0x77da('0x40')]=[{'all':!![]}];}_0x2f0495=_['merge']({},_0x2f0495,_0x4ea24c['options']);return db[_0x77da('0x2a')][_0x77da('0x46')](_0x2f0495)[_0x77da('0x21')](handleEntityNotFound(_0x319625,null))[_0x77da('0x21')](respondWithResult(_0x319625,null))[_0x77da('0x42')](handleError(_0x319625,null));};exports[_0x77da('0x47')]=function(_0x4e811e,_0x6ccb8f){return db[_0x77da('0x2a')][_0x77da('0x47')](_0x4e811e[_0x77da('0x48')],{})['then'](respondWithResult(_0x6ccb8f,0xc9))[_0x77da('0x42')](handleError(_0x6ccb8f,null));};exports['update']=function(_0x518fd5,_0x36263b){if(_0x518fd5[_0x77da('0x48')]['id']){delete _0x518fd5[_0x77da('0x48')]['id'];}return db[_0x77da('0x2a')]['find']({'where':{'id':_0x518fd5[_0x77da('0x44')]['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x36263b,null))['then'](saveUpdates(_0x518fd5[_0x77da('0x48')],null))[_0x77da('0x21')](respondWithResult(_0x36263b,null))['catch'](handleError(_0x36263b,null));};exports[_0x77da('0x22')]=function(_0x3aaf5b,_0x2b73d3){return db[_0x77da('0x2a')][_0x77da('0x46')]({'where':{'id':_0x3aaf5b[_0x77da('0x44')]['id']}})[_0x77da('0x21')](handleEntityNotFound(_0x2b73d3,null))[_0x77da('0x21')](removeEntity(_0x2b73d3,null))[_0x77da('0x42')](handleError(_0x2b73d3,null));};exports[_0x77da('0x49')]=function(_0x52aa0a,_0x3d04a3){return db['Cdr'][_0x77da('0x49')]()[_0x77da('0x21')](respondWithResult(_0x3d04a3,null))[_0x77da('0x42')](handleError(_0x3d04a3,null));}; \ No newline at end of file +var _0x0d4d=['zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','Cdr','rows','catch','show','params','keys','length','find','create','body','destroy','describe','eml-format','rimraf'];(function(_0x409d62,_0x41507c){var _0x2e2d31=function(_0x533658){while(--_0x533658){_0x409d62['push'](_0x409d62['shift']());}};_0x2e2d31(++_0x41507c);}(_0x0d4d,0x132));var _0xd0d4=function(_0x8cb2b7,_0x423cb1){_0x8cb2b7=_0x8cb2b7-0x0;var _0x38e954=_0x0d4d[_0x8cb2b7];return _0x38e954;};'use strict';var emlformat=require(_0xd0d4('0x0'));var rimraf=require(_0xd0d4('0x1'));var zipdir=require(_0xd0d4('0x2'));var jsonpatch=require(_0xd0d4('0x3'));var rp=require(_0xd0d4('0x4'));var moment=require(_0xd0d4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd0d4('0x6'));var util=require('util');var path=require(_0xd0d4('0x7'));var sox=require(_0xd0d4('0x8'));var csv=require('to-csv');var ejs=require(_0xd0d4('0x9'));var fs=require('fs');var fs_extra=require(_0xd0d4('0xa'));var _=require(_0xd0d4('0xb'));var squel=require('squel');var crypto=require(_0xd0d4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd0d4('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd0d4('0xe'));var Papa=require(_0xd0d4('0xf'));var Redis=require(_0xd0d4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd0d4('0x11'));var as=require(_0xd0d4('0x12'));var hardwareService=require(_0xd0d4('0x13'));var logger=require(_0xd0d4('0x14'))(_0xd0d4('0x15'));var utils=require(_0xd0d4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd0d4('0x17'));var db=require(_0xd0d4('0x18'))['db'];function respondWithStatusCode(_0x29ee49,_0x2ddeca){_0x2ddeca=_0x2ddeca||0xcc;return function(_0x38ca06){if(_0x38ca06){return _0x29ee49[_0xd0d4('0x19')](_0x2ddeca);}return _0x29ee49['status'](_0x2ddeca)[_0xd0d4('0x1a')]();};}function respondWithResult(_0x2131c8,_0x10a175){_0x10a175=_0x10a175||0xc8;return function(_0x5d6dd7){if(_0x5d6dd7){return _0x2131c8['status'](_0x10a175)[_0xd0d4('0x1b')](_0x5d6dd7);}};}function respondWithFilteredResult(_0x186405,_0x553b47){return function(_0x29bda4){if(_0x29bda4){var _0x1e8608=typeof _0x553b47['offset']==='undefined'&&typeof _0x553b47[_0xd0d4('0x1c')]===_0xd0d4('0x1d');var _0x268e1a=_0x29bda4['count'];var _0x5cf4c6=_0x1e8608?0x0:_0x553b47['offset'];var _0x407cda=_0x1e8608?_0x29bda4[_0xd0d4('0x1e')]:_0x553b47[_0xd0d4('0x1f')]+_0x553b47['limit'];var _0x568c75;if(_0x407cda>=_0x268e1a){_0x407cda=_0x268e1a;_0x568c75=0xc8;}else{_0x568c75=0xce;}_0x186405[_0xd0d4('0x20')](_0x568c75);return _0x186405['set'](_0xd0d4('0x21'),_0x5cf4c6+'-'+_0x407cda+'/'+_0x268e1a)[_0xd0d4('0x1b')](_0x29bda4);}return null;};}function patchUpdates(_0x1dcc1b){return function(_0x485cd8){try{jsonpatch[_0xd0d4('0x22')](_0x485cd8,_0x1dcc1b,!![]);}catch(_0x4d9fac){return BPromise['reject'](_0x4d9fac);}return _0x485cd8[_0xd0d4('0x23')]();};}function saveUpdates(_0xda03dd,_0x49b6f0){return function(_0x50f959){if(_0x50f959){return _0x50f959[_0xd0d4('0x24')](_0xda03dd)[_0xd0d4('0x25')](function(_0x398a00){return _0x398a00;});}return null;};}function removeEntity(_0x4c94b1,_0x1d8033){return function(_0x1c0831){if(_0x1c0831){return _0x1c0831['destroy']()[_0xd0d4('0x25')](function(){_0x4c94b1['status'](0xcc)[_0xd0d4('0x1a')]();});}};}function handleEntityNotFound(_0x1b03ef,_0x16808c){return function(_0x5380c3){if(!_0x5380c3){_0x1b03ef['sendStatus'](0x194);}return _0x5380c3;};}function handleError(_0x131de5,_0x4e7cc1){_0x4e7cc1=_0x4e7cc1||0x1f4;return function(_0x50e7f0){logger[_0xd0d4('0x26')](_0x50e7f0[_0xd0d4('0x27')]);if(_0x50e7f0[_0xd0d4('0x28')]){delete _0x50e7f0[_0xd0d4('0x28')];}_0x131de5['status'](_0x4e7cc1)[_0xd0d4('0x29')](_0x50e7f0);};}exports[_0xd0d4('0x2a')]=function(_0x45acf8,_0x22e142){var _0x7eecce={},_0xefce4f={},_0x1b07e8={'count':0x0,'rows':[]};var _0x266b91=_[_0xd0d4('0x2b')](db['Cdr'][_0xd0d4('0x2c')],function(_0x7aa87e){return{'name':_0x7aa87e[_0xd0d4('0x2d')],'type':_0x7aa87e[_0xd0d4('0x2e')][_0xd0d4('0x2f')]};});_0xefce4f[_0xd0d4('0x30')]=_['map'](_0x266b91,'name');_0xefce4f[_0xd0d4('0x31')]=_['keys'](_0x45acf8[_0xd0d4('0x31')]);_0xefce4f[_0xd0d4('0x32')]=_[_0xd0d4('0x33')](_0xefce4f[_0xd0d4('0x30')],_0xefce4f[_0xd0d4('0x31')]);_0x7eecce[_0xd0d4('0x34')]=_[_0xd0d4('0x33')](_0xefce4f['model'],qs['fields'](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x35')]));_0x7eecce['attributes']=_0x7eecce[_0xd0d4('0x34')]['length']?_0x7eecce['attributes']:_0xefce4f[_0xd0d4('0x30')];if(!_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x36')](_0xd0d4('0x37'))){_0x7eecce['limit']=qs['limit'](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x1c')]);_0x7eecce[_0xd0d4('0x1f')]=qs['offset'](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x1f')]);}_0x7eecce[_0xd0d4('0x38')]=qs[_0xd0d4('0x39')](_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x39')]);_0x7eecce[_0xd0d4('0x3a')]=qs[_0xd0d4('0x32')](_['pick'](_0x45acf8[_0xd0d4('0x31')],_0xefce4f['filters']),_0x266b91);if(_0x45acf8['query'][_0xd0d4('0x3b')]){_0x7eecce['where']=_[_0xd0d4('0x3c')](_0x7eecce[_0xd0d4('0x3a')],{'$or':_[_0xd0d4('0x2b')](_0x266b91,function(_0x1d6329){if(_0x1d6329[_0xd0d4('0x2e')]!==_0xd0d4('0x3d')){var _0x560e77={};_0x560e77[_0x1d6329[_0xd0d4('0x28')]]={'$like':'%'+_0x45acf8[_0xd0d4('0x31')]['filter']+'%'};return _0x560e77;}})});}_0x7eecce=_['merge']({},_0x7eecce,_0x45acf8[_0xd0d4('0x3e')]);var _0x3e6527={'where':_0x7eecce[_0xd0d4('0x3a')]};return db['Cdr'][_0xd0d4('0x1e')](_0x3e6527)[_0xd0d4('0x25')](function(_0x230101){_0x1b07e8[_0xd0d4('0x1e')]=_0x230101;if(_0x45acf8[_0xd0d4('0x31')][_0xd0d4('0x3f')]){_0x7eecce[_0xd0d4('0x40')]=[{'all':!![]}];}return db[_0xd0d4('0x41')]['findAll'](_0x7eecce);})[_0xd0d4('0x25')](function(_0x4174e8){_0x1b07e8[_0xd0d4('0x42')]=_0x4174e8;return _0x1b07e8;})['then'](respondWithFilteredResult(_0x22e142,_0x7eecce))[_0xd0d4('0x43')](handleError(_0x22e142,null));};exports[_0xd0d4('0x44')]=function(_0x5db657,_0x11b77e){var _0x32d1c1={'raw':!![],'where':{'id':_0x5db657[_0xd0d4('0x45')]['id']}},_0x429b84={};_0x429b84[_0xd0d4('0x30')]=_[_0xd0d4('0x46')](db['Cdr'][_0xd0d4('0x2c')]);_0x429b84[_0xd0d4('0x31')]=_[_0xd0d4('0x46')](_0x5db657[_0xd0d4('0x31')]);_0x429b84['filters']=_[_0xd0d4('0x33')](_0x429b84[_0xd0d4('0x30')],_0x429b84[_0xd0d4('0x31')]);_0x32d1c1[_0xd0d4('0x34')]=_[_0xd0d4('0x33')](_0x429b84[_0xd0d4('0x30')],qs[_0xd0d4('0x35')](_0x5db657['query'][_0xd0d4('0x35')]));_0x32d1c1[_0xd0d4('0x34')]=_0x32d1c1['attributes'][_0xd0d4('0x47')]?_0x32d1c1[_0xd0d4('0x34')]:_0x429b84[_0xd0d4('0x30')];if(_0x5db657[_0xd0d4('0x31')][_0xd0d4('0x3f')]){_0x32d1c1[_0xd0d4('0x40')]=[{'all':!![]}];}_0x32d1c1=_['merge']({},_0x32d1c1,_0x5db657[_0xd0d4('0x3e')]);return db['Cdr'][_0xd0d4('0x48')](_0x32d1c1)[_0xd0d4('0x25')](handleEntityNotFound(_0x11b77e,null))['then'](respondWithResult(_0x11b77e,null))[_0xd0d4('0x43')](handleError(_0x11b77e,null));};exports['create']=function(_0x5d61d5,_0x1dad8b){return db['Cdr'][_0xd0d4('0x49')](_0x5d61d5[_0xd0d4('0x4a')],{})['then'](respondWithResult(_0x1dad8b,0xc9))[_0xd0d4('0x43')](handleError(_0x1dad8b,null));};exports['update']=function(_0xdf2562,_0x258cd1){if(_0xdf2562[_0xd0d4('0x4a')]['id']){delete _0xdf2562[_0xd0d4('0x4a')]['id'];}return db[_0xd0d4('0x41')][_0xd0d4('0x48')]({'where':{'id':_0xdf2562[_0xd0d4('0x45')]['id']}})[_0xd0d4('0x25')](handleEntityNotFound(_0x258cd1,null))[_0xd0d4('0x25')](saveUpdates(_0xdf2562['body'],null))['then'](respondWithResult(_0x258cd1,null))[_0xd0d4('0x43')](handleError(_0x258cd1,null));};exports[_0xd0d4('0x4b')]=function(_0x333a5b,_0x6af64e){return db[_0xd0d4('0x41')][_0xd0d4('0x48')]({'where':{'id':_0x333a5b[_0xd0d4('0x45')]['id']}})[_0xd0d4('0x25')](handleEntityNotFound(_0x6af64e,null))[_0xd0d4('0x25')](removeEntity(_0x6af64e,null))['catch'](handleError(_0x6af64e,null));};exports[_0xd0d4('0x4c')]=function(_0x5b23bb,_0x4b97e1){return db[_0xd0d4('0x41')]['describe']()[_0xd0d4('0x25')](respondWithResult(_0x4b97e1,null))[_0xd0d4('0x43')](handleError(_0x4b97e1,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 27cb410..63e102c 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x2b2266,_0x536623){var _0xcc0d19=function(_0x4a77d6){while(--_0x4a77d6){_0x2b2266['push'](_0x2b2266['shift']());}};_0xcc0d19(++_0x536623);}(_0x7a54,0x106));var _0x47a5=function(_0x3736b0,_0x3e9afe){_0x3736b0=_0x3736b0-0x0;var _0x10c13d=_0x7a54[_0x3736b0];return _0x10c13d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3bcbc9,_0x4f1ec2){var _0x46afb8=function(_0x4e3e13){while(--_0x4e3e13){_0x3bcbc9['push'](_0x3bcbc9['shift']());}};_0x46afb8(++_0x4f1ec2);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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 0982062..4df27e3 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 _0x8468=['catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','code','Cdr,\x20%s,\x20%s','error','message','info','result'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x8468,0x7f));var _0x8846=function(_0x59fb47,_0x2b4183){_0x59fb47=_0x59fb47-0x0;var _0x22b0d6=_0x8468[_0x59fb47];return _0x22b0d6;};'use strict';var _=require(_0x8846('0x0'));var util=require(_0x8846('0x1'));var moment=require(_0x8846('0x2'));var BPromise=require(_0x8846('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8846('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8846('0x5'));var logger=require(_0x8846('0x6'))(_0x8846('0x7'));var config=require(_0x8846('0x8'));var jayson=require(_0x8846('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d95d9,_0x103118,_0x51bc30){return new BPromise(function(_0x4527a7,_0x2f6517){return client['request'](_0x2d95d9,_0x51bc30)[_0x8846('0xa')](function(_0x39be47){logger['info']('Cdr,\x20%s,\x20%s',_0x103118,_0x8846('0xb'));logger['debug'](_0x8846('0xc'),_0x103118,_0x8846('0xb'),JSON[_0x8846('0xd')](_0x39be47));if(_0x39be47['error']){if(_0x39be47['error'][_0x8846('0xe')]===0x1f4){logger['error'](_0x8846('0xf'),_0x103118,_0x39be47[_0x8846('0x10')][_0x8846('0x11')]);return _0x2f6517(_0x39be47[_0x8846('0x10')][_0x8846('0x11')]);}logger[_0x8846('0x10')]('Cdr,\x20%s,\x20%s',_0x103118,_0x39be47['error'][_0x8846('0x11')]);return _0x4527a7(_0x39be47['error'][_0x8846('0x11')]);}else{logger[_0x8846('0x12')](_0x8846('0xf'),_0x103118,_0x8846('0xb'));_0x4527a7(_0x39be47[_0x8846('0x13')][_0x8846('0x11')]);}})[_0x8846('0x14')](function(_0x49c526){logger[_0x8846('0x10')]('Cdr,\x20%s,\x20%s',_0x103118,_0x49c526);_0x2f6517(_0x49c526);});});} \ No newline at end of file +var _0x8eb8=['then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4a518f,_0x1cecde){var _0x551a5e=function(_0x17b103){while(--_0x17b103){_0x4a518f['push'](_0x4a518f['shift']());}};_0x551a5e(++_0x1cecde);}(_0x8eb8,0x7d));var _0x88eb=function(_0x9822c4,_0x37a957){_0x9822c4=_0x9822c4-0x0;var _0x456ce4=_0x8eb8[_0x9822c4];return _0x456ce4;};'use strict';var _=require(_0x88eb('0x0'));var util=require(_0x88eb('0x1'));var moment=require('moment');var BPromise=require(_0x88eb('0x2'));var rs=require(_0x88eb('0x3'));var fs=require('fs');var Redis=require(_0x88eb('0x4'));var db=require(_0x88eb('0x5'))['db'];var utils=require(_0x88eb('0x6'));var logger=require(_0x88eb('0x7'))(_0x88eb('0x8'));var config=require(_0x88eb('0x9'));var jayson=require(_0x88eb('0xa'));var client=jayson[_0x88eb('0xb')][_0x88eb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cad2d,_0x32e193,_0x521813){return new BPromise(function(_0x288db4,_0x467c3c){return client['request'](_0x3cad2d,_0x521813)[_0x88eb('0xd')](function(_0x586fa2){logger['info'](_0x88eb('0xe'),_0x32e193,_0x88eb('0xf'));logger[_0x88eb('0x10')](_0x88eb('0x11'),_0x32e193,_0x88eb('0xf'),JSON['stringify'](_0x586fa2));if(_0x586fa2[_0x88eb('0x12')]){if(_0x586fa2[_0x88eb('0x12')]['code']===0x1f4){logger[_0x88eb('0x12')](_0x88eb('0xe'),_0x32e193,_0x586fa2['error']['message']);return _0x467c3c(_0x586fa2[_0x88eb('0x12')][_0x88eb('0x13')]);}logger[_0x88eb('0x12')](_0x88eb('0xe'),_0x32e193,_0x586fa2[_0x88eb('0x12')][_0x88eb('0x13')]);return _0x288db4(_0x586fa2['error'][_0x88eb('0x13')]);}else{logger[_0x88eb('0x14')](_0x88eb('0xe'),_0x32e193,_0x88eb('0xf'));_0x288db4(_0x586fa2[_0x88eb('0x15')][_0x88eb('0x13')]);}})[_0x88eb('0x16')](function(_0x57bea8){logger[_0x88eb('0x12')](_0x88eb('0xe'),_0x32e193,_0x57bea8);_0x467c3c(_0x57bea8);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 415619a..f1a02fb 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 _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x402fdb,_0x1f9f25){var _0x449220=function(_0x196992){while(--_0x196992){_0x402fdb['push'](_0x402fdb['shift']());}};_0x449220(++_0x1f9f25);}(_0xb10b,0x12a));var _0xbb10=function(_0xc40b9f,_0x17ec1f){_0xc40b9f=_0xc40b9f-0x0;var _0x535b9c=_0xb10b[_0xc40b9f];return _0x535b9c;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x5ac13b,_0x371bf0){var _0x2919c1=function(_0x56b44b){while(--_0x56b44b){_0x5ac13b['push'](_0x5ac13b['shift']());}};_0x2919c1(++_0x371bf0);}(_0xb10b,0x12a));var _0xbb10=function(_0x576d8a,_0x2d7bde){_0x576d8a=_0x576d8a-0x0;var _0x3dc3ef=_0xb10b[_0x576d8a];return _0x3dc3ef;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 17a2799..f1b12d2 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 _0xa5ef=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x38de33,_0x4361bb){var _0x40f16d=function(_0x25975c){while(--_0x25975c){_0x38de33['push'](_0x38de33['shift']());}};_0x40f16d(++_0x4361bb);}(_0xa5ef,0xe3));var _0xfa5e=function(_0x24655a,_0x7fa437){_0x24655a=_0x24655a-0x0;var _0x5f4ad4=_0xa5ef[_0x24655a];return _0x5f4ad4;};'use strict';var Sequelize=require(_0xfa5e('0x0'));module[_0xfa5e('0x1')]={'priority':{'type':Sequelize[_0xfa5e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfa5e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xfa5e('0x3')]},'interval':{'type':Sequelize[_0xfa5e('0x3')],'defaultValue':_0xfa5e('0x4')}}; \ No newline at end of file +var _0x3fba=['STRING','*,*,*,*','sequelize','INTEGER','noop','TEXT'];(function(_0xbdbd32,_0x188a65){var _0x3b2e64=function(_0x788471){while(--_0x788471){_0xbdbd32['push'](_0xbdbd32['shift']());}};_0x3b2e64(++_0x188a65);}(_0x3fba,0xbc));var _0xa3fb=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0x3fba[_0x2f62aa];return _0x1a341f;};'use strict';var Sequelize=require(_0xa3fb('0x0'));module['exports']={'priority':{'type':Sequelize[_0xa3fb('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa3fb('0x2')},'appdata':{'type':Sequelize[_0xa3fb('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa3fb('0x4')],'defaultValue':_0xa3fb('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 8256a8a..ce7f199 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 _0x7d98=['mustache','util','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','name','send','params','model','query','keys','filters','attributes','intersection','fields','length','includeAll','include','merge','options','ChatApplication','find','catch','body','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5af853,_0x463f3b){var _0x49564=function(_0x2cc632){while(--_0x2cc632){_0x5af853['push'](_0x5af853['shift']());}};_0x49564(++_0x463f3b);}(_0x7d98,0xe7));var _0x87d9=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0x7d98[_0xcda377];return _0x1c024f;};'use strict';var emlformat=require(_0x87d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x87d9('0x1'));var jsonpatch=require(_0x87d9('0x2'));var rp=require(_0x87d9('0x3'));var moment=require(_0x87d9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x87d9('0x5'));var util=require(_0x87d9('0x6'));var path=require('path');var sox=require(_0x87d9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x87d9('0x8'));var squel=require(_0x87d9('0x9'));var crypto=require(_0x87d9('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x87d9('0xb'));var toCsv=require(_0x87d9('0xc'));var querystring=require(_0x87d9('0xd'));var Papa=require('papaparse');var Redis=require(_0x87d9('0xe'));var authService=require(_0x87d9('0xf'));var qs=require(_0x87d9('0x10'));var as=require(_0x87d9('0x11'));var hardwareService=require(_0x87d9('0x12'));var logger=require(_0x87d9('0x13'))(_0x87d9('0x14'));var utils=require(_0x87d9('0x15'));var config=require(_0x87d9('0x16'));var licenseUtil=require(_0x87d9('0x17'));var db=require(_0x87d9('0x18'))['db'];function respondWithStatusCode(_0x22f32d,_0x38f33e){_0x38f33e=_0x38f33e||0xcc;return function(_0x22758){if(_0x22758){return _0x22f32d[_0x87d9('0x19')](_0x38f33e);}return _0x22f32d[_0x87d9('0x1a')](_0x38f33e)[_0x87d9('0x1b')]();};}function respondWithResult(_0x185401,_0x380836){_0x380836=_0x380836||0xc8;return function(_0x27d61d){if(_0x27d61d){return _0x185401['status'](_0x380836)['json'](_0x27d61d);}};}function respondWithFilteredResult(_0x9e9e53,_0xaa910c){return function(_0x3231e7){if(_0x3231e7){var _0x501d32=typeof _0xaa910c['offset']===_0x87d9('0x1c')&&typeof _0xaa910c[_0x87d9('0x1d')]===_0x87d9('0x1c');var _0x23ae47=_0x3231e7[_0x87d9('0x1e')];var _0xebc1eb=_0x501d32?0x0:_0xaa910c[_0x87d9('0x1f')];var _0x1f33a3=_0x501d32?_0x3231e7[_0x87d9('0x1e')]:_0xaa910c[_0x87d9('0x1f')]+_0xaa910c[_0x87d9('0x1d')];var _0x5d6da1;if(_0x1f33a3>=_0x23ae47){_0x1f33a3=_0x23ae47;_0x5d6da1=0xc8;}else{_0x5d6da1=0xce;}_0x9e9e53[_0x87d9('0x1a')](_0x5d6da1);return _0x9e9e53['set'](_0x87d9('0x20'),_0xebc1eb+'-'+_0x1f33a3+'/'+_0x23ae47)[_0x87d9('0x21')](_0x3231e7);}return null;};}function patchUpdates(_0x334d31){return function(_0x57bef6){try{jsonpatch['apply'](_0x57bef6,_0x334d31,!![]);}catch(_0x545241){return BPromise[_0x87d9('0x22')](_0x545241);}return _0x57bef6[_0x87d9('0x23')]();};}function saveUpdates(_0x28aaaa,_0x6ab839){return function(_0xc82b02){if(_0xc82b02){return _0xc82b02[_0x87d9('0x24')](_0x28aaaa)[_0x87d9('0x25')](function(_0x3b24e7){return _0x3b24e7;});}return null;};}function removeEntity(_0x1c550c,_0x4c0f7a){return function(_0x31e1b2){if(_0x31e1b2){return _0x31e1b2[_0x87d9('0x26')]()[_0x87d9('0x25')](function(){_0x1c550c[_0x87d9('0x1a')](0xcc)[_0x87d9('0x1b')]();});}};}function handleEntityNotFound(_0x340462,_0x3641c8){return function(_0x32b83f){if(!_0x32b83f){_0x340462['sendStatus'](0x194);}return _0x32b83f;};}function handleError(_0x8b1ab7,_0x600404){_0x600404=_0x600404||0x1f4;return function(_0x2f63fa){logger[_0x87d9('0x27')](_0x2f63fa['stack']);if(_0x2f63fa[_0x87d9('0x28')]){delete _0x2f63fa[_0x87d9('0x28')];}_0x8b1ab7[_0x87d9('0x1a')](_0x600404)[_0x87d9('0x29')](_0x2f63fa);};}exports['show']=function(_0x21916a,_0x3c0283){var _0x501c5={'raw':!![],'where':{'id':_0x21916a[_0x87d9('0x2a')]['id']}},_0x5e1b55={};_0x5e1b55[_0x87d9('0x2b')]=_['keys'](db['ChatApplication']['rawAttributes']);_0x5e1b55[_0x87d9('0x2c')]=_[_0x87d9('0x2d')](_0x21916a['query']);_0x5e1b55[_0x87d9('0x2e')]=_['intersection'](_0x5e1b55[_0x87d9('0x2b')],_0x5e1b55['query']);_0x501c5[_0x87d9('0x2f')]=_[_0x87d9('0x30')](_0x5e1b55['model'],qs[_0x87d9('0x31')](_0x21916a['query'][_0x87d9('0x31')]));_0x501c5[_0x87d9('0x2f')]=_0x501c5[_0x87d9('0x2f')][_0x87d9('0x32')]?_0x501c5[_0x87d9('0x2f')]:_0x5e1b55[_0x87d9('0x2b')];if(_0x21916a['query'][_0x87d9('0x33')]){_0x501c5[_0x87d9('0x34')]=[{'all':!![]}];}_0x501c5=_[_0x87d9('0x35')]({},_0x501c5,_0x21916a[_0x87d9('0x36')]);return db[_0x87d9('0x37')][_0x87d9('0x38')](_0x501c5)[_0x87d9('0x25')](handleEntityNotFound(_0x3c0283,null))[_0x87d9('0x25')](respondWithResult(_0x3c0283,null))[_0x87d9('0x39')](handleError(_0x3c0283,null));};exports['update']=function(_0xf1007,_0x24d0e6){if(_0xf1007[_0x87d9('0x3a')]['id']){delete _0xf1007[_0x87d9('0x3a')]['id'];}return db[_0x87d9('0x37')]['find']({'where':{'id':_0xf1007[_0x87d9('0x2a')]['id']}})[_0x87d9('0x25')](handleEntityNotFound(_0x24d0e6,null))[_0x87d9('0x25')](saveUpdates(_0xf1007['body'],null))[_0x87d9('0x25')](respondWithResult(_0x24d0e6,null))['catch'](handleError(_0x24d0e6,null));};exports[_0x87d9('0x26')]=function(_0x2a18cf,_0x157fa1){return db[_0x87d9('0x37')]['find']({'where':{'id':_0x2a18cf[_0x87d9('0x2a')]['id']}})['then'](handleEntityNotFound(_0x157fa1,null))[_0x87d9('0x25')](removeEntity(_0x157fa1,null))[_0x87d9('0x39')](handleError(_0x157fa1,null));}; \ No newline at end of file +var _0x3f9b=['update','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','fields','attributes','includeAll','include','merge','find','catch','zip-dir','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x237825,_0x3c6f8d){_0x237825=_0x237825-0x0;var _0x3dbfbe=_0x3f9b[_0x237825];return _0x3dbfbe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb3f9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3f9('0x1'));var moment=require(_0xb3f9('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb3f9('0x3'));var sox=require(_0xb3f9('0x4'));var csv=require(_0xb3f9('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3f9('0x6'));var _=require(_0xb3f9('0x7'));var squel=require(_0xb3f9('0x8'));var crypto=require(_0xb3f9('0x9'));var jsforce=require(_0xb3f9('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3f9('0xb'));var Papa=require(_0xb3f9('0xc'));var Redis=require('ioredis');var authService=require(_0xb3f9('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3f9('0xe'));var logger=require(_0xb3f9('0xf'))(_0xb3f9('0x10'));var utils=require(_0xb3f9('0x11'));var config=require(_0xb3f9('0x12'));var licenseUtil=require(_0xb3f9('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cdce2,_0xbbc1cb){_0xbbc1cb=_0xbbc1cb||0xcc;return function(_0x395561){if(_0x395561){return _0x1cdce2[_0xb3f9('0x14')](_0xbbc1cb);}return _0x1cdce2[_0xb3f9('0x15')](_0xbbc1cb)[_0xb3f9('0x16')]();};}function respondWithResult(_0x36c56c,_0x67f3ee){_0x67f3ee=_0x67f3ee||0xc8;return function(_0x590d44){if(_0x590d44){return _0x36c56c[_0xb3f9('0x15')](_0x67f3ee)['json'](_0x590d44);}};}function respondWithFilteredResult(_0x55256c,_0x214c4b){return function(_0x86b55c){if(_0x86b55c){var _0x171378=typeof _0x214c4b[_0xb3f9('0x17')]===_0xb3f9('0x18')&&typeof _0x214c4b[_0xb3f9('0x19')]===_0xb3f9('0x18');var _0x3f89e5=_0x86b55c['count'];var _0x2c69d4=_0x171378?0x0:_0x214c4b['offset'];var _0x5e7e42=_0x171378?_0x86b55c[_0xb3f9('0x1a')]:_0x214c4b['offset']+_0x214c4b[_0xb3f9('0x19')];var _0x33cf23;if(_0x5e7e42>=_0x3f89e5){_0x5e7e42=_0x3f89e5;_0x33cf23=0xc8;}else{_0x33cf23=0xce;}_0x55256c[_0xb3f9('0x15')](_0x33cf23);return _0x55256c[_0xb3f9('0x1b')](_0xb3f9('0x1c'),_0x2c69d4+'-'+_0x5e7e42+'/'+_0x3f89e5)[_0xb3f9('0x1d')](_0x86b55c);}return null;};}function patchUpdates(_0x4b7da0){return function(_0x51b607){try{jsonpatch['apply'](_0x51b607,_0x4b7da0,!![]);}catch(_0xb17d2e){return BPromise[_0xb3f9('0x1e')](_0xb17d2e);}return _0x51b607[_0xb3f9('0x1f')]();};}function saveUpdates(_0x4bffc7,_0x53f664){return function(_0x3446ea){if(_0x3446ea){return _0x3446ea[_0xb3f9('0x20')](_0x4bffc7)[_0xb3f9('0x21')](function(_0x560077){return _0x560077;});}return null;};}function removeEntity(_0x3b8738,_0x503ba7){return function(_0x20e804){if(_0x20e804){return _0x20e804[_0xb3f9('0x22')]()[_0xb3f9('0x21')](function(){_0x3b8738['status'](0xcc)[_0xb3f9('0x16')]();});}};}function handleEntityNotFound(_0x1ffd67,_0x378271){return function(_0x4d70e6){if(!_0x4d70e6){_0x1ffd67[_0xb3f9('0x14')](0x194);}return _0x4d70e6;};}function handleError(_0x402bc2,_0x581510){_0x581510=_0x581510||0x1f4;return function(_0x317e48){logger[_0xb3f9('0x23')](_0x317e48[_0xb3f9('0x24')]);if(_0x317e48[_0xb3f9('0x25')]){delete _0x317e48[_0xb3f9('0x25')];}_0x402bc2['status'](_0x581510)[_0xb3f9('0x26')](_0x317e48);};}exports[_0xb3f9('0x27')]=function(_0x2939f8,_0x1d94e0){var _0x3d8c58={'raw':!![],'where':{'id':_0x2939f8[_0xb3f9('0x28')]['id']}},_0x1b952f={};_0x1b952f[_0xb3f9('0x29')]=_[_0xb3f9('0x2a')](db[_0xb3f9('0x2b')][_0xb3f9('0x2c')]);_0x1b952f[_0xb3f9('0x2d')]=_[_0xb3f9('0x2a')](_0x2939f8['query']);_0x1b952f['filters']=_['intersection'](_0x1b952f[_0xb3f9('0x29')],_0x1b952f['query']);_0x3d8c58['attributes']=_['intersection'](_0x1b952f[_0xb3f9('0x29')],qs[_0xb3f9('0x2e')](_0x2939f8['query'][_0xb3f9('0x2e')]));_0x3d8c58[_0xb3f9('0x2f')]=_0x3d8c58[_0xb3f9('0x2f')]['length']?_0x3d8c58['attributes']:_0x1b952f[_0xb3f9('0x29')];if(_0x2939f8['query'][_0xb3f9('0x30')]){_0x3d8c58[_0xb3f9('0x31')]=[{'all':!![]}];}_0x3d8c58=_[_0xb3f9('0x32')]({},_0x3d8c58,_0x2939f8['options']);return db[_0xb3f9('0x2b')][_0xb3f9('0x33')](_0x3d8c58)[_0xb3f9('0x21')](handleEntityNotFound(_0x1d94e0,null))['then'](respondWithResult(_0x1d94e0,null))[_0xb3f9('0x34')](handleError(_0x1d94e0,null));};exports[_0xb3f9('0x20')]=function(_0x5c45e9,_0x21f16a){if(_0x5c45e9['body']['id']){delete _0x5c45e9['body']['id'];}return db[_0xb3f9('0x2b')][_0xb3f9('0x33')]({'where':{'id':_0x5c45e9['params']['id']}})['then'](handleEntityNotFound(_0x21f16a,null))[_0xb3f9('0x21')](saveUpdates(_0x5c45e9['body'],null))[_0xb3f9('0x21')](respondWithResult(_0x21f16a,null))[_0xb3f9('0x34')](handleError(_0x21f16a,null));};exports[_0xb3f9('0x22')]=function(_0x3b8449,_0x48281d){return db['ChatApplication'][_0xb3f9('0x33')]({'where':{'id':_0x3b8449['params']['id']}})[_0xb3f9('0x21')](handleEntityNotFound(_0x48281d,null))['then'](removeEntity(_0x48281d,null))[_0xb3f9('0x34')](handleError(_0x48281d,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index a3913e0..e84f57c 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 _0xd3e7=['exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd3e7,0x130));var _0x7d3e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd3e7[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x7d3e('0x0'));var util=require(_0x7d3e('0x1'));var logger=require('../../config/logger')(_0x7d3e('0x2'));var moment=require(_0x7d3e('0x3'));var BPromise=require('bluebird');var rp=require(_0x7d3e('0x4'));var fs=require('fs');var path=require(_0x7d3e('0x5'));var rimraf=require(_0x7d3e('0x6'));var config=require(_0x7d3e('0x7'));var attributes=require('./chatApplication.attributes');module[_0x7d3e('0x8')]=function(_0x3526c0,_0x14211e){return _0x3526c0[_0x7d3e('0x9')](_0x7d3e('0xa'),attributes,{'tableName':_0x7d3e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7d3e('0xc')});}; \ No newline at end of file +var _0x4588=['rimraf','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5c0e4d,_0x5b1db2){var _0x2a2ea7=function(_0x42be23){while(--_0x42be23){_0x5c0e4d['push'](_0x5c0e4d['shift']());}};_0x2a2ea7(++_0x5b1db2);}(_0x4588,0x179));var _0x8458=function(_0x6182ff,_0x59d492){_0x6182ff=_0x6182ff-0x0;var _0x1cec22=_0x4588[_0x6182ff];return _0x1cec22;};'use strict';var _=require(_0x8458('0x0'));var util=require(_0x8458('0x1'));var logger=require(_0x8458('0x2'))(_0x8458('0x3'));var moment=require('moment');var BPromise=require(_0x8458('0x4'));var rp=require(_0x8458('0x5'));var fs=require('fs');var path=require(_0x8458('0x6'));var rimraf=require(_0x8458('0x7'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module['exports']=function(_0x46ff3e,_0x7c4650){return _0x46ff3e[_0x8458('0x8')](_0x8458('0x9'),attributes,{'tableName':_0x8458('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8458('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index d42de0b..81194ed 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 _0x91da=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','ChatApplication,\x20%s,\x20%s','error','message','result','catch'];(function(_0x74277,_0x58cbee){var _0x56e81=function(_0x58bfda){while(--_0x58bfda){_0x74277['push'](_0x74277['shift']());}};_0x56e81(++_0x58cbee);}(_0x91da,0x1e0));var _0xa91d=function(_0x23710e,_0x5a0e05){_0x23710e=_0x23710e-0x0;var _0x103a34=_0x91da[_0x23710e];return _0x103a34;};'use strict';var _=require(_0xa91d('0x0'));var util=require(_0xa91d('0x1'));var moment=require(_0xa91d('0x2'));var BPromise=require(_0xa91d('0x3'));var rs=require(_0xa91d('0x4'));var fs=require('fs');var Redis=require(_0xa91d('0x5'));var db=require(_0xa91d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa91d('0x7'))(_0xa91d('0x8'));var config=require('../../config/environment');var jayson=require(_0xa91d('0x9'));var client=jayson[_0xa91d('0xa')][_0xa91d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11d9a8,_0x1258ed,_0x1f9f1c){return new BPromise(function(_0x31611b,_0x5d9fc2){return client[_0xa91d('0xc')](_0x11d9a8,_0x1f9f1c)[_0xa91d('0xd')](function(_0x51106b){logger[_0xa91d('0xe')]('ChatApplication,\x20%s,\x20%s',_0x1258ed,'request\x20sent');logger['debug'](_0xa91d('0xf'),_0x1258ed,_0xa91d('0x10'),JSON[_0xa91d('0x11')](_0x51106b));if(_0x51106b['error']){if(_0x51106b['error'][_0xa91d('0x12')]===0x1f4){logger['error'](_0xa91d('0x13'),_0x1258ed,_0x51106b[_0xa91d('0x14')][_0xa91d('0x15')]);return _0x5d9fc2(_0x51106b[_0xa91d('0x14')][_0xa91d('0x15')]);}logger[_0xa91d('0x14')](_0xa91d('0x13'),_0x1258ed,_0x51106b[_0xa91d('0x14')]['message']);return _0x31611b(_0x51106b['error'][_0xa91d('0x15')]);}else{logger[_0xa91d('0xe')](_0xa91d('0x13'),_0x1258ed,_0xa91d('0x10'));_0x31611b(_0x51106b[_0xa91d('0x16')][_0xa91d('0x15')]);}})[_0xa91d('0x17')](function(_0x302aed){logger[_0xa91d('0x14')](_0xa91d('0x13'),_0x1258ed,_0x302aed);_0x5d9fc2(_0x302aed);});});} \ No newline at end of file +var _0x6644=['request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','ChatApplication,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x3f6460,_0x3bdb9b){var _0x5d9ac6=function(_0x1ebb5e){while(--_0x1ebb5e){_0x3f6460['push'](_0x3f6460['shift']());}};_0x5d9ac6(++_0x3bdb9b);}(_0x6644,0x182));var _0x4664=function(_0x41abc0,_0x418df2){_0x41abc0=_0x41abc0-0x0;var _0x2a25f5=_0x6644[_0x41abc0];return _0x2a25f5;};'use strict';var _=require('lodash');var util=require(_0x4664('0x0'));var moment=require(_0x4664('0x1'));var BPromise=require(_0x4664('0x2'));var rs=require(_0x4664('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4664('0x4'))['db'];var utils=require(_0x4664('0x5'));var logger=require(_0x4664('0x6'))(_0x4664('0x7'));var config=require(_0x4664('0x8'));var jayson=require(_0x4664('0x9'));var client=jayson[_0x4664('0xa')][_0x4664('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x232a03,_0x26d05b,_0x27fd5f){return new BPromise(function(_0x7a0978,_0x56da1a){return client['request'](_0x232a03,_0x27fd5f)['then'](function(_0x4f6b27){logger[_0x4664('0xc')]('ChatApplication,\x20%s,\x20%s',_0x26d05b,_0x4664('0xd'));logger['debug'](_0x4664('0xe'),_0x26d05b,'request\x20sent',JSON[_0x4664('0xf')](_0x4f6b27));if(_0x4f6b27[_0x4664('0x10')]){if(_0x4f6b27[_0x4664('0x10')]['code']===0x1f4){logger[_0x4664('0x10')](_0x4664('0x11'),_0x26d05b,_0x4f6b27[_0x4664('0x10')][_0x4664('0x12')]);return _0x56da1a(_0x4f6b27[_0x4664('0x10')][_0x4664('0x12')]);}logger[_0x4664('0x10')]('ChatApplication,\x20%s,\x20%s',_0x26d05b,_0x4f6b27['error'][_0x4664('0x12')]);return _0x7a0978(_0x4f6b27['error']['message']);}else{logger[_0x4664('0xc')]('ChatApplication,\x20%s,\x20%s',_0x26d05b,'request\x20sent');_0x7a0978(_0x4f6b27[_0x4664('0x13')][_0x4664('0x12')]);}})[_0x4664('0x14')](function(_0x11c48b){logger[_0x4664('0x10')](_0x4664('0x11'),_0x26d05b,_0x11c48b);_0x56da1a(_0x11c48b);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 50fb919..bcfccee 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 _0x17c4=['../../config/environment','./chatApplication.controller','get','isAuthenticated','show','/:id','update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1bd91c,_0x285e72){var _0x3bc43c=function(_0x5801c4){while(--_0x5801c4){_0x1bd91c['push'](_0x1bd91c['shift']());}};_0x3bc43c(++_0x285e72);}(_0x17c4,0x19d));var _0x417c=function(_0x24acc8,_0x268c25){_0x24acc8=_0x24acc8-0x0;var _0x2bb313=_0x17c4[_0x24acc8];return _0x2bb313;};'use strict';var multer=require(_0x417c('0x0'));var util=require('util');var path=require(_0x417c('0x1'));var timeout=require(_0x417c('0x2'));var express=require(_0x417c('0x3'));var router=express[_0x417c('0x4')]();var fs_extra=require(_0x417c('0x5'));var auth=require(_0x417c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x417c('0x7'));var controller=require(_0x417c('0x8'));router[_0x417c('0x9')]('/:id',auth[_0x417c('0xa')](),controller[_0x417c('0xb')]);router['put'](_0x417c('0xc'),auth['isAuthenticated'](),controller[_0x417c('0xd')]);router['delete'](_0x417c('0xc'),auth[_0x417c('0xa')](),controller[_0x417c('0xe')]);module['exports']=router; \ No newline at end of file +var _0x0cac=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','exports','multer','path','express'];(function(_0x5073a4,_0x3e27e2){var _0x15314a=function(_0x10be66){while(--_0x10be66){_0x5073a4['push'](_0x5073a4['shift']());}};_0x15314a(++_0x3e27e2);}(_0x0cac,0x1dd));var _0xc0ca=function(_0x27c5b4,_0x430385){_0x27c5b4=_0x27c5b4-0x0;var _0x1358ba=_0x0cac[_0x27c5b4];return _0x1358ba;};'use strict';var multer=require(_0xc0ca('0x0'));var util=require('util');var path=require(_0xc0ca('0x1'));var timeout=require('connect-timeout');var express=require(_0xc0ca('0x2'));var router=express[_0xc0ca('0x3')]();var fs_extra=require(_0xc0ca('0x4'));var auth=require(_0xc0ca('0x5'));var interaction=require(_0xc0ca('0x6'));var config=require('../../config/environment');var controller=require(_0xc0ca('0x7'));router[_0xc0ca('0x8')](_0xc0ca('0x9'),auth[_0xc0ca('0xa')](),controller[_0xc0ca('0xb')]);router[_0xc0ca('0xc')](_0xc0ca('0x9'),auth[_0xc0ca('0xa')](),controller[_0xc0ca('0xd')]);router['delete']('/:id',auth[_0xc0ca('0xa')](),controller['destroy']);module[_0xc0ca('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index ba44c3a..c032d56 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 _0xf77e=['STRING','BOOLEAN','sequelize','exports'];(function(_0x5d9be7,_0x529695){var _0x568237=function(_0x748649){while(--_0x748649){_0x5d9be7['push'](_0x5d9be7['shift']());}};_0x568237(++_0x529695);}(_0xf77e,0x15a));var _0xef77=function(_0xa7b72a,_0xb7e07c){_0xa7b72a=_0xa7b72a-0x0;var _0x41998a=_0xf77e[_0xa7b72a];return _0x41998a;};'use strict';var Sequelize=require(_0xef77('0x0'));module[_0xef77('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xef77('0x2')]},'write':{'type':Sequelize[_0xef77('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1921=['STRING','BOOLEAN','sequelize'];(function(_0x7e6b22,_0x4116fd){var _0x3f7e2a=function(_0xd26244){while(--_0xd26244){_0x7e6b22['push'](_0x7e6b22['shift']());}};_0x3f7e2a(++_0x4116fd);}(_0x1921,0xf2));var _0x1192=function(_0x36e87f,_0x4061cc){_0x36e87f=_0x36e87f-0x0;var _0x19d2ec=_0x1921[_0x36e87f];return _0x19d2ec;};'use strict';var Sequelize=require(_0x1192('0x0'));module['exports']={'name':{'type':Sequelize[_0x1192('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x1192('0x1')]},'write':{'type':Sequelize[_0x1192('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 7ed5850..1dcae9e 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 _0x808a=['describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','map','ChatGroup','fieldName','type','model','query','filters','intersection','attributes','fields','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','catch','show','params','keys','rawAttributes','length','includeAll','find','create','body'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x808a,0xd6));var _0xa808=function(_0x461930,_0x329a2a){_0x461930=_0x461930-0x0;var _0x382394=_0x808a[_0x461930];return _0x382394;};'use strict';var emlformat=require(_0xa808('0x0'));var rimraf=require(_0xa808('0x1'));var zipdir=require(_0xa808('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa808('0x3'));var moment=require(_0xa808('0x4'));var BPromise=require(_0xa808('0x5'));var Mustache=require(_0xa808('0x6'));var util=require(_0xa808('0x7'));var path=require(_0xa808('0x8'));var sox=require(_0xa808('0x9'));var csv=require(_0xa808('0xa'));var ejs=require(_0xa808('0xb'));var fs=require('fs');var fs_extra=require(_0xa808('0xc'));var _=require(_0xa808('0xd'));var squel=require(_0xa808('0xe'));var crypto=require(_0xa808('0xf'));var jsforce=require(_0xa808('0x10'));var deskjs=require(_0xa808('0x11'));var toCsv=require(_0xa808('0xa'));var querystring=require('querystring');var Papa=require(_0xa808('0x12'));var Redis=require(_0xa808('0x13'));var authService=require(_0xa808('0x14'));var qs=require(_0xa808('0x15'));var as=require(_0xa808('0x16'));var hardwareService=require(_0xa808('0x17'));var logger=require(_0xa808('0x18'))(_0xa808('0x19'));var utils=require(_0xa808('0x1a'));var config=require(_0xa808('0x1b'));var licenseUtil=require(_0xa808('0x1c'));var db=require(_0xa808('0x1d'))['db'];config[_0xa808('0x1e')]=_[_0xa808('0x1f')](config[_0xa808('0x1e')],{'host':_0xa808('0x20'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa808('0x1e')]));require('./chatGroup.socket')['register'](socket);function respondWithStatusCode(_0x4c2453,_0x553d23){_0x553d23=_0x553d23||0xcc;return function(_0x2fca9f){if(_0x2fca9f){return _0x4c2453[_0xa808('0x21')](_0x553d23);}return _0x4c2453[_0xa808('0x22')](_0x553d23)[_0xa808('0x23')]();};}function respondWithResult(_0x2b2a28,_0x2c1bcc){_0x2c1bcc=_0x2c1bcc||0xc8;return function(_0x1faf22){if(_0x1faf22){return _0x2b2a28[_0xa808('0x22')](_0x2c1bcc)[_0xa808('0x24')](_0x1faf22);}};}function respondWithFilteredResult(_0x20721e,_0x13dedb){return function(_0x3375d9){if(_0x3375d9){var _0x14a399=typeof _0x13dedb[_0xa808('0x25')]===_0xa808('0x26')&&typeof _0x13dedb['limit']===_0xa808('0x26');var _0x23b59e=_0x3375d9[_0xa808('0x27')];var _0x2ebe3b=_0x14a399?0x0:_0x13dedb[_0xa808('0x25')];var _0x45cb67=_0x14a399?_0x3375d9['count']:_0x13dedb['offset']+_0x13dedb[_0xa808('0x28')];var _0xd2322e;if(_0x45cb67>=_0x23b59e){_0x45cb67=_0x23b59e;_0xd2322e=0xc8;}else{_0xd2322e=0xce;}_0x20721e[_0xa808('0x22')](_0xd2322e);return _0x20721e[_0xa808('0x29')](_0xa808('0x2a'),_0x2ebe3b+'-'+_0x45cb67+'/'+_0x23b59e)[_0xa808('0x24')](_0x3375d9);}return null;};}function patchUpdates(_0x30836d){return function(_0xe24594){try{jsonpatch[_0xa808('0x2b')](_0xe24594,_0x30836d,!![]);}catch(_0x2b2206){return BPromise['reject'](_0x2b2206);}return _0xe24594[_0xa808('0x2c')]();};}function saveUpdates(_0x164a57,_0x5a5899){return function(_0x2374ce){if(_0x2374ce){return _0x2374ce[_0xa808('0x2d')](_0x164a57)['then'](function(_0x1196a6){return _0x1196a6;});}return null;};}function removeEntity(_0x4083ab,_0x2a6e6e){return function(_0x431665){if(_0x431665){return _0x431665[_0xa808('0x2e')]()[_0xa808('0x2f')](function(){_0x4083ab[_0xa808('0x22')](0xcc)[_0xa808('0x23')]();});}};}function handleEntityNotFound(_0x579576,_0x30ab5a){return function(_0x90d89f){if(!_0x90d89f){_0x579576[_0xa808('0x21')](0x194);}return _0x90d89f;};}function handleError(_0x322db2,_0x4cff5e){_0x4cff5e=_0x4cff5e||0x1f4;return function(_0x54963d){logger[_0xa808('0x30')](_0x54963d[_0xa808('0x31')]);if(_0x54963d['name']){delete _0x54963d[_0xa808('0x32')];}_0x322db2[_0xa808('0x22')](_0x4cff5e)['send'](_0x54963d);};}exports['index']=function(_0x1b334a,_0x260191){var _0x39de09={},_0x3875f8={},_0x1f0a2c={'count':0x0,'rows':[]};var _0x2df288=_[_0xa808('0x33')](db[_0xa808('0x34')]['rawAttributes'],function(_0x1dc10f){return{'name':_0x1dc10f[_0xa808('0x35')],'type':_0x1dc10f[_0xa808('0x36')]['key']};});_0x3875f8[_0xa808('0x37')]=_[_0xa808('0x33')](_0x2df288,'name');_0x3875f8[_0xa808('0x38')]=_['keys'](_0x1b334a['query']);_0x3875f8[_0xa808('0x39')]=_[_0xa808('0x3a')](_0x3875f8[_0xa808('0x37')],_0x3875f8['query']);_0x39de09[_0xa808('0x3b')]=_[_0xa808('0x3a')](_0x3875f8[_0xa808('0x37')],qs[_0xa808('0x3c')](_0x1b334a['query'][_0xa808('0x3c')]));_0x39de09[_0xa808('0x3b')]=_0x39de09['attributes']['length']?_0x39de09['attributes']:_0x3875f8[_0xa808('0x37')];if(!_0x1b334a[_0xa808('0x38')]['hasOwnProperty']('nolimit')){_0x39de09[_0xa808('0x28')]=qs['limit'](_0x1b334a[_0xa808('0x38')][_0xa808('0x28')]);_0x39de09[_0xa808('0x25')]=qs['offset'](_0x1b334a['query'][_0xa808('0x25')]);}_0x39de09[_0xa808('0x3d')]=qs[_0xa808('0x3e')](_0x1b334a[_0xa808('0x38')][_0xa808('0x3e')]);_0x39de09['where']=qs[_0xa808('0x39')](_[_0xa808('0x3f')](_0x1b334a[_0xa808('0x38')],_0x3875f8[_0xa808('0x39')]),_0x2df288);if(_0x1b334a['query'][_0xa808('0x40')]){_0x39de09[_0xa808('0x41')]=_[_0xa808('0x42')](_0x39de09[_0xa808('0x41')],{'$or':_[_0xa808('0x33')](_0x2df288,function(_0x339bc1){if(_0x339bc1['type']!==_0xa808('0x43')){var _0x1d8d1d={};_0x1d8d1d[_0x339bc1[_0xa808('0x32')]]={'$like':'%'+_0x1b334a['query'][_0xa808('0x40')]+'%'};return _0x1d8d1d;}})});}_0x39de09=_['merge']({},_0x39de09,_0x1b334a[_0xa808('0x44')]);var _0x2c603b={'where':_0x39de09['where']};return db['ChatGroup'][_0xa808('0x27')](_0x2c603b)[_0xa808('0x2f')](function(_0x1ba55d){_0x1f0a2c[_0xa808('0x27')]=_0x1ba55d;if(_0x1b334a[_0xa808('0x38')]['includeAll']){_0x39de09['include']=[{'all':!![]}];}return db[_0xa808('0x34')][_0xa808('0x45')](_0x39de09);})['then'](function(_0x4db0c8){_0x1f0a2c['rows']=_0x4db0c8;return _0x1f0a2c;})['then'](respondWithFilteredResult(_0x260191,_0x39de09))[_0xa808('0x46')](handleError(_0x260191,null));};exports[_0xa808('0x47')]=function(_0x53f2ec,_0x49ba33){var _0xa0e74c={'raw':!![],'where':{'id':_0x53f2ec[_0xa808('0x48')]['id']}},_0x54782a={};_0x54782a[_0xa808('0x37')]=_[_0xa808('0x49')](db['ChatGroup'][_0xa808('0x4a')]);_0x54782a[_0xa808('0x38')]=_[_0xa808('0x49')](_0x53f2ec['query']);_0x54782a[_0xa808('0x39')]=_['intersection'](_0x54782a['model'],_0x54782a[_0xa808('0x38')]);_0xa0e74c[_0xa808('0x3b')]=_[_0xa808('0x3a')](_0x54782a[_0xa808('0x37')],qs[_0xa808('0x3c')](_0x53f2ec[_0xa808('0x38')][_0xa808('0x3c')]));_0xa0e74c[_0xa808('0x3b')]=_0xa0e74c[_0xa808('0x3b')][_0xa808('0x4b')]?_0xa0e74c[_0xa808('0x3b')]:_0x54782a[_0xa808('0x37')];if(_0x53f2ec[_0xa808('0x38')][_0xa808('0x4c')]){_0xa0e74c['include']=[{'all':!![]}];}_0xa0e74c=_['merge']({},_0xa0e74c,_0x53f2ec[_0xa808('0x44')]);return db['ChatGroup'][_0xa808('0x4d')](_0xa0e74c)[_0xa808('0x2f')](handleEntityNotFound(_0x49ba33,null))[_0xa808('0x2f')](respondWithResult(_0x49ba33,null))['catch'](handleError(_0x49ba33,null));};exports[_0xa808('0x4e')]=function(_0x38de93,_0x39f4a7){return db[_0xa808('0x34')][_0xa808('0x4e')](_0x38de93[_0xa808('0x4f')],{})['then'](respondWithResult(_0x39f4a7,0xc9))[_0xa808('0x46')](handleError(_0x39f4a7,null));};exports[_0xa808('0x2d')]=function(_0xdaa8fd,_0x309451){if(_0xdaa8fd[_0xa808('0x4f')]['id']){delete _0xdaa8fd[_0xa808('0x4f')]['id'];}return db[_0xa808('0x34')][_0xa808('0x4d')]({'where':{'id':_0xdaa8fd[_0xa808('0x48')]['id']}})[_0xa808('0x2f')](handleEntityNotFound(_0x309451,null))[_0xa808('0x2f')](saveUpdates(_0xdaa8fd[_0xa808('0x4f')],null))[_0xa808('0x2f')](respondWithResult(_0x309451,null))[_0xa808('0x46')](handleError(_0x309451,null));};exports['destroy']=function(_0x2e3ea6,_0xb1762f){return db[_0xa808('0x34')][_0xa808('0x4d')]({'where':{'id':_0x2e3ea6[_0xa808('0x48')]['id']}})[_0xa808('0x2f')](handleEntityNotFound(_0xb1762f,null))[_0xa808('0x2f')](removeEntity(_0xb1762f,null))['catch'](handleError(_0xb1762f,null));};exports['describe']=function(_0x28ee1b,_0x118660){return db[_0xa808('0x34')][_0xa808('0x50')]()['then'](respondWithResult(_0x118660,null))[_0xa808('0x46')](handleError(_0x118660,null));};exports[_0xa808('0x51')]=function(_0x5b25ea,_0x5e5f5d,_0x38b22){return db[_0xa808('0x52')][_0xa808('0x27')]({'where':{'ChatGroupId':_0x5b25ea['params']['id'],'ToId':_0x5b25ea[_0xa808('0x53')]['id'],'read':![]}})[_0xa808('0x2f')](function(_0x439193){return{'id':_[_0xa808('0x54')](_0x5b25ea['params']['id']),'count':_0x439193};})[_0xa808('0x2f')](respondWithResult(_0x5e5f5d,null))['catch'](handleError(_0x5e5f5d,null));};exports[_0xa808('0x55')]=function(_0x57a0d1,_0x436d95,_0x3e01b3){return db[_0xa808('0x34')]['find']({'where':{'id':_0x57a0d1[_0xa808('0x48')]['id']}})[_0xa808('0x2f')](handleEntityNotFound(_0x436d95,null))[_0xa808('0x2f')](function(_0x393124){if(_0x393124){return _0x393124[_0xa808('0x55')](_0x57a0d1[_0xa808('0x4f')][_0xa808('0x56')],_['omit'](_0x57a0d1[_0xa808('0x4f')],['ids','id'])||{});}})[_0xa808('0x2f')](respondWithResult(_0x436d95,null))[_0xa808('0x46')](handleError(_0x436d95,null));};exports[_0xa808('0x57')]=function(_0x12a0b5,_0x2eded4,_0x135ad6){var _0x4d3e5b={};var _0x531326={};var _0x4ab58c;var _0x56dd19;return db[_0xa808('0x34')][_0xa808('0x58')]({'where':{'id':_0x12a0b5['params']['id']}})[_0xa808('0x2f')](handleEntityNotFound(_0x2eded4,null))[_0xa808('0x2f')](function(_0x2762e0){if(_0x2762e0){_0x4ab58c=_0x2762e0;_0x531326[_0xa808('0x37')]=_['keys'](db['User'][_0xa808('0x4a')]);_0x531326[_0xa808('0x38')]=_[_0xa808('0x49')](_0x12a0b5[_0xa808('0x38')]);_0x531326[_0xa808('0x39')]=_[_0xa808('0x3a')](_0x531326[_0xa808('0x37')],_0x531326[_0xa808('0x38')]);_0x4d3e5b['attributes']=_[_0xa808('0x3a')](_0x531326['model'],qs[_0xa808('0x3c')](_0x12a0b5[_0xa808('0x38')][_0xa808('0x3c')]));_0x4d3e5b[_0xa808('0x3b')]=_0x4d3e5b[_0xa808('0x3b')][_0xa808('0x4b')]?_0x4d3e5b[_0xa808('0x3b')]:_0x531326[_0xa808('0x37')];_0x4d3e5b['order']=qs[_0xa808('0x3e')](_0x12a0b5[_0xa808('0x38')][_0xa808('0x3e')]);_0x4d3e5b[_0xa808('0x41')]=qs[_0xa808('0x39')](_[_0xa808('0x3f')](_0x12a0b5['query'],_0x531326[_0xa808('0x39')]));if(_0x12a0b5['query'][_0xa808('0x40')]){_0x4d3e5b[_0xa808('0x41')]=_[_0xa808('0x42')](_0x4d3e5b['where'],{'$or':_['map'](_0x4d3e5b[_0xa808('0x3b')],function(_0x6c9efb){var _0x393199={};_0x393199[_0x6c9efb]={'$like':'%'+_0x12a0b5[_0xa808('0x38')][_0xa808('0x40')]+'%'};return _0x393199;})});}_0x4d3e5b=_['merge']({},_0x4d3e5b,_0x12a0b5[_0xa808('0x44')]);return _0x4ab58c[_0xa808('0x57')](_0x4d3e5b);}})[_0xa808('0x2f')](function(_0x34e3ac){if(_0x34e3ac){_0x56dd19=_0x34e3ac[_0xa808('0x4b')];if(!_0x12a0b5[_0xa808('0x38')][_0xa808('0x59')](_0xa808('0x5a'))){_0x4d3e5b[_0xa808('0x28')]=qs['limit'](_0x12a0b5[_0xa808('0x38')][_0xa808('0x28')]);_0x4d3e5b['offset']=qs[_0xa808('0x25')](_0x12a0b5['query'][_0xa808('0x25')]);}return _0x4ab58c[_0xa808('0x57')](_0x4d3e5b);}})[_0xa808('0x2f')](function(_0x381073){if(_0x381073){return _0x381073?{'count':_0x56dd19,'rows':_0x381073}:null;}})[_0xa808('0x2f')](respondWithResult(_0x2eded4,null))[_0xa808('0x46')](handleError(_0x2eded4,null));};exports['removeMembers']=function(_0x487ab8,_0x10c4af,_0x4f31e7){return db[_0xa808('0x34')][_0xa808('0x4d')]({'where':{'id':_0x487ab8[_0xa808('0x48')]['id']}})[_0xa808('0x2f')](handleEntityNotFound(_0x10c4af,null))[_0xa808('0x2f')](function(_0x3addb1){if(_0x3addb1){return _0x3addb1[_0xa808('0x5b')](_0x487ab8[_0xa808('0x38')][_0xa808('0x56')]);}})['then'](respondWithStatusCode(_0x10c4af,null))['catch'](handleError(_0x10c4af,null));};exports[_0xa808('0x5c')]=function(_0x4905b7,_0x1e2960,_0x2fcc59){if(_0x4905b7[_0xa808('0x4f')]['id']){delete _0x4905b7['body']['id'];}return db[_0xa808('0x34')][_0xa808('0x4d')]({'where':{'id':_0x4905b7[_0xa808('0x48')]['id']}})[_0xa808('0x2f')](handleEntityNotFound(_0x1e2960,null))[_0xa808('0x2f')](function(_0x4ed39c){if(_0x4ed39c){_0x4905b7[_0xa808('0x4f')][_0xa808('0x5d')]=_0x4ed39c['id'];return db[_0xa808('0x52')][_0xa808('0x4e')](_0x4905b7[_0xa808('0x4f')]);}})['then'](respondWithResult(_0x1e2960,null))[_0xa808('0x46')](handleError(_0x1e2960,null));};exports[_0xa808('0x5e')]=function(_0x5785c0,_0x3dd368,_0x57e489){var _0x4807b1={};var _0x58f795={};var _0x5b3b68;var _0xd371ea;return db[_0xa808('0x34')][_0xa808('0x58')]({'where':{'id':_0x5785c0[_0xa808('0x48')]['id']}})['then'](handleEntityNotFound(_0x3dd368,null))[_0xa808('0x2f')](function(_0x44b6d9){if(_0x44b6d9){_0x5b3b68=_0x44b6d9;_0x58f795[_0xa808('0x37')]=_['keys'](db[_0xa808('0x52')][_0xa808('0x4a')]);_0x58f795[_0xa808('0x38')]=_[_0xa808('0x49')](_0x5785c0['query']);_0x58f795[_0xa808('0x39')]=_[_0xa808('0x3a')](_0x58f795[_0xa808('0x37')],_0x58f795[_0xa808('0x38')]);_0x4807b1[_0xa808('0x3b')]=_[_0xa808('0x3a')](_0x58f795[_0xa808('0x37')],qs[_0xa808('0x3c')](_0x5785c0[_0xa808('0x38')]['fields']));_0x4807b1['attributes']=_0x4807b1['attributes'][_0xa808('0x4b')]?_0x4807b1[_0xa808('0x3b')]:_0x58f795['model'];_0x4807b1[_0xa808('0x3d')]=qs['sort'](_0x5785c0['query'][_0xa808('0x3e')]);_0x4807b1[_0xa808('0x41')]=qs[_0xa808('0x39')](_[_0xa808('0x3f')](_0x5785c0['query'],_0x58f795['filters']));if(_0x5785c0['query']['filter']){_0x4807b1[_0xa808('0x41')]=_['merge'](_0x4807b1[_0xa808('0x41')],{'$or':_[_0xa808('0x33')](_0x4807b1[_0xa808('0x3b')],function(_0x2c5ca9){var _0xcaba61={};_0xcaba61[_0x2c5ca9]={'$like':'%'+_0x5785c0[_0xa808('0x38')][_0xa808('0x40')]+'%'};return _0xcaba61;})});}if(_0x5785c0['query']['$gte']){var _0x428abb=_0x5785c0['query']['$gte'][_0xa808('0x5f')](',');var _0x1b0b55={};_0x1b0b55[_0x428abb[0x0]]={'$gte':moment(_0x428abb[0x1])[_0xa808('0x60')](_0xa808('0x61'))};_0x4807b1[_0xa808('0x41')]=_[_0xa808('0x42')](_0x4807b1['where'],_0x1b0b55);}_0x4807b1=_[_0xa808('0x42')]({},_0x4807b1,_0x5785c0[_0xa808('0x44')]);return _0x5b3b68[_0xa808('0x5e')](_0x4807b1);}})[_0xa808('0x2f')](function(_0x2ff172){if(_0x2ff172){_0xd371ea=_0x2ff172['length'];if(!_0x5785c0[_0xa808('0x38')]['hasOwnProperty'](_0xa808('0x5a'))){_0x4807b1['limit']=qs[_0xa808('0x28')](_0x5785c0[_0xa808('0x38')][_0xa808('0x28')]);_0x4807b1[_0xa808('0x25')]=qs[_0xa808('0x25')](_0x5785c0[_0xa808('0x38')][_0xa808('0x25')]);}return _0x5b3b68[_0xa808('0x5e')](_0x4807b1);}})['then'](function(_0xa4df6d){if(_0xa4df6d){return _0xa4df6d?{'count':_0xd371ea,'rows':_0xa4df6d}:null;}})['then'](respondWithResult(_0x3dd368,null))['catch'](handleError(_0x3dd368,null));}; \ No newline at end of file +var _0xfa17=['update','then','error','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','ChatGroup','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','describe','getUnread','ChatInternalMessage','user','addMembers','ids','findOne','User','getMembers','removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','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/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply'];(function(_0x568eca,_0x549174){var _0x767192=function(_0x4bc377){while(--_0x4bc377){_0x568eca['push'](_0x568eca['shift']());}};_0x767192(++_0x549174);}(_0xfa17,0x1b3));var _0x7fa1=function(_0x24e3ca,_0x4c951e){_0x24e3ca=_0x24e3ca-0x0;var _0x9204aa=_0xfa17[_0x24e3ca];return _0x9204aa;};'use strict';var emlformat=require(_0x7fa1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7fa1('0x1'));var jsonpatch=require(_0x7fa1('0x2'));var rp=require(_0x7fa1('0x3'));var moment=require(_0x7fa1('0x4'));var BPromise=require(_0x7fa1('0x5'));var Mustache=require(_0x7fa1('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7fa1('0x7'));var csv=require(_0x7fa1('0x8'));var ejs=require(_0x7fa1('0x9'));var fs=require('fs');var fs_extra=require(_0x7fa1('0xa'));var _=require('lodash');var squel=require(_0x7fa1('0xb'));var crypto=require(_0x7fa1('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7fa1('0xd'));var toCsv=require(_0x7fa1('0x8'));var querystring=require(_0x7fa1('0xe'));var Papa=require(_0x7fa1('0xf'));var Redis=require('ioredis');var authService=require(_0x7fa1('0x10'));var qs=require(_0x7fa1('0x11'));var as=require(_0x7fa1('0x12'));var hardwareService=require(_0x7fa1('0x13'));var logger=require(_0x7fa1('0x14'))(_0x7fa1('0x15'));var utils=require(_0x7fa1('0x16'));var config=require(_0x7fa1('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7fa1('0x18'))['db'];config['redis']=_[_0x7fa1('0x19')](config['redis'],{'host':_0x7fa1('0x1a'),'port':0x18eb});var socket=require(_0x7fa1('0x1b'))(new Redis(config[_0x7fa1('0x1c')]));require(_0x7fa1('0x1d'))['register'](socket);function respondWithStatusCode(_0x3d4dd9,_0x23c6a8){_0x23c6a8=_0x23c6a8||0xcc;return function(_0x374c24){if(_0x374c24){return _0x3d4dd9[_0x7fa1('0x1e')](_0x23c6a8);}return _0x3d4dd9['status'](_0x23c6a8)[_0x7fa1('0x1f')]();};}function respondWithResult(_0x1807d3,_0x149a91){_0x149a91=_0x149a91||0xc8;return function(_0x5df245){if(_0x5df245){return _0x1807d3[_0x7fa1('0x20')](_0x149a91)[_0x7fa1('0x21')](_0x5df245);}};}function respondWithFilteredResult(_0x2b6112,_0x7c3003){return function(_0x581e91){if(_0x581e91){var _0x4008c4=typeof _0x7c3003[_0x7fa1('0x22')]==='undefined'&&typeof _0x7c3003['limit']==='undefined';var _0x57b268=_0x581e91[_0x7fa1('0x23')];var _0xdee8a0=_0x4008c4?0x0:_0x7c3003[_0x7fa1('0x22')];var _0x49d4e5=_0x4008c4?_0x581e91[_0x7fa1('0x23')]:_0x7c3003[_0x7fa1('0x22')]+_0x7c3003[_0x7fa1('0x24')];var _0x541cca;if(_0x49d4e5>=_0x57b268){_0x49d4e5=_0x57b268;_0x541cca=0xc8;}else{_0x541cca=0xce;}_0x2b6112['status'](_0x541cca);return _0x2b6112[_0x7fa1('0x25')](_0x7fa1('0x26'),_0xdee8a0+'-'+_0x49d4e5+'/'+_0x57b268)['json'](_0x581e91);}return null;};}function patchUpdates(_0x515050){return function(_0x24b106){try{jsonpatch[_0x7fa1('0x27')](_0x24b106,_0x515050,!![]);}catch(_0x5232f2){return BPromise['reject'](_0x5232f2);}return _0x24b106['save']();};}function saveUpdates(_0x1a6ad2,_0x4d9470){return function(_0x490c88){if(_0x490c88){return _0x490c88[_0x7fa1('0x28')](_0x1a6ad2)[_0x7fa1('0x29')](function(_0x13ac85){return _0x13ac85;});}return null;};}function removeEntity(_0x335762,_0x31ae4a){return function(_0x130324){if(_0x130324){return _0x130324['destroy']()[_0x7fa1('0x29')](function(){_0x335762['status'](0xcc)[_0x7fa1('0x1f')]();});}};}function handleEntityNotFound(_0x39643f,_0x546831){return function(_0x495a35){if(!_0x495a35){_0x39643f['sendStatus'](0x194);}return _0x495a35;};}function handleError(_0x1d9d93,_0x5bb17b){_0x5bb17b=_0x5bb17b||0x1f4;return function(_0x4a662){logger[_0x7fa1('0x2a')](_0x4a662['stack']);if(_0x4a662[_0x7fa1('0x2b')]){delete _0x4a662['name'];}_0x1d9d93['status'](_0x5bb17b)[_0x7fa1('0x2c')](_0x4a662);};}exports[_0x7fa1('0x2d')]=function(_0x5d1589,_0x4ea37a){var _0x333931={},_0xc34c9c={},_0x34b89b={'count':0x0,'rows':[]};var _0x90aee1=_['map'](db['ChatGroup'][_0x7fa1('0x2e')],function(_0x5cbd5f){return{'name':_0x5cbd5f[_0x7fa1('0x2f')],'type':_0x5cbd5f['type'][_0x7fa1('0x30')]};});_0xc34c9c[_0x7fa1('0x31')]=_[_0x7fa1('0x32')](_0x90aee1,_0x7fa1('0x2b'));_0xc34c9c[_0x7fa1('0x33')]=_[_0x7fa1('0x34')](_0x5d1589[_0x7fa1('0x33')]);_0xc34c9c[_0x7fa1('0x35')]=_[_0x7fa1('0x36')](_0xc34c9c['model'],_0xc34c9c[_0x7fa1('0x33')]);_0x333931[_0x7fa1('0x37')]=_[_0x7fa1('0x36')](_0xc34c9c[_0x7fa1('0x31')],qs[_0x7fa1('0x38')](_0x5d1589[_0x7fa1('0x33')][_0x7fa1('0x38')]));_0x333931[_0x7fa1('0x37')]=_0x333931[_0x7fa1('0x37')][_0x7fa1('0x39')]?_0x333931[_0x7fa1('0x37')]:_0xc34c9c[_0x7fa1('0x31')];if(!_0x5d1589['query'][_0x7fa1('0x3a')](_0x7fa1('0x3b'))){_0x333931[_0x7fa1('0x24')]=qs[_0x7fa1('0x24')](_0x5d1589[_0x7fa1('0x33')]['limit']);_0x333931[_0x7fa1('0x22')]=qs['offset'](_0x5d1589[_0x7fa1('0x33')][_0x7fa1('0x22')]);}_0x333931[_0x7fa1('0x3c')]=qs[_0x7fa1('0x3d')](_0x5d1589[_0x7fa1('0x33')][_0x7fa1('0x3d')]);_0x333931['where']=qs['filters'](_[_0x7fa1('0x3e')](_0x5d1589['query'],_0xc34c9c[_0x7fa1('0x35')]),_0x90aee1);if(_0x5d1589[_0x7fa1('0x33')][_0x7fa1('0x3f')]){_0x333931[_0x7fa1('0x40')]=_['merge'](_0x333931[_0x7fa1('0x40')],{'$or':_[_0x7fa1('0x32')](_0x90aee1,function(_0x47e792){if(_0x47e792['type']!=='VIRTUAL'){var _0x43a708={};_0x43a708[_0x47e792['name']]={'$like':'%'+_0x5d1589[_0x7fa1('0x33')][_0x7fa1('0x3f')]+'%'};return _0x43a708;}})});}_0x333931=_[_0x7fa1('0x41')]({},_0x333931,_0x5d1589[_0x7fa1('0x42')]);var _0x377854={'where':_0x333931['where']};return db[_0x7fa1('0x43')][_0x7fa1('0x23')](_0x377854)[_0x7fa1('0x29')](function(_0x15e530){_0x34b89b[_0x7fa1('0x23')]=_0x15e530;if(_0x5d1589[_0x7fa1('0x33')][_0x7fa1('0x44')]){_0x333931[_0x7fa1('0x45')]=[{'all':!![]}];}return db[_0x7fa1('0x43')][_0x7fa1('0x46')](_0x333931);})[_0x7fa1('0x29')](function(_0x74e749){_0x34b89b[_0x7fa1('0x47')]=_0x74e749;return _0x34b89b;})[_0x7fa1('0x29')](respondWithFilteredResult(_0x4ea37a,_0x333931))['catch'](handleError(_0x4ea37a,null));};exports[_0x7fa1('0x48')]=function(_0x4073f4,_0x2afe27){var _0x29e138={'raw':!![],'where':{'id':_0x4073f4[_0x7fa1('0x49')]['id']}},_0x4b51cc={};_0x4b51cc[_0x7fa1('0x31')]=_[_0x7fa1('0x34')](db[_0x7fa1('0x43')][_0x7fa1('0x2e')]);_0x4b51cc[_0x7fa1('0x33')]=_['keys'](_0x4073f4['query']);_0x4b51cc['filters']=_[_0x7fa1('0x36')](_0x4b51cc[_0x7fa1('0x31')],_0x4b51cc[_0x7fa1('0x33')]);_0x29e138[_0x7fa1('0x37')]=_[_0x7fa1('0x36')](_0x4b51cc[_0x7fa1('0x31')],qs[_0x7fa1('0x38')](_0x4073f4['query'][_0x7fa1('0x38')]));_0x29e138[_0x7fa1('0x37')]=_0x29e138['attributes'][_0x7fa1('0x39')]?_0x29e138[_0x7fa1('0x37')]:_0x4b51cc['model'];if(_0x4073f4[_0x7fa1('0x33')][_0x7fa1('0x44')]){_0x29e138['include']=[{'all':!![]}];}_0x29e138=_[_0x7fa1('0x41')]({},_0x29e138,_0x4073f4[_0x7fa1('0x42')]);return db[_0x7fa1('0x43')][_0x7fa1('0x4a')](_0x29e138)[_0x7fa1('0x29')](handleEntityNotFound(_0x2afe27,null))[_0x7fa1('0x29')](respondWithResult(_0x2afe27,null))[_0x7fa1('0x4b')](handleError(_0x2afe27,null));};exports[_0x7fa1('0x4c')]=function(_0x30224c,_0x22acd0){return db[_0x7fa1('0x43')]['create'](_0x30224c[_0x7fa1('0x4d')],{})[_0x7fa1('0x29')](respondWithResult(_0x22acd0,0xc9))[_0x7fa1('0x4b')](handleError(_0x22acd0,null));};exports['update']=function(_0x51c7b2,_0x17b24b){if(_0x51c7b2['body']['id']){delete _0x51c7b2[_0x7fa1('0x4d')]['id'];}return db[_0x7fa1('0x43')][_0x7fa1('0x4a')]({'where':{'id':_0x51c7b2[_0x7fa1('0x49')]['id']}})[_0x7fa1('0x29')](handleEntityNotFound(_0x17b24b,null))['then'](saveUpdates(_0x51c7b2[_0x7fa1('0x4d')],null))[_0x7fa1('0x29')](respondWithResult(_0x17b24b,null))['catch'](handleError(_0x17b24b,null));};exports[_0x7fa1('0x4e')]=function(_0x335333,_0x1d8607){return db[_0x7fa1('0x43')]['find']({'where':{'id':_0x335333[_0x7fa1('0x49')]['id']}})[_0x7fa1('0x29')](handleEntityNotFound(_0x1d8607,null))[_0x7fa1('0x29')](removeEntity(_0x1d8607,null))[_0x7fa1('0x4b')](handleError(_0x1d8607,null));};exports[_0x7fa1('0x4f')]=function(_0x178eac,_0x33ca55){return db['ChatGroup']['describe']()[_0x7fa1('0x29')](respondWithResult(_0x33ca55,null))[_0x7fa1('0x4b')](handleError(_0x33ca55,null));};exports[_0x7fa1('0x50')]=function(_0x4ab5c8,_0x15a920,_0x4cc30a){return db[_0x7fa1('0x51')][_0x7fa1('0x23')]({'where':{'ChatGroupId':_0x4ab5c8[_0x7fa1('0x49')]['id'],'ToId':_0x4ab5c8[_0x7fa1('0x52')]['id'],'read':![]}})[_0x7fa1('0x29')](function(_0x10afdd){return{'id':_['toInteger'](_0x4ab5c8['params']['id']),'count':_0x10afdd};})['then'](respondWithResult(_0x15a920,null))[_0x7fa1('0x4b')](handleError(_0x15a920,null));};exports[_0x7fa1('0x53')]=function(_0x5a7c7c,_0x21a634,_0xdfeae6){return db[_0x7fa1('0x43')][_0x7fa1('0x4a')]({'where':{'id':_0x5a7c7c['params']['id']}})[_0x7fa1('0x29')](handleEntityNotFound(_0x21a634,null))[_0x7fa1('0x29')](function(_0x1c53e0){if(_0x1c53e0){return _0x1c53e0['addMembers'](_0x5a7c7c[_0x7fa1('0x4d')][_0x7fa1('0x54')],_['omit'](_0x5a7c7c[_0x7fa1('0x4d')],[_0x7fa1('0x54'),'id'])||{});}})[_0x7fa1('0x29')](respondWithResult(_0x21a634,null))[_0x7fa1('0x4b')](handleError(_0x21a634,null));};exports['getMembers']=function(_0x511ab0,_0xe57909,_0x39d396){var _0x4d034a={};var _0x12d7d3={};var _0x4b6e4a;var _0x23e8af;return db[_0x7fa1('0x43')][_0x7fa1('0x55')]({'where':{'id':_0x511ab0[_0x7fa1('0x49')]['id']}})[_0x7fa1('0x29')](handleEntityNotFound(_0xe57909,null))[_0x7fa1('0x29')](function(_0x4c4f14){if(_0x4c4f14){_0x4b6e4a=_0x4c4f14;_0x12d7d3[_0x7fa1('0x31')]=_[_0x7fa1('0x34')](db[_0x7fa1('0x56')][_0x7fa1('0x2e')]);_0x12d7d3[_0x7fa1('0x33')]=_[_0x7fa1('0x34')](_0x511ab0[_0x7fa1('0x33')]);_0x12d7d3[_0x7fa1('0x35')]=_['intersection'](_0x12d7d3['model'],_0x12d7d3['query']);_0x4d034a[_0x7fa1('0x37')]=_[_0x7fa1('0x36')](_0x12d7d3[_0x7fa1('0x31')],qs['fields'](_0x511ab0[_0x7fa1('0x33')][_0x7fa1('0x38')]));_0x4d034a[_0x7fa1('0x37')]=_0x4d034a[_0x7fa1('0x37')][_0x7fa1('0x39')]?_0x4d034a[_0x7fa1('0x37')]:_0x12d7d3['model'];_0x4d034a[_0x7fa1('0x3c')]=qs[_0x7fa1('0x3d')](_0x511ab0[_0x7fa1('0x33')][_0x7fa1('0x3d')]);_0x4d034a[_0x7fa1('0x40')]=qs['filters'](_[_0x7fa1('0x3e')](_0x511ab0['query'],_0x12d7d3[_0x7fa1('0x35')]));if(_0x511ab0['query'][_0x7fa1('0x3f')]){_0x4d034a[_0x7fa1('0x40')]=_[_0x7fa1('0x41')](_0x4d034a[_0x7fa1('0x40')],{'$or':_[_0x7fa1('0x32')](_0x4d034a[_0x7fa1('0x37')],function(_0x345d57){var _0x18387e={};_0x18387e[_0x345d57]={'$like':'%'+_0x511ab0['query']['filter']+'%'};return _0x18387e;})});}_0x4d034a=_[_0x7fa1('0x41')]({},_0x4d034a,_0x511ab0[_0x7fa1('0x42')]);return _0x4b6e4a[_0x7fa1('0x57')](_0x4d034a);}})['then'](function(_0x4208f0){if(_0x4208f0){_0x23e8af=_0x4208f0[_0x7fa1('0x39')];if(!_0x511ab0[_0x7fa1('0x33')][_0x7fa1('0x3a')](_0x7fa1('0x3b'))){_0x4d034a['limit']=qs[_0x7fa1('0x24')](_0x511ab0['query'][_0x7fa1('0x24')]);_0x4d034a['offset']=qs[_0x7fa1('0x22')](_0x511ab0[_0x7fa1('0x33')][_0x7fa1('0x22')]);}return _0x4b6e4a['getMembers'](_0x4d034a);}})[_0x7fa1('0x29')](function(_0x3f6a38){if(_0x3f6a38){return _0x3f6a38?{'count':_0x23e8af,'rows':_0x3f6a38}:null;}})['then'](respondWithResult(_0xe57909,null))['catch'](handleError(_0xe57909,null));};exports[_0x7fa1('0x58')]=function(_0x555b77,_0x432156,_0x3cef51){return db[_0x7fa1('0x43')][_0x7fa1('0x4a')]({'where':{'id':_0x555b77[_0x7fa1('0x49')]['id']}})['then'](handleEntityNotFound(_0x432156,null))['then'](function(_0x2ad6e5){if(_0x2ad6e5){return _0x2ad6e5[_0x7fa1('0x58')](_0x555b77[_0x7fa1('0x33')][_0x7fa1('0x54')]);}})[_0x7fa1('0x29')](respondWithStatusCode(_0x432156,null))[_0x7fa1('0x4b')](handleError(_0x432156,null));};exports[_0x7fa1('0x59')]=function(_0x4da86a,_0x5780ba,_0x31f844){if(_0x4da86a[_0x7fa1('0x4d')]['id']){delete _0x4da86a[_0x7fa1('0x4d')]['id'];}return db['ChatGroup'][_0x7fa1('0x4a')]({'where':{'id':_0x4da86a[_0x7fa1('0x49')]['id']}})[_0x7fa1('0x29')](handleEntityNotFound(_0x5780ba,null))[_0x7fa1('0x29')](function(_0x3de971){if(_0x3de971){_0x4da86a[_0x7fa1('0x4d')][_0x7fa1('0x5a')]=_0x3de971['id'];return db[_0x7fa1('0x51')]['create'](_0x4da86a['body']);}})[_0x7fa1('0x29')](respondWithResult(_0x5780ba,null))[_0x7fa1('0x4b')](handleError(_0x5780ba,null));};exports[_0x7fa1('0x5b')]=function(_0x472ddf,_0x13715d,_0x5d0112){var _0x385286={};var _0x8f5fe2={};var _0x10f804;var _0x387c74;return db[_0x7fa1('0x43')][_0x7fa1('0x55')]({'where':{'id':_0x472ddf[_0x7fa1('0x49')]['id']}})[_0x7fa1('0x29')](handleEntityNotFound(_0x13715d,null))[_0x7fa1('0x29')](function(_0x546e7f){if(_0x546e7f){_0x10f804=_0x546e7f;_0x8f5fe2[_0x7fa1('0x31')]=_[_0x7fa1('0x34')](db[_0x7fa1('0x51')][_0x7fa1('0x2e')]);_0x8f5fe2[_0x7fa1('0x33')]=_['keys'](_0x472ddf[_0x7fa1('0x33')]);_0x8f5fe2[_0x7fa1('0x35')]=_[_0x7fa1('0x36')](_0x8f5fe2[_0x7fa1('0x31')],_0x8f5fe2[_0x7fa1('0x33')]);_0x385286[_0x7fa1('0x37')]=_[_0x7fa1('0x36')](_0x8f5fe2[_0x7fa1('0x31')],qs[_0x7fa1('0x38')](_0x472ddf[_0x7fa1('0x33')][_0x7fa1('0x38')]));_0x385286['attributes']=_0x385286['attributes'][_0x7fa1('0x39')]?_0x385286[_0x7fa1('0x37')]:_0x8f5fe2[_0x7fa1('0x31')];_0x385286[_0x7fa1('0x3c')]=qs[_0x7fa1('0x3d')](_0x472ddf['query'][_0x7fa1('0x3d')]);_0x385286[_0x7fa1('0x40')]=qs['filters'](_[_0x7fa1('0x3e')](_0x472ddf[_0x7fa1('0x33')],_0x8f5fe2[_0x7fa1('0x35')]));if(_0x472ddf['query'][_0x7fa1('0x3f')]){_0x385286['where']=_[_0x7fa1('0x41')](_0x385286[_0x7fa1('0x40')],{'$or':_['map'](_0x385286[_0x7fa1('0x37')],function(_0x59c830){var _0xbd8c90={};_0xbd8c90[_0x59c830]={'$like':'%'+_0x472ddf['query'][_0x7fa1('0x3f')]+'%'};return _0xbd8c90;})});}if(_0x472ddf['query'][_0x7fa1('0x5c')]){var _0x4b5f85=_0x472ddf[_0x7fa1('0x33')][_0x7fa1('0x5c')]['split'](',');var _0x495af4={};_0x495af4[_0x4b5f85[0x0]]={'$gte':moment(_0x4b5f85[0x1])[_0x7fa1('0x5d')](_0x7fa1('0x5e'))};_0x385286['where']=_['merge'](_0x385286[_0x7fa1('0x40')],_0x495af4);}_0x385286=_[_0x7fa1('0x41')]({},_0x385286,_0x472ddf[_0x7fa1('0x42')]);return _0x10f804[_0x7fa1('0x5b')](_0x385286);}})['then'](function(_0x3ef0d8){if(_0x3ef0d8){_0x387c74=_0x3ef0d8['length'];if(!_0x472ddf[_0x7fa1('0x33')][_0x7fa1('0x3a')](_0x7fa1('0x3b'))){_0x385286[_0x7fa1('0x24')]=qs[_0x7fa1('0x24')](_0x472ddf[_0x7fa1('0x33')][_0x7fa1('0x24')]);_0x385286[_0x7fa1('0x22')]=qs['offset'](_0x472ddf[_0x7fa1('0x33')][_0x7fa1('0x22')]);}return _0x10f804[_0x7fa1('0x5b')](_0x385286);}})[_0x7fa1('0x29')](function(_0x4c9731){if(_0x4c9731){return _0x4c9731?{'count':_0x387c74,'rows':_0x4c9731}:null;}})[_0x7fa1('0x29')](respondWithResult(_0x13715d,null))[_0x7fa1('0x4b')](handleError(_0x13715d,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index bad1c48..9ea4273 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 _0x11d1=['remove','emit','hasOwnProperty','hook','events','ChatGroup','setMaxListeners','save'];(function(_0x546be0,_0x3fcd84){var _0x4f64ba=function(_0x570928){while(--_0x570928){_0x546be0['push'](_0x546be0['shift']());}};_0x4f64ba(++_0x3fcd84);}(_0x11d1,0x184));var _0x111d=function(_0x3a208a,_0x55fd53){_0x3a208a=_0x3a208a-0x0;var _0x22fa9b=_0x11d1[_0x3a208a];return _0x22fa9b;};'use strict';var EventEmitter=require(_0x111d('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0x111d('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x111d('0x2')](0x0);var events={'afterCreate':_0x111d('0x3'),'afterUpdate':'update','afterDestroy':_0x111d('0x4')};function emitEvent(_0x119e36){return function(_0x3d763a,_0x5657c6,_0x2cc0fb){ChatGroupEvents[_0x111d('0x5')](_0x119e36+':'+_0x3d763a['id'],_0x3d763a);ChatGroupEvents[_0x111d('0x5')](_0x119e36,_0x3d763a);_0x2cc0fb(null);};}for(var e in events){if(events[_0x111d('0x6')](e)){var event=events[e];ChatGroup[_0x111d('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x4a6d=['hook','exports','../../mysqldb','save','update','remove','hasOwnProperty'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4a6d,0x121));var _0xd4a6=function(_0x4125d3,_0x429075){_0x4125d3=_0x4125d3-0x0;var _0x40a5eb=_0x4a6d[_0x4125d3];return _0x40a5eb;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xd4a6('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd4a6('0x1'),'afterUpdate':_0xd4a6('0x2'),'afterDestroy':_0xd4a6('0x3')};function emitEvent(_0x9cfdf){return function(_0x49994a,_0x13fd34,_0x4ec60f){ChatGroupEvents['emit'](_0x9cfdf+':'+_0x49994a['id'],_0x49994a);ChatGroupEvents['emit'](_0x9cfdf,_0x49994a);_0x4ec60f(null);};}for(var e in events){if(events[_0xd4a6('0x4')](e)){var event=events[e];ChatGroup[_0xd4a6('0x5')](e,emitEvent(event));}}module[_0xd4a6('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 8e22396..99634fe 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 _0xa9ec=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups'];(function(_0x397ea1,_0x51b8b3){var _0xf132e=function(_0x2a1a5f){while(--_0x2a1a5f){_0x397ea1['push'](_0x397ea1['shift']());}};_0xf132e(++_0x51b8b3);}(_0xa9ec,0x145));var _0xca9e=function(_0x4bdda3,_0x25f960){_0x4bdda3=_0x4bdda3-0x0;var _0x3f8722=_0xa9ec[_0x4bdda3];return _0x3f8722;};'use strict';var _=require(_0xca9e('0x0'));var util=require(_0xca9e('0x1'));var logger=require(_0xca9e('0x2'))(_0xca9e('0x3'));var moment=require(_0xca9e('0x4'));var BPromise=require('bluebird');var rp=require(_0xca9e('0x5'));var fs=require('fs');var path=require(_0xca9e('0x6'));var rimraf=require(_0xca9e('0x7'));var config=require(_0xca9e('0x8'));var attributes=require(_0xca9e('0x9'));module['exports']=function(_0x408356,_0x5ee53a){return _0x408356[_0xca9e('0xa')](_0xca9e('0xb'),attributes,{'tableName':_0xca9e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3aa6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api'];(function(_0x1a0620,_0x4f40c3){var _0x475abc=function(_0x276d92){while(--_0x276d92){_0x1a0620['push'](_0x1a0620['shift']());}};_0x475abc(++_0x4f40c3);}(_0x3aa6,0xec));var _0x63aa=function(_0x504df1,_0x289598){_0x504df1=_0x504df1-0x0;var _0x1063b5=_0x3aa6[_0x504df1];return _0x1063b5;};'use strict';var _=require(_0x63aa('0x0'));var util=require(_0x63aa('0x1'));var logger=require(_0x63aa('0x2'))(_0x63aa('0x3'));var moment=require(_0x63aa('0x4'));var BPromise=require(_0x63aa('0x5'));var rp=require(_0x63aa('0x6'));var fs=require('fs');var path=require(_0x63aa('0x7'));var rimraf=require(_0x63aa('0x8'));var config=require(_0x63aa('0x9'));var attributes=require('./chatGroup.attributes');module[_0x63aa('0xa')]=function(_0x4132d0,_0x476d2f){return _0x4132d0[_0x63aa('0xb')]('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 6acc980..28a063e 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 _0x29d4=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','moment','bluebird'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x29d4,0x1a1));var _0x429d=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x29d4[_0x33032e];return _0x13316b;};'use strict';var _=require(_0x429d('0x0'));var util=require('util');var moment=require(_0x429d('0x1'));var BPromise=require(_0x429d('0x2'));var rs=require(_0x429d('0x3'));var fs=require('fs');var Redis=require(_0x429d('0x4'));var db=require(_0x429d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x429d('0x6'))(_0x429d('0x7'));var config=require(_0x429d('0x8'));var jayson=require(_0x429d('0x9'));var client=jayson[_0x429d('0xa')][_0x429d('0xb')]({'port':0x232a});config[_0x429d('0xc')]=_[_0x429d('0xd')](config['redis'],{'host':_0x429d('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x429d('0xc')]));require(_0x429d('0xf'))[_0x429d('0x10')](socket);function respondWithRpcPromise(_0x5e8430,_0x1f9b3e,_0x8c7cb6){return new BPromise(function(_0x5993cc,_0x31ff87){return client[_0x429d('0x11')](_0x5e8430,_0x8c7cb6)[_0x429d('0x12')](function(_0x5b45c2){logger[_0x429d('0x13')](_0x429d('0x14'),_0x1f9b3e,_0x429d('0x15'));logger[_0x429d('0x16')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1f9b3e,_0x429d('0x15'),JSON[_0x429d('0x17')](_0x5b45c2));if(_0x5b45c2[_0x429d('0x18')]){if(_0x5b45c2['error'][_0x429d('0x19')]===0x1f4){logger[_0x429d('0x18')]('ChatGroup,\x20%s,\x20%s',_0x1f9b3e,_0x5b45c2[_0x429d('0x18')][_0x429d('0x1a')]);return _0x31ff87(_0x5b45c2[_0x429d('0x18')][_0x429d('0x1a')]);}logger[_0x429d('0x18')](_0x429d('0x14'),_0x1f9b3e,_0x5b45c2['error'][_0x429d('0x1a')]);return _0x5993cc(_0x5b45c2['error'][_0x429d('0x1a')]);}else{logger[_0x429d('0x13')](_0x429d('0x14'),_0x1f9b3e,_0x429d('0x15'));_0x5993cc(_0x5b45c2['result'][_0x429d('0x1a')]);}})[_0x429d('0x1b')](function(_0x2b9e78){logger['error'](_0x429d('0x14'),_0x1f9b3e,_0x2b9e78);_0x31ff87(_0x2b9e78);});});} \ No newline at end of file +var _0x4989=['../../mysqldb','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x3e18bf,_0x387f5e){var _0x1022e5=function(_0x242ec4){while(--_0x242ec4){_0x3e18bf['push'](_0x3e18bf['shift']());}};_0x1022e5(++_0x387f5e);}(_0x4989,0x79));var _0x9498=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0x4989[_0x59eefb];return _0x1a49e8;};'use strict';var _=require(_0x9498('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9498('0x1'));var rs=require(_0x9498('0x2'));var fs=require('fs');var Redis=require(_0x9498('0x3'));var db=require(_0x9498('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9498('0x5'));var config=require('../../config/environment');var jayson=require(_0x9498('0x6'));var client=jayson[_0x9498('0x7')]['http']({'port':0x232a});config[_0x9498('0x8')]=_[_0x9498('0x9')](config[_0x9498('0x8')],{'host':_0x9498('0xa'),'port':0x18eb});var socket=require(_0x9498('0xb'))(new Redis(config[_0x9498('0x8')]));require(_0x9498('0xc'))[_0x9498('0xd')](socket);function respondWithRpcPromise(_0x2cd88f,_0x212a2d,_0x1e7440){return new BPromise(function(_0x5ce9bf,_0x1926af){return client[_0x9498('0xe')](_0x2cd88f,_0x1e7440)[_0x9498('0xf')](function(_0x51f0b1){logger[_0x9498('0x10')](_0x9498('0x11'),_0x212a2d,'request\x20sent');logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x212a2d,_0x9498('0x12'),JSON[_0x9498('0x13')](_0x51f0b1));if(_0x51f0b1[_0x9498('0x14')]){if(_0x51f0b1[_0x9498('0x14')][_0x9498('0x15')]===0x1f4){logger[_0x9498('0x14')]('ChatGroup,\x20%s,\x20%s',_0x212a2d,_0x51f0b1[_0x9498('0x14')][_0x9498('0x16')]);return _0x1926af(_0x51f0b1[_0x9498('0x14')][_0x9498('0x16')]);}logger[_0x9498('0x14')](_0x9498('0x11'),_0x212a2d,_0x51f0b1[_0x9498('0x14')][_0x9498('0x16')]);return _0x5ce9bf(_0x51f0b1[_0x9498('0x14')][_0x9498('0x16')]);}else{logger[_0x9498('0x10')](_0x9498('0x11'),_0x212a2d,_0x9498('0x12'));_0x5ce9bf(_0x51f0b1[_0x9498('0x17')][_0x9498('0x16')]);}})[_0x9498('0x18')](function(_0x5d775d){logger[_0x9498('0x14')](_0x9498('0x11'),_0x212a2d,_0x5d775d);_0x1926af(_0x5d775d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 9a61ed0..1d1f377 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 _0x8949=['removeListener','chatGroup:','save','update','emit'];(function(_0x122529,_0x2d19ff){var _0x1ec76d=function(_0xe47b07){while(--_0xe47b07){_0x122529['push'](_0x122529['shift']());}};_0x1ec76d(++_0x2d19ff);}(_0x8949,0x19c));var _0x9894=function(_0x1a637c,_0x245b0c){_0x1a637c=_0x1a637c-0x0;var _0x113850=_0x8949[_0x1a637c];return _0x113850;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x9894('0x0'),'remove',_0x9894('0x1')];function createListener(_0x893236,_0x20d997){return function(_0x402745){_0x20d997[_0x9894('0x2')](_0x893236,_0x402745);};}function removeListener(_0x46f560,_0x5dac5e){return function(){ChatGroupEvents[_0x9894('0x3')](_0x46f560,_0x5dac5e);};}exports['register']=function(_0x5a618a){for(var _0x2a198f=0x0,_0x2b55eb=events['length'];_0x2a198f<_0x2b55eb;_0x2a198f++){var _0x5a4ed9=events[_0x2a198f];var _0x56d4fc=createListener(_0x9894('0x4')+_0x5a4ed9,_0x5a618a);ChatGroupEvents['on'](_0x5a4ed9,_0x56d4fc);}}; \ No newline at end of file +var _0xf468=['./chatGroup.events','save','remove','emit','removeListener','length','chatGroup:'];(function(_0x5dbaa9,_0xa1eb2f){var _0x52abe0=function(_0x4a540c){while(--_0x4a540c){_0x5dbaa9['push'](_0x5dbaa9['shift']());}};_0x52abe0(++_0xa1eb2f);}(_0xf468,0x85));var _0x8f46=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xf468[_0x4243a3];return _0x1b2a33;};'use strict';var ChatGroupEvents=require(_0x8f46('0x0'));var events=[_0x8f46('0x1'),_0x8f46('0x2'),'update'];function createListener(_0x6b8bc1,_0x2317d3){return function(_0xed69fe){_0x2317d3[_0x8f46('0x3')](_0x6b8bc1,_0xed69fe);};}function removeListener(_0x574434,_0x2ee5f2){return function(){ChatGroupEvents[_0x8f46('0x4')](_0x574434,_0x2ee5f2);};}exports['register']=function(_0x18533c){for(var _0x378ed8=0x0,_0x580904=events[_0x8f46('0x5')];_0x378ed8<_0x580904;_0x378ed8++){var _0x4e6064=events[_0x378ed8];var _0x56c79b=createListener(_0x8f46('0x6')+_0x4e6064,_0x18533c);ChatGroupEvents['on'](_0x4e6064,_0x56c79b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index f6e2c23..306d309 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 _0x5657=['../../components/auth/service','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','/:id/unread','getUnread','/:id/members','getMembers','create','post','addMembers','/:id/messages','put','update','destroy','delete','removeMembers','exports','path','connect-timeout','express','Router','fs-extra'];(function(_0x5f2303,_0x267185){var _0x31078d=function(_0x23427d){while(--_0x23427d){_0x5f2303['push'](_0x5f2303['shift']());}};_0x31078d(++_0x267185);}(_0x5657,0x133));var _0x7565=function(_0x2cdfc4,_0x1a18c0){_0x2cdfc4=_0x2cdfc4-0x0;var _0x13e0e=_0x5657[_0x2cdfc4];return _0x13e0e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7565('0x0'));var timeout=require(_0x7565('0x1'));var express=require(_0x7565('0x2'));var router=express[_0x7565('0x3')]();var fs_extra=require(_0x7565('0x4'));var auth=require(_0x7565('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7565('0x6'));router[_0x7565('0x7')]('/',auth[_0x7565('0x8')](),controller[_0x7565('0x9')]);router['get']('/describe',auth[_0x7565('0x8')](),controller[_0x7565('0xa')]);router['get'](_0x7565('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7565('0x7')](_0x7565('0xc'),auth['isAuthenticated'](),controller[_0x7565('0xd')]);router[_0x7565('0x7')](_0x7565('0xe'),auth[_0x7565('0x8')](),controller[_0x7565('0xf')]);router[_0x7565('0x7')]('/:id/messages',auth[_0x7565('0x8')](),controller['getMessages']);router['post']('/',auth[_0x7565('0x8')](),controller[_0x7565('0x10')]);router[_0x7565('0x11')](_0x7565('0xe'),auth[_0x7565('0x8')](),controller[_0x7565('0x12')]);router[_0x7565('0x11')](_0x7565('0x13'),auth['isAuthenticated'](),controller['addMessage']);router[_0x7565('0x14')](_0x7565('0xb'),auth[_0x7565('0x8')](),controller[_0x7565('0x15')]);router['delete'](_0x7565('0xb'),auth['isAuthenticated'](),controller[_0x7565('0x16')]);router[_0x7565('0x17')](_0x7565('0xe'),auth['isAuthenticated'](),controller[_0x7565('0x18')]);module[_0x7565('0x19')]=router; \ No newline at end of file +var _0x1833=['/:id/messages','getMessages','post','create','addMembers','addMessage','update','delete','removeMembers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe','/:id','/:id/unread','getUnread','/:id/members'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x1833,0x1ef));var _0x3183=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0x1833[_0x445c98];return _0x2fe913;};'use strict';var multer=require(_0x3183('0x0'));var util=require(_0x3183('0x1'));var path=require(_0x3183('0x2'));var timeout=require(_0x3183('0x3'));var express=require(_0x3183('0x4'));var router=express[_0x3183('0x5')]();var fs_extra=require(_0x3183('0x6'));var auth=require(_0x3183('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3183('0x8'));var controller=require(_0x3183('0x9'));router[_0x3183('0xa')]('/',auth[_0x3183('0xb')](),controller[_0x3183('0xc')]);router[_0x3183('0xa')]('/describe',auth[_0x3183('0xb')](),controller[_0x3183('0xd')]);router['get'](_0x3183('0xe'),auth[_0x3183('0xb')](),controller['show']);router[_0x3183('0xa')](_0x3183('0xf'),auth['isAuthenticated'](),controller[_0x3183('0x10')]);router[_0x3183('0xa')](_0x3183('0x11'),auth[_0x3183('0xb')](),controller['getMembers']);router[_0x3183('0xa')](_0x3183('0x12'),auth['isAuthenticated'](),controller[_0x3183('0x13')]);router[_0x3183('0x14')]('/',auth['isAuthenticated'](),controller[_0x3183('0x15')]);router[_0x3183('0x14')](_0x3183('0x11'),auth['isAuthenticated'](),controller[_0x3183('0x16')]);router[_0x3183('0x14')]('/:id/messages',auth[_0x3183('0xb')](),controller[_0x3183('0x17')]);router['put'](_0x3183('0xe'),auth['isAuthenticated'](),controller[_0x3183('0x18')]);router[_0x3183('0x19')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x3183('0x19')]('/:id/members',auth[_0x3183('0xb')](),controller[_0x3183('0x1a')]);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 41af8cf..5dc6128 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 _0x0bb4=['exports','INTEGER','ENUM','star','thumb','TEXT','STRING','long','DATE','out','BOOLEAN','sequelize'];(function(_0x18e8c8,_0x5b6b81){var _0x1fa76e=function(_0x369790){while(--_0x369790){_0x18e8c8['push'](_0x18e8c8['shift']());}};_0x1fa76e(++_0x5b6b81);}(_0x0bb4,0x77));var _0x40bb=function(_0x3d2acd,_0x43096b){_0x3d2acd=_0x3d2acd-0x0;var _0x21e616=_0x0bb4[_0x3d2acd];return _0x21e616;};'use strict';var Sequelize=require(_0x40bb('0x0'));module[_0x40bb('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x40bb('0x2')]},'ratingType':{'type':Sequelize[_0x40bb('0x3')](_0x40bb('0x4'),_0x40bb('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x40bb('0x6')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x40bb('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x40bb('0x7')]},'secondDisposition':{'type':Sequelize[_0x40bb('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x40bb('0x7')]},'browserName':{'type':Sequelize[_0x40bb('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x40bb('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x40bb('0x7')]},'deviceVendor':{'type':Sequelize[_0x40bb('0x7')]},'deviceType':{'type':Sequelize[_0x40bb('0x7')]},'referer':{'type':Sequelize[_0x40bb('0x6')]},'customerIp':{'type':Sequelize[_0x40bb('0x7')]},'formData':{'type':Sequelize[_0x40bb('0x6')](_0x40bb('0x8'))},'read1stAt':{'type':Sequelize[_0x40bb('0x9')]},'lastMsgAt':{'type':Sequelize[_0x40bb('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x40bb('0x3')]('in',_0x40bb('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x40bb('0x7')]},'customerPort':{'type':Sequelize[_0x40bb('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x40bb('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x40bb('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0xa902=['BOOLEAN','INTEGER','ENUM','thumb','TEXT','STRING','DATE','long','out','sequelize','exports'];(function(_0x228907,_0x514883){var _0x10d5b9=function(_0x2db453){while(--_0x2db453){_0x228907['push'](_0x228907['shift']());}};_0x10d5b9(++_0x514883);}(_0xa902,0x8d));var _0x2a90=function(_0x301566,_0x4a8dab){_0x301566=_0x301566-0x0;var _0x2c80fd=_0xa902[_0x301566];return _0x2c80fd;};'use strict';var Sequelize=require(_0x2a90('0x0'));module[_0x2a90('0x1')]={'closed':{'type':Sequelize[_0x2a90('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x2a90('0x3')]},'ratingType':{'type':Sequelize[_0x2a90('0x4')]('star',_0x2a90('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x2a90('0x6')]},'mailTranscript':{'type':Sequelize[_0x2a90('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x2a90('0x8')]},'disposition':{'type':Sequelize[_0x2a90('0x7')]},'secondDisposition':{'type':Sequelize[_0x2a90('0x7')]},'thirdDisposition':{'type':Sequelize[_0x2a90('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x2a90('0x7')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x2a90('0x7')]},'deviceModel':{'type':Sequelize[_0x2a90('0x7')]},'deviceVendor':{'type':Sequelize[_0x2a90('0x7')]},'deviceType':{'type':Sequelize[_0x2a90('0x7')]},'referer':{'type':Sequelize[_0x2a90('0x6')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x2a90('0x6')](_0x2a90('0x9'))},'read1stAt':{'type':Sequelize[_0x2a90('0x8')]},'lastMsgAt':{'type':Sequelize[_0x2a90('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2a90('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x2a90('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x2a90('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 c5a4104..099a08b 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 _0xd7d1=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','groupBy','ChatInteractionId','all','rows','show','params','includeAll','include','create','destroy','describe','createVidaooSession','findOne','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','Interaction\x20already\x20assigned','update','disposition','file','basename','filename','Attachment','attachmentDownload','closed','json','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','close','mailTranscript','root','transcript-%s.txt','now','pathTranscript','Messages','format','agentAlias','System','customer','%s%d','Visitor','agentIdentifier','website_alias','agent_fullname','direction','secret','appendFileSync','MailAccount','Smtp','service','host','secure','auth','pass','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','alias','findAll','addTags','setTags','ids','omit','spread','emit','chatInteractionTags:save','removeTags','download','unix','tmp','server','files','attachments','transcript-%d-%s.zip','lastName','ChatWebsite','get','mkdirSync','Chat','Account','Owner','N.A.','browserName','osName','customerIp','customerPort','tail','createReadStream','pipe','createWriteStream','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','unlinkSync','eml-format','rimraf','zip-dir','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/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./chatInteraction.socket','register','jayson/promise','client','http','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','sendStatus','status','end','limit','undefined','count','offset','set','apply','reject','save','stack','name','send','contact','agent','interaction','account','map','fullname','TagIds','forEach','Tags','push','index','ChatInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','select','field','color','tools_tags','u.fullname','from','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','having','`\x20>\x200','Contact','operator','$substring','value','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','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','buildExpression','body','some','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','DESC','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x543229,_0x573f36){_0x543229=_0x543229-0x0;var _0x4e62c9=_0xd7d1[_0x543229];return _0x4e62c9;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x1d7d('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1d7d('0x18'))(_0x1d7d('0x19'));var utils=require(_0x1d7d('0x1a'));var config=require(_0x1d7d('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x1d7d('0x1c'))['db'];config['redis']=_['defaults'](config[_0x1d7d('0x1d')],{'host':_0x1d7d('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1d7d('0x1f'))[_0x1d7d('0x20')](socket);var jayson=require(_0x1d7d('0x21'));var client=jayson[_0x1d7d('0x22')][_0x1d7d('0x23')]({'port':0x232b});var client9004=jayson['client'][_0x1d7d('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x1de6cc,_0x51cbca,_0xb90a8c,_0x162c3a){return new BPromise(function(_0x3c3417,_0x47826a){var _0x40db4d=_0x162c3a||client;return _0x40db4d['request'](_0x1de6cc,_0xb90a8c)[_0x1d7d('0x24')](function(_0x191024){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x51cbca,_0x1d7d('0x25'));logger[_0x1d7d('0x26')](_0x1d7d('0x27'),_0x51cbca,_0x1d7d('0x25'),JSON[_0x1d7d('0x28')](_0x191024));if(_0x191024[_0x1d7d('0x29')]){if(_0x191024['error'][_0x1d7d('0x2a')]===0x1f4){logger[_0x1d7d('0x29')](_0x1d7d('0x2b'),_0x51cbca,_0x191024['error'][_0x1d7d('0x2c')]);return _0x47826a(_0x191024[_0x1d7d('0x29')]['message']);}logger['error'](_0x1d7d('0x2b'),_0x51cbca,_0x191024[_0x1d7d('0x29')][_0x1d7d('0x2c')]);return _0x3c3417(_0x191024['error'][_0x1d7d('0x2c')]);}else{logger[_0x1d7d('0x2d')](_0x1d7d('0x2b'),_0x51cbca,_0x1d7d('0x25'));_0x3c3417(_0x191024['result'][_0x1d7d('0x2c')]);}})[_0x1d7d('0x2e')](function(_0x5c8257){logger['error'](_0x1d7d('0x2b'),_0x51cbca,_0x5c8257);_0x47826a(_0x5c8257);});});}function respondWithStatusCode(_0x52c618,_0x38c323){_0x38c323=_0x38c323||0xcc;return function(_0x2d4de4){if(_0x2d4de4){return _0x52c618[_0x1d7d('0x2f')](_0x38c323);}return _0x52c618[_0x1d7d('0x30')](_0x38c323)[_0x1d7d('0x31')]();};}function respondWithResult(_0x59f827,_0x1c2616){_0x1c2616=_0x1c2616||0xc8;return function(_0x98c1ad){if(_0x98c1ad){return _0x59f827[_0x1d7d('0x30')](_0x1c2616)['json'](_0x98c1ad);}};}function respondWithFilteredResult(_0x78adbe,_0x1a935a){return function(_0x23ad85){if(_0x23ad85){var _0x482367=typeof _0x1a935a['offset']==='undefined'&&typeof _0x1a935a[_0x1d7d('0x32')]===_0x1d7d('0x33');var _0x559f19=_0x23ad85[_0x1d7d('0x34')];var _0x3e4136=_0x482367?0x0:_0x1a935a[_0x1d7d('0x35')];var _0x3336ab=_0x482367?_0x23ad85[_0x1d7d('0x34')]:_0x1a935a[_0x1d7d('0x35')]+_0x1a935a[_0x1d7d('0x32')];var _0x803dc9;if(_0x3336ab>=_0x559f19){_0x3336ab=_0x559f19;_0x803dc9=0xc8;}else{_0x803dc9=0xce;}_0x78adbe[_0x1d7d('0x30')](_0x803dc9);return _0x78adbe[_0x1d7d('0x36')]('Content-Range',_0x3e4136+'-'+_0x3336ab+'/'+_0x559f19)['json'](_0x23ad85);}return null;};}function patchUpdates(_0x2e4402){return function(_0x2266a6){try{jsonpatch[_0x1d7d('0x37')](_0x2266a6,_0x2e4402,!![]);}catch(_0x40318f){return BPromise[_0x1d7d('0x38')](_0x40318f);}return _0x2266a6[_0x1d7d('0x39')]();};}function saveUpdates(_0x1aee3c,_0x40aca9){return function(_0x2fa3f4){if(_0x2fa3f4){return _0x2fa3f4['update'](_0x1aee3c)[_0x1d7d('0x24')](function(_0xf9d3e4){return _0xf9d3e4;});}return null;};}function removeEntity(_0x13a974,_0x30fb9a){return function(_0x4cc364){if(_0x4cc364){return _0x4cc364['destroy']()[_0x1d7d('0x24')](function(){_0x13a974[_0x1d7d('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x103c77,_0x3fea2e){return function(_0x568092){if(!_0x568092){_0x103c77['sendStatus'](0x194);}return _0x568092;};}function handleError(_0x26f81c,_0xc77f24){_0xc77f24=_0xc77f24||0x1f4;return function(_0x406f57){logger[_0x1d7d('0x29')](_0x406f57[_0x1d7d('0x3a')]);if(_0x406f57[_0x1d7d('0x3b')]){delete _0x406f57[_0x1d7d('0x3b')];}_0x26f81c[_0x1d7d('0x30')](_0xc77f24)[_0x1d7d('0x3c')](_0x406f57);};}function getMustacheRender(_0x318b9a,_0x4fcdcc){return Mustache['render'](_0x318b9a,_['merge'](_0x4fcdcc['body'],{'contact':_0x4fcdcc[_0x1d7d('0x3d')],'message':_0x4fcdcc['message'],'agent':_0x4fcdcc[_0x1d7d('0x3e')],'interaction':_0x4fcdcc[_0x1d7d('0x3f')],'account':_0x4fcdcc[_0x1d7d('0x40')]}))||'';}function getInteractionUsers(_0x515199,_0x5a4052){return new BPromise(function(_0x16a4e0,_0x153979){try{if(_0x5a4052[_0x515199['id']]){_0x515199['Users']=_[_0x1d7d('0x41')](_0x5a4052[_0x515199['id']],function(_0xa53806){return{'id':_0xa53806['id'],'fullname':_0xa53806[_0x1d7d('0x42')]};});}}catch(_0x2100f6){_0x153979(_0x2100f6);}_0x16a4e0(_0x515199);});}function getInteractionTags(_0x5eef0a,_0x1db8e8){return new BPromise(function(_0x42c229,_0x4239fa){try{if(_0x5eef0a[_0x1d7d('0x43')]){_0x5eef0a['Tags']=[];_0x5eef0a[_0x1d7d('0x43')]['split'](',')[_0x1d7d('0x44')](function(_0x31b850){_0x5eef0a[_0x1d7d('0x45')][_0x1d7d('0x46')](_0x1db8e8[_0x31b850]);});}delete _0x5eef0a[_0x1d7d('0x43')];}catch(_0x4becec){_0x4239fa(_0x4becec);}_0x42c229(_0x5eef0a);});}function updateChatInteraction(_0x59b8e7,_0x33582a,_0xe57fa5){return new BPromise(function(_0x1637fc,_0x4bed84){return getInteractionUsers(_0x59b8e7,_0xe57fa5)['then'](function(_0x12f397){return getInteractionTags(_0x12f397,_0x33582a);})['then'](function(_0x86e7bc){_0x1637fc(_0x86e7bc);})[_0x1d7d('0x2e')](function(_0x1d1064){_0x4bed84(_0x1d1064);});});}exports[_0x1d7d('0x47')]=function(_0x1e2ea8,_0x370e8d){var _0x72f5d7={},_0x51cb15={},_0x3ccd44={'count':0x0,'rows':[]};var _0x8b0c22=_['map'](db[_0x1d7d('0x48')][_0x1d7d('0x49')],function(_0x40599b){return{'name':_0x40599b[_0x1d7d('0x4a')],'type':_0x40599b[_0x1d7d('0x4b')][_0x1d7d('0x4c')]};});_0x51cb15[_0x1d7d('0x4d')]=_[_0x1d7d('0x41')](_0x8b0c22,_0x1d7d('0x3b'));_0x51cb15[_0x1d7d('0x4e')]=_[_0x1d7d('0x4f')](_0x1e2ea8[_0x1d7d('0x4e')]);_0x51cb15['filters']=_[_0x1d7d('0x50')](_0x51cb15['model'],_0x51cb15[_0x1d7d('0x4e')]);_0x72f5d7['attributes']=_[_0x1d7d('0x50')](_0x51cb15[_0x1d7d('0x4d')],qs[_0x1d7d('0x51')](_0x1e2ea8[_0x1d7d('0x4e')]['fields']));_0x72f5d7[_0x1d7d('0x52')]=_0x72f5d7['attributes']['length']?_0x72f5d7[_0x1d7d('0x52')]:_0x51cb15['model'];if(!_0x1e2ea8['query'][_0x1d7d('0x53')](_0x1d7d('0x54'))){_0x72f5d7['limit']=qs[_0x1d7d('0x32')](_0x1e2ea8[_0x1d7d('0x4e')]['limit']);_0x72f5d7[_0x1d7d('0x35')]=qs[_0x1d7d('0x35')](_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x35')]);}_0x72f5d7['order']=qs['sort'](_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x55')]);_0x72f5d7[_0x1d7d('0x56')]=qs[_0x1d7d('0x57')](_[_0x1d7d('0x58')](_0x1e2ea8['query'],_0x51cb15[_0x1d7d('0x57')]),_0x8b0c22);var _0x24e0b7=[];var _0x344b66=squel[_0x1d7d('0x59')]()[_0x1d7d('0x5a')]('id')[_0x1d7d('0x5a')](_0x1d7d('0x3b'))[_0x1d7d('0x5a')](_0x1d7d('0x5b'))['from'](_0x1d7d('0x5c'));var _0x41ad41=squel[_0x1d7d('0x59')]()['field']('u.id')[_0x1d7d('0x5a')](_0x1d7d('0x5d'))[_0x1d7d('0x5a')]('ui.ChatInteractionId')[_0x1d7d('0x5e')](_0x1d7d('0x5f'),'ui')['left_join'](_0x1d7d('0x60'),'u',_0x1d7d('0x61'));var _0x3fc216=squel[_0x1d7d('0x59')]()['from'](_0x1d7d('0x62'),'i')[_0x1d7d('0x63')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1d7d('0x63')](_0x1d7d('0x60'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x1d7d('0x64'),'a',_0x1d7d('0x65'))[_0x1d7d('0x63')](_0x1d7d('0x66'),'me','me.ChatInteractionId\x20=\x20i.id')[_0x1d7d('0x63')]('chat_interaction_has_tags','it',_0x1d7d('0x67'))[_0x1d7d('0x63')](_0x1d7d('0x5c'),'t',_0x1d7d('0x68'));var _0x5a4bd7=squel[_0x1d7d('0x69')]();var _0x1ea966=[];var _0x193135=squel[_0x1d7d('0x69')]();var _0x28ec14;if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x6a')]){_0x28ec14=as[_0x1d7d('0x6b')](_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x6a')]);var _0x44a187=_0x28ec14[_0x1d7d('0x6c')];for(var _0x301a67=0x0;_0x301a67<_0x28ec14[_0x1d7d('0x6d')][_0x1d7d('0x6e')];_0x301a67++){var _0x520d3c=_0x28ec14[_0x1d7d('0x6d')][_0x301a67];var _0x566d27='i';var _0x1c9fe7=_[_0x1d7d('0x6f')](_0x8b0c22,[_0x1d7d('0x3b'),_0x520d3c[_0x1d7d('0x5a')]]);if(!_0x1c9fe7){switch(_0x520d3c[_0x1d7d('0x5a')]){case _0x1d7d('0x70'):if(_0x520d3c['value']==0x1){_0x3fc216[_0x1d7d('0x71')]('`'+_0x520d3c[_0x1d7d('0x5a')]+'`\x20=\x200');}else{_0x3fc216[_0x1d7d('0x71')]('`'+_0x520d3c['field']+_0x1d7d('0x72'));}break;case _0x1d7d('0x73'):if(_0x520d3c[_0x1d7d('0x74')]===_0x1d7d('0x75')){if(_0x520d3c[_0x1d7d('0x76')][_0x1d7d('0x77')]('\x20')['length']>0x1){_0x5a4bd7[_0x44a187](_0x1d7d('0x78'),qs[_0x1d7d('0x79')](_0x520d3c['value']),null);}else{var _0x3289c2='%'+_0x520d3c[_0x1d7d('0x76')]+'%';_0x5a4bd7[_0x44a187](_0x1d7d('0x7a'),_0x3289c2,_0x3289c2,_0x3289c2);}}else{_0x1c9fe7=_['find'](_0x8b0c22,[_0x1d7d('0x3b'),_0x1d7d('0x7b')]);_0x520d3c[_0x1d7d('0x5a')]=_0x1d7d('0x7b');_0x2e26d4=as['buildExpression'](_0x566d27,_0x1c9fe7[_0x1d7d('0x4b')],_0x520d3c);_0x5a4bd7[_0x44a187](_0x2e26d4[_0x1d7d('0x7c')],_0x2e26d4[_0x1d7d('0x76')][_0x1d7d('0x7d')],_0x2e26d4[_0x1d7d('0x76')]['end']);}break;case _0x1d7d('0x7e'):var _0x10dea3=_0x520d3c['value'][_0x1d7d('0x77')](',')[_0x1d7d('0x41')](function(_0x17c174){return Number(_0x17c174);});_0x10dea3[_0x1d7d('0x44')](function(_0x47d27e){_0x193135['or'](_0x1d7d('0x7f'),'%,'+_0x47d27e+',%');});_0x1ea966=_['union'](_0x1ea966,_0x10dea3);break;case _0x1d7d('0x80'):if(_0x520d3c[_0x1d7d('0x74')]===_0x1d7d('0x75')){_0x5a4bd7[_0x44a187]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x520d3c[_0x1d7d('0x76')]+'%',null);}else{_0x1c9fe7=_[_0x1d7d('0x6f')](_0x8b0c22,[_0x1d7d('0x3b'),'UserId']);_0x520d3c[_0x1d7d('0x5a')]='UserId';_0x2e26d4=as[_0x1d7d('0x81')](_0x566d27,_0x1c9fe7[_0x1d7d('0x4b')],_0x520d3c);_0x5a4bd7[_0x44a187](_0x2e26d4[_0x1d7d('0x7c')],_0x2e26d4[_0x1d7d('0x76')][_0x1d7d('0x7d')],_0x2e26d4[_0x1d7d('0x76')][_0x1d7d('0x31')]);}break;case _0x1d7d('0x82'):_0x2e26d4=as[_0x1d7d('0x81')]('me',null,_0x520d3c);_0x5a4bd7[_0x44a187](_0x2e26d4[_0x1d7d('0x7c')],_0x2e26d4[_0x1d7d('0x76')]['start'],_0x2e26d4['value'][_0x1d7d('0x31')]);break;}}else{var _0x2e26d4=as[_0x1d7d('0x81')](_0x566d27,_0x1c9fe7['type'],_0x520d3c);_0x5a4bd7[_0x44a187](_0x2e26d4[_0x1d7d('0x7c')],_0x2e26d4['value'][_0x1d7d('0x7d')],_0x2e26d4[_0x1d7d('0x76')]['end']);}}}else{var _0x1f55a2=_(_0x1e2ea8[_0x1d7d('0x4e')])['keys']()[_0x1d7d('0x41')](function(_0x40ee1f){return _[_0x1d7d('0x83')](_0x8b0c22,['name',_0x40ee1f])?_0x40ee1f:undefined;})['compact']()[_0x1d7d('0x76')]();if(!_[_0x1d7d('0x84')](_0x1f55a2)){_0x1f55a2['forEach'](function(_0x33430c){if(_0x33430c===_0x1d7d('0x85')){_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0x86'),[]['concat'](_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c]));}else if(_0x33430c===_0x1d7d('0x87')){var _0x22cdd1=JSON[_0x1d7d('0x88')](_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c])[_0x1d7d('0x89')];var _0x42a83c=JSON[_0x1d7d('0x88')](_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c])[_0x1d7d('0x8a')];_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0x8b'),_0x22cdd1,_0x42a83c);}else{if(_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c]==='null'){_0x3fc216[_0x1d7d('0x56')]('i.'+_0x33430c+_0x1d7d('0x8c'));}else{_0x3fc216['where']('i.'+_0x33430c+_0x1d7d('0x8d'),_0x1e2ea8[_0x1d7d('0x4e')][_0x33430c]);}}});}if(_0x1e2ea8['query']['read']){if(_0x1e2ea8['query'][_0x1d7d('0x8e')]==0x1){_0x3fc216[_0x1d7d('0x71')](_0x1d7d('0x8f'));}else{_0x3fc216[_0x1d7d('0x71')]('`unreadMessages`\x20>\x200');}}if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x90')]){_0x1ea966=_[_0x1d7d('0x91')](_0x1e2ea8[_0x1d7d('0x4e')]['tag'])?_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x90')]:new Array(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x90')]);_0x1ea966[_0x1d7d('0x44')](function(_0x2a7229){_0x193135['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2a7229+',%');});}if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x92')]){var _0x57aba7=_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x92')][_0x1d7d('0x93')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1d7d('0x94')](_0x57aba7)){_0x5a4bd7['or']('i.id\x20LIKE\x20?',_0x57aba7+'%');}else{_0x5a4bd7['or'](_0x1d7d('0x95'),qs[_0x1d7d('0x79')](_0x57aba7))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x57aba7+'%');}}}_0x3fc216[_0x1d7d('0x56')](_0x5a4bd7);_0x3fc216[_0x1d7d('0x96')](_0x1d7d('0x97'));var _0xc3c42f={'type':db[_0x1d7d('0x98')][_0x1d7d('0x99')][_0x1d7d('0x9a')],'raw':!![]};var _0x155e88=_0x3fc216[_0x1d7d('0x9b')]();_0x155e88[_0x1d7d('0x5a')](_0x1d7d('0x97'));_0x155e88[_0x1d7d('0x5a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x72f5d7[_0x1d7d('0x9c')]){_0x72f5d7[_0x1d7d('0x9c')][_0x1d7d('0x44')](function(_0x395818){var _0x247289=_0x395818[0x0]===_0x1d7d('0x9d')?_0x395818[0x0]:'i.'+_0x395818[0x0];_0x3fc216[_0x1d7d('0x9c')](_0x247289,_0x395818[0x1]===_0x1d7d('0x9e')?![]:!![]);});}if(!_[_0x1d7d('0x84')](_0x1ea966)){_0x3fc216[_0x1d7d('0x71')](_0x193135);_0x155e88[_0x1d7d('0x56')](_0x1d7d('0x9f'),_0x1ea966);}BPromise['resolve']()[_0x1d7d('0x24')](function(){if(!_0x28ec14){if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x85')])return;_0x155e88[_0x1d7d('0x56')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0xa0'));return;}if(_0x1e2ea8[_0x1d7d('0xa1')][_0x1d7d('0xa2')]!=='agent')return;return _0x1e2ea8['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})['then'](function(_0x10925b){if(_[_0x1d7d('0x84')](_0x10925b)){_0x155e88['where']('i.ChatWebsiteId\x20IS\x20NULL');_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0xa3'));}else{_0x155e88[_0x1d7d('0x56')](_0x1d7d('0x86'),_[_0x1d7d('0x41')](_0x10925b,'id'));_0x3fc216[_0x1d7d('0x56')](_0x1d7d('0x86'),_[_0x1d7d('0x41')](_0x10925b,'id'));}});})[_0x1d7d('0x24')](function(){if(_0x1e2ea8[_0x1d7d('0xa1')]['role']===_0x1d7d('0x3e')&&!_0x28ec14&&!_0x1e2ea8['query'][_0x1d7d('0x85')])return[];return db[_0x1d7d('0xa4')][_0x1d7d('0x4e')](_0x155e88['toString'](),_0xc3c42f);})[_0x1d7d('0x24')](function(_0x40464c){_0x3ccd44[_0x1d7d('0x34')]=_0x40464c[_0x1d7d('0x6e')];if(_0x3ccd44[_0x1d7d('0x34')]===0x0)return[];return db[_0x1d7d('0xa4')][_0x1d7d('0x4e')](_0x344b66[_0x1d7d('0xa5')](),_0xc3c42f)[_0x1d7d('0x24')](function(_0x74e3fe){_0x24e0b7=_[_0x1d7d('0xa6')](_0x74e3fe,'id');_0xc3c42f=_[_0x1d7d('0xa7')](_0xc3c42f,{'model':db[_0x1d7d('0x48')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e2ea8[_0x1d7d('0x4e')][_0x1d7d('0x51')]){_0x72f5d7[_0x1d7d('0x52')][_0x1d7d('0x44')](function(_0x2aac19){_0x3fc216[_0x1d7d('0x5a')]('i.'+_0x2aac19);});}else{_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xa8'),_0x1d7d('0x70'));_0x3fc216[_0x1d7d('0x5a')]('a.key',_0x1d7d('0xa9'));_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xaa'),'Account.mandatoryDisposition');_0x3fc216[_0x1d7d('0x5a')]('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');_0x3fc216['field']('i.*');_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xab'),_0x1d7d('0xac'));_0x3fc216['field'](_0x1d7d('0xad'),'Contact.lastName');_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xae'),_0x1d7d('0xaf'));_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xb0'),_0x1d7d('0xb1'));_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xb2'),_0x1d7d('0xb3'));_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xb4'),'Contact.fax');_0x3fc216[_0x1d7d('0x5a')](_0x1d7d('0xb5'),_0x1d7d('0xb6'));_0x3fc216['field'](_0x1d7d('0xb7'),_0x1d7d('0xb8'));_0x3fc216[_0x1d7d('0x5a')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x72f5d7[_0x1d7d('0x32')])_0x3fc216['limit'](_0x72f5d7[_0x1d7d('0x32')]);if(_0x72f5d7[_0x1d7d('0x35')])_0x3fc216['offset'](_0x72f5d7[_0x1d7d('0x35')]);return db[_0x1d7d('0xa4')]['query'](_0x3fc216[_0x1d7d('0xa5')](),_0xc3c42f);})[_0x1d7d('0x24')](function(_0x45b5e2){if(_0x45b5e2[_0x1d7d('0x6e')]>0x0)_0x41ad41['where']('ui.ChatInteractionId\x20IN\x20?',_[_0x1d7d('0x41')](_0x45b5e2,'id'));return db[_0x1d7d('0xa4')][_0x1d7d('0x4e')](_0x41ad41[_0x1d7d('0xa5')](),_0xc3c42f)[_0x1d7d('0x24')](function(_0xa5c005){var _0x1af86a=_[_0x1d7d('0xb9')](_0xa5c005,_0x1d7d('0xba'));var _0x434500=[];_0x45b5e2[_0x1d7d('0x44')](function(_0x26781c){_0x434500[_0x1d7d('0x46')](updateChatInteraction(_0x26781c,_0x24e0b7,_0x1af86a));});return BPromise[_0x1d7d('0xbb')](_0x434500);});});})[_0x1d7d('0x24')](function(_0x39924a){_0x3ccd44[_0x1d7d('0xbc')]=_0x39924a;return _0x3ccd44;})[_0x1d7d('0x24')](respondWithFilteredResult(_0x370e8d,_0x72f5d7))['catch'](handleError(_0x370e8d,null));};exports[_0x1d7d('0xbd')]=function(_0x45e83d,_0x16ce51){var _0x20b99d={'raw':![],'where':{'id':_0x45e83d[_0x1d7d('0xbe')]['id']}},_0x5ca824={};_0x5ca824[_0x1d7d('0x4d')]=_[_0x1d7d('0x4f')](db[_0x1d7d('0x48')]['rawAttributes']);_0x5ca824[_0x1d7d('0x4e')]=_['keys'](_0x45e83d[_0x1d7d('0x4e')]);_0x5ca824[_0x1d7d('0x57')]=_[_0x1d7d('0x50')](_0x5ca824['model'],_0x5ca824[_0x1d7d('0x4e')]);_0x20b99d['attributes']=_[_0x1d7d('0x50')](_0x5ca824[_0x1d7d('0x4d')],qs[_0x1d7d('0x51')](_0x45e83d[_0x1d7d('0x4e')]['fields']));_0x20b99d[_0x1d7d('0x52')]=_0x20b99d['attributes'][_0x1d7d('0x6e')]?_0x20b99d[_0x1d7d('0x52')]:_0x5ca824['model'];if(_0x45e83d[_0x1d7d('0x4e')][_0x1d7d('0xbf')]){_0x20b99d[_0x1d7d('0xc0')]=[{'all':!![]}];}_0x20b99d=_[_0x1d7d('0xa7')]({},_0x20b99d,_0x45e83d['options']);return db['ChatInteraction']['find'](_0x20b99d)[_0x1d7d('0x24')](handleEntityNotFound(_0x16ce51,null))[_0x1d7d('0x24')](respondWithResult(_0x16ce51,null))[_0x1d7d('0x2e')](handleError(_0x16ce51,null));};exports[_0x1d7d('0xc1')]=function(_0x458f92,_0x55ea3b){return db[_0x1d7d('0x48')][_0x1d7d('0xc1')](_0x458f92[_0x1d7d('0x82')],{})[_0x1d7d('0x24')](respondWithResult(_0x55ea3b,0xc9))['catch'](handleError(_0x55ea3b,null));};exports['update']=function(_0xbde512,_0x21995f){if(_0xbde512[_0x1d7d('0x82')]['id']){delete _0xbde512[_0x1d7d('0x82')]['id'];}return db[_0x1d7d('0x48')][_0x1d7d('0x6f')]({'where':{'id':_0xbde512['params']['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x21995f,null))['then'](saveUpdates(_0xbde512[_0x1d7d('0x82')],null))[_0x1d7d('0x24')](respondWithResult(_0x21995f,null))['catch'](handleError(_0x21995f,null));};exports[_0x1d7d('0xc2')]=function(_0x5a754a,_0x13566e){return db[_0x1d7d('0x48')][_0x1d7d('0x6f')]({'where':{'id':_0x5a754a[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x13566e,null))['then'](removeEntity(_0x13566e,null))[_0x1d7d('0x2e')](handleError(_0x13566e,null));};exports['describe']=function(_0x303d6f,_0x5bf0de){return db['ChatInteraction'][_0x1d7d('0xc3')]()[_0x1d7d('0x24')](respondWithResult(_0x5bf0de,null))[_0x1d7d('0x2e')](handleError(_0x5bf0de,null));};exports[_0x1d7d('0xc4')]=function(_0x8ce169,_0x3f119f){var _0x14d3fb=_0x8ce169[_0x1d7d('0xbe')]['id'];var _0x3d5fff;var _0x3b7543;var _0x3e94d6;return db[_0x1d7d('0x48')]['findOne']({'where':{'id':_0x14d3fb}})['then'](function(_0x1f2d68){_0x3d5fff=_0x1f2d68;return db['ChatWebsite'][_0x1d7d('0xc5')]({'where':{'id':_0x1f2d68['ChatWebsiteId']},'attributes':['id','vidaooApiKey',_0x1d7d('0xc6'),_0x1d7d('0xc7'),_0x1d7d('0xc8'),_0x1d7d('0xc9')],'raw':!![]});})[_0x1d7d('0x24')](function(_0xd919b1){if(_0xd919b1&&_0xd919b1[_0x1d7d('0xca')]&&_0xd919b1[_0x1d7d('0xc6')]){_0x3b7543=_0xd919b1;var _0x5690c={'interaction':{'id':_0x14d3fb},'agent':{'id':_0x8ce169['user']['id'],'name':_0x8ce169['user'][_0x1d7d('0x3b')],'fullname':_0x8ce169['user'][_0x1d7d('0x42')],'email':_0x8ce169[_0x1d7d('0xa1')][_0x1d7d('0xcb')]},'contact':_0x8ce169[_0x1d7d('0x82')][_0x1d7d('0x3d')],'account':_0x8ce169[_0x1d7d('0x82')][_0x1d7d('0x40')]};var _0x3774f8={'rejectUnauthorized':![],'method':_0x1d7d('0xcc'),'url':_0x1d7d('0xcd'),'headers':{'X-APIKEY':_0xd919b1[_0x1d7d('0xca')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x8ce169[_0x1d7d('0xa1')]['email']],'buttons':null,'topic':_0x3b7543['vidaooTopic'],'note':_[_0x1d7d('0xce')](_0x3b7543[_0x1d7d('0xc8')])?null:getMustacheRender(_0x3b7543[_0x1d7d('0xc8')],_0x5690c),'metadata':null},'redirect':'follow','json':!![]};try{if(!_['isNull'](_0x3b7543[_0x1d7d('0xc9')])){var _0x470f5e=getMustacheRender(_0x3b7543['vidaooMetadata'],_0x5690c);var _0x1f0d9f=JSON['parse'](_0x470f5e);_0x3774f8[_0x1d7d('0x82')]['metadata']=_0x1f0d9f;}}catch(_0x1f50d4){throw new db[(_0x1d7d('0x98'))][(_0x1d7d('0xcf'))](_0x1d7d('0xd0'));}return rp(_0x3774f8);}else{throw new db[(_0x1d7d('0x98'))][(_0x1d7d('0xcf'))](_0x1d7d('0xd1'));}})[_0x1d7d('0x24')](function(_0x4f1602){_0x3e94d6=_0x4f1602;if(_0x3e94d6['id']){var _0x202d85={'body':_0x3e94d6[_0x1d7d('0xd2')],'ChatWebsiteId':_0x3b7543['id'],'ChatInteractionId':_0x3d5fff['id'],'direction':_0x1d7d('0xd3'),'UserId':_0x8ce169[_0x1d7d('0xa1')]['id']};return db[_0x1d7d('0xd4')][_0x1d7d('0xc1')](_0x202d85,{});}else{throw new db['Sequelize'][(_0x1d7d('0xcf'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x1d7d('0x24')](function(){return _0x3d5fff[_0x1d7d('0xd5')]({'vidaooSessionId':_0x3e94d6['id']});})['then'](respondWithResult(_0x3f119f,null))[_0x1d7d('0x2e')](handleError(_0x3f119f,null));};exports[_0x1d7d('0xd6')]=function(_0x3e7f3c,_0x454679){if(_0x3e7f3c['body']['id']){delete _0x3e7f3c[_0x1d7d('0x82')]['id'];}return db[_0x1d7d('0x48')]['find']({'where':{'id':_0x3e7f3c['params']['id']},'include':[{'model':db[_0x1d7d('0xd7')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x454679,null))['then'](saveUpdates(_0x3e7f3c[_0x1d7d('0x82')],null))['then'](respondWithResult(_0x454679,null))[_0x1d7d('0x2e')](handleError(_0x454679,null));};exports[_0x1d7d('0xd8')]=function(_0x4abfb1,_0x4caa84,_0x561f33){if(_0x4abfb1[_0x1d7d('0x82')]['id']){delete _0x4abfb1[_0x1d7d('0x82')]['id'];}return db[_0x1d7d('0x48')]['find']({'where':{'id':_0x4abfb1[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](function(_0x54616b){if(!_0x54616b){logger['error'](_0x1d7d('0xd9'),'abandon',0x194,'entity\x20not\x20found');_0x4caa84[_0x1d7d('0x2f')](0x194);}else{if(_0x54616b[_0x1d7d('0xda')]){throw new db[(_0x1d7d('0x98'))][(_0x1d7d('0xcf'))](_0x1d7d('0xdb'));}}return _0x54616b;})[_0x1d7d('0x24')](function(_0x19427f){if(_0x19427f){return _0x19427f[_0x1d7d('0xdc')]({'closed':_0x4abfb1['body']['closed'],'disposition':_0x4abfb1[_0x1d7d('0x82')][_0x1d7d('0xdd')]})[_0x1d7d('0x24')](function(_0x4d8a36){return _0x4d8a36;});}})[_0x1d7d('0x24')](function(_0x216585){return respondWithRpcPromise('AbandonInteraction',_0x1d7d('0xd8'),_0x4abfb1[_0x1d7d('0x82')],client9004);})[_0x1d7d('0x24')](respondWithResult(_0x4caa84,null))['catch'](handleError(_0x4caa84,null));};exports['attachmentUpload']=function(_0x854f68,_0x205d6f,_0x149415){_0x854f68[_0x1d7d('0x82')][_0x1d7d('0x3b')]=_0x854f68[_0x1d7d('0xde')]['originalname'];_0x854f68[_0x1d7d('0x82')][_0x1d7d('0xdf')]=_0x854f68['file'][_0x1d7d('0xe0')];_0x854f68[_0x1d7d('0x82')]['type']=_0x854f68['file']['mimetype'];return db[_0x1d7d('0xe1')][_0x1d7d('0xc1')](_0x854f68[_0x1d7d('0x82')])[_0x1d7d('0x24')](respondWithResult(_0x205d6f,0xc9))[_0x1d7d('0x2e')](handleError(_0x205d6f,null));};exports[_0x1d7d('0xe2')]=function(_0x3e358c,_0x2eae3c,_0x3838ef){return db[_0x1d7d('0x48')][_0x1d7d('0xc5')]({'where':{'id':_0x3e358c[_0x1d7d('0xbe')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2eae3c,null))['then'](function(_0x545b09){if(_0x545b09){if(_0x545b09[_0x1d7d('0xe3')]){return _0x2eae3c[_0x1d7d('0x30')](0x193)[_0x1d7d('0xe4')]({'status':0x193,'message':_0x1d7d('0xe5')});}return db[_0x1d7d('0xe1')][_0x1d7d('0xc5')]({'where':{'id':_0x3e358c[_0x1d7d('0x4e')][_0x1d7d('0xe6')]},'raw':!![]})['then'](handleEntityNotFound(_0x2eae3c,null));}})['then'](function(_0x549144){if(_0x549144){var _0x2a4feb=_0x549144[_0x1d7d('0xe7')]!==null;var _0x4df896=path[_0x1d7d('0xe8')](config['root'],_0x1d7d('0xe9'));if(_0x2a4feb){_0x4df896=path[_0x1d7d('0xe8')](_0x4df896,_0x1d7d('0xea'));}var _0x37eb97=path[_0x1d7d('0xe8')](_0x4df896,_0x549144[_0x1d7d('0xdf')]);return _0x2eae3c['download'](_0x37eb97);}})[_0x1d7d('0x2e')](handleError(_0x2eae3c,null));};exports[_0x1d7d('0xeb')]=function(_0x185697,_0x4d5753){var _0x55929b=null;var _0x43ce7f=null;var _0x2b0486=null;var _0x337c32=null;if(_0x185697['body']['id']){delete _0x185697[_0x1d7d('0x82')]['id'];}if(_0x185697['body'][_0x1d7d('0xec')]){_0x337c32=path[_0x1d7d('0xe8')](config[_0x1d7d('0xed')],'server/files/chat/upload/',util['format'](_0x1d7d('0xee'),Date[_0x1d7d('0xef')]()));_0x185697[_0x1d7d('0x82')][_0x1d7d('0xf0')]=_0x337c32;}return db[_0x1d7d('0x48')][_0x1d7d('0x6f')]({'where':{'id':_0x185697[_0x1d7d('0xbe')]['id']},'include':[{'model':db[_0x1d7d('0xd4')],'as':_0x1d7d('0xf1'),'include':[{'model':db[_0x1d7d('0x80')],'as':_0x1d7d('0x80')}]}]})['then'](handleEntityNotFound(_0x4d5753,null))[_0x1d7d('0x24')](saveUpdates(_0x185697[_0x1d7d('0x82')],null))[_0x1d7d('0x24')](function(_0x551a56){if(_0x551a56){_0x55929b=_0x551a56;return db['ChatWebsite'][_0x1d7d('0x6f')]({'where':{'id':_0x55929b['ChatWebsiteId']}});}})[_0x1d7d('0x24')](function(_0x1d47d9){if(_0x1d47d9){_0x2b0486=_0x1d47d9;return db[_0x1d7d('0xd7')]['find']({'where':{'id':_0x55929b[_0x1d7d('0x7b')]}});}})['then'](function(_0x5c0be4){if(_0x5c0be4){_0x43ce7f=_0x5c0be4;if(_0x337c32){var _0x46b9e5=null;for(var _0x385e15=0x1;_0x385e15<_0x55929b['Messages'][_0x1d7d('0x6e')];++_0x385e15){_0x46b9e5=_0x55929b[_0x1d7d('0xf1')][_0x385e15];var _0x20543c=_0x46b9e5[_0x1d7d('0xda')]?util[_0x1d7d('0xf2')]('%s%d',_0x2b0486[_0x1d7d('0xf3')],_0x46b9e5['UserId']):_0x1d7d('0xf4');var _0x474f68=_0x185697['body'][_0x1d7d('0xf5')]||util[_0x1d7d('0xf2')](_0x1d7d('0xf6'),_0x1d7d('0xf7'),_0x46b9e5[_0x1d7d('0x7b')]);switch(_0x2b0486[_0x1d7d('0xf8')]){case _0x1d7d('0xf9'):_0x20543c=_0x46b9e5[_0x1d7d('0xda')]?util[_0x1d7d('0xf2')](_0x1d7d('0xf6'),_0x2b0486[_0x1d7d('0xf3')],_0x46b9e5[_0x1d7d('0xda')]):_0x1d7d('0xf4');break;case'agent_alias':_0x20543c=_0x46b9e5['UserId']?_0x46b9e5[_0x1d7d('0x80')]['alias']||_0x46b9e5['User'][_0x1d7d('0x42')]:'System';break;case _0x1d7d('0xfa'):_0x20543c=_0x46b9e5[_0x1d7d('0xda')]?_0x46b9e5[_0x1d7d('0x80')]['fullname']:_0x1d7d('0xf4');break;default:_0x20543c=_0x46b9e5[_0x1d7d('0xda')]?util[_0x1d7d('0xf2')](_0x1d7d('0xf6'),_0x2b0486[_0x1d7d('0xf3')],_0x46b9e5[_0x1d7d('0xda')]):_0x1d7d('0xf4');}var _0x353bb1=util[_0x1d7d('0xf2')]('[%s]\x20%s:\x20%s\x0a',moment(_0x46b9e5[_0x1d7d('0x87')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x46b9e5[_0x1d7d('0xfb')]==='in'?_0x474f68:_0x20543c,_0x46b9e5['body']);if(!_0x46b9e5[_0x1d7d('0xfc')]){fs[_0x1d7d('0xfd')](_0x337c32,_0x353bb1);}}return db[_0x1d7d('0xfe')]['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x1d7d('0xff'),'raw':!![]}]});}}})[_0x1d7d('0x24')](function(_0x5c2113){if(_0x5c2113&&_0x5c2113[_0x1d7d('0xff')]&&_0x185697[_0x1d7d('0x82')]){var _0x129d4b={'tls':{'rejectUnauthorized':![]}};if(_0x5c2113['Smtp']['service']){_0x129d4b[_0x1d7d('0x100')]=_0x5c2113[_0x1d7d('0xff')][_0x1d7d('0x100')];}else{_0x129d4b['host']=_0x5c2113[_0x1d7d('0xff')][_0x1d7d('0x101')];_0x129d4b['port']=_0x5c2113['Smtp']['port'];_0x129d4b[_0x1d7d('0x102')]=_0x5c2113[_0x1d7d('0xff')][_0x1d7d('0x102')];}if(_0x5c2113['Smtp']['authentication']){_0x129d4b[_0x1d7d('0x103')]={'user':_0x5c2113[_0x1d7d('0xff')]['user'],'pass':_0x5c2113['Smtp'][_0x1d7d('0x104')]};}return respondWithRpcPromise(_0x1d7d('0x105'),'sendMail',{'account':_0x129d4b,'message':{'from':util[_0x1d7d('0xf2')]('\x22%s\x22\x20<%s>',_0x5c2113[_0x1d7d('0x3b')],_0x5c2113[_0x1d7d('0xcb')]||_0x5c2113[_0x1d7d('0xff')][_0x1d7d('0xa1')]),'to':_0x185697[_0x1d7d('0x82')][_0x1d7d('0xec')],'subject':_0x1d7d('0x106'),'text':util[_0x1d7d('0xf2')](_0x1d7d('0x107'),_0x185697[_0x1d7d('0x82')][_0x1d7d('0xec')]),'attachments':[{'path':_0x337c32}]}})['then'](function(){return _0x55929b;})[_0x1d7d('0x2e')](function(_0x18c505){console[_0x1d7d('0x29')](_0x18c505);});}else{return _0x55929b;}})['then'](respondWithStatusCode(_0x4d5753,0xc8))['catch'](handleError(_0x4d5753,null));};exports[_0x1d7d('0x108')]=function(_0x1b41b5,_0x5b79bd,_0xb87340){return db[_0x1d7d('0xd4')][_0x1d7d('0x6f')]({'where':{'id':_0x1b41b5[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x5b79bd,null))[_0x1d7d('0x24')](function(_0x537520){if(_0x537520){return _0x537520[_0x1d7d('0x108')](_0x1b41b5['body']['ids'],_['omit'](_0x1b41b5[_0x1d7d('0x82')],['ids','id'])||{});}})[_0x1d7d('0x24')](respondWithResult(_0x5b79bd,null))[_0x1d7d('0x2e')](handleError(_0x5b79bd,null));};exports['getMessages']=function(_0x1ce79d,_0x7dbbc9,_0x286ddd){var _0x1484b1={'raw':![],'where':{}};var _0x5be0c4={};var _0x50be17={'count':0x0,'rows':[]};return db[_0x1d7d('0x48')][_0x1d7d('0xc5')]({'where':{'id':_0x1ce79d[_0x1d7d('0xbe')]['id']}})['then'](handleEntityNotFound(_0x7dbbc9,null))['then'](function(_0x81fadf){if(_0x81fadf){_0x5be0c4['model']=_[_0x1d7d('0x4f')](db[_0x1d7d('0xd4')][_0x1d7d('0x49')]);_0x5be0c4[_0x1d7d('0x4e')]=_['keys'](_0x1ce79d[_0x1d7d('0x4e')]);_0x5be0c4['filters']=_[_0x1d7d('0x50')](_0x5be0c4[_0x1d7d('0x4d')],_0x5be0c4[_0x1d7d('0x4e')]);_0x1484b1['attributes']=_[_0x1d7d('0x50')](_0x5be0c4[_0x1d7d('0x4d')],qs['fields'](_0x1ce79d[_0x1d7d('0x4e')][_0x1d7d('0x51')]));_0x1484b1[_0x1d7d('0x52')]=_0x1484b1[_0x1d7d('0x52')]['length']?_0x1484b1[_0x1d7d('0x52')]:_0x5be0c4[_0x1d7d('0x4d')];if(!_0x1ce79d[_0x1d7d('0x4e')]['hasOwnProperty']('nolimit')){_0x1484b1[_0x1d7d('0x32')]=qs['limit'](_0x1ce79d[_0x1d7d('0x4e')][_0x1d7d('0x32')]);_0x1484b1[_0x1d7d('0x35')]=qs['offset'](_0x1ce79d[_0x1d7d('0x4e')]['offset']);}_0x1484b1[_0x1d7d('0x9c')]=qs['sort'](_0x1ce79d[_0x1d7d('0x4e')]['sort']);_0x1484b1['where']=qs[_0x1d7d('0x57')](_[_0x1d7d('0x58')](_0x1ce79d[_0x1d7d('0x4e')],_0x5be0c4[_0x1d7d('0x57')]));_0x1484b1[_0x1d7d('0x56')]['ChatInteractionId']=_0x81fadf['id'];if(_0x1ce79d[_0x1d7d('0x4e')][_0x1d7d('0x92')]){_0x1484b1[_0x1d7d('0x56')]=_['merge'](_0x1484b1[_0x1d7d('0x56')],{'$or':_['map'](_0x1484b1['attributes'],function(_0x19ee24){var _0x3cdad2={};_0x3cdad2[_0x19ee24]={'$like':'%'+_0x1ce79d['query'][_0x1d7d('0x92')]+'%'};return _0x3cdad2;})});}if(_0x1ce79d[_0x1d7d('0x4e')][_0x1d7d('0x89')]){var _0x24984d=_0x1ce79d[_0x1d7d('0x4e')]['$gte'][_0x1d7d('0x77')](',');var _0x5a2144={};_0x5a2144[_0x24984d[0x0]]={'$gte':moment(_0x24984d[0x1])[_0x1d7d('0xf2')](_0x1d7d('0x109'))};_0x1484b1[_0x1d7d('0x56')]=_['merge'](_0x1484b1['where'],_0x5a2144);}_0x1484b1=_['merge']({},_0x1484b1,_0x1ce79d['options']);return db['ChatMessage'][_0x1d7d('0x34')]({'where':_0x1484b1[_0x1d7d('0x56')]})[_0x1d7d('0x24')](function(_0x1e83dc){_0x50be17[_0x1d7d('0x34')]=_0x1e83dc;if(_0x1ce79d['query']['includeAll']){_0x1484b1[_0x1d7d('0xc0')]=[{'all':!![]}];}return db[_0x1d7d('0xd4')]['findAll'](_0x1484b1);})[_0x1d7d('0x24')](function(_0x2d0232){_0x50be17[_0x1d7d('0xbc')]=_0x2d0232;return _0x50be17;});}})['then'](respondWithFilteredResult(_0x7dbbc9,_0x1484b1))[_0x1d7d('0x2e')](handleError(_0x7dbbc9,null));};exports[_0x1d7d('0x10a')]=function(_0xb42210,_0x3844b6,_0x1181b6){var _0x530493={'where':{}},_0x53cdb8={},_0x960917={'count':0x0,'rows':[]};return db[_0x1d7d('0x48')][_0x1d7d('0xc5')]({'where':{'id':_0xb42210[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x3844b6,null))['then'](function(_0x339603){if(_0x339603){_0x53cdb8[_0x1d7d('0x4d')]=_['keys'](db['ChatMessage'][_0x1d7d('0x49')]);_0x53cdb8['query']=_[_0x1d7d('0x4f')](_0xb42210[_0x1d7d('0x4e')]);_0x53cdb8[_0x1d7d('0x57')]=_[_0x1d7d('0x50')](_0x53cdb8[_0x1d7d('0x4d')],_0x53cdb8[_0x1d7d('0x4e')]);_0x530493[_0x1d7d('0x52')]=_['intersection'](_0x53cdb8[_0x1d7d('0x4d')],qs[_0x1d7d('0x51')](_0xb42210[_0x1d7d('0x4e')]['fields']));_0x530493[_0x1d7d('0x52')]=_0x530493[_0x1d7d('0x52')]['length']?_0x530493[_0x1d7d('0x52')]:_0x53cdb8['model'];if(!_0xb42210[_0x1d7d('0x4e')][_0x1d7d('0x53')](_0x1d7d('0x54'))){_0x530493[_0x1d7d('0x32')]=qs[_0x1d7d('0x32')](_0xb42210['query'][_0x1d7d('0x32')]);_0x530493[_0x1d7d('0x35')]=qs['offset'](_0xb42210['query'][_0x1d7d('0x35')]);}_0x530493[_0x1d7d('0x9c')]=qs['sort'](_0xb42210[_0x1d7d('0x4e')][_0x1d7d('0x55')]);_0x530493[_0x1d7d('0x56')]=qs[_0x1d7d('0x57')](_['pick'](_0xb42210['query'],_0x53cdb8[_0x1d7d('0x57')]));_0x530493[_0x1d7d('0x56')][_0x1d7d('0xba')]=_0x339603['id'];if(_0xb42210[_0x1d7d('0x4e')][_0x1d7d('0x92')]){_0x530493[_0x1d7d('0x56')]=_[_0x1d7d('0xa7')](_0x530493[_0x1d7d('0x56')],{'$or':_[_0x1d7d('0x41')](_0x530493[_0x1d7d('0x52')],function(_0x3dfeb8){var _0x4726cb={};_0x4726cb[_0x3dfeb8]={'$like':'%'+_0xb42210[_0x1d7d('0x4e')][_0x1d7d('0x92')]+'%'};return _0x4726cb;})});}_0x530493[_0x1d7d('0x56')][_0x1d7d('0xfc')]=![];if(_0xb42210[_0x1d7d('0x4e')]['id']){_0x530493['where']['id']={'$gt':_0xb42210[_0x1d7d('0x4e')]['id']};}_0x530493=_['merge']({},_0x530493,_0xb42210['options']);return db[_0x1d7d('0xd4')][_0x1d7d('0x34')]({'where':_0x530493[_0x1d7d('0x56')]})[_0x1d7d('0x24')](function(_0x1e2b03){_0x960917['count']=_0x1e2b03;_0x530493[_0x1d7d('0xc0')]=[];if(_0xb42210[_0x1d7d('0x4e')]['includeAgent']){_0x530493[_0x1d7d('0xc0')]['push']({'model':db[_0x1d7d('0x80')],'as':_0x1d7d('0x80'),'attributes':['id',_0x1d7d('0x42'),_0x1d7d('0x10b')]});}if(_0xb42210[_0x1d7d('0x4e')]['includeAll']){_0x530493[_0x1d7d('0xc0')]=[{'all':!![]}];}return db[_0x1d7d('0xd4')][_0x1d7d('0x10c')](_0x530493);})[_0x1d7d('0x24')](function(_0x2d1258){_0x960917[_0x1d7d('0xbc')]=_0x2d1258;return _0x960917;});}})[_0x1d7d('0x24')](respondWithFilteredResult(_0x3844b6,_0x530493))[_0x1d7d('0x2e')](handleError(_0x3844b6,null));};exports[_0x1d7d('0x10d')]=function(_0x34b43f,_0x14a937,_0x291f26){return db['ChatInteraction'][_0x1d7d('0x6f')]({'where':{'id':_0x34b43f[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x14a937,null))['then'](function(_0x59b044){if(_0x59b044){return _0x59b044[_0x1d7d('0x10e')](_0x34b43f['body'][_0x1d7d('0x10f')],_[_0x1d7d('0x110')](_0x34b43f[_0x1d7d('0x82')],[_0x1d7d('0x10f'),'id'])||{})[_0x1d7d('0x111')](function(){return db[_0x1d7d('0x7e')]['findAll']({'attributes':['id',_0x1d7d('0x3b'),'color'],'where':{'id':_0x34b43f['body'][_0x1d7d('0x10f')]}});})[_0x1d7d('0x24')](function(_0x5b1ae1){socket[_0x1d7d('0x112')](_0x1d7d('0x113'),{'id':Number(_0x34b43f['params']['id']),'tags':_0x5b1ae1||[]});return{'id':Number(_0x34b43f[_0x1d7d('0xbe')]['id']),'tags':_0x5b1ae1||[]};});}})['then'](respondWithResult(_0x14a937,null))[_0x1d7d('0x2e')](handleError(_0x14a937,null));};exports[_0x1d7d('0x114')]=function(_0x7c3bd8,_0x552481,_0x2c91d5){return db['ChatInteraction'][_0x1d7d('0x6f')]({'where':{'id':_0x7c3bd8[_0x1d7d('0xbe')]['id']}})[_0x1d7d('0x24')](handleEntityNotFound(_0x552481,null))[_0x1d7d('0x24')](function(_0xf5e9f8){if(_0xf5e9f8){return _0xf5e9f8['removeTags'](_0x7c3bd8['query'][_0x1d7d('0x10f')]);}})[_0x1d7d('0x24')](respondWithStatusCode(_0x552481,null))['catch'](handleError(_0x552481,null));};exports[_0x1d7d('0x115')]=function(_0x210be0,_0x5f1b69){var _0x44c5ac=moment()[_0x1d7d('0x116')]()['toString']();var _0x39cae3=path[_0x1d7d('0xe8')](config[_0x1d7d('0xed')],'server','files',_0x1d7d('0x117'));var _0x1eec70=path[_0x1d7d('0xe8')](config[_0x1d7d('0xed')],_0x1d7d('0x118'),_0x1d7d('0x119'),_0x1d7d('0x11a'));var _0x3ded4b=path['join'](_0x39cae3,_0x44c5ac);var _0xe65d48=util[_0x1d7d('0xf2')](_0x1d7d('0x11b'),_0x210be0[_0x1d7d('0xbe')]['id'],_0x44c5ac);var _0x3b440c=path['join'](_0x39cae3,_0xe65d48);var _0x473472=[];_0x473472[_0x1d7d('0x46')]({'model':db[_0x1d7d('0x80')],'as':_0x1d7d('0x80'),'attributes':['id',_0x1d7d('0x42')],'raw':!![]});_0x473472[_0x1d7d('0x46')]({'model':db[_0x1d7d('0xd7')],'as':_0x1d7d('0x73'),'attributes':['id','firstName',_0x1d7d('0x11c')],'raw':!![]});if(_0x210be0[_0x1d7d('0x4e')][_0x1d7d('0x11a')]){_0x473472[_0x1d7d('0x46')]({'model':db['Attachment'],'as':_0x1d7d('0xe1'),'raw':!![]});}var _0x2aab28=[{'model':db[_0x1d7d('0xd4')],'as':_0x1d7d('0xf1'),'attributes':['id','body',_0x1d7d('0x87'),_0x1d7d('0xfb'),'secret',_0x1d7d('0x8e')],'include':_0x473472}];_0x2aab28['push']({'model':db[_0x1d7d('0x11d')],'as':'Account','attributes':['id','name']});_0x2aab28[_0x1d7d('0x46')]({'model':db[_0x1d7d('0x80')],'as':'Owner','attributes':['id','fullname']});return db[_0x1d7d('0x48')]['find']({'where':{'id':_0x210be0[_0x1d7d('0xbe')]['id']},'include':_0x2aab28})[_0x1d7d('0x24')](handleEntityNotFound(_0x5f1b69,null))[_0x1d7d('0x24')](function(_0x4e8473){if(_0x4e8473){var _0x194822=_0x4e8473[_0x1d7d('0x11e')]({'plain':!![]});fs[_0x1d7d('0x11f')](_0x3ded4b);var _0x3e93bb={'channel':_0x1d7d('0x120'),'account':_0x194822[_0x1d7d('0x121')]['name'],'agent':_0x194822['Owner']?_0x194822[_0x1d7d('0x122')][_0x1d7d('0x42')]:_0x1d7d('0x123'),'createdAt':moment(_0x194822[_0x1d7d('0x87')])[_0x1d7d('0xf2')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x194822[_0x1d7d('0xe3')]?moment(_0x194822['closedAt'])['format'](_0x1d7d('0x109'))[_0x1d7d('0xa5')]():'','disposition':_0x194822[_0x1d7d('0xdd')],'chatInfo':{'browser':_0x194822[_0x1d7d('0x124')],'os':_0x194822[_0x1d7d('0x125')],'referer':_0x194822['referer'],'customerIp':_0x194822[_0x1d7d('0x126')],'customerPort':_0x194822[_0x1d7d('0x127')]?_0x194822[_0x1d7d('0x127')]:_0x1d7d('0x123')},'messages':_(_0x194822[_0x1d7d('0xf1')])[_0x1d7d('0x128')]()['filter']({'secret':![]})[_0x1d7d('0x41')](function(_0x6ea91f){if(_0x6ea91f[_0x1d7d('0xe1')]){var _0x2b3cbd=path[_0x1d7d('0xe8')](_0x1eec70,_0x6ea91f[_0x1d7d('0xe1')][_0x1d7d('0xdf')]);if(fs['existsSync'](_0x2b3cbd)){fs[_0x1d7d('0x129')](_0x2b3cbd)[_0x1d7d('0x12a')](fs[_0x1d7d('0x12b')](path[_0x1d7d('0xe8')](_0x3ded4b,_0x6ea91f[_0x1d7d('0xe1')]['basename'])));}}return{'date':moment(_0x6ea91f[_0x1d7d('0x87')])[_0x1d7d('0xf2')](_0x1d7d('0x109'))[_0x1d7d('0xa5')](),'sender':_0x6ea91f['direction']==='out'?_0x6ea91f[_0x1d7d('0x80')]?_0x6ea91f[_0x1d7d('0x80')][_0x1d7d('0x42')]:_0x1d7d('0xf4'):_0x6ea91f[_0x1d7d('0x73')]['firstName']+(_0x6ea91f[_0x1d7d('0x73')][_0x1d7d('0x11c')]?'\x20'+_0x6ea91f[_0x1d7d('0x73')]['lastName']:''),'body':_0x6ea91f[_0x1d7d('0xe1')]?_0x6ea91f[_0x1d7d('0xe1')][_0x1d7d('0xdf')]:_0x6ea91f[_0x1d7d('0x82')],'direction':_0x6ea91f['direction']===_0x1d7d('0xd3')?'A':'C','secret':_0x6ea91f[_0x1d7d('0xfc')],'read':_0x6ea91f[_0x1d7d('0x8e')],'attachment':_0x6ea91f['Attachment']};})[_0x1d7d('0x76')]()};return ejs[_0x1d7d('0x12c')](path[_0x1d7d('0xe8')](config[_0x1d7d('0xed')],'server','views',_0x1d7d('0x12d')),{'interaction':_0x3e93bb})[_0x1d7d('0x24')](function(_0x43f4cb){var _0x21d65a=path[_0x1d7d('0xe8')](_0x3ded4b,'transcript-'+_0x194822['id']+'-'+_0x44c5ac+_0x1d7d('0x12e'));var _0x4d0682={'path':_0x21d65a,'channel':_0x1d7d('0x120'),'interactionId':_0x194822['id']};return pdf[_0x1d7d('0x12f')](_0x43f4cb,_0x4d0682);})['then'](function(){return new BPromise(function(_0x29f93c,_0x582183){zipdir(_0x3ded4b,{'saveTo':_0x3b440c},function(_0x12250e,_0x19127b){if(_0x12250e)return _0x582183(_0x12250e);return _0x29f93c(_0x19127b);});})['then'](function(){return new BPromise(function(_0x35f2d1,_0x588610){rimraf(_0x3ded4b,function(_0x35f18d){if(_0x35f18d)_0x588610(_0x35f18d);return _0x35f2d1();});});})[_0x1d7d('0x24')](function(){return _0x5f1b69[_0x1d7d('0x115')](_0x3b440c,_0xe65d48,function(_0x10263c){if(_0x10263c){console['log']('err',_0x10263c);}else{fs[_0x1d7d('0x130')](_0x3b440c);}});});});}else{return _0x5f1b69[_0x1d7d('0x2f')](0xc8);}})[_0x1d7d('0x2e')](handleError(_0x5f1b69,null));}; \ No newline at end of file +var _0x4fc2=['result','catch','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','render','merge','body','contact','agent','interaction','account','map','fullname','TagIds','Tags','split','forEach','push','ChatInteraction','rawAttributes','type','key','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname','ui.ChatInteractionId','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','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','search','parseSearch','sqlOperator','conditions','find','unreadMessages','`\x20=\x200','having','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','keys','some','compact','isEmpty','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','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','SELECT','DESC','t.id\x20IN\x20?','ChatWebsiteId','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','all','rows','params','includeAll','options','create','describe','createVidaooSession','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','mimetype','Attachment','Unauthorized','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','pathTranscript','Messages','User','ChatWebsite','%s%d','agentAlias','System','customer','website_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','pick','YYYY-MM-DD\x20HH:mm:ss','include','findAll','getMyMessages','includeAgent','addTags','setTags','spread','Tag','removeTags','unix','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','direction','Account','Owner','mkdirSync','N.A.','closedAt','customerIp','customerPort','existsSync','createWriteStream','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','Chat','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message'];(function(_0x58e6a8,_0x56e7e6){var _0x1b1c9a=function(_0x2ea4b4){while(--_0x2ea4b4){_0x58e6a8['push'](_0x58e6a8['shift']());}};_0x1b1c9a(++_0x56e7e6);}(_0x4fc2,0x111));var _0x24fc=function(_0x482372,_0x40f56b){_0x482372=_0x482372-0x0;var _0x55fbea=_0x4fc2[_0x482372];return _0x55fbea;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var pdf=require(_0x24fc('0x15'));var hardwareService=require(_0x24fc('0x16'));var logger=require(_0x24fc('0x17'))(_0x24fc('0x18'));var utils=require('../../config/utils');var config=require(_0x24fc('0x19'));var licenseUtil=require(_0x24fc('0x1a'));var db=require('../../mysqldb')['db'];config[_0x24fc('0x1b')]=_[_0x24fc('0x1c')](config[_0x24fc('0x1b')],{'host':_0x24fc('0x1d'),'port':0x18eb});var socket=require(_0x24fc('0x1e'))(new Redis(config[_0x24fc('0x1b')]));require('./chatInteraction.socket')[_0x24fc('0x1f')](socket);var jayson=require(_0x24fc('0x20'));var client=jayson[_0x24fc('0x21')][_0x24fc('0x22')]({'port':0x232b});var client9004=jayson['client'][_0x24fc('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x588543,_0x4af098,_0x3385c7,_0x218fb6){return new BPromise(function(_0x41c593,_0x25cb40){var _0x52a884=_0x218fb6||client;return _0x52a884[_0x24fc('0x23')](_0x588543,_0x3385c7)[_0x24fc('0x24')](function(_0x6cfa0a){logger[_0x24fc('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x4af098,_0x24fc('0x26'));logger[_0x24fc('0x27')](_0x24fc('0x28'),_0x4af098,'request\x20sent',JSON[_0x24fc('0x29')](_0x6cfa0a));if(_0x6cfa0a[_0x24fc('0x2a')]){if(_0x6cfa0a[_0x24fc('0x2a')][_0x24fc('0x2b')]===0x1f4){logger['error'](_0x24fc('0x2c'),_0x4af098,_0x6cfa0a['error'][_0x24fc('0x2d')]);return _0x25cb40(_0x6cfa0a['error'][_0x24fc('0x2d')]);}logger[_0x24fc('0x2a')](_0x24fc('0x2c'),_0x4af098,_0x6cfa0a['error'][_0x24fc('0x2d')]);return _0x41c593(_0x6cfa0a['error'][_0x24fc('0x2d')]);}else{logger[_0x24fc('0x25')](_0x24fc('0x2c'),_0x4af098,_0x24fc('0x26'));_0x41c593(_0x6cfa0a[_0x24fc('0x2e')][_0x24fc('0x2d')]);}})[_0x24fc('0x2f')](function(_0x20192b){logger[_0x24fc('0x2a')](_0x24fc('0x2c'),_0x4af098,_0x20192b);_0x25cb40(_0x20192b);});});}function respondWithStatusCode(_0x568441,_0x11c913){_0x11c913=_0x11c913||0xcc;return function(_0x16f27f){if(_0x16f27f){return _0x568441[_0x24fc('0x30')](_0x11c913);}return _0x568441['status'](_0x11c913)[_0x24fc('0x31')]();};}function respondWithResult(_0x3d1ec8,_0x35f9f9){_0x35f9f9=_0x35f9f9||0xc8;return function(_0x290f84){if(_0x290f84){return _0x3d1ec8[_0x24fc('0x32')](_0x35f9f9)[_0x24fc('0x33')](_0x290f84);}};}function respondWithFilteredResult(_0x5ac1f2,_0x240ae7){return function(_0x29a461){if(_0x29a461){var _0x3c99ed=typeof _0x240ae7[_0x24fc('0x34')]===_0x24fc('0x35')&&typeof _0x240ae7['limit']==='undefined';var _0x4e6f73=_0x29a461[_0x24fc('0x36')];var _0x574ba3=_0x3c99ed?0x0:_0x240ae7[_0x24fc('0x34')];var _0x3e6389=_0x3c99ed?_0x29a461[_0x24fc('0x36')]:_0x240ae7[_0x24fc('0x34')]+_0x240ae7['limit'];var _0x66eec0;if(_0x3e6389>=_0x4e6f73){_0x3e6389=_0x4e6f73;_0x66eec0=0xc8;}else{_0x66eec0=0xce;}_0x5ac1f2[_0x24fc('0x32')](_0x66eec0);return _0x5ac1f2['set'](_0x24fc('0x37'),_0x574ba3+'-'+_0x3e6389+'/'+_0x4e6f73)[_0x24fc('0x33')](_0x29a461);}return null;};}function patchUpdates(_0x4d756f){return function(_0x48c62a){try{jsonpatch[_0x24fc('0x38')](_0x48c62a,_0x4d756f,!![]);}catch(_0x56eae7){return BPromise[_0x24fc('0x39')](_0x56eae7);}return _0x48c62a[_0x24fc('0x3a')]();};}function saveUpdates(_0x5491b0,_0x2ae896){return function(_0x33bbf2){if(_0x33bbf2){return _0x33bbf2[_0x24fc('0x3b')](_0x5491b0)[_0x24fc('0x24')](function(_0x1c5874){return _0x1c5874;});}return null;};}function removeEntity(_0x1e205d,_0x3b3932){return function(_0x2a209d){if(_0x2a209d){return _0x2a209d[_0x24fc('0x3c')]()['then'](function(){_0x1e205d[_0x24fc('0x32')](0xcc)[_0x24fc('0x31')]();});}};}function handleEntityNotFound(_0x2fbe30,_0x316aa2){return function(_0x242bd5){if(!_0x242bd5){_0x2fbe30['sendStatus'](0x194);}return _0x242bd5;};}function handleError(_0x56a9bd,_0xd52d10){_0xd52d10=_0xd52d10||0x1f4;return function(_0x5d48fe){logger[_0x24fc('0x2a')](_0x5d48fe[_0x24fc('0x3d')]);if(_0x5d48fe[_0x24fc('0x3e')]){delete _0x5d48fe[_0x24fc('0x3e')];}_0x56a9bd['status'](_0xd52d10)[_0x24fc('0x3f')](_0x5d48fe);};}function getMustacheRender(_0x4f4ec8,_0x65771d){return Mustache[_0x24fc('0x40')](_0x4f4ec8,_[_0x24fc('0x41')](_0x65771d[_0x24fc('0x42')],{'contact':_0x65771d[_0x24fc('0x43')],'message':_0x65771d['message'],'agent':_0x65771d[_0x24fc('0x44')],'interaction':_0x65771d[_0x24fc('0x45')],'account':_0x65771d[_0x24fc('0x46')]}))||'';}function getInteractionUsers(_0x22a75c,_0x5ceae2){return new BPromise(function(_0x172923,_0x2f0bd9){try{if(_0x5ceae2[_0x22a75c['id']]){_0x22a75c['Users']=_[_0x24fc('0x47')](_0x5ceae2[_0x22a75c['id']],function(_0x52df2e){return{'id':_0x52df2e['id'],'fullname':_0x52df2e[_0x24fc('0x48')]};});}}catch(_0x2fd30d){_0x2f0bd9(_0x2fd30d);}_0x172923(_0x22a75c);});}function getInteractionTags(_0x3a15ab,_0x1e045a){return new BPromise(function(_0x431189,_0x278b18){try{if(_0x3a15ab[_0x24fc('0x49')]){_0x3a15ab[_0x24fc('0x4a')]=[];_0x3a15ab['TagIds'][_0x24fc('0x4b')](',')[_0x24fc('0x4c')](function(_0x32f72c){_0x3a15ab['Tags'][_0x24fc('0x4d')](_0x1e045a[_0x32f72c]);});}delete _0x3a15ab[_0x24fc('0x49')];}catch(_0x4ae4a7){_0x278b18(_0x4ae4a7);}_0x431189(_0x3a15ab);});}function updateChatInteraction(_0x2c4a6c,_0x22f30b,_0x2c598c){return new BPromise(function(_0x5e4e9b,_0x31ddd0){return getInteractionUsers(_0x2c4a6c,_0x2c598c)[_0x24fc('0x24')](function(_0x585e48){return getInteractionTags(_0x585e48,_0x22f30b);})[_0x24fc('0x24')](function(_0x169982){_0x5e4e9b(_0x169982);})[_0x24fc('0x2f')](function(_0x2a0ac4){_0x31ddd0(_0x2a0ac4);});});}exports['index']=function(_0x2eecaf,_0x9bc56a){var _0x3ce7b3={},_0x7b38fa={},_0xbcbcfa={'count':0x0,'rows':[]};var _0x58a950=_[_0x24fc('0x47')](db[_0x24fc('0x4e')][_0x24fc('0x4f')],function(_0x3c6ffb){return{'name':_0x3c6ffb['fieldName'],'type':_0x3c6ffb[_0x24fc('0x50')][_0x24fc('0x51')]};});_0x7b38fa['model']=_['map'](_0x58a950,_0x24fc('0x3e'));_0x7b38fa['query']=_['keys'](_0x2eecaf[_0x24fc('0x52')]);_0x7b38fa['filters']=_[_0x24fc('0x53')](_0x7b38fa[_0x24fc('0x54')],_0x7b38fa[_0x24fc('0x52')]);_0x3ce7b3['attributes']=_[_0x24fc('0x53')](_0x7b38fa[_0x24fc('0x54')],qs[_0x24fc('0x55')](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x55')]));_0x3ce7b3[_0x24fc('0x56')]=_0x3ce7b3[_0x24fc('0x56')][_0x24fc('0x57')]?_0x3ce7b3['attributes']:_0x7b38fa['model'];if(!_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x58')](_0x24fc('0x59'))){_0x3ce7b3['limit']=qs['limit'](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x5a')]);_0x3ce7b3[_0x24fc('0x34')]=qs[_0x24fc('0x34')](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x34')]);}_0x3ce7b3[_0x24fc('0x5b')]=qs[_0x24fc('0x5c')](_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x5c')]);_0x3ce7b3[_0x24fc('0x5d')]=qs[_0x24fc('0x5e')](_['pick'](_0x2eecaf[_0x24fc('0x52')],_0x7b38fa[_0x24fc('0x5e')]),_0x58a950);var _0x32a466=[];var _0xb0fc00=squel[_0x24fc('0x5f')]()['field']('id')[_0x24fc('0x60')]('name')[_0x24fc('0x60')](_0x24fc('0x61'))[_0x24fc('0x62')](_0x24fc('0x63'));var _0x40f42b=squel[_0x24fc('0x5f')]()['field'](_0x24fc('0x64'))[_0x24fc('0x60')](_0x24fc('0x65'))[_0x24fc('0x60')](_0x24fc('0x66'))[_0x24fc('0x62')]('user_has_chat_interactions','ui')[_0x24fc('0x67')](_0x24fc('0x68'),'u',_0x24fc('0x69'));var _0x1b69ad=squel[_0x24fc('0x5f')]()[_0x24fc('0x62')](_0x24fc('0x6a'),'i')['left_join'](_0x24fc('0x6b'),'c',_0x24fc('0x6c'))['left_join'](_0x24fc('0x68'),'o',_0x24fc('0x6d'))[_0x24fc('0x67')](_0x24fc('0x6e'),'a',_0x24fc('0x6f'))[_0x24fc('0x67')]('chat_messages','me',_0x24fc('0x70'))['left_join'](_0x24fc('0x71'),'it',_0x24fc('0x72'))['left_join'](_0x24fc('0x63'),'t','t.id\x20=\x20it.TagId');var _0x1c1f74=squel['expr']();var _0xdff811=[];var _0x27b612=squel['expr']();var _0x2edef7;if(_0x2eecaf['query'][_0x24fc('0x73')]){_0x2edef7=as[_0x24fc('0x74')](_0x2eecaf['query'][_0x24fc('0x73')]);var _0x3ec1a8=_0x2edef7[_0x24fc('0x75')];for(var _0x47179d=0x0;_0x47179d<_0x2edef7[_0x24fc('0x76')]['length'];_0x47179d++){var _0x39da59=_0x2edef7[_0x24fc('0x76')][_0x47179d];var _0x2d657a='i';var _0x2b5dca=_[_0x24fc('0x77')](_0x58a950,['name',_0x39da59['field']]);if(!_0x2b5dca){switch(_0x39da59[_0x24fc('0x60')]){case _0x24fc('0x78'):if(_0x39da59['value']==0x1){_0x1b69ad['having']('`'+_0x39da59[_0x24fc('0x60')]+_0x24fc('0x79'));}else{_0x1b69ad[_0x24fc('0x7a')]('`'+_0x39da59[_0x24fc('0x60')]+'`\x20>\x200');}break;case _0x24fc('0x7b'):if(_0x39da59[_0x24fc('0x7c')]===_0x24fc('0x7d')){if(_0x39da59[_0x24fc('0x7e')][_0x24fc('0x4b')]('\x20')[_0x24fc('0x57')]>0x1){_0x1c1f74[_0x3ec1a8](_0x24fc('0x7f'),qs[_0x24fc('0x80')](_0x39da59[_0x24fc('0x7e')]),null);}else{var _0x1f6a71='%'+_0x39da59[_0x24fc('0x7e')]+'%';_0x1c1f74[_0x3ec1a8](_0x24fc('0x81'),_0x1f6a71,_0x1f6a71,_0x1f6a71);}}else{_0x2b5dca=_[_0x24fc('0x77')](_0x58a950,[_0x24fc('0x3e'),_0x24fc('0x82')]);_0x39da59['field']=_0x24fc('0x82');_0x10ef7c=as[_0x24fc('0x83')](_0x2d657a,_0x2b5dca[_0x24fc('0x50')],_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c[_0x24fc('0x84')],_0x10ef7c[_0x24fc('0x7e')][_0x24fc('0x85')],_0x10ef7c[_0x24fc('0x7e')][_0x24fc('0x31')]);}break;case'Tag':var _0x3475b8=_0x39da59[_0x24fc('0x7e')][_0x24fc('0x4b')](',')[_0x24fc('0x47')](function(_0x55fceb){return Number(_0x55fceb);});_0x3475b8[_0x24fc('0x4c')](function(_0x29b381){_0x27b612['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x29b381+',%');});_0xdff811=_['union'](_0xdff811,_0x3475b8);break;case'User':if(_0x39da59[_0x24fc('0x7c')]===_0x24fc('0x7d')){_0x1c1f74[_0x3ec1a8](_0x24fc('0x86'),'%'+_0x39da59[_0x24fc('0x7e')]+'%',null);}else{_0x2b5dca=_[_0x24fc('0x77')](_0x58a950,[_0x24fc('0x3e'),'UserId']);_0x39da59[_0x24fc('0x60')]=_0x24fc('0x87');_0x10ef7c=as['buildExpression'](_0x2d657a,_0x2b5dca['type'],_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c[_0x24fc('0x84')],_0x10ef7c[_0x24fc('0x7e')][_0x24fc('0x85')],_0x10ef7c['value'][_0x24fc('0x31')]);}break;case _0x24fc('0x42'):_0x10ef7c=as[_0x24fc('0x83')]('me',null,_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c['text'],_0x10ef7c['value']['start'],_0x10ef7c['value']['end']);break;}}else{var _0x10ef7c=as[_0x24fc('0x83')](_0x2d657a,_0x2b5dca[_0x24fc('0x50')],_0x39da59);_0x1c1f74[_0x3ec1a8](_0x10ef7c[_0x24fc('0x84')],_0x10ef7c['value'][_0x24fc('0x85')],_0x10ef7c['value'][_0x24fc('0x31')]);}}}else{var _0x4e6eec=_(_0x2eecaf[_0x24fc('0x52')])[_0x24fc('0x88')]()[_0x24fc('0x47')](function(_0x4291bd){return _[_0x24fc('0x89')](_0x58a950,[_0x24fc('0x3e'),_0x4291bd])?_0x4291bd:undefined;})[_0x24fc('0x8a')]()['value']();if(!_[_0x24fc('0x8b')](_0x4e6eec)){_0x4e6eec[_0x24fc('0x4c')](function(_0x2de101){if(_0x2de101==='ChatWebsiteId'){_0x1b69ad['where'](_0x24fc('0x8c'),[][_0x24fc('0x8d')](_0x2eecaf['query'][_0x2de101]));}else if(_0x2de101===_0x24fc('0x8e')){var _0x1a2e6d=JSON['parse'](_0x2eecaf[_0x24fc('0x52')][_0x2de101])[_0x24fc('0x8f')];var _0x5249ea=JSON[_0x24fc('0x90')](_0x2eecaf[_0x24fc('0x52')][_0x2de101])[_0x24fc('0x91')];_0x1b69ad[_0x24fc('0x5d')](_0x24fc('0x92'),_0x1a2e6d,_0x5249ea);}else{if(_0x2eecaf[_0x24fc('0x52')][_0x2de101]==='null'){_0x1b69ad['where']('i.'+_0x2de101+_0x24fc('0x93'));}else{_0x1b69ad['where']('i.'+_0x2de101+_0x24fc('0x94'),_0x2eecaf['query'][_0x2de101]);}}});}if(_0x2eecaf['query'][_0x24fc('0x95')]){if(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x95')]==0x1){_0x1b69ad[_0x24fc('0x7a')](_0x24fc('0x96'));}else{_0x1b69ad[_0x24fc('0x7a')](_0x24fc('0x97'));}}if(_0x2eecaf[_0x24fc('0x52')]['tag']){_0xdff811=_[_0x24fc('0x98')](_0x2eecaf[_0x24fc('0x52')]['tag'])?_0x2eecaf['query'][_0x24fc('0x99')]:new Array(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x99')]);_0xdff811[_0x24fc('0x4c')](function(_0xd1e6){_0x27b612['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xd1e6+',%');});}if(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x9a')]){var _0x5ca35b=_0x2eecaf[_0x24fc('0x52')][_0x24fc('0x9a')][_0x24fc('0x9b')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x24fc('0x9c')](_0x5ca35b)){_0x1c1f74['or'](_0x24fc('0x9d'),_0x5ca35b+'%');}else{_0x1c1f74['or'](_0x24fc('0x9e'),qs[_0x24fc('0x80')](_0x5ca35b))['or'](_0x24fc('0x9f'),_0x5ca35b+'%');}}}_0x1b69ad[_0x24fc('0x5d')](_0x1c1f74);_0x1b69ad[_0x24fc('0xa0')](_0x24fc('0xa1'));var _0x188edb={'type':db['Sequelize'][_0x24fc('0xa2')][_0x24fc('0xa3')],'raw':!![]};var _0x1dcccf=_0x1b69ad['clone']();_0x1dcccf['field']('i.id');_0x1dcccf[_0x24fc('0x60')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x24fc('0x78'));if(_0x3ce7b3[_0x24fc('0x5b')]){_0x3ce7b3['order'][_0x24fc('0x4c')](function(_0x559692){var _0x41cef7=_0x559692[0x0]==='contactName'?_0x559692[0x0]:'i.'+_0x559692[0x0];_0x1b69ad[_0x24fc('0x5b')](_0x41cef7,_0x559692[0x1]===_0x24fc('0xa4')?![]:!![]);});}if(!_[_0x24fc('0x8b')](_0xdff811)){_0x1b69ad[_0x24fc('0x7a')](_0x27b612);_0x1dcccf[_0x24fc('0x5d')](_0x24fc('0xa5'),_0xdff811);}BPromise['resolve']()[_0x24fc('0x24')](function(){if(!_0x2edef7){if(_0x2eecaf[_0x24fc('0x52')][_0x24fc('0xa6')])return;_0x1dcccf[_0x24fc('0x5d')](_0x24fc('0xa7'));_0x1b69ad[_0x24fc('0x5d')](_0x24fc('0xa7'));return;}if(_0x2eecaf[_0x24fc('0xa8')][_0x24fc('0xa9')]!=='agent')return;return _0x2eecaf[_0x24fc('0xa8')][_0x24fc('0xaa')]({'attributes':['id'],'raw':!![]})[_0x24fc('0x24')](function(_0x30ed50){if(_['isEmpty'](_0x30ed50)){_0x1dcccf[_0x24fc('0x5d')](_0x24fc('0xab'));_0x1b69ad[_0x24fc('0x5d')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x1dcccf[_0x24fc('0x5d')]('i.ChatWebsiteId\x20IN\x20?',_['map'](_0x30ed50,'id'));_0x1b69ad['where'](_0x24fc('0x8c'),_['map'](_0x30ed50,'id'));}});})[_0x24fc('0x24')](function(){if(_0x2eecaf[_0x24fc('0xa8')][_0x24fc('0xa9')]===_0x24fc('0x44')&&!_0x2edef7&&!_0x2eecaf['query'][_0x24fc('0xa6')])return[];return db[_0x24fc('0xac')][_0x24fc('0x52')](_0x1dcccf[_0x24fc('0xad')](),_0x188edb);})[_0x24fc('0x24')](function(_0x5c80a5){_0xbcbcfa[_0x24fc('0x36')]=_0x5c80a5[_0x24fc('0x57')];if(_0xbcbcfa[_0x24fc('0x36')]===0x0)return[];return db[_0x24fc('0xac')]['query'](_0xb0fc00['toString'](),_0x188edb)[_0x24fc('0x24')](function(_0x4216da){_0x32a466=_[_0x24fc('0xae')](_0x4216da,'id');_0x188edb=_[_0x24fc('0x41')](_0x188edb,{'model':db[_0x24fc('0x4e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2eecaf['query'][_0x24fc('0x55')]){_0x3ce7b3[_0x24fc('0x56')][_0x24fc('0x4c')](function(_0x5d5a59){_0x1b69ad[_0x24fc('0x60')]('i.'+_0x5d5a59);});}else{_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xaf'),_0x24fc('0x78'));_0x1b69ad[_0x24fc('0x60')]('a.key','Account.key');_0x1b69ad['field'](_0x24fc('0xb0'),_0x24fc('0xb1'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb2'),_0x24fc('0xb3'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb4'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb5'),_0x24fc('0xb6'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb7'),'Contact.lastName');_0x1b69ad['field'](_0x24fc('0xb8'),'Contact.email');_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xb9'),_0x24fc('0xba'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xbb'),_0x24fc('0xbc'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xbd'),_0x24fc('0xbe'));_0x1b69ad['field'](_0x24fc('0xbf'),_0x24fc('0xc0'));_0x1b69ad['field']('o.internal',_0x24fc('0xc1'));_0x1b69ad[_0x24fc('0x60')](_0x24fc('0xc2'),_0x24fc('0x49'));}if(_0x3ce7b3[_0x24fc('0x5a')])_0x1b69ad[_0x24fc('0x5a')](_0x3ce7b3['limit']);if(_0x3ce7b3[_0x24fc('0x34')])_0x1b69ad[_0x24fc('0x34')](_0x3ce7b3[_0x24fc('0x34')]);return db[_0x24fc('0xac')]['query'](_0x1b69ad[_0x24fc('0xad')](),_0x188edb);})[_0x24fc('0x24')](function(_0x1506e8){if(_0x1506e8['length']>0x0)_0x40f42b[_0x24fc('0x5d')](_0x24fc('0xc3'),_[_0x24fc('0x47')](_0x1506e8,'id'));return db['sequelize'][_0x24fc('0x52')](_0x40f42b[_0x24fc('0xad')](),_0x188edb)['then'](function(_0x543db4){var _0x283251=_[_0x24fc('0xc4')](_0x543db4,_0x24fc('0xc5'));var _0x2029cd=[];_0x1506e8[_0x24fc('0x4c')](function(_0x3afe80){_0x2029cd['push'](updateChatInteraction(_0x3afe80,_0x32a466,_0x283251));});return BPromise[_0x24fc('0xc6')](_0x2029cd);});});})[_0x24fc('0x24')](function(_0x17a6a9){_0xbcbcfa[_0x24fc('0xc7')]=_0x17a6a9;return _0xbcbcfa;})[_0x24fc('0x24')](respondWithFilteredResult(_0x9bc56a,_0x3ce7b3))[_0x24fc('0x2f')](handleError(_0x9bc56a,null));};exports['show']=function(_0x4018d3,_0x4a2522){var _0x5226aa={'raw':![],'where':{'id':_0x4018d3[_0x24fc('0xc8')]['id']}},_0x260a62={};_0x260a62['model']=_[_0x24fc('0x88')](db[_0x24fc('0x4e')][_0x24fc('0x4f')]);_0x260a62[_0x24fc('0x52')]=_['keys'](_0x4018d3[_0x24fc('0x52')]);_0x260a62[_0x24fc('0x5e')]=_[_0x24fc('0x53')](_0x260a62[_0x24fc('0x54')],_0x260a62[_0x24fc('0x52')]);_0x5226aa[_0x24fc('0x56')]=_['intersection'](_0x260a62['model'],qs['fields'](_0x4018d3[_0x24fc('0x52')][_0x24fc('0x55')]));_0x5226aa['attributes']=_0x5226aa[_0x24fc('0x56')][_0x24fc('0x57')]?_0x5226aa[_0x24fc('0x56')]:_0x260a62['model'];if(_0x4018d3[_0x24fc('0x52')][_0x24fc('0xc9')]){_0x5226aa['include']=[{'all':!![]}];}_0x5226aa=_['merge']({},_0x5226aa,_0x4018d3[_0x24fc('0xca')]);return db[_0x24fc('0x4e')][_0x24fc('0x77')](_0x5226aa)['then'](handleEntityNotFound(_0x4a2522,null))[_0x24fc('0x24')](respondWithResult(_0x4a2522,null))['catch'](handleError(_0x4a2522,null));};exports['create']=function(_0x344c0f,_0x52484a){return db['ChatInteraction'][_0x24fc('0xcb')](_0x344c0f['body'],{})[_0x24fc('0x24')](respondWithResult(_0x52484a,0xc9))[_0x24fc('0x2f')](handleError(_0x52484a,null));};exports[_0x24fc('0x3b')]=function(_0x11eaeb,_0x4ae346){if(_0x11eaeb[_0x24fc('0x42')]['id']){delete _0x11eaeb[_0x24fc('0x42')]['id'];}return db['ChatInteraction'][_0x24fc('0x77')]({'where':{'id':_0x11eaeb[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x4ae346,null))[_0x24fc('0x24')](saveUpdates(_0x11eaeb[_0x24fc('0x42')],null))['then'](respondWithResult(_0x4ae346,null))[_0x24fc('0x2f')](handleError(_0x4ae346,null));};exports[_0x24fc('0x3c')]=function(_0x5793d9,_0x759d35){return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x5793d9[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x759d35,null))['then'](removeEntity(_0x759d35,null))[_0x24fc('0x2f')](handleError(_0x759d35,null));};exports['describe']=function(_0x5c8969,_0x42c158){return db[_0x24fc('0x4e')][_0x24fc('0xcc')]()['then'](respondWithResult(_0x42c158,null))['catch'](handleError(_0x42c158,null));};exports[_0x24fc('0xcd')]=function(_0x38fba8,_0xfa9d58){var _0x353a64=_0x38fba8[_0x24fc('0xc8')]['id'];var _0x4ee1ad;var _0x4875bd;var _0x1efb25;return db['ChatInteraction']['findOne']({'where':{'id':_0x353a64}})[_0x24fc('0x24')](function(_0x484775){_0x4ee1ad=_0x484775;return db['ChatWebsite'][_0x24fc('0xce')]({'where':{'id':_0x484775[_0x24fc('0xa6')]},'attributes':['id',_0x24fc('0xcf'),_0x24fc('0xd0'),_0x24fc('0xd1'),_0x24fc('0xd2'),_0x24fc('0xd3')],'raw':!![]});})['then'](function(_0x3b2891){if(_0x3b2891&&_0x3b2891[_0x24fc('0xcf')]&&_0x3b2891[_0x24fc('0xd0')]){_0x4875bd=_0x3b2891;var _0x6e3447={'interaction':{'id':_0x353a64},'agent':{'id':_0x38fba8[_0x24fc('0xa8')]['id'],'name':_0x38fba8[_0x24fc('0xa8')][_0x24fc('0x3e')],'fullname':_0x38fba8[_0x24fc('0xa8')][_0x24fc('0x48')],'email':_0x38fba8[_0x24fc('0xa8')][_0x24fc('0xd4')]},'contact':_0x38fba8[_0x24fc('0x42')][_0x24fc('0x43')],'account':_0x38fba8[_0x24fc('0x42')][_0x24fc('0x46')]};var _0x38ec08={'rejectUnauthorized':![],'method':_0x24fc('0xd5'),'url':_0x24fc('0xd6'),'headers':{'X-APIKEY':_0x3b2891[_0x24fc('0xcf')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x38fba8[_0x24fc('0xa8')][_0x24fc('0xd4')]],'buttons':null,'topic':_0x4875bd[_0x24fc('0xd1')],'note':_[_0x24fc('0xd7')](_0x4875bd[_0x24fc('0xd2')])?null:getMustacheRender(_0x4875bd[_0x24fc('0xd2')],_0x6e3447),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x24fc('0xd7')](_0x4875bd[_0x24fc('0xd3')])){var _0x1d8a8f=getMustacheRender(_0x4875bd[_0x24fc('0xd3')],_0x6e3447);var _0x534388=JSON['parse'](_0x1d8a8f);_0x38ec08['body'][_0x24fc('0xd8')]=_0x534388;}}catch(_0x5aa947){throw new db[(_0x24fc('0xd9'))]['ValidationError'](_0x24fc('0xda'));}return rp(_0x38ec08);}else{throw new db[(_0x24fc('0xd9'))][(_0x24fc('0xdb'))](_0x24fc('0xdc'));}})[_0x24fc('0x24')](function(_0x468477){_0x1efb25=_0x468477;if(_0x1efb25['id']){var _0x1c4ac1={'body':_0x1efb25[_0x24fc('0xdd')],'ChatWebsiteId':_0x4875bd['id'],'ChatInteractionId':_0x4ee1ad['id'],'direction':'out','UserId':_0x38fba8[_0x24fc('0xa8')]['id']};return db[_0x24fc('0xde')][_0x24fc('0xcb')](_0x1c4ac1,{});}else{throw new db[(_0x24fc('0xd9'))]['ValidationError'](_0x24fc('0xdf'));}})[_0x24fc('0x24')](function(){return _0x4ee1ad[_0x24fc('0xe0')]({'vidaooSessionId':_0x1efb25['id']});})[_0x24fc('0x24')](respondWithResult(_0xfa9d58,null))[_0x24fc('0x2f')](handleError(_0xfa9d58,null));};exports[_0x24fc('0xe1')]=function(_0x17280c,_0x13f9e3){if(_0x17280c[_0x24fc('0x42')]['id']){delete _0x17280c[_0x24fc('0x42')]['id'];}return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x17280c['params']['id']},'include':[{'model':db[_0x24fc('0xe2')],'as':_0x24fc('0x7b')}]})[_0x24fc('0x24')](handleEntityNotFound(_0x13f9e3,null))[_0x24fc('0x24')](saveUpdates(_0x17280c[_0x24fc('0x42')],null))[_0x24fc('0x24')](respondWithResult(_0x13f9e3,null))[_0x24fc('0x2f')](handleError(_0x13f9e3,null));};exports['abandon']=function(_0x2400a3,_0x16368d,_0x5b1fe2){if(_0x2400a3[_0x24fc('0x42')]['id']){delete _0x2400a3[_0x24fc('0x42')]['id'];}return db['ChatInteraction'][_0x24fc('0x77')]({'where':{'id':_0x2400a3['params']['id']}})[_0x24fc('0x24')](function(_0x21d6d3){if(!_0x21d6d3){logger['error'](_0x24fc('0xe3'),_0x24fc('0xe4'),0x194,_0x24fc('0xe5'));_0x16368d[_0x24fc('0x30')](0x194);}else{if(_0x21d6d3[_0x24fc('0x87')]){throw new db[(_0x24fc('0xd9'))][(_0x24fc('0xdb'))](_0x24fc('0xe6'));}}return _0x21d6d3;})[_0x24fc('0x24')](function(_0x2c6ac9){if(_0x2c6ac9){return _0x2c6ac9[_0x24fc('0x3b')]({'closed':_0x2400a3[_0x24fc('0x42')][_0x24fc('0xe7')],'disposition':_0x2400a3[_0x24fc('0x42')][_0x24fc('0xe8')]})[_0x24fc('0x24')](function(_0x2ccd34){return _0x2ccd34;});}})['then'](function(_0x51764e){return respondWithRpcPromise('AbandonInteraction',_0x24fc('0xe4'),_0x2400a3['body'],client9004);})[_0x24fc('0x24')](respondWithResult(_0x16368d,null))[_0x24fc('0x2f')](handleError(_0x16368d,null));};exports[_0x24fc('0xe9')]=function(_0x2d7ecb,_0xf4f427,_0x41fbf1){_0x2d7ecb[_0x24fc('0x42')][_0x24fc('0x3e')]=_0x2d7ecb[_0x24fc('0xea')][_0x24fc('0xeb')];_0x2d7ecb[_0x24fc('0x42')]['basename']=_0x2d7ecb['file'][_0x24fc('0xec')];_0x2d7ecb[_0x24fc('0x42')][_0x24fc('0x50')]=_0x2d7ecb['file'][_0x24fc('0xed')];return db[_0x24fc('0xee')][_0x24fc('0xcb')](_0x2d7ecb[_0x24fc('0x42')])[_0x24fc('0x24')](respondWithResult(_0xf4f427,0xc9))[_0x24fc('0x2f')](handleError(_0xf4f427,null));};exports['attachmentDownload']=function(_0x3c41c1,_0x337fad,_0x525d4f){return db[_0x24fc('0x4e')]['findOne']({'where':{'id':_0x3c41c1['params']['id']},'raw':!![]})[_0x24fc('0x24')](handleEntityNotFound(_0x337fad,null))[_0x24fc('0x24')](function(_0x282848){if(_0x282848){if(_0x282848[_0x24fc('0xe7')]){return _0x337fad['status'](0x193)[_0x24fc('0x33')]({'status':0x193,'message':_0x24fc('0xef')});}return db[_0x24fc('0xee')][_0x24fc('0xce')]({'where':{'id':_0x3c41c1[_0x24fc('0x52')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x337fad,null));}})[_0x24fc('0x24')](function(_0x2cbaa1){if(_0x2cbaa1){var _0xaab85=_0x2cbaa1[_0x24fc('0xf0')]!==null;var _0x42d3ae=path['join'](config[_0x24fc('0xf1')],_0x24fc('0xf2'));if(_0xaab85){_0x42d3ae=path[_0x24fc('0xf3')](_0x42d3ae,_0x24fc('0xf4'));}var _0xc73868=path[_0x24fc('0xf3')](_0x42d3ae,_0x2cbaa1[_0x24fc('0xf5')]);return _0x337fad[_0x24fc('0xf6')](_0xc73868);}})[_0x24fc('0x2f')](handleError(_0x337fad,null));};exports['close']=function(_0x3f0da7,_0x36f9d2){var _0x50a4c5=null;var _0x299fd8=null;var _0x5d01fa=null;var _0x92d51d=null;if(_0x3f0da7[_0x24fc('0x42')]['id']){delete _0x3f0da7['body']['id'];}if(_0x3f0da7['body'][_0x24fc('0xf7')]){_0x92d51d=path['join'](config[_0x24fc('0xf1')],_0x24fc('0xf8'),util[_0x24fc('0xf9')](_0x24fc('0xfa'),Date['now']()));_0x3f0da7[_0x24fc('0x42')][_0x24fc('0xfb')]=_0x92d51d;}return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x3f0da7[_0x24fc('0xc8')]['id']},'include':[{'model':db[_0x24fc('0xde')],'as':_0x24fc('0xfc'),'include':[{'model':db[_0x24fc('0xfd')],'as':_0x24fc('0xfd')}]}]})[_0x24fc('0x24')](handleEntityNotFound(_0x36f9d2,null))[_0x24fc('0x24')](saveUpdates(_0x3f0da7[_0x24fc('0x42')],null))[_0x24fc('0x24')](function(_0x210bc5){if(_0x210bc5){_0x50a4c5=_0x210bc5;return db[_0x24fc('0xfe')][_0x24fc('0x77')]({'where':{'id':_0x50a4c5[_0x24fc('0xa6')]}});}})[_0x24fc('0x24')](function(_0x4dbbf1){if(_0x4dbbf1){_0x5d01fa=_0x4dbbf1;return db[_0x24fc('0xe2')][_0x24fc('0x77')]({'where':{'id':_0x50a4c5[_0x24fc('0x82')]}});}})[_0x24fc('0x24')](function(_0x61a50b){if(_0x61a50b){_0x299fd8=_0x61a50b;if(_0x92d51d){var _0x282e8c=null;for(var _0x47637c=0x1;_0x47637c<_0x50a4c5[_0x24fc('0xfc')]['length'];++_0x47637c){_0x282e8c=_0x50a4c5[_0x24fc('0xfc')][_0x47637c];var _0x36788c=_0x282e8c[_0x24fc('0x87')]?util['format'](_0x24fc('0xff'),_0x5d01fa[_0x24fc('0x100')],_0x282e8c[_0x24fc('0x87')]):_0x24fc('0x101');var _0x1bbfe1=_0x3f0da7[_0x24fc('0x42')][_0x24fc('0x102')]||util[_0x24fc('0xf9')]('%s%d','Visitor',_0x282e8c[_0x24fc('0x82')]);switch(_0x5d01fa['agentIdentifier']){case _0x24fc('0x103'):_0x36788c=_0x282e8c[_0x24fc('0x87')]?util[_0x24fc('0xf9')](_0x24fc('0xff'),_0x5d01fa[_0x24fc('0x100')],_0x282e8c[_0x24fc('0x87')]):_0x24fc('0x101');break;case'agent_alias':_0x36788c=_0x282e8c[_0x24fc('0x87')]?_0x282e8c[_0x24fc('0xfd')][_0x24fc('0x104')]||_0x282e8c['User'][_0x24fc('0x48')]:_0x24fc('0x101');break;case _0x24fc('0x105'):_0x36788c=_0x282e8c['UserId']?_0x282e8c[_0x24fc('0xfd')][_0x24fc('0x48')]:_0x24fc('0x101');break;default:_0x36788c=_0x282e8c[_0x24fc('0x87')]?util[_0x24fc('0xf9')](_0x24fc('0xff'),_0x5d01fa[_0x24fc('0x100')],_0x282e8c[_0x24fc('0x87')]):_0x24fc('0x101');}var _0x3f1c36=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x282e8c[_0x24fc('0x8e')])[_0x24fc('0xf9')](_0x24fc('0x106')),_0x282e8c['direction']==='in'?_0x1bbfe1:_0x36788c,_0x282e8c[_0x24fc('0x42')]);if(!_0x282e8c[_0x24fc('0x107')]){fs[_0x24fc('0x108')](_0x92d51d,_0x3f1c36);}}return db[_0x24fc('0x109')][_0x24fc('0xce')]({'where':{'service':!![]},'include':[{'model':db[_0x24fc('0x10a')],'as':_0x24fc('0x10b'),'raw':!![]}]});}}})[_0x24fc('0x24')](function(_0x18ab28){if(_0x18ab28&&_0x18ab28[_0x24fc('0x10b')]&&_0x3f0da7[_0x24fc('0x42')]){var _0x14b0b5={'tls':{'rejectUnauthorized':![]}};if(_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x10c')]){_0x14b0b5[_0x24fc('0x10c')]=_0x18ab28['Smtp'][_0x24fc('0x10c')];}else{_0x14b0b5[_0x24fc('0x10d')]=_0x18ab28[_0x24fc('0x10b')]['host'];_0x14b0b5[_0x24fc('0x10e')]=_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x10e')];_0x14b0b5[_0x24fc('0x10f')]=_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x10f')];}if(_0x18ab28[_0x24fc('0x10b')][_0x24fc('0x110')]){_0x14b0b5[_0x24fc('0x111')]={'user':_0x18ab28[_0x24fc('0x10b')][_0x24fc('0xa8')],'pass':_0x18ab28[_0x24fc('0x10b')]['pass']};}return respondWithRpcPromise(_0x24fc('0x112'),_0x24fc('0x113'),{'account':_0x14b0b5,'message':{'from':util[_0x24fc('0xf9')](_0x24fc('0x114'),_0x18ab28[_0x24fc('0x3e')],_0x18ab28[_0x24fc('0xd4')]||_0x18ab28['Smtp'][_0x24fc('0xa8')]),'to':_0x3f0da7[_0x24fc('0x42')][_0x24fc('0xf7')],'subject':_0x24fc('0x115'),'text':util[_0x24fc('0xf9')](_0x24fc('0x116'),_0x3f0da7[_0x24fc('0x42')][_0x24fc('0xf7')]),'attachments':[{'path':_0x92d51d}]}})[_0x24fc('0x24')](function(){return _0x50a4c5;})[_0x24fc('0x2f')](function(_0x51ecc4){console['error'](_0x51ecc4);});}else{return _0x50a4c5;}})['then'](respondWithStatusCode(_0x36f9d2,0xc8))[_0x24fc('0x2f')](handleError(_0x36f9d2,null));};exports[_0x24fc('0x117')]=function(_0x21d021,_0x15035b,_0xe5f00){return db[_0x24fc('0xde')][_0x24fc('0x77')]({'where':{'id':_0x21d021[_0x24fc('0xc8')]['id']}})['then'](handleEntityNotFound(_0x15035b,null))[_0x24fc('0x24')](function(_0x263597){if(_0x263597){return _0x263597['addMessage'](_0x21d021[_0x24fc('0x42')][_0x24fc('0x118')],_[_0x24fc('0x119')](_0x21d021[_0x24fc('0x42')],[_0x24fc('0x118'),'id'])||{});}})[_0x24fc('0x24')](respondWithResult(_0x15035b,null))[_0x24fc('0x2f')](handleError(_0x15035b,null));};exports['getMessages']=function(_0xda0576,_0x1a136f,_0x47833f){var _0x59d561={'raw':![],'where':{}};var _0x4614fe={};var _0x7a2cca={'count':0x0,'rows':[]};return db[_0x24fc('0x4e')][_0x24fc('0xce')]({'where':{'id':_0xda0576[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x1a136f,null))['then'](function(_0x14bd08){if(_0x14bd08){_0x4614fe[_0x24fc('0x54')]=_['keys'](db[_0x24fc('0xde')][_0x24fc('0x4f')]);_0x4614fe[_0x24fc('0x52')]=_[_0x24fc('0x88')](_0xda0576[_0x24fc('0x52')]);_0x4614fe[_0x24fc('0x5e')]=_[_0x24fc('0x53')](_0x4614fe[_0x24fc('0x54')],_0x4614fe[_0x24fc('0x52')]);_0x59d561[_0x24fc('0x56')]=_['intersection'](_0x4614fe['model'],qs[_0x24fc('0x55')](_0xda0576[_0x24fc('0x52')]['fields']));_0x59d561[_0x24fc('0x56')]=_0x59d561[_0x24fc('0x56')][_0x24fc('0x57')]?_0x59d561['attributes']:_0x4614fe[_0x24fc('0x54')];if(!_0xda0576[_0x24fc('0x52')][_0x24fc('0x58')](_0x24fc('0x59'))){_0x59d561['limit']=qs[_0x24fc('0x5a')](_0xda0576['query'][_0x24fc('0x5a')]);_0x59d561['offset']=qs[_0x24fc('0x34')](_0xda0576[_0x24fc('0x52')]['offset']);}_0x59d561[_0x24fc('0x5b')]=qs[_0x24fc('0x5c')](_0xda0576[_0x24fc('0x52')]['sort']);_0x59d561[_0x24fc('0x5d')]=qs[_0x24fc('0x5e')](_[_0x24fc('0x11a')](_0xda0576['query'],_0x4614fe[_0x24fc('0x5e')]));_0x59d561[_0x24fc('0x5d')][_0x24fc('0xc5')]=_0x14bd08['id'];if(_0xda0576['query'][_0x24fc('0x9a')]){_0x59d561[_0x24fc('0x5d')]=_[_0x24fc('0x41')](_0x59d561[_0x24fc('0x5d')],{'$or':_[_0x24fc('0x47')](_0x59d561[_0x24fc('0x56')],function(_0x6fa372){var _0x1e5616={};_0x1e5616[_0x6fa372]={'$like':'%'+_0xda0576[_0x24fc('0x52')]['filter']+'%'};return _0x1e5616;})});}if(_0xda0576['query'][_0x24fc('0x8f')]){var _0x59cd3c=_0xda0576[_0x24fc('0x52')]['$gte']['split'](',');var _0x235cd7={};_0x235cd7[_0x59cd3c[0x0]]={'$gte':moment(_0x59cd3c[0x1])['format'](_0x24fc('0x11b'))};_0x59d561[_0x24fc('0x5d')]=_[_0x24fc('0x41')](_0x59d561['where'],_0x235cd7);}_0x59d561=_[_0x24fc('0x41')]({},_0x59d561,_0xda0576[_0x24fc('0xca')]);return db[_0x24fc('0xde')][_0x24fc('0x36')]({'where':_0x59d561[_0x24fc('0x5d')]})[_0x24fc('0x24')](function(_0x3e6fda){_0x7a2cca[_0x24fc('0x36')]=_0x3e6fda;if(_0xda0576[_0x24fc('0x52')][_0x24fc('0xc9')]){_0x59d561[_0x24fc('0x11c')]=[{'all':!![]}];}return db[_0x24fc('0xde')][_0x24fc('0x11d')](_0x59d561);})[_0x24fc('0x24')](function(_0x4f5acf){_0x7a2cca[_0x24fc('0xc7')]=_0x4f5acf;return _0x7a2cca;});}})[_0x24fc('0x24')](respondWithFilteredResult(_0x1a136f,_0x59d561))[_0x24fc('0x2f')](handleError(_0x1a136f,null));};exports[_0x24fc('0x11e')]=function(_0x4ba8de,_0x53e48e,_0x50012d){var _0x1449f2={'where':{}},_0x43492b={},_0x487e55={'count':0x0,'rows':[]};return db[_0x24fc('0x4e')][_0x24fc('0xce')]({'where':{'id':_0x4ba8de['params']['id']}})['then'](handleEntityNotFound(_0x53e48e,null))[_0x24fc('0x24')](function(_0x5a41d8){if(_0x5a41d8){_0x43492b['model']=_['keys'](db[_0x24fc('0xde')][_0x24fc('0x4f')]);_0x43492b[_0x24fc('0x52')]=_[_0x24fc('0x88')](_0x4ba8de[_0x24fc('0x52')]);_0x43492b[_0x24fc('0x5e')]=_[_0x24fc('0x53')](_0x43492b[_0x24fc('0x54')],_0x43492b['query']);_0x1449f2[_0x24fc('0x56')]=_[_0x24fc('0x53')](_0x43492b[_0x24fc('0x54')],qs[_0x24fc('0x55')](_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x55')]));_0x1449f2[_0x24fc('0x56')]=_0x1449f2[_0x24fc('0x56')][_0x24fc('0x57')]?_0x1449f2[_0x24fc('0x56')]:_0x43492b[_0x24fc('0x54')];if(!_0x4ba8de[_0x24fc('0x52')]['hasOwnProperty'](_0x24fc('0x59'))){_0x1449f2[_0x24fc('0x5a')]=qs[_0x24fc('0x5a')](_0x4ba8de[_0x24fc('0x52')]['limit']);_0x1449f2[_0x24fc('0x34')]=qs[_0x24fc('0x34')](_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x34')]);}_0x1449f2['order']=qs['sort'](_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x5c')]);_0x1449f2[_0x24fc('0x5d')]=qs[_0x24fc('0x5e')](_['pick'](_0x4ba8de[_0x24fc('0x52')],_0x43492b['filters']));_0x1449f2[_0x24fc('0x5d')][_0x24fc('0xc5')]=_0x5a41d8['id'];if(_0x4ba8de[_0x24fc('0x52')]['filter']){_0x1449f2[_0x24fc('0x5d')]=_[_0x24fc('0x41')](_0x1449f2[_0x24fc('0x5d')],{'$or':_[_0x24fc('0x47')](_0x1449f2['attributes'],function(_0x4ae822){var _0x545714={};_0x545714[_0x4ae822]={'$like':'%'+_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x9a')]+'%'};return _0x545714;})});}_0x1449f2[_0x24fc('0x5d')]['secret']=![];if(_0x4ba8de[_0x24fc('0x52')]['id']){_0x1449f2[_0x24fc('0x5d')]['id']={'$gt':_0x4ba8de['query']['id']};}_0x1449f2=_[_0x24fc('0x41')]({},_0x1449f2,_0x4ba8de[_0x24fc('0xca')]);return db[_0x24fc('0xde')][_0x24fc('0x36')]({'where':_0x1449f2['where']})['then'](function(_0x12921f){_0x487e55[_0x24fc('0x36')]=_0x12921f;_0x1449f2['include']=[];if(_0x4ba8de[_0x24fc('0x52')][_0x24fc('0x11f')]){_0x1449f2[_0x24fc('0x11c')]['push']({'model':db[_0x24fc('0xfd')],'as':_0x24fc('0xfd'),'attributes':['id','fullname','alias']});}if(_0x4ba8de[_0x24fc('0x52')][_0x24fc('0xc9')]){_0x1449f2[_0x24fc('0x11c')]=[{'all':!![]}];}return db[_0x24fc('0xde')][_0x24fc('0x11d')](_0x1449f2);})[_0x24fc('0x24')](function(_0x214f7d){_0x487e55[_0x24fc('0xc7')]=_0x214f7d;return _0x487e55;});}})[_0x24fc('0x24')](respondWithFilteredResult(_0x53e48e,_0x1449f2))[_0x24fc('0x2f')](handleError(_0x53e48e,null));};exports[_0x24fc('0x120')]=function(_0x1a7f96,_0x59d246,_0x281eed){return db[_0x24fc('0x4e')]['find']({'where':{'id':_0x1a7f96[_0x24fc('0xc8')]['id']}})[_0x24fc('0x24')](handleEntityNotFound(_0x59d246,null))['then'](function(_0x4e2c71){if(_0x4e2c71){return _0x4e2c71[_0x24fc('0x121')](_0x1a7f96['body'][_0x24fc('0x118')],_['omit'](_0x1a7f96[_0x24fc('0x42')],['ids','id'])||{})[_0x24fc('0x122')](function(){return db[_0x24fc('0x123')][_0x24fc('0x11d')]({'attributes':['id',_0x24fc('0x3e'),_0x24fc('0x61')],'where':{'id':_0x1a7f96[_0x24fc('0x42')][_0x24fc('0x118')]}});})[_0x24fc('0x24')](function(_0x3c5996){socket['emit']('chatInteractionTags:save',{'id':Number(_0x1a7f96['params']['id']),'tags':_0x3c5996||[]});return{'id':Number(_0x1a7f96[_0x24fc('0xc8')]['id']),'tags':_0x3c5996||[]};});}})[_0x24fc('0x24')](respondWithResult(_0x59d246,null))[_0x24fc('0x2f')](handleError(_0x59d246,null));};exports['removeTags']=function(_0x8dc31b,_0x5941bd,_0x4d73bb){return db[_0x24fc('0x4e')][_0x24fc('0x77')]({'where':{'id':_0x8dc31b[_0x24fc('0xc8')]['id']}})['then'](handleEntityNotFound(_0x5941bd,null))[_0x24fc('0x24')](function(_0x464057){if(_0x464057){return _0x464057[_0x24fc('0x124')](_0x8dc31b[_0x24fc('0x52')][_0x24fc('0x118')]);}})[_0x24fc('0x24')](respondWithStatusCode(_0x5941bd,null))['catch'](handleError(_0x5941bd,null));};exports[_0x24fc('0xf6')]=function(_0x9c34d9,_0x3e4f49){var _0x231f0b=moment()[_0x24fc('0x125')]()['toString']();var _0x34355e=path[_0x24fc('0xf3')](config[_0x24fc('0xf1')],_0x24fc('0x126'),_0x24fc('0x127'),'tmp');var _0x4d0910=path[_0x24fc('0xf3')](config[_0x24fc('0xf1')],'server','files',_0x24fc('0x128'));var _0x49025e=path[_0x24fc('0xf3')](_0x34355e,_0x231f0b);var _0x2c9a19=util['format'](_0x24fc('0x129'),_0x9c34d9['params']['id'],_0x231f0b);var _0x38ca24=path['join'](_0x34355e,_0x2c9a19);var _0x53a9aa=[];_0x53a9aa['push']({'model':db['User'],'as':_0x24fc('0xfd'),'attributes':['id',_0x24fc('0x48')],'raw':!![]});_0x53a9aa['push']({'model':db[_0x24fc('0xe2')],'as':_0x24fc('0x7b'),'attributes':['id',_0x24fc('0x12a'),_0x24fc('0x12b')],'raw':!![]});if(_0x9c34d9[_0x24fc('0x52')]['attachments']){_0x53a9aa[_0x24fc('0x4d')]({'model':db[_0x24fc('0xee')],'as':_0x24fc('0xee'),'raw':!![]});}var _0x2139e8=[{'model':db[_0x24fc('0xde')],'as':_0x24fc('0xfc'),'attributes':['id',_0x24fc('0x42'),'createdAt',_0x24fc('0x12c'),_0x24fc('0x107'),_0x24fc('0x95')],'include':_0x53a9aa}];_0x2139e8[_0x24fc('0x4d')]({'model':db['ChatWebsite'],'as':_0x24fc('0x12d'),'attributes':['id',_0x24fc('0x3e')]});_0x2139e8[_0x24fc('0x4d')]({'model':db[_0x24fc('0xfd')],'as':_0x24fc('0x12e'),'attributes':['id','fullname']});return db[_0x24fc('0x4e')]['find']({'where':{'id':_0x9c34d9[_0x24fc('0xc8')]['id']},'include':_0x2139e8})[_0x24fc('0x24')](handleEntityNotFound(_0x3e4f49,null))[_0x24fc('0x24')](function(_0x26179a){if(_0x26179a){var _0x6f1617=_0x26179a['get']({'plain':!![]});fs[_0x24fc('0x12f')](_0x49025e);var _0x57dfbc={'channel':'Chat','account':_0x6f1617['Account'][_0x24fc('0x3e')],'agent':_0x6f1617[_0x24fc('0x12e')]?_0x6f1617[_0x24fc('0x12e')][_0x24fc('0x48')]:_0x24fc('0x130'),'createdAt':moment(_0x6f1617[_0x24fc('0x8e')])[_0x24fc('0xf9')](_0x24fc('0x11b'))[_0x24fc('0xad')](),'closedAt':_0x6f1617[_0x24fc('0xe7')]?moment(_0x6f1617[_0x24fc('0x131')])[_0x24fc('0xf9')](_0x24fc('0x11b'))['toString']():'','disposition':_0x6f1617['disposition'],'chatInfo':{'browser':_0x6f1617['browserName'],'os':_0x6f1617['osName'],'referer':_0x6f1617['referer'],'customerIp':_0x6f1617[_0x24fc('0x132')],'customerPort':_0x6f1617[_0x24fc('0x133')]?_0x6f1617[_0x24fc('0x133')]:_0x24fc('0x130')},'messages':_(_0x6f1617['Messages'])['tail']()[_0x24fc('0x9a')]({'secret':![]})[_0x24fc('0x47')](function(_0x2ee9a6){if(_0x2ee9a6[_0x24fc('0xee')]){var _0x40409c=path['join'](_0x4d0910,_0x2ee9a6[_0x24fc('0xee')][_0x24fc('0xf5')]);if(fs[_0x24fc('0x134')](_0x40409c)){fs['createReadStream'](_0x40409c)['pipe'](fs[_0x24fc('0x135')](path[_0x24fc('0xf3')](_0x49025e,_0x2ee9a6[_0x24fc('0xee')][_0x24fc('0xf5')])));}}return{'date':moment(_0x2ee9a6[_0x24fc('0x8e')])[_0x24fc('0xf9')](_0x24fc('0x11b'))['toString'](),'sender':_0x2ee9a6[_0x24fc('0x12c')]===_0x24fc('0x136')?_0x2ee9a6[_0x24fc('0xfd')]?_0x2ee9a6[_0x24fc('0xfd')]['fullname']:'System':_0x2ee9a6['Contact']['firstName']+(_0x2ee9a6['Contact'][_0x24fc('0x12b')]?'\x20'+_0x2ee9a6[_0x24fc('0x7b')]['lastName']:''),'body':_0x2ee9a6[_0x24fc('0xee')]?_0x2ee9a6[_0x24fc('0xee')]['basename']:_0x2ee9a6[_0x24fc('0x42')],'direction':_0x2ee9a6['direction']===_0x24fc('0x136')?'A':'C','secret':_0x2ee9a6[_0x24fc('0x107')],'read':_0x2ee9a6[_0x24fc('0x95')],'attachment':_0x2ee9a6['Attachment']};})[_0x24fc('0x7e')]()};return ejs[_0x24fc('0x137')](path['join'](config[_0x24fc('0xf1')],'server','views',_0x24fc('0x138')),{'interaction':_0x57dfbc})[_0x24fc('0x24')](function(_0x24101d){var _0x5defce=path[_0x24fc('0xf3')](_0x49025e,_0x24fc('0x139')+_0x6f1617['id']+'-'+_0x231f0b+_0x24fc('0x13a'));var _0x187770={'path':_0x5defce,'channel':_0x24fc('0x13b'),'interactionId':_0x6f1617['id']};return pdf['createPdfFromHTML'](_0x24101d,_0x187770);})['then'](function(){return new BPromise(function(_0x3357cb,_0x2b633b){zipdir(_0x49025e,{'saveTo':_0x38ca24},function(_0x4ad7c4,_0x1d8b26){if(_0x4ad7c4)return _0x2b633b(_0x4ad7c4);return _0x3357cb(_0x1d8b26);});})[_0x24fc('0x24')](function(){return new BPromise(function(_0x4b0f8b,_0x59d408){rimraf(_0x49025e,function(_0x547f6b){if(_0x547f6b)_0x59d408(_0x547f6b);return _0x4b0f8b();});});})[_0x24fc('0x24')](function(){return _0x3e4f49[_0x24fc('0xf6')](_0x38ca24,_0x2c9a19,function(_0x3a2ffd){if(_0x3a2ffd){console[_0x24fc('0x13c')](_0x24fc('0x13d'),_0x3a2ffd);}else{fs[_0x24fc('0x13e')](_0x38ca24);}});});});}else{return _0x3e4f49[_0x24fc('0x30')](0xc8);}})['catch'](handleError(_0x3e4f49,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index fcc7259..d5619ba 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 _0x8e07=['remove','getUsers','then','setDataValue','Users','findAll','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update'];(function(_0x518cc9,_0x409039){var _0x502300=function(_0x53fb23){while(--_0x53fb23){_0x518cc9['push'](_0x518cc9['shift']());}};_0x502300(++_0x409039);}(_0x8e07,0xbf));var _0x78e0=function(_0x5724fd,_0x1cad51){_0x5724fd=_0x5724fd-0x0;var _0x1ade4a=_0x8e07[_0x5724fd];return _0x1ade4a;};'use strict';var EventEmitter=require(_0x78e0('0x0'));var ChatInteraction=require(_0x78e0('0x1'))['db'][_0x78e0('0x2')];var ChatMessage=require(_0x78e0('0x1'))['db'][_0x78e0('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x78e0('0x4')](0x0);var events={'afterCreate':_0x78e0('0x5'),'afterUpdate':_0x78e0('0x6'),'afterDestroy':_0x78e0('0x7')};function emitEvent(_0x5c96f3){return function(_0x40d487,_0x161efc,_0x5b1108){_0x40d487[_0x78e0('0x8')]({'attributes':['id'],'raw':!![]})[_0x78e0('0x9')](function(_0x1282d0){_0x40d487[_0x78e0('0xa')](_0x78e0('0xb'),_0x1282d0['map'](function(_0xba5a90){return{'id':_0xba5a90['id']};}));return ChatMessage[_0x78e0('0xc')]({'where':{'ChatInteractionId':_0x40d487['id'],'direction':'in','read':![]},'raw':!![]});})[_0x78e0('0x9')](function(_0x45ec08){_0x40d487['setDataValue']('unreadMessages',_0x45ec08[_0x78e0('0xd')]);ChatInteractionEvents[_0x78e0('0xe')](_0x5c96f3+':'+_0x40d487['id'],_0x40d487);ChatInteractionEvents[_0x78e0('0xe')](_0x5c96f3,_0x40d487);_0x5b1108(null);})['catch'](_0x5b1108(null));};}for(var e in events){if(events[_0x78e0('0xf')](e)){var event=events[e];ChatInteraction[_0x78e0('0x10')](e,emitEvent(event));}}module[_0x78e0('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0x4d80=['hasOwnProperty','exports','../../mysqldb','ChatInteraction','setMaxListeners','save','update','getUsers','then','setDataValue','map','unreadMessages','length','emit','catch'];(function(_0x5aca7e,_0x27314b){var _0x2f922a=function(_0x471b3c){while(--_0x471b3c){_0x5aca7e['push'](_0x5aca7e['shift']());}};_0x2f922a(++_0x27314b);}(_0x4d80,0x101));var _0x04d8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4d80[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x04d8('0x0'))['db'][_0x04d8('0x1')];var ChatMessage=require(_0x04d8('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x04d8('0x2')](0x0);var events={'afterCreate':_0x04d8('0x3'),'afterUpdate':_0x04d8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x48edc0){return function(_0x2940be,_0x5c89d8,_0x54b0bd){_0x2940be[_0x04d8('0x5')]({'attributes':['id'],'raw':!![]})[_0x04d8('0x6')](function(_0x1cb21c){_0x2940be[_0x04d8('0x7')]('Users',_0x1cb21c[_0x04d8('0x8')](function(_0x4859d6){return{'id':_0x4859d6['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x2940be['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4bc617){_0x2940be[_0x04d8('0x7')](_0x04d8('0x9'),_0x4bc617[_0x04d8('0xa')]);ChatInteractionEvents[_0x04d8('0xb')](_0x48edc0+':'+_0x2940be['id'],_0x2940be);ChatInteractionEvents[_0x04d8('0xb')](_0x48edc0,_0x2940be);_0x54b0bd(null);})[_0x04d8('0xc')](_0x54b0bd(null));};}for(var e in events){if(events[_0x04d8('0xd')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x04d8('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 4e680eb..668ae38 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 _0x4443=['api','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','define','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0x4443,0x167));var _0x3444=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4443[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x3444('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3444('0x1'));var moment=require('moment');var BPromise=require(_0x3444('0x2'));var rp=require(_0x3444('0x3'));var fs=require('fs');var path=require(_0x3444('0x4'));var rimraf=require(_0x3444('0x5'));var config=require(_0x3444('0x6'));var attributes=require(_0x3444('0x7'));module['exports']=function(_0x4e76bd,_0x348e17){return _0x4e76bd[_0x3444('0x8')]('ChatInteraction',attributes,{'tableName':_0x3444('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d6f84,_0x570088,_0x57ca7d){if(_0x3d6f84[_0x3444('0xa')](_0x3444('0xb'))){_0x3d6f84[_0x3444('0xc')]=moment()[_0x3444('0xd')](_0x3444('0xe'));}_0x57ca7d(null,_0x3d6f84);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x17af=['../../config/environment','exports','ChatInteraction','changed','closed','closedAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4e3a76,_0x300f90){var _0x547038=function(_0x1fd6a2){while(--_0x1fd6a2){_0x4e3a76['push'](_0x4e3a76['shift']());}};_0x547038(++_0x300f90);}(_0x17af,0x17e));var _0xf17a=function(_0x1c270a,_0x378796){_0x1c270a=_0x1c270a-0x0;var _0x2607b8=_0x17af[_0x1c270a];return _0x2607b8;};'use strict';var _=require(_0xf17a('0x0'));var util=require(_0xf17a('0x1'));var logger=require(_0xf17a('0x2'))(_0xf17a('0x3'));var moment=require(_0xf17a('0x4'));var BPromise=require(_0xf17a('0x5'));var rp=require(_0xf17a('0x6'));var fs=require('fs');var path=require(_0xf17a('0x7'));var rimraf=require(_0xf17a('0x8'));var config=require(_0xf17a('0x9'));var attributes=require('./chatInteraction.attributes');module[_0xf17a('0xa')]=function(_0x4d42eb,_0xb3284){return _0x4d42eb['define'](_0xf17a('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20b8b4,_0x5afb57,_0x24d425){if(_0x20b8b4[_0xf17a('0xc')](_0xf17a('0xd'))){_0x20b8b4[_0xf17a('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x24d425(null,_0x20b8b4);}},'charset':_0xf17a('0xf'),'collate':_0xf17a('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index c5101bd..7b7171f 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 _0xb094=['client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','raw','limit','info','debug','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise'];(function(_0x4d355c,_0x2ae984){var _0x228ca3=function(_0x33b641){while(--_0x33b641){_0x4d355c['push'](_0x4d355c['shift']());}};_0x228ca3(++_0x2ae984);}(_0xb094,0x172));var _0x4b09=function(_0x387e6f,_0x254dcc){_0x387e6f=_0x387e6f-0x0;var _0x153b3c=_0xb094[_0x387e6f];return _0x153b3c;};'use strict';var _=require(_0x4b09('0x0'));var util=require(_0x4b09('0x1'));var moment=require(_0x4b09('0x2'));var BPromise=require(_0x4b09('0x3'));var rs=require(_0x4b09('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b09('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4b09('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4b09('0x7'));var client=jayson[_0x4b09('0x8')][_0x4b09('0x9')]({'port':0x232a});config['redis']=_[_0x4b09('0xa')](config[_0x4b09('0xb')],{'host':_0x4b09('0xc'),'port':0x18eb});var socket=require(_0x4b09('0xd'))(new Redis(config['redis']));require(_0x4b09('0xe'))[_0x4b09('0xf')](socket);function respondWithRpcPromise(_0x5bd36d,_0x6f4c48,_0x2f9aaa){return new BPromise(function(_0x3d5ce8,_0x5d6380){return client['request'](_0x5bd36d,_0x2f9aaa)[_0x4b09('0x10')](function(_0x15c15d){logger['info'](_0x4b09('0x11'),_0x6f4c48,_0x4b09('0x12'));logger['debug'](_0x4b09('0x13'),_0x6f4c48,'request\x20sent',JSON[_0x4b09('0x14')](_0x15c15d));if(_0x15c15d['error']){if(_0x15c15d[_0x4b09('0x15')]['code']===0x1f4){logger[_0x4b09('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x6f4c48,_0x15c15d[_0x4b09('0x15')][_0x4b09('0x16')]);return _0x5d6380(_0x15c15d[_0x4b09('0x15')][_0x4b09('0x16')]);}logger[_0x4b09('0x15')](_0x4b09('0x11'),_0x6f4c48,_0x15c15d['error']['message']);return _0x3d5ce8(_0x15c15d[_0x4b09('0x15')][_0x4b09('0x16')]);}else{logger['info'](_0x4b09('0x11'),_0x6f4c48,_0x4b09('0x12'));_0x3d5ce8(_0x15c15d[_0x4b09('0x17')][_0x4b09('0x16')]);}})['catch'](function(_0x43fe57){logger[_0x4b09('0x15')](_0x4b09('0x11'),_0x6f4c48,_0x43fe57);_0x5d6380(_0x43fe57);});});}exports[_0x4b09('0x18')]=function(_0x5b9c04){var _0x2a5e0d=this;return new Promise(function(_0x1879a1,_0x41a70e){return db[_0x4b09('0x19')][_0x4b09('0x1a')](_0x5b9c04[_0x4b09('0x1b')],{'raw':_0x5b9c04[_0x4b09('0x1c')]?_0x5b9c04[_0x4b09('0x1c')][_0x4b09('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b9c04['options']?_0x5b9c04[_0x4b09('0x1c')]['where']||null:null,'attributes':_0x5b9c04['options']?_0x5b9c04[_0x4b09('0x1c')]['attributes']||null:null,'limit':_0x5b9c04[_0x4b09('0x1c')]?_0x5b9c04[_0x4b09('0x1c')][_0x4b09('0x1e')]||null:null})[_0x4b09('0x10')](function(_0x4ccf5e){logger[_0x4b09('0x1f')](_0x4b09('0x18'),_0x5b9c04);logger[_0x4b09('0x20')]('UpdateChatInteraction',_0x5b9c04,JSON[_0x4b09('0x14')](_0x4ccf5e));_0x1879a1(_0x4ccf5e);})['catch'](function(_0x1fcadc){logger[_0x4b09('0x15')](_0x4b09('0x18'),_0x1fcadc[_0x4b09('0x16')],_0x5b9c04);_0x41a70e(_0x2a5e0d['error'](0x1f4,_0x1fcadc[_0x4b09('0x16')]));});});};exports[_0x4b09('0x21')]=function(_0x331799){return new Promise(function(_0x596d6d,_0x4ab831){return db['ChatInteraction'][_0x4b09('0x22')]({'where':_0x331799['options']?_0x331799[_0x4b09('0x1c')][_0x4b09('0x23')]||null:null})[_0x4b09('0x10')](function(_0x200944){if(_0x200944){return _0x200944[_0x4b09('0x24')](_0x331799[_0x4b09('0x1b')][_0x4b09('0x25')],_[_0x4b09('0x26')](_0x331799['body'],[_0x4b09('0x25'),'id'])||{});}})[_0x4b09('0x27')](function(_0x112fd7){logger[_0x4b09('0x1f')](_0x4b09('0x28'),_0x331799);logger[_0x4b09('0x20')](_0x4b09('0x28'),_0x331799,JSON[_0x4b09('0x14')](_0x112fd7));_0x596d6d(_0x112fd7);})[_0x4b09('0x29')](function(_0x4be37a){logger[_0x4b09('0x15')]('AddTags',_0x4be37a['message'],_0x331799);_0x4ab831(_this[_0x4b09('0x15')](0x1f4,_0x4be37a['message']));});});}; \ No newline at end of file +var _0xe2e7=['spread','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatInteraction.socket','register','request','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','then','debug','stringify','ChatInteraction','find','addTags','omit'];(function(_0x872b02,_0x4f4458){var _0x1a6b24=function(_0x1dfb4e){while(--_0x1dfb4e){_0x872b02['push'](_0x872b02['shift']());}};_0x1a6b24(++_0x4f4458);}(_0xe2e7,0x128));var _0x7e2e=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xe2e7[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0x7e2e('0x0'));var moment=require(_0x7e2e('0x1'));var BPromise=require(_0x7e2e('0x2'));var rs=require(_0x7e2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e2e('0x4'))['db'];var utils=require(_0x7e2e('0x5'));var logger=require(_0x7e2e('0x6'))(_0x7e2e('0x7'));var config=require(_0x7e2e('0x8'));var jayson=require(_0x7e2e('0x9'));var client=jayson['client'][_0x7e2e('0xa')]({'port':0x232a});config[_0x7e2e('0xb')]=_[_0x7e2e('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7e2e('0xd'))(new Redis(config[_0x7e2e('0xb')]));require(_0x7e2e('0xe'))[_0x7e2e('0xf')](socket);function respondWithRpcPromise(_0x38ccbe,_0x393540,_0x46d5fd){return new BPromise(function(_0x1aa136,_0x1c3fb7){return client[_0x7e2e('0x10')](_0x38ccbe,_0x46d5fd)['then'](function(_0x4f8ebf){logger[_0x7e2e('0x11')](_0x7e2e('0x12'),_0x393540,'request\x20sent');logger['debug'](_0x7e2e('0x13'),_0x393540,_0x7e2e('0x14'),JSON['stringify'](_0x4f8ebf));if(_0x4f8ebf[_0x7e2e('0x15')]){if(_0x4f8ebf['error']['code']===0x1f4){logger[_0x7e2e('0x15')](_0x7e2e('0x12'),_0x393540,_0x4f8ebf[_0x7e2e('0x15')][_0x7e2e('0x16')]);return _0x1c3fb7(_0x4f8ebf['error'][_0x7e2e('0x16')]);}logger[_0x7e2e('0x15')](_0x7e2e('0x12'),_0x393540,_0x4f8ebf[_0x7e2e('0x15')]['message']);return _0x1aa136(_0x4f8ebf[_0x7e2e('0x15')][_0x7e2e('0x16')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x393540,_0x7e2e('0x14'));_0x1aa136(_0x4f8ebf[_0x7e2e('0x17')][_0x7e2e('0x16')]);}})[_0x7e2e('0x18')](function(_0x1b89b0){logger[_0x7e2e('0x15')](_0x7e2e('0x12'),_0x393540,_0x1b89b0);_0x1c3fb7(_0x1b89b0);});});}exports[_0x7e2e('0x19')]=function(_0x10a30a){var _0x4d5d9a=this;return new Promise(function(_0x90c9e2,_0x4a89ac){return db['ChatInteraction'][_0x7e2e('0x1a')](_0x10a30a[_0x7e2e('0x1b')],{'raw':_0x10a30a['options']?_0x10a30a[_0x7e2e('0x1c')][_0x7e2e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10a30a[_0x7e2e('0x1c')]?_0x10a30a[_0x7e2e('0x1c')][_0x7e2e('0x1e')]||null:null,'attributes':_0x10a30a['options']?_0x10a30a['options'][_0x7e2e('0x1f')]||null:null,'limit':_0x10a30a[_0x7e2e('0x1c')]?_0x10a30a['options'][_0x7e2e('0x20')]||null:null})[_0x7e2e('0x21')](function(_0x48dc12){logger[_0x7e2e('0x11')](_0x7e2e('0x19'),_0x10a30a);logger[_0x7e2e('0x22')](_0x7e2e('0x19'),_0x10a30a,JSON[_0x7e2e('0x23')](_0x48dc12));_0x90c9e2(_0x48dc12);})['catch'](function(_0xd36aeb){logger[_0x7e2e('0x15')](_0x7e2e('0x19'),_0xd36aeb[_0x7e2e('0x16')],_0x10a30a);_0x4a89ac(_0x4d5d9a[_0x7e2e('0x15')](0x1f4,_0xd36aeb[_0x7e2e('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0x14ef45){return new Promise(function(_0x30e9e4,_0x240b83){return db[_0x7e2e('0x24')][_0x7e2e('0x25')]({'where':_0x14ef45[_0x7e2e('0x1c')]?_0x14ef45[_0x7e2e('0x1c')][_0x7e2e('0x1e')]||null:null})['then'](function(_0x4d736a){if(_0x4d736a){return _0x4d736a[_0x7e2e('0x26')](_0x14ef45['body']['ids'],_[_0x7e2e('0x27')](_0x14ef45[_0x7e2e('0x1b')],['ids','id'])||{});}})[_0x7e2e('0x28')](function(_0x916df9){logger[_0x7e2e('0x11')](_0x7e2e('0x29'),_0x14ef45);logger[_0x7e2e('0x22')](_0x7e2e('0x29'),_0x14ef45,JSON[_0x7e2e('0x23')](_0x916df9));_0x30e9e4(_0x916df9);})[_0x7e2e('0x18')](function(_0x5d4726){logger[_0x7e2e('0x15')]('AddTags',_0x5d4726[_0x7e2e('0x16')],_0x14ef45);_0x240b83(_this[_0x7e2e('0x15')](0x1f4,_0x5d4726[_0x7e2e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 7218269..220f234 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 _0x14ce=['./chatInteraction.events','save','remove','update','emit','removeListener','register','length','chatInteraction:'];(function(_0x4e0e3f,_0x3699a0){var _0x5df383=function(_0x229b6e){while(--_0x229b6e){_0x4e0e3f['push'](_0x4e0e3f['shift']());}};_0x5df383(++_0x3699a0);}(_0x14ce,0xea));var _0xe14c=function(_0x473ef7,_0x3ccd74){_0x473ef7=_0x473ef7-0x0;var _0x5f5288=_0x14ce[_0x473ef7];return _0x5f5288;};'use strict';var ChatInteractionEvents=require(_0xe14c('0x0'));var events=[_0xe14c('0x1'),_0xe14c('0x2'),_0xe14c('0x3')];function createListener(_0x1d27f6,_0x37e126){return function(_0x368975){_0x37e126[_0xe14c('0x4')](_0x1d27f6,_0x368975);};}function removeListener(_0x1494ac,_0x20da08){return function(){ChatInteractionEvents[_0xe14c('0x5')](_0x1494ac,_0x20da08);};}exports[_0xe14c('0x6')]=function(_0x1ea766){for(var _0x53cefa=0x0,_0x182123=events[_0xe14c('0x7')];_0x53cefa<_0x182123;_0x53cefa++){var _0x4d2195=events[_0x53cefa];var _0x2d25a3=createListener(_0xe14c('0x8')+_0x4d2195,_0x1ea766);ChatInteractionEvents['on'](_0x4d2195,_0x2d25a3);}}; \ No newline at end of file +var _0xe4c7=['update','emit','register','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0xe76df0,_0x5b07f9){var _0x23011a=function(_0x1c9604){while(--_0x1c9604){_0xe76df0['push'](_0xe76df0['shift']());}};_0x23011a(++_0x5b07f9);}(_0xe4c7,0x1d2));var _0x7e4c=function(_0x32c57d,_0x4b455a){_0x32c57d=_0x32c57d-0x0;var _0x353d7f=_0xe4c7[_0x32c57d];return _0x353d7f;};'use strict';var ChatInteractionEvents=require(_0x7e4c('0x0'));var events=[_0x7e4c('0x1'),_0x7e4c('0x2'),_0x7e4c('0x3')];function createListener(_0x3aeff1,_0x2d294c){return function(_0x5123a7){_0x2d294c[_0x7e4c('0x4')](_0x3aeff1,_0x5123a7);};}function removeListener(_0xfc6b9e,_0x1ae8f4){return function(){ChatInteractionEvents['removeListener'](_0xfc6b9e,_0x1ae8f4);};}exports[_0x7e4c('0x5')]=function(_0x305963){for(var _0x40b497=0x0,_0x4db23c=events['length'];_0x40b497<_0x4db23c;_0x40b497++){var _0x5a5bb4=events[_0x40b497];var _0x2ca5b6=createListener(_0x7e4c('0x6')+_0x5a5bb4,_0x305963);ChatInteractionEvents['on'](_0x5a5bb4,_0x2ca5b6);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index f7b7d59..8bf9464 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 _0xa51f=['create','/:id/vidaoo','diskStorage','root','server/files/attachments/','format','now','originalname','replace','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','chat','update','put','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','/:id','chatinteraction:destroy','destroy','delete','removeTags','exports','util','path','express','fs-extra','../../components/interaction/service','./chatInteraction.controller','isAuthenticated','get','/describe','describe','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','post'];(function(_0x3eca08,_0x11c502){var _0x1164c7=function(_0x3c9ef4){while(--_0x3c9ef4){_0x3eca08['push'](_0x3eca08['shift']());}};_0x1164c7(++_0x11c502);}(_0xa51f,0x145));var _0xfa51=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0xa51f[_0x3afe18];return _0x19ed1f;};'use strict';var multer=require('multer');var util=require(_0xfa51('0x0'));var path=require(_0xfa51('0x1'));var timeout=require('connect-timeout');var express=require(_0xfa51('0x2'));var router=express['Router']();var fs_extra=require(_0xfa51('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfa51('0x4'));var config=require('../../config/environment');var controller=require(_0xfa51('0x5'));router['get']('/',auth[_0xfa51('0x6')](),controller['index']);router[_0xfa51('0x7')](_0xfa51('0x8'),auth[_0xfa51('0x6')](),controller[_0xfa51('0x9')]);router[_0xfa51('0x7')]('/:id',auth[_0xfa51('0xa')](),controller[_0xfa51('0xb')]);router[_0xfa51('0x7')]('/:id/attachment_download',auth['isChatInteractionAuthorized'](),controller[_0xfa51('0xc')]);router[_0xfa51('0x7')](_0xfa51('0xd'),auth[_0xfa51('0x6')](),controller[_0xfa51('0xe')]);router[_0xfa51('0x7')](_0xfa51('0xf'),auth[_0xfa51('0xa')](),controller['getMyMessages']);router['get'](_0xfa51('0x10'),auth[_0xfa51('0x6')](),controller['download']);router[_0xfa51('0x11')]('/',auth[_0xfa51('0x6')](),controller[_0xfa51('0x12')]);router[_0xfa51('0x11')](_0xfa51('0x13'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xfa51('0x14')]({'destination':function(_0x2483ae,_0x49fceb,_0x477ec1){_0x477ec1(null,path['join'](config[_0xfa51('0x15')],_0xfa51('0x16')));},'filename':function(_0x2c8da1,_0x3721df,_0x38ee4b){_0x38ee4b(null,util[_0xfa51('0x17')]('%s-%s',Date[_0xfa51('0x18')](),_0x3721df[_0xfa51('0x19')][_0xfa51('0x1a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xfa51('0x11')]('/:id/attachment_upload',upload[_0xfa51('0x1b')](_0xfa51('0x1c')),controller[_0xfa51('0x1d')]);router[_0xfa51('0x11')](_0xfa51('0xd'),auth[_0xfa51('0xa')](),controller[_0xfa51('0x1e')]);router['post'](_0xfa51('0x1f'),auth[_0xfa51('0x6')](),interaction[_0xfa51('0x20')]('chat',_0xfa51('0x21')),controller[_0xfa51('0x22')]);router['put']('/:id',auth[_0xfa51('0x6')](),interaction[_0xfa51('0x20')](_0xfa51('0x23'),'chatinteraction:update'),controller[_0xfa51('0x24')]);router[_0xfa51('0x25')](_0xfa51('0x26'),controller[_0xfa51('0x27')]);router[_0xfa51('0x25')](_0xfa51('0x28'),auth[_0xfa51('0xa')](),controller['abandon']);router[_0xfa51('0x25')](_0xfa51('0x29'),controller[_0xfa51('0x2a')]);router['delete'](_0xfa51('0x2b'),auth['isAuthenticated'](),interaction[_0xfa51('0x20')](_0xfa51('0x23'),_0xfa51('0x2c')),controller[_0xfa51('0x2d')]);router[_0xfa51('0x2e')](_0xfa51('0x1f'),auth['isAuthenticated'](),controller[_0xfa51('0x2f')]);module[_0xfa51('0x30')]=router; \ No newline at end of file +var _0xae15=['chatinteraction:destroy','destroy','/:id/tags','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','/:id/abandon','abandon','/:id/close','delete'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0xae15,0xd8));var _0x5ae1=function(_0x4b57c0,_0x2fb59f){_0x4b57c0=_0x4b57c0-0x0;var _0x59172f=_0xae15[_0x4b57c0];return _0x59172f;};'use strict';var multer=require(_0x5ae1('0x0'));var util=require('util');var path=require(_0x5ae1('0x1'));var timeout=require(_0x5ae1('0x2'));var express=require(_0x5ae1('0x3'));var router=express['Router']();var fs_extra=require(_0x5ae1('0x4'));var auth=require(_0x5ae1('0x5'));var interaction=require(_0x5ae1('0x6'));var config=require(_0x5ae1('0x7'));var controller=require('./chatInteraction.controller');router['get']('/',auth[_0x5ae1('0x8')](),controller[_0x5ae1('0x9')]);router[_0x5ae1('0xa')](_0x5ae1('0xb'),auth[_0x5ae1('0x8')](),controller[_0x5ae1('0xc')]);router[_0x5ae1('0xa')](_0x5ae1('0xd'),auth['isChatInteractionAuthorized'](),controller[_0x5ae1('0xe')]);router[_0x5ae1('0xa')](_0x5ae1('0xf'),auth[_0x5ae1('0x10')](),controller[_0x5ae1('0x11')]);router[_0x5ae1('0xa')](_0x5ae1('0x12'),auth[_0x5ae1('0x8')](),controller[_0x5ae1('0x13')]);router[_0x5ae1('0xa')](_0x5ae1('0x14'),auth['isChatInteractionAuthorized'](),controller[_0x5ae1('0x15')]);router[_0x5ae1('0xa')]('/:id/download',auth[_0x5ae1('0x8')](),controller[_0x5ae1('0x16')]);router['post']('/',auth[_0x5ae1('0x8')](),controller[_0x5ae1('0x17')]);router[_0x5ae1('0x18')](_0x5ae1('0x19'),auth[_0x5ae1('0x8')](),controller[_0x5ae1('0x1a')]);var upload=multer({'storage':multer[_0x5ae1('0x1b')]({'destination':function(_0x7feb38,_0xebb702,_0x563a0c){_0x563a0c(null,path[_0x5ae1('0x1c')](config[_0x5ae1('0x1d')],_0x5ae1('0x1e')));},'filename':function(_0x2f83a6,_0x3380e9,_0x5d802a){_0x5d802a(null,util[_0x5ae1('0x1f')](_0x5ae1('0x20'),Date[_0x5ae1('0x21')](),_0x3380e9[_0x5ae1('0x22')][_0x5ae1('0x23')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x5ae1('0x24'),upload[_0x5ae1('0x25')](_0x5ae1('0x26')),controller['attachmentUpload']);router[_0x5ae1('0x18')](_0x5ae1('0x12'),auth[_0x5ae1('0x10')](),controller['addMessage']);router[_0x5ae1('0x18')]('/:id/tags',auth[_0x5ae1('0x8')](),interaction[_0x5ae1('0x27')](_0x5ae1('0x28'),_0x5ae1('0x29')),controller[_0x5ae1('0x2a')]);router[_0x5ae1('0x2b')](_0x5ae1('0xd'),auth['isAuthenticated'](),interaction[_0x5ae1('0x27')](_0x5ae1('0x28'),'chatinteraction:update'),controller['update']);router[_0x5ae1('0x2b')](_0x5ae1('0x2c'),controller['customUpdate']);router[_0x5ae1('0x2b')](_0x5ae1('0x2d'),auth['isChatInteractionAuthorized'](),controller[_0x5ae1('0x2e')]);router[_0x5ae1('0x2b')](_0x5ae1('0x2f'),controller['close']);router[_0x5ae1('0x30')](_0x5ae1('0xd'),auth['isAuthenticated'](),interaction[_0x5ae1('0x27')]('chat',_0x5ae1('0x31')),controller[_0x5ae1('0x32')]);router['delete'](_0x5ae1('0x33'),auth[_0x5ae1('0x8')](),controller[_0x5ae1('0x34')]);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 79c68e6..350025b 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 _0x3686=['sequelize','exports','TEXT','medium','INTEGER'];(function(_0x8a9b66,_0x589c13){var _0x9b3454=function(_0x5d0371){while(--_0x5d0371){_0x8a9b66['push'](_0x8a9b66['shift']());}};_0x9b3454(++_0x589c13);}(_0x3686,0x127));var _0x6368=function(_0x8b771d,_0x87eb1){_0x8b771d=_0x8b771d-0x0;var _0x3da538=_0x3686[_0x8b771d];return _0x3da538;};'use strict';var Sequelize=require(_0x6368('0x0'));module[_0x6368('0x1')]={'body':{'type':Sequelize[_0x6368('0x2')](_0x6368('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x6368('0x4')]}}; \ No newline at end of file +var _0x7f3d=['BOOLEAN','INTEGER','TEXT'];(function(_0x312aea,_0x5f50b8){var _0x5ef6c4=function(_0x4f7da){while(--_0x4f7da){_0x312aea['push'](_0x312aea['shift']());}};_0x5ef6c4(++_0x5f50b8);}(_0x7f3d,0x7d));var _0xd7f3=function(_0x3a607e,_0x54d530){_0x3a607e=_0x3a607e-0x0;var _0x37b106=_0x7f3d[_0x3a607e];return _0x37b106;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xd7f3('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd7f3('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xd7f3('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index f8f58db..04cd0ea 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 _0x6b4f=['format','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','role','userpic','internal','online','lastLoginAt','allowmessenger','-online','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','name','index','map','ChatInternalMessage','fieldName','type','key','query','intersection','model','attributes','fields','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','describe','messages','lastMessageAt','createdAt','lastMessage'];(function(_0x7e8ee7,_0x5cd7cb){var _0x10933a=function(_0x5279ad){while(--_0x5279ad){_0x7e8ee7['push'](_0x7e8ee7['shift']());}};_0x10933a(++_0x5cd7cb);}(_0x6b4f,0xf8));var _0xf6b4=function(_0x1ec913,_0x27a9e0){_0x1ec913=_0x1ec913-0x0;var _0x3a0b8d=_0x6b4f[_0x1ec913];return _0x3a0b8d;};'use strict';var emlformat=require(_0xf6b4('0x0'));var rimraf=require(_0xf6b4('0x1'));var zipdir=require(_0xf6b4('0x2'));var jsonpatch=require(_0xf6b4('0x3'));var rp=require(_0xf6b4('0x4'));var moment=require(_0xf6b4('0x5'));var BPromise=require(_0xf6b4('0x6'));var Mustache=require(_0xf6b4('0x7'));var util=require(_0xf6b4('0x8'));var path=require(_0xf6b4('0x9'));var sox=require(_0xf6b4('0xa'));var csv=require(_0xf6b4('0xb'));var ejs=require(_0xf6b4('0xc'));var fs=require('fs');var fs_extra=require(_0xf6b4('0xd'));var _=require(_0xf6b4('0xe'));var squel=require('squel');var crypto=require(_0xf6b4('0xf'));var jsforce=require(_0xf6b4('0x10'));var deskjs=require(_0xf6b4('0x11'));var toCsv=require(_0xf6b4('0xb'));var querystring=require(_0xf6b4('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf6b4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf6b4('0x14'));var hardwareService=require(_0xf6b4('0x15'));var logger=require(_0xf6b4('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf6b4('0x17'));var db=require(_0xf6b4('0x18'))['db'];config[_0xf6b4('0x19')]=_['defaults'](config['redis'],{'host':_0xf6b4('0x1a'),'port':0x18eb});var socket=require(_0xf6b4('0x1b'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0xf6b4('0x1c')](socket);function respondWithStatusCode(_0x43f769,_0x17069e){_0x17069e=_0x17069e||0xcc;return function(_0x3569b0){if(_0x3569b0){return _0x43f769[_0xf6b4('0x1d')](_0x17069e);}return _0x43f769[_0xf6b4('0x1e')](_0x17069e)['end']();};}function respondWithResult(_0x3227b9,_0x6adf62){_0x6adf62=_0x6adf62||0xc8;return function(_0x16c021){if(_0x16c021){return _0x3227b9[_0xf6b4('0x1e')](_0x6adf62)[_0xf6b4('0x1f')](_0x16c021);}};}function respondWithFilteredResult(_0x4197ec,_0x4795ea){return function(_0x26a55a){if(_0x26a55a){var _0xda00c3=typeof _0x4795ea[_0xf6b4('0x20')]===_0xf6b4('0x21')&&typeof _0x4795ea[_0xf6b4('0x22')]===_0xf6b4('0x21');var _0x3d8e5b=_0x26a55a[_0xf6b4('0x23')];var _0x16ef38=_0xda00c3?0x0:_0x4795ea[_0xf6b4('0x20')];var _0xb9853c=_0xda00c3?_0x26a55a[_0xf6b4('0x23')]:_0x4795ea['offset']+_0x4795ea[_0xf6b4('0x22')];var _0x5bebef;if(_0xb9853c>=_0x3d8e5b){_0xb9853c=_0x3d8e5b;_0x5bebef=0xc8;}else{_0x5bebef=0xce;}_0x4197ec[_0xf6b4('0x1e')](_0x5bebef);return _0x4197ec[_0xf6b4('0x24')](_0xf6b4('0x25'),_0x16ef38+'-'+_0xb9853c+'/'+_0x3d8e5b)['json'](_0x26a55a);}return null;};}function patchUpdates(_0x2c652b){return function(_0x2007bc){try{jsonpatch[_0xf6b4('0x26')](_0x2007bc,_0x2c652b,!![]);}catch(_0x2a659e){return BPromise['reject'](_0x2a659e);}return _0x2007bc[_0xf6b4('0x27')]();};}function saveUpdates(_0x3b3d8c,_0x15ad24){return function(_0x3d2bdd){if(_0x3d2bdd){return _0x3d2bdd[_0xf6b4('0x28')](_0x3b3d8c)[_0xf6b4('0x29')](function(_0x11a323){return _0x11a323;});}return null;};}function removeEntity(_0x463878,_0x4f844a){return function(_0x1e6cd0){if(_0x1e6cd0){return _0x1e6cd0[_0xf6b4('0x2a')]()[_0xf6b4('0x29')](function(){_0x463878['status'](0xcc)[_0xf6b4('0x2b')]();});}};}function handleEntityNotFound(_0x45e14e,_0x53208c){return function(_0x220365){if(!_0x220365){_0x45e14e['sendStatus'](0x194);}return _0x220365;};}function handleError(_0x47b48b,_0x41f406){_0x41f406=_0x41f406||0x1f4;return function(_0x4c9fa7){logger['error'](_0x4c9fa7['stack']);if(_0x4c9fa7[_0xf6b4('0x2c')]){delete _0x4c9fa7[_0xf6b4('0x2c')];}_0x47b48b[_0xf6b4('0x1e')](_0x41f406)['send'](_0x4c9fa7);};}exports[_0xf6b4('0x2d')]=function(_0x4e8ea3,_0x5cd8b4){var _0x2ff175={},_0x1d3a72={},_0x20a49d={'count':0x0,'rows':[]};var _0x18e62e=_[_0xf6b4('0x2e')](db[_0xf6b4('0x2f')]['rawAttributes'],function(_0x4d614c){return{'name':_0x4d614c[_0xf6b4('0x30')],'type':_0x4d614c[_0xf6b4('0x31')][_0xf6b4('0x32')]};});_0x1d3a72['model']=_[_0xf6b4('0x2e')](_0x18e62e,'name');_0x1d3a72['query']=_['keys'](_0x4e8ea3[_0xf6b4('0x33')]);_0x1d3a72['filters']=_[_0xf6b4('0x34')](_0x1d3a72[_0xf6b4('0x35')],_0x1d3a72['query']);_0x2ff175[_0xf6b4('0x36')]=_[_0xf6b4('0x34')](_0x1d3a72['model'],qs[_0xf6b4('0x37')](_0x4e8ea3['query'][_0xf6b4('0x37')]));_0x2ff175[_0xf6b4('0x36')]=_0x2ff175[_0xf6b4('0x36')]['length']?_0x2ff175[_0xf6b4('0x36')]:_0x1d3a72[_0xf6b4('0x35')];if(!_0x4e8ea3['query']['hasOwnProperty'](_0xf6b4('0x38'))){_0x2ff175[_0xf6b4('0x22')]=qs[_0xf6b4('0x22')](_0x4e8ea3[_0xf6b4('0x33')]['limit']);_0x2ff175[_0xf6b4('0x20')]=qs['offset'](_0x4e8ea3['query']['offset']);}_0x2ff175[_0xf6b4('0x39')]=qs[_0xf6b4('0x3a')](_0x4e8ea3['query'][_0xf6b4('0x3a')]);_0x2ff175[_0xf6b4('0x3b')]=qs[_0xf6b4('0x3c')](_['pick'](_0x4e8ea3[_0xf6b4('0x33')],_0x1d3a72[_0xf6b4('0x3c')]),_0x18e62e);if(_0x4e8ea3[_0xf6b4('0x33')]['filter']){_0x2ff175[_0xf6b4('0x3b')]=_[_0xf6b4('0x3d')](_0x2ff175[_0xf6b4('0x3b')],{'$or':_[_0xf6b4('0x2e')](_0x18e62e,function(_0x250806){if(_0x250806['type']!==_0xf6b4('0x3e')){var _0x30985d={};_0x30985d[_0x250806['name']]={'$like':'%'+_0x4e8ea3[_0xf6b4('0x33')][_0xf6b4('0x3f')]+'%'};return _0x30985d;}})});}_0x2ff175=_[_0xf6b4('0x3d')]({},_0x2ff175,_0x4e8ea3[_0xf6b4('0x40')]);var _0x4a9515={'where':_0x2ff175['where']};return db['ChatInternalMessage']['count'](_0x4a9515)['then'](function(_0x2dd9cc){_0x20a49d[_0xf6b4('0x23')]=_0x2dd9cc;if(_0x4e8ea3['query'][_0xf6b4('0x41')]){_0x2ff175[_0xf6b4('0x42')]=[{'all':!![]}];}return db[_0xf6b4('0x2f')][_0xf6b4('0x43')](_0x2ff175);})[_0xf6b4('0x29')](function(_0x430baa){_0x20a49d[_0xf6b4('0x44')]=_0x430baa;return _0x20a49d;})[_0xf6b4('0x29')](respondWithFilteredResult(_0x5cd8b4,_0x2ff175))[_0xf6b4('0x45')](handleError(_0x5cd8b4,null));};exports[_0xf6b4('0x46')]=function(_0x4bf5ec,_0x346f34){var _0x565514={'raw':!![],'where':{'id':_0x4bf5ec[_0xf6b4('0x47')]['id']}},_0x99537b={};_0x99537b[_0xf6b4('0x35')]=_[_0xf6b4('0x48')](db[_0xf6b4('0x2f')]['rawAttributes']);_0x99537b[_0xf6b4('0x33')]=_['keys'](_0x4bf5ec['query']);_0x99537b['filters']=_[_0xf6b4('0x34')](_0x99537b[_0xf6b4('0x35')],_0x99537b['query']);_0x565514[_0xf6b4('0x36')]=_[_0xf6b4('0x34')](_0x99537b[_0xf6b4('0x35')],qs['fields'](_0x4bf5ec['query'][_0xf6b4('0x37')]));_0x565514['attributes']=_0x565514['attributes'][_0xf6b4('0x49')]?_0x565514['attributes']:_0x99537b[_0xf6b4('0x35')];if(_0x4bf5ec[_0xf6b4('0x33')][_0xf6b4('0x41')]){_0x565514[_0xf6b4('0x42')]=[{'all':!![]}];}_0x565514=_['merge']({},_0x565514,_0x4bf5ec[_0xf6b4('0x40')]);return db['ChatInternalMessage']['find'](_0x565514)[_0xf6b4('0x29')](handleEntityNotFound(_0x346f34,null))['then'](respondWithResult(_0x346f34,null))[_0xf6b4('0x45')](handleError(_0x346f34,null));};exports[_0xf6b4('0x4a')]=function(_0x1d59f2,_0x486eaf){return db[_0xf6b4('0x2f')][_0xf6b4('0x4a')](_0x1d59f2[_0xf6b4('0x4b')],{})[_0xf6b4('0x29')](respondWithResult(_0x486eaf,0xc9))[_0xf6b4('0x45')](handleError(_0x486eaf,null));};exports[_0xf6b4('0x28')]=function(_0x2f2475,_0x5c1a72){if(_0x2f2475[_0xf6b4('0x4b')]['id']){delete _0x2f2475['body']['id'];}return db[_0xf6b4('0x2f')][_0xf6b4('0x4c')]({'where':{'id':_0x2f2475[_0xf6b4('0x47')]['id']}})[_0xf6b4('0x29')](handleEntityNotFound(_0x5c1a72,null))['then'](saveUpdates(_0x2f2475['body'],null))['then'](respondWithResult(_0x5c1a72,null))[_0xf6b4('0x45')](handleError(_0x5c1a72,null));};exports[_0xf6b4('0x2a')]=function(_0x442e47,_0x1757a6){return db[_0xf6b4('0x2f')][_0xf6b4('0x4c')]({'where':{'id':_0x442e47[_0xf6b4('0x47')]['id']}})[_0xf6b4('0x29')](handleEntityNotFound(_0x1757a6,null))[_0xf6b4('0x29')](removeEntity(_0x1757a6,null))[_0xf6b4('0x45')](handleError(_0x1757a6,null));};exports[_0xf6b4('0x4d')]=function(_0x2fab47,_0x19737e){return db[_0xf6b4('0x2f')][_0xf6b4('0x4d')]()[_0xf6b4('0x29')](respondWithResult(_0x19737e,null))[_0xf6b4('0x45')](handleError(_0x19737e,null));};function wrapUser(_0xc77174){return function(_0x450fa3){var _0x3a2570=_0xc77174['get']({'plain':!![]});_0x3a2570[_0xf6b4('0x4e')]=[];if(_0x450fa3){_0x3a2570[_0xf6b4('0x4f')]=_0x450fa3[_0xf6b4('0x50')];_0x3a2570[_0xf6b4('0x51')]=_0x450fa3;}else{_0x3a2570['lastMessageAt']=moment(0x0)[_0xf6b4('0x52')](_0xf6b4('0x53'));_0x3a2570['lastMessage']={};}return _0x3a2570;};}exports['getUsers']=function(_0x54d05b,_0x32b331,_0x1d6a6c){var _0x2fd8c4=[];return db[_0xf6b4('0x54')][_0xf6b4('0x43')]({'where':{'role':[_0xf6b4('0x55'),_0xf6b4('0x56'),_0xf6b4('0x57')]},'attributes':['id','fullname','name',_0xf6b4('0x58'),_0xf6b4('0x59'),_0xf6b4('0x5a'),_0xf6b4('0x5b'),_0xf6b4('0x5c'),_0xf6b4('0x5d'),'showWebBar'],'order':qs[_0xf6b4('0x3a')](_0xf6b4('0x5e')),'include':[{'model':db[_0xf6b4('0x5f')],'as':'VoiceQueues','attributes':['id','name',_0xf6b4('0x31')],'through':{'attributes':[]}}]})[_0xf6b4('0x29')](function(_0x2f2a25){if(_0x2f2a25){var _0x8cfa57=_0x54d05b[_0xf6b4('0x57')][_0xf6b4('0x60')]({'plain':!![]});if(!_0x8cfa57)throw new Error(_0xf6b4('0x61'));if(_0x8cfa57[_0xf6b4('0x58')]==='user'){return db[_0xf6b4('0x62')][_0xf6b4('0x4c')]({'where':{'name':_0xf6b4('0x63'),'userProfileId':_0x8cfa57[_0xf6b4('0x64')]},'raw':!![]})['then'](function(_0x3e9be5){if(_0x3e9be5){if(_0x3e9be5[_0xf6b4('0x65')]===0x0){return db[_0xf6b4('0x66')][_0xf6b4('0x43')]({'where':{'sectionId':_0x3e9be5['id']},'raw':!![]})[_0xf6b4('0x29')](function(_0x2bbcd8){var _0x3fca6c=[];if(_['isEmpty'](_0x2bbcd8)){_0x3fca6c=_['filter'](_0x2f2a25,function(_0x440a4c){if(_0x440a4c[_0xf6b4('0x58')]!==_0xf6b4('0x55')){return _0x440a4c;}});return _0x3fca6c;}else{for(var _0x15e96e=0x0;_0x15e96e<_0x2f2a25[_0xf6b4('0x49')];_0x15e96e++){var _0x4ba8fd=_0x2f2a25[_0x15e96e];if(_0x4ba8fd[_0xf6b4('0x58')]===_0xf6b4('0x55')){var _0x111169=_[_0xf6b4('0x4c')](_0x2bbcd8,function(_0x56ae95){return _0x56ae95[_0xf6b4('0x67')]===_0x4ba8fd['id'];});if(_0x111169)_0x3fca6c[_0xf6b4('0x68')](_0x4ba8fd);}else{_0x3fca6c[_0xf6b4('0x68')](_0x4ba8fd);}}return _0x3fca6c;}});}else{return _0x2f2a25;}}else{var _0x56d2f3=_[_0xf6b4('0x3f')](_0x2f2a25,function(_0x4a483e){if(_0x4a483e[_0xf6b4('0x58')]!==_0xf6b4('0x55')){return _0x4a483e;}});return _0x56d2f3;}});}else{return _0x2f2a25;}}})[_0xf6b4('0x29')](function(_0x190251){var _0x24fb6c=[];if(_0x190251){_0x2fd8c4=_0x190251;for(var _0x3c934a=0x0;_0x3c934a<_0x190251['length'];_0x3c934a+=0x1){_0x2fd8c4[_0x3c934a]['messages']=[];_0x24fb6c['push'](db['ChatInternalMessage'][_0xf6b4('0x4c')]({'where':{'FromId':[_0x54d05b['user']['id'],_0x190251[_0x3c934a]['id']],'ToId':[_0x54d05b['user']['id'],_0x190251[_0x3c934a]['id']],'ChatGroupId':null},'attributes':['id',_0xf6b4('0x50'),_0xf6b4('0x69'),_0xf6b4('0x6a'),_0xf6b4('0x6b'),_0xf6b4('0x4b')],'order':qs['sort'](_0xf6b4('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x190251[_0x3c934a])));}return BPromise[_0xf6b4('0x6d')](_0x24fb6c);}return[];})[_0xf6b4('0x29')](function(_0x14cc52){return{'rows':_0x14cc52,'count':_0x14cc52[_0xf6b4('0x49')]};})[_0xf6b4('0x29')](respondWithResult(_0x32b331,null))[_0xf6b4('0x45')](handleError(_0x32b331,null));}; \ No newline at end of file +var _0x4f5f=['count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','VIRTUAL','options','include','rows','catch','show','keys','length','includeAll','merge','find','create','body','params','describe','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','User','agent','admin','user','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','findAll','isEmpty','resourceId','push','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','request-promise','moment','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/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','json','offset'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4f5f,0x12f));var _0xf4f5=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0x4f5f[_0x209fcd];return _0x501d5e;};'use strict';var emlformat=require(_0xf4f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf4f5('0x1'));var jsonpatch=require(_0xf4f5('0x2'));var rp=require(_0xf4f5('0x3'));var moment=require(_0xf4f5('0x4'));var BPromise=require(_0xf4f5('0x5'));var Mustache=require(_0xf4f5('0x6'));var util=require(_0xf4f5('0x7'));var path=require('path');var sox=require(_0xf4f5('0x8'));var csv=require(_0xf4f5('0x9'));var ejs=require(_0xf4f5('0xa'));var fs=require('fs');var fs_extra=require(_0xf4f5('0xb'));var _=require(_0xf4f5('0xc'));var squel=require(_0xf4f5('0xd'));var crypto=require(_0xf4f5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf4f5('0xf'));var toCsv=require(_0xf4f5('0x9'));var querystring=require(_0xf4f5('0x10'));var Papa=require('papaparse');var Redis=require(_0xf4f5('0x11'));var authService=require(_0xf4f5('0x12'));var qs=require(_0xf4f5('0x13'));var as=require(_0xf4f5('0x14'));var hardwareService=require(_0xf4f5('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xf4f5('0x16'));var config=require(_0xf4f5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf4f5('0x18'))['db'];config[_0xf4f5('0x19')]=_[_0xf4f5('0x1a')](config['redis'],{'host':_0xf4f5('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf4f5('0x19')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x325b17,_0x51d09a){_0x51d09a=_0x51d09a||0xcc;return function(_0x413b81){if(_0x413b81){return _0x325b17[_0xf4f5('0x1c')](_0x51d09a);}return _0x325b17[_0xf4f5('0x1d')](_0x51d09a)[_0xf4f5('0x1e')]();};}function respondWithResult(_0xbed1ea,_0x1c98e2){_0x1c98e2=_0x1c98e2||0xc8;return function(_0x406692){if(_0x406692){return _0xbed1ea[_0xf4f5('0x1d')](_0x1c98e2)[_0xf4f5('0x1f')](_0x406692);}};}function respondWithFilteredResult(_0x22cc38,_0x4c775c){return function(_0x10dd1a){if(_0x10dd1a){var _0x407f68=typeof _0x4c775c[_0xf4f5('0x20')]==='undefined'&&typeof _0x4c775c['limit']==='undefined';var _0x193eef=_0x10dd1a[_0xf4f5('0x21')];var _0x35a1a3=_0x407f68?0x0:_0x4c775c[_0xf4f5('0x20')];var _0x50389c=_0x407f68?_0x10dd1a['count']:_0x4c775c[_0xf4f5('0x20')]+_0x4c775c[_0xf4f5('0x22')];var _0x21a11f;if(_0x50389c>=_0x193eef){_0x50389c=_0x193eef;_0x21a11f=0xc8;}else{_0x21a11f=0xce;}_0x22cc38[_0xf4f5('0x1d')](_0x21a11f);return _0x22cc38[_0xf4f5('0x23')](_0xf4f5('0x24'),_0x35a1a3+'-'+_0x50389c+'/'+_0x193eef)[_0xf4f5('0x1f')](_0x10dd1a);}return null;};}function patchUpdates(_0x1e8d3a){return function(_0x2050f4){try{jsonpatch[_0xf4f5('0x25')](_0x2050f4,_0x1e8d3a,!![]);}catch(_0x2b59bb){return BPromise[_0xf4f5('0x26')](_0x2b59bb);}return _0x2050f4[_0xf4f5('0x27')]();};}function saveUpdates(_0x5ba3b5,_0x53bcb0){return function(_0x593162){if(_0x593162){return _0x593162[_0xf4f5('0x28')](_0x5ba3b5)['then'](function(_0x3111aa){return _0x3111aa;});}return null;};}function removeEntity(_0x57a99e,_0x31246e){return function(_0x521073){if(_0x521073){return _0x521073[_0xf4f5('0x29')]()[_0xf4f5('0x2a')](function(){_0x57a99e[_0xf4f5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b4b07,_0x3c06fc){return function(_0x5b0a9b){if(!_0x5b0a9b){_0x3b4b07[_0xf4f5('0x1c')](0x194);}return _0x5b0a9b;};}function handleError(_0x3398b5,_0x1424c9){_0x1424c9=_0x1424c9||0x1f4;return function(_0x499e38){logger[_0xf4f5('0x2b')](_0x499e38[_0xf4f5('0x2c')]);if(_0x499e38[_0xf4f5('0x2d')]){delete _0x499e38[_0xf4f5('0x2d')];}_0x3398b5['status'](_0x1424c9)[_0xf4f5('0x2e')](_0x499e38);};}exports[_0xf4f5('0x2f')]=function(_0x2143a4,_0x5282ce){var _0x5d3b2f={},_0x3be11a={},_0xb2b512={'count':0x0,'rows':[]};var _0x43b0b6=_[_0xf4f5('0x30')](db[_0xf4f5('0x31')][_0xf4f5('0x32')],function(_0x42efce){return{'name':_0x42efce[_0xf4f5('0x33')],'type':_0x42efce[_0xf4f5('0x34')][_0xf4f5('0x35')]};});_0x3be11a[_0xf4f5('0x36')]=_[_0xf4f5('0x30')](_0x43b0b6,_0xf4f5('0x2d'));_0x3be11a[_0xf4f5('0x37')]=_['keys'](_0x2143a4[_0xf4f5('0x37')]);_0x3be11a[_0xf4f5('0x38')]=_[_0xf4f5('0x39')](_0x3be11a[_0xf4f5('0x36')],_0x3be11a[_0xf4f5('0x37')]);_0x5d3b2f[_0xf4f5('0x3a')]=_['intersection'](_0x3be11a[_0xf4f5('0x36')],qs['fields'](_0x2143a4['query'][_0xf4f5('0x3b')]));_0x5d3b2f['attributes']=_0x5d3b2f[_0xf4f5('0x3a')]['length']?_0x5d3b2f[_0xf4f5('0x3a')]:_0x3be11a['model'];if(!_0x2143a4[_0xf4f5('0x37')]['hasOwnProperty'](_0xf4f5('0x3c'))){_0x5d3b2f[_0xf4f5('0x22')]=qs[_0xf4f5('0x22')](_0x2143a4[_0xf4f5('0x37')][_0xf4f5('0x22')]);_0x5d3b2f[_0xf4f5('0x20')]=qs['offset'](_0x2143a4[_0xf4f5('0x37')][_0xf4f5('0x20')]);}_0x5d3b2f['order']=qs['sort'](_0x2143a4[_0xf4f5('0x37')][_0xf4f5('0x3d')]);_0x5d3b2f[_0xf4f5('0x3e')]=qs['filters'](_[_0xf4f5('0x3f')](_0x2143a4['query'],_0x3be11a[_0xf4f5('0x38')]),_0x43b0b6);if(_0x2143a4['query'][_0xf4f5('0x40')]){_0x5d3b2f[_0xf4f5('0x3e')]=_['merge'](_0x5d3b2f['where'],{'$or':_['map'](_0x43b0b6,function(_0x465059){if(_0x465059[_0xf4f5('0x34')]!==_0xf4f5('0x41')){var _0x2303fc={};_0x2303fc[_0x465059[_0xf4f5('0x2d')]]={'$like':'%'+_0x2143a4['query'][_0xf4f5('0x40')]+'%'};return _0x2303fc;}})});}_0x5d3b2f=_['merge']({},_0x5d3b2f,_0x2143a4[_0xf4f5('0x42')]);var _0x3bfd21={'where':_0x5d3b2f['where']};return db[_0xf4f5('0x31')][_0xf4f5('0x21')](_0x3bfd21)[_0xf4f5('0x2a')](function(_0x3917aa){_0xb2b512[_0xf4f5('0x21')]=_0x3917aa;if(_0x2143a4['query']['includeAll']){_0x5d3b2f[_0xf4f5('0x43')]=[{'all':!![]}];}return db[_0xf4f5('0x31')]['findAll'](_0x5d3b2f);})[_0xf4f5('0x2a')](function(_0x221638){_0xb2b512[_0xf4f5('0x44')]=_0x221638;return _0xb2b512;})[_0xf4f5('0x2a')](respondWithFilteredResult(_0x5282ce,_0x5d3b2f))[_0xf4f5('0x45')](handleError(_0x5282ce,null));};exports[_0xf4f5('0x46')]=function(_0x33901d,_0x48a6f7){var _0x542a0d={'raw':!![],'where':{'id':_0x33901d['params']['id']}},_0x5786c2={};_0x5786c2[_0xf4f5('0x36')]=_[_0xf4f5('0x47')](db[_0xf4f5('0x31')]['rawAttributes']);_0x5786c2['query']=_[_0xf4f5('0x47')](_0x33901d[_0xf4f5('0x37')]);_0x5786c2[_0xf4f5('0x38')]=_[_0xf4f5('0x39')](_0x5786c2[_0xf4f5('0x36')],_0x5786c2[_0xf4f5('0x37')]);_0x542a0d['attributes']=_[_0xf4f5('0x39')](_0x5786c2['model'],qs[_0xf4f5('0x3b')](_0x33901d[_0xf4f5('0x37')][_0xf4f5('0x3b')]));_0x542a0d['attributes']=_0x542a0d[_0xf4f5('0x3a')][_0xf4f5('0x48')]?_0x542a0d[_0xf4f5('0x3a')]:_0x5786c2[_0xf4f5('0x36')];if(_0x33901d[_0xf4f5('0x37')][_0xf4f5('0x49')]){_0x542a0d[_0xf4f5('0x43')]=[{'all':!![]}];}_0x542a0d=_[_0xf4f5('0x4a')]({},_0x542a0d,_0x33901d[_0xf4f5('0x42')]);return db[_0xf4f5('0x31')][_0xf4f5('0x4b')](_0x542a0d)[_0xf4f5('0x2a')](handleEntityNotFound(_0x48a6f7,null))[_0xf4f5('0x2a')](respondWithResult(_0x48a6f7,null))['catch'](handleError(_0x48a6f7,null));};exports[_0xf4f5('0x4c')]=function(_0x2435e0,_0x100323){return db['ChatInternalMessage'][_0xf4f5('0x4c')](_0x2435e0[_0xf4f5('0x4d')],{})['then'](respondWithResult(_0x100323,0xc9))[_0xf4f5('0x45')](handleError(_0x100323,null));};exports[_0xf4f5('0x28')]=function(_0x40efec,_0x9e433a){if(_0x40efec['body']['id']){delete _0x40efec[_0xf4f5('0x4d')]['id'];}return db[_0xf4f5('0x31')][_0xf4f5('0x4b')]({'where':{'id':_0x40efec[_0xf4f5('0x4e')]['id']}})[_0xf4f5('0x2a')](handleEntityNotFound(_0x9e433a,null))[_0xf4f5('0x2a')](saveUpdates(_0x40efec[_0xf4f5('0x4d')],null))['then'](respondWithResult(_0x9e433a,null))[_0xf4f5('0x45')](handleError(_0x9e433a,null));};exports[_0xf4f5('0x29')]=function(_0x5330de,_0x44de0e){return db[_0xf4f5('0x31')][_0xf4f5('0x4b')]({'where':{'id':_0x5330de[_0xf4f5('0x4e')]['id']}})[_0xf4f5('0x2a')](handleEntityNotFound(_0x44de0e,null))[_0xf4f5('0x2a')](removeEntity(_0x44de0e,null))[_0xf4f5('0x45')](handleError(_0x44de0e,null));};exports[_0xf4f5('0x4f')]=function(_0x1d8726,_0x4bebee){return db[_0xf4f5('0x31')][_0xf4f5('0x4f')]()['then'](respondWithResult(_0x4bebee,null))[_0xf4f5('0x45')](handleError(_0x4bebee,null));};function wrapUser(_0x2b8834){return function(_0x41a236){var _0x2b2055=_0x2b8834['get']({'plain':!![]});_0x2b2055[_0xf4f5('0x50')]=[];if(_0x41a236){_0x2b2055[_0xf4f5('0x51')]=_0x41a236[_0xf4f5('0x52')];_0x2b2055['lastMessage']=_0x41a236;}else{_0x2b2055[_0xf4f5('0x51')]=moment(0x0)[_0xf4f5('0x53')](_0xf4f5('0x54'));_0x2b2055[_0xf4f5('0x55')]={};}return _0x2b2055;};}exports['getUsers']=function(_0x2225c2,_0x23ae74,_0x58052b){var _0x277ac5=[];return db[_0xf4f5('0x56')]['findAll']({'where':{'role':[_0xf4f5('0x57'),_0xf4f5('0x58'),_0xf4f5('0x59')]},'attributes':['id','fullname',_0xf4f5('0x2d'),'role',_0xf4f5('0x5a'),_0xf4f5('0x5b'),'online',_0xf4f5('0x5c'),_0xf4f5('0x5d'),_0xf4f5('0x5e')],'order':qs[_0xf4f5('0x3d')](_0xf4f5('0x5f')),'include':[{'model':db[_0xf4f5('0x60')],'as':'VoiceQueues','attributes':['id',_0xf4f5('0x2d'),_0xf4f5('0x34')],'through':{'attributes':[]}}]})[_0xf4f5('0x2a')](function(_0x181acf){if(_0x181acf){var _0x571973=_0x2225c2[_0xf4f5('0x59')][_0xf4f5('0x61')]({'plain':!![]});if(!_0x571973)throw new Error(_0xf4f5('0x62'));if(_0x571973[_0xf4f5('0x63')]==='user'){return db[_0xf4f5('0x64')]['find']({'where':{'name':_0xf4f5('0x65'),'userProfileId':_0x571973[_0xf4f5('0x66')]},'raw':!![]})[_0xf4f5('0x2a')](function(_0x18582f){if(_0x18582f){if(_0x18582f[_0xf4f5('0x67')]===0x0){return db['UserProfileResource'][_0xf4f5('0x68')]({'where':{'sectionId':_0x18582f['id']},'raw':!![]})[_0xf4f5('0x2a')](function(_0x4ed3e8){var _0x497066=[];if(_[_0xf4f5('0x69')](_0x4ed3e8)){_0x497066=_[_0xf4f5('0x40')](_0x181acf,function(_0x8f57e9){if(_0x8f57e9[_0xf4f5('0x63')]!==_0xf4f5('0x57')){return _0x8f57e9;}});return _0x497066;}else{for(var _0x2fdfff=0x0;_0x2fdfff<_0x181acf[_0xf4f5('0x48')];_0x2fdfff++){var _0x570c9c=_0x181acf[_0x2fdfff];if(_0x570c9c[_0xf4f5('0x63')]==='agent'){var _0x382eae=_[_0xf4f5('0x4b')](_0x4ed3e8,function(_0x13e998){return _0x13e998[_0xf4f5('0x6a')]===_0x570c9c['id'];});if(_0x382eae)_0x497066[_0xf4f5('0x6b')](_0x570c9c);}else{_0x497066[_0xf4f5('0x6b')](_0x570c9c);}}return _0x497066;}});}else{return _0x181acf;}}else{var _0x5e8e1d=_[_0xf4f5('0x40')](_0x181acf,function(_0x34ea82){if(_0x34ea82[_0xf4f5('0x63')]!==_0xf4f5('0x57')){return _0x34ea82;}});return _0x5e8e1d;}});}else{return _0x181acf;}}})[_0xf4f5('0x2a')](function(_0x23c8e1){var _0x5e3e97=[];if(_0x23c8e1){_0x277ac5=_0x23c8e1;for(var _0x2afacd=0x0;_0x2afacd<_0x23c8e1[_0xf4f5('0x48')];_0x2afacd+=0x1){_0x277ac5[_0x2afacd][_0xf4f5('0x50')]=[];_0x5e3e97['push'](db['ChatInternalMessage'][_0xf4f5('0x4b')]({'where':{'FromId':[_0x2225c2[_0xf4f5('0x59')]['id'],_0x23c8e1[_0x2afacd]['id']],'ToId':[_0x2225c2[_0xf4f5('0x59')]['id'],_0x23c8e1[_0x2afacd]['id']],'ChatGroupId':null},'attributes':['id',_0xf4f5('0x52'),'FromId',_0xf4f5('0x6c'),_0xf4f5('0x6d'),_0xf4f5('0x4d')],'order':qs[_0xf4f5('0x3d')](_0xf4f5('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x23c8e1[_0x2afacd])));}return BPromise[_0xf4f5('0x6f')](_0x5e3e97);}return[];})[_0xf4f5('0x2a')](function(_0x18312e){return{'rows':_0x18312e,'count':_0x18312e[_0xf4f5('0x48')]};})[_0xf4f5('0x2a')](respondWithResult(_0x23ae74,null))[_0xf4f5('0x45')](handleError(_0x23ae74,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 2a6d99b..8d90915 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 _0x3953=['ChatInternalMessage','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2d6dac,_0x7adb77){var _0x3a3375=function(_0x19cbd9){while(--_0x19cbd9){_0x2d6dac['push'](_0x2d6dac['shift']());}};_0x3a3375(++_0x7adb77);}(_0x3953,0x16f));var _0x3395=function(_0xff6e4,_0x3d82fb){_0xff6e4=_0xff6e4-0x0;var _0x3ada16=_0x3953[_0xff6e4];return _0x3ada16;};'use strict';var EventEmitter=require(_0x3395('0x0'));var ChatInternalMessage=require(_0x3395('0x1'))['db'][_0x3395('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3395('0x3'),'afterUpdate':_0x3395('0x4'),'afterDestroy':_0x3395('0x5')};function emitEvent(_0x1a3d41){return function(_0x3914ed,_0x1c4300,_0x33dc32){ChatInternalMessageEvents['emit'](_0x1a3d41+':'+_0x3914ed['id'],_0x3914ed);ChatInternalMessageEvents[_0x3395('0x6')](_0x1a3d41,_0x3914ed);_0x33dc32(null);};}for(var e in events){if(events[_0x3395('0x7')](e)){var event=events[e];ChatInternalMessage[_0x3395('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x5193=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage','save','update','remove','emit'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0x5193,0x143));var _0x3519=function(_0x72b71a,_0x1877bb){_0x72b71a=_0x72b71a-0x0;var _0x2286bc=_0x5193[_0x72b71a];return _0x2286bc;};'use strict';var EventEmitter=require(_0x3519('0x0'));var ChatInternalMessage=require(_0x3519('0x1'))['db'][_0x3519('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3519('0x3'),'afterUpdate':_0x3519('0x4'),'afterDestroy':_0x3519('0x5')};function emitEvent(_0x48eb21){return function(_0x19d7d1,_0x34c3af,_0x372467){ChatInternalMessageEvents[_0x3519('0x6')](_0x48eb21+':'+_0x19d7d1['id'],_0x19d7d1);ChatInternalMessageEvents[_0x3519('0x6')](_0x48eb21,_0x19d7d1);_0x372467(null);};}for(var e in events){if(events[_0x3519('0x7')](e)){var event=events[e];ChatInternalMessage[_0x3519('0x8')](e,emitEvent(event));}}module[_0x3519('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index c7f0c85..98d6a73 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 _0xba19=['chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage'];(function(_0x4060ae,_0x4a46d4){var _0x16582b=function(_0x2b691f){while(--_0x2b691f){_0x4060ae['push'](_0x4060ae['shift']());}};_0x16582b(++_0x4a46d4);}(_0xba19,0xd5));var _0x9ba1=function(_0x590bab,_0x1744d3){_0x590bab=_0x590bab-0x0;var _0x4b0595=_0xba19[_0x590bab];return _0x4b0595;};'use strict';var _=require('lodash');var util=require(_0x9ba1('0x0'));var logger=require(_0x9ba1('0x1'))(_0x9ba1('0x2'));var moment=require(_0x9ba1('0x3'));var BPromise=require(_0x9ba1('0x4'));var rp=require(_0x9ba1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9ba1('0x6'));var attributes=require(_0x9ba1('0x7'));module[_0x9ba1('0x8')]=function(_0x117bea,_0x5027c7){return _0x117bea[_0x9ba1('0x9')](_0x9ba1('0xa'),attributes,{'tableName':_0x9ba1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9ba1('0xc'),'collate':_0x9ba1('0xd')});}; \ No newline at end of file +var _0xbf34=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','rimraf','define','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0xb0895e,_0xbe27f3){var _0x24dbae=function(_0x590497){while(--_0x590497){_0xb0895e['push'](_0xb0895e['shift']());}};_0x24dbae(++_0xbe27f3);}(_0xbf34,0x177));var _0x4bf3=function(_0x24233a,_0xfd68b7){_0x24233a=_0x24233a-0x0;var _0x2a98ee=_0xbf34[_0x24233a];return _0x2a98ee;};'use strict';var _=require('lodash');var util=require(_0x4bf3('0x0'));var logger=require(_0x4bf3('0x1'))(_0x4bf3('0x2'));var moment=require(_0x4bf3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4bf3('0x4'));var rimraf=require(_0x4bf3('0x5'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module['exports']=function(_0x1938f0,_0x13e811){return _0x1938f0[_0x4bf3('0x6')](_0x4bf3('0x7'),attributes,{'tableName':_0x4bf3('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4bf3('0x9'),'collate':_0x4bf3('0xa')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b5aac37..19545c7 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 _0x04f1=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','http','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info'];(function(_0x3f465d,_0xbd2037){var _0x121ad1=function(_0x5b13d6){while(--_0x5b13d6){_0x3f465d['push'](_0x3f465d['shift']());}};_0x121ad1(++_0xbd2037);}(_0x04f1,0x92));var _0x104f=function(_0x58fb8e,_0x445a00){_0x58fb8e=_0x58fb8e-0x0;var _0x484471=_0x04f1[_0x58fb8e];return _0x484471;};'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});config[_0x104f('0x7')]=_[_0x104f('0x8')](config[_0x104f('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x104f('0x9'))(new Redis(config[_0x104f('0x7')]));require(_0x104f('0xa'))[_0x104f('0xb')](socket);function respondWithRpcPromise(_0x4f3c6b,_0x5d11f3,_0x424526){return new BPromise(function(_0x2635d6,_0x1e5996){return client[_0x104f('0xc')](_0x4f3c6b,_0x424526)[_0x104f('0xd')](function(_0x2dcd68){logger[_0x104f('0xe')](_0x104f('0xf'),_0x5d11f3,_0x104f('0x10'));logger[_0x104f('0x11')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x5d11f3,_0x104f('0x10'),JSON[_0x104f('0x12')](_0x2dcd68));if(_0x2dcd68[_0x104f('0x13')]){if(_0x2dcd68[_0x104f('0x13')][_0x104f('0x14')]===0x1f4){logger[_0x104f('0x13')](_0x104f('0xf'),_0x5d11f3,_0x2dcd68[_0x104f('0x13')][_0x104f('0x15')]);return _0x1e5996(_0x2dcd68[_0x104f('0x13')][_0x104f('0x15')]);}logger[_0x104f('0x13')](_0x104f('0xf'),_0x5d11f3,_0x2dcd68[_0x104f('0x13')]['message']);return _0x2635d6(_0x2dcd68[_0x104f('0x13')][_0x104f('0x15')]);}else{logger[_0x104f('0xe')](_0x104f('0xf'),_0x5d11f3,'request\x20sent');_0x2635d6(_0x2dcd68[_0x104f('0x16')][_0x104f('0x15')]);}})['catch'](function(_0x3c54a0){logger[_0x104f('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x5d11f3,_0x3c54a0);_0x1e5996(_0x3c54a0);});});} \ No newline at end of file +var _0x023f=['../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x27ff35,_0x43abb8){var _0x18138f=function(_0x4ea812){while(--_0x4ea812){_0x27ff35['push'](_0x27ff35['shift']());}};_0x18138f(++_0x43abb8);}(_0x023f,0x69));var _0xf023=function(_0x4fcb09,_0x1de55d){_0x4fcb09=_0x4fcb09-0x0;var _0x141fbf=_0x023f[_0x4fcb09];return _0x141fbf;};'use strict';var _=require(_0xf023('0x0'));var util=require(_0xf023('0x1'));var moment=require(_0xf023('0x2'));var BPromise=require(_0xf023('0x3'));var rs=require(_0xf023('0x4'));var fs=require('fs');var Redis=require(_0xf023('0x5'));var db=require(_0xf023('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf023('0x7'))(_0xf023('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf023('0x9')]['http']({'port':0x232a});config[_0xf023('0xa')]=_[_0xf023('0xb')](config[_0xf023('0xa')],{'host':_0xf023('0xc'),'port':0x18eb});var socket=require(_0xf023('0xd'))(new Redis(config[_0xf023('0xa')]));require(_0xf023('0xe'))[_0xf023('0xf')](socket);function respondWithRpcPromise(_0x4edb7c,_0x312a03,_0x3bcb2e){return new BPromise(function(_0x40b84f,_0x2efd10){return client[_0xf023('0x10')](_0x4edb7c,_0x3bcb2e)[_0xf023('0x11')](function(_0x41afc0){logger[_0xf023('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x312a03,_0xf023('0x13'));logger[_0xf023('0x14')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x312a03,'request\x20sent',JSON[_0xf023('0x15')](_0x41afc0));if(_0x41afc0['error']){if(_0x41afc0[_0xf023('0x16')][_0xf023('0x17')]===0x1f4){logger[_0xf023('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x312a03,_0x41afc0['error']['message']);return _0x2efd10(_0x41afc0[_0xf023('0x16')]['message']);}logger[_0xf023('0x16')](_0xf023('0x18'),_0x312a03,_0x41afc0[_0xf023('0x16')]['message']);return _0x40b84f(_0x41afc0[_0xf023('0x16')]['message']);}else{logger[_0xf023('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x312a03,_0xf023('0x13'));_0x40b84f(_0x41afc0[_0xf023('0x19')][_0xf023('0x1a')]);}})[_0xf023('0x1b')](function(_0x2edcad){logger[_0xf023('0x16')](_0xf023('0x18'),_0x312a03,_0x2edcad);_0x2efd10(_0x2edcad);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index f89be94..515db4a 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 _0x6b7b=['length','save','update','emit','removeListener','register'];(function(_0x58a150,_0x111b65){var _0x367b59=function(_0x11a02c){while(--_0x11a02c){_0x58a150['push'](_0x58a150['shift']());}};_0x367b59(++_0x111b65);}(_0x6b7b,0xd3));var _0xb6b7=function(_0x22e659,_0x5ca4c8){_0x22e659=_0x22e659-0x0;var _0x4c76a2=_0x6b7b[_0x22e659];return _0x4c76a2;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xb6b7('0x0'),'remove',_0xb6b7('0x1')];function createListener(_0x2030a3,_0x34196b){return function(_0x1244ed){_0x34196b[_0xb6b7('0x2')](_0x2030a3,_0x1244ed);};}function removeListener(_0x27184d,_0x334111){return function(){ChatInternalMessageEvents[_0xb6b7('0x3')](_0x27184d,_0x334111);};}exports[_0xb6b7('0x4')]=function(_0x3b8324){for(var _0x4e30bb=0x0,_0x38e35d=events[_0xb6b7('0x5')];_0x4e30bb<_0x38e35d;_0x4e30bb++){var _0x394add=events[_0x4e30bb];var _0x576b31=createListener('chatInternalMessage:'+_0x394add,_0x3b8324);ChatInternalMessageEvents['on'](_0x394add,_0x576b31);}}; \ No newline at end of file +var _0xdf22=['removeListener','length','chatInternalMessage:','./chatInternalMessage.events','save','emit'];(function(_0x16dd09,_0x19cd4a){var _0x518cc4=function(_0x5529b2){while(--_0x5529b2){_0x16dd09['push'](_0x16dd09['shift']());}};_0x518cc4(++_0x19cd4a);}(_0xdf22,0x93));var _0x2df2=function(_0x123af2,_0x23b27c){_0x123af2=_0x123af2-0x0;var _0xe39a07=_0xdf22[_0x123af2];return _0xe39a07;};'use strict';var ChatInternalMessageEvents=require(_0x2df2('0x0'));var events=[_0x2df2('0x1'),'remove','update'];function createListener(_0x5f5a81,_0x4bf738){return function(_0x15026e){_0x4bf738[_0x2df2('0x2')](_0x5f5a81,_0x15026e);};}function removeListener(_0x5e5b9d,_0x15fdd7){return function(){ChatInternalMessageEvents[_0x2df2('0x3')](_0x5e5b9d,_0x15fdd7);};}exports['register']=function(_0x23e410){for(var _0x3ce456=0x0,_0x5e0cff=events[_0x2df2('0x4')];_0x3ce456<_0x5e0cff;_0x3ce456++){var _0x3e23e2=events[_0x3ce456];var _0xfa7ec6=createListener(_0x2df2('0x5')+_0x3e23e2,_0x23e410);ChatInternalMessageEvents['on'](_0x3e23e2,_0xfa7ec6);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 6be2f75..256550b 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 _0xa285=['connect-timeout','express','Router','fs-extra','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','exports','util','path'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0xa285,0xfd));var _0x5a28=function(_0x32d9cc,_0x54b594){_0x32d9cc=_0x32d9cc-0x0;var _0x25a953=_0xa285[_0x32d9cc];return _0x25a953;};'use strict';var multer=require('multer');var util=require(_0x5a28('0x0'));var path=require(_0x5a28('0x1'));var timeout=require(_0x5a28('0x2'));var express=require(_0x5a28('0x3'));var router=express[_0x5a28('0x4')]();var fs_extra=require(_0x5a28('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router[_0x5a28('0x6')]('/',auth[_0x5a28('0x7')](),controller[_0x5a28('0x8')]);router[_0x5a28('0x6')](_0x5a28('0x9'),auth[_0x5a28('0x7')](),controller[_0x5a28('0xa')]);router[_0x5a28('0x6')]('/users',auth['isAuthenticated'](),controller['getUsers']);router[_0x5a28('0x6')](_0x5a28('0xb'),auth[_0x5a28('0x7')](),controller[_0x5a28('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5a28('0xd')]);router['put'](_0x5a28('0xb'),controller[_0x5a28('0xe')]);router[_0x5a28('0xf')](_0x5a28('0xb'),auth[_0x5a28('0x7')](),controller['destroy']);module[_0x5a28('0x10')]=router; \ No newline at end of file +var _0xd450=['index','/describe','describe','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd450,0x73));var _0x0d45=function(_0x222bae,_0x3a6f37){_0x222bae=_0x222bae-0x0;var _0x3a8ad6=_0xd450[_0x222bae];return _0x3a8ad6;};'use strict';var multer=require(_0x0d45('0x0'));var util=require(_0x0d45('0x1'));var path=require(_0x0d45('0x2'));var timeout=require(_0x0d45('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0d45('0x4'));var auth=require(_0x0d45('0x5'));var interaction=require(_0x0d45('0x6'));var config=require(_0x0d45('0x7'));var controller=require(_0x0d45('0x8'));router[_0x0d45('0x9')]('/',auth[_0x0d45('0xa')](),controller[_0x0d45('0xb')]);router['get'](_0x0d45('0xc'),auth[_0x0d45('0xa')](),controller[_0x0d45('0xd')]);router[_0x0d45('0x9')]('/users',auth[_0x0d45('0xa')](),controller['getUsers']);router[_0x0d45('0x9')]('/:id',auth[_0x0d45('0xa')](),controller[_0x0d45('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x0d45('0xf')](_0x0d45('0x10'),controller[_0x0d45('0x11')]);router[_0x0d45('0x12')](_0x0d45('0x10'),auth[_0x0d45('0xa')](),controller[_0x0d45('0x13')]);module[_0x0d45('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 8c143c6..20f6029 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 _0x720e=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT'];(function(_0x16de68,_0x33d7ff){var _0x1c277e=function(_0x1d8549){while(--_0x1d8549){_0x16de68['push'](_0x16de68['shift']());}};_0x1c277e(++_0x33d7ff);}(_0x720e,0x1cb));var _0xe720=function(_0x4f2c3a,_0x6bde90){_0x4f2c3a=_0x4f2c3a-0x0;var _0x17d91c=_0x720e[_0x4f2c3a];return _0x17d91c;};'use strict';var Sequelize=require(_0xe720('0x0'));module[_0xe720('0x1')]={'body':{'type':Sequelize[_0xe720('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xe720('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe720('0x4')),'defaultValue':_0xe720('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe720('0x5')]},'providerName':{'type':Sequelize[_0xe720('0x6')]},'providerResponse':{'type':Sequelize[_0xe720('0x2')]}}; \ No newline at end of file +var _0x9158=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x9158,0x16e));var _0x8915=function(_0x4030af,_0x1ce105){_0x4030af=_0x4030af-0x0;var _0x1ba9ae=_0x9158[_0x4030af];return _0x1ba9ae;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'body':{'type':Sequelize[_0x8915('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8915('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8915('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8915('0x5')]},'providerName':{'type':Sequelize[_0x8915('0x6')]},'providerResponse':{'type':Sequelize[_0x8915('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 00e6ec6..42fc27c 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(_0x125346,_0x352bda){var _0x110425=function(_0x91cb80){while(--_0x91cb80){_0x125346['push'](_0x125346['shift']());}};_0x110425(++_0x352bda);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x5b2186,_0x339e5f){var _0x400157=function(_0x5ba11e){while(--_0x5ba11e){_0x5b2186['push'](_0x5b2186['shift']());}};_0x400157(++_0x339e5f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 201d350..ab281de 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 _0xa997=['exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hook'];(function(_0x5ed76a,_0x686c7){var _0x35d7e1=function(_0x228402){while(--_0x228402){_0x5ed76a['push'](_0x5ed76a['shift']());}};_0x35d7e1(++_0x686c7);}(_0xa997,0xc1));var _0x7a99=function(_0x315add,_0x5e9ace){_0x315add=_0x315add-0x0;var _0x40956b=_0xa997[_0x315add];return _0x40956b;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x7a99('0x0'))['db'][_0x7a99('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x7a99('0x2')](0x0);var events={'afterCreate':_0x7a99('0x3'),'afterUpdate':_0x7a99('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e70c8){return function(_0x2fa0ee,_0xa63829,_0x53ed95){ChatMessageEvents[_0x7a99('0x5')](_0x3e70c8+':'+_0x2fa0ee['id'],_0x2fa0ee);ChatMessageEvents['emit'](_0x3e70c8,_0x2fa0ee);_0x53ed95(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x7a99('0x6')](e,emitEvent(event));}}module[_0x7a99('0x7')]=ChatMessageEvents; \ No newline at end of file +var _0xfd79=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4f7d3b,_0x862020){var _0x40b525=function(_0x25437d){while(--_0x25437d){_0x4f7d3b['push'](_0x4f7d3b['shift']());}};_0x40b525(++_0x862020);}(_0xfd79,0x194));var _0x9fd7=function(_0x254aa9,_0x231c46){_0x254aa9=_0x254aa9-0x0;var _0x133690=_0xfd79[_0x254aa9];return _0x133690;};'use strict';var EventEmitter=require(_0x9fd7('0x0'));var ChatMessage=require(_0x9fd7('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9fd7('0x2')](0x0);var events={'afterCreate':_0x9fd7('0x3'),'afterUpdate':_0x9fd7('0x4'),'afterDestroy':_0x9fd7('0x5')};function emitEvent(_0x3f74f3){return function(_0x3139b2,_0x10a924,_0x376169){ChatMessageEvents[_0x9fd7('0x6')](_0x3f74f3+':'+_0x3139b2['id'],_0x3139b2);ChatMessageEvents[_0x9fd7('0x6')](_0x3f74f3,_0x3139b2);_0x376169(null);};}for(var e in events){if(events[_0x9fd7('0x7')](e)){var event=events[e];ChatMessage[_0x9fd7('0x8')](e,emitEvent(event));}}module[_0x9fd7('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 8328363..0851856 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 _0x3376=['ChatMessage','fti_chat_messages','FULLTEXT','models','get','toLowerCase','out','secret','ChatInteraction','findOne','then','update','createdAt','error','utf8mb4','util','../../config/logger','rimraf','../../config/environment','exports','define'];(function(_0x114249,_0x170da6){var _0xfcb844=function(_0x5873ac){while(--_0x5873ac){_0x114249['push'](_0x114249['shift']());}};_0xfcb844(++_0x170da6);}(_0x3376,0x1dd));var _0x6337=function(_0x4b1be3,_0x493961){_0x4b1be3=_0x4b1be3-0x0;var _0x2cea4a=_0x3376[_0x4b1be3];return _0x2cea4a;};'use strict';var _=require('lodash');var util=require(_0x6337('0x0'));var logger=require(_0x6337('0x1'))('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(_0x6337('0x2'));var config=require(_0x6337('0x3'));var attributes=require('./chatMessage.attributes');module[_0x6337('0x4')]=function(_0x3fd9ae,_0x50b2a7){return _0x3fd9ae[_0x6337('0x5')](_0x6337('0x6'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x6337('0x7'),'fields':['body'],'type':_0x6337('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x54cbab,_0x4d8138,_0x490b46){var _0xeaeb77=_0x3fd9ae[_0x6337('0x9')];var _0x153d16=_0x54cbab[_0x6337('0xa')]({'plain':!![]});if(_0x153d16['direction']['toLowerCase']()==='in'||_0x153d16['direction'][_0x6337('0xb')]()===_0x6337('0xc')&&!_0x153d16[_0x6337('0xd')]&&!_['isNil'](_0x153d16['UserId'])){_0xeaeb77[_0x6337('0xe')][_0x6337('0xf')]({'where':{'id':_0x153d16['ChatInteractionId']}})[_0x6337('0x10')](function(_0xe3b9f1){if(_0xe3b9f1){_0xe3b9f1[_0x6337('0x11')]({'lastMsgAt':_0x153d16[_0x6337('0x12')],'lastMsgDirection':_0x153d16['direction'][_0x6337('0xb')]()});}})['catch'](function(_0x51bda2){console[_0x6337('0x13')](_0x51bda2);});}_0x490b46();}},'charset':_0x6337('0x14'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1b07=['moment','bluebird','path','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','ChatInteraction','findOne','then','update','createdAt','error','utf8mb4_unicode_ci','lodash','util','api'];(function(_0x3dab54,_0x17ae72){var _0x144d02=function(_0x242f74){while(--_0x242f74){_0x3dab54['push'](_0x3dab54['shift']());}};_0x144d02(++_0x17ae72);}(_0x1b07,0xcd));var _0x71b0=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0x1b07[_0x41d02a];return _0x4c3983;};'use strict';var _=require(_0x71b0('0x0'));var util=require(_0x71b0('0x1'));var logger=require('../../config/logger')(_0x71b0('0x2'));var moment=require(_0x71b0('0x3'));var BPromise=require(_0x71b0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71b0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x71b0('0x6'));module['exports']=function(_0x4704c4,_0x2268de){return _0x4704c4[_0x71b0('0x7')]('ChatMessage',attributes,{'tableName':_0x71b0('0x8'),'paranoid':![],'indexes':[{'name':_0x71b0('0x9'),'fields':[_0x71b0('0xa')],'type':_0x71b0('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2c12a4,_0x525bc9,_0x33c3e8){var _0x1c3a58=_0x4704c4[_0x71b0('0xc')];var _0x29e215=_0x2c12a4[_0x71b0('0xd')]({'plain':!![]});if(_0x29e215[_0x71b0('0xe')][_0x71b0('0xf')]()==='in'||_0x29e215['direction']['toLowerCase']()===_0x71b0('0x10')&&!_0x29e215[_0x71b0('0x11')]&&!_[_0x71b0('0x12')](_0x29e215['UserId'])){_0x1c3a58[_0x71b0('0x13')][_0x71b0('0x14')]({'where':{'id':_0x29e215['ChatInteractionId']}})[_0x71b0('0x15')](function(_0x53f807){if(_0x53f807){_0x53f807[_0x71b0('0x16')]({'lastMsgAt':_0x29e215[_0x71b0('0x17')],'lastMsgDirection':_0x29e215[_0x71b0('0xe')]['toLowerCase']()});}})['catch'](function(_0x2e9b43){console[_0x71b0('0x18')](_0x2e9b43);});}_0x33c3e8();}},'charset':'utf8mb4','collate':_0x71b0('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 9cabf51..bebcd36 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 _0x7fd4=['create','options','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','catch','CreateChatMessage','ChatMessage'];(function(_0x2e673b,_0x31fd71){var _0x16ad03=function(_0x91494b){while(--_0x91494b){_0x2e673b['push'](_0x2e673b['shift']());}};_0x16ad03(++_0x31fd71);}(_0x7fd4,0x177));var _0x47fd=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7fd4[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x47fd('0x0'));var moment=require('moment');var BPromise=require(_0x47fd('0x1'));var rs=require(_0x47fd('0x2'));var fs=require('fs');var Redis=require(_0x47fd('0x3'));var db=require(_0x47fd('0x4'))['db'];var utils=require(_0x47fd('0x5'));var logger=require(_0x47fd('0x6'))('rpc');var config=require(_0x47fd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x47fd('0x8')][_0x47fd('0x9')]({'port':0x232a});config[_0x47fd('0xa')]=_[_0x47fd('0xb')](config[_0x47fd('0xa')],{'host':_0x47fd('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47fd('0xa')]));require(_0x47fd('0xd'))[_0x47fd('0xe')](socket);function respondWithRpcPromise(_0x11ec49,_0x293610,_0x494fc0){return new BPromise(function(_0x50a63f,_0xe0972e){return client[_0x47fd('0xf')](_0x11ec49,_0x494fc0)[_0x47fd('0x10')](function(_0x6f517c){logger[_0x47fd('0x11')](_0x47fd('0x12'),_0x293610,'request\x20sent');logger[_0x47fd('0x13')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x293610,_0x47fd('0x14'),JSON[_0x47fd('0x15')](_0x6f517c));if(_0x6f517c['error']){if(_0x6f517c['error'][_0x47fd('0x16')]===0x1f4){logger[_0x47fd('0x17')]('ChatMessage,\x20%s,\x20%s',_0x293610,_0x6f517c[_0x47fd('0x17')][_0x47fd('0x18')]);return _0xe0972e(_0x6f517c[_0x47fd('0x17')]['message']);}logger[_0x47fd('0x17')](_0x47fd('0x12'),_0x293610,_0x6f517c[_0x47fd('0x17')][_0x47fd('0x18')]);return _0x50a63f(_0x6f517c[_0x47fd('0x17')][_0x47fd('0x18')]);}else{logger[_0x47fd('0x11')](_0x47fd('0x12'),_0x293610,_0x47fd('0x14'));_0x50a63f(_0x6f517c['result'][_0x47fd('0x18')]);}})[_0x47fd('0x19')](function(_0x44883a){logger[_0x47fd('0x17')](_0x47fd('0x12'),_0x293610,_0x44883a);_0xe0972e(_0x44883a);});});}exports[_0x47fd('0x1a')]=function(_0x5631c6){var _0x239c5a=this;return new Promise(function(_0x39a041,_0xa855c9){return db[_0x47fd('0x1b')][_0x47fd('0x1c')](_0x5631c6['body'],{'raw':_0x5631c6[_0x47fd('0x1d')]?_0x5631c6[_0x47fd('0x1d')][_0x47fd('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x4e2e14){logger[_0x47fd('0x11')](_0x47fd('0x1a'),_0x5631c6);logger[_0x47fd('0x13')](_0x47fd('0x1a'),_0x5631c6,JSON[_0x47fd('0x15')](_0x4e2e14));_0x39a041(_0x4e2e14);})[_0x47fd('0x19')](function(_0x2efeee){logger[_0x47fd('0x17')](_0x47fd('0x1a'),_0x2efeee['message'],_0x5631c6);_0xa855c9(_0x239c5a[_0x47fd('0x17')](0x1f4,_0x2efeee[_0x47fd('0x18')]));});});}; \ No newline at end of file +var _0x4ff8=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatMessage.socket','register','request','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','result','catch','ChatMessage','create','body','options','CreateChatMessage','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x54be74,_0x37c908){var _0x47da47=function(_0x233b4b){while(--_0x233b4b){_0x54be74['push'](_0x54be74['shift']());}};_0x47da47(++_0x37c908);}(_0x4ff8,0xcc));var _0x84ff=function(_0x44ba23,_0x34546d){_0x44ba23=_0x44ba23-0x0;var _0x5d8b84=_0x4ff8[_0x44ba23];return _0x5d8b84;};'use strict';var _=require(_0x84ff('0x0'));var util=require(_0x84ff('0x1'));var moment=require(_0x84ff('0x2'));var BPromise=require(_0x84ff('0x3'));var rs=require(_0x84ff('0x4'));var fs=require('fs');var Redis=require(_0x84ff('0x5'));var db=require(_0x84ff('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x84ff('0x7'))(_0x84ff('0x8'));var config=require(_0x84ff('0x9'));var jayson=require(_0x84ff('0xa'));var client=jayson[_0x84ff('0xb')][_0x84ff('0xc')]({'port':0x232a});config[_0x84ff('0xd')]=_[_0x84ff('0xe')](config[_0x84ff('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x84ff('0xf'))[_0x84ff('0x10')](socket);function respondWithRpcPromise(_0x4067b9,_0x45cd72,_0x13bf86){return new BPromise(function(_0x3dc6e2,_0x14b9e7){return client[_0x84ff('0x11')](_0x4067b9,_0x13bf86)[_0x84ff('0x12')](function(_0x4e5a76){logger[_0x84ff('0x13')]('ChatMessage,\x20%s,\x20%s',_0x45cd72,'request\x20sent');logger[_0x84ff('0x14')](_0x84ff('0x15'),_0x45cd72,_0x84ff('0x16'),JSON[_0x84ff('0x17')](_0x4e5a76));if(_0x4e5a76[_0x84ff('0x18')]){if(_0x4e5a76[_0x84ff('0x18')][_0x84ff('0x19')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x45cd72,_0x4e5a76[_0x84ff('0x18')]['message']);return _0x14b9e7(_0x4e5a76[_0x84ff('0x18')][_0x84ff('0x1a')]);}logger[_0x84ff('0x18')](_0x84ff('0x1b'),_0x45cd72,_0x4e5a76['error'][_0x84ff('0x1a')]);return _0x3dc6e2(_0x4e5a76[_0x84ff('0x18')][_0x84ff('0x1a')]);}else{logger[_0x84ff('0x13')](_0x84ff('0x1b'),_0x45cd72,_0x84ff('0x16'));_0x3dc6e2(_0x4e5a76[_0x84ff('0x1c')]['message']);}})[_0x84ff('0x1d')](function(_0x568223){logger['error']('ChatMessage,\x20%s,\x20%s',_0x45cd72,_0x568223);_0x14b9e7(_0x568223);});});}exports['CreateChatMessage']=function(_0x562adc){var _0x296d35=this;return new Promise(function(_0x34da18,_0x20381b){return db[_0x84ff('0x1e')][_0x84ff('0x1f')](_0x562adc[_0x84ff('0x20')],{'raw':_0x562adc[_0x84ff('0x21')]?_0x562adc[_0x84ff('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x84ff('0x12')](function(_0x2bb763){logger[_0x84ff('0x13')](_0x84ff('0x22'),_0x562adc);logger[_0x84ff('0x14')](_0x84ff('0x22'),_0x562adc,JSON['stringify'](_0x2bb763));_0x34da18(_0x2bb763);})[_0x84ff('0x1d')](function(_0x3070a4){logger[_0x84ff('0x18')]('CreateChatMessage',_0x3070a4['message'],_0x562adc);_0x20381b(_0x296d35[_0x84ff('0x18')](0x1f4,_0x3070a4[_0x84ff('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 8141069..17e8115 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 _0x85d0=['emit','register','length','chatMessage:'];(function(_0x155bd4,_0x130975){var _0x535e1b=function(_0x3b264f){while(--_0x3b264f){_0x155bd4['push'](_0x155bd4['shift']());}};_0x535e1b(++_0x130975);}(_0x85d0,0x164));var _0x085d=function(_0x5071f1,_0x1af03a){_0x5071f1=_0x5071f1-0x0;var _0x3c1d7b=_0x85d0[_0x5071f1];return _0x3c1d7b;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save','remove','update'];function createListener(_0x297001,_0x1716e5){return function(_0xfd8773){_0x1716e5[_0x085d('0x0')](_0x297001,_0xfd8773);};}function removeListener(_0x231765,_0x19ae4c){return function(){ChatMessageEvents['removeListener'](_0x231765,_0x19ae4c);};}exports[_0x085d('0x1')]=function(_0x5c917f){for(var _0x364f09=0x0,_0x9acc97=events[_0x085d('0x2')];_0x364f09<_0x9acc97;_0x364f09++){var _0x4a12b7=events[_0x364f09];var _0xf65d01=createListener(_0x085d('0x3')+_0x4a12b7,_0x5c917f);ChatMessageEvents['on'](_0x4a12b7,_0xf65d01);}}; \ No newline at end of file +var _0x1af3=['emit','register','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x3f281b,_0x4fc4db){var _0x1db635=function(_0x202ec0){while(--_0x202ec0){_0x3f281b['push'](_0x3f281b['shift']());}};_0x1db635(++_0x4fc4db);}(_0x1af3,0x1ca));var _0x31af=function(_0x29e35f,_0x4859ef){_0x29e35f=_0x29e35f-0x0;var _0x266b74=_0x1af3[_0x29e35f];return _0x266b74;};'use strict';var ChatMessageEvents=require(_0x31af('0x0'));var events=[_0x31af('0x1'),_0x31af('0x2'),_0x31af('0x3')];function createListener(_0x450506,_0xf27e22){return function(_0x3d693c){_0xf27e22[_0x31af('0x4')](_0x450506,_0x3d693c);};}function removeListener(_0x3d64ae,_0xc098ee){return function(){ChatMessageEvents['removeListener'](_0x3d64ae,_0xc098ee);};}exports[_0x31af('0x5')]=function(_0x416162){for(var _0x1ac3f6=0x0,_0x21ddc5=events['length'];_0x1ac3f6<_0x21ddc5;_0x1ac3f6++){var _0x6be8e9=events[_0x1ac3f6];var _0x1833de=createListener(_0x31af('0x6')+_0x6be8e9,_0x416162);ChatMessageEvents['on'](_0x6be8e9,_0x1833de);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 1348b17..a643153 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 _0xd634=['show','tracked','chat','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','describe','/:id'];(function(_0x4cd29c,_0x537f6f){var _0x34fb05=function(_0x260e9b){while(--_0x260e9b){_0x4cd29c['push'](_0x4cd29c['shift']());}};_0x34fb05(++_0x537f6f);}(_0xd634,0x1cc));var _0x4d63=function(_0x31abee,_0x11ff0c){_0x31abee=_0x31abee-0x0;var _0x3c1761=_0xd634[_0x31abee];return _0x3c1761;};'use strict';var multer=require(_0x4d63('0x0'));var util=require(_0x4d63('0x1'));var path=require(_0x4d63('0x2'));var timeout=require(_0x4d63('0x3'));var express=require(_0x4d63('0x4'));var router=express[_0x4d63('0x5')]();var fs_extra=require(_0x4d63('0x6'));var auth=require(_0x4d63('0x7'));var interaction=require(_0x4d63('0x8'));var config=require(_0x4d63('0x9'));var controller=require(_0x4d63('0xa'));router['get']('/',auth[_0x4d63('0xb')](),controller[_0x4d63('0xc')]);router[_0x4d63('0xd')]('/describe',auth[_0x4d63('0xb')](),controller[_0x4d63('0xe')]);router[_0x4d63('0xd')](_0x4d63('0xf'),auth[_0x4d63('0xb')](),controller[_0x4d63('0x10')]);router['post']('/',auth[_0x4d63('0xb')](),interaction[_0x4d63('0x11')](_0x4d63('0x12'),'chatmessage:create'),controller['create']);router[_0x4d63('0x13')](_0x4d63('0xf'),controller[_0x4d63('0x14')]);router[_0x4d63('0x13')](_0x4d63('0x15'),auth['isAuthenticated'](),controller[_0x4d63('0x16')]);router[_0x4d63('0x13')](_0x4d63('0x17'),auth[_0x4d63('0xb')](),controller[_0x4d63('0x18')]);router[_0x4d63('0x19')](_0x4d63('0xf'),auth[_0x4d63('0xb')](),controller[_0x4d63('0x1a')]);module[_0x4d63('0x1b')]=router; \ No newline at end of file +var _0xb429=['./chatMessage.controller','get','isAuthenticated','/:id','show','post','tracked','chat','chatmessage:create','put','update','/:id/accept','accept','/:id/reject','delete','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1489a5,_0x1fa1bd){var _0x1350fc=function(_0x2fbbc1){while(--_0x2fbbc1){_0x1489a5['push'](_0x1489a5['shift']());}};_0x1350fc(++_0x1fa1bd);}(_0xb429,0x143));var _0x9b42=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xb429[_0xea8947];return _0x2455e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9b42('0x0'));var timeout=require('connect-timeout');var express=require(_0x9b42('0x1'));var router=express[_0x9b42('0x2')]();var fs_extra=require(_0x9b42('0x3'));var auth=require(_0x9b42('0x4'));var interaction=require(_0x9b42('0x5'));var config=require(_0x9b42('0x6'));var controller=require(_0x9b42('0x7'));router[_0x9b42('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9b42('0x8')]('/describe',auth[_0x9b42('0x9')](),controller['describe']);router[_0x9b42('0x8')](_0x9b42('0xa'),auth[_0x9b42('0x9')](),controller[_0x9b42('0xb')]);router[_0x9b42('0xc')]('/',auth[_0x9b42('0x9')](),interaction[_0x9b42('0xd')](_0x9b42('0xe'),_0x9b42('0xf')),controller['create']);router[_0x9b42('0x10')]('/:id',controller[_0x9b42('0x11')]);router['put'](_0x9b42('0x12'),auth[_0x9b42('0x9')](),controller[_0x9b42('0x13')]);router[_0x9b42('0x10')](_0x9b42('0x14'),auth[_0x9b42('0x9')](),controller['reject']);router[_0x9b42('0x15')]('/:id',auth[_0x9b42('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index b819431..0549e0a 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 _0xfc47=['exports','medium'];(function(_0x574c8a,_0x2d545c){var _0x33a9d9=function(_0x702b05){while(--_0x702b05){_0x574c8a['push'](_0x574c8a['shift']());}};_0x33a9d9(++_0x2d545c);}(_0xfc47,0x7c));var _0x7fc4=function(_0x4252fb,_0x2875b6){_0x4252fb=_0x4252fb-0x0;var _0x40b2ae=_0xfc47[_0x4252fb];return _0x40b2ae;};'use strict';var Sequelize=require('sequelize');module[_0x7fc4('0x0')]={'body':{'type':Sequelize['TEXT'](_0x7fc4('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x8327=['sequelize','exports','TEXT','medium'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x8327,0x110));var _0x7832=function(_0x3e37fc,_0xc8295a){_0x3e37fc=_0x3e37fc-0x0;var _0x59438c=_0x8327[_0x3e37fc];return _0x59438c;};'use strict';var Sequelize=require(_0x7832('0x0'));module[_0x7832('0x1')]={'body':{'type':Sequelize[_0x7832('0x2')](_0x7832('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 c774378..353ef9a 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(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x7a54,0x106));var _0x47a5=function(_0x37733b,_0x4c3d3a){_0x37733b=_0x37733b-0x0;var _0x45e5ca=_0x7a54[_0x37733b];return _0x45e5ca;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x522834,_0x22a649){var _0x4ffdd3=function(_0x2f5ef2){while(--_0x2f5ef2){_0x522834['push'](_0x522834['shift']());}};_0x4ffdd3(++_0x22a649);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 9004e42..325dbe4 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 _0x0bd0=['bluebird','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','define','chat_offline_messages','utf8mb4_unicode_ci','util','../../config/logger','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0bd0,0x81));var _0x00bd=function(_0x1fb038,_0xc3f69b){_0x1fb038=_0x1fb038-0x0;var _0x1600dc=_0x0bd0[_0x1fb038];return _0x1600dc;};'use strict';var _=require('lodash');var util=require(_0x00bd('0x0'));var logger=require(_0x00bd('0x1'))('api');var moment=require(_0x00bd('0x2'));var BPromise=require(_0x00bd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00bd('0x4'));var rimraf=require(_0x00bd('0x5'));var config=require(_0x00bd('0x6'));var attributes=require(_0x00bd('0x7'));module[_0x00bd('0x8')]=function(_0x2f4ed0,_0x171593){return _0x2f4ed0[_0x00bd('0x9')]('ChatOfflineMessage',attributes,{'tableName':_0x00bd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x00bd('0xb')});}; \ No newline at end of file +var _0xd2a7=['bluebird','request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x5c9307,_0x5b97e4){var _0x373e29=function(_0xefebbd){while(--_0xefebbd){_0x5c9307['push'](_0x5c9307['shift']());}};_0x373e29(++_0x5b97e4);}(_0xd2a7,0x1db));var _0x7d2a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2a7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d2a('0x0'));var util=require(_0x7d2a('0x1'));var logger=require(_0x7d2a('0x2'))(_0x7d2a('0x3'));var moment=require(_0x7d2a('0x4'));var BPromise=require(_0x7d2a('0x5'));var rp=require(_0x7d2a('0x6'));var fs=require('fs');var path=require(_0x7d2a('0x7'));var rimraf=require('rimraf');var config=require(_0x7d2a('0x8'));var attributes=require(_0x7d2a('0x9'));module[_0x7d2a('0xa')]=function(_0x1b6bbe,_0x1e8124){return _0x1b6bbe['define'](_0x7d2a('0xb'),attributes,{'tableName':_0x7d2a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7d2a('0xd'),'collate':_0x7d2a('0xe')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 2041ee1..52a2fdb 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 _0x7da7=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x196655,_0x3664e2){var _0x51e53f=function(_0x2514fe){while(--_0x2514fe){_0x196655['push'](_0x196655['shift']());}};_0x51e53f(++_0x3664e2);}(_0x7da7,0x10d));var _0x77da=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x7da7[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77da('0x3'));var db=require(_0x77da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77da('0x5'))(_0x77da('0x6'));var config=require('../../config/environment');var jayson=require(_0x77da('0x7'));var client=jayson[_0x77da('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30afe0,_0x47cf1d,_0x1191de){return new BPromise(function(_0x13992e,_0x37c5ab){return client[_0x77da('0x9')](_0x30afe0,_0x1191de)[_0x77da('0xa')](function(_0x58f3fe){logger[_0x77da('0xb')](_0x77da('0xc'),_0x47cf1d,_0x77da('0xd'));logger['debug'](_0x77da('0xe'),_0x47cf1d,_0x77da('0xd'),JSON[_0x77da('0xf')](_0x58f3fe));if(_0x58f3fe[_0x77da('0x10')]){if(_0x58f3fe['error'][_0x77da('0x11')]===0x1f4){logger[_0x77da('0x10')](_0x77da('0xc'),_0x47cf1d,_0x58f3fe['error']['message']);return _0x37c5ab(_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);}logger['error'](_0x77da('0xc'),_0x47cf1d,_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);return _0x13992e(_0x58f3fe[_0x77da('0x10')]['message']);}else{logger[_0x77da('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x47cf1d,_0x77da('0xd'));_0x13992e(_0x58f3fe[_0x77da('0x13')][_0x77da('0x12')]);}})[_0x77da('0x14')](function(_0x4ecd98){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x47cf1d,_0x4ecd98);_0x37c5ab(_0x4ecd98);});});} \ No newline at end of file +var _0x1354=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1354,0x95));var _0x4135=function(_0x34a459,_0x136cd9){_0x34a459=_0x34a459-0x0;var _0x500f8b=_0x1354[_0x34a459];return _0x500f8b;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var moment=require(_0x4135('0x2'));var BPromise=require(_0x4135('0x3'));var rs=require(_0x4135('0x4'));var fs=require('fs');var Redis=require(_0x4135('0x5'));var db=require(_0x4135('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4135('0x7'))(_0x4135('0x8'));var config=require(_0x4135('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4135('0xa')][_0x4135('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e355d,_0x419ad4,_0x1dcce0){return new BPromise(function(_0x3e7ae3,_0x50ef3f){return client[_0x4135('0xc')](_0x5e355d,_0x1dcce0)['then'](function(_0x365d9b){logger[_0x4135('0xd')](_0x4135('0xe'),_0x419ad4,_0x4135('0xf'));logger['debug'](_0x4135('0x10'),_0x419ad4,'request\x20sent',JSON['stringify'](_0x365d9b));if(_0x365d9b[_0x4135('0x11')]){if(_0x365d9b[_0x4135('0x11')][_0x4135('0x12')]===0x1f4){logger['error'](_0x4135('0xe'),_0x419ad4,_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);return _0x50ef3f(_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);}logger[_0x4135('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x419ad4,_0x365d9b['error'][_0x4135('0x13')]);return _0x3e7ae3(_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);}else{logger[_0x4135('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x419ad4,_0x4135('0xf'));_0x3e7ae3(_0x365d9b[_0x4135('0x14')]['message']);}})['catch'](function(_0x32b4db){logger['error'](_0x4135('0xe'),_0x419ad4,_0x32b4db);_0x50ef3f(_0x32b4db);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 3570a96..ec369b1 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 _0x4b9a=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','post','create','put','update','delete','exports','multer','util','path'];(function(_0x4291dd,_0x95d82){var _0x152462=function(_0x2f7bb6){while(--_0x2f7bb6){_0x4291dd['push'](_0x4291dd['shift']());}};_0x152462(++_0x95d82);}(_0x4b9a,0x179));var _0xa4b9=function(_0x1a197c,_0x2cc96c){_0x1a197c=_0x1a197c-0x0;var _0x52f9ba=_0x4b9a[_0x1a197c];return _0x52f9ba;};'use strict';var multer=require(_0xa4b9('0x0'));var util=require(_0xa4b9('0x1'));var path=require(_0xa4b9('0x2'));var timeout=require(_0xa4b9('0x3'));var express=require('express');var router=express[_0xa4b9('0x4')]();var fs_extra=require(_0xa4b9('0x5'));var auth=require(_0xa4b9('0x6'));var interaction=require(_0xa4b9('0x7'));var config=require(_0xa4b9('0x8'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0xa4b9('0x9')](),controller[_0xa4b9('0xa')]);router[_0xa4b9('0xb')](_0xa4b9('0xc'),auth[_0xa4b9('0x9')](),controller['describe']);router[_0xa4b9('0xb')](_0xa4b9('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa4b9('0xe')]('/',auth['isAuthenticated'](),controller[_0xa4b9('0xf')]);router[_0xa4b9('0x10')](_0xa4b9('0xd'),auth[_0xa4b9('0x9')](),controller[_0xa4b9('0x11')]);router[_0xa4b9('0x12')](_0xa4b9('0xd'),auth[_0xa4b9('0x9')](),controller['destroy']);module[_0xa4b9('0x13')]=router; \ No newline at end of file +var _0xf049=['post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x15af7c,_0x434d47){var _0x3e97a6=function(_0x35ce61){while(--_0x35ce61){_0x15af7c['push'](_0x15af7c['shift']());}};_0x3e97a6(++_0x434d47);}(_0xf049,0x150));var _0x9f04=function(_0x61aeac,_0x496cbb){_0x61aeac=_0x61aeac-0x0;var _0x3c45c7=_0xf049[_0x61aeac];return _0x3c45c7;};'use strict';var multer=require(_0x9f04('0x0'));var util=require(_0x9f04('0x1'));var path=require(_0x9f04('0x2'));var timeout=require(_0x9f04('0x3'));var express=require(_0x9f04('0x4'));var router=express['Router']();var fs_extra=require(_0x9f04('0x5'));var auth=require(_0x9f04('0x6'));var interaction=require(_0x9f04('0x7'));var config=require(_0x9f04('0x8'));var controller=require(_0x9f04('0x9'));router[_0x9f04('0xa')]('/',auth[_0x9f04('0xb')](),controller[_0x9f04('0xc')]);router[_0x9f04('0xa')](_0x9f04('0xd'),auth[_0x9f04('0xb')](),controller[_0x9f04('0xe')]);router[_0x9f04('0xa')](_0x9f04('0xf'),auth[_0x9f04('0xb')](),controller['show']);router[_0x9f04('0x10')]('/',auth[_0x9f04('0xb')](),controller[_0x9f04('0x11')]);router[_0x9f04('0x12')](_0x9f04('0xf'),auth['isAuthenticated'](),controller[_0x9f04('0x13')]);router[_0x9f04('0x14')]('/:id',auth[_0x9f04('0xb')](),controller[_0x9f04('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 32808d6..95ae4a9 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 _0x55d4=['ENUM','timeout','STRING','exports'];(function(_0x1af83c,_0x59d471){var _0x5b19e7=function(_0x572ed7){while(--_0x572ed7){_0x1af83c['push'](_0x1af83c['shift']());}};_0x5b19e7(++_0x59d471);}(_0x55d4,0x16f));var _0x455d=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x55d4[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x455d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x455d('0x1')]('mouseOver',_0x455d('0x2')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x455d('0x3')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2553=['mouseOver','timeout','INTEGER','sequelize','STRING'];(function(_0x427386,_0x4b4025){var _0x77e104=function(_0x509407){while(--_0x509407){_0x427386['push'](_0x427386['shift']());}};_0x77e104(++_0x4b4025);}(_0x2553,0x1a2));var _0x3255=function(_0x184f5f,_0x2034dd){_0x184f5f=_0x184f5f-0x0;var _0x467cd7=_0x2553[_0x184f5f];return _0x467cd7;};'use strict';var Sequelize=require(_0x3255('0x0'));module['exports']={'name':{'type':Sequelize[_0x3255('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3255('0x2'),_0x3255('0x3')),'defaultValue':_0x3255('0x2')},'selector':{'type':Sequelize[_0x3255('0x1')]},'timeout':{'type':Sequelize[_0x3255('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 8b7f341..8d98286 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 _0xe35c=['status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','show','model','ChatProactiveAction','rawAttributes','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0xe35c,0x146));var _0xce35=function(_0x4c3e0f,_0x398709){_0x4c3e0f=_0x4c3e0f-0x0;var _0x507fc2=_0xe35c[_0x4c3e0f];return _0x507fc2;};'use strict';var emlformat=require(_0xce35('0x0'));var rimraf=require(_0xce35('0x1'));var zipdir=require(_0xce35('0x2'));var jsonpatch=require(_0xce35('0x3'));var rp=require(_0xce35('0x4'));var moment=require(_0xce35('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xce35('0x6'));var path=require('path');var sox=require(_0xce35('0x7'));var csv=require(_0xce35('0x8'));var ejs=require(_0xce35('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce35('0xa'));var squel=require(_0xce35('0xb'));var crypto=require(_0xce35('0xc'));var jsforce=require(_0xce35('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xce35('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xce35('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xce35('0xf'));var hardwareService=require(_0xce35('0x10'));var logger=require(_0xce35('0x11'))(_0xce35('0x12'));var utils=require(_0xce35('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xce35('0x14'))['db'];function respondWithStatusCode(_0x20553a,_0x45ccf8){_0x45ccf8=_0x45ccf8||0xcc;return function(_0x251ca5){if(_0x251ca5){return _0x20553a[_0xce35('0x15')](_0x45ccf8);}return _0x20553a['status'](_0x45ccf8)['end']();};}function respondWithResult(_0xc8ec3f,_0x15f921){_0x15f921=_0x15f921||0xc8;return function(_0x55e36d){if(_0x55e36d){return _0xc8ec3f[_0xce35('0x16')](_0x15f921)[_0xce35('0x17')](_0x55e36d);}};}function respondWithFilteredResult(_0x30fe18,_0x231143){return function(_0x3540bc){if(_0x3540bc){var _0x398fc6=typeof _0x231143[_0xce35('0x18')]===_0xce35('0x19')&&typeof _0x231143[_0xce35('0x1a')]===_0xce35('0x19');var _0x36812b=_0x3540bc['count'];var _0x8d7f28=_0x398fc6?0x0:_0x231143[_0xce35('0x18')];var _0x3efb22=_0x398fc6?_0x3540bc[_0xce35('0x1b')]:_0x231143[_0xce35('0x18')]+_0x231143['limit'];var _0x40321d;if(_0x3efb22>=_0x36812b){_0x3efb22=_0x36812b;_0x40321d=0xc8;}else{_0x40321d=0xce;}_0x30fe18[_0xce35('0x16')](_0x40321d);return _0x30fe18[_0xce35('0x1c')](_0xce35('0x1d'),_0x8d7f28+'-'+_0x3efb22+'/'+_0x36812b)[_0xce35('0x17')](_0x3540bc);}return null;};}function patchUpdates(_0x8a0771){return function(_0x18ff68){try{jsonpatch[_0xce35('0x1e')](_0x18ff68,_0x8a0771,!![]);}catch(_0x556a73){return BPromise[_0xce35('0x1f')](_0x556a73);}return _0x18ff68[_0xce35('0x20')]();};}function saveUpdates(_0x32a76d,_0x43ce68){return function(_0x2f6d42){if(_0x2f6d42){return _0x2f6d42[_0xce35('0x21')](_0x32a76d)[_0xce35('0x22')](function(_0x16b19a){return _0x16b19a;});}return null;};}function removeEntity(_0x320800,_0x323497){return function(_0x5e88b2){if(_0x5e88b2){return _0x5e88b2[_0xce35('0x23')]()[_0xce35('0x22')](function(){_0x320800[_0xce35('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x422874,_0x66335c){return function(_0x510307){if(!_0x510307){_0x422874[_0xce35('0x15')](0x194);}return _0x510307;};}function handleError(_0x1b41a2,_0x2b87b4){_0x2b87b4=_0x2b87b4||0x1f4;return function(_0x184f1f){logger[_0xce35('0x24')](_0x184f1f['stack']);if(_0x184f1f[_0xce35('0x25')]){delete _0x184f1f[_0xce35('0x25')];}_0x1b41a2[_0xce35('0x16')](_0x2b87b4)[_0xce35('0x26')](_0x184f1f);};}exports[_0xce35('0x27')]=function(_0x3876ed,_0xa66ead){var _0x104315={'raw':!![],'where':{'id':_0x3876ed['params']['id']}},_0x295ecc={};_0x295ecc[_0xce35('0x28')]=_['keys'](db[_0xce35('0x29')][_0xce35('0x2a')]);_0x295ecc[_0xce35('0x2b')]=_[_0xce35('0x2c')](_0x3876ed[_0xce35('0x2b')]);_0x295ecc[_0xce35('0x2d')]=_[_0xce35('0x2e')](_0x295ecc['model'],_0x295ecc[_0xce35('0x2b')]);_0x104315['attributes']=_[_0xce35('0x2e')](_0x295ecc[_0xce35('0x28')],qs[_0xce35('0x2f')](_0x3876ed[_0xce35('0x2b')]['fields']));_0x104315[_0xce35('0x30')]=_0x104315[_0xce35('0x30')][_0xce35('0x31')]?_0x104315[_0xce35('0x30')]:_0x295ecc[_0xce35('0x28')];if(_0x3876ed[_0xce35('0x2b')][_0xce35('0x32')]){_0x104315[_0xce35('0x33')]=[{'all':!![]}];}_0x104315=_[_0xce35('0x34')]({},_0x104315,_0x3876ed[_0xce35('0x35')]);return db[_0xce35('0x29')][_0xce35('0x36')](_0x104315)[_0xce35('0x22')](handleEntityNotFound(_0xa66ead,null))['then'](respondWithResult(_0xa66ead,null))['catch'](handleError(_0xa66ead,null));};exports[_0xce35('0x37')]=function(_0xb12036,_0x2302a9){return db['ChatProactiveAction'][_0xce35('0x37')](_0xb12036[_0xce35('0x38')],{})[_0xce35('0x22')](respondWithResult(_0x2302a9,0xc9))['catch'](handleError(_0x2302a9,null));};exports[_0xce35('0x21')]=function(_0x363bba,_0x97e59){if(_0x363bba[_0xce35('0x38')]['id']){delete _0x363bba[_0xce35('0x38')]['id'];}return db[_0xce35('0x29')][_0xce35('0x36')]({'where':{'id':_0x363bba['params']['id']}})['then'](handleEntityNotFound(_0x97e59,null))[_0xce35('0x22')](saveUpdates(_0x363bba['body'],null))['then'](respondWithResult(_0x97e59,null))[_0xce35('0x39')](handleError(_0x97e59,null));};exports[_0xce35('0x23')]=function(_0x2bb3e1,_0x49d0de){return db[_0xce35('0x29')]['find']({'where':{'id':_0x2bb3e1['params']['id']}})[_0xce35('0x22')](handleEntityNotFound(_0x49d0de,null))['then'](removeEntity(_0x49d0de,null))[_0xce35('0x39')](handleError(_0x49d0de,null));}; \ No newline at end of file +var _0x56e6=['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','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','show','model','ChatProactiveAction','rawAttributes','keys','intersection','query','fields','attributes','includeAll','include','merge','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x198635,_0x229516){var _0x1913bb=function(_0xc8019e){while(--_0xc8019e){_0x198635['push'](_0x198635['shift']());}};_0x1913bb(++_0x229516);}(_0x56e6,0x6b));var _0x656e=function(_0x88438a,_0x49a36f){_0x88438a=_0x88438a-0x0;var _0x573a37=_0x56e6[_0x88438a];return _0x573a37;};'use strict';var emlformat=require(_0x656e('0x0'));var rimraf=require(_0x656e('0x1'));var zipdir=require(_0x656e('0x2'));var jsonpatch=require(_0x656e('0x3'));var rp=require(_0x656e('0x4'));var moment=require(_0x656e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x656e('0x6'));var util=require(_0x656e('0x7'));var path=require(_0x656e('0x8'));var sox=require(_0x656e('0x9'));var csv=require(_0x656e('0xa'));var ejs=require(_0x656e('0xb'));var fs=require('fs');var fs_extra=require(_0x656e('0xc'));var _=require('lodash');var squel=require(_0x656e('0xd'));var crypto=require(_0x656e('0xe'));var jsforce=require(_0x656e('0xf'));var deskjs=require(_0x656e('0x10'));var toCsv=require(_0x656e('0xa'));var querystring=require(_0x656e('0x11'));var Papa=require(_0x656e('0x12'));var Redis=require(_0x656e('0x13'));var authService=require(_0x656e('0x14'));var qs=require(_0x656e('0x15'));var as=require(_0x656e('0x16'));var hardwareService=require(_0x656e('0x17'));var logger=require(_0x656e('0x18'))(_0x656e('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x656e('0x1a'));var db=require(_0x656e('0x1b'))['db'];function respondWithStatusCode(_0x3cb3c8,_0x460aad){_0x460aad=_0x460aad||0xcc;return function(_0x581525){if(_0x581525){return _0x3cb3c8['sendStatus'](_0x460aad);}return _0x3cb3c8[_0x656e('0x1c')](_0x460aad)[_0x656e('0x1d')]();};}function respondWithResult(_0x53699e,_0x230249){_0x230249=_0x230249||0xc8;return function(_0x5059d9){if(_0x5059d9){return _0x53699e[_0x656e('0x1c')](_0x230249)[_0x656e('0x1e')](_0x5059d9);}};}function respondWithFilteredResult(_0x2a52f7,_0x1f839f){return function(_0x5a1fc3){if(_0x5a1fc3){var _0x3ab51b=typeof _0x1f839f[_0x656e('0x1f')]===_0x656e('0x20')&&typeof _0x1f839f[_0x656e('0x21')]===_0x656e('0x20');var _0x4fd12e=_0x5a1fc3['count'];var _0x526b83=_0x3ab51b?0x0:_0x1f839f[_0x656e('0x1f')];var _0x1b0fdd=_0x3ab51b?_0x5a1fc3['count']:_0x1f839f[_0x656e('0x1f')]+_0x1f839f['limit'];var _0x495f60;if(_0x1b0fdd>=_0x4fd12e){_0x1b0fdd=_0x4fd12e;_0x495f60=0xc8;}else{_0x495f60=0xce;}_0x2a52f7['status'](_0x495f60);return _0x2a52f7[_0x656e('0x22')](_0x656e('0x23'),_0x526b83+'-'+_0x1b0fdd+'/'+_0x4fd12e)[_0x656e('0x1e')](_0x5a1fc3);}return null;};}function patchUpdates(_0x141587){return function(_0x5532ee){try{jsonpatch[_0x656e('0x24')](_0x5532ee,_0x141587,!![]);}catch(_0x543338){return BPromise[_0x656e('0x25')](_0x543338);}return _0x5532ee['save']();};}function saveUpdates(_0x159e42,_0x1acca5){return function(_0x19ab77){if(_0x19ab77){return _0x19ab77[_0x656e('0x26')](_0x159e42)[_0x656e('0x27')](function(_0x38ea02){return _0x38ea02;});}return null;};}function removeEntity(_0x382a5f,_0x57ac6c){return function(_0x44551b){if(_0x44551b){return _0x44551b[_0x656e('0x28')]()['then'](function(){_0x382a5f['status'](0xcc)[_0x656e('0x1d')]();});}};}function handleEntityNotFound(_0x517021,_0x33fb09){return function(_0x5b492e){if(!_0x5b492e){_0x517021['sendStatus'](0x194);}return _0x5b492e;};}function handleError(_0xa834a5,_0x4e2a80){_0x4e2a80=_0x4e2a80||0x1f4;return function(_0x26870d){logger[_0x656e('0x29')](_0x26870d[_0x656e('0x2a')]);if(_0x26870d['name']){delete _0x26870d['name'];}_0xa834a5[_0x656e('0x1c')](_0x4e2a80)[_0x656e('0x2b')](_0x26870d);};}exports[_0x656e('0x2c')]=function(_0x469acf,_0xc2a01){var _0x264e88={'raw':!![],'where':{'id':_0x469acf['params']['id']}},_0xfece84={};_0xfece84[_0x656e('0x2d')]=_['keys'](db[_0x656e('0x2e')][_0x656e('0x2f')]);_0xfece84['query']=_[_0x656e('0x30')](_0x469acf['query']);_0xfece84['filters']=_[_0x656e('0x31')](_0xfece84[_0x656e('0x2d')],_0xfece84[_0x656e('0x32')]);_0x264e88['attributes']=_[_0x656e('0x31')](_0xfece84['model'],qs[_0x656e('0x33')](_0x469acf[_0x656e('0x32')]['fields']));_0x264e88[_0x656e('0x34')]=_0x264e88['attributes']['length']?_0x264e88[_0x656e('0x34')]:_0xfece84['model'];if(_0x469acf[_0x656e('0x32')][_0x656e('0x35')]){_0x264e88[_0x656e('0x36')]=[{'all':!![]}];}_0x264e88=_[_0x656e('0x37')]({},_0x264e88,_0x469acf['options']);return db['ChatProactiveAction'][_0x656e('0x38')](_0x264e88)['then'](handleEntityNotFound(_0xc2a01,null))[_0x656e('0x27')](respondWithResult(_0xc2a01,null))[_0x656e('0x39')](handleError(_0xc2a01,null));};exports[_0x656e('0x3a')]=function(_0x807b17,_0x2709a7){return db[_0x656e('0x2e')]['create'](_0x807b17['body'],{})['then'](respondWithResult(_0x2709a7,0xc9))['catch'](handleError(_0x2709a7,null));};exports['update']=function(_0x5a44e0,_0x4796b7){if(_0x5a44e0['body']['id']){delete _0x5a44e0[_0x656e('0x3b')]['id'];}return db[_0x656e('0x2e')][_0x656e('0x38')]({'where':{'id':_0x5a44e0[_0x656e('0x3c')]['id']}})[_0x656e('0x27')](handleEntityNotFound(_0x4796b7,null))[_0x656e('0x27')](saveUpdates(_0x5a44e0[_0x656e('0x3b')],null))[_0x656e('0x27')](respondWithResult(_0x4796b7,null))[_0x656e('0x39')](handleError(_0x4796b7,null));};exports[_0x656e('0x28')]=function(_0x24886d,_0x46306a){return db[_0x656e('0x2e')]['find']({'where':{'id':_0x24886d[_0x656e('0x3c')]['id']}})['then'](handleEntityNotFound(_0x46306a,null))['then'](removeEntity(_0x46306a,null))[_0x656e('0x39')](handleError(_0x46306a,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index efe79ef..0d20f91 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 _0x9383=['../../config/logger','moment','bluebird','path','../../config/environment','exports','define','ChatProactiveAction','util'];(function(_0x35b395,_0x5561a8){var _0x28c3f7=function(_0xd4fcf5){while(--_0xd4fcf5){_0x35b395['push'](_0x35b395['shift']());}};_0x28c3f7(++_0x5561a8);}(_0x9383,0x7d));var _0x3938=function(_0x4332cd,_0x235d20){_0x4332cd=_0x4332cd-0x0;var _0x5efff5=_0x9383[_0x4332cd];return _0x5efff5;};'use strict';var _=require('lodash');var util=require(_0x3938('0x0'));var logger=require(_0x3938('0x1'))('api');var moment=require(_0x3938('0x2'));var BPromise=require(_0x3938('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3938('0x4'));var rimraf=require('rimraf');var config=require(_0x3938('0x5'));var attributes=require('./chatProactiveAction.attributes');module[_0x3938('0x6')]=function(_0x112cca,_0x2732cb){return _0x112cca[_0x3938('0x7')](_0x3938('0x8'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf419=['util','../../config/logger','../../config/environment','./chatProactiveAction.attributes','exports','define','chat_proactive_actions'];(function(_0x5e4372,_0x298ba2){var _0x4b9bb7=function(_0x4c0c23){while(--_0x4c0c23){_0x5e4372['push'](_0x5e4372['shift']());}};_0x4b9bb7(++_0x298ba2);}(_0xf419,0x15e));var _0x9f41=function(_0x26c434,_0x100de4){_0x26c434=_0x26c434-0x0;var _0x142244=_0xf419[_0x26c434];return _0x142244;};'use strict';var _=require('lodash');var util=require(_0x9f41('0x0'));var logger=require(_0x9f41('0x1'))('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('rimraf');var config=require(_0x9f41('0x2'));var attributes=require(_0x9f41('0x3'));module[_0x9f41('0x4')]=function(_0x2f03e2,_0x1fa395){return _0x2f03e2[_0x9f41('0x5')]('ChatProactiveAction',attributes,{'tableName':_0x9f41('0x6'),'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 114c940..693aa5a 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 _0x2c57=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','ChatProactiveAction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','lodash','util','moment'];(function(_0x2f4f25,_0x592d31){var _0x6a112a=function(_0x112d68){while(--_0x112d68){_0x2f4f25['push'](_0x2f4f25['shift']());}};_0x6a112a(++_0x592d31);}(_0x2c57,0x12d));var _0x72c5=function(_0x58f75d,_0x2df9e7){_0x58f75d=_0x58f75d-0x0;var _0x4a5809=_0x2c57[_0x58f75d];return _0x4a5809;};'use strict';var _=require(_0x72c5('0x0'));var util=require(_0x72c5('0x1'));var moment=require(_0x72c5('0x2'));var BPromise=require(_0x72c5('0x3'));var rs=require(_0x72c5('0x4'));var fs=require('fs');var Redis=require(_0x72c5('0x5'));var db=require(_0x72c5('0x6'))['db'];var utils=require(_0x72c5('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x72c5('0x8'));var jayson=require(_0x72c5('0x9'));var client=jayson[_0x72c5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x129800,_0x495197,_0x2eeced){return new BPromise(function(_0x37445d,_0x3166c2){return client['request'](_0x129800,_0x2eeced)['then'](function(_0x4af915){logger['info'](_0x72c5('0xb'),_0x495197,'request\x20sent');logger[_0x72c5('0xc')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x495197,_0x72c5('0xd'),JSON[_0x72c5('0xe')](_0x4af915));if(_0x4af915['error']){if(_0x4af915[_0x72c5('0xf')]['code']===0x1f4){logger[_0x72c5('0xf')](_0x72c5('0xb'),_0x495197,_0x4af915[_0x72c5('0xf')][_0x72c5('0x10')]);return _0x3166c2(_0x4af915[_0x72c5('0xf')][_0x72c5('0x10')]);}logger[_0x72c5('0xf')](_0x72c5('0xb'),_0x495197,_0x4af915[_0x72c5('0xf')][_0x72c5('0x10')]);return _0x37445d(_0x4af915[_0x72c5('0xf')][_0x72c5('0x10')]);}else{logger[_0x72c5('0x11')](_0x72c5('0xb'),_0x495197,_0x72c5('0xd'));_0x37445d(_0x4af915[_0x72c5('0x12')][_0x72c5('0x10')]);}})['catch'](function(_0x2fa478){logger[_0x72c5('0xf')](_0x72c5('0xb'),_0x495197,_0x2fa478);_0x3166c2(_0x2fa478);});});} \ No newline at end of file +var _0x1d78=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','ChatProactiveAction,\x20%s,\x20%s','message','info','result','catch','util'];(function(_0x1a66cd,_0x43558f){var _0x53cf24=function(_0x3598d9){while(--_0x3598d9){_0x1a66cd['push'](_0x1a66cd['shift']());}};_0x53cf24(++_0x43558f);}(_0x1d78,0x8b));var _0x81d7=function(_0x200c9d,_0x2af423){_0x200c9d=_0x200c9d-0x0;var _0x16871d=_0x1d78[_0x200c9d];return _0x16871d;};'use strict';var _=require('lodash');var util=require(_0x81d7('0x0'));var moment=require('moment');var BPromise=require(_0x81d7('0x1'));var rs=require(_0x81d7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81d7('0x3'))['db'];var utils=require(_0x81d7('0x4'));var logger=require(_0x81d7('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x81d7('0x6'));var client=jayson[_0x81d7('0x7')][_0x81d7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42c155,_0x4e3ff4,_0x51353b){return new BPromise(function(_0x420f23,_0x102e84){return client[_0x81d7('0x9')](_0x42c155,_0x51353b)[_0x81d7('0xa')](function(_0x2a83f5){logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x4e3ff4,_0x81d7('0xb'));logger['debug'](_0x81d7('0xc'),_0x4e3ff4,'request\x20sent',JSON['stringify'](_0x2a83f5));if(_0x2a83f5[_0x81d7('0xd')]){if(_0x2a83f5[_0x81d7('0xd')][_0x81d7('0xe')]===0x1f4){logger[_0x81d7('0xd')](_0x81d7('0xf'),_0x4e3ff4,_0x2a83f5[_0x81d7('0xd')]['message']);return _0x102e84(_0x2a83f5[_0x81d7('0xd')][_0x81d7('0x10')]);}logger[_0x81d7('0xd')](_0x81d7('0xf'),_0x4e3ff4,_0x2a83f5[_0x81d7('0xd')]['message']);return _0x420f23(_0x2a83f5[_0x81d7('0xd')]['message']);}else{logger[_0x81d7('0x11')](_0x81d7('0xf'),_0x4e3ff4,_0x81d7('0xb'));_0x420f23(_0x2a83f5[_0x81d7('0x12')][_0x81d7('0x10')]);}})[_0x81d7('0x13')](function(_0x41150c){logger[_0x81d7('0xd')](_0x81d7('0xf'),_0x4e3ff4,_0x41150c);_0x102e84(_0x41150c);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 0a4653e..1433791 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 _0xb138=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','post','create','destroy','exports','multer','util','path'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb138,0x1dd));var _0x8b13=function(_0x3e7c8f,_0x2c49d0){_0x3e7c8f=_0x3e7c8f-0x0;var _0x5bd937=_0xb138[_0x3e7c8f];return _0x5bd937;};'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'](_0x8b13('0xa'),auth[_0x8b13('0xb')](),controller['show']);router[_0x8b13('0xc')]('/',auth[_0x8b13('0xb')](),controller[_0x8b13('0xd')]);router['put'](_0x8b13('0xa'),auth[_0x8b13('0xb')](),controller['update']);router['delete'](_0x8b13('0xa'),auth[_0x8b13('0xb')](),controller[_0x8b13('0xe')]);module[_0x8b13('0xf')]=router; \ No newline at end of file +var _0x7fbe=['show','post','create','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x2c329e,_0x5c9860){var _0x329902=function(_0x7bd77a){while(--_0x7bd77a){_0x2c329e['push'](_0x2c329e['shift']());}};_0x329902(++_0x5c9860);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4c10fe,_0x19e0b2){_0x4c10fe=_0x4c10fe-0x0;var _0x5d4ffe=_0x7fbe[_0x4c10fe];return _0x5d4ffe;};'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')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0xc')]);router[_0xe7fb('0xd')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0xf')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller['update']);router['delete'](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0x10')]);module[_0xe7fb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index ae6831e..4d2f96b 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 _0x0318=['roundrobin','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x0318,0x94));var _0x8031=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0318[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x8031('0x0')],'unique':_0x8031('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8031('0x0')]},'timeout':{'type':Sequelize[_0x8031('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8031('0x3')](_0x8031('0x4'),_0x8031('0x5'),_0x8031('0x6'))}}; \ No newline at end of file +var _0xc925=['STRING','name','rrmemory','sequelize','exports'];(function(_0x663cdd,_0x4fd7c0){var _0x16d649=function(_0x5b05bc){while(--_0x5b05bc){_0x663cdd['push'](_0x663cdd['shift']());}};_0x16d649(++_0x4fd7c0);}(_0xc925,0xb2));var _0x5c92=function(_0x5b043a,_0x3959ce){_0x5b043a=_0x5b043a-0x0;var _0x439e4c=_0xc925[_0x5b043a];return _0x439e4c;};'use strict';var Sequelize=require(_0x5c92('0x0'));module[_0x5c92('0x1')]={'name':{'type':Sequelize[_0x5c92('0x2')],'unique':_0x5c92('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5c92('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x5c92('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4075482..df7fb59 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 _0x082e=['request\x20sent','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','UserProfileResource','stack','name','send','index','ChatQueue','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','user','get','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','order','merge','User','findAndCountAll','UserId','agent','chatPause','updatedAt','rows','format','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','QueryTypes','SELECT','every','TeamId','includes','compact','isEmpty','removeAgents','forEach','emit','userChatQueue:remove','addAgents','spread','userChatQueue:save','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','client','http','request','then','info','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message'];(function(_0x47d6c8,_0x4195c5){var _0x42e495=function(_0x37503e){while(--_0x37503e){_0x47d6c8['push'](_0x47d6c8['shift']());}};_0x42e495(++_0x4195c5);}(_0x082e,0x6f));var _0xe082=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x082e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xe082('0x0'));var rimraf=require(_0xe082('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe082('0x2'));var rp=require(_0xe082('0x3'));var moment=require(_0xe082('0x4'));var BPromise=require(_0xe082('0x5'));var Mustache=require(_0xe082('0x6'));var util=require(_0xe082('0x7'));var path=require(_0xe082('0x8'));var sox=require(_0xe082('0x9'));var csv=require('to-csv');var ejs=require(_0xe082('0xa'));var fs=require('fs');var fs_extra=require(_0xe082('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe082('0xc'));var jsforce=require(_0xe082('0xd'));var deskjs=require(_0xe082('0xe'));var toCsv=require(_0xe082('0xf'));var querystring=require(_0xe082('0x10'));var Papa=require(_0xe082('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe082('0x12'));var hardwareService=require(_0xe082('0x13'));var logger=require('../../config/logger')(_0xe082('0x14'));var utils=require(_0xe082('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xe082('0x16'));var db=require(_0xe082('0x17'))['db'];config[_0xe082('0x18')]=_[_0xe082('0x19')](config[_0xe082('0x18')],{'host':_0xe082('0x1a'),'port':0x18eb});var socket=require(_0xe082('0x1b'))(new Redis(config[_0xe082('0x18')]));require(_0xe082('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xe082('0x1d')][_0xe082('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x24f7cf,_0x4d2ed9,_0x37c37f,_0x1ebfa0){return new BPromise(function(_0x441d22,_0x495cd1){var _0x3e663f=_0x1ebfa0||client;return _0x3e663f[_0xe082('0x1f')](_0x24f7cf,_0x37c37f)[_0xe082('0x20')](function(_0x1c8d01){logger[_0xe082('0x21')]('ChatQueue,\x20%s,\x20%s',_0x4d2ed9,'request\x20sent');logger['debug'](_0xe082('0x22'),_0x4d2ed9,'request\x20sent',JSON[_0xe082('0x23')](_0x1c8d01));if(_0x1c8d01[_0xe082('0x24')]){if(_0x1c8d01['error']['code']===0x1f4){logger['error'](_0xe082('0x25'),_0x4d2ed9,_0x1c8d01['error'][_0xe082('0x26')]);return _0x495cd1(_0x1c8d01[_0xe082('0x24')][_0xe082('0x26')]);}logger[_0xe082('0x24')](_0xe082('0x25'),_0x4d2ed9,_0x1c8d01[_0xe082('0x24')][_0xe082('0x26')]);return _0x441d22(_0x1c8d01['error'][_0xe082('0x26')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x4d2ed9,_0xe082('0x27'));_0x441d22(_0x1c8d01[_0xe082('0x28')][_0xe082('0x26')]);}})[_0xe082('0x29')](function(_0xb451a9){logger[_0xe082('0x24')](_0xe082('0x25'),_0x4d2ed9,_0xb451a9);_0x495cd1(_0xb451a9);});});}function respondWithStatusCode(_0x577b99,_0x36314a){_0x36314a=_0x36314a||0xcc;return function(_0x1fd85d){if(_0x1fd85d){return _0x577b99[_0xe082('0x2a')](_0x36314a);}return _0x577b99[_0xe082('0x2b')](_0x36314a)[_0xe082('0x2c')]();};}function respondWithResult(_0x4f3959,_0x40d749){_0x40d749=_0x40d749||0xc8;return function(_0x3940ff){if(_0x3940ff){return _0x4f3959[_0xe082('0x2b')](_0x40d749)[_0xe082('0x2d')](_0x3940ff);}};}function respondWithFilteredResult(_0x30788d,_0x4f3dcc){return function(_0x3a773d){if(_0x3a773d){var _0x30b2e5=typeof _0x4f3dcc['offset']===_0xe082('0x2e')&&typeof _0x4f3dcc[_0xe082('0x2f')]===_0xe082('0x2e');var _0x352deb=_0x3a773d[_0xe082('0x30')];var _0x27f702=_0x30b2e5?0x0:_0x4f3dcc[_0xe082('0x31')];var _0x3eb200=_0x30b2e5?_0x3a773d[_0xe082('0x30')]:_0x4f3dcc['offset']+_0x4f3dcc[_0xe082('0x2f')];var _0x5decc6;if(_0x3eb200>=_0x352deb){_0x3eb200=_0x352deb;_0x5decc6=0xc8;}else{_0x5decc6=0xce;}_0x30788d['status'](_0x5decc6);return _0x30788d[_0xe082('0x32')](_0xe082('0x33'),_0x27f702+'-'+_0x3eb200+'/'+_0x352deb)['json'](_0x3a773d);}return null;};}function patchUpdates(_0x367c4a){return function(_0x411a8a){try{jsonpatch[_0xe082('0x34')](_0x411a8a,_0x367c4a,!![]);}catch(_0x2e6949){return BPromise[_0xe082('0x35')](_0x2e6949);}return _0x411a8a[_0xe082('0x36')]();};}function saveUpdates(_0x28f91c,_0x4cd726){return function(_0x42161c){if(_0x42161c){return _0x42161c[_0xe082('0x37')](_0x28f91c)[_0xe082('0x20')](function(_0x1bb5d3){return _0x1bb5d3;});}return null;};}function removeEntity(_0x22d721,_0x2ac795){return function(_0x41147a){if(_0x41147a){return _0x41147a[_0xe082('0x38')]()[_0xe082('0x20')](function(){var _0x4a67c0=_0x41147a['get']({'plain':!![]});var _0x5cc0a0='ChatQueues';return db[_0xe082('0x39')][_0xe082('0x38')]({'where':{'type':_0x5cc0a0,'resourceId':_0x4a67c0['id']}})[_0xe082('0x20')](function(){return _0x41147a;});})['then'](function(){_0x22d721['status'](0xcc)[_0xe082('0x2c')]();});}};}function handleEntityNotFound(_0x55bbf3,_0x318a91){return function(_0x39bb4b){if(!_0x39bb4b){_0x55bbf3[_0xe082('0x2a')](0x194);}return _0x39bb4b;};}function handleError(_0x1590fb,_0x3317d4){_0x3317d4=_0x3317d4||0x1f4;return function(_0x1e085f){logger['error'](_0x1e085f[_0xe082('0x3a')]);if(_0x1e085f[_0xe082('0x3b')]){delete _0x1e085f[_0xe082('0x3b')];}_0x1590fb[_0xe082('0x2b')](_0x3317d4)[_0xe082('0x3c')](_0x1e085f);};}exports[_0xe082('0x3d')]=function(_0x58f709,_0x2b7b51){var _0x475d87={},_0xf51766={},_0x44c84d={'count':0x0,'rows':[]};var _0x36060b=_['map'](db[_0xe082('0x3e')][_0xe082('0x3f')],function(_0x181c07){return{'name':_0x181c07[_0xe082('0x40')],'type':_0x181c07[_0xe082('0x41')][_0xe082('0x42')]};});_0xf51766[_0xe082('0x43')]=_[_0xe082('0x44')](_0x36060b,'name');_0xf51766[_0xe082('0x45')]=_[_0xe082('0x46')](_0x58f709[_0xe082('0x45')]);_0xf51766[_0xe082('0x47')]=_['intersection'](_0xf51766['model'],_0xf51766[_0xe082('0x45')]);_0x475d87[_0xe082('0x48')]=_[_0xe082('0x49')](_0xf51766[_0xe082('0x43')],qs[_0xe082('0x4a')](_0x58f709['query'][_0xe082('0x4a')]));_0x475d87[_0xe082('0x48')]=_0x475d87[_0xe082('0x48')][_0xe082('0x4b')]?_0x475d87[_0xe082('0x48')]:_0xf51766[_0xe082('0x43')];if(!_0x58f709['query'][_0xe082('0x4c')](_0xe082('0x4d'))){_0x475d87['limit']=qs[_0xe082('0x2f')](_0x58f709[_0xe082('0x45')][_0xe082('0x2f')]);_0x475d87[_0xe082('0x31')]=qs[_0xe082('0x31')](_0x58f709[_0xe082('0x45')][_0xe082('0x31')]);}_0x475d87['order']=qs[_0xe082('0x4e')](_0x58f709[_0xe082('0x45')][_0xe082('0x4e')]);_0x475d87[_0xe082('0x4f')]=qs[_0xe082('0x47')](_[_0xe082('0x50')](_0x58f709[_0xe082('0x45')],_0xf51766[_0xe082('0x47')]),_0x36060b);if(_0x58f709[_0xe082('0x45')][_0xe082('0x51')]){_0x475d87[_0xe082('0x4f')]=_['merge'](_0x475d87['where'],{'$or':_[_0xe082('0x44')](_0x36060b,function(_0x75b3b){if(_0x75b3b[_0xe082('0x41')]!==_0xe082('0x52')){var _0xbea36b={};_0xbea36b[_0x75b3b[_0xe082('0x3b')]]={'$like':'%'+_0x58f709[_0xe082('0x45')][_0xe082('0x51')]+'%'};return _0xbea36b;}})});}_0x475d87=_['merge']({},_0x475d87,_0x58f709[_0xe082('0x53')]);var _0xe55e23={'where':_0x475d87[_0xe082('0x4f')]};return db[_0xe082('0x3e')][_0xe082('0x30')](_0xe55e23)[_0xe082('0x20')](function(_0xf52ddc){_0x44c84d[_0xe082('0x30')]=_0xf52ddc;if(_0x58f709[_0xe082('0x45')][_0xe082('0x54')]){_0x475d87[_0xe082('0x55')]=[{'all':!![]}];}return db[_0xe082('0x3e')][_0xe082('0x56')](_0x475d87);})[_0xe082('0x20')](function(_0x38e73c){_0x44c84d['rows']=_0x38e73c;return _0x44c84d;})[_0xe082('0x20')](respondWithFilteredResult(_0x2b7b51,_0x475d87))['catch'](handleError(_0x2b7b51,null));};exports[_0xe082('0x57')]=function(_0x8f4736,_0x300320){var _0x375072={'raw':!![],'where':{'id':_0x8f4736[_0xe082('0x58')]['id']}},_0x64e72f={};_0x64e72f[_0xe082('0x43')]=_[_0xe082('0x46')](db[_0xe082('0x3e')][_0xe082('0x3f')]);_0x64e72f['query']=_[_0xe082('0x46')](_0x8f4736[_0xe082('0x45')]);_0x64e72f[_0xe082('0x47')]=_[_0xe082('0x49')](_0x64e72f[_0xe082('0x43')],_0x64e72f[_0xe082('0x45')]);_0x375072[_0xe082('0x48')]=_[_0xe082('0x49')](_0x64e72f['model'],qs[_0xe082('0x4a')](_0x8f4736['query'][_0xe082('0x4a')]));_0x375072[_0xe082('0x48')]=_0x375072[_0xe082('0x48')]['length']?_0x375072['attributes']:_0x64e72f[_0xe082('0x43')];if(_0x8f4736[_0xe082('0x45')][_0xe082('0x54')]){_0x375072[_0xe082('0x55')]=[{'all':!![]}];}_0x375072=_['merge']({},_0x375072,_0x8f4736['options']);return db['ChatQueue'][_0xe082('0x59')](_0x375072)[_0xe082('0x20')](handleEntityNotFound(_0x300320,null))[_0xe082('0x20')](respondWithResult(_0x300320,null))[_0xe082('0x29')](handleError(_0x300320,null));};exports[_0xe082('0x5a')]=function(_0x252db4,_0x2b2123){return db[_0xe082('0x3e')][_0xe082('0x5a')](_0x252db4[_0xe082('0x5b')],{})[_0xe082('0x20')](function(_0x36e9f7){var _0x3f72ff=_0x252db4[_0xe082('0x5c')][_0xe082('0x5d')]({'plain':!![]});if(!_0x3f72ff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f72ff['role']==='user'){var _0x1a6aa0=_0x36e9f7[_0xe082('0x5d')]({'plain':!![]});var _0x5ca36b=_0xe082('0x5e');return db[_0xe082('0x5f')][_0xe082('0x59')]({'where':{'name':_0x5ca36b,'userProfileId':_0x3f72ff[_0xe082('0x60')]},'raw':!![]})[_0xe082('0x20')](function(_0x41a816){if(_0x41a816&&_0x41a816[_0xe082('0x61')]===0x0){return db[_0xe082('0x39')]['create']({'name':_0x1a6aa0[_0xe082('0x3b')],'resourceId':_0x1a6aa0['id'],'type':_0x41a816['name'],'sectionId':_0x41a816['id']},{})[_0xe082('0x20')](function(){return _0x36e9f7;});}else{return _0x36e9f7;}})[_0xe082('0x29')](function(_0x31408c){logger['error'](_0xe082('0x62'),_0x31408c);throw _0x31408c;});}return _0x36e9f7;})[_0xe082('0x20')](respondWithResult(_0x2b2123,0xc9))[_0xe082('0x29')](handleError(_0x2b2123,null));};exports[_0xe082('0x37')]=function(_0xa8eb43,_0x217995){if(_0xa8eb43[_0xe082('0x5b')]['id']){delete _0xa8eb43[_0xe082('0x5b')]['id'];}return db['ChatQueue'][_0xe082('0x59')]({'where':{'id':_0xa8eb43[_0xe082('0x58')]['id']}})[_0xe082('0x20')](handleEntityNotFound(_0x217995,null))['then'](saveUpdates(_0xa8eb43[_0xe082('0x5b')],null))[_0xe082('0x20')](respondWithResult(_0x217995,null))['catch'](handleError(_0x217995,null));};exports[_0xe082('0x38')]=function(_0x3b3a62,_0x424d25){return db[_0xe082('0x3e')][_0xe082('0x59')]({'where':{'id':_0x3b3a62[_0xe082('0x58')]['id']}})[_0xe082('0x20')](handleEntityNotFound(_0x424d25,null))[_0xe082('0x20')](removeEntity(_0x424d25,null))[_0xe082('0x29')](handleError(_0x424d25,null));};exports[_0xe082('0x63')]=function(_0x198434,_0x3a7f48){return db[_0xe082('0x3e')]['describe']()[_0xe082('0x20')](respondWithResult(_0x3a7f48,null))[_0xe082('0x29')](handleError(_0x3a7f48,null));};exports[_0xe082('0x64')]=function(_0x4810b7,_0x587f06,_0x586465){var _0x26db45={'raw':!![],'where':{}},_0x398f7c={},_0x1ba55c;return db['ChatQueue']['findOne']({'where':{'id':_0x4810b7['params']['id']}})['then'](handleEntityNotFound(_0x587f06,null))['then'](function(_0x37fe9a){if(_0x37fe9a){_0x1ba55c=_0x37fe9a[_0xe082('0x5d')]({'plain':!![]});_0x398f7c[_0xe082('0x43')]=_['keys'](db[_0xe082('0x65')][_0xe082('0x3f')]);_0x398f7c[_0xe082('0x45')]=_[_0xe082('0x46')](_0x4810b7['query']);_0x398f7c[_0xe082('0x47')]=_[_0xe082('0x49')](_0x398f7c[_0xe082('0x43')],_0x398f7c[_0xe082('0x45')]);_0x26db45['attributes']=_[_0xe082('0x49')](_0x398f7c['model'],qs[_0xe082('0x4a')](_0x4810b7[_0xe082('0x45')][_0xe082('0x4a')]));_0x26db45[_0xe082('0x48')]=_0x26db45[_0xe082('0x48')][_0xe082('0x4b')]?_0x26db45[_0xe082('0x48')]:_0x398f7c[_0xe082('0x43')];if(!_0x4810b7[_0xe082('0x45')][_0xe082('0x4c')](_0xe082('0x4d'))){_0x26db45['limit']=qs[_0xe082('0x2f')](_0x4810b7['query']['limit']);_0x26db45[_0xe082('0x31')]=qs['offset'](_0x4810b7[_0xe082('0x45')]['offset']);}_0x26db45[_0xe082('0x66')]=qs[_0xe082('0x4e')](_0x4810b7['query'][_0xe082('0x4e')]);_0x26db45[_0xe082('0x4f')]=qs[_0xe082('0x47')](_[_0xe082('0x50')](_0x4810b7[_0xe082('0x45')],_0x398f7c[_0xe082('0x47')]));_0x26db45['where']['ChatQueueId']=_0x37fe9a['id'];if(_0x4810b7['query'][_0xe082('0x51')]){_0x26db45[_0xe082('0x4f')]=_[_0xe082('0x67')](_0x26db45[_0xe082('0x4f')],{'$or':_[_0xe082('0x44')](_0x26db45[_0xe082('0x48')],function(_0x5eba6d){var _0x1c0c63={};_0x1c0c63[_0x5eba6d]={'$like':'%'+_0x4810b7[_0xe082('0x45')]['filter']+'%'};return _0x1c0c63;})});}_0x26db45=_[_0xe082('0x67')]({},_0x26db45,_0x4810b7[_0xe082('0x53')]);return db[_0xe082('0x65')]['findAll'](_0x26db45);}})[_0xe082('0x20')](function(_0x3d999f){if(_0x3d999f){return db[_0xe082('0x68')][_0xe082('0x69')]({'where':{'id':_[_0xe082('0x44')](_0x3d999f,_0xe082('0x6a')),'role':_0xe082('0x6b')},'attributes':['id',_0xe082('0x3b'),_0xe082('0x6c'),_0xe082('0x6d'),'createdAt']});}})[_0xe082('0x20')](function(_0x16f6ab){if(_0x16f6ab){return{'count':_0x16f6ab['count'],'rows':_[_0xe082('0x44')](_0x16f6ab[_0xe082('0x6e')],function(_0x47b836){return{'membername':_0x47b836[_0xe082('0x3b')],'UserId':_0x47b836['id'],'queue_name':_0x1ba55c[_0xe082('0x3b')],'ChatQueueId':_0x1ba55c['id'],'interface':util[_0xe082('0x6f')]('%s/%s',_0xe082('0x70'),_0x47b836[_0xe082('0x3b')]),'penalty':0x0,'paused':_0x47b836[_0xe082('0x6c')],'createdAt':_0x47b836[_0xe082('0x71')],'updatedAt':_0x47b836['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x587f06,_0x26db45))['catch'](handleError(_0x587f06,null));};exports[_0xe082('0x72')]=function(_0x31f76e,_0x260435,_0x148a46){var _0xd8fe7a={};var _0x320c49={};var _0x127770;var _0x476e02;return db[_0xe082('0x3e')][_0xe082('0x73')]({'where':{'id':_0x31f76e[_0xe082('0x58')]['id']}})['then'](handleEntityNotFound(_0x260435,null))[_0xe082('0x20')](function(_0x3b087a){if(_0x3b087a){_0x127770=_0x3b087a;_0x320c49[_0xe082('0x43')]=_['keys'](db[_0xe082('0x74')][_0xe082('0x3f')]);_0x320c49[_0xe082('0x45')]=_[_0xe082('0x46')](_0x31f76e[_0xe082('0x45')]);_0x320c49[_0xe082('0x47')]=_[_0xe082('0x49')](_0x320c49[_0xe082('0x43')],_0x320c49[_0xe082('0x45')]);_0xd8fe7a['attributes']=_[_0xe082('0x49')](_0x320c49['model'],qs[_0xe082('0x4a')](_0x31f76e['query'][_0xe082('0x4a')]));_0xd8fe7a['attributes']=_0xd8fe7a['attributes'][_0xe082('0x4b')]?_0xd8fe7a['attributes']:_0x320c49[_0xe082('0x43')];_0xd8fe7a[_0xe082('0x66')]=qs['sort'](_0x31f76e[_0xe082('0x45')]['sort']);_0xd8fe7a[_0xe082('0x4f')]=qs[_0xe082('0x47')](_['pick'](_0x31f76e['query'],_0x320c49[_0xe082('0x47')]));if(_0x31f76e[_0xe082('0x45')][_0xe082('0x51')]){_0xd8fe7a[_0xe082('0x4f')]=_[_0xe082('0x67')](_0xd8fe7a[_0xe082('0x4f')],{'$or':_[_0xe082('0x44')](_0xd8fe7a[_0xe082('0x48')],function(_0x17d63c){var _0x10c438={};_0x10c438[_0x17d63c]={'$like':'%'+_0x31f76e['query'][_0xe082('0x51')]+'%'};return _0x10c438;})});}_0xd8fe7a=_[_0xe082('0x67')]({},_0xd8fe7a,_0x31f76e[_0xe082('0x53')]);return _0x127770[_0xe082('0x72')](_0xd8fe7a);}})[_0xe082('0x20')](function(_0x271b72){if(_0x271b72){_0x476e02=_0x271b72[_0xe082('0x4b')];if(!_0x31f76e['query']['hasOwnProperty'](_0xe082('0x4d'))){_0xd8fe7a[_0xe082('0x2f')]=qs[_0xe082('0x2f')](_0x31f76e['query'][_0xe082('0x2f')]);_0xd8fe7a[_0xe082('0x31')]=qs['offset'](_0x31f76e[_0xe082('0x45')][_0xe082('0x31')]);}return _0x127770[_0xe082('0x72')](_0xd8fe7a);}})[_0xe082('0x20')](function(_0xd04c8d){if(_0xd04c8d){return _0xd04c8d?{'count':_0x476e02,'rows':_0xd04c8d}:null;}})[_0xe082('0x20')](respondWithResult(_0x260435,null))['catch'](handleError(_0x260435,null));};exports[_0xe082('0x75')]=function(_0x56aacb,_0x293bd6,_0x297398){var _0xbeeada=_0x56aacb['body'][_0xe082('0x76')];return db['Team'][_0xe082('0x56')]({'where':{'id':_0xbeeada},'attributes':['id'],'include':[{'model':db[_0xe082('0x68')],'as':_0xe082('0x77'),'attributes':['id','name',_0xe082('0x78'),'voicePause',_0xe082('0x79')],'raw':!![]}]})['then'](function(_0xf0d65d){if(_0xf0d65d){var _0x530fa7=_[_0xe082('0x7a')](_0xf0d65d,function(_0x3fc6cd){var _0x2f7e99=_0x3fc6cd[_0xe082('0x5d')]({'plain':!![]});return _0x2f7e99[_0xe082('0x77')];});return db[_0xe082('0x3e')][_0xe082('0x59')]({'where':{'id':_0x56aacb[_0xe082('0x58')]['id']}})[_0xe082('0x20')](function(_0x165b97){return db[_0xe082('0x7b')][_0xe082('0x7c')](function(_0x26087c){return _0x165b97[_0xe082('0x75')](_0xbeeada,{'transaction':_0x26087c})[_0xe082('0x20')](function(){return BPromise[_0xe082('0x7d')](_0x530fa7,function(_0xed8bfb){return db[_0xe082('0x65')]['findOrCreate']({'where':{'UserId':_0xed8bfb['id'],'ChatQueueId':_0x56aacb['params']['id']},'transaction':_0x26087c});});})[_0xe082('0x20')](function(){_0x530fa7['forEach'](function(_0x2f40d6){socket['emit']('userChatQueue:save',{'UserId':_0x2f40d6['id'],'ChatQueueId':_0x165b97['id']});});});});});}})[_0xe082('0x20')](respondWithStatusCode(_0x293bd6,null))[_0xe082('0x29')](handleError(_0x293bd6,null));};exports['removeTeams']=function(_0x1857ac,_0x1c8074,_0x3f3385){return db[_0xe082('0x74')]['findAll']({'where':{'id':_0x1857ac[_0xe082('0x45')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe082('0x77'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1c8074,null))['then'](function(_0x2eebe0){var _0x13b511=_[_0xe082('0x44')](_0x2eebe0,'id');var _0x4b3169=[];var _0x122c8d=[];var _0x1c887d=squel['select']();_0x1c887d[_0xe082('0x7e')]('tq.TeamId')[_0xe082('0x7f')]('team_has_chat_queues','tq')[_0xe082('0x80')](_0xe082('0x81'),'ut',_0xe082('0x82'))[_0xe082('0x4f')](_0xe082('0x83'),_0x1857ac[_0xe082('0x58')]['id']);for(var _0x36d43a=0x0;_0x36d43a<_0x2eebe0[_0xe082('0x4b')];_0x36d43a+=0x1){let _0x1160d4=_0x2eebe0[_0x36d43a];for(var _0x29d1ba=0x0;_0x29d1ba<_0x1160d4[_0xe082('0x77')][_0xe082('0x4b')];_0x29d1ba+=0x1){let _0x5604b5=_0x1160d4[_0xe082('0x77')][_0x29d1ba];var _0x12cf3b=_0x1c887d[_0xe082('0x84')]();_0x12cf3b[_0xe082('0x4f')]('ut.UserId\x20=\x20?',_0x5604b5['id']);_0x122c8d[_0xe082('0x85')](db[_0xe082('0x7b')][_0xe082('0x45')](_0x12cf3b['toString'](),{'type':db[_0xe082('0x7b')][_0xe082('0x86')][_0xe082('0x87')]})[_0xe082('0x20')](function(_0x43dc8f){if(_0x43dc8f[_0xe082('0x4b')]===0x1){return _0x5604b5['id'];}else{var _0x45d77b=_[_0xe082('0x88')](_[_0xe082('0x44')](_0x43dc8f,_0xe082('0x89')),function(_0x57badb){return _[_0xe082('0x8a')](_0x13b511,_0x57badb);});if(_0x45d77b){return _0x5604b5['id'];}}}));}}return BPromise['all'](_0x122c8d)[_0xe082('0x20')](function(_0x4799eb){_0x4b3169=_(_0x4b3169)['union'](_0x4799eb)[_0xe082('0x8b')]()['value']();return db['ChatQueue'][_0xe082('0x59')]({'where':{'id':_0x1857ac[_0xe082('0x58')]['id']}})[_0xe082('0x20')](function(_0x1e45ae){return db[_0xe082('0x7b')][_0xe082('0x7c')](function(_0x53496f){return _0x1e45ae['removeTeams'](_0x1857ac[_0xe082('0x45')][_0xe082('0x76')],{'transaction':_0x53496f})['then'](function(){if(!_[_0xe082('0x8c')](_0x4b3169)){return _0x1e45ae[_0xe082('0x8d')](_0x4b3169,{'transaction':_0x53496f});}})[_0xe082('0x20')](function(){_0x4b3169[_0xe082('0x8e')](function(_0x22ac12){socket[_0xe082('0x8f')](_0xe082('0x90'),{'UserId':_0x22ac12,'ChatQueueId':_0x1e45ae['id']});});});});});});})[_0xe082('0x20')](respondWithStatusCode(_0x1c8074,null))[_0xe082('0x29')](handleError(_0x1c8074,null));};exports[_0xe082('0x91')]=function(_0x1ac92b,_0x203263,_0x84f7ff){return db[_0xe082('0x3e')]['find']({'where':{'id':_0x1ac92b['params']['id']}})['then'](handleEntityNotFound(_0x203263,null))[_0xe082('0x20')](function(_0x79e170){if(_0x79e170){return _0x79e170[_0xe082('0x91')](_0x1ac92b[_0xe082('0x5b')]['ids'],_['omit'](_0x1ac92b[_0xe082('0x5b')],[_0xe082('0x76'),'id'])||{})[_0xe082('0x92')](function(_0x2574cd){for(var _0x1023d5=0x0;_0x1023d5<_0x1ac92b[_0xe082('0x5b')]['ids'][_0xe082('0x4b')];_0x1023d5+=0x1){socket['emit'](_0xe082('0x93'),{'UserId':Number(_0x1ac92b[_0xe082('0x5b')][_0xe082('0x76')][_0x1023d5]),'ChatQueueId':Number(_0x1ac92b[_0xe082('0x58')]['id'])});}return _0x2574cd;});}})[_0xe082('0x20')](respondWithResult(_0x203263,null))['catch'](handleError(_0x203263,null));};exports[_0xe082('0x8d')]=function(_0x334ae5,_0x2956cb,_0x4053e7){return db[_0xe082('0x3e')][_0xe082('0x59')]({'where':{'id':_0x334ae5['params']['id']}})[_0xe082('0x20')](handleEntityNotFound(_0x2956cb,null))[_0xe082('0x20')](function(_0x701234){if(_0x701234){return _0x701234[_0xe082('0x8d')](_0x334ae5['query'][_0xe082('0x76')])[_0xe082('0x20')](function(){if(_[_0xe082('0x94')](_0x334ae5[_0xe082('0x45')]['ids'])){for(var _0x148a21=0x0;_0x148a21<_0x334ae5[_0xe082('0x45')]['ids']['length'];_0x148a21+=0x1){socket[_0xe082('0x8f')](_0xe082('0x90'),{'UserId':Number(_0x334ae5[_0xe082('0x45')]['ids'][_0x148a21]),'ChatQueueId':Number(_0x334ae5[_0xe082('0x58')]['id'])});}}else{socket[_0xe082('0x8f')]('userChatQueue:remove',{'UserId':Number(_0x334ae5['query'][_0xe082('0x76')]),'ChatQueueId':Number(_0x334ae5[_0xe082('0x58')]['id'])});}});}})[_0xe082('0x20')](respondWithStatusCode(_0x2956cb,null))['catch'](handleError(_0x2956cb,null));};exports[_0xe082('0x95')]=function(_0x9b0cc5,_0x279d88,_0x5a4fba){var _0x4633b6={};var _0x5043cf={};var _0x5d66d9;var _0x1a9610;return db[_0xe082('0x3e')][_0xe082('0x73')]({'where':{'id':_0x9b0cc5[_0xe082('0x58')]['id']}})['then'](handleEntityNotFound(_0x279d88,null))[_0xe082('0x20')](function(_0x1a87bb){if(_0x1a87bb){_0x5d66d9=_0x1a87bb;_0x5043cf[_0xe082('0x43')]=_[_0xe082('0x46')](db[_0xe082('0x68')]['rawAttributes']);_0x5043cf[_0xe082('0x45')]=_[_0xe082('0x46')](_0x9b0cc5[_0xe082('0x45')]);_0x5043cf['filters']=_['intersection'](_0x5043cf[_0xe082('0x43')],_0x5043cf[_0xe082('0x45')]);_0x4633b6[_0xe082('0x48')]=_['intersection'](_0x5043cf[_0xe082('0x43')],qs[_0xe082('0x4a')](_0x9b0cc5['query']['fields']));_0x4633b6[_0xe082('0x48')]=_0x4633b6[_0xe082('0x48')][_0xe082('0x4b')]?_0x4633b6[_0xe082('0x48')]:_0x5043cf[_0xe082('0x43')];_0x4633b6['order']=qs['sort'](_0x9b0cc5[_0xe082('0x45')][_0xe082('0x4e')]);_0x4633b6[_0xe082('0x4f')]=qs[_0xe082('0x47')](_[_0xe082('0x50')](_0x9b0cc5[_0xe082('0x45')],_0x5043cf['filters']));if(_0x9b0cc5[_0xe082('0x45')]['filter']){_0x4633b6['where']=_[_0xe082('0x67')](_0x4633b6[_0xe082('0x4f')],{'$or':_['map'](_0x4633b6['attributes'],function(_0x2440d4){var _0x2d59e8={};_0x2d59e8[_0x2440d4]={'$like':'%'+_0x9b0cc5[_0xe082('0x45')][_0xe082('0x51')]+'%'};return _0x2d59e8;})});}_0x4633b6=_[_0xe082('0x67')]({},_0x4633b6,_0x9b0cc5[_0xe082('0x53')]);return _0x5d66d9['getAgents'](_0x4633b6);}})[_0xe082('0x20')](function(_0x6772d5){if(_0x6772d5){_0x1a9610=_0x6772d5[_0xe082('0x4b')];if(!_0x9b0cc5[_0xe082('0x45')]['hasOwnProperty'](_0xe082('0x4d'))){_0x4633b6['limit']=qs[_0xe082('0x2f')](_0x9b0cc5['query'][_0xe082('0x2f')]);_0x4633b6[_0xe082('0x31')]=qs[_0xe082('0x31')](_0x9b0cc5[_0xe082('0x45')][_0xe082('0x31')]);}return _0x5d66d9[_0xe082('0x95')](_0x4633b6);}})[_0xe082('0x20')](function(_0x1fcaf8){if(_0x1fcaf8){return _0x1fcaf8?{'count':_0x1a9610,'rows':_0x1fcaf8}:null;}})[_0xe082('0x20')](respondWithResult(_0x279d88,null))['catch'](handleError(_0x279d88,null));}; \ No newline at end of file +var _0x8306=['userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','jayson/promise','client','http','request','then','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','info','result','catch','sendStatus','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','get','ChatQueues','UserProfileResource','destroy','status','end','stack','send','index','map','ChatQueue','rawAttributes','fieldName','type','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','show','params','length','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','describe','getMembers','UserChatQueue','User','UserId','agent','updatedAt','format','%s/%s','SIP','findOne','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','transaction','each','findOrCreate','emit','userChatQueue:save','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0x8306,0x144));var _0x6830=function(_0x2148c1,_0x41caa9){_0x2148c1=_0x2148c1-0x0;var _0x28c175=_0x8306[_0x2148c1];return _0x28c175;};'use strict';var emlformat=require(_0x6830('0x0'));var rimraf=require(_0x6830('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6830('0x2'));var BPromise=require(_0x6830('0x3'));var Mustache=require(_0x6830('0x4'));var util=require('util');var path=require(_0x6830('0x5'));var sox=require(_0x6830('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6830('0x7'));var _=require(_0x6830('0x8'));var squel=require(_0x6830('0x9'));var crypto=require(_0x6830('0xa'));var jsforce=require(_0x6830('0xb'));var deskjs=require(_0x6830('0xc'));var toCsv=require(_0x6830('0xd'));var querystring=require(_0x6830('0xe'));var Papa=require(_0x6830('0xf'));var Redis=require(_0x6830('0x10'));var authService=require(_0x6830('0x11'));var qs=require(_0x6830('0x12'));var as=require(_0x6830('0x13'));var hardwareService=require(_0x6830('0x14'));var logger=require(_0x6830('0x15'))(_0x6830('0x16'));var utils=require(_0x6830('0x17'));var config=require(_0x6830('0x18'));var licenseUtil=require(_0x6830('0x19'));var db=require(_0x6830('0x1a'))['db'];config[_0x6830('0x1b')]=_[_0x6830('0x1c')](config['redis'],{'host':_0x6830('0x1d'),'port':0x18eb});var socket=require(_0x6830('0x1e'))(new Redis(config[_0x6830('0x1b')]));require(_0x6830('0x1f'))['register'](socket);var jayson=require(_0x6830('0x20'));var client=jayson[_0x6830('0x21')][_0x6830('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x2fa50b,_0x16f97d,_0x4cc4bf,_0x2f1efd){return new BPromise(function(_0x391e29,_0x2b67d5){var _0x408a4e=_0x2f1efd||client;return _0x408a4e[_0x6830('0x23')](_0x2fa50b,_0x4cc4bf)[_0x6830('0x24')](function(_0x13bcfe){logger['info']('ChatQueue,\x20%s,\x20%s',_0x16f97d,_0x6830('0x25'));logger[_0x6830('0x26')](_0x6830('0x27'),_0x16f97d,'request\x20sent',JSON[_0x6830('0x28')](_0x13bcfe));if(_0x13bcfe[_0x6830('0x29')]){if(_0x13bcfe[_0x6830('0x29')][_0x6830('0x2a')]===0x1f4){logger[_0x6830('0x29')]('ChatQueue,\x20%s,\x20%s',_0x16f97d,_0x13bcfe[_0x6830('0x29')][_0x6830('0x2b')]);return _0x2b67d5(_0x13bcfe[_0x6830('0x29')]['message']);}logger[_0x6830('0x29')](_0x6830('0x2c'),_0x16f97d,_0x13bcfe[_0x6830('0x29')][_0x6830('0x2b')]);return _0x391e29(_0x13bcfe['error'][_0x6830('0x2b')]);}else{logger[_0x6830('0x2d')]('ChatQueue,\x20%s,\x20%s',_0x16f97d,'request\x20sent');_0x391e29(_0x13bcfe[_0x6830('0x2e')]['message']);}})[_0x6830('0x2f')](function(_0x264202){logger[_0x6830('0x29')](_0x6830('0x2c'),_0x16f97d,_0x264202);_0x2b67d5(_0x264202);});});}function respondWithStatusCode(_0x354b5a,_0x459337){_0x459337=_0x459337||0xcc;return function(_0x4e7a67){if(_0x4e7a67){return _0x354b5a[_0x6830('0x30')](_0x459337);}return _0x354b5a['status'](_0x459337)['end']();};}function respondWithResult(_0x438d4a,_0x21bcd2){_0x21bcd2=_0x21bcd2||0xc8;return function(_0x578723){if(_0x578723){return _0x438d4a['status'](_0x21bcd2)[_0x6830('0x31')](_0x578723);}};}function respondWithFilteredResult(_0x5d55d1,_0x5bae45){return function(_0x2b565d){if(_0x2b565d){var _0xcc2e87=typeof _0x5bae45[_0x6830('0x32')]===_0x6830('0x33')&&typeof _0x5bae45[_0x6830('0x34')]===_0x6830('0x33');var _0xb9e4ab=_0x2b565d[_0x6830('0x35')];var _0x59b7f9=_0xcc2e87?0x0:_0x5bae45[_0x6830('0x32')];var _0x1b9f5d=_0xcc2e87?_0x2b565d['count']:_0x5bae45[_0x6830('0x32')]+_0x5bae45['limit'];var _0x450421;if(_0x1b9f5d>=_0xb9e4ab){_0x1b9f5d=_0xb9e4ab;_0x450421=0xc8;}else{_0x450421=0xce;}_0x5d55d1['status'](_0x450421);return _0x5d55d1['set'](_0x6830('0x36'),_0x59b7f9+'-'+_0x1b9f5d+'/'+_0xb9e4ab)['json'](_0x2b565d);}return null;};}function patchUpdates(_0x159965){return function(_0x86b9cc){try{jsonpatch[_0x6830('0x37')](_0x86b9cc,_0x159965,!![]);}catch(_0x465bdc){return BPromise[_0x6830('0x38')](_0x465bdc);}return _0x86b9cc[_0x6830('0x39')]();};}function saveUpdates(_0x2e6c9a,_0x3eee8d){return function(_0x3f4f25){if(_0x3f4f25){return _0x3f4f25[_0x6830('0x3a')](_0x2e6c9a)['then'](function(_0x36aa07){return _0x36aa07;});}return null;};}function removeEntity(_0x19b70c,_0x33266c){return function(_0x2db824){if(_0x2db824){return _0x2db824['destroy']()['then'](function(){var _0x18e418=_0x2db824[_0x6830('0x3b')]({'plain':!![]});var _0x3b56d2=_0x6830('0x3c');return db[_0x6830('0x3d')][_0x6830('0x3e')]({'where':{'type':_0x3b56d2,'resourceId':_0x18e418['id']}})[_0x6830('0x24')](function(){return _0x2db824;});})[_0x6830('0x24')](function(){_0x19b70c[_0x6830('0x3f')](0xcc)[_0x6830('0x40')]();});}};}function handleEntityNotFound(_0x5a7831,_0x5bf0c2){return function(_0x5262e4){if(!_0x5262e4){_0x5a7831['sendStatus'](0x194);}return _0x5262e4;};}function handleError(_0x24476c,_0x540758){_0x540758=_0x540758||0x1f4;return function(_0x570241){logger[_0x6830('0x29')](_0x570241[_0x6830('0x41')]);if(_0x570241['name']){delete _0x570241['name'];}_0x24476c[_0x6830('0x3f')](_0x540758)[_0x6830('0x42')](_0x570241);};}exports[_0x6830('0x43')]=function(_0x347ef3,_0x5d9935){var _0x8fcbe3={},_0x5383a6={},_0x196a10={'count':0x0,'rows':[]};var _0x2464d7=_[_0x6830('0x44')](db[_0x6830('0x45')][_0x6830('0x46')],function(_0x1489eb){return{'name':_0x1489eb[_0x6830('0x47')],'type':_0x1489eb[_0x6830('0x48')]['key']};});_0x5383a6['model']=_[_0x6830('0x44')](_0x2464d7,_0x6830('0x49'));_0x5383a6[_0x6830('0x4a')]=_[_0x6830('0x4b')](_0x347ef3[_0x6830('0x4a')]);_0x5383a6[_0x6830('0x4c')]=_[_0x6830('0x4d')](_0x5383a6[_0x6830('0x4e')],_0x5383a6[_0x6830('0x4a')]);_0x8fcbe3[_0x6830('0x4f')]=_[_0x6830('0x4d')](_0x5383a6[_0x6830('0x4e')],qs[_0x6830('0x50')](_0x347ef3[_0x6830('0x4a')][_0x6830('0x50')]));_0x8fcbe3[_0x6830('0x4f')]=_0x8fcbe3['attributes']['length']?_0x8fcbe3[_0x6830('0x4f')]:_0x5383a6[_0x6830('0x4e')];if(!_0x347ef3['query'][_0x6830('0x51')](_0x6830('0x52'))){_0x8fcbe3[_0x6830('0x34')]=qs[_0x6830('0x34')](_0x347ef3[_0x6830('0x4a')][_0x6830('0x34')]);_0x8fcbe3[_0x6830('0x32')]=qs[_0x6830('0x32')](_0x347ef3[_0x6830('0x4a')][_0x6830('0x32')]);}_0x8fcbe3[_0x6830('0x53')]=qs[_0x6830('0x54')](_0x347ef3[_0x6830('0x4a')][_0x6830('0x54')]);_0x8fcbe3[_0x6830('0x55')]=qs[_0x6830('0x4c')](_[_0x6830('0x56')](_0x347ef3[_0x6830('0x4a')],_0x5383a6[_0x6830('0x4c')]),_0x2464d7);if(_0x347ef3[_0x6830('0x4a')][_0x6830('0x57')]){_0x8fcbe3[_0x6830('0x55')]=_['merge'](_0x8fcbe3[_0x6830('0x55')],{'$or':_[_0x6830('0x44')](_0x2464d7,function(_0x3050b7){if(_0x3050b7['type']!==_0x6830('0x58')){var _0x33f99d={};_0x33f99d[_0x3050b7[_0x6830('0x49')]]={'$like':'%'+_0x347ef3[_0x6830('0x4a')][_0x6830('0x57')]+'%'};return _0x33f99d;}})});}_0x8fcbe3=_['merge']({},_0x8fcbe3,_0x347ef3[_0x6830('0x59')]);var _0x5ad0d8={'where':_0x8fcbe3[_0x6830('0x55')]};return db[_0x6830('0x45')][_0x6830('0x35')](_0x5ad0d8)[_0x6830('0x24')](function(_0x47c31c){_0x196a10[_0x6830('0x35')]=_0x47c31c;if(_0x347ef3['query']['includeAll']){_0x8fcbe3[_0x6830('0x5a')]=[{'all':!![]}];}return db[_0x6830('0x45')][_0x6830('0x5b')](_0x8fcbe3);})['then'](function(_0x34d311){_0x196a10[_0x6830('0x5c')]=_0x34d311;return _0x196a10;})[_0x6830('0x24')](respondWithFilteredResult(_0x5d9935,_0x8fcbe3))[_0x6830('0x2f')](handleError(_0x5d9935,null));};exports[_0x6830('0x5d')]=function(_0x25d14f,_0xd4ab2a){var _0x2f25e6={'raw':!![],'where':{'id':_0x25d14f[_0x6830('0x5e')]['id']}},_0x3abb6b={};_0x3abb6b[_0x6830('0x4e')]=_[_0x6830('0x4b')](db['ChatQueue'][_0x6830('0x46')]);_0x3abb6b[_0x6830('0x4a')]=_[_0x6830('0x4b')](_0x25d14f[_0x6830('0x4a')]);_0x3abb6b[_0x6830('0x4c')]=_['intersection'](_0x3abb6b[_0x6830('0x4e')],_0x3abb6b[_0x6830('0x4a')]);_0x2f25e6[_0x6830('0x4f')]=_[_0x6830('0x4d')](_0x3abb6b[_0x6830('0x4e')],qs[_0x6830('0x50')](_0x25d14f[_0x6830('0x4a')][_0x6830('0x50')]));_0x2f25e6[_0x6830('0x4f')]=_0x2f25e6[_0x6830('0x4f')][_0x6830('0x5f')]?_0x2f25e6[_0x6830('0x4f')]:_0x3abb6b[_0x6830('0x4e')];if(_0x25d14f[_0x6830('0x4a')]['includeAll']){_0x2f25e6['include']=[{'all':!![]}];}_0x2f25e6=_[_0x6830('0x60')]({},_0x2f25e6,_0x25d14f[_0x6830('0x59')]);return db['ChatQueue'][_0x6830('0x61')](_0x2f25e6)[_0x6830('0x24')](handleEntityNotFound(_0xd4ab2a,null))[_0x6830('0x24')](respondWithResult(_0xd4ab2a,null))[_0x6830('0x2f')](handleError(_0xd4ab2a,null));};exports['create']=function(_0x4320ba,_0x3150e1){return db[_0x6830('0x45')][_0x6830('0x62')](_0x4320ba[_0x6830('0x63')],{})[_0x6830('0x24')](function(_0x29d29b){var _0x5d7bbe=_0x4320ba['user'][_0x6830('0x3b')]({'plain':!![]});if(!_0x5d7bbe)throw new Error(_0x6830('0x64'));if(_0x5d7bbe[_0x6830('0x65')]==='user'){var _0x2d4587=_0x29d29b[_0x6830('0x3b')]({'plain':!![]});var _0x14ea30=_0x6830('0x3c');return db['UserProfileSection'][_0x6830('0x61')]({'where':{'name':_0x14ea30,'userProfileId':_0x5d7bbe['userProfileId']},'raw':!![]})[_0x6830('0x24')](function(_0x1b1abb){if(_0x1b1abb&&_0x1b1abb[_0x6830('0x66')]===0x0){return db[_0x6830('0x3d')]['create']({'name':_0x2d4587[_0x6830('0x49')],'resourceId':_0x2d4587['id'],'type':_0x1b1abb[_0x6830('0x49')],'sectionId':_0x1b1abb['id']},{})[_0x6830('0x24')](function(){return _0x29d29b;});}else{return _0x29d29b;}})[_0x6830('0x2f')](function(_0x59720c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59720c);throw _0x59720c;});}return _0x29d29b;})[_0x6830('0x24')](respondWithResult(_0x3150e1,0xc9))[_0x6830('0x2f')](handleError(_0x3150e1,null));};exports['update']=function(_0x4e4bcd,_0x192923){if(_0x4e4bcd[_0x6830('0x63')]['id']){delete _0x4e4bcd['body']['id'];}return db[_0x6830('0x45')]['find']({'where':{'id':_0x4e4bcd[_0x6830('0x5e')]['id']}})[_0x6830('0x24')](handleEntityNotFound(_0x192923,null))['then'](saveUpdates(_0x4e4bcd['body'],null))[_0x6830('0x24')](respondWithResult(_0x192923,null))[_0x6830('0x2f')](handleError(_0x192923,null));};exports['destroy']=function(_0x2aeac1,_0x48826){return db[_0x6830('0x45')][_0x6830('0x61')]({'where':{'id':_0x2aeac1['params']['id']}})[_0x6830('0x24')](handleEntityNotFound(_0x48826,null))[_0x6830('0x24')](removeEntity(_0x48826,null))[_0x6830('0x2f')](handleError(_0x48826,null));};exports[_0x6830('0x67')]=function(_0xc1aa2e,_0x1ccc8b){return db[_0x6830('0x45')][_0x6830('0x67')]()[_0x6830('0x24')](respondWithResult(_0x1ccc8b,null))[_0x6830('0x2f')](handleError(_0x1ccc8b,null));};exports[_0x6830('0x68')]=function(_0x328736,_0x3af943,_0x2ef87d){var _0x13ceee={'raw':!![],'where':{}},_0x585c84={},_0x8fe6b7;return db[_0x6830('0x45')]['findOne']({'where':{'id':_0x328736[_0x6830('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3af943,null))[_0x6830('0x24')](function(_0xfc9680){if(_0xfc9680){_0x8fe6b7=_0xfc9680[_0x6830('0x3b')]({'plain':!![]});_0x585c84[_0x6830('0x4e')]=_['keys'](db[_0x6830('0x69')][_0x6830('0x46')]);_0x585c84[_0x6830('0x4a')]=_[_0x6830('0x4b')](_0x328736[_0x6830('0x4a')]);_0x585c84[_0x6830('0x4c')]=_['intersection'](_0x585c84[_0x6830('0x4e')],_0x585c84[_0x6830('0x4a')]);_0x13ceee['attributes']=_['intersection'](_0x585c84['model'],qs['fields'](_0x328736[_0x6830('0x4a')][_0x6830('0x50')]));_0x13ceee[_0x6830('0x4f')]=_0x13ceee[_0x6830('0x4f')]['length']?_0x13ceee[_0x6830('0x4f')]:_0x585c84[_0x6830('0x4e')];if(!_0x328736[_0x6830('0x4a')][_0x6830('0x51')](_0x6830('0x52'))){_0x13ceee[_0x6830('0x34')]=qs[_0x6830('0x34')](_0x328736[_0x6830('0x4a')]['limit']);_0x13ceee[_0x6830('0x32')]=qs[_0x6830('0x32')](_0x328736[_0x6830('0x4a')][_0x6830('0x32')]);}_0x13ceee['order']=qs[_0x6830('0x54')](_0x328736['query']['sort']);_0x13ceee[_0x6830('0x55')]=qs['filters'](_['pick'](_0x328736[_0x6830('0x4a')],_0x585c84[_0x6830('0x4c')]));_0x13ceee[_0x6830('0x55')]['ChatQueueId']=_0xfc9680['id'];if(_0x328736[_0x6830('0x4a')]['filter']){_0x13ceee[_0x6830('0x55')]=_[_0x6830('0x60')](_0x13ceee[_0x6830('0x55')],{'$or':_['map'](_0x13ceee[_0x6830('0x4f')],function(_0x54ed5f){var _0x14d875={};_0x14d875[_0x54ed5f]={'$like':'%'+_0x328736[_0x6830('0x4a')][_0x6830('0x57')]+'%'};return _0x14d875;})});}_0x13ceee=_['merge']({},_0x13ceee,_0x328736[_0x6830('0x59')]);return db['UserChatQueue'][_0x6830('0x5b')](_0x13ceee);}})[_0x6830('0x24')](function(_0x5a5611){if(_0x5a5611){return db[_0x6830('0x6a')]['findAndCountAll']({'where':{'id':_[_0x6830('0x44')](_0x5a5611,_0x6830('0x6b')),'role':_0x6830('0x6c')},'attributes':['id','name','chatPause',_0x6830('0x6d'),'createdAt']});}})[_0x6830('0x24')](function(_0x58ac2d){if(_0x58ac2d){return{'count':_0x58ac2d['count'],'rows':_[_0x6830('0x44')](_0x58ac2d[_0x6830('0x5c')],function(_0x3ce085){return{'membername':_0x3ce085[_0x6830('0x49')],'UserId':_0x3ce085['id'],'queue_name':_0x8fe6b7[_0x6830('0x49')],'ChatQueueId':_0x8fe6b7['id'],'interface':util[_0x6830('0x6e')](_0x6830('0x6f'),_0x6830('0x70'),_0x3ce085['name']),'penalty':0x0,'paused':_0x3ce085['chatPause'],'createdAt':_0x3ce085['createdAt'],'updatedAt':_0x3ce085[_0x6830('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6830('0x24')](respondWithFilteredResult(_0x3af943,_0x13ceee))['catch'](handleError(_0x3af943,null));};exports['getTeams']=function(_0x1c57dd,_0x2176f2,_0x534d77){var _0xe6e218={};var _0x9fdd1b={};var _0x31bdc0;var _0x1b76dc;return db[_0x6830('0x45')][_0x6830('0x71')]({'where':{'id':_0x1c57dd['params']['id']}})['then'](handleEntityNotFound(_0x2176f2,null))[_0x6830('0x24')](function(_0x3027ec){if(_0x3027ec){_0x31bdc0=_0x3027ec;_0x9fdd1b['model']=_[_0x6830('0x4b')](db[_0x6830('0x72')][_0x6830('0x46')]);_0x9fdd1b[_0x6830('0x4a')]=_[_0x6830('0x4b')](_0x1c57dd[_0x6830('0x4a')]);_0x9fdd1b[_0x6830('0x4c')]=_['intersection'](_0x9fdd1b[_0x6830('0x4e')],_0x9fdd1b[_0x6830('0x4a')]);_0xe6e218[_0x6830('0x4f')]=_['intersection'](_0x9fdd1b[_0x6830('0x4e')],qs[_0x6830('0x50')](_0x1c57dd[_0x6830('0x4a')][_0x6830('0x50')]));_0xe6e218[_0x6830('0x4f')]=_0xe6e218[_0x6830('0x4f')]['length']?_0xe6e218['attributes']:_0x9fdd1b[_0x6830('0x4e')];_0xe6e218['order']=qs['sort'](_0x1c57dd[_0x6830('0x4a')]['sort']);_0xe6e218[_0x6830('0x55')]=qs['filters'](_[_0x6830('0x56')](_0x1c57dd[_0x6830('0x4a')],_0x9fdd1b[_0x6830('0x4c')]));if(_0x1c57dd['query'][_0x6830('0x57')]){_0xe6e218[_0x6830('0x55')]=_[_0x6830('0x60')](_0xe6e218['where'],{'$or':_['map'](_0xe6e218['attributes'],function(_0x3083f2){var _0x11cb3a={};_0x11cb3a[_0x3083f2]={'$like':'%'+_0x1c57dd[_0x6830('0x4a')][_0x6830('0x57')]+'%'};return _0x11cb3a;})});}_0xe6e218=_[_0x6830('0x60')]({},_0xe6e218,_0x1c57dd[_0x6830('0x59')]);return _0x31bdc0[_0x6830('0x73')](_0xe6e218);}})[_0x6830('0x24')](function(_0x2c6cde){if(_0x2c6cde){_0x1b76dc=_0x2c6cde[_0x6830('0x5f')];if(!_0x1c57dd[_0x6830('0x4a')]['hasOwnProperty']('nolimit')){_0xe6e218[_0x6830('0x34')]=qs[_0x6830('0x34')](_0x1c57dd['query']['limit']);_0xe6e218[_0x6830('0x32')]=qs[_0x6830('0x32')](_0x1c57dd[_0x6830('0x4a')][_0x6830('0x32')]);}return _0x31bdc0[_0x6830('0x73')](_0xe6e218);}})[_0x6830('0x24')](function(_0x20bb66){if(_0x20bb66){return _0x20bb66?{'count':_0x1b76dc,'rows':_0x20bb66}:null;}})[_0x6830('0x24')](respondWithResult(_0x2176f2,null))[_0x6830('0x2f')](handleError(_0x2176f2,null));};exports[_0x6830('0x74')]=function(_0x5e1db3,_0x452533,_0xdb5cd6){var _0x5e6f39=_0x5e1db3['body'][_0x6830('0x75')];return db[_0x6830('0x72')][_0x6830('0x5b')]({'where':{'id':_0x5e6f39},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6830('0x76'),'attributes':['id',_0x6830('0x49'),_0x6830('0x77'),_0x6830('0x78'),_0x6830('0x79')],'raw':!![]}]})['then'](function(_0x4b737a){if(_0x4b737a){var _0x4274f=_['flatMap'](_0x4b737a,function(_0x3aec66){var _0x16b8fe=_0x3aec66[_0x6830('0x3b')]({'plain':!![]});return _0x16b8fe['Agents'];});return db[_0x6830('0x45')][_0x6830('0x61')]({'where':{'id':_0x5e1db3[_0x6830('0x5e')]['id']}})['then'](function(_0x513d90){return db[_0x6830('0x7a')][_0x6830('0x7b')](function(_0x5cf692){return _0x513d90[_0x6830('0x74')](_0x5e6f39,{'transaction':_0x5cf692})[_0x6830('0x24')](function(){return BPromise[_0x6830('0x7c')](_0x4274f,function(_0x38a41c){return db[_0x6830('0x69')][_0x6830('0x7d')]({'where':{'UserId':_0x38a41c['id'],'ChatQueueId':_0x5e1db3['params']['id']},'transaction':_0x5cf692});});})['then'](function(){_0x4274f['forEach'](function(_0xecf31c){socket[_0x6830('0x7e')](_0x6830('0x7f'),{'UserId':_0xecf31c['id'],'ChatQueueId':_0x513d90['id']});});});});});}})['then'](respondWithStatusCode(_0x452533,null))[_0x6830('0x2f')](handleError(_0x452533,null));};exports['removeTeams']=function(_0x3e2379,_0xa40874,_0x49d3d1){return db['Team']['findAll']({'where':{'id':_0x3e2379[_0x6830('0x4a')][_0x6830('0x75')]},'attributes':['id'],'include':[{'model':db[_0x6830('0x6a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xa40874,null))[_0x6830('0x24')](function(_0x22f71a){var _0x2b8329=_['map'](_0x22f71a,'id');var _0x4e8f18=[];var _0x4e8bc4=[];var _0x134adc=squel[_0x6830('0x80')]();_0x134adc[_0x6830('0x81')](_0x6830('0x82'))[_0x6830('0x83')](_0x6830('0x84'),'tq')['join'](_0x6830('0x85'),'ut',_0x6830('0x86'))[_0x6830('0x55')](_0x6830('0x87'),_0x3e2379[_0x6830('0x5e')]['id']);for(var _0x61612c=0x0;_0x61612c<_0x22f71a[_0x6830('0x5f')];_0x61612c+=0x1){let _0x5b9e31=_0x22f71a[_0x61612c];for(var _0x21f95f=0x0;_0x21f95f<_0x5b9e31[_0x6830('0x76')][_0x6830('0x5f')];_0x21f95f+=0x1){let _0x3645fb=_0x5b9e31[_0x6830('0x76')][_0x21f95f];var _0x1312a1=_0x134adc[_0x6830('0x88')]();_0x1312a1['where'](_0x6830('0x89'),_0x3645fb['id']);_0x4e8bc4[_0x6830('0x8a')](db[_0x6830('0x7a')][_0x6830('0x4a')](_0x1312a1[_0x6830('0x8b')](),{'type':db['sequelize'][_0x6830('0x8c')][_0x6830('0x8d')]})[_0x6830('0x24')](function(_0x418253){if(_0x418253['length']===0x1){return _0x3645fb['id'];}else{var _0x5cee83=_[_0x6830('0x8e')](_[_0x6830('0x44')](_0x418253,_0x6830('0x8f')),function(_0x684fb7){return _[_0x6830('0x90')](_0x2b8329,_0x684fb7);});if(_0x5cee83){return _0x3645fb['id'];}}}));}}return BPromise[_0x6830('0x91')](_0x4e8bc4)[_0x6830('0x24')](function(_0xd5f9f8){_0x4e8f18=_(_0x4e8f18)[_0x6830('0x92')](_0xd5f9f8)[_0x6830('0x93')]()[_0x6830('0x94')]();return db[_0x6830('0x45')][_0x6830('0x61')]({'where':{'id':_0x3e2379[_0x6830('0x5e')]['id']}})[_0x6830('0x24')](function(_0x179f79){return db[_0x6830('0x7a')][_0x6830('0x7b')](function(_0x36be57){return _0x179f79[_0x6830('0x95')](_0x3e2379[_0x6830('0x4a')][_0x6830('0x75')],{'transaction':_0x36be57})[_0x6830('0x24')](function(){if(!_[_0x6830('0x96')](_0x4e8f18)){return _0x179f79[_0x6830('0x97')](_0x4e8f18,{'transaction':_0x36be57});}})['then'](function(){_0x4e8f18[_0x6830('0x98')](function(_0x1324e8){socket[_0x6830('0x7e')](_0x6830('0x99'),{'UserId':_0x1324e8,'ChatQueueId':_0x179f79['id']});});});});});});})[_0x6830('0x24')](respondWithStatusCode(_0xa40874,null))[_0x6830('0x2f')](handleError(_0xa40874,null));};exports[_0x6830('0x9a')]=function(_0x6ed7a7,_0x107609,_0x32490a){return db[_0x6830('0x45')][_0x6830('0x61')]({'where':{'id':_0x6ed7a7[_0x6830('0x5e')]['id']}})[_0x6830('0x24')](handleEntityNotFound(_0x107609,null))[_0x6830('0x24')](function(_0x528544){if(_0x528544){return _0x528544[_0x6830('0x9a')](_0x6ed7a7[_0x6830('0x63')][_0x6830('0x75')],_[_0x6830('0x9b')](_0x6ed7a7[_0x6830('0x63')],[_0x6830('0x75'),'id'])||{})[_0x6830('0x9c')](function(_0x44e38a){for(var _0x1fe114=0x0;_0x1fe114<_0x6ed7a7['body'][_0x6830('0x75')][_0x6830('0x5f')];_0x1fe114+=0x1){socket[_0x6830('0x7e')](_0x6830('0x7f'),{'UserId':Number(_0x6ed7a7[_0x6830('0x63')][_0x6830('0x75')][_0x1fe114]),'ChatQueueId':Number(_0x6ed7a7['params']['id'])});}return _0x44e38a;});}})[_0x6830('0x24')](respondWithResult(_0x107609,null))[_0x6830('0x2f')](handleError(_0x107609,null));};exports[_0x6830('0x97')]=function(_0x332581,_0x1be9f0,_0x3af3e9){return db[_0x6830('0x45')]['find']({'where':{'id':_0x332581[_0x6830('0x5e')]['id']}})[_0x6830('0x24')](handleEntityNotFound(_0x1be9f0,null))[_0x6830('0x24')](function(_0x1c5eaf){if(_0x1c5eaf){return _0x1c5eaf[_0x6830('0x97')](_0x332581[_0x6830('0x4a')][_0x6830('0x75')])[_0x6830('0x24')](function(){if(_[_0x6830('0x9d')](_0x332581[_0x6830('0x4a')]['ids'])){for(var _0x5a6df3=0x0;_0x5a6df3<_0x332581[_0x6830('0x4a')][_0x6830('0x75')][_0x6830('0x5f')];_0x5a6df3+=0x1){socket[_0x6830('0x7e')](_0x6830('0x99'),{'UserId':Number(_0x332581[_0x6830('0x4a')]['ids'][_0x5a6df3]),'ChatQueueId':Number(_0x332581[_0x6830('0x5e')]['id'])});}}else{socket[_0x6830('0x7e')](_0x6830('0x99'),{'UserId':Number(_0x332581[_0x6830('0x4a')][_0x6830('0x75')]),'ChatQueueId':Number(_0x332581[_0x6830('0x5e')]['id'])});}});}})[_0x6830('0x24')](respondWithStatusCode(_0x1be9f0,null))['catch'](handleError(_0x1be9f0,null));};exports['getAgents']=function(_0x2861c6,_0x552993,_0x735b32){var _0x46cf74={};var _0x839c1f={};var _0x7b3f6f;var _0xef79e6;return db[_0x6830('0x45')][_0x6830('0x71')]({'where':{'id':_0x2861c6[_0x6830('0x5e')]['id']}})[_0x6830('0x24')](handleEntityNotFound(_0x552993,null))[_0x6830('0x24')](function(_0x1fcde8){if(_0x1fcde8){_0x7b3f6f=_0x1fcde8;_0x839c1f['model']=_['keys'](db[_0x6830('0x6a')]['rawAttributes']);_0x839c1f[_0x6830('0x4a')]=_[_0x6830('0x4b')](_0x2861c6[_0x6830('0x4a')]);_0x839c1f[_0x6830('0x4c')]=_[_0x6830('0x4d')](_0x839c1f[_0x6830('0x4e')],_0x839c1f[_0x6830('0x4a')]);_0x46cf74[_0x6830('0x4f')]=_[_0x6830('0x4d')](_0x839c1f[_0x6830('0x4e')],qs[_0x6830('0x50')](_0x2861c6['query'][_0x6830('0x50')]));_0x46cf74[_0x6830('0x4f')]=_0x46cf74[_0x6830('0x4f')][_0x6830('0x5f')]?_0x46cf74[_0x6830('0x4f')]:_0x839c1f[_0x6830('0x4e')];_0x46cf74[_0x6830('0x53')]=qs[_0x6830('0x54')](_0x2861c6['query'][_0x6830('0x54')]);_0x46cf74['where']=qs[_0x6830('0x4c')](_['pick'](_0x2861c6[_0x6830('0x4a')],_0x839c1f['filters']));if(_0x2861c6['query']['filter']){_0x46cf74[_0x6830('0x55')]=_[_0x6830('0x60')](_0x46cf74['where'],{'$or':_[_0x6830('0x44')](_0x46cf74[_0x6830('0x4f')],function(_0x17fc94){var _0x49ec12={};_0x49ec12[_0x17fc94]={'$like':'%'+_0x2861c6[_0x6830('0x4a')][_0x6830('0x57')]+'%'};return _0x49ec12;})});}_0x46cf74=_[_0x6830('0x60')]({},_0x46cf74,_0x2861c6[_0x6830('0x59')]);return _0x7b3f6f[_0x6830('0x9e')](_0x46cf74);}})['then'](function(_0x54e716){if(_0x54e716){_0xef79e6=_0x54e716[_0x6830('0x5f')];if(!_0x2861c6[_0x6830('0x4a')]['hasOwnProperty']('nolimit')){_0x46cf74['limit']=qs[_0x6830('0x34')](_0x2861c6[_0x6830('0x4a')][_0x6830('0x34')]);_0x46cf74[_0x6830('0x32')]=qs[_0x6830('0x32')](_0x2861c6[_0x6830('0x4a')][_0x6830('0x32')]);}return _0x7b3f6f['getAgents'](_0x46cf74);}})[_0x6830('0x24')](function(_0x455eda){if(_0x455eda){return _0x455eda?{'count':_0xef79e6,'rows':_0x455eda}:null;}})[_0x6830('0x24')](respondWithResult(_0x552993,null))[_0x6830('0x2f')](handleError(_0x552993,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index ecc9247..8bfa21e 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 _0xe632=['events','../../mysqldb','ChatQueue','save','emit','hasOwnProperty','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe632,0x1b2));var _0x2e63=function(_0xdfb025,_0x7c3249){_0xdfb025=_0xdfb025-0x0;var _0xd46ffb=_0xe632[_0xdfb025];return _0xd46ffb;};'use strict';var EventEmitter=require(_0x2e63('0x0'));var ChatQueue=require(_0x2e63('0x1'))['db'][_0x2e63('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2e63('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x593c09){return function(_0x3cc8d9,_0x483582,_0x1695fd){ChatQueueEvents['emit'](_0x593c09+':'+_0x3cc8d9['id'],_0x3cc8d9);ChatQueueEvents[_0x2e63('0x4')](_0x593c09,_0x3cc8d9);_0x1695fd(null);};}for(var e in events){if(events[_0x2e63('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x2e63('0x6')]=ChatQueueEvents; \ No newline at end of file +var _0x8a81=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','ChatQueue'];(function(_0x218c2c,_0x1db202){var _0xe7d467=function(_0x2b2708){while(--_0x2b2708){_0x218c2c['push'](_0x218c2c['shift']());}};_0xe7d467(++_0x1db202);}(_0x8a81,0x1da));var _0x18a8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x8a81[_0x19950b];return _0x3c6b41;};'use strict';var EventEmitter=require(_0x18a8('0x0'));var ChatQueue=require(_0x18a8('0x1'))['db'][_0x18a8('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x18a8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x18a8('0x4'),'afterDestroy':_0x18a8('0x5')};function emitEvent(_0x137a14){return function(_0x22c518,_0x24a716,_0x1a1221){ChatQueueEvents['emit'](_0x137a14+':'+_0x22c518['id'],_0x22c518);ChatQueueEvents[_0x18a8('0x6')](_0x137a14,_0x22c518);_0x1a1221(null);};}for(var e in events){if(events[_0x18a8('0x7')](e)){var event=events[e];ChatQueue[_0x18a8('0x8')](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 2dd5a88..f87afb4 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 _0xee8d=['util','../../config/logger','api','bluebird','path','../../config/environment','ChatQueue','chat_queues'];(function(_0x4c77f3,_0x2ece5f){var _0x2c5022=function(_0x44f6fa){while(--_0x44f6fa){_0x4c77f3['push'](_0x4c77f3['shift']());}};_0x2c5022(++_0x2ece5f);}(_0xee8d,0x1b0));var _0xdee8=function(_0x34f8c9,_0x93c983){_0x34f8c9=_0x34f8c9-0x0;var _0xf7828c=_0xee8d[_0x34f8c9];return _0xf7828c;};'use strict';var _=require('lodash');var util=require(_0xdee8('0x0'));var logger=require(_0xdee8('0x1'))(_0xdee8('0x2'));var moment=require('moment');var BPromise=require(_0xdee8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdee8('0x4'));var rimraf=require('rimraf');var config=require(_0xdee8('0x5'));var attributes=require('./chatQueue.attributes');module['exports']=function(_0x5f256a,_0x390e35){return _0x5f256a['define'](_0xdee8('0x6'),attributes,{'tableName':_0xdee8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6cc=['ChatQueue','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes'];(function(_0x527b81,_0x167f05){var _0x6b4b26=function(_0x3db465){while(--_0x3db465){_0x527b81['push'](_0x527b81['shift']());}};_0x6b4b26(++_0x167f05);}(_0xf6cc,0x119));var _0xcf6c=function(_0x13d04f,_0x2276e0){_0x13d04f=_0x13d04f-0x0;var _0x28f335=_0xf6cc[_0x13d04f];return _0x28f335;};'use strict';var _=require(_0xcf6c('0x0'));var util=require(_0xcf6c('0x1'));var logger=require('../../config/logger')(_0xcf6c('0x2'));var moment=require(_0xcf6c('0x3'));var BPromise=require('bluebird');var rp=require(_0xcf6c('0x4'));var fs=require('fs');var path=require(_0xcf6c('0x5'));var rimraf=require(_0xcf6c('0x6'));var config=require(_0xcf6c('0x7'));var attributes=require(_0xcf6c('0x8'));module['exports']=function(_0x1669c0,_0xd5ea88){return _0x1669c0['define'](_0xcf6c('0x9'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 248f6bc..2d667fb 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(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x737e,0x1cc));var _0xe737=function(_0x5758b7,_0x43690b){_0x5758b7=_0x5758b7-0x0;var _0x1323d6=_0x737e[_0x5758b7];return _0x1323d6;};'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 _0x199c=['attributes','limit','include','map','model','raw','where','info','ShowChatQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','./chatQueue.socket','register','request','then','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','catch','GetChatQueue','ChatQueue','findAll','options'];(function(_0x11e268,_0x7325a){var _0x2765e4=function(_0x4725e2){while(--_0x4725e2){_0x11e268['push'](_0x11e268['shift']());}};_0x2765e4(++_0x7325a);}(_0x199c,0x7b));var _0xc199=function(_0x1bddc1,_0x36a9c6){_0x1bddc1=_0x1bddc1-0x0;var _0x25ddd0=_0x199c[_0x1bddc1];return _0x25ddd0;};'use strict';var _=require(_0xc199('0x0'));var util=require(_0xc199('0x1'));var moment=require(_0xc199('0x2'));var BPromise=require('bluebird');var rs=require(_0xc199('0x3'));var fs=require('fs');var Redis=require(_0xc199('0x4'));var db=require(_0xc199('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc199('0x6'));var config=require(_0xc199('0x7'));var jayson=require(_0xc199('0x8'));var client=jayson[_0xc199('0x9')][_0xc199('0xa')]({'port':0x232a});config[_0xc199('0xb')]=_['defaults'](config[_0xc199('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc199('0xc'))[_0xc199('0xd')](socket);function respondWithRpcPromise(_0xc971a8,_0x4b472c,_0x35f923){return new BPromise(function(_0x44db95,_0x596249){return client[_0xc199('0xe')](_0xc971a8,_0x35f923)[_0xc199('0xf')](function(_0x3b7ec6){logger['info']('ChatQueue,\x20%s,\x20%s',_0x4b472c,'request\x20sent');logger[_0xc199('0x10')](_0xc199('0x11'),_0x4b472c,_0xc199('0x12'),JSON[_0xc199('0x13')](_0x3b7ec6));if(_0x3b7ec6[_0xc199('0x14')]){if(_0x3b7ec6[_0xc199('0x14')][_0xc199('0x15')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4b472c,_0x3b7ec6[_0xc199('0x14')][_0xc199('0x16')]);return _0x596249(_0x3b7ec6[_0xc199('0x14')][_0xc199('0x16')]);}logger[_0xc199('0x14')](_0xc199('0x17'),_0x4b472c,_0x3b7ec6['error'][_0xc199('0x16')]);return _0x44db95(_0x3b7ec6[_0xc199('0x14')][_0xc199('0x16')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x4b472c,_0xc199('0x12'));_0x44db95(_0x3b7ec6['result']['message']);}})[_0xc199('0x18')](function(_0x488501){logger[_0xc199('0x14')](_0xc199('0x17'),_0x4b472c,_0x488501);_0x596249(_0x488501);});});}exports[_0xc199('0x19')]=function(_0x3f5506){var _0x1478b2=this;return new Promise(function(_0x24d50c,_0x2fb987){return db[_0xc199('0x1a')][_0xc199('0x1b')]({'raw':_0x3f5506['options']?_0x3f5506[_0xc199('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3f5506[_0xc199('0x1c')]?_0x3f5506[_0xc199('0x1c')]['where']||null:null,'attributes':_0x3f5506[_0xc199('0x1c')]?_0x3f5506['options'][_0xc199('0x1d')]||null:null,'limit':_0x3f5506[_0xc199('0x1c')]?_0x3f5506[_0xc199('0x1c')][_0xc199('0x1e')]||null:null,'include':_0x3f5506[_0xc199('0x1c')]?_0x3f5506[_0xc199('0x1c')][_0xc199('0x1f')]?_[_0xc199('0x20')](_0x3f5506['options'][_0xc199('0x1f')],function(_0x2626fc){return{'model':db[_0x2626fc[_0xc199('0x21')]],'as':_0x2626fc['as'],'attributes':_0x2626fc[_0xc199('0x1d')],'include':_0x2626fc[_0xc199('0x1f')]?_[_0xc199('0x20')](_0x2626fc[_0xc199('0x1f')],function(_0x526d72){return{'model':db[_0x526d72[_0xc199('0x21')]],'as':_0x526d72['as'],'attributes':_0x526d72[_0xc199('0x1d')],'include':_0x526d72[_0xc199('0x1f')]?_[_0xc199('0x20')](_0x526d72[_0xc199('0x1f')],function(_0x2dbaaf){return{'model':db[_0x2dbaaf[_0xc199('0x21')]],'as':_0x2dbaaf['as'],'attributes':_0x2dbaaf[_0xc199('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc199('0xf')](function(_0xf16093){logger['info']('GetChatQueue',_0x3f5506);logger[_0xc199('0x10')]('GetChatQueue',_0x3f5506,JSON['stringify'](_0xf16093));_0x24d50c(_0xf16093);})[_0xc199('0x18')](function(_0x5f15e9){logger['error'](_0xc199('0x19'),_0x5f15e9[_0xc199('0x16')],_0x3f5506);_0x2fb987(_0x1478b2[_0xc199('0x14')](0x1f4,_0x5f15e9[_0xc199('0x16')]));});});};exports['ShowChatQueue']=function(_0x42be5d){var _0x59a193=this;return new Promise(function(_0xbd6526,_0x43743d){return db['ChatQueue']['find']({'raw':_0x42be5d[_0xc199('0x1c')]?_0x42be5d[_0xc199('0x1c')][_0xc199('0x22')]===undefined?!![]:![]:!![],'where':_0x42be5d[_0xc199('0x1c')]?_0x42be5d[_0xc199('0x1c')][_0xc199('0x23')]||null:null,'attributes':_0x42be5d['options']?_0x42be5d[_0xc199('0x1c')][_0xc199('0x1d')]||null:null,'include':_0x42be5d[_0xc199('0x1c')]?_0x42be5d[_0xc199('0x1c')]['include']?_['map'](_0x42be5d['options'][_0xc199('0x1f')],function(_0x181abc){return{'model':db[_0x181abc[_0xc199('0x21')]],'as':_0x181abc['as'],'attributes':_0x181abc[_0xc199('0x1d')],'include':_0x181abc['include']?_[_0xc199('0x20')](_0x181abc[_0xc199('0x1f')],function(_0x30b211){return{'model':db[_0x30b211[_0xc199('0x21')]],'as':_0x30b211['as'],'attributes':_0x30b211[_0xc199('0x1d')],'include':_0x30b211['include']?_[_0xc199('0x20')](_0x30b211[_0xc199('0x1f')],function(_0xdc8ac2){return{'model':db[_0xdc8ac2[_0xc199('0x21')]],'as':_0xdc8ac2['as'],'attributes':_0xdc8ac2[_0xc199('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc199('0xf')](function(_0x10a077){logger[_0xc199('0x24')]('ShowChatQueue',_0x42be5d);logger[_0xc199('0x10')](_0xc199('0x25'),_0x42be5d,JSON['stringify'](_0x10a077));_0xbd6526(_0x10a077);})[_0xc199('0x18')](function(_0x5742a9){logger[_0xc199('0x14')](_0xc199('0x25'),_0x5742a9['message'],_0x42be5d);_0x43743d(_0x59a193['error'](0x1f4,_0x5742a9[_0xc199('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 2bed69f..4b9e9ee 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 _0x54ef=['remove','emit','removeListener','length','./chatQueue.events','save'];(function(_0xe84ffe,_0x9ae5f){var _0x47a4af=function(_0x45344d){while(--_0x45344d){_0xe84ffe['push'](_0xe84ffe['shift']());}};_0x47a4af(++_0x9ae5f);}(_0x54ef,0x112));var _0xf54e=function(_0x3faa35,_0x899e80){_0x3faa35=_0x3faa35-0x0;var _0x107fdd=_0x54ef[_0x3faa35];return _0x107fdd;};'use strict';var ChatQueueEvents=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(){ChatQueueEvents[_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('chatQueue:'+_0x561870,_0x55e611);ChatQueueEvents['on'](_0x561870,_0x27e69b);}}; \ No newline at end of file +var _0xe13a=['update','emit','removeListener','register','chatQueue:','save','remove'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0xe13a,0x178));var _0xae13=function(_0x96587c,_0x27cb58){_0x96587c=_0x96587c-0x0;var _0x33a69d=_0xe13a[_0x96587c];return _0x33a69d;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xae13('0x0'),_0xae13('0x1'),_0xae13('0x2')];function createListener(_0x6066c0,_0x4cf961){return function(_0x3aaf90){_0x4cf961[_0xae13('0x3')](_0x6066c0,_0x3aaf90);};}function removeListener(_0x3ebbfe,_0x10abd7){return function(){ChatQueueEvents[_0xae13('0x4')](_0x3ebbfe,_0x10abd7);};}exports[_0xae13('0x5')]=function(_0x412a07){for(var _0x3379ed=0x0,_0x341ba4=events['length'];_0x3379ed<_0x341ba4;_0x3379ed++){var _0x2f6d10=events[_0x3379ed];var _0x2b2e1f=createListener(_0xae13('0x6')+_0x2f6d10,_0x412a07);ChatQueueEvents['on'](_0x2f6d10,_0x2b2e1f);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 4d33305..44e65d2 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5f1591,_0x38669b){var _0x5ee47a=function(_0x39283b){while(--_0x39283b){_0x5f1591['push'](_0x5f1591['shift']());}};_0x5ee47a(++_0x38669b);}(_0x008c,0x188));var _0xc008=function(_0x25e109,_0x6ab24c){_0x25e109=_0x25e109-0x0;var _0xc0f7d6=_0x008c[_0x25e109];return _0xc0f7d6;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0x5fc3[_0x5447aa];return _0xb21e53;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 733d09b..84c4ad2 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 _0x2397=['DATE','exports','STRING'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x2397,0x142));var _0x7239=function(_0x386265,_0x5542ae){_0x386265=_0x386265-0x0;var _0x25e58a=_0x2397[_0x386265];return _0x25e58a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x7239('0x0')]={'uniqueid':{'type':Sequelize[_0x7239('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x7239('0x1')]},'joinAt':{'type':Sequelize[_0x7239('0x2')]},'leaveAt':{'type':Sequelize[_0x7239('0x2')]},'acceptAt':{'type':Sequelize[_0x7239('0x2')]},'exitAt':{'type':Sequelize[_0x7239('0x2')]},'reason':{'type':Sequelize[_0x7239('0x1')]}}; \ No newline at end of file +var _0x1c00=['exports','STRING','DATE','sequelize'];(function(_0x2aeee5,_0x151b16){var _0xf5f89b=function(_0x52415e){while(--_0x52415e){_0x2aeee5['push'](_0x2aeee5['shift']());}};_0xf5f89b(++_0x151b16);}(_0x1c00,0x137));var _0x01c0=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x1c00[_0x4c12ec];return _0x3ae42c;};'use strict';var moment=require('moment');var Sequelize=require(_0x01c0('0x0'));module[_0x01c0('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x01c0('0x2')]},'joinAt':{'type':Sequelize[_0x01c0('0x3')]},'leaveAt':{'type':Sequelize[_0x01c0('0x3')]},'acceptAt':{'type':Sequelize[_0x01c0('0x3')]},'exitAt':{'type':Sequelize[_0x01c0('0x3')]},'reason':{'type':Sequelize[_0x01c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index bb17bb9..43712b1 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 _0x3e24=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','error','name','send','index','map','ChatQueueReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','update','describe','eml-format'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x3e24,0x167));var _0x43e2=function(_0x3ce0e2,_0x3ca132){_0x3ce0e2=_0x3ce0e2-0x0;var _0x36fb36=_0x3e24[_0x3ce0e2];return _0x36fb36;};'use strict';var emlformat=require(_0x43e2('0x0'));var rimraf=require(_0x43e2('0x1'));var zipdir=require(_0x43e2('0x2'));var jsonpatch=require(_0x43e2('0x3'));var rp=require(_0x43e2('0x4'));var moment=require('moment');var BPromise=require(_0x43e2('0x5'));var Mustache=require(_0x43e2('0x6'));var util=require('util');var path=require(_0x43e2('0x7'));var sox=require(_0x43e2('0x8'));var csv=require(_0x43e2('0x9'));var ejs=require(_0x43e2('0xa'));var fs=require('fs');var fs_extra=require(_0x43e2('0xb'));var _=require(_0x43e2('0xc'));var squel=require(_0x43e2('0xd'));var crypto=require('crypto');var jsforce=require(_0x43e2('0xe'));var deskjs=require(_0x43e2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x43e2('0x10'));var Papa=require(_0x43e2('0x11'));var Redis=require('ioredis');var authService=require(_0x43e2('0x12'));var qs=require(_0x43e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43e2('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x43e2('0x15'));var licenseUtil=require(_0x43e2('0x16'));var db=require(_0x43e2('0x17'))['db'];function respondWithStatusCode(_0x44781a,_0x43ba14){_0x43ba14=_0x43ba14||0xcc;return function(_0x68e82d){if(_0x68e82d){return _0x44781a[_0x43e2('0x18')](_0x43ba14);}return _0x44781a[_0x43e2('0x19')](_0x43ba14)[_0x43e2('0x1a')]();};}function respondWithResult(_0x218ae7,_0x377097){_0x377097=_0x377097||0xc8;return function(_0x3ccccd){if(_0x3ccccd){return _0x218ae7['status'](_0x377097)[_0x43e2('0x1b')](_0x3ccccd);}};}function respondWithFilteredResult(_0x40fb7b,_0xb929b5){return function(_0x2a0fb0){if(_0x2a0fb0){var _0x5cea01=typeof _0xb929b5['offset']===_0x43e2('0x1c')&&typeof _0xb929b5[_0x43e2('0x1d')]===_0x43e2('0x1c');var _0x3a27eb=_0x2a0fb0[_0x43e2('0x1e')];var _0x1b7cde=_0x5cea01?0x0:_0xb929b5[_0x43e2('0x1f')];var _0x15ecb5=_0x5cea01?_0x2a0fb0[_0x43e2('0x1e')]:_0xb929b5[_0x43e2('0x1f')]+_0xb929b5['limit'];var _0x3ee34c;if(_0x15ecb5>=_0x3a27eb){_0x15ecb5=_0x3a27eb;_0x3ee34c=0xc8;}else{_0x3ee34c=0xce;}_0x40fb7b[_0x43e2('0x19')](_0x3ee34c);return _0x40fb7b['set'](_0x43e2('0x20'),_0x1b7cde+'-'+_0x15ecb5+'/'+_0x3a27eb)['json'](_0x2a0fb0);}return null;};}function patchUpdates(_0x3bc2ce){return function(_0x13610f){try{jsonpatch[_0x43e2('0x21')](_0x13610f,_0x3bc2ce,!![]);}catch(_0x23825c){return BPromise[_0x43e2('0x22')](_0x23825c);}return _0x13610f['save']();};}function saveUpdates(_0x3b0357,_0x12d842){return function(_0x272934){if(_0x272934){return _0x272934['update'](_0x3b0357)[_0x43e2('0x23')](function(_0x32f048){return _0x32f048;});}return null;};}function removeEntity(_0x43078f,_0x11b285){return function(_0x4f20e6){if(_0x4f20e6){return _0x4f20e6[_0x43e2('0x24')]()[_0x43e2('0x23')](function(){_0x43078f[_0x43e2('0x19')](0xcc)[_0x43e2('0x1a')]();});}};}function handleEntityNotFound(_0x178223,_0x2a593e){return function(_0x3ca16b){if(!_0x3ca16b){_0x178223[_0x43e2('0x18')](0x194);}return _0x3ca16b;};}function handleError(_0xd29b7b,_0x1ec68e){_0x1ec68e=_0x1ec68e||0x1f4;return function(_0x1ea844){logger[_0x43e2('0x25')](_0x1ea844['stack']);if(_0x1ea844[_0x43e2('0x26')]){delete _0x1ea844[_0x43e2('0x26')];}_0xd29b7b['status'](_0x1ec68e)[_0x43e2('0x27')](_0x1ea844);};}exports[_0x43e2('0x28')]=function(_0x2dffa2,_0x404483){var _0x3fd232={},_0x5a896b={},_0x42f495={'count':0x0,'rows':[]};var _0xd1b43a=_[_0x43e2('0x29')](db[_0x43e2('0x2a')][_0x43e2('0x2b')],function(_0x30bdcb){return{'name':_0x30bdcb['fieldName'],'type':_0x30bdcb['type'][_0x43e2('0x2c')]};});_0x5a896b[_0x43e2('0x2d')]=_[_0x43e2('0x29')](_0xd1b43a,_0x43e2('0x26'));_0x5a896b[_0x43e2('0x2e')]=_['keys'](_0x2dffa2[_0x43e2('0x2e')]);_0x5a896b[_0x43e2('0x2f')]=_[_0x43e2('0x30')](_0x5a896b[_0x43e2('0x2d')],_0x5a896b[_0x43e2('0x2e')]);_0x3fd232[_0x43e2('0x31')]=_[_0x43e2('0x30')](_0x5a896b['model'],qs['fields'](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x32')]));_0x3fd232['attributes']=_0x3fd232[_0x43e2('0x31')][_0x43e2('0x33')]?_0x3fd232['attributes']:_0x5a896b[_0x43e2('0x2d')];if(!_0x2dffa2['query']['hasOwnProperty']('nolimit')){_0x3fd232[_0x43e2('0x1d')]=qs['limit'](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x1d')]);_0x3fd232[_0x43e2('0x1f')]=qs[_0x43e2('0x1f')](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x1f')]);}_0x3fd232[_0x43e2('0x34')]=qs[_0x43e2('0x35')](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x35')]);_0x3fd232[_0x43e2('0x36')]=qs[_0x43e2('0x2f')](_[_0x43e2('0x37')](_0x2dffa2[_0x43e2('0x2e')],_0x5a896b[_0x43e2('0x2f')]),_0xd1b43a);if(_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x38')]){_0x3fd232['where']=_['merge'](_0x3fd232['where'],{'$or':_[_0x43e2('0x29')](_0xd1b43a,function(_0x13af7f){if(_0x13af7f['type']!=='VIRTUAL'){var _0x2b5fce={};_0x2b5fce[_0x13af7f[_0x43e2('0x26')]]={'$like':'%'+_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x38')]+'%'};return _0x2b5fce;}})});}_0x3fd232=_[_0x43e2('0x39')]({},_0x3fd232,_0x2dffa2[_0x43e2('0x3a')]);var _0x2afcdd={'where':_0x3fd232[_0x43e2('0x36')]};return db[_0x43e2('0x2a')][_0x43e2('0x1e')](_0x2afcdd)[_0x43e2('0x23')](function(_0x257de9){_0x42f495[_0x43e2('0x1e')]=_0x257de9;if(_0x2dffa2[_0x43e2('0x2e')]['includeAll']){_0x3fd232[_0x43e2('0x3b')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x43e2('0x3c')](_0x3fd232);})['then'](function(_0x19ce1b){_0x42f495[_0x43e2('0x3d')]=_0x19ce1b;return _0x42f495;})[_0x43e2('0x23')](respondWithFilteredResult(_0x404483,_0x3fd232))['catch'](handleError(_0x404483,null));};exports[_0x43e2('0x3e')]=function(_0x5ca5d0,_0x1ba4cf){var _0x36f94a={'raw':!![],'where':{'id':_0x5ca5d0[_0x43e2('0x3f')]['id']}},_0x34f2b5={};_0x34f2b5['model']=_['keys'](db[_0x43e2('0x2a')][_0x43e2('0x2b')]);_0x34f2b5[_0x43e2('0x2e')]=_[_0x43e2('0x40')](_0x5ca5d0['query']);_0x34f2b5[_0x43e2('0x2f')]=_[_0x43e2('0x30')](_0x34f2b5[_0x43e2('0x2d')],_0x34f2b5[_0x43e2('0x2e')]);_0x36f94a[_0x43e2('0x31')]=_['intersection'](_0x34f2b5[_0x43e2('0x2d')],qs['fields'](_0x5ca5d0[_0x43e2('0x2e')][_0x43e2('0x32')]));_0x36f94a['attributes']=_0x36f94a[_0x43e2('0x31')]['length']?_0x36f94a['attributes']:_0x34f2b5[_0x43e2('0x2d')];if(_0x5ca5d0[_0x43e2('0x2e')][_0x43e2('0x41')]){_0x36f94a[_0x43e2('0x3b')]=[{'all':!![]}];}_0x36f94a=_[_0x43e2('0x39')]({},_0x36f94a,_0x5ca5d0['options']);return db[_0x43e2('0x2a')][_0x43e2('0x42')](_0x36f94a)[_0x43e2('0x23')](handleEntityNotFound(_0x1ba4cf,null))[_0x43e2('0x23')](respondWithResult(_0x1ba4cf,null))[_0x43e2('0x43')](handleError(_0x1ba4cf,null));};exports[_0x43e2('0x44')]=function(_0x29a9ef,_0x2462db){return db['ChatQueueReport'][_0x43e2('0x44')](_0x29a9ef[_0x43e2('0x45')],{})['then'](respondWithResult(_0x2462db,0xc9))[_0x43e2('0x43')](handleError(_0x2462db,null));};exports[_0x43e2('0x46')]=function(_0x466f65,_0x8bc721){if(_0x466f65['body']['id']){delete _0x466f65[_0x43e2('0x45')]['id'];}return db[_0x43e2('0x2a')][_0x43e2('0x42')]({'where':{'id':_0x466f65[_0x43e2('0x3f')]['id']}})[_0x43e2('0x23')](handleEntityNotFound(_0x8bc721,null))['then'](saveUpdates(_0x466f65['body'],null))[_0x43e2('0x23')](respondWithResult(_0x8bc721,null))[_0x43e2('0x43')](handleError(_0x8bc721,null));};exports['destroy']=function(_0x2a40a5,_0x28a101){return db[_0x43e2('0x2a')]['find']({'where':{'id':_0x2a40a5['params']['id']}})[_0x43e2('0x23')](handleEntityNotFound(_0x28a101,null))[_0x43e2('0x23')](removeEntity(_0x28a101,null))[_0x43e2('0x43')](handleError(_0x28a101,null));};exports[_0x43e2('0x47')]=function(_0x1a9283,_0x278730){return db[_0x43e2('0x2a')][_0x43e2('0x47')]()[_0x43e2('0x23')](respondWithResult(_0x278730,null))['catch'](handleError(_0x278730,null));}; \ No newline at end of file +var _0x93bb=['includeAll','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','then','destroy','error','stack','name','send','map','ChatQueueReport','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys'];(function(_0x1e9bf5,_0x2b8466){var _0x3e43a0=function(_0x4f74dd){while(--_0x4f74dd){_0x1e9bf5['push'](_0x1e9bf5['shift']());}};_0x3e43a0(++_0x2b8466);}(_0x93bb,0x135));var _0xb93b=function(_0x2524a1,_0x533bb6){_0x2524a1=_0x2524a1-0x0;var _0x3beff7=_0x93bb[_0x2524a1];return _0x3beff7;};'use strict';var emlformat=require(_0xb93b('0x0'));var rimraf=require(_0xb93b('0x1'));var zipdir=require(_0xb93b('0x2'));var jsonpatch=require(_0xb93b('0x3'));var rp=require(_0xb93b('0x4'));var moment=require(_0xb93b('0x5'));var BPromise=require(_0xb93b('0x6'));var Mustache=require(_0xb93b('0x7'));var util=require(_0xb93b('0x8'));var path=require(_0xb93b('0x9'));var sox=require('sox');var csv=require(_0xb93b('0xa'));var ejs=require(_0xb93b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb93b('0xc'));var squel=require(_0xb93b('0xd'));var crypto=require('crypto');var jsforce=require(_0xb93b('0xe'));var deskjs=require(_0xb93b('0xf'));var toCsv=require(_0xb93b('0xa'));var querystring=require(_0xb93b('0x10'));var Papa=require(_0xb93b('0x11'));var Redis=require(_0xb93b('0x12'));var authService=require(_0xb93b('0x13'));var qs=require(_0xb93b('0x14'));var as=require(_0xb93b('0x15'));var hardwareService=require(_0xb93b('0x16'));var logger=require(_0xb93b('0x17'))('api');var utils=require(_0xb93b('0x18'));var config=require(_0xb93b('0x19'));var licenseUtil=require(_0xb93b('0x1a'));var db=require(_0xb93b('0x1b'))['db'];function respondWithStatusCode(_0x5ccabd,_0x44291c){_0x44291c=_0x44291c||0xcc;return function(_0x17f7b0){if(_0x17f7b0){return _0x5ccabd[_0xb93b('0x1c')](_0x44291c);}return _0x5ccabd[_0xb93b('0x1d')](_0x44291c)[_0xb93b('0x1e')]();};}function respondWithResult(_0x29d02e,_0x12ce38){_0x12ce38=_0x12ce38||0xc8;return function(_0x58c73b){if(_0x58c73b){return _0x29d02e[_0xb93b('0x1d')](_0x12ce38)[_0xb93b('0x1f')](_0x58c73b);}};}function respondWithFilteredResult(_0x4281b6,_0x1f6c4b){return function(_0x9e9479){if(_0x9e9479){var _0x1debd0=typeof _0x1f6c4b['offset']===_0xb93b('0x20')&&typeof _0x1f6c4b['limit']===_0xb93b('0x20');var _0x1f4300=_0x9e9479[_0xb93b('0x21')];var _0x11f85b=_0x1debd0?0x0:_0x1f6c4b[_0xb93b('0x22')];var _0x385100=_0x1debd0?_0x9e9479['count']:_0x1f6c4b[_0xb93b('0x22')]+_0x1f6c4b[_0xb93b('0x23')];var _0x3567cf;if(_0x385100>=_0x1f4300){_0x385100=_0x1f4300;_0x3567cf=0xc8;}else{_0x3567cf=0xce;}_0x4281b6[_0xb93b('0x1d')](_0x3567cf);return _0x4281b6[_0xb93b('0x24')](_0xb93b('0x25'),_0x11f85b+'-'+_0x385100+'/'+_0x1f4300)['json'](_0x9e9479);}return null;};}function patchUpdates(_0x57adc7){return function(_0x50f944){try{jsonpatch['apply'](_0x50f944,_0x57adc7,!![]);}catch(_0x1add64){return BPromise['reject'](_0x1add64);}return _0x50f944['save']();};}function saveUpdates(_0xdcf20c,_0x3e57aa){return function(_0x295c61){if(_0x295c61){return _0x295c61['update'](_0xdcf20c)[_0xb93b('0x26')](function(_0x31166b){return _0x31166b;});}return null;};}function removeEntity(_0x5beca0,_0x2cab58){return function(_0x2c6505){if(_0x2c6505){return _0x2c6505[_0xb93b('0x27')]()[_0xb93b('0x26')](function(){_0x5beca0[_0xb93b('0x1d')](0xcc)[_0xb93b('0x1e')]();});}};}function handleEntityNotFound(_0x4e4e16,_0x452483){return function(_0x13d5ad){if(!_0x13d5ad){_0x4e4e16[_0xb93b('0x1c')](0x194);}return _0x13d5ad;};}function handleError(_0x474928,_0x53c665){_0x53c665=_0x53c665||0x1f4;return function(_0x394d37){logger[_0xb93b('0x28')](_0x394d37[_0xb93b('0x29')]);if(_0x394d37[_0xb93b('0x2a')]){delete _0x394d37[_0xb93b('0x2a')];}_0x474928[_0xb93b('0x1d')](_0x53c665)[_0xb93b('0x2b')](_0x394d37);};}exports['index']=function(_0xb79c23,_0x5a9182){var _0x3d835a={},_0x41f593={},_0x60c609={'count':0x0,'rows':[]};var _0x2b31b1=_[_0xb93b('0x2c')](db[_0xb93b('0x2d')][_0xb93b('0x2e')],function(_0x42ee85){return{'name':_0x42ee85[_0xb93b('0x2f')],'type':_0x42ee85['type']['key']};});_0x41f593[_0xb93b('0x30')]=_[_0xb93b('0x2c')](_0x2b31b1,_0xb93b('0x2a'));_0x41f593['query']=_['keys'](_0xb79c23[_0xb93b('0x31')]);_0x41f593[_0xb93b('0x32')]=_[_0xb93b('0x33')](_0x41f593['model'],_0x41f593['query']);_0x3d835a[_0xb93b('0x34')]=_[_0xb93b('0x33')](_0x41f593[_0xb93b('0x30')],qs[_0xb93b('0x35')](_0xb79c23[_0xb93b('0x31')][_0xb93b('0x35')]));_0x3d835a[_0xb93b('0x34')]=_0x3d835a['attributes'][_0xb93b('0x36')]?_0x3d835a[_0xb93b('0x34')]:_0x41f593[_0xb93b('0x30')];if(!_0xb79c23[_0xb93b('0x31')][_0xb93b('0x37')](_0xb93b('0x38'))){_0x3d835a[_0xb93b('0x23')]=qs['limit'](_0xb79c23[_0xb93b('0x31')][_0xb93b('0x23')]);_0x3d835a[_0xb93b('0x22')]=qs[_0xb93b('0x22')](_0xb79c23[_0xb93b('0x31')][_0xb93b('0x22')]);}_0x3d835a[_0xb93b('0x39')]=qs['sort'](_0xb79c23[_0xb93b('0x31')][_0xb93b('0x3a')]);_0x3d835a[_0xb93b('0x3b')]=qs[_0xb93b('0x32')](_[_0xb93b('0x3c')](_0xb79c23[_0xb93b('0x31')],_0x41f593[_0xb93b('0x32')]),_0x2b31b1);if(_0xb79c23[_0xb93b('0x31')][_0xb93b('0x3d')]){_0x3d835a[_0xb93b('0x3b')]=_[_0xb93b('0x3e')](_0x3d835a[_0xb93b('0x3b')],{'$or':_[_0xb93b('0x2c')](_0x2b31b1,function(_0x2adc47){if(_0x2adc47['type']!==_0xb93b('0x3f')){var _0x1462d4={};_0x1462d4[_0x2adc47['name']]={'$like':'%'+_0xb79c23[_0xb93b('0x31')][_0xb93b('0x3d')]+'%'};return _0x1462d4;}})});}_0x3d835a=_[_0xb93b('0x3e')]({},_0x3d835a,_0xb79c23[_0xb93b('0x40')]);var _0x8f34e9={'where':_0x3d835a[_0xb93b('0x3b')]};return db['ChatQueueReport'][_0xb93b('0x21')](_0x8f34e9)[_0xb93b('0x26')](function(_0x10ad42){_0x60c609[_0xb93b('0x21')]=_0x10ad42;if(_0xb79c23['query']['includeAll']){_0x3d835a[_0xb93b('0x41')]=[{'all':!![]}];}return db[_0xb93b('0x2d')][_0xb93b('0x42')](_0x3d835a);})[_0xb93b('0x26')](function(_0x53aaaa){_0x60c609[_0xb93b('0x43')]=_0x53aaaa;return _0x60c609;})['then'](respondWithFilteredResult(_0x5a9182,_0x3d835a))[_0xb93b('0x44')](handleError(_0x5a9182,null));};exports['show']=function(_0x382261,_0x6f9464){var _0x159d3b={'raw':!![],'where':{'id':_0x382261[_0xb93b('0x45')]['id']}},_0x3b1617={};_0x3b1617[_0xb93b('0x30')]=_[_0xb93b('0x46')](db['ChatQueueReport'][_0xb93b('0x2e')]);_0x3b1617['query']=_[_0xb93b('0x46')](_0x382261['query']);_0x3b1617['filters']=_[_0xb93b('0x33')](_0x3b1617[_0xb93b('0x30')],_0x3b1617[_0xb93b('0x31')]);_0x159d3b[_0xb93b('0x34')]=_[_0xb93b('0x33')](_0x3b1617['model'],qs['fields'](_0x382261[_0xb93b('0x31')][_0xb93b('0x35')]));_0x159d3b[_0xb93b('0x34')]=_0x159d3b['attributes'][_0xb93b('0x36')]?_0x159d3b[_0xb93b('0x34')]:_0x3b1617['model'];if(_0x382261[_0xb93b('0x31')][_0xb93b('0x47')]){_0x159d3b[_0xb93b('0x41')]=[{'all':!![]}];}_0x159d3b=_[_0xb93b('0x3e')]({},_0x159d3b,_0x382261['options']);return db[_0xb93b('0x2d')][_0xb93b('0x48')](_0x159d3b)['then'](handleEntityNotFound(_0x6f9464,null))[_0xb93b('0x26')](respondWithResult(_0x6f9464,null))[_0xb93b('0x44')](handleError(_0x6f9464,null));};exports['create']=function(_0x4951fe,_0x31bd33){return db[_0xb93b('0x2d')]['create'](_0x4951fe[_0xb93b('0x49')],{})[_0xb93b('0x26')](respondWithResult(_0x31bd33,0xc9))[_0xb93b('0x44')](handleError(_0x31bd33,null));};exports[_0xb93b('0x4a')]=function(_0x1b3ca9,_0x2b47d4){if(_0x1b3ca9['body']['id']){delete _0x1b3ca9[_0xb93b('0x49')]['id'];}return db[_0xb93b('0x2d')]['find']({'where':{'id':_0x1b3ca9[_0xb93b('0x45')]['id']}})['then'](handleEntityNotFound(_0x2b47d4,null))[_0xb93b('0x26')](saveUpdates(_0x1b3ca9[_0xb93b('0x49')],null))[_0xb93b('0x26')](respondWithResult(_0x2b47d4,null))[_0xb93b('0x44')](handleError(_0x2b47d4,null));};exports[_0xb93b('0x27')]=function(_0x536890,_0x56f7ea){return db[_0xb93b('0x2d')][_0xb93b('0x48')]({'where':{'id':_0x536890[_0xb93b('0x45')]['id']}})[_0xb93b('0x26')](handleEntityNotFound(_0x56f7ea,null))[_0xb93b('0x26')](removeEntity(_0x56f7ea,null))[_0xb93b('0x44')](handleError(_0x56f7ea,null));};exports[_0xb93b('0x4b')]=function(_0x49797b,_0x48c2df){return db['ChatQueueReport'][_0xb93b('0x4b')]()['then'](respondWithResult(_0x48c2df,null))['catch'](handleError(_0x48c2df,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 3c2ba4d..3994921 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x3fe447,_0x13342f){var _0xff8b51=function(_0xcb0660){while(--_0xcb0660){_0x3fe447['push'](_0x3fe447['shift']());}};_0xff8b51(++_0x13342f);}(_0x757a,0xde));var _0xa757=function(_0x2ac320,_0x9d1262){_0x2ac320=_0x2ac320-0x0;var _0x113201=_0x757a[_0x2ac320];return _0x113201;};'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 +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x572400,_0x54a61e){var _0x2d108d=function(_0x5ccdee){while(--_0x5ccdee){_0x572400['push'](_0x572400['shift']());}};_0x2d108d(++_0x54a61e);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0xb7e7[_0x34843e];return _0x598f7f;};'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_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index e6dcc84..ad53ad0 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 _0x82cf=['info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','options','raw','stringify','catch','UpdateChatQueueReport','update','attributes','limit','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x431669,_0x4e9544){var _0x203780=function(_0x40c7ae){while(--_0x40c7ae){_0x431669['push'](_0x431669['shift']());}};_0x203780(++_0x4e9544);}(_0x82cf,0xc8));var _0xf82c=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x82cf[_0x491cbe];return _0x59449d;};'use strict';var _=require('lodash');var util=require(_0xf82c('0x0'));var moment=require(_0xf82c('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf82c('0x2'));var db=require(_0xf82c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf82c('0x4'))(_0xf82c('0x5'));var config=require(_0xf82c('0x6'));var jayson=require(_0xf82c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a98e1,_0x1ea382,_0x5ce9ae){return new BPromise(function(_0x2c0ba3,_0x5a3939){return client[_0xf82c('0x8')](_0x4a98e1,_0x5ce9ae)[_0xf82c('0x9')](function(_0x1c777b){logger[_0xf82c('0xa')](_0xf82c('0xb'),_0x1ea382,_0xf82c('0xc'));logger[_0xf82c('0xd')](_0xf82c('0xe'),_0x1ea382,_0xf82c('0xc'),JSON['stringify'](_0x1c777b));if(_0x1c777b[_0xf82c('0xf')]){if(_0x1c777b[_0xf82c('0xf')][_0xf82c('0x10')]===0x1f4){logger['error'](_0xf82c('0xb'),_0x1ea382,_0x1c777b['error'][_0xf82c('0x11')]);return _0x5a3939(_0x1c777b['error'][_0xf82c('0x11')]);}logger[_0xf82c('0xf')](_0xf82c('0xb'),_0x1ea382,_0x1c777b[_0xf82c('0xf')][_0xf82c('0x11')]);return _0x2c0ba3(_0x1c777b['error'][_0xf82c('0x11')]);}else{logger[_0xf82c('0xa')](_0xf82c('0xb'),_0x1ea382,_0xf82c('0xc'));_0x2c0ba3(_0x1c777b[_0xf82c('0x12')][_0xf82c('0x11')]);}})['catch'](function(_0xce558a){logger[_0xf82c('0xf')](_0xf82c('0xb'),_0x1ea382,_0xce558a);_0x5a3939(_0xce558a);});});}exports[_0xf82c('0x13')]=function(_0x5077bd){var _0x4edadd=this;return new Promise(function(_0x40214c,_0x5addbe){return db[_0xf82c('0x14')][_0xf82c('0x15')](_0x5077bd['body'],{'raw':_0x5077bd[_0xf82c('0x16')]?_0x5077bd[_0xf82c('0x16')][_0xf82c('0x17')]===undefined?!![]:![]:!![]})[_0xf82c('0x9')](function(_0x2a0a2b){logger[_0xf82c('0xa')](_0xf82c('0x13'),_0x5077bd);logger[_0xf82c('0xd')](_0xf82c('0x13'),_0x5077bd,JSON[_0xf82c('0x18')](_0x2a0a2b));_0x40214c(_0x2a0a2b);})[_0xf82c('0x19')](function(_0xcb65e4){logger[_0xf82c('0xf')](_0xf82c('0x13'),_0xcb65e4[_0xf82c('0x11')],_0x5077bd);_0x5addbe(_0x4edadd[_0xf82c('0xf')](0x1f4,_0xcb65e4[_0xf82c('0x11')]));});});};exports[_0xf82c('0x1a')]=function(_0x488f4e){var _0x2c4ddc=this;return new Promise(function(_0x5b40ce,_0x4a8279){return db[_0xf82c('0x14')][_0xf82c('0x1b')](_0x488f4e['body'],{'raw':_0x488f4e['options']?_0x488f4e[_0xf82c('0x16')][_0xf82c('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x488f4e['options']?_0x488f4e[_0xf82c('0x16')]['where']||null:null,'attributes':_0x488f4e[_0xf82c('0x16')]?_0x488f4e['options'][_0xf82c('0x1c')]||null:null,'limit':_0x488f4e[_0xf82c('0x16')]?_0x488f4e[_0xf82c('0x16')][_0xf82c('0x1d')]||null:null})['then'](function(_0x4857be){logger[_0xf82c('0xa')]('UpdateChatQueueReport',_0x488f4e);logger[_0xf82c('0xd')](_0xf82c('0x1a'),_0x488f4e,JSON[_0xf82c('0x18')](_0x4857be));_0x5b40ce(_0x4857be);})[_0xf82c('0x19')](function(_0x7db9a7){logger['error'](_0xf82c('0x1a'),_0x7db9a7['message'],_0x488f4e);_0x4a8279(_0x2c4ddc[_0xf82c('0xf')](0x1f4,_0x7db9a7[_0xf82c('0x11')]));});});}; \ No newline at end of file +var _0x0f22=['error','code','message','result','catch','CreateChatQueueReport','create','body','options','raw','info','UpdateChatQueueReport','ChatQueueReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x1a75c9,_0x11e344){var _0x3d2b86=function(_0x52b31a){while(--_0x52b31a){_0x1a75c9['push'](_0x1a75c9['shift']());}};_0x3d2b86(++_0x11e344);}(_0x0f22,0xab));var _0x20f2=function(_0x3d07ac,_0x48e276){_0x3d07ac=_0x3d07ac-0x0;var _0x5b88ce=_0x0f22[_0x3d07ac];return _0x5b88ce;};'use strict';var _=require(_0x20f2('0x0'));var util=require(_0x20f2('0x1'));var moment=require(_0x20f2('0x2'));var BPromise=require(_0x20f2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x20f2('0x5'));var logger=require('../../config/logger')(_0x20f2('0x6'));var config=require(_0x20f2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x20f2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582628,_0x1c1085,_0xecb331){return new BPromise(function(_0x1cacd9,_0x1a6f9c){return client[_0x20f2('0x9')](_0x582628,_0xecb331)[_0x20f2('0xa')](function(_0x2cf9bc){logger['info'](_0x20f2('0xb'),_0x1c1085,_0x20f2('0xc'));logger[_0x20f2('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x1c1085,_0x20f2('0xc'),JSON[_0x20f2('0xe')](_0x2cf9bc));if(_0x2cf9bc[_0x20f2('0xf')]){if(_0x2cf9bc['error'][_0x20f2('0x10')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x1c1085,_0x2cf9bc[_0x20f2('0xf')][_0x20f2('0x11')]);return _0x1a6f9c(_0x2cf9bc[_0x20f2('0xf')][_0x20f2('0x11')]);}logger[_0x20f2('0xf')](_0x20f2('0xb'),_0x1c1085,_0x2cf9bc[_0x20f2('0xf')][_0x20f2('0x11')]);return _0x1cacd9(_0x2cf9bc[_0x20f2('0xf')]['message']);}else{logger['info'](_0x20f2('0xb'),_0x1c1085,_0x20f2('0xc'));_0x1cacd9(_0x2cf9bc[_0x20f2('0x12')][_0x20f2('0x11')]);}})[_0x20f2('0x13')](function(_0x114508){logger[_0x20f2('0xf')](_0x20f2('0xb'),_0x1c1085,_0x114508);_0x1a6f9c(_0x114508);});});}exports[_0x20f2('0x14')]=function(_0x5c4d61){var _0xd537d7=this;return new Promise(function(_0x4290c7,_0x5839f9){return db['ChatQueueReport'][_0x20f2('0x15')](_0x5c4d61[_0x20f2('0x16')],{'raw':_0x5c4d61[_0x20f2('0x17')]?_0x5c4d61[_0x20f2('0x17')][_0x20f2('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x34272e){logger[_0x20f2('0x19')](_0x20f2('0x14'),_0x5c4d61);logger[_0x20f2('0xd')](_0x20f2('0x14'),_0x5c4d61,JSON['stringify'](_0x34272e));_0x4290c7(_0x34272e);})[_0x20f2('0x13')](function(_0x4156ba){logger['error'](_0x20f2('0x14'),_0x4156ba['message'],_0x5c4d61);_0x5839f9(_0xd537d7[_0x20f2('0xf')](0x1f4,_0x4156ba['message']));});});};exports[_0x20f2('0x1a')]=function(_0x50721c){var _0x1b9d3f=this;return new Promise(function(_0x1bc25b,_0x37d81f){return db[_0x20f2('0x1b')][_0x20f2('0x1c')](_0x50721c[_0x20f2('0x16')],{'raw':_0x50721c[_0x20f2('0x17')]?_0x50721c[_0x20f2('0x17')][_0x20f2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50721c['options']?_0x50721c[_0x20f2('0x17')][_0x20f2('0x1d')]||null:null,'attributes':_0x50721c[_0x20f2('0x17')]?_0x50721c[_0x20f2('0x17')]['attributes']||null:null,'limit':_0x50721c[_0x20f2('0x17')]?_0x50721c[_0x20f2('0x17')][_0x20f2('0x1e')]||null:null})['then'](function(_0x3abfe8){logger['info']('UpdateChatQueueReport',_0x50721c);logger[_0x20f2('0xd')](_0x20f2('0x1a'),_0x50721c,JSON[_0x20f2('0xe')](_0x3abfe8));_0x1bc25b(_0x3abfe8);})[_0x20f2('0x13')](function(_0x3e6b8e){logger[_0x20f2('0xf')](_0x20f2('0x1a'),_0x3e6b8e[_0x20f2('0x11')],_0x50721c);_0x37d81f(_0x1b9d3f['error'](0x1f4,_0x3e6b8e[_0x20f2('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index f29543a..ae4792f 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 _0xa4bb=['connect-timeout','Router','fs-extra','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','destroy','exports','multer','util','path'];(function(_0x4512e9,_0x31bc06){var _0xd1fb=function(_0x32296e){while(--_0x32296e){_0x4512e9['push'](_0x4512e9['shift']());}};_0xd1fb(++_0x31bc06);}(_0xa4bb,0x18d));var _0xba4b=function(_0x438cb6,_0x354c86){_0x438cb6=_0x438cb6-0x0;var _0x113a8c=_0xa4bb[_0x438cb6];return _0x113a8c;};'use strict';var multer=require(_0xba4b('0x0'));var util=require(_0xba4b('0x1'));var path=require(_0xba4b('0x2'));var timeout=require(_0xba4b('0x3'));var express=require('express');var router=express[_0xba4b('0x4')]();var fs_extra=require(_0xba4b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xba4b('0x6'));var config=require('../../config/environment');var controller=require(_0xba4b('0x7'));router[_0xba4b('0x8')]('/',auth[_0xba4b('0x9')](),controller[_0xba4b('0xa')]);router[_0xba4b('0x8')](_0xba4b('0xb'),auth[_0xba4b('0x9')](),controller[_0xba4b('0xc')]);router[_0xba4b('0x8')](_0xba4b('0xd'),auth[_0xba4b('0x9')](),controller['show']);router[_0xba4b('0xe')]('/',auth[_0xba4b('0x9')](),controller[_0xba4b('0xf')]);router['put'](_0xba4b('0xd'),auth[_0xba4b('0x9')](),controller[_0xba4b('0x10')]);router[_0xba4b('0x11')](_0xba4b('0xd'),auth[_0xba4b('0x9')](),controller[_0xba4b('0x12')]);module[_0xba4b('0x13')]=router; \ No newline at end of file +var _0xbc99=['isAuthenticated','index','/describe','describe','/:id','show','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','get'];(function(_0x3cca69,_0x25aae7){var _0x4d7901=function(_0x2c442f){while(--_0x2c442f){_0x3cca69['push'](_0x3cca69['shift']());}};_0x4d7901(++_0x25aae7);}(_0xbc99,0xf7));var _0x9bc9=function(_0xeb8400,_0x34392c){_0xeb8400=_0xeb8400-0x0;var _0x52d09a=_0xbc99[_0xeb8400];return _0x52d09a;};'use strict';var multer=require(_0x9bc9('0x0'));var util=require(_0x9bc9('0x1'));var path=require(_0x9bc9('0x2'));var timeout=require(_0x9bc9('0x3'));var express=require(_0x9bc9('0x4'));var router=express[_0x9bc9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9bc9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x9bc9('0x7')]('/',auth[_0x9bc9('0x8')](),controller[_0x9bc9('0x9')]);router[_0x9bc9('0x7')](_0x9bc9('0xa'),auth[_0x9bc9('0x8')](),controller[_0x9bc9('0xb')]);router[_0x9bc9('0x7')](_0x9bc9('0xc'),auth[_0x9bc9('0x8')](),controller[_0x9bc9('0xd')]);router['post']('/',auth[_0x9bc9('0x8')](),controller['create']);router['put'](_0x9bc9('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x9bc9('0xe')](_0x9bc9('0xc'),auth[_0x9bc9('0x8')](),controller[_0x9bc9('0xf')]);module[_0x9bc9('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 6b13797..2911c17 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x2cf0c2,_0x3de1f3){var _0x41359c=function(_0x21497b){while(--_0x21497b){_0x2cf0c2['push'](_0x2cf0c2['shift']());}};_0x41359c(++_0x3de1f3);}(_0x70e0,0x17b));var _0x070e=function(_0x29e070,_0x3a9d00){_0x29e070=_0x29e070-0x0;var _0x1e7be8=_0x70e0[_0x29e070];return _0x1e7be8;};'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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1a1d9b,_0x5ea65a){var _0x1d7a59=function(_0xa1dea2){while(--_0xa1dea2){_0x1a1d9b['push'](_0x1a1d9b['shift']());}};_0x1d7a59(++_0x5ea65a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 7f939e7..47d5268 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 _0x4c19=['model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','ChatTransferReport','type','key'];(function(_0x138c85,_0x4fcec4){var _0x16500d=function(_0x2f6b63){while(--_0x2f6b63){_0x138c85['push'](_0x138c85['shift']());}};_0x16500d(++_0x4fcec4);}(_0x4c19,0x140));var _0x94c1=function(_0x4bdc8c,_0x1f57d2){_0x4bdc8c=_0x4bdc8c-0x0;var _0x4565e2=_0x4c19[_0x4bdc8c];return _0x4565e2;};'use strict';var emlformat=require(_0x94c1('0x0'));var rimraf=require(_0x94c1('0x1'));var zipdir=require(_0x94c1('0x2'));var jsonpatch=require(_0x94c1('0x3'));var rp=require(_0x94c1('0x4'));var moment=require(_0x94c1('0x5'));var BPromise=require(_0x94c1('0x6'));var Mustache=require(_0x94c1('0x7'));var util=require(_0x94c1('0x8'));var path=require(_0x94c1('0x9'));var sox=require(_0x94c1('0xa'));var csv=require(_0x94c1('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x94c1('0xc'));var jsforce=require(_0x94c1('0xd'));var deskjs=require(_0x94c1('0xe'));var toCsv=require(_0x94c1('0xb'));var querystring=require(_0x94c1('0xf'));var Papa=require(_0x94c1('0x10'));var Redis=require(_0x94c1('0x11'));var authService=require(_0x94c1('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x94c1('0x13'))('api');var utils=require(_0x94c1('0x14'));var config=require(_0x94c1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x94c1('0x16'))['db'];function respondWithStatusCode(_0x3d5d54,_0xce29bf){_0xce29bf=_0xce29bf||0xcc;return function(_0x45d4cf){if(_0x45d4cf){return _0x3d5d54[_0x94c1('0x17')](_0xce29bf);}return _0x3d5d54[_0x94c1('0x18')](_0xce29bf)[_0x94c1('0x19')]();};}function respondWithResult(_0x4f1156,_0x571e54){_0x571e54=_0x571e54||0xc8;return function(_0xa2475){if(_0xa2475){return _0x4f1156['status'](_0x571e54)['json'](_0xa2475);}};}function respondWithFilteredResult(_0x5956ab,_0x3b1d4c){return function(_0x349952){if(_0x349952){var _0x22702e=typeof _0x3b1d4c[_0x94c1('0x1a')]===_0x94c1('0x1b')&&typeof _0x3b1d4c['limit']===_0x94c1('0x1b');var _0x2eb6e9=_0x349952[_0x94c1('0x1c')];var _0x454431=_0x22702e?0x0:_0x3b1d4c[_0x94c1('0x1a')];var _0x3df9b2=_0x22702e?_0x349952[_0x94c1('0x1c')]:_0x3b1d4c[_0x94c1('0x1a')]+_0x3b1d4c[_0x94c1('0x1d')];var _0x26c7e2;if(_0x3df9b2>=_0x2eb6e9){_0x3df9b2=_0x2eb6e9;_0x26c7e2=0xc8;}else{_0x26c7e2=0xce;}_0x5956ab[_0x94c1('0x18')](_0x26c7e2);return _0x5956ab[_0x94c1('0x1e')](_0x94c1('0x1f'),_0x454431+'-'+_0x3df9b2+'/'+_0x2eb6e9)['json'](_0x349952);}return null;};}function patchUpdates(_0x4490eb){return function(_0x8cfa44){try{jsonpatch[_0x94c1('0x20')](_0x8cfa44,_0x4490eb,!![]);}catch(_0x204c4b){return BPromise[_0x94c1('0x21')](_0x204c4b);}return _0x8cfa44[_0x94c1('0x22')]();};}function saveUpdates(_0x212c63,_0x5ad4d8){return function(_0x6cd5e0){if(_0x6cd5e0){return _0x6cd5e0[_0x94c1('0x23')](_0x212c63)[_0x94c1('0x24')](function(_0x5ed049){return _0x5ed049;});}return null;};}function removeEntity(_0x2d35b7,_0x12729e){return function(_0x27f5e3){if(_0x27f5e3){return _0x27f5e3[_0x94c1('0x25')]()[_0x94c1('0x24')](function(){_0x2d35b7[_0x94c1('0x18')](0xcc)[_0x94c1('0x19')]();});}};}function handleEntityNotFound(_0x46e8ce,_0x144665){return function(_0x13ce7b){if(!_0x13ce7b){_0x46e8ce[_0x94c1('0x17')](0x194);}return _0x13ce7b;};}function handleError(_0xd72ad9,_0x1cc6f1){_0x1cc6f1=_0x1cc6f1||0x1f4;return function(_0x510eb9){logger['error'](_0x510eb9[_0x94c1('0x26')]);if(_0x510eb9[_0x94c1('0x27')]){delete _0x510eb9[_0x94c1('0x27')];}_0xd72ad9[_0x94c1('0x18')](_0x1cc6f1)[_0x94c1('0x28')](_0x510eb9);};}exports['index']=function(_0x57076c,_0x3033a3){var _0x80ccc4={},_0x2fbe81={},_0x4e73b4={'count':0x0,'rows':[]};var _0x5c38d4=_[_0x94c1('0x29')](db[_0x94c1('0x2a')]['rawAttributes'],function(_0x365278){return{'name':_0x365278['fieldName'],'type':_0x365278[_0x94c1('0x2b')][_0x94c1('0x2c')]};});_0x2fbe81[_0x94c1('0x2d')]=_[_0x94c1('0x29')](_0x5c38d4,_0x94c1('0x27'));_0x2fbe81[_0x94c1('0x2e')]=_[_0x94c1('0x2f')](_0x57076c[_0x94c1('0x2e')]);_0x2fbe81[_0x94c1('0x30')]=_[_0x94c1('0x31')](_0x2fbe81[_0x94c1('0x2d')],_0x2fbe81[_0x94c1('0x2e')]);_0x80ccc4['attributes']=_[_0x94c1('0x31')](_0x2fbe81['model'],qs['fields'](_0x57076c[_0x94c1('0x2e')][_0x94c1('0x32')]));_0x80ccc4['attributes']=_0x80ccc4[_0x94c1('0x33')][_0x94c1('0x34')]?_0x80ccc4[_0x94c1('0x33')]:_0x2fbe81[_0x94c1('0x2d')];if(!_0x57076c[_0x94c1('0x2e')]['hasOwnProperty'](_0x94c1('0x35'))){_0x80ccc4[_0x94c1('0x1d')]=qs[_0x94c1('0x1d')](_0x57076c[_0x94c1('0x2e')][_0x94c1('0x1d')]);_0x80ccc4[_0x94c1('0x1a')]=qs[_0x94c1('0x1a')](_0x57076c[_0x94c1('0x2e')][_0x94c1('0x1a')]);}_0x80ccc4[_0x94c1('0x36')]=qs[_0x94c1('0x37')](_0x57076c[_0x94c1('0x2e')][_0x94c1('0x37')]);_0x80ccc4[_0x94c1('0x38')]=qs[_0x94c1('0x30')](_['pick'](_0x57076c[_0x94c1('0x2e')],_0x2fbe81[_0x94c1('0x30')]),_0x5c38d4);if(_0x57076c['query'][_0x94c1('0x39')]){_0x80ccc4[_0x94c1('0x38')]=_[_0x94c1('0x3a')](_0x80ccc4[_0x94c1('0x38')],{'$or':_[_0x94c1('0x29')](_0x5c38d4,function(_0x31e3e4){if(_0x31e3e4[_0x94c1('0x2b')]!==_0x94c1('0x3b')){var _0x195992={};_0x195992[_0x31e3e4[_0x94c1('0x27')]]={'$like':'%'+_0x57076c[_0x94c1('0x2e')][_0x94c1('0x39')]+'%'};return _0x195992;}})});}_0x80ccc4=_['merge']({},_0x80ccc4,_0x57076c[_0x94c1('0x3c')]);var _0x156210={'where':_0x80ccc4[_0x94c1('0x38')]};return db[_0x94c1('0x2a')][_0x94c1('0x1c')](_0x156210)[_0x94c1('0x24')](function(_0x4ba904){_0x4e73b4['count']=_0x4ba904;if(_0x57076c[_0x94c1('0x2e')][_0x94c1('0x3d')]){_0x80ccc4[_0x94c1('0x3e')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x94c1('0x3f')](_0x80ccc4);})['then'](function(_0x2697a8){_0x4e73b4[_0x94c1('0x40')]=_0x2697a8;return _0x4e73b4;})['then'](respondWithFilteredResult(_0x3033a3,_0x80ccc4))[_0x94c1('0x41')](handleError(_0x3033a3,null));};exports[_0x94c1('0x42')]=function(_0x4f3760,_0x390568){var _0x1cb766={'raw':!![],'where':{'id':_0x4f3760[_0x94c1('0x43')]['id']}},_0x2565e5={};_0x2565e5[_0x94c1('0x2d')]=_[_0x94c1('0x2f')](db[_0x94c1('0x2a')][_0x94c1('0x44')]);_0x2565e5[_0x94c1('0x2e')]=_[_0x94c1('0x2f')](_0x4f3760[_0x94c1('0x2e')]);_0x2565e5['filters']=_[_0x94c1('0x31')](_0x2565e5[_0x94c1('0x2d')],_0x2565e5[_0x94c1('0x2e')]);_0x1cb766[_0x94c1('0x33')]=_[_0x94c1('0x31')](_0x2565e5[_0x94c1('0x2d')],qs[_0x94c1('0x32')](_0x4f3760[_0x94c1('0x2e')][_0x94c1('0x32')]));_0x1cb766[_0x94c1('0x33')]=_0x1cb766['attributes'][_0x94c1('0x34')]?_0x1cb766[_0x94c1('0x33')]:_0x2565e5[_0x94c1('0x2d')];if(_0x4f3760[_0x94c1('0x2e')][_0x94c1('0x3d')]){_0x1cb766[_0x94c1('0x3e')]=[{'all':!![]}];}_0x1cb766=_[_0x94c1('0x3a')]({},_0x1cb766,_0x4f3760['options']);return db['ChatTransferReport']['find'](_0x1cb766)[_0x94c1('0x24')](handleEntityNotFound(_0x390568,null))[_0x94c1('0x24')](respondWithResult(_0x390568,null))[_0x94c1('0x41')](handleError(_0x390568,null));};exports[_0x94c1('0x45')]=function(_0x368ea,_0x1f1e73){return db['ChatTransferReport']['create'](_0x368ea[_0x94c1('0x46')],{})[_0x94c1('0x24')](respondWithResult(_0x1f1e73,0xc9))[_0x94c1('0x41')](handleError(_0x1f1e73,null));};exports[_0x94c1('0x23')]=function(_0x113bdd,_0x3033a1){if(_0x113bdd[_0x94c1('0x46')]['id']){delete _0x113bdd[_0x94c1('0x46')]['id'];}return db[_0x94c1('0x2a')][_0x94c1('0x47')]({'where':{'id':_0x113bdd[_0x94c1('0x43')]['id']}})['then'](handleEntityNotFound(_0x3033a1,null))[_0x94c1('0x24')](saveUpdates(_0x113bdd[_0x94c1('0x46')],null))[_0x94c1('0x24')](respondWithResult(_0x3033a1,null))['catch'](handleError(_0x3033a1,null));};exports['destroy']=function(_0x397a3e,_0x1595f0){return db[_0x94c1('0x2a')]['find']({'where':{'id':_0x397a3e[_0x94c1('0x43')]['id']}})[_0x94c1('0x24')](handleEntityNotFound(_0x1595f0,null))[_0x94c1('0x24')](removeEntity(_0x1595f0,null))[_0x94c1('0x41')](handleError(_0x1595f0,null));};exports['describe']=function(_0x17efb2,_0x32b593){return db['ChatTransferReport'][_0x94c1('0x48')]()[_0x94c1('0x24')](respondWithResult(_0x32b593,null))['catch'](handleError(_0x32b593,null));}; \ No newline at end of file +var _0x92c6=['ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x29e871,_0x330b98){var _0x3380e3=function(_0x26eeae){while(--_0x26eeae){_0x29e871['push'](_0x29e871['shift']());}};_0x3380e3(++_0x330b98);}(_0x92c6,0x67));var _0x692c=function(_0x1716f1,_0x2b49de){_0x1716f1=_0x1716f1-0x0;var _0x42d6ff=_0x92c6[_0x1716f1];return _0x42d6ff;};'use strict';var emlformat=require(_0x692c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x692c('0x1'));var jsonpatch=require(_0x692c('0x2'));var rp=require(_0x692c('0x3'));var moment=require('moment');var BPromise=require(_0x692c('0x4'));var Mustache=require('mustache');var util=require(_0x692c('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x692c('0x6'));var fs=require('fs');var fs_extra=require(_0x692c('0x7'));var _=require('lodash');var squel=require(_0x692c('0x8'));var crypto=require(_0x692c('0x9'));var jsforce=require(_0x692c('0xa'));var deskjs=require(_0x692c('0xb'));var toCsv=require(_0x692c('0xc'));var querystring=require(_0x692c('0xd'));var Papa=require(_0x692c('0xe'));var Redis=require(_0x692c('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x692c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x692c('0x11'));var logger=require('../../config/logger')(_0x692c('0x12'));var utils=require(_0x692c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x692c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x197248,_0x51aeae){_0x51aeae=_0x51aeae||0xcc;return function(_0x299b71){if(_0x299b71){return _0x197248[_0x692c('0x15')](_0x51aeae);}return _0x197248[_0x692c('0x16')](_0x51aeae)[_0x692c('0x17')]();};}function respondWithResult(_0x1bc8a9,_0x357d61){_0x357d61=_0x357d61||0xc8;return function(_0x12a56d){if(_0x12a56d){return _0x1bc8a9['status'](_0x357d61)['json'](_0x12a56d);}};}function respondWithFilteredResult(_0x5e7c28,_0x23466d){return function(_0x553e6f){if(_0x553e6f){var _0x243a19=typeof _0x23466d[_0x692c('0x18')]===_0x692c('0x19')&&typeof _0x23466d[_0x692c('0x1a')]==='undefined';var _0x5b1ed0=_0x553e6f[_0x692c('0x1b')];var _0xb18243=_0x243a19?0x0:_0x23466d[_0x692c('0x18')];var _0x2d90a9=_0x243a19?_0x553e6f[_0x692c('0x1b')]:_0x23466d[_0x692c('0x18')]+_0x23466d[_0x692c('0x1a')];var _0x3bfba4;if(_0x2d90a9>=_0x5b1ed0){_0x2d90a9=_0x5b1ed0;_0x3bfba4=0xc8;}else{_0x3bfba4=0xce;}_0x5e7c28[_0x692c('0x16')](_0x3bfba4);return _0x5e7c28[_0x692c('0x1c')](_0x692c('0x1d'),_0xb18243+'-'+_0x2d90a9+'/'+_0x5b1ed0)['json'](_0x553e6f);}return null;};}function patchUpdates(_0x4af0da){return function(_0x2621b1){try{jsonpatch[_0x692c('0x1e')](_0x2621b1,_0x4af0da,!![]);}catch(_0x19118c){return BPromise[_0x692c('0x1f')](_0x19118c);}return _0x2621b1[_0x692c('0x20')]();};}function saveUpdates(_0x1187f4,_0x8b32b2){return function(_0x2708ce){if(_0x2708ce){return _0x2708ce[_0x692c('0x21')](_0x1187f4)[_0x692c('0x22')](function(_0x21a540){return _0x21a540;});}return null;};}function removeEntity(_0x7bf338,_0x1c0e7e){return function(_0x1866f8){if(_0x1866f8){return _0x1866f8[_0x692c('0x23')]()['then'](function(){_0x7bf338[_0x692c('0x16')](0xcc)[_0x692c('0x17')]();});}};}function handleEntityNotFound(_0x4f589a,_0x24cbdc){return function(_0x464f74){if(!_0x464f74){_0x4f589a[_0x692c('0x15')](0x194);}return _0x464f74;};}function handleError(_0x114c89,_0x1d15b9){_0x1d15b9=_0x1d15b9||0x1f4;return function(_0x451b10){logger[_0x692c('0x24')](_0x451b10[_0x692c('0x25')]);if(_0x451b10[_0x692c('0x26')]){delete _0x451b10['name'];}_0x114c89[_0x692c('0x16')](_0x1d15b9)[_0x692c('0x27')](_0x451b10);};}exports[_0x692c('0x28')]=function(_0x3b41bf,_0x16514b){var _0xc3bd8b={},_0x164379={},_0x1ed0b4={'count':0x0,'rows':[]};var _0xf8212e=_['map'](db[_0x692c('0x29')][_0x692c('0x2a')],function(_0x547e88){return{'name':_0x547e88[_0x692c('0x2b')],'type':_0x547e88[_0x692c('0x2c')][_0x692c('0x2d')]};});_0x164379[_0x692c('0x2e')]=_[_0x692c('0x2f')](_0xf8212e,'name');_0x164379[_0x692c('0x30')]=_[_0x692c('0x31')](_0x3b41bf[_0x692c('0x30')]);_0x164379['filters']=_[_0x692c('0x32')](_0x164379[_0x692c('0x2e')],_0x164379[_0x692c('0x30')]);_0xc3bd8b[_0x692c('0x33')]=_['intersection'](_0x164379['model'],qs[_0x692c('0x34')](_0x3b41bf[_0x692c('0x30')][_0x692c('0x34')]));_0xc3bd8b[_0x692c('0x33')]=_0xc3bd8b['attributes'][_0x692c('0x35')]?_0xc3bd8b[_0x692c('0x33')]:_0x164379[_0x692c('0x2e')];if(!_0x3b41bf[_0x692c('0x30')][_0x692c('0x36')](_0x692c('0x37'))){_0xc3bd8b[_0x692c('0x1a')]=qs['limit'](_0x3b41bf[_0x692c('0x30')]['limit']);_0xc3bd8b[_0x692c('0x18')]=qs[_0x692c('0x18')](_0x3b41bf[_0x692c('0x30')][_0x692c('0x18')]);}_0xc3bd8b[_0x692c('0x38')]=qs[_0x692c('0x39')](_0x3b41bf[_0x692c('0x30')][_0x692c('0x39')]);_0xc3bd8b[_0x692c('0x3a')]=qs[_0x692c('0x3b')](_['pick'](_0x3b41bf['query'],_0x164379[_0x692c('0x3b')]),_0xf8212e);if(_0x3b41bf[_0x692c('0x30')][_0x692c('0x3c')]){_0xc3bd8b[_0x692c('0x3a')]=_[_0x692c('0x3d')](_0xc3bd8b['where'],{'$or':_['map'](_0xf8212e,function(_0x4492cb){if(_0x4492cb[_0x692c('0x2c')]!=='VIRTUAL'){var _0x362257={};_0x362257[_0x4492cb[_0x692c('0x26')]]={'$like':'%'+_0x3b41bf[_0x692c('0x30')]['filter']+'%'};return _0x362257;}})});}_0xc3bd8b=_[_0x692c('0x3d')]({},_0xc3bd8b,_0x3b41bf['options']);var _0x3be8ae={'where':_0xc3bd8b[_0x692c('0x3a')]};return db['ChatTransferReport'][_0x692c('0x1b')](_0x3be8ae)[_0x692c('0x22')](function(_0x4b80a0){_0x1ed0b4[_0x692c('0x1b')]=_0x4b80a0;if(_0x3b41bf['query']['includeAll']){_0xc3bd8b[_0x692c('0x3e')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x692c('0x3f')](_0xc3bd8b);})[_0x692c('0x22')](function(_0x25ccd6){_0x1ed0b4[_0x692c('0x40')]=_0x25ccd6;return _0x1ed0b4;})[_0x692c('0x22')](respondWithFilteredResult(_0x16514b,_0xc3bd8b))[_0x692c('0x41')](handleError(_0x16514b,null));};exports[_0x692c('0x42')]=function(_0x481d63,_0x138aa3){var _0x4b7f33={'raw':!![],'where':{'id':_0x481d63[_0x692c('0x43')]['id']}},_0x4c65ab={};_0x4c65ab[_0x692c('0x2e')]=_[_0x692c('0x31')](db[_0x692c('0x29')][_0x692c('0x2a')]);_0x4c65ab[_0x692c('0x30')]=_['keys'](_0x481d63['query']);_0x4c65ab[_0x692c('0x3b')]=_[_0x692c('0x32')](_0x4c65ab[_0x692c('0x2e')],_0x4c65ab['query']);_0x4b7f33[_0x692c('0x33')]=_[_0x692c('0x32')](_0x4c65ab[_0x692c('0x2e')],qs[_0x692c('0x34')](_0x481d63[_0x692c('0x30')][_0x692c('0x34')]));_0x4b7f33[_0x692c('0x33')]=_0x4b7f33[_0x692c('0x33')][_0x692c('0x35')]?_0x4b7f33[_0x692c('0x33')]:_0x4c65ab['model'];if(_0x481d63[_0x692c('0x30')]['includeAll']){_0x4b7f33[_0x692c('0x3e')]=[{'all':!![]}];}_0x4b7f33=_['merge']({},_0x4b7f33,_0x481d63['options']);return db[_0x692c('0x29')][_0x692c('0x44')](_0x4b7f33)[_0x692c('0x22')](handleEntityNotFound(_0x138aa3,null))[_0x692c('0x22')](respondWithResult(_0x138aa3,null))['catch'](handleError(_0x138aa3,null));};exports[_0x692c('0x45')]=function(_0x393b83,_0x16e13e){return db[_0x692c('0x29')][_0x692c('0x45')](_0x393b83[_0x692c('0x46')],{})[_0x692c('0x22')](respondWithResult(_0x16e13e,0xc9))[_0x692c('0x41')](handleError(_0x16e13e,null));};exports[_0x692c('0x21')]=function(_0x24429e,_0x15c62d){if(_0x24429e[_0x692c('0x46')]['id']){delete _0x24429e[_0x692c('0x46')]['id'];}return db['ChatTransferReport'][_0x692c('0x44')]({'where':{'id':_0x24429e['params']['id']}})[_0x692c('0x22')](handleEntityNotFound(_0x15c62d,null))[_0x692c('0x22')](saveUpdates(_0x24429e['body'],null))[_0x692c('0x22')](respondWithResult(_0x15c62d,null))[_0x692c('0x41')](handleError(_0x15c62d,null));};exports[_0x692c('0x23')]=function(_0x3f027d,_0x4ec097){return db[_0x692c('0x29')][_0x692c('0x44')]({'where':{'id':_0x3f027d[_0x692c('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ec097,null))[_0x692c('0x22')](removeEntity(_0x4ec097,null))[_0x692c('0x41')](handleError(_0x4ec097,null));};exports[_0x692c('0x47')]=function(_0x1e060a,_0x2692b9){return db[_0x692c('0x29')][_0x692c('0x47')]()[_0x692c('0x22')](respondWithResult(_0x2692b9,null))[_0x692c('0x41')](handleError(_0x2692b9,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 2003350..120d578 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 _0x1a6d=['rimraf','../../config/environment','./chatTransferReport.attributes','define','ChatTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','path'];(function(_0x120e82,_0x49a839){var _0x1b27bf=function(_0x3909c3){while(--_0x3909c3){_0x120e82['push'](_0x120e82['shift']());}};_0x1b27bf(++_0x49a839);}(_0x1a6d,0x7e));var _0xd1a6=function(_0x4beaa6,_0x125036){_0x4beaa6=_0x4beaa6-0x0;var _0x2ed49f=_0x1a6d[_0x4beaa6];return _0x2ed49f;};'use strict';var _=require('lodash');var util=require(_0xd1a6('0x0'));var logger=require(_0xd1a6('0x1'))(_0xd1a6('0x2'));var moment=require(_0xd1a6('0x3'));var BPromise=require(_0xd1a6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1a6('0x5'));var rimraf=require(_0xd1a6('0x6'));var config=require(_0xd1a6('0x7'));var attributes=require(_0xd1a6('0x8'));module['exports']=function(_0x4134f4,_0x2f5818){return _0x4134f4[_0xd1a6('0x9')](_0xd1a6('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xd1a6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x91e8=['api','../../config/environment','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x12877b,_0x8650cf){var _0x3549ff=function(_0x4f96b7){while(--_0x4f96b7){_0x12877b['push'](_0x12877b['shift']());}};_0x3549ff(++_0x8650cf);}(_0x91e8,0xf9));var _0x891e=function(_0xc9a48e,_0x4d3e72){_0xc9a48e=_0xc9a48e-0x0;var _0x419127=_0x91e8[_0xc9a48e];return _0x419127;};'use strict';var _=require(_0x891e('0x0'));var util=require(_0x891e('0x1'));var logger=require(_0x891e('0x2'))(_0x891e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x891e('0x4'));var attributes=require('./chatTransferReport.attributes');module[_0x891e('0x5')]=function(_0x39daad,_0x13864c){return _0x39daad['define'](_0x891e('0x6'),attributes,{'tableName':_0x891e('0x7'),'paranoid':![],'indexes':[{'name':_0x891e('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 980cab0..c778108 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 _0x386a=['request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x1607fb,_0x129766){var _0x573700=function(_0x42847){while(--_0x42847){_0x1607fb['push'](_0x1607fb['shift']());}};_0x573700(++_0x129766);}(_0x386a,0x157));var _0xa386=function(_0x16ccee,_0xc08ff4){_0x16ccee=_0x16ccee-0x0;var _0x305ee6=_0x386a[_0x16ccee];return _0x305ee6;};'use strict';var _=require(_0xa386('0x0'));var util=require(_0xa386('0x1'));var moment=require(_0xa386('0x2'));var BPromise=require('bluebird');var rs=require(_0xa386('0x3'));var fs=require('fs');var Redis=require(_0xa386('0x4'));var db=require(_0xa386('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa386('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa386('0x7'));var client=jayson[_0xa386('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50214a,_0xabb1ba,_0x1a1e5a){return new BPromise(function(_0x305228,_0xc55031){return client[_0xa386('0x9')](_0x50214a,_0x1a1e5a)[_0xa386('0xa')](function(_0x4ec2f0){logger[_0xa386('0xb')](_0xa386('0xc'),_0xabb1ba,_0xa386('0xd'));logger[_0xa386('0xe')](_0xa386('0xf'),_0xabb1ba,'request\x20sent',JSON[_0xa386('0x10')](_0x4ec2f0));if(_0x4ec2f0[_0xa386('0x11')]){if(_0x4ec2f0['error'][_0xa386('0x12')]===0x1f4){logger[_0xa386('0x11')](_0xa386('0xc'),_0xabb1ba,_0x4ec2f0['error']['message']);return _0xc55031(_0x4ec2f0[_0xa386('0x11')][_0xa386('0x13')]);}logger[_0xa386('0x11')](_0xa386('0xc'),_0xabb1ba,_0x4ec2f0[_0xa386('0x11')][_0xa386('0x13')]);return _0x305228(_0x4ec2f0[_0xa386('0x11')][_0xa386('0x13')]);}else{logger[_0xa386('0xb')](_0xa386('0xc'),_0xabb1ba,_0xa386('0xd'));_0x305228(_0x4ec2f0[_0xa386('0x14')][_0xa386('0x13')]);}})[_0xa386('0x15')](function(_0x19b056){logger['error'](_0xa386('0xc'),_0xabb1ba,_0x19b056);_0xc55031(_0x19b056);});});} \ No newline at end of file +var _0x5244=['request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x340c0d,_0x23e406){var _0x3a62fa=function(_0x22c0c2){while(--_0x22c0c2){_0x340c0d['push'](_0x340c0d['shift']());}};_0x3a62fa(++_0x23e406);}(_0x5244,0x182));var _0x4524=function(_0x5c7fc4,_0x525f28){_0x5c7fc4=_0x5c7fc4-0x0;var _0x1afcb9=_0x5244[_0x5c7fc4];return _0x1afcb9;};'use strict';var _=require(_0x4524('0x0'));var util=require(_0x4524('0x1'));var moment=require(_0x4524('0x2'));var BPromise=require(_0x4524('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4524('0x4'))['db'];var utils=require(_0x4524('0x5'));var logger=require(_0x4524('0x6'))(_0x4524('0x7'));var config=require(_0x4524('0x8'));var jayson=require(_0x4524('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x590e0c,_0x2a2e86,_0x58b71b){return new BPromise(function(_0x10aa75,_0x3f59b4){return client[_0x4524('0xa')](_0x590e0c,_0x58b71b)[_0x4524('0xb')](function(_0x5f3e71){logger[_0x4524('0xc')](_0x4524('0xd'),_0x2a2e86,'request\x20sent');logger[_0x4524('0xe')](_0x4524('0xf'),_0x2a2e86,_0x4524('0x10'),JSON[_0x4524('0x11')](_0x5f3e71));if(_0x5f3e71[_0x4524('0x12')]){if(_0x5f3e71[_0x4524('0x12')][_0x4524('0x13')]===0x1f4){logger[_0x4524('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x2a2e86,_0x5f3e71[_0x4524('0x12')][_0x4524('0x14')]);return _0x3f59b4(_0x5f3e71['error'][_0x4524('0x14')]);}logger[_0x4524('0x12')](_0x4524('0xd'),_0x2a2e86,_0x5f3e71['error'][_0x4524('0x14')]);return _0x10aa75(_0x5f3e71[_0x4524('0x12')][_0x4524('0x14')]);}else{logger[_0x4524('0xc')](_0x4524('0xd'),_0x2a2e86,_0x4524('0x10'));_0x10aa75(_0x5f3e71['result'][_0x4524('0x14')]);}})[_0x4524('0x15')](function(_0x23e38f){logger[_0x4524('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x2a2e86,_0x23e38f);_0x3f59b4(_0x23e38f);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 616e47b..c72201f 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 _0x94ee=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5eef05,_0x1be989){var _0x56d4b8=function(_0x57993d){while(--_0x57993d){_0x5eef05['push'](_0x5eef05['shift']());}};_0x56d4b8(++_0x1be989);}(_0x94ee,0x6f));var _0xe94e=function(_0x39ed8a,_0x29a9f3){_0x39ed8a=_0x39ed8a-0x0;var _0x2c3a02=_0x94ee[_0x39ed8a];return _0x2c3a02;};'use strict';var multer=require(_0xe94e('0x0'));var util=require(_0xe94e('0x1'));var path=require(_0xe94e('0x2'));var timeout=require(_0xe94e('0x3'));var express=require(_0xe94e('0x4'));var router=express[_0xe94e('0x5')]();var fs_extra=require(_0xe94e('0x6'));var auth=require(_0xe94e('0x7'));var interaction=require(_0xe94e('0x8'));var config=require(_0xe94e('0x9'));var controller=require(_0xe94e('0xa'));router[_0xe94e('0xb')]('/',auth[_0xe94e('0xc')](),controller['index']);router[_0xe94e('0xb')]('/describe',auth[_0xe94e('0xc')](),controller[_0xe94e('0xd')]);router[_0xe94e('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xe94e('0xe')]);router[_0xe94e('0xf')]('/',auth[_0xe94e('0xc')](),controller[_0xe94e('0x10')]);router[_0xe94e('0x11')](_0xe94e('0x12'),auth[_0xe94e('0xc')](),controller[_0xe94e('0x13')]);router[_0xe94e('0x14')](_0xe94e('0x12'),auth[_0xe94e('0xc')](),controller[_0xe94e('0x15')]);module[_0xe94e('0x16')]=router; \ No newline at end of file +var _0x52db=['../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x3a83db,_0x4ca379){var _0x53ac2c=function(_0x587470){while(--_0x587470){_0x3a83db['push'](_0x3a83db['shift']());}};_0x53ac2c(++_0x4ca379);}(_0x52db,0x13e));var _0xb52d=function(_0xbc9765,_0x11b5c6){_0xbc9765=_0xbc9765-0x0;var _0x2bb565=_0x52db[_0xbc9765];return _0x2bb565;};'use strict';var multer=require(_0xb52d('0x0'));var util=require(_0xb52d('0x1'));var path=require('path');var timeout=require(_0xb52d('0x2'));var express=require(_0xb52d('0x3'));var router=express[_0xb52d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb52d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb52d('0x6'));var controller=require(_0xb52d('0x7'));router[_0xb52d('0x8')]('/',auth[_0xb52d('0x9')](),controller['index']);router[_0xb52d('0x8')](_0xb52d('0xa'),auth[_0xb52d('0x9')](),controller[_0xb52d('0xb')]);router[_0xb52d('0x8')](_0xb52d('0xc'),auth['isAuthenticated'](),controller[_0xb52d('0xd')]);router['post']('/',auth[_0xb52d('0x9')](),controller[_0xb52d('0xe')]);router['put'](_0xb52d('0xc'),auth['isAuthenticated'](),controller[_0xb52d('0xf')]);router[_0xb52d('0x10')](_0xb52d('0xc'),auth[_0xb52d('0x9')](),controller[_0xb52d('0x11')]);module[_0xb52d('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 0886475..56929c0 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 _0xa098=['INTEGER','TEXT','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Send','Skip','Feedback','star','thumb','input','text','name','getDataValue','parse','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','email','#011F6A','BOOLEAN','ENUM','rounded','squared','Chat','Contact\x20us'];(function(_0x53c7ea,_0x13789e){var _0x4197e1=function(_0x12b21e){while(--_0x12b21e){_0x53c7ea['push'](_0x53c7ea['shift']());}};_0x4197e1(++_0x13789e);}(_0xa098,0xb0));var _0x8a09=function(_0x2e661f,_0x1e3b7a){_0x2e661f=_0x2e661f-0x0;var _0x539699=_0xa098[_0x2e661f];return _0x539699;};'use strict';var Sequelize=require(_0x8a09('0x0'));var rs=require(_0x8a09('0x1'));module[_0x8a09('0x2')]={'name':{'type':Sequelize[_0x8a09('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x8a09('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x8a09('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':_0x8a09('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8a09('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x8a09('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x8a09('0x7')](_0x8a09('0x8'),_0x8a09('0x9')),'defaultValue':_0x8a09('0x8')},'header_online':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':_0x8a09('0xa')},'offline_chat_button':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x8a09('0xb')},'download_transcript':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x8a09('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x8a09('0xd')]},'closingQuestion':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8a09('0xe')},'noteTitle':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x8a09('0xf')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x8a09('0x10')},'skipMessageButton':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':_0x8a09('0x11')},'conditionAgreement':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':_0x8a09('0x12')},'ratingType':{'type':Sequelize['ENUM'](_0x8a09('0x13'),_0x8a09('0x14')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x8a09('0xc')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x8a09('0xd')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x8a09('0x15'),'variable':null,'config':{'placeholder':'name','type':_0x8a09('0x16'),'required':!![]},'props':{'title':_0x8a09('0x17'),'helpText':''}},{'type':_0x8a09('0x15'),'props':{'title':_0x8a09('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x8a09('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x8a09('0x18')]('onlineForm')?JSON[_0x8a09('0x19')](this[_0x8a09('0x18')](_0x8a09('0x1a'))):{};},'set':function(_0x163e30){return this[_0x8a09('0x1b')]('onlineForm',JSON[_0x8a09('0x1c')](_0x163e30));}},'offlineForm':{'type':Sequelize[_0x8a09('0xd')],'defaultValue':function(){return JSON[_0x8a09('0x1c')]({'items':[{'type':_0x8a09('0x15'),'props':{'title':_0x8a09('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x8a09('0x4')},'variable':null},{'type':_0x8a09('0x1d'),'config':{'placeholder':_0x8a09('0x1e')},'props':{'title':'Comments','helpText':_0x8a09('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x8a09('0x18')]('offlineForm')?JSON[_0x8a09('0x19')](this[_0x8a09('0x18')](_0x8a09('0x20'))):{};},'set':function(_0x25c9bb){return this[_0x8a09('0x1b')](_0x8a09('0x20'),JSON[_0x8a09('0x1c')](_0x25c9bb));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x8a09('0x3')]},'waitingTitle':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':_0x8a09('0x21')},'waitingMessage':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':_0x8a09('0x22')},'offlineMessageSubject':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':_0x8a09('0x23')},'offlineMessageBody':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':_0x8a09('0x24')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x8a09('0x10')},'enableCustomerAttachment':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x8a09('0xd')]},'showAgentAvatar':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x8a09('0x3')]},'notificationTemplate':{'type':Sequelize[_0x8a09('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x8a09('0x25')},'verticalAlignment':{'type':Sequelize[_0x8a09('0xc')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x8a09('0x26')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x8a09('0xd')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x8a09('0xc')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x8a09('0x3')],'allowNull':![],'defaultValue':_0x8a09('0x27'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8a09('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8a09('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':_0x8a09('0x28')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8a09('0xc')],'comment':_0x8a09('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![],'comment':_0x8a09('0x2a'),'set':function(_0xa8f05a){if(!_0xa8f05a)this[_0x8a09('0x1b')](_0x8a09('0x2b'),null);this[_0x8a09('0x1b')](_0x8a09('0x2c'),_0xa8f05a);}},'vidaooEscalation':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x8a09('0x3')]},'vidaooTopic':{'type':Sequelize[_0x8a09('0x3')],'allowNull':![],'defaultValue':_0x8a09('0x2d')},'vidaooNote':{'type':Sequelize[_0x8a09('0x3')],'defaultValue':function(){return _0x8a09('0x2e');}},'vidaooMetadata':{'type':Sequelize[_0x8a09('0xd')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x8a09('0x6')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1373=['Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Send','Feedback','star','thumb','stringify','input','name','getDataValue','onlineForm','setDataValue','Comments','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','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','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}}','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x1373,0xe2));var _0x3137=function(_0x1b5c1e,_0x5da98b){_0x1b5c1e=_0x1b5c1e-0x0;var _0x5bba27=_0x1373[_0x1b5c1e];return _0x5bba27;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x3137('0x0'));module[_0x3137('0x1')]={'name':{'type':Sequelize[_0x3137('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3137('0x3')},'description':{'type':Sequelize[_0x3137('0x2')]},'mapKey':{'type':Sequelize[_0x3137('0x2')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x3137('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3137('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3137('0x2')],'allowNull':![],'defaultValue':_0x3137('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3137('0x2')],'allowNull':![],'defaultValue':_0x3137('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3137('0x2')],'allowNull':![],'defaultValue':_0x3137('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3137('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3137('0x2')]},'animation':{'type':Sequelize[_0x3137('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3137('0x9')](_0x3137('0xa'),_0x3137('0xb')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0x3137('0x2')],'defaultValue':_0x3137('0xc')},'start_chat_button':{'type':Sequelize[_0x3137('0x2')],'defaultValue':_0x3137('0xd')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x3137('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x3137('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3137('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x3137('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x3137('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3137('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0x3137('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x3137('0x2')],'defaultValue':_0x3137('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x3137('0x2')],'defaultValue':_0x3137('0x12')},'noteTitle':{'type':Sequelize[_0x3137('0x2')],'defaultValue':_0x3137('0x13')},'placeholderMessage':{'type':Sequelize[_0x3137('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0x3137('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x3137('0x2')],'defaultValue':_0x3137('0x14')},'skipMessageButton':{'type':Sequelize[_0x3137('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3137('0x2')],'defaultValue':_0x3137('0x15')},'ratingType':{'type':Sequelize[_0x3137('0x9')](_0x3137('0x16'),_0x3137('0x17')),'defaultValue':_0x3137('0x16')},'ratingStarsNumber':{'type':Sequelize[_0x3137('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x3137('0x18')]({'items':[{'type':_0x3137('0x19'),'variable':null,'config':{'placeholder':_0x3137('0x1a'),'type':'text','required':!![]},'props':{'title':_0x3137('0x1a'),'helpText':''}},{'type':'input','props':{'title':_0x3137('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x3137('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3137('0x1b')](_0x3137('0x1c'))?JSON['parse'](this['getDataValue'](_0x3137('0x1c'))):{};},'set':function(_0x2ffa54){return this[_0x3137('0x1d')](_0x3137('0x1c'),JSON[_0x3137('0x18')](_0x2ffa54));}},'offlineForm':{'type':Sequelize[_0x3137('0xf')],'defaultValue':function(){return JSON[_0x3137('0x18')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x3137('0x4'),'type':'email'},'variable':null},{'type':'textarea','config':{'placeholder':_0x3137('0x1e')},'props':{'title':'Comments','helpText':_0x3137('0x1f')}}],'fromKey':0x0});},'get':function(){return this[_0x3137('0x1b')](_0x3137('0x20'))?JSON[_0x3137('0x21')](this[_0x3137('0x1b')](_0x3137('0x20'))):{};},'set':function(_0x53f007){return this[_0x3137('0x1d')]('offlineForm',JSON['stringify'](_0x53f007));}},'token':{'type':Sequelize[_0x3137('0x2')],'defaultValue':function(){return rs[_0x3137('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3137('0x2')]},'forwardOffline':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3137('0x2')]},'waitingTitle':{'type':Sequelize[_0x3137('0x2')],'defaultValue':_0x3137('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3137('0x24')},'offlineMessageSubject':{'type':Sequelize[_0x3137('0x2')],'defaultValue':_0x3137('0x25')},'offlineMessageBody':{'type':Sequelize[_0x3137('0x2')],'defaultValue':_0x3137('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3137('0x2')],'defaultValue':_0x3137('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x3137('0x28')},'sendUnmanaged':{'type':Sequelize[_0x3137('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3137('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x3137('0x2')]},'notificationTemplate':{'type':Sequelize[_0x3137('0xf')],'defaultValue':function(){return _0x3137('0x29');}},'notificationSound':{'type':Sequelize[_0x3137('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x3137('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3137('0x2')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize[_0x3137('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x3137('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x3137('0x2')]},'customerAvatar':{'type':Sequelize[_0x3137('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3137('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3137('0x2')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3137('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3137('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3137('0x2')],'defaultValue':_0x3137('0x2a')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3137('0x7')],'comment':_0x3137('0x2b')},'mandatoryDisposition':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![],'comment':_0x3137('0x2c'),'set':function(_0x289a79){if(!_0x289a79)this[_0x3137('0x1d')](_0x3137('0x2d'),null);this[_0x3137('0x1d')](_0x3137('0x2e'),_0x289a79);}},'vidaooEscalation':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3137('0x2')]},'vidaooTopic':{'type':Sequelize[_0x3137('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0x3137('0x2')],'defaultValue':function(){return _0x3137('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0x3137('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x3137('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 77796b9..a556b87 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 _0x85a2=['License','chatLicenseExceeded','push','server/files/chat/iframe.ejs','x-real-ip','connection','remoteAddress','replace','render','verticalAlignment','textColor','color_button','backgroundColor','addApplications','ChatApplication','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','http','client','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','destroy','get','sendStatus','stack','name','send','Pause','map','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','ChatWebsite','show','params','mandatoryDispositionPause','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatWebsites','UserProfileSection','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','keys','findAll','rows','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','filename','addAvatar','agentAvatar','file','addSystemAvatar','systemAvatar','getLogo','join','root','sitepic','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','setUA','user-agent','getResult','chat','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','Applications','List','account','applications','list','orderBy','priority','ListId','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','firstName','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','offline','files','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','sendMail','email','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','lastName','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','Tag','color','tag','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','virtual'];(function(_0x1c50b8,_0x2d74fc){var _0x5e6552=function(_0xdab955){while(--_0xdab955){_0x1c50b8['push'](_0x1c50b8['shift']());}};_0x5e6552(++_0x2d74fc);}(_0x85a2,0x153));var _0x285a=function(_0x311800,_0x129237){_0x311800=_0x311800-0x0;var _0x1f8346=_0x85a2[_0x311800];return _0x1f8346;};'use strict';var emlformat=require(_0x285a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x285a('0x1'));var jsonpatch=require(_0x285a('0x2'));var rp=require(_0x285a('0x3'));var moment=require(_0x285a('0x4'));var BPromise=require(_0x285a('0x5'));var Mustache=require(_0x285a('0x6'));var util=require(_0x285a('0x7'));var path=require(_0x285a('0x8'));var sox=require(_0x285a('0x9'));var csv=require(_0x285a('0xa'));var ejs=require(_0x285a('0xb'));var fs=require('fs');var fs_extra=require(_0x285a('0xc'));var _=require(_0x285a('0xd'));var squel=require(_0x285a('0xe'));var crypto=require(_0x285a('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x285a('0xa'));var querystring=require(_0x285a('0x10'));var Papa=require('papaparse');var Redis=require(_0x285a('0x11'));var authService=require(_0x285a('0x12'));var qs=require(_0x285a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x285a('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x285a('0x15'));var config=require(_0x285a('0x16'));var licenseUtil=require(_0x285a('0x17'));var db=require(_0x285a('0x18'))['db'];config['redis']=_[_0x285a('0x19')](config[_0x285a('0x1a')],{'host':_0x285a('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x285a('0x1a')]));require('./chatWebsite.socket')[_0x285a('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x285a('0x1d')]({'port':0x232c});var client9002=jayson[_0x285a('0x1e')]['http']({'port':0x232a});var client9003=jayson[_0x285a('0x1e')][_0x285a('0x1d')]({'port':0x232b});var client9001=jayson['client'][_0x285a('0x1d')]({'port':0x2329});function respondWithRpcPromise(_0x444632,_0x4a2b32,_0x5b03f5,_0x2c883b){return new BPromise(function(_0x2d149c,_0x287509){var _0x5bdf34=_0x2c883b||client;return _0x5bdf34['request'](_0x444632,_0x5b03f5)[_0x285a('0x1f')](function(_0x153551){logger[_0x285a('0x20')](_0x285a('0x21'),_0x4a2b32,_0x285a('0x22'));logger[_0x285a('0x23')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4a2b32,_0x285a('0x22'),JSON['stringify'](_0x153551));if(_0x153551[_0x285a('0x24')]){if(_0x153551[_0x285a('0x24')][_0x285a('0x25')]===0x1f4){logger[_0x285a('0x24')](_0x285a('0x21'),_0x4a2b32,_0x153551[_0x285a('0x24')][_0x285a('0x26')]);return _0x287509(_0x153551[_0x285a('0x24')][_0x285a('0x26')]);}logger[_0x285a('0x24')](_0x285a('0x21'),_0x4a2b32,_0x153551[_0x285a('0x24')][_0x285a('0x26')]);return _0x2d149c(_0x153551[_0x285a('0x24')][_0x285a('0x26')]);}else{logger[_0x285a('0x20')](_0x285a('0x21'),_0x4a2b32,_0x285a('0x22'));_0x2d149c(_0x153551[_0x285a('0x27')][_0x285a('0x26')]);}})[_0x285a('0x28')](function(_0x12289f){logger[_0x285a('0x24')](_0x285a('0x21'),_0x4a2b32,_0x12289f);_0x287509(_0x12289f);});});}function respondWithStatusCode(_0x8617d,_0x46dd34){_0x46dd34=_0x46dd34||0xcc;return function(_0x5f45f3){if(_0x5f45f3){return _0x8617d['sendStatus'](_0x46dd34);}return _0x8617d[_0x285a('0x29')](_0x46dd34)[_0x285a('0x2a')]();};}function respondWithResult(_0x4fac16,_0x5998b0){_0x5998b0=_0x5998b0||0xc8;return function(_0x415b54){if(_0x415b54){return _0x4fac16['status'](_0x5998b0)[_0x285a('0x2b')](_0x415b54);}};}function respondWithFilteredResult(_0x3a0b29,_0x4fa205){return function(_0xda9bb4){if(_0xda9bb4){var _0x22ddcc=typeof _0x4fa205['offset']==='undefined'&&typeof _0x4fa205[_0x285a('0x2c')]===_0x285a('0x2d');var _0x10c78e=_0xda9bb4['count'];var _0x2c7635=_0x22ddcc?0x0:_0x4fa205[_0x285a('0x2e')];var _0x181d36=_0x22ddcc?_0xda9bb4[_0x285a('0x2f')]:_0x4fa205['offset']+_0x4fa205[_0x285a('0x2c')];var _0x1f0efe;if(_0x181d36>=_0x10c78e){_0x181d36=_0x10c78e;_0x1f0efe=0xc8;}else{_0x1f0efe=0xce;}_0x3a0b29['status'](_0x1f0efe);return _0x3a0b29[_0x285a('0x30')](_0x285a('0x31'),_0x2c7635+'-'+_0x181d36+'/'+_0x10c78e)[_0x285a('0x2b')](_0xda9bb4);}return null;};}function patchUpdates(_0x7eaba8){return function(_0x3dc994){try{jsonpatch[_0x285a('0x32')](_0x3dc994,_0x7eaba8,!![]);}catch(_0x28145d){return BPromise[_0x285a('0x33')](_0x28145d);}return _0x3dc994[_0x285a('0x34')]();};}function saveUpdates(_0x4fb510,_0x18f382){return function(_0x13ae13){if(_0x13ae13){return _0x13ae13['update'](_0x4fb510)[_0x285a('0x1f')](function(_0x6faaa1){return _0x6faaa1;});}return null;};}function removeEntity(_0x1518f1,_0x35e0c3){return function(_0x15d205){if(_0x15d205){return _0x15d205[_0x285a('0x35')]()['then'](function(){var _0x361995=_0x15d205[_0x285a('0x36')]({'plain':!![]});var _0x43d69b='ChatWebsites';return db['UserProfileResource'][_0x285a('0x35')]({'where':{'type':_0x43d69b,'resourceId':_0x361995['id']}})['then'](function(){return _0x15d205;});})[_0x285a('0x1f')](function(){_0x1518f1[_0x285a('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfe4211,_0x196754){return function(_0x1b6ee4){if(!_0x1b6ee4){_0xfe4211[_0x285a('0x37')](0x194);}return _0x1b6ee4;};}function handleError(_0x3947e2,_0x2fa307){_0x2fa307=_0x2fa307||0x1f4;return function(_0x360359){logger[_0x285a('0x24')](_0x360359[_0x285a('0x38')]);if(_0x360359[_0x285a('0x39')]){delete _0x360359[_0x285a('0x39')];}_0x3947e2[_0x285a('0x29')](_0x2fa307)[_0x285a('0x3a')](_0x360359);};}exports['index']=function(_0x1092d7,_0x3eb98b){var _0x584e6b={'include':[{'model':db[_0x285a('0x3b')],'as':'mandatoryDispositionPause'}]},_0x340172={},_0x13ddd9={'count':0x0,'rows':[]};var _0x2f5a11=_[_0x285a('0x3c')](db['ChatWebsite'][_0x285a('0x3d')],function(_0x384639){return{'name':_0x384639[_0x285a('0x3e')],'type':_0x384639[_0x285a('0x3f')][_0x285a('0x40')]};});_0x340172['model']=_[_0x285a('0x3c')](_0x2f5a11,_0x285a('0x39'));_0x340172[_0x285a('0x41')]=_['keys'](_0x1092d7[_0x285a('0x41')]);_0x340172['filters']=_['intersection'](_0x340172[_0x285a('0x42')],_0x340172['query']);_0x584e6b[_0x285a('0x43')]=_[_0x285a('0x44')](_0x340172[_0x285a('0x42')],qs[_0x285a('0x45')](_0x1092d7[_0x285a('0x41')][_0x285a('0x45')]));_0x584e6b[_0x285a('0x43')]=_0x584e6b['attributes']['length']?_0x584e6b[_0x285a('0x43')]:_0x340172['model'];if(!_0x1092d7[_0x285a('0x41')][_0x285a('0x46')](_0x285a('0x47'))){_0x584e6b[_0x285a('0x2c')]=qs['limit'](_0x1092d7[_0x285a('0x41')]['limit']);_0x584e6b[_0x285a('0x2e')]=qs[_0x285a('0x2e')](_0x1092d7[_0x285a('0x41')][_0x285a('0x2e')]);}_0x584e6b[_0x285a('0x48')]=qs[_0x285a('0x49')](_0x1092d7[_0x285a('0x41')]['sort']);_0x584e6b[_0x285a('0x4a')]=qs[_0x285a('0x4b')](_[_0x285a('0x4c')](_0x1092d7[_0x285a('0x41')],_0x340172[_0x285a('0x4b')]),_0x2f5a11);if(_0x1092d7[_0x285a('0x41')][_0x285a('0x4d')]){_0x584e6b[_0x285a('0x4a')]=_[_0x285a('0x4e')](_0x584e6b['where'],{'$or':_[_0x285a('0x3c')](_0x2f5a11,function(_0x32a210){if(_0x32a210[_0x285a('0x3f')]!==_0x285a('0x4f')){var _0xb475fc={};_0xb475fc[_0x32a210[_0x285a('0x39')]]={'$like':'%'+_0x1092d7[_0x285a('0x41')][_0x285a('0x4d')]+'%'};return _0xb475fc;}})});}_0x584e6b=_[_0x285a('0x4e')]({},_0x584e6b,_0x1092d7[_0x285a('0x50')]);var _0x460a1c={'where':_0x584e6b['where']};return db['ChatWebsite'][_0x285a('0x2f')](_0x460a1c)[_0x285a('0x1f')](function(_0xad2ddc){_0x13ddd9['count']=_0xad2ddc;if(_0x1092d7[_0x285a('0x41')][_0x285a('0x51')]){_0x584e6b[_0x285a('0x52')]=[{'all':!![]}];}return db[_0x285a('0x53')]['findAll'](_0x584e6b);})['then'](function(_0x3f593c){_0x13ddd9['rows']=_0x3f593c;return _0x13ddd9;})[_0x285a('0x1f')](respondWithFilteredResult(_0x3eb98b,_0x584e6b))[_0x285a('0x28')](handleError(_0x3eb98b,null));};exports[_0x285a('0x54')]=function(_0xbe218e,_0x34a445){var _0x48f82b={'raw':![],'where':{'id':_0xbe218e[_0x285a('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x285a('0x56')}]},_0xce6014={};_0xce6014['model']=_['keys'](db[_0x285a('0x53')][_0x285a('0x3d')]);_0xce6014[_0x285a('0x41')]=_['keys'](_0xbe218e[_0x285a('0x41')]);_0xce6014[_0x285a('0x4b')]=_[_0x285a('0x44')](_0xce6014[_0x285a('0x42')],_0xce6014[_0x285a('0x41')]);_0x48f82b['attributes']=_[_0x285a('0x44')](_0xce6014[_0x285a('0x42')],qs[_0x285a('0x45')](_0xbe218e['query'][_0x285a('0x45')]));_0x48f82b['attributes']=_0x48f82b[_0x285a('0x43')][_0x285a('0x57')]?_0x48f82b['attributes']:_0xce6014[_0x285a('0x42')];if(_0xbe218e['query'][_0x285a('0x51')]){_0x48f82b['include']=[{'all':!![]}];}_0x48f82b=_[_0x285a('0x4e')]({},_0x48f82b,_0xbe218e[_0x285a('0x50')]);return db['ChatWebsite']['find'](_0x48f82b)[_0x285a('0x1f')](handleEntityNotFound(_0x34a445,null))['then'](respondWithResult(_0x34a445,null))['catch'](handleError(_0x34a445,null));};exports[_0x285a('0x58')]=function(_0x163028,_0x416bb5){return db[_0x285a('0x53')][_0x285a('0x58')](_0x163028[_0x285a('0x59')],{})['then'](function(_0x4713e5){var _0x33be32=_0x163028['user']['get']({'plain':!![]});if(!_0x33be32)throw new Error(_0x285a('0x5a'));if(_0x33be32[_0x285a('0x5b')]===_0x285a('0x5c')){var _0x35fdb2=_0x4713e5['get']({'plain':!![]});var _0x3511c0=_0x285a('0x5d');return db[_0x285a('0x5e')][_0x285a('0x5f')]({'where':{'name':_0x3511c0,'userProfileId':_0x33be32['userProfileId']},'raw':!![]})[_0x285a('0x1f')](function(_0x1a1349){if(_0x1a1349&&_0x1a1349['autoAssociation']===0x0){return db[_0x285a('0x60')][_0x285a('0x58')]({'name':_0x35fdb2[_0x285a('0x39')],'resourceId':_0x35fdb2['id'],'type':_0x1a1349['name'],'sectionId':_0x1a1349['id']},{})[_0x285a('0x1f')](function(){return _0x4713e5;});}else{return _0x4713e5;}})[_0x285a('0x28')](function(_0x524155){logger[_0x285a('0x24')](_0x285a('0x61'),_0x524155);throw _0x524155;});}return _0x4713e5;})[_0x285a('0x1f')](respondWithResult(_0x416bb5,0xc9))[_0x285a('0x28')](handleError(_0x416bb5,null));};exports[_0x285a('0x62')]=function(_0x3129bd,_0x1feaaa){if(_0x3129bd[_0x285a('0x59')]['id']){delete _0x3129bd[_0x285a('0x59')]['id'];}return db[_0x285a('0x53')][_0x285a('0x5f')]({'where':{'id':_0x3129bd[_0x285a('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x285a('0x56')}]})['then'](handleEntityNotFound(_0x1feaaa,null))[_0x285a('0x1f')](saveUpdates(_0x3129bd[_0x285a('0x59')],null))['then'](respondWithResult(_0x1feaaa,null))[_0x285a('0x28')](handleError(_0x1feaaa,null));};exports['destroy']=function(_0x4f6e0c,_0x248600){return db[_0x285a('0x53')][_0x285a('0x5f')]({'where':{'id':_0x4f6e0c['params']['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x248600,null))[_0x285a('0x1f')](removeEntity(_0x248600,null))[_0x285a('0x28')](handleError(_0x248600,null));};exports[_0x285a('0x63')]=function(_0x2d94b2,_0x492796){return db[_0x285a('0x53')]['describe']()[_0x285a('0x1f')](respondWithResult(_0x492796,null))['catch'](handleError(_0x492796,null));};exports[_0x285a('0x64')]=function(_0x15eeb8,_0x465fb9,_0x11dd35){if(_0x15eeb8[_0x285a('0x59')]['id']){delete _0x15eeb8['body']['id'];}return db[_0x285a('0x53')]['find']({'where':{'id':_0x15eeb8[_0x285a('0x55')]['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x465fb9,null))['then'](function(_0x1089e0){if(_0x1089e0){_0x15eeb8[_0x285a('0x59')][_0x285a('0x65')]=_0x1089e0['id'];return db[_0x285a('0x66')]['create'](_0x15eeb8[_0x285a('0x59')]);}})[_0x285a('0x1f')](respondWithResult(_0x465fb9,null))[_0x285a('0x28')](handleError(_0x465fb9,null));};exports['getDispositions']=function(_0x218fac,_0x130e9b,_0x1a6d63){var _0x398f15={'raw':![],'where':{}};var _0x209763={};var _0x2511ce={'count':0x0,'rows':[]};return db[_0x285a('0x53')]['findOne']({'where':{'id':_0x218fac[_0x285a('0x55')]['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x130e9b,null))['then'](function(_0x5adb45){if(_0x5adb45){_0x209763[_0x285a('0x42')]=_[_0x285a('0x67')](db[_0x285a('0x66')]['rawAttributes']);_0x209763[_0x285a('0x41')]=_['keys'](_0x218fac[_0x285a('0x41')]);_0x209763['filters']=_['intersection'](_0x209763['model'],_0x209763[_0x285a('0x41')]);_0x398f15['attributes']=_[_0x285a('0x44')](_0x209763['model'],qs['fields'](_0x218fac[_0x285a('0x41')]['fields']));_0x398f15['attributes']=_0x398f15['attributes']['length']?_0x398f15['attributes']:_0x209763['model'];if(!_0x218fac[_0x285a('0x41')][_0x285a('0x46')](_0x285a('0x47'))){_0x398f15['limit']=qs[_0x285a('0x2c')](_0x218fac['query']['limit']);_0x398f15[_0x285a('0x2e')]=qs[_0x285a('0x2e')](_0x218fac[_0x285a('0x41')][_0x285a('0x2e')]);}_0x398f15['order']=qs[_0x285a('0x49')](_0x218fac[_0x285a('0x41')][_0x285a('0x49')]);_0x398f15[_0x285a('0x4a')]=qs[_0x285a('0x4b')](_[_0x285a('0x4c')](_0x218fac[_0x285a('0x41')],_0x209763[_0x285a('0x4b')]));_0x398f15[_0x285a('0x4a')][_0x285a('0x65')]=_0x5adb45['id'];if(_0x218fac[_0x285a('0x41')][_0x285a('0x4d')]){_0x398f15[_0x285a('0x4a')]=_[_0x285a('0x4e')](_0x398f15[_0x285a('0x4a')],{'$or':_[_0x285a('0x3c')](_0x398f15[_0x285a('0x43')],function(_0x2a10d0){var _0x9b9931={};_0x9b9931[_0x2a10d0]={'$like':'%'+_0x218fac[_0x285a('0x41')]['filter']+'%'};return _0x9b9931;})});}_0x398f15=_[_0x285a('0x4e')]({},_0x398f15,_0x218fac['options']);return db['Disposition'][_0x285a('0x2f')]({'where':_0x398f15[_0x285a('0x4a')]})[_0x285a('0x1f')](function(_0x12a778){_0x2511ce[_0x285a('0x2f')]=_0x12a778;if(_0x218fac[_0x285a('0x41')][_0x285a('0x51')]){_0x398f15[_0x285a('0x52')]=[{'all':!![]}];}return db['Disposition'][_0x285a('0x68')](_0x398f15);})['then'](function(_0x1693e6){_0x2511ce[_0x285a('0x69')]=_0x1693e6;return _0x2511ce;});}})['then'](respondWithFilteredResult(_0x130e9b,_0x398f15))[_0x285a('0x28')](handleError(_0x130e9b,null));};exports[_0x285a('0x6a')]=function(_0x268def,_0x1eef67,_0x5c1cc9){return db[_0x285a('0x53')]['find']({'where':{'id':_0x268def[_0x285a('0x55')]['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x1eef67,null))[_0x285a('0x1f')](function(_0x55bb4f){if(_0x55bb4f){return _0x55bb4f[_0x285a('0x6a')](_0x268def[_0x285a('0x41')]['ids']);}})[_0x285a('0x1f')](respondWithStatusCode(_0x1eef67,null))['catch'](handleError(_0x1eef67,null));};exports[_0x285a('0x6b')]=function(_0x59f412,_0x2cddf0,_0x50605d){if(_0x59f412[_0x285a('0x59')]['id']){delete _0x59f412[_0x285a('0x59')]['id'];}return db[_0x285a('0x53')][_0x285a('0x5f')]({'where':{'id':_0x59f412[_0x285a('0x55')]['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x2cddf0,null))[_0x285a('0x1f')](function(_0x5f5310){if(_0x5f5310){_0x59f412[_0x285a('0x59')][_0x285a('0x65')]=_0x5f5310['id'];return db[_0x285a('0x6c')][_0x285a('0x58')](_0x59f412['body']);}})[_0x285a('0x1f')](respondWithResult(_0x2cddf0,null))['catch'](handleError(_0x2cddf0,null));};exports[_0x285a('0x6d')]=function(_0x3b2941,_0x95075e,_0x4f9426){var _0x3d47f3={'raw':![],'where':{}};var _0x4edb37={};var _0x5b6685={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x285a('0x6e')]({'where':{'id':_0x3b2941[_0x285a('0x55')]['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x95075e,null))[_0x285a('0x1f')](function(_0x138067){if(_0x138067){_0x4edb37[_0x285a('0x42')]=_[_0x285a('0x67')](db[_0x285a('0x6c')][_0x285a('0x3d')]);_0x4edb37[_0x285a('0x41')]=_[_0x285a('0x67')](_0x3b2941[_0x285a('0x41')]);_0x4edb37[_0x285a('0x4b')]=_['intersection'](_0x4edb37[_0x285a('0x42')],_0x4edb37[_0x285a('0x41')]);_0x3d47f3[_0x285a('0x43')]=_['intersection'](_0x4edb37[_0x285a('0x42')],qs[_0x285a('0x45')](_0x3b2941[_0x285a('0x41')][_0x285a('0x45')]));_0x3d47f3[_0x285a('0x43')]=_0x3d47f3[_0x285a('0x43')][_0x285a('0x57')]?_0x3d47f3[_0x285a('0x43')]:_0x4edb37[_0x285a('0x42')];if(!_0x3b2941[_0x285a('0x41')]['hasOwnProperty'](_0x285a('0x47'))){_0x3d47f3[_0x285a('0x2c')]=qs['limit'](_0x3b2941[_0x285a('0x41')]['limit']);_0x3d47f3[_0x285a('0x2e')]=qs[_0x285a('0x2e')](_0x3b2941[_0x285a('0x41')][_0x285a('0x2e')]);}_0x3d47f3[_0x285a('0x48')]=qs[_0x285a('0x49')](_0x3b2941['query'][_0x285a('0x49')]);_0x3d47f3[_0x285a('0x4a')]=qs[_0x285a('0x4b')](_[_0x285a('0x4c')](_0x3b2941[_0x285a('0x41')],_0x4edb37['filters']));_0x3d47f3[_0x285a('0x4a')]['ChatWebsiteId']=_0x138067['id'];if(_0x3b2941['query'][_0x285a('0x4d')]){_0x3d47f3[_0x285a('0x4a')]=_[_0x285a('0x4e')](_0x3d47f3[_0x285a('0x4a')],{'$or':_[_0x285a('0x3c')](_0x3d47f3[_0x285a('0x43')],function(_0x37e1e5){var _0x3cd9d2={};_0x3cd9d2[_0x37e1e5]={'$like':'%'+_0x3b2941[_0x285a('0x41')][_0x285a('0x4d')]+'%'};return _0x3cd9d2;})});}_0x3d47f3=_[_0x285a('0x4e')]({},_0x3d47f3,_0x3b2941[_0x285a('0x50')]);return db['CannedAnswer'][_0x285a('0x2f')]({'where':_0x3d47f3[_0x285a('0x4a')]})['then'](function(_0x184919){_0x5b6685[_0x285a('0x2f')]=_0x184919;if(_0x3b2941[_0x285a('0x41')][_0x285a('0x51')]){_0x3d47f3[_0x285a('0x52')]=[{'all':!![]}];}return db[_0x285a('0x6c')][_0x285a('0x68')](_0x3d47f3);})['then'](function(_0x284a91){_0x5b6685[_0x285a('0x69')]=_0x284a91;return _0x5b6685;});}})[_0x285a('0x1f')](respondWithFilteredResult(_0x95075e,_0x3d47f3))[_0x285a('0x28')](handleError(_0x95075e,null));};exports[_0x285a('0x6f')]=function(_0x5864ef,_0x125916,_0x53bc01){return db[_0x285a('0x53')][_0x285a('0x5f')]({'where':{'id':_0x5864ef[_0x285a('0x55')]['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x125916,null))[_0x285a('0x1f')](function(_0x4cb8b0){if(_0x4cb8b0){return _0x4cb8b0[_0x285a('0x6f')](_0x5864ef['query'][_0x285a('0x70')]);}})[_0x285a('0x1f')](respondWithStatusCode(_0x125916,null))['catch'](handleError(_0x125916,null));};exports['addLogo']=function(_0x5529f2,_0x25bfb0,_0x404283){_0x5529f2[_0x285a('0x59')]['sitepic']=_0x5529f2['file'][_0x285a('0x71')];return db[_0x285a('0x53')][_0x285a('0x5f')]({'where':{'id':_0x5529f2[_0x285a('0x55')]['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x25bfb0,null))[_0x285a('0x1f')](saveUpdates(_0x5529f2[_0x285a('0x59')],null))['then'](respondWithResult(_0x25bfb0,null))[_0x285a('0x28')](handleError(_0x25bfb0,null));};exports[_0x285a('0x72')]=function(_0x5f39b8,_0x18ad6b,_0x1cfc05){_0x5f39b8[_0x285a('0x59')][_0x285a('0x73')]=_0x5f39b8[_0x285a('0x74')][_0x285a('0x71')];return db[_0x285a('0x53')][_0x285a('0x5f')]({'where':{'id':_0x5f39b8['params']['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x18ad6b,null))[_0x285a('0x1f')](saveUpdates(_0x5f39b8[_0x285a('0x59')],null))[_0x285a('0x1f')](respondWithResult(_0x18ad6b,null))['catch'](handleError(_0x18ad6b,null));};exports['addCustomerAvatar']=function(_0x179d47,_0x3a48cf,_0x1884b8){_0x179d47['body']['customerAvatar']=_0x179d47[_0x285a('0x74')][_0x285a('0x71')];return db[_0x285a('0x53')][_0x285a('0x5f')]({'where':{'id':_0x179d47['params']['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x3a48cf,null))[_0x285a('0x1f')](saveUpdates(_0x179d47['body'],null))[_0x285a('0x1f')](respondWithResult(_0x3a48cf,null))[_0x285a('0x28')](handleError(_0x3a48cf,null));};exports[_0x285a('0x75')]=function(_0xf737ae,_0x2ab3a6,_0x34f912){_0xf737ae[_0x285a('0x59')][_0x285a('0x76')]=_0xf737ae[_0x285a('0x74')][_0x285a('0x71')];return db['ChatWebsite'][_0x285a('0x5f')]({'where':{'id':_0xf737ae[_0x285a('0x55')]['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x2ab3a6,null))[_0x285a('0x1f')](saveUpdates(_0xf737ae['body'],null))[_0x285a('0x1f')](respondWithResult(_0x2ab3a6,null))['catch'](handleError(_0x2ab3a6,null));};exports[_0x285a('0x77')]=function(_0x3b1a8c,_0x27a44a,_0x35bc9a){var _0x25d823=path[_0x285a('0x78')](config[_0x285a('0x79')],'server/files/images/logos/default_logo.svg');var _0x20067d={'where':{'id':_0x3b1a8c[_0x285a('0x55')]['id']},'attributes':['id',_0x285a('0x7a')],'raw':!![]};var _0x40979a=![];return require(_0x285a('0x17'))['getLicense']()[_0x285a('0x1f')](function(_0x29d413){if(_0x29d413){_0x40979a=_0x29d413[_0x285a('0x7b')];}})['then'](function(){return db[_0x285a('0x53')][_0x285a('0x5f')](_0x20067d);})[_0x285a('0x1f')](handleEntityNotFound(_0x27a44a,null))['then'](function(_0x2d1776){if(_0x2d1776){if(!_[_0x285a('0x7c')](_0x2d1776['sitepic'])){if(fs[_0x285a('0x7d')](path[_0x285a('0x78')](config[_0x285a('0x79')],_0x285a('0x7e'),_0x2d1776[_0x285a('0x7a')]))&&_0x40979a){_0x25d823=path['join'](config[_0x285a('0x79')],_0x285a('0x7e'),_0x2d1776[_0x285a('0x7a')]);}}return _0x27a44a[_0x285a('0x7f')](_0x25d823);}})['catch'](handleError(_0x27a44a,null));};exports[_0x285a('0x80')]=function(_0xb6ca3,_0xd337d7,_0x15ef82){var _0x44fc92=path[_0x285a('0x78')](config[_0x285a('0x79')],_0x285a('0x81'));var _0x3e53f6={'where':{'id':_0xb6ca3['params']['id']},'attributes':['id',_0x285a('0x73')],'raw':!![]};return db['ChatWebsite'][_0x285a('0x5f')](_0x3e53f6)['then'](handleEntityNotFound(_0xd337d7,null))[_0x285a('0x1f')](function(_0x46ed28){if(_0x46ed28){if(!_[_0x285a('0x7c')](_0x46ed28[_0x285a('0x73')])){if(fs[_0x285a('0x7d')](path[_0x285a('0x78')](config[_0x285a('0x79')],_0x285a('0x82'),_0x46ed28[_0x285a('0x73')]))){_0x44fc92=path[_0x285a('0x78')](config[_0x285a('0x79')],_0x285a('0x82'),_0x46ed28[_0x285a('0x73')]);}}return _0xd337d7[_0x285a('0x7f')](_0x44fc92);}})['catch'](handleError(_0xd337d7,null));};exports[_0x285a('0x83')]=function(_0xb8ac62,_0x4322ac,_0x115cf0){var _0x442fcc=path[_0x285a('0x78')](config[_0x285a('0x79')],'server/files/images/avatars/customer_avatar.png');var _0x2f3ee8={'where':{'id':_0xb8ac62[_0x285a('0x55')]['id']},'attributes':['id',_0x285a('0x84'),_0x285a('0x85')],'raw':!![]};return db['ChatWebsite'][_0x285a('0x5f')](_0x2f3ee8)[_0x285a('0x1f')](handleEntityNotFound(_0x4322ac,null))[_0x285a('0x1f')](function(_0x3095c8){if(_0x3095c8){if(!_[_0x285a('0x7c')](_0x3095c8[_0x285a('0x84')])){if(fs[_0x285a('0x7d')](path[_0x285a('0x78')](config[_0x285a('0x79')],_0x285a('0x82'),_0x3095c8['customerAvatar']))&&_0x3095c8['showCustomerAvatar']){_0x442fcc=path[_0x285a('0x78')](config[_0x285a('0x79')],_0x285a('0x82'),_0x3095c8['customerAvatar']);}}return _0x4322ac['download'](_0x442fcc);}})[_0x285a('0x28')](handleError(_0x4322ac,null));};exports[_0x285a('0x86')]=function(_0x3f058a,_0x3e11dd,_0x3e7c42){var _0x432e75=path[_0x285a('0x78')](config['root'],_0x285a('0x87'));var _0x5f32f2={'where':{'id':_0x3f058a[_0x285a('0x55')]['id']},'attributes':['id',_0x285a('0x76')],'raw':!![]};return db[_0x285a('0x53')][_0x285a('0x5f')](_0x5f32f2)[_0x285a('0x1f')](handleEntityNotFound(_0x3e11dd,null))[_0x285a('0x1f')](function(_0x28e201){if(_0x28e201){if(!_[_0x285a('0x7c')](_0x28e201['systemAvatar'])){if(fs[_0x285a('0x7d')](path[_0x285a('0x78')](config[_0x285a('0x79')],'server/files/images/avatars/',_0x28e201[_0x285a('0x76')]))){_0x432e75=path[_0x285a('0x78')](config['root'],_0x285a('0x82'),_0x28e201['systemAvatar']);}}return _0x3e11dd[_0x285a('0x7f')](_0x432e75);}})[_0x285a('0x28')](handleError(_0x3e11dd,null));};exports[_0x285a('0x88')]=function(_0x58e7bd,_0x4cea4f,_0x9bf92f){var _0x33927e=require('user-agent-parser');var _0x365fa6=new _0x33927e();var _0x48c984=_0x365fa6[_0x285a('0x89')](_0x58e7bd['headers'][_0x285a('0x8a')])[_0x285a('0x8b')]();var _0x39fc1a={'body':_0x58e7bd['body'],'channel':_0x285a('0x8c')};var _0x560ce8=[];var _0x1d0250=[];var _0x32f8b9={};var _0xc12262=![];return db[_0x285a('0x8d')][_0x285a('0x63')]()['then'](function(_0x504ff3){if(!_0x504ff3){throw new db['Sequelize'][(_0x285a('0x8e'))](_0x285a('0x8f'));}_0x560ce8=_['difference'](_[_0x285a('0x67')](_0x504ff3),[_0x285a('0x90'),_0x285a('0x91')]);_0x1d0250=_[_0x285a('0x92')](_[_0x285a('0x67')](_0x504ff3),[_0x285a('0x90'),_0x285a('0x91'),'CompanyId','ListId']);if(_0x58e7bd[_0x285a('0x59')]['id']){delete _0x58e7bd[_0x285a('0x59')]['id'];}if(_[_0x285a('0x7c')](_0x58e7bd[_0x285a('0x59')][_0x285a('0x93')])){throw new db[(_0x285a('0x94'))]['ValidationError'](_0x285a('0x95'));}if(_[_0x285a('0x7c')](_0x58e7bd[_0x285a('0x59')][_0x285a('0x59')])||_0x58e7bd['body']['body']===''){throw new db[(_0x285a('0x94'))][(_0x285a('0x8e'))](_0x285a('0x96'));}if(_[_0x285a('0x7c')](_0x58e7bd[_0x285a('0x59')][_0x285a('0x97')])){throw new db['Sequelize'][(_0x285a('0x8e'))](_0x285a('0x98')+_0x1d0250);}if(!_['includes'](_0x1d0250,_0x58e7bd[_0x285a('0x59')]['mapKey'])){throw new db[(_0x285a('0x94'))]['ValidationError'](_0x285a('0x99')+_0x1d0250);}_0x32f8b9[_0x58e7bd[_0x285a('0x59')][_0x285a('0x97')]]=_0x58e7bd[_0x285a('0x59')][_0x285a('0x93')];})[_0x285a('0x1f')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x58e7bd[_0x285a('0x55')]['id']},'include':[{'model':db[_0x285a('0x9a')],'as':'List','include':[{'model':db[_0x285a('0x8d')],'as':_0x285a('0x9b'),'where':_0x32f8b9,'limit':0x1,'order':[[_0x285a('0x91'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0x285a('0x9c')}]});})[_0x285a('0x1f')](handleEntityNotFound(_0x4cea4f,null))[_0x285a('0x1f')](function(_0x58f6a0){if(_0x58f6a0&&_0x58f6a0[_0x285a('0x9d')]){_0x39fc1a[_0x285a('0x9e')]=_0x58f6a0;_0x39fc1a[_0x285a('0x9f')]=_0x58f6a0[_0x285a('0x9c')];_0x39fc1a[_0x285a('0xa0')]=_0x58f6a0[_0x285a('0x9d')];_0x39fc1a[_0x285a('0x9f')]=_[_0x285a('0xa1')](_0x39fc1a[_0x285a('0x9f')],[_0x285a('0xa2')],['asc']);if(_0x39fc1a['account'][_0x285a('0x9c')]){delete _0x39fc1a[_0x285a('0x9e')][_0x285a('0x9c')];}if(_0x39fc1a['account'][_0x285a('0x9d')]&&_0x39fc1a[_0x285a('0x9e')][_0x285a('0x9d')][_0x285a('0x9b')]['length']){return _0x39fc1a[_0x285a('0x9e')][_0x285a('0x9d')][_0x285a('0x9b')][0x0];}var _0x216727=_[_0x285a('0x19')](_0x58e7bd['body'],{'firstName':_0x58e7bd['body'][_0x285a('0x93')],'ListId':_0x58f6a0[_0x285a('0xa3')]});_0x216727[_0x58e7bd[_0x285a('0x59')][_0x285a('0x97')]]=_0x58e7bd[_0x285a('0x59')]['from'];return db['CmContact'][_0x285a('0x58')](_0x216727,{'fields':_0x560ce8,'raw':!![]});}})[_0x285a('0x1f')](handleEntityNotFound(_0x4cea4f,null))[_0x285a('0x1f')](function(_0x563a77){_0x39fc1a[_0x285a('0xa4')]=_0x563a77;var _0xf958c4=_0x58e7bd[_0x285a('0x59')][_0x285a('0xa5')];if(_0x58e7bd[_0x285a('0xa6')][_0x285a('0xa7')]){_0xf958c4=_0x58e7bd[_0x285a('0xa6')]['cf-connecting-ip'];}else if(_0x58e7bd['headers'][_0x285a('0xa8')]){_0xf958c4=_['first'](_0x58e7bd[_0x285a('0xa6')][_0x285a('0xa8')]['split'](','));}if(_0x563a77){var _0x27ee18={'ContactId':_0x563a77['id'],'ChatWebsiteId':_0x58e7bd['params']['id'],'from':(_0x563a77[_0x285a('0xa9')]||'')+'\x20'+(_0x563a77['lastName']||''),'customerIp':_0xf958c4,'customerPort':_0x58e7bd['headers']['x-real-port']?_0x58e7bd[_0x285a('0xa6')]['x-real-port']:null,'referer':_0x58e7bd[_0x285a('0x59')][_0x285a('0xaa')],'browserName':_0x48c984[_0x285a('0xab')][_0x285a('0x39')]&&_0x48c984[_0x285a('0xab')][_0x285a('0xac')]?util[_0x285a('0xad')](_0x285a('0xae'),_0x48c984[_0x285a('0xab')][_0x285a('0x39')],_0x48c984[_0x285a('0xab')][_0x285a('0xac')]):_0x285a('0xaf'),'browserVersion':_0x48c984[_0x285a('0xab')]['version']||_0x285a('0xaf'),'osName':util[_0x285a('0xad')](_0x285a('0xae'),_0x48c984['os']['name'],_0x48c984['os']['version']),'osVersion':_0x48c984['os'][_0x285a('0xac')],'deviceModel':_0x48c984[_0x285a('0xb0')][_0x285a('0x42')]&&_0x48c984[_0x285a('0xb0')][_0x285a('0xb1')]?util[_0x285a('0xad')](_0x285a('0xb2'),_0x48c984[_0x285a('0xb0')]['model'],_0x48c984[_0x285a('0xb0')]['vendor'],_0x48c984[_0x285a('0xb0')][_0x285a('0x3f')]):null,'deviceVendor':_0x48c984[_0x285a('0xb0')]['vendor'],'deviceType':_0x48c984[_0x285a('0xb0')][_0x285a('0x3f')],'formData':JSON[_0x285a('0xb3')](_0x58e7bd[_0x285a('0x59')])};var _0x40f943={'ChatWebsiteId':_0x58e7bd[_0x285a('0x55')]['id'],'closed':![]};if(_0x58e7bd['body'][_0x285a('0xb4')]){_0x40f943[_0x285a('0xb4')]=_0x58e7bd[_0x285a('0x59')][_0x285a('0xb4')];return db[_0x285a('0xb5')][_0x285a('0x5f')]({'where':_0x40f943})[_0x285a('0x1f')](function(_0x349f15){if(_0x349f15){return[_0x349f15,![]];}_0x27ee18[_0x285a('0xb4')]=_0x58e7bd['body'][_0x285a('0xb4')];_0x27ee18[_0x285a('0xb6')]=_0x58e7bd[_0x285a('0x59')][_0x285a('0xb6')];return db[_0x285a('0xb5')][_0x285a('0x58')](_0x27ee18)[_0x285a('0x1f')](function(_0x3fb526){return[_0x3fb526,!![]];});});}_0x40f943[_0x285a('0xb7')]=_0x563a77['id'];if(_0x58e7bd[_0x285a('0x59')]['interaction']&&_0x58e7bd[_0x285a('0x59')][_0x285a('0xb8')]['id']){_0x40f943['id']=_0x58e7bd[_0x285a('0x59')][_0x285a('0xb8')]['id'];return db[_0x285a('0xb5')][_0x285a('0x5f')]({'where':_0x40f943})[_0x285a('0x1f')](function(_0x211465){if(_0x211465){return[_0x211465,![]];}return db[_0x285a('0xb5')]['create'](_0x27ee18)[_0x285a('0x1f')](function(_0x543bd6){return[_0x543bd6,!![]];});});}return db[_0x285a('0xb5')]['create'](_0x27ee18)[_0x285a('0x1f')](function(_0x5c1669){return[_0x5c1669,!![]];});}})[_0x285a('0xb9')](function(_0x5ee8a1,_0x220865){if(_0x5ee8a1){_0xc12262=_0x220865;if(!_0x220865){var _0x3c7baf={'from':(_0x39fc1a[_0x285a('0xa4')][_0x285a('0xa9')]||'')+'\x20'+(_0x39fc1a[_0x285a('0xa4')]['lastName']||'')};if(_0x58e7bd[_0x285a('0x59')][_0x285a('0xb4')]&&_0x58e7bd[_0x285a('0x59')][_0x285a('0xba')]&&_0x58e7bd[_0x285a('0x59')]['threadId']!=_0x58e7bd['body']['messageId']){_0x3c7baf['threadId']=_0x58e7bd[_0x285a('0x59')]['messageId'];}return _0x5ee8a1['update'](_0x3c7baf);}else{return _0x5ee8a1;}}})[_0x285a('0x1f')](function(_0x292445){_0x39fc1a['interaction']=_0x292445[_0x285a('0x36')]({'plain':!![]});_0x39fc1a['interaction'][_0x285a('0xbb')]=_0xc12262;if(_0x39fc1a['interaction'][_0x285a('0xbb')]){if(_0x39fc1a[_0x285a('0x9e')][_0x285a('0xbc')]){_0x39fc1a[_0x285a('0x9f')]['push']({'id':0x0,'priority':_0x39fc1a[_0x285a('0x9f')][_0x285a('0x57')]+0x1,'app':_0x285a('0xbd'),'appdata':_0x285a('0xbe'),'interval':_0x285a('0xbf')});}}return db['ChatMessage'][_0x285a('0x58')]({'body':_0x58e7bd[_0x285a('0x59')][_0x285a('0x59')],'ChatWebsiteId':_0x58e7bd[_0x285a('0x55')]['id'],'ChatInteractionId':_0x292445['id'],'direction':'in','ContactId':_0x39fc1a[_0x285a('0xa4')]['id'],'AttachmentId':_0x58e7bd[_0x285a('0x59')][_0x285a('0xc0')]});})[_0x285a('0x1f')](function(_0x280aa5){_0x39fc1a[_0x285a('0x26')]=_0x280aa5;if(_0x39fc1a[_0x285a('0xb8')][_0x285a('0xc1')]){return db[_0x285a('0xc2')][_0x285a('0x5f')]({'attributes':['id','name'],'where':{'id':_0x39fc1a['interaction'][_0x285a('0xc1')]}})['then'](function(_0x397dfd){if(_0x397dfd){_0x39fc1a['applications'][_0x285a('0xc3')]({'id':0x0,'priority':0x0,'app':_0x285a('0xc4'),'appdata':_0x397dfd[_0x285a('0x39')]+','+(_0x39fc1a[_0x285a('0x9e')][_0x285a('0xc5')]||0xa),'interval':_0x285a('0xbf')});_0x39fc1a[_0x285a('0xc6')]=!![];}return respondWithRpcPromise(_0x285a('0xc7'),_0x285a('0xc8'),_0x39fc1a);});}return respondWithRpcPromise(_0x285a('0xc7'),_0x285a('0xc8'),_0x39fc1a);})['then'](function(_0x51c7f9){respondWithRpcPromise('EventManager',_0x285a('0xc9'),{'event':_0x285a('0x88'),'message':_0x51c7f9},client9002);return _0x51c7f9;})[_0x285a('0x1f')](respondWithResult(_0x4cea4f,null))['catch'](handleError(_0x4cea4f,null));};exports[_0x285a('0xca')]=function(_0x1e4aac,_0x58d481,_0x4a892a){var _0x2d0cbf,_0x5c74cf,_0x1ddd2c;var _0x440a1d=[];var _0x9a38ae=[];var _0x32b33b={};var _0x574f5a=_0x1e4aac[_0x285a('0xcb')]||[];var _0x540fc7=[];var _0x464ac6;return db[_0x285a('0x8d')]['describe']()[_0x285a('0x1f')](function(_0x5f24ca){if(!_0x5f24ca){throw new db['Sequelize'][(_0x285a('0x8e'))](_0x285a('0x8f'));}_0x9a38ae=_['difference'](_['keys'](_0x5f24ca),[_0x285a('0x90'),_0x285a('0x91')]);_0x440a1d=_['difference'](_[_0x285a('0x67')](_0x5f24ca),[_0x285a('0x90'),_0x285a('0x91'),'CompanyId',_0x285a('0xa3')]);if(_0x1e4aac[_0x285a('0x59')]['id']){delete _0x1e4aac[_0x285a('0x59')]['id'];}if(_[_0x285a('0x7c')](_0x1e4aac[_0x285a('0x59')][_0x285a('0x93')])){throw _0x58d481[_0x285a('0x29')](0x1f4)[_0x285a('0x3a')](new db[(_0x285a('0x94'))][(_0x285a('0x8e'))](_0x285a('0x95')));}if(_[_0x285a('0x7c')](_0x1e4aac[_0x285a('0x59')][_0x285a('0x59')])||_0x1e4aac['body'][_0x285a('0x59')]===''){throw _0x58d481[_0x285a('0x29')](0x1f4)[_0x285a('0x3a')](new db[(_0x285a('0x94'))][(_0x285a('0x8e'))](_0x285a('0x96')));}if(_[_0x285a('0x7c')](_0x1e4aac[_0x285a('0x59')][_0x285a('0xcc')])){throw _0x58d481['status'](0x1f4)[_0x285a('0x3a')](new db['Sequelize']['ValidationError'](_0x285a('0xcd')+_0x440a1d));}if(!_['includes'](_0x440a1d,_0x1e4aac[_0x285a('0x59')]['mapKeyOffline'])){throw _0x58d481[_0x285a('0x29')](0x1f4)[_0x285a('0x3a')](new db[(_0x285a('0x94'))][(_0x285a('0x8e'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x440a1d));}_0x32b33b[_0x1e4aac[_0x285a('0x59')][_0x285a('0xcc')]]=_0x1e4aac[_0x285a('0x59')][_0x285a('0x93')];})['then'](function(){return db[_0x285a('0x53')][_0x285a('0x5f')]({'where':{'id':_0x1e4aac['params']['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x285a('0xce')],'as':'MailAccount'}]});})[_0x285a('0x1f')](handleEntityNotFound(_0x58d481,null))[_0x285a('0x1f')](function(_0x49388b){if(_0x49388b&&_0x49388b[_0x285a('0x9d')]){_0x5c74cf=_0x49388b;var _0x13aaeb=_['defaults'](_0x1e4aac[_0x285a('0x59')],{'firstName':_0x1e4aac[_0x285a('0x59')][_0x285a('0x93')],'phone':_0x1e4aac[_0x285a('0x59')][_0x285a('0x93')],'ListId':_0x49388b[_0x285a('0xa3')]});_0x13aaeb[_0x1e4aac['body'][_0x285a('0xcc')]]=_0x1e4aac['body']['from'];return db[_0x285a('0x8d')][_0x285a('0xcf')]({'where':_0x32b33b,'defaults':_0x13aaeb});}})[_0x285a('0xb9')](function(_0x15e7c8){if(_0x15e7c8){_0x1ddd2c=_0x15e7c8;var _0x3df190=fs[_0x285a('0xd0')](path[_0x285a('0x78')](config[_0x285a('0x79')],'server/files/templates/chatOfflineMessage.ejs'),_0x285a('0xd1'));var _0x316a34=ejs['render'](_0x3df190,{'body':_[_0x285a('0xd2')](_0x1e4aac['body']['body']),'bodyTitle':_0x5c74cf[_0x285a('0xd3')]});return db[_0x285a('0xd4')]['create']({'body':_0x316a34,'ContactId':_0x15e7c8['id'],'ChatWebsiteId':_0x5c74cf['id']});}})[_0x285a('0x1f')](function(_0x5199dd){_0x464ac6=_0x5199dd;if(_0x574f5a[_0x285a('0x57')]){var _0x4a410c=_0x574f5a[_0x285a('0x3c')](function(_0x39bcfd){return{'name':_0x39bcfd[_0x285a('0xd5')],'basename':_0x39bcfd['filename'],'type':_0x39bcfd[_0x285a('0xd6')],'ChatOfflineMessageId':_0x5199dd['id']};});_0x540fc7=_0x4a410c[_0x285a('0x3c')](_0x34ac92=>{var _0x3449eb={'filename':_0x34ac92[_0x285a('0x39')],'path':path[_0x285a('0x78')](config[_0x285a('0x79')],_0x285a('0xd7'),'files',_0x285a('0xd8'),_0x285a('0xd9'),_0x34ac92[_0x285a('0xda')])};return _0x3449eb;});if(!_0x5c74cf[_0x285a('0xdb')]){return db[_0x285a('0xdc')][_0x285a('0xdd')](function(_0x40d556){return db[_0x285a('0xde')][_0x285a('0xdf')](_0x4a410c,{'transaction':_0x40d556});});}}})['then'](function(){if(_0x464ac6){_0x2d0cbf=_0x464ac6;return db['MailAccount'][_0x285a('0x6e')]({'where':{'active':!![]},'include':[{'model':db[_0x285a('0xe0')],'as':_0x285a('0xe1'),'raw':!![]}]});}})[_0x285a('0x1f')](function(_0x1ec253){if(_0x1ec253&&_0x1ec253[_0x285a('0xe1')]&&_0x5c74cf[_0x285a('0xe2')]&&_0x5c74cf[_0x285a('0xe3')]){var _0x1165f5={'tls':{'rejectUnauthorized':![]}};if(_0x1ec253[_0x285a('0xe1')][_0x285a('0xe4')]){_0x1165f5[_0x285a('0xe4')]=_0x1ec253[_0x285a('0xe1')][_0x285a('0xe4')];}else{_0x1165f5[_0x285a('0xe5')]=_0x1ec253[_0x285a('0xe1')][_0x285a('0xe5')];_0x1165f5[_0x285a('0xe6')]=_0x1ec253[_0x285a('0xe1')][_0x285a('0xe6')];_0x1165f5[_0x285a('0xe7')]=_0x1ec253[_0x285a('0xe1')][_0x285a('0xe7')];}if(_0x1ec253[_0x285a('0xe1')][_0x285a('0xe8')]){_0x1165f5[_0x285a('0xe9')]={'user':_0x1ec253[_0x285a('0xe1')][_0x285a('0x5c')],'pass':_0x1ec253['Smtp'][_0x285a('0xea')]};}return respondWithRpcPromise('SendMail',_0x285a('0xeb'),{'account':_0x1165f5,'message':{'from':util[_0x285a('0xad')]('\x22%s\x22\x20<%s>',_0x1ec253[_0x285a('0x39')],_0x1ec253[_0x285a('0xec')]||_0x1ec253['Smtp'][_0x285a('0x5c')]),'to':_0x5c74cf[_0x285a('0xe3')],'subject':_0x5c74cf[_0x285a('0xed')],'html':_0x2d0cbf['body'],'attachments':_0x540fc7}},client9003)[_0x285a('0x1f')](function(){return _0x2d0cbf;})['catch'](function(_0xe757aa){console['error'](_0xe757aa);});}})[_0x285a('0x1f')](function(){if(_0x5c74cf&&_0x5c74cf[_0x285a('0xdb')]&&_0x5c74cf['MailAccountId']){var _0x33b21c=[];if(_0x574f5a['length']){_0x33b21c=_0x574f5a[_0x285a('0x3c')](function(_0x28031e){return{'name':_0x28031e[_0x285a('0xd5')],'basename':_0x28031e[_0x285a('0x71')],'type':_0x28031e['mimetype'],'ChatOfflineMessageId':_0x464ac6['id']};});}var _0x289371;if(!_[_0x285a('0x7c')](_0x5c74cf[_0x285a('0xee')])){var _0x2a69c3=_[_0x285a('0x3c')](_0x1e4aac[_0x285a('0x59')],function(_0x2917f2){return _0x2917f2;});var _0xdf97d=_[_0x285a('0xef')](_0x2a69c3)[0x0];var _0x223a52=_[_0x285a('0xf0')](_0xdf97d,function(_0x2cecbb){return _0x2cecbb;});_0x289371=_0x223a52[0x1][_0x5c74cf[_0x285a('0xee')]];}var _0x43c002={'from':_0x1ddd2c[_0x285a('0xec')],'firstName':_0x1ddd2c[_0x285a('0xa9')],'lastName':_0x1ddd2c[_0x285a('0xf1')],'mapKey':'email','message':{'from':_0x1ddd2c['email'],'to':_0x5c74cf[_0x285a('0xce')][_0x285a('0xec')],'cc':'','subject':_[_0x285a('0x7c')](_0x289371)?_0x5c74cf[_0x285a('0xed')]:_0x289371,'messageId':'','sentAt':new Date(),'attach':_0x33b21c[_0x285a('0x57')],'attachments':_0x33b21c,'originChannel':'Chat','ChatWebsiteId':_0x5c74cf['id'],'ChatOfflineMessageId':_0x2d0cbf['id'],'originTo':_0x5c74cf[_0x285a('0xce')]['email']},'body':_0x2d0cbf[_0x285a('0x59')]};var _0x577bca={'account':{'id':_0x5c74cf['MailAccountId']},'body':_0x43c002,'log':_0x285a('0xf2')};return respondWithRpcPromise(_0x285a('0xf2'),_0x285a('0xf3'),_0x577bca,client9001)['then'](function(){return _0x2d0cbf;})[_0x285a('0x28')](function(_0x499443){console['error'](_0x499443);});}return;})[_0x285a('0x1f')](function(){if(_0x2d0cbf){return _0x2d0cbf;}})[_0x285a('0x1f')](respondWithResult(_0x58d481,null))[_0x285a('0x28')](function(_0x2f54a6){console[_0x285a('0x24')](_0x285a('0x28'),_0x2f54a6);for(var _0x387f33 of _0x574f5a){var _0x4f4028=path[_0x285a('0x78')](config['root'],_0x285a('0xd7'),_0x285a('0xcb'),_0x285a('0xd8'),_0x285a('0xd9'),_0x387f33[_0x285a('0x71')]);fs_extra['remove'](_0x4f4028)[_0x285a('0x28')](function(_0xb55037){console[_0x285a('0x24')](_0x285a('0xf4'),_0x4f4028,_0xb55037);});}});};exports[_0x285a('0xf5')]=function(_0x2644b5,_0x15900f,_0x22b708){return db[_0x285a('0xb5')][_0x285a('0x5f')]({'where':{'id':_0x2644b5[_0x285a('0x55')]['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x15900f,null))[_0x285a('0x1f')](function(_0x28ba39){if(_0x28ba39){return _0x28ba39['addInteraction'](_0x2644b5[_0x285a('0x59')][_0x285a('0x70')],_[_0x285a('0xf6')](_0x2644b5[_0x285a('0x59')],[_0x285a('0x70'),'id'])||{});}})[_0x285a('0x1f')](respondWithResult(_0x15900f,null))[_0x285a('0x28')](handleError(_0x15900f,null));};exports[_0x285a('0xf7')]=function(_0x512ac4,_0x2dec6a,_0x1c25ab){var _0x3e408f={'raw':![],'where':{}};var _0x248b2c={};var _0x54a97a={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x512ac4[_0x285a('0x55')]['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x2dec6a,null))[_0x285a('0x1f')](function(_0x5de2ce){if(_0x5de2ce){_0x248b2c[_0x285a('0x42')]=_[_0x285a('0x67')](db['ChatInteraction']['rawAttributes']);_0x248b2c['query']=_['keys'](_0x512ac4[_0x285a('0x41')]);_0x248b2c[_0x285a('0x4b')]=_[_0x285a('0x44')](_0x248b2c['model'],_0x248b2c[_0x285a('0x41')]);_0x3e408f[_0x285a('0x43')]=_[_0x285a('0x44')](_0x248b2c[_0x285a('0x42')],qs[_0x285a('0x45')](_0x512ac4[_0x285a('0x41')][_0x285a('0x45')]));_0x3e408f[_0x285a('0x43')]=_0x3e408f[_0x285a('0x43')][_0x285a('0x57')]?_0x3e408f['attributes']:_0x248b2c['model'];if(!_0x512ac4[_0x285a('0x41')][_0x285a('0x46')](_0x285a('0x47'))){_0x3e408f['limit']=qs['limit'](_0x512ac4[_0x285a('0x41')][_0x285a('0x2c')]);_0x3e408f['offset']=qs[_0x285a('0x2e')](_0x512ac4[_0x285a('0x41')][_0x285a('0x2e')]);}_0x3e408f['order']=qs['sort'](_0x512ac4[_0x285a('0x41')]['sort']);_0x3e408f[_0x285a('0x4a')]=qs[_0x285a('0x4b')](_[_0x285a('0x4c')](_0x512ac4['query'],_0x248b2c['filters']));_0x3e408f['where'][_0x285a('0x65')]=_0x5de2ce['id'];if(_0x512ac4[_0x285a('0x41')][_0x285a('0x4d')]){_0x3e408f[_0x285a('0x4a')]=_[_0x285a('0x4e')](_0x3e408f[_0x285a('0x4a')],{'$or':_[_0x285a('0x3c')](_0x3e408f[_0x285a('0x43')],function(_0x10499e){var _0x25ce70={};_0x25ce70[_0x10499e]={'$like':'%'+_0x512ac4[_0x285a('0x41')][_0x285a('0x4d')]+'%'};return _0x25ce70;})});}_0x3e408f=_[_0x285a('0x4e')]({},_0x3e408f,_0x512ac4['options']);return db['ChatInteraction'][_0x285a('0x2f')]({'where':_0x3e408f[_0x285a('0x4a')]})[_0x285a('0x1f')](function(_0x565650){_0x54a97a[_0x285a('0x2f')]=_0x565650;if(_0x512ac4['query']['includeAll']){_0x3e408f[_0x285a('0x52')]=[{'model':db['CmContact'],'as':_0x285a('0xf8'),'required':![]},{'model':db[_0x285a('0xc2')],'as':_0x285a('0xf9'),'attributes':[_0x285a('0x39'),'fullname','internal'],'required':![]},{'model':db[_0x285a('0xfa')],'as':'Tags','attributes':['id',_0x285a('0x39'),_0x285a('0xfb')],'where':_0x512ac4[_0x285a('0x41')]['tag']?{'id':_0x512ac4['query']['tag']}:undefined,'required':_0x512ac4[_0x285a('0x41')][_0x285a('0xfc')]?!![]:![]}];}return db[_0x285a('0xb5')][_0x285a('0x68')](_0x3e408f);})[_0x285a('0x1f')](function(_0x372bd3){_0x54a97a[_0x285a('0x69')]=_0x372bd3;return _0x54a97a;});}})[_0x285a('0x1f')](respondWithFilteredResult(_0x2dec6a,_0x3e408f))[_0x285a('0x28')](handleError(_0x2dec6a,null));};function iftimePromise(_0xa6f02b,_0x1a3758){return respondWithRpcPromise('Command',_0x285a('0xfd'),{'command':_0x1a3758['timezone']?util[_0x285a('0xad')](_0x285a('0xfe'),_0xa6f02b[_0x285a('0xff')],_0x1a3758[_0x285a('0x100')]):util['format'](_0x285a('0x101'),_0xa6f02b[_0x285a('0xff')])},client9002)[_0x285a('0x1f')](function(_0x2dc822){var _0x56f200=_0x2dc822&&_0x2dc822[_0x285a('0x102')](_0x285a('0x103'))>=0x0?!![]:![];logger[_0x285a('0x20')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1a3758['id'],_0xa6f02b['id'],_0xa6f02b[_0x285a('0xff')],_0x56f200?_0x285a('0x104'):_0x285a('0x105'),_0x1a3758[_0x285a('0x100')]?_0x1a3758['timezone']:'No\x20timezone');return _0x56f200;})[_0x285a('0x28')](function(_0x277ffc){logger[_0x285a('0x24')](_0x285a('0x106'),_0x1a3758['id'],_0xa6f02b['id'],_0xa6f02b['interval'],util[_0x285a('0x107')](_0x277ffc,{'showHidden':![],'depth':null}),_0x1a3758['timezone']?_0x1a3758[_0x285a('0x100')]:_0x285a('0x108'));return![];});}exports[_0x285a('0xfd')]=function(_0x2761f5,_0x1d7335,_0x5a665f){var _0x279acf=0x0;var _0x126b70=0x0;var _0x24b673=![];var _0x2078bb;var _0x594f42;return db[_0x285a('0x53')][_0x285a('0x5f')]({'where':{'id':_0x2761f5[_0x285a('0x55')]['id']},'include':[{'model':db[_0x285a('0x109')],'as':'Interval','include':[{'model':db[_0x285a('0x109')],'as':_0x285a('0x10a'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x285a('0x1f')](handleEntityNotFound(_0x1d7335,null))[_0x285a('0x1f')](function(_0x2070d4){if(_0x2070d4){_0x2078bb=_0x2070d4;return _0x2070d4[_0x285a('0x10b')]({'raw':!![]});}})['then'](function(_0x306ffc){if(_0x2078bb){if(_0x306ffc){_0x594f42=_0x306ffc;}}return require(_0x285a('0x17'))['getLicense']();})[_0x285a('0x1f')](function(_0x98233e){if(_0x98233e){_0x126b70=_0x98233e[_0x285a('0x10c')];_0x24b673=_0x98233e[_0x285a('0x7b')];}})['then'](function(){return db['ChatInteraction'][_0x285a('0x2f')]({'where':{'closed':![]}});})[_0x285a('0x1f')](function(_0x5b40da){_0x279acf=_0x5b40da;if(_0x126b70&&_0x5b40da>_0x126b70){return db[_0x285a('0x10d')][_0x285a('0x6e')]({'where':{'id':0x1}})[_0x285a('0x1f')](function(_0x2e94bb){if(_0x2e94bb){_0x2e94bb['increment'](_0x285a('0x10e'));}});}})[_0x285a('0x1f')](function(){if(_0x2078bb[_0x285a('0x109')]&&_0x2078bb[_0x285a('0x109')][_0x285a('0x10a')]){var _0x1b75d6=[];for(var _0x3c1bd2=0x0;_0x3c1bd2<_0x2078bb[_0x285a('0x109')][_0x285a('0x10a')][_0x285a('0x57')];_0x3c1bd2++){var _0x2df799=_0x2078bb[_0x285a('0x109')][_0x285a('0x10a')][_0x3c1bd2][_0x285a('0x36')]({'plain':!![]});_0x1b75d6[_0x285a('0x10f')](iftimePromise(_0x2df799,_0x2078bb));}return BPromise['all'](_0x1b75d6)[_0x285a('0x1f')](function(_0x132131){return _['some'](_0x132131);});}else{return!![];}})[_0x285a('0x1f')](function(_0x5b467c){var _0x413abc=fs['readFileSync'](path[_0x285a('0x78')](config['root'],_0x285a('0x110')),'utf8');var _0x5d39c8={'remote':_0x2078bb['remote'],'query':querystring['stringify'](_[_0x285a('0x4e')](_0x2078bb['get']({'plain':!![]}),{'customerIp':_0x2761f5['headers'][_0x285a('0xa8')]||_0x2761f5['headers'][_0x285a('0x111')]||_0x2761f5[_0x285a('0x112')][_0x285a('0x113')]||_0x2761f5['ip'],'referer':_0x2761f5[_0x285a('0xa6')][_0x285a('0xaa')],'openedInteractions':_0x279acf,'maxInteractions':_0x126b70,'virtual':_0x24b673[_0x285a('0x10c')],'online':_0x5b467c,'custom':_0x24b673}))[_0x285a('0x114')](/'/g,'\x5c\x27')};_0x1d7335[_0x285a('0x3a')](ejs[_0x285a('0x115')](Mustache['render'](_0x413abc,_0x5d39c8),{'proactiveActions':_0x594f42,'alignment':_0x2078bb['alignment'],'verticalAlignment':_0x2078bb[_0x285a('0x116')],'div_color':_0x2078bb[_0x285a('0xfb')],'text_color':_0x2078bb[_0x285a('0x117')],'button_color':_0x2078bb[_0x285a('0x118')],'background_color':_0x2078bb[_0x285a('0x119')]}));})[_0x285a('0x28')](handleError(_0x1d7335,null));};exports[_0x285a('0x11a')]=function(_0x40595b,_0xf7a4b4,_0x1fbac1){return db[_0x285a('0x53')][_0x285a('0x6e')]({'where':{'id':_0x40595b['params']['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0xf7a4b4,null))[_0x285a('0x1f')](function(_0x5672af){if(_0x5672af){return db[_0x285a('0xdc')][_0x285a('0xdd')](function(_0x477aaf){return db['ChatApplication'][_0x285a('0x35')]({'where':{'ChatWebsiteId':_0x40595b['params']['id']},'transaction':_0x477aaf})[_0x285a('0x1f')](function(_0xd976a4){var _0x12867f=_['map'](_0x40595b[_0x285a('0x59')],function(_0x2d566b){_0x2d566b[_0x285a('0x65')]=_0x40595b[_0x285a('0x55')]['id'];return _0x2d566b;});return db[_0x285a('0x11b')]['bulkCreate'](_0x12867f,{'transaction':_0x477aaf});});})[_0x285a('0x1f')](function(){return db[_0x285a('0x11b')][_0x285a('0x11c')]({'where':{'ChatWebsiteId':_0x40595b[_0x285a('0x55')]['id']},'order':'priority'});});}})[_0x285a('0x1f')](respondWithResult(_0xf7a4b4,null))[_0x285a('0x28')](handleError(_0xf7a4b4,null));};exports[_0x285a('0x11d')]=function(_0xf5e375,_0x844a00,_0x5f401d){var _0x197653={};var _0x51aa20={};var _0x5d6fc8;var _0x58cfae;return db['ChatWebsite']['findOne']({'where':{'id':_0xf5e375[_0x285a('0x55')]['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x844a00,null))[_0x285a('0x1f')](function(_0xbb8f4d){if(_0xbb8f4d){_0x5d6fc8=_0xbb8f4d;_0x51aa20['model']=_['keys'](db[_0x285a('0x11b')][_0x285a('0x3d')]);_0x51aa20[_0x285a('0x41')]=_[_0x285a('0x67')](_0xf5e375['query']);_0x51aa20[_0x285a('0x4b')]=_[_0x285a('0x44')](_0x51aa20[_0x285a('0x42')],_0x51aa20[_0x285a('0x41')]);_0x197653[_0x285a('0x43')]=_['intersection'](_0x51aa20[_0x285a('0x42')],qs['fields'](_0xf5e375['query'][_0x285a('0x45')]));_0x197653[_0x285a('0x43')]=_0x197653[_0x285a('0x43')][_0x285a('0x57')]?_0x197653[_0x285a('0x43')]:_0x51aa20[_0x285a('0x42')];_0x197653['order']=qs[_0x285a('0x49')](_0xf5e375['query'][_0x285a('0x49')]);_0x197653[_0x285a('0x4a')]=qs[_0x285a('0x4b')](_['pick'](_0xf5e375[_0x285a('0x41')],_0x51aa20['filters']));if(_0xf5e375[_0x285a('0x41')]['filter']){_0x197653[_0x285a('0x4a')]=_[_0x285a('0x4e')](_0x197653[_0x285a('0x4a')],{'$or':_[_0x285a('0x3c')](_0x197653[_0x285a('0x43')],function(_0x54bf16){var _0x4c00c1={};_0x4c00c1[_0x54bf16]={'$like':'%'+_0xf5e375[_0x285a('0x41')][_0x285a('0x4d')]+'%'};return _0x4c00c1;})});}_0x197653=_[_0x285a('0x4e')]({},_0x197653,_0xf5e375[_0x285a('0x50')]);return _0x5d6fc8[_0x285a('0x11d')](_0x197653);}})[_0x285a('0x1f')](function(_0x1fdc4b){if(_0x1fdc4b){_0x58cfae=_0x1fdc4b['length'];if(!_0xf5e375['query']['hasOwnProperty'](_0x285a('0x47'))){_0x197653['limit']=qs[_0x285a('0x2c')](_0xf5e375[_0x285a('0x41')]['limit']);_0x197653['offset']=qs[_0x285a('0x2e')](_0xf5e375['query'][_0x285a('0x2e')]);}return _0x5d6fc8['getApplications'](_0x197653);}})['then'](function(_0x3703ed){if(_0x3703ed){return _0x3703ed?{'count':_0x58cfae,'rows':_0x3703ed}:null;}})[_0x285a('0x1f')](respondWithResult(_0x844a00,null))['catch'](handleError(_0x844a00,null));};exports[_0x285a('0x11e')]=function(_0x2ea11d,_0x1230b3,_0x3121b5){return db[_0x285a('0x11f')][_0x285a('0x5f')]({'where':{'id':_0x2ea11d[_0x285a('0x55')]['id']}})['then'](handleEntityNotFound(_0x1230b3,null))[_0x285a('0x1f')](function(_0x411a89){if(_0x411a89){return _0x411a89[_0x285a('0x11e')](_0x2ea11d['body'][_0x285a('0x70')],_[_0x285a('0xf6')](_0x2ea11d['body'],['ids','id'])||{});}})[_0x285a('0x1f')](respondWithResult(_0x1230b3,null))['catch'](handleError(_0x1230b3,null));};exports['getProactiveActions']=function(_0x5b3e89,_0x5e4e9f,_0x54928b){var _0x5ca2a0={};var _0x3fa997={};var _0x827b36;var _0x124e1f;return db[_0x285a('0x53')]['findOne']({'where':{'id':_0x5b3e89[_0x285a('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e4e9f,null))[_0x285a('0x1f')](function(_0x37c7ef){if(_0x37c7ef){_0x827b36=_0x37c7ef;_0x3fa997[_0x285a('0x42')]=_['keys'](db[_0x285a('0x120')][_0x285a('0x3d')]);_0x3fa997[_0x285a('0x41')]=_['keys'](_0x5b3e89[_0x285a('0x41')]);_0x3fa997[_0x285a('0x4b')]=_['intersection'](_0x3fa997['model'],_0x3fa997[_0x285a('0x41')]);_0x5ca2a0[_0x285a('0x43')]=_[_0x285a('0x44')](_0x3fa997[_0x285a('0x42')],qs[_0x285a('0x45')](_0x5b3e89[_0x285a('0x41')][_0x285a('0x45')]));_0x5ca2a0['attributes']=_0x5ca2a0['attributes'][_0x285a('0x57')]?_0x5ca2a0[_0x285a('0x43')]:_0x3fa997[_0x285a('0x42')];_0x5ca2a0['order']=qs[_0x285a('0x49')](_0x5b3e89['query'][_0x285a('0x49')]);_0x5ca2a0[_0x285a('0x4a')]=qs[_0x285a('0x4b')](_['pick'](_0x5b3e89[_0x285a('0x41')],_0x3fa997[_0x285a('0x4b')]));if(_0x5b3e89[_0x285a('0x41')]['filter']){_0x5ca2a0[_0x285a('0x4a')]=_[_0x285a('0x4e')](_0x5ca2a0[_0x285a('0x4a')],{'$or':_[_0x285a('0x3c')](_0x5ca2a0['attributes'],function(_0x5ebed3){var _0x1866b4={};_0x1866b4[_0x5ebed3]={'$like':'%'+_0x5b3e89[_0x285a('0x41')][_0x285a('0x4d')]+'%'};return _0x1866b4;})});}_0x5ca2a0=_[_0x285a('0x4e')]({},_0x5ca2a0,_0x5b3e89[_0x285a('0x50')]);return _0x827b36[_0x285a('0x10b')](_0x5ca2a0);}})['then'](function(_0x3c9899){if(_0x3c9899){_0x124e1f=_0x3c9899[_0x285a('0x57')];if(!_0x5b3e89[_0x285a('0x41')][_0x285a('0x46')](_0x285a('0x47'))){_0x5ca2a0[_0x285a('0x2c')]=qs[_0x285a('0x2c')](_0x5b3e89[_0x285a('0x41')][_0x285a('0x2c')]);_0x5ca2a0[_0x285a('0x2e')]=qs[_0x285a('0x2e')](_0x5b3e89[_0x285a('0x41')]['offset']);}return _0x827b36[_0x285a('0x10b')](_0x5ca2a0);}})[_0x285a('0x1f')](function(_0x3203cb){if(_0x3203cb){return _0x3203cb?{'count':_0x124e1f,'rows':_0x3203cb}:null;}})[_0x285a('0x1f')](respondWithResult(_0x5e4e9f,null))[_0x285a('0x28')](handleError(_0x5e4e9f,null));};exports[_0x285a('0x121')]=function(_0x3082ad,_0x848806,_0x3208ef){var _0x501add=_0x3082ad[_0x285a('0x41')][_0x285a('0x122')]===_0x285a('0x123')?'offlineForm':_0x285a('0x124');return db[_0x285a('0x53')][_0x285a('0x5f')]({'attributes':['id',_0x501add],'where':{'id':_0x3082ad[_0x285a('0x55')]['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x848806,null))[_0x285a('0x1f')](function(_0x5ec939){if(_0x5ec939){var _0x3cfe4d=_0x5ec939[_0x501add];var _0xbeaf3b=_0x3cfe4d&&_0x3cfe4d['items']?_0x3cfe4d[_0x285a('0x125')]:[];_0x848806[_0x285a('0x3a')]({'fromKey':_[_0x285a('0x7c')](_0x3cfe4d[_0x285a('0x126')])?undefined:_0x3cfe4d[_0x285a('0x126')],'count':_0xbeaf3b[_0x285a('0x57')],'rows':_0xbeaf3b});}})['catch'](handleError(_0x848806,null));};exports[_0x285a('0x127')]=function(_0x34a20f,_0x2b242e,_0x49fe37){var _0x294e5e={'raw':![],'where':{}};var _0x204be9={};var _0x16e5e7={'count':0x0,'rows':[]};return db[_0x285a('0x53')][_0x285a('0x6e')]({'where':{'id':_0x34a20f['params']['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x2b242e,null))['then'](function(_0x266210){if(_0x266210){_0x204be9[_0x285a('0x42')]=_['keys'](db['ChatOfflineMessage'][_0x285a('0x3d')]);_0x204be9['query']=_[_0x285a('0x67')](_0x34a20f[_0x285a('0x41')]);_0x204be9['filters']=_[_0x285a('0x44')](_0x204be9[_0x285a('0x42')],_0x204be9[_0x285a('0x41')]);_0x294e5e[_0x285a('0x43')]=_[_0x285a('0x44')](_0x204be9[_0x285a('0x42')],qs['fields'](_0x34a20f['query']['fields']));_0x294e5e['attributes']=_0x294e5e[_0x285a('0x43')]['length']?_0x294e5e[_0x285a('0x43')]:_0x204be9[_0x285a('0x42')];if(!_0x34a20f['query'][_0x285a('0x46')](_0x285a('0x47'))){_0x294e5e[_0x285a('0x2c')]=qs[_0x285a('0x2c')](_0x34a20f[_0x285a('0x41')][_0x285a('0x2c')]);_0x294e5e[_0x285a('0x2e')]=qs['offset'](_0x34a20f[_0x285a('0x41')][_0x285a('0x2e')]);}_0x294e5e[_0x285a('0x48')]=qs[_0x285a('0x49')](_0x34a20f[_0x285a('0x41')][_0x285a('0x49')]);_0x294e5e[_0x285a('0x4a')]=qs['filters'](_[_0x285a('0x4c')](_0x34a20f[_0x285a('0x41')],_0x204be9[_0x285a('0x4b')]));_0x294e5e['where'][_0x285a('0x65')]=_0x266210['id'];if(_0x34a20f[_0x285a('0x41')][_0x285a('0x4d')]){_0x294e5e[_0x285a('0x4a')]=_['merge'](_0x294e5e[_0x285a('0x4a')],{'$or':_[_0x285a('0x3c')](_0x294e5e[_0x285a('0x43')],function(_0xb2b912){var _0x3a5359={};_0x3a5359[_0xb2b912]={'$like':'%'+_0x34a20f[_0x285a('0x41')][_0x285a('0x4d')]+'%'};return _0x3a5359;})});}_0x294e5e=_['merge']({},_0x294e5e,_0x34a20f['options']);return db[_0x285a('0xd4')][_0x285a('0x2f')]({'where':_0x294e5e[_0x285a('0x4a')]})[_0x285a('0x1f')](function(_0xc15418){_0x16e5e7[_0x285a('0x2f')]=_0xc15418;if(_0x34a20f[_0x285a('0x41')][_0x285a('0x51')]){_0x294e5e['include']=[{'all':!![]}];}else{_0x294e5e['include']=[{'model':db[_0x285a('0x8d')],'as':_0x285a('0xf8'),'required':![]},{'model':db[_0x285a('0xde')],'as':_0x285a('0x128'),'required':![]}];}return db[_0x285a('0xd4')][_0x285a('0x68')](_0x294e5e);})[_0x285a('0x1f')](function(_0xbb4c82){_0x16e5e7[_0x285a('0x69')]=_0xbb4c82;return _0x16e5e7;});}})[_0x285a('0x1f')](respondWithFilteredResult(_0x2b242e,_0x294e5e))[_0x285a('0x28')](handleError(_0x2b242e,null));};exports[_0x285a('0x129')]=function(_0x2162ac,_0x6cb15f,_0x12279d){return db[_0x285a('0x53')][_0x285a('0x5f')]({'where':{'id':_0x2162ac[_0x285a('0x55')]['id']}})['then'](handleEntityNotFound(_0x6cb15f,null))[_0x285a('0x1f')](function(_0x512c8e){if(_0x512c8e){return _0x512c8e[_0x285a('0x129')](_0x2162ac['body'][_0x285a('0x70')],_[_0x285a('0xf6')](_0x2162ac[_0x285a('0x59')],[_0x285a('0x70'),'id'])||{})[_0x285a('0xb9')](function(_0x513c53){for(var _0x2098c1=0x0;_0x2098c1<_0x2162ac[_0x285a('0x59')][_0x285a('0x70')][_0x285a('0x57')];_0x2098c1+=0x1){socket['emit'](_0x285a('0x12a'),{'UserId':Number(_0x2162ac['body'][_0x285a('0x70')][_0x2098c1]),'ChatWebsiteId':Number(_0x2162ac['params']['id'])});}return _0x513c53;});}})['then'](respondWithResult(_0x6cb15f,null))[_0x285a('0x28')](handleError(_0x6cb15f,null));};exports[_0x285a('0x12b')]=function(_0x33c6bf,_0x25f118,_0x4ea3d0){return db[_0x285a('0x53')][_0x285a('0x5f')]({'where':{'id':_0x33c6bf['params']['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x25f118,null))[_0x285a('0x1f')](function(_0x3eabb6){if(_0x3eabb6){return _0x3eabb6[_0x285a('0x12b')](_0x33c6bf['query']['ids'])['then'](function(){if(_[_0x285a('0x12c')](_0x33c6bf[_0x285a('0x41')]['ids'])){for(var _0xd9e6db=0x0;_0xd9e6db<_0x33c6bf[_0x285a('0x41')][_0x285a('0x70')]['length'];_0xd9e6db+=0x1){socket[_0x285a('0x12d')](_0x285a('0x12e'),{'UserId':Number(_0x33c6bf[_0x285a('0x41')][_0x285a('0x70')][_0xd9e6db]),'ChatWebsiteId':Number(_0x33c6bf[_0x285a('0x55')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x33c6bf[_0x285a('0x41')][_0x285a('0x70')]),'ChatWebsiteId':Number(_0x33c6bf[_0x285a('0x55')]['id'])});}});}})[_0x285a('0x1f')](respondWithStatusCode(_0x25f118,null))['catch'](handleError(_0x25f118,null));};exports[_0x285a('0x12f')]=function(_0x413f98,_0x5f0169,_0x1c5e01){var _0x2a8a45={};var _0x294334={};var _0x159c94;var _0x1a9146;return db['ChatWebsite'][_0x285a('0x6e')]({'where':{'id':_0x413f98['params']['id']}})[_0x285a('0x1f')](handleEntityNotFound(_0x5f0169,null))[_0x285a('0x1f')](function(_0x47c7a7){if(_0x47c7a7){_0x159c94=_0x47c7a7;_0x294334[_0x285a('0x42')]=_['keys'](db[_0x285a('0xc2')]['rawAttributes']);_0x294334[_0x285a('0x41')]=_[_0x285a('0x67')](_0x413f98['query']);_0x294334[_0x285a('0x4b')]=_[_0x285a('0x44')](_0x294334[_0x285a('0x42')],_0x294334[_0x285a('0x41')]);_0x2a8a45[_0x285a('0x43')]=_[_0x285a('0x44')](_0x294334[_0x285a('0x42')],qs[_0x285a('0x45')](_0x413f98[_0x285a('0x41')][_0x285a('0x45')]));_0x2a8a45['attributes']=_0x2a8a45[_0x285a('0x43')][_0x285a('0x57')]?_0x2a8a45[_0x285a('0x43')]:_0x294334[_0x285a('0x42')];_0x2a8a45[_0x285a('0x48')]=qs[_0x285a('0x49')](_0x413f98[_0x285a('0x41')][_0x285a('0x49')]);_0x2a8a45[_0x285a('0x4a')]=qs['filters'](_['pick'](_0x413f98[_0x285a('0x41')],_0x294334['filters']));if(_0x413f98[_0x285a('0x41')]['filter']){_0x2a8a45[_0x285a('0x4a')]=_['merge'](_0x2a8a45[_0x285a('0x4a')],{'$or':_[_0x285a('0x3c')](_0x2a8a45[_0x285a('0x43')],function(_0x1d6be9){var _0x56d6fe={};_0x56d6fe[_0x1d6be9]={'$like':'%'+_0x413f98[_0x285a('0x41')][_0x285a('0x4d')]+'%'};return _0x56d6fe;})});}_0x2a8a45=_[_0x285a('0x4e')]({},_0x2a8a45,_0x413f98['options']);return _0x159c94[_0x285a('0x12f')](_0x2a8a45);}})[_0x285a('0x1f')](function(_0x3135fe){if(_0x3135fe){_0x1a9146=_0x3135fe[_0x285a('0x57')];if(!_0x413f98['query']['hasOwnProperty']('nolimit')){_0x2a8a45[_0x285a('0x2c')]=qs[_0x285a('0x2c')](_0x413f98[_0x285a('0x41')][_0x285a('0x2c')]);_0x2a8a45[_0x285a('0x2e')]=qs[_0x285a('0x2e')](_0x413f98[_0x285a('0x41')]['offset']);}return _0x159c94[_0x285a('0x12f')](_0x2a8a45);}})[_0x285a('0x1f')](function(_0x30857c){if(_0x30857c){return _0x30857c?{'count':_0x1a9146,'rows':_0x30857c}:null;}})[_0x285a('0x1f')](respondWithResult(_0x5f0169,null))['catch'](handleError(_0x5f0169,null));}; \ No newline at end of file +var _0x0903=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatWebsite.socket','jayson/promise','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','json','offset','undefined','count','limit','status','apply','destroy','get','ChatWebsites','name','Pause','mandatoryDispositionPause','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show','params','ChatWebsite','keys','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','getDispositions','findOne','hasOwnProperty','Disposition','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','getLicense','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','headers','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','ChatApplication','Applications','applications','list','List','orderBy','asc','account','defaults','contact','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','vendor','%s\x20%s\x20%s','device','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','offline','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','ChatOfflineMessage','originalname','basename','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','port','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','lastName','NotifyMailAccount','notifyMail','server','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','virtual','custom','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','utf8','remote','x-real-ip','connection','replace','verticalAlignment','textColor','color_button','backgroundColor','addApplications','sequelize','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','false','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api'];(function(_0x4ee3cf,_0x52d38c){var _0x4f8ef4=function(_0x3ca0b8){while(--_0x3ca0b8){_0x4ee3cf['push'](_0x4ee3cf['shift']());}};_0x4f8ef4(++_0x52d38c);}(_0x0903,0x124));var _0x3090=function(_0x46a38b,_0x16ffb5){_0x46a38b=_0x46a38b-0x0;var _0x346e75=_0x0903[_0x46a38b];return _0x346e75;};'use strict';var emlformat=require(_0x3090('0x0'));var rimraf=require(_0x3090('0x1'));var zipdir=require(_0x3090('0x2'));var jsonpatch=require(_0x3090('0x3'));var rp=require('request-promise');var moment=require(_0x3090('0x4'));var BPromise=require(_0x3090('0x5'));var Mustache=require(_0x3090('0x6'));var util=require(_0x3090('0x7'));var path=require(_0x3090('0x8'));var sox=require('sox');var csv=require(_0x3090('0x9'));var ejs=require(_0x3090('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3090('0xb'));var squel=require(_0x3090('0xc'));var crypto=require(_0x3090('0xd'));var jsforce=require(_0x3090('0xe'));var deskjs=require(_0x3090('0xf'));var toCsv=require(_0x3090('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3090('0x10'));var authService=require(_0x3090('0x11'));var qs=require(_0x3090('0x12'));var as=require(_0x3090('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3090('0x14'));var utils=require(_0x3090('0x15'));var config=require(_0x3090('0x16'));var licenseUtil=require(_0x3090('0x17'));var db=require(_0x3090('0x18'))['db'];config[_0x3090('0x19')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3090('0x1a'))(new Redis(config[_0x3090('0x19')]));require(_0x3090('0x1b'))['register'](socket);var jayson=require(_0x3090('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x3090('0x1d')][_0x3090('0x1e')]({'port':0x232a});var client9003=jayson[_0x3090('0x1d')][_0x3090('0x1e')]({'port':0x232b});var client9001=jayson['client'][_0x3090('0x1e')]({'port':0x2329});function respondWithRpcPromise(_0x582a6b,_0x22900a,_0xe29afc,_0x2d2ba1){return new BPromise(function(_0x5e2c89,_0x509268){var _0x2198db=_0x2d2ba1||client;return _0x2198db[_0x3090('0x1f')](_0x582a6b,_0xe29afc)[_0x3090('0x20')](function(_0x2541b6){logger[_0x3090('0x21')](_0x3090('0x22'),_0x22900a,_0x3090('0x23'));logger[_0x3090('0x24')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x22900a,_0x3090('0x23'),JSON[_0x3090('0x25')](_0x2541b6));if(_0x2541b6['error']){if(_0x2541b6[_0x3090('0x26')][_0x3090('0x27')]===0x1f4){logger[_0x3090('0x26')](_0x3090('0x22'),_0x22900a,_0x2541b6[_0x3090('0x26')][_0x3090('0x28')]);return _0x509268(_0x2541b6['error'][_0x3090('0x28')]);}logger[_0x3090('0x26')](_0x3090('0x22'),_0x22900a,_0x2541b6[_0x3090('0x26')][_0x3090('0x28')]);return _0x5e2c89(_0x2541b6[_0x3090('0x26')]['message']);}else{logger[_0x3090('0x21')]('ChatWebsite,\x20%s,\x20%s',_0x22900a,_0x3090('0x23'));_0x5e2c89(_0x2541b6[_0x3090('0x29')]['message']);}})[_0x3090('0x2a')](function(_0x4e8d34){logger[_0x3090('0x26')](_0x3090('0x22'),_0x22900a,_0x4e8d34);_0x509268(_0x4e8d34);});});}function respondWithStatusCode(_0x4e822b,_0x637f91){_0x637f91=_0x637f91||0xcc;return function(_0x129cc0){if(_0x129cc0){return _0x4e822b[_0x3090('0x2b')](_0x637f91);}return _0x4e822b['status'](_0x637f91)[_0x3090('0x2c')]();};}function respondWithResult(_0x2f8fcf,_0x5dfd0f){_0x5dfd0f=_0x5dfd0f||0xc8;return function(_0xaf57ba){if(_0xaf57ba){return _0x2f8fcf['status'](_0x5dfd0f)[_0x3090('0x2d')](_0xaf57ba);}};}function respondWithFilteredResult(_0x117e85,_0x381d45){return function(_0xadbf3a){if(_0xadbf3a){var _0x5a0952=typeof _0x381d45[_0x3090('0x2e')]===_0x3090('0x2f')&&typeof _0x381d45['limit']===_0x3090('0x2f');var _0x5bc264=_0xadbf3a[_0x3090('0x30')];var _0x276048=_0x5a0952?0x0:_0x381d45[_0x3090('0x2e')];var _0x1a5d08=_0x5a0952?_0xadbf3a[_0x3090('0x30')]:_0x381d45[_0x3090('0x2e')]+_0x381d45[_0x3090('0x31')];var _0x538d67;if(_0x1a5d08>=_0x5bc264){_0x1a5d08=_0x5bc264;_0x538d67=0xc8;}else{_0x538d67=0xce;}_0x117e85[_0x3090('0x32')](_0x538d67);return _0x117e85['set']('Content-Range',_0x276048+'-'+_0x1a5d08+'/'+_0x5bc264)[_0x3090('0x2d')](_0xadbf3a);}return null;};}function patchUpdates(_0x3065ed){return function(_0x27e2e2){try{jsonpatch[_0x3090('0x33')](_0x27e2e2,_0x3065ed,!![]);}catch(_0x322f7e){return BPromise['reject'](_0x322f7e);}return _0x27e2e2['save']();};}function saveUpdates(_0x4cd9cb,_0x258763){return function(_0xd948b5){if(_0xd948b5){return _0xd948b5['update'](_0x4cd9cb)['then'](function(_0x17a488){return _0x17a488;});}return null;};}function removeEntity(_0x3d0266,_0x1bb915){return function(_0xe08f3c){if(_0xe08f3c){return _0xe08f3c[_0x3090('0x34')]()['then'](function(){var _0xf73892=_0xe08f3c[_0x3090('0x35')]({'plain':!![]});var _0x48d8db=_0x3090('0x36');return db['UserProfileResource'][_0x3090('0x34')]({'where':{'type':_0x48d8db,'resourceId':_0xf73892['id']}})[_0x3090('0x20')](function(){return _0xe08f3c;});})['then'](function(){_0x3d0266[_0x3090('0x32')](0xcc)[_0x3090('0x2c')]();});}};}function handleEntityNotFound(_0x19ffaa,_0x22d641){return function(_0x3b60d7){if(!_0x3b60d7){_0x19ffaa[_0x3090('0x2b')](0x194);}return _0x3b60d7;};}function handleError(_0x28f77a,_0x5335da){_0x5335da=_0x5335da||0x1f4;return function(_0x26e3ad){logger[_0x3090('0x26')](_0x26e3ad['stack']);if(_0x26e3ad[_0x3090('0x37')]){delete _0x26e3ad[_0x3090('0x37')];}_0x28f77a[_0x3090('0x32')](_0x5335da)['send'](_0x26e3ad);};}exports['index']=function(_0x54a103,_0x177430){var _0x5c55d3={'include':[{'model':db[_0x3090('0x38')],'as':_0x3090('0x39')}]},_0x21d471={},_0x1fd779={'count':0x0,'rows':[]};var _0x23399a=_['map'](db['ChatWebsite'][_0x3090('0x3a')],function(_0xe81fb0){return{'name':_0xe81fb0[_0x3090('0x3b')],'type':_0xe81fb0[_0x3090('0x3c')][_0x3090('0x3d')]};});_0x21d471['model']=_[_0x3090('0x3e')](_0x23399a,_0x3090('0x37'));_0x21d471['query']=_['keys'](_0x54a103[_0x3090('0x3f')]);_0x21d471[_0x3090('0x40')]=_['intersection'](_0x21d471[_0x3090('0x41')],_0x21d471[_0x3090('0x3f')]);_0x5c55d3[_0x3090('0x42')]=_['intersection'](_0x21d471[_0x3090('0x41')],qs[_0x3090('0x43')](_0x54a103[_0x3090('0x3f')]['fields']));_0x5c55d3[_0x3090('0x42')]=_0x5c55d3['attributes'][_0x3090('0x44')]?_0x5c55d3['attributes']:_0x21d471[_0x3090('0x41')];if(!_0x54a103[_0x3090('0x3f')]['hasOwnProperty'](_0x3090('0x45'))){_0x5c55d3['limit']=qs[_0x3090('0x31')](_0x54a103[_0x3090('0x3f')]['limit']);_0x5c55d3[_0x3090('0x2e')]=qs['offset'](_0x54a103['query'][_0x3090('0x2e')]);}_0x5c55d3[_0x3090('0x46')]=qs[_0x3090('0x47')](_0x54a103[_0x3090('0x3f')][_0x3090('0x47')]);_0x5c55d3[_0x3090('0x48')]=qs[_0x3090('0x40')](_[_0x3090('0x49')](_0x54a103['query'],_0x21d471[_0x3090('0x40')]),_0x23399a);if(_0x54a103[_0x3090('0x3f')][_0x3090('0x4a')]){_0x5c55d3[_0x3090('0x48')]=_[_0x3090('0x4b')](_0x5c55d3[_0x3090('0x48')],{'$or':_['map'](_0x23399a,function(_0x2f319f){if(_0x2f319f[_0x3090('0x3c')]!==_0x3090('0x4c')){var _0x4eadfb={};_0x4eadfb[_0x2f319f['name']]={'$like':'%'+_0x54a103[_0x3090('0x3f')][_0x3090('0x4a')]+'%'};return _0x4eadfb;}})});}_0x5c55d3=_[_0x3090('0x4b')]({},_0x5c55d3,_0x54a103['options']);var _0x323ca0={'where':_0x5c55d3[_0x3090('0x48')]};return db['ChatWebsite'][_0x3090('0x30')](_0x323ca0)['then'](function(_0x5b9551){_0x1fd779['count']=_0x5b9551;if(_0x54a103[_0x3090('0x3f')][_0x3090('0x4d')]){_0x5c55d3[_0x3090('0x4e')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x5c55d3);})[_0x3090('0x20')](function(_0x2f8e68){_0x1fd779['rows']=_0x2f8e68;return _0x1fd779;})['then'](respondWithFilteredResult(_0x177430,_0x5c55d3))[_0x3090('0x2a')](handleError(_0x177430,null));};exports[_0x3090('0x4f')]=function(_0x2c07e6,_0x40d3a3){var _0x4aeddf={'raw':![],'where':{'id':_0x2c07e6[_0x3090('0x50')]['id']},'include':[{'model':db[_0x3090('0x38')],'as':_0x3090('0x39')}]},_0x21a533={};_0x21a533[_0x3090('0x41')]=_['keys'](db[_0x3090('0x51')]['rawAttributes']);_0x21a533['query']=_[_0x3090('0x52')](_0x2c07e6[_0x3090('0x3f')]);_0x21a533[_0x3090('0x40')]=_[_0x3090('0x53')](_0x21a533[_0x3090('0x41')],_0x21a533[_0x3090('0x3f')]);_0x4aeddf[_0x3090('0x42')]=_['intersection'](_0x21a533['model'],qs['fields'](_0x2c07e6[_0x3090('0x3f')][_0x3090('0x43')]));_0x4aeddf['attributes']=_0x4aeddf['attributes']['length']?_0x4aeddf[_0x3090('0x42')]:_0x21a533['model'];if(_0x2c07e6[_0x3090('0x3f')][_0x3090('0x4d')]){_0x4aeddf[_0x3090('0x4e')]=[{'all':!![]}];}_0x4aeddf=_[_0x3090('0x4b')]({},_0x4aeddf,_0x2c07e6[_0x3090('0x54')]);return db[_0x3090('0x51')][_0x3090('0x55')](_0x4aeddf)[_0x3090('0x20')](handleEntityNotFound(_0x40d3a3,null))[_0x3090('0x20')](respondWithResult(_0x40d3a3,null))[_0x3090('0x2a')](handleError(_0x40d3a3,null));};exports['create']=function(_0x20fb8d,_0x1bbaac){return db['ChatWebsite'][_0x3090('0x56')](_0x20fb8d[_0x3090('0x57')],{})[_0x3090('0x20')](function(_0x1d4368){var _0x30187b=_0x20fb8d[_0x3090('0x58')]['get']({'plain':!![]});if(!_0x30187b)throw new Error(_0x3090('0x59'));if(_0x30187b[_0x3090('0x5a')]==='user'){var _0x144b3c=_0x1d4368[_0x3090('0x35')]({'plain':!![]});var _0x59818b=_0x3090('0x36');return db[_0x3090('0x5b')][_0x3090('0x55')]({'where':{'name':_0x59818b,'userProfileId':_0x30187b[_0x3090('0x5c')]},'raw':!![]})[_0x3090('0x20')](function(_0x30c602){if(_0x30c602&&_0x30c602[_0x3090('0x5d')]===0x0){return db[_0x3090('0x5e')][_0x3090('0x56')]({'name':_0x144b3c[_0x3090('0x37')],'resourceId':_0x144b3c['id'],'type':_0x30c602[_0x3090('0x37')],'sectionId':_0x30c602['id']},{})[_0x3090('0x20')](function(){return _0x1d4368;});}else{return _0x1d4368;}})['catch'](function(_0xa04939){logger[_0x3090('0x26')](_0x3090('0x5f'),_0xa04939);throw _0xa04939;});}return _0x1d4368;})[_0x3090('0x20')](respondWithResult(_0x1bbaac,0xc9))[_0x3090('0x2a')](handleError(_0x1bbaac,null));};exports[_0x3090('0x60')]=function(_0x5b9dc4,_0x59e0b5){if(_0x5b9dc4[_0x3090('0x57')]['id']){delete _0x5b9dc4['body']['id'];}return db[_0x3090('0x51')]['find']({'where':{'id':_0x5b9dc4[_0x3090('0x50')]['id']},'include':[{'model':db[_0x3090('0x38')],'as':_0x3090('0x39')}]})[_0x3090('0x20')](handleEntityNotFound(_0x59e0b5,null))[_0x3090('0x20')](saveUpdates(_0x5b9dc4[_0x3090('0x57')],null))[_0x3090('0x20')](respondWithResult(_0x59e0b5,null))[_0x3090('0x2a')](handleError(_0x59e0b5,null));};exports[_0x3090('0x34')]=function(_0x36e36d,_0x24d6f4){return db['ChatWebsite'][_0x3090('0x55')]({'where':{'id':_0x36e36d[_0x3090('0x50')]['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x24d6f4,null))[_0x3090('0x20')](removeEntity(_0x24d6f4,null))[_0x3090('0x2a')](handleError(_0x24d6f4,null));};exports[_0x3090('0x61')]=function(_0x578b89,_0x30653a){return db[_0x3090('0x51')][_0x3090('0x61')]()[_0x3090('0x20')](respondWithResult(_0x30653a,null))[_0x3090('0x2a')](handleError(_0x30653a,null));};exports[_0x3090('0x62')]=function(_0x393567,_0x5c7340,_0x4d6209){if(_0x393567['body']['id']){delete _0x393567[_0x3090('0x57')]['id'];}return db[_0x3090('0x51')][_0x3090('0x55')]({'where':{'id':_0x393567[_0x3090('0x50')]['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x5c7340,null))[_0x3090('0x20')](function(_0x4b7df5){if(_0x4b7df5){_0x393567[_0x3090('0x57')][_0x3090('0x63')]=_0x4b7df5['id'];return db['Disposition'][_0x3090('0x56')](_0x393567['body']);}})[_0x3090('0x20')](respondWithResult(_0x5c7340,null))[_0x3090('0x2a')](handleError(_0x5c7340,null));};exports[_0x3090('0x64')]=function(_0x14e616,_0x7dcb8b,_0x2f7308){var _0x5789dd={'raw':![],'where':{}};var _0x3a64b4={};var _0x14cd43={'count':0x0,'rows':[]};return db[_0x3090('0x51')][_0x3090('0x65')]({'where':{'id':_0x14e616[_0x3090('0x50')]['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x7dcb8b,null))[_0x3090('0x20')](function(_0x5823a8){if(_0x5823a8){_0x3a64b4[_0x3090('0x41')]=_[_0x3090('0x52')](db['Disposition'][_0x3090('0x3a')]);_0x3a64b4[_0x3090('0x3f')]=_[_0x3090('0x52')](_0x14e616[_0x3090('0x3f')]);_0x3a64b4['filters']=_[_0x3090('0x53')](_0x3a64b4[_0x3090('0x41')],_0x3a64b4[_0x3090('0x3f')]);_0x5789dd['attributes']=_['intersection'](_0x3a64b4[_0x3090('0x41')],qs[_0x3090('0x43')](_0x14e616[_0x3090('0x3f')][_0x3090('0x43')]));_0x5789dd['attributes']=_0x5789dd[_0x3090('0x42')][_0x3090('0x44')]?_0x5789dd[_0x3090('0x42')]:_0x3a64b4[_0x3090('0x41')];if(!_0x14e616['query'][_0x3090('0x66')](_0x3090('0x45'))){_0x5789dd[_0x3090('0x31')]=qs[_0x3090('0x31')](_0x14e616[_0x3090('0x3f')][_0x3090('0x31')]);_0x5789dd[_0x3090('0x2e')]=qs['offset'](_0x14e616[_0x3090('0x3f')][_0x3090('0x2e')]);}_0x5789dd[_0x3090('0x46')]=qs[_0x3090('0x47')](_0x14e616[_0x3090('0x3f')][_0x3090('0x47')]);_0x5789dd[_0x3090('0x48')]=qs[_0x3090('0x40')](_[_0x3090('0x49')](_0x14e616[_0x3090('0x3f')],_0x3a64b4[_0x3090('0x40')]));_0x5789dd[_0x3090('0x48')][_0x3090('0x63')]=_0x5823a8['id'];if(_0x14e616['query'][_0x3090('0x4a')]){_0x5789dd['where']=_['merge'](_0x5789dd[_0x3090('0x48')],{'$or':_[_0x3090('0x3e')](_0x5789dd[_0x3090('0x42')],function(_0x3b403c){var _0x5baf8b={};_0x5baf8b[_0x3b403c]={'$like':'%'+_0x14e616[_0x3090('0x3f')][_0x3090('0x4a')]+'%'};return _0x5baf8b;})});}_0x5789dd=_[_0x3090('0x4b')]({},_0x5789dd,_0x14e616[_0x3090('0x54')]);return db[_0x3090('0x67')][_0x3090('0x30')]({'where':_0x5789dd[_0x3090('0x48')]})[_0x3090('0x20')](function(_0x5aa3fa){_0x14cd43[_0x3090('0x30')]=_0x5aa3fa;if(_0x14e616['query'][_0x3090('0x4d')]){_0x5789dd['include']=[{'all':!![]}];}return db[_0x3090('0x67')][_0x3090('0x68')](_0x5789dd);})[_0x3090('0x20')](function(_0x392460){_0x14cd43[_0x3090('0x69')]=_0x392460;return _0x14cd43;});}})['then'](respondWithFilteredResult(_0x7dcb8b,_0x5789dd))[_0x3090('0x2a')](handleError(_0x7dcb8b,null));};exports[_0x3090('0x6a')]=function(_0x3deaf4,_0x16e53c,_0x78f61){return db[_0x3090('0x51')][_0x3090('0x55')]({'where':{'id':_0x3deaf4[_0x3090('0x50')]['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x16e53c,null))[_0x3090('0x20')](function(_0xaf2080){if(_0xaf2080){return _0xaf2080[_0x3090('0x6a')](_0x3deaf4['query'][_0x3090('0x6b')]);}})[_0x3090('0x20')](respondWithStatusCode(_0x16e53c,null))[_0x3090('0x2a')](handleError(_0x16e53c,null));};exports[_0x3090('0x6c')]=function(_0x1ca8ab,_0x10dbd8,_0xd1697){if(_0x1ca8ab[_0x3090('0x57')]['id']){delete _0x1ca8ab['body']['id'];}return db[_0x3090('0x51')][_0x3090('0x55')]({'where':{'id':_0x1ca8ab['params']['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x10dbd8,null))[_0x3090('0x20')](function(_0x42466a){if(_0x42466a){_0x1ca8ab[_0x3090('0x57')]['ChatWebsiteId']=_0x42466a['id'];return db['CannedAnswer'][_0x3090('0x56')](_0x1ca8ab[_0x3090('0x57')]);}})[_0x3090('0x20')](respondWithResult(_0x10dbd8,null))[_0x3090('0x2a')](handleError(_0x10dbd8,null));};exports['getAnswers']=function(_0x5567be,_0x5aee70,_0x5427b2){var _0x10e4c8={'raw':![],'where':{}};var _0x283b55={};var _0x1b208d={'count':0x0,'rows':[]};return db[_0x3090('0x51')]['findOne']({'where':{'id':_0x5567be[_0x3090('0x50')]['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x5aee70,null))[_0x3090('0x20')](function(_0x3b35fd){if(_0x3b35fd){_0x283b55['model']=_[_0x3090('0x52')](db[_0x3090('0x6d')][_0x3090('0x3a')]);_0x283b55['query']=_['keys'](_0x5567be[_0x3090('0x3f')]);_0x283b55[_0x3090('0x40')]=_[_0x3090('0x53')](_0x283b55[_0x3090('0x41')],_0x283b55[_0x3090('0x3f')]);_0x10e4c8[_0x3090('0x42')]=_[_0x3090('0x53')](_0x283b55['model'],qs[_0x3090('0x43')](_0x5567be['query'][_0x3090('0x43')]));_0x10e4c8['attributes']=_0x10e4c8[_0x3090('0x42')][_0x3090('0x44')]?_0x10e4c8[_0x3090('0x42')]:_0x283b55[_0x3090('0x41')];if(!_0x5567be[_0x3090('0x3f')][_0x3090('0x66')]('nolimit')){_0x10e4c8[_0x3090('0x31')]=qs[_0x3090('0x31')](_0x5567be['query'][_0x3090('0x31')]);_0x10e4c8[_0x3090('0x2e')]=qs[_0x3090('0x2e')](_0x5567be[_0x3090('0x3f')]['offset']);}_0x10e4c8[_0x3090('0x46')]=qs[_0x3090('0x47')](_0x5567be[_0x3090('0x3f')][_0x3090('0x47')]);_0x10e4c8[_0x3090('0x48')]=qs[_0x3090('0x40')](_[_0x3090('0x49')](_0x5567be[_0x3090('0x3f')],_0x283b55[_0x3090('0x40')]));_0x10e4c8[_0x3090('0x48')][_0x3090('0x63')]=_0x3b35fd['id'];if(_0x5567be[_0x3090('0x3f')][_0x3090('0x4a')]){_0x10e4c8[_0x3090('0x48')]=_['merge'](_0x10e4c8[_0x3090('0x48')],{'$or':_[_0x3090('0x3e')](_0x10e4c8[_0x3090('0x42')],function(_0x4f3f34){var _0x1da3d7={};_0x1da3d7[_0x4f3f34]={'$like':'%'+_0x5567be[_0x3090('0x3f')][_0x3090('0x4a')]+'%'};return _0x1da3d7;})});}_0x10e4c8=_['merge']({},_0x10e4c8,_0x5567be[_0x3090('0x54')]);return db[_0x3090('0x6d')][_0x3090('0x30')]({'where':_0x10e4c8[_0x3090('0x48')]})[_0x3090('0x20')](function(_0x548789){_0x1b208d[_0x3090('0x30')]=_0x548789;if(_0x5567be['query'][_0x3090('0x4d')]){_0x10e4c8[_0x3090('0x4e')]=[{'all':!![]}];}return db[_0x3090('0x6d')][_0x3090('0x68')](_0x10e4c8);})['then'](function(_0x58f49d){_0x1b208d['rows']=_0x58f49d;return _0x1b208d;});}})[_0x3090('0x20')](respondWithFilteredResult(_0x5aee70,_0x10e4c8))[_0x3090('0x2a')](handleError(_0x5aee70,null));};exports[_0x3090('0x6e')]=function(_0x435d6f,_0x5b36fd,_0x85449){return db[_0x3090('0x51')][_0x3090('0x55')]({'where':{'id':_0x435d6f[_0x3090('0x50')]['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x5b36fd,null))[_0x3090('0x20')](function(_0x261604){if(_0x261604){return _0x261604[_0x3090('0x6e')](_0x435d6f[_0x3090('0x3f')][_0x3090('0x6b')]);}})[_0x3090('0x20')](respondWithStatusCode(_0x5b36fd,null))[_0x3090('0x2a')](handleError(_0x5b36fd,null));};exports[_0x3090('0x6f')]=function(_0x140215,_0x2dae7b,_0x34825b){_0x140215['body'][_0x3090('0x70')]=_0x140215[_0x3090('0x71')][_0x3090('0x72')];return db[_0x3090('0x51')][_0x3090('0x55')]({'where':{'id':_0x140215['params']['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x2dae7b,null))[_0x3090('0x20')](saveUpdates(_0x140215[_0x3090('0x57')],null))[_0x3090('0x20')](respondWithResult(_0x2dae7b,null))[_0x3090('0x2a')](handleError(_0x2dae7b,null));};exports['addAvatar']=function(_0x2ab03d,_0x255695,_0x191e4a){_0x2ab03d[_0x3090('0x57')][_0x3090('0x73')]=_0x2ab03d['file'][_0x3090('0x72')];return db[_0x3090('0x51')]['find']({'where':{'id':_0x2ab03d['params']['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x255695,null))[_0x3090('0x20')](saveUpdates(_0x2ab03d[_0x3090('0x57')],null))[_0x3090('0x20')](respondWithResult(_0x255695,null))[_0x3090('0x2a')](handleError(_0x255695,null));};exports[_0x3090('0x74')]=function(_0x4f0783,_0x38ee07,_0x4be023){_0x4f0783['body'][_0x3090('0x75')]=_0x4f0783[_0x3090('0x71')][_0x3090('0x72')];return db[_0x3090('0x51')][_0x3090('0x55')]({'where':{'id':_0x4f0783['params']['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x38ee07,null))['then'](saveUpdates(_0x4f0783[_0x3090('0x57')],null))['then'](respondWithResult(_0x38ee07,null))['catch'](handleError(_0x38ee07,null));};exports[_0x3090('0x76')]=function(_0x55d043,_0x57ad13,_0x51bdfa){_0x55d043[_0x3090('0x57')]['systemAvatar']=_0x55d043[_0x3090('0x71')]['filename'];return db[_0x3090('0x51')]['find']({'where':{'id':_0x55d043[_0x3090('0x50')]['id']}})['then'](handleEntityNotFound(_0x57ad13,null))[_0x3090('0x20')](saveUpdates(_0x55d043[_0x3090('0x57')],null))[_0x3090('0x20')](respondWithResult(_0x57ad13,null))[_0x3090('0x2a')](handleError(_0x57ad13,null));};exports[_0x3090('0x77')]=function(_0x13353d,_0x5a371a,_0xcec680){var _0x4d8a7f=path[_0x3090('0x78')](config[_0x3090('0x79')],'server/files/images/logos/default_logo.svg');var _0x175440={'where':{'id':_0x13353d[_0x3090('0x50')]['id']},'attributes':['id',_0x3090('0x70')],'raw':!![]};var _0xa2f531=![];return require(_0x3090('0x17'))[_0x3090('0x7a')]()[_0x3090('0x20')](function(_0xf410ae){if(_0xf410ae){_0xa2f531=_0xf410ae['custom'];}})[_0x3090('0x20')](function(){return db[_0x3090('0x51')]['find'](_0x175440);})[_0x3090('0x20')](handleEntityNotFound(_0x5a371a,null))[_0x3090('0x20')](function(_0x7e5a02){if(_0x7e5a02){if(!_[_0x3090('0x7b')](_0x7e5a02[_0x3090('0x70')])){if(fs[_0x3090('0x7c')](path[_0x3090('0x78')](config[_0x3090('0x79')],_0x3090('0x7d'),_0x7e5a02[_0x3090('0x70')]))&&_0xa2f531){_0x4d8a7f=path['join'](config['root'],'server/files/images/logos/',_0x7e5a02[_0x3090('0x70')]);}}return _0x5a371a[_0x3090('0x7e')](_0x4d8a7f);}})['catch'](handleError(_0x5a371a,null));};exports['getAvatar']=function(_0x50f917,_0x4c991a,_0x4d6f19){var _0x5627d4=path['join'](config['root'],_0x3090('0x7f'));var _0x11f0d9={'where':{'id':_0x50f917[_0x3090('0x50')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x3090('0x51')][_0x3090('0x55')](_0x11f0d9)[_0x3090('0x20')](handleEntityNotFound(_0x4c991a,null))[_0x3090('0x20')](function(_0x7dd9bb){if(_0x7dd9bb){if(!_['isNil'](_0x7dd9bb[_0x3090('0x73')])){if(fs[_0x3090('0x7c')](path['join'](config[_0x3090('0x79')],_0x3090('0x80'),_0x7dd9bb[_0x3090('0x73')]))){_0x5627d4=path['join'](config[_0x3090('0x79')],_0x3090('0x80'),_0x7dd9bb[_0x3090('0x73')]);}}return _0x4c991a['download'](_0x5627d4);}})[_0x3090('0x2a')](handleError(_0x4c991a,null));};exports['getCustomerAvatar']=function(_0x5616be,_0x188710,_0x35811a){var _0x1e0211=path[_0x3090('0x78')](config['root'],_0x3090('0x81'));var _0x4c2f35={'where':{'id':_0x5616be[_0x3090('0x50')]['id']},'attributes':['id',_0x3090('0x75'),_0x3090('0x82')],'raw':!![]};return db[_0x3090('0x51')][_0x3090('0x55')](_0x4c2f35)[_0x3090('0x20')](handleEntityNotFound(_0x188710,null))['then'](function(_0x2824bc){if(_0x2824bc){if(!_['isNil'](_0x2824bc['customerAvatar'])){if(fs['existsSync'](path['join'](config[_0x3090('0x79')],_0x3090('0x80'),_0x2824bc[_0x3090('0x75')]))&&_0x2824bc[_0x3090('0x82')]){_0x1e0211=path['join'](config[_0x3090('0x79')],_0x3090('0x80'),_0x2824bc[_0x3090('0x75')]);}}return _0x188710[_0x3090('0x7e')](_0x1e0211);}})[_0x3090('0x2a')](handleError(_0x188710,null));};exports[_0x3090('0x83')]=function(_0x3ab9ce,_0x4e9de3,_0x1553f2){var _0x237b6f=path[_0x3090('0x78')](config['root'],_0x3090('0x84'));var _0x106442={'where':{'id':_0x3ab9ce[_0x3090('0x50')]['id']},'attributes':['id',_0x3090('0x85')],'raw':!![]};return db[_0x3090('0x51')][_0x3090('0x55')](_0x106442)[_0x3090('0x20')](handleEntityNotFound(_0x4e9de3,null))[_0x3090('0x20')](function(_0x1d5b23){if(_0x1d5b23){if(!_[_0x3090('0x7b')](_0x1d5b23[_0x3090('0x85')])){if(fs['existsSync'](path['join'](config[_0x3090('0x79')],_0x3090('0x80'),_0x1d5b23[_0x3090('0x85')]))){_0x237b6f=path[_0x3090('0x78')](config[_0x3090('0x79')],_0x3090('0x80'),_0x1d5b23[_0x3090('0x85')]);}}return _0x4e9de3['download'](_0x237b6f);}})[_0x3090('0x2a')](handleError(_0x4e9de3,null));};exports[_0x3090('0x86')]=function(_0xb31925,_0x4143e7,_0xe05d1d){var _0x3379a7=require(_0x3090('0x87'));var _0x4eee79=new _0x3379a7();var _0x11ca82=_0x4eee79['setUA'](_0xb31925[_0x3090('0x88')][_0x3090('0x89')])[_0x3090('0x8a')]();var _0x56c258={'body':_0xb31925[_0x3090('0x57')],'channel':_0x3090('0x8b')};var _0x5ba3d1=[];var _0x19f09a=[];var _0x27a6d6={};var _0x577614=![];return db[_0x3090('0x8c')]['describe']()[_0x3090('0x20')](function(_0x1995f5){if(!_0x1995f5){throw new db[(_0x3090('0x8d'))][(_0x3090('0x8e'))](_0x3090('0x8f'));}_0x5ba3d1=_[_0x3090('0x90')](_[_0x3090('0x52')](_0x1995f5),[_0x3090('0x91'),_0x3090('0x92')]);_0x19f09a=_[_0x3090('0x90')](_[_0x3090('0x52')](_0x1995f5),[_0x3090('0x91'),_0x3090('0x92'),_0x3090('0x93'),_0x3090('0x94')]);if(_0xb31925['body']['id']){delete _0xb31925[_0x3090('0x57')]['id'];}if(_[_0x3090('0x7b')](_0xb31925['body'][_0x3090('0x95')])){throw new db[(_0x3090('0x8d'))]['ValidationError'](_0x3090('0x96'));}if(_[_0x3090('0x7b')](_0xb31925['body'][_0x3090('0x57')])||_0xb31925[_0x3090('0x57')][_0x3090('0x57')]===''){throw new db[(_0x3090('0x8d'))]['ValidationError'](_0x3090('0x97'));}if(_[_0x3090('0x7b')](_0xb31925['body']['mapKey'])){throw new db[(_0x3090('0x8d'))][(_0x3090('0x8e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x19f09a);}if(!_['includes'](_0x19f09a,_0xb31925['body'][_0x3090('0x98')])){throw new db[(_0x3090('0x8d'))][(_0x3090('0x8e'))](_0x3090('0x99')+_0x19f09a);}_0x27a6d6[_0xb31925[_0x3090('0x57')]['mapKey']]=_0xb31925['body'][_0x3090('0x95')];})['then'](function(){return db[_0x3090('0x51')]['find']({'where':{'id':_0xb31925['params']['id']},'include':[{'model':db[_0x3090('0x9a')],'as':'List','include':[{'model':db[_0x3090('0x8c')],'as':_0x3090('0x9b'),'where':_0x27a6d6,'limit':0x1,'order':[['updatedAt',_0x3090('0x9c')]]}]},{'model':db[_0x3090('0x9d')],'as':_0x3090('0x9e')}]});})['then'](handleEntityNotFound(_0x4143e7,null))[_0x3090('0x20')](function(_0x5c1019){if(_0x5c1019&&_0x5c1019['List']){_0x56c258['account']=_0x5c1019;_0x56c258[_0x3090('0x9f')]=_0x5c1019[_0x3090('0x9e')];_0x56c258[_0x3090('0xa0')]=_0x5c1019[_0x3090('0xa1')];_0x56c258[_0x3090('0x9f')]=_[_0x3090('0xa2')](_0x56c258[_0x3090('0x9f')],['priority'],[_0x3090('0xa3')]);if(_0x56c258[_0x3090('0xa4')][_0x3090('0x9e')]){delete _0x56c258['account'][_0x3090('0x9e')];}if(_0x56c258['account'][_0x3090('0xa1')]&&_0x56c258[_0x3090('0xa4')][_0x3090('0xa1')]['Contacts']['length']){return _0x56c258[_0x3090('0xa4')][_0x3090('0xa1')][_0x3090('0x9b')][0x0];}var _0x27d420=_[_0x3090('0xa5')](_0xb31925['body'],{'firstName':_0xb31925[_0x3090('0x57')][_0x3090('0x95')],'ListId':_0x5c1019[_0x3090('0x94')]});_0x27d420[_0xb31925[_0x3090('0x57')][_0x3090('0x98')]]=_0xb31925[_0x3090('0x57')]['from'];return db[_0x3090('0x8c')][_0x3090('0x56')](_0x27d420,{'fields':_0x5ba3d1,'raw':!![]});}})[_0x3090('0x20')](handleEntityNotFound(_0x4143e7,null))[_0x3090('0x20')](function(_0x3c2de2){_0x56c258[_0x3090('0xa6')]=_0x3c2de2;var _0x56b247=_0xb31925[_0x3090('0x57')][_0x3090('0xa7')];if(_0xb31925['headers']['cf-connecting-ip']){_0x56b247=_0xb31925['headers'][_0x3090('0xa8')];}else if(_0xb31925['headers'][_0x3090('0xa9')]){_0x56b247=_[_0x3090('0xaa')](_0xb31925[_0x3090('0x88')][_0x3090('0xa9')][_0x3090('0xab')](','));}if(_0x3c2de2){var _0x11cc44={'ContactId':_0x3c2de2['id'],'ChatWebsiteId':_0xb31925[_0x3090('0x50')]['id'],'from':(_0x3c2de2[_0x3090('0xac')]||'')+'\x20'+(_0x3c2de2['lastName']||''),'customerIp':_0x56b247,'customerPort':_0xb31925[_0x3090('0x88')]['x-real-port']?_0xb31925[_0x3090('0x88')][_0x3090('0xad')]:null,'referer':_0xb31925['body'][_0x3090('0xae')],'browserName':_0x11ca82['browser'][_0x3090('0x37')]&&_0x11ca82[_0x3090('0xaf')]['version']?util[_0x3090('0xb0')](_0x3090('0xb1'),_0x11ca82[_0x3090('0xaf')][_0x3090('0x37')],_0x11ca82[_0x3090('0xaf')][_0x3090('0xb2')]):'unknown','browserVersion':_0x11ca82[_0x3090('0xaf')]['version']||_0x3090('0xb3'),'osName':util[_0x3090('0xb0')](_0x3090('0xb1'),_0x11ca82['os'][_0x3090('0x37')],_0x11ca82['os'][_0x3090('0xb2')]),'osVersion':_0x11ca82['os']['version'],'deviceModel':_0x11ca82['device'][_0x3090('0x41')]&&_0x11ca82['device'][_0x3090('0xb4')]?util[_0x3090('0xb0')](_0x3090('0xb5'),_0x11ca82['device'][_0x3090('0x41')],_0x11ca82[_0x3090('0xb6')]['vendor'],_0x11ca82[_0x3090('0xb6')][_0x3090('0x3c')]):null,'deviceVendor':_0x11ca82[_0x3090('0xb6')][_0x3090('0xb4')],'deviceType':_0x11ca82[_0x3090('0xb6')][_0x3090('0x3c')],'formData':JSON[_0x3090('0x25')](_0xb31925[_0x3090('0x57')])};var _0x3e935c={'ChatWebsiteId':_0xb31925[_0x3090('0x50')]['id'],'closed':![]};if(_0xb31925[_0x3090('0x57')][_0x3090('0xb7')]){_0x3e935c['threadId']=_0xb31925[_0x3090('0x57')]['threadId'];return db[_0x3090('0xb8')]['find']({'where':_0x3e935c})[_0x3090('0x20')](function(_0x411591){if(_0x411591){return[_0x411591,![]];}_0x11cc44['threadId']=_0xb31925['body'][_0x3090('0xb7')];_0x11cc44[_0x3090('0xb9')]=_0xb31925[_0x3090('0x57')][_0x3090('0xb9')];return db[_0x3090('0xb8')][_0x3090('0x56')](_0x11cc44)[_0x3090('0x20')](function(_0x3e9427){return[_0x3e9427,!![]];});});}_0x3e935c[_0x3090('0xba')]=_0x3c2de2['id'];if(_0xb31925[_0x3090('0x57')][_0x3090('0xbb')]&&_0xb31925['body'][_0x3090('0xbb')]['id']){_0x3e935c['id']=_0xb31925[_0x3090('0x57')][_0x3090('0xbb')]['id'];return db['ChatInteraction']['find']({'where':_0x3e935c})['then'](function(_0x3b2c28){if(_0x3b2c28){return[_0x3b2c28,![]];}return db[_0x3090('0xb8')][_0x3090('0x56')](_0x11cc44)['then'](function(_0x56b3c2){return[_0x56b3c2,!![]];});});}return db[_0x3090('0xb8')][_0x3090('0x56')](_0x11cc44)[_0x3090('0x20')](function(_0x33386c){return[_0x33386c,!![]];});}})[_0x3090('0xbc')](function(_0x5f0ea2,_0x34ba41){if(_0x5f0ea2){_0x577614=_0x34ba41;if(!_0x34ba41){var _0x2cd69c={'from':(_0x56c258['contact'][_0x3090('0xac')]||'')+'\x20'+(_0x56c258[_0x3090('0xa6')]['lastName']||'')};if(_0xb31925[_0x3090('0x57')][_0x3090('0xb7')]&&_0xb31925[_0x3090('0x57')]['messageId']&&_0xb31925[_0x3090('0x57')]['threadId']!=_0xb31925[_0x3090('0x57')]['messageId']){_0x2cd69c[_0x3090('0xb7')]=_0xb31925[_0x3090('0x57')][_0x3090('0xbd')];}return _0x5f0ea2[_0x3090('0x60')](_0x2cd69c);}else{return _0x5f0ea2;}}})['then'](function(_0x11fdd9){_0x56c258['interaction']=_0x11fdd9['get']({'plain':!![]});_0x56c258[_0x3090('0xbb')][_0x3090('0xbe')]=_0x577614;if(_0x56c258['interaction'][_0x3090('0xbe')]){if(_0x56c258[_0x3090('0xa4')][_0x3090('0xbf')]){_0x56c258['applications'][_0x3090('0xc0')]({'id':0x0,'priority':_0x56c258[_0x3090('0x9f')]['length']+0x1,'app':'close','appdata':_0x3090('0xc1'),'interval':_0x3090('0xc2')});}}return db[_0x3090('0xc3')]['create']({'body':_0xb31925[_0x3090('0x57')][_0x3090('0x57')],'ChatWebsiteId':_0xb31925['params']['id'],'ChatInteractionId':_0x11fdd9['id'],'direction':'in','ContactId':_0x56c258[_0x3090('0xa6')]['id'],'AttachmentId':_0xb31925[_0x3090('0x57')][_0x3090('0xc4')]});})['then'](function(_0x2c5c1a){_0x56c258[_0x3090('0x28')]=_0x2c5c1a;if(_0x56c258[_0x3090('0xbb')][_0x3090('0xc5')]){return db[_0x3090('0xc6')][_0x3090('0x55')]({'attributes':['id',_0x3090('0x37')],'where':{'id':_0x56c258[_0x3090('0xbb')][_0x3090('0xc5')]}})['then'](function(_0x30c940){if(_0x30c940){_0x56c258[_0x3090('0x9f')][_0x3090('0xc7')]({'id':0x0,'priority':0x0,'app':_0x3090('0xc8'),'appdata':_0x30c940[_0x3090('0x37')]+','+(_0x56c258[_0x3090('0xa4')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x56c258[_0x3090('0xc9')]=!![];}return respondWithRpcPromise(_0x3090('0xca'),'startRouting',_0x56c258);});}return respondWithRpcPromise(_0x3090('0xca'),_0x3090('0xcb'),_0x56c258);})[_0x3090('0x20')](function(_0x43e7d5){respondWithRpcPromise('EventManager',_0x3090('0xcc'),{'event':_0x3090('0x86'),'message':_0x43e7d5},client9002);return _0x43e7d5;})[_0x3090('0x20')](respondWithResult(_0x4143e7,null))[_0x3090('0x2a')](handleError(_0x4143e7,null));};exports[_0x3090('0xcd')]=function(_0x530d3a,_0x3ee684,_0x53ae2c){var _0x17e109,_0x4eb5c8,_0x2401ee;var _0x3d97b9=[];var _0x513b91=[];var _0x5947ec={};var _0x55f4c0=_0x530d3a[_0x3090('0xce')]||[];var _0x51be24=[];var _0x4b6460;return db[_0x3090('0x8c')][_0x3090('0x61')]()[_0x3090('0x20')](function(_0x35f45d){if(!_0x35f45d){throw new db[(_0x3090('0x8d'))][(_0x3090('0x8e'))](_0x3090('0x8f'));}_0x513b91=_[_0x3090('0x90')](_[_0x3090('0x52')](_0x35f45d),[_0x3090('0x91'),'updatedAt']);_0x3d97b9=_[_0x3090('0x90')](_[_0x3090('0x52')](_0x35f45d),['createdAt',_0x3090('0x92'),_0x3090('0x93'),_0x3090('0x94')]);if(_0x530d3a[_0x3090('0x57')]['id']){delete _0x530d3a[_0x3090('0x57')]['id'];}if(_[_0x3090('0x7b')](_0x530d3a[_0x3090('0x57')][_0x3090('0x95')])){throw _0x3ee684[_0x3090('0x32')](0x1f4)[_0x3090('0xcf')](new db[(_0x3090('0x8d'))][(_0x3090('0x8e'))](_0x3090('0x96')));}if(_['isNil'](_0x530d3a[_0x3090('0x57')][_0x3090('0x57')])||_0x530d3a[_0x3090('0x57')][_0x3090('0x57')]===''){throw _0x3ee684['status'](0x1f4)[_0x3090('0xcf')](new db[(_0x3090('0x8d'))]['ValidationError'](_0x3090('0x97')));}if(_[_0x3090('0x7b')](_0x530d3a[_0x3090('0x57')][_0x3090('0xd0')])){throw _0x3ee684[_0x3090('0x32')](0x1f4)[_0x3090('0xcf')](new db[(_0x3090('0x8d'))][(_0x3090('0x8e'))](_0x3090('0xd1')+_0x3d97b9));}if(!_[_0x3090('0xd2')](_0x3d97b9,_0x530d3a[_0x3090('0x57')][_0x3090('0xd0')])){throw _0x3ee684[_0x3090('0x32')](0x1f4)[_0x3090('0xcf')](new db['Sequelize'][(_0x3090('0x8e'))](_0x3090('0xd3')+_0x3d97b9));}_0x5947ec[_0x530d3a['body'][_0x3090('0xd0')]]=_0x530d3a[_0x3090('0x57')][_0x3090('0x95')];})[_0x3090('0x20')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x530d3a[_0x3090('0x50')]['id']},'include':[{'model':db[_0x3090('0x9a')],'as':_0x3090('0xa1')},{'model':db[_0x3090('0xd4')],'as':'MailAccount'}]});})['then'](handleEntityNotFound(_0x3ee684,null))[_0x3090('0x20')](function(_0x392af3){if(_0x392af3&&_0x392af3[_0x3090('0xa1')]){_0x4eb5c8=_0x392af3;var _0x4e942d=_['defaults'](_0x530d3a[_0x3090('0x57')],{'firstName':_0x530d3a[_0x3090('0x57')][_0x3090('0x95')],'phone':_0x530d3a['body']['from'],'ListId':_0x392af3['ListId']});_0x4e942d[_0x530d3a['body'][_0x3090('0xd0')]]=_0x530d3a[_0x3090('0x57')][_0x3090('0x95')];return db[_0x3090('0x8c')][_0x3090('0xd5')]({'where':_0x5947ec,'defaults':_0x4e942d});}})[_0x3090('0xbc')](function(_0x1c0a3f){if(_0x1c0a3f){_0x2401ee=_0x1c0a3f;var _0xf78b6d=fs[_0x3090('0xd6')](path['join'](config[_0x3090('0x79')],_0x3090('0xd7')),'utf8');var _0x2cf8c7=ejs[_0x3090('0xd8')](_0xf78b6d,{'body':_[_0x3090('0xd9')](_0x530d3a[_0x3090('0x57')][_0x3090('0x57')]),'bodyTitle':_0x4eb5c8['offlineMessageBody']});return db[_0x3090('0xda')][_0x3090('0x56')]({'body':_0x2cf8c7,'ContactId':_0x1c0a3f['id'],'ChatWebsiteId':_0x4eb5c8['id']});}})[_0x3090('0x20')](function(_0x12fdbf){_0x4b6460=_0x12fdbf;if(_0x55f4c0[_0x3090('0x44')]){var _0x199ee2=_0x55f4c0[_0x3090('0x3e')](function(_0x153cbb){return{'name':_0x153cbb[_0x3090('0xdb')],'basename':_0x153cbb[_0x3090('0x72')],'type':_0x153cbb['mimetype'],'ChatOfflineMessageId':_0x12fdbf['id']};});_0x51be24=_0x199ee2['map'](_0x5aa79d=>{var _0x257c1f={'filename':_0x5aa79d[_0x3090('0x37')],'path':path[_0x3090('0x78')](config[_0x3090('0x79')],'server','files','attachments','offline-chat',_0x5aa79d[_0x3090('0xdc')])};return _0x257c1f;});if(!_0x4eb5c8['openNewInteraction']){return db['sequelize'][_0x3090('0xdd')](function(_0x5288f0){return db[_0x3090('0xde')][_0x3090('0xdf')](_0x199ee2,{'transaction':_0x5288f0});});}}})[_0x3090('0x20')](function(){if(_0x4b6460){_0x17e109=_0x4b6460;return db[_0x3090('0xd4')][_0x3090('0x65')]({'where':{'active':!![]},'include':[{'model':db[_0x3090('0xe0')],'as':_0x3090('0xe1'),'raw':!![]}]});}})[_0x3090('0x20')](function(_0x4bb172){if(_0x4bb172&&_0x4bb172[_0x3090('0xe1')]&&_0x4eb5c8[_0x3090('0xe2')]&&_0x4eb5c8[_0x3090('0xe3')]){var _0x32efac={'tls':{'rejectUnauthorized':![]}};if(_0x4bb172['Smtp'][_0x3090('0xe4')]){_0x32efac[_0x3090('0xe4')]=_0x4bb172['Smtp'][_0x3090('0xe4')];}else{_0x32efac['host']=_0x4bb172[_0x3090('0xe1')]['host'];_0x32efac[_0x3090('0xe5')]=_0x4bb172[_0x3090('0xe1')][_0x3090('0xe5')];_0x32efac['secure']=_0x4bb172[_0x3090('0xe1')][_0x3090('0xe6')];}if(_0x4bb172[_0x3090('0xe1')][_0x3090('0xe7')]){_0x32efac[_0x3090('0xe8')]={'user':_0x4bb172[_0x3090('0xe1')]['user'],'pass':_0x4bb172['Smtp'][_0x3090('0xe9')]};}return respondWithRpcPromise(_0x3090('0xea'),'sendMail',{'account':_0x32efac,'message':{'from':util[_0x3090('0xb0')](_0x3090('0xeb'),_0x4bb172[_0x3090('0x37')],_0x4bb172[_0x3090('0xec')]||_0x4bb172[_0x3090('0xe1')][_0x3090('0x58')]),'to':_0x4eb5c8[_0x3090('0xe3')],'subject':_0x4eb5c8[_0x3090('0xed')],'html':_0x17e109[_0x3090('0x57')],'attachments':_0x51be24}},client9003)[_0x3090('0x20')](function(){return _0x17e109;})[_0x3090('0x2a')](function(_0x4c3aea){console[_0x3090('0x26')](_0x4c3aea);});}})[_0x3090('0x20')](function(){if(_0x4eb5c8&&_0x4eb5c8['openNewInteraction']&&_0x4eb5c8[_0x3090('0xee')]){var _0x5ab8b6=[];if(_0x55f4c0[_0x3090('0x44')]){_0x5ab8b6=_0x55f4c0[_0x3090('0x3e')](function(_0x1821b3){return{'name':_0x1821b3[_0x3090('0xdb')],'basename':_0x1821b3[_0x3090('0x72')],'type':_0x1821b3[_0x3090('0xef')],'ChatOfflineMessageId':_0x4b6460['id']};});}var _0x2a61c6;if(!_[_0x3090('0x7b')](_0x4eb5c8[_0x3090('0xf0')])){var _0x3e0af1=_[_0x3090('0x3e')](_0x530d3a[_0x3090('0x57')],function(_0x276071){return _0x276071;});var _0x291591=_[_0x3090('0xf1')](_0x3e0af1)[0x0];var _0x12bc89=_[_0x3090('0xf2')](_0x291591,function(_0x516084){return _0x516084;});_0x2a61c6=_0x12bc89[0x1][_0x4eb5c8[_0x3090('0xf0')]];}var _0x33bfd9={'from':_0x2401ee[_0x3090('0xec')],'firstName':_0x2401ee[_0x3090('0xac')],'lastName':_0x2401ee[_0x3090('0xf3')],'mapKey':_0x3090('0xec'),'message':{'from':_0x2401ee['email'],'to':_0x4eb5c8[_0x3090('0xd4')][_0x3090('0xec')],'cc':'','subject':_['isNil'](_0x2a61c6)?_0x4eb5c8[_0x3090('0xed')]:_0x2a61c6,'messageId':'','sentAt':new Date(),'attach':_0x5ab8b6[_0x3090('0x44')],'attachments':_0x5ab8b6,'originChannel':'Chat','ChatWebsiteId':_0x4eb5c8['id'],'ChatOfflineMessageId':_0x17e109['id'],'originTo':_0x4eb5c8[_0x3090('0xd4')][_0x3090('0xec')]},'body':_0x17e109[_0x3090('0x57')]};var _0x137354={'account':{'id':_0x4eb5c8[_0x3090('0xee')]},'body':_0x33bfd9,'log':_0x3090('0xf4')};return respondWithRpcPromise(_0x3090('0xf4'),_0x3090('0xf5'),_0x137354,client9001)[_0x3090('0x20')](function(){return _0x17e109;})[_0x3090('0x2a')](function(_0x5d33bd){console[_0x3090('0x26')](_0x5d33bd);});}return;})[_0x3090('0x20')](function(){if(_0x17e109){return _0x17e109;}})['then'](respondWithResult(_0x3ee684,null))[_0x3090('0x2a')](function(_0x56cd05){console[_0x3090('0x26')]('catch',_0x56cd05);for(var _0x5cefb6 of _0x55f4c0){var _0xa0416=path[_0x3090('0x78')](config[_0x3090('0x79')],_0x3090('0xf6'),'files',_0x3090('0xf7'),'offline-chat',_0x5cefb6['filename']);fs_extra[_0x3090('0xf8')](_0xa0416)['catch'](function(_0xec72fe){console[_0x3090('0x26')](_0x3090('0xf9'),_0xa0416,_0xec72fe);});}});};exports['addInteraction']=function(_0x53a0c8,_0x31f28b,_0x563c0e){return db['ChatInteraction'][_0x3090('0x55')]({'where':{'id':_0x53a0c8[_0x3090('0x50')]['id']}})['then'](handleEntityNotFound(_0x31f28b,null))[_0x3090('0x20')](function(_0x2a9548){if(_0x2a9548){return _0x2a9548['addInteraction'](_0x53a0c8[_0x3090('0x57')][_0x3090('0x6b')],_[_0x3090('0xfa')](_0x53a0c8[_0x3090('0x57')],['ids','id'])||{});}})[_0x3090('0x20')](respondWithResult(_0x31f28b,null))[_0x3090('0x2a')](handleError(_0x31f28b,null));};exports[_0x3090('0xfb')]=function(_0xdfd0b0,_0x31d2a3,_0x199491){var _0x5c3375={'raw':![],'where':{}};var _0x2765aa={};var _0x3adfc1={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3090('0x65')]({'where':{'id':_0xdfd0b0[_0x3090('0x50')]['id']}})['then'](handleEntityNotFound(_0x31d2a3,null))[_0x3090('0x20')](function(_0x4cbb37){if(_0x4cbb37){_0x2765aa[_0x3090('0x41')]=_[_0x3090('0x52')](db[_0x3090('0xb8')][_0x3090('0x3a')]);_0x2765aa[_0x3090('0x3f')]=_['keys'](_0xdfd0b0[_0x3090('0x3f')]);_0x2765aa[_0x3090('0x40')]=_[_0x3090('0x53')](_0x2765aa[_0x3090('0x41')],_0x2765aa['query']);_0x5c3375['attributes']=_[_0x3090('0x53')](_0x2765aa[_0x3090('0x41')],qs[_0x3090('0x43')](_0xdfd0b0[_0x3090('0x3f')][_0x3090('0x43')]));_0x5c3375['attributes']=_0x5c3375[_0x3090('0x42')][_0x3090('0x44')]?_0x5c3375['attributes']:_0x2765aa[_0x3090('0x41')];if(!_0xdfd0b0[_0x3090('0x3f')][_0x3090('0x66')](_0x3090('0x45'))){_0x5c3375[_0x3090('0x31')]=qs[_0x3090('0x31')](_0xdfd0b0[_0x3090('0x3f')][_0x3090('0x31')]);_0x5c3375[_0x3090('0x2e')]=qs['offset'](_0xdfd0b0[_0x3090('0x3f')][_0x3090('0x2e')]);}_0x5c3375[_0x3090('0x46')]=qs[_0x3090('0x47')](_0xdfd0b0[_0x3090('0x3f')][_0x3090('0x47')]);_0x5c3375[_0x3090('0x48')]=qs['filters'](_[_0x3090('0x49')](_0xdfd0b0[_0x3090('0x3f')],_0x2765aa[_0x3090('0x40')]));_0x5c3375[_0x3090('0x48')]['ChatWebsiteId']=_0x4cbb37['id'];if(_0xdfd0b0['query'][_0x3090('0x4a')]){_0x5c3375[_0x3090('0x48')]=_[_0x3090('0x4b')](_0x5c3375[_0x3090('0x48')],{'$or':_['map'](_0x5c3375['attributes'],function(_0x511694){var _0x23a2d2={};_0x23a2d2[_0x511694]={'$like':'%'+_0xdfd0b0[_0x3090('0x3f')][_0x3090('0x4a')]+'%'};return _0x23a2d2;})});}_0x5c3375=_[_0x3090('0x4b')]({},_0x5c3375,_0xdfd0b0[_0x3090('0x54')]);return db[_0x3090('0xb8')]['count']({'where':_0x5c3375['where']})[_0x3090('0x20')](function(_0x575af4){_0x3adfc1[_0x3090('0x30')]=_0x575af4;if(_0xdfd0b0[_0x3090('0x3f')][_0x3090('0x4d')]){_0x5c3375[_0x3090('0x4e')]=[{'model':db[_0x3090('0x8c')],'as':_0x3090('0xfc'),'required':![]},{'model':db[_0x3090('0xc6')],'as':_0x3090('0xfd'),'attributes':['name',_0x3090('0xfe'),_0x3090('0xff')],'required':![]},{'model':db[_0x3090('0x100')],'as':_0x3090('0x101'),'attributes':['id','name',_0x3090('0x102')],'where':_0xdfd0b0['query']['tag']?{'id':_0xdfd0b0[_0x3090('0x3f')][_0x3090('0x103')]}:undefined,'required':_0xdfd0b0[_0x3090('0x3f')][_0x3090('0x103')]?!![]:![]}];}return db[_0x3090('0xb8')]['findAll'](_0x5c3375);})['then'](function(_0x12d9d8){_0x3adfc1[_0x3090('0x69')]=_0x12d9d8;return _0x3adfc1;});}})[_0x3090('0x20')](respondWithFilteredResult(_0x31d2a3,_0x5c3375))[_0x3090('0x2a')](handleError(_0x31d2a3,null));};function iftimePromise(_0xa8a642,_0x16d0f7){return respondWithRpcPromise(_0x3090('0x104'),_0x3090('0x105'),{'command':_0x16d0f7[_0x3090('0x106')]?util[_0x3090('0xb0')](_0x3090('0x107'),_0xa8a642[_0x3090('0x108')],_0x16d0f7[_0x3090('0x106')]):util[_0x3090('0xb0')](_0x3090('0x109'),_0xa8a642[_0x3090('0x108')])},client9002)[_0x3090('0x20')](function(_0x37bd2a){var _0x166dcf=_0x37bd2a&&_0x37bd2a['indexOf']('true')>=0x0?!![]:![];logger[_0x3090('0x21')](_0x3090('0x10a'),_0x16d0f7['id'],_0xa8a642['id'],_0xa8a642[_0x3090('0x108')],_0x166dcf?_0x3090('0x10b'):_0x3090('0x10c'),_0x16d0f7[_0x3090('0x106')]?_0x16d0f7['timezone']:_0x3090('0x10d'));return _0x166dcf;})['catch'](function(_0x1b2a05){logger[_0x3090('0x26')](_0x3090('0x10a'),_0x16d0f7['id'],_0xa8a642['id'],_0xa8a642[_0x3090('0x108')],util[_0x3090('0x10e')](_0x1b2a05,{'showHidden':![],'depth':null}),_0x16d0f7[_0x3090('0x106')]?_0x16d0f7[_0x3090('0x106')]:_0x3090('0x10d'));return![];});}exports[_0x3090('0x105')]=function(_0x49a457,_0x214ec5,_0x22783c){var _0x97405c=0x0;var _0x5edf5e=0x0;var _0x352d02=![];var _0x2bda96;var _0x30bde4;return db[_0x3090('0x51')]['find']({'where':{'id':_0x49a457[_0x3090('0x50')]['id']},'include':[{'model':db[_0x3090('0x10f')],'as':'Interval','include':[{'model':db[_0x3090('0x10f')],'as':_0x3090('0x110'),'attributes':['id',_0x3090('0x108')],'raw':!![]}]}]})[_0x3090('0x20')](handleEntityNotFound(_0x214ec5,null))[_0x3090('0x20')](function(_0x1e0eeb){if(_0x1e0eeb){_0x2bda96=_0x1e0eeb;return _0x1e0eeb[_0x3090('0x111')]({'raw':!![]});}})['then'](function(_0x2c3a34){if(_0x2bda96){if(_0x2c3a34){_0x30bde4=_0x2c3a34;}}return require('../../config/license/util')[_0x3090('0x7a')]();})[_0x3090('0x20')](function(_0x4a1061){if(_0x4a1061){_0x5edf5e=_0x4a1061[_0x3090('0x112')];_0x352d02=_0x4a1061[_0x3090('0x113')];}})[_0x3090('0x20')](function(){return db['ChatInteraction'][_0x3090('0x30')]({'where':{'closed':![]}});})[_0x3090('0x20')](function(_0x4e50cd){_0x97405c=_0x4e50cd;if(_0x5edf5e&&_0x4e50cd>_0x5edf5e){return db[_0x3090('0x114')]['findOne']({'where':{'id':0x1}})[_0x3090('0x20')](function(_0x492a05){if(_0x492a05){_0x492a05[_0x3090('0x115')](_0x3090('0x116'));}});}})['then'](function(){if(_0x2bda96[_0x3090('0x10f')]&&_0x2bda96['Interval'][_0x3090('0x110')]){var _0x5003c1=[];for(var _0x3d50b4=0x0;_0x3d50b4<_0x2bda96[_0x3090('0x10f')]['Intervals'][_0x3090('0x44')];_0x3d50b4++){var _0x192804=_0x2bda96[_0x3090('0x10f')][_0x3090('0x110')][_0x3d50b4][_0x3090('0x35')]({'plain':!![]});_0x5003c1['push'](iftimePromise(_0x192804,_0x2bda96));}return BPromise[_0x3090('0x117')](_0x5003c1)[_0x3090('0x20')](function(_0x11f476){return _[_0x3090('0x118')](_0x11f476);});}else{return!![];}})['then'](function(_0x3e9e24){var _0xf3e69e=fs[_0x3090('0xd6')](path[_0x3090('0x78')](config[_0x3090('0x79')],_0x3090('0x119')),_0x3090('0x11a'));var _0x5beb96={'remote':_0x2bda96[_0x3090('0x11b')],'query':querystring[_0x3090('0x25')](_[_0x3090('0x4b')](_0x2bda96['get']({'plain':!![]}),{'customerIp':_0x49a457[_0x3090('0x88')]['x-forwarded-for']||_0x49a457[_0x3090('0x88')][_0x3090('0x11c')]||_0x49a457[_0x3090('0x11d')]['remoteAddress']||_0x49a457['ip'],'referer':_0x49a457[_0x3090('0x88')][_0x3090('0xae')],'openedInteractions':_0x97405c,'maxInteractions':_0x5edf5e,'virtual':_0x352d02[_0x3090('0x112')],'online':_0x3e9e24,'custom':_0x352d02}))[_0x3090('0x11e')](/'/g,'\x5c\x27')};_0x214ec5[_0x3090('0xcf')](ejs[_0x3090('0xd8')](Mustache['render'](_0xf3e69e,_0x5beb96),{'proactiveActions':_0x30bde4,'alignment':_0x2bda96['alignment'],'verticalAlignment':_0x2bda96[_0x3090('0x11f')],'div_color':_0x2bda96['color'],'text_color':_0x2bda96[_0x3090('0x120')],'button_color':_0x2bda96[_0x3090('0x121')],'background_color':_0x2bda96[_0x3090('0x122')]}));})[_0x3090('0x2a')](handleError(_0x214ec5,null));};exports[_0x3090('0x123')]=function(_0x32b855,_0x2f6a86,_0x5d266f){return db[_0x3090('0x51')][_0x3090('0x65')]({'where':{'id':_0x32b855[_0x3090('0x50')]['id']}})['then'](handleEntityNotFound(_0x2f6a86,null))[_0x3090('0x20')](function(_0x5d0c8b){if(_0x5d0c8b){return db[_0x3090('0x124')][_0x3090('0xdd')](function(_0x3af420){return db[_0x3090('0x9d')][_0x3090('0x34')]({'where':{'ChatWebsiteId':_0x32b855[_0x3090('0x50')]['id']},'transaction':_0x3af420})[_0x3090('0x20')](function(_0x15c72e){var _0x325807=_[_0x3090('0x3e')](_0x32b855[_0x3090('0x57')],function(_0x5c2ece){_0x5c2ece['ChatWebsiteId']=_0x32b855[_0x3090('0x50')]['id'];return _0x5c2ece;});return db['ChatApplication'][_0x3090('0xdf')](_0x325807,{'transaction':_0x3af420});});})[_0x3090('0x20')](function(){return db[_0x3090('0x9d')][_0x3090('0x125')]({'where':{'ChatWebsiteId':_0x32b855[_0x3090('0x50')]['id']},'order':_0x3090('0x126')});});}})['then'](respondWithResult(_0x2f6a86,null))[_0x3090('0x2a')](handleError(_0x2f6a86,null));};exports[_0x3090('0x127')]=function(_0x23f60c,_0x1e6d2e,_0x1852ff){var _0x33b9f8={};var _0x35cb35={};var _0x571cea;var _0x3a827d;return db[_0x3090('0x51')]['findOne']({'where':{'id':_0x23f60c[_0x3090('0x50')]['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x1e6d2e,null))['then'](function(_0xb71d1b){if(_0xb71d1b){_0x571cea=_0xb71d1b;_0x35cb35['model']=_[_0x3090('0x52')](db[_0x3090('0x9d')][_0x3090('0x3a')]);_0x35cb35['query']=_[_0x3090('0x52')](_0x23f60c['query']);_0x35cb35[_0x3090('0x40')]=_[_0x3090('0x53')](_0x35cb35[_0x3090('0x41')],_0x35cb35[_0x3090('0x3f')]);_0x33b9f8['attributes']=_[_0x3090('0x53')](_0x35cb35['model'],qs[_0x3090('0x43')](_0x23f60c[_0x3090('0x3f')]['fields']));_0x33b9f8[_0x3090('0x42')]=_0x33b9f8['attributes'][_0x3090('0x44')]?_0x33b9f8['attributes']:_0x35cb35['model'];_0x33b9f8[_0x3090('0x46')]=qs[_0x3090('0x47')](_0x23f60c['query'][_0x3090('0x47')]);_0x33b9f8[_0x3090('0x48')]=qs[_0x3090('0x40')](_[_0x3090('0x49')](_0x23f60c['query'],_0x35cb35[_0x3090('0x40')]));if(_0x23f60c['query']['filter']){_0x33b9f8[_0x3090('0x48')]=_[_0x3090('0x4b')](_0x33b9f8[_0x3090('0x48')],{'$or':_['map'](_0x33b9f8[_0x3090('0x42')],function(_0x243dbf){var _0x46467b={};_0x46467b[_0x243dbf]={'$like':'%'+_0x23f60c[_0x3090('0x3f')][_0x3090('0x4a')]+'%'};return _0x46467b;})});}_0x33b9f8=_[_0x3090('0x4b')]({},_0x33b9f8,_0x23f60c[_0x3090('0x54')]);return _0x571cea[_0x3090('0x127')](_0x33b9f8);}})[_0x3090('0x20')](function(_0x12e2ba){if(_0x12e2ba){_0x3a827d=_0x12e2ba[_0x3090('0x44')];if(!_0x23f60c[_0x3090('0x3f')][_0x3090('0x66')]('nolimit')){_0x33b9f8['limit']=qs[_0x3090('0x31')](_0x23f60c[_0x3090('0x3f')][_0x3090('0x31')]);_0x33b9f8[_0x3090('0x2e')]=qs[_0x3090('0x2e')](_0x23f60c[_0x3090('0x3f')][_0x3090('0x2e')]);}return _0x571cea[_0x3090('0x127')](_0x33b9f8);}})['then'](function(_0x5eb3d8){if(_0x5eb3d8){return _0x5eb3d8?{'count':_0x3a827d,'rows':_0x5eb3d8}:null;}})[_0x3090('0x20')](respondWithResult(_0x1e6d2e,null))[_0x3090('0x2a')](handleError(_0x1e6d2e,null));};exports[_0x3090('0x128')]=function(_0x1c3a1f,_0x5a1663,_0x4fb937){return db[_0x3090('0x129')][_0x3090('0x55')]({'where':{'id':_0x1c3a1f[_0x3090('0x50')]['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x5a1663,null))['then'](function(_0x16b458){if(_0x16b458){return _0x16b458['addProactiveActions'](_0x1c3a1f[_0x3090('0x57')][_0x3090('0x6b')],_[_0x3090('0xfa')](_0x1c3a1f[_0x3090('0x57')],['ids','id'])||{});}})[_0x3090('0x20')](respondWithResult(_0x5a1663,null))[_0x3090('0x2a')](handleError(_0x5a1663,null));};exports['getProactiveActions']=function(_0x241bc5,_0x20ddc3,_0x11a129){var _0x2b14b0={};var _0x4e2a52={};var _0x332301;var _0x17c3ce;return db[_0x3090('0x51')][_0x3090('0x65')]({'where':{'id':_0x241bc5[_0x3090('0x50')]['id']}})['then'](handleEntityNotFound(_0x20ddc3,null))[_0x3090('0x20')](function(_0x400fd5){if(_0x400fd5){_0x332301=_0x400fd5;_0x4e2a52[_0x3090('0x41')]=_['keys'](db[_0x3090('0x12a')]['rawAttributes']);_0x4e2a52[_0x3090('0x3f')]=_[_0x3090('0x52')](_0x241bc5[_0x3090('0x3f')]);_0x4e2a52[_0x3090('0x40')]=_[_0x3090('0x53')](_0x4e2a52[_0x3090('0x41')],_0x4e2a52[_0x3090('0x3f')]);_0x2b14b0[_0x3090('0x42')]=_[_0x3090('0x53')](_0x4e2a52[_0x3090('0x41')],qs[_0x3090('0x43')](_0x241bc5[_0x3090('0x3f')]['fields']));_0x2b14b0[_0x3090('0x42')]=_0x2b14b0[_0x3090('0x42')]['length']?_0x2b14b0[_0x3090('0x42')]:_0x4e2a52[_0x3090('0x41')];_0x2b14b0['order']=qs[_0x3090('0x47')](_0x241bc5[_0x3090('0x3f')][_0x3090('0x47')]);_0x2b14b0['where']=qs['filters'](_['pick'](_0x241bc5[_0x3090('0x3f')],_0x4e2a52['filters']));if(_0x241bc5[_0x3090('0x3f')][_0x3090('0x4a')]){_0x2b14b0[_0x3090('0x48')]=_[_0x3090('0x4b')](_0x2b14b0[_0x3090('0x48')],{'$or':_['map'](_0x2b14b0['attributes'],function(_0x26b927){var _0x27a3a2={};_0x27a3a2[_0x26b927]={'$like':'%'+_0x241bc5[_0x3090('0x3f')][_0x3090('0x4a')]+'%'};return _0x27a3a2;})});}_0x2b14b0=_['merge']({},_0x2b14b0,_0x241bc5['options']);return _0x332301[_0x3090('0x111')](_0x2b14b0);}})[_0x3090('0x20')](function(_0x5647c1){if(_0x5647c1){_0x17c3ce=_0x5647c1[_0x3090('0x44')];if(!_0x241bc5[_0x3090('0x3f')][_0x3090('0x66')]('nolimit')){_0x2b14b0[_0x3090('0x31')]=qs[_0x3090('0x31')](_0x241bc5[_0x3090('0x3f')][_0x3090('0x31')]);_0x2b14b0[_0x3090('0x2e')]=qs[_0x3090('0x2e')](_0x241bc5[_0x3090('0x3f')]['offset']);}return _0x332301[_0x3090('0x111')](_0x2b14b0);}})[_0x3090('0x20')](function(_0xb936a7){if(_0xb936a7){return _0xb936a7?{'count':_0x17c3ce,'rows':_0xb936a7}:null;}})[_0x3090('0x20')](respondWithResult(_0x20ddc3,null))[_0x3090('0x2a')](handleError(_0x20ddc3,null));};exports[_0x3090('0x12b')]=function(_0x1f970e,_0x2727e1,_0x2a11cc){var _0x1e79ac=_0x1f970e[_0x3090('0x3f')]['online']===_0x3090('0x12c')?_0x3090('0x12d'):'onlineForm';return db[_0x3090('0x51')]['find']({'attributes':['id',_0x1e79ac],'where':{'id':_0x1f970e['params']['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x2727e1,null))['then'](function(_0x2a833a){if(_0x2a833a){var _0x5036c2=_0x2a833a[_0x1e79ac];var _0x1d91b4=_0x5036c2&&_0x5036c2[_0x3090('0x12e')]?_0x5036c2[_0x3090('0x12e')]:[];_0x2727e1[_0x3090('0xcf')]({'fromKey':_[_0x3090('0x7b')](_0x5036c2[_0x3090('0x12f')])?undefined:_0x5036c2['fromKey'],'count':_0x1d91b4[_0x3090('0x44')],'rows':_0x1d91b4});}})['catch'](handleError(_0x2727e1,null));};exports[_0x3090('0x130')]=function(_0x4c9531,_0x5281f5,_0x17e202){var _0x4dea3f={'raw':![],'where':{}};var _0x231e17={};var _0x1f71a6={'count':0x0,'rows':[]};return db[_0x3090('0x51')][_0x3090('0x65')]({'where':{'id':_0x4c9531[_0x3090('0x50')]['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x5281f5,null))['then'](function(_0x1849c8){if(_0x1849c8){_0x231e17[_0x3090('0x41')]=_[_0x3090('0x52')](db['ChatOfflineMessage']['rawAttributes']);_0x231e17['query']=_[_0x3090('0x52')](_0x4c9531['query']);_0x231e17['filters']=_[_0x3090('0x53')](_0x231e17['model'],_0x231e17[_0x3090('0x3f')]);_0x4dea3f[_0x3090('0x42')]=_[_0x3090('0x53')](_0x231e17[_0x3090('0x41')],qs[_0x3090('0x43')](_0x4c9531[_0x3090('0x3f')][_0x3090('0x43')]));_0x4dea3f['attributes']=_0x4dea3f['attributes'][_0x3090('0x44')]?_0x4dea3f[_0x3090('0x42')]:_0x231e17[_0x3090('0x41')];if(!_0x4c9531[_0x3090('0x3f')]['hasOwnProperty'](_0x3090('0x45'))){_0x4dea3f[_0x3090('0x31')]=qs['limit'](_0x4c9531[_0x3090('0x3f')][_0x3090('0x31')]);_0x4dea3f['offset']=qs['offset'](_0x4c9531[_0x3090('0x3f')][_0x3090('0x2e')]);}_0x4dea3f[_0x3090('0x46')]=qs[_0x3090('0x47')](_0x4c9531[_0x3090('0x3f')][_0x3090('0x47')]);_0x4dea3f[_0x3090('0x48')]=qs[_0x3090('0x40')](_[_0x3090('0x49')](_0x4c9531['query'],_0x231e17['filters']));_0x4dea3f[_0x3090('0x48')][_0x3090('0x63')]=_0x1849c8['id'];if(_0x4c9531[_0x3090('0x3f')][_0x3090('0x4a')]){_0x4dea3f[_0x3090('0x48')]=_[_0x3090('0x4b')](_0x4dea3f[_0x3090('0x48')],{'$or':_['map'](_0x4dea3f['attributes'],function(_0x37dc40){var _0x20638a={};_0x20638a[_0x37dc40]={'$like':'%'+_0x4c9531[_0x3090('0x3f')][_0x3090('0x4a')]+'%'};return _0x20638a;})});}_0x4dea3f=_[_0x3090('0x4b')]({},_0x4dea3f,_0x4c9531[_0x3090('0x54')]);return db[_0x3090('0xda')][_0x3090('0x30')]({'where':_0x4dea3f[_0x3090('0x48')]})['then'](function(_0x42a2f1){_0x1f71a6['count']=_0x42a2f1;if(_0x4c9531[_0x3090('0x3f')][_0x3090('0x4d')]){_0x4dea3f[_0x3090('0x4e')]=[{'all':!![]}];}else{_0x4dea3f[_0x3090('0x4e')]=[{'model':db['CmContact'],'as':_0x3090('0xfc'),'required':![]},{'model':db[_0x3090('0xde')],'as':_0x3090('0x131'),'required':![]}];}return db[_0x3090('0xda')][_0x3090('0x68')](_0x4dea3f);})['then'](function(_0x450453){_0x1f71a6['rows']=_0x450453;return _0x1f71a6;});}})[_0x3090('0x20')](respondWithFilteredResult(_0x5281f5,_0x4dea3f))['catch'](handleError(_0x5281f5,null));};exports[_0x3090('0x132')]=function(_0x12e210,_0x155f20,_0x5c2743){return db[_0x3090('0x51')][_0x3090('0x55')]({'where':{'id':_0x12e210['params']['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x155f20,null))[_0x3090('0x20')](function(_0x135206){if(_0x135206){return _0x135206['addAgents'](_0x12e210[_0x3090('0x57')][_0x3090('0x6b')],_[_0x3090('0xfa')](_0x12e210[_0x3090('0x57')],['ids','id'])||{})['spread'](function(_0x5c5c0b){for(var _0xb2faa2=0x0;_0xb2faa2<_0x12e210['body']['ids'][_0x3090('0x44')];_0xb2faa2+=0x1){socket[_0x3090('0x133')](_0x3090('0x134'),{'UserId':Number(_0x12e210[_0x3090('0x57')][_0x3090('0x6b')][_0xb2faa2]),'ChatWebsiteId':Number(_0x12e210[_0x3090('0x50')]['id'])});}return _0x5c5c0b;});}})[_0x3090('0x20')](respondWithResult(_0x155f20,null))['catch'](handleError(_0x155f20,null));};exports[_0x3090('0x135')]=function(_0x1f83cc,_0x2f26ad,_0x4461b8){return db[_0x3090('0x51')][_0x3090('0x55')]({'where':{'id':_0x1f83cc[_0x3090('0x50')]['id']}})[_0x3090('0x20')](handleEntityNotFound(_0x2f26ad,null))[_0x3090('0x20')](function(_0x362264){if(_0x362264){return _0x362264[_0x3090('0x135')](_0x1f83cc[_0x3090('0x3f')]['ids'])[_0x3090('0x20')](function(){if(_[_0x3090('0x136')](_0x1f83cc[_0x3090('0x3f')]['ids'])){for(var _0x79f534=0x0;_0x79f534<_0x1f83cc[_0x3090('0x3f')]['ids'][_0x3090('0x44')];_0x79f534+=0x1){socket[_0x3090('0x133')](_0x3090('0x137'),{'UserId':Number(_0x1f83cc['query'][_0x3090('0x6b')][_0x79f534]),'ChatWebsiteId':Number(_0x1f83cc[_0x3090('0x50')]['id'])});}}else{socket[_0x3090('0x133')](_0x3090('0x137'),{'UserId':Number(_0x1f83cc[_0x3090('0x3f')][_0x3090('0x6b')]),'ChatWebsiteId':Number(_0x1f83cc[_0x3090('0x50')]['id'])});}});}})[_0x3090('0x20')](respondWithStatusCode(_0x2f26ad,null))['catch'](handleError(_0x2f26ad,null));};exports[_0x3090('0x138')]=function(_0x1a5b96,_0x4fc89b,_0x113d6f){var _0x18eb09={};var _0x3c6111={};var _0x41966c;var _0x1b4ee4;return db[_0x3090('0x51')]['findOne']({'where':{'id':_0x1a5b96[_0x3090('0x50')]['id']}})['then'](handleEntityNotFound(_0x4fc89b,null))[_0x3090('0x20')](function(_0x2666b6){if(_0x2666b6){_0x41966c=_0x2666b6;_0x3c6111[_0x3090('0x41')]=_['keys'](db['User']['rawAttributes']);_0x3c6111[_0x3090('0x3f')]=_[_0x3090('0x52')](_0x1a5b96[_0x3090('0x3f')]);_0x3c6111[_0x3090('0x40')]=_[_0x3090('0x53')](_0x3c6111[_0x3090('0x41')],_0x3c6111[_0x3090('0x3f')]);_0x18eb09[_0x3090('0x42')]=_[_0x3090('0x53')](_0x3c6111['model'],qs[_0x3090('0x43')](_0x1a5b96[_0x3090('0x3f')][_0x3090('0x43')]));_0x18eb09[_0x3090('0x42')]=_0x18eb09['attributes']['length']?_0x18eb09[_0x3090('0x42')]:_0x3c6111['model'];_0x18eb09[_0x3090('0x46')]=qs['sort'](_0x1a5b96[_0x3090('0x3f')]['sort']);_0x18eb09[_0x3090('0x48')]=qs['filters'](_[_0x3090('0x49')](_0x1a5b96['query'],_0x3c6111['filters']));if(_0x1a5b96['query'][_0x3090('0x4a')]){_0x18eb09[_0x3090('0x48')]=_[_0x3090('0x4b')](_0x18eb09[_0x3090('0x48')],{'$or':_['map'](_0x18eb09[_0x3090('0x42')],function(_0x224d20){var _0x8b799e={};_0x8b799e[_0x224d20]={'$like':'%'+_0x1a5b96[_0x3090('0x3f')][_0x3090('0x4a')]+'%'};return _0x8b799e;})});}_0x18eb09=_['merge']({},_0x18eb09,_0x1a5b96['options']);return _0x41966c[_0x3090('0x138')](_0x18eb09);}})[_0x3090('0x20')](function(_0x48fda7){if(_0x48fda7){_0x1b4ee4=_0x48fda7[_0x3090('0x44')];if(!_0x1a5b96[_0x3090('0x3f')][_0x3090('0x66')](_0x3090('0x45'))){_0x18eb09[_0x3090('0x31')]=qs[_0x3090('0x31')](_0x1a5b96[_0x3090('0x3f')][_0x3090('0x31')]);_0x18eb09[_0x3090('0x2e')]=qs[_0x3090('0x2e')](_0x1a5b96[_0x3090('0x3f')][_0x3090('0x2e')]);}return _0x41966c['getAgents'](_0x18eb09);}})[_0x3090('0x20')](function(_0x5d6ba7){if(_0x5d6ba7){return _0x5d6ba7?{'count':_0x1b4ee4,'rows':_0x5d6ba7}:null;}})[_0x3090('0x20')](respondWithResult(_0x4fc89b,null))['catch'](handleError(_0x4fc89b,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 3e183d0..6f67508 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 _0x1cc7=['emit','hook','exports','events','../../mysqldb','ChatWebsite','remove'];(function(_0x554ab5,_0x5ec7d1){var _0x126a3c=function(_0x2fd211){while(--_0x2fd211){_0x554ab5['push'](_0x554ab5['shift']());}};_0x126a3c(++_0x5ec7d1);}(_0x1cc7,0x15a));var _0x71cc=function(_0x112bcc,_0x21317a){_0x112bcc=_0x112bcc-0x0;var _0x4f2df2=_0x1cc7[_0x112bcc];return _0x4f2df2;};'use strict';var EventEmitter=require(_0x71cc('0x0'));var ChatWebsite=require(_0x71cc('0x1'))['db'][_0x71cc('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x71cc('0x3')};function emitEvent(_0x1fac93){return function(_0x402191,_0x5431e1,_0x5dfed9){ChatWebsiteEvents['emit'](_0x1fac93+':'+_0x402191['id'],_0x402191);ChatWebsiteEvents[_0x71cc('0x4')](_0x1fac93,_0x402191);_0x5dfed9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x71cc('0x5')](e,emitEvent(event));}}module[_0x71cc('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0x6bff=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6bff,0xa6));var _0xf6bf=function(_0x2a7d83,_0x17a867){_0x2a7d83=_0x2a7d83-0x0;var _0x50e7b5=_0x6bff[_0x2a7d83];return _0x50e7b5;};'use strict';var EventEmitter=require(_0xf6bf('0x0'));var ChatWebsite=require(_0xf6bf('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xf6bf('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf6bf('0x3'),'afterDestroy':_0xf6bf('0x4')};function emitEvent(_0x3ab762){return function(_0x14a2d8,_0x4cc8b6,_0x1f3e2c){ChatWebsiteEvents[_0xf6bf('0x5')](_0x3ab762+':'+_0x14a2d8['id'],_0x14a2d8);ChatWebsiteEvents[_0xf6bf('0x5')](_0x3ab762,_0x14a2d8);_0x1f3e2c(null);};}for(var e in events){if(events[_0xf6bf('0x6')](e)){var event=events[e];ChatWebsite[_0xf6bf('0x7')](e,emitEvent(event));}}module[_0xf6bf('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index e4e6f67..c18987f 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 _0x260b=['bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util'];(function(_0xdb346f,_0x43a26b){var _0x4046e0=function(_0x569624){while(--_0x569624){_0xdb346f['push'](_0xdb346f['shift']());}};_0x4046e0(++_0x43a26b);}(_0x260b,0x17e));var _0xb260=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0x260b[_0x133277];return _0x5b4a22;};'use strict';var _=require(_0xb260('0x0'));var util=require(_0xb260('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb260('0x2'));var rp=require(_0xb260('0x3'));var fs=require('fs');var path=require(_0xb260('0x4'));var rimraf=require(_0xb260('0x5'));var config=require(_0xb260('0x6'));var attributes=require(_0xb260('0x7'));module[_0xb260('0x8')]=function(_0x47d4ac,_0x1a5967){return _0x47d4ac[_0xb260('0x9')](_0xb260('0xa'),attributes,{'tableName':_0xb260('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26dd=['define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatWebsite.attributes'];(function(_0x3b1883,_0x53f8c0){var _0x111897=function(_0x48119b){while(--_0x48119b){_0x3b1883['push'](_0x3b1883['shift']());}};_0x111897(++_0x53f8c0);}(_0x26dd,0x1d1));var _0xd26d=function(_0x3c4916,_0x1c5575){_0x3c4916=_0x3c4916-0x0;var _0x328192=_0x26dd[_0x3c4916];return _0x328192;};'use strict';var _=require(_0xd26d('0x0'));var util=require('util');var logger=require(_0xd26d('0x1'))(_0xd26d('0x2'));var moment=require(_0xd26d('0x3'));var BPromise=require('bluebird');var rp=require(_0xd26d('0x4'));var fs=require('fs');var path=require(_0xd26d('0x5'));var rimraf=require('rimraf');var config=require(_0xd26d('0x6'));var attributes=require(_0xd26d('0x7'));module['exports']=function(_0x3b084a,_0x47d830){return _0x3b084a[_0xd26d('0x8')](_0xd26d('0x9'),attributes,{'tableName':_0xd26d('0xa'),'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 952a262..f855033 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 _0x38d3=['lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','./chatWebsite.socket','register','request','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result'];(function(_0x586eb2,_0x40e4cd){var _0x161ee2=function(_0x242401){while(--_0x242401){_0x586eb2['push'](_0x586eb2['shift']());}};_0x161ee2(++_0x40e4cd);}(_0x38d3,0x1a9));var _0x338d=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x38d3[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x338d('0x0'));var util=require(_0x338d('0x1'));var moment=require('moment');var BPromise=require(_0x338d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x338d('0x3'));var db=require(_0x338d('0x4'))['db'];var utils=require(_0x338d('0x5'));var logger=require(_0x338d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x338d('0x7'));var client=jayson[_0x338d('0x8')][_0x338d('0x9')]({'port':0x232a});config[_0x338d('0xa')]=_['defaults'](config[_0x338d('0xa')],{'host':_0x338d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x338d('0xa')]));require(_0x338d('0xc'))[_0x338d('0xd')](socket);function respondWithRpcPromise(_0x510326,_0x16bb4e,_0x5d75d4){return new BPromise(function(_0x241f8a,_0x1b3c95){return client[_0x338d('0xe')](_0x510326,_0x5d75d4)['then'](function(_0x6b6493){logger[_0x338d('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x16bb4e,_0x338d('0x10'));logger[_0x338d('0x11')](_0x338d('0x12'),_0x16bb4e,'request\x20sent',JSON[_0x338d('0x13')](_0x6b6493));if(_0x6b6493[_0x338d('0x14')]){if(_0x6b6493[_0x338d('0x14')][_0x338d('0x15')]===0x1f4){logger['error'](_0x338d('0x16'),_0x16bb4e,_0x6b6493[_0x338d('0x14')][_0x338d('0x17')]);return _0x1b3c95(_0x6b6493[_0x338d('0x14')][_0x338d('0x17')]);}logger[_0x338d('0x14')](_0x338d('0x16'),_0x16bb4e,_0x6b6493['error'][_0x338d('0x17')]);return _0x241f8a(_0x6b6493['error'][_0x338d('0x17')]);}else{logger[_0x338d('0xf')](_0x338d('0x16'),_0x16bb4e,'request\x20sent');_0x241f8a(_0x6b6493[_0x338d('0x18')][_0x338d('0x17')]);}})['catch'](function(_0x31c821){logger[_0x338d('0x14')](_0x338d('0x16'),_0x16bb4e,_0x31c821);_0x1b3c95(_0x31c821);});});} \ No newline at end of file +var _0x032d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x032d,0x69));var _0xd032=function(_0x2b4290,_0x333670){_0x2b4290=_0x2b4290-0x0;var _0x123a61=_0x032d[_0x2b4290];return _0x123a61;};'use strict';var _=require(_0xd032('0x0'));var util=require(_0xd032('0x1'));var moment=require(_0xd032('0x2'));var BPromise=require('bluebird');var rs=require(_0xd032('0x3'));var fs=require('fs');var Redis=require(_0xd032('0x4'));var db=require(_0xd032('0x5'))['db'];var utils=require(_0xd032('0x6'));var logger=require(_0xd032('0x7'))(_0xd032('0x8'));var config=require(_0xd032('0x9'));var jayson=require(_0xd032('0xa'));var client=jayson[_0xd032('0xb')][_0xd032('0xc')]({'port':0x232a});config[_0xd032('0xd')]=_[_0xd032('0xe')](config['redis'],{'host':_0xd032('0xf'),'port':0x18eb});var socket=require(_0xd032('0x10'))(new Redis(config['redis']));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x1171b0,_0x208880,_0x5be3c6){return new BPromise(function(_0x531a52,_0x3b895e){return client[_0xd032('0x11')](_0x1171b0,_0x5be3c6)[_0xd032('0x12')](function(_0x13e996){logger[_0xd032('0x13')](_0xd032('0x14'),_0x208880,_0xd032('0x15'));logger[_0xd032('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x208880,_0xd032('0x15'),JSON[_0xd032('0x17')](_0x13e996));if(_0x13e996[_0xd032('0x18')]){if(_0x13e996[_0xd032('0x18')][_0xd032('0x19')]===0x1f4){logger['error'](_0xd032('0x14'),_0x208880,_0x13e996[_0xd032('0x18')][_0xd032('0x1a')]);return _0x3b895e(_0x13e996[_0xd032('0x18')][_0xd032('0x1a')]);}logger[_0xd032('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x208880,_0x13e996['error'][_0xd032('0x1a')]);return _0x531a52(_0x13e996['error'][_0xd032('0x1a')]);}else{logger['info'](_0xd032('0x14'),_0x208880,_0xd032('0x15'));_0x531a52(_0x13e996['result']['message']);}})[_0xd032('0x1b')](function(_0x237aa9){logger['error'](_0xd032('0x14'),_0x208880,_0x237aa9);_0x3b895e(_0x237aa9);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 0763624..73edb92 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 _0xccb7=['emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xccb7,0x9d));var _0x7ccb=function(_0x5edf18,_0x394a73){_0x5edf18=_0x5edf18-0x0;var _0x4c62bb=_0xccb7[_0x5edf18];return _0x4c62bb;};'use strict';var ChatWebsiteEvents=require(_0x7ccb('0x0'));var events=['save',_0x7ccb('0x1'),_0x7ccb('0x2')];function createListener(_0x4d5aac,_0x1b1506){return function(_0xa3672e){_0x1b1506[_0x7ccb('0x3')](_0x4d5aac,_0xa3672e);};}function removeListener(_0x491199,_0x434e0f){return function(){ChatWebsiteEvents[_0x7ccb('0x4')](_0x491199,_0x434e0f);};}exports[_0x7ccb('0x5')]=function(_0x40a632){for(var _0xb820da=0x0,_0x625b85=events[_0x7ccb('0x6')];_0xb820da<_0x625b85;_0xb820da++){var _0x182bf1=events[_0xb820da];var _0x49fa92=createListener(_0x7ccb('0x7')+_0x182bf1,_0x40a632);ChatWebsiteEvents['on'](_0x182bf1,_0x49fa92);}}; \ No newline at end of file +var _0xda61=['length','chatWebsite:','save','remove','update','removeListener'];(function(_0x1ec8f9,_0x22f5e7){var _0x17cd3d=function(_0x156ad2){while(--_0x156ad2){_0x1ec8f9['push'](_0x1ec8f9['shift']());}};_0x17cd3d(++_0x22f5e7);}(_0xda61,0x12e));var _0x1da6=function(_0xc97c3c,_0x38c459){_0xc97c3c=_0xc97c3c-0x0;var _0x3f0130=_0xda61[_0xc97c3c];return _0x3f0130;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x1da6('0x0'),_0x1da6('0x1'),_0x1da6('0x2')];function createListener(_0x3e0854,_0x318676){return function(_0x2d2195){_0x318676['emit'](_0x3e0854,_0x2d2195);};}function removeListener(_0xa36b05,_0x2b3e35){return function(){ChatWebsiteEvents[_0x1da6('0x3')](_0xa36b05,_0x2b3e35);};}exports['register']=function(_0x30e540){for(var _0x1cde52=0x0,_0x2d6e8c=events[_0x1da6('0x4')];_0x1cde52<_0x2d6e8c;_0x1cde52++){var _0x1fb878=events[_0x1cde52];var _0x19bd3f=createListener(_0x1da6('0x5')+_0x1fb878,_0x30e540);ChatWebsiteEvents['on'](_0x1fb878,_0x19bd3f);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 40f20dd..fd20985 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 _0xb281=['root','server/files/images/logos/','format','%s-%s','now','single','addLogo','diskStorage','server/files/images/avatars/','originalname','file','addAvatar','addSystemAvatar','/:id/notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','removeAnswers','exports','multer','util','path','fs-extra','../../config/environment','./chatWebsite.controller','get','index','/describe','describe','/:id','isAuthenticated','/: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','getApplications','/:id/proactive_actions','getProactiveActions','getFields','getOfflineMessages','/:id/users','getAgents','post','addDisposition','addAnswer','join'];(function(_0x2e16e8,_0x95b6fa){var _0xcad9f4=function(_0x2b84d7){while(--_0x2b84d7){_0x2e16e8['push'](_0x2e16e8['shift']());}};_0xcad9f4(++_0x95b6fa);}(_0xb281,0x65));var _0x1b28=function(_0x54ba41,_0x706023){_0x54ba41=_0x54ba41-0x0;var _0x336916=_0xb281[_0x54ba41];return _0x336916;};'use strict';var multer=require(_0x1b28('0x0'));var util=require(_0x1b28('0x1'));var path=require(_0x1b28('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x1b28('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b28('0x4'));var controller=require(_0x1b28('0x5'));router[_0x1b28('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b28('0x7')]);router[_0x1b28('0x6')](_0x1b28('0x8'),auth['isAuthenticated'](),controller[_0x1b28('0x9')]);router[_0x1b28('0x6')](_0x1b28('0xa'),auth[_0x1b28('0xb')](),controller['show']);router[_0x1b28('0x6')](_0x1b28('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x1b28('0x6')](_0x1b28('0xd'),auth[_0x1b28('0xb')](),controller[_0x1b28('0xe')]);router[_0x1b28('0x6')](_0x1b28('0xf'),controller[_0x1b28('0x10')]);router['get'](_0x1b28('0x11'),controller[_0x1b28('0x12')]);router[_0x1b28('0x6')](_0x1b28('0x13'),controller[_0x1b28('0x14')]);router[_0x1b28('0x6')](_0x1b28('0x15'),controller[_0x1b28('0x16')]);router[_0x1b28('0x6')](_0x1b28('0x17'),auth[_0x1b28('0xb')](),controller[_0x1b28('0x18')]);router[_0x1b28('0x6')](_0x1b28('0x19'),controller[_0x1b28('0x1a')]);router[_0x1b28('0x6')](_0x1b28('0x1b'),auth[_0x1b28('0xb')](),controller[_0x1b28('0x1c')]);router[_0x1b28('0x6')](_0x1b28('0x1d'),auth[_0x1b28('0xb')](),controller[_0x1b28('0x1e')]);router[_0x1b28('0x6')]('/:id/fields',controller[_0x1b28('0x1f')]);router[_0x1b28('0x6')]('/:id/offline_messages',auth[_0x1b28('0xb')](),controller[_0x1b28('0x20')]);router[_0x1b28('0x6')](_0x1b28('0x21'),auth['isAuthenticated'](),controller[_0x1b28('0x22')]);router[_0x1b28('0x23')]('/',auth[_0x1b28('0xb')](),controller['create']);router['post'](_0x1b28('0xc'),auth['isAuthenticated'](),controller[_0x1b28('0x24')]);router[_0x1b28('0x23')]('/:id/canned_answers',auth[_0x1b28('0xb')](),controller[_0x1b28('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x165e9a,_0x52e91c,_0x3d864f){_0x3d864f(null,path[_0x1b28('0x26')](config[_0x1b28('0x27')],_0x1b28('0x28')));},'filename':function(_0x186490,_0x1add99,_0x59463e){_0x59463e(null,util[_0x1b28('0x29')](_0x1b28('0x2a'),Date[_0x1b28('0x2b')](),_0x1add99['originalname']));}})});router[_0x1b28('0x23')]('/:id/logo',upload[_0x1b28('0x2c')]('file'),controller[_0x1b28('0x2d')]);var upload=multer({'storage':multer[_0x1b28('0x2e')]({'destination':function(_0x421057,_0x2c492e,_0x1b7d9e){_0x1b7d9e(null,path['join'](config[_0x1b28('0x27')],_0x1b28('0x2f')));},'filename':function(_0x46fd25,_0x4243f9,_0x2081e6){_0x2081e6(null,util[_0x1b28('0x29')](_0x1b28('0x2a'),Date[_0x1b28('0x2b')](),_0x4243f9[_0x1b28('0x30')]));}})});router['post'](_0x1b28('0x11'),upload['single'](_0x1b28('0x31')),controller[_0x1b28('0x32')]);var upload=multer({'storage':multer[_0x1b28('0x2e')]({'destination':function(_0xf7001,_0x225af0,_0x1830ee){_0x1830ee(null,path['join'](config[_0x1b28('0x27')],_0x1b28('0x2f')));},'filename':function(_0x32ba9d,_0x1cdf81,_0x4794fb){_0x4794fb(null,util[_0x1b28('0x29')](_0x1b28('0x2a'),Date['now'](),_0x1cdf81[_0x1b28('0x30')]));}})});router[_0x1b28('0x23')](_0x1b28('0x13'),upload[_0x1b28('0x2c')](_0x1b28('0x31')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x1b28('0x2e')]({'destination':function(_0x3d7bd0,_0x3e761a,_0x15d011){_0x15d011(null,path['join'](config[_0x1b28('0x27')],_0x1b28('0x2f')));},'filename':function(_0x42a551,_0x2d87a1,_0x299c25){_0x299c25(null,util[_0x1b28('0x29')](_0x1b28('0x2a'),Date[_0x1b28('0x2b')](),_0x2d87a1[_0x1b28('0x30')]));}})});router['post'](_0x1b28('0x15'),upload[_0x1b28('0x2c')](_0x1b28('0x31')),controller[_0x1b28('0x33')]);router['post'](_0x1b28('0x34'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x1b28('0x2e')]({'destination':function(_0x16b2b0,_0x10c382,_0x15f987){const _0x20cbb7=path[_0x1b28('0x26')](config[_0x1b28('0x27')],'server/files',_0x1b28('0x35'),_0x1b28('0x36'));fs_extra[_0x1b28('0x37')](_0x20cbb7,function(){_0x15f987(null,_0x20cbb7);});},'filename':function(_0x6da2f7,_0x11d3ba,_0xe685a2){const _0x18f204=_0x11d3ba[_0x1b28('0x30')][_0x1b28('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5dda20=path[_0x1b28('0x39')](_0x18f204);const _0xebe553=Date[_0x1b28('0x2b')]()+'-'+_0x18f204[_0x1b28('0x38')](_0x5dda20,'')+_0x5dda20;_0xe685a2(null,_0xebe553);}})});router[_0x1b28('0x23')](_0x1b28('0x3a'),offlineUploadMulter[_0x1b28('0x3b')](),controller['offline']);router[_0x1b28('0x23')](_0x1b28('0x17'),auth['isAuthenticated'](),controller[_0x1b28('0x3c')]);router['post']('/:id/applications',auth[_0x1b28('0xb')](),controller[_0x1b28('0x3d')]);router[_0x1b28('0x23')](_0x1b28('0x1d'),auth[_0x1b28('0xb')](),controller[_0x1b28('0x3e')]);router[_0x1b28('0x23')](_0x1b28('0x21'),auth[_0x1b28('0xb')](),controller[_0x1b28('0x3f')]);router['put'](_0x1b28('0xa'),auth[_0x1b28('0xb')](),controller[_0x1b28('0x40')]);router[_0x1b28('0x41')](_0x1b28('0xa'),auth['isAuthenticated'](),controller[_0x1b28('0x42')]);router[_0x1b28('0x41')](_0x1b28('0xc'),auth[_0x1b28('0xb')](),controller[_0x1b28('0x43')]);router['delete'](_0x1b28('0xd'),auth[_0x1b28('0xb')](),controller[_0x1b28('0x44')]);router[_0x1b28('0x41')](_0x1b28('0x21'),auth[_0x1b28('0xb')](),controller['removeAgents']);module[_0x1b28('0x45')]=router; \ No newline at end of file +var _0x3495=['attachments','offline-chat','ensureDir','replace','/:id/offline','any','addInteraction','addApplications','addProactiveActions','/:id/users','put','update','delete','removeAnswers','removeAgents','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','create','post','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','originalname','addLogo','server/files/images/avatars/','now','single','file','addAvatar','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files'];(function(_0x48f23f,_0x9145c5){var _0x52e361=function(_0x5c0f7c){while(--_0x5c0f7c){_0x48f23f['push'](_0x48f23f['shift']());}};_0x52e361(++_0x9145c5);}(_0x3495,0x1b9));var _0x5349=function(_0x5f6bb2,_0x4d446a){_0x5f6bb2=_0x5f6bb2-0x0;var _0x208968=_0x3495[_0x5f6bb2];return _0x208968;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5349('0x0'));var timeout=require('connect-timeout');var express=require(_0x5349('0x1'));var router=express[_0x5349('0x2')]();var fs_extra=require(_0x5349('0x3'));var auth=require(_0x5349('0x4'));var interaction=require(_0x5349('0x5'));var config=require(_0x5349('0x6'));var controller=require(_0x5349('0x7'));router[_0x5349('0x8')]('/',auth[_0x5349('0x9')](),controller['index']);router['get'](_0x5349('0xa'),auth[_0x5349('0x9')](),controller[_0x5349('0xb')]);router[_0x5349('0x8')](_0x5349('0xc'),auth[_0x5349('0x9')](),controller[_0x5349('0xd')]);router[_0x5349('0x8')](_0x5349('0xe'),auth[_0x5349('0x9')](),controller[_0x5349('0xf')]);router[_0x5349('0x8')](_0x5349('0x10'),auth['isAuthenticated'](),controller[_0x5349('0x11')]);router[_0x5349('0x8')](_0x5349('0x12'),controller[_0x5349('0x13')]);router[_0x5349('0x8')](_0x5349('0x14'),controller[_0x5349('0x15')]);router[_0x5349('0x8')]('/:id/customer_avatar',controller[_0x5349('0x16')]);router[_0x5349('0x8')](_0x5349('0x17'),controller[_0x5349('0x18')]);router['get'](_0x5349('0x19'),auth[_0x5349('0x9')](),controller[_0x5349('0x1a')]);router['get'](_0x5349('0x1b'),controller[_0x5349('0x1c')]);router['get'](_0x5349('0x1d'),auth[_0x5349('0x9')](),controller[_0x5349('0x1e')]);router[_0x5349('0x8')](_0x5349('0x1f'),auth[_0x5349('0x9')](),controller[_0x5349('0x20')]);router[_0x5349('0x8')](_0x5349('0x21'),controller['getFields']);router['get']('/:id/offline_messages',auth[_0x5349('0x9')](),controller['getOfflineMessages']);router[_0x5349('0x8')]('/:id/users',auth[_0x5349('0x9')](),controller['getAgents']);router['post']('/',auth[_0x5349('0x9')](),controller[_0x5349('0x22')]);router[_0x5349('0x23')](_0x5349('0xe'),auth[_0x5349('0x9')](),controller[_0x5349('0x24')]);router[_0x5349('0x23')]('/:id/canned_answers',auth[_0x5349('0x9')](),controller[_0x5349('0x25')]);var upload=multer({'storage':multer[_0x5349('0x26')]({'destination':function(_0x157f95,_0x1a0ff1,_0x5c26c0){_0x5c26c0(null,path[_0x5349('0x27')](config[_0x5349('0x28')],_0x5349('0x29')));},'filename':function(_0x7e06c6,_0x5106dd,_0x3e4d69){_0x3e4d69(null,util[_0x5349('0x2a')](_0x5349('0x2b'),Date['now'](),_0x5106dd[_0x5349('0x2c')]));}})});router[_0x5349('0x23')](_0x5349('0x12'),upload['single']('file'),controller[_0x5349('0x2d')]);var upload=multer({'storage':multer[_0x5349('0x26')]({'destination':function(_0x13873e,_0x26ac15,_0x52d85e){_0x52d85e(null,path[_0x5349('0x27')](config['root'],_0x5349('0x2e')));},'filename':function(_0x2ab6e0,_0x796744,_0x1d5a0e){_0x1d5a0e(null,util[_0x5349('0x2a')](_0x5349('0x2b'),Date[_0x5349('0x2f')](),_0x796744[_0x5349('0x2c')]));}})});router[_0x5349('0x23')](_0x5349('0x14'),upload[_0x5349('0x30')](_0x5349('0x31')),controller[_0x5349('0x32')]);var upload=multer({'storage':multer[_0x5349('0x26')]({'destination':function(_0xd0319b,_0x3c0c81,_0x5b1580){_0x5b1580(null,path['join'](config[_0x5349('0x28')],_0x5349('0x2e')));},'filename':function(_0x5d2581,_0x419b54,_0x262af1){_0x262af1(null,util[_0x5349('0x2a')](_0x5349('0x2b'),Date['now'](),_0x419b54[_0x5349('0x2c')]));}})});router[_0x5349('0x23')](_0x5349('0x33'),upload[_0x5349('0x30')](_0x5349('0x31')),controller[_0x5349('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5eaa65,_0x30680e,_0x183b4f){_0x183b4f(null,path['join'](config[_0x5349('0x28')],_0x5349('0x2e')));},'filename':function(_0x32a298,_0x20972b,_0x24f465){_0x24f465(null,util[_0x5349('0x2a')](_0x5349('0x2b'),Date[_0x5349('0x2f')](),_0x20972b[_0x5349('0x2c')]));}})});router[_0x5349('0x23')](_0x5349('0x17'),upload['single'](_0x5349('0x31')),controller[_0x5349('0x35')]);router[_0x5349('0x23')](_0x5349('0x36'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x5349('0x26')]({'destination':function(_0x597dac,_0x48a5fe,_0xce986b){const _0x252ece=path[_0x5349('0x27')](config[_0x5349('0x28')],_0x5349('0x37'),_0x5349('0x38'),_0x5349('0x39'));fs_extra[_0x5349('0x3a')](_0x252ece,function(){_0xce986b(null,_0x252ece);});},'filename':function(_0x3d8e07,_0x321e97,_0x3ad137){const _0x1b549d=_0x321e97[_0x5349('0x2c')][_0x5349('0x3b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x426aa9=path['extname'](_0x1b549d);const _0x1b03c1=Date[_0x5349('0x2f')]()+'-'+_0x1b549d[_0x5349('0x3b')](_0x426aa9,'')+_0x426aa9;_0x3ad137(null,_0x1b03c1);}})});router[_0x5349('0x23')](_0x5349('0x3c'),offlineUploadMulter[_0x5349('0x3d')](),controller['offline']);router['post'](_0x5349('0x19'),auth[_0x5349('0x9')](),controller[_0x5349('0x3e')]);router['post'](_0x5349('0x1d'),auth['isAuthenticated'](),controller[_0x5349('0x3f')]);router[_0x5349('0x23')](_0x5349('0x1f'),auth['isAuthenticated'](),controller[_0x5349('0x40')]);router[_0x5349('0x23')](_0x5349('0x41'),auth['isAuthenticated'](),controller['addAgents']);router[_0x5349('0x42')](_0x5349('0xc'),auth[_0x5349('0x9')](),controller[_0x5349('0x43')]);router['delete'](_0x5349('0xc'),auth[_0x5349('0x9')](),controller['destroy']);router[_0x5349('0x44')]('/:id/dispositions',auth[_0x5349('0x9')](),controller['removeDispositions']);router[_0x5349('0x44')](_0x5349('0x10'),auth[_0x5349('0x9')](),controller[_0x5349('0x45')]);router[_0x5349('0x44')](_0x5349('0x41'),auth[_0x5349('0x9')](),controller[_0x5349('0x46')]);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 030ad50..fb1f8a4 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 _0xee3c=['sequelize','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x484b24,_0x5f34ad){var _0x379fbb=function(_0x138c14){while(--_0x138c14){_0x484b24['push'](_0x484b24['shift']());}};_0x379fbb(++_0x5f34ad);}(_0xee3c,0x14a));var _0xcee3=function(_0x34a56e,_0x2969cf){_0x34a56e=_0x34a56e-0x0;var _0x564fed=_0xee3c[_0x34a56e];return _0x564fed;};'use strict';var Sequelize=require(_0xcee3('0x0'));module[_0xcee3('0x1')]={'name':{'type':Sequelize[_0xcee3('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xcee3('0x3')](_0xcee3('0x4'),_0xcee3('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6144=['STRING','ENUM','Google','sequelize','exports'];(function(_0x25918a,_0x27c6a4){var _0x1c79d4=function(_0x43d8fc){while(--_0x43d8fc){_0x25918a['push'](_0x25918a['shift']());}};_0x1c79d4(++_0x27c6a4);}(_0x6144,0x99));var _0x4614=function(_0x26fb28,_0x288d71){_0x26fb28=_0x26fb28-0x0;var _0xe90d7d=_0x6144[_0x26fb28];return _0xe90d7d;};'use strict';var Sequelize=require(_0x4614('0x0'));module[_0x4614('0x1')]={'name':{'type':Sequelize[_0x4614('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x4614('0x3')]('AmazonAWS',_0x4614('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x4614('0x2')]},'data2':{'type':Sequelize[_0x4614('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 9fe7476..da05ae8 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 _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','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'];(function(_0x330a8a,_0x30e661){var _0x5d447c=function(_0x50d4d5){while(--_0x50d4d5){_0x330a8a['push'](_0x330a8a['shift']());}};_0x5d447c(++_0x30e661);}(_0x7a54,0x106));var _0x47a5=function(_0x4fb3ba,_0x5f0c6f){_0x4fb3ba=_0x4fb3ba-0x0;var _0x543666=_0x7a54[_0x4fb3ba];return _0x543666;};'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['CloudProvider'][_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['CloudProvider']['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['CloudProvider']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file +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(_0x1348ac,_0x23f80c){var _0x246815=function(_0x489432){while(--_0x489432){_0x1348ac['push'](_0x1348ac['shift']());}};_0x246815(++_0x23f80c);}(_0xdb28,0x106));var _0x8db2=function(_0x128374,_0x252eba){_0x128374=_0x128374-0x0;var _0x277839=_0xdb28[_0x128374];return _0x277839;};'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 diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 360cb37..d8f5433 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 _0xe2be=['CloudProvider','cloud_providers','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cloudProvider.attributes','define'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0xe2be,0x1ca));var _0xee2b=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xe2be[_0x53cf8e];return _0x459197;};'use strict';var _=require('lodash');var util=require(_0xee2b('0x0'));var logger=require(_0xee2b('0x1'))(_0xee2b('0x2'));var moment=require(_0xee2b('0x3'));var BPromise=require(_0xee2b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee2b('0x5'));var rimraf=require(_0xee2b('0x6'));var config=require(_0xee2b('0x7'));var attributes=require(_0xee2b('0x8'));module['exports']=function(_0x29e064,_0x39418a){return _0x29e064[_0xee2b('0x9')](_0xee2b('0xa'),attributes,{'tableName':_0xee2b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb674=['../../config/environment','./cloudProvider.attributes','exports','define','cloud_providers','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0xb674,0xc8));var _0x4b67=function(_0x3082e5,_0x833b52){_0x3082e5=_0x3082e5-0x0;var _0x5204b9=_0xb674[_0x3082e5];return _0x5204b9;};'use strict';var _=require(_0x4b67('0x0'));var util=require('util');var logger=require(_0x4b67('0x1'))(_0x4b67('0x2'));var moment=require(_0x4b67('0x3'));var BPromise=require(_0x4b67('0x4'));var rp=require(_0x4b67('0x5'));var fs=require('fs');var path=require(_0x4b67('0x6'));var rimraf=require(_0x4b67('0x7'));var config=require(_0x4b67('0x8'));var attributes=require(_0x4b67('0x9'));module[_0x4b67('0xa')]=function(_0x2d9a50,_0x28a913){return _0x2d9a50[_0x4b67('0xb')]('CloudProvider',attributes,{'tableName':_0x4b67('0xc'),'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 114370f..8f68360 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 _0x1a38=['lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x32d8a5,_0x1ef6d2){var _0x2d0d10=function(_0x35fd07){while(--_0x35fd07){_0x32d8a5['push'](_0x32d8a5['shift']());}};_0x2d0d10(++_0x1ef6d2);}(_0x1a38,0xb0));var _0x81a3=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x1a38[_0x28a5ad];return _0x176b8a;};'use strict';var _=require(_0x81a3('0x0'));var util=require(_0x81a3('0x1'));var moment=require(_0x81a3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81a3('0x3'))['db'];var utils=require(_0x81a3('0x4'));var logger=require(_0x81a3('0x5'))(_0x81a3('0x6'));var config=require(_0x81a3('0x7'));var jayson=require(_0x81a3('0x8'));var client=jayson[_0x81a3('0x9')][_0x81a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3153ee,_0x2d331e,_0x207345){return new BPromise(function(_0xe10e0a,_0x3be616){return client['request'](_0x3153ee,_0x207345)[_0x81a3('0xb')](function(_0x252685){logger[_0x81a3('0xc')](_0x81a3('0xd'),_0x2d331e,_0x81a3('0xe'));logger['debug'](_0x81a3('0xf'),_0x2d331e,_0x81a3('0xe'),JSON[_0x81a3('0x10')](_0x252685));if(_0x252685['error']){if(_0x252685['error'][_0x81a3('0x11')]===0x1f4){logger[_0x81a3('0x12')](_0x81a3('0xd'),_0x2d331e,_0x252685[_0x81a3('0x12')][_0x81a3('0x13')]);return _0x3be616(_0x252685[_0x81a3('0x12')][_0x81a3('0x13')]);}logger[_0x81a3('0x12')](_0x81a3('0xd'),_0x2d331e,_0x252685[_0x81a3('0x12')][_0x81a3('0x13')]);return _0xe10e0a(_0x252685[_0x81a3('0x12')]['message']);}else{logger[_0x81a3('0xc')](_0x81a3('0xd'),_0x2d331e,_0x81a3('0xe'));_0xe10e0a(_0x252685[_0x81a3('0x14')]['message']);}})[_0x81a3('0x15')](function(_0x18fc8d){logger['error'](_0x81a3('0xd'),_0x2d331e,_0x18fc8d);_0x3be616(_0x18fc8d);});});} \ No newline at end of file +var _0xa3fe=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','CloudProvider,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0x418f25,_0x1e09af){var _0x3a571b=function(_0x386d44){while(--_0x386d44){_0x418f25['push'](_0x418f25['shift']());}};_0x3a571b(++_0x1e09af);}(_0xa3fe,0xd8));var _0xea3f=function(_0x50c54a,_0x25df7b){_0x50c54a=_0x50c54a-0x0;var _0x4ce675=_0xa3fe[_0x50c54a];return _0x4ce675;};'use strict';var _=require(_0xea3f('0x0'));var util=require('util');var moment=require(_0xea3f('0x1'));var BPromise=require(_0xea3f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea3f('0x3'));var db=require(_0xea3f('0x4'))['db'];var utils=require(_0xea3f('0x5'));var logger=require('../../config/logger')(_0xea3f('0x6'));var config=require('../../config/environment');var jayson=require(_0xea3f('0x7'));var client=jayson[_0xea3f('0x8')][_0xea3f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49e494,_0x56abd6,_0x187ce0){return new BPromise(function(_0x35ba50,_0x3c4807){return client['request'](_0x49e494,_0x187ce0)['then'](function(_0x464ad4){logger['info']('CloudProvider,\x20%s,\x20%s',_0x56abd6,_0xea3f('0xa'));logger[_0xea3f('0xb')](_0xea3f('0xc'),_0x56abd6,'request\x20sent',JSON['stringify'](_0x464ad4));if(_0x464ad4['error']){if(_0x464ad4[_0xea3f('0xd')][_0xea3f('0xe')]===0x1f4){logger[_0xea3f('0xd')](_0xea3f('0xf'),_0x56abd6,_0x464ad4['error']['message']);return _0x3c4807(_0x464ad4['error'][_0xea3f('0x10')]);}logger[_0xea3f('0xd')]('CloudProvider,\x20%s,\x20%s',_0x56abd6,_0x464ad4[_0xea3f('0xd')][_0xea3f('0x10')]);return _0x35ba50(_0x464ad4['error'][_0xea3f('0x10')]);}else{logger[_0xea3f('0x11')](_0xea3f('0xf'),_0x56abd6,_0xea3f('0xa'));_0x35ba50(_0x464ad4[_0xea3f('0x12')][_0xea3f('0x10')]);}})[_0xea3f('0x13')](function(_0x2585f1){logger[_0xea3f('0xd')](_0xea3f('0xf'),_0x56abd6,_0x2585f1);_0x3c4807(_0x2585f1);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 622790d..7ebd894 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 _0x0721=['/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','create','put'];(function(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0x0721,0x9d));var _0x1072=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0x0721[_0x442f02];return _0xab6ef1;};'use strict';var multer=require('multer');var util=require(_0x1072('0x0'));var path=require(_0x1072('0x1'));var timeout=require('connect-timeout');var express=require(_0x1072('0x2'));var router=express[_0x1072('0x3')]();var fs_extra=require(_0x1072('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1072('0x5'));var config=require(_0x1072('0x6'));var controller=require('./cloudProvider.controller');router[_0x1072('0x7')]('/',auth['isAuthenticated'](),controller[_0x1072('0x8')]);router[_0x1072('0x7')]('/:id',auth[_0x1072('0x9')](),controller[_0x1072('0xa')]);router[_0x1072('0xb')]('/',auth[_0x1072('0x9')](),controller[_0x1072('0xc')]);router[_0x1072('0xd')](_0x1072('0xe'),auth[_0x1072('0x9')](),controller[_0x1072('0xf')]);router[_0x1072('0x10')](_0x1072('0xe'),auth[_0x1072('0x9')](),controller[_0x1072('0x11')]);module[_0x1072('0x12')]=router; \ No newline at end of file +var _0xc08a=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete'];(function(_0x4b8224,_0xe52003){var _0xd52a92=function(_0x59ae92){while(--_0x59ae92){_0x4b8224['push'](_0x4b8224['shift']());}};_0xd52a92(++_0xe52003);}(_0xc08a,0x167));var _0xac08=function(_0x246419,_0x554ea8){_0x246419=_0x246419-0x0;var _0x5c54c6=_0xc08a[_0x246419];return _0x5c54c6;};'use strict';var multer=require(_0xac08('0x0'));var util=require(_0xac08('0x1'));var path=require(_0xac08('0x2'));var timeout=require('connect-timeout');var express=require(_0xac08('0x3'));var router=express[_0xac08('0x4')]();var fs_extra=require(_0xac08('0x5'));var auth=require(_0xac08('0x6'));var interaction=require(_0xac08('0x7'));var config=require(_0xac08('0x8'));var controller=require(_0xac08('0x9'));router[_0xac08('0xa')]('/',auth[_0xac08('0xb')](),controller[_0xac08('0xc')]);router[_0xac08('0xa')](_0xac08('0xd'),auth[_0xac08('0xb')](),controller[_0xac08('0xe')]);router['post']('/',auth[_0xac08('0xb')](),controller[_0xac08('0xf')]);router[_0xac08('0x10')](_0xac08('0xd'),auth[_0xac08('0xb')](),controller[_0xac08('0x11')]);router[_0xac08('0x12')](_0xac08('0xd'),auth[_0xac08('0xb')](),controller[_0xac08('0x13')]);module[_0xac08('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index b0c4658..e5276aa 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 _0x7111=['name','STRING','sequelize','exports'];(function(_0x416716,_0x175f9d){var _0x388649=function(_0xcef2f3){while(--_0xcef2f3){_0x416716['push'](_0x416716['shift']());}};_0x388649(++_0x175f9d);}(_0x7111,0x19a));var _0x1711=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x7111[_0x32b542];return _0x554d54;};'use strict';var Sequelize=require(_0x1711('0x0'));module[_0x1711('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1711('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1711('0x3')]},'companyId':{'type':Sequelize[_0x1711('0x3')]},'website':{'type':Sequelize[_0x1711('0x3')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x1711('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x1711('0x3')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1711('0x3')]},'country':{'type':Sequelize[_0x1711('0x3')]},'email':{'type':Sequelize[_0x1711('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1711('0x3')]},'sStreet':{'type':Sequelize[_0x1711('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf811=['STRING','name','exports'];(function(_0xda501a,_0x159d6a){var _0x44be3a=function(_0x5c1c5f){while(--_0x5c1c5f){_0xda501a['push'](_0xda501a['shift']());}};_0x44be3a(++_0x159d6a);}(_0xf811,0x110));var _0x1f81=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xf811[_0x1f36bb];return _0xaf97fa;};'use strict';var Sequelize=require('sequelize');module[_0x1f81('0x0')]={'name':{'type':Sequelize[_0x1f81('0x1')],'unique':_0x1f81('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1f81('0x1')]},'companyId':{'type':Sequelize[_0x1f81('0x1')]},'website':{'type':Sequelize[_0x1f81('0x1')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x1f81('0x1')]},'type':{'type':Sequelize[_0x1f81('0x1')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x1f81('0x1')]},'city':{'type':Sequelize[_0x1f81('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1f81('0x1')]},'sStreet':{'type':Sequelize[_0x1f81('0x1')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x1f81('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1f81('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 70e118a..0beac7a 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 _0x6d74=['status','end','offset','undefined','limit','count','set','Content-Range','json','apply','then','destroy','get','Companies','UserProfileResource','stack','name','send','index','describe','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CmCompany','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','CmContact','addContacts','getContacts','findOne','eml-format','rimraf','request-promise','moment','bluebird','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','api','../../config/environment','sendStatus'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x6d74,0x192));var _0x46d7=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x6d74[_0x38a7ac];return _0x53061a;};'use strict';var emlformat=require(_0x46d7('0x0'));var rimraf=require(_0x46d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x46d7('0x2'));var moment=require(_0x46d7('0x3'));var BPromise=require(_0x46d7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x46d7('0x5'));var sox=require(_0x46d7('0x6'));var csv=require(_0x46d7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x46d7('0x8'));var _=require('lodash');var squel=require(_0x46d7('0x9'));var crypto=require(_0x46d7('0xa'));var jsforce=require(_0x46d7('0xb'));var deskjs=require(_0x46d7('0xc'));var toCsv=require(_0x46d7('0x7'));var querystring=require(_0x46d7('0xd'));var Papa=require(_0x46d7('0xe'));var Redis=require(_0x46d7('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x46d7('0x10'));var as=require(_0x46d7('0x11'));var hardwareService=require(_0x46d7('0x12'));var logger=require(_0x46d7('0x13'))(_0x46d7('0x14'));var utils=require('../../config/utils');var config=require(_0x46d7('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb68c47,_0x16f49c){_0x16f49c=_0x16f49c||0xcc;return function(_0x480089){if(_0x480089){return _0xb68c47[_0x46d7('0x16')](_0x16f49c);}return _0xb68c47[_0x46d7('0x17')](_0x16f49c)[_0x46d7('0x18')]();};}function respondWithResult(_0x1c709c,_0x1cefb3){_0x1cefb3=_0x1cefb3||0xc8;return function(_0x2fdfe2){if(_0x2fdfe2){return _0x1c709c[_0x46d7('0x17')](_0x1cefb3)['json'](_0x2fdfe2);}};}function respondWithFilteredResult(_0x31f497,_0x3c53cf){return function(_0x37133d){if(_0x37133d){var _0x4f9546=typeof _0x3c53cf[_0x46d7('0x19')]===_0x46d7('0x1a')&&typeof _0x3c53cf[_0x46d7('0x1b')]===_0x46d7('0x1a');var _0x55f432=_0x37133d[_0x46d7('0x1c')];var _0x42e854=_0x4f9546?0x0:_0x3c53cf[_0x46d7('0x19')];var _0x2fd877=_0x4f9546?_0x37133d[_0x46d7('0x1c')]:_0x3c53cf[_0x46d7('0x19')]+_0x3c53cf[_0x46d7('0x1b')];var _0x186450;if(_0x2fd877>=_0x55f432){_0x2fd877=_0x55f432;_0x186450=0xc8;}else{_0x186450=0xce;}_0x31f497['status'](_0x186450);return _0x31f497[_0x46d7('0x1d')](_0x46d7('0x1e'),_0x42e854+'-'+_0x2fd877+'/'+_0x55f432)[_0x46d7('0x1f')](_0x37133d);}return null;};}function patchUpdates(_0x431905){return function(_0x2539ac){try{jsonpatch[_0x46d7('0x20')](_0x2539ac,_0x431905,!![]);}catch(_0x4b48b9){return BPromise['reject'](_0x4b48b9);}return _0x2539ac['save']();};}function saveUpdates(_0x555277,_0x3a13c9){return function(_0x19c354){if(_0x19c354){return _0x19c354['update'](_0x555277)[_0x46d7('0x21')](function(_0x3e8a0c){return _0x3e8a0c;});}return null;};}function removeEntity(_0x38385a,_0x7102f){return function(_0x5564c9){if(_0x5564c9){return _0x5564c9[_0x46d7('0x22')]()['then'](function(){var _0x321822=_0x5564c9[_0x46d7('0x23')]({'plain':!![]});var _0x2fe5b5=_0x46d7('0x24');return db[_0x46d7('0x25')][_0x46d7('0x22')]({'where':{'type':_0x2fe5b5,'resourceId':_0x321822['id']}})[_0x46d7('0x21')](function(){return _0x5564c9;});})['then'](function(){_0x38385a[_0x46d7('0x17')](0xcc)[_0x46d7('0x18')]();});}};}function handleEntityNotFound(_0x2b71f0,_0x21a9e4){return function(_0x30a4eb){if(!_0x30a4eb){_0x2b71f0['sendStatus'](0x194);}return _0x30a4eb;};}function handleError(_0xd72f1a,_0x4d353a){_0x4d353a=_0x4d353a||0x1f4;return function(_0x41b89d){logger['error'](_0x41b89d[_0x46d7('0x26')]);if(_0x41b89d[_0x46d7('0x27')]){delete _0x41b89d[_0x46d7('0x27')];}_0xd72f1a[_0x46d7('0x17')](_0x4d353a)[_0x46d7('0x28')](_0x41b89d);};}exports[_0x46d7('0x29')]=function(_0x4d8539,_0x58347a){var _0x2c84d7={},_0x71ae00={},_0x1c4bc3={'count':0x0,'rows':[]};return db['CmCompany'][_0x46d7('0x2a')]()[_0x46d7('0x21')](function(_0x25e981){_0x71ae00[_0x46d7('0x2b')]=_['keys'](_0x25e981);_0x71ae00[_0x46d7('0x2c')]=_[_0x46d7('0x2d')](_0x4d8539[_0x46d7('0x2c')]);_0x71ae00[_0x46d7('0x2e')]=_['intersection'](_0x71ae00[_0x46d7('0x2b')],_0x71ae00['query']);_0x2c84d7[_0x46d7('0x2f')]=_[_0x46d7('0x30')](_0x71ae00['model'],qs['fields'](_0x4d8539[_0x46d7('0x2c')][_0x46d7('0x31')]));_0x2c84d7[_0x46d7('0x2f')]=_0x2c84d7['attributes'][_0x46d7('0x32')]?_0x2c84d7['attributes']:_0x71ae00[_0x46d7('0x2b')];if(!_0x4d8539[_0x46d7('0x2c')][_0x46d7('0x33')](_0x46d7('0x34'))){_0x2c84d7[_0x46d7('0x1b')]=qs[_0x46d7('0x1b')](_0x4d8539[_0x46d7('0x2c')][_0x46d7('0x1b')]);_0x2c84d7[_0x46d7('0x19')]=qs[_0x46d7('0x19')](_0x4d8539[_0x46d7('0x2c')][_0x46d7('0x19')]);}_0x2c84d7[_0x46d7('0x35')]=qs[_0x46d7('0x36')](_0x4d8539['query']['sort']);_0x2c84d7[_0x46d7('0x37')]=qs[_0x46d7('0x2e')](_[_0x46d7('0x38')](_0x4d8539[_0x46d7('0x2c')],_0x71ae00['filters']),_0x25e981);if(_0x4d8539[_0x46d7('0x2c')][_0x46d7('0x39')]){_0x2c84d7[_0x46d7('0x37')]=_[_0x46d7('0x3a')](_0x2c84d7[_0x46d7('0x37')],{'$or':_['map'](_0x2c84d7[_0x46d7('0x2f')],function(_0xfc77e1){var _0x41f3f2={};_0x41f3f2[_0xfc77e1]={'$like':'%'+_0x4d8539['query'][_0x46d7('0x39')]+'%'};return _0x41f3f2;})});}_0x2c84d7=_[_0x46d7('0x3a')]({},_0x2c84d7,_0x4d8539[_0x46d7('0x3b')]);var _0x2e64c2={'where':_0x2c84d7[_0x46d7('0x37')]};return db[_0x46d7('0x3c')][_0x46d7('0x1c')](_0x2e64c2)[_0x46d7('0x21')](function(_0x529343){_0x1c4bc3['count']=_0x529343;if(_0x4d8539[_0x46d7('0x2c')][_0x46d7('0x3d')]){_0x2c84d7['include']=[{'all':!![]}];}return db[_0x46d7('0x3c')][_0x46d7('0x3e')](_0x2c84d7);})[_0x46d7('0x21')](function(_0x3787df){_0x1c4bc3[_0x46d7('0x3f')]=_0x3787df;return _0x1c4bc3;})[_0x46d7('0x21')](respondWithFilteredResult(_0x58347a,_0x2c84d7))[_0x46d7('0x40')](handleError(_0x58347a,null));})[_0x46d7('0x40')](handleError(_0x58347a,null));};exports[_0x46d7('0x41')]=function(_0x2847ce,_0x8f4893){var _0x2c22c8={'raw':![],'where':{'id':_0x2847ce[_0x46d7('0x42')]['id']}},_0x3018dc={};_0x3018dc['model']=_[_0x46d7('0x2d')](db[_0x46d7('0x3c')][_0x46d7('0x43')]);_0x3018dc[_0x46d7('0x2c')]=_[_0x46d7('0x2d')](_0x2847ce[_0x46d7('0x2c')]);_0x3018dc['filters']=_[_0x46d7('0x30')](_0x3018dc[_0x46d7('0x2b')],_0x3018dc['query']);_0x2c22c8[_0x46d7('0x2f')]=_[_0x46d7('0x30')](_0x3018dc[_0x46d7('0x2b')],qs[_0x46d7('0x31')](_0x2847ce[_0x46d7('0x2c')][_0x46d7('0x31')]));_0x2c22c8[_0x46d7('0x2f')]=_0x2c22c8[_0x46d7('0x2f')][_0x46d7('0x32')]?_0x2c22c8['attributes']:_0x3018dc[_0x46d7('0x2b')];if(_0x2847ce['query']['includeAll']){_0x2c22c8[_0x46d7('0x44')]=[{'all':!![]}];}_0x2c22c8=_[_0x46d7('0x3a')]({},_0x2c22c8,_0x2847ce['options']);return db[_0x46d7('0x3c')]['find'](_0x2c22c8)[_0x46d7('0x21')](handleEntityNotFound(_0x8f4893,null))[_0x46d7('0x21')](respondWithResult(_0x8f4893,null))[_0x46d7('0x40')](handleError(_0x8f4893,null));};exports[_0x46d7('0x45')]=function(_0x390969,_0xed6393){return db[_0x46d7('0x3c')][_0x46d7('0x45')](_0x390969['body'],{})[_0x46d7('0x21')](function(_0x52f556){var _0x5d989f=_0x390969['user'][_0x46d7('0x23')]({'plain':!![]});if(!_0x5d989f)throw new Error(_0x46d7('0x46'));if(_0x5d989f[_0x46d7('0x47')]===_0x46d7('0x48')){var _0x567b57=_0x52f556[_0x46d7('0x23')]({'plain':!![]});var _0x21b190=_0x46d7('0x24');return db[_0x46d7('0x49')]['find']({'where':{'name':_0x21b190,'userProfileId':_0x5d989f[_0x46d7('0x4a')]},'raw':!![]})[_0x46d7('0x21')](function(_0x3a340c){if(_0x3a340c&&_0x3a340c[_0x46d7('0x4b')]===0x0){return db[_0x46d7('0x25')][_0x46d7('0x45')]({'name':_0x567b57[_0x46d7('0x27')],'resourceId':_0x567b57['id'],'type':_0x3a340c[_0x46d7('0x27')],'sectionId':_0x3a340c['id']},{})['then'](function(){return _0x52f556;});}else{return _0x52f556;}})[_0x46d7('0x40')](function(_0x3bebe8){logger[_0x46d7('0x4c')](_0x46d7('0x4d'),_0x3bebe8);throw _0x3bebe8;});}return _0x52f556;})[_0x46d7('0x21')](respondWithResult(_0xed6393,0xc9))[_0x46d7('0x40')](handleError(_0xed6393,null));};exports[_0x46d7('0x4e')]=function(_0x1c618a,_0x332e34){if(_0x1c618a[_0x46d7('0x4f')]['id']){delete _0x1c618a[_0x46d7('0x4f')]['id'];}return db[_0x46d7('0x3c')][_0x46d7('0x50')]({'where':{'id':_0x1c618a[_0x46d7('0x42')]['id']}})[_0x46d7('0x21')](handleEntityNotFound(_0x332e34,null))[_0x46d7('0x21')](saveUpdates(_0x1c618a[_0x46d7('0x4f')],null))[_0x46d7('0x21')](respondWithResult(_0x332e34,null))[_0x46d7('0x40')](handleError(_0x332e34,null));};exports[_0x46d7('0x22')]=function(_0x525dc2,_0x3629b5){return db[_0x46d7('0x3c')][_0x46d7('0x50')]({'where':{'id':_0x525dc2[_0x46d7('0x42')]['id']}})[_0x46d7('0x21')](handleEntityNotFound(_0x3629b5,null))[_0x46d7('0x21')](removeEntity(_0x3629b5,null))[_0x46d7('0x40')](handleError(_0x3629b5,null));};exports[_0x46d7('0x2a')]=function(_0x256399,_0xef6142){return db[_0x46d7('0x3c')]['describe']()[_0x46d7('0x21')](respondWithResult(_0xef6142,null))[_0x46d7('0x40')](handleError(_0xef6142,null));};exports['addContacts']=function(_0x5ee5c0,_0x52d8b0,_0x4df3b5){return db[_0x46d7('0x51')][_0x46d7('0x50')]({'where':{'id':_0x5ee5c0[_0x46d7('0x42')]['id']}})['then'](handleEntityNotFound(_0x52d8b0,null))['then'](function(_0x216014){if(_0x216014){return _0x216014[_0x46d7('0x52')](_0x5ee5c0[_0x46d7('0x4f')]['ids'],_['omit'](_0x5ee5c0[_0x46d7('0x4f')],['ids','id'])||{});}})[_0x46d7('0x21')](respondWithResult(_0x52d8b0,null))['catch'](handleError(_0x52d8b0,null));};exports[_0x46d7('0x53')]=function(_0x149b15,_0xe1fa3a,_0x35387c){var _0xedd504={};var _0x3897c4={};var _0x2a2bd9;var _0x3b3925;return db['CmCompany'][_0x46d7('0x54')]({'where':{'id':_0x149b15[_0x46d7('0x42')]['id']}})[_0x46d7('0x21')](handleEntityNotFound(_0xe1fa3a,null))[_0x46d7('0x21')](function(_0x28ff02){if(_0x28ff02){_0x2a2bd9=_0x28ff02;_0x3897c4[_0x46d7('0x2b')]=_['keys'](db[_0x46d7('0x51')][_0x46d7('0x43')]);_0x3897c4[_0x46d7('0x2c')]=_['keys'](_0x149b15['query']);_0x3897c4[_0x46d7('0x2e')]=_[_0x46d7('0x30')](_0x3897c4['model'],_0x3897c4['query']);_0xedd504[_0x46d7('0x2f')]=_[_0x46d7('0x30')](_0x3897c4[_0x46d7('0x2b')],qs[_0x46d7('0x31')](_0x149b15[_0x46d7('0x2c')][_0x46d7('0x31')]));_0xedd504[_0x46d7('0x2f')]=_0xedd504[_0x46d7('0x2f')][_0x46d7('0x32')]?_0xedd504[_0x46d7('0x2f')]:_0x3897c4[_0x46d7('0x2b')];_0xedd504['order']=qs[_0x46d7('0x36')](_0x149b15[_0x46d7('0x2c')][_0x46d7('0x36')]);_0xedd504[_0x46d7('0x37')]=qs[_0x46d7('0x2e')](_[_0x46d7('0x38')](_0x149b15[_0x46d7('0x2c')],_0x3897c4[_0x46d7('0x2e')]));if(_0x149b15[_0x46d7('0x2c')][_0x46d7('0x39')]){_0xedd504[_0x46d7('0x37')]=_[_0x46d7('0x3a')](_0xedd504[_0x46d7('0x37')],{'$or':_['map'](_0xedd504[_0x46d7('0x2f')],function(_0x44c934){var _0x2b0bc1={};_0x2b0bc1[_0x44c934]={'$like':'%'+_0x149b15[_0x46d7('0x2c')][_0x46d7('0x39')]+'%'};return _0x2b0bc1;})});}_0xedd504=_[_0x46d7('0x3a')]({},_0xedd504,_0x149b15['options']);return _0x2a2bd9['getContacts'](_0xedd504);}})[_0x46d7('0x21')](function(_0x2b544f){if(_0x2b544f){_0x3b3925=_0x2b544f[_0x46d7('0x32')];if(!_0x149b15[_0x46d7('0x2c')][_0x46d7('0x33')]('nolimit')){_0xedd504['limit']=qs[_0x46d7('0x1b')](_0x149b15['query'][_0x46d7('0x1b')]);_0xedd504[_0x46d7('0x19')]=qs[_0x46d7('0x19')](_0x149b15[_0x46d7('0x2c')][_0x46d7('0x19')]);}return _0x2a2bd9[_0x46d7('0x53')](_0xedd504);}})[_0x46d7('0x21')](function(_0x123fac){if(_0x123fac){return _0x123fac?{'count':_0x3b3925,'rows':_0x123fac}:null;}})['then'](respondWithResult(_0xe1fa3a,null))[_0x46d7('0x40')](handleError(_0xe1fa3a,null));}; \ No newline at end of file +var _0x2bd5=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','CmCompany','include','findAll','rows','catch','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','omit','ids','getContacts','findOne','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','model','keys','query','filters','intersection','attributes','fields','length'];(function(_0x3c69a7,_0x27315e){var _0x59cdce=function(_0x1b43b4){while(--_0x1b43b4){_0x3c69a7['push'](_0x3c69a7['shift']());}};_0x59cdce(++_0x27315e);}(_0x2bd5,0x12a));var _0x52bd=function(_0x467b5d,_0x22ca71){_0x467b5d=_0x467b5d-0x0;var _0x3a64da=_0x2bd5[_0x467b5d];return _0x3a64da;};'use strict';var emlformat=require(_0x52bd('0x0'));var rimraf=require(_0x52bd('0x1'));var zipdir=require(_0x52bd('0x2'));var jsonpatch=require(_0x52bd('0x3'));var rp=require(_0x52bd('0x4'));var moment=require('moment');var BPromise=require(_0x52bd('0x5'));var Mustache=require(_0x52bd('0x6'));var util=require(_0x52bd('0x7'));var path=require(_0x52bd('0x8'));var sox=require(_0x52bd('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x52bd('0xa'));var _=require(_0x52bd('0xb'));var squel=require(_0x52bd('0xc'));var crypto=require('crypto');var jsforce=require(_0x52bd('0xd'));var deskjs=require(_0x52bd('0xe'));var toCsv=require(_0x52bd('0xf'));var querystring=require(_0x52bd('0x10'));var Papa=require(_0x52bd('0x11'));var Redis=require(_0x52bd('0x12'));var authService=require(_0x52bd('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52bd('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x52bd('0x15'));var config=require(_0x52bd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x52bd('0x17'))['db'];function respondWithStatusCode(_0x19059,_0x46e027){_0x46e027=_0x46e027||0xcc;return function(_0x1b651e){if(_0x1b651e){return _0x19059[_0x52bd('0x18')](_0x46e027);}return _0x19059[_0x52bd('0x19')](_0x46e027)[_0x52bd('0x1a')]();};}function respondWithResult(_0x24f436,_0xdc8767){_0xdc8767=_0xdc8767||0xc8;return function(_0xaa8060){if(_0xaa8060){return _0x24f436[_0x52bd('0x19')](_0xdc8767)[_0x52bd('0x1b')](_0xaa8060);}};}function respondWithFilteredResult(_0x22d410,_0x416da7){return function(_0x51011a){if(_0x51011a){var _0x153fd4=typeof _0x416da7[_0x52bd('0x1c')]===_0x52bd('0x1d')&&typeof _0x416da7[_0x52bd('0x1e')]===_0x52bd('0x1d');var _0x3943e8=_0x51011a[_0x52bd('0x1f')];var _0xddf8ce=_0x153fd4?0x0:_0x416da7[_0x52bd('0x1c')];var _0x2e99bd=_0x153fd4?_0x51011a['count']:_0x416da7[_0x52bd('0x1c')]+_0x416da7[_0x52bd('0x1e')];var _0x2e3cb7;if(_0x2e99bd>=_0x3943e8){_0x2e99bd=_0x3943e8;_0x2e3cb7=0xc8;}else{_0x2e3cb7=0xce;}_0x22d410['status'](_0x2e3cb7);return _0x22d410[_0x52bd('0x20')](_0x52bd('0x21'),_0xddf8ce+'-'+_0x2e99bd+'/'+_0x3943e8)[_0x52bd('0x1b')](_0x51011a);}return null;};}function patchUpdates(_0x27c6b3){return function(_0x277ae9){try{jsonpatch['apply'](_0x277ae9,_0x27c6b3,!![]);}catch(_0x56d858){return BPromise[_0x52bd('0x22')](_0x56d858);}return _0x277ae9[_0x52bd('0x23')]();};}function saveUpdates(_0x127439,_0x5de3fe){return function(_0x53dbc5){if(_0x53dbc5){return _0x53dbc5[_0x52bd('0x24')](_0x127439)[_0x52bd('0x25')](function(_0x351a73){return _0x351a73;});}return null;};}function removeEntity(_0x37348b,_0x3e9b99){return function(_0x1bdadc){if(_0x1bdadc){return _0x1bdadc[_0x52bd('0x26')]()[_0x52bd('0x25')](function(){var _0x2a9e81=_0x1bdadc[_0x52bd('0x27')]({'plain':!![]});var _0x15de92=_0x52bd('0x28');return db[_0x52bd('0x29')][_0x52bd('0x26')]({'where':{'type':_0x15de92,'resourceId':_0x2a9e81['id']}})['then'](function(){return _0x1bdadc;});})[_0x52bd('0x25')](function(){_0x37348b[_0x52bd('0x19')](0xcc)[_0x52bd('0x1a')]();});}};}function handleEntityNotFound(_0x1251c9,_0x4bb21f){return function(_0x2d4abf){if(!_0x2d4abf){_0x1251c9['sendStatus'](0x194);}return _0x2d4abf;};}function handleError(_0x2fce16,_0x19f3f1){_0x19f3f1=_0x19f3f1||0x1f4;return function(_0x56f592){logger[_0x52bd('0x2a')](_0x56f592[_0x52bd('0x2b')]);if(_0x56f592['name']){delete _0x56f592[_0x52bd('0x2c')];}_0x2fce16[_0x52bd('0x19')](_0x19f3f1)[_0x52bd('0x2d')](_0x56f592);};}exports['index']=function(_0x4f9fa1,_0xe25617){var _0x34aeda={},_0x2f50b3={},_0x4b569a={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0x52bd('0x25')](function(_0x467c4f){_0x2f50b3[_0x52bd('0x2e')]=_[_0x52bd('0x2f')](_0x467c4f);_0x2f50b3[_0x52bd('0x30')]=_[_0x52bd('0x2f')](_0x4f9fa1[_0x52bd('0x30')]);_0x2f50b3[_0x52bd('0x31')]=_[_0x52bd('0x32')](_0x2f50b3[_0x52bd('0x2e')],_0x2f50b3[_0x52bd('0x30')]);_0x34aeda[_0x52bd('0x33')]=_[_0x52bd('0x32')](_0x2f50b3[_0x52bd('0x2e')],qs[_0x52bd('0x34')](_0x4f9fa1[_0x52bd('0x30')][_0x52bd('0x34')]));_0x34aeda[_0x52bd('0x33')]=_0x34aeda[_0x52bd('0x33')][_0x52bd('0x35')]?_0x34aeda[_0x52bd('0x33')]:_0x2f50b3[_0x52bd('0x2e')];if(!_0x4f9fa1['query'][_0x52bd('0x36')](_0x52bd('0x37'))){_0x34aeda['limit']=qs[_0x52bd('0x1e')](_0x4f9fa1['query'][_0x52bd('0x1e')]);_0x34aeda[_0x52bd('0x1c')]=qs['offset'](_0x4f9fa1[_0x52bd('0x30')]['offset']);}_0x34aeda[_0x52bd('0x38')]=qs[_0x52bd('0x39')](_0x4f9fa1['query'][_0x52bd('0x39')]);_0x34aeda[_0x52bd('0x3a')]=qs[_0x52bd('0x31')](_[_0x52bd('0x3b')](_0x4f9fa1[_0x52bd('0x30')],_0x2f50b3[_0x52bd('0x31')]),_0x467c4f);if(_0x4f9fa1[_0x52bd('0x30')][_0x52bd('0x3c')]){_0x34aeda[_0x52bd('0x3a')]=_[_0x52bd('0x3d')](_0x34aeda[_0x52bd('0x3a')],{'$or':_[_0x52bd('0x3e')](_0x34aeda[_0x52bd('0x33')],function(_0x5d200e){var _0x453144={};_0x453144[_0x5d200e]={'$like':'%'+_0x4f9fa1[_0x52bd('0x30')][_0x52bd('0x3c')]+'%'};return _0x453144;})});}_0x34aeda=_[_0x52bd('0x3d')]({},_0x34aeda,_0x4f9fa1['options']);var _0x509180={'where':_0x34aeda[_0x52bd('0x3a')]};return db[_0x52bd('0x3f')][_0x52bd('0x1f')](_0x509180)[_0x52bd('0x25')](function(_0x13e123){_0x4b569a[_0x52bd('0x1f')]=_0x13e123;if(_0x4f9fa1[_0x52bd('0x30')]['includeAll']){_0x34aeda[_0x52bd('0x40')]=[{'all':!![]}];}return db[_0x52bd('0x3f')][_0x52bd('0x41')](_0x34aeda);})[_0x52bd('0x25')](function(_0x40081f){_0x4b569a[_0x52bd('0x42')]=_0x40081f;return _0x4b569a;})[_0x52bd('0x25')](respondWithFilteredResult(_0xe25617,_0x34aeda))['catch'](handleError(_0xe25617,null));})[_0x52bd('0x43')](handleError(_0xe25617,null));};exports['show']=function(_0x8a228a,_0x53212a){var _0x48bc20={'raw':![],'where':{'id':_0x8a228a['params']['id']}},_0x1f1cd0={};_0x1f1cd0[_0x52bd('0x2e')]=_[_0x52bd('0x2f')](db[_0x52bd('0x3f')][_0x52bd('0x44')]);_0x1f1cd0[_0x52bd('0x30')]=_[_0x52bd('0x2f')](_0x8a228a[_0x52bd('0x30')]);_0x1f1cd0[_0x52bd('0x31')]=_['intersection'](_0x1f1cd0[_0x52bd('0x2e')],_0x1f1cd0[_0x52bd('0x30')]);_0x48bc20[_0x52bd('0x33')]=_[_0x52bd('0x32')](_0x1f1cd0[_0x52bd('0x2e')],qs[_0x52bd('0x34')](_0x8a228a[_0x52bd('0x30')][_0x52bd('0x34')]));_0x48bc20[_0x52bd('0x33')]=_0x48bc20['attributes']['length']?_0x48bc20[_0x52bd('0x33')]:_0x1f1cd0[_0x52bd('0x2e')];if(_0x8a228a['query'][_0x52bd('0x45')]){_0x48bc20[_0x52bd('0x40')]=[{'all':!![]}];}_0x48bc20=_[_0x52bd('0x3d')]({},_0x48bc20,_0x8a228a['options']);return db[_0x52bd('0x3f')][_0x52bd('0x46')](_0x48bc20)['then'](handleEntityNotFound(_0x53212a,null))['then'](respondWithResult(_0x53212a,null))['catch'](handleError(_0x53212a,null));};exports['create']=function(_0x45c9d2,_0x19d68e){return db[_0x52bd('0x3f')][_0x52bd('0x47')](_0x45c9d2[_0x52bd('0x48')],{})[_0x52bd('0x25')](function(_0x5eae3b){var _0xc1a4e2=_0x45c9d2[_0x52bd('0x49')][_0x52bd('0x27')]({'plain':!![]});if(!_0xc1a4e2)throw new Error(_0x52bd('0x4a'));if(_0xc1a4e2['role']===_0x52bd('0x49')){var _0x28c13f=_0x5eae3b['get']({'plain':!![]});var _0x388655='Companies';return db[_0x52bd('0x4b')][_0x52bd('0x46')]({'where':{'name':_0x388655,'userProfileId':_0xc1a4e2[_0x52bd('0x4c')]},'raw':!![]})[_0x52bd('0x25')](function(_0x5b6d74){if(_0x5b6d74&&_0x5b6d74[_0x52bd('0x4d')]===0x0){return db[_0x52bd('0x29')][_0x52bd('0x47')]({'name':_0x28c13f[_0x52bd('0x2c')],'resourceId':_0x28c13f['id'],'type':_0x5b6d74['name'],'sectionId':_0x5b6d74['id']},{})['then'](function(){return _0x5eae3b;});}else{return _0x5eae3b;}})[_0x52bd('0x43')](function(_0x1e5f62){logger[_0x52bd('0x2a')](_0x52bd('0x4e'),_0x1e5f62);throw _0x1e5f62;});}return _0x5eae3b;})['then'](respondWithResult(_0x19d68e,0xc9))[_0x52bd('0x43')](handleError(_0x19d68e,null));};exports[_0x52bd('0x24')]=function(_0x7757e4,_0x323b54){if(_0x7757e4['body']['id']){delete _0x7757e4['body']['id'];}return db[_0x52bd('0x3f')][_0x52bd('0x46')]({'where':{'id':_0x7757e4[_0x52bd('0x4f')]['id']}})[_0x52bd('0x25')](handleEntityNotFound(_0x323b54,null))[_0x52bd('0x25')](saveUpdates(_0x7757e4[_0x52bd('0x48')],null))[_0x52bd('0x25')](respondWithResult(_0x323b54,null))[_0x52bd('0x43')](handleError(_0x323b54,null));};exports[_0x52bd('0x26')]=function(_0x2484cf,_0x3a27a5){return db[_0x52bd('0x3f')][_0x52bd('0x46')]({'where':{'id':_0x2484cf[_0x52bd('0x4f')]['id']}})[_0x52bd('0x25')](handleEntityNotFound(_0x3a27a5,null))[_0x52bd('0x25')](removeEntity(_0x3a27a5,null))[_0x52bd('0x43')](handleError(_0x3a27a5,null));};exports[_0x52bd('0x50')]=function(_0x4d0c01,_0x32ed70){return db[_0x52bd('0x3f')][_0x52bd('0x50')]()[_0x52bd('0x25')](respondWithResult(_0x32ed70,null))[_0x52bd('0x43')](handleError(_0x32ed70,null));};exports[_0x52bd('0x51')]=function(_0x500c4c,_0x19622b,_0x320bb3){return db[_0x52bd('0x52')]['find']({'where':{'id':_0x500c4c[_0x52bd('0x4f')]['id']}})[_0x52bd('0x25')](handleEntityNotFound(_0x19622b,null))[_0x52bd('0x25')](function(_0x51ac9e){if(_0x51ac9e){return _0x51ac9e[_0x52bd('0x51')](_0x500c4c[_0x52bd('0x48')]['ids'],_[_0x52bd('0x53')](_0x500c4c[_0x52bd('0x48')],[_0x52bd('0x54'),'id'])||{});}})[_0x52bd('0x25')](respondWithResult(_0x19622b,null))[_0x52bd('0x43')](handleError(_0x19622b,null));};exports[_0x52bd('0x55')]=function(_0x1ebbe3,_0x4f7e21,_0x7886f4){var _0x57bf9d={};var _0x281c1b={};var _0x1d8085;var _0x116b8d;return db[_0x52bd('0x3f')][_0x52bd('0x56')]({'where':{'id':_0x1ebbe3[_0x52bd('0x4f')]['id']}})[_0x52bd('0x25')](handleEntityNotFound(_0x4f7e21,null))[_0x52bd('0x25')](function(_0x551bdb){if(_0x551bdb){_0x1d8085=_0x551bdb;_0x281c1b[_0x52bd('0x2e')]=_['keys'](db[_0x52bd('0x52')][_0x52bd('0x44')]);_0x281c1b[_0x52bd('0x30')]=_['keys'](_0x1ebbe3[_0x52bd('0x30')]);_0x281c1b['filters']=_[_0x52bd('0x32')](_0x281c1b[_0x52bd('0x2e')],_0x281c1b[_0x52bd('0x30')]);_0x57bf9d[_0x52bd('0x33')]=_[_0x52bd('0x32')](_0x281c1b[_0x52bd('0x2e')],qs[_0x52bd('0x34')](_0x1ebbe3[_0x52bd('0x30')]['fields']));_0x57bf9d[_0x52bd('0x33')]=_0x57bf9d[_0x52bd('0x33')][_0x52bd('0x35')]?_0x57bf9d[_0x52bd('0x33')]:_0x281c1b[_0x52bd('0x2e')];_0x57bf9d[_0x52bd('0x38')]=qs[_0x52bd('0x39')](_0x1ebbe3['query']['sort']);_0x57bf9d[_0x52bd('0x3a')]=qs['filters'](_[_0x52bd('0x3b')](_0x1ebbe3[_0x52bd('0x30')],_0x281c1b['filters']));if(_0x1ebbe3[_0x52bd('0x30')]['filter']){_0x57bf9d['where']=_[_0x52bd('0x3d')](_0x57bf9d['where'],{'$or':_[_0x52bd('0x3e')](_0x57bf9d[_0x52bd('0x33')],function(_0x44bf53){var _0x219a48={};_0x219a48[_0x44bf53]={'$like':'%'+_0x1ebbe3[_0x52bd('0x30')]['filter']+'%'};return _0x219a48;})});}_0x57bf9d=_[_0x52bd('0x3d')]({},_0x57bf9d,_0x1ebbe3[_0x52bd('0x57')]);return _0x1d8085[_0x52bd('0x55')](_0x57bf9d);}})[_0x52bd('0x25')](function(_0x1e56ab){if(_0x1e56ab){_0x116b8d=_0x1e56ab[_0x52bd('0x35')];if(!_0x1ebbe3[_0x52bd('0x30')][_0x52bd('0x36')](_0x52bd('0x37'))){_0x57bf9d[_0x52bd('0x1e')]=qs['limit'](_0x1ebbe3['query'][_0x52bd('0x1e')]);_0x57bf9d[_0x52bd('0x1c')]=qs[_0x52bd('0x1c')](_0x1ebbe3['query'][_0x52bd('0x1c')]);}return _0x1d8085['getContacts'](_0x57bf9d);}})[_0x52bd('0x25')](function(_0x1b8c48){if(_0x1b8c48){return _0x1b8c48?{'count':_0x116b8d,'rows':_0x1b8c48}:null;}})[_0x52bd('0x25')](respondWithResult(_0x4f7e21,null))['catch'](handleError(_0x4f7e21,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 8b1dbbe..ba0d71e 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 _0xdec2=['api','bluebird','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdec2,0x13d));var _0x2dec=function(_0x2ba92d,_0x4198e8){_0x2ba92d=_0x2ba92d-0x0;var _0x2eb1ce=_0xdec2[_0x2ba92d];return _0x2eb1ce;};'use strict';var _=require(_0x2dec('0x0'));var util=require('util');var logger=require(_0x2dec('0x1'))(_0x2dec('0x2'));var moment=require('moment');var BPromise=require(_0x2dec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2dec('0x4'));var rimraf=require(_0x2dec('0x5'));var config=require('../../config/environment');var attributes=require(_0x2dec('0x6'));module[_0x2dec('0x7')]=function(_0x2a7861,_0x2e75b4){return _0x2a7861[_0x2dec('0x8')](_0x2dec('0x9'),attributes,{'tableName':_0x2dec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1003=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','util','../../config/logger','api','moment','path','rimraf'];(function(_0x29bf14,_0x550019){var _0x154075=function(_0x15f84b){while(--_0x15f84b){_0x29bf14['push'](_0x29bf14['shift']());}};_0x154075(++_0x550019);}(_0x1003,0x89));var _0x3100=function(_0x179cb8,_0x1935d3){_0x179cb8=_0x179cb8-0x0;var _0x3af90f=_0x1003[_0x179cb8];return _0x3af90f;};'use strict';var _=require('lodash');var util=require(_0x3100('0x0'));var logger=require(_0x3100('0x1'))(_0x3100('0x2'));var moment=require(_0x3100('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3100('0x4'));var rimraf=require(_0x3100('0x5'));var config=require(_0x3100('0x6'));var attributes=require(_0x3100('0x7'));module[_0x3100('0x8')]=function(_0x2b55c2,_0x189b28){return _0x2b55c2[_0x3100('0x9')](_0x3100('0xa'),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 391834f..1c20e51 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 _0x9c1a=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x448bab,_0x25517b){var _0x5dc534=function(_0x2196ba){while(--_0x2196ba){_0x448bab['push'](_0x448bab['shift']());}};_0x5dc534(++_0x25517b);}(_0x9c1a,0xe2));var _0xa9c1=function(_0x5b5b5f,_0x1d88f8){_0x5b5b5f=_0x5b5b5f-0x0;var _0x380741=_0x9c1a[_0x5b5b5f];return _0x380741;};'use strict';var _=require(_0xa9c1('0x0'));var util=require('util');var moment=require(_0xa9c1('0x1'));var BPromise=require(_0xa9c1('0x2'));var rs=require(_0xa9c1('0x3'));var fs=require('fs');var Redis=require(_0xa9c1('0x4'));var db=require(_0xa9c1('0x5'))['db'];var utils=require(_0xa9c1('0x6'));var logger=require('../../config/logger')(_0xa9c1('0x7'));var config=require(_0xa9c1('0x8'));var jayson=require(_0xa9c1('0x9'));var client=jayson[_0xa9c1('0xa')][_0xa9c1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10e8f5,_0x3454a6,_0x51bc44){return new BPromise(function(_0x21d758,_0x59112b){return client[_0xa9c1('0xc')](_0x10e8f5,_0x51bc44)[_0xa9c1('0xd')](function(_0x150548){logger[_0xa9c1('0xe')]('CmCompany,\x20%s,\x20%s',_0x3454a6,_0xa9c1('0xf'));logger['debug'](_0xa9c1('0x10'),_0x3454a6,_0xa9c1('0xf'),JSON[_0xa9c1('0x11')](_0x150548));if(_0x150548[_0xa9c1('0x12')]){if(_0x150548[_0xa9c1('0x12')]['code']===0x1f4){logger[_0xa9c1('0x12')](_0xa9c1('0x13'),_0x3454a6,_0x150548[_0xa9c1('0x12')][_0xa9c1('0x14')]);return _0x59112b(_0x150548[_0xa9c1('0x12')][_0xa9c1('0x14')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x3454a6,_0x150548[_0xa9c1('0x12')][_0xa9c1('0x14')]);return _0x21d758(_0x150548[_0xa9c1('0x12')]['message']);}else{logger['info'](_0xa9c1('0x13'),_0x3454a6,_0xa9c1('0xf'));_0x21d758(_0x150548[_0xa9c1('0x15')]['message']);}})[_0xa9c1('0x16')](function(_0x22f2f5){logger[_0xa9c1('0x12')](_0xa9c1('0x13'),_0x3454a6,_0x22f2f5);_0x59112b(_0x22f2f5);});});} \ No newline at end of file +var _0x2b1f=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x1f50c0,_0x5ecb83){var _0x1d9f9c=function(_0x311f9e){while(--_0x311f9e){_0x1f50c0['push'](_0x1f50c0['shift']());}};_0x1d9f9c(++_0x5ecb83);}(_0x2b1f,0x6c));var _0xf2b1=function(_0x37c4e4,_0x41982f){_0x37c4e4=_0x37c4e4-0x0;var _0x3e319e=_0x2b1f[_0x37c4e4];return _0x3e319e;};'use strict';var _=require(_0xf2b1('0x0'));var util=require(_0xf2b1('0x1'));var moment=require(_0xf2b1('0x2'));var BPromise=require(_0xf2b1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2b1('0x4'));var db=require(_0xf2b1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf2b1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf2b1('0x7'));var client=jayson[_0xf2b1('0x8')][_0xf2b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34722d,_0x54ccaa,_0x5a142f){return new BPromise(function(_0x32e207,_0x1e2a7b){return client['request'](_0x34722d,_0x5a142f)['then'](function(_0x781fcb){logger['info'](_0xf2b1('0xa'),_0x54ccaa,_0xf2b1('0xb'));logger[_0xf2b1('0xc')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x54ccaa,_0xf2b1('0xb'),JSON[_0xf2b1('0xd')](_0x781fcb));if(_0x781fcb[_0xf2b1('0xe')]){if(_0x781fcb['error'][_0xf2b1('0xf')]===0x1f4){logger[_0xf2b1('0xe')](_0xf2b1('0xa'),_0x54ccaa,_0x781fcb[_0xf2b1('0xe')][_0xf2b1('0x10')]);return _0x1e2a7b(_0x781fcb['error'][_0xf2b1('0x10')]);}logger[_0xf2b1('0xe')]('CmCompany,\x20%s,\x20%s',_0x54ccaa,_0x781fcb[_0xf2b1('0xe')]['message']);return _0x32e207(_0x781fcb[_0xf2b1('0xe')][_0xf2b1('0x10')]);}else{logger[_0xf2b1('0x11')](_0xf2b1('0xa'),_0x54ccaa,_0xf2b1('0xb'));_0x32e207(_0x781fcb['result'][_0xf2b1('0x10')]);}})['catch'](function(_0x3318c0){logger[_0xf2b1('0xe')](_0xf2b1('0xa'),_0x54ccaa,_0x3318c0);_0x1e2a7b(_0x3318c0);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 49d41bc..44c245d 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 _0x4649=['isAuthenticated','index','/describe','describe','/:id','show','getContacts','post','create','addContacts','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get'];(function(_0x3f496f,_0x58a7c5){var _0x4254bc=function(_0x1823be){while(--_0x1823be){_0x3f496f['push'](_0x3f496f['shift']());}};_0x4254bc(++_0x58a7c5);}(_0x4649,0x18e));var _0x9464=function(_0x516aad,_0x56935e){_0x516aad=_0x516aad-0x0;var _0x1ac661=_0x4649[_0x516aad];return _0x1ac661;};'use strict';var multer=require(_0x9464('0x0'));var util=require(_0x9464('0x1'));var path=require(_0x9464('0x2'));var timeout=require(_0x9464('0x3'));var express=require(_0x9464('0x4'));var router=express[_0x9464('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9464('0x6'));var interaction=require(_0x9464('0x7'));var config=require('../../config/environment');var controller=require(_0x9464('0x8'));router[_0x9464('0x9')]('/',auth[_0x9464('0xa')](),controller[_0x9464('0xb')]);router['get'](_0x9464('0xc'),auth[_0x9464('0xa')](),controller[_0x9464('0xd')]);router['get'](_0x9464('0xe'),auth[_0x9464('0xa')](),controller[_0x9464('0xf')]);router[_0x9464('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x9464('0x10')]);router[_0x9464('0x11')]('/',auth[_0x9464('0xa')](),controller[_0x9464('0x12')]);router[_0x9464('0x11')]('/:id/contacts',auth[_0x9464('0xa')](),controller[_0x9464('0x13')]);router[_0x9464('0x14')](_0x9464('0xe'),auth[_0x9464('0xa')](),controller[_0x9464('0x15')]);router[_0x9464('0x16')]('/:id',auth[_0x9464('0xa')](),controller[_0x9464('0x17')]);module['exports']=router; \ No newline at end of file +var _0x6d48=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','isAuthenticated','get','/describe','/:id','show','getContacts','create','addContacts','put','update','delete','multer'];(function(_0x25a1ac,_0x113c18){var _0x13ea3a=function(_0x91718d){while(--_0x91718d){_0x25a1ac['push'](_0x25a1ac['shift']());}};_0x13ea3a(++_0x113c18);}(_0x6d48,0x9f));var _0x86d4=function(_0xec1043,_0x2a0be1){_0xec1043=_0xec1043-0x0;var _0x2bbb3e=_0x6d48[_0xec1043];return _0x2bbb3e;};'use strict';var multer=require(_0x86d4('0x0'));var util=require(_0x86d4('0x1'));var path=require(_0x86d4('0x2'));var timeout=require(_0x86d4('0x3'));var express=require('express');var router=express[_0x86d4('0x4')]();var fs_extra=require(_0x86d4('0x5'));var auth=require(_0x86d4('0x6'));var interaction=require(_0x86d4('0x7'));var config=require('../../config/environment');var controller=require(_0x86d4('0x8'));router['get']('/',auth[_0x86d4('0x9')](),controller['index']);router[_0x86d4('0xa')](_0x86d4('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x86d4('0xa')](_0x86d4('0xc'),auth[_0x86d4('0x9')](),controller[_0x86d4('0xd')]);router[_0x86d4('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x86d4('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x86d4('0xf')]);router['post']('/:id/contacts',auth['isAuthenticated'](),controller[_0x86d4('0x10')]);router[_0x86d4('0x11')](_0x86d4('0xc'),auth['isAuthenticated'](),controller[_0x86d4('0x12')]);router[_0x86d4('0x13')](_0x86d4('0xc'),auth[_0x86d4('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index ff6048c..c1c52c0 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 _0x4209=['TEXT','INTEGER','UNSIGNED','DATE','lodash','sequelize','STRING'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x4209,0x11c));var _0x9420=function(_0x3d8ba1,_0x5ba1fd){_0x3d8ba1=_0x3d8ba1-0x0;var _0x87804e=_0x4209[_0x3d8ba1];return _0x87804e;};'use strict';var _=require(_0x9420('0x0'));var Sequelize=require(_0x9420('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x9420('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x9420('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9420('0x2')]},'city':{'type':Sequelize[_0x9420('0x2')]},'country':{'type':Sequelize[_0x9420('0x2')]},'dateOfBirth':{'type':Sequelize[_0x9420('0x2')]},'description':{'type':Sequelize[_0x9420('0x3')]},'phone':{'type':Sequelize[_0x9420('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x9420('0x2')]},'email':{'type':Sequelize[_0x9420('0x2')]},'url':{'type':Sequelize[_0x9420('0x2')]},'facebook':{'type':Sequelize[_0x9420('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x9420('0x2')]},'skype':{'type':Sequelize[_0x9420('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x9420('0x2')]},'line':{'type':Sequelize[_0x9420('0x2')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x9420('0x2')]},'UserId':{'type':Sequelize[_0x9420('0x4')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9420('0x4')](0x2)[_0x9420('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9420('0x6')],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x5785=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x12d03a,_0x25aae0){var _0x2c61a9=function(_0x3b990a){while(--_0x3b990a){_0x12d03a['push'](_0x12d03a['shift']());}};_0x2c61a9(++_0x25aae0);}(_0x5785,0x119));var _0x5578=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x5785[_0x39e84d];return _0x1991bc;};'use strict';var _=require(_0x5578('0x0'));var Sequelize=require(_0x5578('0x1'));module[_0x5578('0x2')]={'firstName':{'type':Sequelize[_0x5578('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x5578('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x5578('0x3')]},'city':{'type':Sequelize[_0x5578('0x3')]},'country':{'type':Sequelize[_0x5578('0x3')]},'dateOfBirth':{'type':Sequelize[_0x5578('0x3')]},'description':{'type':Sequelize[_0x5578('0x4')]},'phone':{'type':Sequelize[_0x5578('0x3')]},'mobile':{'type':Sequelize[_0x5578('0x3')]},'fax':{'type':Sequelize[_0x5578('0x3')]},'email':{'type':Sequelize[_0x5578('0x3')]},'url':{'type':Sequelize[_0x5578('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x5578('0x3')]},'twitter':{'type':Sequelize[_0x5578('0x3')]},'skype':{'type':Sequelize[_0x5578('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x5578('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x5578('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x5578('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x5578('0x3')]},'priority':{'type':Sequelize[_0x5578('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x5578('0x6')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 18a6690..00b7f3b 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 _0x7072=['fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','error','stack','name','index','describe','keys','length','cf_','push','fieldType','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','field','color','from','tools_tags','select','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','ct.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','and','uc.UserId\x20=\x20?','value','castTo','DATE','buildExpression','type','start','filter','Contact','isEmpty','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','group','c.id','Sequelize','clone','DESC','having','resolve','user','role','agent','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','CmContact','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.email','c.ListId','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','tags','startsWith','columnName','displayName','alias','values','body','get','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','destroy','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','bulkCreate','each','duplicates','$or','findOrCreate','additionalPhones','contact','all','Tag','CmContactHasItem','Phones','ContactItemType','literal','`Phones.ItemType`.OrderBy','log','$and','CmCustomField','findAll','format','cf_%d','omit','table','cm_contacts','setFields','id\x20=\x20?','text','phone','getTags','findOne','rawAttributes','pick','merge','options','setTags','items','item_types','isNil','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','OrderBy','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','ContactId','include','getHopperFinals','includeAll','uploadCsv','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','0777','child_process','fork','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','path','parse','meta','import','No\x20ListId\x20specified','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','-createdAt','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','duration','note','createdAt','findAndCountAll','closed','closedAt','disposition','secondDisposition','thirdDisposition','Account','key','fullname','browserName','customerIp','customerPort','osName','ratingType','ratingValue','referer','externalUrl','threadId','startCase','Owner','flatten','sortBy','reverse','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7072,0x138));var _0x2707=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x7072[_0x397cfb];return _0x15fed9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2707('0x0'));var zipdir=require(_0x2707('0x1'));var jsonpatch=require(_0x2707('0x2'));var rp=require(_0x2707('0x3'));var moment=require(_0x2707('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2707('0x5'));var path=require('path');var sox=require(_0x2707('0x6'));var csv=require(_0x2707('0x7'));var ejs=require(_0x2707('0x8'));var fs=require('fs');var fs_extra=require(_0x2707('0x9'));var _=require(_0x2707('0xa'));var squel=require(_0x2707('0xb'));var crypto=require(_0x2707('0xc'));var jsforce=require(_0x2707('0xd'));var deskjs=require(_0x2707('0xe'));var toCsv=require(_0x2707('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2707('0xf'));var authService=require(_0x2707('0x10'));var qs=require(_0x2707('0x11'));var as=require(_0x2707('0x12'));var hardwareService=require(_0x2707('0x13'));var logger=require(_0x2707('0x14'))(_0x2707('0x15'));var utils=require(_0x2707('0x16'));var config=require(_0x2707('0x17'));var licenseUtil=require(_0x2707('0x18'));var db=require(_0x2707('0x19'))['db'];config[_0x2707('0x1a')]=_[_0x2707('0x1b')](config['redis'],{'host':_0x2707('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2707('0x1a')]));require(_0x2707('0x1d'))[_0x2707('0x1e')](socket);function respondWithStatusCode(_0x3a67f2,_0x13d9ac){_0x13d9ac=_0x13d9ac||0xcc;return function(_0x4e52a3){if(_0x4e52a3){return _0x3a67f2[_0x2707('0x1f')](_0x13d9ac);}return _0x3a67f2[_0x2707('0x20')](_0x13d9ac)[_0x2707('0x21')]();};}function respondWithResult(_0x5d523f,_0x1153d7){_0x1153d7=_0x1153d7||0xc8;return function(_0x42f374){if(_0x42f374){return _0x5d523f[_0x2707('0x20')](_0x1153d7)[_0x2707('0x22')](_0x42f374);}};}function respondWithFilteredResult(_0x7ed037,_0x27a3ea){return function(_0x4a8b7f){if(_0x4a8b7f){var _0x119ac4=typeof _0x27a3ea[_0x2707('0x23')]===_0x2707('0x24')&&typeof _0x27a3ea['limit']==='undefined';var _0x58a4ee=_0x4a8b7f[_0x2707('0x25')];var _0xc7aaa6=_0x119ac4?0x0:_0x27a3ea[_0x2707('0x23')];var _0x3c4571=_0x119ac4?_0x4a8b7f[_0x2707('0x25')]:_0x27a3ea[_0x2707('0x23')]+_0x27a3ea[_0x2707('0x26')];var _0x65b6e5;if(_0x3c4571>=_0x58a4ee){_0x3c4571=_0x58a4ee;_0x65b6e5=0xc8;}else{_0x65b6e5=0xce;}_0x7ed037[_0x2707('0x20')](_0x65b6e5);return _0x7ed037[_0x2707('0x27')](_0x2707('0x28'),_0xc7aaa6+'-'+_0x3c4571+'/'+_0x58a4ee)[_0x2707('0x22')](_0x4a8b7f);}return null;};}function patchUpdates(_0x454fde){return function(_0x1c0ffe){try{jsonpatch['apply'](_0x1c0ffe,_0x454fde,!![]);}catch(_0x1acf22){return BPromise[_0x2707('0x29')](_0x1acf22);}return _0x1c0ffe[_0x2707('0x2a')]();};}function saveUpdates(_0x369e3a,_0x378ca4){return function(_0x3f6e8b){if(_0x3f6e8b){return _0x3f6e8b['update'](_0x369e3a)[_0x2707('0x2b')](function(_0x3f6976){return _0x3f6976;});}return null;};}function removeEntity(_0x171add,_0x2ad386){return function(_0x5b763f){if(_0x5b763f){return _0x5b763f['destroy']()[_0x2707('0x2b')](function(){_0x171add['status'](0xcc)[_0x2707('0x21')]();});}};}function handleEntityNotFound(_0x34dc4e,_0x2aa3fe){return function(_0x57da26){if(!_0x57da26){_0x34dc4e[_0x2707('0x1f')](0x194);}return _0x57da26;};}function handleError(_0x14daf8,_0x2c7047){_0x2c7047=_0x2c7047||0x1f4;return function(_0x529be8){logger[_0x2707('0x2c')](_0x529be8[_0x2707('0x2d')]);if(_0x529be8['name']){delete _0x529be8[_0x2707('0x2e')];}_0x14daf8['status'](_0x2c7047)['send'](_0x529be8);};}exports[_0x2707('0x2f')]=function(_0x4e0c93,_0x2a0d24){var _0x3f153d={},_0x417a97={},_0x36b2e9={'count':0x0,'rows':[]};return db['CmContact'][_0x2707('0x30')]()[_0x2707('0x2b')](function(_0x2c7ecb){var _0x154799=[];for(var _0x12ec96=0x0;_0x12ec960x1){_0x434fdd['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2707('0x69')](_0x5d0708),null);}else{if(qs[_0x2707('0x6a')](_0x5d0708)){_0x434fdd['or'](_0x2707('0x6b'),_0x5d0708+'%');_0x434fdd['or'](_0x2707('0x6c'),_0x5d0708+'%');_0x434fdd['or'](_0x2707('0x6d'),_0x5d0708+'%');_0x434fdd['or'](_0x2707('0x6e'),_0x5d0708+'%');}else if(qs[_0x2707('0x6f')](_0x5d0708)){_0x434fdd['or'](_0x2707('0x70'),_0x5d0708+'%');}else{_0x434fdd['or'](_0x2707('0x71'),'%'+_0x5d0708+'%');_0x434fdd['or']('c.lastName\x20LIKE\x20?','%'+_0x5d0708+'%');_0x434fdd['or'](_0x2707('0x70'),'%'+_0x5d0708+'%');}}}}_0x5d5ac9[_0x2707('0x3f')](_0x434fdd);_0x5d5ac9[_0x2707('0x72')](_0x2707('0x73'));var _0x1ab8ed={'type':db[_0x2707('0x74')]['QueryTypes']['SELECT'],'raw':!![]};var _0x1070f6=_0x5d5ac9[_0x2707('0x75')]()['field']('c.id');if(_0x3f153d['order']){_0x3f153d['order'][_0x2707('0x54')](function(_0x3ba510){_0x5d5ac9['order']('c.'+_0x3ba510[0x0],_0x3ba510[0x1]===_0x2707('0x76')?![]:!![]);});}if(!_[_0x2707('0x61')](_0x6947fa)){_0x5d5ac9[_0x2707('0x77')](_0x4b110e);_0x1070f6['where']('t.id\x20IN\x20?',_0x6947fa);}BPromise[_0x2707('0x78')]()[_0x2707('0x2b')](function(){if(!_0x420604)return;if(_0x4e0c93[_0x2707('0x79')][_0x2707('0x7a')]!==_0x2707('0x7b'))return;if(!_[_0x2707('0x7c')](_0x420604[_0x2707('0x50')],['field',_0x2707('0x56')])){return _0x4e0c93[_0x2707('0x79')][_0x2707('0x7d')]({'attributes':['id'],'raw':!![]})[_0x2707('0x2b')](function(_0xb63b72){if(_[_0x2707('0x61')](_0xb63b72)){_0x1070f6['where'](_0x2707('0x7e'));_0x5d5ac9[_0x2707('0x3f')](_0x2707('0x7e'));}else{_0x1070f6[_0x2707('0x3f')](_0x2707('0x7f'),_[_0x2707('0x53')](_0xb63b72,'id'));_0x5d5ac9['where']('c.ListId\x20IN\x20?',_[_0x2707('0x53')](_0xb63b72,'id'));}});}})[_0x2707('0x2b')](function(){if(_0x4e0c93[_0x2707('0x79')][_0x2707('0x7a')]===_0x2707('0x7b')&&!_0x420604&&!_0x4e0c93[_0x2707('0x37')]['ListId'])return[];return db['sequelize'][_0x2707('0x37')](_0x1070f6['toString'](),_0x1ab8ed);})[_0x2707('0x2b')](function(_0x518568){_0x36b2e9[_0x2707('0x25')]=_0x518568[_0x2707('0x32')];if(_0x36b2e9[_0x2707('0x25')]===0x0)return[];return db[_0x2707('0x80')]['query'](_0x358aa8[_0x2707('0x81')](),_0x1ab8ed)['then'](function(_0x7327da){_0x5053ba=_[_0x2707('0x82')](_0x7327da,'id');_0x1ab8ed=_['merge'](_0x1ab8ed,{'model':db[_0x2707('0x83')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4e0c93[_0x2707('0x37')][_0x2707('0x3a')]){_0x3f153d[_0x2707('0x39')][_0x2707('0x54')](function(_0x5b9a61){_0x5d5ac9[_0x2707('0x41')]('c.'+_0x5b9a61);});}else{_0x5d5ac9[_0x2707('0x41')](_0x2707('0x73'));_0x5d5ac9[_0x2707('0x41')](_0x2707('0x84'));_0x5d5ac9[_0x2707('0x41')](_0x2707('0x85'));_0x5d5ac9[_0x2707('0x41')](_0x2707('0x86'));_0x5d5ac9[_0x2707('0x41')](_0x2707('0x87'));_0x5d5ac9[_0x2707('0x41')](_0x2707('0x88'));_0x5d5ac9[_0x2707('0x41')](_0x2707('0x89'));_0x5d5ac9[_0x2707('0x41')](_0x2707('0x8a'));_0x5d5ac9[_0x2707('0x41')]('c.createdAt');_0x5d5ac9[_0x2707('0x41')]('c.deletedAt');_0x5d5ac9['field'](_0x2707('0x8b'));_0x5d5ac9[_0x2707('0x41')](_0x2707('0x8c'),_0x2707('0x8d'));}if(_0x3f153d[_0x2707('0x26')])_0x5d5ac9[_0x2707('0x26')](_0x3f153d['limit']);if(_0x3f153d[_0x2707('0x23')])_0x5d5ac9[_0x2707('0x23')](_0x3f153d[_0x2707('0x23')]);return db['sequelize'][_0x2707('0x37')](_0x5d5ac9[_0x2707('0x81')](),_0x1ab8ed);});})[_0x2707('0x2b')](function(_0x381382){_0x381382['forEach'](function(_0xc091da){if(_0xc091da['TagIds']){_0xc091da[_0x2707('0x8e')]=[];_0xc091da[_0x2707('0x8d')][_0x2707('0x52')](',')[_0x2707('0x54')](function(_0x3e673b){_0xc091da[_0x2707('0x8e')][_0x2707('0x34')](_0x5053ba[_0x3e673b]);});}delete _0xc091da[_0x2707('0x8d')];});_0x36b2e9[_0x2707('0x8f')]=_0x381382;return _0x36b2e9;})['then'](respondWithFilteredResult(_0x2a0d24,_0x3f153d));})[_0x2707('0x90')](handleError(_0x2a0d24,null));};exports['destroy']=function(_0x2dfe37,_0x411748){return db[_0x2707('0x83')][_0x2707('0x51')]({'where':{'id':_0x2dfe37[_0x2707('0x91')]['id']}})[_0x2707('0x2b')](handleEntityNotFound(_0x411748,null))['then'](removeEntity(_0x411748,null))['catch'](handleError(_0x411748,null));};exports[_0x2707('0x30')]=function(_0x5c0573,_0x33fbfb){return db[_0x2707('0x83')][_0x2707('0x30')]()[_0x2707('0x2b')](function(_0x511b17){delete _0x511b17[_0x2707('0x92')];for(var _0x18dbac=0x0;_0x18dbac0x0){return new Promise(function(_0x1ec8b4,_0x55a8a3){var _0x40f30c=[];for(var _0x381a02=0x0;_0x381a02<_0x53d4a0[_0x2707('0x32')];_0x381a02++){_0x40f30c[_0x2707('0x34')](insertAdditionalPhones(_0x53d4a0[_0x381a02][_0x2707('0xbb')],_0x53d4a0[_0x381a02][_0x2707('0xba')]));}Promise[_0x2707('0xbc')](_0x40f30c)[_0x2707('0x2b')](function(){_0x1ec8b4(0x1);});})['then'](function(){return{'success':_0x232ecd,'failure':_0x40f1b6,'duplicates':_0x212b1a};});}else{return{'success':_0x232ecd,'failure':_0x40f1b6,'duplicates':_0x212b1a};}}})[_0x2707('0x2b')](respondWithResult(_0x2ff755,0xc9))[_0x2707('0x90')](handleError(_0x2ff755,null));};exports['show']=function(_0x53591b,_0x5c2f01,_0x4d44e0){var _0x3e4a4e;return db[_0x2707('0x83')]['describe']()[_0x2707('0x2b')](function(_0x372535){return db[_0x2707('0x83')][_0x2707('0x51')]({'where':{'id':_0x53591b[_0x2707('0x91')]['id']},'include':[{'model':db[_0x2707('0xbd')],'as':_0x2707('0x8e'),'attributes':['id','name','color'],'required':_0x53591b['query'][_0x2707('0x66')]?!![]:![]},{'model':db[_0x2707('0xbe')],'as':_0x2707('0xbf'),'where':{'CmContactId':_0x53591b[_0x2707('0x91')]['id']},'required':![],'include':[{'model':db[_0x2707('0xc0')],'as':'ItemType'}]}],'order':[db['sequelize'][_0x2707('0xc1')](_0x2707('0xc2'))],'logging':console[_0x2707('0xc3')],'attributes':_[_0x2707('0x31')](_0x372535)});})[_0x2707('0x2b')](function(_0x93b6f1){_0x3e4a4e=_0x93b6f1['get']({'plain':!![]});var _0x16897d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x93b6f1&&_0x93b6f1['ListId']){if(_0x93b6f1[_0x2707('0x62')]){_0x16897d[_0x2707('0x3f')][_0x2707('0xc4')][_0x2707('0x34')]({'ListId':{'$ne':_0x93b6f1[_0x2707('0x62')]}});}}return db[_0x2707('0xc5')][_0x2707('0xc6')](_0x16897d);})[_0x2707('0x2b')](function(_0x3e83a7){return _['omit'](_0x3e4a4e,_[_0x2707('0x53')](_0x3e83a7,function(_0x59d50e){return util[_0x2707('0xc7')](_0x2707('0xc8'),_0x59d50e['id']);}));})[_0x2707('0x2b')](handleEntityNotFound(_0x5c2f01,null))[_0x2707('0x2b')](respondWithResult(_0x5c2f01,null))['catch'](handleError(_0x5c2f01,null));};exports[_0x2707('0xa1')]=function(_0x285f02,_0x53be66){var _0x47ab06;if(_0x285f02[_0x2707('0x98')]['id']){delete _0x285f02[_0x2707('0x98')]['id'];}return db[_0x2707('0x83')]['find']({'where':{'id':_0x285f02[_0x2707('0x91')]['id']}})['then'](handleEntityNotFound(_0x53be66,null))[_0x2707('0x2b')](saveUpdates(_0x285f02[_0x2707('0x98')],null))[_0x2707('0x2b')](function(_0x1f3a3d){_0x47ab06=_0x1f3a3d;var _0x33f54c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1f3a3d&&_0x1f3a3d['ListId']){if(_0x1f3a3d['ListId']){_0x33f54c[_0x2707('0x3f')][_0x2707('0xc4')][_0x2707('0x34')]({'ListId':{'$ne':_0x1f3a3d[_0x2707('0x62')]}});}}return db[_0x2707('0xc5')][_0x2707('0xc6')](_0x33f54c);})['then'](function(_0x53ea9c){if(_0x53ea9c){return _[_0x2707('0xc9')](_['pickBy'](_0x285f02[_0x2707('0x98')],function(_0x2796e1,_0x30c839){return _[_0x2707('0x93')](_0x30c839,_0x2707('0x33'));}),_['map'](_0x53ea9c,function(_0x4763b6){return util[_0x2707('0xc7')](_0x2707('0xc8'),_0x4763b6['id']);}));}})[_0x2707('0x2b')](function(_0x356bf5){if(_0x356bf5&&!_['isEmpty'](_0x356bf5)){var _0x19fffb=squel[_0x2707('0xa1')]()[_0x2707('0xca')](_0x2707('0xcb'))[_0x2707('0xcc')](_0x356bf5)[_0x2707('0x3f')](_0x2707('0xcd'),_0x285f02[_0x2707('0x91')]['id'])['toParam']();return db[_0x2707('0x80')]['query'](_0x19fffb[_0x2707('0xce')],{'replacements':_0x19fffb[_0x2707('0x97')]});}})['then'](function(){if(_0x285f02[_0x2707('0x98')][_0x2707('0xcf')]&&_0x47ab06){return db['CmHopper'][_0x2707('0xa1')]({'phone':_0x285f02['body'][_0x2707('0xcf')]},{'where':{'ContactId':_0x47ab06['id']}});}})[_0x2707('0x2b')](function(){return _0x47ab06;})[_0x2707('0x2b')](respondWithResult(_0x53be66,null))['catch'](handleError(_0x53be66,null));};exports[_0x2707('0xd0')]=function(_0x3954ed,_0x1edcf1,_0x36a768){var _0x4a2226={};var _0x895fe9={};var _0x1cf16f;var _0xd141df;return db['CmContact'][_0x2707('0xd1')]({'where':{'id':_0x3954ed[_0x2707('0x91')]['id']}})[_0x2707('0x2b')](handleEntityNotFound(_0x1edcf1,null))['then'](function(_0x241e79){if(_0x241e79){_0x1cf16f=_0x241e79;_0x895fe9[_0x2707('0x36')]=_[_0x2707('0x31')](db[_0x2707('0xbd')][_0x2707('0xd2')]);_0x895fe9['query']=_[_0x2707('0x31')](_0x3954ed[_0x2707('0x37')]);_0x895fe9[_0x2707('0x40')]=_[_0x2707('0x38')](_0x895fe9[_0x2707('0x36')],_0x895fe9['query']);_0x4a2226['attributes']=_[_0x2707('0x38')](_0x895fe9['model'],qs[_0x2707('0x3a')](_0x3954ed[_0x2707('0x37')]['fields']));_0x4a2226[_0x2707('0x39')]=_0x4a2226[_0x2707('0x39')]['length']?_0x4a2226[_0x2707('0x39')]:_0x895fe9['model'];_0x4a2226[_0x2707('0x3d')]=qs[_0x2707('0x3e')](_0x3954ed['query'][_0x2707('0x3e')]);_0x4a2226[_0x2707('0x3f')]=qs[_0x2707('0x40')](_[_0x2707('0xd3')](_0x3954ed[_0x2707('0x37')],_0x895fe9[_0x2707('0x40')]));if(_0x3954ed['query'][_0x2707('0x5f')]){_0x4a2226[_0x2707('0x3f')]=_['merge'](_0x4a2226[_0x2707('0x3f')],{'$or':_['map'](_0x4a2226[_0x2707('0x39')],function(_0x1c3947){var _0x1a646c={};_0x1a646c[_0x1c3947]={'$like':'%'+_0x3954ed[_0x2707('0x37')][_0x2707('0x5f')]+'%'};return _0x1a646c;})});}_0x4a2226=_[_0x2707('0xd4')]({},_0x4a2226,_0x3954ed[_0x2707('0xd5')]);return _0x1cf16f['getTags'](_0x4a2226);}})[_0x2707('0x2b')](function(_0x430776){if(_0x430776){_0xd141df=_0x430776[_0x2707('0x32')];if(!_0x3954ed['query'][_0x2707('0x3b')](_0x2707('0x3c'))){_0x4a2226[_0x2707('0x26')]=qs[_0x2707('0x26')](_0x3954ed[_0x2707('0x37')][_0x2707('0x26')]);_0x4a2226[_0x2707('0x23')]=qs[_0x2707('0x23')](_0x3954ed[_0x2707('0x37')][_0x2707('0x23')]);}return _0x1cf16f[_0x2707('0xd0')](_0x4a2226);}})[_0x2707('0x2b')](function(_0x1cbbf8){if(_0x1cbbf8){return _0x1cbbf8?{'count':_0xd141df,'rows':_0x1cbbf8}:null;}})[_0x2707('0x2b')](respondWithResult(_0x1edcf1,null))[_0x2707('0x90')](handleError(_0x1edcf1,null));};exports[_0x2707('0xd6')]=function(_0x21209c,_0x5bb3ec,_0x25e2d7){if(_0x21209c[_0x2707('0x98')]['id']){delete _0x21209c[_0x2707('0x98')]['id'];}return db[_0x2707('0x83')]['findOne']({'where':{'id':_0x21209c['params']['id']}})[_0x2707('0x2b')](handleEntityNotFound(_0x5bb3ec,null))['then'](function(_0x1aa294){if(_0x1aa294){return _0x1aa294[_0x2707('0xd6')](_0x21209c[_0x2707('0x98')]['ids']||[]);}return null;})[_0x2707('0x2b')](respondWithResult(_0x5bb3ec,null))[_0x2707('0x90')](handleError(_0x5bb3ec,null));};exports['setAdditionalPhones']=function(_0x3f55e9,_0x4c07b3){var _0x44d142=[];_0x44d142[_0x2707('0x34')](addAdditionalPhones(_0x3f55e9[_0x2707('0x98')]));Promise[_0x2707('0xbc')](_0x44d142)[_0x2707('0x2b')](function(){_0x44d142=[];_0x44d142[_0x2707('0x34')](deleteCmHopperPhones(_0x3f55e9['body']['id']));_0x44d142['push'](addCmHopperPhones(_0x3f55e9[_0x2707('0x98')]['id']));Promise['all'](_0x44d142)[_0x2707('0x2b')](function(){return[0x1];})[_0x2707('0x2b')](respondWithResult(_0x4c07b3,null));});};function addAdditionalPhones(_0x2088cc){var _0x21a866;return new Promise(function(_0x54f945,_0x25d68c){return db['CmContactHasItem'][_0x2707('0x9e')]({'where':{'CmContactId':_0x2088cc['id']}})[_0x2707('0x2b')](function(){var _0x3e8f70=[];for(var _0x22a5cf=0x0;_0x22a5cf<_0x2088cc[_0x2707('0xd7')]['length'];_0x22a5cf++){var _0x57f664=_0x2088cc[_0x2707('0xd8')]?_[_0x2707('0xd9')](_0x2088cc[_0x2707('0xd8')][_0x22a5cf])?'':_0x2088cc[_0x2707('0xd8')][_0x22a5cf]:_0x2088cc[_0x2707('0xd7')][_0x22a5cf][_0x2707('0xda')]?_0x2088cc[_0x2707('0xd7')][_0x22a5cf][_0x2707('0xda')]:'';var _0x2476a8=_[_0x2707('0xd9')](_0x2088cc[_0x2707('0xd7')][_0x22a5cf][_0x2707('0xdb')])?'':_0x2088cc[_0x2707('0xd7')][_0x22a5cf][_0x2707('0xdb')];var _0x18b903=_0x57f664+':'+_0x2088cc['items'][_0x22a5cf][_0x2707('0xcf')]+'§'+_0x2476a8;if(_['isNil'](_0x21a866))_0x21a866=_0x18b903;else _0x21a866+=';'+_0x18b903;_0x3e8f70[_0x2707('0x34')](addAdditionalPhone(_0x2088cc['id'],_0x2088cc[_0x2707('0xd7')][_0x22a5cf][_0x2707('0xcf')],_0x2088cc['item_types']?_[_0x2707('0xd9')](_0x2088cc[_0x2707('0xd8')][_0x22a5cf])?null:_0x2088cc[_0x2707('0xd8')][_0x22a5cf]:_0x2088cc[_0x2707('0xd7')][_0x22a5cf][_0x2707('0xda')]?_0x2088cc[_0x2707('0xd7')][_0x22a5cf][_0x2707('0xda')]:null,_0x22a5cf,_0x2476a8));}Promise[_0x2707('0xbc')](_0x3e8f70)[_0x2707('0x2b')](function(){db['CmContact'][_0x2707('0xa1')]({'AdditionalPhones':_0x21a866},{'where':{'id':_0x2088cc['id']}})[_0x2707('0x2b')](function(){_0x54f945(0x1);});});});});}function addAdditionalPhone(_0x385808,_0x36a8bd,_0x172dc0,_0x200540,_0x12d0de){return db[_0x2707('0xbe')][_0x2707('0x51')]({'where':{'CmContactId':_0x385808,'item':_0x36a8bd}})[_0x2707('0x2b')](function(_0x14a04a){if(_0x14a04a)logger[_0x2707('0x9b')](_0x2707('0xdc'),_0x14a04a);else{db['CmContactHasItem']['create']({'CmContactId':_0x385808,'item':_0x36a8bd,'ItemTypeId':_0x172dc0,'OrderBy':_0x200540,'ItemClass':_0x2707('0xdd'),'description':_0x12d0de});}});}function deletePhones(_0x499d7a){return db[_0x2707('0xbe')][_0x2707('0x9e')]({'where':{'CmContactId':_0x499d7a}});}function deleteCmHopperPhones(_0x4ca248){return new Promise(function(_0x520c92,_0x2d5303){return db[_0x2707('0x9d')][_0x2707('0xc6')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4ca248}})[_0x2707('0x2b')](function(_0x4eed46){db[_0x2707('0xde')][_0x2707('0x9e')]({'where':{'CmHopperId':{'$in':_[_0x2707('0x53')](_0x4eed46,'id')}}});})[_0x2707('0x2b')](function(){_0x520c92(0x1);});});}function addCmHopperPhones(_0x1b70a7){return new Promise(function(_0x2f34b3,_0x692296){return db[_0x2707('0x9d')][_0x2707('0xc6')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1b70a7}})[_0x2707('0x2b')](function(_0x41d6c9){var _0x513170=[];_[_0x2707('0x53')](_0x41d6c9,function(_0x5a9e16){_0x513170[_0x2707('0x34')](createCmHopperPhone(_0x1b70a7,_0x5a9e16['id']));});Promise[_0x2707('0xbc')](_0x513170)['then'](function(){_0x2f34b3(0x1);});});});}function createCmHopperPhone(_0x4c8c9e,_0x57cf09){return new Promise(function(_0x5dd72b,_0x5b38ad){db[_0x2707('0xbe')]['findAll']({'raw':!![],'attributes':[_0x2707('0xdf')],'where':{'CmContactId':_0x4c8c9e,'ItemClass':'PHONE'},'include':[{'model':db[_0x2707('0xc0')],'attributes':[_0x2707('0xe0')],'as':_0x2707('0xe1')}],'order':[db[_0x2707('0x80')][_0x2707('0xc1')](_0x2707('0xe2'))]})[_0x2707('0x2b')](function(_0x35d218){var _0x2698c6=0x1;var _0x4264f6=_[_0x2707('0x53')](_0x35d218,function(_0x4ac850){_0x4ac850[_0x2707('0xe3')]=_0x57cf09;_0x4ac850[_0x2707('0xcf')]=_0x4ac850[_0x2707('0xdf')];_0x4ac850[_0x2707('0xe0')]=_0x4ac850[_0x2707('0xe4')]||_0x2698c6;delete _0x4ac850[_0x2707('0xe4')];_0x2698c6=_0x2698c6+0x1;return _0x4ac850;});return db[_0x2707('0xde')][_0x2707('0xb5')](_0x4264f6,{});})['then'](function(){_0x5dd72b(0x1);});});}function insertAdditionalPhones(_0x48e627,_0x3c413b){return new Promise(function(_0x5b81d8,_0x1cc20a){var _0x31e4bc=[];for(var _0x141945=0x0;_0x141945<_0x3c413b[_0x2707('0x32')];_0x141945++){var _0x4cdd08=_0x3c413b[_0x141945];_0x31e4bc[_0x2707('0x34')](parseContactItemType(_0x4cdd08));}Promise[_0x2707('0xbc')](_0x31e4bc)['then'](function(){var _0x1b217a={'id':_0x48e627['id'],'items':_0x3c413b};return addAdditionalPhones(_0x1b217a)[_0x2707('0x2b')](function(_0x2f0f78){return addCmHopperPhones(_0x48e627['id']);});})[_0x2707('0x2b')](function(){_0x5b81d8(_0x48e627);});});}function parseContactItemType(_0x139dcf){return new Promise(function(_0x55f3d2,_0x1ab646){if(_0x139dcf[_0x2707('0x3b')]('ItemTypeId')){_0x55f3d2(_0x139dcf);}else{return db['ContactItemType']['find']({'where':{'name':_0x139dcf[_0x2707('0xe1')]}})['then'](function(_0x2e8ab6){if(_[_0x2707('0xd9')](_0x2e8ab6))_0x139dcf[_0x2707('0xda')]=null;else _0x139dcf[_0x2707('0xda')]=_0x2e8ab6['id'];_0x55f3d2(_0x139dcf);});}});}exports[_0x2707('0xe5')]=function(_0xabfbf0,_0x23d31d){return db['CmContactHasItem'][_0x2707('0xc6')]({'raw':!![],'where':{'CmContactId':_0xabfbf0[_0x2707('0x91')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x2707('0xc0')],'as':_0x2707('0xe1')}],'order':[[db[_0x2707('0x80')][_0x2707('0xc1')](_0x2707('0xe2'))],[_0x2707('0xe0')]]})[_0x2707('0x2b')](function(_0x3d22aa){return _0x3d22aa;})[_0x2707('0x2b')](respondWithResult(_0x23d31d,null))[_0x2707('0x90')](handleError(_0x23d31d,null));};exports[_0x2707('0xe6')]=function(_0x402aaa,_0xafd51c){return db[_0x2707('0xbe')]['findAll']({'raw':!![],'where':{'CmContactId':_0x402aaa[_0x2707('0x98')][_0x2707('0xe7')]}})[_0x2707('0x2b')](function(_0x17791d){var _0x2b9492=_[_0x2707('0x53')](_0x17791d,function(_0x40f738){_0x40f738[_0x2707('0xe8')]=_0x402aaa[_0x2707('0x98')][_0x2707('0xe9')];return _0x40f738;});return db[_0x2707('0xbe')][_0x2707('0xb5')](_0x2b9492,{});})[_0x2707('0x2b')](function(_0x1b1078){return addCmHopperPhones(_0x402aaa[_0x2707('0x98')][_0x2707('0xe9')]);})['then'](function(_0x3dcf7b){return['ok'];})[_0x2707('0x2b')](respondWithResult(_0xafd51c,null))[_0x2707('0x90')](handleError(_0xafd51c,null));};exports[_0x2707('0xea')]=function(_0x16752e,_0xd58fd5){var _0x453417=[];_0x453417['push'](createCmHopperPhone(_0x16752e[_0x2707('0x98')]['id'],_0x16752e[_0x2707('0x98')]['hopperId']));Promise[_0x2707('0xbc')](_0x453417)[_0x2707('0x2b')](function(){return[0x1];})[_0x2707('0x2b')](respondWithResult(_0xd58fd5,null));};exports[_0x2707('0xeb')]=function(_0x3f87c2,_0x349a2e,_0x4f1aac){var _0x36417a={'raw':![],'where':{}};var _0xe8b564={};var _0x3bcf25={'count':0x0,'rows':[]};return db[_0x2707('0x83')]['findOne']({'where':{'id':_0x3f87c2['params']['id']}})[_0x2707('0x2b')](handleEntityNotFound(_0x349a2e,null))[_0x2707('0x2b')](function(_0x431aff){if(_0x431aff){_0xe8b564[_0x2707('0x36')]=_['keys'](db[_0x2707('0x9d')][_0x2707('0xd2')]);_0xe8b564[_0x2707('0x37')]=_[_0x2707('0x31')](_0x3f87c2['query']);_0xe8b564[_0x2707('0x40')]=_[_0x2707('0x38')](_0xe8b564['model'],_0xe8b564[_0x2707('0x37')]);_0x36417a[_0x2707('0x39')]=_[_0x2707('0x38')](_0xe8b564[_0x2707('0x36')],qs[_0x2707('0x3a')](_0x3f87c2['query'][_0x2707('0x3a')]));_0x36417a[_0x2707('0x39')]=_0x36417a[_0x2707('0x39')][_0x2707('0x32')]?_0x36417a['attributes']:_0xe8b564[_0x2707('0x36')];if(!_0x3f87c2[_0x2707('0x37')][_0x2707('0x3b')](_0x2707('0x3c'))){_0x36417a[_0x2707('0x26')]=qs[_0x2707('0x26')](_0x3f87c2[_0x2707('0x37')][_0x2707('0x26')]);_0x36417a[_0x2707('0x23')]=qs[_0x2707('0x23')](_0x3f87c2[_0x2707('0x37')]['offset']);}_0x36417a[_0x2707('0x3d')]=qs[_0x2707('0x3e')](_0x3f87c2[_0x2707('0x37')][_0x2707('0x3e')]);_0x36417a[_0x2707('0x3f')]=qs[_0x2707('0x40')](_['pick'](_0x3f87c2[_0x2707('0x37')],_0xe8b564[_0x2707('0x40')]));_0x36417a[_0x2707('0x3f')][_0x2707('0xec')]=_0x431aff['id'];if(_0x3f87c2[_0x2707('0x37')][_0x2707('0x5f')]){_0x36417a[_0x2707('0x3f')]=_[_0x2707('0xd4')](_0x36417a[_0x2707('0x3f')],{'$or':_[_0x2707('0x53')](_0x36417a[_0x2707('0x39')],function(_0x30c6ab){var _0x83c652={};_0x83c652[_0x30c6ab]={'$like':'%'+_0x3f87c2[_0x2707('0x37')][_0x2707('0x5f')]+'%'};return _0x83c652;})});}_0x36417a=_[_0x2707('0xd4')]({},_0x36417a,_0x3f87c2[_0x2707('0xd5')]);return db['CmHopper'][_0x2707('0x25')]({'where':_0x36417a[_0x2707('0x3f')]})[_0x2707('0x2b')](function(_0x35eacc){_0x3bcf25[_0x2707('0x25')]=_0x35eacc;if(_0x3f87c2[_0x2707('0x37')]['includeAll']){_0x36417a[_0x2707('0xed')]=[{'all':!![]}];}return db['CmHopper'][_0x2707('0xc6')](_0x36417a);})[_0x2707('0x2b')](function(_0x135b66){_0x3bcf25[_0x2707('0x8f')]=_0x135b66;return _0x3bcf25;});}})[_0x2707('0x2b')](respondWithFilteredResult(_0x349a2e,_0x36417a))[_0x2707('0x90')](handleError(_0x349a2e,null));};exports['getHopperHistories']=function(_0x1da349,_0x86237c,_0x5a10fe){var _0x1ce022={'raw':!![],'where':{}};var _0x3ad8bb={};var _0x2ef0d7={'count':0x0,'rows':[]};return db[_0x2707('0x83')][_0x2707('0xd1')]({'where':{'id':_0x1da349[_0x2707('0x91')]['id']}})[_0x2707('0x2b')](handleEntityNotFound(_0x86237c,null))[_0x2707('0x2b')](function(_0x5f2dc4){if(_0x5f2dc4){_0x3ad8bb[_0x2707('0x36')]=_[_0x2707('0x31')](db[_0x2707('0xab')][_0x2707('0xd2')]);_0x3ad8bb[_0x2707('0x37')]=_[_0x2707('0x31')](_0x1da349[_0x2707('0x37')]);_0x3ad8bb[_0x2707('0x40')]=_[_0x2707('0x38')](_0x3ad8bb['model'],_0x3ad8bb['query']);_0x1ce022[_0x2707('0x39')]=_[_0x2707('0x38')](_0x3ad8bb['model'],qs[_0x2707('0x3a')](_0x1da349[_0x2707('0x37')][_0x2707('0x3a')]));_0x1ce022[_0x2707('0x39')]=_0x1ce022[_0x2707('0x39')][_0x2707('0x32')]?_0x1ce022[_0x2707('0x39')]:_0x3ad8bb[_0x2707('0x36')];if(!_0x1da349['query']['hasOwnProperty']('nolimit')){_0x1ce022[_0x2707('0x26')]=qs[_0x2707('0x26')](_0x1da349[_0x2707('0x37')][_0x2707('0x26')]);_0x1ce022['offset']=qs[_0x2707('0x23')](_0x1da349[_0x2707('0x37')][_0x2707('0x23')]);}_0x1ce022[_0x2707('0x3d')]=qs[_0x2707('0x3e')](_0x1da349[_0x2707('0x37')][_0x2707('0x3e')]);_0x1ce022[_0x2707('0x3f')]=qs['filters'](_['pick'](_0x1da349[_0x2707('0x37')],_0x3ad8bb[_0x2707('0x40')]));_0x1ce022[_0x2707('0x3f')][_0x2707('0xec')]=_0x5f2dc4['id'];if(_0x1da349['query'][_0x2707('0x5f')]){_0x1ce022['where']=_[_0x2707('0xd4')](_0x1ce022[_0x2707('0x3f')],{'$or':_[_0x2707('0x53')](_0x1ce022['attributes'],function(_0x36e303){var _0x2fc47a={};_0x2fc47a[_0x36e303]={'$like':'%'+_0x1da349[_0x2707('0x37')][_0x2707('0x5f')]+'%'};return _0x2fc47a;})});}_0x1ce022=_[_0x2707('0xd4')]({},_0x1ce022,_0x1da349[_0x2707('0xd5')]);return db[_0x2707('0xab')][_0x2707('0x25')]({'where':_0x1ce022[_0x2707('0x3f')]})[_0x2707('0x2b')](function(_0x580c92){_0x2ef0d7['count']=_0x580c92;if(_0x1da349[_0x2707('0x37')]['includeAll']){_0x1ce022[_0x2707('0xed')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x1ce022);})[_0x2707('0x2b')](function(_0x1d1742){_0x2ef0d7[_0x2707('0x8f')]=_0x1d1742;return _0x2ef0d7;});}})[_0x2707('0x2b')](respondWithFilteredResult(_0x86237c,_0x1ce022))[_0x2707('0x90')](handleError(_0x86237c,null));};exports[_0x2707('0xee')]=function(_0x247939,_0x29a98a,_0x13795c){var _0x2a2a32={'raw':!![],'where':{}};var _0x54e501={};var _0x11f504={'count':0x0,'rows':[]};return db[_0x2707('0x83')]['findOne']({'where':{'id':_0x247939[_0x2707('0x91')]['id']}})[_0x2707('0x2b')](handleEntityNotFound(_0x29a98a,null))[_0x2707('0x2b')](function(_0x4c2a60){if(_0x4c2a60){_0x54e501[_0x2707('0x36')]=_[_0x2707('0x31')](db[_0x2707('0xaa')][_0x2707('0xd2')]);_0x54e501['query']=_[_0x2707('0x31')](_0x247939['query']);_0x54e501[_0x2707('0x40')]=_[_0x2707('0x38')](_0x54e501[_0x2707('0x36')],_0x54e501['query']);_0x2a2a32[_0x2707('0x39')]=_[_0x2707('0x38')](_0x54e501[_0x2707('0x36')],qs[_0x2707('0x3a')](_0x247939[_0x2707('0x37')][_0x2707('0x3a')]));_0x2a2a32[_0x2707('0x39')]=_0x2a2a32['attributes']['length']?_0x2a2a32[_0x2707('0x39')]:_0x54e501[_0x2707('0x36')];if(!_0x247939[_0x2707('0x37')]['hasOwnProperty'](_0x2707('0x3c'))){_0x2a2a32[_0x2707('0x26')]=qs[_0x2707('0x26')](_0x247939[_0x2707('0x37')][_0x2707('0x26')]);_0x2a2a32[_0x2707('0x23')]=qs[_0x2707('0x23')](_0x247939['query'][_0x2707('0x23')]);}_0x2a2a32[_0x2707('0x3d')]=qs[_0x2707('0x3e')](_0x247939[_0x2707('0x37')]['sort']);_0x2a2a32[_0x2707('0x3f')]=qs[_0x2707('0x40')](_[_0x2707('0xd3')](_0x247939['query'],_0x54e501[_0x2707('0x40')]));_0x2a2a32[_0x2707('0x3f')][_0x2707('0xec')]=_0x4c2a60['id'];if(_0x247939[_0x2707('0x37')][_0x2707('0x5f')]){_0x2a2a32[_0x2707('0x3f')]=_['merge'](_0x2a2a32['where'],{'$or':_[_0x2707('0x53')](_0x2a2a32['attributes'],function(_0xbc29af){var _0x4cde71={};_0x4cde71[_0xbc29af]={'$like':'%'+_0x247939[_0x2707('0x37')][_0x2707('0x5f')]+'%'};return _0x4cde71;})});}_0x2a2a32=_[_0x2707('0xd4')]({},_0x2a2a32,_0x247939[_0x2707('0xd5')]);return db[_0x2707('0xaa')][_0x2707('0x25')]({'where':_0x2a2a32[_0x2707('0x3f')]})[_0x2707('0x2b')](function(_0x1512b6){_0x11f504[_0x2707('0x25')]=_0x1512b6;if(_0x247939[_0x2707('0x37')][_0x2707('0xef')]){_0x2a2a32[_0x2707('0xed')]=[{'all':!![]}];}return db[_0x2707('0xaa')][_0x2707('0xc6')](_0x2a2a32);})['then'](function(_0x37d99a){_0x11f504['rows']=_0x37d99a;return _0x11f504;});}})[_0x2707('0x2b')](respondWithFilteredResult(_0x29a98a,_0x2a2a32))['catch'](handleError(_0x29a98a,null));};exports['getJscriptySessions']=function(_0x2a10bc,_0x47bf4a,_0x57ae99){var _0x48fa9e={'raw':!![],'where':{}};var _0x39d0ae={};var _0x3765d2={'count':0x0,'rows':[]};return db[_0x2707('0x83')][_0x2707('0xd1')]({'where':{'id':_0x2a10bc[_0x2707('0x91')]['id']}})[_0x2707('0x2b')](handleEntityNotFound(_0x47bf4a,null))[_0x2707('0x2b')](function(_0x522070){if(_0x522070){_0x39d0ae[_0x2707('0x36')]=_[_0x2707('0x31')](db['JscriptySessionReport'][_0x2707('0xd2')]);_0x39d0ae[_0x2707('0x37')]=_[_0x2707('0x31')](_0x2a10bc['query']);_0x39d0ae['filters']=_['intersection'](_0x39d0ae[_0x2707('0x36')],_0x39d0ae[_0x2707('0x37')]);_0x48fa9e[_0x2707('0x39')]=_[_0x2707('0x38')](_0x39d0ae[_0x2707('0x36')],qs['fields'](_0x2a10bc[_0x2707('0x37')][_0x2707('0x3a')]));_0x48fa9e[_0x2707('0x39')]=_0x48fa9e[_0x2707('0x39')]['length']?_0x48fa9e[_0x2707('0x39')]:_0x39d0ae[_0x2707('0x36')];if(!_0x2a10bc[_0x2707('0x37')]['hasOwnProperty'](_0x2707('0x3c'))){_0x48fa9e['limit']=qs[_0x2707('0x26')](_0x2a10bc['query'][_0x2707('0x26')]);_0x48fa9e['offset']=qs[_0x2707('0x23')](_0x2a10bc['query'][_0x2707('0x23')]);}_0x48fa9e['order']=qs[_0x2707('0x3e')](_0x2a10bc[_0x2707('0x37')][_0x2707('0x3e')]);_0x48fa9e['where']=qs[_0x2707('0x40')](_[_0x2707('0xd3')](_0x2a10bc[_0x2707('0x37')],_0x39d0ae[_0x2707('0x40')]));_0x48fa9e[_0x2707('0x3f')][_0x2707('0xec')]=_0x522070['id'];if(_0x2a10bc[_0x2707('0x37')][_0x2707('0x5f')]){_0x48fa9e[_0x2707('0x3f')]=_['merge'](_0x48fa9e[_0x2707('0x3f')],{'$or':_[_0x2707('0x53')](_0x48fa9e['attributes'],function(_0x5d3903){var _0x176cdb={};_0x176cdb[_0x5d3903]={'$like':'%'+_0x2a10bc[_0x2707('0x37')][_0x2707('0x5f')]+'%'};return _0x176cdb;})});}_0x48fa9e=_['merge']({},_0x48fa9e,_0x2a10bc['options']);return db[_0x2707('0xb1')][_0x2707('0x25')]({'where':_0x48fa9e[_0x2707('0x3f')]})[_0x2707('0x2b')](function(_0x527f36){_0x3765d2[_0x2707('0x25')]=_0x527f36;if(_0x2a10bc[_0x2707('0x37')][_0x2707('0xef')]){_0x48fa9e[_0x2707('0xed')]=[{'all':!![]}];}return db[_0x2707('0xb1')]['findAll'](_0x48fa9e);})[_0x2707('0x2b')](function(_0x392a37){_0x3765d2[_0x2707('0x8f')]=_0x392a37;return _0x3765d2;});}})[_0x2707('0x2b')](respondWithFilteredResult(_0x47bf4a,_0x48fa9e))[_0x2707('0x90')](handleError(_0x47bf4a,null));};exports[_0x2707('0xf0')]=function(_0x3458ce,_0x2a2039,_0x3a58f9){try{if(!_0x3458ce['body'][_0x2707('0x62')]){throw new Error('No\x20ListId\x20specified');}if(!_0x3458ce[_0x2707('0x98')][_0x2707('0xf1')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x3458ce[_0x2707('0x98')][_0x2707('0xf2')]){throw new Error(_0x2707('0xf3'));}if(!_0x3458ce[_0x2707('0x98')][_0x2707('0xf4')]){throw new Error(_0x2707('0xf5'));}var _0x405665=_0x3458ce['body']['binding_keys'][_0x2707('0x52')](',');var _0x338068=_0x3458ce['body'][_0x2707('0xf2')][_0x2707('0x52')](',');if(!_0x405665[_0x2707('0x32')]||!_0x338068[_0x2707('0x32')]||_0x405665[_0x2707('0x32')]!==_0x338068['length']){throw new Error(_0x2707('0xf6'));}_0x3458ce[_0x2707('0x98')][_0x2707('0x3a')]=_[_0x2707('0xf7')](_0x405665,_0x338068);if(!_0x3458ce[_0x2707('0x98')][_0x2707('0x3a')][_0x2707('0xcf')]){throw new Error(_0x2707('0xf8'));}if(!_0x3458ce[_0x2707('0x98')][_0x2707('0x3a')][_0x2707('0xf9')]){throw new Error(_0x2707('0xfa'));}var _0x12788d=path[_0x2707('0x9a')](config[_0x2707('0xfb')],_0x2707('0xfc'),_0x3458ce[_0x2707('0xfd')]['filename']);fs['chmodSync'](_0x12788d,parseInt(_0x2707('0xfe'),0x8));var _0x26ca1d=require(_0x2707('0xff'))[_0x2707('0x100')](path[_0x2707('0x9a')](__dirname,'../../components/import/cm/csv'),[_0x12788d,_0x3458ce[_0x2707('0x98')][_0x2707('0xf1')],_0x3458ce[_0x2707('0x98')]['binding_values'],_0x3458ce[_0x2707('0x98')][_0x2707('0x62')],_0x3458ce[_0x2707('0x98')][_0x2707('0x101')],_0x3458ce['body'][_0x2707('0xb7')],_0x3458ce[_0x2707('0x98')][_0x2707('0xf4')]]);return _0x2a2039[_0x2707('0x20')](0xc8)[_0x2707('0x22')]({'message':_0x2707('0x102'),'pid':_0x26ca1d[_0x2707('0x103')]});}catch(_0x1304e3){return _0x2a2039[_0x2707('0x20')](0x1f4)[_0x2707('0x104')](_0x1304e3);}};exports[_0x2707('0x105')]=function(_0x309dea,_0x5d26d7,_0x1d2c6f){var _0x3c41e9=fs[_0x2707('0x106')](_0x309dea['file'][_0x2707('0x107')]);Papa[_0x2707('0x108')](_0x3c41e9,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x26dabe){return _0x5d26d7[_0x2707('0x20')](0xc8)[_0x2707('0x22')]({'file':_0x309dea[_0x2707('0xfd')],'fields':_0x26dabe[_0x2707('0x109')]['fields']});}});};exports[_0x2707('0x10a')]=function(_0xf25469,_0x5d9d1c,_0x566381){return db[_0x2707('0x56')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x2707('0x2b')](function(_0x3d9665){var _0x3b6d8f=![];if(!_0xf25469[_0x2707('0x98')][_0x2707('0x62')]){throw new Error(_0x2707('0x10b'));}if(!_0xf25469[_0x2707('0x98')][_0x2707('0x10c')][_0x2707('0xcf')]){throw new Error(_0x2707('0xf8'));}if(!_0xf25469[_0x2707('0x98')][_0x2707('0x10c')][_0x2707('0xf9')]){throw new Error(_0x2707('0xfa'));}if(!_0xf25469['body'][_0x2707('0xf4')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x8d3f9f=require(_0x2707('0xff'))[_0x2707('0x100')](path[_0x2707('0x9a')](__dirname,'../../components/import/cm/csv2'),[_0xf25469['params']['id'],JSON[_0x2707('0x10d')](_0xf25469[_0x2707('0x98')]),JSON[_0x2707('0x10d')](_0x3d9665)]);_0x8d3f9f['on'](_0x2707('0x10e'),function(_0x134766){_0x3b6d8f=!![];return _0x5d9d1c[_0x2707('0x20')](0xc8)[_0x2707('0x22')]({'message':_0x2707('0x10f'),'pid':_0x8d3f9f[_0x2707('0x103')]});});_0x8d3f9f['on']('exit',function(_0x193063){if(_0x193063&&!_0x3b6d8f){return _0x5d9d1c[_0x2707('0x20')](0x1f4)[_0x2707('0x22')]({'message':_0x2707('0x110'),'pid':_0x8d3f9f['pid']});}});})[_0x2707('0x90')](handleError(_0x5d9d1c,null));};exports[_0x2707('0x111')]=function(_0x1c64c1,_0x2e75b6,_0x2defb9){return db[_0x2707('0x56')][_0x2707('0xc6')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x2707('0x2b')](function(_0x550056){var _0x5a18f7=![];if(!_0x1c64c1[_0x2707('0x98')][_0x2707('0x62')]){throw new Error(_0x2707('0x10b'));}if(!_0x1c64c1['body'][_0x2707('0x10c')][_0x2707('0xcf')]){throw new Error(_0x2707('0xf8'));}if(!_0x1c64c1[_0x2707('0x98')]['binding'][_0x2707('0xf9')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x1c64c1['body'][_0x2707('0xf4')]){throw new Error(_0x2707('0xf5'));}var _0x4f1ca7=require('child_process')[_0x2707('0x100')](path[_0x2707('0x9a')](__dirname,'../../components/import/cm/csvUpdates'),[_0x1c64c1[_0x2707('0x91')]['id'],JSON[_0x2707('0x10d')](_0x1c64c1['body']),JSON[_0x2707('0x10d')](_0x550056)]);_0x4f1ca7['on'](_0x2707('0x10e'),function(_0x506aa0){_0x5a18f7=!![];return _0x2e75b6['status'](0xc8)[_0x2707('0x22')]({'message':_0x2707('0x10f'),'pid':_0x4f1ca7['pid']});});_0x4f1ca7['on'](_0x2707('0x112'),function(_0x65881a){if(_0x65881a&&!_0x5a18f7){return _0x2e75b6['status'](0x1f4)[_0x2707('0x22')]({'message':_0x2707('0x110'),'pid':_0x4f1ca7['pid']});}});})[_0x2707('0x90')](handleError(_0x2e75b6,null));};exports[_0x2707('0x113')]=function(_0x463d9d,_0x28b8f3){var _0x38fc84=[_0x2707('0x114'),_0x2707('0x115'),_0x2707('0x116'),_0x2707('0x117'),_0x2707('0x118'),_0x2707('0x119'),'voice'];var _0x6116a3={'offset':0x0,'order':qs['sort'](_0x2707('0x11a'))},_0x38538b={'count':0x0,'rows':[]};Promise['resolve']()['then'](function(){if(_0x463d9d[_0x2707('0x37')][_0x2707('0x11b')]){if(!_[_0x2707('0x11c')](_0x38fc84,_0x463d9d[_0x2707('0x37')][_0x2707('0x11b')][_0x2707('0x11d')]())){throw new Error('Invalid\x20channel');}_0x38fc84=[_0x463d9d[_0x2707('0x37')][_0x2707('0x11b')][_0x2707('0x11d')]()];}if(_0x463d9d[_0x2707('0x37')][_0x2707('0x11e')]){try{var _0x42663e=JSON[_0x2707('0x108')](_0x463d9d[_0x2707('0x37')]['range']);if(!moment(_0x42663e['from'])[_0x2707('0x11f')]()){throw new Error(_0x2707('0x120'));}if(!moment(_0x42663e['to'])[_0x2707('0x11f')]()){throw new Error(_0x2707('0x121'));}}catch(_0x4efdca){throw new Error(_0x2707('0x122'));}}if(!_0x463d9d['query'][_0x2707('0x3b')](_0x2707('0x3c'))){_0x6116a3[_0x2707('0x26')]=qs[_0x2707('0x26')](_0x463d9d[_0x2707('0x37')][_0x2707('0x26')]||0xa);_0x6116a3[_0x2707('0x23')]=qs[_0x2707('0x23')](_0x463d9d[_0x2707('0x37')][_0x2707('0x23')]);}var _0x486aaa=_0x38fc84[_0x2707('0x53')](function(_0x3ebcb9){if(_0x3ebcb9==='voice'){var _0x22eb7a={'attributes':['id',_0x2707('0x123'),_0x2707('0x5d'),_0x2707('0x124'),_0x2707('0x125'),_0x2707('0x126'),'starttime','endtime',_0x2707('0x127'),_0x2707('0x128'),_0x2707('0x129'),'userDisposition','userSecondDisposition','userThirdDisposition','UserId'],'where':{'ContactId':_0x463d9d['params']['id']},'include':[{'model':db['User'],'as':_0x2707('0x56'),'attributes':['id',_0x2707('0x2e'),'fullname',_0x2707('0x96')]}],'order':[['createdAt',_0x2707('0x76')]]};if(_0x463d9d[_0x2707('0x37')][_0x2707('0x11e')]){_0x22eb7a[_0x2707('0x3f')][_0x2707('0x129')]={'$gte':_0x42663e[_0x2707('0x43')],'$lte':_0x42663e['to']};}return db[_0x2707('0xad')][_0x2707('0x12a')](_0x22eb7a)['then'](function(_0x335714){_0x38538b[_0x2707('0x25')]+=_0x335714[_0x2707('0x25')];return _[_0x2707('0x53')](_0x335714[_0x2707('0x8f')],function(_0x40ce1a){var _0x4f479c=_0x40ce1a[_0x2707('0x99')]({'plain':!![]});_0x4f479c[_0x2707('0x11b')]=_0x3ebcb9;if(_0x4f479c[_0x2707('0x56')]){_0x4f479c['User']={'id':_0x4f479c[_0x2707('0x56')]['id'],'name':_0x4f479c[_0x2707('0x56')]['name'],'fullname':_0x4f479c['User']['fullname'],'alias':_0x4f479c['User'][_0x2707('0x96')]};}return _0x4f479c;});});}else{var _0x173760=_['startCase'](_0x3ebcb9)+(_0x3ebcb9===_0x2707('0x115')?'Website':'Account');var _0x3ff9ac={'attributes':['id',_0x2707('0x12b'),_0x2707('0x12c'),_0x2707('0x129'),_0x2707('0x128'),_0x2707('0x12d'),_0x2707('0x12e'),_0x2707('0x12f'),'UserId',_0x173760+'Id'],'where':{'ContactId':_0x463d9d[_0x2707('0x91')]['id']},'include':[{'model':db[_0x173760],'as':_0x2707('0x130'),'attributes':['id',_0x2707('0x2e'),_0x2707('0x131')]},{'model':db[_0x2707('0x56')],'as':'Owner','attributes':['id',_0x2707('0x2e'),_0x2707('0x132')]},{'model':db['Tag'],'as':_0x2707('0x8e'),'attributes':['id',_0x2707('0x2e'),_0x2707('0x42')],'through':{'attributes':[]}}],'order':[[_0x2707('0x129'),'DESC']]};if(_0x463d9d['query'][_0x2707('0x11e')]){_0x3ff9ac['where'][_0x2707('0x129')]={'$gte':_0x42663e[_0x2707('0x43')],'$lte':_0x42663e['to']};}switch(_0x3ebcb9){case'chat':_0x3ff9ac[_0x2707('0x39')]['push'](_0x2707('0x133'),_0x2707('0x134'),_0x2707('0x135'),'deviceModel',_0x2707('0x136'),'ratingMessage',_0x2707('0x137'),_0x2707('0x138'),_0x2707('0x139'));break;case _0x2707('0x114'):_0x3ff9ac[_0x2707('0x39')][_0x2707('0x34')]('subject','substatus');break;case _0x2707('0x117'):_0x3ff9ac[_0x2707('0x39')][_0x2707('0x34')](_0x2707('0x13a'),_0x2707('0x13b'));break;}return db[_[_0x2707('0x13c')](_0x3ebcb9)+'Interaction'][_0x2707('0x12a')](_0x3ff9ac)[_0x2707('0x2b')](function(_0x54a850){_0x38538b[_0x2707('0x25')]+=_0x54a850[_0x2707('0x25')];return _[_0x2707('0x53')](_0x54a850[_0x2707('0x8f')],function(_0x2514ff){var _0x40f103=_0x2514ff[_0x2707('0x99')]({'plain':!![]});_0x40f103[_0x2707('0x11b')]=_0x3ebcb9;if(_0x40f103['Owner']){_0x40f103[_0x2707('0x13d')]={'id':_0x40f103[_0x2707('0x13d')]['id'],'name':_0x40f103[_0x2707('0x13d')][_0x2707('0x2e')],'fullname':_0x40f103[_0x2707('0x13d')][_0x2707('0x132')]};}return _0x40f103;});});}});return Promise[_0x2707('0xbc')](_0x486aaa);})[_0x2707('0x2b')](function(_0x5cfeb9){return _(_0x5cfeb9)[_0x2707('0x13e')]()[_0x2707('0x13f')]('createdAt')[_0x2707('0x140')]()['value']();})[_0x2707('0x2b')](function(_0x260d63){_0x38538b[_0x2707('0x8f')]=_0x6116a3[_0x2707('0x26')]?_0x260d63['slice'](_0x6116a3[_0x2707('0x23')],_0x6116a3[_0x2707('0x23')]+_0x6116a3[_0x2707('0x26')]):_0x260d63;return _0x38538b;})[_0x2707('0x2b')](respondWithFilteredResult(_0x28b8f3,_0x6116a3))[_0x2707('0x90')](handleError(_0x28b8f3,null));}; \ No newline at end of file +var _0xea28=['sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','describe','length','startsWith','cf_','push','all','fieldType','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','field','color','tools_tags','select','from','cm_contacts','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','sqlOperator','conditions','Tag','value','split','forEach','User','and','dateOfBirth','datetime','buildExpression','start','isNil','Contact','ListId','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','group','c.id','QueryTypes','clone','order','DESC','isEmpty','having','t.id\x20IN\x20?','resolve','user','agent','some','getLists','c.ListId\x20IS\x20NULL','map','role','sequelize','toString','merge','CmContact','c.lastName','c.mobile','c.email','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','catch','find','params','tags','CmCustomField','findAll','columnName','displayName','alias','custom','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','update','MailInteraction','MailMessage','SmsInteraction','FaxInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','create','additionalPhones','bulkCreate','each','duplicates','$or','error','contact','show','Phones','ContactItemType','ItemType','literal','$and','omit','format','cf_%d','pickBy','table','setFields','id\x20=\x20?','toParam','text','values','phone','getTags','setTags','findOne','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','OrderBy','`ItemType`.OrderBy','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','rescheduleAdditionalPhones','hopperId','getHoppers','ContactId','options','includeAll','rows','getHopperHistories','rawAttributes','nolimit','include','getHopperFinals','getJscriptySessions','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','CompanyId','pid','upload','parse','meta','import','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','child_process','../../components/import/cm/csv2','stringify','message','exit','importUpdates','../../components/import/cm/csvUpdates','start\x20child\x20process\x20correctly!','error\x20child\x20process','getJourney','mail','openchannel','fax','whatsapp','voice','-createdAt','channel','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','destination','callerid','note','createdAt','userDisposition','userSecondDisposition','UserId','fullname','startCase','Website','Account','closedAt','secondDisposition','thirdDisposition','key','Owner','chat','browserName','customerIp','deviceModel','osName','ratingMessage','ratingValue','referer','subject','externalUrl','Interaction','findAndCountAll','flatten','sortBy','reverse','slice','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path'];(function(_0x39841e,_0x389b8f){var _0x4a7098=function(_0x15f15b){while(--_0x15f15b){_0x39841e['push'](_0x39841e['shift']());}};_0x4a7098(++_0x389b8f);}(_0xea28,0x13a));var _0x8ea2=function(_0x38d65d,_0x2f2cf4){_0x38d65d=_0x38d65d-0x0;var _0xc095a5=_0xea28[_0x38d65d];return _0xc095a5;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];config[_0x8ea2('0x1b')]=_[_0x8ea2('0x1c')](config[_0x8ea2('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x8ea2('0x1d'))(new Redis(config['redis']));require('./cmContact.socket')[_0x8ea2('0x1e')](socket);function respondWithStatusCode(_0x4726a7,_0x416bae){_0x416bae=_0x416bae||0xcc;return function(_0x78669a){if(_0x78669a){return _0x4726a7[_0x8ea2('0x1f')](_0x416bae);}return _0x4726a7[_0x8ea2('0x20')](_0x416bae)[_0x8ea2('0x21')]();};}function respondWithResult(_0x11f5e8,_0x474873){_0x474873=_0x474873||0xc8;return function(_0x396aab){if(_0x396aab){return _0x11f5e8[_0x8ea2('0x20')](_0x474873)[_0x8ea2('0x22')](_0x396aab);}};}function respondWithFilteredResult(_0x3bc774,_0xaa8abf){return function(_0x1b64cf){if(_0x1b64cf){var _0x174ef2=typeof _0xaa8abf[_0x8ea2('0x23')]===_0x8ea2('0x24')&&typeof _0xaa8abf[_0x8ea2('0x25')]===_0x8ea2('0x24');var _0x134cbe=_0x1b64cf[_0x8ea2('0x26')];var _0x52b58c=_0x174ef2?0x0:_0xaa8abf['offset'];var _0x3790e9=_0x174ef2?_0x1b64cf[_0x8ea2('0x26')]:_0xaa8abf[_0x8ea2('0x23')]+_0xaa8abf['limit'];var _0x46f4fe;if(_0x3790e9>=_0x134cbe){_0x3790e9=_0x134cbe;_0x46f4fe=0xc8;}else{_0x46f4fe=0xce;}_0x3bc774[_0x8ea2('0x20')](_0x46f4fe);return _0x3bc774['set'](_0x8ea2('0x27'),_0x52b58c+'-'+_0x3790e9+'/'+_0x134cbe)[_0x8ea2('0x22')](_0x1b64cf);}return null;};}function patchUpdates(_0x37229a){return function(_0x9f9548){try{jsonpatch[_0x8ea2('0x28')](_0x9f9548,_0x37229a,!![]);}catch(_0xe5c943){return BPromise[_0x8ea2('0x29')](_0xe5c943);}return _0x9f9548[_0x8ea2('0x2a')]();};}function saveUpdates(_0x18ec34,_0x4d5030){return function(_0x433bc5){if(_0x433bc5){return _0x433bc5['update'](_0x18ec34)[_0x8ea2('0x2b')](function(_0x42bec8){return _0x42bec8;});}return null;};}function removeEntity(_0x29b38f,_0x4e2106){return function(_0x53ed43){if(_0x53ed43){return _0x53ed43[_0x8ea2('0x2c')]()['then'](function(){_0x29b38f[_0x8ea2('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x1f')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x2d')]);if(_0xacaa6c[_0x8ea2('0x2e')]){delete _0xacaa6c[_0x8ea2('0x2e')];}_0x4e1b90[_0x8ea2('0x20')](_0x5ce1d4)[_0x8ea2('0x2f')](_0xacaa6c);};}exports[_0x8ea2('0x30')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};return db['CmContact'][_0x8ea2('0x31')]()[_0x8ea2('0x2b')](function(_0x53d71c){var _0x4a110f=[];for(var _0x1ee7b2=0x0;_0x1ee7b20x1){_0x320cb4['or'](_0x8ea2('0x69'),qs[_0x8ea2('0x6a')](_0xf78d1d),null);}else{if(qs[_0x8ea2('0x6b')](_0xf78d1d)){_0x320cb4['or']('c.id\x20LIKE\x20?',_0xf78d1d+'%');_0x320cb4['or'](_0x8ea2('0x6c'),_0xf78d1d+'%');_0x320cb4['or'](_0x8ea2('0x6d'),_0xf78d1d+'%');_0x320cb4['or'](_0x8ea2('0x6e'),_0xf78d1d+'%');}else if(qs[_0x8ea2('0x6f')](_0xf78d1d)){_0x320cb4['or']('c.email\x20LIKE\x20?',_0xf78d1d+'%');}else{_0x320cb4['or'](_0x8ea2('0x70'),'%'+_0xf78d1d+'%');_0x320cb4['or']('c.lastName\x20LIKE\x20?','%'+_0xf78d1d+'%');_0x320cb4['or'](_0x8ea2('0x71'),'%'+_0xf78d1d+'%');}}}}_0x1b8028['where'](_0x320cb4);_0x1b8028[_0x8ea2('0x72')](_0x8ea2('0x73'));var _0x4ad944={'type':db['Sequelize'][_0x8ea2('0x74')]['SELECT'],'raw':!![]};var _0x197453=_0x1b8028[_0x8ea2('0x75')]()[_0x8ea2('0x44')](_0x8ea2('0x73'));if(_0x19e868['order']){_0x19e868[_0x8ea2('0x76')][_0x8ea2('0x59')](function(_0x39776d){_0x1b8028[_0x8ea2('0x76')]('c.'+_0x39776d[0x0],_0x39776d[0x1]===_0x8ea2('0x77')?![]:!![]);});}if(!_[_0x8ea2('0x78')](_0x56efc5)){_0x1b8028[_0x8ea2('0x79')](_0x3e6541);_0x197453[_0x8ea2('0x42')](_0x8ea2('0x7a'),_0x56efc5);}BPromise[_0x8ea2('0x7b')]()[_0x8ea2('0x2b')](function(){if(!_0x23e527)return;if(_0x32e225[_0x8ea2('0x7c')]['role']!==_0x8ea2('0x7d'))return;if(!_[_0x8ea2('0x7e')](_0x23e527[_0x8ea2('0x55')],[_0x8ea2('0x44'),_0x8ea2('0x5a')])){return _0x32e225[_0x8ea2('0x7c')][_0x8ea2('0x7f')]({'attributes':['id'],'raw':!![]})[_0x8ea2('0x2b')](function(_0x18dd88){if(_[_0x8ea2('0x78')](_0x18dd88)){_0x197453[_0x8ea2('0x42')](_0x8ea2('0x80'));_0x1b8028['where'](_0x8ea2('0x80'));}else{_0x197453[_0x8ea2('0x42')](_0x8ea2('0x63'),_[_0x8ea2('0x81')](_0x18dd88,'id'));_0x1b8028[_0x8ea2('0x42')]('c.ListId\x20IN\x20?',_['map'](_0x18dd88,'id'));}});}})['then'](function(){if(_0x32e225[_0x8ea2('0x7c')][_0x8ea2('0x82')]===_0x8ea2('0x7d')&&!_0x23e527&&!_0x32e225[_0x8ea2('0x3b')][_0x8ea2('0x62')])return[];return db[_0x8ea2('0x83')]['query'](_0x197453[_0x8ea2('0x84')](),_0x4ad944);})[_0x8ea2('0x2b')](function(_0x5712a3){_0x56d914['count']=_0x5712a3[_0x8ea2('0x32')];if(_0x56d914[_0x8ea2('0x26')]===0x0)return[];return db[_0x8ea2('0x83')][_0x8ea2('0x3b')](_0x478d5c[_0x8ea2('0x84')](),_0x4ad944)[_0x8ea2('0x2b')](function(_0x3d55db){_0x2f4fa8=_['keyBy'](_0x3d55db,'id');_0x4ad944=_[_0x8ea2('0x85')](_0x4ad944,{'model':db[_0x8ea2('0x86')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x32e225[_0x8ea2('0x3b')][_0x8ea2('0x3f')]){_0x19e868['attributes'][_0x8ea2('0x59')](function(_0x356099){_0x1b8028[_0x8ea2('0x44')]('c.'+_0x356099);});}else{_0x1b8028['field'](_0x8ea2('0x73'));_0x1b8028['field']('c.firstName');_0x1b8028[_0x8ea2('0x44')](_0x8ea2('0x87'));_0x1b8028['field']('c.phone');_0x1b8028['field'](_0x8ea2('0x88'));_0x1b8028['field']('c.fax');_0x1b8028[_0x8ea2('0x44')](_0x8ea2('0x89'));_0x1b8028[_0x8ea2('0x44')](_0x8ea2('0x8a'));_0x1b8028[_0x8ea2('0x44')](_0x8ea2('0x8b'));_0x1b8028[_0x8ea2('0x44')](_0x8ea2('0x8c'));_0x1b8028[_0x8ea2('0x44')](_0x8ea2('0x8d'));_0x1b8028[_0x8ea2('0x44')](_0x8ea2('0x8e'),_0x8ea2('0x8f'));}if(_0x19e868[_0x8ea2('0x25')])_0x1b8028['limit'](_0x19e868[_0x8ea2('0x25')]);if(_0x19e868[_0x8ea2('0x23')])_0x1b8028[_0x8ea2('0x23')](_0x19e868['offset']);return db[_0x8ea2('0x83')]['query'](_0x1b8028[_0x8ea2('0x84')](),_0x4ad944);});})['then'](function(_0xc95633){_0xc95633['forEach'](function(_0x321d6f){if(_0x321d6f[_0x8ea2('0x8f')]){_0x321d6f['Tags']=[];_0x321d6f[_0x8ea2('0x8f')]['split'](',')[_0x8ea2('0x59')](function(_0x2c3a18){_0x321d6f[_0x8ea2('0x90')][_0x8ea2('0x35')](_0x2f4fa8[_0x2c3a18]);});}delete _0x321d6f[_0x8ea2('0x8f')];});_0x56d914['rows']=_0xc95633;return _0x56d914;})['then'](respondWithFilteredResult(_0x316707,_0x19e868));})[_0x8ea2('0x91')](handleError(_0x316707,null));};exports['destroy']=function(_0x410f78,_0x3c9f6a){return db[_0x8ea2('0x86')][_0x8ea2('0x92')]({'where':{'id':_0x410f78[_0x8ea2('0x93')]['id']}})[_0x8ea2('0x2b')](handleEntityNotFound(_0x3c9f6a,null))['then'](removeEntity(_0x3c9f6a,null))['catch'](handleError(_0x3c9f6a,null));};exports['describe']=function(_0x1f50dc,_0x576075){return db[_0x8ea2('0x86')][_0x8ea2('0x31')]()[_0x8ea2('0x2b')](function(_0x30a59a){delete _0x30a59a[_0x8ea2('0x94')];for(var _0xd2bb04=0x0;_0xd2bb040x0){return new Promise(function(_0x56a5f6,_0x410199){var _0xd6ddfb=[];for(var _0x31372a=0x0;_0x31372a<_0x3e1d78[_0x8ea2('0x32')];_0x31372a++){_0xd6ddfb[_0x8ea2('0x35')](insertAdditionalPhones(_0x3e1d78[_0x31372a][_0x8ea2('0xbf')],_0x3e1d78[_0x31372a][_0x8ea2('0xb9')]));}Promise[_0x8ea2('0x36')](_0xd6ddfb)[_0x8ea2('0x2b')](function(){_0x56a5f6(0x1);});})[_0x8ea2('0x2b')](function(){return{'success':_0x11c59e,'failure':_0x11b02a,'duplicates':_0x5ab2c4};});}else{return{'success':_0x11c59e,'failure':_0x11b02a,'duplicates':_0x5ab2c4};}}})[_0x8ea2('0x2b')](respondWithResult(_0x3e0f4f,0xc9))[_0x8ea2('0x91')](handleError(_0x3e0f4f,null));};exports[_0x8ea2('0xc0')]=function(_0x1e4c19,_0x183546,_0x1dd4f2){var _0x1b24fe;return db['CmContact']['describe']()['then'](function(_0x4b2c0f){return db[_0x8ea2('0x86')][_0x8ea2('0x92')]({'where':{'id':_0x1e4c19['params']['id']},'include':[{'model':db[_0x8ea2('0x56')],'as':_0x8ea2('0x90'),'attributes':['id',_0x8ea2('0x2e'),_0x8ea2('0x45')],'required':_0x1e4c19['query'][_0x8ea2('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x8ea2('0xc1'),'where':{'CmContactId':_0x1e4c19[_0x8ea2('0x93')]['id']},'required':![],'include':[{'model':db[_0x8ea2('0xc2')],'as':_0x8ea2('0xc3')}]}],'order':[db[_0x8ea2('0x83')][_0x8ea2('0xc4')]('`Phones.ItemType`.OrderBy')],'logging':console['log'],'attributes':_[_0x8ea2('0x3a')](_0x4b2c0f)});})[_0x8ea2('0x2b')](function(_0x53ff43){_0x1b24fe=_0x53ff43[_0x8ea2('0x9c')]({'plain':!![]});var _0x5392aa={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x53ff43&&_0x53ff43[_0x8ea2('0x62')]){if(_0x53ff43[_0x8ea2('0x62')]){_0x5392aa[_0x8ea2('0x42')][_0x8ea2('0xc5')][_0x8ea2('0x35')]({'ListId':{'$ne':_0x53ff43[_0x8ea2('0x62')]}});}}return db[_0x8ea2('0x95')]['findAll'](_0x5392aa);})[_0x8ea2('0x2b')](function(_0x5c9e47){return _[_0x8ea2('0xc6')](_0x1b24fe,_[_0x8ea2('0x81')](_0x5c9e47,function(_0x2856eb){return util[_0x8ea2('0xc7')](_0x8ea2('0xc8'),_0x2856eb['id']);}));})[_0x8ea2('0x2b')](handleEntityNotFound(_0x183546,null))[_0x8ea2('0x2b')](respondWithResult(_0x183546,null))['catch'](handleError(_0x183546,null));};exports[_0x8ea2('0xa6')]=function(_0x2bbf85,_0x4185d8){var _0x55d880;if(_0x2bbf85[_0x8ea2('0x9b')]['id']){delete _0x2bbf85[_0x8ea2('0x9b')]['id'];}return db[_0x8ea2('0x86')][_0x8ea2('0x92')]({'where':{'id':_0x2bbf85[_0x8ea2('0x93')]['id']}})[_0x8ea2('0x2b')](handleEntityNotFound(_0x4185d8,null))['then'](saveUpdates(_0x2bbf85['body'],null))[_0x8ea2('0x2b')](function(_0x34c4d7){_0x55d880=_0x34c4d7;var _0x406b40={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x34c4d7&&_0x34c4d7[_0x8ea2('0x62')]){if(_0x34c4d7[_0x8ea2('0x62')]){_0x406b40['where'][_0x8ea2('0xc5')]['push']({'ListId':{'$ne':_0x34c4d7[_0x8ea2('0x62')]}});}}return db[_0x8ea2('0x95')]['findAll'](_0x406b40);})[_0x8ea2('0x2b')](function(_0x254b51){if(_0x254b51){return _[_0x8ea2('0xc6')](_[_0x8ea2('0xc9')](_0x2bbf85[_0x8ea2('0x9b')],function(_0x46901d,_0x1b8254){return _[_0x8ea2('0x33')](_0x1b8254,_0x8ea2('0x34'));}),_[_0x8ea2('0x81')](_0x254b51,function(_0x4af3c4){return util[_0x8ea2('0xc7')](_0x8ea2('0xc8'),_0x4af3c4['id']);}));}})[_0x8ea2('0x2b')](function(_0x5ba0a2){if(_0x5ba0a2&&!_[_0x8ea2('0x78')](_0x5ba0a2)){var _0x5013ff=squel[_0x8ea2('0xa6')]()[_0x8ea2('0xca')](_0x8ea2('0x49'))[_0x8ea2('0xcb')](_0x5ba0a2)[_0x8ea2('0x42')](_0x8ea2('0xcc'),_0x2bbf85[_0x8ea2('0x93')]['id'])[_0x8ea2('0xcd')]();return db[_0x8ea2('0x83')]['query'](_0x5013ff[_0x8ea2('0xce')],{'replacements':_0x5013ff[_0x8ea2('0xcf')]});}})[_0x8ea2('0x2b')](function(){if(_0x2bbf85[_0x8ea2('0x9b')][_0x8ea2('0xd0')]&&_0x55d880){return db[_0x8ea2('0xa1')][_0x8ea2('0xa6')]({'phone':_0x2bbf85[_0x8ea2('0x9b')][_0x8ea2('0xd0')]},{'where':{'ContactId':_0x55d880['id']}});}})['then'](function(){return _0x55d880;})[_0x8ea2('0x2b')](respondWithResult(_0x4185d8,null))[_0x8ea2('0x91')](handleError(_0x4185d8,null));};exports[_0x8ea2('0xd1')]=function(_0xd93673,_0xcbb6b3,_0x4bdbe0){var _0x7ba3a3={};var _0x44791f={};var _0x959a31;var _0x2d541c;return db[_0x8ea2('0x86')]['findOne']({'where':{'id':_0xd93673[_0x8ea2('0x93')]['id']}})['then'](handleEntityNotFound(_0xcbb6b3,null))[_0x8ea2('0x2b')](function(_0x21b282){if(_0x21b282){_0x959a31=_0x21b282;_0x44791f[_0x8ea2('0x39')]=_['keys'](db[_0x8ea2('0x56')]['rawAttributes']);_0x44791f['query']=_['keys'](_0xd93673[_0x8ea2('0x3b')]);_0x44791f['filters']=_[_0x8ea2('0x3e')](_0x44791f[_0x8ea2('0x39')],_0x44791f[_0x8ea2('0x3b')]);_0x7ba3a3[_0x8ea2('0x3d')]=_[_0x8ea2('0x3e')](_0x44791f[_0x8ea2('0x39')],qs[_0x8ea2('0x3f')](_0xd93673[_0x8ea2('0x3b')]['fields']));_0x7ba3a3['attributes']=_0x7ba3a3[_0x8ea2('0x3d')][_0x8ea2('0x32')]?_0x7ba3a3[_0x8ea2('0x3d')]:_0x44791f['model'];_0x7ba3a3['order']=qs['sort'](_0xd93673[_0x8ea2('0x3b')]['sort']);_0x7ba3a3['where']=qs[_0x8ea2('0x3c')](_[_0x8ea2('0x43')](_0xd93673['query'],_0x44791f['filters']));if(_0xd93673[_0x8ea2('0x3b')]['filter']){_0x7ba3a3['where']=_[_0x8ea2('0x85')](_0x7ba3a3[_0x8ea2('0x42')],{'$or':_[_0x8ea2('0x81')](_0x7ba3a3['attributes'],function(_0x42cd0f){var _0x1cdedb={};_0x1cdedb[_0x42cd0f]={'$like':'%'+_0xd93673[_0x8ea2('0x3b')][_0x8ea2('0x68')]+'%'};return _0x1cdedb;})});}_0x7ba3a3=_[_0x8ea2('0x85')]({},_0x7ba3a3,_0xd93673['options']);return _0x959a31[_0x8ea2('0xd1')](_0x7ba3a3);}})['then'](function(_0x481fd0){if(_0x481fd0){_0x2d541c=_0x481fd0['length'];if(!_0xd93673[_0x8ea2('0x3b')]['hasOwnProperty']('nolimit')){_0x7ba3a3[_0x8ea2('0x25')]=qs[_0x8ea2('0x25')](_0xd93673[_0x8ea2('0x3b')][_0x8ea2('0x25')]);_0x7ba3a3[_0x8ea2('0x23')]=qs[_0x8ea2('0x23')](_0xd93673[_0x8ea2('0x3b')][_0x8ea2('0x23')]);}return _0x959a31['getTags'](_0x7ba3a3);}})[_0x8ea2('0x2b')](function(_0x1e216b){if(_0x1e216b){return _0x1e216b?{'count':_0x2d541c,'rows':_0x1e216b}:null;}})[_0x8ea2('0x2b')](respondWithResult(_0xcbb6b3,null))[_0x8ea2('0x91')](handleError(_0xcbb6b3,null));};exports[_0x8ea2('0xd2')]=function(_0x4cb596,_0x261e47,_0x4b042e){if(_0x4cb596[_0x8ea2('0x9b')]['id']){delete _0x4cb596['body']['id'];}return db[_0x8ea2('0x86')][_0x8ea2('0xd3')]({'where':{'id':_0x4cb596[_0x8ea2('0x93')]['id']}})[_0x8ea2('0x2b')](handleEntityNotFound(_0x261e47,null))['then'](function(_0x508ce6){if(_0x508ce6){return _0x508ce6['setTags'](_0x4cb596[_0x8ea2('0x9b')][_0x8ea2('0xd4')]||[]);}return null;})['then'](respondWithResult(_0x261e47,null))[_0x8ea2('0x91')](handleError(_0x261e47,null));};exports[_0x8ea2('0xd5')]=function(_0x24d578,_0x1c009e){var _0xad91b2=[];_0xad91b2[_0x8ea2('0x35')](addAdditionalPhones(_0x24d578[_0x8ea2('0x9b')]));Promise[_0x8ea2('0x36')](_0xad91b2)[_0x8ea2('0x2b')](function(){_0xad91b2=[];_0xad91b2[_0x8ea2('0x35')](deleteCmHopperPhones(_0x24d578[_0x8ea2('0x9b')]['id']));_0xad91b2[_0x8ea2('0x35')](addCmHopperPhones(_0x24d578[_0x8ea2('0x9b')]['id']));Promise['all'](_0xad91b2)[_0x8ea2('0x2b')](function(){return[0x1];})['then'](respondWithResult(_0x1c009e,null));});};function addAdditionalPhones(_0x570d9b){var _0x41ee31;return new Promise(function(_0x5cf367,_0x45a00a){return db[_0x8ea2('0xac')][_0x8ea2('0x2c')]({'where':{'CmContactId':_0x570d9b['id']}})[_0x8ea2('0x2b')](function(){var _0xff0fae=[];for(var _0x5c5d78=0x0;_0x5c5d78<_0x570d9b[_0x8ea2('0xd6')][_0x8ea2('0x32')];_0x5c5d78++){var _0x39add3=_0x570d9b['item_types']?_['isNil'](_0x570d9b[_0x8ea2('0xd7')][_0x5c5d78])?'':_0x570d9b[_0x8ea2('0xd7')][_0x5c5d78]:_0x570d9b['items'][_0x5c5d78][_0x8ea2('0xd8')]?_0x570d9b['items'][_0x5c5d78][_0x8ea2('0xd8')]:'';var _0x483261=_[_0x8ea2('0x60')](_0x570d9b[_0x8ea2('0xd6')][_0x5c5d78][_0x8ea2('0xd9')])?'':_0x570d9b[_0x8ea2('0xd6')][_0x5c5d78][_0x8ea2('0xd9')];var _0x24e4c7=_0x39add3+':'+_0x570d9b[_0x8ea2('0xd6')][_0x5c5d78]['phone']+'§'+_0x483261;if(_['isNil'](_0x41ee31))_0x41ee31=_0x24e4c7;else _0x41ee31+=';'+_0x24e4c7;_0xff0fae[_0x8ea2('0x35')](addAdditionalPhone(_0x570d9b['id'],_0x570d9b['items'][_0x5c5d78][_0x8ea2('0xd0')],_0x570d9b[_0x8ea2('0xd7')]?_[_0x8ea2('0x60')](_0x570d9b[_0x8ea2('0xd7')][_0x5c5d78])?null:_0x570d9b['item_types'][_0x5c5d78]:_0x570d9b[_0x8ea2('0xd6')][_0x5c5d78][_0x8ea2('0xd8')]?_0x570d9b['items'][_0x5c5d78][_0x8ea2('0xd8')]:null,_0x5c5d78,_0x483261));}Promise[_0x8ea2('0x36')](_0xff0fae)[_0x8ea2('0x2b')](function(){db['CmContact']['update']({'AdditionalPhones':_0x41ee31},{'where':{'id':_0x570d9b['id']}})['then'](function(){_0x5cf367(0x1);});});});});}function addAdditionalPhone(_0xf4682,_0x557f49,_0x1120c0,_0x488acb,_0x36bf4a){return db[_0x8ea2('0xac')][_0x8ea2('0x92')]({'where':{'CmContactId':_0xf4682,'item':_0x557f49}})[_0x8ea2('0x2b')](function(_0x54925a){if(_0x54925a)logger[_0x8ea2('0xa2')]('contact\x20phone\x20exists',_0x54925a);else{db['CmContactHasItem']['create']({'CmContactId':_0xf4682,'item':_0x557f49,'ItemTypeId':_0x1120c0,'OrderBy':_0x488acb,'ItemClass':_0x8ea2('0xda'),'description':_0x36bf4a});}});}function deletePhones(_0x2ac747){return db[_0x8ea2('0xac')]['destroy']({'where':{'CmContactId':_0x2ac747}});}function deleteCmHopperPhones(_0xcdb8f1){return new Promise(function(_0x2c6860,_0x229dec){return db[_0x8ea2('0xa1')][_0x8ea2('0x96')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xcdb8f1}})[_0x8ea2('0x2b')](function(_0x4604cb){db[_0x8ea2('0xdb')][_0x8ea2('0x2c')]({'where':{'CmHopperId':{'$in':_[_0x8ea2('0x81')](_0x4604cb,'id')}}});})[_0x8ea2('0x2b')](function(){_0x2c6860(0x1);});});}function addCmHopperPhones(_0xc35654){return new Promise(function(_0x355b91,_0x1cf414){return db['CmHopper']['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xc35654}})[_0x8ea2('0x2b')](function(_0x58b75c){var _0x7db85a=[];_[_0x8ea2('0x81')](_0x58b75c,function(_0x3ebbc8){_0x7db85a['push'](createCmHopperPhone(_0xc35654,_0x3ebbc8['id']));});Promise[_0x8ea2('0x36')](_0x7db85a)['then'](function(){_0x355b91(0x1);});});});}function createCmHopperPhone(_0x4e42f9,_0x1c850a){return new Promise(function(_0x46c1de,_0x6f4bf9){db[_0x8ea2('0xac')][_0x8ea2('0x96')]({'raw':!![],'attributes':[_0x8ea2('0xdc')],'where':{'CmContactId':_0x4e42f9,'ItemClass':_0x8ea2('0xda')},'include':[{'model':db['ContactItemType'],'attributes':[_0x8ea2('0xdd')],'as':_0x8ea2('0xc3')}],'order':[db[_0x8ea2('0x83')]['literal'](_0x8ea2('0xde'))]})[_0x8ea2('0x2b')](function(_0x5fd14f){var _0x4cf15e=0x1;var _0x1dbf22=_[_0x8ea2('0x81')](_0x5fd14f,function(_0x31d904){_0x31d904['CmHopperId']=_0x1c850a;_0x31d904['phone']=_0x31d904[_0x8ea2('0xdc')];_0x31d904['OrderBy']=_0x31d904[_0x8ea2('0xdf')]||_0x4cf15e;delete _0x31d904['ItemType.OrderBy'];_0x4cf15e=_0x4cf15e+0x1;return _0x31d904;});return db[_0x8ea2('0xdb')][_0x8ea2('0xba')](_0x1dbf22,{});})[_0x8ea2('0x2b')](function(){_0x46c1de(0x1);});});}function insertAdditionalPhones(_0x291b64,_0x27fe34){return new Promise(function(_0x49553f,_0x3a41ec){var _0x3a0866=[];for(var _0x9cd255=0x0;_0x9cd255<_0x27fe34[_0x8ea2('0x32')];_0x9cd255++){var _0x26b5c8=_0x27fe34[_0x9cd255];_0x3a0866[_0x8ea2('0x35')](parseContactItemType(_0x26b5c8));}Promise['all'](_0x3a0866)['then'](function(){var _0x1ba00d={'id':_0x291b64['id'],'items':_0x27fe34};return addAdditionalPhones(_0x1ba00d)[_0x8ea2('0x2b')](function(_0x4c70af){return addCmHopperPhones(_0x291b64['id']);});})[_0x8ea2('0x2b')](function(){_0x49553f(_0x291b64);});});}function parseContactItemType(_0x475b04){return new Promise(function(_0x1ca9a1,_0x279b7d){if(_0x475b04['hasOwnProperty'](_0x8ea2('0xd8'))){_0x1ca9a1(_0x475b04);}else{return db[_0x8ea2('0xc2')]['find']({'where':{'name':_0x475b04[_0x8ea2('0xc3')]}})['then'](function(_0x1a2388){if(_['isNil'](_0x1a2388))_0x475b04['ItemTypeId']=null;else _0x475b04[_0x8ea2('0xd8')]=_0x1a2388['id'];_0x1ca9a1(_0x475b04);});}});}exports[_0x8ea2('0xe0')]=function(_0xbb5964,_0x2bc279){return db['CmContactHasItem'][_0x8ea2('0x96')]({'raw':!![],'where':{'CmContactId':_0xbb5964[_0x8ea2('0x93')]['id'],'ItemClass':_0x8ea2('0xda')},'include':[{'model':db['ContactItemType'],'as':_0x8ea2('0xc3')}],'order':[[db[_0x8ea2('0x83')][_0x8ea2('0xc4')](_0x8ea2('0xde'))],[_0x8ea2('0xdd')]]})[_0x8ea2('0x2b')](function(_0x2282b2){return _0x2282b2;})['then'](respondWithResult(_0x2bc279,null))[_0x8ea2('0x91')](handleError(_0x2bc279,null));};exports[_0x8ea2('0xe1')]=function(_0x38a4b4,_0x3ad26a){return db[_0x8ea2('0xac')][_0x8ea2('0x96')]({'raw':!![],'where':{'CmContactId':_0x38a4b4[_0x8ea2('0x9b')][_0x8ea2('0xe2')]}})[_0x8ea2('0x2b')](function(_0x14e992){var _0x3a37fb=_[_0x8ea2('0x81')](_0x14e992,function(_0x556919){_0x556919['CmContactId']=_0x38a4b4[_0x8ea2('0x9b')]['toContactId'];return _0x556919;});return db[_0x8ea2('0xac')][_0x8ea2('0xba')](_0x3a37fb,{});})[_0x8ea2('0x2b')](function(_0xd496f9){return addCmHopperPhones(_0x38a4b4[_0x8ea2('0x9b')]['toContactId']);})[_0x8ea2('0x2b')](function(_0x642e9a){return['ok'];})['then'](respondWithResult(_0x3ad26a,null))[_0x8ea2('0x91')](handleError(_0x3ad26a,null));};exports[_0x8ea2('0xe3')]=function(_0x2988c8,_0x43ab2f){var _0x47a6dd=[];_0x47a6dd[_0x8ea2('0x35')](createCmHopperPhone(_0x2988c8[_0x8ea2('0x9b')]['id'],_0x2988c8[_0x8ea2('0x9b')][_0x8ea2('0xe4')]));Promise['all'](_0x47a6dd)[_0x8ea2('0x2b')](function(){return[0x1];})[_0x8ea2('0x2b')](respondWithResult(_0x43ab2f,null));};exports[_0x8ea2('0xe5')]=function(_0x59ae1f,_0x2686b8,_0x49c8d7){var _0x2dc764={'raw':![],'where':{}};var _0x5f0a08={};var _0x4d6379={'count':0x0,'rows':[]};return db[_0x8ea2('0x86')]['findOne']({'where':{'id':_0x59ae1f[_0x8ea2('0x93')]['id']}})[_0x8ea2('0x2b')](handleEntityNotFound(_0x2686b8,null))[_0x8ea2('0x2b')](function(_0x2c7daa){if(_0x2c7daa){_0x5f0a08['model']=_[_0x8ea2('0x3a')](db['CmHopper']['rawAttributes']);_0x5f0a08['query']=_['keys'](_0x59ae1f[_0x8ea2('0x3b')]);_0x5f0a08[_0x8ea2('0x3c')]=_[_0x8ea2('0x3e')](_0x5f0a08[_0x8ea2('0x39')],_0x5f0a08[_0x8ea2('0x3b')]);_0x2dc764['attributes']=_['intersection'](_0x5f0a08[_0x8ea2('0x39')],qs['fields'](_0x59ae1f['query'][_0x8ea2('0x3f')]));_0x2dc764[_0x8ea2('0x3d')]=_0x2dc764[_0x8ea2('0x3d')]['length']?_0x2dc764[_0x8ea2('0x3d')]:_0x5f0a08['model'];if(!_0x59ae1f[_0x8ea2('0x3b')][_0x8ea2('0x40')]('nolimit')){_0x2dc764[_0x8ea2('0x25')]=qs[_0x8ea2('0x25')](_0x59ae1f['query'][_0x8ea2('0x25')]);_0x2dc764[_0x8ea2('0x23')]=qs[_0x8ea2('0x23')](_0x59ae1f[_0x8ea2('0x3b')][_0x8ea2('0x23')]);}_0x2dc764[_0x8ea2('0x76')]=qs[_0x8ea2('0x41')](_0x59ae1f[_0x8ea2('0x3b')][_0x8ea2('0x41')]);_0x2dc764['where']=qs[_0x8ea2('0x3c')](_['pick'](_0x59ae1f[_0x8ea2('0x3b')],_0x5f0a08[_0x8ea2('0x3c')]));_0x2dc764[_0x8ea2('0x42')][_0x8ea2('0xe6')]=_0x2c7daa['id'];if(_0x59ae1f[_0x8ea2('0x3b')][_0x8ea2('0x68')]){_0x2dc764[_0x8ea2('0x42')]=_[_0x8ea2('0x85')](_0x2dc764['where'],{'$or':_['map'](_0x2dc764[_0x8ea2('0x3d')],function(_0x37cc04){var _0x2c71d0={};_0x2c71d0[_0x37cc04]={'$like':'%'+_0x59ae1f[_0x8ea2('0x3b')][_0x8ea2('0x68')]+'%'};return _0x2c71d0;})});}_0x2dc764=_['merge']({},_0x2dc764,_0x59ae1f[_0x8ea2('0xe7')]);return db[_0x8ea2('0xa1')]['count']({'where':_0x2dc764[_0x8ea2('0x42')]})[_0x8ea2('0x2b')](function(_0x3ac848){_0x4d6379['count']=_0x3ac848;if(_0x59ae1f['query'][_0x8ea2('0xe8')]){_0x2dc764['include']=[{'all':!![]}];}return db[_0x8ea2('0xa1')][_0x8ea2('0x96')](_0x2dc764);})[_0x8ea2('0x2b')](function(_0x474109){_0x4d6379[_0x8ea2('0xe9')]=_0x474109;return _0x4d6379;});}})[_0x8ea2('0x2b')](respondWithFilteredResult(_0x2686b8,_0x2dc764))[_0x8ea2('0x91')](handleError(_0x2686b8,null));};exports[_0x8ea2('0xea')]=function(_0x1451c2,_0x74f368,_0x2cd485){var _0x1945be={'raw':!![],'where':{}};var _0x1417ce={};var _0x250f66={'count':0x0,'rows':[]};return db[_0x8ea2('0x86')][_0x8ea2('0xd3')]({'where':{'id':_0x1451c2[_0x8ea2('0x93')]['id']}})[_0x8ea2('0x2b')](handleEntityNotFound(_0x74f368,null))[_0x8ea2('0x2b')](function(_0x5bc575){if(_0x5bc575){_0x1417ce['model']=_['keys'](db[_0x8ea2('0xae')][_0x8ea2('0xeb')]);_0x1417ce[_0x8ea2('0x3b')]=_[_0x8ea2('0x3a')](_0x1451c2['query']);_0x1417ce['filters']=_[_0x8ea2('0x3e')](_0x1417ce['model'],_0x1417ce[_0x8ea2('0x3b')]);_0x1945be[_0x8ea2('0x3d')]=_[_0x8ea2('0x3e')](_0x1417ce[_0x8ea2('0x39')],qs[_0x8ea2('0x3f')](_0x1451c2[_0x8ea2('0x3b')][_0x8ea2('0x3f')]));_0x1945be['attributes']=_0x1945be[_0x8ea2('0x3d')][_0x8ea2('0x32')]?_0x1945be[_0x8ea2('0x3d')]:_0x1417ce[_0x8ea2('0x39')];if(!_0x1451c2['query']['hasOwnProperty'](_0x8ea2('0xec'))){_0x1945be[_0x8ea2('0x25')]=qs[_0x8ea2('0x25')](_0x1451c2['query']['limit']);_0x1945be[_0x8ea2('0x23')]=qs['offset'](_0x1451c2[_0x8ea2('0x3b')][_0x8ea2('0x23')]);}_0x1945be[_0x8ea2('0x76')]=qs['sort'](_0x1451c2[_0x8ea2('0x3b')][_0x8ea2('0x41')]);_0x1945be[_0x8ea2('0x42')]=qs[_0x8ea2('0x3c')](_['pick'](_0x1451c2['query'],_0x1417ce[_0x8ea2('0x3c')]));_0x1945be[_0x8ea2('0x42')][_0x8ea2('0xe6')]=_0x5bc575['id'];if(_0x1451c2['query'][_0x8ea2('0x68')]){_0x1945be['where']=_[_0x8ea2('0x85')](_0x1945be['where'],{'$or':_[_0x8ea2('0x81')](_0x1945be['attributes'],function(_0x1ea4ff){var _0x1985ac={};_0x1985ac[_0x1ea4ff]={'$like':'%'+_0x1451c2[_0x8ea2('0x3b')][_0x8ea2('0x68')]+'%'};return _0x1985ac;})});}_0x1945be=_['merge']({},_0x1945be,_0x1451c2[_0x8ea2('0xe7')]);return db[_0x8ea2('0xae')][_0x8ea2('0x26')]({'where':_0x1945be[_0x8ea2('0x42')]})['then'](function(_0x31265e){_0x250f66[_0x8ea2('0x26')]=_0x31265e;if(_0x1451c2[_0x8ea2('0x3b')][_0x8ea2('0xe8')]){_0x1945be[_0x8ea2('0xed')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x8ea2('0x96')](_0x1945be);})[_0x8ea2('0x2b')](function(_0x306d01){_0x250f66[_0x8ea2('0xe9')]=_0x306d01;return _0x250f66;});}})['then'](respondWithFilteredResult(_0x74f368,_0x1945be))[_0x8ea2('0x91')](handleError(_0x74f368,null));};exports[_0x8ea2('0xee')]=function(_0x58a5cd,_0x532131,_0x5c5300){var _0x4035eb={'raw':!![],'where':{}};var _0x3eeecc={};var _0x348ce0={'count':0x0,'rows':[]};return db[_0x8ea2('0x86')][_0x8ea2('0xd3')]({'where':{'id':_0x58a5cd[_0x8ea2('0x93')]['id']}})['then'](handleEntityNotFound(_0x532131,null))['then'](function(_0xc099b6){if(_0xc099b6){_0x3eeecc[_0x8ea2('0x39')]=_[_0x8ea2('0x3a')](db['CmHopperFinal']['rawAttributes']);_0x3eeecc[_0x8ea2('0x3b')]=_[_0x8ea2('0x3a')](_0x58a5cd['query']);_0x3eeecc[_0x8ea2('0x3c')]=_['intersection'](_0x3eeecc[_0x8ea2('0x39')],_0x3eeecc[_0x8ea2('0x3b')]);_0x4035eb[_0x8ea2('0x3d')]=_['intersection'](_0x3eeecc[_0x8ea2('0x39')],qs[_0x8ea2('0x3f')](_0x58a5cd['query'][_0x8ea2('0x3f')]));_0x4035eb[_0x8ea2('0x3d')]=_0x4035eb['attributes']['length']?_0x4035eb[_0x8ea2('0x3d')]:_0x3eeecc[_0x8ea2('0x39')];if(!_0x58a5cd[_0x8ea2('0x3b')]['hasOwnProperty'](_0x8ea2('0xec'))){_0x4035eb[_0x8ea2('0x25')]=qs[_0x8ea2('0x25')](_0x58a5cd[_0x8ea2('0x3b')][_0x8ea2('0x25')]);_0x4035eb['offset']=qs[_0x8ea2('0x23')](_0x58a5cd['query'][_0x8ea2('0x23')]);}_0x4035eb['order']=qs[_0x8ea2('0x41')](_0x58a5cd[_0x8ea2('0x3b')][_0x8ea2('0x41')]);_0x4035eb[_0x8ea2('0x42')]=qs['filters'](_[_0x8ea2('0x43')](_0x58a5cd[_0x8ea2('0x3b')],_0x3eeecc[_0x8ea2('0x3c')]));_0x4035eb[_0x8ea2('0x42')][_0x8ea2('0xe6')]=_0xc099b6['id'];if(_0x58a5cd[_0x8ea2('0x3b')][_0x8ea2('0x68')]){_0x4035eb[_0x8ea2('0x42')]=_[_0x8ea2('0x85')](_0x4035eb[_0x8ea2('0x42')],{'$or':_[_0x8ea2('0x81')](_0x4035eb['attributes'],function(_0x2ab1da){var _0x2f71e5={};_0x2f71e5[_0x2ab1da]={'$like':'%'+_0x58a5cd[_0x8ea2('0x3b')]['filter']+'%'};return _0x2f71e5;})});}_0x4035eb=_[_0x8ea2('0x85')]({},_0x4035eb,_0x58a5cd[_0x8ea2('0xe7')]);return db[_0x8ea2('0xad')][_0x8ea2('0x26')]({'where':_0x4035eb[_0x8ea2('0x42')]})[_0x8ea2('0x2b')](function(_0x382a85){_0x348ce0[_0x8ea2('0x26')]=_0x382a85;if(_0x58a5cd[_0x8ea2('0x3b')][_0x8ea2('0xe8')]){_0x4035eb['include']=[{'all':!![]}];}return db[_0x8ea2('0xad')][_0x8ea2('0x96')](_0x4035eb);})[_0x8ea2('0x2b')](function(_0x432b84){_0x348ce0['rows']=_0x432b84;return _0x348ce0;});}})[_0x8ea2('0x2b')](respondWithFilteredResult(_0x532131,_0x4035eb))[_0x8ea2('0x91')](handleError(_0x532131,null));};exports[_0x8ea2('0xef')]=function(_0x10d2b3,_0x12a217,_0x45d011){var _0x109785={'raw':!![],'where':{}};var _0x4db2c3={};var _0x44b0dc={'count':0x0,'rows':[]};return db[_0x8ea2('0x86')]['findOne']({'where':{'id':_0x10d2b3[_0x8ea2('0x93')]['id']}})[_0x8ea2('0x2b')](handleEntityNotFound(_0x12a217,null))[_0x8ea2('0x2b')](function(_0x50ebcd){if(_0x50ebcd){_0x4db2c3['model']=_[_0x8ea2('0x3a')](db['JscriptySessionReport']['rawAttributes']);_0x4db2c3[_0x8ea2('0x3b')]=_[_0x8ea2('0x3a')](_0x10d2b3['query']);_0x4db2c3[_0x8ea2('0x3c')]=_[_0x8ea2('0x3e')](_0x4db2c3['model'],_0x4db2c3[_0x8ea2('0x3b')]);_0x109785['attributes']=_[_0x8ea2('0x3e')](_0x4db2c3[_0x8ea2('0x39')],qs[_0x8ea2('0x3f')](_0x10d2b3[_0x8ea2('0x3b')][_0x8ea2('0x3f')]));_0x109785[_0x8ea2('0x3d')]=_0x109785[_0x8ea2('0x3d')][_0x8ea2('0x32')]?_0x109785[_0x8ea2('0x3d')]:_0x4db2c3[_0x8ea2('0x39')];if(!_0x10d2b3[_0x8ea2('0x3b')][_0x8ea2('0x40')](_0x8ea2('0xec'))){_0x109785[_0x8ea2('0x25')]=qs[_0x8ea2('0x25')](_0x10d2b3[_0x8ea2('0x3b')]['limit']);_0x109785[_0x8ea2('0x23')]=qs[_0x8ea2('0x23')](_0x10d2b3['query']['offset']);}_0x109785[_0x8ea2('0x76')]=qs['sort'](_0x10d2b3['query'][_0x8ea2('0x41')]);_0x109785[_0x8ea2('0x42')]=qs[_0x8ea2('0x3c')](_['pick'](_0x10d2b3[_0x8ea2('0x3b')],_0x4db2c3[_0x8ea2('0x3c')]));_0x109785[_0x8ea2('0x42')]['ContactId']=_0x50ebcd['id'];if(_0x10d2b3[_0x8ea2('0x3b')]['filter']){_0x109785[_0x8ea2('0x42')]=_['merge'](_0x109785['where'],{'$or':_[_0x8ea2('0x81')](_0x109785[_0x8ea2('0x3d')],function(_0x10ae49){var _0x3d7695={};_0x3d7695[_0x10ae49]={'$like':'%'+_0x10d2b3[_0x8ea2('0x3b')][_0x8ea2('0x68')]+'%'};return _0x3d7695;})});}_0x109785=_[_0x8ea2('0x85')]({},_0x109785,_0x10d2b3[_0x8ea2('0xe7')]);return db[_0x8ea2('0xb5')][_0x8ea2('0x26')]({'where':_0x109785[_0x8ea2('0x42')]})[_0x8ea2('0x2b')](function(_0x540593){_0x44b0dc['count']=_0x540593;if(_0x10d2b3['query'][_0x8ea2('0xe8')]){_0x109785[_0x8ea2('0xed')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x109785);})[_0x8ea2('0x2b')](function(_0x6fe84){_0x44b0dc[_0x8ea2('0xe9')]=_0x6fe84;return _0x44b0dc;});}})[_0x8ea2('0x2b')](respondWithFilteredResult(_0x12a217,_0x109785))[_0x8ea2('0x91')](handleError(_0x12a217,null));};exports['uploadCsv']=function(_0x294220,_0x5736b9,_0x3c8cfe){try{if(!_0x294220['body'][_0x8ea2('0x62')]){throw new Error('No\x20ListId\x20specified');}if(!_0x294220[_0x8ea2('0x9b')][_0x8ea2('0xf0')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x294220['body'][_0x8ea2('0xf1')]){throw new Error(_0x8ea2('0xf2'));}if(!_0x294220[_0x8ea2('0x9b')][_0x8ea2('0xf3')]){throw new Error(_0x8ea2('0xf4'));}var _0x30a29a=_0x294220[_0x8ea2('0x9b')][_0x8ea2('0xf0')][_0x8ea2('0x58')](',');var _0x4b21a2=_0x294220[_0x8ea2('0x9b')][_0x8ea2('0xf1')][_0x8ea2('0x58')](',');if(!_0x30a29a[_0x8ea2('0x32')]||!_0x4b21a2[_0x8ea2('0x32')]||_0x30a29a['length']!==_0x4b21a2['length']){throw new Error(_0x8ea2('0xf5'));}_0x294220[_0x8ea2('0x9b')][_0x8ea2('0x3f')]=_[_0x8ea2('0xf6')](_0x30a29a,_0x4b21a2);if(!_0x294220[_0x8ea2('0x9b')][_0x8ea2('0x3f')][_0x8ea2('0xd0')]){throw new Error(_0x8ea2('0xf7'));}if(!_0x294220[_0x8ea2('0x9b')]['fields'][_0x8ea2('0xf8')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x546cb6=path[_0x8ea2('0x9f')](config[_0x8ea2('0xf9')],_0x8ea2('0xfa'),_0x294220[_0x8ea2('0xfb')][_0x8ea2('0xfc')]);fs[_0x8ea2('0xfd')](_0x546cb6,parseInt(_0x8ea2('0xfe'),0x8));var _0x405a86=require('child_process')[_0x8ea2('0xff')](path[_0x8ea2('0x9f')](__dirname,_0x8ea2('0x100')),[_0x546cb6,_0x294220[_0x8ea2('0x9b')][_0x8ea2('0xf0')],_0x294220['body']['binding_values'],_0x294220[_0x8ea2('0x9b')][_0x8ea2('0x62')],_0x294220[_0x8ea2('0x9b')][_0x8ea2('0x101')],_0x294220[_0x8ea2('0x9b')][_0x8ea2('0xbc')],_0x294220[_0x8ea2('0x9b')]['socket_timestamp']]);return _0x5736b9[_0x8ea2('0x20')](0xc8)[_0x8ea2('0x22')]({'message':'File\x20uploaded\x20correctly!','pid':_0x405a86[_0x8ea2('0x102')]});}catch(_0x5b9692){return _0x5736b9[_0x8ea2('0x20')](0x1f4)[_0x8ea2('0x2f')](_0x5b9692);}};exports[_0x8ea2('0x103')]=function(_0x2f7a76,_0x3e054c,_0x4fcb69){var _0x40b9d5=fs['createReadStream'](_0x2f7a76[_0x8ea2('0xfb')][_0x8ea2('0x8')]);Papa[_0x8ea2('0x104')](_0x40b9d5,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x55efe6){return _0x3e054c['status'](0xc8)[_0x8ea2('0x22')]({'file':_0x2f7a76[_0x8ea2('0xfb')],'fields':_0x55efe6[_0x8ea2('0x105')][_0x8ea2('0x3f')]});}});};exports[_0x8ea2('0x106')]=function(_0xc9cc,_0x69a44,_0x4e36be){return db[_0x8ea2('0x5a')][_0x8ea2('0x96')]({'raw':!![],'attributes':['id'],'where':{'role':_0x8ea2('0x7d')}})[_0x8ea2('0x2b')](function(_0x813581){var _0x3df861=![];if(!_0xc9cc[_0x8ea2('0x9b')][_0x8ea2('0x62')]){throw new Error(_0x8ea2('0x107'));}if(!_0xc9cc[_0x8ea2('0x9b')][_0x8ea2('0x108')][_0x8ea2('0xd0')]){throw new Error(_0x8ea2('0xf7'));}if(!_0xc9cc[_0x8ea2('0x9b')][_0x8ea2('0x108')][_0x8ea2('0xf8')]){throw new Error(_0x8ea2('0x109'));}if(!_0xc9cc['body']['socket_timestamp']){throw new Error(_0x8ea2('0xf4'));}var _0x1d6974=require(_0x8ea2('0x10a'))[_0x8ea2('0xff')](path[_0x8ea2('0x9f')](__dirname,_0x8ea2('0x10b')),[_0xc9cc['params']['id'],JSON[_0x8ea2('0x10c')](_0xc9cc['body']),JSON[_0x8ea2('0x10c')](_0x813581)]);_0x1d6974['on'](_0x8ea2('0x10d'),function(_0x4f731e){_0x3df861=!![];return _0x69a44[_0x8ea2('0x20')](0xc8)[_0x8ea2('0x22')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x1d6974[_0x8ea2('0x102')]});});_0x1d6974['on'](_0x8ea2('0x10e'),function(_0xe81353){if(_0xe81353&&!_0x3df861){return _0x69a44[_0x8ea2('0x20')](0x1f4)[_0x8ea2('0x22')]({'message':'error\x20child\x20process','pid':_0x1d6974['pid']});}});})['catch'](handleError(_0x69a44,null));};exports[_0x8ea2('0x10f')]=function(_0x199d37,_0x244f5e,_0x27d7ba){return db[_0x8ea2('0x5a')][_0x8ea2('0x96')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x8ea2('0x2b')](function(_0x363147){var _0x56945f=![];if(!_0x199d37['body'][_0x8ea2('0x62')]){throw new Error(_0x8ea2('0x107'));}if(!_0x199d37[_0x8ea2('0x9b')]['binding']['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x199d37['body']['binding'][_0x8ea2('0xf8')]){throw new Error(_0x8ea2('0x109'));}if(!_0x199d37['body'][_0x8ea2('0xf3')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0xd33a90=require(_0x8ea2('0x10a'))['fork'](path[_0x8ea2('0x9f')](__dirname,_0x8ea2('0x110')),[_0x199d37[_0x8ea2('0x93')]['id'],JSON['stringify'](_0x199d37[_0x8ea2('0x9b')]),JSON[_0x8ea2('0x10c')](_0x363147)]);_0xd33a90['on'](_0x8ea2('0x10d'),function(_0xe7d9dd){_0x56945f=!![];return _0x244f5e[_0x8ea2('0x20')](0xc8)[_0x8ea2('0x22')]({'message':_0x8ea2('0x111'),'pid':_0xd33a90['pid']});});_0xd33a90['on'](_0x8ea2('0x10e'),function(_0x1ac027){if(_0x1ac027&&!_0x56945f){return _0x244f5e[_0x8ea2('0x20')](0x1f4)['json']({'message':_0x8ea2('0x112'),'pid':_0xd33a90[_0x8ea2('0x102')]});}});})['catch'](handleError(_0x244f5e,null));};exports[_0x8ea2('0x113')]=function(_0x354be9,_0x5307a1){var _0x12026f=[_0x8ea2('0x114'),'chat','sms',_0x8ea2('0x115'),_0x8ea2('0x116'),_0x8ea2('0x117'),_0x8ea2('0x118')];var _0x540586={'offset':0x0,'order':qs[_0x8ea2('0x41')](_0x8ea2('0x119'))},_0x3eb4bf={'count':0x0,'rows':[]};Promise[_0x8ea2('0x7b')]()[_0x8ea2('0x2b')](function(){if(_0x354be9[_0x8ea2('0x3b')][_0x8ea2('0x11a')]){if(!_['includes'](_0x12026f,_0x354be9[_0x8ea2('0x3b')][_0x8ea2('0x11a')][_0x8ea2('0x11b')]())){throw new Error(_0x8ea2('0x11c'));}_0x12026f=[_0x354be9[_0x8ea2('0x3b')][_0x8ea2('0x11a')]['toLowerCase']()];}if(_0x354be9['query'][_0x8ea2('0x11d')]){try{var _0x189afd=JSON[_0x8ea2('0x104')](_0x354be9['query'][_0x8ea2('0x11d')]);if(!moment(_0x189afd[_0x8ea2('0x48')])['isValid']()){throw new Error(_0x8ea2('0x11e'));}if(!moment(_0x189afd['to'])[_0x8ea2('0x11f')]()){throw new Error(_0x8ea2('0x120'));}}catch(_0x1360b8){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x354be9[_0x8ea2('0x3b')]['hasOwnProperty'](_0x8ea2('0xec'))){_0x540586['limit']=qs[_0x8ea2('0x25')](_0x354be9[_0x8ea2('0x3b')][_0x8ea2('0x25')]||0xa);_0x540586['offset']=qs[_0x8ea2('0x23')](_0x354be9[_0x8ea2('0x3b')]['offset']);}var _0x498247=_0x12026f['map'](function(_0x3500b7){if(_0x3500b7===_0x8ea2('0x118')){var _0x2df47b={'attributes':['id',_0x8ea2('0x121'),'type',_0x8ea2('0x122'),_0x8ea2('0x123'),_0x8ea2('0x124'),'starttime','endtime','duration',_0x8ea2('0x125'),_0x8ea2('0x126'),_0x8ea2('0x127'),_0x8ea2('0x128'),'userThirdDisposition',_0x8ea2('0x129')],'where':{'ContactId':_0x354be9[_0x8ea2('0x93')]['id']},'include':[{'model':db[_0x8ea2('0x5a')],'as':_0x8ea2('0x5a'),'attributes':['id','name',_0x8ea2('0x12a'),_0x8ea2('0x99')]}],'order':[[_0x8ea2('0x126'),'DESC']]};if(_0x354be9['query'][_0x8ea2('0x11d')]){_0x2df47b[_0x8ea2('0x42')][_0x8ea2('0x126')]={'$gte':_0x189afd[_0x8ea2('0x48')],'$lte':_0x189afd['to']};}return db[_0x8ea2('0xb0')]['findAndCountAll'](_0x2df47b)[_0x8ea2('0x2b')](function(_0x5d4826){_0x3eb4bf['count']+=_0x5d4826[_0x8ea2('0x26')];return _[_0x8ea2('0x81')](_0x5d4826[_0x8ea2('0xe9')],function(_0x5a3896){var _0x4dd21e=_0x5a3896[_0x8ea2('0x9c')]({'plain':!![]});_0x4dd21e[_0x8ea2('0x11a')]=_0x3500b7;if(_0x4dd21e[_0x8ea2('0x5a')]){_0x4dd21e[_0x8ea2('0x5a')]={'id':_0x4dd21e[_0x8ea2('0x5a')]['id'],'name':_0x4dd21e[_0x8ea2('0x5a')][_0x8ea2('0x2e')],'fullname':_0x4dd21e[_0x8ea2('0x5a')][_0x8ea2('0x12a')],'alias':_0x4dd21e['User']['alias']};}return _0x4dd21e;});});}else{var _0x43b455=_[_0x8ea2('0x12b')](_0x3500b7)+(_0x3500b7==='chat'?_0x8ea2('0x12c'):_0x8ea2('0x12d'));var _0x264705={'attributes':['id','closed',_0x8ea2('0x12e'),_0x8ea2('0x126'),_0x8ea2('0x125'),'disposition',_0x8ea2('0x12f'),_0x8ea2('0x130'),_0x8ea2('0x129'),_0x43b455+'Id'],'where':{'ContactId':_0x354be9[_0x8ea2('0x93')]['id']},'include':[{'model':db[_0x43b455],'as':_0x8ea2('0x12d'),'attributes':['id',_0x8ea2('0x2e'),_0x8ea2('0x131')]},{'model':db[_0x8ea2('0x5a')],'as':_0x8ea2('0x132'),'attributes':['id',_0x8ea2('0x2e'),_0x8ea2('0x12a')]},{'model':db[_0x8ea2('0x56')],'as':'Tags','attributes':['id',_0x8ea2('0x2e'),_0x8ea2('0x45')],'through':{'attributes':[]}}],'order':[[_0x8ea2('0x126'),_0x8ea2('0x77')]]};if(_0x354be9[_0x8ea2('0x3b')][_0x8ea2('0x11d')]){_0x264705['where']['createdAt']={'$gte':_0x189afd[_0x8ea2('0x48')],'$lte':_0x189afd['to']};}switch(_0x3500b7){case _0x8ea2('0x133'):_0x264705[_0x8ea2('0x3d')][_0x8ea2('0x35')](_0x8ea2('0x134'),_0x8ea2('0x135'),'customerPort',_0x8ea2('0x136'),_0x8ea2('0x137'),_0x8ea2('0x138'),'ratingType',_0x8ea2('0x139'),_0x8ea2('0x13a'));break;case _0x8ea2('0x114'):_0x264705[_0x8ea2('0x3d')][_0x8ea2('0x35')](_0x8ea2('0x13b'),'substatus');break;case _0x8ea2('0x115'):_0x264705[_0x8ea2('0x3d')][_0x8ea2('0x35')](_0x8ea2('0x13c'),'threadId');break;}return db[_[_0x8ea2('0x12b')](_0x3500b7)+_0x8ea2('0x13d')][_0x8ea2('0x13e')](_0x264705)['then'](function(_0x56ab93){_0x3eb4bf[_0x8ea2('0x26')]+=_0x56ab93[_0x8ea2('0x26')];return _[_0x8ea2('0x81')](_0x56ab93['rows'],function(_0x5a9a54){var _0x1c0283=_0x5a9a54[_0x8ea2('0x9c')]({'plain':!![]});_0x1c0283[_0x8ea2('0x11a')]=_0x3500b7;if(_0x1c0283[_0x8ea2('0x132')]){_0x1c0283['Owner']={'id':_0x1c0283['Owner']['id'],'name':_0x1c0283[_0x8ea2('0x132')][_0x8ea2('0x2e')],'fullname':_0x1c0283['Owner'][_0x8ea2('0x12a')]};}return _0x1c0283;});});}});return Promise[_0x8ea2('0x36')](_0x498247);})['then'](function(_0x5dfe99){return _(_0x5dfe99)[_0x8ea2('0x13f')]()[_0x8ea2('0x140')]('createdAt')[_0x8ea2('0x141')]()[_0x8ea2('0x57')]();})[_0x8ea2('0x2b')](function(_0x308e2d){_0x3eb4bf[_0x8ea2('0xe9')]=_0x540586[_0x8ea2('0x25')]?_0x308e2d[_0x8ea2('0x142')](_0x540586[_0x8ea2('0x23')],_0x540586[_0x8ea2('0x23')]+_0x540586[_0x8ea2('0x25')]):_0x308e2d;return _0x3eb4bf;})[_0x8ea2('0x2b')](respondWithFilteredResult(_0x5307a1,_0x540586))['catch'](handleError(_0x5307a1,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index bc26292..7d4bcb6 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb015=['../../mysqldb','CmContact','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x51e7b5,_0x3cb7f1){var _0x421813=function(_0x7a9fe4){while(--_0x7a9fe4){_0x51e7b5['push'](_0x51e7b5['shift']());}};_0x421813(++_0x3cb7f1);}(_0xb015,0x86));var _0x5b01=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xb015[_0x13b8f3];return _0x1a6d06;};'use strict';var EventEmitter=require(_0x5b01('0x0'));var CmContact=require(_0x5b01('0x1'))['db'][_0x5b01('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5b01('0x3'),'afterUpdate':_0x5b01('0x4'),'afterDestroy':_0x5b01('0x5')};function emitEvent(_0x11c14e){return function(_0x23bf01,_0x181447,_0x2e6b0b){CmContactEvents[_0x5b01('0x6')](_0x11c14e+':'+_0x23bf01['id'],_0x23bf01);CmContactEvents[_0x5b01('0x6')](_0x11c14e,_0x23bf01);_0x2e6b0b(null);};}for(var e in events){if(events[_0x5b01('0x7')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x5b01('0x8')]=CmContactEvents; \ No newline at end of file +var _0x6583=['update','emit','exports','events','CmContact','setMaxListeners','save'];(function(_0x23f02f,_0x56bf52){var _0x1ec655=function(_0x549da3){while(--_0x549da3){_0x23f02f['push'](_0x23f02f['shift']());}};_0x1ec655(++_0x56bf52);}(_0x6583,0x6c));var _0x3658=function(_0x17a0a0,_0x1befaa){_0x17a0a0=_0x17a0a0-0x0;var _0x4da752=_0x6583[_0x17a0a0];return _0x4da752;};'use strict';var EventEmitter=require(_0x3658('0x0'));var CmContact=require('../../mysqldb')['db'][_0x3658('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x3658('0x2')](0x0);var events={'afterCreate':_0x3658('0x3'),'afterUpdate':_0x3658('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1be83f){return function(_0x4d551e,_0x20be63,_0x5ebd6e){CmContactEvents['emit'](_0x1be83f+':'+_0x4d551e['id'],_0x4d551e);CmContactEvents[_0x3658('0x5')](_0x1be83f,_0x4d551e);_0x5ebd6e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x3658('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index e3a974b..11108fa 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8e0=['models','get','error','cmContact','inspect','CmHopper','then','isNil','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','scheduledat','format','callbackUniqueid','YYYY-MM-DD\x20HH:mm:ss','catch','findOne','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','afterCreate','VoiceQueue','findAll','outbound','CmList','Lists','length','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','dialCheckDuplicateType','Campaign','List\x20not\x20found','isEmpty','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','../../config/logger','bluebird','path','rimraf','../../config/environment','./cmContact.attributes','exports','cm_contacts','phone','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci'];(function(_0xdba5af,_0x3a43bb){var _0x27b9da=function(_0x49d6be){while(--_0x49d6be){_0xdba5af['push'](_0xdba5af['shift']());}};_0x27b9da(++_0x3a43bb);}(_0xa8e0,0xad));var _0x0a8e=function(_0xd32fba,_0xa2dc58){_0xd32fba=_0xd32fba-0x0;var _0x343833=_0xa8e0[_0xd32fba];return _0x343833;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0a8e('0x0'))('api');var moment=require('moment');var BPromise=require(_0x0a8e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a8e('0x2'));var rimraf=require(_0x0a8e('0x3'));var config=require(_0x0a8e('0x4'));var attributes=require(_0x0a8e('0x5'));module[_0x0a8e('0x6')]=function(_0x106664,_0x559825){return _0x106664['define']('CmContact',attributes,{'tableName':_0x0a8e('0x7'),'paranoid':!![],'indexes':[{'name':_0x0a8e('0x8'),'fields':[_0x0a8e('0x8')]},{'name':'fti_cm_contacts','fields':['firstName',_0x0a8e('0x9'),_0x0a8e('0x8'),_0x0a8e('0xa'),_0x0a8e('0xb'),_0x0a8e('0xc')],'type':_0x0a8e('0xd')}],'timestamps':!![],'charset':_0x0a8e('0xe'),'collate':_0x0a8e('0xf'),'hooks':{'afterCreate':function(_0x46647,_0x5ea624,_0x20b883){var _0x195df6=_0x106664[_0x0a8e('0x10')];var _0x1ad65=_0x46647[_0x0a8e('0x11')]({'plain':!![]});function _0x20f123(){return function(_0x5bc6d2){logger[_0x0a8e('0x12')](_0x0a8e('0x13'),'afterCreate',util[_0x0a8e('0x14')](_0x5bc6d2,{'showHidden':![],'depth':null}));};}var _0x5817b8=function(_0x1d31b4){return new BPromise(function(_0x9e2cb6,_0x3e374e){_0x195df6[_0x0a8e('0x15')]['findOne']({'where':{'phone':_0x1ad65[_0x0a8e('0x8')],'VoiceQueueId':_0x1d31b4['id']}})[_0x0a8e('0x16')](function(_0x5d784d){if(!_[_0x0a8e('0x17')](_0x5d784d)){throw new Error(_0x0a8e('0x18')+_0x1ad65[_0x0a8e('0x8')]+_0x0a8e('0x19')+_0x1d31b4['id']);}return _0x195df6[_0x0a8e('0x15')][_0x0a8e('0x1a')]({'phone':_0x1ad65[_0x0a8e('0x8')],'ContactId':_0x1ad65['id'],'ListId':_0x1ad65[_0x0a8e('0x1b')],'priority':_0x1ad65[_0x0a8e('0x1c')]?_0x1ad65[_0x0a8e('0x1c')]:0x2,'scheduledat':_0x1ad65[_0x0a8e('0x1d')]?_0x1ad65['scheduledat']:moment()[_0x0a8e('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1ad65['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1ad65['callbackUniqueid']?_0x1ad65[_0x0a8e('0x1f')]:undefined,'callbackat':_0x1ad65['callbackUniqueid']?moment()[_0x0a8e('0x1e')](_0x0a8e('0x20')):undefined,'VoiceQueueId':_0x1d31b4['id']});})[_0x0a8e('0x21')](function(_0x29a68e){_0x3e374e(_0x29a68e);});});};var _0x49473d=function(_0x495728){return new BPromise(function(_0x3ed58b,_0x6f79c4){_0x195df6['CmHopper'][_0x0a8e('0x22')]({'where':{'phone':_0x1ad65[_0x0a8e('0x8')],'VoiceQueueId':_0x495728['id']}})[_0x0a8e('0x16')](function(_0x59a0dc){if(!_[_0x0a8e('0x17')](_0x59a0dc)){throw new Error(_0x0a8e('0x18')+_0x1ad65[_0x0a8e('0x8')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x495728['id']);}return _0x195df6[_0x0a8e('0x23')][_0x0a8e('0x22')]({'where':{'calleridnum':_0x1ad65[_0x0a8e('0x8')],'VoiceQueueId':_0x495728['id']}});})[_0x0a8e('0x16')](function(_0x50ec90){if(!_['isNil'](_0x50ec90)){throw new Error(_0x0a8e('0x24')+_0x1ad65['phone']+_0x0a8e('0x25')+_0x495728['id']);}return _0x195df6['CmHopper'][_0x0a8e('0x1a')]({'phone':_0x1ad65[_0x0a8e('0x8')],'ContactId':_0x1ad65['id'],'ListId':_0x1ad65['ListId'],'priority':_0x1ad65['priority']?_0x1ad65[_0x0a8e('0x1c')]:0x2,'scheduledat':_0x1ad65['scheduledat']?_0x1ad65[_0x0a8e('0x1d')]:moment()[_0x0a8e('0x1e')](_0x0a8e('0x20')),'callback':_0x1ad65[_0x0a8e('0x1f')]?!![]:![],'callbackuniqueid':_0x1ad65[_0x0a8e('0x1f')]?_0x1ad65['callbackUniqueid']:undefined,'callbackat':_0x1ad65[_0x0a8e('0x1f')]?moment()[_0x0a8e('0x1e')](_0x0a8e('0x20')):undefined,'VoiceQueueId':_0x495728['id']});})[_0x0a8e('0x21')](function(_0x49728c){_0x6f79c4(_0x49728c);});});};function _0xe94060(){return function(_0x21e388){logger[_0x0a8e('0x12')](_0x0a8e('0x13'),_0x0a8e('0x26'),util[_0x0a8e('0x14')](_0x21e388,{'showHidden':![],'depth':null}));};}var _0x1346c8=function(_0x21cae1){return new BPromise(function(_0x3d1906,_0x35a08e){_0x195df6['CmHopper'][_0x0a8e('0x22')]({'where':{'phone':_0x1ad65['phone'],'CampaignId':_0x21cae1['id']}})[_0x0a8e('0x16')](function(_0x356d40){if(!_[_0x0a8e('0x17')](_0x356d40)){throw new Error(_0x0a8e('0x18')+_0x1ad65[_0x0a8e('0x8')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x21cae1['id']);}return _0x195df6[_0x0a8e('0x15')][_0x0a8e('0x1a')]({'phone':_0x1ad65[_0x0a8e('0x8')],'ContactId':_0x1ad65['id'],'ListId':_0x1ad65['ListId'],'priority':_0x1ad65[_0x0a8e('0x1c')]?_0x1ad65[_0x0a8e('0x1c')]:0x2,'scheduledat':_0x1ad65[_0x0a8e('0x1d')]?_0x1ad65['scheduledat']:moment()[_0x0a8e('0x1e')](_0x0a8e('0x20')),'callback':_0x1ad65[_0x0a8e('0x1f')]?!![]:![],'callbackuniqueid':_0x1ad65[_0x0a8e('0x1f')]?_0x1ad65[_0x0a8e('0x1f')]:undefined,'callbackat':_0x1ad65[_0x0a8e('0x1f')]?moment()['format'](_0x0a8e('0x20')):undefined,'CampaignId':_0x21cae1['id']});})[_0x0a8e('0x21')](function(_0x27fd73){_0x35a08e(_0x27fd73);});});};var _0x15d30a=function(_0x21ee2b){return new BPromise(function(_0x40cc65,_0x1d3a1e){_0x195df6[_0x0a8e('0x15')][_0x0a8e('0x22')]({'where':{'phone':_0x1ad65[_0x0a8e('0x8')],'CampaignId':_0x21ee2b['id']}})[_0x0a8e('0x16')](function(_0x162a05){if(!_['isNil'](_0x162a05)){throw new Error(_0x0a8e('0x18')+_0x1ad65[_0x0a8e('0x8')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x21ee2b['id']);}return _0x195df6[_0x0a8e('0x23')][_0x0a8e('0x22')]({'where':{'calleridnum':_0x1ad65[_0x0a8e('0x8')],'CampaignId':_0x21ee2b['id']}});})[_0x0a8e('0x16')](function(_0x359c6b){if(!_['isNil'](_0x359c6b)){throw new Error(_0x0a8e('0x24')+_0x1ad65[_0x0a8e('0x8')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x21ee2b['id']);}return _0x195df6[_0x0a8e('0x15')]['create']({'phone':_0x1ad65[_0x0a8e('0x8')],'ContactId':_0x1ad65['id'],'ListId':_0x1ad65[_0x0a8e('0x1b')],'priority':_0x1ad65['priority']?_0x1ad65['priority']:0x2,'scheduledat':_0x1ad65[_0x0a8e('0x1d')]?_0x1ad65[_0x0a8e('0x1d')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1ad65[_0x0a8e('0x1f')]?!![]:![],'callbackuniqueid':_0x1ad65[_0x0a8e('0x1f')]?_0x1ad65[_0x0a8e('0x1f')]:undefined,'callbackat':_0x1ad65[_0x0a8e('0x1f')]?moment()[_0x0a8e('0x1e')](_0x0a8e('0x20')):undefined,'CampaignId':_0x21ee2b['id']});})[_0x0a8e('0x21')](function(_0x33a358){_0x1d3a1e(_0x33a358);});});};if(_0x1ad65[_0x0a8e('0x1b')]){_0x195df6[_0x0a8e('0x27')][_0x0a8e('0x28')]({'where':{'type':_0x0a8e('0x29')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':_0x195df6[_0x0a8e('0x2a')],'as':_0x0a8e('0x2b'),'where':{'id':_0x1ad65[_0x0a8e('0x1b')]}}]})[_0x0a8e('0x16')](function(_0x2a7af3){if(_0x2a7af3){var _0x19892c=[];for(var _0x317e92=0x0,_0xa04130;_0x317e92<_0x2a7af3[_0x0a8e('0x2c')];_0x317e92+=0x1){_0xa04130=_0x2a7af3[_0x317e92][_0x0a8e('0x11')]({'plain':!![]});switch(_0xa04130['dialCheckDuplicateType']){case _0x0a8e('0x2d'):_0x49473d(_0xa04130)[_0x0a8e('0x21')](_0x20f123());break;case _0x0a8e('0x2e'):_0x5817b8(_0xa04130)[_0x0a8e('0x21')](_0x20f123());break;default:_0x195df6[_0x0a8e('0x15')][_0x0a8e('0x1a')]({'phone':_0x1ad65[_0x0a8e('0x8')],'ContactId':_0x1ad65['id'],'ListId':_0x1ad65['ListId'],'scheduledat':_0x1ad65[_0x0a8e('0x1d')]?_0x1ad65[_0x0a8e('0x1d')]:moment()[_0x0a8e('0x1e')](_0x0a8e('0x20')),'priority':_0x1ad65['priority']?_0x1ad65[_0x0a8e('0x1c')]:0x2,'callback':_0x1ad65[_0x0a8e('0x1f')]?!![]:![],'callbackuniqueid':_0x1ad65['callbackUniqueid']?_0x1ad65[_0x0a8e('0x1f')]:undefined,'callbackat':_0x1ad65[_0x0a8e('0x1f')]?moment()[_0x0a8e('0x1e')](_0x0a8e('0x20')):undefined,'VoiceQueueId':_0xa04130['id']})[_0x0a8e('0x21')](_0x20f123());}}}})[_0x0a8e('0x16')](function(){return _0x195df6['VoiceQueue'][_0x0a8e('0x28')]({'where':{'type':_0x0a8e('0x29')},'attributes':['id'],'include':[{'model':_0x195df6[_0x0a8e('0x2a')],'as':_0x0a8e('0x2f'),'where':{'id':_0x1ad65[_0x0a8e('0x1b')]}}]})['then'](function(_0x1ae82d){if(_0x1ae82d){var _0x49fb52=[];for(var _0x2e1d6f=0x0,_0x2f16ca;_0x2e1d6f<_0x1ae82d[_0x0a8e('0x2c')];_0x2e1d6f+=0x1){_0x2f16ca=_0x1ae82d[_0x2e1d6f][_0x0a8e('0x11')]({'plain':!![]});_0x195df6[_0x0a8e('0x30')][_0x0a8e('0x1a')]({'phone':_0x1ad65[_0x0a8e('0x8')],'ContactId':_0x1ad65['id'],'ListId':_0x1ad65[_0x0a8e('0x1b')],'VoiceQueueId':_0x2f16ca['id']})[_0x0a8e('0x21')](function(_0x4b1005){logger[_0x0a8e('0x12')](_0x0a8e('0x31'),'afterCreate',_0x4b1005[_0x0a8e('0x32')]);});}}});})[_0x0a8e('0x16')](function(){return _0x195df6['Campaign'][_0x0a8e('0x28')]({'attributes':['id',_0x0a8e('0x33')],'include':[{'model':_0x195df6['CmList'],'as':_0x0a8e('0x2b'),'where':{'id':_0x1ad65[_0x0a8e('0x1b')]}}]})[_0x0a8e('0x16')](function(_0x5cf395){if(_0x5cf395){var _0x2d64ca=[];for(var _0xfdfbe4=0x0,_0x494dc3;_0xfdfbe4<_0x5cf395[_0x0a8e('0x2c')];_0xfdfbe4+=0x1){_0x494dc3=_0x5cf395[_0xfdfbe4][_0x0a8e('0x11')]({'plain':!![]});switch(_0x494dc3[_0x0a8e('0x33')]){case _0x0a8e('0x2d'):_0x15d30a(_0x494dc3)['catch'](_0xe94060());break;case _0x0a8e('0x2e'):_0x1346c8(_0x494dc3)[_0x0a8e('0x21')](_0xe94060());break;default:_0x195df6[_0x0a8e('0x15')][_0x0a8e('0x1a')]({'phone':_0x1ad65['phone'],'ContactId':_0x1ad65['id'],'ListId':_0x1ad65[_0x0a8e('0x1b')],'scheduledat':_0x1ad65[_0x0a8e('0x1d')]?_0x1ad65[_0x0a8e('0x1d')]:moment()[_0x0a8e('0x1e')](_0x0a8e('0x20')),'priority':_0x1ad65[_0x0a8e('0x1c')]?_0x1ad65[_0x0a8e('0x1c')]:0x2,'callback':_0x1ad65[_0x0a8e('0x1f')]?!![]:![],'callbackuniqueid':_0x1ad65[_0x0a8e('0x1f')]?_0x1ad65[_0x0a8e('0x1f')]:undefined,'callbackat':_0x1ad65['callbackUniqueid']?moment()[_0x0a8e('0x1e')](_0x0a8e('0x20')):undefined,'CampaignId':_0x494dc3['id']})['catch'](_0xe94060());}}}});})[_0x0a8e('0x16')](function(){return _0x195df6[_0x0a8e('0x34')][_0x0a8e('0x28')]({'attributes':['id'],'include':[{'model':_0x195df6[_0x0a8e('0x2a')],'as':'BlackLists','where':{'id':_0x1ad65[_0x0a8e('0x1b')]}}]})[_0x0a8e('0x16')](function(_0x3d5748){if(_0x3d5748){var _0x1b5b1a=[];for(var _0xb4c96b=0x0,_0x13c6d8;_0xb4c96b<_0x3d5748['length'];_0xb4c96b+=0x1){_0x13c6d8=_0x3d5748[_0xb4c96b][_0x0a8e('0x11')]({'plain':!![]});_0x195df6[_0x0a8e('0x30')][_0x0a8e('0x1a')]({'phone':_0x1ad65['phone'],'ContactId':_0x1ad65['id'],'ListId':_0x1ad65[_0x0a8e('0x1b')],'CampaignId':_0x13c6d8['id']})['catch'](function(_0x4485c5){logger['error'](_0x0a8e('0x31'),_0x0a8e('0x26'),_0x4485c5[_0x0a8e('0x32')]);});}}});})[_0x0a8e('0x16')](function(){_0x20b883();})[_0x0a8e('0x21')](function(_0x40a021){logger[_0x0a8e('0x12')](_0x0a8e('0x31'),_0x0a8e('0x26'),_0x40a021[_0x0a8e('0x32')]);_0x20b883(_0x40a021);});}else{_0x20b883(new Error(_0x0a8e('0x35')));}},'afterDestroy':function(_0x2859a0,_0x612103,_0x4d66d5){var _0x1fc0da=_0x106664[_0x0a8e('0x10')];var _0x1a096f=_0x2859a0[_0x0a8e('0x11')]({'plain':!![]});return _0x1fc0da[_0x0a8e('0x15')]['findAll']({'raw':!![],'where':{'ListId':_0x1a096f[_0x0a8e('0x1b')],'ContactId':_0x1a096f['id']}})[_0x0a8e('0x16')](function(_0x1137ab){if(!_[_0x0a8e('0x36')](_0x1137ab)){var _0x62bc62=[];for(var _0x5b8717=0x0;_0x5b8717<_0x1137ab[_0x0a8e('0x2c')];_0x5b8717+=0x1){var _0x22fed6=_0x1fc0da[_0x0a8e('0x15')]['destroy']({'where':{'ListId':_0x1137ab[_0x5b8717][_0x0a8e('0x1b')],'ContactId':_0x1137ab[_0x5b8717][_0x0a8e('0x37')],'VoiceQueueId':_0x1137ab[_0x5b8717][_0x0a8e('0x38')],'CampaignId':_0x1137ab[_0x5b8717][_0x0a8e('0x39')]}});_0x62bc62[_0x0a8e('0x3a')](_0x22fed6);}return BPromise[_0x0a8e('0x3b')](_0x62bc62);}})['then'](function(_0x44a621){logger[_0x0a8e('0x3c')](_0x0a8e('0x3d'),util['inspect'](_0x44a621,{'showHidden':![],'depth':null}));_0x4d66d5();})[_0x0a8e('0x21')](function(_0x4393b2){logger['error'](_0x0a8e('0x3e'),util['inspect'](_0x4393b2,{'showHidden':![],'depth':null}));_0x4d66d5(_0x4393b2);});}}});}; \ No newline at end of file +var _0x1ec6=['CmContact','cm_contacts','phone','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','get','error','cmContact','afterCreate','inspect','CmHopper','isNil','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','callbackUniqueid','catch','findOne','then','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','outbound','dialCheckDuplicateType','CmList','Lists','always','onlyIfOpen','findAll','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','List\x20not\x20found','models','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmContact.attributes','exports','define'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1ec6,0x158));var _0x61ec=function(_0xd45112,_0x68c8b4){_0xd45112=_0xd45112-0x0;var _0x2cddb8=_0x1ec6[_0xd45112];return _0x2cddb8;};'use strict';var _=require(_0x61ec('0x0'));var util=require(_0x61ec('0x1'));var logger=require(_0x61ec('0x2'))(_0x61ec('0x3'));var moment=require('moment');var BPromise=require(_0x61ec('0x4'));var rp=require(_0x61ec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61ec('0x6'));var config=require(_0x61ec('0x7'));var attributes=require(_0x61ec('0x8'));module[_0x61ec('0x9')]=function(_0x2bd635,_0x17c12d){return _0x2bd635[_0x61ec('0xa')](_0x61ec('0xb'),attributes,{'tableName':_0x61ec('0xc'),'paranoid':!![],'indexes':[{'name':_0x61ec('0xd'),'fields':['phone']},{'name':'fti_cm_contacts','fields':[_0x61ec('0xe'),_0x61ec('0xf'),_0x61ec('0xd'),_0x61ec('0x10'),_0x61ec('0x11'),_0x61ec('0x12')],'type':_0x61ec('0x13')}],'timestamps':!![],'charset':_0x61ec('0x14'),'collate':_0x61ec('0x15'),'hooks':{'afterCreate':function(_0x1833b7,_0x513329,_0x5a293e){var _0x401c83=_0x2bd635['models'];var _0x48d684=_0x1833b7[_0x61ec('0x16')]({'plain':!![]});function _0x5012dc(){return function(_0x5912ef){logger[_0x61ec('0x17')](_0x61ec('0x18'),_0x61ec('0x19'),util[_0x61ec('0x1a')](_0x5912ef,{'showHidden':![],'depth':null}));};}var _0x48c6d0=function(_0x5db7be){return new BPromise(function(_0xaa68e6,_0x11e521){_0x401c83[_0x61ec('0x1b')]['findOne']({'where':{'phone':_0x48d684[_0x61ec('0xd')],'VoiceQueueId':_0x5db7be['id']}})['then'](function(_0x5ad163){if(!_[_0x61ec('0x1c')](_0x5ad163)){throw new Error(_0x61ec('0x1d')+_0x48d684[_0x61ec('0xd')]+_0x61ec('0x1e')+_0x5db7be['id']);}return _0x401c83[_0x61ec('0x1b')][_0x61ec('0x1f')]({'phone':_0x48d684[_0x61ec('0xd')],'ContactId':_0x48d684['id'],'ListId':_0x48d684[_0x61ec('0x20')],'priority':_0x48d684[_0x61ec('0x21')]?_0x48d684[_0x61ec('0x21')]:0x2,'scheduledat':_0x48d684[_0x61ec('0x22')]?_0x48d684[_0x61ec('0x22')]:moment()[_0x61ec('0x23')](_0x61ec('0x24')),'callback':_0x48d684[_0x61ec('0x25')]?!![]:![],'callbackuniqueid':_0x48d684[_0x61ec('0x25')]?_0x48d684[_0x61ec('0x25')]:undefined,'callbackat':_0x48d684['callbackUniqueid']?moment()['format'](_0x61ec('0x24')):undefined,'VoiceQueueId':_0x5db7be['id']});})[_0x61ec('0x26')](function(_0x214d70){_0x11e521(_0x214d70);});});};var _0x184f5a=function(_0x2b476e){return new BPromise(function(_0x4c8432,_0xd67819){_0x401c83['CmHopper'][_0x61ec('0x27')]({'where':{'phone':_0x48d684['phone'],'VoiceQueueId':_0x2b476e['id']}})[_0x61ec('0x28')](function(_0x221ce4){if(!_[_0x61ec('0x1c')](_0x221ce4)){throw new Error(_0x61ec('0x1d')+_0x48d684[_0x61ec('0xd')]+_0x61ec('0x29')+_0x2b476e['id']);}return _0x401c83[_0x61ec('0x2a')][_0x61ec('0x27')]({'where':{'calleridnum':_0x48d684[_0x61ec('0xd')],'VoiceQueueId':_0x2b476e['id']}});})[_0x61ec('0x28')](function(_0x575f98){if(!_[_0x61ec('0x1c')](_0x575f98)){throw new Error(_0x61ec('0x2b')+_0x48d684[_0x61ec('0xd')]+_0x61ec('0x2c')+_0x2b476e['id']);}return _0x401c83['CmHopper'][_0x61ec('0x1f')]({'phone':_0x48d684[_0x61ec('0xd')],'ContactId':_0x48d684['id'],'ListId':_0x48d684[_0x61ec('0x20')],'priority':_0x48d684[_0x61ec('0x21')]?_0x48d684[_0x61ec('0x21')]:0x2,'scheduledat':_0x48d684[_0x61ec('0x22')]?_0x48d684[_0x61ec('0x22')]:moment()[_0x61ec('0x23')](_0x61ec('0x24')),'callback':_0x48d684['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x48d684[_0x61ec('0x25')]?_0x48d684[_0x61ec('0x25')]:undefined,'callbackat':_0x48d684[_0x61ec('0x25')]?moment()['format'](_0x61ec('0x24')):undefined,'VoiceQueueId':_0x2b476e['id']});})[_0x61ec('0x26')](function(_0x5478ea){_0xd67819(_0x5478ea);});});};function _0x4d1529(){return function(_0x3b1c6d){logger['error'](_0x61ec('0x18'),_0x61ec('0x19'),util[_0x61ec('0x1a')](_0x3b1c6d,{'showHidden':![],'depth':null}));};}var _0x3afac3=function(_0xa3c575){return new BPromise(function(_0x46e3a8,_0x9a61f9){_0x401c83['CmHopper'][_0x61ec('0x27')]({'where':{'phone':_0x48d684[_0x61ec('0xd')],'CampaignId':_0xa3c575['id']}})['then'](function(_0x20abc7){if(!_['isNil'](_0x20abc7)){throw new Error(_0x61ec('0x1d')+_0x48d684[_0x61ec('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0xa3c575['id']);}return _0x401c83[_0x61ec('0x1b')][_0x61ec('0x1f')]({'phone':_0x48d684[_0x61ec('0xd')],'ContactId':_0x48d684['id'],'ListId':_0x48d684[_0x61ec('0x20')],'priority':_0x48d684[_0x61ec('0x21')]?_0x48d684['priority']:0x2,'scheduledat':_0x48d684[_0x61ec('0x22')]?_0x48d684[_0x61ec('0x22')]:moment()['format'](_0x61ec('0x24')),'callback':_0x48d684['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x48d684[_0x61ec('0x25')]?_0x48d684[_0x61ec('0x25')]:undefined,'callbackat':_0x48d684['callbackUniqueid']?moment()[_0x61ec('0x23')](_0x61ec('0x24')):undefined,'CampaignId':_0xa3c575['id']});})[_0x61ec('0x26')](function(_0x2fcc7c){_0x9a61f9(_0x2fcc7c);});});};var _0x3adc74=function(_0x45a941){return new BPromise(function(_0x96f82b,_0x454b8e){_0x401c83[_0x61ec('0x1b')][_0x61ec('0x27')]({'where':{'phone':_0x48d684['phone'],'CampaignId':_0x45a941['id']}})['then'](function(_0x3c859f){if(!_[_0x61ec('0x1c')](_0x3c859f)){throw new Error('cmContact,\x20afterCreate\x20'+_0x48d684['phone']+_0x61ec('0x2d')+_0x45a941['id']);}return _0x401c83[_0x61ec('0x2a')][_0x61ec('0x27')]({'where':{'calleridnum':_0x48d684[_0x61ec('0xd')],'CampaignId':_0x45a941['id']}});})[_0x61ec('0x28')](function(_0x5ad1ec){if(!_[_0x61ec('0x1c')](_0x5ad1ec)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x48d684['phone']+_0x61ec('0x2e')+_0x45a941['id']);}return _0x401c83['CmHopper']['create']({'phone':_0x48d684[_0x61ec('0xd')],'ContactId':_0x48d684['id'],'ListId':_0x48d684[_0x61ec('0x20')],'priority':_0x48d684[_0x61ec('0x21')]?_0x48d684[_0x61ec('0x21')]:0x2,'scheduledat':_0x48d684['scheduledat']?_0x48d684[_0x61ec('0x22')]:moment()['format'](_0x61ec('0x24')),'callback':_0x48d684[_0x61ec('0x25')]?!![]:![],'callbackuniqueid':_0x48d684['callbackUniqueid']?_0x48d684['callbackUniqueid']:undefined,'callbackat':_0x48d684[_0x61ec('0x25')]?moment()[_0x61ec('0x23')](_0x61ec('0x24')):undefined,'CampaignId':_0x45a941['id']});})[_0x61ec('0x26')](function(_0x2b19b7){_0x454b8e(_0x2b19b7);});});};if(_0x48d684[_0x61ec('0x20')]){_0x401c83[_0x61ec('0x2f')]['findAll']({'where':{'type':_0x61ec('0x30')},'attributes':['id',_0x61ec('0x31')],'include':[{'model':_0x401c83[_0x61ec('0x32')],'as':_0x61ec('0x33'),'where':{'id':_0x48d684['ListId']}}]})[_0x61ec('0x28')](function(_0x34d047){if(_0x34d047){var _0x10f64a=[];for(var _0xb8776a=0x0,_0x131759;_0xb8776a<_0x34d047['length'];_0xb8776a+=0x1){_0x131759=_0x34d047[_0xb8776a][_0x61ec('0x16')]({'plain':!![]});switch(_0x131759['dialCheckDuplicateType']){case _0x61ec('0x34'):_0x184f5a(_0x131759)[_0x61ec('0x26')](_0x5012dc());break;case _0x61ec('0x35'):_0x48c6d0(_0x131759)[_0x61ec('0x26')](_0x5012dc());break;default:_0x401c83[_0x61ec('0x1b')]['create']({'phone':_0x48d684[_0x61ec('0xd')],'ContactId':_0x48d684['id'],'ListId':_0x48d684[_0x61ec('0x20')],'scheduledat':_0x48d684[_0x61ec('0x22')]?_0x48d684[_0x61ec('0x22')]:moment()[_0x61ec('0x23')](_0x61ec('0x24')),'priority':_0x48d684[_0x61ec('0x21')]?_0x48d684[_0x61ec('0x21')]:0x2,'callback':_0x48d684['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x48d684['callbackUniqueid']?_0x48d684[_0x61ec('0x25')]:undefined,'callbackat':_0x48d684[_0x61ec('0x25')]?moment()['format'](_0x61ec('0x24')):undefined,'VoiceQueueId':_0x131759['id']})[_0x61ec('0x26')](_0x5012dc());}}}})['then'](function(){return _0x401c83[_0x61ec('0x2f')][_0x61ec('0x36')]({'where':{'type':_0x61ec('0x30')},'attributes':['id'],'include':[{'model':_0x401c83[_0x61ec('0x32')],'as':_0x61ec('0x37'),'where':{'id':_0x48d684[_0x61ec('0x20')]}}]})[_0x61ec('0x28')](function(_0x32dc76){if(_0x32dc76){var _0x5e7a99=[];for(var _0x9b2a9d=0x0,_0x5770a8;_0x9b2a9d<_0x32dc76[_0x61ec('0x38')];_0x9b2a9d+=0x1){_0x5770a8=_0x32dc76[_0x9b2a9d]['get']({'plain':!![]});_0x401c83[_0x61ec('0x39')]['create']({'phone':_0x48d684[_0x61ec('0xd')],'ContactId':_0x48d684['id'],'ListId':_0x48d684[_0x61ec('0x20')],'VoiceQueueId':_0x5770a8['id']})[_0x61ec('0x26')](function(_0x4010fd){logger[_0x61ec('0x17')](_0x61ec('0x3a'),'afterCreate',_0x4010fd[_0x61ec('0x3b')]);});}}});})[_0x61ec('0x28')](function(){return _0x401c83[_0x61ec('0x3c')][_0x61ec('0x36')]({'attributes':['id',_0x61ec('0x31')],'include':[{'model':_0x401c83[_0x61ec('0x32')],'as':_0x61ec('0x33'),'where':{'id':_0x48d684['ListId']}}]})[_0x61ec('0x28')](function(_0x441661){if(_0x441661){var _0x55c116=[];for(var _0x13c6f2=0x0,_0x24c42c;_0x13c6f2<_0x441661[_0x61ec('0x38')];_0x13c6f2+=0x1){_0x24c42c=_0x441661[_0x13c6f2]['get']({'plain':!![]});switch(_0x24c42c[_0x61ec('0x31')]){case _0x61ec('0x34'):_0x3adc74(_0x24c42c)[_0x61ec('0x26')](_0x4d1529());break;case _0x61ec('0x35'):_0x3afac3(_0x24c42c)['catch'](_0x4d1529());break;default:_0x401c83['CmHopper']['create']({'phone':_0x48d684[_0x61ec('0xd')],'ContactId':_0x48d684['id'],'ListId':_0x48d684[_0x61ec('0x20')],'scheduledat':_0x48d684[_0x61ec('0x22')]?_0x48d684['scheduledat']:moment()[_0x61ec('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x48d684[_0x61ec('0x21')]?_0x48d684[_0x61ec('0x21')]:0x2,'callback':_0x48d684[_0x61ec('0x25')]?!![]:![],'callbackuniqueid':_0x48d684[_0x61ec('0x25')]?_0x48d684[_0x61ec('0x25')]:undefined,'callbackat':_0x48d684['callbackUniqueid']?moment()[_0x61ec('0x23')](_0x61ec('0x24')):undefined,'CampaignId':_0x24c42c['id']})[_0x61ec('0x26')](_0x4d1529());}}}});})['then'](function(){return _0x401c83[_0x61ec('0x3c')][_0x61ec('0x36')]({'attributes':['id'],'include':[{'model':_0x401c83[_0x61ec('0x32')],'as':_0x61ec('0x37'),'where':{'id':_0x48d684[_0x61ec('0x20')]}}]})[_0x61ec('0x28')](function(_0x1af46b){if(_0x1af46b){var _0x30c423=[];for(var _0x1b8930=0x0,_0x134e7d;_0x1b8930<_0x1af46b['length'];_0x1b8930+=0x1){_0x134e7d=_0x1af46b[_0x1b8930]['get']({'plain':!![]});_0x401c83['CmHopperBlack'][_0x61ec('0x1f')]({'phone':_0x48d684[_0x61ec('0xd')],'ContactId':_0x48d684['id'],'ListId':_0x48d684[_0x61ec('0x20')],'CampaignId':_0x134e7d['id']})['catch'](function(_0x1c448d){logger[_0x61ec('0x17')](_0x61ec('0x3a'),_0x61ec('0x19'),_0x1c448d[_0x61ec('0x3b')]);});}}});})['then'](function(){_0x5a293e();})[_0x61ec('0x26')](function(_0x47dd2c){logger[_0x61ec('0x17')](_0x61ec('0x3a'),_0x61ec('0x19'),_0x47dd2c[_0x61ec('0x3b')]);_0x5a293e(_0x47dd2c);});}else{_0x5a293e(new Error(_0x61ec('0x3d')));}},'afterDestroy':function(_0x571609,_0xc7f9c6,_0x2b5e98){var _0x59ed45=_0x2bd635[_0x61ec('0x3e')];var _0x8adaa6=_0x571609[_0x61ec('0x16')]({'plain':!![]});return _0x59ed45['CmHopper'][_0x61ec('0x36')]({'raw':!![],'where':{'ListId':_0x8adaa6['ListId'],'ContactId':_0x8adaa6['id']}})['then'](function(_0x25e2e2){if(!_['isEmpty'](_0x25e2e2)){var _0x47ca33=[];for(var _0x9f24e9=0x0;_0x9f24e9<_0x25e2e2[_0x61ec('0x38')];_0x9f24e9+=0x1){var _0x345581=_0x59ed45[_0x61ec('0x1b')][_0x61ec('0x3f')]({'where':{'ListId':_0x25e2e2[_0x9f24e9][_0x61ec('0x20')],'ContactId':_0x25e2e2[_0x9f24e9][_0x61ec('0x40')],'VoiceQueueId':_0x25e2e2[_0x9f24e9][_0x61ec('0x41')],'CampaignId':_0x25e2e2[_0x9f24e9][_0x61ec('0x42')]}});_0x47ca33[_0x61ec('0x43')](_0x345581);}return BPromise[_0x61ec('0x44')](_0x47ca33);}})[_0x61ec('0x28')](function(_0x434746){logger[_0x61ec('0x45')](_0x61ec('0x46'),util['inspect'](_0x434746,{'showHidden':![],'depth':null}));_0x2b5e98();})['catch'](function(_0x5ae1b4){logger[_0x61ec('0x17')]('[CmContact][afterDestroy][Error]',util[_0x61ec('0x1a')](_0x5ae1b4,{'showHidden':![],'depth':null}));_0x2b5e98(_0x5ae1b4);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 212d36a..99df198 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3dab=['randomstring','ioredis','squel','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./cmContact.socket','register','then','request\x20sent','CmContact,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContact,\x20%s,\x20%s','message','result','catch','GetCmContact','CmContact','findAll','options','raw','where','limit','map','model','attributes','include','info','debug','CreateCmContact','create','body','keys','length','cf_','update','table','cm_contacts','set','id\x20=\x20?','toString','sequelize','query','lodash','moment'];(function(_0x136a01,_0x3e0f10){var _0x39ccee=function(_0x1fa530){while(--_0x1fa530){_0x136a01['push'](_0x136a01['shift']());}};_0x39ccee(++_0x3e0f10);}(_0x3dab,0x64));var _0xb3da=function(_0x511c1c,_0x338c3d){_0x511c1c=_0x511c1c-0x0;var _0x2c045b=_0x3dab[_0x511c1c];return _0x2c045b;};'use strict';var _=require(_0xb3da('0x0'));var util=require('util');var moment=require(_0xb3da('0x1'));var BPromise=require('bluebird');var rs=require(_0xb3da('0x2'));var fs=require('fs');var Redis=require(_0xb3da('0x3'));var squel=require(_0xb3da('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb3da('0x5'))(_0xb3da('0x6'));var config=require(_0xb3da('0x7'));var jayson=require(_0xb3da('0x8'));var client=jayson['client'][_0xb3da('0x9')]({'port':0x232a});config[_0xb3da('0xa')]=_['defaults'](config[_0xb3da('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb3da('0xb'))(new Redis(config[_0xb3da('0xa')]));require(_0xb3da('0xc'))[_0xb3da('0xd')](socket);function respondWithRpcPromise(_0xdc7199,_0x9405d1,_0x111a31){return new BPromise(function(_0x323546,_0x212667){return client['request'](_0xdc7199,_0x111a31)[_0xb3da('0xe')](function(_0x2b6571){logger['info']('CmContact,\x20%s,\x20%s',_0x9405d1,_0xb3da('0xf'));logger['debug'](_0xb3da('0x10'),_0x9405d1,'request\x20sent',JSON[_0xb3da('0x11')](_0x2b6571));if(_0x2b6571['error']){if(_0x2b6571[_0xb3da('0x12')][_0xb3da('0x13')]===0x1f4){logger[_0xb3da('0x12')](_0xb3da('0x14'),_0x9405d1,_0x2b6571[_0xb3da('0x12')]['message']);return _0x212667(_0x2b6571[_0xb3da('0x12')][_0xb3da('0x15')]);}logger[_0xb3da('0x12')](_0xb3da('0x14'),_0x9405d1,_0x2b6571[_0xb3da('0x12')][_0xb3da('0x15')]);return _0x323546(_0x2b6571[_0xb3da('0x12')]['message']);}else{logger['info']('CmContact,\x20%s,\x20%s',_0x9405d1,_0xb3da('0xf'));_0x323546(_0x2b6571[_0xb3da('0x16')][_0xb3da('0x15')]);}})[_0xb3da('0x17')](function(_0x8d3a1e){logger[_0xb3da('0x12')]('CmContact,\x20%s,\x20%s',_0x9405d1,_0x8d3a1e);_0x212667(_0x8d3a1e);});});}exports[_0xb3da('0x18')]=function(_0x2e8835){var _0x52bc1b=this;return new Promise(function(_0xd06d6d,_0x414719){return db[_0xb3da('0x19')][_0xb3da('0x1a')]({'raw':_0x2e8835['options']?_0x2e8835[_0xb3da('0x1b')][_0xb3da('0x1c')]===undefined?!![]:![]:!![],'where':_0x2e8835[_0xb3da('0x1b')]?_0x2e8835[_0xb3da('0x1b')][_0xb3da('0x1d')]||null:null,'attributes':_0x2e8835[_0xb3da('0x1b')]?_0x2e8835['options']['attributes']||null:null,'limit':_0x2e8835[_0xb3da('0x1b')]?_0x2e8835[_0xb3da('0x1b')][_0xb3da('0x1e')]||null:null,'include':_0x2e8835[_0xb3da('0x1b')]?_0x2e8835['options']['include']?_[_0xb3da('0x1f')](_0x2e8835[_0xb3da('0x1b')]['include'],function(_0x4de109){return{'model':db[_0x4de109[_0xb3da('0x20')]],'as':_0x4de109['as'],'attributes':_0x4de109[_0xb3da('0x21')],'include':_0x4de109['include']?_['map'](_0x4de109[_0xb3da('0x22')],function(_0x2707a2){return{'model':db[_0x2707a2['model']],'as':_0x2707a2['as'],'attributes':_0x2707a2[_0xb3da('0x21')],'include':_0x2707a2[_0xb3da('0x22')]?_[_0xb3da('0x1f')](_0x2707a2[_0xb3da('0x22')],function(_0x435948){return{'model':db[_0x435948[_0xb3da('0x20')]],'as':_0x435948['as'],'attributes':_0x435948[_0xb3da('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb3da('0xe')](function(_0x31d285){logger[_0xb3da('0x23')](_0xb3da('0x18'),_0x2e8835);logger[_0xb3da('0x24')](_0xb3da('0x18'),_0x2e8835,JSON[_0xb3da('0x11')](_0x31d285));_0xd06d6d(_0x31d285);})['catch'](function(_0x93749){logger[_0xb3da('0x12')](_0xb3da('0x18'),_0x93749[_0xb3da('0x15')],_0x2e8835);_0x414719(_0x52bc1b[_0xb3da('0x12')](0x1f4,_0x93749[_0xb3da('0x15')]));});});};exports[_0xb3da('0x25')]=function(_0x5013d6){var _0x26fb29=this;return new Promise(function(_0x539c2b,_0x239b91){return db[_0xb3da('0x19')][_0xb3da('0x26')](_0x5013d6[_0xb3da('0x27')],{'raw':_0x5013d6['options']?_0x5013d6[_0xb3da('0x1b')][_0xb3da('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x94d3eb){var _0x371c6a;for(var _0x48ead9=0x0;_0x48ead9{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x4b269d,_0x482c34){var _0x383d62=function(_0x8bd5d6){while(--_0x8bd5d6){_0x4b269d['push'](_0x4b269d['shift']());}};_0x383d62(++_0x482c34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index f92d96d..3b8b24c 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x826a=['PHONE','INTEGER','exports','STRING'];(function(_0x2a4336,_0x148e97){var _0x4172cb=function(_0xc2fdf2){while(--_0xc2fdf2){_0x2a4336['push'](_0x2a4336['shift']());}};_0x4172cb(++_0x148e97);}(_0x826a,0x1aa));var _0xa826=function(_0x19ce10,_0xc8cfeb){_0x19ce10=_0x19ce10-0x0;var _0x36eda0=_0x826a[_0x19ce10];return _0x36eda0;};'use strict';var Sequelize=require('sequelize');module[_0xa826('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xa826('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa826('0x1')],'defaultValue':_0xa826('0x2')},'OrderBy':{'type':Sequelize[_0xa826('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0xa826('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xb201=['PHONE','sequelize','INTEGER','STRING'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xb201,0x1b1));var _0x1b20=function(_0x2d5f8a,_0x3d7dbe){_0x2d5f8a=_0x2d5f8a-0x0;var _0x20d836=_0xb201[_0x2d5f8a];return _0x20d836;};'use strict';var Sequelize=require(_0x1b20('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0x1b20('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x1b20('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x1b20('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x1b20('0x2')],'defaultValue':_0x1b20('0x3')},'OrderBy':{'type':Sequelize[_0x1b20('0x1')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index a3eeeb3..01093b9 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6c3=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','get','CmContactHasItems','end','sendStatus','send','rawAttributes','fieldName','type','name','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','filter','options','include','CmContactHasItem','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xd6c3,0xe2));var _0x3d6c=function(_0x1c886e,_0x194c09){_0x1c886e=_0x1c886e-0x0;var _0xa8209=_0xd6c3[_0x1c886e];return _0xa8209;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3d6c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d6c('0x1'));var moment=require(_0x3d6c('0x2'));var BPromise=require(_0x3d6c('0x3'));var Mustache=require(_0x3d6c('0x4'));var util=require(_0x3d6c('0x5'));var path=require(_0x3d6c('0x6'));var sox=require(_0x3d6c('0x7'));var csv=require('to-csv');var ejs=require(_0x3d6c('0x8'));var fs=require('fs');var fs_extra=require(_0x3d6c('0x9'));var _=require('lodash');var squel=require(_0x3d6c('0xa'));var crypto=require(_0x3d6c('0xb'));var jsforce=require(_0x3d6c('0xc'));var deskjs=require(_0x3d6c('0xd'));var toCsv=require(_0x3d6c('0xe'));var querystring=require(_0x3d6c('0xf'));var Papa=require(_0x3d6c('0x10'));var Redis=require(_0x3d6c('0x11'));var authService=require(_0x3d6c('0x12'));var qs=require(_0x3d6c('0x13'));var as=require(_0x3d6c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3d6c('0x15'))(_0x3d6c('0x16'));var utils=require('../../config/utils');var config=require(_0x3d6c('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x361b31,_0x5b9a8f){_0x5b9a8f=_0x5b9a8f||0xcc;return function(_0x4056ce){if(_0x4056ce){return _0x361b31['sendStatus'](_0x5b9a8f);}return _0x361b31['status'](_0x5b9a8f)['end']();};}function respondWithResult(_0x28fc33,_0x18154b){_0x18154b=_0x18154b||0xc8;return function(_0x20899b){if(_0x20899b){return _0x28fc33[_0x3d6c('0x18')](_0x18154b)[_0x3d6c('0x19')](_0x20899b);}};}function respondWithFilteredResult(_0x221409,_0x3afa40){return function(_0x6fb70f){if(_0x6fb70f){var _0x264096=typeof _0x3afa40['offset']===_0x3d6c('0x1a')&&typeof _0x3afa40[_0x3d6c('0x1b')]===_0x3d6c('0x1a');var _0x2cf4ce=_0x6fb70f['count'];var _0x3fc1fa=_0x264096?0x0:_0x3afa40[_0x3d6c('0x1c')];var _0x562dd9=_0x264096?_0x6fb70f[_0x3d6c('0x1d')]:_0x3afa40['offset']+_0x3afa40[_0x3d6c('0x1b')];var _0x56eff4;if(_0x562dd9>=_0x2cf4ce){_0x562dd9=_0x2cf4ce;_0x56eff4=0xc8;}else{_0x56eff4=0xce;}_0x221409['status'](_0x56eff4);return _0x221409[_0x3d6c('0x1e')](_0x3d6c('0x1f'),_0x3fc1fa+'-'+_0x562dd9+'/'+_0x2cf4ce)[_0x3d6c('0x19')](_0x6fb70f);}return null;};}function patchUpdates(_0x4a782a){return function(_0x49361d){try{jsonpatch[_0x3d6c('0x20')](_0x49361d,_0x4a782a,!![]);}catch(_0x31267c){return BPromise[_0x3d6c('0x21')](_0x31267c);}return _0x49361d[_0x3d6c('0x22')]();};}function saveUpdates(_0x210b39,_0x4ca9b9){return function(_0x4d69d4){if(_0x4d69d4){return _0x4d69d4['update'](_0x210b39)[_0x3d6c('0x23')](function(_0x4a28a4){return _0x4a28a4;});}return null;};}function removeEntity(_0x5c2c91,_0x54ef15){return function(_0x4f530e){if(_0x4f530e){return _0x4f530e[_0x3d6c('0x24')]()[_0x3d6c('0x23')](function(){var _0x2e378c=_0x4f530e[_0x3d6c('0x25')]({'plain':!![]});var _0x741ea8=_0x3d6c('0x26');return db['UserProfileResource'][_0x3d6c('0x24')]({'where':{'type':_0x741ea8,'resourceId':_0x2e378c['id']}})[_0x3d6c('0x23')](function(){return _0x4f530e;});})[_0x3d6c('0x23')](function(){_0x5c2c91['status'](0xcc)[_0x3d6c('0x27')]();});}};}function handleEntityNotFound(_0x234d45,_0x347129){return function(_0x53cb80){if(!_0x53cb80){_0x234d45[_0x3d6c('0x28')](0x194);}return _0x53cb80;};}function handleError(_0x469d81,_0x478835){_0x478835=_0x478835||0x1f4;return function(_0x5bce9a){logger['error'](_0x5bce9a['stack']);if(_0x5bce9a['name']){delete _0x5bce9a['name'];}_0x469d81[_0x3d6c('0x18')](_0x478835)[_0x3d6c('0x29')](_0x5bce9a);};}exports['index']=function(_0x5025e6,_0x3fe30a){var _0x3a81f1={},_0x5b611e={},_0x3991c3={'count':0x0,'rows':[]};var _0x16a75b=_['map'](db['CmContactHasItem'][_0x3d6c('0x2a')],function(_0x1b7d92){return{'name':_0x1b7d92[_0x3d6c('0x2b')],'type':_0x1b7d92[_0x3d6c('0x2c')]['key']};});_0x5b611e['model']=_['map'](_0x16a75b,_0x3d6c('0x2d'));_0x5b611e[_0x3d6c('0x2e')]=_[_0x3d6c('0x2f')](_0x5025e6['query']);_0x5b611e['filters']=_['intersection'](_0x5b611e[_0x3d6c('0x30')],_0x5b611e['query']);_0x3a81f1['attributes']=_[_0x3d6c('0x31')](_0x5b611e['model'],qs[_0x3d6c('0x32')](_0x5025e6['query'][_0x3d6c('0x32')]));_0x3a81f1[_0x3d6c('0x33')]=_0x3a81f1[_0x3d6c('0x33')][_0x3d6c('0x34')]?_0x3a81f1[_0x3d6c('0x33')]:_0x5b611e[_0x3d6c('0x30')];if(!_0x5025e6[_0x3d6c('0x2e')][_0x3d6c('0x35')](_0x3d6c('0x36'))){_0x3a81f1[_0x3d6c('0x1b')]=qs['limit'](_0x5025e6[_0x3d6c('0x2e')][_0x3d6c('0x1b')]);_0x3a81f1[_0x3d6c('0x1c')]=qs['offset'](_0x5025e6['query'][_0x3d6c('0x1c')]);}_0x3a81f1[_0x3d6c('0x37')]=qs[_0x3d6c('0x38')](_0x5025e6[_0x3d6c('0x2e')]['sort']);_0x3a81f1[_0x3d6c('0x39')]=qs[_0x3d6c('0x3a')](_[_0x3d6c('0x3b')](_0x5025e6['query'],_0x5b611e['filters']),_0x16a75b);if(_0x5025e6[_0x3d6c('0x2e')]['filter']){_0x3a81f1[_0x3d6c('0x39')]=_[_0x3d6c('0x3c')](_0x3a81f1[_0x3d6c('0x39')],{'$or':_[_0x3d6c('0x3d')](_0x16a75b,function(_0xfbc898){if(_0xfbc898[_0x3d6c('0x2c')]!=='VIRTUAL'){var _0x2e000a={};_0x2e000a[_0xfbc898[_0x3d6c('0x2d')]]={'$like':'%'+_0x5025e6['query'][_0x3d6c('0x3e')]+'%'};return _0x2e000a;}})});}_0x3a81f1=_['merge']({},_0x3a81f1,_0x5025e6[_0x3d6c('0x3f')]);var _0x26b3e8={'where':_0x3a81f1[_0x3d6c('0x39')]};return db['CmContactHasItem'][_0x3d6c('0x1d')](_0x26b3e8)[_0x3d6c('0x23')](function(_0x2b8772){_0x3991c3[_0x3d6c('0x1d')]=_0x2b8772;if(_0x5025e6['query']['includeAll']){_0x3a81f1[_0x3d6c('0x40')]=[{'all':!![]}];}return db[_0x3d6c('0x41')]['findAll'](_0x3a81f1);})['then'](function(_0x346694){_0x3991c3[_0x3d6c('0x42')]=_0x346694;return _0x3991c3;})[_0x3d6c('0x23')](respondWithFilteredResult(_0x3fe30a,_0x3a81f1))[_0x3d6c('0x43')](handleError(_0x3fe30a,null));};exports[_0x3d6c('0x44')]=function(_0xd83147,_0x264940){var _0xd48eac={'raw':!![],'where':{'id':_0xd83147['params']['id']}},_0x50df42={};_0x50df42[_0x3d6c('0x30')]=_['keys'](db[_0x3d6c('0x41')][_0x3d6c('0x2a')]);_0x50df42[_0x3d6c('0x2e')]=_[_0x3d6c('0x2f')](_0xd83147['query']);_0x50df42[_0x3d6c('0x3a')]=_[_0x3d6c('0x31')](_0x50df42[_0x3d6c('0x30')],_0x50df42[_0x3d6c('0x2e')]);_0xd48eac[_0x3d6c('0x33')]=_[_0x3d6c('0x31')](_0x50df42[_0x3d6c('0x30')],qs['fields'](_0xd83147['query']['fields']));_0xd48eac['attributes']=_0xd48eac['attributes']['length']?_0xd48eac['attributes']:_0x50df42['model'];if(_0xd83147[_0x3d6c('0x2e')][_0x3d6c('0x45')]){_0xd48eac['include']=[{'all':!![]}];}_0xd48eac=_[_0x3d6c('0x3c')]({},_0xd48eac,_0xd83147['options']);return db[_0x3d6c('0x41')][_0x3d6c('0x46')](_0xd48eac)['then'](handleEntityNotFound(_0x264940,null))['then'](respondWithResult(_0x264940,null))[_0x3d6c('0x43')](handleError(_0x264940,null));};exports[_0x3d6c('0x47')]=function(_0x6e6508,_0xd064ec){return db[_0x3d6c('0x41')][_0x3d6c('0x47')](_0x6e6508[_0x3d6c('0x48')],{})[_0x3d6c('0x23')](function(_0x14b3e5){var _0x350419=_0x6e6508[_0x3d6c('0x49')][_0x3d6c('0x25')]({'plain':!![]});if(!_0x350419)throw new Error(_0x3d6c('0x4a'));if(_0x350419[_0x3d6c('0x4b')]===_0x3d6c('0x49')){var _0x353e83=_0x14b3e5[_0x3d6c('0x25')]({'plain':!![]});var _0x270e4d=_0x3d6c('0x26');return db[_0x3d6c('0x4c')][_0x3d6c('0x46')]({'where':{'name':_0x270e4d,'userProfileId':_0x350419['userProfileId']},'raw':!![]})[_0x3d6c('0x23')](function(_0x936f2f){if(_0x936f2f&&_0x936f2f[_0x3d6c('0x4d')]===0x0){return db[_0x3d6c('0x4e')][_0x3d6c('0x47')]({'name':_0x353e83['name'],'resourceId':_0x353e83['id'],'type':_0x936f2f[_0x3d6c('0x2d')],'sectionId':_0x936f2f['id']},{})[_0x3d6c('0x23')](function(){return _0x14b3e5;});}else{return _0x14b3e5;}})[_0x3d6c('0x43')](function(_0x5a4ed3){logger['error'](_0x3d6c('0x4f'),_0x5a4ed3);throw _0x5a4ed3;});}return _0x14b3e5;})[_0x3d6c('0x23')](respondWithResult(_0xd064ec,0xc9))['catch'](handleError(_0xd064ec,null));};exports[_0x3d6c('0x50')]=function(_0x50e9f8,_0x5ce5b9){if(_0x50e9f8[_0x3d6c('0x48')]['id']){delete _0x50e9f8['body']['id'];}return db['CmContactHasItem'][_0x3d6c('0x46')]({'where':{'id':_0x50e9f8[_0x3d6c('0x51')]['id']}})['then'](handleEntityNotFound(_0x5ce5b9,null))[_0x3d6c('0x23')](saveUpdates(_0x50e9f8[_0x3d6c('0x48')],null))[_0x3d6c('0x23')](respondWithResult(_0x5ce5b9,null))[_0x3d6c('0x43')](handleError(_0x5ce5b9,null));};exports['destroy']=function(_0x357d2c,_0x2b90bc){return db[_0x3d6c('0x41')][_0x3d6c('0x46')]({'where':{'id':_0x357d2c[_0x3d6c('0x51')]['id']}})[_0x3d6c('0x23')](handleEntityNotFound(_0x2b90bc,null))['then'](removeEntity(_0x2b90bc,null))[_0x3d6c('0x43')](handleError(_0x2b90bc,null));}; \ No newline at end of file +var _0x812c=['rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','params','intersection','includeAll','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','json','apply','save','then','get','UserProfileResource','destroy','sendStatus','stack','name','send','map','CmContactHasItem'];(function(_0x5c6121,_0x40f733){var _0x216aea=function(_0x2723ad){while(--_0x2723ad){_0x5c6121['push'](_0x5c6121['shift']());}};_0x216aea(++_0x40f733);}(_0x812c,0x78));var _0xc812=function(_0x4789cd,_0x1d18d6){_0x4789cd=_0x4789cd-0x0;var _0x39f810=_0x812c[_0x4789cd];return _0x39f810;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc812('0x0'));var zipdir=require(_0xc812('0x1'));var jsonpatch=require(_0xc812('0x2'));var rp=require(_0xc812('0x3'));var moment=require(_0xc812('0x4'));var BPromise=require(_0xc812('0x5'));var Mustache=require(_0xc812('0x6'));var util=require(_0xc812('0x7'));var path=require(_0xc812('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc812('0x9'));var fs=require('fs');var fs_extra=require(_0xc812('0xa'));var _=require(_0xc812('0xb'));var squel=require(_0xc812('0xc'));var crypto=require(_0xc812('0xd'));var jsforce=require(_0xc812('0xe'));var deskjs=require(_0xc812('0xf'));var toCsv=require(_0xc812('0x10'));var querystring=require(_0xc812('0x11'));var Papa=require(_0xc812('0x12'));var Redis=require(_0xc812('0x13'));var authService=require(_0xc812('0x14'));var qs=require(_0xc812('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc812('0x16'));var logger=require(_0xc812('0x17'))(_0xc812('0x18'));var utils=require(_0xc812('0x19'));var config=require(_0xc812('0x1a'));var licenseUtil=require(_0xc812('0x1b'));var db=require(_0xc812('0x1c'))['db'];function respondWithStatusCode(_0x283fa5,_0x5d40e7){_0x5d40e7=_0x5d40e7||0xcc;return function(_0x289009){if(_0x289009){return _0x283fa5['sendStatus'](_0x5d40e7);}return _0x283fa5['status'](_0x5d40e7)[_0xc812('0x1d')]();};}function respondWithResult(_0x5e2f3a,_0x22c5e3){_0x22c5e3=_0x22c5e3||0xc8;return function(_0x388125){if(_0x388125){return _0x5e2f3a[_0xc812('0x1e')](_0x22c5e3)['json'](_0x388125);}};}function respondWithFilteredResult(_0x4448ac,_0x8a838d){return function(_0x3f197d){if(_0x3f197d){var _0x48af9e=typeof _0x8a838d[_0xc812('0x1f')]===_0xc812('0x20')&&typeof _0x8a838d[_0xc812('0x21')]==='undefined';var _0x5dc52b=_0x3f197d[_0xc812('0x22')];var _0x5b08a3=_0x48af9e?0x0:_0x8a838d[_0xc812('0x1f')];var _0x5507f4=_0x48af9e?_0x3f197d[_0xc812('0x22')]:_0x8a838d['offset']+_0x8a838d[_0xc812('0x21')];var _0x57737b;if(_0x5507f4>=_0x5dc52b){_0x5507f4=_0x5dc52b;_0x57737b=0xc8;}else{_0x57737b=0xce;}_0x4448ac[_0xc812('0x1e')](_0x57737b);return _0x4448ac['set']('Content-Range',_0x5b08a3+'-'+_0x5507f4+'/'+_0x5dc52b)[_0xc812('0x23')](_0x3f197d);}return null;};}function patchUpdates(_0x5ab0f3){return function(_0x2fd220){try{jsonpatch[_0xc812('0x24')](_0x2fd220,_0x5ab0f3,!![]);}catch(_0x5795ad){return BPromise['reject'](_0x5795ad);}return _0x2fd220[_0xc812('0x25')]();};}function saveUpdates(_0x3cf61a,_0xbe1181){return function(_0x5a4e76){if(_0x5a4e76){return _0x5a4e76['update'](_0x3cf61a)['then'](function(_0x395dc5){return _0x395dc5;});}return null;};}function removeEntity(_0x415b2d,_0x17912e){return function(_0x1a49f4){if(_0x1a49f4){return _0x1a49f4['destroy']()[_0xc812('0x26')](function(){var _0x11cd13=_0x1a49f4[_0xc812('0x27')]({'plain':!![]});var _0x4d716b='CmContactHasItems';return db[_0xc812('0x28')][_0xc812('0x29')]({'where':{'type':_0x4d716b,'resourceId':_0x11cd13['id']}})[_0xc812('0x26')](function(){return _0x1a49f4;});})['then'](function(){_0x415b2d[_0xc812('0x1e')](0xcc)[_0xc812('0x1d')]();});}};}function handleEntityNotFound(_0x5c9bee,_0x193e08){return function(_0x1adc42){if(!_0x1adc42){_0x5c9bee[_0xc812('0x2a')](0x194);}return _0x1adc42;};}function handleError(_0x5c40c1,_0x407926){_0x407926=_0x407926||0x1f4;return function(_0x2f37f1){logger['error'](_0x2f37f1[_0xc812('0x2b')]);if(_0x2f37f1[_0xc812('0x2c')]){delete _0x2f37f1['name'];}_0x5c40c1['status'](_0x407926)[_0xc812('0x2d')](_0x2f37f1);};}exports['index']=function(_0x4e4616,_0x59f5f8){var _0x3d98ef={},_0x44dea3={},_0x554a5a={'count':0x0,'rows':[]};var _0x4fdeb6=_[_0xc812('0x2e')](db[_0xc812('0x2f')][_0xc812('0x30')],function(_0x37f6e7){return{'name':_0x37f6e7[_0xc812('0x31')],'type':_0x37f6e7[_0xc812('0x32')][_0xc812('0x33')]};});_0x44dea3[_0xc812('0x34')]=_[_0xc812('0x2e')](_0x4fdeb6,_0xc812('0x2c'));_0x44dea3['query']=_[_0xc812('0x35')](_0x4e4616['query']);_0x44dea3['filters']=_['intersection'](_0x44dea3[_0xc812('0x34')],_0x44dea3[_0xc812('0x36')]);_0x3d98ef[_0xc812('0x37')]=_['intersection'](_0x44dea3[_0xc812('0x34')],qs['fields'](_0x4e4616[_0xc812('0x36')][_0xc812('0x38')]));_0x3d98ef[_0xc812('0x37')]=_0x3d98ef[_0xc812('0x37')][_0xc812('0x39')]?_0x3d98ef[_0xc812('0x37')]:_0x44dea3[_0xc812('0x34')];if(!_0x4e4616[_0xc812('0x36')][_0xc812('0x3a')](_0xc812('0x3b'))){_0x3d98ef[_0xc812('0x21')]=qs[_0xc812('0x21')](_0x4e4616[_0xc812('0x36')][_0xc812('0x21')]);_0x3d98ef['offset']=qs[_0xc812('0x1f')](_0x4e4616[_0xc812('0x36')][_0xc812('0x1f')]);}_0x3d98ef[_0xc812('0x3c')]=qs[_0xc812('0x3d')](_0x4e4616[_0xc812('0x36')][_0xc812('0x3d')]);_0x3d98ef[_0xc812('0x3e')]=qs[_0xc812('0x3f')](_[_0xc812('0x40')](_0x4e4616[_0xc812('0x36')],_0x44dea3['filters']),_0x4fdeb6);if(_0x4e4616[_0xc812('0x36')][_0xc812('0x41')]){_0x3d98ef[_0xc812('0x3e')]=_['merge'](_0x3d98ef[_0xc812('0x3e')],{'$or':_[_0xc812('0x2e')](_0x4fdeb6,function(_0x321bf3){if(_0x321bf3['type']!==_0xc812('0x42')){var _0x405131={};_0x405131[_0x321bf3['name']]={'$like':'%'+_0x4e4616[_0xc812('0x36')][_0xc812('0x41')]+'%'};return _0x405131;}})});}_0x3d98ef=_[_0xc812('0x43')]({},_0x3d98ef,_0x4e4616[_0xc812('0x44')]);var _0x117930={'where':_0x3d98ef[_0xc812('0x3e')]};return db[_0xc812('0x2f')]['count'](_0x117930)[_0xc812('0x26')](function(_0x3ec317){_0x554a5a[_0xc812('0x22')]=_0x3ec317;if(_0x4e4616[_0xc812('0x36')]['includeAll']){_0x3d98ef[_0xc812('0x45')]=[{'all':!![]}];}return db[_0xc812('0x2f')][_0xc812('0x46')](_0x3d98ef);})[_0xc812('0x26')](function(_0x4e0d68){_0x554a5a['rows']=_0x4e0d68;return _0x554a5a;})[_0xc812('0x26')](respondWithFilteredResult(_0x59f5f8,_0x3d98ef))[_0xc812('0x47')](handleError(_0x59f5f8,null));};exports[_0xc812('0x48')]=function(_0x2aa851,_0x5143bd){var _0x42d935={'raw':!![],'where':{'id':_0x2aa851[_0xc812('0x49')]['id']}},_0x3a4669={};_0x3a4669[_0xc812('0x34')]=_[_0xc812('0x35')](db[_0xc812('0x2f')][_0xc812('0x30')]);_0x3a4669['query']=_[_0xc812('0x35')](_0x2aa851[_0xc812('0x36')]);_0x3a4669['filters']=_[_0xc812('0x4a')](_0x3a4669[_0xc812('0x34')],_0x3a4669[_0xc812('0x36')]);_0x42d935[_0xc812('0x37')]=_['intersection'](_0x3a4669[_0xc812('0x34')],qs['fields'](_0x2aa851[_0xc812('0x36')][_0xc812('0x38')]));_0x42d935['attributes']=_0x42d935[_0xc812('0x37')][_0xc812('0x39')]?_0x42d935[_0xc812('0x37')]:_0x3a4669[_0xc812('0x34')];if(_0x2aa851[_0xc812('0x36')][_0xc812('0x4b')]){_0x42d935[_0xc812('0x45')]=[{'all':!![]}];}_0x42d935=_[_0xc812('0x43')]({},_0x42d935,_0x2aa851[_0xc812('0x44')]);return db[_0xc812('0x2f')]['find'](_0x42d935)[_0xc812('0x26')](handleEntityNotFound(_0x5143bd,null))['then'](respondWithResult(_0x5143bd,null))[_0xc812('0x47')](handleError(_0x5143bd,null));};exports[_0xc812('0x4c')]=function(_0x2860a9,_0x155a20){return db[_0xc812('0x2f')][_0xc812('0x4c')](_0x2860a9[_0xc812('0x4d')],{})['then'](function(_0x5b5937){var _0x244bda=_0x2860a9[_0xc812('0x4e')][_0xc812('0x27')]({'plain':!![]});if(!_0x244bda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x244bda[_0xc812('0x4f')]===_0xc812('0x4e')){var _0x11da16=_0x5b5937[_0xc812('0x27')]({'plain':!![]});var _0x57cf57='CmContactHasItems';return db[_0xc812('0x50')]['find']({'where':{'name':_0x57cf57,'userProfileId':_0x244bda['userProfileId']},'raw':!![]})[_0xc812('0x26')](function(_0x1944c9){if(_0x1944c9&&_0x1944c9[_0xc812('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x11da16[_0xc812('0x2c')],'resourceId':_0x11da16['id'],'type':_0x1944c9[_0xc812('0x2c')],'sectionId':_0x1944c9['id']},{})[_0xc812('0x26')](function(){return _0x5b5937;});}else{return _0x5b5937;}})[_0xc812('0x47')](function(_0x468f82){logger['error'](_0xc812('0x52'),_0x468f82);throw _0x468f82;});}return _0x5b5937;})[_0xc812('0x26')](respondWithResult(_0x155a20,0xc9))['catch'](handleError(_0x155a20,null));};exports[_0xc812('0x53')]=function(_0x2c636e,_0x3fe028){if(_0x2c636e[_0xc812('0x4d')]['id']){delete _0x2c636e['body']['id'];}return db[_0xc812('0x2f')]['find']({'where':{'id':_0x2c636e[_0xc812('0x49')]['id']}})[_0xc812('0x26')](handleEntityNotFound(_0x3fe028,null))[_0xc812('0x26')](saveUpdates(_0x2c636e[_0xc812('0x4d')],null))[_0xc812('0x26')](respondWithResult(_0x3fe028,null))[_0xc812('0x47')](handleError(_0x3fe028,null));};exports['destroy']=function(_0x368428,_0x622b15){return db[_0xc812('0x2f')]['find']({'where':{'id':_0x368428[_0xc812('0x49')]['id']}})[_0xc812('0x26')](handleEntityNotFound(_0x622b15,null))[_0xc812('0x26')](removeEntity(_0x622b15,null))[_0xc812('0x47')](handleError(_0x622b15,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 5fc70e8..39464c9 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e0e=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash'];(function(_0x1fafa5,_0x1aa281){var _0xcf08c9=function(_0x3af1b4){while(--_0x3af1b4){_0x1fafa5['push'](_0x1fafa5['shift']());}};_0xcf08c9(++_0x1aa281);}(_0x3e0e,0xb3));var _0xe3e0=function(_0x46f7d7,_0x4ca23e){_0x46f7d7=_0x46f7d7-0x0;var _0x639825=_0x3e0e[_0x46f7d7];return _0x639825;};'use strict';var _=require(_0xe3e0('0x0'));var util=require('util');var logger=require(_0xe3e0('0x1'))(_0xe3e0('0x2'));var moment=require(_0xe3e0('0x3'));var BPromise=require(_0xe3e0('0x4'));var rp=require(_0xe3e0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe3e0('0x6'));var attributes=require(_0xe3e0('0x7'));module[_0xe3e0('0x8')]=function(_0x28bc43,_0x90102e){return _0x28bc43[_0xe3e0('0x9')](_0xe3e0('0xa'),attributes,{'tableName':_0xe3e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b95=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','CmContactHasItem','cm_contact_has_items','util'];(function(_0x1e8cab,_0x2e4308){var _0x2d71d2=function(_0xde4be3){while(--_0xde4be3){_0x1e8cab['push'](_0x1e8cab['shift']());}};_0x2d71d2(++_0x2e4308);}(_0x4b95,0x1d3));var _0x54b9=function(_0x5c0f65,_0x8fb857){_0x5c0f65=_0x5c0f65-0x0;var _0x307a8f=_0x4b95[_0x5c0f65];return _0x307a8f;};'use strict';var _=require('lodash');var util=require(_0x54b9('0x0'));var logger=require(_0x54b9('0x1'))(_0x54b9('0x2'));var moment=require(_0x54b9('0x3'));var BPromise=require(_0x54b9('0x4'));var rp=require(_0x54b9('0x5'));var fs=require('fs');var path=require(_0x54b9('0x6'));var rimraf=require(_0x54b9('0x7'));var config=require(_0x54b9('0x8'));var attributes=require('./cmContactHasItem.attributes');module[_0x54b9('0x9')]=function(_0x179f5b,_0x77efb4){return _0x179f5b[_0x54b9('0xa')](_0x54b9('0xb'),attributes,{'tableName':_0x54b9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 9a864ad..4789bbc 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea66=['result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x320aee,_0x290193){var _0x333a76=function(_0x8ca3ba){while(--_0x8ca3ba){_0x320aee['push'](_0x320aee['shift']());}};_0x333a76(++_0x290193);}(_0xea66,0x171));var _0x6ea6=function(_0x1bcc92,_0x4929b8){_0x1bcc92=_0x1bcc92-0x0;var _0x88406a=_0xea66[_0x1bcc92];return _0x88406a;};'use strict';var _=require(_0x6ea6('0x0'));var util=require(_0x6ea6('0x1'));var moment=require(_0x6ea6('0x2'));var BPromise=require(_0x6ea6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ea6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ea6('0x5'));var logger=require(_0x6ea6('0x6'))(_0x6ea6('0x7'));var config=require(_0x6ea6('0x8'));var jayson=require(_0x6ea6('0x9'));var client=jayson[_0x6ea6('0xa')][_0x6ea6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1b2dd5,_0x5adc1d,_0x480077){return new BPromise(function(_0xd8970c,_0x2f0772){return client[_0x6ea6('0xc')](_0x1b2dd5,_0x480077)[_0x6ea6('0xd')](function(_0x3f0c37){logger[_0x6ea6('0xe')](_0x6ea6('0xf'),_0x5adc1d,'request\x20sent');logger[_0x6ea6('0x10')](_0x6ea6('0x11'),_0x5adc1d,_0x6ea6('0x12'),JSON[_0x6ea6('0x13')](_0x3f0c37));if(_0x3f0c37[_0x6ea6('0x14')]){if(_0x3f0c37[_0x6ea6('0x14')]['code']===0x1f4){logger[_0x6ea6('0x14')](_0x6ea6('0xf'),_0x5adc1d,_0x3f0c37[_0x6ea6('0x14')][_0x6ea6('0x15')]);return _0x2f0772(_0x3f0c37[_0x6ea6('0x14')][_0x6ea6('0x15')]);}logger['error'](_0x6ea6('0xf'),_0x5adc1d,_0x3f0c37[_0x6ea6('0x14')][_0x6ea6('0x15')]);return _0xd8970c(_0x3f0c37[_0x6ea6('0x14')]['message']);}else{logger[_0x6ea6('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x5adc1d,'request\x20sent');_0xd8970c(_0x3f0c37[_0x6ea6('0x16')][_0x6ea6('0x15')]);}})['catch'](function(_0x2df94b){logger[_0x6ea6('0x14')](_0x6ea6('0xf'),_0x5adc1d,_0x2df94b);_0x2f0772(_0x2df94b);});});} \ No newline at end of file +var _0x1764=['debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent'];(function(_0x46e649,_0x2a600f){var _0x305678=function(_0x2072b6){while(--_0x2072b6){_0x46e649['push'](_0x46e649['shift']());}};_0x305678(++_0x2a600f);}(_0x1764,0xd7));var _0x4176=function(_0xac5aa5,_0x35b081){_0xac5aa5=_0xac5aa5-0x0;var _0x59cb5e=_0x1764[_0xac5aa5];return _0x59cb5e;};'use strict';var _=require('lodash');var util=require(_0x4176('0x0'));var moment=require(_0x4176('0x1'));var BPromise=require(_0x4176('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4176('0x3'));var db=require(_0x4176('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4176('0x5'))('rpc');var config=require(_0x4176('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4176('0x7')][_0x4176('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x85968a,_0x3a56bc,_0x59335d){return new BPromise(function(_0x56a3ae,_0x54eeb6){return client[_0x4176('0x9')](_0x85968a,_0x59335d)[_0x4176('0xa')](function(_0x1312fb){logger['info'](_0x4176('0xb'),_0x3a56bc,_0x4176('0xc'));logger[_0x4176('0xd')](_0x4176('0xe'),_0x3a56bc,_0x4176('0xc'),JSON[_0x4176('0xf')](_0x1312fb));if(_0x1312fb['error']){if(_0x1312fb[_0x4176('0x10')]['code']===0x1f4){logger['error'](_0x4176('0xb'),_0x3a56bc,_0x1312fb[_0x4176('0x10')]['message']);return _0x54eeb6(_0x1312fb['error'][_0x4176('0x11')]);}logger[_0x4176('0x10')](_0x4176('0xb'),_0x3a56bc,_0x1312fb[_0x4176('0x10')][_0x4176('0x11')]);return _0x56a3ae(_0x1312fb['error'][_0x4176('0x11')]);}else{logger['info'](_0x4176('0xb'),_0x3a56bc,_0x4176('0xc'));_0x56a3ae(_0x1312fb[_0x4176('0x12')][_0x4176('0x11')]);}})['catch'](function(_0x3a73af){logger[_0x4176('0x10')](_0x4176('0xb'),_0x3a56bc,_0x3a73af);_0x54eeb6(_0x3a73af);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 7ebc328..5844463 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc698=['post','create','put','update','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show'];(function(_0x35d20b,_0x46f046){var _0x467114=function(_0x22c515){while(--_0x22c515){_0x35d20b['push'](_0x35d20b['shift']());}};_0x467114(++_0x46f046);}(_0xc698,0x85));var _0x8c69=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xc698[_0x110c3d];return _0x226d67;};'use strict';var multer=require(_0x8c69('0x0'));var util=require(_0x8c69('0x1'));var path=require(_0x8c69('0x2'));var timeout=require(_0x8c69('0x3'));var express=require(_0x8c69('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8c69('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8c69('0x6'));var controller=require('./cmContactHasItem.controller');router[_0x8c69('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8c69('0x7')](_0x8c69('0x8'),auth[_0x8c69('0x9')](),controller[_0x8c69('0xa')]);router[_0x8c69('0xb')]('/',auth[_0x8c69('0x9')](),controller[_0x8c69('0xc')]);router[_0x8c69('0xd')](_0x8c69('0x8'),auth[_0x8c69('0x9')](),controller[_0x8c69('0xe')]);router['delete'](_0x8c69('0x8'),auth[_0x8c69('0x9')](),controller[_0x8c69('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7cc2=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','create','put','update','destroy','multer','util'];(function(_0x546c68,_0x5c0116){var _0x4a2389=function(_0x5aa205){while(--_0x5aa205){_0x546c68['push'](_0x546c68['shift']());}};_0x4a2389(++_0x5c0116);}(_0x7cc2,0x196));var _0x27cc=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x7cc2[_0xda464c];return _0x19e222;};'use strict';var multer=require(_0x27cc('0x0'));var util=require(_0x27cc('0x1'));var path=require(_0x27cc('0x2'));var timeout=require(_0x27cc('0x3'));var express=require(_0x27cc('0x4'));var router=express['Router']();var fs_extra=require(_0x27cc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x27cc('0x6'));var config=require(_0x27cc('0x7'));var controller=require(_0x27cc('0x8'));router[_0x27cc('0x9')]('/',auth[_0x27cc('0xa')](),controller['index']);router[_0x27cc('0x9')](_0x27cc('0xb'),auth['isAuthenticated'](),controller[_0x27cc('0xc')]);router['post']('/',auth[_0x27cc('0xa')](),controller[_0x27cc('0xd')]);router[_0x27cc('0xe')]('/:id',auth[_0x27cc('0xa')](),controller[_0x27cc('0xf')]);router['delete'](_0x27cc('0xb'),auth[_0x27cc('0xa')](),controller[_0x27cc('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 93191ee..cbeedcc 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 _0x0515=['getDataValue','STRING','setDataValue','TEXT','long','type','parse','values','isArray','stringify','BOOLEAN','voice'];(function(_0x4a7152,_0x5a8fd7){var _0xf3366c=function(_0xc70008){while(--_0xc70008){_0x4a7152['push'](_0x4a7152['shift']());}};_0xf3366c(++_0x5a8fd7);}(_0x0515,0x144));var _0x5051=function(_0xb77dfe,_0x39c4c7){_0xb77dfe=_0xb77dfe-0x0;var _0x5e4f5d=_0x0515[_0xb77dfe];return _0x5e4f5d;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x36eccc){return this[_0x5051('0x0')]('alias');}},'alias':{'type':Sequelize[_0x5051('0x1')],'allowNull':![],'set':function(_0xc03875){this[_0x5051('0x2')]('alias',_0xc03875?_0xc03875:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x5051('0x1')],'allowNull':![]},'values':{'type':Sequelize[_0x5051('0x3')](_0x5051('0x4')),'get':function(){if(this[_0x5051('0x0')](_0x5051('0x5'))==='select'){return JSON[_0x5051('0x6')](this[_0x5051('0x0')](_0x5051('0x7')));}else{return this[_0x5051('0x0')](_0x5051('0x7'));}},'set':function(_0x129a02){if(Array[_0x5051('0x8')](_0x129a02)){this[_0x5051('0x2')](_0x5051('0x7'),JSON[_0x5051('0x9')](_0x129a02));}else{this['setDataValue'](_0x5051('0x7'),_0x129a02);}}},'required':{'type':Sequelize[_0x5051('0xa')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x5051('0xb'))}}; \ No newline at end of file +var _0x0bee=['STRING','alias','name','TEXT','type','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','getDataValue'];(function(_0x1ce279,_0x422132){var _0x4dd294=function(_0xe732d6){while(--_0xe732d6){_0x1ce279['push'](_0x1ce279['shift']());}};_0x4dd294(++_0x422132);}(_0x0bee,0x93));var _0xe0be=function(_0x300883,_0x5a1ea4){_0x300883=_0x300883-0x0;var _0x5b9e7a=_0x0bee[_0x300883];return _0x5b9e7a;};'use strict';var Sequelize=require(_0xe0be('0x0'));var _=require(_0xe0be('0x1'));module[_0xe0be('0x2')]={'name':{'type':Sequelize[_0xe0be('0x3')],'get':function(_0x57255a){return this[_0xe0be('0x4')]('alias');}},'alias':{'type':Sequelize[_0xe0be('0x5')],'allowNull':![],'set':function(_0x1fd8ee){this['setDataValue'](_0xe0be('0x6'),_0x1fd8ee?_0x1fd8ee:this['getDataValue'](_0xe0be('0x7')));}},'type':{'type':Sequelize[_0xe0be('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xe0be('0x8')]('long'),'get':function(){if(this['getDataValue'](_0xe0be('0x9'))===_0xe0be('0xa')){return JSON[_0xe0be('0xb')](this[_0xe0be('0x4')](_0xe0be('0xc')));}else{return this['getDataValue']('values');}},'set':function(_0x1c70c7){if(Array[_0xe0be('0xd')](_0x1c70c7)){this[_0xe0be('0xe')](_0xe0be('0xc'),JSON[_0xe0be('0xf')](_0x1c70c7));}else{this[_0xe0be('0xe')](_0xe0be('0xc'),_0x1c70c7);}}},'required':{'type':Sequelize[_0xe0be('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe0be('0x10')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xe0be('0x11')](_0xe0be('0x12'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 6783f55..e56bf60 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 _0x97f0=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','update','body','create','Sequelize','TEXT','switch','BOOLEAN','sequelize','cm_contacts','format','catch','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3678ea,_0x8559f2){var _0x15a9e9=function(_0x23ea26){while(--_0x23ea26){_0x3678ea['push'](_0x3678ea['shift']());}};_0x15a9e9(++_0x8559f2);}(_0x97f0,0x145));var _0x097f=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0x97f0[_0x10d34b];return _0x92b0bf;};'use strict';var emlformat=require(_0x097f('0x0'));var rimraf=require(_0x097f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x097f('0x2'));var moment=require('moment');var BPromise=require(_0x097f('0x3'));var Mustache=require(_0x097f('0x4'));var util=require(_0x097f('0x5'));var path=require(_0x097f('0x6'));var sox=require(_0x097f('0x7'));var csv=require(_0x097f('0x8'));var ejs=require(_0x097f('0x9'));var fs=require('fs');var fs_extra=require(_0x097f('0xa'));var _=require(_0x097f('0xb'));var squel=require(_0x097f('0xc'));var crypto=require('crypto');var jsforce=require(_0x097f('0xd'));var deskjs=require(_0x097f('0xe'));var toCsv=require(_0x097f('0x8'));var querystring=require(_0x097f('0xf'));var Papa=require(_0x097f('0x10'));var Redis=require(_0x097f('0x11'));var authService=require(_0x097f('0x12'));var qs=require(_0x097f('0x13'));var as=require(_0x097f('0x14'));var hardwareService=require(_0x097f('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x097f('0x16'));var licenseUtil=require(_0x097f('0x17'));var db=require(_0x097f('0x18'))['db'];function respondWithStatusCode(_0x24c68d,_0x422991){_0x422991=_0x422991||0xcc;return function(_0x35a3e1){if(_0x35a3e1){return _0x24c68d[_0x097f('0x19')](_0x422991);}return _0x24c68d[_0x097f('0x1a')](_0x422991)[_0x097f('0x1b')]();};}function respondWithResult(_0xaff244,_0x2fbd3c){_0x2fbd3c=_0x2fbd3c||0xc8;return function(_0x6215c9){if(_0x6215c9){return _0xaff244['status'](_0x2fbd3c)[_0x097f('0x1c')](_0x6215c9);}};}function respondWithFilteredResult(_0x4211e8,_0xd581e6){return function(_0x170e26){if(_0x170e26){var _0x4b01d1=typeof _0xd581e6[_0x097f('0x1d')]==='undefined'&&typeof _0xd581e6[_0x097f('0x1e')]==='undefined';var _0x36945b=_0x170e26['count'];var _0x2e8125=_0x4b01d1?0x0:_0xd581e6[_0x097f('0x1d')];var _0x58ded3=_0x4b01d1?_0x170e26[_0x097f('0x1f')]:_0xd581e6['offset']+_0xd581e6[_0x097f('0x1e')];var _0x554a74;if(_0x58ded3>=_0x36945b){_0x58ded3=_0x36945b;_0x554a74=0xc8;}else{_0x554a74=0xce;}_0x4211e8[_0x097f('0x1a')](_0x554a74);return _0x4211e8[_0x097f('0x20')](_0x097f('0x21'),_0x2e8125+'-'+_0x58ded3+'/'+_0x36945b)[_0x097f('0x1c')](_0x170e26);}return null;};}function patchUpdates(_0xb08cfd){return function(_0x1f1c75){try{jsonpatch[_0x097f('0x22')](_0x1f1c75,_0xb08cfd,!![]);}catch(_0x3c5c79){return BPromise[_0x097f('0x23')](_0x3c5c79);}return _0x1f1c75[_0x097f('0x24')]();};}function saveUpdates(_0x543b3b,_0x3dfbcb){return function(_0x25bc3c){if(_0x25bc3c){return _0x25bc3c['update'](_0x543b3b)[_0x097f('0x25')](function(_0x87ed18){return _0x87ed18;});}return null;};}function removeEntity(_0x45233f,_0x15691e){return function(_0x5aba93){if(_0x5aba93){return _0x5aba93[_0x097f('0x26')]()['then'](function(){_0x45233f[_0x097f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15a081,_0x581e55){return function(_0x29f958){if(!_0x29f958){_0x15a081[_0x097f('0x19')](0x194);}return _0x29f958;};}function handleError(_0x402e49,_0x424662){_0x424662=_0x424662||0x1f4;return function(_0x34a6c2){logger[_0x097f('0x27')](_0x34a6c2[_0x097f('0x28')]);if(_0x34a6c2[_0x097f('0x29')]){delete _0x34a6c2[_0x097f('0x29')];}_0x402e49[_0x097f('0x1a')](_0x424662)[_0x097f('0x2a')](_0x34a6c2);};}exports[_0x097f('0x2b')]=function(_0x50eab7,_0x13303f){var _0x1793a9={},_0x415a86={},_0x5a72c4={'count':0x0,'rows':[]};var _0x36884e=_[_0x097f('0x2c')](db[_0x097f('0x2d')][_0x097f('0x2e')],function(_0x1e74e){return{'name':_0x1e74e[_0x097f('0x2f')],'type':_0x1e74e[_0x097f('0x30')][_0x097f('0x31')]};});_0x415a86[_0x097f('0x32')]=_[_0x097f('0x33')](_[_0x097f('0x2c')](_0x36884e,_0x097f('0x29')),[_0x097f('0x29')]);_0x415a86[_0x097f('0x34')]=_['keys'](_0x50eab7[_0x097f('0x34')]);_0x415a86[_0x097f('0x35')]=_[_0x097f('0x36')](_0x415a86[_0x097f('0x32')],_0x415a86[_0x097f('0x34')]);_0x1793a9[_0x097f('0x37')]=_['intersection'](_0x415a86['model'],qs[_0x097f('0x38')](_0x50eab7[_0x097f('0x34')][_0x097f('0x38')]));_0x1793a9[_0x097f('0x37')]=_0x1793a9[_0x097f('0x37')][_0x097f('0x39')]?_0x1793a9[_0x097f('0x37')]:_0x415a86[_0x097f('0x32')];if(!_0x50eab7[_0x097f('0x34')]['hasOwnProperty']('nolimit')){_0x1793a9['limit']=qs[_0x097f('0x1e')](_0x50eab7[_0x097f('0x34')][_0x097f('0x1e')]);_0x1793a9[_0x097f('0x1d')]=qs[_0x097f('0x1d')](_0x50eab7[_0x097f('0x34')][_0x097f('0x1d')]);}_0x1793a9[_0x097f('0x3a')]=qs[_0x097f('0x3b')](_0x50eab7[_0x097f('0x34')][_0x097f('0x3b')]);_0x1793a9[_0x097f('0x3c')]=qs[_0x097f('0x35')](_[_0x097f('0x3d')](_0x50eab7[_0x097f('0x34')],_0x415a86[_0x097f('0x35')]),_0x36884e);if(_0x50eab7['query'][_0x097f('0x3e')]){_0x1793a9[_0x097f('0x3c')]=_[_0x097f('0x3f')](_0x1793a9[_0x097f('0x3c')],{'$or':_[_0x097f('0x2c')](_0x36884e,function(_0x4c9d3d){if(_0x4c9d3d[_0x097f('0x30')]!==_0x097f('0x40')){var _0x4a500a={};_0x4a500a[_0x4c9d3d[_0x097f('0x29')]]={'$like':'%'+_0x50eab7[_0x097f('0x34')][_0x097f('0x3e')]+'%'};return _0x4a500a;}})});}_0x1793a9=_[_0x097f('0x3f')]({},_0x1793a9,_0x50eab7[_0x097f('0x41')]);var _0x3eb8a7={'where':_0x1793a9[_0x097f('0x3c')]};return db[_0x097f('0x2d')][_0x097f('0x1f')](_0x3eb8a7)[_0x097f('0x25')](function(_0x33ab01){_0x5a72c4[_0x097f('0x1f')]=_0x33ab01;if(_0x50eab7[_0x097f('0x34')][_0x097f('0x42')]){_0x1793a9[_0x097f('0x43')]=[{'all':!![]}];}return db[_0x097f('0x2d')]['findAll'](_0x1793a9);})[_0x097f('0x25')](function(_0x3bd19d){_0x5a72c4[_0x097f('0x44')]=_0x3bd19d;return _0x5a72c4;})[_0x097f('0x25')](respondWithFilteredResult(_0x13303f,_0x1793a9))['catch'](handleError(_0x13303f,null));};exports[_0x097f('0x45')]=function(_0x543b38,_0x1b045f){var _0x369d3e={'raw':!![],'where':{'id':_0x543b38[_0x097f('0x46')]['id']}},_0x2d1f6e={};_0x2d1f6e['model']=_[_0x097f('0x47')](db[_0x097f('0x2d')][_0x097f('0x2e')]);_0x2d1f6e[_0x097f('0x34')]=_[_0x097f('0x47')](_0x543b38[_0x097f('0x34')]);_0x2d1f6e['filters']=_[_0x097f('0x36')](_0x2d1f6e[_0x097f('0x32')],_0x2d1f6e[_0x097f('0x34')]);_0x369d3e[_0x097f('0x37')]=_[_0x097f('0x36')](_0x2d1f6e[_0x097f('0x32')],qs[_0x097f('0x38')](_0x543b38['query'][_0x097f('0x38')]));_0x369d3e[_0x097f('0x37')]=_0x369d3e[_0x097f('0x37')][_0x097f('0x39')]?_0x369d3e[_0x097f('0x37')]:_0x2d1f6e[_0x097f('0x32')];if(_0x543b38[_0x097f('0x34')][_0x097f('0x42')]){_0x369d3e['include']=[{'all':!![]}];}_0x369d3e=_['merge']({},_0x369d3e,_0x543b38[_0x097f('0x41')]);return db[_0x097f('0x2d')][_0x097f('0x48')](_0x369d3e)['then'](handleEntityNotFound(_0x1b045f,null))['then'](respondWithResult(_0x1b045f,null))['catch'](handleError(_0x1b045f,null));};exports[_0x097f('0x49')]=function(_0x2c8aea,_0x5c054f){if(_0x2c8aea[_0x097f('0x4a')]['id']){delete _0x2c8aea[_0x097f('0x4a')]['id'];}return db[_0x097f('0x2d')][_0x097f('0x48')]({'where':{'id':_0x2c8aea['params']['id']}})[_0x097f('0x25')](handleEntityNotFound(_0x5c054f,null))[_0x097f('0x25')](saveUpdates(_0x2c8aea[_0x097f('0x4a')],null))[_0x097f('0x25')](respondWithResult(_0x5c054f,null))['catch'](handleError(_0x5c054f,null));};exports['destroy']=function(_0x4e5362,_0x49ada3){return db[_0x097f('0x2d')][_0x097f('0x48')]({'where':{'id':_0x4e5362[_0x097f('0x46')]['id']}})[_0x097f('0x25')](handleEntityNotFound(_0x49ada3,null))[_0x097f('0x25')](removeEntity(_0x49ada3,null))['catch'](handleError(_0x49ada3,null));};exports[_0x097f('0x4b')]=function(_0x520c75,_0x20d003){var _0x33c8cc;return db['sequelize']['transaction'](function(_0x15dc3c){return db['CmCustomField'][_0x097f('0x4b')](_0x520c75[_0x097f('0x4a')],{'transaction':_0x15dc3c})[_0x097f('0x25')](function(_0x5cb9c5){_0x33c8cc=_0x5cb9c5;var _0x343beb={'type':db[_0x097f('0x4c')][_0x097f('0x4d')],'transaction':_0x15dc3c};switch(_0x520c75['body'][_0x097f('0x30')]){case'text':_0x343beb[_0x097f('0x30')]=db['Sequelize']['TEXT'];break;case'number':_0x343beb[_0x097f('0x30')]=db[_0x097f('0x4c')]['INTEGER'];break;case _0x097f('0x4e'):_0x343beb[_0x097f('0x30')]=db[_0x097f('0x4c')][_0x097f('0x4f')];_0x343beb['defaultValue']=![];break;default:}return db[_0x097f('0x50')]['queryInterface']['addColumn'](_0x097f('0x51'),util[_0x097f('0x52')]('cf_%d',_0x33c8cc['id']),_0x343beb);})[_0x097f('0x25')](function(){return _0x33c8cc;});})[_0x097f('0x25')](respondWithResult(_0x20d003,0xc9))[_0x097f('0x53')](handleError(_0x20d003,null));}; \ No newline at end of file +var _0x31d2=['type','VIRTUAL','merge','includeAll','findAll','show','params','options','find','catch','update','body','create','text','Sequelize','TEXT','INTEGER','switch','BOOLEAN','defaultValue','sequelize','addColumn','format','cf_%d','eml-format','rimraf','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0xba22f4,_0x4f1626){var _0x1d9a19=function(_0x274bb2){while(--_0x274bb2){_0xba22f4['push'](_0xba22f4['shift']());}};_0x1d9a19(++_0x4f1626);}(_0x31d2,0x6c));var _0x231d=function(_0x3ade7d,_0x446f53){_0x3ade7d=_0x3ade7d-0x0;var _0x42ddc9=_0x31d2[_0x3ade7d];return _0x42ddc9;};'use strict';var emlformat=require(_0x231d('0x0'));var rimraf=require(_0x231d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x231d('0x2'));var rp=require(_0x231d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x231d('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x231d('0x5'));var ejs=require(_0x231d('0x6'));var fs=require('fs');var fs_extra=require(_0x231d('0x7'));var _=require(_0x231d('0x8'));var squel=require(_0x231d('0x9'));var crypto=require(_0x231d('0xa'));var jsforce=require(_0x231d('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x231d('0xc'));var Redis=require('ioredis');var authService=require(_0x231d('0xd'));var qs=require(_0x231d('0xe'));var as=require(_0x231d('0xf'));var hardwareService=require(_0x231d('0x10'));var logger=require(_0x231d('0x11'))('api');var utils=require(_0x231d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x231d('0x13'));var db=require(_0x231d('0x14'))['db'];function respondWithStatusCode(_0x59aa5a,_0x3f1e54){_0x3f1e54=_0x3f1e54||0xcc;return function(_0x450b27){if(_0x450b27){return _0x59aa5a[_0x231d('0x15')](_0x3f1e54);}return _0x59aa5a[_0x231d('0x16')](_0x3f1e54)[_0x231d('0x17')]();};}function respondWithResult(_0x4a43c2,_0x2c3d2a){_0x2c3d2a=_0x2c3d2a||0xc8;return function(_0x581187){if(_0x581187){return _0x4a43c2[_0x231d('0x16')](_0x2c3d2a)[_0x231d('0x18')](_0x581187);}};}function respondWithFilteredResult(_0x5f30c0,_0x45d1e2){return function(_0x5099c4){if(_0x5099c4){var _0x58036e=typeof _0x45d1e2[_0x231d('0x19')]==='undefined'&&typeof _0x45d1e2[_0x231d('0x1a')]===_0x231d('0x1b');var _0x35ca8a=_0x5099c4[_0x231d('0x1c')];var _0x5e546f=_0x58036e?0x0:_0x45d1e2[_0x231d('0x19')];var _0x3545ef=_0x58036e?_0x5099c4['count']:_0x45d1e2['offset']+_0x45d1e2[_0x231d('0x1a')];var _0x4852b7;if(_0x3545ef>=_0x35ca8a){_0x3545ef=_0x35ca8a;_0x4852b7=0xc8;}else{_0x4852b7=0xce;}_0x5f30c0[_0x231d('0x16')](_0x4852b7);return _0x5f30c0[_0x231d('0x1d')](_0x231d('0x1e'),_0x5e546f+'-'+_0x3545ef+'/'+_0x35ca8a)[_0x231d('0x18')](_0x5099c4);}return null;};}function patchUpdates(_0xab5eb7){return function(_0x174868){try{jsonpatch[_0x231d('0x1f')](_0x174868,_0xab5eb7,!![]);}catch(_0xae6f2){return BPromise[_0x231d('0x20')](_0xae6f2);}return _0x174868['save']();};}function saveUpdates(_0x39749,_0x235768){return function(_0x3f3015){if(_0x3f3015){return _0x3f3015['update'](_0x39749)[_0x231d('0x21')](function(_0x36f723){return _0x36f723;});}return null;};}function removeEntity(_0x55cdb7,_0x157a6d){return function(_0x380da4){if(_0x380da4){return _0x380da4[_0x231d('0x22')]()[_0x231d('0x21')](function(){_0x55cdb7[_0x231d('0x16')](0xcc)[_0x231d('0x17')]();});}};}function handleEntityNotFound(_0x1d6fe9,_0x5e7d35){return function(_0x16bcd4){if(!_0x16bcd4){_0x1d6fe9['sendStatus'](0x194);}return _0x16bcd4;};}function handleError(_0x248296,_0x5954c7){_0x5954c7=_0x5954c7||0x1f4;return function(_0x3a9fd5){logger['error'](_0x3a9fd5[_0x231d('0x23')]);if(_0x3a9fd5['name']){delete _0x3a9fd5[_0x231d('0x24')];}_0x248296[_0x231d('0x16')](_0x5954c7)[_0x231d('0x25')](_0x3a9fd5);};}exports[_0x231d('0x26')]=function(_0x550931,_0x4c3488){var _0x44c531={},_0x492864={},_0xb7acae={'count':0x0,'rows':[]};var _0x2ee1c5=_['map'](db[_0x231d('0x27')][_0x231d('0x28')],function(_0x4586d0){return{'name':_0x4586d0[_0x231d('0x29')],'type':_0x4586d0['type'][_0x231d('0x2a')]};});_0x492864[_0x231d('0x2b')]=_[_0x231d('0x2c')](_[_0x231d('0x2d')](_0x2ee1c5,_0x231d('0x24')),[_0x231d('0x24')]);_0x492864[_0x231d('0x2e')]=_[_0x231d('0x2f')](_0x550931['query']);_0x492864[_0x231d('0x30')]=_[_0x231d('0x31')](_0x492864[_0x231d('0x2b')],_0x492864[_0x231d('0x2e')]);_0x44c531[_0x231d('0x32')]=_['intersection'](_0x492864[_0x231d('0x2b')],qs[_0x231d('0x33')](_0x550931[_0x231d('0x2e')][_0x231d('0x33')]));_0x44c531[_0x231d('0x32')]=_0x44c531['attributes'][_0x231d('0x34')]?_0x44c531[_0x231d('0x32')]:_0x492864[_0x231d('0x2b')];if(!_0x550931[_0x231d('0x2e')][_0x231d('0x35')](_0x231d('0x36'))){_0x44c531[_0x231d('0x1a')]=qs[_0x231d('0x1a')](_0x550931[_0x231d('0x2e')][_0x231d('0x1a')]);_0x44c531[_0x231d('0x19')]=qs[_0x231d('0x19')](_0x550931[_0x231d('0x2e')][_0x231d('0x19')]);}_0x44c531[_0x231d('0x37')]=qs[_0x231d('0x38')](_0x550931[_0x231d('0x2e')][_0x231d('0x38')]);_0x44c531['where']=qs['filters'](_[_0x231d('0x39')](_0x550931[_0x231d('0x2e')],_0x492864['filters']),_0x2ee1c5);if(_0x550931[_0x231d('0x2e')][_0x231d('0x3a')]){_0x44c531[_0x231d('0x3b')]=_['merge'](_0x44c531['where'],{'$or':_['map'](_0x2ee1c5,function(_0x1d7025){if(_0x1d7025[_0x231d('0x3c')]!==_0x231d('0x3d')){var _0x15f5e5={};_0x15f5e5[_0x1d7025['name']]={'$like':'%'+_0x550931[_0x231d('0x2e')][_0x231d('0x3a')]+'%'};return _0x15f5e5;}})});}_0x44c531=_[_0x231d('0x3e')]({},_0x44c531,_0x550931['options']);var _0x2dd3b6={'where':_0x44c531[_0x231d('0x3b')]};return db[_0x231d('0x27')]['count'](_0x2dd3b6)['then'](function(_0x26bca7){_0xb7acae[_0x231d('0x1c')]=_0x26bca7;if(_0x550931['query'][_0x231d('0x3f')]){_0x44c531['include']=[{'all':!![]}];}return db[_0x231d('0x27')][_0x231d('0x40')](_0x44c531);})['then'](function(_0x586113){_0xb7acae['rows']=_0x586113;return _0xb7acae;})[_0x231d('0x21')](respondWithFilteredResult(_0x4c3488,_0x44c531))['catch'](handleError(_0x4c3488,null));};exports[_0x231d('0x41')]=function(_0x4e3a78,_0x50d027){var _0x1ee012={'raw':!![],'where':{'id':_0x4e3a78[_0x231d('0x42')]['id']}},_0x145b2a={};_0x145b2a[_0x231d('0x2b')]=_[_0x231d('0x2f')](db[_0x231d('0x27')][_0x231d('0x28')]);_0x145b2a[_0x231d('0x2e')]=_[_0x231d('0x2f')](_0x4e3a78[_0x231d('0x2e')]);_0x145b2a[_0x231d('0x30')]=_[_0x231d('0x31')](_0x145b2a[_0x231d('0x2b')],_0x145b2a[_0x231d('0x2e')]);_0x1ee012['attributes']=_[_0x231d('0x31')](_0x145b2a['model'],qs[_0x231d('0x33')](_0x4e3a78[_0x231d('0x2e')][_0x231d('0x33')]));_0x1ee012[_0x231d('0x32')]=_0x1ee012[_0x231d('0x32')][_0x231d('0x34')]?_0x1ee012[_0x231d('0x32')]:_0x145b2a[_0x231d('0x2b')];if(_0x4e3a78[_0x231d('0x2e')]['includeAll']){_0x1ee012['include']=[{'all':!![]}];}_0x1ee012=_[_0x231d('0x3e')]({},_0x1ee012,_0x4e3a78[_0x231d('0x43')]);return db['CmCustomField'][_0x231d('0x44')](_0x1ee012)[_0x231d('0x21')](handleEntityNotFound(_0x50d027,null))['then'](respondWithResult(_0x50d027,null))[_0x231d('0x45')](handleError(_0x50d027,null));};exports[_0x231d('0x46')]=function(_0xd5267,_0x880007){if(_0xd5267[_0x231d('0x47')]['id']){delete _0xd5267[_0x231d('0x47')]['id'];}return db['CmCustomField'][_0x231d('0x44')]({'where':{'id':_0xd5267['params']['id']}})[_0x231d('0x21')](handleEntityNotFound(_0x880007,null))[_0x231d('0x21')](saveUpdates(_0xd5267[_0x231d('0x47')],null))[_0x231d('0x21')](respondWithResult(_0x880007,null))[_0x231d('0x45')](handleError(_0x880007,null));};exports[_0x231d('0x22')]=function(_0x380673,_0x354450){return db['CmCustomField']['find']({'where':{'id':_0x380673[_0x231d('0x42')]['id']}})[_0x231d('0x21')](handleEntityNotFound(_0x354450,null))[_0x231d('0x21')](removeEntity(_0x354450,null))[_0x231d('0x45')](handleError(_0x354450,null));};exports[_0x231d('0x48')]=function(_0xeb5be4,_0x78e0df){var _0x4564c5;return db['sequelize']['transaction'](function(_0xa603af){return db[_0x231d('0x27')][_0x231d('0x48')](_0xeb5be4[_0x231d('0x47')],{'transaction':_0xa603af})[_0x231d('0x21')](function(_0x57fd5a){_0x4564c5=_0x57fd5a;var _0x456c54={'type':db['Sequelize']['TEXT'],'transaction':_0xa603af};switch(_0xeb5be4[_0x231d('0x47')]['type']){case _0x231d('0x49'):_0x456c54[_0x231d('0x3c')]=db[_0x231d('0x4a')][_0x231d('0x4b')];break;case'number':_0x456c54[_0x231d('0x3c')]=db[_0x231d('0x4a')][_0x231d('0x4c')];break;case _0x231d('0x4d'):_0x456c54[_0x231d('0x3c')]=db['Sequelize'][_0x231d('0x4e')];_0x456c54[_0x231d('0x4f')]=![];break;default:}return db[_0x231d('0x50')]['queryInterface'][_0x231d('0x51')]('cm_contacts',util[_0x231d('0x52')](_0x231d('0x53'),_0x4564c5['id']),_0x456c54);})[_0x231d('0x21')](function(){return _0x4564c5;});})[_0x231d('0x21')](respondWithResult(_0x78e0df,0xc9))['catch'](handleError(_0x78e0df,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 1c5f359..c0915fc 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 _0x6c15=['exports','cm_custom_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./cmCustomField.attributes'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x6c15,0x11a));var _0x56c1=function(_0x7a7756,_0x501bb1){_0x7a7756=_0x7a7756-0x0;var _0x1e8cb6=_0x6c15[_0x7a7756];return _0x1e8cb6;};'use strict';var _=require(_0x56c1('0x0'));var util=require(_0x56c1('0x1'));var logger=require(_0x56c1('0x2'))('api');var moment=require(_0x56c1('0x3'));var BPromise=require(_0x56c1('0x4'));var rp=require(_0x56c1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x56c1('0x6'));var config=require('../../config/environment');var attributes=require(_0x56c1('0x7'));module[_0x56c1('0x8')]=function(_0x115ef6,_0x29d143){return _0x115ef6['define']('CmCustomField',attributes,{'tableName':_0x56c1('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x806c=['./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x806c,0x13c));var _0xc806=function(_0x2ef44b,_0x553359){_0x2ef44b=_0x2ef44b-0x0;var _0x2405b9=_0x806c[_0x2ef44b];return _0x2405b9;};'use strict';var _=require(_0xc806('0x0'));var util=require(_0xc806('0x1'));var logger=require('../../config/logger')(_0xc806('0x2'));var moment=require(_0xc806('0x3'));var BPromise=require(_0xc806('0x4'));var rp=require(_0xc806('0x5'));var fs=require('fs');var path=require(_0xc806('0x6'));var rimraf=require(_0xc806('0x7'));var config=require(_0xc806('0x8'));var attributes=require(_0xc806('0x9'));module[_0xc806('0xa')]=function(_0x4b26ef,_0x1003b2){return _0x4b26ef['define'](_0xc806('0xb'),attributes,{'tableName':_0xc806('0xc'),'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 91918e6..89cf55e 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 _0xea6d=['then','info','CmCustomField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x22f165,_0x11ec9b){var _0xdf9184=function(_0x514329){while(--_0x514329){_0x22f165['push'](_0x22f165['shift']());}};_0xdf9184(++_0x11ec9b);}(_0xea6d,0x1c2));var _0xdea6=function(_0x5aab0d,_0x5f328c){_0x5aab0d=_0x5aab0d-0x0;var _0x272b83=_0xea6d[_0x5aab0d];return _0x272b83;};'use strict';var _=require(_0xdea6('0x0'));var util=require(_0xdea6('0x1'));var moment=require('moment');var BPromise=require(_0xdea6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdea6('0x3'));var db=require(_0xdea6('0x4'))['db'];var utils=require(_0xdea6('0x5'));var logger=require(_0xdea6('0x6'))(_0xdea6('0x7'));var config=require('../../config/environment');var jayson=require(_0xdea6('0x8'));var client=jayson[_0xdea6('0x9')][_0xdea6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b62d2,_0x4b81e2,_0x7deb31){return new BPromise(function(_0x39f52d,_0x127880){return client[_0xdea6('0xb')](_0x3b62d2,_0x7deb31)[_0xdea6('0xc')](function(_0x15743a){logger[_0xdea6('0xd')](_0xdea6('0xe'),_0x4b81e2,'request\x20sent');logger[_0xdea6('0xf')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x4b81e2,_0xdea6('0x10'),JSON[_0xdea6('0x11')](_0x15743a));if(_0x15743a['error']){if(_0x15743a['error']['code']===0x1f4){logger['error'](_0xdea6('0xe'),_0x4b81e2,_0x15743a[_0xdea6('0x12')][_0xdea6('0x13')]);return _0x127880(_0x15743a['error'][_0xdea6('0x13')]);}logger[_0xdea6('0x12')]('CmCustomField,\x20%s,\x20%s',_0x4b81e2,_0x15743a[_0xdea6('0x12')][_0xdea6('0x13')]);return _0x39f52d(_0x15743a[_0xdea6('0x12')]['message']);}else{logger[_0xdea6('0xd')](_0xdea6('0xe'),_0x4b81e2,'request\x20sent');_0x39f52d(_0x15743a[_0xdea6('0x14')][_0xdea6('0x13')]);}})[_0xdea6('0x15')](function(_0x1db03d){logger[_0xdea6('0x12')]('CmCustomField,\x20%s,\x20%s',_0x4b81e2,_0x1db03d);_0x127880(_0x1db03d);});});} \ No newline at end of file +var _0x4eec=['http','request','then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x26b80e,_0x5c9333){var _0x84a8a8=function(_0x2e5b4a){while(--_0x2e5b4a){_0x26b80e['push'](_0x26b80e['shift']());}};_0x84a8a8(++_0x5c9333);}(_0x4eec,0x12b));var _0xc4ee=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4eec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc4ee('0x0'));var util=require('util');var moment=require(_0xc4ee('0x1'));var BPromise=require('bluebird');var rs=require(_0xc4ee('0x2'));var fs=require('fs');var Redis=require(_0xc4ee('0x3'));var db=require(_0xc4ee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4ee('0x5'))(_0xc4ee('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc4ee('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x835121,_0x4bcd74,_0x4a92a7){return new BPromise(function(_0x48feed,_0x19a384){return client[_0xc4ee('0x8')](_0x835121,_0x4a92a7)[_0xc4ee('0x9')](function(_0x378c36){logger['info'](_0xc4ee('0xa'),_0x4bcd74,'request\x20sent');logger[_0xc4ee('0xb')](_0xc4ee('0xc'),_0x4bcd74,'request\x20sent',JSON['stringify'](_0x378c36));if(_0x378c36[_0xc4ee('0xd')]){if(_0x378c36[_0xc4ee('0xd')][_0xc4ee('0xe')]===0x1f4){logger[_0xc4ee('0xd')](_0xc4ee('0xa'),_0x4bcd74,_0x378c36[_0xc4ee('0xd')][_0xc4ee('0xf')]);return _0x19a384(_0x378c36['error'][_0xc4ee('0xf')]);}logger[_0xc4ee('0xd')](_0xc4ee('0xa'),_0x4bcd74,_0x378c36[_0xc4ee('0xd')][_0xc4ee('0xf')]);return _0x48feed(_0x378c36[_0xc4ee('0xd')][_0xc4ee('0xf')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x4bcd74,'request\x20sent');_0x48feed(_0x378c36[_0xc4ee('0x10')][_0xc4ee('0xf')]);}})[_0xc4ee('0x11')](function(_0x549f08){logger[_0xc4ee('0xd')](_0xc4ee('0xa'),_0x4bcd74,_0x549f08);_0x19a384(_0x549f08);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 4423fe6..714e198 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 _0x9376=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','isAuthenticated','show','post','create','put','/:id','update','delete','exports','multer','util'];(function(_0x185c76,_0x534cc3){var _0x7820b7=function(_0x3bcd58){while(--_0x3bcd58){_0x185c76['push'](_0x185c76['shift']());}};_0x7820b7(++_0x534cc3);}(_0x9376,0x18a));var _0x6937=function(_0x810047,_0x21339c){_0x810047=_0x810047-0x0;var _0x361672=_0x9376[_0x810047];return _0x361672;};'use strict';var multer=require(_0x6937('0x0'));var util=require(_0x6937('0x1'));var path=require(_0x6937('0x2'));var timeout=require(_0x6937('0x3'));var express=require(_0x6937('0x4'));var router=express[_0x6937('0x5')]();var fs_extra=require(_0x6937('0x6'));var auth=require(_0x6937('0x7'));var interaction=require(_0x6937('0x8'));var config=require(_0x6937('0x9'));var controller=require(_0x6937('0xa'));router[_0x6937('0xb')]('/',auth['isAuthenticated'](),controller[_0x6937('0xc')]);router['get']('/:id',auth[_0x6937('0xd')](),controller[_0x6937('0xe')]);router[_0x6937('0xf')]('/',auth[_0x6937('0xd')](),controller[_0x6937('0x10')]);router[_0x6937('0x11')](_0x6937('0x12'),auth['isAuthenticated'](),controller[_0x6937('0x13')]);router[_0x6937('0x14')](_0x6937('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x6937('0x15')]=router; \ No newline at end of file +var _0x7163=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x7163,0x1ef));var _0x3716=function(_0x3c4a7c,_0x2f4e3c){_0x3c4a7c=_0x3c4a7c-0x0;var _0xf13d1e=_0x7163[_0x3c4a7c];return _0xf13d1e;};'use strict';var multer=require(_0x3716('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3716('0x1'));var express=require(_0x3716('0x2'));var router=express[_0x3716('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3716('0x4'));var interaction=require(_0x3716('0x5'));var config=require(_0x3716('0x6'));var controller=require(_0x3716('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3716('0x8')]);router[_0x3716('0x9')](_0x3716('0xa'),auth[_0x3716('0xb')](),controller[_0x3716('0xc')]);router[_0x3716('0xd')]('/',auth[_0x3716('0xb')](),controller[_0x3716('0xe')]);router[_0x3716('0xf')](_0x3716('0xa'),auth[_0x3716('0xb')](),controller[_0x3716('0x10')]);router[_0x3716('0x11')](_0x3716('0xa'),auth[_0x3716('0xb')](),controller[_0x3716('0x12')]);module[_0x3716('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 7889300..df25637 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 _0x471a=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE','format'];(function(_0x27bd2c,_0x24bd98){var _0x3784ea=function(_0x4ca802){while(--_0x4ca802){_0x27bd2c['push'](_0x27bd2c['shift']());}};_0x3784ea(++_0x24bd98);}(_0x471a,0x6f));var _0xa471=function(_0x294b7a,_0x51b167){_0x294b7a=_0x294b7a-0x0;var _0x30d2a3=_0x471a[_0x294b7a];return _0x30d2a3;};'use strict';var moment=require(_0xa471('0x0'));var Sequelize=require(_0xa471('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa471('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xa471('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa471('0x4')],'defaultValue':moment()[_0xa471('0x5')](_0xa471('0x6'))},'countbusyretry':{'type':Sequelize[_0xa471('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa471('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa471('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa471('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa471('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa471('0x4')]},'priority':{'type':Sequelize[_0xa471('0x7')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa471('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa471('0x7')],'unique':_0xa471('0x8')},'ListId':{'type':Sequelize[_0xa471('0x7')],'unique':_0xa471('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xa471('0x7')],'unique':_0xa471('0x8')},'CampaignId':{'type':Sequelize[_0xa471('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xa471('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa471('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa471('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa471('0x7')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file +var _0xba8b=['STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED','contactListQueue','sequelize','exports'];(function(_0x2702fc,_0x379255){var _0x47bfc6=function(_0x512bc7){while(--_0x512bc7){_0x2702fc['push'](_0x2702fc['shift']());}};_0x47bfc6(++_0x379255);}(_0xba8b,0x1b7));var _0xbba8=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xba8b[_0x27af45];return _0x18df21;};'use strict';var moment=require('moment');var Sequelize=require(_0xbba8('0x0'));module[_0xbba8('0x1')]={'phone':{'type':Sequelize[_0xbba8('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xbba8('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xbba8('0x4')],'defaultValue':moment()[_0xbba8('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xbba8('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xbba8('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xbba8('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xbba8('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xbba8('0x4')]},'priority':{'type':Sequelize[_0xbba8('0x6')](0x2)[_0xbba8('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xbba8('0x6')],'unique':_0xbba8('0x8')},'ListId':{'type':Sequelize[_0xbba8('0x6')],'unique':_0xbba8('0x8')},'UserId':{'type':Sequelize[_0xbba8('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xbba8('0x6')],'unique':_0xbba8('0x8')},'CampaignId':{'type':Sequelize[_0xbba8('0x6')]},'countnosuchnumberretry':{'type':Sequelize[_0xbba8('0x6')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xbba8('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xbba8('0x6')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xbba8('0x6')],'allowNull':!![],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 78ccc55..261ea28 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 _0x4bc3=['where','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','update','body','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','isNil','firstName','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','getPreview','getVoiceQueues','preview','dialOrderByScheduledAt','sequelize','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','UPDATE','CmCompany','Company','dialActive','getOpenContacts','outbound','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','json','apply','reject','destroy','then','sendStatus','stack','name','send','CmHopper','rawAttributes','fieldName','type','key','map','keys','filters','intersection','model','query','concat','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notLike','$iLike','$notILike','$like','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0x4bc3,0x16e));var _0x34bc=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x4bc3[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require(_0x34bc('0x0'));var rimraf=require(_0x34bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34bc('0x2'));var rp=require(_0x34bc('0x3'));var moment=require('moment');var BPromise=require(_0x34bc('0x4'));var Mustache=require(_0x34bc('0x5'));var util=require(_0x34bc('0x6'));var path=require(_0x34bc('0x7'));var sox=require(_0x34bc('0x8'));var csv=require(_0x34bc('0x9'));var ejs=require(_0x34bc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x34bc('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x34bc('0xc'));var deskjs=require(_0x34bc('0xd'));var toCsv=require(_0x34bc('0x9'));var querystring=require(_0x34bc('0xe'));var Papa=require(_0x34bc('0xf'));var Redis=require(_0x34bc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x34bc('0x11'));var hardwareService=require(_0x34bc('0x12'));var logger=require(_0x34bc('0x13'))('api');var utils=require(_0x34bc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x34bc('0x15'));var db=require(_0x34bc('0x16'))['db'];function respondWithStatusCode(_0x164fb2,_0x536ebd){_0x536ebd=_0x536ebd||0xcc;return function(_0x3f8852){if(_0x3f8852){return _0x164fb2['sendStatus'](_0x536ebd);}return _0x164fb2[_0x34bc('0x17')](_0x536ebd)[_0x34bc('0x18')]();};}function respondWithResult(_0xc77013,_0x5a22a3){_0x5a22a3=_0x5a22a3||0xc8;return function(_0x4c365a){if(_0x4c365a){return _0xc77013[_0x34bc('0x17')](_0x5a22a3)['json'](_0x4c365a);}};}function respondWithFilteredResult(_0x3e93bf,_0x217605){return function(_0x1da8eb){if(_0x1da8eb){var _0x25da29=typeof _0x217605[_0x34bc('0x19')]===_0x34bc('0x1a')&&typeof _0x217605['limit']==='undefined';var _0x5a5895=_0x1da8eb[_0x34bc('0x1b')];var _0x3eaedf=_0x25da29?0x0:_0x217605[_0x34bc('0x19')];var _0x239e6c=_0x25da29?_0x1da8eb['count']:_0x217605[_0x34bc('0x19')]+_0x217605[_0x34bc('0x1c')];var _0x50106a;if(_0x239e6c>=_0x5a5895){_0x239e6c=_0x5a5895;_0x50106a=0xc8;}else{_0x50106a=0xce;}_0x3e93bf[_0x34bc('0x17')](_0x50106a);return _0x3e93bf[_0x34bc('0x1d')]('Content-Range',_0x3eaedf+'-'+_0x239e6c+'/'+_0x5a5895)[_0x34bc('0x1e')](_0x1da8eb);}return null;};}function patchUpdates(_0x26cdec){return function(_0x2d18ea){try{jsonpatch[_0x34bc('0x1f')](_0x2d18ea,_0x26cdec,!![]);}catch(_0x1f993b){return BPromise[_0x34bc('0x20')](_0x1f993b);}return _0x2d18ea['save']();};}function saveUpdates(_0x40e128,_0x3c9939){return function(_0x38882c){if(_0x38882c){return _0x38882c['update'](_0x40e128)['then'](function(_0x358d51){return _0x358d51;});}return null;};}function removeEntity(_0x1b820a,_0x4263de){return function(_0x410800){if(_0x410800){return _0x410800[_0x34bc('0x21')]()[_0x34bc('0x22')](function(){_0x1b820a[_0x34bc('0x17')](0xcc)[_0x34bc('0x18')]();});}};}function handleEntityNotFound(_0x19472e,_0x25d6fe){return function(_0x2de017){if(!_0x2de017){_0x19472e[_0x34bc('0x23')](0x194);}return _0x2de017;};}function handleError(_0x4fd589,_0x43e527){_0x43e527=_0x43e527||0x1f4;return function(_0x48ec13){logger['error'](_0x48ec13[_0x34bc('0x24')]);if(_0x48ec13['name']){delete _0x48ec13[_0x34bc('0x25')];}_0x4fd589[_0x34bc('0x17')](_0x43e527)[_0x34bc('0x26')](_0x48ec13);};}exports['index']=function(_0x2e6d96,_0x351ed8){var _0x384fd7={},_0x1a83f7={},_0x2bb874={'count':0x0,'rows':[]};var _0x33bf46=_['map'](db[_0x34bc('0x27')][_0x34bc('0x28')],function(_0x22aacc){return{'name':_0x22aacc[_0x34bc('0x29')],'type':_0x22aacc[_0x34bc('0x2a')][_0x34bc('0x2b')]};});_0x1a83f7['model']=_[_0x34bc('0x2c')](_0x33bf46,'name');_0x1a83f7['query']=_[_0x34bc('0x2d')](_0x2e6d96['query']);_0x1a83f7[_0x34bc('0x2e')]=_[_0x34bc('0x2f')](_0x1a83f7[_0x34bc('0x30')],_0x1a83f7[_0x34bc('0x31')]);_0x1a83f7[_0x34bc('0x2e')]=_[_0x34bc('0x32')](_0x1a83f7[_0x34bc('0x2e')],['$and',_0x34bc('0x33'),_0x34bc('0x34'),_0x34bc('0x35'),_0x34bc('0x36'),_0x34bc('0x37'),'$ne',_0x34bc('0x38'),_0x34bc('0x39'),_0x34bc('0x3a'),_0x34bc('0x3b'),_0x34bc('0x3c'),'$notIn','$like',_0x34bc('0x3d'),_0x34bc('0x3e'),_0x34bc('0x3f'),_0x34bc('0x40'),'$overlap',_0x34bc('0x41'),_0x34bc('0x42'),_0x34bc('0x43')]);_0x384fd7['attributes']=_[_0x34bc('0x2f')](_0x1a83f7[_0x34bc('0x30')],qs[_0x34bc('0x44')](_0x2e6d96[_0x34bc('0x31')]['fields']));_0x384fd7[_0x34bc('0x45')]=_0x384fd7[_0x34bc('0x45')][_0x34bc('0x46')]?_0x384fd7['attributes']:_0x1a83f7[_0x34bc('0x30')];if(!_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x47')](_0x34bc('0x48'))){_0x384fd7[_0x34bc('0x1c')]=qs['limit'](_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x1c')]);_0x384fd7[_0x34bc('0x19')]=qs[_0x34bc('0x19')](_0x2e6d96[_0x34bc('0x31')]['offset']);}_0x384fd7[_0x34bc('0x49')]=qs['sort'](_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x4a')]);_0x384fd7[_0x34bc('0x4b')]=qs[_0x34bc('0x2e')](_['pick'](_0x2e6d96[_0x34bc('0x31')],_0x1a83f7[_0x34bc('0x2e')]),_0x33bf46);if(_0x2e6d96['query'][_0x34bc('0x4c')]){_0x384fd7[_0x34bc('0x4b')]=_[_0x34bc('0x4d')](_0x384fd7['where'],{'$or':_[_0x34bc('0x2c')](_0x33bf46,function(_0xbf2127){if(_0xbf2127[_0x34bc('0x2a')]!==_0x34bc('0x4e')){var _0xacada7={};_0xacada7[_0xbf2127[_0x34bc('0x25')]]={'$like':'%'+_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x4c')]+'%'};return _0xacada7;}})});}_0x384fd7=_[_0x34bc('0x4d')]({},_0x384fd7,_0x2e6d96[_0x34bc('0x4f')]);var _0x370c6f={'where':_0x384fd7['where']};return db['CmHopper'][_0x34bc('0x1b')](_0x370c6f)[_0x34bc('0x22')](function(_0x244b64){_0x2bb874[_0x34bc('0x1b')]=_0x244b64;if(_0x2e6d96[_0x34bc('0x31')][_0x34bc('0x50')]){_0x384fd7['include']=[{'all':!![]}];}return db[_0x34bc('0x27')]['findAll'](_0x384fd7);})[_0x34bc('0x22')](function(_0x2a21b4){_0x2bb874[_0x34bc('0x51')]=_0x2a21b4;return _0x2bb874;})['then'](respondWithFilteredResult(_0x351ed8,_0x384fd7))[_0x34bc('0x52')](handleError(_0x351ed8,null));};exports[_0x34bc('0x53')]=function(_0x1b42f5,_0x1c6480){var _0x21b903={'raw':!![],'where':{'id':_0x1b42f5[_0x34bc('0x54')]['id']}},_0x26924c={};_0x26924c[_0x34bc('0x30')]=_[_0x34bc('0x2d')](db[_0x34bc('0x27')][_0x34bc('0x28')]);_0x26924c[_0x34bc('0x31')]=_['keys'](_0x1b42f5['query']);_0x26924c[_0x34bc('0x2e')]=_[_0x34bc('0x2f')](_0x26924c[_0x34bc('0x30')],_0x26924c['query']);_0x21b903['attributes']=_[_0x34bc('0x2f')](_0x26924c[_0x34bc('0x30')],qs[_0x34bc('0x44')](_0x1b42f5['query'][_0x34bc('0x44')]));_0x21b903[_0x34bc('0x45')]=_0x21b903['attributes'][_0x34bc('0x46')]?_0x21b903['attributes']:_0x26924c[_0x34bc('0x30')];if(_0x1b42f5['query'][_0x34bc('0x50')]){_0x21b903[_0x34bc('0x55')]=[{'all':!![]}];}_0x21b903=_[_0x34bc('0x4d')]({},_0x21b903,_0x1b42f5[_0x34bc('0x4f')]);return db['CmHopper'][_0x34bc('0x56')](_0x21b903)[_0x34bc('0x22')](handleEntityNotFound(_0x1c6480,null))[_0x34bc('0x22')](respondWithResult(_0x1c6480,null))[_0x34bc('0x52')](handleError(_0x1c6480,null));};exports[_0x34bc('0x57')]=function(_0x943e1c,_0x18eadd){return db[_0x34bc('0x27')]['create'](_0x943e1c['body'],{})['then'](respondWithResult(_0x18eadd,0xc9))[_0x34bc('0x52')](handleError(_0x18eadd,null));};exports[_0x34bc('0x58')]=function(_0x584ef6,_0x330296){if(_0x584ef6[_0x34bc('0x59')]['id']){delete _0x584ef6[_0x34bc('0x59')]['id'];}return db[_0x34bc('0x27')][_0x34bc('0x56')]({'where':{'id':_0x584ef6['params']['id']}})['then'](handleEntityNotFound(_0x330296,null))['then'](saveUpdates(_0x584ef6[_0x34bc('0x59')],null))[_0x34bc('0x22')](respondWithResult(_0x330296,null))[_0x34bc('0x52')](handleError(_0x330296,null));};exports[_0x34bc('0x5a')]=function(_0x301c23,_0x55c41e){return db[_0x34bc('0x27')][_0x34bc('0x5a')]()[_0x34bc('0x22')](respondWithResult(_0x55c41e,null))[_0x34bc('0x52')](handleError(_0x55c41e,null));};exports['destroy']=function(_0x1a2cf2,_0x9b0c7c){var _0x29d7df;var _0x91e6c5=_0x1a2cf2[_0x34bc('0x54')]['id'];return db[_0x34bc('0x27')][_0x34bc('0x56')]({'where':{'id':_0x1a2cf2[_0x34bc('0x54')]['id']}})[_0x34bc('0x22')](handleEntityNotFound(_0x9b0c7c,null))[_0x34bc('0x22')](function(_0x39c580){if(_0x39c580){return _0x39c580[_0x34bc('0x21')]()[_0x34bc('0x22')](function(_0x592e81){return _0x592e81;});}})[_0x34bc('0x22')](function(_0x2cc1f5){_0x29d7df=_0x2cc1f5;if(_0x2cc1f5){if(_0x2cc1f5[_0x34bc('0x5b')]||_0x2cc1f5[_0x34bc('0x5c')]){return db[_0x2cc1f5[_0x34bc('0x5b')]?_0x34bc('0x5d'):_0x34bc('0x5e')][_0x34bc('0x56')]({'where':{'id':_0x2cc1f5[_0x34bc('0x5b')]?_0x2cc1f5[_0x34bc('0x5b')]:_0x2cc1f5[_0x34bc('0x5c')]},'attributes':['id',_0x34bc('0x25')],'raw':!![]});}}})[_0x34bc('0x22')](function(_0x365d29){var _0x50e41b={};if(_0x365d29){_[_0x34bc('0x4d')](_0x50e41b,_[_0x34bc('0x5f')](_0x29d7df[_0x34bc('0x60')],[_0x34bc('0x61'),_0x34bc('0x62'),'id']));_0x50e41b[_0x34bc('0x63')]=0x15;_0x50e41b[_0x34bc('0x64')]=_0x34bc('0x65');_0x50e41b[_0x34bc('0x66')]=_0x365d29[_0x34bc('0x25')];_0x50e41b['membername']=_0x1a2cf2[_0x34bc('0x67')][_0x34bc('0x25')];_0x50e41b[_0x34bc('0x68')]=_0x1a2cf2['user']['id'];_0x50e41b[_0x34bc('0x65')]=!![];_0x50e41b[_0x34bc('0x69')]=moment()[_0x34bc('0x6a')](_0x34bc('0x6b'));_0x50e41b['calleridnum']=_0x29d7df[_0x34bc('0x6c')];_0x50e41b[_0x34bc('0x6d')]=_0x29d7df[_0x34bc('0x5b')]?_0x34bc('0x6e'):_0x34bc('0x6f');return db[_0x34bc('0x70')][_0x34bc('0x56')]({'where':{'id':_0x50e41b[_0x34bc('0x71')]},'attributes':['firstName','lastName']})[_0x34bc('0x22')](function(_0x1dd036){if(!_[_0x34bc('0x72')](_0x9b0c7c)&&!_[_0x34bc('0x72')](_0x1dd036[_0x34bc('0x73')])){_0x50e41b[_0x34bc('0x74')]=_0x1dd036[_0x34bc('0x73')];if(!_[_0x34bc('0x72')](_0x1dd036[_0x34bc('0x75')])){_0x50e41b[_0x34bc('0x74')]+='\x20'+_0x1dd036[_0x34bc('0x75')];}}})[_0x34bc('0x76')](function(){return db[_0x34bc('0x77')][_0x34bc('0x57')](_0x50e41b);});}})['then'](function(_0x3344ac){return db[_0x34bc('0x78')][_0x34bc('0x21')]({'where':{'CmHopperId':_0x91e6c5}});})['then'](function(){return _0x9b0c7c[_0x34bc('0x17')](0xcc)[_0x34bc('0x18')]();})[_0x34bc('0x52')](handleError(_0x9b0c7c,null));};exports[_0x34bc('0x79')]=function(_0x570876,_0x13007f,_0x278133){var _0x1542b7=[];return db[_0x34bc('0x70')][_0x34bc('0x5a')]()['then'](function(_0xc08131){_0x1542b7=_[_0x34bc('0x2d')](_0xc08131);return _0x570876[_0x34bc('0x67')][_0x34bc('0x7a')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x34bc('0x7b')},'attributes':['id',_0x34bc('0x7c')],'raw':!![]});})[_0x34bc('0x22')](function(_0x2915ec){if(_0x2915ec&&_0x2915ec[_0x34bc('0x46')]){return db[_0x34bc('0x7d')]['transaction'](function(_0x5d87dd){var _0x2c9c2f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x34bc('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x34bc('0x2c')](_0x2915ec,'id')},'$or':[{'UserId':null},{'UserId':_0x570876[_0x34bc('0x67')]['id']}]};var _0x1cb3da=[];if(_0x570876[_0x34bc('0x59')]['direction']&&_0x570876['body'][_0x34bc('0x7e')]===_0x34bc('0x7f')){if(!_[_0x34bc('0x80')](_0x570876[_0x34bc('0x59')][_0x34bc('0x81')])){_0x2c9c2f['id']={'$in':_0x570876[_0x34bc('0x59')][_0x34bc('0x81')]};}_0x1cb3da=[[_0x34bc('0x82'),_0x34bc('0x83')],[_0x34bc('0x84'),_0x2915ec[0x0][_0x34bc('0x7c')]===_0x34bc('0x83')?_0x34bc('0x85'):_0x34bc('0x83')],db[_0x34bc('0x7d')][_0x34bc('0x86')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x34bc('0x85')]];}else{if(!_[_0x34bc('0x80')](_0x570876[_0x34bc('0x59')][_0x34bc('0x81')])){_0x2c9c2f['id']={'$notIn':_0x570876[_0x34bc('0x59')]['hopperIds']};}_0x1cb3da=[[_0x34bc('0x82'),_0x34bc('0x85')],[_0x34bc('0x84'),_0x2915ec[0x0][_0x34bc('0x7c')]],db[_0x34bc('0x7d')]['literal'](_0x34bc('0x87')),['id',_0x34bc('0x83')]];}return db[_0x34bc('0x27')][_0x34bc('0x88')]({'attributes':['id',_0x34bc('0x89'),_0x34bc('0x6c')],'where':_0x2c9c2f,'order':_0x1cb3da,'transaction':_0x5d87dd,'lock':_0x5d87dd['LOCK'][_0x34bc('0x8a')],'include':[{'model':db[_0x34bc('0x70')],'as':'Contact','attributes':_0x1542b7,'include':[{'model':db[_0x34bc('0x8b')],'as':_0x34bc('0x8c'),'attributes':['id',_0x34bc('0x25')]}]},{'model':db['CmList'],'as':'List','attributes':['id',_0x34bc('0x25')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0x34bc('0x8d')]}]})[_0x34bc('0x22')](function(_0xe9a677){if(_0xe9a677){return _0xe9a677['update']({'UserId':_0x570876[_0x34bc('0x67')]['id']},{'transaction':_0x5d87dd});}});});}})[_0x34bc('0x22')](handleEntityNotFound(_0x13007f,null))[_0x34bc('0x22')](respondWithResult(_0x13007f,null))[_0x34bc('0x52')](handleError(_0x13007f,null));};exports[_0x34bc('0x8e')]=function(_0x94aaf3,_0x38baff,_0xead352){return _0x94aaf3[_0x34bc('0x67')][_0x34bc('0x7a')]({'where':{'type':_0x34bc('0x8f'),'dialActive':!![],'dialMethod':_0x34bc('0x7b')},'attributes':['id'],'raw':!![]})['then'](function(_0x5d9b43){if(_0x5d9b43&&_0x5d9b43[_0x34bc('0x46')]){return db[_0x34bc('0x27')][_0x34bc('0x1b')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x34bc('0x6a')](_0x34bc('0x6b'))},'VoiceQueueId':{'$in':_[_0x34bc('0x2c')](_0x5d9b43,'id')},'$or':[{'UserId':null},{'UserId':_0x94aaf3[_0x34bc('0x67')]['id']}]}});}return 0x0;})[_0x34bc('0x22')](function(_0x2a5455){if(!_[_0x34bc('0x72')](_0x2a5455)&&_['isNumber'](_0x2a5455)){return _0x38baff[_0x34bc('0x17')](0xc8)[_0x34bc('0x1e')]({'contacts':_0x2a5455});}else{logger[_0x34bc('0x90')](_0x34bc('0x91'),_0x34bc('0x8e'),0x194,_0x34bc('0x92'));_0x38baff[_0x34bc('0x23')](0x194);}})[_0x34bc('0x52')](handleError(_0x38baff,null));}; \ No newline at end of file +var _0x9957=['rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','$and','$lt','$lte','$eq','$between','$notBetween','$in','$notLike','$like','$overlap','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','CmHopper','includeAll','include','rows','catch','params','rawAttributes','length','options','find','create','body','update','describe','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','user','UserId','format','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','end','CmContact','getVoiceQueues','outbound','preview','transaction','direction','isEmpty','hopperIds','priority','ASC','DESC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getOpenContacts','isNumber','entity\x20not\x20found','eml-format'];(function(_0x300e8,_0x528266){var _0x346471=function(_0x3c8224){while(--_0x3c8224){_0x300e8['push'](_0x300e8['shift']());}};_0x346471(++_0x528266);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['CmHopper']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x456a28[_0x7995('0x32')]=_['concat'](_0x456a28[_0x7995('0x32')],[_0x7995('0x35'),'$or','$gt','$gte',_0x7995('0x36'),_0x7995('0x37'),'$ne',_0x7995('0x38'),'$not',_0x7995('0x39'),_0x7995('0x3a'),_0x7995('0x3b'),'$notIn','$like',_0x7995('0x3c'),'$iLike','$notILike',_0x7995('0x3d'),_0x7995('0x3e'),'$contains',_0x7995('0x3f'),_0x7995('0x40')]);_0x514445[_0x7995('0x41')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],qs['fields'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x42')]));_0x514445[_0x7995('0x41')]=_0x514445[_0x7995('0x41')]['length']?_0x514445[_0x7995('0x41')]:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99[_0x7995('0x34')][_0x7995('0x43')](_0x7995('0x44'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x21')]);_0x514445[_0x7995('0x20')]=qs[_0x7995('0x20')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445[_0x7995('0x45')]=qs[_0x7995('0x46')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x46')]);_0x514445[_0x7995('0x47')]=qs[_0x7995('0x32')](_[_0x7995('0x48')](_0x4b6f99['query'],_0x456a28['filters']),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x49')]){_0x514445['where']=_['merge'](_0x514445[_0x7995('0x47')],{'$or':_['map'](_0x4253e5,function(_0x504a33){if(_0x504a33[_0x7995('0x2d')]!==_0x7995('0x4a')){var _0x35c8ff={};_0x35c8ff[_0x504a33['name']]={'$like':'%'+_0x4b6f99[_0x7995('0x34')]['filter']+'%'};return _0x35c8ff;}})});}_0x514445=_[_0x7995('0x4b')]({},_0x514445,_0x4b6f99['options']);var _0x493066={'where':_0x514445[_0x7995('0x47')]};return db[_0x7995('0x4c')][_0x7995('0x1f')](_0x493066)[_0x7995('0x26')](function(_0x599ecb){_0x3250e0[_0x7995('0x1f')]=_0x599ecb;if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x4d')]){_0x514445[_0x7995('0x4e')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x514445);})[_0x7995('0x26')](function(_0x55791b){_0x3250e0[_0x7995('0x4f')]=_0x55791b;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))[_0x7995('0x50')](handleError(_0x9b2a15,null));};exports['show']=function(_0x1e795e,_0x1b0373){var _0x4d9245={'raw':!![],'where':{'id':_0x1e795e[_0x7995('0x51')]['id']}},_0x3e9e62={};_0x3e9e62[_0x7995('0x2f')]=_[_0x7995('0x31')](db['CmHopper'][_0x7995('0x52')]);_0x3e9e62[_0x7995('0x34')]=_[_0x7995('0x31')](_0x1e795e['query']);_0x3e9e62[_0x7995('0x32')]=_[_0x7995('0x33')](_0x3e9e62[_0x7995('0x2f')],_0x3e9e62[_0x7995('0x34')]);_0x4d9245[_0x7995('0x41')]=_['intersection'](_0x3e9e62[_0x7995('0x2f')],qs[_0x7995('0x42')](_0x1e795e['query'][_0x7995('0x42')]));_0x4d9245['attributes']=_0x4d9245[_0x7995('0x41')][_0x7995('0x53')]?_0x4d9245[_0x7995('0x41')]:_0x3e9e62[_0x7995('0x2f')];if(_0x1e795e[_0x7995('0x34')][_0x7995('0x4d')]){_0x4d9245[_0x7995('0x4e')]=[{'all':!![]}];}_0x4d9245=_['merge']({},_0x4d9245,_0x1e795e[_0x7995('0x54')]);return db[_0x7995('0x4c')][_0x7995('0x55')](_0x4d9245)['then'](handleEntityNotFound(_0x1b0373,null))[_0x7995('0x26')](respondWithResult(_0x1b0373,null))[_0x7995('0x50')](handleError(_0x1b0373,null));};exports[_0x7995('0x56')]=function(_0x47d1d8,_0x4ec548){return db['CmHopper'][_0x7995('0x56')](_0x47d1d8[_0x7995('0x57')],{})['then'](respondWithResult(_0x4ec548,0xc9))[_0x7995('0x50')](handleError(_0x4ec548,null));};exports[_0x7995('0x58')]=function(_0x31f27c,_0x1a9bd7){if(_0x31f27c[_0x7995('0x57')]['id']){delete _0x31f27c['body']['id'];}return db[_0x7995('0x4c')]['find']({'where':{'id':_0x31f27c[_0x7995('0x51')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x1a9bd7,null))[_0x7995('0x26')](saveUpdates(_0x31f27c['body'],null))['then'](respondWithResult(_0x1a9bd7,null))['catch'](handleError(_0x1a9bd7,null));};exports['describe']=function(_0x2e13b0,_0x3709de){return db[_0x7995('0x4c')][_0x7995('0x59')]()[_0x7995('0x26')](respondWithResult(_0x3709de,null))[_0x7995('0x50')](handleError(_0x3709de,null));};exports[_0x7995('0x27')]=function(_0xda6ce8,_0x328671){var _0x17ecd3;var _0xa7af8c=_0xda6ce8[_0x7995('0x51')]['id'];return db[_0x7995('0x4c')][_0x7995('0x55')]({'where':{'id':_0xda6ce8[_0x7995('0x51')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x328671,null))[_0x7995('0x26')](function(_0x223e08){if(_0x223e08){return _0x223e08[_0x7995('0x27')]()['then'](function(_0x56a374){return _0x56a374;});}})[_0x7995('0x26')](function(_0x3b8a54){_0x17ecd3=_0x3b8a54;if(_0x3b8a54){if(_0x3b8a54[_0x7995('0x5a')]||_0x3b8a54['CampaignId']){return db[_0x3b8a54['VoiceQueueId']?_0x7995('0x5b'):_0x7995('0x5c')][_0x7995('0x55')]({'where':{'id':_0x3b8a54[_0x7995('0x5a')]?_0x3b8a54['VoiceQueueId']:_0x3b8a54[_0x7995('0x5d')]},'attributes':['id',_0x7995('0x29')],'raw':!![]});}}})[_0x7995('0x26')](function(_0x33c49c){var _0x502d43={};if(_0x33c49c){_['merge'](_0x502d43,_[_0x7995('0x5e')](_0x17ecd3[_0x7995('0x5f')],[_0x7995('0x60'),_0x7995('0x61'),'id']));_0x502d43[_0x7995('0x62')]=0x15;_0x502d43[_0x7995('0x63')]=_0x7995('0x64');_0x502d43[_0x7995('0x65')]=_0x33c49c[_0x7995('0x29')];_0x502d43['membername']=_0xda6ce8[_0x7995('0x66')][_0x7995('0x29')];_0x502d43[_0x7995('0x67')]=_0xda6ce8[_0x7995('0x66')]['id'];_0x502d43['deleted']=!![];_0x502d43['deletedat']=moment()[_0x7995('0x68')](_0x7995('0x69'));_0x502d43['calleridnum']=_0x17ecd3[_0x7995('0x6a')];_0x502d43[_0x7995('0x6b')]=_0x17ecd3[_0x7995('0x5a')]?_0x7995('0x6c'):_0x7995('0x6d');return db['CmContact'][_0x7995('0x55')]({'where':{'id':_0x502d43['ContactId']},'attributes':[_0x7995('0x6e'),_0x7995('0x6f')]})[_0x7995('0x26')](function(_0x25b534){if(!_[_0x7995('0x70')](_0x328671)&&!_[_0x7995('0x70')](_0x25b534[_0x7995('0x6e')])){_0x502d43[_0x7995('0x71')]=_0x25b534[_0x7995('0x6e')];if(!_[_0x7995('0x70')](_0x25b534[_0x7995('0x6f')])){_0x502d43[_0x7995('0x71')]+='\x20'+_0x25b534['lastName'];}}})[_0x7995('0x72')](function(){return db[_0x7995('0x73')][_0x7995('0x56')](_0x502d43);});}})[_0x7995('0x26')](function(_0x2c6548){return db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':_0xa7af8c}});})[_0x7995('0x26')](function(){return _0x328671[_0x7995('0x1c')](0xcc)[_0x7995('0x74')]();})[_0x7995('0x50')](handleError(_0x328671,null));};exports['getPreview']=function(_0x22d317,_0x50a12e,_0x5df621){var _0xca8238=[];return db[_0x7995('0x75')][_0x7995('0x59')]()[_0x7995('0x26')](function(_0x290eae){_0xca8238=_[_0x7995('0x31')](_0x290eae);return _0x22d317[_0x7995('0x66')][_0x7995('0x76')]({'where':{'type':_0x7995('0x77'),'dialActive':!![],'dialMethod':_0x7995('0x78')},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x7995('0x26')](function(_0x8908cd){if(_0x8908cd&&_0x8908cd[_0x7995('0x53')]){return db['sequelize'][_0x7995('0x79')](function(_0x1d2f9d){var _0x705f0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7995('0x68')](_0x7995('0x69'))},'VoiceQueueId':{'$in':_[_0x7995('0x30')](_0x8908cd,'id')},'$or':[{'UserId':null},{'UserId':_0x22d317[_0x7995('0x66')]['id']}]};var _0x3adfd2=[];if(_0x22d317[_0x7995('0x57')][_0x7995('0x7a')]&&_0x22d317[_0x7995('0x57')]['direction']==='prev'){if(!_[_0x7995('0x7b')](_0x22d317[_0x7995('0x57')][_0x7995('0x7c')])){_0x705f0['id']={'$in':_0x22d317[_0x7995('0x57')]['hopperIds']};}_0x3adfd2=[[_0x7995('0x7d'),_0x7995('0x7e')],['scheduledAt',_0x8908cd[0x0]['dialOrderByScheduledAt']===_0x7995('0x7e')?_0x7995('0x7f'):'ASC'],db[_0x7995('0x80')]['literal'](_0x7995('0x81')),['id',_0x7995('0x7f')]];}else{if(!_['isEmpty'](_0x22d317['body'][_0x7995('0x7c')])){_0x705f0['id']={'$notIn':_0x22d317['body'][_0x7995('0x7c')]};}_0x3adfd2=[[_0x7995('0x7d'),_0x7995('0x7f')],[_0x7995('0x82'),_0x8908cd[0x0][_0x7995('0x83')]],db[_0x7995('0x80')][_0x7995('0x84')](_0x7995('0x85')),['id',_0x7995('0x7e')]];}return db[_0x7995('0x4c')][_0x7995('0x86')]({'attributes':['id',_0x7995('0x87'),_0x7995('0x6a')],'where':_0x705f0,'order':_0x3adfd2,'transaction':_0x1d2f9d,'lock':_0x1d2f9d[_0x7995('0x88')][_0x7995('0x89')],'include':[{'model':db[_0x7995('0x75')],'as':_0x7995('0x8a'),'attributes':_0xca8238,'include':[{'model':db[_0x7995('0x8b')],'as':_0x7995('0x8c'),'attributes':['id',_0x7995('0x29')]}]},{'model':db[_0x7995('0x8d')],'as':_0x7995('0x8e'),'attributes':['id',_0x7995('0x29')]},{'model':db[_0x7995('0x5b')],'as':_0x7995('0x8f'),'attributes':['id',_0x7995('0x29'),_0x7995('0x90')]}]})[_0x7995('0x26')](function(_0x59efff){if(_0x59efff){return _0x59efff[_0x7995('0x58')]({'UserId':_0x22d317[_0x7995('0x66')]['id']},{'transaction':_0x1d2f9d});}});});}})['then'](handleEntityNotFound(_0x50a12e,null))['then'](respondWithResult(_0x50a12e,null))[_0x7995('0x50')](handleError(_0x50a12e,null));};exports[_0x7995('0x91')]=function(_0x2d45d5,_0x38acda,_0xe1ce4){return _0x2d45d5[_0x7995('0x66')]['getVoiceQueues']({'where':{'type':_0x7995('0x77'),'dialActive':!![],'dialMethod':_0x7995('0x78')},'attributes':['id'],'raw':!![]})[_0x7995('0x26')](function(_0x77b03f){if(_0x77b03f&&_0x77b03f[_0x7995('0x53')]){return db[_0x7995('0x4c')][_0x7995('0x1f')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7995('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x7995('0x30')](_0x77b03f,'id')},'$or':[{'UserId':null},{'UserId':_0x2d45d5[_0x7995('0x66')]['id']}]}});}return 0x0;})['then'](function(_0x479271){if(!_[_0x7995('0x70')](_0x479271)&&_[_0x7995('0x92')](_0x479271)){return _0x38acda[_0x7995('0x1c')](0xc8)[_0x7995('0x1d')]({'contacts':_0x479271});}else{logger[_0x7995('0x28')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x7995('0x91'),0x194,_0x7995('0x93'));_0x38acda['sendStatus'](0x194);}})[_0x7995('0x50')](handleError(_0x38acda,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index fa75fcf..eeda535 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 _0x4975=['exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes'];(function(_0x39dc14,_0x175dae){var _0x4d7da1=function(_0x8b48fa){while(--_0x8b48fa){_0x39dc14['push'](_0x39dc14['shift']());}};_0x4d7da1(++_0x175dae);}(_0x4975,0x86));var _0x5497=function(_0x501a1f,_0x27aff4){_0x501a1f=_0x501a1f-0x0;var _0x1bd156=_0x4975[_0x501a1f];return _0x1bd156;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['scheduledat']},{'name':_0x5497('0xe'),'fields':['phone']},{'name':_0x5497('0xf'),'fields':[_0x5497('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe3da=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','priority','lodash','util','../../config/logger'];(function(_0x345cb2,_0x5a17bd){var _0x517828=function(_0x37042a){while(--_0x37042a){_0x345cb2['push'](_0x345cb2['shift']());}};_0x517828(++_0x5a17bd);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));module[_0xae3d('0xb')]=function(_0xa9a1a,_0xa54808){return _0xa9a1a[_0xae3d('0xc')](_0xae3d('0xd'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xae3d('0xe'),'fields':[_0xae3d('0xe')]},{'name':'phone','fields':['phone']},{'name':_0xae3d('0xf'),'fields':[_0xae3d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index a856cdf..d43a562 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 _0xcbcf=['voicePause','length','UserId','push','update','includes','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','contactsRescheduled','LOCK','UPDATE','all','GetContactRecallMe','GetCmHopperPreview','describe','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','request','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CmHopper','options','raw','where','limit','include','map','model','attributes','GetCmHopper','ShowCmHopper','find','then','CreateCmHopper','create','body','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','transaction','findAll','order','Contact','User','Agent','name'];(function(_0x660a1d,_0x3d6c7a){var _0x65dd03=function(_0x1e0175){while(--_0x1e0175){_0x660a1d['push'](_0x660a1d['shift']());}};_0x65dd03(++_0x3d6c7a);}(_0xcbcf,0x1b4));var _0xfcbc=function(_0x5b7f0f,_0x34bb79){_0x5b7f0f=_0x5b7f0f-0x0;var _0x5bfb58=_0xcbcf[_0x5b7f0f];return _0x5bfb58;};'use strict';var _=require(_0xfcbc('0x0'));var util=require('util');var moment=require(_0xfcbc('0x1'));var BPromise=require(_0xfcbc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfcbc('0x3'));var db=require(_0xfcbc('0x4'))['db'];var utils=require(_0xfcbc('0x5'));var logger=require(_0xfcbc('0x6'))('rpc');var config=require(_0xfcbc('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46e540,_0x51da41,_0xa58197){return new BPromise(function(_0x31f0bc,_0x24cb43){return client[_0xfcbc('0x8')](_0x46e540,_0xa58197)['then'](function(_0x44d34c){logger[_0xfcbc('0x9')](_0xfcbc('0xa'),_0x51da41,_0xfcbc('0xb'));logger[_0xfcbc('0xc')](_0xfcbc('0xd'),_0x51da41,_0xfcbc('0xb'),JSON[_0xfcbc('0xe')](_0x44d34c));if(_0x44d34c[_0xfcbc('0xf')]){if(_0x44d34c[_0xfcbc('0xf')][_0xfcbc('0x10')]===0x1f4){logger[_0xfcbc('0xf')](_0xfcbc('0xa'),_0x51da41,_0x44d34c[_0xfcbc('0xf')][_0xfcbc('0x11')]);return _0x24cb43(_0x44d34c[_0xfcbc('0xf')][_0xfcbc('0x11')]);}logger[_0xfcbc('0xf')](_0xfcbc('0xa'),_0x51da41,_0x44d34c['error'][_0xfcbc('0x11')]);return _0x31f0bc(_0x44d34c[_0xfcbc('0xf')][_0xfcbc('0x11')]);}else{logger[_0xfcbc('0x9')](_0xfcbc('0xa'),_0x51da41,'request\x20sent');_0x31f0bc(_0x44d34c['result']['message']);}})[_0xfcbc('0x12')](function(_0x365d8b){logger[_0xfcbc('0xf')](_0xfcbc('0xa'),_0x51da41,_0x365d8b);_0x24cb43(_0x365d8b);});});}exports['GetCmHopper']=function(_0x6c40f1){var _0x5dceca=this;return new Promise(function(_0x4e2e8d,_0x16e78f){return db[_0xfcbc('0x13')]['findAll']({'raw':_0x6c40f1['options']?_0x6c40f1[_0xfcbc('0x14')][_0xfcbc('0x15')]===undefined?!![]:![]:!![],'where':_0x6c40f1[_0xfcbc('0x14')]?_0x6c40f1[_0xfcbc('0x14')][_0xfcbc('0x16')]||null:null,'attributes':_0x6c40f1['options']?_0x6c40f1[_0xfcbc('0x14')]['attributes']||null:null,'limit':_0x6c40f1[_0xfcbc('0x14')]?_0x6c40f1['options'][_0xfcbc('0x17')]||null:null,'include':_0x6c40f1[_0xfcbc('0x14')]?_0x6c40f1[_0xfcbc('0x14')][_0xfcbc('0x18')]?_[_0xfcbc('0x19')](_0x6c40f1[_0xfcbc('0x14')][_0xfcbc('0x18')],function(_0x26df8c){return{'model':db[_0x26df8c[_0xfcbc('0x1a')]],'as':_0x26df8c['as'],'attributes':_0x26df8c[_0xfcbc('0x1b')],'include':_0x26df8c[_0xfcbc('0x18')]?_['map'](_0x26df8c[_0xfcbc('0x18')],function(_0x2a11da){return{'model':db[_0x2a11da[_0xfcbc('0x1a')]],'as':_0x2a11da['as'],'attributes':_0x2a11da[_0xfcbc('0x1b')],'include':_0x2a11da[_0xfcbc('0x18')]?_[_0xfcbc('0x19')](_0x2a11da[_0xfcbc('0x18')],function(_0x2d35b4){return{'model':db[_0x2d35b4[_0xfcbc('0x1a')]],'as':_0x2d35b4['as'],'attributes':_0x2d35b4[_0xfcbc('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b5e2a){logger[_0xfcbc('0x9')](_0xfcbc('0x1c'),_0x6c40f1);logger[_0xfcbc('0xc')]('GetCmHopper',_0x6c40f1,JSON[_0xfcbc('0xe')](_0x5b5e2a));_0x4e2e8d(_0x5b5e2a);})[_0xfcbc('0x12')](function(_0x74c677){logger[_0xfcbc('0xf')]('GetCmHopper',_0x74c677[_0xfcbc('0x11')],_0x6c40f1);_0x16e78f(_0x5dceca[_0xfcbc('0xf')](0x1f4,_0x74c677['message']));});});};exports[_0xfcbc('0x1d')]=function(_0x1fb52d){var _0x2c203a=this;return new Promise(function(_0x401eff,_0x3edf39){return db['CmHopper'][_0xfcbc('0x1e')]({'raw':_0x1fb52d[_0xfcbc('0x14')]?_0x1fb52d[_0xfcbc('0x14')][_0xfcbc('0x15')]===undefined?!![]:![]:!![],'where':_0x1fb52d[_0xfcbc('0x14')]?_0x1fb52d['options'][_0xfcbc('0x16')]||null:null,'attributes':_0x1fb52d[_0xfcbc('0x14')]?_0x1fb52d[_0xfcbc('0x14')][_0xfcbc('0x1b')]||null:null,'include':_0x1fb52d[_0xfcbc('0x14')]?_0x1fb52d[_0xfcbc('0x14')]['include']?_[_0xfcbc('0x19')](_0x1fb52d[_0xfcbc('0x14')][_0xfcbc('0x18')],function(_0x9559e5){return{'model':db[_0x9559e5[_0xfcbc('0x1a')]],'as':_0x9559e5['as'],'attributes':_0x9559e5[_0xfcbc('0x1b')],'include':_0x9559e5[_0xfcbc('0x18')]?_[_0xfcbc('0x19')](_0x9559e5[_0xfcbc('0x18')],function(_0xa4af45){return{'model':db[_0xa4af45[_0xfcbc('0x1a')]],'as':_0xa4af45['as'],'attributes':_0xa4af45['attributes'],'include':_0xa4af45['include']?_[_0xfcbc('0x19')](_0xa4af45[_0xfcbc('0x18')],function(_0x9acbbb){return{'model':db[_0x9acbbb[_0xfcbc('0x1a')]],'as':_0x9acbbb['as'],'attributes':_0x9acbbb['attributes']};}):[]};}):[]};}):[]:[]})[_0xfcbc('0x1f')](function(_0x5bbc44){logger[_0xfcbc('0x9')]('ShowCmHopper',_0x1fb52d);logger[_0xfcbc('0xc')](_0xfcbc('0x1d'),_0x1fb52d,JSON[_0xfcbc('0xe')](_0x5bbc44));_0x401eff(_0x5bbc44);})[_0xfcbc('0x12')](function(_0xbbc94){logger[_0xfcbc('0xf')]('ShowCmHopper',_0xbbc94[_0xfcbc('0x11')],_0x1fb52d);_0x3edf39(_0x2c203a[_0xfcbc('0xf')](0x1f4,_0xbbc94['message']));});});};exports[_0xfcbc('0x20')]=function(_0x199161){var _0x36bf39=this;return new Promise(function(_0x4683ff,_0x465831){return db[_0xfcbc('0x13')][_0xfcbc('0x21')](_0x199161[_0xfcbc('0x22')],{'raw':_0x199161[_0xfcbc('0x14')]?_0x199161[_0xfcbc('0x14')][_0xfcbc('0x15')]===undefined?!![]:![]:!![]})[_0xfcbc('0x1f')](function(_0x415ad9){logger['info'](_0xfcbc('0x20'),_0x199161);logger[_0xfcbc('0xc')]('CreateCmHopper',_0x199161,JSON[_0xfcbc('0xe')](_0x415ad9));_0x4683ff(_0x415ad9);})['catch'](function(_0x42c753){logger['error'](_0xfcbc('0x20'),_0x42c753[_0xfcbc('0x11')],_0x199161);_0x465831(_0x36bf39[_0xfcbc('0xf')](0x1f4,_0x42c753[_0xfcbc('0x11')]));});});};exports[_0xfcbc('0x23')]=function(_0x26a3b8){var _0x422c3d=this;return new Promise(function(_0x52867e,_0x46f588){return db[_0xfcbc('0x13')]['update'](_0x26a3b8[_0xfcbc('0x22')],{'raw':_0x26a3b8[_0xfcbc('0x14')]?_0x26a3b8[_0xfcbc('0x14')][_0xfcbc('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26a3b8[_0xfcbc('0x14')]?_0x26a3b8[_0xfcbc('0x14')]['where']||null:null,'attributes':_0x26a3b8[_0xfcbc('0x14')]?_0x26a3b8[_0xfcbc('0x14')][_0xfcbc('0x1b')]||null:null,'limit':_0x26a3b8['options']?_0x26a3b8[_0xfcbc('0x14')]['limit']||null:null})['then'](function(_0x31aa35){logger[_0xfcbc('0x9')](_0xfcbc('0x23'),_0x26a3b8);logger[_0xfcbc('0xc')]('UpdateCmHopper',_0x26a3b8,JSON['stringify'](_0x31aa35));_0x52867e(_0x31aa35);})[_0xfcbc('0x12')](function(_0x4fa8c3){logger['error']('UpdateCmHopper',_0x4fa8c3['message'],_0x26a3b8);_0x46f588(_0x422c3d[_0xfcbc('0xf')](0x1f4,_0x4fa8c3['message']));});});};exports[_0xfcbc('0x24')]=function(_0x1eb090){var _0x4c80a5=this;return new Promise(function(_0x142d6b,_0x118acd){return db[_0xfcbc('0x13')][_0xfcbc('0x25')]({'where':_0x1eb090[_0xfcbc('0x14')]?_0x1eb090[_0xfcbc('0x14')][_0xfcbc('0x16')]||null:null})[_0xfcbc('0x1f')](function(_0x134b17){logger[_0xfcbc('0x9')](_0xfcbc('0x24'),_0x1eb090);logger['debug'](_0xfcbc('0x24'),_0x1eb090,JSON[_0xfcbc('0xe')](_0x134b17));_0x142d6b(_0x134b17);})['catch'](function(_0x2b03f4){logger['error'](_0xfcbc('0x24'),_0x2b03f4['message'],_0x1eb090);_0x118acd(_0x4c80a5[_0xfcbc('0xf')](0x1f4,_0x2b03f4['message']));});});};exports[_0xfcbc('0x26')]=function(_0xf2c90){var _0x5bb2a5=this;return new Promise(function(_0x63e313,_0x1d7458){return db[_0xfcbc('0x27')]['describe']()['then'](function(_0x10d44e){return db['sequelize'][_0xfcbc('0x28')](function(_0x41b005){return db[_0xfcbc('0x13')][_0xfcbc('0x29')]({'where':_0xf2c90[_0xfcbc('0x14')]?_0xf2c90[_0xfcbc('0x14')][_0xfcbc('0x16')]||null:null,'attributes':_0xf2c90[_0xfcbc('0x14')]?_0xf2c90[_0xfcbc('0x14')][_0xfcbc('0x1b')]||null:null,'limit':_0xf2c90[_0xfcbc('0x14')]?_0xf2c90[_0xfcbc('0x14')]['limit']||null:null,'order':_0xf2c90[_0xfcbc('0x14')]?_0xf2c90['options'][_0xfcbc('0x2a')]||null:null,'transaction':_0x41b005,'lock':_0x41b005['LOCK']['UPDATE'],'include':[{'model':db[_0xfcbc('0x27')],'as':_0xfcbc('0x2b'),'attributes':_['keys'](_0x10d44e)},{'model':db[_0xfcbc('0x2c')],'as':_0xfcbc('0x2d'),'attributes':['id',_0xfcbc('0x2e'),_0xfcbc('0x2f')]}]})[_0xfcbc('0x1f')](function(_0x4b0b3e){var _0x2442bc=[];var _0x155bef=[];for(var _0x54224b=0x0;_0x54224b<_0x4b0b3e[_0xfcbc('0x30')];_0x54224b+=0x1){var _0x1c18fe=_0x4b0b3e[_0x54224b][_0xfcbc('0x31')];if(_0x1c18fe===null){_0x2442bc[_0xfcbc('0x32')](_0x4b0b3e[_0x54224b][_0xfcbc('0x33')](_0xf2c90[_0xfcbc('0x22')],{'transaction':_0x41b005}));}else if(!_0x155bef[_0xfcbc('0x34')](_0x1c18fe)){_0x155bef['push'](_0x1c18fe);_0x2442bc[_0xfcbc('0x32')](_0x4b0b3e[_0x54224b][_0xfcbc('0x33')](_0xf2c90['body'],{'transaction':_0x41b005}));}}return BPromise['all'](_0x2442bc);});})['then'](function(_0x5f1fe9){logger[_0xfcbc('0x9')](_0xfcbc('0x26'),_0xf2c90);logger[_0xfcbc('0xc')](_0xfcbc('0x26'),_0xf2c90,JSON[_0xfcbc('0xe')](_0x5f1fe9));_0x63e313(_0x5f1fe9);})[_0xfcbc('0x12')](function(_0x4610e0){logger['error'](_0xfcbc('0x26'),_0x4610e0[_0xfcbc('0x11')],_0xf2c90);_0x1d7458(_0x5bb2a5[_0xfcbc('0xf')](0x1f4,_0x4610e0['message']));});});});};exports[_0xfcbc('0x35')]=function(_0xd14727){var _0x73f9b8=this;return new Promise(function(_0x397ed2,_0x191fac){return db[_0xfcbc('0x36')]['transaction'](function(_0x3d5c39){return db[_0xfcbc('0x37')][_0xfcbc('0x21')](_0xd14727['body'],{'raw':_0xd14727[_0xfcbc('0x14')]?_0xd14727[_0xfcbc('0x14')][_0xfcbc('0x15')]===undefined?!![]:![]:!![],'transaction':_0x3d5c39})['then'](function(){return db['CmHopper'][_0xfcbc('0x25')]({'where':_0xd14727[_0xfcbc('0x14')]?_0xd14727['options'][_0xfcbc('0x16')]||null:null,'transaction':_0x3d5c39});});})['then'](function(_0x156321){logger[_0xfcbc('0x9')]('MoveContactManagedDialer',_0xd14727);logger[_0xfcbc('0xc')]('MoveContactManagedDialer',_0xd14727,JSON[_0xfcbc('0xe')](_0x156321));_0x397ed2(_0x156321);})['catch'](function(_0x330eec){logger['error']('MoveContactManagedDialer',_0x330eec[_0xfcbc('0x11')],_0xd14727);_0x191fac(_0x73f9b8[_0xfcbc('0xf')](0x1f4,_0x330eec[_0xfcbc('0x11')]));});});};exports[_0xfcbc('0x38')]=function(_0x371de9){var _0x25834f=this;return new Promise(function(_0x136227,_0x4e3426){return db[_0xfcbc('0x13')][_0xfcbc('0x29')]({'raw':_0x371de9[_0xfcbc('0x14')]?_0x371de9[_0xfcbc('0x14')][_0xfcbc('0x15')]===undefined?!![]:![]:!![],'where':_0x371de9[_0xfcbc('0x14')]?_0x371de9['options'][_0xfcbc('0x16')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0xfcbc('0x36')]['fn']('IF',db[_0xfcbc('0x36')][_0xfcbc('0x39')](_0xfcbc('0x3a')+util['format'](_0xfcbc('0x3b'),moment()[_0xfcbc('0x3c')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xfcbc('0x3d')))),_0xfcbc('0x3e')]]})[_0xfcbc('0x1f')](function(_0x3fc025){logger[_0xfcbc('0x9')](_0xfcbc('0x38'),_0x371de9);logger['debug'](_0xfcbc('0x38'),_0x371de9,JSON[_0xfcbc('0xe')](_0x3fc025));_0x136227(_0x3fc025);})[_0xfcbc('0x12')](function(_0x2e5ccc){logger['error'](_0xfcbc('0x38'),_0x2e5ccc[_0xfcbc('0x11')],_0x371de9);_0x4e3426(_0x25834f[_0xfcbc('0xf')](0x1f4,_0x2e5ccc[_0xfcbc('0x11')]));});});};exports['GetContactRecallMe']=function(_0x150423){var _0x42bca3=this;return new Promise(function(_0x4e1cbd,_0x411072){return db['CmContact']['describe']()[_0xfcbc('0x1f')](function(_0x40d216){return db[_0xfcbc('0x36')][_0xfcbc('0x28')](function(_0x5eddc9){return db[_0xfcbc('0x13')][_0xfcbc('0x29')]({'where':_0x150423[_0xfcbc('0x14')]?_0x150423[_0xfcbc('0x14')][_0xfcbc('0x16')]||null:null,'attributes':_0x150423[_0xfcbc('0x14')]?_0x150423['options']['attributes']||null:null,'limit':0x1,'order':_0x150423[_0xfcbc('0x14')]?_0x150423[_0xfcbc('0x14')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x5eddc9,'lock':_0x5eddc9[_0xfcbc('0x3f')][_0xfcbc('0x40')],'include':_0x150423['options']?_0x150423['options'][_0xfcbc('0x18')]?_[_0xfcbc('0x19')](_0x150423[_0xfcbc('0x14')]['include'],function(_0x479d33){return{'model':db[_0x479d33['model']],'as':_0x479d33['as'],'attributes':_0x479d33[_0xfcbc('0x1b')],'include':_0x479d33[_0xfcbc('0x18')]?_[_0xfcbc('0x19')](_0x479d33['include'],function(_0x81a0d){return{'model':db[_0x81a0d[_0xfcbc('0x1a')]],'as':_0x81a0d['as'],'attributes':_0x81a0d[_0xfcbc('0x1b')],'include':_0x81a0d['include']?_[_0xfcbc('0x19')](_0x81a0d['include'],function(_0x342f55){return{'model':db[_0x342f55['model']],'as':_0x342f55['as'],'attributes':_0x342f55[_0xfcbc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfcbc('0x1f')](function(_0x42b535){var _0x5c1fa8=[];for(var _0x2b6abb=0x0;_0x2b6abb<_0x42b535[_0xfcbc('0x30')];_0x2b6abb+=0x1){_0x5c1fa8[_0xfcbc('0x32')](_0x42b535[_0x2b6abb][_0xfcbc('0x33')](_0x150423[_0xfcbc('0x22')],{'transaction':_0x5eddc9}));}return BPromise[_0xfcbc('0x41')](_0x5c1fa8);});})[_0xfcbc('0x1f')](function(_0x33beb7){logger[_0xfcbc('0x9')](_0xfcbc('0x42'),_0x150423);logger[_0xfcbc('0xc')]('GetContactRecallMe',_0x150423,JSON[_0xfcbc('0xe')](_0x33beb7));_0x4e1cbd(_0x33beb7);})['catch'](function(_0x4c752d){logger[_0xfcbc('0xf')](_0xfcbc('0x42'),_0x4c752d[_0xfcbc('0x11')],_0x150423);_0x411072(_0x42bca3[_0xfcbc('0xf')](0x1f4,_0x4c752d[_0xfcbc('0x11')]));});});});};exports[_0xfcbc('0x43')]=function(_0x4c00b0){var _0x4f2372=this;return new Promise(function(_0x58ae3f,_0x58646e){db[_0xfcbc('0x27')][_0xfcbc('0x44')]()[_0xfcbc('0x1f')](function(_0x2c8de6){return db[_0xfcbc('0x13')][_0xfcbc('0x29')]({'raw':_0x4c00b0[_0xfcbc('0x14')]?_0x4c00b0[_0xfcbc('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x4c00b0[_0xfcbc('0x14')]?_0x4c00b0[_0xfcbc('0x14')]['where']||null:null,'attributes':_0x4c00b0[_0xfcbc('0x14')]?_0x4c00b0[_0xfcbc('0x14')][_0xfcbc('0x1b')]||null:null,'limit':_0x4c00b0[_0xfcbc('0x14')]?_0x4c00b0['options']['limit']||null:null,'include':_0x4c00b0['options']?_0x4c00b0[_0xfcbc('0x14')][_0xfcbc('0x18')]?_[_0xfcbc('0x19')](_0x4c00b0[_0xfcbc('0x14')]['include'],function(_0x568442){return{'model':db[_0x568442[_0xfcbc('0x1a')]],'as':_0x568442['as'],'attributes':_0x568442['as']===_0xfcbc('0x2b')?_['keys'](_0x2c8de6):_0x568442[_0xfcbc('0x1b')],'include':_0x568442[_0xfcbc('0x18')]?_['map'](_0x568442[_0xfcbc('0x18')],function(_0x37afd7){return{'model':db[_0x37afd7[_0xfcbc('0x1a')]],'as':_0x37afd7['as'],'attributes':_0x37afd7[_0xfcbc('0x1b')],'include':_0x37afd7['include']?_[_0xfcbc('0x19')](_0x37afd7['include'],function(_0x478903){return{'model':db[_0x478903[_0xfcbc('0x1a')]],'as':_0x478903['as'],'attributes':_0x478903[_0xfcbc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xfcbc('0x1f')](function(_0xdeb73a){logger[_0xfcbc('0x9')](_0xfcbc('0x1c'),_0x4c00b0);logger['debug']('GetCmHopper',_0x4c00b0,JSON[_0xfcbc('0xe')](_0xdeb73a));_0x58ae3f(_0xdeb73a);})['catch'](function(_0x788420){logger['error'](_0xfcbc('0x1c'),_0x788420[_0xfcbc('0x11')],_0x4c00b0);_0x58646e(_0x4f2372[_0xfcbc('0xf')](0x1f4,_0x788420[_0xfcbc('0x11')]));});});});}; \ No newline at end of file +var _0x02f1=['message','result','catch','GetCmHopper','CmHopper','options','raw','where','attributes','limit','include','map','model','find','ShowCmHopper','body','CreateCmHopper','UpdateCmHopper','update','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','transaction','findAll','order','LOCK','Contact','keys','User','Agent','name','voicePause','length','UserId','push','includes','all','MoveContactManagedDialer','sequelize','create','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UPDATE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xb4454a,_0x537bb4){var _0x46a7d1=function(_0x39720f){while(--_0x39720f){_0xb4454a['push'](_0xb4454a['shift']());}};_0x46a7d1(++_0x537bb4);}(_0x02f1,0x1e5));var _0x102f=function(_0x1723dc,_0x3f45a8){_0x1723dc=_0x1723dc-0x0;var _0x1d24f8=_0x02f1[_0x1723dc];return _0x1d24f8;};'use strict';var _=require(_0x102f('0x0'));var util=require(_0x102f('0x1'));var moment=require(_0x102f('0x2'));var BPromise=require(_0x102f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x102f('0x4'));var db=require(_0x102f('0x5'))['db'];var utils=require(_0x102f('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x102f('0x7'));var client=jayson[_0x102f('0x8')][_0x102f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f2962,_0x4df4d6,_0x2ad06d){return new BPromise(function(_0x30cdc1,_0x5a59da){return client[_0x102f('0xa')](_0x5f2962,_0x2ad06d)[_0x102f('0xb')](function(_0x2f9d30){logger[_0x102f('0xc')](_0x102f('0xd'),_0x4df4d6,_0x102f('0xe'));logger[_0x102f('0xf')](_0x102f('0x10'),_0x4df4d6,_0x102f('0xe'),JSON[_0x102f('0x11')](_0x2f9d30));if(_0x2f9d30['error']){if(_0x2f9d30[_0x102f('0x12')]['code']===0x1f4){logger[_0x102f('0x12')](_0x102f('0xd'),_0x4df4d6,_0x2f9d30[_0x102f('0x12')][_0x102f('0x13')]);return _0x5a59da(_0x2f9d30[_0x102f('0x12')][_0x102f('0x13')]);}logger[_0x102f('0x12')](_0x102f('0xd'),_0x4df4d6,_0x2f9d30['error']['message']);return _0x30cdc1(_0x2f9d30['error'][_0x102f('0x13')]);}else{logger['info']('CmHopper,\x20%s,\x20%s',_0x4df4d6,_0x102f('0xe'));_0x30cdc1(_0x2f9d30[_0x102f('0x14')]['message']);}})[_0x102f('0x15')](function(_0x4ccfe1){logger[_0x102f('0x12')](_0x102f('0xd'),_0x4df4d6,_0x4ccfe1);_0x5a59da(_0x4ccfe1);});});}exports[_0x102f('0x16')]=function(_0x5990c0){var _0x1db728=this;return new Promise(function(_0x498f3f,_0xf7c908){return db[_0x102f('0x17')]['findAll']({'raw':_0x5990c0[_0x102f('0x18')]?_0x5990c0[_0x102f('0x18')][_0x102f('0x19')]===undefined?!![]:![]:!![],'where':_0x5990c0[_0x102f('0x18')]?_0x5990c0[_0x102f('0x18')][_0x102f('0x1a')]||null:null,'attributes':_0x5990c0['options']?_0x5990c0[_0x102f('0x18')][_0x102f('0x1b')]||null:null,'limit':_0x5990c0[_0x102f('0x18')]?_0x5990c0[_0x102f('0x18')][_0x102f('0x1c')]||null:null,'include':_0x5990c0[_0x102f('0x18')]?_0x5990c0['options'][_0x102f('0x1d')]?_[_0x102f('0x1e')](_0x5990c0['options'][_0x102f('0x1d')],function(_0x4c0c7e){return{'model':db[_0x4c0c7e['model']],'as':_0x4c0c7e['as'],'attributes':_0x4c0c7e['attributes'],'include':_0x4c0c7e[_0x102f('0x1d')]?_[_0x102f('0x1e')](_0x4c0c7e['include'],function(_0x1ed720){return{'model':db[_0x1ed720[_0x102f('0x1f')]],'as':_0x1ed720['as'],'attributes':_0x1ed720[_0x102f('0x1b')],'include':_0x1ed720[_0x102f('0x1d')]?_[_0x102f('0x1e')](_0x1ed720[_0x102f('0x1d')],function(_0x297cc0){return{'model':db[_0x297cc0[_0x102f('0x1f')]],'as':_0x297cc0['as'],'attributes':_0x297cc0['attributes']};}):[]};}):[]};}):[]:[]})[_0x102f('0xb')](function(_0x14f65b){logger[_0x102f('0xc')](_0x102f('0x16'),_0x5990c0);logger['debug'](_0x102f('0x16'),_0x5990c0,JSON[_0x102f('0x11')](_0x14f65b));_0x498f3f(_0x14f65b);})[_0x102f('0x15')](function(_0x392106){logger['error'](_0x102f('0x16'),_0x392106[_0x102f('0x13')],_0x5990c0);_0xf7c908(_0x1db728[_0x102f('0x12')](0x1f4,_0x392106[_0x102f('0x13')]));});});};exports['ShowCmHopper']=function(_0x5e621f){var _0xf00ad9=this;return new Promise(function(_0x2abe1f,_0x57e832){return db[_0x102f('0x17')][_0x102f('0x20')]({'raw':_0x5e621f['options']?_0x5e621f['options'][_0x102f('0x19')]===undefined?!![]:![]:!![],'where':_0x5e621f[_0x102f('0x18')]?_0x5e621f['options'][_0x102f('0x1a')]||null:null,'attributes':_0x5e621f[_0x102f('0x18')]?_0x5e621f['options'][_0x102f('0x1b')]||null:null,'include':_0x5e621f[_0x102f('0x18')]?_0x5e621f[_0x102f('0x18')][_0x102f('0x1d')]?_[_0x102f('0x1e')](_0x5e621f[_0x102f('0x18')][_0x102f('0x1d')],function(_0x24de28){return{'model':db[_0x24de28[_0x102f('0x1f')]],'as':_0x24de28['as'],'attributes':_0x24de28[_0x102f('0x1b')],'include':_0x24de28[_0x102f('0x1d')]?_[_0x102f('0x1e')](_0x24de28[_0x102f('0x1d')],function(_0x5114f5){return{'model':db[_0x5114f5['model']],'as':_0x5114f5['as'],'attributes':_0x5114f5[_0x102f('0x1b')],'include':_0x5114f5['include']?_[_0x102f('0x1e')](_0x5114f5[_0x102f('0x1d')],function(_0x4c570b){return{'model':db[_0x4c570b[_0x102f('0x1f')]],'as':_0x4c570b['as'],'attributes':_0x4c570b[_0x102f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x102f('0xb')](function(_0x7af7ed){logger[_0x102f('0xc')](_0x102f('0x21'),_0x5e621f);logger[_0x102f('0xf')]('ShowCmHopper',_0x5e621f,JSON[_0x102f('0x11')](_0x7af7ed));_0x2abe1f(_0x7af7ed);})[_0x102f('0x15')](function(_0x24c27c){logger['error'](_0x102f('0x21'),_0x24c27c[_0x102f('0x13')],_0x5e621f);_0x57e832(_0xf00ad9[_0x102f('0x12')](0x1f4,_0x24c27c[_0x102f('0x13')]));});});};exports['CreateCmHopper']=function(_0x296993){var _0x1184e6=this;return new Promise(function(_0x5b910f,_0x509720){return db[_0x102f('0x17')]['create'](_0x296993[_0x102f('0x22')],{'raw':_0x296993['options']?_0x296993[_0x102f('0x18')][_0x102f('0x19')]===undefined?!![]:![]:!![]})[_0x102f('0xb')](function(_0x3d38bd){logger[_0x102f('0xc')](_0x102f('0x23'),_0x296993);logger['debug'](_0x102f('0x23'),_0x296993,JSON[_0x102f('0x11')](_0x3d38bd));_0x5b910f(_0x3d38bd);})[_0x102f('0x15')](function(_0x42f401){logger[_0x102f('0x12')]('CreateCmHopper',_0x42f401[_0x102f('0x13')],_0x296993);_0x509720(_0x1184e6[_0x102f('0x12')](0x1f4,_0x42f401[_0x102f('0x13')]));});});};exports[_0x102f('0x24')]=function(_0x152072){var _0x578ce1=this;return new Promise(function(_0x3ef7c4,_0x262599){return db['CmHopper'][_0x102f('0x25')](_0x152072['body'],{'raw':_0x152072['options']?_0x152072['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x152072[_0x102f('0x18')]?_0x152072[_0x102f('0x18')][_0x102f('0x1a')]||null:null,'attributes':_0x152072[_0x102f('0x18')]?_0x152072[_0x102f('0x18')][_0x102f('0x1b')]||null:null,'limit':_0x152072[_0x102f('0x18')]?_0x152072[_0x102f('0x18')][_0x102f('0x1c')]||null:null})[_0x102f('0xb')](function(_0x531755){logger[_0x102f('0xc')]('UpdateCmHopper',_0x152072);logger[_0x102f('0xf')](_0x102f('0x24'),_0x152072,JSON[_0x102f('0x11')](_0x531755));_0x3ef7c4(_0x531755);})[_0x102f('0x15')](function(_0x128250){logger[_0x102f('0x12')](_0x102f('0x24'),_0x128250['message'],_0x152072);_0x262599(_0x578ce1[_0x102f('0x12')](0x1f4,_0x128250[_0x102f('0x13')]));});});};exports['DestroyCmHopper']=function(_0x1c0830){var _0x5b4fda=this;return new Promise(function(_0x5cb5c8,_0xec669){return db[_0x102f('0x17')][_0x102f('0x26')]({'where':_0x1c0830[_0x102f('0x18')]?_0x1c0830[_0x102f('0x18')][_0x102f('0x1a')]||null:null})[_0x102f('0xb')](function(_0x3fe09c){logger[_0x102f('0xc')]('DestroyCmHopper',_0x1c0830);logger['debug']('DestroyCmHopper',_0x1c0830,JSON[_0x102f('0x11')](_0x3fe09c));_0x5cb5c8(_0x3fe09c);})['catch'](function(_0x136b90){logger[_0x102f('0x12')](_0x102f('0x27'),_0x136b90[_0x102f('0x13')],_0x1c0830);_0xec669(_0x5b4fda[_0x102f('0x12')](0x1f4,_0x136b90[_0x102f('0x13')]));});});};exports[_0x102f('0x28')]=function(_0x48e7f2){var _0x541cdc=this;return new Promise(function(_0x589a60,_0x6fb58c){return db[_0x102f('0x29')][_0x102f('0x2a')]()[_0x102f('0xb')](function(_0xa41795){return db['sequelize'][_0x102f('0x2b')](function(_0x48c137){return db[_0x102f('0x17')][_0x102f('0x2c')]({'where':_0x48e7f2[_0x102f('0x18')]?_0x48e7f2['options'][_0x102f('0x1a')]||null:null,'attributes':_0x48e7f2[_0x102f('0x18')]?_0x48e7f2[_0x102f('0x18')][_0x102f('0x1b')]||null:null,'limit':_0x48e7f2['options']?_0x48e7f2[_0x102f('0x18')]['limit']||null:null,'order':_0x48e7f2[_0x102f('0x18')]?_0x48e7f2['options'][_0x102f('0x2d')]||null:null,'transaction':_0x48c137,'lock':_0x48c137[_0x102f('0x2e')]['UPDATE'],'include':[{'model':db[_0x102f('0x29')],'as':_0x102f('0x2f'),'attributes':_[_0x102f('0x30')](_0xa41795)},{'model':db[_0x102f('0x31')],'as':_0x102f('0x32'),'attributes':['id',_0x102f('0x33'),_0x102f('0x34')]}]})[_0x102f('0xb')](function(_0x3fb0a7){var _0x52972a=[];var _0x597a89=[];for(var _0x42b106=0x0;_0x42b106<_0x3fb0a7[_0x102f('0x35')];_0x42b106+=0x1){var _0x1c8fde=_0x3fb0a7[_0x42b106][_0x102f('0x36')];if(_0x1c8fde===null){_0x52972a[_0x102f('0x37')](_0x3fb0a7[_0x42b106][_0x102f('0x25')](_0x48e7f2[_0x102f('0x22')],{'transaction':_0x48c137}));}else if(!_0x597a89[_0x102f('0x38')](_0x1c8fde)){_0x597a89[_0x102f('0x37')](_0x1c8fde);_0x52972a[_0x102f('0x37')](_0x3fb0a7[_0x42b106][_0x102f('0x25')](_0x48e7f2[_0x102f('0x22')],{'transaction':_0x48c137}));}}return BPromise[_0x102f('0x39')](_0x52972a);});})[_0x102f('0xb')](function(_0x1627bd){logger[_0x102f('0xc')](_0x102f('0x28'),_0x48e7f2);logger[_0x102f('0xf')](_0x102f('0x28'),_0x48e7f2,JSON[_0x102f('0x11')](_0x1627bd));_0x589a60(_0x1627bd);})['catch'](function(_0x5ca4d6){logger[_0x102f('0x12')](_0x102f('0x28'),_0x5ca4d6[_0x102f('0x13')],_0x48e7f2);_0x6fb58c(_0x541cdc[_0x102f('0x12')](0x1f4,_0x5ca4d6['message']));});});});};exports[_0x102f('0x3a')]=function(_0x555e2b){var _0x3a85cc=this;return new Promise(function(_0x53686a,_0x498f40){return db[_0x102f('0x3b')][_0x102f('0x2b')](function(_0x1adf49){return db['CmHopperFinal'][_0x102f('0x3c')](_0x555e2b[_0x102f('0x22')],{'raw':_0x555e2b['options']?_0x555e2b[_0x102f('0x18')][_0x102f('0x19')]===undefined?!![]:![]:!![],'transaction':_0x1adf49})[_0x102f('0xb')](function(){return db[_0x102f('0x17')][_0x102f('0x26')]({'where':_0x555e2b[_0x102f('0x18')]?_0x555e2b[_0x102f('0x18')][_0x102f('0x1a')]||null:null,'transaction':_0x1adf49});});})['then'](function(_0x58bd73){logger[_0x102f('0xc')](_0x102f('0x3a'),_0x555e2b);logger[_0x102f('0xf')](_0x102f('0x3a'),_0x555e2b,JSON[_0x102f('0x11')](_0x58bd73));_0x53686a(_0x58bd73);})[_0x102f('0x15')](function(_0x30996b){logger[_0x102f('0x12')](_0x102f('0x3a'),_0x30996b[_0x102f('0x13')],_0x555e2b);_0x498f40(_0x3a85cc['error'](0x1f4,_0x30996b['message']));});});};exports[_0x102f('0x3d')]=function(_0x122d6f){var _0x3d10c2=this;return new Promise(function(_0x56bdb8,_0x32c2c4){return db[_0x102f('0x17')]['findAll']({'raw':_0x122d6f[_0x102f('0x18')]?_0x122d6f['options']['raw']===undefined?!![]:![]:!![],'where':_0x122d6f[_0x102f('0x18')]?_0x122d6f[_0x102f('0x18')][_0x102f('0x1a')]||null:null,'attributes':[[db[_0x102f('0x3b')]['fn'](_0x102f('0x3e'),db[_0x102f('0x3b')]['fn']('IF',db[_0x102f('0x3b')][_0x102f('0x3f')](_0x102f('0x40')+util['format'](_0x102f('0x41'),moment()[_0x102f('0x42')](_0x102f('0x43')))+_0x102f('0x44')))),_0x102f('0x45')]]})[_0x102f('0xb')](function(_0x3cec3f){logger[_0x102f('0xc')](_0x102f('0x3d'),_0x122d6f);logger[_0x102f('0xf')]('CountReScheduled',_0x122d6f,JSON[_0x102f('0x11')](_0x3cec3f));_0x56bdb8(_0x3cec3f);})[_0x102f('0x15')](function(_0x169f81){logger['error']('CountReScheduled',_0x169f81[_0x102f('0x13')],_0x122d6f);_0x32c2c4(_0x3d10c2['error'](0x1f4,_0x169f81[_0x102f('0x13')]));});});};exports[_0x102f('0x46')]=function(_0x41f6c5){var _0x50548a=this;return new Promise(function(_0x5d069b,_0x164fe2){return db[_0x102f('0x29')]['describe']()[_0x102f('0xb')](function(_0xdbf636){return db['sequelize'][_0x102f('0x2b')](function(_0x230d1c){return db[_0x102f('0x17')][_0x102f('0x2c')]({'where':_0x41f6c5[_0x102f('0x18')]?_0x41f6c5[_0x102f('0x18')][_0x102f('0x1a')]||null:null,'attributes':_0x41f6c5[_0x102f('0x18')]?_0x41f6c5[_0x102f('0x18')][_0x102f('0x1b')]||null:null,'limit':0x1,'order':_0x41f6c5[_0x102f('0x18')]?_0x41f6c5[_0x102f('0x18')]['order']||null:null,'group':db[_0x102f('0x17')][_0x102f('0x36')],'transaction':_0x230d1c,'lock':_0x230d1c[_0x102f('0x2e')][_0x102f('0x47')],'include':_0x41f6c5['options']?_0x41f6c5[_0x102f('0x18')]['include']?_['map'](_0x41f6c5[_0x102f('0x18')][_0x102f('0x1d')],function(_0x2f1ecf){return{'model':db[_0x2f1ecf[_0x102f('0x1f')]],'as':_0x2f1ecf['as'],'attributes':_0x2f1ecf['attributes'],'include':_0x2f1ecf['include']?_[_0x102f('0x1e')](_0x2f1ecf['include'],function(_0xa453a4){return{'model':db[_0xa453a4[_0x102f('0x1f')]],'as':_0xa453a4['as'],'attributes':_0xa453a4[_0x102f('0x1b')],'include':_0xa453a4[_0x102f('0x1d')]?_[_0x102f('0x1e')](_0xa453a4['include'],function(_0xc82a09){return{'model':db[_0xc82a09[_0x102f('0x1f')]],'as':_0xc82a09['as'],'attributes':_0xc82a09[_0x102f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x355689){var _0x39a6ba=[];for(var _0x3612b6=0x0;_0x3612b6<_0x355689[_0x102f('0x35')];_0x3612b6+=0x1){_0x39a6ba[_0x102f('0x37')](_0x355689[_0x3612b6][_0x102f('0x25')](_0x41f6c5[_0x102f('0x22')],{'transaction':_0x230d1c}));}return BPromise[_0x102f('0x39')](_0x39a6ba);});})[_0x102f('0xb')](function(_0x3f7407){logger[_0x102f('0xc')](_0x102f('0x46'),_0x41f6c5);logger[_0x102f('0xf')]('GetContactRecallMe',_0x41f6c5,JSON[_0x102f('0x11')](_0x3f7407));_0x5d069b(_0x3f7407);})['catch'](function(_0x45b960){logger['error'](_0x102f('0x46'),_0x45b960['message'],_0x41f6c5);_0x164fe2(_0x50548a[_0x102f('0x12')](0x1f4,_0x45b960[_0x102f('0x13')]));});});});};exports['GetCmHopperPreview']=function(_0x982703){var _0x12f000=this;return new Promise(function(_0xa56c2c,_0x51f1c5){db[_0x102f('0x29')][_0x102f('0x2a')]()[_0x102f('0xb')](function(_0x2b1015){return db[_0x102f('0x17')][_0x102f('0x2c')]({'raw':_0x982703[_0x102f('0x18')]?_0x982703['options'][_0x102f('0x19')]===undefined?!![]:![]:!![],'where':_0x982703['options']?_0x982703[_0x102f('0x18')]['where']||null:null,'attributes':_0x982703[_0x102f('0x18')]?_0x982703[_0x102f('0x18')][_0x102f('0x1b')]||null:null,'limit':_0x982703[_0x102f('0x18')]?_0x982703[_0x102f('0x18')]['limit']||null:null,'include':_0x982703['options']?_0x982703['options'][_0x102f('0x1d')]?_[_0x102f('0x1e')](_0x982703[_0x102f('0x18')]['include'],function(_0x2924ed){return{'model':db[_0x2924ed['model']],'as':_0x2924ed['as'],'attributes':_0x2924ed['as']==='Contact'?_['keys'](_0x2b1015):_0x2924ed[_0x102f('0x1b')],'include':_0x2924ed[_0x102f('0x1d')]?_[_0x102f('0x1e')](_0x2924ed[_0x102f('0x1d')],function(_0xc27418){return{'model':db[_0xc27418[_0x102f('0x1f')]],'as':_0xc27418['as'],'attributes':_0xc27418['attributes'],'include':_0xc27418['include']?_[_0x102f('0x1e')](_0xc27418[_0x102f('0x1d')],function(_0x525847){return{'model':db[_0x525847[_0x102f('0x1f')]],'as':_0x525847['as'],'attributes':_0x525847['attributes']};}):[]};}):[]};}):[]:[]})[_0x102f('0xb')](function(_0x3a27db){logger[_0x102f('0xc')](_0x102f('0x16'),_0x982703);logger[_0x102f('0xf')](_0x102f('0x16'),_0x982703,JSON[_0x102f('0x11')](_0x3a27db));_0xa56c2c(_0x3a27db);})[_0x102f('0x15')](function(_0x5ce2c4){logger[_0x102f('0x12')](_0x102f('0x16'),_0x5ce2c4[_0x102f('0x13')],_0x982703);_0x51f1c5(_0x12f000['error'](0x1f4,_0x5ce2c4[_0x102f('0x13')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 5d90757..a48fd1a 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 _0x8737=['../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','/describe','isAuthenticated','describe','/opencontacts','getOpenContacts','/:id','post','create','/preview','getPreview','put','update','delete','path','connect-timeout','express','Router'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0x8737,0xf8));var _0x7873=function(_0x3f2a5d,_0x5cb200){_0x3f2a5d=_0x3f2a5d-0x0;var _0x3e29e0=_0x8737[_0x3f2a5d];return _0x3e29e0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7873('0x0'));var timeout=require(_0x7873('0x1'));var express=require(_0x7873('0x2'));var router=express[_0x7873('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7873('0x4'));var interaction=require(_0x7873('0x5'));var config=require('../../config/environment');var controller=require(_0x7873('0x6'));router[_0x7873('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7873('0x7')](_0x7873('0x8'),auth[_0x7873('0x9')](),controller[_0x7873('0xa')]);router[_0x7873('0x7')](_0x7873('0xb'),auth[_0x7873('0x9')](),controller[_0x7873('0xc')]);router[_0x7873('0x7')](_0x7873('0xd'),auth[_0x7873('0x9')](),controller['show']);router[_0x7873('0xe')]('/',auth[_0x7873('0x9')](),controller[_0x7873('0xf')]);router[_0x7873('0xe')](_0x7873('0x10'),auth['isAuthenticated'](),controller[_0x7873('0x11')]);router[_0x7873('0x12')](_0x7873('0xd'),auth[_0x7873('0x9')](),controller[_0x7873('0x13')]);router[_0x7873('0x14')]('/:id',auth[_0x7873('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x22d2=['express','Router','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','describe','/opencontacts','/:id','show','post','create','/preview','put','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x516d47,_0x29055e){var _0x46421b=function(_0x39f986){while(--_0x39f986){_0x516d47['push'](_0x516d47['shift']());}};_0x46421b(++_0x29055e);}(_0x22d2,0x15c));var _0x222d=function(_0x1227ce,_0x2ae2a2){_0x1227ce=_0x1227ce-0x0;var _0x53f6c0=_0x22d2[_0x1227ce];return _0x53f6c0;};'use strict';var multer=require(_0x222d('0x0'));var util=require(_0x222d('0x1'));var path=require(_0x222d('0x2'));var timeout=require(_0x222d('0x3'));var express=require(_0x222d('0x4'));var router=express[_0x222d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x222d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x222d('0x7'));var controller=require(_0x222d('0x8'));router[_0x222d('0x9')]('/',auth[_0x222d('0xa')](),controller['index']);router[_0x222d('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x222d('0xb')]);router[_0x222d('0x9')](_0x222d('0xc'),auth[_0x222d('0xa')](),controller['getOpenContacts']);router[_0x222d('0x9')](_0x222d('0xd'),auth[_0x222d('0xa')](),controller[_0x222d('0xe')]);router[_0x222d('0xf')]('/',auth[_0x222d('0xa')](),controller[_0x222d('0x10')]);router['post'](_0x222d('0x11'),auth[_0x222d('0xa')](),controller['getPreview']);router[_0x222d('0x12')](_0x222d('0xd'),auth['isAuthenticated'](),controller[_0x222d('0x13')]);router['delete'](_0x222d('0xd'),auth['isAuthenticated'](),controller[_0x222d('0x14')]);module[_0x222d('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 62d4a11..c40f30c 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae26=['format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xae26,0x132));var _0x6ae2=function(_0x592541,_0x4fab31){_0x592541=_0x592541-0x0;var _0x5ba8d8=_0xae26[_0x592541];return _0x5ba8d8;};'use strict';var moment=require(_0x6ae2('0x0'));var Sequelize=require(_0x6ae2('0x1'));module[_0x6ae2('0x2')]={'CmHopperId':{'type':Sequelize[_0x6ae2('0x3')]},'phone':{'type':Sequelize[_0x6ae2('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x6ae2('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x6ae2('0x5')],'defaultValue':moment()[_0x6ae2('0x6')](_0x6ae2('0x7'))},'countbusyretry':{'type':Sequelize[_0x6ae2('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6ae2('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x6ae2('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbc48=['moment','sequelize','exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x12e6e5,_0x39855b){var _0x4ef6ce=function(_0x3e06f3){while(--_0x3e06f3){_0x12e6e5['push'](_0x12e6e5['shift']());}};_0x4ef6ce(++_0x39855b);}(_0xbc48,0x118));var _0x8bc4=function(_0x519ad5,_0x2dbb51){_0x519ad5=_0x519ad5-0x0;var _0x58c6e0=_0xbc48[_0x519ad5];return _0x58c6e0;};'use strict';var moment=require(_0x8bc4('0x0'));var Sequelize=require(_0x8bc4('0x1'));module[_0x8bc4('0x2')]={'CmHopperId':{'type':Sequelize[_0x8bc4('0x3')]},'phone':{'type':Sequelize[_0x8bc4('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8bc4('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x8bc4('0x5')],'defaultValue':moment()[_0x8bc4('0x6')](_0x8bc4('0x7'))},'countbusyretry':{'type':Sequelize[_0x8bc4('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8bc4('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8bc4('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8bc4('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8bc4('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8bc4('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index e898c87..37cb2a7 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x425f=['attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','filter','merge','VIRTUAL','where','include','findAll','rows','catch','params','keys','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','filters','intersection'];(function(_0x4f6513,_0x1a6ce7){var _0x5086f1=function(_0x268fbd){while(--_0x268fbd){_0x4f6513['push'](_0x4f6513['shift']());}};_0x5086f1(++_0x1a6ce7);}(_0x425f,0x114));var _0xf425=function(_0x3672fb,_0x2946ae){_0x3672fb=_0x3672fb-0x0;var _0x717727=_0x425f[_0x3672fb];return _0x717727;};'use strict';var emlformat=require(_0xf425('0x0'));var rimraf=require(_0xf425('0x1'));var zipdir=require(_0xf425('0x2'));var jsonpatch=require(_0xf425('0x3'));var rp=require(_0xf425('0x4'));var moment=require(_0xf425('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf425('0x6'));var sox=require(_0xf425('0x7'));var csv=require(_0xf425('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf425('0x9'));var _=require(_0xf425('0xa'));var squel=require(_0xf425('0xb'));var crypto=require(_0xf425('0xc'));var jsforce=require(_0xf425('0xd'));var deskjs=require(_0xf425('0xe'));var toCsv=require(_0xf425('0x8'));var querystring=require(_0xf425('0xf'));var Papa=require('papaparse');var Redis=require(_0xf425('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf425('0x11'));var as=require(_0xf425('0x12'));var hardwareService=require(_0xf425('0x13'));var logger=require(_0xf425('0x14'))(_0xf425('0x15'));var utils=require(_0xf425('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf425('0x17'));var db=require(_0xf425('0x18'))['db'];function respondWithStatusCode(_0x22aa7f,_0x171949){_0x171949=_0x171949||0xcc;return function(_0x577238){if(_0x577238){return _0x22aa7f[_0xf425('0x19')](_0x171949);}return _0x22aa7f[_0xf425('0x1a')](_0x171949)[_0xf425('0x1b')]();};}function respondWithResult(_0x6f588b,_0x325a62){_0x325a62=_0x325a62||0xc8;return function(_0x75bf39){if(_0x75bf39){return _0x6f588b[_0xf425('0x1a')](_0x325a62)['json'](_0x75bf39);}};}function respondWithFilteredResult(_0x16c69e,_0x13b93d){return function(_0x248ffe){if(_0x248ffe){var _0x45fa01=typeof _0x13b93d[_0xf425('0x1c')]==='undefined'&&typeof _0x13b93d['limit']===_0xf425('0x1d');var _0xcadb31=_0x248ffe[_0xf425('0x1e')];var _0x516c1b=_0x45fa01?0x0:_0x13b93d[_0xf425('0x1c')];var _0x1342ca=_0x45fa01?_0x248ffe[_0xf425('0x1e')]:_0x13b93d[_0xf425('0x1c')]+_0x13b93d['limit'];var _0x2b02f6;if(_0x1342ca>=_0xcadb31){_0x1342ca=_0xcadb31;_0x2b02f6=0xc8;}else{_0x2b02f6=0xce;}_0x16c69e[_0xf425('0x1a')](_0x2b02f6);return _0x16c69e[_0xf425('0x1f')](_0xf425('0x20'),_0x516c1b+'-'+_0x1342ca+'/'+_0xcadb31)['json'](_0x248ffe);}return null;};}function patchUpdates(_0x15d4a2){return function(_0x515549){try{jsonpatch[_0xf425('0x21')](_0x515549,_0x15d4a2,!![]);}catch(_0x28d75b){return BPromise[_0xf425('0x22')](_0x28d75b);}return _0x515549['save']();};}function saveUpdates(_0x55cb76,_0x28c83a){return function(_0x503be4){if(_0x503be4){return _0x503be4[_0xf425('0x23')](_0x55cb76)[_0xf425('0x24')](function(_0x27f400){return _0x27f400;});}return null;};}function removeEntity(_0x23cc00,_0x19b224){return function(_0x4cec82){if(_0x4cec82){return _0x4cec82[_0xf425('0x25')]()[_0xf425('0x24')](function(){var _0x55e940=_0x4cec82['get']({'plain':!![]});var _0x390dab=_0xf425('0x26');return db[_0xf425('0x27')][_0xf425('0x25')]({'where':{'type':_0x390dab,'resourceId':_0x55e940['id']}})['then'](function(){return _0x4cec82;});})[_0xf425('0x24')](function(){_0x23cc00[_0xf425('0x1a')](0xcc)[_0xf425('0x1b')]();});}};}function handleEntityNotFound(_0x4ab391,_0x139608){return function(_0xcea17d){if(!_0xcea17d){_0x4ab391[_0xf425('0x19')](0x194);}return _0xcea17d;};}function handleError(_0x5f5753,_0x595d18){_0x595d18=_0x595d18||0x1f4;return function(_0x29fb4c){logger[_0xf425('0x28')](_0x29fb4c['stack']);if(_0x29fb4c[_0xf425('0x29')]){delete _0x29fb4c[_0xf425('0x29')];}_0x5f5753[_0xf425('0x1a')](_0x595d18)['send'](_0x29fb4c);};}exports[_0xf425('0x2a')]=function(_0x4aa334,_0x2517df){var _0x56d790={},_0x4a7733={},_0x3159bc={'count':0x0,'rows':[]};var _0xc28133=_[_0xf425('0x2b')](db[_0xf425('0x2c')][_0xf425('0x2d')],function(_0x282ef2){return{'name':_0x282ef2[_0xf425('0x2e')],'type':_0x282ef2[_0xf425('0x2f')][_0xf425('0x30')]};});_0x4a7733[_0xf425('0x31')]=_[_0xf425('0x2b')](_0xc28133,'name');_0x4a7733['query']=_['keys'](_0x4aa334['query']);_0x4a7733[_0xf425('0x32')]=_[_0xf425('0x33')](_0x4a7733[_0xf425('0x31')],_0x4a7733['query']);_0x56d790[_0xf425('0x34')]=_[_0xf425('0x33')](_0x4a7733[_0xf425('0x31')],qs['fields'](_0x4aa334['query'][_0xf425('0x35')]));_0x56d790[_0xf425('0x34')]=_0x56d790[_0xf425('0x34')][_0xf425('0x36')]?_0x56d790[_0xf425('0x34')]:_0x4a7733['model'];if(!_0x4aa334[_0xf425('0x37')][_0xf425('0x38')](_0xf425('0x39'))){_0x56d790[_0xf425('0x3a')]=qs[_0xf425('0x3a')](_0x4aa334[_0xf425('0x37')][_0xf425('0x3a')]);_0x56d790[_0xf425('0x1c')]=qs[_0xf425('0x1c')](_0x4aa334[_0xf425('0x37')][_0xf425('0x1c')]);}_0x56d790[_0xf425('0x3b')]=qs['sort'](_0x4aa334[_0xf425('0x37')][_0xf425('0x3c')]);_0x56d790['where']=qs[_0xf425('0x32')](_['pick'](_0x4aa334['query'],_0x4a7733['filters']),_0xc28133);if(_0x4aa334['query'][_0xf425('0x3d')]){_0x56d790['where']=_[_0xf425('0x3e')](_0x56d790['where'],{'$or':_[_0xf425('0x2b')](_0xc28133,function(_0x41db88){if(_0x41db88[_0xf425('0x2f')]!==_0xf425('0x3f')){var _0xd96343={};_0xd96343[_0x41db88[_0xf425('0x29')]]={'$like':'%'+_0x4aa334[_0xf425('0x37')][_0xf425('0x3d')]+'%'};return _0xd96343;}})});}_0x56d790=_[_0xf425('0x3e')]({},_0x56d790,_0x4aa334['options']);var _0x56b62c={'where':_0x56d790[_0xf425('0x40')]};return db['CmHopperAdditionalPhone'][_0xf425('0x1e')](_0x56b62c)[_0xf425('0x24')](function(_0x3d0978){_0x3159bc['count']=_0x3d0978;if(_0x4aa334['query']['includeAll']){_0x56d790[_0xf425('0x41')]=[{'all':!![]}];}return db[_0xf425('0x2c')][_0xf425('0x42')](_0x56d790);})[_0xf425('0x24')](function(_0x3d936f){_0x3159bc[_0xf425('0x43')]=_0x3d936f;return _0x3159bc;})[_0xf425('0x24')](respondWithFilteredResult(_0x2517df,_0x56d790))[_0xf425('0x44')](handleError(_0x2517df,null));};exports['show']=function(_0x456543,_0x212ebc){var _0x2ff723={'raw':!![],'where':{'id':_0x456543[_0xf425('0x45')]['id']}},_0xc9335d={};_0xc9335d[_0xf425('0x31')]=_[_0xf425('0x46')](db[_0xf425('0x2c')][_0xf425('0x2d')]);_0xc9335d[_0xf425('0x37')]=_['keys'](_0x456543[_0xf425('0x37')]);_0xc9335d[_0xf425('0x32')]=_[_0xf425('0x33')](_0xc9335d[_0xf425('0x31')],_0xc9335d[_0xf425('0x37')]);_0x2ff723[_0xf425('0x34')]=_['intersection'](_0xc9335d[_0xf425('0x31')],qs['fields'](_0x456543[_0xf425('0x37')]['fields']));_0x2ff723['attributes']=_0x2ff723[_0xf425('0x34')][_0xf425('0x36')]?_0x2ff723['attributes']:_0xc9335d[_0xf425('0x31')];if(_0x456543[_0xf425('0x37')][_0xf425('0x47')]){_0x2ff723[_0xf425('0x41')]=[{'all':!![]}];}_0x2ff723=_['merge']({},_0x2ff723,_0x456543['options']);return db[_0xf425('0x2c')]['find'](_0x2ff723)[_0xf425('0x24')](handleEntityNotFound(_0x212ebc,null))[_0xf425('0x24')](respondWithResult(_0x212ebc,null))[_0xf425('0x44')](handleError(_0x212ebc,null));};exports[_0xf425('0x48')]=function(_0x438677,_0x16a84b){return db['CmHopperAdditionalPhone'][_0xf425('0x48')](_0x438677[_0xf425('0x49')],{})[_0xf425('0x24')](function(_0xfac3d9){var _0x4397da=_0x438677[_0xf425('0x4a')][_0xf425('0x4b')]({'plain':!![]});if(!_0x4397da)throw new Error(_0xf425('0x4c'));if(_0x4397da[_0xf425('0x4d')]===_0xf425('0x4a')){var _0x8dd865=_0xfac3d9['get']({'plain':!![]});var _0x1ab087=_0xf425('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x1ab087,'userProfileId':_0x4397da[_0xf425('0x4e')]},'raw':!![]})['then'](function(_0x5b6234){if(_0x5b6234&&_0x5b6234[_0xf425('0x4f')]===0x0){return db[_0xf425('0x27')][_0xf425('0x48')]({'name':_0x8dd865['name'],'resourceId':_0x8dd865['id'],'type':_0x5b6234['name'],'sectionId':_0x5b6234['id']},{})['then'](function(){return _0xfac3d9;});}else{return _0xfac3d9;}})[_0xf425('0x44')](function(_0x4c9f66){logger[_0xf425('0x28')](_0xf425('0x50'),_0x4c9f66);throw _0x4c9f66;});}return _0xfac3d9;})[_0xf425('0x24')](respondWithResult(_0x16a84b,0xc9))[_0xf425('0x44')](handleError(_0x16a84b,null));};exports[_0xf425('0x23')]=function(_0x5de9bd,_0x42a21e){if(_0x5de9bd[_0xf425('0x49')]['id']){delete _0x5de9bd[_0xf425('0x49')]['id'];}return db[_0xf425('0x2c')][_0xf425('0x51')]({'where':{'id':_0x5de9bd['params']['id']}})['then'](handleEntityNotFound(_0x42a21e,null))['then'](saveUpdates(_0x5de9bd[_0xf425('0x49')],null))['then'](respondWithResult(_0x42a21e,null))['catch'](handleError(_0x42a21e,null));};exports[_0xf425('0x25')]=function(_0x24ff27,_0x386472){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x24ff27[_0xf425('0x45')]['id']}})[_0xf425('0x24')](handleEntityNotFound(_0x386472,null))[_0xf425('0x24')](removeEntity(_0x386472,null))['catch'](handleError(_0x386472,null));}; \ No newline at end of file +var _0x6db1=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch'];(function(_0x414df0,_0x3b902f){var _0x2cf357=function(_0x528c3c){while(--_0x528c3c){_0x414df0['push'](_0x414df0['shift']());}};_0x2cf357(++_0x3b902f);}(_0x6db1,0xad));var _0x16db=function(_0x1d2ed3,_0x57c771){_0x1d2ed3=_0x1d2ed3-0x0;var _0x5c89c6=_0x6db1[_0x1d2ed3];return _0x5c89c6;};'use strict';var emlformat=require(_0x16db('0x0'));var rimraf=require(_0x16db('0x1'));var zipdir=require(_0x16db('0x2'));var jsonpatch=require(_0x16db('0x3'));var rp=require(_0x16db('0x4'));var moment=require(_0x16db('0x5'));var BPromise=require(_0x16db('0x6'));var Mustache=require(_0x16db('0x7'));var util=require('util');var path=require(_0x16db('0x8'));var sox=require(_0x16db('0x9'));var csv=require(_0x16db('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x16db('0xb'));var _=require(_0x16db('0xc'));var squel=require('squel');var crypto=require(_0x16db('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x16db('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x16db('0xe'));var authService=require(_0x16db('0xf'));var qs=require(_0x16db('0x10'));var as=require(_0x16db('0x11'));var hardwareService=require(_0x16db('0x12'));var logger=require(_0x16db('0x13'))('api');var utils=require(_0x16db('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x16db('0x15'));var db=require(_0x16db('0x16'))['db'];function respondWithStatusCode(_0x3d6423,_0x391a78){_0x391a78=_0x391a78||0xcc;return function(_0x1f93d4){if(_0x1f93d4){return _0x3d6423[_0x16db('0x17')](_0x391a78);}return _0x3d6423[_0x16db('0x18')](_0x391a78)[_0x16db('0x19')]();};}function respondWithResult(_0x1d7f89,_0x1c3779){_0x1c3779=_0x1c3779||0xc8;return function(_0x4615b6){if(_0x4615b6){return _0x1d7f89[_0x16db('0x18')](_0x1c3779)[_0x16db('0x1a')](_0x4615b6);}};}function respondWithFilteredResult(_0x409621,_0x5dc299){return function(_0x16f10f){if(_0x16f10f){var _0x297a17=typeof _0x5dc299[_0x16db('0x1b')]===_0x16db('0x1c')&&typeof _0x5dc299['limit']===_0x16db('0x1c');var _0x567df9=_0x16f10f[_0x16db('0x1d')];var _0xf9d57d=_0x297a17?0x0:_0x5dc299[_0x16db('0x1b')];var _0x364384=_0x297a17?_0x16f10f[_0x16db('0x1d')]:_0x5dc299[_0x16db('0x1b')]+_0x5dc299['limit'];var _0x157e12;if(_0x364384>=_0x567df9){_0x364384=_0x567df9;_0x157e12=0xc8;}else{_0x157e12=0xce;}_0x409621['status'](_0x157e12);return _0x409621['set'](_0x16db('0x1e'),_0xf9d57d+'-'+_0x364384+'/'+_0x567df9)['json'](_0x16f10f);}return null;};}function patchUpdates(_0x57f406){return function(_0x2b45c7){try{jsonpatch[_0x16db('0x1f')](_0x2b45c7,_0x57f406,!![]);}catch(_0x16ceb2){return BPromise[_0x16db('0x20')](_0x16ceb2);}return _0x2b45c7[_0x16db('0x21')]();};}function saveUpdates(_0x90c535,_0x4107e8){return function(_0x3e01d8){if(_0x3e01d8){return _0x3e01d8['update'](_0x90c535)[_0x16db('0x22')](function(_0x33d23e){return _0x33d23e;});}return null;};}function removeEntity(_0x1d873f,_0x3094aa){return function(_0xcebafc){if(_0xcebafc){return _0xcebafc[_0x16db('0x23')]()[_0x16db('0x22')](function(){var _0x1e2236=_0xcebafc[_0x16db('0x24')]({'plain':!![]});var _0x483804=_0x16db('0x25');return db[_0x16db('0x26')]['destroy']({'where':{'type':_0x483804,'resourceId':_0x1e2236['id']}})['then'](function(){return _0xcebafc;});})[_0x16db('0x22')](function(){_0x1d873f[_0x16db('0x18')](0xcc)[_0x16db('0x19')]();});}};}function handleEntityNotFound(_0x1dce76,_0x2f803d){return function(_0x4b109c){if(!_0x4b109c){_0x1dce76['sendStatus'](0x194);}return _0x4b109c;};}function handleError(_0x4b3f1f,_0x2e3013){_0x2e3013=_0x2e3013||0x1f4;return function(_0x18d5dd){logger[_0x16db('0x27')](_0x18d5dd[_0x16db('0x28')]);if(_0x18d5dd['name']){delete _0x18d5dd[_0x16db('0x29')];}_0x4b3f1f[_0x16db('0x18')](_0x2e3013)[_0x16db('0x2a')](_0x18d5dd);};}exports[_0x16db('0x2b')]=function(_0x345c4a,_0x17164b){var _0x3218c3={},_0x1d4149={},_0x405dc1={'count':0x0,'rows':[]};var _0x1c198f=_['map'](db[_0x16db('0x2c')][_0x16db('0x2d')],function(_0x3a18fc){return{'name':_0x3a18fc[_0x16db('0x2e')],'type':_0x3a18fc[_0x16db('0x2f')][_0x16db('0x30')]};});_0x1d4149[_0x16db('0x31')]=_['map'](_0x1c198f,_0x16db('0x29'));_0x1d4149[_0x16db('0x32')]=_['keys'](_0x345c4a[_0x16db('0x32')]);_0x1d4149[_0x16db('0x33')]=_[_0x16db('0x34')](_0x1d4149[_0x16db('0x31')],_0x1d4149[_0x16db('0x32')]);_0x3218c3[_0x16db('0x35')]=_[_0x16db('0x34')](_0x1d4149[_0x16db('0x31')],qs[_0x16db('0x36')](_0x345c4a[_0x16db('0x32')][_0x16db('0x36')]));_0x3218c3[_0x16db('0x35')]=_0x3218c3[_0x16db('0x35')]['length']?_0x3218c3['attributes']:_0x1d4149[_0x16db('0x31')];if(!_0x345c4a[_0x16db('0x32')][_0x16db('0x37')](_0x16db('0x38'))){_0x3218c3[_0x16db('0x39')]=qs['limit'](_0x345c4a[_0x16db('0x32')][_0x16db('0x39')]);_0x3218c3[_0x16db('0x1b')]=qs['offset'](_0x345c4a[_0x16db('0x32')][_0x16db('0x1b')]);}_0x3218c3[_0x16db('0x3a')]=qs[_0x16db('0x3b')](_0x345c4a[_0x16db('0x32')]['sort']);_0x3218c3[_0x16db('0x3c')]=qs[_0x16db('0x33')](_[_0x16db('0x3d')](_0x345c4a[_0x16db('0x32')],_0x1d4149[_0x16db('0x33')]),_0x1c198f);if(_0x345c4a[_0x16db('0x32')][_0x16db('0x3e')]){_0x3218c3[_0x16db('0x3c')]=_[_0x16db('0x3f')](_0x3218c3[_0x16db('0x3c')],{'$or':_[_0x16db('0x40')](_0x1c198f,function(_0x72cbf5){if(_0x72cbf5['type']!=='VIRTUAL'){var _0x16ad57={};_0x16ad57[_0x72cbf5[_0x16db('0x29')]]={'$like':'%'+_0x345c4a[_0x16db('0x32')][_0x16db('0x3e')]+'%'};return _0x16ad57;}})});}_0x3218c3=_[_0x16db('0x3f')]({},_0x3218c3,_0x345c4a[_0x16db('0x41')]);var _0x145f7b={'where':_0x3218c3['where']};return db['CmHopperAdditionalPhone']['count'](_0x145f7b)[_0x16db('0x22')](function(_0x1274c8){_0x405dc1[_0x16db('0x1d')]=_0x1274c8;if(_0x345c4a[_0x16db('0x32')][_0x16db('0x42')]){_0x3218c3[_0x16db('0x43')]=[{'all':!![]}];}return db[_0x16db('0x2c')][_0x16db('0x44')](_0x3218c3);})['then'](function(_0x217549){_0x405dc1[_0x16db('0x45')]=_0x217549;return _0x405dc1;})['then'](respondWithFilteredResult(_0x17164b,_0x3218c3))['catch'](handleError(_0x17164b,null));};exports[_0x16db('0x46')]=function(_0x4009b2,_0x59529a){var _0x1eec2f={'raw':!![],'where':{'id':_0x4009b2[_0x16db('0x47')]['id']}},_0x505ae3={};_0x505ae3[_0x16db('0x31')]=_[_0x16db('0x48')](db[_0x16db('0x2c')]['rawAttributes']);_0x505ae3[_0x16db('0x32')]=_[_0x16db('0x48')](_0x4009b2[_0x16db('0x32')]);_0x505ae3[_0x16db('0x33')]=_[_0x16db('0x34')](_0x505ae3[_0x16db('0x31')],_0x505ae3[_0x16db('0x32')]);_0x1eec2f[_0x16db('0x35')]=_[_0x16db('0x34')](_0x505ae3[_0x16db('0x31')],qs[_0x16db('0x36')](_0x4009b2[_0x16db('0x32')][_0x16db('0x36')]));_0x1eec2f[_0x16db('0x35')]=_0x1eec2f[_0x16db('0x35')][_0x16db('0x49')]?_0x1eec2f['attributes']:_0x505ae3['model'];if(_0x4009b2[_0x16db('0x32')]['includeAll']){_0x1eec2f[_0x16db('0x43')]=[{'all':!![]}];}_0x1eec2f=_[_0x16db('0x3f')]({},_0x1eec2f,_0x4009b2[_0x16db('0x41')]);return db[_0x16db('0x2c')][_0x16db('0x4a')](_0x1eec2f)[_0x16db('0x22')](handleEntityNotFound(_0x59529a,null))[_0x16db('0x22')](respondWithResult(_0x59529a,null))[_0x16db('0x4b')](handleError(_0x59529a,null));};exports[_0x16db('0x4c')]=function(_0x315ed5,_0x3eb368){return db[_0x16db('0x2c')][_0x16db('0x4c')](_0x315ed5[_0x16db('0x4d')],{})[_0x16db('0x22')](function(_0x23aa09){var _0x4d971a=_0x315ed5[_0x16db('0x4e')]['get']({'plain':!![]});if(!_0x4d971a)throw new Error(_0x16db('0x4f'));if(_0x4d971a['role']===_0x16db('0x4e')){var _0x32af44=_0x23aa09[_0x16db('0x24')]({'plain':!![]});var _0x3019c6='CmHopperAdditionalPhones';return db[_0x16db('0x50')]['find']({'where':{'name':_0x3019c6,'userProfileId':_0x4d971a['userProfileId']},'raw':!![]})[_0x16db('0x22')](function(_0x231399){if(_0x231399&&_0x231399['autoAssociation']===0x0){return db[_0x16db('0x26')][_0x16db('0x4c')]({'name':_0x32af44['name'],'resourceId':_0x32af44['id'],'type':_0x231399['name'],'sectionId':_0x231399['id']},{})[_0x16db('0x22')](function(){return _0x23aa09;});}else{return _0x23aa09;}})[_0x16db('0x4b')](function(_0x33cd56){logger['error'](_0x16db('0x51'),_0x33cd56);throw _0x33cd56;});}return _0x23aa09;})[_0x16db('0x22')](respondWithResult(_0x3eb368,0xc9))[_0x16db('0x4b')](handleError(_0x3eb368,null));};exports[_0x16db('0x52')]=function(_0x3bf3eb,_0x3d26ac){if(_0x3bf3eb['body']['id']){delete _0x3bf3eb['body']['id'];}return db[_0x16db('0x2c')][_0x16db('0x4a')]({'where':{'id':_0x3bf3eb['params']['id']}})['then'](handleEntityNotFound(_0x3d26ac,null))[_0x16db('0x22')](saveUpdates(_0x3bf3eb[_0x16db('0x4d')],null))[_0x16db('0x22')](respondWithResult(_0x3d26ac,null))[_0x16db('0x4b')](handleError(_0x3d26ac,null));};exports[_0x16db('0x23')]=function(_0xd40622,_0x186331){return db[_0x16db('0x2c')][_0x16db('0x4a')]({'where':{'id':_0xd40622[_0x16db('0x47')]['id']}})[_0x16db('0x22')](handleEntityNotFound(_0x186331,null))[_0x16db('0x22')](removeEntity(_0x186331,null))[_0x16db('0x4b')](handleError(_0x186331,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 5dabb18..2b022da 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe233=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','api','request-promise'];(function(_0x13ec89,_0x1cc1ba){var _0x969623=function(_0x1451eb){while(--_0x1451eb){_0x13ec89['push'](_0x13ec89['shift']());}};_0x969623(++_0x1cc1ba);}(_0xe233,0x15b));var _0x3e23=function(_0x556081,_0x5c6fb4){_0x556081=_0x556081-0x0;var _0x5872bf=_0xe233[_0x556081];return _0x5872bf;};'use strict';var _=require(_0x3e23('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3e23('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e23('0x2'));var fs=require('fs');var path=require(_0x3e23('0x3'));var rimraf=require(_0x3e23('0x4'));var config=require(_0x3e23('0x5'));var attributes=require(_0x3e23('0x6'));module['exports']=function(_0x45ac90,_0x37f31d){return _0x45ac90[_0x3e23('0x7')](_0x3e23('0x8'),attributes,{'tableName':_0x3e23('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c5c=['api','moment','bluebird','path','rimraf','./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','util','../../config/logger'];(function(_0x54fc1f,_0x1703c2){var _0x53f699=function(_0x3fad74){while(--_0x3fad74){_0x54fc1f['push'](_0x54fc1f['shift']());}};_0x53f699(++_0x1703c2);}(_0x4c5c,0xc6));var _0xc4c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4c5c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xc4c5('0x0'));var logger=require(_0xc4c5('0x1'))(_0xc4c5('0x2'));var moment=require(_0xc4c5('0x3'));var BPromise=require(_0xc4c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4c5('0x5'));var rimraf=require(_0xc4c5('0x6'));var config=require('../../config/environment');var attributes=require(_0xc4c5('0x7'));module['exports']=function(_0x39c2d1,_0x230291){return _0x39c2d1[_0xc4c5('0x8')](_0xc4c5('0x9'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index ed17290..8d72d6f 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8cc=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countbusyretry','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','phone','countmachineretry','createdAt','updatedAt','isNil','countcongestionretry','hopperToAdd','additionalToHop','sequelize','IncrementPreviewCounters','update','field','lodash','util'];(function(_0x57534b,_0x537480){var _0x5ad732=function(_0x26bf53){while(--_0x26bf53){_0x57534b['push'](_0x57534b['shift']());}};_0x5ad732(++_0x537480);}(_0xa8cc,0x120));var _0xca8c=function(_0x6883e3,_0x35de2d){_0x6883e3=_0x6883e3-0x0;var _0x238fbf=_0xa8cc[_0x6883e3];return _0x238fbf;};'use strict';var _=require(_0xca8c('0x0'));var util=require(_0xca8c('0x1'));var moment=require('moment');var BPromise=require(_0xca8c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xca8c('0x3'))['db'];var utils=require(_0xca8c('0x4'));var logger=require(_0xca8c('0x5'))(_0xca8c('0x6'));var config=require(_0xca8c('0x7'));var jayson=require(_0xca8c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x528c7a,_0x2c4ad1,_0x3b955a){return new BPromise(function(_0x14c319,_0x3c97db){return client[_0xca8c('0x9')](_0x528c7a,_0x3b955a)[_0xca8c('0xa')](function(_0x3cbba9){logger[_0xca8c('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x2c4ad1,_0xca8c('0xc'));logger[_0xca8c('0xd')](_0xca8c('0xe'),_0x2c4ad1,_0xca8c('0xc'),JSON[_0xca8c('0xf')](_0x3cbba9));if(_0x3cbba9['error']){if(_0x3cbba9[_0xca8c('0x10')]['code']===0x1f4){logger[_0xca8c('0x10')](_0xca8c('0x11'),_0x2c4ad1,_0x3cbba9[_0xca8c('0x10')][_0xca8c('0x12')]);return _0x3c97db(_0x3cbba9[_0xca8c('0x10')][_0xca8c('0x12')]);}logger[_0xca8c('0x10')](_0xca8c('0x11'),_0x2c4ad1,_0x3cbba9[_0xca8c('0x10')][_0xca8c('0x12')]);return _0x14c319(_0x3cbba9[_0xca8c('0x10')][_0xca8c('0x12')]);}else{logger[_0xca8c('0xb')](_0xca8c('0x11'),_0x2c4ad1,'request\x20sent');_0x14c319(_0x3cbba9[_0xca8c('0x13')][_0xca8c('0x12')]);}})[_0xca8c('0x14')](function(_0x49e8fe){logger[_0xca8c('0x10')](_0xca8c('0x11'),_0x2c4ad1,_0x49e8fe);_0x3c97db(_0x49e8fe);});});}exports[_0xca8c('0x15')]=function(_0x401f02){var _0x180983=this;return new Promise(function(_0x531d4c,_0x3a0c59){return db[_0xca8c('0x16')][_0xca8c('0x17')]({'raw':!![],'where':{'ContactId':_0x401f02[_0xca8c('0x18')][_0xca8c('0x19')],'ListId':_0x401f02[_0xca8c('0x18')][_0xca8c('0x1a')],'VoiceQueueId':_0x401f02[_0xca8c('0x18')][_0xca8c('0x1b')]===undefined?null:_0x401f02[_0xca8c('0x18')][_0xca8c('0x1b')],'CampaignId':_0x401f02[_0xca8c('0x18')][_0xca8c('0x1c')]===undefined?null:_0x401f02[_0xca8c('0x18')]['CampaignId']}})[_0xca8c('0xa')](function(_0x47279b){if(_0x47279b!=null){return db[_0xca8c('0x1d')][_0xca8c('0x17')]({'raw':!![],'where':{'CmHopperId':_0x47279b['id'],'OrderBy':{'$gt':_0x47279b[_0xca8c('0x1e')]}},'order':[[_0xca8c('0x1e'),'ASC']]})[_0xca8c('0xa')](function(_0x493a38){var _0x50f000=0x0;if(_0x493a38){if(_0x493a38['countbusyretry']+_0x493a38['countcongestionretry']+_0x493a38[_0xca8c('0x1f')]+_0x493a38[_0xca8c('0x20')]+_0x493a38[_0xca8c('0x21')]+_0x493a38[_0xca8c('0x22')]+_0x493a38['countmachineretry']+_0x493a38[_0xca8c('0x23')]<_0x401f02[_0xca8c('0x24')][_0xca8c('0x25')])_0x50f000=0x1;_0x531d4c({'additional':_0x50f000});}else{return db[_0xca8c('0x1d')][_0xca8c('0x17')]({'raw':!![],'where':{'CmHopperId':_0x47279b['id']},'order':[[_0xca8c('0x1e'),_0xca8c('0x26')]]})[_0xca8c('0xa')](function(_0x138cba){var _0x585e2c=0x0;if(_0x138cba){if(_0x138cba[_0xca8c('0x27')]+_0x138cba['countcongestionretry']+_0x138cba[_0xca8c('0x1f')]+_0x138cba[_0xca8c('0x20')]+_0x138cba['countdropretry']+_0x138cba['countabandonedretry']+_0x138cba['countmachineretry']+_0x138cba[_0xca8c('0x23')]<_0x401f02[_0xca8c('0x24')][_0xca8c('0x25')])_0x585e2c=0x1;_0x531d4c({'additional':_0x585e2c});}else{_0x531d4c({'additional':0x0});}})[_0xca8c('0x14')](function(_0x2713c2){logger[_0xca8c('0x10')](_0xca8c('0x15'),_0x2713c2[_0xca8c('0x12')],_0x401f02);_0x3a0c59(_0x180983['error'](0x1f4,_0x2713c2[_0xca8c('0x12')]));});}})[_0xca8c('0x14')](function(_0x2bc125){logger[_0xca8c('0x10')](_0xca8c('0x15'),_0x2bc125['message'],_0x401f02);_0x3a0c59(_0x180983[_0xca8c('0x10')](0x1f4,_0x2bc125[_0xca8c('0x12')]));});}else _0x531d4c({'additional':0x0});});});};exports[_0xca8c('0x28')]=function(_0x2673f5){var _0x1db27f=this;return new Promise(function(_0x4d174c,_0x1ff713){return db[_0xca8c('0x16')][_0xca8c('0x17')]({'raw':!![],'where':{'ContactId':_0x2673f5[_0xca8c('0x18')][_0xca8c('0x19')],'ListId':_0x2673f5[_0xca8c('0x18')][_0xca8c('0x1a')],'VoiceQueueId':_0x2673f5[_0xca8c('0x18')][_0xca8c('0x1b')]===undefined?null:_0x2673f5['body'][_0xca8c('0x1b')],'CampaignId':_0x2673f5[_0xca8c('0x18')][_0xca8c('0x1c')]===undefined?null:_0x2673f5[_0xca8c('0x18')][_0xca8c('0x1c')]}})[_0xca8c('0xa')](function(_0x5a6aad){if(_0x5a6aad!=null){return db[_0xca8c('0x1d')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x5a6aad['id'],'OrderBy':{'$gte':_0x5a6aad[_0xca8c('0x1e')]}},'order':[[_0xca8c('0x1e'),_0xca8c('0x26')]]})[_0xca8c('0xa')](function(_0x5ed503){if(_0x5ed503)return activateAdditionalPhone(_0x5a6aad,_0x2673f5['body'],_0x5ed503,_0x2673f5['duration'],_0x2673f5['waitTime'])[_0xca8c('0xa')](function(_0x1ca36a){_0x4d174c(_0x1ca36a);});else{return db[_0xca8c('0x1d')][_0xca8c('0x17')]({'raw':!![],'where':{'CmHopperId':_0x5a6aad['id']},'order':[[_0xca8c('0x1e'),_0xca8c('0x26')]]})[_0xca8c('0xa')](function(_0x5632d4){if(_0x5632d4)return activateAdditionalPhone(_0x5a6aad,_0x2673f5['body'],_0x5632d4,_0x2673f5[_0xca8c('0x29')],_0x2673f5[_0xca8c('0x2a')])[_0xca8c('0xa')](function(_0x87761c){_0x4d174c(_0x87761c);});else{_0x4d174c({'id':_0x5a6aad['id'],'phone':''});}})[_0xca8c('0x14')](function(_0x251992){logger[_0xca8c('0x10')](_0xca8c('0x15'),_0x251992[_0xca8c('0x12')],_0x2673f5);_0x1ff713(_0x1db27f['error'](0x1f4,_0x251992[_0xca8c('0x12')]));});}})['catch'](function(_0x5767ee){logger['error'](_0xca8c('0x15'),_0x5767ee[_0xca8c('0x12')],_0x2673f5);_0x1ff713(_0x1db27f['error'](0x1f4,_0x5767ee[_0xca8c('0x12')]));});}else _0x4d174c(0x1);});});};function activateAdditionalPhone(_0x2f4783,_0x5568a2,_0x27b730,_0x385cab,_0x5ed8e9){return new Promise(function(_0x889f0c,_0x1b9a35){logger[_0xca8c('0xb')](_0xca8c('0x15'),_0x27b730);var _0x1c7155;if(moment()>moment(_0x27b730[_0xca8c('0x2b')])){_0x1c7155=moment()[_0xca8c('0x2c')](_0x5ed8e9||0x3,_0xca8c('0x2d'));}else{if(_0x27b730[_0xca8c('0x1e')]==0x0){_0x1c7155=moment(_0x27b730[_0xca8c('0x2b')]);}else{_0x1c7155=moment()[_0xca8c('0x2c')](_0x5ed8e9||0x3,'minutes');}}var _0x2faffa={'phone':_0x2f4783[_0xca8c('0x2e')],'active':0x0,'OrderBy':_['isNil'](_0x2f4783['OrderBy'])?0x0:_0x2f4783[_0xca8c('0x1e')],'scheduledat':moment()[_0xca8c('0x2c')](_0x385cab||0x1,_0xca8c('0x2d')),'countbusyretry':_0x5568a2[_0xca8c('0x27')],'countcongestionretry':_0x5568a2['countcongestionretry'],'countnoanswerretry':_0x5568a2[_0xca8c('0x1f')],'countnosuchnumberretry':_0x5568a2[_0xca8c('0x20')],'countdropretry':_0x5568a2['countdropretry'],'countabandonedretry':_0x5568a2['countabandonedretry'],'countmachineretry':_0x5568a2[_0xca8c('0x2f')],'countagentrejectretry':_0x5568a2[_0xca8c('0x23')],'createdAt':_0x5568a2[_0xca8c('0x30')],'updatedAt':_0x5568a2[_0xca8c('0x31')]};var _0x40ab1c={'CmHopperId':_0x2f4783['id'],'phone':_0x27b730['phone'],'active':0x0,'OrderBy':_[_0xca8c('0x32')](_0x27b730['OrderBy'])?0x0:_0x27b730[_0xca8c('0x1e')],'scheduledat':_0x1c7155,'countbusyretry':_0x27b730[_0xca8c('0x27')],'countcongestionretry':_0x27b730[_0xca8c('0x33')],'countnoanswerretry':_0x27b730[_0xca8c('0x1f')],'countnosuchnumberretry':_0x27b730[_0xca8c('0x20')],'countdropretry':_0x27b730['countdropretry'],'countabandonedretry':_0x27b730[_0xca8c('0x22')],'countmachineretry':_0x27b730[_0xca8c('0x2f')],'countagentrejectretry':_0x27b730['countagentrejectretry'],'createdAt':_0x27b730[_0xca8c('0x30')],'updatedAt':_0x27b730[_0xca8c('0x31')]};logger['info'](_0xca8c('0x34'),_0x2faffa);logger[_0xca8c('0xb')](_0xca8c('0x35'),_0x40ab1c);return db[_0xca8c('0x36')]['transaction'](function(_0x154a0b){return db[_0xca8c('0x1d')]['update'](_0x2faffa,{'where':{'id':_0x27b730['id']}},{'transaction':_0x154a0b})[_0xca8c('0xa')](function(){return db[_0xca8c('0x16')]['update'](_0x40ab1c,{'where':{'id':_0x2f4783['id']}},{'transaction':_0x154a0b});});})[_0xca8c('0xa')](function(_0x31c2c4){_0x889f0c({'id':_0x2f4783['id'],'phone':_0x27b730[_0xca8c('0x2e')]});})[_0xca8c('0x14')](function(_0x155390){logger['error']('VerifyAdditionalPhones',_0x155390[_0xca8c('0x12')],req);_0x1b9a35(_this[_0xca8c('0x10')](0x1f4,_0x155390[_0xca8c('0x12')]));});});}exports[_0xca8c('0x37')]=function(_0x2d98b0){var _0x3d0200=this;return new Promise(function(_0x53e916,_0xd7246a){return db['CmHopper'][_0xca8c('0x38')](_0x2d98b0[_0xca8c('0x18')][_0xca8c('0x39')],{'where':{'id':_0x2d98b0[_0xca8c('0x18')]['id']}})['then'](function(_0x58ab9c){_0x53e916(_0x58ab9c);})['catch'](function(_0x43072a){logger[_0xca8c('0x10')](_0xca8c('0x37'),_0x43072a['message'],_0x2d98b0);_0xd7246a(_0x3d0200[_0xca8c('0x10')](0x1f4,_0x43072a[_0xca8c('0x12')]));});});}; \ No newline at end of file +var _0x641b=['countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countabandonedretry','ListId','waitTime','duration','activateAdditionalPhone','add','minutes','scheduledat','phone','isNil','countnosuchnumberretry','countdropretry','createdAt','updatedAt','hopperToAdditional\x20-\x20','additionalToHopper\x20-\x20','additional\x20-\x20','hopper\x20-\x20','sequelize','transaction','update','CmHopper','IncrementPreviewCounters','field','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperAdditionalPhone,\x20%s,\x20%s','result','catch','VerifyAdditionalPhones','findOne','body','ContactId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x57b03e,_0x45f3b3){var _0x21fa44=function(_0x40a7e2){while(--_0x40a7e2){_0x57b03e['push'](_0x57b03e['shift']());}};_0x21fa44(++_0x45f3b3);}(_0x641b,0x190));var _0xb641=function(_0x8df82b,_0x2b370d){_0x8df82b=_0x8df82b-0x0;var _0x5b87d8=_0x641b[_0x8df82b];return _0x5b87d8;};'use strict';var _=require('lodash');var util=require(_0xb641('0x0'));var moment=require('moment');var BPromise=require(_0xb641('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb641('0x2'));var db=require(_0xb641('0x3'))['db'];var utils=require(_0xb641('0x4'));var logger=require(_0xb641('0x5'))('rpc');var config=require(_0xb641('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb641('0x7')][_0xb641('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5295f5,_0x3595bc,_0x4c4061){return new BPromise(function(_0x40a068,_0x453f76){return client[_0xb641('0x9')](_0x5295f5,_0x4c4061)[_0xb641('0xa')](function(_0x52264b){logger[_0xb641('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3595bc,_0xb641('0xc'));logger[_0xb641('0xd')](_0xb641('0xe'),_0x3595bc,_0xb641('0xc'),JSON[_0xb641('0xf')](_0x52264b));if(_0x52264b[_0xb641('0x10')]){if(_0x52264b[_0xb641('0x10')][_0xb641('0x11')]===0x1f4){logger[_0xb641('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x3595bc,_0x52264b['error'][_0xb641('0x12')]);return _0x453f76(_0x52264b[_0xb641('0x10')]['message']);}logger['error'](_0xb641('0x13'),_0x3595bc,_0x52264b[_0xb641('0x10')][_0xb641('0x12')]);return _0x40a068(_0x52264b[_0xb641('0x10')]['message']);}else{logger[_0xb641('0xb')](_0xb641('0x13'),_0x3595bc,'request\x20sent');_0x40a068(_0x52264b[_0xb641('0x14')][_0xb641('0x12')]);}})[_0xb641('0x15')](function(_0x392347){logger[_0xb641('0x10')](_0xb641('0x13'),_0x3595bc,_0x392347);_0x453f76(_0x392347);});});}exports[_0xb641('0x16')]=function(_0x1e540a){var _0x3df360=this;return new Promise(function(_0x59ee5a,_0x3445c0){return db['CmHopper'][_0xb641('0x17')]({'raw':!![],'where':{'ContactId':_0x1e540a[_0xb641('0x18')][_0xb641('0x19')],'ListId':_0x1e540a[_0xb641('0x18')]['ListId'],'VoiceQueueId':_0x1e540a['body'][_0xb641('0x1a')]===undefined?null:_0x1e540a['body']['VoiceQueueId'],'CampaignId':_0x1e540a[_0xb641('0x18')][_0xb641('0x1b')]===undefined?null:_0x1e540a[_0xb641('0x18')]['CampaignId']}})[_0xb641('0xa')](function(_0x301bf1){if(_0x301bf1!=null){return db[_0xb641('0x1c')][_0xb641('0x17')]({'raw':!![],'where':{'CmHopperId':_0x301bf1['id'],'OrderBy':{'$gt':_0x301bf1[_0xb641('0x1d')]}},'order':[[_0xb641('0x1d'),_0xb641('0x1e')]]})['then'](function(_0x5f35c2){var _0x1ec0e6=0x0;if(_0x5f35c2){if(_0x5f35c2[_0xb641('0x1f')]+_0x5f35c2[_0xb641('0x20')]+_0x5f35c2[_0xb641('0x21')]+_0x5f35c2['countnosuchnumberretry']+_0x5f35c2['countdropretry']+_0x5f35c2['countabandonedretry']+_0x5f35c2[_0xb641('0x22')]+_0x5f35c2[_0xb641('0x23')]<_0x1e540a[_0xb641('0x24')][_0xb641('0x25')])_0x1ec0e6=0x1;_0x59ee5a({'additional':_0x1ec0e6});}else{return db['CmHopperAdditionalPhone'][_0xb641('0x17')]({'raw':!![],'where':{'CmHopperId':_0x301bf1['id']},'order':[[_0xb641('0x1d'),_0xb641('0x1e')]]})[_0xb641('0xa')](function(_0x16e58e){var _0x4f50e2=0x0;if(_0x16e58e){if(_0x16e58e[_0xb641('0x1f')]+_0x16e58e[_0xb641('0x20')]+_0x16e58e[_0xb641('0x21')]+_0x16e58e['countnosuchnumberretry']+_0x16e58e['countdropretry']+_0x16e58e[_0xb641('0x26')]+_0x16e58e[_0xb641('0x22')]+_0x16e58e[_0xb641('0x23')]<_0x1e540a[_0xb641('0x24')]['dialGlobalMaxRetry'])_0x4f50e2=0x1;_0x59ee5a({'additional':_0x4f50e2});}else{_0x59ee5a({'additional':0x0});}})[_0xb641('0x15')](function(_0x223cb8){logger['error']('VerifyAdditionalPhones',_0x223cb8[_0xb641('0x12')],_0x1e540a);_0x3445c0(_0x3df360['error'](0x1f4,_0x223cb8[_0xb641('0x12')]));});}})[_0xb641('0x15')](function(_0x346908){logger['error']('VerifyAdditionalPhones',_0x346908[_0xb641('0x12')],_0x1e540a);_0x3445c0(_0x3df360[_0xb641('0x10')](0x1f4,_0x346908[_0xb641('0x12')]));});}else _0x59ee5a({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x26754b){var _0x124c21=this;return new Promise(function(_0x2a70ac,_0x33b793){return db['CmHopper']['findOne']({'raw':!![],'where':{'ContactId':_0x26754b[_0xb641('0x18')][_0xb641('0x19')],'ListId':_0x26754b[_0xb641('0x18')][_0xb641('0x27')],'VoiceQueueId':_0x26754b[_0xb641('0x18')][_0xb641('0x1a')]===undefined?null:_0x26754b[_0xb641('0x18')][_0xb641('0x1a')],'CampaignId':_0x26754b['body'][_0xb641('0x1b')]===undefined?null:_0x26754b[_0xb641('0x18')][_0xb641('0x1b')]}})[_0xb641('0xa')](function(_0x314d09){if(_0x314d09!=null){return db[_0xb641('0x1c')][_0xb641('0x17')]({'raw':!![],'where':{'CmHopperId':_0x314d09['id'],'OrderBy':{'$gte':_0x314d09[_0xb641('0x1d')]}},'order':[['OrderBy',_0xb641('0x1e')]]})[_0xb641('0xa')](function(_0x1b854a){if(_0x1b854a)return activateAdditionalPhone(_0x314d09,_0x26754b[_0xb641('0x18')],_0x1b854a,_0x26754b['duration'],_0x26754b[_0xb641('0x28')])[_0xb641('0xa')](function(_0x2a3db2){_0x2a70ac(_0x2a3db2);});else{return db[_0xb641('0x1c')][_0xb641('0x17')]({'raw':!![],'where':{'CmHopperId':_0x314d09['id']},'order':[[_0xb641('0x1d'),_0xb641('0x1e')]]})[_0xb641('0xa')](function(_0x5cf04e){if(_0x5cf04e)return activateAdditionalPhone(_0x314d09,_0x26754b[_0xb641('0x18')],_0x5cf04e,_0x26754b[_0xb641('0x29')],_0x26754b[_0xb641('0x28')])['then'](function(_0x6addad){_0x2a70ac(_0x6addad);});else{_0x2a70ac({'id':_0x314d09['id'],'phone':''});}})[_0xb641('0x15')](function(_0x4321c2){logger['error']('VerifyAdditionalPhones',_0x4321c2[_0xb641('0x12')],_0x26754b);_0x33b793(_0x124c21[_0xb641('0x10')](0x1f4,_0x4321c2[_0xb641('0x12')]));});}})[_0xb641('0x15')](function(_0x4a2152){logger[_0xb641('0x10')](_0xb641('0x16'),_0x4a2152['message'],_0x26754b);_0x33b793(_0x124c21[_0xb641('0x10')](0x1f4,_0x4a2152[_0xb641('0x12')]));});}else _0x2a70ac(0x1);});});};function activateAdditionalPhone(_0x15549b,_0x3beb0b,_0x4da930,_0x297e53,_0x5c57b8){return new Promise(function(_0x299e50,_0x11ea67){logger[_0xb641('0xb')](_0xb641('0x2a'));var _0x2ee9ce;if(moment()>moment(_0x4da930['scheduledat'])){_0x2ee9ce=moment()[_0xb641('0x2b')](_0x5c57b8||0x3,_0xb641('0x2c'));}else{if(_0x4da930['OrderBy']==0x0){_0x2ee9ce=moment(_0x4da930[_0xb641('0x2d')]);}else{_0x2ee9ce=moment()[_0xb641('0x2b')](_0x5c57b8||0x3,'minutes');}}var _0x5c5394={'phone':_0x15549b[_0xb641('0x2e')],'active':0x0,'OrderBy':_[_0xb641('0x2f')](_0x15549b['OrderBy'])?0x0:_0x15549b[_0xb641('0x1d')],'scheduledat':moment()[_0xb641('0x2b')](_0x297e53||0x1,_0xb641('0x2c')),'countbusyretry':_0x3beb0b['countbusyretry'],'countcongestionretry':_0x3beb0b[_0xb641('0x20')],'countnoanswerretry':_0x3beb0b[_0xb641('0x21')],'countnosuchnumberretry':_0x3beb0b[_0xb641('0x30')],'countdropretry':_0x3beb0b[_0xb641('0x31')],'countabandonedretry':_0x3beb0b[_0xb641('0x26')],'countmachineretry':_0x3beb0b[_0xb641('0x22')],'countagentrejectretry':_0x3beb0b[_0xb641('0x23')],'createdAt':_0x3beb0b[_0xb641('0x32')],'updatedAt':_0x3beb0b[_0xb641('0x33')]};var _0xdb5cfb={'CmHopperId':_0x15549b['id'],'phone':_0x4da930[_0xb641('0x2e')],'active':0x0,'OrderBy':_[_0xb641('0x2f')](_0x4da930[_0xb641('0x1d')])?0x0:_0x4da930[_0xb641('0x1d')],'scheduledat':_0x2ee9ce,'countbusyretry':_0x4da930[_0xb641('0x1f')],'countcongestionretry':_0x4da930[_0xb641('0x20')],'countnoanswerretry':_0x4da930[_0xb641('0x21')],'countnosuchnumberretry':_0x4da930[_0xb641('0x30')],'countdropretry':_0x4da930[_0xb641('0x31')],'countabandonedretry':_0x4da930['countabandonedretry'],'countmachineretry':_0x4da930['countmachineretry'],'countagentrejectretry':_0x4da930[_0xb641('0x23')],'createdAt':_0x4da930['createdAt'],'updatedAt':_0x4da930[_0xb641('0x33')]};logger[_0xb641('0xb')](_0xb641('0x34')+JSON['stringify'](_0x5c5394));logger['info'](_0xb641('0x35')+JSON[_0xb641('0xf')](_0xdb5cfb));logger[_0xb641('0xb')](_0xb641('0x36')+JSON[_0xb641('0xf')](_0x4da930));logger[_0xb641('0xb')](_0xb641('0x37')+JSON['stringify'](_0x15549b));return db[_0xb641('0x38')][_0xb641('0x39')](function(_0x53070b){return db[_0xb641('0x1c')][_0xb641('0x3a')](_0x5c5394,{'where':{'id':_0x4da930['id']}},{'transaction':_0x53070b})[_0xb641('0xa')](function(){return db[_0xb641('0x3b')][_0xb641('0x3a')](_0xdb5cfb,{'where':{'id':_0x15549b['id']}},{'transaction':_0x53070b});});})[_0xb641('0xa')](function(_0x5ee084){_0x299e50({'id':_0x15549b['id'],'phone':_0x4da930['phone']});})['catch'](function(_0x1de3ad){logger[_0xb641('0x10')](_0xb641('0x2a'),_0x1de3ad[_0xb641('0x12')],req);_0x11ea67(_this['error'](0x1f4,_0x1de3ad[_0xb641('0x12')]));});});}exports[_0xb641('0x3c')]=function(_0x1c2c0b){var _0x3e3090=this;return new Promise(function(_0x31b27e,_0x5c2499){return db['CmHopper']['update'](_0x1c2c0b[_0xb641('0x18')][_0xb641('0x3d')],{'where':{'id':_0x1c2c0b[_0xb641('0x18')]['id']}})[_0xb641('0xa')](function(_0x53e615){_0x31b27e(_0x53e615);})['catch'](function(_0x4771f3){logger[_0xb641('0x10')](_0xb641('0x3c'),_0x4771f3[_0xb641('0x12')],_0x1c2c0b);_0x5c2499(_0x3e3090[_0xb641('0x10')](0x1f4,_0x4771f3[_0xb641('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 5e6a414..5d50ab1 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2b39=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopperAdditionalPhone.controller','get'];(function(_0x141d7f,_0x379fb7){var _0x33b885=function(_0x35c6b0){while(--_0x35c6b0){_0x141d7f['push'](_0x141d7f['shift']());}};_0x33b885(++_0x379fb7);}(_0x2b39,0x11c));var _0x92b3=function(_0x1fc514,_0x2fce6a){_0x1fc514=_0x1fc514-0x0;var _0x118496=_0x2b39[_0x1fc514];return _0x118496;};'use strict';var multer=require(_0x92b3('0x0'));var util=require(_0x92b3('0x1'));var path=require(_0x92b3('0x2'));var timeout=require(_0x92b3('0x3'));var express=require(_0x92b3('0x4'));var router=express['Router']();var fs_extra=require(_0x92b3('0x5'));var auth=require(_0x92b3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92b3('0x7'));var controller=require(_0x92b3('0x8'));router[_0x92b3('0x9')]('/',auth[_0x92b3('0xa')](),controller[_0x92b3('0xb')]);router[_0x92b3('0x9')](_0x92b3('0xc'),auth[_0x92b3('0xa')](),controller[_0x92b3('0xd')]);router[_0x92b3('0xe')]('/',auth['isAuthenticated'](),controller[_0x92b3('0xf')]);router[_0x92b3('0x10')](_0x92b3('0xc'),auth[_0x92b3('0xa')](),controller[_0x92b3('0x11')]);router[_0x92b3('0x12')](_0x92b3('0xc'),auth[_0x92b3('0xa')](),controller[_0x92b3('0x13')]);module[_0x92b3('0x14')]=router; \ No newline at end of file +var _0xaa7c=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','multer','util'];(function(_0xf62e6c,_0x160938){var _0x14234f=function(_0x16fe1d){while(--_0x16fe1d){_0xf62e6c['push'](_0xf62e6c['shift']());}};_0x14234f(++_0x160938);}(_0xaa7c,0x18e));var _0xcaa7=function(_0x2b4376,_0x4fa631){_0x2b4376=_0x2b4376-0x0;var _0x23599e=_0xaa7c[_0x2b4376];return _0x23599e;};'use strict';var multer=require(_0xcaa7('0x0'));var util=require(_0xcaa7('0x1'));var path=require(_0xcaa7('0x2'));var timeout=require(_0xcaa7('0x3'));var express=require(_0xcaa7('0x4'));var router=express['Router']();var fs_extra=require(_0xcaa7('0x5'));var auth=require(_0xcaa7('0x6'));var interaction=require(_0xcaa7('0x7'));var config=require(_0xcaa7('0x8'));var controller=require(_0xcaa7('0x9'));router[_0xcaa7('0xa')]('/',auth['isAuthenticated'](),controller[_0xcaa7('0xb')]);router['get'](_0xcaa7('0xc'),auth[_0xcaa7('0xd')](),controller[_0xcaa7('0xe')]);router['post']('/',auth[_0xcaa7('0xd')](),controller[_0xcaa7('0xf')]);router[_0xcaa7('0x10')](_0xcaa7('0xc'),auth[_0xcaa7('0xd')](),controller[_0xcaa7('0x11')]);router[_0xcaa7('0x12')]('/:id',auth[_0xcaa7('0xd')](),controller[_0xcaa7('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 4f47693..6d34449 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 _0xcb04=['exports','STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0xcb04,0x9a));var _0x4cb0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xcb04[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0x4cb0('0x0'));var Sequelize=require(_0x4cb0('0x1'));module[_0x4cb0('0x2')]={'phone':{'type':Sequelize[_0x4cb0('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x4cb0('0x4')],'unique':_0x4cb0('0x5')},'ListId':{'type':Sequelize[_0x4cb0('0x4')],'unique':_0x4cb0('0x5')},'VoiceQueueId':{'type':Sequelize[_0x4cb0('0x4')],'unique':_0x4cb0('0x5')}}; \ No newline at end of file +var _0x80c3=['STRING','contactListQueue','INTEGER','moment'];(function(_0x10c0b5,_0x361ef7){var _0x558e64=function(_0x138b16){while(--_0x138b16){_0x10c0b5['push'](_0x10c0b5['shift']());}};_0x558e64(++_0x361ef7);}(_0x80c3,0x18f));var _0x380c=function(_0x188a93,_0xaf57db){_0x188a93=_0x188a93-0x0;var _0x23b40d=_0x80c3[_0x188a93];return _0x23b40d;};'use strict';var moment=require(_0x380c('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x380c('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x380c('0x2')},'ListId':{'type':Sequelize[_0x380c('0x3')],'unique':_0x380c('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'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 4e1ad8f..106f8c8 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 _0xf98b=['to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','end','status','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','CmHopperBlack','includeAll','findAll','rows','catch','show','params','include','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x44bc4e,_0x48ba83){var _0x2df568=function(_0x6ad2ef){while(--_0x6ad2ef){_0x44bc4e['push'](_0x44bc4e['shift']());}};_0x2df568(++_0x48ba83);}(_0xf98b,0x171));var _0xbf98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf98b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbf98('0x0'));var rimraf=require(_0xbf98('0x1'));var zipdir=require(_0xbf98('0x2'));var jsonpatch=require(_0xbf98('0x3'));var rp=require(_0xbf98('0x4'));var moment=require(_0xbf98('0x5'));var BPromise=require(_0xbf98('0x6'));var Mustache=require(_0xbf98('0x7'));var util=require(_0xbf98('0x8'));var path=require(_0xbf98('0x9'));var sox=require(_0xbf98('0xa'));var csv=require(_0xbf98('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf98('0xc'));var _=require('lodash');var squel=require(_0xbf98('0xd'));var crypto=require('crypto');var jsforce=require(_0xbf98('0xe'));var deskjs=require(_0xbf98('0xf'));var toCsv=require(_0xbf98('0xb'));var querystring=require(_0xbf98('0x10'));var Papa=require(_0xbf98('0x11'));var Redis=require(_0xbf98('0x12'));var authService=require(_0xbf98('0x13'));var qs=require(_0xbf98('0x14'));var as=require(_0xbf98('0x15'));var hardwareService=require(_0xbf98('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xbf98('0x17'));var config=require(_0xbf98('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c25a9,_0x3ae940){_0x3ae940=_0x3ae940||0xcc;return function(_0x718292){if(_0x718292){return _0x5c25a9[_0xbf98('0x19')](_0x3ae940);}return _0x5c25a9['status'](_0x3ae940)[_0xbf98('0x1a')]();};}function respondWithResult(_0x2da212,_0x58d029){_0x58d029=_0x58d029||0xc8;return function(_0x11b3e0){if(_0x11b3e0){return _0x2da212[_0xbf98('0x1b')](_0x58d029)['json'](_0x11b3e0);}};}function respondWithFilteredResult(_0x23ae2a,_0x45b64e){return function(_0x22c5e2){if(_0x22c5e2){var _0x5aa524=typeof _0x45b64e[_0xbf98('0x1c')]===_0xbf98('0x1d')&&typeof _0x45b64e[_0xbf98('0x1e')]===_0xbf98('0x1d');var _0x30231f=_0x22c5e2[_0xbf98('0x1f')];var _0xa0db7d=_0x5aa524?0x0:_0x45b64e[_0xbf98('0x1c')];var _0x5c5180=_0x5aa524?_0x22c5e2[_0xbf98('0x1f')]:_0x45b64e[_0xbf98('0x1c')]+_0x45b64e[_0xbf98('0x1e')];var _0x32bc6b;if(_0x5c5180>=_0x30231f){_0x5c5180=_0x30231f;_0x32bc6b=0xc8;}else{_0x32bc6b=0xce;}_0x23ae2a[_0xbf98('0x1b')](_0x32bc6b);return _0x23ae2a['set']('Content-Range',_0xa0db7d+'-'+_0x5c5180+'/'+_0x30231f)[_0xbf98('0x20')](_0x22c5e2);}return null;};}function patchUpdates(_0x3ca6a6){return function(_0x4961ba){try{jsonpatch[_0xbf98('0x21')](_0x4961ba,_0x3ca6a6,!![]);}catch(_0x4416a6){return BPromise[_0xbf98('0x22')](_0x4416a6);}return _0x4961ba[_0xbf98('0x23')]();};}function saveUpdates(_0x2b7f22,_0x36ad04){return function(_0x474c45){if(_0x474c45){return _0x474c45[_0xbf98('0x24')](_0x2b7f22)[_0xbf98('0x25')](function(_0x35d248){return _0x35d248;});}return null;};}function removeEntity(_0x276826,_0x119209){return function(_0x2721f7){if(_0x2721f7){return _0x2721f7[_0xbf98('0x26')]()[_0xbf98('0x25')](function(){_0x276826[_0xbf98('0x1b')](0xcc)[_0xbf98('0x1a')]();});}};}function handleEntityNotFound(_0x2d8eee,_0x53dd43){return function(_0x48aec1){if(!_0x48aec1){_0x2d8eee['sendStatus'](0x194);}return _0x48aec1;};}function handleError(_0x546058,_0x5c87ac){_0x5c87ac=_0x5c87ac||0x1f4;return function(_0x391df1){logger[_0xbf98('0x27')](_0x391df1[_0xbf98('0x28')]);if(_0x391df1[_0xbf98('0x29')]){delete _0x391df1[_0xbf98('0x29')];}_0x546058[_0xbf98('0x1b')](_0x5c87ac)[_0xbf98('0x2a')](_0x391df1);};}exports[_0xbf98('0x2b')]=function(_0x53b9a8,_0x7a9382){var _0x3a2552={},_0x5c8fec={},_0x232450={'count':0x0,'rows':[]};var _0x5b9e92=_[_0xbf98('0x2c')](db['CmHopperBlack'][_0xbf98('0x2d')],function(_0xc87bd5){return{'name':_0xc87bd5[_0xbf98('0x2e')],'type':_0xc87bd5[_0xbf98('0x2f')][_0xbf98('0x30')]};});_0x5c8fec[_0xbf98('0x31')]=_['map'](_0x5b9e92,_0xbf98('0x29'));_0x5c8fec[_0xbf98('0x32')]=_[_0xbf98('0x33')](_0x53b9a8[_0xbf98('0x32')]);_0x5c8fec[_0xbf98('0x34')]=_[_0xbf98('0x35')](_0x5c8fec[_0xbf98('0x31')],_0x5c8fec[_0xbf98('0x32')]);_0x3a2552['attributes']=_[_0xbf98('0x35')](_0x5c8fec[_0xbf98('0x31')],qs[_0xbf98('0x36')](_0x53b9a8['query']['fields']));_0x3a2552[_0xbf98('0x37')]=_0x3a2552[_0xbf98('0x37')][_0xbf98('0x38')]?_0x3a2552[_0xbf98('0x37')]:_0x5c8fec['model'];if(!_0x53b9a8['query'][_0xbf98('0x39')](_0xbf98('0x3a'))){_0x3a2552[_0xbf98('0x1e')]=qs[_0xbf98('0x1e')](_0x53b9a8[_0xbf98('0x32')][_0xbf98('0x1e')]);_0x3a2552[_0xbf98('0x1c')]=qs[_0xbf98('0x1c')](_0x53b9a8[_0xbf98('0x32')]['offset']);}_0x3a2552['order']=qs[_0xbf98('0x3b')](_0x53b9a8[_0xbf98('0x32')][_0xbf98('0x3b')]);_0x3a2552[_0xbf98('0x3c')]=qs[_0xbf98('0x34')](_['pick'](_0x53b9a8[_0xbf98('0x32')],_0x5c8fec['filters']),_0x5b9e92);if(_0x53b9a8[_0xbf98('0x32')][_0xbf98('0x3d')]){_0x3a2552[_0xbf98('0x3c')]=_[_0xbf98('0x3e')](_0x3a2552['where'],{'$or':_['map'](_0x5b9e92,function(_0x524dd0){if(_0x524dd0[_0xbf98('0x2f')]!==_0xbf98('0x3f')){var _0x155dab={};_0x155dab[_0x524dd0[_0xbf98('0x29')]]={'$like':'%'+_0x53b9a8[_0xbf98('0x32')][_0xbf98('0x3d')]+'%'};return _0x155dab;}})});}_0x3a2552=_['merge']({},_0x3a2552,_0x53b9a8[_0xbf98('0x40')]);var _0x1ad73a={'where':_0x3a2552[_0xbf98('0x3c')]};return db[_0xbf98('0x41')]['count'](_0x1ad73a)[_0xbf98('0x25')](function(_0x2e2f02){_0x232450['count']=_0x2e2f02;if(_0x53b9a8['query'][_0xbf98('0x42')]){_0x3a2552['include']=[{'all':!![]}];}return db[_0xbf98('0x41')][_0xbf98('0x43')](_0x3a2552);})[_0xbf98('0x25')](function(_0x447ded){_0x232450[_0xbf98('0x44')]=_0x447ded;return _0x232450;})[_0xbf98('0x25')](respondWithFilteredResult(_0x7a9382,_0x3a2552))[_0xbf98('0x45')](handleError(_0x7a9382,null));};exports[_0xbf98('0x46')]=function(_0x4b4943,_0x3e2ef4){var _0x397348={'raw':!![],'where':{'id':_0x4b4943[_0xbf98('0x47')]['id']}},_0x37572c={};_0x37572c[_0xbf98('0x31')]=_[_0xbf98('0x33')](db['CmHopperBlack']['rawAttributes']);_0x37572c[_0xbf98('0x32')]=_[_0xbf98('0x33')](_0x4b4943[_0xbf98('0x32')]);_0x37572c[_0xbf98('0x34')]=_[_0xbf98('0x35')](_0x37572c[_0xbf98('0x31')],_0x37572c[_0xbf98('0x32')]);_0x397348['attributes']=_[_0xbf98('0x35')](_0x37572c[_0xbf98('0x31')],qs[_0xbf98('0x36')](_0x4b4943[_0xbf98('0x32')][_0xbf98('0x36')]));_0x397348[_0xbf98('0x37')]=_0x397348[_0xbf98('0x37')][_0xbf98('0x38')]?_0x397348[_0xbf98('0x37')]:_0x37572c[_0xbf98('0x31')];if(_0x4b4943[_0xbf98('0x32')][_0xbf98('0x42')]){_0x397348[_0xbf98('0x48')]=[{'all':!![]}];}_0x397348=_[_0xbf98('0x3e')]({},_0x397348,_0x4b4943['options']);return db[_0xbf98('0x41')][_0xbf98('0x49')](_0x397348)[_0xbf98('0x25')](handleEntityNotFound(_0x3e2ef4,null))[_0xbf98('0x25')](respondWithResult(_0x3e2ef4,null))[_0xbf98('0x45')](handleError(_0x3e2ef4,null));};exports[_0xbf98('0x24')]=function(_0x30183d,_0x5d1225){if(_0x30183d['body']['id']){delete _0x30183d[_0xbf98('0x4a')]['id'];}return db[_0xbf98('0x41')][_0xbf98('0x49')]({'where':{'id':_0x30183d[_0xbf98('0x47')]['id']}})[_0xbf98('0x25')](handleEntityNotFound(_0x5d1225,null))['then'](saveUpdates(_0x30183d[_0xbf98('0x4a')],null))[_0xbf98('0x25')](respondWithResult(_0x5d1225,null))[_0xbf98('0x45')](handleError(_0x5d1225,null));};exports[_0xbf98('0x26')]=function(_0x34beea,_0x8f820c){return db[_0xbf98('0x41')][_0xbf98('0x49')]({'where':{'id':_0x34beea[_0xbf98('0x47')]['id']}})['then'](handleEntityNotFound(_0x8f820c,null))[_0xbf98('0x25')](removeEntity(_0x8f820c,null))[_0xbf98('0x45')](handleError(_0x8f820c,null));};exports[_0xbf98('0x4b')]=function(_0x33b88b,_0x283a86){return db[_0xbf98('0x41')]['describe']()[_0xbf98('0x25')](respondWithResult(_0x283a86,null))[_0xbf98('0x45')](handleError(_0x283a86,null));}; \ No newline at end of file +var _0x20fa=['find','update','body','catch','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','then','error','stack','name','send','CmHopperBlack','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','show','params','include'];(function(_0x58a4b5,_0x182439){var _0x51821d=function(_0x47c3c5){while(--_0x47c3c5){_0x58a4b5['push'](_0x58a4b5['shift']());}};_0x51821d(++_0x182439);}(_0x20fa,0xea));var _0xa20f=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0x20fa[_0x2b9e8a];return _0x520e67;};'use strict';var emlformat=require(_0xa20f('0x0'));var rimraf=require(_0xa20f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa20f('0x2'));var rp=require(_0xa20f('0x3'));var moment=require(_0xa20f('0x4'));var BPromise=require(_0xa20f('0x5'));var Mustache=require(_0xa20f('0x6'));var util=require(_0xa20f('0x7'));var path=require(_0xa20f('0x8'));var sox=require('sox');var csv=require(_0xa20f('0x9'));var ejs=require(_0xa20f('0xa'));var fs=require('fs');var fs_extra=require(_0xa20f('0xb'));var _=require(_0xa20f('0xc'));var squel=require(_0xa20f('0xd'));var crypto=require('crypto');var jsforce=require(_0xa20f('0xe'));var deskjs=require(_0xa20f('0xf'));var toCsv=require(_0xa20f('0x9'));var querystring=require(_0xa20f('0x10'));var Papa=require(_0xa20f('0x11'));var Redis=require(_0xa20f('0x12'));var authService=require(_0xa20f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa20f('0x14'));var hardwareService=require(_0xa20f('0x15'));var logger=require('../../config/logger')(_0xa20f('0x16'));var utils=require(_0xa20f('0x17'));var config=require(_0xa20f('0x18'));var licenseUtil=require(_0xa20f('0x19'));var db=require(_0xa20f('0x1a'))['db'];function respondWithStatusCode(_0x6fd89,_0x50169e){_0x50169e=_0x50169e||0xcc;return function(_0x409000){if(_0x409000){return _0x6fd89[_0xa20f('0x1b')](_0x50169e);}return _0x6fd89[_0xa20f('0x1c')](_0x50169e)[_0xa20f('0x1d')]();};}function respondWithResult(_0x313cb9,_0x8b7ef5){_0x8b7ef5=_0x8b7ef5||0xc8;return function(_0x1e0c85){if(_0x1e0c85){return _0x313cb9[_0xa20f('0x1c')](_0x8b7ef5)['json'](_0x1e0c85);}};}function respondWithFilteredResult(_0x45f827,_0x49afb7){return function(_0x29b4eb){if(_0x29b4eb){var _0xe3f7ba=typeof _0x49afb7[_0xa20f('0x1e')]===_0xa20f('0x1f')&&typeof _0x49afb7[_0xa20f('0x20')]==='undefined';var _0x20cc4c=_0x29b4eb['count'];var _0x49ec6a=_0xe3f7ba?0x0:_0x49afb7[_0xa20f('0x1e')];var _0x5ccd11=_0xe3f7ba?_0x29b4eb['count']:_0x49afb7[_0xa20f('0x1e')]+_0x49afb7[_0xa20f('0x20')];var _0x4edbc2;if(_0x5ccd11>=_0x20cc4c){_0x5ccd11=_0x20cc4c;_0x4edbc2=0xc8;}else{_0x4edbc2=0xce;}_0x45f827[_0xa20f('0x1c')](_0x4edbc2);return _0x45f827[_0xa20f('0x21')](_0xa20f('0x22'),_0x49ec6a+'-'+_0x5ccd11+'/'+_0x20cc4c)[_0xa20f('0x23')](_0x29b4eb);}return null;};}function patchUpdates(_0x4f21c3){return function(_0x597b48){try{jsonpatch[_0xa20f('0x24')](_0x597b48,_0x4f21c3,!![]);}catch(_0x21a332){return BPromise[_0xa20f('0x25')](_0x21a332);}return _0x597b48['save']();};}function saveUpdates(_0x2af236,_0x4efd07){return function(_0x78070c){if(_0x78070c){return _0x78070c['update'](_0x2af236)[_0xa20f('0x26')](function(_0x518bd3){return _0x518bd3;});}return null;};}function removeEntity(_0x371bed,_0x362341){return function(_0x4e5521){if(_0x4e5521){return _0x4e5521['destroy']()['then'](function(){_0x371bed[_0xa20f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x331b3e,_0x4b271d){return function(_0x5653f1){if(!_0x5653f1){_0x331b3e['sendStatus'](0x194);}return _0x5653f1;};}function handleError(_0x7eda68,_0x43b146){_0x43b146=_0x43b146||0x1f4;return function(_0x56f682){logger[_0xa20f('0x27')](_0x56f682[_0xa20f('0x28')]);if(_0x56f682[_0xa20f('0x29')]){delete _0x56f682['name'];}_0x7eda68['status'](_0x43b146)[_0xa20f('0x2a')](_0x56f682);};}exports['index']=function(_0x16c83a,_0x17634c){var _0x3b24bb={},_0x157062={},_0x1907e2={'count':0x0,'rows':[]};var _0xef186=_['map'](db[_0xa20f('0x2b')][_0xa20f('0x2c')],function(_0x435b18){return{'name':_0x435b18[_0xa20f('0x2d')],'type':_0x435b18['type'][_0xa20f('0x2e')]};});_0x157062[_0xa20f('0x2f')]=_[_0xa20f('0x30')](_0xef186,'name');_0x157062['query']=_[_0xa20f('0x31')](_0x16c83a[_0xa20f('0x32')]);_0x157062[_0xa20f('0x33')]=_['intersection'](_0x157062[_0xa20f('0x2f')],_0x157062[_0xa20f('0x32')]);_0x3b24bb['attributes']=_[_0xa20f('0x34')](_0x157062[_0xa20f('0x2f')],qs[_0xa20f('0x35')](_0x16c83a['query'][_0xa20f('0x35')]));_0x3b24bb[_0xa20f('0x36')]=_0x3b24bb[_0xa20f('0x36')][_0xa20f('0x37')]?_0x3b24bb[_0xa20f('0x36')]:_0x157062[_0xa20f('0x2f')];if(!_0x16c83a[_0xa20f('0x32')][_0xa20f('0x38')]('nolimit')){_0x3b24bb[_0xa20f('0x20')]=qs[_0xa20f('0x20')](_0x16c83a['query'][_0xa20f('0x20')]);_0x3b24bb['offset']=qs['offset'](_0x16c83a[_0xa20f('0x32')][_0xa20f('0x1e')]);}_0x3b24bb[_0xa20f('0x39')]=qs[_0xa20f('0x3a')](_0x16c83a[_0xa20f('0x32')][_0xa20f('0x3a')]);_0x3b24bb['where']=qs['filters'](_['pick'](_0x16c83a['query'],_0x157062[_0xa20f('0x33')]),_0xef186);if(_0x16c83a[_0xa20f('0x32')]['filter']){_0x3b24bb['where']=_[_0xa20f('0x3b')](_0x3b24bb[_0xa20f('0x3c')],{'$or':_[_0xa20f('0x30')](_0xef186,function(_0x21fcf9){if(_0x21fcf9['type']!==_0xa20f('0x3d')){var _0x197356={};_0x197356[_0x21fcf9['name']]={'$like':'%'+_0x16c83a[_0xa20f('0x32')]['filter']+'%'};return _0x197356;}})});}_0x3b24bb=_['merge']({},_0x3b24bb,_0x16c83a[_0xa20f('0x3e')]);var _0x319eb5={'where':_0x3b24bb['where']};return db[_0xa20f('0x2b')][_0xa20f('0x3f')](_0x319eb5)[_0xa20f('0x26')](function(_0x3c2ed8){_0x1907e2[_0xa20f('0x3f')]=_0x3c2ed8;if(_0x16c83a[_0xa20f('0x32')][_0xa20f('0x40')]){_0x3b24bb['include']=[{'all':!![]}];}return db[_0xa20f('0x2b')][_0xa20f('0x41')](_0x3b24bb);})[_0xa20f('0x26')](function(_0x29a91a){_0x1907e2[_0xa20f('0x42')]=_0x29a91a;return _0x1907e2;})[_0xa20f('0x26')](respondWithFilteredResult(_0x17634c,_0x3b24bb))['catch'](handleError(_0x17634c,null));};exports[_0xa20f('0x43')]=function(_0x28e0f1,_0x155f08){var _0x14a21e={'raw':!![],'where':{'id':_0x28e0f1[_0xa20f('0x44')]['id']}},_0xd4f35c={};_0xd4f35c[_0xa20f('0x2f')]=_['keys'](db[_0xa20f('0x2b')]['rawAttributes']);_0xd4f35c[_0xa20f('0x32')]=_[_0xa20f('0x31')](_0x28e0f1[_0xa20f('0x32')]);_0xd4f35c[_0xa20f('0x33')]=_[_0xa20f('0x34')](_0xd4f35c[_0xa20f('0x2f')],_0xd4f35c[_0xa20f('0x32')]);_0x14a21e[_0xa20f('0x36')]=_[_0xa20f('0x34')](_0xd4f35c['model'],qs[_0xa20f('0x35')](_0x28e0f1[_0xa20f('0x32')]['fields']));_0x14a21e[_0xa20f('0x36')]=_0x14a21e[_0xa20f('0x36')][_0xa20f('0x37')]?_0x14a21e[_0xa20f('0x36')]:_0xd4f35c[_0xa20f('0x2f')];if(_0x28e0f1['query'][_0xa20f('0x40')]){_0x14a21e[_0xa20f('0x45')]=[{'all':!![]}];}_0x14a21e=_['merge']({},_0x14a21e,_0x28e0f1[_0xa20f('0x3e')]);return db[_0xa20f('0x2b')][_0xa20f('0x46')](_0x14a21e)[_0xa20f('0x26')](handleEntityNotFound(_0x155f08,null))['then'](respondWithResult(_0x155f08,null))['catch'](handleError(_0x155f08,null));};exports[_0xa20f('0x47')]=function(_0x455a70,_0x1ea7ea){if(_0x455a70[_0xa20f('0x48')]['id']){delete _0x455a70['body']['id'];}return db[_0xa20f('0x2b')][_0xa20f('0x46')]({'where':{'id':_0x455a70[_0xa20f('0x44')]['id']}})[_0xa20f('0x26')](handleEntityNotFound(_0x1ea7ea,null))[_0xa20f('0x26')](saveUpdates(_0x455a70[_0xa20f('0x48')],null))[_0xa20f('0x26')](respondWithResult(_0x1ea7ea,null))[_0xa20f('0x49')](handleError(_0x1ea7ea,null));};exports[_0xa20f('0x4a')]=function(_0x87d3f,_0xae9caf){return db[_0xa20f('0x2b')][_0xa20f('0x46')]({'where':{'id':_0x87d3f[_0xa20f('0x44')]['id']}})[_0xa20f('0x26')](handleEntityNotFound(_0xae9caf,null))[_0xa20f('0x26')](removeEntity(_0xae9caf,null))[_0xa20f('0x49')](handleError(_0xae9caf,null));};exports[_0xa20f('0x4b')]=function(_0x257a19,_0x2fb9e6){return db['CmHopperBlack']['describe']()['then'](respondWithResult(_0x2fb9e6,null))[_0xa20f('0x49')](handleError(_0x2fb9e6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 420cfc0..9ab5b6e 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 _0x3ffb=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x144532,_0x110237){var _0x1af98f=function(_0x4c2023){while(--_0x4c2023){_0x144532['push'](_0x144532['shift']());}};_0x1af98f(++_0x110237);}(_0x3ffb,0x157));var _0xb3ff=function(_0x1654fc,_0x41bfa7){_0x1654fc=_0x1654fc-0x0;var _0x254006=_0x3ffb[_0x1654fc];return _0x254006;};'use strict';var _=require(_0xb3ff('0x0'));var util=require(_0xb3ff('0x1'));var logger=require(_0xb3ff('0x2'))(_0xb3ff('0x3'));var moment=require('moment');var BPromise=require(_0xb3ff('0x4'));var rp=require(_0xb3ff('0x5'));var fs=require('fs');var path=require(_0xb3ff('0x6'));var rimraf=require(_0xb3ff('0x7'));var config=require(_0xb3ff('0x8'));var attributes=require(_0xb3ff('0x9'));module[_0xb3ff('0xa')]=function(_0x1a3553,_0x395cff){return _0x1a3553[_0xb3ff('0xb')](_0xb3ff('0xc'),attributes,{'tableName':_0xb3ff('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce78=['api','moment','request-promise','rimraf','exports','define','CmHopperBlack','cm_hopper_black','../../config/logger'];(function(_0x4a209a,_0x575ff9){var _0x4b3c20=function(_0x1a50c1){while(--_0x1a50c1){_0x4a209a['push'](_0x4a209a['shift']());}};_0x4b3c20(++_0x575ff9);}(_0xce78,0x74));var _0x8ce7=function(_0xf4a734,_0x1a4fe7){_0xf4a734=_0xf4a734-0x0;var _0x10ee33=_0xce78[_0xf4a734];return _0x10ee33;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8ce7('0x0'))(_0x8ce7('0x1'));var moment=require(_0x8ce7('0x2'));var BPromise=require('bluebird');var rp=require(_0x8ce7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8ce7('0x4'));var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x8ce7('0x5')]=function(_0x29aad7,_0x5a652f){return _0x29aad7[_0x8ce7('0x6')](_0x8ce7('0x7'),attributes,{'tableName':_0x8ce7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 60fe7b2..24a11a2 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 _0x1c4d=['options','attributes','map','model','include','then','CmHopperBlack','update','body','raw','limit','UpdateCmHopperBlack','destroy','where','DestroyCmHopperBlack','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','findAll'];(function(_0x4aa4af,_0x210cde){var _0x3bf44a=function(_0x4a8126){while(--_0x4a8126){_0x4aa4af['push'](_0x4aa4af['shift']());}};_0x3bf44a(++_0x210cde);}(_0x1c4d,0x15c));var _0xd1c4=function(_0x260247,_0x3be752){_0x260247=_0x260247-0x0;var _0x1df404=_0x1c4d[_0x260247];return _0x1df404;};'use strict';var _=require('lodash');var util=require(_0xd1c4('0x0'));var moment=require(_0xd1c4('0x1'));var BPromise=require('bluebird');var rs=require(_0xd1c4('0x2'));var fs=require('fs');var Redis=require(_0xd1c4('0x3'));var db=require(_0xd1c4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd1c4('0x5'))(_0xd1c4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd1c4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43f5fd,_0x3af92d,_0x5176f7){return new BPromise(function(_0x24fc77,_0x1fbe30){return client[_0xd1c4('0x8')](_0x43f5fd,_0x5176f7)['then'](function(_0x4e9036){logger[_0xd1c4('0x9')](_0xd1c4('0xa'),_0x3af92d,_0xd1c4('0xb'));logger[_0xd1c4('0xc')](_0xd1c4('0xd'),_0x3af92d,_0xd1c4('0xb'),JSON[_0xd1c4('0xe')](_0x4e9036));if(_0x4e9036['error']){if(_0x4e9036[_0xd1c4('0xf')][_0xd1c4('0x10')]===0x1f4){logger['error'](_0xd1c4('0xa'),_0x3af92d,_0x4e9036[_0xd1c4('0xf')][_0xd1c4('0x11')]);return _0x1fbe30(_0x4e9036['error'][_0xd1c4('0x11')]);}logger[_0xd1c4('0xf')](_0xd1c4('0xa'),_0x3af92d,_0x4e9036[_0xd1c4('0xf')][_0xd1c4('0x11')]);return _0x24fc77(_0x4e9036[_0xd1c4('0xf')][_0xd1c4('0x11')]);}else{logger[_0xd1c4('0x9')](_0xd1c4('0xa'),_0x3af92d,_0xd1c4('0xb'));_0x24fc77(_0x4e9036[_0xd1c4('0x12')][_0xd1c4('0x11')]);}})[_0xd1c4('0x13')](function(_0x284299){logger[_0xd1c4('0xf')](_0xd1c4('0xa'),_0x3af92d,_0x284299);_0x1fbe30(_0x284299);});});}exports[_0xd1c4('0x14')]=function(_0x21fbd3){var _0x9bd879=this;return new Promise(function(_0x5277c1,_0x45dbab){return db['CmHopperBlack'][_0xd1c4('0x15')]({'raw':_0x21fbd3['options']?_0x21fbd3[_0xd1c4('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x21fbd3[_0xd1c4('0x16')]?_0x21fbd3[_0xd1c4('0x16')]['where']||null:null,'attributes':_0x21fbd3[_0xd1c4('0x16')]?_0x21fbd3[_0xd1c4('0x16')][_0xd1c4('0x17')]||null:null,'limit':_0x21fbd3['options']?_0x21fbd3[_0xd1c4('0x16')]['limit']||null:null,'include':_0x21fbd3[_0xd1c4('0x16')]?_0x21fbd3[_0xd1c4('0x16')]['include']?_[_0xd1c4('0x18')](_0x21fbd3['options']['include'],function(_0x2bfae7){return{'model':db[_0x2bfae7[_0xd1c4('0x19')]],'as':_0x2bfae7['as'],'attributes':_0x2bfae7[_0xd1c4('0x17')],'include':_0x2bfae7[_0xd1c4('0x1a')]?_[_0xd1c4('0x18')](_0x2bfae7[_0xd1c4('0x1a')],function(_0x398607){return{'model':db[_0x398607[_0xd1c4('0x19')]],'as':_0x398607['as'],'attributes':_0x398607['attributes'],'include':_0x398607[_0xd1c4('0x1a')]?_['map'](_0x398607[_0xd1c4('0x1a')],function(_0x27d7dd){return{'model':db[_0x27d7dd[_0xd1c4('0x19')]],'as':_0x27d7dd['as'],'attributes':_0x27d7dd[_0xd1c4('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd1c4('0x1b')](function(_0x1f0d4c){logger[_0xd1c4('0x9')](_0xd1c4('0x14'),_0x21fbd3);logger[_0xd1c4('0xc')](_0xd1c4('0x14'),_0x21fbd3,JSON[_0xd1c4('0xe')](_0x1f0d4c));_0x5277c1(_0x1f0d4c);})[_0xd1c4('0x13')](function(_0x4b69e0){logger[_0xd1c4('0xf')](_0xd1c4('0x14'),_0x4b69e0['message'],_0x21fbd3);_0x45dbab(_0x9bd879[_0xd1c4('0xf')](0x1f4,_0x4b69e0[_0xd1c4('0x11')]));});});};exports['UpdateCmHopperBlack']=function(_0x164cb2){var _0x24df95=this;return new Promise(function(_0x5675f8,_0x4275e6){return db[_0xd1c4('0x1c')][_0xd1c4('0x1d')](_0x164cb2[_0xd1c4('0x1e')],{'raw':_0x164cb2[_0xd1c4('0x16')]?_0x164cb2[_0xd1c4('0x16')][_0xd1c4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x164cb2[_0xd1c4('0x16')]?_0x164cb2['options']['where']||null:null,'attributes':_0x164cb2[_0xd1c4('0x16')]?_0x164cb2[_0xd1c4('0x16')]['attributes']||null:null,'limit':_0x164cb2[_0xd1c4('0x16')]?_0x164cb2['options'][_0xd1c4('0x20')]||null:null})['then'](function(_0xd5019b){logger[_0xd1c4('0x9')](_0xd1c4('0x21'),_0x164cb2);logger[_0xd1c4('0xc')](_0xd1c4('0x21'),_0x164cb2,JSON[_0xd1c4('0xe')](_0xd5019b));_0x5675f8(_0xd5019b);})[_0xd1c4('0x13')](function(_0x142752){logger[_0xd1c4('0xf')]('UpdateCmHopperBlack',_0x142752[_0xd1c4('0x11')],_0x164cb2);_0x4275e6(_0x24df95[_0xd1c4('0xf')](0x1f4,_0x142752[_0xd1c4('0x11')]));});});};exports['DestroyCmHopperBlack']=function(_0x2dba88){var _0x2d0332=this;return new Promise(function(_0x42adca,_0x482e51){return db[_0xd1c4('0x1c')][_0xd1c4('0x22')]({'where':_0x2dba88[_0xd1c4('0x16')]?_0x2dba88[_0xd1c4('0x16')][_0xd1c4('0x23')]||null:null})[_0xd1c4('0x1b')](function(_0x1002ad){logger[_0xd1c4('0x9')](_0xd1c4('0x24'),_0x2dba88);logger[_0xd1c4('0xc')](_0xd1c4('0x24'),_0x2dba88,JSON[_0xd1c4('0xe')](_0x1002ad));_0x42adca(_0x1002ad);})[_0xd1c4('0x13')](function(_0x2771dd){logger[_0xd1c4('0xf')]('DestroyCmHopperBlack',_0x2771dd[_0xd1c4('0x11')],_0x2dba88);_0x482e51(_0x2d0332[_0xd1c4('0xf')](0x1f4,_0x2771dd['message']));});});}; \ No newline at end of file +var _0xb974=['DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','limit','map','include','model','attributes','UpdateCmHopperBlack','update','body'];(function(_0x26a10d,_0x277fad){var _0x393311=function(_0x5c62df){while(--_0x5c62df){_0x26a10d['push'](_0x26a10d['shift']());}};_0x393311(++_0x277fad);}(_0xb974,0x105));var _0x4b97=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb974[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x4b97('0x0'));var util=require(_0x4b97('0x1'));var moment=require(_0x4b97('0x2'));var BPromise=require(_0x4b97('0x3'));var rs=require(_0x4b97('0x4'));var fs=require('fs');var Redis=require(_0x4b97('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4b97('0x6'));var jayson=require(_0x4b97('0x7'));var client=jayson[_0x4b97('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38b146,_0x386b0f,_0x10ba8d){return new BPromise(function(_0x2eb0c3,_0x56f489){return client['request'](_0x38b146,_0x10ba8d)[_0x4b97('0x9')](function(_0x7d3a2f){logger[_0x4b97('0xa')](_0x4b97('0xb'),_0x386b0f,_0x4b97('0xc'));logger[_0x4b97('0xd')](_0x4b97('0xe'),_0x386b0f,'request\x20sent',JSON[_0x4b97('0xf')](_0x7d3a2f));if(_0x7d3a2f['error']){if(_0x7d3a2f[_0x4b97('0x10')][_0x4b97('0x11')]===0x1f4){logger[_0x4b97('0x10')](_0x4b97('0xb'),_0x386b0f,_0x7d3a2f[_0x4b97('0x10')][_0x4b97('0x12')]);return _0x56f489(_0x7d3a2f[_0x4b97('0x10')]['message']);}logger[_0x4b97('0x10')](_0x4b97('0xb'),_0x386b0f,_0x7d3a2f['error'][_0x4b97('0x12')]);return _0x2eb0c3(_0x7d3a2f[_0x4b97('0x10')][_0x4b97('0x12')]);}else{logger[_0x4b97('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x386b0f,'request\x20sent');_0x2eb0c3(_0x7d3a2f[_0x4b97('0x13')][_0x4b97('0x12')]);}})[_0x4b97('0x14')](function(_0x1ac552){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x386b0f,_0x1ac552);_0x56f489(_0x1ac552);});});}exports[_0x4b97('0x15')]=function(_0x4d7787){var _0x4beed1=this;return new Promise(function(_0x39bd34,_0x40c2f7){return db[_0x4b97('0x16')][_0x4b97('0x17')]({'raw':_0x4d7787[_0x4b97('0x18')]?_0x4d7787[_0x4b97('0x18')][_0x4b97('0x19')]===undefined?!![]:![]:!![],'where':_0x4d7787[_0x4b97('0x18')]?_0x4d7787[_0x4b97('0x18')][_0x4b97('0x1a')]||null:null,'attributes':_0x4d7787[_0x4b97('0x18')]?_0x4d7787[_0x4b97('0x18')]['attributes']||null:null,'limit':_0x4d7787[_0x4b97('0x18')]?_0x4d7787[_0x4b97('0x18')][_0x4b97('0x1b')]||null:null,'include':_0x4d7787[_0x4b97('0x18')]?_0x4d7787[_0x4b97('0x18')]['include']?_[_0x4b97('0x1c')](_0x4d7787[_0x4b97('0x18')][_0x4b97('0x1d')],function(_0xdd0b57){return{'model':db[_0xdd0b57[_0x4b97('0x1e')]],'as':_0xdd0b57['as'],'attributes':_0xdd0b57[_0x4b97('0x1f')],'include':_0xdd0b57['include']?_[_0x4b97('0x1c')](_0xdd0b57[_0x4b97('0x1d')],function(_0x502302){return{'model':db[_0x502302['model']],'as':_0x502302['as'],'attributes':_0x502302[_0x4b97('0x1f')],'include':_0x502302['include']?_[_0x4b97('0x1c')](_0x502302[_0x4b97('0x1d')],function(_0x1630f1){return{'model':db[_0x1630f1['model']],'as':_0x1630f1['as'],'attributes':_0x1630f1[_0x4b97('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4b97('0x9')](function(_0xc9dd5b){logger[_0x4b97('0xa')](_0x4b97('0x15'),_0x4d7787);logger[_0x4b97('0xd')](_0x4b97('0x15'),_0x4d7787,JSON[_0x4b97('0xf')](_0xc9dd5b));_0x39bd34(_0xc9dd5b);})[_0x4b97('0x14')](function(_0x35576d){logger[_0x4b97('0x10')](_0x4b97('0x15'),_0x35576d['message'],_0x4d7787);_0x40c2f7(_0x4beed1[_0x4b97('0x10')](0x1f4,_0x35576d['message']));});});};exports[_0x4b97('0x20')]=function(_0xabf01d){var _0x416497=this;return new Promise(function(_0x1dfbc2,_0x5db390){return db[_0x4b97('0x16')][_0x4b97('0x21')](_0xabf01d[_0x4b97('0x22')],{'raw':_0xabf01d[_0x4b97('0x18')]?_0xabf01d[_0x4b97('0x18')][_0x4b97('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xabf01d['options']?_0xabf01d[_0x4b97('0x18')][_0x4b97('0x1a')]||null:null,'attributes':_0xabf01d[_0x4b97('0x18')]?_0xabf01d['options'][_0x4b97('0x1f')]||null:null,'limit':_0xabf01d[_0x4b97('0x18')]?_0xabf01d['options'][_0x4b97('0x1b')]||null:null})[_0x4b97('0x9')](function(_0x163433){logger['info'](_0x4b97('0x20'),_0xabf01d);logger[_0x4b97('0xd')](_0x4b97('0x20'),_0xabf01d,JSON['stringify'](_0x163433));_0x1dfbc2(_0x163433);})[_0x4b97('0x14')](function(_0x454a7f){logger[_0x4b97('0x10')](_0x4b97('0x20'),_0x454a7f[_0x4b97('0x12')],_0xabf01d);_0x5db390(_0x416497[_0x4b97('0x10')](0x1f4,_0x454a7f['message']));});});};exports[_0x4b97('0x23')]=function(_0x1d9689){var _0x2abff1=this;return new Promise(function(_0x5da59d,_0x2f0143){return db[_0x4b97('0x16')][_0x4b97('0x24')]({'where':_0x1d9689['options']?_0x1d9689['options']['where']||null:null})['then'](function(_0x2b8a0c){logger[_0x4b97('0xa')](_0x4b97('0x23'),_0x1d9689);logger[_0x4b97('0xd')](_0x4b97('0x23'),_0x1d9689,JSON[_0x4b97('0xf')](_0x2b8a0c));_0x5da59d(_0x2b8a0c);})[_0x4b97('0x14')](function(_0x321249){logger[_0x4b97('0x10')](_0x4b97('0x23'),_0x321249['message'],_0x1d9689);_0x2f0143(_0x2abff1['error'](0x1f4,_0x321249[_0x4b97('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 0747f77..aa514c9 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 _0xc6ac=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x42de13,_0xb98724){_0x42de13=_0x42de13-0x0;var _0x31ab58=_0xc6ac[_0x42de13];return _0x31ab58;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')](_0xcc6a('0x10'),auth['isAuthenticated'](),controller[_0xcc6a('0x13')]);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth['isAuthenticated'](),controller[_0xcc6a('0x15')]);module[_0xcc6a('0x16')]=router; \ No newline at end of file +var _0xa6b0=['update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','put'];(function(_0x483017,_0x73092c){var _0x3cc794=function(_0x28cb06){while(--_0x28cb06){_0x483017['push'](_0x483017['shift']());}};_0x3cc794(++_0x73092c);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x2eaff2,_0x79b375){_0x2eaff2=_0x2eaff2-0x0;var _0xf691ed=_0xa6b0[_0x2eaff2];return _0xf691ed;};'use strict';var multer=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a6b('0x2'));var router=express[_0x0a6b('0x3')]();var fs_extra=require(_0x0a6b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0a6b('0x5'));var config=require(_0x0a6b('0x6'));var controller=require(_0x0a6b('0x7'));router[_0x0a6b('0x8')]('/',auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xa')]);router[_0x0a6b('0x8')](_0x0a6b('0xb'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xc')]);router[_0x0a6b('0x8')](_0x0a6b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x0a6b('0xe')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0xf')]);router[_0x0a6b('0x10')](_0x0a6b('0xd'),auth[_0x0a6b('0x9')](),controller[_0x0a6b('0x11')]);module[_0x0a6b('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index a997090..1042406 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 _0x6a33=['followuptime','diff','seconds','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue'];(function(_0x4c254f,_0x2c8b0b){var _0x56aff7=function(_0x3912e0){while(--_0x3912e0){_0x4c254f['push'](_0x4c254f['shift']());}};_0x56aff7(++_0x2c8b0b);}(_0x6a33,0xfb));var _0x36a3=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x6a33[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x36a3('0x0'));var moment=require(_0x36a3('0x1'));module[_0x36a3('0x2')]={'state':{'type':Sequelize[_0x36a3('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x36a3('0x4')]},'scheduledat':{'type':Sequelize[_0x36a3('0x5')]},'countbusyretry':{'type':Sequelize[_0x36a3('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x36a3('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x36a3('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x36a3('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x36a3('0x4')]},'originatecalleridname':{'type':Sequelize[_0x36a3('0x4')]},'calleridnum':{'type':Sequelize[_0x36a3('0x4')]},'calleridname':{'type':Sequelize[_0x36a3('0x4')]},'starttime':{'type':Sequelize[_0x36a3('0x5')]},'responsetime':{'type':Sequelize[_0x36a3('0x5')]},'answertime':{'type':Sequelize[_0x36a3('0x5')]},'droptime':{'type':Sequelize[_0x36a3('0x5')]},'endtime':{'type':Sequelize[_0x36a3('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x36a3('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x36a3('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x36a3('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x36a3('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x36a3('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x36a3('0x4')]},'dispositionat':{'type':Sequelize[_0x36a3('0x5')],'set':function(_0x4d41e2){var _0x2f761f=this[_0x36a3('0x6')](_0x36a3('0x7'));if(_0x2f761f&&_0x4d41e2){this[_0x36a3('0x8')](_0x36a3('0x9'),moment(_0x4d41e2)[_0x36a3('0xa')](moment(_0x2f761f),_0x36a3('0xb')));}}},'amd':{'type':Sequelize[_0x36a3('0xc')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x36a3('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x36a3('0x5')]},'callback':{'type':Sequelize[_0x36a3('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x36a3('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x36a3('0x5')]},'deleted':{'type':Sequelize[_0x36a3('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x36a3('0x5')]},'recallme':{'type':Sequelize[_0x36a3('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x36a3('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x36a3('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x36a3('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x36a3('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb449=['setDataValue','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','endtime'];(function(_0x2aa196,_0x5a832f){var _0x5e2a4e=function(_0x907b50){while(--_0x907b50){_0x2aa196['push'](_0x2aa196['shift']());}};_0x5e2a4e(++_0x5a832f);}(_0xb449,0xaa));var _0x9b44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb449[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9b44('0x0'));var moment=require(_0x9b44('0x1'));module['exports']={'state':{'type':Sequelize[_0x9b44('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x9b44('0x3')]},'scheduledat':{'type':Sequelize[_0x9b44('0x4')]},'countbusyretry':{'type':Sequelize[_0x9b44('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9b44('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9b44('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9b44('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9b44('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x9b44('0x3')]},'originatecalleridname':{'type':Sequelize[_0x9b44('0x3')]},'calleridnum':{'type':Sequelize[_0x9b44('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9b44('0x4')]},'responsetime':{'type':Sequelize[_0x9b44('0x4')]},'answertime':{'type':Sequelize[_0x9b44('0x4')]},'droptime':{'type':Sequelize[_0x9b44('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9b44('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9b44('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9b44('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9b44('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x9b44('0x3')]},'reason':{'type':Sequelize[_0x9b44('0x3')]},'disposition':{'type':Sequelize[_0x9b44('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9b44('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x51289a){var _0x172f0d=this['getDataValue'](_0x9b44('0x5'));if(_0x172f0d&&_0x51289a){this[_0x9b44('0x6')]('followuptime',moment(_0x51289a)['diff'](moment(_0x172f0d),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9b44('0x7')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9b44('0x7')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x9b44('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9b44('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x9b44('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x9b44('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x9b44('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x9b44('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9b44('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9b44('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9b44('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index cffabd5..1aa6787 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 _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(_0x1b48fa,_0x2375a4){var _0x34434f=function(_0x5b1ccd){while(--_0x5b1ccd){_0x1b48fa['push'](_0x1b48fa['shift']());}};_0x34434f(++_0x2375a4);}(_0xc2c7,0x134));var _0x7c2c=function(_0x4fe5ef,_0x241233){_0x4fe5ef=_0x4fe5ef-0x0;var _0x338547=_0xc2c7[_0x4fe5ef];return _0x338547;};'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 +var _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0x5d17,0x114));var _0x75d1=function(_0x14909f,_0xe25f2e){_0x14909f=_0x14909f-0x0;var _0x19698c=_0x5d17[_0x14909f];return _0x19698c;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index c46071c..4e41db6 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 _0xe143=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','../../config/logger','api','request-promise','path','rimraf','./cmHopperFinal.attributes'];(function(_0x310c0a,_0x4ec103){var _0x599109=function(_0x18a58b){while(--_0x18a58b){_0x310c0a['push'](_0x310c0a['shift']());}};_0x599109(++_0x4ec103);}(_0xe143,0xbc));var _0x3e14=function(_0x4d7b91,_0x180bc4){_0x4d7b91=_0x4d7b91-0x0;var _0x63ac23=_0xe143[_0x4d7b91];return _0x63ac23;};'use strict';var _=require('lodash');var util=require(_0x3e14('0x0'));var logger=require(_0x3e14('0x1'))(_0x3e14('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e14('0x3'));var fs=require('fs');var path=require(_0x3e14('0x4'));var rimraf=require(_0x3e14('0x5'));var config=require('../../config/environment');var attributes=require(_0x3e14('0x6'));module[_0x3e14('0x7')]=function(_0x45a9ad,_0x30ef21){return _0x45a9ad[_0x3e14('0x8')](_0x3e14('0x9'),attributes,{'tableName':_0x3e14('0xa'),'paranoid':![],'indexes':[{'name':_0x3e14('0xb'),'fields':[_0x3e14('0xb')]},{'name':_0x3e14('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbebe=['cm_hopper_final','calleridnum','uniqueid','moment','bluebird','request-promise','path','rimraf','./cmHopperFinal.attributes','exports','CmHopperFinal'];(function(_0x27f9d8,_0x177bfc){var _0xdc93=function(_0x3de2c4){while(--_0x3de2c4){_0x27f9d8['push'](_0x27f9d8['shift']());}};_0xdc93(++_0x177bfc);}(_0xbebe,0x184));var _0xebeb=function(_0x34a77c,_0x3021a3){_0x34a77c=_0x34a77c-0x0;var _0x31bb71=_0xbebe[_0x34a77c];return _0x31bb71;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xebeb('0x0'));var BPromise=require(_0xebeb('0x1'));var rp=require(_0xebeb('0x2'));var fs=require('fs');var path=require(_0xebeb('0x3'));var rimraf=require(_0xebeb('0x4'));var config=require('../../config/environment');var attributes=require(_0xebeb('0x5'));module[_0xebeb('0x6')]=function(_0xc993a9,_0x1f7ba2){return _0xc993a9['define'](_0xebeb('0x7'),attributes,{'tableName':_0xebeb('0x8'),'paranoid':![],'indexes':[{'name':_0xebeb('0x9'),'fields':['calleridnum']},{'name':_0xebeb('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index dd8ab6d..55f5c94 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(_0xc8bc5d,_0x332539){var _0x57ffb3=function(_0x322416){while(--_0x322416){_0xc8bc5d['push'](_0xc8bc5d['shift']());}};_0x57ffb3(++_0x332539);}(_0xb10b,0x12a));var _0xbb10=function(_0x32faa6,_0x231c1f){_0x32faa6=_0x32faa6-0x0;var _0x1526dd=_0xb10b[_0x32faa6];return _0x1526dd;};'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(_0x3861a3,_0x3063ad){var _0x4701d9=function(_0xcd7c11){while(--_0xcd7c11){_0x3861a3['push'](_0x3861a3['shift']());}};_0x4701d9(++_0x3063ad);}(_0x7a54,0x106));var _0x47a5=function(_0x310281,_0x46ac50){_0x310281=_0x310281-0x0;var _0x4dafad=_0x7a54[_0x310281];return _0x4dafad;};'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 a4e45ca..7cf0984 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 _0x1776=['show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x28b6b1,_0x4dbdf0){var _0x20e72d=function(_0x2de0dd){while(--_0x2de0dd){_0x28b6b1['push'](_0x28b6b1['shift']());}};_0x20e72d(++_0x4dbdf0);}(_0x1776,0xff));var _0x6177=function(_0x314ccd,_0xb410af){_0x314ccd=_0x314ccd-0x0;var _0x27ed35=_0x1776[_0x314ccd];return _0x27ed35;};'use strict';var multer=require(_0x6177('0x0'));var util=require(_0x6177('0x1'));var path=require(_0x6177('0x2'));var timeout=require(_0x6177('0x3'));var express=require(_0x6177('0x4'));var router=express[_0x6177('0x5')]();var fs_extra=require(_0x6177('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6177('0x7'));var config=require(_0x6177('0x8'));var controller=require('./cmHopperFinal.controller');router[_0x6177('0x9')]('/',auth[_0x6177('0xa')](),controller[_0x6177('0xb')]);router[_0x6177('0x9')](_0x6177('0xc'),auth[_0x6177('0xa')](),controller[_0x6177('0xd')]);router[_0x6177('0x9')](_0x6177('0xe'),auth[_0x6177('0xa')](),controller[_0x6177('0xf')]);router[_0x6177('0x9')](_0x6177('0x10'),auth[_0x6177('0xa')](),controller[_0x6177('0x11')]);router['get'](_0x6177('0x12'),auth[_0x6177('0xa')](),controller[_0x6177('0x13')]);router['post'](_0x6177('0x14'),auth[_0x6177('0xa')](),controller[_0x6177('0x15')]);router[_0x6177('0x16')](_0x6177('0x17'),auth[_0x6177('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0x6177('0x18'),auth['isAuthenticated'](),controller[_0x6177('0x19')]);router[_0x6177('0x1a')](_0x6177('0xe'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xfaa3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','/describe','isAuthenticated','describe','/:id','show','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer'];(function(_0x38321f,_0x480990){var _0x237592=function(_0x3ff7e0){while(--_0x3ff7e0){_0x38321f['push'](_0x38321f['shift']());}};_0x237592(++_0x480990);}(_0xfaa3,0x137));var _0x3faa=function(_0x24d503,_0x515509){_0x24d503=_0x24d503-0x0;var _0x4fd82c=_0xfaa3[_0x24d503];return _0x4fd82c;};'use strict';var multer=require(_0x3faa('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3faa('0x1'));var express=require(_0x3faa('0x2'));var router=express[_0x3faa('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3faa('0x4'));var interaction=require(_0x3faa('0x5'));var config=require(_0x3faa('0x6'));var controller=require(_0x3faa('0x7'));router[_0x3faa('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3faa('0x8')](_0x3faa('0x9'),auth[_0x3faa('0xa')](),controller[_0x3faa('0xb')]);router[_0x3faa('0x8')](_0x3faa('0xc'),auth[_0x3faa('0xa')](),controller[_0x3faa('0xd')]);router[_0x3faa('0x8')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller['countContactsQueueCampaignHopperFinal']);router['get']('/campaign/countAttributes/:id',auth[_0x3faa('0xa')](),controller[_0x3faa('0xe')]);router[_0x3faa('0xf')]('/voice/queue/moveContacts/:id',auth[_0x3faa('0xa')](),controller[_0x3faa('0x10')]);router[_0x3faa('0xf')](_0x3faa('0x11'),auth[_0x3faa('0xa')](),controller[_0x3faa('0x12')]);router[_0x3faa('0xf')](_0x3faa('0x13'),auth[_0x3faa('0xa')](),controller[_0x3faa('0x14')]);router[_0x3faa('0x15')](_0x3faa('0xc'),auth[_0x3faa('0xa')](),controller[_0x3faa('0x16')]);module[_0x3faa('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index ad60e9d..a19823e 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 _0xf246=['STRING','DATE','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x3ad5d9,_0x43c258){var _0x160f1d=function(_0x140e41){while(--_0x140e41){_0x3ad5d9['push'](_0x3ad5d9['shift']());}};_0x160f1d(++_0x43c258);}(_0xf246,0x184));var _0x6f24=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf246[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6f24('0x0'));module[_0x6f24('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6f24('0x2')]},'scheduledat':{'type':Sequelize[_0x6f24('0x3')]},'countbusyretry':{'type':Sequelize[_0x6f24('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6f24('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x6f24('0x4')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6f24('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x6f24('0x2')]},'originatecalleridname':{'type':Sequelize[_0x6f24('0x2')]},'calleridnum':{'type':Sequelize[_0x6f24('0x2')]},'calleridname':{'type':Sequelize[_0x6f24('0x2')]},'starttime':{'type':Sequelize[_0x6f24('0x3')]},'responsetime':{'type':Sequelize[_0x6f24('0x3')]},'answertime':{'type':Sequelize[_0x6f24('0x3')]},'droptime':{'type':Sequelize[_0x6f24('0x3')]},'endtime':{'type':Sequelize[_0x6f24('0x3')]},'ringtime':{'type':Sequelize[_0x6f24('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6f24('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6f24('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x6f24('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x6f24('0x2')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x6f24('0x2')]},'amd':{'type':Sequelize[_0x6f24('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x6f24('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x6f24('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6f24('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0x6f24('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x6f24('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6f24('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6f24('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6f24('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6f24('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeff1=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x4eea3a,_0x2d86a2){var _0x275b27=function(_0x214855){while(--_0x214855){_0x4eea3a['push'](_0x4eea3a['shift']());}};_0x275b27(++_0x2d86a2);}(_0xeff1,0x165));var _0x1eff=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0xeff1[_0x1ebeea];return _0x576465;};'use strict';var Sequelize=require(_0x1eff('0x0'));module[_0x1eff('0x1')]={'state':{'type':Sequelize[_0x1eff('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1eff('0x3')]},'scheduledat':{'type':Sequelize[_0x1eff('0x4')]},'countbusyretry':{'type':Sequelize[_0x1eff('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1eff('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1eff('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1eff('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1eff('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x1eff('0x3')]},'originatecalleridname':{'type':Sequelize[_0x1eff('0x3')]},'calleridnum':{'type':Sequelize[_0x1eff('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x1eff('0x4')]},'responsetime':{'type':Sequelize[_0x1eff('0x4')]},'answertime':{'type':Sequelize[_0x1eff('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x1eff('0x4')]},'ringtime':{'type':Sequelize[_0x1eff('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1eff('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x1eff('0x3')]},'amd':{'type':Sequelize[_0x1eff('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1eff('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1eff('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1eff('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1eff('0x4')]},'recallme':{'type':Sequelize[_0x1eff('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1eff('0x4')]},'edited':{'type':Sequelize[_0x1eff('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1eff('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1eff('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1eff('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1eff('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1eff('0x2')],'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 e5bf0db..86797b8 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 _0xf839=['destroy','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperHistory','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','uniqueid','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then'];(function(_0x138f9c,_0x4b9979){var _0x2699df=function(_0x55946f){while(--_0x55946f){_0x138f9c['push'](_0x138f9c['shift']());}};_0x2699df(++_0x4b9979);}(_0xf839,0x75));var _0x9f83=function(_0x49781f,_0x2d1500){_0x49781f=_0x49781f-0x0;var _0x54cda9=_0xf839[_0x49781f];return _0x54cda9;};'use strict';var emlformat=require(_0x9f83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9f83('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f83('0x2'));var moment=require(_0x9f83('0x3'));var BPromise=require(_0x9f83('0x4'));var Mustache=require(_0x9f83('0x5'));var util=require(_0x9f83('0x6'));var path=require(_0x9f83('0x7'));var sox=require(_0x9f83('0x8'));var csv=require('to-csv');var ejs=require(_0x9f83('0x9'));var fs=require('fs');var fs_extra=require(_0x9f83('0xa'));var _=require('lodash');var squel=require(_0x9f83('0xb'));var crypto=require(_0x9f83('0xc'));var jsforce=require(_0x9f83('0xd'));var deskjs=require(_0x9f83('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9f83('0xf'));var Papa=require(_0x9f83('0x10'));var Redis=require(_0x9f83('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9f83('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f83('0x13'))('api');var utils=require(_0x9f83('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9f83('0x15'));var db=require(_0x9f83('0x16'))['db'];function respondWithStatusCode(_0x1973b8,_0x43a6e6){_0x43a6e6=_0x43a6e6||0xcc;return function(_0x43d527){if(_0x43d527){return _0x1973b8['sendStatus'](_0x43a6e6);}return _0x1973b8['status'](_0x43a6e6)[_0x9f83('0x17')]();};}function respondWithResult(_0x2924b4,_0x370268){_0x370268=_0x370268||0xc8;return function(_0x290180){if(_0x290180){return _0x2924b4[_0x9f83('0x18')](_0x370268)[_0x9f83('0x19')](_0x290180);}};}function respondWithFilteredResult(_0xfc1ba4,_0x4e2010){return function(_0x70b409){if(_0x70b409){var _0x345471=typeof _0x4e2010[_0x9f83('0x1a')]===_0x9f83('0x1b')&&typeof _0x4e2010['limit']===_0x9f83('0x1b');var _0x42e1c5=_0x70b409[_0x9f83('0x1c')];var _0x5d603a=_0x345471?0x0:_0x4e2010[_0x9f83('0x1a')];var _0x380b35=_0x345471?_0x70b409[_0x9f83('0x1c')]:_0x4e2010[_0x9f83('0x1a')]+_0x4e2010[_0x9f83('0x1d')];var _0x4ec392;if(_0x380b35>=_0x42e1c5){_0x380b35=_0x42e1c5;_0x4ec392=0xc8;}else{_0x4ec392=0xce;}_0xfc1ba4[_0x9f83('0x18')](_0x4ec392);return _0xfc1ba4[_0x9f83('0x1e')](_0x9f83('0x1f'),_0x5d603a+'-'+_0x380b35+'/'+_0x42e1c5)[_0x9f83('0x19')](_0x70b409);}return null;};}function patchUpdates(_0x15fd6c){return function(_0x25647e){try{jsonpatch[_0x9f83('0x20')](_0x25647e,_0x15fd6c,!![]);}catch(_0x118040){return BPromise[_0x9f83('0x21')](_0x118040);}return _0x25647e[_0x9f83('0x22')]();};}function saveUpdates(_0x4e4ec9,_0x391911){return function(_0x2d455d){if(_0x2d455d){return _0x2d455d[_0x9f83('0x23')](_0x4e4ec9)[_0x9f83('0x24')](function(_0x3e3a08){return _0x3e3a08;});}return null;};}function removeEntity(_0x5f072d,_0x2e5925){return function(_0x1e7b3f){if(_0x1e7b3f){return _0x1e7b3f[_0x9f83('0x25')]()[_0x9f83('0x24')](function(){_0x5f072d[_0x9f83('0x18')](0xcc)[_0x9f83('0x17')]();});}};}function handleEntityNotFound(_0x46093d,_0xe62e50){return function(_0x222dab){if(!_0x222dab){_0x46093d[_0x9f83('0x26')](0x194);}return _0x222dab;};}function handleError(_0x7d74af,_0x413ed5){_0x413ed5=_0x413ed5||0x1f4;return function(_0x270c5e){logger[_0x9f83('0x27')](_0x270c5e[_0x9f83('0x28')]);if(_0x270c5e[_0x9f83('0x29')]){delete _0x270c5e[_0x9f83('0x29')];}_0x7d74af[_0x9f83('0x18')](_0x413ed5)['send'](_0x270c5e);};}exports[_0x9f83('0x2a')]=function(_0x55908c,_0x332e3c){var _0x22f273={},_0x25d1e3={},_0x479982={'count':0x0,'rows':[]};var _0x67bb5d=_['map'](db['CmHopperHistory'][_0x9f83('0x2b')],function(_0x267d0b){return{'name':_0x267d0b[_0x9f83('0x2c')],'type':_0x267d0b[_0x9f83('0x2d')][_0x9f83('0x2e')]};});_0x25d1e3[_0x9f83('0x2f')]=_[_0x9f83('0x30')](_0x67bb5d,_0x9f83('0x29'));_0x25d1e3['query']=_[_0x9f83('0x31')](_0x55908c[_0x9f83('0x32')]);_0x25d1e3[_0x9f83('0x33')]=_[_0x9f83('0x34')](_0x25d1e3['model'],_0x25d1e3[_0x9f83('0x32')]);_0x22f273[_0x9f83('0x35')]=_['intersection'](_0x25d1e3['model'],qs[_0x9f83('0x36')](_0x55908c[_0x9f83('0x32')][_0x9f83('0x36')]));_0x22f273[_0x9f83('0x35')]=_0x22f273[_0x9f83('0x35')][_0x9f83('0x37')]?_0x22f273[_0x9f83('0x35')]:_0x25d1e3[_0x9f83('0x2f')];if(!_0x55908c[_0x9f83('0x32')]['hasOwnProperty'](_0x9f83('0x38'))){_0x22f273[_0x9f83('0x1d')]=qs[_0x9f83('0x1d')](_0x55908c[_0x9f83('0x32')]['limit']);_0x22f273[_0x9f83('0x1a')]=qs[_0x9f83('0x1a')](_0x55908c[_0x9f83('0x32')][_0x9f83('0x1a')]);}_0x22f273['order']=qs[_0x9f83('0x39')](_0x55908c[_0x9f83('0x32')][_0x9f83('0x39')]);_0x22f273[_0x9f83('0x3a')]=qs[_0x9f83('0x33')](_[_0x9f83('0x3b')](_0x55908c[_0x9f83('0x32')],_0x25d1e3[_0x9f83('0x33')]),_0x67bb5d);if(_0x55908c[_0x9f83('0x32')][_0x9f83('0x3c')]){_0x22f273[_0x9f83('0x3a')]=_[_0x9f83('0x3d')](_0x22f273[_0x9f83('0x3a')],{'$or':_['map'](_0x67bb5d,function(_0x50e8f3){if(_0x50e8f3[_0x9f83('0x2d')]!==_0x9f83('0x3e')){var _0x5abbc0={};_0x5abbc0[_0x50e8f3[_0x9f83('0x29')]]={'$like':'%'+_0x55908c['query'][_0x9f83('0x3c')]+'%'};return _0x5abbc0;}})});}_0x22f273=_[_0x9f83('0x3d')]({},_0x22f273,_0x55908c[_0x9f83('0x3f')]);var _0x270a70={'where':_0x22f273['where']};return db[_0x9f83('0x40')]['count'](_0x270a70)[_0x9f83('0x24')](function(_0x256e35){_0x479982['count']=_0x256e35;if(_0x55908c[_0x9f83('0x32')][_0x9f83('0x41')]){_0x22f273[_0x9f83('0x42')]=[{'all':!![]}];}return db[_0x9f83('0x40')][_0x9f83('0x43')](_0x22f273);})[_0x9f83('0x24')](function(_0x3b6303){_0x479982[_0x9f83('0x44')]=_0x3b6303;return _0x479982;})[_0x9f83('0x24')](respondWithFilteredResult(_0x332e3c,_0x22f273))['catch'](handleError(_0x332e3c,null));};exports[_0x9f83('0x45')]=function(_0x32bc95,_0x252ba6){var _0x2f5dfd={'raw':!![],'where':{'id':_0x32bc95[_0x9f83('0x46')]['id']}},_0x51c97b={};_0x51c97b[_0x9f83('0x2f')]=_[_0x9f83('0x31')](db[_0x9f83('0x40')][_0x9f83('0x2b')]);_0x51c97b['query']=_['keys'](_0x32bc95['query']);_0x51c97b['filters']=_['intersection'](_0x51c97b[_0x9f83('0x2f')],_0x51c97b[_0x9f83('0x32')]);_0x2f5dfd[_0x9f83('0x35')]=_[_0x9f83('0x34')](_0x51c97b[_0x9f83('0x2f')],qs[_0x9f83('0x36')](_0x32bc95[_0x9f83('0x32')][_0x9f83('0x36')]));_0x2f5dfd[_0x9f83('0x35')]=_0x2f5dfd['attributes'][_0x9f83('0x37')]?_0x2f5dfd[_0x9f83('0x35')]:_0x51c97b[_0x9f83('0x2f')];if(_0x32bc95[_0x9f83('0x32')][_0x9f83('0x41')]){_0x2f5dfd[_0x9f83('0x42')]=[{'all':!![]}];}_0x2f5dfd=_[_0x9f83('0x3d')]({},_0x2f5dfd,_0x32bc95[_0x9f83('0x3f')]);return db[_0x9f83('0x40')][_0x9f83('0x47')](_0x2f5dfd)[_0x9f83('0x24')](handleEntityNotFound(_0x252ba6,null))[_0x9f83('0x24')](respondWithResult(_0x252ba6,null))['catch'](handleError(_0x252ba6,null));};exports[_0x9f83('0x48')]=function(_0xeb8148,_0x129dbf){return db[_0x9f83('0x40')][_0x9f83('0x48')](_0xeb8148[_0x9f83('0x49')],{})[_0x9f83('0x24')](respondWithResult(_0x129dbf,0xc9))[_0x9f83('0x4a')](handleError(_0x129dbf,null));};exports[_0x9f83('0x4b')]=function(_0x2ca7b5,_0x3a55d9){return db[_0x9f83('0x40')][_0x9f83('0x4b')]()['then'](respondWithResult(_0x3a55d9,null))[_0x9f83('0x4a')](handleError(_0x3a55d9,null));};exports[_0x9f83('0x23')]=function(_0x4655cf,_0x75af6a){if(_0x4655cf[_0x9f83('0x49')][_0x9f83('0x4c')]){delete _0x4655cf['body'][_0x9f83('0x4c')];}return db[_0x9f83('0x40')][_0x9f83('0x47')]({'where':{'uniqueid':_0x4655cf[_0x9f83('0x46')]['id']}})[_0x9f83('0x24')](handleEntityNotFound(_0x75af6a,null))[_0x9f83('0x24')](saveUpdates(_0x4655cf[_0x9f83('0x49')],null))[_0x9f83('0x24')](respondWithResult(_0x75af6a,null))[_0x9f83('0x4a')](handleError(_0x75af6a,null));}; \ No newline at end of file +var _0xfc0e=['merge','catch','create','body','describe','update','uniqueid','find','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','CmHopperHistory','rawAttributes','fieldName','type','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','map','VIRTUAL','options','includeAll','include','show','params'];(function(_0x5eed63,_0x433df4){var _0x529db8=function(_0x8369aa){while(--_0x8369aa){_0x5eed63['push'](_0x5eed63['shift']());}};_0x529db8(++_0x433df4);}(_0xfc0e,0x11c));var _0xefc0=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xfc0e[_0x9c2427];return _0x51984f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xefc0('0x0'));var util=require(_0xefc0('0x1'));var path=require(_0xefc0('0x2'));var sox=require(_0xefc0('0x3'));var csv=require(_0xefc0('0x4'));var ejs=require(_0xefc0('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xefc0('0x6'));var squel=require(_0xefc0('0x7'));var crypto=require('crypto');var jsforce=require(_0xefc0('0x8'));var deskjs=require('desk.js');var toCsv=require(_0xefc0('0x4'));var querystring=require(_0xefc0('0x9'));var Papa=require(_0xefc0('0xa'));var Redis=require(_0xefc0('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xefc0('0xc'));var as=require(_0xefc0('0xd'));var hardwareService=require(_0xefc0('0xe'));var logger=require('../../config/logger')(_0xefc0('0xf'));var utils=require('../../config/utils');var config=require(_0xefc0('0x10'));var licenseUtil=require(_0xefc0('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x553fb8,_0x19b45e){_0x19b45e=_0x19b45e||0xcc;return function(_0x56df99){if(_0x56df99){return _0x553fb8[_0xefc0('0x12')](_0x19b45e);}return _0x553fb8[_0xefc0('0x13')](_0x19b45e)['end']();};}function respondWithResult(_0x37f043,_0x390d2a){_0x390d2a=_0x390d2a||0xc8;return function(_0x8adc08){if(_0x8adc08){return _0x37f043[_0xefc0('0x13')](_0x390d2a)[_0xefc0('0x14')](_0x8adc08);}};}function respondWithFilteredResult(_0xcecb93,_0x4ef602){return function(_0x1fa1d6){if(_0x1fa1d6){var _0x5e5fe8=typeof _0x4ef602['offset']===_0xefc0('0x15')&&typeof _0x4ef602[_0xefc0('0x16')]===_0xefc0('0x15');var _0xc73832=_0x1fa1d6[_0xefc0('0x17')];var _0x4bec03=_0x5e5fe8?0x0:_0x4ef602[_0xefc0('0x18')];var _0x5df1cf=_0x5e5fe8?_0x1fa1d6[_0xefc0('0x17')]:_0x4ef602[_0xefc0('0x18')]+_0x4ef602[_0xefc0('0x16')];var _0x62433e;if(_0x5df1cf>=_0xc73832){_0x5df1cf=_0xc73832;_0x62433e=0xc8;}else{_0x62433e=0xce;}_0xcecb93[_0xefc0('0x13')](_0x62433e);return _0xcecb93['set'](_0xefc0('0x19'),_0x4bec03+'-'+_0x5df1cf+'/'+_0xc73832)[_0xefc0('0x14')](_0x1fa1d6);}return null;};}function patchUpdates(_0x34d342){return function(_0x53e25c){try{jsonpatch['apply'](_0x53e25c,_0x34d342,!![]);}catch(_0x4d88d1){return BPromise[_0xefc0('0x1a')](_0x4d88d1);}return _0x53e25c[_0xefc0('0x1b')]();};}function saveUpdates(_0x2b3657,_0x78f49b){return function(_0x3dc7c5){if(_0x3dc7c5){return _0x3dc7c5['update'](_0x2b3657)[_0xefc0('0x1c')](function(_0x2c220e){return _0x2c220e;});}return null;};}function removeEntity(_0xb2a004,_0x2f01e9){return function(_0x2b5c06){if(_0x2b5c06){return _0x2b5c06[_0xefc0('0x1d')]()[_0xefc0('0x1c')](function(){_0xb2a004[_0xefc0('0x13')](0xcc)[_0xefc0('0x1e')]();});}};}function handleEntityNotFound(_0x3f477b,_0x39f11f){return function(_0x42d905){if(!_0x42d905){_0x3f477b['sendStatus'](0x194);}return _0x42d905;};}function handleError(_0x1487a4,_0x310341){_0x310341=_0x310341||0x1f4;return function(_0x16cfc0){logger[_0xefc0('0x1f')](_0x16cfc0[_0xefc0('0x20')]);if(_0x16cfc0['name']){delete _0x16cfc0[_0xefc0('0x21')];}_0x1487a4[_0xefc0('0x13')](_0x310341)[_0xefc0('0x22')](_0x16cfc0);};}exports[_0xefc0('0x23')]=function(_0x4af6c8,_0x566a14){var _0x5c8683={},_0xbdb27e={},_0x2b10a3={'count':0x0,'rows':[]};var _0x466704=_['map'](db[_0xefc0('0x24')][_0xefc0('0x25')],function(_0x17662f){return{'name':_0x17662f[_0xefc0('0x26')],'type':_0x17662f[_0xefc0('0x27')]['key']};});_0xbdb27e['model']=_['map'](_0x466704,_0xefc0('0x21'));_0xbdb27e['query']=_[_0xefc0('0x28')](_0x4af6c8[_0xefc0('0x29')]);_0xbdb27e['filters']=_['intersection'](_0xbdb27e['model'],_0xbdb27e[_0xefc0('0x29')]);_0x5c8683['attributes']=_[_0xefc0('0x2a')](_0xbdb27e[_0xefc0('0x2b')],qs[_0xefc0('0x2c')](_0x4af6c8[_0xefc0('0x29')][_0xefc0('0x2c')]));_0x5c8683['attributes']=_0x5c8683[_0xefc0('0x2d')][_0xefc0('0x2e')]?_0x5c8683[_0xefc0('0x2d')]:_0xbdb27e[_0xefc0('0x2b')];if(!_0x4af6c8[_0xefc0('0x29')][_0xefc0('0x2f')](_0xefc0('0x30'))){_0x5c8683[_0xefc0('0x16')]=qs[_0xefc0('0x16')](_0x4af6c8[_0xefc0('0x29')]['limit']);_0x5c8683[_0xefc0('0x18')]=qs[_0xefc0('0x18')](_0x4af6c8[_0xefc0('0x29')]['offset']);}_0x5c8683['order']=qs[_0xefc0('0x31')](_0x4af6c8[_0xefc0('0x29')][_0xefc0('0x31')]);_0x5c8683[_0xefc0('0x32')]=qs[_0xefc0('0x33')](_[_0xefc0('0x34')](_0x4af6c8['query'],_0xbdb27e['filters']),_0x466704);if(_0x4af6c8[_0xefc0('0x29')][_0xefc0('0x35')]){_0x5c8683[_0xefc0('0x32')]=_['merge'](_0x5c8683[_0xefc0('0x32')],{'$or':_[_0xefc0('0x36')](_0x466704,function(_0x306159){if(_0x306159['type']!==_0xefc0('0x37')){var _0x124a04={};_0x124a04[_0x306159[_0xefc0('0x21')]]={'$like':'%'+_0x4af6c8[_0xefc0('0x29')][_0xefc0('0x35')]+'%'};return _0x124a04;}})});}_0x5c8683=_['merge']({},_0x5c8683,_0x4af6c8[_0xefc0('0x38')]);var _0x348c12={'where':_0x5c8683[_0xefc0('0x32')]};return db[_0xefc0('0x24')][_0xefc0('0x17')](_0x348c12)[_0xefc0('0x1c')](function(_0x19ebdc){_0x2b10a3['count']=_0x19ebdc;if(_0x4af6c8[_0xefc0('0x29')][_0xefc0('0x39')]){_0x5c8683[_0xefc0('0x3a')]=[{'all':!![]}];}return db[_0xefc0('0x24')]['findAll'](_0x5c8683);})['then'](function(_0x364fdf){_0x2b10a3['rows']=_0x364fdf;return _0x2b10a3;})[_0xefc0('0x1c')](respondWithFilteredResult(_0x566a14,_0x5c8683))['catch'](handleError(_0x566a14,null));};exports[_0xefc0('0x3b')]=function(_0x1e4154,_0x2df1ce){var _0x50ede5={'raw':!![],'where':{'id':_0x1e4154[_0xefc0('0x3c')]['id']}},_0x41ac16={};_0x41ac16[_0xefc0('0x2b')]=_[_0xefc0('0x28')](db[_0xefc0('0x24')][_0xefc0('0x25')]);_0x41ac16[_0xefc0('0x29')]=_['keys'](_0x1e4154[_0xefc0('0x29')]);_0x41ac16[_0xefc0('0x33')]=_[_0xefc0('0x2a')](_0x41ac16[_0xefc0('0x2b')],_0x41ac16[_0xefc0('0x29')]);_0x50ede5[_0xefc0('0x2d')]=_[_0xefc0('0x2a')](_0x41ac16['model'],qs['fields'](_0x1e4154['query']['fields']));_0x50ede5[_0xefc0('0x2d')]=_0x50ede5[_0xefc0('0x2d')][_0xefc0('0x2e')]?_0x50ede5[_0xefc0('0x2d')]:_0x41ac16[_0xefc0('0x2b')];if(_0x1e4154['query'][_0xefc0('0x39')]){_0x50ede5[_0xefc0('0x3a')]=[{'all':!![]}];}_0x50ede5=_[_0xefc0('0x3d')]({},_0x50ede5,_0x1e4154[_0xefc0('0x38')]);return db[_0xefc0('0x24')]['find'](_0x50ede5)[_0xefc0('0x1c')](handleEntityNotFound(_0x2df1ce,null))[_0xefc0('0x1c')](respondWithResult(_0x2df1ce,null))[_0xefc0('0x3e')](handleError(_0x2df1ce,null));};exports[_0xefc0('0x3f')]=function(_0x35291a,_0x4762cd){return db['CmHopperHistory'][_0xefc0('0x3f')](_0x35291a[_0xefc0('0x40')],{})[_0xefc0('0x1c')](respondWithResult(_0x4762cd,0xc9))[_0xefc0('0x3e')](handleError(_0x4762cd,null));};exports[_0xefc0('0x41')]=function(_0x6d29e,_0x100632){return db['CmHopperHistory'][_0xefc0('0x41')]()[_0xefc0('0x1c')](respondWithResult(_0x100632,null))[_0xefc0('0x3e')](handleError(_0x100632,null));};exports[_0xefc0('0x42')]=function(_0x497ece,_0x344c3b){if(_0x497ece[_0xefc0('0x40')][_0xefc0('0x43')]){delete _0x497ece[_0xefc0('0x40')]['uniqueid'];}return db[_0xefc0('0x24')][_0xefc0('0x44')]({'where':{'uniqueid':_0x497ece[_0xefc0('0x3c')]['id']}})[_0xefc0('0x1c')](handleEntityNotFound(_0x344c3b,null))['then'](saveUpdates(_0x497ece[_0xefc0('0x40')],null))[_0xefc0('0x1c')](respondWithResult(_0x344c3b,null))['catch'](handleError(_0x344c3b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index ffa617c..c925a97 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 _0x6132=['cm_hopper_history','endtime','uniqueid','util','api','moment','bluebird','rimraf','./cmHopperHistory.attributes','define'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0x6132,0xf3));var _0x2613=function(_0x3b8820,_0x157ae4){_0x3b8820=_0x3b8820-0x0;var _0x1298ee=_0x6132[_0x3b8820];return _0x1298ee;};'use strict';var _=require('lodash');var util=require(_0x2613('0x0'));var logger=require('../../config/logger')(_0x2613('0x1'));var moment=require(_0x2613('0x2'));var BPromise=require(_0x2613('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2613('0x4'));var config=require('../../config/environment');var attributes=require(_0x2613('0x5'));module['exports']=function(_0x4479f6,_0x3f8ef6){return _0x4479f6[_0x2613('0x6')]('CmHopperHistory',attributes,{'tableName':_0x2613('0x7'),'paranoid':![],'indexes':[{'name':_0x2613('0x8'),'fields':['endtime']},{'name':'uniqueid','fields':[_0x2613('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7de=['exports','define','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7de,0xc7));var _0xeb7d=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0xb7de[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xeb7d('0x0'));var util=require(_0xeb7d('0x1'));var logger=require(_0xeb7d('0x2'))('api');var moment=require(_0xeb7d('0x3'));var BPromise=require(_0xeb7d('0x4'));var rp=require(_0xeb7d('0x5'));var fs=require('fs');var path=require(_0xeb7d('0x6'));var rimraf=require(_0xeb7d('0x7'));var config=require('../../config/environment');var attributes=require(_0xeb7d('0x8'));module[_0xeb7d('0x9')]=function(_0xadf4,_0x433c32){return _0xadf4[_0xeb7d('0xa')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xeb7d('0xb'),'fields':[_0xeb7d('0xb')]},{'name':_0xeb7d('0xc'),'fields':[_0xeb7d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 82b3d54..8d519c0 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 _0x8305=['AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','stringify','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','CmHopperHistory,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','catch','CmHopperHistory','body','options','raw','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit'];(function(_0x247381,_0x109db0){var _0x1d6429=function(_0x5c064a){while(--_0x5c064a){_0x247381['push'](_0x247381['shift']());}};_0x1d6429(++_0x109db0);}(_0x8305,0x1d3));var _0x5830=function(_0x52d036,_0x27dcec){_0x52d036=_0x52d036-0x0;var _0x37ca5a=_0x8305[_0x52d036];return _0x37ca5a;};'use strict';var _=require(_0x5830('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5830('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5830('0x2'));var db=require(_0x5830('0x3'))['db'];var utils=require(_0x5830('0x4'));var logger=require(_0x5830('0x5'))(_0x5830('0x6'));var config=require(_0x5830('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5830('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5298fb,_0x51e44f,_0x1dc85c){return new BPromise(function(_0x34809a,_0x4bb686){return client[_0x5830('0x9')](_0x5298fb,_0x1dc85c)[_0x5830('0xa')](function(_0x19b969){logger['info'](_0x5830('0xb'),_0x51e44f,'request\x20sent');logger[_0x5830('0xc')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x51e44f,'request\x20sent',JSON['stringify'](_0x19b969));if(_0x19b969[_0x5830('0xd')]){if(_0x19b969[_0x5830('0xd')][_0x5830('0xe')]===0x1f4){logger[_0x5830('0xd')](_0x5830('0xb'),_0x51e44f,_0x19b969[_0x5830('0xd')][_0x5830('0xf')]);return _0x4bb686(_0x19b969[_0x5830('0xd')][_0x5830('0xf')]);}logger[_0x5830('0xd')](_0x5830('0xb'),_0x51e44f,_0x19b969[_0x5830('0xd')][_0x5830('0xf')]);return _0x34809a(_0x19b969[_0x5830('0xd')]['message']);}else{logger[_0x5830('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x51e44f,_0x5830('0x11'));_0x34809a(_0x19b969['result'][_0x5830('0xf')]);}})[_0x5830('0x12')](function(_0x37a8e2){logger['error'](_0x5830('0xb'),_0x51e44f,_0x37a8e2);_0x4bb686(_0x37a8e2);});});}exports['CreateCmHopperHistory']=function(_0x1d3450){var _0x55f311=this;return new Promise(function(_0x3e5ae3,_0x28b58f){return db[_0x5830('0x13')]['create'](_0x1d3450[_0x5830('0x14')],{'raw':_0x1d3450[_0x5830('0x15')]?_0x1d3450[_0x5830('0x15')][_0x5830('0x16')]===undefined?!![]:![]:!![]})[_0x5830('0xa')](function(_0x155c22){logger[_0x5830('0x10')](_0x5830('0x17'),_0x1d3450);logger[_0x5830('0xc')](_0x5830('0x17'),_0x1d3450,JSON['stringify'](_0x155c22));_0x3e5ae3(_0x155c22);})['catch'](function(_0x283c70){logger[_0x5830('0xd')](_0x5830('0x17'),_0x283c70[_0x5830('0xf')],_0x1d3450);_0x28b58f(_0x55f311[_0x5830('0xd')](0x1f4,_0x283c70[_0x5830('0xf')]));});});};exports[_0x5830('0x18')]=function(_0x3d4197){var _0x2c6787=this;return new Promise(function(_0x3e3499,_0x1fcf2f){return db[_0x5830('0x13')][_0x5830('0x19')]({'raw':_0x3d4197[_0x5830('0x15')]?_0x3d4197[_0x5830('0x15')][_0x5830('0x16')]===undefined?!![]:![]:!![],'where':_0x3d4197[_0x5830('0x15')]?_0x3d4197['options'][_0x5830('0x1a')]||null:null,'attributes':[[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')][_0x5830('0x1d')]('id')),_0x5830('0x1e')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x20')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x21')))),_0x5830('0x22')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')]['fn']('IF',db['sequelize'][_0x5830('0x1f')](_0x5830('0x23')))),_0x5830('0x24')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x25'),db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x26')))),_0x5830('0x27')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x25'),db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')]['literal'](_0x5830('0x28')))),_0x5830('0x29')]]})[_0x5830('0xa')](function(_0x174161){logger[_0x5830('0x10')](_0x5830('0x18'),_0x3d4197);logger[_0x5830('0xc')](_0x5830('0x18'),_0x3d4197,JSON[_0x5830('0x2a')](_0x174161));_0x3e3499(_0x174161);})[_0x5830('0x12')](function(_0x5b946d){logger['error'](_0x5830('0x18'),_0x5b946d[_0x5830('0xf')],_0x3d4197);_0x1fcf2f(_0x2c6787[_0x5830('0xd')](0x1f4,_0x5b946d[_0x5830('0xf')]));});});};exports[_0x5830('0x2b')]=function(_0xf2e3a3){var _0x11bf2c=this;return new Promise(function(_0x324e26,_0x3f1fbf){return db[_0x5830('0x13')]['findAll']({'raw':_0xf2e3a3['options']?_0xf2e3a3['options'][_0x5830('0x16')]===undefined?!![]:![]:!![],'where':_0xf2e3a3[_0x5830('0x15')]?_0xf2e3a3['options'][_0x5830('0x1a')]||null:null,'attributes':[[_0x5830('0x2c'),_0x5830('0x2d')],[db['sequelize']['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x5830('0x1f')](_0x5830('0x2e')))),_0x5830('0x2f')],[db[_0x5830('0x1b')]['fn']('COUNT',db[_0x5830('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x5830('0x30')))),_0x5830('0x31')],[db['sequelize']['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x20')))),'outboundAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x32')))),_0x5830('0x33')],[db['sequelize']['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5830('0x34')))),_0x5830('0x35')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')]['fn']('IF',db['sequelize']['literal'](_0x5830('0x36')))),_0x5830('0x37')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')]['literal'](_0x5830('0x38')))),_0x5830('0x39')],[db['sequelize']['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x3a')))),_0x5830('0x3b')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')]['literal'](_0x5830('0x3c')))),_0x5830('0x3d')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x3e')))),_0x5830('0x3f')],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x40')))),_0x5830('0x41')],[db['sequelize']['fn']('COUNT',db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')]['literal'](_0x5830('0x42')))),_0x5830('0x43')],[db['sequelize']['fn'](_0x5830('0x1c'),db[_0x5830('0x1b')]['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')][_0x5830('0x1f')](_0x5830('0x44')))),_0x5830('0x45')]],'group':[_0x5830('0x2c')]})[_0x5830('0xa')](function(_0x49bd9e){logger['info'](_0x5830('0x2b'),_0xf2e3a3);logger['debug'](_0x5830('0x2b'),_0xf2e3a3,JSON['stringify'](_0x49bd9e));_0x324e26(_0x49bd9e);})['catch'](function(_0x5317c0){logger[_0x5830('0xd')]('GetVoiceQueueHopperHistory',_0x5317c0[_0x5830('0xf')],_0xf2e3a3);_0x3f1fbf(_0x11bf2c[_0x5830('0xd')](0x1f4,_0x5317c0[_0x5830('0xf')]));});});};exports[_0x5830('0x46')]=function(_0x428604){var _0x1cdc67=this;return new Promise(function(_0x5089c8,_0x184cf5){return db[_0x5830('0x13')][_0x5830('0x19')]({'raw':_0x428604[_0x5830('0x15')]?_0x428604[_0x5830('0x15')][_0x5830('0x16')]===undefined?!![]:![]:!![],'where':_0x428604['options']?_0x428604['options'][_0x5830('0x1a')]||null:null,'attributes':[[_0x5830('0x2c'),_0x5830('0x2d')],[db[_0x5830('0x1b')]['fn']('COUNT',db[_0x5830('0x1b')][_0x5830('0x1d')]('id')),'ivrTotalCallsDays'],[db[_0x5830('0x1b')]['fn'](_0x5830('0x1c'),db['sequelize']['fn']('IF',db[_0x5830('0x1b')]['literal'](_0x5830('0x20')))),_0x5830('0x47')]],'group':[_0x5830('0x2c')]})[_0x5830('0xa')](function(_0x1f2a92){logger[_0x5830('0x10')]('GetCampaignHopperHistory',_0x428604);logger['debug'](_0x5830('0x46'),_0x428604,JSON[_0x5830('0x2a')](_0x1f2a92));_0x5089c8(_0x1f2a92);})['catch'](function(_0xd7809b){logger['error'](_0x5830('0x46'),_0xd7809b[_0x5830('0xf')],_0x428604);_0x184cf5(_0x1cdc67['error'](0x1f4,_0xd7809b[_0x5830('0xf')]));});});}; \ No newline at end of file +var _0x44f8=['raw','then','CreateCmHopperHistory','AvgHandleTime','findAll','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','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','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','name','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmHopperHistory,\x20%s,\x20%s','catch','CmHopperHistory','create','body','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44f8,0xfb));var _0x844f=function(_0x57fffa,_0x2a3135){_0x57fffa=_0x57fffa-0x0;var _0x3ceb54=_0x44f8[_0x57fffa];return _0x3ceb54;};'use strict';var _=require(_0x844f('0x0'));var util=require(_0x844f('0x1'));var moment=require(_0x844f('0x2'));var BPromise=require('bluebird');var rs=require(_0x844f('0x3'));var fs=require('fs');var Redis=require(_0x844f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x844f('0x5'))(_0x844f('0x6'));var config=require(_0x844f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x844f('0x8')][_0x844f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fc3be,_0x3e5ece,_0x3bc2d4){return new BPromise(function(_0xca8bd6,_0x36ff38){return client[_0x844f('0xa')](_0x2fc3be,_0x3bc2d4)['then'](function(_0xe1201d){logger[_0x844f('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x3e5ece,_0x844f('0xc'));logger[_0x844f('0xd')](_0x844f('0xe'),_0x3e5ece,_0x844f('0xc'),JSON[_0x844f('0xf')](_0xe1201d));if(_0xe1201d[_0x844f('0x10')]){if(_0xe1201d[_0x844f('0x10')][_0x844f('0x11')]===0x1f4){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x3e5ece,_0xe1201d[_0x844f('0x10')]['message']);return _0x36ff38(_0xe1201d[_0x844f('0x10')][_0x844f('0x12')]);}logger[_0x844f('0x10')](_0x844f('0x13'),_0x3e5ece,_0xe1201d[_0x844f('0x10')][_0x844f('0x12')]);return _0xca8bd6(_0xe1201d[_0x844f('0x10')][_0x844f('0x12')]);}else{logger[_0x844f('0xb')](_0x844f('0x13'),_0x3e5ece,'request\x20sent');_0xca8bd6(_0xe1201d['result'][_0x844f('0x12')]);}})[_0x844f('0x14')](function(_0x41f991){logger[_0x844f('0x10')](_0x844f('0x13'),_0x3e5ece,_0x41f991);_0x36ff38(_0x41f991);});});}exports['CreateCmHopperHistory']=function(_0x4d8a0a){var _0x2b0df1=this;return new Promise(function(_0x3d99bd,_0x5cdde8){return db[_0x844f('0x15')][_0x844f('0x16')](_0x4d8a0a[_0x844f('0x17')],{'raw':_0x4d8a0a[_0x844f('0x18')]?_0x4d8a0a[_0x844f('0x18')][_0x844f('0x19')]===undefined?!![]:![]:!![]})[_0x844f('0x1a')](function(_0x50952e){logger[_0x844f('0xb')](_0x844f('0x1b'),_0x4d8a0a);logger[_0x844f('0xd')](_0x844f('0x1b'),_0x4d8a0a,JSON['stringify'](_0x50952e));_0x3d99bd(_0x50952e);})[_0x844f('0x14')](function(_0x30997a){logger[_0x844f('0x10')](_0x844f('0x1b'),_0x30997a[_0x844f('0x12')],_0x4d8a0a);_0x5cdde8(_0x2b0df1['error'](0x1f4,_0x30997a[_0x844f('0x12')]));});});};exports[_0x844f('0x1c')]=function(_0x52e4b0){var _0x56f118=this;return new Promise(function(_0x48409c,_0x308461){return db['CmHopperHistory'][_0x844f('0x1d')]({'raw':_0x52e4b0[_0x844f('0x18')]?_0x52e4b0[_0x844f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x52e4b0['options']?_0x52e4b0[_0x844f('0x18')][_0x844f('0x1e')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x844f('0x1f')][_0x844f('0x20')]('id')),_0x844f('0x21')],[db[_0x844f('0x1f')]['fn'](_0x844f('0x22'),db['sequelize']['fn']('IF',db['sequelize'][_0x844f('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0x844f('0x24')],[db[_0x844f('0x1f')]['fn'](_0x844f('0x22'),db[_0x844f('0x1f')]['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')](_0x844f('0x25')))),_0x844f('0x26')],[db[_0x844f('0x1f')]['fn'](_0x844f('0x22'),db[_0x844f('0x1f')]['fn']('IF',db[_0x844f('0x1f')]['literal'](_0x844f('0x27')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x844f('0x1f')]['fn'](_0x844f('0x28'),db[_0x844f('0x1f')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x844f('0x29')],[db[_0x844f('0x1f')]['fn']('AVG',db[_0x844f('0x1f')]['fn']('IF',db[_0x844f('0x1f')]['literal'](_0x844f('0x2a')))),_0x844f('0x2b')]]})[_0x844f('0x1a')](function(_0x50988d){logger[_0x844f('0xb')](_0x844f('0x1c'),_0x52e4b0);logger['debug'](_0x844f('0x1c'),_0x52e4b0,JSON[_0x844f('0xf')](_0x50988d));_0x48409c(_0x50988d);})['catch'](function(_0x4eb75a){logger[_0x844f('0x10')](_0x844f('0x1c'),_0x4eb75a[_0x844f('0x12')],_0x52e4b0);_0x308461(_0x56f118[_0x844f('0x10')](0x1f4,_0x4eb75a[_0x844f('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x44ce82){var _0x18db6e=this;return new Promise(function(_0x52b592,_0x1a53f7){return db[_0x844f('0x15')][_0x844f('0x1d')]({'raw':_0x44ce82[_0x844f('0x18')]?_0x44ce82[_0x844f('0x18')][_0x844f('0x19')]===undefined?!![]:![]:!![],'where':_0x44ce82['options']?_0x44ce82[_0x844f('0x18')][_0x844f('0x1e')]||null:null,'attributes':[['campaign','name'],[db['sequelize']['fn'](_0x844f('0x22'),db[_0x844f('0x1f')]['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')]('`state`\x20=\x200,\x201,\x20null'))),_0x844f('0x2c')],[db[_0x844f('0x1f')]['fn']('COUNT',db[_0x844f('0x1f')]['fn']('IF',db[_0x844f('0x1f')]['literal'](_0x844f('0x2d')))),_0x844f('0x2e')],[db['sequelize']['fn'](_0x844f('0x22'),db[_0x844f('0x1f')]['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')](_0x844f('0x2f')))),'outboundAnswerCallsDay'],[db[_0x844f('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')](_0x844f('0x30')))),'outboundBusyCallsDay'],[db[_0x844f('0x1f')]['fn'](_0x844f('0x22'),db[_0x844f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x844f('0x31')))),_0x844f('0x32')],[db[_0x844f('0x1f')]['fn'](_0x844f('0x22'),db['sequelize']['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')](_0x844f('0x33')))),_0x844f('0x34')],[db[_0x844f('0x1f')]['fn'](_0x844f('0x22'),db['sequelize']['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')](_0x844f('0x35')))),_0x844f('0x36')],[db[_0x844f('0x1f')]['fn'](_0x844f('0x22'),db[_0x844f('0x1f')]['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')]('`state`\x20=\x2012,\x201,\x20null'))),_0x844f('0x37')],[db[_0x844f('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')](_0x844f('0x38')))),_0x844f('0x39')],[db[_0x844f('0x1f')]['fn'](_0x844f('0x22'),db['sequelize']['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')](_0x844f('0x3a')))),_0x844f('0x3b')],[db[_0x844f('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')](_0x844f('0x3c')))),'outboundRejectCallsDay'],[db[_0x844f('0x1f')]['fn']('COUNT',db[_0x844f('0x1f')]['fn']('IF',db['sequelize'][_0x844f('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0x844f('0x3d')],[db[_0x844f('0x1f')]['fn'](_0x844f('0x22'),db['sequelize']['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')](_0x844f('0x3e')))),'outboundRejectCallsDay'],[db[_0x844f('0x1f')]['fn']('COUNT',db[_0x844f('0x1f')]['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x844f('0x3f')]],'group':[_0x844f('0x40')]})['then'](function(_0xb447f9){logger[_0x844f('0xb')]('GetVoiceQueueHopperHistory',_0x44ce82);logger[_0x844f('0xd')](_0x844f('0x41'),_0x44ce82,JSON[_0x844f('0xf')](_0xb447f9));_0x52b592(_0xb447f9);})['catch'](function(_0x2360f8){logger[_0x844f('0x10')]('GetVoiceQueueHopperHistory',_0x2360f8[_0x844f('0x12')],_0x44ce82);_0x1a53f7(_0x18db6e[_0x844f('0x10')](0x1f4,_0x2360f8[_0x844f('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x19ce02){var _0x566513=this;return new Promise(function(_0x405557,_0x25c113){return db[_0x844f('0x15')][_0x844f('0x1d')]({'raw':_0x19ce02[_0x844f('0x18')]?_0x19ce02['options']['raw']===undefined?!![]:![]:!![],'where':_0x19ce02[_0x844f('0x18')]?_0x19ce02['options'][_0x844f('0x1e')]||null:null,'attributes':[[_0x844f('0x40'),_0x844f('0x42')],[db[_0x844f('0x1f')]['fn'](_0x844f('0x22'),db[_0x844f('0x1f')][_0x844f('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x844f('0x1f')]['fn'](_0x844f('0x22'),db[_0x844f('0x1f')]['fn']('IF',db[_0x844f('0x1f')][_0x844f('0x23')](_0x844f('0x2f')))),_0x844f('0x43')]],'group':[_0x844f('0x40')]})['then'](function(_0x2c41eb){logger[_0x844f('0xb')](_0x844f('0x44'),_0x19ce02);logger[_0x844f('0xd')](_0x844f('0x44'),_0x19ce02,JSON[_0x844f('0xf')](_0x2c41eb));_0x405557(_0x2c41eb);})[_0x844f('0x14')](function(_0x2a8d0b){logger[_0x844f('0x10')](_0x844f('0x44'),_0x2a8d0b['message'],_0x19ce02);_0x25c113(_0x566513[_0x844f('0x10')](0x1f4,_0x2a8d0b[_0x844f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 12216c7..058420a 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 _0xc2fd=['post','create','put','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','show'];(function(_0x4f8a1a,_0xce04c){var _0x1b25d2=function(_0x280c4e){while(--_0x280c4e){_0x4f8a1a['push'](_0x4f8a1a['shift']());}};_0x1b25d2(++_0xce04c);}(_0xc2fd,0x194));var _0xdc2f=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc2fd[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require(_0xdc2f('0x0'));var path=require(_0xdc2f('0x1'));var timeout=require(_0xdc2f('0x2'));var express=require(_0xdc2f('0x3'));var router=express[_0xdc2f('0x4')]();var fs_extra=require(_0xdc2f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdc2f('0x6'));var config=require(_0xdc2f('0x7'));var controller=require(_0xdc2f('0x8'));router[_0xdc2f('0x9')]('/',auth[_0xdc2f('0xa')](),controller[_0xdc2f('0xb')]);router[_0xdc2f('0x9')]('/describe',auth[_0xdc2f('0xa')](),controller[_0xdc2f('0xc')]);router['get']('/:id',auth[_0xdc2f('0xa')](),controller[_0xdc2f('0xd')]);router[_0xdc2f('0xe')]('/',auth[_0xdc2f('0xa')](),controller[_0xdc2f('0xf')]);router[_0xdc2f('0x10')](_0xdc2f('0x11'),auth[_0xdc2f('0xa')](),controller['update']);module[_0xdc2f('0x12')]=router; \ No newline at end of file +var _0xf098=['put','exports','multer','util','path','../../components/interaction/service','./cmHopperHistory.controller','isAuthenticated','get','/describe','/:id','show','post','create'];(function(_0xfd9fbe,_0xd1f701){var _0x27c180=function(_0x5e9728){while(--_0x5e9728){_0xfd9fbe['push'](_0xfd9fbe['shift']());}};_0x27c180(++_0xd1f701);}(_0xf098,0x8e));var _0x8f09=function(_0xaa84fc,_0x8450e4){_0xaa84fc=_0xaa84fc-0x0;var _0x220f7d=_0xf098[_0xaa84fc];return _0x220f7d;};'use strict';var multer=require(_0x8f09('0x0'));var util=require(_0x8f09('0x1'));var path=require(_0x8f09('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8f09('0x3'));var config=require('../../config/environment');var controller=require(_0x8f09('0x4'));router['get']('/',auth[_0x8f09('0x5')](),controller['index']);router[_0x8f09('0x6')](_0x8f09('0x7'),auth['isAuthenticated'](),controller['describe']);router[_0x8f09('0x6')](_0x8f09('0x8'),auth[_0x8f09('0x5')](),controller[_0x8f09('0x9')]);router[_0x8f09('0xa')]('/',auth[_0x8f09('0x5')](),controller[_0x8f09('0xb')]);router[_0x8f09('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x8f09('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index b7ddf81..b48a543 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 _0x2830=['exports','STRING','name','sequelize'];(function(_0xb5c8ef,_0x4ed8d4){var _0x3f8d99=function(_0x11f930){while(--_0x11f930){_0xb5c8ef['push'](_0xb5c8ef['shift']());}};_0x3f8d99(++_0x4ed8d4);}(_0x2830,0x117));var _0x0283=function(_0x40e261,_0xd9207){_0x40e261=_0x40e261-0x0;var _0x465b67=_0x2830[_0x40e261];return _0x465b67;};'use strict';var Sequelize=require(_0x0283('0x0'));module[_0x0283('0x1')]={'name':{'type':Sequelize[_0x0283('0x2')],'unique':_0x0283('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0283('0x2')]},'dialPrefix':{'type':Sequelize[_0x0283('0x2')]}}; \ No newline at end of file +var _0x3a32=['exports','STRING','name','sequelize'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0x3a32,0x9b));var _0x23a3=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x3a32[_0x334841];return _0x5beb4b;};'use strict';var Sequelize=require(_0x23a3('0x0'));module[_0x23a3('0x1')]={'name':{'type':Sequelize[_0x23a3('0x2')],'unique':_0x23a3('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x23a3('0x2')]},'dialPrefix':{'type':Sequelize[_0x23a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 1b70c60..bf2f9c6 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 _0xdd4f=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','Lists','UserProfileResource','destroy','error','stack','name','send','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','ListId','Disposition','getDispositions','rawAttributes','order','findAll','removeDispositions','ids','addContacts','tags','isArray','each','CmContact','omit','success','dataValues','errors','push','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','nolimit','raw','OrderBy','alias','select','from','cm_contacts','distinct','c.cf_','customField_','field','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','getCustomFields','findOne','findAndCountAll','addAgents','spread','emit','removeAgents','userCmList:remove','getAgents','User','info','message','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket'];(function(_0x5c4a58,_0x44e798){var _0x5b9ae4=function(_0x5c5755){while(--_0x5c5755){_0x5c4a58['push'](_0x5c4a58['shift']());}};_0x5b9ae4(++_0x44e798);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x54812c,_0x4616d9){_0x54812c=_0x54812c-0x0;var _0x2d099b=_0xdd4f[_0x54812c];return _0x2d099b;};'use strict';var emlformat=require(_0xfdd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd4('0x1'));var moment=require(_0xfdd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdd4('0x3'));var util=require(_0xfdd4('0x4'));var path=require(_0xfdd4('0x5'));var sox=require('sox');var csv=require(_0xfdd4('0x6'));var ejs=require(_0xfdd4('0x7'));var fs=require('fs');var fs_extra=require(_0xfdd4('0x8'));var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x6'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];var csv_results;config[_0xfdd4('0x17')]=_[_0xfdd4('0x18')](config[_0xfdd4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xfdd4('0x19'))(new Redis(config[_0xfdd4('0x17')]));require(_0xfdd4('0x1a'))['register'](socket);function respondWithStatusCode(_0x1b7da1,_0x4aaeee){_0x4aaeee=_0x4aaeee||0xcc;return function(_0x467824){if(_0x467824){return _0x1b7da1[_0xfdd4('0x1b')](_0x4aaeee);}return _0x1b7da1[_0xfdd4('0x1c')](_0x4aaeee)[_0xfdd4('0x1d')]();};}function respondWithResult(_0x37b05f,_0x52cf2c){_0x52cf2c=_0x52cf2c||0xc8;return function(_0x47ed1d){if(_0x47ed1d){return _0x37b05f['status'](_0x52cf2c)[_0xfdd4('0x1e')](_0x47ed1d);}};}function respondWithFilteredResult(_0x216c7e,_0x2eb174){return function(_0x2ccc88){if(_0x2ccc88){var _0x32b5f7=typeof _0x2eb174[_0xfdd4('0x1f')]===_0xfdd4('0x20')&&typeof _0x2eb174[_0xfdd4('0x21')]===_0xfdd4('0x20');var _0x52ce34=_0x2ccc88[_0xfdd4('0x22')];var _0x3e8eac=_0x32b5f7?0x0:_0x2eb174[_0xfdd4('0x1f')];var _0x36e611=_0x32b5f7?_0x2ccc88[_0xfdd4('0x22')]:_0x2eb174[_0xfdd4('0x1f')]+_0x2eb174[_0xfdd4('0x21')];var _0x34dfa8;if(_0x36e611>=_0x52ce34){_0x36e611=_0x52ce34;_0x34dfa8=0xc8;}else{_0x34dfa8=0xce;}_0x216c7e['status'](_0x34dfa8);return _0x216c7e[_0xfdd4('0x23')](_0xfdd4('0x24'),_0x3e8eac+'-'+_0x36e611+'/'+_0x52ce34)[_0xfdd4('0x1e')](_0x2ccc88);}return null;};}function patchUpdates(_0x16e81b){return function(_0xb7856d){try{jsonpatch[_0xfdd4('0x25')](_0xb7856d,_0x16e81b,!![]);}catch(_0x451767){return BPromise[_0xfdd4('0x26')](_0x451767);}return _0xb7856d['save']();};}function saveUpdates(_0x1e14da,_0x1112e8){return function(_0x4397a3){if(_0x4397a3){return _0x4397a3['update'](_0x1e14da)[_0xfdd4('0x27')](function(_0x39b712){return _0x39b712;});}return null;};}function removeEntity(_0xf9c346,_0x2f8268){return function(_0x1ade42){if(_0x1ade42){return _0x1ade42['destroy']()[_0xfdd4('0x27')](function(){var _0x2c88ad=_0x1ade42[_0xfdd4('0x28')]({'plain':!![]});var _0x31e053=_0xfdd4('0x29');return db[_0xfdd4('0x2a')][_0xfdd4('0x2b')]({'where':{'type':_0x31e053,'resourceId':_0x2c88ad['id']}})[_0xfdd4('0x27')](function(){return _0x1ade42;});})['then'](function(){_0xf9c346[_0xfdd4('0x1c')](0xcc)[_0xfdd4('0x1d')]();});}};}function handleEntityNotFound(_0x385a68,_0xef012e){return function(_0x2207ae){if(!_0x2207ae){_0x385a68['sendStatus'](0x194);}return _0x2207ae;};}function handleError(_0xd127b1,_0x3372d2){_0x3372d2=_0x3372d2||0x1f4;return function(_0xbf38b4){logger[_0xfdd4('0x2c')](_0xbf38b4[_0xfdd4('0x2d')]);if(_0xbf38b4['name']){delete _0xbf38b4[_0xfdd4('0x2e')];}_0xd127b1[_0xfdd4('0x1c')](_0x3372d2)[_0xfdd4('0x2f')](_0xbf38b4);};}exports['index']=function(_0x3fd07a,_0x502776){var _0x2a65c8={},_0x2b22f9={},_0x4aa4f2={'count':0x0,'rows':[]};var _0x50b748=_[_0xfdd4('0x30')](db[_0xfdd4('0x31')]['rawAttributes'],function(_0x557d7b){return{'name':_0x557d7b[_0xfdd4('0x32')],'type':_0x557d7b[_0xfdd4('0x33')][_0xfdd4('0x34')]};});_0x2b22f9[_0xfdd4('0x35')]=_[_0xfdd4('0x30')](_0x50b748,_0xfdd4('0x2e'));_0x2b22f9[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x3fd07a[_0xfdd4('0x36')]);_0x2b22f9[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x2b22f9[_0xfdd4('0x35')],_0x2b22f9[_0xfdd4('0x36')]);_0x2a65c8[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x2b22f9[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x2a65c8[_0xfdd4('0x3a')]=_0x2a65c8[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x2a65c8[_0xfdd4('0x3a')]:_0x2b22f9[_0xfdd4('0x35')];if(!_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3d')]('nolimit')){_0x2a65c8[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x2a65c8[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x3fd07a['query'][_0xfdd4('0x1f')]);}_0x2a65c8['order']=qs[_0xfdd4('0x3e')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3e')]);_0x2a65c8[_0xfdd4('0x3f')]=qs['filters'](_[_0xfdd4('0x40')](_0x3fd07a[_0xfdd4('0x36')],_0x2b22f9[_0xfdd4('0x38')]),_0x50b748);if(_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x2a65c8[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x2a65c8[_0xfdd4('0x3f')],{'$or':_[_0xfdd4('0x30')](_0x50b748,function(_0x83673d){if(_0x83673d['type']!==_0xfdd4('0x43')){var _0x2196f={};_0x2196f[_0x83673d[_0xfdd4('0x2e')]]={'$like':'%'+_0x3fd07a[_0xfdd4('0x36')]['filter']+'%'};return _0x2196f;}})});}_0x2a65c8=_[_0xfdd4('0x42')]({},_0x2a65c8,_0x3fd07a[_0xfdd4('0x44')]);var _0x30524f={'where':_0x2a65c8[_0xfdd4('0x3f')]};return db[_0xfdd4('0x31')]['count'](_0x30524f)[_0xfdd4('0x27')](function(_0x23af2a){_0x4aa4f2[_0xfdd4('0x22')]=_0x23af2a;if(_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x2a65c8[_0xfdd4('0x46')]=[{'all':!![]}];}return db[_0xfdd4('0x31')]['findAll'](_0x2a65c8);})[_0xfdd4('0x27')](function(_0x586713){_0x4aa4f2[_0xfdd4('0x47')]=_0x586713;return _0x4aa4f2;})[_0xfdd4('0x27')](respondWithFilteredResult(_0x502776,_0x2a65c8))[_0xfdd4('0x48')](handleError(_0x502776,null));};exports[_0xfdd4('0x49')]=function(_0x5367aa,_0x419578){var _0x11e90a={'raw':![],'where':{'id':_0x5367aa[_0xfdd4('0x4a')]['id']}},_0x4d1dfe={};_0x4d1dfe[_0xfdd4('0x35')]=_['keys'](db[_0xfdd4('0x31')]['rawAttributes']);_0x4d1dfe['query']=_['keys'](_0x5367aa[_0xfdd4('0x36')]);_0x4d1dfe[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x4d1dfe['model'],_0x4d1dfe[_0xfdd4('0x36')]);_0x11e90a[_0xfdd4('0x3a')]=_['intersection'](_0x4d1dfe[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x5367aa[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x11e90a[_0xfdd4('0x3a')]=_0x11e90a[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x11e90a[_0xfdd4('0x3a')]:_0x4d1dfe[_0xfdd4('0x35')];if(_0x5367aa[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x11e90a[_0xfdd4('0x46')]=[{'all':!![]}];}_0x11e90a=_[_0xfdd4('0x42')]({},_0x11e90a,_0x5367aa[_0xfdd4('0x44')]);return db['CmList']['find'](_0x11e90a)[_0xfdd4('0x27')](handleEntityNotFound(_0x419578,null))[_0xfdd4('0x27')](respondWithResult(_0x419578,null))[_0xfdd4('0x48')](handleError(_0x419578,null));};exports[_0xfdd4('0x4b')]=function(_0x507bf5,_0x3c6828){return db[_0xfdd4('0x31')]['create'](_0x507bf5['body'],{})['then'](function(_0x51dd34){var _0x557cb3=_0x507bf5[_0xfdd4('0x4c')][_0xfdd4('0x28')]({'plain':!![]});if(!_0x557cb3)throw new Error(_0xfdd4('0x4d'));if(_0x557cb3[_0xfdd4('0x4e')]===_0xfdd4('0x4c')){var _0x49bc61=_0x51dd34['get']({'plain':!![]});var _0x17bbab=_0xfdd4('0x29');return db[_0xfdd4('0x4f')][_0xfdd4('0x50')]({'where':{'name':_0x17bbab,'userProfileId':_0x557cb3['userProfileId']},'raw':!![]})[_0xfdd4('0x27')](function(_0x8aa0ea){if(_0x8aa0ea&&_0x8aa0ea['autoAssociation']===0x0){return db[_0xfdd4('0x2a')][_0xfdd4('0x4b')]({'name':_0x49bc61['name'],'resourceId':_0x49bc61['id'],'type':_0x8aa0ea['name'],'sectionId':_0x8aa0ea['id']},{})[_0xfdd4('0x27')](function(){return _0x51dd34;});}else{return _0x51dd34;}})[_0xfdd4('0x48')](function(_0x18f071){logger[_0xfdd4('0x2c')](_0xfdd4('0x51'),_0x18f071);throw _0x18f071;});}return _0x51dd34;})[_0xfdd4('0x27')](respondWithResult(_0x3c6828,0xc9))[_0xfdd4('0x48')](handleError(_0x3c6828,null));};exports[_0xfdd4('0x52')]=function(_0x5848e1,_0x1cf4ff){if(_0x5848e1['body']['id']){delete _0x5848e1['body']['id'];}return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x5848e1['params']['id']}})['then'](handleEntityNotFound(_0x1cf4ff,null))['then'](saveUpdates(_0x5848e1[_0xfdd4('0x53')],null))[_0xfdd4('0x27')](respondWithResult(_0x1cf4ff,null))['catch'](handleError(_0x1cf4ff,null));};exports[_0xfdd4('0x2b')]=function(_0x1cee9f,_0x466b75){return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x1cee9f['params']['id']}})['then'](handleEntityNotFound(_0x466b75,null))['then'](removeEntity(_0x466b75,null))['catch'](handleError(_0x466b75,null));};exports[_0xfdd4('0x54')]=function(_0x14d07e,_0x5ddc25){return db[_0xfdd4('0x31')][_0xfdd4('0x54')]()['then'](respondWithResult(_0x5ddc25,null))[_0xfdd4('0x48')](handleError(_0x5ddc25,null));};exports[_0xfdd4('0x55')]=function(_0x4e9364,_0x1497ff,_0x2b7081){if(_0x4e9364[_0xfdd4('0x53')]['id']){delete _0x4e9364['body']['id'];}return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x4e9364[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x1497ff,null))[_0xfdd4('0x27')](function(_0x562417){if(_0x562417){_0x4e9364[_0xfdd4('0x53')][_0xfdd4('0x56')]=_0x562417['id'];return db[_0xfdd4('0x57')][_0xfdd4('0x4b')](_0x4e9364[_0xfdd4('0x53')]);}})[_0xfdd4('0x27')](respondWithResult(_0x1497ff,null))[_0xfdd4('0x48')](handleError(_0x1497ff,null));};exports[_0xfdd4('0x58')]=function(_0x38b58b,_0x5e0a1c,_0x335b6e){var _0x2799b2={'raw':![],'where':{}};var _0x4483e1={};var _0x2ad8e8={'count':0x0,'rows':[]};return db[_0xfdd4('0x31')]['findOne']({'where':{'id':_0x38b58b[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x5e0a1c,null))[_0xfdd4('0x27')](function(_0x12e917){if(_0x12e917){_0x4483e1[_0xfdd4('0x35')]=_[_0xfdd4('0x37')](db[_0xfdd4('0x57')][_0xfdd4('0x59')]);_0x4483e1[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x38b58b[_0xfdd4('0x36')]);_0x4483e1[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x4483e1['model'],_0x4483e1[_0xfdd4('0x36')]);_0x2799b2['attributes']=_[_0xfdd4('0x39')](_0x4483e1[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x38b58b[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x2799b2[_0xfdd4('0x3a')]=_0x2799b2[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x2799b2[_0xfdd4('0x3a')]:_0x4483e1[_0xfdd4('0x35')];if(!_0x38b58b[_0xfdd4('0x36')][_0xfdd4('0x3d')]('nolimit')){_0x2799b2['limit']=qs['limit'](_0x38b58b[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x2799b2['offset']=qs[_0xfdd4('0x1f')](_0x38b58b[_0xfdd4('0x36')][_0xfdd4('0x1f')]);}_0x2799b2[_0xfdd4('0x5a')]=qs[_0xfdd4('0x3e')](_0x38b58b['query'][_0xfdd4('0x3e')]);_0x2799b2[_0xfdd4('0x3f')]=qs[_0xfdd4('0x38')](_['pick'](_0x38b58b[_0xfdd4('0x36')],_0x4483e1['filters']));_0x2799b2[_0xfdd4('0x3f')][_0xfdd4('0x56')]=_0x12e917['id'];if(_0x38b58b[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x2799b2['where']=_[_0xfdd4('0x42')](_0x2799b2[_0xfdd4('0x3f')],{'$or':_['map'](_0x2799b2[_0xfdd4('0x3a')],function(_0x341e95){var _0xa55e0f={};_0xa55e0f[_0x341e95]={'$like':'%'+_0x38b58b['query'][_0xfdd4('0x41')]+'%'};return _0xa55e0f;})});}_0x2799b2=_[_0xfdd4('0x42')]({},_0x2799b2,_0x38b58b[_0xfdd4('0x44')]);return db['Disposition'][_0xfdd4('0x22')]({'where':_0x2799b2[_0xfdd4('0x3f')]})[_0xfdd4('0x27')](function(_0x1d9f0d){_0x2ad8e8[_0xfdd4('0x22')]=_0x1d9f0d;if(_0x38b58b[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x2799b2['include']=[{'all':!![]}];}return db[_0xfdd4('0x57')][_0xfdd4('0x5b')](_0x2799b2);})[_0xfdd4('0x27')](function(_0x3c24b0){_0x2ad8e8[_0xfdd4('0x47')]=_0x3c24b0;return _0x2ad8e8;});}})[_0xfdd4('0x27')](respondWithFilteredResult(_0x5e0a1c,_0x2799b2))[_0xfdd4('0x48')](handleError(_0x5e0a1c,null));};exports[_0xfdd4('0x5c')]=function(_0x58dee0,_0x430412,_0x5800b8){return db['CmList'][_0xfdd4('0x50')]({'where':{'id':_0x58dee0['params']['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x430412,null))['then'](function(_0x4576ce){if(_0x4576ce){return _0x4576ce[_0xfdd4('0x5c')](_0x58dee0[_0xfdd4('0x36')][_0xfdd4('0x5d')]);}})[_0xfdd4('0x27')](respondWithStatusCode(_0x430412,null))[_0xfdd4('0x48')](handleError(_0x430412,null));};exports[_0xfdd4('0x5e')]=function(_0x48c8dd,_0x588a18,_0x2d7fba){return db['CmList'][_0xfdd4('0x50')]({'where':{'id':_0x48c8dd[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x588a18,null))[_0xfdd4('0x27')](function(_0x243848){if(_0x243848){var _0x165295=[];var _0x246772={'success':[],'errors':[]};return db['CmContact']['describe']()[_0xfdd4('0x27')](function(_0x1eecb7){if(_0x48c8dd[_0xfdd4('0x53')][_0xfdd4('0x5f')]&&_[_0xfdd4('0x60')](_0x48c8dd[_0xfdd4('0x53')][_0xfdd4('0x5f')])){if(_0x48c8dd[_0xfdd4('0x53')][_0xfdd4('0x5f')][_0xfdd4('0x3c')]){_0x48c8dd[_0xfdd4('0x53')][_0xfdd4('0x5f')]=_0x48c8dd[_0xfdd4('0x53')]['tags']['join'](';')+';';}else{_0x48c8dd[_0xfdd4('0x53')][_0xfdd4('0x5f')]=null;}}else{_0x48c8dd['body']['tags']=null;}if(_0x48c8dd[_0xfdd4('0x53')]&&_[_0xfdd4('0x60')](_0x48c8dd['body'])){for(var _0x3ea3e9=0x0;_0x3ea3e9<_0x48c8dd[_0xfdd4('0x53')][_0xfdd4('0x3c')];_0x3ea3e9+=0x1){_0x48c8dd[_0xfdd4('0x53')][_0x3ea3e9][_0xfdd4('0x56')]=_0x48c8dd[_0xfdd4('0x4a')]['id'];_0x165295['push'](_0x48c8dd[_0xfdd4('0x53')][_0x3ea3e9]);}return BPromise[_0xfdd4('0x61')](_0x165295,function(_0x4783b9){return db[_0xfdd4('0x62')][_0xfdd4('0x4b')](_[_0xfdd4('0x63')](_0x4783b9,[_0xfdd4('0x5d'),'id'])||{},{'fields':_[_0xfdd4('0x37')](_0x1eecb7),'raw':!![]})['then'](function(_0x4c5f4c){_0x246772[_0xfdd4('0x64')]['push'](_0x4c5f4c[_0xfdd4('0x65')]);})[_0xfdd4('0x48')](function(_0x298906){_0x246772[_0xfdd4('0x66')][_0xfdd4('0x67')]({'data':_0x4783b9,'error':_0x298906['message']});});})['then'](function(_0x14ce5d){return _0x246772;})['catch'](function(_0x998992){return _0x998992;});}else{_0x588a18['status'](0x190)[_0xfdd4('0x1e')]({'message':_0xfdd4('0x68')});}});}})[_0xfdd4('0x27')](respondWithResult(_0x588a18,null))[_0xfdd4('0x48')](handleError(_0x588a18,null));};exports[_0xfdd4('0x69')]=function(_0x2e6830,_0x1823e1,_0x18ae9e){var _0x3d23df;return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x2e6830['params']['id']},'include':[{'model':db[_0xfdd4('0x6a')],'as':_0xfdd4('0x6b')}]})[_0xfdd4('0x27')](handleEntityNotFound(_0x1823e1,null))[_0xfdd4('0x27')](function(_0x31c7f4){if(_0x31c7f4){_0x3d23df=_0x31c7f4;return db[_0xfdd4('0x62')][_0xfdd4('0x59')];}})[_0xfdd4('0x27')](function(_0x2fe961){if(_0x2fe961){var _0x530157={};var _0x4882d6={};_0x4882d6[_0xfdd4('0x35')]=_[_0xfdd4('0x6c')](_[_0xfdd4('0x37')](_0x2fe961),_['map'](_0x3d23df[_0xfdd4('0x6b')],function(_0x11a75f){return util[_0xfdd4('0x6d')](_0xfdd4('0x6e'),_0x11a75f['id']);}));_0x4882d6['query']=_['keys'](_0x2e6830[_0xfdd4('0x36')]);_0x4882d6[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x4882d6['model'],_0x4882d6[_0xfdd4('0x36')]);_0x530157[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x4882d6[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x2e6830[_0xfdd4('0x36')]['fields']));_0x530157['attributes']=_0x530157[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x530157[_0xfdd4('0x3a')]:_0x4882d6[_0xfdd4('0x35')];if(!_0x2e6830[_0xfdd4('0x36')][_0xfdd4('0x3d')](_0xfdd4('0x6f'))){_0x530157[_0xfdd4('0x21')]=qs['limit'](_0x2e6830[_0xfdd4('0x36')]['limit']);_0x530157[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x2e6830['query'][_0xfdd4('0x1f')]);}_0x530157[_0xfdd4('0x5a')]=qs[_0xfdd4('0x3e')](_0x2e6830[_0xfdd4('0x36')][_0xfdd4('0x3e')]);_0x530157[_0xfdd4('0x3f')]=qs[_0xfdd4('0x38')](_[_0xfdd4('0x40')](_0x2e6830[_0xfdd4('0x36')],_0x4882d6['filters']));_0x530157[_0xfdd4('0x70')]=!![];if(_0x2e6830['query'][_0xfdd4('0x41')]){_0x530157['where']=_['merge'](_0x530157[_0xfdd4('0x3f')],{'$or':_[_0xfdd4('0x30')](_0x530157[_0xfdd4('0x3a')],function(_0x418a22){var _0x11bc5b={};_0x11bc5b[_0x418a22]={'$like':'%'+_0x2e6830['query'][_0xfdd4('0x41')]+'%'};return _0x11bc5b;})});}_0x530157=_[_0xfdd4('0x42')]({},_0x530157,_0x2e6830[_0xfdd4('0x44')]);return _0x3d23df[_0xfdd4('0x69')](_0x530157);}})[_0xfdd4('0x27')](respondWithResult(_0x1823e1,null))[_0xfdd4('0x48')](handleError(_0x1823e1,null));};exports['getContactsCsv']=function(_0x7a81f1,_0x1eb455,_0x4d123f){var _0x4bc30f;var _0x4a5749;var _0x1e358c;var _0x10a995=_0x7a81f1['params']['id'];csv_results=[];return db['ContactItemType'][_0xfdd4('0x5b')]({'attributes':['id',_0xfdd4('0x2e')],'raw':!![],'order':[_0xfdd4('0x71')]})['then'](function(_0x4b6d61){_0x4bc30f=_0x4b6d61;var _0x2c7072=_[_0xfdd4('0x37')](db[_0xfdd4('0x62')]['rawAttributes']);return db[_0xfdd4('0x6a')]['findAll']({'raw':!![],'attributes':['id',_0xfdd4('0x72')]})[_0xfdd4('0x27')](function(_0x3a237f){_0x4a5749=_0x3a237f;var _0x4e1dbc=squel[_0xfdd4('0x73')]()[_0xfdd4('0x3b')](_0x2c7072)[_0xfdd4('0x74')](_0xfdd4('0x75'),'c')[_0xfdd4('0x3f')]('c.ListId\x20=\x20?',_0x10a995)[_0xfdd4('0x76')]();for(var _0x28d246=0x0;_0x28d246<_0x4a5749[_0xfdd4('0x3c')];_0x28d246++){_0x4e1dbc['field'](_0xfdd4('0x77')+_0x4a5749[_0x28d246]['id'],_0xfdd4('0x78')+_0x4a5749[_0x28d246][_0xfdd4('0x72')]);}for(var _0x28d246=0x0;_0x28d246<_0x4bc30f['length'];_0x28d246++){_0x4e1dbc[_0xfdd4('0x79')](squel['select']()['field']('item')[_0xfdd4('0x74')]('cm_contact_has_items')['where']('ItemTypeId\x20=\x20?',_0x4bc30f[_0x28d246]['id'])[_0xfdd4('0x3f')](_0xfdd4('0x7a')),_0xfdd4('0x7b')+_0x4bc30f[_0x28d246][_0xfdd4('0x2e')]);_0x4e1dbc[_0xfdd4('0x79')](squel[_0xfdd4('0x73')]()[_0xfdd4('0x79')](_0xfdd4('0x7c'))[_0xfdd4('0x74')](_0xfdd4('0x7d'))[_0xfdd4('0x3f')](_0xfdd4('0x7e'),_0x4bc30f[_0x28d246]['id'])[_0xfdd4('0x3f')](_0xfdd4('0x7a')),_0xfdd4('0x7f')+_0x4bc30f[_0x28d246][_0xfdd4('0x2e')]);}var _0x1e9f17=[];_0x1e9f17[_0xfdd4('0x67')](_0x4e1dbc[_0xfdd4('0x80')]());BPromise[_0xfdd4('0x61')](_0x1e9f17,handleQuery)[_0xfdd4('0x27')](function(_0x2c9630){handleQuery(_0x4e1dbc[_0xfdd4('0x80')]());var _0x137393=csv_results[0x0];if(!_[_0xfdd4('0x81')](_0x137393)){var _0x22f93b=toCsv(_0x137393);var _0x4a2f3f=Date[_0xfdd4('0x82')]();fs[_0xfdd4('0x83')](util[_0xfdd4('0x6d')](_0xfdd4('0x84'),_0x10a995,_0x4a2f3f),_0x22f93b);_0x1eb455[_0xfdd4('0x85')]('Content-disposition',_0xfdd4('0x86')+util[_0xfdd4('0x6d')](_0xfdd4('0x87'),_0x10a995,_0x4a2f3f));_0x1eb455[_0xfdd4('0x85')](_0xfdd4('0x88'),_0xfdd4('0x89'));return _0x1eb455['download'](util[_0xfdd4('0x6d')](_0xfdd4('0x84'),_0x10a995,_0x4a2f3f));}else{return _0x1eb455[_0xfdd4('0x1b')](0xcc);}});});});};exports[_0xfdd4('0x8a')]=function(_0x343044,_0x260b70,_0x566a92){var _0x2a6a0d;delete _0x343044[_0xfdd4('0x53')]['id'];return db[_0xfdd4('0x31')]['findOne']({'where':{'id':_0x343044[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x260b70,null))['then'](function(_0x5159a5){if(_0x5159a5){return db[_0xfdd4('0x8b')][_0xfdd4('0x8c')](function(_0x16635c){return db[_0xfdd4('0x6a')]['create'](_0x343044[_0xfdd4('0x53')],{'transaction':_0x16635c})['then'](function(_0xc9955e){_0x2a6a0d=_0xc9955e;return _0x5159a5[_0xfdd4('0x8d')](_0xc9955e,{'transaction':_0x16635c});})[_0xfdd4('0x27')](function(){var _0x2b6952={'type':db[_0xfdd4('0x8e')][_0xfdd4('0x8f')],'transaction':_0x16635c};switch(_0x343044[_0xfdd4('0x53')][_0xfdd4('0x33')]){case _0xfdd4('0x90'):_0x2b6952[_0xfdd4('0x33')]=db[_0xfdd4('0x8e')]['TEXT'];break;case _0xfdd4('0x91'):_0x2b6952[_0xfdd4('0x33')]=db[_0xfdd4('0x8e')][_0xfdd4('0x92')];break;case _0xfdd4('0x93'):_0x2b6952[_0xfdd4('0x33')]=db['Sequelize'][_0xfdd4('0x94')];_0x2b6952[_0xfdd4('0x95')]=![];break;default:}return db[_0xfdd4('0x8b')][_0xfdd4('0x96')]['addColumn'](_0xfdd4('0x75'),util[_0xfdd4('0x6d')]('cf_%s',_0x2a6a0d['id']),_0x2b6952);})[_0xfdd4('0x27')](function(){return _0x2a6a0d;});});}})[_0xfdd4('0x27')](respondWithResult(_0x260b70,null))[_0xfdd4('0x48')](handleError(_0x260b70,null));};exports[_0xfdd4('0x97')]=function(_0x3eab2e,_0x1b732b,_0x191ab6){var _0x217d9b={};var _0x1d460f={};var _0x82c28f;var _0x3c35b4;return db[_0xfdd4('0x31')][_0xfdd4('0x98')]({'where':{'id':_0x3eab2e[_0xfdd4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1b732b,null))[_0xfdd4('0x27')](function(_0x349fc6){if(_0x349fc6){_0x82c28f=_0x349fc6;_0x1d460f[_0xfdd4('0x35')]=_[_0xfdd4('0x37')](db['CmCustomField'][_0xfdd4('0x59')]);_0x1d460f[_0xfdd4('0x36')]=_['keys'](_0x3eab2e[_0xfdd4('0x36')]);_0x1d460f[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x1d460f[_0xfdd4('0x35')],_0x1d460f['query']);_0x217d9b[_0xfdd4('0x3a')]=_['intersection'](_0x1d460f[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x3eab2e['query'][_0xfdd4('0x3b')]));_0x217d9b['attributes']=_0x217d9b['attributes'][_0xfdd4('0x3c')]?_0x217d9b[_0xfdd4('0x3a')]:_0x1d460f[_0xfdd4('0x35')];_0x217d9b[_0xfdd4('0x5a')]=qs['sort'](_0x3eab2e['query'][_0xfdd4('0x3e')]);_0x217d9b[_0xfdd4('0x3f')]=qs['filters'](_['pick'](_0x3eab2e[_0xfdd4('0x36')],_0x1d460f[_0xfdd4('0x38')]));_0x217d9b[_0xfdd4('0x3f')]=_['merge'](_0x217d9b[_0xfdd4('0x3f')],{'$or':[{'ListId':_0x349fc6['id']},{'ListId':null}]});if(_0x3eab2e[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x217d9b[_0xfdd4('0x3f')]=_['merge'](_0x217d9b[_0xfdd4('0x3f')],{'$or':_[_0xfdd4('0x30')](_0x217d9b[_0xfdd4('0x3a')],function(_0x23746f){var _0x2bc7f7={};_0x2bc7f7[_0x23746f]={'$like':'%'+_0x3eab2e['query'][_0xfdd4('0x41')]+'%'};return _0x2bc7f7;})});}_0x217d9b=_[_0xfdd4('0x42')]({},_0x217d9b,_0x3eab2e['options']);return db[_0xfdd4('0x6a')][_0xfdd4('0x99')](_0x217d9b);}})[_0xfdd4('0x27')](respondWithResult(_0x1b732b,null))[_0xfdd4('0x48')](handleError(_0x1b732b,null));};exports[_0xfdd4('0x9a')]=function(_0xff9710,_0x18378f,_0x58de86){return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0xff9710[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x18378f,null))[_0xfdd4('0x27')](function(_0x10f9d3){if(_0x10f9d3){return _0x10f9d3[_0xfdd4('0x9a')](_0xff9710['body']['ids'],_[_0xfdd4('0x63')](_0xff9710['body'],['ids','id'])||{})[_0xfdd4('0x9b')](function(_0x3e09bc){for(var _0x1dd8f4=0x0;_0x1dd8f4<_0xff9710[_0xfdd4('0x53')][_0xfdd4('0x5d')][_0xfdd4('0x3c')];_0x1dd8f4+=0x1){socket[_0xfdd4('0x9c')]('userCmList:save',{'UserId':Number(_0xff9710[_0xfdd4('0x53')][_0xfdd4('0x5d')][_0x1dd8f4]),'CmListId':Number(_0xff9710['params']['id'])});}return _0x3e09bc;});}})['then'](respondWithResult(_0x18378f,null))['catch'](handleError(_0x18378f,null));};exports[_0xfdd4('0x9d')]=function(_0x47917b,_0x28d8d9,_0x495a58){return db['CmList'][_0xfdd4('0x50')]({'where':{'id':_0x47917b[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x28d8d9,null))[_0xfdd4('0x27')](function(_0x31a98f){if(_0x31a98f){return _0x31a98f[_0xfdd4('0x9d')](_0x47917b[_0xfdd4('0x36')][_0xfdd4('0x5d')])[_0xfdd4('0x27')](function(){if(_['isArray'](_0x47917b[_0xfdd4('0x36')][_0xfdd4('0x5d')])){for(var _0x493a3f=0x0;_0x493a3f<_0x47917b[_0xfdd4('0x36')][_0xfdd4('0x5d')]['length'];_0x493a3f+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x47917b['query'][_0xfdd4('0x5d')][_0x493a3f]),'CmListId':Number(_0x47917b[_0xfdd4('0x4a')]['id'])});}}else{socket['emit'](_0xfdd4('0x9e'),{'UserId':Number(_0x47917b['query'][_0xfdd4('0x5d')]),'CmListId':Number(_0x47917b[_0xfdd4('0x4a')]['id'])});}});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x28d8d9,null))[_0xfdd4('0x48')](handleError(_0x28d8d9,null));};exports[_0xfdd4('0x9f')]=function(_0x45fa09,_0x2aa88c,_0x5858f3){var _0x57cd65={};var _0x23cabf={};var _0x8ea53c;var _0x2b65d7;return db[_0xfdd4('0x31')][_0xfdd4('0x98')]({'where':{'id':_0x45fa09['params']['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x2aa88c,null))[_0xfdd4('0x27')](function(_0x46fa1e){if(_0x46fa1e){_0x8ea53c=_0x46fa1e;_0x23cabf['model']=_['keys'](db[_0xfdd4('0xa0')][_0xfdd4('0x59')]);_0x23cabf[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x45fa09[_0xfdd4('0x36')]);_0x23cabf[_0xfdd4('0x38')]=_['intersection'](_0x23cabf['model'],_0x23cabf[_0xfdd4('0x36')]);_0x57cd65[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x23cabf['model'],qs[_0xfdd4('0x3b')](_0x45fa09['query'][_0xfdd4('0x3b')]));_0x57cd65['attributes']=_0x57cd65[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x57cd65['attributes']:_0x23cabf[_0xfdd4('0x35')];_0x57cd65[_0xfdd4('0x5a')]=qs[_0xfdd4('0x3e')](_0x45fa09[_0xfdd4('0x36')]['sort']);_0x57cd65[_0xfdd4('0x3f')]=qs[_0xfdd4('0x38')](_[_0xfdd4('0x40')](_0x45fa09[_0xfdd4('0x36')],_0x23cabf[_0xfdd4('0x38')]));if(_0x45fa09[_0xfdd4('0x36')]['filter']){_0x57cd65[_0xfdd4('0x3f')]=_['merge'](_0x57cd65[_0xfdd4('0x3f')],{'$or':_[_0xfdd4('0x30')](_0x57cd65[_0xfdd4('0x3a')],function(_0x21b78b){var _0x27eb23={};_0x27eb23[_0x21b78b]={'$like':'%'+_0x45fa09[_0xfdd4('0x36')][_0xfdd4('0x41')]+'%'};return _0x27eb23;})});}_0x57cd65=_[_0xfdd4('0x42')]({},_0x57cd65,_0x45fa09[_0xfdd4('0x44')]);return _0x8ea53c[_0xfdd4('0x9f')](_0x57cd65);}})[_0xfdd4('0x27')](function(_0x27eb5e){if(_0x27eb5e){_0x2b65d7=_0x27eb5e['length'];if(!_0x45fa09[_0xfdd4('0x36')]['hasOwnProperty'](_0xfdd4('0x6f'))){_0x57cd65['limit']=qs['limit'](_0x45fa09[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x57cd65[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x45fa09[_0xfdd4('0x36')][_0xfdd4('0x1f')]);}return _0x8ea53c[_0xfdd4('0x9f')](_0x57cd65);}})['then'](function(_0x44f890){if(_0x44f890){return _0x44f890?{'count':_0x2b65d7,'rows':_0x44f890}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x2aa88c,null))[_0xfdd4('0x48')](handleError(_0x2aa88c,null));};function handleQuery(_0x5a7c66){logger[_0xfdd4('0xa1')](_0x5a7c66);return db[_0xfdd4('0x8b')][_0xfdd4('0x36')](_0x5a7c66)[_0xfdd4('0x9b')](function(_0x3980ed){csv_results[_0xfdd4('0x67')](_0x3980ed);})[_0xfdd4('0x48')](function(_0x154496){logger[_0xfdd4('0x2c')](_0x154496[_0xfdd4('0xa2')]);});} \ No newline at end of file +var _0x9c00=['map','CmList','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','catch','params','options','find','create','user','role','UserProfileSection','userProfileId','body','describe','addDisposition','ListId','findOne','Disposition','pick','findAll','rows','removeDispositions','ids','addContacts','CmContact','tags','push','each','omit','errors','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','from','cm_contacts','c.ListId\x20=\x20?','field','c.cf_','alias','item','cm_contact_has_items','select','description','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','isEmpty','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','download','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','INTEGER','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents','info','message','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','save','update','then','destroy','get','Lists','UserProfileResource','error','name','send'];(function(_0x10cc84,_0x3b44eb){var _0x357fe4=function(_0x5c2e94){while(--_0x5c2e94){_0x10cc84['push'](_0x10cc84['shift']());}};_0x357fe4(++_0x3b44eb);}(_0x9c00,0x1a0));var _0x09c0=function(_0x2bf6be,_0x5b23f1){_0x2bf6be=_0x2bf6be-0x0;var _0x532ef4=_0x9c00[_0x2bf6be];return _0x532ef4;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];var csv_results;config[_0x09c0('0x1b')]=_[_0x09c0('0x1c')](config[_0x09c0('0x1b')],{'host':_0x09c0('0x1d'),'port':0x18eb});var socket=require(_0x09c0('0x1e'))(new Redis(config[_0x09c0('0x1b')]));require(_0x09c0('0x1f'))[_0x09c0('0x20')](socket);function respondWithStatusCode(_0x254598,_0x152140){_0x152140=_0x152140||0xcc;return function(_0x45a265){if(_0x45a265){return _0x254598[_0x09c0('0x21')](_0x152140);}return _0x254598[_0x09c0('0x22')](_0x152140)['end']();};}function respondWithResult(_0x590129,_0x558b4f){_0x558b4f=_0x558b4f||0xc8;return function(_0x42030d){if(_0x42030d){return _0x590129[_0x09c0('0x22')](_0x558b4f)[_0x09c0('0x23')](_0x42030d);}};}function respondWithFilteredResult(_0x628272,_0x5dcab7){return function(_0x2c4440){if(_0x2c4440){var _0x4aa8a5=typeof _0x5dcab7['offset']===_0x09c0('0x24')&&typeof _0x5dcab7['limit']===_0x09c0('0x24');var _0x319c36=_0x2c4440[_0x09c0('0x25')];var _0x49064c=_0x4aa8a5?0x0:_0x5dcab7[_0x09c0('0x26')];var _0x44f714=_0x4aa8a5?_0x2c4440[_0x09c0('0x25')]:_0x5dcab7[_0x09c0('0x26')]+_0x5dcab7[_0x09c0('0x27')];var _0xa5d16f;if(_0x44f714>=_0x319c36){_0x44f714=_0x319c36;_0xa5d16f=0xc8;}else{_0xa5d16f=0xce;}_0x628272[_0x09c0('0x22')](_0xa5d16f);return _0x628272['set'](_0x09c0('0x28'),_0x49064c+'-'+_0x44f714+'/'+_0x319c36)[_0x09c0('0x23')](_0x2c4440);}return null;};}function patchUpdates(_0x473fbd){return function(_0x1d18e9){try{jsonpatch['apply'](_0x1d18e9,_0x473fbd,!![]);}catch(_0x4f6824){return BPromise[_0x09c0('0x29')](_0x4f6824);}return _0x1d18e9[_0x09c0('0x2a')]();};}function saveUpdates(_0x1e8a1c,_0x3a5370){return function(_0x491e6f){if(_0x491e6f){return _0x491e6f[_0x09c0('0x2b')](_0x1e8a1c)[_0x09c0('0x2c')](function(_0x56d883){return _0x56d883;});}return null;};}function removeEntity(_0x2c7202,_0x163a59){return function(_0x2e3d4d){if(_0x2e3d4d){return _0x2e3d4d[_0x09c0('0x2d')]()[_0x09c0('0x2c')](function(){var _0x1d2d9d=_0x2e3d4d[_0x09c0('0x2e')]({'plain':!![]});var _0x35b61c=_0x09c0('0x2f');return db[_0x09c0('0x30')][_0x09c0('0x2d')]({'where':{'type':_0x35b61c,'resourceId':_0x1d2d9d['id']}})['then'](function(){return _0x2e3d4d;});})[_0x09c0('0x2c')](function(){_0x2c7202[_0x09c0('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d09e0,_0x5aa0b9){return function(_0x3f5b10){if(!_0x3f5b10){_0x1d09e0['sendStatus'](0x194);}return _0x3f5b10;};}function handleError(_0x3ac8e4,_0x24e371){_0x24e371=_0x24e371||0x1f4;return function(_0x108409){logger[_0x09c0('0x31')](_0x108409['stack']);if(_0x108409['name']){delete _0x108409[_0x09c0('0x32')];}_0x3ac8e4[_0x09c0('0x22')](_0x24e371)[_0x09c0('0x33')](_0x108409);};}exports['index']=function(_0x321ee6,_0x4bdae9){var _0x350cd3={},_0x21755d={},_0x16cf08={'count':0x0,'rows':[]};var _0x500cf8=_[_0x09c0('0x34')](db[_0x09c0('0x35')][_0x09c0('0x36')],function(_0x184c0b){return{'name':_0x184c0b[_0x09c0('0x37')],'type':_0x184c0b[_0x09c0('0x38')][_0x09c0('0x39')]};});_0x21755d['model']=_[_0x09c0('0x34')](_0x500cf8,_0x09c0('0x32'));_0x21755d[_0x09c0('0x3a')]=_[_0x09c0('0x3b')](_0x321ee6[_0x09c0('0x3a')]);_0x21755d['filters']=_[_0x09c0('0x3c')](_0x21755d[_0x09c0('0x3d')],_0x21755d[_0x09c0('0x3a')]);_0x350cd3[_0x09c0('0x3e')]=_[_0x09c0('0x3c')](_0x21755d['model'],qs[_0x09c0('0x3f')](_0x321ee6[_0x09c0('0x3a')][_0x09c0('0x3f')]));_0x350cd3[_0x09c0('0x3e')]=_0x350cd3[_0x09c0('0x3e')][_0x09c0('0x40')]?_0x350cd3[_0x09c0('0x3e')]:_0x21755d['model'];if(!_0x321ee6[_0x09c0('0x3a')][_0x09c0('0x41')](_0x09c0('0x42'))){_0x350cd3[_0x09c0('0x27')]=qs[_0x09c0('0x27')](_0x321ee6['query']['limit']);_0x350cd3['offset']=qs['offset'](_0x321ee6[_0x09c0('0x3a')][_0x09c0('0x26')]);}_0x350cd3[_0x09c0('0x43')]=qs[_0x09c0('0x44')](_0x321ee6[_0x09c0('0x3a')]['sort']);_0x350cd3[_0x09c0('0x45')]=qs[_0x09c0('0x46')](_['pick'](_0x321ee6[_0x09c0('0x3a')],_0x21755d['filters']),_0x500cf8);if(_0x321ee6[_0x09c0('0x3a')]['filter']){_0x350cd3[_0x09c0('0x45')]=_[_0x09c0('0x47')](_0x350cd3['where'],{'$or':_[_0x09c0('0x34')](_0x500cf8,function(_0x17fed6){if(_0x17fed6['type']!==_0x09c0('0x48')){var _0x30f8a7={};_0x30f8a7[_0x17fed6[_0x09c0('0x32')]]={'$like':'%'+_0x321ee6[_0x09c0('0x3a')][_0x09c0('0x49')]+'%'};return _0x30f8a7;}})});}_0x350cd3=_[_0x09c0('0x47')]({},_0x350cd3,_0x321ee6['options']);var _0x24bb97={'where':_0x350cd3[_0x09c0('0x45')]};return db[_0x09c0('0x35')]['count'](_0x24bb97)[_0x09c0('0x2c')](function(_0x30c0c5){_0x16cf08[_0x09c0('0x25')]=_0x30c0c5;if(_0x321ee6['query'][_0x09c0('0x4a')]){_0x350cd3[_0x09c0('0x4b')]=[{'all':!![]}];}return db['CmList']['findAll'](_0x350cd3);})[_0x09c0('0x2c')](function(_0x471078){_0x16cf08['rows']=_0x471078;return _0x16cf08;})[_0x09c0('0x2c')](respondWithFilteredResult(_0x4bdae9,_0x350cd3))[_0x09c0('0x4c')](handleError(_0x4bdae9,null));};exports['show']=function(_0xbabba1,_0x13582b){var _0x2e7d4f={'raw':![],'where':{'id':_0xbabba1[_0x09c0('0x4d')]['id']}},_0x33fc26={};_0x33fc26['model']=_[_0x09c0('0x3b')](db['CmList']['rawAttributes']);_0x33fc26[_0x09c0('0x3a')]=_[_0x09c0('0x3b')](_0xbabba1[_0x09c0('0x3a')]);_0x33fc26[_0x09c0('0x46')]=_[_0x09c0('0x3c')](_0x33fc26[_0x09c0('0x3d')],_0x33fc26['query']);_0x2e7d4f['attributes']=_['intersection'](_0x33fc26[_0x09c0('0x3d')],qs[_0x09c0('0x3f')](_0xbabba1[_0x09c0('0x3a')]['fields']));_0x2e7d4f[_0x09c0('0x3e')]=_0x2e7d4f[_0x09c0('0x3e')][_0x09c0('0x40')]?_0x2e7d4f[_0x09c0('0x3e')]:_0x33fc26[_0x09c0('0x3d')];if(_0xbabba1[_0x09c0('0x3a')][_0x09c0('0x4a')]){_0x2e7d4f[_0x09c0('0x4b')]=[{'all':!![]}];}_0x2e7d4f=_[_0x09c0('0x47')]({},_0x2e7d4f,_0xbabba1[_0x09c0('0x4e')]);return db[_0x09c0('0x35')][_0x09c0('0x4f')](_0x2e7d4f)[_0x09c0('0x2c')](handleEntityNotFound(_0x13582b,null))[_0x09c0('0x2c')](respondWithResult(_0x13582b,null))[_0x09c0('0x4c')](handleError(_0x13582b,null));};exports[_0x09c0('0x50')]=function(_0x37e043,_0x14c834){return db[_0x09c0('0x35')][_0x09c0('0x50')](_0x37e043['body'],{})[_0x09c0('0x2c')](function(_0x44befb){var _0x15b0a2=_0x37e043[_0x09c0('0x51')][_0x09c0('0x2e')]({'plain':!![]});if(!_0x15b0a2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15b0a2[_0x09c0('0x52')]===_0x09c0('0x51')){var _0x1823c2=_0x44befb['get']({'plain':!![]});var _0xe0b82a=_0x09c0('0x2f');return db[_0x09c0('0x53')][_0x09c0('0x4f')]({'where':{'name':_0xe0b82a,'userProfileId':_0x15b0a2[_0x09c0('0x54')]},'raw':!![]})[_0x09c0('0x2c')](function(_0x45ecd0){if(_0x45ecd0&&_0x45ecd0['autoAssociation']===0x0){return db[_0x09c0('0x30')][_0x09c0('0x50')]({'name':_0x1823c2[_0x09c0('0x32')],'resourceId':_0x1823c2['id'],'type':_0x45ecd0[_0x09c0('0x32')],'sectionId':_0x45ecd0['id']},{})[_0x09c0('0x2c')](function(){return _0x44befb;});}else{return _0x44befb;}})[_0x09c0('0x4c')](function(_0x3ebabb){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ebabb);throw _0x3ebabb;});}return _0x44befb;})[_0x09c0('0x2c')](respondWithResult(_0x14c834,0xc9))[_0x09c0('0x4c')](handleError(_0x14c834,null));};exports[_0x09c0('0x2b')]=function(_0x528366,_0x1af651){if(_0x528366['body']['id']){delete _0x528366[_0x09c0('0x55')]['id'];}return db[_0x09c0('0x35')][_0x09c0('0x4f')]({'where':{'id':_0x528366[_0x09c0('0x4d')]['id']}})[_0x09c0('0x2c')](handleEntityNotFound(_0x1af651,null))[_0x09c0('0x2c')](saveUpdates(_0x528366[_0x09c0('0x55')],null))['then'](respondWithResult(_0x1af651,null))[_0x09c0('0x4c')](handleError(_0x1af651,null));};exports[_0x09c0('0x2d')]=function(_0x97c584,_0x270ff2){return db[_0x09c0('0x35')][_0x09c0('0x4f')]({'where':{'id':_0x97c584[_0x09c0('0x4d')]['id']}})[_0x09c0('0x2c')](handleEntityNotFound(_0x270ff2,null))[_0x09c0('0x2c')](removeEntity(_0x270ff2,null))[_0x09c0('0x4c')](handleError(_0x270ff2,null));};exports[_0x09c0('0x56')]=function(_0x4c4339,_0x34cc0a){return db[_0x09c0('0x35')][_0x09c0('0x56')]()[_0x09c0('0x2c')](respondWithResult(_0x34cc0a,null))['catch'](handleError(_0x34cc0a,null));};exports[_0x09c0('0x57')]=function(_0x48dae0,_0x29205f,_0x9a4f4){if(_0x48dae0[_0x09c0('0x55')]['id']){delete _0x48dae0['body']['id'];}return db['CmList'][_0x09c0('0x4f')]({'where':{'id':_0x48dae0[_0x09c0('0x4d')]['id']}})[_0x09c0('0x2c')](handleEntityNotFound(_0x29205f,null))[_0x09c0('0x2c')](function(_0x4b65c7){if(_0x4b65c7){_0x48dae0[_0x09c0('0x55')][_0x09c0('0x58')]=_0x4b65c7['id'];return db['Disposition'][_0x09c0('0x50')](_0x48dae0[_0x09c0('0x55')]);}})[_0x09c0('0x2c')](respondWithResult(_0x29205f,null))[_0x09c0('0x4c')](handleError(_0x29205f,null));};exports['getDispositions']=function(_0x8d27a5,_0x24f23b,_0x3c3ad4){var _0x36c2f5={'raw':![],'where':{}};var _0x360924={};var _0x4613e0={'count':0x0,'rows':[]};return db[_0x09c0('0x35')][_0x09c0('0x59')]({'where':{'id':_0x8d27a5[_0x09c0('0x4d')]['id']}})[_0x09c0('0x2c')](handleEntityNotFound(_0x24f23b,null))[_0x09c0('0x2c')](function(_0x2906cb){if(_0x2906cb){_0x360924[_0x09c0('0x3d')]=_['keys'](db[_0x09c0('0x5a')][_0x09c0('0x36')]);_0x360924[_0x09c0('0x3a')]=_[_0x09c0('0x3b')](_0x8d27a5[_0x09c0('0x3a')]);_0x360924['filters']=_[_0x09c0('0x3c')](_0x360924[_0x09c0('0x3d')],_0x360924[_0x09c0('0x3a')]);_0x36c2f5[_0x09c0('0x3e')]=_['intersection'](_0x360924[_0x09c0('0x3d')],qs[_0x09c0('0x3f')](_0x8d27a5['query'][_0x09c0('0x3f')]));_0x36c2f5[_0x09c0('0x3e')]=_0x36c2f5[_0x09c0('0x3e')][_0x09c0('0x40')]?_0x36c2f5[_0x09c0('0x3e')]:_0x360924['model'];if(!_0x8d27a5[_0x09c0('0x3a')][_0x09c0('0x41')](_0x09c0('0x42'))){_0x36c2f5[_0x09c0('0x27')]=qs[_0x09c0('0x27')](_0x8d27a5['query'][_0x09c0('0x27')]);_0x36c2f5[_0x09c0('0x26')]=qs[_0x09c0('0x26')](_0x8d27a5[_0x09c0('0x3a')][_0x09c0('0x26')]);}_0x36c2f5[_0x09c0('0x43')]=qs['sort'](_0x8d27a5['query']['sort']);_0x36c2f5['where']=qs[_0x09c0('0x46')](_[_0x09c0('0x5b')](_0x8d27a5[_0x09c0('0x3a')],_0x360924['filters']));_0x36c2f5[_0x09c0('0x45')]['ListId']=_0x2906cb['id'];if(_0x8d27a5[_0x09c0('0x3a')][_0x09c0('0x49')]){_0x36c2f5['where']=_[_0x09c0('0x47')](_0x36c2f5['where'],{'$or':_['map'](_0x36c2f5[_0x09c0('0x3e')],function(_0x111647){var _0xde4ccc={};_0xde4ccc[_0x111647]={'$like':'%'+_0x8d27a5[_0x09c0('0x3a')][_0x09c0('0x49')]+'%'};return _0xde4ccc;})});}_0x36c2f5=_[_0x09c0('0x47')]({},_0x36c2f5,_0x8d27a5[_0x09c0('0x4e')]);return db[_0x09c0('0x5a')][_0x09c0('0x25')]({'where':_0x36c2f5[_0x09c0('0x45')]})['then'](function(_0x188af2){_0x4613e0[_0x09c0('0x25')]=_0x188af2;if(_0x8d27a5['query']['includeAll']){_0x36c2f5[_0x09c0('0x4b')]=[{'all':!![]}];}return db[_0x09c0('0x5a')][_0x09c0('0x5c')](_0x36c2f5);})[_0x09c0('0x2c')](function(_0x3310d2){_0x4613e0[_0x09c0('0x5d')]=_0x3310d2;return _0x4613e0;});}})[_0x09c0('0x2c')](respondWithFilteredResult(_0x24f23b,_0x36c2f5))['catch'](handleError(_0x24f23b,null));};exports[_0x09c0('0x5e')]=function(_0x56b94b,_0x399542,_0x1d1491){return db[_0x09c0('0x35')][_0x09c0('0x4f')]({'where':{'id':_0x56b94b[_0x09c0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x399542,null))[_0x09c0('0x2c')](function(_0x4ce49a){if(_0x4ce49a){return _0x4ce49a[_0x09c0('0x5e')](_0x56b94b['query'][_0x09c0('0x5f')]);}})[_0x09c0('0x2c')](respondWithStatusCode(_0x399542,null))[_0x09c0('0x4c')](handleError(_0x399542,null));};exports[_0x09c0('0x60')]=function(_0x3a1bb0,_0x14629c,_0x29e16){return db['CmList']['find']({'where':{'id':_0x3a1bb0[_0x09c0('0x4d')]['id']}})[_0x09c0('0x2c')](handleEntityNotFound(_0x14629c,null))[_0x09c0('0x2c')](function(_0x309d0a){if(_0x309d0a){var _0x31ed01=[];var _0x1041d9={'success':[],'errors':[]};return db[_0x09c0('0x61')][_0x09c0('0x56')]()[_0x09c0('0x2c')](function(_0x2af2ad){if(_0x3a1bb0['body']['tags']&&_['isArray'](_0x3a1bb0[_0x09c0('0x55')][_0x09c0('0x62')])){if(_0x3a1bb0[_0x09c0('0x55')]['tags']['length']){_0x3a1bb0[_0x09c0('0x55')]['tags']=_0x3a1bb0[_0x09c0('0x55')][_0x09c0('0x62')]['join'](';')+';';}else{_0x3a1bb0[_0x09c0('0x55')]['tags']=null;}}else{_0x3a1bb0[_0x09c0('0x55')][_0x09c0('0x62')]=null;}if(_0x3a1bb0[_0x09c0('0x55')]&&_['isArray'](_0x3a1bb0[_0x09c0('0x55')])){for(var _0x456adf=0x0;_0x456adf<_0x3a1bb0[_0x09c0('0x55')][_0x09c0('0x40')];_0x456adf+=0x1){_0x3a1bb0[_0x09c0('0x55')][_0x456adf][_0x09c0('0x58')]=_0x3a1bb0[_0x09c0('0x4d')]['id'];_0x31ed01[_0x09c0('0x63')](_0x3a1bb0[_0x09c0('0x55')][_0x456adf]);}return BPromise[_0x09c0('0x64')](_0x31ed01,function(_0x22efe8){return db[_0x09c0('0x61')]['create'](_[_0x09c0('0x65')](_0x22efe8,[_0x09c0('0x5f'),'id'])||{},{'fields':_[_0x09c0('0x3b')](_0x2af2ad),'raw':!![]})[_0x09c0('0x2c')](function(_0x45233b){_0x1041d9['success'][_0x09c0('0x63')](_0x45233b['dataValues']);})['catch'](function(_0x97d2d){_0x1041d9[_0x09c0('0x66')][_0x09c0('0x63')]({'data':_0x22efe8,'error':_0x97d2d['message']});});})[_0x09c0('0x2c')](function(_0x18a821){return _0x1041d9;})[_0x09c0('0x4c')](function(_0x42f327){return _0x42f327;});}else{_0x14629c[_0x09c0('0x22')](0x190)[_0x09c0('0x23')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x09c0('0x2c')](respondWithResult(_0x14629c,null))[_0x09c0('0x4c')](handleError(_0x14629c,null));};exports['getContacts']=function(_0x7d7b3a,_0x3c7ba0,_0x582dfe){var _0x474053;return db[_0x09c0('0x35')][_0x09c0('0x4f')]({'where':{'id':_0x7d7b3a['params']['id']},'include':[{'model':db[_0x09c0('0x67')],'as':_0x09c0('0x68')}]})['then'](handleEntityNotFound(_0x3c7ba0,null))[_0x09c0('0x2c')](function(_0x17050c){if(_0x17050c){_0x474053=_0x17050c;return db[_0x09c0('0x61')][_0x09c0('0x36')];}})[_0x09c0('0x2c')](function(_0x34dd1d){if(_0x34dd1d){var _0x41b5a6={};var _0x2e9dfd={};_0x2e9dfd['model']=_[_0x09c0('0x69')](_[_0x09c0('0x3b')](_0x34dd1d),_[_0x09c0('0x34')](_0x474053['CustomFields'],function(_0x131e1a){return util[_0x09c0('0x6a')](_0x09c0('0x6b'),_0x131e1a['id']);}));_0x2e9dfd['query']=_[_0x09c0('0x3b')](_0x7d7b3a[_0x09c0('0x3a')]);_0x2e9dfd[_0x09c0('0x46')]=_[_0x09c0('0x3c')](_0x2e9dfd[_0x09c0('0x3d')],_0x2e9dfd[_0x09c0('0x3a')]);_0x41b5a6[_0x09c0('0x3e')]=_['intersection'](_0x2e9dfd[_0x09c0('0x3d')],qs[_0x09c0('0x3f')](_0x7d7b3a[_0x09c0('0x3a')][_0x09c0('0x3f')]));_0x41b5a6[_0x09c0('0x3e')]=_0x41b5a6[_0x09c0('0x3e')][_0x09c0('0x40')]?_0x41b5a6['attributes']:_0x2e9dfd[_0x09c0('0x3d')];if(!_0x7d7b3a[_0x09c0('0x3a')][_0x09c0('0x41')](_0x09c0('0x42'))){_0x41b5a6['limit']=qs['limit'](_0x7d7b3a[_0x09c0('0x3a')][_0x09c0('0x27')]);_0x41b5a6[_0x09c0('0x26')]=qs['offset'](_0x7d7b3a[_0x09c0('0x3a')][_0x09c0('0x26')]);}_0x41b5a6[_0x09c0('0x43')]=qs[_0x09c0('0x44')](_0x7d7b3a['query'][_0x09c0('0x44')]);_0x41b5a6[_0x09c0('0x45')]=qs['filters'](_[_0x09c0('0x5b')](_0x7d7b3a[_0x09c0('0x3a')],_0x2e9dfd[_0x09c0('0x46')]));_0x41b5a6[_0x09c0('0x6c')]=!![];if(_0x7d7b3a[_0x09c0('0x3a')]['filter']){_0x41b5a6[_0x09c0('0x45')]=_[_0x09c0('0x47')](_0x41b5a6['where'],{'$or':_[_0x09c0('0x34')](_0x41b5a6[_0x09c0('0x3e')],function(_0x450ce4){var _0x475a03={};_0x475a03[_0x450ce4]={'$like':'%'+_0x7d7b3a[_0x09c0('0x3a')][_0x09c0('0x49')]+'%'};return _0x475a03;})});}_0x41b5a6=_['merge']({},_0x41b5a6,_0x7d7b3a['options']);return _0x474053[_0x09c0('0x6d')](_0x41b5a6);}})[_0x09c0('0x2c')](respondWithResult(_0x3c7ba0,null))[_0x09c0('0x4c')](handleError(_0x3c7ba0,null));};exports[_0x09c0('0x6e')]=function(_0x2d8d0a,_0x2a17a0,_0x3db01d){var _0x24cbdf;var _0x1b9f57;var _0x71d7a7;var _0x3ba21d=_0x2d8d0a[_0x09c0('0x4d')]['id'];csv_results=[];return db[_0x09c0('0x6f')]['findAll']({'attributes':['id',_0x09c0('0x32')],'raw':!![],'order':['OrderBy']})[_0x09c0('0x2c')](function(_0x5af234){_0x24cbdf=_0x5af234;var _0x4ce059=_[_0x09c0('0x3b')](db[_0x09c0('0x61')][_0x09c0('0x36')]);return db[_0x09c0('0x67')][_0x09c0('0x5c')]({'raw':!![],'attributes':['id','alias']})['then'](function(_0x347f02){_0x1b9f57=_0x347f02;var _0x1f00a3=squel['select']()[_0x09c0('0x3f')](_0x4ce059)[_0x09c0('0x70')](_0x09c0('0x71'),'c')[_0x09c0('0x45')](_0x09c0('0x72'),_0x3ba21d)['distinct']();for(var _0x2b6a09=0x0;_0x2b6a09<_0x1b9f57[_0x09c0('0x40')];_0x2b6a09++){_0x1f00a3[_0x09c0('0x73')](_0x09c0('0x74')+_0x1b9f57[_0x2b6a09]['id'],'customField_'+_0x1b9f57[_0x2b6a09][_0x09c0('0x75')]);}for(var _0x2b6a09=0x0;_0x2b6a09<_0x24cbdf['length'];_0x2b6a09++){_0x1f00a3['field'](squel['select']()[_0x09c0('0x73')](_0x09c0('0x76'))[_0x09c0('0x70')](_0x09c0('0x77'))[_0x09c0('0x45')]('ItemTypeId\x20=\x20?',_0x24cbdf[_0x2b6a09]['id'])['where']('CmContactId\x20=\x20c.id'),'additionalPhone_'+_0x24cbdf[_0x2b6a09][_0x09c0('0x32')]);_0x1f00a3[_0x09c0('0x73')](squel[_0x09c0('0x78')]()[_0x09c0('0x73')](_0x09c0('0x79'))[_0x09c0('0x70')]('cm_contact_has_items')[_0x09c0('0x45')](_0x09c0('0x7a'),_0x24cbdf[_0x2b6a09]['id'])['where'](_0x09c0('0x7b')),_0x09c0('0x7c')+_0x24cbdf[_0x2b6a09]['name']);}var _0x3e00c6=[];_0x3e00c6[_0x09c0('0x63')](_0x1f00a3[_0x09c0('0x7d')]());BPromise[_0x09c0('0x64')](_0x3e00c6,handleQuery)['then'](function(_0x3d62ed){handleQuery(_0x1f00a3[_0x09c0('0x7d')]());var _0x2284ab=csv_results[0x0];if(!_[_0x09c0('0x7e')](_0x2284ab)){var _0x34e81d=toCsv(_0x2284ab);var _0x2c7c2c=Date['now']();fs['writeFileSync'](util[_0x09c0('0x6a')](_0x09c0('0x7f'),_0x3ba21d,_0x2c7c2c),_0x34e81d);_0x2a17a0[_0x09c0('0x80')](_0x09c0('0x81'),_0x09c0('0x82')+util[_0x09c0('0x6a')](_0x09c0('0x83'),_0x3ba21d,_0x2c7c2c));_0x2a17a0[_0x09c0('0x80')]('Content-type','text/csv');return _0x2a17a0[_0x09c0('0x84')](util['format'](_0x09c0('0x7f'),_0x3ba21d,_0x2c7c2c));}else{return _0x2a17a0[_0x09c0('0x21')](0xcc);}});});});};exports['addCustomField']=function(_0x33af87,_0x5f3c92,_0x4a9e7c){var _0x8ffc99;delete _0x33af87[_0x09c0('0x55')]['id'];return db['CmList'][_0x09c0('0x59')]({'where':{'id':_0x33af87[_0x09c0('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5f3c92,null))[_0x09c0('0x2c')](function(_0x2c784b){if(_0x2c784b){return db[_0x09c0('0x85')][_0x09c0('0x86')](function(_0xe3213a){return db['CmCustomField'][_0x09c0('0x50')](_0x33af87['body'],{'transaction':_0xe3213a})[_0x09c0('0x2c')](function(_0x445994){_0x8ffc99=_0x445994;return _0x2c784b[_0x09c0('0x87')](_0x445994,{'transaction':_0xe3213a});})['then'](function(){var _0x558e2e={'type':db[_0x09c0('0x88')]['TEXT'],'transaction':_0xe3213a};switch(_0x33af87[_0x09c0('0x55')][_0x09c0('0x38')]){case _0x09c0('0x89'):_0x558e2e[_0x09c0('0x38')]=db[_0x09c0('0x88')][_0x09c0('0x8a')];break;case _0x09c0('0x8b'):_0x558e2e['type']=db[_0x09c0('0x88')][_0x09c0('0x8c')];break;case'switch':_0x558e2e['type']=db[_0x09c0('0x88')]['BOOLEAN'];_0x558e2e[_0x09c0('0x8d')]=![];break;default:}return db[_0x09c0('0x85')][_0x09c0('0x8e')][_0x09c0('0x8f')]('cm_contacts',util[_0x09c0('0x6a')](_0x09c0('0x90'),_0x8ffc99['id']),_0x558e2e);})[_0x09c0('0x2c')](function(){return _0x8ffc99;});});}})['then'](respondWithResult(_0x5f3c92,null))[_0x09c0('0x4c')](handleError(_0x5f3c92,null));};exports['getCustomFields']=function(_0x22df6d,_0x27de30,_0x2deeee){var _0x6cc6d8={};var _0x1b333c={};var _0x186280;var _0x5ae22c;return db[_0x09c0('0x35')][_0x09c0('0x59')]({'where':{'id':_0x22df6d['params']['id']}})[_0x09c0('0x2c')](handleEntityNotFound(_0x27de30,null))['then'](function(_0x3058c4){if(_0x3058c4){_0x186280=_0x3058c4;_0x1b333c[_0x09c0('0x3d')]=_[_0x09c0('0x3b')](db[_0x09c0('0x67')][_0x09c0('0x36')]);_0x1b333c[_0x09c0('0x3a')]=_['keys'](_0x22df6d[_0x09c0('0x3a')]);_0x1b333c[_0x09c0('0x46')]=_[_0x09c0('0x3c')](_0x1b333c[_0x09c0('0x3d')],_0x1b333c['query']);_0x6cc6d8[_0x09c0('0x3e')]=_[_0x09c0('0x3c')](_0x1b333c[_0x09c0('0x3d')],qs[_0x09c0('0x3f')](_0x22df6d['query'][_0x09c0('0x3f')]));_0x6cc6d8[_0x09c0('0x3e')]=_0x6cc6d8['attributes'][_0x09c0('0x40')]?_0x6cc6d8[_0x09c0('0x3e')]:_0x1b333c['model'];_0x6cc6d8[_0x09c0('0x43')]=qs[_0x09c0('0x44')](_0x22df6d[_0x09c0('0x3a')][_0x09c0('0x44')]);_0x6cc6d8[_0x09c0('0x45')]=qs[_0x09c0('0x46')](_[_0x09c0('0x5b')](_0x22df6d['query'],_0x1b333c[_0x09c0('0x46')]));_0x6cc6d8['where']=_['merge'](_0x6cc6d8[_0x09c0('0x45')],{'$or':[{'ListId':_0x3058c4['id']},{'ListId':null}]});if(_0x22df6d[_0x09c0('0x3a')]['filter']){_0x6cc6d8[_0x09c0('0x45')]=_[_0x09c0('0x47')](_0x6cc6d8['where'],{'$or':_[_0x09c0('0x34')](_0x6cc6d8['attributes'],function(_0x3f194f){var _0x306a54={};_0x306a54[_0x3f194f]={'$like':'%'+_0x22df6d[_0x09c0('0x3a')][_0x09c0('0x49')]+'%'};return _0x306a54;})});}_0x6cc6d8=_[_0x09c0('0x47')]({},_0x6cc6d8,_0x22df6d[_0x09c0('0x4e')]);return db[_0x09c0('0x67')][_0x09c0('0x91')](_0x6cc6d8);}})[_0x09c0('0x2c')](respondWithResult(_0x27de30,null))[_0x09c0('0x4c')](handleError(_0x27de30,null));};exports[_0x09c0('0x92')]=function(_0x11ab24,_0x51df74,_0x18acaf){return db[_0x09c0('0x35')][_0x09c0('0x4f')]({'where':{'id':_0x11ab24['params']['id']}})[_0x09c0('0x2c')](handleEntityNotFound(_0x51df74,null))['then'](function(_0x54728b){if(_0x54728b){return _0x54728b[_0x09c0('0x92')](_0x11ab24['body'][_0x09c0('0x5f')],_[_0x09c0('0x65')](_0x11ab24[_0x09c0('0x55')],[_0x09c0('0x5f'),'id'])||{})[_0x09c0('0x93')](function(_0x39a238){for(var _0x461ad4=0x0;_0x461ad4<_0x11ab24['body'][_0x09c0('0x5f')][_0x09c0('0x40')];_0x461ad4+=0x1){socket[_0x09c0('0x94')](_0x09c0('0x95'),{'UserId':Number(_0x11ab24[_0x09c0('0x55')][_0x09c0('0x5f')][_0x461ad4]),'CmListId':Number(_0x11ab24[_0x09c0('0x4d')]['id'])});}return _0x39a238;});}})[_0x09c0('0x2c')](respondWithResult(_0x51df74,null))[_0x09c0('0x4c')](handleError(_0x51df74,null));};exports[_0x09c0('0x96')]=function(_0x1caaeb,_0x1578c1,_0x1c52cf){return db[_0x09c0('0x35')][_0x09c0('0x4f')]({'where':{'id':_0x1caaeb[_0x09c0('0x4d')]['id']}})[_0x09c0('0x2c')](handleEntityNotFound(_0x1578c1,null))['then'](function(_0x3135b5){if(_0x3135b5){return _0x3135b5[_0x09c0('0x96')](_0x1caaeb[_0x09c0('0x3a')]['ids'])[_0x09c0('0x2c')](function(){if(_[_0x09c0('0x97')](_0x1caaeb[_0x09c0('0x3a')]['ids'])){for(var _0x2979ec=0x0;_0x2979ec<_0x1caaeb[_0x09c0('0x3a')][_0x09c0('0x5f')][_0x09c0('0x40')];_0x2979ec+=0x1){socket[_0x09c0('0x94')](_0x09c0('0x98'),{'UserId':Number(_0x1caaeb[_0x09c0('0x3a')][_0x09c0('0x5f')][_0x2979ec]),'CmListId':Number(_0x1caaeb[_0x09c0('0x4d')]['id'])});}}else{socket[_0x09c0('0x94')]('userCmList:remove',{'UserId':Number(_0x1caaeb[_0x09c0('0x3a')]['ids']),'CmListId':Number(_0x1caaeb[_0x09c0('0x4d')]['id'])});}});}})[_0x09c0('0x2c')](respondWithStatusCode(_0x1578c1,null))['catch'](handleError(_0x1578c1,null));};exports[_0x09c0('0x99')]=function(_0x425488,_0x450414,_0x57653e){var _0x1ba8eb={};var _0x468d78={};var _0x1aa32f;var _0x2eb784;return db[_0x09c0('0x35')][_0x09c0('0x59')]({'where':{'id':_0x425488[_0x09c0('0x4d')]['id']}})[_0x09c0('0x2c')](handleEntityNotFound(_0x450414,null))[_0x09c0('0x2c')](function(_0x2179e0){if(_0x2179e0){_0x1aa32f=_0x2179e0;_0x468d78['model']=_['keys'](db['User'][_0x09c0('0x36')]);_0x468d78[_0x09c0('0x3a')]=_['keys'](_0x425488[_0x09c0('0x3a')]);_0x468d78[_0x09c0('0x46')]=_[_0x09c0('0x3c')](_0x468d78[_0x09c0('0x3d')],_0x468d78[_0x09c0('0x3a')]);_0x1ba8eb[_0x09c0('0x3e')]=_[_0x09c0('0x3c')](_0x468d78[_0x09c0('0x3d')],qs[_0x09c0('0x3f')](_0x425488[_0x09c0('0x3a')][_0x09c0('0x3f')]));_0x1ba8eb[_0x09c0('0x3e')]=_0x1ba8eb['attributes'][_0x09c0('0x40')]?_0x1ba8eb[_0x09c0('0x3e')]:_0x468d78[_0x09c0('0x3d')];_0x1ba8eb[_0x09c0('0x43')]=qs[_0x09c0('0x44')](_0x425488[_0x09c0('0x3a')][_0x09c0('0x44')]);_0x1ba8eb[_0x09c0('0x45')]=qs[_0x09c0('0x46')](_[_0x09c0('0x5b')](_0x425488[_0x09c0('0x3a')],_0x468d78['filters']));if(_0x425488[_0x09c0('0x3a')][_0x09c0('0x49')]){_0x1ba8eb[_0x09c0('0x45')]=_['merge'](_0x1ba8eb[_0x09c0('0x45')],{'$or':_[_0x09c0('0x34')](_0x1ba8eb[_0x09c0('0x3e')],function(_0x2f9b5e){var _0x22ebcc={};_0x22ebcc[_0x2f9b5e]={'$like':'%'+_0x425488['query'][_0x09c0('0x49')]+'%'};return _0x22ebcc;})});}_0x1ba8eb=_[_0x09c0('0x47')]({},_0x1ba8eb,_0x425488[_0x09c0('0x4e')]);return _0x1aa32f[_0x09c0('0x99')](_0x1ba8eb);}})[_0x09c0('0x2c')](function(_0x18710c){if(_0x18710c){_0x2eb784=_0x18710c[_0x09c0('0x40')];if(!_0x425488['query'][_0x09c0('0x41')](_0x09c0('0x42'))){_0x1ba8eb[_0x09c0('0x27')]=qs['limit'](_0x425488[_0x09c0('0x3a')][_0x09c0('0x27')]);_0x1ba8eb[_0x09c0('0x26')]=qs[_0x09c0('0x26')](_0x425488[_0x09c0('0x3a')][_0x09c0('0x26')]);}return _0x1aa32f[_0x09c0('0x99')](_0x1ba8eb);}})[_0x09c0('0x2c')](function(_0x47ebdb){if(_0x47ebdb){return _0x47ebdb?{'count':_0x2eb784,'rows':_0x47ebdb}:null;}})['then'](respondWithResult(_0x450414,null))[_0x09c0('0x4c')](handleError(_0x450414,null));};function handleQuery(_0x4f1145){logger[_0x09c0('0x9a')](_0x4f1145);return db['sequelize'][_0x09c0('0x3a')](_0x4f1145)[_0x09c0('0x93')](function(_0x5dd07a){csv_results[_0x09c0('0x63')](_0x5dd07a);})[_0x09c0('0x4c')](function(_0x31f7b4){logger[_0x09c0('0x31')](_0x31f7b4[_0x09c0('0x9b')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 5051054..e3e7abc 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x1ea5a1,_0x490472){var _0xd53a86=function(_0x10bbcb){while(--_0x10bbcb){_0x1ea5a1['push'](_0x1ea5a1['shift']());}};_0xd53a86(++_0x490472);}(_0x814b,0x1a2));var _0xb814=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0x814b[_0x344a3f];return _0x264712;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0x5fc3[_0x56756b];return _0xa3002;};'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 4c3575c..910adcc 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 _0xb821=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','../../config/logger','bluebird'];(function(_0x4ac593,_0x1f4485){var _0xb9fd01=function(_0x3a3e3c){while(--_0x3a3e3c){_0x4ac593['push'](_0x4ac593['shift']());}};_0xb9fd01(++_0x1f4485);}(_0xb821,0xa7));var _0x1b82=function(_0x2aa681,_0x247d87){_0x2aa681=_0x2aa681-0x0;var _0x25933a=_0xb821[_0x2aa681];return _0x25933a;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55e0=['./cmList.attributes','exports','define','cm_lists','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x55e0,0xdc));var _0x055e=function(_0x22487b,_0x3a9021){_0x22487b=_0x22487b-0x0;var _0x2949ef=_0x55e0[_0x22487b];return _0x2949ef;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x055e('0x4'));var fs=require('fs');var path=require(_0x055e('0x5'));var rimraf=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var attributes=require(_0x055e('0x8'));module[_0x055e('0x9')]=function(_0x490ee1,_0x5239f6){return _0x490ee1[_0x055e('0xa')]('CmList',attributes,{'tableName':_0x055e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index cf0c409..ab144c2 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 _0x0dfb=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./cmList.socket','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','message','util','bluebird'];(function(_0x187e24,_0x393e15){var _0x39b658=function(_0x386c91){while(--_0x386c91){_0x187e24['push'](_0x187e24['shift']());}};_0x39b658(++_0x393e15);}(_0x0dfb,0xae));var _0xb0df=function(_0x5c7f60,_0x479aae){_0x5c7f60=_0x5c7f60-0x0;var _0x5057a8=_0x0dfb[_0x5c7f60];return _0x5057a8;};'use strict';var _=require('lodash');var util=require(_0xb0df('0x0'));var moment=require('moment');var BPromise=require(_0xb0df('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb0df('0x2'));var db=require(_0xb0df('0x3'))['db'];var utils=require(_0xb0df('0x4'));var logger=require(_0xb0df('0x5'))(_0xb0df('0x6'));var config=require(_0xb0df('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb0df('0x8')]({'port':0x232a});config[_0xb0df('0x9')]=_[_0xb0df('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb0df('0xb'))(new Redis(config[_0xb0df('0x9')]));require(_0xb0df('0xc'))['register'](socket);function respondWithRpcPromise(_0x2d4cec,_0x431979,_0x38c180){return new BPromise(function(_0xf087f5,_0x242427){return client[_0xb0df('0xd')](_0x2d4cec,_0x38c180)[_0xb0df('0xe')](function(_0x52bd32){logger[_0xb0df('0xf')](_0xb0df('0x10'),_0x431979,_0xb0df('0x11'));logger[_0xb0df('0x12')](_0xb0df('0x13'),_0x431979,_0xb0df('0x11'),JSON['stringify'](_0x52bd32));if(_0x52bd32[_0xb0df('0x14')]){if(_0x52bd32[_0xb0df('0x14')]['code']===0x1f4){logger[_0xb0df('0x14')]('CmList,\x20%s,\x20%s',_0x431979,_0x52bd32[_0xb0df('0x14')][_0xb0df('0x15')]);return _0x242427(_0x52bd32[_0xb0df('0x14')][_0xb0df('0x15')]);}logger['error'](_0xb0df('0x10'),_0x431979,_0x52bd32['error'][_0xb0df('0x15')]);return _0xf087f5(_0x52bd32[_0xb0df('0x14')][_0xb0df('0x15')]);}else{logger[_0xb0df('0xf')](_0xb0df('0x10'),_0x431979,_0xb0df('0x11'));_0xf087f5(_0x52bd32['result'][_0xb0df('0x15')]);}})['catch'](function(_0x429b07){logger[_0xb0df('0x14')](_0xb0df('0x10'),_0x431979,_0x429b07);_0x242427(_0x429b07);});});} \ No newline at end of file +var _0x2c8f=['http','redis','defaults','socket.io-emitter','./cmList.socket','register','request','then','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x2c8f,0x1e5));var _0xf2c8=function(_0x1d69d2,_0x2ef689){_0x1d69d2=_0x1d69d2-0x0;var _0x10b3ba=_0x2c8f[_0x1d69d2];return _0x10b3ba;};'use strict';var _=require(_0xf2c8('0x0'));var util=require(_0xf2c8('0x1'));var moment=require(_0xf2c8('0x2'));var BPromise=require(_0xf2c8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf2c8('0x4'))['db'];var utils=require(_0xf2c8('0x5'));var logger=require(_0xf2c8('0x6'))(_0xf2c8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf2c8('0x8')][_0xf2c8('0x9')]({'port':0x232a});config[_0xf2c8('0xa')]=_[_0xf2c8('0xb')](config[_0xf2c8('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf2c8('0xc'))(new Redis(config[_0xf2c8('0xa')]));require(_0xf2c8('0xd'))[_0xf2c8('0xe')](socket);function respondWithRpcPromise(_0x2a953b,_0x5a7d19,_0xa56b8d){return new BPromise(function(_0x5a950d,_0x10c67b){return client[_0xf2c8('0xf')](_0x2a953b,_0xa56b8d)[_0xf2c8('0x10')](function(_0x1eb544){logger['info'](_0xf2c8('0x11'),_0x5a7d19,'request\x20sent');logger['debug'](_0xf2c8('0x12'),_0x5a7d19,_0xf2c8('0x13'),JSON[_0xf2c8('0x14')](_0x1eb544));if(_0x1eb544[_0xf2c8('0x15')]){if(_0x1eb544[_0xf2c8('0x15')][_0xf2c8('0x16')]===0x1f4){logger[_0xf2c8('0x15')](_0xf2c8('0x11'),_0x5a7d19,_0x1eb544[_0xf2c8('0x15')][_0xf2c8('0x17')]);return _0x10c67b(_0x1eb544[_0xf2c8('0x15')][_0xf2c8('0x17')]);}logger[_0xf2c8('0x15')](_0xf2c8('0x11'),_0x5a7d19,_0x1eb544[_0xf2c8('0x15')][_0xf2c8('0x17')]);return _0x5a950d(_0x1eb544[_0xf2c8('0x15')][_0xf2c8('0x17')]);}else{logger[_0xf2c8('0x18')](_0xf2c8('0x11'),_0x5a7d19,_0xf2c8('0x13'));_0x5a950d(_0x1eb544['result'][_0xf2c8('0x17')]);}})[_0xf2c8('0x19')](function(_0xed5021){logger[_0xf2c8('0x15')](_0xf2c8('0x11'),_0x5a7d19,_0xed5021);_0x10c67b(_0xed5021);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index dc2f3e6..cedd998 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 _0xa081=['cmList:','./cmList.events','emit','register','length'];(function(_0x361fa2,_0x3cca67){var _0x30597a=function(_0x2feede){while(--_0x2feede){_0x361fa2['push'](_0x361fa2['shift']());}};_0x30597a(++_0x3cca67);}(_0xa081,0x146));var _0x1a08=function(_0xf28bed,_0x2d9f8c){_0xf28bed=_0xf28bed-0x0;var _0x2a7c1a=_0xa081[_0xf28bed];return _0x2a7c1a;};'use strict';var CmListEvents=require(_0x1a08('0x0'));var events=['save','remove','update'];function createListener(_0x31384e,_0x438aa5){return function(_0x3c805f){_0x438aa5[_0x1a08('0x1')](_0x31384e,_0x3c805f);};}function removeListener(_0x140336,_0x3e981d){return function(){CmListEvents['removeListener'](_0x140336,_0x3e981d);};}exports[_0x1a08('0x2')]=function(_0x4ae349){for(var _0x5ac2d5=0x0,_0x165e70=events[_0x1a08('0x3')];_0x5ac2d5<_0x165e70;_0x5ac2d5++){var _0xcbf95=events[_0x5ac2d5];var _0x2d396f=createListener(_0x1a08('0x4')+_0xcbf95,_0x4ae349);CmListEvents['on'](_0xcbf95,_0x2d396f);}}; \ No newline at end of file +var _0x3e0b=['removeListener','register','save','remove','update'];(function(_0x1f62c3,_0x1ff95b){var _0x385c1c=function(_0x1db580){while(--_0x1db580){_0x1f62c3['push'](_0x1f62c3['shift']());}};_0x385c1c(++_0x1ff95b);}(_0x3e0b,0x151));var _0xb3e0=function(_0x21a83f,_0xb70c9c){_0x21a83f=_0x21a83f-0x0;var _0x59e63d=_0x3e0b[_0x21a83f];return _0x59e63d;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xb3e0('0x0'),_0xb3e0('0x1'),_0xb3e0('0x2')];function createListener(_0x26df8c,_0x5f2da4){return function(_0x3cb028){_0x5f2da4['emit'](_0x26df8c,_0x3cb028);};}function removeListener(_0x128b3a,_0x1b741e){return function(){CmListEvents[_0xb3e0('0x3')](_0x128b3a,_0x1b741e);};}exports[_0xb3e0('0x4')]=function(_0x5533a8){for(var _0x446f1b=0x0,_0x1f1e5a=events['length'];_0x446f1b<_0x1f1e5a;_0x446f1b++){var _0xa28ab1=events[_0x446f1b];var _0x5b953=createListener('cmList:'+_0xa28ab1,_0x5533a8);CmListEvents['on'](_0xa28ab1,_0x5b953);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 8d65d7f..3df6037 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 _0xf85a=['isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/contacts','getContacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addDisposition','addContacts','addCustomField','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./cmList.controller','get'];(function(_0x48b491,_0x1599e1){var _0x57bfeb=function(_0x4eedff){while(--_0x4eedff){_0x48b491['push'](_0x48b491['shift']());}};_0x57bfeb(++_0x1599e1);}(_0xf85a,0xbd));var _0xaf85=function(_0x24bdf9,_0x530d81){_0x24bdf9=_0x24bdf9-0x0;var _0x2a3b9c=_0xf85a[_0x24bdf9];return _0x2a3b9c;};'use strict';var multer=require(_0xaf85('0x0'));var util=require(_0xaf85('0x1'));var path=require(_0xaf85('0x2'));var timeout=require(_0xaf85('0x3'));var express=require(_0xaf85('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaf85('0x5'));var interaction=require(_0xaf85('0x6'));var config=require('../../config/environment');var controller=require(_0xaf85('0x7'));router[_0xaf85('0x8')]('/',auth[_0xaf85('0x9')](),controller[_0xaf85('0xa')]);router[_0xaf85('0x8')]('/describe',auth[_0xaf85('0x9')](),controller[_0xaf85('0xb')]);router['get'](_0xaf85('0xc'),auth[_0xaf85('0x9')](),controller[_0xaf85('0xd')]);router['get'](_0xaf85('0xe'),auth[_0xaf85('0x9')](),controller['getDispositions']);router['get'](_0xaf85('0xf'),auth['isAuthenticated'](),controller[_0xaf85('0x10')]);router[_0xaf85('0x8')]('/:id/contacts/csv',auth['isAuthenticated'](),controller[_0xaf85('0x11')]);router['get'](_0xaf85('0x12'),auth[_0xaf85('0x9')](),controller[_0xaf85('0x13')]);router[_0xaf85('0x8')](_0xaf85('0x14'),auth[_0xaf85('0x9')](),controller[_0xaf85('0x15')]);router['post']('/',auth[_0xaf85('0x9')](),controller[_0xaf85('0x16')]);router[_0xaf85('0x17')](_0xaf85('0xe'),auth[_0xaf85('0x9')](),controller[_0xaf85('0x18')]);router[_0xaf85('0x17')](_0xaf85('0xf'),auth[_0xaf85('0x9')](),controller[_0xaf85('0x19')]);router['post'](_0xaf85('0x12'),auth[_0xaf85('0x9')](),controller[_0xaf85('0x1a')]);router[_0xaf85('0x17')]('/:id/users',auth[_0xaf85('0x9')](),controller['addAgents']);router[_0xaf85('0x1b')]('/:id',auth[_0xaf85('0x9')](),controller[_0xaf85('0x1c')]);router[_0xaf85('0x1d')]('/:id',auth[_0xaf85('0x9')](),controller[_0xaf85('0x1e')]);router['delete'](_0xaf85('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xaf85('0x1d')](_0xaf85('0x14'),auth['isAuthenticated'](),controller[_0xaf85('0x1f')]);module[_0xaf85('0x20')]=router; \ No newline at end of file +var _0x9f5e=['put','update','delete','destroy','removeDispositions','removeAgents','exports','connect-timeout','express','fs-extra','../../components/auth/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','getCustomFields','getAgents','post','create','addContacts','/:id/fields','addCustomField','/:id/users','addAgents'];(function(_0x13a5a8,_0x186495){var _0x397582=function(_0x33dc56){while(--_0x33dc56){_0x13a5a8['push'](_0x13a5a8['shift']());}};_0x397582(++_0x186495);}(_0x9f5e,0x167));var _0xe9f5=function(_0x154628,_0x5bdb5a){_0x154628=_0x154628-0x0;var _0x1e9b20=_0x9f5e[_0x154628];return _0x1e9b20;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe9f5('0x0'));var express=require(_0xe9f5('0x1'));var router=express['Router']();var fs_extra=require(_0xe9f5('0x2'));var auth=require(_0xe9f5('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe9f5('0x4'));router[_0xe9f5('0x5')]('/',auth[_0xe9f5('0x6')](),controller[_0xe9f5('0x7')]);router[_0xe9f5('0x5')](_0xe9f5('0x8'),auth[_0xe9f5('0x6')](),controller[_0xe9f5('0x9')]);router[_0xe9f5('0x5')](_0xe9f5('0xa'),auth['isAuthenticated'](),controller[_0xe9f5('0xb')]);router['get'](_0xe9f5('0xc'),auth[_0xe9f5('0x6')](),controller[_0xe9f5('0xd')]);router[_0xe9f5('0x5')](_0xe9f5('0xe'),auth[_0xe9f5('0x6')](),controller[_0xe9f5('0xf')]);router[_0xe9f5('0x5')]('/:id/contacts/csv',auth[_0xe9f5('0x6')](),controller['getContactsCsv']);router[_0xe9f5('0x5')]('/:id/fields',auth[_0xe9f5('0x6')](),controller[_0xe9f5('0x10')]);router[_0xe9f5('0x5')]('/:id/users',auth[_0xe9f5('0x6')](),controller[_0xe9f5('0x11')]);router[_0xe9f5('0x12')]('/',auth[_0xe9f5('0x6')](),controller[_0xe9f5('0x13')]);router['post']('/:id/dispositions',auth[_0xe9f5('0x6')](),controller['addDisposition']);router[_0xe9f5('0x12')](_0xe9f5('0xe'),auth[_0xe9f5('0x6')](),controller[_0xe9f5('0x14')]);router[_0xe9f5('0x12')](_0xe9f5('0x15'),auth[_0xe9f5('0x6')](),controller[_0xe9f5('0x16')]);router[_0xe9f5('0x12')](_0xe9f5('0x17'),auth[_0xe9f5('0x6')](),controller[_0xe9f5('0x18')]);router[_0xe9f5('0x19')]('/:id',auth[_0xe9f5('0x6')](),controller[_0xe9f5('0x1a')]);router[_0xe9f5('0x1b')](_0xe9f5('0xa'),auth[_0xe9f5('0x6')](),controller[_0xe9f5('0x1c')]);router[_0xe9f5('0x1b')](_0xe9f5('0xc'),auth[_0xe9f5('0x6')](),controller[_0xe9f5('0x1d')]);router[_0xe9f5('0x1b')](_0xe9f5('0x17'),auth['isAuthenticated'](),controller[_0xe9f5('0x1e')]);module[_0xe9f5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index aaeb0a8..4714129 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 _0x988b=['exports','VIRTUAL','field','STRING','sequelize'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x988b,0x1e9));var _0xb988=function(_0x495c52,_0x53c0cc){_0x495c52=_0x495c52-0x0;var _0x2b4bb2=_0x988b[_0x495c52];return _0x2b4bb2;};'use strict';var Sequelize=require(_0xb988('0x0'));module[_0xb988('0x1')]={'name':{'type':Sequelize[_0xb988('0x2')],'get':function(_0x4b5f46){return this['getDataValue'](_0xb988('0x3'));}},'field':{'type':Sequelize[_0xb988('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xb988('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xb988('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x20ec=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x20ec,0x1f1));var _0xc20e=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x20ec[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0xc20e('0x0'));module[_0xc20e('0x1')]={'name':{'type':Sequelize[_0xc20e('0x2')],'get':function(_0x1e3a17){return this[_0xc20e('0x3')](_0xc20e('0x4'));}},'field':{'type':Sequelize[_0xc20e('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xc20e('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xc20e('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 4ec3379..d154162 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x22af8c,_0x16aa71){var _0x11963a=function(_0x1d2e05){while(--_0x1d2e05){_0x22af8c['push'](_0x22af8c['shift']());}};_0x11963a(++_0x16aa71);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x58e9d8,_0x2bafc8){var _0x189aa4=function(_0x5243b6){while(--_0x5243b6){_0x58e9d8['push'](_0x58e9d8['shift']());}};_0x189aa4(++_0x2bafc8);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index fd9a2af..39803b6 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 _0x68bc=['bluebird','path','define','Condition','lodash','util','api','moment'];(function(_0x402731,_0x43c115){var _0x111736=function(_0x5a7044){while(--_0x5a7044){_0x402731['push'](_0x402731['shift']());}};_0x111736(++_0x43c115);}(_0x68bc,0x144));var _0xc68b=function(_0x39f01f,_0x3d5dbb){_0x39f01f=_0x39f01f-0x0;var _0xe641e4=_0x68bc[_0x39f01f];return _0xe641e4;};'use strict';var _=require(_0xc68b('0x0'));var util=require(_0xc68b('0x1'));var logger=require('../../config/logger')(_0xc68b('0x2'));var moment=require(_0xc68b('0x3'));var BPromise=require(_0xc68b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc68b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./condition.attributes');module['exports']=function(_0xd7cceb,_0x44265d){return _0xd7cceb[_0xc68b('0x6')](_0xc68b('0x7'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1bd=['./condition.attributes','exports','Condition','tools_conditions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0xc1bd,0x118));var _0xdc1b=function(_0x2853ce,_0x23f70e){_0x2853ce=_0x2853ce-0x0;var _0x266a31=_0xc1bd[_0x2853ce];return _0x266a31;};'use strict';var _=require(_0xdc1b('0x0'));var util=require('util');var logger=require(_0xdc1b('0x1'))(_0xdc1b('0x2'));var moment=require(_0xdc1b('0x3'));var BPromise=require(_0xdc1b('0x4'));var rp=require(_0xdc1b('0x5'));var fs=require('fs');var path=require(_0xdc1b('0x6'));var rimraf=require('rimraf');var config=require(_0xdc1b('0x7'));var attributes=require(_0xdc1b('0x8'));module[_0xdc1b('0x9')]=function(_0x390591,_0x317795){return _0x390591['define'](_0xdc1b('0xa'),attributes,{'tableName':_0xdc1b('0xb'),'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 68b53b6..4ba6c14 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 _0xce5f=['code','message','Condition,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error'];(function(_0x2fb1ad,_0x22c2a5){var _0x5bab95=function(_0x4b7f6a){while(--_0x4b7f6a){_0x2fb1ad['push'](_0x2fb1ad['shift']());}};_0x5bab95(++_0x22c2a5);}(_0xce5f,0xde));var _0xfce5=function(_0x18697a,_0x151a88){_0x18697a=_0x18697a-0x0;var _0xf15784=_0xce5f[_0x18697a];return _0xf15784;};'use strict';var _=require(_0xfce5('0x0'));var util=require(_0xfce5('0x1'));var moment=require(_0xfce5('0x2'));var BPromise=require(_0xfce5('0x3'));var rs=require(_0xfce5('0x4'));var fs=require('fs');var Redis=require(_0xfce5('0x5'));var db=require(_0xfce5('0x6'))['db'];var utils=require(_0xfce5('0x7'));var logger=require('../../config/logger')(_0xfce5('0x8'));var config=require(_0xfce5('0x9'));var jayson=require(_0xfce5('0xa'));var client=jayson[_0xfce5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfd4c2,_0x2e6733,_0x18c6f3){return new BPromise(function(_0x177777,_0xf98392){return client[_0xfce5('0xc')](_0xfd4c2,_0x18c6f3)[_0xfce5('0xd')](function(_0x4b78eb){logger['info']('Condition,\x20%s,\x20%s',_0x2e6733,_0xfce5('0xe'));logger[_0xfce5('0xf')](_0xfce5('0x10'),_0x2e6733,_0xfce5('0xe'),JSON['stringify'](_0x4b78eb));if(_0x4b78eb[_0xfce5('0x11')]){if(_0x4b78eb[_0xfce5('0x11')][_0xfce5('0x12')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x2e6733,_0x4b78eb['error'][_0xfce5('0x13')]);return _0xf98392(_0x4b78eb[_0xfce5('0x11')][_0xfce5('0x13')]);}logger['error'](_0xfce5('0x14'),_0x2e6733,_0x4b78eb[_0xfce5('0x11')]['message']);return _0x177777(_0x4b78eb['error']['message']);}else{logger[_0xfce5('0x15')](_0xfce5('0x14'),_0x2e6733,_0xfce5('0xe'));_0x177777(_0x4b78eb[_0xfce5('0x16')][_0xfce5('0x13')]);}})[_0xfce5('0x17')](function(_0x471721){logger[_0xfce5('0x11')]('Condition,\x20%s,\x20%s',_0x2e6733,_0x471721);_0xf98392(_0x471721);});});} \ No newline at end of file +var _0xed98=['error','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','request\x20sent'];(function(_0x100447,_0x3d10b5){var _0x37bcab=function(_0x17691e){while(--_0x17691e){_0x100447['push'](_0x100447['shift']());}};_0x37bcab(++_0x3d10b5);}(_0xed98,0xcb));var _0x8ed9=function(_0x1a798c,_0x4b66d1){_0x1a798c=_0x1a798c-0x0;var _0x43a000=_0xed98[_0x1a798c];return _0x43a000;};'use strict';var _=require(_0x8ed9('0x0'));var util=require(_0x8ed9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8ed9('0x2'));var fs=require('fs');var Redis=require(_0x8ed9('0x3'));var db=require(_0x8ed9('0x4'))['db'];var utils=require(_0x8ed9('0x5'));var logger=require(_0x8ed9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8ed9('0x7')][_0x8ed9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a6f9c,_0xb1398c,_0xa403a2){return new BPromise(function(_0xcabd07,_0x4ce2e7){return client[_0x8ed9('0x9')](_0x3a6f9c,_0xa403a2)[_0x8ed9('0xa')](function(_0x5acc20){logger[_0x8ed9('0xb')]('Condition,\x20%s,\x20%s',_0xb1398c,_0x8ed9('0xc'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0xb1398c,'request\x20sent',JSON['stringify'](_0x5acc20));if(_0x5acc20['error']){if(_0x5acc20[_0x8ed9('0xd')]['code']===0x1f4){logger[_0x8ed9('0xd')](_0x8ed9('0xe'),_0xb1398c,_0x5acc20[_0x8ed9('0xd')][_0x8ed9('0xf')]);return _0x4ce2e7(_0x5acc20[_0x8ed9('0xd')][_0x8ed9('0xf')]);}logger['error'](_0x8ed9('0xe'),_0xb1398c,_0x5acc20[_0x8ed9('0xd')][_0x8ed9('0xf')]);return _0xcabd07(_0x5acc20['error']['message']);}else{logger[_0x8ed9('0xb')](_0x8ed9('0xe'),_0xb1398c,_0x8ed9('0xc'));_0xcabd07(_0x5acc20[_0x8ed9('0x10')][_0x8ed9('0xf')]);}})[_0x8ed9('0x11')](function(_0x2656fe){logger[_0x8ed9('0xd')](_0x8ed9('0xe'),_0xb1398c,_0x2656fe);_0x4ce2e7(_0x2656fe);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 263bf9f..95fbea2 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 _0xfac9=['put','/:id','isAuthenticated','update','delete','destroy','util','connect-timeout','../../components/auth/service','../../config/environment'];(function(_0x3ace89,_0x234564){var _0x445e07=function(_0x3f4400){while(--_0x3f4400){_0x3ace89['push'](_0x3ace89['shift']());}};_0x445e07(++_0x234564);}(_0xfac9,0x1dc));var _0x9fac=function(_0x411f5f,_0x5b464a){_0x411f5f=_0x411f5f-0x0;var _0x2413cd=_0xfac9[_0x411f5f];return _0x2413cd;};'use strict';var multer=require('multer');var util=require(_0x9fac('0x0'));var path=require('path');var timeout=require(_0x9fac('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9fac('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x9fac('0x3'));var controller=require('./condition.controller');router[_0x9fac('0x4')](_0x9fac('0x5'),auth[_0x9fac('0x6')](),controller[_0x9fac('0x7')]);router[_0x9fac('0x8')](_0x9fac('0x5'),auth['isAuthenticated'](),controller[_0x9fac('0x9')]);module['exports']=router; \ No newline at end of file +var _0xb340=['multer','util','path','express','Router','fs-extra','../../components/interaction/service','./condition.controller','/:id','isAuthenticated','update','delete','destroy'];(function(_0x5a6a08,_0x1c2957){var _0x4dc396=function(_0x4a3b08){while(--_0x4a3b08){_0x5a6a08['push'](_0x5a6a08['shift']());}};_0x4dc396(++_0x1c2957);}(_0xb340,0x75));var _0x0b34=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xb340[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x0b34('0x0'));var util=require(_0x0b34('0x1'));var path=require(_0x0b34('0x2'));var timeout=require('connect-timeout');var express=require(_0x0b34('0x3'));var router=express[_0x0b34('0x4')]();var fs_extra=require(_0x0b34('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0b34('0x6'));var config=require('../../config/environment');var controller=require(_0x0b34('0x7'));router['put'](_0x0b34('0x8'),auth[_0x0b34('0x9')](),controller[_0x0b34('0xa')]);router[_0x0b34('0xb')](_0x0b34('0x8'),auth['isAuthenticated'](),controller[_0x0b34('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index f065a4c..494009c 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x958d=['name','INTEGER','sequelize','exports','STRING'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x958d,0xbb));var _0xd958=function(_0x1bfb78,_0x4decfd){_0x1bfb78=_0x1bfb78-0x0;var _0x54c11c=_0x958d[_0x1bfb78];return _0x54c11c;};'use strict';var Sequelize=require(_0xd958('0x0'));module[_0xd958('0x1')]={'name':{'type':Sequelize[_0xd958('0x2')],'allowNull':![],'unique':_0xd958('0x3')},'OrderBy':{'type':Sequelize[_0xd958('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xd958('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x116e=['name','INTEGER','STRING','sequelize','exports'];(function(_0x1a83c3,_0x1daad9){var _0x538187=function(_0x52cc0b){while(--_0x52cc0b){_0x1a83c3['push'](_0x1a83c3['shift']());}};_0x538187(++_0x1daad9);}(_0x116e,0x1de));var _0xe116=function(_0x3b1d1e,_0x10d8d9){_0x3b1d1e=_0x3b1d1e-0x0;var _0x5670b7=_0x116e[_0x3b1d1e];return _0x5670b7;};'use strict';var Sequelize=require(_0xe116('0x0'));module[_0xe116('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe116('0x2')},'OrderBy':{'type':Sequelize[_0xe116('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xe116('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index f4f995c..f55ed6e 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeba6=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','includeAll','catch','show','options','find','create','user','UserProfileSection','userProfileId','body','params','eml-format','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','ContactItemTypes','error','stack','name','send','index','map','ContactItemType'];(function(_0x17a95c,_0xb26a3d){var _0x1a81e3=function(_0x43641b){while(--_0x43641b){_0x17a95c['push'](_0x17a95c['shift']());}};_0x1a81e3(++_0xb26a3d);}(_0xeba6,0xff));var _0x6eba=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeba6[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x6eba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6eba('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6eba('0x2'));var moment=require('moment');var BPromise=require(_0x6eba('0x3'));var Mustache=require('mustache');var util=require(_0x6eba('0x4'));var path=require('path');var sox=require(_0x6eba('0x5'));var csv=require(_0x6eba('0x6'));var ejs=require(_0x6eba('0x7'));var fs=require('fs');var fs_extra=require(_0x6eba('0x8'));var _=require('lodash');var squel=require(_0x6eba('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6eba('0x6'));var querystring=require(_0x6eba('0xa'));var Papa=require(_0x6eba('0xb'));var Redis=require(_0x6eba('0xc'));var authService=require(_0x6eba('0xd'));var qs=require(_0x6eba('0xe'));var as=require(_0x6eba('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6eba('0x10'))(_0x6eba('0x11'));var utils=require('../../config/utils');var config=require(_0x6eba('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x6eba('0x13'))['db'];function respondWithStatusCode(_0x409763,_0x1b078b){_0x1b078b=_0x1b078b||0xcc;return function(_0x580c8e){if(_0x580c8e){return _0x409763[_0x6eba('0x14')](_0x1b078b);}return _0x409763[_0x6eba('0x15')](_0x1b078b)[_0x6eba('0x16')]();};}function respondWithResult(_0x1011ad,_0x1ba209){_0x1ba209=_0x1ba209||0xc8;return function(_0x2b010d){if(_0x2b010d){return _0x1011ad['status'](_0x1ba209)[_0x6eba('0x17')](_0x2b010d);}};}function respondWithFilteredResult(_0x4c2d8d,_0x4c9429){return function(_0x4de4e8){if(_0x4de4e8){var _0x3fb6d4=typeof _0x4c9429[_0x6eba('0x18')]==='undefined'&&typeof _0x4c9429[_0x6eba('0x19')]===_0x6eba('0x1a');var _0x114b70=_0x4de4e8[_0x6eba('0x1b')];var _0x3bbad0=_0x3fb6d4?0x0:_0x4c9429[_0x6eba('0x18')];var _0x341963=_0x3fb6d4?_0x4de4e8[_0x6eba('0x1b')]:_0x4c9429[_0x6eba('0x18')]+_0x4c9429[_0x6eba('0x19')];var _0x477785;if(_0x341963>=_0x114b70){_0x341963=_0x114b70;_0x477785=0xc8;}else{_0x477785=0xce;}_0x4c2d8d[_0x6eba('0x15')](_0x477785);return _0x4c2d8d[_0x6eba('0x1c')](_0x6eba('0x1d'),_0x3bbad0+'-'+_0x341963+'/'+_0x114b70)[_0x6eba('0x17')](_0x4de4e8);}return null;};}function patchUpdates(_0x4ef5a8){return function(_0x53295c){try{jsonpatch[_0x6eba('0x1e')](_0x53295c,_0x4ef5a8,!![]);}catch(_0x486865){return BPromise[_0x6eba('0x1f')](_0x486865);}return _0x53295c[_0x6eba('0x20')]();};}function saveUpdates(_0x55bd3e,_0x2e44f9){return function(_0xd5b665){if(_0xd5b665){return _0xd5b665[_0x6eba('0x21')](_0x55bd3e)['then'](function(_0x387bc9){return _0x387bc9;});}return null;};}function removeEntity(_0x3311c1,_0xaf8bb4){return function(_0x563464){if(_0x563464){return _0x563464[_0x6eba('0x22')]()[_0x6eba('0x23')](function(){var _0x18b8f5=_0x563464[_0x6eba('0x24')]({'plain':!![]});var _0x42c759=_0x6eba('0x25');return db['UserProfileResource'][_0x6eba('0x22')]({'where':{'type':_0x42c759,'resourceId':_0x18b8f5['id']}})[_0x6eba('0x23')](function(){return _0x563464;});})[_0x6eba('0x23')](function(){_0x3311c1[_0x6eba('0x15')](0xcc)[_0x6eba('0x16')]();});}};}function handleEntityNotFound(_0x9c11d3,_0x157cb2){return function(_0x33769c){if(!_0x33769c){_0x9c11d3[_0x6eba('0x14')](0x194);}return _0x33769c;};}function handleError(_0x29fd68,_0x1177b2){_0x1177b2=_0x1177b2||0x1f4;return function(_0x523e7c){logger[_0x6eba('0x26')](_0x523e7c[_0x6eba('0x27')]);if(_0x523e7c[_0x6eba('0x28')]){delete _0x523e7c['name'];}_0x29fd68[_0x6eba('0x15')](_0x1177b2)[_0x6eba('0x29')](_0x523e7c);};}exports[_0x6eba('0x2a')]=function(_0x3ec59d,_0x5c2919){var _0x50b1fe={},_0x4db886={},_0x3837c8={'count':0x0,'rows':[]};var _0x447370=_[_0x6eba('0x2b')](db[_0x6eba('0x2c')]['rawAttributes'],function(_0x55d5f3){return{'name':_0x55d5f3[_0x6eba('0x2d')],'type':_0x55d5f3[_0x6eba('0x2e')][_0x6eba('0x2f')]};});_0x4db886[_0x6eba('0x30')]=_[_0x6eba('0x2b')](_0x447370,'name');_0x4db886[_0x6eba('0x31')]=_[_0x6eba('0x32')](_0x3ec59d[_0x6eba('0x31')]);_0x4db886[_0x6eba('0x33')]=_[_0x6eba('0x34')](_0x4db886['model'],_0x4db886[_0x6eba('0x31')]);_0x50b1fe[_0x6eba('0x35')]=_[_0x6eba('0x34')](_0x4db886['model'],qs[_0x6eba('0x36')](_0x3ec59d[_0x6eba('0x31')]['fields']));_0x50b1fe['attributes']=_0x50b1fe[_0x6eba('0x35')][_0x6eba('0x37')]?_0x50b1fe[_0x6eba('0x35')]:_0x4db886[_0x6eba('0x30')];if(!_0x3ec59d[_0x6eba('0x31')][_0x6eba('0x38')](_0x6eba('0x39'))){_0x50b1fe[_0x6eba('0x19')]=qs[_0x6eba('0x19')](_0x3ec59d['query'][_0x6eba('0x19')]);_0x50b1fe['offset']=qs[_0x6eba('0x18')](_0x3ec59d[_0x6eba('0x31')][_0x6eba('0x18')]);}_0x50b1fe[_0x6eba('0x3a')]=qs['sort'](_0x3ec59d[_0x6eba('0x31')]['sort']);_0x50b1fe[_0x6eba('0x3b')]=qs['filters'](_[_0x6eba('0x3c')](_0x3ec59d[_0x6eba('0x31')],_0x4db886[_0x6eba('0x33')]),_0x447370);if(_0x3ec59d[_0x6eba('0x31')][_0x6eba('0x3d')]){_0x50b1fe[_0x6eba('0x3b')]=_['merge'](_0x50b1fe['where'],{'$or':_[_0x6eba('0x2b')](_0x447370,function(_0x2371ae){if(_0x2371ae[_0x6eba('0x2e')]!==_0x6eba('0x3e')){var _0xfa6d68={};_0xfa6d68[_0x2371ae[_0x6eba('0x28')]]={'$like':'%'+_0x3ec59d[_0x6eba('0x31')][_0x6eba('0x3d')]+'%'};return _0xfa6d68;}})});}_0x50b1fe=_[_0x6eba('0x3f')]({},_0x50b1fe,_0x3ec59d['options']);var _0x2db1cd={'where':_0x50b1fe[_0x6eba('0x3b')]};return db['ContactItemType'][_0x6eba('0x1b')](_0x2db1cd)[_0x6eba('0x23')](function(_0x319997){_0x3837c8[_0x6eba('0x1b')]=_0x319997;if(_0x3ec59d[_0x6eba('0x31')][_0x6eba('0x40')]){_0x50b1fe['include']=[{'all':!![]}];}return db[_0x6eba('0x2c')]['findAll'](_0x50b1fe);})[_0x6eba('0x23')](function(_0x166ff4){_0x3837c8['rows']=_0x166ff4;return _0x3837c8;})['then'](respondWithFilteredResult(_0x5c2919,_0x50b1fe))[_0x6eba('0x41')](handleError(_0x5c2919,null));};exports[_0x6eba('0x42')]=function(_0x2f4285,_0x5f36ea){var _0xf137a={'raw':!![],'where':{'id':_0x2f4285['params']['id']}},_0x381383={};_0x381383[_0x6eba('0x30')]=_[_0x6eba('0x32')](db['ContactItemType']['rawAttributes']);_0x381383['query']=_[_0x6eba('0x32')](_0x2f4285[_0x6eba('0x31')]);_0x381383[_0x6eba('0x33')]=_[_0x6eba('0x34')](_0x381383[_0x6eba('0x30')],_0x381383[_0x6eba('0x31')]);_0xf137a['attributes']=_[_0x6eba('0x34')](_0x381383[_0x6eba('0x30')],qs['fields'](_0x2f4285['query'][_0x6eba('0x36')]));_0xf137a[_0x6eba('0x35')]=_0xf137a[_0x6eba('0x35')][_0x6eba('0x37')]?_0xf137a[_0x6eba('0x35')]:_0x381383['model'];if(_0x2f4285['query'][_0x6eba('0x40')]){_0xf137a['include']=[{'all':!![]}];}_0xf137a=_[_0x6eba('0x3f')]({},_0xf137a,_0x2f4285[_0x6eba('0x43')]);return db[_0x6eba('0x2c')][_0x6eba('0x44')](_0xf137a)[_0x6eba('0x23')](handleEntityNotFound(_0x5f36ea,null))['then'](respondWithResult(_0x5f36ea,null))[_0x6eba('0x41')](handleError(_0x5f36ea,null));};exports['create']=function(_0x15babd,_0x128c93){return db[_0x6eba('0x2c')][_0x6eba('0x45')](_0x15babd['body'],{})[_0x6eba('0x23')](function(_0x3930da){var _0xabca15=_0x15babd[_0x6eba('0x46')]['get']({'plain':!![]});if(!_0xabca15)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xabca15['role']===_0x6eba('0x46')){var _0xd4d098=_0x3930da[_0x6eba('0x24')]({'plain':!![]});var _0x325cb3='ContactItemTypes';return db[_0x6eba('0x47')][_0x6eba('0x44')]({'where':{'name':_0x325cb3,'userProfileId':_0xabca15[_0x6eba('0x48')]},'raw':!![]})[_0x6eba('0x23')](function(_0xcc47e2){if(_0xcc47e2&&_0xcc47e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x6eba('0x45')]({'name':_0xd4d098[_0x6eba('0x28')],'resourceId':_0xd4d098['id'],'type':_0xcc47e2['name'],'sectionId':_0xcc47e2['id']},{})[_0x6eba('0x23')](function(){return _0x3930da;});}else{return _0x3930da;}})[_0x6eba('0x41')](function(_0x458d20){logger[_0x6eba('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x458d20);throw _0x458d20;});}return _0x3930da;})['then'](respondWithResult(_0x128c93,0xc9))[_0x6eba('0x41')](handleError(_0x128c93,null));};exports[_0x6eba('0x21')]=function(_0x175e0a,_0x53b045){if(_0x175e0a[_0x6eba('0x49')]['id']){delete _0x175e0a[_0x6eba('0x49')]['id'];}return db[_0x6eba('0x2c')][_0x6eba('0x44')]({'where':{'id':_0x175e0a[_0x6eba('0x4a')]['id']}})[_0x6eba('0x23')](handleEntityNotFound(_0x53b045,null))[_0x6eba('0x23')](saveUpdates(_0x175e0a['body'],null))[_0x6eba('0x23')](respondWithResult(_0x53b045,null))[_0x6eba('0x41')](handleError(_0x53b045,null));};exports['destroy']=function(_0x57c388,_0x35e407){return db[_0x6eba('0x2c')][_0x6eba('0x44')]({'where':{'id':_0x57c388[_0x6eba('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35e407,null))[_0x6eba('0x23')](removeEntity(_0x35e407,null))[_0x6eba('0x41')](handleError(_0x35e407,null));}; \ No newline at end of file +var _0xbbbf=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ContactItemTypes','error','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','includeAll','include','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end'];(function(_0x4e4a09,_0xe4eac8){var _0x17a756=function(_0x23b5ef){while(--_0x23b5ef){_0x4e4a09['push'](_0x4e4a09['shift']());}};_0x17a756(++_0xe4eac8);}(_0xbbbf,0x186));var _0xfbbb=function(_0x3c01ee,_0x44f651){_0x3c01ee=_0x3c01ee-0x0;var _0x6bc616=_0xbbbf[_0x3c01ee];return _0x6bc616;};'use strict';var emlformat=require(_0xfbbb('0x0'));var rimraf=require(_0xfbbb('0x1'));var zipdir=require(_0xfbbb('0x2'));var jsonpatch=require(_0xfbbb('0x3'));var rp=require(_0xfbbb('0x4'));var moment=require(_0xfbbb('0x5'));var BPromise=require(_0xfbbb('0x6'));var Mustache=require(_0xfbbb('0x7'));var util=require(_0xfbbb('0x8'));var path=require(_0xfbbb('0x9'));var sox=require(_0xfbbb('0xa'));var csv=require(_0xfbbb('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbbb('0xc'));var squel=require(_0xfbbb('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfbbb('0xb'));var querystring=require('querystring');var Papa=require(_0xfbbb('0xe'));var Redis=require('ioredis');var authService=require(_0xfbbb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfbbb('0x10'));var hardwareService=require(_0xfbbb('0x11'));var logger=require(_0xfbbb('0x12'))(_0xfbbb('0x13'));var utils=require(_0xfbbb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xfbbb('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e80aa,_0x4170e0){_0x4170e0=_0x4170e0||0xcc;return function(_0x4e2a00){if(_0x4e2a00){return _0x3e80aa[_0xfbbb('0x16')](_0x4170e0);}return _0x3e80aa[_0xfbbb('0x17')](_0x4170e0)[_0xfbbb('0x18')]();};}function respondWithResult(_0x554082,_0x665e0c){_0x665e0c=_0x665e0c||0xc8;return function(_0x1dae0c){if(_0x1dae0c){return _0x554082[_0xfbbb('0x17')](_0x665e0c)[_0xfbbb('0x19')](_0x1dae0c);}};}function respondWithFilteredResult(_0x352d98,_0x1dc1aa){return function(_0x7cd15f){if(_0x7cd15f){var _0x14a83a=typeof _0x1dc1aa[_0xfbbb('0x1a')]===_0xfbbb('0x1b')&&typeof _0x1dc1aa['limit']===_0xfbbb('0x1b');var _0x242e71=_0x7cd15f[_0xfbbb('0x1c')];var _0x5081ac=_0x14a83a?0x0:_0x1dc1aa[_0xfbbb('0x1a')];var _0x132075=_0x14a83a?_0x7cd15f['count']:_0x1dc1aa[_0xfbbb('0x1a')]+_0x1dc1aa[_0xfbbb('0x1d')];var _0x4acada;if(_0x132075>=_0x242e71){_0x132075=_0x242e71;_0x4acada=0xc8;}else{_0x4acada=0xce;}_0x352d98[_0xfbbb('0x17')](_0x4acada);return _0x352d98[_0xfbbb('0x1e')](_0xfbbb('0x1f'),_0x5081ac+'-'+_0x132075+'/'+_0x242e71)['json'](_0x7cd15f);}return null;};}function patchUpdates(_0x5d4947){return function(_0x3e8f3c){try{jsonpatch[_0xfbbb('0x20')](_0x3e8f3c,_0x5d4947,!![]);}catch(_0x5da6e1){return BPromise[_0xfbbb('0x21')](_0x5da6e1);}return _0x3e8f3c[_0xfbbb('0x22')]();};}function saveUpdates(_0x1cecad,_0x1c13c4){return function(_0x56f7c4){if(_0x56f7c4){return _0x56f7c4[_0xfbbb('0x23')](_0x1cecad)[_0xfbbb('0x24')](function(_0xd52346){return _0xd52346;});}return null;};}function removeEntity(_0x485ab2,_0x539c71){return function(_0x1bf549){if(_0x1bf549){return _0x1bf549[_0xfbbb('0x25')]()[_0xfbbb('0x24')](function(){var _0x57b3db=_0x1bf549[_0xfbbb('0x26')]({'plain':!![]});var _0x985749=_0xfbbb('0x27');return db['UserProfileResource'][_0xfbbb('0x25')]({'where':{'type':_0x985749,'resourceId':_0x57b3db['id']}})[_0xfbbb('0x24')](function(){return _0x1bf549;});})[_0xfbbb('0x24')](function(){_0x485ab2['status'](0xcc)[_0xfbbb('0x18')]();});}};}function handleEntityNotFound(_0x3a47f2,_0x406ff0){return function(_0x291f3d){if(!_0x291f3d){_0x3a47f2['sendStatus'](0x194);}return _0x291f3d;};}function handleError(_0x5afe5e,_0x384d13){_0x384d13=_0x384d13||0x1f4;return function(_0x280be4){logger[_0xfbbb('0x28')](_0x280be4['stack']);if(_0x280be4['name']){delete _0x280be4['name'];}_0x5afe5e[_0xfbbb('0x17')](_0x384d13)[_0xfbbb('0x29')](_0x280be4);};}exports[_0xfbbb('0x2a')]=function(_0x13220c,_0x303a78){var _0x330da8={},_0x3ea3bd={},_0x217699={'count':0x0,'rows':[]};var _0x272120=_[_0xfbbb('0x2b')](db[_0xfbbb('0x2c')][_0xfbbb('0x2d')],function(_0x22f530){return{'name':_0x22f530[_0xfbbb('0x2e')],'type':_0x22f530[_0xfbbb('0x2f')][_0xfbbb('0x30')]};});_0x3ea3bd['model']=_['map'](_0x272120,'name');_0x3ea3bd[_0xfbbb('0x31')]=_['keys'](_0x13220c['query']);_0x3ea3bd[_0xfbbb('0x32')]=_[_0xfbbb('0x33')](_0x3ea3bd[_0xfbbb('0x34')],_0x3ea3bd[_0xfbbb('0x31')]);_0x330da8[_0xfbbb('0x35')]=_[_0xfbbb('0x33')](_0x3ea3bd[_0xfbbb('0x34')],qs[_0xfbbb('0x36')](_0x13220c['query'][_0xfbbb('0x36')]));_0x330da8[_0xfbbb('0x35')]=_0x330da8[_0xfbbb('0x35')][_0xfbbb('0x37')]?_0x330da8[_0xfbbb('0x35')]:_0x3ea3bd[_0xfbbb('0x34')];if(!_0x13220c['query'][_0xfbbb('0x38')](_0xfbbb('0x39'))){_0x330da8[_0xfbbb('0x1d')]=qs[_0xfbbb('0x1d')](_0x13220c[_0xfbbb('0x31')][_0xfbbb('0x1d')]);_0x330da8[_0xfbbb('0x1a')]=qs[_0xfbbb('0x1a')](_0x13220c[_0xfbbb('0x31')]['offset']);}_0x330da8[_0xfbbb('0x3a')]=qs[_0xfbbb('0x3b')](_0x13220c[_0xfbbb('0x31')]['sort']);_0x330da8[_0xfbbb('0x3c')]=qs[_0xfbbb('0x32')](_[_0xfbbb('0x3d')](_0x13220c['query'],_0x3ea3bd[_0xfbbb('0x32')]),_0x272120);if(_0x13220c[_0xfbbb('0x31')][_0xfbbb('0x3e')]){_0x330da8[_0xfbbb('0x3c')]=_['merge'](_0x330da8[_0xfbbb('0x3c')],{'$or':_['map'](_0x272120,function(_0xd22908){if(_0xd22908[_0xfbbb('0x2f')]!==_0xfbbb('0x3f')){var _0x1f94a3={};_0x1f94a3[_0xd22908[_0xfbbb('0x40')]]={'$like':'%'+_0x13220c[_0xfbbb('0x31')][_0xfbbb('0x3e')]+'%'};return _0x1f94a3;}})});}_0x330da8=_[_0xfbbb('0x41')]({},_0x330da8,_0x13220c['options']);var _0x478c78={'where':_0x330da8[_0xfbbb('0x3c')]};return db[_0xfbbb('0x2c')][_0xfbbb('0x1c')](_0x478c78)[_0xfbbb('0x24')](function(_0x3b3cf6){_0x217699['count']=_0x3b3cf6;if(_0x13220c['query'][_0xfbbb('0x42')]){_0x330da8[_0xfbbb('0x43')]=[{'all':!![]}];}return db[_0xfbbb('0x2c')]['findAll'](_0x330da8);})[_0xfbbb('0x24')](function(_0x51b046){_0x217699[_0xfbbb('0x44')]=_0x51b046;return _0x217699;})[_0xfbbb('0x24')](respondWithFilteredResult(_0x303a78,_0x330da8))[_0xfbbb('0x45')](handleError(_0x303a78,null));};exports[_0xfbbb('0x46')]=function(_0x4a3a4d,_0x25f26d){var _0x258d72={'raw':!![],'where':{'id':_0x4a3a4d[_0xfbbb('0x47')]['id']}},_0x4ef756={};_0x4ef756['model']=_[_0xfbbb('0x48')](db['ContactItemType'][_0xfbbb('0x2d')]);_0x4ef756[_0xfbbb('0x31')]=_[_0xfbbb('0x48')](_0x4a3a4d[_0xfbbb('0x31')]);_0x4ef756[_0xfbbb('0x32')]=_['intersection'](_0x4ef756[_0xfbbb('0x34')],_0x4ef756[_0xfbbb('0x31')]);_0x258d72[_0xfbbb('0x35')]=_[_0xfbbb('0x33')](_0x4ef756[_0xfbbb('0x34')],qs[_0xfbbb('0x36')](_0x4a3a4d[_0xfbbb('0x31')][_0xfbbb('0x36')]));_0x258d72[_0xfbbb('0x35')]=_0x258d72[_0xfbbb('0x35')]['length']?_0x258d72[_0xfbbb('0x35')]:_0x4ef756[_0xfbbb('0x34')];if(_0x4a3a4d[_0xfbbb('0x31')][_0xfbbb('0x42')]){_0x258d72['include']=[{'all':!![]}];}_0x258d72=_[_0xfbbb('0x41')]({},_0x258d72,_0x4a3a4d[_0xfbbb('0x49')]);return db[_0xfbbb('0x2c')][_0xfbbb('0x4a')](_0x258d72)[_0xfbbb('0x24')](handleEntityNotFound(_0x25f26d,null))[_0xfbbb('0x24')](respondWithResult(_0x25f26d,null))['catch'](handleError(_0x25f26d,null));};exports[_0xfbbb('0x4b')]=function(_0x691e71,_0x32331d){return db[_0xfbbb('0x2c')][_0xfbbb('0x4b')](_0x691e71[_0xfbbb('0x4c')],{})[_0xfbbb('0x24')](function(_0x16c05a){var _0x4cb682=_0x691e71[_0xfbbb('0x4d')][_0xfbbb('0x26')]({'plain':!![]});if(!_0x4cb682)throw new Error(_0xfbbb('0x4e'));if(_0x4cb682['role']==='user'){var _0x2e213b=_0x16c05a[_0xfbbb('0x26')]({'plain':!![]});var _0xaa5110=_0xfbbb('0x27');return db[_0xfbbb('0x4f')][_0xfbbb('0x4a')]({'where':{'name':_0xaa5110,'userProfileId':_0x4cb682[_0xfbbb('0x50')]},'raw':!![]})[_0xfbbb('0x24')](function(_0x406e04){if(_0x406e04&&_0x406e04[_0xfbbb('0x51')]===0x0){return db['UserProfileResource'][_0xfbbb('0x4b')]({'name':_0x2e213b[_0xfbbb('0x40')],'resourceId':_0x2e213b['id'],'type':_0x406e04[_0xfbbb('0x40')],'sectionId':_0x406e04['id']},{})[_0xfbbb('0x24')](function(){return _0x16c05a;});}else{return _0x16c05a;}})['catch'](function(_0x47d9ea){logger[_0xfbbb('0x28')](_0xfbbb('0x52'),_0x47d9ea);throw _0x47d9ea;});}return _0x16c05a;})['then'](respondWithResult(_0x32331d,0xc9))[_0xfbbb('0x45')](handleError(_0x32331d,null));};exports['update']=function(_0x7e5719,_0x5572f7){if(_0x7e5719[_0xfbbb('0x4c')]['id']){delete _0x7e5719[_0xfbbb('0x4c')]['id'];}return db['ContactItemType'][_0xfbbb('0x4a')]({'where':{'id':_0x7e5719[_0xfbbb('0x47')]['id']}})[_0xfbbb('0x24')](handleEntityNotFound(_0x5572f7,null))[_0xfbbb('0x24')](saveUpdates(_0x7e5719[_0xfbbb('0x4c')],null))['then'](respondWithResult(_0x5572f7,null))[_0xfbbb('0x45')](handleError(_0x5572f7,null));};exports['destroy']=function(_0x249f81,_0xa746db){return db[_0xfbbb('0x2c')]['find']({'where':{'id':_0x249f81[_0xfbbb('0x47')]['id']}})[_0xfbbb('0x24')](handleEntityNotFound(_0xa746db,null))[_0xfbbb('0x24')](removeEntity(_0xa746db,null))['catch'](handleError(_0xa746db,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 20a7ca4..04416cc 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf7e6=['request-promise','path','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','../../config/logger','api','bluebird'];(function(_0x394ea0,_0x26ede6){var _0x5032b4=function(_0x5c99b2){while(--_0x5c99b2){_0x394ea0['push'](_0x394ea0['shift']());}};_0x5032b4(++_0x26ede6);}(_0xf7e6,0x194));var _0x6f7e=function(_0x2c50cf,_0x4136d0){_0x2c50cf=_0x2c50cf-0x0;var _0x22bae8=_0xf7e6[_0x2c50cf];return _0x22bae8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6f7e('0x0'))(_0x6f7e('0x1'));var moment=require('moment');var BPromise=require(_0x6f7e('0x2'));var rp=require(_0x6f7e('0x3'));var fs=require('fs');var path=require(_0x6f7e('0x4'));var rimraf=require('rimraf');var config=require(_0x6f7e('0x5'));var attributes=require(_0x6f7e('0x6'));module[_0x6f7e('0x7')]=function(_0x2064be,_0x42d7f1){return _0x2064be[_0x6f7e('0x8')](_0x6f7e('0x9'),attributes,{'tableName':_0x6f7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4de4=['api','moment','bluebird','request-promise','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4de4,0x111));var _0x44de=function(_0x394ff4,_0x7c300b){_0x394ff4=_0x394ff4-0x0;var _0x4667ea=_0x4de4[_0x394ff4];return _0x4667ea;};'use strict';var _=require(_0x44de('0x0'));var util=require(_0x44de('0x1'));var logger=require(_0x44de('0x2'))(_0x44de('0x3'));var moment=require(_0x44de('0x4'));var BPromise=require(_0x44de('0x5'));var rp=require(_0x44de('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x44de('0x7'));var attributes=require(_0x44de('0x8'));module[_0x44de('0x9')]=function(_0x2067fd,_0x28957f){return _0x2067fd['define'](_0x44de('0xa'),attributes,{'tableName':_0x44de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index 534da5f..088533a 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7129=['jayson/promise','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x233d57,_0x284678){var _0x3eec8c=function(_0x56d91b){while(--_0x56d91b){_0x233d57['push'](_0x233d57['shift']());}};_0x3eec8c(++_0x284678);}(_0x7129,0x99));var _0x9712=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x7129[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x9712('0x0'));var moment=require(_0x9712('0x1'));var BPromise=require(_0x9712('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9712('0x3'));var db=require(_0x9712('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9712('0x5'))('rpc');var config=require(_0x9712('0x6'));var jayson=require(_0x9712('0x7'));var client=jayson['client'][_0x9712('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a9723,_0x2cbcf8,_0x27137e){return new BPromise(function(_0x45f0f3,_0x4261ef){return client[_0x9712('0x9')](_0x3a9723,_0x27137e)[_0x9712('0xa')](function(_0x1535ee){logger[_0x9712('0xb')](_0x9712('0xc'),_0x2cbcf8,_0x9712('0xd'));logger['debug'](_0x9712('0xe'),_0x2cbcf8,_0x9712('0xd'),JSON[_0x9712('0xf')](_0x1535ee));if(_0x1535ee['error']){if(_0x1535ee[_0x9712('0x10')][_0x9712('0x11')]===0x1f4){logger['error'](_0x9712('0xc'),_0x2cbcf8,_0x1535ee[_0x9712('0x10')][_0x9712('0x12')]);return _0x4261ef(_0x1535ee['error']['message']);}logger[_0x9712('0x10')](_0x9712('0xc'),_0x2cbcf8,_0x1535ee['error'][_0x9712('0x12')]);return _0x45f0f3(_0x1535ee[_0x9712('0x10')]['message']);}else{logger[_0x9712('0xb')](_0x9712('0xc'),_0x2cbcf8,_0x9712('0xd'));_0x45f0f3(_0x1535ee['result'][_0x9712('0x12')]);}})[_0x9712('0x13')](function(_0x550d9e){logger['error'](_0x9712('0xc'),_0x2cbcf8,_0x550d9e);_0x4261ef(_0x550d9e);});});} \ No newline at end of file +var _0x53b7=['../../config/utils','rpc','jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x478703,_0x1bba1b){var _0x4e5e03=function(_0x47d1ca){while(--_0x47d1ca){_0x478703['push'](_0x478703['shift']());}};_0x4e5e03(++_0x1bba1b);}(_0x53b7,0x170));var _0x753b=function(_0x47ebe1,_0x149f7d){_0x47ebe1=_0x47ebe1-0x0;var _0x670800=_0x53b7[_0x47ebe1];return _0x670800;};'use strict';var _=require(_0x753b('0x0'));var util=require(_0x753b('0x1'));var moment=require(_0x753b('0x2'));var BPromise=require(_0x753b('0x3'));var rs=require(_0x753b('0x4'));var fs=require('fs');var Redis=require(_0x753b('0x5'));var db=require(_0x753b('0x6'))['db'];var utils=require(_0x753b('0x7'));var logger=require('../../config/logger')(_0x753b('0x8'));var config=require('../../config/environment');var jayson=require(_0x753b('0x9'));var client=jayson[_0x753b('0xa')][_0x753b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb0da,_0x3ed3cc,_0x1a3b67){return new BPromise(function(_0x2014b7,_0x2fbac8){return client[_0x753b('0xc')](_0x3bb0da,_0x1a3b67)[_0x753b('0xd')](function(_0x36431a){logger['info'](_0x753b('0xe'),_0x3ed3cc,'request\x20sent');logger[_0x753b('0xf')](_0x753b('0x10'),_0x3ed3cc,_0x753b('0x11'),JSON[_0x753b('0x12')](_0x36431a));if(_0x36431a[_0x753b('0x13')]){if(_0x36431a[_0x753b('0x13')][_0x753b('0x14')]===0x1f4){logger[_0x753b('0x13')](_0x753b('0xe'),_0x3ed3cc,_0x36431a[_0x753b('0x13')][_0x753b('0x15')]);return _0x2fbac8(_0x36431a['error']['message']);}logger['error'](_0x753b('0xe'),_0x3ed3cc,_0x36431a[_0x753b('0x13')]['message']);return _0x2014b7(_0x36431a[_0x753b('0x13')][_0x753b('0x15')]);}else{logger[_0x753b('0x16')](_0x753b('0xe'),_0x3ed3cc,_0x753b('0x11'));_0x2014b7(_0x36431a[_0x753b('0x17')][_0x753b('0x15')]);}})[_0x753b('0x18')](function(_0x5a6834){logger[_0x753b('0x13')](_0x753b('0xe'),_0x3ed3cc,_0x5a6834);_0x2fbac8(_0x5a6834);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 87278d2..90f3148 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x238d=['post','delete','/:id','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','show'];(function(_0x28fac0,_0x5be94c){var _0x24e5e8=function(_0x4a3b0e){while(--_0x4a3b0e){_0x28fac0['push'](_0x28fac0['shift']());}};_0x24e5e8(++_0x5be94c);}(_0x238d,0x17a));var _0xd238=function(_0xfdc4e2,_0x20da01){_0xfdc4e2=_0xfdc4e2-0x0;var _0xf96e8d=_0x238d[_0xfdc4e2];return _0xf96e8d;};'use strict';var multer=require(_0xd238('0x0'));var util=require('util');var path=require(_0xd238('0x1'));var timeout=require(_0xd238('0x2'));var express=require(_0xd238('0x3'));var router=express[_0xd238('0x4')]();var fs_extra=require(_0xd238('0x5'));var auth=require(_0xd238('0x6'));var interaction=require(_0xd238('0x7'));var config=require(_0xd238('0x8'));var controller=require(_0xd238('0x9'));router[_0xd238('0xa')]('/',auth[_0xd238('0xb')](),controller['index']);router[_0xd238('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xd238('0xc')]);router[_0xd238('0xd')]('/',auth[_0xd238('0xb')](),controller['create']);router['put']('/:id',auth[_0xd238('0xb')](),controller['update']);router[_0xd238('0xe')](_0xd238('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0xd238('0x10')]=router; \ No newline at end of file +var _0x19b3=['create','put','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','show','post'];(function(_0x36fe46,_0x40010c){var _0x4d2e9c=function(_0x2dfa20){while(--_0x2dfa20){_0x36fe46['push'](_0x36fe46['shift']());}};_0x4d2e9c(++_0x40010c);}(_0x19b3,0x1be));var _0x319b=function(_0x14e27a,_0x3b4136){_0x14e27a=_0x14e27a-0x0;var _0x288688=_0x19b3[_0x14e27a];return _0x288688;};'use strict';var multer=require(_0x319b('0x0'));var util=require(_0x319b('0x1'));var path=require(_0x319b('0x2'));var timeout=require(_0x319b('0x3'));var express=require(_0x319b('0x4'));var router=express[_0x319b('0x5')]();var fs_extra=require(_0x319b('0x6'));var auth=require(_0x319b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x319b('0x8'));var controller=require('./contactItemType.controller');router[_0x319b('0x9')]('/',auth['isAuthenticated'](),controller[_0x319b('0xa')]);router[_0x319b('0x9')](_0x319b('0xb'),auth['isAuthenticated'](),controller[_0x319b('0xc')]);router[_0x319b('0xd')]('/',auth['isAuthenticated'](),controller[_0x319b('0xe')]);router[_0x319b('0xf')]('/:id',auth[_0x319b('0x10')](),controller[_0x319b('0x11')]);router['delete'](_0x319b('0xb'),auth[_0x319b('0x10')](),controller[_0x319b('0x12')]);module[_0x319b('0x13')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index a92061f..fcbe0a0 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(_0x11a220,_0x4e470a){var _0x20d8fe=function(_0xbedfd){while(--_0xbedfd){_0x11a220['push'](_0x11a220['shift']());}};_0x20d8fe(++_0x4e470a);}(_0xb7e7,0x121));var _0x7b7e=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xb7e7[_0x55abd9];return _0x3e5669;};'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(_0x2f86f8,_0x404cf8){var _0x4fce92=function(_0x28c6eb){while(--_0x28c6eb){_0x2f86f8['push'](_0x2f86f8['shift']());}};_0x4fce92(++_0x404cf8);}(_0x757a,0xde));var _0xa757=function(_0x4aded0,_0x540880){_0x4aded0=_0x4aded0-0x0;var _0xd30355=_0x757a[_0x4aded0];return _0xd30355;};'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 c12421b..eeeed9e 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 _0x997f=['update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','reportType','attrReport','attrRefresh','stringify','addItem','DashboardItem','getItems','findOne','sort','nolimit','eml-format','zip-dir','fast-json-patch','bluebird','path','sox','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','./dashboard.socket','register','sendStatus','end','json','undefined','limit','count','offset','status','set','reject','save','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','order','where','pick','merge','filter','options','Dashboard','includeAll','findAll','rows','catch','show','params','length','include','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x997f,0x1f4));var _0xf997=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x997f[_0x298ed3];return _0x5aad28;};'use strict';var emlformat=require(_0xf997('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf997('0x1'));var jsonpatch=require(_0xf997('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf997('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf997('0x4'));var sox=require(_0xf997('0x5'));var csv=require('to-csv');var ejs=require(_0xf997('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf997('0x7'));var squel=require(_0xf997('0x8'));var crypto=require(_0xf997('0x9'));var jsforce=require(_0xf997('0xa'));var deskjs=require(_0xf997('0xb'));var toCsv=require('to-csv');var querystring=require(_0xf997('0xc'));var Papa=require(_0xf997('0xd'));var Redis=require(_0xf997('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf997('0xf'));var as=require(_0xf997('0x10'));var hardwareService=require(_0xf997('0x11'));var logger=require(_0xf997('0x12'))(_0xf997('0x13'));var utils=require(_0xf997('0x14'));var config=require(_0xf997('0x15'));var licenseUtil=require(_0xf997('0x16'));var db=require(_0xf997('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf997('0x18'))[_0xf997('0x19')](socket);function respondWithStatusCode(_0x8fefad,_0x1bce39){_0x1bce39=_0x1bce39||0xcc;return function(_0x592322){if(_0x592322){return _0x8fefad[_0xf997('0x1a')](_0x1bce39);}return _0x8fefad['status'](_0x1bce39)[_0xf997('0x1b')]();};}function respondWithResult(_0x314875,_0x482378){_0x482378=_0x482378||0xc8;return function(_0x10dd2d){if(_0x10dd2d){return _0x314875['status'](_0x482378)[_0xf997('0x1c')](_0x10dd2d);}};}function respondWithFilteredResult(_0x148eff,_0x3327a7){return function(_0x90d6e3){if(_0x90d6e3){var _0x2ca547=typeof _0x3327a7['offset']===_0xf997('0x1d')&&typeof _0x3327a7[_0xf997('0x1e')]==='undefined';var _0x44ee83=_0x90d6e3[_0xf997('0x1f')];var _0x2f55f2=_0x2ca547?0x0:_0x3327a7[_0xf997('0x20')];var _0x1154ea=_0x2ca547?_0x90d6e3['count']:_0x3327a7['offset']+_0x3327a7[_0xf997('0x1e')];var _0xd2a35b;if(_0x1154ea>=_0x44ee83){_0x1154ea=_0x44ee83;_0xd2a35b=0xc8;}else{_0xd2a35b=0xce;}_0x148eff[_0xf997('0x21')](_0xd2a35b);return _0x148eff[_0xf997('0x22')]('Content-Range',_0x2f55f2+'-'+_0x1154ea+'/'+_0x44ee83)['json'](_0x90d6e3);}return null;};}function patchUpdates(_0x258cb5){return function(_0x461a06){try{jsonpatch['apply'](_0x461a06,_0x258cb5,!![]);}catch(_0x44dc22){return BPromise[_0xf997('0x23')](_0x44dc22);}return _0x461a06[_0xf997('0x24')]();};}function saveUpdates(_0x374336,_0x23693b){return function(_0x39c83b){if(_0x39c83b){return _0x39c83b['update'](_0x374336)[_0xf997('0x25')](function(_0x289f01){return _0x289f01;});}return null;};}function removeEntity(_0x15529c,_0x2ac3cb){return function(_0x2284c6){if(_0x2284c6){return _0x2284c6[_0xf997('0x26')]()[_0xf997('0x25')](function(){var _0x41b306=_0x2284c6[_0xf997('0x27')]({'plain':!![]});var _0x46bf10=_0xf997('0x28');return db[_0xf997('0x29')][_0xf997('0x26')]({'where':{'type':_0x46bf10,'resourceId':_0x41b306['id']}})[_0xf997('0x25')](function(){return _0x2284c6;});})[_0xf997('0x25')](function(){_0x15529c[_0xf997('0x21')](0xcc)[_0xf997('0x1b')]();});}};}function handleEntityNotFound(_0xae5790,_0x35ac2b){return function(_0x2db151){if(!_0x2db151){_0xae5790[_0xf997('0x1a')](0x194);}return _0x2db151;};}function handleError(_0xa7691d,_0x2f1a65){_0x2f1a65=_0x2f1a65||0x1f4;return function(_0x278341){logger[_0xf997('0x2a')](_0x278341['stack']);if(_0x278341['name']){delete _0x278341[_0xf997('0x2b')];}_0xa7691d[_0xf997('0x21')](_0x2f1a65)[_0xf997('0x2c')](_0x278341);};}exports['index']=function(_0x2bc543,_0x2e2e7f){var _0x5b8907={},_0x2dc8e2={},_0x954040={'count':0x0,'rows':[]};var _0x263fde=_[_0xf997('0x2d')](db['Dashboard'][_0xf997('0x2e')],function(_0x1c6f7d){return{'name':_0x1c6f7d[_0xf997('0x2f')],'type':_0x1c6f7d[_0xf997('0x30')][_0xf997('0x31')]};});_0x2dc8e2[_0xf997('0x32')]=_['map'](_0x263fde,_0xf997('0x2b'));_0x2dc8e2['query']=_[_0xf997('0x33')](_0x2bc543[_0xf997('0x34')]);_0x2dc8e2[_0xf997('0x35')]=_[_0xf997('0x36')](_0x2dc8e2[_0xf997('0x32')],_0x2dc8e2[_0xf997('0x34')]);_0x5b8907[_0xf997('0x37')]=_['intersection'](_0x2dc8e2['model'],qs[_0xf997('0x38')](_0x2bc543[_0xf997('0x34')][_0xf997('0x38')]));_0x5b8907[_0xf997('0x37')]=_0x5b8907[_0xf997('0x37')]['length']?_0x5b8907[_0xf997('0x37')]:_0x2dc8e2[_0xf997('0x32')];if(!_0x2bc543[_0xf997('0x34')]['hasOwnProperty']('nolimit')){_0x5b8907['limit']=qs[_0xf997('0x1e')](_0x2bc543['query'][_0xf997('0x1e')]);_0x5b8907[_0xf997('0x20')]=qs[_0xf997('0x20')](_0x2bc543['query'][_0xf997('0x20')]);}_0x5b8907[_0xf997('0x39')]=qs['sort'](_0x2bc543[_0xf997('0x34')]['sort']);_0x5b8907[_0xf997('0x3a')]=qs[_0xf997('0x35')](_[_0xf997('0x3b')](_0x2bc543['query'],_0x2dc8e2['filters']),_0x263fde);if(_0x2bc543[_0xf997('0x34')]['filter']){_0x5b8907['where']=_[_0xf997('0x3c')](_0x5b8907[_0xf997('0x3a')],{'$or':_[_0xf997('0x2d')](_0x263fde,function(_0x50090f){if(_0x50090f['type']!=='VIRTUAL'){var _0xd88963={};_0xd88963[_0x50090f[_0xf997('0x2b')]]={'$like':'%'+_0x2bc543[_0xf997('0x34')][_0xf997('0x3d')]+'%'};return _0xd88963;}})});}_0x5b8907=_[_0xf997('0x3c')]({},_0x5b8907,_0x2bc543[_0xf997('0x3e')]);var _0x2affa3={'where':_0x5b8907[_0xf997('0x3a')]};return db[_0xf997('0x3f')][_0xf997('0x1f')](_0x2affa3)[_0xf997('0x25')](function(_0x1bf6ae){_0x954040['count']=_0x1bf6ae;if(_0x2bc543[_0xf997('0x34')][_0xf997('0x40')]){_0x5b8907['include']=[{'all':!![]}];}return db['Dashboard'][_0xf997('0x41')](_0x5b8907);})[_0xf997('0x25')](function(_0x489528){_0x954040[_0xf997('0x42')]=_0x489528;return _0x954040;})[_0xf997('0x25')](respondWithFilteredResult(_0x2e2e7f,_0x5b8907))[_0xf997('0x43')](handleError(_0x2e2e7f,null));};exports[_0xf997('0x44')]=function(_0x2496ec,_0x325f6e){var _0x50f29b={'raw':![],'where':{'id':_0x2496ec[_0xf997('0x45')]['id']}},_0x485ba5={};_0x485ba5['model']=_['keys'](db['Dashboard'][_0xf997('0x2e')]);_0x485ba5[_0xf997('0x34')]=_[_0xf997('0x33')](_0x2496ec[_0xf997('0x34')]);_0x485ba5[_0xf997('0x35')]=_[_0xf997('0x36')](_0x485ba5[_0xf997('0x32')],_0x485ba5['query']);_0x50f29b[_0xf997('0x37')]=_['intersection'](_0x485ba5['model'],qs['fields'](_0x2496ec[_0xf997('0x34')][_0xf997('0x38')]));_0x50f29b['attributes']=_0x50f29b['attributes'][_0xf997('0x46')]?_0x50f29b[_0xf997('0x37')]:_0x485ba5['model'];if(_0x2496ec[_0xf997('0x34')]['includeAll']){_0x50f29b[_0xf997('0x47')]=[{'all':!![]}];}_0x50f29b=_['merge']({},_0x50f29b,_0x2496ec['options']);return db['Dashboard']['find'](_0x50f29b)['then'](handleEntityNotFound(_0x325f6e,null))[_0xf997('0x25')](respondWithResult(_0x325f6e,null))[_0xf997('0x43')](handleError(_0x325f6e,null));};exports[_0xf997('0x48')]=function(_0x35d4e5,_0x5f426a){return db[_0xf997('0x3f')]['create'](_0x35d4e5[_0xf997('0x49')],{})[_0xf997('0x25')](function(_0x47ce18){var _0xcc08fc=_0x35d4e5[_0xf997('0x4a')][_0xf997('0x27')]({'plain':!![]});if(!_0xcc08fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcc08fc['role']==='user'){var _0x5f073d=_0x47ce18['get']({'plain':!![]});var _0x49c42d=_0xf997('0x28');return db[_0xf997('0x4b')][_0xf997('0x4c')]({'where':{'name':_0x49c42d,'userProfileId':_0xcc08fc[_0xf997('0x4d')]},'raw':!![]})[_0xf997('0x25')](function(_0x4f2e9a){if(_0x4f2e9a&&_0x4f2e9a[_0xf997('0x4e')]===0x0){return db[_0xf997('0x29')][_0xf997('0x48')]({'name':_0x5f073d[_0xf997('0x2b')],'resourceId':_0x5f073d['id'],'type':_0x4f2e9a[_0xf997('0x2b')],'sectionId':_0x4f2e9a['id']},{})[_0xf997('0x25')](function(){return _0x47ce18;});}else{return _0x47ce18;}})[_0xf997('0x43')](function(_0x1a1d5b){logger[_0xf997('0x2a')](_0xf997('0x4f'),_0x1a1d5b);throw _0x1a1d5b;});}return _0x47ce18;})[_0xf997('0x25')](respondWithResult(_0x5f426a,0xc9))[_0xf997('0x43')](handleError(_0x5f426a,null));};exports[_0xf997('0x50')]=function(_0x478931,_0x6fdb10){var _0x4498cf={'where':{'id':_0x478931[_0xf997('0x45')]['id']}},_0x4a759a={};_0x4a759a[_0xf997('0x32')]=_[_0xf997('0x33')](db['Dashboard'][_0xf997('0x2e')]);_0x4498cf[_0xf997('0x37')]=_['intersection'](_0x4a759a[_0xf997('0x32')],qs[_0xf997('0x38')](_0x478931[_0xf997('0x34')]['fields']));_0x4498cf[_0xf997('0x37')]=_0x4498cf[_0xf997('0x37')][_0xf997('0x46')]?_0x4498cf[_0xf997('0x37')]:_0x4a759a[_0xf997('0x32')];if(_0x478931[_0xf997('0x34')]['includeAll']){_0x4498cf[_0xf997('0x47')]=[{'all':!![]}];}_0x4498cf=_[_0xf997('0x3c')]({},_0x4498cf,_0x478931['options']);return db[_0xf997('0x3f')][_0xf997('0x4c')](_0x4498cf)[_0xf997('0x25')](handleEntityNotFound(_0x6fdb10,null))[_0xf997('0x25')](function(_0x311832){if(_0x311832){var _0x22ed35=_0x311832['get']({'plain':!![]});_0x22ed35=qs[_0xf997('0x51')](_0x22ed35,['id',_0xf997('0x52'),_0xf997('0x53')]);_0x478931[_0xf997('0x49')]=_['omit'](_0x478931[_0xf997('0x49')],['id',_0xf997('0x52'),_0xf997('0x53')]);return db[_0xf997('0x3f')][_0xf997('0x48')](_[_0xf997('0x3c')](_0x22ed35,_0x478931[_0xf997('0x49')]),{'include':_0x478931['query'][_0xf997('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x3556d3){var _0x218ba8=_0x478931['user'][_0xf997('0x27')]({'plain':!![]});if(!_0x218ba8)throw new Error(_0xf997('0x54'));if(_0x218ba8['role']==='user'){var _0x2150c3=_0x3556d3[_0xf997('0x27')]({'plain':!![]});var _0x1faf29=_0xf997('0x28');return db[_0xf997('0x4b')][_0xf997('0x4c')]({'where':{'name':_0x1faf29,'userProfileId':_0x218ba8['userProfileId']},'raw':!![]})[_0xf997('0x25')](function(_0x1f91ab){if(_0x1f91ab&&_0x1f91ab[_0xf997('0x4e')]===0x0){return db[_0xf997('0x29')][_0xf997('0x48')]({'name':_0x2150c3[_0xf997('0x2b')],'resourceId':_0x2150c3['id'],'type':_0x1f91ab[_0xf997('0x2b')],'sectionId':_0x1f91ab['id']},{})[_0xf997('0x25')](function(){return _0x3556d3;});}else{return _0x3556d3;}})[_0xf997('0x43')](function(_0x18acdb){logger[_0xf997('0x2a')](_0xf997('0x4f'),_0x18acdb);throw _0x18acdb;});}return _0x3556d3;});}})[_0xf997('0x25')](respondWithResult(_0x6fdb10,0xc9))[_0xf997('0x43')](handleError(_0x6fdb10,null));};exports[_0xf997('0x55')]=function(_0x28a9ae,_0x1f4363){if(_0x28a9ae[_0xf997('0x49')]['id']){delete _0x28a9ae[_0xf997('0x49')]['id'];}return db[_0xf997('0x3f')]['find']({'where':{'id':_0x28a9ae[_0xf997('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f4363,null))['then'](saveUpdates(_0x28a9ae['body'],null))[_0xf997('0x25')](respondWithResult(_0x1f4363,null))[_0xf997('0x43')](handleError(_0x1f4363,null));};exports['destroy']=function(_0x29cc0d,_0x3e48bf){return db[_0xf997('0x3f')][_0xf997('0x4c')]({'where':{'id':_0x29cc0d[_0xf997('0x45')]['id']}})[_0xf997('0x25')](handleEntityNotFound(_0x3e48bf,null))[_0xf997('0x25')](removeEntity(_0x3e48bf,null))['catch'](handleError(_0x3e48bf,null));};function widgetAttributes(_0x4f7d64){try{switch(_0x4f7d64[_0xf997('0x30')]){case _0xf997('0x56'):return[{'name':'attrUrl','value':_0x4f7d64[_0xf997('0x57')]||(_0x4f7d64[_0xf997('0x58')]&&_0x4f7d64['attrs'][0x0]?_0x4f7d64[_0xf997('0x58')][0x0][_0xf997('0x59')]:undefined)||_0xf997('0x5a')}];case _0xf997('0x5b'):return[{'name':_0xf997('0x5c'),'value':_0x4f7d64['attrPath']||(_0x4f7d64['attrs']&&_0x4f7d64[_0xf997('0x58')][0x0]?_0x4f7d64[_0xf997('0x58')][0x0][_0xf997('0x59')]:undefined)||''}];case _0xf997('0x5d'):return[{'name':'attrHourFormat','value':_0x4f7d64[_0xf997('0x5e')]||(_0x4f7d64[_0xf997('0x58')]&&_0x4f7d64[_0xf997('0x58')][0x0]?_0x4f7d64['attrs'][0x0]['value']:undefined)||_0xf997('0x5f')},{'name':_0xf997('0x60'),'value':_0x4f7d64[_0xf997('0x60')]||(_0x4f7d64[_0xf997('0x58')]&&_0x4f7d64[_0xf997('0x58')][0x1]?_0x4f7d64[_0xf997('0x58')][0x1][_0xf997('0x59')]:undefined)||_0xf997('0x61')},{'name':_0xf997('0x62'),'value':_0x4f7d64[_0xf997('0x62')]||(_0x4f7d64['attrs']&&_0x4f7d64['attrs'][0x2]?_0x4f7d64[_0xf997('0x58')][0x2][_0xf997('0x59')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x4f7d64[_0xf997('0x63')]||(_0x4f7d64['attrs']&&_0x4f7d64['attrs'][0x0]?_0x4f7d64[_0xf997('0x58')][0x0][_0xf997('0x59')]:undefined)||_0xf997('0x64')},{'name':'attrVoiceQueues','value':_0x4f7d64[_0xf997('0x65')]||(_0x4f7d64[_0xf997('0x58')]&&_0x4f7d64['attrs'][0x1]?_0x4f7d64['attrs'][0x1][_0xf997('0x59')]:undefined)||[]},{'name':_0xf997('0x62'),'value':_0x4f7d64['attrFontSize']||(_0x4f7d64[_0xf997('0x58')]&&_0x4f7d64[_0xf997('0x58')][0x2]?_0x4f7d64[_0xf997('0x58')][0x2][_0xf997('0x59')]:undefined)||0x14}];case _0xf997('0x66'):case _0xf997('0x67'):return[{'name':_0xf997('0x68'),'value':_0x4f7d64[_0xf997('0x68')]||(_0x4f7d64[_0xf997('0x58')]&&_0x4f7d64['attrs'][0x0]?_0x4f7d64[_0xf997('0x58')][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x4f7d64['attrSerie2']||(_0x4f7d64[_0xf997('0x58')]&&_0x4f7d64['attrs'][0x1]?_0x4f7d64['attrs'][0x1][_0xf997('0x59')]:undefined)||null},{'name':_0xf997('0x69'),'value':_0x4f7d64['attrSerie3']||(_0x4f7d64[_0xf997('0x58')]&&_0x4f7d64[_0xf997('0x58')][0x2]?_0x4f7d64[_0xf997('0x58')][0x2][_0xf997('0x59')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x4f7d64[_0xf997('0x65')]||(_0x4f7d64[_0xf997('0x58')]&&_0x4f7d64[_0xf997('0x58')][0x3]?_0x4f7d64['attrs'][0x3]['value']:undefined)||[]}];case _0xf997('0x6a'):return[{'name':'attrReport','type':_0x4f7d64[_0xf997('0x6b')]||(_0x4f7d64[_0xf997('0x58')]&&_0x4f7d64['attrs'][0x0]?_0x4f7d64[_0xf997('0x58')][0x0][_0xf997('0x30')]:undefined)||null,'value':_0x4f7d64[_0xf997('0x6c')]||(_0x4f7d64['attrs']&&_0x4f7d64['attrs'][0x0]?_0x4f7d64[_0xf997('0x58')][0x0]['value']:undefined)||null},{'name':_0xf997('0x6d'),'value':_0x4f7d64['attrRefresh']||(_0x4f7d64[_0xf997('0x58')]&&_0x4f7d64[_0xf997('0x58')][0x1]?_0x4f7d64[_0xf997('0x58')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x21d453){logger[_0xf997('0x2a')]('widgetAttributes:\x20%s',JSON[_0xf997('0x6e')](_0x21d453));return[];}}exports[_0xf997('0x6f')]=function(_0x334884,_0x3c239a,_0x43ba4d){if(_0x334884[_0xf997('0x49')]['id']){delete _0x334884[_0xf997('0x49')]['id'];}return db[_0xf997('0x3f')][_0xf997('0x4c')]({'where':{'id':_0x334884[_0xf997('0x45')]['id']}})[_0xf997('0x25')](handleEntityNotFound(_0x3c239a,null))['then'](function(_0x3e5aeb){if(_0x3e5aeb){_0x334884[_0xf997('0x49')]['DashboardId']=_0x3e5aeb['id'];_0x334884[_0xf997('0x49')][_0xf997('0x58')]=widgetAttributes(_0x334884[_0xf997('0x49')]);return db[_0xf997('0x70')][_0xf997('0x48')](_0x334884['body']);}})['then'](respondWithResult(_0x3c239a,null))[_0xf997('0x43')](handleError(_0x3c239a,null));};exports[_0xf997('0x71')]=function(_0x1f55b9,_0x346df7,_0x21375a){var _0x262f5e={};var _0x24e554={};var _0x421c23;var _0x31e8ea;return db[_0xf997('0x3f')][_0xf997('0x72')]({'where':{'id':_0x1f55b9[_0xf997('0x45')]['id']}})[_0xf997('0x25')](handleEntityNotFound(_0x346df7,null))[_0xf997('0x25')](function(_0x44efd6){if(_0x44efd6){_0x421c23=_0x44efd6;_0x24e554[_0xf997('0x32')]=_[_0xf997('0x33')](db[_0xf997('0x70')][_0xf997('0x2e')]);_0x24e554[_0xf997('0x34')]=_[_0xf997('0x33')](_0x1f55b9[_0xf997('0x34')]);_0x24e554[_0xf997('0x35')]=_[_0xf997('0x36')](_0x24e554[_0xf997('0x32')],_0x24e554[_0xf997('0x34')]);_0x262f5e['attributes']=_[_0xf997('0x36')](_0x24e554[_0xf997('0x32')],qs[_0xf997('0x38')](_0x1f55b9[_0xf997('0x34')][_0xf997('0x38')]));_0x262f5e['attributes']=_0x262f5e[_0xf997('0x37')][_0xf997('0x46')]?_0x262f5e[_0xf997('0x37')]:_0x24e554[_0xf997('0x32')];_0x262f5e[_0xf997('0x39')]=qs[_0xf997('0x73')](_0x1f55b9[_0xf997('0x34')][_0xf997('0x73')]);_0x262f5e[_0xf997('0x3a')]=qs[_0xf997('0x35')](_[_0xf997('0x3b')](_0x1f55b9[_0xf997('0x34')],_0x24e554[_0xf997('0x35')]));if(_0x1f55b9[_0xf997('0x34')][_0xf997('0x3d')]){_0x262f5e[_0xf997('0x3a')]=_[_0xf997('0x3c')](_0x262f5e['where'],{'$or':_['map'](_0x262f5e[_0xf997('0x37')],function(_0x1f848b){var _0x1288f3={};_0x1288f3[_0x1f848b]={'$like':'%'+_0x1f55b9[_0xf997('0x34')][_0xf997('0x3d')]+'%'};return _0x1288f3;})});}_0x262f5e=_['merge']({},_0x262f5e,_0x1f55b9[_0xf997('0x3e')]);return _0x421c23['getItems'](_0x262f5e);}})['then'](function(_0x255d11){if(_0x255d11){_0x31e8ea=_0x255d11[_0xf997('0x46')];if(!_0x1f55b9[_0xf997('0x34')]['hasOwnProperty'](_0xf997('0x74'))){_0x262f5e[_0xf997('0x1e')]=qs[_0xf997('0x1e')](_0x1f55b9[_0xf997('0x34')][_0xf997('0x1e')]);_0x262f5e[_0xf997('0x20')]=qs['offset'](_0x1f55b9['query'][_0xf997('0x20')]);}return _0x421c23[_0xf997('0x71')](_0x262f5e);}})['then'](function(_0x32ea80){if(_0x32ea80){return _0x32ea80?{'count':_0x31e8ea,'rows':_0x32ea80}:null;}})[_0xf997('0x25')](respondWithResult(_0x346df7,null))['catch'](handleError(_0x346df7,null));}; \ No newline at end of file +var _0x5221=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','then','destroy','CustomDashboards','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','find','catch','create','body','get','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','omit','createdAt','updatedAt','role','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','reportType','attrReport','attrRefresh','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel'];(function(_0x345346,_0x20c71e){var _0x39a3ac=function(_0x46b857){while(--_0x46b857){_0x345346['push'](_0x345346['shift']());}};_0x39a3ac(++_0x20c71e);}(_0x5221,0x15c));var _0x1522=function(_0x56c1ec,_0x11f5ee){_0x56c1ec=_0x56c1ec-0x0;var _0x515a74=_0x5221[_0x56c1ec];return _0x515a74;};'use strict';var emlformat=require(_0x1522('0x0'));var rimraf=require(_0x1522('0x1'));var zipdir=require(_0x1522('0x2'));var jsonpatch=require(_0x1522('0x3'));var rp=require(_0x1522('0x4'));var moment=require(_0x1522('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1522('0x6'));var util=require(_0x1522('0x7'));var path=require('path');var sox=require(_0x1522('0x8'));var csv=require(_0x1522('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1522('0xa'));var _=require('lodash');var squel=require(_0x1522('0xb'));var crypto=require(_0x1522('0xc'));var jsforce=require(_0x1522('0xd'));var deskjs=require(_0x1522('0xe'));var toCsv=require(_0x1522('0x9'));var querystring=require(_0x1522('0xf'));var Papa=require('papaparse');var Redis=require(_0x1522('0x10'));var authService=require(_0x1522('0x11'));var qs=require(_0x1522('0x12'));var as=require(_0x1522('0x13'));var hardwareService=require(_0x1522('0x14'));var logger=require(_0x1522('0x15'))(_0x1522('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1522('0x17'));var db=require(_0x1522('0x18'))['db'];config[_0x1522('0x19')]=_[_0x1522('0x1a')](config[_0x1522('0x19')],{'host':_0x1522('0x1b'),'port':0x18eb});var socket=require(_0x1522('0x1c'))(new Redis(config[_0x1522('0x19')]));require(_0x1522('0x1d'))[_0x1522('0x1e')](socket);function respondWithStatusCode(_0x5c769e,_0x52fe39){_0x52fe39=_0x52fe39||0xcc;return function(_0x31b7d6){if(_0x31b7d6){return _0x5c769e[_0x1522('0x1f')](_0x52fe39);}return _0x5c769e[_0x1522('0x20')](_0x52fe39)[_0x1522('0x21')]();};}function respondWithResult(_0x3f66a8,_0x163812){_0x163812=_0x163812||0xc8;return function(_0x25bc00){if(_0x25bc00){return _0x3f66a8['status'](_0x163812)[_0x1522('0x22')](_0x25bc00);}};}function respondWithFilteredResult(_0x45db2d,_0x39ca81){return function(_0x32874b){if(_0x32874b){var _0x52ad7a=typeof _0x39ca81['offset']===_0x1522('0x23')&&typeof _0x39ca81[_0x1522('0x24')]==='undefined';var _0x393623=_0x32874b[_0x1522('0x25')];var _0x20d773=_0x52ad7a?0x0:_0x39ca81[_0x1522('0x26')];var _0x11d39e=_0x52ad7a?_0x32874b[_0x1522('0x25')]:_0x39ca81[_0x1522('0x26')]+_0x39ca81[_0x1522('0x24')];var _0x435e8a;if(_0x11d39e>=_0x393623){_0x11d39e=_0x393623;_0x435e8a=0xc8;}else{_0x435e8a=0xce;}_0x45db2d[_0x1522('0x20')](_0x435e8a);return _0x45db2d['set']('Content-Range',_0x20d773+'-'+_0x11d39e+'/'+_0x393623)[_0x1522('0x22')](_0x32874b);}return null;};}function patchUpdates(_0x46fc3c){return function(_0x4abff5){try{jsonpatch[_0x1522('0x27')](_0x4abff5,_0x46fc3c,!![]);}catch(_0x51b695){return BPromise[_0x1522('0x28')](_0x51b695);}return _0x4abff5['save']();};}function saveUpdates(_0xd5feba,_0x275f9a){return function(_0x2244ca){if(_0x2244ca){return _0x2244ca['update'](_0xd5feba)[_0x1522('0x29')](function(_0x4c5e4c){return _0x4c5e4c;});}return null;};}function removeEntity(_0x125ff0,_0x1127b1){return function(_0x2cd103){if(_0x2cd103){return _0x2cd103[_0x1522('0x2a')]()[_0x1522('0x29')](function(){var _0x25f85e=_0x2cd103['get']({'plain':!![]});var _0x338d00=_0x1522('0x2b');return db['UserProfileResource'][_0x1522('0x2a')]({'where':{'type':_0x338d00,'resourceId':_0x25f85e['id']}})['then'](function(){return _0x2cd103;});})[_0x1522('0x29')](function(){_0x125ff0[_0x1522('0x20')](0xcc)[_0x1522('0x21')]();});}};}function handleEntityNotFound(_0x43e726,_0x5f5b06){return function(_0x29f115){if(!_0x29f115){_0x43e726['sendStatus'](0x194);}return _0x29f115;};}function handleError(_0x379849,_0x532bbc){_0x532bbc=_0x532bbc||0x1f4;return function(_0x2cd505){logger['error'](_0x2cd505[_0x1522('0x2c')]);if(_0x2cd505[_0x1522('0x2d')]){delete _0x2cd505[_0x1522('0x2d')];}_0x379849[_0x1522('0x20')](_0x532bbc)[_0x1522('0x2e')](_0x2cd505);};}exports[_0x1522('0x2f')]=function(_0x9aeee,_0x3bf947){var _0x4997e2={},_0x20e4b9={},_0x277449={'count':0x0,'rows':[]};var _0x27e984=_[_0x1522('0x30')](db[_0x1522('0x31')][_0x1522('0x32')],function(_0x391219){return{'name':_0x391219[_0x1522('0x33')],'type':_0x391219[_0x1522('0x34')]['key']};});_0x20e4b9[_0x1522('0x35')]=_[_0x1522('0x30')](_0x27e984,_0x1522('0x2d'));_0x20e4b9[_0x1522('0x36')]=_[_0x1522('0x37')](_0x9aeee[_0x1522('0x36')]);_0x20e4b9[_0x1522('0x38')]=_['intersection'](_0x20e4b9['model'],_0x20e4b9[_0x1522('0x36')]);_0x4997e2[_0x1522('0x39')]=_[_0x1522('0x3a')](_0x20e4b9[_0x1522('0x35')],qs[_0x1522('0x3b')](_0x9aeee[_0x1522('0x36')]['fields']));_0x4997e2[_0x1522('0x39')]=_0x4997e2[_0x1522('0x39')]['length']?_0x4997e2[_0x1522('0x39')]:_0x20e4b9['model'];if(!_0x9aeee[_0x1522('0x36')][_0x1522('0x3c')](_0x1522('0x3d'))){_0x4997e2[_0x1522('0x24')]=qs[_0x1522('0x24')](_0x9aeee[_0x1522('0x36')]['limit']);_0x4997e2[_0x1522('0x26')]=qs[_0x1522('0x26')](_0x9aeee['query']['offset']);}_0x4997e2[_0x1522('0x3e')]=qs[_0x1522('0x3f')](_0x9aeee['query']['sort']);_0x4997e2[_0x1522('0x40')]=qs[_0x1522('0x38')](_[_0x1522('0x41')](_0x9aeee[_0x1522('0x36')],_0x20e4b9[_0x1522('0x38')]),_0x27e984);if(_0x9aeee['query'][_0x1522('0x42')]){_0x4997e2[_0x1522('0x40')]=_[_0x1522('0x43')](_0x4997e2[_0x1522('0x40')],{'$or':_[_0x1522('0x30')](_0x27e984,function(_0x3525f2){if(_0x3525f2[_0x1522('0x34')]!==_0x1522('0x44')){var _0x3b3135={};_0x3b3135[_0x3525f2['name']]={'$like':'%'+_0x9aeee[_0x1522('0x36')][_0x1522('0x42')]+'%'};return _0x3b3135;}})});}_0x4997e2=_['merge']({},_0x4997e2,_0x9aeee[_0x1522('0x45')]);var _0x1e6e60={'where':_0x4997e2[_0x1522('0x40')]};return db[_0x1522('0x31')][_0x1522('0x25')](_0x1e6e60)[_0x1522('0x29')](function(_0x22414b){_0x277449[_0x1522('0x25')]=_0x22414b;if(_0x9aeee[_0x1522('0x36')][_0x1522('0x46')]){_0x4997e2[_0x1522('0x47')]=[{'all':!![]}];}return db[_0x1522('0x31')][_0x1522('0x48')](_0x4997e2);})['then'](function(_0xfde8b){_0x277449['rows']=_0xfde8b;return _0x277449;})[_0x1522('0x29')](respondWithFilteredResult(_0x3bf947,_0x4997e2))['catch'](handleError(_0x3bf947,null));};exports['show']=function(_0x131dc8,_0x2d41e4){var _0x46a63f={'raw':![],'where':{'id':_0x131dc8[_0x1522('0x49')]['id']}},_0x131276={};_0x131276[_0x1522('0x35')]=_[_0x1522('0x37')](db[_0x1522('0x31')][_0x1522('0x32')]);_0x131276[_0x1522('0x36')]=_[_0x1522('0x37')](_0x131dc8[_0x1522('0x36')]);_0x131276[_0x1522('0x38')]=_[_0x1522('0x3a')](_0x131276['model'],_0x131276[_0x1522('0x36')]);_0x46a63f['attributes']=_[_0x1522('0x3a')](_0x131276['model'],qs[_0x1522('0x3b')](_0x131dc8[_0x1522('0x36')][_0x1522('0x3b')]));_0x46a63f[_0x1522('0x39')]=_0x46a63f[_0x1522('0x39')]['length']?_0x46a63f[_0x1522('0x39')]:_0x131276[_0x1522('0x35')];if(_0x131dc8['query'][_0x1522('0x46')]){_0x46a63f['include']=[{'all':!![]}];}_0x46a63f=_['merge']({},_0x46a63f,_0x131dc8['options']);return db[_0x1522('0x31')][_0x1522('0x4a')](_0x46a63f)[_0x1522('0x29')](handleEntityNotFound(_0x2d41e4,null))[_0x1522('0x29')](respondWithResult(_0x2d41e4,null))[_0x1522('0x4b')](handleError(_0x2d41e4,null));};exports[_0x1522('0x4c')]=function(_0x5c9e62,_0x36f9fc){return db['Dashboard']['create'](_0x5c9e62[_0x1522('0x4d')],{})[_0x1522('0x29')](function(_0x1782fd){var _0x43598b=_0x5c9e62['user'][_0x1522('0x4e')]({'plain':!![]});if(!_0x43598b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43598b['role']===_0x1522('0x4f')){var _0x183438=_0x1782fd[_0x1522('0x4e')]({'plain':!![]});var _0x195117=_0x1522('0x2b');return db[_0x1522('0x50')][_0x1522('0x4a')]({'where':{'name':_0x195117,'userProfileId':_0x43598b[_0x1522('0x51')]},'raw':!![]})[_0x1522('0x29')](function(_0x5b2af8){if(_0x5b2af8&&_0x5b2af8[_0x1522('0x52')]===0x0){return db[_0x1522('0x53')][_0x1522('0x4c')]({'name':_0x183438[_0x1522('0x2d')],'resourceId':_0x183438['id'],'type':_0x5b2af8[_0x1522('0x2d')],'sectionId':_0x5b2af8['id']},{})[_0x1522('0x29')](function(){return _0x1782fd;});}else{return _0x1782fd;}})[_0x1522('0x4b')](function(_0x21abce){logger[_0x1522('0x54')](_0x1522('0x55'),_0x21abce);throw _0x21abce;});}return _0x1782fd;})[_0x1522('0x29')](respondWithResult(_0x36f9fc,0xc9))[_0x1522('0x4b')](handleError(_0x36f9fc,null));};exports[_0x1522('0x56')]=function(_0x2d4169,_0x487d04){var _0x2fe039={'where':{'id':_0x2d4169['params']['id']}},_0x223d0a={};_0x223d0a[_0x1522('0x35')]=_[_0x1522('0x37')](db[_0x1522('0x31')]['rawAttributes']);_0x2fe039[_0x1522('0x39')]=_[_0x1522('0x3a')](_0x223d0a[_0x1522('0x35')],qs[_0x1522('0x3b')](_0x2d4169['query'][_0x1522('0x3b')]));_0x2fe039['attributes']=_0x2fe039[_0x1522('0x39')][_0x1522('0x57')]?_0x2fe039[_0x1522('0x39')]:_0x223d0a[_0x1522('0x35')];if(_0x2d4169[_0x1522('0x36')][_0x1522('0x46')]){_0x2fe039['include']=[{'all':!![]}];}_0x2fe039=_[_0x1522('0x43')]({},_0x2fe039,_0x2d4169['options']);return db[_0x1522('0x31')]['find'](_0x2fe039)[_0x1522('0x29')](handleEntityNotFound(_0x487d04,null))[_0x1522('0x29')](function(_0x5bc8f4){if(_0x5bc8f4){var _0x575be5=_0x5bc8f4[_0x1522('0x4e')]({'plain':!![]});_0x575be5=qs[_0x1522('0x58')](_0x575be5,['id',_0x1522('0x59'),'updatedAt']);_0x2d4169[_0x1522('0x4d')]=_[_0x1522('0x58')](_0x2d4169[_0x1522('0x4d')],['id',_0x1522('0x59'),_0x1522('0x5a')]);return db[_0x1522('0x31')][_0x1522('0x4c')](_[_0x1522('0x43')](_0x575be5,_0x2d4169[_0x1522('0x4d')]),{'include':_0x2d4169['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3acfa6){var _0x179775=_0x2d4169['user'][_0x1522('0x4e')]({'plain':!![]});if(!_0x179775)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x179775[_0x1522('0x5b')]===_0x1522('0x4f')){var _0x281690=_0x3acfa6['get']({'plain':!![]});var _0x2a6485=_0x1522('0x2b');return db[_0x1522('0x50')][_0x1522('0x4a')]({'where':{'name':_0x2a6485,'userProfileId':_0x179775['userProfileId']},'raw':!![]})['then'](function(_0x57c8ff){if(_0x57c8ff&&_0x57c8ff[_0x1522('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x281690[_0x1522('0x2d')],'resourceId':_0x281690['id'],'type':_0x57c8ff[_0x1522('0x2d')],'sectionId':_0x57c8ff['id']},{})[_0x1522('0x29')](function(){return _0x3acfa6;});}else{return _0x3acfa6;}})[_0x1522('0x4b')](function(_0x4e0f6b){logger[_0x1522('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e0f6b);throw _0x4e0f6b;});}return _0x3acfa6;});}})['then'](respondWithResult(_0x487d04,0xc9))[_0x1522('0x4b')](handleError(_0x487d04,null));};exports['update']=function(_0x44aea3,_0x481349){if(_0x44aea3[_0x1522('0x4d')]['id']){delete _0x44aea3[_0x1522('0x4d')]['id'];}return db[_0x1522('0x31')][_0x1522('0x4a')]({'where':{'id':_0x44aea3['params']['id']}})['then'](handleEntityNotFound(_0x481349,null))[_0x1522('0x29')](saveUpdates(_0x44aea3[_0x1522('0x4d')],null))[_0x1522('0x29')](respondWithResult(_0x481349,null))[_0x1522('0x4b')](handleError(_0x481349,null));};exports[_0x1522('0x2a')]=function(_0x37151d,_0x16a2c5){return db['Dashboard'][_0x1522('0x4a')]({'where':{'id':_0x37151d['params']['id']}})[_0x1522('0x29')](handleEntityNotFound(_0x16a2c5,null))[_0x1522('0x29')](removeEntity(_0x16a2c5,null))[_0x1522('0x4b')](handleError(_0x16a2c5,null));};function widgetAttributes(_0xf3214e){try{switch(_0xf3214e[_0x1522('0x34')]){case _0x1522('0x5c'):return[{'name':_0x1522('0x5d'),'value':_0xf3214e['attrUrl']||(_0xf3214e['attrs']&&_0xf3214e[_0x1522('0x5e')][0x0]?_0xf3214e[_0x1522('0x5e')][0x0]['value']:undefined)||_0x1522('0x5f')}];case _0x1522('0x60'):return[{'name':_0x1522('0x61'),'value':_0xf3214e[_0x1522('0x61')]||(_0xf3214e[_0x1522('0x5e')]&&_0xf3214e[_0x1522('0x5e')][0x0]?_0xf3214e['attrs'][0x0][_0x1522('0x62')]:undefined)||''}];case _0x1522('0x63'):return[{'name':_0x1522('0x64'),'value':_0xf3214e[_0x1522('0x64')]||(_0xf3214e[_0x1522('0x5e')]&&_0xf3214e[_0x1522('0x5e')][0x0]?_0xf3214e[_0x1522('0x5e')][0x0][_0x1522('0x62')]:undefined)||_0x1522('0x65')},{'name':'attrTimezone','value':_0xf3214e[_0x1522('0x66')]||(_0xf3214e[_0x1522('0x5e')]&&_0xf3214e[_0x1522('0x5e')][0x1]?_0xf3214e[_0x1522('0x5e')][0x1][_0x1522('0x62')]:undefined)||'0.00'},{'name':_0x1522('0x67'),'value':_0xf3214e[_0x1522('0x67')]||(_0xf3214e['attrs']&&_0xf3214e[_0x1522('0x5e')][0x2]?_0xf3214e[_0x1522('0x5e')][0x2][_0x1522('0x62')]:undefined)||0xc}];case'counter':return[{'name':_0x1522('0x68'),'value':_0xf3214e['attrMetric']||(_0xf3214e[_0x1522('0x5e')]&&_0xf3214e[_0x1522('0x5e')][0x0]?_0xf3214e[_0x1522('0x5e')][0x0][_0x1522('0x62')]:undefined)||_0x1522('0x69')},{'name':_0x1522('0x6a'),'value':_0xf3214e['attrVoiceQueues']||(_0xf3214e[_0x1522('0x5e')]&&_0xf3214e[_0x1522('0x5e')][0x1]?_0xf3214e[_0x1522('0x5e')][0x1][_0x1522('0x62')]:undefined)||[]},{'name':'attrFontSize','value':_0xf3214e[_0x1522('0x67')]||(_0xf3214e[_0x1522('0x5e')]&&_0xf3214e[_0x1522('0x5e')][0x2]?_0xf3214e[_0x1522('0x5e')][0x2]['value']:undefined)||0x14}];case _0x1522('0x6b'):case _0x1522('0x6c'):return[{'name':_0x1522('0x6d'),'value':_0xf3214e[_0x1522('0x6d')]||(_0xf3214e[_0x1522('0x5e')]&&_0xf3214e[_0x1522('0x5e')][0x0]?_0xf3214e['attrs'][0x0][_0x1522('0x62')]:undefined)||_0x1522('0x69')},{'name':'attrSerie2','value':_0xf3214e['attrSerie2']||(_0xf3214e['attrs']&&_0xf3214e['attrs'][0x1]?_0xf3214e['attrs'][0x1][_0x1522('0x62')]:undefined)||null},{'name':'attrSerie3','value':_0xf3214e[_0x1522('0x6e')]||(_0xf3214e[_0x1522('0x5e')]&&_0xf3214e['attrs'][0x2]?_0xf3214e[_0x1522('0x5e')][0x2][_0x1522('0x62')]:undefined)||null},{'name':_0x1522('0x6a'),'value':_0xf3214e[_0x1522('0x6a')]||(_0xf3214e[_0x1522('0x5e')]&&_0xf3214e[_0x1522('0x5e')][0x3]?_0xf3214e[_0x1522('0x5e')][0x3]['value']:undefined)||[]}];case _0x1522('0x6f'):return[{'name':'attrReport','type':_0xf3214e[_0x1522('0x70')]||(_0xf3214e[_0x1522('0x5e')]&&_0xf3214e[_0x1522('0x5e')][0x0]?_0xf3214e[_0x1522('0x5e')][0x0]['type']:undefined)||null,'value':_0xf3214e[_0x1522('0x71')]||(_0xf3214e['attrs']&&_0xf3214e['attrs'][0x0]?_0xf3214e[_0x1522('0x5e')][0x0][_0x1522('0x62')]:undefined)||null},{'name':'attrRefresh','value':_0xf3214e[_0x1522('0x72')]||(_0xf3214e[_0x1522('0x5e')]&&_0xf3214e['attrs'][0x1]?_0xf3214e[_0x1522('0x5e')][0x1][_0x1522('0x62')]:undefined)||0x0}];default:return[];}}catch(_0x48b63e){logger[_0x1522('0x54')]('widgetAttributes:\x20%s',JSON[_0x1522('0x73')](_0x48b63e));return[];}}exports['addItem']=function(_0x566373,_0x5ad33c,_0x4c96d7){if(_0x566373[_0x1522('0x4d')]['id']){delete _0x566373[_0x1522('0x4d')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x566373[_0x1522('0x49')]['id']}})[_0x1522('0x29')](handleEntityNotFound(_0x5ad33c,null))[_0x1522('0x29')](function(_0x462b67){if(_0x462b67){_0x566373[_0x1522('0x4d')][_0x1522('0x74')]=_0x462b67['id'];_0x566373[_0x1522('0x4d')]['attrs']=widgetAttributes(_0x566373['body']);return db[_0x1522('0x75')][_0x1522('0x4c')](_0x566373['body']);}})['then'](respondWithResult(_0x5ad33c,null))[_0x1522('0x4b')](handleError(_0x5ad33c,null));};exports[_0x1522('0x76')]=function(_0x566449,_0x2cf11e,_0x4cdc3d){var _0x3502cf={};var _0x1b6235={};var _0x546a60;var _0x5cf308;return db[_0x1522('0x31')][_0x1522('0x77')]({'where':{'id':_0x566449[_0x1522('0x49')]['id']}})['then'](handleEntityNotFound(_0x2cf11e,null))[_0x1522('0x29')](function(_0x49e98d){if(_0x49e98d){_0x546a60=_0x49e98d;_0x1b6235[_0x1522('0x35')]=_[_0x1522('0x37')](db[_0x1522('0x75')][_0x1522('0x32')]);_0x1b6235[_0x1522('0x36')]=_['keys'](_0x566449[_0x1522('0x36')]);_0x1b6235['filters']=_[_0x1522('0x3a')](_0x1b6235[_0x1522('0x35')],_0x1b6235['query']);_0x3502cf['attributes']=_['intersection'](_0x1b6235['model'],qs[_0x1522('0x3b')](_0x566449['query'][_0x1522('0x3b')]));_0x3502cf['attributes']=_0x3502cf[_0x1522('0x39')][_0x1522('0x57')]?_0x3502cf[_0x1522('0x39')]:_0x1b6235[_0x1522('0x35')];_0x3502cf['order']=qs[_0x1522('0x3f')](_0x566449[_0x1522('0x36')][_0x1522('0x3f')]);_0x3502cf['where']=qs['filters'](_[_0x1522('0x41')](_0x566449[_0x1522('0x36')],_0x1b6235['filters']));if(_0x566449['query'][_0x1522('0x42')]){_0x3502cf[_0x1522('0x40')]=_['merge'](_0x3502cf[_0x1522('0x40')],{'$or':_[_0x1522('0x30')](_0x3502cf[_0x1522('0x39')],function(_0x543b73){var _0x5bf54b={};_0x5bf54b[_0x543b73]={'$like':'%'+_0x566449[_0x1522('0x36')][_0x1522('0x42')]+'%'};return _0x5bf54b;})});}_0x3502cf=_[_0x1522('0x43')]({},_0x3502cf,_0x566449[_0x1522('0x45')]);return _0x546a60['getItems'](_0x3502cf);}})['then'](function(_0x2a924e){if(_0x2a924e){_0x5cf308=_0x2a924e[_0x1522('0x57')];if(!_0x566449['query'][_0x1522('0x3c')]('nolimit')){_0x3502cf[_0x1522('0x24')]=qs['limit'](_0x566449[_0x1522('0x36')][_0x1522('0x24')]);_0x3502cf['offset']=qs['offset'](_0x566449[_0x1522('0x36')][_0x1522('0x26')]);}return _0x546a60[_0x1522('0x76')](_0x3502cf);}})[_0x1522('0x29')](function(_0x200ab6){if(_0x200ab6){return _0x200ab6?{'count':_0x5cf308,'rows':_0x200ab6}:null;}})[_0x1522('0x29')](respondWithResult(_0x2cf11e,null))[_0x1522('0x4b')](handleError(_0x2cf11e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index b621423..ce49170 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 _0xc48d=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove','emit'];(function(_0x2a32a1,_0x14a756){var _0x2e3261=function(_0x4cd10d){while(--_0x4cd10d){_0x2a32a1['push'](_0x2a32a1['shift']());}};_0x2e3261(++_0x14a756);}(_0xc48d,0x11a));var _0xdc48=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0xc48d[_0x421cf8];return _0x145c48;};'use strict';var EventEmitter=require(_0xdc48('0x0'));var Dashboard=require(_0xdc48('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdc48('0x2'),'afterUpdate':_0xdc48('0x3'),'afterDestroy':_0xdc48('0x4')};function emitEvent(_0x39ee61){return function(_0x3da692,_0x286809,_0x2faa2e){DashboardEvents[_0xdc48('0x5')](_0x39ee61+':'+_0x3da692['id'],_0x3da692);DashboardEvents[_0xdc48('0x5')](_0x39ee61,_0x3da692);_0x2faa2e(null);};}for(var e in events){if(events[_0xdc48('0x6')](e)){var event=events[e];Dashboard[_0xdc48('0x7')](e,emitEvent(event));}}module[_0xdc48('0x8')]=DashboardEvents; \ No newline at end of file +var _0x282f=['save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard'];(function(_0x154ffd,_0x4b47c2){var _0xb6e802=function(_0x3c00f9){while(--_0x3c00f9){_0x154ffd['push'](_0x154ffd['shift']());}};_0xb6e802(++_0x4b47c2);}(_0x282f,0x153));var _0xf282=function(_0x2acb85,_0x2769e2){_0x2acb85=_0x2acb85-0x0;var _0x2063d5=_0x282f[_0x2acb85];return _0x2063d5;};'use strict';var EventEmitter=require(_0xf282('0x0'));var Dashboard=require(_0xf282('0x1'))['db'][_0xf282('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf282('0x3'),'afterUpdate':'update','afterDestroy':_0xf282('0x4')};function emitEvent(_0x3fd09b){return function(_0x2e2120,_0x25abc7,_0x478b73){DashboardEvents[_0xf282('0x5')](_0x3fd09b+':'+_0x2e2120['id'],_0x2e2120);DashboardEvents['emit'](_0x3fd09b,_0x2e2120);_0x478b73(null);};}for(var e in events){if(events[_0xf282('0x6')](e)){var event=events[e];Dashboard[_0xf282('0x7')](e,emitEvent(event));}}module[_0xf282('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 bfd7615..f06be58 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 _0xbfa3=['request-promise','path','rimraf','./dashboard.attributes','exports','define','Dashboard','dashboards','util','api','moment','bluebird'];(function(_0x3a32e0,_0x69a2f1){var _0x43ae59=function(_0x234f2e){while(--_0x234f2e){_0x3a32e0['push'](_0x3a32e0['shift']());}};_0x43ae59(++_0x69a2f1);}(_0xbfa3,0x1f4));var _0x3bfa=function(_0x5a23d6,_0x1f5bd3){_0x5a23d6=_0x5a23d6-0x0;var _0x2ff882=_0xbfa3[_0x5a23d6];return _0x2ff882;};'use strict';var _=require('lodash');var util=require(_0x3bfa('0x0'));var logger=require('../../config/logger')(_0x3bfa('0x1'));var moment=require(_0x3bfa('0x2'));var BPromise=require(_0x3bfa('0x3'));var rp=require(_0x3bfa('0x4'));var fs=require('fs');var path=require(_0x3bfa('0x5'));var rimraf=require(_0x3bfa('0x6'));var config=require('../../config/environment');var attributes=require(_0x3bfa('0x7'));module[_0x3bfa('0x8')]=function(_0x4fdd0c,_0xa662d1){return _0x4fdd0c[_0x3bfa('0x9')](_0x3bfa('0xa'),attributes,{'tableName':_0x3bfa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d16=['lodash','util','../../config/logger','api','moment','path','../../config/environment','./dashboard.attributes','exports','define','dashboards'];(function(_0x4b5e23,_0x401b1){var _0x371abd=function(_0x3f6ed6){while(--_0x3f6ed6){_0x4b5e23['push'](_0x4b5e23['shift']());}};_0x371abd(++_0x401b1);}(_0x0d16,0xbb));var _0x60d1=function(_0x5e943c,_0x5e4f6a){_0x5e943c=_0x5e943c-0x0;var _0x1b2421=_0x0d16[_0x5e943c];return _0x1b2421;};'use strict';var _=require(_0x60d1('0x0'));var util=require(_0x60d1('0x1'));var logger=require(_0x60d1('0x2'))(_0x60d1('0x3'));var moment=require(_0x60d1('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x60d1('0x5'));var rimraf=require('rimraf');var config=require(_0x60d1('0x6'));var attributes=require(_0x60d1('0x7'));module[_0x60d1('0x8')]=function(_0x42d473,_0x1fc1e1){return _0x42d473[_0x60d1('0x9')]('Dashboard',attributes,{'tableName':_0x60d1('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 d631b6d..31a8ad5 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 _0x4256=['rpc','../../config/environment','jayson/promise','redis','localhost','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1a30e1,_0x387e26){var _0x24e239=function(_0x58878e){while(--_0x58878e){_0x1a30e1['push'](_0x1a30e1['shift']());}};_0x24e239(++_0x387e26);}(_0x4256,0x124));var _0x6425=function(_0x6c0123,_0x4c8d3b){_0x6c0123=_0x6c0123-0x0;var _0x5a87d2=_0x4256[_0x6c0123];return _0x5a87d2;};'use strict';var _=require(_0x6425('0x0'));var util=require(_0x6425('0x1'));var moment=require(_0x6425('0x2'));var BPromise=require(_0x6425('0x3'));var rs=require(_0x6425('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6425('0x5'))['db'];var utils=require(_0x6425('0x6'));var logger=require(_0x6425('0x7'))(_0x6425('0x8'));var config=require(_0x6425('0x9'));var jayson=require(_0x6425('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x6425('0xb')]=_['defaults'](config[_0x6425('0xb')],{'host':_0x6425('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6425('0xb')]));require(_0x6425('0xd'))[_0x6425('0xe')](socket);function respondWithRpcPromise(_0x29ec2f,_0x50b0c0,_0x25b829){return new BPromise(function(_0x48ec17,_0x37c2e8){return client['request'](_0x29ec2f,_0x25b829)[_0x6425('0xf')](function(_0x3ba233){logger[_0x6425('0x10')](_0x6425('0x11'),_0x50b0c0,'request\x20sent');logger[_0x6425('0x12')](_0x6425('0x13'),_0x50b0c0,'request\x20sent',JSON['stringify'](_0x3ba233));if(_0x3ba233[_0x6425('0x14')]){if(_0x3ba233[_0x6425('0x14')][_0x6425('0x15')]===0x1f4){logger['error'](_0x6425('0x11'),_0x50b0c0,_0x3ba233[_0x6425('0x14')][_0x6425('0x16')]);return _0x37c2e8(_0x3ba233[_0x6425('0x14')][_0x6425('0x16')]);}logger[_0x6425('0x14')](_0x6425('0x11'),_0x50b0c0,_0x3ba233['error'][_0x6425('0x16')]);return _0x48ec17(_0x3ba233[_0x6425('0x14')][_0x6425('0x16')]);}else{logger[_0x6425('0x10')](_0x6425('0x11'),_0x50b0c0,'request\x20sent');_0x48ec17(_0x3ba233[_0x6425('0x17')][_0x6425('0x16')]);}})[_0x6425('0x18')](function(_0x4b9c4e){logger['error'](_0x6425('0x11'),_0x50b0c0,_0x4b9c4e);_0x37c2e8(_0x4b9c4e);});});} \ No newline at end of file +var _0x4ec8=['Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0x4ec8,0x1db));var _0x84ec=function(_0x392461,_0x36cb63){_0x392461=_0x392461-0x0;var _0x2e9964=_0x4ec8[_0x392461];return _0x2e9964;};'use strict';var _=require('lodash');var util=require(_0x84ec('0x0'));var moment=require(_0x84ec('0x1'));var BPromise=require(_0x84ec('0x2'));var rs=require(_0x84ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x84ec('0x4'))(_0x84ec('0x5'));var config=require(_0x84ec('0x6'));var jayson=require(_0x84ec('0x7'));var client=jayson[_0x84ec('0x8')]['http']({'port':0x232a});config[_0x84ec('0x9')]=_['defaults'](config[_0x84ec('0x9')],{'host':_0x84ec('0xa'),'port':0x18eb});var socket=require(_0x84ec('0xb'))(new Redis(config['redis']));require(_0x84ec('0xc'))[_0x84ec('0xd')](socket);function respondWithRpcPromise(_0x47b969,_0x34aca4,_0x308e57){return new BPromise(function(_0x3dde7f,_0x2e69f5){return client[_0x84ec('0xe')](_0x47b969,_0x308e57)['then'](function(_0x5a1247){logger[_0x84ec('0xf')](_0x84ec('0x10'),_0x34aca4,_0x84ec('0x11'));logger[_0x84ec('0x12')](_0x84ec('0x13'),_0x34aca4,_0x84ec('0x11'),JSON[_0x84ec('0x14')](_0x5a1247));if(_0x5a1247['error']){if(_0x5a1247[_0x84ec('0x15')][_0x84ec('0x16')]===0x1f4){logger[_0x84ec('0x15')](_0x84ec('0x10'),_0x34aca4,_0x5a1247[_0x84ec('0x15')][_0x84ec('0x17')]);return _0x2e69f5(_0x5a1247[_0x84ec('0x15')][_0x84ec('0x17')]);}logger[_0x84ec('0x15')]('Dashboard,\x20%s,\x20%s',_0x34aca4,_0x5a1247[_0x84ec('0x15')][_0x84ec('0x17')]);return _0x3dde7f(_0x5a1247[_0x84ec('0x15')][_0x84ec('0x17')]);}else{logger[_0x84ec('0xf')](_0x84ec('0x10'),_0x34aca4,_0x84ec('0x11'));_0x3dde7f(_0x5a1247[_0x84ec('0x18')][_0x84ec('0x17')]);}})[_0x84ec('0x19')](function(_0x20fb30){logger[_0x84ec('0x15')]('Dashboard,\x20%s,\x20%s',_0x34aca4,_0x20fb30);_0x2e69f5(_0x20fb30);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 551d60f..db60439 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 _0x159a=['./dashboard.events','remove','emit','register','dashboard:'];(function(_0x51fe86,_0x422b66){var _0x3557d4=function(_0x524a6a){while(--_0x524a6a){_0x51fe86['push'](_0x51fe86['shift']());}};_0x3557d4(++_0x422b66);}(_0x159a,0x1e5));var _0xa159=function(_0x505241,_0x54a73d){_0x505241=_0x505241-0x0;var _0x1a1fcb=_0x159a[_0x505241];return _0x1a1fcb;};'use strict';var DashboardEvents=require(_0xa159('0x0'));var events=['save',_0xa159('0x1'),'update'];function createListener(_0x12c2ba,_0x51a398){return function(_0x2bb64a){_0x51a398[_0xa159('0x2')](_0x12c2ba,_0x2bb64a);};}function removeListener(_0x56d938,_0x48d4ca){return function(){DashboardEvents['removeListener'](_0x56d938,_0x48d4ca);};}exports[_0xa159('0x3')]=function(_0x255f8b){for(var _0x9d0dda=0x0,_0x323ed3=events['length'];_0x9d0dda<_0x323ed3;_0x9d0dda++){var _0x70a7de=events[_0x9d0dda];var _0x52fcbc=createListener(_0xa159('0x4')+_0x70a7de,_0x255f8b);DashboardEvents['on'](_0x70a7de,_0x52fcbc);}}; \ No newline at end of file +var _0x7821=['remove','update','emit','removeListener','register','length','dashboard:','./dashboard.events','save'];(function(_0x2060c2,_0x4e0b9d){var _0x5b73a6=function(_0x1eef84){while(--_0x1eef84){_0x2060c2['push'](_0x2060c2['shift']());}};_0x5b73a6(++_0x4e0b9d);}(_0x7821,0x1ae));var _0x1782=function(_0x3018eb,_0x570c63){_0x3018eb=_0x3018eb-0x0;var _0x23131f=_0x7821[_0x3018eb];return _0x23131f;};'use strict';var DashboardEvents=require(_0x1782('0x0'));var events=[_0x1782('0x1'),_0x1782('0x2'),_0x1782('0x3')];function createListener(_0x3e7356,_0x59a895){return function(_0x56c54d){_0x59a895[_0x1782('0x4')](_0x3e7356,_0x56c54d);};}function removeListener(_0x37605e,_0x5a97f4){return function(){DashboardEvents[_0x1782('0x5')](_0x37605e,_0x5a97f4);};}exports[_0x1782('0x6')]=function(_0x28aaaa){for(var _0x364db2=0x0,_0x119b74=events[_0x1782('0x7')];_0x364db2<_0x119b74;_0x364db2++){var _0x140b8b=events[_0x364db2];var _0x1e0945=createListener(_0x1782('0x8')+_0x140b8b,_0x28aaaa);DashboardEvents['on'](_0x140b8b,_0x1e0945);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index e36985c..e0cdff8 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 _0x33bd=['../../components/interaction/service','./dashboard.controller','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x56f308,_0x567609){var _0x1f8640=function(_0x4ce4c3){while(--_0x4ce4c3){_0x56f308['push'](_0x56f308['shift']());}};_0x1f8640(++_0x567609);}(_0x33bd,0x15b));var _0xd33b=function(_0x4e0901,_0x342f0e){_0x4e0901=_0x4e0901-0x0;var _0x1c5d7a=_0x33bd[_0x4e0901];return _0x1c5d7a;};'use strict';var multer=require(_0xd33b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd33b('0x1'));var express=require('express');var router=express[_0xd33b('0x2')]();var fs_extra=require(_0xd33b('0x3'));var auth=require(_0xd33b('0x4'));var interaction=require(_0xd33b('0x5'));var config=require('../../config/environment');var controller=require(_0xd33b('0x6'));router['get']('/',auth[_0xd33b('0x7')](),controller[_0xd33b('0x8')]);router['get'](_0xd33b('0x9'),auth[_0xd33b('0x7')](),controller[_0xd33b('0xa')]);router['get'](_0xd33b('0xb'),auth[_0xd33b('0x7')](),controller[_0xd33b('0xc')]);router[_0xd33b('0xd')]('/',auth[_0xd33b('0x7')](),controller[_0xd33b('0xe')]);router['post'](_0xd33b('0xf'),auth[_0xd33b('0x7')](),controller['clone']);router['post'](_0xd33b('0xb'),auth[_0xd33b('0x7')](),controller[_0xd33b('0x10')]);router[_0xd33b('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd33b('0x12')]);router[_0xd33b('0x13')]('/:id',auth[_0xd33b('0x7')](),controller[_0xd33b('0x14')]);module[_0xd33b('0x15')]=router; \ No newline at end of file +var _0x4357=['delete','exports','util','path','fs-extra','../../components/auth/service','get','isAuthenticated','show','/:id/items','getItems','post','clone','/:id','update'];(function(_0x77481e,_0x26c026){var _0x2cefb5=function(_0x3ac516){while(--_0x3ac516){_0x77481e['push'](_0x77481e['shift']());}};_0x2cefb5(++_0x26c026);}(_0x4357,0xd4));var _0x7435=function(_0x4aa33b,_0x18235f){_0x4aa33b=_0x4aa33b-0x0;var _0x5efce2=_0x4357[_0x4aa33b];return _0x5efce2;};'use strict';var multer=require('multer');var util=require(_0x7435('0x0'));var path=require(_0x7435('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7435('0x2'));var auth=require(_0x7435('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0x7435('0x4')]('/',auth[_0x7435('0x5')](),controller['index']);router[_0x7435('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x7435('0x6')]);router['get'](_0x7435('0x7'),auth[_0x7435('0x5')](),controller[_0x7435('0x8')]);router[_0x7435('0x9')]('/',auth[_0x7435('0x5')](),controller['create']);router[_0x7435('0x9')]('/:id/clone',auth[_0x7435('0x5')](),controller[_0x7435('0xa')]);router[_0x7435('0x9')]('/:id/items',auth[_0x7435('0x5')](),controller['addItem']);router['put'](_0x7435('0xb'),auth[_0x7435('0x5')](),controller[_0x7435('0xc')]);router[_0x7435('0xd')](_0x7435('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7435('0xe')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 4720c80..eaae1ff 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 _0x2a07=['setDataValue','stringify','INTEGER','#2196f3','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x50e67a,_0x1784b8){var _0x34ff8d=function(_0xb93fbc){while(--_0xb93fbc){_0x50e67a['push'](_0x50e67a['shift']());}};_0x34ff8d(++_0x1784b8);}(_0x2a07,0x74));var _0x72a0=function(_0x35bdcf,_0x21421c){_0x35bdcf=_0x35bdcf-0x0;var _0x5a4fc7=_0x2a07[_0x35bdcf];return _0x5a4fc7;};'use strict';var Sequelize=require(_0x72a0('0x0'));var squel=require(_0x72a0('0x1'));var _=require(_0x72a0('0x2'));module[_0x72a0('0x3')]={'title':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x72a0('0x5')](_0x72a0('0x6')),'get':function(){try{return JSON[_0x72a0('0x7')](this[_0x72a0('0x8')](_0x72a0('0x9')));}catch(_0xce74c){return[];}},'set':function(_0x3ccf6d){try{this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')](_0x3ccf6d));}catch(_0x21c819){this[_0x72a0('0xa')](_0x72a0('0x9'),JSON[_0x72a0('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x72a0('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x72a0('0xc')]},'background':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x72a0('0x4')],'allowNull':![],'defaultValue':_0x72a0('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x72a0('0x4')]},'titleFontSize':{'type':Sequelize[_0x72a0('0xc')],'defaultValue':0xc}}; \ No newline at end of file +var _0x3f8a=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','long'];(function(_0x4e0403,_0x23bb0a){var _0xb4ab4f=function(_0x3c12c3){while(--_0x3c12c3){_0x4e0403['push'](_0x4e0403['shift']());}};_0xb4ab4f(++_0x23bb0a);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x2feaad,_0x1aa6fc){_0x2feaad=_0x2feaad-0x0;var _0x5514bd=_0x3f8a[_0x2feaad];return _0x5514bd;};'use strict';var Sequelize=require(_0xa3f8('0x0'));var squel=require(_0xa3f8('0x1'));var _=require(_0xa3f8('0x2'));module[_0xa3f8('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa3f8('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xa3f8('0x5')](_0xa3f8('0x6')),'get':function(){try{return JSON[_0xa3f8('0x7')](this[_0xa3f8('0x8')](_0xa3f8('0x9')));}catch(_0x39d2e4){return[];}},'set':function(_0x471464){try{this[_0xa3f8('0xa')](_0xa3f8('0x9'),JSON[_0xa3f8('0xb')](_0x471464));}catch(_0x268332){this[_0xa3f8('0xa')](_0xa3f8('0x9'),JSON[_0xa3f8('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0xa3f8('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xa3f8('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0xa3f8('0xc')]},'background':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'defaultValue':_0xa3f8('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xa3f8('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xa3f8('0x4')]},'titleFontSize':{'type':Sequelize[_0xa3f8('0xc')],'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 70aadc6..fdeacce 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 _0x6001=['stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','error','stack','name','send','show','params','model','keys','DashboardItem','filters','intersection','query','attributes','fields','length','include','merge','find','destroy','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','widgetAttributes:\x20%s'];(function(_0x1c4951,_0x2038ee){var _0x345e1b=function(_0x69ee47){while(--_0x69ee47){_0x1c4951['push'](_0x1c4951['shift']());}};_0x345e1b(++_0x2038ee);}(_0x6001,0x1cb));var _0x1600=function(_0x2e7f1e,_0x32f286){_0x2e7f1e=_0x2e7f1e-0x0;var _0x3dffa5=_0x6001[_0x2e7f1e];return _0x3dffa5;};'use strict';var emlformat=require(_0x1600('0x0'));var rimraf=require(_0x1600('0x1'));var zipdir=require(_0x1600('0x2'));var jsonpatch=require(_0x1600('0x3'));var rp=require('request-promise');var moment=require(_0x1600('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1600('0x5'));var util=require('util');var path=require(_0x1600('0x6'));var sox=require(_0x1600('0x7'));var csv=require(_0x1600('0x8'));var ejs=require(_0x1600('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1600('0xa'));var crypto=require(_0x1600('0xb'));var jsforce=require(_0x1600('0xc'));var deskjs=require(_0x1600('0xd'));var toCsv=require(_0x1600('0x8'));var querystring=require(_0x1600('0xe'));var Papa=require(_0x1600('0xf'));var Redis=require(_0x1600('0x10'));var authService=require(_0x1600('0x11'));var qs=require(_0x1600('0x12'));var as=require(_0x1600('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1600('0x14'));var utils=require(_0x1600('0x15'));var config=require(_0x1600('0x16'));var licenseUtil=require(_0x1600('0x17'));var db=require('../../mysqldb')['db'];config[_0x1600('0x18')]=_[_0x1600('0x19')](config[_0x1600('0x18')],{'host':_0x1600('0x1a'),'port':0x18eb});var socket=require(_0x1600('0x1b'))(new Redis(config[_0x1600('0x18')]));require(_0x1600('0x1c'))[_0x1600('0x1d')](socket);function respondWithStatusCode(_0x4a1e70,_0x549955){_0x549955=_0x549955||0xcc;return function(_0x176089){if(_0x176089){return _0x4a1e70[_0x1600('0x1e')](_0x549955);}return _0x4a1e70[_0x1600('0x1f')](_0x549955)[_0x1600('0x20')]();};}function respondWithResult(_0x18f9df,_0x651968){_0x651968=_0x651968||0xc8;return function(_0x2f6dc9){if(_0x2f6dc9){return _0x18f9df['status'](_0x651968)[_0x1600('0x21')](_0x2f6dc9);}};}function respondWithFilteredResult(_0x5a5ec3,_0x4cea4a){return function(_0x59051c){if(_0x59051c){var _0x33a0c3=typeof _0x4cea4a[_0x1600('0x22')]===_0x1600('0x23')&&typeof _0x4cea4a[_0x1600('0x24')]===_0x1600('0x23');var _0x8f0ee3=_0x59051c[_0x1600('0x25')];var _0x49bd66=_0x33a0c3?0x0:_0x4cea4a[_0x1600('0x22')];var _0x6a758d=_0x33a0c3?_0x59051c[_0x1600('0x25')]:_0x4cea4a[_0x1600('0x22')]+_0x4cea4a[_0x1600('0x24')];var _0x360b57;if(_0x6a758d>=_0x8f0ee3){_0x6a758d=_0x8f0ee3;_0x360b57=0xc8;}else{_0x360b57=0xce;}_0x5a5ec3[_0x1600('0x1f')](_0x360b57);return _0x5a5ec3[_0x1600('0x26')]('Content-Range',_0x49bd66+'-'+_0x6a758d+'/'+_0x8f0ee3)[_0x1600('0x21')](_0x59051c);}return null;};}function patchUpdates(_0x2143f2){return function(_0x1ba567){try{jsonpatch[_0x1600('0x27')](_0x1ba567,_0x2143f2,!![]);}catch(_0xd9e055){return BPromise['reject'](_0xd9e055);}return _0x1ba567[_0x1600('0x28')]();};}function saveUpdates(_0x16fcda,_0x1fa331){return function(_0x2e9f4a){if(_0x2e9f4a){return _0x2e9f4a['update'](_0x16fcda)[_0x1600('0x29')](function(_0x27764c){return _0x27764c;});}return null;};}function removeEntity(_0x2cb21c,_0x3cb580){return function(_0x29ba59){if(_0x29ba59){return _0x29ba59['destroy']()[_0x1600('0x29')](function(){_0x2cb21c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x8553ac,_0x40f15c){return function(_0x259762){if(!_0x259762){_0x8553ac['sendStatus'](0x194);}return _0x259762;};}function handleError(_0x379d77,_0x251fe9){_0x251fe9=_0x251fe9||0x1f4;return function(_0x25fde2){logger[_0x1600('0x2a')](_0x25fde2[_0x1600('0x2b')]);if(_0x25fde2[_0x1600('0x2c')]){delete _0x25fde2['name'];}_0x379d77['status'](_0x251fe9)[_0x1600('0x2d')](_0x25fde2);};}exports[_0x1600('0x2e')]=function(_0x28c72b,_0xa761f2){var _0x4c227e={'raw':![],'where':{'id':_0x28c72b[_0x1600('0x2f')]['id']}},_0x1332db={};_0x1332db[_0x1600('0x30')]=_[_0x1600('0x31')](db[_0x1600('0x32')]['rawAttributes']);_0x1332db['query']=_[_0x1600('0x31')](_0x28c72b['query']);_0x1332db[_0x1600('0x33')]=_[_0x1600('0x34')](_0x1332db[_0x1600('0x30')],_0x1332db[_0x1600('0x35')]);_0x4c227e[_0x1600('0x36')]=_[_0x1600('0x34')](_0x1332db[_0x1600('0x30')],qs[_0x1600('0x37')](_0x28c72b[_0x1600('0x35')][_0x1600('0x37')]));_0x4c227e[_0x1600('0x36')]=_0x4c227e[_0x1600('0x36')][_0x1600('0x38')]?_0x4c227e['attributes']:_0x1332db[_0x1600('0x30')];if(_0x28c72b['query']['includeAll']){_0x4c227e[_0x1600('0x39')]=[{'all':!![]}];}_0x4c227e=_[_0x1600('0x3a')]({},_0x4c227e,_0x28c72b['options']);return db[_0x1600('0x32')][_0x1600('0x3b')](_0x4c227e)[_0x1600('0x29')](handleEntityNotFound(_0xa761f2,null))[_0x1600('0x29')](respondWithResult(_0xa761f2,null))['catch'](handleError(_0xa761f2,null));};exports[_0x1600('0x3c')]=function(_0x596654,_0x31a76b){return db[_0x1600('0x32')][_0x1600('0x3b')]({'where':{'id':_0x596654[_0x1600('0x2f')]['id']}})[_0x1600('0x29')](handleEntityNotFound(_0x31a76b,null))[_0x1600('0x29')](removeEntity(_0x31a76b,null))[_0x1600('0x3d')](handleError(_0x31a76b,null));};function widgetAttributes(_0x250889){try{switch(_0x250889[_0x1600('0x3e')]){case _0x1600('0x3f'):return[{'name':_0x1600('0x40'),'value':_0x250889['attrUrl']||(_0x250889['attrs']&&_0x250889[_0x1600('0x41')][0x0]?_0x250889[_0x1600('0x41')][0x0][_0x1600('0x42')]:undefined)||'https://'}];case _0x1600('0x43'):return[{'name':_0x1600('0x44'),'value':_0x250889[_0x1600('0x44')]||(_0x250889[_0x1600('0x41')]&&_0x250889[_0x1600('0x41')][0x0]?_0x250889[_0x1600('0x41')][0x0][_0x1600('0x42')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x250889[_0x1600('0x45')]||(_0x250889[_0x1600('0x41')]&&_0x250889[_0x1600('0x41')][0x0]?_0x250889[_0x1600('0x41')][0x0]['value']:undefined)||_0x1600('0x46')},{'name':_0x1600('0x47'),'value':_0x250889['attrTimezone']||(_0x250889[_0x1600('0x41')]&&_0x250889[_0x1600('0x41')][0x1]?_0x250889[_0x1600('0x41')][0x1][_0x1600('0x42')]:undefined)||_0x1600('0x48')},{'name':_0x1600('0x49'),'value':_0x250889['attrFontSize']||(_0x250889[_0x1600('0x41')]&&_0x250889[_0x1600('0x41')][0x2]?_0x250889[_0x1600('0x41')][0x2][_0x1600('0x42')]:undefined)||0xc}];case _0x1600('0x4a'):return[{'name':_0x1600('0x4b'),'value':_0x250889[_0x1600('0x4b')]||(_0x250889[_0x1600('0x41')]&&_0x250889['attrs'][0x0]?_0x250889[_0x1600('0x41')][0x0][_0x1600('0x42')]:undefined)||_0x1600('0x4c')},{'name':_0x1600('0x4d'),'value':_0x250889[_0x1600('0x4d')]||(_0x250889[_0x1600('0x41')]&&_0x250889['attrs'][0x1]?_0x250889[_0x1600('0x41')][0x1][_0x1600('0x42')]:undefined)||[]},{'name':_0x1600('0x49'),'value':_0x250889[_0x1600('0x49')]||(_0x250889['attrs']&&_0x250889['attrs'][0x2]?_0x250889[_0x1600('0x41')][0x2][_0x1600('0x42')]:undefined)||0x14}];case _0x1600('0x4e'):case _0x1600('0x4f'):return[{'name':_0x1600('0x50'),'value':_0x250889[_0x1600('0x50')]||(_0x250889[_0x1600('0x41')]&&_0x250889[_0x1600('0x41')][0x0]?_0x250889[_0x1600('0x41')][0x0][_0x1600('0x42')]:undefined)||_0x1600('0x4c')},{'name':_0x1600('0x51'),'value':_0x250889[_0x1600('0x51')]||(_0x250889['attrs']&&_0x250889[_0x1600('0x41')][0x1]?_0x250889[_0x1600('0x41')][0x1][_0x1600('0x42')]:undefined)||null},{'name':_0x1600('0x52'),'value':_0x250889[_0x1600('0x52')]||(_0x250889[_0x1600('0x41')]&&_0x250889['attrs'][0x2]?_0x250889[_0x1600('0x41')][0x2][_0x1600('0x42')]:undefined)||null},{'name':_0x1600('0x4d'),'value':_0x250889[_0x1600('0x4d')]||(_0x250889['attrs']&&_0x250889['attrs'][0x3]?_0x250889[_0x1600('0x41')][0x3]['value']:undefined)||[]}];case _0x1600('0x53'):return[{'name':'attrReport','type':_0x250889[_0x1600('0x54')]||(_0x250889[_0x1600('0x41')]&&_0x250889['attrs'][0x0]?_0x250889['attrs'][0x0][_0x1600('0x3e')]:undefined)||null,'value':_0x250889[_0x1600('0x55')]||(_0x250889['attrs']&&_0x250889[_0x1600('0x41')][0x0]?_0x250889['attrs'][0x0][_0x1600('0x42')]:undefined)||null},{'name':'attrRefresh','value':_0x250889['attrRefresh']||(_0x250889[_0x1600('0x41')]&&_0x250889[_0x1600('0x41')][0x1]?_0x250889[_0x1600('0x41')][0x1][_0x1600('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x1f1ea5){logger[_0x1600('0x2a')](_0x1600('0x56'),JSON[_0x1600('0x57')](_0x1f1ea5));return[];}}exports[_0x1600('0x58')]=function(_0x26a8d9,_0x4a5606){if(_0x26a8d9['body']){_0x26a8d9[_0x1600('0x59')][_0x1600('0x41')]=widgetAttributes(_0x26a8d9['body']);}return db[_0x1600('0x32')][_0x1600('0x58')](_0x26a8d9[_0x1600('0x59')],{})[_0x1600('0x29')](respondWithResult(_0x4a5606,0xc9))[_0x1600('0x3d')](handleError(_0x4a5606,null));};exports[_0x1600('0x5a')]=function(_0x13e102,_0x3609be){if(_0x13e102[_0x1600('0x59')]['id']){delete _0x13e102[_0x1600('0x59')]['id'];}_0x13e102[_0x1600('0x59')][_0x1600('0x41')]=widgetAttributes(_0x13e102[_0x1600('0x59')]);return db[_0x1600('0x32')][_0x1600('0x3b')]({'where':{'id':_0x13e102[_0x1600('0x2f')]['id']}})[_0x1600('0x29')](handleEntityNotFound(_0x3609be,null))[_0x1600('0x29')](saveUpdates(_0x13e102[_0x1600('0x59')],null))['then'](respondWithResult(_0x3609be,null))[_0x1600('0x3d')](handleError(_0x3609be,null));}; \ No newline at end of file +var _0x8cd5=['attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','stringify','body','create','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','status','send','show','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','total'];(function(_0x1aed95,_0x1de484){var _0x31cbda=function(_0x3c7753){while(--_0x3c7753){_0x1aed95['push'](_0x1aed95['shift']());}};_0x31cbda(++_0x1de484);}(_0x8cd5,0x6a));var _0x58cd=function(_0x239a9,_0x4e772b){_0x239a9=_0x239a9-0x0;var _0x270da5=_0x8cd5[_0x239a9];return _0x270da5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x58cd('0x0'));var zipdir=require(_0x58cd('0x1'));var jsonpatch=require(_0x58cd('0x2'));var rp=require(_0x58cd('0x3'));var moment=require(_0x58cd('0x4'));var BPromise=require(_0x58cd('0x5'));var Mustache=require(_0x58cd('0x6'));var util=require(_0x58cd('0x7'));var path=require('path');var sox=require(_0x58cd('0x8'));var csv=require(_0x58cd('0x9'));var ejs=require(_0x58cd('0xa'));var fs=require('fs');var fs_extra=require(_0x58cd('0xb'));var _=require(_0x58cd('0xc'));var squel=require(_0x58cd('0xd'));var crypto=require('crypto');var jsforce=require(_0x58cd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x58cd('0x9'));var querystring=require(_0x58cd('0xf'));var Papa=require(_0x58cd('0x10'));var Redis=require(_0x58cd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x58cd('0x12'));var as=require(_0x58cd('0x13'));var hardwareService=require(_0x58cd('0x14'));var logger=require(_0x58cd('0x15'))(_0x58cd('0x16'));var utils=require(_0x58cd('0x17'));var config=require(_0x58cd('0x18'));var licenseUtil=require(_0x58cd('0x19'));var db=require(_0x58cd('0x1a'))['db'];config[_0x58cd('0x1b')]=_['defaults'](config[_0x58cd('0x1b')],{'host':_0x58cd('0x1c'),'port':0x18eb});var socket=require(_0x58cd('0x1d'))(new Redis(config[_0x58cd('0x1b')]));require('./dashboardItem.socket')[_0x58cd('0x1e')](socket);function respondWithStatusCode(_0x48bf6f,_0x2bdb52){_0x2bdb52=_0x2bdb52||0xcc;return function(_0x13f57f){if(_0x13f57f){return _0x48bf6f[_0x58cd('0x1f')](_0x2bdb52);}return _0x48bf6f['status'](_0x2bdb52)[_0x58cd('0x20')]();};}function respondWithResult(_0x579d0a,_0x3fecd0){_0x3fecd0=_0x3fecd0||0xc8;return function(_0x397ffe){if(_0x397ffe){return _0x579d0a['status'](_0x3fecd0)[_0x58cd('0x21')](_0x397ffe);}};}function respondWithFilteredResult(_0x1e9e15,_0x39f76a){return function(_0x5b4e1a){if(_0x5b4e1a){var _0x1bb3bd=typeof _0x39f76a['offset']===_0x58cd('0x22')&&typeof _0x39f76a['limit']===_0x58cd('0x22');var _0x533eb7=_0x5b4e1a['count'];var _0x37b80c=_0x1bb3bd?0x0:_0x39f76a[_0x58cd('0x23')];var _0x396d96=_0x1bb3bd?_0x5b4e1a[_0x58cd('0x24')]:_0x39f76a[_0x58cd('0x23')]+_0x39f76a[_0x58cd('0x25')];var _0x32e67e;if(_0x396d96>=_0x533eb7){_0x396d96=_0x533eb7;_0x32e67e=0xc8;}else{_0x32e67e=0xce;}_0x1e9e15['status'](_0x32e67e);return _0x1e9e15[_0x58cd('0x26')](_0x58cd('0x27'),_0x37b80c+'-'+_0x396d96+'/'+_0x533eb7)['json'](_0x5b4e1a);}return null;};}function patchUpdates(_0x58fb54){return function(_0x1910ee){try{jsonpatch[_0x58cd('0x28')](_0x1910ee,_0x58fb54,!![]);}catch(_0x15e69d){return BPromise[_0x58cd('0x29')](_0x15e69d);}return _0x1910ee[_0x58cd('0x2a')]();};}function saveUpdates(_0x596392,_0x4e8748){return function(_0x102542){if(_0x102542){return _0x102542[_0x58cd('0x2b')](_0x596392)[_0x58cd('0x2c')](function(_0x1ab6c1){return _0x1ab6c1;});}return null;};}function removeEntity(_0x26cc49,_0x446ce9){return function(_0x1b24d7){if(_0x1b24d7){return _0x1b24d7[_0x58cd('0x2d')]()[_0x58cd('0x2c')](function(){_0x26cc49['status'](0xcc)[_0x58cd('0x20')]();});}};}function handleEntityNotFound(_0x2063c9,_0x59e49d){return function(_0x407639){if(!_0x407639){_0x2063c9[_0x58cd('0x1f')](0x194);}return _0x407639;};}function handleError(_0x2fdf12,_0xe7e8d2){_0xe7e8d2=_0xe7e8d2||0x1f4;return function(_0x27248f){logger[_0x58cd('0x2e')](_0x27248f[_0x58cd('0x2f')]);if(_0x27248f[_0x58cd('0x30')]){delete _0x27248f[_0x58cd('0x30')];}_0x2fdf12[_0x58cd('0x31')](_0xe7e8d2)[_0x58cd('0x32')](_0x27248f);};}exports[_0x58cd('0x33')]=function(_0x151339,_0x1d54cf){var _0x133362={'raw':![],'where':{'id':_0x151339[_0x58cd('0x34')]['id']}},_0x2b395f={};_0x2b395f[_0x58cd('0x35')]=_[_0x58cd('0x36')](db[_0x58cd('0x37')][_0x58cd('0x38')]);_0x2b395f[_0x58cd('0x39')]=_[_0x58cd('0x36')](_0x151339[_0x58cd('0x39')]);_0x2b395f['filters']=_[_0x58cd('0x3a')](_0x2b395f[_0x58cd('0x35')],_0x2b395f[_0x58cd('0x39')]);_0x133362[_0x58cd('0x3b')]=_['intersection'](_0x2b395f[_0x58cd('0x35')],qs[_0x58cd('0x3c')](_0x151339[_0x58cd('0x39')][_0x58cd('0x3c')]));_0x133362[_0x58cd('0x3b')]=_0x133362[_0x58cd('0x3b')]['length']?_0x133362[_0x58cd('0x3b')]:_0x2b395f[_0x58cd('0x35')];if(_0x151339['query'][_0x58cd('0x3d')]){_0x133362[_0x58cd('0x3e')]=[{'all':!![]}];}_0x133362=_[_0x58cd('0x3f')]({},_0x133362,_0x151339[_0x58cd('0x40')]);return db[_0x58cd('0x37')][_0x58cd('0x41')](_0x133362)[_0x58cd('0x2c')](handleEntityNotFound(_0x1d54cf,null))[_0x58cd('0x2c')](respondWithResult(_0x1d54cf,null))[_0x58cd('0x42')](handleError(_0x1d54cf,null));};exports[_0x58cd('0x2d')]=function(_0x51f1b9,_0x16a9c7){return db['DashboardItem'][_0x58cd('0x41')]({'where':{'id':_0x51f1b9['params']['id']}})['then'](handleEntityNotFound(_0x16a9c7,null))[_0x58cd('0x2c')](removeEntity(_0x16a9c7,null))[_0x58cd('0x42')](handleError(_0x16a9c7,null));};function widgetAttributes(_0x1849bc){try{switch(_0x1849bc[_0x58cd('0x43')]){case _0x58cd('0x44'):return[{'name':_0x58cd('0x45'),'value':_0x1849bc[_0x58cd('0x45')]||(_0x1849bc['attrs']&&_0x1849bc[_0x58cd('0x46')][0x0]?_0x1849bc[_0x58cd('0x46')][0x0]['value']:undefined)||_0x58cd('0x47')}];case _0x58cd('0x48'):return[{'name':'attrPath','value':_0x1849bc[_0x58cd('0x49')]||(_0x1849bc[_0x58cd('0x46')]&&_0x1849bc['attrs'][0x0]?_0x1849bc[_0x58cd('0x46')][0x0][_0x58cd('0x4a')]:undefined)||''}];case _0x58cd('0x4b'):return[{'name':_0x58cd('0x4c'),'value':_0x1849bc[_0x58cd('0x4c')]||(_0x1849bc[_0x58cd('0x46')]&&_0x1849bc[_0x58cd('0x46')][0x0]?_0x1849bc[_0x58cd('0x46')][0x0]['value']:undefined)||_0x58cd('0x4d')},{'name':_0x58cd('0x4e'),'value':_0x1849bc['attrTimezone']||(_0x1849bc['attrs']&&_0x1849bc['attrs'][0x1]?_0x1849bc[_0x58cd('0x46')][0x1][_0x58cd('0x4a')]:undefined)||_0x58cd('0x4f')},{'name':'attrFontSize','value':_0x1849bc[_0x58cd('0x50')]||(_0x1849bc['attrs']&&_0x1849bc[_0x58cd('0x46')][0x2]?_0x1849bc[_0x58cd('0x46')][0x2]['value']:undefined)||0xc}];case _0x58cd('0x51'):return[{'name':_0x58cd('0x52'),'value':_0x1849bc[_0x58cd('0x52')]||(_0x1849bc[_0x58cd('0x46')]&&_0x1849bc[_0x58cd('0x46')][0x0]?_0x1849bc[_0x58cd('0x46')][0x0][_0x58cd('0x4a')]:undefined)||'total'},{'name':_0x58cd('0x53'),'value':_0x1849bc['attrVoiceQueues']||(_0x1849bc[_0x58cd('0x46')]&&_0x1849bc['attrs'][0x1]?_0x1849bc['attrs'][0x1][_0x58cd('0x4a')]:undefined)||[]},{'name':_0x58cd('0x50'),'value':_0x1849bc[_0x58cd('0x50')]||(_0x1849bc['attrs']&&_0x1849bc['attrs'][0x2]?_0x1849bc[_0x58cd('0x46')][0x2]['value']:undefined)||0x14}];case _0x58cd('0x54'):case _0x58cd('0x55'):return[{'name':_0x58cd('0x56'),'value':_0x1849bc[_0x58cd('0x56')]||(_0x1849bc['attrs']&&_0x1849bc[_0x58cd('0x46')][0x0]?_0x1849bc['attrs'][0x0][_0x58cd('0x4a')]:undefined)||_0x58cd('0x57')},{'name':'attrSerie2','value':_0x1849bc[_0x58cd('0x58')]||(_0x1849bc['attrs']&&_0x1849bc[_0x58cd('0x46')][0x1]?_0x1849bc[_0x58cd('0x46')][0x1][_0x58cd('0x4a')]:undefined)||null},{'name':_0x58cd('0x59'),'value':_0x1849bc['attrSerie3']||(_0x1849bc[_0x58cd('0x46')]&&_0x1849bc['attrs'][0x2]?_0x1849bc['attrs'][0x2][_0x58cd('0x4a')]:undefined)||null},{'name':_0x58cd('0x53'),'value':_0x1849bc['attrVoiceQueues']||(_0x1849bc['attrs']&&_0x1849bc['attrs'][0x3]?_0x1849bc[_0x58cd('0x46')][0x3][_0x58cd('0x4a')]:undefined)||[]}];case _0x58cd('0x5a'):return[{'name':_0x58cd('0x5b'),'type':_0x1849bc[_0x58cd('0x5c')]||(_0x1849bc['attrs']&&_0x1849bc[_0x58cd('0x46')][0x0]?_0x1849bc[_0x58cd('0x46')][0x0][_0x58cd('0x43')]:undefined)||null,'value':_0x1849bc[_0x58cd('0x5b')]||(_0x1849bc['attrs']&&_0x1849bc['attrs'][0x0]?_0x1849bc[_0x58cd('0x46')][0x0][_0x58cd('0x4a')]:undefined)||null},{'name':'attrRefresh','value':_0x1849bc[_0x58cd('0x5d')]||(_0x1849bc[_0x58cd('0x46')]&&_0x1849bc[_0x58cd('0x46')][0x1]?_0x1849bc['attrs'][0x1][_0x58cd('0x4a')]:undefined)||0x0}];default:return[];}}catch(_0x458978){logger['error']('widgetAttributes:\x20%s',JSON[_0x58cd('0x5e')](_0x458978));return[];}}exports['create']=function(_0x388b48,_0x458497){if(_0x388b48[_0x58cd('0x5f')]){_0x388b48[_0x58cd('0x5f')][_0x58cd('0x46')]=widgetAttributes(_0x388b48[_0x58cd('0x5f')]);}return db[_0x58cd('0x37')][_0x58cd('0x60')](_0x388b48['body'],{})[_0x58cd('0x2c')](respondWithResult(_0x458497,0xc9))[_0x58cd('0x42')](handleError(_0x458497,null));};exports[_0x58cd('0x2b')]=function(_0x14e2b7,_0x88d810){if(_0x14e2b7[_0x58cd('0x5f')]['id']){delete _0x14e2b7[_0x58cd('0x5f')]['id'];}_0x14e2b7[_0x58cd('0x5f')]['attrs']=widgetAttributes(_0x14e2b7['body']);return db[_0x58cd('0x37')][_0x58cd('0x41')]({'where':{'id':_0x14e2b7[_0x58cd('0x34')]['id']}})['then'](handleEntityNotFound(_0x88d810,null))[_0x58cd('0x2c')](saveUpdates(_0x14e2b7[_0x58cd('0x5f')],null))['then'](respondWithResult(_0x88d810,null))[_0x58cd('0x42')](handleError(_0x88d810,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index adab485..4f49973 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 _0xfb14=['hook','../../mysqldb','DashboardItem','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x5d1ffa,_0x1989da){var _0x649155=function(_0x5e044c){while(--_0x5e044c){_0x5d1ffa['push'](_0x5d1ffa['shift']());}};_0x649155(++_0x1989da);}(_0xfb14,0x1b9));var _0x4fb1=function(_0x3b7762,_0x3dfbdc){_0x3b7762=_0x3b7762-0x0;var _0x18f842=_0xfb14[_0x3b7762];return _0x18f842;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x4fb1('0x0'))['db'][_0x4fb1('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4fb1('0x2')](0x0);var events={'afterCreate':_0x4fb1('0x3'),'afterUpdate':'update','afterDestroy':_0x4fb1('0x4')};function emitEvent(_0x200624){return function(_0x582a95,_0x46b7c7,_0x44229b){DashboardItemEvents[_0x4fb1('0x5')](_0x200624+':'+_0x582a95['id'],_0x582a95);DashboardItemEvents[_0x4fb1('0x5')](_0x200624,_0x582a95);_0x44229b(null);};}for(var e in events){if(events[_0x4fb1('0x6')](e)){var event=events[e];DashboardItem[_0x4fb1('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x126d=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3cdf34,_0x9e7205){var _0x922515=function(_0x3c5eb9){while(--_0x3c5eb9){_0x3cdf34['push'](_0x3cdf34['shift']());}};_0x922515(++_0x9e7205);}(_0x126d,0xc7));var _0xd126=function(_0x5cc3fe,_0x36518e){_0x5cc3fe=_0x5cc3fe-0x0;var _0x500d39=_0x126d[_0x5cc3fe];return _0x500d39;};'use strict';var EventEmitter=require(_0xd126('0x0'));var DashboardItem=require(_0xd126('0x1'))['db'][_0xd126('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd126('0x3')](0x0);var events={'afterCreate':_0xd126('0x4'),'afterUpdate':_0xd126('0x5'),'afterDestroy':_0xd126('0x6')};function emitEvent(_0x263599){return function(_0x4a03d7,_0x45cc47,_0x3494f1){DashboardItemEvents[_0xd126('0x7')](_0x263599+':'+_0x4a03d7['id'],_0x4a03d7);DashboardItemEvents[_0xd126('0x7')](_0x263599,_0x4a03d7);_0x3494f1(null);};}for(var e in events){if(events[_0xd126('0x8')](e)){var event=events[e];DashboardItem[_0xd126('0x9')](e,emitEvent(event));}}module[_0xd126('0xa')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 624379f..ca40598 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 _0x101d=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','lodash'];(function(_0x1da8be,_0x25c1f4){var _0x3486bc=function(_0x3a4540){while(--_0x3a4540){_0x1da8be['push'](_0x1da8be['shift']());}};_0x3486bc(++_0x25c1f4);}(_0x101d,0x173));var _0xd101=function(_0x2961f4,_0x2ef430){_0x2961f4=_0x2961f4-0x0;var _0x4c2388=_0x101d[_0x2961f4];return _0x4c2388;};'use strict';var _=require(_0xd101('0x0'));var util=require(_0xd101('0x1'));var logger=require(_0xd101('0x2'))('api');var moment=require(_0xd101('0x3'));var BPromise=require(_0xd101('0x4'));var rp=require(_0xd101('0x5'));var fs=require('fs');var path=require(_0xd101('0x6'));var rimraf=require('rimraf');var config=require(_0xd101('0x7'));var attributes=require(_0xd101('0x8'));module[_0xd101('0x9')]=function(_0x1451f8,_0x589f15){return _0x1451f8[_0xd101('0xa')](_0xd101('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa678=['path','rimraf','../../config/environment','exports','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x489b10,_0x2fcb75){var _0x1b9b8b=function(_0x5be007){while(--_0x5be007){_0x489b10['push'](_0x489b10['shift']());}};_0x1b9b8b(++_0x2fcb75);}(_0xa678,0xe1));var _0x8a67=function(_0x40c6d6,_0xdf451){_0x40c6d6=_0x40c6d6-0x0;var _0x4aaca9=_0xa678[_0x40c6d6];return _0x4aaca9;};'use strict';var _=require(_0x8a67('0x0'));var util=require(_0x8a67('0x1'));var logger=require(_0x8a67('0x2'))(_0x8a67('0x3'));var moment=require(_0x8a67('0x4'));var BPromise=require(_0x8a67('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a67('0x6'));var rimraf=require(_0x8a67('0x7'));var config=require(_0x8a67('0x8'));var attributes=require('./dashboardItem.attributes');module[_0x8a67('0x9')]=function(_0x5ba4dd,_0x16c745){return _0x5ba4dd['define']('DashboardItem',attributes,{'tableName':_0x8a67('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 53c7ad4..a732735 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 _0x6b36=['http','redis','defaults','localhost','register','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','jayson/promise','client'];(function(_0x21aafd,_0x1f0fa6){var _0x9f2800=function(_0xf23734){while(--_0xf23734){_0x21aafd['push'](_0x21aafd['shift']());}};_0x9f2800(++_0x1f0fa6);}(_0x6b36,0xc2));var _0x66b3=function(_0x33b645,_0x92a605){_0x33b645=_0x33b645-0x0;var _0x3f1310=_0x6b36[_0x33b645];return _0x3f1310;};'use strict';var _=require('lodash');var util=require(_0x66b3('0x0'));var moment=require('moment');var BPromise=require(_0x66b3('0x1'));var rs=require(_0x66b3('0x2'));var fs=require('fs');var Redis=require(_0x66b3('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x66b3('0x4'));var client=jayson[_0x66b3('0x5')][_0x66b3('0x6')]({'port':0x232a});config[_0x66b3('0x7')]=_[_0x66b3('0x8')](config['redis'],{'host':_0x66b3('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')[_0x66b3('0xa')](socket);function respondWithRpcPromise(_0x372dee,_0x3917ab,_0x4b4ca0){return new BPromise(function(_0x2bfac3,_0x3e1931){return client['request'](_0x372dee,_0x4b4ca0)['then'](function(_0x5a151c){logger['info'](_0x66b3('0xb'),_0x3917ab,_0x66b3('0xc'));logger[_0x66b3('0xd')](_0x66b3('0xe'),_0x3917ab,_0x66b3('0xc'),JSON[_0x66b3('0xf')](_0x5a151c));if(_0x5a151c[_0x66b3('0x10')]){if(_0x5a151c['error'][_0x66b3('0x11')]===0x1f4){logger[_0x66b3('0x10')](_0x66b3('0xb'),_0x3917ab,_0x5a151c[_0x66b3('0x10')][_0x66b3('0x12')]);return _0x3e1931(_0x5a151c[_0x66b3('0x10')][_0x66b3('0x12')]);}logger['error'](_0x66b3('0xb'),_0x3917ab,_0x5a151c[_0x66b3('0x10')][_0x66b3('0x12')]);return _0x2bfac3(_0x5a151c[_0x66b3('0x10')]['message']);}else{logger['info'](_0x66b3('0xb'),_0x3917ab,'request\x20sent');_0x2bfac3(_0x5a151c[_0x66b3('0x13')][_0x66b3('0x12')]);}})['catch'](function(_0x480d68){logger[_0x66b3('0x10')](_0x66b3('0xb'),_0x3917ab,_0x480d68);_0x3e1931(_0x480d68);});});} \ No newline at end of file +var _0x771e=['DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','debug'];(function(_0x5b8e2f,_0x59c800){var _0xccc591=function(_0x5948bf){while(--_0x5948bf){_0x5b8e2f['push'](_0x5b8e2f['shift']());}};_0xccc591(++_0x59c800);}(_0x771e,0x174));var _0xe771=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x771e[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xe771('0x0'));var util=require('util');var moment=require(_0xe771('0x1'));var BPromise=require(_0xe771('0x2'));var rs=require(_0xe771('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe771('0x4'))['db'];var utils=require(_0xe771('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe771('0x6'));var jayson=require(_0xe771('0x7'));var client=jayson[_0xe771('0x8')]['http']({'port':0x232a});config[_0xe771('0x9')]=_[_0xe771('0xa')](config[_0xe771('0x9')],{'host':_0xe771('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe771('0x9')]));require(_0xe771('0xc'))['register'](socket);function respondWithRpcPromise(_0x22c029,_0x48e37a,_0x24280a){return new BPromise(function(_0x11c1e5,_0x18139a){return client[_0xe771('0xd')](_0x22c029,_0x24280a)[_0xe771('0xe')](function(_0x4c70dd){logger[_0xe771('0xf')](_0xe771('0x10'),_0x48e37a,'request\x20sent');logger[_0xe771('0x11')](_0xe771('0x12'),_0x48e37a,_0xe771('0x13'),JSON[_0xe771('0x14')](_0x4c70dd));if(_0x4c70dd['error']){if(_0x4c70dd[_0xe771('0x15')][_0xe771('0x16')]===0x1f4){logger['error']('DashboardItem,\x20%s,\x20%s',_0x48e37a,_0x4c70dd['error'][_0xe771('0x17')]);return _0x18139a(_0x4c70dd[_0xe771('0x15')][_0xe771('0x17')]);}logger[_0xe771('0x15')](_0xe771('0x10'),_0x48e37a,_0x4c70dd[_0xe771('0x15')][_0xe771('0x17')]);return _0x11c1e5(_0x4c70dd[_0xe771('0x15')][_0xe771('0x17')]);}else{logger['info'](_0xe771('0x10'),_0x48e37a,'request\x20sent');_0x11c1e5(_0x4c70dd[_0xe771('0x18')][_0xe771('0x17')]);}})[_0xe771('0x19')](function(_0x3ab764){logger[_0xe771('0x15')](_0xe771('0x10'),_0x48e37a,_0x3ab764);_0x18139a(_0x3ab764);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 4dffb76..b98e0ce 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 _0x8965=['length','dashboardItem:','./dashboardItem.events','remove','update','emit','register'];(function(_0x3505ae,_0x5b1f9f){var _0x3b0ca7=function(_0x2ce4ea){while(--_0x2ce4ea){_0x3505ae['push'](_0x3505ae['shift']());}};_0x3b0ca7(++_0x5b1f9f);}(_0x8965,0x1b4));var _0x5896=function(_0x4c9740,_0x43cbe6){_0x4c9740=_0x4c9740-0x0;var _0x11a029=_0x8965[_0x4c9740];return _0x11a029;};'use strict';var DashboardItemEvents=require(_0x5896('0x0'));var events=['save',_0x5896('0x1'),_0x5896('0x2')];function createListener(_0x2e8c0e,_0x22d1a5){return function(_0x1aca63){_0x22d1a5[_0x5896('0x3')](_0x2e8c0e,_0x1aca63);};}function removeListener(_0x5ef7e9,_0x4f15a8){return function(){DashboardItemEvents['removeListener'](_0x5ef7e9,_0x4f15a8);};}exports[_0x5896('0x4')]=function(_0x54a843){for(var _0x22c129=0x0,_0x24710f=events[_0x5896('0x5')];_0x22c129<_0x24710f;_0x22c129++){var _0x34b6da=events[_0x22c129];var _0x1240d4=createListener(_0x5896('0x6')+_0x34b6da,_0x54a843);DashboardItemEvents['on'](_0x34b6da,_0x1240d4);}}; \ No newline at end of file +var _0xdcb4=['save','remove','emit','removeListener','register','length'];(function(_0xd97070,_0x43a158){var _0x4092c8=function(_0x6b6f7c){while(--_0x6b6f7c){_0xd97070['push'](_0xd97070['shift']());}};_0x4092c8(++_0x43a158);}(_0xdcb4,0xd8));var _0x4dcb=function(_0x4012e8,_0x300cbb){_0x4012e8=_0x4012e8-0x0;var _0x35997a=_0xdcb4[_0x4012e8];return _0x35997a;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0x4dcb('0x0'),_0x4dcb('0x1'),'update'];function createListener(_0x3db897,_0x4562d1){return function(_0x5b8d2b){_0x4562d1[_0x4dcb('0x2')](_0x3db897,_0x5b8d2b);};}function removeListener(_0x1d3a96,_0x36e393){return function(){DashboardItemEvents[_0x4dcb('0x3')](_0x1d3a96,_0x36e393);};}exports[_0x4dcb('0x4')]=function(_0x3840bf){for(var _0x2f0243=0x0,_0x26eebb=events[_0x4dcb('0x5')];_0x2f0243<_0x26eebb;_0x2f0243++){var _0xb08c7d=events[_0x2f0243];var _0x48b87a=createListener('dashboardItem:'+_0xb08c7d,_0x3840bf);DashboardItemEvents['on'](_0xb08c7d,_0x48b87a);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index ef67bf3..92ed4d9 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 _0x88db=['../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x88db,0x188));var _0xb88d=function(_0x525b3c,_0x810307){_0x525b3c=_0x525b3c-0x0;var _0x5a0c20=_0x88db[_0x525b3c];return _0x5a0c20;};'use strict';var multer=require(_0xb88d('0x0'));var util=require(_0xb88d('0x1'));var path=require(_0xb88d('0x2'));var timeout=require(_0xb88d('0x3'));var express=require(_0xb88d('0x4'));var router=express[_0xb88d('0x5')]();var fs_extra=require(_0xb88d('0x6'));var auth=require(_0xb88d('0x7'));var interaction=require(_0xb88d('0x8'));var config=require('../../config/environment');var controller=require(_0xb88d('0x9'));router[_0xb88d('0xa')](_0xb88d('0xb'),auth[_0xb88d('0xc')](),controller[_0xb88d('0xd')]);router['post']('/',auth[_0xb88d('0xc')](),controller[_0xb88d('0xe')]);router[_0xb88d('0xf')](_0xb88d('0xb'),auth[_0xb88d('0xc')](),controller['update']);router[_0xb88d('0x10')](_0xb88d('0xb'),auth[_0xb88d('0xc')](),controller[_0xb88d('0x11')]);module[_0xb88d('0x12')]=router; \ No newline at end of file +var _0xd20d=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','post','update','delete','destroy'];(function(_0x1c06f4,_0x2feba6){var _0x1a727e=function(_0x2e83af){while(--_0x2e83af){_0x1c06f4['push'](_0x1c06f4['shift']());}};_0x1a727e(++_0x2feba6);}(_0xd20d,0x70));var _0xdd20=function(_0xfbe93a,_0x2db138){_0xfbe93a=_0xfbe93a-0x0;var _0x9a0d73=_0xd20d[_0xfbe93a];return _0x9a0d73;};'use strict';var multer=require(_0xdd20('0x0'));var util=require(_0xdd20('0x1'));var path=require(_0xdd20('0x2'));var timeout=require('connect-timeout');var express=require(_0xdd20('0x3'));var router=express[_0xdd20('0x4')]();var fs_extra=require(_0xdd20('0x5'));var auth=require(_0xdd20('0x6'));var interaction=require(_0xdd20('0x7'));var config=require('../../config/environment');var controller=require(_0xdd20('0x8'));router[_0xdd20('0x9')](_0xdd20('0xa'),auth[_0xdd20('0xb')](),controller['show']);router[_0xdd20('0xc')]('/',auth[_0xdd20('0xb')](),controller['create']);router['put'](_0xdd20('0xa'),auth[_0xdd20('0xb')](),controller[_0xdd20('0xd')]);router[_0xdd20('0xe')](_0xdd20('0xa'),auth[_0xdd20('0xb')](),controller[_0xdd20('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index a3c58da..31336db 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 _0x9f22=['sequelize','exports','ENUM','first','third','STRING'];(function(_0x333767,_0x3e6f9c){var _0x51661b=function(_0x46e5d6){while(--_0x46e5d6){_0x333767['push'](_0x333767['shift']());}};_0x51661b(++_0x3e6f9c);}(_0x9f22,0x198));var _0x29f2=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9f22[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require(_0x29f2('0x0'));module[_0x29f2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x29f2('0x2')](_0x29f2('0x3'),'second',_0x29f2('0x4')),'allowNull':![],'defaultValue':_0x29f2('0x3')},'description':{'type':Sequelize[_0x29f2('0x5')]}}; \ No newline at end of file +var _0x4259=['third','first','sequelize','exports','STRING','second'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0x4259,0x188));var _0x9425=function(_0xe6f164,_0xc47bea){_0xe6f164=_0xe6f164-0x0;var _0x37f530=_0x4259[_0xe6f164];return _0x37f530;};'use strict';var Sequelize=require(_0x9425('0x0'));module[_0x9425('0x1')]={'name':{'type':Sequelize[_0x9425('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0x9425('0x3'),_0x9425('0x4')),'allowNull':![],'defaultValue':_0x9425('0x5')},'description':{'type':Sequelize[_0x9425('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index dc4a38b..21ffd5c 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 _0xd6fe=['../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','index','map','fieldName','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','Disposition','include','findAll','show','params','keys','rawAttributes','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment'];(function(_0x4016d4,_0x491c60){var _0x348a93=function(_0x2fad52){while(--_0x2fad52){_0x4016d4['push'](_0x4016d4['shift']());}};_0x348a93(++_0x491c60);}(_0xd6fe,0x192));var _0xed6f=function(_0x295c89,_0x36f71d){_0x295c89=_0x295c89-0x0;var _0x1689f0=_0xd6fe[_0x295c89];return _0x1689f0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xed6f('0x0'));var jsonpatch=require(_0xed6f('0x1'));var rp=require('request-promise');var moment=require(_0xed6f('0x2'));var BPromise=require(_0xed6f('0x3'));var Mustache=require(_0xed6f('0x4'));var util=require(_0xed6f('0x5'));var path=require(_0xed6f('0x6'));var sox=require(_0xed6f('0x7'));var csv=require('to-csv');var ejs=require(_0xed6f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed6f('0x9'));var squel=require(_0xed6f('0xa'));var crypto=require(_0xed6f('0xb'));var jsforce=require(_0xed6f('0xc'));var deskjs=require(_0xed6f('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xed6f('0xe'));var Redis=require(_0xed6f('0xf'));var authService=require(_0xed6f('0x10'));var qs=require(_0xed6f('0x11'));var as=require(_0xed6f('0x12'));var hardwareService=require(_0xed6f('0x13'));var logger=require(_0xed6f('0x14'))('api');var utils=require(_0xed6f('0x15'));var config=require(_0xed6f('0x16'));var licenseUtil=require(_0xed6f('0x17'));var db=require(_0xed6f('0x18'))['db'];function respondWithStatusCode(_0x412177,_0x44dc6d){_0x44dc6d=_0x44dc6d||0xcc;return function(_0x136e24){if(_0x136e24){return _0x412177[_0xed6f('0x19')](_0x44dc6d);}return _0x412177['status'](_0x44dc6d)[_0xed6f('0x1a')]();};}function respondWithResult(_0x4702e2,_0x187d4c){_0x187d4c=_0x187d4c||0xc8;return function(_0x158c4a){if(_0x158c4a){return _0x4702e2[_0xed6f('0x1b')](_0x187d4c)[_0xed6f('0x1c')](_0x158c4a);}};}function respondWithFilteredResult(_0xb902a1,_0x4193f6){return function(_0x37bbed){if(_0x37bbed){var _0x11a4f8=typeof _0x4193f6['offset']===_0xed6f('0x1d')&&typeof _0x4193f6[_0xed6f('0x1e')]===_0xed6f('0x1d');var _0xc4a126=_0x37bbed[_0xed6f('0x1f')];var _0x987e8d=_0x11a4f8?0x0:_0x4193f6['offset'];var _0x533654=_0x11a4f8?_0x37bbed[_0xed6f('0x1f')]:_0x4193f6[_0xed6f('0x20')]+_0x4193f6['limit'];var _0x5a01a0;if(_0x533654>=_0xc4a126){_0x533654=_0xc4a126;_0x5a01a0=0xc8;}else{_0x5a01a0=0xce;}_0xb902a1[_0xed6f('0x1b')](_0x5a01a0);return _0xb902a1[_0xed6f('0x21')]('Content-Range',_0x987e8d+'-'+_0x533654+'/'+_0xc4a126)[_0xed6f('0x1c')](_0x37bbed);}return null;};}function patchUpdates(_0x23b74a){return function(_0x20fb1d){try{jsonpatch[_0xed6f('0x22')](_0x20fb1d,_0x23b74a,!![]);}catch(_0x36406a){return BPromise[_0xed6f('0x23')](_0x36406a);}return _0x20fb1d[_0xed6f('0x24')]();};}function saveUpdates(_0x165315,_0x183e4f){return function(_0x21f903){if(_0x21f903){return _0x21f903[_0xed6f('0x25')](_0x165315)[_0xed6f('0x26')](function(_0x48190c){return _0x48190c;});}return null;};}function removeEntity(_0x42435e,_0x795f29){return function(_0x3f242c){if(_0x3f242c){return _0x3f242c[_0xed6f('0x27')]()[_0xed6f('0x26')](function(){var _0x1665d6=_0x3f242c[_0xed6f('0x28')]({'plain':!![]});var _0x511ac6=_0xed6f('0x29');return db[_0xed6f('0x2a')][_0xed6f('0x27')]({'where':{'type':_0x511ac6,'resourceId':_0x1665d6['id']}})[_0xed6f('0x26')](function(){return _0x3f242c;});})['then'](function(){_0x42435e['status'](0xcc)[_0xed6f('0x1a')]();});}};}function handleEntityNotFound(_0x34edd1,_0x424aa4){return function(_0x517bf7){if(!_0x517bf7){_0x34edd1[_0xed6f('0x19')](0x194);}return _0x517bf7;};}function handleError(_0x427387,_0x378d41){_0x378d41=_0x378d41||0x1f4;return function(_0x1f3d12){logger[_0xed6f('0x2b')](_0x1f3d12['stack']);if(_0x1f3d12['name']){delete _0x1f3d12['name'];}_0x427387[_0xed6f('0x1b')](_0x378d41)['send'](_0x1f3d12);};}exports[_0xed6f('0x2c')]=function(_0x3fa1b7,_0x1df824){var _0x1ecd6a={},_0x3d1121={},_0x4e8ef7={'count':0x0,'rows':[]};var _0x1d01d1=_[_0xed6f('0x2d')](db['Disposition']['rawAttributes'],function(_0x221d61){return{'name':_0x221d61[_0xed6f('0x2e')],'type':_0x221d61['type'][_0xed6f('0x2f')]};});_0x3d1121['model']=_[_0xed6f('0x2d')](_0x1d01d1,_0xed6f('0x30'));_0x3d1121[_0xed6f('0x31')]=_['keys'](_0x3fa1b7[_0xed6f('0x31')]);_0x3d1121[_0xed6f('0x32')]=_[_0xed6f('0x33')](_0x3d1121[_0xed6f('0x34')],_0x3d1121[_0xed6f('0x31')]);_0x1ecd6a[_0xed6f('0x35')]=_[_0xed6f('0x33')](_0x3d1121[_0xed6f('0x34')],qs['fields'](_0x3fa1b7[_0xed6f('0x31')][_0xed6f('0x36')]));_0x1ecd6a[_0xed6f('0x35')]=_0x1ecd6a[_0xed6f('0x35')][_0xed6f('0x37')]?_0x1ecd6a[_0xed6f('0x35')]:_0x3d1121['model'];if(!_0x3fa1b7[_0xed6f('0x31')][_0xed6f('0x38')]('nolimit')){_0x1ecd6a['limit']=qs[_0xed6f('0x1e')](_0x3fa1b7[_0xed6f('0x31')][_0xed6f('0x1e')]);_0x1ecd6a[_0xed6f('0x20')]=qs['offset'](_0x3fa1b7[_0xed6f('0x31')][_0xed6f('0x20')]);}_0x1ecd6a[_0xed6f('0x39')]=qs['sort'](_0x3fa1b7[_0xed6f('0x31')][_0xed6f('0x3a')]);_0x1ecd6a[_0xed6f('0x3b')]=qs['filters'](_[_0xed6f('0x3c')](_0x3fa1b7['query'],_0x3d1121[_0xed6f('0x32')]),_0x1d01d1);if(_0x3fa1b7['query'][_0xed6f('0x3d')]){_0x1ecd6a[_0xed6f('0x3b')]=_[_0xed6f('0x3e')](_0x1ecd6a['where'],{'$or':_[_0xed6f('0x2d')](_0x1d01d1,function(_0x49672d){if(_0x49672d[_0xed6f('0x3f')]!==_0xed6f('0x40')){var _0x148194={};_0x148194[_0x49672d[_0xed6f('0x30')]]={'$like':'%'+_0x3fa1b7[_0xed6f('0x31')]['filter']+'%'};return _0x148194;}})});}_0x1ecd6a=_['merge']({},_0x1ecd6a,_0x3fa1b7[_0xed6f('0x41')]);var _0xdd8b53={'where':_0x1ecd6a['where']};return db[_0xed6f('0x42')][_0xed6f('0x1f')](_0xdd8b53)[_0xed6f('0x26')](function(_0x3c0878){_0x4e8ef7[_0xed6f('0x1f')]=_0x3c0878;if(_0x3fa1b7[_0xed6f('0x31')]['includeAll']){_0x1ecd6a[_0xed6f('0x43')]=[{'all':!![]}];}return db[_0xed6f('0x42')][_0xed6f('0x44')](_0x1ecd6a);})['then'](function(_0x191bd2){_0x4e8ef7['rows']=_0x191bd2;return _0x4e8ef7;})['then'](respondWithFilteredResult(_0x1df824,_0x1ecd6a))['catch'](handleError(_0x1df824,null));};exports[_0xed6f('0x45')]=function(_0x2e2bef,_0x54d690){var _0x4f4c49={'raw':!![],'where':{'id':_0x2e2bef[_0xed6f('0x46')]['id']}},_0x36662c={};_0x36662c[_0xed6f('0x34')]=_[_0xed6f('0x47')](db[_0xed6f('0x42')][_0xed6f('0x48')]);_0x36662c[_0xed6f('0x31')]=_[_0xed6f('0x47')](_0x2e2bef[_0xed6f('0x31')]);_0x36662c[_0xed6f('0x32')]=_[_0xed6f('0x33')](_0x36662c[_0xed6f('0x34')],_0x36662c[_0xed6f('0x31')]);_0x4f4c49['attributes']=_[_0xed6f('0x33')](_0x36662c[_0xed6f('0x34')],qs[_0xed6f('0x36')](_0x2e2bef['query'][_0xed6f('0x36')]));_0x4f4c49[_0xed6f('0x35')]=_0x4f4c49[_0xed6f('0x35')]['length']?_0x4f4c49[_0xed6f('0x35')]:_0x36662c[_0xed6f('0x34')];if(_0x2e2bef['query'][_0xed6f('0x49')]){_0x4f4c49[_0xed6f('0x43')]=[{'all':!![]}];}_0x4f4c49=_[_0xed6f('0x3e')]({},_0x4f4c49,_0x2e2bef[_0xed6f('0x41')]);return db[_0xed6f('0x42')][_0xed6f('0x4a')](_0x4f4c49)[_0xed6f('0x26')](handleEntityNotFound(_0x54d690,null))[_0xed6f('0x26')](respondWithResult(_0x54d690,null))['catch'](handleError(_0x54d690,null));};exports[_0xed6f('0x4b')]=function(_0xaaa07a,_0x2de691){return db['Disposition'][_0xed6f('0x4b')](_0xaaa07a['body'],{})[_0xed6f('0x26')](function(_0x2a1bde){var _0x114bf1=_0xaaa07a[_0xed6f('0x4c')][_0xed6f('0x28')]({'plain':!![]});if(!_0x114bf1)throw new Error(_0xed6f('0x4d'));if(_0x114bf1[_0xed6f('0x4e')]===_0xed6f('0x4c')){var _0x53e435=_0x2a1bde[_0xed6f('0x28')]({'plain':!![]});var _0xfe775a=_0xed6f('0x29');return db[_0xed6f('0x4f')][_0xed6f('0x4a')]({'where':{'name':_0xfe775a,'userProfileId':_0x114bf1[_0xed6f('0x50')]},'raw':!![]})[_0xed6f('0x26')](function(_0x13a8be){if(_0x13a8be&&_0x13a8be[_0xed6f('0x51')]===0x0){return db[_0xed6f('0x2a')][_0xed6f('0x4b')]({'name':_0x53e435['name'],'resourceId':_0x53e435['id'],'type':_0x13a8be[_0xed6f('0x30')],'sectionId':_0x13a8be['id']},{})['then'](function(){return _0x2a1bde;});}else{return _0x2a1bde;}})[_0xed6f('0x52')](function(_0x2f8f08){logger[_0xed6f('0x2b')](_0xed6f('0x53'),_0x2f8f08);throw _0x2f8f08;});}return _0x2a1bde;})['then'](respondWithResult(_0x2de691,0xc9))['catch'](handleError(_0x2de691,null));};exports[_0xed6f('0x25')]=function(_0x730ad1,_0xf09075){if(_0x730ad1['body']['id']){delete _0x730ad1[_0xed6f('0x54')]['id'];}return db[_0xed6f('0x42')]['find']({'where':{'id':_0x730ad1[_0xed6f('0x46')]['id']}})[_0xed6f('0x26')](handleEntityNotFound(_0xf09075,null))[_0xed6f('0x26')](saveUpdates(_0x730ad1['body'],null))[_0xed6f('0x26')](respondWithResult(_0xf09075,null))[_0xed6f('0x52')](handleError(_0xf09075,null));};exports[_0xed6f('0x27')]=function(_0x1be8bc,_0x21f86e){return db[_0xed6f('0x42')]['find']({'where':{'id':_0x1be8bc['params']['id']}})[_0xed6f('0x26')](handleEntityNotFound(_0x21f86e,null))[_0xed6f('0x26')](removeEntity(_0x21f86e,null))[_0xed6f('0x52')](handleError(_0x21f86e,null));}; \ No newline at end of file +var _0xdcd8=['Disposition','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','limit','order','sort','where','pick','filter','options','includeAll','findAll','rows','catch','keys','include','merge','find','create','body','get','role','user','Dispositions','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','map'];(function(_0x5d17d6,_0x38a0d9){var _0x5369ed=function(_0x40c757){while(--_0x40c757){_0x5d17d6['push'](_0x5d17d6['shift']());}};_0x5369ed(++_0x38a0d9);}(_0xdcd8,0x122));var _0x8dcd=function(_0x18cb5c,_0x58e8ca){_0x18cb5c=_0x18cb5c-0x0;var _0x2f9171=_0xdcd8[_0x18cb5c];return _0x2f9171;};'use strict';var emlformat=require(_0x8dcd('0x0'));var rimraf=require(_0x8dcd('0x1'));var zipdir=require(_0x8dcd('0x2'));var jsonpatch=require(_0x8dcd('0x3'));var rp=require('request-promise');var moment=require(_0x8dcd('0x4'));var BPromise=require(_0x8dcd('0x5'));var Mustache=require(_0x8dcd('0x6'));var util=require('util');var path=require(_0x8dcd('0x7'));var sox=require(_0x8dcd('0x8'));var csv=require(_0x8dcd('0x9'));var ejs=require(_0x8dcd('0xa'));var fs=require('fs');var fs_extra=require(_0x8dcd('0xb'));var _=require(_0x8dcd('0xc'));var squel=require(_0x8dcd('0xd'));var crypto=require(_0x8dcd('0xe'));var jsforce=require(_0x8dcd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8dcd('0x9'));var querystring=require(_0x8dcd('0x10'));var Papa=require(_0x8dcd('0x11'));var Redis=require('ioredis');var authService=require(_0x8dcd('0x12'));var qs=require(_0x8dcd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dcd('0x14'));var logger=require('../../config/logger')(_0x8dcd('0x15'));var utils=require(_0x8dcd('0x16'));var config=require(_0x8dcd('0x17'));var licenseUtil=require(_0x8dcd('0x18'));var db=require(_0x8dcd('0x19'))['db'];function respondWithStatusCode(_0x20a74a,_0x57d594){_0x57d594=_0x57d594||0xcc;return function(_0x3cde12){if(_0x3cde12){return _0x20a74a[_0x8dcd('0x1a')](_0x57d594);}return _0x20a74a['status'](_0x57d594)[_0x8dcd('0x1b')]();};}function respondWithResult(_0x55a7bf,_0x4480bd){_0x4480bd=_0x4480bd||0xc8;return function(_0xab8e7){if(_0xab8e7){return _0x55a7bf['status'](_0x4480bd)[_0x8dcd('0x1c')](_0xab8e7);}};}function respondWithFilteredResult(_0x3dd53a,_0x21eead){return function(_0x86e876){if(_0x86e876){var _0x4b5800=typeof _0x21eead[_0x8dcd('0x1d')]===_0x8dcd('0x1e')&&typeof _0x21eead['limit']==='undefined';var _0x180eb6=_0x86e876[_0x8dcd('0x1f')];var _0x57c767=_0x4b5800?0x0:_0x21eead[_0x8dcd('0x1d')];var _0x2b7b4e=_0x4b5800?_0x86e876[_0x8dcd('0x1f')]:_0x21eead[_0x8dcd('0x1d')]+_0x21eead['limit'];var _0x49bfc4;if(_0x2b7b4e>=_0x180eb6){_0x2b7b4e=_0x180eb6;_0x49bfc4=0xc8;}else{_0x49bfc4=0xce;}_0x3dd53a[_0x8dcd('0x20')](_0x49bfc4);return _0x3dd53a[_0x8dcd('0x21')](_0x8dcd('0x22'),_0x57c767+'-'+_0x2b7b4e+'/'+_0x180eb6)['json'](_0x86e876);}return null;};}function patchUpdates(_0x3dee66){return function(_0x3a6f86){try{jsonpatch[_0x8dcd('0x23')](_0x3a6f86,_0x3dee66,!![]);}catch(_0x3752b2){return BPromise['reject'](_0x3752b2);}return _0x3a6f86[_0x8dcd('0x24')]();};}function saveUpdates(_0x3d6b07,_0x277be3){return function(_0x2ce946){if(_0x2ce946){return _0x2ce946[_0x8dcd('0x25')](_0x3d6b07)[_0x8dcd('0x26')](function(_0x45f758){return _0x45f758;});}return null;};}function removeEntity(_0xf50ea8,_0x536cdf){return function(_0x567636){if(_0x567636){return _0x567636[_0x8dcd('0x27')]()[_0x8dcd('0x26')](function(){var _0xd21f35=_0x567636['get']({'plain':!![]});var _0x19da01='Dispositions';return db[_0x8dcd('0x28')][_0x8dcd('0x27')]({'where':{'type':_0x19da01,'resourceId':_0xd21f35['id']}})['then'](function(){return _0x567636;});})[_0x8dcd('0x26')](function(){_0xf50ea8[_0x8dcd('0x20')](0xcc)[_0x8dcd('0x1b')]();});}};}function handleEntityNotFound(_0x1de72f,_0x3b5036){return function(_0x78931){if(!_0x78931){_0x1de72f[_0x8dcd('0x1a')](0x194);}return _0x78931;};}function handleError(_0x494d1b,_0x481b7d){_0x481b7d=_0x481b7d||0x1f4;return function(_0x57cb87){logger[_0x8dcd('0x29')](_0x57cb87[_0x8dcd('0x2a')]);if(_0x57cb87[_0x8dcd('0x2b')]){delete _0x57cb87[_0x8dcd('0x2b')];}_0x494d1b[_0x8dcd('0x20')](_0x481b7d)[_0x8dcd('0x2c')](_0x57cb87);};}exports['index']=function(_0x1266a7,_0x3e2bb7){var _0x1eb1c3={},_0x5801a1={},_0x5a9167={'count':0x0,'rows':[]};var _0x34205f=_[_0x8dcd('0x2d')](db[_0x8dcd('0x2e')][_0x8dcd('0x2f')],function(_0xbb5a3b){return{'name':_0xbb5a3b[_0x8dcd('0x30')],'type':_0xbb5a3b[_0x8dcd('0x31')][_0x8dcd('0x32')]};});_0x5801a1[_0x8dcd('0x33')]=_['map'](_0x34205f,_0x8dcd('0x2b'));_0x5801a1[_0x8dcd('0x34')]=_['keys'](_0x1266a7[_0x8dcd('0x34')]);_0x5801a1[_0x8dcd('0x35')]=_['intersection'](_0x5801a1['model'],_0x5801a1[_0x8dcd('0x34')]);_0x1eb1c3[_0x8dcd('0x36')]=_[_0x8dcd('0x37')](_0x5801a1[_0x8dcd('0x33')],qs[_0x8dcd('0x38')](_0x1266a7[_0x8dcd('0x34')][_0x8dcd('0x38')]));_0x1eb1c3[_0x8dcd('0x36')]=_0x1eb1c3[_0x8dcd('0x36')][_0x8dcd('0x39')]?_0x1eb1c3[_0x8dcd('0x36')]:_0x5801a1[_0x8dcd('0x33')];if(!_0x1266a7['query']['hasOwnProperty']('nolimit')){_0x1eb1c3['limit']=qs[_0x8dcd('0x3a')](_0x1266a7[_0x8dcd('0x34')][_0x8dcd('0x3a')]);_0x1eb1c3[_0x8dcd('0x1d')]=qs[_0x8dcd('0x1d')](_0x1266a7['query'][_0x8dcd('0x1d')]);}_0x1eb1c3[_0x8dcd('0x3b')]=qs['sort'](_0x1266a7[_0x8dcd('0x34')][_0x8dcd('0x3c')]);_0x1eb1c3[_0x8dcd('0x3d')]=qs['filters'](_[_0x8dcd('0x3e')](_0x1266a7['query'],_0x5801a1[_0x8dcd('0x35')]),_0x34205f);if(_0x1266a7[_0x8dcd('0x34')][_0x8dcd('0x3f')]){_0x1eb1c3[_0x8dcd('0x3d')]=_['merge'](_0x1eb1c3[_0x8dcd('0x3d')],{'$or':_[_0x8dcd('0x2d')](_0x34205f,function(_0x179954){if(_0x179954['type']!=='VIRTUAL'){var _0x1f9666={};_0x1f9666[_0x179954[_0x8dcd('0x2b')]]={'$like':'%'+_0x1266a7[_0x8dcd('0x34')][_0x8dcd('0x3f')]+'%'};return _0x1f9666;}})});}_0x1eb1c3=_['merge']({},_0x1eb1c3,_0x1266a7[_0x8dcd('0x40')]);var _0x1ccc3b={'where':_0x1eb1c3['where']};return db[_0x8dcd('0x2e')][_0x8dcd('0x1f')](_0x1ccc3b)[_0x8dcd('0x26')](function(_0x249a2e){_0x5a9167[_0x8dcd('0x1f')]=_0x249a2e;if(_0x1266a7[_0x8dcd('0x34')][_0x8dcd('0x41')]){_0x1eb1c3['include']=[{'all':!![]}];}return db[_0x8dcd('0x2e')][_0x8dcd('0x42')](_0x1eb1c3);})[_0x8dcd('0x26')](function(_0xe5413b){_0x5a9167[_0x8dcd('0x43')]=_0xe5413b;return _0x5a9167;})[_0x8dcd('0x26')](respondWithFilteredResult(_0x3e2bb7,_0x1eb1c3))[_0x8dcd('0x44')](handleError(_0x3e2bb7,null));};exports['show']=function(_0x16f7cb,_0x58f541){var _0x30cdc7={'raw':!![],'where':{'id':_0x16f7cb['params']['id']}},_0x4f2f41={};_0x4f2f41[_0x8dcd('0x33')]=_['keys'](db[_0x8dcd('0x2e')][_0x8dcd('0x2f')]);_0x4f2f41['query']=_[_0x8dcd('0x45')](_0x16f7cb[_0x8dcd('0x34')]);_0x4f2f41[_0x8dcd('0x35')]=_[_0x8dcd('0x37')](_0x4f2f41[_0x8dcd('0x33')],_0x4f2f41[_0x8dcd('0x34')]);_0x30cdc7['attributes']=_[_0x8dcd('0x37')](_0x4f2f41[_0x8dcd('0x33')],qs[_0x8dcd('0x38')](_0x16f7cb[_0x8dcd('0x34')]['fields']));_0x30cdc7[_0x8dcd('0x36')]=_0x30cdc7[_0x8dcd('0x36')][_0x8dcd('0x39')]?_0x30cdc7[_0x8dcd('0x36')]:_0x4f2f41['model'];if(_0x16f7cb[_0x8dcd('0x34')][_0x8dcd('0x41')]){_0x30cdc7[_0x8dcd('0x46')]=[{'all':!![]}];}_0x30cdc7=_[_0x8dcd('0x47')]({},_0x30cdc7,_0x16f7cb[_0x8dcd('0x40')]);return db[_0x8dcd('0x2e')][_0x8dcd('0x48')](_0x30cdc7)[_0x8dcd('0x26')](handleEntityNotFound(_0x58f541,null))[_0x8dcd('0x26')](respondWithResult(_0x58f541,null))[_0x8dcd('0x44')](handleError(_0x58f541,null));};exports[_0x8dcd('0x49')]=function(_0x449ee9,_0x39125e){return db[_0x8dcd('0x2e')]['create'](_0x449ee9[_0x8dcd('0x4a')],{})[_0x8dcd('0x26')](function(_0x27a054){var _0x3f8639=_0x449ee9['user'][_0x8dcd('0x4b')]({'plain':!![]});if(!_0x3f8639)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f8639[_0x8dcd('0x4c')]===_0x8dcd('0x4d')){var _0x1d9d3e=_0x27a054[_0x8dcd('0x4b')]({'plain':!![]});var _0x3f15a6=_0x8dcd('0x4e');return db[_0x8dcd('0x4f')][_0x8dcd('0x48')]({'where':{'name':_0x3f15a6,'userProfileId':_0x3f8639[_0x8dcd('0x50')]},'raw':!![]})[_0x8dcd('0x26')](function(_0x33dc7a){if(_0x33dc7a&&_0x33dc7a[_0x8dcd('0x51')]===0x0){return db['UserProfileResource'][_0x8dcd('0x49')]({'name':_0x1d9d3e[_0x8dcd('0x2b')],'resourceId':_0x1d9d3e['id'],'type':_0x33dc7a[_0x8dcd('0x2b')],'sectionId':_0x33dc7a['id']},{})[_0x8dcd('0x26')](function(){return _0x27a054;});}else{return _0x27a054;}})[_0x8dcd('0x44')](function(_0x1c2a32){logger[_0x8dcd('0x29')](_0x8dcd('0x52'),_0x1c2a32);throw _0x1c2a32;});}return _0x27a054;})[_0x8dcd('0x26')](respondWithResult(_0x39125e,0xc9))[_0x8dcd('0x44')](handleError(_0x39125e,null));};exports[_0x8dcd('0x25')]=function(_0x429fbe,_0xbd789f){if(_0x429fbe[_0x8dcd('0x4a')]['id']){delete _0x429fbe[_0x8dcd('0x4a')]['id'];}return db[_0x8dcd('0x2e')][_0x8dcd('0x48')]({'where':{'id':_0x429fbe[_0x8dcd('0x53')]['id']}})[_0x8dcd('0x26')](handleEntityNotFound(_0xbd789f,null))[_0x8dcd('0x26')](saveUpdates(_0x429fbe[_0x8dcd('0x4a')],null))[_0x8dcd('0x26')](respondWithResult(_0xbd789f,null))[_0x8dcd('0x44')](handleError(_0xbd789f,null));};exports[_0x8dcd('0x27')]=function(_0x569f72,_0x4b2274){return db['Disposition'][_0x8dcd('0x48')]({'where':{'id':_0x569f72[_0x8dcd('0x53')]['id']}})[_0x8dcd('0x26')](handleEntityNotFound(_0x4b2274,null))['then'](removeEntity(_0x4b2274,null))[_0x8dcd('0x44')](handleError(_0x4b2274,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 83b1f74..88f7302 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 _0x3025=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./disposition.attributes','exports','Disposition','tools_dispositions','name','ListId','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash'];(function(_0x5270a1,_0x4674c4){var _0xc51634=function(_0x5ba346){while(--_0x5ba346){_0x5270a1['push'](_0x5270a1['shift']());}};_0xc51634(++_0x4674c4);}(_0x3025,0x1c7));var _0x5302=function(_0x5b6622,_0x8ae321){_0x5b6622=_0x5b6622-0x0;var _0x538a4a=_0x3025[_0x5b6622];return _0x538a4a;};'use strict';var _=require(_0x5302('0x0'));var util=require(_0x5302('0x1'));var logger=require(_0x5302('0x2'))(_0x5302('0x3'));var moment=require(_0x5302('0x4'));var BPromise=require(_0x5302('0x5'));var rp=require(_0x5302('0x6'));var fs=require('fs');var path=require(_0x5302('0x7'));var rimraf=require(_0x5302('0x8'));var config=require('../../config/environment');var attributes=require(_0x5302('0x9'));module[_0x5302('0xa')]=function(_0x507cb2,_0x28db41){return _0x507cb2['define'](_0x5302('0xb'),attributes,{'tableName':_0x5302('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x5302('0xd'),_0x5302('0xe')]},{'unique':!![],'name':'name_chat','fields':[_0x5302('0xd'),_0x5302('0xf')]},{'unique':!![],'name':_0x5302('0x10'),'fields':[_0x5302('0xd'),'MailAccountId']},{'unique':!![],'name':_0x5302('0x11'),'fields':[_0x5302('0xd'),_0x5302('0x12')]},{'unique':!![],'name':_0x5302('0x13'),'fields':['name',_0x5302('0x14')]},{'unique':!![],'name':'name_openchannel','fields':['name',_0x5302('0x15')]},{'unique':!![],'name':_0x5302('0x16'),'fields':[_0x5302('0xd'),_0x5302('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf2d3=['SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','Disposition','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms'];(function(_0x41e226,_0x5b6d61){var _0x87089d=function(_0x596f57){while(--_0x596f57){_0x41e226['push'](_0x41e226['shift']());}};_0x87089d(++_0x5b6d61);}(_0xf2d3,0x175));var _0x3f2d=function(_0x340031,_0x168157){_0x340031=_0x340031-0x0;var _0x133239=_0xf2d3[_0x340031];return _0x133239;};'use strict';var _=require('lodash');var util=require(_0x3f2d('0x0'));var logger=require(_0x3f2d('0x1'))(_0x3f2d('0x2'));var moment=require(_0x3f2d('0x3'));var BPromise=require(_0x3f2d('0x4'));var rp=require(_0x3f2d('0x5'));var fs=require('fs');var path=require(_0x3f2d('0x6'));var rimraf=require(_0x3f2d('0x7'));var config=require(_0x3f2d('0x8'));var attributes=require(_0x3f2d('0x9'));module['exports']=function(_0x5c7e3e,_0x242f0f){return _0x5c7e3e['define'](_0x3f2d('0xa'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x3f2d('0xb'),_0x3f2d('0xc')]},{'unique':!![],'name':_0x3f2d('0xd'),'fields':['name',_0x3f2d('0xe')]},{'unique':!![],'name':_0x3f2d('0xf'),'fields':[_0x3f2d('0xb'),_0x3f2d('0x10')]},{'unique':!![],'name':_0x3f2d('0x11'),'fields':['name',_0x3f2d('0x12')]},{'unique':!![],'name':_0x3f2d('0x13'),'fields':[_0x3f2d('0xb'),_0x3f2d('0x14')]},{'unique':!![],'name':_0x3f2d('0x15'),'fields':[_0x3f2d('0xb'),_0x3f2d('0x16')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x3f2d('0xb'),'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 33745d9..60ceaaa 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(_0x1dc1c6,_0x542878){var _0x848f2d=function(_0x49800a){while(--_0x49800a){_0x1dc1c6['push'](_0x1dc1c6['shift']());}};_0x848f2d(++_0x542878);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0x3f1811,_0x3d3aa4){var _0xc0ceb9=function(_0x30689a){while(--_0x30689a){_0x3f1811['push'](_0x3f1811['shift']());}};_0xc0ceb9(++_0x3d3aa4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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 27c9746..dbec379 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 _0x1a72=['multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','show','post','create','put','/:id','isAuthenticated','update','delete','destroy'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x1a72,0x156));var _0x21a7=function(_0x9b3b46,_0x5196be){_0x9b3b46=_0x9b3b46-0x0;var _0x484254=_0x1a72[_0x9b3b46];return _0x484254;};'use strict';var multer=require(_0x21a7('0x0'));var util=require('util');var path=require(_0x21a7('0x1'));var timeout=require(_0x21a7('0x2'));var express=require(_0x21a7('0x3'));var router=express[_0x21a7('0x4')]();var fs_extra=require(_0x21a7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x21a7('0x6'));var config=require(_0x21a7('0x7'));var controller=require('./disposition.controller');router[_0x21a7('0x8')]('/',auth['isAuthenticated'](),controller[_0x21a7('0x9')]);router[_0x21a7('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x21a7('0xa')]);router[_0x21a7('0xb')]('/',auth['isAuthenticated'](),controller[_0x21a7('0xc')]);router[_0x21a7('0xd')](_0x21a7('0xe'),auth[_0x21a7('0xf')](),controller[_0x21a7('0x10')]);router[_0x21a7('0x11')](_0x21a7('0xe'),auth[_0x21a7('0xf')](),controller[_0x21a7('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc0f3=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','show','post','create','/:id','delete','destroy','multer','util','connect-timeout'];(function(_0x10e33e,_0x1f96f1){var _0xf9adfe=function(_0x24d4c2){while(--_0x24d4c2){_0x10e33e['push'](_0x10e33e['shift']());}};_0xf9adfe(++_0x1f96f1);}(_0xc0f3,0x177));var _0x3c0f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc0f3[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x3c0f('0x0'));var util=require(_0x3c0f('0x1'));var path=require('path');var timeout=require(_0x3c0f('0x2'));var express=require(_0x3c0f('0x3'));var router=express[_0x3c0f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3c0f('0x5'));var interaction=require(_0x3c0f('0x6'));var config=require(_0x3c0f('0x7'));var controller=require(_0x3c0f('0x8'));router['get']('/',auth[_0x3c0f('0x9')](),controller[_0x3c0f('0xa')]);router[_0x3c0f('0xb')]('/:id',auth[_0x3c0f('0x9')](),controller[_0x3c0f('0xc')]);router[_0x3c0f('0xd')]('/',auth['isAuthenticated'](),controller[_0x3c0f('0xe')]);router['put'](_0x3c0f('0xf'),auth[_0x3c0f('0x9')](),controller['update']);router[_0x3c0f('0x10')](_0x3c0f('0xf'),auth[_0x3c0f('0x9')](),controller[_0x3c0f('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 72f5449..4025813 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 _0x73fc=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','2400','4800','9600','14400','7200','12000','v17,v27,v29','INTEGER','SIP'];(function(_0xd1d49d,_0x167f58){var _0x386355=function(_0x313495){while(--_0x313495){_0xd1d49d['push'](_0xd1d49d['shift']());}};_0x386355(++_0x167f58);}(_0x73fc,0x6a));var _0xc73f=function(_0x4f3398,_0x2656ea){_0x4f3398=_0x4f3398-0x0;var _0x527170=_0x73fc[_0x4f3398];return _0x527170;};'use strict';var Sequelize=require(_0xc73f('0x0'));module[_0xc73f('0x1')]={'name':{'type':Sequelize[_0xc73f('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xc73f('0x2')]},'ecm':{'type':Sequelize[_0xc73f('0x3')](_0xc73f('0x4'),'no'),'defaultValue':_0xc73f('0x4')},'headerinfo':{'type':Sequelize[_0xc73f('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xc73f('0x3')](_0xc73f('0x5'),_0xc73f('0x6'),'7200',_0xc73f('0x7'),'12000',_0xc73f('0x8')),'defaultValue':_0xc73f('0x6')},'maxrate':{'type':Sequelize['ENUM'](_0xc73f('0x5'),'4800',_0xc73f('0x9'),_0xc73f('0x7'),_0xc73f('0xa'),'14400'),'defaultValue':_0xc73f('0x8')},'modem':{'type':Sequelize[_0xc73f('0x2')],'defaultValue':_0xc73f('0xb')},'gateway':{'type':Sequelize[_0xc73f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xc73f('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xc73f('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xc73f('0x3')](_0xc73f('0xd'),'IAX','DADHI','KHOMP'),'defaultValue':_0xc73f('0xd')},'key':{'type':Sequelize[_0xc73f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xc73f('0xe')],'defaultValue':function(){return _0xc73f('0xf');}},'notificationSound':{'type':Sequelize[_0xc73f('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc73f('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc73f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc73f('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc73f('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc73f('0xc')],'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[_0xc73f('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2fb4cc){if(!_0x2fb4cc)this[_0xc73f('0x11')](_0xc73f('0x12'),null);this['setDataValue'](_0xc73f('0x13'),_0x2fb4cc);}}}; \ No newline at end of file +var _0x5225=['IAX','DADHI','KHOMP','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','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','14400','9600','12000','v17,v27,v29','INTEGER','SIP'];(function(_0x55358b,_0x14b858){var _0x5226de=function(_0x4a19f7){while(--_0x4a19f7){_0x55358b['push'](_0x55358b['shift']());}};_0x5226de(++_0x14b858);}(_0x5225,0x19b));var _0x5522=function(_0x2cf683,_0x3213de){_0x2cf683=_0x2cf683-0x0;var _0x5cddff=_0x5225[_0x2cf683];return _0x5cddff;};'use strict';var Sequelize=require(_0x5522('0x0'));module['exports']={'name':{'type':Sequelize[_0x5522('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x5522('0x2')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x5522('0x1')],'defaultValue':_0x5522('0x3')},'localstationid':{'type':Sequelize[_0x5522('0x1')],'unique':_0x5522('0x4')},'minrate':{'type':Sequelize[_0x5522('0x2')](_0x5522('0x5'),_0x5522('0x6'),_0x5522('0x7'),'9600','12000',_0x5522('0x8')),'defaultValue':_0x5522('0x6')},'maxrate':{'type':Sequelize['ENUM'](_0x5522('0x5'),'4800',_0x5522('0x7'),_0x5522('0x9'),_0x5522('0xa'),'14400'),'defaultValue':_0x5522('0x8')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x5522('0xb')},'gateway':{'type':Sequelize[_0x5522('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5522('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5522('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x5522('0xd'),_0x5522('0xe'),_0x5522('0xf'),_0x5522('0x10')),'defaultValue':_0x5522('0xd')},'key':{'type':Sequelize[_0x5522('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5522('0x11')],'defaultValue':function(){return _0x5522('0x12');}},'notificationSound':{'type':Sequelize[_0x5522('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5522('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5522('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5522('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5522('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5522('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5522('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x5522('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x5522('0x13')],'defaultValue':![],'comment':_0x5522('0x15'),'set':function(_0x4b67bc){if(!_0x4b67bc)this[_0x5522('0x16')](_0x5522('0x17'),null);this['setDataValue'](_0x5522('0x18'),_0x4b67bc);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 905e2cf..f14ac79 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 _0xdbce=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','bulkCreate','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','attachments','join','root','basename','CheckAfterSend','isNil','path','from','fax','List','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','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','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type'];(function(_0x14915a,_0x222f6b){var _0x2f683c=function(_0x28e694){while(--_0x28e694){_0x14915a['push'](_0x14915a['shift']());}};_0x2f683c(++_0x222f6b);}(_0xdbce,0x150));var _0xedbc=function(_0x5a9b31,_0x514881){_0x5a9b31=_0x5a9b31-0x0;var _0x1990cb=_0xdbce[_0x5a9b31];return _0x1990cb;};'use strict';var emlformat=require(_0xedbc('0x0'));var rimraf=require(_0xedbc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedbc('0x2'));var rp=require(_0xedbc('0x3'));var moment=require(_0xedbc('0x4'));var BPromise=require(_0xedbc('0x5'));var Mustache=require('mustache');var util=require(_0xedbc('0x6'));var path=require('path');var sox=require(_0xedbc('0x7'));var csv=require(_0xedbc('0x8'));var ejs=require(_0xedbc('0x9'));var fs=require('fs');var fs_extra=require(_0xedbc('0xa'));var _=require('lodash');var squel=require(_0xedbc('0xb'));var crypto=require(_0xedbc('0xc'));var jsforce=require(_0xedbc('0xd'));var deskjs=require(_0xedbc('0xe'));var toCsv=require(_0xedbc('0x8'));var querystring=require(_0xedbc('0xf'));var Papa=require(_0xedbc('0x10'));var Redis=require(_0xedbc('0x11'));var authService=require(_0xedbc('0x12'));var qs=require(_0xedbc('0x13'));var as=require(_0xedbc('0x14'));var hardwareService=require(_0xedbc('0x15'));var logger=require(_0xedbc('0x16'))(_0xedbc('0x17'));var utils=require(_0xedbc('0x18'));var config=require(_0xedbc('0x19'));var licenseUtil=require(_0xedbc('0x1a'));var db=require(_0xedbc('0x1b'))['db'];config['redis']=_[_0xedbc('0x1c')](config['redis'],{'host':_0xedbc('0x1d'),'port':0x18eb});var socket=require(_0xedbc('0x1e'))(new Redis(config['redis']));require(_0xedbc('0x1f'))[_0xedbc('0x20')](socket);var jayson=require(_0xedbc('0x21'));var client=jayson[_0xedbc('0x22')][_0xedbc('0x23')]({'port':0x232c});var client9002=jayson[_0xedbc('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x320ae2,_0x506f6a,_0x3ac816,_0x28dbc8){return new BPromise(function(_0x524192,_0x3af9a6){var _0x2de5c3=_0x28dbc8||client;return _0x2de5c3[_0xedbc('0x24')](_0x320ae2,_0x3ac816)[_0xedbc('0x25')](function(_0x57c3fd){logger[_0xedbc('0x26')](_0xedbc('0x27'),_0x506f6a,_0xedbc('0x28'));logger[_0xedbc('0x29')](_0xedbc('0x2a'),_0x506f6a,_0xedbc('0x28'),JSON['stringify'](_0x57c3fd));if(_0x57c3fd['error']){if(_0x57c3fd[_0xedbc('0x2b')][_0xedbc('0x2c')]===0x1f4){logger[_0xedbc('0x2b')](_0xedbc('0x27'),_0x506f6a,_0x57c3fd[_0xedbc('0x2b')][_0xedbc('0x2d')]);return _0x3af9a6(_0x57c3fd[_0xedbc('0x2b')][_0xedbc('0x2d')]);}logger['error'](_0xedbc('0x27'),_0x506f6a,_0x57c3fd[_0xedbc('0x2b')][_0xedbc('0x2d')]);return _0x524192(_0x57c3fd[_0xedbc('0x2b')][_0xedbc('0x2d')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x506f6a,'request\x20sent');_0x524192(_0x57c3fd[_0xedbc('0x2e')][_0xedbc('0x2d')]);}})[_0xedbc('0x2f')](function(_0x5ee517){logger['error'](_0xedbc('0x27'),_0x506f6a,_0x5ee517);_0x3af9a6(_0x5ee517);});});}function respondWithStatusCode(_0x23a12c,_0x1ba022){_0x1ba022=_0x1ba022||0xcc;return function(_0x10762a){if(_0x10762a){return _0x23a12c[_0xedbc('0x30')](_0x1ba022);}return _0x23a12c[_0xedbc('0x31')](_0x1ba022)[_0xedbc('0x32')]();};}function respondWithResult(_0x3772bd,_0x333a7f){_0x333a7f=_0x333a7f||0xc8;return function(_0x953a05){if(_0x953a05){return _0x3772bd['status'](_0x333a7f)[_0xedbc('0x33')](_0x953a05);}};}function respondWithFilteredResult(_0x435587,_0x13c84c){return function(_0x3f4166){if(_0x3f4166){var _0x46da83=typeof _0x13c84c[_0xedbc('0x34')]===_0xedbc('0x35')&&typeof _0x13c84c['limit']===_0xedbc('0x35');var _0x59aadd=_0x3f4166[_0xedbc('0x36')];var _0x28dbf7=_0x46da83?0x0:_0x13c84c['offset'];var _0x71c8f2=_0x46da83?_0x3f4166[_0xedbc('0x36')]:_0x13c84c['offset']+_0x13c84c[_0xedbc('0x37')];var _0x56d1ae;if(_0x71c8f2>=_0x59aadd){_0x71c8f2=_0x59aadd;_0x56d1ae=0xc8;}else{_0x56d1ae=0xce;}_0x435587[_0xedbc('0x31')](_0x56d1ae);return _0x435587[_0xedbc('0x38')](_0xedbc('0x39'),_0x28dbf7+'-'+_0x71c8f2+'/'+_0x59aadd)[_0xedbc('0x33')](_0x3f4166);}return null;};}function patchUpdates(_0x4a222e){return function(_0x402e98){try{jsonpatch[_0xedbc('0x3a')](_0x402e98,_0x4a222e,!![]);}catch(_0x251275){return BPromise['reject'](_0x251275);}return _0x402e98[_0xedbc('0x3b')]();};}function saveUpdates(_0x162356,_0x4f6753){return function(_0x4375c6){if(_0x4375c6){return _0x4375c6[_0xedbc('0x3c')](_0x162356)[_0xedbc('0x25')](function(_0x3432cf){return _0x3432cf;});}return null;};}function removeEntity(_0xc28d52,_0x363880){return function(_0x5763a5){if(_0x5763a5){return _0x5763a5[_0xedbc('0x3d')]()[_0xedbc('0x25')](function(){var _0x13ac3f=_0x5763a5[_0xedbc('0x3e')]({'plain':!![]});var _0x43bdef=_0xedbc('0x3f');return db[_0xedbc('0x40')][_0xedbc('0x3d')]({'where':{'type':_0x43bdef,'resourceId':_0x13ac3f['id']}})[_0xedbc('0x25')](function(){return _0x5763a5;});})[_0xedbc('0x25')](function(){_0xc28d52[_0xedbc('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57279f,_0x346d29){return function(_0x400ea2){if(!_0x400ea2){_0x57279f['sendStatus'](0x194);}return _0x400ea2;};}function handleError(_0x48a41d,_0x5136ef){_0x5136ef=_0x5136ef||0x1f4;return function(_0xdd3247){logger[_0xedbc('0x2b')](_0xdd3247[_0xedbc('0x41')]);if(_0xdd3247['name']){delete _0xdd3247[_0xedbc('0x42')];}_0x48a41d['status'](_0x5136ef)[_0xedbc('0x43')](_0xdd3247);};}exports[_0xedbc('0x44')]=function(_0x5edcd8,_0x5ee24c){var _0x12b2cb={'include':[{'model':db[_0xedbc('0x45')],'as':_0xedbc('0x46')}]},_0x33f4a7={},_0x5df5a0={'count':0x0,'rows':[]};var _0x49a2ee=_[_0xedbc('0x47')](db[_0xedbc('0x48')][_0xedbc('0x49')],function(_0x4db7aa){return{'name':_0x4db7aa[_0xedbc('0x4a')],'type':_0x4db7aa[_0xedbc('0x4b')][_0xedbc('0x4c')]};});_0x33f4a7[_0xedbc('0x4d')]=_['map'](_0x49a2ee,_0xedbc('0x42'));_0x33f4a7[_0xedbc('0x4e')]=_['keys'](_0x5edcd8[_0xedbc('0x4e')]);_0x33f4a7[_0xedbc('0x4f')]=_[_0xedbc('0x50')](_0x33f4a7[_0xedbc('0x4d')],_0x33f4a7[_0xedbc('0x4e')]);_0x12b2cb[_0xedbc('0x51')]=_[_0xedbc('0x50')](_0x33f4a7[_0xedbc('0x4d')],qs['fields'](_0x5edcd8[_0xedbc('0x4e')][_0xedbc('0x52')]));_0x12b2cb[_0xedbc('0x51')]=_0x12b2cb[_0xedbc('0x51')][_0xedbc('0x53')]?_0x12b2cb['attributes']:_0x33f4a7['model'];if(!_0x5edcd8[_0xedbc('0x4e')][_0xedbc('0x54')](_0xedbc('0x55'))){_0x12b2cb[_0xedbc('0x37')]=qs[_0xedbc('0x37')](_0x5edcd8[_0xedbc('0x4e')][_0xedbc('0x37')]);_0x12b2cb[_0xedbc('0x34')]=qs[_0xedbc('0x34')](_0x5edcd8[_0xedbc('0x4e')][_0xedbc('0x34')]);}_0x12b2cb['order']=qs['sort'](_0x5edcd8[_0xedbc('0x4e')][_0xedbc('0x56')]);_0x12b2cb[_0xedbc('0x57')]=qs['filters'](_[_0xedbc('0x58')](_0x5edcd8[_0xedbc('0x4e')],_0x33f4a7[_0xedbc('0x4f')]),_0x49a2ee);if(_0x5edcd8['query'][_0xedbc('0x59')]){_0x12b2cb['where']=_[_0xedbc('0x5a')](_0x12b2cb[_0xedbc('0x57')],{'$or':_[_0xedbc('0x47')](_0x49a2ee,function(_0x43ff90){if(_0x43ff90[_0xedbc('0x4b')]!==_0xedbc('0x5b')){var _0x344aad={};_0x344aad[_0x43ff90[_0xedbc('0x42')]]={'$like':'%'+_0x5edcd8[_0xedbc('0x4e')][_0xedbc('0x59')]+'%'};return _0x344aad;}})});}_0x12b2cb=_[_0xedbc('0x5a')]({},_0x12b2cb,_0x5edcd8[_0xedbc('0x5c')]);var _0x4e80f3={'where':_0x12b2cb[_0xedbc('0x57')]};return db[_0xedbc('0x48')][_0xedbc('0x36')](_0x4e80f3)[_0xedbc('0x25')](function(_0x54c00a){_0x5df5a0[_0xedbc('0x36')]=_0x54c00a;if(_0x5edcd8[_0xedbc('0x4e')][_0xedbc('0x5d')]){_0x12b2cb[_0xedbc('0x5e')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x12b2cb);})[_0xedbc('0x25')](function(_0x289924){_0x5df5a0[_0xedbc('0x5f')]=_0x289924;return _0x5df5a0;})[_0xedbc('0x25')](respondWithFilteredResult(_0x5ee24c,_0x12b2cb))[_0xedbc('0x2f')](handleError(_0x5ee24c,null));};exports['show']=function(_0x48e2bd,_0x2c88f2){var _0x4ddc53={'raw':![],'where':{'id':_0x48e2bd[_0xedbc('0x60')]['id']},'include':[{'model':db[_0xedbc('0x45')],'as':_0xedbc('0x46')}]},_0x1d1407={};_0x1d1407[_0xedbc('0x4d')]=_['keys'](db[_0xedbc('0x48')][_0xedbc('0x49')]);_0x1d1407['query']=_[_0xedbc('0x61')](_0x48e2bd[_0xedbc('0x4e')]);_0x1d1407[_0xedbc('0x4f')]=_[_0xedbc('0x50')](_0x1d1407[_0xedbc('0x4d')],_0x1d1407[_0xedbc('0x4e')]);_0x4ddc53[_0xedbc('0x51')]=_[_0xedbc('0x50')](_0x1d1407[_0xedbc('0x4d')],qs[_0xedbc('0x52')](_0x48e2bd[_0xedbc('0x4e')][_0xedbc('0x52')]));_0x4ddc53[_0xedbc('0x51')]=_0x4ddc53['attributes']['length']?_0x4ddc53[_0xedbc('0x51')]:_0x1d1407['model'];if(_0x48e2bd[_0xedbc('0x4e')]['includeAll']){_0x4ddc53['include']=[{'all':!![]}];}_0x4ddc53=_[_0xedbc('0x5a')]({},_0x4ddc53,_0x48e2bd[_0xedbc('0x5c')]);return db['FaxAccount'][_0xedbc('0x62')](_0x4ddc53)[_0xedbc('0x25')](handleEntityNotFound(_0x2c88f2,null))[_0xedbc('0x25')](respondWithResult(_0x2c88f2,null))[_0xedbc('0x2f')](handleError(_0x2c88f2,null));};exports[_0xedbc('0x63')]=function(_0x55e256,_0x5bf79d){return db[_0xedbc('0x48')]['create'](_0x55e256['body'],{})[_0xedbc('0x25')](function(_0x4d98d9){var _0x286cc0=_0x55e256[_0xedbc('0x64')][_0xedbc('0x3e')]({'plain':!![]});if(!_0x286cc0)throw new Error(_0xedbc('0x65'));if(_0x286cc0[_0xedbc('0x66')]===_0xedbc('0x64')){var _0x1c1f36=_0x4d98d9[_0xedbc('0x3e')]({'plain':!![]});var _0x5a7de4=_0xedbc('0x3f');return db[_0xedbc('0x67')][_0xedbc('0x62')]({'where':{'name':_0x5a7de4,'userProfileId':_0x286cc0[_0xedbc('0x68')]},'raw':!![]})[_0xedbc('0x25')](function(_0x2d9857){if(_0x2d9857&&_0x2d9857[_0xedbc('0x69')]===0x0){return db[_0xedbc('0x40')]['create']({'name':_0x1c1f36[_0xedbc('0x42')],'resourceId':_0x1c1f36['id'],'type':_0x2d9857[_0xedbc('0x42')],'sectionId':_0x2d9857['id']},{})['then'](function(){return _0x4d98d9;});}else{return _0x4d98d9;}})[_0xedbc('0x2f')](function(_0x21fc6d){logger[_0xedbc('0x2b')](_0xedbc('0x6a'),_0x21fc6d);throw _0x21fc6d;});}return _0x4d98d9;})['then'](respondWithResult(_0x5bf79d,0xc9))[_0xedbc('0x2f')](handleError(_0x5bf79d,null));};exports[_0xedbc('0x3c')]=function(_0x10511a,_0x27625a){if(_0x10511a[_0xedbc('0x6b')]['id']){delete _0x10511a[_0xedbc('0x6b')]['id'];}return db[_0xedbc('0x48')][_0xedbc('0x62')]({'where':{'id':_0x10511a[_0xedbc('0x60')]['id']},'include':[{'model':db[_0xedbc('0x45')],'as':_0xedbc('0x46')}]})[_0xedbc('0x25')](handleEntityNotFound(_0x27625a,null))['then'](saveUpdates(_0x10511a['body'],null))[_0xedbc('0x25')](respondWithResult(_0x27625a,null))[_0xedbc('0x2f')](handleError(_0x27625a,null));};exports['destroy']=function(_0x1aec42,_0x29eaee){return db[_0xedbc('0x48')][_0xedbc('0x62')]({'where':{'id':_0x1aec42['params']['id']}})['then'](handleEntityNotFound(_0x29eaee,null))[_0xedbc('0x25')](removeEntity(_0x29eaee,null))[_0xedbc('0x2f')](handleError(_0x29eaee,null));};exports[_0xedbc('0x6c')]=function(_0xa3f990,_0x13e61c){return db[_0xedbc('0x48')][_0xedbc('0x6c')]()[_0xedbc('0x25')](respondWithResult(_0x13e61c,null))['catch'](handleError(_0x13e61c,null));};exports[_0xedbc('0x6d')]=function(_0x4383a3,_0x58acb1,_0x5d9538){if(_0x4383a3[_0xedbc('0x6b')]['id']){delete _0x4383a3[_0xedbc('0x6b')]['id'];}return db[_0xedbc('0x48')][_0xedbc('0x62')]({'where':{'id':_0x4383a3[_0xedbc('0x60')]['id']}})[_0xedbc('0x25')](handleEntityNotFound(_0x58acb1,null))[_0xedbc('0x25')](function(_0x43bdee){if(_0x43bdee){_0x4383a3[_0xedbc('0x6b')][_0xedbc('0x6e')]=_0x43bdee['id'];return db[_0xedbc('0x6f')]['create'](_0x4383a3['body']);}})[_0xedbc('0x25')](respondWithResult(_0x58acb1,null))['catch'](handleError(_0x58acb1,null));};exports[_0xedbc('0x70')]=function(_0x3620c9,_0x926651,_0x3945cb){var _0x55602b={'raw':![],'where':{}};var _0x1dba0a={};var _0x211c98={'count':0x0,'rows':[]};return db[_0xedbc('0x48')][_0xedbc('0x71')]({'where':{'id':_0x3620c9[_0xedbc('0x60')]['id']}})[_0xedbc('0x25')](handleEntityNotFound(_0x926651,null))[_0xedbc('0x25')](function(_0x31ca4e){if(_0x31ca4e){_0x1dba0a['model']=_[_0xedbc('0x61')](db[_0xedbc('0x6f')][_0xedbc('0x49')]);_0x1dba0a[_0xedbc('0x4e')]=_[_0xedbc('0x61')](_0x3620c9[_0xedbc('0x4e')]);_0x1dba0a[_0xedbc('0x4f')]=_[_0xedbc('0x50')](_0x1dba0a[_0xedbc('0x4d')],_0x1dba0a[_0xedbc('0x4e')]);_0x55602b[_0xedbc('0x51')]=_[_0xedbc('0x50')](_0x1dba0a[_0xedbc('0x4d')],qs[_0xedbc('0x52')](_0x3620c9[_0xedbc('0x4e')][_0xedbc('0x52')]));_0x55602b['attributes']=_0x55602b[_0xedbc('0x51')][_0xedbc('0x53')]?_0x55602b[_0xedbc('0x51')]:_0x1dba0a['model'];if(!_0x3620c9[_0xedbc('0x4e')][_0xedbc('0x54')](_0xedbc('0x55'))){_0x55602b[_0xedbc('0x37')]=qs[_0xedbc('0x37')](_0x3620c9[_0xedbc('0x4e')]['limit']);_0x55602b[_0xedbc('0x34')]=qs[_0xedbc('0x34')](_0x3620c9['query']['offset']);}_0x55602b[_0xedbc('0x72')]=qs[_0xedbc('0x56')](_0x3620c9['query'][_0xedbc('0x56')]);_0x55602b[_0xedbc('0x57')]=qs[_0xedbc('0x4f')](_[_0xedbc('0x58')](_0x3620c9['query'],_0x1dba0a['filters']));_0x55602b['where'][_0xedbc('0x6e')]=_0x31ca4e['id'];if(_0x3620c9[_0xedbc('0x4e')][_0xedbc('0x59')]){_0x55602b[_0xedbc('0x57')]=_[_0xedbc('0x5a')](_0x55602b['where'],{'$or':_[_0xedbc('0x47')](_0x55602b['attributes'],function(_0x3f5111){var _0x1bdfa5={};_0x1bdfa5[_0x3f5111]={'$like':'%'+_0x3620c9['query'][_0xedbc('0x59')]+'%'};return _0x1bdfa5;})});}_0x55602b=_[_0xedbc('0x5a')]({},_0x55602b,_0x3620c9['options']);return db[_0xedbc('0x6f')]['count']({'where':_0x55602b['where']})[_0xedbc('0x25')](function(_0x4e71be){_0x211c98['count']=_0x4e71be;if(_0x3620c9[_0xedbc('0x4e')][_0xedbc('0x5d')]){_0x55602b[_0xedbc('0x5e')]=[{'all':!![]}];}return db[_0xedbc('0x6f')][_0xedbc('0x73')](_0x55602b);})[_0xedbc('0x25')](function(_0x4deea3){_0x211c98['rows']=_0x4deea3;return _0x211c98;});}})[_0xedbc('0x25')](respondWithFilteredResult(_0x926651,_0x55602b))[_0xedbc('0x2f')](handleError(_0x926651,null));};exports[_0xedbc('0x74')]=function(_0x533d2d,_0x41e352,_0x463699){return db[_0xedbc('0x48')][_0xedbc('0x62')]({'where':{'id':_0x533d2d['params']['id']}})[_0xedbc('0x25')](handleEntityNotFound(_0x41e352,null))[_0xedbc('0x25')](function(_0x4e5bb4){if(_0x4e5bb4){return _0x4e5bb4[_0xedbc('0x74')](_0x533d2d['query'][_0xedbc('0x75')]);}})[_0xedbc('0x25')](respondWithStatusCode(_0x41e352,null))[_0xedbc('0x2f')](handleError(_0x41e352,null));};exports[_0xedbc('0x76')]=function(_0x74c730,_0x56c9bc,_0x2d388f){if(_0x74c730[_0xedbc('0x6b')]['id']){delete _0x74c730[_0xedbc('0x6b')]['id'];}return db[_0xedbc('0x48')]['find']({'where':{'id':_0x74c730[_0xedbc('0x60')]['id']}})['then'](handleEntityNotFound(_0x56c9bc,null))['then'](function(_0x174309){if(_0x174309){_0x74c730[_0xedbc('0x6b')][_0xedbc('0x6e')]=_0x174309['id'];return db[_0xedbc('0x77')][_0xedbc('0x63')](_0x74c730[_0xedbc('0x6b')]);}})[_0xedbc('0x25')](respondWithResult(_0x56c9bc,null))[_0xedbc('0x2f')](handleError(_0x56c9bc,null));};exports[_0xedbc('0x78')]=function(_0xe89b40,_0x2d0b3c,_0xfae59a){var _0x5e6d0b={'raw':![],'where':{}};var _0x40d755={};var _0x1f34b2={'count':0x0,'rows':[]};return db['FaxAccount'][_0xedbc('0x71')]({'where':{'id':_0xe89b40[_0xedbc('0x60')]['id']}})['then'](handleEntityNotFound(_0x2d0b3c,null))[_0xedbc('0x25')](function(_0x263323){if(_0x263323){_0x40d755[_0xedbc('0x4d')]=_[_0xedbc('0x61')](db[_0xedbc('0x77')][_0xedbc('0x49')]);_0x40d755[_0xedbc('0x4e')]=_[_0xedbc('0x61')](_0xe89b40[_0xedbc('0x4e')]);_0x40d755[_0xedbc('0x4f')]=_['intersection'](_0x40d755[_0xedbc('0x4d')],_0x40d755['query']);_0x5e6d0b[_0xedbc('0x51')]=_[_0xedbc('0x50')](_0x40d755['model'],qs['fields'](_0xe89b40['query'][_0xedbc('0x52')]));_0x5e6d0b[_0xedbc('0x51')]=_0x5e6d0b['attributes'][_0xedbc('0x53')]?_0x5e6d0b[_0xedbc('0x51')]:_0x40d755[_0xedbc('0x4d')];if(!_0xe89b40[_0xedbc('0x4e')]['hasOwnProperty'](_0xedbc('0x55'))){_0x5e6d0b[_0xedbc('0x37')]=qs['limit'](_0xe89b40[_0xedbc('0x4e')][_0xedbc('0x37')]);_0x5e6d0b[_0xedbc('0x34')]=qs[_0xedbc('0x34')](_0xe89b40[_0xedbc('0x4e')][_0xedbc('0x34')]);}_0x5e6d0b[_0xedbc('0x72')]=qs[_0xedbc('0x56')](_0xe89b40[_0xedbc('0x4e')][_0xedbc('0x56')]);_0x5e6d0b['where']=qs[_0xedbc('0x4f')](_['pick'](_0xe89b40[_0xedbc('0x4e')],_0x40d755[_0xedbc('0x4f')]));_0x5e6d0b['where'][_0xedbc('0x6e')]=_0x263323['id'];if(_0xe89b40[_0xedbc('0x4e')][_0xedbc('0x59')]){_0x5e6d0b[_0xedbc('0x57')]=_[_0xedbc('0x5a')](_0x5e6d0b['where'],{'$or':_[_0xedbc('0x47')](_0x5e6d0b['attributes'],function(_0x22195a){var _0x345c42={};_0x345c42[_0x22195a]={'$like':'%'+_0xe89b40[_0xedbc('0x4e')]['filter']+'%'};return _0x345c42;})});}_0x5e6d0b=_['merge']({},_0x5e6d0b,_0xe89b40[_0xedbc('0x5c')]);return db[_0xedbc('0x77')]['count']({'where':_0x5e6d0b[_0xedbc('0x57')]})[_0xedbc('0x25')](function(_0x5c9a73){_0x1f34b2[_0xedbc('0x36')]=_0x5c9a73;if(_0xe89b40[_0xedbc('0x4e')][_0xedbc('0x5d')]){_0x5e6d0b['include']=[{'all':!![]}];}return db[_0xedbc('0x77')][_0xedbc('0x73')](_0x5e6d0b);})['then'](function(_0x58ee7c){_0x1f34b2[_0xedbc('0x5f')]=_0x58ee7c;return _0x1f34b2;});}})[_0xedbc('0x25')](respondWithFilteredResult(_0x2d0b3c,_0x5e6d0b))[_0xedbc('0x2f')](handleError(_0x2d0b3c,null));};exports['removeAnswers']=function(_0x4a1af7,_0x2b99a4,_0x3b82c6){return db['FaxAccount'][_0xedbc('0x62')]({'where':{'id':_0x4a1af7[_0xedbc('0x60')]['id']}})[_0xedbc('0x25')](handleEntityNotFound(_0x2b99a4,null))[_0xedbc('0x25')](function(_0x12013f){if(_0x12013f){return _0x12013f[_0xedbc('0x79')](_0x4a1af7[_0xedbc('0x4e')]['ids']);}})[_0xedbc('0x25')](respondWithStatusCode(_0x2b99a4,null))[_0xedbc('0x2f')](handleError(_0x2b99a4,null));};exports[_0xedbc('0x7a')]=function(_0x531f52,_0x1c9b46,_0x256fac){return db['FaxInteraction'][_0xedbc('0x62')]({'where':{'id':_0x531f52[_0xedbc('0x60')]['id']}})[_0xedbc('0x25')](handleEntityNotFound(_0x1c9b46,null))[_0xedbc('0x25')](function(_0x58ece6){if(_0x58ece6){return _0x58ece6[_0xedbc('0x7a')](_0x531f52[_0xedbc('0x6b')][_0xedbc('0x75')],_[_0xedbc('0x7b')](_0x531f52[_0xedbc('0x6b')],[_0xedbc('0x75'),'id'])||{});}})[_0xedbc('0x25')](respondWithResult(_0x1c9b46,null))[_0xedbc('0x2f')](handleError(_0x1c9b46,null));};exports[_0xedbc('0x7c')]=function(_0x28a4d4,_0x5dec79,_0x21b3d3){var _0x32b589={'raw':![],'where':{}};var _0x251825={};var _0x18cae2={'count':0x0,'rows':[]};return db[_0xedbc('0x48')]['findOne']({'where':{'id':_0x28a4d4[_0xedbc('0x60')]['id']}})[_0xedbc('0x25')](handleEntityNotFound(_0x5dec79,null))[_0xedbc('0x25')](function(_0x4a587f){if(_0x4a587f){_0x251825[_0xedbc('0x4d')]=_[_0xedbc('0x61')](db[_0xedbc('0x7d')][_0xedbc('0x49')]);_0x251825[_0xedbc('0x4e')]=_[_0xedbc('0x61')](_0x28a4d4[_0xedbc('0x4e')]);_0x251825['filters']=_[_0xedbc('0x50')](_0x251825['model'],_0x251825[_0xedbc('0x4e')]);_0x32b589[_0xedbc('0x51')]=_[_0xedbc('0x50')](_0x251825[_0xedbc('0x4d')],qs[_0xedbc('0x52')](_0x28a4d4[_0xedbc('0x4e')][_0xedbc('0x52')]));_0x32b589[_0xedbc('0x51')]=_0x32b589[_0xedbc('0x51')]['length']?_0x32b589[_0xedbc('0x51')]:_0x251825[_0xedbc('0x4d')];if(!_0x28a4d4['query'][_0xedbc('0x54')](_0xedbc('0x55'))){_0x32b589[_0xedbc('0x37')]=qs['limit'](_0x28a4d4[_0xedbc('0x4e')][_0xedbc('0x37')]);_0x32b589[_0xedbc('0x34')]=qs['offset'](_0x28a4d4[_0xedbc('0x4e')][_0xedbc('0x34')]);}_0x32b589['order']=qs[_0xedbc('0x56')](_0x28a4d4[_0xedbc('0x4e')][_0xedbc('0x56')]);_0x32b589[_0xedbc('0x57')]=qs[_0xedbc('0x4f')](_[_0xedbc('0x58')](_0x28a4d4[_0xedbc('0x4e')],_0x251825[_0xedbc('0x4f')]));_0x32b589['where']['FaxAccountId']=_0x4a587f['id'];if(_0x28a4d4['query'][_0xedbc('0x59')]){_0x32b589['where']=_[_0xedbc('0x5a')](_0x32b589['where'],{'$or':_[_0xedbc('0x47')](_0x32b589[_0xedbc('0x51')],function(_0x42ceeb){var _0x1b4269={};_0x1b4269[_0x42ceeb]={'$like':'%'+_0x28a4d4[_0xedbc('0x4e')]['filter']+'%'};return _0x1b4269;})});}_0x32b589=_[_0xedbc('0x5a')]({},_0x32b589,_0x28a4d4[_0xedbc('0x5c')]);return db[_0xedbc('0x7d')][_0xedbc('0x36')]({'where':_0x32b589['where']})[_0xedbc('0x25')](function(_0x5548e4){_0x18cae2[_0xedbc('0x36')]=_0x5548e4;if(_0x28a4d4[_0xedbc('0x4e')]['includeAll']){_0x32b589[_0xedbc('0x5e')]=[{'model':db[_0xedbc('0x7e')],'as':'Contact','required':![]},{'model':db[_0xedbc('0x7f')],'as':_0xedbc('0x80'),'attributes':[_0xedbc('0x42'),_0xedbc('0x81'),_0xedbc('0x82')],'required':![]},{'model':db[_0xedbc('0x83')],'as':_0xedbc('0x84'),'attributes':['id',_0xedbc('0x42'),_0xedbc('0x85')],'where':_0x28a4d4[_0xedbc('0x4e')][_0xedbc('0x86')]?{'id':_0x28a4d4['query'][_0xedbc('0x86')]}:undefined,'required':_0x28a4d4[_0xedbc('0x4e')][_0xedbc('0x86')]?!![]:![]}];}return db[_0xedbc('0x7d')][_0xedbc('0x73')](_0x32b589);})[_0xedbc('0x25')](function(_0x171eae){_0x18cae2[_0xedbc('0x5f')]=_0x171eae;return _0x18cae2;});}})[_0xedbc('0x25')](respondWithFilteredResult(_0x5dec79,_0x32b589))[_0xedbc('0x2f')](handleError(_0x5dec79,null));};exports[_0xedbc('0x87')]=function(_0xee1b13,_0x58970b,_0x3cf981){return db['FaxAccount'][_0xedbc('0x71')]({'where':{'id':_0xee1b13[_0xedbc('0x60')]['id']}})['then'](handleEntityNotFound(_0x58970b,null))[_0xedbc('0x25')](function(_0x5674c1){if(_0x5674c1){return db[_0xedbc('0x88')]['transaction'](function(_0x3fa6d2){return db[_0xedbc('0x89')][_0xedbc('0x3d')]({'where':{'FaxAccountId':_0xee1b13[_0xedbc('0x60')]['id']},'transaction':_0x3fa6d2})['then'](function(_0x44c133){var _0x4e4c68=_[_0xedbc('0x47')](_0xee1b13[_0xedbc('0x6b')],function(_0x413c42){_0x413c42[_0xedbc('0x6e')]=_0xee1b13[_0xedbc('0x60')]['id'];return _0x413c42;});return db[_0xedbc('0x89')]['bulkCreate'](_0x4e4c68,{'transaction':_0x3fa6d2});});})[_0xedbc('0x25')](function(){return db[_0xedbc('0x89')][_0xedbc('0x8a')]({'where':{'FaxAccountId':_0xee1b13['params']['id']},'order':_0xedbc('0x8b')});});}})[_0xedbc('0x25')](respondWithResult(_0x58970b,null))[_0xedbc('0x2f')](handleError(_0x58970b,null));};exports['getApplications']=function(_0x41222d,_0x379400,_0x116da2){var _0x353183={};var _0x4099ce={};var _0x59afa5;var _0x22e8dd;return db['FaxAccount'][_0xedbc('0x71')]({'where':{'id':_0x41222d[_0xedbc('0x60')]['id']}})['then'](handleEntityNotFound(_0x379400,null))[_0xedbc('0x25')](function(_0x5e75f4){if(_0x5e75f4){_0x59afa5=_0x5e75f4;_0x4099ce[_0xedbc('0x4d')]=_[_0xedbc('0x61')](db[_0xedbc('0x89')][_0xedbc('0x49')]);_0x4099ce[_0xedbc('0x4e')]=_['keys'](_0x41222d['query']);_0x4099ce[_0xedbc('0x4f')]=_[_0xedbc('0x50')](_0x4099ce[_0xedbc('0x4d')],_0x4099ce['query']);_0x353183[_0xedbc('0x51')]=_[_0xedbc('0x50')](_0x4099ce[_0xedbc('0x4d')],qs[_0xedbc('0x52')](_0x41222d[_0xedbc('0x4e')][_0xedbc('0x52')]));_0x353183[_0xedbc('0x51')]=_0x353183[_0xedbc('0x51')][_0xedbc('0x53')]?_0x353183['attributes']:_0x4099ce['model'];_0x353183[_0xedbc('0x72')]=qs['sort'](_0x41222d[_0xedbc('0x4e')][_0xedbc('0x56')]);_0x353183[_0xedbc('0x57')]=qs[_0xedbc('0x4f')](_['pick'](_0x41222d['query'],_0x4099ce[_0xedbc('0x4f')]));if(_0x41222d['query']['filter']){_0x353183[_0xedbc('0x57')]=_[_0xedbc('0x5a')](_0x353183[_0xedbc('0x57')],{'$or':_['map'](_0x353183['attributes'],function(_0x4f77fc){var _0x3b8c98={};_0x3b8c98[_0x4f77fc]={'$like':'%'+_0x41222d[_0xedbc('0x4e')][_0xedbc('0x59')]+'%'};return _0x3b8c98;})});}_0x353183=_[_0xedbc('0x5a')]({},_0x353183,_0x41222d['options']);return _0x59afa5[_0xedbc('0x8c')](_0x353183);}})[_0xedbc('0x25')](function(_0x4bd7ad){if(_0x4bd7ad){_0x22e8dd=_0x4bd7ad['length'];if(!_0x41222d['query'][_0xedbc('0x54')](_0xedbc('0x55'))){_0x353183[_0xedbc('0x37')]=qs['limit'](_0x41222d['query'][_0xedbc('0x37')]);_0x353183[_0xedbc('0x34')]=qs[_0xedbc('0x34')](_0x41222d['query'][_0xedbc('0x34')]);}return _0x59afa5[_0xedbc('0x8c')](_0x353183);}})[_0xedbc('0x25')](function(_0x4fafad){if(_0x4fafad){return _0x4fafad?{'count':_0x22e8dd,'rows':_0x4fafad}:null;}})[_0xedbc('0x25')](respondWithResult(_0x379400,null))['catch'](handleError(_0x379400,null));};function Extension(_0x317001,_0x103bc4,_0x4b8287,_0x3934f4){this[_0xedbc('0x8d')]=_0xedbc('0x8e');this[_0xedbc('0x8f')]=_0x317001[_0xedbc('0x90')];this[_0xedbc('0x91')]=_0x3934f4;this[_0xedbc('0x4b')]='system';this['description']=_0xedbc('0x92');this['FaxAccountId']=_0x317001['id'];this[_0xedbc('0x8b')]=_0x103bc4;this[_0xedbc('0x93')]=_0x4b8287;}function createExtensionsReciveFax(_0x4ee375){var _0x119eeb=0x1;var _0x51ed73=[];_0x51ed73[_0xedbc('0x94')](new Extension(_0x4ee375,_0x119eeb,'',_0xedbc('0x95')));_0x119eeb+=0x1;_0x51ed73[_0xedbc('0x94')](new Extension(_0x4ee375,_0x119eeb,_0xedbc('0x96'),_0xedbc('0x97')));_0x119eeb+=0x1;for(var _0x3d18e5 in _0x4ee375){if(_0x4ee375[_0xedbc('0x54')](_0x3d18e5)&&(_0x3d18e5===_0xedbc('0x98')||_0x3d18e5===_0xedbc('0x90')||_0x3d18e5===_0xedbc('0x99')||_0x3d18e5===_0xedbc('0x9a')||_0x3d18e5===_0xedbc('0x9b')||_0x3d18e5===_0xedbc('0x9c')||_0x3d18e5==='minrate'||_0x3d18e5==='modem'||_0x3d18e5===_0xedbc('0x9d'))){_0x51ed73[_0xedbc('0x94')](new Extension(_0x4ee375,_0x119eeb,_0xedbc('0x9e')+_0x3d18e5+')='+_0x4ee375[_0x3d18e5],_0xedbc('0x97')));_0x119eeb+=0x1;}}_0x51ed73['push'](new Extension(_0x4ee375,_0x119eeb,'6',_0xedbc('0x9f')));_0x119eeb+=0x1;_0x51ed73[_0xedbc('0x94')](new Extension(_0x4ee375,_0x119eeb,_0xedbc('0xa0'),_0xedbc('0xa1')));_0x119eeb=0x0;return _0x51ed73;}exports[_0xedbc('0xa2')]=function(_0x36cdcc,_0x10cda5,_0x347b9f){var _0x5b7dc7;return db[_0xedbc('0x88')][_0xedbc('0xa3')](function(_0x5e0421){return db['FaxAccount'][_0xedbc('0x63')](_0x36cdcc[_0xedbc('0x6b')],{'transaction':_0x5e0421})[_0xedbc('0x25')](function(_0x25a447){_0x5b7dc7=_0x25a447[_0xedbc('0x3e')]({'plain':!![]});return db['VoiceExtension'][_0xedbc('0xa4')](createExtensionsReciveFax(_0x5b7dc7),{'transaction':_0x5e0421});});})[_0xedbc('0x25')](function(){return _0x5b7dc7;})[_0xedbc('0x25')](respondWithResult(_0x10cda5,null))[_0xedbc('0x2f')](handleError(_0x10cda5,null));};exports[_0xedbc('0xa5')]=function(_0x581f8d,_0x3d0893,_0x40df50){var _0x4060d3;return db['sequelize']['transaction'](function(_0xbe084c){return db[_0xedbc('0x48')]['update'](_0x581f8d[_0xedbc('0x6b')],{'where':{'id':_0x581f8d['body']['id']},'transaction':_0xbe084c})[_0xedbc('0x25')](function(_0x2133a4){return db[_0xedbc('0xa6')]['destroy']({'where':{'FaxAccountId':_0x581f8d['body']['id']},'transaction':_0xbe084c})[_0xedbc('0x25')](function(_0x3e2c7d){return db[_0xedbc('0xa6')][_0xedbc('0xa4')](createExtensionsReciveFax(_[_0xedbc('0x7b')](_0x581f8d[_0xedbc('0x6b')],[_0xedbc('0xa7'),_0xedbc('0x4c'),_0xedbc('0xa8'),_0xedbc('0xa9'),_0xedbc('0xaa'),'ListId'])),{'transaction':_0xbe084c});});});})[_0xedbc('0x25')](function(){return db[_0xedbc('0x48')][_0xedbc('0xab')](_0x581f8d[_0xedbc('0x6b')]['id']);})[_0xedbc('0x25')](respondWithResult(_0x3d0893,null))[_0xedbc('0x2f')](handleError(_0x3d0893,null));};exports[_0xedbc('0xac')]=function(_0x2c9238,_0x22ebb1,_0x347ff7){var _0x43855e={'raw':!![],'where':{}};var _0x2b2c41={};var _0x336adb={'count':0x0,'rows':[]};return db[_0xedbc('0x48')][_0xedbc('0x71')]({'where':{'id':_0x2c9238[_0xedbc('0x60')]['id']}})[_0xedbc('0x25')](handleEntityNotFound(_0x22ebb1,null))[_0xedbc('0x25')](function(_0x6fcd47){if(_0x6fcd47){_0x2b2c41[_0xedbc('0x4d')]=_[_0xedbc('0x61')](db[_0xedbc('0xad')][_0xedbc('0x49')]);_0x2b2c41[_0xedbc('0x4e')]=_[_0xedbc('0x61')](_0x2c9238[_0xedbc('0x4e')]);_0x2b2c41[_0xedbc('0x4f')]=_['intersection'](_0x2b2c41[_0xedbc('0x4d')],_0x2b2c41['query']);_0x43855e[_0xedbc('0x51')]=_[_0xedbc('0x50')](_0x2b2c41[_0xedbc('0x4d')],qs[_0xedbc('0x52')](_0x2c9238[_0xedbc('0x4e')][_0xedbc('0x52')]));_0x43855e[_0xedbc('0x51')]=_0x43855e[_0xedbc('0x51')][_0xedbc('0x53')]?_0x43855e[_0xedbc('0x51')]:_0x2b2c41[_0xedbc('0x4d')];if(!_0x2c9238[_0xedbc('0x4e')][_0xedbc('0x54')]('nolimit')){_0x43855e[_0xedbc('0x37')]=qs[_0xedbc('0x37')](_0x2c9238[_0xedbc('0x4e')][_0xedbc('0x37')]);_0x43855e[_0xedbc('0x34')]=qs[_0xedbc('0x34')](_0x2c9238[_0xedbc('0x4e')][_0xedbc('0x34')]);}_0x43855e[_0xedbc('0x72')]=qs[_0xedbc('0x56')](_0x2c9238['query'][_0xedbc('0x56')]);_0x43855e['where']=qs['filters'](_[_0xedbc('0x58')](_0x2c9238[_0xedbc('0x4e')],_0x2b2c41['filters']));_0x43855e[_0xedbc('0x57')][_0xedbc('0x6e')]=_0x6fcd47['id'];if(_0x2c9238[_0xedbc('0x4e')]['filter']){_0x43855e[_0xedbc('0x57')]=_[_0xedbc('0x5a')](_0x43855e[_0xedbc('0x57')],{'$or':_['map'](_0x43855e[_0xedbc('0x51')],function(_0x3fc933){var _0xabea3c={};_0xabea3c[_0x3fc933]={'$like':'%'+_0x2c9238[_0xedbc('0x4e')][_0xedbc('0x59')]+'%'};return _0xabea3c;})});}if(_0x2c9238[_0xedbc('0x4e')]['$gte']){var _0x58ffcf=_0x2c9238[_0xedbc('0x4e')][_0xedbc('0xae')][_0xedbc('0xaf')](',');var _0x268683={};_0x268683[_0x58ffcf[0x0]]={'$gte':moment(_0x58ffcf[0x1])['format'](_0xedbc('0xb0'))};_0x43855e[_0xedbc('0x57')]=_[_0xedbc('0x5a')](_0x43855e[_0xedbc('0x57')],_0x268683);}_0x43855e=_[_0xedbc('0x5a')]({},_0x43855e,_0x2c9238[_0xedbc('0x5c')]);return db[_0xedbc('0xad')]['count']({'where':_0x43855e['where']})['then'](function(_0x3f872a){_0x336adb['count']=_0x3f872a;if(_0x2c9238['query'][_0xedbc('0x5d')]){_0x43855e[_0xedbc('0x5e')]=[{'all':!![]}];}return db['FaxMessage'][_0xedbc('0x73')](_0x43855e);})[_0xedbc('0x25')](function(_0x5ac746){_0x336adb['rows']=_0x5ac746;return _0x336adb;});}})['then'](respondWithFilteredResult(_0x22ebb1,_0x43855e))[_0xedbc('0x2f')](handleError(_0x22ebb1,null));};exports[_0xedbc('0x43')]=function(_0x18a886,_0x21184b,_0x3b024b){var _0x1451c,_0xd693ed={},_0x2f465f;if(_0x18a886[_0xedbc('0x6b')]['to']){_0x2f465f=_0x18a886['body']['to'][0x0];}return db[_0xedbc('0x48')][_0xedbc('0x62')]({'where':{'id':_0x18a886[_0xedbc('0x60')]['id']},'include':[{'model':db[_0xedbc('0xb1')],'as':'List','include':[{'model':db[_0xedbc('0x7e')],'as':_0xedbc('0xb2'),'where':{'fax':_0x2f465f},'limit':0x1,'order':[[_0xedbc('0xa9'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x21184b,null))[_0xedbc('0x25')](function(_0x41cb5){_0x1451c=_0x41cb5;if(_0x18a886['body'][_0xedbc('0xb3')]&&_0x18a886[_0xedbc('0x6b')][_0xedbc('0xb3')][_0xedbc('0x53')]){for(var _0x4d3b8d=0x0;_0x4d3b8d<_0x18a886[_0xedbc('0x6b')][_0xedbc('0xb3')][_0xedbc('0x53')];_0x4d3b8d+=0x1){_0x18a886['body'][_0xedbc('0xb3')][_0x4d3b8d]={'filename':_0x18a886[_0xedbc('0x6b')][_0xedbc('0xb3')][_0x4d3b8d]['name'],'id':_0x18a886[_0xedbc('0x6b')]['attachments'][_0x4d3b8d]['id'],'path':path[_0xedbc('0xb4')](config[_0xedbc('0xb5')],'server/files/attachments',_0x18a886[_0xedbc('0x6b')][_0xedbc('0xb3')][_0x4d3b8d][_0xedbc('0xb6')])};}}return respondWithRpcPromise(_0xedbc('0xb7'),_0xedbc('0xb7'),{'FaxAccountId':_[_0xedbc('0xb8')](_0x18a886[_0xedbc('0x60')]['id'])?undefined:_0x18a886['params']['id'],'path':_['isNil'](_0x18a886['body']['attachments'][0x0][_0xedbc('0xb9')])?undefined:_0x18a886[_0xedbc('0x6b')][_0xedbc('0xb3')][0x0][_0xedbc('0xb9')],'fax':_[_0xedbc('0xb8')](_0x18a886[_0xedbc('0x6b')]['to'][0x0])?undefined:_0x18a886[_0xedbc('0x6b')]['to'][0x0]},client9002);})[_0xedbc('0x25')](function(){if(_0x1451c){if(_[_0xedbc('0xb8')](_0x18a886[_0xedbc('0x6b')][_0xedbc('0xba')])){_0x18a886[_0xedbc('0x6b')]['from']=util['format']('\x22%s\x22\x20<%s>',_0x1451c[_0xedbc('0x42')],_0x1451c[_0xedbc('0xbb')]);}if(_0x1451c['List']){if(_0x1451c[_0xedbc('0xbc')][_0xedbc('0xb2')][_0xedbc('0x53')]){return _0x1451c['List'][_0xedbc('0xb2')][0x0];}else{return db[_0xedbc('0x7e')][_0xedbc('0x63')](_[_0xedbc('0x1c')](_0x18a886[_0xedbc('0x6b')],{'firstName':_0x18a886[_0xedbc('0x6b')]['to'][0x0],'phone':_0x18a886['body']['to'][0x0],'fax':_0x18a886[_0xedbc('0x6b')]['to'][0x0],'ListId':_0x1451c[_0xedbc('0xbd')]}));}}else{throw new Error(_0xedbc('0xbe'));}}else{throw new Error(_0xedbc('0xbf'));}})[_0xedbc('0x25')](function(_0x1fee7c){if(_0x1fee7c){return db[_0xedbc('0x7d')]['find']({'where':{'ContactId':_0x1fee7c['id'],'closed':![],'FaxAccountId':_0x1451c['id']}})[_0xedbc('0x25')](function(_0x3a9d5e){if(_0x3a9d5e){return[_0x3a9d5e,![]];}return db['FaxInteraction']['create']({'UserId':_0x18a886[_0xedbc('0x64')]['id'],'ContactId':_0x1fee7c['id'],'FaxAccountId':_0x1451c['id'],'fax':_0x18a886[_0xedbc('0x6b')]['to'][0x0],'firstMsgDirection':_0xedbc('0xc0'),'Messages':[_[_0xedbc('0x5a')](_0x18a886[_0xedbc('0x6b')],{'read':![],'body':_0x18a886[_0xedbc('0x6b')][_0xedbc('0xb3')][0x0]['filename'],'FaxAccountId':_0x1451c['id'],'UserId':_0x18a886[_0xedbc('0x64')]['id'],'ContactId':_0x1fee7c['id'],'AttachmentId':_0x18a886[_0xedbc('0x6b')][_0xedbc('0xb3')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xedbc('0xc1')}]})[_0xedbc('0x25')](function(_0x5a5b99){return[_0x5a5b99,!![]];});});}else{throw new Error(_0xedbc('0xc2'));}})[_0xedbc('0xc3')](function(_0x4bf5ef,_0x11e309){if(_0x11e309){return _0x4bf5ef;}return db[_0xedbc('0xad')][_0xedbc('0x63')]({'direction':'out','read':![],'body':_0x18a886[_0xedbc('0x6b')][_0xedbc('0xb3')][0x0]['filename'],'FaxAccountId':_0x1451c['id'],'FaxInteractionId':_0x4bf5ef['id'],'UserId':_0x18a886[_0xedbc('0x64')]['id'],'ContactId':_0x4bf5ef[_0xedbc('0xc4')],'AttachmentId':_0x18a886[_0xedbc('0x6b')]['attachments'][0x0]['id']})[_0xedbc('0x25')](function(_0x42f9d6){_0x4bf5ef[_0xedbc('0xc5')][_0xedbc('0xc1')]=[];_0x4bf5ef[_0xedbc('0xc5')]['Messages'][_0xedbc('0x94')](_0x42f9d6[_0xedbc('0xc5')]);return _0x4bf5ef;});})[_0xedbc('0x25')](function(_0x25ef78){respondWithRpcPromise('SendFax',_0xedbc('0xc6'),{'FaxAccountId':_[_0xedbc('0xb8')](_0x18a886[_0xedbc('0x60')]['id'])?undefined:_0x18a886['params']['id'],'path':_[_0xedbc('0xb8')](_0x18a886[_0xedbc('0x6b')][_0xedbc('0xb3')][0x0]['path'])?undefined:_0x18a886[_0xedbc('0x6b')][_0xedbc('0xb3')][0x0][_0xedbc('0xb9')],'fax':_[_0xedbc('0xb8')](_0x18a886['body']['to'][0x0])?undefined:_0x18a886['body']['to'][0x0],'AttachmentId':_0x18a886['body'][_0xedbc('0xb3')][0x0]['id']},client9002)[_0xedbc('0x25')](function(_0x4f38d3){logger[_0xedbc('0x26')](_0xedbc('0xc7'),_0x4f38d3);})[_0xedbc('0x2f')](function(_0x2e78cb){logger['info'](_0xedbc('0xc7'),_0x2e78cb);});return _0x25ef78;})[_0xedbc('0x25')](respondWithResult(_0x21184b,null))[_0xedbc('0x2f')](handleError(_0x21184b,null));};exports['addAgents']=function(_0x1abce7,_0x474e9c,_0x2d77db){return db[_0xedbc('0x48')][_0xedbc('0x62')]({'where':{'id':_0x1abce7['params']['id']}})[_0xedbc('0x25')](handleEntityNotFound(_0x474e9c,null))[_0xedbc('0x25')](function(_0x33133){if(_0x33133){return _0x33133[_0xedbc('0xc8')](_0x1abce7['body'][_0xedbc('0x75')],_[_0xedbc('0x7b')](_0x1abce7[_0xedbc('0x6b')],[_0xedbc('0x75'),'id'])||{})[_0xedbc('0xc3')](function(_0x529351){for(var _0x1e3185=0x0;_0x1e3185<_0x1abce7[_0xedbc('0x6b')][_0xedbc('0x75')][_0xedbc('0x53')];_0x1e3185+=0x1){socket['emit'](_0xedbc('0xc9'),{'UserId':Number(_0x1abce7[_0xedbc('0x6b')][_0xedbc('0x75')][_0x1e3185]),'FaxAccountId':Number(_0x1abce7['params']['id'])});}return _0x529351;});}})[_0xedbc('0x25')](respondWithResult(_0x474e9c,null))[_0xedbc('0x2f')](handleError(_0x474e9c,null));};exports[_0xedbc('0xca')]=function(_0x1d8960,_0x2c8fdb,_0x48a6f1){return db[_0xedbc('0x48')][_0xedbc('0x62')]({'where':{'id':_0x1d8960[_0xedbc('0x60')]['id']}})['then'](handleEntityNotFound(_0x2c8fdb,null))['then'](function(_0x38cd72){if(_0x38cd72){return _0x38cd72[_0xedbc('0xca')](_0x1d8960['query'][_0xedbc('0x75')])[_0xedbc('0x25')](function(){if(_['isArray'](_0x1d8960['query']['ids'])){for(var _0x3c727f=0x0;_0x3c727f<_0x1d8960[_0xedbc('0x4e')][_0xedbc('0x75')][_0xedbc('0x53')];_0x3c727f+=0x1){socket[_0xedbc('0xcb')](_0xedbc('0xcc'),{'UserId':Number(_0x1d8960[_0xedbc('0x4e')][_0xedbc('0x75')][_0x3c727f]),'FaxAccountId':Number(_0x1d8960['params']['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x1d8960[_0xedbc('0x4e')][_0xedbc('0x75')]),'FaxAccountId':Number(_0x1d8960[_0xedbc('0x60')]['id'])});}});}})[_0xedbc('0x25')](respondWithStatusCode(_0x2c8fdb,null))[_0xedbc('0x2f')](handleError(_0x2c8fdb,null));};exports['getAgents']=function(_0x534628,_0x514361,_0xe5bf9e){var _0x194f8c={};var _0x4c1db4={};var _0x241e97;var _0xf713f8;return db[_0xedbc('0x48')][_0xedbc('0x71')]({'where':{'id':_0x534628['params']['id']}})[_0xedbc('0x25')](handleEntityNotFound(_0x514361,null))[_0xedbc('0x25')](function(_0x51ef9f){if(_0x51ef9f){_0x241e97=_0x51ef9f;_0x4c1db4[_0xedbc('0x4d')]=_['keys'](db['User']['rawAttributes']);_0x4c1db4['query']=_[_0xedbc('0x61')](_0x534628[_0xedbc('0x4e')]);_0x4c1db4[_0xedbc('0x4f')]=_[_0xedbc('0x50')](_0x4c1db4[_0xedbc('0x4d')],_0x4c1db4[_0xedbc('0x4e')]);_0x194f8c[_0xedbc('0x51')]=_[_0xedbc('0x50')](_0x4c1db4[_0xedbc('0x4d')],qs[_0xedbc('0x52')](_0x534628[_0xedbc('0x4e')]['fields']));_0x194f8c[_0xedbc('0x51')]=_0x194f8c[_0xedbc('0x51')][_0xedbc('0x53')]?_0x194f8c[_0xedbc('0x51')]:_0x4c1db4[_0xedbc('0x4d')];_0x194f8c[_0xedbc('0x72')]=qs['sort'](_0x534628['query'][_0xedbc('0x56')]);_0x194f8c['where']=qs['filters'](_[_0xedbc('0x58')](_0x534628['query'],_0x4c1db4['filters']));if(_0x534628[_0xedbc('0x4e')]['filter']){_0x194f8c['where']=_[_0xedbc('0x5a')](_0x194f8c[_0xedbc('0x57')],{'$or':_['map'](_0x194f8c['attributes'],function(_0x73d51b){var _0x17da28={};_0x17da28[_0x73d51b]={'$like':'%'+_0x534628[_0xedbc('0x4e')]['filter']+'%'};return _0x17da28;})});}_0x194f8c=_[_0xedbc('0x5a')]({},_0x194f8c,_0x534628['options']);return _0x241e97[_0xedbc('0xcd')](_0x194f8c);}})[_0xedbc('0x25')](function(_0x4ccfa9){if(_0x4ccfa9){_0xf713f8=_0x4ccfa9[_0xedbc('0x53')];if(!_0x534628['query'][_0xedbc('0x54')]('nolimit')){_0x194f8c[_0xedbc('0x37')]=qs[_0xedbc('0x37')](_0x534628['query']['limit']);_0x194f8c[_0xedbc('0x34')]=qs[_0xedbc('0x34')](_0x534628[_0xedbc('0x4e')][_0xedbc('0x34')]);}return _0x241e97[_0xedbc('0xcd')](_0x194f8c);}})[_0xedbc('0x25')](function(_0x346ee5){if(_0x346ee5){return _0x346ee5?{'count':_0xf713f8,'rows':_0x346ee5}:null;}})[_0xedbc('0x25')](respondWithResult(_0x514361,null))[_0xedbc('0x2f')](handleError(_0x514361,null));}; \ No newline at end of file +var _0x5937=['reject','save','update','destroy','get','FaxAccounts','sendStatus','stack','name','send','mandatoryDispositionPause','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','includeAll','include','rows','show','params','Pause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','FaxAccountId','Disposition','getDispositions','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','FaxInteraction','addInteraction','omit','getInteractions','findOne','CmContact','Contact','fullname','internal','Tag','color','tag','findAll','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','app','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','ReceiveFax','addAccountApplications','sequelize','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','CmList','List','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x21e119,_0x3e2c9c){var _0x27a6b1=function(_0x1c2222){while(--_0x1c2222){_0x21e119['push'](_0x21e119['shift']());}};_0x27a6b1(++_0x3e2c9c);}(_0x5937,0x163));var _0x7593=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5937[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x7593('0x0'));var rimraf=require(_0x7593('0x1'));var zipdir=require(_0x7593('0x2'));var jsonpatch=require(_0x7593('0x3'));var rp=require(_0x7593('0x4'));var moment=require('moment');var BPromise=require(_0x7593('0x5'));var Mustache=require('mustache');var util=require(_0x7593('0x6'));var path=require('path');var sox=require(_0x7593('0x7'));var csv=require(_0x7593('0x8'));var ejs=require(_0x7593('0x9'));var fs=require('fs');var fs_extra=require(_0x7593('0xa'));var _=require('lodash');var squel=require(_0x7593('0xb'));var crypto=require(_0x7593('0xc'));var jsforce=require(_0x7593('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7593('0xe'));var Papa=require(_0x7593('0xf'));var Redis=require(_0x7593('0x10'));var authService=require(_0x7593('0x11'));var qs=require(_0x7593('0x12'));var as=require(_0x7593('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7593('0x14'))(_0x7593('0x15'));var utils=require(_0x7593('0x16'));var config=require(_0x7593('0x17'));var licenseUtil=require(_0x7593('0x18'));var db=require(_0x7593('0x19'))['db'];config[_0x7593('0x1a')]=_['defaults'](config[_0x7593('0x1a')],{'host':_0x7593('0x1b'),'port':0x18eb});var socket=require(_0x7593('0x1c'))(new Redis(config[_0x7593('0x1a')]));require(_0x7593('0x1d'))[_0x7593('0x1e')](socket);var jayson=require(_0x7593('0x1f'));var client=jayson[_0x7593('0x20')][_0x7593('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x7593('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4961b3,_0x1fb8d2,_0x4ba31e,_0x3ce54a){return new BPromise(function(_0x24ecf5,_0x1f6d17){var _0x260752=_0x3ce54a||client;return _0x260752['request'](_0x4961b3,_0x4ba31e)[_0x7593('0x22')](function(_0x3eb169){logger[_0x7593('0x23')](_0x7593('0x24'),_0x1fb8d2,_0x7593('0x25'));logger[_0x7593('0x26')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1fb8d2,'request\x20sent',JSON[_0x7593('0x27')](_0x3eb169));if(_0x3eb169[_0x7593('0x28')]){if(_0x3eb169['error'][_0x7593('0x29')]===0x1f4){logger['error'](_0x7593('0x24'),_0x1fb8d2,_0x3eb169[_0x7593('0x28')]['message']);return _0x1f6d17(_0x3eb169['error'][_0x7593('0x2a')]);}logger[_0x7593('0x28')]('FaxAccount,\x20%s,\x20%s',_0x1fb8d2,_0x3eb169['error'][_0x7593('0x2a')]);return _0x24ecf5(_0x3eb169['error'][_0x7593('0x2a')]);}else{logger['info'](_0x7593('0x24'),_0x1fb8d2,_0x7593('0x25'));_0x24ecf5(_0x3eb169[_0x7593('0x2b')][_0x7593('0x2a')]);}})[_0x7593('0x2c')](function(_0x540ba1){logger[_0x7593('0x28')](_0x7593('0x24'),_0x1fb8d2,_0x540ba1);_0x1f6d17(_0x540ba1);});});}function respondWithStatusCode(_0x2c4333,_0x3c9173){_0x3c9173=_0x3c9173||0xcc;return function(_0x1adeae){if(_0x1adeae){return _0x2c4333['sendStatus'](_0x3c9173);}return _0x2c4333[_0x7593('0x2d')](_0x3c9173)[_0x7593('0x2e')]();};}function respondWithResult(_0x1b26d4,_0x2157d1){_0x2157d1=_0x2157d1||0xc8;return function(_0x251759){if(_0x251759){return _0x1b26d4[_0x7593('0x2d')](_0x2157d1)[_0x7593('0x2f')](_0x251759);}};}function respondWithFilteredResult(_0x3f78cb,_0x5192dd){return function(_0x258e2a){if(_0x258e2a){var _0x37e27b=typeof _0x5192dd[_0x7593('0x30')]==='undefined'&&typeof _0x5192dd['limit']===_0x7593('0x31');var _0x288bc1=_0x258e2a[_0x7593('0x32')];var _0x160e55=_0x37e27b?0x0:_0x5192dd[_0x7593('0x30')];var _0x5d270b=_0x37e27b?_0x258e2a['count']:_0x5192dd[_0x7593('0x30')]+_0x5192dd[_0x7593('0x33')];var _0x5e34bd;if(_0x5d270b>=_0x288bc1){_0x5d270b=_0x288bc1;_0x5e34bd=0xc8;}else{_0x5e34bd=0xce;}_0x3f78cb[_0x7593('0x2d')](_0x5e34bd);return _0x3f78cb[_0x7593('0x34')](_0x7593('0x35'),_0x160e55+'-'+_0x5d270b+'/'+_0x288bc1)['json'](_0x258e2a);}return null;};}function patchUpdates(_0x1e4ccf){return function(_0x53aaf2){try{jsonpatch[_0x7593('0x36')](_0x53aaf2,_0x1e4ccf,!![]);}catch(_0x40d50b){return BPromise[_0x7593('0x37')](_0x40d50b);}return _0x53aaf2[_0x7593('0x38')]();};}function saveUpdates(_0x170f78,_0x2e24d8){return function(_0x25ac1b){if(_0x25ac1b){return _0x25ac1b[_0x7593('0x39')](_0x170f78)[_0x7593('0x22')](function(_0x3d3a3c){return _0x3d3a3c;});}return null;};}function removeEntity(_0x1bb1f8,_0x15a883){return function(_0x500186){if(_0x500186){return _0x500186[_0x7593('0x3a')]()[_0x7593('0x22')](function(){var _0x353bd8=_0x500186[_0x7593('0x3b')]({'plain':!![]});var _0x2f2f2e=_0x7593('0x3c');return db['UserProfileResource'][_0x7593('0x3a')]({'where':{'type':_0x2f2f2e,'resourceId':_0x353bd8['id']}})[_0x7593('0x22')](function(){return _0x500186;});})[_0x7593('0x22')](function(){_0x1bb1f8[_0x7593('0x2d')](0xcc)[_0x7593('0x2e')]();});}};}function handleEntityNotFound(_0x542591,_0x4819bc){return function(_0x2f5218){if(!_0x2f5218){_0x542591[_0x7593('0x3d')](0x194);}return _0x2f5218;};}function handleError(_0x2cfe0f,_0x37f109){_0x37f109=_0x37f109||0x1f4;return function(_0x41ab76){logger['error'](_0x41ab76[_0x7593('0x3e')]);if(_0x41ab76[_0x7593('0x3f')]){delete _0x41ab76[_0x7593('0x3f')];}_0x2cfe0f[_0x7593('0x2d')](_0x37f109)[_0x7593('0x40')](_0x41ab76);};}exports['index']=function(_0x41b6a0,_0x50aa08){var _0x260ffe={'include':[{'model':db['Pause'],'as':_0x7593('0x41')}]},_0x1d0db6={},_0x32dbc4={'count':0x0,'rows':[]};var _0x5250f0=_[_0x7593('0x42')](db['FaxAccount'][_0x7593('0x43')],function(_0x402991){return{'name':_0x402991['fieldName'],'type':_0x402991[_0x7593('0x44')][_0x7593('0x45')]};});_0x1d0db6[_0x7593('0x46')]=_[_0x7593('0x42')](_0x5250f0,'name');_0x1d0db6[_0x7593('0x47')]=_[_0x7593('0x48')](_0x41b6a0['query']);_0x1d0db6[_0x7593('0x49')]=_[_0x7593('0x4a')](_0x1d0db6['model'],_0x1d0db6[_0x7593('0x47')]);_0x260ffe['attributes']=_[_0x7593('0x4a')](_0x1d0db6['model'],qs[_0x7593('0x4b')](_0x41b6a0['query'][_0x7593('0x4b')]));_0x260ffe[_0x7593('0x4c')]=_0x260ffe[_0x7593('0x4c')][_0x7593('0x4d')]?_0x260ffe[_0x7593('0x4c')]:_0x1d0db6[_0x7593('0x46')];if(!_0x41b6a0[_0x7593('0x47')][_0x7593('0x4e')](_0x7593('0x4f'))){_0x260ffe['limit']=qs[_0x7593('0x33')](_0x41b6a0['query']['limit']);_0x260ffe[_0x7593('0x30')]=qs[_0x7593('0x30')](_0x41b6a0['query'][_0x7593('0x30')]);}_0x260ffe[_0x7593('0x50')]=qs[_0x7593('0x51')](_0x41b6a0[_0x7593('0x47')][_0x7593('0x51')]);_0x260ffe[_0x7593('0x52')]=qs[_0x7593('0x49')](_[_0x7593('0x53')](_0x41b6a0[_0x7593('0x47')],_0x1d0db6[_0x7593('0x49')]),_0x5250f0);if(_0x41b6a0[_0x7593('0x47')][_0x7593('0x54')]){_0x260ffe[_0x7593('0x52')]=_[_0x7593('0x55')](_0x260ffe[_0x7593('0x52')],{'$or':_[_0x7593('0x42')](_0x5250f0,function(_0x9dbdbf){if(_0x9dbdbf['type']!==_0x7593('0x56')){var _0x842719={};_0x842719[_0x9dbdbf[_0x7593('0x3f')]]={'$like':'%'+_0x41b6a0['query'][_0x7593('0x54')]+'%'};return _0x842719;}})});}_0x260ffe=_[_0x7593('0x55')]({},_0x260ffe,_0x41b6a0[_0x7593('0x57')]);var _0x3ddca6={'where':_0x260ffe[_0x7593('0x52')]};return db[_0x7593('0x58')][_0x7593('0x32')](_0x3ddca6)['then'](function(_0x4f33af){_0x32dbc4[_0x7593('0x32')]=_0x4f33af;if(_0x41b6a0[_0x7593('0x47')][_0x7593('0x59')]){_0x260ffe[_0x7593('0x5a')]=[{'all':!![]}];}return db[_0x7593('0x58')]['findAll'](_0x260ffe);})[_0x7593('0x22')](function(_0x191138){_0x32dbc4[_0x7593('0x5b')]=_0x191138;return _0x32dbc4;})[_0x7593('0x22')](respondWithFilteredResult(_0x50aa08,_0x260ffe))[_0x7593('0x2c')](handleError(_0x50aa08,null));};exports[_0x7593('0x5c')]=function(_0xffe6d6,_0x3719a0){var _0x168722={'raw':![],'where':{'id':_0xffe6d6[_0x7593('0x5d')]['id']},'include':[{'model':db[_0x7593('0x5e')],'as':_0x7593('0x41')}]},_0x305746={};_0x305746['model']=_[_0x7593('0x48')](db['FaxAccount'][_0x7593('0x43')]);_0x305746[_0x7593('0x47')]=_[_0x7593('0x48')](_0xffe6d6[_0x7593('0x47')]);_0x305746[_0x7593('0x49')]=_[_0x7593('0x4a')](_0x305746[_0x7593('0x46')],_0x305746[_0x7593('0x47')]);_0x168722[_0x7593('0x4c')]=_[_0x7593('0x4a')](_0x305746[_0x7593('0x46')],qs['fields'](_0xffe6d6[_0x7593('0x47')][_0x7593('0x4b')]));_0x168722['attributes']=_0x168722[_0x7593('0x4c')]['length']?_0x168722[_0x7593('0x4c')]:_0x305746[_0x7593('0x46')];if(_0xffe6d6[_0x7593('0x47')][_0x7593('0x59')]){_0x168722[_0x7593('0x5a')]=[{'all':!![]}];}_0x168722=_['merge']({},_0x168722,_0xffe6d6['options']);return db[_0x7593('0x58')][_0x7593('0x5f')](_0x168722)['then'](handleEntityNotFound(_0x3719a0,null))[_0x7593('0x22')](respondWithResult(_0x3719a0,null))[_0x7593('0x2c')](handleError(_0x3719a0,null));};exports[_0x7593('0x60')]=function(_0x2822ea,_0x128621){return db['FaxAccount'][_0x7593('0x60')](_0x2822ea[_0x7593('0x61')],{})[_0x7593('0x22')](function(_0xcafd18){var _0xf2335=_0x2822ea[_0x7593('0x62')][_0x7593('0x3b')]({'plain':!![]});if(!_0xf2335)throw new Error(_0x7593('0x63'));if(_0xf2335[_0x7593('0x64')]===_0x7593('0x62')){var _0x286ef8=_0xcafd18[_0x7593('0x3b')]({'plain':!![]});var _0x19fd6c=_0x7593('0x3c');return db[_0x7593('0x65')][_0x7593('0x5f')]({'where':{'name':_0x19fd6c,'userProfileId':_0xf2335[_0x7593('0x66')]},'raw':!![]})['then'](function(_0x2a06f5){if(_0x2a06f5&&_0x2a06f5[_0x7593('0x67')]===0x0){return db[_0x7593('0x68')]['create']({'name':_0x286ef8[_0x7593('0x3f')],'resourceId':_0x286ef8['id'],'type':_0x2a06f5[_0x7593('0x3f')],'sectionId':_0x2a06f5['id']},{})[_0x7593('0x22')](function(){return _0xcafd18;});}else{return _0xcafd18;}})[_0x7593('0x2c')](function(_0x15f516){logger[_0x7593('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15f516);throw _0x15f516;});}return _0xcafd18;})[_0x7593('0x22')](respondWithResult(_0x128621,0xc9))[_0x7593('0x2c')](handleError(_0x128621,null));};exports[_0x7593('0x39')]=function(_0x1d5651,_0x3ff7bb){if(_0x1d5651['body']['id']){delete _0x1d5651[_0x7593('0x61')]['id'];}return db[_0x7593('0x58')][_0x7593('0x5f')]({'where':{'id':_0x1d5651[_0x7593('0x5d')]['id']},'include':[{'model':db[_0x7593('0x5e')],'as':_0x7593('0x41')}]})[_0x7593('0x22')](handleEntityNotFound(_0x3ff7bb,null))[_0x7593('0x22')](saveUpdates(_0x1d5651[_0x7593('0x61')],null))[_0x7593('0x22')](respondWithResult(_0x3ff7bb,null))[_0x7593('0x2c')](handleError(_0x3ff7bb,null));};exports[_0x7593('0x3a')]=function(_0x960b5,_0x4df170){return db[_0x7593('0x58')][_0x7593('0x5f')]({'where':{'id':_0x960b5[_0x7593('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4df170,null))[_0x7593('0x22')](removeEntity(_0x4df170,null))['catch'](handleError(_0x4df170,null));};exports[_0x7593('0x69')]=function(_0x387079,_0x4fa2a6){return db[_0x7593('0x58')][_0x7593('0x69')]()[_0x7593('0x22')](respondWithResult(_0x4fa2a6,null))[_0x7593('0x2c')](handleError(_0x4fa2a6,null));};exports[_0x7593('0x6a')]=function(_0x52e53c,_0x2e3b34,_0x1c14fd){if(_0x52e53c[_0x7593('0x61')]['id']){delete _0x52e53c[_0x7593('0x61')]['id'];}return db[_0x7593('0x58')]['find']({'where':{'id':_0x52e53c[_0x7593('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2e3b34,null))[_0x7593('0x22')](function(_0x497067){if(_0x497067){_0x52e53c[_0x7593('0x61')][_0x7593('0x6b')]=_0x497067['id'];return db[_0x7593('0x6c')][_0x7593('0x60')](_0x52e53c['body']);}})[_0x7593('0x22')](respondWithResult(_0x2e3b34,null))[_0x7593('0x2c')](handleError(_0x2e3b34,null));};exports[_0x7593('0x6d')]=function(_0x4d65b9,_0x32cc46,_0x3d6ce7){var _0x590956={'raw':![],'where':{}};var _0x598efd={};var _0x134518={'count':0x0,'rows':[]};return db[_0x7593('0x58')]['findOne']({'where':{'id':_0x4d65b9[_0x7593('0x5d')]['id']}})['then'](handleEntityNotFound(_0x32cc46,null))[_0x7593('0x22')](function(_0xb5ceb3){if(_0xb5ceb3){_0x598efd[_0x7593('0x46')]=_[_0x7593('0x48')](db[_0x7593('0x6c')][_0x7593('0x43')]);_0x598efd['query']=_[_0x7593('0x48')](_0x4d65b9[_0x7593('0x47')]);_0x598efd[_0x7593('0x49')]=_[_0x7593('0x4a')](_0x598efd[_0x7593('0x46')],_0x598efd['query']);_0x590956[_0x7593('0x4c')]=_[_0x7593('0x4a')](_0x598efd[_0x7593('0x46')],qs[_0x7593('0x4b')](_0x4d65b9[_0x7593('0x47')]['fields']));_0x590956[_0x7593('0x4c')]=_0x590956[_0x7593('0x4c')][_0x7593('0x4d')]?_0x590956[_0x7593('0x4c')]:_0x598efd['model'];if(!_0x4d65b9[_0x7593('0x47')][_0x7593('0x4e')](_0x7593('0x4f'))){_0x590956[_0x7593('0x33')]=qs['limit'](_0x4d65b9[_0x7593('0x47')][_0x7593('0x33')]);_0x590956[_0x7593('0x30')]=qs[_0x7593('0x30')](_0x4d65b9['query'][_0x7593('0x30')]);}_0x590956['order']=qs[_0x7593('0x51')](_0x4d65b9[_0x7593('0x47')][_0x7593('0x51')]);_0x590956[_0x7593('0x52')]=qs['filters'](_['pick'](_0x4d65b9[_0x7593('0x47')],_0x598efd[_0x7593('0x49')]));_0x590956[_0x7593('0x52')][_0x7593('0x6b')]=_0xb5ceb3['id'];if(_0x4d65b9[_0x7593('0x47')][_0x7593('0x54')]){_0x590956['where']=_[_0x7593('0x55')](_0x590956[_0x7593('0x52')],{'$or':_[_0x7593('0x42')](_0x590956[_0x7593('0x4c')],function(_0x20e387){var _0x7126b3={};_0x7126b3[_0x20e387]={'$like':'%'+_0x4d65b9[_0x7593('0x47')][_0x7593('0x54')]+'%'};return _0x7126b3;})});}_0x590956=_['merge']({},_0x590956,_0x4d65b9[_0x7593('0x57')]);return db['Disposition'][_0x7593('0x32')]({'where':_0x590956[_0x7593('0x52')]})[_0x7593('0x22')](function(_0xda3630){_0x134518[_0x7593('0x32')]=_0xda3630;if(_0x4d65b9[_0x7593('0x47')][_0x7593('0x59')]){_0x590956['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x590956);})['then'](function(_0x40b609){_0x134518[_0x7593('0x5b')]=_0x40b609;return _0x134518;});}})[_0x7593('0x22')](respondWithFilteredResult(_0x32cc46,_0x590956))[_0x7593('0x2c')](handleError(_0x32cc46,null));};exports[_0x7593('0x6e')]=function(_0x8f7bcc,_0x2a5fe6,_0x2b7f48){return db['FaxAccount'][_0x7593('0x5f')]({'where':{'id':_0x8f7bcc[_0x7593('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2a5fe6,null))[_0x7593('0x22')](function(_0x5431bf){if(_0x5431bf){return _0x5431bf[_0x7593('0x6e')](_0x8f7bcc['query']['ids']);}})[_0x7593('0x22')](respondWithStatusCode(_0x2a5fe6,null))[_0x7593('0x2c')](handleError(_0x2a5fe6,null));};exports[_0x7593('0x6f')]=function(_0x67f69,_0x1c31ea,_0xe67cc2){if(_0x67f69[_0x7593('0x61')]['id']){delete _0x67f69[_0x7593('0x61')]['id'];}return db[_0x7593('0x58')][_0x7593('0x5f')]({'where':{'id':_0x67f69[_0x7593('0x5d')]['id']}})[_0x7593('0x22')](handleEntityNotFound(_0x1c31ea,null))[_0x7593('0x22')](function(_0x2fe28d){if(_0x2fe28d){_0x67f69['body'][_0x7593('0x6b')]=_0x2fe28d['id'];return db[_0x7593('0x70')][_0x7593('0x60')](_0x67f69[_0x7593('0x61')]);}})['then'](respondWithResult(_0x1c31ea,null))['catch'](handleError(_0x1c31ea,null));};exports[_0x7593('0x71')]=function(_0x5acd5a,_0x4d2c07,_0x2658d8){var _0x42b806={'raw':![],'where':{}};var _0xdda214={};var _0xfd5579={'count':0x0,'rows':[]};return db[_0x7593('0x58')]['findOne']({'where':{'id':_0x5acd5a['params']['id']}})[_0x7593('0x22')](handleEntityNotFound(_0x4d2c07,null))[_0x7593('0x22')](function(_0x2ca6f1){if(_0x2ca6f1){_0xdda214[_0x7593('0x46')]=_[_0x7593('0x48')](db['CannedAnswer'][_0x7593('0x43')]);_0xdda214[_0x7593('0x47')]=_[_0x7593('0x48')](_0x5acd5a[_0x7593('0x47')]);_0xdda214[_0x7593('0x49')]=_['intersection'](_0xdda214[_0x7593('0x46')],_0xdda214[_0x7593('0x47')]);_0x42b806[_0x7593('0x4c')]=_[_0x7593('0x4a')](_0xdda214[_0x7593('0x46')],qs[_0x7593('0x4b')](_0x5acd5a[_0x7593('0x47')][_0x7593('0x4b')]));_0x42b806[_0x7593('0x4c')]=_0x42b806[_0x7593('0x4c')][_0x7593('0x4d')]?_0x42b806[_0x7593('0x4c')]:_0xdda214['model'];if(!_0x5acd5a[_0x7593('0x47')][_0x7593('0x4e')](_0x7593('0x4f'))){_0x42b806[_0x7593('0x33')]=qs[_0x7593('0x33')](_0x5acd5a[_0x7593('0x47')][_0x7593('0x33')]);_0x42b806[_0x7593('0x30')]=qs['offset'](_0x5acd5a['query'][_0x7593('0x30')]);}_0x42b806[_0x7593('0x50')]=qs[_0x7593('0x51')](_0x5acd5a[_0x7593('0x47')][_0x7593('0x51')]);_0x42b806[_0x7593('0x52')]=qs[_0x7593('0x49')](_['pick'](_0x5acd5a[_0x7593('0x47')],_0xdda214['filters']));_0x42b806[_0x7593('0x52')][_0x7593('0x6b')]=_0x2ca6f1['id'];if(_0x5acd5a[_0x7593('0x47')][_0x7593('0x54')]){_0x42b806['where']=_[_0x7593('0x55')](_0x42b806[_0x7593('0x52')],{'$or':_['map'](_0x42b806['attributes'],function(_0x4dc55b){var _0x1f4ae9={};_0x1f4ae9[_0x4dc55b]={'$like':'%'+_0x5acd5a['query'][_0x7593('0x54')]+'%'};return _0x1f4ae9;})});}_0x42b806=_['merge']({},_0x42b806,_0x5acd5a['options']);return db[_0x7593('0x70')][_0x7593('0x32')]({'where':_0x42b806[_0x7593('0x52')]})['then'](function(_0x270b17){_0xfd5579['count']=_0x270b17;if(_0x5acd5a[_0x7593('0x47')][_0x7593('0x59')]){_0x42b806['include']=[{'all':!![]}];}return db[_0x7593('0x70')]['findAll'](_0x42b806);})['then'](function(_0x27285b){_0xfd5579[_0x7593('0x5b')]=_0x27285b;return _0xfd5579;});}})[_0x7593('0x22')](respondWithFilteredResult(_0x4d2c07,_0x42b806))[_0x7593('0x2c')](handleError(_0x4d2c07,null));};exports['removeAnswers']=function(_0x47f065,_0x1b8e89,_0x3841c6){return db[_0x7593('0x58')][_0x7593('0x5f')]({'where':{'id':_0x47f065[_0x7593('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1b8e89,null))['then'](function(_0x25afaf){if(_0x25afaf){return _0x25afaf[_0x7593('0x72')](_0x47f065['query'][_0x7593('0x73')]);}})[_0x7593('0x22')](respondWithStatusCode(_0x1b8e89,null))[_0x7593('0x2c')](handleError(_0x1b8e89,null));};exports['addInteraction']=function(_0x52105f,_0x8c937,_0xe680){return db[_0x7593('0x74')][_0x7593('0x5f')]({'where':{'id':_0x52105f[_0x7593('0x5d')]['id']}})[_0x7593('0x22')](handleEntityNotFound(_0x8c937,null))[_0x7593('0x22')](function(_0x1752fd){if(_0x1752fd){return _0x1752fd[_0x7593('0x75')](_0x52105f['body'][_0x7593('0x73')],_[_0x7593('0x76')](_0x52105f[_0x7593('0x61')],[_0x7593('0x73'),'id'])||{});}})['then'](respondWithResult(_0x8c937,null))['catch'](handleError(_0x8c937,null));};exports[_0x7593('0x77')]=function(_0x52aadb,_0x3a35a2,_0x443998){var _0x4ac5a8={'raw':![],'where':{}};var _0x8c194a={};var _0x4062c1={'count':0x0,'rows':[]};return db[_0x7593('0x58')][_0x7593('0x78')]({'where':{'id':_0x52aadb[_0x7593('0x5d')]['id']}})[_0x7593('0x22')](handleEntityNotFound(_0x3a35a2,null))[_0x7593('0x22')](function(_0x37eace){if(_0x37eace){_0x8c194a['model']=_[_0x7593('0x48')](db[_0x7593('0x74')]['rawAttributes']);_0x8c194a[_0x7593('0x47')]=_['keys'](_0x52aadb[_0x7593('0x47')]);_0x8c194a[_0x7593('0x49')]=_['intersection'](_0x8c194a[_0x7593('0x46')],_0x8c194a['query']);_0x4ac5a8[_0x7593('0x4c')]=_[_0x7593('0x4a')](_0x8c194a[_0x7593('0x46')],qs['fields'](_0x52aadb[_0x7593('0x47')][_0x7593('0x4b')]));_0x4ac5a8['attributes']=_0x4ac5a8[_0x7593('0x4c')][_0x7593('0x4d')]?_0x4ac5a8['attributes']:_0x8c194a['model'];if(!_0x52aadb[_0x7593('0x47')][_0x7593('0x4e')](_0x7593('0x4f'))){_0x4ac5a8[_0x7593('0x33')]=qs[_0x7593('0x33')](_0x52aadb[_0x7593('0x47')][_0x7593('0x33')]);_0x4ac5a8['offset']=qs[_0x7593('0x30')](_0x52aadb[_0x7593('0x47')]['offset']);}_0x4ac5a8[_0x7593('0x50')]=qs[_0x7593('0x51')](_0x52aadb[_0x7593('0x47')][_0x7593('0x51')]);_0x4ac5a8[_0x7593('0x52')]=qs[_0x7593('0x49')](_[_0x7593('0x53')](_0x52aadb[_0x7593('0x47')],_0x8c194a[_0x7593('0x49')]));_0x4ac5a8[_0x7593('0x52')][_0x7593('0x6b')]=_0x37eace['id'];if(_0x52aadb['query']['filter']){_0x4ac5a8['where']=_[_0x7593('0x55')](_0x4ac5a8[_0x7593('0x52')],{'$or':_[_0x7593('0x42')](_0x4ac5a8[_0x7593('0x4c')],function(_0x4786c8){var _0x222f07={};_0x222f07[_0x4786c8]={'$like':'%'+_0x52aadb[_0x7593('0x47')][_0x7593('0x54')]+'%'};return _0x222f07;})});}_0x4ac5a8=_['merge']({},_0x4ac5a8,_0x52aadb[_0x7593('0x57')]);return db[_0x7593('0x74')][_0x7593('0x32')]({'where':_0x4ac5a8[_0x7593('0x52')]})[_0x7593('0x22')](function(_0x50338a){_0x4062c1[_0x7593('0x32')]=_0x50338a;if(_0x52aadb[_0x7593('0x47')][_0x7593('0x59')]){_0x4ac5a8[_0x7593('0x5a')]=[{'model':db[_0x7593('0x79')],'as':_0x7593('0x7a'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x7593('0x3f'),_0x7593('0x7b'),_0x7593('0x7c')],'required':![]},{'model':db[_0x7593('0x7d')],'as':'Tags','attributes':['id',_0x7593('0x3f'),_0x7593('0x7e')],'where':_0x52aadb['query']['tag']?{'id':_0x52aadb[_0x7593('0x47')][_0x7593('0x7f')]}:undefined,'required':_0x52aadb['query'][_0x7593('0x7f')]?!![]:![]}];}return db[_0x7593('0x74')][_0x7593('0x80')](_0x4ac5a8);})[_0x7593('0x22')](function(_0x2a54d1){_0x4062c1[_0x7593('0x5b')]=_0x2a54d1;return _0x4062c1;});}})[_0x7593('0x22')](respondWithFilteredResult(_0x3a35a2,_0x4ac5a8))[_0x7593('0x2c')](handleError(_0x3a35a2,null));};exports[_0x7593('0x81')]=function(_0x809b1f,_0x15f468,_0x55c136){return db[_0x7593('0x58')][_0x7593('0x78')]({'where':{'id':_0x809b1f[_0x7593('0x5d')]['id']}})[_0x7593('0x22')](handleEntityNotFound(_0x15f468,null))[_0x7593('0x22')](function(_0x25509c){if(_0x25509c){return db['sequelize'][_0x7593('0x82')](function(_0x2c911f){return db[_0x7593('0x83')][_0x7593('0x3a')]({'where':{'FaxAccountId':_0x809b1f['params']['id']},'transaction':_0x2c911f})['then'](function(_0x21cb04){var _0x18ba71=_[_0x7593('0x42')](_0x809b1f['body'],function(_0x2bab74){_0x2bab74[_0x7593('0x6b')]=_0x809b1f[_0x7593('0x5d')]['id'];return _0x2bab74;});return db[_0x7593('0x83')][_0x7593('0x84')](_0x18ba71,{'transaction':_0x2c911f});});})[_0x7593('0x22')](function(){return db['FaxApplication'][_0x7593('0x85')]({'where':{'FaxAccountId':_0x809b1f['params']['id']},'order':'priority'});});}})[_0x7593('0x22')](respondWithResult(_0x15f468,null))[_0x7593('0x2c')](handleError(_0x15f468,null));};exports[_0x7593('0x86')]=function(_0x5667ae,_0x143997,_0x30d75a){var _0x594422={};var _0x470946={};var _0x533452;var _0x51855f;return db['FaxAccount']['findOne']({'where':{'id':_0x5667ae['params']['id']}})[_0x7593('0x22')](handleEntityNotFound(_0x143997,null))[_0x7593('0x22')](function(_0x2d67e1){if(_0x2d67e1){_0x533452=_0x2d67e1;_0x470946[_0x7593('0x46')]=_[_0x7593('0x48')](db[_0x7593('0x83')][_0x7593('0x43')]);_0x470946[_0x7593('0x47')]=_[_0x7593('0x48')](_0x5667ae[_0x7593('0x47')]);_0x470946[_0x7593('0x49')]=_[_0x7593('0x4a')](_0x470946[_0x7593('0x46')],_0x470946[_0x7593('0x47')]);_0x594422[_0x7593('0x4c')]=_[_0x7593('0x4a')](_0x470946['model'],qs[_0x7593('0x4b')](_0x5667ae[_0x7593('0x47')][_0x7593('0x4b')]));_0x594422[_0x7593('0x4c')]=_0x594422[_0x7593('0x4c')]['length']?_0x594422[_0x7593('0x4c')]:_0x470946[_0x7593('0x46')];_0x594422['order']=qs[_0x7593('0x51')](_0x5667ae[_0x7593('0x47')][_0x7593('0x51')]);_0x594422[_0x7593('0x52')]=qs[_0x7593('0x49')](_[_0x7593('0x53')](_0x5667ae[_0x7593('0x47')],_0x470946[_0x7593('0x49')]));if(_0x5667ae[_0x7593('0x47')][_0x7593('0x54')]){_0x594422[_0x7593('0x52')]=_[_0x7593('0x55')](_0x594422['where'],{'$or':_['map'](_0x594422['attributes'],function(_0x423e6a){var _0x1211b4={};_0x1211b4[_0x423e6a]={'$like':'%'+_0x5667ae[_0x7593('0x47')][_0x7593('0x54')]+'%'};return _0x1211b4;})});}_0x594422=_[_0x7593('0x55')]({},_0x594422,_0x5667ae[_0x7593('0x57')]);return _0x533452['getApplications'](_0x594422);}})['then'](function(_0x4549e4){if(_0x4549e4){_0x51855f=_0x4549e4[_0x7593('0x4d')];if(!_0x5667ae[_0x7593('0x47')][_0x7593('0x4e')](_0x7593('0x4f'))){_0x594422[_0x7593('0x33')]=qs[_0x7593('0x33')](_0x5667ae[_0x7593('0x47')]['limit']);_0x594422[_0x7593('0x30')]=qs[_0x7593('0x30')](_0x5667ae['query'][_0x7593('0x30')]);}return _0x533452[_0x7593('0x86')](_0x594422);}})['then'](function(_0x54061f){if(_0x54061f){return _0x54061f?{'count':_0x51855f,'rows':_0x54061f}:null;}})['then'](respondWithResult(_0x143997,null))[_0x7593('0x2c')](handleError(_0x143997,null));};function Extension(_0x5beb93,_0x3d9a05,_0xd7b53d,_0x20ff7f){this[_0x7593('0x87')]=_0x7593('0x88');this[_0x7593('0x89')]=_0x5beb93['localstationid'];this[_0x7593('0x8a')]=_0x20ff7f;this[_0x7593('0x44')]='system';this[_0x7593('0x8b')]=_0x7593('0x8c');this['FaxAccountId']=_0x5beb93['id'];this['priority']=_0x3d9a05;this[_0x7593('0x8d')]=_0xd7b53d;}function createExtensionsReciveFax(_0x105f4a){var _0xaa9de3=0x1;var _0xa54ddf=[];_0xa54ddf['push'](new Extension(_0x105f4a,_0xaa9de3,'',_0x7593('0x8e')));_0xaa9de3+=0x1;_0xa54ddf[_0x7593('0x8f')](new Extension(_0x105f4a,_0xaa9de3,_0x7593('0x90'),'Set'));_0xaa9de3+=0x1;for(var _0x497a4b in _0x105f4a){if(_0x105f4a[_0x7593('0x4e')](_0x497a4b)&&(_0x497a4b===_0x7593('0x91')||_0x497a4b===_0x7593('0x92')||_0x497a4b===_0x7593('0x93')||_0x497a4b===_0x7593('0x94')||_0x497a4b===_0x7593('0x95')||_0x497a4b===_0x7593('0x96')||_0x497a4b===_0x7593('0x97')||_0x497a4b===_0x7593('0x98')||_0x497a4b===_0x7593('0x99'))){_0xa54ddf[_0x7593('0x8f')](new Extension(_0x105f4a,_0xaa9de3,_0x7593('0x9a')+_0x497a4b+')='+_0x105f4a[_0x497a4b],_0x7593('0x9b')));_0xaa9de3+=0x1;}}_0xa54ddf[_0x7593('0x8f')](new Extension(_0x105f4a,_0xaa9de3,'6',_0x7593('0x9c')));_0xaa9de3+=0x1;_0xa54ddf[_0x7593('0x8f')](new Extension(_0x105f4a,_0xaa9de3,'/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',_0x7593('0x9d')));_0xaa9de3=0x0;return _0xa54ddf;}exports[_0x7593('0x9e')]=function(_0x15f456,_0x1c0653,_0x135da0){var _0xf01844;return db[_0x7593('0x9f')][_0x7593('0x82')](function(_0x47d59c){return db[_0x7593('0x58')]['create'](_0x15f456[_0x7593('0x61')],{'transaction':_0x47d59c})[_0x7593('0x22')](function(_0x2f795d){_0xf01844=_0x2f795d[_0x7593('0x3b')]({'plain':!![]});return db[_0x7593('0xa0')][_0x7593('0x84')](createExtensionsReciveFax(_0xf01844),{'transaction':_0x47d59c});});})[_0x7593('0x22')](function(){return _0xf01844;})[_0x7593('0x22')](respondWithResult(_0x1c0653,null))['catch'](handleError(_0x1c0653,null));};exports[_0x7593('0xa1')]=function(_0x26471e,_0x3db202,_0x588f97){var _0x289cbf;return db[_0x7593('0x9f')][_0x7593('0x82')](function(_0x4e8d4a){return db[_0x7593('0x58')][_0x7593('0x39')](_0x26471e['body'],{'where':{'id':_0x26471e['body']['id']},'transaction':_0x4e8d4a})[_0x7593('0x22')](function(_0x514ded){return db[_0x7593('0xa0')]['destroy']({'where':{'FaxAccountId':_0x26471e[_0x7593('0x61')]['id']},'transaction':_0x4e8d4a})[_0x7593('0x22')](function(_0x37bc39){return db[_0x7593('0xa0')][_0x7593('0x84')](createExtensionsReciveFax(_[_0x7593('0x76')](_0x26471e[_0x7593('0x61')],[_0x7593('0xa2'),_0x7593('0x45'),'createdAt',_0x7593('0xa3'),_0x7593('0xa4'),_0x7593('0xa5')])),{'transaction':_0x4e8d4a});});});})[_0x7593('0x22')](function(){return db[_0x7593('0x58')][_0x7593('0xa6')](_0x26471e[_0x7593('0x61')]['id']);})[_0x7593('0x22')](respondWithResult(_0x3db202,null))[_0x7593('0x2c')](handleError(_0x3db202,null));};exports[_0x7593('0xa7')]=function(_0x1feb1d,_0x1108ba,_0x37a301){var _0x13eccc={'raw':!![],'where':{}};var _0x30cc9a={};var _0x8d3ec9={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7593('0x78')]({'where':{'id':_0x1feb1d[_0x7593('0x5d')]['id']}})[_0x7593('0x22')](handleEntityNotFound(_0x1108ba,null))['then'](function(_0x56e69d){if(_0x56e69d){_0x30cc9a['model']=_['keys'](db[_0x7593('0xa8')][_0x7593('0x43')]);_0x30cc9a[_0x7593('0x47')]=_[_0x7593('0x48')](_0x1feb1d['query']);_0x30cc9a['filters']=_[_0x7593('0x4a')](_0x30cc9a['model'],_0x30cc9a[_0x7593('0x47')]);_0x13eccc[_0x7593('0x4c')]=_[_0x7593('0x4a')](_0x30cc9a[_0x7593('0x46')],qs['fields'](_0x1feb1d[_0x7593('0x47')][_0x7593('0x4b')]));_0x13eccc['attributes']=_0x13eccc[_0x7593('0x4c')][_0x7593('0x4d')]?_0x13eccc[_0x7593('0x4c')]:_0x30cc9a[_0x7593('0x46')];if(!_0x1feb1d['query']['hasOwnProperty']('nolimit')){_0x13eccc[_0x7593('0x33')]=qs[_0x7593('0x33')](_0x1feb1d['query'][_0x7593('0x33')]);_0x13eccc[_0x7593('0x30')]=qs[_0x7593('0x30')](_0x1feb1d[_0x7593('0x47')]['offset']);}_0x13eccc[_0x7593('0x50')]=qs[_0x7593('0x51')](_0x1feb1d[_0x7593('0x47')][_0x7593('0x51')]);_0x13eccc['where']=qs[_0x7593('0x49')](_['pick'](_0x1feb1d[_0x7593('0x47')],_0x30cc9a[_0x7593('0x49')]));_0x13eccc[_0x7593('0x52')]['FaxAccountId']=_0x56e69d['id'];if(_0x1feb1d[_0x7593('0x47')][_0x7593('0x54')]){_0x13eccc[_0x7593('0x52')]=_[_0x7593('0x55')](_0x13eccc[_0x7593('0x52')],{'$or':_[_0x7593('0x42')](_0x13eccc[_0x7593('0x4c')],function(_0x5895c2){var _0x4118e0={};_0x4118e0[_0x5895c2]={'$like':'%'+_0x1feb1d[_0x7593('0x47')][_0x7593('0x54')]+'%'};return _0x4118e0;})});}if(_0x1feb1d[_0x7593('0x47')][_0x7593('0xa9')]){var _0x259c32=_0x1feb1d[_0x7593('0x47')]['$gte'][_0x7593('0xaa')](',');var _0x583fe8={};_0x583fe8[_0x259c32[0x0]]={'$gte':moment(_0x259c32[0x1])[_0x7593('0xab')]('YYYY-MM-DD\x20HH:mm:ss')};_0x13eccc['where']=_[_0x7593('0x55')](_0x13eccc[_0x7593('0x52')],_0x583fe8);}_0x13eccc=_[_0x7593('0x55')]({},_0x13eccc,_0x1feb1d[_0x7593('0x57')]);return db[_0x7593('0xa8')][_0x7593('0x32')]({'where':_0x13eccc[_0x7593('0x52')]})[_0x7593('0x22')](function(_0x3512a3){_0x8d3ec9[_0x7593('0x32')]=_0x3512a3;if(_0x1feb1d[_0x7593('0x47')]['includeAll']){_0x13eccc[_0x7593('0x5a')]=[{'all':!![]}];}return db[_0x7593('0xa8')][_0x7593('0x80')](_0x13eccc);})[_0x7593('0x22')](function(_0x5d0791){_0x8d3ec9[_0x7593('0x5b')]=_0x5d0791;return _0x8d3ec9;});}})[_0x7593('0x22')](respondWithFilteredResult(_0x1108ba,_0x13eccc))['catch'](handleError(_0x1108ba,null));};exports[_0x7593('0x40')]=function(_0x38b2b9,_0x5dab05,_0x513d1c){var _0x9785b5,_0x2db9e0={},_0x552a79;if(_0x38b2b9[_0x7593('0x61')]['to']){_0x552a79=_0x38b2b9[_0x7593('0x61')]['to'][0x0];}return db['FaxAccount'][_0x7593('0x5f')]({'where':{'id':_0x38b2b9[_0x7593('0x5d')]['id']},'include':[{'model':db[_0x7593('0xac')],'as':_0x7593('0xad'),'include':[{'model':db[_0x7593('0x79')],'as':_0x7593('0xae'),'where':{'fax':_0x552a79},'limit':0x1,'order':[['updatedAt',_0x7593('0xaf')]]}]}]})[_0x7593('0x22')](handleEntityNotFound(_0x5dab05,null))[_0x7593('0x22')](function(_0x25f300){_0x9785b5=_0x25f300;if(_0x38b2b9['body']['attachments']&&_0x38b2b9[_0x7593('0x61')][_0x7593('0xb0')][_0x7593('0x4d')]){for(var _0x365e75=0x0;_0x365e75<_0x38b2b9[_0x7593('0x61')]['attachments'][_0x7593('0x4d')];_0x365e75+=0x1){_0x38b2b9['body'][_0x7593('0xb0')][_0x365e75]={'filename':_0x38b2b9['body'][_0x7593('0xb0')][_0x365e75][_0x7593('0x3f')],'id':_0x38b2b9[_0x7593('0x61')]['attachments'][_0x365e75]['id'],'path':path[_0x7593('0xb1')](config['root'],_0x7593('0xb2'),_0x38b2b9[_0x7593('0x61')][_0x7593('0xb0')][_0x365e75][_0x7593('0xb3')])};}}return respondWithRpcPromise(_0x7593('0xb4'),_0x7593('0xb4'),{'FaxAccountId':_[_0x7593('0xb5')](_0x38b2b9[_0x7593('0x5d')]['id'])?undefined:_0x38b2b9['params']['id'],'path':_[_0x7593('0xb5')](_0x38b2b9[_0x7593('0x61')][_0x7593('0xb0')][0x0][_0x7593('0xb6')])?undefined:_0x38b2b9['body'][_0x7593('0xb0')][0x0][_0x7593('0xb6')],'fax':_[_0x7593('0xb5')](_0x38b2b9[_0x7593('0x61')]['to'][0x0])?undefined:_0x38b2b9['body']['to'][0x0]},client9002);})[_0x7593('0x22')](function(){if(_0x9785b5){if(_[_0x7593('0xb5')](_0x38b2b9[_0x7593('0x61')][_0x7593('0xb7')])){_0x38b2b9['body'][_0x7593('0xb7')]=util['format'](_0x7593('0xb8'),_0x9785b5['name'],_0x9785b5[_0x7593('0xb9')]);}if(_0x9785b5[_0x7593('0xad')]){if(_0x9785b5[_0x7593('0xad')][_0x7593('0xae')][_0x7593('0x4d')]){return _0x9785b5[_0x7593('0xad')]['Contacts'][0x0];}else{return db[_0x7593('0x79')][_0x7593('0x60')](_[_0x7593('0xba')](_0x38b2b9[_0x7593('0x61')],{'firstName':_0x38b2b9[_0x7593('0x61')]['to'][0x0],'phone':_0x38b2b9['body']['to'][0x0],'fax':_0x38b2b9[_0x7593('0x61')]['to'][0x0],'ListId':_0x9785b5[_0x7593('0xa5')]}));}}else{throw new Error(_0x7593('0xbb'));}}else{throw new Error(_0x7593('0xbc'));}})['then'](function(_0x44380c){if(_0x44380c){return db[_0x7593('0x74')][_0x7593('0x5f')]({'where':{'ContactId':_0x44380c['id'],'closed':![],'FaxAccountId':_0x9785b5['id']}})[_0x7593('0x22')](function(_0x5f33da){if(_0x5f33da){return[_0x5f33da,![]];}return db[_0x7593('0x74')][_0x7593('0x60')]({'UserId':_0x38b2b9[_0x7593('0x62')]['id'],'ContactId':_0x44380c['id'],'FaxAccountId':_0x9785b5['id'],'fax':_0x38b2b9[_0x7593('0x61')]['to'][0x0],'firstMsgDirection':_0x7593('0xbd'),'Messages':[_[_0x7593('0x55')](_0x38b2b9['body'],{'read':![],'body':_0x38b2b9['body'][_0x7593('0xb0')][0x0][_0x7593('0xbe')],'FaxAccountId':_0x9785b5['id'],'UserId':_0x38b2b9[_0x7593('0x62')]['id'],'ContactId':_0x44380c['id'],'AttachmentId':_0x38b2b9['body'][_0x7593('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0x7593('0xa8')],'as':'Messages'}]})[_0x7593('0x22')](function(_0x5841f0){return[_0x5841f0,!![]];});});}else{throw new Error(_0x7593('0xbf'));}})[_0x7593('0xc0')](function(_0xc2f455,_0xa1da9f){if(_0xa1da9f){return _0xc2f455;}return db['FaxMessage'][_0x7593('0x60')]({'direction':_0x7593('0xbd'),'read':![],'body':_0x38b2b9[_0x7593('0x61')]['attachments'][0x0][_0x7593('0xbe')],'FaxAccountId':_0x9785b5['id'],'FaxInteractionId':_0xc2f455['id'],'UserId':_0x38b2b9[_0x7593('0x62')]['id'],'ContactId':_0xc2f455[_0x7593('0xc1')],'AttachmentId':_0x38b2b9[_0x7593('0x61')][_0x7593('0xb0')][0x0]['id']})[_0x7593('0x22')](function(_0x3a68d9){_0xc2f455[_0x7593('0xc2')][_0x7593('0xc3')]=[];_0xc2f455[_0x7593('0xc2')][_0x7593('0xc3')]['push'](_0x3a68d9['dataValues']);return _0xc2f455;});})[_0x7593('0x22')](function(_0x20cad4){respondWithRpcPromise(_0x7593('0xc4'),'SendFax',{'FaxAccountId':_[_0x7593('0xb5')](_0x38b2b9[_0x7593('0x5d')]['id'])?undefined:_0x38b2b9[_0x7593('0x5d')]['id'],'path':_[_0x7593('0xb5')](_0x38b2b9[_0x7593('0x61')]['attachments'][0x0][_0x7593('0xb6')])?undefined:_0x38b2b9[_0x7593('0x61')][_0x7593('0xb0')][0x0][_0x7593('0xb6')],'fax':_['isNil'](_0x38b2b9[_0x7593('0x61')]['to'][0x0])?undefined:_0x38b2b9[_0x7593('0x61')]['to'][0x0],'AttachmentId':_0x38b2b9[_0x7593('0x61')][_0x7593('0xb0')][0x0]['id']},client9002)['then'](function(_0x2d60d4){logger[_0x7593('0x23')](_0x7593('0xc5'),_0x2d60d4);})[_0x7593('0x2c')](function(_0x222666){logger[_0x7593('0x23')](_0x7593('0xc5'),_0x222666);});return _0x20cad4;})[_0x7593('0x22')](respondWithResult(_0x5dab05,null))['catch'](handleError(_0x5dab05,null));};exports[_0x7593('0xc6')]=function(_0x259e5f,_0x4c30f5,_0x4fdb13){return db[_0x7593('0x58')][_0x7593('0x5f')]({'where':{'id':_0x259e5f['params']['id']}})[_0x7593('0x22')](handleEntityNotFound(_0x4c30f5,null))[_0x7593('0x22')](function(_0x5b2ce2){if(_0x5b2ce2){return _0x5b2ce2['addAgents'](_0x259e5f[_0x7593('0x61')][_0x7593('0x73')],_[_0x7593('0x76')](_0x259e5f['body'],[_0x7593('0x73'),'id'])||{})['spread'](function(_0x64ad23){for(var _0x340116=0x0;_0x340116<_0x259e5f[_0x7593('0x61')][_0x7593('0x73')][_0x7593('0x4d')];_0x340116+=0x1){socket[_0x7593('0xc7')](_0x7593('0xc8'),{'UserId':Number(_0x259e5f[_0x7593('0x61')][_0x7593('0x73')][_0x340116]),'FaxAccountId':Number(_0x259e5f[_0x7593('0x5d')]['id'])});}return _0x64ad23;});}})[_0x7593('0x22')](respondWithResult(_0x4c30f5,null))[_0x7593('0x2c')](handleError(_0x4c30f5,null));};exports[_0x7593('0xc9')]=function(_0x1a6616,_0xef2d45,_0x39bcac){return db[_0x7593('0x58')]['find']({'where':{'id':_0x1a6616[_0x7593('0x5d')]['id']}})[_0x7593('0x22')](handleEntityNotFound(_0xef2d45,null))[_0x7593('0x22')](function(_0x1a0d8e){if(_0x1a0d8e){return _0x1a0d8e[_0x7593('0xc9')](_0x1a6616[_0x7593('0x47')][_0x7593('0x73')])['then'](function(){if(_[_0x7593('0xca')](_0x1a6616[_0x7593('0x47')]['ids'])){for(var _0x55ca63=0x0;_0x55ca63<_0x1a6616[_0x7593('0x47')]['ids'][_0x7593('0x4d')];_0x55ca63+=0x1){socket[_0x7593('0xc7')](_0x7593('0xcb'),{'UserId':Number(_0x1a6616[_0x7593('0x47')][_0x7593('0x73')][_0x55ca63]),'FaxAccountId':Number(_0x1a6616[_0x7593('0x5d')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x1a6616[_0x7593('0x47')]['ids']),'FaxAccountId':Number(_0x1a6616[_0x7593('0x5d')]['id'])});}});}})[_0x7593('0x22')](respondWithStatusCode(_0xef2d45,null))[_0x7593('0x2c')](handleError(_0xef2d45,null));};exports['getAgents']=function(_0x59992c,_0x5741fb,_0x41cc94){var _0x2c516e={};var _0x3797a6={};var _0x469132;var _0x2e61b5;return db['FaxAccount'][_0x7593('0x78')]({'where':{'id':_0x59992c[_0x7593('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5741fb,null))[_0x7593('0x22')](function(_0x41b4ef){if(_0x41b4ef){_0x469132=_0x41b4ef;_0x3797a6['model']=_[_0x7593('0x48')](db['User'][_0x7593('0x43')]);_0x3797a6[_0x7593('0x47')]=_['keys'](_0x59992c['query']);_0x3797a6['filters']=_[_0x7593('0x4a')](_0x3797a6['model'],_0x3797a6['query']);_0x2c516e[_0x7593('0x4c')]=_[_0x7593('0x4a')](_0x3797a6[_0x7593('0x46')],qs[_0x7593('0x4b')](_0x59992c['query']['fields']));_0x2c516e['attributes']=_0x2c516e[_0x7593('0x4c')][_0x7593('0x4d')]?_0x2c516e[_0x7593('0x4c')]:_0x3797a6[_0x7593('0x46')];_0x2c516e[_0x7593('0x50')]=qs['sort'](_0x59992c[_0x7593('0x47')][_0x7593('0x51')]);_0x2c516e[_0x7593('0x52')]=qs['filters'](_[_0x7593('0x53')](_0x59992c[_0x7593('0x47')],_0x3797a6[_0x7593('0x49')]));if(_0x59992c[_0x7593('0x47')][_0x7593('0x54')]){_0x2c516e[_0x7593('0x52')]=_['merge'](_0x2c516e[_0x7593('0x52')],{'$or':_['map'](_0x2c516e['attributes'],function(_0xf753b3){var _0x40c034={};_0x40c034[_0xf753b3]={'$like':'%'+_0x59992c[_0x7593('0x47')][_0x7593('0x54')]+'%'};return _0x40c034;})});}_0x2c516e=_[_0x7593('0x55')]({},_0x2c516e,_0x59992c[_0x7593('0x57')]);return _0x469132[_0x7593('0xcc')](_0x2c516e);}})[_0x7593('0x22')](function(_0xf1d6c0){if(_0xf1d6c0){_0x2e61b5=_0xf1d6c0[_0x7593('0x4d')];if(!_0x59992c[_0x7593('0x47')][_0x7593('0x4e')](_0x7593('0x4f'))){_0x2c516e[_0x7593('0x33')]=qs['limit'](_0x59992c[_0x7593('0x47')][_0x7593('0x33')]);_0x2c516e[_0x7593('0x30')]=qs[_0x7593('0x30')](_0x59992c[_0x7593('0x47')]['offset']);}return _0x469132[_0x7593('0xcc')](_0x2c516e);}})[_0x7593('0x22')](function(_0x59d894){if(_0x59d894){return _0x59d894?{'count':_0x2e61b5,'rows':_0x59d894}:null;}})[_0x7593('0x22')](respondWithResult(_0x5741fb,null))['catch'](handleError(_0x5741fb,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 9d95079..285b103 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 _0x6f58=['FaxAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x168d1d,_0x437357){var _0xf9bc98=function(_0x421810){while(--_0x421810){_0x168d1d['push'](_0x168d1d['shift']());}};_0xf9bc98(++_0x437357);}(_0x6f58,0x1ad));var _0x86f5=function(_0x347bd7,_0x5b0875){_0x347bd7=_0x347bd7-0x0;var _0x324c41=_0x6f58[_0x347bd7];return _0x324c41;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x86f5('0x0'))['db'][_0x86f5('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x86f5('0x2')](0x0);var events={'afterCreate':_0x86f5('0x3'),'afterUpdate':_0x86f5('0x4'),'afterDestroy':_0x86f5('0x5')};function emitEvent(_0x32a877){return function(_0x23330d,_0x431478,_0x48e8bc){FaxAccountEvents['emit'](_0x32a877+':'+_0x23330d['id'],_0x23330d);FaxAccountEvents[_0x86f5('0x6')](_0x32a877,_0x23330d);_0x48e8bc(null);};}for(var e in events){if(events[_0x86f5('0x7')](e)){var event=events[e];FaxAccount[_0x86f5('0x8')](e,emitEvent(event));}}module[_0x86f5('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xf161=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','save','update'];(function(_0x549658,_0x584f60){var _0x372d09=function(_0x36f176){while(--_0x36f176){_0x549658['push'](_0x549658['shift']());}};_0x372d09(++_0x584f60);}(_0xf161,0x1d1));var _0x1f16=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xf161[_0x15c421];return _0x5e5ed5;};'use strict';var EventEmitter=require(_0x1f16('0x0'));var FaxAccount=require(_0x1f16('0x1'))['db'][_0x1f16('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1f16('0x3'),'afterUpdate':_0x1f16('0x4'),'afterDestroy':_0x1f16('0x5')};function emitEvent(_0x47bfc3){return function(_0x3b2635,_0x7b53d7,_0x30a348){FaxAccountEvents['emit'](_0x47bfc3+':'+_0x3b2635['id'],_0x3b2635);FaxAccountEvents[_0x1f16('0x6')](_0x47bfc3,_0x3b2635);_0x30a348(null);};}for(var e in events){if(events[_0x1f16('0x7')](e)){var event=events[e];FaxAccount[_0x1f16('0x8')](e,emitEvent(event));}}module[_0x1f16('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 32b7966..907cf7f 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 _0xd714=['rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xd714,0xe3));var _0x4d71=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0xd714[_0x120123];return _0x3bec4c;};'use strict';var _=require('lodash');var util=require(_0x4d71('0x0'));var logger=require(_0x4d71('0x1'))(_0x4d71('0x2'));var moment=require(_0x4d71('0x3'));var BPromise=require(_0x4d71('0x4'));var rp=require(_0x4d71('0x5'));var fs=require('fs');var path=require(_0x4d71('0x6'));var rimraf=require(_0x4d71('0x7'));var config=require('../../config/environment');var attributes=require(_0x4d71('0x8'));module[_0x4d71('0x9')]=function(_0x53fd37,_0x3c0478){return _0x53fd37[_0x4d71('0xa')](_0x4d71('0xb'),attributes,{'tableName':_0x4d71('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5825=['moment','bluebird','path','FaxAccount','fax_accounts','lodash','../../config/logger','api'];(function(_0x36ec40,_0x237c64){var _0x47ba03=function(_0x3defae){while(--_0x3defae){_0x36ec40['push'](_0x36ec40['shift']());}};_0x47ba03(++_0x237c64);}(_0x5825,0x1cd));var _0x5582=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5825[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5582('0x0'));var util=require('util');var logger=require(_0x5582('0x1'))(_0x5582('0x2'));var moment=require(_0x5582('0x3'));var BPromise=require(_0x5582('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5582('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module['exports']=function(_0x146a00,_0x300faa){return _0x146a00['define'](_0x5582('0x6'),attributes,{'tableName':_0x5582('0x7'),'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 788b23f..b2272f6 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 _0x1344=['CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','orderBy','priority','length','create','contact','find','FaxInteraction','spread','autoclose','push','unmanaged','*,*,*,*','created','ContactId','interaction','User','name','UserId','unshift','agent','waitForTheAssignedAgent','startRouting','Start','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFaxAccount','options','raw','where','limit','include','model','attributes','map','then','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','ListId','from','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account'];(function(_0x2a5f16,_0x591e59){var _0x26fa0a=function(_0x4e5612){while(--_0x4e5612){_0x2a5f16['push'](_0x2a5f16['shift']());}};_0x26fa0a(++_0x591e59);}(_0x1344,0x1cd));var _0x4134=function(_0x1e7944,_0x5a1ee7){_0x1e7944=_0x1e7944-0x0;var _0x4be825=_0x1344[_0x1e7944];return _0x4be825;};'use strict';var _=require('lodash');var util=require(_0x4134('0x0'));var moment=require('moment');var BPromise=require(_0x4134('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4134('0x2'));var db=require(_0x4134('0x3'))['db'];var utils=require(_0x4134('0x4'));var logger=require('../../config/logger')(_0x4134('0x5'));var config=require('../../config/environment');var jayson=require(_0x4134('0x6'));var client=jayson[_0x4134('0x7')]['http']({'port':0x232c});config[_0x4134('0x8')]=_[_0x4134('0x9')](config['redis'],{'host':_0x4134('0xa'),'port':0x18eb});var socket=require(_0x4134('0xb'))(new Redis(config[_0x4134('0x8')]));require(_0x4134('0xc'))[_0x4134('0xd')](socket);function respondWithRpcPromise(_0x12c587,_0x28e6a6,_0x1736de){return new BPromise(function(_0xcfaed9,_0x2ddfdd){return client['request'](_0x12c587,_0x1736de)['then'](function(_0xd1b69b){logger[_0x4134('0xe')](_0x4134('0xf'),_0x28e6a6,_0x4134('0x10'));logger[_0x4134('0x11')](_0x4134('0x12'),_0x28e6a6,_0x4134('0x10'),JSON[_0x4134('0x13')](_0xd1b69b));if(_0xd1b69b[_0x4134('0x14')]){if(_0xd1b69b[_0x4134('0x14')]['code']===0x1f4){logger['error'](_0x4134('0xf'),_0x28e6a6,_0xd1b69b[_0x4134('0x14')][_0x4134('0x15')]);return _0x2ddfdd(_0xd1b69b[_0x4134('0x14')]['message']);}logger[_0x4134('0x14')](_0x4134('0xf'),_0x28e6a6,_0xd1b69b[_0x4134('0x14')][_0x4134('0x15')]);return _0xcfaed9(_0xd1b69b[_0x4134('0x14')][_0x4134('0x15')]);}else{logger[_0x4134('0xe')](_0x4134('0xf'),_0x28e6a6,_0x4134('0x10'));_0xcfaed9(_0xd1b69b[_0x4134('0x16')][_0x4134('0x15')]);}})[_0x4134('0x17')](function(_0x21f6c5){logger[_0x4134('0x14')](_0x4134('0xf'),_0x28e6a6,_0x21f6c5);_0x2ddfdd(_0x21f6c5);});});}exports[_0x4134('0x18')]=function(_0x57d3b4){var _0x550732=this;return new Promise(function(_0x305344,_0x4b8797){return db['FaxAccount']['findAll']({'raw':_0x57d3b4[_0x4134('0x19')]?_0x57d3b4[_0x4134('0x19')][_0x4134('0x1a')]===undefined?!![]:![]:!![],'where':_0x57d3b4[_0x4134('0x19')]?_0x57d3b4[_0x4134('0x19')][_0x4134('0x1b')]||null:null,'attributes':_0x57d3b4[_0x4134('0x19')]?_0x57d3b4[_0x4134('0x19')]['attributes']||null:null,'limit':_0x57d3b4[_0x4134('0x19')]?_0x57d3b4[_0x4134('0x19')][_0x4134('0x1c')]||null:null,'include':_0x57d3b4['options']?_0x57d3b4[_0x4134('0x19')][_0x4134('0x1d')]?_['map'](_0x57d3b4['options'][_0x4134('0x1d')],function(_0xad643c){return{'model':db[_0xad643c[_0x4134('0x1e')]],'as':_0xad643c['as'],'attributes':_0xad643c[_0x4134('0x1f')],'include':_0xad643c[_0x4134('0x1d')]?_[_0x4134('0x20')](_0xad643c['include'],function(_0x472c6f){return{'model':db[_0x472c6f[_0x4134('0x1e')]],'as':_0x472c6f['as'],'attributes':_0x472c6f[_0x4134('0x1f')],'include':_0x472c6f[_0x4134('0x1d')]?_[_0x4134('0x20')](_0x472c6f['include'],function(_0x3d96e6){return{'model':db[_0x3d96e6[_0x4134('0x1e')]],'as':_0x3d96e6['as'],'attributes':_0x3d96e6['attributes']};}):[]};}):[]};}):[]:[]})[_0x4134('0x21')](function(_0x467ed5){logger[_0x4134('0xe')](_0x4134('0x18'),_0x57d3b4);logger['debug']('GetFaxAccount',_0x57d3b4,JSON[_0x4134('0x13')](_0x467ed5));_0x305344(_0x467ed5);})[_0x4134('0x17')](function(_0x293cec){logger[_0x4134('0x14')](_0x4134('0x18'),_0x293cec[_0x4134('0x15')],_0x57d3b4);_0x4b8797(_0x550732[_0x4134('0x14')](0x1f4,_0x293cec[_0x4134('0x15')]));});});};exports[_0x4134('0x22')]=function(_0x24bde3,_0x19ecc1,_0x5bc977){var _0x3f6116=this;return new Promise(function(_0x567cd5,_0x579450){var _0x11a363={'body':_0x24bde3[_0x4134('0x23')],'channel':_0x4134('0x24')};var _0x102d95=[];var _0x45d34a=[];var _0x469718={};return db[_0x4134('0x25')]['describe']()['then'](function(_0x393d80){if(!_0x393d80){throw new db[(_0x4134('0x26'))][(_0x4134('0x27'))](_0x4134('0x28'));}_0x102d95=_[_0x4134('0x29')](_['keys'](_0x393d80),[_0x4134('0x2a'),_0x4134('0x2b')]);_0x45d34a=_['difference'](_[_0x4134('0x2c')](_0x393d80),[_0x4134('0x2a'),_0x4134('0x2b'),'CompanyId',_0x4134('0x2d')]);if(_0x24bde3[_0x4134('0x23')]['id']){delete _0x24bde3['body']['id'];}if(_['isNil'](_0x24bde3[_0x4134('0x23')][_0x4134('0x2e')])){throw new db[(_0x4134('0x26'))][(_0x4134('0x27'))](_0x4134('0x2f'));}if(_[_0x4134('0x30')](_0x24bde3[_0x4134('0x23')]['body'])||_0x24bde3[_0x4134('0x23')]['body']===''){throw new db[(_0x4134('0x26'))][(_0x4134('0x27'))](_0x4134('0x31'));}if(_[_0x4134('0x30')](_0x24bde3[_0x4134('0x23')][_0x4134('0x32')])){throw new db['Sequelize']['ValidationError'](_0x4134('0x33')+_0x45d34a);}if(!_[_0x4134('0x34')](_0x45d34a,_0x24bde3[_0x4134('0x23')][_0x4134('0x32')])){throw new db[(_0x4134('0x26'))][(_0x4134('0x27'))](_0x4134('0x35')+_0x45d34a);}_0x469718[_0x24bde3[_0x4134('0x23')][_0x4134('0x32')]]=_0x24bde3[_0x4134('0x23')][_0x4134('0x2e')];})[_0x4134('0x21')](function(){return db['FaxAccount']['find']({'where':{'id':_0x24bde3[_0x4134('0x36')]['id']},'include':[{'model':db[_0x4134('0x37')],'as':_0x4134('0x38'),'include':[{'model':db['CmContact'],'as':_0x4134('0x39'),'where':_0x469718,'limit':0x1,'order':[[_0x4134('0x2b'),_0x4134('0x3a')]]}]},{'model':db[_0x4134('0x3b')],'as':_0x4134('0x3c')}]});})[_0x4134('0x21')](function(_0x4c4f4b){if(_0x4c4f4b&&_0x4c4f4b['List']){var _0x368c7e=_0x4c4f4b[_0x4134('0x3d')]({'plain':!![]});_0x11a363[_0x4134('0x36')]=_0x368c7e;_0x11a363[_0x4134('0x3e')]=_0x368c7e[_0x4134('0x3c')];_0x11a363['list']=_0x368c7e[_0x4134('0x38')];_0x11a363[_0x4134('0x3e')]=_[_0x4134('0x3f')](_0x11a363['applications'],[_0x4134('0x40')],['asc']);if(_0x11a363[_0x4134('0x36')][_0x4134('0x3c')]){delete _0x11a363[_0x4134('0x36')][_0x4134('0x3c')];}if(_0x11a363['account'][_0x4134('0x38')]&&_0x11a363[_0x4134('0x36')]['List'][_0x4134('0x39')][_0x4134('0x41')]){return _0x11a363['account'][_0x4134('0x38')][_0x4134('0x39')][0x0];}var _0x10d7b7=_['defaults'](_0x24bde3['body'],{'firstName':_0x24bde3[_0x4134('0x23')][_0x4134('0x2e')],'ListId':_0x368c7e[_0x4134('0x2d')]});_0x10d7b7[_0x24bde3[_0x4134('0x23')][_0x4134('0x32')]]=_0x24bde3[_0x4134('0x23')][_0x4134('0x2e')];return db[_0x4134('0x25')][_0x4134('0x42')](_0x10d7b7,{'fields':_0x102d95,'raw':!![]});}})[_0x4134('0x21')](function(_0x1849ca){_0x11a363[_0x4134('0x43')]=_0x1849ca;if(_0x1849ca){var _0x26a54a={'ContactId':_0x1849ca['id'],'FaxAccountId':_0x24bde3[_0x4134('0x36')]['id'],'fax':_0x1849ca['fax']};return db['FaxInteraction'][_0x4134('0x44')]({'where':{'ContactId':_0x1849ca['id'],'closed':![],'FaxAccountId':_0x24bde3['account']['id']}})[_0x4134('0x21')](function(_0x20c32f){if(_0x20c32f){return[_0x20c32f,![]];}return db[_0x4134('0x45')][_0x4134('0x42')](_0x26a54a)[_0x4134('0x21')](function(_0x3ef4e0){return[_0x3ef4e0,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x4134('0x46')](function(_0x16c937,_0x5e182a){var _0x3d9f58=_0x16c937[_0x4134('0x3d')]({'plain':!![]});if(_0x5e182a){if(_0x11a363[_0x4134('0x36')][_0x4134('0x47')]){_0x11a363[_0x4134('0x3e')][_0x4134('0x48')]({'id':0x0,'priority':_0x11a363[_0x4134('0x3e')]['length']+0x1,'app':'close','appdata':_0x4134('0x49'),'interval':_0x4134('0x4a')});}_0x3d9f58[_0x4134('0x4b')]=!![];}else{_0x3d9f58[_0x4134('0x4b')]=![];}_0x11a363['interaction']=_0x3d9f58;return db['FaxMessage'][_0x4134('0x42')]({'body':_0x24bde3[_0x4134('0x23')][_0x4134('0x23')],'FaxAccountId':_0x24bde3[_0x4134('0x36')]['id'],'FaxInteractionId':_0x16c937['id'],'direction':'in','ContactId':_0x16c937[_0x4134('0x4c')],'AttachmentId':_0x24bde3['body']['AttachmentId']});})[_0x4134('0x21')](function(_0x1d9b91){_0x11a363[_0x4134('0x15')]=_0x1d9b91;if(_0x11a363[_0x4134('0x4d')]['UserId']){return db[_0x4134('0x4e')][_0x4134('0x44')]({'attributes':['id',_0x4134('0x4f')],'where':{'id':_0x11a363[_0x4134('0x4d')][_0x4134('0x50')]}})[_0x4134('0x21')](function(_0x26551f){if(_0x26551f){_0x11a363[_0x4134('0x3e')][_0x4134('0x51')]({'id':0x0,'priority':0x0,'app':_0x4134('0x52'),'appdata':_0x26551f['name']+','+(_0x11a363[_0x4134('0x36')][_0x4134('0x53')]||0xa),'interval':_0x4134('0x4a')});}return respondWithRpcPromise('Start',_0x4134('0x54'),_0x11a363);});}return respondWithRpcPromise(_0x4134('0x55'),'startRouting',_0x11a363);})[_0x4134('0x21')](function(_0x45033e){_0x567cd5(_0x45033e);})['catch'](function(_0x560aac){_0x579450(_0x3f6116[_0x4134('0x14')](0x1f4,_0x560aac[_0x4134('0x15')]));});});}; \ No newline at end of file +var _0xc4b8=['findAll','options','raw','where','limit','include','map','model','attributes','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','keys','createdAt','updatedAt','difference','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','List','Contacts','FaxApplication','Applications','get','applications','list','orderBy','priority','length','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','User','UserId','unshift','name','Start','startRouting','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','request\x20sent','debug','error','code','FaxAccount,\x20%s,\x20%s','message','catch','GetFaxAccount','FaxAccount'];(function(_0x100246,_0x1657ac){var _0x12ed2e=function(_0x595bd5){while(--_0x595bd5){_0x100246['push'](_0x100246['shift']());}};_0x12ed2e(++_0x1657ac);}(_0xc4b8,0x98));var _0x8c4b=function(_0x3acbbb,_0x5e07bc){_0x3acbbb=_0x3acbbb-0x0;var _0x24b96e=_0xc4b8[_0x3acbbb];return _0x24b96e;};'use strict';var _=require('lodash');var util=require(_0x8c4b('0x0'));var moment=require(_0x8c4b('0x1'));var BPromise=require(_0x8c4b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c4b('0x3'));var db=require(_0x8c4b('0x4'))['db'];var utils=require(_0x8c4b('0x5'));var logger=require(_0x8c4b('0x6'))(_0x8c4b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8c4b('0x8')]['http']({'port':0x232c});config[_0x8c4b('0x9')]=_[_0x8c4b('0xa')](config[_0x8c4b('0x9')],{'host':_0x8c4b('0xb'),'port':0x18eb});var socket=require(_0x8c4b('0xc'))(new Redis(config[_0x8c4b('0x9')]));require(_0x8c4b('0xd'))[_0x8c4b('0xe')](socket);function respondWithRpcPromise(_0x33e40a,_0x53e351,_0x1042d0){return new BPromise(function(_0x27db0e,_0x5eb583){return client['request'](_0x33e40a,_0x1042d0)[_0x8c4b('0xf')](function(_0xa759ba){logger[_0x8c4b('0x10')]('FaxAccount,\x20%s,\x20%s',_0x53e351,_0x8c4b('0x11'));logger[_0x8c4b('0x12')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x53e351,_0x8c4b('0x11'),JSON['stringify'](_0xa759ba));if(_0xa759ba[_0x8c4b('0x13')]){if(_0xa759ba[_0x8c4b('0x13')][_0x8c4b('0x14')]===0x1f4){logger['error'](_0x8c4b('0x15'),_0x53e351,_0xa759ba[_0x8c4b('0x13')][_0x8c4b('0x16')]);return _0x5eb583(_0xa759ba['error'][_0x8c4b('0x16')]);}logger[_0x8c4b('0x13')]('FaxAccount,\x20%s,\x20%s',_0x53e351,_0xa759ba[_0x8c4b('0x13')][_0x8c4b('0x16')]);return _0x27db0e(_0xa759ba[_0x8c4b('0x13')]['message']);}else{logger[_0x8c4b('0x10')](_0x8c4b('0x15'),_0x53e351,_0x8c4b('0x11'));_0x27db0e(_0xa759ba['result']['message']);}})[_0x8c4b('0x17')](function(_0x58ca42){logger[_0x8c4b('0x13')]('FaxAccount,\x20%s,\x20%s',_0x53e351,_0x58ca42);_0x5eb583(_0x58ca42);});});}exports[_0x8c4b('0x18')]=function(_0x12e77f){var _0x514b3d=this;return new Promise(function(_0xbd1107,_0x14696a){return db[_0x8c4b('0x19')][_0x8c4b('0x1a')]({'raw':_0x12e77f[_0x8c4b('0x1b')]?_0x12e77f['options'][_0x8c4b('0x1c')]===undefined?!![]:![]:!![],'where':_0x12e77f[_0x8c4b('0x1b')]?_0x12e77f[_0x8c4b('0x1b')][_0x8c4b('0x1d')]||null:null,'attributes':_0x12e77f[_0x8c4b('0x1b')]?_0x12e77f['options']['attributes']||null:null,'limit':_0x12e77f['options']?_0x12e77f['options'][_0x8c4b('0x1e')]||null:null,'include':_0x12e77f[_0x8c4b('0x1b')]?_0x12e77f[_0x8c4b('0x1b')][_0x8c4b('0x1f')]?_[_0x8c4b('0x20')](_0x12e77f[_0x8c4b('0x1b')][_0x8c4b('0x1f')],function(_0x170daa){return{'model':db[_0x170daa[_0x8c4b('0x21')]],'as':_0x170daa['as'],'attributes':_0x170daa[_0x8c4b('0x22')],'include':_0x170daa[_0x8c4b('0x1f')]?_[_0x8c4b('0x20')](_0x170daa[_0x8c4b('0x1f')],function(_0x49ab2f){return{'model':db[_0x49ab2f[_0x8c4b('0x21')]],'as':_0x49ab2f['as'],'attributes':_0x49ab2f[_0x8c4b('0x22')],'include':_0x49ab2f[_0x8c4b('0x1f')]?_['map'](_0x49ab2f[_0x8c4b('0x1f')],function(_0x16920c){return{'model':db[_0x16920c[_0x8c4b('0x21')]],'as':_0x16920c['as'],'attributes':_0x16920c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x24fecc){logger[_0x8c4b('0x10')](_0x8c4b('0x18'),_0x12e77f);logger[_0x8c4b('0x12')](_0x8c4b('0x18'),_0x12e77f,JSON['stringify'](_0x24fecc));_0xbd1107(_0x24fecc);})[_0x8c4b('0x17')](function(_0x57e8c6){logger[_0x8c4b('0x13')](_0x8c4b('0x18'),_0x57e8c6[_0x8c4b('0x16')],_0x12e77f);_0x14696a(_0x514b3d['error'](0x1f4,_0x57e8c6[_0x8c4b('0x16')]));});});};exports[_0x8c4b('0x23')]=function(_0x3301ad,_0x58c42c,_0x3dc708){var _0x3fbf47=this;return new Promise(function(_0x38f963,_0x1f8548){var _0x4f365a={'body':_0x3301ad['body'],'channel':_0x8c4b('0x24')};var _0x307a16=[];var _0x2897a9=[];var _0xedbe1d={};return db[_0x8c4b('0x25')][_0x8c4b('0x26')]()[_0x8c4b('0xf')](function(_0x1e1a28){if(!_0x1e1a28){throw new db[(_0x8c4b('0x27'))][(_0x8c4b('0x28'))](_0x8c4b('0x29'));}_0x307a16=_['difference'](_[_0x8c4b('0x2a')](_0x1e1a28),[_0x8c4b('0x2b'),_0x8c4b('0x2c')]);_0x2897a9=_[_0x8c4b('0x2d')](_['keys'](_0x1e1a28),['createdAt',_0x8c4b('0x2c'),_0x8c4b('0x2e'),_0x8c4b('0x2f')]);if(_0x3301ad[_0x8c4b('0x30')]['id']){delete _0x3301ad['body']['id'];}if(_[_0x8c4b('0x31')](_0x3301ad[_0x8c4b('0x30')][_0x8c4b('0x32')])){throw new db[(_0x8c4b('0x27'))][(_0x8c4b('0x28'))](_0x8c4b('0x33'));}if(_[_0x8c4b('0x31')](_0x3301ad['body'][_0x8c4b('0x30')])||_0x3301ad[_0x8c4b('0x30')][_0x8c4b('0x30')]===''){throw new db[(_0x8c4b('0x27'))]['ValidationError'](_0x8c4b('0x34'));}if(_[_0x8c4b('0x31')](_0x3301ad[_0x8c4b('0x30')][_0x8c4b('0x35')])){throw new db[(_0x8c4b('0x27'))][(_0x8c4b('0x28'))](_0x8c4b('0x36')+_0x2897a9);}if(!_[_0x8c4b('0x37')](_0x2897a9,_0x3301ad['body'][_0x8c4b('0x35')])){throw new db['Sequelize'][(_0x8c4b('0x28'))](_0x8c4b('0x38')+_0x2897a9);}_0xedbe1d[_0x3301ad['body'][_0x8c4b('0x35')]]=_0x3301ad[_0x8c4b('0x30')][_0x8c4b('0x32')];})[_0x8c4b('0xf')](function(){return db[_0x8c4b('0x19')]['find']({'where':{'id':_0x3301ad[_0x8c4b('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0x8c4b('0x3a'),'include':[{'model':db[_0x8c4b('0x25')],'as':_0x8c4b('0x3b'),'where':_0xedbe1d,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x8c4b('0x3c')],'as':_0x8c4b('0x3d')}]});})['then'](function(_0x5770e9){if(_0x5770e9&&_0x5770e9['List']){var _0x57a2c2=_0x5770e9[_0x8c4b('0x3e')]({'plain':!![]});_0x4f365a['account']=_0x57a2c2;_0x4f365a[_0x8c4b('0x3f')]=_0x57a2c2[_0x8c4b('0x3d')];_0x4f365a[_0x8c4b('0x40')]=_0x57a2c2[_0x8c4b('0x3a')];_0x4f365a['applications']=_[_0x8c4b('0x41')](_0x4f365a[_0x8c4b('0x3f')],[_0x8c4b('0x42')],['asc']);if(_0x4f365a[_0x8c4b('0x39')][_0x8c4b('0x3d')]){delete _0x4f365a[_0x8c4b('0x39')][_0x8c4b('0x3d')];}if(_0x4f365a[_0x8c4b('0x39')][_0x8c4b('0x3a')]&&_0x4f365a['account'][_0x8c4b('0x3a')][_0x8c4b('0x3b')][_0x8c4b('0x43')]){return _0x4f365a['account'][_0x8c4b('0x3a')][_0x8c4b('0x3b')][0x0];}var _0x44ee0a=_['defaults'](_0x3301ad[_0x8c4b('0x30')],{'firstName':_0x3301ad[_0x8c4b('0x30')][_0x8c4b('0x32')],'ListId':_0x57a2c2[_0x8c4b('0x2f')]});_0x44ee0a[_0x3301ad[_0x8c4b('0x30')][_0x8c4b('0x35')]]=_0x3301ad['body']['from'];return db['CmContact'][_0x8c4b('0x44')](_0x44ee0a,{'fields':_0x307a16,'raw':!![]});}})[_0x8c4b('0xf')](function(_0x3c7fa4){_0x4f365a[_0x8c4b('0x45')]=_0x3c7fa4;if(_0x3c7fa4){var _0x559c81={'ContactId':_0x3c7fa4['id'],'FaxAccountId':_0x3301ad[_0x8c4b('0x39')]['id'],'fax':_0x3c7fa4['fax']};return db[_0x8c4b('0x46')][_0x8c4b('0x47')]({'where':{'ContactId':_0x3c7fa4['id'],'closed':![],'FaxAccountId':_0x3301ad[_0x8c4b('0x39')]['id']}})[_0x8c4b('0xf')](function(_0x55ce3e){if(_0x55ce3e){return[_0x55ce3e,![]];}return db[_0x8c4b('0x46')][_0x8c4b('0x44')](_0x559c81)['then'](function(_0xcb2033){return[_0xcb2033,!![]];});});}else{throw new Error(_0x8c4b('0x48'));}})[_0x8c4b('0x49')](function(_0x3c44e5,_0x13cce1){var _0x466126=_0x3c44e5['get']({'plain':!![]});if(_0x13cce1){if(_0x4f365a[_0x8c4b('0x39')][_0x8c4b('0x4a')]){_0x4f365a[_0x8c4b('0x3f')][_0x8c4b('0x4b')]({'id':0x0,'priority':_0x4f365a[_0x8c4b('0x3f')][_0x8c4b('0x43')]+0x1,'app':_0x8c4b('0x4c'),'appdata':'unmanaged','interval':_0x8c4b('0x4d')});}_0x466126[_0x8c4b('0x4e')]=!![];}else{_0x466126[_0x8c4b('0x4e')]=![];}_0x4f365a[_0x8c4b('0x4f')]=_0x466126;return db[_0x8c4b('0x50')]['create']({'body':_0x3301ad['body'][_0x8c4b('0x30')],'FaxAccountId':_0x3301ad[_0x8c4b('0x39')]['id'],'FaxInteractionId':_0x3c44e5['id'],'direction':'in','ContactId':_0x3c44e5[_0x8c4b('0x51')],'AttachmentId':_0x3301ad[_0x8c4b('0x30')][_0x8c4b('0x52')]});})[_0x8c4b('0xf')](function(_0x220146){_0x4f365a['message']=_0x220146;if(_0x4f365a[_0x8c4b('0x4f')]['UserId']){return db[_0x8c4b('0x53')][_0x8c4b('0x47')]({'attributes':['id','name'],'where':{'id':_0x4f365a[_0x8c4b('0x4f')][_0x8c4b('0x54')]}})[_0x8c4b('0xf')](function(_0x56dd0e){if(_0x56dd0e){_0x4f365a[_0x8c4b('0x3f')][_0x8c4b('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x56dd0e[_0x8c4b('0x56')]+','+(_0x4f365a[_0x8c4b('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0x8c4b('0x4d')});}return respondWithRpcPromise(_0x8c4b('0x57'),_0x8c4b('0x58'),_0x4f365a);});}return respondWithRpcPromise(_0x8c4b('0x57'),_0x8c4b('0x58'),_0x4f365a);})[_0x8c4b('0xf')](function(_0x78a9b3){_0x38f963(_0x78a9b3);})['catch'](function(_0x4ae111){_0x1f8548(_0x3fbf47[_0x8c4b('0x13')](0x1f4,_0x4ae111[_0x8c4b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f08dba6..5d93f00 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 _0x52df=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events','save','remove'];(function(_0x366e92,_0x1b1b86){var _0x41aa9d=function(_0x128bb7){while(--_0x128bb7){_0x366e92['push'](_0x366e92['shift']());}};_0x41aa9d(++_0x1b1b86);}(_0x52df,0x1b6));var _0xf52d=function(_0x262eb0,_0x5a84a7){_0x262eb0=_0x262eb0-0x0;var _0x37cf9f=_0x52df[_0x262eb0];return _0x37cf9f;};'use strict';var FaxAccountEvents=require(_0xf52d('0x0'));var events=[_0xf52d('0x1'),_0xf52d('0x2'),_0xf52d('0x3')];function createListener(_0xc7f05e,_0x19afa2){return function(_0x2a66fe){_0x19afa2[_0xf52d('0x4')](_0xc7f05e,_0x2a66fe);};}function removeListener(_0x510c9e,_0x4cbfbe){return function(){FaxAccountEvents[_0xf52d('0x5')](_0x510c9e,_0x4cbfbe);};}exports[_0xf52d('0x6')]=function(_0x22f914){for(var _0x3933e9=0x0,_0x43595f=events[_0xf52d('0x7')];_0x3933e9<_0x43595f;_0x3933e9++){var _0x459bcb=events[_0x3933e9];var _0x11752f=createListener(_0xf52d('0x8')+_0x459bcb,_0x22f914);FaxAccountEvents['on'](_0x459bcb,_0x11752f);}}; \ No newline at end of file +var _0xf3f3=['faxAccount:','./faxAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf3f3,0x196));var _0x3f3f=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xf3f3[_0x173441];return _0x2423a8;};'use strict';var FaxAccountEvents=require(_0x3f3f('0x0'));var events=[_0x3f3f('0x1'),_0x3f3f('0x2'),_0x3f3f('0x3')];function createListener(_0x201326,_0x5abcbd){return function(_0x193ba2){_0x5abcbd[_0x3f3f('0x4')](_0x201326,_0x193ba2);};}function removeListener(_0x52c330,_0x3a4846){return function(){FaxAccountEvents[_0x3f3f('0x5')](_0x52c330,_0x3a4846);};}exports[_0x3f3f('0x6')]=function(_0x360001){for(var _0x5748b3=0x0,_0x11e67a=events[_0x3f3f('0x7')];_0x5748b3<_0x11e67a;_0x5748b3++){var _0x5aa2a7=events[_0x5748b3];var _0x29931a=createListener(_0x3f3f('0x8')+_0x5aa2a7,_0x360001);FaxAccountEvents['on'](_0x5aa2a7,_0x29931a);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 3c1eed0..9bfa499 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(_0x3587d9,_0x3346ef){var _0x42d41c=function(_0x202d6c){while(--_0x202d6c){_0x3587d9['push'](_0x3587d9['shift']());}};_0x42d41c(++_0x3346ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var 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(_0x182f71,_0x2a9c96){var _0x18b7e6=function(_0x3aeb15){while(--_0x3aeb15){_0x182f71['push'](_0x182f71['shift']());}};_0x18b7e6(++_0x2a9c96);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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 11c3b6a..def5e48 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 _0xb12d=['INTEGER','noop','STRING','*,*,*,*','sequelize','exports'];(function(_0x51386b,_0x1f4d00){var _0x4c749d=function(_0x27f85f){while(--_0x27f85f){_0x51386b['push'](_0x51386b['shift']());}};_0x4c749d(++_0x1f4d00);}(_0xb12d,0x124));var _0xdb12=function(_0x1757f2,_0x1b09fa){_0x1757f2=_0x1757f2-0x0;var _0x5e7212=_0xb12d[_0x1757f2];return _0x5e7212;};'use strict';var Sequelize=require(_0xdb12('0x0'));module[_0xdb12('0x1')]={'priority':{'type':Sequelize[_0xdb12('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdb12('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xdb12('0x4')]},'interval':{'type':Sequelize[_0xdb12('0x4')],'defaultValue':_0xdb12('0x5')}}; \ No newline at end of file +var _0xba46=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba46,0x1db));var _0x6ba4=function(_0x43f19e,_0x3fd498){_0x43f19e=_0x43f19e-0x0;var _0x335014=_0xba46[_0x43f19e];return _0x335014;};'use strict';var Sequelize=require(_0x6ba4('0x0'));module[_0x6ba4('0x1')]={'priority':{'type':Sequelize[_0x6ba4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6ba4('0x3')],'allowNull':![],'defaultValue':_0x6ba4('0x4')},'appdata':{'type':Sequelize[_0x6ba4('0x5')]()},'description':{'type':Sequelize[_0x6ba4('0x3')]},'interval':{'type':Sequelize[_0x6ba4('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index e41216c..8ec8992 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 _0xfdc3=['count','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0x482573,_0x31a4dd){var _0x2bd0de=function(_0x32272f){while(--_0x32272f){_0x482573['push'](_0x482573['shift']());}};_0x2bd0de(++_0x31a4dd);}(_0xfdc3,0x116));var _0x3fdc=function(_0x47565e,_0x1b677e){_0x47565e=_0x47565e-0x0;var _0x115bec=_0xfdc3[_0x47565e];return _0x115bec;};'use strict';var emlformat=require(_0x3fdc('0x0'));var rimraf=require(_0x3fdc('0x1'));var zipdir=require(_0x3fdc('0x2'));var jsonpatch=require(_0x3fdc('0x3'));var rp=require('request-promise');var moment=require(_0x3fdc('0x4'));var BPromise=require(_0x3fdc('0x5'));var Mustache=require(_0x3fdc('0x6'));var util=require(_0x3fdc('0x7'));var path=require(_0x3fdc('0x8'));var sox=require(_0x3fdc('0x9'));var csv=require(_0x3fdc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fdc('0xb'));var _=require(_0x3fdc('0xc'));var squel=require(_0x3fdc('0xd'));var crypto=require(_0x3fdc('0xe'));var jsforce=require(_0x3fdc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3fdc('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3fdc('0x10'));var authService=require(_0x3fdc('0x11'));var qs=require(_0x3fdc('0x12'));var as=require(_0x3fdc('0x13'));var hardwareService=require(_0x3fdc('0x14'));var logger=require(_0x3fdc('0x15'))(_0x3fdc('0x16'));var utils=require(_0x3fdc('0x17'));var config=require(_0x3fdc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fdc('0x19'))['db'];function respondWithStatusCode(_0x277957,_0x359231){_0x359231=_0x359231||0xcc;return function(_0xc35521){if(_0xc35521){return _0x277957[_0x3fdc('0x1a')](_0x359231);}return _0x277957[_0x3fdc('0x1b')](_0x359231)['end']();};}function respondWithResult(_0x399283,_0xcd86b8){_0xcd86b8=_0xcd86b8||0xc8;return function(_0x4a8020){if(_0x4a8020){return _0x399283['status'](_0xcd86b8)[_0x3fdc('0x1c')](_0x4a8020);}};}function respondWithFilteredResult(_0x246bf4,_0x5af45e){return function(_0x2b8e9f){if(_0x2b8e9f){var _0x185ea0=typeof _0x5af45e[_0x3fdc('0x1d')]==='undefined'&&typeof _0x5af45e['limit']==='undefined';var _0x2d0d61=_0x2b8e9f[_0x3fdc('0x1e')];var _0x24dac7=_0x185ea0?0x0:_0x5af45e[_0x3fdc('0x1d')];var _0x2d8084=_0x185ea0?_0x2b8e9f['count']:_0x5af45e[_0x3fdc('0x1d')]+_0x5af45e['limit'];var _0x6a1f88;if(_0x2d8084>=_0x2d0d61){_0x2d8084=_0x2d0d61;_0x6a1f88=0xc8;}else{_0x6a1f88=0xce;}_0x246bf4[_0x3fdc('0x1b')](_0x6a1f88);return _0x246bf4[_0x3fdc('0x1f')](_0x3fdc('0x20'),_0x24dac7+'-'+_0x2d8084+'/'+_0x2d0d61)[_0x3fdc('0x1c')](_0x2b8e9f);}return null;};}function patchUpdates(_0x2240c0){return function(_0x3bc7a9){try{jsonpatch['apply'](_0x3bc7a9,_0x2240c0,!![]);}catch(_0x1c8b41){return BPromise[_0x3fdc('0x21')](_0x1c8b41);}return _0x3bc7a9[_0x3fdc('0x22')]();};}function saveUpdates(_0x45b684,_0x56ffe6){return function(_0x561e12){if(_0x561e12){return _0x561e12[_0x3fdc('0x23')](_0x45b684)[_0x3fdc('0x24')](function(_0x510c96){return _0x510c96;});}return null;};}function removeEntity(_0x385bc7,_0x1d7c70){return function(_0x3d5acd){if(_0x3d5acd){return _0x3d5acd['destroy']()[_0x3fdc('0x24')](function(){_0x385bc7['status'](0xcc)[_0x3fdc('0x25')]();});}};}function handleEntityNotFound(_0x3fa6f1,_0x548fbc){return function(_0x33be51){if(!_0x33be51){_0x3fa6f1['sendStatus'](0x194);}return _0x33be51;};}function handleError(_0x57f796,_0x430dc2){_0x430dc2=_0x430dc2||0x1f4;return function(_0x46c1af){logger[_0x3fdc('0x26')](_0x46c1af[_0x3fdc('0x27')]);if(_0x46c1af['name']){delete _0x46c1af[_0x3fdc('0x28')];}_0x57f796[_0x3fdc('0x1b')](_0x430dc2)[_0x3fdc('0x29')](_0x46c1af);};}exports[_0x3fdc('0x2a')]=function(_0x3a8bf8,_0x419128){var _0x48c758={},_0xabadc6={},_0x2c62d2={'count':0x0,'rows':[]};var _0x1b2e2a=_[_0x3fdc('0x2b')](db[_0x3fdc('0x2c')][_0x3fdc('0x2d')],function(_0x59b1e3){return{'name':_0x59b1e3[_0x3fdc('0x2e')],'type':_0x59b1e3[_0x3fdc('0x2f')][_0x3fdc('0x30')]};});_0xabadc6[_0x3fdc('0x31')]=_[_0x3fdc('0x2b')](_0x1b2e2a,_0x3fdc('0x28'));_0xabadc6['query']=_[_0x3fdc('0x32')](_0x3a8bf8[_0x3fdc('0x33')]);_0xabadc6['filters']=_[_0x3fdc('0x34')](_0xabadc6['model'],_0xabadc6[_0x3fdc('0x33')]);_0x48c758[_0x3fdc('0x35')]=_[_0x3fdc('0x34')](_0xabadc6[_0x3fdc('0x31')],qs[_0x3fdc('0x36')](_0x3a8bf8['query'][_0x3fdc('0x36')]));_0x48c758['attributes']=_0x48c758[_0x3fdc('0x35')]['length']?_0x48c758[_0x3fdc('0x35')]:_0xabadc6[_0x3fdc('0x31')];if(!_0x3a8bf8[_0x3fdc('0x33')][_0x3fdc('0x37')](_0x3fdc('0x38'))){_0x48c758[_0x3fdc('0x39')]=qs[_0x3fdc('0x39')](_0x3a8bf8[_0x3fdc('0x33')][_0x3fdc('0x39')]);_0x48c758[_0x3fdc('0x1d')]=qs[_0x3fdc('0x1d')](_0x3a8bf8['query']['offset']);}_0x48c758[_0x3fdc('0x3a')]=qs[_0x3fdc('0x3b')](_0x3a8bf8['query']['sort']);_0x48c758[_0x3fdc('0x3c')]=qs[_0x3fdc('0x3d')](_[_0x3fdc('0x3e')](_0x3a8bf8[_0x3fdc('0x33')],_0xabadc6['filters']),_0x1b2e2a);if(_0x3a8bf8[_0x3fdc('0x33')][_0x3fdc('0x3f')]){_0x48c758[_0x3fdc('0x3c')]=_[_0x3fdc('0x40')](_0x48c758[_0x3fdc('0x3c')],{'$or':_[_0x3fdc('0x2b')](_0x1b2e2a,function(_0x47d238){if(_0x47d238[_0x3fdc('0x2f')]!==_0x3fdc('0x41')){var _0x1aa58b={};_0x1aa58b[_0x47d238[_0x3fdc('0x28')]]={'$like':'%'+_0x3a8bf8[_0x3fdc('0x33')][_0x3fdc('0x3f')]+'%'};return _0x1aa58b;}})});}_0x48c758=_[_0x3fdc('0x40')]({},_0x48c758,_0x3a8bf8[_0x3fdc('0x42')]);var _0x4f0bf3={'where':_0x48c758[_0x3fdc('0x3c')]};return db[_0x3fdc('0x2c')][_0x3fdc('0x1e')](_0x4f0bf3)['then'](function(_0x5c26a6){_0x2c62d2[_0x3fdc('0x1e')]=_0x5c26a6;if(_0x3a8bf8['query'][_0x3fdc('0x43')]){_0x48c758['include']=[{'all':!![]}];}return db['FaxApplication'][_0x3fdc('0x44')](_0x48c758);})[_0x3fdc('0x24')](function(_0x1ebf9e){_0x2c62d2['rows']=_0x1ebf9e;return _0x2c62d2;})['then'](respondWithFilteredResult(_0x419128,_0x48c758))[_0x3fdc('0x45')](handleError(_0x419128,null));};exports[_0x3fdc('0x46')]=function(_0x25b197,_0x1e6fff){var _0x3ebdf9={'raw':!![],'where':{'id':_0x25b197['params']['id']}},_0x4a65e2={};_0x4a65e2[_0x3fdc('0x31')]=_['keys'](db[_0x3fdc('0x2c')][_0x3fdc('0x2d')]);_0x4a65e2[_0x3fdc('0x33')]=_[_0x3fdc('0x32')](_0x25b197[_0x3fdc('0x33')]);_0x4a65e2['filters']=_['intersection'](_0x4a65e2[_0x3fdc('0x31')],_0x4a65e2[_0x3fdc('0x33')]);_0x3ebdf9[_0x3fdc('0x35')]=_[_0x3fdc('0x34')](_0x4a65e2[_0x3fdc('0x31')],qs[_0x3fdc('0x36')](_0x25b197['query'][_0x3fdc('0x36')]));_0x3ebdf9[_0x3fdc('0x35')]=_0x3ebdf9[_0x3fdc('0x35')]['length']?_0x3ebdf9[_0x3fdc('0x35')]:_0x4a65e2[_0x3fdc('0x31')];if(_0x25b197[_0x3fdc('0x33')][_0x3fdc('0x43')]){_0x3ebdf9[_0x3fdc('0x47')]=[{'all':!![]}];}_0x3ebdf9=_[_0x3fdc('0x40')]({},_0x3ebdf9,_0x25b197[_0x3fdc('0x42')]);return db[_0x3fdc('0x2c')][_0x3fdc('0x48')](_0x3ebdf9)[_0x3fdc('0x24')](handleEntityNotFound(_0x1e6fff,null))['then'](respondWithResult(_0x1e6fff,null))[_0x3fdc('0x45')](handleError(_0x1e6fff,null));};exports[_0x3fdc('0x49')]=function(_0x8d082c,_0x17369c){return db[_0x3fdc('0x2c')][_0x3fdc('0x49')](_0x8d082c[_0x3fdc('0x4a')],{})[_0x3fdc('0x24')](respondWithResult(_0x17369c,0xc9))['catch'](handleError(_0x17369c,null));};exports[_0x3fdc('0x23')]=function(_0x18b0ed,_0x125b3d){if(_0x18b0ed[_0x3fdc('0x4a')]['id']){delete _0x18b0ed[_0x3fdc('0x4a')]['id'];}return db[_0x3fdc('0x2c')]['find']({'where':{'id':_0x18b0ed['params']['id']}})['then'](handleEntityNotFound(_0x125b3d,null))[_0x3fdc('0x24')](saveUpdates(_0x18b0ed[_0x3fdc('0x4a')],null))[_0x3fdc('0x24')](respondWithResult(_0x125b3d,null))[_0x3fdc('0x45')](handleError(_0x125b3d,null));};exports[_0x3fdc('0x4b')]=function(_0x492839,_0x2033a5){return db['FaxApplication'][_0x3fdc('0x48')]({'where':{'id':_0x492839[_0x3fdc('0x4c')]['id']}})[_0x3fdc('0x24')](handleEntityNotFound(_0x2033a5,null))[_0x3fdc('0x24')](removeEntity(_0x2033a5,null))['catch'](handleError(_0x2033a5,null));}; \ No newline at end of file +var _0x418b=['show','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','FaxApplication','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x4e4bec,_0x20f6e3){var _0x272a69=function(_0x3ac1ce){while(--_0x3ac1ce){_0x4e4bec['push'](_0x4e4bec['shift']());}};_0x272a69(++_0x20f6e3);}(_0x418b,0xe9));var _0xb418=function(_0x4b5147,_0x1371a3){_0x4b5147=_0x4b5147-0x0;var _0x3f612a=_0x418b[_0x4b5147];return _0x3f612a;};'use strict';var emlformat=require(_0xb418('0x0'));var rimraf=require(_0xb418('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb418('0x2'));var rp=require(_0xb418('0x3'));var moment=require(_0xb418('0x4'));var BPromise=require(_0xb418('0x5'));var Mustache=require(_0xb418('0x6'));var util=require(_0xb418('0x7'));var path=require(_0xb418('0x8'));var sox=require(_0xb418('0x9'));var csv=require('to-csv');var ejs=require(_0xb418('0xa'));var fs=require('fs');var fs_extra=require(_0xb418('0xb'));var _=require(_0xb418('0xc'));var squel=require(_0xb418('0xd'));var crypto=require(_0xb418('0xe'));var jsforce=require(_0xb418('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb418('0x10'));var querystring=require(_0xb418('0x11'));var Papa=require('papaparse');var Redis=require(_0xb418('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb418('0x13'));var hardwareService=require(_0xb418('0x14'));var logger=require(_0xb418('0x15'))(_0xb418('0x16'));var utils=require(_0xb418('0x17'));var config=require(_0xb418('0x18'));var licenseUtil=require(_0xb418('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16550d,_0x5e25eb){_0x5e25eb=_0x5e25eb||0xcc;return function(_0x43ecb8){if(_0x43ecb8){return _0x16550d['sendStatus'](_0x5e25eb);}return _0x16550d['status'](_0x5e25eb)[_0xb418('0x1a')]();};}function respondWithResult(_0x4581e8,_0x8f2f4){_0x8f2f4=_0x8f2f4||0xc8;return function(_0x22126e){if(_0x22126e){return _0x4581e8[_0xb418('0x1b')](_0x8f2f4)[_0xb418('0x1c')](_0x22126e);}};}function respondWithFilteredResult(_0xfe4d18,_0x18b0d8){return function(_0x1f9a12){if(_0x1f9a12){var _0xc5c70e=typeof _0x18b0d8[_0xb418('0x1d')]==='undefined'&&typeof _0x18b0d8[_0xb418('0x1e')]===_0xb418('0x1f');var _0xea790a=_0x1f9a12[_0xb418('0x20')];var _0x212ee8=_0xc5c70e?0x0:_0x18b0d8[_0xb418('0x1d')];var _0xa8a84b=_0xc5c70e?_0x1f9a12[_0xb418('0x20')]:_0x18b0d8[_0xb418('0x1d')]+_0x18b0d8['limit'];var _0x294772;if(_0xa8a84b>=_0xea790a){_0xa8a84b=_0xea790a;_0x294772=0xc8;}else{_0x294772=0xce;}_0xfe4d18['status'](_0x294772);return _0xfe4d18[_0xb418('0x21')](_0xb418('0x22'),_0x212ee8+'-'+_0xa8a84b+'/'+_0xea790a)[_0xb418('0x1c')](_0x1f9a12);}return null;};}function patchUpdates(_0x1a4535){return function(_0x2b02b5){try{jsonpatch[_0xb418('0x23')](_0x2b02b5,_0x1a4535,!![]);}catch(_0xcabc81){return BPromise[_0xb418('0x24')](_0xcabc81);}return _0x2b02b5[_0xb418('0x25')]();};}function saveUpdates(_0x2c360c,_0x36c44c){return function(_0x1816df){if(_0x1816df){return _0x1816df[_0xb418('0x26')](_0x2c360c)[_0xb418('0x27')](function(_0x2712e2){return _0x2712e2;});}return null;};}function removeEntity(_0x3eb465,_0x27dc24){return function(_0x9801c5){if(_0x9801c5){return _0x9801c5[_0xb418('0x28')]()[_0xb418('0x27')](function(){_0x3eb465['status'](0xcc)[_0xb418('0x1a')]();});}};}function handleEntityNotFound(_0x24efa2,_0x3300c1){return function(_0x4672da){if(!_0x4672da){_0x24efa2['sendStatus'](0x194);}return _0x4672da;};}function handleError(_0x41c50e,_0x4eda64){_0x4eda64=_0x4eda64||0x1f4;return function(_0x44f51b){logger['error'](_0x44f51b[_0xb418('0x29')]);if(_0x44f51b[_0xb418('0x2a')]){delete _0x44f51b['name'];}_0x41c50e['status'](_0x4eda64)[_0xb418('0x2b')](_0x44f51b);};}exports[_0xb418('0x2c')]=function(_0x4ee8f0,_0x3c480c){var _0x1901f0={},_0x19a02d={},_0x35fc27={'count':0x0,'rows':[]};var _0x52ebeb=_['map'](db[_0xb418('0x2d')][_0xb418('0x2e')],function(_0xd7eb6d){return{'name':_0xd7eb6d[_0xb418('0x2f')],'type':_0xd7eb6d['type'][_0xb418('0x30')]};});_0x19a02d[_0xb418('0x31')]=_[_0xb418('0x32')](_0x52ebeb,_0xb418('0x2a'));_0x19a02d[_0xb418('0x33')]=_[_0xb418('0x34')](_0x4ee8f0[_0xb418('0x33')]);_0x19a02d[_0xb418('0x35')]=_[_0xb418('0x36')](_0x19a02d[_0xb418('0x31')],_0x19a02d[_0xb418('0x33')]);_0x1901f0['attributes']=_['intersection'](_0x19a02d[_0xb418('0x31')],qs[_0xb418('0x37')](_0x4ee8f0[_0xb418('0x33')][_0xb418('0x37')]));_0x1901f0[_0xb418('0x38')]=_0x1901f0[_0xb418('0x38')][_0xb418('0x39')]?_0x1901f0[_0xb418('0x38')]:_0x19a02d[_0xb418('0x31')];if(!_0x4ee8f0[_0xb418('0x33')]['hasOwnProperty'](_0xb418('0x3a'))){_0x1901f0['limit']=qs['limit'](_0x4ee8f0[_0xb418('0x33')][_0xb418('0x1e')]);_0x1901f0[_0xb418('0x1d')]=qs['offset'](_0x4ee8f0[_0xb418('0x33')][_0xb418('0x1d')]);}_0x1901f0[_0xb418('0x3b')]=qs[_0xb418('0x3c')](_0x4ee8f0['query'][_0xb418('0x3c')]);_0x1901f0[_0xb418('0x3d')]=qs['filters'](_['pick'](_0x4ee8f0[_0xb418('0x33')],_0x19a02d[_0xb418('0x35')]),_0x52ebeb);if(_0x4ee8f0[_0xb418('0x33')][_0xb418('0x3e')]){_0x1901f0['where']=_[_0xb418('0x3f')](_0x1901f0[_0xb418('0x3d')],{'$or':_[_0xb418('0x32')](_0x52ebeb,function(_0x251bb5){if(_0x251bb5[_0xb418('0x40')]!==_0xb418('0x41')){var _0x1c4ed4={};_0x1c4ed4[_0x251bb5[_0xb418('0x2a')]]={'$like':'%'+_0x4ee8f0['query'][_0xb418('0x3e')]+'%'};return _0x1c4ed4;}})});}_0x1901f0=_[_0xb418('0x3f')]({},_0x1901f0,_0x4ee8f0[_0xb418('0x42')]);var _0x5bb9ab={'where':_0x1901f0[_0xb418('0x3d')]};return db[_0xb418('0x2d')][_0xb418('0x20')](_0x5bb9ab)['then'](function(_0x2be77c){_0x35fc27[_0xb418('0x20')]=_0x2be77c;if(_0x4ee8f0[_0xb418('0x33')][_0xb418('0x43')]){_0x1901f0[_0xb418('0x44')]=[{'all':!![]}];}return db[_0xb418('0x2d')][_0xb418('0x45')](_0x1901f0);})[_0xb418('0x27')](function(_0xc08207){_0x35fc27['rows']=_0xc08207;return _0x35fc27;})[_0xb418('0x27')](respondWithFilteredResult(_0x3c480c,_0x1901f0))[_0xb418('0x46')](handleError(_0x3c480c,null));};exports[_0xb418('0x47')]=function(_0x3d5baa,_0x140f1a){var _0x363643={'raw':!![],'where':{'id':_0x3d5baa['params']['id']}},_0x8a8b16={};_0x8a8b16[_0xb418('0x31')]=_[_0xb418('0x34')](db[_0xb418('0x2d')][_0xb418('0x2e')]);_0x8a8b16['query']=_[_0xb418('0x34')](_0x3d5baa[_0xb418('0x33')]);_0x8a8b16[_0xb418('0x35')]=_[_0xb418('0x36')](_0x8a8b16['model'],_0x8a8b16['query']);_0x363643[_0xb418('0x38')]=_['intersection'](_0x8a8b16[_0xb418('0x31')],qs[_0xb418('0x37')](_0x3d5baa[_0xb418('0x33')]['fields']));_0x363643[_0xb418('0x38')]=_0x363643[_0xb418('0x38')][_0xb418('0x39')]?_0x363643[_0xb418('0x38')]:_0x8a8b16[_0xb418('0x31')];if(_0x3d5baa[_0xb418('0x33')][_0xb418('0x43')]){_0x363643[_0xb418('0x44')]=[{'all':!![]}];}_0x363643=_[_0xb418('0x3f')]({},_0x363643,_0x3d5baa[_0xb418('0x42')]);return db[_0xb418('0x2d')][_0xb418('0x48')](_0x363643)['then'](handleEntityNotFound(_0x140f1a,null))['then'](respondWithResult(_0x140f1a,null))[_0xb418('0x46')](handleError(_0x140f1a,null));};exports[_0xb418('0x49')]=function(_0x5e9b6d,_0x5cb1fb){return db[_0xb418('0x2d')]['create'](_0x5e9b6d[_0xb418('0x4a')],{})[_0xb418('0x27')](respondWithResult(_0x5cb1fb,0xc9))[_0xb418('0x46')](handleError(_0x5cb1fb,null));};exports['update']=function(_0xd6d981,_0xe300f5){if(_0xd6d981[_0xb418('0x4a')]['id']){delete _0xd6d981['body']['id'];}return db[_0xb418('0x2d')][_0xb418('0x48')]({'where':{'id':_0xd6d981[_0xb418('0x4b')]['id']}})[_0xb418('0x27')](handleEntityNotFound(_0xe300f5,null))[_0xb418('0x27')](saveUpdates(_0xd6d981[_0xb418('0x4a')],null))['then'](respondWithResult(_0xe300f5,null))['catch'](handleError(_0xe300f5,null));};exports[_0xb418('0x28')]=function(_0x480c80,_0x57cf57){return db[_0xb418('0x2d')][_0xb418('0x48')]({'where':{'id':_0x480c80[_0xb418('0x4b')]['id']}})['then'](handleEntityNotFound(_0x57cf57,null))[_0xb418('0x27')](removeEntity(_0x57cf57,null))[_0xb418('0x46')](handleError(_0x57cf57,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 19e1a08..9aeaade 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 _0x2053=['api','moment','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4','lodash','util','../../config/logger'];(function(_0x536d86,_0x4ebe51){var _0xc78f4a=function(_0x21dd52){while(--_0x21dd52){_0x536d86['push'](_0x536d86['shift']());}};_0xc78f4a(++_0x4ebe51);}(_0x2053,0x17d));var _0x3205=function(_0x14fc1d,_0xfffc36){_0x14fc1d=_0x14fc1d-0x0;var _0x449f76=_0x2053[_0x14fc1d];return _0x449f76;};'use strict';var _=require(_0x3205('0x0'));var util=require(_0x3205('0x1'));var logger=require(_0x3205('0x2'))(_0x3205('0x3'));var moment=require(_0x3205('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3205('0x5'));var config=require(_0x3205('0x6'));var attributes=require(_0x3205('0x7'));module[_0x3205('0x8')]=function(_0x147f15,_0x2b28dc){return _0x147f15[_0x3205('0x9')](_0x3205('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3205('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xcdbf=['exports','define','FaxApplication','fax_applications','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x91accc,_0x3af767){var _0xd9bbc9=function(_0x2a42c2){while(--_0x2a42c2){_0x91accc['push'](_0x91accc['shift']());}};_0xd9bbc9(++_0x3af767);}(_0xcdbf,0x184));var _0xfcdb=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xcdbf[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require(_0xfcdb('0x0'));var logger=require(_0xfcdb('0x1'))('api');var moment=require(_0xfcdb('0x2'));var BPromise=require(_0xfcdb('0x3'));var rp=require(_0xfcdb('0x4'));var fs=require('fs');var path=require(_0xfcdb('0x5'));var rimraf=require(_0xfcdb('0x6'));var config=require(_0xfcdb('0x7'));var attributes=require('./faxApplication.attributes');module[_0xfcdb('0x8')]=function(_0x5194dc,_0x3dec63){return _0x5194dc[_0xfcdb('0x9')](_0xfcdb('0xa'),attributes,{'tableName':_0xfcdb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 5e4001c..b6851a6 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 _0xc44c=['../../config/logger','rpc','client','request','then','info','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication','update','body','options','raw','where','attributes','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x517049,_0x2f6c8b){var _0x3eb9a4=function(_0x5263ba){while(--_0x5263ba){_0x517049['push'](_0x517049['shift']());}};_0x3eb9a4(++_0x2f6c8b);}(_0xc44c,0x107));var _0xcc44=function(_0x2dcc33,_0x535716){_0x2dcc33=_0x2dcc33-0x0;var _0x3f5fed=_0xc44c[_0x2dcc33];return _0x3f5fed;};'use strict';var _=require(_0xcc44('0x0'));var util=require(_0xcc44('0x1'));var moment=require('moment');var BPromise=require(_0xcc44('0x2'));var rs=require(_0xcc44('0x3'));var fs=require('fs');var Redis=require(_0xcc44('0x4'));var db=require(_0xcc44('0x5'))['db'];var utils=require(_0xcc44('0x6'));var logger=require(_0xcc44('0x7'))(_0xcc44('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xcc44('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d5db9,_0x5c0e13,_0x14c6c2){return new BPromise(function(_0x1d53e9,_0x10e183){return client[_0xcc44('0xa')](_0x2d5db9,_0x14c6c2)[_0xcc44('0xb')](function(_0x246b83){logger[_0xcc44('0xc')]('FaxApplication,\x20%s,\x20%s',_0x5c0e13,_0xcc44('0xd'));logger['debug'](_0xcc44('0xe'),_0x5c0e13,_0xcc44('0xd'),JSON[_0xcc44('0xf')](_0x246b83));if(_0x246b83[_0xcc44('0x10')]){if(_0x246b83[_0xcc44('0x10')][_0xcc44('0x11')]===0x1f4){logger[_0xcc44('0x10')](_0xcc44('0x12'),_0x5c0e13,_0x246b83[_0xcc44('0x10')][_0xcc44('0x13')]);return _0x10e183(_0x246b83[_0xcc44('0x10')][_0xcc44('0x13')]);}logger[_0xcc44('0x10')](_0xcc44('0x12'),_0x5c0e13,_0x246b83[_0xcc44('0x10')][_0xcc44('0x13')]);return _0x1d53e9(_0x246b83['error']['message']);}else{logger[_0xcc44('0xc')](_0xcc44('0x12'),_0x5c0e13,_0xcc44('0xd'));_0x1d53e9(_0x246b83[_0xcc44('0x14')][_0xcc44('0x13')]);}})[_0xcc44('0x15')](function(_0x4ac38e){logger['error'](_0xcc44('0x12'),_0x5c0e13,_0x4ac38e);_0x10e183(_0x4ac38e);});});}exports['UpdateFaxApplication']=function(_0x3a5544){var _0x2e8b59=this;return new Promise(function(_0x2ea5dd,_0x8d393f){return db[_0xcc44('0x16')][_0xcc44('0x17')](_0x3a5544[_0xcc44('0x18')],{'raw':_0x3a5544[_0xcc44('0x19')]?_0x3a5544[_0xcc44('0x19')][_0xcc44('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a5544[_0xcc44('0x19')]?_0x3a5544[_0xcc44('0x19')][_0xcc44('0x1b')]||null:null,'attributes':_0x3a5544[_0xcc44('0x19')]?_0x3a5544['options'][_0xcc44('0x1c')]||null:null,'limit':_0x3a5544[_0xcc44('0x19')]?_0x3a5544[_0xcc44('0x19')]['limit']||null:null})[_0xcc44('0xb')](function(_0x23d84d){logger[_0xcc44('0xc')]('UpdateFaxApplication',_0x3a5544);logger[_0xcc44('0x1d')]('UpdateFaxApplication',_0x3a5544,JSON[_0xcc44('0xf')](_0x23d84d));_0x2ea5dd(_0x23d84d);})[_0xcc44('0x15')](function(_0x560b88){logger[_0xcc44('0x10')]('UpdateFaxApplication',_0x560b88[_0xcc44('0x13')],_0x3a5544);_0x8d393f(_0x2e8b59['error'](0x1f4,_0x560b88['message']));});});}; \ No newline at end of file +var _0xd288=['jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','stringify','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1f2b56,_0x4df540){var _0x2e832d=function(_0x10477d){while(--_0x10477d){_0x1f2b56['push'](_0x1f2b56['shift']());}};_0x2e832d(++_0x4df540);}(_0xd288,0x18f));var _0x8d28=function(_0x2990ee,_0x554c5e){_0x2990ee=_0x2990ee-0x0;var _0x380c70=_0xd288[_0x2990ee];return _0x380c70;};'use strict';var _=require('lodash');var util=require(_0x8d28('0x0'));var moment=require('moment');var BPromise=require(_0x8d28('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d28('0x2'));var db=require(_0x8d28('0x3'))['db'];var utils=require(_0x8d28('0x4'));var logger=require(_0x8d28('0x5'))('rpc');var config=require(_0x8d28('0x6'));var jayson=require(_0x8d28('0x7'));var client=jayson[_0x8d28('0x8')][_0x8d28('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd2f706,_0x1524cc,_0x3c899d){return new BPromise(function(_0x4e993d,_0x317d36){return client[_0x8d28('0xa')](_0xd2f706,_0x3c899d)[_0x8d28('0xb')](function(_0x375454){logger[_0x8d28('0xc')](_0x8d28('0xd'),_0x1524cc,_0x8d28('0xe'));logger[_0x8d28('0xf')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1524cc,'request\x20sent',JSON['stringify'](_0x375454));if(_0x375454[_0x8d28('0x10')]){if(_0x375454[_0x8d28('0x10')][_0x8d28('0x11')]===0x1f4){logger['error'](_0x8d28('0xd'),_0x1524cc,_0x375454[_0x8d28('0x10')]['message']);return _0x317d36(_0x375454[_0x8d28('0x10')][_0x8d28('0x12')]);}logger['error'](_0x8d28('0xd'),_0x1524cc,_0x375454[_0x8d28('0x10')][_0x8d28('0x12')]);return _0x4e993d(_0x375454[_0x8d28('0x10')][_0x8d28('0x12')]);}else{logger[_0x8d28('0xc')](_0x8d28('0xd'),_0x1524cc,_0x8d28('0xe'));_0x4e993d(_0x375454[_0x8d28('0x13')][_0x8d28('0x12')]);}})[_0x8d28('0x14')](function(_0x5bd457){logger[_0x8d28('0x10')](_0x8d28('0xd'),_0x1524cc,_0x5bd457);_0x317d36(_0x5bd457);});});}exports[_0x8d28('0x15')]=function(_0x1300a4){var _0x2794d5=this;return new Promise(function(_0x460437,_0x425c2d){return db[_0x8d28('0x16')][_0x8d28('0x17')](_0x1300a4['body'],{'raw':_0x1300a4[_0x8d28('0x18')]?_0x1300a4['options'][_0x8d28('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1300a4['options']?_0x1300a4['options'][_0x8d28('0x1a')]||null:null,'attributes':_0x1300a4[_0x8d28('0x18')]?_0x1300a4[_0x8d28('0x18')][_0x8d28('0x1b')]||null:null,'limit':_0x1300a4[_0x8d28('0x18')]?_0x1300a4[_0x8d28('0x18')]['limit']||null:null})[_0x8d28('0xb')](function(_0x11e48f){logger['info'](_0x8d28('0x15'),_0x1300a4);logger['debug'](_0x8d28('0x15'),_0x1300a4,JSON[_0x8d28('0x1c')](_0x11e48f));_0x460437(_0x11e48f);})[_0x8d28('0x14')](function(_0x454c94){logger[_0x8d28('0x10')](_0x8d28('0x15'),_0x454c94[_0x8d28('0x12')],_0x1300a4);_0x425c2d(_0x2794d5[_0x8d28('0x10')](0x1f4,_0x454c94[_0x8d28('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 8731587..70562e1 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 _0x9354=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','path','express'];(function(_0x406d46,_0x2f25a8){var _0x4305e2=function(_0x20474b){while(--_0x20474b){_0x406d46['push'](_0x406d46['shift']());}};_0x4305e2(++_0x2f25a8);}(_0x9354,0x96));var _0x4935=function(_0x1ebd10,_0x4914b4){_0x1ebd10=_0x1ebd10-0x0;var _0x1004d3=_0x9354[_0x1ebd10];return _0x1004d3;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['post']('/',auth[_0x4935('0x9')](),controller['create']);router[_0x4935('0xd')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xe')]);router[_0x4935('0xf')](_0x4935('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4935('0x10')]=router; \ No newline at end of file +var _0x9354=['Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports','util','path','express'];(function(_0x168d5b,_0xb436da){var _0x316557=function(_0x2e471b){while(--_0x2e471b){_0x168d5b['push'](_0x168d5b['shift']());}};_0x316557(++_0xb436da);}(_0x9354,0x96));var _0x4935=function(_0x3ed4d7,_0x3783e0){_0x3ed4d7=_0x3ed4d7-0x0;var _0x2be1a4=_0x9354[_0x3ed4d7];return _0x2be1a4;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['post']('/',auth[_0x4935('0x9')](),controller['create']);router[_0x4935('0xd')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xe')]);router[_0x4935('0xf')](_0x4935('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4935('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 5019f7b..46a6912 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 _0x7f44=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x9317f3,_0x2525a7){var _0x19717b=function(_0x50bc06){while(--_0x50bc06){_0x9317f3['push'](_0x9317f3['shift']());}};_0x19717b(++_0x2525a7);}(_0x7f44,0x1d4));var _0x47f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7f44[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x47f4('0x0'));module[_0x47f4('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x47f4('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x47f4('0x3')]},'thirdDisposition':{'type':Sequelize[_0x47f4('0x3')]},'note':{'type':Sequelize[_0x47f4('0x3')]},'read1stAt':{'type':Sequelize[_0x47f4('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x47f4('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x47f4('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x47f4('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x0fb1=['ENUM','sequelize','exports','DATE','STRING'];(function(_0xc498b3,_0x5610b4){var _0x1e2530=function(_0x5c6e08){while(--_0x5c6e08){_0xc498b3['push'](_0xc498b3['shift']());}};_0x1e2530(++_0x5610b4);}(_0x0fb1,0x1be));var _0x10fb=function(_0x4bccfa,_0x30a740){_0x4bccfa=_0x4bccfa-0x0;var _0x5f3008=_0x0fb1[_0x4bccfa];return _0x5f3008;};'use strict';var Sequelize=require(_0x10fb('0x0'));module[_0x10fb('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x10fb('0x2')]},'disposition':{'type':Sequelize[_0x10fb('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x10fb('0x3')]},'read1stAt':{'type':Sequelize[_0x10fb('0x2')]},'fax':{'type':Sequelize[_0x10fb('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x10fb('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x10fb('0x4')]('in','out'),'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 4cbd5cf..217f8cc 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 _0x1980=['fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','expr','search','sqlOperator','conditions','find','unreadMessages','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)','getFullTextValue','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','count','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','params','rawAttributes','include','options','create','describe','addMessage','FaxMessage','omit','getMessages','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','merge','findAll','rows','addTags','setTags','spread','ids','faxInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','save','update','then','destroy','error','name','Users','map','fullname','TagIds','Tags','split','push','catch','index','FaxInteraction','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','select','field','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','from','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','me.FaxInteractionId\x20=\x20i.id'];(function(_0x343912,_0x5e954c){var _0x4bf8da=function(_0x2704aa){while(--_0x2704aa){_0x343912['push'](_0x343912['shift']());}};_0x4bf8da(++_0x5e954c);}(_0x1980,0x7d));var _0x0198=function(_0x50ffc6,_0x2f303f){_0x50ffc6=_0x50ffc6-0x0;var _0x46acae=_0x1980[_0x50ffc6];return _0x46acae;};'use strict';var emlformat=require(_0x0198('0x0'));var rimraf=require(_0x0198('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0198('0x2'));var rp=require('request-promise');var moment=require(_0x0198('0x3'));var BPromise=require(_0x0198('0x4'));var Mustache=require('mustache');var util=require(_0x0198('0x5'));var path=require(_0x0198('0x6'));var sox=require(_0x0198('0x7'));var csv=require(_0x0198('0x8'));var ejs=require(_0x0198('0x9'));var fs=require('fs');var fs_extra=require(_0x0198('0xa'));var _=require(_0x0198('0xb'));var squel=require(_0x0198('0xc'));var crypto=require('crypto');var jsforce=require(_0x0198('0xd'));var deskjs=require(_0x0198('0xe'));var toCsv=require(_0x0198('0x8'));var querystring=require(_0x0198('0xf'));var Papa=require(_0x0198('0x10'));var Redis=require(_0x0198('0x11'));var authService=require(_0x0198('0x12'));var qs=require(_0x0198('0x13'));var as=require(_0x0198('0x14'));var hardwareService=require(_0x0198('0x15'));var logger=require(_0x0198('0x16'))(_0x0198('0x17'));var utils=require(_0x0198('0x18'));var config=require(_0x0198('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0198('0x1a')]=_[_0x0198('0x1b')](config[_0x0198('0x1a')],{'host':_0x0198('0x1c'),'port':0x18eb});var socket=require(_0x0198('0x1d'))(new Redis(config[_0x0198('0x1a')]));require(_0x0198('0x1e'))[_0x0198('0x1f')](socket);function respondWithStatusCode(_0x40bb6d,_0x524ba9){_0x524ba9=_0x524ba9||0xcc;return function(_0x15cca3){if(_0x15cca3){return _0x40bb6d[_0x0198('0x20')](_0x524ba9);}return _0x40bb6d[_0x0198('0x21')](_0x524ba9)[_0x0198('0x22')]();};}function respondWithResult(_0x345a6f,_0x5477eb){_0x5477eb=_0x5477eb||0xc8;return function(_0x3082e4){if(_0x3082e4){return _0x345a6f[_0x0198('0x21')](_0x5477eb)[_0x0198('0x23')](_0x3082e4);}};}function respondWithFilteredResult(_0x28db93,_0x96d83){return function(_0x31bd1c){if(_0x31bd1c){var _0x52a3db=typeof _0x96d83[_0x0198('0x24')]===_0x0198('0x25')&&typeof _0x96d83['limit']==='undefined';var _0x13a082=_0x31bd1c['count'];var _0x1750f9=_0x52a3db?0x0:_0x96d83[_0x0198('0x24')];var _0x1e8a45=_0x52a3db?_0x31bd1c['count']:_0x96d83[_0x0198('0x24')]+_0x96d83[_0x0198('0x26')];var _0x49d113;if(_0x1e8a45>=_0x13a082){_0x1e8a45=_0x13a082;_0x49d113=0xc8;}else{_0x49d113=0xce;}_0x28db93[_0x0198('0x21')](_0x49d113);return _0x28db93[_0x0198('0x27')](_0x0198('0x28'),_0x1750f9+'-'+_0x1e8a45+'/'+_0x13a082)[_0x0198('0x23')](_0x31bd1c);}return null;};}function patchUpdates(_0x3a73c1){return function(_0x1055d3){try{jsonpatch['apply'](_0x1055d3,_0x3a73c1,!![]);}catch(_0x295ad1){return BPromise['reject'](_0x295ad1);}return _0x1055d3[_0x0198('0x29')]();};}function saveUpdates(_0x1ab9c3,_0x357afd){return function(_0x39306c){if(_0x39306c){return _0x39306c[_0x0198('0x2a')](_0x1ab9c3)[_0x0198('0x2b')](function(_0x4e78cc){return _0x4e78cc;});}return null;};}function removeEntity(_0x504b90,_0x567899){return function(_0x22f32b){if(_0x22f32b){return _0x22f32b[_0x0198('0x2c')]()[_0x0198('0x2b')](function(){_0x504b90['status'](0xcc)[_0x0198('0x22')]();});}};}function handleEntityNotFound(_0x3322ce,_0x5bee9c){return function(_0x15395a){if(!_0x15395a){_0x3322ce[_0x0198('0x20')](0x194);}return _0x15395a;};}function handleError(_0x16ee59,_0x3f34f4){_0x3f34f4=_0x3f34f4||0x1f4;return function(_0x1e053c){logger[_0x0198('0x2d')](_0x1e053c['stack']);if(_0x1e053c[_0x0198('0x2e')]){delete _0x1e053c[_0x0198('0x2e')];}_0x16ee59[_0x0198('0x21')](_0x3f34f4)['send'](_0x1e053c);};}function getInteractionUsers(_0x10b872,_0x723b7c){return new BPromise(function(_0xa87d80,_0x7550db){try{if(_0x723b7c[_0x10b872['id']]){_0x10b872[_0x0198('0x2f')]=_[_0x0198('0x30')](_0x723b7c[_0x10b872['id']],function(_0x175b82){return{'id':_0x175b82['id'],'fullname':_0x175b82[_0x0198('0x31')]};});}}catch(_0x13e5a1){_0x7550db(_0x13e5a1);}_0xa87d80(_0x10b872);});}function getInteractionTags(_0x3e5dba,_0x43185f){return new BPromise(function(_0x2b867e,_0x26cb5c){try{if(_0x3e5dba[_0x0198('0x32')]){_0x3e5dba[_0x0198('0x33')]=[];_0x3e5dba[_0x0198('0x32')][_0x0198('0x34')](',')['forEach'](function(_0x204721){_0x3e5dba[_0x0198('0x33')][_0x0198('0x35')](_0x43185f[_0x204721]);});}delete _0x3e5dba[_0x0198('0x32')];}catch(_0x456154){_0x26cb5c(_0x456154);}_0x2b867e(_0x3e5dba);});}function updateFaxInteraction(_0x2f9155,_0x1cad0f,_0x3d3860){return new BPromise(function(_0x2221a2,_0x4b234e){return getInteractionUsers(_0x2f9155,_0x3d3860)[_0x0198('0x2b')](function(_0x5aff62){return getInteractionTags(_0x5aff62,_0x1cad0f);})[_0x0198('0x2b')](function(_0x3b23eb){_0x2221a2(_0x3b23eb);})[_0x0198('0x36')](function(_0xc56232){_0x4b234e(_0xc56232);});});}exports[_0x0198('0x37')]=function(_0x3ce9d4,_0x2071aa){var _0x574bfa={},_0x307e84={},_0x4794e4={'count':0x0,'rows':[]};var _0x49c685=_[_0x0198('0x30')](db[_0x0198('0x38')]['rawAttributes'],function(_0x35ef7a){return{'name':_0x35ef7a[_0x0198('0x39')],'type':_0x35ef7a[_0x0198('0x3a')][_0x0198('0x3b')]};});_0x307e84[_0x0198('0x3c')]=_['map'](_0x49c685,_0x0198('0x2e'));_0x307e84['query']=_[_0x0198('0x3d')](_0x3ce9d4[_0x0198('0x3e')]);_0x307e84[_0x0198('0x3f')]=_[_0x0198('0x40')](_0x307e84[_0x0198('0x3c')],_0x307e84[_0x0198('0x3e')]);_0x574bfa[_0x0198('0x41')]=_[_0x0198('0x40')](_0x307e84[_0x0198('0x3c')],qs[_0x0198('0x42')](_0x3ce9d4[_0x0198('0x3e')][_0x0198('0x42')]));_0x574bfa[_0x0198('0x41')]=_0x574bfa[_0x0198('0x41')][_0x0198('0x43')]?_0x574bfa[_0x0198('0x41')]:_0x307e84[_0x0198('0x3c')];if(!_0x3ce9d4[_0x0198('0x3e')]['hasOwnProperty'](_0x0198('0x44'))){_0x574bfa[_0x0198('0x26')]=qs[_0x0198('0x26')](_0x3ce9d4[_0x0198('0x3e')][_0x0198('0x26')]);_0x574bfa[_0x0198('0x24')]=qs[_0x0198('0x24')](_0x3ce9d4['query'][_0x0198('0x24')]);}_0x574bfa[_0x0198('0x45')]=qs[_0x0198('0x46')](_0x3ce9d4['query'][_0x0198('0x46')]);_0x574bfa[_0x0198('0x47')]=qs[_0x0198('0x3f')](_[_0x0198('0x48')](_0x3ce9d4['query'],_0x307e84[_0x0198('0x3f')]),_0x49c685);var _0xab64e0=[];var _0xd5867=squel[_0x0198('0x49')]()[_0x0198('0x4a')]('id')[_0x0198('0x4a')](_0x0198('0x2e'))['field']('color')['from']('tools_tags');var _0x41ab8f=squel[_0x0198('0x49')]()[_0x0198('0x4a')](_0x0198('0x4b'))[_0x0198('0x4a')](_0x0198('0x4c'))['field'](_0x0198('0x4d'))['from'](_0x0198('0x4e'),'ui')[_0x0198('0x4f')]('users','u',_0x0198('0x50'));var _0x2515af=squel[_0x0198('0x49')]()[_0x0198('0x51')]('fax_interactions','i')[_0x0198('0x4f')](_0x0198('0x52'),'c',_0x0198('0x53'))[_0x0198('0x4f')]('users','o',_0x0198('0x54'))[_0x0198('0x4f')](_0x0198('0x55'),'a','a.id\x20=\x20i.FaxAccountId')[_0x0198('0x4f')](_0x0198('0x56'),'me',_0x0198('0x57'))['left_join'](_0x0198('0x58'),'it',_0x0198('0x59'))[_0x0198('0x4f')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1f9342=squel[_0x0198('0x5a')]();var _0x144607=[];var _0x543e3e=squel[_0x0198('0x5a')]();var _0x767745;if(_0x3ce9d4[_0x0198('0x3e')][_0x0198('0x5b')]){_0x767745=as['parseSearch'](_0x3ce9d4[_0x0198('0x3e')][_0x0198('0x5b')]);var _0x4c5a26=_0x767745[_0x0198('0x5c')];for(var _0x1b7d8b=0x0;_0x1b7d8b<_0x767745['conditions'][_0x0198('0x43')];_0x1b7d8b++){var _0x48fead=_0x767745[_0x0198('0x5d')][_0x1b7d8b];var _0x13359d='i';var _0x548b25=_[_0x0198('0x5e')](_0x49c685,[_0x0198('0x2e'),_0x48fead[_0x0198('0x4a')]]);if(!_0x548b25){switch(_0x48fead[_0x0198('0x4a')]){case _0x0198('0x5f'):if(_0x48fead[_0x0198('0x60')]==0x1){_0x2515af[_0x0198('0x61')]('`'+_0x48fead['field']+'`\x20=\x200');}else{_0x2515af[_0x0198('0x61')]('`'+_0x48fead[_0x0198('0x4a')]+_0x0198('0x62'));}break;case _0x0198('0x63'):if(_0x48fead[_0x0198('0x64')]===_0x0198('0x65')){if(_0x48fead[_0x0198('0x60')]['split']('\x20')[_0x0198('0x43')]>0x1){_0x1f9342[_0x4c5a26](_0x0198('0x66'),qs[_0x0198('0x67')](_0x48fead['value']),null);}else{var _0x4dba1d='%'+_0x48fead['value']+'%';_0x1f9342[_0x4c5a26]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4dba1d,_0x4dba1d,_0x4dba1d);}}else{_0x548b25=_['find'](_0x49c685,[_0x0198('0x2e'),_0x0198('0x68')]);_0x48fead[_0x0198('0x4a')]=_0x0198('0x68');_0x207c0d=as[_0x0198('0x69')](_0x13359d,_0x548b25[_0x0198('0x3a')],_0x48fead);_0x1f9342[_0x4c5a26](_0x207c0d[_0x0198('0x6a')],_0x207c0d[_0x0198('0x60')][_0x0198('0x6b')],_0x207c0d[_0x0198('0x60')]['end']);}break;case _0x0198('0x6c'):var _0x2a98df=_0x48fead[_0x0198('0x60')][_0x0198('0x34')](',')[_0x0198('0x30')](function(_0x165e1a){return Number(_0x165e1a);});_0x2a98df[_0x0198('0x6d')](function(_0x3b3bf0){_0x543e3e['or'](_0x0198('0x6e'),'%,'+_0x3b3bf0+',%');});_0x144607=_[_0x0198('0x6f')](_0x144607,_0x2a98df);break;case'User':if(_0x48fead[_0x0198('0x64')]===_0x0198('0x65')){_0x1f9342[_0x4c5a26](_0x0198('0x70'),'%'+_0x48fead['value']+'%',null);}else{_0x548b25=_[_0x0198('0x5e')](_0x49c685,['name',_0x0198('0x71')]);_0x48fead[_0x0198('0x4a')]=_0x0198('0x71');_0x207c0d=as[_0x0198('0x69')](_0x13359d,_0x548b25['type'],_0x48fead);_0x1f9342[_0x4c5a26](_0x207c0d[_0x0198('0x6a')],_0x207c0d['value'][_0x0198('0x6b')],_0x207c0d['value'][_0x0198('0x22')]);}break;case _0x0198('0x72'):_0x207c0d=as[_0x0198('0x69')]('me',null,_0x48fead);_0x1f9342[_0x4c5a26](_0x207c0d[_0x0198('0x6a')],_0x207c0d[_0x0198('0x60')][_0x0198('0x6b')],_0x207c0d['value'][_0x0198('0x22')]);break;}}else{var _0x207c0d=as[_0x0198('0x69')](_0x13359d,_0x548b25[_0x0198('0x3a')],_0x48fead);_0x1f9342[_0x4c5a26](_0x207c0d['text'],_0x207c0d['value'][_0x0198('0x6b')],_0x207c0d['value'][_0x0198('0x22')]);}}}else{var _0x40cf1b=_(_0x3ce9d4[_0x0198('0x3e')])[_0x0198('0x3d')]()[_0x0198('0x30')](function(_0x3a3093){return _[_0x0198('0x73')](_0x49c685,['name',_0x3a3093])?_0x3a3093:undefined;})[_0x0198('0x74')]()[_0x0198('0x60')]();if(!_[_0x0198('0x75')](_0x40cf1b)){_0x40cf1b[_0x0198('0x6d')](function(_0x23ee9b){if(_0x23ee9b===_0x0198('0x76')){_0x2515af[_0x0198('0x47')](_0x0198('0x77'),[]['concat'](_0x3ce9d4['query'][_0x23ee9b]));}else if(_0x23ee9b===_0x0198('0x78')){var _0x1607c4=JSON['parse'](_0x3ce9d4[_0x0198('0x3e')][_0x23ee9b])[_0x0198('0x79')];var _0x8131b8=JSON[_0x0198('0x7a')](_0x3ce9d4[_0x0198('0x3e')][_0x23ee9b])[_0x0198('0x7b')];_0x2515af['where'](_0x0198('0x7c'),_0x1607c4,_0x8131b8);}else{if(_0x3ce9d4['query'][_0x23ee9b]===_0x0198('0x7d')){_0x2515af[_0x0198('0x47')]('i.'+_0x23ee9b+'\x20IS\x20NULL');}else{_0x2515af['where']('i.'+_0x23ee9b+_0x0198('0x7e'),_0x3ce9d4[_0x0198('0x3e')][_0x23ee9b]);}}});}if(_0x3ce9d4[_0x0198('0x3e')]['read']){if(_0x3ce9d4['query'][_0x0198('0x7f')]==0x1){_0x2515af[_0x0198('0x61')]('`unreadMessages`\x20=\x200');}else{_0x2515af[_0x0198('0x61')](_0x0198('0x80'));}}if(_0x3ce9d4[_0x0198('0x3e')]['tag']){_0x144607=_['isArray'](_0x3ce9d4[_0x0198('0x3e')][_0x0198('0x81')])?_0x3ce9d4['query'][_0x0198('0x81')]:new Array(_0x3ce9d4[_0x0198('0x3e')][_0x0198('0x81')]);_0x144607[_0x0198('0x6d')](function(_0x677c64){_0x543e3e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x677c64+',%');});}if(_0x3ce9d4[_0x0198('0x3e')]['filter']){var _0x3a7e20=_0x3ce9d4[_0x0198('0x3e')][_0x0198('0x82')][_0x0198('0x83')]('\x5c','\x5c\x5c')[_0x0198('0x83')](/'/g,'\x27\x27');if(qs[_0x0198('0x84')](_0x3a7e20)){_0x1f9342['or']('i.id\x20LIKE\x20?',_0x3a7e20+'%')['or'](_0x0198('0x85'),_0x3a7e20+'%');}_0x1f9342['or'](_0x0198('0x86'),_0x3a7e20+'%');}}_0x2515af[_0x0198('0x47')](_0x1f9342);_0x2515af[_0x0198('0x87')]('i.id');var _0x116696={'type':db[_0x0198('0x88')][_0x0198('0x89')]['SELECT'],'raw':!![]};var _0x4923ea=_0x2515af[_0x0198('0x8a')]();_0x4923ea[_0x0198('0x4a')](_0x0198('0x8b'));_0x4923ea[_0x0198('0x4a')](_0x0198('0x8c'),_0x0198('0x5f'));if(_0x574bfa[_0x0198('0x45')]){_0x574bfa['order'][_0x0198('0x6d')](function(_0x13cdaa){var _0x276ad1=_0x13cdaa[0x0]===_0x0198('0x8d')?_0x13cdaa[0x0]:'i.'+_0x13cdaa[0x0];_0x2515af[_0x0198('0x45')](_0x276ad1,_0x13cdaa[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0198('0x75')](_0x144607)){_0x2515af[_0x0198('0x61')](_0x543e3e);_0x4923ea[_0x0198('0x47')](_0x0198('0x8e'),_0x144607);}BPromise['resolve']()[_0x0198('0x2b')](function(){if(!_0x767745){if(_0x3ce9d4['query'][_0x0198('0x76')])return;_0x4923ea['where'](_0x0198('0x8f'));_0x2515af[_0x0198('0x47')](_0x0198('0x8f'));return;}if(_0x3ce9d4[_0x0198('0x90')][_0x0198('0x91')]!==_0x0198('0x92'))return;return _0x3ce9d4[_0x0198('0x90')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0x0198('0x2b')](function(_0x113075){if(_[_0x0198('0x75')](_0x113075)){_0x4923ea[_0x0198('0x47')](_0x0198('0x93'));_0x2515af['where'](_0x0198('0x93'));}else{_0x4923ea[_0x0198('0x47')](_0x0198('0x77'),_['map'](_0x113075,'id'));_0x2515af[_0x0198('0x47')](_0x0198('0x77'),_[_0x0198('0x30')](_0x113075,'id'));}});})[_0x0198('0x2b')](function(){if(_0x3ce9d4[_0x0198('0x90')][_0x0198('0x91')]===_0x0198('0x92')&&!_0x767745&&!_0x3ce9d4['query'][_0x0198('0x76')])return[];return db[_0x0198('0x94')]['query'](_0x4923ea[_0x0198('0x95')](),_0x116696);})[_0x0198('0x2b')](function(_0x12bf31){_0x4794e4['count']=_0x12bf31[_0x0198('0x43')];if(_0x4794e4[_0x0198('0x96')]===0x0)return[];return db[_0x0198('0x94')][_0x0198('0x3e')](_0xd5867['toString'](),_0x116696)[_0x0198('0x2b')](function(_0x1af1b9){_0xab64e0=_['keyBy'](_0x1af1b9,'id');_0x116696=_['merge'](_0x116696,{'model':db[_0x0198('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3ce9d4['query'][_0x0198('0x42')]){_0x574bfa['attributes'][_0x0198('0x6d')](function(_0x4573a3){_0x2515af['field']('i.'+_0x4573a3);});}else{_0x2515af[_0x0198('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0198('0x5f'));_0x2515af[_0x0198('0x4a')]('a.key','Account.key');_0x2515af['field']('a.mandatoryDisposition',_0x0198('0x97'));_0x2515af[_0x0198('0x4a')](_0x0198('0x98'),_0x0198('0x8d'));_0x2515af['field'](_0x0198('0x99'));_0x2515af[_0x0198('0x4a')](_0x0198('0x9a'),_0x0198('0x9b'));_0x2515af[_0x0198('0x4a')]('c.lastName',_0x0198('0x9c'));_0x2515af[_0x0198('0x4a')](_0x0198('0x9d'),_0x0198('0x9e'));_0x2515af[_0x0198('0x4a')]('c.phone',_0x0198('0x9f'));_0x2515af[_0x0198('0x4a')](_0x0198('0xa0'),'Contact.mobile');_0x2515af[_0x0198('0x4a')](_0x0198('0xa1'),'Contact.fax');_0x2515af[_0x0198('0x4a')](_0x0198('0xa2'),_0x0198('0xa3'));_0x2515af[_0x0198('0x4a')]('o.internal',_0x0198('0xa4'));_0x2515af['field'](_0x0198('0xa5'),_0x0198('0x32'));}if(_0x574bfa[_0x0198('0x26')])_0x2515af[_0x0198('0x26')](_0x574bfa[_0x0198('0x26')]);if(_0x574bfa['offset'])_0x2515af[_0x0198('0x24')](_0x574bfa[_0x0198('0x24')]);return db[_0x0198('0x94')][_0x0198('0x3e')](_0x2515af[_0x0198('0x95')](),_0x116696);})[_0x0198('0x2b')](function(_0x3165f4){if(_0x3165f4['length']>0x0)_0x41ab8f[_0x0198('0x47')](_0x0198('0xa6'),_['map'](_0x3165f4,'id'));return db[_0x0198('0x94')]['query'](_0x41ab8f[_0x0198('0x95')](),_0x116696)[_0x0198('0x2b')](function(_0x4a788b){var _0x1ffd99=_[_0x0198('0xa7')](_0x4a788b,_0x0198('0xa8'));var _0x17af2f=[];_0x3165f4[_0x0198('0x6d')](function(_0x135477){_0x17af2f[_0x0198('0x35')](updateFaxInteraction(_0x135477,_0xab64e0,_0x1ffd99));});return BPromise['all'](_0x17af2f);});});})[_0x0198('0x2b')](function(_0x82917b){_0x4794e4['rows']=_0x82917b;return _0x4794e4;})[_0x0198('0x2b')](respondWithFilteredResult(_0x2071aa,_0x574bfa))[_0x0198('0x36')](handleError(_0x2071aa,null));};exports['show']=function(_0x4137cd,_0x3f6bfa){var _0x5a4e2f={'raw':![],'where':{'id':_0x4137cd[_0x0198('0xa9')]['id']}},_0xa23060={};_0xa23060[_0x0198('0x3c')]=_[_0x0198('0x3d')](db[_0x0198('0x38')][_0x0198('0xaa')]);_0xa23060[_0x0198('0x3e')]=_['keys'](_0x4137cd['query']);_0xa23060['filters']=_['intersection'](_0xa23060[_0x0198('0x3c')],_0xa23060['query']);_0x5a4e2f[_0x0198('0x41')]=_[_0x0198('0x40')](_0xa23060[_0x0198('0x3c')],qs[_0x0198('0x42')](_0x4137cd[_0x0198('0x3e')][_0x0198('0x42')]));_0x5a4e2f[_0x0198('0x41')]=_0x5a4e2f[_0x0198('0x41')]['length']?_0x5a4e2f['attributes']:_0xa23060[_0x0198('0x3c')];if(_0x4137cd['query']['includeAll']){_0x5a4e2f[_0x0198('0xab')]=[{'all':!![]}];}_0x5a4e2f=_['merge']({},_0x5a4e2f,_0x4137cd[_0x0198('0xac')]);return db[_0x0198('0x38')]['find'](_0x5a4e2f)[_0x0198('0x2b')](handleEntityNotFound(_0x3f6bfa,null))['then'](respondWithResult(_0x3f6bfa,null))[_0x0198('0x36')](handleError(_0x3f6bfa,null));};exports[_0x0198('0xad')]=function(_0x5229de,_0x775969){return db[_0x0198('0x38')][_0x0198('0xad')](_0x5229de['body'],{})[_0x0198('0x2b')](respondWithResult(_0x775969,0xc9))[_0x0198('0x36')](handleError(_0x775969,null));};exports[_0x0198('0x2a')]=function(_0x238527,_0x5b6360){if(_0x238527[_0x0198('0x72')]['id']){delete _0x238527[_0x0198('0x72')]['id'];}return db[_0x0198('0x38')][_0x0198('0x5e')]({'where':{'id':_0x238527[_0x0198('0xa9')]['id']}})[_0x0198('0x2b')](handleEntityNotFound(_0x5b6360,null))[_0x0198('0x2b')](saveUpdates(_0x238527[_0x0198('0x72')],null))[_0x0198('0x2b')](respondWithResult(_0x5b6360,null))[_0x0198('0x36')](handleError(_0x5b6360,null));};exports[_0x0198('0x2c')]=function(_0x58cf10,_0x1efe10){return db[_0x0198('0x38')][_0x0198('0x5e')]({'where':{'id':_0x58cf10[_0x0198('0xa9')]['id']}})[_0x0198('0x2b')](handleEntityNotFound(_0x1efe10,null))[_0x0198('0x2b')](removeEntity(_0x1efe10,null))[_0x0198('0x36')](handleError(_0x1efe10,null));};exports[_0x0198('0xae')]=function(_0x4181aa,_0xa90f92){return db['FaxInteraction'][_0x0198('0xae')]()[_0x0198('0x2b')](respondWithResult(_0xa90f92,null))[_0x0198('0x36')](handleError(_0xa90f92,null));};exports[_0x0198('0xaf')]=function(_0x3ebf2d,_0x4296be,_0x537d99){return db[_0x0198('0xb0')][_0x0198('0x5e')]({'where':{'id':_0x3ebf2d['params']['id']}})['then'](handleEntityNotFound(_0x4296be,null))[_0x0198('0x2b')](function(_0x19a5e3){if(_0x19a5e3){return _0x19a5e3[_0x0198('0xaf')](_0x3ebf2d['body']['ids'],_[_0x0198('0xb1')](_0x3ebf2d[_0x0198('0x72')],['ids','id'])||{});}})[_0x0198('0x2b')](respondWithResult(_0x4296be,null))['catch'](handleError(_0x4296be,null));};exports[_0x0198('0xb2')]=function(_0x1281c4,_0x3e80b1,_0x12a7a1){var _0x27df54={'raw':![],'where':{}};var _0x2494c5={};var _0x241dee={'count':0x0,'rows':[]};return db[_0x0198('0x38')][_0x0198('0xb3')]({'where':{'id':_0x1281c4['params']['id']}})[_0x0198('0x2b')](handleEntityNotFound(_0x3e80b1,null))[_0x0198('0x2b')](function(_0x428ce5){if(_0x428ce5){_0x2494c5['model']=_[_0x0198('0x3d')](db[_0x0198('0xb0')][_0x0198('0xaa')]);_0x2494c5[_0x0198('0x3e')]=_[_0x0198('0x3d')](_0x1281c4[_0x0198('0x3e')]);_0x2494c5[_0x0198('0x3f')]=_[_0x0198('0x40')](_0x2494c5[_0x0198('0x3c')],_0x2494c5[_0x0198('0x3e')]);_0x27df54[_0x0198('0x41')]=_['intersection'](_0x2494c5[_0x0198('0x3c')],qs['fields'](_0x1281c4[_0x0198('0x3e')][_0x0198('0x42')]));_0x27df54['attributes']=_0x27df54['attributes'][_0x0198('0x43')]?_0x27df54[_0x0198('0x41')]:_0x2494c5[_0x0198('0x3c')];if(!_0x1281c4[_0x0198('0x3e')][_0x0198('0xb4')](_0x0198('0x44'))){_0x27df54['limit']=qs[_0x0198('0x26')](_0x1281c4[_0x0198('0x3e')]['limit']);_0x27df54['offset']=qs[_0x0198('0x24')](_0x1281c4[_0x0198('0x3e')][_0x0198('0x24')]);}_0x27df54[_0x0198('0x45')]=qs[_0x0198('0x46')](_0x1281c4[_0x0198('0x3e')]['sort']);_0x27df54['where']=qs[_0x0198('0x3f')](_[_0x0198('0x48')](_0x1281c4[_0x0198('0x3e')],_0x2494c5[_0x0198('0x3f')]));_0x27df54[_0x0198('0x47')][_0x0198('0xa8')]=_0x428ce5['id'];if(_0x1281c4[_0x0198('0x3e')][_0x0198('0x82')]){_0x27df54[_0x0198('0x47')]=_['merge'](_0x27df54[_0x0198('0x47')],{'$or':_[_0x0198('0x30')](_0x27df54[_0x0198('0x41')],function(_0x8135b5){var _0x45df76={};_0x45df76[_0x8135b5]={'$like':'%'+_0x1281c4[_0x0198('0x3e')][_0x0198('0x82')]+'%'};return _0x45df76;})});}if(_0x1281c4[_0x0198('0x3e')][_0x0198('0x79')]){var _0x23403b=_0x1281c4[_0x0198('0x3e')][_0x0198('0x79')][_0x0198('0x34')](',');var _0x466fcf={};_0x466fcf[_0x23403b[0x0]]={'$gte':moment(_0x23403b[0x1])[_0x0198('0xb5')](_0x0198('0xb6'))};_0x27df54['where']=_[_0x0198('0xb7')](_0x27df54[_0x0198('0x47')],_0x466fcf);}_0x27df54=_[_0x0198('0xb7')]({},_0x27df54,_0x1281c4[_0x0198('0xac')]);return db[_0x0198('0xb0')][_0x0198('0x96')]({'where':_0x27df54[_0x0198('0x47')]})[_0x0198('0x2b')](function(_0x52df5f){_0x241dee[_0x0198('0x96')]=_0x52df5f;if(_0x1281c4[_0x0198('0x3e')]['includeAll']){_0x27df54[_0x0198('0xab')]=[{'all':!![]}];}return db[_0x0198('0xb0')][_0x0198('0xb8')](_0x27df54);})[_0x0198('0x2b')](function(_0x86bb26){_0x241dee[_0x0198('0xb9')]=_0x86bb26;return _0x241dee;});}})[_0x0198('0x2b')](respondWithFilteredResult(_0x3e80b1,_0x27df54))[_0x0198('0x36')](handleError(_0x3e80b1,null));};exports[_0x0198('0xba')]=function(_0x42a9e0,_0x562e14,_0x4d130d){return db[_0x0198('0x38')]['find']({'where':{'id':_0x42a9e0[_0x0198('0xa9')]['id']}})[_0x0198('0x2b')](handleEntityNotFound(_0x562e14,null))['then'](function(_0x3596af){if(_0x3596af){return _0x3596af[_0x0198('0xbb')](_0x42a9e0[_0x0198('0x72')]['ids'],_[_0x0198('0xb1')](_0x42a9e0[_0x0198('0x72')],['ids','id'])||{})[_0x0198('0xbc')](function(){return db['Tag'][_0x0198('0xb8')]({'attributes':['id',_0x0198('0x2e'),'color'],'where':{'id':_0x42a9e0['body'][_0x0198('0xbd')]}});})[_0x0198('0x2b')](function(_0x15f189){socket['emit'](_0x0198('0xbe'),{'id':Number(_0x42a9e0['params']['id']),'tags':_0x15f189||[]});return{'id':Number(_0x42a9e0[_0x0198('0xa9')]['id']),'tags':_0x15f189||[]};});}})[_0x0198('0x2b')](respondWithResult(_0x562e14,null))['catch'](handleError(_0x562e14,null));};exports[_0x0198('0xbf')]=function(_0x3d0848,_0x1cdd4b,_0x484b89){return db[_0x0198('0x38')][_0x0198('0x5e')]({'where':{'id':_0x3d0848[_0x0198('0xa9')]['id']}})['then'](handleEntityNotFound(_0x1cdd4b,null))[_0x0198('0x2b')](function(_0xc98be0){if(_0xc98be0){return _0xc98be0[_0x0198('0xbf')](_0x3d0848[_0x0198('0x3e')][_0x0198('0xbd')]);}})[_0x0198('0x2b')](respondWithStatusCode(_0x1cdd4b,null))[_0x0198('0x36')](handleError(_0x1cdd4b,null));};exports[_0x0198('0xc0')]=function(_0x21a6cb,_0x22d9e0){var _0x4c080f=moment()[_0x0198('0xc1')]()[_0x0198('0x95')]();var _0x4c409d=path[_0x0198('0xc2')](config['root'],_0x0198('0xc3'),_0x0198('0xc4'),_0x0198('0xc5'));var _0x2bcc41=path['join'](config[_0x0198('0xc6')],_0x0198('0xc3'),'files',_0x0198('0xc7'));var _0x58ac2b=path[_0x0198('0xc2')](_0x4c409d,_0x4c080f);var _0x25e542=util[_0x0198('0xb5')](_0x0198('0xc8'),_0x21a6cb[_0x0198('0xa9')]['id'],_0x4c080f);var _0x76ab=path[_0x0198('0xc2')](_0x4c409d,_0x25e542);var _0x404b54=[];_0x404b54['push']({'model':db[_0x0198('0xc9')],'as':_0x0198('0xc9'),'raw':!![]});var _0x3fdba8=[{'model':db[_0x0198('0xb0')],'as':_0x0198('0xca'),'attributes':['id','body','createdAt'],'include':_0x404b54}];return db[_0x0198('0x38')]['find']({'where':{'id':_0x21a6cb[_0x0198('0xa9')]['id']},'include':_0x3fdba8})[_0x0198('0x2b')](handleEntityNotFound(_0x22d9e0,null))['then'](function(_0xc3ee0a){if(_0xc3ee0a&&_0xc3ee0a[_0x0198('0xca')]){var _0x3e6183=_0xc3ee0a[_0x0198('0xcb')]({'plain':!![]});fs[_0x0198('0xcc')](_0x58ac2b);for(var _0x1fa37a=0x0;_0x1fa37a<_0x3e6183[_0x0198('0xca')][_0x0198('0x43')];_0x1fa37a++){var _0x3ca836=_0x3e6183[_0x0198('0xca')][_0x1fa37a][_0x0198('0xc9')];if(_0x3ca836){var _0x181565=path[_0x0198('0xc2')](_0x2bcc41,_0x3ca836[_0x0198('0xcd')]);if(fs[_0x0198('0xce')](_0x181565)){fs[_0x0198('0xcf')](_0x181565)[_0x0198('0xd0')](fs[_0x0198('0xd1')](path[_0x0198('0xc2')](_0x58ac2b,_0x3ca836[_0x0198('0xcd')])));}}}return BPromise[_0x0198('0xd2')]()[_0x0198('0x2b')](function(){return new BPromise(function(_0xb87511,_0x56c3a7){zipdir(_0x58ac2b,{'saveTo':_0x76ab},function(_0x300d53,_0x59ebad){if(_0x300d53)return _0x56c3a7(_0x300d53);return _0xb87511(_0x59ebad);});})[_0x0198('0x2b')](function(){return new BPromise(function(_0x2772ab,_0x51e690){rimraf(_0x58ac2b,function(_0x2b1470){if(_0x2b1470)_0x51e690(_0x2b1470);return _0x2772ab();});});})['then'](function(){return _0x22d9e0[_0x0198('0xc0')](_0x76ab,_0x25e542,function(_0x33b0ed){if(_0x33b0ed){console[_0x0198('0xd3')](_0x0198('0xd4'),_0x33b0ed);}else{fs['unlinkSync'](_0x76ab);}});});});}else{return _0x22d9e0[_0x0198('0x20')](0xc8);}})[_0x0198('0x36')](handleError(_0x22d9e0,null));}; \ No newline at end of file +var _0x70fb=['$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','start','body','some','compact','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','DESC','isEmpty','t.id\x20IN\x20?','user','role','i.FaxAccountId\x20IS\x20NULL','agent','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','contactName','i.*','c.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','all','rows','params','includeAll','include','FaxInteraction','create','update','destroy','describe','addMessage','FaxMessage','ids','findOne','FaxInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','omit','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','server','files','tmp','transcript-%d-%s.zip','Messages','get','mkdirSync','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','eml-format','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','save','then','stack','name','send','Users','map','TagIds','Tags','forEach','push','catch','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_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','fax_accounts','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','tools_tags','expr','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200'];(function(_0x4782af,_0x4dff5e){var _0x533a07=function(_0xee9c29){while(--_0xee9c29){_0x4782af['push'](_0x4782af['shift']());}};_0x533a07(++_0x4dff5e);}(_0x70fb,0x144));var _0xb70f=function(_0x2965d6,_0x4f3c54){_0x2965d6=_0x2965d6-0x0;var _0x122ef7=_0x70fb[_0x2965d6];return _0x122ef7;};'use strict';var emlformat=require(_0xb70f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb70f('0x1'));var rp=require(_0xb70f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb70f('0x3'));var util=require(_0xb70f('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb70f('0x5'));var ejs=require(_0xb70f('0x6'));var fs=require('fs');var fs_extra=require(_0xb70f('0x7'));var _=require(_0xb70f('0x8'));var squel=require(_0xb70f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb70f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xb70f('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb70f('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xb70f('0xd'));var hardwareService=require(_0xb70f('0xe'));var logger=require(_0xb70f('0xf'))(_0xb70f('0x10'));var utils=require(_0xb70f('0x11'));var config=require(_0xb70f('0x12'));var licenseUtil=require(_0xb70f('0x13'));var db=require('../../mysqldb')['db'];config[_0xb70f('0x14')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb70f('0x15'))(new Redis(config[_0xb70f('0x14')]));require(_0xb70f('0x16'))[_0xb70f('0x17')](socket);function respondWithStatusCode(_0x47016c,_0x54135a){_0x54135a=_0x54135a||0xcc;return function(_0x46e728){if(_0x46e728){return _0x47016c[_0xb70f('0x18')](_0x54135a);}return _0x47016c[_0xb70f('0x19')](_0x54135a)[_0xb70f('0x1a')]();};}function respondWithResult(_0x3430e7,_0x2aeaf8){_0x2aeaf8=_0x2aeaf8||0xc8;return function(_0x502550){if(_0x502550){return _0x3430e7[_0xb70f('0x19')](_0x2aeaf8)['json'](_0x502550);}};}function respondWithFilteredResult(_0x12a7f9,_0x5e0e0a){return function(_0x9e1a5e){if(_0x9e1a5e){var _0xcfd8d9=typeof _0x5e0e0a[_0xb70f('0x1b')]===_0xb70f('0x1c')&&typeof _0x5e0e0a[_0xb70f('0x1d')]==='undefined';var _0xdea8c3=_0x9e1a5e[_0xb70f('0x1e')];var _0x50063d=_0xcfd8d9?0x0:_0x5e0e0a[_0xb70f('0x1b')];var _0x55d464=_0xcfd8d9?_0x9e1a5e[_0xb70f('0x1e')]:_0x5e0e0a[_0xb70f('0x1b')]+_0x5e0e0a[_0xb70f('0x1d')];var _0x5b0c55;if(_0x55d464>=_0xdea8c3){_0x55d464=_0xdea8c3;_0x5b0c55=0xc8;}else{_0x5b0c55=0xce;}_0x12a7f9[_0xb70f('0x19')](_0x5b0c55);return _0x12a7f9[_0xb70f('0x1f')]('Content-Range',_0x50063d+'-'+_0x55d464+'/'+_0xdea8c3)[_0xb70f('0x20')](_0x9e1a5e);}return null;};}function patchUpdates(_0x36fdae){return function(_0x1e7c50){try{jsonpatch[_0xb70f('0x21')](_0x1e7c50,_0x36fdae,!![]);}catch(_0x29226f){return BPromise['reject'](_0x29226f);}return _0x1e7c50[_0xb70f('0x22')]();};}function saveUpdates(_0x281d0,_0x2c0409){return function(_0x3d2abc){if(_0x3d2abc){return _0x3d2abc['update'](_0x281d0)[_0xb70f('0x23')](function(_0x59bf87){return _0x59bf87;});}return null;};}function removeEntity(_0x90a825,_0x38c6ee){return function(_0x168a79){if(_0x168a79){return _0x168a79['destroy']()[_0xb70f('0x23')](function(){_0x90a825[_0xb70f('0x19')](0xcc)[_0xb70f('0x1a')]();});}};}function handleEntityNotFound(_0xeb40aa,_0x2ae5b7){return function(_0x540d44){if(!_0x540d44){_0xeb40aa[_0xb70f('0x18')](0x194);}return _0x540d44;};}function handleError(_0x260d98,_0x29432c){_0x29432c=_0x29432c||0x1f4;return function(_0x1cfea8){logger['error'](_0x1cfea8[_0xb70f('0x24')]);if(_0x1cfea8['name']){delete _0x1cfea8[_0xb70f('0x25')];}_0x260d98['status'](_0x29432c)[_0xb70f('0x26')](_0x1cfea8);};}function getInteractionUsers(_0x25a10e,_0x43a692){return new BPromise(function(_0x57550a,_0xe83214){try{if(_0x43a692[_0x25a10e['id']]){_0x25a10e[_0xb70f('0x27')]=_[_0xb70f('0x28')](_0x43a692[_0x25a10e['id']],function(_0x33448d){return{'id':_0x33448d['id'],'fullname':_0x33448d['fullname']};});}}catch(_0x2ec02a){_0xe83214(_0x2ec02a);}_0x57550a(_0x25a10e);});}function getInteractionTags(_0x58a8a3,_0x47dbad){return new BPromise(function(_0x16a8a4,_0x4d46d9){try{if(_0x58a8a3[_0xb70f('0x29')]){_0x58a8a3[_0xb70f('0x2a')]=[];_0x58a8a3[_0xb70f('0x29')]['split'](',')[_0xb70f('0x2b')](function(_0x977d34){_0x58a8a3[_0xb70f('0x2a')][_0xb70f('0x2c')](_0x47dbad[_0x977d34]);});}delete _0x58a8a3[_0xb70f('0x29')];}catch(_0x34bbdf){_0x4d46d9(_0x34bbdf);}_0x16a8a4(_0x58a8a3);});}function updateFaxInteraction(_0x45936f,_0x2e0029,_0x34a9a2){return new BPromise(function(_0x36ad18,_0x2819c5){return getInteractionUsers(_0x45936f,_0x34a9a2)[_0xb70f('0x23')](function(_0x131487){return getInteractionTags(_0x131487,_0x2e0029);})[_0xb70f('0x23')](function(_0x29e234){_0x36ad18(_0x29e234);})[_0xb70f('0x2d')](function(_0x1460f3){_0x2819c5(_0x1460f3);});});}exports['index']=function(_0x523592,_0x31cedc){var _0x150dd5={},_0x25baea={},_0x44b57={'count':0x0,'rows':[]};var _0x28219e=_[_0xb70f('0x28')](db['FaxInteraction'][_0xb70f('0x2e')],function(_0x37e7e3){return{'name':_0x37e7e3[_0xb70f('0x2f')],'type':_0x37e7e3[_0xb70f('0x30')][_0xb70f('0x31')]};});_0x25baea['model']=_['map'](_0x28219e,'name');_0x25baea[_0xb70f('0x32')]=_[_0xb70f('0x33')](_0x523592[_0xb70f('0x32')]);_0x25baea[_0xb70f('0x34')]=_['intersection'](_0x25baea[_0xb70f('0x35')],_0x25baea[_0xb70f('0x32')]);_0x150dd5['attributes']=_[_0xb70f('0x36')](_0x25baea[_0xb70f('0x35')],qs['fields'](_0x523592['query'][_0xb70f('0x37')]));_0x150dd5[_0xb70f('0x38')]=_0x150dd5[_0xb70f('0x38')][_0xb70f('0x39')]?_0x150dd5[_0xb70f('0x38')]:_0x25baea['model'];if(!_0x523592[_0xb70f('0x32')][_0xb70f('0x3a')]('nolimit')){_0x150dd5[_0xb70f('0x1d')]=qs[_0xb70f('0x1d')](_0x523592[_0xb70f('0x32')][_0xb70f('0x1d')]);_0x150dd5[_0xb70f('0x1b')]=qs['offset'](_0x523592[_0xb70f('0x32')][_0xb70f('0x1b')]);}_0x150dd5[_0xb70f('0x3b')]=qs['sort'](_0x523592[_0xb70f('0x32')][_0xb70f('0x3c')]);_0x150dd5[_0xb70f('0x3d')]=qs[_0xb70f('0x34')](_[_0xb70f('0x3e')](_0x523592[_0xb70f('0x32')],_0x25baea[_0xb70f('0x34')]),_0x28219e);var _0xbdce55=[];var _0x3ce6c9=squel[_0xb70f('0x3f')]()['field']('id')[_0xb70f('0x40')](_0xb70f('0x25'))[_0xb70f('0x40')](_0xb70f('0x41'))[_0xb70f('0x42')]('tools_tags');var _0x3af045=squel[_0xb70f('0x3f')]()[_0xb70f('0x40')](_0xb70f('0x43'))[_0xb70f('0x40')](_0xb70f('0x44'))[_0xb70f('0x40')](_0xb70f('0x45'))['from'](_0xb70f('0x46'),'ui')[_0xb70f('0x47')](_0xb70f('0x48'),'u',_0xb70f('0x49'));var _0xa28432=squel['select']()[_0xb70f('0x42')]('fax_interactions','i')[_0xb70f('0x47')](_0xb70f('0x4a'),'c',_0xb70f('0x4b'))[_0xb70f('0x47')](_0xb70f('0x48'),'o',_0xb70f('0x4c'))[_0xb70f('0x47')](_0xb70f('0x4d'),'a','a.id\x20=\x20i.FaxAccountId')[_0xb70f('0x47')](_0xb70f('0x4e'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xb70f('0x47')](_0xb70f('0x4f'),'it',_0xb70f('0x50'))[_0xb70f('0x47')](_0xb70f('0x51'),'t','t.id\x20=\x20it.TagId');var _0x216495=squel[_0xb70f('0x52')]();var _0x51c0cd=[];var _0xc613f6=squel[_0xb70f('0x52')]();var _0x1da593;if(_0x523592[_0xb70f('0x32')]['search']){_0x1da593=as[_0xb70f('0x53')](_0x523592['query']['search']);var _0x3d5a54=_0x1da593[_0xb70f('0x54')];for(var _0x5f4d70=0x0;_0x5f4d70<_0x1da593[_0xb70f('0x55')][_0xb70f('0x39')];_0x5f4d70++){var _0x4e1988=_0x1da593[_0xb70f('0x55')][_0x5f4d70];var _0x2435c9='i';var _0x40763e=_[_0xb70f('0x56')](_0x28219e,[_0xb70f('0x25'),_0x4e1988[_0xb70f('0x40')]]);if(!_0x40763e){switch(_0x4e1988[_0xb70f('0x40')]){case _0xb70f('0x57'):if(_0x4e1988[_0xb70f('0x58')]==0x1){_0xa28432[_0xb70f('0x59')]('`'+_0x4e1988['field']+_0xb70f('0x5a'));}else{_0xa28432['having']('`'+_0x4e1988[_0xb70f('0x40')]+_0xb70f('0x5b'));}break;case'Contact':if(_0x4e1988['operator']===_0xb70f('0x5c')){if(_0x4e1988[_0xb70f('0x58')]['split']('\x20')[_0xb70f('0x39')]>0x1){_0x216495[_0x3d5a54](_0xb70f('0x5d'),qs[_0xb70f('0x5e')](_0x4e1988[_0xb70f('0x58')]),null);}else{var _0x189b6f='%'+_0x4e1988[_0xb70f('0x58')]+'%';_0x216495[_0x3d5a54](_0xb70f('0x5f'),_0x189b6f,_0x189b6f,_0x189b6f);}}else{_0x40763e=_['find'](_0x28219e,[_0xb70f('0x25'),_0xb70f('0x60')]);_0x4e1988['field']=_0xb70f('0x60');_0x44f754=as[_0xb70f('0x61')](_0x2435c9,_0x40763e[_0xb70f('0x30')],_0x4e1988);_0x216495[_0x3d5a54](_0x44f754[_0xb70f('0x62')],_0x44f754[_0xb70f('0x58')]['start'],_0x44f754['value'][_0xb70f('0x1a')]);}break;case _0xb70f('0x63'):var _0x561583=_0x4e1988[_0xb70f('0x58')][_0xb70f('0x64')](',')[_0xb70f('0x28')](function(_0x3411ef){return Number(_0x3411ef);});_0x561583[_0xb70f('0x2b')](function(_0x1f337e){_0xc613f6['or'](_0xb70f('0x65'),'%,'+_0x1f337e+',%');});_0x51c0cd=_[_0xb70f('0x66')](_0x51c0cd,_0x561583);break;case _0xb70f('0x67'):if(_0x4e1988[_0xb70f('0x68')]===_0xb70f('0x5c')){_0x216495[_0x3d5a54]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4e1988[_0xb70f('0x58')]+'%',null);}else{_0x40763e=_[_0xb70f('0x56')](_0x28219e,['name',_0xb70f('0x69')]);_0x4e1988['field']=_0xb70f('0x69');_0x44f754=as[_0xb70f('0x61')](_0x2435c9,_0x40763e[_0xb70f('0x30')],_0x4e1988);_0x216495[_0x3d5a54](_0x44f754['text'],_0x44f754[_0xb70f('0x58')][_0xb70f('0x6a')],_0x44f754[_0xb70f('0x58')][_0xb70f('0x1a')]);}break;case _0xb70f('0x6b'):_0x44f754=as[_0xb70f('0x61')]('me',null,_0x4e1988);_0x216495[_0x3d5a54](_0x44f754[_0xb70f('0x62')],_0x44f754[_0xb70f('0x58')]['start'],_0x44f754[_0xb70f('0x58')][_0xb70f('0x1a')]);break;}}else{var _0x44f754=as[_0xb70f('0x61')](_0x2435c9,_0x40763e[_0xb70f('0x30')],_0x4e1988);_0x216495[_0x3d5a54](_0x44f754[_0xb70f('0x62')],_0x44f754[_0xb70f('0x58')]['start'],_0x44f754[_0xb70f('0x58')][_0xb70f('0x1a')]);}}}else{var _0x226e15=_(_0x523592['query'])[_0xb70f('0x33')]()[_0xb70f('0x28')](function(_0x1fe94c){return _[_0xb70f('0x6c')](_0x28219e,['name',_0x1fe94c])?_0x1fe94c:undefined;})[_0xb70f('0x6d')]()[_0xb70f('0x58')]();if(!_['isEmpty'](_0x226e15)){_0x226e15[_0xb70f('0x2b')](function(_0x2b4970){if(_0x2b4970===_0xb70f('0x6e')){_0xa28432[_0xb70f('0x3d')](_0xb70f('0x6f'),[][_0xb70f('0x70')](_0x523592[_0xb70f('0x32')][_0x2b4970]));}else if(_0x2b4970===_0xb70f('0x71')){var _0x2fd438=JSON['parse'](_0x523592[_0xb70f('0x32')][_0x2b4970])[_0xb70f('0x72')];var _0x5c24f=JSON['parse'](_0x523592[_0xb70f('0x32')][_0x2b4970])['$lte'];_0xa28432[_0xb70f('0x3d')](_0xb70f('0x73'),_0x2fd438,_0x5c24f);}else{if(_0x523592[_0xb70f('0x32')][_0x2b4970]==='null'){_0xa28432[_0xb70f('0x3d')]('i.'+_0x2b4970+'\x20IS\x20NULL');}else{_0xa28432[_0xb70f('0x3d')]('i.'+_0x2b4970+_0xb70f('0x74'),_0x523592['query'][_0x2b4970]);}}});}if(_0x523592[_0xb70f('0x32')][_0xb70f('0x75')]){if(_0x523592[_0xb70f('0x32')][_0xb70f('0x75')]==0x1){_0xa28432[_0xb70f('0x59')](_0xb70f('0x76'));}else{_0xa28432[_0xb70f('0x59')]('`unreadMessages`\x20>\x200');}}if(_0x523592[_0xb70f('0x32')][_0xb70f('0x77')]){_0x51c0cd=_[_0xb70f('0x78')](_0x523592[_0xb70f('0x32')][_0xb70f('0x77')])?_0x523592[_0xb70f('0x32')]['tag']:new Array(_0x523592['query'][_0xb70f('0x77')]);_0x51c0cd[_0xb70f('0x2b')](function(_0x48fdba){_0xc613f6['or'](_0xb70f('0x65'),'%,'+_0x48fdba+',%');});}if(_0x523592[_0xb70f('0x32')][_0xb70f('0x79')]){var _0x35963b=_0x523592[_0xb70f('0x32')][_0xb70f('0x79')][_0xb70f('0x7a')]('\x5c','\x5c\x5c')[_0xb70f('0x7a')](/'/g,'\x27\x27');if(qs[_0xb70f('0x7b')](_0x35963b)){_0x216495['or'](_0xb70f('0x7c'),_0x35963b+'%')['or']('i.fax\x20LIKE\x20?',_0x35963b+'%');}_0x216495['or'](_0xb70f('0x7d'),_0x35963b+'%');}}_0xa28432[_0xb70f('0x3d')](_0x216495);_0xa28432[_0xb70f('0x7e')](_0xb70f('0x7f'));var _0x10d3bc={'type':db[_0xb70f('0x80')][_0xb70f('0x81')][_0xb70f('0x82')],'raw':!![]};var _0x4567a8=_0xa28432[_0xb70f('0x83')]();_0x4567a8['field'](_0xb70f('0x7f'));_0x4567a8[_0xb70f('0x40')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb70f('0x57'));if(_0x150dd5[_0xb70f('0x3b')]){_0x150dd5[_0xb70f('0x3b')][_0xb70f('0x2b')](function(_0x4aacaa){var _0x193997=_0x4aacaa[0x0]==='contactName'?_0x4aacaa[0x0]:'i.'+_0x4aacaa[0x0];_0xa28432[_0xb70f('0x3b')](_0x193997,_0x4aacaa[0x1]===_0xb70f('0x84')?![]:!![]);});}if(!_[_0xb70f('0x85')](_0x51c0cd)){_0xa28432[_0xb70f('0x59')](_0xc613f6);_0x4567a8[_0xb70f('0x3d')](_0xb70f('0x86'),_0x51c0cd);}BPromise['resolve']()[_0xb70f('0x23')](function(){if(!_0x1da593){if(_0x523592[_0xb70f('0x32')][_0xb70f('0x6e')])return;_0x4567a8['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0xa28432[_0xb70f('0x3d')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x523592[_0xb70f('0x87')][_0xb70f('0x88')]!=='agent')return;return _0x523592[_0xb70f('0x87')]['getFaxAccounts']({'attributes':['id'],'raw':!![]})[_0xb70f('0x23')](function(_0x115d4b){if(_[_0xb70f('0x85')](_0x115d4b)){_0x4567a8[_0xb70f('0x3d')](_0xb70f('0x89'));_0xa28432[_0xb70f('0x3d')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4567a8[_0xb70f('0x3d')](_0xb70f('0x6f'),_[_0xb70f('0x28')](_0x115d4b,'id'));_0xa28432['where'](_0xb70f('0x6f'),_[_0xb70f('0x28')](_0x115d4b,'id'));}});})['then'](function(){if(_0x523592[_0xb70f('0x87')]['role']===_0xb70f('0x8a')&&!_0x1da593&&!_0x523592['query'][_0xb70f('0x6e')])return[];return db['sequelize'][_0xb70f('0x32')](_0x4567a8[_0xb70f('0x8b')](),_0x10d3bc);})['then'](function(_0x5053bf){_0x44b57[_0xb70f('0x1e')]=_0x5053bf[_0xb70f('0x39')];if(_0x44b57[_0xb70f('0x1e')]===0x0)return[];return db['sequelize']['query'](_0x3ce6c9[_0xb70f('0x8b')](),_0x10d3bc)[_0xb70f('0x23')](function(_0x135edb){_0xbdce55=_[_0xb70f('0x8c')](_0x135edb,'id');_0x10d3bc=_[_0xb70f('0x8d')](_0x10d3bc,{'model':db['FaxInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x523592['query']['fields']){_0x150dd5[_0xb70f('0x38')]['forEach'](function(_0x2b3564){_0xa28432[_0xb70f('0x40')]('i.'+_0x2b3564);});}else{_0xa28432[_0xb70f('0x40')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0xa28432['field'](_0xb70f('0x8e'),_0xb70f('0x8f'));_0xa28432[_0xb70f('0x40')](_0xb70f('0x90'),'Account.mandatoryDisposition');_0xa28432[_0xb70f('0x40')](_0xb70f('0x91'),_0xb70f('0x92'));_0xa28432['field'](_0xb70f('0x93'));_0xa28432['field'](_0xb70f('0x94'),'Contact.firstName');_0xa28432[_0xb70f('0x40')]('c.lastName',_0xb70f('0x95'));_0xa28432[_0xb70f('0x40')](_0xb70f('0x96'),_0xb70f('0x97'));_0xa28432[_0xb70f('0x40')](_0xb70f('0x98'),_0xb70f('0x99'));_0xa28432[_0xb70f('0x40')](_0xb70f('0x9a'),_0xb70f('0x9b'));_0xa28432['field'](_0xb70f('0x9c'),_0xb70f('0x9d'));_0xa28432[_0xb70f('0x40')](_0xb70f('0x9e'),_0xb70f('0x9f'));_0xa28432[_0xb70f('0x40')]('o.internal',_0xb70f('0xa0'));_0xa28432[_0xb70f('0x40')](_0xb70f('0xa1'),'TagIds');}if(_0x150dd5['limit'])_0xa28432[_0xb70f('0x1d')](_0x150dd5['limit']);if(_0x150dd5[_0xb70f('0x1b')])_0xa28432[_0xb70f('0x1b')](_0x150dd5[_0xb70f('0x1b')]);return db['sequelize'][_0xb70f('0x32')](_0xa28432[_0xb70f('0x8b')](),_0x10d3bc);})[_0xb70f('0x23')](function(_0x4cabab){if(_0x4cabab[_0xb70f('0x39')]>0x0)_0x3af045['where'](_0xb70f('0xa2'),_[_0xb70f('0x28')](_0x4cabab,'id'));return db['sequelize']['query'](_0x3af045[_0xb70f('0x8b')](),_0x10d3bc)[_0xb70f('0x23')](function(_0x88db6a){var _0x3e211c=_[_0xb70f('0xa3')](_0x88db6a,'FaxInteractionId');var _0x46b618=[];_0x4cabab[_0xb70f('0x2b')](function(_0x2dcbcb){_0x46b618[_0xb70f('0x2c')](updateFaxInteraction(_0x2dcbcb,_0xbdce55,_0x3e211c));});return BPromise[_0xb70f('0xa4')](_0x46b618);});});})[_0xb70f('0x23')](function(_0x103b6e){_0x44b57[_0xb70f('0xa5')]=_0x103b6e;return _0x44b57;})[_0xb70f('0x23')](respondWithFilteredResult(_0x31cedc,_0x150dd5))[_0xb70f('0x2d')](handleError(_0x31cedc,null));};exports['show']=function(_0x481aee,_0x47e4b3){var _0x1df0d5={'raw':![],'where':{'id':_0x481aee[_0xb70f('0xa6')]['id']}},_0x4fef1a={};_0x4fef1a[_0xb70f('0x35')]=_[_0xb70f('0x33')](db['FaxInteraction'][_0xb70f('0x2e')]);_0x4fef1a[_0xb70f('0x32')]=_[_0xb70f('0x33')](_0x481aee[_0xb70f('0x32')]);_0x4fef1a[_0xb70f('0x34')]=_[_0xb70f('0x36')](_0x4fef1a[_0xb70f('0x35')],_0x4fef1a['query']);_0x1df0d5[_0xb70f('0x38')]=_['intersection'](_0x4fef1a['model'],qs[_0xb70f('0x37')](_0x481aee[_0xb70f('0x32')][_0xb70f('0x37')]));_0x1df0d5[_0xb70f('0x38')]=_0x1df0d5[_0xb70f('0x38')][_0xb70f('0x39')]?_0x1df0d5[_0xb70f('0x38')]:_0x4fef1a[_0xb70f('0x35')];if(_0x481aee['query'][_0xb70f('0xa7')]){_0x1df0d5[_0xb70f('0xa8')]=[{'all':!![]}];}_0x1df0d5=_[_0xb70f('0x8d')]({},_0x1df0d5,_0x481aee['options']);return db[_0xb70f('0xa9')][_0xb70f('0x56')](_0x1df0d5)[_0xb70f('0x23')](handleEntityNotFound(_0x47e4b3,null))['then'](respondWithResult(_0x47e4b3,null))[_0xb70f('0x2d')](handleError(_0x47e4b3,null));};exports['create']=function(_0x27bf39,_0x3ff8a9){return db['FaxInteraction'][_0xb70f('0xaa')](_0x27bf39[_0xb70f('0x6b')],{})[_0xb70f('0x23')](respondWithResult(_0x3ff8a9,0xc9))[_0xb70f('0x2d')](handleError(_0x3ff8a9,null));};exports[_0xb70f('0xab')]=function(_0x48956c,_0x951e62){if(_0x48956c['body']['id']){delete _0x48956c[_0xb70f('0x6b')]['id'];}return db[_0xb70f('0xa9')][_0xb70f('0x56')]({'where':{'id':_0x48956c[_0xb70f('0xa6')]['id']}})['then'](handleEntityNotFound(_0x951e62,null))['then'](saveUpdates(_0x48956c[_0xb70f('0x6b')],null))[_0xb70f('0x23')](respondWithResult(_0x951e62,null))[_0xb70f('0x2d')](handleError(_0x951e62,null));};exports[_0xb70f('0xac')]=function(_0x601b72,_0x223e91){return db[_0xb70f('0xa9')][_0xb70f('0x56')]({'where':{'id':_0x601b72['params']['id']}})[_0xb70f('0x23')](handleEntityNotFound(_0x223e91,null))[_0xb70f('0x23')](removeEntity(_0x223e91,null))[_0xb70f('0x2d')](handleError(_0x223e91,null));};exports[_0xb70f('0xad')]=function(_0x2b5b03,_0x4813a8){return db['FaxInteraction'][_0xb70f('0xad')]()[_0xb70f('0x23')](respondWithResult(_0x4813a8,null))[_0xb70f('0x2d')](handleError(_0x4813a8,null));};exports[_0xb70f('0xae')]=function(_0xf3f307,_0x3b34a0,_0x5aa25a){return db[_0xb70f('0xaf')][_0xb70f('0x56')]({'where':{'id':_0xf3f307[_0xb70f('0xa6')]['id']}})[_0xb70f('0x23')](handleEntityNotFound(_0x3b34a0,null))[_0xb70f('0x23')](function(_0x416ba2){if(_0x416ba2){return _0x416ba2[_0xb70f('0xae')](_0xf3f307['body'][_0xb70f('0xb0')],_['omit'](_0xf3f307[_0xb70f('0x6b')],[_0xb70f('0xb0'),'id'])||{});}})[_0xb70f('0x23')](respondWithResult(_0x3b34a0,null))['catch'](handleError(_0x3b34a0,null));};exports['getMessages']=function(_0x1775bf,_0x3acfe2,_0x367ce8){var _0x3ce14b={'raw':![],'where':{}};var _0x20c36f={};var _0x144cce={'count':0x0,'rows':[]};return db[_0xb70f('0xa9')][_0xb70f('0xb1')]({'where':{'id':_0x1775bf['params']['id']}})['then'](handleEntityNotFound(_0x3acfe2,null))['then'](function(_0xb70f8){if(_0xb70f8){_0x20c36f[_0xb70f('0x35')]=_[_0xb70f('0x33')](db[_0xb70f('0xaf')][_0xb70f('0x2e')]);_0x20c36f[_0xb70f('0x32')]=_[_0xb70f('0x33')](_0x1775bf[_0xb70f('0x32')]);_0x20c36f['filters']=_[_0xb70f('0x36')](_0x20c36f['model'],_0x20c36f[_0xb70f('0x32')]);_0x3ce14b[_0xb70f('0x38')]=_[_0xb70f('0x36')](_0x20c36f[_0xb70f('0x35')],qs['fields'](_0x1775bf[_0xb70f('0x32')][_0xb70f('0x37')]));_0x3ce14b[_0xb70f('0x38')]=_0x3ce14b[_0xb70f('0x38')][_0xb70f('0x39')]?_0x3ce14b[_0xb70f('0x38')]:_0x20c36f[_0xb70f('0x35')];if(!_0x1775bf['query'][_0xb70f('0x3a')]('nolimit')){_0x3ce14b[_0xb70f('0x1d')]=qs[_0xb70f('0x1d')](_0x1775bf['query']['limit']);_0x3ce14b[_0xb70f('0x1b')]=qs[_0xb70f('0x1b')](_0x1775bf['query'][_0xb70f('0x1b')]);}_0x3ce14b[_0xb70f('0x3b')]=qs['sort'](_0x1775bf[_0xb70f('0x32')][_0xb70f('0x3c')]);_0x3ce14b['where']=qs['filters'](_[_0xb70f('0x3e')](_0x1775bf[_0xb70f('0x32')],_0x20c36f['filters']));_0x3ce14b[_0xb70f('0x3d')][_0xb70f('0xb2')]=_0xb70f8['id'];if(_0x1775bf[_0xb70f('0x32')][_0xb70f('0x79')]){_0x3ce14b[_0xb70f('0x3d')]=_[_0xb70f('0x8d')](_0x3ce14b[_0xb70f('0x3d')],{'$or':_[_0xb70f('0x28')](_0x3ce14b['attributes'],function(_0x114f21){var _0x8096db={};_0x8096db[_0x114f21]={'$like':'%'+_0x1775bf['query']['filter']+'%'};return _0x8096db;})});}if(_0x1775bf[_0xb70f('0x32')][_0xb70f('0x72')]){var _0x21b661=_0x1775bf[_0xb70f('0x32')][_0xb70f('0x72')][_0xb70f('0x64')](',');var _0x351a51={};_0x351a51[_0x21b661[0x0]]={'$gte':moment(_0x21b661[0x1])[_0xb70f('0xb3')](_0xb70f('0xb4'))};_0x3ce14b[_0xb70f('0x3d')]=_['merge'](_0x3ce14b[_0xb70f('0x3d')],_0x351a51);}_0x3ce14b=_[_0xb70f('0x8d')]({},_0x3ce14b,_0x1775bf['options']);return db[_0xb70f('0xaf')]['count']({'where':_0x3ce14b['where']})[_0xb70f('0x23')](function(_0x25f20c){_0x144cce[_0xb70f('0x1e')]=_0x25f20c;if(_0x1775bf['query']['includeAll']){_0x3ce14b['include']=[{'all':!![]}];}return db[_0xb70f('0xaf')][_0xb70f('0xb5')](_0x3ce14b);})[_0xb70f('0x23')](function(_0x5834f9){_0x144cce[_0xb70f('0xa5')]=_0x5834f9;return _0x144cce;});}})[_0xb70f('0x23')](respondWithFilteredResult(_0x3acfe2,_0x3ce14b))['catch'](handleError(_0x3acfe2,null));};exports[_0xb70f('0xb6')]=function(_0x305dd7,_0xee80f2,_0x59fcad){return db[_0xb70f('0xa9')][_0xb70f('0x56')]({'where':{'id':_0x305dd7[_0xb70f('0xa6')]['id']}})[_0xb70f('0x23')](handleEntityNotFound(_0xee80f2,null))[_0xb70f('0x23')](function(_0x2563c9){if(_0x2563c9){return _0x2563c9[_0xb70f('0xb7')](_0x305dd7[_0xb70f('0x6b')][_0xb70f('0xb0')],_[_0xb70f('0xb8')](_0x305dd7[_0xb70f('0x6b')],[_0xb70f('0xb0'),'id'])||{})[_0xb70f('0xb9')](function(){return db[_0xb70f('0x63')][_0xb70f('0xb5')]({'attributes':['id',_0xb70f('0x25'),_0xb70f('0x41')],'where':{'id':_0x305dd7[_0xb70f('0x6b')]['ids']}});})[_0xb70f('0x23')](function(_0x1a8c3e){socket[_0xb70f('0xba')](_0xb70f('0xbb'),{'id':Number(_0x305dd7[_0xb70f('0xa6')]['id']),'tags':_0x1a8c3e||[]});return{'id':Number(_0x305dd7['params']['id']),'tags':_0x1a8c3e||[]};});}})[_0xb70f('0x23')](respondWithResult(_0xee80f2,null))[_0xb70f('0x2d')](handleError(_0xee80f2,null));};exports['removeTags']=function(_0x48f102,_0x37e94e,_0x2210ff){return db['FaxInteraction'][_0xb70f('0x56')]({'where':{'id':_0x48f102[_0xb70f('0xa6')]['id']}})[_0xb70f('0x23')](handleEntityNotFound(_0x37e94e,null))['then'](function(_0x21dfc4){if(_0x21dfc4){return _0x21dfc4[_0xb70f('0xbc')](_0x48f102['query'][_0xb70f('0xb0')]);}})[_0xb70f('0x23')](respondWithStatusCode(_0x37e94e,null))['catch'](handleError(_0x37e94e,null));};exports[_0xb70f('0xbd')]=function(_0x3cb3c9,_0x5450d3){var _0x54e0a1=moment()[_0xb70f('0xbe')]()[_0xb70f('0x8b')]();var _0x380179=path[_0xb70f('0xbf')](config['root'],_0xb70f('0xc0'),_0xb70f('0xc1'),_0xb70f('0xc2'));var _0x27d516=path[_0xb70f('0xbf')](config['root'],_0xb70f('0xc0'),_0xb70f('0xc1'),'attachments');var _0x60053f=path[_0xb70f('0xbf')](_0x380179,_0x54e0a1);var _0x1aa6a2=util[_0xb70f('0xb3')](_0xb70f('0xc3'),_0x3cb3c9[_0xb70f('0xa6')]['id'],_0x54e0a1);var _0xd72801=path[_0xb70f('0xbf')](_0x380179,_0x1aa6a2);var _0x5e749f=[];_0x5e749f[_0xb70f('0x2c')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x2fd592=[{'model':db['FaxMessage'],'as':_0xb70f('0xc4'),'attributes':['id',_0xb70f('0x6b'),_0xb70f('0x71')],'include':_0x5e749f}];return db[_0xb70f('0xa9')]['find']({'where':{'id':_0x3cb3c9[_0xb70f('0xa6')]['id']},'include':_0x2fd592})[_0xb70f('0x23')](handleEntityNotFound(_0x5450d3,null))['then'](function(_0x1ee25a){if(_0x1ee25a&&_0x1ee25a[_0xb70f('0xc4')]){var _0x641d81=_0x1ee25a[_0xb70f('0xc5')]({'plain':!![]});fs[_0xb70f('0xc6')](_0x60053f);for(var _0x4824c6=0x0;_0x4824c6<_0x641d81[_0xb70f('0xc4')][_0xb70f('0x39')];_0x4824c6++){var _0x503e1c=_0x641d81[_0xb70f('0xc4')][_0x4824c6][_0xb70f('0xc7')];if(_0x503e1c){var _0xea61e7=path[_0xb70f('0xbf')](_0x27d516,_0x503e1c[_0xb70f('0xc8')]);if(fs[_0xb70f('0xc9')](_0xea61e7)){fs[_0xb70f('0xca')](_0xea61e7)[_0xb70f('0xcb')](fs[_0xb70f('0xcc')](path[_0xb70f('0xbf')](_0x60053f,_0x503e1c[_0xb70f('0xc8')])));}}}return BPromise[_0xb70f('0xcd')]()[_0xb70f('0x23')](function(){return new BPromise(function(_0x2470db,_0x43f30e){zipdir(_0x60053f,{'saveTo':_0xd72801},function(_0x1c2cf3,_0x2b05b4){if(_0x1c2cf3)return _0x43f30e(_0x1c2cf3);return _0x2470db(_0x2b05b4);});})['then'](function(){return new BPromise(function(_0x21be57,_0x16c5a7){rimraf(_0x60053f,function(_0x3d9b57){if(_0x3d9b57)_0x16c5a7(_0x3d9b57);return _0x21be57();});});})[_0xb70f('0x23')](function(){return _0x5450d3[_0xb70f('0xbd')](_0xd72801,_0x1aa6a2,function(_0x4ca6be){if(_0x4ca6be){console[_0xb70f('0xce')](_0xb70f('0xcf'),_0x4ca6be);}else{fs['unlinkSync'](_0xd72801);}});});});}else{return _0x5450d3[_0xb70f('0x18')](0xc8);}})['catch'](handleError(_0x5450d3,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 3a2667f..6d320f7 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 _0x67ab=['setMaxListeners','save','getUsers','then','setDataValue','findAll','unreadMessages','length','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x10e4ec,_0xee4ffc){var _0x3901a6=function(_0x528c11){while(--_0x528c11){_0x10e4ec['push'](_0x10e4ec['shift']());}};_0x3901a6(++_0xee4ffc);}(_0x67ab,0x82));var _0xb67a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x67ab[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0xb67a('0x0'));var FaxInteraction=require(_0xb67a('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0xb67a('0x1'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb67a('0x2')](0x0);var events={'afterCreate':_0xb67a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x454628){return function(_0x29ef9c,_0x5c1629,_0x5d1bb9){_0x29ef9c[_0xb67a('0x4')]({'attributes':['id'],'raw':!![]})[_0xb67a('0x5')](function(_0x549746){_0x29ef9c[_0xb67a('0x6')]('Users',_0x549746['map'](function(_0x1e0f51){return{'id':_0x1e0f51['id']};}));return FaxMessage[_0xb67a('0x7')]({'where':{'FaxInteractionId':_0x29ef9c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb67a('0x5')](function(_0x197ee8){_0x29ef9c[_0xb67a('0x6')](_0xb67a('0x8'),_0x197ee8[_0xb67a('0x9')]);FaxInteractionEvents[_0xb67a('0xa')](_0x454628+':'+_0x29ef9c['id'],_0x29ef9c);FaxInteractionEvents[_0xb67a('0xa')](_0x454628,_0x29ef9c);_0x5d1bb9(null);})['catch'](_0x5d1bb9(null));};}for(var e in events){if(events[_0xb67a('0xb')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x5a2d=['findAll','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map'];(function(_0xcd39c8,_0x2ad166){var _0x463dfc=function(_0x224b09){while(--_0x224b09){_0xcd39c8['push'](_0xcd39c8['shift']());}};_0x463dfc(++_0x2ad166);}(_0x5a2d,0x9f));var _0xd5a2=function(_0x234ce7,_0x3e909c){_0x234ce7=_0x234ce7-0x0;var _0x57c561=_0x5a2d[_0x234ce7];return _0x57c561;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xd5a2('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0xd5a2('0x0'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xd5a2('0x1')](0x0);var events={'afterCreate':_0xd5a2('0x2'),'afterUpdate':_0xd5a2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4ab0ad){return function(_0x3f5206,_0x32316c,_0x2d6690){_0x3f5206[_0xd5a2('0x4')]({'attributes':['id'],'raw':!![]})[_0xd5a2('0x5')](function(_0x1a64be){_0x3f5206[_0xd5a2('0x6')](_0xd5a2('0x7'),_0x1a64be[_0xd5a2('0x8')](function(_0x338b8f){return{'id':_0x338b8f['id']};}));return FaxMessage[_0xd5a2('0x9')]({'where':{'FaxInteractionId':_0x3f5206['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd5a2('0x5')](function(_0x4630b0){_0x3f5206['setDataValue']('unreadMessages',_0x4630b0['length']);FaxInteractionEvents[_0xd5a2('0xa')](_0x4ab0ad+':'+_0x3f5206['id'],_0x3f5206);FaxInteractionEvents[_0xd5a2('0xa')](_0x4ab0ad,_0x3f5206);_0x2d6690(null);})['catch'](_0x2d6690(null));};}for(var e in events){if(events[_0xd5a2('0xb')](e)){var event=events[e];FaxInteraction[_0xd5a2('0xc')](e,emitEvent(event));}}module[_0xd5a2('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index b29479d..b344b40 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 _0x39f3=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39f3,0x181));var _0x339f=function(_0x3642aa,_0x15e032){_0x3642aa=_0x3642aa-0x0;var _0x4e05b4=_0x39f3[_0x3642aa];return _0x4e05b4;};'use strict';var _=require(_0x339f('0x0'));var util=require(_0x339f('0x1'));var logger=require(_0x339f('0x2'))('api');var moment=require(_0x339f('0x3'));var BPromise=require(_0x339f('0x4'));var rp=require(_0x339f('0x5'));var fs=require('fs');var path=require(_0x339f('0x6'));var rimraf=require(_0x339f('0x7'));var config=require('../../config/environment');var attributes=require(_0x339f('0x8'));module[_0x339f('0x9')]=function(_0x13dfe8,_0x1f7a19){return _0x13dfe8[_0x339f('0xa')](_0x339f('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49afdb,_0x5bf23,_0x1ce1f5){if(_0x49afdb[_0x339f('0xc')](_0x339f('0xd'))){_0x49afdb['closedAt']=moment()[_0x339f('0xe')](_0x339f('0xf'));}_0x1ce1f5(null,_0x49afdb);}}});}; \ No newline at end of file +var _0x0137=['moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','fax_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger','api'];(function(_0xdc65e6,_0x3f4c38){var _0x492a9d=function(_0x18a6f2){while(--_0x18a6f2){_0xdc65e6['push'](_0xdc65e6['shift']());}};_0x492a9d(++_0x3f4c38);}(_0x0137,0x1d8));var _0x7013=function(_0x4fdb79,_0x12c116){_0x4fdb79=_0x4fdb79-0x0;var _0x3ec15b=_0x0137[_0x4fdb79];return _0x3ec15b;};'use strict';var _=require(_0x7013('0x0'));var util=require(_0x7013('0x1'));var logger=require(_0x7013('0x2'))(_0x7013('0x3'));var moment=require(_0x7013('0x4'));var BPromise=require('bluebird');var rp=require(_0x7013('0x5'));var fs=require('fs');var path=require(_0x7013('0x6'));var rimraf=require(_0x7013('0x7'));var config=require(_0x7013('0x8'));var attributes=require(_0x7013('0x9'));module[_0x7013('0xa')]=function(_0x50b822,_0x24cb85){return _0x50b822[_0x7013('0xb')]('FaxInteraction',attributes,{'tableName':_0x7013('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16dae3,_0x1b748c,_0x56d571){if(_0x16dae3[_0x7013('0xd')](_0x7013('0xe'))){_0x16dae3[_0x7013('0xf')]=moment()[_0x7013('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x56d571(null,_0x16dae3);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 33e52f0..17f4c6d 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 _0xd0b7=['FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxInteraction','body','options','raw','where','attributes','limit','stringify','AddTagsToFaxInteraction','FaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3806e6,_0x2f55d1){var _0x43aea8=function(_0x3c9928){while(--_0x3c9928){_0x3806e6['push'](_0x3806e6['shift']());}};_0x43aea8(++_0x2f55d1);}(_0xd0b7,0x9d));var _0x7d0b=function(_0x52962c,_0x20b91d){_0x52962c=_0x52962c-0x0;var _0x92b01b=_0xd0b7[_0x52962c];return _0x92b01b;};'use strict';var _=require(_0x7d0b('0x0'));var util=require('util');var moment=require(_0x7d0b('0x1'));var BPromise=require(_0x7d0b('0x2'));var rs=require(_0x7d0b('0x3'));var fs=require('fs');var Redis=require(_0x7d0b('0x4'));var db=require(_0x7d0b('0x5'))['db'];var utils=require(_0x7d0b('0x6'));var logger=require(_0x7d0b('0x7'))(_0x7d0b('0x8'));var config=require('../../config/environment');var jayson=require(_0x7d0b('0x9'));var client=jayson[_0x7d0b('0xa')][_0x7d0b('0xb')]({'port':0x232a});config['redis']=_[_0x7d0b('0xc')](config['redis'],{'host':_0x7d0b('0xd'),'port':0x18eb});var socket=require(_0x7d0b('0xe'))(new Redis(config[_0x7d0b('0xf')]));require(_0x7d0b('0x10'))['register'](socket);function respondWithRpcPromise(_0x5c2023,_0x505f67,_0x44a02b){return new BPromise(function(_0x3cef99,_0x4d5571){return client[_0x7d0b('0x11')](_0x5c2023,_0x44a02b)[_0x7d0b('0x12')](function(_0x4f84de){logger[_0x7d0b('0x13')](_0x7d0b('0x14'),_0x505f67,_0x7d0b('0x15'));logger[_0x7d0b('0x16')](_0x7d0b('0x17'),_0x505f67,_0x7d0b('0x15'),JSON['stringify'](_0x4f84de));if(_0x4f84de[_0x7d0b('0x18')]){if(_0x4f84de['error'][_0x7d0b('0x19')]===0x1f4){logger[_0x7d0b('0x18')](_0x7d0b('0x14'),_0x505f67,_0x4f84de[_0x7d0b('0x18')][_0x7d0b('0x1a')]);return _0x4d5571(_0x4f84de[_0x7d0b('0x18')]['message']);}logger[_0x7d0b('0x18')](_0x7d0b('0x14'),_0x505f67,_0x4f84de[_0x7d0b('0x18')]['message']);return _0x3cef99(_0x4f84de[_0x7d0b('0x18')][_0x7d0b('0x1a')]);}else{logger[_0x7d0b('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x505f67,_0x7d0b('0x15'));_0x3cef99(_0x4f84de[_0x7d0b('0x1b')]['message']);}})[_0x7d0b('0x1c')](function(_0x3e667d){logger[_0x7d0b('0x18')]('FaxInteraction,\x20%s,\x20%s',_0x505f67,_0x3e667d);_0x4d5571(_0x3e667d);});});}exports[_0x7d0b('0x1d')]=function(_0x296da5){var _0x35065a=this;return new Promise(function(_0x42d581,_0x5fc22c){return db['FaxInteraction']['update'](_0x296da5[_0x7d0b('0x1e')],{'raw':_0x296da5[_0x7d0b('0x1f')]?_0x296da5[_0x7d0b('0x1f')][_0x7d0b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x296da5[_0x7d0b('0x1f')]?_0x296da5[_0x7d0b('0x1f')][_0x7d0b('0x21')]||null:null,'attributes':_0x296da5['options']?_0x296da5[_0x7d0b('0x1f')][_0x7d0b('0x22')]||null:null,'limit':_0x296da5[_0x7d0b('0x1f')]?_0x296da5[_0x7d0b('0x1f')][_0x7d0b('0x23')]||null:null})[_0x7d0b('0x12')](function(_0x1d70f5){logger['info'](_0x7d0b('0x1d'),_0x296da5);logger['debug'](_0x7d0b('0x1d'),_0x296da5,JSON[_0x7d0b('0x24')](_0x1d70f5));_0x42d581(_0x1d70f5);})[_0x7d0b('0x1c')](function(_0x2bc6a5){logger[_0x7d0b('0x18')]('UpdateFaxInteraction',_0x2bc6a5[_0x7d0b('0x1a')],_0x296da5);_0x5fc22c(_0x35065a['error'](0x1f4,_0x2bc6a5[_0x7d0b('0x1a')]));});});};exports[_0x7d0b('0x25')]=function(_0x22cb35){return new Promise(function(_0x2aea0f,_0xa7d4aa){return db[_0x7d0b('0x26')][_0x7d0b('0x27')]({'where':_0x22cb35[_0x7d0b('0x1f')]?_0x22cb35[_0x7d0b('0x1f')][_0x7d0b('0x21')]||null:null})[_0x7d0b('0x12')](function(_0x4fb515){if(_0x4fb515){return _0x4fb515[_0x7d0b('0x28')](_0x22cb35[_0x7d0b('0x1e')][_0x7d0b('0x29')],_[_0x7d0b('0x2a')](_0x22cb35[_0x7d0b('0x1e')],[_0x7d0b('0x29'),'id'])||{});}})[_0x7d0b('0x2b')](function(_0x3fe0e2){logger['info'](_0x7d0b('0x2c'),_0x22cb35);logger[_0x7d0b('0x16')]('AddTags',_0x22cb35,JSON[_0x7d0b('0x24')](_0x3fe0e2));_0x2aea0f(_0x3fe0e2);})['catch'](function(_0xb7e8a1){logger['error']('AddTags',_0xb7e8a1[_0x7d0b('0x1a')],_0x22cb35);_0xa7d4aa(_this['error'](0x1f4,_0xb7e8a1[_0x7d0b('0x1a')]));});});}; \ No newline at end of file +var _0xdfe7=['register','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UpdateFaxInteraction','update','body','options','raw','where','attributes','limit','debug','catch','AddTagsToFaxInteraction','FaxInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket'];(function(_0x3a2180,_0x2b31bb){var _0x44d72e=function(_0x358826){while(--_0x358826){_0x3a2180['push'](_0x3a2180['shift']());}};_0x44d72e(++_0x2b31bb);}(_0xdfe7,0xfc));var _0x7dfe=function(_0x5a02fa,_0x17aa52){_0x5a02fa=_0x5a02fa-0x0;var _0x158cca=_0xdfe7[_0x5a02fa];return _0x158cca;};'use strict';var _=require(_0x7dfe('0x0'));var util=require(_0x7dfe('0x1'));var moment=require(_0x7dfe('0x2'));var BPromise=require(_0x7dfe('0x3'));var rs=require(_0x7dfe('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7dfe('0x5'))['db'];var utils=require(_0x7dfe('0x6'));var logger=require(_0x7dfe('0x7'))(_0x7dfe('0x8'));var config=require(_0x7dfe('0x9'));var jayson=require(_0x7dfe('0xa'));var client=jayson[_0x7dfe('0xb')][_0x7dfe('0xc')]({'port':0x232a});config['redis']=_[_0x7dfe('0xd')](config[_0x7dfe('0xe')],{'host':_0x7dfe('0xf'),'port':0x18eb});var socket=require(_0x7dfe('0x10'))(new Redis(config['redis']));require(_0x7dfe('0x11'))[_0x7dfe('0x12')](socket);function respondWithRpcPromise(_0x3fe16a,_0x40b683,_0x46e829){return new BPromise(function(_0x470e4d,_0x1d11da){return client[_0x7dfe('0x13')](_0x3fe16a,_0x46e829)[_0x7dfe('0x14')](function(_0x5b5e84){logger[_0x7dfe('0x15')](_0x7dfe('0x16'),_0x40b683,_0x7dfe('0x17'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x40b683,_0x7dfe('0x17'),JSON[_0x7dfe('0x18')](_0x5b5e84));if(_0x5b5e84[_0x7dfe('0x19')]){if(_0x5b5e84['error'][_0x7dfe('0x1a')]===0x1f4){logger['error'](_0x7dfe('0x16'),_0x40b683,_0x5b5e84[_0x7dfe('0x19')][_0x7dfe('0x1b')]);return _0x1d11da(_0x5b5e84[_0x7dfe('0x19')][_0x7dfe('0x1b')]);}logger['error']('FaxInteraction,\x20%s,\x20%s',_0x40b683,_0x5b5e84[_0x7dfe('0x19')]['message']);return _0x470e4d(_0x5b5e84[_0x7dfe('0x19')][_0x7dfe('0x1b')]);}else{logger[_0x7dfe('0x15')](_0x7dfe('0x16'),_0x40b683,_0x7dfe('0x17'));_0x470e4d(_0x5b5e84['result'][_0x7dfe('0x1b')]);}})['catch'](function(_0x1e90fe){logger[_0x7dfe('0x19')](_0x7dfe('0x16'),_0x40b683,_0x1e90fe);_0x1d11da(_0x1e90fe);});});}exports[_0x7dfe('0x1c')]=function(_0x26c1da){var _0x4e1af4=this;return new Promise(function(_0x3d0b09,_0x4dfbaa){return db['FaxInteraction'][_0x7dfe('0x1d')](_0x26c1da[_0x7dfe('0x1e')],{'raw':_0x26c1da['options']?_0x26c1da[_0x7dfe('0x1f')][_0x7dfe('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26c1da[_0x7dfe('0x1f')]?_0x26c1da[_0x7dfe('0x1f')][_0x7dfe('0x21')]||null:null,'attributes':_0x26c1da[_0x7dfe('0x1f')]?_0x26c1da[_0x7dfe('0x1f')][_0x7dfe('0x22')]||null:null,'limit':_0x26c1da['options']?_0x26c1da[_0x7dfe('0x1f')][_0x7dfe('0x23')]||null:null})[_0x7dfe('0x14')](function(_0x5101b3){logger['info']('UpdateFaxInteraction',_0x26c1da);logger[_0x7dfe('0x24')](_0x7dfe('0x1c'),_0x26c1da,JSON[_0x7dfe('0x18')](_0x5101b3));_0x3d0b09(_0x5101b3);})[_0x7dfe('0x25')](function(_0x9bdbc8){logger['error'](_0x7dfe('0x1c'),_0x9bdbc8[_0x7dfe('0x1b')],_0x26c1da);_0x4dfbaa(_0x4e1af4[_0x7dfe('0x19')](0x1f4,_0x9bdbc8[_0x7dfe('0x1b')]));});});};exports[_0x7dfe('0x26')]=function(_0x53da7c){return new Promise(function(_0x7fbf6f,_0x1e946d){return db[_0x7dfe('0x27')][_0x7dfe('0x28')]({'where':_0x53da7c[_0x7dfe('0x1f')]?_0x53da7c[_0x7dfe('0x1f')][_0x7dfe('0x21')]||null:null})[_0x7dfe('0x14')](function(_0x59d674){if(_0x59d674){return _0x59d674['addTags'](_0x53da7c['body'][_0x7dfe('0x29')],_[_0x7dfe('0x2a')](_0x53da7c[_0x7dfe('0x1e')],[_0x7dfe('0x29'),'id'])||{});}})[_0x7dfe('0x2b')](function(_0x3384b7){logger[_0x7dfe('0x15')](_0x7dfe('0x2c'),_0x53da7c);logger[_0x7dfe('0x24')]('AddTags',_0x53da7c,JSON[_0x7dfe('0x18')](_0x3384b7));_0x7fbf6f(_0x3384b7);})[_0x7dfe('0x25')](function(_0x43e54a){logger['error'](_0x7dfe('0x2c'),_0x43e54a['message'],_0x53da7c);_0x1e946d(_this[_0x7dfe('0x19')](0x1f4,_0x43e54a['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 5078e95..368306f 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 _0x8477=['update','removeListener','length','save'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x8477,0xbb));var _0x7847=function(_0x2f8530,_0x5cbd67){_0x2f8530=_0x2f8530-0x0;var _0x5e814e=_0x8477[_0x2f8530];return _0x5e814e;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x7847('0x0'),'remove',_0x7847('0x1')];function createListener(_0x318482,_0x3a111c){return function(_0xccc298){_0x3a111c['emit'](_0x318482,_0xccc298);};}function removeListener(_0x293a8f,_0x1437ef){return function(){FaxInteractionEvents[_0x7847('0x2')](_0x293a8f,_0x1437ef);};}exports['register']=function(_0x3335dd){for(var _0x9a8ab4=0x0,_0x2e2963=events[_0x7847('0x3')];_0x9a8ab4<_0x2e2963;_0x9a8ab4++){var _0x2380b5=events[_0x9a8ab4];var _0x57e84d=createListener('faxInteraction:'+_0x2380b5,_0x3335dd);FaxInteractionEvents['on'](_0x2380b5,_0x57e84d);}}; \ No newline at end of file +var _0xbbc9=['emit','removeListener','length','./faxInteraction.events','save','update'];(function(_0x29cfb4,_0x2154b9){var _0xf782a8=function(_0x2d8e25){while(--_0x2d8e25){_0x29cfb4['push'](_0x29cfb4['shift']());}};_0xf782a8(++_0x2154b9);}(_0xbbc9,0x195));var _0x9bbc=function(_0x472ff2,_0x559096){_0x472ff2=_0x472ff2-0x0;var _0x5b4ce1=_0xbbc9[_0x472ff2];return _0x5b4ce1;};'use strict';var FaxInteractionEvents=require(_0x9bbc('0x0'));var events=[_0x9bbc('0x1'),'remove',_0x9bbc('0x2')];function createListener(_0x319e19,_0x5abb79){return function(_0xf2fb09){_0x5abb79[_0x9bbc('0x3')](_0x319e19,_0xf2fb09);};}function removeListener(_0x188bfa,_0x36cfb5){return function(){FaxInteractionEvents[_0x9bbc('0x4')](_0x188bfa,_0x36cfb5);};}exports['register']=function(_0x4d7ccc){for(var _0xcf0ce8=0x0,_0x3c58d1=events[_0x9bbc('0x5')];_0xcf0ce8<_0x3c58d1;_0xcf0ce8++){var _0x1361c4=events[_0xcf0ce8];var _0x14f33d=createListener('faxInteraction:'+_0x1361c4,_0x4d7ccc);FaxInteractionEvents['on'](_0x1361c4,_0x14f33d);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9a9facd..3a45d1d 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 _0xa6cd=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','faxinteraction:update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path'];(function(_0x421263,_0x18187d){var _0x34e4b5=function(_0x4e7978){while(--_0x4e7978){_0x421263['push'](_0x421263['shift']());}};_0x34e4b5(++_0x18187d);}(_0xa6cd,0x171));var _0xda6c=function(_0x558c26,_0x5aa06f){_0x558c26=_0x558c26-0x0;var _0x2e6289=_0xa6cd[_0x558c26];return _0x2e6289;};'use strict';var multer=require(_0xda6c('0x0'));var util=require(_0xda6c('0x1'));var path=require(_0xda6c('0x2'));var timeout=require(_0xda6c('0x3'));var express=require(_0xda6c('0x4'));var router=express[_0xda6c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xda6c('0x6'));var interaction=require(_0xda6c('0x7'));var config=require(_0xda6c('0x8'));var controller=require(_0xda6c('0x9'));router[_0xda6c('0xa')]('/',auth[_0xda6c('0xb')](),controller[_0xda6c('0xc')]);router[_0xda6c('0xa')](_0xda6c('0xd'),auth[_0xda6c('0xb')](),controller[_0xda6c('0xe')]);router[_0xda6c('0xa')](_0xda6c('0xf'),auth[_0xda6c('0xb')](),controller['show']);router[_0xda6c('0xa')](_0xda6c('0x10'),auth[_0xda6c('0xb')](),controller[_0xda6c('0x11')]);router[_0xda6c('0xa')]('/:id/download',auth[_0xda6c('0xb')](),controller[_0xda6c('0x12')]);router[_0xda6c('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xda6c('0x10'),auth['isAuthenticated'](),controller[_0xda6c('0x14')]);router[_0xda6c('0x13')](_0xda6c('0x15'),auth[_0xda6c('0xb')](),interaction[_0xda6c('0x16')](_0xda6c('0x17'),_0xda6c('0x18')),controller['addTags']);router['put'](_0xda6c('0xf'),auth[_0xda6c('0xb')](),interaction[_0xda6c('0x16')](_0xda6c('0x17'),_0xda6c('0x19')),controller['update']);router[_0xda6c('0x1a')]('/:id',auth['isAuthenticated'](),interaction['tracked']('fax',_0xda6c('0x1b')),controller[_0xda6c('0x1c')]);router[_0xda6c('0x1a')](_0xda6c('0x15'),auth['isAuthenticated'](),controller[_0xda6c('0x1d')]);module[_0xda6c('0x1e')]=router; \ No newline at end of file +var _0x919c=['post','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','update','delete','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','create'];(function(_0x993e7d,_0x4b7f76){var _0x4de01e=function(_0x63a895){while(--_0x63a895){_0x993e7d['push'](_0x993e7d['shift']());}};_0x4de01e(++_0x4b7f76);}(_0x919c,0xcc));var _0xc919=function(_0x2bdac,_0x5b0a5f){_0x2bdac=_0x2bdac-0x0;var _0x281d09=_0x919c[_0x2bdac];return _0x281d09;};'use strict';var multer=require(_0xc919('0x0'));var util=require('util');var path=require(_0xc919('0x1'));var timeout=require(_0xc919('0x2'));var express=require(_0xc919('0x3'));var router=express[_0xc919('0x4')]();var fs_extra=require(_0xc919('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc919('0x6'));var config=require(_0xc919('0x7'));var controller=require(_0xc919('0x8'));router[_0xc919('0x9')]('/',auth[_0xc919('0xa')](),controller[_0xc919('0xb')]);router[_0xc919('0x9')](_0xc919('0xc'),auth['isAuthenticated'](),controller[_0xc919('0xd')]);router[_0xc919('0x9')](_0xc919('0xe'),auth[_0xc919('0xa')](),controller['show']);router[_0xc919('0x9')](_0xc919('0xf'),auth['isAuthenticated'](),controller[_0xc919('0x10')]);router[_0xc919('0x9')](_0xc919('0x11'),auth['isAuthenticated'](),controller[_0xc919('0x12')]);router['post']('/',auth[_0xc919('0xa')](),controller[_0xc919('0x13')]);router[_0xc919('0x14')](_0xc919('0xf'),auth[_0xc919('0xa')](),controller[_0xc919('0x15')]);router[_0xc919('0x14')](_0xc919('0x16'),auth['isAuthenticated'](),interaction[_0xc919('0x17')](_0xc919('0x18'),_0xc919('0x19')),controller[_0xc919('0x1a')]);router['put'](_0xc919('0xe'),auth[_0xc919('0xa')](),interaction[_0xc919('0x17')](_0xc919('0x18'),'faxinteraction:update'),controller[_0xc919('0x1b')]);router[_0xc919('0x1c')](_0xc919('0xe'),auth[_0xc919('0xa')](),interaction[_0xc919('0x17')](_0xc919('0x18'),'faxinteraction:destroy'),controller[_0xc919('0x1d')]);router[_0xc919('0x1c')]('/:id/tags',auth[_0xc919('0xa')](),controller[_0xc919('0x1e')]);module[_0xc919('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 a405ad6..9606212 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 _0xe5d5=['out','DATE','TEXT','BOOLEAN'];(function(_0x842ca2,_0x298fcf){var _0x4fad1a=function(_0x3b28cf){while(--_0x3b28cf){_0x842ca2['push'](_0x842ca2['shift']());}};_0x4fad1a(++_0x298fcf);}(_0xe5d5,0x156));var _0x5e5d=function(_0x344c80,_0x2ddc9d){_0x344c80=_0x344c80-0x0;var _0x1b29f5=_0xe5d5[_0x344c80];return _0x1b29f5;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x5e5d('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x5e5d('0x1')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5e5d('0x2')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x5e5d('0x0')],'defaultValue':null},'readAt':{'type':Sequelize[_0x5e5d('0x3')]}}; \ No newline at end of file +var _0xde9d=['sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xde9d,0x156));var _0xdde9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde9d[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xdde9('0x0'));module[_0xdde9('0x1')]={'body':{'type':Sequelize[_0xdde9('0x2')](_0xdde9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdde9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xdde9('0x5')),'defaultValue':_0xdde9('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xdde9('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 5456600..1b27c91 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 _0xe274=['message','result','catch','status','end','json','limit','undefined','count','offset','set','apply','save','update','destroy','sendStatus','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','show','keys','find','body','params','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','FaxInteraction','isNil','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','agent','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','fax-interactions','reject','fax','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','attachments','basename','eml-format','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x25a0b9,_0x86e28f){var _0x30b9ab=function(_0x883a4){while(--_0x883a4){_0x25a0b9['push'](_0x25a0b9['shift']());}};_0x30b9ab(++_0x86e28f);}(_0xe274,0x177));var _0x4e27=function(_0x477a06,_0x4e676b){_0x477a06=_0x477a06-0x0;var _0x5d34c7=_0xe274[_0x477a06];return _0x5d34c7;};'use strict';var emlformat=require(_0x4e27('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4e27('0x1'));var rp=require(_0x4e27('0x2'));var moment=require('moment');var BPromise=require(_0x4e27('0x3'));var Mustache=require('mustache');var util=require(_0x4e27('0x4'));var path=require(_0x4e27('0x5'));var sox=require('sox');var csv=require(_0x4e27('0x6'));var ejs=require(_0x4e27('0x7'));var fs=require('fs');var fs_extra=require(_0x4e27('0x8'));var _=require(_0x4e27('0x9'));var squel=require(_0x4e27('0xa'));var crypto=require(_0x4e27('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4e27('0xc'));var Papa=require('papaparse');var Redis=require(_0x4e27('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x4e27('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e27('0xf'));var logger=require(_0x4e27('0x10'))(_0x4e27('0x11'));var utils=require(_0x4e27('0x12'));var config=require(_0x4e27('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4e27('0x14'))['db'];config[_0x4e27('0x15')]=_['defaults'](config[_0x4e27('0x15')],{'host':_0x4e27('0x16'),'port':0x18eb});var socket=require(_0x4e27('0x17'))(new Redis(config['redis']));require(_0x4e27('0x18'))[_0x4e27('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4e27('0x1a')][_0x4e27('0x1b')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a7f06,_0x326339,_0x1721dc,_0x1b6142){return new BPromise(function(_0x5c131c,_0x48b0aa){var _0xa491c6=_0x1b6142||client;return _0xa491c6['request'](_0x4a7f06,_0x1721dc)[_0x4e27('0x1c')](function(_0xc83ae){logger[_0x4e27('0x1d')](_0x4e27('0x1e'),_0x326339,_0x4e27('0x1f'));logger['debug'](_0x4e27('0x20'),_0x326339,_0x4e27('0x1f'),JSON[_0x4e27('0x21')](_0xc83ae));if(_0xc83ae['error']){if(_0xc83ae[_0x4e27('0x22')][_0x4e27('0x23')]===0x1f4){logger[_0x4e27('0x22')](_0x4e27('0x1e'),_0x326339,_0xc83ae[_0x4e27('0x22')][_0x4e27('0x24')]);return _0x48b0aa(_0xc83ae[_0x4e27('0x22')][_0x4e27('0x24')]);}logger[_0x4e27('0x22')](_0x4e27('0x1e'),_0x326339,_0xc83ae[_0x4e27('0x22')]['message']);return _0x5c131c(_0xc83ae[_0x4e27('0x22')][_0x4e27('0x24')]);}else{logger['info'](_0x4e27('0x1e'),_0x326339,_0x4e27('0x1f'));_0x5c131c(_0xc83ae[_0x4e27('0x25')][_0x4e27('0x24')]);}})[_0x4e27('0x26')](function(_0x57635b){logger[_0x4e27('0x22')](_0x4e27('0x1e'),_0x326339,_0x57635b);_0x48b0aa(_0x57635b);});});}function respondWithStatusCode(_0x2e34d1,_0x3b8c30){_0x3b8c30=_0x3b8c30||0xcc;return function(_0x47baa5){if(_0x47baa5){return _0x2e34d1['sendStatus'](_0x3b8c30);}return _0x2e34d1[_0x4e27('0x27')](_0x3b8c30)[_0x4e27('0x28')]();};}function respondWithResult(_0xc33b63,_0x293b86){_0x293b86=_0x293b86||0xc8;return function(_0x38bc5f){if(_0x38bc5f){return _0xc33b63['status'](_0x293b86)[_0x4e27('0x29')](_0x38bc5f);}};}function respondWithFilteredResult(_0x3a274e,_0x911ca5){return function(_0x4ff34a){if(_0x4ff34a){var _0x459e77=typeof _0x911ca5['offset']==='undefined'&&typeof _0x911ca5[_0x4e27('0x2a')]===_0x4e27('0x2b');var _0x5caa11=_0x4ff34a[_0x4e27('0x2c')];var _0xc39766=_0x459e77?0x0:_0x911ca5['offset'];var _0x361be8=_0x459e77?_0x4ff34a[_0x4e27('0x2c')]:_0x911ca5[_0x4e27('0x2d')]+_0x911ca5[_0x4e27('0x2a')];var _0xbc856c;if(_0x361be8>=_0x5caa11){_0x361be8=_0x5caa11;_0xbc856c=0xc8;}else{_0xbc856c=0xce;}_0x3a274e[_0x4e27('0x27')](_0xbc856c);return _0x3a274e[_0x4e27('0x2e')]('Content-Range',_0xc39766+'-'+_0x361be8+'/'+_0x5caa11)['json'](_0x4ff34a);}return null;};}function patchUpdates(_0x409334){return function(_0x460129){try{jsonpatch[_0x4e27('0x2f')](_0x460129,_0x409334,!![]);}catch(_0x25af52){return BPromise['reject'](_0x25af52);}return _0x460129[_0x4e27('0x30')]();};}function saveUpdates(_0x1e5484,_0x75be67){return function(_0x16ae8e){if(_0x16ae8e){return _0x16ae8e[_0x4e27('0x31')](_0x1e5484)[_0x4e27('0x1c')](function(_0x4c1b6c){return _0x4c1b6c;});}return null;};}function removeEntity(_0x2d760f,_0x4eb569){return function(_0x37bee0){if(_0x37bee0){return _0x37bee0[_0x4e27('0x32')]()['then'](function(){_0x2d760f[_0x4e27('0x27')](0xcc)[_0x4e27('0x28')]();});}};}function handleEntityNotFound(_0x4fc240,_0x278431){return function(_0x3a2557){if(!_0x3a2557){_0x4fc240[_0x4e27('0x33')](0x194);}return _0x3a2557;};}function handleError(_0x4ceedb,_0x6cfb70){_0x6cfb70=_0x6cfb70||0x1f4;return function(_0x238db6){logger[_0x4e27('0x22')](_0x238db6[_0x4e27('0x34')]);if(_0x238db6['name']){delete _0x238db6[_0x4e27('0x35')];}_0x4ceedb['status'](_0x6cfb70)[_0x4e27('0x36')](_0x238db6);};}exports[_0x4e27('0x37')]=function(_0x29abcf,_0x361629){var _0x31481b={},_0x2db7fc={},_0x2a0b42={'count':0x0,'rows':[]};var _0x3c64b4=_['map'](db[_0x4e27('0x38')][_0x4e27('0x39')],function(_0x56f07c){return{'name':_0x56f07c[_0x4e27('0x3a')],'type':_0x56f07c[_0x4e27('0x3b')][_0x4e27('0x3c')]};});_0x2db7fc[_0x4e27('0x3d')]=_[_0x4e27('0x3e')](_0x3c64b4,'name');_0x2db7fc[_0x4e27('0x3f')]=_['keys'](_0x29abcf[_0x4e27('0x3f')]);_0x2db7fc[_0x4e27('0x40')]=_[_0x4e27('0x41')](_0x2db7fc[_0x4e27('0x3d')],_0x2db7fc['query']);_0x31481b[_0x4e27('0x42')]=_['intersection'](_0x2db7fc[_0x4e27('0x3d')],qs[_0x4e27('0x43')](_0x29abcf[_0x4e27('0x3f')]['fields']));_0x31481b[_0x4e27('0x42')]=_0x31481b['attributes'][_0x4e27('0x44')]?_0x31481b[_0x4e27('0x42')]:_0x2db7fc[_0x4e27('0x3d')];if(!_0x29abcf[_0x4e27('0x3f')][_0x4e27('0x45')](_0x4e27('0x46'))){_0x31481b['limit']=qs['limit'](_0x29abcf['query'][_0x4e27('0x2a')]);_0x31481b['offset']=qs[_0x4e27('0x2d')](_0x29abcf[_0x4e27('0x3f')][_0x4e27('0x2d')]);}_0x31481b['order']=qs[_0x4e27('0x47')](_0x29abcf[_0x4e27('0x3f')][_0x4e27('0x47')]);_0x31481b[_0x4e27('0x48')]=qs[_0x4e27('0x40')](_[_0x4e27('0x49')](_0x29abcf[_0x4e27('0x3f')],_0x2db7fc[_0x4e27('0x40')]),_0x3c64b4);if(_0x29abcf[_0x4e27('0x3f')][_0x4e27('0x4a')]){_0x31481b[_0x4e27('0x48')]=_[_0x4e27('0x4b')](_0x31481b[_0x4e27('0x48')],{'$or':_[_0x4e27('0x3e')](_0x3c64b4,function(_0x10508b){if(_0x10508b[_0x4e27('0x3b')]!=='VIRTUAL'){var _0x27da42={};_0x27da42[_0x10508b[_0x4e27('0x35')]]={'$like':'%'+_0x29abcf[_0x4e27('0x3f')][_0x4e27('0x4a')]+'%'};return _0x27da42;}})});}_0x31481b=_[_0x4e27('0x4b')]({},_0x31481b,_0x29abcf[_0x4e27('0x4c')]);var _0x4d1f6e={'where':_0x31481b[_0x4e27('0x48')]};return db[_0x4e27('0x38')][_0x4e27('0x2c')](_0x4d1f6e)[_0x4e27('0x1c')](function(_0x20015f){_0x2a0b42[_0x4e27('0x2c')]=_0x20015f;if(_0x29abcf['query'][_0x4e27('0x4d')]){_0x31481b['include']=[{'all':!![]}];}return db[_0x4e27('0x38')]['findAll'](_0x31481b);})['then'](function(_0x2a8b5d){_0x2a0b42['rows']=_0x2a8b5d;return _0x2a0b42;})['then'](respondWithFilteredResult(_0x361629,_0x31481b))[_0x4e27('0x26')](handleError(_0x361629,null));};exports[_0x4e27('0x4e')]=function(_0x172ff1,_0x12b284){var _0x269de0={'raw':!![],'where':{'id':_0x172ff1['params']['id']}},_0x4c21a5={};_0x4c21a5[_0x4e27('0x3d')]=_[_0x4e27('0x4f')](db['FaxMessage'][_0x4e27('0x39')]);_0x4c21a5['query']=_['keys'](_0x172ff1[_0x4e27('0x3f')]);_0x4c21a5[_0x4e27('0x40')]=_[_0x4e27('0x41')](_0x4c21a5[_0x4e27('0x3d')],_0x4c21a5[_0x4e27('0x3f')]);_0x269de0[_0x4e27('0x42')]=_[_0x4e27('0x41')](_0x4c21a5[_0x4e27('0x3d')],qs[_0x4e27('0x43')](_0x172ff1[_0x4e27('0x3f')]['fields']));_0x269de0[_0x4e27('0x42')]=_0x269de0[_0x4e27('0x42')][_0x4e27('0x44')]?_0x269de0[_0x4e27('0x42')]:_0x4c21a5['model'];if(_0x172ff1[_0x4e27('0x3f')][_0x4e27('0x4d')]){_0x269de0['include']=[{'all':!![]}];}_0x269de0=_[_0x4e27('0x4b')]({},_0x269de0,_0x172ff1[_0x4e27('0x4c')]);return db[_0x4e27('0x38')][_0x4e27('0x50')](_0x269de0)[_0x4e27('0x1c')](handleEntityNotFound(_0x12b284,null))[_0x4e27('0x1c')](respondWithResult(_0x12b284,null))[_0x4e27('0x26')](handleError(_0x12b284,null));};exports['update']=function(_0xd2c2a6,_0x58a4b1){if(_0xd2c2a6[_0x4e27('0x51')]['id']){delete _0xd2c2a6['body']['id'];}return db[_0x4e27('0x38')][_0x4e27('0x50')]({'where':{'id':_0xd2c2a6['params']['id']}})[_0x4e27('0x1c')](handleEntityNotFound(_0x58a4b1,null))[_0x4e27('0x1c')](saveUpdates(_0xd2c2a6['body'],null))[_0x4e27('0x1c')](respondWithResult(_0x58a4b1,null))['catch'](handleError(_0x58a4b1,null));};exports[_0x4e27('0x32')]=function(_0x3cc638,_0x1e440a){return db[_0x4e27('0x38')][_0x4e27('0x50')]({'where':{'id':_0x3cc638[_0x4e27('0x52')]['id']}})[_0x4e27('0x1c')](handleEntityNotFound(_0x1e440a,null))[_0x4e27('0x1c')](removeEntity(_0x1e440a,null))[_0x4e27('0x26')](handleError(_0x1e440a,null));};exports['describe']=function(_0x5942ac,_0x222b66){return db[_0x4e27('0x38')]['describe']()[_0x4e27('0x1c')](respondWithResult(_0x222b66,null))[_0x4e27('0x26')](handleError(_0x222b66,null));};var interaction_log=require(_0x4e27('0x10'))('fax-interactions');exports['accept']=function(_0x59d3b9,_0x278920,_0x348a50){var _0x5103d8={'agent':{},'channel':'fax'};if(_0x59d3b9[_0x4e27('0x51')]['id']){delete _0x59d3b9[_0x4e27('0x51')]['id'];}_0x59d3b9[_0x4e27('0x51')]['read']=!![];_0x59d3b9[_0x4e27('0x51')][_0x4e27('0x53')]=moment()[_0x4e27('0x54')](_0x4e27('0x55'));_0x59d3b9[_0x4e27('0x51')][_0x4e27('0x56')]=_0x59d3b9[_0x4e27('0x51')]['UserId']||_0x59d3b9['user']['id'];_0x5103d8['agent']['id']=_0x59d3b9['body'][_0x4e27('0x56')];return db[_0x4e27('0x38')][_0x4e27('0x50')]({'where':{'id':_0x59d3b9[_0x4e27('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x278920,null))[_0x4e27('0x1c')](saveUpdates(_0x59d3b9[_0x4e27('0x51')],null))[_0x4e27('0x1c')](function(_0x2e1cf2){if(_0x2e1cf2){_0x5103d8[_0x4e27('0x24')]=_0x2e1cf2[_0x4e27('0x57')]({'plain':!![]});return db[_0x4e27('0x58')][_0x4e27('0x50')]({'where':{'id':_0x2e1cf2['FaxInteractionId']}});}return null;})[_0x4e27('0x1c')](handleEntityNotFound(_0x278920,null))['then'](function(_0x20b6af){if(_0x20b6af){return _0x20b6af[_0x4e27('0x31')]({'UserId':_0x59d3b9['body'][_0x4e27('0x56')],'read1stAt':_[_0x4e27('0x59')](_0x20b6af['read1stAt'])?moment()[_0x4e27('0x54')](_0x4e27('0x55')):undefined});}return null;})[_0x4e27('0x1c')](function(_0x61713a){if(_0x61713a){_0x5103d8['interaction']=_0x61713a['get']({'plain':!![]});interaction_log['info'](_0x4e27('0x5a'),_0x59d3b9[_0x4e27('0x5b')]['id'],_0x59d3b9[_0x4e27('0x5b')][_0x4e27('0x35')],_0x59d3b9[_0x4e27('0x5b')][_0x4e27('0x5c')],_0x5103d8[_0x4e27('0x5d')]['id'],_0x59d3b9[_0x4e27('0x51')]?JSON['stringify'](_0x59d3b9[_0x4e27('0x51')]):_0x4e27('0x5e'));return respondWithRpcPromise(_0x4e27('0x5f'),_0x4e27('0x60'),_0x5103d8);}return null;})['then'](function(_0xafd28d){var _0x40e013=_0x4e27('0x61')+_0xafd28d[_0x4e27('0x24')][_0x4e27('0x62')];return db[_0x4e27('0x63')][_0x4e27('0x3f')](_0x40e013,{'type':db[_0x4e27('0x64')][_0x4e27('0x65')]['SELECT'],'raw':!![]})[_0x4e27('0x1c')](function(_0x2ea90){return _0x2ea90;});})[_0x4e27('0x1c')](function(_0xb43d0f){if(_0xb43d0f){_0x5103d8['message'][_0x4e27('0x66')]=_0xb43d0f[0x0];if(!_0x59d3b9[_0x4e27('0x51')][_0x4e27('0x56')])return;return db[_0x4e27('0x67')][_0x4e27('0x50')]({'where':{'id':_0x59d3b9[_0x4e27('0x51')][_0x4e27('0x56')],'role':_0x4e27('0x68')},'attributes':['id','name','fullname',_0x4e27('0x69'),_0x4e27('0x6a')],'raw':!![]});}return null;})[_0x4e27('0x1c')](function(_0xb1f6f6){if(!_0xb1f6f6)return null;_0x5103d8[_0x4e27('0x24')][_0x4e27('0x68')]=_0xb1f6f6;return _0x5103d8;})[_0x4e27('0x1c')](function(_0x59c21){if(_0x59c21){if(_0x59d3b9['body'][_0x4e27('0x6b')]){_0x5103d8[_0x4e27('0x24')][_0x4e27('0x6c')]=util[_0x4e27('0x54')](_0x4e27('0x6d'),_0x59d3b9[_0x4e27('0x5b')][_0x4e27('0x35')]);_0x5103d8[_0x4e27('0x24')]['channel']=_0x5103d8[_0x4e27('0x6e')];_0x5103d8[_0x4e27('0x24')][_0x4e27('0x6f')]=_0x4e27('0x70');return respondWithRpcPromise(_0x4e27('0x71'),_0x4e27('0x71'),{'event':_0x4e27('0x72'),'message':_0x5103d8[_0x4e27('0x24')]},client9002)[_0x4e27('0x1c')](function(){return _0x5103d8;});}return _0x5103d8;}return null;})[_0x4e27('0x1c')](respondWithResult(_0x278920,null))[_0x4e27('0x26')](handleError(_0x278920,null));};var interaction_log=require(_0x4e27('0x10'))(_0x4e27('0x73'));exports[_0x4e27('0x74')]=function(_0x152fc6,_0x517593,_0x53fa2d){var _0x221b85={'agent':{},'channel':_0x4e27('0x75')};if(_0x152fc6[_0x4e27('0x51')]['id']){delete _0x152fc6[_0x4e27('0x51')]['id'];}_0x152fc6[_0x4e27('0x51')][_0x4e27('0x56')]=_0x152fc6['body'][_0x4e27('0x56')]||_0x152fc6[_0x4e27('0x5b')]['id'];_0x221b85[_0x4e27('0x68')]['id']=_0x152fc6['body'][_0x4e27('0x56')];return db[_0x4e27('0x38')][_0x4e27('0x50')]({'where':{'id':_0x152fc6[_0x4e27('0x52')]['id'],'UserId':null}})[_0x4e27('0x1c')](handleEntityNotFound(_0x517593,null))[_0x4e27('0x1c')](function(_0x32893c){if(_0x32893c){_0x221b85[_0x4e27('0x24')]=_0x32893c[_0x4e27('0x57')]({'plain':!![]});return db[_0x4e27('0x58')][_0x4e27('0x50')]({'where':{'id':_0x32893c[_0x4e27('0x76')]}});}return null;})[_0x4e27('0x1c')](handleEntityNotFound(_0x517593,null))[_0x4e27('0x1c')](function(_0x1e01c3){if(_0x1e01c3){_0x221b85[_0x4e27('0x5d')]=_0x1e01c3[_0x4e27('0x57')]({'plain':!![]});interaction_log[_0x4e27('0x1d')](_0x4e27('0x77'),_0x152fc6['user']['id'],_0x152fc6[_0x4e27('0x5b')][_0x4e27('0x35')],_0x152fc6['user']['role'],_0x221b85[_0x4e27('0x5d')]['id'],_0x152fc6[_0x4e27('0x51')]?JSON[_0x4e27('0x21')](_0x152fc6[_0x4e27('0x51')]):'null');return respondWithRpcPromise('RejectMessage',_0x4e27('0x78'),_0x221b85);}return null;})[_0x4e27('0x1c')](function(_0x2b732c){var _0x3398ba='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b732c[_0x4e27('0x24')][_0x4e27('0x62')];return db[_0x4e27('0x63')]['query'](_0x3398ba,{'type':db[_0x4e27('0x64')][_0x4e27('0x65')][_0x4e27('0x79')],'raw':!![]})[_0x4e27('0x1c')](function(_0x5b3fec){return _0x5b3fec;});})[_0x4e27('0x1c')](function(_0x1fc5ef){if(_0x1fc5ef){_0x221b85['message'][_0x4e27('0x66')]=_0x1fc5ef[0x0];if(!_0x152fc6[_0x4e27('0x51')][_0x4e27('0x56')])return;return db[_0x4e27('0x67')]['find']({'where':{'id':_0x152fc6[_0x4e27('0x51')][_0x4e27('0x56')],'role':'agent'},'attributes':['id',_0x4e27('0x35'),'fullname',_0x4e27('0x69'),'internal'],'raw':!![]});}return null;})[_0x4e27('0x1c')](function(_0x5efcdf){if(!_0x5efcdf)return null;_0x221b85[_0x4e27('0x24')][_0x4e27('0x68')]=_0x5efcdf;return _0x221b85;})['then'](function(_0x4ddf83){if(_0x4ddf83){_0x4ddf83[_0x4e27('0x24')][_0x4e27('0x6c')]=util['format'](_0x4e27('0x6d'),_0x152fc6[_0x4e27('0x5b')][_0x4e27('0x35')]);_0x4ddf83[_0x4e27('0x24')]['channel']=_0x221b85[_0x4e27('0x6e')];_0x4ddf83['message'][_0x4e27('0x6f')]='reject';respondWithRpcPromise('EventManager',_0x4e27('0x71'),{'event':_0x4e27('0x7a'),'message':_0x4ddf83[_0x4e27('0x24')]},client9002);return _0x221b85;}return null;})[_0x4e27('0x1c')](respondWithResult(_0x517593,null))['catch'](handleError(_0x517593,null));};exports[_0x4e27('0x7b')]=function(_0x363198,_0x173cee){var _0x48892d;return db[_0x4e27('0x38')][_0x4e27('0x7b')](_0x363198[_0x4e27('0x51')],{})[_0x4e27('0x1c')](function(_0x3d865c){_0x48892d=_0x3d865c;return db[_0x4e27('0x7c')][_0x4e27('0x7d')]({'where':{'id':_0x48892d[_0x4e27('0x62')]}});})[_0x4e27('0x1c')](function(_0x48e226){if(_[_0x4e27('0x59')](_0x48e226)){return;}else{_0x48892d['fax']=_0x48e226[_0x4e27('0x75')];return db[_0x4e27('0x7e')][_0x4e27('0x7d')]({'where':{'id':_0x48892d[_0x4e27('0x7f')]}});}})[_0x4e27('0x1c')](function(_0x427409){return respondWithRpcPromise(_0x4e27('0x80'),_0x4e27('0x80'),{'FaxAccountId':_[_0x4e27('0x59')](_0x363198[_0x4e27('0x51')])?undefined:_0x363198['body'][_0x4e27('0x81')],'path':_['isNil'](_0x427409)?undefined:util[_0x4e27('0x54')](_0x4e27('0x82'),_0x427409['basename']),'fax':_[_0x4e27('0x59')](_0x48892d[_0x4e27('0x75')])?undefined:_0x48892d['fax'],'AttachmentId':_0x48892d[_0x4e27('0x7f')]},client9002);})[_0x4e27('0x1c')](respondWithResult(_0x173cee,0xc9))[_0x4e27('0x26')](handleError(_0x173cee,null));};exports[_0x4e27('0x83')]=function(_0x13957b,_0x29fc41){var _0x326a31=path[_0x4e27('0x84')](config[_0x4e27('0x85')],_0x4e27('0x86'),'files',_0x4e27('0x87'));return db[_0x4e27('0x38')][_0x4e27('0x50')]({'where':{'id':_0x13957b[_0x4e27('0x52')]['id']},'include':[{'model':db[_0x4e27('0x7e')],'as':_0x4e27('0x7e')}]})['then'](handleEntityNotFound(_0x29fc41,null))[_0x4e27('0x1c')](function(_0x21d8c2){if(_0x21d8c2){return _0x29fc41[_0x4e27('0x83')](path[_0x4e27('0x84')](_0x326a31,_0x21d8c2[_0x4e27('0x7e')][_0x4e27('0x88')]));}})[_0x4e27('0x26')](handleError(_0x29fc41,null));}; \ No newline at end of file +var _0x5ff8=['acceptmessage','fax-interactions','reject','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','User','fullname','event','rejectmessage','create','CmContact','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','Attachment','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','options','findAll','rows','params','includeAll','find','body','destroy','describe','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','email','internal','agent','interface','SIP/%s','channel','EventManager'];(function(_0x2f92c1,_0xe5ea43){var _0x5280c2=function(_0x39e2f9){while(--_0x39e2f9){_0x2f92c1['push'](_0x2f92c1['shift']());}};_0x5280c2(++_0xe5ea43);}(_0x5ff8,0xa0));var _0x85ff=function(_0x4f53d0,_0x4485ac){_0x4f53d0=_0x4f53d0-0x0;var _0x434bf7=_0x5ff8[_0x4f53d0];return _0x434bf7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85ff('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85ff('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x85ff('0x2'));var util=require(_0x85ff('0x3'));var path=require(_0x85ff('0x4'));var sox=require(_0x85ff('0x5'));var csv=require(_0x85ff('0x6'));var ejs=require(_0x85ff('0x7'));var fs=require('fs');var fs_extra=require(_0x85ff('0x8'));var _=require(_0x85ff('0x9'));var squel=require(_0x85ff('0xa'));var crypto=require(_0x85ff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x85ff('0xc'));var toCsv=require(_0x85ff('0x6'));var querystring=require(_0x85ff('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x85ff('0xe'));var qs=require(_0x85ff('0xf'));var as=require(_0x85ff('0x10'));var hardwareService=require(_0x85ff('0x11'));var logger=require(_0x85ff('0x12'))('api');var utils=require(_0x85ff('0x13'));var config=require(_0x85ff('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x85ff('0x15'))['db'];config[_0x85ff('0x16')]=_['defaults'](config['redis'],{'host':_0x85ff('0x17'),'port':0x18eb});var socket=require(_0x85ff('0x18'))(new Redis(config[_0x85ff('0x16')]));require(_0x85ff('0x19'))[_0x85ff('0x1a')](socket);var jayson=require(_0x85ff('0x1b'));var client=jayson[_0x85ff('0x1c')][_0x85ff('0x1d')]({'port':0x232c});var client9002=jayson[_0x85ff('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2aee25,_0x1d6361,_0x3dced7,_0xcb8de9){return new BPromise(function(_0x2f1d40,_0xea8cef){var _0x3f9fd4=_0xcb8de9||client;return _0x3f9fd4['request'](_0x2aee25,_0x3dced7)['then'](function(_0x3f13f3){logger[_0x85ff('0x1e')](_0x85ff('0x1f'),_0x1d6361,'request\x20sent');logger[_0x85ff('0x20')](_0x85ff('0x21'),_0x1d6361,_0x85ff('0x22'),JSON['stringify'](_0x3f13f3));if(_0x3f13f3[_0x85ff('0x23')]){if(_0x3f13f3[_0x85ff('0x23')][_0x85ff('0x24')]===0x1f4){logger[_0x85ff('0x23')](_0x85ff('0x1f'),_0x1d6361,_0x3f13f3[_0x85ff('0x23')][_0x85ff('0x25')]);return _0xea8cef(_0x3f13f3[_0x85ff('0x23')]['message']);}logger[_0x85ff('0x23')](_0x85ff('0x1f'),_0x1d6361,_0x3f13f3[_0x85ff('0x23')][_0x85ff('0x25')]);return _0x2f1d40(_0x3f13f3[_0x85ff('0x23')][_0x85ff('0x25')]);}else{logger[_0x85ff('0x1e')]('FaxMessage,\x20%s,\x20%s',_0x1d6361,_0x85ff('0x22'));_0x2f1d40(_0x3f13f3['result'][_0x85ff('0x25')]);}})[_0x85ff('0x26')](function(_0x47a3e1){logger['error'](_0x85ff('0x1f'),_0x1d6361,_0x47a3e1);_0xea8cef(_0x47a3e1);});});}function respondWithStatusCode(_0x38cdc5,_0x1658e8){_0x1658e8=_0x1658e8||0xcc;return function(_0x50c138){if(_0x50c138){return _0x38cdc5[_0x85ff('0x27')](_0x1658e8);}return _0x38cdc5[_0x85ff('0x28')](_0x1658e8)[_0x85ff('0x29')]();};}function respondWithResult(_0x381c76,_0x560b48){_0x560b48=_0x560b48||0xc8;return function(_0x136738){if(_0x136738){return _0x381c76[_0x85ff('0x28')](_0x560b48)[_0x85ff('0x2a')](_0x136738);}};}function respondWithFilteredResult(_0x2a77ef,_0x1b363c){return function(_0x17a722){if(_0x17a722){var _0x1dd0ab=typeof _0x1b363c[_0x85ff('0x2b')]==='undefined'&&typeof _0x1b363c[_0x85ff('0x2c')]===_0x85ff('0x2d');var _0x4d0ede=_0x17a722['count'];var _0x50ed3b=_0x1dd0ab?0x0:_0x1b363c[_0x85ff('0x2b')];var _0x82fea4=_0x1dd0ab?_0x17a722[_0x85ff('0x2e')]:_0x1b363c[_0x85ff('0x2b')]+_0x1b363c[_0x85ff('0x2c')];var _0x243f8a;if(_0x82fea4>=_0x4d0ede){_0x82fea4=_0x4d0ede;_0x243f8a=0xc8;}else{_0x243f8a=0xce;}_0x2a77ef[_0x85ff('0x28')](_0x243f8a);return _0x2a77ef[_0x85ff('0x2f')](_0x85ff('0x30'),_0x50ed3b+'-'+_0x82fea4+'/'+_0x4d0ede)[_0x85ff('0x2a')](_0x17a722);}return null;};}function patchUpdates(_0x437559){return function(_0xe0391d){try{jsonpatch[_0x85ff('0x31')](_0xe0391d,_0x437559,!![]);}catch(_0x5964d2){return BPromise['reject'](_0x5964d2);}return _0xe0391d[_0x85ff('0x32')]();};}function saveUpdates(_0x2b315a,_0x2d34fa){return function(_0xdce9b1){if(_0xdce9b1){return _0xdce9b1[_0x85ff('0x33')](_0x2b315a)[_0x85ff('0x34')](function(_0x5cd863){return _0x5cd863;});}return null;};}function removeEntity(_0x2bc549,_0x102754){return function(_0x1bff5b){if(_0x1bff5b){return _0x1bff5b['destroy']()[_0x85ff('0x34')](function(){_0x2bc549['status'](0xcc)[_0x85ff('0x29')]();});}};}function handleEntityNotFound(_0x1b6b8e,_0x96553f){return function(_0x1c68ac){if(!_0x1c68ac){_0x1b6b8e['sendStatus'](0x194);}return _0x1c68ac;};}function handleError(_0xb1fa42,_0x509f78){_0x509f78=_0x509f78||0x1f4;return function(_0x1aa331){logger[_0x85ff('0x23')](_0x1aa331[_0x85ff('0x35')]);if(_0x1aa331[_0x85ff('0x36')]){delete _0x1aa331[_0x85ff('0x36')];}_0xb1fa42[_0x85ff('0x28')](_0x509f78)[_0x85ff('0x37')](_0x1aa331);};}exports[_0x85ff('0x38')]=function(_0x497922,_0x249bfd){var _0x2cb649={},_0x525ce4={},_0x4ee455={'count':0x0,'rows':[]};var _0xdb0590=_[_0x85ff('0x39')](db[_0x85ff('0x3a')][_0x85ff('0x3b')],function(_0x394e2d){return{'name':_0x394e2d[_0x85ff('0x3c')],'type':_0x394e2d[_0x85ff('0x3d')]['key']};});_0x525ce4[_0x85ff('0x3e')]=_[_0x85ff('0x39')](_0xdb0590,_0x85ff('0x36'));_0x525ce4[_0x85ff('0x3f')]=_[_0x85ff('0x40')](_0x497922[_0x85ff('0x3f')]);_0x525ce4[_0x85ff('0x41')]=_[_0x85ff('0x42')](_0x525ce4[_0x85ff('0x3e')],_0x525ce4['query']);_0x2cb649['attributes']=_[_0x85ff('0x42')](_0x525ce4[_0x85ff('0x3e')],qs[_0x85ff('0x43')](_0x497922[_0x85ff('0x3f')]['fields']));_0x2cb649[_0x85ff('0x44')]=_0x2cb649[_0x85ff('0x44')][_0x85ff('0x45')]?_0x2cb649[_0x85ff('0x44')]:_0x525ce4[_0x85ff('0x3e')];if(!_0x497922['query']['hasOwnProperty'](_0x85ff('0x46'))){_0x2cb649[_0x85ff('0x2c')]=qs[_0x85ff('0x2c')](_0x497922[_0x85ff('0x3f')]['limit']);_0x2cb649['offset']=qs[_0x85ff('0x2b')](_0x497922[_0x85ff('0x3f')][_0x85ff('0x2b')]);}_0x2cb649[_0x85ff('0x47')]=qs[_0x85ff('0x48')](_0x497922[_0x85ff('0x3f')][_0x85ff('0x48')]);_0x2cb649['where']=qs['filters'](_[_0x85ff('0x49')](_0x497922['query'],_0x525ce4[_0x85ff('0x41')]),_0xdb0590);if(_0x497922[_0x85ff('0x3f')][_0x85ff('0x4a')]){_0x2cb649['where']=_[_0x85ff('0x4b')](_0x2cb649[_0x85ff('0x4c')],{'$or':_['map'](_0xdb0590,function(_0x4caa02){if(_0x4caa02[_0x85ff('0x3d')]!=='VIRTUAL'){var _0x5b734e={};_0x5b734e[_0x4caa02['name']]={'$like':'%'+_0x497922['query']['filter']+'%'};return _0x5b734e;}})});}_0x2cb649=_[_0x85ff('0x4b')]({},_0x2cb649,_0x497922[_0x85ff('0x4d')]);var _0x1e4d8b={'where':_0x2cb649['where']};return db[_0x85ff('0x3a')]['count'](_0x1e4d8b)[_0x85ff('0x34')](function(_0x5b9251){_0x4ee455[_0x85ff('0x2e')]=_0x5b9251;if(_0x497922['query']['includeAll']){_0x2cb649['include']=[{'all':!![]}];}return db[_0x85ff('0x3a')][_0x85ff('0x4e')](_0x2cb649);})[_0x85ff('0x34')](function(_0xbdc46b){_0x4ee455[_0x85ff('0x4f')]=_0xbdc46b;return _0x4ee455;})[_0x85ff('0x34')](respondWithFilteredResult(_0x249bfd,_0x2cb649))[_0x85ff('0x26')](handleError(_0x249bfd,null));};exports['show']=function(_0x4d5140,_0x3fb0f2){var _0x42c465={'raw':!![],'where':{'id':_0x4d5140[_0x85ff('0x50')]['id']}},_0x262257={};_0x262257[_0x85ff('0x3e')]=_[_0x85ff('0x40')](db[_0x85ff('0x3a')][_0x85ff('0x3b')]);_0x262257[_0x85ff('0x3f')]=_[_0x85ff('0x40')](_0x4d5140[_0x85ff('0x3f')]);_0x262257[_0x85ff('0x41')]=_['intersection'](_0x262257[_0x85ff('0x3e')],_0x262257[_0x85ff('0x3f')]);_0x42c465['attributes']=_[_0x85ff('0x42')](_0x262257['model'],qs['fields'](_0x4d5140[_0x85ff('0x3f')][_0x85ff('0x43')]));_0x42c465[_0x85ff('0x44')]=_0x42c465['attributes'][_0x85ff('0x45')]?_0x42c465[_0x85ff('0x44')]:_0x262257[_0x85ff('0x3e')];if(_0x4d5140[_0x85ff('0x3f')][_0x85ff('0x51')]){_0x42c465['include']=[{'all':!![]}];}_0x42c465=_[_0x85ff('0x4b')]({},_0x42c465,_0x4d5140[_0x85ff('0x4d')]);return db[_0x85ff('0x3a')][_0x85ff('0x52')](_0x42c465)[_0x85ff('0x34')](handleEntityNotFound(_0x3fb0f2,null))[_0x85ff('0x34')](respondWithResult(_0x3fb0f2,null))['catch'](handleError(_0x3fb0f2,null));};exports[_0x85ff('0x33')]=function(_0x42b936,_0x34b534){if(_0x42b936[_0x85ff('0x53')]['id']){delete _0x42b936[_0x85ff('0x53')]['id'];}return db[_0x85ff('0x3a')]['find']({'where':{'id':_0x42b936[_0x85ff('0x50')]['id']}})['then'](handleEntityNotFound(_0x34b534,null))[_0x85ff('0x34')](saveUpdates(_0x42b936['body'],null))[_0x85ff('0x34')](respondWithResult(_0x34b534,null))[_0x85ff('0x26')](handleError(_0x34b534,null));};exports[_0x85ff('0x54')]=function(_0x3867bd,_0x3efaa1){return db[_0x85ff('0x3a')][_0x85ff('0x52')]({'where':{'id':_0x3867bd['params']['id']}})[_0x85ff('0x34')](handleEntityNotFound(_0x3efaa1,null))[_0x85ff('0x34')](removeEntity(_0x3efaa1,null))['catch'](handleError(_0x3efaa1,null));};exports[_0x85ff('0x55')]=function(_0x4ced32,_0x2253df){return db[_0x85ff('0x3a')][_0x85ff('0x55')]()[_0x85ff('0x34')](respondWithResult(_0x2253df,null))[_0x85ff('0x26')](handleError(_0x2253df,null));};var interaction_log=require(_0x85ff('0x12'))('fax-interactions');exports[_0x85ff('0x56')]=function(_0x3ef995,_0x5bb5bb,_0x17eb12){var _0x462e8a={'agent':{},'channel':_0x85ff('0x57')};if(_0x3ef995['body']['id']){delete _0x3ef995[_0x85ff('0x53')]['id'];}_0x3ef995['body'][_0x85ff('0x58')]=!![];_0x3ef995['body'][_0x85ff('0x59')]=moment()[_0x85ff('0x5a')](_0x85ff('0x5b'));_0x3ef995[_0x85ff('0x53')][_0x85ff('0x5c')]=_0x3ef995[_0x85ff('0x53')]['UserId']||_0x3ef995[_0x85ff('0x5d')]['id'];_0x462e8a['agent']['id']=_0x3ef995['body'][_0x85ff('0x5c')];return db[_0x85ff('0x3a')][_0x85ff('0x52')]({'where':{'id':_0x3ef995[_0x85ff('0x50')]['id'],'UserId':null}})[_0x85ff('0x34')](handleEntityNotFound(_0x5bb5bb,null))[_0x85ff('0x34')](saveUpdates(_0x3ef995[_0x85ff('0x53')],null))[_0x85ff('0x34')](function(_0x20dfee){if(_0x20dfee){_0x462e8a[_0x85ff('0x25')]=_0x20dfee[_0x85ff('0x5e')]({'plain':!![]});return db[_0x85ff('0x5f')][_0x85ff('0x52')]({'where':{'id':_0x20dfee[_0x85ff('0x60')]}});}return null;})[_0x85ff('0x34')](handleEntityNotFound(_0x5bb5bb,null))[_0x85ff('0x34')](function(_0x51010b){if(_0x51010b){return _0x51010b['update']({'UserId':_0x3ef995[_0x85ff('0x53')]['UserId'],'read1stAt':_[_0x85ff('0x61')](_0x51010b['read1stAt'])?moment()[_0x85ff('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x85ff('0x34')](function(_0x9eb023){if(_0x9eb023){_0x462e8a[_0x85ff('0x62')]=_0x9eb023['get']({'plain':!![]});interaction_log[_0x85ff('0x1e')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3ef995[_0x85ff('0x5d')]['id'],_0x3ef995[_0x85ff('0x5d')][_0x85ff('0x36')],_0x3ef995['user'][_0x85ff('0x63')],_0x462e8a[_0x85ff('0x62')]['id'],_0x3ef995[_0x85ff('0x53')]?JSON['stringify'](_0x3ef995[_0x85ff('0x53')]):_0x85ff('0x64'));return respondWithRpcPromise('AcceptMessage',_0x85ff('0x65'),_0x462e8a);}return null;})[_0x85ff('0x34')](function(_0x2583e6){var _0xc2168e=_0x85ff('0x66')+_0x2583e6[_0x85ff('0x25')][_0x85ff('0x67')];return db[_0x85ff('0x68')]['query'](_0xc2168e,{'type':db[_0x85ff('0x69')][_0x85ff('0x6a')][_0x85ff('0x6b')],'raw':!![]})[_0x85ff('0x34')](function(_0x132ab5){return _0x132ab5;});})['then'](function(_0x56c6a4){if(_0x56c6a4){_0x462e8a[_0x85ff('0x25')][_0x85ff('0x6c')]=_0x56c6a4[0x0];if(!_0x3ef995[_0x85ff('0x53')][_0x85ff('0x5c')])return;return db['User'][_0x85ff('0x52')]({'where':{'id':_0x3ef995[_0x85ff('0x53')][_0x85ff('0x5c')],'role':'agent'},'attributes':['id',_0x85ff('0x36'),'fullname',_0x85ff('0x6d'),_0x85ff('0x6e')],'raw':!![]});}return null;})[_0x85ff('0x34')](function(_0x1e4784){if(!_0x1e4784)return null;_0x462e8a[_0x85ff('0x25')][_0x85ff('0x6f')]=_0x1e4784;return _0x462e8a;})[_0x85ff('0x34')](function(_0x3573f6){if(_0x3573f6){if(_0x3ef995['body']['manual']){_0x462e8a[_0x85ff('0x25')][_0x85ff('0x70')]=util[_0x85ff('0x5a')](_0x85ff('0x71'),_0x3ef995[_0x85ff('0x5d')]['name']);_0x462e8a[_0x85ff('0x25')][_0x85ff('0x72')]=_0x462e8a[_0x85ff('0x72')];_0x462e8a[_0x85ff('0x25')]['event']=_0x85ff('0x56');return respondWithRpcPromise(_0x85ff('0x73'),_0x85ff('0x73'),{'event':_0x85ff('0x74'),'message':_0x462e8a[_0x85ff('0x25')]},client9002)[_0x85ff('0x34')](function(){return _0x462e8a;});}return _0x462e8a;}return null;})[_0x85ff('0x34')](respondWithResult(_0x5bb5bb,null))[_0x85ff('0x26')](handleError(_0x5bb5bb,null));};var interaction_log=require(_0x85ff('0x12'))(_0x85ff('0x75'));exports[_0x85ff('0x76')]=function(_0x479a4e,_0x14adbb,_0x13d8f0){var _0x4e3290={'agent':{},'channel':_0x85ff('0x57')};if(_0x479a4e[_0x85ff('0x53')]['id']){delete _0x479a4e['body']['id'];}_0x479a4e[_0x85ff('0x53')][_0x85ff('0x5c')]=_0x479a4e[_0x85ff('0x53')][_0x85ff('0x5c')]||_0x479a4e['user']['id'];_0x4e3290[_0x85ff('0x6f')]['id']=_0x479a4e['body'][_0x85ff('0x5c')];return db[_0x85ff('0x3a')][_0x85ff('0x52')]({'where':{'id':_0x479a4e[_0x85ff('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x14adbb,null))[_0x85ff('0x34')](function(_0x1a0e7b){if(_0x1a0e7b){_0x4e3290[_0x85ff('0x25')]=_0x1a0e7b['get']({'plain':!![]});return db[_0x85ff('0x5f')][_0x85ff('0x52')]({'where':{'id':_0x1a0e7b['FaxInteractionId']}});}return null;})[_0x85ff('0x34')](handleEntityNotFound(_0x14adbb,null))[_0x85ff('0x34')](function(_0x11394a){if(_0x11394a){_0x4e3290[_0x85ff('0x62')]=_0x11394a[_0x85ff('0x5e')]({'plain':!![]});interaction_log[_0x85ff('0x1e')](_0x85ff('0x77'),_0x479a4e[_0x85ff('0x5d')]['id'],_0x479a4e[_0x85ff('0x5d')][_0x85ff('0x36')],_0x479a4e[_0x85ff('0x5d')][_0x85ff('0x63')],_0x4e3290[_0x85ff('0x62')]['id'],_0x479a4e[_0x85ff('0x53')]?JSON['stringify'](_0x479a4e['body']):'null');return respondWithRpcPromise(_0x85ff('0x78'),'rejectMessage',_0x4e3290);}return null;})[_0x85ff('0x34')](function(_0x4e03e7){var _0x32855b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e03e7[_0x85ff('0x25')][_0x85ff('0x67')];return db['sequelize'][_0x85ff('0x3f')](_0x32855b,{'type':db['Sequelize'][_0x85ff('0x6a')][_0x85ff('0x6b')],'raw':!![]})[_0x85ff('0x34')](function(_0x2f0abc){return _0x2f0abc;});})[_0x85ff('0x34')](function(_0x55c227){if(_0x55c227){_0x4e3290['message'][_0x85ff('0x6c')]=_0x55c227[0x0];if(!_0x479a4e[_0x85ff('0x53')][_0x85ff('0x5c')])return;return db[_0x85ff('0x79')]['find']({'where':{'id':_0x479a4e[_0x85ff('0x53')][_0x85ff('0x5c')],'role':_0x85ff('0x6f')},'attributes':['id',_0x85ff('0x36'),_0x85ff('0x7a'),_0x85ff('0x6d'),_0x85ff('0x6e')],'raw':!![]});}return null;})[_0x85ff('0x34')](function(_0x52861d){if(!_0x52861d)return null;_0x4e3290['message'][_0x85ff('0x6f')]=_0x52861d;return _0x4e3290;})[_0x85ff('0x34')](function(_0x788c03){if(_0x788c03){_0x788c03[_0x85ff('0x25')][_0x85ff('0x70')]=util[_0x85ff('0x5a')](_0x85ff('0x71'),_0x479a4e['user'][_0x85ff('0x36')]);_0x788c03['message'][_0x85ff('0x72')]=_0x4e3290[_0x85ff('0x72')];_0x788c03[_0x85ff('0x25')][_0x85ff('0x7b')]=_0x85ff('0x76');respondWithRpcPromise(_0x85ff('0x73'),_0x85ff('0x73'),{'event':_0x85ff('0x7c'),'message':_0x788c03['message']},client9002);return _0x4e3290;}return null;})['then'](respondWithResult(_0x14adbb,null))[_0x85ff('0x26')](handleError(_0x14adbb,null));};exports[_0x85ff('0x7d')]=function(_0x460734,_0x5d5626){var _0x2a29d4;return db[_0x85ff('0x3a')][_0x85ff('0x7d')](_0x460734[_0x85ff('0x53')],{})[_0x85ff('0x34')](function(_0x5aa13b){_0x2a29d4=_0x5aa13b;return db[_0x85ff('0x7e')]['findOne']({'where':{'id':_0x2a29d4[_0x85ff('0x67')]}});})[_0x85ff('0x34')](function(_0x3a4070){if(_['isNil'](_0x3a4070)){return;}else{_0x2a29d4[_0x85ff('0x57')]=_0x3a4070[_0x85ff('0x57')];return db['Attachment']['findOne']({'where':{'id':_0x2a29d4[_0x85ff('0x7f')]}});}})[_0x85ff('0x34')](function(_0x2600b6){return respondWithRpcPromise('SendFax',_0x85ff('0x80'),{'FaxAccountId':_[_0x85ff('0x61')](_0x460734[_0x85ff('0x53')])?undefined:_0x460734['body'][_0x85ff('0x81')],'path':_[_0x85ff('0x61')](_0x2600b6)?undefined:util[_0x85ff('0x5a')](_0x85ff('0x82'),_0x2600b6[_0x85ff('0x83')]),'fax':_[_0x85ff('0x61')](_0x2a29d4[_0x85ff('0x57')])?undefined:_0x2a29d4[_0x85ff('0x57')],'AttachmentId':_0x2a29d4[_0x85ff('0x7f')]},client9002);})['then'](respondWithResult(_0x5d5626,0xc9))[_0x85ff('0x26')](handleError(_0x5d5626,null));};exports[_0x85ff('0x84')]=function(_0x286535,_0x16a6ac){var _0x352c3d=path[_0x85ff('0x85')](config[_0x85ff('0x86')],_0x85ff('0x87'),'files',_0x85ff('0x88'));return db['FaxMessage'][_0x85ff('0x52')]({'where':{'id':_0x286535['params']['id']},'include':[{'model':db[_0x85ff('0x89')],'as':_0x85ff('0x89')}]})[_0x85ff('0x34')](handleEntityNotFound(_0x16a6ac,null))[_0x85ff('0x34')](function(_0x3a2361){if(_0x3a2361){return _0x16a6ac['download'](path[_0x85ff('0x85')](_0x352c3d,_0x3a2361[_0x85ff('0x89')][_0x85ff('0x83')]));}})[_0x85ff('0x26')](handleError(_0x16a6ac,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 2421430..7770fde 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 _0x6dc0=['hook','exports','events','../../mysqldb','FaxMessage','save','update','remove','emit'];(function(_0x4d0d12,_0x1b99e0){var _0x3ddf7f=function(_0xc78bd9){while(--_0xc78bd9){_0x4d0d12['push'](_0x4d0d12['shift']());}};_0x3ddf7f(++_0x1b99e0);}(_0x6dc0,0xb6));var _0x06dc=function(_0x3a187e,_0x38be07){_0x3a187e=_0x3a187e-0x0;var _0x483c40=_0x6dc0[_0x3a187e];return _0x483c40;};'use strict';var EventEmitter=require(_0x06dc('0x0'));var FaxMessage=require(_0x06dc('0x1'))['db'][_0x06dc('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x06dc('0x3'),'afterUpdate':_0x06dc('0x4'),'afterDestroy':_0x06dc('0x5')};function emitEvent(_0x3460a5){return function(_0x4e2c2c,_0x3d99ab,_0x30437f){FaxMessageEvents['emit'](_0x3460a5+':'+_0x4e2c2c['id'],_0x4e2c2c);FaxMessageEvents[_0x06dc('0x6')](_0x3460a5,_0x4e2c2c);_0x30437f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x06dc('0x7')](e,emitEvent(event));}}module[_0x06dc('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x3dba=['save','remove','emit','setMaxListeners'];(function(_0x3008b1,_0x2a89f){var _0x1922d9=function(_0x3ad7bf){while(--_0x3ad7bf){_0x3008b1['push'](_0x3008b1['shift']());}};_0x1922d9(++_0x2a89f);}(_0x3dba,0x73));var _0xa3db=function(_0x40ebc3,_0x5b7f78){_0x40ebc3=_0x40ebc3-0x0;var _0x1d8b08=_0x3dba[_0x40ebc3];return _0x1d8b08;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xa3db('0x0')](0x0);var events={'afterCreate':_0xa3db('0x1'),'afterUpdate':'update','afterDestroy':_0xa3db('0x2')};function emitEvent(_0x2ddae6){return function(_0x20b644,_0x189a24,_0x15fbf8){FaxMessageEvents[_0xa3db('0x3')](_0x2ddae6+':'+_0x20b644['id'],_0x20b644);FaxMessageEvents[_0xa3db('0x3')](_0x2ddae6,_0x20b644);_0x15fbf8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 6ab21c0..3904741 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 _0x3371=['secret','isNil','FaxInteraction','findOne','FaxInteractionId','then','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','get','direction','toLowerCase','out'];(function(_0x3fdcb6,_0x47941e){var _0x4d4bfb=function(_0x1e3148){while(--_0x1e3148){_0x3fdcb6['push'](_0x3fdcb6['shift']());}};_0x4d4bfb(++_0x47941e);}(_0x3371,0x10f));var _0x1337=function(_0x20f3e4,_0x11766d){_0x20f3e4=_0x20f3e4-0x0;var _0x216f5e=_0x3371[_0x20f3e4];return _0x216f5e;};'use strict';var _=require(_0x1337('0x0'));var util=require(_0x1337('0x1'));var logger=require(_0x1337('0x2'))(_0x1337('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1337('0x4'));var fs=require('fs');var path=require(_0x1337('0x5'));var rimraf=require(_0x1337('0x6'));var config=require(_0x1337('0x7'));var attributes=require(_0x1337('0x8'));module[_0x1337('0x9')]=function(_0x31381f,_0x53c7c8){return _0x31381f['define'](_0x1337('0xa'),attributes,{'tableName':_0x1337('0xb'),'paranoid':![],'indexes':[{'name':_0x1337('0xc'),'fields':[_0x1337('0xd')],'type':_0x1337('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3af861,_0x2b6b0a,_0x56eac3){var _0x536db6=_0x31381f['models'];var _0xf42976=_0x3af861[_0x1337('0xf')]({'plain':!![]});if(_0xf42976[_0x1337('0x10')][_0x1337('0x11')]()==='in'||_0xf42976[_0x1337('0x10')]['toLowerCase']()===_0x1337('0x12')&&!_0xf42976[_0x1337('0x13')]&&!_[_0x1337('0x14')](_0xf42976['UserId'])){_0x536db6[_0x1337('0x15')][_0x1337('0x16')]({'where':{'id':_0xf42976[_0x1337('0x17')]}})[_0x1337('0x18')](function(_0x5a98f7){if(_0x5a98f7){_0x5a98f7[_0x1337('0x19')]({'lastMsgAt':_0xf42976['createdAt'],'lastMsgDirection':_0xf42976['direction'][_0x1337('0x11')]()});}})[_0x1337('0x1a')](function(_0x3ffb4b){console['error'](_0x3ffb4b);});}_0x56eac3();}},'charset':_0x1337('0x1b'),'collate':_0x1337('0x1c')});}; \ No newline at end of file +var _0xb29d=['moment','bluebird','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','direction','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x5f196f,_0x1a2281){var _0x454535=function(_0x1456eb){while(--_0x1456eb){_0x5f196f['push'](_0x5f196f['shift']());}};_0x454535(++_0x1a2281);}(_0xb29d,0x193));var _0xdb29=function(_0x3eda1b,_0x14542a){_0x3eda1b=_0x3eda1b-0x0;var _0x28835d=_0xb29d[_0x3eda1b];return _0x28835d;};'use strict';var _=require(_0xdb29('0x0'));var util=require('util');var logger=require(_0xdb29('0x1'))(_0xdb29('0x2'));var moment=require(_0xdb29('0x3'));var BPromise=require(_0xdb29('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb29('0x5'));var rimraf=require(_0xdb29('0x6'));var config=require(_0xdb29('0x7'));var attributes=require(_0xdb29('0x8'));module[_0xdb29('0x9')]=function(_0x102830,_0x1d0b44){return _0x102830[_0xdb29('0xa')](_0xdb29('0xb'),attributes,{'tableName':_0xdb29('0xc'),'paranoid':![],'indexes':[{'name':_0xdb29('0xd'),'fields':[_0xdb29('0xe')],'type':_0xdb29('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x33a944,_0x56b3bb,_0x31b026){var _0x53d11a=_0x102830['models'];var _0x556d2e=_0x33a944['get']({'plain':!![]});if(_0x556d2e[_0xdb29('0x10')][_0xdb29('0x11')]()==='in'||_0x556d2e[_0xdb29('0x10')]['toLowerCase']()===_0xdb29('0x12')&&!_0x556d2e[_0xdb29('0x13')]&&!_['isNil'](_0x556d2e[_0xdb29('0x14')])){_0x53d11a[_0xdb29('0x15')][_0xdb29('0x16')]({'where':{'id':_0x556d2e[_0xdb29('0x17')]}})[_0xdb29('0x18')](function(_0x567d43){if(_0x567d43){_0x567d43[_0xdb29('0x19')]({'lastMsgAt':_0x556d2e['createdAt'],'lastMsgDirection':_0x556d2e[_0xdb29('0x10')]['toLowerCase']()});}})[_0xdb29('0x1a')](function(_0x26cf4a){console[_0xdb29('0x1b')](_0x26cf4a);});}_0x31b026();}},'charset':'utf8mb4','collate':_0xdb29('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index aee0a1e..11feb82 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 _0x7bae=['request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxMessage,\x20%s,\x20%s','create','body','options','raw','CreateFaxMessage','debug','FaxMessage','update','where','limit','UpdateFaxMessage','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7bae,0x13b));var _0xe7ba=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x7bae[_0x373dee];return _0x46798f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});config[_0xe7ba('0xa')]=_[_0xe7ba('0xb')](config[_0xe7ba('0xa')],{'host':_0xe7ba('0xc'),'port':0x18eb});var socket=require(_0xe7ba('0xd'))(new Redis(config[_0xe7ba('0xa')]));require(_0xe7ba('0xe'))['register'](socket);function respondWithRpcPromise(_0x3df8bf,_0xe57e33,_0x375ebb){return new BPromise(function(_0x276bc3,_0x15083a){return client[_0xe7ba('0xf')](_0x3df8bf,_0x375ebb)[_0xe7ba('0x10')](function(_0x448bcc){logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0xe7ba('0x12'));logger['debug'](_0xe7ba('0x13'),_0xe57e33,_0xe7ba('0x12'),JSON[_0xe7ba('0x14')](_0x448bcc));if(_0x448bcc[_0xe7ba('0x15')]){if(_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x17')]);return _0x15083a(_0x448bcc[_0xe7ba('0x15')]['message']);}logger[_0xe7ba('0x15')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc['error']['message']);return _0x276bc3(_0x448bcc[_0xe7ba('0x15')]['message']);}else{logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,'request\x20sent');_0x276bc3(_0x448bcc['result'][_0xe7ba('0x17')]);}})[_0xe7ba('0x18')](function(_0x39ca38){logger[_0xe7ba('0x15')](_0xe7ba('0x19'),_0xe57e33,_0x39ca38);_0x15083a(_0x39ca38);});});}exports['CreateFaxMessage']=function(_0x149c62){var _0x20c653=this;return new Promise(function(_0x3b40fb,_0x136ec6){return db['FaxMessage'][_0xe7ba('0x1a')](_0x149c62[_0xe7ba('0x1b')],{'raw':_0x149c62['options']?_0x149c62[_0xe7ba('0x1c')][_0xe7ba('0x1d')]===undefined?!![]:![]:!![]})[_0xe7ba('0x10')](function(_0x7ab9e4){logger[_0xe7ba('0x11')](_0xe7ba('0x1e'),_0x149c62);logger[_0xe7ba('0x1f')](_0xe7ba('0x1e'),_0x149c62,JSON[_0xe7ba('0x14')](_0x7ab9e4));_0x3b40fb(_0x7ab9e4);})[_0xe7ba('0x18')](function(_0x58cf43){logger['error']('CreateFaxMessage',_0x58cf43['message'],_0x149c62);_0x136ec6(_0x20c653[_0xe7ba('0x15')](0x1f4,_0x58cf43['message']));});});};exports['UpdateFaxMessage']=function(_0x5ece11){var _0x255def=this;return new Promise(function(_0x32cc00,_0xe32862){return db[_0xe7ba('0x20')][_0xe7ba('0x21')](_0x5ece11[_0xe7ba('0x1b')],{'raw':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11['options'][_0xe7ba('0x22')]||null:null,'attributes':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['attributes']||null:null,'limit':_0x5ece11['options']?_0x5ece11[_0xe7ba('0x1c')][_0xe7ba('0x23')]||null:null})[_0xe7ba('0x10')](function(_0x20b6cd){logger[_0xe7ba('0x11')]('UpdateFaxMessage',_0x5ece11);logger[_0xe7ba('0x1f')](_0xe7ba('0x24'),_0x5ece11,JSON['stringify'](_0x20b6cd));_0x32cc00(_0x20b6cd);})[_0xe7ba('0x18')](function(_0x530227){logger['error'](_0xe7ba('0x24'),_0x530227[_0xe7ba('0x17')],_0x5ece11);_0xe32862(_0x255def[_0xe7ba('0x15')](0x1f4,_0x530227['message']));});});}; \ No newline at end of file +var _0x55ca=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','code','error','message','catch','CreateFaxMessage','FaxMessage','body','options','raw','UpdateFaxMessage','update','attributes','limit','debug','stringify','lodash','util','ioredis'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x55ca,0x126));var _0xa55c=function(_0x238202,_0x10da07){_0x238202=_0x238202-0x0;var _0x217367=_0x55ca[_0x238202];return _0x217367;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});config[_0xa55c('0xa')]=_['defaults'](config[_0xa55c('0xa')],{'host':_0xa55c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0xa')]));require(_0xa55c('0xc'))['register'](socket);function respondWithRpcPromise(_0x5849ad,_0x473d0e,_0x20c76a){return new BPromise(function(_0x381d07,_0x5d8e5a){return client[_0xa55c('0xd')](_0x5849ad,_0x20c76a)[_0xa55c('0xe')](function(_0x508342){logger[_0xa55c('0xf')](_0xa55c('0x10'),_0x473d0e,_0xa55c('0x11'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x473d0e,_0xa55c('0x11'),JSON['stringify'](_0x508342));if(_0x508342['error']){if(_0x508342['error'][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);return _0x5d8e5a(_0x508342[_0xa55c('0x13')]['message']);}logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);return _0x381d07(_0x508342[_0xa55c('0x13')][_0xa55c('0x14')]);}else{logger[_0xa55c('0xf')](_0xa55c('0x10'),_0x473d0e,_0xa55c('0x11'));_0x381d07(_0x508342['result'][_0xa55c('0x14')]);}})[_0xa55c('0x15')](function(_0x461284){logger[_0xa55c('0x13')](_0xa55c('0x10'),_0x473d0e,_0x461284);_0x5d8e5a(_0x461284);});});}exports[_0xa55c('0x16')]=function(_0x4c0daf){var _0x5f5158=this;return new Promise(function(_0xd643cc,_0x3776ac){return db[_0xa55c('0x17')]['create'](_0x4c0daf[_0xa55c('0x18')],{'raw':_0x4c0daf[_0xa55c('0x19')]?_0x4c0daf['options'][_0xa55c('0x1a')]===undefined?!![]:![]:!![]})[_0xa55c('0xe')](function(_0x940f28){logger[_0xa55c('0xf')](_0xa55c('0x16'),_0x4c0daf);logger['debug'](_0xa55c('0x16'),_0x4c0daf,JSON['stringify'](_0x940f28));_0xd643cc(_0x940f28);})['catch'](function(_0x59d89a){logger[_0xa55c('0x13')]('CreateFaxMessage',_0x59d89a[_0xa55c('0x14')],_0x4c0daf);_0x3776ac(_0x5f5158[_0xa55c('0x13')](0x1f4,_0x59d89a[_0xa55c('0x14')]));});});};exports[_0xa55c('0x1b')]=function(_0x2313a9){var _0x170ba4=this;return new Promise(function(_0x1da633,_0x11e7f7){return db[_0xa55c('0x17')][_0xa55c('0x1c')](_0x2313a9[_0xa55c('0x18')],{'raw':_0x2313a9['options']?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')]['where']||null:null,'attributes':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1d')]||null:null,'limit':_0x2313a9[_0xa55c('0x19')]?_0x2313a9[_0xa55c('0x19')][_0xa55c('0x1e')]||null:null})['then'](function(_0x23e698){logger['info'](_0xa55c('0x1b'),_0x2313a9);logger[_0xa55c('0x1f')](_0xa55c('0x1b'),_0x2313a9,JSON[_0xa55c('0x20')](_0x23e698));_0x1da633(_0x23e698);})['catch'](function(_0x3d28fb){logger[_0xa55c('0x13')](_0xa55c('0x1b'),_0x3d28fb[_0xa55c('0x14')],_0x2313a9);_0x11e7f7(_0x170ba4[_0xa55c('0x13')](0x1f4,_0x3d28fb[_0xa55c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index dda92cf..5a84879 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 _0xd45c=['register','length','faxMessage:','./faxMessage.events','remove','emit'];(function(_0x3bf618,_0xea4027){var _0x4e9307=function(_0x5848c5){while(--_0x5848c5){_0x3bf618['push'](_0x3bf618['shift']());}};_0x4e9307(++_0xea4027);}(_0xd45c,0xa5));var _0xcd45=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd45c[_0x20a584];return _0x4b41a8;};'use strict';var FaxMessageEvents=require(_0xcd45('0x0'));var events=['save',_0xcd45('0x1'),'update'];function createListener(_0x1d5346,_0x557a79){return function(_0x282cd7){_0x557a79[_0xcd45('0x2')](_0x1d5346,_0x282cd7);};}function removeListener(_0x270c77,_0xaa6d61){return function(){FaxMessageEvents['removeListener'](_0x270c77,_0xaa6d61);};}exports[_0xcd45('0x3')]=function(_0xfddb15){for(var _0x51eaba=0x0,_0x4ce812=events[_0xcd45('0x4')];_0x51eaba<_0x4ce812;_0x51eaba++){var _0x443659=events[_0x51eaba];var _0x1097fb=createListener(_0xcd45('0x5')+_0x443659,_0xfddb15);FaxMessageEvents['on'](_0x443659,_0x1097fb);}}; \ No newline at end of file +var _0x21c8=['save','remove','update','emit','register','length','./faxMessage.events'];(function(_0x17c3c7,_0x5d69c4){var _0x199cca=function(_0x5814aa){while(--_0x5814aa){_0x17c3c7['push'](_0x17c3c7['shift']());}};_0x199cca(++_0x5d69c4);}(_0x21c8,0xa7));var _0x821c=function(_0x4f2ee2,_0x1828cd){_0x4f2ee2=_0x4f2ee2-0x0;var _0x3b87d9=_0x21c8[_0x4f2ee2];return _0x3b87d9;};'use strict';var FaxMessageEvents=require(_0x821c('0x0'));var events=[_0x821c('0x1'),_0x821c('0x2'),_0x821c('0x3')];function createListener(_0x6485ad,_0x12d167){return function(_0x4adc2c){_0x12d167[_0x821c('0x4')](_0x6485ad,_0x4adc2c);};}function removeListener(_0x9ef992,_0x45e653){return function(){FaxMessageEvents['removeListener'](_0x9ef992,_0x45e653);};}exports[_0x821c('0x5')]=function(_0x36b7b7){for(var _0x4d8607=0x0,_0x58a9a4=events[_0x821c('0x6')];_0x4d8607<_0x58a9a4;_0x4d8607++){var _0x2af9b2=events[_0x4d8607];var _0xd613f5=createListener('faxMessage:'+_0x2af9b2,_0x36b7b7);FaxMessageEvents['on'](_0x2af9b2,_0xd613f5);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index bcef38c..f8c4c6b 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 _0xe13a=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/reject','reject','delete','exports','util','path'];(function(_0x1329dc,_0x293d44){var _0x2f7107=function(_0x114670){while(--_0x114670){_0x1329dc['push'](_0x1329dc['shift']());}};_0x2f7107(++_0x293d44);}(_0xe13a,0x178));var _0xae13=function(_0x5825c2,_0x14bf6a){_0x5825c2=_0x5825c2-0x0;var _0x58b34c=_0xe13a[_0x5825c2];return _0x58b34c;};'use strict';var multer=require('multer');var util=require(_0xae13('0x0'));var path=require(_0xae13('0x1'));var timeout=require(_0xae13('0x2'));var express=require(_0xae13('0x3'));var router=express['Router']();var fs_extra=require(_0xae13('0x4'));var auth=require(_0xae13('0x5'));var interaction=require(_0xae13('0x6'));var config=require(_0xae13('0x7'));var controller=require(_0xae13('0x8'));router[_0xae13('0x9')]('/',auth[_0xae13('0xa')](),controller[_0xae13('0xb')]);router[_0xae13('0x9')]('/describe',auth[_0xae13('0xa')](),controller[_0xae13('0xc')]);router[_0xae13('0x9')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller[_0xae13('0xe')]);router[_0xae13('0x9')](_0xae13('0xf'),auth[_0xae13('0xa')](),controller['download']);router[_0xae13('0x10')]('/',auth[_0xae13('0xa')](),interaction[_0xae13('0x11')](_0xae13('0x12'),_0xae13('0x13')),controller[_0xae13('0x14')]);router[_0xae13('0x15')]('/:id',auth[_0xae13('0xa')](),controller[_0xae13('0x16')]);router['put']('/:id/accept',auth['isAuthenticated'](),controller['accept']);router['put'](_0xae13('0x17'),auth[_0xae13('0xa')](),controller[_0xae13('0x18')]);router[_0xae13('0x19')](_0xae13('0xd'),auth[_0xae13('0xa')](),controller['destroy']);module[_0xae13('0x1a')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','./faxMessage.controller','isAuthenticated','describe','get','/:id','show','download','post','tracked','fax','faxmessage:create','create','put','update','reject','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x16f6cf,_0x364ec8){var _0xcf168e=function(_0x3801cc){while(--_0x3801cc){_0x16f6cf['push'](_0x16f6cf['shift']());}};_0xcf168e(++_0x364ec8);}(_0x70e0,0x17b));var _0x070e=function(_0x28bf70,_0x44a804){_0x28bf70=_0x28bf70-0x0;var _0x3f1dee=_0x70e0[_0x28bf70];return _0x3f1dee;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x070e('0xd')]);router[_0x070e('0xe')]('/',auth[_0x070e('0x8')](),interaction[_0x070e('0xf')](_0x070e('0x10'),_0x070e('0x11')),controller[_0x070e('0x12')]);router[_0x070e('0x13')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/accept',auth[_0x070e('0x8')](),controller['accept']);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x16')]);module[_0x070e('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index ea3a0bd..8a0a565 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 _0x3d0a=['beepall','roundrobin','sequelize','STRING','name','INTEGER','ENUM'];(function(_0x5f2599,_0x6f1047){var _0x16968b=function(_0x450419){while(--_0x450419){_0x5f2599['push'](_0x5f2599['shift']());}};_0x16968b(++_0x6f1047);}(_0x3d0a,0xd4));var _0xa3d0=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x3d0a[_0x3826ad];return _0x17b900;};'use strict';var Sequelize=require(_0xa3d0('0x0'));module['exports']={'name':{'type':Sequelize[_0xa3d0('0x1')],'unique':_0xa3d0('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa3d0('0x1')]},'timeout':{'type':Sequelize[_0xa3d0('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa3d0('0x4')]('rrmemory',_0xa3d0('0x5'),_0xa3d0('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa3d0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa54e=['exports','name','INTEGER','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xa54e,0x7d));var _0xea54=function(_0x4529b3,_0x390ebb){_0x4529b3=_0x4529b3-0x0;var _0x21e907=_0xa54e[_0x4529b3];return _0x21e907;};'use strict';var Sequelize=require(_0xea54('0x0'));module[_0xea54('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xea54('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xea54('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xea54('0x4')](_0xea54('0x5'),'beepall',_0xea54('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xea54('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 9ac7548..7b867d9 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 _0x6d7d=['rows','catch','show','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','options','User','UserId','updatedAt','createdAt','format','SIP','Team','getTeams','addTeams','ids','Agents','sequelize','transaction','each','findOrCreate','forEach','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','removeTeams','isEmpty','emit','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','FaxQueues','UserProfileResource','then','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll'];(function(_0x5e53d1,_0x1b732a){var _0x194bdb=function(_0x530cef){while(--_0x530cef){_0x5e53d1['push'](_0x5e53d1['shift']());}};_0x194bdb(++_0x1b732a);}(_0x6d7d,0x1f2));var _0xd6d7=function(_0x4a962d,_0x298772){_0x4a962d=_0x4a962d-0x0;var _0x4f0bb2=_0x6d7d[_0x4a962d];return _0x4f0bb2;};'use strict';var emlformat=require(_0xd6d7('0x0'));var rimraf=require(_0xd6d7('0x1'));var zipdir=require(_0xd6d7('0x2'));var jsonpatch=require(_0xd6d7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd6d7('0x4'));var Mustache=require('mustache');var util=require(_0xd6d7('0x5'));var path=require(_0xd6d7('0x6'));var sox=require(_0xd6d7('0x7'));var csv=require(_0xd6d7('0x8'));var ejs=require(_0xd6d7('0x9'));var fs=require('fs');var fs_extra=require(_0xd6d7('0xa'));var _=require('lodash');var squel=require(_0xd6d7('0xb'));var crypto=require(_0xd6d7('0xc'));var jsforce=require(_0xd6d7('0xd'));var deskjs=require(_0xd6d7('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd6d7('0xf'));var Papa=require(_0xd6d7('0x10'));var Redis=require(_0xd6d7('0x11'));var authService=require(_0xd6d7('0x12'));var qs=require(_0xd6d7('0x13'));var as=require(_0xd6d7('0x14'));var hardwareService=require(_0xd6d7('0x15'));var logger=require(_0xd6d7('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xd6d7('0x17'));var licenseUtil=require(_0xd6d7('0x18'));var db=require(_0xd6d7('0x19'))['db'];config['redis']=_['defaults'](config[_0xd6d7('0x1a')],{'host':_0xd6d7('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6d7('0x1a')]));require(_0xd6d7('0x1c'))[_0xd6d7('0x1d')](socket);function respondWithStatusCode(_0x18a610,_0xe89ead){_0xe89ead=_0xe89ead||0xcc;return function(_0x405fe7){if(_0x405fe7){return _0x18a610[_0xd6d7('0x1e')](_0xe89ead);}return _0x18a610[_0xd6d7('0x1f')](_0xe89ead)[_0xd6d7('0x20')]();};}function respondWithResult(_0x5db47a,_0x166a94){_0x166a94=_0x166a94||0xc8;return function(_0x451108){if(_0x451108){return _0x5db47a['status'](_0x166a94)[_0xd6d7('0x21')](_0x451108);}};}function respondWithFilteredResult(_0x38e56c,_0x1ca307){return function(_0x3db571){if(_0x3db571){var _0x3eeec4=typeof _0x1ca307[_0xd6d7('0x22')]===_0xd6d7('0x23')&&typeof _0x1ca307[_0xd6d7('0x24')]==='undefined';var _0x5462cf=_0x3db571[_0xd6d7('0x25')];var _0x17d1cc=_0x3eeec4?0x0:_0x1ca307[_0xd6d7('0x22')];var _0x468e2b=_0x3eeec4?_0x3db571[_0xd6d7('0x25')]:_0x1ca307['offset']+_0x1ca307[_0xd6d7('0x24')];var _0x4f76e5;if(_0x468e2b>=_0x5462cf){_0x468e2b=_0x5462cf;_0x4f76e5=0xc8;}else{_0x4f76e5=0xce;}_0x38e56c['status'](_0x4f76e5);return _0x38e56c[_0xd6d7('0x26')](_0xd6d7('0x27'),_0x17d1cc+'-'+_0x468e2b+'/'+_0x5462cf)[_0xd6d7('0x21')](_0x3db571);}return null;};}function patchUpdates(_0x5e8805){return function(_0x3e2ac2){try{jsonpatch[_0xd6d7('0x28')](_0x3e2ac2,_0x5e8805,!![]);}catch(_0x36fc06){return BPromise[_0xd6d7('0x29')](_0x36fc06);}return _0x3e2ac2[_0xd6d7('0x2a')]();};}function saveUpdates(_0x53bce4,_0x1a76d0){return function(_0x43b5f5){if(_0x43b5f5){return _0x43b5f5[_0xd6d7('0x2b')](_0x53bce4)['then'](function(_0x4fdf8c){return _0x4fdf8c;});}return null;};}function removeEntity(_0x42525a,_0x3f2670){return function(_0x3d137d){if(_0x3d137d){return _0x3d137d['destroy']()['then'](function(){var _0x3c8a45=_0x3d137d['get']({'plain':!![]});var _0x21f452=_0xd6d7('0x2c');return db[_0xd6d7('0x2d')]['destroy']({'where':{'type':_0x21f452,'resourceId':_0x3c8a45['id']}})[_0xd6d7('0x2e')](function(){return _0x3d137d;});})[_0xd6d7('0x2e')](function(){_0x42525a[_0xd6d7('0x1f')](0xcc)[_0xd6d7('0x20')]();});}};}function handleEntityNotFound(_0x37013c,_0x552e96){return function(_0x41a2eb){if(!_0x41a2eb){_0x37013c[_0xd6d7('0x1e')](0x194);}return _0x41a2eb;};}function handleError(_0x2d3f64,_0xa54399){_0xa54399=_0xa54399||0x1f4;return function(_0x5d3438){logger['error'](_0x5d3438[_0xd6d7('0x2f')]);if(_0x5d3438['name']){delete _0x5d3438[_0xd6d7('0x30')];}_0x2d3f64['status'](_0xa54399)[_0xd6d7('0x31')](_0x5d3438);};}exports[_0xd6d7('0x32')]=function(_0x1c09cc,_0xd62bb7){var _0x316bd9={},_0x22b418={},_0x4db355={'count':0x0,'rows':[]};var _0x10c6b4=_[_0xd6d7('0x33')](db[_0xd6d7('0x34')][_0xd6d7('0x35')],function(_0x1561dc){return{'name':_0x1561dc[_0xd6d7('0x36')],'type':_0x1561dc['type'][_0xd6d7('0x37')]};});_0x22b418[_0xd6d7('0x38')]=_[_0xd6d7('0x33')](_0x10c6b4,_0xd6d7('0x30'));_0x22b418[_0xd6d7('0x39')]=_[_0xd6d7('0x3a')](_0x1c09cc[_0xd6d7('0x39')]);_0x22b418[_0xd6d7('0x3b')]=_[_0xd6d7('0x3c')](_0x22b418[_0xd6d7('0x38')],_0x22b418[_0xd6d7('0x39')]);_0x316bd9[_0xd6d7('0x3d')]=_[_0xd6d7('0x3c')](_0x22b418[_0xd6d7('0x38')],qs[_0xd6d7('0x3e')](_0x1c09cc[_0xd6d7('0x39')][_0xd6d7('0x3e')]));_0x316bd9[_0xd6d7('0x3d')]=_0x316bd9['attributes'][_0xd6d7('0x3f')]?_0x316bd9['attributes']:_0x22b418[_0xd6d7('0x38')];if(!_0x1c09cc['query'][_0xd6d7('0x40')]('nolimit')){_0x316bd9[_0xd6d7('0x24')]=qs[_0xd6d7('0x24')](_0x1c09cc['query']['limit']);_0x316bd9[_0xd6d7('0x22')]=qs['offset'](_0x1c09cc[_0xd6d7('0x39')][_0xd6d7('0x22')]);}_0x316bd9[_0xd6d7('0x41')]=qs[_0xd6d7('0x42')](_0x1c09cc[_0xd6d7('0x39')]['sort']);_0x316bd9[_0xd6d7('0x43')]=qs[_0xd6d7('0x3b')](_[_0xd6d7('0x44')](_0x1c09cc[_0xd6d7('0x39')],_0x22b418[_0xd6d7('0x3b')]),_0x10c6b4);if(_0x1c09cc['query'][_0xd6d7('0x45')]){_0x316bd9[_0xd6d7('0x43')]=_['merge'](_0x316bd9[_0xd6d7('0x43')],{'$or':_[_0xd6d7('0x33')](_0x10c6b4,function(_0x17b0d1){if(_0x17b0d1['type']!==_0xd6d7('0x46')){var _0x1fc40a={};_0x1fc40a[_0x17b0d1[_0xd6d7('0x30')]]={'$like':'%'+_0x1c09cc[_0xd6d7('0x39')][_0xd6d7('0x45')]+'%'};return _0x1fc40a;}})});}_0x316bd9=_[_0xd6d7('0x47')]({},_0x316bd9,_0x1c09cc['options']);var _0x1d121d={'where':_0x316bd9[_0xd6d7('0x43')]};return db['FaxQueue'][_0xd6d7('0x25')](_0x1d121d)[_0xd6d7('0x2e')](function(_0x8615b0){_0x4db355['count']=_0x8615b0;if(_0x1c09cc[_0xd6d7('0x39')]['includeAll']){_0x316bd9[_0xd6d7('0x48')]=[{'all':!![]}];}return db[_0xd6d7('0x34')][_0xd6d7('0x49')](_0x316bd9);})[_0xd6d7('0x2e')](function(_0x334aec){_0x4db355[_0xd6d7('0x4a')]=_0x334aec;return _0x4db355;})[_0xd6d7('0x2e')](respondWithFilteredResult(_0xd62bb7,_0x316bd9))[_0xd6d7('0x4b')](handleError(_0xd62bb7,null));};exports[_0xd6d7('0x4c')]=function(_0x3ffa37,_0x108f80){var _0x4f35f7={'raw':!![],'where':{'id':_0x3ffa37[_0xd6d7('0x4d')]['id']}},_0x3b915d={};_0x3b915d['model']=_[_0xd6d7('0x3a')](db[_0xd6d7('0x34')][_0xd6d7('0x35')]);_0x3b915d['query']=_['keys'](_0x3ffa37[_0xd6d7('0x39')]);_0x3b915d[_0xd6d7('0x3b')]=_[_0xd6d7('0x3c')](_0x3b915d[_0xd6d7('0x38')],_0x3b915d[_0xd6d7('0x39')]);_0x4f35f7['attributes']=_['intersection'](_0x3b915d[_0xd6d7('0x38')],qs[_0xd6d7('0x3e')](_0x3ffa37[_0xd6d7('0x39')]['fields']));_0x4f35f7['attributes']=_0x4f35f7[_0xd6d7('0x3d')][_0xd6d7('0x3f')]?_0x4f35f7['attributes']:_0x3b915d[_0xd6d7('0x38')];if(_0x3ffa37['query'][_0xd6d7('0x4e')]){_0x4f35f7['include']=[{'all':!![]}];}_0x4f35f7=_['merge']({},_0x4f35f7,_0x3ffa37['options']);return db[_0xd6d7('0x34')][_0xd6d7('0x4f')](_0x4f35f7)[_0xd6d7('0x2e')](handleEntityNotFound(_0x108f80,null))['then'](respondWithResult(_0x108f80,null))[_0xd6d7('0x4b')](handleError(_0x108f80,null));};exports[_0xd6d7('0x50')]=function(_0x318387,_0xda38d2){return db['FaxQueue']['create'](_0x318387['body'],{})[_0xd6d7('0x2e')](function(_0x2a0cec){var _0x2fd340=_0x318387[_0xd6d7('0x51')][_0xd6d7('0x52')]({'plain':!![]});if(!_0x2fd340)throw new Error(_0xd6d7('0x53'));if(_0x2fd340[_0xd6d7('0x54')]===_0xd6d7('0x51')){var _0x384e92=_0x2a0cec[_0xd6d7('0x52')]({'plain':!![]});var _0xfc36a2=_0xd6d7('0x2c');return db[_0xd6d7('0x55')]['find']({'where':{'name':_0xfc36a2,'userProfileId':_0x2fd340['userProfileId']},'raw':!![]})[_0xd6d7('0x2e')](function(_0x59b724){if(_0x59b724&&_0x59b724['autoAssociation']===0x0){return db[_0xd6d7('0x2d')][_0xd6d7('0x50')]({'name':_0x384e92[_0xd6d7('0x30')],'resourceId':_0x384e92['id'],'type':_0x59b724[_0xd6d7('0x30')],'sectionId':_0x59b724['id']},{})[_0xd6d7('0x2e')](function(){return _0x2a0cec;});}else{return _0x2a0cec;}})['catch'](function(_0x7e3035){logger['error'](_0xd6d7('0x56'),_0x7e3035);throw _0x7e3035;});}return _0x2a0cec;})[_0xd6d7('0x2e')](respondWithResult(_0xda38d2,0xc9))[_0xd6d7('0x4b')](handleError(_0xda38d2,null));};exports['update']=function(_0x401d9b,_0x2c8836){if(_0x401d9b[_0xd6d7('0x57')]['id']){delete _0x401d9b[_0xd6d7('0x57')]['id'];}return db[_0xd6d7('0x34')][_0xd6d7('0x4f')]({'where':{'id':_0x401d9b[_0xd6d7('0x4d')]['id']}})[_0xd6d7('0x2e')](handleEntityNotFound(_0x2c8836,null))[_0xd6d7('0x2e')](saveUpdates(_0x401d9b[_0xd6d7('0x57')],null))[_0xd6d7('0x2e')](respondWithResult(_0x2c8836,null))[_0xd6d7('0x4b')](handleError(_0x2c8836,null));};exports[_0xd6d7('0x58')]=function(_0x3adb1c,_0x242334){return db[_0xd6d7('0x34')][_0xd6d7('0x4f')]({'where':{'id':_0x3adb1c[_0xd6d7('0x4d')]['id']}})['then'](handleEntityNotFound(_0x242334,null))['then'](removeEntity(_0x242334,null))[_0xd6d7('0x4b')](handleError(_0x242334,null));};exports['describe']=function(_0xcc9e1,_0x5808f1){return db[_0xd6d7('0x34')]['describe']()[_0xd6d7('0x2e')](respondWithResult(_0x5808f1,null))['catch'](handleError(_0x5808f1,null));};exports[_0xd6d7('0x59')]=function(_0x28ffce,_0x38620c,_0x4c8f2c){var _0x2e316a={'raw':!![],'where':{}},_0x1edceb={},_0x450aa7;return db['FaxQueue'][_0xd6d7('0x5a')]({'where':{'id':_0x28ffce[_0xd6d7('0x4d')]['id']}})[_0xd6d7('0x2e')](handleEntityNotFound(_0x38620c,null))[_0xd6d7('0x2e')](function(_0x264b02){if(_0x264b02){_0x450aa7=_0x264b02[_0xd6d7('0x52')]({'plain':!![]});_0x1edceb['model']=_[_0xd6d7('0x3a')](db[_0xd6d7('0x5b')]['rawAttributes']);_0x1edceb['query']=_[_0xd6d7('0x3a')](_0x28ffce[_0xd6d7('0x39')]);_0x1edceb['filters']=_[_0xd6d7('0x3c')](_0x1edceb[_0xd6d7('0x38')],_0x1edceb['query']);_0x2e316a['attributes']=_[_0xd6d7('0x3c')](_0x1edceb[_0xd6d7('0x38')],qs[_0xd6d7('0x3e')](_0x28ffce['query']['fields']));_0x2e316a['attributes']=_0x2e316a[_0xd6d7('0x3d')][_0xd6d7('0x3f')]?_0x2e316a[_0xd6d7('0x3d')]:_0x1edceb['model'];if(!_0x28ffce['query']['hasOwnProperty'](_0xd6d7('0x5c'))){_0x2e316a[_0xd6d7('0x24')]=qs[_0xd6d7('0x24')](_0x28ffce['query'][_0xd6d7('0x24')]);_0x2e316a[_0xd6d7('0x22')]=qs[_0xd6d7('0x22')](_0x28ffce[_0xd6d7('0x39')][_0xd6d7('0x22')]);}_0x2e316a['order']=qs[_0xd6d7('0x42')](_0x28ffce[_0xd6d7('0x39')][_0xd6d7('0x42')]);_0x2e316a[_0xd6d7('0x43')]=qs['filters'](_[_0xd6d7('0x44')](_0x28ffce[_0xd6d7('0x39')],_0x1edceb['filters']));_0x2e316a[_0xd6d7('0x43')][_0xd6d7('0x5d')]=_0x264b02['id'];if(_0x28ffce['query'][_0xd6d7('0x45')]){_0x2e316a['where']=_[_0xd6d7('0x47')](_0x2e316a[_0xd6d7('0x43')],{'$or':_[_0xd6d7('0x33')](_0x2e316a[_0xd6d7('0x3d')],function(_0xefbf5a){var _0x3752af={};_0x3752af[_0xefbf5a]={'$like':'%'+_0x28ffce[_0xd6d7('0x39')][_0xd6d7('0x45')]+'%'};return _0x3752af;})});}_0x2e316a=_[_0xd6d7('0x47')]({},_0x2e316a,_0x28ffce[_0xd6d7('0x5e')]);return db[_0xd6d7('0x5b')][_0xd6d7('0x49')](_0x2e316a);}})[_0xd6d7('0x2e')](function(_0x386818){if(_0x386818){return db[_0xd6d7('0x5f')]['findAndCountAll']({'where':{'id':_[_0xd6d7('0x33')](_0x386818,_0xd6d7('0x60')),'role':'agent'},'attributes':['id',_0xd6d7('0x30'),'faxPause',_0xd6d7('0x61'),_0xd6d7('0x62')]});}})[_0xd6d7('0x2e')](function(_0x3890f0){if(_0x3890f0){return{'count':_0x3890f0[_0xd6d7('0x25')],'rows':_['map'](_0x3890f0['rows'],function(_0x431470){return{'membername':_0x431470[_0xd6d7('0x30')],'UserId':_0x431470['id'],'queue_name':_0x450aa7[_0xd6d7('0x30')],'FaxQueueId':_0x450aa7['id'],'interface':util[_0xd6d7('0x63')]('%s/%s',_0xd6d7('0x64'),_0x431470['name']),'penalty':0x0,'paused':_0x431470['faxPause'],'createdAt':_0x431470['createdAt'],'updatedAt':_0x431470[_0xd6d7('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x38620c,_0x2e316a))[_0xd6d7('0x4b')](handleError(_0x38620c,null));};exports['getTeams']=function(_0x10eeba,_0x3465bb,_0x4f6b5b){var _0x3abad3={};var _0x23106b={};var _0x4f0ea6;var _0x1718a4;return db['FaxQueue'][_0xd6d7('0x5a')]({'where':{'id':_0x10eeba[_0xd6d7('0x4d')]['id']}})[_0xd6d7('0x2e')](handleEntityNotFound(_0x3465bb,null))[_0xd6d7('0x2e')](function(_0x3dd07d){if(_0x3dd07d){_0x4f0ea6=_0x3dd07d;_0x23106b[_0xd6d7('0x38')]=_[_0xd6d7('0x3a')](db[_0xd6d7('0x65')][_0xd6d7('0x35')]);_0x23106b[_0xd6d7('0x39')]=_[_0xd6d7('0x3a')](_0x10eeba[_0xd6d7('0x39')]);_0x23106b[_0xd6d7('0x3b')]=_['intersection'](_0x23106b[_0xd6d7('0x38')],_0x23106b['query']);_0x3abad3[_0xd6d7('0x3d')]=_[_0xd6d7('0x3c')](_0x23106b[_0xd6d7('0x38')],qs[_0xd6d7('0x3e')](_0x10eeba[_0xd6d7('0x39')][_0xd6d7('0x3e')]));_0x3abad3[_0xd6d7('0x3d')]=_0x3abad3[_0xd6d7('0x3d')]['length']?_0x3abad3[_0xd6d7('0x3d')]:_0x23106b['model'];_0x3abad3[_0xd6d7('0x41')]=qs[_0xd6d7('0x42')](_0x10eeba[_0xd6d7('0x39')][_0xd6d7('0x42')]);_0x3abad3[_0xd6d7('0x43')]=qs[_0xd6d7('0x3b')](_[_0xd6d7('0x44')](_0x10eeba[_0xd6d7('0x39')],_0x23106b[_0xd6d7('0x3b')]));if(_0x10eeba[_0xd6d7('0x39')][_0xd6d7('0x45')]){_0x3abad3['where']=_['merge'](_0x3abad3[_0xd6d7('0x43')],{'$or':_[_0xd6d7('0x33')](_0x3abad3[_0xd6d7('0x3d')],function(_0x1b844a){var _0x137b8e={};_0x137b8e[_0x1b844a]={'$like':'%'+_0x10eeba[_0xd6d7('0x39')][_0xd6d7('0x45')]+'%'};return _0x137b8e;})});}_0x3abad3=_['merge']({},_0x3abad3,_0x10eeba[_0xd6d7('0x5e')]);return _0x4f0ea6[_0xd6d7('0x66')](_0x3abad3);}})[_0xd6d7('0x2e')](function(_0x59ad6c){if(_0x59ad6c){_0x1718a4=_0x59ad6c[_0xd6d7('0x3f')];if(!_0x10eeba[_0xd6d7('0x39')][_0xd6d7('0x40')]('nolimit')){_0x3abad3[_0xd6d7('0x24')]=qs[_0xd6d7('0x24')](_0x10eeba[_0xd6d7('0x39')][_0xd6d7('0x24')]);_0x3abad3[_0xd6d7('0x22')]=qs[_0xd6d7('0x22')](_0x10eeba[_0xd6d7('0x39')][_0xd6d7('0x22')]);}return _0x4f0ea6[_0xd6d7('0x66')](_0x3abad3);}})['then'](function(_0x3d95e1){if(_0x3d95e1){return _0x3d95e1?{'count':_0x1718a4,'rows':_0x3d95e1}:null;}})[_0xd6d7('0x2e')](respondWithResult(_0x3465bb,null))['catch'](handleError(_0x3465bb,null));};exports[_0xd6d7('0x67')]=function(_0x20a14a,_0x5c2edc,_0x2c2774){var _0x2720ef=_0x20a14a[_0xd6d7('0x57')][_0xd6d7('0x68')];return db['Team'][_0xd6d7('0x49')]({'where':{'id':_0x2720ef},'attributes':['id'],'include':[{'model':db[_0xd6d7('0x5f')],'as':_0xd6d7('0x69'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})['then'](function(_0x3bf16d){if(_0x3bf16d){var _0x350d9d=_['flatMap'](_0x3bf16d,function(_0x2239a6){var _0x5e658f=_0x2239a6[_0xd6d7('0x52')]({'plain':!![]});return _0x5e658f['Agents'];});return db[_0xd6d7('0x34')][_0xd6d7('0x4f')]({'where':{'id':_0x20a14a[_0xd6d7('0x4d')]['id']}})[_0xd6d7('0x2e')](function(_0x534232){return db[_0xd6d7('0x6a')][_0xd6d7('0x6b')](function(_0x11bbc4){return _0x534232[_0xd6d7('0x67')](_0x2720ef,{'transaction':_0x11bbc4})[_0xd6d7('0x2e')](function(){return BPromise[_0xd6d7('0x6c')](_0x350d9d,function(_0x518f93){return db['UserFaxQueue'][_0xd6d7('0x6d')]({'where':{'UserId':_0x518f93['id'],'FaxQueueId':_0x20a14a[_0xd6d7('0x4d')]['id']},'transaction':_0x11bbc4});});})[_0xd6d7('0x2e')](function(){_0x350d9d[_0xd6d7('0x6e')](function(_0x3e1cd9){socket['emit']('userFaxQueue:save',{'UserId':_0x3e1cd9['id'],'FaxQueueId':_0x534232['id']});});});});});}})[_0xd6d7('0x2e')](respondWithStatusCode(_0x5c2edc,null))[_0xd6d7('0x4b')](handleError(_0x5c2edc,null));};exports['removeTeams']=function(_0x4f3651,_0x5a43aa,_0x6da7b3){return db[_0xd6d7('0x65')]['findAll']({'where':{'id':_0x4f3651[_0xd6d7('0x39')][_0xd6d7('0x68')]},'attributes':['id'],'include':[{'model':db[_0xd6d7('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xd6d7('0x2e')](handleEntityNotFound(_0x5a43aa,null))[_0xd6d7('0x2e')](function(_0x243f7d){var _0x31dad9=_[_0xd6d7('0x33')](_0x243f7d,'id');var _0x55c187=[];var _0x1a6773=[];var _0x5d7bca=squel[_0xd6d7('0x6f')]();_0x5d7bca['field'](_0xd6d7('0x70'))[_0xd6d7('0x71')](_0xd6d7('0x72'),'tq')[_0xd6d7('0x73')](_0xd6d7('0x74'),'ut',_0xd6d7('0x75'))[_0xd6d7('0x43')](_0xd6d7('0x76'),_0x4f3651[_0xd6d7('0x4d')]['id']);for(var _0x42d729=0x0;_0x42d729<_0x243f7d[_0xd6d7('0x3f')];_0x42d729+=0x1){let _0x2b097a=_0x243f7d[_0x42d729];for(var _0x1f2bbe=0x0;_0x1f2bbe<_0x2b097a[_0xd6d7('0x69')][_0xd6d7('0x3f')];_0x1f2bbe+=0x1){let _0x5a46f1=_0x2b097a[_0xd6d7('0x69')][_0x1f2bbe];var _0x481a42=_0x5d7bca[_0xd6d7('0x77')]();_0x481a42['where'](_0xd6d7('0x78'),_0x5a46f1['id']);_0x1a6773[_0xd6d7('0x79')](db[_0xd6d7('0x6a')][_0xd6d7('0x39')](_0x481a42[_0xd6d7('0x7a')](),{'type':db[_0xd6d7('0x6a')][_0xd6d7('0x7b')][_0xd6d7('0x7c')]})['then'](function(_0x5cc924){if(_0x5cc924[_0xd6d7('0x3f')]===0x1){return _0x5a46f1['id'];}else{var _0x9cd6df=_[_0xd6d7('0x7d')](_[_0xd6d7('0x33')](_0x5cc924,_0xd6d7('0x7e')),function(_0x4fc9ac){return _[_0xd6d7('0x7f')](_0x31dad9,_0x4fc9ac);});if(_0x9cd6df){return _0x5a46f1['id'];}}}));}}return BPromise[_0xd6d7('0x80')](_0x1a6773)['then'](function(_0xc32138){_0x55c187=_(_0x55c187)[_0xd6d7('0x81')](_0xc32138)[_0xd6d7('0x82')]()[_0xd6d7('0x83')]();return db['FaxQueue'][_0xd6d7('0x4f')]({'where':{'id':_0x4f3651[_0xd6d7('0x4d')]['id']}})[_0xd6d7('0x2e')](function(_0x1d7399){return db[_0xd6d7('0x6a')][_0xd6d7('0x6b')](function(_0x346cb2){return _0x1d7399[_0xd6d7('0x84')](_0x4f3651[_0xd6d7('0x39')]['ids'],{'transaction':_0x346cb2})[_0xd6d7('0x2e')](function(){if(!_[_0xd6d7('0x85')](_0x55c187)){return _0x1d7399['removeAgents'](_0x55c187,{'transaction':_0x346cb2});}})[_0xd6d7('0x2e')](function(){_0x55c187['forEach'](function(_0x4aebcf){socket[_0xd6d7('0x86')](_0xd6d7('0x87'),{'UserId':_0x4aebcf,'FaxQueueId':_0x1d7399['id']});});});});});});})[_0xd6d7('0x2e')](respondWithStatusCode(_0x5a43aa,null))[_0xd6d7('0x4b')](handleError(_0x5a43aa,null));};exports[_0xd6d7('0x88')]=function(_0x3a98d8,_0x326b5b,_0x20326c){return db[_0xd6d7('0x34')][_0xd6d7('0x4f')]({'where':{'id':_0x3a98d8[_0xd6d7('0x4d')]['id']}})[_0xd6d7('0x2e')](handleEntityNotFound(_0x326b5b,null))[_0xd6d7('0x2e')](function(_0x5105db){if(_0x5105db){return _0x5105db[_0xd6d7('0x88')](_0x3a98d8['body'][_0xd6d7('0x68')],_[_0xd6d7('0x89')](_0x3a98d8[_0xd6d7('0x57')],[_0xd6d7('0x68'),'id'])||{})[_0xd6d7('0x8a')](function(_0x20933f){for(var _0x108856=0x0;_0x108856<_0x3a98d8[_0xd6d7('0x57')][_0xd6d7('0x68')][_0xd6d7('0x3f')];_0x108856+=0x1){socket[_0xd6d7('0x86')](_0xd6d7('0x8b'),{'UserId':Number(_0x3a98d8[_0xd6d7('0x57')][_0xd6d7('0x68')][_0x108856]),'FaxQueueId':Number(_0x3a98d8[_0xd6d7('0x4d')]['id'])});}return _0x20933f;});}})['then'](respondWithResult(_0x326b5b,null))[_0xd6d7('0x4b')](handleError(_0x326b5b,null));};exports[_0xd6d7('0x8c')]=function(_0x45f330,_0x223911,_0x45fc8c){return db['FaxQueue'][_0xd6d7('0x4f')]({'where':{'id':_0x45f330['params']['id']}})[_0xd6d7('0x2e')](handleEntityNotFound(_0x223911,null))[_0xd6d7('0x2e')](function(_0x6de753){if(_0x6de753){return _0x6de753[_0xd6d7('0x8c')](_0x45f330[_0xd6d7('0x39')]['ids'])['then'](function(){if(_[_0xd6d7('0x8d')](_0x45f330['query'][_0xd6d7('0x68')])){for(var _0x1a258b=0x0;_0x1a258b<_0x45f330[_0xd6d7('0x39')][_0xd6d7('0x68')][_0xd6d7('0x3f')];_0x1a258b+=0x1){socket[_0xd6d7('0x86')](_0xd6d7('0x87'),{'UserId':Number(_0x45f330[_0xd6d7('0x39')][_0xd6d7('0x68')][_0x1a258b]),'FaxQueueId':Number(_0x45f330[_0xd6d7('0x4d')]['id'])});}}else{socket['emit'](_0xd6d7('0x87'),{'UserId':Number(_0x45f330[_0xd6d7('0x39')][_0xd6d7('0x68')]),'FaxQueueId':Number(_0x45f330[_0xd6d7('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x223911,null))['catch'](handleError(_0x223911,null));};exports['getAgents']=function(_0x39577f,_0x269655,_0x488c58){var _0x48eae0={};var _0xf8ece4={};var _0x512cf1;var _0x241615;return db[_0xd6d7('0x34')]['findOne']({'where':{'id':_0x39577f['params']['id']}})[_0xd6d7('0x2e')](handleEntityNotFound(_0x269655,null))[_0xd6d7('0x2e')](function(_0x3cf056){if(_0x3cf056){_0x512cf1=_0x3cf056;_0xf8ece4['model']=_[_0xd6d7('0x3a')](db[_0xd6d7('0x5f')][_0xd6d7('0x35')]);_0xf8ece4[_0xd6d7('0x39')]=_['keys'](_0x39577f[_0xd6d7('0x39')]);_0xf8ece4['filters']=_['intersection'](_0xf8ece4['model'],_0xf8ece4[_0xd6d7('0x39')]);_0x48eae0['attributes']=_[_0xd6d7('0x3c')](_0xf8ece4['model'],qs['fields'](_0x39577f[_0xd6d7('0x39')][_0xd6d7('0x3e')]));_0x48eae0[_0xd6d7('0x3d')]=_0x48eae0[_0xd6d7('0x3d')][_0xd6d7('0x3f')]?_0x48eae0['attributes']:_0xf8ece4[_0xd6d7('0x38')];_0x48eae0['order']=qs[_0xd6d7('0x42')](_0x39577f[_0xd6d7('0x39')]['sort']);_0x48eae0[_0xd6d7('0x43')]=qs[_0xd6d7('0x3b')](_[_0xd6d7('0x44')](_0x39577f[_0xd6d7('0x39')],_0xf8ece4[_0xd6d7('0x3b')]));if(_0x39577f[_0xd6d7('0x39')][_0xd6d7('0x45')]){_0x48eae0[_0xd6d7('0x43')]=_['merge'](_0x48eae0[_0xd6d7('0x43')],{'$or':_[_0xd6d7('0x33')](_0x48eae0[_0xd6d7('0x3d')],function(_0x49a374){var _0x17172f={};_0x17172f[_0x49a374]={'$like':'%'+_0x39577f['query'][_0xd6d7('0x45')]+'%'};return _0x17172f;})});}_0x48eae0=_[_0xd6d7('0x47')]({},_0x48eae0,_0x39577f['options']);return _0x512cf1[_0xd6d7('0x8e')](_0x48eae0);}})[_0xd6d7('0x2e')](function(_0x12bcd5){if(_0x12bcd5){_0x241615=_0x12bcd5[_0xd6d7('0x3f')];if(!_0x39577f['query'][_0xd6d7('0x40')](_0xd6d7('0x5c'))){_0x48eae0[_0xd6d7('0x24')]=qs[_0xd6d7('0x24')](_0x39577f[_0xd6d7('0x39')][_0xd6d7('0x24')]);_0x48eae0[_0xd6d7('0x22')]=qs['offset'](_0x39577f[_0xd6d7('0x39')][_0xd6d7('0x22')]);}return _0x512cf1['getAgents'](_0x48eae0);}})['then'](function(_0x51dfeb){if(_0x51dfeb){return _0x51dfeb?{'count':_0x241615,'rows':_0x51dfeb}:null;}})[_0xd6d7('0x2e')](respondWithResult(_0x269655,null))[_0xd6d7('0x4b')](handleError(_0x269655,null));}; \ No newline at end of file +var _0xd00a=['%s/%s','Team','getTeams','addTeams','ids','findAll','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','spread','isArray','order','getAgents','eml-format','rimraf','zip-dir','mustache','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','get','FaxQueues','UserProfileResource','end','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','include','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','getMembers','findOne','UserFaxQueue','pick','FaxQueueId','User','findAndCountAll','UserId','faxPause','updatedAt','createdAt','format'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xd00a,0x144));var _0xad00=function(_0xcf6d0d,_0x490049){_0xcf6d0d=_0xcf6d0d-0x0;var _0x4bc54e=_0xd00a[_0xcf6d0d];return _0x4bc54e;};'use strict';var emlformat=require(_0xad00('0x0'));var rimraf=require(_0xad00('0x1'));var zipdir=require(_0xad00('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad00('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xad00('0x4'));var fs=require('fs');var fs_extra=require(_0xad00('0x5'));var _=require('lodash');var squel=require(_0xad00('0x6'));var crypto=require(_0xad00('0x7'));var jsforce=require('jsforce');var deskjs=require(_0xad00('0x8'));var toCsv=require('to-csv');var querystring=require(_0xad00('0x9'));var Papa=require(_0xad00('0xa'));var Redis=require(_0xad00('0xb'));var authService=require(_0xad00('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xad00('0xd'));var hardwareService=require(_0xad00('0xe'));var logger=require(_0xad00('0xf'))(_0xad00('0x10'));var utils=require(_0xad00('0x11'));var config=require(_0xad00('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xad00('0x13'))['db'];config[_0xad00('0x14')]=_[_0xad00('0x15')](config['redis'],{'host':_0xad00('0x16'),'port':0x18eb});var socket=require(_0xad00('0x17'))(new Redis(config[_0xad00('0x14')]));require(_0xad00('0x18'))[_0xad00('0x19')](socket);function respondWithStatusCode(_0x409683,_0x53c024){_0x53c024=_0x53c024||0xcc;return function(_0x1a6e95){if(_0x1a6e95){return _0x409683[_0xad00('0x1a')](_0x53c024);}return _0x409683[_0xad00('0x1b')](_0x53c024)['end']();};}function respondWithResult(_0x386fac,_0x41c3ca){_0x41c3ca=_0x41c3ca||0xc8;return function(_0x375878){if(_0x375878){return _0x386fac[_0xad00('0x1b')](_0x41c3ca)[_0xad00('0x1c')](_0x375878);}};}function respondWithFilteredResult(_0x3896df,_0x3e552d){return function(_0x2240b5){if(_0x2240b5){var _0x47f97c=typeof _0x3e552d['offset']===_0xad00('0x1d')&&typeof _0x3e552d['limit']==='undefined';var _0xb081fe=_0x2240b5[_0xad00('0x1e')];var _0x5e5bc4=_0x47f97c?0x0:_0x3e552d[_0xad00('0x1f')];var _0x41c98b=_0x47f97c?_0x2240b5[_0xad00('0x1e')]:_0x3e552d['offset']+_0x3e552d[_0xad00('0x20')];var _0xa9db99;if(_0x41c98b>=_0xb081fe){_0x41c98b=_0xb081fe;_0xa9db99=0xc8;}else{_0xa9db99=0xce;}_0x3896df[_0xad00('0x1b')](_0xa9db99);return _0x3896df[_0xad00('0x21')](_0xad00('0x22'),_0x5e5bc4+'-'+_0x41c98b+'/'+_0xb081fe)[_0xad00('0x1c')](_0x2240b5);}return null;};}function patchUpdates(_0x5e458a){return function(_0x1fbe51){try{jsonpatch[_0xad00('0x23')](_0x1fbe51,_0x5e458a,!![]);}catch(_0xd6fd7f){return BPromise[_0xad00('0x24')](_0xd6fd7f);}return _0x1fbe51[_0xad00('0x25')]();};}function saveUpdates(_0x3b6981,_0x3b7dff){return function(_0x184125){if(_0x184125){return _0x184125['update'](_0x3b6981)['then'](function(_0x521caf){return _0x521caf;});}return null;};}function removeEntity(_0x3aa6f4,_0x31ba7d){return function(_0x11c06a){if(_0x11c06a){return _0x11c06a[_0xad00('0x26')]()[_0xad00('0x27')](function(){var _0x17b502=_0x11c06a[_0xad00('0x28')]({'plain':!![]});var _0x2a80da=_0xad00('0x29');return db[_0xad00('0x2a')]['destroy']({'where':{'type':_0x2a80da,'resourceId':_0x17b502['id']}})[_0xad00('0x27')](function(){return _0x11c06a;});})[_0xad00('0x27')](function(){_0x3aa6f4[_0xad00('0x1b')](0xcc)[_0xad00('0x2b')]();});}};}function handleEntityNotFound(_0x2f3eb7,_0x46af0c){return function(_0x2ea3a4){if(!_0x2ea3a4){_0x2f3eb7['sendStatus'](0x194);}return _0x2ea3a4;};}function handleError(_0x185542,_0x5b7eb2){_0x5b7eb2=_0x5b7eb2||0x1f4;return function(_0x433147){logger['error'](_0x433147[_0xad00('0x2c')]);if(_0x433147['name']){delete _0x433147[_0xad00('0x2d')];}_0x185542[_0xad00('0x1b')](_0x5b7eb2)[_0xad00('0x2e')](_0x433147);};}exports['index']=function(_0x4cec62,_0x1a9439){var _0x2b915b={},_0x4cf885={},_0x4aa95f={'count':0x0,'rows':[]};var _0x1478b5=_[_0xad00('0x2f')](db[_0xad00('0x30')][_0xad00('0x31')],function(_0x26cb1d){return{'name':_0x26cb1d[_0xad00('0x32')],'type':_0x26cb1d[_0xad00('0x33')][_0xad00('0x34')]};});_0x4cf885[_0xad00('0x35')]=_[_0xad00('0x2f')](_0x1478b5,_0xad00('0x2d'));_0x4cf885[_0xad00('0x36')]=_[_0xad00('0x37')](_0x4cec62[_0xad00('0x36')]);_0x4cf885[_0xad00('0x38')]=_['intersection'](_0x4cf885[_0xad00('0x35')],_0x4cf885[_0xad00('0x36')]);_0x2b915b[_0xad00('0x39')]=_[_0xad00('0x3a')](_0x4cf885[_0xad00('0x35')],qs[_0xad00('0x3b')](_0x4cec62[_0xad00('0x36')][_0xad00('0x3b')]));_0x2b915b[_0xad00('0x39')]=_0x2b915b[_0xad00('0x39')][_0xad00('0x3c')]?_0x2b915b[_0xad00('0x39')]:_0x4cf885[_0xad00('0x35')];if(!_0x4cec62[_0xad00('0x36')][_0xad00('0x3d')](_0xad00('0x3e'))){_0x2b915b[_0xad00('0x20')]=qs[_0xad00('0x20')](_0x4cec62[_0xad00('0x36')][_0xad00('0x20')]);_0x2b915b[_0xad00('0x1f')]=qs[_0xad00('0x1f')](_0x4cec62[_0xad00('0x36')]['offset']);}_0x2b915b['order']=qs[_0xad00('0x3f')](_0x4cec62[_0xad00('0x36')]['sort']);_0x2b915b[_0xad00('0x40')]=qs[_0xad00('0x38')](_['pick'](_0x4cec62[_0xad00('0x36')],_0x4cf885[_0xad00('0x38')]),_0x1478b5);if(_0x4cec62['query'][_0xad00('0x41')]){_0x2b915b[_0xad00('0x40')]=_[_0xad00('0x42')](_0x2b915b[_0xad00('0x40')],{'$or':_['map'](_0x1478b5,function(_0x434d1e){if(_0x434d1e[_0xad00('0x33')]!=='VIRTUAL'){var _0x2a8d40={};_0x2a8d40[_0x434d1e['name']]={'$like':'%'+_0x4cec62[_0xad00('0x36')][_0xad00('0x41')]+'%'};return _0x2a8d40;}})});}_0x2b915b=_[_0xad00('0x42')]({},_0x2b915b,_0x4cec62[_0xad00('0x43')]);var _0x51b4ec={'where':_0x2b915b[_0xad00('0x40')]};return db[_0xad00('0x30')][_0xad00('0x1e')](_0x51b4ec)[_0xad00('0x27')](function(_0x2d8e35){_0x4aa95f[_0xad00('0x1e')]=_0x2d8e35;if(_0x4cec62[_0xad00('0x36')]['includeAll']){_0x2b915b[_0xad00('0x44')]=[{'all':!![]}];}return db[_0xad00('0x30')]['findAll'](_0x2b915b);})[_0xad00('0x27')](function(_0x309bac){_0x4aa95f[_0xad00('0x45')]=_0x309bac;return _0x4aa95f;})[_0xad00('0x27')](respondWithFilteredResult(_0x1a9439,_0x2b915b))[_0xad00('0x46')](handleError(_0x1a9439,null));};exports[_0xad00('0x47')]=function(_0x341f9d,_0x17f14a){var _0x5dd6cc={'raw':!![],'where':{'id':_0x341f9d[_0xad00('0x48')]['id']}},_0x47db39={};_0x47db39[_0xad00('0x35')]=_[_0xad00('0x37')](db[_0xad00('0x30')]['rawAttributes']);_0x47db39[_0xad00('0x36')]=_['keys'](_0x341f9d[_0xad00('0x36')]);_0x47db39[_0xad00('0x38')]=_['intersection'](_0x47db39[_0xad00('0x35')],_0x47db39[_0xad00('0x36')]);_0x5dd6cc['attributes']=_[_0xad00('0x3a')](_0x47db39[_0xad00('0x35')],qs[_0xad00('0x3b')](_0x341f9d[_0xad00('0x36')][_0xad00('0x3b')]));_0x5dd6cc[_0xad00('0x39')]=_0x5dd6cc[_0xad00('0x39')][_0xad00('0x3c')]?_0x5dd6cc[_0xad00('0x39')]:_0x47db39[_0xad00('0x35')];if(_0x341f9d['query']['includeAll']){_0x5dd6cc[_0xad00('0x44')]=[{'all':!![]}];}_0x5dd6cc=_[_0xad00('0x42')]({},_0x5dd6cc,_0x341f9d['options']);return db[_0xad00('0x30')]['find'](_0x5dd6cc)[_0xad00('0x27')](handleEntityNotFound(_0x17f14a,null))[_0xad00('0x27')](respondWithResult(_0x17f14a,null))[_0xad00('0x46')](handleError(_0x17f14a,null));};exports[_0xad00('0x49')]=function(_0x25715a,_0xaa3d2b){return db[_0xad00('0x30')][_0xad00('0x49')](_0x25715a[_0xad00('0x4a')],{})[_0xad00('0x27')](function(_0x2a1523){var _0x3cb81f=_0x25715a[_0xad00('0x4b')][_0xad00('0x28')]({'plain':!![]});if(!_0x3cb81f)throw new Error(_0xad00('0x4c'));if(_0x3cb81f[_0xad00('0x4d')]===_0xad00('0x4b')){var _0x8a8702=_0x2a1523['get']({'plain':!![]});var _0x3e196a=_0xad00('0x29');return db['UserProfileSection']['find']({'where':{'name':_0x3e196a,'userProfileId':_0x3cb81f['userProfileId']},'raw':!![]})[_0xad00('0x27')](function(_0x4d0cd9){if(_0x4d0cd9&&_0x4d0cd9[_0xad00('0x4e')]===0x0){return db['UserProfileResource'][_0xad00('0x49')]({'name':_0x8a8702['name'],'resourceId':_0x8a8702['id'],'type':_0x4d0cd9['name'],'sectionId':_0x4d0cd9['id']},{})['then'](function(){return _0x2a1523;});}else{return _0x2a1523;}})[_0xad00('0x46')](function(_0x4e9724){logger[_0xad00('0x4f')](_0xad00('0x50'),_0x4e9724);throw _0x4e9724;});}return _0x2a1523;})[_0xad00('0x27')](respondWithResult(_0xaa3d2b,0xc9))['catch'](handleError(_0xaa3d2b,null));};exports[_0xad00('0x51')]=function(_0x24312c,_0x45e09c){if(_0x24312c[_0xad00('0x4a')]['id']){delete _0x24312c['body']['id'];}return db[_0xad00('0x30')][_0xad00('0x52')]({'where':{'id':_0x24312c['params']['id']}})[_0xad00('0x27')](handleEntityNotFound(_0x45e09c,null))[_0xad00('0x27')](saveUpdates(_0x24312c[_0xad00('0x4a')],null))[_0xad00('0x27')](respondWithResult(_0x45e09c,null))[_0xad00('0x46')](handleError(_0x45e09c,null));};exports['destroy']=function(_0x4f0bcd,_0x471a79){return db[_0xad00('0x30')]['find']({'where':{'id':_0x4f0bcd['params']['id']}})[_0xad00('0x27')](handleEntityNotFound(_0x471a79,null))[_0xad00('0x27')](removeEntity(_0x471a79,null))[_0xad00('0x46')](handleError(_0x471a79,null));};exports[_0xad00('0x53')]=function(_0x19277b,_0x58c1a3){return db[_0xad00('0x30')]['describe']()[_0xad00('0x27')](respondWithResult(_0x58c1a3,null))[_0xad00('0x46')](handleError(_0x58c1a3,null));};exports[_0xad00('0x54')]=function(_0x1f62b3,_0x3424bc,_0x321925){var _0x39f8f6={'raw':!![],'where':{}},_0x41a198={},_0x386e88;return db['FaxQueue'][_0xad00('0x55')]({'where':{'id':_0x1f62b3[_0xad00('0x48')]['id']}})[_0xad00('0x27')](handleEntityNotFound(_0x3424bc,null))[_0xad00('0x27')](function(_0x3f0ff9){if(_0x3f0ff9){_0x386e88=_0x3f0ff9['get']({'plain':!![]});_0x41a198[_0xad00('0x35')]=_['keys'](db[_0xad00('0x56')][_0xad00('0x31')]);_0x41a198[_0xad00('0x36')]=_[_0xad00('0x37')](_0x1f62b3[_0xad00('0x36')]);_0x41a198[_0xad00('0x38')]=_[_0xad00('0x3a')](_0x41a198[_0xad00('0x35')],_0x41a198[_0xad00('0x36')]);_0x39f8f6['attributes']=_[_0xad00('0x3a')](_0x41a198[_0xad00('0x35')],qs[_0xad00('0x3b')](_0x1f62b3[_0xad00('0x36')][_0xad00('0x3b')]));_0x39f8f6[_0xad00('0x39')]=_0x39f8f6['attributes']['length']?_0x39f8f6[_0xad00('0x39')]:_0x41a198[_0xad00('0x35')];if(!_0x1f62b3[_0xad00('0x36')]['hasOwnProperty'](_0xad00('0x3e'))){_0x39f8f6[_0xad00('0x20')]=qs[_0xad00('0x20')](_0x1f62b3[_0xad00('0x36')][_0xad00('0x20')]);_0x39f8f6[_0xad00('0x1f')]=qs[_0xad00('0x1f')](_0x1f62b3[_0xad00('0x36')]['offset']);}_0x39f8f6['order']=qs[_0xad00('0x3f')](_0x1f62b3[_0xad00('0x36')]['sort']);_0x39f8f6['where']=qs['filters'](_[_0xad00('0x57')](_0x1f62b3[_0xad00('0x36')],_0x41a198['filters']));_0x39f8f6[_0xad00('0x40')][_0xad00('0x58')]=_0x3f0ff9['id'];if(_0x1f62b3[_0xad00('0x36')]['filter']){_0x39f8f6[_0xad00('0x40')]=_[_0xad00('0x42')](_0x39f8f6['where'],{'$or':_[_0xad00('0x2f')](_0x39f8f6['attributes'],function(_0x26ae14){var _0x9d0a20={};_0x9d0a20[_0x26ae14]={'$like':'%'+_0x1f62b3[_0xad00('0x36')][_0xad00('0x41')]+'%'};return _0x9d0a20;})});}_0x39f8f6=_[_0xad00('0x42')]({},_0x39f8f6,_0x1f62b3[_0xad00('0x43')]);return db[_0xad00('0x56')]['findAll'](_0x39f8f6);}})[_0xad00('0x27')](function(_0x43e092){if(_0x43e092){return db[_0xad00('0x59')][_0xad00('0x5a')]({'where':{'id':_[_0xad00('0x2f')](_0x43e092,_0xad00('0x5b')),'role':'agent'},'attributes':['id',_0xad00('0x2d'),_0xad00('0x5c'),_0xad00('0x5d'),_0xad00('0x5e')]});}})[_0xad00('0x27')](function(_0x2a402e){if(_0x2a402e){return{'count':_0x2a402e[_0xad00('0x1e')],'rows':_[_0xad00('0x2f')](_0x2a402e[_0xad00('0x45')],function(_0x5b81b4){return{'membername':_0x5b81b4[_0xad00('0x2d')],'UserId':_0x5b81b4['id'],'queue_name':_0x386e88[_0xad00('0x2d')],'FaxQueueId':_0x386e88['id'],'interface':util[_0xad00('0x5f')](_0xad00('0x60'),'SIP',_0x5b81b4['name']),'penalty':0x0,'paused':_0x5b81b4[_0xad00('0x5c')],'createdAt':_0x5b81b4['createdAt'],'updatedAt':_0x5b81b4[_0xad00('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xad00('0x27')](respondWithFilteredResult(_0x3424bc,_0x39f8f6))[_0xad00('0x46')](handleError(_0x3424bc,null));};exports['getTeams']=function(_0x53e3c0,_0x5b8478,_0x2c7dc3){var _0x22ea91={};var _0x3c20f6={};var _0x5e4944;var _0x44e7f5;return db['FaxQueue'][_0xad00('0x55')]({'where':{'id':_0x53e3c0[_0xad00('0x48')]['id']}})[_0xad00('0x27')](handleEntityNotFound(_0x5b8478,null))[_0xad00('0x27')](function(_0x551b61){if(_0x551b61){_0x5e4944=_0x551b61;_0x3c20f6['model']=_['keys'](db[_0xad00('0x61')]['rawAttributes']);_0x3c20f6[_0xad00('0x36')]=_['keys'](_0x53e3c0[_0xad00('0x36')]);_0x3c20f6[_0xad00('0x38')]=_[_0xad00('0x3a')](_0x3c20f6[_0xad00('0x35')],_0x3c20f6[_0xad00('0x36')]);_0x22ea91['attributes']=_['intersection'](_0x3c20f6[_0xad00('0x35')],qs[_0xad00('0x3b')](_0x53e3c0[_0xad00('0x36')][_0xad00('0x3b')]));_0x22ea91['attributes']=_0x22ea91[_0xad00('0x39')]['length']?_0x22ea91[_0xad00('0x39')]:_0x3c20f6['model'];_0x22ea91['order']=qs['sort'](_0x53e3c0[_0xad00('0x36')]['sort']);_0x22ea91[_0xad00('0x40')]=qs[_0xad00('0x38')](_[_0xad00('0x57')](_0x53e3c0[_0xad00('0x36')],_0x3c20f6[_0xad00('0x38')]));if(_0x53e3c0[_0xad00('0x36')][_0xad00('0x41')]){_0x22ea91['where']=_['merge'](_0x22ea91['where'],{'$or':_['map'](_0x22ea91[_0xad00('0x39')],function(_0x3de807){var _0x41d2c8={};_0x41d2c8[_0x3de807]={'$like':'%'+_0x53e3c0[_0xad00('0x36')][_0xad00('0x41')]+'%'};return _0x41d2c8;})});}_0x22ea91=_['merge']({},_0x22ea91,_0x53e3c0['options']);return _0x5e4944[_0xad00('0x62')](_0x22ea91);}})['then'](function(_0x4e5ee4){if(_0x4e5ee4){_0x44e7f5=_0x4e5ee4[_0xad00('0x3c')];if(!_0x53e3c0['query']['hasOwnProperty'](_0xad00('0x3e'))){_0x22ea91[_0xad00('0x20')]=qs['limit'](_0x53e3c0[_0xad00('0x36')][_0xad00('0x20')]);_0x22ea91[_0xad00('0x1f')]=qs[_0xad00('0x1f')](_0x53e3c0[_0xad00('0x36')]['offset']);}return _0x5e4944[_0xad00('0x62')](_0x22ea91);}})[_0xad00('0x27')](function(_0x431473){if(_0x431473){return _0x431473?{'count':_0x44e7f5,'rows':_0x431473}:null;}})['then'](respondWithResult(_0x5b8478,null))['catch'](handleError(_0x5b8478,null));};exports[_0xad00('0x63')]=function(_0x42bfec,_0x52400e,_0x2a5851){var _0x45c21d=_0x42bfec[_0xad00('0x4a')][_0xad00('0x64')];return db[_0xad00('0x61')][_0xad00('0x65')]({'where':{'id':_0x45c21d},'attributes':['id'],'include':[{'model':db[_0xad00('0x59')],'as':_0xad00('0x66'),'attributes':['id',_0xad00('0x2d'),_0xad00('0x67'),_0xad00('0x68'),_0xad00('0x69')],'raw':!![]}]})['then'](function(_0x38cca7){if(_0x38cca7){var _0x47c92f=_[_0xad00('0x6a')](_0x38cca7,function(_0x1c3935){var _0x47ef59=_0x1c3935[_0xad00('0x28')]({'plain':!![]});return _0x47ef59['Agents'];});return db[_0xad00('0x30')][_0xad00('0x52')]({'where':{'id':_0x42bfec[_0xad00('0x48')]['id']}})['then'](function(_0x44eb95){return db['sequelize']['transaction'](function(_0x19ef2a){return _0x44eb95['addTeams'](_0x45c21d,{'transaction':_0x19ef2a})[_0xad00('0x27')](function(){return BPromise['each'](_0x47c92f,function(_0x5bd772){return db['UserFaxQueue'][_0xad00('0x6b')]({'where':{'UserId':_0x5bd772['id'],'FaxQueueId':_0x42bfec['params']['id']},'transaction':_0x19ef2a});});})[_0xad00('0x27')](function(){_0x47c92f[_0xad00('0x6c')](function(_0x4997ac){socket[_0xad00('0x6d')]('userFaxQueue:save',{'UserId':_0x4997ac['id'],'FaxQueueId':_0x44eb95['id']});});});});});}})[_0xad00('0x27')](respondWithStatusCode(_0x52400e,null))['catch'](handleError(_0x52400e,null));};exports[_0xad00('0x6e')]=function(_0x54de7d,_0x5e188a,_0x15517b){return db[_0xad00('0x61')][_0xad00('0x65')]({'where':{'id':_0x54de7d[_0xad00('0x36')]['ids']},'attributes':['id'],'include':[{'model':db[_0xad00('0x59')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xad00('0x27')](handleEntityNotFound(_0x5e188a,null))[_0xad00('0x27')](function(_0x38ed9f){var _0x377125=_['map'](_0x38ed9f,'id');var _0x22f1e7=[];var _0x2cc427=[];var _0x635dc3=squel[_0xad00('0x6f')]();_0x635dc3[_0xad00('0x70')](_0xad00('0x71'))[_0xad00('0x72')](_0xad00('0x73'),'tq')[_0xad00('0x74')](_0xad00('0x75'),'ut',_0xad00('0x76'))[_0xad00('0x40')](_0xad00('0x77'),_0x54de7d[_0xad00('0x48')]['id']);for(var _0x37c9cd=0x0;_0x37c9cd<_0x38ed9f[_0xad00('0x3c')];_0x37c9cd+=0x1){let _0x1a95ef=_0x38ed9f[_0x37c9cd];for(var _0x4a06fa=0x0;_0x4a06fa<_0x1a95ef['Agents']['length'];_0x4a06fa+=0x1){let _0x27685f=_0x1a95ef[_0xad00('0x66')][_0x4a06fa];var _0x4c881c=_0x635dc3[_0xad00('0x78')]();_0x4c881c[_0xad00('0x40')](_0xad00('0x79'),_0x27685f['id']);_0x2cc427[_0xad00('0x7a')](db[_0xad00('0x7b')][_0xad00('0x36')](_0x4c881c[_0xad00('0x7c')](),{'type':db[_0xad00('0x7b')]['QueryTypes'][_0xad00('0x7d')]})[_0xad00('0x27')](function(_0x384ae5){if(_0x384ae5['length']===0x1){return _0x27685f['id'];}else{var _0x493c41=_[_0xad00('0x7e')](_[_0xad00('0x2f')](_0x384ae5,_0xad00('0x7f')),function(_0x260135){return _[_0xad00('0x80')](_0x377125,_0x260135);});if(_0x493c41){return _0x27685f['id'];}}}));}}return BPromise[_0xad00('0x81')](_0x2cc427)[_0xad00('0x27')](function(_0x4e9a6a){_0x22f1e7=_(_0x22f1e7)[_0xad00('0x82')](_0x4e9a6a)[_0xad00('0x83')]()[_0xad00('0x84')]();return db[_0xad00('0x30')][_0xad00('0x52')]({'where':{'id':_0x54de7d[_0xad00('0x48')]['id']}})[_0xad00('0x27')](function(_0x26fe4a){return db[_0xad00('0x7b')]['transaction'](function(_0x44b22d){return _0x26fe4a[_0xad00('0x6e')](_0x54de7d[_0xad00('0x36')]['ids'],{'transaction':_0x44b22d})[_0xad00('0x27')](function(){if(!_[_0xad00('0x85')](_0x22f1e7)){return _0x26fe4a[_0xad00('0x86')](_0x22f1e7,{'transaction':_0x44b22d});}})[_0xad00('0x27')](function(){_0x22f1e7['forEach'](function(_0x16ba55){socket[_0xad00('0x6d')]('userFaxQueue:remove',{'UserId':_0x16ba55,'FaxQueueId':_0x26fe4a['id']});});});});});});})['then'](respondWithStatusCode(_0x5e188a,null))[_0xad00('0x46')](handleError(_0x5e188a,null));};exports['addAgents']=function(_0x5b8d7e,_0x38a2f4,_0x3ab5ca){return db['FaxQueue'][_0xad00('0x52')]({'where':{'id':_0x5b8d7e['params']['id']}})[_0xad00('0x27')](handleEntityNotFound(_0x38a2f4,null))[_0xad00('0x27')](function(_0x4911cc){if(_0x4911cc){return _0x4911cc[_0xad00('0x87')](_0x5b8d7e[_0xad00('0x4a')][_0xad00('0x64')],_['omit'](_0x5b8d7e[_0xad00('0x4a')],[_0xad00('0x64'),'id'])||{})[_0xad00('0x88')](function(_0x772fc){for(var _0x29e155=0x0;_0x29e155<_0x5b8d7e[_0xad00('0x4a')]['ids'][_0xad00('0x3c')];_0x29e155+=0x1){socket[_0xad00('0x6d')]('userFaxQueue:save',{'UserId':Number(_0x5b8d7e[_0xad00('0x4a')]['ids'][_0x29e155]),'FaxQueueId':Number(_0x5b8d7e[_0xad00('0x48')]['id'])});}return _0x772fc;});}})['then'](respondWithResult(_0x38a2f4,null))[_0xad00('0x46')](handleError(_0x38a2f4,null));};exports[_0xad00('0x86')]=function(_0x3d8d82,_0x66c0eb,_0x376e99){return db[_0xad00('0x30')][_0xad00('0x52')]({'where':{'id':_0x3d8d82[_0xad00('0x48')]['id']}})[_0xad00('0x27')](handleEntityNotFound(_0x66c0eb,null))[_0xad00('0x27')](function(_0x16eccb){if(_0x16eccb){return _0x16eccb[_0xad00('0x86')](_0x3d8d82[_0xad00('0x36')][_0xad00('0x64')])[_0xad00('0x27')](function(){if(_[_0xad00('0x89')](_0x3d8d82[_0xad00('0x36')]['ids'])){for(var _0x14f15d=0x0;_0x14f15d<_0x3d8d82['query'][_0xad00('0x64')][_0xad00('0x3c')];_0x14f15d+=0x1){socket[_0xad00('0x6d')]('userFaxQueue:remove',{'UserId':Number(_0x3d8d82['query']['ids'][_0x14f15d]),'FaxQueueId':Number(_0x3d8d82[_0xad00('0x48')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x3d8d82[_0xad00('0x36')]['ids']),'FaxQueueId':Number(_0x3d8d82[_0xad00('0x48')]['id'])});}});}})[_0xad00('0x27')](respondWithStatusCode(_0x66c0eb,null))[_0xad00('0x46')](handleError(_0x66c0eb,null));};exports['getAgents']=function(_0x45b0ce,_0x27cef,_0x17c3da){var _0x315974={};var _0xe5ce2a={};var _0x3cb880;var _0x29866e;return db[_0xad00('0x30')][_0xad00('0x55')]({'where':{'id':_0x45b0ce[_0xad00('0x48')]['id']}})['then'](handleEntityNotFound(_0x27cef,null))[_0xad00('0x27')](function(_0x1c98f6){if(_0x1c98f6){_0x3cb880=_0x1c98f6;_0xe5ce2a['model']=_[_0xad00('0x37')](db[_0xad00('0x59')][_0xad00('0x31')]);_0xe5ce2a[_0xad00('0x36')]=_[_0xad00('0x37')](_0x45b0ce[_0xad00('0x36')]);_0xe5ce2a[_0xad00('0x38')]=_[_0xad00('0x3a')](_0xe5ce2a[_0xad00('0x35')],_0xe5ce2a[_0xad00('0x36')]);_0x315974[_0xad00('0x39')]=_['intersection'](_0xe5ce2a['model'],qs[_0xad00('0x3b')](_0x45b0ce[_0xad00('0x36')][_0xad00('0x3b')]));_0x315974[_0xad00('0x39')]=_0x315974[_0xad00('0x39')]['length']?_0x315974[_0xad00('0x39')]:_0xe5ce2a[_0xad00('0x35')];_0x315974[_0xad00('0x8a')]=qs[_0xad00('0x3f')](_0x45b0ce[_0xad00('0x36')]['sort']);_0x315974[_0xad00('0x40')]=qs['filters'](_['pick'](_0x45b0ce[_0xad00('0x36')],_0xe5ce2a[_0xad00('0x38')]));if(_0x45b0ce['query']['filter']){_0x315974[_0xad00('0x40')]=_['merge'](_0x315974['where'],{'$or':_[_0xad00('0x2f')](_0x315974[_0xad00('0x39')],function(_0x21ebe5){var _0xb310e1={};_0xb310e1[_0x21ebe5]={'$like':'%'+_0x45b0ce['query'][_0xad00('0x41')]+'%'};return _0xb310e1;})});}_0x315974=_[_0xad00('0x42')]({},_0x315974,_0x45b0ce[_0xad00('0x43')]);return _0x3cb880[_0xad00('0x8b')](_0x315974);}})['then'](function(_0x36ee00){if(_0x36ee00){_0x29866e=_0x36ee00[_0xad00('0x3c')];if(!_0x45b0ce['query']['hasOwnProperty']('nolimit')){_0x315974[_0xad00('0x20')]=qs[_0xad00('0x20')](_0x45b0ce[_0xad00('0x36')]['limit']);_0x315974[_0xad00('0x1f')]=qs[_0xad00('0x1f')](_0x45b0ce['query'][_0xad00('0x1f')]);}return _0x3cb880[_0xad00('0x8b')](_0x315974);}})[_0xad00('0x27')](function(_0x71824e){if(_0x71824e){return _0x71824e?{'count':_0x29866e,'rows':_0x71824e}:null;}})[_0xad00('0x27')](respondWithResult(_0x27cef,null))[_0xad00('0x46')](handleError(_0x27cef,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index d3167d5..d930b95 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 _0xb2ea=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0xb2ea,0x124));var _0xab2e=function(_0x29c261,_0x3af39a){_0x29c261=_0x29c261-0x0;var _0x1a9335=_0xb2ea[_0x29c261];return _0x1a9335;};'use strict';var EventEmitter=require(_0xab2e('0x0'));var FaxQueue=require(_0xab2e('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xab2e('0x2')](0x0);var events={'afterCreate':_0xab2e('0x3'),'afterUpdate':_0xab2e('0x4'),'afterDestroy':_0xab2e('0x5')};function emitEvent(_0x4e8254){return function(_0x430c7a,_0x523185,_0x26d861){FaxQueueEvents[_0xab2e('0x6')](_0x4e8254+':'+_0x430c7a['id'],_0x430c7a);FaxQueueEvents[_0xab2e('0x6')](_0x4e8254,_0x430c7a);_0x26d861(null);};}for(var e in events){if(events[_0xab2e('0x7')](e)){var event=events[e];FaxQueue[_0xab2e('0x8')](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file +var _0xc782=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','save','update','remove'];(function(_0x5b4e81,_0x1511af){var _0x36d33b=function(_0x2f6ef4){while(--_0x2f6ef4){_0x5b4e81['push'](_0x5b4e81['shift']());}};_0x36d33b(++_0x1511af);}(_0xc782,0x180));var _0x2c78=function(_0x107df9,_0x4d1825){_0x107df9=_0x107df9-0x0;var _0x2df84a=_0xc782[_0x107df9];return _0x2df84a;};'use strict';var EventEmitter=require(_0x2c78('0x0'));var FaxQueue=require(_0x2c78('0x1'))['db'][_0x2c78('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2c78('0x3'),'afterUpdate':_0x2c78('0x4'),'afterDestroy':_0x2c78('0x5')};function emitEvent(_0x16d78c){return function(_0x419ff1,_0x9a2636,_0x4c7827){FaxQueueEvents[_0x2c78('0x6')](_0x16d78c+':'+_0x419ff1['id'],_0x419ff1);FaxQueueEvents[_0x2c78('0x6')](_0x16d78c,_0x419ff1);_0x4c7827(null);};}for(var e in events){if(events[_0x2c78('0x7')](e)){var event=events[e];FaxQueue[_0x2c78('0x8')](e,emitEvent(event));}}module[_0x2c78('0x9')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index eff9e6a..8eb9fac 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 _0x340c=['bluebird','path','../../config/environment','./faxQueue.attributes','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0x340c,0x19f));var _0xc340=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x340c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc340('0x0'));var util=require(_0xc340('0x1'));var logger=require(_0xc340('0x2'))(_0xc340('0x3'));var moment=require(_0xc340('0x4'));var BPromise=require(_0xc340('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc340('0x6'));var rimraf=require('rimraf');var config=require(_0xc340('0x7'));var attributes=require(_0xc340('0x8'));module['exports']=function(_0x56e3f1,_0x4584ad){return _0x56e3f1[_0xc340('0x9')](_0xc340('0xa'),attributes,{'tableName':_0xc340('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb89c=['fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxQueue.attributes','exports','FaxQueue'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xb89c,0xe5));var _0xcb89=function(_0x328505,_0x4b3105){_0x328505=_0x328505-0x0;var _0x1994ff=_0xb89c[_0x328505];return _0x1994ff;};'use strict';var _=require(_0xcb89('0x0'));var util=require(_0xcb89('0x1'));var logger=require(_0xcb89('0x2'))(_0xcb89('0x3'));var moment=require(_0xcb89('0x4'));var BPromise=require('bluebird');var rp=require(_0xcb89('0x5'));var fs=require('fs');var path=require(_0xcb89('0x6'));var rimraf=require('rimraf');var config=require(_0xcb89('0x7'));var attributes=require(_0xcb89('0x8'));module[_0xcb89('0x9')]=function(_0x48dc28,_0x1e3d2f){return _0x48dc28['define'](_0xcb89('0xa'),attributes,{'tableName':_0xcb89('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 360eac3..3157076 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 _0xd46f=['register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowFaxQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./faxQueue.socket'];(function(_0x1c0f3d,_0x55a9e2){var _0x4d71a8=function(_0xeff131){while(--_0xeff131){_0x1c0f3d['push'](_0x1c0f3d['shift']());}};_0x4d71a8(++_0x55a9e2);}(_0xd46f,0x1d3));var _0xfd46=function(_0x3add81,_0x4791ac){_0x3add81=_0x3add81-0x0;var _0xfd9b7c=_0xd46f[_0x3add81];return _0xfd9b7c;};'use strict';var _=require(_0xfd46('0x0'));var util=require(_0xfd46('0x1'));var moment=require(_0xfd46('0x2'));var BPromise=require(_0xfd46('0x3'));var rs=require(_0xfd46('0x4'));var fs=require('fs');var Redis=require(_0xfd46('0x5'));var db=require(_0xfd46('0x6'))['db'];var utils=require(_0xfd46('0x7'));var logger=require(_0xfd46('0x8'))(_0xfd46('0x9'));var config=require('../../config/environment');var jayson=require(_0xfd46('0xa'));var client=jayson[_0xfd46('0xb')][_0xfd46('0xc')]({'port':0x232a});config[_0xfd46('0xd')]=_[_0xfd46('0xe')](config[_0xfd46('0xd')],{'host':_0xfd46('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfd46('0xd')]));require(_0xfd46('0x10'))[_0xfd46('0x11')](socket);function respondWithRpcPromise(_0x474dfa,_0x33d28a,_0x312233){return new BPromise(function(_0x1e8df5,_0x4ea34d){return client[_0xfd46('0x12')](_0x474dfa,_0x312233)[_0xfd46('0x13')](function(_0x3538ec){logger[_0xfd46('0x14')](_0xfd46('0x15'),_0x33d28a,_0xfd46('0x16'));logger[_0xfd46('0x17')](_0xfd46('0x18'),_0x33d28a,'request\x20sent',JSON[_0xfd46('0x19')](_0x3538ec));if(_0x3538ec['error']){if(_0x3538ec[_0xfd46('0x1a')][_0xfd46('0x1b')]===0x1f4){logger[_0xfd46('0x1a')](_0xfd46('0x15'),_0x33d28a,_0x3538ec[_0xfd46('0x1a')]['message']);return _0x4ea34d(_0x3538ec[_0xfd46('0x1a')][_0xfd46('0x1c')]);}logger[_0xfd46('0x1a')](_0xfd46('0x15'),_0x33d28a,_0x3538ec[_0xfd46('0x1a')][_0xfd46('0x1c')]);return _0x1e8df5(_0x3538ec['error'][_0xfd46('0x1c')]);}else{logger[_0xfd46('0x14')]('FaxQueue,\x20%s,\x20%s',_0x33d28a,_0xfd46('0x16'));_0x1e8df5(_0x3538ec[_0xfd46('0x1d')][_0xfd46('0x1c')]);}})[_0xfd46('0x1e')](function(_0x2fd198){logger[_0xfd46('0x1a')](_0xfd46('0x15'),_0x33d28a,_0x2fd198);_0x4ea34d(_0x2fd198);});});}exports[_0xfd46('0x1f')]=function(_0x400ff1){var _0x317183=this;return new Promise(function(_0x470c35,_0x481aa3){return db[_0xfd46('0x20')][_0xfd46('0x21')]({'raw':_0x400ff1[_0xfd46('0x22')]?_0x400ff1[_0xfd46('0x22')][_0xfd46('0x23')]===undefined?!![]:![]:!![],'where':_0x400ff1[_0xfd46('0x22')]?_0x400ff1[_0xfd46('0x22')][_0xfd46('0x24')]||null:null,'attributes':_0x400ff1[_0xfd46('0x22')]?_0x400ff1[_0xfd46('0x22')]['attributes']||null:null,'limit':_0x400ff1[_0xfd46('0x22')]?_0x400ff1['options'][_0xfd46('0x25')]||null:null,'include':_0x400ff1['options']?_0x400ff1[_0xfd46('0x22')][_0xfd46('0x26')]?_[_0xfd46('0x27')](_0x400ff1[_0xfd46('0x22')]['include'],function(_0x1b8cac){return{'model':db[_0x1b8cac[_0xfd46('0x28')]],'as':_0x1b8cac['as'],'attributes':_0x1b8cac[_0xfd46('0x29')],'include':_0x1b8cac['include']?_[_0xfd46('0x27')](_0x1b8cac[_0xfd46('0x26')],function(_0x3beabd){return{'model':db[_0x3beabd[_0xfd46('0x28')]],'as':_0x3beabd['as'],'attributes':_0x3beabd[_0xfd46('0x29')],'include':_0x3beabd[_0xfd46('0x26')]?_[_0xfd46('0x27')](_0x3beabd[_0xfd46('0x26')],function(_0x1748a8){return{'model':db[_0x1748a8[_0xfd46('0x28')]],'as':_0x1748a8['as'],'attributes':_0x1748a8[_0xfd46('0x29')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d249c){logger[_0xfd46('0x14')](_0xfd46('0x1f'),_0x400ff1);logger[_0xfd46('0x17')](_0xfd46('0x1f'),_0x400ff1,JSON[_0xfd46('0x19')](_0x5d249c));_0x470c35(_0x5d249c);})[_0xfd46('0x1e')](function(_0x48392d){logger[_0xfd46('0x1a')](_0xfd46('0x1f'),_0x48392d[_0xfd46('0x1c')],_0x400ff1);_0x481aa3(_0x317183[_0xfd46('0x1a')](0x1f4,_0x48392d[_0xfd46('0x1c')]));});});};exports[_0xfd46('0x2a')]=function(_0x21f696){var _0x87c898=this;return new Promise(function(_0x55dbf4,_0x202906){return db[_0xfd46('0x20')][_0xfd46('0x2b')]({'raw':_0x21f696[_0xfd46('0x22')]?_0x21f696[_0xfd46('0x22')][_0xfd46('0x23')]===undefined?!![]:![]:!![],'where':_0x21f696['options']?_0x21f696[_0xfd46('0x22')][_0xfd46('0x24')]||null:null,'attributes':_0x21f696['options']?_0x21f696[_0xfd46('0x22')][_0xfd46('0x29')]||null:null,'include':_0x21f696[_0xfd46('0x22')]?_0x21f696[_0xfd46('0x22')][_0xfd46('0x26')]?_[_0xfd46('0x27')](_0x21f696[_0xfd46('0x22')]['include'],function(_0x3c6255){return{'model':db[_0x3c6255[_0xfd46('0x28')]],'as':_0x3c6255['as'],'attributes':_0x3c6255[_0xfd46('0x29')],'include':_0x3c6255[_0xfd46('0x26')]?_[_0xfd46('0x27')](_0x3c6255['include'],function(_0x25bbf3){return{'model':db[_0x25bbf3[_0xfd46('0x28')]],'as':_0x25bbf3['as'],'attributes':_0x25bbf3[_0xfd46('0x29')],'include':_0x25bbf3[_0xfd46('0x26')]?_[_0xfd46('0x27')](_0x25bbf3['include'],function(_0xd6455){return{'model':db[_0xd6455[_0xfd46('0x28')]],'as':_0xd6455['as'],'attributes':_0xd6455[_0xfd46('0x29')]};}):[]};}):[]};}):[]:[]})[_0xfd46('0x13')](function(_0xf6c2c2){logger[_0xfd46('0x14')](_0xfd46('0x2a'),_0x21f696);logger[_0xfd46('0x17')](_0xfd46('0x2a'),_0x21f696,JSON[_0xfd46('0x19')](_0xf6c2c2));_0x55dbf4(_0xf6c2c2);})['catch'](function(_0x10a9c1){logger[_0xfd46('0x1a')](_0xfd46('0x2a'),_0x10a9c1[_0xfd46('0x1c')],_0x21f696);_0x202906(_0x87c898[_0xfd46('0x1a')](0x1f4,_0x10a9c1[_0xfd46('0x1c')]));});});}; \ No newline at end of file +var _0x9a72=['model','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','GetFaxQueue','FaxQueue','options','where','attributes','map','include'];(function(_0x5d31ee,_0x183e43){var _0x21c2e6=function(_0x176343){while(--_0x176343){_0x5d31ee['push'](_0x5d31ee['shift']());}};_0x21c2e6(++_0x183e43);}(_0x9a72,0xda));var _0x29a7=function(_0x593254,_0x398971){_0x593254=_0x593254-0x0;var _0x44f13c=_0x9a72[_0x593254];return _0x44f13c;};'use strict';var _=require(_0x29a7('0x0'));var util=require(_0x29a7('0x1'));var moment=require(_0x29a7('0x2'));var BPromise=require(_0x29a7('0x3'));var rs=require(_0x29a7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x29a7('0x5'));var logger=require(_0x29a7('0x6'))(_0x29a7('0x7'));var config=require(_0x29a7('0x8'));var jayson=require(_0x29a7('0x9'));var client=jayson['client'][_0x29a7('0xa')]({'port':0x232a});config[_0x29a7('0xb')]=_[_0x29a7('0xc')](config[_0x29a7('0xb')],{'host':_0x29a7('0xd'),'port':0x18eb});var socket=require(_0x29a7('0xe'))(new Redis(config[_0x29a7('0xb')]));require(_0x29a7('0xf'))['register'](socket);function respondWithRpcPromise(_0x2b5f95,_0x372407,_0x1db4c9){return new BPromise(function(_0x56aff3,_0x37f50d){return client[_0x29a7('0x10')](_0x2b5f95,_0x1db4c9)[_0x29a7('0x11')](function(_0x1ae88b){logger['info'](_0x29a7('0x12'),_0x372407,_0x29a7('0x13'));logger[_0x29a7('0x14')](_0x29a7('0x15'),_0x372407,'request\x20sent',JSON[_0x29a7('0x16')](_0x1ae88b));if(_0x1ae88b[_0x29a7('0x17')]){if(_0x1ae88b[_0x29a7('0x17')]['code']===0x1f4){logger[_0x29a7('0x17')](_0x29a7('0x12'),_0x372407,_0x1ae88b[_0x29a7('0x17')][_0x29a7('0x18')]);return _0x37f50d(_0x1ae88b['error'][_0x29a7('0x18')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x372407,_0x1ae88b[_0x29a7('0x17')][_0x29a7('0x18')]);return _0x56aff3(_0x1ae88b['error'][_0x29a7('0x18')]);}else{logger[_0x29a7('0x19')]('FaxQueue,\x20%s,\x20%s',_0x372407,'request\x20sent');_0x56aff3(_0x1ae88b['result'][_0x29a7('0x18')]);}})[_0x29a7('0x1a')](function(_0x483e27){logger[_0x29a7('0x17')](_0x29a7('0x12'),_0x372407,_0x483e27);_0x37f50d(_0x483e27);});});}exports[_0x29a7('0x1b')]=function(_0x41140f){var _0xbca942=this;return new Promise(function(_0x5bb50e,_0x184381){return db[_0x29a7('0x1c')]['findAll']({'raw':_0x41140f['options']?_0x41140f[_0x29a7('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x41140f['options']?_0x41140f[_0x29a7('0x1d')][_0x29a7('0x1e')]||null:null,'attributes':_0x41140f[_0x29a7('0x1d')]?_0x41140f['options'][_0x29a7('0x1f')]||null:null,'limit':_0x41140f[_0x29a7('0x1d')]?_0x41140f[_0x29a7('0x1d')]['limit']||null:null,'include':_0x41140f[_0x29a7('0x1d')]?_0x41140f[_0x29a7('0x1d')]['include']?_[_0x29a7('0x20')](_0x41140f[_0x29a7('0x1d')][_0x29a7('0x21')],function(_0x167294){return{'model':db[_0x167294[_0x29a7('0x22')]],'as':_0x167294['as'],'attributes':_0x167294[_0x29a7('0x1f')],'include':_0x167294[_0x29a7('0x21')]?_[_0x29a7('0x20')](_0x167294[_0x29a7('0x21')],function(_0x103860){return{'model':db[_0x103860['model']],'as':_0x103860['as'],'attributes':_0x103860[_0x29a7('0x1f')],'include':_0x103860[_0x29a7('0x21')]?_[_0x29a7('0x20')](_0x103860[_0x29a7('0x21')],function(_0x361f26){return{'model':db[_0x361f26[_0x29a7('0x22')]],'as':_0x361f26['as'],'attributes':_0x361f26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cbd3f){logger[_0x29a7('0x19')](_0x29a7('0x1b'),_0x41140f);logger['debug']('GetFaxQueue',_0x41140f,JSON[_0x29a7('0x16')](_0x3cbd3f));_0x5bb50e(_0x3cbd3f);})[_0x29a7('0x1a')](function(_0x310dba){logger[_0x29a7('0x17')]('GetFaxQueue',_0x310dba[_0x29a7('0x18')],_0x41140f);_0x184381(_0xbca942['error'](0x1f4,_0x310dba[_0x29a7('0x18')]));});});};exports[_0x29a7('0x23')]=function(_0x409612){var _0x48af76=this;return new Promise(function(_0x29da8f,_0xf72197){return db[_0x29a7('0x1c')]['find']({'raw':_0x409612['options']?_0x409612[_0x29a7('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x409612[_0x29a7('0x1d')]?_0x409612[_0x29a7('0x1d')][_0x29a7('0x1e')]||null:null,'attributes':_0x409612['options']?_0x409612[_0x29a7('0x1d')][_0x29a7('0x1f')]||null:null,'include':_0x409612[_0x29a7('0x1d')]?_0x409612[_0x29a7('0x1d')][_0x29a7('0x21')]?_[_0x29a7('0x20')](_0x409612['options'][_0x29a7('0x21')],function(_0x3e4060){return{'model':db[_0x3e4060[_0x29a7('0x22')]],'as':_0x3e4060['as'],'attributes':_0x3e4060['attributes'],'include':_0x3e4060[_0x29a7('0x21')]?_[_0x29a7('0x20')](_0x3e4060['include'],function(_0x4eba1f){return{'model':db[_0x4eba1f['model']],'as':_0x4eba1f['as'],'attributes':_0x4eba1f[_0x29a7('0x1f')],'include':_0x4eba1f[_0x29a7('0x21')]?_[_0x29a7('0x20')](_0x4eba1f[_0x29a7('0x21')],function(_0x36ccce){return{'model':db[_0x36ccce[_0x29a7('0x22')]],'as':_0x36ccce['as'],'attributes':_0x36ccce[_0x29a7('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b865f){logger[_0x29a7('0x19')]('ShowFaxQueue',_0x409612);logger['debug']('ShowFaxQueue',_0x409612,JSON[_0x29a7('0x16')](_0x5b865f));_0x29da8f(_0x5b865f);})[_0x29a7('0x1a')](function(_0x585457){logger[_0x29a7('0x17')](_0x29a7('0x23'),_0x585457[_0x29a7('0x18')],_0x409612);_0xf72197(_0x48af76['error'](0x1f4,_0x585457['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index ef207df..dff723c 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 _0xbb93=['emit','length','./faxQueue.events','remove'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xbb93,0x1b2));var _0x3bb9=function(_0x4ef003,_0x323c80){_0x4ef003=_0x4ef003-0x0;var _0x2cffb3=_0xbb93[_0x4ef003];return _0x2cffb3;};'use strict';var FaxQueueEvents=require(_0x3bb9('0x0'));var events=['save',_0x3bb9('0x1'),'update'];function createListener(_0x117989,_0x512348){return function(_0xc1b8a6){_0x512348[_0x3bb9('0x2')](_0x117989,_0xc1b8a6);};}function removeListener(_0x3883bd,_0x53e990){return function(){FaxQueueEvents['removeListener'](_0x3883bd,_0x53e990);};}exports['register']=function(_0x3fe0db){for(var _0x2c9eaa=0x0,_0x46869d=events[_0x3bb9('0x3')];_0x2c9eaa<_0x46869d;_0x2c9eaa++){var _0x33badb=events[_0x2c9eaa];var _0x4050df=createListener('faxQueue:'+_0x33badb,_0x3fe0db);FaxQueueEvents['on'](_0x33badb,_0x4050df);}}; \ No newline at end of file +var _0x28e4=['update','removeListener','register','length','./faxQueue.events','save','remove'];(function(_0x55ba17,_0x2c6e87){var _0x3716b5=function(_0x2b7222){while(--_0x2b7222){_0x55ba17['push'](_0x55ba17['shift']());}};_0x3716b5(++_0x2c6e87);}(_0x28e4,0x11c));var _0x428e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28e4[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require(_0x428e('0x0'));var events=[_0x428e('0x1'),_0x428e('0x2'),_0x428e('0x3')];function createListener(_0x39da09,_0x253594){return function(_0x46e41e){_0x253594['emit'](_0x39da09,_0x46e41e);};}function removeListener(_0x4b2d9b,_0x18d91d){return function(){FaxQueueEvents[_0x428e('0x4')](_0x4b2d9b,_0x18d91d);};}exports[_0x428e('0x5')]=function(_0x5052f7){for(var _0x3ab35a=0x0,_0x4cdc6f=events[_0x428e('0x6')];_0x3ab35a<_0x4cdc6f;_0x3ab35a++){var _0x5b0d72=events[_0x3ab35a];var _0x516f8c=createListener('faxQueue:'+_0x5b0d72,_0x5052f7);FaxQueueEvents['on'](_0x5b0d72,_0x516f8c);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index b7e2499..b4a623e 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 _0x0af5=['create','addTeams','destroy','delete','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0x0af5,0x158));var _0x50af=function(_0x4f9a2d,_0x2ca2dc){_0x4f9a2d=_0x4f9a2d-0x0;var _0x27e967=_0x0af5[_0x4f9a2d];return _0x27e967;};'use strict';var multer=require('multer');var util=require(_0x50af('0x0'));var path=require(_0x50af('0x1'));var timeout=require(_0x50af('0x2'));var express=require(_0x50af('0x3'));var router=express[_0x50af('0x4')]();var fs_extra=require(_0x50af('0x5'));var auth=require(_0x50af('0x6'));var interaction=require(_0x50af('0x7'));var config=require(_0x50af('0x8'));var controller=require(_0x50af('0x9'));router[_0x50af('0xa')]('/',auth[_0x50af('0xb')](),controller['index']);router['get'](_0x50af('0xc'),auth[_0x50af('0xb')](),controller['describe']);router['get'](_0x50af('0xd'),auth[_0x50af('0xb')](),controller['show']);router['get'](_0x50af('0xe'),auth[_0x50af('0xb')](),controller['getMembers']);router[_0x50af('0xa')](_0x50af('0xf'),auth[_0x50af('0xb')](),controller[_0x50af('0x10')]);router['get'](_0x50af('0x11'),auth[_0x50af('0xb')](),controller[_0x50af('0x12')]);router[_0x50af('0x13')]('/',auth[_0x50af('0xb')](),controller[_0x50af('0x14')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x50af('0x15')]);router['post'](_0x50af('0x11'),auth[_0x50af('0xb')](),controller['addAgents']);router['put'](_0x50af('0xd'),auth[_0x50af('0xb')](),controller['update']);router['delete'](_0x50af('0xd'),auth[_0x50af('0xb')](),controller[_0x50af('0x16')]);router[_0x50af('0x17')](_0x50af('0xf'),auth[_0x50af('0xb')](),controller[_0x50af('0x18')]);router[_0x50af('0x17')](_0x50af('0x11'),auth[_0x50af('0xb')](),controller['removeAgents']);module[_0x50af('0x19')]=router; \ No newline at end of file +var _0xf2e3=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','/:id/users','put','update','delete','destroy','removeAgents','exports'];(function(_0x4c4569,_0x46d59d){var _0x5c8090=function(_0xfa0c47){while(--_0xfa0c47){_0x4c4569['push'](_0x4c4569['shift']());}};_0x5c8090(++_0x46d59d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf2e3[_0x2c91e9];return _0x13f0ff;};'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('0xc')](_0x3f2e('0x11'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x12')]);router[_0x3f2e('0xc')](_0x3f2e('0x13'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x14')]);router[_0x3f2e('0xc')]('/:id/users',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x15')]);router['post']('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x16')]);router[_0x3f2e('0x17')](_0x3f2e('0x13'),auth[_0x3f2e('0xa')](),controller['addTeams']);router[_0x3f2e('0x17')](_0x3f2e('0x18'),auth[_0x3f2e('0xa')](),controller['addAgents']);router[_0x3f2e('0x19')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x1a')]);router[_0x3f2e('0x1b')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x1c')]);router[_0x3f2e('0x1b')](_0x3f2e('0x13'),auth[_0x3f2e('0xa')](),controller['removeTeams']);router[_0x3f2e('0x1b')](_0x3f2e('0x18'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x1d')]);module[_0x3f2e('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 9e29a0b..b1e7cb9 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 _0xd1db=['sequelize','exports','STRING','DATE'];(function(_0x1e2a97,_0x4c0067){var _0x1f52e0=function(_0x493bf5){while(--_0x493bf5){_0x1e2a97['push'](_0x1e2a97['shift']());}};_0x1f52e0(++_0x4c0067);}(_0xd1db,0x90));var _0xbd1d=function(_0x421cf8,_0x23152c){_0x421cf8=_0x421cf8-0x0;var _0x145c48=_0xd1db[_0x421cf8];return _0x145c48;};'use strict';var moment=require('moment');var Sequelize=require(_0xbd1d('0x0'));module[_0xbd1d('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbd1d('0x2')]},'joinAt':{'type':Sequelize[_0xbd1d('0x3')]},'leaveAt':{'type':Sequelize[_0xbd1d('0x3')]},'acceptAt':{'type':Sequelize[_0xbd1d('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xde1d=['DATE','sequelize','exports','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xde1d,0x109));var _0xdde1=function(_0x99c2dd,_0x1d32eb){_0x99c2dd=_0x99c2dd-0x0;var _0x173349=_0xde1d[_0x99c2dd];return _0x173349;};'use strict';var moment=require('moment');var Sequelize=require(_0xdde1('0x0'));module[_0xdde1('0x1')]={'uniqueid':{'type':Sequelize[_0xdde1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdde1('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xdde1('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xdde1('0x3')]},'reason':{'type':Sequelize[_0xdde1('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b9788fb..a9301c8 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 _0x9086=['destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','FaxQueueReport','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9086,0x10b));var _0x6908=function(_0x223b71,_0x597bfb){_0x223b71=_0x223b71-0x0;var _0x4131e4=_0x9086[_0x223b71];return _0x4131e4;};'use strict';var emlformat=require(_0x6908('0x0'));var rimraf=require(_0x6908('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6908('0x2'));var rp=require(_0x6908('0x3'));var moment=require(_0x6908('0x4'));var BPromise=require(_0x6908('0x5'));var Mustache=require(_0x6908('0x6'));var util=require(_0x6908('0x7'));var path=require('path');var sox=require(_0x6908('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6908('0x9'));var _=require('lodash');var squel=require(_0x6908('0xa'));var crypto=require(_0x6908('0xb'));var jsforce=require(_0x6908('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6908('0xd'));var querystring=require('querystring');var Papa=require(_0x6908('0xe'));var Redis=require('ioredis');var authService=require(_0x6908('0xf'));var qs=require(_0x6908('0x10'));var as=require(_0x6908('0x11'));var hardwareService=require(_0x6908('0x12'));var logger=require(_0x6908('0x13'))('api');var utils=require(_0x6908('0x14'));var config=require(_0x6908('0x15'));var licenseUtil=require(_0x6908('0x16'));var db=require(_0x6908('0x17'))['db'];function respondWithStatusCode(_0x2ad916,_0x448250){_0x448250=_0x448250||0xcc;return function(_0x28a623){if(_0x28a623){return _0x2ad916[_0x6908('0x18')](_0x448250);}return _0x2ad916[_0x6908('0x19')](_0x448250)['end']();};}function respondWithResult(_0x2dfecc,_0x5b819c){_0x5b819c=_0x5b819c||0xc8;return function(_0xc967ec){if(_0xc967ec){return _0x2dfecc[_0x6908('0x19')](_0x5b819c)['json'](_0xc967ec);}};}function respondWithFilteredResult(_0x108e25,_0x3c42b1){return function(_0x2e2f1f){if(_0x2e2f1f){var _0x3badf9=typeof _0x3c42b1[_0x6908('0x1a')]==='undefined'&&typeof _0x3c42b1['limit']===_0x6908('0x1b');var _0x34f15e=_0x2e2f1f[_0x6908('0x1c')];var _0x4e8ea3=_0x3badf9?0x0:_0x3c42b1[_0x6908('0x1a')];var _0x5e8253=_0x3badf9?_0x2e2f1f[_0x6908('0x1c')]:_0x3c42b1[_0x6908('0x1a')]+_0x3c42b1[_0x6908('0x1d')];var _0x5f1063;if(_0x5e8253>=_0x34f15e){_0x5e8253=_0x34f15e;_0x5f1063=0xc8;}else{_0x5f1063=0xce;}_0x108e25[_0x6908('0x19')](_0x5f1063);return _0x108e25[_0x6908('0x1e')]('Content-Range',_0x4e8ea3+'-'+_0x5e8253+'/'+_0x34f15e)[_0x6908('0x1f')](_0x2e2f1f);}return null;};}function patchUpdates(_0x458be9){return function(_0x15d8dc){try{jsonpatch[_0x6908('0x20')](_0x15d8dc,_0x458be9,!![]);}catch(_0xccffb2){return BPromise[_0x6908('0x21')](_0xccffb2);}return _0x15d8dc[_0x6908('0x22')]();};}function saveUpdates(_0x1d8889,_0x10fd5a){return function(_0x2b2614){if(_0x2b2614){return _0x2b2614[_0x6908('0x23')](_0x1d8889)[_0x6908('0x24')](function(_0x401740){return _0x401740;});}return null;};}function removeEntity(_0x3cb627,_0x312231){return function(_0x2eb759){if(_0x2eb759){return _0x2eb759[_0x6908('0x25')]()[_0x6908('0x24')](function(){_0x3cb627[_0x6908('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x363dc6,_0x1854dc){return function(_0x4af0fc){if(!_0x4af0fc){_0x363dc6[_0x6908('0x18')](0x194);}return _0x4af0fc;};}function handleError(_0x5f140e,_0x5232be){_0x5232be=_0x5232be||0x1f4;return function(_0xb8c62){logger[_0x6908('0x26')](_0xb8c62[_0x6908('0x27')]);if(_0xb8c62[_0x6908('0x28')]){delete _0xb8c62[_0x6908('0x28')];}_0x5f140e[_0x6908('0x19')](_0x5232be)[_0x6908('0x29')](_0xb8c62);};}exports[_0x6908('0x2a')]=function(_0x208274,_0x5b0329){var _0x2a0d51={},_0x315234={},_0x804455={'count':0x0,'rows':[]};var _0x44be5d=_['map'](db['FaxQueueReport'][_0x6908('0x2b')],function(_0x2aa657){return{'name':_0x2aa657[_0x6908('0x2c')],'type':_0x2aa657[_0x6908('0x2d')][_0x6908('0x2e')]};});_0x315234[_0x6908('0x2f')]=_[_0x6908('0x30')](_0x44be5d,_0x6908('0x28'));_0x315234[_0x6908('0x31')]=_[_0x6908('0x32')](_0x208274[_0x6908('0x31')]);_0x315234[_0x6908('0x33')]=_['intersection'](_0x315234['model'],_0x315234[_0x6908('0x31')]);_0x2a0d51[_0x6908('0x34')]=_[_0x6908('0x35')](_0x315234[_0x6908('0x2f')],qs[_0x6908('0x36')](_0x208274['query'][_0x6908('0x36')]));_0x2a0d51[_0x6908('0x34')]=_0x2a0d51[_0x6908('0x34')]['length']?_0x2a0d51[_0x6908('0x34')]:_0x315234[_0x6908('0x2f')];if(!_0x208274['query'][_0x6908('0x37')]('nolimit')){_0x2a0d51[_0x6908('0x1d')]=qs['limit'](_0x208274[_0x6908('0x31')]['limit']);_0x2a0d51[_0x6908('0x1a')]=qs[_0x6908('0x1a')](_0x208274[_0x6908('0x31')][_0x6908('0x1a')]);}_0x2a0d51[_0x6908('0x38')]=qs[_0x6908('0x39')](_0x208274[_0x6908('0x31')][_0x6908('0x39')]);_0x2a0d51[_0x6908('0x3a')]=qs[_0x6908('0x33')](_[_0x6908('0x3b')](_0x208274[_0x6908('0x31')],_0x315234[_0x6908('0x33')]),_0x44be5d);if(_0x208274[_0x6908('0x31')][_0x6908('0x3c')]){_0x2a0d51['where']=_['merge'](_0x2a0d51[_0x6908('0x3a')],{'$or':_[_0x6908('0x30')](_0x44be5d,function(_0x413da1){if(_0x413da1[_0x6908('0x2d')]!=='VIRTUAL'){var _0x42cdef={};_0x42cdef[_0x413da1['name']]={'$like':'%'+_0x208274[_0x6908('0x31')][_0x6908('0x3c')]+'%'};return _0x42cdef;}})});}_0x2a0d51=_[_0x6908('0x3d')]({},_0x2a0d51,_0x208274[_0x6908('0x3e')]);var _0x3980f0={'where':_0x2a0d51['where']};return db[_0x6908('0x3f')][_0x6908('0x1c')](_0x3980f0)[_0x6908('0x24')](function(_0x21db77){_0x804455[_0x6908('0x1c')]=_0x21db77;if(_0x208274[_0x6908('0x31')]['includeAll']){_0x2a0d51[_0x6908('0x40')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x6908('0x41')](_0x2a0d51);})[_0x6908('0x24')](function(_0x4478d8){_0x804455[_0x6908('0x42')]=_0x4478d8;return _0x804455;})[_0x6908('0x24')](respondWithFilteredResult(_0x5b0329,_0x2a0d51))[_0x6908('0x43')](handleError(_0x5b0329,null));};exports[_0x6908('0x44')]=function(_0x20ed64,_0xba7b12){var _0xa675f5={'raw':!![],'where':{'id':_0x20ed64[_0x6908('0x45')]['id']}},_0x32a8b8={};_0x32a8b8['model']=_[_0x6908('0x32')](db[_0x6908('0x3f')]['rawAttributes']);_0x32a8b8['query']=_['keys'](_0x20ed64[_0x6908('0x31')]);_0x32a8b8[_0x6908('0x33')]=_[_0x6908('0x35')](_0x32a8b8[_0x6908('0x2f')],_0x32a8b8[_0x6908('0x31')]);_0xa675f5[_0x6908('0x34')]=_[_0x6908('0x35')](_0x32a8b8[_0x6908('0x2f')],qs[_0x6908('0x36')](_0x20ed64[_0x6908('0x31')][_0x6908('0x36')]));_0xa675f5['attributes']=_0xa675f5[_0x6908('0x34')][_0x6908('0x46')]?_0xa675f5['attributes']:_0x32a8b8[_0x6908('0x2f')];if(_0x20ed64[_0x6908('0x31')][_0x6908('0x47')]){_0xa675f5[_0x6908('0x40')]=[{'all':!![]}];}_0xa675f5=_[_0x6908('0x3d')]({},_0xa675f5,_0x20ed64[_0x6908('0x3e')]);return db[_0x6908('0x3f')][_0x6908('0x48')](_0xa675f5)['then'](handleEntityNotFound(_0xba7b12,null))[_0x6908('0x24')](respondWithResult(_0xba7b12,null))[_0x6908('0x43')](handleError(_0xba7b12,null));};exports[_0x6908('0x49')]=function(_0x5ed60d,_0x141726){return db['FaxQueueReport']['create'](_0x5ed60d['body'],{})[_0x6908('0x24')](respondWithResult(_0x141726,0xc9))[_0x6908('0x43')](handleError(_0x141726,null));};exports[_0x6908('0x23')]=function(_0x5e73f5,_0x1fbc6b){if(_0x5e73f5[_0x6908('0x4a')]['id']){delete _0x5e73f5[_0x6908('0x4a')]['id'];}return db[_0x6908('0x3f')][_0x6908('0x48')]({'where':{'id':_0x5e73f5[_0x6908('0x45')]['id']}})['then'](handleEntityNotFound(_0x1fbc6b,null))['then'](saveUpdates(_0x5e73f5[_0x6908('0x4a')],null))[_0x6908('0x24')](respondWithResult(_0x1fbc6b,null))[_0x6908('0x43')](handleError(_0x1fbc6b,null));};exports[_0x6908('0x25')]=function(_0x4460f4,_0x52cfe3){return db['FaxQueueReport'][_0x6908('0x48')]({'where':{'id':_0x4460f4[_0x6908('0x45')]['id']}})['then'](handleEntityNotFound(_0x52cfe3,null))[_0x6908('0x24')](removeEntity(_0x52cfe3,null))['catch'](handleError(_0x52cfe3,null));};exports[_0x6908('0x4b')]=function(_0x26923b,_0x28a7a6){return db['FaxQueueReport'][_0x6908('0x4b')]()[_0x6908('0x24')](respondWithResult(_0x28a7a6,null))[_0x6908('0x43')](handleError(_0x28a7a6,null));}; \ No newline at end of file +var _0x4876=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','stack','send','index','map','rawAttributes','type','key','model','name','query','keys','filters','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','FaxQueueReport','findAll','rows','catch','show','params','intersection','length','find','create','body','destroy','describe','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x1bd213,_0x156b25){var _0xb72a1a=function(_0x48a4a7){while(--_0x48a4a7){_0x1bd213['push'](_0x1bd213['shift']());}};_0xb72a1a(++_0x156b25);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6487('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6487('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x6487('0x2'));var util=require(_0x6487('0x3'));var path=require(_0x6487('0x4'));var sox=require(_0x6487('0x5'));var csv=require('to-csv');var ejs=require(_0x6487('0x6'));var fs=require('fs');var fs_extra=require(_0x6487('0x7'));var _=require('lodash');var squel=require(_0x6487('0x8'));var crypto=require(_0x6487('0x9'));var jsforce=require(_0x6487('0xa'));var deskjs=require(_0x6487('0xb'));var toCsv=require(_0x6487('0xc'));var querystring=require(_0x6487('0xd'));var Papa=require(_0x6487('0xe'));var Redis=require(_0x6487('0xf'));var authService=require(_0x6487('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6487('0x11'));var hardwareService=require(_0x6487('0x12'));var logger=require(_0x6487('0x13'))(_0x6487('0x14'));var utils=require(_0x6487('0x15'));var config=require(_0x6487('0x16'));var licenseUtil=require(_0x6487('0x17'));var db=require(_0x6487('0x18'))['db'];function respondWithStatusCode(_0x48e266,_0x30227d){_0x30227d=_0x30227d||0xcc;return function(_0x22596a){if(_0x22596a){return _0x48e266[_0x6487('0x19')](_0x30227d);}return _0x48e266[_0x6487('0x1a')](_0x30227d)['end']();};}function respondWithResult(_0x40a352,_0x10f2e1){_0x10f2e1=_0x10f2e1||0xc8;return function(_0x1ac263){if(_0x1ac263){return _0x40a352[_0x6487('0x1a')](_0x10f2e1)['json'](_0x1ac263);}};}function respondWithFilteredResult(_0x522154,_0x1dde46){return function(_0x552f2d){if(_0x552f2d){var _0x2fdfc3=typeof _0x1dde46['offset']===_0x6487('0x1b')&&typeof _0x1dde46[_0x6487('0x1c')]===_0x6487('0x1b');var _0x26b2f2=_0x552f2d[_0x6487('0x1d')];var _0x59514e=_0x2fdfc3?0x0:_0x1dde46['offset'];var _0x5afb4a=_0x2fdfc3?_0x552f2d[_0x6487('0x1d')]:_0x1dde46[_0x6487('0x1e')]+_0x1dde46[_0x6487('0x1c')];var _0x424ae2;if(_0x5afb4a>=_0x26b2f2){_0x5afb4a=_0x26b2f2;_0x424ae2=0xc8;}else{_0x424ae2=0xce;}_0x522154[_0x6487('0x1a')](_0x424ae2);return _0x522154[_0x6487('0x1f')](_0x6487('0x20'),_0x59514e+'-'+_0x5afb4a+'/'+_0x26b2f2)[_0x6487('0x21')](_0x552f2d);}return null;};}function patchUpdates(_0x1b99ef){return function(_0x30ed2e){try{jsonpatch[_0x6487('0x22')](_0x30ed2e,_0x1b99ef,!![]);}catch(_0x2827a3){return BPromise[_0x6487('0x23')](_0x2827a3);}return _0x30ed2e[_0x6487('0x24')]();};}function saveUpdates(_0x21b8e8,_0x21050d){return function(_0x3affe7){if(_0x3affe7){return _0x3affe7[_0x6487('0x25')](_0x21b8e8)[_0x6487('0x26')](function(_0x4d06b2){return _0x4d06b2;});}return null;};}function removeEntity(_0x58d269,_0x234485){return function(_0x4e8ec8){if(_0x4e8ec8){return _0x4e8ec8['destroy']()[_0x6487('0x26')](function(){_0x58d269[_0x6487('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x116995,_0x38ac56){return function(_0x2f4190){if(!_0x2f4190){_0x116995[_0x6487('0x19')](0x194);}return _0x2f4190;};}function handleError(_0x392e60,_0x5439f7){_0x5439f7=_0x5439f7||0x1f4;return function(_0x44bb48){logger['error'](_0x44bb48[_0x6487('0x27')]);if(_0x44bb48['name']){delete _0x44bb48['name'];}_0x392e60[_0x6487('0x1a')](_0x5439f7)[_0x6487('0x28')](_0x44bb48);};}exports[_0x6487('0x29')]=function(_0x4c424a,_0x39581d){var _0x3c4411={},_0x33085b={},_0x63ddc7={'count':0x0,'rows':[]};var _0x35b089=_[_0x6487('0x2a')](db['FaxQueueReport'][_0x6487('0x2b')],function(_0x270e6e){return{'name':_0x270e6e['fieldName'],'type':_0x270e6e[_0x6487('0x2c')][_0x6487('0x2d')]};});_0x33085b[_0x6487('0x2e')]=_[_0x6487('0x2a')](_0x35b089,_0x6487('0x2f'));_0x33085b[_0x6487('0x30')]=_[_0x6487('0x31')](_0x4c424a['query']);_0x33085b[_0x6487('0x32')]=_['intersection'](_0x33085b[_0x6487('0x2e')],_0x33085b['query']);_0x3c4411['attributes']=_['intersection'](_0x33085b['model'],qs[_0x6487('0x33')](_0x4c424a[_0x6487('0x30')][_0x6487('0x33')]));_0x3c4411['attributes']=_0x3c4411[_0x6487('0x34')]['length']?_0x3c4411[_0x6487('0x34')]:_0x33085b[_0x6487('0x2e')];if(!_0x4c424a[_0x6487('0x30')][_0x6487('0x35')](_0x6487('0x36'))){_0x3c4411['limit']=qs[_0x6487('0x1c')](_0x4c424a['query'][_0x6487('0x1c')]);_0x3c4411[_0x6487('0x1e')]=qs[_0x6487('0x1e')](_0x4c424a[_0x6487('0x30')]['offset']);}_0x3c4411[_0x6487('0x37')]=qs[_0x6487('0x38')](_0x4c424a[_0x6487('0x30')]['sort']);_0x3c4411['where']=qs[_0x6487('0x32')](_['pick'](_0x4c424a[_0x6487('0x30')],_0x33085b[_0x6487('0x32')]),_0x35b089);if(_0x4c424a[_0x6487('0x30')]['filter']){_0x3c4411[_0x6487('0x39')]=_[_0x6487('0x3a')](_0x3c4411[_0x6487('0x39')],{'$or':_[_0x6487('0x2a')](_0x35b089,function(_0x2e532d){if(_0x2e532d[_0x6487('0x2c')]!==_0x6487('0x3b')){var _0x538293={};_0x538293[_0x2e532d[_0x6487('0x2f')]]={'$like':'%'+_0x4c424a[_0x6487('0x30')][_0x6487('0x3c')]+'%'};return _0x538293;}})});}_0x3c4411=_['merge']({},_0x3c4411,_0x4c424a[_0x6487('0x3d')]);var _0x4de8c8={'where':_0x3c4411[_0x6487('0x39')]};return db['FaxQueueReport'][_0x6487('0x1d')](_0x4de8c8)['then'](function(_0x44e2e9){_0x63ddc7[_0x6487('0x1d')]=_0x44e2e9;if(_0x4c424a[_0x6487('0x30')][_0x6487('0x3e')]){_0x3c4411[_0x6487('0x3f')]=[{'all':!![]}];}return db[_0x6487('0x40')][_0x6487('0x41')](_0x3c4411);})[_0x6487('0x26')](function(_0x47b3bb){_0x63ddc7[_0x6487('0x42')]=_0x47b3bb;return _0x63ddc7;})[_0x6487('0x26')](respondWithFilteredResult(_0x39581d,_0x3c4411))[_0x6487('0x43')](handleError(_0x39581d,null));};exports[_0x6487('0x44')]=function(_0x3598c4,_0x12f7f5){var _0x594b42={'raw':!![],'where':{'id':_0x3598c4[_0x6487('0x45')]['id']}},_0x56452e={};_0x56452e['model']=_[_0x6487('0x31')](db[_0x6487('0x40')][_0x6487('0x2b')]);_0x56452e[_0x6487('0x30')]=_[_0x6487('0x31')](_0x3598c4[_0x6487('0x30')]);_0x56452e[_0x6487('0x32')]=_[_0x6487('0x46')](_0x56452e[_0x6487('0x2e')],_0x56452e['query']);_0x594b42[_0x6487('0x34')]=_[_0x6487('0x46')](_0x56452e[_0x6487('0x2e')],qs['fields'](_0x3598c4['query'][_0x6487('0x33')]));_0x594b42[_0x6487('0x34')]=_0x594b42[_0x6487('0x34')][_0x6487('0x47')]?_0x594b42[_0x6487('0x34')]:_0x56452e[_0x6487('0x2e')];if(_0x3598c4['query'][_0x6487('0x3e')]){_0x594b42['include']=[{'all':!![]}];}_0x594b42=_[_0x6487('0x3a')]({},_0x594b42,_0x3598c4[_0x6487('0x3d')]);return db[_0x6487('0x40')][_0x6487('0x48')](_0x594b42)[_0x6487('0x26')](handleEntityNotFound(_0x12f7f5,null))[_0x6487('0x26')](respondWithResult(_0x12f7f5,null))[_0x6487('0x43')](handleError(_0x12f7f5,null));};exports[_0x6487('0x49')]=function(_0x2f6b86,_0x1e8ae7){return db[_0x6487('0x40')][_0x6487('0x49')](_0x2f6b86['body'],{})[_0x6487('0x26')](respondWithResult(_0x1e8ae7,0xc9))['catch'](handleError(_0x1e8ae7,null));};exports[_0x6487('0x25')]=function(_0x2c4272,_0x46c3dd){if(_0x2c4272[_0x6487('0x4a')]['id']){delete _0x2c4272[_0x6487('0x4a')]['id'];}return db[_0x6487('0x40')][_0x6487('0x48')]({'where':{'id':_0x2c4272[_0x6487('0x45')]['id']}})[_0x6487('0x26')](handleEntityNotFound(_0x46c3dd,null))[_0x6487('0x26')](saveUpdates(_0x2c4272[_0x6487('0x4a')],null))[_0x6487('0x26')](respondWithResult(_0x46c3dd,null))[_0x6487('0x43')](handleError(_0x46c3dd,null));};exports[_0x6487('0x4b')]=function(_0x2a7715,_0x2dde3c){return db[_0x6487('0x40')][_0x6487('0x48')]({'where':{'id':_0x2a7715[_0x6487('0x45')]['id']}})['then'](handleEntityNotFound(_0x2dde3c,null))[_0x6487('0x26')](removeEntity(_0x2dde3c,null))[_0x6487('0x43')](handleError(_0x2dde3c,null));};exports['describe']=function(_0x39f822,_0x38a94b){return db[_0x6487('0x40')][_0x6487('0x4c')]()['then'](respondWithResult(_0x38a94b,null))[_0x6487('0x43')](handleError(_0x38a94b,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 5f7fce3..bb13bf5 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 _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x814b,0x1a2));var _0xb814=function(_0x234ce7,_0x3e909c){_0x234ce7=_0x234ce7-0x0;var _0x57c561=_0x814b[_0x234ce7];return _0x57c561;};'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':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x30e9a0,_0x3c5afc){var _0x5b329f=function(_0x52b030){while(--_0x52b030){_0x30e9a0['push'](_0x30e9a0['shift']());}};_0x5b329f(++_0x3c5afc);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4c1eec,_0x515aa1){_0x4c1eec=_0x4c1eec-0x0;var _0x5d8475=_0x7fbe[_0x4c1eec];return _0x5d8475;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('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 5deb591..ddc0ea0 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 _0xb8b3=['FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','request\x20sent','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','update','body','where','attributes','UpdateFaxQueueReport','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x40c2ef,_0x3ee243){var _0x13148a=function(_0x35253c){while(--_0x35253c){_0x40c2ef['push'](_0x40c2ef['shift']());}};_0x13148a(++_0x3ee243);}(_0xb8b3,0x145));var _0x3b8b=function(_0x813d0a,_0x4fd3d7){_0x813d0a=_0x813d0a-0x0;var _0x241352=_0xb8b3[_0x813d0a];return _0x241352;};'use strict';var _=require(_0x3b8b('0x0'));var util=require('util');var moment=require(_0x3b8b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b8b('0x2'));var db=require(_0x3b8b('0x3'))['db'];var utils=require(_0x3b8b('0x4'));var logger=require(_0x3b8b('0x5'))(_0x3b8b('0x6'));var config=require(_0x3b8b('0x7'));var jayson=require(_0x3b8b('0x8'));var client=jayson[_0x3b8b('0x9')][_0x3b8b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x136748,_0x58dfa7,_0x3c63e1){return new BPromise(function(_0x2fa386,_0x55ae81){return client[_0x3b8b('0xb')](_0x136748,_0x3c63e1)[_0x3b8b('0xc')](function(_0x1bce56){logger[_0x3b8b('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x58dfa7,'request\x20sent');logger[_0x3b8b('0xe')](_0x3b8b('0xf'),_0x58dfa7,'request\x20sent',JSON[_0x3b8b('0x10')](_0x1bce56));if(_0x1bce56[_0x3b8b('0x11')]){if(_0x1bce56[_0x3b8b('0x11')][_0x3b8b('0x12')]===0x1f4){logger[_0x3b8b('0x11')](_0x3b8b('0x13'),_0x58dfa7,_0x1bce56[_0x3b8b('0x11')][_0x3b8b('0x14')]);return _0x55ae81(_0x1bce56[_0x3b8b('0x11')][_0x3b8b('0x14')]);}logger[_0x3b8b('0x11')](_0x3b8b('0x13'),_0x58dfa7,_0x1bce56[_0x3b8b('0x11')]['message']);return _0x2fa386(_0x1bce56[_0x3b8b('0x11')][_0x3b8b('0x14')]);}else{logger[_0x3b8b('0xd')](_0x3b8b('0x13'),_0x58dfa7,_0x3b8b('0x15'));_0x2fa386(_0x1bce56[_0x3b8b('0x16')][_0x3b8b('0x14')]);}})[_0x3b8b('0x17')](function(_0x3b7ea8){logger[_0x3b8b('0x11')](_0x3b8b('0x13'),_0x58dfa7,_0x3b7ea8);_0x55ae81(_0x3b7ea8);});});}exports[_0x3b8b('0x18')]=function(_0x4e2846){var _0x37e312=this;return new Promise(function(_0x463da1,_0x545dd5){return db[_0x3b8b('0x19')][_0x3b8b('0x1a')](_0x4e2846['body'],{'raw':_0x4e2846[_0x3b8b('0x1b')]?_0x4e2846[_0x3b8b('0x1b')][_0x3b8b('0x1c')]===undefined?!![]:![]:!![]})[_0x3b8b('0xc')](function(_0x579e55){logger['info'](_0x3b8b('0x18'),_0x4e2846);logger['debug'](_0x3b8b('0x18'),_0x4e2846,JSON[_0x3b8b('0x10')](_0x579e55));_0x463da1(_0x579e55);})[_0x3b8b('0x17')](function(_0xcc67f6){logger[_0x3b8b('0x11')](_0x3b8b('0x18'),_0xcc67f6[_0x3b8b('0x14')],_0x4e2846);_0x545dd5(_0x37e312[_0x3b8b('0x11')](0x1f4,_0xcc67f6[_0x3b8b('0x14')]));});});};exports['UpdateFaxQueueReport']=function(_0x5304dd){var _0x29e0f2=this;return new Promise(function(_0x8cb66a,_0x4f6fe4){return db[_0x3b8b('0x19')][_0x3b8b('0x1d')](_0x5304dd[_0x3b8b('0x1e')],{'raw':_0x5304dd['options']?_0x5304dd[_0x3b8b('0x1b')][_0x3b8b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5304dd[_0x3b8b('0x1b')]?_0x5304dd[_0x3b8b('0x1b')][_0x3b8b('0x1f')]||null:null,'attributes':_0x5304dd[_0x3b8b('0x1b')]?_0x5304dd[_0x3b8b('0x1b')][_0x3b8b('0x20')]||null:null,'limit':_0x5304dd[_0x3b8b('0x1b')]?_0x5304dd['options']['limit']||null:null})[_0x3b8b('0xc')](function(_0x178e5e){logger[_0x3b8b('0xd')]('UpdateFaxQueueReport',_0x5304dd);logger[_0x3b8b('0xe')](_0x3b8b('0x21'),_0x5304dd,JSON[_0x3b8b('0x10')](_0x178e5e));_0x8cb66a(_0x178e5e);})[_0x3b8b('0x17')](function(_0x98c174){logger[_0x3b8b('0x11')]('UpdateFaxQueueReport',_0x98c174[_0x3b8b('0x14')],_0x5304dd);_0x4f6fe4(_0x29e0f2['error'](0x1f4,_0x98c174[_0x3b8b('0x14')]));});});}; \ No newline at end of file +var _0xb301=['UpdateFaxQueueReport','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','catch','update','where','attributes','limit'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xb301,0xf9));var _0x1b30=function(_0x437f59,_0x353271){_0x437f59=_0x437f59-0x0;var _0x1e50d4=_0xb301[_0x437f59];return _0x1e50d4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1b30('0x0'));var BPromise=require(_0x1b30('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b30('0x2'))['db'];var utils=require(_0x1b30('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x1b30('0x4'));var jayson=require(_0x1b30('0x5'));var client=jayson[_0x1b30('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12f85b,_0x55a851,_0x329d99){return new BPromise(function(_0x5c8309,_0x3496ec){return client[_0x1b30('0x7')](_0x12f85b,_0x329d99)[_0x1b30('0x8')](function(_0x57f20d){logger[_0x1b30('0x9')](_0x1b30('0xa'),_0x55a851,_0x1b30('0xb'));logger[_0x1b30('0xc')](_0x1b30('0xd'),_0x55a851,_0x1b30('0xb'),JSON[_0x1b30('0xe')](_0x57f20d));if(_0x57f20d[_0x1b30('0xf')]){if(_0x57f20d[_0x1b30('0xf')][_0x1b30('0x10')]===0x1f4){logger[_0x1b30('0xf')](_0x1b30('0xa'),_0x55a851,_0x57f20d[_0x1b30('0xf')][_0x1b30('0x11')]);return _0x3496ec(_0x57f20d[_0x1b30('0xf')]['message']);}logger['error'](_0x1b30('0xa'),_0x55a851,_0x57f20d[_0x1b30('0xf')]['message']);return _0x5c8309(_0x57f20d[_0x1b30('0xf')][_0x1b30('0x11')]);}else{logger[_0x1b30('0x9')](_0x1b30('0xa'),_0x55a851,_0x1b30('0xb'));_0x5c8309(_0x57f20d[_0x1b30('0x12')][_0x1b30('0x11')]);}})['catch'](function(_0x45a2f5){logger[_0x1b30('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x55a851,_0x45a2f5);_0x3496ec(_0x45a2f5);});});}exports[_0x1b30('0x13')]=function(_0x2f5f64){var _0x47b5e8=this;return new Promise(function(_0x3d8f15,_0x5d738f){return db[_0x1b30('0x14')][_0x1b30('0x15')](_0x2f5f64[_0x1b30('0x16')],{'raw':_0x2f5f64['options']?_0x2f5f64[_0x1b30('0x17')][_0x1b30('0x18')]===undefined?!![]:![]:!![]})[_0x1b30('0x8')](function(_0x19b5c5){logger[_0x1b30('0x9')](_0x1b30('0x13'),_0x2f5f64);logger[_0x1b30('0xc')](_0x1b30('0x13'),_0x2f5f64,JSON[_0x1b30('0xe')](_0x19b5c5));_0x3d8f15(_0x19b5c5);})[_0x1b30('0x19')](function(_0x2d0168){logger[_0x1b30('0xf')](_0x1b30('0x13'),_0x2d0168[_0x1b30('0x11')],_0x2f5f64);_0x5d738f(_0x47b5e8[_0x1b30('0xf')](0x1f4,_0x2d0168[_0x1b30('0x11')]));});});};exports['UpdateFaxQueueReport']=function(_0x22ed61){var _0x11e02c=this;return new Promise(function(_0x2735b4,_0x230358){return db[_0x1b30('0x14')][_0x1b30('0x1a')](_0x22ed61[_0x1b30('0x16')],{'raw':_0x22ed61['options']?_0x22ed61[_0x1b30('0x17')][_0x1b30('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22ed61['options']?_0x22ed61[_0x1b30('0x17')][_0x1b30('0x1b')]||null:null,'attributes':_0x22ed61['options']?_0x22ed61['options'][_0x1b30('0x1c')]||null:null,'limit':_0x22ed61[_0x1b30('0x17')]?_0x22ed61[_0x1b30('0x17')][_0x1b30('0x1d')]||null:null})[_0x1b30('0x8')](function(_0x5e1a37){logger[_0x1b30('0x9')]('UpdateFaxQueueReport',_0x22ed61);logger[_0x1b30('0xc')](_0x1b30('0x1e'),_0x22ed61,JSON[_0x1b30('0xe')](_0x5e1a37));_0x2735b4(_0x5e1a37);})['catch'](function(_0x22d2d1){logger['error']('UpdateFaxQueueReport',_0x22d2d1[_0x1b30('0x11')],_0x22ed61);_0x230358(_0x11e02c[_0x1b30('0xf')](0x1f4,_0x22d2d1['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index f58fe84..198ac20 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 _0x000d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','exports','multer','util'];(function(_0x5228a2,_0x49f24f){var _0x1c6815=function(_0x4a0c58){while(--_0x4a0c58){_0x5228a2['push'](_0x5228a2['shift']());}};_0x1c6815(++_0x49f24f);}(_0x000d,0x18d));var _0xd000=function(_0x5d2cd4,_0x10e511){_0x5d2cd4=_0x5d2cd4-0x0;var _0xa2be03=_0x000d[_0x5d2cd4];return _0xa2be03;};'use strict';var multer=require(_0xd000('0x0'));var util=require(_0xd000('0x1'));var path=require(_0xd000('0x2'));var timeout=require(_0xd000('0x3'));var express=require(_0xd000('0x4'));var router=express[_0xd000('0x5')]();var fs_extra=require(_0xd000('0x6'));var auth=require(_0xd000('0x7'));var interaction=require(_0xd000('0x8'));var config=require('../../config/environment');var controller=require(_0xd000('0x9'));router[_0xd000('0xa')]('/',auth[_0xd000('0xb')](),controller[_0xd000('0xc')]);router['get'](_0xd000('0xd'),auth[_0xd000('0xb')](),controller[_0xd000('0xe')]);router[_0xd000('0xa')](_0xd000('0xf'),auth[_0xd000('0xb')](),controller[_0xd000('0x10')]);router['post']('/',auth[_0xd000('0xb')](),controller['create']);router[_0xd000('0x11')](_0xd000('0xf'),auth[_0xd000('0xb')](),controller[_0xd000('0x12')]);router[_0xd000('0x13')](_0xd000('0xf'),auth[_0xd000('0xb')](),controller['destroy']);module[_0xd000('0x14')]=router; \ No newline at end of file +var _0x7719=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x430d7c,_0x4bfab6){var _0x1e3f10=function(_0x2bb09d){while(--_0x2bb09d){_0x430d7c['push'](_0x430d7c['shift']());}};_0x1e3f10(++_0x4bfab6);}(_0x7719,0x181));var _0x9771=function(_0x2c742c,_0x337544){_0x2c742c=_0x2c742c-0x0;var _0x29673a=_0x7719[_0x2c742c];return _0x29673a;};'use strict';var multer=require(_0x9771('0x0'));var util=require(_0x9771('0x1'));var path=require(_0x9771('0x2'));var timeout=require(_0x9771('0x3'));var express=require('express');var router=express[_0x9771('0x4')]();var fs_extra=require(_0x9771('0x5'));var auth=require(_0x9771('0x6'));var interaction=require(_0x9771('0x7'));var config=require(_0x9771('0x8'));var controller=require(_0x9771('0x9'));router[_0x9771('0xa')]('/',auth[_0x9771('0xb')](),controller[_0x9771('0xc')]);router[_0x9771('0xa')](_0x9771('0xd'),auth[_0x9771('0xb')](),controller[_0x9771('0xe')]);router[_0x9771('0xa')](_0x9771('0xf'),auth[_0x9771('0xb')](),controller[_0x9771('0x10')]);router[_0x9771('0x11')]('/',auth[_0x9771('0xb')](),controller[_0x9771('0x12')]);router[_0x9771('0x13')]('/:id',auth[_0x9771('0xb')](),controller[_0x9771('0x14')]);router[_0x9771('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x9771('0x16')]);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 7b40857..88cca79 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(_0x254abd,_0x1ab7f0){var _0x31bf1b=function(_0x447fd8){while(--_0x447fd8){_0x254abd['push'](_0x254abd['shift']());}};_0x31bf1b(++_0x1ab7f0);}(_0xb43b,0x1b2));var _0xbb43=function(_0x1514d3,_0x4d343f){_0x1514d3=_0x1514d3-0x0;var _0x17ec82=_0xb43b[_0x1514d3];return _0x17ec82;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x38bfb8,_0x1608ed){var _0x5daf37=function(_0xd65bdd){while(--_0xd65bdd){_0x38bfb8['push'](_0x38bfb8['shift']());}};_0x5daf37(++_0x1608ed);}(_0x008c,0x188));var _0xc008=function(_0x3b150c,_0x2f93f8){_0x3b150c=_0x3b150c-0x0;var _0x5cd414=_0x008c[_0x3b150c];return _0x5cd414;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index ef64efb..137c1dc 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 _0xff13=['keys','intersection','attributes','fields','nolimit','sort','where','pick','filters','merge','map','VIRTUAL','filter','options','includeAll','rows','catch','show','params','length','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','model','query'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0xff13,0x141));var _0x3ff1=function(_0x4d9fba,_0x2ce906){_0x4d9fba=_0x4d9fba-0x0;var _0x55f8bf=_0xff13[_0x4d9fba];return _0x55f8bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ff1('0x0'));var zipdir=require(_0x3ff1('0x1'));var jsonpatch=require(_0x3ff1('0x2'));var rp=require('request-promise');var moment=require(_0x3ff1('0x3'));var BPromise=require(_0x3ff1('0x4'));var Mustache=require(_0x3ff1('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3ff1('0x6'));var ejs=require(_0x3ff1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ff1('0x8'));var squel=require(_0x3ff1('0x9'));var crypto=require(_0x3ff1('0xa'));var jsforce=require(_0x3ff1('0xb'));var deskjs=require(_0x3ff1('0xc'));var toCsv=require(_0x3ff1('0x6'));var querystring=require(_0x3ff1('0xd'));var Papa=require(_0x3ff1('0xe'));var Redis=require('ioredis');var authService=require(_0x3ff1('0xf'));var qs=require(_0x3ff1('0x10'));var as=require(_0x3ff1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ff1('0x12'))(_0x3ff1('0x13'));var utils=require('../../config/utils');var config=require(_0x3ff1('0x14'));var licenseUtil=require(_0x3ff1('0x15'));var db=require(_0x3ff1('0x16'))['db'];function respondWithStatusCode(_0x143811,_0x24dc23){_0x24dc23=_0x24dc23||0xcc;return function(_0x52bd80){if(_0x52bd80){return _0x143811[_0x3ff1('0x17')](_0x24dc23);}return _0x143811[_0x3ff1('0x18')](_0x24dc23)[_0x3ff1('0x19')]();};}function respondWithResult(_0x5627a3,_0x24b254){_0x24b254=_0x24b254||0xc8;return function(_0x5900c4){if(_0x5900c4){return _0x5627a3[_0x3ff1('0x18')](_0x24b254)[_0x3ff1('0x1a')](_0x5900c4);}};}function respondWithFilteredResult(_0xa2cc56,_0x3b2d71){return function(_0xa2601f){if(_0xa2601f){var _0x32be7c=typeof _0x3b2d71[_0x3ff1('0x1b')]===_0x3ff1('0x1c')&&typeof _0x3b2d71[_0x3ff1('0x1d')]===_0x3ff1('0x1c');var _0x36beff=_0xa2601f[_0x3ff1('0x1e')];var _0xb4ec49=_0x32be7c?0x0:_0x3b2d71[_0x3ff1('0x1b')];var _0x3c2ed5=_0x32be7c?_0xa2601f[_0x3ff1('0x1e')]:_0x3b2d71[_0x3ff1('0x1b')]+_0x3b2d71[_0x3ff1('0x1d')];var _0x164871;if(_0x3c2ed5>=_0x36beff){_0x3c2ed5=_0x36beff;_0x164871=0xc8;}else{_0x164871=0xce;}_0xa2cc56[_0x3ff1('0x18')](_0x164871);return _0xa2cc56[_0x3ff1('0x1f')](_0x3ff1('0x20'),_0xb4ec49+'-'+_0x3c2ed5+'/'+_0x36beff)['json'](_0xa2601f);}return null;};}function patchUpdates(_0x1e8c12){return function(_0x2207b4){try{jsonpatch[_0x3ff1('0x21')](_0x2207b4,_0x1e8c12,!![]);}catch(_0x5ea0d4){return BPromise[_0x3ff1('0x22')](_0x5ea0d4);}return _0x2207b4[_0x3ff1('0x23')]();};}function saveUpdates(_0x434f0a,_0x3d36f3){return function(_0x1b361a){if(_0x1b361a){return _0x1b361a[_0x3ff1('0x24')](_0x434f0a)[_0x3ff1('0x25')](function(_0x37460a){return _0x37460a;});}return null;};}function removeEntity(_0x22e85c,_0x59e2d9){return function(_0x187c79){if(_0x187c79){return _0x187c79['destroy']()[_0x3ff1('0x25')](function(){_0x22e85c['status'](0xcc)[_0x3ff1('0x19')]();});}};}function handleEntityNotFound(_0x43416e,_0x2f639f){return function(_0x48fa2e){if(!_0x48fa2e){_0x43416e['sendStatus'](0x194);}return _0x48fa2e;};}function handleError(_0x3e50e5,_0xa61c7a){_0xa61c7a=_0xa61c7a||0x1f4;return function(_0x2dc6da){logger[_0x3ff1('0x26')](_0x2dc6da['stack']);if(_0x2dc6da[_0x3ff1('0x27')]){delete _0x2dc6da[_0x3ff1('0x27')];}_0x3e50e5[_0x3ff1('0x18')](_0xa61c7a)[_0x3ff1('0x28')](_0x2dc6da);};}exports[_0x3ff1('0x29')]=function(_0x5584f7,_0xe00cab){var _0x3e4642={},_0x1773ba={},_0x485dbd={'count':0x0,'rows':[]};var _0x1f4375=_['map'](db[_0x3ff1('0x2a')][_0x3ff1('0x2b')],function(_0x333e4d){return{'name':_0x333e4d[_0x3ff1('0x2c')],'type':_0x333e4d[_0x3ff1('0x2d')][_0x3ff1('0x2e')]};});_0x1773ba[_0x3ff1('0x2f')]=_['map'](_0x1f4375,'name');_0x1773ba[_0x3ff1('0x30')]=_[_0x3ff1('0x31')](_0x5584f7['query']);_0x1773ba['filters']=_[_0x3ff1('0x32')](_0x1773ba[_0x3ff1('0x2f')],_0x1773ba[_0x3ff1('0x30')]);_0x3e4642[_0x3ff1('0x33')]=_[_0x3ff1('0x32')](_0x1773ba[_0x3ff1('0x2f')],qs['fields'](_0x5584f7['query'][_0x3ff1('0x34')]));_0x3e4642['attributes']=_0x3e4642[_0x3ff1('0x33')]['length']?_0x3e4642[_0x3ff1('0x33')]:_0x1773ba[_0x3ff1('0x2f')];if(!_0x5584f7[_0x3ff1('0x30')]['hasOwnProperty'](_0x3ff1('0x35'))){_0x3e4642[_0x3ff1('0x1d')]=qs[_0x3ff1('0x1d')](_0x5584f7[_0x3ff1('0x30')][_0x3ff1('0x1d')]);_0x3e4642[_0x3ff1('0x1b')]=qs[_0x3ff1('0x1b')](_0x5584f7['query']['offset']);}_0x3e4642['order']=qs['sort'](_0x5584f7[_0x3ff1('0x30')][_0x3ff1('0x36')]);_0x3e4642[_0x3ff1('0x37')]=qs['filters'](_[_0x3ff1('0x38')](_0x5584f7['query'],_0x1773ba[_0x3ff1('0x39')]),_0x1f4375);if(_0x5584f7[_0x3ff1('0x30')]['filter']){_0x3e4642[_0x3ff1('0x37')]=_[_0x3ff1('0x3a')](_0x3e4642[_0x3ff1('0x37')],{'$or':_[_0x3ff1('0x3b')](_0x1f4375,function(_0x2c7374){if(_0x2c7374[_0x3ff1('0x2d')]!==_0x3ff1('0x3c')){var _0xefa86e={};_0xefa86e[_0x2c7374[_0x3ff1('0x27')]]={'$like':'%'+_0x5584f7[_0x3ff1('0x30')][_0x3ff1('0x3d')]+'%'};return _0xefa86e;}})});}_0x3e4642=_[_0x3ff1('0x3a')]({},_0x3e4642,_0x5584f7[_0x3ff1('0x3e')]);var _0x27985e={'where':_0x3e4642[_0x3ff1('0x37')]};return db[_0x3ff1('0x2a')][_0x3ff1('0x1e')](_0x27985e)[_0x3ff1('0x25')](function(_0x382f40){_0x485dbd['count']=_0x382f40;if(_0x5584f7[_0x3ff1('0x30')][_0x3ff1('0x3f')]){_0x3e4642['include']=[{'all':!![]}];}return db[_0x3ff1('0x2a')]['findAll'](_0x3e4642);})[_0x3ff1('0x25')](function(_0x4a74aa){_0x485dbd[_0x3ff1('0x40')]=_0x4a74aa;return _0x485dbd;})[_0x3ff1('0x25')](respondWithFilteredResult(_0xe00cab,_0x3e4642))[_0x3ff1('0x41')](handleError(_0xe00cab,null));};exports[_0x3ff1('0x42')]=function(_0x5f51a6,_0x1f26fc){var _0x5ba28c={'raw':!![],'where':{'id':_0x5f51a6[_0x3ff1('0x43')]['id']}},_0x2b1142={};_0x2b1142[_0x3ff1('0x2f')]=_['keys'](db[_0x3ff1('0x2a')][_0x3ff1('0x2b')]);_0x2b1142[_0x3ff1('0x30')]=_['keys'](_0x5f51a6[_0x3ff1('0x30')]);_0x2b1142[_0x3ff1('0x39')]=_[_0x3ff1('0x32')](_0x2b1142['model'],_0x2b1142[_0x3ff1('0x30')]);_0x5ba28c[_0x3ff1('0x33')]=_[_0x3ff1('0x32')](_0x2b1142[_0x3ff1('0x2f')],qs[_0x3ff1('0x34')](_0x5f51a6['query']['fields']));_0x5ba28c['attributes']=_0x5ba28c[_0x3ff1('0x33')][_0x3ff1('0x44')]?_0x5ba28c['attributes']:_0x2b1142[_0x3ff1('0x2f')];if(_0x5f51a6[_0x3ff1('0x30')][_0x3ff1('0x3f')]){_0x5ba28c['include']=[{'all':!![]}];}_0x5ba28c=_[_0x3ff1('0x3a')]({},_0x5ba28c,_0x5f51a6['options']);return db[_0x3ff1('0x2a')][_0x3ff1('0x45')](_0x5ba28c)[_0x3ff1('0x25')](handleEntityNotFound(_0x1f26fc,null))[_0x3ff1('0x25')](respondWithResult(_0x1f26fc,null))[_0x3ff1('0x41')](handleError(_0x1f26fc,null));};exports[_0x3ff1('0x46')]=function(_0x63ab3e,_0x3732d6){return db['FaxTransferReport'][_0x3ff1('0x46')](_0x63ab3e[_0x3ff1('0x47')],{})[_0x3ff1('0x25')](respondWithResult(_0x3732d6,0xc9))[_0x3ff1('0x41')](handleError(_0x3732d6,null));};exports[_0x3ff1('0x24')]=function(_0x2ea5f7,_0x473720){if(_0x2ea5f7[_0x3ff1('0x47')]['id']){delete _0x2ea5f7['body']['id'];}return db[_0x3ff1('0x2a')][_0x3ff1('0x45')]({'where':{'id':_0x2ea5f7['params']['id']}})[_0x3ff1('0x25')](handleEntityNotFound(_0x473720,null))[_0x3ff1('0x25')](saveUpdates(_0x2ea5f7[_0x3ff1('0x47')],null))[_0x3ff1('0x25')](respondWithResult(_0x473720,null))[_0x3ff1('0x41')](handleError(_0x473720,null));};exports[_0x3ff1('0x48')]=function(_0x4d1224,_0x232cef){return db['FaxTransferReport'][_0x3ff1('0x45')]({'where':{'id':_0x4d1224[_0x3ff1('0x43')]['id']}})[_0x3ff1('0x25')](handleEntityNotFound(_0x232cef,null))['then'](removeEntity(_0x232cef,null))[_0x3ff1('0x41')](handleError(_0x232cef,null));};exports['describe']=function(_0x4cd7b7,_0x4284f7){return db[_0x3ff1('0x2a')][_0x3ff1('0x49')]()[_0x3ff1('0x25')](respondWithResult(_0x4284f7,null))[_0x3ff1('0x41')](handleError(_0x4284f7,null));}; \ No newline at end of file +var _0x7f06=['moment','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','intersection','fields','length','include','options','create','update','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x5e18cb,_0x40f3fd){var _0x2eee7d=function(_0x1db363){while(--_0x1db363){_0x5e18cb['push'](_0x5e18cb['shift']());}};_0x2eee7d(++_0x40f3fd);}(_0x7f06,0x15f));var _0x67f0=function(_0x14b717,_0x2a3734){_0x14b717=_0x14b717-0x0;var _0x5ab8e7=_0x7f06[_0x14b717];return _0x5ab8e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x67f0('0x0'));var zipdir=require(_0x67f0('0x1'));var jsonpatch=require(_0x67f0('0x2'));var rp=require(_0x67f0('0x3'));var moment=require(_0x67f0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x67f0('0x5'));var path=require(_0x67f0('0x6'));var sox=require('sox');var csv=require(_0x67f0('0x7'));var ejs=require(_0x67f0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x67f0('0x9'));var squel=require(_0x67f0('0xa'));var crypto=require('crypto');var jsforce=require(_0x67f0('0xb'));var deskjs=require(_0x67f0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x67f0('0xd'));var Papa=require(_0x67f0('0xe'));var Redis=require(_0x67f0('0xf'));var authService=require(_0x67f0('0x10'));var qs=require(_0x67f0('0x11'));var as=require(_0x67f0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67f0('0x13'))(_0x67f0('0x14'));var utils=require(_0x67f0('0x15'));var config=require(_0x67f0('0x16'));var licenseUtil=require(_0x67f0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c3577,_0x5ba547){_0x5ba547=_0x5ba547||0xcc;return function(_0x115581){if(_0x115581){return _0x5c3577[_0x67f0('0x18')](_0x5ba547);}return _0x5c3577['status'](_0x5ba547)[_0x67f0('0x19')]();};}function respondWithResult(_0x5701cd,_0x5aadb9){_0x5aadb9=_0x5aadb9||0xc8;return function(_0x53ed9c){if(_0x53ed9c){return _0x5701cd[_0x67f0('0x1a')](_0x5aadb9)[_0x67f0('0x1b')](_0x53ed9c);}};}function respondWithFilteredResult(_0x1a2e17,_0x5ab462){return function(_0x441fc6){if(_0x441fc6){var _0xea1176=typeof _0x5ab462[_0x67f0('0x1c')]==='undefined'&&typeof _0x5ab462['limit']==='undefined';var _0x4cf9a5=_0x441fc6[_0x67f0('0x1d')];var _0x410a32=_0xea1176?0x0:_0x5ab462['offset'];var _0x25d611=_0xea1176?_0x441fc6['count']:_0x5ab462[_0x67f0('0x1c')]+_0x5ab462[_0x67f0('0x1e')];var _0x5d6570;if(_0x25d611>=_0x4cf9a5){_0x25d611=_0x4cf9a5;_0x5d6570=0xc8;}else{_0x5d6570=0xce;}_0x1a2e17['status'](_0x5d6570);return _0x1a2e17[_0x67f0('0x1f')](_0x67f0('0x20'),_0x410a32+'-'+_0x25d611+'/'+_0x4cf9a5)[_0x67f0('0x1b')](_0x441fc6);}return null;};}function patchUpdates(_0x3f4fd1){return function(_0x7443d4){try{jsonpatch[_0x67f0('0x21')](_0x7443d4,_0x3f4fd1,!![]);}catch(_0x211947){return BPromise[_0x67f0('0x22')](_0x211947);}return _0x7443d4[_0x67f0('0x23')]();};}function saveUpdates(_0x3f8dd2,_0x428027){return function(_0xe35235){if(_0xe35235){return _0xe35235['update'](_0x3f8dd2)[_0x67f0('0x24')](function(_0x2c4c6b){return _0x2c4c6b;});}return null;};}function removeEntity(_0x4bc4dd,_0xbdc2fe){return function(_0x374e6b){if(_0x374e6b){return _0x374e6b[_0x67f0('0x25')]()['then'](function(){_0x4bc4dd['status'](0xcc)[_0x67f0('0x19')]();});}};}function handleEntityNotFound(_0x811516,_0x5cd577){return function(_0x134db3){if(!_0x134db3){_0x811516['sendStatus'](0x194);}return _0x134db3;};}function handleError(_0x4dc78f,_0x48e7bb){_0x48e7bb=_0x48e7bb||0x1f4;return function(_0x10c7ab){logger[_0x67f0('0x26')](_0x10c7ab['stack']);if(_0x10c7ab[_0x67f0('0x27')]){delete _0x10c7ab[_0x67f0('0x27')];}_0x4dc78f[_0x67f0('0x1a')](_0x48e7bb)[_0x67f0('0x28')](_0x10c7ab);};}exports[_0x67f0('0x29')]=function(_0x26e36b,_0x24a077){var _0x55b9d6={},_0x58e1e2={},_0x507a08={'count':0x0,'rows':[]};var _0x14ef4f=_[_0x67f0('0x2a')](db[_0x67f0('0x2b')][_0x67f0('0x2c')],function(_0x4e0a80){return{'name':_0x4e0a80[_0x67f0('0x2d')],'type':_0x4e0a80[_0x67f0('0x2e')]['key']};});_0x58e1e2['model']=_[_0x67f0('0x2a')](_0x14ef4f,_0x67f0('0x27'));_0x58e1e2[_0x67f0('0x2f')]=_[_0x67f0('0x30')](_0x26e36b['query']);_0x58e1e2[_0x67f0('0x31')]=_['intersection'](_0x58e1e2[_0x67f0('0x32')],_0x58e1e2[_0x67f0('0x2f')]);_0x55b9d6[_0x67f0('0x33')]=_['intersection'](_0x58e1e2['model'],qs['fields'](_0x26e36b[_0x67f0('0x2f')]['fields']));_0x55b9d6[_0x67f0('0x33')]=_0x55b9d6['attributes']['length']?_0x55b9d6[_0x67f0('0x33')]:_0x58e1e2[_0x67f0('0x32')];if(!_0x26e36b['query']['hasOwnProperty']('nolimit')){_0x55b9d6[_0x67f0('0x1e')]=qs[_0x67f0('0x1e')](_0x26e36b['query']['limit']);_0x55b9d6[_0x67f0('0x1c')]=qs[_0x67f0('0x1c')](_0x26e36b[_0x67f0('0x2f')][_0x67f0('0x1c')]);}_0x55b9d6['order']=qs['sort'](_0x26e36b[_0x67f0('0x2f')]['sort']);_0x55b9d6['where']=qs[_0x67f0('0x31')](_['pick'](_0x26e36b[_0x67f0('0x2f')],_0x58e1e2['filters']),_0x14ef4f);if(_0x26e36b[_0x67f0('0x2f')][_0x67f0('0x34')]){_0x55b9d6[_0x67f0('0x35')]=_[_0x67f0('0x36')](_0x55b9d6[_0x67f0('0x35')],{'$or':_['map'](_0x14ef4f,function(_0x21840a){if(_0x21840a[_0x67f0('0x2e')]!==_0x67f0('0x37')){var _0x538eee={};_0x538eee[_0x21840a[_0x67f0('0x27')]]={'$like':'%'+_0x26e36b[_0x67f0('0x2f')][_0x67f0('0x34')]+'%'};return _0x538eee;}})});}_0x55b9d6=_['merge']({},_0x55b9d6,_0x26e36b['options']);var _0x2b4c86={'where':_0x55b9d6['where']};return db[_0x67f0('0x2b')][_0x67f0('0x1d')](_0x2b4c86)[_0x67f0('0x24')](function(_0x130044){_0x507a08['count']=_0x130044;if(_0x26e36b[_0x67f0('0x2f')][_0x67f0('0x38')]){_0x55b9d6['include']=[{'all':!![]}];}return db[_0x67f0('0x2b')][_0x67f0('0x39')](_0x55b9d6);})[_0x67f0('0x24')](function(_0x1b3228){_0x507a08['rows']=_0x1b3228;return _0x507a08;})[_0x67f0('0x24')](respondWithFilteredResult(_0x24a077,_0x55b9d6))[_0x67f0('0x3a')](handleError(_0x24a077,null));};exports[_0x67f0('0x3b')]=function(_0x4d866a,_0x1c7ac0){var _0x4b4609={'raw':!![],'where':{'id':_0x4d866a['params']['id']}},_0x4904e4={};_0x4904e4[_0x67f0('0x32')]=_[_0x67f0('0x30')](db[_0x67f0('0x2b')][_0x67f0('0x2c')]);_0x4904e4[_0x67f0('0x2f')]=_[_0x67f0('0x30')](_0x4d866a[_0x67f0('0x2f')]);_0x4904e4[_0x67f0('0x31')]=_['intersection'](_0x4904e4[_0x67f0('0x32')],_0x4904e4[_0x67f0('0x2f')]);_0x4b4609[_0x67f0('0x33')]=_[_0x67f0('0x3c')](_0x4904e4[_0x67f0('0x32')],qs[_0x67f0('0x3d')](_0x4d866a[_0x67f0('0x2f')][_0x67f0('0x3d')]));_0x4b4609[_0x67f0('0x33')]=_0x4b4609[_0x67f0('0x33')][_0x67f0('0x3e')]?_0x4b4609[_0x67f0('0x33')]:_0x4904e4[_0x67f0('0x32')];if(_0x4d866a['query'][_0x67f0('0x38')]){_0x4b4609[_0x67f0('0x3f')]=[{'all':!![]}];}_0x4b4609=_[_0x67f0('0x36')]({},_0x4b4609,_0x4d866a[_0x67f0('0x40')]);return db['FaxTransferReport']['find'](_0x4b4609)['then'](handleEntityNotFound(_0x1c7ac0,null))[_0x67f0('0x24')](respondWithResult(_0x1c7ac0,null))[_0x67f0('0x3a')](handleError(_0x1c7ac0,null));};exports[_0x67f0('0x41')]=function(_0x3c0c1e,_0x210c51){return db['FaxTransferReport'][_0x67f0('0x41')](_0x3c0c1e['body'],{})[_0x67f0('0x24')](respondWithResult(_0x210c51,0xc9))[_0x67f0('0x3a')](handleError(_0x210c51,null));};exports[_0x67f0('0x42')]=function(_0x1820a6,_0x13717c){if(_0x1820a6[_0x67f0('0x43')]['id']){delete _0x1820a6[_0x67f0('0x43')]['id'];}return db[_0x67f0('0x2b')][_0x67f0('0x44')]({'where':{'id':_0x1820a6[_0x67f0('0x45')]['id']}})['then'](handleEntityNotFound(_0x13717c,null))['then'](saveUpdates(_0x1820a6[_0x67f0('0x43')],null))[_0x67f0('0x24')](respondWithResult(_0x13717c,null))['catch'](handleError(_0x13717c,null));};exports[_0x67f0('0x25')]=function(_0x37bbb7,_0x574d33){return db[_0x67f0('0x2b')][_0x67f0('0x44')]({'where':{'id':_0x37bbb7['params']['id']}})[_0x67f0('0x24')](handleEntityNotFound(_0x574d33,null))[_0x67f0('0x24')](removeEntity(_0x574d33,null))[_0x67f0('0x3a')](handleError(_0x574d33,null));};exports[_0x67f0('0x46')]=function(_0x5cfe0a,_0x5f0edd){return db[_0x67f0('0x2b')]['describe']()[_0x67f0('0x24')](respondWithResult(_0x5f0edd,null))[_0x67f0('0x3a')](handleError(_0x5f0edd,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 7487f77..c49f37a 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 _0x0c0a=['request-promise','path','rimraf','../../config/environment','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2dcc50,_0x4a9ad0){var _0x2a9012=function(_0x201fd3){while(--_0x201fd3){_0x2dcc50['push'](_0x2dcc50['shift']());}};_0x2a9012(++_0x4a9ad0);}(_0x0c0a,0x19e));var _0xa0c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c0a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa0c0('0x0'));var util=require(_0xa0c0('0x1'));var logger=require(_0xa0c0('0x2'))(_0xa0c0('0x3'));var moment=require(_0xa0c0('0x4'));var BPromise=require(_0xa0c0('0x5'));var rp=require(_0xa0c0('0x6'));var fs=require('fs');var path=require(_0xa0c0('0x7'));var rimraf=require(_0xa0c0('0x8'));var config=require(_0xa0c0('0x9'));var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x2ee7b1,_0xaf7cda){return _0x2ee7b1[_0xa0c0('0xa')](_0xa0c0('0xb'),attributes,{'tableName':_0xa0c0('0xc'),'paranoid':![],'indexes':[{'name':_0xa0c0('0xd'),'fields':[_0xa0c0('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d93=['FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports'];(function(_0x323747,_0x5c0967){var _0x296372=function(_0x413eff){while(--_0x413eff){_0x323747['push'](_0x323747['shift']());}};_0x296372(++_0x5c0967);}(_0x2d93,0xf3));var _0x32d9=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x2d93[_0x44268d];return _0x4be92d;};'use strict';var _=require(_0x32d9('0x0'));var util=require(_0x32d9('0x1'));var logger=require(_0x32d9('0x2'))(_0x32d9('0x3'));var moment=require(_0x32d9('0x4'));var BPromise=require(_0x32d9('0x5'));var rp=require(_0x32d9('0x6'));var fs=require('fs');var path=require(_0x32d9('0x7'));var rimraf=require(_0x32d9('0x8'));var config=require(_0x32d9('0x9'));var attributes=require(_0x32d9('0xa'));module[_0x32d9('0xb')]=function(_0x9b4979,_0x3529db){return _0x9b4979['define'](_0x32d9('0xc'),attributes,{'tableName':_0x32d9('0xd'),'paranoid':![],'indexes':[{'name':_0x32d9('0xe'),'fields':[_0x32d9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 6b2c560..5ed5a90 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 _0x1bb0=['client','http','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3bc55e,_0x4130d7){var _0x4f9472=function(_0x292923){while(--_0x292923){_0x3bc55e['push'](_0x3bc55e['shift']());}};_0x4f9472(++_0x4130d7);}(_0x1bb0,0x1ae));var _0x01bb=function(_0x14a9e7,_0x1bc6c5){_0x14a9e7=_0x14a9e7-0x0;var _0x2caeca=_0x1bb0[_0x14a9e7];return _0x2caeca;};'use strict';var _=require(_0x01bb('0x0'));var util=require(_0x01bb('0x1'));var moment=require(_0x01bb('0x2'));var BPromise=require(_0x01bb('0x3'));var rs=require(_0x01bb('0x4'));var fs=require('fs');var Redis=require(_0x01bb('0x5'));var db=require(_0x01bb('0x6'))['db'];var utils=require(_0x01bb('0x7'));var logger=require(_0x01bb('0x8'))('rpc');var config=require(_0x01bb('0x9'));var jayson=require(_0x01bb('0xa'));var client=jayson[_0x01bb('0xb')][_0x01bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43b1ab,_0x49fe1c,_0x560d24){return new BPromise(function(_0x2761ce,_0x20830d){return client['request'](_0x43b1ab,_0x560d24)[_0x01bb('0xd')](function(_0x232813){logger['info'](_0x01bb('0xe'),_0x49fe1c,_0x01bb('0xf'));logger[_0x01bb('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x49fe1c,_0x01bb('0xf'),JSON['stringify'](_0x232813));if(_0x232813[_0x01bb('0x11')]){if(_0x232813[_0x01bb('0x11')][_0x01bb('0x12')]===0x1f4){logger[_0x01bb('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x49fe1c,_0x232813['error'][_0x01bb('0x13')]);return _0x20830d(_0x232813['error'][_0x01bb('0x13')]);}logger[_0x01bb('0x11')](_0x01bb('0xe'),_0x49fe1c,_0x232813[_0x01bb('0x11')][_0x01bb('0x13')]);return _0x2761ce(_0x232813[_0x01bb('0x11')][_0x01bb('0x13')]);}else{logger['info'](_0x01bb('0xe'),_0x49fe1c,_0x01bb('0xf'));_0x2761ce(_0x232813['result'][_0x01bb('0x13')]);}})[_0x01bb('0x14')](function(_0x2826f8){logger['error'](_0x01bb('0xe'),_0x49fe1c,_0x2826f8);_0x20830d(_0x2826f8);});});} \ No newline at end of file +var _0x67e5=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','message','FaxTransferReport,\x20%s,\x20%s','result','lodash','util'];(function(_0x1f75f9,_0x5c2a8d){var _0x34f4c7=function(_0x4ec21c){while(--_0x4ec21c){_0x1f75f9['push'](_0x1f75f9['shift']());}};_0x34f4c7(++_0x5c2a8d);}(_0x67e5,0x18d));var _0x567e=function(_0x5cbb42,_0xcb7a75){_0x5cbb42=_0x5cbb42-0x0;var _0x37761c=_0x67e5[_0x5cbb42];return _0x37761c;};'use strict';var _=require(_0x567e('0x0'));var util=require(_0x567e('0x1'));var moment=require('moment');var BPromise=require(_0x567e('0x2'));var rs=require(_0x567e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x567e('0x4'))['db'];var utils=require(_0x567e('0x5'));var logger=require(_0x567e('0x6'))(_0x567e('0x7'));var config=require(_0x567e('0x8'));var jayson=require(_0x567e('0x9'));var client=jayson[_0x567e('0xa')][_0x567e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x228ec2,_0x2f596c,_0x2e8997){return new BPromise(function(_0x5e3602,_0x3898cb){return client[_0x567e('0xc')](_0x228ec2,_0x2e8997)[_0x567e('0xd')](function(_0x332bd2){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x2f596c,_0x567e('0xe'));logger['debug']('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x2f596c,_0x567e('0xe'),JSON[_0x567e('0xf')](_0x332bd2));if(_0x332bd2[_0x567e('0x10')]){if(_0x332bd2[_0x567e('0x10')][_0x567e('0x11')]===0x1f4){logger[_0x567e('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x2f596c,_0x332bd2[_0x567e('0x10')][_0x567e('0x12')]);return _0x3898cb(_0x332bd2['error']['message']);}logger[_0x567e('0x10')](_0x567e('0x13'),_0x2f596c,_0x332bd2[_0x567e('0x10')][_0x567e('0x12')]);return _0x5e3602(_0x332bd2[_0x567e('0x10')][_0x567e('0x12')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x2f596c,'request\x20sent');_0x5e3602(_0x332bd2[_0x567e('0x14')]['message']);}})['catch'](function(_0xe4db48){logger[_0x567e('0x10')](_0x567e('0x13'),_0x2f596c,_0xe4db48);_0x3898cb(_0xe4db48);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 84ea327..770f909 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 _0xa2ea=['/:id','show','post','create','put','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x3c983c,_0x2e2868){var _0x870cd2=function(_0x52553e){while(--_0x52553e){_0x3c983c['push'](_0x3c983c['shift']());}};_0x870cd2(++_0x2e2868);}(_0xa2ea,0x15d));var _0xaa2e=function(_0x45dbe3,_0xd2bf96){_0x45dbe3=_0x45dbe3-0x0;var _0x1e71cf=_0xa2ea[_0x45dbe3];return _0x1e71cf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaa2e('0x0'));var timeout=require(_0xaa2e('0x1'));var express=require(_0xaa2e('0x2'));var router=express[_0xaa2e('0x3')]();var fs_extra=require(_0xaa2e('0x4'));var auth=require(_0xaa2e('0x5'));var interaction=require(_0xaa2e('0x6'));var config=require(_0xaa2e('0x7'));var controller=require('./faxTransferReport.controller');router[_0xaa2e('0x8')]('/',auth['isAuthenticated'](),controller[_0xaa2e('0x9')]);router[_0xaa2e('0x8')]('/describe',auth[_0xaa2e('0xa')](),controller['describe']);router[_0xaa2e('0x8')](_0xaa2e('0xb'),auth['isAuthenticated'](),controller[_0xaa2e('0xc')]);router[_0xaa2e('0xd')]('/',auth[_0xaa2e('0xa')](),controller[_0xaa2e('0xe')]);router[_0xaa2e('0xf')](_0xaa2e('0xb'),auth[_0xaa2e('0xa')](),controller['update']);router[_0xaa2e('0x10')]('/:id',auth[_0xaa2e('0xa')](),controller['destroy']);module[_0xaa2e('0x11')]=router; \ No newline at end of file +var _0xc441=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','connect-timeout'];(function(_0x58355a,_0x340a2c){var _0xffc83=function(_0x594d72){while(--_0x594d72){_0x58355a['push'](_0x58355a['shift']());}};_0xffc83(++_0x340a2c);}(_0xc441,0xfa));var _0x1c44=function(_0x591215,_0x35b633){_0x591215=_0x591215-0x0;var _0x20bf5a=_0xc441[_0x591215];return _0x20bf5a;};'use strict';var multer=require('multer');var util=require(_0x1c44('0x0'));var path=require('path');var timeout=require(_0x1c44('0x1'));var express=require(_0x1c44('0x2'));var router=express[_0x1c44('0x3')]();var fs_extra=require(_0x1c44('0x4'));var auth=require(_0x1c44('0x5'));var interaction=require(_0x1c44('0x6'));var config=require(_0x1c44('0x7'));var controller=require(_0x1c44('0x8'));router[_0x1c44('0x9')]('/',auth[_0x1c44('0xa')](),controller[_0x1c44('0xb')]);router[_0x1c44('0x9')](_0x1c44('0xc'),auth['isAuthenticated'](),controller[_0x1c44('0xd')]);router[_0x1c44('0x9')](_0x1c44('0xe'),auth['isAuthenticated'](),controller[_0x1c44('0xf')]);router[_0x1c44('0x10')]('/',auth[_0x1c44('0xa')](),controller['create']);router['put'](_0x1c44('0xe'),auth[_0x1c44('0xa')](),controller[_0x1c44('0x11')]);router[_0x1c44('0x12')](_0x1c44('0xe'),auth[_0x1c44('0xa')](),controller[_0x1c44('0x13')]);module[_0x1c44('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 357b9ec..6ab886f 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 _0xa9ec=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','create','post','put','delete','exports','multer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9ec,0x19d));var _0xca9e=function(_0x24b1ea,_0x642a66){_0x24b1ea=_0x24b1ea-0x0;var _0x1eb3b0=_0xa9ec[_0x24b1ea];return _0x1eb3b0;};'use strict';var multer=require(_0xca9e('0x0'));var util=require(_0xca9e('0x1'));var path=require(_0xca9e('0x2'));var timeout=require(_0xca9e('0x3'));var express=require(_0xca9e('0x4'));var router=express[_0xca9e('0x5')]();var fs_extra=require(_0xca9e('0x6'));var auth=require(_0xca9e('0x7'));var interaction=require(_0xca9e('0x8'));var config=require(_0xca9e('0x9'));var controller=require(_0xca9e('0xa'));router[_0xca9e('0xb')]('/',auth[_0xca9e('0xc')](),controller[_0xca9e('0xd')]);router[_0xca9e('0xb')](_0xca9e('0xe'),auth[_0xca9e('0xc')](),controller[_0xca9e('0xf')]);router[_0xca9e('0xb')](_0xca9e('0x10'),auth[_0xca9e('0xc')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0xca9e('0xc')](),controller[_0xca9e('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xca9e('0x12')]);router[_0xca9e('0x13')](_0xca9e('0x10'),auth[_0xca9e('0xc')](),controller['addConfiguration']);router[_0xca9e('0x14')](_0xca9e('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xca9e('0x15')](_0xca9e('0xe'),auth[_0xca9e('0xc')](),controller['destroy']);module[_0xca9e('0x16')]=router; \ No newline at end of file +var _0x2305=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x28c588,_0x12f4f5){var _0x3e3088=function(_0x3d8428){while(--_0x3d8428){_0x28c588['push'](_0x28c588['shift']());}};_0x3e3088(++_0x12f4f5);}(_0x2305,0x181));var _0x5230=function(_0x351509,_0x54725c){_0x351509=_0x351509-0x0;var _0x4e9861=_0x2305[_0x351509];return _0x4e9861;};'use strict';var multer=require(_0x5230('0x0'));var util=require(_0x5230('0x1'));var path=require(_0x5230('0x2'));var timeout=require(_0x5230('0x3'));var express=require(_0x5230('0x4'));var router=express[_0x5230('0x5')]();var fs_extra=require(_0x5230('0x6'));var auth=require(_0x5230('0x7'));var interaction=require(_0x5230('0x8'));var config=require(_0x5230('0x9'));var controller=require('./intDeskAccount.controller');router[_0x5230('0xa')]('/',auth[_0x5230('0xb')](),controller[_0x5230('0xc')]);router[_0x5230('0xa')](_0x5230('0xd'),auth[_0x5230('0xb')](),controller[_0x5230('0xe')]);router['get'](_0x5230('0xf'),auth[_0x5230('0xb')](),controller[_0x5230('0x10')]);router[_0x5230('0xa')](_0x5230('0x11'),auth[_0x5230('0xb')](),controller['getFields']);router[_0x5230('0x12')]('/',auth[_0x5230('0xb')](),controller[_0x5230('0x13')]);router[_0x5230('0x12')]('/:id/configurations',auth[_0x5230('0xb')](),controller[_0x5230('0x14')]);router[_0x5230('0x15')]('/:id',auth[_0x5230('0xb')](),controller[_0x5230('0x16')]);router[_0x5230('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x5230('0x18')]);module[_0x5230('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index fb2aa42..e47a9e1 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 _0xd085=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x540f48,_0x8be529){var _0x3a54d9=function(_0x56576d){while(--_0x56576d){_0x540f48['push'](_0x540f48['shift']());}};_0x3a54d9(++_0x8be529);}(_0xd085,0x1cf));var _0x5d08=function(_0x4e198a,_0x5a6bad){_0x4e198a=_0x4e198a-0x0;var _0xb84bfe=_0xd085[_0x4e198a];return _0xb84bfe;};'use strict';var Sequelize=require(_0x5d08('0x0'));module[_0x5d08('0x1')]={'name':{'type':Sequelize[_0x5d08('0x2')]},'description':{'type':Sequelize[_0x5d08('0x2')]},'username':{'type':Sequelize[_0x5d08('0x2')]},'remoteUri':{'type':Sequelize[_0x5d08('0x2')]},'authType':{'type':Sequelize[_0x5d08('0x3')]('basic'),'defaultValue':_0x5d08('0x4')},'password':{'type':Sequelize[_0x5d08('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x5d08('0x2')]},'token':{'type':Sequelize[_0x5d08('0x2')]},'tokenSecret':{'type':Sequelize[_0x5d08('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x5d08('0x3')](_0x5d08('0x5'),_0x5d08('0x6')),'defaultValue':_0x5d08('0x5')}}; \ No newline at end of file +var _0x0753=['STRING','basic','ENUM','integrationTab','newTab','exports'];(function(_0x1fdb5f,_0x97f230){var _0x505252=function(_0x532e44){while(--_0x532e44){_0x1fdb5f['push'](_0x1fdb5f['shift']());}};_0x505252(++_0x97f230);}(_0x0753,0xcb));var _0x3075=function(_0x2c8c97,_0x48e6a2){_0x2c8c97=_0x2c8c97-0x0;var _0xf4541c=_0x0753[_0x2c8c97];return _0xf4541c;};'use strict';var Sequelize=require('sequelize');module[_0x3075('0x0')]={'name':{'type':Sequelize[_0x3075('0x1')]},'description':{'type':Sequelize[_0x3075('0x1')]},'username':{'type':Sequelize[_0x3075('0x1')]},'remoteUri':{'type':Sequelize[_0x3075('0x1')]},'authType':{'type':Sequelize['ENUM'](_0x3075('0x2')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x3075('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x3075('0x1')]},'token':{'type':Sequelize[_0x3075('0x1')]},'tokenSecret':{'type':Sequelize[_0x3075('0x1')]},'serverUrl':{'type':Sequelize[_0x3075('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3075('0x3')](_0x3075('0x4'),_0x3075('0x5')),'defaultValue':_0x3075('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7eaaaf3..d943d35 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 _0xb07b=['squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','Content-Range','apply','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','filters','pick','where','merge','options','DeskAccount','count','includeAll','include','findAll','rows','show','params','find','catch','create','body','findOne','DeskConfiguration','sort','filter','getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash'];(function(_0x3a5a8d,_0x22dac9){var _0x1b94b7=function(_0x2529ea){while(--_0x2529ea){_0x3a5a8d['push'](_0x3a5a8d['shift']());}};_0x1b94b7(++_0x22dac9);}(_0xb07b,0x14e));var _0xbb07=function(_0x305766,_0x4ed775){_0x305766=_0x305766-0x0;var _0x1d6353=_0xb07b[_0x305766];return _0x1d6353;};'use strict';var emlformat=require(_0xbb07('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb07('0x1'));var jsonpatch=require(_0xbb07('0x2'));var rp=require(_0xbb07('0x3'));var moment=require(_0xbb07('0x4'));var BPromise=require(_0xbb07('0x5'));var Mustache=require(_0xbb07('0x6'));var util=require(_0xbb07('0x7'));var path=require(_0xbb07('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb07('0x9'));var _=require(_0xbb07('0xa'));var squel=require(_0xbb07('0xb'));var crypto=require(_0xbb07('0xc'));var jsforce=require(_0xbb07('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbb07('0xe'));var querystring=require('querystring');var Papa=require(_0xbb07('0xf'));var Redis=require(_0xbb07('0x10'));var authService=require(_0xbb07('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbb07('0x12'));var hardwareService=require(_0xbb07('0x13'));var logger=require(_0xbb07('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xbb07('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb07('0x16'))['db'];var integrations=require(_0xbb07('0x17'));function respondWithStatusCode(_0x3e30a6,_0x1d19f2){_0x1d19f2=_0x1d19f2||0xcc;return function(_0x518522){if(_0x518522){return _0x3e30a6['sendStatus'](_0x1d19f2);}return _0x3e30a6[_0xbb07('0x18')](_0x1d19f2)[_0xbb07('0x19')]();};}function respondWithResult(_0x4410b2,_0x1797b2){_0x1797b2=_0x1797b2||0xc8;return function(_0x1db7eb){if(_0x1db7eb){return _0x4410b2['status'](_0x1797b2)[_0xbb07('0x1a')](_0x1db7eb);}};}function respondWithFilteredResult(_0x243612,_0x14d159){return function(_0x333cc5){if(_0x333cc5){var _0x231201=typeof _0x14d159[_0xbb07('0x1b')]===_0xbb07('0x1c')&&typeof _0x14d159[_0xbb07('0x1d')]==='undefined';var _0x1d9ae4=_0x333cc5['count'];var _0xa59405=_0x231201?0x0:_0x14d159[_0xbb07('0x1b')];var _0x3e2920=_0x231201?_0x333cc5['count']:_0x14d159[_0xbb07('0x1b')]+_0x14d159['limit'];var _0x2b6df0;if(_0x3e2920>=_0x1d9ae4){_0x3e2920=_0x1d9ae4;_0x2b6df0=0xc8;}else{_0x2b6df0=0xce;}_0x243612[_0xbb07('0x18')](_0x2b6df0);return _0x243612['set'](_0xbb07('0x1e'),_0xa59405+'-'+_0x3e2920+'/'+_0x1d9ae4)[_0xbb07('0x1a')](_0x333cc5);}return null;};}function patchUpdates(_0x2f889a){return function(_0x3225f9){try{jsonpatch[_0xbb07('0x1f')](_0x3225f9,_0x2f889a,!![]);}catch(_0x3d8aa2){return BPromise['reject'](_0x3d8aa2);}return _0x3225f9['save']();};}function saveUpdates(_0xdd756b,_0x424f36){return function(_0x5cac74){if(_0x5cac74){return _0x5cac74[_0xbb07('0x20')](_0xdd756b)['then'](function(_0x3ca233){return _0x3ca233;});}return null;};}function removeEntity(_0x1bc194,_0x9f183c){return function(_0x1dd7a7){if(_0x1dd7a7){return _0x1dd7a7['destroy']()[_0xbb07('0x21')](function(){_0x1bc194[_0xbb07('0x18')](0xcc)[_0xbb07('0x19')]();});}};}function handleEntityNotFound(_0x1787b4,_0xc2b350){return function(_0x247a02){if(!_0x247a02){_0x1787b4[_0xbb07('0x22')](0x194);}return _0x247a02;};}function handleError(_0xdede79,_0x15a326){_0x15a326=_0x15a326||0x1f4;return function(_0x50ae68){logger[_0xbb07('0x23')](_0x50ae68[_0xbb07('0x24')]);if(_0x50ae68[_0xbb07('0x25')]){delete _0x50ae68['name'];}_0xdede79[_0xbb07('0x18')](_0x15a326)[_0xbb07('0x26')](_0x50ae68);};}exports[_0xbb07('0x27')]=function(_0x565503,_0x5527bb){var _0x332f89={},_0x22ddc4={},_0x59fb25={'count':0x0,'rows':[]};var _0xeac242=_[_0xbb07('0x28')](db['DeskAccount'][_0xbb07('0x29')],function(_0x68e2d1){return{'name':_0x68e2d1['fieldName'],'type':_0x68e2d1[_0xbb07('0x2a')][_0xbb07('0x2b')]};});_0x22ddc4[_0xbb07('0x2c')]=_['map'](_0xeac242,_0xbb07('0x25'));_0x22ddc4[_0xbb07('0x2d')]=_[_0xbb07('0x2e')](_0x565503[_0xbb07('0x2d')]);_0x22ddc4['filters']=_[_0xbb07('0x2f')](_0x22ddc4[_0xbb07('0x2c')],_0x22ddc4[_0xbb07('0x2d')]);_0x332f89[_0xbb07('0x30')]=_['intersection'](_0x22ddc4[_0xbb07('0x2c')],qs[_0xbb07('0x31')](_0x565503[_0xbb07('0x2d')][_0xbb07('0x31')]));_0x332f89[_0xbb07('0x30')]=_0x332f89['attributes'][_0xbb07('0x32')]?_0x332f89[_0xbb07('0x30')]:_0x22ddc4[_0xbb07('0x2c')];if(!_0x565503[_0xbb07('0x2d')][_0xbb07('0x33')]('nolimit')){_0x332f89[_0xbb07('0x1d')]=qs[_0xbb07('0x1d')](_0x565503[_0xbb07('0x2d')][_0xbb07('0x1d')]);_0x332f89[_0xbb07('0x1b')]=qs[_0xbb07('0x1b')](_0x565503[_0xbb07('0x2d')]['offset']);}_0x332f89[_0xbb07('0x34')]=qs['sort'](_0x565503[_0xbb07('0x2d')]['sort']);_0x332f89['where']=qs[_0xbb07('0x35')](_[_0xbb07('0x36')](_0x565503['query'],_0x22ddc4[_0xbb07('0x35')]),_0xeac242);if(_0x565503[_0xbb07('0x2d')]['filter']){_0x332f89[_0xbb07('0x37')]=_[_0xbb07('0x38')](_0x332f89['where'],{'$or':_[_0xbb07('0x28')](_0xeac242,function(_0x7a91b9){if(_0x7a91b9[_0xbb07('0x2a')]!=='VIRTUAL'){var _0x3776f4={};_0x3776f4[_0x7a91b9['name']]={'$like':'%'+_0x565503[_0xbb07('0x2d')]['filter']+'%'};return _0x3776f4;}})});}_0x332f89=_[_0xbb07('0x38')]({},_0x332f89,_0x565503[_0xbb07('0x39')]);var _0x37c09={'where':_0x332f89[_0xbb07('0x37')]};return db[_0xbb07('0x3a')][_0xbb07('0x3b')](_0x37c09)[_0xbb07('0x21')](function(_0x4d101c){_0x59fb25['count']=_0x4d101c;if(_0x565503[_0xbb07('0x2d')][_0xbb07('0x3c')]){_0x332f89[_0xbb07('0x3d')]=[{'all':!![]}];}return db[_0xbb07('0x3a')][_0xbb07('0x3e')](_0x332f89);})[_0xbb07('0x21')](function(_0x2f5a7c){_0x59fb25[_0xbb07('0x3f')]=_0x2f5a7c;return _0x59fb25;})['then'](respondWithFilteredResult(_0x5527bb,_0x332f89))['catch'](handleError(_0x5527bb,null));};exports[_0xbb07('0x40')]=function(_0x208ef5,_0x187345){var _0xafeeb9={'raw':![],'where':{'id':_0x208ef5[_0xbb07('0x41')]['id']}},_0x216c09={};_0x216c09[_0xbb07('0x2c')]=_[_0xbb07('0x2e')](db['DeskAccount']['rawAttributes']);_0x216c09[_0xbb07('0x2d')]=_[_0xbb07('0x2e')](_0x208ef5[_0xbb07('0x2d')]);_0x216c09[_0xbb07('0x35')]=_[_0xbb07('0x2f')](_0x216c09[_0xbb07('0x2c')],_0x216c09['query']);_0xafeeb9[_0xbb07('0x30')]=_[_0xbb07('0x2f')](_0x216c09['model'],qs['fields'](_0x208ef5[_0xbb07('0x2d')]['fields']));_0xafeeb9[_0xbb07('0x30')]=_0xafeeb9[_0xbb07('0x30')][_0xbb07('0x32')]?_0xafeeb9[_0xbb07('0x30')]:_0x216c09[_0xbb07('0x2c')];if(_0x208ef5[_0xbb07('0x2d')]['includeAll']){_0xafeeb9['include']=[{'all':!![]}];}_0xafeeb9=_['merge']({},_0xafeeb9,_0x208ef5[_0xbb07('0x39')]);return db['DeskAccount'][_0xbb07('0x42')](_0xafeeb9)[_0xbb07('0x21')](handleEntityNotFound(_0x187345,null))[_0xbb07('0x21')](respondWithResult(_0x187345,null))[_0xbb07('0x43')](handleError(_0x187345,null));};exports[_0xbb07('0x44')]=function(_0x25bb88,_0x2169d3){return db['DeskAccount'][_0xbb07('0x44')](_0x25bb88[_0xbb07('0x45')],{})[_0xbb07('0x21')](respondWithResult(_0x2169d3,0xc9))[_0xbb07('0x43')](handleError(_0x2169d3,null));};exports['update']=function(_0x5481d6,_0x5271d2){if(_0x5481d6[_0xbb07('0x45')]['id']){delete _0x5481d6[_0xbb07('0x45')]['id'];}return db[_0xbb07('0x3a')]['find']({'where':{'id':_0x5481d6[_0xbb07('0x41')]['id']}})[_0xbb07('0x21')](handleEntityNotFound(_0x5271d2,null))[_0xbb07('0x21')](saveUpdates(_0x5481d6['body'],null))[_0xbb07('0x21')](respondWithResult(_0x5271d2,null))[_0xbb07('0x43')](handleError(_0x5271d2,null));};exports['destroy']=function(_0x139070,_0x343aa0){return db['DeskAccount'][_0xbb07('0x42')]({'where':{'id':_0x139070[_0xbb07('0x41')]['id']}})[_0xbb07('0x21')](handleEntityNotFound(_0x343aa0,null))[_0xbb07('0x21')](removeEntity(_0x343aa0,null))[_0xbb07('0x43')](handleError(_0x343aa0,null));};exports['getConfigurations']=function(_0x32a3ba,_0x6ca2ba,_0x4133a2){var _0x301699={};var _0xa98b28={};var _0x4ef382;var _0x20aaf3;return db['DeskAccount'][_0xbb07('0x46')]({'where':{'id':_0x32a3ba[_0xbb07('0x41')]['id']}})['then'](handleEntityNotFound(_0x6ca2ba,null))[_0xbb07('0x21')](function(_0x2589f9){if(_0x2589f9){_0x4ef382=_0x2589f9;_0xa98b28['model']=_[_0xbb07('0x2e')](db[_0xbb07('0x47')][_0xbb07('0x29')]);_0xa98b28['query']=_['keys'](_0x32a3ba[_0xbb07('0x2d')]);_0xa98b28['filters']=_['intersection'](_0xa98b28['model'],_0xa98b28[_0xbb07('0x2d')]);_0x301699[_0xbb07('0x30')]=_[_0xbb07('0x2f')](_0xa98b28[_0xbb07('0x2c')],qs[_0xbb07('0x31')](_0x32a3ba[_0xbb07('0x2d')]['fields']));_0x301699[_0xbb07('0x30')]=_0x301699[_0xbb07('0x30')][_0xbb07('0x32')]?_0x301699['attributes']:_0xa98b28[_0xbb07('0x2c')];_0x301699[_0xbb07('0x34')]=qs[_0xbb07('0x48')](_0x32a3ba[_0xbb07('0x2d')]['sort']);_0x301699[_0xbb07('0x37')]=qs[_0xbb07('0x35')](_[_0xbb07('0x36')](_0x32a3ba[_0xbb07('0x2d')],_0xa98b28[_0xbb07('0x35')]));if(_0x32a3ba[_0xbb07('0x2d')][_0xbb07('0x49')]){_0x301699[_0xbb07('0x37')]=_[_0xbb07('0x38')](_0x301699[_0xbb07('0x37')],{'$or':_[_0xbb07('0x28')](_0x301699['attributes'],function(_0x588867){var _0x555e75={};_0x555e75[_0x588867]={'$like':'%'+_0x32a3ba['query'][_0xbb07('0x49')]+'%'};return _0x555e75;})});}_0x301699=_[_0xbb07('0x38')]({},_0x301699,_0x32a3ba[_0xbb07('0x39')]);return _0x4ef382[_0xbb07('0x4a')](_0x301699);}})['then'](function(_0x116ed){if(_0x116ed){_0x20aaf3=_0x116ed['length'];if(!_0x32a3ba[_0xbb07('0x2d')][_0xbb07('0x33')](_0xbb07('0x4b'))){_0x301699[_0xbb07('0x1d')]=qs[_0xbb07('0x1d')](_0x32a3ba[_0xbb07('0x2d')][_0xbb07('0x1d')]);_0x301699[_0xbb07('0x1b')]=qs[_0xbb07('0x1b')](_0x32a3ba[_0xbb07('0x2d')][_0xbb07('0x1b')]);}return _0x4ef382['getConfigurations'](_0x301699);}})['then'](function(_0x4f680a){if(_0x4f680a){return _0x4f680a?{'count':_0x20aaf3,'rows':_0x4f680a}:null;}})[_0xbb07('0x21')](respondWithResult(_0x6ca2ba,null))[_0xbb07('0x43')](handleError(_0x6ca2ba,null));};exports[_0xbb07('0x4c')]=function(_0x1a194f,_0x96bbe7,_0x38553d){if(_0x1a194f[_0xbb07('0x45')]['id']){delete _0x1a194f[_0xbb07('0x45')]['id'];}return db[_0xbb07('0x3a')][_0xbb07('0x46')]({'where':{'id':_0x1a194f[_0xbb07('0x41')]['id']}})[_0xbb07('0x21')](handleEntityNotFound(_0x96bbe7,null))[_0xbb07('0x21')](function(_0x4835ab){if(_0x4835ab){_0x1a194f['body'][_0xbb07('0x4d')]=_0x4835ab['id'];_0x1a194f[_0xbb07('0x45')][_0xbb07('0x4e')]=integrations[_0xbb07('0x4f')](_0x1a194f[_0xbb07('0x45')][_0xbb07('0x50')],_0x1a194f['body'][_0xbb07('0x2a')]);_0x1a194f[_0xbb07('0x45')][_0xbb07('0x51')]=integrations[_0xbb07('0x52')](_0x1a194f[_0xbb07('0x45')][_0xbb07('0x50')],_0x1a194f[_0xbb07('0x45')][_0xbb07('0x2a')]);return db[_0xbb07('0x47')][_0xbb07('0x44')](_0x1a194f[_0xbb07('0x45')],{'include':[{'model':db[_0xbb07('0x53')],'as':_0xbb07('0x4e')},{'model':db['DeskField'],'as':_0xbb07('0x51')}]});}return null;})[_0xbb07('0x21')](respondWithResult(_0x96bbe7,null))[_0xbb07('0x43')](handleError(_0x96bbe7,null));};exports[_0xbb07('0x54')]=function(_0x5237ec,_0x2b8279,_0x21000b){var _0x50e77b=[{'name':_0xbb07('0x55'),'label':_0xbb07('0x55'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4d6def='';return db[_0xbb07('0x3a')][_0xbb07('0x46')]({'where':{'id':_0x5237ec[_0xbb07('0x41')]['id']},'attributes':['id',_0xbb07('0x56'),_0xbb07('0x57'),_0xbb07('0x58'),_0xbb07('0x59'),_0xbb07('0x5a'),_0xbb07('0x5b'),_0xbb07('0x5c'),_0xbb07('0x5d')]})[_0xbb07('0x21')](handleEntityNotFound(_0x2b8279,null))[_0xbb07('0x21')](function(_0x3f0f52){if(_0x3f0f52){_0x4d6def=_0x3f0f52[_0xbb07('0x56')];var _0x35016f=_0x4d6def[_0xbb07('0x5e')](-0x1);if(_0x35016f==='/'){_0x4d6def=_0x4d6def['substring'](0x0,_0x4d6def['lastIndexOf'](_0x35016f));}var _0x32493e={'method':_0xbb07('0x5f'),'uri':util[_0xbb07('0x60')](_0xbb07('0x61'),_0x4d6def),'headers':{'Content-Type':_0xbb07('0x62'),'Accept':_0xbb07('0x62')},'json':!![]};if(_0x3f0f52[_0xbb07('0x57')]===_0xbb07('0x63')){_0x32493e[_0xbb07('0x64')][_0xbb07('0x65')]=util['format'](_0xbb07('0x66'),new Buffer(util['format'](_0xbb07('0x67'),_0x3f0f52[_0xbb07('0x58')],_0x3f0f52[_0xbb07('0x59')]))[_0xbb07('0x68')](_0xbb07('0x69')));}return rp(_0x32493e)[_0xbb07('0x21')](function(_0x23c8d9){return _0x50e77b[_0xbb07('0x6a')](_['map'](_0x23c8d9[_0xbb07('0x6b')][_0xbb07('0x6c')],function(_0x12f8eb){return{'id':_0x12f8eb[_0xbb07('0x25')],'name':_0x12f8eb['name'],'type':_0x12f8eb[_0xbb07('0x2a')],'active':_0x12f8eb[_0xbb07('0x6d')],'label':_0x12f8eb[_0xbb07('0x6e')],'custom':!![]};}));});}})['then'](function(_0x41eeeb){return{'count':_0x41eeeb[_0xbb07('0x32')],'rows':_0x41eeeb};})[_0xbb07('0x21')](respondWithResult(_0x2b8279,null))['catch'](function(_0x432d74){var _0x459bdc=_0x5237ec[_0xbb07('0x2d')][_0xbb07('0x6f')]?0x1f4:_0x432d74[_0xbb07('0x70')]||0x1f4;logger[_0xbb07('0x23')](_0xbb07('0x71'),_0xbb07('0x54'),_0x459bdc,JSON['stringify'](_0x432d74));delete _0x432d74[_0xbb07('0x25')];if(_0x459bdc===0x191){_0x459bdc=0x190;}_0x2b8279[_0xbb07('0x18')](_0x459bdc)[_0xbb07('0x26')](_0x5237ec[_0xbb07('0x2d')][_0xbb07('0x6f')]?{'message':_0xbb07('0x72'),'statusCode':_0x432d74[_0xbb07('0x70')]}:_0x432d74);});}; \ No newline at end of file +var _0xffb9=['find','getConfigurations','findOne','options','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','priority','remoteUri','username','consumerKey','consumerSecret','tokenSecret','substring','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','label','test','statusCode','error','getFields','stringify','rimraf','zip-dir','fast-json-patch','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','where','type','VIRTUAL','filter','includeAll','findAll','rows','show','params','keys','include','merge','catch','create','body'];(function(_0x59dccc,_0x184c1c){var _0xc97bcb=function(_0x1ddbcb){while(--_0x1ddbcb){_0x59dccc['push'](_0x59dccc['shift']());}};_0xc97bcb(++_0x184c1c);}(_0xffb9,0x9f));var _0x9ffb=function(_0x5003e2,_0x83dcc1){_0x5003e2=_0x5003e2-0x0;var _0x59bb42=_0xffb9[_0x5003e2];return _0x59bb42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ffb('0x0'));var zipdir=require(_0x9ffb('0x1'));var jsonpatch=require(_0x9ffb('0x2'));var rp=require('request-promise');var moment=require(_0x9ffb('0x3'));var BPromise=require(_0x9ffb('0x4'));var Mustache=require(_0x9ffb('0x5'));var util=require(_0x9ffb('0x6'));var path=require(_0x9ffb('0x7'));var sox=require(_0x9ffb('0x8'));var csv=require(_0x9ffb('0x9'));var ejs=require(_0x9ffb('0xa'));var fs=require('fs');var fs_extra=require(_0x9ffb('0xb'));var _=require(_0x9ffb('0xc'));var squel=require(_0x9ffb('0xd'));var crypto=require(_0x9ffb('0xe'));var jsforce=require(_0x9ffb('0xf'));var deskjs=require(_0x9ffb('0x10'));var toCsv=require(_0x9ffb('0x9'));var querystring=require(_0x9ffb('0x11'));var Papa=require(_0x9ffb('0x12'));var Redis=require(_0x9ffb('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9ffb('0x14'));var as=require(_0x9ffb('0x15'));var hardwareService=require(_0x9ffb('0x16'));var logger=require(_0x9ffb('0x17'))('api');var utils=require(_0x9ffb('0x18'));var config=require(_0x9ffb('0x19'));var licenseUtil=require(_0x9ffb('0x1a'));var db=require(_0x9ffb('0x1b'))['db'];var integrations=require(_0x9ffb('0x1c'));function respondWithStatusCode(_0x3f9c15,_0x2550e3){_0x2550e3=_0x2550e3||0xcc;return function(_0x4120bb){if(_0x4120bb){return _0x3f9c15[_0x9ffb('0x1d')](_0x2550e3);}return _0x3f9c15[_0x9ffb('0x1e')](_0x2550e3)[_0x9ffb('0x1f')]();};}function respondWithResult(_0x9732f0,_0x4cc44d){_0x4cc44d=_0x4cc44d||0xc8;return function(_0xa4d269){if(_0xa4d269){return _0x9732f0['status'](_0x4cc44d)['json'](_0xa4d269);}};}function respondWithFilteredResult(_0x487d4c,_0x12e686){return function(_0x2246f5){if(_0x2246f5){var _0x29b601=typeof _0x12e686[_0x9ffb('0x20')]===_0x9ffb('0x21')&&typeof _0x12e686[_0x9ffb('0x22')]==='undefined';var _0x5c3dda=_0x2246f5[_0x9ffb('0x23')];var _0x2b9f5c=_0x29b601?0x0:_0x12e686['offset'];var _0x46cace=_0x29b601?_0x2246f5[_0x9ffb('0x23')]:_0x12e686[_0x9ffb('0x20')]+_0x12e686[_0x9ffb('0x22')];var _0x516a02;if(_0x46cace>=_0x5c3dda){_0x46cace=_0x5c3dda;_0x516a02=0xc8;}else{_0x516a02=0xce;}_0x487d4c[_0x9ffb('0x1e')](_0x516a02);return _0x487d4c[_0x9ffb('0x24')](_0x9ffb('0x25'),_0x2b9f5c+'-'+_0x46cace+'/'+_0x5c3dda)['json'](_0x2246f5);}return null;};}function patchUpdates(_0x5376df){return function(_0x33678c){try{jsonpatch[_0x9ffb('0x26')](_0x33678c,_0x5376df,!![]);}catch(_0x262f44){return BPromise[_0x9ffb('0x27')](_0x262f44);}return _0x33678c['save']();};}function saveUpdates(_0x2aa392,_0x5362db){return function(_0x406c23){if(_0x406c23){return _0x406c23[_0x9ffb('0x28')](_0x2aa392)[_0x9ffb('0x29')](function(_0x3ef774){return _0x3ef774;});}return null;};}function removeEntity(_0x314718,_0x51c3d9){return function(_0x1656b0){if(_0x1656b0){return _0x1656b0[_0x9ffb('0x2a')]()[_0x9ffb('0x29')](function(){_0x314718['status'](0xcc)[_0x9ffb('0x1f')]();});}};}function handleEntityNotFound(_0x11b66c,_0x2ed409){return function(_0x35a65c){if(!_0x35a65c){_0x11b66c['sendStatus'](0x194);}return _0x35a65c;};}function handleError(_0x510086,_0x1c7fc3){_0x1c7fc3=_0x1c7fc3||0x1f4;return function(_0x196842){logger['error'](_0x196842[_0x9ffb('0x2b')]);if(_0x196842[_0x9ffb('0x2c')]){delete _0x196842[_0x9ffb('0x2c')];}_0x510086[_0x9ffb('0x1e')](_0x1c7fc3)[_0x9ffb('0x2d')](_0x196842);};}exports[_0x9ffb('0x2e')]=function(_0x5220a7,_0x5d2ec3){var _0x536d64={},_0x3d8f0f={},_0x20dc28={'count':0x0,'rows':[]};var _0x5192a9=_[_0x9ffb('0x2f')](db[_0x9ffb('0x30')][_0x9ffb('0x31')],function(_0x3d5748){return{'name':_0x3d5748[_0x9ffb('0x32')],'type':_0x3d5748['type']['key']};});_0x3d8f0f[_0x9ffb('0x33')]=_[_0x9ffb('0x2f')](_0x5192a9,_0x9ffb('0x2c'));_0x3d8f0f[_0x9ffb('0x34')]=_['keys'](_0x5220a7['query']);_0x3d8f0f['filters']=_[_0x9ffb('0x35')](_0x3d8f0f[_0x9ffb('0x33')],_0x3d8f0f[_0x9ffb('0x34')]);_0x536d64[_0x9ffb('0x36')]=_[_0x9ffb('0x35')](_0x3d8f0f[_0x9ffb('0x33')],qs['fields'](_0x5220a7[_0x9ffb('0x34')][_0x9ffb('0x37')]));_0x536d64[_0x9ffb('0x36')]=_0x536d64[_0x9ffb('0x36')][_0x9ffb('0x38')]?_0x536d64[_0x9ffb('0x36')]:_0x3d8f0f[_0x9ffb('0x33')];if(!_0x5220a7[_0x9ffb('0x34')]['hasOwnProperty'](_0x9ffb('0x39'))){_0x536d64[_0x9ffb('0x22')]=qs[_0x9ffb('0x22')](_0x5220a7[_0x9ffb('0x34')]['limit']);_0x536d64[_0x9ffb('0x20')]=qs[_0x9ffb('0x20')](_0x5220a7[_0x9ffb('0x34')][_0x9ffb('0x20')]);}_0x536d64[_0x9ffb('0x3a')]=qs[_0x9ffb('0x3b')](_0x5220a7[_0x9ffb('0x34')][_0x9ffb('0x3b')]);_0x536d64['where']=qs[_0x9ffb('0x3c')](_[_0x9ffb('0x3d')](_0x5220a7[_0x9ffb('0x34')],_0x3d8f0f[_0x9ffb('0x3c')]),_0x5192a9);if(_0x5220a7[_0x9ffb('0x34')]['filter']){_0x536d64['where']=_['merge'](_0x536d64[_0x9ffb('0x3e')],{'$or':_[_0x9ffb('0x2f')](_0x5192a9,function(_0x5789d4){if(_0x5789d4[_0x9ffb('0x3f')]!==_0x9ffb('0x40')){var _0x31763b={};_0x31763b[_0x5789d4[_0x9ffb('0x2c')]]={'$like':'%'+_0x5220a7[_0x9ffb('0x34')][_0x9ffb('0x41')]+'%'};return _0x31763b;}})});}_0x536d64=_['merge']({},_0x536d64,_0x5220a7['options']);var _0x13c71e={'where':_0x536d64[_0x9ffb('0x3e')]};return db[_0x9ffb('0x30')][_0x9ffb('0x23')](_0x13c71e)[_0x9ffb('0x29')](function(_0x37da1d){_0x20dc28[_0x9ffb('0x23')]=_0x37da1d;if(_0x5220a7[_0x9ffb('0x34')][_0x9ffb('0x42')]){_0x536d64['include']=[{'all':!![]}];}return db[_0x9ffb('0x30')][_0x9ffb('0x43')](_0x536d64);})[_0x9ffb('0x29')](function(_0x214418){_0x20dc28[_0x9ffb('0x44')]=_0x214418;return _0x20dc28;})['then'](respondWithFilteredResult(_0x5d2ec3,_0x536d64))['catch'](handleError(_0x5d2ec3,null));};exports[_0x9ffb('0x45')]=function(_0x29e561,_0xe0d119){var _0x21e01b={'raw':![],'where':{'id':_0x29e561[_0x9ffb('0x46')]['id']}},_0x4e5743={};_0x4e5743[_0x9ffb('0x33')]=_[_0x9ffb('0x47')](db['DeskAccount'][_0x9ffb('0x31')]);_0x4e5743[_0x9ffb('0x34')]=_[_0x9ffb('0x47')](_0x29e561['query']);_0x4e5743[_0x9ffb('0x3c')]=_[_0x9ffb('0x35')](_0x4e5743['model'],_0x4e5743['query']);_0x21e01b[_0x9ffb('0x36')]=_[_0x9ffb('0x35')](_0x4e5743[_0x9ffb('0x33')],qs['fields'](_0x29e561[_0x9ffb('0x34')][_0x9ffb('0x37')]));_0x21e01b[_0x9ffb('0x36')]=_0x21e01b[_0x9ffb('0x36')]['length']?_0x21e01b[_0x9ffb('0x36')]:_0x4e5743[_0x9ffb('0x33')];if(_0x29e561[_0x9ffb('0x34')][_0x9ffb('0x42')]){_0x21e01b[_0x9ffb('0x48')]=[{'all':!![]}];}_0x21e01b=_[_0x9ffb('0x49')]({},_0x21e01b,_0x29e561['options']);return db[_0x9ffb('0x30')]['find'](_0x21e01b)['then'](handleEntityNotFound(_0xe0d119,null))[_0x9ffb('0x29')](respondWithResult(_0xe0d119,null))[_0x9ffb('0x4a')](handleError(_0xe0d119,null));};exports['create']=function(_0x13faec,_0x54fc42){return db[_0x9ffb('0x30')][_0x9ffb('0x4b')](_0x13faec[_0x9ffb('0x4c')],{})[_0x9ffb('0x29')](respondWithResult(_0x54fc42,0xc9))[_0x9ffb('0x4a')](handleError(_0x54fc42,null));};exports['update']=function(_0x4efda3,_0x73774e){if(_0x4efda3[_0x9ffb('0x4c')]['id']){delete _0x4efda3[_0x9ffb('0x4c')]['id'];}return db[_0x9ffb('0x30')][_0x9ffb('0x4d')]({'where':{'id':_0x4efda3[_0x9ffb('0x46')]['id']}})[_0x9ffb('0x29')](handleEntityNotFound(_0x73774e,null))[_0x9ffb('0x29')](saveUpdates(_0x4efda3[_0x9ffb('0x4c')],null))['then'](respondWithResult(_0x73774e,null))['catch'](handleError(_0x73774e,null));};exports['destroy']=function(_0x4801b6,_0x597064){return db[_0x9ffb('0x30')][_0x9ffb('0x4d')]({'where':{'id':_0x4801b6[_0x9ffb('0x46')]['id']}})[_0x9ffb('0x29')](handleEntityNotFound(_0x597064,null))[_0x9ffb('0x29')](removeEntity(_0x597064,null))['catch'](handleError(_0x597064,null));};exports[_0x9ffb('0x4e')]=function(_0x3b72b6,_0x8ffd6e,_0x219234){var _0x34d1dc={};var _0x5b7444={};var _0x191eaa;var _0x2abe36;return db[_0x9ffb('0x30')][_0x9ffb('0x4f')]({'where':{'id':_0x3b72b6['params']['id']}})[_0x9ffb('0x29')](handleEntityNotFound(_0x8ffd6e,null))[_0x9ffb('0x29')](function(_0x3407d1){if(_0x3407d1){_0x191eaa=_0x3407d1;_0x5b7444[_0x9ffb('0x33')]=_[_0x9ffb('0x47')](db['DeskConfiguration']['rawAttributes']);_0x5b7444[_0x9ffb('0x34')]=_[_0x9ffb('0x47')](_0x3b72b6[_0x9ffb('0x34')]);_0x5b7444[_0x9ffb('0x3c')]=_['intersection'](_0x5b7444[_0x9ffb('0x33')],_0x5b7444[_0x9ffb('0x34')]);_0x34d1dc[_0x9ffb('0x36')]=_[_0x9ffb('0x35')](_0x5b7444['model'],qs[_0x9ffb('0x37')](_0x3b72b6[_0x9ffb('0x34')][_0x9ffb('0x37')]));_0x34d1dc[_0x9ffb('0x36')]=_0x34d1dc[_0x9ffb('0x36')]['length']?_0x34d1dc[_0x9ffb('0x36')]:_0x5b7444[_0x9ffb('0x33')];_0x34d1dc[_0x9ffb('0x3a')]=qs['sort'](_0x3b72b6['query'][_0x9ffb('0x3b')]);_0x34d1dc[_0x9ffb('0x3e')]=qs[_0x9ffb('0x3c')](_['pick'](_0x3b72b6[_0x9ffb('0x34')],_0x5b7444[_0x9ffb('0x3c')]));if(_0x3b72b6['query']['filter']){_0x34d1dc[_0x9ffb('0x3e')]=_[_0x9ffb('0x49')](_0x34d1dc['where'],{'$or':_[_0x9ffb('0x2f')](_0x34d1dc[_0x9ffb('0x36')],function(_0x5df2bf){var _0x3f784e={};_0x3f784e[_0x5df2bf]={'$like':'%'+_0x3b72b6['query'][_0x9ffb('0x41')]+'%'};return _0x3f784e;})});}_0x34d1dc=_['merge']({},_0x34d1dc,_0x3b72b6[_0x9ffb('0x50')]);return _0x191eaa[_0x9ffb('0x4e')](_0x34d1dc);}})[_0x9ffb('0x29')](function(_0x518bb3){if(_0x518bb3){_0x2abe36=_0x518bb3[_0x9ffb('0x38')];if(!_0x3b72b6[_0x9ffb('0x34')][_0x9ffb('0x51')](_0x9ffb('0x39'))){_0x34d1dc[_0x9ffb('0x22')]=qs[_0x9ffb('0x22')](_0x3b72b6['query'][_0x9ffb('0x22')]);_0x34d1dc[_0x9ffb('0x20')]=qs['offset'](_0x3b72b6[_0x9ffb('0x34')][_0x9ffb('0x20')]);}return _0x191eaa['getConfigurations'](_0x34d1dc);}})['then'](function(_0x49af63){if(_0x49af63){return _0x49af63?{'count':_0x2abe36,'rows':_0x49af63}:null;}})[_0x9ffb('0x29')](respondWithResult(_0x8ffd6e,null))['catch'](handleError(_0x8ffd6e,null));};exports['addConfiguration']=function(_0x2247fd,_0x1fe4d9,_0x848ba){if(_0x2247fd[_0x9ffb('0x4c')]['id']){delete _0x2247fd['body']['id'];}return db[_0x9ffb('0x30')][_0x9ffb('0x4f')]({'where':{'id':_0x2247fd['params']['id']}})['then'](handleEntityNotFound(_0x1fe4d9,null))[_0x9ffb('0x29')](function(_0x2558dc){if(_0x2558dc){_0x2247fd[_0x9ffb('0x4c')][_0x9ffb('0x52')]=_0x2558dc['id'];_0x2247fd[_0x9ffb('0x4c')][_0x9ffb('0x53')]=integrations[_0x9ffb('0x54')](_0x2247fd['body'][_0x9ffb('0x55')],_0x2247fd['body'][_0x9ffb('0x3f')]);_0x2247fd[_0x9ffb('0x4c')][_0x9ffb('0x56')]=integrations[_0x9ffb('0x57')](_0x2247fd[_0x9ffb('0x4c')][_0x9ffb('0x55')],_0x2247fd['body']['type']);return db[_0x9ffb('0x58')][_0x9ffb('0x4b')](_0x2247fd['body'],{'include':[{'model':db[_0x9ffb('0x59')],'as':_0x9ffb('0x53')},{'model':db[_0x9ffb('0x59')],'as':_0x9ffb('0x56')}]});}return null;})['then'](respondWithResult(_0x1fe4d9,null))[_0x9ffb('0x4a')](handleError(_0x1fe4d9,null));};exports['getFields']=function(_0x4826c7,_0x207761,_0x10a9d7){var _0x3b188b=[{'name':_0x9ffb('0x5a'),'label':_0x9ffb('0x5a'),'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 _0x4bcab5='';return db[_0x9ffb('0x30')][_0x9ffb('0x4f')]({'where':{'id':_0x4826c7[_0x9ffb('0x46')]['id']},'attributes':['id',_0x9ffb('0x5b'),'authType',_0x9ffb('0x5c'),'password',_0x9ffb('0x5d'),_0x9ffb('0x5e'),'token',_0x9ffb('0x5f')]})[_0x9ffb('0x29')](handleEntityNotFound(_0x207761,null))[_0x9ffb('0x29')](function(_0x4d3f67){if(_0x4d3f67){_0x4bcab5=_0x4d3f67[_0x9ffb('0x5b')];var _0x5200e6=_0x4bcab5['slice'](-0x1);if(_0x5200e6==='/'){_0x4bcab5=_0x4bcab5[_0x9ffb('0x60')](0x0,_0x4bcab5['lastIndexOf'](_0x5200e6));}var _0x3f9733={'method':_0x9ffb('0x61'),'uri':util[_0x9ffb('0x62')](_0x9ffb('0x63'),_0x4bcab5),'headers':{'Content-Type':_0x9ffb('0x64'),'Accept':_0x9ffb('0x64')},'json':!![]};if(_0x4d3f67[_0x9ffb('0x65')]===_0x9ffb('0x66')){_0x3f9733[_0x9ffb('0x67')][_0x9ffb('0x68')]=util[_0x9ffb('0x62')](_0x9ffb('0x69'),new Buffer(util['format'](_0x9ffb('0x6a'),_0x4d3f67[_0x9ffb('0x5c')],_0x4d3f67['password']))[_0x9ffb('0x6b')](_0x9ffb('0x6c')));}return rp(_0x3f9733)['then'](function(_0x51e7b2){return _0x3b188b[_0x9ffb('0x6d')](_[_0x9ffb('0x2f')](_0x51e7b2['_embedded'][_0x9ffb('0x6e')],function(_0x2b415e){return{'id':_0x2b415e[_0x9ffb('0x2c')],'name':_0x2b415e[_0x9ffb('0x2c')],'type':_0x2b415e['type'],'active':_0x2b415e[_0x9ffb('0x6f')],'label':_0x2b415e[_0x9ffb('0x70')],'custom':!![]};}));});}})['then'](function(_0x1e022c){return{'count':_0x1e022c[_0x9ffb('0x38')],'rows':_0x1e022c};})[_0x9ffb('0x29')](respondWithResult(_0x207761,null))['catch'](function(_0x4a3d13){var _0x52a2c2=_0x4826c7[_0x9ffb('0x34')][_0x9ffb('0x71')]?0x1f4:_0x4a3d13[_0x9ffb('0x72')]||0x1f4;logger[_0x9ffb('0x73')]('getFields,\x20%s,\x20%s,\x20%s',_0x9ffb('0x74'),_0x52a2c2,JSON[_0x9ffb('0x75')](_0x4a3d13));delete _0x4a3d13[_0x9ffb('0x2c')];if(_0x52a2c2===0x191){_0x52a2c2=0x190;}_0x207761['status'](_0x52a2c2)['send'](_0x4826c7[_0x9ffb('0x34')][_0x9ffb('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x4a3d13[_0x9ffb('0x72')]}:_0x4a3d13);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 74e89cc..7b2c9cd 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 _0x8c9f=['define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','./intDeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x8c9f,0x1bd));var _0xf8c9=function(_0x330246,_0x431349){_0x330246=_0x330246-0x0;var _0x3f9eab=_0x8c9f[_0x330246];return _0x3f9eab;};'use strict';var _=require(_0xf8c9('0x0'));var util=require(_0xf8c9('0x1'));var logger=require(_0xf8c9('0x2'))(_0xf8c9('0x3'));var moment=require('moment');var BPromise=require(_0xf8c9('0x4'));var rp=require(_0xf8c9('0x5'));var fs=require('fs');var path=require(_0xf8c9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf8c9('0x7'));var integrations=require(_0xf8c9('0x8'));module[_0xf8c9('0x9')]=function(_0x3e70ae,_0x57437a){return _0x3e70ae[_0xf8c9('0xa')](_0xf8c9('0xb'),attributes,{'tableName':_0xf8c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fbd=['bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','lodash','util','../../config/logger','moment'];(function(_0x109075,_0x22742a){var _0x15a2af=function(_0xdfecaa){while(--_0xdfecaa){_0x109075['push'](_0x109075['shift']());}};_0x15a2af(++_0x22742a);}(_0x4fbd,0x7e));var _0xd4fb=function(_0xd86eec,_0x2478f0){_0xd86eec=_0xd86eec-0x0;var _0x92f40b=_0x4fbd[_0xd86eec];return _0x92f40b;};'use strict';var _=require(_0xd4fb('0x0'));var util=require(_0xd4fb('0x1'));var logger=require(_0xd4fb('0x2'))('api');var moment=require(_0xd4fb('0x3'));var BPromise=require(_0xd4fb('0x4'));var rp=require(_0xd4fb('0x5'));var fs=require('fs');var path=require(_0xd4fb('0x6'));var rimraf=require(_0xd4fb('0x7'));var config=require(_0xd4fb('0x8'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0xd4fb('0x9'));module['exports']=function(_0x153a0d,_0x22940c){return _0x153a0d['define']('DeskAccount',attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 7d10090..2f38cdf 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 _0x321e=['GetDeskAccount','ShowDeskAccount','DeskAccount','find','where','model','then','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','raw','attributes','limit','include','map'];(function(_0x1ec6d7,_0x35e0f0){var _0x9ab269=function(_0xa4f30c){while(--_0xa4f30c){_0x1ec6d7['push'](_0x1ec6d7['shift']());}};_0x9ab269(++_0x35e0f0);}(_0x321e,0x11f));var _0xe321=function(_0x40c70e,_0x251a2f){_0x40c70e=_0x40c70e-0x0;var _0x3857e7=_0x321e[_0x40c70e];return _0x3857e7;};'use strict';var _=require(_0xe321('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe321('0x1'));var rs=require(_0xe321('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe321('0x3'))['db'];var utils=require(_0xe321('0x4'));var logger=require(_0xe321('0x5'))(_0xe321('0x6'));var config=require(_0xe321('0x7'));var jayson=require(_0xe321('0x8'));var client=jayson['client'][_0xe321('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2feb38,_0x3e7b1f,_0x68c633){return new BPromise(function(_0xa00960,_0x20446b){return client[_0xe321('0xa')](_0x2feb38,_0x68c633)['then'](function(_0x659936){logger[_0xe321('0xb')](_0xe321('0xc'),_0x3e7b1f,_0xe321('0xd'));logger[_0xe321('0xe')](_0xe321('0xf'),_0x3e7b1f,_0xe321('0xd'),JSON[_0xe321('0x10')](_0x659936));if(_0x659936[_0xe321('0x11')]){if(_0x659936[_0xe321('0x11')][_0xe321('0x12')]===0x1f4){logger[_0xe321('0x11')](_0xe321('0xc'),_0x3e7b1f,_0x659936[_0xe321('0x11')][_0xe321('0x13')]);return _0x20446b(_0x659936['error'][_0xe321('0x13')]);}logger[_0xe321('0x11')]('DeskAccount,\x20%s,\x20%s',_0x3e7b1f,_0x659936['error']['message']);return _0xa00960(_0x659936[_0xe321('0x11')][_0xe321('0x13')]);}else{logger[_0xe321('0xb')](_0xe321('0xc'),_0x3e7b1f,'request\x20sent');_0xa00960(_0x659936['result']['message']);}})[_0xe321('0x14')](function(_0x57a3c1){logger['error'](_0xe321('0xc'),_0x3e7b1f,_0x57a3c1);_0x20446b(_0x57a3c1);});});}exports['GetDeskAccount']=function(_0x57bc16){var _0x1d1409=this;return new Promise(function(_0x3acd28,_0x36ec20){return db['DeskAccount'][_0xe321('0x15')]({'raw':_0x57bc16['options']?_0x57bc16[_0xe321('0x16')][_0xe321('0x17')]===undefined?!![]:![]:!![],'where':_0x57bc16[_0xe321('0x16')]?_0x57bc16['options']['where']||null:null,'attributes':_0x57bc16[_0xe321('0x16')]?_0x57bc16[_0xe321('0x16')][_0xe321('0x18')]||null:null,'limit':_0x57bc16[_0xe321('0x16')]?_0x57bc16['options'][_0xe321('0x19')]||null:null,'include':_0x57bc16[_0xe321('0x16')]?_0x57bc16['options'][_0xe321('0x1a')]?_[_0xe321('0x1b')](_0x57bc16[_0xe321('0x16')][_0xe321('0x1a')],function(_0x552a93){return{'model':db[_0x552a93['model']],'as':_0x552a93['as'],'attributes':_0x552a93[_0xe321('0x18')],'include':_0x552a93[_0xe321('0x1a')]?_[_0xe321('0x1b')](_0x552a93[_0xe321('0x1a')],function(_0x46c291){return{'model':db[_0x46c291['model']],'as':_0x46c291['as'],'attributes':_0x46c291[_0xe321('0x18')],'include':_0x46c291[_0xe321('0x1a')]?_[_0xe321('0x1b')](_0x46c291[_0xe321('0x1a')],function(_0x2a6059){return{'model':db[_0x2a6059['model']],'as':_0x2a6059['as'],'attributes':_0x2a6059[_0xe321('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a7fdc){logger[_0xe321('0xb')](_0xe321('0x1c'),_0x57bc16);logger['debug']('GetDeskAccount',_0x57bc16,JSON['stringify'](_0x5a7fdc));_0x3acd28(_0x5a7fdc);})[_0xe321('0x14')](function(_0x422757){logger['error'](_0xe321('0x1c'),_0x422757[_0xe321('0x13')],_0x57bc16);_0x36ec20(_0x1d1409[_0xe321('0x11')](0x1f4,_0x422757['message']));});});};exports[_0xe321('0x1d')]=function(_0x5aeed3){var _0x2179d0=this;return new Promise(function(_0x3b5a89,_0x288347){return db[_0xe321('0x1e')][_0xe321('0x1f')]({'raw':_0x5aeed3['options']?_0x5aeed3[_0xe321('0x16')][_0xe321('0x17')]===undefined?!![]:![]:!![],'where':_0x5aeed3[_0xe321('0x16')]?_0x5aeed3[_0xe321('0x16')][_0xe321('0x20')]||null:null,'attributes':_0x5aeed3['options']?_0x5aeed3[_0xe321('0x16')][_0xe321('0x18')]||null:null,'include':_0x5aeed3[_0xe321('0x16')]?_0x5aeed3[_0xe321('0x16')]['include']?_[_0xe321('0x1b')](_0x5aeed3[_0xe321('0x16')]['include'],function(_0x1a2c9a){return{'model':db[_0x1a2c9a['model']],'as':_0x1a2c9a['as'],'attributes':_0x1a2c9a[_0xe321('0x18')],'include':_0x1a2c9a['include']?_[_0xe321('0x1b')](_0x1a2c9a['include'],function(_0x2482a3){return{'model':db[_0x2482a3[_0xe321('0x21')]],'as':_0x2482a3['as'],'attributes':_0x2482a3[_0xe321('0x18')],'include':_0x2482a3[_0xe321('0x1a')]?_[_0xe321('0x1b')](_0x2482a3[_0xe321('0x1a')],function(_0x2048bc){return{'model':db[_0x2048bc[_0xe321('0x21')]],'as':_0x2048bc['as'],'attributes':_0x2048bc[_0xe321('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe321('0x22')](function(_0x35a9b7){logger[_0xe321('0xb')](_0xe321('0x1d'),_0x5aeed3);logger['debug']('ShowDeskAccount',_0x5aeed3,JSON['stringify'](_0x35a9b7));_0x3b5a89(_0x35a9b7);})['catch'](function(_0x40c16c){logger[_0xe321('0x11')]('ShowDeskAccount',_0x40c16c['message'],_0x5aeed3);_0x288347(_0x2179d0['error'](0x1f4,_0x40c16c[_0xe321('0x13')]));});});}; \ No newline at end of file +var _0x13ab=['GetDeskAccount','DeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','ShowDeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13ab,0x7a));var _0xb13a=function(_0x5a7bb0,_0x2cfc98){_0x5a7bb0=_0x5a7bb0-0x0;var _0x4e9ea1=_0x13ab[_0x5a7bb0];return _0x4e9ea1;};'use strict';var _=require(_0xb13a('0x0'));var util=require('util');var moment=require(_0xb13a('0x1'));var BPromise=require(_0xb13a('0x2'));var rs=require(_0xb13a('0x3'));var fs=require('fs');var Redis=require(_0xb13a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb13a('0x5'));var logger=require(_0xb13a('0x6'))(_0xb13a('0x7'));var config=require(_0xb13a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb13a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7fbfb2,_0x165e7,_0x3fbba7){return new BPromise(function(_0x2942f7,_0x1fcf2b){return client[_0xb13a('0xa')](_0x7fbfb2,_0x3fbba7)[_0xb13a('0xb')](function(_0x4053c0){logger['info'](_0xb13a('0xc'),_0x165e7,'request\x20sent');logger[_0xb13a('0xd')](_0xb13a('0xe'),_0x165e7,_0xb13a('0xf'),JSON['stringify'](_0x4053c0));if(_0x4053c0[_0xb13a('0x10')]){if(_0x4053c0['error'][_0xb13a('0x11')]===0x1f4){logger[_0xb13a('0x10')](_0xb13a('0xc'),_0x165e7,_0x4053c0[_0xb13a('0x10')]['message']);return _0x1fcf2b(_0x4053c0[_0xb13a('0x10')][_0xb13a('0x12')]);}logger['error'](_0xb13a('0xc'),_0x165e7,_0x4053c0[_0xb13a('0x10')]['message']);return _0x2942f7(_0x4053c0[_0xb13a('0x10')]['message']);}else{logger[_0xb13a('0x13')]('DeskAccount,\x20%s,\x20%s',_0x165e7,_0xb13a('0xf'));_0x2942f7(_0x4053c0[_0xb13a('0x14')][_0xb13a('0x12')]);}})[_0xb13a('0x15')](function(_0x1f0cd4){logger[_0xb13a('0x10')](_0xb13a('0xc'),_0x165e7,_0x1f0cd4);_0x1fcf2b(_0x1f0cd4);});});}exports[_0xb13a('0x16')]=function(_0x2fbee){var _0x44b4fb=this;return new Promise(function(_0x10a1fd,_0x47d797){return db[_0xb13a('0x17')][_0xb13a('0x18')]({'raw':_0x2fbee[_0xb13a('0x19')]?_0x2fbee[_0xb13a('0x19')][_0xb13a('0x1a')]===undefined?!![]:![]:!![],'where':_0x2fbee[_0xb13a('0x19')]?_0x2fbee[_0xb13a('0x19')][_0xb13a('0x1b')]||null:null,'attributes':_0x2fbee[_0xb13a('0x19')]?_0x2fbee[_0xb13a('0x19')]['attributes']||null:null,'limit':_0x2fbee[_0xb13a('0x19')]?_0x2fbee[_0xb13a('0x19')][_0xb13a('0x1c')]||null:null,'include':_0x2fbee['options']?_0x2fbee[_0xb13a('0x19')][_0xb13a('0x1d')]?_[_0xb13a('0x1e')](_0x2fbee[_0xb13a('0x19')][_0xb13a('0x1d')],function(_0x57fb67){return{'model':db[_0x57fb67[_0xb13a('0x1f')]],'as':_0x57fb67['as'],'attributes':_0x57fb67[_0xb13a('0x20')],'include':_0x57fb67[_0xb13a('0x1d')]?_[_0xb13a('0x1e')](_0x57fb67[_0xb13a('0x1d')],function(_0xb71422){return{'model':db[_0xb71422[_0xb13a('0x1f')]],'as':_0xb71422['as'],'attributes':_0xb71422[_0xb13a('0x20')],'include':_0xb71422[_0xb13a('0x1d')]?_[_0xb13a('0x1e')](_0xb71422[_0xb13a('0x1d')],function(_0x18196f){return{'model':db[_0x18196f['model']],'as':_0x18196f['as'],'attributes':_0x18196f[_0xb13a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb13a('0xb')](function(_0x4e0477){logger[_0xb13a('0x13')](_0xb13a('0x16'),_0x2fbee);logger[_0xb13a('0xd')](_0xb13a('0x16'),_0x2fbee,JSON[_0xb13a('0x21')](_0x4e0477));_0x10a1fd(_0x4e0477);})[_0xb13a('0x15')](function(_0x44abec){logger[_0xb13a('0x10')]('GetDeskAccount',_0x44abec['message'],_0x2fbee);_0x47d797(_0x44b4fb[_0xb13a('0x10')](0x1f4,_0x44abec[_0xb13a('0x12')]));});});};exports[_0xb13a('0x22')]=function(_0x24e138){var _0x107576=this;return new Promise(function(_0x8220b3,_0x4773b1){return db[_0xb13a('0x17')][_0xb13a('0x23')]({'raw':_0x24e138[_0xb13a('0x19')]?_0x24e138['options'][_0xb13a('0x1a')]===undefined?!![]:![]:!![],'where':_0x24e138[_0xb13a('0x19')]?_0x24e138[_0xb13a('0x19')][_0xb13a('0x1b')]||null:null,'attributes':_0x24e138[_0xb13a('0x19')]?_0x24e138[_0xb13a('0x19')][_0xb13a('0x20')]||null:null,'include':_0x24e138[_0xb13a('0x19')]?_0x24e138[_0xb13a('0x19')][_0xb13a('0x1d')]?_['map'](_0x24e138[_0xb13a('0x19')]['include'],function(_0x31a0a6){return{'model':db[_0x31a0a6[_0xb13a('0x1f')]],'as':_0x31a0a6['as'],'attributes':_0x31a0a6[_0xb13a('0x20')],'include':_0x31a0a6[_0xb13a('0x1d')]?_[_0xb13a('0x1e')](_0x31a0a6[_0xb13a('0x1d')],function(_0x534f3a){return{'model':db[_0x534f3a[_0xb13a('0x1f')]],'as':_0x534f3a['as'],'attributes':_0x534f3a[_0xb13a('0x20')],'include':_0x534f3a[_0xb13a('0x1d')]?_[_0xb13a('0x1e')](_0x534f3a['include'],function(_0x10332b){return{'model':db[_0x10332b[_0xb13a('0x1f')]],'as':_0x10332b['as'],'attributes':_0x10332b[_0xb13a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb13a('0xb')](function(_0x2cd64d){logger['info'](_0xb13a('0x22'),_0x24e138);logger[_0xb13a('0xd')](_0xb13a('0x22'),_0x24e138,JSON['stringify'](_0x2cd64d));_0x8220b3(_0x2cd64d);})[_0xb13a('0x15')](function(_0x462acf){logger[_0xb13a('0x10')](_0xb13a('0x22'),_0x462acf[_0xb13a('0x12')],_0x24e138);_0x4773b1(_0x107576[_0xb13a('0x10')](0x1f4,_0x462acf[_0xb13a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index e662627..a74e7c7 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(_0x19ef2b,_0x354f66){var _0x4df537=function(_0x576738){while(--_0x576738){_0x19ef2b['push'](_0x19ef2b['shift']());}};_0x4df537(++_0x354f66);}(_0x55ca,0x126));var _0xa55c=function(_0x33e93d,_0x1a8423){_0x33e93d=_0x33e93d-0x0;var _0x19e99d=_0x55ca[_0x33e93d];return _0x19e99d;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x4281f3,_0x51daa2){var _0x1296f8=function(_0x6f286e){while(--_0x6f286e){_0x4281f3['push'](_0x4281f3['shift']());}};_0x1296f8(++_0x51daa2);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 56b259a..88b0d24 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 _0x3743=['STRING','exports'];(function(_0x59429c,_0x74e47c){var _0x3bb838=function(_0x539343){while(--_0x539343){_0x59429c['push'](_0x59429c['shift']());}};_0x3bb838(++_0x74e47c);}(_0x3743,0x9f));var _0x3374=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0x3743[_0x5f42f1];return _0x5534ee;};'use strict';var Sequelize=require('sequelize');module[_0x3374('0x0')]={'name':{'type':Sequelize[_0x3374('0x1')]},'description':{'type':Sequelize[_0x3374('0x1')]}}; \ No newline at end of file +var _0xb7f3=['STRING','sequelize'];(function(_0x108831,_0x5e4f70){var _0x4da77a=function(_0x139446){while(--_0x139446){_0x108831['push'](_0x108831['shift']());}};_0x4da77a(++_0x5e4f70);}(_0xb7f3,0x107));var _0x3b7f=function(_0x1797e5,_0x679f29){_0x1797e5=_0x1797e5-0x0;var _0x1e8ee3=_0xb7f3[_0x1797e5];return _0x1e8ee3;};'use strict';var Sequelize=require(_0x3b7f('0x0'));module['exports']={'name':{'type':Sequelize[_0x3b7f('0x1')]},'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 5f82cee..c4c4196 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 _0x4e80=['request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','save','update','destroy','then','error','stack','name','send','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','DeskField','filter','hasOwnProperty','nolimit','getSubjects','findOne','options','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x4e80,0x152));var _0x04e8=function(_0x18b73e,_0x39b3f2){_0x18b73e=_0x18b73e-0x0;var _0x25fa91=_0x4e80[_0x18b73e];return _0x25fa91;};'use strict';var emlformat=require(_0x04e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x04e8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04e8('0x2'));var moment=require(_0x04e8('0x3'));var BPromise=require(_0x04e8('0x4'));var Mustache=require('mustache');var util=require(_0x04e8('0x5'));var path=require('path');var sox=require(_0x04e8('0x6'));var csv=require('to-csv');var ejs=require(_0x04e8('0x7'));var fs=require('fs');var fs_extra=require(_0x04e8('0x8'));var _=require(_0x04e8('0x9'));var squel=require(_0x04e8('0xa'));var crypto=require(_0x04e8('0xb'));var jsforce=require(_0x04e8('0xc'));var deskjs=require(_0x04e8('0xd'));var toCsv=require(_0x04e8('0xe'));var querystring=require(_0x04e8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x04e8('0x10'));var qs=require(_0x04e8('0x11'));var as=require(_0x04e8('0x12'));var hardwareService=require(_0x04e8('0x13'));var logger=require(_0x04e8('0x14'))('api');var utils=require(_0x04e8('0x15'));var config=require(_0x04e8('0x16'));var licenseUtil=require(_0x04e8('0x17'));var db=require(_0x04e8('0x18'))['db'];function respondWithStatusCode(_0x2bc760,_0x412f1c){_0x412f1c=_0x412f1c||0xcc;return function(_0x1e0001){if(_0x1e0001){return _0x2bc760[_0x04e8('0x19')](_0x412f1c);}return _0x2bc760[_0x04e8('0x1a')](_0x412f1c)[_0x04e8('0x1b')]();};}function respondWithResult(_0x20a27e,_0xb6ac4a){_0xb6ac4a=_0xb6ac4a||0xc8;return function(_0xaadcb9){if(_0xaadcb9){return _0x20a27e[_0x04e8('0x1a')](_0xb6ac4a)['json'](_0xaadcb9);}};}function respondWithFilteredResult(_0x42720,_0x253c1c){return function(_0x27de99){if(_0x27de99){var _0x50b8e5=typeof _0x253c1c[_0x04e8('0x1c')]===_0x04e8('0x1d')&&typeof _0x253c1c['limit']==='undefined';var _0x16c171=_0x27de99[_0x04e8('0x1e')];var _0x23a8c8=_0x50b8e5?0x0:_0x253c1c[_0x04e8('0x1c')];var _0x5179b8=_0x50b8e5?_0x27de99[_0x04e8('0x1e')]:_0x253c1c['offset']+_0x253c1c[_0x04e8('0x1f')];var _0x30946c;if(_0x5179b8>=_0x16c171){_0x5179b8=_0x16c171;_0x30946c=0xc8;}else{_0x30946c=0xce;}_0x42720[_0x04e8('0x1a')](_0x30946c);return _0x42720[_0x04e8('0x20')](_0x04e8('0x21'),_0x23a8c8+'-'+_0x5179b8+'/'+_0x16c171)[_0x04e8('0x22')](_0x27de99);}return null;};}function patchUpdates(_0x4de40a){return function(_0x3d8834){try{jsonpatch['apply'](_0x3d8834,_0x4de40a,!![]);}catch(_0x31ebef){return BPromise['reject'](_0x31ebef);}return _0x3d8834[_0x04e8('0x23')]();};}function saveUpdates(_0x178fbb,_0x22b563){return function(_0x15f4bf){if(_0x15f4bf){return _0x15f4bf[_0x04e8('0x24')](_0x178fbb)['then'](function(_0x1706fe){return _0x1706fe;});}return null;};}function removeEntity(_0x351e38,_0x479ce0){return function(_0x34c78d){if(_0x34c78d){return _0x34c78d[_0x04e8('0x25')]()[_0x04e8('0x26')](function(){_0x351e38['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f64c,_0x2a47ac){return function(_0x4332cf){if(!_0x4332cf){_0x40f64c[_0x04e8('0x19')](0x194);}return _0x4332cf;};}function handleError(_0x410bd7,_0x3021ba){_0x3021ba=_0x3021ba||0x1f4;return function(_0x1dc22e){logger[_0x04e8('0x27')](_0x1dc22e[_0x04e8('0x28')]);if(_0x1dc22e['name']){delete _0x1dc22e[_0x04e8('0x29')];}_0x410bd7[_0x04e8('0x1a')](_0x3021ba)[_0x04e8('0x2a')](_0x1dc22e);};}exports['index']=function(_0x22bc21,_0x594b02){var _0x3e6d0b={},_0x6e3491={},_0x43b2be={'count':0x0,'rows':[]};var _0x4c380d=_[_0x04e8('0x2b')](db[_0x04e8('0x2c')][_0x04e8('0x2d')],function(_0x4f6c9e){return{'name':_0x4f6c9e[_0x04e8('0x2e')],'type':_0x4f6c9e[_0x04e8('0x2f')][_0x04e8('0x30')]};});_0x6e3491[_0x04e8('0x31')]=_[_0x04e8('0x2b')](_0x4c380d,_0x04e8('0x29'));_0x6e3491[_0x04e8('0x32')]=_[_0x04e8('0x33')](_0x22bc21['query']);_0x6e3491[_0x04e8('0x34')]=_[_0x04e8('0x35')](_0x6e3491['model'],_0x6e3491[_0x04e8('0x32')]);_0x3e6d0b['attributes']=_['intersection'](_0x6e3491[_0x04e8('0x31')],qs[_0x04e8('0x36')](_0x22bc21['query'][_0x04e8('0x36')]));_0x3e6d0b[_0x04e8('0x37')]=_0x3e6d0b[_0x04e8('0x37')][_0x04e8('0x38')]?_0x3e6d0b['attributes']:_0x6e3491['model'];if(!_0x22bc21[_0x04e8('0x32')]['hasOwnProperty']('nolimit')){_0x3e6d0b[_0x04e8('0x1f')]=qs[_0x04e8('0x1f')](_0x22bc21[_0x04e8('0x32')][_0x04e8('0x1f')]);_0x3e6d0b[_0x04e8('0x1c')]=qs[_0x04e8('0x1c')](_0x22bc21['query'][_0x04e8('0x1c')]);}_0x3e6d0b[_0x04e8('0x39')]=qs['sort'](_0x22bc21['query'][_0x04e8('0x3a')]);_0x3e6d0b[_0x04e8('0x3b')]=qs[_0x04e8('0x34')](_[_0x04e8('0x3c')](_0x22bc21['query'],_0x6e3491[_0x04e8('0x34')]),_0x4c380d);if(_0x22bc21['query']['filter']){_0x3e6d0b['where']=_['merge'](_0x3e6d0b[_0x04e8('0x3b')],{'$or':_[_0x04e8('0x2b')](_0x4c380d,function(_0x40e03d){if(_0x40e03d[_0x04e8('0x2f')]!==_0x04e8('0x3d')){var _0x1536c3={};_0x1536c3[_0x40e03d['name']]={'$like':'%'+_0x22bc21[_0x04e8('0x32')]['filter']+'%'};return _0x1536c3;}})});}_0x3e6d0b=_[_0x04e8('0x3e')]({},_0x3e6d0b,_0x22bc21['options']);var _0x183d91={'where':_0x3e6d0b[_0x04e8('0x3b')]};return db[_0x04e8('0x2c')][_0x04e8('0x1e')](_0x183d91)[_0x04e8('0x26')](function(_0x20f679){_0x43b2be[_0x04e8('0x1e')]=_0x20f679;if(_0x22bc21[_0x04e8('0x32')][_0x04e8('0x3f')]){_0x3e6d0b[_0x04e8('0x40')]=[{'all':!![]}];}return db[_0x04e8('0x2c')][_0x04e8('0x41')](_0x3e6d0b);})[_0x04e8('0x26')](function(_0x1f9659){_0x43b2be[_0x04e8('0x42')]=_0x1f9659;return _0x43b2be;})[_0x04e8('0x26')](respondWithFilteredResult(_0x594b02,_0x3e6d0b))[_0x04e8('0x43')](handleError(_0x594b02,null));};exports[_0x04e8('0x44')]=function(_0x5b25ac,_0x533301){var _0x3e14d3={'raw':![],'where':{'id':_0x5b25ac[_0x04e8('0x45')]['id']}},_0xeaeaa0={};_0xeaeaa0['model']=_[_0x04e8('0x33')](db[_0x04e8('0x2c')][_0x04e8('0x2d')]);_0xeaeaa0['query']=_[_0x04e8('0x33')](_0x5b25ac[_0x04e8('0x32')]);_0xeaeaa0[_0x04e8('0x34')]=_[_0x04e8('0x35')](_0xeaeaa0[_0x04e8('0x31')],_0xeaeaa0['query']);_0x3e14d3[_0x04e8('0x37')]=_[_0x04e8('0x35')](_0xeaeaa0[_0x04e8('0x31')],qs[_0x04e8('0x36')](_0x5b25ac[_0x04e8('0x32')][_0x04e8('0x36')]));_0x3e14d3[_0x04e8('0x37')]=_0x3e14d3[_0x04e8('0x37')][_0x04e8('0x38')]?_0x3e14d3['attributes']:_0xeaeaa0[_0x04e8('0x31')];if(_0x5b25ac['query'][_0x04e8('0x3f')]){_0x3e14d3[_0x04e8('0x40')]=[{'all':!![]}];}_0x3e14d3=_['merge']({},_0x3e14d3,_0x5b25ac['options']);return db[_0x04e8('0x2c')][_0x04e8('0x46')](_0x3e14d3)[_0x04e8('0x26')](handleEntityNotFound(_0x533301,null))[_0x04e8('0x26')](respondWithResult(_0x533301,null))[_0x04e8('0x43')](handleError(_0x533301,null));};exports[_0x04e8('0x47')]=function(_0x5da853,_0x4e2f9b){return db[_0x04e8('0x2c')][_0x04e8('0x47')](_0x5da853[_0x04e8('0x48')],{})[_0x04e8('0x26')](respondWithResult(_0x4e2f9b,0xc9))[_0x04e8('0x43')](handleError(_0x4e2f9b,null));};exports[_0x04e8('0x24')]=function(_0x50cb49,_0xcc3f82){if(_0x50cb49['body']['id']){delete _0x50cb49[_0x04e8('0x48')]['id'];}return db[_0x04e8('0x2c')][_0x04e8('0x46')]({'where':{'id':_0x50cb49['params']['id']}})[_0x04e8('0x26')](handleEntityNotFound(_0xcc3f82,null))['then'](saveUpdates(_0x50cb49['body'],null))[_0x04e8('0x26')](respondWithResult(_0xcc3f82,null))['catch'](handleError(_0xcc3f82,null));};exports[_0x04e8('0x25')]=function(_0x5e40e1,_0x1d22ca){return db[_0x04e8('0x2c')][_0x04e8('0x46')]({'where':{'id':_0x5e40e1[_0x04e8('0x45')]['id']}})[_0x04e8('0x26')](handleEntityNotFound(_0x1d22ca,null))[_0x04e8('0x26')](removeEntity(_0x1d22ca,null))[_0x04e8('0x43')](handleError(_0x1d22ca,null));};exports[_0x04e8('0x49')]=function(_0x368d5d,_0x52fd8c,_0x29bcec){var _0x3a7a82={};var _0x2b0a96={};var _0x360753;var _0x339d71;return db[_0x04e8('0x2c')]['findOne']({'where':{'id':_0x368d5d['params']['id']}})[_0x04e8('0x26')](handleEntityNotFound(_0x52fd8c,null))[_0x04e8('0x26')](function(_0x14c8b5){if(_0x14c8b5){_0x360753=_0x14c8b5;_0x2b0a96[_0x04e8('0x31')]=_[_0x04e8('0x33')](db[_0x04e8('0x4a')]['rawAttributes']);_0x2b0a96[_0x04e8('0x32')]=_['keys'](_0x368d5d[_0x04e8('0x32')]);_0x2b0a96['filters']=_[_0x04e8('0x35')](_0x2b0a96[_0x04e8('0x31')],_0x2b0a96[_0x04e8('0x32')]);_0x3a7a82[_0x04e8('0x37')]=_[_0x04e8('0x35')](_0x2b0a96[_0x04e8('0x31')],qs['fields'](_0x368d5d[_0x04e8('0x32')][_0x04e8('0x36')]));_0x3a7a82[_0x04e8('0x37')]=_0x3a7a82[_0x04e8('0x37')][_0x04e8('0x38')]?_0x3a7a82[_0x04e8('0x37')]:_0x2b0a96[_0x04e8('0x31')];_0x3a7a82['order']=qs[_0x04e8('0x3a')](_0x368d5d[_0x04e8('0x32')][_0x04e8('0x3a')]);_0x3a7a82['where']=qs['filters'](_[_0x04e8('0x3c')](_0x368d5d[_0x04e8('0x32')],_0x2b0a96[_0x04e8('0x34')]));if(_0x368d5d['query'][_0x04e8('0x4b')]){_0x3a7a82[_0x04e8('0x3b')]=_[_0x04e8('0x3e')](_0x3a7a82[_0x04e8('0x3b')],{'$or':_[_0x04e8('0x2b')](_0x3a7a82[_0x04e8('0x37')],function(_0x17ba1f){var _0x2f99b1={};_0x2f99b1[_0x17ba1f]={'$like':'%'+_0x368d5d['query']['filter']+'%'};return _0x2f99b1;})});}_0x3a7a82=_[_0x04e8('0x3e')]({},_0x3a7a82,_0x368d5d['options']);return _0x360753['getFields'](_0x3a7a82);}})[_0x04e8('0x26')](function(_0xb4bf06){if(_0xb4bf06){_0x339d71=_0xb4bf06[_0x04e8('0x38')];if(!_0x368d5d[_0x04e8('0x32')][_0x04e8('0x4c')](_0x04e8('0x4d'))){_0x3a7a82[_0x04e8('0x1f')]=qs[_0x04e8('0x1f')](_0x368d5d[_0x04e8('0x32')][_0x04e8('0x1f')]);_0x3a7a82[_0x04e8('0x1c')]=qs[_0x04e8('0x1c')](_0x368d5d['query'][_0x04e8('0x1c')]);}return _0x360753[_0x04e8('0x49')](_0x3a7a82);}})[_0x04e8('0x26')](function(_0x58da4e){if(_0x58da4e){return _0x58da4e?{'count':_0x339d71,'rows':_0x58da4e}:null;}})[_0x04e8('0x26')](respondWithResult(_0x52fd8c,null))[_0x04e8('0x43')](handleError(_0x52fd8c,null));};exports[_0x04e8('0x4e')]=function(_0x32bf18,_0x6717d0,_0x52d93f){var _0x53b60d={};var _0x118bc9={};var _0x41313a;var _0x2dd000;return db['DeskConfiguration'][_0x04e8('0x4f')]({'where':{'id':_0x32bf18['params']['id']}})['then'](handleEntityNotFound(_0x6717d0,null))[_0x04e8('0x26')](function(_0x43df52){if(_0x43df52){_0x41313a=_0x43df52;_0x118bc9[_0x04e8('0x31')]=_['keys'](db[_0x04e8('0x4a')][_0x04e8('0x2d')]);_0x118bc9['query']=_[_0x04e8('0x33')](_0x32bf18[_0x04e8('0x32')]);_0x118bc9[_0x04e8('0x34')]=_['intersection'](_0x118bc9[_0x04e8('0x31')],_0x118bc9[_0x04e8('0x32')]);_0x53b60d[_0x04e8('0x37')]=_[_0x04e8('0x35')](_0x118bc9[_0x04e8('0x31')],qs[_0x04e8('0x36')](_0x32bf18[_0x04e8('0x32')]['fields']));_0x53b60d[_0x04e8('0x37')]=_0x53b60d[_0x04e8('0x37')]['length']?_0x53b60d['attributes']:_0x118bc9[_0x04e8('0x31')];_0x53b60d['order']=qs[_0x04e8('0x3a')](_0x32bf18[_0x04e8('0x32')][_0x04e8('0x3a')]);_0x53b60d[_0x04e8('0x3b')]=qs[_0x04e8('0x34')](_[_0x04e8('0x3c')](_0x32bf18[_0x04e8('0x32')],_0x118bc9[_0x04e8('0x34')]));if(_0x32bf18[_0x04e8('0x32')][_0x04e8('0x4b')]){_0x53b60d[_0x04e8('0x3b')]=_[_0x04e8('0x3e')](_0x53b60d[_0x04e8('0x3b')],{'$or':_[_0x04e8('0x2b')](_0x53b60d[_0x04e8('0x37')],function(_0x16196d){var _0x5b1ebb={};_0x5b1ebb[_0x16196d]={'$like':'%'+_0x32bf18['query'][_0x04e8('0x4b')]+'%'};return _0x5b1ebb;})});}_0x53b60d=_[_0x04e8('0x3e')]({},_0x53b60d,_0x32bf18[_0x04e8('0x50')]);return _0x41313a[_0x04e8('0x4e')](_0x53b60d);}})[_0x04e8('0x26')](function(_0x3b99f0){if(_0x3b99f0){_0x2dd000=_0x3b99f0[_0x04e8('0x38')];if(!_0x32bf18[_0x04e8('0x32')][_0x04e8('0x4c')](_0x04e8('0x4d'))){_0x53b60d[_0x04e8('0x1f')]=qs[_0x04e8('0x1f')](_0x32bf18['query'][_0x04e8('0x1f')]);_0x53b60d['offset']=qs[_0x04e8('0x1c')](_0x32bf18[_0x04e8('0x32')][_0x04e8('0x1c')]);}return _0x41313a[_0x04e8('0x4e')](_0x53b60d);}})[_0x04e8('0x26')](function(_0x1790da){if(_0x1790da){return _0x1790da?{'count':_0x2dd000,'rows':_0x1790da}:null;}})['then'](respondWithResult(_0x6717d0,null))[_0x04e8('0x43')](handleError(_0x6717d0,null));};exports[_0x04e8('0x51')]=function(_0x5755b8,_0x315bb7,_0x28c97c){var _0x1e64f6={};var _0x3b632={};var _0x17b9a5;var _0x18f274;return db[_0x04e8('0x2c')]['findOne']({'where':{'id':_0x5755b8[_0x04e8('0x45')]['id']}})[_0x04e8('0x26')](handleEntityNotFound(_0x315bb7,null))['then'](function(_0x557353){if(_0x557353){_0x17b9a5=_0x557353;_0x3b632['model']=_[_0x04e8('0x33')](db[_0x04e8('0x4a')]['rawAttributes']);_0x3b632[_0x04e8('0x32')]=_[_0x04e8('0x33')](_0x5755b8[_0x04e8('0x32')]);_0x3b632[_0x04e8('0x34')]=_[_0x04e8('0x35')](_0x3b632[_0x04e8('0x31')],_0x3b632[_0x04e8('0x32')]);_0x1e64f6[_0x04e8('0x37')]=_['intersection'](_0x3b632[_0x04e8('0x31')],qs[_0x04e8('0x36')](_0x5755b8['query'][_0x04e8('0x36')]));_0x1e64f6['attributes']=_0x1e64f6[_0x04e8('0x37')]['length']?_0x1e64f6['attributes']:_0x3b632[_0x04e8('0x31')];_0x1e64f6['order']=qs[_0x04e8('0x3a')](_0x5755b8[_0x04e8('0x32')][_0x04e8('0x3a')]);_0x1e64f6[_0x04e8('0x3b')]=qs[_0x04e8('0x34')](_['pick'](_0x5755b8[_0x04e8('0x32')],_0x3b632[_0x04e8('0x34')]));if(_0x5755b8['query'][_0x04e8('0x4b')]){_0x1e64f6[_0x04e8('0x3b')]=_[_0x04e8('0x3e')](_0x1e64f6[_0x04e8('0x3b')],{'$or':_['map'](_0x1e64f6[_0x04e8('0x37')],function(_0x36a63e){var _0xa65799={};_0xa65799[_0x36a63e]={'$like':'%'+_0x5755b8['query'][_0x04e8('0x4b')]+'%'};return _0xa65799;})});}_0x1e64f6=_[_0x04e8('0x3e')]({},_0x1e64f6,_0x5755b8['options']);return _0x17b9a5[_0x04e8('0x51')](_0x1e64f6);}})[_0x04e8('0x26')](function(_0x5822d8){if(_0x5822d8){_0x18f274=_0x5822d8['length'];if(!_0x5755b8[_0x04e8('0x32')]['hasOwnProperty'](_0x04e8('0x4d'))){_0x1e64f6[_0x04e8('0x1f')]=qs[_0x04e8('0x1f')](_0x5755b8[_0x04e8('0x32')][_0x04e8('0x1f')]);_0x1e64f6['offset']=qs[_0x04e8('0x1c')](_0x5755b8['query'][_0x04e8('0x1c')]);}return _0x17b9a5[_0x04e8('0x51')](_0x1e64f6);}})[_0x04e8('0x26')](function(_0x2175c7){if(_0x2175c7){return _0x2175c7?{'count':_0x18f274,'rows':_0x2175c7}:null;}})[_0x04e8('0x26')](respondWithResult(_0x315bb7,null))[_0x04e8('0x43')](handleError(_0x315bb7,null));};exports[_0x04e8('0x52')]=function(_0x22911e,_0x42c240,_0x2ab252){var _0x6e6c0c={};var _0x76a303={};var _0x149a34;var _0x35a89a;return db[_0x04e8('0x2c')][_0x04e8('0x4f')]({'where':{'id':_0x22911e[_0x04e8('0x45')]['id']}})[_0x04e8('0x26')](handleEntityNotFound(_0x42c240,null))[_0x04e8('0x26')](function(_0x25a6c1){if(_0x25a6c1){_0x149a34=_0x25a6c1;_0x76a303['model']=_['keys'](db[_0x04e8('0x53')]['rawAttributes']);_0x76a303[_0x04e8('0x32')]=_[_0x04e8('0x33')](_0x22911e[_0x04e8('0x32')]);_0x76a303[_0x04e8('0x34')]=_[_0x04e8('0x35')](_0x76a303[_0x04e8('0x31')],_0x76a303[_0x04e8('0x32')]);_0x6e6c0c['attributes']=_[_0x04e8('0x35')](_0x76a303[_0x04e8('0x31')],qs[_0x04e8('0x36')](_0x22911e[_0x04e8('0x32')][_0x04e8('0x36')]));_0x6e6c0c['attributes']=_0x6e6c0c[_0x04e8('0x37')][_0x04e8('0x38')]?_0x6e6c0c[_0x04e8('0x37')]:_0x76a303['model'];_0x6e6c0c['order']=qs[_0x04e8('0x3a')](_0x22911e[_0x04e8('0x32')][_0x04e8('0x3a')]);_0x6e6c0c[_0x04e8('0x3b')]=qs[_0x04e8('0x34')](_['pick'](_0x22911e[_0x04e8('0x32')],_0x76a303[_0x04e8('0x34')]));if(_0x22911e[_0x04e8('0x32')][_0x04e8('0x4b')]){_0x6e6c0c['where']=_[_0x04e8('0x3e')](_0x6e6c0c[_0x04e8('0x3b')],{'$or':_[_0x04e8('0x2b')](_0x6e6c0c[_0x04e8('0x37')],function(_0x179864){var _0x296a57={};_0x296a57[_0x179864]={'$like':'%'+_0x22911e[_0x04e8('0x32')][_0x04e8('0x4b')]+'%'};return _0x296a57;})});}_0x6e6c0c=_['merge']({},_0x6e6c0c,_0x22911e[_0x04e8('0x50')]);return _0x149a34[_0x04e8('0x52')](_0x6e6c0c);}})[_0x04e8('0x26')](function(_0x19d9c3){if(_0x19d9c3){_0x35a89a=_0x19d9c3[_0x04e8('0x38')];if(!_0x22911e[_0x04e8('0x32')][_0x04e8('0x4c')](_0x04e8('0x4d'))){_0x6e6c0c[_0x04e8('0x1f')]=qs['limit'](_0x22911e['query'][_0x04e8('0x1f')]);_0x6e6c0c[_0x04e8('0x1c')]=qs[_0x04e8('0x1c')](_0x22911e[_0x04e8('0x32')]['offset']);}return _0x149a34['getTags'](_0x6e6c0c);}})[_0x04e8('0x26')](function(_0x25e37c){if(_0x25e37c){return _0x25e37c?{'count':_0x35a89a,'rows':_0x25e37c}:null;}})[_0x04e8('0x26')](respondWithResult(_0x42c240,null))[_0x04e8('0x43')](handleError(_0x42c240,null));};exports[_0x04e8('0x54')]=function(_0xf8af1,_0x2e3624,_0x432631){if(_0xf8af1[_0x04e8('0x48')]['id']){delete _0xf8af1[_0x04e8('0x48')]['id'];}return db[_0x04e8('0x2c')][_0x04e8('0x4f')]({'where':{'id':_0xf8af1[_0x04e8('0x45')]['id']}})[_0x04e8('0x26')](handleEntityNotFound(_0x2e3624,null))[_0x04e8('0x26')](function(_0x129915){if(_0x129915){return _0x129915[_0x04e8('0x54')](_0xf8af1[_0x04e8('0x48')]['ids']||[]);}return null;})[_0x04e8('0x26')](respondWithResult(_0x2e3624,null))[_0x04e8('0x43')](handleError(_0x2e3624,null));}; \ No newline at end of file +var _0xb677=['order','sort','where','pick','filter','merge','VIRTUAL','DeskConfiguration','count','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','getFields','findOne','DeskField','hasOwnProperty','getSubjects','options','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0xb677,0xc9));var _0x7b67=function(_0x5b0456,_0x39bd8d){_0x5b0456=_0x5b0456-0x0;var _0x591a22=_0xb677[_0x5b0456];return _0x591a22;};'use strict';var emlformat=require(_0x7b67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b67('0x1'));var jsonpatch=require(_0x7b67('0x2'));var rp=require(_0x7b67('0x3'));var moment=require('moment');var BPromise=require(_0x7b67('0x4'));var Mustache=require(_0x7b67('0x5'));var util=require(_0x7b67('0x6'));var path=require(_0x7b67('0x7'));var sox=require(_0x7b67('0x8'));var csv=require(_0x7b67('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b67('0xa'));var _=require('lodash');var squel=require(_0x7b67('0xb'));var crypto=require(_0x7b67('0xc'));var jsforce=require(_0x7b67('0xd'));var deskjs=require(_0x7b67('0xe'));var toCsv=require(_0x7b67('0x9'));var querystring=require('querystring');var Papa=require(_0x7b67('0xf'));var Redis=require(_0x7b67('0x10'));var authService=require(_0x7b67('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7b67('0x12'));var hardwareService=require(_0x7b67('0x13'));var logger=require(_0x7b67('0x14'))('api');var utils=require(_0x7b67('0x15'));var config=require(_0x7b67('0x16'));var licenseUtil=require(_0x7b67('0x17'));var db=require(_0x7b67('0x18'))['db'];function respondWithStatusCode(_0x51afbd,_0x3eb33c){_0x3eb33c=_0x3eb33c||0xcc;return function(_0x8c8033){if(_0x8c8033){return _0x51afbd[_0x7b67('0x19')](_0x3eb33c);}return _0x51afbd[_0x7b67('0x1a')](_0x3eb33c)[_0x7b67('0x1b')]();};}function respondWithResult(_0x2f3b9a,_0x2ba2ee){_0x2ba2ee=_0x2ba2ee||0xc8;return function(_0x4d506b){if(_0x4d506b){return _0x2f3b9a[_0x7b67('0x1a')](_0x2ba2ee)[_0x7b67('0x1c')](_0x4d506b);}};}function respondWithFilteredResult(_0x396cb1,_0x39cbc5){return function(_0x5ee79b){if(_0x5ee79b){var _0x102ff9=typeof _0x39cbc5[_0x7b67('0x1d')]===_0x7b67('0x1e')&&typeof _0x39cbc5[_0x7b67('0x1f')]==='undefined';var _0x3d204c=_0x5ee79b['count'];var _0x102b8c=_0x102ff9?0x0:_0x39cbc5[_0x7b67('0x1d')];var _0x146f0b=_0x102ff9?_0x5ee79b['count']:_0x39cbc5[_0x7b67('0x1d')]+_0x39cbc5[_0x7b67('0x1f')];var _0x2e04a9;if(_0x146f0b>=_0x3d204c){_0x146f0b=_0x3d204c;_0x2e04a9=0xc8;}else{_0x2e04a9=0xce;}_0x396cb1[_0x7b67('0x1a')](_0x2e04a9);return _0x396cb1[_0x7b67('0x20')](_0x7b67('0x21'),_0x102b8c+'-'+_0x146f0b+'/'+_0x3d204c)[_0x7b67('0x1c')](_0x5ee79b);}return null;};}function patchUpdates(_0x979d71){return function(_0x35c001){try{jsonpatch[_0x7b67('0x22')](_0x35c001,_0x979d71,!![]);}catch(_0x59cb6a){return BPromise[_0x7b67('0x23')](_0x59cb6a);}return _0x35c001[_0x7b67('0x24')]();};}function saveUpdates(_0x375b50,_0x384f06){return function(_0x53d0ec){if(_0x53d0ec){return _0x53d0ec[_0x7b67('0x25')](_0x375b50)[_0x7b67('0x26')](function(_0x2074f3){return _0x2074f3;});}return null;};}function removeEntity(_0x19f959,_0x44c92b){return function(_0x204da6){if(_0x204da6){return _0x204da6[_0x7b67('0x27')]()[_0x7b67('0x26')](function(){_0x19f959[_0x7b67('0x1a')](0xcc)[_0x7b67('0x1b')]();});}};}function handleEntityNotFound(_0x35c73f,_0x10c52c){return function(_0xe1050f){if(!_0xe1050f){_0x35c73f['sendStatus'](0x194);}return _0xe1050f;};}function handleError(_0x26e342,_0x1ab2f5){_0x1ab2f5=_0x1ab2f5||0x1f4;return function(_0x2dd3f7){logger['error'](_0x2dd3f7['stack']);if(_0x2dd3f7[_0x7b67('0x28')]){delete _0x2dd3f7[_0x7b67('0x28')];}_0x26e342[_0x7b67('0x1a')](_0x1ab2f5)['send'](_0x2dd3f7);};}exports['index']=function(_0x2953d0,_0x3e42e6){var _0x5e34da={},_0x4f43fc={},_0x27456b={'count':0x0,'rows':[]};var _0x5366d5=_[_0x7b67('0x29')](db['DeskConfiguration']['rawAttributes'],function(_0x3633ac){return{'name':_0x3633ac[_0x7b67('0x2a')],'type':_0x3633ac[_0x7b67('0x2b')][_0x7b67('0x2c')]};});_0x4f43fc[_0x7b67('0x2d')]=_[_0x7b67('0x29')](_0x5366d5,'name');_0x4f43fc[_0x7b67('0x2e')]=_[_0x7b67('0x2f')](_0x2953d0[_0x7b67('0x2e')]);_0x4f43fc[_0x7b67('0x30')]=_[_0x7b67('0x31')](_0x4f43fc[_0x7b67('0x2d')],_0x4f43fc[_0x7b67('0x2e')]);_0x5e34da[_0x7b67('0x32')]=_[_0x7b67('0x31')](_0x4f43fc['model'],qs[_0x7b67('0x33')](_0x2953d0[_0x7b67('0x2e')][_0x7b67('0x33')]));_0x5e34da[_0x7b67('0x32')]=_0x5e34da[_0x7b67('0x32')][_0x7b67('0x34')]?_0x5e34da[_0x7b67('0x32')]:_0x4f43fc[_0x7b67('0x2d')];if(!_0x2953d0[_0x7b67('0x2e')]['hasOwnProperty'](_0x7b67('0x35'))){_0x5e34da[_0x7b67('0x1f')]=qs['limit'](_0x2953d0[_0x7b67('0x2e')][_0x7b67('0x1f')]);_0x5e34da[_0x7b67('0x1d')]=qs['offset'](_0x2953d0['query'][_0x7b67('0x1d')]);}_0x5e34da[_0x7b67('0x36')]=qs[_0x7b67('0x37')](_0x2953d0[_0x7b67('0x2e')][_0x7b67('0x37')]);_0x5e34da[_0x7b67('0x38')]=qs[_0x7b67('0x30')](_[_0x7b67('0x39')](_0x2953d0[_0x7b67('0x2e')],_0x4f43fc['filters']),_0x5366d5);if(_0x2953d0['query'][_0x7b67('0x3a')]){_0x5e34da[_0x7b67('0x38')]=_[_0x7b67('0x3b')](_0x5e34da[_0x7b67('0x38')],{'$or':_[_0x7b67('0x29')](_0x5366d5,function(_0x3795b5){if(_0x3795b5['type']!==_0x7b67('0x3c')){var _0x5c54c9={};_0x5c54c9[_0x3795b5['name']]={'$like':'%'+_0x2953d0[_0x7b67('0x2e')][_0x7b67('0x3a')]+'%'};return _0x5c54c9;}})});}_0x5e34da=_[_0x7b67('0x3b')]({},_0x5e34da,_0x2953d0['options']);var _0x519a23={'where':_0x5e34da[_0x7b67('0x38')]};return db[_0x7b67('0x3d')][_0x7b67('0x3e')](_0x519a23)[_0x7b67('0x26')](function(_0x250bf1){_0x27456b[_0x7b67('0x3e')]=_0x250bf1;if(_0x2953d0[_0x7b67('0x2e')][_0x7b67('0x3f')]){_0x5e34da[_0x7b67('0x40')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x7b67('0x41')](_0x5e34da);})[_0x7b67('0x26')](function(_0x2eaeff){_0x27456b[_0x7b67('0x42')]=_0x2eaeff;return _0x27456b;})[_0x7b67('0x26')](respondWithFilteredResult(_0x3e42e6,_0x5e34da))['catch'](handleError(_0x3e42e6,null));};exports[_0x7b67('0x43')]=function(_0x22f771,_0x25cb59){var _0x27d2e0={'raw':![],'where':{'id':_0x22f771[_0x7b67('0x44')]['id']}},_0x5beec6={};_0x5beec6[_0x7b67('0x2d')]=_[_0x7b67('0x2f')](db[_0x7b67('0x3d')][_0x7b67('0x45')]);_0x5beec6[_0x7b67('0x2e')]=_['keys'](_0x22f771[_0x7b67('0x2e')]);_0x5beec6['filters']=_['intersection'](_0x5beec6[_0x7b67('0x2d')],_0x5beec6[_0x7b67('0x2e')]);_0x27d2e0[_0x7b67('0x32')]=_[_0x7b67('0x31')](_0x5beec6[_0x7b67('0x2d')],qs[_0x7b67('0x33')](_0x22f771['query'][_0x7b67('0x33')]));_0x27d2e0[_0x7b67('0x32')]=_0x27d2e0[_0x7b67('0x32')][_0x7b67('0x34')]?_0x27d2e0['attributes']:_0x5beec6[_0x7b67('0x2d')];if(_0x22f771[_0x7b67('0x2e')][_0x7b67('0x3f')]){_0x27d2e0['include']=[{'all':!![]}];}_0x27d2e0=_[_0x7b67('0x3b')]({},_0x27d2e0,_0x22f771['options']);return db[_0x7b67('0x3d')][_0x7b67('0x46')](_0x27d2e0)['then'](handleEntityNotFound(_0x25cb59,null))['then'](respondWithResult(_0x25cb59,null))[_0x7b67('0x47')](handleError(_0x25cb59,null));};exports['create']=function(_0x484ce3,_0x35eb76){return db['DeskConfiguration'][_0x7b67('0x48')](_0x484ce3[_0x7b67('0x49')],{})[_0x7b67('0x26')](respondWithResult(_0x35eb76,0xc9))[_0x7b67('0x47')](handleError(_0x35eb76,null));};exports[_0x7b67('0x25')]=function(_0x5b6cf3,_0x44ae7e){if(_0x5b6cf3[_0x7b67('0x49')]['id']){delete _0x5b6cf3['body']['id'];}return db[_0x7b67('0x3d')][_0x7b67('0x46')]({'where':{'id':_0x5b6cf3[_0x7b67('0x44')]['id']}})[_0x7b67('0x26')](handleEntityNotFound(_0x44ae7e,null))['then'](saveUpdates(_0x5b6cf3[_0x7b67('0x49')],null))[_0x7b67('0x26')](respondWithResult(_0x44ae7e,null))[_0x7b67('0x47')](handleError(_0x44ae7e,null));};exports[_0x7b67('0x27')]=function(_0x3e20da,_0x33352b){return db['DeskConfiguration'][_0x7b67('0x46')]({'where':{'id':_0x3e20da[_0x7b67('0x44')]['id']}})[_0x7b67('0x26')](handleEntityNotFound(_0x33352b,null))[_0x7b67('0x26')](removeEntity(_0x33352b,null))['catch'](handleError(_0x33352b,null));};exports[_0x7b67('0x4a')]=function(_0x1df255,_0x38ac63,_0x45a247){var _0x4769d7={};var _0x3c3d76={};var _0x25b293;var _0x3c9821;return db[_0x7b67('0x3d')][_0x7b67('0x4b')]({'where':{'id':_0x1df255[_0x7b67('0x44')]['id']}})[_0x7b67('0x26')](handleEntityNotFound(_0x38ac63,null))[_0x7b67('0x26')](function(_0x296d6e){if(_0x296d6e){_0x25b293=_0x296d6e;_0x3c3d76[_0x7b67('0x2d')]=_[_0x7b67('0x2f')](db[_0x7b67('0x4c')][_0x7b67('0x45')]);_0x3c3d76['query']=_['keys'](_0x1df255[_0x7b67('0x2e')]);_0x3c3d76[_0x7b67('0x30')]=_['intersection'](_0x3c3d76[_0x7b67('0x2d')],_0x3c3d76[_0x7b67('0x2e')]);_0x4769d7[_0x7b67('0x32')]=_['intersection'](_0x3c3d76['model'],qs[_0x7b67('0x33')](_0x1df255[_0x7b67('0x2e')]['fields']));_0x4769d7['attributes']=_0x4769d7[_0x7b67('0x32')][_0x7b67('0x34')]?_0x4769d7[_0x7b67('0x32')]:_0x3c3d76[_0x7b67('0x2d')];_0x4769d7[_0x7b67('0x36')]=qs[_0x7b67('0x37')](_0x1df255[_0x7b67('0x2e')][_0x7b67('0x37')]);_0x4769d7[_0x7b67('0x38')]=qs['filters'](_[_0x7b67('0x39')](_0x1df255[_0x7b67('0x2e')],_0x3c3d76[_0x7b67('0x30')]));if(_0x1df255[_0x7b67('0x2e')]['filter']){_0x4769d7['where']=_[_0x7b67('0x3b')](_0x4769d7['where'],{'$or':_[_0x7b67('0x29')](_0x4769d7[_0x7b67('0x32')],function(_0xf4e518){var _0x4e2984={};_0x4e2984[_0xf4e518]={'$like':'%'+_0x1df255[_0x7b67('0x2e')][_0x7b67('0x3a')]+'%'};return _0x4e2984;})});}_0x4769d7=_['merge']({},_0x4769d7,_0x1df255['options']);return _0x25b293[_0x7b67('0x4a')](_0x4769d7);}})[_0x7b67('0x26')](function(_0x4f005f){if(_0x4f005f){_0x3c9821=_0x4f005f[_0x7b67('0x34')];if(!_0x1df255[_0x7b67('0x2e')][_0x7b67('0x4d')](_0x7b67('0x35'))){_0x4769d7[_0x7b67('0x1f')]=qs[_0x7b67('0x1f')](_0x1df255[_0x7b67('0x2e')][_0x7b67('0x1f')]);_0x4769d7[_0x7b67('0x1d')]=qs['offset'](_0x1df255[_0x7b67('0x2e')][_0x7b67('0x1d')]);}return _0x25b293['getFields'](_0x4769d7);}})[_0x7b67('0x26')](function(_0x624e00){if(_0x624e00){return _0x624e00?{'count':_0x3c9821,'rows':_0x624e00}:null;}})[_0x7b67('0x26')](respondWithResult(_0x38ac63,null))[_0x7b67('0x47')](handleError(_0x38ac63,null));};exports[_0x7b67('0x4e')]=function(_0x176768,_0x5e806f,_0x4de24c){var _0x3b6ca4={};var _0x1e918b={};var _0x207cb6;var _0x3dadca;return db['DeskConfiguration'][_0x7b67('0x4b')]({'where':{'id':_0x176768['params']['id']}})[_0x7b67('0x26')](handleEntityNotFound(_0x5e806f,null))[_0x7b67('0x26')](function(_0x1d32e6){if(_0x1d32e6){_0x207cb6=_0x1d32e6;_0x1e918b['model']=_[_0x7b67('0x2f')](db[_0x7b67('0x4c')]['rawAttributes']);_0x1e918b[_0x7b67('0x2e')]=_[_0x7b67('0x2f')](_0x176768[_0x7b67('0x2e')]);_0x1e918b[_0x7b67('0x30')]=_[_0x7b67('0x31')](_0x1e918b[_0x7b67('0x2d')],_0x1e918b[_0x7b67('0x2e')]);_0x3b6ca4[_0x7b67('0x32')]=_[_0x7b67('0x31')](_0x1e918b[_0x7b67('0x2d')],qs[_0x7b67('0x33')](_0x176768['query'][_0x7b67('0x33')]));_0x3b6ca4[_0x7b67('0x32')]=_0x3b6ca4[_0x7b67('0x32')][_0x7b67('0x34')]?_0x3b6ca4[_0x7b67('0x32')]:_0x1e918b[_0x7b67('0x2d')];_0x3b6ca4[_0x7b67('0x36')]=qs[_0x7b67('0x37')](_0x176768['query'][_0x7b67('0x37')]);_0x3b6ca4[_0x7b67('0x38')]=qs[_0x7b67('0x30')](_['pick'](_0x176768[_0x7b67('0x2e')],_0x1e918b[_0x7b67('0x30')]));if(_0x176768[_0x7b67('0x2e')][_0x7b67('0x3a')]){_0x3b6ca4[_0x7b67('0x38')]=_[_0x7b67('0x3b')](_0x3b6ca4[_0x7b67('0x38')],{'$or':_[_0x7b67('0x29')](_0x3b6ca4[_0x7b67('0x32')],function(_0x57c6e5){var _0x1ead83={};_0x1ead83[_0x57c6e5]={'$like':'%'+_0x176768[_0x7b67('0x2e')][_0x7b67('0x3a')]+'%'};return _0x1ead83;})});}_0x3b6ca4=_[_0x7b67('0x3b')]({},_0x3b6ca4,_0x176768[_0x7b67('0x4f')]);return _0x207cb6[_0x7b67('0x4e')](_0x3b6ca4);}})['then'](function(_0x1c8e4e){if(_0x1c8e4e){_0x3dadca=_0x1c8e4e['length'];if(!_0x176768[_0x7b67('0x2e')][_0x7b67('0x4d')](_0x7b67('0x35'))){_0x3b6ca4[_0x7b67('0x1f')]=qs[_0x7b67('0x1f')](_0x176768[_0x7b67('0x2e')]['limit']);_0x3b6ca4[_0x7b67('0x1d')]=qs[_0x7b67('0x1d')](_0x176768[_0x7b67('0x2e')]['offset']);}return _0x207cb6[_0x7b67('0x4e')](_0x3b6ca4);}})['then'](function(_0x334917){if(_0x334917){return _0x334917?{'count':_0x3dadca,'rows':_0x334917}:null;}})[_0x7b67('0x26')](respondWithResult(_0x5e806f,null))[_0x7b67('0x47')](handleError(_0x5e806f,null));};exports[_0x7b67('0x50')]=function(_0x2e436a,_0x13053c,_0x556b56){var _0x3d0e39={};var _0x565fd6={};var _0x2eaa24;var _0x528175;return db['DeskConfiguration']['findOne']({'where':{'id':_0x2e436a['params']['id']}})[_0x7b67('0x26')](handleEntityNotFound(_0x13053c,null))['then'](function(_0x324aa7){if(_0x324aa7){_0x2eaa24=_0x324aa7;_0x565fd6[_0x7b67('0x2d')]=_['keys'](db[_0x7b67('0x4c')]['rawAttributes']);_0x565fd6[_0x7b67('0x2e')]=_[_0x7b67('0x2f')](_0x2e436a['query']);_0x565fd6[_0x7b67('0x30')]=_[_0x7b67('0x31')](_0x565fd6[_0x7b67('0x2d')],_0x565fd6[_0x7b67('0x2e')]);_0x3d0e39[_0x7b67('0x32')]=_[_0x7b67('0x31')](_0x565fd6['model'],qs[_0x7b67('0x33')](_0x2e436a[_0x7b67('0x2e')]['fields']));_0x3d0e39[_0x7b67('0x32')]=_0x3d0e39[_0x7b67('0x32')][_0x7b67('0x34')]?_0x3d0e39[_0x7b67('0x32')]:_0x565fd6[_0x7b67('0x2d')];_0x3d0e39['order']=qs[_0x7b67('0x37')](_0x2e436a['query'][_0x7b67('0x37')]);_0x3d0e39['where']=qs[_0x7b67('0x30')](_['pick'](_0x2e436a['query'],_0x565fd6[_0x7b67('0x30')]));if(_0x2e436a[_0x7b67('0x2e')][_0x7b67('0x3a')]){_0x3d0e39['where']=_[_0x7b67('0x3b')](_0x3d0e39['where'],{'$or':_[_0x7b67('0x29')](_0x3d0e39[_0x7b67('0x32')],function(_0x3358d0){var _0x47d52a={};_0x47d52a[_0x3358d0]={'$like':'%'+_0x2e436a[_0x7b67('0x2e')][_0x7b67('0x3a')]+'%'};return _0x47d52a;})});}_0x3d0e39=_[_0x7b67('0x3b')]({},_0x3d0e39,_0x2e436a[_0x7b67('0x4f')]);return _0x2eaa24['getDescriptions'](_0x3d0e39);}})[_0x7b67('0x26')](function(_0x1d882a){if(_0x1d882a){_0x528175=_0x1d882a[_0x7b67('0x34')];if(!_0x2e436a[_0x7b67('0x2e')][_0x7b67('0x4d')](_0x7b67('0x35'))){_0x3d0e39[_0x7b67('0x1f')]=qs[_0x7b67('0x1f')](_0x2e436a[_0x7b67('0x2e')][_0x7b67('0x1f')]);_0x3d0e39['offset']=qs[_0x7b67('0x1d')](_0x2e436a[_0x7b67('0x2e')][_0x7b67('0x1d')]);}return _0x2eaa24['getDescriptions'](_0x3d0e39);}})[_0x7b67('0x26')](function(_0x4c1211){if(_0x4c1211){return _0x4c1211?{'count':_0x528175,'rows':_0x4c1211}:null;}})[_0x7b67('0x26')](respondWithResult(_0x13053c,null))[_0x7b67('0x47')](handleError(_0x13053c,null));};exports[_0x7b67('0x51')]=function(_0x13e77a,_0x5e4e2a,_0x1c6542){var _0x33825a={};var _0x40c284={};var _0x1787ac;var _0x48897a;return db[_0x7b67('0x3d')][_0x7b67('0x4b')]({'where':{'id':_0x13e77a[_0x7b67('0x44')]['id']}})[_0x7b67('0x26')](handleEntityNotFound(_0x5e4e2a,null))[_0x7b67('0x26')](function(_0x1f51f1){if(_0x1f51f1){_0x1787ac=_0x1f51f1;_0x40c284[_0x7b67('0x2d')]=_[_0x7b67('0x2f')](db[_0x7b67('0x52')]['rawAttributes']);_0x40c284['query']=_[_0x7b67('0x2f')](_0x13e77a[_0x7b67('0x2e')]);_0x40c284[_0x7b67('0x30')]=_[_0x7b67('0x31')](_0x40c284[_0x7b67('0x2d')],_0x40c284[_0x7b67('0x2e')]);_0x33825a[_0x7b67('0x32')]=_[_0x7b67('0x31')](_0x40c284[_0x7b67('0x2d')],qs[_0x7b67('0x33')](_0x13e77a[_0x7b67('0x2e')][_0x7b67('0x33')]));_0x33825a[_0x7b67('0x32')]=_0x33825a[_0x7b67('0x32')][_0x7b67('0x34')]?_0x33825a['attributes']:_0x40c284[_0x7b67('0x2d')];_0x33825a[_0x7b67('0x36')]=qs['sort'](_0x13e77a[_0x7b67('0x2e')][_0x7b67('0x37')]);_0x33825a['where']=qs['filters'](_['pick'](_0x13e77a['query'],_0x40c284[_0x7b67('0x30')]));if(_0x13e77a['query']['filter']){_0x33825a[_0x7b67('0x38')]=_[_0x7b67('0x3b')](_0x33825a['where'],{'$or':_[_0x7b67('0x29')](_0x33825a[_0x7b67('0x32')],function(_0x193419){var _0x302104={};_0x302104[_0x193419]={'$like':'%'+_0x13e77a[_0x7b67('0x2e')][_0x7b67('0x3a')]+'%'};return _0x302104;})});}_0x33825a=_[_0x7b67('0x3b')]({},_0x33825a,_0x13e77a['options']);return _0x1787ac[_0x7b67('0x51')](_0x33825a);}})['then'](function(_0x33546a){if(_0x33546a){_0x48897a=_0x33546a[_0x7b67('0x34')];if(!_0x13e77a['query'][_0x7b67('0x4d')]('nolimit')){_0x33825a[_0x7b67('0x1f')]=qs[_0x7b67('0x1f')](_0x13e77a[_0x7b67('0x2e')][_0x7b67('0x1f')]);_0x33825a[_0x7b67('0x1d')]=qs[_0x7b67('0x1d')](_0x13e77a[_0x7b67('0x2e')][_0x7b67('0x1d')]);}return _0x1787ac[_0x7b67('0x51')](_0x33825a);}})[_0x7b67('0x26')](function(_0x4e2ab1){if(_0x4e2ab1){return _0x4e2ab1?{'count':_0x48897a,'rows':_0x4e2ab1}:null;}})[_0x7b67('0x26')](respondWithResult(_0x5e4e2a,null))[_0x7b67('0x47')](handleError(_0x5e4e2a,null));};exports[_0x7b67('0x53')]=function(_0x564f91,_0x22bf19,_0x511fee){if(_0x564f91['body']['id']){delete _0x564f91[_0x7b67('0x49')]['id'];}return db[_0x7b67('0x3d')]['findOne']({'where':{'id':_0x564f91['params']['id']}})[_0x7b67('0x26')](handleEntityNotFound(_0x22bf19,null))['then'](function(_0xa9cb5f){if(_0xa9cb5f){return _0xa9cb5f[_0x7b67('0x53')](_0x564f91[_0x7b67('0x49')][_0x7b67('0x54')]||[]);}return null;})['then'](respondWithResult(_0x22bf19,null))[_0x7b67('0x47')](handleError(_0x22bf19,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index d287794..58ed3f8 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 _0x6458=['rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x4baac3,_0x481c9a){var _0x4fb4bc=function(_0x27d865){while(--_0x27d865){_0x4baac3['push'](_0x4baac3['shift']());}};_0x4fb4bc(++_0x481c9a);}(_0x6458,0x124));var _0x8645=function(_0x4a29a9,_0x58cd04){_0x4a29a9=_0x4a29a9-0x0;var _0x386570=_0x6458[_0x4a29a9];return _0x386570;};'use strict';var _=require(_0x8645('0x0'));var util=require('util');var logger=require(_0x8645('0x1'))(_0x8645('0x2'));var moment=require(_0x8645('0x3'));var BPromise=require(_0x8645('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8645('0x5'));var config=require(_0x8645('0x6'));var attributes=require(_0x8645('0x7'));module[_0x8645('0x8')]=function(_0x3c8aab,_0x1232fc){return _0x3c8aab['define'](_0x8645('0x9'),attributes,{'tableName':_0x8645('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf8b=['define','DeskConfiguration','int_desk_configurations','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x594cfc,_0x1fb259){var _0x3df210=function(_0x55de22){while(--_0x55de22){_0x594cfc['push'](_0x594cfc['shift']());}};_0x3df210(++_0x1fb259);}(_0xdf8b,0x6b));var _0xbdf8=function(_0x469eba,_0x39471c){_0x469eba=_0x469eba-0x0;var _0x355f69=_0xdf8b[_0x469eba];return _0x355f69;};'use strict';var _=require('lodash');var util=require(_0xbdf8('0x0'));var logger=require('../../config/logger')(_0xbdf8('0x1'));var moment=require(_0xbdf8('0x2'));var BPromise=require(_0xbdf8('0x3'));var rp=require(_0xbdf8('0x4'));var fs=require('fs');var path=require(_0xbdf8('0x5'));var rimraf=require(_0xbdf8('0x6'));var config=require(_0xbdf8('0x7'));var attributes=require(_0xbdf8('0x8'));module[_0xbdf8('0x9')]=function(_0x25780e,_0x2fea77){return _0x25780e[_0xbdf8('0xa')](_0xbdf8('0xb'),attributes,{'tableName':_0xbdf8('0xc'),'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 5785965..411f9ac 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 _0x1678=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x1678,0x17b));var _0x8167=function(_0x3b61a9,_0x49b0c1){_0x3b61a9=_0x3b61a9-0x0;var _0x3e47bc=_0x1678[_0x3b61a9];return _0x3e47bc;};'use strict';var _=require(_0x8167('0x0'));var util=require(_0x8167('0x1'));var moment=require(_0x8167('0x2'));var BPromise=require(_0x8167('0x3'));var rs=require(_0x8167('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8167('0x5'));var logger=require(_0x8167('0x6'))(_0x8167('0x7'));var config=require(_0x8167('0x8'));var jayson=require(_0x8167('0x9'));var client=jayson[_0x8167('0xa')][_0x8167('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ce075,_0x34768e,_0x267746){return new BPromise(function(_0x1aab13,_0x58b220){return client['request'](_0x4ce075,_0x267746)[_0x8167('0xc')](function(_0x381a87){logger['info'](_0x8167('0xd'),_0x34768e,_0x8167('0xe'));logger[_0x8167('0xf')](_0x8167('0x10'),_0x34768e,_0x8167('0xe'),JSON[_0x8167('0x11')](_0x381a87));if(_0x381a87[_0x8167('0x12')]){if(_0x381a87['error']['code']===0x1f4){logger[_0x8167('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x34768e,_0x381a87[_0x8167('0x12')][_0x8167('0x13')]);return _0x58b220(_0x381a87[_0x8167('0x12')][_0x8167('0x13')]);}logger[_0x8167('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x34768e,_0x381a87[_0x8167('0x12')]['message']);return _0x1aab13(_0x381a87['error']['message']);}else{logger['info'](_0x8167('0xd'),_0x34768e,_0x8167('0xe'));_0x1aab13(_0x381a87[_0x8167('0x14')][_0x8167('0x13')]);}})[_0x8167('0x15')](function(_0x3927ad){logger[_0x8167('0x12')](_0x8167('0xd'),_0x34768e,_0x3927ad);_0x58b220(_0x3927ad);});});} \ No newline at end of file +var _0xa412=['DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info'];(function(_0x510b98,_0x4c4cbb){var _0x45e775=function(_0x29ec11){while(--_0x29ec11){_0x510b98['push'](_0x510b98['shift']());}};_0x45e775(++_0x4c4cbb);}(_0xa412,0x127));var _0x2a41=function(_0x1d4b50,_0x2d07d3){_0x1d4b50=_0x1d4b50-0x0;var _0x1ce436=_0xa412[_0x1d4b50];return _0x1ce436;};'use strict';var _=require(_0x2a41('0x0'));var util=require(_0x2a41('0x1'));var moment=require(_0x2a41('0x2'));var BPromise=require(_0x2a41('0x3'));var rs=require(_0x2a41('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a41('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a41('0x6'))(_0x2a41('0x7'));var config=require('../../config/environment');var jayson=require(_0x2a41('0x8'));var client=jayson[_0x2a41('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fb2a5,_0x3c3620,_0x32af58){return new BPromise(function(_0x4d481f,_0x355027){return client[_0x2a41('0xa')](_0x3fb2a5,_0x32af58)[_0x2a41('0xb')](function(_0x21d1f1){logger[_0x2a41('0xc')](_0x2a41('0xd'),_0x3c3620,_0x2a41('0xe'));logger[_0x2a41('0xf')](_0x2a41('0x10'),_0x3c3620,_0x2a41('0xe'),JSON['stringify'](_0x21d1f1));if(_0x21d1f1[_0x2a41('0x11')]){if(_0x21d1f1[_0x2a41('0x11')][_0x2a41('0x12')]===0x1f4){logger[_0x2a41('0x11')](_0x2a41('0xd'),_0x3c3620,_0x21d1f1['error']['message']);return _0x355027(_0x21d1f1[_0x2a41('0x11')][_0x2a41('0x13')]);}logger[_0x2a41('0x11')](_0x2a41('0xd'),_0x3c3620,_0x21d1f1[_0x2a41('0x11')][_0x2a41('0x13')]);return _0x4d481f(_0x21d1f1[_0x2a41('0x11')]['message']);}else{logger[_0x2a41('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x3c3620,_0x2a41('0xe'));_0x4d481f(_0x21d1f1[_0x2a41('0x14')]['message']);}})[_0x2a41('0x15')](function(_0x147f46){logger['error'](_0x2a41('0xd'),_0x3c3620,_0x147f46);_0x355027(_0x147f46);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3a34e0e..9a4de94 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 _0x8b5c=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x3ea8b8,_0x508efb){var _0x7d213f=function(_0x13c1e1){while(--_0x13c1e1){_0x3ea8b8['push'](_0x3ea8b8['shift']());}};_0x7d213f(++_0x508efb);}(_0x8b5c,0x10d));var _0xc8b5=function(_0x14aca5,_0xc5ae95){_0x14aca5=_0x14aca5-0x0;var _0x1197f2=_0x8b5c[_0x14aca5];return _0x1197f2;};'use strict';var multer=require('multer');var util=require(_0xc8b5('0x0'));var path=require('path');var timeout=require(_0xc8b5('0x1'));var express=require(_0xc8b5('0x2'));var router=express['Router']();var fs_extra=require(_0xc8b5('0x3'));var auth=require(_0xc8b5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc8b5('0x5'));var controller=require('./intDeskField.controller');router[_0xc8b5('0x6')]('/',auth[_0xc8b5('0x7')](),controller[_0xc8b5('0x8')]);router[_0xc8b5('0x6')](_0xc8b5('0x9'),auth[_0xc8b5('0x7')](),controller[_0xc8b5('0xa')]);router[_0xc8b5('0xb')]('/',auth['isAuthenticated'](),controller[_0xc8b5('0xc')]);router[_0xc8b5('0xd')](_0xc8b5('0x9'),auth[_0xc8b5('0x7')](),controller[_0xc8b5('0xe')]);router[_0xc8b5('0xf')](_0xc8b5('0x9'),auth[_0xc8b5('0x7')](),controller[_0xc8b5('0x10')]);module[_0xc8b5('0x11')]=router; \ No newline at end of file +var _0x2895=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2895,0x82));var _0x5289=function(_0x5bb097,_0x246a46){_0x5bb097=_0x5bb097-0x0;var _0x326348=_0x2895[_0x5bb097];return _0x326348;};'use strict';var multer=require(_0x5289('0x0'));var util=require(_0x5289('0x1'));var path=require(_0x5289('0x2'));var timeout=require('connect-timeout');var express=require(_0x5289('0x3'));var router=express[_0x5289('0x4')]();var fs_extra=require(_0x5289('0x5'));var auth=require(_0x5289('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5289('0x7'));var controller=require('./intDeskField.controller');router[_0x5289('0x8')]('/',auth[_0x5289('0x9')](),controller[_0x5289('0xa')]);router[_0x5289('0x8')](_0x5289('0xb'),auth[_0x5289('0x9')](),controller['show']);router[_0x5289('0xc')]('/',auth[_0x5289('0x9')](),controller[_0x5289('0xd')]);router[_0x5289('0xe')](_0x5289('0xb'),auth[_0x5289('0x9')](),controller[_0x5289('0xf')]);router['delete'](_0x5289('0xb'),auth[_0x5289('0x9')](),controller['destroy']);module[_0x5289('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 630c4c0..b3133b0 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 _0xf206=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x541685,_0x5156f3){var _0x39661a=function(_0x884de3){while(--_0x884de3){_0x541685['push'](_0x541685['shift']());}};_0x39661a(++_0x5156f3);}(_0xf206,0x17e));var _0x6f20=function(_0x5f4795,_0x559a11){_0x5f4795=_0x5f4795-0x0;var _0x5b8ef5=_0xf206[_0x5f4795];return _0x5b8ef5;};'use strict';var Sequelize=require(_0x6f20('0x0'));module[_0x6f20('0x1')]={'type':{'type':Sequelize[_0x6f20('0x2')](_0x6f20('0x3'),_0x6f20('0x4'),_0x6f20('0x5'),_0x6f20('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x6f20('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x6f20('0x4'),_0x6f20('0x5'))},'keyContent':{'type':Sequelize[_0x6f20('0x7')]},'idField':{'type':Sequelize[_0x6f20('0x7')]},'nameField':{'type':Sequelize[_0x6f20('0x7')]},'customField':{'type':Sequelize[_0x6f20('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf040=['ENUM','string','variable','keyValue','picklist','STRING','customVariable','BOOLEAN','exports'];(function(_0x58f4d1,_0x370178){var _0x45a984=function(_0x458ad6){while(--_0x458ad6){_0x58f4d1['push'](_0x58f4d1['shift']());}};_0x45a984(++_0x370178);}(_0xf040,0xe9));var _0x0f04=function(_0x12aa66,_0x2d35c1){_0x12aa66=_0x12aa66-0x0;var _0x53dfe9=_0xf040[_0x12aa66];return _0x53dfe9;};'use strict';var Sequelize=require('sequelize');module[_0x0f04('0x0')]={'type':{'type':Sequelize[_0x0f04('0x1')](_0x0f04('0x2'),_0x0f04('0x3'),'customVariable',_0x0f04('0x4'),_0x0f04('0x5')),'defaultValue':_0x0f04('0x2')},'content':{'type':Sequelize[_0x0f04('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0f04('0x1')]('string',_0x0f04('0x3'),_0x0f04('0x7'))},'keyContent':{'type':Sequelize[_0x0f04('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0f04('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0f04('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index cc7d0bb..6d2329c 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 _0x3e24=['catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','then','destroy','error','name','send','index','map','DeskField','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','keys','includeAll','find'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e24,0x167));var _0x43e2=function(_0x1f808f,_0x172b10){_0x1f808f=_0x1f808f-0x0;var _0x282348=_0x3e24[_0x1f808f];return _0x282348;};'use strict';var emlformat=require(_0x43e2('0x0'));var rimraf=require(_0x43e2('0x1'));var zipdir=require(_0x43e2('0x2'));var jsonpatch=require(_0x43e2('0x3'));var rp=require(_0x43e2('0x4'));var moment=require('moment');var BPromise=require(_0x43e2('0x5'));var Mustache=require(_0x43e2('0x6'));var util=require('util');var path=require(_0x43e2('0x7'));var sox=require(_0x43e2('0x8'));var csv=require(_0x43e2('0x9'));var ejs=require(_0x43e2('0xa'));var fs=require('fs');var fs_extra=require(_0x43e2('0xb'));var _=require(_0x43e2('0xc'));var squel=require(_0x43e2('0xd'));var crypto=require('crypto');var jsforce=require(_0x43e2('0xe'));var deskjs=require(_0x43e2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x43e2('0x10'));var Papa=require(_0x43e2('0x11'));var Redis=require('ioredis');var authService=require(_0x43e2('0x12'));var qs=require(_0x43e2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43e2('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x43e2('0x15'));var licenseUtil=require(_0x43e2('0x16'));var db=require(_0x43e2('0x17'))['db'];function respondWithStatusCode(_0x44781a,_0x43ba14){_0x43ba14=_0x43ba14||0xcc;return function(_0x68e82d){if(_0x68e82d){return _0x44781a[_0x43e2('0x18')](_0x43ba14);}return _0x44781a[_0x43e2('0x19')](_0x43ba14)[_0x43e2('0x1a')]();};}function respondWithResult(_0x218ae7,_0x377097){_0x377097=_0x377097||0xc8;return function(_0x3ccccd){if(_0x3ccccd){return _0x218ae7['status'](_0x377097)[_0x43e2('0x1b')](_0x3ccccd);}};}function respondWithFilteredResult(_0x40fb7b,_0xb929b5){return function(_0x2a0fb0){if(_0x2a0fb0){var _0x5cea01=typeof _0xb929b5['offset']===_0x43e2('0x1c')&&typeof _0xb929b5[_0x43e2('0x1d')]===_0x43e2('0x1c');var _0x3a27eb=_0x2a0fb0[_0x43e2('0x1e')];var _0x1b7cde=_0x5cea01?0x0:_0xb929b5[_0x43e2('0x1f')];var _0x15ecb5=_0x5cea01?_0x2a0fb0[_0x43e2('0x1e')]:_0xb929b5[_0x43e2('0x1f')]+_0xb929b5['limit'];var _0x3ee34c;if(_0x15ecb5>=_0x3a27eb){_0x15ecb5=_0x3a27eb;_0x3ee34c=0xc8;}else{_0x3ee34c=0xce;}_0x40fb7b[_0x43e2('0x19')](_0x3ee34c);return _0x40fb7b['set'](_0x43e2('0x20'),_0x1b7cde+'-'+_0x15ecb5+'/'+_0x3a27eb)['json'](_0x2a0fb0);}return null;};}function patchUpdates(_0x3bc2ce){return function(_0x13610f){try{jsonpatch[_0x43e2('0x21')](_0x13610f,_0x3bc2ce,!![]);}catch(_0x23825c){return BPromise[_0x43e2('0x22')](_0x23825c);}return _0x13610f['save']();};}function saveUpdates(_0x3b0357,_0x12d842){return function(_0x272934){if(_0x272934){return _0x272934['update'](_0x3b0357)[_0x43e2('0x23')](function(_0x32f048){return _0x32f048;});}return null;};}function removeEntity(_0x43078f,_0x11b285){return function(_0x4f20e6){if(_0x4f20e6){return _0x4f20e6[_0x43e2('0x24')]()[_0x43e2('0x23')](function(){_0x43078f[_0x43e2('0x19')](0xcc)[_0x43e2('0x1a')]();});}};}function handleEntityNotFound(_0x178223,_0x2a593e){return function(_0x3ca16b){if(!_0x3ca16b){_0x178223[_0x43e2('0x18')](0x194);}return _0x3ca16b;};}function handleError(_0xd29b7b,_0x1ec68e){_0x1ec68e=_0x1ec68e||0x1f4;return function(_0x1ea844){logger[_0x43e2('0x25')](_0x1ea844['stack']);if(_0x1ea844[_0x43e2('0x26')]){delete _0x1ea844[_0x43e2('0x26')];}_0xd29b7b['status'](_0x1ec68e)[_0x43e2('0x27')](_0x1ea844);};}exports[_0x43e2('0x28')]=function(_0x2dffa2,_0x404483){var _0x3fd232={},_0x5a896b={},_0x42f495={'count':0x0,'rows':[]};var _0xd1b43a=_[_0x43e2('0x29')](db[_0x43e2('0x2a')][_0x43e2('0x2b')],function(_0x30bdcb){return{'name':_0x30bdcb['fieldName'],'type':_0x30bdcb['type'][_0x43e2('0x2c')]};});_0x5a896b[_0x43e2('0x2d')]=_[_0x43e2('0x29')](_0xd1b43a,_0x43e2('0x26'));_0x5a896b[_0x43e2('0x2e')]=_['keys'](_0x2dffa2[_0x43e2('0x2e')]);_0x5a896b[_0x43e2('0x2f')]=_[_0x43e2('0x30')](_0x5a896b[_0x43e2('0x2d')],_0x5a896b[_0x43e2('0x2e')]);_0x3fd232[_0x43e2('0x31')]=_[_0x43e2('0x30')](_0x5a896b['model'],qs['fields'](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x32')]));_0x3fd232['attributes']=_0x3fd232[_0x43e2('0x31')][_0x43e2('0x33')]?_0x3fd232['attributes']:_0x5a896b[_0x43e2('0x2d')];if(!_0x2dffa2['query']['hasOwnProperty']('nolimit')){_0x3fd232[_0x43e2('0x1d')]=qs['limit'](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x1d')]);_0x3fd232[_0x43e2('0x1f')]=qs[_0x43e2('0x1f')](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x1f')]);}_0x3fd232[_0x43e2('0x34')]=qs[_0x43e2('0x35')](_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x35')]);_0x3fd232[_0x43e2('0x36')]=qs[_0x43e2('0x2f')](_[_0x43e2('0x37')](_0x2dffa2[_0x43e2('0x2e')],_0x5a896b[_0x43e2('0x2f')]),_0xd1b43a);if(_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x38')]){_0x3fd232['where']=_['merge'](_0x3fd232['where'],{'$or':_[_0x43e2('0x29')](_0xd1b43a,function(_0x13af7f){if(_0x13af7f['type']!=='VIRTUAL'){var _0x2b5fce={};_0x2b5fce[_0x13af7f[_0x43e2('0x26')]]={'$like':'%'+_0x2dffa2[_0x43e2('0x2e')][_0x43e2('0x38')]+'%'};return _0x2b5fce;}})});}_0x3fd232=_[_0x43e2('0x39')]({},_0x3fd232,_0x2dffa2[_0x43e2('0x3a')]);var _0x2afcdd={'where':_0x3fd232[_0x43e2('0x36')]};return db[_0x43e2('0x2a')][_0x43e2('0x1e')](_0x2afcdd)[_0x43e2('0x23')](function(_0x257de9){_0x42f495[_0x43e2('0x1e')]=_0x257de9;if(_0x2dffa2[_0x43e2('0x2e')]['includeAll']){_0x3fd232[_0x43e2('0x3b')]=[{'all':!![]}];}return db['DeskField'][_0x43e2('0x3c')](_0x3fd232);})['then'](function(_0x19ce1b){_0x42f495[_0x43e2('0x3d')]=_0x19ce1b;return _0x42f495;})[_0x43e2('0x23')](respondWithFilteredResult(_0x404483,_0x3fd232))['catch'](handleError(_0x404483,null));};exports[_0x43e2('0x3e')]=function(_0x5ca5d0,_0x1ba4cf){var _0x36f94a={'raw':!![],'where':{'id':_0x5ca5d0[_0x43e2('0x3f')]['id']}},_0x34f2b5={};_0x34f2b5['model']=_['keys'](db[_0x43e2('0x2a')][_0x43e2('0x2b')]);_0x34f2b5[_0x43e2('0x2e')]=_[_0x43e2('0x40')](_0x5ca5d0['query']);_0x34f2b5[_0x43e2('0x2f')]=_[_0x43e2('0x30')](_0x34f2b5[_0x43e2('0x2d')],_0x34f2b5[_0x43e2('0x2e')]);_0x36f94a[_0x43e2('0x31')]=_['intersection'](_0x34f2b5[_0x43e2('0x2d')],qs['fields'](_0x5ca5d0[_0x43e2('0x2e')][_0x43e2('0x32')]));_0x36f94a['attributes']=_0x36f94a[_0x43e2('0x31')]['length']?_0x36f94a['attributes']:_0x34f2b5[_0x43e2('0x2d')];if(_0x5ca5d0[_0x43e2('0x2e')][_0x43e2('0x41')]){_0x36f94a[_0x43e2('0x3b')]=[{'all':!![]}];}_0x36f94a=_[_0x43e2('0x39')]({},_0x36f94a,_0x5ca5d0['options']);return db[_0x43e2('0x2a')][_0x43e2('0x42')](_0x36f94a)[_0x43e2('0x23')](handleEntityNotFound(_0x1ba4cf,null))[_0x43e2('0x23')](respondWithResult(_0x1ba4cf,null))[_0x43e2('0x43')](handleError(_0x1ba4cf,null));};exports[_0x43e2('0x44')]=function(_0x29a9ef,_0x2462db){return db['DeskField'][_0x43e2('0x44')](_0x29a9ef[_0x43e2('0x45')],{})['then'](respondWithResult(_0x2462db,0xc9))[_0x43e2('0x43')](handleError(_0x2462db,null));};exports[_0x43e2('0x46')]=function(_0x466f65,_0x8bc721){if(_0x466f65['body']['id']){delete _0x466f65[_0x43e2('0x45')]['id'];}return db[_0x43e2('0x2a')][_0x43e2('0x42')]({'where':{'id':_0x466f65[_0x43e2('0x3f')]['id']}})[_0x43e2('0x23')](handleEntityNotFound(_0x8bc721,null))['then'](saveUpdates(_0x466f65['body'],null))[_0x43e2('0x23')](respondWithResult(_0x8bc721,null))[_0x43e2('0x43')](handleError(_0x8bc721,null));};exports['destroy']=function(_0x2a40a5,_0x28a101){return db[_0x43e2('0x2a')]['find']({'where':{'id':_0x2a40a5['params']['id']}})[_0x43e2('0x23')](handleEntityNotFound(_0x28a101,null))[_0x43e2('0x23')](removeEntity(_0x28a101,null))[_0x43e2('0x43')](handleError(_0x28a101,null));}; \ No newline at end of file +var _0xba64=['set','Content-Range','json','reject','save','update','destroy','then','end','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count'];(function(_0x286354,_0x128be5){var _0x30fe4d=function(_0x18ae00){while(--_0x18ae00){_0x286354['push'](_0x286354['shift']());}};_0x30fe4d(++_0x128be5);}(_0xba64,0x1ef));var _0x4ba6=function(_0x4554bb,_0x18f0d6){_0x4554bb=_0x4554bb-0x0;var _0xad0c95=_0xba64[_0x4554bb];return _0xad0c95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ba6('0x0'));var zipdir=require(_0x4ba6('0x1'));var jsonpatch=require(_0x4ba6('0x2'));var rp=require(_0x4ba6('0x3'));var moment=require('moment');var BPromise=require(_0x4ba6('0x4'));var Mustache=require(_0x4ba6('0x5'));var util=require('util');var path=require(_0x4ba6('0x6'));var sox=require(_0x4ba6('0x7'));var csv=require(_0x4ba6('0x8'));var ejs=require(_0x4ba6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4ba6('0xa'));var crypto=require(_0x4ba6('0xb'));var jsforce=require(_0x4ba6('0xc'));var deskjs=require(_0x4ba6('0xd'));var toCsv=require(_0x4ba6('0x8'));var querystring=require(_0x4ba6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4ba6('0xf'));var qs=require(_0x4ba6('0x10'));var as=require(_0x4ba6('0x11'));var hardwareService=require(_0x4ba6('0x12'));var logger=require(_0x4ba6('0x13'))(_0x4ba6('0x14'));var utils=require(_0x4ba6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba6('0x16'));var db=require(_0x4ba6('0x17'))['db'];function respondWithStatusCode(_0x303ff0,_0x1fc891){_0x1fc891=_0x1fc891||0xcc;return function(_0x2a2cf6){if(_0x2a2cf6){return _0x303ff0[_0x4ba6('0x18')](_0x1fc891);}return _0x303ff0[_0x4ba6('0x19')](_0x1fc891)['end']();};}function respondWithResult(_0xaa8888,_0x1d118d){_0x1d118d=_0x1d118d||0xc8;return function(_0x136027){if(_0x136027){return _0xaa8888[_0x4ba6('0x19')](_0x1d118d)['json'](_0x136027);}};}function respondWithFilteredResult(_0x26c50d,_0x3bbe47){return function(_0x546b91){if(_0x546b91){var _0x542571=typeof _0x3bbe47[_0x4ba6('0x1a')]===_0x4ba6('0x1b')&&typeof _0x3bbe47[_0x4ba6('0x1c')]===_0x4ba6('0x1b');var _0x446028=_0x546b91['count'];var _0xc16001=_0x542571?0x0:_0x3bbe47['offset'];var _0x1d64b3=_0x542571?_0x546b91[_0x4ba6('0x1d')]:_0x3bbe47[_0x4ba6('0x1a')]+_0x3bbe47[_0x4ba6('0x1c')];var _0x121a3e;if(_0x1d64b3>=_0x446028){_0x1d64b3=_0x446028;_0x121a3e=0xc8;}else{_0x121a3e=0xce;}_0x26c50d['status'](_0x121a3e);return _0x26c50d[_0x4ba6('0x1e')](_0x4ba6('0x1f'),_0xc16001+'-'+_0x1d64b3+'/'+_0x446028)[_0x4ba6('0x20')](_0x546b91);}return null;};}function patchUpdates(_0x35f1ab){return function(_0x2febf9){try{jsonpatch['apply'](_0x2febf9,_0x35f1ab,!![]);}catch(_0x1d716d){return BPromise[_0x4ba6('0x21')](_0x1d716d);}return _0x2febf9[_0x4ba6('0x22')]();};}function saveUpdates(_0x3cbbca,_0x2a3a8f){return function(_0x19da88){if(_0x19da88){return _0x19da88[_0x4ba6('0x23')](_0x3cbbca)['then'](function(_0x477a92){return _0x477a92;});}return null;};}function removeEntity(_0x2c26cf,_0xc32955){return function(_0x38c341){if(_0x38c341){return _0x38c341[_0x4ba6('0x24')]()[_0x4ba6('0x25')](function(){_0x2c26cf[_0x4ba6('0x19')](0xcc)[_0x4ba6('0x26')]();});}};}function handleEntityNotFound(_0x247e9d,_0x6b8d22){return function(_0x562eab){if(!_0x562eab){_0x247e9d[_0x4ba6('0x18')](0x194);}return _0x562eab;};}function handleError(_0xa20158,_0x596ae5){_0x596ae5=_0x596ae5||0x1f4;return function(_0x163439){logger['error'](_0x163439[_0x4ba6('0x27')]);if(_0x163439[_0x4ba6('0x28')]){delete _0x163439[_0x4ba6('0x28')];}_0xa20158['status'](_0x596ae5)[_0x4ba6('0x29')](_0x163439);};}exports['index']=function(_0x502021,_0x2a295b){var _0x471217={},_0x57a26e={},_0x4b1f67={'count':0x0,'rows':[]};var _0x4e195b=_[_0x4ba6('0x2a')](db[_0x4ba6('0x2b')][_0x4ba6('0x2c')],function(_0xd9ce6e){return{'name':_0xd9ce6e[_0x4ba6('0x2d')],'type':_0xd9ce6e[_0x4ba6('0x2e')][_0x4ba6('0x2f')]};});_0x57a26e[_0x4ba6('0x30')]=_[_0x4ba6('0x2a')](_0x4e195b,_0x4ba6('0x28'));_0x57a26e[_0x4ba6('0x31')]=_[_0x4ba6('0x32')](_0x502021[_0x4ba6('0x31')]);_0x57a26e['filters']=_[_0x4ba6('0x33')](_0x57a26e['model'],_0x57a26e[_0x4ba6('0x31')]);_0x471217[_0x4ba6('0x34')]=_['intersection'](_0x57a26e[_0x4ba6('0x30')],qs['fields'](_0x502021[_0x4ba6('0x31')][_0x4ba6('0x35')]));_0x471217[_0x4ba6('0x34')]=_0x471217[_0x4ba6('0x34')][_0x4ba6('0x36')]?_0x471217['attributes']:_0x57a26e[_0x4ba6('0x30')];if(!_0x502021[_0x4ba6('0x31')][_0x4ba6('0x37')](_0x4ba6('0x38'))){_0x471217[_0x4ba6('0x1c')]=qs[_0x4ba6('0x1c')](_0x502021[_0x4ba6('0x31')][_0x4ba6('0x1c')]);_0x471217[_0x4ba6('0x1a')]=qs['offset'](_0x502021[_0x4ba6('0x31')][_0x4ba6('0x1a')]);}_0x471217[_0x4ba6('0x39')]=qs[_0x4ba6('0x3a')](_0x502021['query']['sort']);_0x471217[_0x4ba6('0x3b')]=qs[_0x4ba6('0x3c')](_['pick'](_0x502021['query'],_0x57a26e['filters']),_0x4e195b);if(_0x502021[_0x4ba6('0x31')][_0x4ba6('0x3d')]){_0x471217['where']=_['merge'](_0x471217[_0x4ba6('0x3b')],{'$or':_[_0x4ba6('0x2a')](_0x4e195b,function(_0x1b6a2c){if(_0x1b6a2c[_0x4ba6('0x2e')]!==_0x4ba6('0x3e')){var _0x4a2b45={};_0x4a2b45[_0x1b6a2c[_0x4ba6('0x28')]]={'$like':'%'+_0x502021[_0x4ba6('0x31')][_0x4ba6('0x3d')]+'%'};return _0x4a2b45;}})});}_0x471217=_[_0x4ba6('0x3f')]({},_0x471217,_0x502021[_0x4ba6('0x40')]);var _0x143ba3={'where':_0x471217['where']};return db[_0x4ba6('0x2b')]['count'](_0x143ba3)[_0x4ba6('0x25')](function(_0xd7eeb6){_0x4b1f67[_0x4ba6('0x1d')]=_0xd7eeb6;if(_0x502021[_0x4ba6('0x31')][_0x4ba6('0x41')]){_0x471217[_0x4ba6('0x42')]=[{'all':!![]}];}return db[_0x4ba6('0x2b')][_0x4ba6('0x43')](_0x471217);})[_0x4ba6('0x25')](function(_0x1d76d2){_0x4b1f67[_0x4ba6('0x44')]=_0x1d76d2;return _0x4b1f67;})[_0x4ba6('0x25')](respondWithFilteredResult(_0x2a295b,_0x471217))[_0x4ba6('0x45')](handleError(_0x2a295b,null));};exports[_0x4ba6('0x46')]=function(_0x32e903,_0x5c7aba){var _0x2b02ec={'raw':!![],'where':{'id':_0x32e903[_0x4ba6('0x47')]['id']}},_0x4e6bcf={};_0x4e6bcf['model']=_[_0x4ba6('0x32')](db[_0x4ba6('0x2b')]['rawAttributes']);_0x4e6bcf[_0x4ba6('0x31')]=_[_0x4ba6('0x32')](_0x32e903[_0x4ba6('0x31')]);_0x4e6bcf[_0x4ba6('0x3c')]=_[_0x4ba6('0x33')](_0x4e6bcf[_0x4ba6('0x30')],_0x4e6bcf['query']);_0x2b02ec[_0x4ba6('0x34')]=_[_0x4ba6('0x33')](_0x4e6bcf[_0x4ba6('0x30')],qs[_0x4ba6('0x35')](_0x32e903[_0x4ba6('0x31')][_0x4ba6('0x35')]));_0x2b02ec['attributes']=_0x2b02ec[_0x4ba6('0x34')][_0x4ba6('0x36')]?_0x2b02ec[_0x4ba6('0x34')]:_0x4e6bcf['model'];if(_0x32e903[_0x4ba6('0x31')][_0x4ba6('0x41')]){_0x2b02ec[_0x4ba6('0x42')]=[{'all':!![]}];}_0x2b02ec=_[_0x4ba6('0x3f')]({},_0x2b02ec,_0x32e903[_0x4ba6('0x40')]);return db[_0x4ba6('0x2b')][_0x4ba6('0x48')](_0x2b02ec)['then'](handleEntityNotFound(_0x5c7aba,null))['then'](respondWithResult(_0x5c7aba,null))[_0x4ba6('0x45')](handleError(_0x5c7aba,null));};exports[_0x4ba6('0x49')]=function(_0x1cff0a,_0x519fae){return db[_0x4ba6('0x2b')][_0x4ba6('0x49')](_0x1cff0a[_0x4ba6('0x4a')],{})['then'](respondWithResult(_0x519fae,0xc9))['catch'](handleError(_0x519fae,null));};exports['update']=function(_0x2e9390,_0x2eec3a){if(_0x2e9390['body']['id']){delete _0x2e9390[_0x4ba6('0x4a')]['id'];}return db['DeskField'][_0x4ba6('0x48')]({'where':{'id':_0x2e9390[_0x4ba6('0x47')]['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x2eec3a,null))[_0x4ba6('0x25')](saveUpdates(_0x2e9390[_0x4ba6('0x4a')],null))[_0x4ba6('0x25')](respondWithResult(_0x2eec3a,null))[_0x4ba6('0x45')](handleError(_0x2eec3a,null));};exports[_0x4ba6('0x24')]=function(_0x53c608,_0x5559e5){return db['DeskField'][_0x4ba6('0x48')]({'where':{'id':_0x53c608[_0x4ba6('0x47')]['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x5559e5,null))['then'](removeEntity(_0x5559e5,null))[_0x4ba6('0x45')](handleError(_0x5559e5,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index ac763b7..4a4f6ba 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 _0x9050=['desk_unique_index','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields'];(function(_0x44cff8,_0x5e09b7){var _0x57d185=function(_0x26c243){while(--_0x26c243){_0x44cff8['push'](_0x44cff8['shift']());}};_0x57d185(++_0x5e09b7);}(_0x9050,0x127));var _0x0905=function(_0x112465,_0x288746){_0x112465=_0x112465-0x0;var _0xa9385=_0x9050[_0x112465];return _0xa9385;};'use strict';var _=require(_0x0905('0x0'));var util=require(_0x0905('0x1'));var logger=require(_0x0905('0x2'))(_0x0905('0x3'));var moment=require(_0x0905('0x4'));var BPromise=require(_0x0905('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0905('0x6'));var rimraf=require(_0x0905('0x7'));var config=require(_0x0905('0x8'));var attributes=require('./intDeskField.attributes');module[_0x0905('0x9')]=function(_0xb5d78d,_0x5bc953){return _0xb5d78d[_0x0905('0xa')](_0x0905('0xb'),attributes,{'tableName':_0x0905('0xc'),'paranoid':![],'indexes':[{'name':_0x0905('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5377=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','api'];(function(_0x8275bb,_0x457647){var _0x4bec94=function(_0x389af1){while(--_0x389af1){_0x8275bb['push'](_0x8275bb['shift']());}};_0x4bec94(++_0x457647);}(_0x5377,0x15d));var _0x7537=function(_0x2fd38e,_0x2c678a){_0x2fd38e=_0x2fd38e-0x0;var _0x1e7455=_0x5377[_0x2fd38e];return _0x1e7455;};'use strict';var _=require(_0x7537('0x0'));var util=require(_0x7537('0x1'));var logger=require('../../config/logger')(_0x7537('0x2'));var moment=require(_0x7537('0x3'));var BPromise=require(_0x7537('0x4'));var rp=require(_0x7537('0x5'));var fs=require('fs');var path=require(_0x7537('0x6'));var rimraf=require(_0x7537('0x7'));var config=require(_0x7537('0x8'));var attributes=require('./intDeskField.attributes');module[_0x7537('0x9')]=function(_0x369246,_0xbc7683){return _0x369246[_0x7537('0xa')](_0x7537('0xb'),attributes,{'tableName':_0x7537('0xc'),'paranoid':![],'indexes':[{'name':_0x7537('0xd'),'fields':[_0x7537('0xe'),_0x7537('0xf')],'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 bffe276..3b24673 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 _0xefba=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','lodash'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0xefba,0x11f));var _0xaefb=function(_0x58d98a,_0x3040c3){_0x58d98a=_0x58d98a-0x0;var _0x4274ba=_0xefba[_0x58d98a];return _0x4274ba;};'use strict';var _=require(_0xaefb('0x0'));var util=require(_0xaefb('0x1'));var moment=require(_0xaefb('0x2'));var BPromise=require(_0xaefb('0x3'));var rs=require(_0xaefb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaefb('0x5'))['db'];var utils=require(_0xaefb('0x6'));var logger=require('../../config/logger')(_0xaefb('0x7'));var config=require(_0xaefb('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xaefb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x198674,_0x69dd88,_0x29d182){return new BPromise(function(_0x509d28,_0x294bf9){return client['request'](_0x198674,_0x29d182)[_0xaefb('0xa')](function(_0x3a389d){logger[_0xaefb('0xb')](_0xaefb('0xc'),_0x69dd88,'request\x20sent');logger['debug'](_0xaefb('0xd'),_0x69dd88,_0xaefb('0xe'),JSON[_0xaefb('0xf')](_0x3a389d));if(_0x3a389d[_0xaefb('0x10')]){if(_0x3a389d[_0xaefb('0x10')]['code']===0x1f4){logger[_0xaefb('0x10')](_0xaefb('0xc'),_0x69dd88,_0x3a389d['error']['message']);return _0x294bf9(_0x3a389d[_0xaefb('0x10')][_0xaefb('0x11')]);}logger[_0xaefb('0x10')](_0xaefb('0xc'),_0x69dd88,_0x3a389d['error'][_0xaefb('0x11')]);return _0x509d28(_0x3a389d[_0xaefb('0x10')][_0xaefb('0x11')]);}else{logger[_0xaefb('0xb')](_0xaefb('0xc'),_0x69dd88,_0xaefb('0xe'));_0x509d28(_0x3a389d['result'][_0xaefb('0x11')]);}})['catch'](function(_0x27e457){logger[_0xaefb('0x10')](_0xaefb('0xc'),_0x69dd88,_0x27e457);_0x294bf9(_0x27e457);});});} \ No newline at end of file +var _0x535c=['DeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x535c,0x198));var _0xc535=function(_0x25da9f,_0x47d72c){_0x25da9f=_0x25da9f-0x0;var _0x447588=_0x535c[_0x25da9f];return _0x447588;};'use strict';var _=require(_0xc535('0x0'));var util=require(_0xc535('0x1'));var moment=require(_0xc535('0x2'));var BPromise=require(_0xc535('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc535('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc535('0x5'));var config=require('../../config/environment');var jayson=require(_0xc535('0x6'));var client=jayson[_0xc535('0x7')][_0xc535('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x502add,_0x3ff7fd,_0x45a0a3){return new BPromise(function(_0x319469,_0xbdb3ec){return client[_0xc535('0x9')](_0x502add,_0x45a0a3)[_0xc535('0xa')](function(_0x11f321){logger[_0xc535('0xb')](_0xc535('0xc'),_0x3ff7fd,'request\x20sent');logger['debug']('DeskField,\x20%s,\x20%s,\x20%s',_0x3ff7fd,_0xc535('0xd'),JSON[_0xc535('0xe')](_0x11f321));if(_0x11f321[_0xc535('0xf')]){if(_0x11f321[_0xc535('0xf')][_0xc535('0x10')]===0x1f4){logger[_0xc535('0xf')](_0xc535('0xc'),_0x3ff7fd,_0x11f321[_0xc535('0xf')][_0xc535('0x11')]);return _0xbdb3ec(_0x11f321[_0xc535('0xf')][_0xc535('0x11')]);}logger[_0xc535('0xf')](_0xc535('0xc'),_0x3ff7fd,_0x11f321[_0xc535('0xf')][_0xc535('0x11')]);return _0x319469(_0x11f321[_0xc535('0xf')][_0xc535('0x11')]);}else{logger['info'](_0xc535('0xc'),_0x3ff7fd,'request\x20sent');_0x319469(_0x11f321[_0xc535('0x12')][_0xc535('0x11')]);}})[_0xc535('0x13')](function(_0x49d867){logger[_0xc535('0xf')](_0xc535('0xc'),_0x3ff7fd,_0x49d867);_0xbdb3ec(_0x49d867);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index d62cc37..f1a17bf 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 _0x6448=['get','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6448,0x6f));var _0x8644=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6448[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8644('0x0'));var util=require(_0x8644('0x1'));var path=require(_0x8644('0x2'));var timeout=require(_0x8644('0x3'));var express=require(_0x8644('0x4'));var router=express[_0x8644('0x5')]();var fs_extra=require(_0x8644('0x6'));var auth=require(_0x8644('0x7'));var interaction=require(_0x8644('0x8'));var config=require(_0x8644('0x9'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x8644('0xa')]);router['get'](_0x8644('0xb'),auth[_0x8644('0xc')](),controller[_0x8644('0xd')]);router[_0x8644('0xe')](_0x8644('0xf'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x8644('0xe')]('/:id/fields',auth[_0x8644('0xc')](),controller[_0x8644('0x10')]);router[_0x8644('0x11')]('/',auth['isAuthenticated'](),controller[_0x8644('0x12')]);router[_0x8644('0x11')](_0x8644('0xf'),auth[_0x8644('0xc')](),controller[_0x8644('0x13')]);router[_0x8644('0x14')]('/:id',auth[_0x8644('0xc')](),controller[_0x8644('0x15')]);router[_0x8644('0x16')](_0x8644('0xb'),auth[_0x8644('0xc')](),controller[_0x8644('0x17')]);module[_0x8644('0x18')]=router; \ No newline at end of file +var _0x7e6c=['/:id/fields','getFields','create','post','/:id/configurations','/:id','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','getConfigurations'];(function(_0x2a6da8,_0x46c243){var _0x46383f=function(_0xce10fe){while(--_0xce10fe){_0x2a6da8['push'](_0x2a6da8['shift']());}};_0x46383f(++_0x46c243);}(_0x7e6c,0xef));var _0xc7e6=function(_0x510b08,_0x16cd04){_0x510b08=_0x510b08-0x0;var _0xbf9488=_0x7e6c[_0x510b08];return _0xbf9488;};'use strict';var multer=require(_0xc7e6('0x0'));var util=require(_0xc7e6('0x1'));var path=require(_0xc7e6('0x2'));var timeout=require(_0xc7e6('0x3'));var express=require('express');var router=express[_0xc7e6('0x4')]();var fs_extra=require(_0xc7e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc7e6('0x6'));var config=require(_0xc7e6('0x7'));var controller=require(_0xc7e6('0x8'));router[_0xc7e6('0x9')]('/',auth[_0xc7e6('0xa')](),controller[_0xc7e6('0xb')]);router[_0xc7e6('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xc7e6('0x9')]('/:id/configurations',auth[_0xc7e6('0xa')](),controller[_0xc7e6('0xc')]);router[_0xc7e6('0x9')](_0xc7e6('0xd'),auth[_0xc7e6('0xa')](),controller[_0xc7e6('0xe')]);router['post']('/',auth[_0xc7e6('0xa')](),controller[_0xc7e6('0xf')]);router[_0xc7e6('0x10')](_0xc7e6('0x11'),auth[_0xc7e6('0xa')](),controller['addConfiguration']);router['put'](_0xc7e6('0x12'),auth[_0xc7e6('0xa')](),controller['update']);router[_0xc7e6('0x13')](_0xc7e6('0x12'),auth[_0xc7e6('0xa')](),controller['destroy']);module[_0xc7e6('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index f8e083e..e426e8c 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 _0x205d=['STRING','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x205d,0x1f1));var _0xd205=function(_0x48ada8,_0x578d35){_0x48ada8=_0x48ada8-0x0;var _0x178ad1=_0x205d[_0x48ada8];return _0x178ad1;};'use strict';var Sequelize=require('sequelize');module[_0xd205('0x0')]={'name':{'type':Sequelize[_0xd205('0x1')]},'username':{'type':Sequelize[_0xd205('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd205('0x1')]},'tenantId':{'type':Sequelize[_0xd205('0x1')]},'clientId':{'type':Sequelize[_0xd205('0x1')]},'clientSecret':{'type':Sequelize[_0xd205('0x1')]},'serverUrl':{'type':Sequelize[_0xd205('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd205('0x1')]}}; \ No newline at end of file +var _0x3c82=['STRING'];(function(_0x2fcd62,_0x57bf42){var _0x2580f5=function(_0x50143b){while(--_0x50143b){_0x2fcd62['push'](_0x2fcd62['shift']());}};_0x2580f5(++_0x57bf42);}(_0x3c82,0x1f3));var _0x23c8=function(_0x505e62,_0x699aaf){_0x505e62=_0x505e62-0x0;var _0x19b2a5=_0x3c82[_0x505e62];return _0x19b2a5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x23c8('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x23c8('0x0')]},'clientId':{'type':Sequelize[_0x23c8('0x0')]},'clientSecret':{'type':Sequelize[_0x23c8('0x0')]},'serverUrl':{'type':Sequelize[_0x23c8('0x0')],'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 9e921c3..0109a74 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 _0x16e4=['fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','intersection','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','length','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','remoteUri','tenantId','clientId','slice','substring','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','GET','EntityDefinitions(','Bearer\x20','Attributes','includes','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','concat','statusCode','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','OptionSet','UserLocalizedLabel','Label','Value','DisplayName','TrueOption','FalseOption',')/Microsoft.Dynamics.CRM.','LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes'];(function(_0x267814,_0x587459){var _0x1f8d18=function(_0x447137){while(--_0x447137){_0x267814['push'](_0x267814['shift']());}};_0x1f8d18(++_0x587459);}(_0x16e4,0x97));var _0x416e=function(_0x139941,_0x28d392){_0x139941=_0x139941-0x0;var _0x154723=_0x16e4[_0x139941];return _0x154723;};'use strict';var emlformat=require(_0x416e('0x0'));var rimraf=require(_0x416e('0x1'));var zipdir=require(_0x416e('0x2'));var jsonpatch=require(_0x416e('0x3'));var rp=require(_0x416e('0x4'));var moment=require(_0x416e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x416e('0x6'));var util=require('util');var path=require(_0x416e('0x7'));var sox=require(_0x416e('0x8'));var csv=require('to-csv');var ejs=require(_0x416e('0x9'));var fs=require('fs');var fs_extra=require(_0x416e('0xa'));var _=require(_0x416e('0xb'));var squel=require(_0x416e('0xc'));var crypto=require(_0x416e('0xd'));var jsforce=require(_0x416e('0xe'));var deskjs=require(_0x416e('0xf'));var toCsv=require(_0x416e('0x10'));var querystring=require(_0x416e('0x11'));var Papa=require('papaparse');var Redis=require(_0x416e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x416e('0x13'));var as=require(_0x416e('0x14'));var hardwareService=require(_0x416e('0x15'));var logger=require('../../config/logger')(_0x416e('0x16'));var utils=require(_0x416e('0x17'));var config=require(_0x416e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x416e('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x27c3aa,_0x2ec3e8){_0x2ec3e8=_0x2ec3e8||0xcc;return function(_0x2221ca){if(_0x2221ca){return _0x27c3aa[_0x416e('0x1a')](_0x2ec3e8);}return _0x27c3aa['status'](_0x2ec3e8)[_0x416e('0x1b')]();};}function respondWithResult(_0x457e49,_0x30b23f){_0x30b23f=_0x30b23f||0xc8;return function(_0x1188de){if(_0x1188de){return _0x457e49[_0x416e('0x1c')](_0x30b23f)[_0x416e('0x1d')](_0x1188de);}};}function respondWithFilteredResult(_0x30ead5,_0x162420){return function(_0x36069b){if(_0x36069b){var _0x5624ab=typeof _0x162420['offset']==='undefined'&&typeof _0x162420[_0x416e('0x1e')]===_0x416e('0x1f');var _0x268ad1=_0x36069b[_0x416e('0x20')];var _0x4ed9fc=_0x5624ab?0x0:_0x162420[_0x416e('0x21')];var _0x27d249=_0x5624ab?_0x36069b['count']:_0x162420[_0x416e('0x21')]+_0x162420[_0x416e('0x1e')];var _0x33fe4f;if(_0x27d249>=_0x268ad1){_0x27d249=_0x268ad1;_0x33fe4f=0xc8;}else{_0x33fe4f=0xce;}_0x30ead5[_0x416e('0x1c')](_0x33fe4f);return _0x30ead5[_0x416e('0x22')](_0x416e('0x23'),_0x4ed9fc+'-'+_0x27d249+'/'+_0x268ad1)[_0x416e('0x1d')](_0x36069b);}return null;};}function patchUpdates(_0x1134ee){return function(_0x3f6c1d){try{jsonpatch[_0x416e('0x24')](_0x3f6c1d,_0x1134ee,!![]);}catch(_0x61de2b){return BPromise['reject'](_0x61de2b);}return _0x3f6c1d[_0x416e('0x25')]();};}function saveUpdates(_0x1f062f,_0x3d197c){return function(_0x41e5e8){if(_0x41e5e8){return _0x41e5e8[_0x416e('0x26')](_0x1f062f)[_0x416e('0x27')](function(_0x4a2e9c){return _0x4a2e9c;});}return null;};}function removeEntity(_0x25070a,_0x3bbbad){return function(_0x196c11){if(_0x196c11){return _0x196c11['destroy']()[_0x416e('0x27')](function(){_0x25070a[_0x416e('0x1c')](0xcc)[_0x416e('0x1b')]();});}};}function handleEntityNotFound(_0x6cb20a,_0x4ab2f2){return function(_0x17fe69){if(!_0x17fe69){_0x6cb20a[_0x416e('0x1a')](0x194);}return _0x17fe69;};}function handleError(_0x3ab2fd,_0x21bc79){_0x21bc79=_0x21bc79||0x1f4;return function(_0x3b3487){logger[_0x416e('0x28')](_0x3b3487[_0x416e('0x29')]);if(_0x3b3487[_0x416e('0x2a')]){delete _0x3b3487[_0x416e('0x2a')];}_0x3ab2fd['status'](_0x21bc79)[_0x416e('0x2b')](_0x3b3487);};}exports[_0x416e('0x2c')]=function(_0x39b4d9,_0x12fa28){var _0x2ce7ea={},_0x40f504={},_0x454f87={'count':0x0,'rows':[]};var _0x5c4b5d=_[_0x416e('0x2d')](db[_0x416e('0x2e')][_0x416e('0x2f')],function(_0x4c2d04){return{'name':_0x4c2d04[_0x416e('0x30')],'type':_0x4c2d04[_0x416e('0x31')][_0x416e('0x32')]};});_0x40f504[_0x416e('0x33')]=_[_0x416e('0x2d')](_0x5c4b5d,_0x416e('0x2a'));_0x40f504[_0x416e('0x34')]=_[_0x416e('0x35')](_0x39b4d9[_0x416e('0x34')]);_0x40f504[_0x416e('0x36')]=_['intersection'](_0x40f504[_0x416e('0x33')],_0x40f504[_0x416e('0x34')]);_0x2ce7ea[_0x416e('0x37')]=_['intersection'](_0x40f504[_0x416e('0x33')],qs[_0x416e('0x38')](_0x39b4d9[_0x416e('0x34')]['fields']));_0x2ce7ea[_0x416e('0x37')]=_0x2ce7ea[_0x416e('0x37')]['length']?_0x2ce7ea[_0x416e('0x37')]:_0x40f504['model'];if(!_0x39b4d9['query'][_0x416e('0x39')](_0x416e('0x3a'))){_0x2ce7ea[_0x416e('0x1e')]=qs[_0x416e('0x1e')](_0x39b4d9[_0x416e('0x34')][_0x416e('0x1e')]);_0x2ce7ea[_0x416e('0x21')]=qs[_0x416e('0x21')](_0x39b4d9[_0x416e('0x34')]['offset']);}_0x2ce7ea[_0x416e('0x3b')]=qs['sort'](_0x39b4d9[_0x416e('0x34')][_0x416e('0x3c')]);_0x2ce7ea['where']=qs[_0x416e('0x36')](_['pick'](_0x39b4d9[_0x416e('0x34')],_0x40f504[_0x416e('0x36')]),_0x5c4b5d);if(_0x39b4d9['query'][_0x416e('0x3d')]){_0x2ce7ea[_0x416e('0x3e')]=_[_0x416e('0x3f')](_0x2ce7ea['where'],{'$or':_['map'](_0x5c4b5d,function(_0x4e6f26){if(_0x4e6f26[_0x416e('0x31')]!==_0x416e('0x40')){var _0x379990={};_0x379990[_0x4e6f26[_0x416e('0x2a')]]={'$like':'%'+_0x39b4d9[_0x416e('0x34')][_0x416e('0x3d')]+'%'};return _0x379990;}})});}_0x2ce7ea=_[_0x416e('0x3f')]({},_0x2ce7ea,_0x39b4d9[_0x416e('0x41')]);var _0x38e64d={'where':_0x2ce7ea[_0x416e('0x3e')]};return db[_0x416e('0x2e')]['count'](_0x38e64d)[_0x416e('0x27')](function(_0x5a2713){_0x454f87['count']=_0x5a2713;if(_0x39b4d9[_0x416e('0x34')][_0x416e('0x42')]){_0x2ce7ea[_0x416e('0x43')]=[{'all':!![]}];}return db[_0x416e('0x2e')][_0x416e('0x44')](_0x2ce7ea);})[_0x416e('0x27')](function(_0x59fb46){_0x454f87['rows']=_0x59fb46;return _0x454f87;})[_0x416e('0x27')](respondWithFilteredResult(_0x12fa28,_0x2ce7ea))[_0x416e('0x45')](handleError(_0x12fa28,null));};exports['show']=function(_0x56e5f5,_0x1bbc73){var _0xbf0d03={'raw':![],'where':{'id':_0x56e5f5[_0x416e('0x46')]['id']}},_0x26dbf2={};_0x26dbf2[_0x416e('0x33')]=_[_0x416e('0x35')](db[_0x416e('0x2e')][_0x416e('0x2f')]);_0x26dbf2[_0x416e('0x34')]=_[_0x416e('0x35')](_0x56e5f5[_0x416e('0x34')]);_0x26dbf2[_0x416e('0x36')]=_[_0x416e('0x47')](_0x26dbf2[_0x416e('0x33')],_0x26dbf2['query']);_0xbf0d03[_0x416e('0x37')]=_[_0x416e('0x47')](_0x26dbf2['model'],qs[_0x416e('0x38')](_0x56e5f5['query'][_0x416e('0x38')]));_0xbf0d03['attributes']=_0xbf0d03[_0x416e('0x37')]['length']?_0xbf0d03['attributes']:_0x26dbf2['model'];if(_0x56e5f5[_0x416e('0x34')][_0x416e('0x42')]){_0xbf0d03[_0x416e('0x43')]=[{'all':!![]}];}_0xbf0d03=_[_0x416e('0x3f')]({},_0xbf0d03,_0x56e5f5[_0x416e('0x41')]);return db[_0x416e('0x2e')][_0x416e('0x48')](_0xbf0d03)['then'](handleEntityNotFound(_0x1bbc73,null))[_0x416e('0x27')](respondWithResult(_0x1bbc73,null))[_0x416e('0x45')](handleError(_0x1bbc73,null));};exports['create']=function(_0x29ab79,_0x482a5f){return db[_0x416e('0x2e')][_0x416e('0x49')](_0x29ab79['body'],{})[_0x416e('0x27')](respondWithResult(_0x482a5f,0xc9))['catch'](handleError(_0x482a5f,null));};exports['update']=function(_0xd26fd3,_0x2ef833){if(_0xd26fd3[_0x416e('0x4a')]['id']){delete _0xd26fd3[_0x416e('0x4a')]['id'];}return db[_0x416e('0x2e')][_0x416e('0x48')]({'where':{'id':_0xd26fd3['params']['id']}})[_0x416e('0x27')](handleEntityNotFound(_0x2ef833,null))[_0x416e('0x27')](saveUpdates(_0xd26fd3[_0x416e('0x4a')],null))['then'](respondWithResult(_0x2ef833,null))[_0x416e('0x45')](handleError(_0x2ef833,null));};exports[_0x416e('0x4b')]=function(_0x53107a,_0x2e96e6){return db['Dynamics365Account']['find']({'where':{'id':_0x53107a['params']['id']}})[_0x416e('0x27')](handleEntityNotFound(_0x2e96e6,null))['then'](removeEntity(_0x2e96e6,null))[_0x416e('0x45')](handleError(_0x2e96e6,null));};exports[_0x416e('0x4c')]=function(_0x1d364e,_0x23e81a,_0x23a324){var _0x47e0a0={};var _0x1d1761={};var _0x2bbc45;var _0x1db190;return db[_0x416e('0x2e')][_0x416e('0x4d')]({'where':{'id':_0x1d364e['params']['id']}})[_0x416e('0x27')](handleEntityNotFound(_0x23e81a,null))[_0x416e('0x27')](function(_0xd81abe){if(_0xd81abe){_0x2bbc45=_0xd81abe;_0x1d1761[_0x416e('0x33')]=_[_0x416e('0x35')](db[_0x416e('0x4e')][_0x416e('0x2f')]);_0x1d1761[_0x416e('0x34')]=_[_0x416e('0x35')](_0x1d364e[_0x416e('0x34')]);_0x1d1761[_0x416e('0x36')]=_[_0x416e('0x47')](_0x1d1761[_0x416e('0x33')],_0x1d1761[_0x416e('0x34')]);_0x47e0a0[_0x416e('0x37')]=_[_0x416e('0x47')](_0x1d1761['model'],qs[_0x416e('0x38')](_0x1d364e[_0x416e('0x34')][_0x416e('0x38')]));_0x47e0a0[_0x416e('0x37')]=_0x47e0a0[_0x416e('0x37')][_0x416e('0x4f')]?_0x47e0a0[_0x416e('0x37')]:_0x1d1761['model'];_0x47e0a0['order']=qs[_0x416e('0x3c')](_0x1d364e['query'][_0x416e('0x3c')]);_0x47e0a0['where']=qs['filters'](_[_0x416e('0x50')](_0x1d364e[_0x416e('0x34')],_0x1d1761['filters']));if(_0x1d364e[_0x416e('0x34')][_0x416e('0x3d')]){_0x47e0a0[_0x416e('0x3e')]=_[_0x416e('0x3f')](_0x47e0a0['where'],{'$or':_[_0x416e('0x2d')](_0x47e0a0[_0x416e('0x37')],function(_0x58efb0){var _0x1374a9={};_0x1374a9[_0x58efb0]={'$like':'%'+_0x1d364e['query']['filter']+'%'};return _0x1374a9;})});}_0x47e0a0=_[_0x416e('0x3f')]({},_0x47e0a0,_0x1d364e[_0x416e('0x41')]);return _0x2bbc45[_0x416e('0x4c')](_0x47e0a0);}})[_0x416e('0x27')](function(_0x53ec04){if(_0x53ec04){_0x1db190=_0x53ec04['length'];if(!_0x1d364e[_0x416e('0x34')]['hasOwnProperty'](_0x416e('0x3a'))){_0x47e0a0[_0x416e('0x1e')]=qs['limit'](_0x1d364e[_0x416e('0x34')][_0x416e('0x1e')]);_0x47e0a0['offset']=qs[_0x416e('0x21')](_0x1d364e[_0x416e('0x34')][_0x416e('0x21')]);}return _0x2bbc45[_0x416e('0x4c')](_0x47e0a0);}})[_0x416e('0x27')](function(_0x323745){if(_0x323745){return _0x323745?{'count':_0x1db190,'rows':_0x323745}:null;}})['then'](respondWithResult(_0x23e81a,null))['catch'](handleError(_0x23e81a,null));};exports[_0x416e('0x51')]=function(_0x4cbd06,_0x289272,_0x32650e){if(_0x4cbd06['body']['id']){delete _0x4cbd06[_0x416e('0x4a')]['id'];}return db[_0x416e('0x2e')][_0x416e('0x4d')]({'where':{'id':_0x4cbd06[_0x416e('0x46')]['id']}})[_0x416e('0x27')](handleEntityNotFound(_0x289272,null))[_0x416e('0x27')](function(_0x325570){if(_0x325570){_0x4cbd06[_0x416e('0x4a')][_0x416e('0x52')]=_0x325570['id'];_0x4cbd06[_0x416e('0x4a')][_0x416e('0x53')]=integrations[_0x416e('0x54')](_0x4cbd06[_0x416e('0x4a')][_0x416e('0x55')],_0x4cbd06['body'][_0x416e('0x31')]);_0x4cbd06[_0x416e('0x4a')][_0x416e('0x56')]=integrations['getDescriptions'](_0x4cbd06['body']['channel'],_0x4cbd06['body'][_0x416e('0x31')]);return db[_0x416e('0x4e')]['create'](_0x4cbd06[_0x416e('0x4a')],{'include':[{'model':db[_0x416e('0x57')],'as':_0x416e('0x53')},{'model':db[_0x416e('0x57')],'as':'Descriptions'}]});}return null;})[_0x416e('0x27')](respondWithResult(_0x289272,null))[_0x416e('0x45')](handleError(_0x289272,null));};exports['getFields']=function(_0x37a505,_0x33a3b9,_0xe81da2){var _0x323af2=_0x37a505[_0x416e('0x34')][_0x416e('0x58')];var _0x3bbd66=_0x323af2===_0x416e('0x59')?_0x416e('0x5a'):_0x416e('0x5b');var _0x36c214='';var _0xb1f753='';var _0x458bd7='';var _0xb6d89d='';var _0x2c1dc0='';var _0x3e8552='';var _0x34429b='';var _0x58c12d='';var _0x2c9fdd=[_0x416e('0x5c'),_0x416e('0x5d'),_0x416e('0x5e'),_0x416e('0x5f'),_0x416e('0x60'),'subject',_0x416e('0x61'),_0x416e('0x62'),'directioncode',_0x416e('0x63')];var _0x225016=[_0x416e('0x64'),_0x416e('0x65'),_0x416e('0x66'),'billedserviceunits',_0x416e('0x67'),_0x416e('0x68'),_0x416e('0x69'),_0x416e('0x6a'),_0x416e('0x6b'),_0x416e('0x6c'),_0x416e('0x6d'),_0x416e('0x6e'),'createdon',_0x416e('0x6f'),_0x416e('0x70'),_0x416e('0x71'),_0x416e('0x72'),_0x416e('0x73'),_0x416e('0x74'),_0x416e('0x75'),_0x416e('0x76'),_0x416e('0x77'),'escalatedon',_0x416e('0x78'),_0x416e('0x79'),_0x416e('0x7a'),_0x416e('0x7b'),_0x416e('0x7c'),_0x416e('0x7d'),'lastonholdtime',_0x416e('0x7e'),_0x416e('0x7f'),_0x416e('0x80'),_0x416e('0x81'),_0x416e('0x82'),'modifiedon',_0x416e('0x83'),_0x416e('0x84'),_0x416e('0x85'),_0x416e('0x86'),_0x416e('0x87'),'onholdtime',_0x416e('0x88'),_0x416e('0x89'),'owneridtype',_0x416e('0x8a'),_0x416e('0x8b'),_0x416e('0x8c'),_0x416e('0x8d'),'prioritycodename','productidname',_0x416e('0x8e'),_0x416e('0x8f'),_0x416e('0x90'),_0x416e('0x91'),'responsiblecontactidname',_0x416e('0x92'),_0x416e('0x93'),_0x416e('0x94'),'slaname',_0x416e('0x95'),_0x416e('0x96'),'statuscode',_0x416e('0x97'),_0x416e('0x98'),_0x416e('0x99'),_0x416e('0x9a'),'traversedpath',_0x416e('0x9b'),_0x416e('0x9c')];var _0x29980f=_0x2c9fdd['concat'](_0x225016);return db[_0x416e('0x2e')][_0x416e('0x4d')]({'where':{'id':_0x37a505[_0x416e('0x46')]['id']},'attributes':['id',_0x416e('0x9d'),'password',_0x416e('0x9e'),_0x416e('0x9f'),_0x416e('0xa0'),'clientSecret']})['then'](handleEntityNotFound(_0x33a3b9,null))[_0x416e('0x27')](function(_0xde63b){if(_0xde63b){_0x58c12d=_0xde63b[_0x416e('0x9e')];var _0x15eb38=_0x58c12d[_0x416e('0xa1')](-0x1);if(_0x15eb38==='/'){_0x58c12d=_0x58c12d[_0x416e('0xa2')](0x0,_0x58c12d['lastIndexOf'](_0x15eb38));}_0x34429b=util['format'](_0x416e('0xa3'),_0x58c12d);var _0x4d3a66={'method':_0x416e('0xa4'),'uri':_0x416e('0xa5')+_0xde63b[_0x416e('0x9f')]+_0x416e('0xa6'),'form':{'client_id':_0xde63b[_0x416e('0xa0')],'resource':_0x58c12d,'username':_0xde63b['username'],'password':_0xde63b[_0x416e('0xa7')],'grant_type':'password','client_secret':_0xde63b['clientSecret']},'json':!![]};return rp(_0x4d3a66);}})[_0x416e('0x27')](function(_0x3a9908){_0x3e8552=_0x3a9908[_0x416e('0xa8')];var _0x105afc={'method':'GET','uri':encodeURI(_0x34429b+_0x416e('0xa9')+_0x3bbd66+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x3e8552,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x105afc);})['then'](function(_0x1b6d0a){var _0x430368=_0x1b6d0a[_0x416e('0xaa')][0x0];var _0x39c40b=_0x430368[_0x416e('0xab')];var _0x4b19bc={'method':_0x416e('0xac'),'uri':_0x34429b+_0x416e('0xad')+_0x39c40b+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x416e('0xae')+_0x3e8552,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b19bc);})['then'](function(_0x523e61){_0x36c214=_0x523e61;_0xb1f753=_0x36c214[_0x416e('0xaf')];_0xb1f753=_['remove'](_0xb1f753,function(_0x5bf4ad){return!_0x29980f[_0x416e('0xb0')](_0x5bf4ad['LogicalName']);});var _0x1fcec3=[];var _0x5a9631=[];_0xb1f753[_0x416e('0xb1')](function(_0x45c5b8){if(_0x45c5b8[_0x416e('0xb2')]){var _0x9de708=_0x45c5b8['@odata.type'][_0x416e('0xa2')](_0x45c5b8[_0x416e('0xb2')][_0x416e('0xb3')]('.')+0x1);if(_0x9de708===_0x416e('0xb4')){_0x1fcec3[_0x416e('0xb5')](getSelectList(_0x34429b,_0x323af2,_0x5a9631,_0x36c214['MetadataId'],_0x45c5b8[_0x416e('0xab')],_0x3e8552));}}});return Promise['all'](_0x1fcec3);})[_0x416e('0x27')](function(_0x4e306b){_0x458bd7=_0x4e306b[0x0];var _0x2fdb2a=[];var _0x22ad62=[];_0xb1f753[_0x416e('0xb1')](function(_0x500574){if(!_[_0x416e('0xb6')](_0x500574['@odata.type'])){var _0x4499ec=_0x500574[_0x416e('0xb2')][_0x416e('0xa2')](_0x500574[_0x416e('0xb2')][_0x416e('0xb3')]('.')+0x1);if(_0x4499ec===_0x416e('0xb7')){_0x2fdb2a['push'](getBooleanList(_0x34429b,_0x323af2,_0x22ad62,_0x36c214['MetadataId'],_0x500574['MetadataId'],_0x3e8552));}}});return Promise['all'](_0x2fdb2a);})[_0x416e('0x27')](function(_0x1e5425){_0xb6d89d=_0x1e5425[0x0];var _0x3be461=[];var _0x208881=[];_0xb1f753[_0x416e('0xb1')](function(_0x4ead06){if(_0x4ead06[_0x416e('0xb2')]){var _0x4881f8=_0x4ead06[_0x416e('0xb2')][_0x416e('0xa2')](_0x4ead06['@odata.type'][_0x416e('0xb3')]('.')+0x1);if(_0x4881f8===_0x416e('0xb8')||_0x4881f8==='DoubleAttributeMetadata'||_0x4881f8===_0x416e('0xb9')||_0x4881f8===_0x416e('0xba')||_0x4881f8===_0x416e('0xbb')||_0x4881f8===_0x416e('0xbc')||_0x4881f8==='StatusAttributeMetadata'||_0x4881f8==='EntityNameAttributeMetadata'||_0x4881f8===_0x416e('0xbd')||_0x4881f8==='DecimalAttributeMetadata'){_0x3be461['push'](getInputList(_0x34429b,_0x323af2,_0x4881f8,_0x208881,_0x36c214[_0x416e('0xab')],_0x4ead06[_0x416e('0xab')],_0x3e8552));}}});return Promise['all'](_0x3be461);})[_0x416e('0x27')](function(_0x5a147b){_0x2c1dc0=_0x5a147b[0x0];var _0x700fc2=_0x458bd7[_0x416e('0xbe')](_0xb6d89d)[_0x416e('0xbe')](_0x2c1dc0);var _0x4af0d5={'count':_0x700fc2[_0x416e('0x4f')],'rows':_0x700fc2};return _0x4af0d5;})[_0x416e('0x27')](respondWithResult(_0x33a3b9,null))[_0x416e('0x45')](function(_0x3b5a7e){var _0x491634=_0x37a505['query']['test']?0x1f4:_0x3b5a7e[_0x416e('0xbf')]||0x1f4;logger[_0x416e('0x28')](_0x3b5a7e['stack']);delete _0x3b5a7e[_0x416e('0x2a')];if(_0x491634===0x191){_0x491634=0x190;}_0x33a3b9[_0x416e('0x1c')](_0x491634)[_0x416e('0x2b')](_0x37a505['query'][_0x416e('0xc0')]?{'message':_0x416e('0xc1'),'statusCode':_0x3b5a7e['statusCode']}:_0x3b5a7e);});};function getSelectList(_0x43aa07,_0xce15d0,_0x1f6eea,_0xb584b2,_0x53e42c,_0x93c8bf){var _0x2a797a={'method':_0x416e('0xac'),'uri':_0x43aa07+'EntityDefinitions('+_0xb584b2+_0x416e('0xc2')+_0x53e42c+_0x416e('0xc3')+_0x416e('0xc4'),'headers':{'Authorization':_0x416e('0xae')+_0x93c8bf,'If-None-Match':null,'OData-Version':_0x416e('0xc5')},'json':!![]};return rp(_0x2a797a)['then'](function(_0x28ad16){var _0x129fa8=[];var _0x26746f=_0x28ad16[_0x416e('0xc6')]['Options'];_0x26746f[_0x416e('0xb1')](function(_0x9a9ed5){_0x129fa8[_0x416e('0xb5')]({'name':_0x9a9ed5['Label'][_0x416e('0xc7')][_0x416e('0xc8')],'value':String(_0x9a9ed5[_0x416e('0xc9')])});});var _0x2d4d43={'id':_0xce15d0+'_'+_0x28ad16['LogicalName'],'name':_0x28ad16[_0x416e('0xca')][_0x416e('0xc7')]['Label'],'custom':![],'options':_0x129fa8};_0x1f6eea[_0x416e('0xb5')](_0x2d4d43);return _0x1f6eea;});}function getBooleanList(_0x49063a,_0x4f8168,_0x15b9f7,_0x5b49d6,_0x5d6bde,_0x43e140){var _0x1e9f36={'method':_0x416e('0xac'),'uri':_0x49063a+_0x416e('0xad')+_0x5b49d6+_0x416e('0xc2')+_0x5d6bde+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x416e('0xae')+_0x43e140,'If-None-Match':null,'OData-Version':_0x416e('0xc5')},'json':!![]};return rp(_0x1e9f36)['then'](function(_0x512155){var _0x6ebb20=[];_0x6ebb20['push']({'name':_0x512155[_0x416e('0xc6')][_0x416e('0xcb')][_0x416e('0xc8')][_0x416e('0xc7')][_0x416e('0xc8')],'value':'true'},{'name':_0x512155['OptionSet'][_0x416e('0xcc')][_0x416e('0xc8')]['UserLocalizedLabel'][_0x416e('0xc8')],'value':'false'});var _0x4ac8e4={'id':_0x4f8168+'_'+_0x512155['LogicalName'],'name':_0x512155['DisplayName'][_0x416e('0xc7')][_0x416e('0xc8')],'custom':![],'options':_0x6ebb20};_0x15b9f7[_0x416e('0xb5')](_0x4ac8e4);return _0x15b9f7;});}function getInputList(_0x5c335c,_0x1315fd,_0x1d2c4f,_0x391c25,_0x537fc7,_0x4ef0f4,_0x5e291e){var _0x5bf348={'method':_0x416e('0xac'),'uri':_0x5c335c+'EntityDefinitions('+_0x537fc7+_0x416e('0xc2')+_0x4ef0f4+_0x416e('0xcd')+_0x1d2c4f+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x416e('0xae')+_0x5e291e,'If-None-Match':null,'OData-Version':_0x416e('0xc5')},'json':!![]};return rp(_0x5bf348)[_0x416e('0x27')](function(_0x5a1ecf){var _0x30a54d={'id':_0x1315fd+'_'+_0x5a1ecf[_0x416e('0xce')],'name':_0x5a1ecf[_0x416e('0xca')][_0x416e('0xc7')]?_0x5a1ecf[_0x416e('0xca')][_0x416e('0xc7')][_0x416e('0xc8')]:_0x5a1ecf['LogicalName'],'custom':![],'options':[]};_0x391c25[_0x416e('0xb5')](_0x30a54d);return _0x391c25;});} \ No newline at end of file +var _0x7118=['show','params','create','body','find','getConfigurations','findOne','Dynamics365Configuration','nolimit','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','Dynamics365Field','ticketType','incident','Incident','PhoneCall','title','description','caseorigincode','subject','phonenumber','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','firstresponsebykpiidname','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','clientId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','access_token','GET','Bearer\x20','value','MetadataId','EntityDefinitions(','4.0','Attributes','remove','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','LogicalName','DisplayName','UserLocalizedLabel','TrueOption','true','FalseOption','false','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','includeAll','include','findAll','rows','catch'];(function(_0x50416f,_0x4ab9a5){var _0x14e8ad=function(_0x2bf8e7){while(--_0x2bf8e7){_0x50416f['push'](_0x50416f['shift']());}};_0x14e8ad(++_0x4ab9a5);}(_0x7118,0x159));var _0x8711=function(_0x104499,_0x326299){_0x104499=_0x104499-0x0;var _0x3707da=_0x7118[_0x104499];return _0x3707da;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8711('0x0'));var jsonpatch=require(_0x8711('0x1'));var rp=require('request-promise');var moment=require(_0x8711('0x2'));var BPromise=require(_0x8711('0x3'));var Mustache=require(_0x8711('0x4'));var util=require(_0x8711('0x5'));var path=require(_0x8711('0x6'));var sox=require(_0x8711('0x7'));var csv=require(_0x8711('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8711('0x9'));var _=require(_0x8711('0xa'));var squel=require(_0x8711('0xb'));var crypto=require(_0x8711('0xc'));var jsforce=require(_0x8711('0xd'));var deskjs=require(_0x8711('0xe'));var toCsv=require(_0x8711('0x8'));var querystring=require(_0x8711('0xf'));var Papa=require(_0x8711('0x10'));var Redis=require(_0x8711('0x11'));var authService=require(_0x8711('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8711('0x13'));var logger=require(_0x8711('0x14'))(_0x8711('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8711('0x16'));var db=require(_0x8711('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x49b241,_0x11adb0){_0x11adb0=_0x11adb0||0xcc;return function(_0x3403f5){if(_0x3403f5){return _0x49b241[_0x8711('0x18')](_0x11adb0);}return _0x49b241[_0x8711('0x19')](_0x11adb0)[_0x8711('0x1a')]();};}function respondWithResult(_0x22f434,_0x16b742){_0x16b742=_0x16b742||0xc8;return function(_0x4a2330){if(_0x4a2330){return _0x22f434[_0x8711('0x19')](_0x16b742)[_0x8711('0x1b')](_0x4a2330);}};}function respondWithFilteredResult(_0x13f394,_0x2e12ec){return function(_0x3ab905){if(_0x3ab905){var _0x4628e9=typeof _0x2e12ec['offset']===_0x8711('0x1c')&&typeof _0x2e12ec[_0x8711('0x1d')]===_0x8711('0x1c');var _0xe1e9b3=_0x3ab905[_0x8711('0x1e')];var _0x47d18b=_0x4628e9?0x0:_0x2e12ec['offset'];var _0x569412=_0x4628e9?_0x3ab905[_0x8711('0x1e')]:_0x2e12ec[_0x8711('0x1f')]+_0x2e12ec[_0x8711('0x1d')];var _0x5305c3;if(_0x569412>=_0xe1e9b3){_0x569412=_0xe1e9b3;_0x5305c3=0xc8;}else{_0x5305c3=0xce;}_0x13f394['status'](_0x5305c3);return _0x13f394[_0x8711('0x20')](_0x8711('0x21'),_0x47d18b+'-'+_0x569412+'/'+_0xe1e9b3)[_0x8711('0x1b')](_0x3ab905);}return null;};}function patchUpdates(_0x44b948){return function(_0x23d977){try{jsonpatch[_0x8711('0x22')](_0x23d977,_0x44b948,!![]);}catch(_0x142fa7){return BPromise[_0x8711('0x23')](_0x142fa7);}return _0x23d977[_0x8711('0x24')]();};}function saveUpdates(_0x41369d,_0x4a35f5){return function(_0x2613de){if(_0x2613de){return _0x2613de[_0x8711('0x25')](_0x41369d)[_0x8711('0x26')](function(_0x939ef3){return _0x939ef3;});}return null;};}function removeEntity(_0x4cf830,_0x27cafd){return function(_0x29b079){if(_0x29b079){return _0x29b079[_0x8711('0x27')]()['then'](function(){_0x4cf830[_0x8711('0x19')](0xcc)[_0x8711('0x1a')]();});}};}function handleEntityNotFound(_0x3e8281,_0x217197){return function(_0x3f937b){if(!_0x3f937b){_0x3e8281['sendStatus'](0x194);}return _0x3f937b;};}function handleError(_0x494683,_0x515a74){_0x515a74=_0x515a74||0x1f4;return function(_0x2ad1fa){logger[_0x8711('0x28')](_0x2ad1fa[_0x8711('0x29')]);if(_0x2ad1fa[_0x8711('0x2a')]){delete _0x2ad1fa[_0x8711('0x2a')];}_0x494683[_0x8711('0x19')](_0x515a74)[_0x8711('0x2b')](_0x2ad1fa);};}exports[_0x8711('0x2c')]=function(_0x398097,_0x47e7b7){var _0x27db5d={},_0x591380={},_0x28c2d5={'count':0x0,'rows':[]};var _0xd0c671=_[_0x8711('0x2d')](db['Dynamics365Account'][_0x8711('0x2e')],function(_0x5e6111){return{'name':_0x5e6111[_0x8711('0x2f')],'type':_0x5e6111[_0x8711('0x30')][_0x8711('0x31')]};});_0x591380['model']=_['map'](_0xd0c671,_0x8711('0x2a'));_0x591380[_0x8711('0x32')]=_[_0x8711('0x33')](_0x398097[_0x8711('0x32')]);_0x591380[_0x8711('0x34')]=_[_0x8711('0x35')](_0x591380[_0x8711('0x36')],_0x591380[_0x8711('0x32')]);_0x27db5d[_0x8711('0x37')]=_[_0x8711('0x35')](_0x591380['model'],qs[_0x8711('0x38')](_0x398097[_0x8711('0x32')][_0x8711('0x38')]));_0x27db5d[_0x8711('0x37')]=_0x27db5d[_0x8711('0x37')][_0x8711('0x39')]?_0x27db5d[_0x8711('0x37')]:_0x591380[_0x8711('0x36')];if(!_0x398097[_0x8711('0x32')][_0x8711('0x3a')]('nolimit')){_0x27db5d[_0x8711('0x1d')]=qs[_0x8711('0x1d')](_0x398097[_0x8711('0x32')][_0x8711('0x1d')]);_0x27db5d[_0x8711('0x1f')]=qs['offset'](_0x398097[_0x8711('0x32')][_0x8711('0x1f')]);}_0x27db5d[_0x8711('0x3b')]=qs['sort'](_0x398097[_0x8711('0x32')][_0x8711('0x3c')]);_0x27db5d[_0x8711('0x3d')]=qs[_0x8711('0x34')](_[_0x8711('0x3e')](_0x398097[_0x8711('0x32')],_0x591380[_0x8711('0x34')]),_0xd0c671);if(_0x398097['query'][_0x8711('0x3f')]){_0x27db5d[_0x8711('0x3d')]=_[_0x8711('0x40')](_0x27db5d[_0x8711('0x3d')],{'$or':_['map'](_0xd0c671,function(_0x5de511){if(_0x5de511[_0x8711('0x30')]!==_0x8711('0x41')){var _0x3074f2={};_0x3074f2[_0x5de511[_0x8711('0x2a')]]={'$like':'%'+_0x398097[_0x8711('0x32')][_0x8711('0x3f')]+'%'};return _0x3074f2;}})});}_0x27db5d=_[_0x8711('0x40')]({},_0x27db5d,_0x398097[_0x8711('0x42')]);var _0x15f9cd={'where':_0x27db5d[_0x8711('0x3d')]};return db[_0x8711('0x43')][_0x8711('0x1e')](_0x15f9cd)[_0x8711('0x26')](function(_0x2e98f9){_0x28c2d5[_0x8711('0x1e')]=_0x2e98f9;if(_0x398097[_0x8711('0x32')][_0x8711('0x44')]){_0x27db5d[_0x8711('0x45')]=[{'all':!![]}];}return db[_0x8711('0x43')][_0x8711('0x46')](_0x27db5d);})[_0x8711('0x26')](function(_0x597b48){_0x28c2d5[_0x8711('0x47')]=_0x597b48;return _0x28c2d5;})['then'](respondWithFilteredResult(_0x47e7b7,_0x27db5d))[_0x8711('0x48')](handleError(_0x47e7b7,null));};exports[_0x8711('0x49')]=function(_0x121971,_0x38c0c4){var _0x5f2c0c={'raw':![],'where':{'id':_0x121971[_0x8711('0x4a')]['id']}},_0x1645f6={};_0x1645f6[_0x8711('0x36')]=_[_0x8711('0x33')](db[_0x8711('0x43')][_0x8711('0x2e')]);_0x1645f6['query']=_[_0x8711('0x33')](_0x121971[_0x8711('0x32')]);_0x1645f6[_0x8711('0x34')]=_[_0x8711('0x35')](_0x1645f6['model'],_0x1645f6[_0x8711('0x32')]);_0x5f2c0c[_0x8711('0x37')]=_[_0x8711('0x35')](_0x1645f6[_0x8711('0x36')],qs[_0x8711('0x38')](_0x121971['query']['fields']));_0x5f2c0c[_0x8711('0x37')]=_0x5f2c0c[_0x8711('0x37')]['length']?_0x5f2c0c[_0x8711('0x37')]:_0x1645f6[_0x8711('0x36')];if(_0x121971[_0x8711('0x32')][_0x8711('0x44')]){_0x5f2c0c['include']=[{'all':!![]}];}_0x5f2c0c=_[_0x8711('0x40')]({},_0x5f2c0c,_0x121971[_0x8711('0x42')]);return db[_0x8711('0x43')]['find'](_0x5f2c0c)[_0x8711('0x26')](handleEntityNotFound(_0x38c0c4,null))[_0x8711('0x26')](respondWithResult(_0x38c0c4,null))['catch'](handleError(_0x38c0c4,null));};exports[_0x8711('0x4b')]=function(_0x14a815,_0x4abc1c){return db[_0x8711('0x43')][_0x8711('0x4b')](_0x14a815['body'],{})[_0x8711('0x26')](respondWithResult(_0x4abc1c,0xc9))[_0x8711('0x48')](handleError(_0x4abc1c,null));};exports[_0x8711('0x25')]=function(_0x17a3f5,_0x52be53){if(_0x17a3f5[_0x8711('0x4c')]['id']){delete _0x17a3f5[_0x8711('0x4c')]['id'];}return db['Dynamics365Account'][_0x8711('0x4d')]({'where':{'id':_0x17a3f5[_0x8711('0x4a')]['id']}})['then'](handleEntityNotFound(_0x52be53,null))['then'](saveUpdates(_0x17a3f5['body'],null))['then'](respondWithResult(_0x52be53,null))[_0x8711('0x48')](handleError(_0x52be53,null));};exports[_0x8711('0x27')]=function(_0x1c83f7,_0x1cde16){return db[_0x8711('0x43')][_0x8711('0x4d')]({'where':{'id':_0x1c83f7[_0x8711('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1cde16,null))['then'](removeEntity(_0x1cde16,null))['catch'](handleError(_0x1cde16,null));};exports[_0x8711('0x4e')]=function(_0x867599,_0x1bbef4,_0x320666){var _0x40727f={};var _0x31f378={};var _0x526e07;var _0x449ba1;return db[_0x8711('0x43')][_0x8711('0x4f')]({'where':{'id':_0x867599['params']['id']}})[_0x8711('0x26')](handleEntityNotFound(_0x1bbef4,null))[_0x8711('0x26')](function(_0x35d5c3){if(_0x35d5c3){_0x526e07=_0x35d5c3;_0x31f378[_0x8711('0x36')]=_[_0x8711('0x33')](db[_0x8711('0x50')][_0x8711('0x2e')]);_0x31f378[_0x8711('0x32')]=_['keys'](_0x867599[_0x8711('0x32')]);_0x31f378['filters']=_[_0x8711('0x35')](_0x31f378['model'],_0x31f378['query']);_0x40727f['attributes']=_[_0x8711('0x35')](_0x31f378[_0x8711('0x36')],qs['fields'](_0x867599[_0x8711('0x32')]['fields']));_0x40727f[_0x8711('0x37')]=_0x40727f[_0x8711('0x37')]['length']?_0x40727f[_0x8711('0x37')]:_0x31f378['model'];_0x40727f[_0x8711('0x3b')]=qs[_0x8711('0x3c')](_0x867599['query']['sort']);_0x40727f[_0x8711('0x3d')]=qs['filters'](_[_0x8711('0x3e')](_0x867599[_0x8711('0x32')],_0x31f378[_0x8711('0x34')]));if(_0x867599[_0x8711('0x32')][_0x8711('0x3f')]){_0x40727f['where']=_[_0x8711('0x40')](_0x40727f[_0x8711('0x3d')],{'$or':_[_0x8711('0x2d')](_0x40727f[_0x8711('0x37')],function(_0x428a0f){var _0x483fa1={};_0x483fa1[_0x428a0f]={'$like':'%'+_0x867599[_0x8711('0x32')][_0x8711('0x3f')]+'%'};return _0x483fa1;})});}_0x40727f=_[_0x8711('0x40')]({},_0x40727f,_0x867599['options']);return _0x526e07['getConfigurations'](_0x40727f);}})[_0x8711('0x26')](function(_0x432cd5){if(_0x432cd5){_0x449ba1=_0x432cd5['length'];if(!_0x867599['query']['hasOwnProperty'](_0x8711('0x51'))){_0x40727f[_0x8711('0x1d')]=qs[_0x8711('0x1d')](_0x867599[_0x8711('0x32')][_0x8711('0x1d')]);_0x40727f[_0x8711('0x1f')]=qs[_0x8711('0x1f')](_0x867599[_0x8711('0x32')][_0x8711('0x1f')]);}return _0x526e07[_0x8711('0x4e')](_0x40727f);}})[_0x8711('0x26')](function(_0x5937ed){if(_0x5937ed){return _0x5937ed?{'count':_0x449ba1,'rows':_0x5937ed}:null;}})[_0x8711('0x26')](respondWithResult(_0x1bbef4,null))[_0x8711('0x48')](handleError(_0x1bbef4,null));};exports[_0x8711('0x52')]=function(_0x337940,_0xfd714a,_0xf135dc){if(_0x337940[_0x8711('0x4c')]['id']){delete _0x337940[_0x8711('0x4c')]['id'];}return db[_0x8711('0x43')][_0x8711('0x4f')]({'where':{'id':_0x337940['params']['id']}})[_0x8711('0x26')](handleEntityNotFound(_0xfd714a,null))[_0x8711('0x26')](function(_0x46f6b7){if(_0x46f6b7){_0x337940['body'][_0x8711('0x53')]=_0x46f6b7['id'];_0x337940[_0x8711('0x4c')][_0x8711('0x54')]=integrations['getSubjects'](_0x337940['body']['channel'],_0x337940[_0x8711('0x4c')][_0x8711('0x30')]);_0x337940['body'][_0x8711('0x55')]=integrations[_0x8711('0x56')](_0x337940['body'][_0x8711('0x57')],_0x337940[_0x8711('0x4c')][_0x8711('0x30')]);return db[_0x8711('0x50')]['create'](_0x337940[_0x8711('0x4c')],{'include':[{'model':db[_0x8711('0x58')],'as':'Subjects'},{'model':db[_0x8711('0x58')],'as':_0x8711('0x55')}]});}return null;})['then'](respondWithResult(_0xfd714a,null))[_0x8711('0x48')](handleError(_0xfd714a,null));};exports['getFields']=function(_0x2fa3b4,_0x3c86d3,_0x4520b6){var _0x2bb7ce=_0x2fa3b4[_0x8711('0x32')][_0x8711('0x59')];var _0x2ef0bd=_0x2bb7ce===_0x8711('0x5a')?_0x8711('0x5b'):_0x8711('0x5c');var _0x3bcc6f='';var _0x12102b='';var _0x1da9d3='';var _0x42c058='';var _0x140d54='';var _0x368323='';var _0x3f5371='';var _0x58a7ed='';var _0x3d92b4=[_0x8711('0x5d'),_0x8711('0x5e'),'customerid','ownerid',_0x8711('0x5f'),_0x8711('0x60'),_0x8711('0x61'),'regardingobjectid',_0x8711('0x62'),'phonecall_activity_parties'];var _0x2c1cbe=[_0x8711('0x63'),_0x8711('0x64'),_0x8711('0x65'),'billedserviceunits',_0x8711('0x66'),_0x8711('0x67'),_0x8711('0x68'),'contractidname',_0x8711('0x69'),'createdbyexternalpartyyominame',_0x8711('0x6a'),_0x8711('0x6b'),'createdon',_0x8711('0x6c'),_0x8711('0x6d'),_0x8711('0x6e'),_0x8711('0x6f'),_0x8711('0x70'),_0x8711('0x71'),_0x8711('0x72'),_0x8711('0x73'),_0x8711('0x74'),_0x8711('0x75'),'exchangerate',_0x8711('0x76'),'followupby','importsequencenumber',_0x8711('0x77'),'kbarticleidname',_0x8711('0x78'),_0x8711('0x79'),_0x8711('0x7a'),_0x8711('0x7b'),_0x8711('0x7c'),_0x8711('0x7d'),_0x8711('0x7e'),_0x8711('0x7f'),_0x8711('0x80'),_0x8711('0x81'),_0x8711('0x82'),_0x8711('0x83'),_0x8711('0x84'),_0x8711('0x85'),_0x8711('0x86'),_0x8711('0x87'),_0x8711('0x88'),'parentcaseidname',_0x8711('0x89'),_0x8711('0x8a'),_0x8711('0x8b'),'productidname','productserialnumber','resolveby',_0x8711('0x8c'),_0x8711('0x8d'),'responsiblecontactidname',_0x8711('0x8e'),_0x8711('0x8f'),'slainvokedidname','slaname',_0x8711('0x90'),_0x8711('0x91'),_0x8711('0x92'),_0x8711('0x93'),_0x8711('0x94'),_0x8711('0x95'),_0x8711('0x96'),_0x8711('0x97'),_0x8711('0x98'),_0x8711('0x99')];var _0x186eff=_0x3d92b4[_0x8711('0x9a')](_0x2c1cbe);return db[_0x8711('0x43')][_0x8711('0x4f')]({'where':{'id':_0x2fa3b4['params']['id']},'attributes':['id',_0x8711('0x9b'),_0x8711('0x9c'),_0x8711('0x9d'),'tenantId',_0x8711('0x9e'),'clientSecret']})[_0x8711('0x26')](handleEntityNotFound(_0x3c86d3,null))[_0x8711('0x26')](function(_0x33befe){if(_0x33befe){_0x58a7ed=_0x33befe[_0x8711('0x9d')];var _0x98f35=_0x58a7ed[_0x8711('0x9f')](-0x1);if(_0x98f35==='/'){_0x58a7ed=_0x58a7ed[_0x8711('0xa0')](0x0,_0x58a7ed[_0x8711('0xa1')](_0x98f35));}_0x3f5371=util[_0x8711('0xa2')](_0x8711('0xa3'),_0x58a7ed);var _0x247805={'method':_0x8711('0xa4'),'uri':_0x8711('0xa5')+_0x33befe[_0x8711('0xa6')]+_0x8711('0xa7'),'form':{'client_id':_0x33befe['clientId'],'resource':_0x58a7ed,'username':_0x33befe[_0x8711('0x9b')],'password':_0x33befe[_0x8711('0x9c')],'grant_type':_0x8711('0x9c'),'client_secret':_0x33befe['clientSecret']},'json':!![]};return rp(_0x247805);}})[_0x8711('0x26')](function(_0x17a32a){_0x368323=_0x17a32a[_0x8711('0xa8')];var _0x4e5c25={'method':_0x8711('0xa9'),'uri':encodeURI(_0x3f5371+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x2ef0bd+'\x27'),'headers':{'Authorization':_0x8711('0xaa')+_0x368323,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4e5c25);})[_0x8711('0x26')](function(_0x45e8c5){var _0x23db2b=_0x45e8c5[_0x8711('0xab')][0x0];var _0x151f0b=_0x23db2b[_0x8711('0xac')];var _0x5f8304={'method':_0x8711('0xa9'),'uri':_0x3f5371+_0x8711('0xad')+_0x151f0b+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x368323,'If-None-Match':null,'OData-Version':_0x8711('0xae')},'json':!![]};return rp(_0x5f8304);})['then'](function(_0xad77cc){_0x3bcc6f=_0xad77cc;_0x12102b=_0x3bcc6f[_0x8711('0xaf')];_0x12102b=_[_0x8711('0xb0')](_0x12102b,function(_0x5151fb){return!_0x186eff['includes'](_0x5151fb['LogicalName']);});var _0x443d53=[];var _0x177cc2=[];_0x12102b[_0x8711('0xb1')](function(_0x2fbe50){if(_0x2fbe50['@odata.type']){var _0x5d7678=_0x2fbe50[_0x8711('0xb2')][_0x8711('0xa0')](_0x2fbe50[_0x8711('0xb2')]['lastIndexOf']('.')+0x1);if(_0x5d7678===_0x8711('0xb3')){_0x443d53[_0x8711('0xb4')](getSelectList(_0x3f5371,_0x2bb7ce,_0x177cc2,_0x3bcc6f[_0x8711('0xac')],_0x2fbe50['MetadataId'],_0x368323));}}});return Promise[_0x8711('0xb5')](_0x443d53);})[_0x8711('0x26')](function(_0x2d5491){_0x1da9d3=_0x2d5491[0x0];var _0x27e061=[];var _0x29d705=[];_0x12102b['forEach'](function(_0x218508){if(!_[_0x8711('0xb6')](_0x218508[_0x8711('0xb2')])){var _0x243359=_0x218508[_0x8711('0xb2')]['substring'](_0x218508[_0x8711('0xb2')][_0x8711('0xa1')]('.')+0x1);if(_0x243359===_0x8711('0xb7')){_0x27e061[_0x8711('0xb4')](getBooleanList(_0x3f5371,_0x2bb7ce,_0x29d705,_0x3bcc6f[_0x8711('0xac')],_0x218508['MetadataId'],_0x368323));}}});return Promise[_0x8711('0xb5')](_0x27e061);})[_0x8711('0x26')](function(_0x1ee4db){_0x42c058=_0x1ee4db[0x0];var _0xa49d38=[];var _0x42b60d=[];_0x12102b[_0x8711('0xb1')](function(_0x24e569){if(_0x24e569[_0x8711('0xb2')]){var _0x19dda1=_0x24e569[_0x8711('0xb2')][_0x8711('0xa0')](_0x24e569['@odata.type'][_0x8711('0xa1')]('.')+0x1);if(_0x19dda1===_0x8711('0xb8')||_0x19dda1===_0x8711('0xb9')||_0x19dda1===_0x8711('0xba')||_0x19dda1==='IntegerAttributeMetadata'||_0x19dda1==='MemoAttributeMetadata'||_0x19dda1===_0x8711('0xbb')||_0x19dda1===_0x8711('0xbc')||_0x19dda1===_0x8711('0xbd')||_0x19dda1===_0x8711('0xbe')||_0x19dda1===_0x8711('0xbf')){_0xa49d38[_0x8711('0xb4')](getInputList(_0x3f5371,_0x2bb7ce,_0x19dda1,_0x42b60d,_0x3bcc6f['MetadataId'],_0x24e569[_0x8711('0xac')],_0x368323));}}});return Promise[_0x8711('0xb5')](_0xa49d38);})[_0x8711('0x26')](function(_0x1bcd1c){_0x140d54=_0x1bcd1c[0x0];var _0x420691=_0x1da9d3[_0x8711('0x9a')](_0x42c058)[_0x8711('0x9a')](_0x140d54);var _0x5b4754={'count':_0x420691[_0x8711('0x39')],'rows':_0x420691};return _0x5b4754;})[_0x8711('0x26')](respondWithResult(_0x3c86d3,null))[_0x8711('0x48')](function(_0x536180){var _0x3fe51f=_0x2fa3b4[_0x8711('0x32')][_0x8711('0xc0')]?0x1f4:_0x536180[_0x8711('0xc1')]||0x1f4;logger[_0x8711('0x28')](_0x536180[_0x8711('0x29')]);delete _0x536180['name'];if(_0x3fe51f===0x191){_0x3fe51f=0x190;}_0x3c86d3[_0x8711('0x19')](_0x3fe51f)[_0x8711('0x2b')](_0x2fa3b4['query'][_0x8711('0xc0')]?{'message':_0x8711('0xc2'),'statusCode':_0x536180[_0x8711('0xc1')]}:_0x536180);});};function getSelectList(_0x4b9aac,_0x4c174a,_0x3cb1ed,_0x5300f7,_0x44e2b9,_0x2b96dc){var _0x4758ae={'method':'GET','uri':_0x4b9aac+_0x8711('0xad')+_0x5300f7+_0x8711('0xc3')+_0x44e2b9+_0x8711('0xc4')+_0x8711('0xc5'),'headers':{'Authorization':_0x8711('0xaa')+_0x2b96dc,'If-None-Match':null,'OData-Version':_0x8711('0xae')},'json':!![]};return rp(_0x4758ae)[_0x8711('0x26')](function(_0x167437){var _0x3c809c=[];var _0x24ed84=_0x167437[_0x8711('0xc6')][_0x8711('0xc7')];_0x24ed84['forEach'](function(_0x2bd52c){_0x3c809c['push']({'name':_0x2bd52c[_0x8711('0xc8')]['UserLocalizedLabel'][_0x8711('0xc8')],'value':String(_0x2bd52c[_0x8711('0xc9')])});});var _0x10efc5={'id':_0x4c174a+'_'+_0x167437[_0x8711('0xca')],'name':_0x167437[_0x8711('0xcb')][_0x8711('0xcc')][_0x8711('0xc8')],'custom':![],'options':_0x3c809c};_0x3cb1ed[_0x8711('0xb4')](_0x10efc5);return _0x3cb1ed;});}function getBooleanList(_0x1c9f49,_0x283c56,_0x25158b,_0x3604c1,_0x2f120a,_0x58f6a1){var _0x289d59={'method':'GET','uri':_0x1c9f49+'EntityDefinitions('+_0x3604c1+_0x8711('0xc3')+_0x2f120a+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x8711('0xaa')+_0x58f6a1,'If-None-Match':null,'OData-Version':_0x8711('0xae')},'json':!![]};return rp(_0x289d59)['then'](function(_0x42e4bd){var _0x3eb00b=[];_0x3eb00b[_0x8711('0xb4')]({'name':_0x42e4bd[_0x8711('0xc6')][_0x8711('0xcd')][_0x8711('0xc8')][_0x8711('0xcc')][_0x8711('0xc8')],'value':_0x8711('0xce')},{'name':_0x42e4bd[_0x8711('0xc6')][_0x8711('0xcf')][_0x8711('0xc8')]['UserLocalizedLabel'][_0x8711('0xc8')],'value':_0x8711('0xd0')});var _0x1d471a={'id':_0x283c56+'_'+_0x42e4bd[_0x8711('0xca')],'name':_0x42e4bd[_0x8711('0xcb')]['UserLocalizedLabel'][_0x8711('0xc8')],'custom':![],'options':_0x3eb00b};_0x25158b[_0x8711('0xb4')](_0x1d471a);return _0x25158b;});}function getInputList(_0x2a2205,_0x66b8e1,_0x172174,_0x423c7e,_0x3d3d3a,_0x15e0c2,_0x48ff93){var _0x1a9746={'method':'GET','uri':_0x2a2205+_0x8711('0xad')+_0x3d3d3a+_0x8711('0xc3')+_0x15e0c2+')/Microsoft.Dynamics.CRM.'+_0x172174+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x48ff93,'If-None-Match':null,'OData-Version':_0x8711('0xae')},'json':!![]};return rp(_0x1a9746)['then'](function(_0x2a0e83){var _0xbbd9b8={'id':_0x66b8e1+'_'+_0x2a0e83[_0x8711('0xca')],'name':_0x2a0e83[_0x8711('0xcb')][_0x8711('0xcc')]?_0x2a0e83[_0x8711('0xcb')][_0x8711('0xcc')][_0x8711('0xc8')]:_0x2a0e83[_0x8711('0xca')],'custom':![],'options':[]};_0x423c7e[_0x8711('0xb4')](_0xbbd9b8);return _0x423c7e;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index beb13cf..8f87adc 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 _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x2a5033,_0x332859){var _0x8fad23=function(_0x10a599){while(--_0x10a599){_0x2a5033['push'](_0x2a5033['shift']());}};_0x8fad23(++_0x332859);}(_0x757a,0xde));var _0xa757=function(_0x38621d,_0x3a7770){_0x38621d=_0x38621d-0x0;var _0xcefc12=_0x757a[_0x38621d];return _0xcefc12;};'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'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 6f745e0..4062e56 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 _0x2df4=['result','GetDynamics365Account','findAll','options','raw','where','attributes','include','model','map','then','catch','ShowDynamics365Account','Dynamics365Account','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','request','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x8065e0,_0x530006){var _0x5b0f55=function(_0x241f58){while(--_0x241f58){_0x8065e0['push'](_0x8065e0['shift']());}};_0x5b0f55(++_0x530006);}(_0x2df4,0x6b));var _0x42df=function(_0x1fd456,_0x3b5d5f){_0x1fd456=_0x1fd456-0x0;var _0x599648=_0x2df4[_0x1fd456];return _0x599648;};'use strict';var _=require(_0x42df('0x0'));var util=require('util');var moment=require(_0x42df('0x1'));var BPromise=require(_0x42df('0x2'));var rs=require(_0x42df('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42df('0x4'))['db'];var utils=require(_0x42df('0x5'));var logger=require('../../config/logger')(_0x42df('0x6'));var config=require('../../config/environment');var jayson=require(_0x42df('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20b3f4,_0x126d39,_0x501484){return new BPromise(function(_0x25cca1,_0x354a89){return client[_0x42df('0x8')](_0x20b3f4,_0x501484)['then'](function(_0x4d45b4){logger[_0x42df('0x9')](_0x42df('0xa'),_0x126d39,_0x42df('0xb'));logger[_0x42df('0xc')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x126d39,'request\x20sent',JSON[_0x42df('0xd')](_0x4d45b4));if(_0x4d45b4[_0x42df('0xe')]){if(_0x4d45b4['error'][_0x42df('0xf')]===0x1f4){logger[_0x42df('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x126d39,_0x4d45b4[_0x42df('0xe')]['message']);return _0x354a89(_0x4d45b4[_0x42df('0xe')][_0x42df('0x10')]);}logger[_0x42df('0xe')](_0x42df('0xa'),_0x126d39,_0x4d45b4['error'][_0x42df('0x10')]);return _0x25cca1(_0x4d45b4[_0x42df('0xe')][_0x42df('0x10')]);}else{logger['info'](_0x42df('0xa'),_0x126d39,_0x42df('0xb'));_0x25cca1(_0x4d45b4[_0x42df('0x11')][_0x42df('0x10')]);}})['catch'](function(_0x2c2d6d){logger[_0x42df('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x126d39,_0x2c2d6d);_0x354a89(_0x2c2d6d);});});}exports[_0x42df('0x12')]=function(_0xb9f790){var _0x4cb489=this;return new Promise(function(_0x42d13b,_0x4af13e){return db['Dynamics365Account'][_0x42df('0x13')]({'raw':_0xb9f790[_0x42df('0x14')]?_0xb9f790['options'][_0x42df('0x15')]===undefined?!![]:![]:!![],'where':_0xb9f790[_0x42df('0x14')]?_0xb9f790['options'][_0x42df('0x16')]||null:null,'attributes':_0xb9f790['options']?_0xb9f790['options'][_0x42df('0x17')]||null:null,'limit':_0xb9f790[_0x42df('0x14')]?_0xb9f790[_0x42df('0x14')]['limit']||null:null,'include':_0xb9f790[_0x42df('0x14')]?_0xb9f790[_0x42df('0x14')]['include']?_['map'](_0xb9f790['options'][_0x42df('0x18')],function(_0x169383){return{'model':db[_0x169383[_0x42df('0x19')]],'as':_0x169383['as'],'attributes':_0x169383['attributes'],'include':_0x169383[_0x42df('0x18')]?_[_0x42df('0x1a')](_0x169383[_0x42df('0x18')],function(_0x4d2a45){return{'model':db[_0x4d2a45[_0x42df('0x19')]],'as':_0x4d2a45['as'],'attributes':_0x4d2a45['attributes'],'include':_0x4d2a45[_0x42df('0x18')]?_[_0x42df('0x1a')](_0x4d2a45[_0x42df('0x18')],function(_0x33132e){return{'model':db[_0x33132e[_0x42df('0x19')]],'as':_0x33132e['as'],'attributes':_0x33132e[_0x42df('0x17')]};}):[]};}):[]};}):[]:[]})[_0x42df('0x1b')](function(_0x5c3d2f){logger['info'](_0x42df('0x12'),_0xb9f790);logger['debug'](_0x42df('0x12'),_0xb9f790,JSON[_0x42df('0xd')](_0x5c3d2f));_0x42d13b(_0x5c3d2f);})[_0x42df('0x1c')](function(_0x4efadf){logger[_0x42df('0xe')]('GetDynamics365Account',_0x4efadf[_0x42df('0x10')],_0xb9f790);_0x4af13e(_0x4cb489[_0x42df('0xe')](0x1f4,_0x4efadf[_0x42df('0x10')]));});});};exports[_0x42df('0x1d')]=function(_0x5cbde6){var _0x386f5d=this;return new Promise(function(_0x2c5e72,_0x1ffa51){return db[_0x42df('0x1e')]['find']({'raw':_0x5cbde6[_0x42df('0x14')]?_0x5cbde6['options']['raw']===undefined?!![]:![]:!![],'where':_0x5cbde6[_0x42df('0x14')]?_0x5cbde6[_0x42df('0x14')][_0x42df('0x16')]||null:null,'attributes':_0x5cbde6[_0x42df('0x14')]?_0x5cbde6[_0x42df('0x14')][_0x42df('0x17')]||null:null,'include':_0x5cbde6[_0x42df('0x14')]?_0x5cbde6[_0x42df('0x14')][_0x42df('0x18')]?_[_0x42df('0x1a')](_0x5cbde6[_0x42df('0x14')][_0x42df('0x18')],function(_0xbaa96d){return{'model':db[_0xbaa96d[_0x42df('0x19')]],'as':_0xbaa96d['as'],'attributes':_0xbaa96d[_0x42df('0x17')],'include':_0xbaa96d[_0x42df('0x18')]?_['map'](_0xbaa96d[_0x42df('0x18')],function(_0x2c00ff){return{'model':db[_0x2c00ff[_0x42df('0x19')]],'as':_0x2c00ff['as'],'attributes':_0x2c00ff[_0x42df('0x17')],'include':_0x2c00ff['include']?_[_0x42df('0x1a')](_0x2c00ff[_0x42df('0x18')],function(_0x582f93){return{'model':db[_0x582f93[_0x42df('0x19')]],'as':_0x582f93['as'],'attributes':_0x582f93[_0x42df('0x17')]};}):[]};}):[]};}):[]:[]})[_0x42df('0x1b')](function(_0x453969){logger[_0x42df('0x9')]('ShowDynamics365Account',_0x5cbde6);logger['debug'](_0x42df('0x1d'),_0x5cbde6,JSON[_0x42df('0xd')](_0x453969));_0x2c5e72(_0x453969);})[_0x42df('0x1c')](function(_0x31f904){logger[_0x42df('0xe')](_0x42df('0x1d'),_0x31f904['message'],_0x5cbde6);_0x1ffa51(_0x386f5d[_0x42df('0xe')](0x1f4,_0x31f904[_0x42df('0x10')]));});});}; \ No newline at end of file +var _0x8130=['code','message','result','GetDynamics365Account','Dynamics365Account','findAll','raw','options','where','attributes','include','map','model','then','info','catch','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x451756,_0x25d98f){var _0x49ef0e=function(_0x2c5b6b){while(--_0x2c5b6b){_0x451756['push'](_0x451756['shift']());}};_0x49ef0e(++_0x25d98f);}(_0x8130,0x7d));var _0x0813=function(_0x2f6fb6,_0x3fefb1){_0x2f6fb6=_0x2f6fb6-0x0;var _0x55c48f=_0x8130[_0x2f6fb6];return _0x55c48f;};'use strict';var _=require(_0x0813('0x0'));var util=require(_0x0813('0x1'));var moment=require(_0x0813('0x2'));var BPromise=require(_0x0813('0x3'));var rs=require(_0x0813('0x4'));var fs=require('fs');var Redis=require(_0x0813('0x5'));var db=require(_0x0813('0x6'))['db'];var utils=require(_0x0813('0x7'));var logger=require(_0x0813('0x8'))(_0x0813('0x9'));var config=require(_0x0813('0xa'));var jayson=require(_0x0813('0xb'));var client=jayson['client'][_0x0813('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5809f9,_0x4c4c2e,_0x344432){return new BPromise(function(_0x5b1f77,_0x34cca8){return client[_0x0813('0xd')](_0x5809f9,_0x344432)['then'](function(_0x410822){logger['info'](_0x0813('0xe'),_0x4c4c2e,_0x0813('0xf'));logger[_0x0813('0x10')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x4c4c2e,_0x0813('0xf'),JSON[_0x0813('0x11')](_0x410822));if(_0x410822[_0x0813('0x12')]){if(_0x410822[_0x0813('0x12')][_0x0813('0x13')]===0x1f4){logger['error'](_0x0813('0xe'),_0x4c4c2e,_0x410822[_0x0813('0x12')]['message']);return _0x34cca8(_0x410822['error']['message']);}logger['error'](_0x0813('0xe'),_0x4c4c2e,_0x410822[_0x0813('0x12')][_0x0813('0x14')]);return _0x5b1f77(_0x410822['error'][_0x0813('0x14')]);}else{logger['info'](_0x0813('0xe'),_0x4c4c2e,_0x0813('0xf'));_0x5b1f77(_0x410822[_0x0813('0x15')][_0x0813('0x14')]);}})['catch'](function(_0x457cad){logger[_0x0813('0x12')](_0x0813('0xe'),_0x4c4c2e,_0x457cad);_0x34cca8(_0x457cad);});});}exports[_0x0813('0x16')]=function(_0xc46583){var _0x54bd86=this;return new Promise(function(_0x37eaac,_0x139f1a){return db[_0x0813('0x17')][_0x0813('0x18')]({'raw':_0xc46583['options']?_0xc46583['options'][_0x0813('0x19')]===undefined?!![]:![]:!![],'where':_0xc46583[_0x0813('0x1a')]?_0xc46583['options'][_0x0813('0x1b')]||null:null,'attributes':_0xc46583[_0x0813('0x1a')]?_0xc46583[_0x0813('0x1a')][_0x0813('0x1c')]||null:null,'limit':_0xc46583[_0x0813('0x1a')]?_0xc46583[_0x0813('0x1a')]['limit']||null:null,'include':_0xc46583[_0x0813('0x1a')]?_0xc46583[_0x0813('0x1a')][_0x0813('0x1d')]?_[_0x0813('0x1e')](_0xc46583[_0x0813('0x1a')][_0x0813('0x1d')],function(_0x2e0be0){return{'model':db[_0x2e0be0[_0x0813('0x1f')]],'as':_0x2e0be0['as'],'attributes':_0x2e0be0[_0x0813('0x1c')],'include':_0x2e0be0[_0x0813('0x1d')]?_[_0x0813('0x1e')](_0x2e0be0['include'],function(_0x1795ae){return{'model':db[_0x1795ae[_0x0813('0x1f')]],'as':_0x1795ae['as'],'attributes':_0x1795ae[_0x0813('0x1c')],'include':_0x1795ae['include']?_[_0x0813('0x1e')](_0x1795ae['include'],function(_0x200d78){return{'model':db[_0x200d78['model']],'as':_0x200d78['as'],'attributes':_0x200d78[_0x0813('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0813('0x20')](function(_0xacb049){logger[_0x0813('0x21')](_0x0813('0x16'),_0xc46583);logger[_0x0813('0x10')](_0x0813('0x16'),_0xc46583,JSON[_0x0813('0x11')](_0xacb049));_0x37eaac(_0xacb049);})[_0x0813('0x22')](function(_0x474f26){logger['error'](_0x0813('0x16'),_0x474f26[_0x0813('0x14')],_0xc46583);_0x139f1a(_0x54bd86[_0x0813('0x12')](0x1f4,_0x474f26['message']));});});};exports[_0x0813('0x23')]=function(_0x1c8c85){var _0x58d51a=this;return new Promise(function(_0x5d94f8,_0x5481c6){return db[_0x0813('0x17')]['find']({'raw':_0x1c8c85['options']?_0x1c8c85[_0x0813('0x1a')][_0x0813('0x19')]===undefined?!![]:![]:!![],'where':_0x1c8c85[_0x0813('0x1a')]?_0x1c8c85[_0x0813('0x1a')][_0x0813('0x1b')]||null:null,'attributes':_0x1c8c85['options']?_0x1c8c85['options'][_0x0813('0x1c')]||null:null,'include':_0x1c8c85[_0x0813('0x1a')]?_0x1c8c85[_0x0813('0x1a')][_0x0813('0x1d')]?_[_0x0813('0x1e')](_0x1c8c85[_0x0813('0x1a')][_0x0813('0x1d')],function(_0x361818){return{'model':db[_0x361818['model']],'as':_0x361818['as'],'attributes':_0x361818[_0x0813('0x1c')],'include':_0x361818[_0x0813('0x1d')]?_['map'](_0x361818[_0x0813('0x1d')],function(_0x337598){return{'model':db[_0x337598[_0x0813('0x1f')]],'as':_0x337598['as'],'attributes':_0x337598[_0x0813('0x1c')],'include':_0x337598[_0x0813('0x1d')]?_[_0x0813('0x1e')](_0x337598[_0x0813('0x1d')],function(_0x197f97){return{'model':db[_0x197f97[_0x0813('0x1f')]],'as':_0x197f97['as'],'attributes':_0x197f97[_0x0813('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0813('0x20')](function(_0x3abbda){logger[_0x0813('0x21')](_0x0813('0x23'),_0x1c8c85);logger[_0x0813('0x10')](_0x0813('0x23'),_0x1c8c85,JSON[_0x0813('0x11')](_0x3abbda));_0x5d94f8(_0x3abbda);})['catch'](function(_0x39a697){logger[_0x0813('0x12')](_0x0813('0x23'),_0x39a697[_0x0813('0x14')],_0x1c8c85);_0x5481c6(_0x58d51a[_0x0813('0x12')](0x1f4,_0x39a697[_0x0813('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index a13eab8..9987088 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 _0x759e=['update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put'];(function(_0x1c5d44,_0x5abdc0){var _0x27b24f=function(_0x2d2064){while(--_0x2d2064){_0x1c5d44['push'](_0x1c5d44['shift']());}};_0x27b24f(++_0x5abdc0);}(_0x759e,0xd1));var _0xe759=function(_0x2f6db1,_0x3b140e){_0x2f6db1=_0x2f6db1-0x0;var _0x54184b=_0x759e[_0x2f6db1];return _0x54184b;};'use strict';var multer=require(_0xe759('0x0'));var util=require(_0xe759('0x1'));var path=require('path');var timeout=require(_0xe759('0x2'));var express=require(_0xe759('0x3'));var router=express[_0xe759('0x4')]();var fs_extra=require(_0xe759('0x5'));var auth=require(_0xe759('0x6'));var interaction=require(_0xe759('0x7'));var config=require(_0xe759('0x8'));var controller=require(_0xe759('0x9'));router[_0xe759('0xa')]('/',auth[_0xe759('0xb')](),controller['index']);router['get'](_0xe759('0xc'),auth[_0xe759('0xb')](),controller[_0xe759('0xd')]);router[_0xe759('0xa')](_0xe759('0xe'),auth[_0xe759('0xb')](),controller[_0xe759('0xf')]);router[_0xe759('0xa')](_0xe759('0x10'),auth[_0xe759('0xb')](),controller[_0xe759('0x11')]);router[_0xe759('0xa')](_0xe759('0x12'),auth[_0xe759('0xb')](),controller[_0xe759('0x13')]);router['post']('/',auth[_0xe759('0xb')](),controller['create']);router[_0xe759('0x14')](_0xe759('0xc'),auth['isAuthenticated'](),controller[_0xe759('0x15')]);router['delete'](_0xe759('0xc'),auth[_0xe759('0xb')](),controller['destroy']);module[_0xe759('0x16')]=router; \ No newline at end of file +var _0x6ce1=['delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x6ce1,0xca));var _0x16ce=function(_0xebf3ca,_0x4f988d){_0xebf3ca=_0xebf3ca-0x0;var _0x51f2a8=_0x6ce1[_0xebf3ca];return _0x51f2a8;};'use strict';var multer=require('multer');var util=require(_0x16ce('0x0'));var path=require(_0x16ce('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x16ce('0x2')]();var fs_extra=require(_0x16ce('0x3'));var auth=require(_0x16ce('0x4'));var interaction=require(_0x16ce('0x5'));var config=require(_0x16ce('0x6'));var controller=require(_0x16ce('0x7'));router[_0x16ce('0x8')]('/',auth[_0x16ce('0x9')](),controller['index']);router[_0x16ce('0x8')](_0x16ce('0xa'),auth[_0x16ce('0x9')](),controller['show']);router[_0x16ce('0x8')](_0x16ce('0xb'),auth[_0x16ce('0x9')](),controller[_0x16ce('0xc')]);router[_0x16ce('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x16ce('0xd')]);router[_0x16ce('0x8')](_0x16ce('0xe'),auth['isAuthenticated'](),controller[_0x16ce('0xf')]);router[_0x16ce('0x10')]('/',auth[_0x16ce('0x9')](),controller['create']);router[_0x16ce('0x11')](_0x16ce('0xa'),auth[_0x16ce('0x9')](),controller['update']);router[_0x16ce('0x12')](_0x16ce('0xa'),auth[_0x16ce('0x9')](),controller['destroy']);module[_0x16ce('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 65fdb51..ef747a1 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 _0x19df=['ENUM','exports','STRING'];(function(_0x1a72e1,_0x1ffbea){var _0x3c980c=function(_0x2d59f9){while(--_0x2d59f9){_0x1a72e1['push'](_0x1a72e1['shift']());}};_0x3c980c(++_0x1ffbea);}(_0x19df,0xb8));var _0xf19d=function(_0x22c50e,_0x4ea131){_0x22c50e=_0x22c50e-0x0;var _0x500f85=_0x19df[_0x22c50e];return _0x500f85;};'use strict';var Sequelize=require('sequelize');module[_0xf19d('0x0')]={'name':{'type':Sequelize[_0xf19d('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xf19d('0x2')]('incident','phonecall'),'defaultValue':'incident'}}; \ No newline at end of file +var _0xd216=['ENUM','incident','phonecall','sequelize','STRING'];(function(_0x31f2b7,_0x2e2ef4){var _0x3bccc0=function(_0x1d4694){while(--_0x1d4694){_0x31f2b7['push'](_0x31f2b7['shift']());}};_0x3bccc0(++_0x2e2ef4);}(_0xd216,0x198));var _0x6d21=function(_0x3b724b,_0x9a0f1d){_0x3b724b=_0x3b724b-0x0;var _0x2725da=_0xd216[_0x3b724b];return _0x2725da;};'use strict';var Sequelize=require(_0x6d21('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d21('0x1')]},'description':{'type':Sequelize[_0x6d21('0x1')]},'ticketType':{'type':Sequelize[_0x6d21('0x2')](_0x6d21('0x3'),_0x6d21('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 6f1ad11..4a8e8f1 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 _0xbc04=['options','Dynamics365Configuration','includeAll','findAll','rows','catch','params','keys','rawAttributes','length','create','body','find','findOne','Dynamics365Field','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','fieldName','type','model','filters','intersection','query','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x145350,_0x5d0cbf){var _0x4ecb2d=function(_0x2456c0){while(--_0x2456c0){_0x145350['push'](_0x145350['shift']());}};_0x4ecb2d(++_0x5d0cbf);}(_0xbc04,0x1d4));var _0x4bc0=function(_0x1c212b,_0x34b667){_0x1c212b=_0x1c212b-0x0;var _0x275588=_0xbc04[_0x1c212b];return _0x275588;};'use strict';var emlformat=require(_0x4bc0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4bc0('0x1'));var jsonpatch=require(_0x4bc0('0x2'));var rp=require('request-promise');var moment=require(_0x4bc0('0x3'));var BPromise=require(_0x4bc0('0x4'));var Mustache=require('mustache');var util=require(_0x4bc0('0x5'));var path=require(_0x4bc0('0x6'));var sox=require('sox');var csv=require(_0x4bc0('0x7'));var ejs=require(_0x4bc0('0x8'));var fs=require('fs');var fs_extra=require(_0x4bc0('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4bc0('0xa'));var jsforce=require(_0x4bc0('0xb'));var deskjs=require(_0x4bc0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4bc0('0xd'));var Papa=require(_0x4bc0('0xe'));var Redis=require('ioredis');var authService=require(_0x4bc0('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4bc0('0x10'));var hardwareService=require(_0x4bc0('0x11'));var logger=require(_0x4bc0('0x12'))('api');var utils=require(_0x4bc0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4bc0('0x14'));var db=require(_0x4bc0('0x15'))['db'];function respondWithStatusCode(_0x5a4e96,_0x516ccd){_0x516ccd=_0x516ccd||0xcc;return function(_0x5c398d){if(_0x5c398d){return _0x5a4e96['sendStatus'](_0x516ccd);}return _0x5a4e96[_0x4bc0('0x16')](_0x516ccd)[_0x4bc0('0x17')]();};}function respondWithResult(_0x24744c,_0x487a38){_0x487a38=_0x487a38||0xc8;return function(_0x127668){if(_0x127668){return _0x24744c[_0x4bc0('0x16')](_0x487a38)[_0x4bc0('0x18')](_0x127668);}};}function respondWithFilteredResult(_0x2d4755,_0x3c0dc7){return function(_0x2b6cb5){if(_0x2b6cb5){var _0x1039a5=typeof _0x3c0dc7[_0x4bc0('0x19')]===_0x4bc0('0x1a')&&typeof _0x3c0dc7[_0x4bc0('0x1b')]===_0x4bc0('0x1a');var _0x4e1025=_0x2b6cb5[_0x4bc0('0x1c')];var _0x3682d0=_0x1039a5?0x0:_0x3c0dc7['offset'];var _0x5a57b2=_0x1039a5?_0x2b6cb5[_0x4bc0('0x1c')]:_0x3c0dc7[_0x4bc0('0x19')]+_0x3c0dc7[_0x4bc0('0x1b')];var _0x97d1ab;if(_0x5a57b2>=_0x4e1025){_0x5a57b2=_0x4e1025;_0x97d1ab=0xc8;}else{_0x97d1ab=0xce;}_0x2d4755['status'](_0x97d1ab);return _0x2d4755[_0x4bc0('0x1d')](_0x4bc0('0x1e'),_0x3682d0+'-'+_0x5a57b2+'/'+_0x4e1025)['json'](_0x2b6cb5);}return null;};}function patchUpdates(_0xa4e24){return function(_0x54f4b6){try{jsonpatch[_0x4bc0('0x1f')](_0x54f4b6,_0xa4e24,!![]);}catch(_0x4bd13a){return BPromise[_0x4bc0('0x20')](_0x4bd13a);}return _0x54f4b6[_0x4bc0('0x21')]();};}function saveUpdates(_0x30cb6a,_0x414e5f){return function(_0x569b7d){if(_0x569b7d){return _0x569b7d[_0x4bc0('0x22')](_0x30cb6a)[_0x4bc0('0x23')](function(_0x418119){return _0x418119;});}return null;};}function removeEntity(_0x1627df,_0x49989a){return function(_0xf55006){if(_0xf55006){return _0xf55006[_0x4bc0('0x24')]()[_0x4bc0('0x23')](function(){_0x1627df[_0x4bc0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1192e2,_0x20d1d0){return function(_0x5ccd07){if(!_0x5ccd07){_0x1192e2[_0x4bc0('0x25')](0x194);}return _0x5ccd07;};}function handleError(_0x20009c,_0x3cac7c){_0x3cac7c=_0x3cac7c||0x1f4;return function(_0x14f0a9){logger['error'](_0x14f0a9['stack']);if(_0x14f0a9['name']){delete _0x14f0a9[_0x4bc0('0x26')];}_0x20009c[_0x4bc0('0x16')](_0x3cac7c)[_0x4bc0('0x27')](_0x14f0a9);};}exports[_0x4bc0('0x28')]=function(_0x11e3f7,_0x4bdcd7){var _0x711f69={},_0x4bc8c2={},_0x10f9d0={'count':0x0,'rows':[]};var _0x126643=_[_0x4bc0('0x29')](db['Dynamics365Configuration']['rawAttributes'],function(_0x54b0d1){return{'name':_0x54b0d1[_0x4bc0('0x2a')],'type':_0x54b0d1[_0x4bc0('0x2b')]['key']};});_0x4bc8c2[_0x4bc0('0x2c')]=_[_0x4bc0('0x29')](_0x126643,_0x4bc0('0x26'));_0x4bc8c2['query']=_['keys'](_0x11e3f7['query']);_0x4bc8c2[_0x4bc0('0x2d')]=_[_0x4bc0('0x2e')](_0x4bc8c2['model'],_0x4bc8c2[_0x4bc0('0x2f')]);_0x711f69['attributes']=_[_0x4bc0('0x2e')](_0x4bc8c2[_0x4bc0('0x2c')],qs[_0x4bc0('0x30')](_0x11e3f7[_0x4bc0('0x2f')][_0x4bc0('0x30')]));_0x711f69[_0x4bc0('0x31')]=_0x711f69[_0x4bc0('0x31')]['length']?_0x711f69[_0x4bc0('0x31')]:_0x4bc8c2[_0x4bc0('0x2c')];if(!_0x11e3f7[_0x4bc0('0x2f')][_0x4bc0('0x32')]('nolimit')){_0x711f69['limit']=qs[_0x4bc0('0x1b')](_0x11e3f7[_0x4bc0('0x2f')][_0x4bc0('0x1b')]);_0x711f69[_0x4bc0('0x19')]=qs[_0x4bc0('0x19')](_0x11e3f7[_0x4bc0('0x2f')]['offset']);}_0x711f69[_0x4bc0('0x33')]=qs[_0x4bc0('0x34')](_0x11e3f7[_0x4bc0('0x2f')][_0x4bc0('0x34')]);_0x711f69[_0x4bc0('0x35')]=qs['filters'](_[_0x4bc0('0x36')](_0x11e3f7[_0x4bc0('0x2f')],_0x4bc8c2[_0x4bc0('0x2d')]),_0x126643);if(_0x11e3f7[_0x4bc0('0x2f')][_0x4bc0('0x37')]){_0x711f69[_0x4bc0('0x35')]=_[_0x4bc0('0x38')](_0x711f69[_0x4bc0('0x35')],{'$or':_[_0x4bc0('0x29')](_0x126643,function(_0x45fb2e){if(_0x45fb2e[_0x4bc0('0x2b')]!=='VIRTUAL'){var _0x38fcf9={};_0x38fcf9[_0x45fb2e[_0x4bc0('0x26')]]={'$like':'%'+_0x11e3f7[_0x4bc0('0x2f')]['filter']+'%'};return _0x38fcf9;}})});}_0x711f69=_[_0x4bc0('0x38')]({},_0x711f69,_0x11e3f7[_0x4bc0('0x39')]);var _0x210173={'where':_0x711f69[_0x4bc0('0x35')]};return db[_0x4bc0('0x3a')][_0x4bc0('0x1c')](_0x210173)['then'](function(_0x5b3750){_0x10f9d0[_0x4bc0('0x1c')]=_0x5b3750;if(_0x11e3f7[_0x4bc0('0x2f')][_0x4bc0('0x3b')]){_0x711f69['include']=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x4bc0('0x3c')](_0x711f69);})[_0x4bc0('0x23')](function(_0x10e053){_0x10f9d0[_0x4bc0('0x3d')]=_0x10e053;return _0x10f9d0;})[_0x4bc0('0x23')](respondWithFilteredResult(_0x4bdcd7,_0x711f69))[_0x4bc0('0x3e')](handleError(_0x4bdcd7,null));};exports['show']=function(_0x1f3274,_0x10da98){var _0x313eaf={'raw':![],'where':{'id':_0x1f3274[_0x4bc0('0x3f')]['id']}},_0x278cac={};_0x278cac[_0x4bc0('0x2c')]=_[_0x4bc0('0x40')](db[_0x4bc0('0x3a')][_0x4bc0('0x41')]);_0x278cac[_0x4bc0('0x2f')]=_[_0x4bc0('0x40')](_0x1f3274['query']);_0x278cac[_0x4bc0('0x2d')]=_[_0x4bc0('0x2e')](_0x278cac[_0x4bc0('0x2c')],_0x278cac['query']);_0x313eaf['attributes']=_[_0x4bc0('0x2e')](_0x278cac[_0x4bc0('0x2c')],qs[_0x4bc0('0x30')](_0x1f3274[_0x4bc0('0x2f')][_0x4bc0('0x30')]));_0x313eaf[_0x4bc0('0x31')]=_0x313eaf[_0x4bc0('0x31')][_0x4bc0('0x42')]?_0x313eaf[_0x4bc0('0x31')]:_0x278cac[_0x4bc0('0x2c')];if(_0x1f3274[_0x4bc0('0x2f')][_0x4bc0('0x3b')]){_0x313eaf['include']=[{'all':!![]}];}_0x313eaf=_[_0x4bc0('0x38')]({},_0x313eaf,_0x1f3274[_0x4bc0('0x39')]);return db[_0x4bc0('0x3a')]['find'](_0x313eaf)[_0x4bc0('0x23')](handleEntityNotFound(_0x10da98,null))[_0x4bc0('0x23')](respondWithResult(_0x10da98,null))[_0x4bc0('0x3e')](handleError(_0x10da98,null));};exports['create']=function(_0x2c09fd,_0x29d050){return db[_0x4bc0('0x3a')][_0x4bc0('0x43')](_0x2c09fd['body'],{})[_0x4bc0('0x23')](respondWithResult(_0x29d050,0xc9))[_0x4bc0('0x3e')](handleError(_0x29d050,null));};exports[_0x4bc0('0x22')]=function(_0x477e85,_0x12b07c){if(_0x477e85[_0x4bc0('0x44')]['id']){delete _0x477e85[_0x4bc0('0x44')]['id'];}return db[_0x4bc0('0x3a')][_0x4bc0('0x45')]({'where':{'id':_0x477e85[_0x4bc0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x12b07c,null))[_0x4bc0('0x23')](saveUpdates(_0x477e85['body'],null))[_0x4bc0('0x23')](respondWithResult(_0x12b07c,null))[_0x4bc0('0x3e')](handleError(_0x12b07c,null));};exports[_0x4bc0('0x24')]=function(_0x101c30,_0xa9035e){return db[_0x4bc0('0x3a')][_0x4bc0('0x45')]({'where':{'id':_0x101c30[_0x4bc0('0x3f')]['id']}})['then'](handleEntityNotFound(_0xa9035e,null))[_0x4bc0('0x23')](removeEntity(_0xa9035e,null))['catch'](handleError(_0xa9035e,null));};exports['getFields']=function(_0x12dae6,_0x43e624,_0x79f1b4){var _0x2f5725={};var _0x1c303c={};var _0x3b3bbb;var _0x1118a6;return db[_0x4bc0('0x3a')][_0x4bc0('0x46')]({'where':{'id':_0x12dae6[_0x4bc0('0x3f')]['id']}})[_0x4bc0('0x23')](handleEntityNotFound(_0x43e624,null))[_0x4bc0('0x23')](function(_0x4c9925){if(_0x4c9925){_0x3b3bbb=_0x4c9925;_0x1c303c[_0x4bc0('0x2c')]=_[_0x4bc0('0x40')](db[_0x4bc0('0x47')][_0x4bc0('0x41')]);_0x1c303c[_0x4bc0('0x2f')]=_[_0x4bc0('0x40')](_0x12dae6[_0x4bc0('0x2f')]);_0x1c303c[_0x4bc0('0x2d')]=_[_0x4bc0('0x2e')](_0x1c303c['model'],_0x1c303c[_0x4bc0('0x2f')]);_0x2f5725[_0x4bc0('0x31')]=_[_0x4bc0('0x2e')](_0x1c303c[_0x4bc0('0x2c')],qs[_0x4bc0('0x30')](_0x12dae6['query'][_0x4bc0('0x30')]));_0x2f5725[_0x4bc0('0x31')]=_0x2f5725['attributes'][_0x4bc0('0x42')]?_0x2f5725['attributes']:_0x1c303c[_0x4bc0('0x2c')];_0x2f5725[_0x4bc0('0x33')]=qs['sort'](_0x12dae6[_0x4bc0('0x2f')]['sort']);_0x2f5725[_0x4bc0('0x35')]=qs['filters'](_[_0x4bc0('0x36')](_0x12dae6[_0x4bc0('0x2f')],_0x1c303c[_0x4bc0('0x2d')]));if(_0x12dae6[_0x4bc0('0x2f')]['filter']){_0x2f5725[_0x4bc0('0x35')]=_['merge'](_0x2f5725[_0x4bc0('0x35')],{'$or':_['map'](_0x2f5725[_0x4bc0('0x31')],function(_0x586942){var _0x20f5f2={};_0x20f5f2[_0x586942]={'$like':'%'+_0x12dae6[_0x4bc0('0x2f')]['filter']+'%'};return _0x20f5f2;})});}_0x2f5725=_[_0x4bc0('0x38')]({},_0x2f5725,_0x12dae6['options']);return _0x3b3bbb['getFields'](_0x2f5725);}})[_0x4bc0('0x23')](function(_0x46d5c5){if(_0x46d5c5){_0x1118a6=_0x46d5c5[_0x4bc0('0x42')];if(!_0x12dae6[_0x4bc0('0x2f')][_0x4bc0('0x32')](_0x4bc0('0x48'))){_0x2f5725['limit']=qs['limit'](_0x12dae6[_0x4bc0('0x2f')]['limit']);_0x2f5725[_0x4bc0('0x19')]=qs[_0x4bc0('0x19')](_0x12dae6['query']['offset']);}return _0x3b3bbb['getFields'](_0x2f5725);}})[_0x4bc0('0x23')](function(_0x551a92){if(_0x551a92){return _0x551a92?{'count':_0x1118a6,'rows':_0x551a92}:null;}})[_0x4bc0('0x23')](respondWithResult(_0x43e624,null))[_0x4bc0('0x3e')](handleError(_0x43e624,null));};exports[_0x4bc0('0x49')]=function(_0x16b464,_0x5d5b8f,_0xaac596){var _0x3d275a={};var _0x4be8db={};var _0x46b5a4;var _0x575774;return db[_0x4bc0('0x3a')][_0x4bc0('0x46')]({'where':{'id':_0x16b464[_0x4bc0('0x3f')]['id']}})[_0x4bc0('0x23')](handleEntityNotFound(_0x5d5b8f,null))[_0x4bc0('0x23')](function(_0x5f3b1c){if(_0x5f3b1c){_0x46b5a4=_0x5f3b1c;_0x4be8db[_0x4bc0('0x2c')]=_[_0x4bc0('0x40')](db[_0x4bc0('0x47')]['rawAttributes']);_0x4be8db[_0x4bc0('0x2f')]=_[_0x4bc0('0x40')](_0x16b464[_0x4bc0('0x2f')]);_0x4be8db[_0x4bc0('0x2d')]=_[_0x4bc0('0x2e')](_0x4be8db['model'],_0x4be8db[_0x4bc0('0x2f')]);_0x3d275a[_0x4bc0('0x31')]=_[_0x4bc0('0x2e')](_0x4be8db[_0x4bc0('0x2c')],qs[_0x4bc0('0x30')](_0x16b464[_0x4bc0('0x2f')][_0x4bc0('0x30')]));_0x3d275a[_0x4bc0('0x31')]=_0x3d275a[_0x4bc0('0x31')]['length']?_0x3d275a[_0x4bc0('0x31')]:_0x4be8db[_0x4bc0('0x2c')];_0x3d275a[_0x4bc0('0x33')]=qs[_0x4bc0('0x34')](_0x16b464[_0x4bc0('0x2f')]['sort']);_0x3d275a[_0x4bc0('0x35')]=qs[_0x4bc0('0x2d')](_[_0x4bc0('0x36')](_0x16b464['query'],_0x4be8db['filters']));if(_0x16b464['query'][_0x4bc0('0x37')]){_0x3d275a[_0x4bc0('0x35')]=_['merge'](_0x3d275a[_0x4bc0('0x35')],{'$or':_['map'](_0x3d275a[_0x4bc0('0x31')],function(_0x3323aa){var _0x32a8cc={};_0x32a8cc[_0x3323aa]={'$like':'%'+_0x16b464['query'][_0x4bc0('0x37')]+'%'};return _0x32a8cc;})});}_0x3d275a=_['merge']({},_0x3d275a,_0x16b464[_0x4bc0('0x39')]);return _0x46b5a4['getSubjects'](_0x3d275a);}})[_0x4bc0('0x23')](function(_0x67626d){if(_0x67626d){_0x575774=_0x67626d[_0x4bc0('0x42')];if(!_0x16b464[_0x4bc0('0x2f')][_0x4bc0('0x32')](_0x4bc0('0x48'))){_0x3d275a[_0x4bc0('0x1b')]=qs[_0x4bc0('0x1b')](_0x16b464[_0x4bc0('0x2f')]['limit']);_0x3d275a[_0x4bc0('0x19')]=qs[_0x4bc0('0x19')](_0x16b464[_0x4bc0('0x2f')][_0x4bc0('0x19')]);}return _0x46b5a4[_0x4bc0('0x49')](_0x3d275a);}})[_0x4bc0('0x23')](function(_0x5aba0d){if(_0x5aba0d){return _0x5aba0d?{'count':_0x575774,'rows':_0x5aba0d}:null;}})[_0x4bc0('0x23')](respondWithResult(_0x5d5b8f,null))[_0x4bc0('0x3e')](handleError(_0x5d5b8f,null));};exports[_0x4bc0('0x4a')]=function(_0x58d6fa,_0x4e7c1b,_0x3fb446){var _0x860854={};var _0x3f3398={};var _0x548a73;var _0x287d40;return db[_0x4bc0('0x3a')][_0x4bc0('0x46')]({'where':{'id':_0x58d6fa[_0x4bc0('0x3f')]['id']}})[_0x4bc0('0x23')](handleEntityNotFound(_0x4e7c1b,null))[_0x4bc0('0x23')](function(_0x2e0559){if(_0x2e0559){_0x548a73=_0x2e0559;_0x3f3398[_0x4bc0('0x2c')]=_[_0x4bc0('0x40')](db[_0x4bc0('0x47')][_0x4bc0('0x41')]);_0x3f3398[_0x4bc0('0x2f')]=_['keys'](_0x58d6fa[_0x4bc0('0x2f')]);_0x3f3398['filters']=_['intersection'](_0x3f3398[_0x4bc0('0x2c')],_0x3f3398['query']);_0x860854[_0x4bc0('0x31')]=_[_0x4bc0('0x2e')](_0x3f3398[_0x4bc0('0x2c')],qs[_0x4bc0('0x30')](_0x58d6fa[_0x4bc0('0x2f')][_0x4bc0('0x30')]));_0x860854[_0x4bc0('0x31')]=_0x860854[_0x4bc0('0x31')][_0x4bc0('0x42')]?_0x860854[_0x4bc0('0x31')]:_0x3f3398[_0x4bc0('0x2c')];_0x860854[_0x4bc0('0x33')]=qs[_0x4bc0('0x34')](_0x58d6fa[_0x4bc0('0x2f')][_0x4bc0('0x34')]);_0x860854[_0x4bc0('0x35')]=qs[_0x4bc0('0x2d')](_[_0x4bc0('0x36')](_0x58d6fa[_0x4bc0('0x2f')],_0x3f3398[_0x4bc0('0x2d')]));if(_0x58d6fa[_0x4bc0('0x2f')][_0x4bc0('0x37')]){_0x860854[_0x4bc0('0x35')]=_[_0x4bc0('0x38')](_0x860854[_0x4bc0('0x35')],{'$or':_[_0x4bc0('0x29')](_0x860854[_0x4bc0('0x31')],function(_0x42d77c){var _0x451892={};_0x451892[_0x42d77c]={'$like':'%'+_0x58d6fa[_0x4bc0('0x2f')][_0x4bc0('0x37')]+'%'};return _0x451892;})});}_0x860854=_[_0x4bc0('0x38')]({},_0x860854,_0x58d6fa[_0x4bc0('0x39')]);return _0x548a73[_0x4bc0('0x4a')](_0x860854);}})[_0x4bc0('0x23')](function(_0x554340){if(_0x554340){_0x287d40=_0x554340[_0x4bc0('0x42')];if(!_0x58d6fa[_0x4bc0('0x2f')][_0x4bc0('0x32')](_0x4bc0('0x48'))){_0x860854[_0x4bc0('0x1b')]=qs[_0x4bc0('0x1b')](_0x58d6fa['query']['limit']);_0x860854['offset']=qs[_0x4bc0('0x19')](_0x58d6fa[_0x4bc0('0x2f')]['offset']);}return _0x548a73[_0x4bc0('0x4a')](_0x860854);}})[_0x4bc0('0x23')](function(_0x52d281){if(_0x52d281){return _0x52d281?{'count':_0x287d40,'rows':_0x52d281}:null;}})['then'](respondWithResult(_0x4e7c1b,null))[_0x4bc0('0x3e')](handleError(_0x4e7c1b,null));}; \ No newline at end of file +var _0xdb81=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','Dynamics365Configuration','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','create','body','catch','findOne','Dynamics365Field','nolimit','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0xdb81,0xf8));var _0x1db8=function(_0x2657c1,_0x50043d){_0x2657c1=_0x2657c1-0x0;var _0x2a94c3=_0xdb81[_0x2657c1];return _0x2a94c3;};'use strict';var emlformat=require(_0x1db8('0x0'));var rimraf=require(_0x1db8('0x1'));var zipdir=require(_0x1db8('0x2'));var jsonpatch=require(_0x1db8('0x3'));var rp=require('request-promise');var moment=require(_0x1db8('0x4'));var BPromise=require(_0x1db8('0x5'));var Mustache=require(_0x1db8('0x6'));var util=require(_0x1db8('0x7'));var path=require(_0x1db8('0x8'));var sox=require(_0x1db8('0x9'));var csv=require(_0x1db8('0xa'));var ejs=require(_0x1db8('0xb'));var fs=require('fs');var fs_extra=require(_0x1db8('0xc'));var _=require(_0x1db8('0xd'));var squel=require(_0x1db8('0xe'));var crypto=require(_0x1db8('0xf'));var jsforce=require(_0x1db8('0x10'));var deskjs=require(_0x1db8('0x11'));var toCsv=require('to-csv');var querystring=require(_0x1db8('0x12'));var Papa=require(_0x1db8('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1db8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1db8('0x15'));var logger=require(_0x1db8('0x16'))(_0x1db8('0x17'));var utils=require(_0x1db8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x1db8('0x19'));var db=require(_0x1db8('0x1a'))['db'];function respondWithStatusCode(_0x1771d3,_0x2d68fc){_0x2d68fc=_0x2d68fc||0xcc;return function(_0x5476af){if(_0x5476af){return _0x1771d3[_0x1db8('0x1b')](_0x2d68fc);}return _0x1771d3['status'](_0x2d68fc)['end']();};}function respondWithResult(_0x16de20,_0x131e84){_0x131e84=_0x131e84||0xc8;return function(_0x1f2f74){if(_0x1f2f74){return _0x16de20[_0x1db8('0x1c')](_0x131e84)[_0x1db8('0x1d')](_0x1f2f74);}};}function respondWithFilteredResult(_0x226b88,_0x50ed1f){return function(_0x3f1ee5){if(_0x3f1ee5){var _0xb030e2=typeof _0x50ed1f[_0x1db8('0x1e')]==='undefined'&&typeof _0x50ed1f[_0x1db8('0x1f')]===_0x1db8('0x20');var _0x1b02af=_0x3f1ee5[_0x1db8('0x21')];var _0x53d6d3=_0xb030e2?0x0:_0x50ed1f['offset'];var _0x140d80=_0xb030e2?_0x3f1ee5[_0x1db8('0x21')]:_0x50ed1f[_0x1db8('0x1e')]+_0x50ed1f[_0x1db8('0x1f')];var _0x157fbe;if(_0x140d80>=_0x1b02af){_0x140d80=_0x1b02af;_0x157fbe=0xc8;}else{_0x157fbe=0xce;}_0x226b88[_0x1db8('0x1c')](_0x157fbe);return _0x226b88[_0x1db8('0x22')](_0x1db8('0x23'),_0x53d6d3+'-'+_0x140d80+'/'+_0x1b02af)[_0x1db8('0x1d')](_0x3f1ee5);}return null;};}function patchUpdates(_0x31867a){return function(_0x508e81){try{jsonpatch['apply'](_0x508e81,_0x31867a,!![]);}catch(_0x29a28c){return BPromise['reject'](_0x29a28c);}return _0x508e81[_0x1db8('0x24')]();};}function saveUpdates(_0x144593,_0x3585ed){return function(_0x4ae3a7){if(_0x4ae3a7){return _0x4ae3a7[_0x1db8('0x25')](_0x144593)[_0x1db8('0x26')](function(_0x585613){return _0x585613;});}return null;};}function removeEntity(_0x4d69ae,_0xd7cfe7){return function(_0x2687ab){if(_0x2687ab){return _0x2687ab[_0x1db8('0x27')]()['then'](function(){_0x4d69ae['status'](0xcc)[_0x1db8('0x28')]();});}};}function handleEntityNotFound(_0x2fd170,_0x543d29){return function(_0x30b973){if(!_0x30b973){_0x2fd170['sendStatus'](0x194);}return _0x30b973;};}function handleError(_0x73177a,_0x20fad5){_0x20fad5=_0x20fad5||0x1f4;return function(_0x3451bb){logger[_0x1db8('0x29')](_0x3451bb[_0x1db8('0x2a')]);if(_0x3451bb[_0x1db8('0x2b')]){delete _0x3451bb[_0x1db8('0x2b')];}_0x73177a[_0x1db8('0x1c')](_0x20fad5)[_0x1db8('0x2c')](_0x3451bb);};}exports[_0x1db8('0x2d')]=function(_0x4d3fa9,_0x486623){var _0x4c603c={},_0x412121={},_0x1db8a9={'count':0x0,'rows':[]};var _0x5cfc10=_[_0x1db8('0x2e')](db['Dynamics365Configuration']['rawAttributes'],function(_0x2cbea3){return{'name':_0x2cbea3[_0x1db8('0x2f')],'type':_0x2cbea3[_0x1db8('0x30')][_0x1db8('0x31')]};});_0x412121[_0x1db8('0x32')]=_[_0x1db8('0x2e')](_0x5cfc10,'name');_0x412121[_0x1db8('0x33')]=_['keys'](_0x4d3fa9[_0x1db8('0x33')]);_0x412121[_0x1db8('0x34')]=_[_0x1db8('0x35')](_0x412121['model'],_0x412121[_0x1db8('0x33')]);_0x4c603c['attributes']=_[_0x1db8('0x35')](_0x412121['model'],qs[_0x1db8('0x36')](_0x4d3fa9[_0x1db8('0x33')]['fields']));_0x4c603c[_0x1db8('0x37')]=_0x4c603c['attributes'][_0x1db8('0x38')]?_0x4c603c[_0x1db8('0x37')]:_0x412121['model'];if(!_0x4d3fa9[_0x1db8('0x33')][_0x1db8('0x39')]('nolimit')){_0x4c603c[_0x1db8('0x1f')]=qs['limit'](_0x4d3fa9['query'][_0x1db8('0x1f')]);_0x4c603c[_0x1db8('0x1e')]=qs[_0x1db8('0x1e')](_0x4d3fa9[_0x1db8('0x33')]['offset']);}_0x4c603c[_0x1db8('0x3a')]=qs[_0x1db8('0x3b')](_0x4d3fa9[_0x1db8('0x33')][_0x1db8('0x3b')]);_0x4c603c[_0x1db8('0x3c')]=qs[_0x1db8('0x34')](_[_0x1db8('0x3d')](_0x4d3fa9[_0x1db8('0x33')],_0x412121[_0x1db8('0x34')]),_0x5cfc10);if(_0x4d3fa9[_0x1db8('0x33')]['filter']){_0x4c603c[_0x1db8('0x3c')]=_[_0x1db8('0x3e')](_0x4c603c['where'],{'$or':_[_0x1db8('0x2e')](_0x5cfc10,function(_0x2380f6){if(_0x2380f6[_0x1db8('0x30')]!==_0x1db8('0x3f')){var _0x439447={};_0x439447[_0x2380f6[_0x1db8('0x2b')]]={'$like':'%'+_0x4d3fa9[_0x1db8('0x33')][_0x1db8('0x40')]+'%'};return _0x439447;}})});}_0x4c603c=_[_0x1db8('0x3e')]({},_0x4c603c,_0x4d3fa9[_0x1db8('0x41')]);var _0x647090={'where':_0x4c603c['where']};return db[_0x1db8('0x42')][_0x1db8('0x21')](_0x647090)[_0x1db8('0x26')](function(_0x563194){_0x1db8a9[_0x1db8('0x21')]=_0x563194;if(_0x4d3fa9['query'][_0x1db8('0x43')]){_0x4c603c[_0x1db8('0x44')]=[{'all':!![]}];}return db[_0x1db8('0x42')][_0x1db8('0x45')](_0x4c603c);})[_0x1db8('0x26')](function(_0x3cc56a){_0x1db8a9[_0x1db8('0x46')]=_0x3cc56a;return _0x1db8a9;})['then'](respondWithFilteredResult(_0x486623,_0x4c603c))['catch'](handleError(_0x486623,null));};exports[_0x1db8('0x47')]=function(_0x3f52f2,_0x334aff){var _0x420293={'raw':![],'where':{'id':_0x3f52f2[_0x1db8('0x48')]['id']}},_0x2ee3b7={};_0x2ee3b7[_0x1db8('0x32')]=_[_0x1db8('0x49')](db['Dynamics365Configuration'][_0x1db8('0x4a')]);_0x2ee3b7[_0x1db8('0x33')]=_[_0x1db8('0x49')](_0x3f52f2[_0x1db8('0x33')]);_0x2ee3b7[_0x1db8('0x34')]=_[_0x1db8('0x35')](_0x2ee3b7[_0x1db8('0x32')],_0x2ee3b7['query']);_0x420293['attributes']=_[_0x1db8('0x35')](_0x2ee3b7[_0x1db8('0x32')],qs[_0x1db8('0x36')](_0x3f52f2[_0x1db8('0x33')][_0x1db8('0x36')]));_0x420293[_0x1db8('0x37')]=_0x420293[_0x1db8('0x37')][_0x1db8('0x38')]?_0x420293[_0x1db8('0x37')]:_0x2ee3b7[_0x1db8('0x32')];if(_0x3f52f2['query'][_0x1db8('0x43')]){_0x420293['include']=[{'all':!![]}];}_0x420293=_[_0x1db8('0x3e')]({},_0x420293,_0x3f52f2['options']);return db[_0x1db8('0x42')][_0x1db8('0x4b')](_0x420293)['then'](handleEntityNotFound(_0x334aff,null))['then'](respondWithResult(_0x334aff,null))['catch'](handleError(_0x334aff,null));};exports[_0x1db8('0x4c')]=function(_0x141ed5,_0x43f868){return db[_0x1db8('0x42')]['create'](_0x141ed5[_0x1db8('0x4d')],{})[_0x1db8('0x26')](respondWithResult(_0x43f868,0xc9))[_0x1db8('0x4e')](handleError(_0x43f868,null));};exports[_0x1db8('0x25')]=function(_0x2de337,_0x23deb7){if(_0x2de337[_0x1db8('0x4d')]['id']){delete _0x2de337[_0x1db8('0x4d')]['id'];}return db[_0x1db8('0x42')][_0x1db8('0x4b')]({'where':{'id':_0x2de337['params']['id']}})['then'](handleEntityNotFound(_0x23deb7,null))[_0x1db8('0x26')](saveUpdates(_0x2de337[_0x1db8('0x4d')],null))[_0x1db8('0x26')](respondWithResult(_0x23deb7,null))[_0x1db8('0x4e')](handleError(_0x23deb7,null));};exports[_0x1db8('0x27')]=function(_0x4ec73e,_0x127dd3){return db[_0x1db8('0x42')][_0x1db8('0x4b')]({'where':{'id':_0x4ec73e[_0x1db8('0x48')]['id']}})[_0x1db8('0x26')](handleEntityNotFound(_0x127dd3,null))[_0x1db8('0x26')](removeEntity(_0x127dd3,null))['catch'](handleError(_0x127dd3,null));};exports['getFields']=function(_0x4c772a,_0x59056f,_0x43ca4d){var _0x3b7eaa={};var _0xde3520={};var _0x50c628;var _0x264f66;return db[_0x1db8('0x42')][_0x1db8('0x4f')]({'where':{'id':_0x4c772a[_0x1db8('0x48')]['id']}})[_0x1db8('0x26')](handleEntityNotFound(_0x59056f,null))[_0x1db8('0x26')](function(_0x2475c3){if(_0x2475c3){_0x50c628=_0x2475c3;_0xde3520[_0x1db8('0x32')]=_[_0x1db8('0x49')](db[_0x1db8('0x50')][_0x1db8('0x4a')]);_0xde3520[_0x1db8('0x33')]=_[_0x1db8('0x49')](_0x4c772a[_0x1db8('0x33')]);_0xde3520[_0x1db8('0x34')]=_[_0x1db8('0x35')](_0xde3520['model'],_0xde3520[_0x1db8('0x33')]);_0x3b7eaa[_0x1db8('0x37')]=_['intersection'](_0xde3520[_0x1db8('0x32')],qs[_0x1db8('0x36')](_0x4c772a[_0x1db8('0x33')][_0x1db8('0x36')]));_0x3b7eaa[_0x1db8('0x37')]=_0x3b7eaa[_0x1db8('0x37')][_0x1db8('0x38')]?_0x3b7eaa[_0x1db8('0x37')]:_0xde3520[_0x1db8('0x32')];_0x3b7eaa['order']=qs[_0x1db8('0x3b')](_0x4c772a[_0x1db8('0x33')][_0x1db8('0x3b')]);_0x3b7eaa[_0x1db8('0x3c')]=qs['filters'](_[_0x1db8('0x3d')](_0x4c772a[_0x1db8('0x33')],_0xde3520['filters']));if(_0x4c772a['query'][_0x1db8('0x40')]){_0x3b7eaa[_0x1db8('0x3c')]=_[_0x1db8('0x3e')](_0x3b7eaa[_0x1db8('0x3c')],{'$or':_[_0x1db8('0x2e')](_0x3b7eaa[_0x1db8('0x37')],function(_0x30e345){var _0x552b1a={};_0x552b1a[_0x30e345]={'$like':'%'+_0x4c772a[_0x1db8('0x33')][_0x1db8('0x40')]+'%'};return _0x552b1a;})});}_0x3b7eaa=_[_0x1db8('0x3e')]({},_0x3b7eaa,_0x4c772a[_0x1db8('0x41')]);return _0x50c628['getFields'](_0x3b7eaa);}})[_0x1db8('0x26')](function(_0x164120){if(_0x164120){_0x264f66=_0x164120[_0x1db8('0x38')];if(!_0x4c772a[_0x1db8('0x33')][_0x1db8('0x39')](_0x1db8('0x51'))){_0x3b7eaa[_0x1db8('0x1f')]=qs[_0x1db8('0x1f')](_0x4c772a[_0x1db8('0x33')][_0x1db8('0x1f')]);_0x3b7eaa['offset']=qs[_0x1db8('0x1e')](_0x4c772a[_0x1db8('0x33')][_0x1db8('0x1e')]);}return _0x50c628[_0x1db8('0x52')](_0x3b7eaa);}})[_0x1db8('0x26')](function(_0x235623){if(_0x235623){return _0x235623?{'count':_0x264f66,'rows':_0x235623}:null;}})[_0x1db8('0x26')](respondWithResult(_0x59056f,null))['catch'](handleError(_0x59056f,null));};exports['getSubjects']=function(_0x2a8b60,_0x308a54,_0x50e8b6){var _0x47330d={};var _0x32f23e={};var _0x13ec32;var _0x298167;return db['Dynamics365Configuration'][_0x1db8('0x4f')]({'where':{'id':_0x2a8b60['params']['id']}})[_0x1db8('0x26')](handleEntityNotFound(_0x308a54,null))[_0x1db8('0x26')](function(_0xbe5536){if(_0xbe5536){_0x13ec32=_0xbe5536;_0x32f23e[_0x1db8('0x32')]=_[_0x1db8('0x49')](db[_0x1db8('0x50')]['rawAttributes']);_0x32f23e['query']=_['keys'](_0x2a8b60[_0x1db8('0x33')]);_0x32f23e['filters']=_[_0x1db8('0x35')](_0x32f23e[_0x1db8('0x32')],_0x32f23e[_0x1db8('0x33')]);_0x47330d['attributes']=_[_0x1db8('0x35')](_0x32f23e['model'],qs['fields'](_0x2a8b60[_0x1db8('0x33')]['fields']));_0x47330d[_0x1db8('0x37')]=_0x47330d['attributes'][_0x1db8('0x38')]?_0x47330d['attributes']:_0x32f23e[_0x1db8('0x32')];_0x47330d['order']=qs[_0x1db8('0x3b')](_0x2a8b60[_0x1db8('0x33')][_0x1db8('0x3b')]);_0x47330d[_0x1db8('0x3c')]=qs[_0x1db8('0x34')](_['pick'](_0x2a8b60[_0x1db8('0x33')],_0x32f23e[_0x1db8('0x34')]));if(_0x2a8b60['query'][_0x1db8('0x40')]){_0x47330d[_0x1db8('0x3c')]=_['merge'](_0x47330d['where'],{'$or':_[_0x1db8('0x2e')](_0x47330d['attributes'],function(_0xd2312e){var _0x4af5e6={};_0x4af5e6[_0xd2312e]={'$like':'%'+_0x2a8b60[_0x1db8('0x33')][_0x1db8('0x40')]+'%'};return _0x4af5e6;})});}_0x47330d=_[_0x1db8('0x3e')]({},_0x47330d,_0x2a8b60[_0x1db8('0x41')]);return _0x13ec32[_0x1db8('0x53')](_0x47330d);}})[_0x1db8('0x26')](function(_0x4829c0){if(_0x4829c0){_0x298167=_0x4829c0['length'];if(!_0x2a8b60[_0x1db8('0x33')]['hasOwnProperty'](_0x1db8('0x51'))){_0x47330d[_0x1db8('0x1f')]=qs['limit'](_0x2a8b60[_0x1db8('0x33')][_0x1db8('0x1f')]);_0x47330d[_0x1db8('0x1e')]=qs[_0x1db8('0x1e')](_0x2a8b60[_0x1db8('0x33')][_0x1db8('0x1e')]);}return _0x13ec32[_0x1db8('0x53')](_0x47330d);}})[_0x1db8('0x26')](function(_0x355d6e){if(_0x355d6e){return _0x355d6e?{'count':_0x298167,'rows':_0x355d6e}:null;}})['then'](respondWithResult(_0x308a54,null))[_0x1db8('0x4e')](handleError(_0x308a54,null));};exports['getDescriptions']=function(_0x114c8e,_0x35c1ea,_0x428e03){var _0x33b13f={};var _0x959780={};var _0x15c2a7;var _0x78d2ab;return db['Dynamics365Configuration'][_0x1db8('0x4f')]({'where':{'id':_0x114c8e[_0x1db8('0x48')]['id']}})[_0x1db8('0x26')](handleEntityNotFound(_0x35c1ea,null))[_0x1db8('0x26')](function(_0x5e9a32){if(_0x5e9a32){_0x15c2a7=_0x5e9a32;_0x959780['model']=_[_0x1db8('0x49')](db[_0x1db8('0x50')][_0x1db8('0x4a')]);_0x959780[_0x1db8('0x33')]=_[_0x1db8('0x49')](_0x114c8e[_0x1db8('0x33')]);_0x959780['filters']=_[_0x1db8('0x35')](_0x959780[_0x1db8('0x32')],_0x959780[_0x1db8('0x33')]);_0x33b13f[_0x1db8('0x37')]=_[_0x1db8('0x35')](_0x959780[_0x1db8('0x32')],qs[_0x1db8('0x36')](_0x114c8e[_0x1db8('0x33')]['fields']));_0x33b13f[_0x1db8('0x37')]=_0x33b13f[_0x1db8('0x37')]['length']?_0x33b13f[_0x1db8('0x37')]:_0x959780['model'];_0x33b13f['order']=qs['sort'](_0x114c8e[_0x1db8('0x33')][_0x1db8('0x3b')]);_0x33b13f[_0x1db8('0x3c')]=qs[_0x1db8('0x34')](_[_0x1db8('0x3d')](_0x114c8e[_0x1db8('0x33')],_0x959780[_0x1db8('0x34')]));if(_0x114c8e['query'][_0x1db8('0x40')]){_0x33b13f[_0x1db8('0x3c')]=_[_0x1db8('0x3e')](_0x33b13f[_0x1db8('0x3c')],{'$or':_[_0x1db8('0x2e')](_0x33b13f[_0x1db8('0x37')],function(_0x47d738){var _0x1eaf93={};_0x1eaf93[_0x47d738]={'$like':'%'+_0x114c8e[_0x1db8('0x33')][_0x1db8('0x40')]+'%'};return _0x1eaf93;})});}_0x33b13f=_['merge']({},_0x33b13f,_0x114c8e[_0x1db8('0x41')]);return _0x15c2a7[_0x1db8('0x54')](_0x33b13f);}})[_0x1db8('0x26')](function(_0x1e4c5a){if(_0x1e4c5a){_0x78d2ab=_0x1e4c5a[_0x1db8('0x38')];if(!_0x114c8e[_0x1db8('0x33')]['hasOwnProperty']('nolimit')){_0x33b13f[_0x1db8('0x1f')]=qs[_0x1db8('0x1f')](_0x114c8e['query'][_0x1db8('0x1f')]);_0x33b13f[_0x1db8('0x1e')]=qs[_0x1db8('0x1e')](_0x114c8e[_0x1db8('0x33')]['offset']);}return _0x15c2a7[_0x1db8('0x54')](_0x33b13f);}})[_0x1db8('0x26')](function(_0x5626b4){if(_0x5626b4){return _0x5626b4?{'count':_0x78d2ab,'rows':_0x5626b4}:null;}})['then'](respondWithResult(_0x35c1ea,null))[_0x1db8('0x4e')](handleError(_0x35c1ea,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index bbf3d7e..f0f6c52 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 _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3503e6,_0x18e54c){var _0x4c223e=function(_0x319599){while(--_0x319599){_0x3503e6['push'](_0x3503e6['shift']());}};_0x4c223e(++_0x18e54c);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x15a6e1,_0xcf2811){_0x15a6e1=_0x15a6e1-0x0;var _0x11655b=_0xd6d6[_0x15a6e1];return _0x11655b;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9bde=['request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','api','bluebird'];(function(_0x230405,_0x19673b){var _0x59bb74=function(_0x398f23){while(--_0x398f23){_0x230405['push'](_0x230405['shift']());}};_0x59bb74(++_0x19673b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x23844a,_0x296752){_0x23844a=_0x23844a-0x0;var _0x564497=_0x9bde[_0x23844a];return _0x564497;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var moment=require('moment');var BPromise=require(_0xe9bd('0x2'));var rp=require(_0xe9bd('0x3'));var fs=require('fs');var path=require(_0xe9bd('0x4'));var rimraf=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var attributes=require(_0xe9bd('0x7'));module[_0xe9bd('0x8')]=function(_0x4fd7b8,_0x4763e9){return _0x4fd7b8[_0xe9bd('0x9')](_0xe9bd('0xa'),attributes,{'tableName':_0xe9bd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 658eacd..c13326d 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 _0x26b7=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../config/utils','../../config/logger'];(function(_0x11475a,_0x3bc26f){var _0x490971=function(_0x2baed4){while(--_0x2baed4){_0x11475a['push'](_0x11475a['shift']());}};_0x490971(++_0x3bc26f);}(_0x26b7,0x9c));var _0x726b=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x26b7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x726b('0x0'));var util=require(_0x726b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x726b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x726b('0x3'));var logger=require(_0x726b('0x4'))(_0x726b('0x5'));var config=require(_0x726b('0x6'));var jayson=require(_0x726b('0x7'));var client=jayson[_0x726b('0x8')][_0x726b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15fc10,_0x3807ae,_0x482655){return new BPromise(function(_0xaeb0fb,_0x488941){return client[_0x726b('0xa')](_0x15fc10,_0x482655)[_0x726b('0xb')](function(_0x559285){logger[_0x726b('0xc')](_0x726b('0xd'),_0x3807ae,_0x726b('0xe'));logger[_0x726b('0xf')](_0x726b('0x10'),_0x3807ae,_0x726b('0xe'),JSON[_0x726b('0x11')](_0x559285));if(_0x559285[_0x726b('0x12')]){if(_0x559285['error'][_0x726b('0x13')]===0x1f4){logger['error'](_0x726b('0xd'),_0x3807ae,_0x559285[_0x726b('0x12')]['message']);return _0x488941(_0x559285['error'][_0x726b('0x14')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x3807ae,_0x559285['error']['message']);return _0xaeb0fb(_0x559285['error'][_0x726b('0x14')]);}else{logger[_0x726b('0xc')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3807ae,_0x726b('0xe'));_0xaeb0fb(_0x559285[_0x726b('0x15')][_0x726b('0x14')]);}})[_0x726b('0x16')](function(_0x41b709){logger['error'](_0x726b('0xd'),_0x3807ae,_0x41b709);_0x488941(_0x41b709);});});} \ No newline at end of file +var _0x0564=['jayson/promise','client','http','then','Dynamics365Configuration,\x20%s,\x20%s','debug','stringify','error','code','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x26253d,_0x5dfc80){var _0x318a82=function(_0x22ae6a){while(--_0x22ae6a){_0x26253d['push'](_0x26253d['shift']());}};_0x318a82(++_0x5dfc80);}(_0x0564,0x1d9));var _0x4056=function(_0x3d2089,_0x155ee1){_0x3d2089=_0x3d2089-0x0;var _0x41a399=_0x0564[_0x3d2089];return _0x41a399;};'use strict';var _=require('lodash');var util=require(_0x4056('0x0'));var moment=require(_0x4056('0x1'));var BPromise=require('bluebird');var rs=require(_0x4056('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4056('0x3'))['db'];var utils=require(_0x4056('0x4'));var logger=require('../../config/logger')(_0x4056('0x5'));var config=require(_0x4056('0x6'));var jayson=require(_0x4056('0x7'));var client=jayson[_0x4056('0x8')][_0x4056('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a3652,_0xfcdab1,_0x3084ef){return new BPromise(function(_0x5d2e84,_0x3b17b8){return client['request'](_0x1a3652,_0x3084ef)[_0x4056('0xa')](function(_0x5b95c4){logger['info'](_0x4056('0xb'),_0xfcdab1,'request\x20sent');logger[_0x4056('0xc')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0xfcdab1,'request\x20sent',JSON[_0x4056('0xd')](_0x5b95c4));if(_0x5b95c4[_0x4056('0xe')]){if(_0x5b95c4[_0x4056('0xe')][_0x4056('0xf')]===0x1f4){logger[_0x4056('0xe')](_0x4056('0xb'),_0xfcdab1,_0x5b95c4['error'][_0x4056('0x10')]);return _0x3b17b8(_0x5b95c4['error'][_0x4056('0x10')]);}logger[_0x4056('0xe')](_0x4056('0xb'),_0xfcdab1,_0x5b95c4[_0x4056('0xe')]['message']);return _0x5d2e84(_0x5b95c4[_0x4056('0xe')]['message']);}else{logger[_0x4056('0x11')](_0x4056('0xb'),_0xfcdab1,'request\x20sent');_0x5d2e84(_0x5b95c4[_0x4056('0x12')][_0x4056('0x10')]);}})[_0x4056('0x13')](function(_0x540d43){logger[_0x4056('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0xfcdab1,_0x540d43);_0x3b17b8(_0x540d43);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 970ee6c..6486c0d 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 _0xe09f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show','post','create','put','update','delete','exports','multer','util'];(function(_0x531b16,_0x2b20b5){var _0x261bbe=function(_0x34c264){while(--_0x34c264){_0x531b16['push'](_0x531b16['shift']());}};_0x261bbe(++_0x2b20b5);}(_0xe09f,0x1e4));var _0xfe09=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xe09f[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xfe09('0x0'));var util=require(_0xfe09('0x1'));var path=require('path');var timeout=require(_0xfe09('0x2'));var express=require(_0xfe09('0x3'));var router=express[_0xfe09('0x4')]();var fs_extra=require(_0xfe09('0x5'));var auth=require(_0xfe09('0x6'));var interaction=require(_0xfe09('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xfe09('0x8')](),controller['index']);router[_0xfe09('0x9')](_0xfe09('0xa'),auth['isAuthenticated'](),controller[_0xfe09('0xb')]);router[_0xfe09('0xc')]('/',auth[_0xfe09('0x8')](),controller[_0xfe09('0xd')]);router[_0xfe09('0xe')](_0xfe09('0xa'),auth['isAuthenticated'](),controller[_0xfe09('0xf')]);router[_0xfe09('0x10')]('/:id',auth[_0xfe09('0x8')](),controller['destroy']);module[_0xfe09('0x11')]=router; \ No newline at end of file +var _0x8782=['destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8782,0x1ce));var _0x2878=function(_0x192022,_0x23385c){_0x192022=_0x192022-0x0;var _0x161d8c=_0x8782[_0x192022];return _0x161d8c;};'use strict';var multer=require(_0x2878('0x0'));var util=require('util');var path=require(_0x2878('0x1'));var timeout=require(_0x2878('0x2'));var express=require(_0x2878('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2878('0x4'));var interaction=require(_0x2878('0x5'));var config=require(_0x2878('0x6'));var controller=require(_0x2878('0x7'));router[_0x2878('0x8')]('/',auth[_0x2878('0x9')](),controller[_0x2878('0xa')]);router['get'](_0x2878('0xb'),auth[_0x2878('0x9')](),controller[_0x2878('0xc')]);router[_0x2878('0xd')]('/',auth[_0x2878('0x9')](),controller[_0x2878('0xe')]);router[_0x2878('0xf')](_0x2878('0xb'),auth[_0x2878('0x9')](),controller[_0x2878('0x10')]);router[_0x2878('0x11')](_0x2878('0xb'),auth[_0x2878('0x9')](),controller[_0x2878('0x12')]);module[_0x2878('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index fe5c17d..8544682 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 _0x1ccc=['exports','ENUM','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x465f45,_0x1a2bf0){var _0x1012c8=function(_0x568349){while(--_0x568349){_0x465f45['push'](_0x465f45['shift']());}};_0x1012c8(++_0x1a2bf0);}(_0x1ccc,0x1af));var _0xc1cc=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x1ccc[_0x81dcac];return _0xc7803b;};'use strict';var Sequelize=require(_0xc1cc('0x0'));module[_0xc1cc('0x1')]={'type':{'type':Sequelize[_0xc1cc('0x2')]('string',_0xc1cc('0x3'),_0xc1cc('0x4'),_0xc1cc('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xc1cc('0x6')]},'key':{'type':Sequelize[_0xc1cc('0x6')]},'keyType':{'type':Sequelize[_0xc1cc('0x2')]('string','variable',_0xc1cc('0x4'))},'keyContent':{'type':Sequelize[_0xc1cc('0x6')]},'idField':{'type':Sequelize[_0xc1cc('0x6')]},'nameField':{'type':Sequelize[_0xc1cc('0x6')]},'customField':{'type':Sequelize[_0xc1cc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4214=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x4214,0xa4));var _0x4421=function(_0x575a16,_0x18eefa){_0x575a16=_0x575a16-0x0;var _0x298d59=_0x4214[_0x575a16];return _0x298d59;};'use strict';var Sequelize=require('sequelize');module[_0x4421('0x0')]={'type':{'type':Sequelize[_0x4421('0x1')](_0x4421('0x2'),_0x4421('0x3'),_0x4421('0x4'),_0x4421('0x5'),_0x4421('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x4421('0x7')]},'keyType':{'type':Sequelize[_0x4421('0x1')](_0x4421('0x2'),_0x4421('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x4421('0x7')]},'idField':{'type':Sequelize[_0x4421('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4421('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4421('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 12a306f..33142d9 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 _0x2390=['filters','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','show','params','include','find','catch','create','body','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','destroy','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x91aa06,_0x2d2a2d){var _0x533ff6=function(_0x4cdd8d){while(--_0x4cdd8d){_0x91aa06['push'](_0x91aa06['shift']());}};_0x533ff6(++_0x2d2a2d);}(_0x2390,0x18c));var _0x0239=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x2390[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0239('0x0'));var jsonpatch=require(_0x0239('0x1'));var rp=require(_0x0239('0x2'));var moment=require(_0x0239('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0239('0x4'));var util=require('util');var path=require(_0x0239('0x5'));var sox=require('sox');var csv=require(_0x0239('0x6'));var ejs=require(_0x0239('0x7'));var fs=require('fs');var fs_extra=require(_0x0239('0x8'));var _=require(_0x0239('0x9'));var squel=require(_0x0239('0xa'));var crypto=require(_0x0239('0xb'));var jsforce=require(_0x0239('0xc'));var deskjs=require(_0x0239('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0239('0xe'));var Papa=require(_0x0239('0xf'));var Redis=require(_0x0239('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0239('0x11'));var hardwareService=require(_0x0239('0x12'));var logger=require(_0x0239('0x13'))(_0x0239('0x14'));var utils=require(_0x0239('0x15'));var config=require(_0x0239('0x16'));var licenseUtil=require(_0x0239('0x17'));var db=require(_0x0239('0x18'))['db'];function respondWithStatusCode(_0x292f8,_0x235206){_0x235206=_0x235206||0xcc;return function(_0x1a93c8){if(_0x1a93c8){return _0x292f8[_0x0239('0x19')](_0x235206);}return _0x292f8[_0x0239('0x1a')](_0x235206)[_0x0239('0x1b')]();};}function respondWithResult(_0x148b51,_0x5b0522){_0x5b0522=_0x5b0522||0xc8;return function(_0x124914){if(_0x124914){return _0x148b51['status'](_0x5b0522)['json'](_0x124914);}};}function respondWithFilteredResult(_0x158170,_0x2d6505){return function(_0x5359f8){if(_0x5359f8){var _0x27a36a=typeof _0x2d6505['offset']===_0x0239('0x1c')&&typeof _0x2d6505[_0x0239('0x1d')]===_0x0239('0x1c');var _0x2f2c8e=_0x5359f8[_0x0239('0x1e')];var _0x3be25f=_0x27a36a?0x0:_0x2d6505[_0x0239('0x1f')];var _0x5d1f78=_0x27a36a?_0x5359f8[_0x0239('0x1e')]:_0x2d6505[_0x0239('0x1f')]+_0x2d6505[_0x0239('0x1d')];var _0x16f506;if(_0x5d1f78>=_0x2f2c8e){_0x5d1f78=_0x2f2c8e;_0x16f506=0xc8;}else{_0x16f506=0xce;}_0x158170['status'](_0x16f506);return _0x158170['set'](_0x0239('0x20'),_0x3be25f+'-'+_0x5d1f78+'/'+_0x2f2c8e)[_0x0239('0x21')](_0x5359f8);}return null;};}function patchUpdates(_0x2928e4){return function(_0xb06f4d){try{jsonpatch['apply'](_0xb06f4d,_0x2928e4,!![]);}catch(_0x367a14){return BPromise[_0x0239('0x22')](_0x367a14);}return _0xb06f4d[_0x0239('0x23')]();};}function saveUpdates(_0x3895d8,_0x85dbbe){return function(_0xaf86b3){if(_0xaf86b3){return _0xaf86b3[_0x0239('0x24')](_0x3895d8)[_0x0239('0x25')](function(_0x50d969){return _0x50d969;});}return null;};}function removeEntity(_0xe6c093,_0x301110){return function(_0x3c4fe2){if(_0x3c4fe2){return _0x3c4fe2[_0x0239('0x26')]()['then'](function(){_0xe6c093[_0x0239('0x1a')](0xcc)[_0x0239('0x1b')]();});}};}function handleEntityNotFound(_0x4533bb,_0x576330){return function(_0x3570cc){if(!_0x3570cc){_0x4533bb[_0x0239('0x19')](0x194);}return _0x3570cc;};}function handleError(_0x29227d,_0x19d001){_0x19d001=_0x19d001||0x1f4;return function(_0x56a40a){logger[_0x0239('0x27')](_0x56a40a[_0x0239('0x28')]);if(_0x56a40a[_0x0239('0x29')]){delete _0x56a40a[_0x0239('0x29')];}_0x29227d[_0x0239('0x1a')](_0x19d001)['send'](_0x56a40a);};}exports[_0x0239('0x2a')]=function(_0xee9312,_0x2a88a1){var _0x16809f={},_0x18f37c={},_0x250a3c={'count':0x0,'rows':[]};var _0x19ed42=_[_0x0239('0x2b')](db[_0x0239('0x2c')][_0x0239('0x2d')],function(_0x244c32){return{'name':_0x244c32[_0x0239('0x2e')],'type':_0x244c32[_0x0239('0x2f')][_0x0239('0x30')]};});_0x18f37c[_0x0239('0x31')]=_[_0x0239('0x2b')](_0x19ed42,_0x0239('0x29'));_0x18f37c['query']=_[_0x0239('0x32')](_0xee9312['query']);_0x18f37c['filters']=_[_0x0239('0x33')](_0x18f37c[_0x0239('0x31')],_0x18f37c[_0x0239('0x34')]);_0x16809f[_0x0239('0x35')]=_['intersection'](_0x18f37c['model'],qs[_0x0239('0x36')](_0xee9312['query']['fields']));_0x16809f[_0x0239('0x35')]=_0x16809f[_0x0239('0x35')][_0x0239('0x37')]?_0x16809f[_0x0239('0x35')]:_0x18f37c[_0x0239('0x31')];if(!_0xee9312[_0x0239('0x34')][_0x0239('0x38')](_0x0239('0x39'))){_0x16809f['limit']=qs[_0x0239('0x1d')](_0xee9312['query'][_0x0239('0x1d')]);_0x16809f[_0x0239('0x1f')]=qs[_0x0239('0x1f')](_0xee9312[_0x0239('0x34')]['offset']);}_0x16809f[_0x0239('0x3a')]=qs[_0x0239('0x3b')](_0xee9312[_0x0239('0x34')]['sort']);_0x16809f['where']=qs[_0x0239('0x3c')](_[_0x0239('0x3d')](_0xee9312[_0x0239('0x34')],_0x18f37c['filters']),_0x19ed42);if(_0xee9312[_0x0239('0x34')][_0x0239('0x3e')]){_0x16809f[_0x0239('0x3f')]=_['merge'](_0x16809f[_0x0239('0x3f')],{'$or':_[_0x0239('0x2b')](_0x19ed42,function(_0x493c90){if(_0x493c90[_0x0239('0x2f')]!==_0x0239('0x40')){var _0x13eb0a={};_0x13eb0a[_0x493c90['name']]={'$like':'%'+_0xee9312[_0x0239('0x34')][_0x0239('0x3e')]+'%'};return _0x13eb0a;}})});}_0x16809f=_[_0x0239('0x41')]({},_0x16809f,_0xee9312[_0x0239('0x42')]);var _0x4b4dcc={'where':_0x16809f[_0x0239('0x3f')]};return db[_0x0239('0x2c')]['count'](_0x4b4dcc)[_0x0239('0x25')](function(_0x289ed0){_0x250a3c['count']=_0x289ed0;if(_0xee9312[_0x0239('0x34')][_0x0239('0x43')]){_0x16809f['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x0239('0x44')](_0x16809f);})['then'](function(_0x2b15c0){_0x250a3c['rows']=_0x2b15c0;return _0x250a3c;})[_0x0239('0x25')](respondWithFilteredResult(_0x2a88a1,_0x16809f))['catch'](handleError(_0x2a88a1,null));};exports[_0x0239('0x45')]=function(_0x2a5e3d,_0x28d4c9){var _0x841421={'raw':!![],'where':{'id':_0x2a5e3d[_0x0239('0x46')]['id']}},_0x53f2fe={};_0x53f2fe[_0x0239('0x31')]=_[_0x0239('0x32')](db[_0x0239('0x2c')][_0x0239('0x2d')]);_0x53f2fe[_0x0239('0x34')]=_[_0x0239('0x32')](_0x2a5e3d[_0x0239('0x34')]);_0x53f2fe['filters']=_['intersection'](_0x53f2fe[_0x0239('0x31')],_0x53f2fe['query']);_0x841421['attributes']=_[_0x0239('0x33')](_0x53f2fe[_0x0239('0x31')],qs[_0x0239('0x36')](_0x2a5e3d[_0x0239('0x34')][_0x0239('0x36')]));_0x841421[_0x0239('0x35')]=_0x841421[_0x0239('0x35')][_0x0239('0x37')]?_0x841421['attributes']:_0x53f2fe[_0x0239('0x31')];if(_0x2a5e3d[_0x0239('0x34')][_0x0239('0x43')]){_0x841421[_0x0239('0x47')]=[{'all':!![]}];}_0x841421=_[_0x0239('0x41')]({},_0x841421,_0x2a5e3d[_0x0239('0x42')]);return db['Dynamics365Field'][_0x0239('0x48')](_0x841421)[_0x0239('0x25')](handleEntityNotFound(_0x28d4c9,null))[_0x0239('0x25')](respondWithResult(_0x28d4c9,null))[_0x0239('0x49')](handleError(_0x28d4c9,null));};exports[_0x0239('0x4a')]=function(_0x23a0b7,_0x5ddbca){return db[_0x0239('0x2c')][_0x0239('0x4a')](_0x23a0b7[_0x0239('0x4b')],{})[_0x0239('0x25')](respondWithResult(_0x5ddbca,0xc9))[_0x0239('0x49')](handleError(_0x5ddbca,null));};exports[_0x0239('0x24')]=function(_0x22ea01,_0x5ea1cf){if(_0x22ea01['body']['id']){delete _0x22ea01[_0x0239('0x4b')]['id'];}return db[_0x0239('0x2c')][_0x0239('0x48')]({'where':{'id':_0x22ea01[_0x0239('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ea1cf,null))[_0x0239('0x25')](saveUpdates(_0x22ea01[_0x0239('0x4b')],null))[_0x0239('0x25')](respondWithResult(_0x5ea1cf,null))[_0x0239('0x49')](handleError(_0x5ea1cf,null));};exports[_0x0239('0x26')]=function(_0x9a8927,_0x51c4c4){return db['Dynamics365Field']['find']({'where':{'id':_0x9a8927['params']['id']}})['then'](handleEntityNotFound(_0x51c4c4,null))[_0x0239('0x25')](removeEntity(_0x51c4c4,null))[_0x0239('0x49')](handleError(_0x51c4c4,null));}; \ No newline at end of file +var _0xe165=['squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x67a245,_0x22c647){var _0xed6bed=function(_0x4e3c94){while(--_0x4e3c94){_0x67a245['push'](_0x67a245['shift']());}};_0xed6bed(++_0x22c647);}(_0xe165,0x1e6));var _0x5e16=function(_0x3d9d7b,_0x542ca4){_0x3d9d7b=_0x3d9d7b-0x0;var _0x3df3e0=_0xe165[_0x3d9d7b];return _0x3df3e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5e16('0x0'));var zipdir=require(_0x5e16('0x1'));var jsonpatch=require(_0x5e16('0x2'));var rp=require(_0x5e16('0x3'));var moment=require(_0x5e16('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5e16('0x5'));var path=require(_0x5e16('0x6'));var sox=require(_0x5e16('0x7'));var csv=require(_0x5e16('0x8'));var ejs=require(_0x5e16('0x9'));var fs=require('fs');var fs_extra=require(_0x5e16('0xa'));var _=require('lodash');var squel=require(_0x5e16('0xb'));var crypto=require(_0x5e16('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5e16('0xd'));var toCsv=require(_0x5e16('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5e16('0xe'));var qs=require(_0x5e16('0xf'));var as=require(_0x5e16('0x10'));var hardwareService=require(_0x5e16('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x5e16('0x12'));var config=require(_0x5e16('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5e16('0x14'))['db'];function respondWithStatusCode(_0x5b5959,_0x49b58d){_0x49b58d=_0x49b58d||0xcc;return function(_0xa58ba4){if(_0xa58ba4){return _0x5b5959['sendStatus'](_0x49b58d);}return _0x5b5959[_0x5e16('0x15')](_0x49b58d)[_0x5e16('0x16')]();};}function respondWithResult(_0x2f3c1b,_0x3180dc){_0x3180dc=_0x3180dc||0xc8;return function(_0x150531){if(_0x150531){return _0x2f3c1b['status'](_0x3180dc)[_0x5e16('0x17')](_0x150531);}};}function respondWithFilteredResult(_0x574987,_0x27b6df){return function(_0x16a0e8){if(_0x16a0e8){var _0x52320a=typeof _0x27b6df['offset']==='undefined'&&typeof _0x27b6df[_0x5e16('0x18')]===_0x5e16('0x19');var _0x507c3f=_0x16a0e8[_0x5e16('0x1a')];var _0x5e67cb=_0x52320a?0x0:_0x27b6df['offset'];var _0x184074=_0x52320a?_0x16a0e8[_0x5e16('0x1a')]:_0x27b6df[_0x5e16('0x1b')]+_0x27b6df[_0x5e16('0x18')];var _0x5297dd;if(_0x184074>=_0x507c3f){_0x184074=_0x507c3f;_0x5297dd=0xc8;}else{_0x5297dd=0xce;}_0x574987[_0x5e16('0x15')](_0x5297dd);return _0x574987[_0x5e16('0x1c')](_0x5e16('0x1d'),_0x5e67cb+'-'+_0x184074+'/'+_0x507c3f)[_0x5e16('0x17')](_0x16a0e8);}return null;};}function patchUpdates(_0x18a01e){return function(_0x3c09d2){try{jsonpatch[_0x5e16('0x1e')](_0x3c09d2,_0x18a01e,!![]);}catch(_0x42eba8){return BPromise[_0x5e16('0x1f')](_0x42eba8);}return _0x3c09d2['save']();};}function saveUpdates(_0x516496,_0x894a88){return function(_0x48d508){if(_0x48d508){return _0x48d508[_0x5e16('0x20')](_0x516496)['then'](function(_0x4b1ab7){return _0x4b1ab7;});}return null;};}function removeEntity(_0x55974a,_0x528769){return function(_0x332164){if(_0x332164){return _0x332164[_0x5e16('0x21')]()['then'](function(){_0x55974a[_0x5e16('0x15')](0xcc)[_0x5e16('0x16')]();});}};}function handleEntityNotFound(_0xc3e0a0,_0x2d4663){return function(_0x441aac){if(!_0x441aac){_0xc3e0a0[_0x5e16('0x22')](0x194);}return _0x441aac;};}function handleError(_0xac2674,_0x1deb0a){_0x1deb0a=_0x1deb0a||0x1f4;return function(_0x8a730f){logger[_0x5e16('0x23')](_0x8a730f[_0x5e16('0x24')]);if(_0x8a730f['name']){delete _0x8a730f[_0x5e16('0x25')];}_0xac2674[_0x5e16('0x15')](_0x1deb0a)[_0x5e16('0x26')](_0x8a730f);};}exports[_0x5e16('0x27')]=function(_0xc16c51,_0x681151){var _0x56f4c5={},_0x2ffda9={},_0x34a65c={'count':0x0,'rows':[]};var _0x460895=_[_0x5e16('0x28')](db[_0x5e16('0x29')][_0x5e16('0x2a')],function(_0x301daf){return{'name':_0x301daf['fieldName'],'type':_0x301daf['type']['key']};});_0x2ffda9[_0x5e16('0x2b')]=_['map'](_0x460895,_0x5e16('0x25'));_0x2ffda9[_0x5e16('0x2c')]=_[_0x5e16('0x2d')](_0xc16c51['query']);_0x2ffda9[_0x5e16('0x2e')]=_[_0x5e16('0x2f')](_0x2ffda9['model'],_0x2ffda9['query']);_0x56f4c5[_0x5e16('0x30')]=_[_0x5e16('0x2f')](_0x2ffda9[_0x5e16('0x2b')],qs['fields'](_0xc16c51[_0x5e16('0x2c')][_0x5e16('0x31')]));_0x56f4c5[_0x5e16('0x30')]=_0x56f4c5[_0x5e16('0x30')]['length']?_0x56f4c5[_0x5e16('0x30')]:_0x2ffda9[_0x5e16('0x2b')];if(!_0xc16c51[_0x5e16('0x2c')]['hasOwnProperty'](_0x5e16('0x32'))){_0x56f4c5['limit']=qs[_0x5e16('0x18')](_0xc16c51['query'][_0x5e16('0x18')]);_0x56f4c5[_0x5e16('0x1b')]=qs[_0x5e16('0x1b')](_0xc16c51[_0x5e16('0x2c')][_0x5e16('0x1b')]);}_0x56f4c5[_0x5e16('0x33')]=qs[_0x5e16('0x34')](_0xc16c51[_0x5e16('0x2c')]['sort']);_0x56f4c5[_0x5e16('0x35')]=qs[_0x5e16('0x2e')](_[_0x5e16('0x36')](_0xc16c51[_0x5e16('0x2c')],_0x2ffda9['filters']),_0x460895);if(_0xc16c51['query'][_0x5e16('0x37')]){_0x56f4c5[_0x5e16('0x35')]=_['merge'](_0x56f4c5[_0x5e16('0x35')],{'$or':_[_0x5e16('0x28')](_0x460895,function(_0x402fa3){if(_0x402fa3['type']!==_0x5e16('0x38')){var _0x29bca5={};_0x29bca5[_0x402fa3[_0x5e16('0x25')]]={'$like':'%'+_0xc16c51[_0x5e16('0x2c')]['filter']+'%'};return _0x29bca5;}})});}_0x56f4c5=_[_0x5e16('0x39')]({},_0x56f4c5,_0xc16c51[_0x5e16('0x3a')]);var _0x993930={'where':_0x56f4c5[_0x5e16('0x35')]};return db[_0x5e16('0x29')][_0x5e16('0x1a')](_0x993930)[_0x5e16('0x3b')](function(_0x5beeec){_0x34a65c[_0x5e16('0x1a')]=_0x5beeec;if(_0xc16c51[_0x5e16('0x2c')]['includeAll']){_0x56f4c5[_0x5e16('0x3c')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x5e16('0x3d')](_0x56f4c5);})[_0x5e16('0x3b')](function(_0x568a38){_0x34a65c[_0x5e16('0x3e')]=_0x568a38;return _0x34a65c;})[_0x5e16('0x3b')](respondWithFilteredResult(_0x681151,_0x56f4c5))[_0x5e16('0x3f')](handleError(_0x681151,null));};exports[_0x5e16('0x40')]=function(_0x346abc,_0x1365bc){var _0x4d2cb8={'raw':!![],'where':{'id':_0x346abc[_0x5e16('0x41')]['id']}},_0x13a2d2={};_0x13a2d2[_0x5e16('0x2b')]=_['keys'](db[_0x5e16('0x29')]['rawAttributes']);_0x13a2d2[_0x5e16('0x2c')]=_[_0x5e16('0x2d')](_0x346abc[_0x5e16('0x2c')]);_0x13a2d2[_0x5e16('0x2e')]=_[_0x5e16('0x2f')](_0x13a2d2[_0x5e16('0x2b')],_0x13a2d2['query']);_0x4d2cb8[_0x5e16('0x30')]=_[_0x5e16('0x2f')](_0x13a2d2[_0x5e16('0x2b')],qs['fields'](_0x346abc[_0x5e16('0x2c')][_0x5e16('0x31')]));_0x4d2cb8['attributes']=_0x4d2cb8['attributes'][_0x5e16('0x42')]?_0x4d2cb8['attributes']:_0x13a2d2['model'];if(_0x346abc['query'][_0x5e16('0x43')]){_0x4d2cb8[_0x5e16('0x3c')]=[{'all':!![]}];}_0x4d2cb8=_[_0x5e16('0x39')]({},_0x4d2cb8,_0x346abc[_0x5e16('0x3a')]);return db[_0x5e16('0x29')][_0x5e16('0x44')](_0x4d2cb8)[_0x5e16('0x3b')](handleEntityNotFound(_0x1365bc,null))[_0x5e16('0x3b')](respondWithResult(_0x1365bc,null))['catch'](handleError(_0x1365bc,null));};exports[_0x5e16('0x45')]=function(_0x315521,_0x59bf9d){return db['Dynamics365Field'][_0x5e16('0x45')](_0x315521[_0x5e16('0x46')],{})[_0x5e16('0x3b')](respondWithResult(_0x59bf9d,0xc9))[_0x5e16('0x3f')](handleError(_0x59bf9d,null));};exports[_0x5e16('0x20')]=function(_0x7ac8,_0x549fc6){if(_0x7ac8[_0x5e16('0x46')]['id']){delete _0x7ac8['body']['id'];}return db['Dynamics365Field'][_0x5e16('0x44')]({'where':{'id':_0x7ac8[_0x5e16('0x41')]['id']}})[_0x5e16('0x3b')](handleEntityNotFound(_0x549fc6,null))[_0x5e16('0x3b')](saveUpdates(_0x7ac8['body'],null))['then'](respondWithResult(_0x549fc6,null))[_0x5e16('0x3f')](handleError(_0x549fc6,null));};exports[_0x5e16('0x21')]=function(_0x4cfb9b,_0x6e5961){return db['Dynamics365Field'][_0x5e16('0x44')]({'where':{'id':_0x4cfb9b['params']['id']}})[_0x5e16('0x3b')](handleEntityNotFound(_0x6e5961,null))[_0x5e16('0x3b')](removeEntity(_0x6e5961,null))[_0x5e16('0x3f')](handleError(_0x6e5961,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index ea4169d..765f1b7 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 _0x65dd=['FieldId','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField'];(function(_0x4b10ab,_0x2e1410){var _0x389cc6=function(_0x2f513e){while(--_0x2f513e){_0x4b10ab['push'](_0x4b10ab['shift']());}};_0x389cc6(++_0x2e1410);}(_0x65dd,0x1e1));var _0xd65d=function(_0x530f7f,_0x2462bb){_0x530f7f=_0x530f7f-0x0;var _0x3b6c42=_0x65dd[_0x530f7f];return _0x3b6c42;};'use strict';var _=require(_0xd65d('0x0'));var util=require(_0xd65d('0x1'));var logger=require(_0xd65d('0x2'))(_0xd65d('0x3'));var moment=require(_0xd65d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd65d('0x5'));var rimraf=require(_0xd65d('0x6'));var config=require(_0xd65d('0x7'));var attributes=require(_0xd65d('0x8'));module[_0xd65d('0x9')]=function(_0x979702,_0x48d2f5){return _0x979702[_0xd65d('0xa')](_0xd65d('0xb'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xd65d('0xc'),'fields':[_0xd65d('0xd'),_0xd65d('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4353=['./intDynamics365Field.attributes','exports','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x545e9a,_0x2d9016){var _0x548780=function(_0x3cb507){while(--_0x3cb507){_0x545e9a['push'](_0x545e9a['shift']());}};_0x548780(++_0x2d9016);}(_0x4353,0x15f));var _0x3435=function(_0x2259a3,_0x4b358d){_0x2259a3=_0x2259a3-0x0;var _0x1cbc85=_0x4353[_0x2259a3];return _0x1cbc85;};'use strict';var _=require(_0x3435('0x0'));var util=require(_0x3435('0x1'));var logger=require('../../config/logger')(_0x3435('0x2'));var moment=require(_0x3435('0x3'));var BPromise=require(_0x3435('0x4'));var rp=require(_0x3435('0x5'));var fs=require('fs');var path=require(_0x3435('0x6'));var rimraf=require(_0x3435('0x7'));var config=require(_0x3435('0x8'));var attributes=require(_0x3435('0x9'));module[_0x3435('0xa')]=function(_0x2921ce,_0x264471){return _0x2921ce['define']('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':['idField',_0x3435('0xb')],'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 ff99d2b..640854a 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 _0xd903=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','ioredis'];(function(_0x652303,_0x1170be){var _0x22998d=function(_0x50bc8b){while(--_0x50bc8b){_0x652303['push'](_0x652303['shift']());}};_0x22998d(++_0x1170be);}(_0xd903,0x1d7));var _0x3d90=function(_0xdab59,_0x42e2b9){_0xdab59=_0xdab59-0x0;var _0x249a90=_0xd903[_0xdab59];return _0x249a90;};'use strict';var _=require('lodash');var util=require(_0x3d90('0x0'));var moment=require(_0x3d90('0x1'));var BPromise=require(_0x3d90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d90('0x3'));var db=require(_0x3d90('0x4'))['db'];var utils=require(_0x3d90('0x5'));var logger=require(_0x3d90('0x6'))(_0x3d90('0x7'));var config=require(_0x3d90('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3d90('0x9')][_0x3d90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1588b7,_0x4946c1,_0x59a34f){return new BPromise(function(_0x18b060,_0x1b2925){return client['request'](_0x1588b7,_0x59a34f)[_0x3d90('0xb')](function(_0xc20eb8){logger[_0x3d90('0xc')](_0x3d90('0xd'),_0x4946c1,_0x3d90('0xe'));logger['debug'](_0x3d90('0xf'),_0x4946c1,_0x3d90('0xe'),JSON[_0x3d90('0x10')](_0xc20eb8));if(_0xc20eb8[_0x3d90('0x11')]){if(_0xc20eb8[_0x3d90('0x11')]['code']===0x1f4){logger[_0x3d90('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x4946c1,_0xc20eb8[_0x3d90('0x11')][_0x3d90('0x12')]);return _0x1b2925(_0xc20eb8[_0x3d90('0x11')][_0x3d90('0x12')]);}logger[_0x3d90('0x11')](_0x3d90('0xd'),_0x4946c1,_0xc20eb8[_0x3d90('0x11')][_0x3d90('0x12')]);return _0x18b060(_0xc20eb8[_0x3d90('0x11')][_0x3d90('0x12')]);}else{logger[_0x3d90('0xc')](_0x3d90('0xd'),_0x4946c1,_0x3d90('0xe'));_0x18b060(_0xc20eb8['result'][_0x3d90('0x12')]);}})['catch'](function(_0x493fb6){logger[_0x3d90('0x11')](_0x3d90('0xd'),_0x4946c1,_0x493fb6);_0x1b2925(_0x493fb6);});});} \ No newline at end of file +var _0x6d21=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x37b519,_0x24b2ca){var _0x412276=function(_0xbe9cbb){while(--_0xbe9cbb){_0x37b519['push'](_0x37b519['shift']());}};_0x412276(++_0x24b2ca);}(_0x6d21,0x1e3));var _0x16d2=function(_0x556b16,_0x51f863){_0x556b16=_0x556b16-0x0;var _0x3f2a44=_0x6d21[_0x556b16];return _0x3f2a44;};'use strict';var _=require(_0x16d2('0x0'));var util=require(_0x16d2('0x1'));var moment=require(_0x16d2('0x2'));var BPromise=require(_0x16d2('0x3'));var rs=require(_0x16d2('0x4'));var fs=require('fs');var Redis=require(_0x16d2('0x5'));var db=require(_0x16d2('0x6'))['db'];var utils=require(_0x16d2('0x7'));var logger=require(_0x16d2('0x8'))(_0x16d2('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x16d2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4aab22,_0x38c544,_0x1e6a81){return new BPromise(function(_0x49b6a1,_0x571425){return client[_0x16d2('0xb')](_0x4aab22,_0x1e6a81)[_0x16d2('0xc')](function(_0x5536f9){logger[_0x16d2('0xd')](_0x16d2('0xe'),_0x38c544,_0x16d2('0xf'));logger[_0x16d2('0x10')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x38c544,_0x16d2('0xf'),JSON[_0x16d2('0x11')](_0x5536f9));if(_0x5536f9[_0x16d2('0x12')]){if(_0x5536f9[_0x16d2('0x12')][_0x16d2('0x13')]===0x1f4){logger[_0x16d2('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x38c544,_0x5536f9['error'][_0x16d2('0x14')]);return _0x571425(_0x5536f9[_0x16d2('0x12')][_0x16d2('0x14')]);}logger[_0x16d2('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x38c544,_0x5536f9['error'][_0x16d2('0x14')]);return _0x49b6a1(_0x5536f9[_0x16d2('0x12')][_0x16d2('0x14')]);}else{logger[_0x16d2('0xd')](_0x16d2('0xe'),_0x38c544,_0x16d2('0xf'));_0x49b6a1(_0x5536f9[_0x16d2('0x15')][_0x16d2('0x14')]);}})[_0x16d2('0x16')](function(_0x545e23){logger[_0x16d2('0x12')](_0x16d2('0xe'),_0x38c544,_0x545e23);_0x571425(_0x545e23);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 2fbd33f..5f5bab0 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 _0xb9b3=['show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x13404a,_0x5b7171){var _0x2a57f3=function(_0x4e47c5){while(--_0x4e47c5){_0x13404a['push'](_0x13404a['shift']());}};_0x2a57f3(++_0x5b7171);}(_0xb9b3,0x18c));var _0x3b9b=function(_0xe32f7,_0x553504){_0xe32f7=_0xe32f7-0x0;var _0x1beac9=_0xb9b3[_0xe32f7];return _0x1beac9;};'use strict';var multer=require(_0x3b9b('0x0'));var util=require(_0x3b9b('0x1'));var path=require(_0x3b9b('0x2'));var timeout=require(_0x3b9b('0x3'));var express=require('express');var router=express[_0x3b9b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3b9b('0x5'));var config=require(_0x3b9b('0x6'));var controller=require(_0x3b9b('0x7'));router[_0x3b9b('0x8')]('/',auth[_0x3b9b('0x9')](),controller[_0x3b9b('0xa')]);router[_0x3b9b('0x8')](_0x3b9b('0xb'),auth[_0x3b9b('0x9')](),controller[_0x3b9b('0xc')]);router[_0x3b9b('0x8')](_0x3b9b('0xd'),auth[_0x3b9b('0x9')](),controller[_0x3b9b('0xe')]);router[_0x3b9b('0x8')](_0x3b9b('0xf'),auth[_0x3b9b('0x9')](),controller[_0x3b9b('0x10')]);router[_0x3b9b('0x11')]('/',auth['isAuthenticated'](),controller[_0x3b9b('0x12')]);router['post'](_0x3b9b('0xd'),auth[_0x3b9b('0x9')](),controller['addConfiguration']);router[_0x3b9b('0x13')](_0x3b9b('0xb'),auth['isAuthenticated'](),controller[_0x3b9b('0x14')]);router[_0x3b9b('0x15')](_0x3b9b('0xb'),auth[_0x3b9b('0x9')](),controller[_0x3b9b('0x16')]);module[_0x3b9b('0x17')]=router; \ No newline at end of file +var _0xf562=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskAccount.controller','get','index','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','create','addConfiguration','put','update','delete','/:id','destroy','exports'];(function(_0x27308a,_0x39ecb5){var _0x532efb=function(_0x54ee46){while(--_0x54ee46){_0x27308a['push'](_0x27308a['shift']());}};_0x532efb(++_0x39ecb5);}(_0xf562,0x1ba));var _0x2f56=function(_0x141d0a,_0x590c81){_0x141d0a=_0x141d0a-0x0;var _0x170d11=_0xf562[_0x141d0a];return _0x170d11;};'use strict';var multer=require('multer');var util=require(_0x2f56('0x0'));var path=require(_0x2f56('0x1'));var timeout=require(_0x2f56('0x2'));var express=require(_0x2f56('0x3'));var router=express[_0x2f56('0x4')]();var fs_extra=require(_0x2f56('0x5'));var auth=require(_0x2f56('0x6'));var interaction=require(_0x2f56('0x7'));var config=require('../../config/environment');var controller=require(_0x2f56('0x8'));router[_0x2f56('0x9')]('/',auth['isAuthenticated'](),controller[_0x2f56('0xa')]);router[_0x2f56('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2f56('0xb')]);router[_0x2f56('0x9')](_0x2f56('0xc'),auth['isAuthenticated'](),controller[_0x2f56('0xd')]);router[_0x2f56('0x9')](_0x2f56('0xe'),auth[_0x2f56('0xf')](),controller[_0x2f56('0x10')]);router[_0x2f56('0x11')]('/',auth[_0x2f56('0xf')](),controller[_0x2f56('0x12')]);router[_0x2f56('0x11')](_0x2f56('0xc'),auth[_0x2f56('0xf')](),controller[_0x2f56('0x13')]);router[_0x2f56('0x14')]('/:id',auth[_0x2f56('0xf')](),controller[_0x2f56('0x15')]);router[_0x2f56('0x16')](_0x2f56('0x17'),auth[_0x2f56('0xf')](),controller[_0x2f56('0x18')]);module[_0x2f56('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 9811fa7..558856a 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 _0xf4f4=['exports','STRING','username','sequelize'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x5319cf,_0x36cb48){_0x5319cf=_0x5319cf-0x0;var _0x67ea6f=_0xf4f4[_0x5319cf];return _0x67ea6f;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4f4f('0x2')]},'username':{'type':Sequelize[_0x4f4f('0x2')],'unique':_0x4f4f('0x3')},'apiKey':{'type':Sequelize[_0x4f4f('0x2')]},'remoteUri':{'type':Sequelize[_0x4f4f('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4f4f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1a85=['STRING','remoteUri'];(function(_0x4c7d49,_0x284cdf){var _0x212fb0=function(_0x12e185){while(--_0x12e185){_0x4c7d49['push'](_0x4c7d49['shift']());}};_0x212fb0(++_0x284cdf);}(_0x1a85,0x178));var _0x51a8=function(_0x2ccdb9,_0x3ded46){_0x2ccdb9=_0x2ccdb9-0x0;var _0x4e8120=_0x1a85[_0x2ccdb9];return _0x4e8120;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x51a8('0x0')]},'description':{'type':Sequelize[_0x51a8('0x0')]},'username':{'type':Sequelize[_0x51a8('0x0')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x51a8('0x0')],'unique':_0x51a8('0x1')},'serverUrl':{'type':Sequelize[_0x51a8('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 9d758be..11ba677 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 _0x3189=['query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','FreshdeskAccount','includeAll','findAll','rows','catch','include','find','create','body','params','findOne','order','options','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','GET','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','description','group','source','company','includes','default','custom_dropdown','label','choices','capitalize','test','statusCode','error','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','model'];(function(_0x55f5b1,_0x1139b4){var _0x1d1389=function(_0x1cfca6){while(--_0x1cfca6){_0x55f5b1['push'](_0x55f5b1['shift']());}};_0x1d1389(++_0x1139b4);}(_0x3189,0xae));var _0x9318=function(_0x1a1ea5,_0x48475a){_0x1a1ea5=_0x1a1ea5-0x0;var _0xed49a=_0x3189[_0x1a1ea5];return _0xed49a;};'use strict';var emlformat=require(_0x9318('0x0'));var rimraf=require(_0x9318('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9318('0x2'));var rp=require(_0x9318('0x3'));var moment=require(_0x9318('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9318('0x5'));var util=require('util');var path=require('path');var sox=require(_0x9318('0x6'));var csv=require(_0x9318('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9318('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9318('0x9'));var jsforce=require(_0x9318('0xa'));var deskjs=require(_0x9318('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9318('0xc'));var Papa=require(_0x9318('0xd'));var Redis=require(_0x9318('0xe'));var authService=require(_0x9318('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9318('0x10'));var logger=require('../../config/logger')(_0x9318('0x11'));var utils=require(_0x9318('0x12'));var config=require(_0x9318('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9318('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5133a4,_0x2ac258){_0x2ac258=_0x2ac258||0xcc;return function(_0x4fba52){if(_0x4fba52){return _0x5133a4[_0x9318('0x15')](_0x2ac258);}return _0x5133a4[_0x9318('0x16')](_0x2ac258)['end']();};}function respondWithResult(_0x258b56,_0xfe145c){_0xfe145c=_0xfe145c||0xc8;return function(_0x326e26){if(_0x326e26){return _0x258b56['status'](_0xfe145c)['json'](_0x326e26);}};}function respondWithFilteredResult(_0x10d4f0,_0x11b380){return function(_0x4ee574){if(_0x4ee574){var _0x1a22c=typeof _0x11b380[_0x9318('0x17')]==='undefined'&&typeof _0x11b380[_0x9318('0x18')]===_0x9318('0x19');var _0x411fa4=_0x4ee574[_0x9318('0x1a')];var _0xd1fd86=_0x1a22c?0x0:_0x11b380[_0x9318('0x17')];var _0xf657f7=_0x1a22c?_0x4ee574[_0x9318('0x1a')]:_0x11b380['offset']+_0x11b380[_0x9318('0x18')];var _0x4611cb;if(_0xf657f7>=_0x411fa4){_0xf657f7=_0x411fa4;_0x4611cb=0xc8;}else{_0x4611cb=0xce;}_0x10d4f0[_0x9318('0x16')](_0x4611cb);return _0x10d4f0[_0x9318('0x1b')](_0x9318('0x1c'),_0xd1fd86+'-'+_0xf657f7+'/'+_0x411fa4)[_0x9318('0x1d')](_0x4ee574);}return null;};}function patchUpdates(_0x59a34f){return function(_0x325f14){try{jsonpatch['apply'](_0x325f14,_0x59a34f,!![]);}catch(_0x4c2883){return BPromise[_0x9318('0x1e')](_0x4c2883);}return _0x325f14[_0x9318('0x1f')]();};}function saveUpdates(_0xa45304,_0x2b3d31){return function(_0x714c45){if(_0x714c45){return _0x714c45['update'](_0xa45304)[_0x9318('0x20')](function(_0x3d6205){return _0x3d6205;});}return null;};}function removeEntity(_0x451694,_0x33502a){return function(_0x4316f8){if(_0x4316f8){return _0x4316f8[_0x9318('0x21')]()[_0x9318('0x20')](function(){_0x451694[_0x9318('0x16')](0xcc)[_0x9318('0x22')]();});}};}function handleEntityNotFound(_0xaf8aec,_0x30386c){return function(_0x202123){if(!_0x202123){_0xaf8aec[_0x9318('0x15')](0x194);}return _0x202123;};}function handleError(_0x659998,_0x35e85e){_0x35e85e=_0x35e85e||0x1f4;return function(_0x30be80){logger['error'](_0x30be80[_0x9318('0x23')]);if(_0x30be80[_0x9318('0x24')]){delete _0x30be80['name'];}_0x659998[_0x9318('0x16')](_0x35e85e)[_0x9318('0x25')](_0x30be80);};}exports[_0x9318('0x26')]=function(_0xf8bc76,_0xf01d79){var _0x430f42={},_0x30b048={},_0x4c8dc6={'count':0x0,'rows':[]};var _0x2fb678=_[_0x9318('0x27')](db['FreshdeskAccount'][_0x9318('0x28')],function(_0x4c4a6f){return{'name':_0x4c4a6f[_0x9318('0x29')],'type':_0x4c4a6f[_0x9318('0x2a')]['key']};});_0x30b048[_0x9318('0x2b')]=_['map'](_0x2fb678,_0x9318('0x24'));_0x30b048[_0x9318('0x2c')]=_[_0x9318('0x2d')](_0xf8bc76['query']);_0x30b048[_0x9318('0x2e')]=_[_0x9318('0x2f')](_0x30b048[_0x9318('0x2b')],_0x30b048[_0x9318('0x2c')]);_0x430f42['attributes']=_['intersection'](_0x30b048[_0x9318('0x2b')],qs['fields'](_0xf8bc76[_0x9318('0x2c')][_0x9318('0x30')]));_0x430f42['attributes']=_0x430f42[_0x9318('0x31')][_0x9318('0x32')]?_0x430f42['attributes']:_0x30b048[_0x9318('0x2b')];if(!_0xf8bc76[_0x9318('0x2c')]['hasOwnProperty'](_0x9318('0x33'))){_0x430f42[_0x9318('0x18')]=qs[_0x9318('0x18')](_0xf8bc76[_0x9318('0x2c')][_0x9318('0x18')]);_0x430f42[_0x9318('0x17')]=qs[_0x9318('0x17')](_0xf8bc76[_0x9318('0x2c')][_0x9318('0x17')]);}_0x430f42['order']=qs['sort'](_0xf8bc76[_0x9318('0x2c')][_0x9318('0x34')]);_0x430f42[_0x9318('0x35')]=qs[_0x9318('0x2e')](_[_0x9318('0x36')](_0xf8bc76[_0x9318('0x2c')],_0x30b048[_0x9318('0x2e')]),_0x2fb678);if(_0xf8bc76[_0x9318('0x2c')][_0x9318('0x37')]){_0x430f42[_0x9318('0x35')]=_['merge'](_0x430f42['where'],{'$or':_[_0x9318('0x27')](_0x2fb678,function(_0x5538b2){if(_0x5538b2['type']!==_0x9318('0x38')){var _0xa1b0b1={};_0xa1b0b1[_0x5538b2[_0x9318('0x24')]]={'$like':'%'+_0xf8bc76[_0x9318('0x2c')][_0x9318('0x37')]+'%'};return _0xa1b0b1;}})});}_0x430f42=_[_0x9318('0x39')]({},_0x430f42,_0xf8bc76['options']);var _0x3f3673={'where':_0x430f42[_0x9318('0x35')]};return db[_0x9318('0x3a')][_0x9318('0x1a')](_0x3f3673)['then'](function(_0xf31f83){_0x4c8dc6[_0x9318('0x1a')]=_0xf31f83;if(_0xf8bc76[_0x9318('0x2c')][_0x9318('0x3b')]){_0x430f42['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0x9318('0x3c')](_0x430f42);})[_0x9318('0x20')](function(_0x5392b0){_0x4c8dc6[_0x9318('0x3d')]=_0x5392b0;return _0x4c8dc6;})[_0x9318('0x20')](respondWithFilteredResult(_0xf01d79,_0x430f42))[_0x9318('0x3e')](handleError(_0xf01d79,null));};exports['show']=function(_0x94a111,_0x205f06){var _0x28d505={'raw':![],'where':{'id':_0x94a111['params']['id']}},_0x430975={};_0x430975[_0x9318('0x2b')]=_['keys'](db[_0x9318('0x3a')][_0x9318('0x28')]);_0x430975[_0x9318('0x2c')]=_[_0x9318('0x2d')](_0x94a111[_0x9318('0x2c')]);_0x430975[_0x9318('0x2e')]=_['intersection'](_0x430975[_0x9318('0x2b')],_0x430975['query']);_0x28d505[_0x9318('0x31')]=_[_0x9318('0x2f')](_0x430975['model'],qs['fields'](_0x94a111['query'][_0x9318('0x30')]));_0x28d505[_0x9318('0x31')]=_0x28d505[_0x9318('0x31')][_0x9318('0x32')]?_0x28d505[_0x9318('0x31')]:_0x430975[_0x9318('0x2b')];if(_0x94a111[_0x9318('0x2c')][_0x9318('0x3b')]){_0x28d505[_0x9318('0x3f')]=[{'all':!![]}];}_0x28d505=_[_0x9318('0x39')]({},_0x28d505,_0x94a111['options']);return db[_0x9318('0x3a')][_0x9318('0x40')](_0x28d505)[_0x9318('0x20')](handleEntityNotFound(_0x205f06,null))[_0x9318('0x20')](respondWithResult(_0x205f06,null))[_0x9318('0x3e')](handleError(_0x205f06,null));};exports[_0x9318('0x41')]=function(_0x5eec25,_0x210f74){return db['FreshdeskAccount'][_0x9318('0x41')](_0x5eec25[_0x9318('0x42')],{})[_0x9318('0x20')](respondWithResult(_0x210f74,0xc9))['catch'](handleError(_0x210f74,null));};exports['update']=function(_0x4ce675,_0x19aa0e){if(_0x4ce675[_0x9318('0x42')]['id']){delete _0x4ce675[_0x9318('0x42')]['id'];}return db[_0x9318('0x3a')][_0x9318('0x40')]({'where':{'id':_0x4ce675[_0x9318('0x43')]['id']}})[_0x9318('0x20')](handleEntityNotFound(_0x19aa0e,null))['then'](saveUpdates(_0x4ce675[_0x9318('0x42')],null))[_0x9318('0x20')](respondWithResult(_0x19aa0e,null))['catch'](handleError(_0x19aa0e,null));};exports['destroy']=function(_0x1d8e80,_0x155e69){return db[_0x9318('0x3a')][_0x9318('0x40')]({'where':{'id':_0x1d8e80[_0x9318('0x43')]['id']}})[_0x9318('0x20')](handleEntityNotFound(_0x155e69,null))[_0x9318('0x20')](removeEntity(_0x155e69,null))[_0x9318('0x3e')](handleError(_0x155e69,null));};exports['getConfigurations']=function(_0x2c7eca,_0x221dc3,_0x44128e){var _0x14b195={};var _0x1bd5c1={};var _0x11b2ce;var _0x2c41a0;return db[_0x9318('0x3a')][_0x9318('0x44')]({'where':{'id':_0x2c7eca[_0x9318('0x43')]['id']}})[_0x9318('0x20')](handleEntityNotFound(_0x221dc3,null))[_0x9318('0x20')](function(_0x359871){if(_0x359871){_0x11b2ce=_0x359871;_0x1bd5c1[_0x9318('0x2b')]=_[_0x9318('0x2d')](db['FreshdeskConfiguration']['rawAttributes']);_0x1bd5c1[_0x9318('0x2c')]=_[_0x9318('0x2d')](_0x2c7eca['query']);_0x1bd5c1[_0x9318('0x2e')]=_[_0x9318('0x2f')](_0x1bd5c1[_0x9318('0x2b')],_0x1bd5c1[_0x9318('0x2c')]);_0x14b195[_0x9318('0x31')]=_[_0x9318('0x2f')](_0x1bd5c1['model'],qs['fields'](_0x2c7eca[_0x9318('0x2c')][_0x9318('0x30')]));_0x14b195[_0x9318('0x31')]=_0x14b195['attributes']['length']?_0x14b195[_0x9318('0x31')]:_0x1bd5c1['model'];_0x14b195[_0x9318('0x45')]=qs[_0x9318('0x34')](_0x2c7eca['query'][_0x9318('0x34')]);_0x14b195['where']=qs[_0x9318('0x2e')](_['pick'](_0x2c7eca[_0x9318('0x2c')],_0x1bd5c1[_0x9318('0x2e')]));if(_0x2c7eca[_0x9318('0x2c')][_0x9318('0x37')]){_0x14b195[_0x9318('0x35')]=_[_0x9318('0x39')](_0x14b195[_0x9318('0x35')],{'$or':_[_0x9318('0x27')](_0x14b195[_0x9318('0x31')],function(_0x37be4d){var _0x21ced4={};_0x21ced4[_0x37be4d]={'$like':'%'+_0x2c7eca[_0x9318('0x2c')][_0x9318('0x37')]+'%'};return _0x21ced4;})});}_0x14b195=_['merge']({},_0x14b195,_0x2c7eca[_0x9318('0x46')]);return _0x11b2ce[_0x9318('0x47')](_0x14b195);}})[_0x9318('0x20')](function(_0x2c98f4){if(_0x2c98f4){_0x2c41a0=_0x2c98f4['length'];if(!_0x2c7eca[_0x9318('0x2c')][_0x9318('0x48')](_0x9318('0x33'))){_0x14b195[_0x9318('0x18')]=qs[_0x9318('0x18')](_0x2c7eca[_0x9318('0x2c')]['limit']);_0x14b195[_0x9318('0x17')]=qs[_0x9318('0x17')](_0x2c7eca[_0x9318('0x2c')][_0x9318('0x17')]);}return _0x11b2ce[_0x9318('0x47')](_0x14b195);}})[_0x9318('0x20')](function(_0x34178d){if(_0x34178d){return _0x34178d?{'count':_0x2c41a0,'rows':_0x34178d}:null;}})[_0x9318('0x20')](respondWithResult(_0x221dc3,null))[_0x9318('0x3e')](handleError(_0x221dc3,null));};exports['addConfiguration']=function(_0x19db94,_0x1dbfcc,_0x1178fc){if(_0x19db94[_0x9318('0x42')]['id']){delete _0x19db94[_0x9318('0x42')]['id'];}return db[_0x9318('0x3a')]['findOne']({'where':{'id':_0x19db94['params']['id']}})[_0x9318('0x20')](handleEntityNotFound(_0x1dbfcc,null))[_0x9318('0x20')](function(_0x3b9b1c){if(_0x3b9b1c){_0x19db94['body'][_0x9318('0x49')]=_0x3b9b1c['id'];_0x19db94[_0x9318('0x42')][_0x9318('0x4a')]=integrations[_0x9318('0x4b')](_0x19db94[_0x9318('0x42')][_0x9318('0x4c')],_0x19db94['body'][_0x9318('0x2a')]);_0x19db94[_0x9318('0x42')][_0x9318('0x4d')]=integrations[_0x9318('0x4e')](_0x19db94[_0x9318('0x42')]['channel'],_0x19db94[_0x9318('0x42')][_0x9318('0x2a')]);return db[_0x9318('0x4f')][_0x9318('0x41')](_0x19db94[_0x9318('0x42')],{'include':[{'model':db[_0x9318('0x50')],'as':_0x9318('0x4a')},{'model':db[_0x9318('0x50')],'as':_0x9318('0x4d')}]});}return null;})[_0x9318('0x20')](respondWithResult(_0x1dbfcc,null))[_0x9318('0x3e')](handleError(_0x1dbfcc,null));};exports[_0x9318('0x51')]=function(_0x178fc5,_0x497171,_0x43850e){var _0x3ec6cb='';return db[_0x9318('0x3a')][_0x9318('0x44')]({'where':{'id':_0x178fc5['params']['id']},'attributes':['id',_0x9318('0x52'),_0x9318('0x53')]})[_0x9318('0x20')](handleEntityNotFound(_0x497171,null))[_0x9318('0x20')](function(_0x53900c){if(_0x53900c){_0x3ec6cb=_0x53900c[_0x9318('0x52')];var _0x2a4a07=_0x3ec6cb[_0x9318('0x54')](-0x1);if(_0x2a4a07==='/'){_0x3ec6cb=_0x3ec6cb['substring'](0x0,_0x3ec6cb['lastIndexOf'](_0x2a4a07));}return rp({'method':_0x9318('0x55'),'uri':util[_0x9318('0x56')]('%s/%s',_0x3ec6cb,_0x9318('0x57')),'headers':{'Authorization':util[_0x9318('0x56')](_0x9318('0x58'),new Buffer(util[_0x9318('0x56')]('%s:X',_0x53900c[_0x9318('0x53')]))[_0x9318('0x59')](_0x9318('0x5a')))},'json':!![]});}})[_0x9318('0x20')](function(_0x58e274){if(_0x58e274){var _0x197f01=[_0x9318('0x5b'),_0x9318('0x5c'),_0x9318('0x5d'),_0x9318('0x5e'),_0x9318('0x16'),'priority',_0x9318('0x5f'),_0x9318('0x60'),'ticket_type',_0x9318('0x5f'),_0x9318('0x61')];_['remove'](_0x58e274,function(_0xdde700){return _0x197f01[_0x9318('0x62')](_0xdde700[_0x9318('0x24')])||!_0xdde700[_0x9318('0x63')]&&_0xdde700[_0x9318('0x2a')]!=='custom_text'&&_0xdde700[_0x9318('0x2a')]!==_0x9318('0x64');});return{'count':_0x58e274['length'],'rows':_[_0x9318('0x27')](_0x58e274,function(_0x76fe43){return{'id':_0x76fe43['name'],'name':_0x76fe43[_0x9318('0x65')],'custom':!_0x76fe43[_0x9318('0x63')],'options':_0x76fe43[_0x9318('0x66')]?_[_0x9318('0x27')](_0x76fe43[_0x9318('0x66')],function(_0x34600f){return{'name':_[_0x9318('0x67')](_0x34600f),'value':_0x34600f};}):[]};})};}})['then'](respondWithResult(_0x497171,null))[_0x9318('0x3e')](function(_0x1b9b25){var _0x2ca2e6=_0x178fc5[_0x9318('0x2c')][_0x9318('0x68')]?0x1f4:_0x1b9b25[_0x9318('0x69')]||0x1f4;logger[_0x9318('0x6a')]('getFields,\x20%s,\x20%s,\x20%s',_0x9318('0x51'),_0x2ca2e6,JSON[_0x9318('0x6b')](_0x1b9b25));delete _0x1b9b25['name'];if(_0x2ca2e6===0x191){_0x2ca2e6=0x190;}_0x497171[_0x9318('0x16')](_0x2ca2e6)['send'](_0x178fc5[_0x9318('0x2c')][_0x9318('0x68')]?{'message':_0x9318('0x6c'),'statusCode':_0x1b9b25[_0x9318('0x69')]}:_0x1b9b25);});}; \ No newline at end of file +var _0x5e14=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','FreshdeskAccount','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','model','sort','pick','filters','where','filter','merge','options','include','findAll','rows','show','params','includeAll','find','create','body','catch','getConfigurations','findOne','FreshdeskConfiguration','length','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','type','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','api/v2/ticket_fields','%s:X','base64','requester','subject','description','priority','group','source','ticket_type','default','custom_text','custom_dropdown','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x4de9e8,_0x565ffa){var _0x4db0de=function(_0x12279d){while(--_0x12279d){_0x4de9e8['push'](_0x4de9e8['shift']());}};_0x4db0de(++_0x565ffa);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x45e1('0x0'));var rimraf=require(_0x45e1('0x1'));var zipdir=require(_0x45e1('0x2'));var jsonpatch=require(_0x45e1('0x3'));var rp=require(_0x45e1('0x4'));var moment=require(_0x45e1('0x5'));var BPromise=require(_0x45e1('0x6'));var Mustache=require(_0x45e1('0x7'));var util=require(_0x45e1('0x8'));var path=require(_0x45e1('0x9'));var sox=require(_0x45e1('0xa'));var csv=require(_0x45e1('0xb'));var ejs=require(_0x45e1('0xc'));var fs=require('fs');var fs_extra=require(_0x45e1('0xd'));var _=require(_0x45e1('0xe'));var squel=require(_0x45e1('0xf'));var crypto=require(_0x45e1('0x10'));var jsforce=require(_0x45e1('0x11'));var deskjs=require(_0x45e1('0x12'));var toCsv=require(_0x45e1('0xb'));var querystring=require(_0x45e1('0x13'));var Papa=require(_0x45e1('0x14'));var Redis=require('ioredis');var authService=require(_0x45e1('0x15'));var qs=require(_0x45e1('0x16'));var as=require(_0x45e1('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45e1('0x18'))('api');var utils=require(_0x45e1('0x19'));var config=require(_0x45e1('0x1a'));var licenseUtil=require(_0x45e1('0x1b'));var db=require(_0x45e1('0x1c'))['db'];var integrations=require(_0x45e1('0x1d'));function respondWithStatusCode(_0x2ec2b9,_0x2ab53e){_0x2ab53e=_0x2ab53e||0xcc;return function(_0x59e307){if(_0x59e307){return _0x2ec2b9[_0x45e1('0x1e')](_0x2ab53e);}return _0x2ec2b9[_0x45e1('0x1f')](_0x2ab53e)[_0x45e1('0x20')]();};}function respondWithResult(_0x370297,_0x4364a0){_0x4364a0=_0x4364a0||0xc8;return function(_0x235cb9){if(_0x235cb9){return _0x370297[_0x45e1('0x1f')](_0x4364a0)['json'](_0x235cb9);}};}function respondWithFilteredResult(_0x5d9dba,_0x2de680){return function(_0x53a90e){if(_0x53a90e){var _0x5095be=typeof _0x2de680['offset']===_0x45e1('0x21')&&typeof _0x2de680[_0x45e1('0x22')]===_0x45e1('0x21');var _0x474aa2=_0x53a90e[_0x45e1('0x23')];var _0xb67f34=_0x5095be?0x0:_0x2de680[_0x45e1('0x24')];var _0x22d927=_0x5095be?_0x53a90e['count']:_0x2de680[_0x45e1('0x24')]+_0x2de680['limit'];var _0x3134f4;if(_0x22d927>=_0x474aa2){_0x22d927=_0x474aa2;_0x3134f4=0xc8;}else{_0x3134f4=0xce;}_0x5d9dba[_0x45e1('0x1f')](_0x3134f4);return _0x5d9dba[_0x45e1('0x25')](_0x45e1('0x26'),_0xb67f34+'-'+_0x22d927+'/'+_0x474aa2)[_0x45e1('0x27')](_0x53a90e);}return null;};}function patchUpdates(_0x4f4884){return function(_0x34d043){try{jsonpatch[_0x45e1('0x28')](_0x34d043,_0x4f4884,!![]);}catch(_0x44d900){return BPromise[_0x45e1('0x29')](_0x44d900);}return _0x34d043[_0x45e1('0x2a')]();};}function saveUpdates(_0x32ae6b,_0x477b12){return function(_0x2bdd53){if(_0x2bdd53){return _0x2bdd53[_0x45e1('0x2b')](_0x32ae6b)[_0x45e1('0x2c')](function(_0x2f724b){return _0x2f724b;});}return null;};}function removeEntity(_0x51fb60,_0x3847dd){return function(_0x81ea3c){if(_0x81ea3c){return _0x81ea3c[_0x45e1('0x2d')]()[_0x45e1('0x2c')](function(){_0x51fb60[_0x45e1('0x1f')](0xcc)[_0x45e1('0x20')]();});}};}function handleEntityNotFound(_0x20f986,_0xb92fc){return function(_0x5cd4c6){if(!_0x5cd4c6){_0x20f986[_0x45e1('0x1e')](0x194);}return _0x5cd4c6;};}function handleError(_0x3889bf,_0x668f14){_0x668f14=_0x668f14||0x1f4;return function(_0x284695){logger[_0x45e1('0x2e')](_0x284695[_0x45e1('0x2f')]);if(_0x284695[_0x45e1('0x30')]){delete _0x284695[_0x45e1('0x30')];}_0x3889bf[_0x45e1('0x1f')](_0x668f14)['send'](_0x284695);};}exports[_0x45e1('0x31')]=function(_0x52c7cc,_0x400a20){var _0x1b97ff={},_0x4fccf0={},_0x2f42f2={'count':0x0,'rows':[]};var _0x327b22=_[_0x45e1('0x32')](db[_0x45e1('0x33')][_0x45e1('0x34')],function(_0x290d99){return{'name':_0x290d99[_0x45e1('0x35')],'type':_0x290d99['type'][_0x45e1('0x36')]};});_0x4fccf0['model']=_[_0x45e1('0x32')](_0x327b22,_0x45e1('0x30'));_0x4fccf0[_0x45e1('0x37')]=_[_0x45e1('0x38')](_0x52c7cc['query']);_0x4fccf0['filters']=_[_0x45e1('0x39')](_0x4fccf0['model'],_0x4fccf0[_0x45e1('0x37')]);_0x1b97ff[_0x45e1('0x3a')]=_[_0x45e1('0x39')](_0x4fccf0['model'],qs[_0x45e1('0x3b')](_0x52c7cc[_0x45e1('0x37')][_0x45e1('0x3b')]));_0x1b97ff[_0x45e1('0x3a')]=_0x1b97ff[_0x45e1('0x3a')]['length']?_0x1b97ff[_0x45e1('0x3a')]:_0x4fccf0[_0x45e1('0x3c')];if(!_0x52c7cc[_0x45e1('0x37')]['hasOwnProperty']('nolimit')){_0x1b97ff[_0x45e1('0x22')]=qs[_0x45e1('0x22')](_0x52c7cc['query']['limit']);_0x1b97ff[_0x45e1('0x24')]=qs[_0x45e1('0x24')](_0x52c7cc['query'][_0x45e1('0x24')]);}_0x1b97ff['order']=qs[_0x45e1('0x3d')](_0x52c7cc[_0x45e1('0x37')][_0x45e1('0x3d')]);_0x1b97ff['where']=qs['filters'](_[_0x45e1('0x3e')](_0x52c7cc[_0x45e1('0x37')],_0x4fccf0[_0x45e1('0x3f')]),_0x327b22);if(_0x52c7cc[_0x45e1('0x37')]['filter']){_0x1b97ff['where']=_['merge'](_0x1b97ff[_0x45e1('0x40')],{'$or':_[_0x45e1('0x32')](_0x327b22,function(_0x2c1500){if(_0x2c1500['type']!=='VIRTUAL'){var _0x55f92b={};_0x55f92b[_0x2c1500[_0x45e1('0x30')]]={'$like':'%'+_0x52c7cc[_0x45e1('0x37')][_0x45e1('0x41')]+'%'};return _0x55f92b;}})});}_0x1b97ff=_[_0x45e1('0x42')]({},_0x1b97ff,_0x52c7cc[_0x45e1('0x43')]);var _0x2ef57b={'where':_0x1b97ff['where']};return db[_0x45e1('0x33')][_0x45e1('0x23')](_0x2ef57b)[_0x45e1('0x2c')](function(_0x1a070e){_0x2f42f2['count']=_0x1a070e;if(_0x52c7cc[_0x45e1('0x37')]['includeAll']){_0x1b97ff[_0x45e1('0x44')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x45e1('0x45')](_0x1b97ff);})[_0x45e1('0x2c')](function(_0xacce1d){_0x2f42f2[_0x45e1('0x46')]=_0xacce1d;return _0x2f42f2;})[_0x45e1('0x2c')](respondWithFilteredResult(_0x400a20,_0x1b97ff))['catch'](handleError(_0x400a20,null));};exports[_0x45e1('0x47')]=function(_0x1dc9fe,_0x11e45b){var _0x46feb6={'raw':![],'where':{'id':_0x1dc9fe[_0x45e1('0x48')]['id']}},_0x1c1a10={};_0x1c1a10['model']=_[_0x45e1('0x38')](db[_0x45e1('0x33')]['rawAttributes']);_0x1c1a10[_0x45e1('0x37')]=_[_0x45e1('0x38')](_0x1dc9fe[_0x45e1('0x37')]);_0x1c1a10[_0x45e1('0x3f')]=_[_0x45e1('0x39')](_0x1c1a10[_0x45e1('0x3c')],_0x1c1a10[_0x45e1('0x37')]);_0x46feb6[_0x45e1('0x3a')]=_[_0x45e1('0x39')](_0x1c1a10[_0x45e1('0x3c')],qs[_0x45e1('0x3b')](_0x1dc9fe[_0x45e1('0x37')][_0x45e1('0x3b')]));_0x46feb6[_0x45e1('0x3a')]=_0x46feb6[_0x45e1('0x3a')]['length']?_0x46feb6[_0x45e1('0x3a')]:_0x1c1a10[_0x45e1('0x3c')];if(_0x1dc9fe[_0x45e1('0x37')][_0x45e1('0x49')]){_0x46feb6[_0x45e1('0x44')]=[{'all':!![]}];}_0x46feb6=_[_0x45e1('0x42')]({},_0x46feb6,_0x1dc9fe[_0x45e1('0x43')]);return db[_0x45e1('0x33')][_0x45e1('0x4a')](_0x46feb6)[_0x45e1('0x2c')](handleEntityNotFound(_0x11e45b,null))[_0x45e1('0x2c')](respondWithResult(_0x11e45b,null))['catch'](handleError(_0x11e45b,null));};exports[_0x45e1('0x4b')]=function(_0x4a6b2e,_0x21f7e9){return db[_0x45e1('0x33')][_0x45e1('0x4b')](_0x4a6b2e[_0x45e1('0x4c')],{})['then'](respondWithResult(_0x21f7e9,0xc9))[_0x45e1('0x4d')](handleError(_0x21f7e9,null));};exports[_0x45e1('0x2b')]=function(_0x17701d,_0x22eb5c){if(_0x17701d[_0x45e1('0x4c')]['id']){delete _0x17701d[_0x45e1('0x4c')]['id'];}return db['FreshdeskAccount'][_0x45e1('0x4a')]({'where':{'id':_0x17701d[_0x45e1('0x48')]['id']}})[_0x45e1('0x2c')](handleEntityNotFound(_0x22eb5c,null))[_0x45e1('0x2c')](saveUpdates(_0x17701d['body'],null))[_0x45e1('0x2c')](respondWithResult(_0x22eb5c,null))[_0x45e1('0x4d')](handleError(_0x22eb5c,null));};exports[_0x45e1('0x2d')]=function(_0x1c1824,_0x10580e){return db[_0x45e1('0x33')][_0x45e1('0x4a')]({'where':{'id':_0x1c1824[_0x45e1('0x48')]['id']}})[_0x45e1('0x2c')](handleEntityNotFound(_0x10580e,null))[_0x45e1('0x2c')](removeEntity(_0x10580e,null))['catch'](handleError(_0x10580e,null));};exports[_0x45e1('0x4e')]=function(_0x273043,_0x3234f1,_0x2126a9){var _0x5f1be7={};var _0x2a5a99={};var _0x10d9ff;var _0x4e0bca;return db[_0x45e1('0x33')][_0x45e1('0x4f')]({'where':{'id':_0x273043[_0x45e1('0x48')]['id']}})[_0x45e1('0x2c')](handleEntityNotFound(_0x3234f1,null))[_0x45e1('0x2c')](function(_0x5e08e1){if(_0x5e08e1){_0x10d9ff=_0x5e08e1;_0x2a5a99[_0x45e1('0x3c')]=_[_0x45e1('0x38')](db[_0x45e1('0x50')][_0x45e1('0x34')]);_0x2a5a99['query']=_[_0x45e1('0x38')](_0x273043[_0x45e1('0x37')]);_0x2a5a99['filters']=_[_0x45e1('0x39')](_0x2a5a99[_0x45e1('0x3c')],_0x2a5a99[_0x45e1('0x37')]);_0x5f1be7[_0x45e1('0x3a')]=_[_0x45e1('0x39')](_0x2a5a99[_0x45e1('0x3c')],qs['fields'](_0x273043['query']['fields']));_0x5f1be7[_0x45e1('0x3a')]=_0x5f1be7['attributes'][_0x45e1('0x51')]?_0x5f1be7[_0x45e1('0x3a')]:_0x2a5a99[_0x45e1('0x3c')];_0x5f1be7['order']=qs[_0x45e1('0x3d')](_0x273043[_0x45e1('0x37')][_0x45e1('0x3d')]);_0x5f1be7[_0x45e1('0x40')]=qs[_0x45e1('0x3f')](_['pick'](_0x273043[_0x45e1('0x37')],_0x2a5a99[_0x45e1('0x3f')]));if(_0x273043[_0x45e1('0x37')][_0x45e1('0x41')]){_0x5f1be7[_0x45e1('0x40')]=_[_0x45e1('0x42')](_0x5f1be7[_0x45e1('0x40')],{'$or':_['map'](_0x5f1be7[_0x45e1('0x3a')],function(_0x256d9c){var _0x194fdd={};_0x194fdd[_0x256d9c]={'$like':'%'+_0x273043[_0x45e1('0x37')][_0x45e1('0x41')]+'%'};return _0x194fdd;})});}_0x5f1be7=_[_0x45e1('0x42')]({},_0x5f1be7,_0x273043[_0x45e1('0x43')]);return _0x10d9ff[_0x45e1('0x4e')](_0x5f1be7);}})[_0x45e1('0x2c')](function(_0x3fd1ca){if(_0x3fd1ca){_0x4e0bca=_0x3fd1ca['length'];if(!_0x273043[_0x45e1('0x37')][_0x45e1('0x52')](_0x45e1('0x53'))){_0x5f1be7[_0x45e1('0x22')]=qs['limit'](_0x273043[_0x45e1('0x37')][_0x45e1('0x22')]);_0x5f1be7['offset']=qs[_0x45e1('0x24')](_0x273043[_0x45e1('0x37')][_0x45e1('0x24')]);}return _0x10d9ff['getConfigurations'](_0x5f1be7);}})[_0x45e1('0x2c')](function(_0x5c4b49){if(_0x5c4b49){return _0x5c4b49?{'count':_0x4e0bca,'rows':_0x5c4b49}:null;}})[_0x45e1('0x2c')](respondWithResult(_0x3234f1,null))[_0x45e1('0x4d')](handleError(_0x3234f1,null));};exports[_0x45e1('0x54')]=function(_0xf19241,_0x50bde2,_0x5b0cf4){if(_0xf19241[_0x45e1('0x4c')]['id']){delete _0xf19241[_0x45e1('0x4c')]['id'];}return db[_0x45e1('0x33')]['findOne']({'where':{'id':_0xf19241[_0x45e1('0x48')]['id']}})[_0x45e1('0x2c')](handleEntityNotFound(_0x50bde2,null))[_0x45e1('0x2c')](function(_0x1e9735){if(_0x1e9735){_0xf19241['body'][_0x45e1('0x55')]=_0x1e9735['id'];_0xf19241[_0x45e1('0x4c')][_0x45e1('0x56')]=integrations[_0x45e1('0x57')](_0xf19241[_0x45e1('0x4c')][_0x45e1('0x58')],_0xf19241[_0x45e1('0x4c')][_0x45e1('0x59')]);_0xf19241[_0x45e1('0x4c')]['Descriptions']=integrations[_0x45e1('0x5a')](_0xf19241['body'][_0x45e1('0x58')],_0xf19241[_0x45e1('0x4c')]['type']);return db[_0x45e1('0x50')][_0x45e1('0x4b')](_0xf19241[_0x45e1('0x4c')],{'include':[{'model':db[_0x45e1('0x5b')],'as':_0x45e1('0x56')},{'model':db[_0x45e1('0x5b')],'as':_0x45e1('0x5c')}]});}return null;})[_0x45e1('0x2c')](respondWithResult(_0x50bde2,null))[_0x45e1('0x4d')](handleError(_0x50bde2,null));};exports[_0x45e1('0x5d')]=function(_0xdd2fd1,_0x2c2b42,_0x47218e){var _0x398cf8='';return db[_0x45e1('0x33')]['findOne']({'where':{'id':_0xdd2fd1[_0x45e1('0x48')]['id']},'attributes':['id',_0x45e1('0x5e'),_0x45e1('0x5f')]})[_0x45e1('0x2c')](handleEntityNotFound(_0x2c2b42,null))[_0x45e1('0x2c')](function(_0xf29469){if(_0xf29469){_0x398cf8=_0xf29469[_0x45e1('0x5e')];var _0x12afc0=_0x398cf8[_0x45e1('0x60')](-0x1);if(_0x12afc0==='/'){_0x398cf8=_0x398cf8['substring'](0x0,_0x398cf8[_0x45e1('0x61')](_0x12afc0));}return rp({'method':_0x45e1('0x62'),'uri':util[_0x45e1('0x63')]('%s/%s',_0x398cf8,_0x45e1('0x64')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x45e1('0x63')](_0x45e1('0x65'),_0xf29469['apiKey']))['toString'](_0x45e1('0x66')))},'json':!![]});}})[_0x45e1('0x2c')](function(_0x156479){if(_0x156479){var _0xa4529f=[_0x45e1('0x67'),_0x45e1('0x68'),'agent',_0x45e1('0x69'),_0x45e1('0x1f'),_0x45e1('0x6a'),_0x45e1('0x6b'),_0x45e1('0x6c'),_0x45e1('0x6d'),_0x45e1('0x6b'),'company'];_['remove'](_0x156479,function(_0x22b3d8){return _0xa4529f['includes'](_0x22b3d8['name'])||!_0x22b3d8[_0x45e1('0x6e')]&&_0x22b3d8[_0x45e1('0x59')]!==_0x45e1('0x6f')&&_0x22b3d8[_0x45e1('0x59')]!==_0x45e1('0x70');});return{'count':_0x156479[_0x45e1('0x51')],'rows':_[_0x45e1('0x32')](_0x156479,function(_0x180f2d){return{'id':_0x180f2d[_0x45e1('0x30')],'name':_0x180f2d['label'],'custom':!_0x180f2d[_0x45e1('0x6e')],'options':_0x180f2d[_0x45e1('0x71')]?_[_0x45e1('0x32')](_0x180f2d[_0x45e1('0x71')],function(_0x5759f8){return{'name':_['capitalize'](_0x5759f8),'value':_0x5759f8};}):[]};})};}})['then'](respondWithResult(_0x2c2b42,null))[_0x45e1('0x4d')](function(_0x5700d0){var _0x3f2809=_0xdd2fd1[_0x45e1('0x37')][_0x45e1('0x72')]?0x1f4:_0x5700d0[_0x45e1('0x73')]||0x1f4;logger[_0x45e1('0x2e')](_0x45e1('0x74'),'getFields',_0x3f2809,JSON[_0x45e1('0x75')](_0x5700d0));delete _0x5700d0[_0x45e1('0x30')];if(_0x3f2809===0x191){_0x3f2809=0x190;}_0x2c2b42[_0x45e1('0x1f')](_0x3f2809)[_0x45e1('0x76')](_0xdd2fd1[_0x45e1('0x37')][_0x45e1('0x72')]?{'message':_0x45e1('0x77'),'statusCode':_0x5700d0[_0x45e1('0x73')]}:_0x5700d0);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 7d8e4d8..9cb4242 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 _0xd273=['path','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd273,0xaf));var _0x3d27=function(_0x4e52a4,_0x49428b){_0x4e52a4=_0x4e52a4-0x0;var _0x2db987=_0xd273[_0x4e52a4];return _0x2db987;};'use strict';var _=require(_0x3d27('0x0'));var util=require(_0x3d27('0x1'));var logger=require(_0x3d27('0x2'))(_0x3d27('0x3'));var moment=require(_0x3d27('0x4'));var BPromise=require(_0x3d27('0x5'));var rp=require(_0x3d27('0x6'));var fs=require('fs');var path=require(_0x3d27('0x7'));var rimraf=require('rimraf');var config=require(_0x3d27('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x3d27('0x9'));module[_0x3d27('0xa')]=function(_0x42ebd6,_0x29de49){return _0x42ebd6[_0x3d27('0xb')](_0x3d27('0xc'),attributes,{'tableName':_0x3d27('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3252=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','moment','request-promise','path','../../config/environment','./intFreshdeskAccount.attributes','exports'];(function(_0x49f760,_0x1a8f26){var _0x6d1f5b=function(_0x182b5c){while(--_0x182b5c){_0x49f760['push'](_0x49f760['shift']());}};_0x6d1f5b(++_0x1a8f26);}(_0x3252,0x18f));var _0x2325=function(_0x15b148,_0x6fd9b6){_0x15b148=_0x15b148-0x0;var _0x18819c=_0x3252[_0x15b148];return _0x18819c;};'use strict';var _=require(_0x2325('0x0'));var util=require('util');var logger=require(_0x2325('0x1'))('api');var moment=require(_0x2325('0x2'));var BPromise=require('bluebird');var rp=require(_0x2325('0x3'));var fs=require('fs');var path=require(_0x2325('0x4'));var rimraf=require('rimraf');var config=require(_0x2325('0x5'));var attributes=require(_0x2325('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x2325('0x7')]=function(_0x20bd5b,_0x3ac4d1){return _0x20bd5b[_0x2325('0x8')](_0x2325('0x9'),attributes,{'tableName':_0x2325('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 c127b75..556c54a 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 _0x7def=['options','raw','where','attributes','limit','include','model','map','GetFreshdeskAccount','ShowFreshdeskAccount','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','code','error','FreshdeskAccount,\x20%s,\x20%s','message','catch','FreshdeskAccount','findAll'];(function(_0x44434f,_0x1f3b10){var _0x1e9098=function(_0x329107){while(--_0x329107){_0x44434f['push'](_0x44434f['shift']());}};_0x1e9098(++_0x1f3b10);}(_0x7def,0x74));var _0xf7de=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x7def[_0x1b4b23];return _0x2a325b;};'use strict';var _=require(_0xf7de('0x0'));var util=require('util');var moment=require(_0xf7de('0x1'));var BPromise=require(_0xf7de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf7de('0x3'));var db=require(_0xf7de('0x4'))['db'];var utils=require(_0xf7de('0x5'));var logger=require(_0xf7de('0x6'))(_0xf7de('0x7'));var config=require(_0xf7de('0x8'));var jayson=require(_0xf7de('0x9'));var client=jayson[_0xf7de('0xa')][_0xf7de('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x99732f,_0x184463,_0x5dce30){return new BPromise(function(_0x11937a,_0x1858f0){return client['request'](_0x99732f,_0x5dce30)[_0xf7de('0xc')](function(_0x5bc95e){logger[_0xf7de('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x184463,_0xf7de('0xe'));logger[_0xf7de('0xf')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x184463,'request\x20sent',JSON[_0xf7de('0x10')](_0x5bc95e));if(_0x5bc95e['error']){if(_0x5bc95e['error'][_0xf7de('0x11')]===0x1f4){logger[_0xf7de('0x12')](_0xf7de('0x13'),_0x184463,_0x5bc95e['error'][_0xf7de('0x14')]);return _0x1858f0(_0x5bc95e[_0xf7de('0x12')]['message']);}logger[_0xf7de('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x184463,_0x5bc95e[_0xf7de('0x12')][_0xf7de('0x14')]);return _0x11937a(_0x5bc95e[_0xf7de('0x12')][_0xf7de('0x14')]);}else{logger[_0xf7de('0xd')](_0xf7de('0x13'),_0x184463,_0xf7de('0xe'));_0x11937a(_0x5bc95e['result']['message']);}})[_0xf7de('0x15')](function(_0x2eff72){logger['error'](_0xf7de('0x13'),_0x184463,_0x2eff72);_0x1858f0(_0x2eff72);});});}exports['GetFreshdeskAccount']=function(_0x44d721){var _0x30da00=this;return new Promise(function(_0x5b4dfd,_0x26bbbf){return db[_0xf7de('0x16')][_0xf7de('0x17')]({'raw':_0x44d721[_0xf7de('0x18')]?_0x44d721[_0xf7de('0x18')][_0xf7de('0x19')]===undefined?!![]:![]:!![],'where':_0x44d721[_0xf7de('0x18')]?_0x44d721[_0xf7de('0x18')][_0xf7de('0x1a')]||null:null,'attributes':_0x44d721[_0xf7de('0x18')]?_0x44d721[_0xf7de('0x18')][_0xf7de('0x1b')]||null:null,'limit':_0x44d721[_0xf7de('0x18')]?_0x44d721[_0xf7de('0x18')][_0xf7de('0x1c')]||null:null,'include':_0x44d721[_0xf7de('0x18')]?_0x44d721['options'][_0xf7de('0x1d')]?_['map'](_0x44d721['options']['include'],function(_0x2529ae){return{'model':db[_0x2529ae[_0xf7de('0x1e')]],'as':_0x2529ae['as'],'attributes':_0x2529ae[_0xf7de('0x1b')],'include':_0x2529ae[_0xf7de('0x1d')]?_[_0xf7de('0x1f')](_0x2529ae[_0xf7de('0x1d')],function(_0x2424ff){return{'model':db[_0x2424ff[_0xf7de('0x1e')]],'as':_0x2424ff['as'],'attributes':_0x2424ff['attributes'],'include':_0x2424ff[_0xf7de('0x1d')]?_[_0xf7de('0x1f')](_0x2424ff['include'],function(_0x28b8fb){return{'model':db[_0x28b8fb[_0xf7de('0x1e')]],'as':_0x28b8fb['as'],'attributes':_0x28b8fb[_0xf7de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf7de('0xc')](function(_0x416a1e){logger[_0xf7de('0xd')](_0xf7de('0x20'),_0x44d721);logger[_0xf7de('0xf')]('GetFreshdeskAccount',_0x44d721,JSON[_0xf7de('0x10')](_0x416a1e));_0x5b4dfd(_0x416a1e);})[_0xf7de('0x15')](function(_0x246f7e){logger[_0xf7de('0x12')](_0xf7de('0x20'),_0x246f7e[_0xf7de('0x14')],_0x44d721);_0x26bbbf(_0x30da00[_0xf7de('0x12')](0x1f4,_0x246f7e['message']));});});};exports[_0xf7de('0x21')]=function(_0xd6d679){var _0x4d61bd=this;return new Promise(function(_0x3d9941,_0x426db3){return db['FreshdeskAccount'][_0xf7de('0x22')]({'raw':_0xd6d679['options']?_0xd6d679[_0xf7de('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xd6d679[_0xf7de('0x18')]?_0xd6d679[_0xf7de('0x18')][_0xf7de('0x1a')]||null:null,'attributes':_0xd6d679['options']?_0xd6d679[_0xf7de('0x18')][_0xf7de('0x1b')]||null:null,'include':_0xd6d679[_0xf7de('0x18')]?_0xd6d679[_0xf7de('0x18')]['include']?_[_0xf7de('0x1f')](_0xd6d679['options'][_0xf7de('0x1d')],function(_0x5635dd){return{'model':db[_0x5635dd[_0xf7de('0x1e')]],'as':_0x5635dd['as'],'attributes':_0x5635dd[_0xf7de('0x1b')],'include':_0x5635dd[_0xf7de('0x1d')]?_[_0xf7de('0x1f')](_0x5635dd[_0xf7de('0x1d')],function(_0x5c9eb6){return{'model':db[_0x5c9eb6[_0xf7de('0x1e')]],'as':_0x5c9eb6['as'],'attributes':_0x5c9eb6[_0xf7de('0x1b')],'include':_0x5c9eb6[_0xf7de('0x1d')]?_['map'](_0x5c9eb6[_0xf7de('0x1d')],function(_0x2dc0d5){return{'model':db[_0x2dc0d5[_0xf7de('0x1e')]],'as':_0x2dc0d5['as'],'attributes':_0x2dc0d5[_0xf7de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf7de('0xc')](function(_0x584843){logger[_0xf7de('0xd')](_0xf7de('0x21'),_0xd6d679);logger[_0xf7de('0xf')](_0xf7de('0x21'),_0xd6d679,JSON[_0xf7de('0x10')](_0x584843));_0x3d9941(_0x584843);})['catch'](function(_0x4019cf){logger[_0xf7de('0x12')](_0xf7de('0x21'),_0x4019cf['message'],_0xd6d679);_0x426db3(_0x4d61bd[_0xf7de('0x12')](0x1f4,_0x4019cf[_0xf7de('0x14')]));});});}; \ No newline at end of file +var _0xe0e8=['attributes','limit','include','map','model','stringify','ShowFreshdeskAccount','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','message','catch','GetFreshdeskAccount','findAll','options','raw'];(function(_0x562f3b,_0x4c65ae){var _0x1edd55=function(_0xe67e06){while(--_0xe67e06){_0x562f3b['push'](_0x562f3b['shift']());}};_0x1edd55(++_0x4c65ae);}(_0xe0e8,0x1c8));var _0x8e0e=function(_0x5292fc,_0x1bd395){_0x5292fc=_0x5292fc-0x0;var _0x1c48ad=_0xe0e8[_0x5292fc];return _0x1c48ad;};'use strict';var _=require(_0x8e0e('0x0'));var util=require('util');var moment=require(_0x8e0e('0x1'));var BPromise=require(_0x8e0e('0x2'));var rs=require(_0x8e0e('0x3'));var fs=require('fs');var Redis=require(_0x8e0e('0x4'));var db=require(_0x8e0e('0x5'))['db'];var utils=require(_0x8e0e('0x6'));var logger=require('../../config/logger')(_0x8e0e('0x7'));var config=require(_0x8e0e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8e0e('0x9')][_0x8e0e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7b4c8c,_0x36a988,_0x442342){return new BPromise(function(_0x7b66f5,_0x845b4d){return client['request'](_0x7b4c8c,_0x442342)[_0x8e0e('0xb')](function(_0x1ce843){logger[_0x8e0e('0xc')](_0x8e0e('0xd'),_0x36a988,_0x8e0e('0xe'));logger[_0x8e0e('0xf')](_0x8e0e('0x10'),_0x36a988,_0x8e0e('0xe'),JSON['stringify'](_0x1ce843));if(_0x1ce843['error']){if(_0x1ce843[_0x8e0e('0x11')]['code']===0x1f4){logger[_0x8e0e('0x11')](_0x8e0e('0xd'),_0x36a988,_0x1ce843[_0x8e0e('0x11')][_0x8e0e('0x12')]);return _0x845b4d(_0x1ce843['error'][_0x8e0e('0x12')]);}logger[_0x8e0e('0x11')](_0x8e0e('0xd'),_0x36a988,_0x1ce843['error']['message']);return _0x7b66f5(_0x1ce843[_0x8e0e('0x11')]['message']);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x36a988,'request\x20sent');_0x7b66f5(_0x1ce843['result']['message']);}})[_0x8e0e('0x13')](function(_0x331c07){logger[_0x8e0e('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x36a988,_0x331c07);_0x845b4d(_0x331c07);});});}exports[_0x8e0e('0x14')]=function(_0x557b86){var _0x575752=this;return new Promise(function(_0x5a70ea,_0x55b02b){return db['FreshdeskAccount'][_0x8e0e('0x15')]({'raw':_0x557b86[_0x8e0e('0x16')]?_0x557b86[_0x8e0e('0x16')][_0x8e0e('0x17')]===undefined?!![]:![]:!![],'where':_0x557b86[_0x8e0e('0x16')]?_0x557b86[_0x8e0e('0x16')]['where']||null:null,'attributes':_0x557b86[_0x8e0e('0x16')]?_0x557b86['options'][_0x8e0e('0x18')]||null:null,'limit':_0x557b86['options']?_0x557b86[_0x8e0e('0x16')][_0x8e0e('0x19')]||null:null,'include':_0x557b86['options']?_0x557b86[_0x8e0e('0x16')][_0x8e0e('0x1a')]?_[_0x8e0e('0x1b')](_0x557b86['options']['include'],function(_0x266f35){return{'model':db[_0x266f35[_0x8e0e('0x1c')]],'as':_0x266f35['as'],'attributes':_0x266f35[_0x8e0e('0x18')],'include':_0x266f35[_0x8e0e('0x1a')]?_[_0x8e0e('0x1b')](_0x266f35['include'],function(_0x4d1309){return{'model':db[_0x4d1309[_0x8e0e('0x1c')]],'as':_0x4d1309['as'],'attributes':_0x4d1309[_0x8e0e('0x18')],'include':_0x4d1309['include']?_[_0x8e0e('0x1b')](_0x4d1309['include'],function(_0x1fa12a){return{'model':db[_0x1fa12a[_0x8e0e('0x1c')]],'as':_0x1fa12a['as'],'attributes':_0x1fa12a[_0x8e0e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8e0e('0xb')](function(_0x2ccc77){logger['info'](_0x8e0e('0x14'),_0x557b86);logger['debug'](_0x8e0e('0x14'),_0x557b86,JSON[_0x8e0e('0x1d')](_0x2ccc77));_0x5a70ea(_0x2ccc77);})[_0x8e0e('0x13')](function(_0x385569){logger['error'](_0x8e0e('0x14'),_0x385569[_0x8e0e('0x12')],_0x557b86);_0x55b02b(_0x575752[_0x8e0e('0x11')](0x1f4,_0x385569[_0x8e0e('0x12')]));});});};exports[_0x8e0e('0x1e')]=function(_0x19eaf6){var _0x2806cb=this;return new Promise(function(_0x1b853f,_0x37b152){return db['FreshdeskAccount']['find']({'raw':_0x19eaf6[_0x8e0e('0x16')]?_0x19eaf6[_0x8e0e('0x16')][_0x8e0e('0x17')]===undefined?!![]:![]:!![],'where':_0x19eaf6[_0x8e0e('0x16')]?_0x19eaf6[_0x8e0e('0x16')][_0x8e0e('0x1f')]||null:null,'attributes':_0x19eaf6['options']?_0x19eaf6[_0x8e0e('0x16')][_0x8e0e('0x18')]||null:null,'include':_0x19eaf6['options']?_0x19eaf6[_0x8e0e('0x16')]['include']?_['map'](_0x19eaf6[_0x8e0e('0x16')][_0x8e0e('0x1a')],function(_0x24b05c){return{'model':db[_0x24b05c['model']],'as':_0x24b05c['as'],'attributes':_0x24b05c[_0x8e0e('0x18')],'include':_0x24b05c[_0x8e0e('0x1a')]?_['map'](_0x24b05c[_0x8e0e('0x1a')],function(_0x59364f){return{'model':db[_0x59364f[_0x8e0e('0x1c')]],'as':_0x59364f['as'],'attributes':_0x59364f['attributes'],'include':_0x59364f[_0x8e0e('0x1a')]?_[_0x8e0e('0x1b')](_0x59364f[_0x8e0e('0x1a')],function(_0x127986){return{'model':db[_0x127986[_0x8e0e('0x1c')]],'as':_0x127986['as'],'attributes':_0x127986[_0x8e0e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8e0e('0xb')](function(_0x2191ff){logger[_0x8e0e('0xc')]('ShowFreshdeskAccount',_0x19eaf6);logger['debug']('ShowFreshdeskAccount',_0x19eaf6,JSON['stringify'](_0x2191ff));_0x1b853f(_0x2191ff);})[_0x8e0e('0x13')](function(_0xacd722){logger[_0x8e0e('0x11')](_0x8e0e('0x1e'),_0xacd722['message'],_0x19eaf6);_0x37b152(_0x2806cb[_0x8e0e('0x11')](0x1f4,_0xacd722[_0x8e0e('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 37d28db..7bcbe32 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 _0x303d=['/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','/:id','update','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','show'];(function(_0x46d765,_0x3940af){var _0x53bb37=function(_0x1b65c3){while(--_0x1b65c3){_0x46d765['push'](_0x46d765['shift']());}};_0x53bb37(++_0x3940af);}(_0x303d,0x183));var _0xd303=function(_0xfb6cef,_0x206adf){_0xfb6cef=_0xfb6cef-0x0;var _0x40eb07=_0x303d[_0xfb6cef];return _0x40eb07;};'use strict';var multer=require(_0xd303('0x0'));var util=require(_0xd303('0x1'));var path=require(_0xd303('0x2'));var timeout=require('connect-timeout');var express=require(_0xd303('0x3'));var router=express[_0xd303('0x4')]();var fs_extra=require(_0xd303('0x5'));var auth=require(_0xd303('0x6'));var interaction=require(_0xd303('0x7'));var config=require(_0xd303('0x8'));var controller=require(_0xd303('0x9'));router[_0xd303('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd303('0xa')]('/:id',auth[_0xd303('0xb')](),controller[_0xd303('0xc')]);router[_0xd303('0xa')](_0xd303('0xd'),auth['isAuthenticated'](),controller[_0xd303('0xe')]);router['get'](_0xd303('0xf'),auth[_0xd303('0xb')](),controller['getSubjects']);router[_0xd303('0xa')](_0xd303('0x10'),auth['isAuthenticated'](),controller[_0xd303('0x11')]);router[_0xd303('0xa')](_0xd303('0x12'),auth['isAuthenticated'](),controller[_0xd303('0x13')]);router[_0xd303('0x14')]('/',auth[_0xd303('0xb')](),controller[_0xd303('0x15')]);router['post']('/:id/tags',auth['isAuthenticated'](),controller[_0xd303('0x16')]);router['put'](_0xd303('0x17'),auth['isAuthenticated'](),controller[_0xd303('0x18')]);router['delete'](_0xd303('0x17'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xdc97=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x285118,_0x36caee){var _0x5a1b03=function(_0xb61a9e){while(--_0xb61a9e){_0x285118['push'](_0x285118['shift']());}};_0x5a1b03(++_0x36caee);}(_0xdc97,0x126));var _0x7dc9=function(_0x170d43,_0xffdb44){_0x170d43=_0x170d43-0x0;var _0x4024fa=_0xdc97[_0x170d43];return _0x4024fa;};'use strict';var multer=require(_0x7dc9('0x0'));var util=require('util');var path=require(_0x7dc9('0x1'));var timeout=require(_0x7dc9('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x7dc9('0x3'));var auth=require(_0x7dc9('0x4'));var interaction=require(_0x7dc9('0x5'));var config=require(_0x7dc9('0x6'));var controller=require(_0x7dc9('0x7'));router[_0x7dc9('0x8')]('/',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xa')]);router['get']('/:id',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xb')]);router['get'](_0x7dc9('0xc'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xd')]);router[_0x7dc9('0x8')]('/:id/subjects',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0xe')]);router[_0x7dc9('0x8')](_0x7dc9('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x7dc9('0x8')](_0x7dc9('0x10'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x11')]);router[_0x7dc9('0x12')]('/',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x13')]);router['post']('/:id/tags',auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x14')]);router[_0x7dc9('0x15')](_0x7dc9('0x16'),auth['isAuthenticated'](),controller[_0x7dc9('0x17')]);router[_0x7dc9('0x18')](_0x7dc9('0x16'),auth[_0x7dc9('0x9')](),controller[_0x7dc9('0x19')]);module[_0x7dc9('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 66c976d..44dc92d 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 _0xdac8=['sequelize','exports','STRING'];(function(_0x3173ac,_0x21a00a){var _0x4b53ef=function(_0x4d7811){while(--_0x4d7811){_0x3173ac['push'](_0x3173ac['shift']());}};_0x4b53ef(++_0x21a00a);}(_0xdac8,0xcf));var _0x8dac=function(_0x3bffb1,_0x444c4b){_0x3bffb1=_0x3bffb1-0x0;var _0x3fd6d9=_0xdac8[_0x3bffb1];return _0x3fd6d9;};'use strict';var Sequelize=require(_0x8dac('0x0'));module[_0x8dac('0x1')]={'name':{'type':Sequelize[_0x8dac('0x2')]},'description':{'type':Sequelize[_0x8dac('0x2')]}}; \ No newline at end of file +var _0x32eb=['sequelize'];(function(_0x4c85b5,_0x16d28a){var _0x4bb9ac=function(_0x1a51b6){while(--_0x1a51b6){_0x4c85b5['push'](_0x4c85b5['shift']());}};_0x4bb9ac(++_0x16d28a);}(_0x32eb,0xe0));var _0xb32e=function(_0xd0cd0b,_0x490956){_0xd0cd0b=_0xd0cd0b-0x0;var _0x59cced=_0x32eb[_0xd0cd0b];return _0x59cced;};'use strict';var Sequelize=require(_0xb32e('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index aeb5e4f..6881693 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 _0xeb37=['order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','update','body','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','destroy','then','end','error','stack','name','FreshdeskConfiguration','rawAttributes','type','key','model','map','keys','query','intersection','fields','attributes','length','nolimit'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xeb37,0x19d));var _0x7eb3=function(_0x46ed50,_0x3fb7e1){_0x46ed50=_0x46ed50-0x0;var _0x23e9b9=_0xeb37[_0x46ed50];return _0x23e9b9;};'use strict';var emlformat=require(_0x7eb3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7eb3('0x1'));var jsonpatch=require(_0x7eb3('0x2'));var rp=require('request-promise');var moment=require(_0x7eb3('0x3'));var BPromise=require(_0x7eb3('0x4'));var Mustache=require(_0x7eb3('0x5'));var util=require(_0x7eb3('0x6'));var path=require(_0x7eb3('0x7'));var sox=require(_0x7eb3('0x8'));var csv=require(_0x7eb3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7eb3('0xa'));var squel=require('squel');var crypto=require(_0x7eb3('0xb'));var jsforce=require(_0x7eb3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7eb3('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7eb3('0xd'));var authService=require(_0x7eb3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x7eb3('0xf'));var hardwareService=require(_0x7eb3('0x10'));var logger=require(_0x7eb3('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7eb3('0x12'));var db=require(_0x7eb3('0x13'))['db'];function respondWithStatusCode(_0x407efe,_0x1ec41c){_0x1ec41c=_0x1ec41c||0xcc;return function(_0x3ab6ce){if(_0x3ab6ce){return _0x407efe[_0x7eb3('0x14')](_0x1ec41c);}return _0x407efe[_0x7eb3('0x15')](_0x1ec41c)['end']();};}function respondWithResult(_0x1bdb6f,_0x2fa1ca){_0x2fa1ca=_0x2fa1ca||0xc8;return function(_0x4733cd){if(_0x4733cd){return _0x1bdb6f['status'](_0x2fa1ca)[_0x7eb3('0x16')](_0x4733cd);}};}function respondWithFilteredResult(_0x15ab4a,_0x5cb19e){return function(_0x2c98e0){if(_0x2c98e0){var _0x43cae2=typeof _0x5cb19e[_0x7eb3('0x17')]===_0x7eb3('0x18')&&typeof _0x5cb19e['limit']===_0x7eb3('0x18');var _0x2dd770=_0x2c98e0[_0x7eb3('0x19')];var _0x1482e2=_0x43cae2?0x0:_0x5cb19e[_0x7eb3('0x17')];var _0x4bdd61=_0x43cae2?_0x2c98e0[_0x7eb3('0x19')]:_0x5cb19e[_0x7eb3('0x17')]+_0x5cb19e[_0x7eb3('0x1a')];var _0x16b267;if(_0x4bdd61>=_0x2dd770){_0x4bdd61=_0x2dd770;_0x16b267=0xc8;}else{_0x16b267=0xce;}_0x15ab4a['status'](_0x16b267);return _0x15ab4a[_0x7eb3('0x1b')]('Content-Range',_0x1482e2+'-'+_0x4bdd61+'/'+_0x2dd770)[_0x7eb3('0x16')](_0x2c98e0);}return null;};}function patchUpdates(_0x1199e3){return function(_0x2bf9a9){try{jsonpatch[_0x7eb3('0x1c')](_0x2bf9a9,_0x1199e3,!![]);}catch(_0x1f06fd){return BPromise['reject'](_0x1f06fd);}return _0x2bf9a9[_0x7eb3('0x1d')]();};}function saveUpdates(_0x91572f,_0x583eb7){return function(_0x21bff4){if(_0x21bff4){return _0x21bff4['update'](_0x91572f)['then'](function(_0x541fad){return _0x541fad;});}return null;};}function removeEntity(_0x1e6301,_0x420ec3){return function(_0xc8415c){if(_0xc8415c){return _0xc8415c[_0x7eb3('0x1e')]()[_0x7eb3('0x1f')](function(){_0x1e6301['status'](0xcc)[_0x7eb3('0x20')]();});}};}function handleEntityNotFound(_0x2e37ed,_0x9adedd){return function(_0x3d392a){if(!_0x3d392a){_0x2e37ed['sendStatus'](0x194);}return _0x3d392a;};}function handleError(_0x20eabe,_0x562dc1){_0x562dc1=_0x562dc1||0x1f4;return function(_0x503ea8){logger[_0x7eb3('0x21')](_0x503ea8[_0x7eb3('0x22')]);if(_0x503ea8['name']){delete _0x503ea8[_0x7eb3('0x23')];}_0x20eabe[_0x7eb3('0x15')](_0x562dc1)['send'](_0x503ea8);};}exports['index']=function(_0x233e1c,_0x45c282){var _0x5158b9={},_0x565e12={},_0x2ca8bf={'count':0x0,'rows':[]};var _0xefc3b9=_['map'](db[_0x7eb3('0x24')][_0x7eb3('0x25')],function(_0x5c28b9){return{'name':_0x5c28b9['fieldName'],'type':_0x5c28b9[_0x7eb3('0x26')][_0x7eb3('0x27')]};});_0x565e12[_0x7eb3('0x28')]=_[_0x7eb3('0x29')](_0xefc3b9,_0x7eb3('0x23'));_0x565e12['query']=_[_0x7eb3('0x2a')](_0x233e1c[_0x7eb3('0x2b')]);_0x565e12['filters']=_['intersection'](_0x565e12['model'],_0x565e12['query']);_0x5158b9['attributes']=_[_0x7eb3('0x2c')](_0x565e12[_0x7eb3('0x28')],qs['fields'](_0x233e1c[_0x7eb3('0x2b')][_0x7eb3('0x2d')]));_0x5158b9[_0x7eb3('0x2e')]=_0x5158b9[_0x7eb3('0x2e')][_0x7eb3('0x2f')]?_0x5158b9['attributes']:_0x565e12['model'];if(!_0x233e1c['query']['hasOwnProperty'](_0x7eb3('0x30'))){_0x5158b9[_0x7eb3('0x1a')]=qs[_0x7eb3('0x1a')](_0x233e1c[_0x7eb3('0x2b')][_0x7eb3('0x1a')]);_0x5158b9[_0x7eb3('0x17')]=qs[_0x7eb3('0x17')](_0x233e1c['query'][_0x7eb3('0x17')]);}_0x5158b9[_0x7eb3('0x31')]=qs['sort'](_0x233e1c[_0x7eb3('0x2b')][_0x7eb3('0x32')]);_0x5158b9[_0x7eb3('0x33')]=qs[_0x7eb3('0x34')](_[_0x7eb3('0x35')](_0x233e1c[_0x7eb3('0x2b')],_0x565e12[_0x7eb3('0x34')]),_0xefc3b9);if(_0x233e1c[_0x7eb3('0x2b')][_0x7eb3('0x36')]){_0x5158b9[_0x7eb3('0x33')]=_['merge'](_0x5158b9[_0x7eb3('0x33')],{'$or':_[_0x7eb3('0x29')](_0xefc3b9,function(_0x5b0537){if(_0x5b0537[_0x7eb3('0x26')]!==_0x7eb3('0x37')){var _0x2445b7={};_0x2445b7[_0x5b0537['name']]={'$like':'%'+_0x233e1c[_0x7eb3('0x2b')][_0x7eb3('0x36')]+'%'};return _0x2445b7;}})});}_0x5158b9=_[_0x7eb3('0x38')]({},_0x5158b9,_0x233e1c[_0x7eb3('0x39')]);var _0x39818b={'where':_0x5158b9[_0x7eb3('0x33')]};return db['FreshdeskConfiguration'][_0x7eb3('0x19')](_0x39818b)[_0x7eb3('0x1f')](function(_0x492d30){_0x2ca8bf[_0x7eb3('0x19')]=_0x492d30;if(_0x233e1c['query'][_0x7eb3('0x3a')]){_0x5158b9[_0x7eb3('0x3b')]=[{'all':!![]}];}return db[_0x7eb3('0x24')]['findAll'](_0x5158b9);})['then'](function(_0x5bb065){_0x2ca8bf[_0x7eb3('0x3c')]=_0x5bb065;return _0x2ca8bf;})['then'](respondWithFilteredResult(_0x45c282,_0x5158b9))[_0x7eb3('0x3d')](handleError(_0x45c282,null));};exports[_0x7eb3('0x3e')]=function(_0x31ed96,_0x426f95){var _0x2f5288={'raw':![],'where':{'id':_0x31ed96[_0x7eb3('0x3f')]['id']}},_0x44cca9={};_0x44cca9[_0x7eb3('0x28')]=_[_0x7eb3('0x2a')](db[_0x7eb3('0x24')][_0x7eb3('0x25')]);_0x44cca9[_0x7eb3('0x2b')]=_['keys'](_0x31ed96[_0x7eb3('0x2b')]);_0x44cca9[_0x7eb3('0x34')]=_[_0x7eb3('0x2c')](_0x44cca9[_0x7eb3('0x28')],_0x44cca9[_0x7eb3('0x2b')]);_0x2f5288['attributes']=_[_0x7eb3('0x2c')](_0x44cca9[_0x7eb3('0x28')],qs[_0x7eb3('0x2d')](_0x31ed96[_0x7eb3('0x2b')]['fields']));_0x2f5288[_0x7eb3('0x2e')]=_0x2f5288[_0x7eb3('0x2e')][_0x7eb3('0x2f')]?_0x2f5288[_0x7eb3('0x2e')]:_0x44cca9[_0x7eb3('0x28')];if(_0x31ed96[_0x7eb3('0x2b')][_0x7eb3('0x3a')]){_0x2f5288['include']=[{'all':!![]}];}_0x2f5288=_[_0x7eb3('0x38')]({},_0x2f5288,_0x31ed96[_0x7eb3('0x39')]);return db[_0x7eb3('0x24')][_0x7eb3('0x40')](_0x2f5288)['then'](handleEntityNotFound(_0x426f95,null))[_0x7eb3('0x1f')](respondWithResult(_0x426f95,null))['catch'](handleError(_0x426f95,null));};exports[_0x7eb3('0x41')]=function(_0xdf4cbc,_0x1fb493){return db[_0x7eb3('0x24')]['create'](_0xdf4cbc['body'],{})[_0x7eb3('0x1f')](respondWithResult(_0x1fb493,0xc9))[_0x7eb3('0x3d')](handleError(_0x1fb493,null));};exports[_0x7eb3('0x42')]=function(_0x29ba5c,_0x1b620d){if(_0x29ba5c[_0x7eb3('0x43')]['id']){delete _0x29ba5c[_0x7eb3('0x43')]['id'];}return db[_0x7eb3('0x24')][_0x7eb3('0x40')]({'where':{'id':_0x29ba5c[_0x7eb3('0x3f')]['id']}})[_0x7eb3('0x1f')](handleEntityNotFound(_0x1b620d,null))['then'](saveUpdates(_0x29ba5c[_0x7eb3('0x43')],null))[_0x7eb3('0x1f')](respondWithResult(_0x1b620d,null))['catch'](handleError(_0x1b620d,null));};exports[_0x7eb3('0x1e')]=function(_0x16a8ca,_0x39cd6f){return db[_0x7eb3('0x24')][_0x7eb3('0x40')]({'where':{'id':_0x16a8ca['params']['id']}})[_0x7eb3('0x1f')](handleEntityNotFound(_0x39cd6f,null))[_0x7eb3('0x1f')](removeEntity(_0x39cd6f,null))[_0x7eb3('0x3d')](handleError(_0x39cd6f,null));};exports[_0x7eb3('0x44')]=function(_0x199f88,_0x5241a9,_0x1def8e){var _0xbe6e15={};var _0xfc7dcc={};var _0x8a6c9;var _0x310e7c;return db[_0x7eb3('0x24')][_0x7eb3('0x45')]({'where':{'id':_0x199f88[_0x7eb3('0x3f')]['id']}})[_0x7eb3('0x1f')](handleEntityNotFound(_0x5241a9,null))[_0x7eb3('0x1f')](function(_0x52611b){if(_0x52611b){_0x8a6c9=_0x52611b;_0xfc7dcc['model']=_['keys'](db[_0x7eb3('0x46')][_0x7eb3('0x25')]);_0xfc7dcc['query']=_[_0x7eb3('0x2a')](_0x199f88[_0x7eb3('0x2b')]);_0xfc7dcc['filters']=_[_0x7eb3('0x2c')](_0xfc7dcc[_0x7eb3('0x28')],_0xfc7dcc[_0x7eb3('0x2b')]);_0xbe6e15[_0x7eb3('0x2e')]=_[_0x7eb3('0x2c')](_0xfc7dcc['model'],qs[_0x7eb3('0x2d')](_0x199f88['query'][_0x7eb3('0x2d')]));_0xbe6e15[_0x7eb3('0x2e')]=_0xbe6e15[_0x7eb3('0x2e')][_0x7eb3('0x2f')]?_0xbe6e15[_0x7eb3('0x2e')]:_0xfc7dcc[_0x7eb3('0x28')];_0xbe6e15[_0x7eb3('0x31')]=qs[_0x7eb3('0x32')](_0x199f88[_0x7eb3('0x2b')][_0x7eb3('0x32')]);_0xbe6e15[_0x7eb3('0x33')]=qs[_0x7eb3('0x34')](_[_0x7eb3('0x35')](_0x199f88[_0x7eb3('0x2b')],_0xfc7dcc[_0x7eb3('0x34')]));if(_0x199f88[_0x7eb3('0x2b')][_0x7eb3('0x36')]){_0xbe6e15['where']=_['merge'](_0xbe6e15['where'],{'$or':_['map'](_0xbe6e15['attributes'],function(_0x1e4c78){var _0x6f310c={};_0x6f310c[_0x1e4c78]={'$like':'%'+_0x199f88[_0x7eb3('0x2b')]['filter']+'%'};return _0x6f310c;})});}_0xbe6e15=_[_0x7eb3('0x38')]({},_0xbe6e15,_0x199f88[_0x7eb3('0x39')]);return _0x8a6c9[_0x7eb3('0x44')](_0xbe6e15);}})['then'](function(_0xef0a24){if(_0xef0a24){_0x310e7c=_0xef0a24[_0x7eb3('0x2f')];if(!_0x199f88['query'][_0x7eb3('0x47')](_0x7eb3('0x30'))){_0xbe6e15[_0x7eb3('0x1a')]=qs[_0x7eb3('0x1a')](_0x199f88['query'][_0x7eb3('0x1a')]);_0xbe6e15['offset']=qs[_0x7eb3('0x17')](_0x199f88[_0x7eb3('0x2b')]['offset']);}return _0x8a6c9['getFields'](_0xbe6e15);}})['then'](function(_0x3d85dd){if(_0x3d85dd){return _0x3d85dd?{'count':_0x310e7c,'rows':_0x3d85dd}:null;}})[_0x7eb3('0x1f')](respondWithResult(_0x5241a9,null))[_0x7eb3('0x3d')](handleError(_0x5241a9,null));};exports[_0x7eb3('0x48')]=function(_0x30320d,_0x3be78b,_0x1ef7ba){var _0x27785c={};var _0x28bf37={};var _0x43f9bc;var _0x4802e3;return db[_0x7eb3('0x24')][_0x7eb3('0x45')]({'where':{'id':_0x30320d[_0x7eb3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3be78b,null))['then'](function(_0x5f5cd6){if(_0x5f5cd6){_0x43f9bc=_0x5f5cd6;_0x28bf37[_0x7eb3('0x28')]=_[_0x7eb3('0x2a')](db[_0x7eb3('0x46')][_0x7eb3('0x25')]);_0x28bf37[_0x7eb3('0x2b')]=_[_0x7eb3('0x2a')](_0x30320d['query']);_0x28bf37[_0x7eb3('0x34')]=_['intersection'](_0x28bf37[_0x7eb3('0x28')],_0x28bf37[_0x7eb3('0x2b')]);_0x27785c[_0x7eb3('0x2e')]=_[_0x7eb3('0x2c')](_0x28bf37[_0x7eb3('0x28')],qs[_0x7eb3('0x2d')](_0x30320d[_0x7eb3('0x2b')]['fields']));_0x27785c['attributes']=_0x27785c[_0x7eb3('0x2e')][_0x7eb3('0x2f')]?_0x27785c[_0x7eb3('0x2e')]:_0x28bf37[_0x7eb3('0x28')];_0x27785c[_0x7eb3('0x31')]=qs[_0x7eb3('0x32')](_0x30320d[_0x7eb3('0x2b')][_0x7eb3('0x32')]);_0x27785c[_0x7eb3('0x33')]=qs['filters'](_[_0x7eb3('0x35')](_0x30320d[_0x7eb3('0x2b')],_0x28bf37[_0x7eb3('0x34')]));if(_0x30320d[_0x7eb3('0x2b')][_0x7eb3('0x36')]){_0x27785c[_0x7eb3('0x33')]=_['merge'](_0x27785c['where'],{'$or':_[_0x7eb3('0x29')](_0x27785c[_0x7eb3('0x2e')],function(_0x11900){var _0x13ff4b={};_0x13ff4b[_0x11900]={'$like':'%'+_0x30320d[_0x7eb3('0x2b')][_0x7eb3('0x36')]+'%'};return _0x13ff4b;})});}_0x27785c=_[_0x7eb3('0x38')]({},_0x27785c,_0x30320d[_0x7eb3('0x39')]);return _0x43f9bc['getSubjects'](_0x27785c);}})[_0x7eb3('0x1f')](function(_0x1b869c){if(_0x1b869c){_0x4802e3=_0x1b869c[_0x7eb3('0x2f')];if(!_0x30320d[_0x7eb3('0x2b')][_0x7eb3('0x47')](_0x7eb3('0x30'))){_0x27785c[_0x7eb3('0x1a')]=qs[_0x7eb3('0x1a')](_0x30320d[_0x7eb3('0x2b')]['limit']);_0x27785c['offset']=qs[_0x7eb3('0x17')](_0x30320d[_0x7eb3('0x2b')][_0x7eb3('0x17')]);}return _0x43f9bc[_0x7eb3('0x48')](_0x27785c);}})[_0x7eb3('0x1f')](function(_0xac63a){if(_0xac63a){return _0xac63a?{'count':_0x4802e3,'rows':_0xac63a}:null;}})['then'](respondWithResult(_0x3be78b,null))[_0x7eb3('0x3d')](handleError(_0x3be78b,null));};exports[_0x7eb3('0x49')]=function(_0x2d4055,_0x3dd516,_0xd2f11f){var _0x3487e4={};var _0x27a774={};var _0x552276;var _0x489623;return db[_0x7eb3('0x24')][_0x7eb3('0x45')]({'where':{'id':_0x2d4055[_0x7eb3('0x3f')]['id']}})[_0x7eb3('0x1f')](handleEntityNotFound(_0x3dd516,null))[_0x7eb3('0x1f')](function(_0x16fd26){if(_0x16fd26){_0x552276=_0x16fd26;_0x27a774[_0x7eb3('0x28')]=_['keys'](db[_0x7eb3('0x46')]['rawAttributes']);_0x27a774[_0x7eb3('0x2b')]=_['keys'](_0x2d4055['query']);_0x27a774[_0x7eb3('0x34')]=_['intersection'](_0x27a774[_0x7eb3('0x28')],_0x27a774[_0x7eb3('0x2b')]);_0x3487e4['attributes']=_[_0x7eb3('0x2c')](_0x27a774['model'],qs['fields'](_0x2d4055[_0x7eb3('0x2b')][_0x7eb3('0x2d')]));_0x3487e4[_0x7eb3('0x2e')]=_0x3487e4['attributes'][_0x7eb3('0x2f')]?_0x3487e4[_0x7eb3('0x2e')]:_0x27a774[_0x7eb3('0x28')];_0x3487e4['order']=qs[_0x7eb3('0x32')](_0x2d4055[_0x7eb3('0x2b')][_0x7eb3('0x32')]);_0x3487e4[_0x7eb3('0x33')]=qs[_0x7eb3('0x34')](_[_0x7eb3('0x35')](_0x2d4055[_0x7eb3('0x2b')],_0x27a774[_0x7eb3('0x34')]));if(_0x2d4055[_0x7eb3('0x2b')][_0x7eb3('0x36')]){_0x3487e4['where']=_[_0x7eb3('0x38')](_0x3487e4[_0x7eb3('0x33')],{'$or':_['map'](_0x3487e4[_0x7eb3('0x2e')],function(_0x50a9bb){var _0x154025={};_0x154025[_0x50a9bb]={'$like':'%'+_0x2d4055[_0x7eb3('0x2b')]['filter']+'%'};return _0x154025;})});}_0x3487e4=_[_0x7eb3('0x38')]({},_0x3487e4,_0x2d4055['options']);return _0x552276[_0x7eb3('0x49')](_0x3487e4);}})['then'](function(_0x3aa093){if(_0x3aa093){_0x489623=_0x3aa093[_0x7eb3('0x2f')];if(!_0x2d4055[_0x7eb3('0x2b')][_0x7eb3('0x47')](_0x7eb3('0x30'))){_0x3487e4[_0x7eb3('0x1a')]=qs[_0x7eb3('0x1a')](_0x2d4055['query']['limit']);_0x3487e4['offset']=qs['offset'](_0x2d4055[_0x7eb3('0x2b')][_0x7eb3('0x17')]);}return _0x552276[_0x7eb3('0x49')](_0x3487e4);}})[_0x7eb3('0x1f')](function(_0x513322){if(_0x513322){return _0x513322?{'count':_0x489623,'rows':_0x513322}:null;}})[_0x7eb3('0x1f')](respondWithResult(_0x3dd516,null))[_0x7eb3('0x3d')](handleError(_0x3dd516,null));};exports[_0x7eb3('0x4a')]=function(_0x31e5fe,_0x1cc8c2,_0x2b2431){var _0x1c8893={};var _0x7ee613={};var _0x106824;var _0x3d6bc3;return db[_0x7eb3('0x24')][_0x7eb3('0x45')]({'where':{'id':_0x31e5fe['params']['id']}})[_0x7eb3('0x1f')](handleEntityNotFound(_0x1cc8c2,null))[_0x7eb3('0x1f')](function(_0x5d9d5a){if(_0x5d9d5a){_0x106824=_0x5d9d5a;_0x7ee613['model']=_[_0x7eb3('0x2a')](db[_0x7eb3('0x4b')][_0x7eb3('0x25')]);_0x7ee613[_0x7eb3('0x2b')]=_[_0x7eb3('0x2a')](_0x31e5fe[_0x7eb3('0x2b')]);_0x7ee613['filters']=_[_0x7eb3('0x2c')](_0x7ee613[_0x7eb3('0x28')],_0x7ee613[_0x7eb3('0x2b')]);_0x1c8893['attributes']=_[_0x7eb3('0x2c')](_0x7ee613[_0x7eb3('0x28')],qs['fields'](_0x31e5fe['query'][_0x7eb3('0x2d')]));_0x1c8893[_0x7eb3('0x2e')]=_0x1c8893[_0x7eb3('0x2e')][_0x7eb3('0x2f')]?_0x1c8893[_0x7eb3('0x2e')]:_0x7ee613[_0x7eb3('0x28')];_0x1c8893[_0x7eb3('0x31')]=qs[_0x7eb3('0x32')](_0x31e5fe[_0x7eb3('0x2b')][_0x7eb3('0x32')]);_0x1c8893['where']=qs[_0x7eb3('0x34')](_[_0x7eb3('0x35')](_0x31e5fe[_0x7eb3('0x2b')],_0x7ee613[_0x7eb3('0x34')]));if(_0x31e5fe[_0x7eb3('0x2b')]['filter']){_0x1c8893[_0x7eb3('0x33')]=_[_0x7eb3('0x38')](_0x1c8893['where'],{'$or':_[_0x7eb3('0x29')](_0x1c8893['attributes'],function(_0x49e32d){var _0x4f2fe7={};_0x4f2fe7[_0x49e32d]={'$like':'%'+_0x31e5fe[_0x7eb3('0x2b')][_0x7eb3('0x36')]+'%'};return _0x4f2fe7;})});}_0x1c8893=_[_0x7eb3('0x38')]({},_0x1c8893,_0x31e5fe[_0x7eb3('0x39')]);return _0x106824[_0x7eb3('0x4a')](_0x1c8893);}})[_0x7eb3('0x1f')](function(_0x281dc5){if(_0x281dc5){_0x3d6bc3=_0x281dc5[_0x7eb3('0x2f')];if(!_0x31e5fe['query']['hasOwnProperty']('nolimit')){_0x1c8893['limit']=qs[_0x7eb3('0x1a')](_0x31e5fe[_0x7eb3('0x2b')][_0x7eb3('0x1a')]);_0x1c8893[_0x7eb3('0x17')]=qs[_0x7eb3('0x17')](_0x31e5fe[_0x7eb3('0x2b')][_0x7eb3('0x17')]);}return _0x106824['getTags'](_0x1c8893);}})[_0x7eb3('0x1f')](function(_0x346dfb){if(_0x346dfb){return _0x346dfb?{'count':_0x3d6bc3,'rows':_0x346dfb}:null;}})[_0x7eb3('0x1f')](respondWithResult(_0x1cc8c2,null))['catch'](handleError(_0x1cc8c2,null));};exports[_0x7eb3('0x4c')]=function(_0x562931,_0x21dd08,_0x2357c9){if(_0x562931[_0x7eb3('0x43')]['id']){delete _0x562931[_0x7eb3('0x43')]['id'];}return db['FreshdeskConfiguration'][_0x7eb3('0x45')]({'where':{'id':_0x562931[_0x7eb3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x21dd08,null))[_0x7eb3('0x1f')](function(_0x512389){if(_0x512389){return _0x512389[_0x7eb3('0x4c')](_0x562931[_0x7eb3('0x43')]['ids']||[]);}return null;})[_0x7eb3('0x1f')](respondWithResult(_0x21dd08,null))['catch'](handleError(_0x21dd08,null));}; \ No newline at end of file +var _0xbf32=['path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','map','FreshdeskConfiguration','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','then','include','findAll','rows','params','includeAll','catch','create','body','find','getFields','findOne','FreshdeskField','order','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0xc88f11,_0x50820c){var _0x2b639e=function(_0x56463e){while(--_0x56463e){_0xc88f11['push'](_0xc88f11['shift']());}};_0x2b639e(++_0x50820c);}(_0xbf32,0x1f1));var _0x2bf3=function(_0x2052ee,_0x4dabe9){_0x2052ee=_0x2052ee-0x0;var _0x2a4b95=_0xbf32[_0x2052ee];return _0x2a4b95;};'use strict';var emlformat=require(_0x2bf3('0x0'));var rimraf=require(_0x2bf3('0x1'));var zipdir=require(_0x2bf3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2bf3('0x3'));var moment=require(_0x2bf3('0x4'));var BPromise=require(_0x2bf3('0x5'));var Mustache=require(_0x2bf3('0x6'));var util=require('util');var path=require(_0x2bf3('0x7'));var sox=require(_0x2bf3('0x8'));var csv=require(_0x2bf3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2bf3('0xa'));var _=require(_0x2bf3('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2bf3('0xc'));var deskjs=require(_0x2bf3('0xd'));var toCsv=require(_0x2bf3('0x9'));var querystring=require(_0x2bf3('0xe'));var Papa=require('papaparse');var Redis=require(_0x2bf3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2bf3('0x10'));var as=require(_0x2bf3('0x11'));var hardwareService=require(_0x2bf3('0x12'));var logger=require('../../config/logger')(_0x2bf3('0x13'));var utils=require(_0x2bf3('0x14'));var config=require(_0x2bf3('0x15'));var licenseUtil=require(_0x2bf3('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cd629,_0x24450e){_0x24450e=_0x24450e||0xcc;return function(_0x34af4a){if(_0x34af4a){return _0x4cd629[_0x2bf3('0x17')](_0x24450e);}return _0x4cd629[_0x2bf3('0x18')](_0x24450e)[_0x2bf3('0x19')]();};}function respondWithResult(_0x21684c,_0x56869d){_0x56869d=_0x56869d||0xc8;return function(_0x48faf3){if(_0x48faf3){return _0x21684c[_0x2bf3('0x18')](_0x56869d)[_0x2bf3('0x1a')](_0x48faf3);}};}function respondWithFilteredResult(_0x50c4d1,_0x13fe9b){return function(_0x21e4d0){if(_0x21e4d0){var _0x326b76=typeof _0x13fe9b[_0x2bf3('0x1b')]===_0x2bf3('0x1c')&&typeof _0x13fe9b['limit']===_0x2bf3('0x1c');var _0x4bb341=_0x21e4d0[_0x2bf3('0x1d')];var _0xfc532a=_0x326b76?0x0:_0x13fe9b[_0x2bf3('0x1b')];var _0xee4961=_0x326b76?_0x21e4d0['count']:_0x13fe9b[_0x2bf3('0x1b')]+_0x13fe9b['limit'];var _0x3b56e9;if(_0xee4961>=_0x4bb341){_0xee4961=_0x4bb341;_0x3b56e9=0xc8;}else{_0x3b56e9=0xce;}_0x50c4d1[_0x2bf3('0x18')](_0x3b56e9);return _0x50c4d1[_0x2bf3('0x1e')](_0x2bf3('0x1f'),_0xfc532a+'-'+_0xee4961+'/'+_0x4bb341)[_0x2bf3('0x1a')](_0x21e4d0);}return null;};}function patchUpdates(_0x272376){return function(_0x4e172c){try{jsonpatch['apply'](_0x4e172c,_0x272376,!![]);}catch(_0x255bd3){return BPromise[_0x2bf3('0x20')](_0x255bd3);}return _0x4e172c[_0x2bf3('0x21')]();};}function saveUpdates(_0x4b6935,_0x210f62){return function(_0x44d7aa){if(_0x44d7aa){return _0x44d7aa[_0x2bf3('0x22')](_0x4b6935)['then'](function(_0x4774b3){return _0x4774b3;});}return null;};}function removeEntity(_0x318b1c,_0x3c444d){return function(_0x324aaf){if(_0x324aaf){return _0x324aaf[_0x2bf3('0x23')]()['then'](function(){_0x318b1c[_0x2bf3('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e0417,_0x2e3e75){return function(_0x480739){if(!_0x480739){_0x5e0417[_0x2bf3('0x17')](0x194);}return _0x480739;};}function handleError(_0x2e314e,_0x4e5589){_0x4e5589=_0x4e5589||0x1f4;return function(_0x43e614){logger[_0x2bf3('0x24')](_0x43e614[_0x2bf3('0x25')]);if(_0x43e614[_0x2bf3('0x26')]){delete _0x43e614[_0x2bf3('0x26')];}_0x2e314e[_0x2bf3('0x18')](_0x4e5589)[_0x2bf3('0x27')](_0x43e614);};}exports['index']=function(_0x9b14d7,_0xf2ba08){var _0x29d74f={},_0x5b6c03={},_0x4d2fe2={'count':0x0,'rows':[]};var _0x7afb10=_[_0x2bf3('0x28')](db[_0x2bf3('0x29')][_0x2bf3('0x2a')],function(_0x421bd7){return{'name':_0x421bd7[_0x2bf3('0x2b')],'type':_0x421bd7['type'][_0x2bf3('0x2c')]};});_0x5b6c03[_0x2bf3('0x2d')]=_['map'](_0x7afb10,'name');_0x5b6c03['query']=_[_0x2bf3('0x2e')](_0x9b14d7['query']);_0x5b6c03[_0x2bf3('0x2f')]=_[_0x2bf3('0x30')](_0x5b6c03[_0x2bf3('0x2d')],_0x5b6c03[_0x2bf3('0x31')]);_0x29d74f[_0x2bf3('0x32')]=_['intersection'](_0x5b6c03[_0x2bf3('0x2d')],qs[_0x2bf3('0x33')](_0x9b14d7[_0x2bf3('0x31')][_0x2bf3('0x33')]));_0x29d74f[_0x2bf3('0x32')]=_0x29d74f[_0x2bf3('0x32')][_0x2bf3('0x34')]?_0x29d74f[_0x2bf3('0x32')]:_0x5b6c03[_0x2bf3('0x2d')];if(!_0x9b14d7[_0x2bf3('0x31')][_0x2bf3('0x35')](_0x2bf3('0x36'))){_0x29d74f['limit']=qs[_0x2bf3('0x37')](_0x9b14d7[_0x2bf3('0x31')][_0x2bf3('0x37')]);_0x29d74f[_0x2bf3('0x1b')]=qs['offset'](_0x9b14d7[_0x2bf3('0x31')][_0x2bf3('0x1b')]);}_0x29d74f['order']=qs['sort'](_0x9b14d7['query'][_0x2bf3('0x38')]);_0x29d74f[_0x2bf3('0x39')]=qs[_0x2bf3('0x2f')](_[_0x2bf3('0x3a')](_0x9b14d7[_0x2bf3('0x31')],_0x5b6c03['filters']),_0x7afb10);if(_0x9b14d7[_0x2bf3('0x31')][_0x2bf3('0x3b')]){_0x29d74f[_0x2bf3('0x39')]=_[_0x2bf3('0x3c')](_0x29d74f['where'],{'$or':_[_0x2bf3('0x28')](_0x7afb10,function(_0x34fe8a){if(_0x34fe8a[_0x2bf3('0x3d')]!==_0x2bf3('0x3e')){var _0x158c38={};_0x158c38[_0x34fe8a['name']]={'$like':'%'+_0x9b14d7[_0x2bf3('0x31')][_0x2bf3('0x3b')]+'%'};return _0x158c38;}})});}_0x29d74f=_[_0x2bf3('0x3c')]({},_0x29d74f,_0x9b14d7[_0x2bf3('0x3f')]);var _0x468763={'where':_0x29d74f[_0x2bf3('0x39')]};return db['FreshdeskConfiguration'][_0x2bf3('0x1d')](_0x468763)[_0x2bf3('0x40')](function(_0x3b1ee4){_0x4d2fe2[_0x2bf3('0x1d')]=_0x3b1ee4;if(_0x9b14d7[_0x2bf3('0x31')]['includeAll']){_0x29d74f[_0x2bf3('0x41')]=[{'all':!![]}];}return db[_0x2bf3('0x29')][_0x2bf3('0x42')](_0x29d74f);})['then'](function(_0x4518b5){_0x4d2fe2[_0x2bf3('0x43')]=_0x4518b5;return _0x4d2fe2;})[_0x2bf3('0x40')](respondWithFilteredResult(_0xf2ba08,_0x29d74f))['catch'](handleError(_0xf2ba08,null));};exports['show']=function(_0x2879c9,_0x15462e){var _0x4b9785={'raw':![],'where':{'id':_0x2879c9[_0x2bf3('0x44')]['id']}},_0x2d4c35={};_0x2d4c35[_0x2bf3('0x2d')]=_[_0x2bf3('0x2e')](db[_0x2bf3('0x29')][_0x2bf3('0x2a')]);_0x2d4c35['query']=_[_0x2bf3('0x2e')](_0x2879c9['query']);_0x2d4c35['filters']=_['intersection'](_0x2d4c35[_0x2bf3('0x2d')],_0x2d4c35[_0x2bf3('0x31')]);_0x4b9785[_0x2bf3('0x32')]=_['intersection'](_0x2d4c35[_0x2bf3('0x2d')],qs['fields'](_0x2879c9['query'][_0x2bf3('0x33')]));_0x4b9785[_0x2bf3('0x32')]=_0x4b9785[_0x2bf3('0x32')]['length']?_0x4b9785['attributes']:_0x2d4c35[_0x2bf3('0x2d')];if(_0x2879c9[_0x2bf3('0x31')][_0x2bf3('0x45')]){_0x4b9785['include']=[{'all':!![]}];}_0x4b9785=_['merge']({},_0x4b9785,_0x2879c9[_0x2bf3('0x3f')]);return db[_0x2bf3('0x29')]['find'](_0x4b9785)['then'](handleEntityNotFound(_0x15462e,null))[_0x2bf3('0x40')](respondWithResult(_0x15462e,null))[_0x2bf3('0x46')](handleError(_0x15462e,null));};exports['create']=function(_0x101216,_0x165b18){return db[_0x2bf3('0x29')][_0x2bf3('0x47')](_0x101216[_0x2bf3('0x48')],{})[_0x2bf3('0x40')](respondWithResult(_0x165b18,0xc9))[_0x2bf3('0x46')](handleError(_0x165b18,null));};exports[_0x2bf3('0x22')]=function(_0x95d79b,_0x4d363a){if(_0x95d79b[_0x2bf3('0x48')]['id']){delete _0x95d79b['body']['id'];}return db[_0x2bf3('0x29')]['find']({'where':{'id':_0x95d79b['params']['id']}})[_0x2bf3('0x40')](handleEntityNotFound(_0x4d363a,null))[_0x2bf3('0x40')](saveUpdates(_0x95d79b[_0x2bf3('0x48')],null))[_0x2bf3('0x40')](respondWithResult(_0x4d363a,null))[_0x2bf3('0x46')](handleError(_0x4d363a,null));};exports['destroy']=function(_0xec2a94,_0x139821){return db['FreshdeskConfiguration'][_0x2bf3('0x49')]({'where':{'id':_0xec2a94['params']['id']}})[_0x2bf3('0x40')](handleEntityNotFound(_0x139821,null))[_0x2bf3('0x40')](removeEntity(_0x139821,null))[_0x2bf3('0x46')](handleError(_0x139821,null));};exports[_0x2bf3('0x4a')]=function(_0x1b8d3c,_0x285b98,_0x21605c){var _0xe866ad={};var _0x3213ca={};var _0x11fe62;var _0x5b0fb1;return db[_0x2bf3('0x29')][_0x2bf3('0x4b')]({'where':{'id':_0x1b8d3c[_0x2bf3('0x44')]['id']}})[_0x2bf3('0x40')](handleEntityNotFound(_0x285b98,null))['then'](function(_0x3e87c0){if(_0x3e87c0){_0x11fe62=_0x3e87c0;_0x3213ca['model']=_[_0x2bf3('0x2e')](db[_0x2bf3('0x4c')]['rawAttributes']);_0x3213ca['query']=_['keys'](_0x1b8d3c[_0x2bf3('0x31')]);_0x3213ca['filters']=_[_0x2bf3('0x30')](_0x3213ca[_0x2bf3('0x2d')],_0x3213ca[_0x2bf3('0x31')]);_0xe866ad[_0x2bf3('0x32')]=_[_0x2bf3('0x30')](_0x3213ca['model'],qs[_0x2bf3('0x33')](_0x1b8d3c['query']['fields']));_0xe866ad[_0x2bf3('0x32')]=_0xe866ad[_0x2bf3('0x32')][_0x2bf3('0x34')]?_0xe866ad['attributes']:_0x3213ca['model'];_0xe866ad[_0x2bf3('0x4d')]=qs[_0x2bf3('0x38')](_0x1b8d3c[_0x2bf3('0x31')][_0x2bf3('0x38')]);_0xe866ad['where']=qs[_0x2bf3('0x2f')](_[_0x2bf3('0x3a')](_0x1b8d3c[_0x2bf3('0x31')],_0x3213ca[_0x2bf3('0x2f')]));if(_0x1b8d3c['query'][_0x2bf3('0x3b')]){_0xe866ad[_0x2bf3('0x39')]=_['merge'](_0xe866ad['where'],{'$or':_['map'](_0xe866ad[_0x2bf3('0x32')],function(_0x25b23e){var _0x13ffe4={};_0x13ffe4[_0x25b23e]={'$like':'%'+_0x1b8d3c['query'][_0x2bf3('0x3b')]+'%'};return _0x13ffe4;})});}_0xe866ad=_[_0x2bf3('0x3c')]({},_0xe866ad,_0x1b8d3c[_0x2bf3('0x3f')]);return _0x11fe62[_0x2bf3('0x4a')](_0xe866ad);}})[_0x2bf3('0x40')](function(_0x30edce){if(_0x30edce){_0x5b0fb1=_0x30edce['length'];if(!_0x1b8d3c['query'][_0x2bf3('0x35')](_0x2bf3('0x36'))){_0xe866ad[_0x2bf3('0x37')]=qs['limit'](_0x1b8d3c[_0x2bf3('0x31')]['limit']);_0xe866ad[_0x2bf3('0x1b')]=qs[_0x2bf3('0x1b')](_0x1b8d3c[_0x2bf3('0x31')]['offset']);}return _0x11fe62[_0x2bf3('0x4a')](_0xe866ad);}})[_0x2bf3('0x40')](function(_0x27554b){if(_0x27554b){return _0x27554b?{'count':_0x5b0fb1,'rows':_0x27554b}:null;}})[_0x2bf3('0x40')](respondWithResult(_0x285b98,null))['catch'](handleError(_0x285b98,null));};exports[_0x2bf3('0x4e')]=function(_0x31eddd,_0x3a28fb,_0x285458){var _0x64091d={};var _0x16a55e={};var _0x163f4c;var _0x20bd55;return db['FreshdeskConfiguration'][_0x2bf3('0x4b')]({'where':{'id':_0x31eddd['params']['id']}})[_0x2bf3('0x40')](handleEntityNotFound(_0x3a28fb,null))[_0x2bf3('0x40')](function(_0x3e12b0){if(_0x3e12b0){_0x163f4c=_0x3e12b0;_0x16a55e[_0x2bf3('0x2d')]=_[_0x2bf3('0x2e')](db[_0x2bf3('0x4c')][_0x2bf3('0x2a')]);_0x16a55e[_0x2bf3('0x31')]=_[_0x2bf3('0x2e')](_0x31eddd[_0x2bf3('0x31')]);_0x16a55e['filters']=_[_0x2bf3('0x30')](_0x16a55e[_0x2bf3('0x2d')],_0x16a55e[_0x2bf3('0x31')]);_0x64091d['attributes']=_[_0x2bf3('0x30')](_0x16a55e['model'],qs['fields'](_0x31eddd[_0x2bf3('0x31')][_0x2bf3('0x33')]));_0x64091d[_0x2bf3('0x32')]=_0x64091d['attributes']['length']?_0x64091d[_0x2bf3('0x32')]:_0x16a55e['model'];_0x64091d[_0x2bf3('0x4d')]=qs['sort'](_0x31eddd[_0x2bf3('0x31')][_0x2bf3('0x38')]);_0x64091d[_0x2bf3('0x39')]=qs[_0x2bf3('0x2f')](_[_0x2bf3('0x3a')](_0x31eddd['query'],_0x16a55e[_0x2bf3('0x2f')]));if(_0x31eddd[_0x2bf3('0x31')][_0x2bf3('0x3b')]){_0x64091d['where']=_['merge'](_0x64091d[_0x2bf3('0x39')],{'$or':_['map'](_0x64091d[_0x2bf3('0x32')],function(_0x287fe3){var _0x46ff64={};_0x46ff64[_0x287fe3]={'$like':'%'+_0x31eddd[_0x2bf3('0x31')][_0x2bf3('0x3b')]+'%'};return _0x46ff64;})});}_0x64091d=_[_0x2bf3('0x3c')]({},_0x64091d,_0x31eddd['options']);return _0x163f4c[_0x2bf3('0x4e')](_0x64091d);}})['then'](function(_0x1792d5){if(_0x1792d5){_0x20bd55=_0x1792d5[_0x2bf3('0x34')];if(!_0x31eddd[_0x2bf3('0x31')]['hasOwnProperty']('nolimit')){_0x64091d[_0x2bf3('0x37')]=qs[_0x2bf3('0x37')](_0x31eddd['query']['limit']);_0x64091d['offset']=qs[_0x2bf3('0x1b')](_0x31eddd[_0x2bf3('0x31')][_0x2bf3('0x1b')]);}return _0x163f4c['getSubjects'](_0x64091d);}})['then'](function(_0x48deac){if(_0x48deac){return _0x48deac?{'count':_0x20bd55,'rows':_0x48deac}:null;}})[_0x2bf3('0x40')](respondWithResult(_0x3a28fb,null))[_0x2bf3('0x46')](handleError(_0x3a28fb,null));};exports[_0x2bf3('0x4f')]=function(_0x3d4610,_0x1b515e,_0x3f8a90){var _0x5e177e={};var _0x4e441f={};var _0x5bbaf4;var _0x2156b7;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3d4610[_0x2bf3('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b515e,null))[_0x2bf3('0x40')](function(_0x43708c){if(_0x43708c){_0x5bbaf4=_0x43708c;_0x4e441f[_0x2bf3('0x2d')]=_[_0x2bf3('0x2e')](db[_0x2bf3('0x4c')]['rawAttributes']);_0x4e441f[_0x2bf3('0x31')]=_[_0x2bf3('0x2e')](_0x3d4610['query']);_0x4e441f[_0x2bf3('0x2f')]=_['intersection'](_0x4e441f[_0x2bf3('0x2d')],_0x4e441f[_0x2bf3('0x31')]);_0x5e177e[_0x2bf3('0x32')]=_[_0x2bf3('0x30')](_0x4e441f[_0x2bf3('0x2d')],qs[_0x2bf3('0x33')](_0x3d4610[_0x2bf3('0x31')][_0x2bf3('0x33')]));_0x5e177e[_0x2bf3('0x32')]=_0x5e177e['attributes'][_0x2bf3('0x34')]?_0x5e177e[_0x2bf3('0x32')]:_0x4e441f[_0x2bf3('0x2d')];_0x5e177e['order']=qs['sort'](_0x3d4610[_0x2bf3('0x31')]['sort']);_0x5e177e['where']=qs[_0x2bf3('0x2f')](_['pick'](_0x3d4610[_0x2bf3('0x31')],_0x4e441f['filters']));if(_0x3d4610[_0x2bf3('0x31')][_0x2bf3('0x3b')]){_0x5e177e['where']=_[_0x2bf3('0x3c')](_0x5e177e[_0x2bf3('0x39')],{'$or':_[_0x2bf3('0x28')](_0x5e177e[_0x2bf3('0x32')],function(_0x467bfb){var _0x57beec={};_0x57beec[_0x467bfb]={'$like':'%'+_0x3d4610[_0x2bf3('0x31')][_0x2bf3('0x3b')]+'%'};return _0x57beec;})});}_0x5e177e=_[_0x2bf3('0x3c')]({},_0x5e177e,_0x3d4610[_0x2bf3('0x3f')]);return _0x5bbaf4[_0x2bf3('0x4f')](_0x5e177e);}})[_0x2bf3('0x40')](function(_0x134824){if(_0x134824){_0x2156b7=_0x134824[_0x2bf3('0x34')];if(!_0x3d4610[_0x2bf3('0x31')][_0x2bf3('0x35')]('nolimit')){_0x5e177e['limit']=qs[_0x2bf3('0x37')](_0x3d4610['query'][_0x2bf3('0x37')]);_0x5e177e['offset']=qs[_0x2bf3('0x1b')](_0x3d4610[_0x2bf3('0x31')][_0x2bf3('0x1b')]);}return _0x5bbaf4[_0x2bf3('0x4f')](_0x5e177e);}})[_0x2bf3('0x40')](function(_0x1c1bb1){if(_0x1c1bb1){return _0x1c1bb1?{'count':_0x2156b7,'rows':_0x1c1bb1}:null;}})[_0x2bf3('0x40')](respondWithResult(_0x1b515e,null))[_0x2bf3('0x46')](handleError(_0x1b515e,null));};exports[_0x2bf3('0x50')]=function(_0x43a33d,_0x5cebb2,_0x5e9ee4){var _0x4c6cb1={};var _0x15f1d0={};var _0x13a109;var _0x1baf5d;return db[_0x2bf3('0x29')][_0x2bf3('0x4b')]({'where':{'id':_0x43a33d[_0x2bf3('0x44')]['id']}})[_0x2bf3('0x40')](handleEntityNotFound(_0x5cebb2,null))['then'](function(_0x176f63){if(_0x176f63){_0x13a109=_0x176f63;_0x15f1d0['model']=_[_0x2bf3('0x2e')](db[_0x2bf3('0x51')][_0x2bf3('0x2a')]);_0x15f1d0[_0x2bf3('0x31')]=_[_0x2bf3('0x2e')](_0x43a33d['query']);_0x15f1d0[_0x2bf3('0x2f')]=_['intersection'](_0x15f1d0[_0x2bf3('0x2d')],_0x15f1d0[_0x2bf3('0x31')]);_0x4c6cb1[_0x2bf3('0x32')]=_[_0x2bf3('0x30')](_0x15f1d0[_0x2bf3('0x2d')],qs[_0x2bf3('0x33')](_0x43a33d[_0x2bf3('0x31')][_0x2bf3('0x33')]));_0x4c6cb1[_0x2bf3('0x32')]=_0x4c6cb1['attributes'][_0x2bf3('0x34')]?_0x4c6cb1[_0x2bf3('0x32')]:_0x15f1d0[_0x2bf3('0x2d')];_0x4c6cb1['order']=qs[_0x2bf3('0x38')](_0x43a33d[_0x2bf3('0x31')]['sort']);_0x4c6cb1[_0x2bf3('0x39')]=qs[_0x2bf3('0x2f')](_[_0x2bf3('0x3a')](_0x43a33d['query'],_0x15f1d0[_0x2bf3('0x2f')]));if(_0x43a33d[_0x2bf3('0x31')][_0x2bf3('0x3b')]){_0x4c6cb1[_0x2bf3('0x39')]=_[_0x2bf3('0x3c')](_0x4c6cb1[_0x2bf3('0x39')],{'$or':_[_0x2bf3('0x28')](_0x4c6cb1[_0x2bf3('0x32')],function(_0x17f640){var _0x22d4b5={};_0x22d4b5[_0x17f640]={'$like':'%'+_0x43a33d[_0x2bf3('0x31')][_0x2bf3('0x3b')]+'%'};return _0x22d4b5;})});}_0x4c6cb1=_[_0x2bf3('0x3c')]({},_0x4c6cb1,_0x43a33d[_0x2bf3('0x3f')]);return _0x13a109[_0x2bf3('0x50')](_0x4c6cb1);}})[_0x2bf3('0x40')](function(_0x863fa4){if(_0x863fa4){_0x1baf5d=_0x863fa4[_0x2bf3('0x34')];if(!_0x43a33d[_0x2bf3('0x31')][_0x2bf3('0x35')](_0x2bf3('0x36'))){_0x4c6cb1[_0x2bf3('0x37')]=qs[_0x2bf3('0x37')](_0x43a33d[_0x2bf3('0x31')][_0x2bf3('0x37')]);_0x4c6cb1['offset']=qs['offset'](_0x43a33d[_0x2bf3('0x31')][_0x2bf3('0x1b')]);}return _0x13a109[_0x2bf3('0x50')](_0x4c6cb1);}})[_0x2bf3('0x40')](function(_0x1e1c1b){if(_0x1e1c1b){return _0x1e1c1b?{'count':_0x1baf5d,'rows':_0x1e1c1b}:null;}})[_0x2bf3('0x40')](respondWithResult(_0x5cebb2,null))['catch'](handleError(_0x5cebb2,null));};exports['setTags']=function(_0x163f50,_0x5beb68,_0x3b1e2d){if(_0x163f50[_0x2bf3('0x48')]['id']){delete _0x163f50[_0x2bf3('0x48')]['id'];}return db['FreshdeskConfiguration'][_0x2bf3('0x4b')]({'where':{'id':_0x163f50[_0x2bf3('0x44')]['id']}})[_0x2bf3('0x40')](handleEntityNotFound(_0x5beb68,null))['then'](function(_0x2b517f){if(_0x2b517f){return _0x2b517f[_0x2bf3('0x52')](_0x163f50[_0x2bf3('0x48')][_0x2bf3('0x53')]||[]);}return null;})['then'](respondWithResult(_0x5beb68,null))['catch'](handleError(_0x5beb68,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 0dce073..816f377 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 _0x5840=['FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define'];(function(_0x1655b1,_0x827b6e){var _0x352ffe=function(_0x2143a2){while(--_0x2143a2){_0x1655b1['push'](_0x1655b1['shift']());}};_0x352ffe(++_0x827b6e);}(_0x5840,0x1dd));var _0x0584=function(_0x447b90,_0x557e3e){_0x447b90=_0x447b90-0x0;var _0x30f786=_0x5840[_0x447b90];return _0x30f786;};'use strict';var _=require(_0x0584('0x0'));var util=require(_0x0584('0x1'));var logger=require(_0x0584('0x2'))(_0x0584('0x3'));var moment=require(_0x0584('0x4'));var BPromise=require(_0x0584('0x5'));var rp=require(_0x0584('0x6'));var fs=require('fs');var path=require(_0x0584('0x7'));var rimraf=require(_0x0584('0x8'));var config=require(_0x0584('0x9'));var attributes=require(_0x0584('0xa'));module[_0x0584('0xb')]=function(_0x2c0c8f,_0x141e46){return _0x2c0c8f[_0x0584('0xc')](_0x0584('0xd'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4700=['rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x1a976f,_0xd3e7d5){var _0x2a776d=function(_0x151842){while(--_0x151842){_0x1a976f['push'](_0x1a976f['shift']());}};_0x2a776d(++_0xd3e7d5);}(_0x4700,0x125));var _0x0470=function(_0x389b27,_0x5214a0){_0x389b27=_0x389b27-0x0;var _0x39b3d3=_0x4700[_0x389b27];return _0x39b3d3;};'use strict';var _=require(_0x0470('0x0'));var util=require(_0x0470('0x1'));var logger=require(_0x0470('0x2'))('api');var moment=require(_0x0470('0x3'));var BPromise=require('bluebird');var rp=require(_0x0470('0x4'));var fs=require('fs');var path=require(_0x0470('0x5'));var rimraf=require(_0x0470('0x6'));var config=require(_0x0470('0x7'));var attributes=require(_0x0470('0x8'));module[_0x0470('0x9')]=function(_0x293b05,_0x8f37c4){return _0x293b05[_0x0470('0xa')](_0x0470('0xb'),attributes,{'tableName':_0x0470('0xc'),'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 8998152..7cd5408 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 _0xbb00=['rpc','../../config/environment','client','http','request','then','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3cec79,_0x14a42c){var _0x1ef24c=function(_0x1504bf){while(--_0x1504bf){_0x3cec79['push'](_0x3cec79['shift']());}};_0x1ef24c(++_0x14a42c);}(_0xbb00,0x76));var _0x0bb0=function(_0x4a81c3,_0x504a70){_0x4a81c3=_0x4a81c3-0x0;var _0x17a34f=_0xbb00[_0x4a81c3];return _0x17a34f;};'use strict';var _=require(_0x0bb0('0x0'));var util=require(_0x0bb0('0x1'));var moment=require(_0x0bb0('0x2'));var BPromise=require(_0x0bb0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bb0('0x4'));var db=require(_0x0bb0('0x5'))['db'];var utils=require(_0x0bb0('0x6'));var logger=require(_0x0bb0('0x7'))(_0x0bb0('0x8'));var config=require(_0x0bb0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0bb0('0xa')][_0x0bb0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1138ab,_0x1f0f23,_0x33337d){return new BPromise(function(_0x204015,_0x1470de){return client[_0x0bb0('0xc')](_0x1138ab,_0x33337d)[_0x0bb0('0xd')](function(_0x242d17){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1f0f23,_0x0bb0('0xe'));logger['debug'](_0x0bb0('0xf'),_0x1f0f23,_0x0bb0('0xe'),JSON['stringify'](_0x242d17));if(_0x242d17[_0x0bb0('0x10')]){if(_0x242d17[_0x0bb0('0x10')][_0x0bb0('0x11')]===0x1f4){logger[_0x0bb0('0x10')](_0x0bb0('0x12'),_0x1f0f23,_0x242d17[_0x0bb0('0x10')]['message']);return _0x1470de(_0x242d17['error'][_0x0bb0('0x13')]);}logger[_0x0bb0('0x10')](_0x0bb0('0x12'),_0x1f0f23,_0x242d17['error'][_0x0bb0('0x13')]);return _0x204015(_0x242d17[_0x0bb0('0x10')][_0x0bb0('0x13')]);}else{logger['info'](_0x0bb0('0x12'),_0x1f0f23,_0x0bb0('0xe'));_0x204015(_0x242d17['result']['message']);}})[_0x0bb0('0x14')](function(_0x1eeea1){logger[_0x0bb0('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1f0f23,_0x1eeea1);_0x1470de(_0x1eeea1);});});} \ No newline at end of file +var _0x08ab=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5cfee3,_0x3d05f2){var _0x3e9912=function(_0x47f1b5){while(--_0x47f1b5){_0x5cfee3['push'](_0x5cfee3['shift']());}};_0x3e9912(++_0x3d05f2);}(_0x08ab,0xd4));var _0xb08a=function(_0x2338ae,_0x1896f8){_0x2338ae=_0x2338ae-0x0;var _0x4adad9=_0x08ab[_0x2338ae];return _0x4adad9;};'use strict';var _=require(_0xb08a('0x0'));var util=require(_0xb08a('0x1'));var moment=require(_0xb08a('0x2'));var BPromise=require(_0xb08a('0x3'));var rs=require(_0xb08a('0x4'));var fs=require('fs');var Redis=require(_0xb08a('0x5'));var db=require(_0xb08a('0x6'))['db'];var utils=require(_0xb08a('0x7'));var logger=require(_0xb08a('0x8'))(_0xb08a('0x9'));var config=require(_0xb08a('0xa'));var jayson=require(_0xb08a('0xb'));var client=jayson[_0xb08a('0xc')][_0xb08a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x450e66,_0x12f2a5,_0x5a80fd){return new BPromise(function(_0x39e4a5,_0x840bf6){return client[_0xb08a('0xe')](_0x450e66,_0x5a80fd)[_0xb08a('0xf')](function(_0xe925e6){logger[_0xb08a('0x10')](_0xb08a('0x11'),_0x12f2a5,_0xb08a('0x12'));logger[_0xb08a('0x13')](_0xb08a('0x14'),_0x12f2a5,_0xb08a('0x12'),JSON[_0xb08a('0x15')](_0xe925e6));if(_0xe925e6[_0xb08a('0x16')]){if(_0xe925e6[_0xb08a('0x16')][_0xb08a('0x17')]===0x1f4){logger[_0xb08a('0x16')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x12f2a5,_0xe925e6[_0xb08a('0x16')][_0xb08a('0x18')]);return _0x840bf6(_0xe925e6[_0xb08a('0x16')][_0xb08a('0x18')]);}logger[_0xb08a('0x16')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x12f2a5,_0xe925e6['error'][_0xb08a('0x18')]);return _0x39e4a5(_0xe925e6[_0xb08a('0x16')]['message']);}else{logger[_0xb08a('0x10')](_0xb08a('0x11'),_0x12f2a5,_0xb08a('0x12'));_0x39e4a5(_0xe925e6[_0xb08a('0x19')]['message']);}})[_0xb08a('0x1a')](function(_0x15906c){logger['error'](_0xb08a('0x11'),_0x12f2a5,_0x15906c);_0x840bf6(_0x15906c);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 5a0d99d..0e862a4 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 _0x29d2=['show','post','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x215985,_0x2fb9da){var _0x447075=function(_0x1a326f){while(--_0x1a326f){_0x215985['push'](_0x215985['shift']());}};_0x447075(++_0x2fb9da);}(_0x29d2,0x1ba));var _0x229d=function(_0x278201,_0x5de935){_0x278201=_0x278201-0x0;var _0x4b7cb7=_0x29d2[_0x278201];return _0x4b7cb7;};'use strict';var multer=require(_0x229d('0x0'));var util=require(_0x229d('0x1'));var path=require(_0x229d('0x2'));var timeout=require('connect-timeout');var express=require(_0x229d('0x3'));var router=express[_0x229d('0x4')]();var fs_extra=require(_0x229d('0x5'));var auth=require(_0x229d('0x6'));var interaction=require(_0x229d('0x7'));var config=require(_0x229d('0x8'));var controller=require(_0x229d('0x9'));router[_0x229d('0xa')]('/',auth[_0x229d('0xb')](),controller[_0x229d('0xc')]);router['get'](_0x229d('0xd'),auth[_0x229d('0xb')](),controller[_0x229d('0xe')]);router[_0x229d('0xf')]('/',auth[_0x229d('0xb')](),controller['create']);router['put']('/:id',auth[_0x229d('0xb')](),controller[_0x229d('0x10')]);router['delete'](_0x229d('0xd'),auth[_0x229d('0xb')](),controller[_0x229d('0x11')]);module[_0x229d('0x12')]=router; \ No newline at end of file +var _0x8ed3=['post','create','put','update','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1d536d,_0x325129){var _0x1f9387=function(_0x21abfe){while(--_0x21abfe){_0x1d536d['push'](_0x1d536d['shift']());}};_0x1f9387(++_0x325129);}(_0x8ed3,0x1eb));var _0x38ed=function(_0x33e613,_0x2e55f0){_0x33e613=_0x33e613-0x0;var _0x421c4b=_0x8ed3[_0x33e613];return _0x421c4b;};'use strict';var multer=require(_0x38ed('0x0'));var util=require(_0x38ed('0x1'));var path=require(_0x38ed('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x38ed('0x3'));var auth=require(_0x38ed('0x4'));var interaction=require(_0x38ed('0x5'));var config=require(_0x38ed('0x6'));var controller=require(_0x38ed('0x7'));router[_0x38ed('0x8')]('/',auth[_0x38ed('0x9')](),controller[_0x38ed('0xa')]);router[_0x38ed('0x8')](_0x38ed('0xb'),auth['isAuthenticated'](),controller[_0x38ed('0xc')]);router[_0x38ed('0xd')]('/',auth[_0x38ed('0x9')](),controller[_0x38ed('0xe')]);router[_0x38ed('0xf')](_0x38ed('0xb'),auth['isAuthenticated'](),controller[_0x38ed('0x10')]);router['delete']('/:id',auth[_0x38ed('0x9')](),controller['destroy']);module[_0x38ed('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 cd9fbc2..212d220 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 _0x0da2=['exports','ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize'];(function(_0x323c4d,_0x480c87){var _0x13e440=function(_0x56f416){while(--_0x56f416){_0x323c4d['push'](_0x323c4d['shift']());}};_0x13e440(++_0x480c87);}(_0x0da2,0x194));var _0x20da=function(_0x41f443,_0x1ee972){_0x41f443=_0x41f443-0x0;var _0x324b0f=_0x0da2[_0x41f443];return _0x324b0f;};'use strict';var Sequelize=require(_0x20da('0x0'));module[_0x20da('0x1')]={'type':{'type':Sequelize[_0x20da('0x2')](_0x20da('0x3'),'variable',_0x20da('0x4'),_0x20da('0x5'),'picklist'),'defaultValue':_0x20da('0x3')},'content':{'type':Sequelize[_0x20da('0x6')]},'key':{'type':Sequelize[_0x20da('0x6')]},'keyType':{'type':Sequelize[_0x20da('0x2')](_0x20da('0x3'),_0x20da('0x7'),_0x20da('0x4'))},'keyContent':{'type':Sequelize[_0x20da('0x6')]},'idField':{'type':Sequelize[_0x20da('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x20da('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x938f=['customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','picklist','STRING'];(function(_0x174f0e,_0x22cd03){var _0xd40c0e=function(_0x9ab883){while(--_0x9ab883){_0x174f0e['push'](_0x174f0e['shift']());}};_0xd40c0e(++_0x22cd03);}(_0x938f,0xd1));var _0xf938=function(_0x19f8ee,_0x3e08c2){_0x19f8ee=_0x19f8ee-0x0;var _0x3b68f2=_0x938f[_0x19f8ee];return _0x3b68f2;};'use strict';var Sequelize=require(_0xf938('0x0'));module[_0xf938('0x1')]={'type':{'type':Sequelize[_0xf938('0x2')]('string',_0xf938('0x3'),'customVariable',_0xf938('0x4'),_0xf938('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xf938('0x6')]},'keyType':{'type':Sequelize[_0xf938('0x2')]('string',_0xf938('0x3'),_0xf938('0x7'))},'keyContent':{'type':Sequelize[_0xf938('0x6')]},'idField':{'type':Sequelize[_0xf938('0x6')]},'nameField':{'type':Sequelize[_0xf938('0x6')]},'customField':{'type':Sequelize[_0xf938('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf938('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 8d45077..96cc0e9 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 _0x3eec=['include','findAll','catch','show','params','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','send','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','name','options','includeAll'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0x3eec,0x1e9));var _0xc3ee=function(_0xbc2ad3,_0x34c170){_0xbc2ad3=_0xbc2ad3-0x0;var _0x3376fe=_0x3eec[_0xbc2ad3];return _0x3376fe;};'use strict';var emlformat=require(_0xc3ee('0x0'));var rimraf=require(_0xc3ee('0x1'));var zipdir=require(_0xc3ee('0x2'));var jsonpatch=require(_0xc3ee('0x3'));var rp=require('request-promise');var moment=require(_0xc3ee('0x4'));var BPromise=require(_0xc3ee('0x5'));var Mustache=require(_0xc3ee('0x6'));var util=require(_0xc3ee('0x7'));var path=require(_0xc3ee('0x8'));var sox=require(_0xc3ee('0x9'));var csv=require('to-csv');var ejs=require(_0xc3ee('0xa'));var fs=require('fs');var fs_extra=require(_0xc3ee('0xb'));var _=require(_0xc3ee('0xc'));var squel=require(_0xc3ee('0xd'));var crypto=require(_0xc3ee('0xe'));var jsforce=require(_0xc3ee('0xf'));var deskjs=require(_0xc3ee('0x10'));var toCsv=require(_0xc3ee('0x11'));var querystring=require(_0xc3ee('0x12'));var Papa=require(_0xc3ee('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc3ee('0x14'));var as=require(_0xc3ee('0x15'));var hardwareService=require(_0xc3ee('0x16'));var logger=require(_0xc3ee('0x17'))('api');var utils=require(_0xc3ee('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc3ee('0x19'));var db=require(_0xc3ee('0x1a'))['db'];function respondWithStatusCode(_0x4beb01,_0x5f2c3a){_0x5f2c3a=_0x5f2c3a||0xcc;return function(_0x2eb82e){if(_0x2eb82e){return _0x4beb01['sendStatus'](_0x5f2c3a);}return _0x4beb01[_0xc3ee('0x1b')](_0x5f2c3a)['end']();};}function respondWithResult(_0x19feb3,_0x58ebe7){_0x58ebe7=_0x58ebe7||0xc8;return function(_0x3d669d){if(_0x3d669d){return _0x19feb3[_0xc3ee('0x1b')](_0x58ebe7)[_0xc3ee('0x1c')](_0x3d669d);}};}function respondWithFilteredResult(_0x664bad,_0x476f8f){return function(_0xf63359){if(_0xf63359){var _0x277e11=typeof _0x476f8f['offset']===_0xc3ee('0x1d')&&typeof _0x476f8f['limit']===_0xc3ee('0x1d');var _0x1bf49a=_0xf63359[_0xc3ee('0x1e')];var _0x219db0=_0x277e11?0x0:_0x476f8f[_0xc3ee('0x1f')];var _0x3acb0c=_0x277e11?_0xf63359[_0xc3ee('0x1e')]:_0x476f8f[_0xc3ee('0x1f')]+_0x476f8f[_0xc3ee('0x20')];var _0x202a9a;if(_0x3acb0c>=_0x1bf49a){_0x3acb0c=_0x1bf49a;_0x202a9a=0xc8;}else{_0x202a9a=0xce;}_0x664bad[_0xc3ee('0x1b')](_0x202a9a);return _0x664bad[_0xc3ee('0x21')](_0xc3ee('0x22'),_0x219db0+'-'+_0x3acb0c+'/'+_0x1bf49a)[_0xc3ee('0x1c')](_0xf63359);}return null;};}function patchUpdates(_0x3e7224){return function(_0x46a8c9){try{jsonpatch[_0xc3ee('0x23')](_0x46a8c9,_0x3e7224,!![]);}catch(_0x30df3a){return BPromise[_0xc3ee('0x24')](_0x30df3a);}return _0x46a8c9[_0xc3ee('0x25')]();};}function saveUpdates(_0x11778f,_0x493fea){return function(_0x4d672e){if(_0x4d672e){return _0x4d672e[_0xc3ee('0x26')](_0x11778f)[_0xc3ee('0x27')](function(_0x3b8f75){return _0x3b8f75;});}return null;};}function removeEntity(_0x464ffc,_0x28bfeb){return function(_0x238df7){if(_0x238df7){return _0x238df7['destroy']()[_0xc3ee('0x27')](function(){_0x464ffc[_0xc3ee('0x1b')](0xcc)[_0xc3ee('0x28')]();});}};}function handleEntityNotFound(_0xfd03bd,_0x5c366e){return function(_0x525ae5){if(!_0x525ae5){_0xfd03bd['sendStatus'](0x194);}return _0x525ae5;};}function handleError(_0x383bd9,_0x28522d){_0x28522d=_0x28522d||0x1f4;return function(_0x3d8c79){logger[_0xc3ee('0x29')](_0x3d8c79[_0xc3ee('0x2a')]);if(_0x3d8c79['name']){delete _0x3d8c79['name'];}_0x383bd9['status'](_0x28522d)[_0xc3ee('0x2b')](_0x3d8c79);};}exports[_0xc3ee('0x2c')]=function(_0x44678b,_0x2fba96){var _0x2cdd85={},_0x50ffaa={},_0x13f30d={'count':0x0,'rows':[]};var _0xfa3111=_[_0xc3ee('0x2d')](db[_0xc3ee('0x2e')][_0xc3ee('0x2f')],function(_0x8bbe1e){return{'name':_0x8bbe1e[_0xc3ee('0x30')],'type':_0x8bbe1e['type'][_0xc3ee('0x31')]};});_0x50ffaa[_0xc3ee('0x32')]=_[_0xc3ee('0x2d')](_0xfa3111,'name');_0x50ffaa[_0xc3ee('0x33')]=_[_0xc3ee('0x34')](_0x44678b[_0xc3ee('0x33')]);_0x50ffaa[_0xc3ee('0x35')]=_[_0xc3ee('0x36')](_0x50ffaa[_0xc3ee('0x32')],_0x50ffaa[_0xc3ee('0x33')]);_0x2cdd85['attributes']=_[_0xc3ee('0x36')](_0x50ffaa['model'],qs[_0xc3ee('0x37')](_0x44678b[_0xc3ee('0x33')][_0xc3ee('0x37')]));_0x2cdd85[_0xc3ee('0x38')]=_0x2cdd85[_0xc3ee('0x38')][_0xc3ee('0x39')]?_0x2cdd85['attributes']:_0x50ffaa[_0xc3ee('0x32')];if(!_0x44678b[_0xc3ee('0x33')][_0xc3ee('0x3a')](_0xc3ee('0x3b'))){_0x2cdd85[_0xc3ee('0x20')]=qs[_0xc3ee('0x20')](_0x44678b[_0xc3ee('0x33')][_0xc3ee('0x20')]);_0x2cdd85[_0xc3ee('0x1f')]=qs[_0xc3ee('0x1f')](_0x44678b[_0xc3ee('0x33')][_0xc3ee('0x1f')]);}_0x2cdd85[_0xc3ee('0x3c')]=qs[_0xc3ee('0x3d')](_0x44678b[_0xc3ee('0x33')][_0xc3ee('0x3d')]);_0x2cdd85[_0xc3ee('0x3e')]=qs[_0xc3ee('0x35')](_[_0xc3ee('0x3f')](_0x44678b[_0xc3ee('0x33')],_0x50ffaa[_0xc3ee('0x35')]),_0xfa3111);if(_0x44678b['query'][_0xc3ee('0x40')]){_0x2cdd85['where']=_[_0xc3ee('0x41')](_0x2cdd85[_0xc3ee('0x3e')],{'$or':_[_0xc3ee('0x2d')](_0xfa3111,function(_0x1544f3){if(_0x1544f3[_0xc3ee('0x42')]!==_0xc3ee('0x43')){var _0x5e7dcd={};_0x5e7dcd[_0x1544f3[_0xc3ee('0x44')]]={'$like':'%'+_0x44678b[_0xc3ee('0x33')][_0xc3ee('0x40')]+'%'};return _0x5e7dcd;}})});}_0x2cdd85=_['merge']({},_0x2cdd85,_0x44678b[_0xc3ee('0x45')]);var _0x105ecc={'where':_0x2cdd85[_0xc3ee('0x3e')]};return db[_0xc3ee('0x2e')][_0xc3ee('0x1e')](_0x105ecc)[_0xc3ee('0x27')](function(_0x381e68){_0x13f30d[_0xc3ee('0x1e')]=_0x381e68;if(_0x44678b[_0xc3ee('0x33')][_0xc3ee('0x46')]){_0x2cdd85[_0xc3ee('0x47')]=[{'all':!![]}];}return db['FreshdeskField'][_0xc3ee('0x48')](_0x2cdd85);})[_0xc3ee('0x27')](function(_0x4a89b7){_0x13f30d['rows']=_0x4a89b7;return _0x13f30d;})[_0xc3ee('0x27')](respondWithFilteredResult(_0x2fba96,_0x2cdd85))[_0xc3ee('0x49')](handleError(_0x2fba96,null));};exports[_0xc3ee('0x4a')]=function(_0x51c70e,_0x28b167){var _0x92a306={'raw':!![],'where':{'id':_0x51c70e[_0xc3ee('0x4b')]['id']}},_0x112e77={};_0x112e77[_0xc3ee('0x32')]=_[_0xc3ee('0x34')](db[_0xc3ee('0x2e')][_0xc3ee('0x2f')]);_0x112e77[_0xc3ee('0x33')]=_[_0xc3ee('0x34')](_0x51c70e[_0xc3ee('0x33')]);_0x112e77[_0xc3ee('0x35')]=_[_0xc3ee('0x36')](_0x112e77[_0xc3ee('0x32')],_0x112e77['query']);_0x92a306[_0xc3ee('0x38')]=_['intersection'](_0x112e77['model'],qs[_0xc3ee('0x37')](_0x51c70e[_0xc3ee('0x33')]['fields']));_0x92a306[_0xc3ee('0x38')]=_0x92a306[_0xc3ee('0x38')]['length']?_0x92a306[_0xc3ee('0x38')]:_0x112e77['model'];if(_0x51c70e[_0xc3ee('0x33')]['includeAll']){_0x92a306[_0xc3ee('0x47')]=[{'all':!![]}];}_0x92a306=_[_0xc3ee('0x41')]({},_0x92a306,_0x51c70e['options']);return db['FreshdeskField']['find'](_0x92a306)[_0xc3ee('0x27')](handleEntityNotFound(_0x28b167,null))[_0xc3ee('0x27')](respondWithResult(_0x28b167,null))[_0xc3ee('0x49')](handleError(_0x28b167,null));};exports[_0xc3ee('0x4c')]=function(_0x972860,_0x5b5f5c){return db['FreshdeskField'][_0xc3ee('0x4c')](_0x972860[_0xc3ee('0x4d')],{})['then'](respondWithResult(_0x5b5f5c,0xc9))[_0xc3ee('0x49')](handleError(_0x5b5f5c,null));};exports['update']=function(_0x60e36a,_0x5d0017){if(_0x60e36a[_0xc3ee('0x4d')]['id']){delete _0x60e36a[_0xc3ee('0x4d')]['id'];}return db[_0xc3ee('0x2e')][_0xc3ee('0x4e')]({'where':{'id':_0x60e36a[_0xc3ee('0x4b')]['id']}})[_0xc3ee('0x27')](handleEntityNotFound(_0x5d0017,null))[_0xc3ee('0x27')](saveUpdates(_0x60e36a['body'],null))[_0xc3ee('0x27')](respondWithResult(_0x5d0017,null))[_0xc3ee('0x49')](handleError(_0x5d0017,null));};exports[_0xc3ee('0x4f')]=function(_0x237aa8,_0x47d12c){return db[_0xc3ee('0x2e')][_0xc3ee('0x4e')]({'where':{'id':_0x237aa8[_0xc3ee('0x4b')]['id']}})[_0xc3ee('0x27')](handleEntityNotFound(_0x47d12c,null))[_0xc3ee('0x27')](removeEntity(_0x47d12c,null))[_0xc3ee('0x49')](handleError(_0x47d12c,null));}; \ No newline at end of file +var _0xb921=['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','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','error','stack','name','index','FreshdeskField','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','include','options','create','body','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x522144,_0x4dd58d){var _0x2a0223=function(_0x3a9563){while(--_0x3a9563){_0x522144['push'](_0x522144['shift']());}};_0x2a0223(++_0x4dd58d);}(_0xb921,0x16a));var _0x1b92=function(_0x2726ad,_0x5073b1){_0x2726ad=_0x2726ad-0x0;var _0xd87993=_0xb921[_0x2726ad];return _0xd87993;};'use strict';var emlformat=require(_0x1b92('0x0'));var rimraf=require(_0x1b92('0x1'));var zipdir=require(_0x1b92('0x2'));var jsonpatch=require(_0x1b92('0x3'));var rp=require(_0x1b92('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1b92('0x5'));var util=require(_0x1b92('0x6'));var path=require(_0x1b92('0x7'));var sox=require(_0x1b92('0x8'));var csv=require(_0x1b92('0x9'));var ejs=require(_0x1b92('0xa'));var fs=require('fs');var fs_extra=require(_0x1b92('0xb'));var _=require(_0x1b92('0xc'));var squel=require(_0x1b92('0xd'));var crypto=require(_0x1b92('0xe'));var jsforce=require(_0x1b92('0xf'));var deskjs=require(_0x1b92('0x10'));var toCsv=require(_0x1b92('0x9'));var querystring=require(_0x1b92('0x11'));var Papa=require(_0x1b92('0x12'));var Redis=require('ioredis');var authService=require(_0x1b92('0x13'));var qs=require(_0x1b92('0x14'));var as=require(_0x1b92('0x15'));var hardwareService=require(_0x1b92('0x16'));var logger=require(_0x1b92('0x17'))(_0x1b92('0x18'));var utils=require(_0x1b92('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1b92('0x1a'));var db=require(_0x1b92('0x1b'))['db'];function respondWithStatusCode(_0x5a1ca5,_0x81cbe0){_0x81cbe0=_0x81cbe0||0xcc;return function(_0x29a7ed){if(_0x29a7ed){return _0x5a1ca5[_0x1b92('0x1c')](_0x81cbe0);}return _0x5a1ca5[_0x1b92('0x1d')](_0x81cbe0)[_0x1b92('0x1e')]();};}function respondWithResult(_0x290be6,_0x1d33bf){_0x1d33bf=_0x1d33bf||0xc8;return function(_0x4bbb76){if(_0x4bbb76){return _0x290be6[_0x1b92('0x1d')](_0x1d33bf)['json'](_0x4bbb76);}};}function respondWithFilteredResult(_0x1a559b,_0x511a97){return function(_0x694d4f){if(_0x694d4f){var _0x523285=typeof _0x511a97[_0x1b92('0x1f')]===_0x1b92('0x20')&&typeof _0x511a97[_0x1b92('0x21')]==='undefined';var _0x2d171f=_0x694d4f[_0x1b92('0x22')];var _0x289523=_0x523285?0x0:_0x511a97[_0x1b92('0x1f')];var _0x4368dc=_0x523285?_0x694d4f['count']:_0x511a97[_0x1b92('0x1f')]+_0x511a97[_0x1b92('0x21')];var _0x30b0d8;if(_0x4368dc>=_0x2d171f){_0x4368dc=_0x2d171f;_0x30b0d8=0xc8;}else{_0x30b0d8=0xce;}_0x1a559b['status'](_0x30b0d8);return _0x1a559b[_0x1b92('0x23')](_0x1b92('0x24'),_0x289523+'-'+_0x4368dc+'/'+_0x2d171f)[_0x1b92('0x25')](_0x694d4f);}return null;};}function patchUpdates(_0x4bfc51){return function(_0x1d9d28){try{jsonpatch['apply'](_0x1d9d28,_0x4bfc51,!![]);}catch(_0x39ef4e){return BPromise[_0x1b92('0x26')](_0x39ef4e);}return _0x1d9d28['save']();};}function saveUpdates(_0x4ea25f,_0x34c5c9){return function(_0x311487){if(_0x311487){return _0x311487[_0x1b92('0x27')](_0x4ea25f)[_0x1b92('0x28')](function(_0x41fc82){return _0x41fc82;});}return null;};}function removeEntity(_0x186030,_0x48cdf1){return function(_0x3be220){if(_0x3be220){return _0x3be220[_0x1b92('0x29')]()[_0x1b92('0x28')](function(){_0x186030[_0x1b92('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f0e1b,_0x53025e){return function(_0x4369e2){if(!_0x4369e2){_0x3f0e1b[_0x1b92('0x1c')](0x194);}return _0x4369e2;};}function handleError(_0x1abb9a,_0x3c1fa1){_0x3c1fa1=_0x3c1fa1||0x1f4;return function(_0x3e353){logger[_0x1b92('0x2a')](_0x3e353[_0x1b92('0x2b')]);if(_0x3e353[_0x1b92('0x2c')]){delete _0x3e353['name'];}_0x1abb9a['status'](_0x3c1fa1)['send'](_0x3e353);};}exports[_0x1b92('0x2d')]=function(_0x525d05,_0x2c4e02){var _0x5d006b={},_0x462949={},_0x4656aa={'count':0x0,'rows':[]};var _0x26f832=_['map'](db[_0x1b92('0x2e')][_0x1b92('0x2f')],function(_0x55eafd){return{'name':_0x55eafd['fieldName'],'type':_0x55eafd[_0x1b92('0x30')][_0x1b92('0x31')]};});_0x462949[_0x1b92('0x32')]=_[_0x1b92('0x33')](_0x26f832,_0x1b92('0x2c'));_0x462949['query']=_[_0x1b92('0x34')](_0x525d05[_0x1b92('0x35')]);_0x462949[_0x1b92('0x36')]=_[_0x1b92('0x37')](_0x462949[_0x1b92('0x32')],_0x462949[_0x1b92('0x35')]);_0x5d006b[_0x1b92('0x38')]=_['intersection'](_0x462949[_0x1b92('0x32')],qs[_0x1b92('0x39')](_0x525d05['query'][_0x1b92('0x39')]));_0x5d006b[_0x1b92('0x38')]=_0x5d006b[_0x1b92('0x38')]['length']?_0x5d006b[_0x1b92('0x38')]:_0x462949[_0x1b92('0x32')];if(!_0x525d05['query']['hasOwnProperty'](_0x1b92('0x3a'))){_0x5d006b[_0x1b92('0x21')]=qs[_0x1b92('0x21')](_0x525d05[_0x1b92('0x35')]['limit']);_0x5d006b['offset']=qs['offset'](_0x525d05[_0x1b92('0x35')][_0x1b92('0x1f')]);}_0x5d006b[_0x1b92('0x3b')]=qs[_0x1b92('0x3c')](_0x525d05[_0x1b92('0x35')][_0x1b92('0x3c')]);_0x5d006b[_0x1b92('0x3d')]=qs['filters'](_[_0x1b92('0x3e')](_0x525d05[_0x1b92('0x35')],_0x462949['filters']),_0x26f832);if(_0x525d05[_0x1b92('0x35')][_0x1b92('0x3f')]){_0x5d006b[_0x1b92('0x3d')]=_[_0x1b92('0x40')](_0x5d006b[_0x1b92('0x3d')],{'$or':_[_0x1b92('0x33')](_0x26f832,function(_0x115e5f){if(_0x115e5f[_0x1b92('0x30')]!==_0x1b92('0x41')){var _0x14571e={};_0x14571e[_0x115e5f['name']]={'$like':'%'+_0x525d05[_0x1b92('0x35')]['filter']+'%'};return _0x14571e;}})});}_0x5d006b=_[_0x1b92('0x40')]({},_0x5d006b,_0x525d05['options']);var _0x4589fb={'where':_0x5d006b[_0x1b92('0x3d')]};return db[_0x1b92('0x2e')][_0x1b92('0x22')](_0x4589fb)[_0x1b92('0x28')](function(_0x29cda5){_0x4656aa[_0x1b92('0x22')]=_0x29cda5;if(_0x525d05[_0x1b92('0x35')][_0x1b92('0x42')]){_0x5d006b['include']=[{'all':!![]}];}return db[_0x1b92('0x2e')]['findAll'](_0x5d006b);})[_0x1b92('0x28')](function(_0x1e945){_0x4656aa[_0x1b92('0x43')]=_0x1e945;return _0x4656aa;})[_0x1b92('0x28')](respondWithFilteredResult(_0x2c4e02,_0x5d006b))['catch'](handleError(_0x2c4e02,null));};exports[_0x1b92('0x44')]=function(_0xfb5b49,_0x133500){var _0x469a88={'raw':!![],'where':{'id':_0xfb5b49[_0x1b92('0x45')]['id']}},_0xd3f7b0={};_0xd3f7b0['model']=_[_0x1b92('0x34')](db[_0x1b92('0x2e')][_0x1b92('0x2f')]);_0xd3f7b0[_0x1b92('0x35')]=_[_0x1b92('0x34')](_0xfb5b49[_0x1b92('0x35')]);_0xd3f7b0['filters']=_[_0x1b92('0x37')](_0xd3f7b0[_0x1b92('0x32')],_0xd3f7b0['query']);_0x469a88[_0x1b92('0x38')]=_['intersection'](_0xd3f7b0[_0x1b92('0x32')],qs[_0x1b92('0x39')](_0xfb5b49[_0x1b92('0x35')]['fields']));_0x469a88[_0x1b92('0x38')]=_0x469a88[_0x1b92('0x38')]['length']?_0x469a88['attributes']:_0xd3f7b0['model'];if(_0xfb5b49[_0x1b92('0x35')][_0x1b92('0x42')]){_0x469a88[_0x1b92('0x46')]=[{'all':!![]}];}_0x469a88=_[_0x1b92('0x40')]({},_0x469a88,_0xfb5b49[_0x1b92('0x47')]);return db[_0x1b92('0x2e')]['find'](_0x469a88)[_0x1b92('0x28')](handleEntityNotFound(_0x133500,null))[_0x1b92('0x28')](respondWithResult(_0x133500,null))['catch'](handleError(_0x133500,null));};exports[_0x1b92('0x48')]=function(_0x30dbb0,_0x121be9){return db['FreshdeskField'][_0x1b92('0x48')](_0x30dbb0[_0x1b92('0x49')],{})[_0x1b92('0x28')](respondWithResult(_0x121be9,0xc9))[_0x1b92('0x4a')](handleError(_0x121be9,null));};exports[_0x1b92('0x27')]=function(_0x5ac096,_0x142d28){if(_0x5ac096[_0x1b92('0x49')]['id']){delete _0x5ac096[_0x1b92('0x49')]['id'];}return db[_0x1b92('0x2e')][_0x1b92('0x4b')]({'where':{'id':_0x5ac096['params']['id']}})['then'](handleEntityNotFound(_0x142d28,null))[_0x1b92('0x28')](saveUpdates(_0x5ac096[_0x1b92('0x49')],null))[_0x1b92('0x28')](respondWithResult(_0x142d28,null))[_0x1b92('0x4a')](handleError(_0x142d28,null));};exports['destroy']=function(_0x4e0954,_0xfdae28){return db['FreshdeskField'][_0x1b92('0x4b')]({'where':{'id':_0x4e0954[_0x1b92('0x45')]['id']}})[_0x1b92('0x28')](handleEntityNotFound(_0xfdae28,null))['then'](removeEntity(_0xfdae28,null))[_0x1b92('0x4a')](handleError(_0xfdae28,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index a8d86d1..cd65b6c 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 _0x18fe=['request-promise','path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x18fe,0x13a));var _0xe18f=function(_0x4283b4,_0x368a33){_0x4283b4=_0x4283b4-0x0;var _0x1b23e2=_0x18fe[_0x4283b4];return _0x1b23e2;};'use strict';var _=require(_0xe18f('0x0'));var util=require(_0xe18f('0x1'));var logger=require(_0xe18f('0x2'))(_0xe18f('0x3'));var moment=require(_0xe18f('0x4'));var BPromise=require(_0xe18f('0x5'));var rp=require(_0xe18f('0x6'));var fs=require('fs');var path=require(_0xe18f('0x7'));var rimraf=require(_0xe18f('0x8'));var config=require('../../config/environment');var attributes=require(_0xe18f('0x9'));module[_0xe18f('0xa')]=function(_0x5ba26c,_0x227062){return _0x5ba26c[_0xe18f('0xb')](_0xe18f('0xc'),attributes,{'tableName':_0xe18f('0xd'),'paranoid':![],'indexes':[{'name':_0xe18f('0xe'),'fields':['idField',_0xe18f('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd10b=['path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1e9424,_0x191cba){var _0x1bd96c=function(_0x5e952d){while(--_0x5e952d){_0x1e9424['push'](_0x1e9424['shift']());}};_0x1bd96c(++_0x191cba);}(_0xd10b,0xf8));var _0xbd10=function(_0x1db831,_0x8725b6){_0x1db831=_0x1db831-0x0;var _0x5db8ad=_0xd10b[_0x1db831];return _0x5db8ad;};'use strict';var _=require(_0xbd10('0x0'));var util=require(_0xbd10('0x1'));var logger=require(_0xbd10('0x2'))(_0xbd10('0x3'));var moment=require(_0xbd10('0x4'));var BPromise=require(_0xbd10('0x5'));var rp=require(_0xbd10('0x6'));var fs=require('fs');var path=require(_0xbd10('0x7'));var rimraf=require(_0xbd10('0x8'));var config=require('../../config/environment');var attributes=require(_0xbd10('0x9'));module[_0xbd10('0xa')]=function(_0x12e5bd,_0x3e2ac8){return _0x12e5bd[_0xbd10('0xb')](_0xbd10('0xc'),attributes,{'tableName':_0xbd10('0xd'),'paranoid':![],'indexes':[{'name':_0xbd10('0xe'),'fields':[_0xbd10('0xf'),_0xbd10('0x10')],'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 584fd45..1916265 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 _0x0497=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x282a1f,_0x49a6ef){var _0x296ea7=function(_0x4bac68){while(--_0x4bac68){_0x282a1f['push'](_0x282a1f['shift']());}};_0x296ea7(++_0x49a6ef);}(_0x0497,0xd9));var _0x7049=function(_0x141a1b,_0x48ce01){_0x141a1b=_0x141a1b-0x0;var _0x54319f=_0x0497[_0x141a1b];return _0x54319f;};'use strict';var _=require(_0x7049('0x0'));var util=require(_0x7049('0x1'));var moment=require('moment');var BPromise=require(_0x7049('0x2'));var rs=require(_0x7049('0x3'));var fs=require('fs');var Redis=require(_0x7049('0x4'));var db=require(_0x7049('0x5'))['db'];var utils=require(_0x7049('0x6'));var logger=require(_0x7049('0x7'))('rpc');var config=require(_0x7049('0x8'));var jayson=require(_0x7049('0x9'));var client=jayson['client'][_0x7049('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b682e,_0x5c68da,_0x504af6){return new BPromise(function(_0x1fa4da,_0x185bda){return client[_0x7049('0xb')](_0x4b682e,_0x504af6)['then'](function(_0x1d7b53){logger[_0x7049('0xc')](_0x7049('0xd'),_0x5c68da,_0x7049('0xe'));logger[_0x7049('0xf')](_0x7049('0x10'),_0x5c68da,_0x7049('0xe'),JSON['stringify'](_0x1d7b53));if(_0x1d7b53[_0x7049('0x11')]){if(_0x1d7b53[_0x7049('0x11')][_0x7049('0x12')]===0x1f4){logger['error'](_0x7049('0xd'),_0x5c68da,_0x1d7b53[_0x7049('0x11')][_0x7049('0x13')]);return _0x185bda(_0x1d7b53[_0x7049('0x11')][_0x7049('0x13')]);}logger[_0x7049('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x5c68da,_0x1d7b53[_0x7049('0x11')]['message']);return _0x1fa4da(_0x1d7b53[_0x7049('0x11')][_0x7049('0x13')]);}else{logger[_0x7049('0xc')](_0x7049('0xd'),_0x5c68da,_0x7049('0xe'));_0x1fa4da(_0x1d7b53[_0x7049('0x14')][_0x7049('0x13')]);}})[_0x7049('0x15')](function(_0xb907a){logger[_0x7049('0x11')](_0x7049('0xd'),_0x5c68da,_0xb907a);_0x185bda(_0xb907a);});});} \ No newline at end of file +var _0x929e=['stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x156fa9,_0x2c4a0e){var _0x14dd7d=function(_0x20f7a4){while(--_0x20f7a4){_0x156fa9['push'](_0x156fa9['shift']());}};_0x14dd7d(++_0x2c4a0e);}(_0x929e,0x1bb));var _0xe929=function(_0x2128b4,_0x1514af){_0x2128b4=_0x2128b4-0x0;var _0x4b367a=_0x929e[_0x2128b4];return _0x4b367a;};'use strict';var _=require(_0xe929('0x0'));var util=require(_0xe929('0x1'));var moment=require(_0xe929('0x2'));var BPromise=require('bluebird');var rs=require(_0xe929('0x3'));var fs=require('fs');var Redis=require(_0xe929('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe929('0x5'))(_0xe929('0x6'));var config=require(_0xe929('0x7'));var jayson=require(_0xe929('0x8'));var client=jayson['client'][_0xe929('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x239d89,_0x109350,_0xe45523){return new BPromise(function(_0x2499df,_0x3b9caa){return client[_0xe929('0xa')](_0x239d89,_0xe45523)[_0xe929('0xb')](function(_0x230e27){logger[_0xe929('0xc')](_0xe929('0xd'),_0x109350,_0xe929('0xe'));logger[_0xe929('0xf')](_0xe929('0x10'),_0x109350,_0xe929('0xe'),JSON[_0xe929('0x11')](_0x230e27));if(_0x230e27[_0xe929('0x12')]){if(_0x230e27[_0xe929('0x12')][_0xe929('0x13')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x109350,_0x230e27[_0xe929('0x12')][_0xe929('0x14')]);return _0x3b9caa(_0x230e27['error'][_0xe929('0x14')]);}logger[_0xe929('0x12')](_0xe929('0xd'),_0x109350,_0x230e27[_0xe929('0x12')]['message']);return _0x2499df(_0x230e27[_0xe929('0x12')][_0xe929('0x14')]);}else{logger[_0xe929('0xc')](_0xe929('0xd'),_0x109350,_0xe929('0xe'));_0x2499df(_0x230e27[_0xe929('0x15')][_0xe929('0x14')]);}})[_0xe929('0x16')](function(_0x29edf1){logger[_0xe929('0x12')](_0xe929('0xd'),_0x109350,_0x29edf1);_0x3b9caa(_0x29edf1);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a28d2b5..4fa2284 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 _0x0fd9=['../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x4f25f9,_0x255051){var _0x92083c=function(_0x46ab7b){while(--_0x46ab7b){_0x4f25f9['push'](_0x4f25f9['shift']());}};_0x92083c(++_0x255051);}(_0x0fd9,0xa3));var _0x90fd=function(_0x4164f2,_0x38669f){_0x4164f2=_0x4164f2-0x0;var _0x2575c7=_0x0fd9[_0x4164f2];return _0x2575c7;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),controller[_0x90fd('0x10')]);router[_0x90fd('0xf')]('/:id/configurations',auth[_0x90fd('0x9')](),controller[_0x90fd('0x11')]);router['put'](_0x90fd('0xa'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x12')]);router['delete'](_0x90fd('0xa'),auth['isAuthenticated'](),controller[_0x90fd('0x13')]);module[_0x90fd('0x14')]=router; \ No newline at end of file +var _0x0565=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','post','create','delete','/:id','exports'];(function(_0xd52cba,_0x12ba30){var _0x59c1fe=function(_0x124c31){while(--_0x124c31){_0xd52cba['push'](_0xd52cba['shift']());}};_0x59c1fe(++_0x12ba30);}(_0x0565,0xf2));var _0x5056=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x0565[_0x1b7368];return _0x25d54c;};'use strict';var multer=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var path=require(_0x5056('0x2'));var timeout=require(_0x5056('0x3'));var express=require(_0x5056('0x4'));var router=express[_0x5056('0x5')]();var fs_extra=require(_0x5056('0x6'));var auth=require(_0x5056('0x7'));var interaction=require(_0x5056('0x8'));var config=require(_0x5056('0x9'));var controller=require('./intFreshsalesAccount.controller');router[_0x5056('0xa')]('/',auth[_0x5056('0xb')](),controller[_0x5056('0xc')]);router[_0x5056('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x5056('0xd')]);router[_0x5056('0xa')](_0x5056('0xe'),auth[_0x5056('0xb')](),controller[_0x5056('0xf')]);router[_0x5056('0xa')](_0x5056('0x10'),auth[_0x5056('0xb')](),controller['getFields']);router[_0x5056('0x11')]('/',auth[_0x5056('0xb')](),controller[_0x5056('0x12')]);router['post']('/:id/configurations',auth[_0x5056('0xb')](),controller['addConfiguration']);router['put']('/:id',auth[_0x5056('0xb')](),controller['update']);router[_0x5056('0x13')](_0x5056('0x14'),auth[_0x5056('0xb')](),controller['destroy']);module[_0x5056('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ab6e297..6900f59 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 _0xd7d1=['sequelize','exports','STRING','username','remoteUri'];(function(_0x2e4cf9,_0x515fd9){var _0x39f63a=function(_0x33ef49){while(--_0x33ef49){_0x2e4cf9['push'](_0x2e4cf9['shift']());}};_0x39f63a(++_0x515fd9);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x38db18,_0x4edbc4){_0x38db18=_0x38db18-0x0;var _0x50e8db=_0xd7d1[_0x38db18];return _0x50e8db;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')]},'description':{'type':Sequelize[_0x1d7d('0x2')]},'username':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3')},'apiKey':{'type':Sequelize[_0x1d7d('0x2')]},'remoteUri':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x4')},'serverUrl':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1eba=['exports','STRING','remoteUri','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x47e549,_0x2e53d6){_0x47e549=_0x47e549-0x0;var _0x251374=_0x1eba[_0x47e549];return _0x251374;};'use strict';var Sequelize=require(_0xa1eb('0x0'));module[_0xa1eb('0x1')]={'name':{'type':Sequelize[_0xa1eb('0x2')]},'description':{'type':Sequelize[_0xa1eb('0x2')]},'username':{'type':Sequelize[_0xa1eb('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xa1eb('0x2')],'unique':_0xa1eb('0x3')},'serverUrl':{'type':Sequelize[_0xa1eb('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 55cebec..254b56e 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 _0x3e22=['Descriptions','Subjects','FreshsalesField','getFields','remoteUri','username','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','apiKey','Requested\x20Resource\x20not\x20Found','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','keys','find','create','body','catch','update','params','FreshsalesConfiguration','order','getConfigurations','addConfiguration','findOne','AccountId','getSubjects'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x3e22,0x18d));var _0x23e2=function(_0x360076,_0x481a6f){_0x360076=_0x360076-0x0;var _0x1d593d=_0x3e22[_0x360076];return _0x1d593d;};'use strict';var emlformat=require(_0x23e2('0x0'));var rimraf=require(_0x23e2('0x1'));var zipdir=require(_0x23e2('0x2'));var jsonpatch=require(_0x23e2('0x3'));var rp=require(_0x23e2('0x4'));var moment=require('moment');var BPromise=require(_0x23e2('0x5'));var Mustache=require('mustache');var util=require(_0x23e2('0x6'));var path=require(_0x23e2('0x7'));var sox=require(_0x23e2('0x8'));var csv=require(_0x23e2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x23e2('0xa'));var _=require(_0x23e2('0xb'));var squel=require(_0x23e2('0xc'));var crypto=require(_0x23e2('0xd'));var jsforce=require(_0x23e2('0xe'));var deskjs=require(_0x23e2('0xf'));var toCsv=require(_0x23e2('0x9'));var querystring=require(_0x23e2('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x23e2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x23e2('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x23e2('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x23e2('0x14'));var db=require(_0x23e2('0x15'))['db'];var integrations=require(_0x23e2('0x16'));function respondWithStatusCode(_0x660dcf,_0x111e01){_0x111e01=_0x111e01||0xcc;return function(_0x229dd9){if(_0x229dd9){return _0x660dcf[_0x23e2('0x17')](_0x111e01);}return _0x660dcf['status'](_0x111e01)['end']();};}function respondWithResult(_0x10a0e5,_0x57cb2d){_0x57cb2d=_0x57cb2d||0xc8;return function(_0x501b99){if(_0x501b99){return _0x10a0e5[_0x23e2('0x18')](_0x57cb2d)[_0x23e2('0x19')](_0x501b99);}};}function respondWithFilteredResult(_0x524f50,_0x2df098){return function(_0x571310){if(_0x571310){var _0x3f06c8=typeof _0x2df098[_0x23e2('0x1a')]===_0x23e2('0x1b')&&typeof _0x2df098[_0x23e2('0x1c')]==='undefined';var _0x473f9d=_0x571310[_0x23e2('0x1d')];var _0x5db0f4=_0x3f06c8?0x0:_0x2df098[_0x23e2('0x1a')];var _0x50e99a=_0x3f06c8?_0x571310[_0x23e2('0x1d')]:_0x2df098['offset']+_0x2df098[_0x23e2('0x1c')];var _0x1c38de;if(_0x50e99a>=_0x473f9d){_0x50e99a=_0x473f9d;_0x1c38de=0xc8;}else{_0x1c38de=0xce;}_0x524f50[_0x23e2('0x18')](_0x1c38de);return _0x524f50[_0x23e2('0x1e')](_0x23e2('0x1f'),_0x5db0f4+'-'+_0x50e99a+'/'+_0x473f9d)[_0x23e2('0x19')](_0x571310);}return null;};}function patchUpdates(_0x46e114){return function(_0x263b82){try{jsonpatch[_0x23e2('0x20')](_0x263b82,_0x46e114,!![]);}catch(_0x1169a2){return BPromise['reject'](_0x1169a2);}return _0x263b82[_0x23e2('0x21')]();};}function saveUpdates(_0x20a69f,_0x153831){return function(_0x29077d){if(_0x29077d){return _0x29077d['update'](_0x20a69f)[_0x23e2('0x22')](function(_0x46612d){return _0x46612d;});}return null;};}function removeEntity(_0x58819f,_0x179cc6){return function(_0x18d4c0){if(_0x18d4c0){return _0x18d4c0[_0x23e2('0x23')]()[_0x23e2('0x22')](function(){_0x58819f[_0x23e2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x468f41,_0x1935ff){return function(_0x1f0d5b){if(!_0x1f0d5b){_0x468f41[_0x23e2('0x17')](0x194);}return _0x1f0d5b;};}function handleError(_0x195ab4,_0x24a14e){_0x24a14e=_0x24a14e||0x1f4;return function(_0x25bfe9){logger[_0x23e2('0x24')](_0x25bfe9[_0x23e2('0x25')]);if(_0x25bfe9['name']){delete _0x25bfe9[_0x23e2('0x26')];}_0x195ab4[_0x23e2('0x18')](_0x24a14e)[_0x23e2('0x27')](_0x25bfe9);};}exports['index']=function(_0x4101b9,_0x5b332a){var _0x15d443={},_0x32c8fa={},_0x5321bb={'count':0x0,'rows':[]};var _0x13ca62=_[_0x23e2('0x28')](db[_0x23e2('0x29')][_0x23e2('0x2a')],function(_0x16e0f4){return{'name':_0x16e0f4[_0x23e2('0x2b')],'type':_0x16e0f4['type'][_0x23e2('0x2c')]};});_0x32c8fa[_0x23e2('0x2d')]=_['map'](_0x13ca62,_0x23e2('0x26'));_0x32c8fa[_0x23e2('0x2e')]=_['keys'](_0x4101b9[_0x23e2('0x2e')]);_0x32c8fa[_0x23e2('0x2f')]=_[_0x23e2('0x30')](_0x32c8fa[_0x23e2('0x2d')],_0x32c8fa['query']);_0x15d443[_0x23e2('0x31')]=_[_0x23e2('0x30')](_0x32c8fa['model'],qs[_0x23e2('0x32')](_0x4101b9['query'][_0x23e2('0x32')]));_0x15d443[_0x23e2('0x31')]=_0x15d443[_0x23e2('0x31')][_0x23e2('0x33')]?_0x15d443['attributes']:_0x32c8fa[_0x23e2('0x2d')];if(!_0x4101b9[_0x23e2('0x2e')][_0x23e2('0x34')](_0x23e2('0x35'))){_0x15d443['limit']=qs[_0x23e2('0x1c')](_0x4101b9[_0x23e2('0x2e')][_0x23e2('0x1c')]);_0x15d443[_0x23e2('0x1a')]=qs[_0x23e2('0x1a')](_0x4101b9[_0x23e2('0x2e')][_0x23e2('0x1a')]);}_0x15d443['order']=qs['sort'](_0x4101b9[_0x23e2('0x2e')][_0x23e2('0x36')]);_0x15d443[_0x23e2('0x37')]=qs[_0x23e2('0x2f')](_[_0x23e2('0x38')](_0x4101b9[_0x23e2('0x2e')],_0x32c8fa[_0x23e2('0x2f')]),_0x13ca62);if(_0x4101b9[_0x23e2('0x2e')][_0x23e2('0x39')]){_0x15d443[_0x23e2('0x37')]=_[_0x23e2('0x3a')](_0x15d443[_0x23e2('0x37')],{'$or':_[_0x23e2('0x28')](_0x13ca62,function(_0x57c912){if(_0x57c912['type']!==_0x23e2('0x3b')){var _0x17155a={};_0x17155a[_0x57c912['name']]={'$like':'%'+_0x4101b9[_0x23e2('0x2e')][_0x23e2('0x39')]+'%'};return _0x17155a;}})});}_0x15d443=_[_0x23e2('0x3a')]({},_0x15d443,_0x4101b9[_0x23e2('0x3c')]);var _0x920ca2={'where':_0x15d443[_0x23e2('0x37')]};return db[_0x23e2('0x29')][_0x23e2('0x1d')](_0x920ca2)[_0x23e2('0x22')](function(_0x3a705c){_0x5321bb['count']=_0x3a705c;if(_0x4101b9[_0x23e2('0x2e')][_0x23e2('0x3d')]){_0x15d443[_0x23e2('0x3e')]=[{'all':!![]}];}return db[_0x23e2('0x29')]['findAll'](_0x15d443);})['then'](function(_0x534702){_0x5321bb['rows']=_0x534702;return _0x5321bb;})['then'](respondWithFilteredResult(_0x5b332a,_0x15d443))['catch'](handleError(_0x5b332a,null));};exports[_0x23e2('0x3f')]=function(_0x300262,_0x6edcac){var _0x28be57={'raw':![],'where':{'id':_0x300262['params']['id']}},_0x4f4412={};_0x4f4412[_0x23e2('0x2d')]=_[_0x23e2('0x40')](db[_0x23e2('0x29')][_0x23e2('0x2a')]);_0x4f4412['query']=_[_0x23e2('0x40')](_0x300262['query']);_0x4f4412[_0x23e2('0x2f')]=_[_0x23e2('0x30')](_0x4f4412[_0x23e2('0x2d')],_0x4f4412[_0x23e2('0x2e')]);_0x28be57[_0x23e2('0x31')]=_[_0x23e2('0x30')](_0x4f4412[_0x23e2('0x2d')],qs[_0x23e2('0x32')](_0x300262['query'][_0x23e2('0x32')]));_0x28be57[_0x23e2('0x31')]=_0x28be57[_0x23e2('0x31')][_0x23e2('0x33')]?_0x28be57['attributes']:_0x4f4412[_0x23e2('0x2d')];if(_0x300262['query'][_0x23e2('0x3d')]){_0x28be57[_0x23e2('0x3e')]=[{'all':!![]}];}_0x28be57=_[_0x23e2('0x3a')]({},_0x28be57,_0x300262[_0x23e2('0x3c')]);return db[_0x23e2('0x29')][_0x23e2('0x41')](_0x28be57)[_0x23e2('0x22')](handleEntityNotFound(_0x6edcac,null))['then'](respondWithResult(_0x6edcac,null))['catch'](handleError(_0x6edcac,null));};exports[_0x23e2('0x42')]=function(_0x300d97,_0x1cb35f){return db[_0x23e2('0x29')]['create'](_0x300d97[_0x23e2('0x43')],{})[_0x23e2('0x22')](respondWithResult(_0x1cb35f,0xc9))[_0x23e2('0x44')](handleError(_0x1cb35f,null));};exports[_0x23e2('0x45')]=function(_0x561757,_0x41be44){if(_0x561757[_0x23e2('0x43')]['id']){delete _0x561757[_0x23e2('0x43')]['id'];}return db[_0x23e2('0x29')][_0x23e2('0x41')]({'where':{'id':_0x561757[_0x23e2('0x46')]['id']}})[_0x23e2('0x22')](handleEntityNotFound(_0x41be44,null))[_0x23e2('0x22')](saveUpdates(_0x561757[_0x23e2('0x43')],null))[_0x23e2('0x22')](respondWithResult(_0x41be44,null))['catch'](handleError(_0x41be44,null));};exports[_0x23e2('0x23')]=function(_0x794b0a,_0x41ee89){return db[_0x23e2('0x29')]['find']({'where':{'id':_0x794b0a[_0x23e2('0x46')]['id']}})[_0x23e2('0x22')](handleEntityNotFound(_0x41ee89,null))[_0x23e2('0x22')](removeEntity(_0x41ee89,null))[_0x23e2('0x44')](handleError(_0x41ee89,null));};exports['getConfigurations']=function(_0x30c718,_0x4f2049,_0x58bd56){var _0x5e522c={};var _0x8687d={};var _0x1fbd04;var _0x8a8a59;return db[_0x23e2('0x29')]['findOne']({'where':{'id':_0x30c718[_0x23e2('0x46')]['id']}})[_0x23e2('0x22')](handleEntityNotFound(_0x4f2049,null))[_0x23e2('0x22')](function(_0x47dce1){if(_0x47dce1){_0x1fbd04=_0x47dce1;_0x8687d['model']=_['keys'](db[_0x23e2('0x47')]['rawAttributes']);_0x8687d[_0x23e2('0x2e')]=_[_0x23e2('0x40')](_0x30c718[_0x23e2('0x2e')]);_0x8687d[_0x23e2('0x2f')]=_[_0x23e2('0x30')](_0x8687d[_0x23e2('0x2d')],_0x8687d[_0x23e2('0x2e')]);_0x5e522c[_0x23e2('0x31')]=_[_0x23e2('0x30')](_0x8687d['model'],qs['fields'](_0x30c718['query'][_0x23e2('0x32')]));_0x5e522c[_0x23e2('0x31')]=_0x5e522c[_0x23e2('0x31')][_0x23e2('0x33')]?_0x5e522c[_0x23e2('0x31')]:_0x8687d[_0x23e2('0x2d')];_0x5e522c[_0x23e2('0x48')]=qs[_0x23e2('0x36')](_0x30c718['query'][_0x23e2('0x36')]);_0x5e522c[_0x23e2('0x37')]=qs['filters'](_['pick'](_0x30c718[_0x23e2('0x2e')],_0x8687d['filters']));if(_0x30c718['query']['filter']){_0x5e522c[_0x23e2('0x37')]=_[_0x23e2('0x3a')](_0x5e522c[_0x23e2('0x37')],{'$or':_[_0x23e2('0x28')](_0x5e522c['attributes'],function(_0x6a71f){var _0x19ec43={};_0x19ec43[_0x6a71f]={'$like':'%'+_0x30c718[_0x23e2('0x2e')][_0x23e2('0x39')]+'%'};return _0x19ec43;})});}_0x5e522c=_['merge']({},_0x5e522c,_0x30c718[_0x23e2('0x3c')]);return _0x1fbd04[_0x23e2('0x49')](_0x5e522c);}})[_0x23e2('0x22')](function(_0x33d226){if(_0x33d226){_0x8a8a59=_0x33d226[_0x23e2('0x33')];if(!_0x30c718['query'][_0x23e2('0x34')](_0x23e2('0x35'))){_0x5e522c[_0x23e2('0x1c')]=qs[_0x23e2('0x1c')](_0x30c718[_0x23e2('0x2e')][_0x23e2('0x1c')]);_0x5e522c[_0x23e2('0x1a')]=qs[_0x23e2('0x1a')](_0x30c718['query'][_0x23e2('0x1a')]);}return _0x1fbd04[_0x23e2('0x49')](_0x5e522c);}})['then'](function(_0x5a46ab){if(_0x5a46ab){return _0x5a46ab?{'count':_0x8a8a59,'rows':_0x5a46ab}:null;}})[_0x23e2('0x22')](respondWithResult(_0x4f2049,null))[_0x23e2('0x44')](handleError(_0x4f2049,null));};exports[_0x23e2('0x4a')]=function(_0x5a0787,_0x18abf7,_0x44376f){if(_0x5a0787[_0x23e2('0x43')]['id']){delete _0x5a0787[_0x23e2('0x43')]['id'];}return db[_0x23e2('0x29')][_0x23e2('0x4b')]({'where':{'id':_0x5a0787['params']['id']}})[_0x23e2('0x22')](handleEntityNotFound(_0x18abf7,null))[_0x23e2('0x22')](function(_0x60eb94){if(_0x60eb94){_0x5a0787[_0x23e2('0x43')][_0x23e2('0x4c')]=_0x60eb94['id'];_0x5a0787['body']['Subjects']=integrations[_0x23e2('0x4d')](_0x5a0787[_0x23e2('0x43')]['channel'],_0x5a0787[_0x23e2('0x43')]['type']);_0x5a0787[_0x23e2('0x43')][_0x23e2('0x4e')]=integrations['getDescriptions'](_0x5a0787['body']['channel'],_0x5a0787['body']['type']);return db[_0x23e2('0x47')][_0x23e2('0x42')](_0x5a0787[_0x23e2('0x43')],{'include':[{'model':db['FreshsalesField'],'as':_0x23e2('0x4f')},{'model':db[_0x23e2('0x50')],'as':_0x23e2('0x4e')}]});}return null;})[_0x23e2('0x22')](respondWithResult(_0x18abf7,null))['catch'](handleError(_0x18abf7,null));};exports[_0x23e2('0x51')]=function(_0x4c5e57,_0x5f10e7,_0x562e94){var _0x1d40a7='';var _0x3e8f12='';return db[_0x23e2('0x29')][_0x23e2('0x4b')]({'where':{'id':_0x4c5e57[_0x23e2('0x46')]['id']},'attributes':['id','username',_0x23e2('0x52'),'apiKey']})['then'](handleEntityNotFound(_0x5f10e7,null))['then'](function(_0x3fad9e){if(_0x3fad9e){_0x3e8f12=_0x3fad9e[_0x23e2('0x53')];_0x1d40a7=_0x3fad9e[_0x23e2('0x52')];var _0x26d51c=_0x3fad9e[_0x23e2('0x52')]['slice'](-0x1);if(_0x26d51c==='/'){_0x1d40a7=_0x1d40a7[_0x23e2('0x54')](0x0,_0x1d40a7['lastIndexOf'](_0x26d51c));}return rp({'method':_0x23e2('0x55'),'uri':util[_0x23e2('0x56')](_0x23e2('0x57'),_0x1d40a7,_0x23e2('0x58')),'headers':{'Authorization':_0x23e2('0x59')+_0x3fad9e[_0x23e2('0x5a')]},'json':!![]});}})[_0x23e2('0x22')](function(_0xd9def5){if(_0xd9def5){var _0x3f4501=_0xd9def5['users'];var _0x58973f=![];var _0x35aa12=null;for(_0x35aa12=0x0;_0x35aa12<_0x3f4501[_0x23e2('0x33')];_0x35aa12++){if(_0x3f4501[_0x35aa12]['email']===_0x3e8f12){_0x58973f=!![];}}if(_0x58973f){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x23e2('0x5b')});}}})[_0x23e2('0x22')](respondWithResult(_0x5f10e7,null))['catch'](function(_0x15e971){var _0x5c5c00=_0x4c5e57['query'][_0x23e2('0x5c')]?0x1f4:_0x15e971[_0x23e2('0x5d')]||0x1f4;logger[_0x23e2('0x24')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5c5c00,JSON['stringify'](_0x15e971));delete _0x15e971[_0x23e2('0x26')];if(_0x5c5c00===0x191){_0x5c5c00=0x190;}_0x5f10e7[_0x23e2('0x18')](_0x5c5c00)[_0x23e2('0x27')](_0x4c5e57[_0x23e2('0x2e')][_0x23e2('0x5c')]?{'message':_0x23e2('0x5e'),'statusCode':_0x15e971[_0x23e2('0x5d')]}:_0x15e971);});}; \ No newline at end of file +var _0x860d=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','fields','include','options','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','Subjects','channel','getDescriptions','FreshsalesField','Descriptions','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x860d,0x17f));var _0xd860=function(_0x25a787,_0x6926e7){_0x25a787=_0x25a787-0x0;var _0x37712a=_0x860d[_0x25a787];return _0x37712a;};'use strict';var emlformat=require(_0xd860('0x0'));var rimraf=require(_0xd860('0x1'));var zipdir=require(_0xd860('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd860('0x3'));var moment=require(_0xd860('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd860('0x5'));var util=require(_0xd860('0x6'));var path=require(_0xd860('0x7'));var sox=require(_0xd860('0x8'));var csv=require('to-csv');var ejs=require(_0xd860('0x9'));var fs=require('fs');var fs_extra=require(_0xd860('0xa'));var _=require(_0xd860('0xb'));var squel=require(_0xd860('0xc'));var crypto=require(_0xd860('0xd'));var jsforce=require(_0xd860('0xe'));var deskjs=require(_0xd860('0xf'));var toCsv=require(_0xd860('0x10'));var querystring=require(_0xd860('0x11'));var Papa=require(_0xd860('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd860('0x13'));var as=require(_0xd860('0x14'));var hardwareService=require(_0xd860('0x15'));var logger=require(_0xd860('0x16'))(_0xd860('0x17'));var utils=require(_0xd860('0x18'));var config=require(_0xd860('0x19'));var licenseUtil=require(_0xd860('0x1a'));var db=require(_0xd860('0x1b'))['db'];var integrations=require(_0xd860('0x1c'));function respondWithStatusCode(_0x550447,_0x3d5aae){_0x3d5aae=_0x3d5aae||0xcc;return function(_0x176382){if(_0x176382){return _0x550447[_0xd860('0x1d')](_0x3d5aae);}return _0x550447['status'](_0x3d5aae)[_0xd860('0x1e')]();};}function respondWithResult(_0x43c12a,_0x125338){_0x125338=_0x125338||0xc8;return function(_0x5bbc3b){if(_0x5bbc3b){return _0x43c12a[_0xd860('0x1f')](_0x125338)[_0xd860('0x20')](_0x5bbc3b);}};}function respondWithFilteredResult(_0xb28d7c,_0x359408){return function(_0x1ec7be){if(_0x1ec7be){var _0x49851e=typeof _0x359408[_0xd860('0x21')]===_0xd860('0x22')&&typeof _0x359408[_0xd860('0x23')]==='undefined';var _0x240d93=_0x1ec7be['count'];var _0x2c4761=_0x49851e?0x0:_0x359408[_0xd860('0x21')];var _0x59c62c=_0x49851e?_0x1ec7be[_0xd860('0x24')]:_0x359408[_0xd860('0x21')]+_0x359408[_0xd860('0x23')];var _0x16edf5;if(_0x59c62c>=_0x240d93){_0x59c62c=_0x240d93;_0x16edf5=0xc8;}else{_0x16edf5=0xce;}_0xb28d7c[_0xd860('0x1f')](_0x16edf5);return _0xb28d7c[_0xd860('0x25')]('Content-Range',_0x2c4761+'-'+_0x59c62c+'/'+_0x240d93)[_0xd860('0x20')](_0x1ec7be);}return null;};}function patchUpdates(_0x2d649a){return function(_0x15bcb1){try{jsonpatch[_0xd860('0x26')](_0x15bcb1,_0x2d649a,!![]);}catch(_0x102b30){return BPromise[_0xd860('0x27')](_0x102b30);}return _0x15bcb1[_0xd860('0x28')]();};}function saveUpdates(_0x4f95a4,_0x233de5){return function(_0x41b3ad){if(_0x41b3ad){return _0x41b3ad[_0xd860('0x29')](_0x4f95a4)[_0xd860('0x2a')](function(_0x3fa008){return _0x3fa008;});}return null;};}function removeEntity(_0x1cc1d2,_0x4d8a33){return function(_0x3ddeac){if(_0x3ddeac){return _0x3ddeac[_0xd860('0x2b')]()[_0xd860('0x2a')](function(){_0x1cc1d2[_0xd860('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20b9a6,_0x1af087){return function(_0x300f6c){if(!_0x300f6c){_0x20b9a6[_0xd860('0x1d')](0x194);}return _0x300f6c;};}function handleError(_0x2e8616,_0x380a23){_0x380a23=_0x380a23||0x1f4;return function(_0x3b877e){logger[_0xd860('0x2c')](_0x3b877e[_0xd860('0x2d')]);if(_0x3b877e[_0xd860('0x2e')]){delete _0x3b877e[_0xd860('0x2e')];}_0x2e8616['status'](_0x380a23)[_0xd860('0x2f')](_0x3b877e);};}exports[_0xd860('0x30')]=function(_0x9b8c6b,_0x4c590a){var _0x692ccd={},_0x14370f={},_0x27f7d9={'count':0x0,'rows':[]};var _0x9371ea=_[_0xd860('0x31')](db[_0xd860('0x32')][_0xd860('0x33')],function(_0x4ea8c5){return{'name':_0x4ea8c5[_0xd860('0x34')],'type':_0x4ea8c5[_0xd860('0x35')][_0xd860('0x36')]};});_0x14370f[_0xd860('0x37')]=_[_0xd860('0x31')](_0x9371ea,_0xd860('0x2e'));_0x14370f[_0xd860('0x38')]=_[_0xd860('0x39')](_0x9b8c6b[_0xd860('0x38')]);_0x14370f[_0xd860('0x3a')]=_[_0xd860('0x3b')](_0x14370f['model'],_0x14370f['query']);_0x692ccd[_0xd860('0x3c')]=_[_0xd860('0x3b')](_0x14370f[_0xd860('0x37')],qs['fields'](_0x9b8c6b['query']['fields']));_0x692ccd[_0xd860('0x3c')]=_0x692ccd[_0xd860('0x3c')][_0xd860('0x3d')]?_0x692ccd[_0xd860('0x3c')]:_0x14370f[_0xd860('0x37')];if(!_0x9b8c6b[_0xd860('0x38')][_0xd860('0x3e')](_0xd860('0x3f'))){_0x692ccd[_0xd860('0x23')]=qs[_0xd860('0x23')](_0x9b8c6b[_0xd860('0x38')][_0xd860('0x23')]);_0x692ccd[_0xd860('0x21')]=qs[_0xd860('0x21')](_0x9b8c6b[_0xd860('0x38')][_0xd860('0x21')]);}_0x692ccd[_0xd860('0x40')]=qs[_0xd860('0x41')](_0x9b8c6b[_0xd860('0x38')][_0xd860('0x41')]);_0x692ccd[_0xd860('0x42')]=qs[_0xd860('0x3a')](_[_0xd860('0x43')](_0x9b8c6b[_0xd860('0x38')],_0x14370f[_0xd860('0x3a')]),_0x9371ea);if(_0x9b8c6b['query'][_0xd860('0x44')]){_0x692ccd['where']=_[_0xd860('0x45')](_0x692ccd[_0xd860('0x42')],{'$or':_[_0xd860('0x31')](_0x9371ea,function(_0x26d1a2){if(_0x26d1a2[_0xd860('0x35')]!==_0xd860('0x46')){var _0x464952={};_0x464952[_0x26d1a2[_0xd860('0x2e')]]={'$like':'%'+_0x9b8c6b[_0xd860('0x38')][_0xd860('0x44')]+'%'};return _0x464952;}})});}_0x692ccd=_[_0xd860('0x45')]({},_0x692ccd,_0x9b8c6b['options']);var _0x264d72={'where':_0x692ccd[_0xd860('0x42')]};return db[_0xd860('0x32')][_0xd860('0x24')](_0x264d72)[_0xd860('0x2a')](function(_0xb4204b){_0x27f7d9['count']=_0xb4204b;if(_0x9b8c6b['query'][_0xd860('0x47')]){_0x692ccd['include']=[{'all':!![]}];}return db[_0xd860('0x32')][_0xd860('0x48')](_0x692ccd);})[_0xd860('0x2a')](function(_0x4c8134){_0x27f7d9[_0xd860('0x49')]=_0x4c8134;return _0x27f7d9;})[_0xd860('0x2a')](respondWithFilteredResult(_0x4c590a,_0x692ccd))[_0xd860('0x4a')](handleError(_0x4c590a,null));};exports[_0xd860('0x4b')]=function(_0x43e195,_0x269b26){var _0x5069f6={'raw':![],'where':{'id':_0x43e195[_0xd860('0x4c')]['id']}},_0x228062={};_0x228062[_0xd860('0x37')]=_[_0xd860('0x39')](db[_0xd860('0x32')]['rawAttributes']);_0x228062[_0xd860('0x38')]=_[_0xd860('0x39')](_0x43e195[_0xd860('0x38')]);_0x228062[_0xd860('0x3a')]=_[_0xd860('0x3b')](_0x228062[_0xd860('0x37')],_0x228062[_0xd860('0x38')]);_0x5069f6[_0xd860('0x3c')]=_[_0xd860('0x3b')](_0x228062[_0xd860('0x37')],qs['fields'](_0x43e195[_0xd860('0x38')][_0xd860('0x4d')]));_0x5069f6[_0xd860('0x3c')]=_0x5069f6[_0xd860('0x3c')][_0xd860('0x3d')]?_0x5069f6[_0xd860('0x3c')]:_0x228062['model'];if(_0x43e195[_0xd860('0x38')][_0xd860('0x47')]){_0x5069f6[_0xd860('0x4e')]=[{'all':!![]}];}_0x5069f6=_['merge']({},_0x5069f6,_0x43e195[_0xd860('0x4f')]);return db[_0xd860('0x32')][_0xd860('0x50')](_0x5069f6)['then'](handleEntityNotFound(_0x269b26,null))[_0xd860('0x2a')](respondWithResult(_0x269b26,null))['catch'](handleError(_0x269b26,null));};exports[_0xd860('0x51')]=function(_0x248209,_0x35d485){return db[_0xd860('0x32')]['create'](_0x248209['body'],{})['then'](respondWithResult(_0x35d485,0xc9))[_0xd860('0x4a')](handleError(_0x35d485,null));};exports[_0xd860('0x29')]=function(_0x21679c,_0x443bfa){if(_0x21679c[_0xd860('0x52')]['id']){delete _0x21679c['body']['id'];}return db['FreshsalesAccount'][_0xd860('0x50')]({'where':{'id':_0x21679c['params']['id']}})['then'](handleEntityNotFound(_0x443bfa,null))[_0xd860('0x2a')](saveUpdates(_0x21679c[_0xd860('0x52')],null))[_0xd860('0x2a')](respondWithResult(_0x443bfa,null))[_0xd860('0x4a')](handleError(_0x443bfa,null));};exports['destroy']=function(_0x24ef3d,_0x9ae47a){return db[_0xd860('0x32')][_0xd860('0x50')]({'where':{'id':_0x24ef3d['params']['id']}})[_0xd860('0x2a')](handleEntityNotFound(_0x9ae47a,null))[_0xd860('0x2a')](removeEntity(_0x9ae47a,null))[_0xd860('0x4a')](handleError(_0x9ae47a,null));};exports[_0xd860('0x53')]=function(_0x5cb839,_0x1cb888,_0x523154){var _0x4a3c71={};var _0x30b949={};var _0x82d638;var _0x32453d;return db[_0xd860('0x32')][_0xd860('0x54')]({'where':{'id':_0x5cb839[_0xd860('0x4c')]['id']}})[_0xd860('0x2a')](handleEntityNotFound(_0x1cb888,null))[_0xd860('0x2a')](function(_0x3998ac){if(_0x3998ac){_0x82d638=_0x3998ac;_0x30b949[_0xd860('0x37')]=_['keys'](db[_0xd860('0x55')][_0xd860('0x33')]);_0x30b949[_0xd860('0x38')]=_[_0xd860('0x39')](_0x5cb839[_0xd860('0x38')]);_0x30b949[_0xd860('0x3a')]=_[_0xd860('0x3b')](_0x30b949[_0xd860('0x37')],_0x30b949[_0xd860('0x38')]);_0x4a3c71[_0xd860('0x3c')]=_['intersection'](_0x30b949[_0xd860('0x37')],qs[_0xd860('0x4d')](_0x5cb839['query'][_0xd860('0x4d')]));_0x4a3c71['attributes']=_0x4a3c71[_0xd860('0x3c')]['length']?_0x4a3c71[_0xd860('0x3c')]:_0x30b949['model'];_0x4a3c71[_0xd860('0x40')]=qs[_0xd860('0x41')](_0x5cb839[_0xd860('0x38')][_0xd860('0x41')]);_0x4a3c71[_0xd860('0x42')]=qs[_0xd860('0x3a')](_[_0xd860('0x43')](_0x5cb839['query'],_0x30b949[_0xd860('0x3a')]));if(_0x5cb839['query']['filter']){_0x4a3c71[_0xd860('0x42')]=_[_0xd860('0x45')](_0x4a3c71['where'],{'$or':_['map'](_0x4a3c71[_0xd860('0x3c')],function(_0xac2059){var _0x47e69f={};_0x47e69f[_0xac2059]={'$like':'%'+_0x5cb839[_0xd860('0x38')][_0xd860('0x44')]+'%'};return _0x47e69f;})});}_0x4a3c71=_['merge']({},_0x4a3c71,_0x5cb839[_0xd860('0x4f')]);return _0x82d638[_0xd860('0x53')](_0x4a3c71);}})['then'](function(_0x12a87f){if(_0x12a87f){_0x32453d=_0x12a87f[_0xd860('0x3d')];if(!_0x5cb839['query'][_0xd860('0x3e')](_0xd860('0x3f'))){_0x4a3c71[_0xd860('0x23')]=qs['limit'](_0x5cb839[_0xd860('0x38')][_0xd860('0x23')]);_0x4a3c71[_0xd860('0x21')]=qs['offset'](_0x5cb839['query'][_0xd860('0x21')]);}return _0x82d638[_0xd860('0x53')](_0x4a3c71);}})[_0xd860('0x2a')](function(_0x4829ef){if(_0x4829ef){return _0x4829ef?{'count':_0x32453d,'rows':_0x4829ef}:null;}})[_0xd860('0x2a')](respondWithResult(_0x1cb888,null))[_0xd860('0x4a')](handleError(_0x1cb888,null));};exports[_0xd860('0x56')]=function(_0x133da6,_0x591814,_0xa8755e){if(_0x133da6['body']['id']){delete _0x133da6[_0xd860('0x52')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x133da6['params']['id']}})[_0xd860('0x2a')](handleEntityNotFound(_0x591814,null))[_0xd860('0x2a')](function(_0x22075c){if(_0x22075c){_0x133da6[_0xd860('0x52')][_0xd860('0x57')]=_0x22075c['id'];_0x133da6[_0xd860('0x52')][_0xd860('0x58')]=integrations['getSubjects'](_0x133da6[_0xd860('0x52')][_0xd860('0x59')],_0x133da6['body']['type']);_0x133da6[_0xd860('0x52')]['Descriptions']=integrations[_0xd860('0x5a')](_0x133da6[_0xd860('0x52')]['channel'],_0x133da6[_0xd860('0x52')][_0xd860('0x35')]);return db[_0xd860('0x55')][_0xd860('0x51')](_0x133da6['body'],{'include':[{'model':db[_0xd860('0x5b')],'as':'Subjects'},{'model':db[_0xd860('0x5b')],'as':_0xd860('0x5c')}]});}return null;})['then'](respondWithResult(_0x591814,null))[_0xd860('0x4a')](handleError(_0x591814,null));};exports['getFields']=function(_0x5199ca,_0xcdb435,_0x1aeff2){var _0x78c556='';var _0x3e52df='';return db[_0xd860('0x32')][_0xd860('0x54')]({'where':{'id':_0x5199ca[_0xd860('0x4c')]['id']},'attributes':['id',_0xd860('0x5d'),_0xd860('0x5e'),_0xd860('0x5f')]})[_0xd860('0x2a')](handleEntityNotFound(_0xcdb435,null))[_0xd860('0x2a')](function(_0x4964c8){if(_0x4964c8){_0x3e52df=_0x4964c8[_0xd860('0x5d')];_0x78c556=_0x4964c8[_0xd860('0x5e')];var _0xed3e42=_0x4964c8['remoteUri'][_0xd860('0x60')](-0x1);if(_0xed3e42==='/'){_0x78c556=_0x78c556[_0xd860('0x61')](0x0,_0x78c556[_0xd860('0x62')](_0xed3e42));}return rp({'method':_0xd860('0x63'),'uri':util['format'](_0xd860('0x64'),_0x78c556,_0xd860('0x65')),'headers':{'Authorization':_0xd860('0x66')+_0x4964c8[_0xd860('0x5f')]},'json':!![]});}})['then'](function(_0xfdccde){if(_0xfdccde){var _0x59e3a6=_0xfdccde[_0xd860('0x67')];var _0x18c159=![];var _0x1b051e=null;for(_0x1b051e=0x0;_0x1b051e<_0x59e3a6['length'];_0x1b051e++){if(_0x59e3a6[_0x1b051e][_0xd860('0x68')]===_0x3e52df){_0x18c159=!![];}}if(_0x18c159){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd860('0x69')});}}})['then'](respondWithResult(_0xcdb435,null))[_0xd860('0x4a')](function(_0x3d3306){var _0x3fbf85=_0x5199ca[_0xd860('0x38')][_0xd860('0x6a')]?0x1f4:_0x3d3306[_0xd860('0x6b')]||0x1f4;logger['error'](_0xd860('0x6c'),_0xd860('0x6d'),_0x3fbf85,JSON[_0xd860('0x6e')](_0x3d3306));delete _0x3d3306[_0xd860('0x2e')];if(_0x3fbf85===0x191){_0x3fbf85=0x190;}_0xcdb435['status'](_0x3fbf85)[_0xd860('0x2f')](_0x5199ca[_0xd860('0x38')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x3d3306[_0xd860('0x6b')]}:_0x3d3306);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 52d586a..d892e62 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 _0x5496=['util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','FreshsalesAccount','int_freshsales_accounts','lodash'];(function(_0x5c5c52,_0x36d085){var _0x4229ff=function(_0x3806df){while(--_0x3806df){_0x5c5c52['push'](_0x5c5c52['shift']());}};_0x4229ff(++_0x36d085);}(_0x5496,0x175));var _0x6549=function(_0x117968,_0x423cb4){_0x117968=_0x117968-0x0;var _0xcc4a4d=_0x5496[_0x117968];return _0xcc4a4d;};'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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x43cb17,_0x1d8cea){return _0x43cb17['define'](_0x6549('0x9'),attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb016=['../../components/integrations/configuration','exports','FreshsalesAccount','int_freshsales_accounts','lodash','util','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x4e36e1,_0x40ed74){var _0x400a2b=function(_0x2c6faf){while(--_0x2c6faf){_0x4e36e1['push'](_0x4e36e1['shift']());}};_0x400a2b(++_0x40ed74);}(_0xb016,0x159));var _0x6b01=function(_0x556cdf,_0xb9d3c){_0x556cdf=_0x556cdf-0x0;var _0x327aac=_0xb016[_0x556cdf];return _0x327aac;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6b01('0x2'));var BPromise=require('bluebird');var rp=require(_0x6b01('0x3'));var fs=require('fs');var path=require(_0x6b01('0x4'));var rimraf=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x6b01('0x7'));module[_0x6b01('0x8')]=function(_0x192b2d,_0x5759a1){return _0x192b2d['define'](_0x6b01('0x9'),attributes,{'tableName':_0x6b01('0xa'),'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 3975340..b9c0300 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 _0xba34=['request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesAccount,\x20%s,\x20%s'];(function(_0x3f06d9,_0xa5f172){var _0x4f32a6=function(_0x2a8597){while(--_0x2a8597){_0x3f06d9['push'](_0x3f06d9['shift']());}};_0x4f32a6(++_0xa5f172);}(_0xba34,0x119));var _0x4ba3=function(_0x3ad908,_0x8cf108){_0x3ad908=_0x3ad908-0x0;var _0x3da4fe=_0xba34[_0x3ad908];return _0x3da4fe;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});}exports[_0x4ba3('0x18')]=function(_0x5ff7ce){var _0x451c92=this;return new Promise(function(_0x556290,_0x2519bb){return db[_0x4ba3('0x19')][_0x4ba3('0x1a')]({'raw':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ff7ce['options']?_0x5ff7ce['options'][_0x4ba3('0x1d')]||null:null,'attributes':_0x5ff7ce['options']?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1e')]||null:null,'limit':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce[_0x4ba3('0x1b')][_0x4ba3('0x1f')]||null:null,'include':_0x5ff7ce[_0x4ba3('0x1b')]?_0x5ff7ce['options'][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x5ff7ce['options'][_0x4ba3('0x20')],function(_0x4ffe39){return{'model':db[_0x4ffe39[_0x4ba3('0x22')]],'as':_0x4ffe39['as'],'attributes':_0x4ffe39[_0x4ba3('0x1e')],'include':_0x4ffe39[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x4ffe39[_0x4ba3('0x20')],function(_0xe29a49){return{'model':db[_0xe29a49[_0x4ba3('0x22')]],'as':_0xe29a49['as'],'attributes':_0xe29a49[_0x4ba3('0x1e')],'include':_0xe29a49[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0xe29a49['include'],function(_0x252f37){return{'model':db[_0x252f37[_0x4ba3('0x22')]],'as':_0x252f37['as'],'attributes':_0x252f37[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10537e){logger[_0x4ba3('0xd')](_0x4ba3('0x18'),_0x5ff7ce);logger['debug'](_0x4ba3('0x18'),_0x5ff7ce,JSON[_0x4ba3('0x12')](_0x10537e));_0x556290(_0x10537e);})[_0x4ba3('0x17')](function(_0x22394d){logger['error']('GetFreshsalesAccount',_0x22394d[_0x4ba3('0x15')],_0x5ff7ce);_0x2519bb(_0x451c92[_0x4ba3('0x13')](0x1f4,_0x22394d[_0x4ba3('0x15')]));});});};exports[_0x4ba3('0x23')]=function(_0x2cb5d5){var _0x11f88f=this;return new Promise(function(_0x48b3b7,_0x27444b){return db[_0x4ba3('0x19')][_0x4ba3('0x24')]({'raw':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x1c')]===undefined?!![]:![]:!![],'where':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x1d')]||null:null,'attributes':_0x2cb5d5[_0x4ba3('0x1b')]?_0x2cb5d5['options']['attributes']||null:null,'include':_0x2cb5d5['options']?_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x2cb5d5[_0x4ba3('0x1b')][_0x4ba3('0x20')],function(_0x137f9b){return{'model':db[_0x137f9b[_0x4ba3('0x22')]],'as':_0x137f9b['as'],'attributes':_0x137f9b[_0x4ba3('0x1e')],'include':_0x137f9b[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x137f9b[_0x4ba3('0x20')],function(_0x3439cb){return{'model':db[_0x3439cb['model']],'as':_0x3439cb['as'],'attributes':_0x3439cb[_0x4ba3('0x1e')],'include':_0x3439cb[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x3439cb['include'],function(_0x188f8c){return{'model':db[_0x188f8c['model']],'as':_0x188f8c['as'],'attributes':_0x188f8c[_0x4ba3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0xc')](function(_0x426e11){logger[_0x4ba3('0xd')](_0x4ba3('0x23'),_0x2cb5d5);logger[_0x4ba3('0x10')]('ShowFreshsalesAccount',_0x2cb5d5,JSON[_0x4ba3('0x12')](_0x426e11));_0x48b3b7(_0x426e11);})[_0x4ba3('0x17')](function(_0x2e77d4){logger['error'](_0x4ba3('0x23'),_0x2e77d4[_0x4ba3('0x15')],_0x2cb5d5);_0x27444b(_0x11f88f['error'](0x1f4,_0x2e77d4[_0x4ba3('0x15')]));});});}; \ No newline at end of file +var _0xa46e=['model','attributes','GetFreshsalesAccount','ShowFreshsalesAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','message','FreshsalesAccount,\x20%s,\x20%s','info','result','catch','FreshsalesAccount','findAll','options','raw','include','map'];(function(_0x46cc19,_0x47e952){var _0x4fb02b=function(_0x3e366b){while(--_0x3e366b){_0x46cc19['push'](_0x46cc19['shift']());}};_0x4fb02b(++_0x47e952);}(_0xa46e,0x8a));var _0xea46=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0xa46e[_0x19babd];return _0x314eaf;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var moment=require('moment');var BPromise=require(_0xea46('0x2'));var rs=require(_0xea46('0x3'));var fs=require('fs');var Redis=require(_0xea46('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xea46('0x5'));var logger=require('../../config/logger')(_0xea46('0x6'));var config=require('../../config/environment');var jayson=require(_0xea46('0x7'));var client=jayson['client'][_0xea46('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dc26f,_0x5f1cd1,_0x2d1b30){return new BPromise(function(_0x42771a,_0xe7d428){return client[_0xea46('0x9')](_0x3dc26f,_0x2d1b30)[_0xea46('0xa')](function(_0x4cf206){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'));logger[_0xea46('0xc')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x5f1cd1,_0xea46('0xb'),JSON[_0xea46('0xd')](_0x4cf206));if(_0x4cf206[_0xea46('0xe')]){if(_0x4cf206['error'][_0xea46('0xf')]===0x1f4){logger[_0xea46('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0xe7d428(_0x4cf206['error'][_0xea46('0x10')]);}logger['error'](_0xea46('0x11'),_0x5f1cd1,_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);return _0x42771a(_0x4cf206[_0xea46('0xe')][_0xea46('0x10')]);}else{logger[_0xea46('0x12')](_0xea46('0x11'),_0x5f1cd1,_0xea46('0xb'));_0x42771a(_0x4cf206[_0xea46('0x13')]['message']);}})[_0xea46('0x14')](function(_0xbf225e){logger[_0xea46('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x5f1cd1,_0xbf225e);_0xe7d428(_0xbf225e);});});}exports['GetFreshsalesAccount']=function(_0x19d5c1){var _0x3f463d=this;return new Promise(function(_0x5cf5dd,_0x4b6745){return db[_0xea46('0x15')][_0xea46('0x16')]({'raw':_0x19d5c1['options']?_0x19d5c1[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![],'where':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1[_0xea46('0x17')]['where']||null:null,'attributes':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1['options']['attributes']||null:null,'limit':_0x19d5c1[_0xea46('0x17')]?_0x19d5c1['options']['limit']||null:null,'include':_0x19d5c1['options']?_0x19d5c1[_0xea46('0x17')][_0xea46('0x19')]?_[_0xea46('0x1a')](_0x19d5c1['options'][_0xea46('0x19')],function(_0x59b10d){return{'model':db[_0x59b10d[_0xea46('0x1b')]],'as':_0x59b10d['as'],'attributes':_0x59b10d[_0xea46('0x1c')],'include':_0x59b10d['include']?_[_0xea46('0x1a')](_0x59b10d['include'],function(_0x2b3a8f){return{'model':db[_0x2b3a8f[_0xea46('0x1b')]],'as':_0x2b3a8f['as'],'attributes':_0x2b3a8f[_0xea46('0x1c')],'include':_0x2b3a8f['include']?_['map'](_0x2b3a8f[_0xea46('0x19')],function(_0x38ac07){return{'model':db[_0x38ac07['model']],'as':_0x38ac07['as'],'attributes':_0x38ac07[_0xea46('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11129d){logger['info'](_0xea46('0x1d'),_0x19d5c1);logger[_0xea46('0xc')](_0xea46('0x1d'),_0x19d5c1,JSON[_0xea46('0xd')](_0x11129d));_0x5cf5dd(_0x11129d);})[_0xea46('0x14')](function(_0x174345){logger['error'](_0xea46('0x1d'),_0x174345[_0xea46('0x10')],_0x19d5c1);_0x4b6745(_0x3f463d[_0xea46('0xe')](0x1f4,_0x174345['message']));});});};exports[_0xea46('0x1e')]=function(_0x3cdf96){var _0x38d631=this;return new Promise(function(_0x5a0fc0,_0x4a0635){return db['FreshsalesAccount'][_0xea46('0x1f')]({'raw':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96[_0xea46('0x17')][_0xea46('0x18')]===undefined?!![]:![]:!![],'where':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96[_0xea46('0x17')][_0xea46('0x20')]||null:null,'attributes':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96[_0xea46('0x17')][_0xea46('0x1c')]||null:null,'include':_0x3cdf96[_0xea46('0x17')]?_0x3cdf96['options'][_0xea46('0x19')]?_[_0xea46('0x1a')](_0x3cdf96[_0xea46('0x17')][_0xea46('0x19')],function(_0x1472c0){return{'model':db[_0x1472c0[_0xea46('0x1b')]],'as':_0x1472c0['as'],'attributes':_0x1472c0[_0xea46('0x1c')],'include':_0x1472c0['include']?_[_0xea46('0x1a')](_0x1472c0[_0xea46('0x19')],function(_0x388449){return{'model':db[_0x388449[_0xea46('0x1b')]],'as':_0x388449['as'],'attributes':_0x388449[_0xea46('0x1c')],'include':_0x388449['include']?_['map'](_0x388449[_0xea46('0x19')],function(_0x343499){return{'model':db[_0x343499['model']],'as':_0x343499['as'],'attributes':_0x343499[_0xea46('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xea46('0xa')](function(_0x123aae){logger[_0xea46('0x12')]('ShowFreshsalesAccount',_0x3cdf96);logger['debug'](_0xea46('0x1e'),_0x3cdf96,JSON['stringify'](_0x123aae));_0x5a0fc0(_0x123aae);})[_0xea46('0x14')](function(_0xdec374){logger['error'](_0xea46('0x1e'),_0xdec374[_0xea46('0x10')],_0x3cdf96);_0x4a0635(_0x38d631['error'](0x1f4,_0xdec374[_0xea46('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index a947560..640573d 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 _0x5ae7=['post','create','put','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5ae7,0x7e));var _0x75ae=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x5ae7[_0x525c7b];return _0x27b33e;};'use strict';var multer=require(_0x75ae('0x0'));var util=require(_0x75ae('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75ae('0x2'));var router=express[_0x75ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x75ae('0x4'));var interaction=require(_0x75ae('0x5'));var config=require(_0x75ae('0x6'));var controller=require(_0x75ae('0x7'));router[_0x75ae('0x8')]('/',auth[_0x75ae('0x9')](),controller['index']);router[_0x75ae('0x8')](_0x75ae('0xa'),auth[_0x75ae('0x9')](),controller[_0x75ae('0xb')]);router[_0x75ae('0x8')](_0x75ae('0xc'),auth[_0x75ae('0x9')](),controller[_0x75ae('0xd')]);router['get'](_0x75ae('0xe'),auth[_0x75ae('0x9')](),controller[_0x75ae('0xf')]);router['get'](_0x75ae('0x10'),auth[_0x75ae('0x9')](),controller[_0x75ae('0x11')]);router[_0x75ae('0x12')]('/',auth[_0x75ae('0x9')](),controller[_0x75ae('0x13')]);router[_0x75ae('0x14')](_0x75ae('0xa'),auth[_0x75ae('0x9')](),controller['update']);router[_0x75ae('0x15')](_0x75ae('0xa'),auth[_0x75ae('0x9')](),controller[_0x75ae('0x16')]);module[_0x75ae('0x17')]=router; \ No newline at end of file +var _0x5251=['path','express','Router','fs-extra','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','post','create','update','delete','exports','multer'];(function(_0x52c168,_0x99d88e){var _0x40cb2e=function(_0x2facde){while(--_0x2facde){_0x52c168['push'](_0x52c168['shift']());}};_0x40cb2e(++_0x99d88e);}(_0x5251,0x13a));var _0x1525=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5251[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x1525('0x0'));var util=require('util');var path=require(_0x1525('0x1'));var timeout=require('connect-timeout');var express=require(_0x1525('0x2'));var router=express[_0x1525('0x3')]();var fs_extra=require(_0x1525('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1525('0x5'));var controller=require(_0x1525('0x6'));router[_0x1525('0x7')]('/',auth[_0x1525('0x8')](),controller[_0x1525('0x9')]);router[_0x1525('0x7')](_0x1525('0xa'),auth[_0x1525('0x8')](),controller[_0x1525('0xb')]);router[_0x1525('0x7')](_0x1525('0xc'),auth['isAuthenticated'](),controller[_0x1525('0xd')]);router[_0x1525('0x7')](_0x1525('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x1525('0x7')](_0x1525('0xf'),auth[_0x1525('0x8')](),controller['getFields']);router[_0x1525('0x10')]('/',auth['isAuthenticated'](),controller[_0x1525('0x11')]);router['put']('/:id',auth[_0x1525('0x8')](),controller[_0x1525('0x12')]);router[_0x1525('0x13')](_0x1525('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1525('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 6aae967..d580c0c 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 _0xd019=['exports','STRING','sequelize'];(function(_0x5e8460,_0x2003b5){var _0x3d50fd=function(_0x4c499f){while(--_0x4c499f){_0x5e8460['push'](_0x5e8460['shift']());}};_0x3d50fd(++_0x2003b5);}(_0xd019,0x92));var _0x9d01=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xd019[_0x1db251];return _0x56685a;};'use strict';var Sequelize=require(_0x9d01('0x0'));module[_0x9d01('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9d01('0x2')]}}; \ No newline at end of file +var _0x7406=['exports','STRING'];(function(_0x2f4909,_0x3e5657){var _0x3545c8=function(_0x3ffbb){while(--_0x3ffbb){_0x2f4909['push'](_0x2f4909['shift']());}};_0x3545c8(++_0x3e5657);}(_0x7406,0x146));var _0x6740=function(_0x3cc4c8,_0x114636){_0x3cc4c8=_0x3cc4c8-0x0;var _0xdc0123=_0x7406[_0x3cc4c8];return _0xdc0123;};'use strict';var Sequelize=require('sequelize');module[_0x6740('0x0')]={'name':{'type':Sequelize[_0x6740('0x1')]},'description':{'type':Sequelize[_0x6740('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index ac5b6df..382dd09 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 _0x3ed2=['destroy','sendStatus','error','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','filter','type','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','findOne','FreshsalesField','pick','getSubjects','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','status','end','json','offset','undefined','Content-Range','apply','reject','update','then'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x3ed2,0x7b));var _0x23ed=function(_0x4b8df0,_0x5c59f1){_0x4b8df0=_0x4b8df0-0x0;var _0x2ad3fe=_0x3ed2[_0x4b8df0];return _0x2ad3fe;};'use strict';var emlformat=require(_0x23ed('0x0'));var rimraf=require(_0x23ed('0x1'));var zipdir=require(_0x23ed('0x2'));var jsonpatch=require(_0x23ed('0x3'));var rp=require(_0x23ed('0x4'));var moment=require(_0x23ed('0x5'));var BPromise=require(_0x23ed('0x6'));var Mustache=require(_0x23ed('0x7'));var util=require('util');var path=require(_0x23ed('0x8'));var sox=require(_0x23ed('0x9'));var csv=require(_0x23ed('0xa'));var ejs=require(_0x23ed('0xb'));var fs=require('fs');var fs_extra=require(_0x23ed('0xc'));var _=require('lodash');var squel=require(_0x23ed('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x23ed('0xe'));var toCsv=require(_0x23ed('0xa'));var querystring=require(_0x23ed('0xf'));var Papa=require('papaparse');var Redis=require(_0x23ed('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x23ed('0x11'));var as=require(_0x23ed('0x12'));var hardwareService=require(_0x23ed('0x13'));var logger=require(_0x23ed('0x14'))(_0x23ed('0x15'));var utils=require('../../config/utils');var config=require(_0x23ed('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x238e52,_0x15369b){_0x15369b=_0x15369b||0xcc;return function(_0x476c59){if(_0x476c59){return _0x238e52['sendStatus'](_0x15369b);}return _0x238e52[_0x23ed('0x17')](_0x15369b)[_0x23ed('0x18')]();};}function respondWithResult(_0x202070,_0x5ac177){_0x5ac177=_0x5ac177||0xc8;return function(_0x3d6c45){if(_0x3d6c45){return _0x202070[_0x23ed('0x17')](_0x5ac177)[_0x23ed('0x19')](_0x3d6c45);}};}function respondWithFilteredResult(_0x3967f7,_0x323212){return function(_0x432f31){if(_0x432f31){var _0x2bf83f=typeof _0x323212[_0x23ed('0x1a')]===_0x23ed('0x1b')&&typeof _0x323212['limit']===_0x23ed('0x1b');var _0x496045=_0x432f31['count'];var _0x333a14=_0x2bf83f?0x0:_0x323212[_0x23ed('0x1a')];var _0x3c82cd=_0x2bf83f?_0x432f31['count']:_0x323212['offset']+_0x323212['limit'];var _0x7d694f;if(_0x3c82cd>=_0x496045){_0x3c82cd=_0x496045;_0x7d694f=0xc8;}else{_0x7d694f=0xce;}_0x3967f7['status'](_0x7d694f);return _0x3967f7['set'](_0x23ed('0x1c'),_0x333a14+'-'+_0x3c82cd+'/'+_0x496045)[_0x23ed('0x19')](_0x432f31);}return null;};}function patchUpdates(_0xc40135){return function(_0x19e4e7){try{jsonpatch[_0x23ed('0x1d')](_0x19e4e7,_0xc40135,!![]);}catch(_0x2f1204){return BPromise[_0x23ed('0x1e')](_0x2f1204);}return _0x19e4e7['save']();};}function saveUpdates(_0x3762e5,_0x19ccc5){return function(_0x4723da){if(_0x4723da){return _0x4723da[_0x23ed('0x1f')](_0x3762e5)[_0x23ed('0x20')](function(_0x16e230){return _0x16e230;});}return null;};}function removeEntity(_0xc38700,_0xe6f57b){return function(_0x576f9b){if(_0x576f9b){return _0x576f9b[_0x23ed('0x21')]()['then'](function(){_0xc38700['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x27f88d,_0x1e14fb){return function(_0x3024b4){if(!_0x3024b4){_0x27f88d[_0x23ed('0x22')](0x194);}return _0x3024b4;};}function handleError(_0x57c51e,_0x75f142){_0x75f142=_0x75f142||0x1f4;return function(_0x2f1d01){logger[_0x23ed('0x23')](_0x2f1d01['stack']);if(_0x2f1d01[_0x23ed('0x24')]){delete _0x2f1d01[_0x23ed('0x24')];}_0x57c51e[_0x23ed('0x17')](_0x75f142)[_0x23ed('0x25')](_0x2f1d01);};}exports['index']=function(_0x15f42e,_0x40b553){var _0x4b4eaa={},_0x8a1dad={},_0xc18e77={'count':0x0,'rows':[]};var _0x84b65d=_[_0x23ed('0x26')](db[_0x23ed('0x27')][_0x23ed('0x28')],function(_0x220fb7){return{'name':_0x220fb7[_0x23ed('0x29')],'type':_0x220fb7['type'][_0x23ed('0x2a')]};});_0x8a1dad[_0x23ed('0x2b')]=_[_0x23ed('0x26')](_0x84b65d,_0x23ed('0x24'));_0x8a1dad[_0x23ed('0x2c')]=_['keys'](_0x15f42e[_0x23ed('0x2c')]);_0x8a1dad['filters']=_['intersection'](_0x8a1dad[_0x23ed('0x2b')],_0x8a1dad[_0x23ed('0x2c')]);_0x4b4eaa['attributes']=_[_0x23ed('0x2d')](_0x8a1dad[_0x23ed('0x2b')],qs[_0x23ed('0x2e')](_0x15f42e[_0x23ed('0x2c')][_0x23ed('0x2e')]));_0x4b4eaa[_0x23ed('0x2f')]=_0x4b4eaa[_0x23ed('0x2f')][_0x23ed('0x30')]?_0x4b4eaa[_0x23ed('0x2f')]:_0x8a1dad[_0x23ed('0x2b')];if(!_0x15f42e[_0x23ed('0x2c')][_0x23ed('0x31')](_0x23ed('0x32'))){_0x4b4eaa[_0x23ed('0x33')]=qs[_0x23ed('0x33')](_0x15f42e[_0x23ed('0x2c')][_0x23ed('0x33')]);_0x4b4eaa[_0x23ed('0x1a')]=qs[_0x23ed('0x1a')](_0x15f42e['query']['offset']);}_0x4b4eaa[_0x23ed('0x34')]=qs[_0x23ed('0x35')](_0x15f42e[_0x23ed('0x2c')][_0x23ed('0x35')]);_0x4b4eaa[_0x23ed('0x36')]=qs[_0x23ed('0x37')](_['pick'](_0x15f42e[_0x23ed('0x2c')],_0x8a1dad[_0x23ed('0x37')]),_0x84b65d);if(_0x15f42e[_0x23ed('0x2c')][_0x23ed('0x38')]){_0x4b4eaa[_0x23ed('0x36')]=_['merge'](_0x4b4eaa[_0x23ed('0x36')],{'$or':_[_0x23ed('0x26')](_0x84b65d,function(_0x37678d){if(_0x37678d[_0x23ed('0x39')]!=='VIRTUAL'){var _0x483681={};_0x483681[_0x37678d[_0x23ed('0x24')]]={'$like':'%'+_0x15f42e['query']['filter']+'%'};return _0x483681;}})});}_0x4b4eaa=_[_0x23ed('0x3a')]({},_0x4b4eaa,_0x15f42e[_0x23ed('0x3b')]);var _0x235024={'where':_0x4b4eaa[_0x23ed('0x36')]};return db[_0x23ed('0x27')][_0x23ed('0x3c')](_0x235024)[_0x23ed('0x20')](function(_0x4251c0){_0xc18e77[_0x23ed('0x3c')]=_0x4251c0;if(_0x15f42e['query'][_0x23ed('0x3d')]){_0x4b4eaa[_0x23ed('0x3e')]=[{'all':!![]}];}return db[_0x23ed('0x27')][_0x23ed('0x3f')](_0x4b4eaa);})[_0x23ed('0x20')](function(_0x57e1e8){_0xc18e77[_0x23ed('0x40')]=_0x57e1e8;return _0xc18e77;})[_0x23ed('0x20')](respondWithFilteredResult(_0x40b553,_0x4b4eaa))[_0x23ed('0x41')](handleError(_0x40b553,null));};exports[_0x23ed('0x42')]=function(_0xd9a721,_0x1a4fcd){var _0x2f3478={'raw':![],'where':{'id':_0xd9a721[_0x23ed('0x43')]['id']}},_0x49b9b4={};_0x49b9b4['model']=_[_0x23ed('0x44')](db[_0x23ed('0x27')][_0x23ed('0x28')]);_0x49b9b4[_0x23ed('0x2c')]=_[_0x23ed('0x44')](_0xd9a721['query']);_0x49b9b4[_0x23ed('0x37')]=_['intersection'](_0x49b9b4[_0x23ed('0x2b')],_0x49b9b4[_0x23ed('0x2c')]);_0x2f3478[_0x23ed('0x2f')]=_['intersection'](_0x49b9b4[_0x23ed('0x2b')],qs[_0x23ed('0x2e')](_0xd9a721[_0x23ed('0x2c')][_0x23ed('0x2e')]));_0x2f3478[_0x23ed('0x2f')]=_0x2f3478[_0x23ed('0x2f')]['length']?_0x2f3478[_0x23ed('0x2f')]:_0x49b9b4['model'];if(_0xd9a721[_0x23ed('0x2c')][_0x23ed('0x3d')]){_0x2f3478[_0x23ed('0x3e')]=[{'all':!![]}];}_0x2f3478=_[_0x23ed('0x3a')]({},_0x2f3478,_0xd9a721[_0x23ed('0x3b')]);return db[_0x23ed('0x27')][_0x23ed('0x45')](_0x2f3478)[_0x23ed('0x20')](handleEntityNotFound(_0x1a4fcd,null))[_0x23ed('0x20')](respondWithResult(_0x1a4fcd,null))['catch'](handleError(_0x1a4fcd,null));};exports[_0x23ed('0x46')]=function(_0x23da80,_0x345e60){return db[_0x23ed('0x27')][_0x23ed('0x46')](_0x23da80[_0x23ed('0x47')],{})[_0x23ed('0x20')](respondWithResult(_0x345e60,0xc9))[_0x23ed('0x41')](handleError(_0x345e60,null));};exports[_0x23ed('0x1f')]=function(_0x28fa0c,_0x4202da){if(_0x28fa0c[_0x23ed('0x47')]['id']){delete _0x28fa0c[_0x23ed('0x47')]['id'];}return db[_0x23ed('0x27')][_0x23ed('0x45')]({'where':{'id':_0x28fa0c[_0x23ed('0x43')]['id']}})['then'](handleEntityNotFound(_0x4202da,null))[_0x23ed('0x20')](saveUpdates(_0x28fa0c['body'],null))[_0x23ed('0x20')](respondWithResult(_0x4202da,null))[_0x23ed('0x41')](handleError(_0x4202da,null));};exports[_0x23ed('0x21')]=function(_0x210e55,_0xc1d50d){return db[_0x23ed('0x27')][_0x23ed('0x45')]({'where':{'id':_0x210e55['params']['id']}})[_0x23ed('0x20')](handleEntityNotFound(_0xc1d50d,null))['then'](removeEntity(_0xc1d50d,null))[_0x23ed('0x41')](handleError(_0xc1d50d,null));};exports['getSubjects']=function(_0x453ca3,_0x47b6f6,_0x4afde8){var _0x4186b5={};var _0xc64e30={};var _0x99d0ff;var _0x4d65eb;return db[_0x23ed('0x27')][_0x23ed('0x48')]({'where':{'id':_0x453ca3[_0x23ed('0x43')]['id']}})[_0x23ed('0x20')](handleEntityNotFound(_0x47b6f6,null))[_0x23ed('0x20')](function(_0x2268a3){if(_0x2268a3){_0x99d0ff=_0x2268a3;_0xc64e30[_0x23ed('0x2b')]=_[_0x23ed('0x44')](db[_0x23ed('0x49')]['rawAttributes']);_0xc64e30['query']=_[_0x23ed('0x44')](_0x453ca3[_0x23ed('0x2c')]);_0xc64e30[_0x23ed('0x37')]=_[_0x23ed('0x2d')](_0xc64e30[_0x23ed('0x2b')],_0xc64e30[_0x23ed('0x2c')]);_0x4186b5[_0x23ed('0x2f')]=_[_0x23ed('0x2d')](_0xc64e30[_0x23ed('0x2b')],qs[_0x23ed('0x2e')](_0x453ca3[_0x23ed('0x2c')][_0x23ed('0x2e')]));_0x4186b5[_0x23ed('0x2f')]=_0x4186b5['attributes'][_0x23ed('0x30')]?_0x4186b5[_0x23ed('0x2f')]:_0xc64e30[_0x23ed('0x2b')];_0x4186b5[_0x23ed('0x34')]=qs[_0x23ed('0x35')](_0x453ca3[_0x23ed('0x2c')][_0x23ed('0x35')]);_0x4186b5[_0x23ed('0x36')]=qs[_0x23ed('0x37')](_[_0x23ed('0x4a')](_0x453ca3['query'],_0xc64e30[_0x23ed('0x37')]));if(_0x453ca3[_0x23ed('0x2c')][_0x23ed('0x38')]){_0x4186b5['where']=_['merge'](_0x4186b5['where'],{'$or':_[_0x23ed('0x26')](_0x4186b5[_0x23ed('0x2f')],function(_0x530d20){var _0x4f093d={};_0x4f093d[_0x530d20]={'$like':'%'+_0x453ca3[_0x23ed('0x2c')][_0x23ed('0x38')]+'%'};return _0x4f093d;})});}_0x4186b5=_[_0x23ed('0x3a')]({},_0x4186b5,_0x453ca3[_0x23ed('0x3b')]);return _0x99d0ff[_0x23ed('0x4b')](_0x4186b5);}})[_0x23ed('0x20')](function(_0x8146b3){if(_0x8146b3){_0x4d65eb=_0x8146b3[_0x23ed('0x30')];if(!_0x453ca3['query']['hasOwnProperty'](_0x23ed('0x32'))){_0x4186b5[_0x23ed('0x33')]=qs[_0x23ed('0x33')](_0x453ca3[_0x23ed('0x2c')][_0x23ed('0x33')]);_0x4186b5[_0x23ed('0x1a')]=qs[_0x23ed('0x1a')](_0x453ca3[_0x23ed('0x2c')][_0x23ed('0x1a')]);}return _0x99d0ff[_0x23ed('0x4b')](_0x4186b5);}})[_0x23ed('0x20')](function(_0xa980b1){if(_0xa980b1){return _0xa980b1?{'count':_0x4d65eb,'rows':_0xa980b1}:null;}})['then'](respondWithResult(_0x47b6f6,null))[_0x23ed('0x41')](handleError(_0x47b6f6,null));};exports['getDescriptions']=function(_0x170147,_0x20a93a,_0x44a29b){var _0x5ac05e={};var _0x4f30b7={};var _0x305515;var _0x4daae3;return db[_0x23ed('0x27')][_0x23ed('0x48')]({'where':{'id':_0x170147[_0x23ed('0x43')]['id']}})['then'](handleEntityNotFound(_0x20a93a,null))[_0x23ed('0x20')](function(_0x5e5ac7){if(_0x5e5ac7){_0x305515=_0x5e5ac7;_0x4f30b7['model']=_[_0x23ed('0x44')](db['FreshsalesField']['rawAttributes']);_0x4f30b7[_0x23ed('0x2c')]=_['keys'](_0x170147[_0x23ed('0x2c')]);_0x4f30b7[_0x23ed('0x37')]=_[_0x23ed('0x2d')](_0x4f30b7[_0x23ed('0x2b')],_0x4f30b7['query']);_0x5ac05e['attributes']=_[_0x23ed('0x2d')](_0x4f30b7[_0x23ed('0x2b')],qs[_0x23ed('0x2e')](_0x170147[_0x23ed('0x2c')]['fields']));_0x5ac05e[_0x23ed('0x2f')]=_0x5ac05e['attributes'][_0x23ed('0x30')]?_0x5ac05e['attributes']:_0x4f30b7['model'];_0x5ac05e[_0x23ed('0x34')]=qs[_0x23ed('0x35')](_0x170147['query']['sort']);_0x5ac05e[_0x23ed('0x36')]=qs[_0x23ed('0x37')](_['pick'](_0x170147['query'],_0x4f30b7[_0x23ed('0x37')]));if(_0x170147[_0x23ed('0x2c')][_0x23ed('0x38')]){_0x5ac05e[_0x23ed('0x36')]=_[_0x23ed('0x3a')](_0x5ac05e[_0x23ed('0x36')],{'$or':_[_0x23ed('0x26')](_0x5ac05e[_0x23ed('0x2f')],function(_0x4743bc){var _0x21440a={};_0x21440a[_0x4743bc]={'$like':'%'+_0x170147[_0x23ed('0x2c')][_0x23ed('0x38')]+'%'};return _0x21440a;})});}_0x5ac05e=_[_0x23ed('0x3a')]({},_0x5ac05e,_0x170147[_0x23ed('0x3b')]);return _0x305515['getDescriptions'](_0x5ac05e);}})[_0x23ed('0x20')](function(_0x3fedff){if(_0x3fedff){_0x4daae3=_0x3fedff[_0x23ed('0x30')];if(!_0x170147[_0x23ed('0x2c')][_0x23ed('0x31')](_0x23ed('0x32'))){_0x5ac05e[_0x23ed('0x33')]=qs[_0x23ed('0x33')](_0x170147['query']['limit']);_0x5ac05e[_0x23ed('0x1a')]=qs[_0x23ed('0x1a')](_0x170147[_0x23ed('0x2c')]['offset']);}return _0x305515[_0x23ed('0x4c')](_0x5ac05e);}})[_0x23ed('0x20')](function(_0x277e31){if(_0x277e31){return _0x277e31?{'count':_0x4daae3,'rows':_0x277e31}:null;}})[_0x23ed('0x20')](respondWithResult(_0x20a93a,null))[_0x23ed('0x41')](handleError(_0x20a93a,null));};exports[_0x23ed('0x4d')]=function(_0x2bf7e1,_0x5ba22e,_0x108788){var _0xbb757b={};var _0x186293={};var _0x79a2ce;var _0x445f4d;return db[_0x23ed('0x27')]['findOne']({'where':{'id':_0x2bf7e1['params']['id']}})[_0x23ed('0x20')](handleEntityNotFound(_0x5ba22e,null))[_0x23ed('0x20')](function(_0x105cec){if(_0x105cec){_0x79a2ce=_0x105cec;_0x186293[_0x23ed('0x2b')]=_['keys'](db[_0x23ed('0x49')][_0x23ed('0x28')]);_0x186293[_0x23ed('0x2c')]=_[_0x23ed('0x44')](_0x2bf7e1[_0x23ed('0x2c')]);_0x186293[_0x23ed('0x37')]=_[_0x23ed('0x2d')](_0x186293[_0x23ed('0x2b')],_0x186293[_0x23ed('0x2c')]);_0xbb757b[_0x23ed('0x2f')]=_[_0x23ed('0x2d')](_0x186293[_0x23ed('0x2b')],qs[_0x23ed('0x2e')](_0x2bf7e1[_0x23ed('0x2c')]['fields']));_0xbb757b[_0x23ed('0x2f')]=_0xbb757b[_0x23ed('0x2f')][_0x23ed('0x30')]?_0xbb757b[_0x23ed('0x2f')]:_0x186293[_0x23ed('0x2b')];_0xbb757b[_0x23ed('0x34')]=qs[_0x23ed('0x35')](_0x2bf7e1[_0x23ed('0x2c')]['sort']);_0xbb757b[_0x23ed('0x36')]=qs[_0x23ed('0x37')](_[_0x23ed('0x4a')](_0x2bf7e1[_0x23ed('0x2c')],_0x186293[_0x23ed('0x37')]));if(_0x2bf7e1[_0x23ed('0x2c')]['filter']){_0xbb757b['where']=_[_0x23ed('0x3a')](_0xbb757b['where'],{'$or':_[_0x23ed('0x26')](_0xbb757b[_0x23ed('0x2f')],function(_0x604491){var _0x53ec6c={};_0x53ec6c[_0x604491]={'$like':'%'+_0x2bf7e1[_0x23ed('0x2c')][_0x23ed('0x38')]+'%'};return _0x53ec6c;})});}_0xbb757b=_[_0x23ed('0x3a')]({},_0xbb757b,_0x2bf7e1[_0x23ed('0x3b')]);return _0x79a2ce['getFields'](_0xbb757b);}})[_0x23ed('0x20')](function(_0x2b51bb){if(_0x2b51bb){_0x445f4d=_0x2b51bb[_0x23ed('0x30')];if(!_0x2bf7e1[_0x23ed('0x2c')][_0x23ed('0x31')]('nolimit')){_0xbb757b[_0x23ed('0x33')]=qs[_0x23ed('0x33')](_0x2bf7e1[_0x23ed('0x2c')][_0x23ed('0x33')]);_0xbb757b['offset']=qs[_0x23ed('0x1a')](_0x2bf7e1[_0x23ed('0x2c')][_0x23ed('0x1a')]);}return _0x79a2ce[_0x23ed('0x4d')](_0xbb757b);}})['then'](function(_0x13521e){if(_0x13521e){return _0x13521e?{'count':_0x445f4d,'rows':_0x13521e}:null;}})[_0x23ed('0x20')](respondWithResult(_0x5ba22e,null))[_0x23ed('0x41')](handleError(_0x5ba22e,null));}; \ No newline at end of file +var _0x1489=['update','then','destroy','error','stack','name','index','map','FreshsalesConfiguration','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','rawAttributes','includeAll','include','find','create','body','getSubjects','findOne','FreshsalesField','pick','getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0x1489,0x17d));var _0x9148=function(_0x5c8628,_0x2fc5f5){_0x5c8628=_0x5c8628-0x0;var _0xcbd50e=_0x1489[_0x5c8628];return _0xcbd50e;};'use strict';var emlformat=require(_0x9148('0x0'));var rimraf=require(_0x9148('0x1'));var zipdir=require(_0x9148('0x2'));var jsonpatch=require(_0x9148('0x3'));var rp=require('request-promise');var moment=require(_0x9148('0x4'));var BPromise=require(_0x9148('0x5'));var Mustache=require(_0x9148('0x6'));var util=require(_0x9148('0x7'));var path=require(_0x9148('0x8'));var sox=require(_0x9148('0x9'));var csv=require(_0x9148('0xa'));var ejs=require(_0x9148('0xb'));var fs=require('fs');var fs_extra=require(_0x9148('0xc'));var _=require('lodash');var squel=require(_0x9148('0xd'));var crypto=require(_0x9148('0xe'));var jsforce=require(_0x9148('0xf'));var deskjs=require(_0x9148('0x10'));var toCsv=require(_0x9148('0xa'));var querystring=require('querystring');var Papa=require(_0x9148('0x11'));var Redis=require(_0x9148('0x12'));var authService=require(_0x9148('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x9148('0x14'));var hardwareService=require(_0x9148('0x15'));var logger=require(_0x9148('0x16'))(_0x9148('0x17'));var utils=require(_0x9148('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9148('0x19'));var db=require(_0x9148('0x1a'))['db'];function respondWithStatusCode(_0x2e7f38,_0x29fca2){_0x29fca2=_0x29fca2||0xcc;return function(_0x259e3a){if(_0x259e3a){return _0x2e7f38[_0x9148('0x1b')](_0x29fca2);}return _0x2e7f38['status'](_0x29fca2)[_0x9148('0x1c')]();};}function respondWithResult(_0x1d7276,_0x21fa67){_0x21fa67=_0x21fa67||0xc8;return function(_0x2c03d0){if(_0x2c03d0){return _0x1d7276[_0x9148('0x1d')](_0x21fa67)[_0x9148('0x1e')](_0x2c03d0);}};}function respondWithFilteredResult(_0x32174e,_0x127622){return function(_0x3ef36a){if(_0x3ef36a){var _0x56ff1b=typeof _0x127622['offset']==='undefined'&&typeof _0x127622[_0x9148('0x1f')]===_0x9148('0x20');var _0x5abd2b=_0x3ef36a[_0x9148('0x21')];var _0x3ed2c7=_0x56ff1b?0x0:_0x127622[_0x9148('0x22')];var _0x13b264=_0x56ff1b?_0x3ef36a[_0x9148('0x21')]:_0x127622[_0x9148('0x22')]+_0x127622[_0x9148('0x1f')];var _0x517d40;if(_0x13b264>=_0x5abd2b){_0x13b264=_0x5abd2b;_0x517d40=0xc8;}else{_0x517d40=0xce;}_0x32174e[_0x9148('0x1d')](_0x517d40);return _0x32174e[_0x9148('0x23')](_0x9148('0x24'),_0x3ed2c7+'-'+_0x13b264+'/'+_0x5abd2b)[_0x9148('0x1e')](_0x3ef36a);}return null;};}function patchUpdates(_0x22e9f1){return function(_0x569d59){try{jsonpatch[_0x9148('0x25')](_0x569d59,_0x22e9f1,!![]);}catch(_0x5f1e74){return BPromise[_0x9148('0x26')](_0x5f1e74);}return _0x569d59['save']();};}function saveUpdates(_0x1550ec,_0x28c919){return function(_0x469ca7){if(_0x469ca7){return _0x469ca7[_0x9148('0x27')](_0x1550ec)[_0x9148('0x28')](function(_0x67d545){return _0x67d545;});}return null;};}function removeEntity(_0x907d88,_0x2f96e9){return function(_0x53a99f){if(_0x53a99f){return _0x53a99f[_0x9148('0x29')]()[_0x9148('0x28')](function(){_0x907d88['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x471d24,_0x59ffea){return function(_0x40a051){if(!_0x40a051){_0x471d24[_0x9148('0x1b')](0x194);}return _0x40a051;};}function handleError(_0x12f1ea,_0x25c9c3){_0x25c9c3=_0x25c9c3||0x1f4;return function(_0x5e54ca){logger[_0x9148('0x2a')](_0x5e54ca[_0x9148('0x2b')]);if(_0x5e54ca[_0x9148('0x2c')]){delete _0x5e54ca[_0x9148('0x2c')];}_0x12f1ea['status'](_0x25c9c3)['send'](_0x5e54ca);};}exports[_0x9148('0x2d')]=function(_0x55c24b,_0x5891b9){var _0x239506={},_0x9d000c={},_0x41d5d9={'count':0x0,'rows':[]};var _0x162b89=_[_0x9148('0x2e')](db[_0x9148('0x2f')]['rawAttributes'],function(_0x4040c8){return{'name':_0x4040c8['fieldName'],'type':_0x4040c8[_0x9148('0x30')][_0x9148('0x31')]};});_0x9d000c[_0x9148('0x32')]=_[_0x9148('0x2e')](_0x162b89,_0x9148('0x2c'));_0x9d000c[_0x9148('0x33')]=_[_0x9148('0x34')](_0x55c24b[_0x9148('0x33')]);_0x9d000c[_0x9148('0x35')]=_[_0x9148('0x36')](_0x9d000c[_0x9148('0x32')],_0x9d000c[_0x9148('0x33')]);_0x239506['attributes']=_[_0x9148('0x36')](_0x9d000c[_0x9148('0x32')],qs[_0x9148('0x37')](_0x55c24b[_0x9148('0x33')][_0x9148('0x37')]));_0x239506['attributes']=_0x239506['attributes'][_0x9148('0x38')]?_0x239506[_0x9148('0x39')]:_0x9d000c['model'];if(!_0x55c24b[_0x9148('0x33')][_0x9148('0x3a')](_0x9148('0x3b'))){_0x239506[_0x9148('0x1f')]=qs[_0x9148('0x1f')](_0x55c24b[_0x9148('0x33')]['limit']);_0x239506[_0x9148('0x22')]=qs[_0x9148('0x22')](_0x55c24b[_0x9148('0x33')][_0x9148('0x22')]);}_0x239506[_0x9148('0x3c')]=qs['sort'](_0x55c24b[_0x9148('0x33')][_0x9148('0x3d')]);_0x239506[_0x9148('0x3e')]=qs[_0x9148('0x35')](_['pick'](_0x55c24b[_0x9148('0x33')],_0x9d000c[_0x9148('0x35')]),_0x162b89);if(_0x55c24b[_0x9148('0x33')][_0x9148('0x3f')]){_0x239506[_0x9148('0x3e')]=_[_0x9148('0x40')](_0x239506[_0x9148('0x3e')],{'$or':_[_0x9148('0x2e')](_0x162b89,function(_0x2f7627){if(_0x2f7627[_0x9148('0x30')]!==_0x9148('0x41')){var _0x2cb368={};_0x2cb368[_0x2f7627[_0x9148('0x2c')]]={'$like':'%'+_0x55c24b['query'][_0x9148('0x3f')]+'%'};return _0x2cb368;}})});}_0x239506=_[_0x9148('0x40')]({},_0x239506,_0x55c24b[_0x9148('0x42')]);var _0x2d84cc={'where':_0x239506[_0x9148('0x3e')]};return db[_0x9148('0x2f')][_0x9148('0x21')](_0x2d84cc)[_0x9148('0x28')](function(_0x5c0ace){_0x41d5d9[_0x9148('0x21')]=_0x5c0ace;if(_0x55c24b[_0x9148('0x33')]['includeAll']){_0x239506['include']=[{'all':!![]}];}return db[_0x9148('0x2f')][_0x9148('0x43')](_0x239506);})[_0x9148('0x28')](function(_0x3a7fb8){_0x41d5d9[_0x9148('0x44')]=_0x3a7fb8;return _0x41d5d9;})[_0x9148('0x28')](respondWithFilteredResult(_0x5891b9,_0x239506))[_0x9148('0x45')](handleError(_0x5891b9,null));};exports[_0x9148('0x46')]=function(_0x25f656,_0x135177){var _0x123a61={'raw':![],'where':{'id':_0x25f656[_0x9148('0x47')]['id']}},_0x14dabf={};_0x14dabf['model']=_[_0x9148('0x34')](db['FreshsalesConfiguration'][_0x9148('0x48')]);_0x14dabf[_0x9148('0x33')]=_[_0x9148('0x34')](_0x25f656['query']);_0x14dabf['filters']=_['intersection'](_0x14dabf[_0x9148('0x32')],_0x14dabf[_0x9148('0x33')]);_0x123a61[_0x9148('0x39')]=_[_0x9148('0x36')](_0x14dabf[_0x9148('0x32')],qs['fields'](_0x25f656['query'][_0x9148('0x37')]));_0x123a61[_0x9148('0x39')]=_0x123a61['attributes'][_0x9148('0x38')]?_0x123a61[_0x9148('0x39')]:_0x14dabf[_0x9148('0x32')];if(_0x25f656[_0x9148('0x33')][_0x9148('0x49')]){_0x123a61[_0x9148('0x4a')]=[{'all':!![]}];}_0x123a61=_['merge']({},_0x123a61,_0x25f656['options']);return db[_0x9148('0x2f')][_0x9148('0x4b')](_0x123a61)[_0x9148('0x28')](handleEntityNotFound(_0x135177,null))[_0x9148('0x28')](respondWithResult(_0x135177,null))[_0x9148('0x45')](handleError(_0x135177,null));};exports[_0x9148('0x4c')]=function(_0x494286,_0x49cb71){return db['FreshsalesConfiguration'][_0x9148('0x4c')](_0x494286['body'],{})['then'](respondWithResult(_0x49cb71,0xc9))['catch'](handleError(_0x49cb71,null));};exports['update']=function(_0x4433d6,_0x7643ce){if(_0x4433d6[_0x9148('0x4d')]['id']){delete _0x4433d6[_0x9148('0x4d')]['id'];}return db[_0x9148('0x2f')][_0x9148('0x4b')]({'where':{'id':_0x4433d6[_0x9148('0x47')]['id']}})[_0x9148('0x28')](handleEntityNotFound(_0x7643ce,null))[_0x9148('0x28')](saveUpdates(_0x4433d6[_0x9148('0x4d')],null))[_0x9148('0x28')](respondWithResult(_0x7643ce,null))['catch'](handleError(_0x7643ce,null));};exports[_0x9148('0x29')]=function(_0x22ea8c,_0x1ef65c){return db[_0x9148('0x2f')][_0x9148('0x4b')]({'where':{'id':_0x22ea8c[_0x9148('0x47')]['id']}})[_0x9148('0x28')](handleEntityNotFound(_0x1ef65c,null))[_0x9148('0x28')](removeEntity(_0x1ef65c,null))[_0x9148('0x45')](handleError(_0x1ef65c,null));};exports[_0x9148('0x4e')]=function(_0x388d10,_0x34b386,_0x5aaa88){var _0x1a469f={};var _0x137ad5={};var _0x435136;var _0x39f722;return db[_0x9148('0x2f')][_0x9148('0x4f')]({'where':{'id':_0x388d10[_0x9148('0x47')]['id']}})['then'](handleEntityNotFound(_0x34b386,null))[_0x9148('0x28')](function(_0x475ac5){if(_0x475ac5){_0x435136=_0x475ac5;_0x137ad5[_0x9148('0x32')]=_[_0x9148('0x34')](db[_0x9148('0x50')]['rawAttributes']);_0x137ad5[_0x9148('0x33')]=_['keys'](_0x388d10[_0x9148('0x33')]);_0x137ad5[_0x9148('0x35')]=_[_0x9148('0x36')](_0x137ad5[_0x9148('0x32')],_0x137ad5[_0x9148('0x33')]);_0x1a469f[_0x9148('0x39')]=_[_0x9148('0x36')](_0x137ad5[_0x9148('0x32')],qs[_0x9148('0x37')](_0x388d10[_0x9148('0x33')][_0x9148('0x37')]));_0x1a469f['attributes']=_0x1a469f[_0x9148('0x39')]['length']?_0x1a469f['attributes']:_0x137ad5[_0x9148('0x32')];_0x1a469f[_0x9148('0x3c')]=qs['sort'](_0x388d10[_0x9148('0x33')]['sort']);_0x1a469f[_0x9148('0x3e')]=qs['filters'](_[_0x9148('0x51')](_0x388d10[_0x9148('0x33')],_0x137ad5[_0x9148('0x35')]));if(_0x388d10[_0x9148('0x33')][_0x9148('0x3f')]){_0x1a469f[_0x9148('0x3e')]=_[_0x9148('0x40')](_0x1a469f[_0x9148('0x3e')],{'$or':_[_0x9148('0x2e')](_0x1a469f[_0x9148('0x39')],function(_0x3e7420){var _0x51075d={};_0x51075d[_0x3e7420]={'$like':'%'+_0x388d10['query'][_0x9148('0x3f')]+'%'};return _0x51075d;})});}_0x1a469f=_[_0x9148('0x40')]({},_0x1a469f,_0x388d10['options']);return _0x435136[_0x9148('0x4e')](_0x1a469f);}})[_0x9148('0x28')](function(_0x2848c9){if(_0x2848c9){_0x39f722=_0x2848c9[_0x9148('0x38')];if(!_0x388d10[_0x9148('0x33')]['hasOwnProperty'](_0x9148('0x3b'))){_0x1a469f['limit']=qs[_0x9148('0x1f')](_0x388d10['query'][_0x9148('0x1f')]);_0x1a469f[_0x9148('0x22')]=qs[_0x9148('0x22')](_0x388d10['query'][_0x9148('0x22')]);}return _0x435136[_0x9148('0x4e')](_0x1a469f);}})['then'](function(_0x1190fd){if(_0x1190fd){return _0x1190fd?{'count':_0x39f722,'rows':_0x1190fd}:null;}})['then'](respondWithResult(_0x34b386,null))[_0x9148('0x45')](handleError(_0x34b386,null));};exports['getDescriptions']=function(_0x29028a,_0x517025,_0x3fc1c8){var _0x4a800f={};var _0x4ae09a={};var _0x2ee231;var _0x48bc51;return db['FreshsalesConfiguration'][_0x9148('0x4f')]({'where':{'id':_0x29028a[_0x9148('0x47')]['id']}})['then'](handleEntityNotFound(_0x517025,null))['then'](function(_0xf6537e){if(_0xf6537e){_0x2ee231=_0xf6537e;_0x4ae09a[_0x9148('0x32')]=_['keys'](db[_0x9148('0x50')][_0x9148('0x48')]);_0x4ae09a[_0x9148('0x33')]=_['keys'](_0x29028a[_0x9148('0x33')]);_0x4ae09a[_0x9148('0x35')]=_[_0x9148('0x36')](_0x4ae09a['model'],_0x4ae09a[_0x9148('0x33')]);_0x4a800f[_0x9148('0x39')]=_[_0x9148('0x36')](_0x4ae09a['model'],qs[_0x9148('0x37')](_0x29028a['query'][_0x9148('0x37')]));_0x4a800f[_0x9148('0x39')]=_0x4a800f[_0x9148('0x39')][_0x9148('0x38')]?_0x4a800f[_0x9148('0x39')]:_0x4ae09a['model'];_0x4a800f[_0x9148('0x3c')]=qs[_0x9148('0x3d')](_0x29028a[_0x9148('0x33')][_0x9148('0x3d')]);_0x4a800f['where']=qs[_0x9148('0x35')](_[_0x9148('0x51')](_0x29028a[_0x9148('0x33')],_0x4ae09a[_0x9148('0x35')]));if(_0x29028a[_0x9148('0x33')]['filter']){_0x4a800f[_0x9148('0x3e')]=_[_0x9148('0x40')](_0x4a800f[_0x9148('0x3e')],{'$or':_[_0x9148('0x2e')](_0x4a800f[_0x9148('0x39')],function(_0x2f4bea){var _0x5f0e75={};_0x5f0e75[_0x2f4bea]={'$like':'%'+_0x29028a[_0x9148('0x33')][_0x9148('0x3f')]+'%'};return _0x5f0e75;})});}_0x4a800f=_[_0x9148('0x40')]({},_0x4a800f,_0x29028a[_0x9148('0x42')]);return _0x2ee231[_0x9148('0x52')](_0x4a800f);}})[_0x9148('0x28')](function(_0x10a9e3){if(_0x10a9e3){_0x48bc51=_0x10a9e3['length'];if(!_0x29028a[_0x9148('0x33')][_0x9148('0x3a')](_0x9148('0x3b'))){_0x4a800f[_0x9148('0x1f')]=qs[_0x9148('0x1f')](_0x29028a[_0x9148('0x33')][_0x9148('0x1f')]);_0x4a800f[_0x9148('0x22')]=qs[_0x9148('0x22')](_0x29028a[_0x9148('0x33')][_0x9148('0x22')]);}return _0x2ee231[_0x9148('0x52')](_0x4a800f);}})[_0x9148('0x28')](function(_0x456613){if(_0x456613){return _0x456613?{'count':_0x48bc51,'rows':_0x456613}:null;}})[_0x9148('0x28')](respondWithResult(_0x517025,null))[_0x9148('0x45')](handleError(_0x517025,null));};exports['getFields']=function(_0x300b24,_0x4440ec,_0x109d8f){var _0x2724da={};var _0x263a91={};var _0x507620;var _0x1d5a45;return db[_0x9148('0x2f')][_0x9148('0x4f')]({'where':{'id':_0x300b24[_0x9148('0x47')]['id']}})[_0x9148('0x28')](handleEntityNotFound(_0x4440ec,null))[_0x9148('0x28')](function(_0x141df8){if(_0x141df8){_0x507620=_0x141df8;_0x263a91[_0x9148('0x32')]=_['keys'](db['FreshsalesField'][_0x9148('0x48')]);_0x263a91[_0x9148('0x33')]=_[_0x9148('0x34')](_0x300b24[_0x9148('0x33')]);_0x263a91[_0x9148('0x35')]=_[_0x9148('0x36')](_0x263a91[_0x9148('0x32')],_0x263a91[_0x9148('0x33')]);_0x2724da[_0x9148('0x39')]=_[_0x9148('0x36')](_0x263a91[_0x9148('0x32')],qs[_0x9148('0x37')](_0x300b24[_0x9148('0x33')][_0x9148('0x37')]));_0x2724da[_0x9148('0x39')]=_0x2724da[_0x9148('0x39')][_0x9148('0x38')]?_0x2724da[_0x9148('0x39')]:_0x263a91[_0x9148('0x32')];_0x2724da[_0x9148('0x3c')]=qs['sort'](_0x300b24[_0x9148('0x33')][_0x9148('0x3d')]);_0x2724da[_0x9148('0x3e')]=qs[_0x9148('0x35')](_[_0x9148('0x51')](_0x300b24['query'],_0x263a91[_0x9148('0x35')]));if(_0x300b24[_0x9148('0x33')][_0x9148('0x3f')]){_0x2724da['where']=_['merge'](_0x2724da['where'],{'$or':_[_0x9148('0x2e')](_0x2724da['attributes'],function(_0x4cf192){var _0x2fb392={};_0x2fb392[_0x4cf192]={'$like':'%'+_0x300b24[_0x9148('0x33')][_0x9148('0x3f')]+'%'};return _0x2fb392;})});}_0x2724da=_[_0x9148('0x40')]({},_0x2724da,_0x300b24[_0x9148('0x42')]);return _0x507620[_0x9148('0x53')](_0x2724da);}})[_0x9148('0x28')](function(_0x26eca5){if(_0x26eca5){_0x1d5a45=_0x26eca5[_0x9148('0x38')];if(!_0x300b24[_0x9148('0x33')][_0x9148('0x3a')](_0x9148('0x3b'))){_0x2724da['limit']=qs[_0x9148('0x1f')](_0x300b24[_0x9148('0x33')][_0x9148('0x1f')]);_0x2724da['offset']=qs[_0x9148('0x22')](_0x300b24['query'][_0x9148('0x22')]);}return _0x507620[_0x9148('0x53')](_0x2724da);}})[_0x9148('0x28')](function(_0xca06ea){if(_0xca06ea){return _0xca06ea?{'count':_0x1d5a45,'rows':_0xca06ea}:null;}})[_0x9148('0x28')](respondWithResult(_0x4440ec,null))[_0x9148('0x45')](handleError(_0x4440ec,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index f57548e..5842607 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 _0x76ce=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','util'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x76ce,0xef));var _0xe76c=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x76ce[_0x2a6809];return _0x11c371;};'use strict';var _=require('lodash');var util=require(_0xe76c('0x0'));var logger=require(_0xe76c('0x1'))(_0xe76c('0x2'));var moment=require(_0xe76c('0x3'));var BPromise=require(_0xe76c('0x4'));var rp=require(_0xe76c('0x5'));var fs=require('fs');var path=require(_0xe76c('0x6'));var rimraf=require('rimraf');var config=require(_0xe76c('0x7'));var attributes=require(_0xe76c('0x8'));module[_0xe76c('0x9')]=function(_0x4bf0da,_0x47ca37){return _0x4bf0da[_0xe76c('0xa')](_0xe76c('0xb'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e64=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4d33bd,_0x25aa88){var _0x17bdcc=function(_0x39197f){while(--_0x39197f){_0x4d33bd['push'](_0x4d33bd['shift']());}};_0x17bdcc(++_0x25aa88);}(_0x9e64,0x157));var _0x49e6=function(_0x31d7a7,_0x51b927){_0x31d7a7=_0x31d7a7-0x0;var _0x46b958=_0x9e64[_0x31d7a7];return _0x46b958;};'use strict';var _=require(_0x49e6('0x0'));var util=require(_0x49e6('0x1'));var logger=require(_0x49e6('0x2'))(_0x49e6('0x3'));var moment=require(_0x49e6('0x4'));var BPromise=require(_0x49e6('0x5'));var rp=require(_0x49e6('0x6'));var fs=require('fs');var path=require(_0x49e6('0x7'));var rimraf=require(_0x49e6('0x8'));var config=require(_0x49e6('0x9'));var attributes=require(_0x49e6('0xa'));module['exports']=function(_0x271640,_0x409d0a){return _0x271640['define'](_0x49e6('0xb'),attributes,{'tableName':_0x49e6('0xc'),'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 0bac1fd..60f7e93 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 _0x18f9=['result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesConfiguration,\x20%s,\x20%s','message'];(function(_0x29c5e6,_0x4ad419){var _0x4e58ee=function(_0x2fa780){while(--_0x2fa780){_0x29c5e6['push'](_0x29c5e6['shift']());}};_0x4e58ee(++_0x4ad419);}(_0x18f9,0xd4));var _0x918f=function(_0xfb8f31,_0x2d3880){_0xfb8f31=_0xfb8f31-0x0;var _0x28b6e0=_0x18f9[_0xfb8f31];return _0x28b6e0;};'use strict';var _=require(_0x918f('0x0'));var util=require('util');var moment=require(_0x918f('0x1'));var BPromise=require(_0x918f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x918f('0x3'))['db'];var utils=require(_0x918f('0x4'));var logger=require(_0x918f('0x5'))(_0x918f('0x6'));var config=require(_0x918f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x918f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x386581,_0x298104,_0x3316be){return new BPromise(function(_0x2a5832,_0x1ca13c){return client[_0x918f('0x9')](_0x386581,_0x3316be)[_0x918f('0xa')](function(_0x15033c){logger[_0x918f('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x298104,_0x918f('0xc'));logger[_0x918f('0xd')](_0x918f('0xe'),_0x298104,_0x918f('0xc'),JSON[_0x918f('0xf')](_0x15033c));if(_0x15033c[_0x918f('0x10')]){if(_0x15033c[_0x918f('0x10')]['code']===0x1f4){logger[_0x918f('0x10')](_0x918f('0x11'),_0x298104,_0x15033c[_0x918f('0x10')][_0x918f('0x12')]);return _0x1ca13c(_0x15033c['error']['message']);}logger[_0x918f('0x10')](_0x918f('0x11'),_0x298104,_0x15033c['error'][_0x918f('0x12')]);return _0x2a5832(_0x15033c[_0x918f('0x10')][_0x918f('0x12')]);}else{logger['info'](_0x918f('0x11'),_0x298104,_0x918f('0xc'));_0x2a5832(_0x15033c[_0x918f('0x13')][_0x918f('0x12')]);}})[_0x918f('0x14')](function(_0x2a5e65){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x298104,_0x2a5e65);_0x1ca13c(_0x2a5e65);});});} \ No newline at end of file +var _0x331e=['stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x751643,_0x3c6557){var _0x21a413=function(_0x2336a4){while(--_0x2336a4){_0x751643['push'](_0x751643['shift']());}};_0x21a413(++_0x3c6557);}(_0x331e,0x18c));var _0xe331=function(_0x395028,_0x5dccef){_0x395028=_0x395028-0x0;var _0x15c1b2=_0x331e[_0x395028];return _0x15c1b2;};'use strict';var _=require('lodash');var util=require(_0xe331('0x0'));var moment=require(_0xe331('0x1'));var BPromise=require(_0xe331('0x2'));var rs=require(_0xe331('0x3'));var fs=require('fs');var Redis=require(_0xe331('0x4'));var db=require(_0xe331('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe331('0x6'))('rpc');var config=require(_0xe331('0x7'));var jayson=require(_0xe331('0x8'));var client=jayson[_0xe331('0x9')][_0xe331('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a93ab,_0x2432dd,_0x5520d6){return new BPromise(function(_0x316fd6,_0x4b9d59){return client[_0xe331('0xb')](_0x4a93ab,_0x5520d6)[_0xe331('0xc')](function(_0x3d2e52){logger[_0xe331('0xd')](_0xe331('0xe'),_0x2432dd,_0xe331('0xf'));logger[_0xe331('0x10')](_0xe331('0x11'),_0x2432dd,_0xe331('0xf'),JSON[_0xe331('0x12')](_0x3d2e52));if(_0x3d2e52['error']){if(_0x3d2e52[_0xe331('0x13')]['code']===0x1f4){logger['error'](_0xe331('0xe'),_0x2432dd,_0x3d2e52[_0xe331('0x13')][_0xe331('0x14')]);return _0x4b9d59(_0x3d2e52[_0xe331('0x13')]['message']);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2432dd,_0x3d2e52[_0xe331('0x13')][_0xe331('0x14')]);return _0x316fd6(_0x3d2e52[_0xe331('0x13')][_0xe331('0x14')]);}else{logger[_0xe331('0xd')](_0xe331('0xe'),_0x2432dd,_0xe331('0xf'));_0x316fd6(_0x3d2e52[_0xe331('0x15')]['message']);}})[_0xe331('0x16')](function(_0x31f62c){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2432dd,_0x31f62c);_0x4b9d59(_0x31f62c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 6330e72..950fe84 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 _0x579c=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x2fe986,_0x3ea148){var _0x10cde4=function(_0x4b58c1){while(--_0x4b58c1){_0x2fe986['push'](_0x2fe986['shift']());}};_0x10cde4(++_0x3ea148);}(_0x579c,0xda));var _0xc579=function(_0x44f353,_0x5b6c2f){_0x44f353=_0x44f353-0x0;var _0x26a635=_0x579c[_0x44f353];return _0x26a635;};'use strict';var multer=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var path=require(_0xc579('0x2'));var timeout=require(_0xc579('0x3'));var express=require(_0xc579('0x4'));var router=express['Router']();var fs_extra=require(_0xc579('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var controller=require(_0xc579('0x8'));router[_0xc579('0x9')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xb')]);router[_0xc579('0x9')]('/:id',auth[_0xc579('0xa')](),controller[_0xc579('0xc')]);router[_0xc579('0xd')]('/',auth[_0xc579('0xa')](),controller[_0xc579('0xe')]);router[_0xc579('0xf')](_0xc579('0x10'),auth[_0xc579('0xa')](),controller['update']);router[_0xc579('0x11')](_0xc579('0x10'),auth[_0xc579('0xa')](),controller[_0xc579('0x12')]);module[_0xc579('0x13')]=router; \ No newline at end of file +var _0x938c=['connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','exports','multer','util'];(function(_0x377506,_0x1e4dc2){var _0x1f0d81=function(_0x4a25ed){while(--_0x4a25ed){_0x377506['push'](_0x377506['shift']());}};_0x1f0d81(++_0x1e4dc2);}(_0x938c,0x11f));var _0xc938=function(_0x36b07b,_0x530cb1){_0x36b07b=_0x36b07b-0x0;var _0x2a7136=_0x938c[_0x36b07b];return _0x2a7136;};'use strict';var multer=require(_0xc938('0x0'));var util=require(_0xc938('0x1'));var path=require('path');var timeout=require(_0xc938('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc938('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc938('0x4'));var config=require(_0xc938('0x5'));var controller=require(_0xc938('0x6'));router[_0xc938('0x7')]('/',auth[_0xc938('0x8')](),controller[_0xc938('0x9')]);router['get'](_0xc938('0xa'),auth[_0xc938('0x8')](),controller['show']);router[_0xc938('0xb')]('/',auth[_0xc938('0x8')](),controller['create']);router[_0xc938('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xc938('0xd')]);router[_0xc938('0xe')](_0xc938('0xa'),auth['isAuthenticated'](),controller[_0xc938('0xf')]);module[_0xc938('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5924816..083944a 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 _0x560c=['variable','customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0x560c,0x1be));var _0xc560=function(_0x4c0f02,_0x312a96){_0x4c0f02=_0x4c0f02-0x0;var _0x479a33=_0x560c[_0x4c0f02];return _0x479a33;};'use strict';var Sequelize=require(_0xc560('0x0'));module[_0xc560('0x1')]={'type':{'type':Sequelize[_0xc560('0x2')](_0xc560('0x3'),_0xc560('0x4'),_0xc560('0x5'),_0xc560('0x6'),_0xc560('0x7')),'defaultValue':_0xc560('0x3')},'content':{'type':Sequelize[_0xc560('0x8')]},'key':{'type':Sequelize[_0xc560('0x8')]},'keyType':{'type':Sequelize[_0xc560('0x2')](_0xc560('0x3'),_0xc560('0x4'),_0xc560('0x5'))},'keyContent':{'type':Sequelize[_0xc560('0x8')]},'idField':{'type':Sequelize[_0xc560('0x8')]},'nameField':{'type':Sequelize[_0xc560('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc560('0x8')]}}; \ No newline at end of file +var _0x601a=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x2ce114,_0x2e8bf5){var _0x23937f=function(_0x193a7e){while(--_0x193a7e){_0x2ce114['push'](_0x2ce114['shift']());}};_0x23937f(++_0x2e8bf5);}(_0x601a,0x1bc));var _0xa601=function(_0x148b6f,_0x448c22){_0x148b6f=_0x148b6f-0x0;var _0x17e9c2=_0x601a[_0x148b6f];return _0x17e9c2;};'use strict';var Sequelize=require('sequelize');module[_0xa601('0x0')]={'type':{'type':Sequelize[_0xa601('0x1')](_0xa601('0x2'),_0xa601('0x3'),_0xa601('0x4'),_0xa601('0x5'),_0xa601('0x6')),'defaultValue':_0xa601('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa601('0x7')]},'keyType':{'type':Sequelize[_0xa601('0x1')](_0xa601('0x2'),_0xa601('0x3'),_0xa601('0x4'))},'keyContent':{'type':Sequelize[_0xa601('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa601('0x7')]},'customField':{'type':Sequelize[_0xa601('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa601('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 2a20892..949994b 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 _0x2652=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','status','end','offset','undefined','count','limit','set','Content-Range','json','save','update','destroy','sendStatus','stack','name','index','map','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','FreshsalesField','then','includeAll','findAll','rows','catch','show','params','include','create','body'];(function(_0x4d337e,_0x2f7eed){var _0x247963=function(_0x3d6564){while(--_0x3d6564){_0x4d337e['push'](_0x4d337e['shift']());}};_0x247963(++_0x2f7eed);}(_0x2652,0x173));var _0x2265=function(_0x501093,_0x52d61e){_0x501093=_0x501093-0x0;var _0x10556c=_0x2652[_0x501093];return _0x10556c;};'use strict';var emlformat=require(_0x2265('0x0'));var rimraf=require(_0x2265('0x1'));var zipdir=require(_0x2265('0x2'));var jsonpatch=require(_0x2265('0x3'));var rp=require(_0x2265('0x4'));var moment=require(_0x2265('0x5'));var BPromise=require(_0x2265('0x6'));var Mustache=require(_0x2265('0x7'));var util=require('util');var path=require(_0x2265('0x8'));var sox=require(_0x2265('0x9'));var csv=require(_0x2265('0xa'));var ejs=require(_0x2265('0xb'));var fs=require('fs');var fs_extra=require(_0x2265('0xc'));var _=require(_0x2265('0xd'));var squel=require(_0x2265('0xe'));var crypto=require(_0x2265('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2265('0x10'));var toCsv=require(_0x2265('0xa'));var querystring=require(_0x2265('0x11'));var Papa=require(_0x2265('0x12'));var Redis=require(_0x2265('0x13'));var authService=require(_0x2265('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x2265('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2265('0x16'));var utils=require(_0x2265('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2265('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21d81e,_0x4e9ae7){_0x4e9ae7=_0x4e9ae7||0xcc;return function(_0x326ead){if(_0x326ead){return _0x21d81e['sendStatus'](_0x4e9ae7);}return _0x21d81e[_0x2265('0x19')](_0x4e9ae7)[_0x2265('0x1a')]();};}function respondWithResult(_0x10d86b,_0x2361d7){_0x2361d7=_0x2361d7||0xc8;return function(_0xdec7ea){if(_0xdec7ea){return _0x10d86b[_0x2265('0x19')](_0x2361d7)['json'](_0xdec7ea);}};}function respondWithFilteredResult(_0x27897f,_0x1a794b){return function(_0x44c290){if(_0x44c290){var _0x2f5572=typeof _0x1a794b[_0x2265('0x1b')]==='undefined'&&typeof _0x1a794b['limit']===_0x2265('0x1c');var _0x3bd58b=_0x44c290[_0x2265('0x1d')];var _0x2a2f8b=_0x2f5572?0x0:_0x1a794b[_0x2265('0x1b')];var _0x5986d2=_0x2f5572?_0x44c290[_0x2265('0x1d')]:_0x1a794b[_0x2265('0x1b')]+_0x1a794b[_0x2265('0x1e')];var _0xbe7cb9;if(_0x5986d2>=_0x3bd58b){_0x5986d2=_0x3bd58b;_0xbe7cb9=0xc8;}else{_0xbe7cb9=0xce;}_0x27897f[_0x2265('0x19')](_0xbe7cb9);return _0x27897f[_0x2265('0x1f')](_0x2265('0x20'),_0x2a2f8b+'-'+_0x5986d2+'/'+_0x3bd58b)[_0x2265('0x21')](_0x44c290);}return null;};}function patchUpdates(_0x4d3408){return function(_0xa79bfa){try{jsonpatch['apply'](_0xa79bfa,_0x4d3408,!![]);}catch(_0x22e09e){return BPromise['reject'](_0x22e09e);}return _0xa79bfa[_0x2265('0x22')]();};}function saveUpdates(_0x321c2a,_0x99c37a){return function(_0x223de3){if(_0x223de3){return _0x223de3[_0x2265('0x23')](_0x321c2a)['then'](function(_0xa2dbf0){return _0xa2dbf0;});}return null;};}function removeEntity(_0x743f12,_0x34d5a5){return function(_0x52f5f9){if(_0x52f5f9){return _0x52f5f9[_0x2265('0x24')]()['then'](function(){_0x743f12['status'](0xcc)[_0x2265('0x1a')]();});}};}function handleEntityNotFound(_0x56da88,_0x30d8f2){return function(_0x3e5972){if(!_0x3e5972){_0x56da88[_0x2265('0x25')](0x194);}return _0x3e5972;};}function handleError(_0x36aa52,_0x33844d){_0x33844d=_0x33844d||0x1f4;return function(_0x48cbcd){logger['error'](_0x48cbcd[_0x2265('0x26')]);if(_0x48cbcd['name']){delete _0x48cbcd[_0x2265('0x27')];}_0x36aa52['status'](_0x33844d)['send'](_0x48cbcd);};}exports[_0x2265('0x28')]=function(_0x311b55,_0x2b1486){var _0x2df526={},_0xc552e3={},_0x367694={'count':0x0,'rows':[]};var _0x4d6408=_[_0x2265('0x29')](db['FreshsalesField'][_0x2265('0x2a')],function(_0x1f11f1){return{'name':_0x1f11f1['fieldName'],'type':_0x1f11f1[_0x2265('0x2b')][_0x2265('0x2c')]};});_0xc552e3[_0x2265('0x2d')]=_['map'](_0x4d6408,_0x2265('0x27'));_0xc552e3['query']=_[_0x2265('0x2e')](_0x311b55[_0x2265('0x2f')]);_0xc552e3[_0x2265('0x30')]=_['intersection'](_0xc552e3[_0x2265('0x2d')],_0xc552e3[_0x2265('0x2f')]);_0x2df526[_0x2265('0x31')]=_[_0x2265('0x32')](_0xc552e3['model'],qs[_0x2265('0x33')](_0x311b55['query'][_0x2265('0x33')]));_0x2df526[_0x2265('0x31')]=_0x2df526['attributes'][_0x2265('0x34')]?_0x2df526[_0x2265('0x31')]:_0xc552e3[_0x2265('0x2d')];if(!_0x311b55['query'][_0x2265('0x35')](_0x2265('0x36'))){_0x2df526[_0x2265('0x1e')]=qs[_0x2265('0x1e')](_0x311b55[_0x2265('0x2f')][_0x2265('0x1e')]);_0x2df526[_0x2265('0x1b')]=qs[_0x2265('0x1b')](_0x311b55['query'][_0x2265('0x1b')]);}_0x2df526[_0x2265('0x37')]=qs[_0x2265('0x38')](_0x311b55[_0x2265('0x2f')][_0x2265('0x38')]);_0x2df526[_0x2265('0x39')]=qs[_0x2265('0x30')](_['pick'](_0x311b55['query'],_0xc552e3[_0x2265('0x30')]),_0x4d6408);if(_0x311b55[_0x2265('0x2f')]['filter']){_0x2df526[_0x2265('0x39')]=_[_0x2265('0x3a')](_0x2df526[_0x2265('0x39')],{'$or':_['map'](_0x4d6408,function(_0x4122a5){if(_0x4122a5[_0x2265('0x2b')]!==_0x2265('0x3b')){var _0x24e56f={};_0x24e56f[_0x4122a5[_0x2265('0x27')]]={'$like':'%'+_0x311b55[_0x2265('0x2f')][_0x2265('0x3c')]+'%'};return _0x24e56f;}})});}_0x2df526=_['merge']({},_0x2df526,_0x311b55[_0x2265('0x3d')]);var _0x48b63d={'where':_0x2df526[_0x2265('0x39')]};return db[_0x2265('0x3e')][_0x2265('0x1d')](_0x48b63d)[_0x2265('0x3f')](function(_0x3d9c38){_0x367694[_0x2265('0x1d')]=_0x3d9c38;if(_0x311b55['query'][_0x2265('0x40')]){_0x2df526['include']=[{'all':!![]}];}return db[_0x2265('0x3e')][_0x2265('0x41')](_0x2df526);})[_0x2265('0x3f')](function(_0x2492c0){_0x367694[_0x2265('0x42')]=_0x2492c0;return _0x367694;})['then'](respondWithFilteredResult(_0x2b1486,_0x2df526))[_0x2265('0x43')](handleError(_0x2b1486,null));};exports[_0x2265('0x44')]=function(_0x4cabc2,_0x4f158b){var _0x3e769c={'raw':!![],'where':{'id':_0x4cabc2[_0x2265('0x45')]['id']}},_0xa51733={};_0xa51733[_0x2265('0x2d')]=_[_0x2265('0x2e')](db[_0x2265('0x3e')][_0x2265('0x2a')]);_0xa51733[_0x2265('0x2f')]=_[_0x2265('0x2e')](_0x4cabc2[_0x2265('0x2f')]);_0xa51733[_0x2265('0x30')]=_[_0x2265('0x32')](_0xa51733[_0x2265('0x2d')],_0xa51733[_0x2265('0x2f')]);_0x3e769c[_0x2265('0x31')]=_[_0x2265('0x32')](_0xa51733[_0x2265('0x2d')],qs[_0x2265('0x33')](_0x4cabc2[_0x2265('0x2f')][_0x2265('0x33')]));_0x3e769c[_0x2265('0x31')]=_0x3e769c['attributes'][_0x2265('0x34')]?_0x3e769c[_0x2265('0x31')]:_0xa51733[_0x2265('0x2d')];if(_0x4cabc2[_0x2265('0x2f')][_0x2265('0x40')]){_0x3e769c[_0x2265('0x46')]=[{'all':!![]}];}_0x3e769c=_[_0x2265('0x3a')]({},_0x3e769c,_0x4cabc2['options']);return db[_0x2265('0x3e')]['find'](_0x3e769c)[_0x2265('0x3f')](handleEntityNotFound(_0x4f158b,null))[_0x2265('0x3f')](respondWithResult(_0x4f158b,null))[_0x2265('0x43')](handleError(_0x4f158b,null));};exports[_0x2265('0x47')]=function(_0x2fa2ae,_0x584d14){return db['FreshsalesField'][_0x2265('0x47')](_0x2fa2ae['body'],{})[_0x2265('0x3f')](respondWithResult(_0x584d14,0xc9))[_0x2265('0x43')](handleError(_0x584d14,null));};exports[_0x2265('0x23')]=function(_0x275cf4,_0x2ec865){if(_0x275cf4[_0x2265('0x48')]['id']){delete _0x275cf4['body']['id'];}return db[_0x2265('0x3e')][_0x2265('0x49')]({'where':{'id':_0x275cf4[_0x2265('0x45')]['id']}})[_0x2265('0x3f')](handleEntityNotFound(_0x2ec865,null))['then'](saveUpdates(_0x275cf4[_0x2265('0x48')],null))[_0x2265('0x3f')](respondWithResult(_0x2ec865,null))['catch'](handleError(_0x2ec865,null));};exports['destroy']=function(_0x3153af,_0x335ce5){return db[_0x2265('0x3e')][_0x2265('0x49')]({'where':{'id':_0x3153af[_0x2265('0x45')]['id']}})['then'](handleEntityNotFound(_0x335ce5,null))[_0x2265('0x3f')](removeEntity(_0x335ce5,null))['catch'](handleError(_0x335ce5,null));}; \ No newline at end of file +var _0xacd0=['rows','show','params','length','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','error','name','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','FreshsalesField','includeAll','include','findAll'];(function(_0x2376d1,_0x38eec4){var _0x443759=function(_0x73c733){while(--_0x73c733){_0x2376d1['push'](_0x2376d1['shift']());}};_0x443759(++_0x38eec4);}(_0xacd0,0x170));var _0x0acd=function(_0x497880,_0x430dbc){_0x497880=_0x497880-0x0;var _0x1a3d4b=_0xacd0[_0x497880];return _0x1a3d4b;};'use strict';var emlformat=require(_0x0acd('0x0'));var rimraf=require(_0x0acd('0x1'));var zipdir=require(_0x0acd('0x2'));var jsonpatch=require(_0x0acd('0x3'));var rp=require(_0x0acd('0x4'));var moment=require(_0x0acd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0acd('0x6'));var util=require(_0x0acd('0x7'));var path=require('path');var sox=require(_0x0acd('0x8'));var csv=require(_0x0acd('0x9'));var ejs=require(_0x0acd('0xa'));var fs=require('fs');var fs_extra=require(_0x0acd('0xb'));var _=require(_0x0acd('0xc'));var squel=require('squel');var crypto=require(_0x0acd('0xd'));var jsforce=require(_0x0acd('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0acd('0x9'));var querystring=require(_0x0acd('0xf'));var Papa=require(_0x0acd('0x10'));var Redis=require(_0x0acd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0acd('0x12'));var as=require(_0x0acd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0acd('0x14'));var utils=require(_0x0acd('0x15'));var config=require(_0x0acd('0x16'));var licenseUtil=require(_0x0acd('0x17'));var db=require(_0x0acd('0x18'))['db'];function respondWithStatusCode(_0x362525,_0xeca73b){_0xeca73b=_0xeca73b||0xcc;return function(_0x473087){if(_0x473087){return _0x362525[_0x0acd('0x19')](_0xeca73b);}return _0x362525[_0x0acd('0x1a')](_0xeca73b)[_0x0acd('0x1b')]();};}function respondWithResult(_0x5062d3,_0x2d6ceb){_0x2d6ceb=_0x2d6ceb||0xc8;return function(_0x180250){if(_0x180250){return _0x5062d3[_0x0acd('0x1a')](_0x2d6ceb)['json'](_0x180250);}};}function respondWithFilteredResult(_0x326b6,_0x104208){return function(_0x117d8d){if(_0x117d8d){var _0x1a3cdc=typeof _0x104208[_0x0acd('0x1c')]==='undefined'&&typeof _0x104208[_0x0acd('0x1d')]===_0x0acd('0x1e');var _0x41c5d6=_0x117d8d[_0x0acd('0x1f')];var _0x1cb926=_0x1a3cdc?0x0:_0x104208['offset'];var _0x370e3c=_0x1a3cdc?_0x117d8d[_0x0acd('0x1f')]:_0x104208[_0x0acd('0x1c')]+_0x104208['limit'];var _0x300172;if(_0x370e3c>=_0x41c5d6){_0x370e3c=_0x41c5d6;_0x300172=0xc8;}else{_0x300172=0xce;}_0x326b6[_0x0acd('0x1a')](_0x300172);return _0x326b6['set'](_0x0acd('0x20'),_0x1cb926+'-'+_0x370e3c+'/'+_0x41c5d6)[_0x0acd('0x21')](_0x117d8d);}return null;};}function patchUpdates(_0x100f4c){return function(_0x1fb069){try{jsonpatch[_0x0acd('0x22')](_0x1fb069,_0x100f4c,!![]);}catch(_0x2f30ec){return BPromise[_0x0acd('0x23')](_0x2f30ec);}return _0x1fb069[_0x0acd('0x24')]();};}function saveUpdates(_0x2c5156,_0x4f7cce){return function(_0x293c78){if(_0x293c78){return _0x293c78[_0x0acd('0x25')](_0x2c5156)[_0x0acd('0x26')](function(_0x40bfb3){return _0x40bfb3;});}return null;};}function removeEntity(_0x2f9a55,_0x19f080){return function(_0x4189b7){if(_0x4189b7){return _0x4189b7['destroy']()['then'](function(){_0x2f9a55[_0x0acd('0x1a')](0xcc)[_0x0acd('0x1b')]();});}};}function handleEntityNotFound(_0x2d9539,_0x1a5090){return function(_0x58c614){if(!_0x58c614){_0x2d9539[_0x0acd('0x19')](0x194);}return _0x58c614;};}function handleError(_0x5ddd02,_0x1e4513){_0x1e4513=_0x1e4513||0x1f4;return function(_0x528585){logger[_0x0acd('0x27')](_0x528585['stack']);if(_0x528585['name']){delete _0x528585[_0x0acd('0x28')];}_0x5ddd02[_0x0acd('0x1a')](_0x1e4513)['send'](_0x528585);};}exports[_0x0acd('0x29')]=function(_0x28ec4a,_0xe01411){var _0x15468b={},_0x4e1a43={},_0x5f129c={'count':0x0,'rows':[]};var _0x35d127=_[_0x0acd('0x2a')](db['FreshsalesField'][_0x0acd('0x2b')],function(_0x3a67b2){return{'name':_0x3a67b2['fieldName'],'type':_0x3a67b2[_0x0acd('0x2c')]['key']};});_0x4e1a43[_0x0acd('0x2d')]=_[_0x0acd('0x2a')](_0x35d127,_0x0acd('0x28'));_0x4e1a43[_0x0acd('0x2e')]=_[_0x0acd('0x2f')](_0x28ec4a[_0x0acd('0x2e')]);_0x4e1a43['filters']=_[_0x0acd('0x30')](_0x4e1a43[_0x0acd('0x2d')],_0x4e1a43[_0x0acd('0x2e')]);_0x15468b[_0x0acd('0x31')]=_['intersection'](_0x4e1a43[_0x0acd('0x2d')],qs[_0x0acd('0x32')](_0x28ec4a[_0x0acd('0x2e')][_0x0acd('0x32')]));_0x15468b[_0x0acd('0x31')]=_0x15468b[_0x0acd('0x31')]['length']?_0x15468b[_0x0acd('0x31')]:_0x4e1a43[_0x0acd('0x2d')];if(!_0x28ec4a[_0x0acd('0x2e')][_0x0acd('0x33')]('nolimit')){_0x15468b[_0x0acd('0x1d')]=qs[_0x0acd('0x1d')](_0x28ec4a[_0x0acd('0x2e')][_0x0acd('0x1d')]);_0x15468b[_0x0acd('0x1c')]=qs[_0x0acd('0x1c')](_0x28ec4a[_0x0acd('0x2e')]['offset']);}_0x15468b[_0x0acd('0x34')]=qs[_0x0acd('0x35')](_0x28ec4a[_0x0acd('0x2e')][_0x0acd('0x35')]);_0x15468b[_0x0acd('0x36')]=qs[_0x0acd('0x37')](_[_0x0acd('0x38')](_0x28ec4a[_0x0acd('0x2e')],_0x4e1a43[_0x0acd('0x37')]),_0x35d127);if(_0x28ec4a[_0x0acd('0x2e')][_0x0acd('0x39')]){_0x15468b['where']=_[_0x0acd('0x3a')](_0x15468b[_0x0acd('0x36')],{'$or':_[_0x0acd('0x2a')](_0x35d127,function(_0x291d53){if(_0x291d53[_0x0acd('0x2c')]!=='VIRTUAL'){var _0x1845c0={};_0x1845c0[_0x291d53[_0x0acd('0x28')]]={'$like':'%'+_0x28ec4a['query'][_0x0acd('0x39')]+'%'};return _0x1845c0;}})});}_0x15468b=_[_0x0acd('0x3a')]({},_0x15468b,_0x28ec4a[_0x0acd('0x3b')]);var _0x1a903d={'where':_0x15468b['where']};return db[_0x0acd('0x3c')][_0x0acd('0x1f')](_0x1a903d)[_0x0acd('0x26')](function(_0xe69582){_0x5f129c[_0x0acd('0x1f')]=_0xe69582;if(_0x28ec4a[_0x0acd('0x2e')][_0x0acd('0x3d')]){_0x15468b[_0x0acd('0x3e')]=[{'all':!![]}];}return db[_0x0acd('0x3c')][_0x0acd('0x3f')](_0x15468b);})[_0x0acd('0x26')](function(_0x16dad0){_0x5f129c[_0x0acd('0x40')]=_0x16dad0;return _0x5f129c;})[_0x0acd('0x26')](respondWithFilteredResult(_0xe01411,_0x15468b))['catch'](handleError(_0xe01411,null));};exports[_0x0acd('0x41')]=function(_0x59bdec,_0x268501){var _0x263cf8={'raw':!![],'where':{'id':_0x59bdec[_0x0acd('0x42')]['id']}},_0x330ecb={};_0x330ecb['model']=_[_0x0acd('0x2f')](db[_0x0acd('0x3c')][_0x0acd('0x2b')]);_0x330ecb[_0x0acd('0x2e')]=_['keys'](_0x59bdec[_0x0acd('0x2e')]);_0x330ecb['filters']=_[_0x0acd('0x30')](_0x330ecb[_0x0acd('0x2d')],_0x330ecb[_0x0acd('0x2e')]);_0x263cf8[_0x0acd('0x31')]=_[_0x0acd('0x30')](_0x330ecb[_0x0acd('0x2d')],qs[_0x0acd('0x32')](_0x59bdec['query'][_0x0acd('0x32')]));_0x263cf8['attributes']=_0x263cf8['attributes'][_0x0acd('0x43')]?_0x263cf8['attributes']:_0x330ecb['model'];if(_0x59bdec[_0x0acd('0x2e')][_0x0acd('0x3d')]){_0x263cf8[_0x0acd('0x3e')]=[{'all':!![]}];}_0x263cf8=_[_0x0acd('0x3a')]({},_0x263cf8,_0x59bdec['options']);return db['FreshsalesField']['find'](_0x263cf8)['then'](handleEntityNotFound(_0x268501,null))['then'](respondWithResult(_0x268501,null))[_0x0acd('0x44')](handleError(_0x268501,null));};exports[_0x0acd('0x45')]=function(_0x46c219,_0x2c293c){return db[_0x0acd('0x3c')][_0x0acd('0x45')](_0x46c219[_0x0acd('0x46')],{})[_0x0acd('0x26')](respondWithResult(_0x2c293c,0xc9))['catch'](handleError(_0x2c293c,null));};exports[_0x0acd('0x25')]=function(_0x1b875d,_0x53d4af){if(_0x1b875d[_0x0acd('0x46')]['id']){delete _0x1b875d[_0x0acd('0x46')]['id'];}return db[_0x0acd('0x3c')]['find']({'where':{'id':_0x1b875d['params']['id']}})[_0x0acd('0x26')](handleEntityNotFound(_0x53d4af,null))[_0x0acd('0x26')](saveUpdates(_0x1b875d[_0x0acd('0x46')],null))[_0x0acd('0x26')](respondWithResult(_0x53d4af,null))['catch'](handleError(_0x53d4af,null));};exports['destroy']=function(_0x4c80ca,_0x42db54){return db[_0x0acd('0x3c')][_0x0acd('0x47')]({'where':{'id':_0x4c80ca['params']['id']}})[_0x0acd('0x26')](handleEntityNotFound(_0x42db54,null))[_0x0acd('0x26')](removeEntity(_0x42db54,null))[_0x0acd('0x44')](handleError(_0x42db54,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 7de3cdb..dcb7117 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 _0x390a=['exports','define','FreshsalesField','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x390a,0xc9));var _0xa390=function(_0x2091c5,_0x481c4a){_0x2091c5=_0x2091c5-0x0;var _0x4467c5=_0x390a[_0x2091c5];return _0x4467c5;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var logger=require(_0xa390('0x2'))(_0xa390('0x3'));var moment=require('moment');var BPromise=require(_0xa390('0x4'));var rp=require(_0xa390('0x5'));var fs=require('fs');var path=require(_0xa390('0x6'));var rimraf=require(_0xa390('0x7'));var config=require('../../config/environment');var attributes=require(_0xa390('0x8'));module[_0xa390('0x9')]=function(_0x3d7cd7,_0x4ac9f5){return _0x3d7cd7[_0xa390('0xa')](_0xa390('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xa390('0xc'),_0xa390('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9db7=['api','bluebird','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x37be4c,_0x1d0ec8){var _0x367b40=function(_0x539a58){while(--_0x539a58){_0x37be4c['push'](_0x37be4c['shift']());}};_0x367b40(++_0x1d0ec8);}(_0x9db7,0x1bf));var _0x79db=function(_0x13c292,_0x175410){_0x13c292=_0x13c292-0x0;var _0x2a0483=_0x9db7[_0x13c292];return _0x2a0483;};'use strict';var _=require(_0x79db('0x0'));var util=require(_0x79db('0x1'));var logger=require(_0x79db('0x2'))(_0x79db('0x3'));var moment=require('moment');var BPromise=require(_0x79db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79db('0x5'));var rimraf=require(_0x79db('0x6'));var config=require('../../config/environment');var attributes=require(_0x79db('0x7'));module[_0x79db('0x8')]=function(_0xfb8328,_0x45c9d1){return _0xfb8328[_0x79db('0x9')](_0x79db('0xa'),attributes,{'tableName':_0x79db('0xb'),'paranoid':![],'indexes':[{'name':_0x79db('0xc'),'fields':[_0x79db('0xd'),_0x79db('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 2b02ddf..725a86c 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 _0x326f=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xbedd19,_0x1a201f){var _0x1a31f6=function(_0xfed309){while(--_0xfed309){_0xbedd19['push'](_0xbedd19['shift']());}};_0x1a31f6(++_0x1a201f);}(_0x326f,0xd1));var _0xf326=function(_0x2a473e,_0x59b6e2){_0x2a473e=_0x2a473e-0x0;var _0x4535c2=_0x326f[_0x2a473e];return _0x4535c2;};'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')]('FreshsalesField,\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')]('FreshsalesField,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0xb4c7=['client','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x37e6fc,_0x1f2e33){var _0x39c7cf=function(_0x426c3b){while(--_0x426c3b){_0x37e6fc['push'](_0x37e6fc['shift']());}};_0x39c7cf(++_0x1f2e33);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0xf63b86,_0x6fc8d8){_0xf63b86=_0xf63b86-0x0;var _0x56a617=_0xb4c7[_0xf63b86];return _0x56a617;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var BPromise=require(_0x7b4c('0x3'));var rs=require(_0x7b4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b4c('0x5'))['db'];var utils=require(_0x7b4c('0x6'));var logger=require(_0x7b4c('0x7'))(_0x7b4c('0x8'));var config=require(_0x7b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0xa')][_0x7b4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2dd5c7,_0x4bf85d,_0x2d7b7e){return new BPromise(function(_0x21687f,_0x570daa){return client[_0x7b4c('0xc')](_0x2dd5c7,_0x2d7b7e)[_0x7b4c('0xd')](function(_0x28e902){logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));logger[_0x7b4c('0x11')](_0x7b4c('0x12'),_0x4bf85d,_0x7b4c('0x10'),JSON[_0x7b4c('0x13')](_0x28e902));if(_0x28e902['error']){if(_0x28e902['error'][_0x7b4c('0x14')]===0x1f4){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);return _0x570daa(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x28e902[_0x7b4c('0x15')]['message']);return _0x21687f(_0x28e902[_0x7b4c('0x15')][_0x7b4c('0x16')]);}else{logger[_0x7b4c('0xe')](_0x7b4c('0xf'),_0x4bf85d,_0x7b4c('0x10'));_0x21687f(_0x28e902[_0x7b4c('0x17')][_0x7b4c('0x16')]);}})[_0x7b4c('0x18')](function(_0x4d3f5e){logger[_0x7b4c('0x15')](_0x7b4c('0xf'),_0x4bf85d,_0x4d3f5e);_0x570daa(_0x4d3f5e);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 579222e..0e0b7de 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x53a234,_0x5d973b){var _0x1e3aa=function(_0x38a49d){while(--_0x38a49d){_0x53a234['push'](_0x53a234['shift']());}};_0x1e3aa(++_0x5d973b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x5583b0,_0x13bb43){var _0x23c46c=function(_0x5c90c2){while(--_0x5c90c2){_0x5583b0['push'](_0x5583b0['shift']());}};_0x23c46c(++_0x13bb43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index faa7c03..6ae225f 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 _0x18c9=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x1ebe63,_0x90e2ef){var _0x1ee877=function(_0x256c95){while(--_0x256c95){_0x1ebe63['push'](_0x1ebe63['shift']());}};_0x1ee877(++_0x90e2ef);}(_0x18c9,0x13c));var _0x918c=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x18c9[_0x557fd2];return _0x1b54a2;};'use strict';var Sequelize=require(_0x918c('0x0'));module[_0x918c('0x1')]={'name':{'type':Sequelize[_0x918c('0x2')]},'description':{'type':Sequelize[_0x918c('0x2')]},'username':{'type':Sequelize[_0x918c('0x2')],'unique':_0x918c('0x3')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x918c('0x2')]},'clientId':{'type':Sequelize[_0x918c('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x918c('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x918c('0x4')](_0x918c('0x5'),_0x918c('0x6')),'defaultValue':_0x918c('0x5')}}; \ No newline at end of file +var _0xca6e=['exports','STRING','ENUM','integrationTab','sequelize'];(function(_0x9db19f,_0x16a0f7){var _0xefc307=function(_0x25e3e4){while(--_0x25e3e4){_0x9db19f['push'](_0x9db19f['shift']());}};_0xefc307(++_0x16a0f7);}(_0xca6e,0x1c1));var _0xeca6=function(_0x2eff73,_0x116e91){_0x2eff73=_0x2eff73-0x0;var _0x319d39=_0xca6e[_0x2eff73];return _0x319d39;};'use strict';var Sequelize=require(_0xeca6('0x0'));module[_0xeca6('0x1')]={'name':{'type':Sequelize[_0xeca6('0x2')]},'description':{'type':Sequelize[_0xeca6('0x2')]},'username':{'type':Sequelize[_0xeca6('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xeca6('0x2')]},'password':{'type':Sequelize[_0xeca6('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xeca6('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xeca6('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xeca6('0x3')](_0xeca6('0x4'),'newTab'),'defaultValue':_0xeca6('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 9ea584f..3d7554a 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 _0x8406=['findOne','SalesforceConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','concat','isNil','describe','OwnerId','ActivityDate','IsRecurrence','Subject','Description','string','picklist','email','textarea','remove','includes','picklistValues','label','boolean','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','catch','show','params','includeAll','options','find','create','body','getConfigurations'];(function(_0x4173f5,_0x3c2657){var _0x3daad4=function(_0x3c0812){while(--_0x3c0812){_0x4173f5['push'](_0x4173f5['shift']());}};_0x3daad4(++_0x3c2657);}(_0x8406,0x1a6));var _0x6840=function(_0x3dcee0,_0x5df334){_0x3dcee0=_0x3dcee0-0x0;var _0x49a254=_0x8406[_0x3dcee0];return _0x49a254;};'use strict';var emlformat=require(_0x6840('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6840('0x1'));var jsonpatch=require(_0x6840('0x2'));var rp=require(_0x6840('0x3'));var moment=require(_0x6840('0x4'));var BPromise=require(_0x6840('0x5'));var Mustache=require(_0x6840('0x6'));var util=require(_0x6840('0x7'));var path=require(_0x6840('0x8'));var sox=require(_0x6840('0x9'));var csv=require(_0x6840('0xa'));var ejs=require(_0x6840('0xb'));var fs=require('fs');var fs_extra=require(_0x6840('0xc'));var _=require('lodash');var squel=require(_0x6840('0xd'));var crypto=require(_0x6840('0xe'));var jsforce=require(_0x6840('0xf'));var deskjs=require(_0x6840('0x10'));var toCsv=require(_0x6840('0xa'));var querystring=require(_0x6840('0x11'));var Papa=require(_0x6840('0x12'));var Redis=require(_0x6840('0x13'));var authService=require(_0x6840('0x14'));var qs=require(_0x6840('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6840('0x16'));var logger=require(_0x6840('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x6840('0x18'));var licenseUtil=require(_0x6840('0x19'));var db=require(_0x6840('0x1a'))['db'];var integrations=require(_0x6840('0x1b'));function respondWithStatusCode(_0x35b32d,_0x2c2348){_0x2c2348=_0x2c2348||0xcc;return function(_0x7a6e44){if(_0x7a6e44){return _0x35b32d[_0x6840('0x1c')](_0x2c2348);}return _0x35b32d[_0x6840('0x1d')](_0x2c2348)['end']();};}function respondWithResult(_0x58a794,_0x2a0dd){_0x2a0dd=_0x2a0dd||0xc8;return function(_0x559ae1){if(_0x559ae1){return _0x58a794[_0x6840('0x1d')](_0x2a0dd)[_0x6840('0x1e')](_0x559ae1);}};}function respondWithFilteredResult(_0x201037,_0x5414a8){return function(_0x3af0bb){if(_0x3af0bb){var _0x516189=typeof _0x5414a8[_0x6840('0x1f')]===_0x6840('0x20')&&typeof _0x5414a8['limit']===_0x6840('0x20');var _0x3f62ef=_0x3af0bb[_0x6840('0x21')];var _0x555ce6=_0x516189?0x0:_0x5414a8[_0x6840('0x1f')];var _0x43f8c2=_0x516189?_0x3af0bb['count']:_0x5414a8[_0x6840('0x1f')]+_0x5414a8[_0x6840('0x22')];var _0x5f1e5a;if(_0x43f8c2>=_0x3f62ef){_0x43f8c2=_0x3f62ef;_0x5f1e5a=0xc8;}else{_0x5f1e5a=0xce;}_0x201037[_0x6840('0x1d')](_0x5f1e5a);return _0x201037['set'](_0x6840('0x23'),_0x555ce6+'-'+_0x43f8c2+'/'+_0x3f62ef)['json'](_0x3af0bb);}return null;};}function patchUpdates(_0x5b87eb){return function(_0x213b9e){try{jsonpatch[_0x6840('0x24')](_0x213b9e,_0x5b87eb,!![]);}catch(_0x9784d1){return BPromise[_0x6840('0x25')](_0x9784d1);}return _0x213b9e[_0x6840('0x26')]();};}function saveUpdates(_0x7b9dc3,_0x1b9844){return function(_0x26f710){if(_0x26f710){return _0x26f710[_0x6840('0x27')](_0x7b9dc3)[_0x6840('0x28')](function(_0x33d60a){return _0x33d60a;});}return null;};}function removeEntity(_0xf544d3,_0x2c7630){return function(_0x4f9b2e){if(_0x4f9b2e){return _0x4f9b2e[_0x6840('0x29')]()['then'](function(){_0xf544d3['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x233a80,_0x3266ba){return function(_0x3ca15e){if(!_0x3ca15e){_0x233a80[_0x6840('0x1c')](0x194);}return _0x3ca15e;};}function handleError(_0x4a4e27,_0x1b6cd7){_0x1b6cd7=_0x1b6cd7||0x1f4;return function(_0x45f02c){logger[_0x6840('0x2a')](_0x45f02c[_0x6840('0x2b')]);if(_0x45f02c[_0x6840('0x2c')]){delete _0x45f02c[_0x6840('0x2c')];}_0x4a4e27[_0x6840('0x1d')](_0x1b6cd7)[_0x6840('0x2d')](_0x45f02c);};}exports[_0x6840('0x2e')]=function(_0x1af572,_0x43421a){var _0x22b146={},_0x4e5fe9={},_0x528680={'count':0x0,'rows':[]};var _0x216d80=_['map'](db[_0x6840('0x2f')][_0x6840('0x30')],function(_0x5e42f8){return{'name':_0x5e42f8[_0x6840('0x31')],'type':_0x5e42f8[_0x6840('0x32')]['key']};});_0x4e5fe9['model']=_[_0x6840('0x33')](_0x216d80,_0x6840('0x2c'));_0x4e5fe9[_0x6840('0x34')]=_[_0x6840('0x35')](_0x1af572['query']);_0x4e5fe9[_0x6840('0x36')]=_[_0x6840('0x37')](_0x4e5fe9[_0x6840('0x38')],_0x4e5fe9[_0x6840('0x34')]);_0x22b146[_0x6840('0x39')]=_['intersection'](_0x4e5fe9[_0x6840('0x38')],qs[_0x6840('0x3a')](_0x1af572['query'][_0x6840('0x3a')]));_0x22b146[_0x6840('0x39')]=_0x22b146[_0x6840('0x39')][_0x6840('0x3b')]?_0x22b146[_0x6840('0x39')]:_0x4e5fe9[_0x6840('0x38')];if(!_0x1af572[_0x6840('0x34')][_0x6840('0x3c')](_0x6840('0x3d'))){_0x22b146['limit']=qs['limit'](_0x1af572[_0x6840('0x34')][_0x6840('0x22')]);_0x22b146[_0x6840('0x1f')]=qs[_0x6840('0x1f')](_0x1af572[_0x6840('0x34')][_0x6840('0x1f')]);}_0x22b146['order']=qs[_0x6840('0x3e')](_0x1af572[_0x6840('0x34')][_0x6840('0x3e')]);_0x22b146[_0x6840('0x3f')]=qs['filters'](_[_0x6840('0x40')](_0x1af572[_0x6840('0x34')],_0x4e5fe9[_0x6840('0x36')]),_0x216d80);if(_0x1af572[_0x6840('0x34')][_0x6840('0x41')]){_0x22b146[_0x6840('0x3f')]=_[_0x6840('0x42')](_0x22b146[_0x6840('0x3f')],{'$or':_['map'](_0x216d80,function(_0x5d692b){if(_0x5d692b['type']!==_0x6840('0x43')){var _0x193cfb={};_0x193cfb[_0x5d692b['name']]={'$like':'%'+_0x1af572[_0x6840('0x34')][_0x6840('0x41')]+'%'};return _0x193cfb;}})});}_0x22b146=_[_0x6840('0x42')]({},_0x22b146,_0x1af572['options']);var _0x2d1743={'where':_0x22b146[_0x6840('0x3f')]};return db[_0x6840('0x2f')][_0x6840('0x21')](_0x2d1743)[_0x6840('0x28')](function(_0x949357){_0x528680['count']=_0x949357;if(_0x1af572[_0x6840('0x34')]['includeAll']){_0x22b146[_0x6840('0x44')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x22b146);})[_0x6840('0x28')](function(_0x2c036a){_0x528680['rows']=_0x2c036a;return _0x528680;})['then'](respondWithFilteredResult(_0x43421a,_0x22b146))[_0x6840('0x45')](handleError(_0x43421a,null));};exports[_0x6840('0x46')]=function(_0x304857,_0x4cc50d){var _0x1dba20={'raw':![],'where':{'id':_0x304857[_0x6840('0x47')]['id']}},_0x113f6e={};_0x113f6e[_0x6840('0x38')]=_['keys'](db[_0x6840('0x2f')][_0x6840('0x30')]);_0x113f6e[_0x6840('0x34')]=_[_0x6840('0x35')](_0x304857[_0x6840('0x34')]);_0x113f6e[_0x6840('0x36')]=_[_0x6840('0x37')](_0x113f6e[_0x6840('0x38')],_0x113f6e[_0x6840('0x34')]);_0x1dba20[_0x6840('0x39')]=_[_0x6840('0x37')](_0x113f6e[_0x6840('0x38')],qs[_0x6840('0x3a')](_0x304857['query']['fields']));_0x1dba20['attributes']=_0x1dba20['attributes'][_0x6840('0x3b')]?_0x1dba20[_0x6840('0x39')]:_0x113f6e[_0x6840('0x38')];if(_0x304857[_0x6840('0x34')][_0x6840('0x48')]){_0x1dba20[_0x6840('0x44')]=[{'all':!![]}];}_0x1dba20=_['merge']({},_0x1dba20,_0x304857[_0x6840('0x49')]);return db[_0x6840('0x2f')][_0x6840('0x4a')](_0x1dba20)[_0x6840('0x28')](handleEntityNotFound(_0x4cc50d,null))[_0x6840('0x28')](respondWithResult(_0x4cc50d,null))['catch'](handleError(_0x4cc50d,null));};exports[_0x6840('0x4b')]=function(_0x51239d,_0x388df6){return db[_0x6840('0x2f')][_0x6840('0x4b')](_0x51239d['body'],{})[_0x6840('0x28')](respondWithResult(_0x388df6,0xc9))['catch'](handleError(_0x388df6,null));};exports[_0x6840('0x27')]=function(_0x104b86,_0x2b9e4f){if(_0x104b86[_0x6840('0x4c')]['id']){delete _0x104b86[_0x6840('0x4c')]['id'];}return db['SalesforceAccount'][_0x6840('0x4a')]({'where':{'id':_0x104b86[_0x6840('0x47')]['id']}})[_0x6840('0x28')](handleEntityNotFound(_0x2b9e4f,null))[_0x6840('0x28')](saveUpdates(_0x104b86['body'],null))['then'](respondWithResult(_0x2b9e4f,null))[_0x6840('0x45')](handleError(_0x2b9e4f,null));};exports[_0x6840('0x29')]=function(_0x269a33,_0x5dc647){return db[_0x6840('0x2f')][_0x6840('0x4a')]({'where':{'id':_0x269a33[_0x6840('0x47')]['id']}})['then'](handleEntityNotFound(_0x5dc647,null))[_0x6840('0x28')](removeEntity(_0x5dc647,null))[_0x6840('0x45')](handleError(_0x5dc647,null));};exports[_0x6840('0x4d')]=function(_0x5cfa42,_0x1f0a73,_0x3f02ef){var _0x1d8f94={};var _0x2b3860={};var _0x14fba5;var _0x16091f;return db[_0x6840('0x2f')][_0x6840('0x4e')]({'where':{'id':_0x5cfa42[_0x6840('0x47')]['id']}})[_0x6840('0x28')](handleEntityNotFound(_0x1f0a73,null))[_0x6840('0x28')](function(_0x510a77){if(_0x510a77){_0x14fba5=_0x510a77;_0x2b3860['model']=_[_0x6840('0x35')](db[_0x6840('0x4f')]['rawAttributes']);_0x2b3860['query']=_[_0x6840('0x35')](_0x5cfa42['query']);_0x2b3860[_0x6840('0x36')]=_['intersection'](_0x2b3860['model'],_0x2b3860[_0x6840('0x34')]);_0x1d8f94[_0x6840('0x39')]=_[_0x6840('0x37')](_0x2b3860[_0x6840('0x38')],qs[_0x6840('0x3a')](_0x5cfa42[_0x6840('0x34')][_0x6840('0x3a')]));_0x1d8f94[_0x6840('0x39')]=_0x1d8f94[_0x6840('0x39')][_0x6840('0x3b')]?_0x1d8f94[_0x6840('0x39')]:_0x2b3860[_0x6840('0x38')];_0x1d8f94['order']=qs['sort'](_0x5cfa42[_0x6840('0x34')][_0x6840('0x3e')]);_0x1d8f94[_0x6840('0x3f')]=qs[_0x6840('0x36')](_[_0x6840('0x40')](_0x5cfa42['query'],_0x2b3860[_0x6840('0x36')]));if(_0x5cfa42[_0x6840('0x34')][_0x6840('0x41')]){_0x1d8f94[_0x6840('0x3f')]=_[_0x6840('0x42')](_0x1d8f94['where'],{'$or':_[_0x6840('0x33')](_0x1d8f94[_0x6840('0x39')],function(_0x51d993){var _0x3f74fa={};_0x3f74fa[_0x51d993]={'$like':'%'+_0x5cfa42[_0x6840('0x34')][_0x6840('0x41')]+'%'};return _0x3f74fa;})});}_0x1d8f94=_[_0x6840('0x42')]({},_0x1d8f94,_0x5cfa42[_0x6840('0x49')]);return _0x14fba5[_0x6840('0x4d')](_0x1d8f94);}})[_0x6840('0x28')](function(_0x53fbc3){if(_0x53fbc3){_0x16091f=_0x53fbc3[_0x6840('0x3b')];if(!_0x5cfa42['query'][_0x6840('0x3c')]('nolimit')){_0x1d8f94['limit']=qs[_0x6840('0x22')](_0x5cfa42['query']['limit']);_0x1d8f94[_0x6840('0x1f')]=qs[_0x6840('0x1f')](_0x5cfa42[_0x6840('0x34')][_0x6840('0x1f')]);}return _0x14fba5[_0x6840('0x4d')](_0x1d8f94);}})[_0x6840('0x28')](function(_0x2db20c){if(_0x2db20c){return _0x2db20c?{'count':_0x16091f,'rows':_0x2db20c}:null;}})['then'](respondWithResult(_0x1f0a73,null))[_0x6840('0x45')](handleError(_0x1f0a73,null));};exports[_0x6840('0x50')]=function(_0x3cebf6,_0x595e79,_0x58f3e7){if(_0x3cebf6[_0x6840('0x4c')]['id']){delete _0x3cebf6[_0x6840('0x4c')]['id'];}return db[_0x6840('0x2f')][_0x6840('0x4e')]({'where':{'id':_0x3cebf6[_0x6840('0x47')]['id']}})['then'](handleEntityNotFound(_0x595e79,null))[_0x6840('0x28')](function(_0x530f78){if(_0x530f78){_0x3cebf6[_0x6840('0x4c')][_0x6840('0x51')]=_0x530f78['id'];_0x3cebf6[_0x6840('0x4c')]['Subjects']=integrations[_0x6840('0x52')](_0x3cebf6['body']['channel'],_0x3cebf6[_0x6840('0x4c')][_0x6840('0x32')]);_0x3cebf6['body'][_0x6840('0x53')]=integrations[_0x6840('0x54')](_0x3cebf6[_0x6840('0x4c')]['channel'],_0x3cebf6['body'][_0x6840('0x32')]);return db[_0x6840('0x4f')]['create'](_0x3cebf6['body'],{'include':[{'model':db[_0x6840('0x55')],'as':_0x6840('0x56')},{'model':db[_0x6840('0x55')],'as':_0x6840('0x53')}]});}return null;})['then'](respondWithResult(_0x595e79,null))[_0x6840('0x45')](handleError(_0x595e79,null));};exports[_0x6840('0x57')]=function(_0x2e7ece,_0x2911e6,_0x376c49){var _0x280cca;var _0x4c5d36='';var _0x55f9d3=_0x6840('0x58');return db[_0x6840('0x2f')]['findOne']({'where':{'id':_0x2e7ece[_0x6840('0x47')]['id']},'attributes':['id',_0x6840('0x59'),_0x6840('0x5a'),_0x6840('0x5b'),_0x6840('0x5c'),_0x6840('0x5d'),_0x6840('0x5e')]})['then'](handleEntityNotFound(_0x2911e6,null))[_0x6840('0x28')](function(_0x550ec0){if(_0x550ec0){_0x4c5d36=_0x550ec0[_0x6840('0x59')];var _0x5e0369=_0x4c5d36[_0x6840('0x5f')](-0x1);if(_0x5e0369==='/'){_0x4c5d36=_0x4c5d36[_0x6840('0x60')](0x0,_0x4c5d36[_0x6840('0x61')](_0x5e0369));}_0x280cca=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4c5d36,'clientId':_0x550ec0[_0x6840('0x5a')],'clientSecret':_0x550ec0[_0x6840('0x5b')]}});return _0x280cca[_0x6840('0x62')](_0x550ec0['username'],_0x550ec0[_0x6840('0x5d')][_0x6840('0x63')](_0x550ec0['securityToken']));}})['then'](function(_0x4516ed){if(_0x4516ed){if(!_[_0x6840('0x64')](_0x2e7ece[_0x6840('0x34')]['ticketType'])){_0x55f9d3=_0x2e7ece['query']['ticketType'];}return _0x280cca['sobject'](_0x55f9d3)[_0x6840('0x65')]();}})[_0x6840('0x28')](function(_0xc9741e){var _0x55d38b=[_0x6840('0x66'),_0x6840('0x67'),'IsReminderSet',_0x6840('0x68'),_0x6840('0x69'),_0x6840('0x6a')];var _0x2a50ef=[_0x6840('0x6b'),'int',_0x6840('0x6c'),'boolean',_0x6840('0x6d'),_0x6840('0x6e'),'phone'];if(_0xc9741e){_[_0x6840('0x6f')](_0xc9741e[_0x6840('0x3a')],function(_0x31d75a){return _0x55d38b['includes'](_0x31d75a[_0x6840('0x2c')])||!_0x2a50ef[_0x6840('0x70')](_0x31d75a[_0x6840('0x32')]);});return{'count':_0xc9741e['fields'][_0x6840('0x3b')],'rows':_['map'](_0xc9741e['fields'],function(_0x503ba0){return{'id':_0x503ba0[_0x6840('0x2c')],'name':_0x503ba0['label'],'custom':_0x503ba0['custom'],'options':_0x503ba0['picklistValues'][_0x6840('0x3b')]>0x0?_[_0x6840('0x33')](_0x503ba0[_0x6840('0x71')],function(_0x3e2ac6){return{'name':_0x3e2ac6[_0x6840('0x72')],'value':_0x3e2ac6['value']};}):_0x503ba0[_0x6840('0x32')]==_0x6840('0x73')?[{'name':_0x6840('0x74'),'value':_0x6840('0x75')},{'name':_0x6840('0x76'),'value':_0x6840('0x77')}]:[]};})};}})[_0x6840('0x28')](respondWithResult(_0x2911e6,null))[_0x6840('0x45')](function(_0xc47d60){var _0x5c3201=_0x2e7ece[_0x6840('0x34')][_0x6840('0x78')]?0x1f4:_0xc47d60[_0x6840('0x79')]||0x1f4;logger[_0x6840('0x2a')](_0x6840('0x7a'),'getFields',_0x5c3201,JSON[_0x6840('0x7b')](_0xc47d60));delete _0xc47d60[_0x6840('0x2c')];if(_0x5c3201===0x191){_0x5c3201=0x190;}_0x2911e6['status'](_0x5c3201)[_0x6840('0x2d')](_0x2e7ece[_0x6840('0x34')]['test']?{'message':_0x6840('0x7c'),'statusCode':_0xc47d60[_0x6840('0x79')]}:_0xc47d60);});}; \ No newline at end of file +var _0x1e82=['length','find','catch','create','body','params','getConfigurations','findOne','order','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','username','password','securityToken','lastIndexOf','clientSecret','login','concat','isNil','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Description','string','textarea','phone','remove','includes','custom','picklistValues','value','boolean','True','true','False','false','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0x40cdc9,_0x47256f){var _0x3d7b3b=function(_0x48db0d){while(--_0x48db0d){_0x40cdc9['push'](_0x40cdc9['shift']());}};_0x3d7b3b(++_0x47256f);}(_0x1e82,0x131));var _0x21e8=function(_0x514808,_0x3e0711){_0x514808=_0x514808-0x0;var _0x2b276b=_0x1e82[_0x514808];return _0x2b276b;};'use strict';var emlformat=require(_0x21e8('0x0'));var rimraf=require(_0x21e8('0x1'));var zipdir=require(_0x21e8('0x2'));var jsonpatch=require(_0x21e8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x21e8('0x4'));var Mustache=require(_0x21e8('0x5'));var util=require(_0x21e8('0x6'));var path=require(_0x21e8('0x7'));var sox=require(_0x21e8('0x8'));var csv=require(_0x21e8('0x9'));var ejs=require(_0x21e8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x21e8('0xb'));var squel=require(_0x21e8('0xc'));var crypto=require(_0x21e8('0xd'));var jsforce=require(_0x21e8('0xe'));var deskjs=require(_0x21e8('0xf'));var toCsv=require(_0x21e8('0x9'));var querystring=require(_0x21e8('0x10'));var Papa=require(_0x21e8('0x11'));var Redis=require(_0x21e8('0x12'));var authService=require(_0x21e8('0x13'));var qs=require(_0x21e8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x21e8('0x15'));var logger=require('../../config/logger')(_0x21e8('0x16'));var utils=require(_0x21e8('0x17'));var config=require(_0x21e8('0x18'));var licenseUtil=require(_0x21e8('0x19'));var db=require(_0x21e8('0x1a'))['db'];var integrations=require(_0x21e8('0x1b'));function respondWithStatusCode(_0x280630,_0x34f795){_0x34f795=_0x34f795||0xcc;return function(_0x5a3bf5){if(_0x5a3bf5){return _0x280630[_0x21e8('0x1c')](_0x34f795);}return _0x280630['status'](_0x34f795)['end']();};}function respondWithResult(_0xdf10a2,_0x516767){_0x516767=_0x516767||0xc8;return function(_0x18e6d8){if(_0x18e6d8){return _0xdf10a2[_0x21e8('0x1d')](_0x516767)[_0x21e8('0x1e')](_0x18e6d8);}};}function respondWithFilteredResult(_0x2d7fae,_0x224926){return function(_0x189f71){if(_0x189f71){var _0x176ecb=typeof _0x224926[_0x21e8('0x1f')]===_0x21e8('0x20')&&typeof _0x224926[_0x21e8('0x21')]===_0x21e8('0x20');var _0x5d764c=_0x189f71[_0x21e8('0x22')];var _0x1a7f0c=_0x176ecb?0x0:_0x224926['offset'];var _0x1be6ee=_0x176ecb?_0x189f71[_0x21e8('0x22')]:_0x224926[_0x21e8('0x1f')]+_0x224926['limit'];var _0x5d4d79;if(_0x1be6ee>=_0x5d764c){_0x1be6ee=_0x5d764c;_0x5d4d79=0xc8;}else{_0x5d4d79=0xce;}_0x2d7fae[_0x21e8('0x1d')](_0x5d4d79);return _0x2d7fae[_0x21e8('0x23')](_0x21e8('0x24'),_0x1a7f0c+'-'+_0x1be6ee+'/'+_0x5d764c)[_0x21e8('0x1e')](_0x189f71);}return null;};}function patchUpdates(_0x1dc56c){return function(_0x203557){try{jsonpatch['apply'](_0x203557,_0x1dc56c,!![]);}catch(_0x4de553){return BPromise[_0x21e8('0x25')](_0x4de553);}return _0x203557[_0x21e8('0x26')]();};}function saveUpdates(_0x1b3acf,_0x553e26){return function(_0xe234f6){if(_0xe234f6){return _0xe234f6[_0x21e8('0x27')](_0x1b3acf)[_0x21e8('0x28')](function(_0x45cd51){return _0x45cd51;});}return null;};}function removeEntity(_0x19d7e0,_0x563e0a){return function(_0x6df99){if(_0x6df99){return _0x6df99[_0x21e8('0x29')]()[_0x21e8('0x28')](function(){_0x19d7e0[_0x21e8('0x1d')](0xcc)[_0x21e8('0x2a')]();});}};}function handleEntityNotFound(_0x1d0103,_0x20e7ad){return function(_0x126162){if(!_0x126162){_0x1d0103['sendStatus'](0x194);}return _0x126162;};}function handleError(_0x37a680,_0x2a7687){_0x2a7687=_0x2a7687||0x1f4;return function(_0x334fa9){logger[_0x21e8('0x2b')](_0x334fa9[_0x21e8('0x2c')]);if(_0x334fa9[_0x21e8('0x2d')]){delete _0x334fa9['name'];}_0x37a680[_0x21e8('0x1d')](_0x2a7687)['send'](_0x334fa9);};}exports[_0x21e8('0x2e')]=function(_0x59365a,_0x5ec224){var _0x22bfba={},_0xb5d7e5={},_0x582a9b={'count':0x0,'rows':[]};var _0x5011d2=_[_0x21e8('0x2f')](db[_0x21e8('0x30')][_0x21e8('0x31')],function(_0x1d9c96){return{'name':_0x1d9c96[_0x21e8('0x32')],'type':_0x1d9c96[_0x21e8('0x33')][_0x21e8('0x34')]};});_0xb5d7e5[_0x21e8('0x35')]=_['map'](_0x5011d2,_0x21e8('0x2d'));_0xb5d7e5['query']=_[_0x21e8('0x36')](_0x59365a[_0x21e8('0x37')]);_0xb5d7e5[_0x21e8('0x38')]=_['intersection'](_0xb5d7e5['model'],_0xb5d7e5[_0x21e8('0x37')]);_0x22bfba[_0x21e8('0x39')]=_[_0x21e8('0x3a')](_0xb5d7e5[_0x21e8('0x35')],qs[_0x21e8('0x3b')](_0x59365a[_0x21e8('0x37')][_0x21e8('0x3b')]));_0x22bfba[_0x21e8('0x39')]=_0x22bfba[_0x21e8('0x39')]['length']?_0x22bfba[_0x21e8('0x39')]:_0xb5d7e5['model'];if(!_0x59365a[_0x21e8('0x37')][_0x21e8('0x3c')](_0x21e8('0x3d'))){_0x22bfba['limit']=qs[_0x21e8('0x21')](_0x59365a[_0x21e8('0x37')][_0x21e8('0x21')]);_0x22bfba['offset']=qs[_0x21e8('0x1f')](_0x59365a[_0x21e8('0x37')][_0x21e8('0x1f')]);}_0x22bfba['order']=qs[_0x21e8('0x3e')](_0x59365a[_0x21e8('0x37')]['sort']);_0x22bfba[_0x21e8('0x3f')]=qs[_0x21e8('0x38')](_[_0x21e8('0x40')](_0x59365a[_0x21e8('0x37')],_0xb5d7e5[_0x21e8('0x38')]),_0x5011d2);if(_0x59365a[_0x21e8('0x37')][_0x21e8('0x41')]){_0x22bfba[_0x21e8('0x3f')]=_[_0x21e8('0x42')](_0x22bfba['where'],{'$or':_['map'](_0x5011d2,function(_0x11e259){if(_0x11e259['type']!==_0x21e8('0x43')){var _0x36cd8a={};_0x36cd8a[_0x11e259[_0x21e8('0x2d')]]={'$like':'%'+_0x59365a[_0x21e8('0x37')][_0x21e8('0x41')]+'%'};return _0x36cd8a;}})});}_0x22bfba=_[_0x21e8('0x42')]({},_0x22bfba,_0x59365a[_0x21e8('0x44')]);var _0x5ac3c1={'where':_0x22bfba['where']};return db[_0x21e8('0x30')]['count'](_0x5ac3c1)[_0x21e8('0x28')](function(_0x2dbd37){_0x582a9b[_0x21e8('0x22')]=_0x2dbd37;if(_0x59365a[_0x21e8('0x37')][_0x21e8('0x45')]){_0x22bfba[_0x21e8('0x46')]=[{'all':!![]}];}return db[_0x21e8('0x30')][_0x21e8('0x47')](_0x22bfba);})[_0x21e8('0x28')](function(_0x335417){_0x582a9b[_0x21e8('0x48')]=_0x335417;return _0x582a9b;})['then'](respondWithFilteredResult(_0x5ec224,_0x22bfba))['catch'](handleError(_0x5ec224,null));};exports['show']=function(_0x32fee7,_0xb95209){var _0xdc43b1={'raw':![],'where':{'id':_0x32fee7['params']['id']}},_0x5eae10={};_0x5eae10[_0x21e8('0x35')]=_[_0x21e8('0x36')](db['SalesforceAccount']['rawAttributes']);_0x5eae10[_0x21e8('0x37')]=_[_0x21e8('0x36')](_0x32fee7['query']);_0x5eae10[_0x21e8('0x38')]=_[_0x21e8('0x3a')](_0x5eae10['model'],_0x5eae10[_0x21e8('0x37')]);_0xdc43b1[_0x21e8('0x39')]=_[_0x21e8('0x3a')](_0x5eae10['model'],qs[_0x21e8('0x3b')](_0x32fee7[_0x21e8('0x37')][_0x21e8('0x3b')]));_0xdc43b1[_0x21e8('0x39')]=_0xdc43b1[_0x21e8('0x39')][_0x21e8('0x49')]?_0xdc43b1['attributes']:_0x5eae10[_0x21e8('0x35')];if(_0x32fee7[_0x21e8('0x37')][_0x21e8('0x45')]){_0xdc43b1[_0x21e8('0x46')]=[{'all':!![]}];}_0xdc43b1=_[_0x21e8('0x42')]({},_0xdc43b1,_0x32fee7[_0x21e8('0x44')]);return db[_0x21e8('0x30')][_0x21e8('0x4a')](_0xdc43b1)[_0x21e8('0x28')](handleEntityNotFound(_0xb95209,null))[_0x21e8('0x28')](respondWithResult(_0xb95209,null))[_0x21e8('0x4b')](handleError(_0xb95209,null));};exports['create']=function(_0x4a9db9,_0x13298f){return db[_0x21e8('0x30')][_0x21e8('0x4c')](_0x4a9db9[_0x21e8('0x4d')],{})['then'](respondWithResult(_0x13298f,0xc9))['catch'](handleError(_0x13298f,null));};exports[_0x21e8('0x27')]=function(_0x27e8df,_0x43c968){if(_0x27e8df[_0x21e8('0x4d')]['id']){delete _0x27e8df[_0x21e8('0x4d')]['id'];}return db[_0x21e8('0x30')][_0x21e8('0x4a')]({'where':{'id':_0x27e8df[_0x21e8('0x4e')]['id']}})[_0x21e8('0x28')](handleEntityNotFound(_0x43c968,null))['then'](saveUpdates(_0x27e8df['body'],null))[_0x21e8('0x28')](respondWithResult(_0x43c968,null))['catch'](handleError(_0x43c968,null));};exports[_0x21e8('0x29')]=function(_0x37856f,_0x1ff182){return db[_0x21e8('0x30')][_0x21e8('0x4a')]({'where':{'id':_0x37856f[_0x21e8('0x4e')]['id']}})[_0x21e8('0x28')](handleEntityNotFound(_0x1ff182,null))[_0x21e8('0x28')](removeEntity(_0x1ff182,null))[_0x21e8('0x4b')](handleError(_0x1ff182,null));};exports[_0x21e8('0x4f')]=function(_0x218fd1,_0x77c595,_0xf9b07e){var _0x2fa6fd={};var _0x6f000e={};var _0x4424bf;var _0x33bc6c;return db['SalesforceAccount'][_0x21e8('0x50')]({'where':{'id':_0x218fd1['params']['id']}})[_0x21e8('0x28')](handleEntityNotFound(_0x77c595,null))[_0x21e8('0x28')](function(_0x400f6a){if(_0x400f6a){_0x4424bf=_0x400f6a;_0x6f000e['model']=_[_0x21e8('0x36')](db['SalesforceConfiguration']['rawAttributes']);_0x6f000e[_0x21e8('0x37')]=_[_0x21e8('0x36')](_0x218fd1['query']);_0x6f000e[_0x21e8('0x38')]=_['intersection'](_0x6f000e[_0x21e8('0x35')],_0x6f000e[_0x21e8('0x37')]);_0x2fa6fd[_0x21e8('0x39')]=_[_0x21e8('0x3a')](_0x6f000e[_0x21e8('0x35')],qs[_0x21e8('0x3b')](_0x218fd1[_0x21e8('0x37')][_0x21e8('0x3b')]));_0x2fa6fd['attributes']=_0x2fa6fd[_0x21e8('0x39')][_0x21e8('0x49')]?_0x2fa6fd[_0x21e8('0x39')]:_0x6f000e[_0x21e8('0x35')];_0x2fa6fd[_0x21e8('0x51')]=qs[_0x21e8('0x3e')](_0x218fd1['query'][_0x21e8('0x3e')]);_0x2fa6fd['where']=qs[_0x21e8('0x38')](_[_0x21e8('0x40')](_0x218fd1[_0x21e8('0x37')],_0x6f000e['filters']));if(_0x218fd1['query'][_0x21e8('0x41')]){_0x2fa6fd[_0x21e8('0x3f')]=_['merge'](_0x2fa6fd[_0x21e8('0x3f')],{'$or':_[_0x21e8('0x2f')](_0x2fa6fd[_0x21e8('0x39')],function(_0x484ae0){var _0x2a4d9f={};_0x2a4d9f[_0x484ae0]={'$like':'%'+_0x218fd1[_0x21e8('0x37')][_0x21e8('0x41')]+'%'};return _0x2a4d9f;})});}_0x2fa6fd=_[_0x21e8('0x42')]({},_0x2fa6fd,_0x218fd1[_0x21e8('0x44')]);return _0x4424bf['getConfigurations'](_0x2fa6fd);}})['then'](function(_0x2c0ec0){if(_0x2c0ec0){_0x33bc6c=_0x2c0ec0[_0x21e8('0x49')];if(!_0x218fd1[_0x21e8('0x37')][_0x21e8('0x3c')](_0x21e8('0x3d'))){_0x2fa6fd[_0x21e8('0x21')]=qs[_0x21e8('0x21')](_0x218fd1[_0x21e8('0x37')]['limit']);_0x2fa6fd[_0x21e8('0x1f')]=qs[_0x21e8('0x1f')](_0x218fd1['query'][_0x21e8('0x1f')]);}return _0x4424bf[_0x21e8('0x4f')](_0x2fa6fd);}})[_0x21e8('0x28')](function(_0x3e2685){if(_0x3e2685){return _0x3e2685?{'count':_0x33bc6c,'rows':_0x3e2685}:null;}})['then'](respondWithResult(_0x77c595,null))[_0x21e8('0x4b')](handleError(_0x77c595,null));};exports[_0x21e8('0x52')]=function(_0x438ef7,_0x57d206,_0x3ded68){if(_0x438ef7['body']['id']){delete _0x438ef7[_0x21e8('0x4d')]['id'];}return db[_0x21e8('0x30')]['findOne']({'where':{'id':_0x438ef7[_0x21e8('0x4e')]['id']}})[_0x21e8('0x28')](handleEntityNotFound(_0x57d206,null))[_0x21e8('0x28')](function(_0x121a29){if(_0x121a29){_0x438ef7[_0x21e8('0x4d')][_0x21e8('0x53')]=_0x121a29['id'];_0x438ef7[_0x21e8('0x4d')][_0x21e8('0x54')]=integrations[_0x21e8('0x55')](_0x438ef7[_0x21e8('0x4d')][_0x21e8('0x56')],_0x438ef7[_0x21e8('0x4d')][_0x21e8('0x33')]);_0x438ef7[_0x21e8('0x4d')][_0x21e8('0x57')]=integrations[_0x21e8('0x58')](_0x438ef7[_0x21e8('0x4d')][_0x21e8('0x56')],_0x438ef7[_0x21e8('0x4d')][_0x21e8('0x33')]);return db[_0x21e8('0x59')][_0x21e8('0x4c')](_0x438ef7[_0x21e8('0x4d')],{'include':[{'model':db['SalesforceField'],'as':_0x21e8('0x54')},{'model':db[_0x21e8('0x5a')],'as':'Descriptions'}]});}return null;})[_0x21e8('0x28')](respondWithResult(_0x57d206,null))['catch'](handleError(_0x57d206,null));};exports[_0x21e8('0x5b')]=function(_0x106808,_0x91d90a,_0x429ac7){var _0x26d429;var _0xb6306c='';var _0x5352fd=_0x21e8('0x5c');return db[_0x21e8('0x30')][_0x21e8('0x50')]({'where':{'id':_0x106808['params']['id']},'attributes':['id',_0x21e8('0x5d'),_0x21e8('0x5e'),'clientSecret',_0x21e8('0x5f'),_0x21e8('0x60'),_0x21e8('0x61')]})['then'](handleEntityNotFound(_0x91d90a,null))[_0x21e8('0x28')](function(_0x3cb08a){if(_0x3cb08a){_0xb6306c=_0x3cb08a[_0x21e8('0x5d')];var _0x2cd8e6=_0xb6306c['slice'](-0x1);if(_0x2cd8e6==='/'){_0xb6306c=_0xb6306c['substring'](0x0,_0xb6306c[_0x21e8('0x62')](_0x2cd8e6));}_0x26d429=new jsforce['Connection']({'oauth2':{'loginUrl':_0xb6306c,'clientId':_0x3cb08a['clientId'],'clientSecret':_0x3cb08a[_0x21e8('0x63')]}});return _0x26d429[_0x21e8('0x64')](_0x3cb08a[_0x21e8('0x5f')],_0x3cb08a[_0x21e8('0x60')][_0x21e8('0x65')](_0x3cb08a['securityToken']));}})[_0x21e8('0x28')](function(_0x27324e){if(_0x27324e){if(!_[_0x21e8('0x66')](_0x106808[_0x21e8('0x37')]['ticketType'])){_0x5352fd=_0x106808[_0x21e8('0x37')][_0x21e8('0x67')];}return _0x26d429[_0x21e8('0x68')](_0x5352fd)['describe']();}})[_0x21e8('0x28')](function(_0x294119){var _0x29dae9=['OwnerId',_0x21e8('0x69'),_0x21e8('0x6a'),_0x21e8('0x6b'),'Subject',_0x21e8('0x6c')];var _0x119e55=[_0x21e8('0x6d'),'int','picklist','boolean','email',_0x21e8('0x6e'),_0x21e8('0x6f')];if(_0x294119){_[_0x21e8('0x70')](_0x294119[_0x21e8('0x3b')],function(_0x21dc62){return _0x29dae9[_0x21e8('0x71')](_0x21dc62[_0x21e8('0x2d')])||!_0x119e55['includes'](_0x21dc62[_0x21e8('0x33')]);});return{'count':_0x294119[_0x21e8('0x3b')][_0x21e8('0x49')],'rows':_['map'](_0x294119[_0x21e8('0x3b')],function(_0x498e24){return{'id':_0x498e24[_0x21e8('0x2d')],'name':_0x498e24['label'],'custom':_0x498e24[_0x21e8('0x72')],'options':_0x498e24[_0x21e8('0x73')][_0x21e8('0x49')]>0x0?_[_0x21e8('0x2f')](_0x498e24[_0x21e8('0x73')],function(_0x3e53d3){return{'name':_0x3e53d3['label'],'value':_0x3e53d3[_0x21e8('0x74')]};}):_0x498e24[_0x21e8('0x33')]==_0x21e8('0x75')?[{'name':_0x21e8('0x76'),'value':_0x21e8('0x77')},{'name':_0x21e8('0x78'),'value':_0x21e8('0x79')}]:[]};})};}})[_0x21e8('0x28')](respondWithResult(_0x91d90a,null))['catch'](function(_0x20e61f){var _0x5c6352=_0x106808['query'][_0x21e8('0x7a')]?0x1f4:_0x20e61f['statusCode']||0x1f4;logger[_0x21e8('0x2b')](_0x21e8('0x7b'),_0x21e8('0x5b'),_0x5c6352,JSON[_0x21e8('0x7c')](_0x20e61f));delete _0x20e61f[_0x21e8('0x2d')];if(_0x5c6352===0x191){_0x5c6352=0x190;}_0x91d90a[_0x21e8('0x1d')](_0x5c6352)['send'](_0x106808['query'][_0x21e8('0x7a')]?{'message':_0x21e8('0x7d'),'statusCode':_0x20e61f['statusCode']}:_0x20e61f);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 0397bc9..6cc1f04 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 _0x01b9=['api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger'];(function(_0x19e291,_0x5052bc){var _0x5c816f=function(_0x4a9cdf){while(--_0x4a9cdf){_0x19e291['push'](_0x19e291['shift']());}};_0x5c816f(++_0x5052bc);}(_0x01b9,0xde));var _0x901b=function(_0x7b36b0,_0x2f46c5){_0x7b36b0=_0x7b36b0-0x0;var _0x2a8103=_0x01b9[_0x7b36b0];return _0x2a8103;};'use strict';var _=require('lodash');var util=require(_0x901b('0x0'));var logger=require(_0x901b('0x1'))(_0x901b('0x2'));var moment=require(_0x901b('0x3'));var BPromise=require('bluebird');var rp=require(_0x901b('0x4'));var fs=require('fs');var path=require(_0x901b('0x5'));var rimraf=require(_0x901b('0x6'));var config=require(_0x901b('0x7'));var attributes=require(_0x901b('0x8'));var integrations=require(_0x901b('0x9'));module[_0x901b('0xa')]=function(_0x5009ca,_0x4bd987){return _0x5009ca[_0x901b('0xb')](_0x901b('0xc'),attributes,{'tableName':_0x901b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc87=['request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x574e8e,_0x2b7d0b){var _0x5cf9a7=function(_0x3879e6){while(--_0x3879e6){_0x574e8e['push'](_0x574e8e['shift']());}};_0x5cf9a7(++_0x2b7d0b);}(_0xfc87,0x1ce));var _0x7fc8=function(_0x30deed,_0x17669c){_0x30deed=_0x30deed-0x0;var _0x135548=_0xfc87[_0x30deed];return _0x135548;};'use strict';var _=require(_0x7fc8('0x0'));var util=require(_0x7fc8('0x1'));var logger=require(_0x7fc8('0x2'))(_0x7fc8('0x3'));var moment=require(_0x7fc8('0x4'));var BPromise=require(_0x7fc8('0x5'));var rp=require(_0x7fc8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7fc8('0x7'));var config=require(_0x7fc8('0x8'));var attributes=require(_0x7fc8('0x9'));var integrations=require(_0x7fc8('0xa'));module['exports']=function(_0x3ebc4b,_0xafe094){return _0x3ebc4b['define'](_0x7fc8('0xb'),attributes,{'tableName':_0x7fc8('0xc'),'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 bcc3652..abd89ae 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 _0xbdf4=['jayson/promise','client','http','then','info','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','SalesforceAccount,\x20%s,\x20%s','result','catch','SalesforceAccount','options','raw','attributes','limit','include','map','model','debug','GetSalesforceAccount','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x26e051,_0x46931a){var _0x30f454=function(_0x4ffa33){while(--_0x4ffa33){_0x26e051['push'](_0x26e051['shift']());}};_0x30f454(++_0x46931a);}(_0xbdf4,0xf2));var _0x4bdf=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xbdf4[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x4bdf('0x0'));var util=require(_0x4bdf('0x1'));var moment=require(_0x4bdf('0x2'));var BPromise=require(_0x4bdf('0x3'));var rs=require(_0x4bdf('0x4'));var fs=require('fs');var Redis=require(_0x4bdf('0x5'));var db=require(_0x4bdf('0x6'))['db'];var utils=require(_0x4bdf('0x7'));var logger=require(_0x4bdf('0x8'))(_0x4bdf('0x9'));var config=require('../../config/environment');var jayson=require(_0x4bdf('0xa'));var client=jayson[_0x4bdf('0xb')][_0x4bdf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f42f4,_0x4606de,_0x4a3469){return new BPromise(function(_0x5c188b,_0x3ef128){return client['request'](_0x5f42f4,_0x4a3469)[_0x4bdf('0xd')](function(_0x1a04b1){logger[_0x4bdf('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x4606de,_0x4bdf('0xf'));logger['debug'](_0x4bdf('0x10'),_0x4606de,_0x4bdf('0xf'),JSON[_0x4bdf('0x11')](_0x1a04b1));if(_0x1a04b1['error']){if(_0x1a04b1['error'][_0x4bdf('0x12')]===0x1f4){logger[_0x4bdf('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x4606de,_0x1a04b1[_0x4bdf('0x13')][_0x4bdf('0x14')]);return _0x3ef128(_0x1a04b1[_0x4bdf('0x13')][_0x4bdf('0x14')]);}logger['error'](_0x4bdf('0x15'),_0x4606de,_0x1a04b1[_0x4bdf('0x13')][_0x4bdf('0x14')]);return _0x5c188b(_0x1a04b1[_0x4bdf('0x13')][_0x4bdf('0x14')]);}else{logger[_0x4bdf('0xe')](_0x4bdf('0x15'),_0x4606de,_0x4bdf('0xf'));_0x5c188b(_0x1a04b1[_0x4bdf('0x16')][_0x4bdf('0x14')]);}})[_0x4bdf('0x17')](function(_0x488d3d){logger[_0x4bdf('0x13')](_0x4bdf('0x15'),_0x4606de,_0x488d3d);_0x3ef128(_0x488d3d);});});}exports['GetSalesforceAccount']=function(_0x11d331){var _0x34475a=this;return new Promise(function(_0x1d689e,_0x4eecd6){return db[_0x4bdf('0x18')]['findAll']({'raw':_0x11d331[_0x4bdf('0x19')]?_0x11d331[_0x4bdf('0x19')][_0x4bdf('0x1a')]===undefined?!![]:![]:!![],'where':_0x11d331[_0x4bdf('0x19')]?_0x11d331[_0x4bdf('0x19')]['where']||null:null,'attributes':_0x11d331['options']?_0x11d331[_0x4bdf('0x19')][_0x4bdf('0x1b')]||null:null,'limit':_0x11d331[_0x4bdf('0x19')]?_0x11d331[_0x4bdf('0x19')][_0x4bdf('0x1c')]||null:null,'include':_0x11d331[_0x4bdf('0x19')]?_0x11d331[_0x4bdf('0x19')][_0x4bdf('0x1d')]?_[_0x4bdf('0x1e')](_0x11d331[_0x4bdf('0x19')][_0x4bdf('0x1d')],function(_0x378786){return{'model':db[_0x378786[_0x4bdf('0x1f')]],'as':_0x378786['as'],'attributes':_0x378786[_0x4bdf('0x1b')],'include':_0x378786['include']?_[_0x4bdf('0x1e')](_0x378786[_0x4bdf('0x1d')],function(_0x4d9a58){return{'model':db[_0x4d9a58[_0x4bdf('0x1f')]],'as':_0x4d9a58['as'],'attributes':_0x4d9a58[_0x4bdf('0x1b')],'include':_0x4d9a58['include']?_['map'](_0x4d9a58['include'],function(_0x553306){return{'model':db[_0x553306['model']],'as':_0x553306['as'],'attributes':_0x553306['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b9a6f){logger[_0x4bdf('0xe')]('GetSalesforceAccount',_0x11d331);logger[_0x4bdf('0x20')](_0x4bdf('0x21'),_0x11d331,JSON[_0x4bdf('0x11')](_0x5b9a6f));_0x1d689e(_0x5b9a6f);})['catch'](function(_0x30bc34){logger[_0x4bdf('0x13')]('GetSalesforceAccount',_0x30bc34[_0x4bdf('0x14')],_0x11d331);_0x4eecd6(_0x34475a[_0x4bdf('0x13')](0x1f4,_0x30bc34['message']));});});};exports[_0x4bdf('0x22')]=function(_0x1853dc){var _0x5d4aa3=this;return new Promise(function(_0x41689e,_0x5cfa19){return db[_0x4bdf('0x18')][_0x4bdf('0x23')]({'raw':_0x1853dc['options']?_0x1853dc[_0x4bdf('0x19')][_0x4bdf('0x1a')]===undefined?!![]:![]:!![],'where':_0x1853dc[_0x4bdf('0x19')]?_0x1853dc[_0x4bdf('0x19')]['where']||null:null,'attributes':_0x1853dc[_0x4bdf('0x19')]?_0x1853dc[_0x4bdf('0x19')][_0x4bdf('0x1b')]||null:null,'include':_0x1853dc[_0x4bdf('0x19')]?_0x1853dc[_0x4bdf('0x19')][_0x4bdf('0x1d')]?_[_0x4bdf('0x1e')](_0x1853dc[_0x4bdf('0x19')]['include'],function(_0x58e8c7){return{'model':db[_0x58e8c7[_0x4bdf('0x1f')]],'as':_0x58e8c7['as'],'attributes':_0x58e8c7[_0x4bdf('0x1b')],'include':_0x58e8c7['include']?_[_0x4bdf('0x1e')](_0x58e8c7[_0x4bdf('0x1d')],function(_0x52c0bc){return{'model':db[_0x52c0bc['model']],'as':_0x52c0bc['as'],'attributes':_0x52c0bc[_0x4bdf('0x1b')],'include':_0x52c0bc[_0x4bdf('0x1d')]?_[_0x4bdf('0x1e')](_0x52c0bc[_0x4bdf('0x1d')],function(_0x4165af){return{'model':db[_0x4165af[_0x4bdf('0x1f')]],'as':_0x4165af['as'],'attributes':_0x4165af['attributes']};}):[]};}):[]};}):[]:[]})[_0x4bdf('0xd')](function(_0x5a15ed){logger['info'](_0x4bdf('0x22'),_0x1853dc);logger[_0x4bdf('0x20')](_0x4bdf('0x22'),_0x1853dc,JSON[_0x4bdf('0x11')](_0x5a15ed));_0x41689e(_0x5a15ed);})[_0x4bdf('0x17')](function(_0x4b30bf){logger[_0x4bdf('0x13')]('ShowSalesforceAccount',_0x4b30bf['message'],_0x1853dc);_0x5cfa19(_0x5d4aa3[_0x4bdf('0x13')](0x1f4,_0x4b30bf[_0x4bdf('0x14')]));});});}; \ No newline at end of file +var _0x5d3b=['ShowSalesforceAccount','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','then','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify'];(function(_0xfc959c,_0x4660c){var _0xa12959=function(_0x474863){while(--_0x474863){_0xfc959c['push'](_0xfc959c['shift']());}};_0xa12959(++_0x4660c);}(_0x5d3b,0x1d3));var _0xb5d3=function(_0x14b302,_0x20c345){_0x14b302=_0x14b302-0x0;var _0x319f08=_0x5d3b[_0x14b302];return _0x319f08;};'use strict';var _=require(_0xb5d3('0x0'));var util=require('util');var moment=require(_0xb5d3('0x1'));var BPromise=require(_0xb5d3('0x2'));var rs=require(_0xb5d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb5d3('0x4'))['db'];var utils=require(_0xb5d3('0x5'));var logger=require('../../config/logger')(_0xb5d3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb5d3('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e825a,_0x5bf12a,_0x4b5076){return new BPromise(function(_0x3378d0,_0x107bb9){return client['request'](_0x2e825a,_0x4b5076)[_0xb5d3('0x8')](function(_0x96850c){logger[_0xb5d3('0x9')](_0xb5d3('0xa'),_0x5bf12a,'request\x20sent');logger['debug'](_0xb5d3('0xb'),_0x5bf12a,'request\x20sent',JSON['stringify'](_0x96850c));if(_0x96850c[_0xb5d3('0xc')]){if(_0x96850c[_0xb5d3('0xc')]['code']===0x1f4){logger[_0xb5d3('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x5bf12a,_0x96850c[_0xb5d3('0xc')][_0xb5d3('0xd')]);return _0x107bb9(_0x96850c[_0xb5d3('0xc')][_0xb5d3('0xd')]);}logger[_0xb5d3('0xc')](_0xb5d3('0xa'),_0x5bf12a,_0x96850c['error'][_0xb5d3('0xd')]);return _0x3378d0(_0x96850c[_0xb5d3('0xc')][_0xb5d3('0xd')]);}else{logger[_0xb5d3('0x9')]('SalesforceAccount,\x20%s,\x20%s',_0x5bf12a,'request\x20sent');_0x3378d0(_0x96850c[_0xb5d3('0xe')][_0xb5d3('0xd')]);}})[_0xb5d3('0xf')](function(_0x40fa9c){logger['error'](_0xb5d3('0xa'),_0x5bf12a,_0x40fa9c);_0x107bb9(_0x40fa9c);});});}exports[_0xb5d3('0x10')]=function(_0x1dc439){var _0x5d3e3d=this;return new Promise(function(_0xcd4b0f,_0x3889ca){return db[_0xb5d3('0x11')][_0xb5d3('0x12')]({'raw':_0x1dc439[_0xb5d3('0x13')]?_0x1dc439[_0xb5d3('0x13')][_0xb5d3('0x14')]===undefined?!![]:![]:!![],'where':_0x1dc439[_0xb5d3('0x13')]?_0x1dc439[_0xb5d3('0x13')][_0xb5d3('0x15')]||null:null,'attributes':_0x1dc439[_0xb5d3('0x13')]?_0x1dc439[_0xb5d3('0x13')][_0xb5d3('0x16')]||null:null,'limit':_0x1dc439[_0xb5d3('0x13')]?_0x1dc439[_0xb5d3('0x13')][_0xb5d3('0x17')]||null:null,'include':_0x1dc439['options']?_0x1dc439[_0xb5d3('0x13')][_0xb5d3('0x18')]?_[_0xb5d3('0x19')](_0x1dc439['options'][_0xb5d3('0x18')],function(_0x2c8dd3){return{'model':db[_0x2c8dd3[_0xb5d3('0x1a')]],'as':_0x2c8dd3['as'],'attributes':_0x2c8dd3[_0xb5d3('0x16')],'include':_0x2c8dd3[_0xb5d3('0x18')]?_[_0xb5d3('0x19')](_0x2c8dd3[_0xb5d3('0x18')],function(_0x49a4b3){return{'model':db[_0x49a4b3[_0xb5d3('0x1a')]],'as':_0x49a4b3['as'],'attributes':_0x49a4b3['attributes'],'include':_0x49a4b3[_0xb5d3('0x18')]?_[_0xb5d3('0x19')](_0x49a4b3[_0xb5d3('0x18')],function(_0x369337){return{'model':db[_0x369337[_0xb5d3('0x1a')]],'as':_0x369337['as'],'attributes':_0x369337[_0xb5d3('0x16')]};}):[]};}):[]};}):[]:[]})[_0xb5d3('0x8')](function(_0x278921){logger[_0xb5d3('0x9')](_0xb5d3('0x10'),_0x1dc439);logger[_0xb5d3('0x1b')](_0xb5d3('0x10'),_0x1dc439,JSON[_0xb5d3('0x1c')](_0x278921));_0xcd4b0f(_0x278921);})['catch'](function(_0x34f645){logger['error'](_0xb5d3('0x10'),_0x34f645[_0xb5d3('0xd')],_0x1dc439);_0x3889ca(_0x5d3e3d[_0xb5d3('0xc')](0x1f4,_0x34f645[_0xb5d3('0xd')]));});});};exports[_0xb5d3('0x1d')]=function(_0x1fc95a){var _0x517107=this;return new Promise(function(_0x2190d3,_0x214780){return db[_0xb5d3('0x11')][_0xb5d3('0x1e')]({'raw':_0x1fc95a[_0xb5d3('0x13')]?_0x1fc95a[_0xb5d3('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x1fc95a[_0xb5d3('0x13')]?_0x1fc95a[_0xb5d3('0x13')]['where']||null:null,'attributes':_0x1fc95a[_0xb5d3('0x13')]?_0x1fc95a['options'][_0xb5d3('0x16')]||null:null,'include':_0x1fc95a[_0xb5d3('0x13')]?_0x1fc95a['options'][_0xb5d3('0x18')]?_[_0xb5d3('0x19')](_0x1fc95a[_0xb5d3('0x13')][_0xb5d3('0x18')],function(_0x443920){return{'model':db[_0x443920[_0xb5d3('0x1a')]],'as':_0x443920['as'],'attributes':_0x443920[_0xb5d3('0x16')],'include':_0x443920[_0xb5d3('0x18')]?_['map'](_0x443920[_0xb5d3('0x18')],function(_0x2151da){return{'model':db[_0x2151da['model']],'as':_0x2151da['as'],'attributes':_0x2151da[_0xb5d3('0x16')],'include':_0x2151da[_0xb5d3('0x18')]?_[_0xb5d3('0x19')](_0x2151da[_0xb5d3('0x18')],function(_0x256c95){return{'model':db[_0x256c95[_0xb5d3('0x1a')]],'as':_0x256c95['as'],'attributes':_0x256c95[_0xb5d3('0x16')]};}):[]};}):[]};}):[]:[]})[_0xb5d3('0x8')](function(_0x4e3569){logger[_0xb5d3('0x9')]('ShowSalesforceAccount',_0x1fc95a);logger['debug'](_0xb5d3('0x1d'),_0x1fc95a,JSON[_0xb5d3('0x1c')](_0x4e3569));_0x2190d3(_0x4e3569);})['catch'](function(_0x44fce4){logger[_0xb5d3('0xc')](_0xb5d3('0x1d'),_0x44fce4[_0xb5d3('0xd')],_0x1fc95a);_0x214780(_0x517107[_0xb5d3('0xc')](0x1f4,_0x44fce4[_0xb5d3('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 5fece6f..9573686 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(_0x2fee0f,_0x445ff2){var _0x27b19f=function(_0x39afd7){while(--_0x39afd7){_0x2fee0f['push'](_0x2fee0f['shift']());}};_0x27b19f(++_0x445ff2);}(_0xadb5,0xad));var _0x5adb=function(_0x4073e7,_0x5b73fe){_0x4073e7=_0x4073e7-0x0;var _0x41f028=_0xadb5[_0x4073e7];return _0x41f028;};'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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x31c4f4,_0x4f2407){var _0x2d7aa8=function(_0x1625da){while(--_0x1625da){_0x31c4f4['push'](_0x31c4f4['shift']());}};_0x2d7aa8(++_0x4f2407);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index b559d5f..85c121c 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 _0xb08f=['account','nothing','lead','exports','STRING','ENUM','Case','Task','contact_lead','contact'];(function(_0x14e990,_0x171a13){var _0x7c5244=function(_0xa76c6e){while(--_0xa76c6e){_0x14e990['push'](_0x14e990['shift']());}};_0x7c5244(++_0x171a13);}(_0xb08f,0x125));var _0xfb08=function(_0x585cff,_0x166444){_0x585cff=_0x585cff-0x0;var _0x1e1470=_0xb08f[_0x585cff];return _0x1e1470;};'use strict';var Sequelize=require('sequelize');module[_0xfb08('0x0')]={'name':{'type':Sequelize[_0xfb08('0x1')]},'description':{'type':Sequelize[_0xfb08('0x1')]},'ticketType':{'type':Sequelize[_0xfb08('0x2')]('Task',_0xfb08('0x3')),'defaultValue':_0xfb08('0x4')},'moduleSearch':{'type':Sequelize[_0xfb08('0x2')](_0xfb08('0x5'),_0xfb08('0x6'),'lead','account_contact_lead',_0xfb08('0x7')),'defaultValue':_0xfb08('0x5')},'moduleCreate':{'type':Sequelize[_0xfb08('0x2')](_0xfb08('0x8'),_0xfb08('0x6'),'lead',_0xfb08('0x7')),'defaultValue':_0xfb08('0x9')},'leadId':{'type':Sequelize[_0xfb08('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xfb08('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xfb08('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xfb08('0x1')]}}; \ No newline at end of file +var _0x6222=['nothing','exports','STRING','ENUM','Task','contact','lead','account','contact_lead'];(function(_0x520563,_0x227f8d){var _0x4975c9=function(_0x2f5bd4){while(--_0x2f5bd4){_0x520563['push'](_0x520563['shift']());}};_0x4975c9(++_0x227f8d);}(_0x6222,0x9a));var _0x2622=function(_0x2dddcc,_0x2aaa07){_0x2dddcc=_0x2dddcc-0x0;var _0xd43bd0=_0x6222[_0x2dddcc];return _0xd43bd0;};'use strict';var Sequelize=require('sequelize');module[_0x2622('0x0')]={'name':{'type':Sequelize[_0x2622('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x2622('0x2')]('Task','Case'),'defaultValue':_0x2622('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x2622('0x4'),_0x2622('0x5'),'account_contact_lead',_0x2622('0x6')),'defaultValue':_0x2622('0x7')},'moduleCreate':{'type':Sequelize['ENUM'](_0x2622('0x8'),_0x2622('0x4'),_0x2622('0x5'),_0x2622('0x6')),'defaultValue':_0x2622('0x5')},'leadId':{'type':Sequelize[_0x2622('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x2622('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x2622('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 8854a17..557e621 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 _0xbc2f=['body','findOne','SalesforceField','getFields','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc2f,0x1a0));var _0xfbc2=function(_0x3cbff5,_0x560fc4){_0x3cbff5=_0x3cbff5-0x0;var _0x5b2ab6=_0xbc2f[_0x3cbff5];return _0x5b2ab6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfbc2('0x0'));var zipdir=require(_0xfbc2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfbc2('0x2'));var moment=require(_0xfbc2('0x3'));var BPromise=require(_0xfbc2('0x4'));var Mustache=require(_0xfbc2('0x5'));var util=require(_0xfbc2('0x6'));var path=require(_0xfbc2('0x7'));var sox=require(_0xfbc2('0x8'));var csv=require(_0xfbc2('0x9'));var ejs=require(_0xfbc2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbc2('0xb'));var squel=require('squel');var crypto=require(_0xfbc2('0xc'));var jsforce=require(_0xfbc2('0xd'));var deskjs=require(_0xfbc2('0xe'));var toCsv=require(_0xfbc2('0x9'));var querystring=require(_0xfbc2('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfbc2('0x10'));var qs=require(_0xfbc2('0x11'));var as=require(_0xfbc2('0x12'));var hardwareService=require(_0xfbc2('0x13'));var logger=require(_0xfbc2('0x14'))(_0xfbc2('0x15'));var utils=require(_0xfbc2('0x16'));var config=require(_0xfbc2('0x17'));var licenseUtil=require(_0xfbc2('0x18'));var db=require(_0xfbc2('0x19'))['db'];function respondWithStatusCode(_0x264d6a,_0x441cb4){_0x441cb4=_0x441cb4||0xcc;return function(_0x2af21c){if(_0x2af21c){return _0x264d6a['sendStatus'](_0x441cb4);}return _0x264d6a[_0xfbc2('0x1a')](_0x441cb4)['end']();};}function respondWithResult(_0x2f0aa7,_0x43a7f6){_0x43a7f6=_0x43a7f6||0xc8;return function(_0x1c736b){if(_0x1c736b){return _0x2f0aa7[_0xfbc2('0x1a')](_0x43a7f6)['json'](_0x1c736b);}};}function respondWithFilteredResult(_0x397fda,_0x3556aa){return function(_0x4da1de){if(_0x4da1de){var _0x27b2f9=typeof _0x3556aa[_0xfbc2('0x1b')]===_0xfbc2('0x1c')&&typeof _0x3556aa[_0xfbc2('0x1d')]===_0xfbc2('0x1c');var _0x9615a4=_0x4da1de[_0xfbc2('0x1e')];var _0x594827=_0x27b2f9?0x0:_0x3556aa['offset'];var _0x1ed686=_0x27b2f9?_0x4da1de[_0xfbc2('0x1e')]:_0x3556aa[_0xfbc2('0x1b')]+_0x3556aa[_0xfbc2('0x1d')];var _0x1ecf11;if(_0x1ed686>=_0x9615a4){_0x1ed686=_0x9615a4;_0x1ecf11=0xc8;}else{_0x1ecf11=0xce;}_0x397fda['status'](_0x1ecf11);return _0x397fda[_0xfbc2('0x1f')](_0xfbc2('0x20'),_0x594827+'-'+_0x1ed686+'/'+_0x9615a4)['json'](_0x4da1de);}return null;};}function patchUpdates(_0x13f6bb){return function(_0x203956){try{jsonpatch[_0xfbc2('0x21')](_0x203956,_0x13f6bb,!![]);}catch(_0x4115e8){return BPromise[_0xfbc2('0x22')](_0x4115e8);}return _0x203956[_0xfbc2('0x23')]();};}function saveUpdates(_0x35f301,_0x712bfc){return function(_0x412073){if(_0x412073){return _0x412073[_0xfbc2('0x24')](_0x35f301)['then'](function(_0x431051){return _0x431051;});}return null;};}function removeEntity(_0xd93b68,_0x20a0a7){return function(_0x3a12b5){if(_0x3a12b5){return _0x3a12b5[_0xfbc2('0x25')]()[_0xfbc2('0x26')](function(){_0xd93b68['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c51d2,_0x8135f6){return function(_0x35c9d6){if(!_0x35c9d6){_0x5c51d2['sendStatus'](0x194);}return _0x35c9d6;};}function handleError(_0x304074,_0x25887e){_0x25887e=_0x25887e||0x1f4;return function(_0x34dee8){logger[_0xfbc2('0x27')](_0x34dee8[_0xfbc2('0x28')]);if(_0x34dee8[_0xfbc2('0x29')]){delete _0x34dee8[_0xfbc2('0x29')];}_0x304074[_0xfbc2('0x1a')](_0x25887e)[_0xfbc2('0x2a')](_0x34dee8);};}exports[_0xfbc2('0x2b')]=function(_0x387526,_0xc6bcab){var _0x3873c1={},_0x3d7504={},_0x58e811={'count':0x0,'rows':[]};var _0x3f9bdc=_[_0xfbc2('0x2c')](db[_0xfbc2('0x2d')][_0xfbc2('0x2e')],function(_0x41ef1f){return{'name':_0x41ef1f[_0xfbc2('0x2f')],'type':_0x41ef1f[_0xfbc2('0x30')]['key']};});_0x3d7504['model']=_['map'](_0x3f9bdc,_0xfbc2('0x29'));_0x3d7504[_0xfbc2('0x31')]=_[_0xfbc2('0x32')](_0x387526[_0xfbc2('0x31')]);_0x3d7504[_0xfbc2('0x33')]=_[_0xfbc2('0x34')](_0x3d7504[_0xfbc2('0x35')],_0x3d7504['query']);_0x3873c1[_0xfbc2('0x36')]=_['intersection'](_0x3d7504['model'],qs[_0xfbc2('0x37')](_0x387526[_0xfbc2('0x31')]['fields']));_0x3873c1[_0xfbc2('0x36')]=_0x3873c1[_0xfbc2('0x36')][_0xfbc2('0x38')]?_0x3873c1[_0xfbc2('0x36')]:_0x3d7504[_0xfbc2('0x35')];if(!_0x387526['query'][_0xfbc2('0x39')](_0xfbc2('0x3a'))){_0x3873c1['limit']=qs[_0xfbc2('0x1d')](_0x387526['query']['limit']);_0x3873c1[_0xfbc2('0x1b')]=qs[_0xfbc2('0x1b')](_0x387526['query'][_0xfbc2('0x1b')]);}_0x3873c1[_0xfbc2('0x3b')]=qs[_0xfbc2('0x3c')](_0x387526[_0xfbc2('0x31')][_0xfbc2('0x3c')]);_0x3873c1[_0xfbc2('0x3d')]=qs['filters'](_[_0xfbc2('0x3e')](_0x387526['query'],_0x3d7504['filters']),_0x3f9bdc);if(_0x387526[_0xfbc2('0x31')][_0xfbc2('0x3f')]){_0x3873c1[_0xfbc2('0x3d')]=_['merge'](_0x3873c1['where'],{'$or':_[_0xfbc2('0x2c')](_0x3f9bdc,function(_0x455391){if(_0x455391[_0xfbc2('0x30')]!==_0xfbc2('0x40')){var _0x2a736f={};_0x2a736f[_0x455391[_0xfbc2('0x29')]]={'$like':'%'+_0x387526[_0xfbc2('0x31')][_0xfbc2('0x3f')]+'%'};return _0x2a736f;}})});}_0x3873c1=_[_0xfbc2('0x41')]({},_0x3873c1,_0x387526[_0xfbc2('0x42')]);var _0x4b679e={'where':_0x3873c1[_0xfbc2('0x3d')]};return db[_0xfbc2('0x2d')][_0xfbc2('0x1e')](_0x4b679e)[_0xfbc2('0x26')](function(_0x6e0a38){_0x58e811[_0xfbc2('0x1e')]=_0x6e0a38;if(_0x387526[_0xfbc2('0x31')]['includeAll']){_0x3873c1[_0xfbc2('0x43')]=[{'all':!![]}];}return db[_0xfbc2('0x2d')][_0xfbc2('0x44')](_0x3873c1);})[_0xfbc2('0x26')](function(_0x541b86){_0x58e811[_0xfbc2('0x45')]=_0x541b86;return _0x58e811;})['then'](respondWithFilteredResult(_0xc6bcab,_0x3873c1))[_0xfbc2('0x46')](handleError(_0xc6bcab,null));};exports[_0xfbc2('0x47')]=function(_0xf64bc2,_0x748120){var _0x1a17dc={'raw':![],'where':{'id':_0xf64bc2[_0xfbc2('0x48')]['id']}},_0x1aed07={};_0x1aed07[_0xfbc2('0x35')]=_[_0xfbc2('0x32')](db[_0xfbc2('0x2d')][_0xfbc2('0x2e')]);_0x1aed07[_0xfbc2('0x31')]=_[_0xfbc2('0x32')](_0xf64bc2[_0xfbc2('0x31')]);_0x1aed07[_0xfbc2('0x33')]=_[_0xfbc2('0x34')](_0x1aed07['model'],_0x1aed07[_0xfbc2('0x31')]);_0x1a17dc[_0xfbc2('0x36')]=_[_0xfbc2('0x34')](_0x1aed07[_0xfbc2('0x35')],qs[_0xfbc2('0x37')](_0xf64bc2[_0xfbc2('0x31')]['fields']));_0x1a17dc[_0xfbc2('0x36')]=_0x1a17dc[_0xfbc2('0x36')][_0xfbc2('0x38')]?_0x1a17dc[_0xfbc2('0x36')]:_0x1aed07['model'];if(_0xf64bc2[_0xfbc2('0x31')][_0xfbc2('0x49')]){_0x1a17dc[_0xfbc2('0x43')]=[{'all':!![]}];}_0x1a17dc=_[_0xfbc2('0x41')]({},_0x1a17dc,_0xf64bc2[_0xfbc2('0x42')]);return db[_0xfbc2('0x2d')][_0xfbc2('0x4a')](_0x1a17dc)['then'](handleEntityNotFound(_0x748120,null))['then'](respondWithResult(_0x748120,null))[_0xfbc2('0x46')](handleError(_0x748120,null));};exports['create']=function(_0x52e593,_0x412eae){return db[_0xfbc2('0x2d')][_0xfbc2('0x4b')](_0x52e593[_0xfbc2('0x4c')],{})['then'](respondWithResult(_0x412eae,0xc9))[_0xfbc2('0x46')](handleError(_0x412eae,null));};exports['update']=function(_0x4a53aa,_0x4c5981){if(_0x4a53aa[_0xfbc2('0x4c')]['id']){delete _0x4a53aa[_0xfbc2('0x4c')]['id'];}return db[_0xfbc2('0x2d')][_0xfbc2('0x4a')]({'where':{'id':_0x4a53aa['params']['id']}})[_0xfbc2('0x26')](handleEntityNotFound(_0x4c5981,null))['then'](saveUpdates(_0x4a53aa[_0xfbc2('0x4c')],null))[_0xfbc2('0x26')](respondWithResult(_0x4c5981,null))[_0xfbc2('0x46')](handleError(_0x4c5981,null));};exports[_0xfbc2('0x25')]=function(_0x1b8391,_0x197fdb){return db[_0xfbc2('0x2d')][_0xfbc2('0x4a')]({'where':{'id':_0x1b8391[_0xfbc2('0x48')]['id']}})[_0xfbc2('0x26')](handleEntityNotFound(_0x197fdb,null))[_0xfbc2('0x26')](removeEntity(_0x197fdb,null))[_0xfbc2('0x46')](handleError(_0x197fdb,null));};exports['getFields']=function(_0x48eded,_0x52d5be,_0x2ef1c2){var _0xe93fcd={};var _0x32702f={};var _0x2dcf54;var _0x2b3016;return db[_0xfbc2('0x2d')][_0xfbc2('0x4d')]({'where':{'id':_0x48eded[_0xfbc2('0x48')]['id']}})[_0xfbc2('0x26')](handleEntityNotFound(_0x52d5be,null))[_0xfbc2('0x26')](function(_0x233535){if(_0x233535){_0x2dcf54=_0x233535;_0x32702f[_0xfbc2('0x35')]=_[_0xfbc2('0x32')](db[_0xfbc2('0x4e')][_0xfbc2('0x2e')]);_0x32702f[_0xfbc2('0x31')]=_[_0xfbc2('0x32')](_0x48eded[_0xfbc2('0x31')]);_0x32702f[_0xfbc2('0x33')]=_[_0xfbc2('0x34')](_0x32702f['model'],_0x32702f['query']);_0xe93fcd[_0xfbc2('0x36')]=_[_0xfbc2('0x34')](_0x32702f[_0xfbc2('0x35')],qs[_0xfbc2('0x37')](_0x48eded[_0xfbc2('0x31')][_0xfbc2('0x37')]));_0xe93fcd[_0xfbc2('0x36')]=_0xe93fcd[_0xfbc2('0x36')][_0xfbc2('0x38')]?_0xe93fcd['attributes']:_0x32702f[_0xfbc2('0x35')];_0xe93fcd['order']=qs[_0xfbc2('0x3c')](_0x48eded['query'][_0xfbc2('0x3c')]);_0xe93fcd['where']=qs[_0xfbc2('0x33')](_[_0xfbc2('0x3e')](_0x48eded[_0xfbc2('0x31')],_0x32702f[_0xfbc2('0x33')]));if(_0x48eded['query'][_0xfbc2('0x3f')]){_0xe93fcd['where']=_['merge'](_0xe93fcd[_0xfbc2('0x3d')],{'$or':_[_0xfbc2('0x2c')](_0xe93fcd[_0xfbc2('0x36')],function(_0x450a27){var _0x1193ae={};_0x1193ae[_0x450a27]={'$like':'%'+_0x48eded[_0xfbc2('0x31')][_0xfbc2('0x3f')]+'%'};return _0x1193ae;})});}_0xe93fcd=_[_0xfbc2('0x41')]({},_0xe93fcd,_0x48eded[_0xfbc2('0x42')]);return _0x2dcf54[_0xfbc2('0x4f')](_0xe93fcd);}})['then'](function(_0x2a34ca){if(_0x2a34ca){_0x2b3016=_0x2a34ca[_0xfbc2('0x38')];if(!_0x48eded[_0xfbc2('0x31')][_0xfbc2('0x39')](_0xfbc2('0x3a'))){_0xe93fcd[_0xfbc2('0x1d')]=qs['limit'](_0x48eded[_0xfbc2('0x31')][_0xfbc2('0x1d')]);_0xe93fcd[_0xfbc2('0x1b')]=qs[_0xfbc2('0x1b')](_0x48eded[_0xfbc2('0x31')]['offset']);}return _0x2dcf54['getFields'](_0xe93fcd);}})['then'](function(_0x459fd3){if(_0x459fd3){return _0x459fd3?{'count':_0x2b3016,'rows':_0x459fd3}:null;}})[_0xfbc2('0x26')](respondWithResult(_0x52d5be,null))[_0xfbc2('0x46')](handleError(_0x52d5be,null));};exports[_0xfbc2('0x50')]=function(_0x37fbcd,_0x2c62c7,_0x18f1b5){var _0x59cc1e={};var _0x388f5d={};var _0x5b9446;var _0x20bb38;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x37fbcd['params']['id']}})[_0xfbc2('0x26')](handleEntityNotFound(_0x2c62c7,null))['then'](function(_0x5eb577){if(_0x5eb577){_0x5b9446=_0x5eb577;_0x388f5d[_0xfbc2('0x35')]=_[_0xfbc2('0x32')](db[_0xfbc2('0x4e')][_0xfbc2('0x2e')]);_0x388f5d[_0xfbc2('0x31')]=_[_0xfbc2('0x32')](_0x37fbcd['query']);_0x388f5d['filters']=_[_0xfbc2('0x34')](_0x388f5d['model'],_0x388f5d[_0xfbc2('0x31')]);_0x59cc1e['attributes']=_[_0xfbc2('0x34')](_0x388f5d['model'],qs[_0xfbc2('0x37')](_0x37fbcd['query'][_0xfbc2('0x37')]));_0x59cc1e[_0xfbc2('0x36')]=_0x59cc1e[_0xfbc2('0x36')][_0xfbc2('0x38')]?_0x59cc1e[_0xfbc2('0x36')]:_0x388f5d[_0xfbc2('0x35')];_0x59cc1e[_0xfbc2('0x3b')]=qs[_0xfbc2('0x3c')](_0x37fbcd[_0xfbc2('0x31')][_0xfbc2('0x3c')]);_0x59cc1e['where']=qs[_0xfbc2('0x33')](_['pick'](_0x37fbcd[_0xfbc2('0x31')],_0x388f5d[_0xfbc2('0x33')]));if(_0x37fbcd[_0xfbc2('0x31')][_0xfbc2('0x3f')]){_0x59cc1e[_0xfbc2('0x3d')]=_['merge'](_0x59cc1e[_0xfbc2('0x3d')],{'$or':_[_0xfbc2('0x2c')](_0x59cc1e[_0xfbc2('0x36')],function(_0x4bf274){var _0x1e8962={};_0x1e8962[_0x4bf274]={'$like':'%'+_0x37fbcd['query'][_0xfbc2('0x3f')]+'%'};return _0x1e8962;})});}_0x59cc1e=_[_0xfbc2('0x41')]({},_0x59cc1e,_0x37fbcd[_0xfbc2('0x42')]);return _0x5b9446[_0xfbc2('0x50')](_0x59cc1e);}})[_0xfbc2('0x26')](function(_0x2d1f9c){if(_0x2d1f9c){_0x20bb38=_0x2d1f9c[_0xfbc2('0x38')];if(!_0x37fbcd['query'][_0xfbc2('0x39')]('nolimit')){_0x59cc1e['limit']=qs['limit'](_0x37fbcd['query']['limit']);_0x59cc1e[_0xfbc2('0x1b')]=qs[_0xfbc2('0x1b')](_0x37fbcd[_0xfbc2('0x31')][_0xfbc2('0x1b')]);}return _0x5b9446[_0xfbc2('0x50')](_0x59cc1e);}})[_0xfbc2('0x26')](function(_0xde485f){if(_0xde485f){return _0xde485f?{'count':_0x20bb38,'rows':_0xde485f}:null;}})['then'](respondWithResult(_0x2c62c7,null))[_0xfbc2('0x46')](handleError(_0x2c62c7,null));};exports['getDescriptions']=function(_0x5a9525,_0xa1bf27,_0x3da7c7){var _0x3cb16f={};var _0x534380={};var _0x3a2bc8;var _0x3a3dc3;return db[_0xfbc2('0x2d')][_0xfbc2('0x4d')]({'where':{'id':_0x5a9525[_0xfbc2('0x48')]['id']}})[_0xfbc2('0x26')](handleEntityNotFound(_0xa1bf27,null))[_0xfbc2('0x26')](function(_0x4e7bbf){if(_0x4e7bbf){_0x3a2bc8=_0x4e7bbf;_0x534380[_0xfbc2('0x35')]=_[_0xfbc2('0x32')](db[_0xfbc2('0x4e')][_0xfbc2('0x2e')]);_0x534380[_0xfbc2('0x31')]=_[_0xfbc2('0x32')](_0x5a9525[_0xfbc2('0x31')]);_0x534380[_0xfbc2('0x33')]=_[_0xfbc2('0x34')](_0x534380[_0xfbc2('0x35')],_0x534380[_0xfbc2('0x31')]);_0x3cb16f[_0xfbc2('0x36')]=_['intersection'](_0x534380[_0xfbc2('0x35')],qs['fields'](_0x5a9525['query'][_0xfbc2('0x37')]));_0x3cb16f[_0xfbc2('0x36')]=_0x3cb16f[_0xfbc2('0x36')]['length']?_0x3cb16f[_0xfbc2('0x36')]:_0x534380[_0xfbc2('0x35')];_0x3cb16f[_0xfbc2('0x3b')]=qs[_0xfbc2('0x3c')](_0x5a9525['query'][_0xfbc2('0x3c')]);_0x3cb16f[_0xfbc2('0x3d')]=qs[_0xfbc2('0x33')](_[_0xfbc2('0x3e')](_0x5a9525[_0xfbc2('0x31')],_0x534380[_0xfbc2('0x33')]));if(_0x5a9525[_0xfbc2('0x31')]['filter']){_0x3cb16f[_0xfbc2('0x3d')]=_[_0xfbc2('0x41')](_0x3cb16f[_0xfbc2('0x3d')],{'$or':_[_0xfbc2('0x2c')](_0x3cb16f[_0xfbc2('0x36')],function(_0x1e8fb8){var _0x19d114={};_0x19d114[_0x1e8fb8]={'$like':'%'+_0x5a9525[_0xfbc2('0x31')][_0xfbc2('0x3f')]+'%'};return _0x19d114;})});}_0x3cb16f=_[_0xfbc2('0x41')]({},_0x3cb16f,_0x5a9525['options']);return _0x3a2bc8['getDescriptions'](_0x3cb16f);}})['then'](function(_0x6a37ec){if(_0x6a37ec){_0x3a3dc3=_0x6a37ec[_0xfbc2('0x38')];if(!_0x5a9525[_0xfbc2('0x31')][_0xfbc2('0x39')](_0xfbc2('0x3a'))){_0x3cb16f[_0xfbc2('0x1d')]=qs[_0xfbc2('0x1d')](_0x5a9525['query'][_0xfbc2('0x1d')]);_0x3cb16f[_0xfbc2('0x1b')]=qs['offset'](_0x5a9525[_0xfbc2('0x31')][_0xfbc2('0x1b')]);}return _0x3a2bc8[_0xfbc2('0x51')](_0x3cb16f);}})[_0xfbc2('0x26')](function(_0x1ca09c){if(_0x1ca09c){return _0x1ca09c?{'count':_0x3a3dc3,'rows':_0x1ca09c}:null;}})[_0xfbc2('0x26')](respondWithResult(_0xa1bf27,null))[_0xfbc2('0x46')](handleError(_0xa1bf27,null));}; \ No newline at end of file +var _0xd302=['hasOwnProperty','nolimit','order','where','filters','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','length','find','body','findOne','sort','pick','getFields','getSubjects','filter','getDescriptions','SalesforceField','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes'];(function(_0x9d1c14,_0x1e9c8a){var _0x287a63=function(_0x5ad3c5){while(--_0x5ad3c5){_0x9d1c14['push'](_0x9d1c14['shift']());}};_0x287a63(++_0x1e9c8a);}(_0xd302,0x160));var _0x2d30=function(_0x40639f,_0x57f2f2){_0x40639f=_0x40639f-0x0;var _0x1618b7=_0xd302[_0x40639f];return _0x1618b7;};'use strict';var emlformat=require(_0x2d30('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d30('0x1'));var rp=require(_0x2d30('0x2'));var moment=require(_0x2d30('0x3'));var BPromise=require(_0x2d30('0x4'));var Mustache=require(_0x2d30('0x5'));var util=require(_0x2d30('0x6'));var path=require(_0x2d30('0x7'));var sox=require(_0x2d30('0x8'));var csv=require(_0x2d30('0x9'));var ejs=require(_0x2d30('0xa'));var fs=require('fs');var fs_extra=require(_0x2d30('0xb'));var _=require('lodash');var squel=require(_0x2d30('0xc'));var crypto=require(_0x2d30('0xd'));var jsforce=require(_0x2d30('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2d30('0xf'));var Papa=require('papaparse');var Redis=require(_0x2d30('0x10'));var authService=require(_0x2d30('0x11'));var qs=require(_0x2d30('0x12'));var as=require(_0x2d30('0x13'));var hardwareService=require(_0x2d30('0x14'));var logger=require(_0x2d30('0x15'))(_0x2d30('0x16'));var utils=require(_0x2d30('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2d30('0x18'));var db=require(_0x2d30('0x19'))['db'];function respondWithStatusCode(_0xc06eb4,_0x1040f6){_0x1040f6=_0x1040f6||0xcc;return function(_0x1fc146){if(_0x1fc146){return _0xc06eb4[_0x2d30('0x1a')](_0x1040f6);}return _0xc06eb4['status'](_0x1040f6)[_0x2d30('0x1b')]();};}function respondWithResult(_0x46aab7,_0x7f2465){_0x7f2465=_0x7f2465||0xc8;return function(_0x84044){if(_0x84044){return _0x46aab7[_0x2d30('0x1c')](_0x7f2465)['json'](_0x84044);}};}function respondWithFilteredResult(_0x194e31,_0x305d2e){return function(_0x3cfcaa){if(_0x3cfcaa){var _0x2119c9=typeof _0x305d2e['offset']==='undefined'&&typeof _0x305d2e['limit']===_0x2d30('0x1d');var _0x232b88=_0x3cfcaa[_0x2d30('0x1e')];var _0x485399=_0x2119c9?0x0:_0x305d2e[_0x2d30('0x1f')];var _0x332782=_0x2119c9?_0x3cfcaa[_0x2d30('0x1e')]:_0x305d2e[_0x2d30('0x1f')]+_0x305d2e[_0x2d30('0x20')];var _0x31b687;if(_0x332782>=_0x232b88){_0x332782=_0x232b88;_0x31b687=0xc8;}else{_0x31b687=0xce;}_0x194e31[_0x2d30('0x1c')](_0x31b687);return _0x194e31[_0x2d30('0x21')](_0x2d30('0x22'),_0x485399+'-'+_0x332782+'/'+_0x232b88)[_0x2d30('0x23')](_0x3cfcaa);}return null;};}function patchUpdates(_0x58c56d){return function(_0x5f5909){try{jsonpatch[_0x2d30('0x24')](_0x5f5909,_0x58c56d,!![]);}catch(_0x5470f9){return BPromise[_0x2d30('0x25')](_0x5470f9);}return _0x5f5909[_0x2d30('0x26')]();};}function saveUpdates(_0x3422d1,_0x60c12b){return function(_0x4b5d7e){if(_0x4b5d7e){return _0x4b5d7e[_0x2d30('0x27')](_0x3422d1)[_0x2d30('0x28')](function(_0x3758ec){return _0x3758ec;});}return null;};}function removeEntity(_0x3b51a3,_0x5462dd){return function(_0x7622fe){if(_0x7622fe){return _0x7622fe[_0x2d30('0x29')]()[_0x2d30('0x28')](function(){_0x3b51a3[_0x2d30('0x1c')](0xcc)[_0x2d30('0x1b')]();});}};}function handleEntityNotFound(_0x6ffc08,_0x3b2573){return function(_0x15b3c4){if(!_0x15b3c4){_0x6ffc08[_0x2d30('0x1a')](0x194);}return _0x15b3c4;};}function handleError(_0x4e2917,_0xf1fda6){_0xf1fda6=_0xf1fda6||0x1f4;return function(_0x56c76c){logger[_0x2d30('0x2a')](_0x56c76c[_0x2d30('0x2b')]);if(_0x56c76c[_0x2d30('0x2c')]){delete _0x56c76c[_0x2d30('0x2c')];}_0x4e2917['status'](_0xf1fda6)[_0x2d30('0x2d')](_0x56c76c);};}exports['index']=function(_0x42304a,_0x1cb60e){var _0x80ee4b={},_0x531328={},_0x40def7={'count':0x0,'rows':[]};var _0x3d740a=_[_0x2d30('0x2e')](db[_0x2d30('0x2f')][_0x2d30('0x30')],function(_0x5b7b50){return{'name':_0x5b7b50[_0x2d30('0x31')],'type':_0x5b7b50[_0x2d30('0x32')][_0x2d30('0x33')]};});_0x531328[_0x2d30('0x34')]=_[_0x2d30('0x2e')](_0x3d740a,_0x2d30('0x2c'));_0x531328[_0x2d30('0x35')]=_[_0x2d30('0x36')](_0x42304a[_0x2d30('0x35')]);_0x531328['filters']=_[_0x2d30('0x37')](_0x531328['model'],_0x531328[_0x2d30('0x35')]);_0x80ee4b['attributes']=_[_0x2d30('0x37')](_0x531328['model'],qs[_0x2d30('0x38')](_0x42304a[_0x2d30('0x35')][_0x2d30('0x38')]));_0x80ee4b[_0x2d30('0x39')]=_0x80ee4b[_0x2d30('0x39')]['length']?_0x80ee4b[_0x2d30('0x39')]:_0x531328['model'];if(!_0x42304a[_0x2d30('0x35')][_0x2d30('0x3a')](_0x2d30('0x3b'))){_0x80ee4b[_0x2d30('0x20')]=qs[_0x2d30('0x20')](_0x42304a[_0x2d30('0x35')][_0x2d30('0x20')]);_0x80ee4b[_0x2d30('0x1f')]=qs[_0x2d30('0x1f')](_0x42304a['query'][_0x2d30('0x1f')]);}_0x80ee4b[_0x2d30('0x3c')]=qs['sort'](_0x42304a[_0x2d30('0x35')]['sort']);_0x80ee4b[_0x2d30('0x3d')]=qs[_0x2d30('0x3e')](_['pick'](_0x42304a[_0x2d30('0x35')],_0x531328[_0x2d30('0x3e')]),_0x3d740a);if(_0x42304a[_0x2d30('0x35')]['filter']){_0x80ee4b[_0x2d30('0x3d')]=_[_0x2d30('0x3f')](_0x80ee4b['where'],{'$or':_[_0x2d30('0x2e')](_0x3d740a,function(_0x4c369){if(_0x4c369[_0x2d30('0x32')]!==_0x2d30('0x40')){var _0x2083c5={};_0x2083c5[_0x4c369[_0x2d30('0x2c')]]={'$like':'%'+_0x42304a['query']['filter']+'%'};return _0x2083c5;}})});}_0x80ee4b=_[_0x2d30('0x3f')]({},_0x80ee4b,_0x42304a[_0x2d30('0x41')]);var _0x161bb7={'where':_0x80ee4b[_0x2d30('0x3d')]};return db[_0x2d30('0x2f')]['count'](_0x161bb7)['then'](function(_0x5e4977){_0x40def7['count']=_0x5e4977;if(_0x42304a[_0x2d30('0x35')][_0x2d30('0x42')]){_0x80ee4b['include']=[{'all':!![]}];}return db[_0x2d30('0x2f')][_0x2d30('0x43')](_0x80ee4b);})[_0x2d30('0x28')](function(_0xe6a5e){_0x40def7['rows']=_0xe6a5e;return _0x40def7;})[_0x2d30('0x28')](respondWithFilteredResult(_0x1cb60e,_0x80ee4b))[_0x2d30('0x44')](handleError(_0x1cb60e,null));};exports[_0x2d30('0x45')]=function(_0x8feb94,_0x43ceac){var _0x5540ac={'raw':![],'where':{'id':_0x8feb94[_0x2d30('0x46')]['id']}},_0x3e940d={};_0x3e940d[_0x2d30('0x34')]=_[_0x2d30('0x36')](db[_0x2d30('0x2f')][_0x2d30('0x30')]);_0x3e940d['query']=_[_0x2d30('0x36')](_0x8feb94[_0x2d30('0x35')]);_0x3e940d[_0x2d30('0x3e')]=_['intersection'](_0x3e940d[_0x2d30('0x34')],_0x3e940d[_0x2d30('0x35')]);_0x5540ac[_0x2d30('0x39')]=_[_0x2d30('0x37')](_0x3e940d['model'],qs[_0x2d30('0x38')](_0x8feb94[_0x2d30('0x35')][_0x2d30('0x38')]));_0x5540ac['attributes']=_0x5540ac[_0x2d30('0x39')][_0x2d30('0x47')]?_0x5540ac[_0x2d30('0x39')]:_0x3e940d['model'];if(_0x8feb94[_0x2d30('0x35')][_0x2d30('0x42')]){_0x5540ac['include']=[{'all':!![]}];}_0x5540ac=_[_0x2d30('0x3f')]({},_0x5540ac,_0x8feb94['options']);return db[_0x2d30('0x2f')][_0x2d30('0x48')](_0x5540ac)[_0x2d30('0x28')](handleEntityNotFound(_0x43ceac,null))['then'](respondWithResult(_0x43ceac,null))[_0x2d30('0x44')](handleError(_0x43ceac,null));};exports['create']=function(_0x25cebb,_0x3cc993){return db[_0x2d30('0x2f')]['create'](_0x25cebb[_0x2d30('0x49')],{})[_0x2d30('0x28')](respondWithResult(_0x3cc993,0xc9))['catch'](handleError(_0x3cc993,null));};exports['update']=function(_0x59bc0d,_0x339123){if(_0x59bc0d['body']['id']){delete _0x59bc0d[_0x2d30('0x49')]['id'];}return db[_0x2d30('0x2f')][_0x2d30('0x48')]({'where':{'id':_0x59bc0d['params']['id']}})[_0x2d30('0x28')](handleEntityNotFound(_0x339123,null))[_0x2d30('0x28')](saveUpdates(_0x59bc0d[_0x2d30('0x49')],null))[_0x2d30('0x28')](respondWithResult(_0x339123,null))[_0x2d30('0x44')](handleError(_0x339123,null));};exports[_0x2d30('0x29')]=function(_0x5f3f62,_0x74e47d){return db[_0x2d30('0x2f')]['find']({'where':{'id':_0x5f3f62['params']['id']}})[_0x2d30('0x28')](handleEntityNotFound(_0x74e47d,null))['then'](removeEntity(_0x74e47d,null))[_0x2d30('0x44')](handleError(_0x74e47d,null));};exports['getFields']=function(_0x4a50db,_0x40ee27,_0x558797){var _0x60fcdd={};var _0x888ada={};var _0x3dcb61;var _0x562cc1;return db['SalesforceConfiguration'][_0x2d30('0x4a')]({'where':{'id':_0x4a50db[_0x2d30('0x46')]['id']}})[_0x2d30('0x28')](handleEntityNotFound(_0x40ee27,null))[_0x2d30('0x28')](function(_0x229c94){if(_0x229c94){_0x3dcb61=_0x229c94;_0x888ada[_0x2d30('0x34')]=_[_0x2d30('0x36')](db['SalesforceField'][_0x2d30('0x30')]);_0x888ada[_0x2d30('0x35')]=_[_0x2d30('0x36')](_0x4a50db['query']);_0x888ada[_0x2d30('0x3e')]=_['intersection'](_0x888ada[_0x2d30('0x34')],_0x888ada['query']);_0x60fcdd[_0x2d30('0x39')]=_[_0x2d30('0x37')](_0x888ada[_0x2d30('0x34')],qs[_0x2d30('0x38')](_0x4a50db['query']['fields']));_0x60fcdd[_0x2d30('0x39')]=_0x60fcdd[_0x2d30('0x39')][_0x2d30('0x47')]?_0x60fcdd['attributes']:_0x888ada['model'];_0x60fcdd['order']=qs[_0x2d30('0x4b')](_0x4a50db[_0x2d30('0x35')][_0x2d30('0x4b')]);_0x60fcdd['where']=qs[_0x2d30('0x3e')](_[_0x2d30('0x4c')](_0x4a50db[_0x2d30('0x35')],_0x888ada[_0x2d30('0x3e')]));if(_0x4a50db[_0x2d30('0x35')]['filter']){_0x60fcdd[_0x2d30('0x3d')]=_[_0x2d30('0x3f')](_0x60fcdd['where'],{'$or':_[_0x2d30('0x2e')](_0x60fcdd[_0x2d30('0x39')],function(_0xe20215){var _0x18a246={};_0x18a246[_0xe20215]={'$like':'%'+_0x4a50db[_0x2d30('0x35')]['filter']+'%'};return _0x18a246;})});}_0x60fcdd=_[_0x2d30('0x3f')]({},_0x60fcdd,_0x4a50db[_0x2d30('0x41')]);return _0x3dcb61[_0x2d30('0x4d')](_0x60fcdd);}})['then'](function(_0x839ccb){if(_0x839ccb){_0x562cc1=_0x839ccb[_0x2d30('0x47')];if(!_0x4a50db['query'][_0x2d30('0x3a')](_0x2d30('0x3b'))){_0x60fcdd[_0x2d30('0x20')]=qs[_0x2d30('0x20')](_0x4a50db[_0x2d30('0x35')][_0x2d30('0x20')]);_0x60fcdd[_0x2d30('0x1f')]=qs[_0x2d30('0x1f')](_0x4a50db[_0x2d30('0x35')]['offset']);}return _0x3dcb61[_0x2d30('0x4d')](_0x60fcdd);}})[_0x2d30('0x28')](function(_0x4f8363){if(_0x4f8363){return _0x4f8363?{'count':_0x562cc1,'rows':_0x4f8363}:null;}})[_0x2d30('0x28')](respondWithResult(_0x40ee27,null))[_0x2d30('0x44')](handleError(_0x40ee27,null));};exports[_0x2d30('0x4e')]=function(_0x56fb0d,_0x5cf783,_0x500a96){var _0x106e1a={};var _0x52aaa1={};var _0x54cbc0;var _0x760e86;return db[_0x2d30('0x2f')][_0x2d30('0x4a')]({'where':{'id':_0x56fb0d[_0x2d30('0x46')]['id']}})[_0x2d30('0x28')](handleEntityNotFound(_0x5cf783,null))[_0x2d30('0x28')](function(_0x3f0ab7){if(_0x3f0ab7){_0x54cbc0=_0x3f0ab7;_0x52aaa1['model']=_[_0x2d30('0x36')](db['SalesforceField'][_0x2d30('0x30')]);_0x52aaa1[_0x2d30('0x35')]=_[_0x2d30('0x36')](_0x56fb0d[_0x2d30('0x35')]);_0x52aaa1['filters']=_['intersection'](_0x52aaa1[_0x2d30('0x34')],_0x52aaa1[_0x2d30('0x35')]);_0x106e1a[_0x2d30('0x39')]=_[_0x2d30('0x37')](_0x52aaa1[_0x2d30('0x34')],qs[_0x2d30('0x38')](_0x56fb0d[_0x2d30('0x35')][_0x2d30('0x38')]));_0x106e1a['attributes']=_0x106e1a[_0x2d30('0x39')][_0x2d30('0x47')]?_0x106e1a['attributes']:_0x52aaa1[_0x2d30('0x34')];_0x106e1a[_0x2d30('0x3c')]=qs['sort'](_0x56fb0d[_0x2d30('0x35')][_0x2d30('0x4b')]);_0x106e1a[_0x2d30('0x3d')]=qs[_0x2d30('0x3e')](_[_0x2d30('0x4c')](_0x56fb0d[_0x2d30('0x35')],_0x52aaa1[_0x2d30('0x3e')]));if(_0x56fb0d['query'][_0x2d30('0x4f')]){_0x106e1a[_0x2d30('0x3d')]=_[_0x2d30('0x3f')](_0x106e1a[_0x2d30('0x3d')],{'$or':_['map'](_0x106e1a['attributes'],function(_0x5312b6){var _0x87cf35={};_0x87cf35[_0x5312b6]={'$like':'%'+_0x56fb0d[_0x2d30('0x35')][_0x2d30('0x4f')]+'%'};return _0x87cf35;})});}_0x106e1a=_[_0x2d30('0x3f')]({},_0x106e1a,_0x56fb0d['options']);return _0x54cbc0[_0x2d30('0x4e')](_0x106e1a);}})['then'](function(_0x6808e2){if(_0x6808e2){_0x760e86=_0x6808e2['length'];if(!_0x56fb0d['query']['hasOwnProperty']('nolimit')){_0x106e1a[_0x2d30('0x20')]=qs[_0x2d30('0x20')](_0x56fb0d['query']['limit']);_0x106e1a[_0x2d30('0x1f')]=qs[_0x2d30('0x1f')](_0x56fb0d[_0x2d30('0x35')]['offset']);}return _0x54cbc0[_0x2d30('0x4e')](_0x106e1a);}})[_0x2d30('0x28')](function(_0x133204){if(_0x133204){return _0x133204?{'count':_0x760e86,'rows':_0x133204}:null;}})[_0x2d30('0x28')](respondWithResult(_0x5cf783,null))[_0x2d30('0x44')](handleError(_0x5cf783,null));};exports[_0x2d30('0x50')]=function(_0x4bf041,_0x2c97dd,_0x1931b1){var _0x31c100={};var _0x38505c={};var _0x1a991f;var _0x5d3946;return db[_0x2d30('0x2f')][_0x2d30('0x4a')]({'where':{'id':_0x4bf041['params']['id']}})[_0x2d30('0x28')](handleEntityNotFound(_0x2c97dd,null))[_0x2d30('0x28')](function(_0x2b494f){if(_0x2b494f){_0x1a991f=_0x2b494f;_0x38505c[_0x2d30('0x34')]=_[_0x2d30('0x36')](db[_0x2d30('0x51')][_0x2d30('0x30')]);_0x38505c['query']=_[_0x2d30('0x36')](_0x4bf041[_0x2d30('0x35')]);_0x38505c[_0x2d30('0x3e')]=_[_0x2d30('0x37')](_0x38505c['model'],_0x38505c[_0x2d30('0x35')]);_0x31c100['attributes']=_[_0x2d30('0x37')](_0x38505c[_0x2d30('0x34')],qs[_0x2d30('0x38')](_0x4bf041[_0x2d30('0x35')][_0x2d30('0x38')]));_0x31c100['attributes']=_0x31c100[_0x2d30('0x39')]['length']?_0x31c100[_0x2d30('0x39')]:_0x38505c['model'];_0x31c100[_0x2d30('0x3c')]=qs[_0x2d30('0x4b')](_0x4bf041[_0x2d30('0x35')][_0x2d30('0x4b')]);_0x31c100[_0x2d30('0x3d')]=qs['filters'](_['pick'](_0x4bf041[_0x2d30('0x35')],_0x38505c[_0x2d30('0x3e')]));if(_0x4bf041[_0x2d30('0x35')][_0x2d30('0x4f')]){_0x31c100['where']=_[_0x2d30('0x3f')](_0x31c100['where'],{'$or':_['map'](_0x31c100[_0x2d30('0x39')],function(_0x36e757){var _0x1b83b7={};_0x1b83b7[_0x36e757]={'$like':'%'+_0x4bf041[_0x2d30('0x35')]['filter']+'%'};return _0x1b83b7;})});}_0x31c100=_[_0x2d30('0x3f')]({},_0x31c100,_0x4bf041[_0x2d30('0x41')]);return _0x1a991f['getDescriptions'](_0x31c100);}})[_0x2d30('0x28')](function(_0x12c5f7){if(_0x12c5f7){_0x5d3946=_0x12c5f7[_0x2d30('0x47')];if(!_0x4bf041[_0x2d30('0x35')][_0x2d30('0x3a')](_0x2d30('0x3b'))){_0x31c100['limit']=qs['limit'](_0x4bf041['query']['limit']);_0x31c100[_0x2d30('0x1f')]=qs['offset'](_0x4bf041[_0x2d30('0x35')]['offset']);}return _0x1a991f[_0x2d30('0x50')](_0x31c100);}})[_0x2d30('0x28')](function(_0x43e98d){if(_0x43e98d){return _0x43e98d?{'count':_0x5d3946,'rows':_0x43e98d}:null;}})[_0x2d30('0x28')](respondWithResult(_0x2c97dd,null))[_0x2d30('0x44')](handleError(_0x2c97dd,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 461b2a0..e6772c7 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 _0x6351=['../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6351,0x1b5));var _0x1635=function(_0x2a9e93,_0x5c3054){_0x2a9e93=_0x2a9e93-0x0;var _0x1a77bc=_0x6351[_0x2a9e93];return _0x1a77bc;};'use strict';var _=require(_0x1635('0x0'));var util=require('util');var logger=require(_0x1635('0x1'))(_0x1635('0x2'));var moment=require(_0x1635('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1635('0x4'));var attributes=require(_0x1635('0x5'));module['exports']=function(_0x206101,_0x41e202){return _0x206101[_0x1635('0x6')](_0x1635('0x7'),attributes,{'tableName':_0x1635('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x722d=['./intSalesforceConfiguration.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3b9c1e,_0x404155){var _0xfa2700=function(_0x176464){while(--_0x176464){_0x3b9c1e['push'](_0x3b9c1e['shift']());}};_0xfa2700(++_0x404155);}(_0x722d,0x1ef));var _0xd722=function(_0x378752,_0x158b32){_0x378752=_0x378752-0x0;var _0xd5a262=_0x722d[_0x378752];return _0xd5a262;};'use strict';var _=require(_0xd722('0x0'));var util=require(_0xd722('0x1'));var logger=require('../../config/logger')(_0xd722('0x2'));var moment=require(_0xd722('0x3'));var BPromise=require(_0xd722('0x4'));var rp=require(_0xd722('0x5'));var fs=require('fs');var path=require(_0xd722('0x6'));var rimraf=require(_0xd722('0x7'));var config=require(_0xd722('0x8'));var attributes=require(_0xd722('0x9'));module[_0xd722('0xa')]=function(_0x29e13b,_0x218343){return _0x29e13b[_0xd722('0xb')]('SalesforceConfiguration',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 bb553a3..84bbe3e 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 _0x78ed=['http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x9c12c9,_0x2903a7){var _0x2b8ad2=function(_0x20d429){while(--_0x20d429){_0x9c12c9['push'](_0x9c12c9['shift']());}};_0x2b8ad2(++_0x2903a7);}(_0x78ed,0xf2));var _0xd78e=function(_0x4e6dd8,_0xf1aa2f){_0x4e6dd8=_0x4e6dd8-0x0;var _0x422001=_0x78ed[_0x4e6dd8];return _0x422001;};'use strict';var _=require(_0xd78e('0x0'));var util=require('util');var moment=require(_0xd78e('0x1'));var BPromise=require(_0xd78e('0x2'));var rs=require(_0xd78e('0x3'));var fs=require('fs');var Redis=require(_0xd78e('0x4'));var db=require(_0xd78e('0x5'))['db'];var utils=require(_0xd78e('0x6'));var logger=require(_0xd78e('0x7'))(_0xd78e('0x8'));var config=require(_0xd78e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd78e('0xa')][_0xd78e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27d9a3,_0x857834,_0x5d8364){return new BPromise(function(_0x51dbde,_0x263566){return client[_0xd78e('0xc')](_0x27d9a3,_0x5d8364)['then'](function(_0x504aaf){logger[_0xd78e('0xd')](_0xd78e('0xe'),_0x857834,_0xd78e('0xf'));logger['debug'](_0xd78e('0x10'),_0x857834,_0xd78e('0xf'),JSON[_0xd78e('0x11')](_0x504aaf));if(_0x504aaf['error']){if(_0x504aaf[_0xd78e('0x12')][_0xd78e('0x13')]===0x1f4){logger[_0xd78e('0x12')](_0xd78e('0xe'),_0x857834,_0x504aaf['error'][_0xd78e('0x14')]);return _0x263566(_0x504aaf['error'][_0xd78e('0x14')]);}logger[_0xd78e('0x12')](_0xd78e('0xe'),_0x857834,_0x504aaf[_0xd78e('0x12')]['message']);return _0x51dbde(_0x504aaf['error']['message']);}else{logger[_0xd78e('0xd')]('SalesforceConfiguration,\x20%s,\x20%s',_0x857834,_0xd78e('0xf'));_0x51dbde(_0x504aaf[_0xd78e('0x15')][_0xd78e('0x14')]);}})[_0xd78e('0x16')](function(_0x29a57d){logger[_0xd78e('0x12')](_0xd78e('0xe'),_0x857834,_0x29a57d);_0x263566(_0x29a57d);});});} \ No newline at end of file +var _0x709c=['stringify','error','message','result','catch','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x59cb01,_0x1f010b){var _0x491bb3=function(_0x3f2ea9){while(--_0x3f2ea9){_0x59cb01['push'](_0x59cb01['shift']());}};_0x491bb3(++_0x1f010b);}(_0x709c,0x191));var _0xc709=function(_0x584245,_0x161fa2){_0x584245=_0x584245-0x0;var _0xebb228=_0x709c[_0x584245];return _0xebb228;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc709('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc709('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xc709('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0xc709('0x3'));var jayson=require(_0xc709('0x4'));var client=jayson[_0xc709('0x5')][_0xc709('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x533c6b,_0x24933f,_0x2420bc){return new BPromise(function(_0x2c1354,_0x4fa7af){return client[_0xc709('0x7')](_0x533c6b,_0x2420bc)['then'](function(_0x54d490){logger[_0xc709('0x8')](_0xc709('0x9'),_0x24933f,_0xc709('0xa'));logger[_0xc709('0xb')](_0xc709('0xc'),_0x24933f,_0xc709('0xa'),JSON[_0xc709('0xd')](_0x54d490));if(_0x54d490[_0xc709('0xe')]){if(_0x54d490[_0xc709('0xe')]['code']===0x1f4){logger[_0xc709('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x24933f,_0x54d490[_0xc709('0xe')]['message']);return _0x4fa7af(_0x54d490[_0xc709('0xe')][_0xc709('0xf')]);}logger['error'](_0xc709('0x9'),_0x24933f,_0x54d490['error']['message']);return _0x2c1354(_0x54d490['error']['message']);}else{logger[_0xc709('0x8')](_0xc709('0x9'),_0x24933f,'request\x20sent');_0x2c1354(_0x54d490[_0xc709('0x10')][_0xc709('0xf')]);}})[_0xc709('0x11')](function(_0x4154b6){logger[_0xc709('0xe')]('SalesforceConfiguration,\x20%s,\x20%s',_0x24933f,_0x4154b6);_0x4fa7af(_0x4154b6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 2b39c7d..cbc73ea 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 _0x6a5f=['put','/:id','update','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','post'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0x6a5f,0x169));var _0xf6a5=function(_0x305c31,_0x466b17){_0x305c31=_0x305c31-0x0;var _0x17f39f=_0x6a5f[_0x305c31];return _0x17f39f;};'use strict';var multer=require('multer');var util=require(_0xf6a5('0x0'));var path=require(_0xf6a5('0x1'));var timeout=require(_0xf6a5('0x2'));var express=require(_0xf6a5('0x3'));var router=express[_0xf6a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf6a5('0x5'));var interaction=require(_0xf6a5('0x6'));var config=require(_0xf6a5('0x7'));var controller=require(_0xf6a5('0x8'));router[_0xf6a5('0x9')]('/',auth[_0xf6a5('0xa')](),controller[_0xf6a5('0xb')]);router[_0xf6a5('0x9')]('/:id',auth[_0xf6a5('0xa')](),controller['show']);router[_0xf6a5('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf6a5('0xd')](_0xf6a5('0xe'),auth[_0xf6a5('0xa')](),controller[_0xf6a5('0xf')]);router['delete'](_0xf6a5('0xe'),auth['isAuthenticated'](),controller[_0xf6a5('0x10')]);module['exports']=router; \ No newline at end of file +var _0xa317=['put','update','delete','destroy','multer','util','connect-timeout','express','Router','get','/:id','isAuthenticated','show','post'];(function(_0x442577,_0x57155d){var _0x2645d7=function(_0x17298f){while(--_0x17298f){_0x442577['push'](_0x442577['shift']());}};_0x2645d7(++_0x57155d);}(_0xa317,0x1c4));var _0x7a31=function(_0x51ae6c,_0x362db1){_0x51ae6c=_0x51ae6c-0x0;var _0x2a6f4d=_0xa317[_0x51ae6c];return _0x2a6f4d;};'use strict';var multer=require(_0x7a31('0x0'));var util=require(_0x7a31('0x1'));var path=require('path');var timeout=require(_0x7a31('0x2'));var express=require(_0x7a31('0x3'));var router=express[_0x7a31('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intSalesforceField.controller');router[_0x7a31('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7a31('0x5')](_0x7a31('0x6'),auth[_0x7a31('0x7')](),controller[_0x7a31('0x8')]);router[_0x7a31('0x9')]('/',auth[_0x7a31('0x7')](),controller['create']);router[_0x7a31('0xa')](_0x7a31('0x6'),auth[_0x7a31('0x7')](),controller[_0x7a31('0xb')]);router[_0x7a31('0xc')]('/:id',auth[_0x7a31('0x7')](),controller[_0x7a31('0xd')]);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 add47f9..d401e5c 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 _0xbc88=['keyValue','picklist','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x47a851,_0x48a7fa){var _0x159fe1=function(_0x5becb0){while(--_0x5becb0){_0x47a851['push'](_0x47a851['shift']());}};_0x159fe1(++_0x48a7fa);}(_0xbc88,0x17b));var _0x8bc8=function(_0x58a617,_0x8f65a4){_0x58a617=_0x58a617-0x0;var _0xac2670=_0xbc88[_0x58a617];return _0xac2670;};'use strict';var Sequelize=require('sequelize');module[_0x8bc8('0x0')]={'type':{'type':Sequelize[_0x8bc8('0x1')](_0x8bc8('0x2'),_0x8bc8('0x3'),_0x8bc8('0x4'),_0x8bc8('0x5'),_0x8bc8('0x6')),'defaultValue':_0x8bc8('0x2')},'content':{'type':Sequelize[_0x8bc8('0x7')]},'key':{'type':Sequelize[_0x8bc8('0x7')]},'keyType':{'type':Sequelize[_0x8bc8('0x1')](_0x8bc8('0x2'),'variable',_0x8bc8('0x4'))},'keyContent':{'type':Sequelize[_0x8bc8('0x7')]},'idField':{'type':Sequelize[_0x8bc8('0x7')]},'variableName':{'type':Sequelize[_0x8bc8('0x7')]}}; \ No newline at end of file +var _0x1836=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x584984,_0x4bb8ba){var _0x2f08e1=function(_0x1ebc6b){while(--_0x1ebc6b){_0x584984['push'](_0x584984['shift']());}};_0x2f08e1(++_0x4bb8ba);}(_0x1836,0x110));var _0x6183=function(_0x4b5daf,_0x598090){_0x4b5daf=_0x4b5daf-0x0;var _0x56f8a7=_0x1836[_0x4b5daf];return _0x56f8a7;};'use strict';var Sequelize=require(_0x6183('0x0'));module['exports']={'type':{'type':Sequelize[_0x6183('0x1')](_0x6183('0x2'),_0x6183('0x3'),_0x6183('0x4'),_0x6183('0x5'),_0x6183('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x6183('0x2'),_0x6183('0x3'),_0x6183('0x4'))},'keyContent':{'type':Sequelize[_0x6183('0x7')]},'idField':{'type':Sequelize[_0x6183('0x7')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index c74c13a..efdcae5 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 _0x3f70=['destroy','sendStatus','error','name','send','index','map','SalesforceField','rawAttributes','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','find','create','body','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then'];(function(_0x338bd1,_0x5741bc){var _0x110deb=function(_0x411ad4){while(--_0x411ad4){_0x338bd1['push'](_0x338bd1['shift']());}};_0x110deb(++_0x5741bc);}(_0x3f70,0x14c));var _0x03f7=function(_0x89d8ae,_0x40c8a1){_0x89d8ae=_0x89d8ae-0x0;var _0x2a3a01=_0x3f70[_0x89d8ae];return _0x2a3a01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x03f7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x03f7('0x1'));var rp=require(_0x03f7('0x2'));var moment=require('moment');var BPromise=require(_0x03f7('0x3'));var Mustache=require(_0x03f7('0x4'));var util=require(_0x03f7('0x5'));var path=require(_0x03f7('0x6'));var sox=require(_0x03f7('0x7'));var csv=require(_0x03f7('0x8'));var ejs=require(_0x03f7('0x9'));var fs=require('fs');var fs_extra=require(_0x03f7('0xa'));var _=require(_0x03f7('0xb'));var squel=require(_0x03f7('0xc'));var crypto=require(_0x03f7('0xd'));var jsforce=require(_0x03f7('0xe'));var deskjs=require(_0x03f7('0xf'));var toCsv=require(_0x03f7('0x8'));var querystring=require('querystring');var Papa=require(_0x03f7('0x10'));var Redis=require(_0x03f7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x03f7('0x12'));var as=require(_0x03f7('0x13'));var hardwareService=require(_0x03f7('0x14'));var logger=require(_0x03f7('0x15'))(_0x03f7('0x16'));var utils=require(_0x03f7('0x17'));var config=require(_0x03f7('0x18'));var licenseUtil=require(_0x03f7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x340beb,_0x23719f){_0x23719f=_0x23719f||0xcc;return function(_0x49a47e){if(_0x49a47e){return _0x340beb['sendStatus'](_0x23719f);}return _0x340beb[_0x03f7('0x1a')](_0x23719f)[_0x03f7('0x1b')]();};}function respondWithResult(_0xee1cf3,_0x480805){_0x480805=_0x480805||0xc8;return function(_0x39aff4){if(_0x39aff4){return _0xee1cf3[_0x03f7('0x1a')](_0x480805)[_0x03f7('0x1c')](_0x39aff4);}};}function respondWithFilteredResult(_0x298c4b,_0x5c9a01){return function(_0x4782d2){if(_0x4782d2){var _0x4c6aba=typeof _0x5c9a01[_0x03f7('0x1d')]===_0x03f7('0x1e')&&typeof _0x5c9a01[_0x03f7('0x1f')]===_0x03f7('0x1e');var _0x35700f=_0x4782d2[_0x03f7('0x20')];var _0x705026=_0x4c6aba?0x0:_0x5c9a01[_0x03f7('0x1d')];var _0x4a0dd2=_0x4c6aba?_0x4782d2[_0x03f7('0x20')]:_0x5c9a01['offset']+_0x5c9a01[_0x03f7('0x1f')];var _0x403b19;if(_0x4a0dd2>=_0x35700f){_0x4a0dd2=_0x35700f;_0x403b19=0xc8;}else{_0x403b19=0xce;}_0x298c4b[_0x03f7('0x1a')](_0x403b19);return _0x298c4b['set'](_0x03f7('0x21'),_0x705026+'-'+_0x4a0dd2+'/'+_0x35700f)[_0x03f7('0x1c')](_0x4782d2);}return null;};}function patchUpdates(_0xa78dae){return function(_0xed686a){try{jsonpatch['apply'](_0xed686a,_0xa78dae,!![]);}catch(_0x2767b9){return BPromise[_0x03f7('0x22')](_0x2767b9);}return _0xed686a[_0x03f7('0x23')]();};}function saveUpdates(_0x154d65,_0x5ae0d8){return function(_0x2a2e70){if(_0x2a2e70){return _0x2a2e70[_0x03f7('0x24')](_0x154d65)[_0x03f7('0x25')](function(_0x2a3c58){return _0x2a3c58;});}return null;};}function removeEntity(_0x5c15d3,_0x3e886d){return function(_0x151d13){if(_0x151d13){return _0x151d13[_0x03f7('0x26')]()[_0x03f7('0x25')](function(){_0x5c15d3[_0x03f7('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2dc9c2,_0x27839e){return function(_0x9f78a8){if(!_0x9f78a8){_0x2dc9c2[_0x03f7('0x27')](0x194);}return _0x9f78a8;};}function handleError(_0xeaa886,_0x4d8eaa){_0x4d8eaa=_0x4d8eaa||0x1f4;return function(_0x33f53e){logger[_0x03f7('0x28')](_0x33f53e['stack']);if(_0x33f53e[_0x03f7('0x29')]){delete _0x33f53e[_0x03f7('0x29')];}_0xeaa886[_0x03f7('0x1a')](_0x4d8eaa)[_0x03f7('0x2a')](_0x33f53e);};}exports[_0x03f7('0x2b')]=function(_0x1fa5df,_0x536c2f){var _0x476cd1={},_0x938de={},_0x537ae2={'count':0x0,'rows':[]};var _0x3d2228=_[_0x03f7('0x2c')](db[_0x03f7('0x2d')][_0x03f7('0x2e')],function(_0x4b5326){return{'name':_0x4b5326['fieldName'],'type':_0x4b5326[_0x03f7('0x2f')][_0x03f7('0x30')]};});_0x938de['model']=_[_0x03f7('0x2c')](_0x3d2228,_0x03f7('0x29'));_0x938de[_0x03f7('0x31')]=_['keys'](_0x1fa5df[_0x03f7('0x31')]);_0x938de['filters']=_[_0x03f7('0x32')](_0x938de[_0x03f7('0x33')],_0x938de[_0x03f7('0x31')]);_0x476cd1[_0x03f7('0x34')]=_[_0x03f7('0x32')](_0x938de[_0x03f7('0x33')],qs[_0x03f7('0x35')](_0x1fa5df[_0x03f7('0x31')][_0x03f7('0x35')]));_0x476cd1[_0x03f7('0x34')]=_0x476cd1['attributes'][_0x03f7('0x36')]?_0x476cd1[_0x03f7('0x34')]:_0x938de[_0x03f7('0x33')];if(!_0x1fa5df[_0x03f7('0x31')][_0x03f7('0x37')](_0x03f7('0x38'))){_0x476cd1[_0x03f7('0x1f')]=qs['limit'](_0x1fa5df[_0x03f7('0x31')]['limit']);_0x476cd1[_0x03f7('0x1d')]=qs[_0x03f7('0x1d')](_0x1fa5df[_0x03f7('0x31')][_0x03f7('0x1d')]);}_0x476cd1[_0x03f7('0x39')]=qs['sort'](_0x1fa5df[_0x03f7('0x31')]['sort']);_0x476cd1[_0x03f7('0x3a')]=qs[_0x03f7('0x3b')](_[_0x03f7('0x3c')](_0x1fa5df[_0x03f7('0x31')],_0x938de['filters']),_0x3d2228);if(_0x1fa5df[_0x03f7('0x31')][_0x03f7('0x3d')]){_0x476cd1[_0x03f7('0x3a')]=_[_0x03f7('0x3e')](_0x476cd1[_0x03f7('0x3a')],{'$or':_['map'](_0x3d2228,function(_0x535511){if(_0x535511[_0x03f7('0x2f')]!==_0x03f7('0x3f')){var _0x48269a={};_0x48269a[_0x535511[_0x03f7('0x29')]]={'$like':'%'+_0x1fa5df[_0x03f7('0x31')][_0x03f7('0x3d')]+'%'};return _0x48269a;}})});}_0x476cd1=_[_0x03f7('0x3e')]({},_0x476cd1,_0x1fa5df[_0x03f7('0x40')]);var _0x12990d={'where':_0x476cd1['where']};return db[_0x03f7('0x2d')]['count'](_0x12990d)[_0x03f7('0x25')](function(_0x52a25f){_0x537ae2['count']=_0x52a25f;if(_0x1fa5df[_0x03f7('0x31')][_0x03f7('0x41')]){_0x476cd1[_0x03f7('0x42')]=[{'all':!![]}];}return db[_0x03f7('0x2d')][_0x03f7('0x43')](_0x476cd1);})[_0x03f7('0x25')](function(_0x3d3d0c){_0x537ae2['rows']=_0x3d3d0c;return _0x537ae2;})['then'](respondWithFilteredResult(_0x536c2f,_0x476cd1))[_0x03f7('0x44')](handleError(_0x536c2f,null));};exports['show']=function(_0x410175,_0x5e3fc8){var _0x582205={'raw':!![],'where':{'id':_0x410175[_0x03f7('0x45')]['id']}},_0x3a260d={};_0x3a260d[_0x03f7('0x33')]=_['keys'](db[_0x03f7('0x2d')]['rawAttributes']);_0x3a260d[_0x03f7('0x31')]=_[_0x03f7('0x46')](_0x410175[_0x03f7('0x31')]);_0x3a260d[_0x03f7('0x3b')]=_[_0x03f7('0x32')](_0x3a260d['model'],_0x3a260d[_0x03f7('0x31')]);_0x582205[_0x03f7('0x34')]=_[_0x03f7('0x32')](_0x3a260d[_0x03f7('0x33')],qs[_0x03f7('0x35')](_0x410175[_0x03f7('0x31')]['fields']));_0x582205[_0x03f7('0x34')]=_0x582205[_0x03f7('0x34')][_0x03f7('0x36')]?_0x582205[_0x03f7('0x34')]:_0x3a260d[_0x03f7('0x33')];if(_0x410175[_0x03f7('0x31')][_0x03f7('0x41')]){_0x582205[_0x03f7('0x42')]=[{'all':!![]}];}_0x582205=_[_0x03f7('0x3e')]({},_0x582205,_0x410175[_0x03f7('0x40')]);return db['SalesforceField'][_0x03f7('0x47')](_0x582205)[_0x03f7('0x25')](handleEntityNotFound(_0x5e3fc8,null))[_0x03f7('0x25')](respondWithResult(_0x5e3fc8,null))[_0x03f7('0x44')](handleError(_0x5e3fc8,null));};exports[_0x03f7('0x48')]=function(_0x44955c,_0x999caf){return db[_0x03f7('0x2d')]['create'](_0x44955c['body'],{})[_0x03f7('0x25')](respondWithResult(_0x999caf,0xc9))[_0x03f7('0x44')](handleError(_0x999caf,null));};exports[_0x03f7('0x24')]=function(_0x2be452,_0x44644b){if(_0x2be452[_0x03f7('0x49')]['id']){delete _0x2be452[_0x03f7('0x49')]['id'];}return db[_0x03f7('0x2d')]['find']({'where':{'id':_0x2be452[_0x03f7('0x45')]['id']}})[_0x03f7('0x25')](handleEntityNotFound(_0x44644b,null))[_0x03f7('0x25')](saveUpdates(_0x2be452[_0x03f7('0x49')],null))[_0x03f7('0x25')](respondWithResult(_0x44644b,null))['catch'](handleError(_0x44644b,null));};exports[_0x03f7('0x26')]=function(_0x5653dc,_0x246540){return db['SalesforceField']['find']({'where':{'id':_0x5653dc[_0x03f7('0x45')]['id']}})[_0x03f7('0x25')](handleEntityNotFound(_0x246540,null))[_0x03f7('0x25')](removeEntity(_0x246540,null))[_0x03f7('0x44')](handleError(_0x246540,null));}; \ No newline at end of file +var _0x414b=['fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','params','includeAll','find','create','body','update','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','index','SalesforceField','rawAttributes'];(function(_0x377cd8,_0x3aaabf){var _0x2685e1=function(_0x33a342){while(--_0x33a342){_0x377cd8['push'](_0x377cd8['shift']());}};_0x2685e1(++_0x3aaabf);}(_0x414b,0xb3));var _0xb414=function(_0x588e09,_0x5e0e6e){_0x588e09=_0x588e09-0x0;var _0x17da19=_0x414b[_0x588e09];return _0x17da19;};'use strict';var emlformat=require(_0xb414('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb414('0x1'));var jsonpatch=require(_0xb414('0x2'));var rp=require(_0xb414('0x3'));var moment=require(_0xb414('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb414('0x5'));var util=require(_0xb414('0x6'));var path=require(_0xb414('0x7'));var sox=require(_0xb414('0x8'));var csv=require(_0xb414('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb414('0xa'));var _=require('lodash');var squel=require(_0xb414('0xb'));var crypto=require(_0xb414('0xc'));var jsforce=require(_0xb414('0xd'));var deskjs=require(_0xb414('0xe'));var toCsv=require(_0xb414('0x9'));var querystring=require(_0xb414('0xf'));var Papa=require(_0xb414('0x10'));var Redis=require(_0xb414('0x11'));var authService=require(_0xb414('0x12'));var qs=require(_0xb414('0x13'));var as=require(_0xb414('0x14'));var hardwareService=require(_0xb414('0x15'));var logger=require(_0xb414('0x16'))(_0xb414('0x17'));var utils=require(_0xb414('0x18'));var config=require(_0xb414('0x19'));var licenseUtil=require(_0xb414('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12b4a0,_0x3b249a){_0x3b249a=_0x3b249a||0xcc;return function(_0x40de60){if(_0x40de60){return _0x12b4a0[_0xb414('0x1b')](_0x3b249a);}return _0x12b4a0[_0xb414('0x1c')](_0x3b249a)[_0xb414('0x1d')]();};}function respondWithResult(_0x4e8dfb,_0x120fe9){_0x120fe9=_0x120fe9||0xc8;return function(_0x5342bc){if(_0x5342bc){return _0x4e8dfb[_0xb414('0x1c')](_0x120fe9)[_0xb414('0x1e')](_0x5342bc);}};}function respondWithFilteredResult(_0x1344e7,_0x9f78bc){return function(_0x4fa6db){if(_0x4fa6db){var _0x2a8179=typeof _0x9f78bc[_0xb414('0x1f')]===_0xb414('0x20')&&typeof _0x9f78bc[_0xb414('0x21')]===_0xb414('0x20');var _0xea0448=_0x4fa6db['count'];var _0x5922cf=_0x2a8179?0x0:_0x9f78bc[_0xb414('0x1f')];var _0x180125=_0x2a8179?_0x4fa6db[_0xb414('0x22')]:_0x9f78bc['offset']+_0x9f78bc[_0xb414('0x21')];var _0x497c54;if(_0x180125>=_0xea0448){_0x180125=_0xea0448;_0x497c54=0xc8;}else{_0x497c54=0xce;}_0x1344e7[_0xb414('0x1c')](_0x497c54);return _0x1344e7['set'](_0xb414('0x23'),_0x5922cf+'-'+_0x180125+'/'+_0xea0448)[_0xb414('0x1e')](_0x4fa6db);}return null;};}function patchUpdates(_0x5891d5){return function(_0x4298a0){try{jsonpatch[_0xb414('0x24')](_0x4298a0,_0x5891d5,!![]);}catch(_0xc35673){return BPromise[_0xb414('0x25')](_0xc35673);}return _0x4298a0[_0xb414('0x26')]();};}function saveUpdates(_0x18c8f9,_0x4e1503){return function(_0x56af70){if(_0x56af70){return _0x56af70['update'](_0x18c8f9)[_0xb414('0x27')](function(_0x10c080){return _0x10c080;});}return null;};}function removeEntity(_0x52708d,_0x3d491d){return function(_0x340d86){if(_0x340d86){return _0x340d86[_0xb414('0x28')]()[_0xb414('0x27')](function(){_0x52708d[_0xb414('0x1c')](0xcc)[_0xb414('0x1d')]();});}};}function handleEntityNotFound(_0xbce19,_0x412f62){return function(_0x1d52a2){if(!_0x1d52a2){_0xbce19[_0xb414('0x1b')](0x194);}return _0x1d52a2;};}function handleError(_0x358059,_0x2ca0bf){_0x2ca0bf=_0x2ca0bf||0x1f4;return function(_0x4b1874){logger['error'](_0x4b1874[_0xb414('0x29')]);if(_0x4b1874[_0xb414('0x2a')]){delete _0x4b1874['name'];}_0x358059[_0xb414('0x1c')](_0x2ca0bf)['send'](_0x4b1874);};}exports[_0xb414('0x2b')]=function(_0x2ebc21,_0x32f512){var _0x44c0f2={},_0x391dc4={},_0x761baa={'count':0x0,'rows':[]};var _0x469f6b=_['map'](db[_0xb414('0x2c')][_0xb414('0x2d')],function(_0x24b0ce){return{'name':_0x24b0ce[_0xb414('0x2e')],'type':_0x24b0ce[_0xb414('0x2f')]['key']};});_0x391dc4[_0xb414('0x30')]=_[_0xb414('0x31')](_0x469f6b,_0xb414('0x2a'));_0x391dc4[_0xb414('0x32')]=_[_0xb414('0x33')](_0x2ebc21['query']);_0x391dc4[_0xb414('0x34')]=_[_0xb414('0x35')](_0x391dc4[_0xb414('0x30')],_0x391dc4[_0xb414('0x32')]);_0x44c0f2[_0xb414('0x36')]=_['intersection'](_0x391dc4[_0xb414('0x30')],qs[_0xb414('0x37')](_0x2ebc21[_0xb414('0x32')][_0xb414('0x37')]));_0x44c0f2[_0xb414('0x36')]=_0x44c0f2[_0xb414('0x36')][_0xb414('0x38')]?_0x44c0f2[_0xb414('0x36')]:_0x391dc4[_0xb414('0x30')];if(!_0x2ebc21[_0xb414('0x32')][_0xb414('0x39')](_0xb414('0x3a'))){_0x44c0f2[_0xb414('0x21')]=qs[_0xb414('0x21')](_0x2ebc21[_0xb414('0x32')]['limit']);_0x44c0f2[_0xb414('0x1f')]=qs['offset'](_0x2ebc21[_0xb414('0x32')][_0xb414('0x1f')]);}_0x44c0f2['order']=qs[_0xb414('0x3b')](_0x2ebc21[_0xb414('0x32')][_0xb414('0x3b')]);_0x44c0f2['where']=qs[_0xb414('0x34')](_[_0xb414('0x3c')](_0x2ebc21['query'],_0x391dc4['filters']),_0x469f6b);if(_0x2ebc21[_0xb414('0x32')][_0xb414('0x3d')]){_0x44c0f2['where']=_[_0xb414('0x3e')](_0x44c0f2[_0xb414('0x3f')],{'$or':_['map'](_0x469f6b,function(_0x483a80){if(_0x483a80[_0xb414('0x2f')]!==_0xb414('0x40')){var _0x4ec121={};_0x4ec121[_0x483a80[_0xb414('0x2a')]]={'$like':'%'+_0x2ebc21[_0xb414('0x32')][_0xb414('0x3d')]+'%'};return _0x4ec121;}})});}_0x44c0f2=_['merge']({},_0x44c0f2,_0x2ebc21[_0xb414('0x41')]);var _0x4990ff={'where':_0x44c0f2[_0xb414('0x3f')]};return db['SalesforceField'][_0xb414('0x22')](_0x4990ff)[_0xb414('0x27')](function(_0x317f94){_0x761baa[_0xb414('0x22')]=_0x317f94;if(_0x2ebc21[_0xb414('0x32')]['includeAll']){_0x44c0f2[_0xb414('0x42')]=[{'all':!![]}];}return db['SalesforceField'][_0xb414('0x43')](_0x44c0f2);})['then'](function(_0x4972a2){_0x761baa['rows']=_0x4972a2;return _0x761baa;})[_0xb414('0x27')](respondWithFilteredResult(_0x32f512,_0x44c0f2))['catch'](handleError(_0x32f512,null));};exports['show']=function(_0x6f9100,_0x2d430e){var _0xcbf088={'raw':!![],'where':{'id':_0x6f9100[_0xb414('0x44')]['id']}},_0x12bc98={};_0x12bc98['model']=_[_0xb414('0x33')](db[_0xb414('0x2c')][_0xb414('0x2d')]);_0x12bc98[_0xb414('0x32')]=_['keys'](_0x6f9100['query']);_0x12bc98[_0xb414('0x34')]=_[_0xb414('0x35')](_0x12bc98['model'],_0x12bc98[_0xb414('0x32')]);_0xcbf088[_0xb414('0x36')]=_[_0xb414('0x35')](_0x12bc98[_0xb414('0x30')],qs[_0xb414('0x37')](_0x6f9100['query']['fields']));_0xcbf088[_0xb414('0x36')]=_0xcbf088[_0xb414('0x36')][_0xb414('0x38')]?_0xcbf088[_0xb414('0x36')]:_0x12bc98[_0xb414('0x30')];if(_0x6f9100[_0xb414('0x32')][_0xb414('0x45')]){_0xcbf088[_0xb414('0x42')]=[{'all':!![]}];}_0xcbf088=_[_0xb414('0x3e')]({},_0xcbf088,_0x6f9100['options']);return db[_0xb414('0x2c')][_0xb414('0x46')](_0xcbf088)[_0xb414('0x27')](handleEntityNotFound(_0x2d430e,null))[_0xb414('0x27')](respondWithResult(_0x2d430e,null))['catch'](handleError(_0x2d430e,null));};exports[_0xb414('0x47')]=function(_0x446706,_0x2c9a84){return db[_0xb414('0x2c')][_0xb414('0x47')](_0x446706[_0xb414('0x48')],{})[_0xb414('0x27')](respondWithResult(_0x2c9a84,0xc9))['catch'](handleError(_0x2c9a84,null));};exports[_0xb414('0x49')]=function(_0x427295,_0x339876){if(_0x427295[_0xb414('0x48')]['id']){delete _0x427295[_0xb414('0x48')]['id'];}return db[_0xb414('0x2c')][_0xb414('0x46')]({'where':{'id':_0x427295['params']['id']}})['then'](handleEntityNotFound(_0x339876,null))[_0xb414('0x27')](saveUpdates(_0x427295[_0xb414('0x48')],null))[_0xb414('0x27')](respondWithResult(_0x339876,null))[_0xb414('0x4a')](handleError(_0x339876,null));};exports[_0xb414('0x28')]=function(_0x1967d,_0x391bd0){return db[_0xb414('0x2c')]['find']({'where':{'id':_0x1967d[_0xb414('0x44')]['id']}})[_0xb414('0x27')](handleEntityNotFound(_0x391bd0,null))[_0xb414('0x27')](removeEntity(_0x391bd0,null))[_0xb414('0x4a')](handleError(_0x391bd0,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index de8419b..38129d1 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 _0x846f=['path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x53b704,_0x5f24cb){var _0x90f538=function(_0x5e60d9){while(--_0x5e60d9){_0x53b704['push'](_0x53b704['shift']());}};_0x90f538(++_0x5f24cb);}(_0x846f,0xdb));var _0xf846=function(_0x291742,_0x28697d){_0x291742=_0x291742-0x0;var _0x3b3cea=_0x846f[_0x291742];return _0x3b3cea;};'use strict';var _=require(_0xf846('0x0'));var util=require('util');var logger=require(_0xf846('0x1'))(_0xf846('0x2'));var moment=require('moment');var BPromise=require(_0xf846('0x3'));var rp=require(_0xf846('0x4'));var fs=require('fs');var path=require(_0xf846('0x5'));var rimraf=require(_0xf846('0x6'));var config=require(_0xf846('0x7'));var attributes=require(_0xf846('0x8'));module[_0xf846('0x9')]=function(_0x5b5ed9,_0x44ce5e){return _0x5b5ed9[_0xf846('0xa')](_0xf846('0xb'),attributes,{'tableName':_0xf846('0xc'),'paranoid':![],'indexes':[{'name':_0xf846('0xd'),'fields':[_0xf846('0xe'),_0xf846('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ae9=['salesforce_unique_index','FieldId','lodash','util','../../config/logger','api','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields'];(function(_0x5f0501,_0x19196e){var _0x3c2c45=function(_0x107fe6){while(--_0x107fe6){_0x5f0501['push'](_0x5f0501['shift']());}};_0x3c2c45(++_0x19196e);}(_0x2ae9,0x86));var _0x92ae=function(_0x5bbb86,_0x31386a){_0x5bbb86=_0x5bbb86-0x0;var _0x41f61d=_0x2ae9[_0x5bbb86];return _0x41f61d;};'use strict';var _=require(_0x92ae('0x0'));var util=require(_0x92ae('0x1'));var logger=require(_0x92ae('0x2'))(_0x92ae('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x92ae('0x4'));var attributes=require(_0x92ae('0x5'));module[_0x92ae('0x6')]=function(_0x209770,_0x20291c){return _0x209770['define'](_0x92ae('0x7'),attributes,{'tableName':_0x92ae('0x8'),'paranoid':![],'indexes':[{'name':_0x92ae('0x9'),'fields':['idField',_0x92ae('0xa')],'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 abf3a8b..8c6befc 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 _0xb0ac=['catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','result'];(function(_0x4b6d4d,_0x211c58){var _0x2a109c=function(_0x41c794){while(--_0x41c794){_0x4b6d4d['push'](_0x4b6d4d['shift']());}};_0x2a109c(++_0x211c58);}(_0xb0ac,0x17b));var _0xcb0a=function(_0xadf9eb,_0x21e85f){_0xadf9eb=_0xadf9eb-0x0;var _0x2646e7=_0xb0ac[_0xadf9eb];return _0x2646e7;};'use strict';var _=require(_0xcb0a('0x0'));var util=require(_0xcb0a('0x1'));var moment=require('moment');var BPromise=require(_0xcb0a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb0a('0x3'));var db=require(_0xcb0a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcb0a('0x5'));var config=require('../../config/environment');var jayson=require(_0xcb0a('0x6'));var client=jayson[_0xcb0a('0x7')][_0xcb0a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x287212,_0x2145be,_0x558d41){return new BPromise(function(_0x5ba00f,_0x19ff75){return client[_0xcb0a('0x9')](_0x287212,_0x558d41)[_0xcb0a('0xa')](function(_0x3fe94d){logger[_0xcb0a('0xb')]('SalesforceField,\x20%s,\x20%s',_0x2145be,_0xcb0a('0xc'));logger[_0xcb0a('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x2145be,_0xcb0a('0xc'),JSON[_0xcb0a('0xe')](_0x3fe94d));if(_0x3fe94d['error']){if(_0x3fe94d[_0xcb0a('0xf')][_0xcb0a('0x10')]===0x1f4){logger['error'](_0xcb0a('0x11'),_0x2145be,_0x3fe94d[_0xcb0a('0xf')][_0xcb0a('0x12')]);return _0x19ff75(_0x3fe94d['error']['message']);}logger[_0xcb0a('0xf')](_0xcb0a('0x11'),_0x2145be,_0x3fe94d[_0xcb0a('0xf')][_0xcb0a('0x12')]);return _0x5ba00f(_0x3fe94d[_0xcb0a('0xf')][_0xcb0a('0x12')]);}else{logger[_0xcb0a('0xb')](_0xcb0a('0x11'),_0x2145be,_0xcb0a('0xc'));_0x5ba00f(_0x3fe94d[_0xcb0a('0x13')][_0xcb0a('0x12')]);}})[_0xcb0a('0x14')](function(_0x77049){logger[_0xcb0a('0xf')](_0xcb0a('0x11'),_0x2145be,_0x77049);_0x19ff75(_0x77049);});});} \ No newline at end of file +var _0x1fe0=['error','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x25963d,_0x236466){var _0x29b6a2=function(_0x428212){while(--_0x428212){_0x25963d['push'](_0x25963d['shift']());}};_0x29b6a2(++_0x236466);}(_0x1fe0,0xcd));var _0x01fe=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x1fe0[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x01fe('0x0'));var util=require(_0x01fe('0x1'));var moment=require('moment');var BPromise=require(_0x01fe('0x2'));var rs=require(_0x01fe('0x3'));var fs=require('fs');var Redis=require(_0x01fe('0x4'));var db=require(_0x01fe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x01fe('0x6'))(_0x01fe('0x7'));var config=require(_0x01fe('0x8'));var jayson=require(_0x01fe('0x9'));var client=jayson[_0x01fe('0xa')][_0x01fe('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x258709,_0x559aaa,_0x1caba3){return new BPromise(function(_0x43c4fd,_0x4c147d){return client[_0x01fe('0xc')](_0x258709,_0x1caba3)[_0x01fe('0xd')](function(_0x1b8ca3){logger['info'](_0x01fe('0xe'),_0x559aaa,_0x01fe('0xf'));logger[_0x01fe('0x10')](_0x01fe('0x11'),_0x559aaa,_0x01fe('0xf'),JSON[_0x01fe('0x12')](_0x1b8ca3));if(_0x1b8ca3['error']){if(_0x1b8ca3['error'][_0x01fe('0x13')]===0x1f4){logger['error'](_0x01fe('0xe'),_0x559aaa,_0x1b8ca3[_0x01fe('0x14')][_0x01fe('0x15')]);return _0x4c147d(_0x1b8ca3[_0x01fe('0x14')][_0x01fe('0x15')]);}logger[_0x01fe('0x14')](_0x01fe('0xe'),_0x559aaa,_0x1b8ca3[_0x01fe('0x14')][_0x01fe('0x15')]);return _0x43c4fd(_0x1b8ca3[_0x01fe('0x14')]['message']);}else{logger[_0x01fe('0x16')](_0x01fe('0xe'),_0x559aaa,_0x01fe('0xf'));_0x43c4fd(_0x1b8ca3[_0x01fe('0x17')][_0x01fe('0x15')]);}})[_0x01fe('0x18')](function(_0x50c7f2){logger[_0x01fe('0x14')]('SalesforceField,\x20%s,\x20%s',_0x559aaa,_0x50c7f2);_0x4c147d(_0x50c7f2);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 5552d23..3279ff8 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 _0xfda0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util'];(function(_0x1eab98,_0x5148a1){var _0x25816d=function(_0x4a3b35){while(--_0x4a3b35){_0x1eab98['push'](_0x1eab98['shift']());}};_0x25816d(++_0x5148a1);}(_0xfda0,0xee));var _0x0fda=function(_0x50de1e,_0x49d24c){_0x50de1e=_0x50de1e-0x0;var _0x57b928=_0xfda0[_0x50de1e];return _0x57b928;};'use strict';var multer=require(_0x0fda('0x0'));var util=require(_0x0fda('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0fda('0x2'));var router=express[_0x0fda('0x3')]();var fs_extra=require(_0x0fda('0x4'));var auth=require(_0x0fda('0x5'));var interaction=require(_0x0fda('0x6'));var config=require(_0x0fda('0x7'));var controller=require(_0x0fda('0x8'));router[_0x0fda('0x9')]('/',auth[_0x0fda('0xa')](),controller['index']);router[_0x0fda('0x9')](_0x0fda('0xb'),auth[_0x0fda('0xa')](),controller[_0x0fda('0xc')]);router[_0x0fda('0x9')](_0x0fda('0xd'),auth['isAuthenticated'](),controller[_0x0fda('0xe')]);router['get'](_0x0fda('0xf'),auth['isAuthenticated'](),controller[_0x0fda('0x10')]);router[_0x0fda('0x11')]('/',auth[_0x0fda('0xa')](),controller[_0x0fda('0x12')]);router[_0x0fda('0x11')](_0x0fda('0xd'),auth[_0x0fda('0xa')](),controller[_0x0fda('0x13')]);router[_0x0fda('0x14')](_0x0fda('0xb'),auth[_0x0fda('0xa')](),controller[_0x0fda('0x15')]);router[_0x0fda('0x16')](_0x0fda('0xb'),auth[_0x0fda('0xa')](),controller['destroy']);module[_0x0fda('0x17')]=router; \ No newline at end of file +var _0xf69b=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','util','connect-timeout','Router','fs-extra'];(function(_0x3cba93,_0x5c2fd8){var _0x4a2991=function(_0x3cf95b){while(--_0x3cf95b){_0x3cba93['push'](_0x3cba93['shift']());}};_0x4a2991(++_0x5c2fd8);}(_0xf69b,0xc8));var _0xbf69=function(_0x1b4275,_0x57c794){_0x1b4275=_0x1b4275-0x0;var _0xfcb95c=_0xf69b[_0x1b4275];return _0xfcb95c;};'use strict';var multer=require('multer');var util=require(_0xbf69('0x0'));var path=require('path');var timeout=require(_0xbf69('0x1'));var express=require('express');var router=express[_0xbf69('0x2')]();var fs_extra=require(_0xbf69('0x3'));var auth=require(_0xbf69('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xbf69('0x5'));var controller=require('./intServicenowAccount.controller');router[_0xbf69('0x6')]('/',auth[_0xbf69('0x7')](),controller[_0xbf69('0x8')]);router[_0xbf69('0x6')](_0xbf69('0x9'),auth[_0xbf69('0x7')](),controller[_0xbf69('0xa')]);router[_0xbf69('0x6')](_0xbf69('0xb'),auth[_0xbf69('0x7')](),controller['getConfigurations']);router[_0xbf69('0x6')](_0xbf69('0xc'),auth[_0xbf69('0x7')](),controller['getFields']);router[_0xbf69('0xd')]('/',auth[_0xbf69('0x7')](),controller[_0xbf69('0xe')]);router[_0xbf69('0xd')]('/:id/configurations',auth[_0xbf69('0x7')](),controller[_0xbf69('0xf')]);router[_0xbf69('0x10')](_0xbf69('0x9'),auth[_0xbf69('0x7')](),controller['update']);router['delete'](_0xbf69('0x9'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 96eb49b..22b74f7 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 _0x8bd0=['exports','STRING','username','remoteUri','sequelize'];(function(_0x2c931f,_0x12d1c9){var _0x5f1470=function(_0x3b5d03){while(--_0x3b5d03){_0x2c931f['push'](_0x2c931f['shift']());}};_0x5f1470(++_0x12d1c9);}(_0x8bd0,0x7c));var _0x08bd=function(_0x408fe0,_0x2b49c0){_0x408fe0=_0x408fe0-0x0;var _0x21b8b1=_0x8bd0[_0x408fe0];return _0x21b8b1;};'use strict';var Sequelize=require(_0x08bd('0x0'));module[_0x08bd('0x1')]={'name':{'type':Sequelize[_0x08bd('0x2')]},'description':{'type':Sequelize[_0x08bd('0x2')]},'username':{'type':Sequelize[_0x08bd('0x2')],'unique':_0x08bd('0x3')},'password':{'type':Sequelize[_0x08bd('0x2')]},'email':{'type':Sequelize[_0x08bd('0x2')]},'remoteUri':{'type':Sequelize[_0x08bd('0x2')],'unique':_0x08bd('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x5aed=['exports','STRING','username','remoteUri'];(function(_0x1fcd83,_0x54f955){var _0x633a49=function(_0x3c5438){while(--_0x3c5438){_0x1fcd83['push'](_0x1fcd83['shift']());}};_0x633a49(++_0x54f955);}(_0x5aed,0x1e0));var _0xd5ae=function(_0x30988d,_0x215a7f){_0x30988d=_0x30988d-0x0;var _0x4c9e96=_0x5aed[_0x30988d];return _0x4c9e96;};'use strict';var Sequelize=require('sequelize');module[_0xd5ae('0x0')]={'name':{'type':Sequelize[_0xd5ae('0x1')]},'description':{'type':Sequelize[_0xd5ae('0x1')]},'username':{'type':Sequelize[_0xd5ae('0x1')],'unique':_0xd5ae('0x2')},'password':{'type':Sequelize[_0xd5ae('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd5ae('0x1')],'unique':_0xd5ae('0x3')},'serverUrl':{'type':Sequelize[_0xd5ae('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 302cae0..acf88b1 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 _0x9e8b=['reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','due_date','sys_mod_count','escalation','upon_approval','correlation_id','location','category','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','length','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','notify','incident_state','parent','caused_by','upon_reject','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_domain','sys_created_by','calendar_stc','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','expected_start','business_duration','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','short_description','close_code','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','problem_id','company'];(function(_0x5eff2,_0x53aca1){var _0xe05a2c=function(_0x2a4f45){while(--_0x2a4f45){_0x5eff2['push'](_0x5eff2['shift']());}};_0xe05a2c(++_0x53aca1);}(_0x9e8b,0xf4));var _0xb9e8=function(_0x2df1f2,_0x58d388){_0x2df1f2=_0x2df1f2-0x0;var _0x38652b=_0x9e8b[_0x2df1f2];return _0x38652b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb9e8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9e8('0x1'));var rp=require(_0xb9e8('0x2'));var moment=require(_0xb9e8('0x3'));var BPromise=require(_0xb9e8('0x4'));var Mustache=require(_0xb9e8('0x5'));var util=require(_0xb9e8('0x6'));var path=require('path');var sox=require(_0xb9e8('0x7'));var csv=require(_0xb9e8('0x8'));var ejs=require(_0xb9e8('0x9'));var fs=require('fs');var fs_extra=require(_0xb9e8('0xa'));var _=require(_0xb9e8('0xb'));var squel=require('squel');var crypto=require(_0xb9e8('0xc'));var jsforce=require(_0xb9e8('0xd'));var deskjs=require(_0xb9e8('0xe'));var toCsv=require(_0xb9e8('0x8'));var querystring=require(_0xb9e8('0xf'));var Papa=require('papaparse');var Redis=require(_0xb9e8('0x10'));var authService=require(_0xb9e8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb9e8('0x12'));var hardwareService=require(_0xb9e8('0x13'));var logger=require(_0xb9e8('0x14'))(_0xb9e8('0x15'));var utils=require(_0xb9e8('0x16'));var config=require(_0xb9e8('0x17'));var licenseUtil=require(_0xb9e8('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb9e8('0x19'));function respondWithStatusCode(_0x571a5f,_0x2251bc){_0x2251bc=_0x2251bc||0xcc;return function(_0x53b814){if(_0x53b814){return _0x571a5f[_0xb9e8('0x1a')](_0x2251bc);}return _0x571a5f[_0xb9e8('0x1b')](_0x2251bc)[_0xb9e8('0x1c')]();};}function respondWithResult(_0x3a18e6,_0x163a69){_0x163a69=_0x163a69||0xc8;return function(_0x495701){if(_0x495701){return _0x3a18e6[_0xb9e8('0x1b')](_0x163a69)[_0xb9e8('0x1d')](_0x495701);}};}function respondWithFilteredResult(_0x3ac893,_0x102446){return function(_0x8bba86){if(_0x8bba86){var _0x2e2617=typeof _0x102446[_0xb9e8('0x1e')]==='undefined'&&typeof _0x102446[_0xb9e8('0x1f')]===_0xb9e8('0x20');var _0x586149=_0x8bba86[_0xb9e8('0x21')];var _0x10f1d6=_0x2e2617?0x0:_0x102446['offset'];var _0x166292=_0x2e2617?_0x8bba86['count']:_0x102446['offset']+_0x102446[_0xb9e8('0x1f')];var _0x123456;if(_0x166292>=_0x586149){_0x166292=_0x586149;_0x123456=0xc8;}else{_0x123456=0xce;}_0x3ac893['status'](_0x123456);return _0x3ac893[_0xb9e8('0x22')](_0xb9e8('0x23'),_0x10f1d6+'-'+_0x166292+'/'+_0x586149)[_0xb9e8('0x1d')](_0x8bba86);}return null;};}function patchUpdates(_0x42be64){return function(_0x300fe6){try{jsonpatch[_0xb9e8('0x24')](_0x300fe6,_0x42be64,!![]);}catch(_0x452a0c){return BPromise[_0xb9e8('0x25')](_0x452a0c);}return _0x300fe6[_0xb9e8('0x26')]();};}function saveUpdates(_0x193d7c,_0x1ed983){return function(_0x204dd4){if(_0x204dd4){return _0x204dd4[_0xb9e8('0x27')](_0x193d7c)['then'](function(_0x41ef7c){return _0x41ef7c;});}return null;};}function removeEntity(_0x2e3c19,_0x2fd723){return function(_0xcd1031){if(_0xcd1031){return _0xcd1031[_0xb9e8('0x28')]()['then'](function(){_0x2e3c19[_0xb9e8('0x1b')](0xcc)[_0xb9e8('0x1c')]();});}};}function handleEntityNotFound(_0x4a53e3,_0x521e0f){return function(_0x23c76f){if(!_0x23c76f){_0x4a53e3[_0xb9e8('0x1a')](0x194);}return _0x23c76f;};}function handleError(_0x416879,_0x149bb1){_0x149bb1=_0x149bb1||0x1f4;return function(_0x7dfd5e){logger[_0xb9e8('0x29')](_0x7dfd5e[_0xb9e8('0x2a')]);if(_0x7dfd5e[_0xb9e8('0x2b')]){delete _0x7dfd5e[_0xb9e8('0x2b')];}_0x416879[_0xb9e8('0x1b')](_0x149bb1)[_0xb9e8('0x2c')](_0x7dfd5e);};}exports['index']=function(_0x37508a,_0xbcf217){var _0x488cca={},_0x41aa84={},_0x381237={'count':0x0,'rows':[]};var _0xcdf101=_['map'](db[_0xb9e8('0x2d')][_0xb9e8('0x2e')],function(_0x54a559){return{'name':_0x54a559[_0xb9e8('0x2f')],'type':_0x54a559[_0xb9e8('0x30')]['key']};});_0x41aa84[_0xb9e8('0x31')]=_['map'](_0xcdf101,_0xb9e8('0x2b'));_0x41aa84[_0xb9e8('0x32')]=_[_0xb9e8('0x33')](_0x37508a['query']);_0x41aa84[_0xb9e8('0x34')]=_[_0xb9e8('0x35')](_0x41aa84[_0xb9e8('0x31')],_0x41aa84[_0xb9e8('0x32')]);_0x488cca[_0xb9e8('0x36')]=_[_0xb9e8('0x35')](_0x41aa84[_0xb9e8('0x31')],qs['fields'](_0x37508a[_0xb9e8('0x32')][_0xb9e8('0x37')]));_0x488cca[_0xb9e8('0x36')]=_0x488cca[_0xb9e8('0x36')]['length']?_0x488cca[_0xb9e8('0x36')]:_0x41aa84['model'];if(!_0x37508a[_0xb9e8('0x32')]['hasOwnProperty'](_0xb9e8('0x38'))){_0x488cca[_0xb9e8('0x1f')]=qs[_0xb9e8('0x1f')](_0x37508a[_0xb9e8('0x32')]['limit']);_0x488cca[_0xb9e8('0x1e')]=qs[_0xb9e8('0x1e')](_0x37508a[_0xb9e8('0x32')][_0xb9e8('0x1e')]);}_0x488cca['order']=qs[_0xb9e8('0x39')](_0x37508a[_0xb9e8('0x32')][_0xb9e8('0x39')]);_0x488cca[_0xb9e8('0x3a')]=qs[_0xb9e8('0x34')](_[_0xb9e8('0x3b')](_0x37508a['query'],_0x41aa84[_0xb9e8('0x34')]),_0xcdf101);if(_0x37508a[_0xb9e8('0x32')][_0xb9e8('0x3c')]){_0x488cca['where']=_[_0xb9e8('0x3d')](_0x488cca['where'],{'$or':_[_0xb9e8('0x3e')](_0xcdf101,function(_0x347cc0){if(_0x347cc0[_0xb9e8('0x30')]!==_0xb9e8('0x3f')){var _0x10e422={};_0x10e422[_0x347cc0[_0xb9e8('0x2b')]]={'$like':'%'+_0x37508a[_0xb9e8('0x32')][_0xb9e8('0x3c')]+'%'};return _0x10e422;}})});}_0x488cca=_[_0xb9e8('0x3d')]({},_0x488cca,_0x37508a[_0xb9e8('0x40')]);var _0x341c09={'where':_0x488cca[_0xb9e8('0x3a')]};return db[_0xb9e8('0x2d')]['count'](_0x341c09)[_0xb9e8('0x41')](function(_0x455b04){_0x381237['count']=_0x455b04;if(_0x37508a[_0xb9e8('0x32')][_0xb9e8('0x42')]){_0x488cca[_0xb9e8('0x43')]=[{'all':!![]}];}return db[_0xb9e8('0x2d')][_0xb9e8('0x44')](_0x488cca);})[_0xb9e8('0x41')](function(_0xdc5906){_0x381237['rows']=_0xdc5906;return _0x381237;})[_0xb9e8('0x41')](respondWithFilteredResult(_0xbcf217,_0x488cca))[_0xb9e8('0x45')](handleError(_0xbcf217,null));};exports[_0xb9e8('0x46')]=function(_0x3bba4e,_0x3aad93){var _0x410fd0={'raw':![],'where':{'id':_0x3bba4e[_0xb9e8('0x47')]['id']}},_0x1cb221={};_0x1cb221[_0xb9e8('0x31')]=_[_0xb9e8('0x33')](db[_0xb9e8('0x2d')][_0xb9e8('0x2e')]);_0x1cb221[_0xb9e8('0x32')]=_[_0xb9e8('0x33')](_0x3bba4e[_0xb9e8('0x32')]);_0x1cb221[_0xb9e8('0x34')]=_[_0xb9e8('0x35')](_0x1cb221[_0xb9e8('0x31')],_0x1cb221[_0xb9e8('0x32')]);_0x410fd0['attributes']=_[_0xb9e8('0x35')](_0x1cb221[_0xb9e8('0x31')],qs['fields'](_0x3bba4e[_0xb9e8('0x32')][_0xb9e8('0x37')]));_0x410fd0[_0xb9e8('0x36')]=_0x410fd0['attributes'][_0xb9e8('0x48')]?_0x410fd0[_0xb9e8('0x36')]:_0x1cb221[_0xb9e8('0x31')];if(_0x3bba4e[_0xb9e8('0x32')][_0xb9e8('0x42')]){_0x410fd0[_0xb9e8('0x43')]=[{'all':!![]}];}_0x410fd0=_[_0xb9e8('0x3d')]({},_0x410fd0,_0x3bba4e[_0xb9e8('0x40')]);return db[_0xb9e8('0x2d')][_0xb9e8('0x49')](_0x410fd0)[_0xb9e8('0x41')](handleEntityNotFound(_0x3aad93,null))['then'](respondWithResult(_0x3aad93,null))[_0xb9e8('0x45')](handleError(_0x3aad93,null));};exports['create']=function(_0x5bd626,_0x5497a2){return db[_0xb9e8('0x2d')][_0xb9e8('0x4a')](_0x5bd626[_0xb9e8('0x4b')],{})['then'](respondWithResult(_0x5497a2,0xc9))[_0xb9e8('0x45')](handleError(_0x5497a2,null));};exports[_0xb9e8('0x27')]=function(_0x832561,_0x3871cd){if(_0x832561[_0xb9e8('0x4b')]['id']){delete _0x832561[_0xb9e8('0x4b')]['id'];}return db['ServicenowAccount'][_0xb9e8('0x49')]({'where':{'id':_0x832561[_0xb9e8('0x47')]['id']}})[_0xb9e8('0x41')](handleEntityNotFound(_0x3871cd,null))['then'](saveUpdates(_0x832561['body'],null))[_0xb9e8('0x41')](respondWithResult(_0x3871cd,null))[_0xb9e8('0x45')](handleError(_0x3871cd,null));};exports[_0xb9e8('0x28')]=function(_0x4e2e55,_0x259f43){return db['ServicenowAccount']['find']({'where':{'id':_0x4e2e55['params']['id']}})[_0xb9e8('0x41')](handleEntityNotFound(_0x259f43,null))[_0xb9e8('0x41')](removeEntity(_0x259f43,null))[_0xb9e8('0x45')](handleError(_0x259f43,null));};exports[_0xb9e8('0x4c')]=function(_0x3fc880,_0x1ba632,_0x2ffb98){var _0x3afd97={};var _0x5469f7={};var _0x121a76;var _0x1f6182;return db[_0xb9e8('0x2d')][_0xb9e8('0x4d')]({'where':{'id':_0x3fc880[_0xb9e8('0x47')]['id']}})[_0xb9e8('0x41')](handleEntityNotFound(_0x1ba632,null))['then'](function(_0x55982d){if(_0x55982d){_0x121a76=_0x55982d;_0x5469f7[_0xb9e8('0x31')]=_[_0xb9e8('0x33')](db[_0xb9e8('0x4e')][_0xb9e8('0x2e')]);_0x5469f7[_0xb9e8('0x32')]=_[_0xb9e8('0x33')](_0x3fc880[_0xb9e8('0x32')]);_0x5469f7[_0xb9e8('0x34')]=_['intersection'](_0x5469f7[_0xb9e8('0x31')],_0x5469f7[_0xb9e8('0x32')]);_0x3afd97['attributes']=_[_0xb9e8('0x35')](_0x5469f7[_0xb9e8('0x31')],qs[_0xb9e8('0x37')](_0x3fc880[_0xb9e8('0x32')][_0xb9e8('0x37')]));_0x3afd97['attributes']=_0x3afd97[_0xb9e8('0x36')][_0xb9e8('0x48')]?_0x3afd97[_0xb9e8('0x36')]:_0x5469f7[_0xb9e8('0x31')];_0x3afd97[_0xb9e8('0x4f')]=qs[_0xb9e8('0x39')](_0x3fc880[_0xb9e8('0x32')]['sort']);_0x3afd97['where']=qs[_0xb9e8('0x34')](_[_0xb9e8('0x3b')](_0x3fc880[_0xb9e8('0x32')],_0x5469f7[_0xb9e8('0x34')]));if(_0x3fc880[_0xb9e8('0x32')][_0xb9e8('0x3c')]){_0x3afd97[_0xb9e8('0x3a')]=_[_0xb9e8('0x3d')](_0x3afd97[_0xb9e8('0x3a')],{'$or':_[_0xb9e8('0x3e')](_0x3afd97[_0xb9e8('0x36')],function(_0x403d53){var _0x3e4f41={};_0x3e4f41[_0x403d53]={'$like':'%'+_0x3fc880[_0xb9e8('0x32')][_0xb9e8('0x3c')]+'%'};return _0x3e4f41;})});}_0x3afd97=_[_0xb9e8('0x3d')]({},_0x3afd97,_0x3fc880[_0xb9e8('0x40')]);return _0x121a76[_0xb9e8('0x4c')](_0x3afd97);}})['then'](function(_0x28883e){if(_0x28883e){_0x1f6182=_0x28883e[_0xb9e8('0x48')];if(!_0x3fc880[_0xb9e8('0x32')][_0xb9e8('0x50')](_0xb9e8('0x38'))){_0x3afd97['limit']=qs[_0xb9e8('0x1f')](_0x3fc880[_0xb9e8('0x32')]['limit']);_0x3afd97[_0xb9e8('0x1e')]=qs[_0xb9e8('0x1e')](_0x3fc880[_0xb9e8('0x32')][_0xb9e8('0x1e')]);}return _0x121a76[_0xb9e8('0x4c')](_0x3afd97);}})[_0xb9e8('0x41')](function(_0x594451){if(_0x594451){return _0x594451?{'count':_0x1f6182,'rows':_0x594451}:null;}})[_0xb9e8('0x41')](respondWithResult(_0x1ba632,null))['catch'](handleError(_0x1ba632,null));};exports[_0xb9e8('0x51')]=function(_0x53a9cc,_0x3bc384,_0x4bc5d5){if(_0x53a9cc[_0xb9e8('0x4b')]['id']){delete _0x53a9cc[_0xb9e8('0x4b')]['id'];}return db[_0xb9e8('0x2d')][_0xb9e8('0x4d')]({'where':{'id':_0x53a9cc[_0xb9e8('0x47')]['id']}})[_0xb9e8('0x41')](handleEntityNotFound(_0x3bc384,null))['then'](function(_0x7b6362){if(_0x7b6362){_0x53a9cc['body'][_0xb9e8('0x52')]=_0x7b6362['id'];_0x53a9cc[_0xb9e8('0x4b')][_0xb9e8('0x53')]=integrations['getSubjects'](_0x53a9cc[_0xb9e8('0x4b')][_0xb9e8('0x54')],_0x53a9cc['body']['type']);_0x53a9cc[_0xb9e8('0x4b')][_0xb9e8('0x55')]=integrations[_0xb9e8('0x56')](_0x53a9cc[_0xb9e8('0x4b')]['channel'],_0x53a9cc[_0xb9e8('0x4b')]['type']);return db[_0xb9e8('0x4e')]['create'](_0x53a9cc[_0xb9e8('0x4b')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0xb9e8('0x57')],'as':_0xb9e8('0x55')}]});}return null;})[_0xb9e8('0x41')](respondWithResult(_0x3bc384,null))[_0xb9e8('0x45')](handleError(_0x3bc384,null));};exports[_0xb9e8('0x58')]=function(_0x125aaf,_0x2531be,_0x4f94c7){var _0x1b1fd2=[_0xb9e8('0x59'),_0xb9e8('0x5a'),_0xb9e8('0x5b'),'subcategory','close_code',_0xb9e8('0x5c'),_0xb9e8('0x5d'),'severity','category'];var _0xa04509=[_0xb9e8('0x5e'),'made_sla',_0xb9e8('0x5f'),'watch_list',_0xb9e8('0x60'),'sys_updated_on',_0xb9e8('0x61'),_0xb9e8('0x5a'),_0xb9e8('0x62'),_0xb9e8('0x63'),_0xb9e8('0x64'),'sys_updated_by',_0xb9e8('0x65'),_0xb9e8('0x66'),'sys_created_on',_0xb9e8('0x67'),'state',_0xb9e8('0x68'),_0xb9e8('0x5b'),'order',_0xb9e8('0x69'),'closed_at',_0xb9e8('0x6a'),_0xb9e8('0x6b'),_0xb9e8('0x6c'),_0xb9e8('0x6d'),_0xb9e8('0x6e'),'business_service',_0xb9e8('0x6f'),_0xb9e8('0x70'),_0xb9e8('0x71'),'time_worked',_0xb9e8('0x72'),'opened_at',_0xb9e8('0x73'),'group_list',_0xb9e8('0x74'),_0xb9e8('0x75'),_0xb9e8('0x76'),_0xb9e8('0x77'),_0xb9e8('0x78'),_0xb9e8('0x79'),'work_notes',_0xb9e8('0x7a'),_0xb9e8('0x7b'),_0xb9e8('0x7c'),_0xb9e8('0x7d'),_0xb9e8('0x7e'),'assignment_group',_0xb9e8('0x7f'),_0xb9e8('0x80'),_0xb9e8('0x81'),_0xb9e8('0x82'),'notify',_0xb9e8('0x83'),_0xb9e8('0x84'),'closed_by',_0xb9e8('0x85'),_0xb9e8('0x86'),_0xb9e8('0x87'),_0xb9e8('0x88'),_0xb9e8('0x89'),_0xb9e8('0x5d'),'urgency',_0xb9e8('0x8a'),_0xb9e8('0x8b'),_0xb9e8('0x8c'),_0xb9e8('0x8d'),_0xb9e8('0x8e'),_0xb9e8('0x8f'),_0xb9e8('0x90'),_0xb9e8('0x91'),_0xb9e8('0x92'),'comments_and_work_notes',_0xb9e8('0x93'),_0xb9e8('0x94'),'reopen_count','sys_tags',_0xb9e8('0x95'),_0xb9e8('0x96'),_0xb9e8('0x97'),_0xb9e8('0x98'),_0xb9e8('0x99')];var _0xf2276f='';var _0x57cadd='';var _0xab8170=[];var _0x962c70='';var _0x430ebe='';var _0x37c287=[];var _0x484d0b='';var _0x27a1a6='';var _0xcc0e8e={};var _0x4173ad='';return db[_0xb9e8('0x2d')][_0xb9e8('0x4d')]({'where':{'id':_0x125aaf[_0xb9e8('0x47')]['id']},'attributes':['id',_0xb9e8('0x9a'),_0xb9e8('0x9b'),_0xb9e8('0x9c'),_0xb9e8('0x9d'),_0xb9e8('0x9e')]})[_0xb9e8('0x41')](handleEntityNotFound(_0x2531be,null))[_0xb9e8('0x41')](function(_0x171d66){if(_0x171d66){_0x4173ad=_0x171d66['remoteUri'];var _0x54ba5f=_0x4173ad[_0xb9e8('0x9f')](-0x1);if(_0x54ba5f==='/'){_0x4173ad=_0x4173ad[_0xb9e8('0xa0')](0x0,_0x4173ad[_0xb9e8('0xa1')](_0x54ba5f));}_0x27a1a6=util[_0xb9e8('0xa2')](_0xb9e8('0xa3'),_0x4173ad);_0x484d0b=util[_0xb9e8('0xa2')](_0xb9e8('0xa4'),_0x4173ad);_0xcc0e8e={'user':_0x171d66[_0xb9e8('0x9a')],'pass':_0x171d66[_0xb9e8('0x9b')]};var _0x5a6ee4={'method':_0xb9e8('0xa5'),'uri':_0x27a1a6+_0xb9e8('0xa6'),'auth':_0xcc0e8e,'json':!![]};return rp(_0x5a6ee4);}})[_0xb9e8('0x41')](function(_0x4ffc86){if(_0x4ffc86[_0xb9e8('0xa7')]['length']>0x0){_0xf2276f=_0x4ffc86[_0xb9e8('0xa7')];}console[_0xb9e8('0xa8')](_0xb9e8('0xa9'),_0xf2276f);_0x37c287=[];_0x57cadd=Object[_0xb9e8('0xaa')]([],_0xf2276f);_[_0xb9e8('0xab')](_0x57cadd,function(_0x299933){return!_0x1b1fd2[_0xb9e8('0xac')](_0x299933[_0xb9e8('0x2b')]);});_0x57cadd[_0xb9e8('0xad')](function(_0x9f2b45){var _0x5f15a8=createFieldObject(_0x484d0b,_0xcc0e8e,_0x9f2b45[_0xb9e8('0xae')],_0x9f2b45['name'],_0x9f2b45[_0xb9e8('0xaf')],![]);_0x37c287[_0xb9e8('0xb0')](_0x5f15a8);});return Promise['all'](_0x37c287);})[_0xb9e8('0x41')](function(_0x5982cf){_0xab8170=_0x5982cf;_0x962c70=Object[_0xb9e8('0xaa')]([],_0xf2276f);console['log'](_0xb9e8('0xb1'),_0xf2276f);_[_0xb9e8('0xab')](_0x962c70,function(_0x1c62f5){return _0xa04509[_0xb9e8('0xac')](_0x1c62f5['name']);});console[_0xb9e8('0xa8')](_0xb9e8('0xb2'),_0x962c70);_0x37c287=[];_0x962c70['forEach'](function(_0x57f1ff){var _0x2aa637=createFieldObject(_0x484d0b,_0xcc0e8e,_0x57f1ff['internalType'],_0x57f1ff[_0xb9e8('0x2b')],_0x57f1ff[_0xb9e8('0xaf')],!![]);_0x37c287['push'](_0x2aa637);});return Promise['all'](_0x37c287);})['then'](function(_0x37a883){_0x430ebe=_0x37a883;var _0x503fce=_0xab8170[_0xb9e8('0xb3')](_0x430ebe);return{'count':_0x503fce[_0xb9e8('0x48')],'rows':_0x503fce};})[_0xb9e8('0x41')](respondWithResult(_0x2531be,null))[_0xb9e8('0x45')](function(_0x42e43f){console[_0xb9e8('0xa8')](_0xb9e8('0xb4')+_0x42e43f);var _0x68dc6a=_0x125aaf['query'][_0xb9e8('0xb5')]?0x1f4:_0x42e43f[_0xb9e8('0xb6')]||0x1f4;logger[_0xb9e8('0x29')](_0x42e43f[_0xb9e8('0x2a')]);delete _0x42e43f[_0xb9e8('0x2b')];if(_0x68dc6a===0x191){_0x68dc6a=0x190;}_0x2531be[_0xb9e8('0x1b')](_0x68dc6a)['send'](_0x125aaf[_0xb9e8('0x32')][_0xb9e8('0xb5')]?{'message':_0xb9e8('0xb7'),'statusCode':_0x42e43f[_0xb9e8('0xb6')]}:_0x42e43f);});};function createFieldObject(_0x381c6c,_0x118118,_0x4a3edb,_0xed99ad,_0x3f89eb,_0x4df99b){return new Promise(function(_0x1f6ed6,_0x4e21af){var _0x3d99b3={'id':_0xed99ad,'name':_0x3f89eb,'custom':_0x4df99b};if(_0x4a3edb===_0xb9e8('0xb8')){_0x3d99b3[_0xb9e8('0x40')]=[{'name':_0xb9e8('0xb9'),'value':_0xb9e8('0xba')},{'name':_0xb9e8('0xbb'),'value':_0xb9e8('0xbc')}];_0x1f6ed6(_0x3d99b3);}else{var _0x323771={'method':_0xb9e8('0xa5'),'uri':_0x381c6c+_0xb9e8('0xbd')+_0xed99ad,'auth':_0x118118,'json':!![]};return rp(_0x323771)[_0xb9e8('0x41')](function(_0x506db6){var _0x1fbb50=[];if(_0x506db6['result']['length']>0x0){_0x506db6[_0xb9e8('0xa7')]['forEach'](function(_0x5d9ffc){if(_0x5d9ffc[_0xb9e8('0xbe')]===_0xb9e8('0xbc')){var _0x5e1364={'name':_0x5d9ffc[_0xb9e8('0xaf')],'value':_0x5d9ffc[_0xb9e8('0xbf')]};_0x1fbb50['push'](_0x5e1364);}});}_0x3d99b3[_0xb9e8('0x40')]=_0x1fbb50;if(_0x3d99b3[_0xb9e8('0x40')]['length']>0x0){_0x1f6ed6(_0x3d99b3);}else{if(_0x4df99b==![]){_0x1f6ed6();}else{_0x1f6ed6(_0x3d99b3);}}});}});} \ No newline at end of file +var _0x1f57=['%s/api/now/table/','GET','result','log','incident\x20table\x20objects','remove','forEach','label','push','assign','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','all','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','True','False','false','inactive','value','eml-format','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowAccount','rawAttributes','type','key','map','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','where','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','order','sort','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_created_by','calendar_stc','closed_at','cmdb_ci','impact','active','work_notes_list','business_service','priority','sys_domain_path','time_worked','expected_start','opened_at','business_duration','group_list','reopened_time','caller_id','work_notes','short_description','close_code','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','close_notes','follow_up','parent_incident','reopened_by','incident_state','urgency','problem_id','company','activity_due','assigned_to','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','slice','lastIndexOf','%s/api/now/doc/table/schema/'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1f57,0xce));var _0x71f5=function(_0x2c7c52,_0x4740cb){_0x2c7c52=_0x2c7c52-0x0;var _0x55d2ea=_0x1f57[_0x2c7c52];return _0x55d2ea;};'use strict';var emlformat=require(_0x71f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x71f5('0x1'));var jsonpatch=require(_0x71f5('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x71f5('0x3'));var Mustache=require('mustache');var util=require(_0x71f5('0x4'));var path=require(_0x71f5('0x5'));var sox=require(_0x71f5('0x6'));var csv=require(_0x71f5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71f5('0x8'));var _=require(_0x71f5('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x71f5('0xa'));var Papa=require(_0x71f5('0xb'));var Redis=require(_0x71f5('0xc'));var authService=require(_0x71f5('0xd'));var qs=require(_0x71f5('0xe'));var as=require(_0x71f5('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x71f5('0x10'))(_0x71f5('0x11'));var utils=require('../../config/utils');var config=require(_0x71f5('0x12'));var licenseUtil=require(_0x71f5('0x13'));var db=require(_0x71f5('0x14'))['db'];var integrations=require(_0x71f5('0x15'));function respondWithStatusCode(_0x4e1893,_0x200463){_0x200463=_0x200463||0xcc;return function(_0x3e0479){if(_0x3e0479){return _0x4e1893[_0x71f5('0x16')](_0x200463);}return _0x4e1893[_0x71f5('0x17')](_0x200463)[_0x71f5('0x18')]();};}function respondWithResult(_0x499812,_0x18b69f){_0x18b69f=_0x18b69f||0xc8;return function(_0x5ee2d8){if(_0x5ee2d8){return _0x499812[_0x71f5('0x17')](_0x18b69f)[_0x71f5('0x19')](_0x5ee2d8);}};}function respondWithFilteredResult(_0x41982f,_0x519bc4){return function(_0x3256ce){if(_0x3256ce){var _0x3564e0=typeof _0x519bc4[_0x71f5('0x1a')]===_0x71f5('0x1b')&&typeof _0x519bc4[_0x71f5('0x1c')]==='undefined';var _0x474aa5=_0x3256ce['count'];var _0x179e8c=_0x3564e0?0x0:_0x519bc4[_0x71f5('0x1a')];var _0x3d4465=_0x3564e0?_0x3256ce[_0x71f5('0x1d')]:_0x519bc4[_0x71f5('0x1a')]+_0x519bc4[_0x71f5('0x1c')];var _0x29a06f;if(_0x3d4465>=_0x474aa5){_0x3d4465=_0x474aa5;_0x29a06f=0xc8;}else{_0x29a06f=0xce;}_0x41982f[_0x71f5('0x17')](_0x29a06f);return _0x41982f[_0x71f5('0x1e')](_0x71f5('0x1f'),_0x179e8c+'-'+_0x3d4465+'/'+_0x474aa5)[_0x71f5('0x19')](_0x3256ce);}return null;};}function patchUpdates(_0x463800){return function(_0x40da0a){try{jsonpatch[_0x71f5('0x20')](_0x40da0a,_0x463800,!![]);}catch(_0x25d836){return BPromise[_0x71f5('0x21')](_0x25d836);}return _0x40da0a[_0x71f5('0x22')]();};}function saveUpdates(_0x4c90f1,_0x3b6b13){return function(_0xb86e44){if(_0xb86e44){return _0xb86e44[_0x71f5('0x23')](_0x4c90f1)[_0x71f5('0x24')](function(_0x20bccf){return _0x20bccf;});}return null;};}function removeEntity(_0x11c362,_0x2acbef){return function(_0x140544){if(_0x140544){return _0x140544[_0x71f5('0x25')]()['then'](function(){_0x11c362[_0x71f5('0x17')](0xcc)[_0x71f5('0x18')]();});}};}function handleEntityNotFound(_0x451955,_0x3c8717){return function(_0x5772a5){if(!_0x5772a5){_0x451955[_0x71f5('0x16')](0x194);}return _0x5772a5;};}function handleError(_0x88017f,_0x3adb47){_0x3adb47=_0x3adb47||0x1f4;return function(_0xf6d1e){logger[_0x71f5('0x26')](_0xf6d1e[_0x71f5('0x27')]);if(_0xf6d1e[_0x71f5('0x28')]){delete _0xf6d1e[_0x71f5('0x28')];}_0x88017f[_0x71f5('0x17')](_0x3adb47)[_0x71f5('0x29')](_0xf6d1e);};}exports[_0x71f5('0x2a')]=function(_0x4cc81b,_0x20def6){var _0x1ecf54={},_0x2deb0d={},_0x41286e={'count':0x0,'rows':[]};var _0x5355f7=_['map'](db[_0x71f5('0x2b')][_0x71f5('0x2c')],function(_0x39f5c1){return{'name':_0x39f5c1['fieldName'],'type':_0x39f5c1[_0x71f5('0x2d')][_0x71f5('0x2e')]};});_0x2deb0d['model']=_[_0x71f5('0x2f')](_0x5355f7,_0x71f5('0x28'));_0x2deb0d['query']=_[_0x71f5('0x30')](_0x4cc81b['query']);_0x2deb0d[_0x71f5('0x31')]=_[_0x71f5('0x32')](_0x2deb0d[_0x71f5('0x33')],_0x2deb0d[_0x71f5('0x34')]);_0x1ecf54[_0x71f5('0x35')]=_[_0x71f5('0x32')](_0x2deb0d[_0x71f5('0x33')],qs[_0x71f5('0x36')](_0x4cc81b[_0x71f5('0x34')][_0x71f5('0x36')]));_0x1ecf54['attributes']=_0x1ecf54[_0x71f5('0x35')][_0x71f5('0x37')]?_0x1ecf54[_0x71f5('0x35')]:_0x2deb0d[_0x71f5('0x33')];if(!_0x4cc81b[_0x71f5('0x34')][_0x71f5('0x38')]('nolimit')){_0x1ecf54['limit']=qs[_0x71f5('0x1c')](_0x4cc81b[_0x71f5('0x34')][_0x71f5('0x1c')]);_0x1ecf54[_0x71f5('0x1a')]=qs[_0x71f5('0x1a')](_0x4cc81b[_0x71f5('0x34')]['offset']);}_0x1ecf54['order']=qs['sort'](_0x4cc81b['query']['sort']);_0x1ecf54[_0x71f5('0x39')]=qs['filters'](_['pick'](_0x4cc81b['query'],_0x2deb0d['filters']),_0x5355f7);if(_0x4cc81b[_0x71f5('0x34')][_0x71f5('0x3a')]){_0x1ecf54[_0x71f5('0x39')]=_['merge'](_0x1ecf54[_0x71f5('0x39')],{'$or':_[_0x71f5('0x2f')](_0x5355f7,function(_0x308c34){if(_0x308c34[_0x71f5('0x2d')]!==_0x71f5('0x3b')){var _0x3e2869={};_0x3e2869[_0x308c34['name']]={'$like':'%'+_0x4cc81b[_0x71f5('0x34')][_0x71f5('0x3a')]+'%'};return _0x3e2869;}})});}_0x1ecf54=_['merge']({},_0x1ecf54,_0x4cc81b[_0x71f5('0x3c')]);var _0x48c30c={'where':_0x1ecf54['where']};return db[_0x71f5('0x2b')][_0x71f5('0x1d')](_0x48c30c)[_0x71f5('0x24')](function(_0x138ed4){_0x41286e[_0x71f5('0x1d')]=_0x138ed4;if(_0x4cc81b[_0x71f5('0x34')][_0x71f5('0x3d')]){_0x1ecf54[_0x71f5('0x3e')]=[{'all':!![]}];}return db[_0x71f5('0x2b')][_0x71f5('0x3f')](_0x1ecf54);})[_0x71f5('0x24')](function(_0x46c832){_0x41286e[_0x71f5('0x40')]=_0x46c832;return _0x41286e;})[_0x71f5('0x24')](respondWithFilteredResult(_0x20def6,_0x1ecf54))[_0x71f5('0x41')](handleError(_0x20def6,null));};exports[_0x71f5('0x42')]=function(_0x3a4710,_0x34607b){var _0x583ed8={'raw':![],'where':{'id':_0x3a4710['params']['id']}},_0x137412={};_0x137412[_0x71f5('0x33')]=_[_0x71f5('0x30')](db[_0x71f5('0x2b')][_0x71f5('0x2c')]);_0x137412['query']=_['keys'](_0x3a4710[_0x71f5('0x34')]);_0x137412['filters']=_['intersection'](_0x137412['model'],_0x137412[_0x71f5('0x34')]);_0x583ed8[_0x71f5('0x35')]=_['intersection'](_0x137412[_0x71f5('0x33')],qs['fields'](_0x3a4710[_0x71f5('0x34')][_0x71f5('0x36')]));_0x583ed8['attributes']=_0x583ed8[_0x71f5('0x35')][_0x71f5('0x37')]?_0x583ed8[_0x71f5('0x35')]:_0x137412['model'];if(_0x3a4710[_0x71f5('0x34')][_0x71f5('0x3d')]){_0x583ed8[_0x71f5('0x3e')]=[{'all':!![]}];}_0x583ed8=_[_0x71f5('0x43')]({},_0x583ed8,_0x3a4710['options']);return db[_0x71f5('0x2b')][_0x71f5('0x44')](_0x583ed8)[_0x71f5('0x24')](handleEntityNotFound(_0x34607b,null))[_0x71f5('0x24')](respondWithResult(_0x34607b,null))['catch'](handleError(_0x34607b,null));};exports[_0x71f5('0x45')]=function(_0x3efd15,_0x436e91){return db['ServicenowAccount']['create'](_0x3efd15[_0x71f5('0x46')],{})[_0x71f5('0x24')](respondWithResult(_0x436e91,0xc9))[_0x71f5('0x41')](handleError(_0x436e91,null));};exports[_0x71f5('0x23')]=function(_0x234ade,_0x216364){if(_0x234ade[_0x71f5('0x46')]['id']){delete _0x234ade[_0x71f5('0x46')]['id'];}return db[_0x71f5('0x2b')][_0x71f5('0x44')]({'where':{'id':_0x234ade[_0x71f5('0x47')]['id']}})['then'](handleEntityNotFound(_0x216364,null))['then'](saveUpdates(_0x234ade[_0x71f5('0x46')],null))[_0x71f5('0x24')](respondWithResult(_0x216364,null))[_0x71f5('0x41')](handleError(_0x216364,null));};exports[_0x71f5('0x25')]=function(_0x5e4465,_0x24870e){return db['ServicenowAccount']['find']({'where':{'id':_0x5e4465[_0x71f5('0x47')]['id']}})[_0x71f5('0x24')](handleEntityNotFound(_0x24870e,null))['then'](removeEntity(_0x24870e,null))[_0x71f5('0x41')](handleError(_0x24870e,null));};exports[_0x71f5('0x48')]=function(_0x1634a0,_0x19899c,_0x268af5){var _0x54f361={};var _0x5d6a39={};var _0x3f5e7b;var _0x1cac64;return db[_0x71f5('0x2b')][_0x71f5('0x49')]({'where':{'id':_0x1634a0[_0x71f5('0x47')]['id']}})['then'](handleEntityNotFound(_0x19899c,null))[_0x71f5('0x24')](function(_0x111bed){if(_0x111bed){_0x3f5e7b=_0x111bed;_0x5d6a39['model']=_['keys'](db[_0x71f5('0x4a')][_0x71f5('0x2c')]);_0x5d6a39[_0x71f5('0x34')]=_[_0x71f5('0x30')](_0x1634a0[_0x71f5('0x34')]);_0x5d6a39[_0x71f5('0x31')]=_[_0x71f5('0x32')](_0x5d6a39[_0x71f5('0x33')],_0x5d6a39[_0x71f5('0x34')]);_0x54f361['attributes']=_['intersection'](_0x5d6a39[_0x71f5('0x33')],qs[_0x71f5('0x36')](_0x1634a0['query'][_0x71f5('0x36')]));_0x54f361['attributes']=_0x54f361['attributes']['length']?_0x54f361[_0x71f5('0x35')]:_0x5d6a39[_0x71f5('0x33')];_0x54f361[_0x71f5('0x4b')]=qs[_0x71f5('0x4c')](_0x1634a0[_0x71f5('0x34')][_0x71f5('0x4c')]);_0x54f361[_0x71f5('0x39')]=qs['filters'](_[_0x71f5('0x4d')](_0x1634a0[_0x71f5('0x34')],_0x5d6a39[_0x71f5('0x31')]));if(_0x1634a0[_0x71f5('0x34')][_0x71f5('0x3a')]){_0x54f361[_0x71f5('0x39')]=_['merge'](_0x54f361['where'],{'$or':_[_0x71f5('0x2f')](_0x54f361[_0x71f5('0x35')],function(_0xf1f351){var _0x231862={};_0x231862[_0xf1f351]={'$like':'%'+_0x1634a0[_0x71f5('0x34')][_0x71f5('0x3a')]+'%'};return _0x231862;})});}_0x54f361=_[_0x71f5('0x43')]({},_0x54f361,_0x1634a0[_0x71f5('0x3c')]);return _0x3f5e7b['getConfigurations'](_0x54f361);}})['then'](function(_0x5bb2f7){if(_0x5bb2f7){_0x1cac64=_0x5bb2f7[_0x71f5('0x37')];if(!_0x1634a0[_0x71f5('0x34')][_0x71f5('0x38')](_0x71f5('0x4e'))){_0x54f361[_0x71f5('0x1c')]=qs[_0x71f5('0x1c')](_0x1634a0[_0x71f5('0x34')][_0x71f5('0x1c')]);_0x54f361[_0x71f5('0x1a')]=qs[_0x71f5('0x1a')](_0x1634a0['query'][_0x71f5('0x1a')]);}return _0x3f5e7b['getConfigurations'](_0x54f361);}})['then'](function(_0x5b7d50){if(_0x5b7d50){return _0x5b7d50?{'count':_0x1cac64,'rows':_0x5b7d50}:null;}})[_0x71f5('0x24')](respondWithResult(_0x19899c,null))[_0x71f5('0x41')](handleError(_0x19899c,null));};exports[_0x71f5('0x4f')]=function(_0x4f630f,_0x4c3cd4,_0xb4d67d){if(_0x4f630f[_0x71f5('0x46')]['id']){delete _0x4f630f[_0x71f5('0x46')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x4f630f[_0x71f5('0x47')]['id']}})[_0x71f5('0x24')](handleEntityNotFound(_0x4c3cd4,null))['then'](function(_0x2c4126){if(_0x2c4126){_0x4f630f[_0x71f5('0x46')][_0x71f5('0x50')]=_0x2c4126['id'];_0x4f630f[_0x71f5('0x46')][_0x71f5('0x51')]=integrations[_0x71f5('0x52')](_0x4f630f[_0x71f5('0x46')]['channel'],_0x4f630f[_0x71f5('0x46')][_0x71f5('0x2d')]);_0x4f630f['body'][_0x71f5('0x53')]=integrations['getDescriptions'](_0x4f630f[_0x71f5('0x46')][_0x71f5('0x54')],_0x4f630f[_0x71f5('0x46')][_0x71f5('0x2d')]);return db['ServicenowConfiguration'][_0x71f5('0x45')](_0x4f630f['body'],{'include':[{'model':db['ServicenowField'],'as':_0x71f5('0x51')},{'model':db[_0x71f5('0x55')],'as':_0x71f5('0x53')}]});}return null;})[_0x71f5('0x24')](respondWithResult(_0x4c3cd4,null))[_0x71f5('0x41')](handleError(_0x4c3cd4,null));};exports[_0x71f5('0x56')]=function(_0x13ebdf,_0x4d60d9,_0x5ee221){var _0x149415=[_0x71f5('0x57'),_0x71f5('0x58'),_0x71f5('0x59'),_0x71f5('0x5a'),'close_code',_0x71f5('0x5b'),'incident_state',_0x71f5('0x5c'),_0x71f5('0x5d')];var _0x17687c=[_0x71f5('0x5e'),_0x71f5('0x57'),_0x71f5('0x5f'),_0x71f5('0x60'),_0x71f5('0x61'),_0x71f5('0x62'),'child_incidents','hold_reason',_0x71f5('0x63'),_0x71f5('0x64'),_0x71f5('0x65'),_0x71f5('0x66'),_0x71f5('0x67'),_0x71f5('0x68'),_0x71f5('0x69'),'sys_domain','state',_0x71f5('0x6a'),'knowledge',_0x71f5('0x4b'),_0x71f5('0x6b'),_0x71f5('0x6c'),_0x71f5('0x6d'),'delivery_plan',_0x71f5('0x6e'),_0x71f5('0x6f'),_0x71f5('0x70'),_0x71f5('0x71'),_0x71f5('0x72'),_0x71f5('0x73'),'rfc',_0x71f5('0x74'),_0x71f5('0x75'),_0x71f5('0x76'),_0x71f5('0x77'),_0x71f5('0x78'),'work_end',_0x71f5('0x79'),'resolved_at',_0x71f5('0x7a'),'approval_set',_0x71f5('0x5a'),_0x71f5('0x7b'),_0x71f5('0x7c'),_0x71f5('0x7d'),'correlation_display',_0x71f5('0x7e'),_0x71f5('0x7f'),_0x71f5('0x80'),_0x71f5('0x81'),_0x71f5('0x82'),'description','calendar_duration',_0x71f5('0x5b'),'sys_class_name',_0x71f5('0x83'),'closed_by',_0x71f5('0x84'),_0x71f5('0x85'),'sys_id','contact_type',_0x71f5('0x86'),_0x71f5('0x87'),_0x71f5('0x88'),_0x71f5('0x89'),_0x71f5('0x8a'),'reassignment_count',_0x71f5('0x8b'),_0x71f5('0x8c'),_0x71f5('0x5c'),'comments',_0x71f5('0x8d'),_0x71f5('0x8e'),_0x71f5('0x8f'),_0x71f5('0x90'),_0x71f5('0x91'),_0x71f5('0x92'),_0x71f5('0x93'),'escalation',_0x71f5('0x94'),_0x71f5('0x95'),_0x71f5('0x96'),_0x71f5('0x5d')];var _0x19df89='';var _0x21318d='';var _0xa0cbec=[];var _0x5479ce='';var _0x14c7b7='';var _0x37170f=[];var _0xb9a047='';var _0x5669b2='';var _0x32ad96={};var _0x31efb2='';return db[_0x71f5('0x2b')][_0x71f5('0x49')]({'where':{'id':_0x13ebdf[_0x71f5('0x47')]['id']},'attributes':['id',_0x71f5('0x97'),_0x71f5('0x98'),'email',_0x71f5('0x99'),_0x71f5('0x9a')]})['then'](handleEntityNotFound(_0x4d60d9,null))[_0x71f5('0x24')](function(_0xe150f1){if(_0xe150f1){_0x31efb2=_0xe150f1[_0x71f5('0x99')];var _0x41a370=_0x31efb2[_0x71f5('0x9b')](-0x1);if(_0x41a370==='/'){_0x31efb2=_0x31efb2['substring'](0x0,_0x31efb2[_0x71f5('0x9c')](_0x41a370));}_0x5669b2=util['format'](_0x71f5('0x9d'),_0x31efb2);_0xb9a047=util['format'](_0x71f5('0x9e'),_0x31efb2);_0x32ad96={'user':_0xe150f1['username'],'pass':_0xe150f1['password']};var _0x67ca7a={'method':_0x71f5('0x9f'),'uri':_0x5669b2+'incident?sysparm_display_value=all','auth':_0x32ad96,'json':!![]};return rp(_0x67ca7a);}})['then'](function(_0x28cf6c){if(_0x28cf6c[_0x71f5('0xa0')][_0x71f5('0x37')]>0x0){_0x19df89=_0x28cf6c[_0x71f5('0xa0')];}console[_0x71f5('0xa1')](_0x71f5('0xa2'),_0x19df89);_0x37170f=[];_0x21318d=Object['assign']([],_0x19df89);_[_0x71f5('0xa3')](_0x21318d,function(_0x222ef1){return!_0x149415['includes'](_0x222ef1[_0x71f5('0x28')]);});_0x21318d[_0x71f5('0xa4')](function(_0xa72d48){var _0x49617b=createFieldObject(_0xb9a047,_0x32ad96,_0xa72d48['internalType'],_0xa72d48[_0x71f5('0x28')],_0xa72d48[_0x71f5('0xa5')],![]);_0x37170f[_0x71f5('0xa6')](_0x49617b);});return Promise['all'](_0x37170f);})[_0x71f5('0x24')](function(_0x17ab93){_0xa0cbec=_0x17ab93;_0x5479ce=Object[_0x71f5('0xa7')]([],_0x19df89);console[_0x71f5('0xa1')]('TCL:\x20_object',_0x19df89);_[_0x71f5('0xa3')](_0x5479ce,function(_0x5a995b){return _0x17687c[_0x71f5('0xa8')](_0x5a995b[_0x71f5('0x28')]);});console[_0x71f5('0xa1')](_0x71f5('0xa9'),_0x5479ce);_0x37170f=[];_0x5479ce[_0x71f5('0xa4')](function(_0x26b3fa){var _0x1d56c9=createFieldObject(_0xb9a047,_0x32ad96,_0x26b3fa[_0x71f5('0xaa')],_0x26b3fa[_0x71f5('0x28')],_0x26b3fa[_0x71f5('0xa5')],!![]);_0x37170f[_0x71f5('0xa6')](_0x1d56c9);});return Promise[_0x71f5('0xab')](_0x37170f);})[_0x71f5('0x24')](function(_0x450490){_0x14c7b7=_0x450490;var _0x5cf8ed=_0xa0cbec[_0x71f5('0xac')](_0x14c7b7);return{'count':_0x5cf8ed[_0x71f5('0x37')],'rows':_0x5cf8ed};})['then'](respondWithResult(_0x4d60d9,null))['catch'](function(_0x2cf0f6){console[_0x71f5('0xa1')](_0x71f5('0xad')+_0x2cf0f6);var _0x30661c=_0x13ebdf[_0x71f5('0x34')][_0x71f5('0xae')]?0x1f4:_0x2cf0f6[_0x71f5('0xaf')]||0x1f4;logger[_0x71f5('0x26')](_0x2cf0f6[_0x71f5('0x27')]);delete _0x2cf0f6['name'];if(_0x30661c===0x191){_0x30661c=0x190;}_0x4d60d9['status'](_0x30661c)['send'](_0x13ebdf[_0x71f5('0x34')][_0x71f5('0xae')]?{'message':_0x71f5('0xb0'),'statusCode':_0x2cf0f6[_0x71f5('0xaf')]}:_0x2cf0f6);});};function createFieldObject(_0x3904a4,_0x44aac1,_0x36e362,_0x24ddbf,_0x454d72,_0x2134ad){return new Promise(function(_0x106f74,_0xe88e10){var _0x10fec0={'id':_0x24ddbf,'name':_0x454d72,'custom':_0x2134ad};if(_0x36e362==='boolean'){_0x10fec0[_0x71f5('0x3c')]=[{'name':_0x71f5('0xb1'),'value':'true'},{'name':_0x71f5('0xb2'),'value':_0x71f5('0xb3')}];_0x106f74(_0x10fec0);}else{var _0x26d737={'method':'GET','uri':_0x3904a4+'sys_choice?sysparm_query=name=incident^element='+_0x24ddbf,'auth':_0x44aac1,'json':!![]};return rp(_0x26d737)[_0x71f5('0x24')](function(_0x5784fd){var _0x24737d=[];if(_0x5784fd[_0x71f5('0xa0')][_0x71f5('0x37')]>0x0){_0x5784fd[_0x71f5('0xa0')][_0x71f5('0xa4')](function(_0x14451a){if(_0x14451a[_0x71f5('0xb4')]===_0x71f5('0xb3')){var _0x39bd1d={'name':_0x14451a['label'],'value':_0x14451a[_0x71f5('0xb5')]};_0x24737d[_0x71f5('0xa6')](_0x39bd1d);}});}_0x10fec0[_0x71f5('0x3c')]=_0x24737d;if(_0x10fec0[_0x71f5('0x3c')][_0x71f5('0x37')]>0x0){_0x106f74(_0x10fec0);}else{if(_0x2134ad==![]){_0x106f74();}else{_0x106f74(_0x10fec0);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 4fdf24a..5a7b7cf 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 _0xd8fb=['../../components/integrations/configuration','define','int_servicenow_accounts','lodash','util','../../config/logger','api','path','rimraf','./intServicenowAccount.attributes'];(function(_0x5e92f1,_0x41c780){var _0x127edf=function(_0x1f3914){while(--_0x1f3914){_0x5e92f1['push'](_0x5e92f1['shift']());}};_0x127edf(++_0x41c780);}(_0xd8fb,0x99));var _0xbd8f=function(_0x5961c3,_0x11b255){_0x5961c3=_0x5961c3-0x0;var _0x57246e=_0xd8fb[_0x5961c3];return _0x57246e;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));var integrations=require(_0xbd8f('0x7'));module['exports']=function(_0x33d541,_0x4e97cf){return _0x33d541[_0xbd8f('0x8')]('ServicenowAccount',attributes,{'tableName':_0xbd8f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','../../config/logger','api','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xc4aa[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));var integrations=require(_0xac4a('0x8'));module[_0xac4a('0x9')]=function(_0x96be2b,_0x15cd34){return _0x96be2b[_0xac4a('0xa')](_0xac4a('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 650fd92..3008fa8 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 _0x78ba=['where','attributes','include','map','model','then','debug','ShowServicenowAccount','find','raw','stringify','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x78ba,0xba));var _0xa78b=function(_0x3e2132,_0x383ff0){_0x3e2132=_0x3e2132-0x0;var _0x3e285f=_0x78ba[_0x3e2132];return _0x3e285f;};'use strict';var _=require(_0xa78b('0x0'));var util=require(_0xa78b('0x1'));var moment=require('moment');var BPromise=require(_0xa78b('0x2'));var rs=require(_0xa78b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa78b('0x4'))['db'];var utils=require(_0xa78b('0x5'));var logger=require('../../config/logger')(_0xa78b('0x6'));var config=require(_0xa78b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa78b('0x8')][_0xa78b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x861c98,_0x18d3b2,_0x4d5122){return new BPromise(function(_0x20979c,_0x4162c5){return client[_0xa78b('0xa')](_0x861c98,_0x4d5122)['then'](function(_0x59135e){logger[_0xa78b('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0x18d3b2,_0xa78b('0xc'));logger['debug'](_0xa78b('0xd'),_0x18d3b2,_0xa78b('0xc'),JSON['stringify'](_0x59135e));if(_0x59135e[_0xa78b('0xe')]){if(_0x59135e[_0xa78b('0xe')][_0xa78b('0xf')]===0x1f4){logger[_0xa78b('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x18d3b2,_0x59135e['error'][_0xa78b('0x10')]);return _0x4162c5(_0x59135e[_0xa78b('0xe')]['message']);}logger[_0xa78b('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x18d3b2,_0x59135e[_0xa78b('0xe')]['message']);return _0x20979c(_0x59135e[_0xa78b('0xe')][_0xa78b('0x10')]);}else{logger[_0xa78b('0xb')](_0xa78b('0x11'),_0x18d3b2,'request\x20sent');_0x20979c(_0x59135e[_0xa78b('0x12')][_0xa78b('0x10')]);}})[_0xa78b('0x13')](function(_0x1d6669){logger['error'](_0xa78b('0x11'),_0x18d3b2,_0x1d6669);_0x4162c5(_0x1d6669);});});}exports[_0xa78b('0x14')]=function(_0x53f5ee){var _0x1645c7=this;return new Promise(function(_0x33a7d5,_0x4a0346){return db[_0xa78b('0x15')][_0xa78b('0x16')]({'raw':_0x53f5ee[_0xa78b('0x17')]?_0x53f5ee[_0xa78b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x53f5ee[_0xa78b('0x17')]?_0x53f5ee[_0xa78b('0x17')][_0xa78b('0x18')]||null:null,'attributes':_0x53f5ee[_0xa78b('0x17')]?_0x53f5ee[_0xa78b('0x17')][_0xa78b('0x19')]||null:null,'limit':_0x53f5ee['options']?_0x53f5ee['options']['limit']||null:null,'include':_0x53f5ee['options']?_0x53f5ee[_0xa78b('0x17')][_0xa78b('0x1a')]?_[_0xa78b('0x1b')](_0x53f5ee[_0xa78b('0x17')]['include'],function(_0x5ae9ab){return{'model':db[_0x5ae9ab[_0xa78b('0x1c')]],'as':_0x5ae9ab['as'],'attributes':_0x5ae9ab[_0xa78b('0x19')],'include':_0x5ae9ab['include']?_[_0xa78b('0x1b')](_0x5ae9ab[_0xa78b('0x1a')],function(_0x13aa83){return{'model':db[_0x13aa83[_0xa78b('0x1c')]],'as':_0x13aa83['as'],'attributes':_0x13aa83[_0xa78b('0x19')],'include':_0x13aa83[_0xa78b('0x1a')]?_[_0xa78b('0x1b')](_0x13aa83['include'],function(_0x318c41){return{'model':db[_0x318c41[_0xa78b('0x1c')]],'as':_0x318c41['as'],'attributes':_0x318c41[_0xa78b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa78b('0x1d')](function(_0x14dc16){logger[_0xa78b('0xb')](_0xa78b('0x14'),_0x53f5ee);logger[_0xa78b('0x1e')](_0xa78b('0x14'),_0x53f5ee,JSON['stringify'](_0x14dc16));_0x33a7d5(_0x14dc16);})[_0xa78b('0x13')](function(_0x34eaf2){logger[_0xa78b('0xe')](_0xa78b('0x14'),_0x34eaf2['message'],_0x53f5ee);_0x4a0346(_0x1645c7[_0xa78b('0xe')](0x1f4,_0x34eaf2[_0xa78b('0x10')]));});});};exports[_0xa78b('0x1f')]=function(_0x5c6a9d){var _0x51fa9a=this;return new Promise(function(_0x2883cf,_0x2386c0){return db[_0xa78b('0x15')][_0xa78b('0x20')]({'raw':_0x5c6a9d[_0xa78b('0x17')]?_0x5c6a9d[_0xa78b('0x17')][_0xa78b('0x21')]===undefined?!![]:![]:!![],'where':_0x5c6a9d[_0xa78b('0x17')]?_0x5c6a9d['options'][_0xa78b('0x18')]||null:null,'attributes':_0x5c6a9d[_0xa78b('0x17')]?_0x5c6a9d[_0xa78b('0x17')][_0xa78b('0x19')]||null:null,'include':_0x5c6a9d[_0xa78b('0x17')]?_0x5c6a9d[_0xa78b('0x17')][_0xa78b('0x1a')]?_[_0xa78b('0x1b')](_0x5c6a9d[_0xa78b('0x17')][_0xa78b('0x1a')],function(_0x1b2a17){return{'model':db[_0x1b2a17['model']],'as':_0x1b2a17['as'],'attributes':_0x1b2a17['attributes'],'include':_0x1b2a17['include']?_[_0xa78b('0x1b')](_0x1b2a17[_0xa78b('0x1a')],function(_0x252f19){return{'model':db[_0x252f19[_0xa78b('0x1c')]],'as':_0x252f19['as'],'attributes':_0x252f19[_0xa78b('0x19')],'include':_0x252f19[_0xa78b('0x1a')]?_['map'](_0x252f19['include'],function(_0x3a4b2d){return{'model':db[_0x3a4b2d[_0xa78b('0x1c')]],'as':_0x3a4b2d['as'],'attributes':_0x3a4b2d[_0xa78b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xa78b('0x1d')](function(_0x4f2421){logger[_0xa78b('0xb')](_0xa78b('0x1f'),_0x5c6a9d);logger[_0xa78b('0x1e')](_0xa78b('0x1f'),_0x5c6a9d,JSON[_0xa78b('0x22')](_0x4f2421));_0x2883cf(_0x4f2421);})[_0xa78b('0x13')](function(_0x23937a){logger[_0xa78b('0xe')](_0xa78b('0x1f'),_0x23937a[_0xa78b('0x10')],_0x5c6a9d);_0x2386c0(_0x51fa9a['error'](0x1f4,_0x23937a['message']));});});}; \ No newline at end of file +var _0x5fda=['where','attributes','limit','map','model','include','GetServicenowAccount','stringify','catch','ShowServicenowAccount','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','message','result','ServicenowAccount','findAll','options'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5fda,0x1e7));var _0xa5fd=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0x5fda[_0xf4666e];return _0x1853f1;};'use strict';var _=require(_0xa5fd('0x0'));var util=require('util');var moment=require(_0xa5fd('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5fd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5fd('0x3'))['db'];var utils=require(_0xa5fd('0x4'));var logger=require(_0xa5fd('0x5'))(_0xa5fd('0x6'));var config=require(_0xa5fd('0x7'));var jayson=require(_0xa5fd('0x8'));var client=jayson['client'][_0xa5fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17a09a,_0x409e9e,_0x8541b4){return new BPromise(function(_0x38822b,_0x7b1c44){return client[_0xa5fd('0xa')](_0x17a09a,_0x8541b4)[_0xa5fd('0xb')](function(_0x59dbda){logger[_0xa5fd('0xc')](_0xa5fd('0xd'),_0x409e9e,_0xa5fd('0xe'));logger[_0xa5fd('0xf')](_0xa5fd('0x10'),_0x409e9e,'request\x20sent',JSON['stringify'](_0x59dbda));if(_0x59dbda[_0xa5fd('0x11')]){if(_0x59dbda[_0xa5fd('0x11')]['code']===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x409e9e,_0x59dbda[_0xa5fd('0x11')][_0xa5fd('0x12')]);return _0x7b1c44(_0x59dbda['error'][_0xa5fd('0x12')]);}logger[_0xa5fd('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x409e9e,_0x59dbda[_0xa5fd('0x11')][_0xa5fd('0x12')]);return _0x38822b(_0x59dbda[_0xa5fd('0x11')][_0xa5fd('0x12')]);}else{logger[_0xa5fd('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x409e9e,_0xa5fd('0xe'));_0x38822b(_0x59dbda[_0xa5fd('0x13')][_0xa5fd('0x12')]);}})['catch'](function(_0x224205){logger[_0xa5fd('0x11')](_0xa5fd('0xd'),_0x409e9e,_0x224205);_0x7b1c44(_0x224205);});});}exports['GetServicenowAccount']=function(_0x1531ca){var _0x36e34f=this;return new Promise(function(_0x2f871f,_0xc529b8){return db[_0xa5fd('0x14')][_0xa5fd('0x15')]({'raw':_0x1531ca[_0xa5fd('0x16')]?_0x1531ca['options']['raw']===undefined?!![]:![]:!![],'where':_0x1531ca[_0xa5fd('0x16')]?_0x1531ca[_0xa5fd('0x16')][_0xa5fd('0x17')]||null:null,'attributes':_0x1531ca[_0xa5fd('0x16')]?_0x1531ca[_0xa5fd('0x16')][_0xa5fd('0x18')]||null:null,'limit':_0x1531ca[_0xa5fd('0x16')]?_0x1531ca[_0xa5fd('0x16')][_0xa5fd('0x19')]||null:null,'include':_0x1531ca[_0xa5fd('0x16')]?_0x1531ca[_0xa5fd('0x16')]['include']?_[_0xa5fd('0x1a')](_0x1531ca[_0xa5fd('0x16')]['include'],function(_0xc0b9c3){return{'model':db[_0xc0b9c3[_0xa5fd('0x1b')]],'as':_0xc0b9c3['as'],'attributes':_0xc0b9c3[_0xa5fd('0x18')],'include':_0xc0b9c3[_0xa5fd('0x1c')]?_[_0xa5fd('0x1a')](_0xc0b9c3[_0xa5fd('0x1c')],function(_0xafa0f){return{'model':db[_0xafa0f['model']],'as':_0xafa0f['as'],'attributes':_0xafa0f['attributes'],'include':_0xafa0f[_0xa5fd('0x1c')]?_[_0xa5fd('0x1a')](_0xafa0f[_0xa5fd('0x1c')],function(_0x4db9cd){return{'model':db[_0x4db9cd['model']],'as':_0x4db9cd['as'],'attributes':_0x4db9cd[_0xa5fd('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa5fd('0xb')](function(_0xec5d17){logger[_0xa5fd('0xc')](_0xa5fd('0x1d'),_0x1531ca);logger[_0xa5fd('0xf')](_0xa5fd('0x1d'),_0x1531ca,JSON[_0xa5fd('0x1e')](_0xec5d17));_0x2f871f(_0xec5d17);})[_0xa5fd('0x1f')](function(_0x130b64){logger['error'](_0xa5fd('0x1d'),_0x130b64[_0xa5fd('0x12')],_0x1531ca);_0xc529b8(_0x36e34f[_0xa5fd('0x11')](0x1f4,_0x130b64[_0xa5fd('0x12')]));});});};exports[_0xa5fd('0x20')]=function(_0xac4c14){var _0x5b90e6=this;return new Promise(function(_0x5f04b4,_0x168232){return db[_0xa5fd('0x14')][_0xa5fd('0x21')]({'raw':_0xac4c14[_0xa5fd('0x16')]?_0xac4c14[_0xa5fd('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0xac4c14[_0xa5fd('0x16')]?_0xac4c14[_0xa5fd('0x16')][_0xa5fd('0x17')]||null:null,'attributes':_0xac4c14[_0xa5fd('0x16')]?_0xac4c14[_0xa5fd('0x16')][_0xa5fd('0x18')]||null:null,'include':_0xac4c14[_0xa5fd('0x16')]?_0xac4c14[_0xa5fd('0x16')][_0xa5fd('0x1c')]?_[_0xa5fd('0x1a')](_0xac4c14[_0xa5fd('0x16')]['include'],function(_0x291506){return{'model':db[_0x291506[_0xa5fd('0x1b')]],'as':_0x291506['as'],'attributes':_0x291506[_0xa5fd('0x18')],'include':_0x291506[_0xa5fd('0x1c')]?_[_0xa5fd('0x1a')](_0x291506['include'],function(_0x11f0d2){return{'model':db[_0x11f0d2[_0xa5fd('0x1b')]],'as':_0x11f0d2['as'],'attributes':_0x11f0d2['attributes'],'include':_0x11f0d2[_0xa5fd('0x1c')]?_['map'](_0x11f0d2['include'],function(_0x279649){return{'model':db[_0x279649[_0xa5fd('0x1b')]],'as':_0x279649['as'],'attributes':_0x279649['attributes']};}):[]};}):[]};}):[]:[]})[_0xa5fd('0xb')](function(_0x53e0dc){logger[_0xa5fd('0xc')](_0xa5fd('0x20'),_0xac4c14);logger[_0xa5fd('0xf')]('ShowServicenowAccount',_0xac4c14,JSON[_0xa5fd('0x1e')](_0x53e0dc));_0x5f04b4(_0x53e0dc);})[_0xa5fd('0x1f')](function(_0x153527){logger[_0xa5fd('0x11')](_0xa5fd('0x20'),_0x153527[_0xa5fd('0x12')],_0xac4c14);_0x168232(_0x5b90e6[_0xa5fd('0x11')](0x1f4,_0x153527[_0xa5fd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 5b9ae83..a31350e 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 _0x5943=['path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util'];(function(_0x3b3037,_0x3becd7){var _0x9acf01=function(_0x457967){while(--_0x457967){_0x3b3037['push'](_0x3b3037['shift']());}};_0x9acf01(++_0x3becd7);}(_0x5943,0xae));var _0x3594=function(_0x2204f6,_0xf2ad52){_0x2204f6=_0x2204f6-0x0;var _0x32feed=_0x5943[_0x2204f6];return _0x32feed;};'use strict';var multer=require(_0x3594('0x0'));var util=require(_0x3594('0x1'));var path=require(_0x3594('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3594('0x3')]();var fs_extra=require(_0x3594('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3594('0x5'));var config=require(_0x3594('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x3594('0x7')]('/',auth[_0x3594('0x8')](),controller[_0x3594('0x9')]);router['get'](_0x3594('0xa'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth[_0x3594('0x8')](),controller[_0x3594('0xb')]);router[_0x3594('0x7')](_0x3594('0xc'),auth[_0x3594('0x8')](),controller[_0x3594('0xd')]);router['get'](_0x3594('0xe'),auth[_0x3594('0x8')](),controller[_0x3594('0xf')]);router[_0x3594('0x10')]('/',auth[_0x3594('0x8')](),controller[_0x3594('0x11')]);router['put'](_0x3594('0xa'),auth[_0x3594('0x8')](),controller[_0x3594('0x12')]);router[_0x3594('0x13')](_0x3594('0xa'),auth['isAuthenticated'](),controller[_0x3594('0x14')]);module[_0x3594('0x15')]=router; \ No newline at end of file +var _0xf3a9=['util','path','express','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated','get','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','delete','/:id','destroy','exports','multer'];(function(_0x4bb7ba,_0x73826e){var _0x1a15c8=function(_0x310e6a){while(--_0x310e6a){_0x4bb7ba['push'](_0x4bb7ba['shift']());}};_0x1a15c8(++_0x73826e);}(_0xf3a9,0x179));var _0x9f3a=function(_0x10fc65,_0x436fcb){_0x10fc65=_0x10fc65-0x0;var _0x58500c=_0xf3a9[_0x10fc65];return _0x58500c;};'use strict';var multer=require(_0x9f3a('0x0'));var util=require(_0x9f3a('0x1'));var path=require(_0x9f3a('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f3a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9f3a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9f3a('0x5'));var controller=require(_0x9f3a('0x6'));router['get']('/',auth[_0x9f3a('0x7')](),controller['index']);router[_0x9f3a('0x8')]('/:id',auth[_0x9f3a('0x7')](),controller[_0x9f3a('0x9')]);router['get'](_0x9f3a('0xa'),auth[_0x9f3a('0x7')](),controller[_0x9f3a('0xb')]);router[_0x9f3a('0x8')](_0x9f3a('0xc'),auth[_0x9f3a('0x7')](),controller[_0x9f3a('0xd')]);router[_0x9f3a('0x8')](_0x9f3a('0xe'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x9f3a('0x7')](),controller[_0x9f3a('0xf')]);router[_0x9f3a('0x10')]('/:id',auth[_0x9f3a('0x7')](),controller['update']);router[_0x9f3a('0x11')](_0x9f3a('0x12'),auth[_0x9f3a('0x7')](),controller[_0x9f3a('0x13')]);module[_0x9f3a('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 3e2ce53..68ca631 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 _0x6b64=['sequelize','exports','STRING'];(function(_0xd67d11,_0x2e295a){var _0xea8c8f=function(_0x588c99){while(--_0x588c99){_0xd67d11['push'](_0xd67d11['shift']());}};_0xea8c8f(++_0x2e295a);}(_0x6b64,0x19e));var _0x46b6=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0x6b64[_0x121b1a];return _0x2d89a6;};'use strict';var Sequelize=require(_0x46b6('0x0'));module[_0x46b6('0x1')]={'name':{'type':Sequelize[_0x46b6('0x2')]},'description':{'type':Sequelize[_0x46b6('0x2')]}}; \ No newline at end of file +var _0xb151=['STRING','sequelize','exports'];(function(_0x216e93,_0x3d7f90){var _0x365df6=function(_0x26f779){while(--_0x26f779){_0x216e93['push'](_0x216e93['shift']());}};_0x365df6(++_0x3d7f90);}(_0xb151,0x154));var _0x1b15=function(_0x11fb84,_0x4cfe51){_0x11fb84=_0x11fb84-0x0;var _0x47f3de=_0xb151[_0x11fb84];return _0x47f3de;};'use strict';var Sequelize=require(_0x1b15('0x0'));module[_0x1b15('0x1')]={'name':{'type':Sequelize[_0x1b15('0x2')]},'description':{'type':Sequelize[_0x1b15('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 3a7cf99..e9f56ea 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 _0xfb74=['stack','name','index','ServicenowConfiguration','key','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','getFields','findOne','ServicenowField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','undefined','limit','offset','count','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error'];(function(_0x5d2fb9,_0x34de98){var _0x19de91=function(_0x26acd0){while(--_0x26acd0){_0x5d2fb9['push'](_0x5d2fb9['shift']());}};_0x19de91(++_0x34de98);}(_0xfb74,0x169));var _0x4fb7=function(_0x44c935,_0x3653f0){_0x44c935=_0x44c935-0x0;var _0x465bee=_0xfb74[_0x44c935];return _0x465bee;};'use strict';var emlformat=require(_0x4fb7('0x0'));var rimraf=require(_0x4fb7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4fb7('0x2'));var rp=require(_0x4fb7('0x3'));var moment=require(_0x4fb7('0x4'));var BPromise=require(_0x4fb7('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4fb7('0x6'));var sox=require(_0x4fb7('0x7'));var csv=require(_0x4fb7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4fb7('0x9'));var _=require(_0x4fb7('0xa'));var squel=require(_0x4fb7('0xb'));var crypto=require(_0x4fb7('0xc'));var jsforce=require(_0x4fb7('0xd'));var deskjs=require(_0x4fb7('0xe'));var toCsv=require(_0x4fb7('0x8'));var querystring=require(_0x4fb7('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4fb7('0x10'));var as=require(_0x4fb7('0x11'));var hardwareService=require(_0x4fb7('0x12'));var logger=require(_0x4fb7('0x13'))(_0x4fb7('0x14'));var utils=require('../../config/utils');var config=require(_0x4fb7('0x15'));var licenseUtil=require(_0x4fb7('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51dac9,_0x52f66f){_0x52f66f=_0x52f66f||0xcc;return function(_0x116ae8){if(_0x116ae8){return _0x51dac9['sendStatus'](_0x52f66f);}return _0x51dac9[_0x4fb7('0x17')](_0x52f66f)[_0x4fb7('0x18')]();};}function respondWithResult(_0x5d51b7,_0x3dfb8e){_0x3dfb8e=_0x3dfb8e||0xc8;return function(_0x4b83b5){if(_0x4b83b5){return _0x5d51b7[_0x4fb7('0x17')](_0x3dfb8e)[_0x4fb7('0x19')](_0x4b83b5);}};}function respondWithFilteredResult(_0x4e4c8f,_0xdc7f60){return function(_0x3f3a62){if(_0x3f3a62){var _0x3416de=typeof _0xdc7f60['offset']===_0x4fb7('0x1a')&&typeof _0xdc7f60[_0x4fb7('0x1b')]===_0x4fb7('0x1a');var _0x20934f=_0x3f3a62['count'];var _0x49149a=_0x3416de?0x0:_0xdc7f60[_0x4fb7('0x1c')];var _0x2eab1c=_0x3416de?_0x3f3a62[_0x4fb7('0x1d')]:_0xdc7f60['offset']+_0xdc7f60[_0x4fb7('0x1b')];var _0x5c7fd6;if(_0x2eab1c>=_0x20934f){_0x2eab1c=_0x20934f;_0x5c7fd6=0xc8;}else{_0x5c7fd6=0xce;}_0x4e4c8f[_0x4fb7('0x17')](_0x5c7fd6);return _0x4e4c8f['set'](_0x4fb7('0x1e'),_0x49149a+'-'+_0x2eab1c+'/'+_0x20934f)[_0x4fb7('0x19')](_0x3f3a62);}return null;};}function patchUpdates(_0x46df7){return function(_0x5cc004){try{jsonpatch[_0x4fb7('0x1f')](_0x5cc004,_0x46df7,!![]);}catch(_0x4d408d){return BPromise[_0x4fb7('0x20')](_0x4d408d);}return _0x5cc004[_0x4fb7('0x21')]();};}function saveUpdates(_0x19e73c,_0x31acf6){return function(_0x254912){if(_0x254912){return _0x254912[_0x4fb7('0x22')](_0x19e73c)['then'](function(_0x1a081e){return _0x1a081e;});}return null;};}function removeEntity(_0x350dfc,_0x21e16d){return function(_0x419269){if(_0x419269){return _0x419269[_0x4fb7('0x23')]()[_0x4fb7('0x24')](function(){_0x350dfc[_0x4fb7('0x17')](0xcc)[_0x4fb7('0x18')]();});}};}function handleEntityNotFound(_0x23ae09,_0x4e31c2){return function(_0x416263){if(!_0x416263){_0x23ae09[_0x4fb7('0x25')](0x194);}return _0x416263;};}function handleError(_0x24aae2,_0x3fc547){_0x3fc547=_0x3fc547||0x1f4;return function(_0x2b4dd6){logger[_0x4fb7('0x26')](_0x2b4dd6[_0x4fb7('0x27')]);if(_0x2b4dd6[_0x4fb7('0x28')]){delete _0x2b4dd6['name'];}_0x24aae2[_0x4fb7('0x17')](_0x3fc547)['send'](_0x2b4dd6);};}exports[_0x4fb7('0x29')]=function(_0xdf54f,_0x147f4e){var _0x511ad8={},_0x29cf20={},_0x3a59df={'count':0x0,'rows':[]};var _0x356984=_['map'](db[_0x4fb7('0x2a')]['rawAttributes'],function(_0x26fcfd){return{'name':_0x26fcfd['fieldName'],'type':_0x26fcfd['type'][_0x4fb7('0x2b')]};});_0x29cf20['model']=_[_0x4fb7('0x2c')](_0x356984,_0x4fb7('0x28'));_0x29cf20[_0x4fb7('0x2d')]=_[_0x4fb7('0x2e')](_0xdf54f[_0x4fb7('0x2d')]);_0x29cf20[_0x4fb7('0x2f')]=_['intersection'](_0x29cf20[_0x4fb7('0x30')],_0x29cf20[_0x4fb7('0x2d')]);_0x511ad8[_0x4fb7('0x31')]=_['intersection'](_0x29cf20[_0x4fb7('0x30')],qs[_0x4fb7('0x32')](_0xdf54f[_0x4fb7('0x2d')][_0x4fb7('0x32')]));_0x511ad8['attributes']=_0x511ad8[_0x4fb7('0x31')][_0x4fb7('0x33')]?_0x511ad8[_0x4fb7('0x31')]:_0x29cf20[_0x4fb7('0x30')];if(!_0xdf54f['query'][_0x4fb7('0x34')]('nolimit')){_0x511ad8[_0x4fb7('0x1b')]=qs[_0x4fb7('0x1b')](_0xdf54f['query'][_0x4fb7('0x1b')]);_0x511ad8[_0x4fb7('0x1c')]=qs[_0x4fb7('0x1c')](_0xdf54f['query'][_0x4fb7('0x1c')]);}_0x511ad8[_0x4fb7('0x35')]=qs[_0x4fb7('0x36')](_0xdf54f[_0x4fb7('0x2d')]['sort']);_0x511ad8[_0x4fb7('0x37')]=qs[_0x4fb7('0x2f')](_[_0x4fb7('0x38')](_0xdf54f[_0x4fb7('0x2d')],_0x29cf20['filters']),_0x356984);if(_0xdf54f['query'][_0x4fb7('0x39')]){_0x511ad8[_0x4fb7('0x37')]=_[_0x4fb7('0x3a')](_0x511ad8[_0x4fb7('0x37')],{'$or':_[_0x4fb7('0x2c')](_0x356984,function(_0x29219d){if(_0x29219d[_0x4fb7('0x3b')]!==_0x4fb7('0x3c')){var _0x460811={};_0x460811[_0x29219d[_0x4fb7('0x28')]]={'$like':'%'+_0xdf54f[_0x4fb7('0x2d')]['filter']+'%'};return _0x460811;}})});}_0x511ad8=_[_0x4fb7('0x3a')]({},_0x511ad8,_0xdf54f[_0x4fb7('0x3d')]);var _0x460cf9={'where':_0x511ad8[_0x4fb7('0x37')]};return db[_0x4fb7('0x2a')][_0x4fb7('0x1d')](_0x460cf9)[_0x4fb7('0x24')](function(_0x5aac3c){_0x3a59df['count']=_0x5aac3c;if(_0xdf54f[_0x4fb7('0x2d')][_0x4fb7('0x3e')]){_0x511ad8[_0x4fb7('0x3f')]=[{'all':!![]}];}return db[_0x4fb7('0x2a')][_0x4fb7('0x40')](_0x511ad8);})[_0x4fb7('0x24')](function(_0x527753){_0x3a59df[_0x4fb7('0x41')]=_0x527753;return _0x3a59df;})[_0x4fb7('0x24')](respondWithFilteredResult(_0x147f4e,_0x511ad8))[_0x4fb7('0x42')](handleError(_0x147f4e,null));};exports[_0x4fb7('0x43')]=function(_0x257e0c,_0x55b6f0){var _0x4b4221={'raw':![],'where':{'id':_0x257e0c[_0x4fb7('0x44')]['id']}},_0x5ba33a={};_0x5ba33a['model']=_['keys'](db['ServicenowConfiguration'][_0x4fb7('0x45')]);_0x5ba33a[_0x4fb7('0x2d')]=_[_0x4fb7('0x2e')](_0x257e0c[_0x4fb7('0x2d')]);_0x5ba33a[_0x4fb7('0x2f')]=_[_0x4fb7('0x46')](_0x5ba33a[_0x4fb7('0x30')],_0x5ba33a[_0x4fb7('0x2d')]);_0x4b4221['attributes']=_['intersection'](_0x5ba33a[_0x4fb7('0x30')],qs['fields'](_0x257e0c['query']['fields']));_0x4b4221[_0x4fb7('0x31')]=_0x4b4221[_0x4fb7('0x31')][_0x4fb7('0x33')]?_0x4b4221['attributes']:_0x5ba33a[_0x4fb7('0x30')];if(_0x257e0c[_0x4fb7('0x2d')][_0x4fb7('0x3e')]){_0x4b4221['include']=[{'all':!![]}];}_0x4b4221=_[_0x4fb7('0x3a')]({},_0x4b4221,_0x257e0c['options']);return db[_0x4fb7('0x2a')][_0x4fb7('0x47')](_0x4b4221)[_0x4fb7('0x24')](handleEntityNotFound(_0x55b6f0,null))[_0x4fb7('0x24')](respondWithResult(_0x55b6f0,null))['catch'](handleError(_0x55b6f0,null));};exports[_0x4fb7('0x48')]=function(_0xf82e7d,_0x4af78e){return db[_0x4fb7('0x2a')][_0x4fb7('0x48')](_0xf82e7d['body'],{})[_0x4fb7('0x24')](respondWithResult(_0x4af78e,0xc9))[_0x4fb7('0x42')](handleError(_0x4af78e,null));};exports[_0x4fb7('0x22')]=function(_0x64ac32,_0x39311f){if(_0x64ac32[_0x4fb7('0x49')]['id']){delete _0x64ac32[_0x4fb7('0x49')]['id'];}return db[_0x4fb7('0x2a')]['find']({'where':{'id':_0x64ac32[_0x4fb7('0x44')]['id']}})[_0x4fb7('0x24')](handleEntityNotFound(_0x39311f,null))[_0x4fb7('0x24')](saveUpdates(_0x64ac32[_0x4fb7('0x49')],null))[_0x4fb7('0x24')](respondWithResult(_0x39311f,null))[_0x4fb7('0x42')](handleError(_0x39311f,null));};exports[_0x4fb7('0x23')]=function(_0x2a3035,_0x3ec6c3){return db[_0x4fb7('0x2a')]['find']({'where':{'id':_0x2a3035[_0x4fb7('0x44')]['id']}})[_0x4fb7('0x24')](handleEntityNotFound(_0x3ec6c3,null))[_0x4fb7('0x24')](removeEntity(_0x3ec6c3,null))[_0x4fb7('0x42')](handleError(_0x3ec6c3,null));};exports[_0x4fb7('0x4a')]=function(_0x4a9f56,_0x28e655,_0x551b4b){var _0x1eb653={};var _0x51d30d={};var _0x1915d6;var _0x59b531;return db['ServicenowConfiguration'][_0x4fb7('0x4b')]({'where':{'id':_0x4a9f56[_0x4fb7('0x44')]['id']}})['then'](handleEntityNotFound(_0x28e655,null))[_0x4fb7('0x24')](function(_0x304fa1){if(_0x304fa1){_0x1915d6=_0x304fa1;_0x51d30d[_0x4fb7('0x30')]=_[_0x4fb7('0x2e')](db[_0x4fb7('0x4c')][_0x4fb7('0x45')]);_0x51d30d['query']=_[_0x4fb7('0x2e')](_0x4a9f56[_0x4fb7('0x2d')]);_0x51d30d[_0x4fb7('0x2f')]=_['intersection'](_0x51d30d[_0x4fb7('0x30')],_0x51d30d[_0x4fb7('0x2d')]);_0x1eb653['attributes']=_['intersection'](_0x51d30d[_0x4fb7('0x30')],qs[_0x4fb7('0x32')](_0x4a9f56[_0x4fb7('0x2d')][_0x4fb7('0x32')]));_0x1eb653[_0x4fb7('0x31')]=_0x1eb653['attributes'][_0x4fb7('0x33')]?_0x1eb653['attributes']:_0x51d30d[_0x4fb7('0x30')];_0x1eb653[_0x4fb7('0x35')]=qs[_0x4fb7('0x36')](_0x4a9f56[_0x4fb7('0x2d')]['sort']);_0x1eb653['where']=qs['filters'](_[_0x4fb7('0x38')](_0x4a9f56[_0x4fb7('0x2d')],_0x51d30d[_0x4fb7('0x2f')]));if(_0x4a9f56['query']['filter']){_0x1eb653[_0x4fb7('0x37')]=_[_0x4fb7('0x3a')](_0x1eb653[_0x4fb7('0x37')],{'$or':_['map'](_0x1eb653[_0x4fb7('0x31')],function(_0x55de8b){var _0x46b6f7={};_0x46b6f7[_0x55de8b]={'$like':'%'+_0x4a9f56[_0x4fb7('0x2d')][_0x4fb7('0x39')]+'%'};return _0x46b6f7;})});}_0x1eb653=_['merge']({},_0x1eb653,_0x4a9f56[_0x4fb7('0x3d')]);return _0x1915d6[_0x4fb7('0x4a')](_0x1eb653);}})[_0x4fb7('0x24')](function(_0x589255){if(_0x589255){_0x59b531=_0x589255['length'];if(!_0x4a9f56['query'][_0x4fb7('0x34')](_0x4fb7('0x4d'))){_0x1eb653[_0x4fb7('0x1b')]=qs[_0x4fb7('0x1b')](_0x4a9f56['query']['limit']);_0x1eb653['offset']=qs[_0x4fb7('0x1c')](_0x4a9f56[_0x4fb7('0x2d')][_0x4fb7('0x1c')]);}return _0x1915d6[_0x4fb7('0x4a')](_0x1eb653);}})['then'](function(_0x5c4239){if(_0x5c4239){return _0x5c4239?{'count':_0x59b531,'rows':_0x5c4239}:null;}})['then'](respondWithResult(_0x28e655,null))['catch'](handleError(_0x28e655,null));};exports[_0x4fb7('0x4e')]=function(_0x25be72,_0x1861b4,_0x5142c0){var _0x4ec710={};var _0x1a10f7={};var _0x376f36;var _0x100d55;return db[_0x4fb7('0x2a')]['findOne']({'where':{'id':_0x25be72['params']['id']}})[_0x4fb7('0x24')](handleEntityNotFound(_0x1861b4,null))[_0x4fb7('0x24')](function(_0x2a74de){if(_0x2a74de){_0x376f36=_0x2a74de;_0x1a10f7[_0x4fb7('0x30')]=_[_0x4fb7('0x2e')](db['ServicenowField'][_0x4fb7('0x45')]);_0x1a10f7['query']=_[_0x4fb7('0x2e')](_0x25be72[_0x4fb7('0x2d')]);_0x1a10f7['filters']=_['intersection'](_0x1a10f7[_0x4fb7('0x30')],_0x1a10f7['query']);_0x4ec710[_0x4fb7('0x31')]=_['intersection'](_0x1a10f7[_0x4fb7('0x30')],qs[_0x4fb7('0x32')](_0x25be72[_0x4fb7('0x2d')]['fields']));_0x4ec710[_0x4fb7('0x31')]=_0x4ec710[_0x4fb7('0x31')]['length']?_0x4ec710[_0x4fb7('0x31')]:_0x1a10f7[_0x4fb7('0x30')];_0x4ec710[_0x4fb7('0x35')]=qs[_0x4fb7('0x36')](_0x25be72[_0x4fb7('0x2d')]['sort']);_0x4ec710[_0x4fb7('0x37')]=qs[_0x4fb7('0x2f')](_['pick'](_0x25be72[_0x4fb7('0x2d')],_0x1a10f7[_0x4fb7('0x2f')]));if(_0x25be72[_0x4fb7('0x2d')][_0x4fb7('0x39')]){_0x4ec710[_0x4fb7('0x37')]=_[_0x4fb7('0x3a')](_0x4ec710[_0x4fb7('0x37')],{'$or':_[_0x4fb7('0x2c')](_0x4ec710[_0x4fb7('0x31')],function(_0x59b1a5){var _0x22cb03={};_0x22cb03[_0x59b1a5]={'$like':'%'+_0x25be72['query'][_0x4fb7('0x39')]+'%'};return _0x22cb03;})});}_0x4ec710=_[_0x4fb7('0x3a')]({},_0x4ec710,_0x25be72[_0x4fb7('0x3d')]);return _0x376f36['getSubjects'](_0x4ec710);}})[_0x4fb7('0x24')](function(_0x389b0f){if(_0x389b0f){_0x100d55=_0x389b0f['length'];if(!_0x25be72[_0x4fb7('0x2d')][_0x4fb7('0x34')](_0x4fb7('0x4d'))){_0x4ec710[_0x4fb7('0x1b')]=qs[_0x4fb7('0x1b')](_0x25be72['query']['limit']);_0x4ec710['offset']=qs[_0x4fb7('0x1c')](_0x25be72[_0x4fb7('0x2d')][_0x4fb7('0x1c')]);}return _0x376f36['getSubjects'](_0x4ec710);}})['then'](function(_0x5d8914){if(_0x5d8914){return _0x5d8914?{'count':_0x100d55,'rows':_0x5d8914}:null;}})[_0x4fb7('0x24')](respondWithResult(_0x1861b4,null))[_0x4fb7('0x42')](handleError(_0x1861b4,null));};exports[_0x4fb7('0x4f')]=function(_0x58a5d4,_0x294e58,_0x183150){var _0x403885={};var _0x4906d4={};var _0x3705c6;var _0x400cfb;return db['ServicenowConfiguration'][_0x4fb7('0x4b')]({'where':{'id':_0x58a5d4[_0x4fb7('0x44')]['id']}})['then'](handleEntityNotFound(_0x294e58,null))[_0x4fb7('0x24')](function(_0x4d1cc9){if(_0x4d1cc9){_0x3705c6=_0x4d1cc9;_0x4906d4[_0x4fb7('0x30')]=_['keys'](db[_0x4fb7('0x4c')][_0x4fb7('0x45')]);_0x4906d4[_0x4fb7('0x2d')]=_[_0x4fb7('0x2e')](_0x58a5d4['query']);_0x4906d4[_0x4fb7('0x2f')]=_[_0x4fb7('0x46')](_0x4906d4[_0x4fb7('0x30')],_0x4906d4[_0x4fb7('0x2d')]);_0x403885[_0x4fb7('0x31')]=_[_0x4fb7('0x46')](_0x4906d4[_0x4fb7('0x30')],qs[_0x4fb7('0x32')](_0x58a5d4[_0x4fb7('0x2d')][_0x4fb7('0x32')]));_0x403885[_0x4fb7('0x31')]=_0x403885['attributes'][_0x4fb7('0x33')]?_0x403885[_0x4fb7('0x31')]:_0x4906d4[_0x4fb7('0x30')];_0x403885[_0x4fb7('0x35')]=qs['sort'](_0x58a5d4['query'][_0x4fb7('0x36')]);_0x403885['where']=qs[_0x4fb7('0x2f')](_[_0x4fb7('0x38')](_0x58a5d4[_0x4fb7('0x2d')],_0x4906d4[_0x4fb7('0x2f')]));if(_0x58a5d4[_0x4fb7('0x2d')]['filter']){_0x403885[_0x4fb7('0x37')]=_[_0x4fb7('0x3a')](_0x403885[_0x4fb7('0x37')],{'$or':_[_0x4fb7('0x2c')](_0x403885[_0x4fb7('0x31')],function(_0xd0118){var _0x23810a={};_0x23810a[_0xd0118]={'$like':'%'+_0x58a5d4['query'][_0x4fb7('0x39')]+'%'};return _0x23810a;})});}_0x403885=_[_0x4fb7('0x3a')]({},_0x403885,_0x58a5d4['options']);return _0x3705c6[_0x4fb7('0x4f')](_0x403885);}})[_0x4fb7('0x24')](function(_0x4dce64){if(_0x4dce64){_0x400cfb=_0x4dce64[_0x4fb7('0x33')];if(!_0x58a5d4[_0x4fb7('0x2d')]['hasOwnProperty']('nolimit')){_0x403885[_0x4fb7('0x1b')]=qs['limit'](_0x58a5d4[_0x4fb7('0x2d')][_0x4fb7('0x1b')]);_0x403885[_0x4fb7('0x1c')]=qs['offset'](_0x58a5d4[_0x4fb7('0x2d')][_0x4fb7('0x1c')]);}return _0x3705c6[_0x4fb7('0x4f')](_0x403885);}})['then'](function(_0x475b47){if(_0x475b47){return _0x475b47?{'count':_0x400cfb,'rows':_0x475b47}:null;}})[_0x4fb7('0x24')](respondWithResult(_0x294e58,null))[_0x4fb7('0x42')](handleError(_0x294e58,null));}; \ No newline at end of file +var _0x75a7=['update','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','then','include','findAll','params','includeAll','find','catch','create','body','getFields','findOne','ServicenowField','pick','getSubjects','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x481f86,_0x4c3961){var _0x3ed4ef=function(_0x51afa1){while(--_0x51afa1){_0x481f86['push'](_0x481f86['shift']());}};_0x3ed4ef(++_0x4c3961);}(_0x75a7,0x117));var _0x775a=function(_0x2b6171,_0x46ea96){_0x2b6171=_0x2b6171-0x0;var _0x55ba2f=_0x75a7[_0x2b6171];return _0x55ba2f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x775a('0x0'));var zipdir=require(_0x775a('0x1'));var jsonpatch=require(_0x775a('0x2'));var rp=require(_0x775a('0x3'));var moment=require(_0x775a('0x4'));var BPromise=require(_0x775a('0x5'));var Mustache=require(_0x775a('0x6'));var util=require(_0x775a('0x7'));var path=require(_0x775a('0x8'));var sox=require('sox');var csv=require(_0x775a('0x9'));var ejs=require(_0x775a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x775a('0xb'));var crypto=require(_0x775a('0xc'));var jsforce=require(_0x775a('0xd'));var deskjs=require(_0x775a('0xe'));var toCsv=require(_0x775a('0x9'));var querystring=require(_0x775a('0xf'));var Papa=require(_0x775a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x775a('0x11'));var as=require(_0x775a('0x12'));var hardwareService=require(_0x775a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x775a('0x14'));var config=require(_0x775a('0x15'));var licenseUtil=require(_0x775a('0x16'));var db=require(_0x775a('0x17'))['db'];function respondWithStatusCode(_0x554c59,_0x4992dd){_0x4992dd=_0x4992dd||0xcc;return function(_0x3c15a3){if(_0x3c15a3){return _0x554c59[_0x775a('0x18')](_0x4992dd);}return _0x554c59[_0x775a('0x19')](_0x4992dd)[_0x775a('0x1a')]();};}function respondWithResult(_0x4302cf,_0x499c52){_0x499c52=_0x499c52||0xc8;return function(_0x163b5f){if(_0x163b5f){return _0x4302cf[_0x775a('0x19')](_0x499c52)[_0x775a('0x1b')](_0x163b5f);}};}function respondWithFilteredResult(_0x175f9b,_0x42002e){return function(_0x29fc23){if(_0x29fc23){var _0x36f77d=typeof _0x42002e[_0x775a('0x1c')]===_0x775a('0x1d')&&typeof _0x42002e[_0x775a('0x1e')]===_0x775a('0x1d');var _0x493bff=_0x29fc23['count'];var _0x25711c=_0x36f77d?0x0:_0x42002e[_0x775a('0x1c')];var _0x1f324b=_0x36f77d?_0x29fc23[_0x775a('0x1f')]:_0x42002e[_0x775a('0x1c')]+_0x42002e[_0x775a('0x1e')];var _0x22524d;if(_0x1f324b>=_0x493bff){_0x1f324b=_0x493bff;_0x22524d=0xc8;}else{_0x22524d=0xce;}_0x175f9b[_0x775a('0x19')](_0x22524d);return _0x175f9b[_0x775a('0x20')](_0x775a('0x21'),_0x25711c+'-'+_0x1f324b+'/'+_0x493bff)[_0x775a('0x1b')](_0x29fc23);}return null;};}function patchUpdates(_0x5a7edd){return function(_0x483b8b){try{jsonpatch[_0x775a('0x22')](_0x483b8b,_0x5a7edd,!![]);}catch(_0x2dfef3){return BPromise[_0x775a('0x23')](_0x2dfef3);}return _0x483b8b[_0x775a('0x24')]();};}function saveUpdates(_0x4182f4,_0x156445){return function(_0x51bc8b){if(_0x51bc8b){return _0x51bc8b[_0x775a('0x25')](_0x4182f4)['then'](function(_0x98c670){return _0x98c670;});}return null;};}function removeEntity(_0x11844d,_0x490347){return function(_0x31397c){if(_0x31397c){return _0x31397c[_0x775a('0x26')]()['then'](function(){_0x11844d[_0x775a('0x19')](0xcc)[_0x775a('0x1a')]();});}};}function handleEntityNotFound(_0x1df1ec,_0x21b193){return function(_0x3952c4){if(!_0x3952c4){_0x1df1ec[_0x775a('0x18')](0x194);}return _0x3952c4;};}function handleError(_0x176f44,_0x2993ab){_0x2993ab=_0x2993ab||0x1f4;return function(_0x579604){logger[_0x775a('0x27')](_0x579604[_0x775a('0x28')]);if(_0x579604[_0x775a('0x29')]){delete _0x579604['name'];}_0x176f44['status'](_0x2993ab)[_0x775a('0x2a')](_0x579604);};}exports[_0x775a('0x2b')]=function(_0x5c2231,_0x3ed86c){var _0x15e029={},_0x4cce05={},_0xc9eea0={'count':0x0,'rows':[]};var _0x2d7ec1=_[_0x775a('0x2c')](db[_0x775a('0x2d')][_0x775a('0x2e')],function(_0x48107b){return{'name':_0x48107b['fieldName'],'type':_0x48107b[_0x775a('0x2f')][_0x775a('0x30')]};});_0x4cce05[_0x775a('0x31')]=_[_0x775a('0x2c')](_0x2d7ec1,_0x775a('0x29'));_0x4cce05[_0x775a('0x32')]=_[_0x775a('0x33')](_0x5c2231[_0x775a('0x32')]);_0x4cce05[_0x775a('0x34')]=_[_0x775a('0x35')](_0x4cce05['model'],_0x4cce05['query']);_0x15e029['attributes']=_[_0x775a('0x35')](_0x4cce05['model'],qs[_0x775a('0x36')](_0x5c2231[_0x775a('0x32')][_0x775a('0x36')]));_0x15e029[_0x775a('0x37')]=_0x15e029['attributes'][_0x775a('0x38')]?_0x15e029[_0x775a('0x37')]:_0x4cce05[_0x775a('0x31')];if(!_0x5c2231[_0x775a('0x32')][_0x775a('0x39')](_0x775a('0x3a'))){_0x15e029[_0x775a('0x1e')]=qs[_0x775a('0x1e')](_0x5c2231[_0x775a('0x32')]['limit']);_0x15e029[_0x775a('0x1c')]=qs[_0x775a('0x1c')](_0x5c2231[_0x775a('0x32')][_0x775a('0x1c')]);}_0x15e029[_0x775a('0x3b')]=qs[_0x775a('0x3c')](_0x5c2231[_0x775a('0x32')]['sort']);_0x15e029['where']=qs['filters'](_['pick'](_0x5c2231[_0x775a('0x32')],_0x4cce05[_0x775a('0x34')]),_0x2d7ec1);if(_0x5c2231[_0x775a('0x32')][_0x775a('0x3d')]){_0x15e029[_0x775a('0x3e')]=_[_0x775a('0x3f')](_0x15e029['where'],{'$or':_[_0x775a('0x2c')](_0x2d7ec1,function(_0x563611){if(_0x563611['type']!=='VIRTUAL'){var _0x294af1={};_0x294af1[_0x563611[_0x775a('0x29')]]={'$like':'%'+_0x5c2231[_0x775a('0x32')][_0x775a('0x3d')]+'%'};return _0x294af1;}})});}_0x15e029=_[_0x775a('0x3f')]({},_0x15e029,_0x5c2231[_0x775a('0x40')]);var _0x2550f2={'where':_0x15e029[_0x775a('0x3e')]};return db[_0x775a('0x2d')]['count'](_0x2550f2)[_0x775a('0x41')](function(_0xb3fa79){_0xc9eea0[_0x775a('0x1f')]=_0xb3fa79;if(_0x5c2231[_0x775a('0x32')]['includeAll']){_0x15e029[_0x775a('0x42')]=[{'all':!![]}];}return db[_0x775a('0x2d')][_0x775a('0x43')](_0x15e029);})['then'](function(_0x283554){_0xc9eea0['rows']=_0x283554;return _0xc9eea0;})[_0x775a('0x41')](respondWithFilteredResult(_0x3ed86c,_0x15e029))['catch'](handleError(_0x3ed86c,null));};exports['show']=function(_0x1463ca,_0x41a5bf){var _0x52d38a={'raw':![],'where':{'id':_0x1463ca[_0x775a('0x44')]['id']}},_0x1941f8={};_0x1941f8['model']=_[_0x775a('0x33')](db[_0x775a('0x2d')][_0x775a('0x2e')]);_0x1941f8[_0x775a('0x32')]=_[_0x775a('0x33')](_0x1463ca[_0x775a('0x32')]);_0x1941f8[_0x775a('0x34')]=_[_0x775a('0x35')](_0x1941f8[_0x775a('0x31')],_0x1941f8[_0x775a('0x32')]);_0x52d38a[_0x775a('0x37')]=_[_0x775a('0x35')](_0x1941f8['model'],qs['fields'](_0x1463ca['query'][_0x775a('0x36')]));_0x52d38a[_0x775a('0x37')]=_0x52d38a[_0x775a('0x37')][_0x775a('0x38')]?_0x52d38a[_0x775a('0x37')]:_0x1941f8[_0x775a('0x31')];if(_0x1463ca[_0x775a('0x32')][_0x775a('0x45')]){_0x52d38a[_0x775a('0x42')]=[{'all':!![]}];}_0x52d38a=_[_0x775a('0x3f')]({},_0x52d38a,_0x1463ca[_0x775a('0x40')]);return db['ServicenowConfiguration'][_0x775a('0x46')](_0x52d38a)[_0x775a('0x41')](handleEntityNotFound(_0x41a5bf,null))[_0x775a('0x41')](respondWithResult(_0x41a5bf,null))[_0x775a('0x47')](handleError(_0x41a5bf,null));};exports[_0x775a('0x48')]=function(_0x1aaced,_0x5122de){return db[_0x775a('0x2d')][_0x775a('0x48')](_0x1aaced['body'],{})[_0x775a('0x41')](respondWithResult(_0x5122de,0xc9))['catch'](handleError(_0x5122de,null));};exports[_0x775a('0x25')]=function(_0x45d58b,_0x81d894){if(_0x45d58b[_0x775a('0x49')]['id']){delete _0x45d58b[_0x775a('0x49')]['id'];}return db[_0x775a('0x2d')][_0x775a('0x46')]({'where':{'id':_0x45d58b[_0x775a('0x44')]['id']}})[_0x775a('0x41')](handleEntityNotFound(_0x81d894,null))[_0x775a('0x41')](saveUpdates(_0x45d58b[_0x775a('0x49')],null))[_0x775a('0x41')](respondWithResult(_0x81d894,null))['catch'](handleError(_0x81d894,null));};exports['destroy']=function(_0x42b91c,_0x51d68d){return db[_0x775a('0x2d')][_0x775a('0x46')]({'where':{'id':_0x42b91c['params']['id']}})[_0x775a('0x41')](handleEntityNotFound(_0x51d68d,null))[_0x775a('0x41')](removeEntity(_0x51d68d,null))['catch'](handleError(_0x51d68d,null));};exports[_0x775a('0x4a')]=function(_0x411219,_0x449d46,_0x55888c){var _0xcf9d36={};var _0x285a49={};var _0x3610dc;var _0x2486a6;return db['ServicenowConfiguration'][_0x775a('0x4b')]({'where':{'id':_0x411219['params']['id']}})['then'](handleEntityNotFound(_0x449d46,null))[_0x775a('0x41')](function(_0x171da9){if(_0x171da9){_0x3610dc=_0x171da9;_0x285a49[_0x775a('0x31')]=_[_0x775a('0x33')](db[_0x775a('0x4c')]['rawAttributes']);_0x285a49[_0x775a('0x32')]=_[_0x775a('0x33')](_0x411219[_0x775a('0x32')]);_0x285a49[_0x775a('0x34')]=_[_0x775a('0x35')](_0x285a49[_0x775a('0x31')],_0x285a49[_0x775a('0x32')]);_0xcf9d36['attributes']=_['intersection'](_0x285a49[_0x775a('0x31')],qs[_0x775a('0x36')](_0x411219[_0x775a('0x32')][_0x775a('0x36')]));_0xcf9d36['attributes']=_0xcf9d36[_0x775a('0x37')][_0x775a('0x38')]?_0xcf9d36[_0x775a('0x37')]:_0x285a49[_0x775a('0x31')];_0xcf9d36[_0x775a('0x3b')]=qs[_0x775a('0x3c')](_0x411219['query']['sort']);_0xcf9d36[_0x775a('0x3e')]=qs[_0x775a('0x34')](_[_0x775a('0x4d')](_0x411219[_0x775a('0x32')],_0x285a49[_0x775a('0x34')]));if(_0x411219[_0x775a('0x32')][_0x775a('0x3d')]){_0xcf9d36[_0x775a('0x3e')]=_['merge'](_0xcf9d36[_0x775a('0x3e')],{'$or':_[_0x775a('0x2c')](_0xcf9d36['attributes'],function(_0x249e76){var _0xf86735={};_0xf86735[_0x249e76]={'$like':'%'+_0x411219[_0x775a('0x32')]['filter']+'%'};return _0xf86735;})});}_0xcf9d36=_['merge']({},_0xcf9d36,_0x411219[_0x775a('0x40')]);return _0x3610dc[_0x775a('0x4a')](_0xcf9d36);}})[_0x775a('0x41')](function(_0x59590c){if(_0x59590c){_0x2486a6=_0x59590c[_0x775a('0x38')];if(!_0x411219[_0x775a('0x32')][_0x775a('0x39')](_0x775a('0x3a'))){_0xcf9d36[_0x775a('0x1e')]=qs[_0x775a('0x1e')](_0x411219[_0x775a('0x32')][_0x775a('0x1e')]);_0xcf9d36[_0x775a('0x1c')]=qs[_0x775a('0x1c')](_0x411219[_0x775a('0x32')][_0x775a('0x1c')]);}return _0x3610dc[_0x775a('0x4a')](_0xcf9d36);}})[_0x775a('0x41')](function(_0x370b1e){if(_0x370b1e){return _0x370b1e?{'count':_0x2486a6,'rows':_0x370b1e}:null;}})[_0x775a('0x41')](respondWithResult(_0x449d46,null))[_0x775a('0x47')](handleError(_0x449d46,null));};exports[_0x775a('0x4e')]=function(_0x26a3b8,_0x365254,_0x2fe916){var _0x87894={};var _0x4f8815={};var _0x4cf5e4;var _0x362f95;return db[_0x775a('0x2d')][_0x775a('0x4b')]({'where':{'id':_0x26a3b8[_0x775a('0x44')]['id']}})[_0x775a('0x41')](handleEntityNotFound(_0x365254,null))[_0x775a('0x41')](function(_0x3b4ae5){if(_0x3b4ae5){_0x4cf5e4=_0x3b4ae5;_0x4f8815['model']=_[_0x775a('0x33')](db[_0x775a('0x4c')][_0x775a('0x2e')]);_0x4f8815[_0x775a('0x32')]=_['keys'](_0x26a3b8[_0x775a('0x32')]);_0x4f8815[_0x775a('0x34')]=_[_0x775a('0x35')](_0x4f8815[_0x775a('0x31')],_0x4f8815[_0x775a('0x32')]);_0x87894['attributes']=_[_0x775a('0x35')](_0x4f8815[_0x775a('0x31')],qs[_0x775a('0x36')](_0x26a3b8[_0x775a('0x32')][_0x775a('0x36')]));_0x87894[_0x775a('0x37')]=_0x87894[_0x775a('0x37')][_0x775a('0x38')]?_0x87894['attributes']:_0x4f8815[_0x775a('0x31')];_0x87894[_0x775a('0x3b')]=qs['sort'](_0x26a3b8[_0x775a('0x32')][_0x775a('0x3c')]);_0x87894[_0x775a('0x3e')]=qs['filters'](_[_0x775a('0x4d')](_0x26a3b8[_0x775a('0x32')],_0x4f8815[_0x775a('0x34')]));if(_0x26a3b8[_0x775a('0x32')]['filter']){_0x87894[_0x775a('0x3e')]=_[_0x775a('0x3f')](_0x87894['where'],{'$or':_[_0x775a('0x2c')](_0x87894['attributes'],function(_0x15a83f){var _0x2f4eaf={};_0x2f4eaf[_0x15a83f]={'$like':'%'+_0x26a3b8[_0x775a('0x32')][_0x775a('0x3d')]+'%'};return _0x2f4eaf;})});}_0x87894=_[_0x775a('0x3f')]({},_0x87894,_0x26a3b8[_0x775a('0x40')]);return _0x4cf5e4[_0x775a('0x4e')](_0x87894);}})[_0x775a('0x41')](function(_0x431b30){if(_0x431b30){_0x362f95=_0x431b30['length'];if(!_0x26a3b8[_0x775a('0x32')][_0x775a('0x39')](_0x775a('0x3a'))){_0x87894['limit']=qs[_0x775a('0x1e')](_0x26a3b8[_0x775a('0x32')]['limit']);_0x87894[_0x775a('0x1c')]=qs[_0x775a('0x1c')](_0x26a3b8[_0x775a('0x32')][_0x775a('0x1c')]);}return _0x4cf5e4[_0x775a('0x4e')](_0x87894);}})['then'](function(_0x3cb89f){if(_0x3cb89f){return _0x3cb89f?{'count':_0x362f95,'rows':_0x3cb89f}:null;}})['then'](respondWithResult(_0x365254,null))[_0x775a('0x47')](handleError(_0x365254,null));};exports['getDescriptions']=function(_0x14eb42,_0x1e06c4,_0x40c0d4){var _0x21e471={};var _0x119be0={};var _0x1133be;var _0x10b2f5;return db[_0x775a('0x2d')][_0x775a('0x4b')]({'where':{'id':_0x14eb42[_0x775a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1e06c4,null))[_0x775a('0x41')](function(_0x2c1b1d){if(_0x2c1b1d){_0x1133be=_0x2c1b1d;_0x119be0[_0x775a('0x31')]=_['keys'](db['ServicenowField'][_0x775a('0x2e')]);_0x119be0['query']=_[_0x775a('0x33')](_0x14eb42['query']);_0x119be0[_0x775a('0x34')]=_['intersection'](_0x119be0[_0x775a('0x31')],_0x119be0['query']);_0x21e471[_0x775a('0x37')]=_[_0x775a('0x35')](_0x119be0[_0x775a('0x31')],qs[_0x775a('0x36')](_0x14eb42[_0x775a('0x32')][_0x775a('0x36')]));_0x21e471['attributes']=_0x21e471[_0x775a('0x37')][_0x775a('0x38')]?_0x21e471[_0x775a('0x37')]:_0x119be0['model'];_0x21e471[_0x775a('0x3b')]=qs[_0x775a('0x3c')](_0x14eb42[_0x775a('0x32')][_0x775a('0x3c')]);_0x21e471['where']=qs[_0x775a('0x34')](_[_0x775a('0x4d')](_0x14eb42[_0x775a('0x32')],_0x119be0[_0x775a('0x34')]));if(_0x14eb42[_0x775a('0x32')]['filter']){_0x21e471[_0x775a('0x3e')]=_[_0x775a('0x3f')](_0x21e471['where'],{'$or':_['map'](_0x21e471['attributes'],function(_0x46b975){var _0x305b4f={};_0x305b4f[_0x46b975]={'$like':'%'+_0x14eb42['query'][_0x775a('0x3d')]+'%'};return _0x305b4f;})});}_0x21e471=_[_0x775a('0x3f')]({},_0x21e471,_0x14eb42[_0x775a('0x40')]);return _0x1133be['getDescriptions'](_0x21e471);}})[_0x775a('0x41')](function(_0x2f6b4a){if(_0x2f6b4a){_0x10b2f5=_0x2f6b4a[_0x775a('0x38')];if(!_0x14eb42[_0x775a('0x32')][_0x775a('0x39')]('nolimit')){_0x21e471[_0x775a('0x1e')]=qs[_0x775a('0x1e')](_0x14eb42[_0x775a('0x32')][_0x775a('0x1e')]);_0x21e471[_0x775a('0x1c')]=qs[_0x775a('0x1c')](_0x14eb42['query'][_0x775a('0x1c')]);}return _0x1133be['getDescriptions'](_0x21e471);}})[_0x775a('0x41')](function(_0x47b095){if(_0x47b095){return _0x47b095?{'count':_0x10b2f5,'rows':_0x47b095}:null;}})[_0x775a('0x41')](respondWithResult(_0x1e06c4,null))[_0x775a('0x47')](handleError(_0x1e06c4,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 01eabda..367c655 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 _0xf4ce=['ServicenowConfiguration','int_servicenow_configurations','lodash','api','moment','bluebird','request-promise','define'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xf4ce,0xf2));var _0xef4c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf4ce[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xef4c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xef4c('0x1'));var moment=require(_0xef4c('0x2'));var BPromise=require(_0xef4c('0x3'));var rp=require(_0xef4c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x2488f4,_0x3e7b2a){return _0x2488f4[_0xef4c('0x5')](_0xef4c('0x6'),attributes,{'tableName':_0xef4c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9348=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x39a95b,_0x4f5c0d){var _0x1e39c3=function(_0x1b88a9){while(--_0x1b88a9){_0x39a95b['push'](_0x39a95b['shift']());}};_0x1e39c3(++_0x4f5c0d);}(_0x9348,0x10d));var _0x8934=function(_0xcb70f6,_0x4d87a7){_0xcb70f6=_0xcb70f6-0x0;var _0x4b5ec7=_0x9348[_0xcb70f6];return _0x4b5ec7;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var logger=require(_0x8934('0x2'))(_0x8934('0x3'));var moment=require(_0x8934('0x4'));var BPromise=require('bluebird');var rp=require(_0x8934('0x5'));var fs=require('fs');var path=require(_0x8934('0x6'));var rimraf=require('rimraf');var config=require(_0x8934('0x7'));var attributes=require(_0x8934('0x8'));module[_0x8934('0x9')]=function(_0x2bce03,_0x4c70d7){return _0x2bce03[_0x8934('0xa')]('ServicenowConfiguration',attributes,{'tableName':_0x8934('0xb'),'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 678ac5b..7ae58c4 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 _0xb6b7=['request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xb6b7,0xe4));var _0x7b6b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb6b7[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x7b6b('0x0'));var util=require(_0x7b6b('0x1'));var moment=require(_0x7b6b('0x2'));var BPromise=require(_0x7b6b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b6b('0x4'))['db'];var utils=require(_0x7b6b('0x5'));var logger=require(_0x7b6b('0x6'))(_0x7b6b('0x7'));var config=require('../../config/environment');var jayson=require(_0x7b6b('0x8'));var client=jayson[_0x7b6b('0x9')][_0x7b6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32572f,_0x58c566,_0x1bc86b){return new BPromise(function(_0x219300,_0xb2d177){return client[_0x7b6b('0xb')](_0x32572f,_0x1bc86b)['then'](function(_0x429314){logger[_0x7b6b('0xc')](_0x7b6b('0xd'),_0x58c566,_0x7b6b('0xe'));logger[_0x7b6b('0xf')](_0x7b6b('0x10'),_0x58c566,'request\x20sent',JSON[_0x7b6b('0x11')](_0x429314));if(_0x429314[_0x7b6b('0x12')]){if(_0x429314[_0x7b6b('0x12')]['code']===0x1f4){logger[_0x7b6b('0x12')](_0x7b6b('0xd'),_0x58c566,_0x429314[_0x7b6b('0x12')][_0x7b6b('0x13')]);return _0xb2d177(_0x429314[_0x7b6b('0x12')]['message']);}logger[_0x7b6b('0x12')]('ServicenowConfiguration,\x20%s,\x20%s',_0x58c566,_0x429314[_0x7b6b('0x12')][_0x7b6b('0x13')]);return _0x219300(_0x429314[_0x7b6b('0x12')][_0x7b6b('0x13')]);}else{logger[_0x7b6b('0xc')](_0x7b6b('0xd'),_0x58c566,_0x7b6b('0xe'));_0x219300(_0x429314[_0x7b6b('0x14')][_0x7b6b('0x13')]);}})[_0x7b6b('0x15')](function(_0x418e5a){logger[_0x7b6b('0x12')](_0x7b6b('0xd'),_0x58c566,_0x418e5a);_0xb2d177(_0x418e5a);});});} \ No newline at end of file +var _0x494e=['ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x42e432,_0x5bd026){var _0x2c08e9=function(_0x57617f){while(--_0x57617f){_0x42e432['push'](_0x42e432['shift']());}};_0x2c08e9(++_0x5bd026);}(_0x494e,0xd6));var _0xe494=function(_0x29c093,_0x6f4c04){_0x29c093=_0x29c093-0x0;var _0x51b280=_0x494e[_0x29c093];return _0x51b280;};'use strict';var _=require(_0xe494('0x0'));var util=require('util');var moment=require(_0xe494('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe494('0x2'));var db=require(_0xe494('0x3'))['db'];var utils=require(_0xe494('0x4'));var logger=require(_0xe494('0x5'))(_0xe494('0x6'));var config=require(_0xe494('0x7'));var jayson=require(_0xe494('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16773d,_0x298248,_0x7c1e3e){return new BPromise(function(_0x1c477d,_0x39bca1){return client[_0xe494('0x9')](_0x16773d,_0x7c1e3e)[_0xe494('0xa')](function(_0x58de64){logger[_0xe494('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x298248,'request\x20sent');logger[_0xe494('0xc')](_0xe494('0xd'),_0x298248,_0xe494('0xe'),JSON[_0xe494('0xf')](_0x58de64));if(_0x58de64['error']){if(_0x58de64['error']['code']===0x1f4){logger[_0xe494('0x10')](_0xe494('0x11'),_0x298248,_0x58de64[_0xe494('0x10')]['message']);return _0x39bca1(_0x58de64[_0xe494('0x10')][_0xe494('0x12')]);}logger[_0xe494('0x10')](_0xe494('0x11'),_0x298248,_0x58de64['error'][_0xe494('0x12')]);return _0x1c477d(_0x58de64['error']['message']);}else{logger[_0xe494('0xb')](_0xe494('0x11'),_0x298248,_0xe494('0xe'));_0x1c477d(_0x58de64[_0xe494('0x13')]['message']);}})[_0xe494('0x14')](function(_0x283602){logger[_0xe494('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x298248,_0x283602);_0x39bca1(_0x283602);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 615c4bd..f6c9bb2 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 _0xcbf5=['express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','post','create','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x3cb988,_0x379b24){var _0x2628f0=function(_0x3d4230){while(--_0x3d4230){_0x3cb988['push'](_0x3cb988['shift']());}};_0x2628f0(++_0x379b24);}(_0xcbf5,0x184));var _0x5cbf=function(_0x26cf6b,_0x3c5983){_0x26cf6b=_0x26cf6b-0x0;var _0x26d527=_0xcbf5[_0x26cf6b];return _0x26d527;};'use strict';var multer=require(_0x5cbf('0x0'));var util=require(_0x5cbf('0x1'));var path=require(_0x5cbf('0x2'));var timeout=require('connect-timeout');var express=require(_0x5cbf('0x3'));var router=express[_0x5cbf('0x4')]();var fs_extra=require(_0x5cbf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5cbf('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0x5cbf('0x7')]('/',auth[_0x5cbf('0x8')](),controller['index']);router[_0x5cbf('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5cbf('0x9')]('/',auth[_0x5cbf('0x8')](),controller[_0x5cbf('0xa')]);router[_0x5cbf('0xb')](_0x5cbf('0xc'),auth[_0x5cbf('0x8')](),controller[_0x5cbf('0xd')]);router[_0x5cbf('0xe')](_0x5cbf('0xc'),auth[_0x5cbf('0x8')](),controller[_0x5cbf('0xf')]);module[_0x5cbf('0x10')]=router; \ No newline at end of file +var _0x17b8=['express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','update','/:id','destroy','multer','util','connect-timeout'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x17b8,0x151));var _0x817b=function(_0x518467,_0x383a5f){_0x518467=_0x518467-0x0;var _0x5a0ee4=_0x17b8[_0x518467];return _0x5a0ee4;};'use strict';var multer=require(_0x817b('0x0'));var util=require(_0x817b('0x1'));var path=require('path');var timeout=require(_0x817b('0x2'));var express=require(_0x817b('0x3'));var router=express['Router']();var fs_extra=require(_0x817b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x817b('0x5'));var config=require(_0x817b('0x6'));var controller=require('./intServicenowField.controller');router[_0x817b('0x7')]('/',auth[_0x817b('0x8')](),controller[_0x817b('0x9')]);router['get']('/:id',auth[_0x817b('0x8')](),controller[_0x817b('0xa')]);router[_0x817b('0xb')]('/',auth[_0x817b('0x8')](),controller[_0x817b('0xc')]);router[_0x817b('0xd')]('/:id',auth[_0x817b('0x8')](),controller[_0x817b('0xe')]);router['delete'](_0x817b('0xf'),auth[_0x817b('0x8')](),controller[_0x817b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index c8d8046..67ca993 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 _0xa734=['string','sequelize','ENUM','variable','customVariable','STRING'];(function(_0x7a7a76,_0x1c2ddb){var _0x468948=function(_0x266e6e){while(--_0x266e6e){_0x7a7a76['push'](_0x7a7a76['shift']());}};_0x468948(++_0x1c2ddb);}(_0xa734,0x127));var _0x4a73=function(_0x113af9,_0x4d9c48){_0x113af9=_0x113af9-0x0;var _0x555d1e=_0xa734[_0x113af9];return _0x555d1e;};'use strict';var Sequelize=require(_0x4a73('0x0'));module['exports']={'type':{'type':Sequelize[_0x4a73('0x1')]('string',_0x4a73('0x2'),_0x4a73('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x4a73('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x4a73('0x5'),_0x4a73('0x2'),_0x4a73('0x3'))},'keyContent':{'type':Sequelize[_0x4a73('0x4')]},'idField':{'type':Sequelize[_0x4a73('0x4')]},'nameField':{'type':Sequelize[_0x4a73('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4a73('0x4')]}}; \ No newline at end of file +var _0xd292=['keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable'];(function(_0x3a9e1a,_0x6188e1){var _0x333774=function(_0x5378fb){while(--_0x5378fb){_0x3a9e1a['push'](_0x3a9e1a['shift']());}};_0x333774(++_0x6188e1);}(_0xd292,0x1ea));var _0x2d29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd292[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2d29('0x0'));module['exports']={'type':{'type':Sequelize[_0x2d29('0x1')](_0x2d29('0x2'),_0x2d29('0x3'),_0x2d29('0x4'),_0x2d29('0x5'),_0x2d29('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2d29('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x2d29('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x2d29('0x7')]},'idField':{'type':Sequelize[_0x2d29('0x7')]},'nameField':{'type':Sequelize[_0x2d29('0x7')]},'customField':{'type':Sequelize[_0x2d29('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2d29('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 775b19f..e71c01e 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 _0xfc27=['includeAll','findAll','catch','show','include','create','body','update','find','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options'];(function(_0x63d4c3,_0x33e2e5){var _0x5bb6dd=function(_0x5504a4){while(--_0x5504a4){_0x63d4c3['push'](_0x63d4c3['shift']());}};_0x5bb6dd(++_0x33e2e5);}(_0xfc27,0x12e));var _0x7fc2=function(_0x10794b,_0x5d6867){_0x10794b=_0x10794b-0x0;var _0x8585e3=_0xfc27[_0x10794b];return _0x8585e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fc2('0x0'));var zipdir=require(_0x7fc2('0x1'));var jsonpatch=require(_0x7fc2('0x2'));var rp=require('request-promise');var moment=require(_0x7fc2('0x3'));var BPromise=require(_0x7fc2('0x4'));var Mustache=require(_0x7fc2('0x5'));var util=require(_0x7fc2('0x6'));var path=require(_0x7fc2('0x7'));var sox=require(_0x7fc2('0x8'));var csv=require('to-csv');var ejs=require(_0x7fc2('0x9'));var fs=require('fs');var fs_extra=require(_0x7fc2('0xa'));var _=require('lodash');var squel=require(_0x7fc2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7fc2('0xc'));var toCsv=require(_0x7fc2('0xd'));var querystring=require('querystring');var Papa=require(_0x7fc2('0xe'));var Redis=require(_0x7fc2('0xf'));var authService=require(_0x7fc2('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7fc2('0x11'));var hardwareService=require(_0x7fc2('0x12'));var logger=require(_0x7fc2('0x13'))('api');var utils=require(_0x7fc2('0x14'));var config=require(_0x7fc2('0x15'));var licenseUtil=require(_0x7fc2('0x16'));var db=require(_0x7fc2('0x17'))['db'];function respondWithStatusCode(_0x23c3f2,_0x306c34){_0x306c34=_0x306c34||0xcc;return function(_0x3b2f88){if(_0x3b2f88){return _0x23c3f2[_0x7fc2('0x18')](_0x306c34);}return _0x23c3f2[_0x7fc2('0x19')](_0x306c34)[_0x7fc2('0x1a')]();};}function respondWithResult(_0x4c5fa2,_0x5f5803){_0x5f5803=_0x5f5803||0xc8;return function(_0x393b5c){if(_0x393b5c){return _0x4c5fa2[_0x7fc2('0x19')](_0x5f5803)[_0x7fc2('0x1b')](_0x393b5c);}};}function respondWithFilteredResult(_0x3ebaba,_0xd27923){return function(_0xc28ce5){if(_0xc28ce5){var _0x4da326=typeof _0xd27923[_0x7fc2('0x1c')]===_0x7fc2('0x1d')&&typeof _0xd27923['limit']===_0x7fc2('0x1d');var _0x46076f=_0xc28ce5[_0x7fc2('0x1e')];var _0x1f111=_0x4da326?0x0:_0xd27923[_0x7fc2('0x1c')];var _0x353997=_0x4da326?_0xc28ce5['count']:_0xd27923[_0x7fc2('0x1c')]+_0xd27923[_0x7fc2('0x1f')];var _0x4b0493;if(_0x353997>=_0x46076f){_0x353997=_0x46076f;_0x4b0493=0xc8;}else{_0x4b0493=0xce;}_0x3ebaba[_0x7fc2('0x19')](_0x4b0493);return _0x3ebaba['set'](_0x7fc2('0x20'),_0x1f111+'-'+_0x353997+'/'+_0x46076f)['json'](_0xc28ce5);}return null;};}function patchUpdates(_0x4a4e2f){return function(_0x2993cc){try{jsonpatch['apply'](_0x2993cc,_0x4a4e2f,!![]);}catch(_0x4f823d){return BPromise[_0x7fc2('0x21')](_0x4f823d);}return _0x2993cc[_0x7fc2('0x22')]();};}function saveUpdates(_0x2e26f9,_0x190012){return function(_0x3353c6){if(_0x3353c6){return _0x3353c6['update'](_0x2e26f9)[_0x7fc2('0x23')](function(_0x3c12cd){return _0x3c12cd;});}return null;};}function removeEntity(_0x548bda,_0x23c04d){return function(_0x59d0d4){if(_0x59d0d4){return _0x59d0d4[_0x7fc2('0x24')]()[_0x7fc2('0x23')](function(){_0x548bda[_0x7fc2('0x19')](0xcc)[_0x7fc2('0x1a')]();});}};}function handleEntityNotFound(_0x4bc3b8,_0x1408f6){return function(_0x26b646){if(!_0x26b646){_0x4bc3b8[_0x7fc2('0x18')](0x194);}return _0x26b646;};}function handleError(_0x1e39e1,_0x1572ee){_0x1572ee=_0x1572ee||0x1f4;return function(_0x34aa0d){logger[_0x7fc2('0x25')](_0x34aa0d[_0x7fc2('0x26')]);if(_0x34aa0d[_0x7fc2('0x27')]){delete _0x34aa0d[_0x7fc2('0x27')];}_0x1e39e1[_0x7fc2('0x19')](_0x1572ee)[_0x7fc2('0x28')](_0x34aa0d);};}exports[_0x7fc2('0x29')]=function(_0x18fb63,_0x5a8975){var _0x2cca2b={},_0x7abbc3={},_0x66f97b={'count':0x0,'rows':[]};var _0x5d8a17=_[_0x7fc2('0x2a')](db[_0x7fc2('0x2b')][_0x7fc2('0x2c')],function(_0xc204c1){return{'name':_0xc204c1[_0x7fc2('0x2d')],'type':_0xc204c1[_0x7fc2('0x2e')]['key']};});_0x7abbc3[_0x7fc2('0x2f')]=_[_0x7fc2('0x2a')](_0x5d8a17,_0x7fc2('0x27'));_0x7abbc3[_0x7fc2('0x30')]=_[_0x7fc2('0x31')](_0x18fb63[_0x7fc2('0x30')]);_0x7abbc3[_0x7fc2('0x32')]=_[_0x7fc2('0x33')](_0x7abbc3[_0x7fc2('0x2f')],_0x7abbc3[_0x7fc2('0x30')]);_0x2cca2b[_0x7fc2('0x34')]=_[_0x7fc2('0x33')](_0x7abbc3[_0x7fc2('0x2f')],qs[_0x7fc2('0x35')](_0x18fb63['query'][_0x7fc2('0x35')]));_0x2cca2b[_0x7fc2('0x34')]=_0x2cca2b[_0x7fc2('0x34')][_0x7fc2('0x36')]?_0x2cca2b[_0x7fc2('0x34')]:_0x7abbc3[_0x7fc2('0x2f')];if(!_0x18fb63[_0x7fc2('0x30')][_0x7fc2('0x37')](_0x7fc2('0x38'))){_0x2cca2b[_0x7fc2('0x1f')]=qs[_0x7fc2('0x1f')](_0x18fb63[_0x7fc2('0x30')][_0x7fc2('0x1f')]);_0x2cca2b['offset']=qs[_0x7fc2('0x1c')](_0x18fb63[_0x7fc2('0x30')][_0x7fc2('0x1c')]);}_0x2cca2b[_0x7fc2('0x39')]=qs[_0x7fc2('0x3a')](_0x18fb63[_0x7fc2('0x30')][_0x7fc2('0x3a')]);_0x2cca2b[_0x7fc2('0x3b')]=qs[_0x7fc2('0x32')](_['pick'](_0x18fb63[_0x7fc2('0x30')],_0x7abbc3[_0x7fc2('0x32')]),_0x5d8a17);if(_0x18fb63['query'][_0x7fc2('0x3c')]){_0x2cca2b[_0x7fc2('0x3b')]=_[_0x7fc2('0x3d')](_0x2cca2b[_0x7fc2('0x3b')],{'$or':_[_0x7fc2('0x2a')](_0x5d8a17,function(_0x1517fe){if(_0x1517fe[_0x7fc2('0x2e')]!=='VIRTUAL'){var _0x6f6b64={};_0x6f6b64[_0x1517fe[_0x7fc2('0x27')]]={'$like':'%'+_0x18fb63['query']['filter']+'%'};return _0x6f6b64;}})});}_0x2cca2b=_[_0x7fc2('0x3d')]({},_0x2cca2b,_0x18fb63[_0x7fc2('0x3e')]);var _0x1bb266={'where':_0x2cca2b[_0x7fc2('0x3b')]};return db['ServicenowField'][_0x7fc2('0x1e')](_0x1bb266)[_0x7fc2('0x23')](function(_0x49ff60){_0x66f97b[_0x7fc2('0x1e')]=_0x49ff60;if(_0x18fb63['query'][_0x7fc2('0x3f')]){_0x2cca2b['include']=[{'all':!![]}];}return db['ServicenowField'][_0x7fc2('0x40')](_0x2cca2b);})[_0x7fc2('0x23')](function(_0x5cf936){_0x66f97b['rows']=_0x5cf936;return _0x66f97b;})['then'](respondWithFilteredResult(_0x5a8975,_0x2cca2b))[_0x7fc2('0x41')](handleError(_0x5a8975,null));};exports[_0x7fc2('0x42')]=function(_0x175402,_0x1b8ab4){var _0x4eb0ba={'raw':!![],'where':{'id':_0x175402['params']['id']}},_0x3fc02={};_0x3fc02[_0x7fc2('0x2f')]=_[_0x7fc2('0x31')](db[_0x7fc2('0x2b')][_0x7fc2('0x2c')]);_0x3fc02[_0x7fc2('0x30')]=_[_0x7fc2('0x31')](_0x175402[_0x7fc2('0x30')]);_0x3fc02[_0x7fc2('0x32')]=_[_0x7fc2('0x33')](_0x3fc02[_0x7fc2('0x2f')],_0x3fc02[_0x7fc2('0x30')]);_0x4eb0ba[_0x7fc2('0x34')]=_[_0x7fc2('0x33')](_0x3fc02[_0x7fc2('0x2f')],qs['fields'](_0x175402['query'][_0x7fc2('0x35')]));_0x4eb0ba[_0x7fc2('0x34')]=_0x4eb0ba[_0x7fc2('0x34')][_0x7fc2('0x36')]?_0x4eb0ba[_0x7fc2('0x34')]:_0x3fc02[_0x7fc2('0x2f')];if(_0x175402[_0x7fc2('0x30')][_0x7fc2('0x3f')]){_0x4eb0ba[_0x7fc2('0x43')]=[{'all':!![]}];}_0x4eb0ba=_[_0x7fc2('0x3d')]({},_0x4eb0ba,_0x175402[_0x7fc2('0x3e')]);return db[_0x7fc2('0x2b')]['find'](_0x4eb0ba)[_0x7fc2('0x23')](handleEntityNotFound(_0x1b8ab4,null))[_0x7fc2('0x23')](respondWithResult(_0x1b8ab4,null))[_0x7fc2('0x41')](handleError(_0x1b8ab4,null));};exports[_0x7fc2('0x44')]=function(_0x48bbe8,_0x416e39){return db[_0x7fc2('0x2b')][_0x7fc2('0x44')](_0x48bbe8[_0x7fc2('0x45')],{})[_0x7fc2('0x23')](respondWithResult(_0x416e39,0xc9))[_0x7fc2('0x41')](handleError(_0x416e39,null));};exports[_0x7fc2('0x46')]=function(_0x3ee9f9,_0x44259f){if(_0x3ee9f9['body']['id']){delete _0x3ee9f9['body']['id'];}return db[_0x7fc2('0x2b')][_0x7fc2('0x47')]({'where':{'id':_0x3ee9f9[_0x7fc2('0x48')]['id']}})[_0x7fc2('0x23')](handleEntityNotFound(_0x44259f,null))[_0x7fc2('0x23')](saveUpdates(_0x3ee9f9[_0x7fc2('0x45')],null))[_0x7fc2('0x23')](respondWithResult(_0x44259f,null))[_0x7fc2('0x41')](handleError(_0x44259f,null));};exports[_0x7fc2('0x24')]=function(_0x2689b7,_0x293bd4){return db['ServicenowField'][_0x7fc2('0x47')]({'where':{'id':_0x2689b7[_0x7fc2('0x48')]['id']}})[_0x7fc2('0x23')](handleEntityNotFound(_0x293bd4,null))['then'](removeEntity(_0x293bd4,null))[_0x7fc2('0x41')](handleError(_0x293bd4,null));}; \ No newline at end of file +var _0x08ee=['error','stack','name','send','index','ServicenowField','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','findAll','rows','show','params','keys','length','includeAll','include','find','catch','create','body','eml-format','request-promise','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','end'];(function(_0x46538c,_0x3cdb9f){var _0x12130e=function(_0xff25e8){while(--_0xff25e8){_0x46538c['push'](_0x46538c['shift']());}};_0x12130e(++_0x3cdb9f);}(_0x08ee,0x68));var _0xe08e=function(_0x5ce6b5,_0x5a80e6){_0x5ce6b5=_0x5ce6b5-0x0;var _0x3f50b2=_0x08ee[_0x5ce6b5];return _0x3f50b2;};'use strict';var emlformat=require(_0xe08e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe08e('0x1'));var moment=require(_0xe08e('0x2'));var BPromise=require(_0xe08e('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe08e('0x4'));var ejs=require(_0xe08e('0x5'));var fs=require('fs');var fs_extra=require(_0xe08e('0x6'));var _=require(_0xe08e('0x7'));var squel=require(_0xe08e('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe08e('0x4'));var querystring=require(_0xe08e('0x9'));var Papa=require(_0xe08e('0xa'));var Redis=require(_0xe08e('0xb'));var authService=require(_0xe08e('0xc'));var qs=require(_0xe08e('0xd'));var as=require(_0xe08e('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe08e('0xf'));var utils=require(_0xe08e('0x10'));var config=require(_0xe08e('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548643,_0x2654c7){_0x2654c7=_0x2654c7||0xcc;return function(_0x43faae){if(_0x43faae){return _0x548643[_0xe08e('0x12')](_0x2654c7);}return _0x548643[_0xe08e('0x13')](_0x2654c7)['end']();};}function respondWithResult(_0x56fe3b,_0x4e5302){_0x4e5302=_0x4e5302||0xc8;return function(_0x3bb91b){if(_0x3bb91b){return _0x56fe3b['status'](_0x4e5302)[_0xe08e('0x14')](_0x3bb91b);}};}function respondWithFilteredResult(_0xdff538,_0xa38fdf){return function(_0x4ff5f0){if(_0x4ff5f0){var _0x1077f2=typeof _0xa38fdf['offset']===_0xe08e('0x15')&&typeof _0xa38fdf[_0xe08e('0x16')]===_0xe08e('0x15');var _0x53bd3e=_0x4ff5f0[_0xe08e('0x17')];var _0x542e9a=_0x1077f2?0x0:_0xa38fdf[_0xe08e('0x18')];var _0x1b5fe6=_0x1077f2?_0x4ff5f0['count']:_0xa38fdf[_0xe08e('0x18')]+_0xa38fdf[_0xe08e('0x16')];var _0x43acb8;if(_0x1b5fe6>=_0x53bd3e){_0x1b5fe6=_0x53bd3e;_0x43acb8=0xc8;}else{_0x43acb8=0xce;}_0xdff538[_0xe08e('0x13')](_0x43acb8);return _0xdff538[_0xe08e('0x19')](_0xe08e('0x1a'),_0x542e9a+'-'+_0x1b5fe6+'/'+_0x53bd3e)[_0xe08e('0x14')](_0x4ff5f0);}return null;};}function patchUpdates(_0x191415){return function(_0xe368a0){try{jsonpatch['apply'](_0xe368a0,_0x191415,!![]);}catch(_0x586494){return BPromise[_0xe08e('0x1b')](_0x586494);}return _0xe368a0['save']();};}function saveUpdates(_0x497e75,_0x1241d9){return function(_0x342844){if(_0x342844){return _0x342844[_0xe08e('0x1c')](_0x497e75)[_0xe08e('0x1d')](function(_0x1d2d47){return _0x1d2d47;});}return null;};}function removeEntity(_0x45aa6b,_0x546d30){return function(_0x4e6eb9){if(_0x4e6eb9){return _0x4e6eb9[_0xe08e('0x1e')]()[_0xe08e('0x1d')](function(){_0x45aa6b['status'](0xcc)[_0xe08e('0x1f')]();});}};}function handleEntityNotFound(_0x24e5fa,_0x1dcd75){return function(_0x3847c8){if(!_0x3847c8){_0x24e5fa[_0xe08e('0x12')](0x194);}return _0x3847c8;};}function handleError(_0x33cbe8,_0x27b65d){_0x27b65d=_0x27b65d||0x1f4;return function(_0x5dac73){logger[_0xe08e('0x20')](_0x5dac73[_0xe08e('0x21')]);if(_0x5dac73[_0xe08e('0x22')]){delete _0x5dac73[_0xe08e('0x22')];}_0x33cbe8[_0xe08e('0x13')](_0x27b65d)[_0xe08e('0x23')](_0x5dac73);};}exports[_0xe08e('0x24')]=function(_0x375c69,_0x529db9){var _0x439f7e={},_0x235216={},_0x1c443d={'count':0x0,'rows':[]};var _0x395dec=_['map'](db[_0xe08e('0x25')]['rawAttributes'],function(_0x2b64d0){return{'name':_0x2b64d0['fieldName'],'type':_0x2b64d0[_0xe08e('0x26')][_0xe08e('0x27')]};});_0x235216[_0xe08e('0x28')]=_['map'](_0x395dec,_0xe08e('0x22'));_0x235216['query']=_['keys'](_0x375c69[_0xe08e('0x29')]);_0x235216[_0xe08e('0x2a')]=_[_0xe08e('0x2b')](_0x235216[_0xe08e('0x28')],_0x235216[_0xe08e('0x29')]);_0x439f7e[_0xe08e('0x2c')]=_[_0xe08e('0x2b')](_0x235216[_0xe08e('0x28')],qs[_0xe08e('0x2d')](_0x375c69[_0xe08e('0x29')][_0xe08e('0x2d')]));_0x439f7e[_0xe08e('0x2c')]=_0x439f7e[_0xe08e('0x2c')]['length']?_0x439f7e['attributes']:_0x235216[_0xe08e('0x28')];if(!_0x375c69['query'][_0xe08e('0x2e')](_0xe08e('0x2f'))){_0x439f7e['limit']=qs[_0xe08e('0x16')](_0x375c69['query']['limit']);_0x439f7e['offset']=qs['offset'](_0x375c69[_0xe08e('0x29')][_0xe08e('0x18')]);}_0x439f7e[_0xe08e('0x30')]=qs['sort'](_0x375c69[_0xe08e('0x29')][_0xe08e('0x31')]);_0x439f7e[_0xe08e('0x32')]=qs[_0xe08e('0x2a')](_[_0xe08e('0x33')](_0x375c69[_0xe08e('0x29')],_0x235216['filters']),_0x395dec);if(_0x375c69[_0xe08e('0x29')][_0xe08e('0x34')]){_0x439f7e[_0xe08e('0x32')]=_[_0xe08e('0x35')](_0x439f7e[_0xe08e('0x32')],{'$or':_[_0xe08e('0x36')](_0x395dec,function(_0x1a520a){if(_0x1a520a[_0xe08e('0x26')]!=='VIRTUAL'){var _0x35d5e1={};_0x35d5e1[_0x1a520a[_0xe08e('0x22')]]={'$like':'%'+_0x375c69[_0xe08e('0x29')][_0xe08e('0x34')]+'%'};return _0x35d5e1;}})});}_0x439f7e=_[_0xe08e('0x35')]({},_0x439f7e,_0x375c69[_0xe08e('0x37')]);var _0x3e7c7f={'where':_0x439f7e['where']};return db[_0xe08e('0x25')][_0xe08e('0x17')](_0x3e7c7f)['then'](function(_0xb5a02c){_0x1c443d[_0xe08e('0x17')]=_0xb5a02c;if(_0x375c69[_0xe08e('0x29')]['includeAll']){_0x439f7e['include']=[{'all':!![]}];}return db[_0xe08e('0x25')][_0xe08e('0x38')](_0x439f7e);})[_0xe08e('0x1d')](function(_0x351a82){_0x1c443d[_0xe08e('0x39')]=_0x351a82;return _0x1c443d;})[_0xe08e('0x1d')](respondWithFilteredResult(_0x529db9,_0x439f7e))['catch'](handleError(_0x529db9,null));};exports[_0xe08e('0x3a')]=function(_0x55340a,_0x513012){var _0x1a1efc={'raw':!![],'where':{'id':_0x55340a[_0xe08e('0x3b')]['id']}},_0x4a1a9d={};_0x4a1a9d['model']=_[_0xe08e('0x3c')](db[_0xe08e('0x25')]['rawAttributes']);_0x4a1a9d[_0xe08e('0x29')]=_[_0xe08e('0x3c')](_0x55340a[_0xe08e('0x29')]);_0x4a1a9d[_0xe08e('0x2a')]=_['intersection'](_0x4a1a9d[_0xe08e('0x28')],_0x4a1a9d[_0xe08e('0x29')]);_0x1a1efc['attributes']=_[_0xe08e('0x2b')](_0x4a1a9d[_0xe08e('0x28')],qs[_0xe08e('0x2d')](_0x55340a['query'][_0xe08e('0x2d')]));_0x1a1efc[_0xe08e('0x2c')]=_0x1a1efc[_0xe08e('0x2c')][_0xe08e('0x3d')]?_0x1a1efc[_0xe08e('0x2c')]:_0x4a1a9d[_0xe08e('0x28')];if(_0x55340a[_0xe08e('0x29')][_0xe08e('0x3e')]){_0x1a1efc[_0xe08e('0x3f')]=[{'all':!![]}];}_0x1a1efc=_[_0xe08e('0x35')]({},_0x1a1efc,_0x55340a['options']);return db[_0xe08e('0x25')][_0xe08e('0x40')](_0x1a1efc)[_0xe08e('0x1d')](handleEntityNotFound(_0x513012,null))[_0xe08e('0x1d')](respondWithResult(_0x513012,null))[_0xe08e('0x41')](handleError(_0x513012,null));};exports[_0xe08e('0x42')]=function(_0x3c1755,_0x1f21e2){return db[_0xe08e('0x25')]['create'](_0x3c1755[_0xe08e('0x43')],{})[_0xe08e('0x1d')](respondWithResult(_0x1f21e2,0xc9))[_0xe08e('0x41')](handleError(_0x1f21e2,null));};exports['update']=function(_0xe364f9,_0x48dac7){if(_0xe364f9['body']['id']){delete _0xe364f9[_0xe08e('0x43')]['id'];}return db[_0xe08e('0x25')][_0xe08e('0x40')]({'where':{'id':_0xe364f9[_0xe08e('0x3b')]['id']}})[_0xe08e('0x1d')](handleEntityNotFound(_0x48dac7,null))[_0xe08e('0x1d')](saveUpdates(_0xe364f9[_0xe08e('0x43')],null))[_0xe08e('0x1d')](respondWithResult(_0x48dac7,null))[_0xe08e('0x41')](handleError(_0x48dac7,null));};exports['destroy']=function(_0x491bdd,_0x3ce24b){return db['ServicenowField'][_0xe08e('0x40')]({'where':{'id':_0x491bdd[_0xe08e('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3ce24b,null))[_0xe08e('0x1d')](removeEntity(_0x3ce24b,null))[_0xe08e('0x41')](handleError(_0x3ce24b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index b26cbf2..2d5d2ec 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 _0x4420=['int_servicenow_fields','servicenow_unique_index','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','ServicenowField'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x4420,0x9f));var _0x0442=function(_0x3c8e0d,_0x912f8f){_0x3c8e0d=_0x3c8e0d-0x0;var _0x422611=_0x4420[_0x3c8e0d];return _0x422611;};'use strict';var _=require(_0x0442('0x0'));var util=require('util');var logger=require(_0x0442('0x1'))(_0x0442('0x2'));var moment=require(_0x0442('0x3'));var BPromise=require(_0x0442('0x4'));var rp=require(_0x0442('0x5'));var fs=require('fs');var path=require(_0x0442('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowField.attributes');module[_0x0442('0x7')]=function(_0x12136b,_0x47aa7c){return _0x12136b[_0x0442('0x8')](_0x0442('0x9'),attributes,{'tableName':_0x0442('0xa'),'paranoid':![],'indexes':[{'name':_0x0442('0xb'),'fields':['idField',_0x0442('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4cf0=['bluebird','path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','../../config/logger','api','moment'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x4cf0,0x15a));var _0x04cf=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4cf0[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x04cf('0x0'));var util=require('util');var logger=require(_0x04cf('0x1'))(_0x04cf('0x2'));var moment=require(_0x04cf('0x3'));var BPromise=require(_0x04cf('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04cf('0x5'));var rimraf=require('rimraf');var config=require(_0x04cf('0x6'));var attributes=require(_0x04cf('0x7'));module[_0x04cf('0x8')]=function(_0x4075e5,_0x443b4b){return _0x4075e5[_0x04cf('0x9')](_0x04cf('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x04cf('0xb'),'fields':[_0x04cf('0xc'),_0x04cf('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index ec4f241..8a297ca 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 _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3aa853,_0x39af8e){var _0x40c5d8=function(_0x15220d){while(--_0x15220d){_0x3aa853['push'](_0x3aa853['shift']());}};_0x40c5d8(++_0x39af8e);}(_0xe706,0xa3));var _0x6e70=function(_0x4d672c,_0x15a6e0){_0x4d672c=_0x4d672c-0x0;var _0x22dc61=_0xe706[_0x4d672c];return _0x22dc61;};'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']('ServicenowField,\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']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3ddb02,_0x184ada){var _0x52b85f=function(_0xc7f427){while(--_0xc7f427){_0x3ddb02['push'](_0x3ddb02['shift']());}};_0x52b85f(++_0x184ada);}(_0xaa88,0x137));var _0x8aa8=function(_0x1d1963,_0x32cc0e){_0x1d1963=_0x1d1963-0x0;var _0x3f58bb=_0xaa88[_0x1d1963];return _0x3f58bb;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 41bd3a3..3c6596b 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(_0x98836a,_0x8a9cc1){var _0x39cf38=function(_0x2947ff){while(--_0x2947ff){_0x98836a['push'](_0x98836a['shift']());}};_0x39cf38(++_0x8a9cc1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x136640,_0x4be445){var _0x27674c=function(_0x3c77af){while(--_0x3c77af){_0x136640['push'](_0x136640['shift']());}};_0x27674c(++_0x4be445);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 8510a79..f22ccfa 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(_0x3a6b52,_0x3ac6ff){var _0x27a714=function(_0x150bca){while(--_0x150bca){_0x3a6b52['push'](_0x3a6b52['shift']());}};_0x27a714(++_0x3ac6ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x121c6d,_0x108645){var _0x3a8943=function(_0xc4f80a){while(--_0xc4f80a){_0x121c6d['push'](_0x121c6d['shift']());}};_0x3a8943(++_0x108645);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 e76efb2..8334ba3 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 _0x4360=['format','%s%s','/service/v4_1/rest.php','login','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','JSON','values','module_fields','includes','label','value','statusCode','getFields','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','end','sendStatus','error','stack','name','send','index','map','SugarcrmAccount','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','rows','show','rawAttributes','length','include','create','body','catch','update','find','params','getConfigurations','findOne','SugarcrmConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','SugarcrmField','description','date_start','duration_hours','duration_minutes','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST'];(function(_0x83ec62,_0x14421a){var _0x2bb01e=function(_0x26ff98){while(--_0x26ff98){_0x83ec62['push'](_0x83ec62['shift']());}};_0x2bb01e(++_0x14421a);}(_0x4360,0xf8));var _0x0436=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x4360[_0x2dea24];return _0x309d58;};'use strict';var emlformat=require(_0x0436('0x0'));var rimraf=require(_0x0436('0x1'));var zipdir=require(_0x0436('0x2'));var jsonpatch=require(_0x0436('0x3'));var rp=require(_0x0436('0x4'));var moment=require(_0x0436('0x5'));var BPromise=require(_0x0436('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0436('0x7'));var sox=require(_0x0436('0x8'));var csv=require(_0x0436('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0436('0xa'));var crypto=require(_0x0436('0xb'));var jsforce=require(_0x0436('0xc'));var deskjs=require(_0x0436('0xd'));var toCsv=require(_0x0436('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0436('0xe'));var authService=require(_0x0436('0xf'));var qs=require(_0x0436('0x10'));var as=require(_0x0436('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0436('0x12'))('api');var utils=require(_0x0436('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x0436('0x14'));var db=require(_0x0436('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5862ee,_0x578363){_0x578363=_0x578363||0xcc;return function(_0x55c206){if(_0x55c206){return _0x5862ee['sendStatus'](_0x578363);}return _0x5862ee[_0x0436('0x16')](_0x578363)['end']();};}function respondWithResult(_0x54167e,_0x3c93da){_0x3c93da=_0x3c93da||0xc8;return function(_0x33f74d){if(_0x33f74d){return _0x54167e['status'](_0x3c93da)[_0x0436('0x17')](_0x33f74d);}};}function respondWithFilteredResult(_0x201659,_0x331535){return function(_0x19c886){if(_0x19c886){var _0x5dbcc4=typeof _0x331535['offset']===_0x0436('0x18')&&typeof _0x331535[_0x0436('0x19')]==='undefined';var _0x3f5a7d=_0x19c886[_0x0436('0x1a')];var _0x258dfd=_0x5dbcc4?0x0:_0x331535[_0x0436('0x1b')];var _0x213abb=_0x5dbcc4?_0x19c886['count']:_0x331535['offset']+_0x331535[_0x0436('0x19')];var _0xe6b089;if(_0x213abb>=_0x3f5a7d){_0x213abb=_0x3f5a7d;_0xe6b089=0xc8;}else{_0xe6b089=0xce;}_0x201659[_0x0436('0x16')](_0xe6b089);return _0x201659[_0x0436('0x1c')]('Content-Range',_0x258dfd+'-'+_0x213abb+'/'+_0x3f5a7d)['json'](_0x19c886);}return null;};}function patchUpdates(_0x3dbbea){return function(_0x39bc18){try{jsonpatch[_0x0436('0x1d')](_0x39bc18,_0x3dbbea,!![]);}catch(_0x50c459){return BPromise[_0x0436('0x1e')](_0x50c459);}return _0x39bc18[_0x0436('0x1f')]();};}function saveUpdates(_0x467697,_0x13c652){return function(_0x4d49fe){if(_0x4d49fe){return _0x4d49fe['update'](_0x467697)[_0x0436('0x20')](function(_0x2d3b92){return _0x2d3b92;});}return null;};}function removeEntity(_0x9d5335,_0x16904c){return function(_0x1a256b){if(_0x1a256b){return _0x1a256b[_0x0436('0x21')]()[_0x0436('0x20')](function(){_0x9d5335['status'](0xcc)[_0x0436('0x22')]();});}};}function handleEntityNotFound(_0x3f77c2,_0x21a8af){return function(_0x432e3e){if(!_0x432e3e){_0x3f77c2[_0x0436('0x23')](0x194);}return _0x432e3e;};}function handleError(_0x5929ea,_0x45299b){_0x45299b=_0x45299b||0x1f4;return function(_0x51e082){logger[_0x0436('0x24')](_0x51e082[_0x0436('0x25')]);if(_0x51e082[_0x0436('0x26')]){delete _0x51e082[_0x0436('0x26')];}_0x5929ea[_0x0436('0x16')](_0x45299b)[_0x0436('0x27')](_0x51e082);};}exports[_0x0436('0x28')]=function(_0x450553,_0x236bbf){var _0x5db0e3={},_0x25da6b={},_0x47da45={'count':0x0,'rows':[]};var _0x1c06f1=_[_0x0436('0x29')](db[_0x0436('0x2a')]['rawAttributes'],function(_0x27d76e){return{'name':_0x27d76e['fieldName'],'type':_0x27d76e['type'][_0x0436('0x2b')]};});_0x25da6b[_0x0436('0x2c')]=_[_0x0436('0x29')](_0x1c06f1,_0x0436('0x26'));_0x25da6b[_0x0436('0x2d')]=_[_0x0436('0x2e')](_0x450553[_0x0436('0x2d')]);_0x25da6b[_0x0436('0x2f')]=_['intersection'](_0x25da6b[_0x0436('0x2c')],_0x25da6b[_0x0436('0x2d')]);_0x5db0e3[_0x0436('0x30')]=_[_0x0436('0x31')](_0x25da6b[_0x0436('0x2c')],qs[_0x0436('0x32')](_0x450553[_0x0436('0x2d')]['fields']));_0x5db0e3[_0x0436('0x30')]=_0x5db0e3[_0x0436('0x30')]['length']?_0x5db0e3['attributes']:_0x25da6b['model'];if(!_0x450553['query'][_0x0436('0x33')](_0x0436('0x34'))){_0x5db0e3[_0x0436('0x19')]=qs[_0x0436('0x19')](_0x450553[_0x0436('0x2d')][_0x0436('0x19')]);_0x5db0e3[_0x0436('0x1b')]=qs[_0x0436('0x1b')](_0x450553[_0x0436('0x2d')][_0x0436('0x1b')]);}_0x5db0e3[_0x0436('0x35')]=qs['sort'](_0x450553[_0x0436('0x2d')][_0x0436('0x36')]);_0x5db0e3[_0x0436('0x37')]=qs[_0x0436('0x2f')](_[_0x0436('0x38')](_0x450553['query'],_0x25da6b[_0x0436('0x2f')]),_0x1c06f1);if(_0x450553['query'][_0x0436('0x39')]){_0x5db0e3['where']=_['merge'](_0x5db0e3[_0x0436('0x37')],{'$or':_[_0x0436('0x29')](_0x1c06f1,function(_0x37d3f1){if(_0x37d3f1[_0x0436('0x3a')]!=='VIRTUAL'){var _0x3a3918={};_0x3a3918[_0x37d3f1['name']]={'$like':'%'+_0x450553[_0x0436('0x2d')][_0x0436('0x39')]+'%'};return _0x3a3918;}})});}_0x5db0e3=_[_0x0436('0x3b')]({},_0x5db0e3,_0x450553[_0x0436('0x3c')]);var _0x1bbc17={'where':_0x5db0e3['where']};return db[_0x0436('0x2a')][_0x0436('0x1a')](_0x1bbc17)['then'](function(_0x50638e){_0x47da45['count']=_0x50638e;if(_0x450553[_0x0436('0x2d')][_0x0436('0x3d')]){_0x5db0e3['include']=[{'all':!![]}];}return db[_0x0436('0x2a')]['findAll'](_0x5db0e3);})[_0x0436('0x20')](function(_0x395891){_0x47da45[_0x0436('0x3e')]=_0x395891;return _0x47da45;})['then'](respondWithFilteredResult(_0x236bbf,_0x5db0e3))['catch'](handleError(_0x236bbf,null));};exports[_0x0436('0x3f')]=function(_0x29aca9,_0x31a11b){var _0x2834a0={'raw':![],'where':{'id':_0x29aca9['params']['id']}},_0x494c3c={};_0x494c3c[_0x0436('0x2c')]=_[_0x0436('0x2e')](db['SugarcrmAccount'][_0x0436('0x40')]);_0x494c3c['query']=_['keys'](_0x29aca9[_0x0436('0x2d')]);_0x494c3c['filters']=_['intersection'](_0x494c3c[_0x0436('0x2c')],_0x494c3c['query']);_0x2834a0[_0x0436('0x30')]=_[_0x0436('0x31')](_0x494c3c[_0x0436('0x2c')],qs[_0x0436('0x32')](_0x29aca9[_0x0436('0x2d')][_0x0436('0x32')]));_0x2834a0[_0x0436('0x30')]=_0x2834a0[_0x0436('0x30')][_0x0436('0x41')]?_0x2834a0[_0x0436('0x30')]:_0x494c3c[_0x0436('0x2c')];if(_0x29aca9[_0x0436('0x2d')][_0x0436('0x3d')]){_0x2834a0[_0x0436('0x42')]=[{'all':!![]}];}_0x2834a0=_['merge']({},_0x2834a0,_0x29aca9[_0x0436('0x3c')]);return db[_0x0436('0x2a')]['find'](_0x2834a0)[_0x0436('0x20')](handleEntityNotFound(_0x31a11b,null))[_0x0436('0x20')](respondWithResult(_0x31a11b,null))['catch'](handleError(_0x31a11b,null));};exports[_0x0436('0x43')]=function(_0x2ce7ab,_0x4e0cd0){return db[_0x0436('0x2a')]['create'](_0x2ce7ab[_0x0436('0x44')],{})[_0x0436('0x20')](respondWithResult(_0x4e0cd0,0xc9))[_0x0436('0x45')](handleError(_0x4e0cd0,null));};exports[_0x0436('0x46')]=function(_0x25c047,_0x4eeb2d){if(_0x25c047[_0x0436('0x44')]['id']){delete _0x25c047[_0x0436('0x44')]['id'];}return db[_0x0436('0x2a')][_0x0436('0x47')]({'where':{'id':_0x25c047[_0x0436('0x48')]['id']}})['then'](handleEntityNotFound(_0x4eeb2d,null))['then'](saveUpdates(_0x25c047[_0x0436('0x44')],null))[_0x0436('0x20')](respondWithResult(_0x4eeb2d,null))[_0x0436('0x45')](handleError(_0x4eeb2d,null));};exports['destroy']=function(_0x585ec0,_0x28a525){return db[_0x0436('0x2a')][_0x0436('0x47')]({'where':{'id':_0x585ec0['params']['id']}})[_0x0436('0x20')](handleEntityNotFound(_0x28a525,null))[_0x0436('0x20')](removeEntity(_0x28a525,null))[_0x0436('0x45')](handleError(_0x28a525,null));};exports[_0x0436('0x49')]=function(_0x1d567b,_0x244dd9,_0x59ebc0){var _0x25e9dd={};var _0x2d1f15={};var _0x1b31c5;var _0x51a7d4;return db[_0x0436('0x2a')][_0x0436('0x4a')]({'where':{'id':_0x1d567b[_0x0436('0x48')]['id']}})['then'](handleEntityNotFound(_0x244dd9,null))['then'](function(_0x4f1887){if(_0x4f1887){_0x1b31c5=_0x4f1887;_0x2d1f15[_0x0436('0x2c')]=_[_0x0436('0x2e')](db[_0x0436('0x4b')][_0x0436('0x40')]);_0x2d1f15['query']=_[_0x0436('0x2e')](_0x1d567b[_0x0436('0x2d')]);_0x2d1f15['filters']=_['intersection'](_0x2d1f15['model'],_0x2d1f15[_0x0436('0x2d')]);_0x25e9dd[_0x0436('0x30')]=_[_0x0436('0x31')](_0x2d1f15[_0x0436('0x2c')],qs[_0x0436('0x32')](_0x1d567b[_0x0436('0x2d')][_0x0436('0x32')]));_0x25e9dd['attributes']=_0x25e9dd[_0x0436('0x30')]['length']?_0x25e9dd[_0x0436('0x30')]:_0x2d1f15[_0x0436('0x2c')];_0x25e9dd[_0x0436('0x35')]=qs[_0x0436('0x36')](_0x1d567b[_0x0436('0x2d')][_0x0436('0x36')]);_0x25e9dd[_0x0436('0x37')]=qs[_0x0436('0x2f')](_[_0x0436('0x38')](_0x1d567b[_0x0436('0x2d')],_0x2d1f15['filters']));if(_0x1d567b[_0x0436('0x2d')]['filter']){_0x25e9dd[_0x0436('0x37')]=_[_0x0436('0x3b')](_0x25e9dd[_0x0436('0x37')],{'$or':_[_0x0436('0x29')](_0x25e9dd['attributes'],function(_0x268de8){var _0x195d48={};_0x195d48[_0x268de8]={'$like':'%'+_0x1d567b[_0x0436('0x2d')][_0x0436('0x39')]+'%'};return _0x195d48;})});}_0x25e9dd=_['merge']({},_0x25e9dd,_0x1d567b[_0x0436('0x3c')]);return _0x1b31c5[_0x0436('0x49')](_0x25e9dd);}})['then'](function(_0x4b1633){if(_0x4b1633){_0x51a7d4=_0x4b1633['length'];if(!_0x1d567b[_0x0436('0x2d')]['hasOwnProperty'](_0x0436('0x34'))){_0x25e9dd[_0x0436('0x19')]=qs['limit'](_0x1d567b[_0x0436('0x2d')][_0x0436('0x19')]);_0x25e9dd['offset']=qs[_0x0436('0x1b')](_0x1d567b[_0x0436('0x2d')][_0x0436('0x1b')]);}return _0x1b31c5[_0x0436('0x49')](_0x25e9dd);}})['then'](function(_0x87f610){if(_0x87f610){return _0x87f610?{'count':_0x51a7d4,'rows':_0x87f610}:null;}})['then'](respondWithResult(_0x244dd9,null))[_0x0436('0x45')](handleError(_0x244dd9,null));};exports['addConfiguration']=function(_0x2d1b9d,_0x11335b,_0x4a5244){if(_0x2d1b9d[_0x0436('0x44')]['id']){delete _0x2d1b9d[_0x0436('0x44')]['id'];}return db[_0x0436('0x2a')][_0x0436('0x4a')]({'where':{'id':_0x2d1b9d['params']['id']}})[_0x0436('0x20')](handleEntityNotFound(_0x11335b,null))[_0x0436('0x20')](function(_0xd111e3){if(_0xd111e3){_0x2d1b9d[_0x0436('0x44')]['AccountId']=_0xd111e3['id'];_0x2d1b9d[_0x0436('0x44')][_0x0436('0x4c')]=integrations[_0x0436('0x4d')](_0x2d1b9d[_0x0436('0x44')]['channel'],_0x2d1b9d[_0x0436('0x44')][_0x0436('0x3a')]);_0x2d1b9d[_0x0436('0x44')][_0x0436('0x4e')]=integrations[_0x0436('0x4f')](_0x2d1b9d['body']['channel'],_0x2d1b9d['body'][_0x0436('0x3a')]);return db[_0x0436('0x4b')][_0x0436('0x43')](_0x2d1b9d[_0x0436('0x44')],{'include':[{'model':db[_0x0436('0x50')],'as':'Subjects'},{'model':db[_0x0436('0x50')],'as':_0x0436('0x4e')}]});}return null;})['then'](respondWithResult(_0x11335b,null))['catch'](handleError(_0x11335b,null));};exports['getFields']=function(_0x1813e7,_0x28a13d,_0x12da81){var _0x2b4f96='';var _0x4defb2=['id',_0x0436('0x26'),'assigned_user_id','created_by',_0x0436('0x51'),_0x0436('0x52'),_0x0436('0x53'),_0x0436('0x54'),'parent_id','parent_type',_0x0436('0x55'),_0x0436('0x56')];return db[_0x0436('0x2a')]['findOne']({'where':{'id':_0x1813e7['params']['id']},'attributes':['id',_0x0436('0x57'),_0x0436('0x58'),_0x0436('0x59')]})[_0x0436('0x20')](handleEntityNotFound(_0x28a13d,null))[_0x0436('0x20')](function(_0x51fb1e){if(_0x51fb1e){_0x2b4f96=_0x51fb1e[_0x0436('0x59')];var _0x36f52f=_0x2b4f96[_0x0436('0x5a')](-0x1);if(_0x36f52f==='/'){_0x2b4f96=_0x2b4f96[_0x0436('0x5b')](0x0,_0x2b4f96[_0x0436('0x5c')](_0x36f52f));}return rp({'method':_0x0436('0x5d'),'uri':util[_0x0436('0x5e')](_0x0436('0x5f'),_0x2b4f96,_0x0436('0x60')),'json':!![],'form':{'method':_0x0436('0x61'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x0436('0x62')]({'user_auth':{'user_name':_0x51fb1e[_0x0436('0x57')],'password':_0x51fb1e[_0x0436('0x58')],'encryption':_0x0436('0x63')},'application':_0x0436('0x64')})}});}})['then'](function(_0x5e69df){if(_0x5e69df&&_0x5e69df[_0x0436('0x26')]!==_0x0436('0x65')&&_0x5e69df[_0x0436('0x26')]!==_0x0436('0x66')){return rp({'method':'POST','uri':util[_0x0436('0x5e')](_0x0436('0x5f'),_0x2b4f96,_0x0436('0x60')),'json':!![],'form':{'method':_0x0436('0x67'),'input_type':_0x0436('0x68'),'response_type':_0x0436('0x68'),'rest_data':JSON[_0x0436('0x62')]({'session':_0x5e69df['id'],'module_name':'Calls'})}})[_0x0436('0x20')](function(_0x196510){if(_0x196510){var _0x22cdcb=_[_0x0436('0x69')](_0x196510[_0x0436('0x6a')]);_['remove'](_0x22cdcb,function(_0x30cce6){return _0x4defb2[_0x0436('0x6b')](_0x30cce6[_0x0436('0x26')]);});return{'count':_0x22cdcb[_0x0436('0x41')],'rows':_['map'](_0x22cdcb,function(_0x56cdde){return{'id':_0x56cdde[_0x0436('0x26')],'name':_0x56cdde[_0x0436('0x6c')],'custom':_['endsWith'](_0x56cdde[_0x0436('0x26')],'_c')?!![]:![],'options':_0x56cdde[_0x0436('0x3c')]?_[_0x0436('0x29')](_[_0x0436('0x69')](_0x56cdde[_0x0436('0x3c')]),function(_0x4791b8){return{'name':_0x4791b8[_0x0436('0x6d')],'value':_0x4791b8[_0x0436('0x26')]};}):[]};})};}})['then'](respondWithResult(_0x28a13d,null))[_0x0436('0x45')](function(_0x5a3fe1){var _0x569248=_0x1813e7[_0x0436('0x2d')]['test']?0x1f4:_0x5a3fe1[_0x0436('0x6e')]||0x1f4;logger[_0x0436('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x0436('0x6f'),_0x569248,JSON[_0x0436('0x62')](_0x5a3fe1));delete _0x5a3fe1[_0x0436('0x26')];if(_0x569248===0x191){_0x569248=0x190;}_0x28a13d[_0x0436('0x16')](_0x569248)[_0x0436('0x27')](_0x1813e7['query'][_0x0436('0x70')]?{'message':_0x0436('0x71'),'statusCode':_0x5a3fe1[_0x0436('0x6e')]}:_0x5a3fe1);});}else{var _0x3c9c0f=0x1f4;_0x28a13d['status'](_0x3c9c0f)[_0x0436('0x27')]({'message':_0x0436('0x71'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xa4e5=['getFields','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SugarcrmAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','includeAll','findAll','catch','show','rawAttributes','include','find','create','body','params','findOne','SugarcrmConfiguration','pick','getConfigurations','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','created_by','description','date_start','duration_hours','duration_minutes','username','password','remoteUri','slice','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','values','module_fields','includes','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s'];(function(_0x5ef1bb,_0x4613e2){var _0x17cd60=function(_0x454975){while(--_0x454975){_0x5ef1bb['push'](_0x5ef1bb['shift']());}};_0x17cd60(++_0x4613e2);}(_0xa4e5,0xf2));var _0x5a4e=function(_0x5c677b,_0x4b7105){_0x5c677b=_0x5c677b-0x0;var _0x3e1988=_0xa4e5[_0x5c677b];return _0x3e1988;};'use strict';var emlformat=require(_0x5a4e('0x0'));var rimraf=require(_0x5a4e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5a4e('0x2'));var rp=require(_0x5a4e('0x3'));var moment=require(_0x5a4e('0x4'));var BPromise=require(_0x5a4e('0x5'));var Mustache=require(_0x5a4e('0x6'));var util=require(_0x5a4e('0x7'));var path=require(_0x5a4e('0x8'));var sox=require(_0x5a4e('0x9'));var csv=require(_0x5a4e('0xa'));var ejs=require(_0x5a4e('0xb'));var fs=require('fs');var fs_extra=require(_0x5a4e('0xc'));var _=require(_0x5a4e('0xd'));var squel=require('squel');var crypto=require(_0x5a4e('0xe'));var jsforce=require(_0x5a4e('0xf'));var deskjs=require(_0x5a4e('0x10'));var toCsv=require(_0x5a4e('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5a4e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5a4e('0x12'));var as=require(_0x5a4e('0x13'));var hardwareService=require(_0x5a4e('0x14'));var logger=require(_0x5a4e('0x15'))(_0x5a4e('0x16'));var utils=require('../../config/utils');var config=require(_0x5a4e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a4e('0x18'))['db'];var integrations=require(_0x5a4e('0x19'));function respondWithStatusCode(_0x3e5965,_0x40383c){_0x40383c=_0x40383c||0xcc;return function(_0x408a55){if(_0x408a55){return _0x3e5965[_0x5a4e('0x1a')](_0x40383c);}return _0x3e5965[_0x5a4e('0x1b')](_0x40383c)[_0x5a4e('0x1c')]();};}function respondWithResult(_0x111010,_0x4d83dd){_0x4d83dd=_0x4d83dd||0xc8;return function(_0x124209){if(_0x124209){return _0x111010[_0x5a4e('0x1b')](_0x4d83dd)[_0x5a4e('0x1d')](_0x124209);}};}function respondWithFilteredResult(_0x2688b0,_0x18d143){return function(_0x39d3a5){if(_0x39d3a5){var _0xc7ce76=typeof _0x18d143[_0x5a4e('0x1e')]===_0x5a4e('0x1f')&&typeof _0x18d143[_0x5a4e('0x20')]===_0x5a4e('0x1f');var _0x1f0c74=_0x39d3a5[_0x5a4e('0x21')];var _0x483552=_0xc7ce76?0x0:_0x18d143[_0x5a4e('0x1e')];var _0x3e4276=_0xc7ce76?_0x39d3a5['count']:_0x18d143[_0x5a4e('0x1e')]+_0x18d143[_0x5a4e('0x20')];var _0x178397;if(_0x3e4276>=_0x1f0c74){_0x3e4276=_0x1f0c74;_0x178397=0xc8;}else{_0x178397=0xce;}_0x2688b0[_0x5a4e('0x1b')](_0x178397);return _0x2688b0['set'](_0x5a4e('0x22'),_0x483552+'-'+_0x3e4276+'/'+_0x1f0c74)[_0x5a4e('0x1d')](_0x39d3a5);}return null;};}function patchUpdates(_0x32fce3){return function(_0x479075){try{jsonpatch[_0x5a4e('0x23')](_0x479075,_0x32fce3,!![]);}catch(_0x22ab15){return BPromise[_0x5a4e('0x24')](_0x22ab15);}return _0x479075[_0x5a4e('0x25')]();};}function saveUpdates(_0xe090aa,_0x378458){return function(_0x497c40){if(_0x497c40){return _0x497c40[_0x5a4e('0x26')](_0xe090aa)[_0x5a4e('0x27')](function(_0x337e93){return _0x337e93;});}return null;};}function removeEntity(_0x291f2c,_0x504462){return function(_0x29087c){if(_0x29087c){return _0x29087c[_0x5a4e('0x28')]()[_0x5a4e('0x27')](function(){_0x291f2c[_0x5a4e('0x1b')](0xcc)[_0x5a4e('0x1c')]();});}};}function handleEntityNotFound(_0x24ff82,_0x556353){return function(_0x26c99a){if(!_0x26c99a){_0x24ff82[_0x5a4e('0x1a')](0x194);}return _0x26c99a;};}function handleError(_0x527e90,_0x51487c){_0x51487c=_0x51487c||0x1f4;return function(_0x204ca8){logger[_0x5a4e('0x29')](_0x204ca8[_0x5a4e('0x2a')]);if(_0x204ca8[_0x5a4e('0x2b')]){delete _0x204ca8[_0x5a4e('0x2b')];}_0x527e90[_0x5a4e('0x1b')](_0x51487c)['send'](_0x204ca8);};}exports[_0x5a4e('0x2c')]=function(_0x1d9b83,_0x3aaddc){var _0x5463fc={},_0x2c3635={},_0x43564e={'count':0x0,'rows':[]};var _0x44b3ac=_[_0x5a4e('0x2d')](db[_0x5a4e('0x2e')]['rawAttributes'],function(_0x1461f0){return{'name':_0x1461f0[_0x5a4e('0x2f')],'type':_0x1461f0[_0x5a4e('0x30')][_0x5a4e('0x31')]};});_0x2c3635[_0x5a4e('0x32')]=_[_0x5a4e('0x2d')](_0x44b3ac,'name');_0x2c3635[_0x5a4e('0x33')]=_[_0x5a4e('0x34')](_0x1d9b83['query']);_0x2c3635[_0x5a4e('0x35')]=_[_0x5a4e('0x36')](_0x2c3635[_0x5a4e('0x32')],_0x2c3635[_0x5a4e('0x33')]);_0x5463fc[_0x5a4e('0x37')]=_[_0x5a4e('0x36')](_0x2c3635['model'],qs[_0x5a4e('0x38')](_0x1d9b83['query'][_0x5a4e('0x38')]));_0x5463fc['attributes']=_0x5463fc[_0x5a4e('0x37')][_0x5a4e('0x39')]?_0x5463fc[_0x5a4e('0x37')]:_0x2c3635[_0x5a4e('0x32')];if(!_0x1d9b83['query'][_0x5a4e('0x3a')](_0x5a4e('0x3b'))){_0x5463fc['limit']=qs[_0x5a4e('0x20')](_0x1d9b83[_0x5a4e('0x33')][_0x5a4e('0x20')]);_0x5463fc[_0x5a4e('0x1e')]=qs[_0x5a4e('0x1e')](_0x1d9b83[_0x5a4e('0x33')]['offset']);}_0x5463fc[_0x5a4e('0x3c')]=qs[_0x5a4e('0x3d')](_0x1d9b83[_0x5a4e('0x33')][_0x5a4e('0x3d')]);_0x5463fc['where']=qs[_0x5a4e('0x35')](_['pick'](_0x1d9b83['query'],_0x2c3635[_0x5a4e('0x35')]),_0x44b3ac);if(_0x1d9b83[_0x5a4e('0x33')][_0x5a4e('0x3e')]){_0x5463fc['where']=_[_0x5a4e('0x3f')](_0x5463fc[_0x5a4e('0x40')],{'$or':_['map'](_0x44b3ac,function(_0x1e4b15){if(_0x1e4b15[_0x5a4e('0x30')]!=='VIRTUAL'){var _0x32ddb8={};_0x32ddb8[_0x1e4b15[_0x5a4e('0x2b')]]={'$like':'%'+_0x1d9b83[_0x5a4e('0x33')][_0x5a4e('0x3e')]+'%'};return _0x32ddb8;}})});}_0x5463fc=_[_0x5a4e('0x3f')]({},_0x5463fc,_0x1d9b83[_0x5a4e('0x41')]);var _0x4c907a={'where':_0x5463fc[_0x5a4e('0x40')]};return db['SugarcrmAccount'][_0x5a4e('0x21')](_0x4c907a)[_0x5a4e('0x27')](function(_0x3ff3b6){_0x43564e[_0x5a4e('0x21')]=_0x3ff3b6;if(_0x1d9b83['query'][_0x5a4e('0x42')]){_0x5463fc['include']=[{'all':!![]}];}return db[_0x5a4e('0x2e')][_0x5a4e('0x43')](_0x5463fc);})[_0x5a4e('0x27')](function(_0x4fa152){_0x43564e['rows']=_0x4fa152;return _0x43564e;})[_0x5a4e('0x27')](respondWithFilteredResult(_0x3aaddc,_0x5463fc))[_0x5a4e('0x44')](handleError(_0x3aaddc,null));};exports[_0x5a4e('0x45')]=function(_0x182b9d,_0x4c3aa9){var _0x2a09cf={'raw':![],'where':{'id':_0x182b9d['params']['id']}},_0x210620={};_0x210620[_0x5a4e('0x32')]=_[_0x5a4e('0x34')](db[_0x5a4e('0x2e')][_0x5a4e('0x46')]);_0x210620['query']=_[_0x5a4e('0x34')](_0x182b9d[_0x5a4e('0x33')]);_0x210620[_0x5a4e('0x35')]=_[_0x5a4e('0x36')](_0x210620[_0x5a4e('0x32')],_0x210620['query']);_0x2a09cf[_0x5a4e('0x37')]=_[_0x5a4e('0x36')](_0x210620[_0x5a4e('0x32')],qs[_0x5a4e('0x38')](_0x182b9d[_0x5a4e('0x33')][_0x5a4e('0x38')]));_0x2a09cf[_0x5a4e('0x37')]=_0x2a09cf[_0x5a4e('0x37')]['length']?_0x2a09cf['attributes']:_0x210620[_0x5a4e('0x32')];if(_0x182b9d[_0x5a4e('0x33')]['includeAll']){_0x2a09cf[_0x5a4e('0x47')]=[{'all':!![]}];}_0x2a09cf=_[_0x5a4e('0x3f')]({},_0x2a09cf,_0x182b9d[_0x5a4e('0x41')]);return db[_0x5a4e('0x2e')][_0x5a4e('0x48')](_0x2a09cf)[_0x5a4e('0x27')](handleEntityNotFound(_0x4c3aa9,null))[_0x5a4e('0x27')](respondWithResult(_0x4c3aa9,null))[_0x5a4e('0x44')](handleError(_0x4c3aa9,null));};exports['create']=function(_0x33880b,_0x5266e5){return db[_0x5a4e('0x2e')][_0x5a4e('0x49')](_0x33880b[_0x5a4e('0x4a')],{})['then'](respondWithResult(_0x5266e5,0xc9))[_0x5a4e('0x44')](handleError(_0x5266e5,null));};exports[_0x5a4e('0x26')]=function(_0x3f6850,_0x4fb3dc){if(_0x3f6850[_0x5a4e('0x4a')]['id']){delete _0x3f6850[_0x5a4e('0x4a')]['id'];}return db['SugarcrmAccount'][_0x5a4e('0x48')]({'where':{'id':_0x3f6850[_0x5a4e('0x4b')]['id']}})[_0x5a4e('0x27')](handleEntityNotFound(_0x4fb3dc,null))[_0x5a4e('0x27')](saveUpdates(_0x3f6850['body'],null))[_0x5a4e('0x27')](respondWithResult(_0x4fb3dc,null))['catch'](handleError(_0x4fb3dc,null));};exports[_0x5a4e('0x28')]=function(_0x1ca9bf,_0x58beae){return db['SugarcrmAccount'][_0x5a4e('0x48')]({'where':{'id':_0x1ca9bf['params']['id']}})[_0x5a4e('0x27')](handleEntityNotFound(_0x58beae,null))[_0x5a4e('0x27')](removeEntity(_0x58beae,null))['catch'](handleError(_0x58beae,null));};exports['getConfigurations']=function(_0xf03d73,_0x1220b0,_0x5b390a){var _0x1b39d2={};var _0x458498={};var _0x17775e;var _0x228c1c;return db[_0x5a4e('0x2e')][_0x5a4e('0x4c')]({'where':{'id':_0xf03d73[_0x5a4e('0x4b')]['id']}})[_0x5a4e('0x27')](handleEntityNotFound(_0x1220b0,null))[_0x5a4e('0x27')](function(_0x14ed8e){if(_0x14ed8e){_0x17775e=_0x14ed8e;_0x458498['model']=_[_0x5a4e('0x34')](db[_0x5a4e('0x4d')]['rawAttributes']);_0x458498[_0x5a4e('0x33')]=_[_0x5a4e('0x34')](_0xf03d73[_0x5a4e('0x33')]);_0x458498['filters']=_[_0x5a4e('0x36')](_0x458498[_0x5a4e('0x32')],_0x458498['query']);_0x1b39d2['attributes']=_[_0x5a4e('0x36')](_0x458498[_0x5a4e('0x32')],qs['fields'](_0xf03d73[_0x5a4e('0x33')][_0x5a4e('0x38')]));_0x1b39d2[_0x5a4e('0x37')]=_0x1b39d2['attributes'][_0x5a4e('0x39')]?_0x1b39d2[_0x5a4e('0x37')]:_0x458498[_0x5a4e('0x32')];_0x1b39d2[_0x5a4e('0x3c')]=qs[_0x5a4e('0x3d')](_0xf03d73[_0x5a4e('0x33')][_0x5a4e('0x3d')]);_0x1b39d2[_0x5a4e('0x40')]=qs['filters'](_[_0x5a4e('0x4e')](_0xf03d73[_0x5a4e('0x33')],_0x458498[_0x5a4e('0x35')]));if(_0xf03d73[_0x5a4e('0x33')][_0x5a4e('0x3e')]){_0x1b39d2[_0x5a4e('0x40')]=_[_0x5a4e('0x3f')](_0x1b39d2[_0x5a4e('0x40')],{'$or':_[_0x5a4e('0x2d')](_0x1b39d2[_0x5a4e('0x37')],function(_0x58f66e){var _0x26dfa5={};_0x26dfa5[_0x58f66e]={'$like':'%'+_0xf03d73[_0x5a4e('0x33')][_0x5a4e('0x3e')]+'%'};return _0x26dfa5;})});}_0x1b39d2=_['merge']({},_0x1b39d2,_0xf03d73[_0x5a4e('0x41')]);return _0x17775e[_0x5a4e('0x4f')](_0x1b39d2);}})[_0x5a4e('0x27')](function(_0x6c965f){if(_0x6c965f){_0x228c1c=_0x6c965f[_0x5a4e('0x39')];if(!_0xf03d73[_0x5a4e('0x33')]['hasOwnProperty'](_0x5a4e('0x3b'))){_0x1b39d2['limit']=qs['limit'](_0xf03d73[_0x5a4e('0x33')]['limit']);_0x1b39d2[_0x5a4e('0x1e')]=qs[_0x5a4e('0x1e')](_0xf03d73[_0x5a4e('0x33')]['offset']);}return _0x17775e[_0x5a4e('0x4f')](_0x1b39d2);}})[_0x5a4e('0x27')](function(_0x179b7d){if(_0x179b7d){return _0x179b7d?{'count':_0x228c1c,'rows':_0x179b7d}:null;}})[_0x5a4e('0x27')](respondWithResult(_0x1220b0,null))['catch'](handleError(_0x1220b0,null));};exports[_0x5a4e('0x50')]=function(_0x505037,_0x126fcd,_0x594691){if(_0x505037[_0x5a4e('0x4a')]['id']){delete _0x505037[_0x5a4e('0x4a')]['id'];}return db[_0x5a4e('0x2e')][_0x5a4e('0x4c')]({'where':{'id':_0x505037[_0x5a4e('0x4b')]['id']}})[_0x5a4e('0x27')](handleEntityNotFound(_0x126fcd,null))['then'](function(_0x28ce93){if(_0x28ce93){_0x505037[_0x5a4e('0x4a')]['AccountId']=_0x28ce93['id'];_0x505037[_0x5a4e('0x4a')][_0x5a4e('0x51')]=integrations[_0x5a4e('0x52')](_0x505037[_0x5a4e('0x4a')][_0x5a4e('0x53')],_0x505037[_0x5a4e('0x4a')]['type']);_0x505037[_0x5a4e('0x4a')][_0x5a4e('0x54')]=integrations[_0x5a4e('0x55')](_0x505037[_0x5a4e('0x4a')][_0x5a4e('0x53')],_0x505037[_0x5a4e('0x4a')][_0x5a4e('0x30')]);return db[_0x5a4e('0x4d')]['create'](_0x505037['body'],{'include':[{'model':db['SugarcrmField'],'as':_0x5a4e('0x51')},{'model':db[_0x5a4e('0x56')],'as':_0x5a4e('0x54')}]});}return null;})['then'](respondWithResult(_0x126fcd,null))[_0x5a4e('0x44')](handleError(_0x126fcd,null));};exports['getFields']=function(_0x14ae57,_0x427ead,_0x37c730){var _0x49024e='';var _0xb07196=['id','name','assigned_user_id',_0x5a4e('0x57'),_0x5a4e('0x58'),_0x5a4e('0x59'),_0x5a4e('0x5a'),_0x5a4e('0x5b'),'parent_id','parent_type','parent_name','direction'];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x14ae57[_0x5a4e('0x4b')]['id']},'attributes':['id',_0x5a4e('0x5c'),_0x5a4e('0x5d'),_0x5a4e('0x5e')]})[_0x5a4e('0x27')](handleEntityNotFound(_0x427ead,null))['then'](function(_0xffba43){if(_0xffba43){_0x49024e=_0xffba43[_0x5a4e('0x5e')];var _0x4f45ae=_0x49024e[_0x5a4e('0x5f')](-0x1);if(_0x4f45ae==='/'){_0x49024e=_0x49024e['substring'](0x0,_0x49024e[_0x5a4e('0x60')](_0x4f45ae));}return rp({'method':_0x5a4e('0x61'),'uri':util[_0x5a4e('0x62')]('%s%s',_0x49024e,_0x5a4e('0x63')),'json':!![],'form':{'method':_0x5a4e('0x64'),'input_type':_0x5a4e('0x65'),'response_type':_0x5a4e('0x65'),'rest_data':JSON[_0x5a4e('0x66')]({'user_auth':{'user_name':_0xffba43['username'],'password':_0xffba43['password'],'encryption':_0x5a4e('0x67')},'application':_0x5a4e('0x68')})}});}})['then'](function(_0x592f0d){if(_0x592f0d&&_0x592f0d['name']!==_0x5a4e('0x69')&&_0x592f0d[_0x5a4e('0x2b')]!==_0x5a4e('0x6a')){return rp({'method':_0x5a4e('0x61'),'uri':util['format']('%s%s',_0x49024e,_0x5a4e('0x63')),'json':!![],'form':{'method':_0x5a4e('0x6b'),'input_type':_0x5a4e('0x65'),'response_type':_0x5a4e('0x65'),'rest_data':JSON[_0x5a4e('0x66')]({'session':_0x592f0d['id'],'module_name':_0x5a4e('0x6c')})}})[_0x5a4e('0x27')](function(_0x37f1ea){if(_0x37f1ea){var _0x4b0819=_[_0x5a4e('0x6d')](_0x37f1ea[_0x5a4e('0x6e')]);_['remove'](_0x4b0819,function(_0x24992c){return _0xb07196[_0x5a4e('0x6f')](_0x24992c[_0x5a4e('0x2b')]);});return{'count':_0x4b0819[_0x5a4e('0x39')],'rows':_[_0x5a4e('0x2d')](_0x4b0819,function(_0x35fb7f){return{'id':_0x35fb7f[_0x5a4e('0x2b')],'name':_0x35fb7f[_0x5a4e('0x70')],'custom':_[_0x5a4e('0x71')](_0x35fb7f[_0x5a4e('0x2b')],'_c')?!![]:![],'options':_0x35fb7f[_0x5a4e('0x41')]?_['map'](_[_0x5a4e('0x6d')](_0x35fb7f[_0x5a4e('0x41')]),function(_0x12527c){return{'name':_0x12527c[_0x5a4e('0x72')],'value':_0x12527c[_0x5a4e('0x2b')]};}):[]};})};}})[_0x5a4e('0x27')](respondWithResult(_0x427ead,null))[_0x5a4e('0x44')](function(_0x31f2b1){var _0x4f37aa=_0x14ae57[_0x5a4e('0x33')][_0x5a4e('0x73')]?0x1f4:_0x31f2b1[_0x5a4e('0x74')]||0x1f4;logger[_0x5a4e('0x29')](_0x5a4e('0x75'),_0x5a4e('0x76'),_0x4f37aa,JSON[_0x5a4e('0x66')](_0x31f2b1));delete _0x31f2b1[_0x5a4e('0x2b')];if(_0x4f37aa===0x191){_0x4f37aa=0x190;}_0x427ead[_0x5a4e('0x1b')](_0x4f37aa)['send'](_0x14ae57[_0x5a4e('0x33')]['test']?{'message':_0x5a4e('0x77'),'statusCode':_0x31f2b1['statusCode']}:_0x31f2b1);});}else{var _0x19275d=0x1f4;_0x427ead[_0x5a4e('0x1b')](_0x19275d)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 20cc2ba..d8ce235 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 _0x7d60=['rimraf','../../components/integrations/configuration','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x32ae07,_0x399327){var _0x19368c=function(_0x1609a1){while(--_0x1609a1){_0x32ae07['push'](_0x32ae07['shift']());}};_0x19368c(++_0x399327);}(_0x7d60,0xd0));var _0x07d6=function(_0x261b79,_0x335ebe){_0x261b79=_0x261b79-0x0;var _0x50ef41=_0x7d60[_0x261b79];return _0x50ef41;};'use strict';var _=require(_0x07d6('0x0'));var util=require(_0x07d6('0x1'));var logger=require(_0x07d6('0x2'))(_0x07d6('0x3'));var moment=require(_0x07d6('0x4'));var BPromise=require(_0x07d6('0x5'));var rp=require(_0x07d6('0x6'));var fs=require('fs');var path=require(_0x07d6('0x7'));var rimraf=require(_0x07d6('0x8'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x07d6('0x9'));module['exports']=function(_0x1d70f9,_0x453256){return _0x1d70f9[_0x07d6('0xa')]('SugarcrmAccount',attributes,{'tableName':_0x07d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81d4=['define','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports'];(function(_0x520b32,_0x50792d){var _0x7ae0c3=function(_0x55c046){while(--_0x55c046){_0x520b32['push'](_0x520b32['shift']());}};_0x7ae0c3(++_0x50792d);}(_0x81d4,0x1ca));var _0x481d=function(_0x23fdc2,_0x351d37){_0x23fdc2=_0x23fdc2-0x0;var _0x4e8ed6=_0x81d4[_0x23fdc2];return _0x4e8ed6;};'use strict';var _=require(_0x481d('0x0'));var util=require('util');var logger=require(_0x481d('0x1'))(_0x481d('0x2'));var moment=require(_0x481d('0x3'));var BPromise=require(_0x481d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x481d('0x5'));var rimraf=require(_0x481d('0x6'));var config=require(_0x481d('0x7'));var attributes=require(_0x481d('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x481d('0x9')]=function(_0x3138c3,_0x76839f){return _0x3138c3[_0x481d('0xa')](_0x481d('0xb'),attributes,{'tableName':_0x481d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 4e05c07..d21bb64 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 _0x211e=['raw','attributes','limit','include','map','model','debug','ShowSugarcrmAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','then','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options'];(function(_0x1f5048,_0x35594a){var _0x4f17fd=function(_0x59c926){while(--_0x59c926){_0x1f5048['push'](_0x1f5048['shift']());}};_0x4f17fd(++_0x35594a);}(_0x211e,0x6c));var _0xe211=function(_0x28332b,_0x3115c7){_0x28332b=_0x28332b-0x0;var _0x1cbeb0=_0x211e[_0x28332b];return _0x1cbeb0;};'use strict';var _=require(_0xe211('0x0'));var util=require(_0xe211('0x1'));var moment=require(_0xe211('0x2'));var BPromise=require('bluebird');var rs=require(_0xe211('0x3'));var fs=require('fs');var Redis=require(_0xe211('0x4'));var db=require(_0xe211('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe211('0x6'));var config=require(_0xe211('0x7'));var jayson=require(_0xe211('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x474253,_0x44e4ff,_0x147184){return new BPromise(function(_0x1844a8,_0x2109eb){return client['request'](_0x474253,_0x147184)[_0xe211('0x9')](function(_0x518311){logger[_0xe211('0xa')](_0xe211('0xb'),_0x44e4ff,'request\x20sent');logger['debug'](_0xe211('0xc'),_0x44e4ff,_0xe211('0xd'),JSON[_0xe211('0xe')](_0x518311));if(_0x518311[_0xe211('0xf')]){if(_0x518311['error'][_0xe211('0x10')]===0x1f4){logger[_0xe211('0xf')](_0xe211('0xb'),_0x44e4ff,_0x518311[_0xe211('0xf')][_0xe211('0x11')]);return _0x2109eb(_0x518311['error'][_0xe211('0x11')]);}logger[_0xe211('0xf')](_0xe211('0xb'),_0x44e4ff,_0x518311[_0xe211('0xf')][_0xe211('0x11')]);return _0x1844a8(_0x518311['error']['message']);}else{logger['info'](_0xe211('0xb'),_0x44e4ff,'request\x20sent');_0x1844a8(_0x518311[_0xe211('0x12')][_0xe211('0x11')]);}})[_0xe211('0x13')](function(_0x28cefd){logger[_0xe211('0xf')](_0xe211('0xb'),_0x44e4ff,_0x28cefd);_0x2109eb(_0x28cefd);});});}exports[_0xe211('0x14')]=function(_0x3cc46c){var _0x41651d=this;return new Promise(function(_0x32367f,_0x234afd){return db[_0xe211('0x15')][_0xe211('0x16')]({'raw':_0x3cc46c[_0xe211('0x17')]?_0x3cc46c[_0xe211('0x17')][_0xe211('0x18')]===undefined?!![]:![]:!![],'where':_0x3cc46c[_0xe211('0x17')]?_0x3cc46c[_0xe211('0x17')]['where']||null:null,'attributes':_0x3cc46c['options']?_0x3cc46c[_0xe211('0x17')][_0xe211('0x19')]||null:null,'limit':_0x3cc46c[_0xe211('0x17')]?_0x3cc46c[_0xe211('0x17')][_0xe211('0x1a')]||null:null,'include':_0x3cc46c['options']?_0x3cc46c[_0xe211('0x17')][_0xe211('0x1b')]?_[_0xe211('0x1c')](_0x3cc46c[_0xe211('0x17')][_0xe211('0x1b')],function(_0x145a47){return{'model':db[_0x145a47['model']],'as':_0x145a47['as'],'attributes':_0x145a47[_0xe211('0x19')],'include':_0x145a47[_0xe211('0x1b')]?_[_0xe211('0x1c')](_0x145a47['include'],function(_0x15dfd4){return{'model':db[_0x15dfd4[_0xe211('0x1d')]],'as':_0x15dfd4['as'],'attributes':_0x15dfd4[_0xe211('0x19')],'include':_0x15dfd4[_0xe211('0x1b')]?_[_0xe211('0x1c')](_0x15dfd4[_0xe211('0x1b')],function(_0x12a8ff){return{'model':db[_0x12a8ff[_0xe211('0x1d')]],'as':_0x12a8ff['as'],'attributes':_0x12a8ff[_0xe211('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f0c82){logger[_0xe211('0xa')]('GetSugarcrmAccount',_0x3cc46c);logger[_0xe211('0x1e')](_0xe211('0x14'),_0x3cc46c,JSON[_0xe211('0xe')](_0x4f0c82));_0x32367f(_0x4f0c82);})['catch'](function(_0x15519d){logger[_0xe211('0xf')](_0xe211('0x14'),_0x15519d[_0xe211('0x11')],_0x3cc46c);_0x234afd(_0x41651d[_0xe211('0xf')](0x1f4,_0x15519d[_0xe211('0x11')]));});});};exports[_0xe211('0x1f')]=function(_0x40a0f9){var _0x907f89=this;return new Promise(function(_0x1a56d1,_0x185239){return db[_0xe211('0x15')][_0xe211('0x20')]({'raw':_0x40a0f9[_0xe211('0x17')]?_0x40a0f9['options']['raw']===undefined?!![]:![]:!![],'where':_0x40a0f9['options']?_0x40a0f9[_0xe211('0x17')]['where']||null:null,'attributes':_0x40a0f9[_0xe211('0x17')]?_0x40a0f9[_0xe211('0x17')][_0xe211('0x19')]||null:null,'include':_0x40a0f9['options']?_0x40a0f9['options'][_0xe211('0x1b')]?_[_0xe211('0x1c')](_0x40a0f9[_0xe211('0x17')][_0xe211('0x1b')],function(_0x4403a5){return{'model':db[_0x4403a5['model']],'as':_0x4403a5['as'],'attributes':_0x4403a5['attributes'],'include':_0x4403a5['include']?_[_0xe211('0x1c')](_0x4403a5[_0xe211('0x1b')],function(_0x5a49ac){return{'model':db[_0x5a49ac[_0xe211('0x1d')]],'as':_0x5a49ac['as'],'attributes':_0x5a49ac[_0xe211('0x19')],'include':_0x5a49ac[_0xe211('0x1b')]?_['map'](_0x5a49ac[_0xe211('0x1b')],function(_0x2b891e){return{'model':db[_0x2b891e['model']],'as':_0x2b891e['as'],'attributes':_0x2b891e[_0xe211('0x19')]};}):[]};}):[]};}):[]:[]})[_0xe211('0x9')](function(_0x15242f){logger[_0xe211('0xa')](_0xe211('0x1f'),_0x40a0f9);logger['debug'](_0xe211('0x1f'),_0x40a0f9,JSON['stringify'](_0x15242f));_0x1a56d1(_0x15242f);})[_0xe211('0x13')](function(_0x56eeeb){logger[_0xe211('0xf')](_0xe211('0x1f'),_0x56eeeb['message'],_0x40a0f9);_0x185239(_0x907f89[_0xe211('0xf')](0x1f4,_0x56eeeb[_0xe211('0x11')]));});});}; \ No newline at end of file +var _0xcfac=['raw','where','attributes','include','map','model','catch','ShowSugarcrmAccount','find','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options'];(function(_0x189dbd,_0x1d3cad){var _0x7861fb=function(_0x1a8738){while(--_0x1a8738){_0x189dbd['push'](_0x189dbd['shift']());}};_0x7861fb(++_0x1d3cad);}(_0xcfac,0x129));var _0xccfa=function(_0x8b415e,_0x224150){_0x8b415e=_0x8b415e-0x0;var _0x25f5ed=_0xcfac[_0x8b415e];return _0x25f5ed;};'use strict';var _=require('lodash');var util=require(_0xccfa('0x0'));var moment=require(_0xccfa('0x1'));var BPromise=require(_0xccfa('0x2'));var rs=require(_0xccfa('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xccfa('0x4'));var logger=require(_0xccfa('0x5'))(_0xccfa('0x6'));var config=require(_0xccfa('0x7'));var jayson=require(_0xccfa('0x8'));var client=jayson[_0xccfa('0x9')][_0xccfa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13aaee,_0x1e06c2,_0x5cb055){return new BPromise(function(_0x288999,_0x1870d8){return client[_0xccfa('0xb')](_0x13aaee,_0x5cb055)[_0xccfa('0xc')](function(_0x4da48c){logger[_0xccfa('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x1e06c2,_0xccfa('0xe'));logger[_0xccfa('0xf')](_0xccfa('0x10'),_0x1e06c2,_0xccfa('0xe'),JSON[_0xccfa('0x11')](_0x4da48c));if(_0x4da48c[_0xccfa('0x12')]){if(_0x4da48c['error'][_0xccfa('0x13')]===0x1f4){logger[_0xccfa('0x12')](_0xccfa('0x14'),_0x1e06c2,_0x4da48c[_0xccfa('0x12')][_0xccfa('0x15')]);return _0x1870d8(_0x4da48c['error'][_0xccfa('0x15')]);}logger[_0xccfa('0x12')](_0xccfa('0x14'),_0x1e06c2,_0x4da48c['error'][_0xccfa('0x15')]);return _0x288999(_0x4da48c[_0xccfa('0x12')][_0xccfa('0x15')]);}else{logger[_0xccfa('0xd')](_0xccfa('0x14'),_0x1e06c2,_0xccfa('0xe'));_0x288999(_0x4da48c[_0xccfa('0x16')][_0xccfa('0x15')]);}})['catch'](function(_0x489dda){logger[_0xccfa('0x12')](_0xccfa('0x14'),_0x1e06c2,_0x489dda);_0x1870d8(_0x489dda);});});}exports[_0xccfa('0x17')]=function(_0x114159){var _0x4cbe85=this;return new Promise(function(_0x264d9c,_0x115433){return db[_0xccfa('0x18')][_0xccfa('0x19')]({'raw':_0x114159[_0xccfa('0x1a')]?_0x114159[_0xccfa('0x1a')][_0xccfa('0x1b')]===undefined?!![]:![]:!![],'where':_0x114159[_0xccfa('0x1a')]?_0x114159[_0xccfa('0x1a')][_0xccfa('0x1c')]||null:null,'attributes':_0x114159['options']?_0x114159[_0xccfa('0x1a')][_0xccfa('0x1d')]||null:null,'limit':_0x114159[_0xccfa('0x1a')]?_0x114159[_0xccfa('0x1a')]['limit']||null:null,'include':_0x114159[_0xccfa('0x1a')]?_0x114159[_0xccfa('0x1a')][_0xccfa('0x1e')]?_[_0xccfa('0x1f')](_0x114159[_0xccfa('0x1a')]['include'],function(_0x450f15){return{'model':db[_0x450f15[_0xccfa('0x20')]],'as':_0x450f15['as'],'attributes':_0x450f15[_0xccfa('0x1d')],'include':_0x450f15[_0xccfa('0x1e')]?_[_0xccfa('0x1f')](_0x450f15[_0xccfa('0x1e')],function(_0x576af2){return{'model':db[_0x576af2['model']],'as':_0x576af2['as'],'attributes':_0x576af2['attributes'],'include':_0x576af2[_0xccfa('0x1e')]?_[_0xccfa('0x1f')](_0x576af2[_0xccfa('0x1e')],function(_0x5733fb){return{'model':db[_0x5733fb[_0xccfa('0x20')]],'as':_0x5733fb['as'],'attributes':_0x5733fb[_0xccfa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xccfa('0xc')](function(_0x463022){logger['info'](_0xccfa('0x17'),_0x114159);logger['debug'](_0xccfa('0x17'),_0x114159,JSON[_0xccfa('0x11')](_0x463022));_0x264d9c(_0x463022);})[_0xccfa('0x21')](function(_0x516960){logger[_0xccfa('0x12')](_0xccfa('0x17'),_0x516960[_0xccfa('0x15')],_0x114159);_0x115433(_0x4cbe85['error'](0x1f4,_0x516960['message']));});});};exports[_0xccfa('0x22')]=function(_0x4b7a08){var _0x2ffd30=this;return new Promise(function(_0x16d326,_0x357b77){return db[_0xccfa('0x18')][_0xccfa('0x23')]({'raw':_0x4b7a08['options']?_0x4b7a08[_0xccfa('0x1a')][_0xccfa('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b7a08['options']?_0x4b7a08[_0xccfa('0x1a')][_0xccfa('0x1c')]||null:null,'attributes':_0x4b7a08[_0xccfa('0x1a')]?_0x4b7a08[_0xccfa('0x1a')]['attributes']||null:null,'include':_0x4b7a08[_0xccfa('0x1a')]?_0x4b7a08[_0xccfa('0x1a')][_0xccfa('0x1e')]?_['map'](_0x4b7a08[_0xccfa('0x1a')]['include'],function(_0x2af4e6){return{'model':db[_0x2af4e6[_0xccfa('0x20')]],'as':_0x2af4e6['as'],'attributes':_0x2af4e6[_0xccfa('0x1d')],'include':_0x2af4e6[_0xccfa('0x1e')]?_['map'](_0x2af4e6['include'],function(_0x1f6ca7){return{'model':db[_0x1f6ca7['model']],'as':_0x1f6ca7['as'],'attributes':_0x1f6ca7[_0xccfa('0x1d')],'include':_0x1f6ca7[_0xccfa('0x1e')]?_[_0xccfa('0x1f')](_0x1f6ca7['include'],function(_0x18617b){return{'model':db[_0x18617b['model']],'as':_0x18617b['as'],'attributes':_0x18617b[_0xccfa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xccfa('0xc')](function(_0x26cb61){logger[_0xccfa('0xd')]('ShowSugarcrmAccount',_0x4b7a08);logger[_0xccfa('0xf')](_0xccfa('0x22'),_0x4b7a08,JSON[_0xccfa('0x11')](_0x26cb61));_0x16d326(_0x26cb61);})[_0xccfa('0x21')](function(_0x4eb5c7){logger[_0xccfa('0x12')](_0xccfa('0x22'),_0x4eb5c7[_0xccfa('0x15')],_0x4b7a08);_0x357b77(_0x2ffd30[_0xccfa('0x12')](0x1f4,_0x4eb5c7['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 4cc7566..3796a0d 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 _0xb476=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','show'];(function(_0x597c40,_0x231268){var _0x2a1d0c=function(_0x154eaf){while(--_0x154eaf){_0x597c40['push'](_0x597c40['shift']());}};_0x2a1d0c(++_0x231268);}(_0xb476,0x76));var _0x6b47=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xb476[_0x3635ce];return _0x97ecd0;};'use strict';var multer=require(_0x6b47('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b47('0x1'));var express=require(_0x6b47('0x2'));var router=express[_0x6b47('0x3')]();var fs_extra=require(_0x6b47('0x4'));var auth=require(_0x6b47('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6b47('0x6'));var controller=require(_0x6b47('0x7'));router[_0x6b47('0x8')]('/',auth[_0x6b47('0x9')](),controller[_0x6b47('0xa')]);router[_0x6b47('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6b47('0xb')]);router['get'](_0x6b47('0xc'),auth[_0x6b47('0x9')](),controller[_0x6b47('0xd')]);router['get'](_0x6b47('0xe'),auth[_0x6b47('0x9')](),controller[_0x6b47('0xf')]);router['get'](_0x6b47('0x10'),auth['isAuthenticated'](),controller[_0x6b47('0x11')]);router[_0x6b47('0x12')]('/',auth[_0x6b47('0x9')](),controller[_0x6b47('0x13')]);router[_0x6b47('0x14')](_0x6b47('0x15'),auth[_0x6b47('0x9')](),controller[_0x6b47('0x16')]);router[_0x6b47('0x17')](_0x6b47('0x15'),auth[_0x6b47('0x9')](),controller[_0x6b47('0x18')]);module[_0x6b47('0x19')]=router; \ No newline at end of file +var _0x3bb5=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','create','put','delete','destroy'];(function(_0x2d56b8,_0x266ab2){var _0x46d418=function(_0x2eb46e){while(--_0x2eb46e){_0x2d56b8['push'](_0x2d56b8['shift']());}};_0x46d418(++_0x266ab2);}(_0x3bb5,0xfc));var _0x53bb=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x3bb5[_0x5a776b];return _0xbbef59;};'use strict';var multer=require('multer');var util=require(_0x53bb('0x0'));var path=require(_0x53bb('0x1'));var timeout=require(_0x53bb('0x2'));var express=require(_0x53bb('0x3'));var router=express[_0x53bb('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x53bb('0x5'));var config=require(_0x53bb('0x6'));var controller=require(_0x53bb('0x7'));router[_0x53bb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x53bb('0x9'),auth[_0x53bb('0xa')](),controller[_0x53bb('0xb')]);router[_0x53bb('0x8')](_0x53bb('0xc'),auth[_0x53bb('0xa')](),controller[_0x53bb('0xd')]);router[_0x53bb('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x53bb('0xe')]);router[_0x53bb('0x8')](_0x53bb('0xf'),auth[_0x53bb('0xa')](),controller[_0x53bb('0x10')]);router['post']('/',auth[_0x53bb('0xa')](),controller[_0x53bb('0x11')]);router[_0x53bb('0x12')](_0x53bb('0x9'),auth[_0x53bb('0xa')](),controller['update']);router[_0x53bb('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x53bb('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 5794d94..388775c 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 _0x9c05=['sequelize','exports','STRING'];(function(_0x1dc59b,_0x5e0410){var _0x6f734c=function(_0x5d3f4c){while(--_0x5d3f4c){_0x1dc59b['push'](_0x1dc59b['shift']());}};_0x6f734c(++_0x5e0410);}(_0x9c05,0x1c2));var _0x59c0=function(_0x1905ec,_0x55f7f2){_0x1905ec=_0x1905ec-0x0;var _0x38e534=_0x9c05[_0x1905ec];return _0x38e534;};'use strict';var Sequelize=require(_0x59c0('0x0'));module[_0x59c0('0x1')]={'name':{'type':Sequelize[_0x59c0('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x533f=['sequelize','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x533f,0x9e));var _0xf533=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x533f[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0xf533('0x0'));module[_0xf533('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 146c687..7c72930 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 _0x099f=['attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','length','catch','create','body','params','find','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection'];(function(_0x52bb3c,_0x4398ba){var _0x4c029e=function(_0xb36acb){while(--_0xb36acb){_0x52bb3c['push'](_0x52bb3c['shift']());}};_0x4c029e(++_0x4398ba);}(_0x099f,0x1a8));var _0xf099=function(_0x20a61c,_0x47893d){_0x20a61c=_0x20a61c-0x0;var _0x1812bb=_0x099f[_0x20a61c];return _0x1812bb;};'use strict';var emlformat=require(_0xf099('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf099('0x1'));var rp=require('request-promise');var moment=require(_0xf099('0x2'));var BPromise=require(_0xf099('0x3'));var Mustache=require(_0xf099('0x4'));var util=require(_0xf099('0x5'));var path=require('path');var sox=require(_0xf099('0x6'));var csv=require('to-csv');var ejs=require(_0xf099('0x7'));var fs=require('fs');var fs_extra=require(_0xf099('0x8'));var _=require('lodash');var squel=require(_0xf099('0x9'));var crypto=require(_0xf099('0xa'));var jsforce=require(_0xf099('0xb'));var deskjs=require(_0xf099('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf099('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf099('0xe'));var as=require(_0xf099('0xf'));var hardwareService=require(_0xf099('0x10'));var logger=require('../../config/logger')(_0xf099('0x11'));var utils=require(_0xf099('0x12'));var config=require(_0xf099('0x13'));var licenseUtil=require(_0xf099('0x14'));var db=require(_0xf099('0x15'))['db'];function respondWithStatusCode(_0xc02f8f,_0x453269){_0x453269=_0x453269||0xcc;return function(_0x50602e){if(_0x50602e){return _0xc02f8f[_0xf099('0x16')](_0x453269);}return _0xc02f8f[_0xf099('0x17')](_0x453269)[_0xf099('0x18')]();};}function respondWithResult(_0x369a51,_0x31c756){_0x31c756=_0x31c756||0xc8;return function(_0x3e500f){if(_0x3e500f){return _0x369a51[_0xf099('0x17')](_0x31c756)[_0xf099('0x19')](_0x3e500f);}};}function respondWithFilteredResult(_0x51bfa3,_0x53e844){return function(_0x1ffb88){if(_0x1ffb88){var _0x5494a0=typeof _0x53e844[_0xf099('0x1a')]===_0xf099('0x1b')&&typeof _0x53e844[_0xf099('0x1c')]===_0xf099('0x1b');var _0x34117d=_0x1ffb88['count'];var _0xd5ad2c=_0x5494a0?0x0:_0x53e844['offset'];var _0x49baa9=_0x5494a0?_0x1ffb88[_0xf099('0x1d')]:_0x53e844[_0xf099('0x1a')]+_0x53e844[_0xf099('0x1c')];var _0x59c691;if(_0x49baa9>=_0x34117d){_0x49baa9=_0x34117d;_0x59c691=0xc8;}else{_0x59c691=0xce;}_0x51bfa3[_0xf099('0x17')](_0x59c691);return _0x51bfa3['set'](_0xf099('0x1e'),_0xd5ad2c+'-'+_0x49baa9+'/'+_0x34117d)[_0xf099('0x19')](_0x1ffb88);}return null;};}function patchUpdates(_0x521755){return function(_0x3ed205){try{jsonpatch['apply'](_0x3ed205,_0x521755,!![]);}catch(_0x4ef4f6){return BPromise['reject'](_0x4ef4f6);}return _0x3ed205[_0xf099('0x1f')]();};}function saveUpdates(_0x881ab0,_0x29e8a1){return function(_0x684433){if(_0x684433){return _0x684433[_0xf099('0x20')](_0x881ab0)[_0xf099('0x21')](function(_0x5ee2c0){return _0x5ee2c0;});}return null;};}function removeEntity(_0x471ac8,_0x313345){return function(_0x559fd9){if(_0x559fd9){return _0x559fd9[_0xf099('0x22')]()[_0xf099('0x21')](function(){_0x471ac8[_0xf099('0x17')](0xcc)[_0xf099('0x18')]();});}};}function handleEntityNotFound(_0x456196,_0x3bd012){return function(_0x3ac127){if(!_0x3ac127){_0x456196[_0xf099('0x16')](0x194);}return _0x3ac127;};}function handleError(_0x53d252,_0x404bbc){_0x404bbc=_0x404bbc||0x1f4;return function(_0x1928ad){logger[_0xf099('0x23')](_0x1928ad[_0xf099('0x24')]);if(_0x1928ad['name']){delete _0x1928ad['name'];}_0x53d252['status'](_0x404bbc)[_0xf099('0x25')](_0x1928ad);};}exports[_0xf099('0x26')]=function(_0x16712f,_0x3fef7f){var _0x37f225={},_0x1fce31={},_0x229b66={'count':0x0,'rows':[]};var _0x4aed8f=_[_0xf099('0x27')](db[_0xf099('0x28')][_0xf099('0x29')],function(_0x503080){return{'name':_0x503080[_0xf099('0x2a')],'type':_0x503080[_0xf099('0x2b')][_0xf099('0x2c')]};});_0x1fce31['model']=_[_0xf099('0x27')](_0x4aed8f,_0xf099('0x2d'));_0x1fce31[_0xf099('0x2e')]=_[_0xf099('0x2f')](_0x16712f[_0xf099('0x2e')]);_0x1fce31[_0xf099('0x30')]=_[_0xf099('0x31')](_0x1fce31['model'],_0x1fce31['query']);_0x37f225[_0xf099('0x32')]=_[_0xf099('0x31')](_0x1fce31[_0xf099('0x33')],qs[_0xf099('0x34')](_0x16712f[_0xf099('0x2e')][_0xf099('0x34')]));_0x37f225[_0xf099('0x32')]=_0x37f225[_0xf099('0x32')]['length']?_0x37f225[_0xf099('0x32')]:_0x1fce31[_0xf099('0x33')];if(!_0x16712f[_0xf099('0x2e')][_0xf099('0x35')](_0xf099('0x36'))){_0x37f225[_0xf099('0x1c')]=qs[_0xf099('0x1c')](_0x16712f[_0xf099('0x2e')][_0xf099('0x1c')]);_0x37f225[_0xf099('0x1a')]=qs[_0xf099('0x1a')](_0x16712f[_0xf099('0x2e')][_0xf099('0x1a')]);}_0x37f225[_0xf099('0x37')]=qs[_0xf099('0x38')](_0x16712f['query']['sort']);_0x37f225['where']=qs[_0xf099('0x30')](_[_0xf099('0x39')](_0x16712f[_0xf099('0x2e')],_0x1fce31[_0xf099('0x30')]),_0x4aed8f);if(_0x16712f['query'][_0xf099('0x3a')]){_0x37f225[_0xf099('0x3b')]=_[_0xf099('0x3c')](_0x37f225[_0xf099('0x3b')],{'$or':_[_0xf099('0x27')](_0x4aed8f,function(_0x2c1e9a){if(_0x2c1e9a['type']!==_0xf099('0x3d')){var _0x4016af={};_0x4016af[_0x2c1e9a[_0xf099('0x2d')]]={'$like':'%'+_0x16712f[_0xf099('0x2e')][_0xf099('0x3a')]+'%'};return _0x4016af;}})});}_0x37f225=_[_0xf099('0x3c')]({},_0x37f225,_0x16712f[_0xf099('0x3e')]);var _0x7fe65f={'where':_0x37f225[_0xf099('0x3b')]};return db[_0xf099('0x28')][_0xf099('0x1d')](_0x7fe65f)[_0xf099('0x21')](function(_0x63a240){_0x229b66[_0xf099('0x1d')]=_0x63a240;if(_0x16712f[_0xf099('0x2e')][_0xf099('0x3f')]){_0x37f225[_0xf099('0x40')]=[{'all':!![]}];}return db[_0xf099('0x28')][_0xf099('0x41')](_0x37f225);})['then'](function(_0x40f5ed){_0x229b66[_0xf099('0x42')]=_0x40f5ed;return _0x229b66;})[_0xf099('0x21')](respondWithFilteredResult(_0x3fef7f,_0x37f225))['catch'](handleError(_0x3fef7f,null));};exports[_0xf099('0x43')]=function(_0x1c4126,_0x4ee331){var _0x407f9f={'raw':![],'where':{'id':_0x1c4126['params']['id']}},_0x4f5a9e={};_0x4f5a9e[_0xf099('0x33')]=_['keys'](db[_0xf099('0x28')][_0xf099('0x29')]);_0x4f5a9e[_0xf099('0x2e')]=_['keys'](_0x1c4126[_0xf099('0x2e')]);_0x4f5a9e['filters']=_[_0xf099('0x31')](_0x4f5a9e[_0xf099('0x33')],_0x4f5a9e[_0xf099('0x2e')]);_0x407f9f['attributes']=_[_0xf099('0x31')](_0x4f5a9e[_0xf099('0x33')],qs[_0xf099('0x34')](_0x1c4126[_0xf099('0x2e')][_0xf099('0x34')]));_0x407f9f[_0xf099('0x32')]=_0x407f9f[_0xf099('0x32')][_0xf099('0x44')]?_0x407f9f[_0xf099('0x32')]:_0x4f5a9e[_0xf099('0x33')];if(_0x1c4126[_0xf099('0x2e')]['includeAll']){_0x407f9f['include']=[{'all':!![]}];}_0x407f9f=_[_0xf099('0x3c')]({},_0x407f9f,_0x1c4126[_0xf099('0x3e')]);return db[_0xf099('0x28')]['find'](_0x407f9f)[_0xf099('0x21')](handleEntityNotFound(_0x4ee331,null))[_0xf099('0x21')](respondWithResult(_0x4ee331,null))[_0xf099('0x45')](handleError(_0x4ee331,null));};exports[_0xf099('0x46')]=function(_0x447ae2,_0x376180){return db['SugarcrmConfiguration'][_0xf099('0x46')](_0x447ae2[_0xf099('0x47')],{})[_0xf099('0x21')](respondWithResult(_0x376180,0xc9))['catch'](handleError(_0x376180,null));};exports['update']=function(_0x87db70,_0x3a0637){if(_0x87db70['body']['id']){delete _0x87db70[_0xf099('0x47')]['id'];}return db[_0xf099('0x28')]['find']({'where':{'id':_0x87db70[_0xf099('0x48')]['id']}})[_0xf099('0x21')](handleEntityNotFound(_0x3a0637,null))[_0xf099('0x21')](saveUpdates(_0x87db70[_0xf099('0x47')],null))['then'](respondWithResult(_0x3a0637,null))[_0xf099('0x45')](handleError(_0x3a0637,null));};exports[_0xf099('0x22')]=function(_0x27417e,_0x2d88e1){return db['SugarcrmConfiguration'][_0xf099('0x49')]({'where':{'id':_0x27417e[_0xf099('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d88e1,null))[_0xf099('0x21')](removeEntity(_0x2d88e1,null))[_0xf099('0x45')](handleError(_0x2d88e1,null));};exports[_0xf099('0x4a')]=function(_0x1e8f5b,_0x87788e,_0x2ae713){var _0x16f5c3={};var _0xf6315d={};var _0x7644d8;var _0x1775ba;return db[_0xf099('0x28')][_0xf099('0x4b')]({'where':{'id':_0x1e8f5b[_0xf099('0x48')]['id']}})['then'](handleEntityNotFound(_0x87788e,null))[_0xf099('0x21')](function(_0x144127){if(_0x144127){_0x7644d8=_0x144127;_0xf6315d[_0xf099('0x33')]=_['keys'](db[_0xf099('0x4c')][_0xf099('0x29')]);_0xf6315d['query']=_[_0xf099('0x2f')](_0x1e8f5b[_0xf099('0x2e')]);_0xf6315d[_0xf099('0x30')]=_[_0xf099('0x31')](_0xf6315d['model'],_0xf6315d['query']);_0x16f5c3[_0xf099('0x32')]=_[_0xf099('0x31')](_0xf6315d[_0xf099('0x33')],qs['fields'](_0x1e8f5b[_0xf099('0x2e')]['fields']));_0x16f5c3['attributes']=_0x16f5c3['attributes']['length']?_0x16f5c3[_0xf099('0x32')]:_0xf6315d['model'];_0x16f5c3[_0xf099('0x37')]=qs[_0xf099('0x38')](_0x1e8f5b[_0xf099('0x2e')][_0xf099('0x38')]);_0x16f5c3[_0xf099('0x3b')]=qs[_0xf099('0x30')](_[_0xf099('0x39')](_0x1e8f5b['query'],_0xf6315d[_0xf099('0x30')]));if(_0x1e8f5b[_0xf099('0x2e')][_0xf099('0x3a')]){_0x16f5c3[_0xf099('0x3b')]=_[_0xf099('0x3c')](_0x16f5c3[_0xf099('0x3b')],{'$or':_[_0xf099('0x27')](_0x16f5c3[_0xf099('0x32')],function(_0x20ba7b){var _0x21f7cf={};_0x21f7cf[_0x20ba7b]={'$like':'%'+_0x1e8f5b[_0xf099('0x2e')][_0xf099('0x3a')]+'%'};return _0x21f7cf;})});}_0x16f5c3=_[_0xf099('0x3c')]({},_0x16f5c3,_0x1e8f5b['options']);return _0x7644d8[_0xf099('0x4a')](_0x16f5c3);}})[_0xf099('0x21')](function(_0x4b28df){if(_0x4b28df){_0x1775ba=_0x4b28df[_0xf099('0x44')];if(!_0x1e8f5b['query'][_0xf099('0x35')](_0xf099('0x36'))){_0x16f5c3[_0xf099('0x1c')]=qs[_0xf099('0x1c')](_0x1e8f5b[_0xf099('0x2e')]['limit']);_0x16f5c3[_0xf099('0x1a')]=qs[_0xf099('0x1a')](_0x1e8f5b[_0xf099('0x2e')]['offset']);}return _0x7644d8[_0xf099('0x4a')](_0x16f5c3);}})[_0xf099('0x21')](function(_0x28f1cc){if(_0x28f1cc){return _0x28f1cc?{'count':_0x1775ba,'rows':_0x28f1cc}:null;}})[_0xf099('0x21')](respondWithResult(_0x87788e,null))[_0xf099('0x45')](handleError(_0x87788e,null));};exports['getSubjects']=function(_0x1ba100,_0x3c3beb,_0x42e8a7){var _0x518cad={};var _0x35b5cb={};var _0x131f24;var _0x29e5b6;return db[_0xf099('0x28')]['findOne']({'where':{'id':_0x1ba100['params']['id']}})[_0xf099('0x21')](handleEntityNotFound(_0x3c3beb,null))[_0xf099('0x21')](function(_0x2fa343){if(_0x2fa343){_0x131f24=_0x2fa343;_0x35b5cb[_0xf099('0x33')]=_[_0xf099('0x2f')](db[_0xf099('0x4c')]['rawAttributes']);_0x35b5cb['query']=_[_0xf099('0x2f')](_0x1ba100['query']);_0x35b5cb[_0xf099('0x30')]=_[_0xf099('0x31')](_0x35b5cb['model'],_0x35b5cb[_0xf099('0x2e')]);_0x518cad[_0xf099('0x32')]=_[_0xf099('0x31')](_0x35b5cb[_0xf099('0x33')],qs[_0xf099('0x34')](_0x1ba100[_0xf099('0x2e')]['fields']));_0x518cad[_0xf099('0x32')]=_0x518cad[_0xf099('0x32')][_0xf099('0x44')]?_0x518cad[_0xf099('0x32')]:_0x35b5cb[_0xf099('0x33')];_0x518cad[_0xf099('0x37')]=qs[_0xf099('0x38')](_0x1ba100[_0xf099('0x2e')][_0xf099('0x38')]);_0x518cad[_0xf099('0x3b')]=qs[_0xf099('0x30')](_['pick'](_0x1ba100[_0xf099('0x2e')],_0x35b5cb['filters']));if(_0x1ba100['query']['filter']){_0x518cad[_0xf099('0x3b')]=_['merge'](_0x518cad[_0xf099('0x3b')],{'$or':_[_0xf099('0x27')](_0x518cad[_0xf099('0x32')],function(_0x5139eb){var _0xa4fb2d={};_0xa4fb2d[_0x5139eb]={'$like':'%'+_0x1ba100[_0xf099('0x2e')][_0xf099('0x3a')]+'%'};return _0xa4fb2d;})});}_0x518cad=_[_0xf099('0x3c')]({},_0x518cad,_0x1ba100[_0xf099('0x3e')]);return _0x131f24[_0xf099('0x4d')](_0x518cad);}})[_0xf099('0x21')](function(_0xbb477d){if(_0xbb477d){_0x29e5b6=_0xbb477d['length'];if(!_0x1ba100[_0xf099('0x2e')][_0xf099('0x35')](_0xf099('0x36'))){_0x518cad[_0xf099('0x1c')]=qs[_0xf099('0x1c')](_0x1ba100['query'][_0xf099('0x1c')]);_0x518cad[_0xf099('0x1a')]=qs[_0xf099('0x1a')](_0x1ba100[_0xf099('0x2e')][_0xf099('0x1a')]);}return _0x131f24[_0xf099('0x4d')](_0x518cad);}})[_0xf099('0x21')](function(_0x37f16b){if(_0x37f16b){return _0x37f16b?{'count':_0x29e5b6,'rows':_0x37f16b}:null;}})['then'](respondWithResult(_0x3c3beb,null))['catch'](handleError(_0x3c3beb,null));};exports[_0xf099('0x4e')]=function(_0x1dcd5f,_0x585c5e,_0x421431){var _0x3677c4={};var _0x520153={};var _0x2d3925;var _0x58b586;return db[_0xf099('0x28')]['findOne']({'where':{'id':_0x1dcd5f[_0xf099('0x48')]['id']}})[_0xf099('0x21')](handleEntityNotFound(_0x585c5e,null))[_0xf099('0x21')](function(_0x4b339b){if(_0x4b339b){_0x2d3925=_0x4b339b;_0x520153[_0xf099('0x33')]=_[_0xf099('0x2f')](db['SugarcrmField'][_0xf099('0x29')]);_0x520153['query']=_['keys'](_0x1dcd5f[_0xf099('0x2e')]);_0x520153['filters']=_[_0xf099('0x31')](_0x520153['model'],_0x520153['query']);_0x3677c4[_0xf099('0x32')]=_['intersection'](_0x520153[_0xf099('0x33')],qs[_0xf099('0x34')](_0x1dcd5f[_0xf099('0x2e')][_0xf099('0x34')]));_0x3677c4[_0xf099('0x32')]=_0x3677c4[_0xf099('0x32')][_0xf099('0x44')]?_0x3677c4[_0xf099('0x32')]:_0x520153['model'];_0x3677c4[_0xf099('0x37')]=qs[_0xf099('0x38')](_0x1dcd5f['query'][_0xf099('0x38')]);_0x3677c4[_0xf099('0x3b')]=qs[_0xf099('0x30')](_[_0xf099('0x39')](_0x1dcd5f[_0xf099('0x2e')],_0x520153[_0xf099('0x30')]));if(_0x1dcd5f[_0xf099('0x2e')][_0xf099('0x3a')]){_0x3677c4['where']=_['merge'](_0x3677c4['where'],{'$or':_['map'](_0x3677c4[_0xf099('0x32')],function(_0x3ef5a9){var _0x1bde97={};_0x1bde97[_0x3ef5a9]={'$like':'%'+_0x1dcd5f['query'][_0xf099('0x3a')]+'%'};return _0x1bde97;})});}_0x3677c4=_['merge']({},_0x3677c4,_0x1dcd5f['options']);return _0x2d3925['getDescriptions'](_0x3677c4);}})[_0xf099('0x21')](function(_0x35cc90){if(_0x35cc90){_0x58b586=_0x35cc90[_0xf099('0x44')];if(!_0x1dcd5f[_0xf099('0x2e')][_0xf099('0x35')](_0xf099('0x36'))){_0x3677c4[_0xf099('0x1c')]=qs[_0xf099('0x1c')](_0x1dcd5f['query']['limit']);_0x3677c4['offset']=qs[_0xf099('0x1a')](_0x1dcd5f['query'][_0xf099('0x1a')]);}return _0x2d3925[_0xf099('0x4e')](_0x3677c4);}})[_0xf099('0x21')](function(_0x2630c7){if(_0x2630c7){return _0x2630c7?{'count':_0x58b586,'rows':_0x2630c7}:null;}})[_0xf099('0x21')](respondWithResult(_0x585c5e,null))[_0xf099('0x45')](handleError(_0x585c5e,null));}; \ No newline at end of file +var _0x35bc=['where','VIRTUAL','merge','SugarcrmConfiguration','includeAll','include','findAll','rows','then','catch','show','params','intersection','find','create','update','body','destroy','getFields','findOne','rawAttributes','order','sort','pick','options','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','filters','filter'];(function(_0x23fb74,_0x3ee528){var _0x67b41f=function(_0xfc00cf){while(--_0xfc00cf){_0x23fb74['push'](_0x23fb74['shift']());}};_0x67b41f(++_0x3ee528);}(_0x35bc,0x1ac));var _0xc35b=function(_0x5f150e,_0x5e3a1e){_0x5f150e=_0x5f150e-0x0;var _0x2f6957=_0x35bc[_0x5f150e];return _0x2f6957;};'use strict';var emlformat=require(_0xc35b('0x0'));var rimraf=require(_0xc35b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc35b('0x2'));var rp=require(_0xc35b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc35b('0x4'));var path=require(_0xc35b('0x5'));var sox=require(_0xc35b('0x6'));var csv=require('to-csv');var ejs=require(_0xc35b('0x7'));var fs=require('fs');var fs_extra=require(_0xc35b('0x8'));var _=require(_0xc35b('0x9'));var squel=require(_0xc35b('0xa'));var crypto=require(_0xc35b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xc35b('0xc'));var toCsv=require(_0xc35b('0xd'));var querystring=require(_0xc35b('0xe'));var Papa=require(_0xc35b('0xf'));var Redis=require('ioredis');var authService=require(_0xc35b('0x10'));var qs=require(_0xc35b('0x11'));var as=require(_0xc35b('0x12'));var hardwareService=require(_0xc35b('0x13'));var logger=require(_0xc35b('0x14'))(_0xc35b('0x15'));var utils=require('../../config/utils');var config=require(_0xc35b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc35b('0x17'))['db'];function respondWithStatusCode(_0xe2b14f,_0x56d458){_0x56d458=_0x56d458||0xcc;return function(_0x36be63){if(_0x36be63){return _0xe2b14f[_0xc35b('0x18')](_0x56d458);}return _0xe2b14f['status'](_0x56d458)[_0xc35b('0x19')]();};}function respondWithResult(_0x5843e6,_0x47ab95){_0x47ab95=_0x47ab95||0xc8;return function(_0x2aabed){if(_0x2aabed){return _0x5843e6[_0xc35b('0x1a')](_0x47ab95)['json'](_0x2aabed);}};}function respondWithFilteredResult(_0x2263a5,_0x51e645){return function(_0x377467){if(_0x377467){var _0x2c5226=typeof _0x51e645[_0xc35b('0x1b')]===_0xc35b('0x1c')&&typeof _0x51e645['limit']===_0xc35b('0x1c');var _0x871892=_0x377467[_0xc35b('0x1d')];var _0x1561a7=_0x2c5226?0x0:_0x51e645[_0xc35b('0x1b')];var _0x190f0e=_0x2c5226?_0x377467[_0xc35b('0x1d')]:_0x51e645[_0xc35b('0x1b')]+_0x51e645[_0xc35b('0x1e')];var _0x4b9b79;if(_0x190f0e>=_0x871892){_0x190f0e=_0x871892;_0x4b9b79=0xc8;}else{_0x4b9b79=0xce;}_0x2263a5[_0xc35b('0x1a')](_0x4b9b79);return _0x2263a5['set'](_0xc35b('0x1f'),_0x1561a7+'-'+_0x190f0e+'/'+_0x871892)[_0xc35b('0x20')](_0x377467);}return null;};}function patchUpdates(_0x18b9e6){return function(_0x531cd5){try{jsonpatch[_0xc35b('0x21')](_0x531cd5,_0x18b9e6,!![]);}catch(_0x24cf62){return BPromise['reject'](_0x24cf62);}return _0x531cd5['save']();};}function saveUpdates(_0x42b32d,_0x5090b5){return function(_0x1437fd){if(_0x1437fd){return _0x1437fd['update'](_0x42b32d)['then'](function(_0x1abd84){return _0x1abd84;});}return null;};}function removeEntity(_0x26a608,_0x57d1eb){return function(_0x331302){if(_0x331302){return _0x331302['destroy']()['then'](function(){_0x26a608[_0xc35b('0x1a')](0xcc)[_0xc35b('0x19')]();});}};}function handleEntityNotFound(_0x5dd351,_0x14e062){return function(_0x551c99){if(!_0x551c99){_0x5dd351['sendStatus'](0x194);}return _0x551c99;};}function handleError(_0x93054a,_0x402dce){_0x402dce=_0x402dce||0x1f4;return function(_0x5200b2){logger[_0xc35b('0x22')](_0x5200b2[_0xc35b('0x23')]);if(_0x5200b2[_0xc35b('0x24')]){delete _0x5200b2[_0xc35b('0x24')];}_0x93054a[_0xc35b('0x1a')](_0x402dce)[_0xc35b('0x25')](_0x5200b2);};}exports[_0xc35b('0x26')]=function(_0x3b04c9,_0x5bb094){var _0x18af48={},_0x8a132={},_0x6d5ebb={'count':0x0,'rows':[]};var _0x33a601=_[_0xc35b('0x27')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x34c999){return{'name':_0x34c999[_0xc35b('0x28')],'type':_0x34c999[_0xc35b('0x29')][_0xc35b('0x2a')]};});_0x8a132[_0xc35b('0x2b')]=_['map'](_0x33a601,_0xc35b('0x24'));_0x8a132[_0xc35b('0x2c')]=_[_0xc35b('0x2d')](_0x3b04c9['query']);_0x8a132['filters']=_['intersection'](_0x8a132[_0xc35b('0x2b')],_0x8a132[_0xc35b('0x2c')]);_0x18af48[_0xc35b('0x2e')]=_['intersection'](_0x8a132[_0xc35b('0x2b')],qs[_0xc35b('0x2f')](_0x3b04c9[_0xc35b('0x2c')][_0xc35b('0x2f')]));_0x18af48[_0xc35b('0x2e')]=_0x18af48[_0xc35b('0x2e')][_0xc35b('0x30')]?_0x18af48[_0xc35b('0x2e')]:_0x8a132[_0xc35b('0x2b')];if(!_0x3b04c9[_0xc35b('0x2c')]['hasOwnProperty'](_0xc35b('0x31'))){_0x18af48['limit']=qs[_0xc35b('0x1e')](_0x3b04c9[_0xc35b('0x2c')][_0xc35b('0x1e')]);_0x18af48[_0xc35b('0x1b')]=qs['offset'](_0x3b04c9[_0xc35b('0x2c')][_0xc35b('0x1b')]);}_0x18af48['order']=qs['sort'](_0x3b04c9[_0xc35b('0x2c')]['sort']);_0x18af48['where']=qs[_0xc35b('0x32')](_['pick'](_0x3b04c9['query'],_0x8a132[_0xc35b('0x32')]),_0x33a601);if(_0x3b04c9[_0xc35b('0x2c')][_0xc35b('0x33')]){_0x18af48[_0xc35b('0x34')]=_['merge'](_0x18af48[_0xc35b('0x34')],{'$or':_[_0xc35b('0x27')](_0x33a601,function(_0x1b0de6){if(_0x1b0de6[_0xc35b('0x29')]!==_0xc35b('0x35')){var _0x4319f7={};_0x4319f7[_0x1b0de6['name']]={'$like':'%'+_0x3b04c9[_0xc35b('0x2c')][_0xc35b('0x33')]+'%'};return _0x4319f7;}})});}_0x18af48=_[_0xc35b('0x36')]({},_0x18af48,_0x3b04c9['options']);var _0x29dcd6={'where':_0x18af48['where']};return db[_0xc35b('0x37')]['count'](_0x29dcd6)['then'](function(_0x35a80b){_0x6d5ebb[_0xc35b('0x1d')]=_0x35a80b;if(_0x3b04c9[_0xc35b('0x2c')][_0xc35b('0x38')]){_0x18af48[_0xc35b('0x39')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xc35b('0x3a')](_0x18af48);})['then'](function(_0x3c88a8){_0x6d5ebb[_0xc35b('0x3b')]=_0x3c88a8;return _0x6d5ebb;})[_0xc35b('0x3c')](respondWithFilteredResult(_0x5bb094,_0x18af48))[_0xc35b('0x3d')](handleError(_0x5bb094,null));};exports[_0xc35b('0x3e')]=function(_0x22ae55,_0x38c1bb){var _0x1946a0={'raw':![],'where':{'id':_0x22ae55[_0xc35b('0x3f')]['id']}},_0x596aef={};_0x596aef[_0xc35b('0x2b')]=_[_0xc35b('0x2d')](db[_0xc35b('0x37')]['rawAttributes']);_0x596aef[_0xc35b('0x2c')]=_[_0xc35b('0x2d')](_0x22ae55[_0xc35b('0x2c')]);_0x596aef[_0xc35b('0x32')]=_['intersection'](_0x596aef[_0xc35b('0x2b')],_0x596aef[_0xc35b('0x2c')]);_0x1946a0[_0xc35b('0x2e')]=_[_0xc35b('0x40')](_0x596aef['model'],qs[_0xc35b('0x2f')](_0x22ae55[_0xc35b('0x2c')][_0xc35b('0x2f')]));_0x1946a0[_0xc35b('0x2e')]=_0x1946a0['attributes'][_0xc35b('0x30')]?_0x1946a0[_0xc35b('0x2e')]:_0x596aef[_0xc35b('0x2b')];if(_0x22ae55['query'][_0xc35b('0x38')]){_0x1946a0[_0xc35b('0x39')]=[{'all':!![]}];}_0x1946a0=_[_0xc35b('0x36')]({},_0x1946a0,_0x22ae55['options']);return db[_0xc35b('0x37')][_0xc35b('0x41')](_0x1946a0)[_0xc35b('0x3c')](handleEntityNotFound(_0x38c1bb,null))[_0xc35b('0x3c')](respondWithResult(_0x38c1bb,null))[_0xc35b('0x3d')](handleError(_0x38c1bb,null));};exports['create']=function(_0x62d42e,_0x57c6f5){return db['SugarcrmConfiguration'][_0xc35b('0x42')](_0x62d42e['body'],{})[_0xc35b('0x3c')](respondWithResult(_0x57c6f5,0xc9))['catch'](handleError(_0x57c6f5,null));};exports[_0xc35b('0x43')]=function(_0x3c86b1,_0x54c2c2){if(_0x3c86b1[_0xc35b('0x44')]['id']){delete _0x3c86b1[_0xc35b('0x44')]['id'];}return db[_0xc35b('0x37')][_0xc35b('0x41')]({'where':{'id':_0x3c86b1[_0xc35b('0x3f')]['id']}})[_0xc35b('0x3c')](handleEntityNotFound(_0x54c2c2,null))[_0xc35b('0x3c')](saveUpdates(_0x3c86b1[_0xc35b('0x44')],null))[_0xc35b('0x3c')](respondWithResult(_0x54c2c2,null))[_0xc35b('0x3d')](handleError(_0x54c2c2,null));};exports[_0xc35b('0x45')]=function(_0x1ddd31,_0x55308f){return db['SugarcrmConfiguration'][_0xc35b('0x41')]({'where':{'id':_0x1ddd31[_0xc35b('0x3f')]['id']}})[_0xc35b('0x3c')](handleEntityNotFound(_0x55308f,null))[_0xc35b('0x3c')](removeEntity(_0x55308f,null))[_0xc35b('0x3d')](handleError(_0x55308f,null));};exports[_0xc35b('0x46')]=function(_0x28a570,_0x16b3d1,_0x18aac7){var _0x3af57f={};var _0x517754={};var _0x3f1858;var _0xca0814;return db[_0xc35b('0x37')][_0xc35b('0x47')]({'where':{'id':_0x28a570['params']['id']}})['then'](handleEntityNotFound(_0x16b3d1,null))[_0xc35b('0x3c')](function(_0x22cc28){if(_0x22cc28){_0x3f1858=_0x22cc28;_0x517754[_0xc35b('0x2b')]=_['keys'](db['SugarcrmField'][_0xc35b('0x48')]);_0x517754['query']=_[_0xc35b('0x2d')](_0x28a570[_0xc35b('0x2c')]);_0x517754[_0xc35b('0x32')]=_[_0xc35b('0x40')](_0x517754[_0xc35b('0x2b')],_0x517754[_0xc35b('0x2c')]);_0x3af57f[_0xc35b('0x2e')]=_[_0xc35b('0x40')](_0x517754[_0xc35b('0x2b')],qs[_0xc35b('0x2f')](_0x28a570[_0xc35b('0x2c')][_0xc35b('0x2f')]));_0x3af57f[_0xc35b('0x2e')]=_0x3af57f[_0xc35b('0x2e')][_0xc35b('0x30')]?_0x3af57f[_0xc35b('0x2e')]:_0x517754[_0xc35b('0x2b')];_0x3af57f[_0xc35b('0x49')]=qs[_0xc35b('0x4a')](_0x28a570[_0xc35b('0x2c')]['sort']);_0x3af57f[_0xc35b('0x34')]=qs[_0xc35b('0x32')](_[_0xc35b('0x4b')](_0x28a570[_0xc35b('0x2c')],_0x517754['filters']));if(_0x28a570[_0xc35b('0x2c')]['filter']){_0x3af57f['where']=_[_0xc35b('0x36')](_0x3af57f[_0xc35b('0x34')],{'$or':_[_0xc35b('0x27')](_0x3af57f[_0xc35b('0x2e')],function(_0x36c26c){var _0x3871ff={};_0x3871ff[_0x36c26c]={'$like':'%'+_0x28a570[_0xc35b('0x2c')][_0xc35b('0x33')]+'%'};return _0x3871ff;})});}_0x3af57f=_[_0xc35b('0x36')]({},_0x3af57f,_0x28a570[_0xc35b('0x4c')]);return _0x3f1858[_0xc35b('0x46')](_0x3af57f);}})[_0xc35b('0x3c')](function(_0x5af880){if(_0x5af880){_0xca0814=_0x5af880['length'];if(!_0x28a570[_0xc35b('0x2c')][_0xc35b('0x4d')](_0xc35b('0x31'))){_0x3af57f[_0xc35b('0x1e')]=qs[_0xc35b('0x1e')](_0x28a570[_0xc35b('0x2c')][_0xc35b('0x1e')]);_0x3af57f[_0xc35b('0x1b')]=qs[_0xc35b('0x1b')](_0x28a570[_0xc35b('0x2c')][_0xc35b('0x1b')]);}return _0x3f1858[_0xc35b('0x46')](_0x3af57f);}})[_0xc35b('0x3c')](function(_0x8df892){if(_0x8df892){return _0x8df892?{'count':_0xca0814,'rows':_0x8df892}:null;}})['then'](respondWithResult(_0x16b3d1,null))[_0xc35b('0x3d')](handleError(_0x16b3d1,null));};exports[_0xc35b('0x4e')]=function(_0x403710,_0x3768cc,_0x136a62){var _0x1e0416={};var _0x47fc3f={};var _0x33a220;var _0x214382;return db[_0xc35b('0x37')][_0xc35b('0x47')]({'where':{'id':_0x403710['params']['id']}})[_0xc35b('0x3c')](handleEntityNotFound(_0x3768cc,null))[_0xc35b('0x3c')](function(_0x28ba41){if(_0x28ba41){_0x33a220=_0x28ba41;_0x47fc3f['model']=_['keys'](db['SugarcrmField']['rawAttributes']);_0x47fc3f[_0xc35b('0x2c')]=_[_0xc35b('0x2d')](_0x403710[_0xc35b('0x2c')]);_0x47fc3f[_0xc35b('0x32')]=_['intersection'](_0x47fc3f[_0xc35b('0x2b')],_0x47fc3f[_0xc35b('0x2c')]);_0x1e0416['attributes']=_[_0xc35b('0x40')](_0x47fc3f['model'],qs['fields'](_0x403710['query'][_0xc35b('0x2f')]));_0x1e0416['attributes']=_0x1e0416[_0xc35b('0x2e')][_0xc35b('0x30')]?_0x1e0416[_0xc35b('0x2e')]:_0x47fc3f[_0xc35b('0x2b')];_0x1e0416[_0xc35b('0x49')]=qs[_0xc35b('0x4a')](_0x403710[_0xc35b('0x2c')][_0xc35b('0x4a')]);_0x1e0416[_0xc35b('0x34')]=qs[_0xc35b('0x32')](_['pick'](_0x403710['query'],_0x47fc3f[_0xc35b('0x32')]));if(_0x403710[_0xc35b('0x2c')][_0xc35b('0x33')]){_0x1e0416['where']=_['merge'](_0x1e0416[_0xc35b('0x34')],{'$or':_['map'](_0x1e0416['attributes'],function(_0x8a7bf8){var _0x35439c={};_0x35439c[_0x8a7bf8]={'$like':'%'+_0x403710[_0xc35b('0x2c')]['filter']+'%'};return _0x35439c;})});}_0x1e0416=_[_0xc35b('0x36')]({},_0x1e0416,_0x403710[_0xc35b('0x4c')]);return _0x33a220['getSubjects'](_0x1e0416);}})['then'](function(_0x532a60){if(_0x532a60){_0x214382=_0x532a60[_0xc35b('0x30')];if(!_0x403710['query']['hasOwnProperty'](_0xc35b('0x31'))){_0x1e0416[_0xc35b('0x1e')]=qs['limit'](_0x403710[_0xc35b('0x2c')][_0xc35b('0x1e')]);_0x1e0416[_0xc35b('0x1b')]=qs['offset'](_0x403710[_0xc35b('0x2c')][_0xc35b('0x1b')]);}return _0x33a220['getSubjects'](_0x1e0416);}})['then'](function(_0x30276d){if(_0x30276d){return _0x30276d?{'count':_0x214382,'rows':_0x30276d}:null;}})[_0xc35b('0x3c')](respondWithResult(_0x3768cc,null))[_0xc35b('0x3d')](handleError(_0x3768cc,null));};exports[_0xc35b('0x4f')]=function(_0x35f042,_0x2bb7cc,_0x542023){var _0x4dfb07={};var _0x3cd80f={};var _0x76c88c;var _0x21f935;return db[_0xc35b('0x37')]['findOne']({'where':{'id':_0x35f042['params']['id']}})[_0xc35b('0x3c')](handleEntityNotFound(_0x2bb7cc,null))[_0xc35b('0x3c')](function(_0x3b327f){if(_0x3b327f){_0x76c88c=_0x3b327f;_0x3cd80f[_0xc35b('0x2b')]=_[_0xc35b('0x2d')](db['SugarcrmField'][_0xc35b('0x48')]);_0x3cd80f[_0xc35b('0x2c')]=_[_0xc35b('0x2d')](_0x35f042[_0xc35b('0x2c')]);_0x3cd80f['filters']=_[_0xc35b('0x40')](_0x3cd80f['model'],_0x3cd80f['query']);_0x4dfb07[_0xc35b('0x2e')]=_[_0xc35b('0x40')](_0x3cd80f['model'],qs[_0xc35b('0x2f')](_0x35f042['query'][_0xc35b('0x2f')]));_0x4dfb07[_0xc35b('0x2e')]=_0x4dfb07[_0xc35b('0x2e')][_0xc35b('0x30')]?_0x4dfb07[_0xc35b('0x2e')]:_0x3cd80f[_0xc35b('0x2b')];_0x4dfb07[_0xc35b('0x49')]=qs['sort'](_0x35f042[_0xc35b('0x2c')][_0xc35b('0x4a')]);_0x4dfb07[_0xc35b('0x34')]=qs['filters'](_['pick'](_0x35f042[_0xc35b('0x2c')],_0x3cd80f[_0xc35b('0x32')]));if(_0x35f042[_0xc35b('0x2c')]['filter']){_0x4dfb07[_0xc35b('0x34')]=_[_0xc35b('0x36')](_0x4dfb07['where'],{'$or':_[_0xc35b('0x27')](_0x4dfb07['attributes'],function(_0x2a4227){var _0x93326d={};_0x93326d[_0x2a4227]={'$like':'%'+_0x35f042['query'][_0xc35b('0x33')]+'%'};return _0x93326d;})});}_0x4dfb07=_['merge']({},_0x4dfb07,_0x35f042['options']);return _0x76c88c[_0xc35b('0x4f')](_0x4dfb07);}})[_0xc35b('0x3c')](function(_0x289aaa){if(_0x289aaa){_0x21f935=_0x289aaa['length'];if(!_0x35f042[_0xc35b('0x2c')][_0xc35b('0x4d')](_0xc35b('0x31'))){_0x4dfb07['limit']=qs[_0xc35b('0x1e')](_0x35f042['query'][_0xc35b('0x1e')]);_0x4dfb07[_0xc35b('0x1b')]=qs[_0xc35b('0x1b')](_0x35f042[_0xc35b('0x2c')][_0xc35b('0x1b')]);}return _0x76c88c[_0xc35b('0x4f')](_0x4dfb07);}})[_0xc35b('0x3c')](function(_0x20969f){if(_0x20969f){return _0x20969f?{'count':_0x21f935,'rows':_0x20969f}:null;}})['then'](respondWithResult(_0x2bb7cc,null))[_0xc35b('0x3d')](handleError(_0x2bb7cc,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 442704c..a3f4429 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 _0x21a7=['request-promise','rimraf','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment','bluebird'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0x21a7,0x15b));var _0x721a=function(_0x3a0174,_0x491d79){_0x3a0174=_0x3a0174-0x0;var _0x172be6=_0x21a7[_0x3a0174];return _0x172be6;};'use strict';var _=require(_0x721a('0x0'));var util=require(_0x721a('0x1'));var logger=require('../../config/logger')(_0x721a('0x2'));var moment=require(_0x721a('0x3'));var BPromise=require(_0x721a('0x4'));var rp=require(_0x721a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x721a('0x6'));var config=require('../../config/environment');var attributes=require(_0x721a('0x7'));module['exports']=function(_0x2e7966,_0x9bb7f0){return _0x2e7966[_0x721a('0x8')](_0x721a('0x9'),attributes,{'tableName':_0x721a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2d5=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','int_sugarcrm_configurations','lodash'];(function(_0x44c502,_0x47ee08){var _0x168c43=function(_0x4bcc47){while(--_0x4bcc47){_0x44c502['push'](_0x44c502['shift']());}};_0x168c43(++_0x47ee08);}(_0xa2d5,0xb3));var _0x5a2d=function(_0x2c0cf1,_0x17f242){_0x2c0cf1=_0x2c0cf1-0x0;var _0x3da711=_0xa2d5[_0x2c0cf1];return _0x3da711;};'use strict';var _=require(_0x5a2d('0x0'));var util=require(_0x5a2d('0x1'));var logger=require(_0x5a2d('0x2'))(_0x5a2d('0x3'));var moment=require(_0x5a2d('0x4'));var BPromise=require('bluebird');var rp=require(_0x5a2d('0x5'));var fs=require('fs');var path=require(_0x5a2d('0x6'));var rimraf=require(_0x5a2d('0x7'));var config=require(_0x5a2d('0x8'));var attributes=require(_0x5a2d('0x9'));module['exports']=function(_0x303389,_0x441bb9){return _0x303389[_0x5a2d('0xa')]('SugarcrmConfiguration',attributes,{'tableName':_0x5a2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index e34d6f8..7481bb7 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 _0x6641=['../../config/environment','jayson/promise','client','http','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1f7a28,_0x567352){var _0x3100f9=function(_0x287ea7){while(--_0x287ea7){_0x1f7a28['push'](_0x1f7a28['shift']());}};_0x3100f9(++_0x567352);}(_0x6641,0xc7));var _0x1664=function(_0x1cd82c,_0x45a949){_0x1cd82c=_0x1cd82c-0x0;var _0x478ffc=_0x6641[_0x1cd82c];return _0x478ffc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1664('0x0'));var BPromise=require(_0x1664('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1664('0x2'));var db=require(_0x1664('0x3'))['db'];var utils=require(_0x1664('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1664('0x5'));var jayson=require(_0x1664('0x6'));var client=jayson[_0x1664('0x7')][_0x1664('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x447725,_0x497500,_0x30785b){return new BPromise(function(_0xc0c6cb,_0x42bc90){return client['request'](_0x447725,_0x30785b)['then'](function(_0x2a36fb){logger[_0x1664('0x9')](_0x1664('0xa'),_0x497500,_0x1664('0xb'));logger[_0x1664('0xc')](_0x1664('0xd'),_0x497500,_0x1664('0xb'),JSON[_0x1664('0xe')](_0x2a36fb));if(_0x2a36fb[_0x1664('0xf')]){if(_0x2a36fb[_0x1664('0xf')]['code']===0x1f4){logger[_0x1664('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x497500,_0x2a36fb[_0x1664('0xf')][_0x1664('0x10')]);return _0x42bc90(_0x2a36fb[_0x1664('0xf')][_0x1664('0x10')]);}logger[_0x1664('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x497500,_0x2a36fb[_0x1664('0xf')][_0x1664('0x10')]);return _0xc0c6cb(_0x2a36fb[_0x1664('0xf')]['message']);}else{logger[_0x1664('0x9')](_0x1664('0xa'),_0x497500,_0x1664('0xb'));_0xc0c6cb(_0x2a36fb['result'][_0x1664('0x10')]);}})['catch'](function(_0x39e058){logger[_0x1664('0xf')](_0x1664('0xa'),_0x497500,_0x39e058);_0x42bc90(_0x39e058);});});} \ No newline at end of file +var _0x242f=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x218afc,_0x521c30){var _0x270351=function(_0x4a70e5){while(--_0x4a70e5){_0x218afc['push'](_0x218afc['shift']());}};_0x270351(++_0x521c30);}(_0x242f,0x165));var _0xf242=function(_0x136c26,_0x25b3e8){_0x136c26=_0x136c26-0x0;var _0x5f0a7a=_0x242f[_0x136c26];return _0x5f0a7a;};'use strict';var _=require(_0xf242('0x0'));var util=require(_0xf242('0x1'));var moment=require(_0xf242('0x2'));var BPromise=require(_0xf242('0x3'));var rs=require(_0xf242('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf242('0x5'));var logger=require(_0xf242('0x6'))(_0xf242('0x7'));var config=require(_0xf242('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf242('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8612f,_0x567be2,_0x289270){return new BPromise(function(_0xadcb25,_0x322248){return client[_0xf242('0xa')](_0x8612f,_0x289270)[_0xf242('0xb')](function(_0x143006){logger[_0xf242('0xc')](_0xf242('0xd'),_0x567be2,_0xf242('0xe'));logger['debug'](_0xf242('0xf'),_0x567be2,'request\x20sent',JSON[_0xf242('0x10')](_0x143006));if(_0x143006[_0xf242('0x11')]){if(_0x143006[_0xf242('0x11')][_0xf242('0x12')]===0x1f4){logger[_0xf242('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x567be2,_0x143006['error'][_0xf242('0x13')]);return _0x322248(_0x143006[_0xf242('0x11')][_0xf242('0x13')]);}logger[_0xf242('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x567be2,_0x143006[_0xf242('0x11')]['message']);return _0xadcb25(_0x143006[_0xf242('0x11')][_0xf242('0x13')]);}else{logger['info'](_0xf242('0xd'),_0x567be2,_0xf242('0xe'));_0xadcb25(_0x143006[_0xf242('0x14')][_0xf242('0x13')]);}})[_0xf242('0x15')](function(_0x2a532a){logger[_0xf242('0x11')](_0xf242('0xd'),_0x567be2,_0x2a532a);_0x322248(_0x2a532a);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 4a578cf..faad381 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 _0xc2bd=['show','post','create','update','delete','destroy','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id'];(function(_0x2b5466,_0x43fe49){var _0x4f6e42=function(_0x585504){while(--_0x585504){_0x2b5466['push'](_0x2b5466['shift']());}};_0x4f6e42(++_0x43fe49);}(_0xc2bd,0x84));var _0xdc2b=function(_0x4be21e,_0x37b832){_0x4be21e=_0x4be21e-0x0;var _0x5646b1=_0xc2bd[_0x4be21e];return _0x5646b1;};'use strict';var multer=require('multer');var util=require(_0xdc2b('0x0'));var path=require(_0xdc2b('0x1'));var timeout=require(_0xdc2b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xdc2b('0x3'));var auth=require(_0xdc2b('0x4'));var interaction=require(_0xdc2b('0x5'));var config=require(_0xdc2b('0x6'));var controller=require(_0xdc2b('0x7'));router[_0xdc2b('0x8')]('/',auth[_0xdc2b('0x9')](),controller[_0xdc2b('0xa')]);router[_0xdc2b('0x8')](_0xdc2b('0xb'),auth['isAuthenticated'](),controller[_0xdc2b('0xc')]);router[_0xdc2b('0xd')]('/',auth[_0xdc2b('0x9')](),controller[_0xdc2b('0xe')]);router['put'](_0xdc2b('0xb'),auth[_0xdc2b('0x9')](),controller[_0xdc2b('0xf')]);router[_0xdc2b('0x10')](_0xdc2b('0xb'),auth[_0xdc2b('0x9')](),controller[_0xdc2b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x3a7a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','util','path','connect-timeout'];(function(_0x184d22,_0x474c6b){var _0x14c85a=function(_0x5bb546){while(--_0x5bb546){_0x184d22['push'](_0x184d22['shift']());}};_0x14c85a(++_0x474c6b);}(_0x3a7a,0xf4));var _0xa3a7=function(_0x1e235e,_0x994b77){_0x1e235e=_0x1e235e-0x0;var _0x1e8e94=_0x3a7a[_0x1e235e];return _0x1e8e94;};'use strict';var multer=require('multer');var util=require(_0xa3a7('0x0'));var path=require(_0xa3a7('0x1'));var timeout=require(_0xa3a7('0x2'));var express=require(_0xa3a7('0x3'));var router=express[_0xa3a7('0x4')]();var fs_extra=require(_0xa3a7('0x5'));var auth=require(_0xa3a7('0x6'));var interaction=require(_0xa3a7('0x7'));var config=require(_0xa3a7('0x8'));var controller=require('./intSugarcrmField.controller');router[_0xa3a7('0x9')]('/',auth['isAuthenticated'](),controller[_0xa3a7('0xa')]);router[_0xa3a7('0x9')](_0xa3a7('0xb'),auth[_0xa3a7('0xc')](),controller[_0xa3a7('0xd')]);router[_0xa3a7('0xe')]('/',auth[_0xa3a7('0xc')](),controller[_0xa3a7('0xf')]);router[_0xa3a7('0x10')](_0xa3a7('0xb'),auth[_0xa3a7('0xc')](),controller[_0xa3a7('0x11')]);router[_0xa3a7('0x12')](_0xa3a7('0xb'),auth[_0xa3a7('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 4104e5c..0706337 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 _0x532c=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x5e2a90,_0x3c55bd){var _0x4e4254=function(_0x32665a){while(--_0x32665a){_0x5e2a90['push'](_0x5e2a90['shift']());}};_0x4e4254(++_0x3c55bd);}(_0x532c,0x135));var _0xc532=function(_0x2e9b61,_0x2120cf){_0x2e9b61=_0x2e9b61-0x0;var _0x597ccd=_0x532c[_0x2e9b61];return _0x597ccd;};'use strict';var Sequelize=require(_0xc532('0x0'));module[_0xc532('0x1')]={'type':{'type':Sequelize[_0xc532('0x2')](_0xc532('0x3'),_0xc532('0x4'),_0xc532('0x5'),_0xc532('0x6'),_0xc532('0x7')),'defaultValue':_0xc532('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc532('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xc532('0x3'),_0xc532('0x4'),_0xc532('0x5'))},'keyContent':{'type':Sequelize[_0xc532('0x8')]},'idField':{'type':Sequelize[_0xc532('0x8')]},'nameField':{'type':Sequelize[_0xc532('0x8')]},'customField':{'type':Sequelize[_0xc532('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc532('0x8')]}}; \ No newline at end of file +var _0xd018=['picklist','STRING','BOOLEAN','ENUM','string','variable','customVariable','keyValue'];(function(_0x231b7c,_0x51c47d){var _0x32f361=function(_0x1cbd4d){while(--_0x1cbd4d){_0x231b7c['push'](_0x231b7c['shift']());}};_0x32f361(++_0x51c47d);}(_0xd018,0xb3));var _0x8d01=function(_0xfc58,_0x1f3839){_0xfc58=_0xfc58-0x0;var _0x59fb78=_0xd018[_0xfc58];return _0x59fb78;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x8d01('0x0')](_0x8d01('0x1'),_0x8d01('0x2'),_0x8d01('0x3'),_0x8d01('0x4'),_0x8d01('0x5')),'defaultValue':_0x8d01('0x1')},'content':{'type':Sequelize[_0x8d01('0x6')]},'key':{'type':Sequelize[_0x8d01('0x6')]},'keyType':{'type':Sequelize[_0x8d01('0x0')](_0x8d01('0x1'),_0x8d01('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x8d01('0x6')]},'idField':{'type':Sequelize[_0x8d01('0x6')]},'nameField':{'type':Sequelize[_0x8d01('0x6')]},'customField':{'type':Sequelize[_0x8d01('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8d01('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 53c628f..4885800 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 _0x3db6=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','then','stack','send','index','map','SugarcrmField','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','rimraf','zip-dir','fast-json-patch'];(function(_0xc3a71f,_0x54fe71){var _0x46a474=function(_0x47e601){while(--_0x47e601){_0xc3a71f['push'](_0xc3a71f['shift']());}};_0x46a474(++_0x54fe71);}(_0x3db6,0x1d1));var _0x63db=function(_0x27ff1d,_0x3677c4){_0x27ff1d=_0x27ff1d-0x0;var _0x3c9001=_0x3db6[_0x27ff1d];return _0x3c9001;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63db('0x0'));var zipdir=require(_0x63db('0x1'));var jsonpatch=require(_0x63db('0x2'));var rp=require(_0x63db('0x3'));var moment=require(_0x63db('0x4'));var BPromise=require(_0x63db('0x5'));var Mustache=require(_0x63db('0x6'));var util=require(_0x63db('0x7'));var path=require(_0x63db('0x8'));var sox=require(_0x63db('0x9'));var csv=require(_0x63db('0xa'));var ejs=require(_0x63db('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x63db('0xc'));var crypto=require('crypto');var jsforce=require(_0x63db('0xd'));var deskjs=require(_0x63db('0xe'));var toCsv=require('to-csv');var querystring=require(_0x63db('0xf'));var Papa=require(_0x63db('0x10'));var Redis=require('ioredis');var authService=require(_0x63db('0x11'));var qs=require(_0x63db('0x12'));var as=require(_0x63db('0x13'));var hardwareService=require(_0x63db('0x14'));var logger=require(_0x63db('0x15'))(_0x63db('0x16'));var utils=require(_0x63db('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x63db('0x18'));var db=require(_0x63db('0x19'))['db'];function respondWithStatusCode(_0x5b3318,_0x16e331){_0x16e331=_0x16e331||0xcc;return function(_0x157b99){if(_0x157b99){return _0x5b3318[_0x63db('0x1a')](_0x16e331);}return _0x5b3318[_0x63db('0x1b')](_0x16e331)[_0x63db('0x1c')]();};}function respondWithResult(_0xb88454,_0x24e8cc){_0x24e8cc=_0x24e8cc||0xc8;return function(_0x4bb49b){if(_0x4bb49b){return _0xb88454[_0x63db('0x1b')](_0x24e8cc)['json'](_0x4bb49b);}};}function respondWithFilteredResult(_0x4be7e7,_0x3b0062){return function(_0x502fe0){if(_0x502fe0){var _0x4da00e=typeof _0x3b0062[_0x63db('0x1d')]===_0x63db('0x1e')&&typeof _0x3b0062['limit']===_0x63db('0x1e');var _0x3227a1=_0x502fe0['count'];var _0x25295e=_0x4da00e?0x0:_0x3b0062[_0x63db('0x1d')];var _0x514e60=_0x4da00e?_0x502fe0['count']:_0x3b0062[_0x63db('0x1d')]+_0x3b0062[_0x63db('0x1f')];var _0x157301;if(_0x514e60>=_0x3227a1){_0x514e60=_0x3227a1;_0x157301=0xc8;}else{_0x157301=0xce;}_0x4be7e7['status'](_0x157301);return _0x4be7e7[_0x63db('0x20')](_0x63db('0x21'),_0x25295e+'-'+_0x514e60+'/'+_0x3227a1)[_0x63db('0x22')](_0x502fe0);}return null;};}function patchUpdates(_0x205c6a){return function(_0x345a4d){try{jsonpatch[_0x63db('0x23')](_0x345a4d,_0x205c6a,!![]);}catch(_0x57e0b2){return BPromise['reject'](_0x57e0b2);}return _0x345a4d[_0x63db('0x24')]();};}function saveUpdates(_0x418025,_0x144a55){return function(_0x24b777){if(_0x24b777){return _0x24b777[_0x63db('0x25')](_0x418025)[_0x63db('0x26')](function(_0x56af34){return _0x56af34;});}return null;};}function removeEntity(_0x3fac83,_0x322440){return function(_0x1e768e){if(_0x1e768e){return _0x1e768e['destroy']()[_0x63db('0x26')](function(){_0x3fac83[_0x63db('0x1b')](0xcc)[_0x63db('0x1c')]();});}};}function handleEntityNotFound(_0x24b38b,_0x42d824){return function(_0x4dbcb5){if(!_0x4dbcb5){_0x24b38b['sendStatus'](0x194);}return _0x4dbcb5;};}function handleError(_0x26286d,_0x2c464a){_0x2c464a=_0x2c464a||0x1f4;return function(_0x591c7b){logger['error'](_0x591c7b[_0x63db('0x27')]);if(_0x591c7b['name']){delete _0x591c7b['name'];}_0x26286d[_0x63db('0x1b')](_0x2c464a)[_0x63db('0x28')](_0x591c7b);};}exports[_0x63db('0x29')]=function(_0x369463,_0x4ec855){var _0x530a10={},_0x5bebde={},_0x544aef={'count':0x0,'rows':[]};var _0x28ca6c=_[_0x63db('0x2a')](db[_0x63db('0x2b')][_0x63db('0x2c')],function(_0x5ea9e8){return{'name':_0x5ea9e8[_0x63db('0x2d')],'type':_0x5ea9e8[_0x63db('0x2e')][_0x63db('0x2f')]};});_0x5bebde[_0x63db('0x30')]=_[_0x63db('0x2a')](_0x28ca6c,_0x63db('0x31'));_0x5bebde[_0x63db('0x32')]=_[_0x63db('0x33')](_0x369463[_0x63db('0x32')]);_0x5bebde[_0x63db('0x34')]=_[_0x63db('0x35')](_0x5bebde[_0x63db('0x30')],_0x5bebde[_0x63db('0x32')]);_0x530a10['attributes']=_[_0x63db('0x35')](_0x5bebde[_0x63db('0x30')],qs[_0x63db('0x36')](_0x369463[_0x63db('0x32')]['fields']));_0x530a10[_0x63db('0x37')]=_0x530a10[_0x63db('0x37')][_0x63db('0x38')]?_0x530a10[_0x63db('0x37')]:_0x5bebde[_0x63db('0x30')];if(!_0x369463[_0x63db('0x32')][_0x63db('0x39')]('nolimit')){_0x530a10['limit']=qs[_0x63db('0x1f')](_0x369463[_0x63db('0x32')][_0x63db('0x1f')]);_0x530a10[_0x63db('0x1d')]=qs[_0x63db('0x1d')](_0x369463[_0x63db('0x32')][_0x63db('0x1d')]);}_0x530a10[_0x63db('0x3a')]=qs['sort'](_0x369463[_0x63db('0x32')][_0x63db('0x3b')]);_0x530a10['where']=qs[_0x63db('0x34')](_[_0x63db('0x3c')](_0x369463[_0x63db('0x32')],_0x5bebde['filters']),_0x28ca6c);if(_0x369463[_0x63db('0x32')][_0x63db('0x3d')]){_0x530a10[_0x63db('0x3e')]=_['merge'](_0x530a10[_0x63db('0x3e')],{'$or':_[_0x63db('0x2a')](_0x28ca6c,function(_0x5f3bd9){if(_0x5f3bd9[_0x63db('0x2e')]!==_0x63db('0x3f')){var _0x5e6bcc={};_0x5e6bcc[_0x5f3bd9['name']]={'$like':'%'+_0x369463[_0x63db('0x32')][_0x63db('0x3d')]+'%'};return _0x5e6bcc;}})});}_0x530a10=_[_0x63db('0x40')]({},_0x530a10,_0x369463[_0x63db('0x41')]);var _0x20f6c7={'where':_0x530a10['where']};return db[_0x63db('0x2b')][_0x63db('0x42')](_0x20f6c7)['then'](function(_0x3b7ea7){_0x544aef[_0x63db('0x42')]=_0x3b7ea7;if(_0x369463[_0x63db('0x32')][_0x63db('0x43')]){_0x530a10['include']=[{'all':!![]}];}return db[_0x63db('0x2b')][_0x63db('0x44')](_0x530a10);})['then'](function(_0x200821){_0x544aef[_0x63db('0x45')]=_0x200821;return _0x544aef;})[_0x63db('0x26')](respondWithFilteredResult(_0x4ec855,_0x530a10))[_0x63db('0x46')](handleError(_0x4ec855,null));};exports[_0x63db('0x47')]=function(_0x281202,_0x5998aa){var _0x4a42d6={'raw':!![],'where':{'id':_0x281202[_0x63db('0x48')]['id']}},_0x56cb8c={};_0x56cb8c[_0x63db('0x30')]=_[_0x63db('0x33')](db['SugarcrmField']['rawAttributes']);_0x56cb8c[_0x63db('0x32')]=_['keys'](_0x281202[_0x63db('0x32')]);_0x56cb8c['filters']=_[_0x63db('0x35')](_0x56cb8c[_0x63db('0x30')],_0x56cb8c[_0x63db('0x32')]);_0x4a42d6['attributes']=_[_0x63db('0x35')](_0x56cb8c[_0x63db('0x30')],qs[_0x63db('0x36')](_0x281202[_0x63db('0x32')][_0x63db('0x36')]));_0x4a42d6[_0x63db('0x37')]=_0x4a42d6['attributes'][_0x63db('0x38')]?_0x4a42d6['attributes']:_0x56cb8c[_0x63db('0x30')];if(_0x281202['query'][_0x63db('0x43')]){_0x4a42d6[_0x63db('0x49')]=[{'all':!![]}];}_0x4a42d6=_[_0x63db('0x40')]({},_0x4a42d6,_0x281202[_0x63db('0x41')]);return db[_0x63db('0x2b')][_0x63db('0x4a')](_0x4a42d6)[_0x63db('0x26')](handleEntityNotFound(_0x5998aa,null))[_0x63db('0x26')](respondWithResult(_0x5998aa,null))[_0x63db('0x46')](handleError(_0x5998aa,null));};exports[_0x63db('0x4b')]=function(_0x41a973,_0x57303b){return db[_0x63db('0x2b')][_0x63db('0x4b')](_0x41a973[_0x63db('0x4c')],{})['then'](respondWithResult(_0x57303b,0xc9))['catch'](handleError(_0x57303b,null));};exports[_0x63db('0x25')]=function(_0x46c011,_0x27f523){if(_0x46c011[_0x63db('0x4c')]['id']){delete _0x46c011[_0x63db('0x4c')]['id'];}return db[_0x63db('0x2b')][_0x63db('0x4a')]({'where':{'id':_0x46c011['params']['id']}})['then'](handleEntityNotFound(_0x27f523,null))[_0x63db('0x26')](saveUpdates(_0x46c011[_0x63db('0x4c')],null))[_0x63db('0x26')](respondWithResult(_0x27f523,null))[_0x63db('0x46')](handleError(_0x27f523,null));};exports[_0x63db('0x4d')]=function(_0x19d92b,_0x353bd0){return db[_0x63db('0x2b')][_0x63db('0x4a')]({'where':{'id':_0x19d92b[_0x63db('0x48')]['id']}})[_0x63db('0x26')](handleEntityNotFound(_0x353bd0,null))[_0x63db('0x26')](removeEntity(_0x353bd0,null))[_0x63db('0x46')](handleError(_0x353bd0,null));}; \ No newline at end of file +var _0xf367=['ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','filter','where','merge','VIRTUAL','include','findAll','catch','keys','SugarcrmField','includeAll','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf367,0x164));var _0x7f36=function(_0xf44fbd,_0x56527b){_0xf44fbd=_0xf44fbd-0x0;var _0x15e76c=_0xf367[_0xf44fbd];return _0x15e76c;};'use strict';var emlformat=require(_0x7f36('0x0'));var rimraf=require(_0x7f36('0x1'));var zipdir=require(_0x7f36('0x2'));var jsonpatch=require(_0x7f36('0x3'));var rp=require('request-promise');var moment=require(_0x7f36('0x4'));var BPromise=require(_0x7f36('0x5'));var Mustache=require(_0x7f36('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7f36('0x7'));var csv=require(_0x7f36('0x8'));var ejs=require(_0x7f36('0x9'));var fs=require('fs');var fs_extra=require(_0x7f36('0xa'));var _=require(_0x7f36('0xb'));var squel=require(_0x7f36('0xc'));var crypto=require(_0x7f36('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7f36('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7f36('0xf'));var Papa=require(_0x7f36('0x10'));var Redis=require('ioredis');var authService=require(_0x7f36('0x11'));var qs=require(_0x7f36('0x12'));var as=require(_0x7f36('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7f36('0x14'));var utils=require(_0x7f36('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7f36('0x16'));var db=require(_0x7f36('0x17'))['db'];function respondWithStatusCode(_0xb33dcb,_0x1146dd){_0x1146dd=_0x1146dd||0xcc;return function(_0x5d29e9){if(_0x5d29e9){return _0xb33dcb[_0x7f36('0x18')](_0x1146dd);}return _0xb33dcb[_0x7f36('0x19')](_0x1146dd)[_0x7f36('0x1a')]();};}function respondWithResult(_0x198d45,_0x1dc2e0){_0x1dc2e0=_0x1dc2e0||0xc8;return function(_0x52cbf5){if(_0x52cbf5){return _0x198d45[_0x7f36('0x19')](_0x1dc2e0)[_0x7f36('0x1b')](_0x52cbf5);}};}function respondWithFilteredResult(_0x43eea0,_0x1e6e14){return function(_0x52087b){if(_0x52087b){var _0x1c7f12=typeof _0x1e6e14['offset']===_0x7f36('0x1c')&&typeof _0x1e6e14['limit']===_0x7f36('0x1c');var _0x1a43b4=_0x52087b[_0x7f36('0x1d')];var _0x32cca7=_0x1c7f12?0x0:_0x1e6e14[_0x7f36('0x1e')];var _0x3d56ad=_0x1c7f12?_0x52087b[_0x7f36('0x1d')]:_0x1e6e14[_0x7f36('0x1e')]+_0x1e6e14[_0x7f36('0x1f')];var _0x83b0b4;if(_0x3d56ad>=_0x1a43b4){_0x3d56ad=_0x1a43b4;_0x83b0b4=0xc8;}else{_0x83b0b4=0xce;}_0x43eea0[_0x7f36('0x19')](_0x83b0b4);return _0x43eea0[_0x7f36('0x20')](_0x7f36('0x21'),_0x32cca7+'-'+_0x3d56ad+'/'+_0x1a43b4)[_0x7f36('0x1b')](_0x52087b);}return null;};}function patchUpdates(_0xe55283){return function(_0x18f427){try{jsonpatch[_0x7f36('0x22')](_0x18f427,_0xe55283,!![]);}catch(_0x296449){return BPromise[_0x7f36('0x23')](_0x296449);}return _0x18f427['save']();};}function saveUpdates(_0x281bba,_0xc493cb){return function(_0xa50fd3){if(_0xa50fd3){return _0xa50fd3[_0x7f36('0x24')](_0x281bba)[_0x7f36('0x25')](function(_0xe39711){return _0xe39711;});}return null;};}function removeEntity(_0x2b9fd0,_0x36aa66){return function(_0x20dc78){if(_0x20dc78){return _0x20dc78[_0x7f36('0x26')]()[_0x7f36('0x25')](function(){_0x2b9fd0[_0x7f36('0x19')](0xcc)[_0x7f36('0x1a')]();});}};}function handleEntityNotFound(_0x3eb724,_0x15a285){return function(_0x5841ab){if(!_0x5841ab){_0x3eb724[_0x7f36('0x18')](0x194);}return _0x5841ab;};}function handleError(_0x544420,_0x3b1644){_0x3b1644=_0x3b1644||0x1f4;return function(_0x4e380d){logger[_0x7f36('0x27')](_0x4e380d[_0x7f36('0x28')]);if(_0x4e380d[_0x7f36('0x29')]){delete _0x4e380d[_0x7f36('0x29')];}_0x544420[_0x7f36('0x19')](_0x3b1644)[_0x7f36('0x2a')](_0x4e380d);};}exports['index']=function(_0x34ac68,_0x1f8d48){var _0x3ea353={},_0x30b9b7={},_0x4bbc69={'count':0x0,'rows':[]};var _0xd9f720=_['map'](db['SugarcrmField'][_0x7f36('0x2b')],function(_0x3221cc){return{'name':_0x3221cc[_0x7f36('0x2c')],'type':_0x3221cc[_0x7f36('0x2d')][_0x7f36('0x2e')]};});_0x30b9b7[_0x7f36('0x2f')]=_[_0x7f36('0x30')](_0xd9f720,_0x7f36('0x29'));_0x30b9b7[_0x7f36('0x31')]=_['keys'](_0x34ac68[_0x7f36('0x31')]);_0x30b9b7[_0x7f36('0x32')]=_[_0x7f36('0x33')](_0x30b9b7[_0x7f36('0x2f')],_0x30b9b7[_0x7f36('0x31')]);_0x3ea353['attributes']=_['intersection'](_0x30b9b7[_0x7f36('0x2f')],qs[_0x7f36('0x34')](_0x34ac68['query'][_0x7f36('0x34')]));_0x3ea353['attributes']=_0x3ea353[_0x7f36('0x35')][_0x7f36('0x36')]?_0x3ea353[_0x7f36('0x35')]:_0x30b9b7[_0x7f36('0x2f')];if(!_0x34ac68[_0x7f36('0x31')]['hasOwnProperty'](_0x7f36('0x37'))){_0x3ea353[_0x7f36('0x1f')]=qs[_0x7f36('0x1f')](_0x34ac68['query']['limit']);_0x3ea353[_0x7f36('0x1e')]=qs[_0x7f36('0x1e')](_0x34ac68[_0x7f36('0x31')][_0x7f36('0x1e')]);}_0x3ea353[_0x7f36('0x38')]=qs['sort'](_0x34ac68[_0x7f36('0x31')][_0x7f36('0x39')]);_0x3ea353['where']=qs[_0x7f36('0x32')](_['pick'](_0x34ac68[_0x7f36('0x31')],_0x30b9b7[_0x7f36('0x32')]),_0xd9f720);if(_0x34ac68['query'][_0x7f36('0x3a')]){_0x3ea353[_0x7f36('0x3b')]=_[_0x7f36('0x3c')](_0x3ea353[_0x7f36('0x3b')],{'$or':_[_0x7f36('0x30')](_0xd9f720,function(_0x3ae446){if(_0x3ae446[_0x7f36('0x2d')]!==_0x7f36('0x3d')){var _0xd4be98={};_0xd4be98[_0x3ae446[_0x7f36('0x29')]]={'$like':'%'+_0x34ac68['query'][_0x7f36('0x3a')]+'%'};return _0xd4be98;}})});}_0x3ea353=_[_0x7f36('0x3c')]({},_0x3ea353,_0x34ac68['options']);var _0x91216b={'where':_0x3ea353[_0x7f36('0x3b')]};return db['SugarcrmField']['count'](_0x91216b)[_0x7f36('0x25')](function(_0x25ab78){_0x4bbc69[_0x7f36('0x1d')]=_0x25ab78;if(_0x34ac68['query']['includeAll']){_0x3ea353[_0x7f36('0x3e')]=[{'all':!![]}];}return db['SugarcrmField'][_0x7f36('0x3f')](_0x3ea353);})[_0x7f36('0x25')](function(_0x11a2d4){_0x4bbc69['rows']=_0x11a2d4;return _0x4bbc69;})['then'](respondWithFilteredResult(_0x1f8d48,_0x3ea353))[_0x7f36('0x40')](handleError(_0x1f8d48,null));};exports['show']=function(_0x21372f,_0x2dff87){var _0x55d7c6={'raw':!![],'where':{'id':_0x21372f['params']['id']}},_0x88fda7={};_0x88fda7[_0x7f36('0x2f')]=_[_0x7f36('0x41')](db[_0x7f36('0x42')]['rawAttributes']);_0x88fda7[_0x7f36('0x31')]=_[_0x7f36('0x41')](_0x21372f[_0x7f36('0x31')]);_0x88fda7['filters']=_[_0x7f36('0x33')](_0x88fda7[_0x7f36('0x2f')],_0x88fda7[_0x7f36('0x31')]);_0x55d7c6['attributes']=_[_0x7f36('0x33')](_0x88fda7['model'],qs[_0x7f36('0x34')](_0x21372f[_0x7f36('0x31')][_0x7f36('0x34')]));_0x55d7c6[_0x7f36('0x35')]=_0x55d7c6[_0x7f36('0x35')]['length']?_0x55d7c6[_0x7f36('0x35')]:_0x88fda7[_0x7f36('0x2f')];if(_0x21372f['query'][_0x7f36('0x43')]){_0x55d7c6[_0x7f36('0x3e')]=[{'all':!![]}];}_0x55d7c6=_[_0x7f36('0x3c')]({},_0x55d7c6,_0x21372f[_0x7f36('0x44')]);return db[_0x7f36('0x42')][_0x7f36('0x45')](_0x55d7c6)[_0x7f36('0x25')](handleEntityNotFound(_0x2dff87,null))[_0x7f36('0x25')](respondWithResult(_0x2dff87,null))[_0x7f36('0x40')](handleError(_0x2dff87,null));};exports[_0x7f36('0x46')]=function(_0x407fb8,_0x8cf32c){return db[_0x7f36('0x42')][_0x7f36('0x46')](_0x407fb8['body'],{})['then'](respondWithResult(_0x8cf32c,0xc9))[_0x7f36('0x40')](handleError(_0x8cf32c,null));};exports[_0x7f36('0x24')]=function(_0x3ad57f,_0xf0c102){if(_0x3ad57f[_0x7f36('0x47')]['id']){delete _0x3ad57f[_0x7f36('0x47')]['id'];}return db['SugarcrmField']['find']({'where':{'id':_0x3ad57f[_0x7f36('0x48')]['id']}})[_0x7f36('0x25')](handleEntityNotFound(_0xf0c102,null))['then'](saveUpdates(_0x3ad57f[_0x7f36('0x47')],null))['then'](respondWithResult(_0xf0c102,null))[_0x7f36('0x40')](handleError(_0xf0c102,null));};exports['destroy']=function(_0x4dbd61,_0xa1ff7f){return db[_0x7f36('0x42')][_0x7f36('0x45')]({'where':{'id':_0x4dbd61['params']['id']}})[_0x7f36('0x25')](handleEntityNotFound(_0xa1ff7f,null))[_0x7f36('0x25')](removeEntity(_0xa1ff7f,null))[_0x7f36('0x40')](handleError(_0xa1ff7f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index a559fb1..d4417cd 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 _0x456c=['request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0x31a11d,_0xec04ae){var _0x3e4228=function(_0x159406){while(--_0x159406){_0x31a11d['push'](_0x31a11d['shift']());}};_0x3e4228(++_0xec04ae);}(_0x456c,0x1eb));var _0xc456=function(_0xfc444f,_0x5281c7){_0xfc444f=_0xfc444f-0x0;var _0x126d39=_0x456c[_0xfc444f];return _0x126d39;};'use strict';var _=require('lodash');var util=require(_0xc456('0x0'));var logger=require(_0xc456('0x1'))(_0xc456('0x2'));var moment=require(_0xc456('0x3'));var BPromise=require(_0xc456('0x4'));var rp=require(_0xc456('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc456('0x6'));var config=require(_0xc456('0x7'));var attributes=require(_0xc456('0x8'));module[_0xc456('0x9')]=function(_0xb22fac,_0x38f425){return _0xb22fac[_0xc456('0xa')](_0xc456('0xb'),attributes,{'tableName':_0xc456('0xc'),'paranoid':![],'indexes':[{'name':_0xc456('0xd'),'fields':[_0xc456('0xe'),_0xc456('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabc9=['bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0xabc9,0x168));var _0x9abc=function(_0x2c42e7,_0x5d9746){_0x2c42e7=_0x2c42e7-0x0;var _0x2bee3=_0xabc9[_0x2c42e7];return _0x2bee3;};'use strict';var _=require(_0x9abc('0x0'));var util=require(_0x9abc('0x1'));var logger=require(_0x9abc('0x2'))(_0x9abc('0x3'));var moment=require('moment');var BPromise=require(_0x9abc('0x4'));var rp=require(_0x9abc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9abc('0x6'));var config=require(_0x9abc('0x7'));var attributes=require(_0x9abc('0x8'));module[_0x9abc('0x9')]=function(_0x461b46,_0x290124){return _0x461b46['define']('SugarcrmField',attributes,{'tableName':_0x9abc('0xa'),'paranoid':![],'indexes':[{'name':_0x9abc('0xb'),'fields':['idField',_0x9abc('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 2bf471f..f298143 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 _0xa675=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x2f9dca,_0x5af184){var _0x280455=function(_0x5b2cb4){while(--_0x5b2cb4){_0x2f9dca['push'](_0x2f9dca['shift']());}};_0x280455(++_0x5af184);}(_0xa675,0x15a));var _0x5a67=function(_0xb7bd46,_0x941298){_0xb7bd46=_0xb7bd46-0x0;var _0x2abe45=_0xa675[_0xb7bd46];return _0x2abe45;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5a67('0x0'));var BPromise=require(_0x5a67('0x1'));var rs=require(_0x5a67('0x2'));var fs=require('fs');var Redis=require(_0x5a67('0x3'));var db=require(_0x5a67('0x4'))['db'];var utils=require(_0x5a67('0x5'));var logger=require(_0x5a67('0x6'))(_0x5a67('0x7'));var config=require(_0x5a67('0x8'));var jayson=require(_0x5a67('0x9'));var client=jayson[_0x5a67('0xa')][_0x5a67('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12c9da,_0x59e359,_0x518c0f){return new BPromise(function(_0x272acb,_0x5c43c0){return client['request'](_0x12c9da,_0x518c0f)[_0x5a67('0xc')](function(_0x1cad46){logger[_0x5a67('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x59e359,'request\x20sent');logger[_0x5a67('0xe')](_0x5a67('0xf'),_0x59e359,_0x5a67('0x10'),JSON[_0x5a67('0x11')](_0x1cad46));if(_0x1cad46[_0x5a67('0x12')]){if(_0x1cad46['error'][_0x5a67('0x13')]===0x1f4){logger['error'](_0x5a67('0x14'),_0x59e359,_0x1cad46['error']['message']);return _0x5c43c0(_0x1cad46[_0x5a67('0x12')][_0x5a67('0x15')]);}logger[_0x5a67('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x59e359,_0x1cad46[_0x5a67('0x12')][_0x5a67('0x15')]);return _0x272acb(_0x1cad46[_0x5a67('0x12')][_0x5a67('0x15')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x59e359,_0x5a67('0x10'));_0x272acb(_0x1cad46[_0x5a67('0x16')][_0x5a67('0x15')]);}})[_0x5a67('0x17')](function(_0x4cc12e){logger[_0x5a67('0x12')](_0x5a67('0x14'),_0x59e359,_0x4cc12e);_0x5c43c0(_0x4cc12e);});});} \ No newline at end of file +var _0xa410=['client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x812ab2,_0x30fabf){var _0x3cafe7=function(_0x51d0d4){while(--_0x51d0d4){_0x812ab2['push'](_0x812ab2['shift']());}};_0x3cafe7(++_0x30fabf);}(_0xa410,0x80));var _0x0a41=function(_0xad4e69,_0xb441f5){_0xad4e69=_0xad4e69-0x0;var _0x36dacf=_0xa410[_0xad4e69];return _0x36dacf;};'use strict';var _=require(_0x0a41('0x0'));var util=require(_0x0a41('0x1'));var moment=require(_0x0a41('0x2'));var BPromise=require(_0x0a41('0x3'));var rs=require(_0x0a41('0x4'));var fs=require('fs');var Redis=require(_0x0a41('0x5'));var db=require(_0x0a41('0x6'))['db'];var utils=require(_0x0a41('0x7'));var logger=require(_0x0a41('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0a41('0x9'));var client=jayson[_0x0a41('0xa')][_0x0a41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1fad34,_0x203911,_0x5257a6){return new BPromise(function(_0x1d2942,_0x24295e){return client[_0x0a41('0xc')](_0x1fad34,_0x5257a6)[_0x0a41('0xd')](function(_0x26ed5f){logger['info'](_0x0a41('0xe'),_0x203911,_0x0a41('0xf'));logger['debug'](_0x0a41('0x10'),_0x203911,_0x0a41('0xf'),JSON[_0x0a41('0x11')](_0x26ed5f));if(_0x26ed5f['error']){if(_0x26ed5f[_0x0a41('0x12')][_0x0a41('0x13')]===0x1f4){logger['error'](_0x0a41('0xe'),_0x203911,_0x26ed5f[_0x0a41('0x12')][_0x0a41('0x14')]);return _0x24295e(_0x26ed5f[_0x0a41('0x12')][_0x0a41('0x14')]);}logger[_0x0a41('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x203911,_0x26ed5f[_0x0a41('0x12')][_0x0a41('0x14')]);return _0x1d2942(_0x26ed5f[_0x0a41('0x12')]['message']);}else{logger[_0x0a41('0x15')](_0x0a41('0xe'),_0x203911,_0x0a41('0xf'));_0x1d2942(_0x26ed5f['result']['message']);}})[_0x0a41('0x16')](function(_0x10c202){logger[_0x0a41('0x12')](_0x0a41('0xe'),_0x203911,_0x10c202);_0x24295e(_0x10c202);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 1486723..a8cbcf8 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 _0x3f49=['exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','update','destroy'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x3f49,0x11f));var _0x93f4=function(_0xf93dd5,_0x2a7126){_0xf93dd5=_0xf93dd5-0x0;var _0x95b5eb=_0x3f49[_0xf93dd5];return _0x95b5eb;};'use strict';var multer=require(_0x93f4('0x0'));var util=require(_0x93f4('0x1'));var path=require('path');var timeout=require(_0x93f4('0x2'));var express=require(_0x93f4('0x3'));var router=express[_0x93f4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x93f4('0x5'));var interaction=require(_0x93f4('0x6'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router[_0x93f4('0x7')]('/',auth[_0x93f4('0x8')](),controller[_0x93f4('0x9')]);router['get'](_0x93f4('0xa'),auth['isAuthenticated'](),controller[_0x93f4('0xb')]);router[_0x93f4('0x7')](_0x93f4('0xc'),auth[_0x93f4('0x8')](),controller[_0x93f4('0xd')]);router[_0x93f4('0x7')](_0x93f4('0xe'),auth[_0x93f4('0x8')](),controller['getFields']);router['post']('/',auth[_0x93f4('0x8')](),controller[_0x93f4('0xf')]);router[_0x93f4('0x10')](_0x93f4('0xc'),auth[_0x93f4('0x8')](),controller[_0x93f4('0x11')]);router[_0x93f4('0x12')](_0x93f4('0xa'),auth['isAuthenticated'](),controller[_0x93f4('0x13')]);router['delete']('/:id',auth[_0x93f4('0x8')](),controller[_0x93f4('0x14')]);module[_0x93f4('0x15')]=router; \ No newline at end of file +var _0xa198=['/:id/configurations','/:id/fields','post','create','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','isAuthenticated'];(function(_0x1bfff6,_0xccc94b){var _0x57de72=function(_0x59097e){while(--_0x59097e){_0x1bfff6['push'](_0x1bfff6['shift']());}};_0x57de72(++_0xccc94b);}(_0xa198,0x7f));var _0x8a19=function(_0x4064ab,_0x53675b){_0x4064ab=_0x4064ab-0x0;var _0x212fe0=_0xa198[_0x4064ab];return _0x212fe0;};'use strict';var multer=require(_0x8a19('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8a19('0x1'));var express=require(_0x8a19('0x2'));var router=express[_0x8a19('0x3')]();var fs_extra=require(_0x8a19('0x4'));var auth=require(_0x8a19('0x5'));var interaction=require(_0x8a19('0x6'));var config=require(_0x8a19('0x7'));var controller=require(_0x8a19('0x8'));router[_0x8a19('0x9')]('/',auth['isAuthenticated'](),controller[_0x8a19('0xa')]);router['get'](_0x8a19('0xb'),auth[_0x8a19('0xc')](),controller['show']);router[_0x8a19('0x9')](_0x8a19('0xd'),auth[_0x8a19('0xc')](),controller['getConfigurations']);router[_0x8a19('0x9')](_0x8a19('0xe'),auth[_0x8a19('0xc')](),controller['getFields']);router[_0x8a19('0xf')]('/',auth['isAuthenticated'](),controller[_0x8a19('0x10')]);router[_0x8a19('0xf')](_0x8a19('0xd'),auth[_0x8a19('0xc')](),controller['addConfiguration']);router['put'](_0x8a19('0xb'),auth[_0x8a19('0xc')](),controller['update']);router[_0x8a19('0x11')](_0x8a19('0xb'),auth[_0x8a19('0xc')](),controller[_0x8a19('0x12')]);module[_0x8a19('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index ed47ce0..581af3c 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 _0xaecb=['exports','STRING','HelpDesk','sequelize'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xaecb,0xdf));var _0xbaec=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaecb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xbaec('0x0'));module[_0xbaec('0x1')]={'name':{'type':Sequelize[_0xbaec('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xbaec('0x2')],'allowNull':![],'defaultValue':_0xbaec('0x3')},'remoteUri':{'type':Sequelize[_0xbaec('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xbaec('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x06cc=['sequelize','exports','STRING','HelpDesk'];(function(_0x449a38,_0x3f8271){var _0x38a415=function(_0x261b53){while(--_0x261b53){_0x449a38['push'](_0x449a38['shift']());}};_0x38a415(++_0x3f8271);}(_0x06cc,0x174));var _0xc06c=function(_0x2b457f,_0x162ce7){_0x2b457f=_0x2b457f-0x0;var _0x48cf56=_0x06cc[_0x2b457f];return _0x48cf56;};'use strict';var Sequelize=require(_0xc06c('0x0'));module[_0xc06c('0x1')]={'name':{'type':Sequelize[_0xc06c('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc06c('0x2')],'allowNull':![],'defaultValue':_0xc06c('0x3')},'remoteUri':{'type':Sequelize[_0xc06c('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xc06c('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc06c('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 7830eb5..81f6bd7 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 _0x8b7b=['rows','catch','show','params','include','find','create','body','destroy','getConfigurations','findOne','VtigerConfiguration','rawAttributes','order','addConfiguration','AccountId','Descriptions','getDescriptions','channel','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','%s/webservice.php','success','POST','login','result','token','GET','sessionName','autogenerated','reference','owner','remove','includes','false','length','label','picklist','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','sendStatus','error','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','VtigerAccount','includeAll','findAll'];(function(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0x8b7b,0xab));var _0xb8b7=function(_0x2a54eb,_0x703a20){_0x2a54eb=_0x2a54eb-0x0;var _0x540796=_0x8b7b[_0x2a54eb];return _0x540796;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb8b7('0x0'));var zipdir=require(_0xb8b7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8b7('0x2'));var moment=require(_0xb8b7('0x3'));var BPromise=require(_0xb8b7('0x4'));var Mustache=require(_0xb8b7('0x5'));var util=require(_0xb8b7('0x6'));var path=require('path');var sox=require(_0xb8b7('0x7'));var csv=require(_0xb8b7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb8b7('0x9'));var _=require(_0xb8b7('0xa'));var squel=require(_0xb8b7('0xb'));var crypto=require(_0xb8b7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb8b7('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb8b7('0xe'));var Papa=require(_0xb8b7('0xf'));var Redis=require(_0xb8b7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb8b7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb8b7('0x12'));var logger=require(_0xb8b7('0x13'))(_0xb8b7('0x14'));var utils=require(_0xb8b7('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb8b7('0x16'))['db'];var integrations=require(_0xb8b7('0x17'));function respondWithStatusCode(_0x201976,_0x1ea651){_0x1ea651=_0x1ea651||0xcc;return function(_0x392c18){if(_0x392c18){return _0x201976['sendStatus'](_0x1ea651);}return _0x201976[_0xb8b7('0x18')](_0x1ea651)[_0xb8b7('0x19')]();};}function respondWithResult(_0x5ef053,_0xcd452e){_0xcd452e=_0xcd452e||0xc8;return function(_0x1026df){if(_0x1026df){return _0x5ef053['status'](_0xcd452e)[_0xb8b7('0x1a')](_0x1026df);}};}function respondWithFilteredResult(_0x1dafee,_0x2b946c){return function(_0x2a67e3){if(_0x2a67e3){var _0x30af75=typeof _0x2b946c[_0xb8b7('0x1b')]==='undefined'&&typeof _0x2b946c[_0xb8b7('0x1c')]===_0xb8b7('0x1d');var _0xd97876=_0x2a67e3['count'];var _0x58aac7=_0x30af75?0x0:_0x2b946c[_0xb8b7('0x1b')];var _0x579799=_0x30af75?_0x2a67e3[_0xb8b7('0x1e')]:_0x2b946c[_0xb8b7('0x1b')]+_0x2b946c[_0xb8b7('0x1c')];var _0x427422;if(_0x579799>=_0xd97876){_0x579799=_0xd97876;_0x427422=0xc8;}else{_0x427422=0xce;}_0x1dafee[_0xb8b7('0x18')](_0x427422);return _0x1dafee[_0xb8b7('0x1f')]('Content-Range',_0x58aac7+'-'+_0x579799+'/'+_0xd97876)[_0xb8b7('0x1a')](_0x2a67e3);}return null;};}function patchUpdates(_0x3d8c18){return function(_0xbcb96b){try{jsonpatch['apply'](_0xbcb96b,_0x3d8c18,!![]);}catch(_0x16d20b){return BPromise[_0xb8b7('0x20')](_0x16d20b);}return _0xbcb96b[_0xb8b7('0x21')]();};}function saveUpdates(_0x4de4b3,_0x5ccf27){return function(_0x31b9c0){if(_0x31b9c0){return _0x31b9c0[_0xb8b7('0x22')](_0x4de4b3)[_0xb8b7('0x23')](function(_0x4ddea0){return _0x4ddea0;});}return null;};}function removeEntity(_0x17252d,_0x4711b4){return function(_0x426509){if(_0x426509){return _0x426509['destroy']()['then'](function(){_0x17252d['status'](0xcc)[_0xb8b7('0x19')]();});}};}function handleEntityNotFound(_0x502283,_0x4d78ed){return function(_0xd0c6de){if(!_0xd0c6de){_0x502283[_0xb8b7('0x24')](0x194);}return _0xd0c6de;};}function handleError(_0xe0e23a,_0x32f31d){_0x32f31d=_0x32f31d||0x1f4;return function(_0x1ce952){logger[_0xb8b7('0x25')](_0x1ce952['stack']);if(_0x1ce952['name']){delete _0x1ce952[_0xb8b7('0x26')];}_0xe0e23a[_0xb8b7('0x18')](_0x32f31d)[_0xb8b7('0x27')](_0x1ce952);};}exports['index']=function(_0x35ee9f,_0x3be6d6){var _0x5d58f6={},_0x13cbae={},_0x2e4059={'count':0x0,'rows':[]};var _0xbd9d1d=_[_0xb8b7('0x28')](db['VtigerAccount']['rawAttributes'],function(_0x5d3c47){return{'name':_0x5d3c47[_0xb8b7('0x29')],'type':_0x5d3c47[_0xb8b7('0x2a')][_0xb8b7('0x2b')]};});_0x13cbae[_0xb8b7('0x2c')]=_[_0xb8b7('0x28')](_0xbd9d1d,_0xb8b7('0x26'));_0x13cbae[_0xb8b7('0x2d')]=_[_0xb8b7('0x2e')](_0x35ee9f['query']);_0x13cbae[_0xb8b7('0x2f')]=_[_0xb8b7('0x30')](_0x13cbae[_0xb8b7('0x2c')],_0x13cbae[_0xb8b7('0x2d')]);_0x5d58f6[_0xb8b7('0x31')]=_['intersection'](_0x13cbae[_0xb8b7('0x2c')],qs[_0xb8b7('0x32')](_0x35ee9f[_0xb8b7('0x2d')][_0xb8b7('0x32')]));_0x5d58f6['attributes']=_0x5d58f6[_0xb8b7('0x31')]['length']?_0x5d58f6[_0xb8b7('0x31')]:_0x13cbae[_0xb8b7('0x2c')];if(!_0x35ee9f['query'][_0xb8b7('0x33')](_0xb8b7('0x34'))){_0x5d58f6[_0xb8b7('0x1c')]=qs[_0xb8b7('0x1c')](_0x35ee9f[_0xb8b7('0x2d')][_0xb8b7('0x1c')]);_0x5d58f6[_0xb8b7('0x1b')]=qs['offset'](_0x35ee9f[_0xb8b7('0x2d')][_0xb8b7('0x1b')]);}_0x5d58f6['order']=qs[_0xb8b7('0x35')](_0x35ee9f['query'][_0xb8b7('0x35')]);_0x5d58f6[_0xb8b7('0x36')]=qs['filters'](_[_0xb8b7('0x37')](_0x35ee9f[_0xb8b7('0x2d')],_0x13cbae[_0xb8b7('0x2f')]),_0xbd9d1d);if(_0x35ee9f[_0xb8b7('0x2d')][_0xb8b7('0x38')]){_0x5d58f6['where']=_['merge'](_0x5d58f6[_0xb8b7('0x36')],{'$or':_['map'](_0xbd9d1d,function(_0x4b094a){if(_0x4b094a[_0xb8b7('0x2a')]!==_0xb8b7('0x39')){var _0x3aa0e2={};_0x3aa0e2[_0x4b094a[_0xb8b7('0x26')]]={'$like':'%'+_0x35ee9f[_0xb8b7('0x2d')][_0xb8b7('0x38')]+'%'};return _0x3aa0e2;}})});}_0x5d58f6=_[_0xb8b7('0x3a')]({},_0x5d58f6,_0x35ee9f[_0xb8b7('0x3b')]);var _0x482b42={'where':_0x5d58f6[_0xb8b7('0x36')]};return db[_0xb8b7('0x3c')]['count'](_0x482b42)[_0xb8b7('0x23')](function(_0x51bf22){_0x2e4059['count']=_0x51bf22;if(_0x35ee9f[_0xb8b7('0x2d')][_0xb8b7('0x3d')]){_0x5d58f6['include']=[{'all':!![]}];}return db[_0xb8b7('0x3c')][_0xb8b7('0x3e')](_0x5d58f6);})[_0xb8b7('0x23')](function(_0x49b888){_0x2e4059[_0xb8b7('0x3f')]=_0x49b888;return _0x2e4059;})[_0xb8b7('0x23')](respondWithFilteredResult(_0x3be6d6,_0x5d58f6))[_0xb8b7('0x40')](handleError(_0x3be6d6,null));};exports[_0xb8b7('0x41')]=function(_0x254b61,_0x47bfb7){var _0x5c8f51={'raw':![],'where':{'id':_0x254b61[_0xb8b7('0x42')]['id']}},_0x37076d={};_0x37076d[_0xb8b7('0x2c')]=_[_0xb8b7('0x2e')](db[_0xb8b7('0x3c')]['rawAttributes']);_0x37076d[_0xb8b7('0x2d')]=_[_0xb8b7('0x2e')](_0x254b61[_0xb8b7('0x2d')]);_0x37076d[_0xb8b7('0x2f')]=_[_0xb8b7('0x30')](_0x37076d[_0xb8b7('0x2c')],_0x37076d[_0xb8b7('0x2d')]);_0x5c8f51[_0xb8b7('0x31')]=_[_0xb8b7('0x30')](_0x37076d[_0xb8b7('0x2c')],qs[_0xb8b7('0x32')](_0x254b61[_0xb8b7('0x2d')][_0xb8b7('0x32')]));_0x5c8f51[_0xb8b7('0x31')]=_0x5c8f51[_0xb8b7('0x31')]['length']?_0x5c8f51[_0xb8b7('0x31')]:_0x37076d['model'];if(_0x254b61['query'][_0xb8b7('0x3d')]){_0x5c8f51[_0xb8b7('0x43')]=[{'all':!![]}];}_0x5c8f51=_['merge']({},_0x5c8f51,_0x254b61[_0xb8b7('0x3b')]);return db[_0xb8b7('0x3c')][_0xb8b7('0x44')](_0x5c8f51)['then'](handleEntityNotFound(_0x47bfb7,null))['then'](respondWithResult(_0x47bfb7,null))['catch'](handleError(_0x47bfb7,null));};exports['create']=function(_0x43a6cb,_0x5410f7){return db['VtigerAccount'][_0xb8b7('0x45')](_0x43a6cb[_0xb8b7('0x46')],{})['then'](respondWithResult(_0x5410f7,0xc9))[_0xb8b7('0x40')](handleError(_0x5410f7,null));};exports[_0xb8b7('0x22')]=function(_0x12843e,_0xb6b803){if(_0x12843e[_0xb8b7('0x46')]['id']){delete _0x12843e[_0xb8b7('0x46')]['id'];}return db[_0xb8b7('0x3c')][_0xb8b7('0x44')]({'where':{'id':_0x12843e[_0xb8b7('0x42')]['id']}})[_0xb8b7('0x23')](handleEntityNotFound(_0xb6b803,null))[_0xb8b7('0x23')](saveUpdates(_0x12843e['body'],null))['then'](respondWithResult(_0xb6b803,null))[_0xb8b7('0x40')](handleError(_0xb6b803,null));};exports[_0xb8b7('0x47')]=function(_0x20df79,_0x33a85e){return db['VtigerAccount'][_0xb8b7('0x44')]({'where':{'id':_0x20df79[_0xb8b7('0x42')]['id']}})[_0xb8b7('0x23')](handleEntityNotFound(_0x33a85e,null))['then'](removeEntity(_0x33a85e,null))['catch'](handleError(_0x33a85e,null));};exports[_0xb8b7('0x48')]=function(_0x2c22cc,_0x13c4ed,_0x49707b){var _0x36fcb7={};var _0x5c55c4={};var _0x4f9e7a;var _0x2e441c;return db[_0xb8b7('0x3c')][_0xb8b7('0x49')]({'where':{'id':_0x2c22cc[_0xb8b7('0x42')]['id']}})['then'](handleEntityNotFound(_0x13c4ed,null))[_0xb8b7('0x23')](function(_0x387e10){if(_0x387e10){_0x4f9e7a=_0x387e10;_0x5c55c4['model']=_['keys'](db[_0xb8b7('0x4a')][_0xb8b7('0x4b')]);_0x5c55c4[_0xb8b7('0x2d')]=_[_0xb8b7('0x2e')](_0x2c22cc[_0xb8b7('0x2d')]);_0x5c55c4[_0xb8b7('0x2f')]=_[_0xb8b7('0x30')](_0x5c55c4[_0xb8b7('0x2c')],_0x5c55c4['query']);_0x36fcb7[_0xb8b7('0x31')]=_[_0xb8b7('0x30')](_0x5c55c4[_0xb8b7('0x2c')],qs[_0xb8b7('0x32')](_0x2c22cc[_0xb8b7('0x2d')][_0xb8b7('0x32')]));_0x36fcb7[_0xb8b7('0x31')]=_0x36fcb7[_0xb8b7('0x31')]['length']?_0x36fcb7['attributes']:_0x5c55c4[_0xb8b7('0x2c')];_0x36fcb7[_0xb8b7('0x4c')]=qs[_0xb8b7('0x35')](_0x2c22cc[_0xb8b7('0x2d')][_0xb8b7('0x35')]);_0x36fcb7[_0xb8b7('0x36')]=qs[_0xb8b7('0x2f')](_[_0xb8b7('0x37')](_0x2c22cc[_0xb8b7('0x2d')],_0x5c55c4[_0xb8b7('0x2f')]));if(_0x2c22cc[_0xb8b7('0x2d')][_0xb8b7('0x38')]){_0x36fcb7[_0xb8b7('0x36')]=_[_0xb8b7('0x3a')](_0x36fcb7[_0xb8b7('0x36')],{'$or':_['map'](_0x36fcb7['attributes'],function(_0x5657c4){var _0x5b25b9={};_0x5b25b9[_0x5657c4]={'$like':'%'+_0x2c22cc['query'][_0xb8b7('0x38')]+'%'};return _0x5b25b9;})});}_0x36fcb7=_['merge']({},_0x36fcb7,_0x2c22cc[_0xb8b7('0x3b')]);return _0x4f9e7a['getConfigurations'](_0x36fcb7);}})[_0xb8b7('0x23')](function(_0x437bca){if(_0x437bca){_0x2e441c=_0x437bca['length'];if(!_0x2c22cc[_0xb8b7('0x2d')][_0xb8b7('0x33')](_0xb8b7('0x34'))){_0x36fcb7[_0xb8b7('0x1c')]=qs[_0xb8b7('0x1c')](_0x2c22cc[_0xb8b7('0x2d')][_0xb8b7('0x1c')]);_0x36fcb7['offset']=qs[_0xb8b7('0x1b')](_0x2c22cc['query'][_0xb8b7('0x1b')]);}return _0x4f9e7a[_0xb8b7('0x48')](_0x36fcb7);}})['then'](function(_0x1c4a4c){if(_0x1c4a4c){return _0x1c4a4c?{'count':_0x2e441c,'rows':_0x1c4a4c}:null;}})[_0xb8b7('0x23')](respondWithResult(_0x13c4ed,null))[_0xb8b7('0x40')](handleError(_0x13c4ed,null));};exports[_0xb8b7('0x4d')]=function(_0x6d471a,_0x14cc6d,_0x40cb1e){if(_0x6d471a['body']['id']){delete _0x6d471a[_0xb8b7('0x46')]['id'];}return db[_0xb8b7('0x3c')]['findOne']({'where':{'id':_0x6d471a['params']['id']}})[_0xb8b7('0x23')](handleEntityNotFound(_0x14cc6d,null))[_0xb8b7('0x23')](function(_0x50b778){if(_0x50b778){_0x6d471a['body'][_0xb8b7('0x4e')]=_0x50b778['id'];_0x6d471a[_0xb8b7('0x46')]['Subjects']=integrations['getSubjects'](_0x6d471a['body']['channel'],_0x6d471a[_0xb8b7('0x46')][_0xb8b7('0x2a')]);_0x6d471a[_0xb8b7('0x46')][_0xb8b7('0x4f')]=integrations[_0xb8b7('0x50')](_0x6d471a[_0xb8b7('0x46')][_0xb8b7('0x51')],_0x6d471a[_0xb8b7('0x46')]['type']);return db[_0xb8b7('0x4a')]['create'](_0x6d471a[_0xb8b7('0x46')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db['VtigerField'],'as':_0xb8b7('0x4f')}]});}return null;})['then'](respondWithResult(_0x14cc6d,null))[_0xb8b7('0x40')](handleError(_0x14cc6d,null));};var md5=require(_0xb8b7('0x52'));exports[_0xb8b7('0x53')]=function(_0x2f7f1d,_0x591efd,_0x92b244){var _0x29e2fc=null;var _0x21d73d=null;var _0x569e84=null;var _0x1b0d5e=null;var _0x4bb7d2='';return db[_0xb8b7('0x3c')][_0xb8b7('0x49')]({'where':{'id':_0x2f7f1d[_0xb8b7('0x42')]['id']},'attributes':['id',_0xb8b7('0x26'),_0xb8b7('0x54'),_0xb8b7('0x55'),_0xb8b7('0x56'),_0xb8b7('0x57'),_0xb8b7('0x58'),_0xb8b7('0x59')]})['then'](handleEntityNotFound(_0x591efd,null))[_0xb8b7('0x23')](function(_0x562cbe){if(_0x562cbe){_0x29e2fc=_0x562cbe[_0xb8b7('0x54')];_0x21d73d=_0x562cbe[_0xb8b7('0x59')];_0x569e84=_0x562cbe[_0xb8b7('0x56')];_0x4bb7d2=_0x562cbe[_0xb8b7('0x57')];var _0x3bc41f=_0x4bb7d2[_0xb8b7('0x5a')](-0x1);if(_0x3bc41f==='/'){_0x4bb7d2=_0x4bb7d2[_0xb8b7('0x5b')](0x0,_0x4bb7d2['lastIndexOf'](_0x3bc41f));}_0x1b0d5e=util['format'](_0xb8b7('0x5c'),_0x4bb7d2);var _0x116cb2={'method':'GET','uri':_0x1b0d5e,'qs':{'operation':'getchallenge','username':_0x562cbe[_0xb8b7('0x54')]},'json':!![]};return rp(_0x116cb2);}})[_0xb8b7('0x23')](function(_0x19b8c9){if(_0x19b8c9[_0xb8b7('0x5d')]){var _0x3e2f45={'method':_0xb8b7('0x5e'),'uri':_0x1b0d5e,'form':{'operation':_0xb8b7('0x5f'),'username':_0x29e2fc,'accessKey':md5(_0x19b8c9[_0xb8b7('0x60')][_0xb8b7('0x61')]+_0x21d73d)},'json':!![]};return rp(_0x3e2f45);}})[_0xb8b7('0x23')](function(_0x4aaa71){if(_0x4aaa71['success']){var _0x525b21={'method':_0xb8b7('0x62'),'uri':_0x1b0d5e,'qs':{'operation':'describe','username':_0x29e2fc,'sessionName':_0x4aaa71[_0xb8b7('0x60')][_0xb8b7('0x63')],'elementType':_0x569e84},'json':!![]};return rp(_0x525b21);}})[_0xb8b7('0x23')](function(_0x1f660b){if(_0x1f660b[_0xb8b7('0x5d')]){var _0x520ac5=[_0xb8b7('0x64'),_0xb8b7('0x65'),_0xb8b7('0x66')];_[_0xb8b7('0x67')](_0x1f660b[_0xb8b7('0x60')][_0xb8b7('0x32')],function(_0x45d805){return _0x520ac5[_0xb8b7('0x68')](_0x45d805[_0xb8b7('0x2a')][_0xb8b7('0x26')]);});_[_0xb8b7('0x67')](_0x1f660b[_0xb8b7('0x60')][_0xb8b7('0x32')],function(_0xc1af0){return _0xc1af0['editable']===_0xb8b7('0x69');});return{'count':_0x1f660b[_0xb8b7('0x60')][_0xb8b7('0x32')][_0xb8b7('0x6a')],'rows':_['map'](_0x1f660b[_0xb8b7('0x60')][_0xb8b7('0x32')],function(_0x34e7eb){return{'id':_0x34e7eb[_0xb8b7('0x26')],'name':_0x34e7eb[_0xb8b7('0x6b')],'custom':_['startsWith'](_0x34e7eb[_0xb8b7('0x26')],'cf_')?!![]:![],'options':_0x34e7eb[_0xb8b7('0x2a')][_0xb8b7('0x26')]===_0xb8b7('0x6c')&&_0x34e7eb[_0xb8b7('0x2a')]['picklistValues'][_0xb8b7('0x6a')]>0x0?_['map'](_0x34e7eb[_0xb8b7('0x2a')]['picklistValues'],function(_0x11416a){return{'name':_0x11416a[_0xb8b7('0x6b')],'value':_0x11416a[_0xb8b7('0x6d')]};}):[]};})};}})['then'](respondWithResult(_0x591efd,null))['catch'](function(_0x149ffd){console[_0xb8b7('0x6e')](_0xb8b7('0x6f')+_0x149ffd);var _0x2fdad4=_0x2f7f1d[_0xb8b7('0x2d')][_0xb8b7('0x70')]?0x1f4:_0x149ffd['statusCode']||0x1f4;logger[_0xb8b7('0x25')](_0xb8b7('0x71'),'getFields',_0x2fdad4,JSON[_0xb8b7('0x72')](_0x149ffd));delete _0x149ffd['name'];if(_0x2fdad4===0x191){_0x2fdad4=0x190;}_0x591efd[_0xb8b7('0x18')](_0x2fdad4)[_0xb8b7('0x27')](_0x2f7f1d[_0xb8b7('0x2d')]['test']?{'message':_0xb8b7('0x73'),'statusCode':_0x149ffd[_0xb8b7('0x74')]}:_0x149ffd);});}; \ No newline at end of file +var _0xe24c=['slice','substring','lastIndexOf','format','getchallenge','success','POST','result','token','GET','describe','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','apply','save','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','find','create','body','catch','update','params','getConfigurations','findOne','VtigerConfiguration','order','pick','nolimit','AccountId','getSubjects','channel','type','Descriptions','getDescriptions','VtigerField','Subjects','md5','getFields','moduleName','serverUrl','accessKey','username','remoteUri'];(function(_0x2977c5,_0x30c9e9){var _0x23d9e2=function(_0x3194e2){while(--_0x3194e2){_0x2977c5['push'](_0x2977c5['shift']());}};_0x23d9e2(++_0x30c9e9);}(_0xe24c,0x94));var _0xce24=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe24c[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xce24('0x0'));var rimraf=require(_0xce24('0x1'));var zipdir=require(_0xce24('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xce24('0x3'));var moment=require(_0xce24('0x4'));var BPromise=require(_0xce24('0x5'));var Mustache=require('mustache');var util=require(_0xce24('0x6'));var path=require(_0xce24('0x7'));var sox=require(_0xce24('0x8'));var csv=require(_0xce24('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce24('0xa'));var squel=require('squel');var crypto=require(_0xce24('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xce24('0xc'));var toCsv=require(_0xce24('0x9'));var querystring=require(_0xce24('0xd'));var Papa=require(_0xce24('0xe'));var Redis=require('ioredis');var authService=require(_0xce24('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce24('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xce24('0x11'));var config=require(_0xce24('0x12'));var licenseUtil=require(_0xce24('0x13'));var db=require(_0xce24('0x14'))['db'];var integrations=require(_0xce24('0x15'));function respondWithStatusCode(_0x59d9fc,_0x1d3eb0){_0x1d3eb0=_0x1d3eb0||0xcc;return function(_0x2e052b){if(_0x2e052b){return _0x59d9fc['sendStatus'](_0x1d3eb0);}return _0x59d9fc[_0xce24('0x16')](_0x1d3eb0)[_0xce24('0x17')]();};}function respondWithResult(_0x4d05f1,_0x43cab3){_0x43cab3=_0x43cab3||0xc8;return function(_0x1310e2){if(_0x1310e2){return _0x4d05f1[_0xce24('0x16')](_0x43cab3)[_0xce24('0x18')](_0x1310e2);}};}function respondWithFilteredResult(_0x32dac2,_0x4dc7e9){return function(_0x54dcfa){if(_0x54dcfa){var _0x44cd07=typeof _0x4dc7e9[_0xce24('0x19')]===_0xce24('0x1a')&&typeof _0x4dc7e9[_0xce24('0x1b')]===_0xce24('0x1a');var _0x1bd281=_0x54dcfa['count'];var _0x1e5561=_0x44cd07?0x0:_0x4dc7e9[_0xce24('0x19')];var _0xc07bc0=_0x44cd07?_0x54dcfa[_0xce24('0x1c')]:_0x4dc7e9[_0xce24('0x19')]+_0x4dc7e9['limit'];var _0x2ed25a;if(_0xc07bc0>=_0x1bd281){_0xc07bc0=_0x1bd281;_0x2ed25a=0xc8;}else{_0x2ed25a=0xce;}_0x32dac2[_0xce24('0x16')](_0x2ed25a);return _0x32dac2[_0xce24('0x1d')]('Content-Range',_0x1e5561+'-'+_0xc07bc0+'/'+_0x1bd281)['json'](_0x54dcfa);}return null;};}function patchUpdates(_0x5649b4){return function(_0x4c0f1b){try{jsonpatch[_0xce24('0x1e')](_0x4c0f1b,_0x5649b4,!![]);}catch(_0x1009b6){return BPromise['reject'](_0x1009b6);}return _0x4c0f1b[_0xce24('0x1f')]();};}function saveUpdates(_0x2a1fe9,_0x3cbfdc){return function(_0x1ea24e){if(_0x1ea24e){return _0x1ea24e['update'](_0x2a1fe9)[_0xce24('0x20')](function(_0x230066){return _0x230066;});}return null;};}function removeEntity(_0x400231,_0x1a547a){return function(_0x2eec32){if(_0x2eec32){return _0x2eec32['destroy']()['then'](function(){_0x400231[_0xce24('0x16')](0xcc)[_0xce24('0x17')]();});}};}function handleEntityNotFound(_0x25028c,_0x5c4140){return function(_0x200650){if(!_0x200650){_0x25028c['sendStatus'](0x194);}return _0x200650;};}function handleError(_0x2a0b3a,_0x28dff1){_0x28dff1=_0x28dff1||0x1f4;return function(_0x28a2c8){logger[_0xce24('0x21')](_0x28a2c8[_0xce24('0x22')]);if(_0x28a2c8[_0xce24('0x23')]){delete _0x28a2c8[_0xce24('0x23')];}_0x2a0b3a[_0xce24('0x16')](_0x28dff1)[_0xce24('0x24')](_0x28a2c8);};}exports[_0xce24('0x25')]=function(_0x152a51,_0x5a4a02){var _0x4004af={},_0x9237c8={},_0xe2c972={'count':0x0,'rows':[]};var _0x358308=_[_0xce24('0x26')](db[_0xce24('0x27')][_0xce24('0x28')],function(_0x2fa048){return{'name':_0x2fa048[_0xce24('0x29')],'type':_0x2fa048['type']['key']};});_0x9237c8[_0xce24('0x2a')]=_[_0xce24('0x26')](_0x358308,_0xce24('0x23'));_0x9237c8['query']=_[_0xce24('0x2b')](_0x152a51['query']);_0x9237c8[_0xce24('0x2c')]=_[_0xce24('0x2d')](_0x9237c8[_0xce24('0x2a')],_0x9237c8[_0xce24('0x2e')]);_0x4004af['attributes']=_[_0xce24('0x2d')](_0x9237c8[_0xce24('0x2a')],qs[_0xce24('0x2f')](_0x152a51[_0xce24('0x2e')][_0xce24('0x2f')]));_0x4004af[_0xce24('0x30')]=_0x4004af['attributes'][_0xce24('0x31')]?_0x4004af[_0xce24('0x30')]:_0x9237c8['model'];if(!_0x152a51['query'][_0xce24('0x32')]('nolimit')){_0x4004af[_0xce24('0x1b')]=qs[_0xce24('0x1b')](_0x152a51[_0xce24('0x2e')][_0xce24('0x1b')]);_0x4004af[_0xce24('0x19')]=qs[_0xce24('0x19')](_0x152a51['query']['offset']);}_0x4004af['order']=qs['sort'](_0x152a51[_0xce24('0x2e')][_0xce24('0x33')]);_0x4004af['where']=qs[_0xce24('0x2c')](_['pick'](_0x152a51[_0xce24('0x2e')],_0x9237c8[_0xce24('0x2c')]),_0x358308);if(_0x152a51[_0xce24('0x2e')]['filter']){_0x4004af[_0xce24('0x34')]=_[_0xce24('0x35')](_0x4004af[_0xce24('0x34')],{'$or':_['map'](_0x358308,function(_0x1c3878){if(_0x1c3878['type']!==_0xce24('0x36')){var _0x19bca7={};_0x19bca7[_0x1c3878[_0xce24('0x23')]]={'$like':'%'+_0x152a51[_0xce24('0x2e')][_0xce24('0x37')]+'%'};return _0x19bca7;}})});}_0x4004af=_[_0xce24('0x35')]({},_0x4004af,_0x152a51[_0xce24('0x38')]);var _0x790e95={'where':_0x4004af[_0xce24('0x34')]};return db[_0xce24('0x27')][_0xce24('0x1c')](_0x790e95)[_0xce24('0x20')](function(_0xd8e073){_0xe2c972[_0xce24('0x1c')]=_0xd8e073;if(_0x152a51[_0xce24('0x2e')][_0xce24('0x39')]){_0x4004af[_0xce24('0x3a')]=[{'all':!![]}];}return db[_0xce24('0x27')][_0xce24('0x3b')](_0x4004af);})[_0xce24('0x20')](function(_0x1af1a6){_0xe2c972[_0xce24('0x3c')]=_0x1af1a6;return _0xe2c972;})[_0xce24('0x20')](respondWithFilteredResult(_0x5a4a02,_0x4004af))['catch'](handleError(_0x5a4a02,null));};exports['show']=function(_0x3e3f97,_0x11722f){var _0x1e9144={'raw':![],'where':{'id':_0x3e3f97['params']['id']}},_0x3fc2d9={};_0x3fc2d9[_0xce24('0x2a')]=_[_0xce24('0x2b')](db['VtigerAccount'][_0xce24('0x28')]);_0x3fc2d9[_0xce24('0x2e')]=_[_0xce24('0x2b')](_0x3e3f97[_0xce24('0x2e')]);_0x3fc2d9[_0xce24('0x2c')]=_[_0xce24('0x2d')](_0x3fc2d9['model'],_0x3fc2d9[_0xce24('0x2e')]);_0x1e9144[_0xce24('0x30')]=_[_0xce24('0x2d')](_0x3fc2d9['model'],qs['fields'](_0x3e3f97[_0xce24('0x2e')][_0xce24('0x2f')]));_0x1e9144[_0xce24('0x30')]=_0x1e9144[_0xce24('0x30')][_0xce24('0x31')]?_0x1e9144['attributes']:_0x3fc2d9['model'];if(_0x3e3f97[_0xce24('0x2e')]['includeAll']){_0x1e9144[_0xce24('0x3a')]=[{'all':!![]}];}_0x1e9144=_[_0xce24('0x35')]({},_0x1e9144,_0x3e3f97[_0xce24('0x38')]);return db[_0xce24('0x27')][_0xce24('0x3d')](_0x1e9144)['then'](handleEntityNotFound(_0x11722f,null))[_0xce24('0x20')](respondWithResult(_0x11722f,null))['catch'](handleError(_0x11722f,null));};exports[_0xce24('0x3e')]=function(_0x1bd4ef,_0x40f2a4){return db[_0xce24('0x27')][_0xce24('0x3e')](_0x1bd4ef[_0xce24('0x3f')],{})[_0xce24('0x20')](respondWithResult(_0x40f2a4,0xc9))[_0xce24('0x40')](handleError(_0x40f2a4,null));};exports[_0xce24('0x41')]=function(_0x5b73b2,_0x5b3a8e){if(_0x5b73b2[_0xce24('0x3f')]['id']){delete _0x5b73b2[_0xce24('0x3f')]['id'];}return db[_0xce24('0x27')][_0xce24('0x3d')]({'where':{'id':_0x5b73b2['params']['id']}})['then'](handleEntityNotFound(_0x5b3a8e,null))[_0xce24('0x20')](saveUpdates(_0x5b73b2['body'],null))[_0xce24('0x20')](respondWithResult(_0x5b3a8e,null))[_0xce24('0x40')](handleError(_0x5b3a8e,null));};exports['destroy']=function(_0x142152,_0x1f0b5a){return db[_0xce24('0x27')]['find']({'where':{'id':_0x142152[_0xce24('0x42')]['id']}})[_0xce24('0x20')](handleEntityNotFound(_0x1f0b5a,null))[_0xce24('0x20')](removeEntity(_0x1f0b5a,null))[_0xce24('0x40')](handleError(_0x1f0b5a,null));};exports[_0xce24('0x43')]=function(_0x30b863,_0x904535,_0x1c5c86){var _0x83a364={};var _0x5a8182={};var _0x3dd25e;var _0x453e16;return db[_0xce24('0x27')][_0xce24('0x44')]({'where':{'id':_0x30b863[_0xce24('0x42')]['id']}})[_0xce24('0x20')](handleEntityNotFound(_0x904535,null))[_0xce24('0x20')](function(_0x3916bd){if(_0x3916bd){_0x3dd25e=_0x3916bd;_0x5a8182['model']=_[_0xce24('0x2b')](db[_0xce24('0x45')][_0xce24('0x28')]);_0x5a8182[_0xce24('0x2e')]=_['keys'](_0x30b863[_0xce24('0x2e')]);_0x5a8182[_0xce24('0x2c')]=_[_0xce24('0x2d')](_0x5a8182[_0xce24('0x2a')],_0x5a8182[_0xce24('0x2e')]);_0x83a364[_0xce24('0x30')]=_[_0xce24('0x2d')](_0x5a8182[_0xce24('0x2a')],qs['fields'](_0x30b863['query']['fields']));_0x83a364[_0xce24('0x30')]=_0x83a364['attributes']['length']?_0x83a364['attributes']:_0x5a8182[_0xce24('0x2a')];_0x83a364[_0xce24('0x46')]=qs[_0xce24('0x33')](_0x30b863[_0xce24('0x2e')][_0xce24('0x33')]);_0x83a364['where']=qs[_0xce24('0x2c')](_[_0xce24('0x47')](_0x30b863[_0xce24('0x2e')],_0x5a8182[_0xce24('0x2c')]));if(_0x30b863[_0xce24('0x2e')]['filter']){_0x83a364[_0xce24('0x34')]=_[_0xce24('0x35')](_0x83a364[_0xce24('0x34')],{'$or':_[_0xce24('0x26')](_0x83a364[_0xce24('0x30')],function(_0x343b4c){var _0x224b11={};_0x224b11[_0x343b4c]={'$like':'%'+_0x30b863[_0xce24('0x2e')][_0xce24('0x37')]+'%'};return _0x224b11;})});}_0x83a364=_['merge']({},_0x83a364,_0x30b863[_0xce24('0x38')]);return _0x3dd25e[_0xce24('0x43')](_0x83a364);}})[_0xce24('0x20')](function(_0x1ce38b){if(_0x1ce38b){_0x453e16=_0x1ce38b[_0xce24('0x31')];if(!_0x30b863['query'][_0xce24('0x32')](_0xce24('0x48'))){_0x83a364[_0xce24('0x1b')]=qs[_0xce24('0x1b')](_0x30b863[_0xce24('0x2e')]['limit']);_0x83a364[_0xce24('0x19')]=qs[_0xce24('0x19')](_0x30b863[_0xce24('0x2e')]['offset']);}return _0x3dd25e[_0xce24('0x43')](_0x83a364);}})['then'](function(_0x1cb78b){if(_0x1cb78b){return _0x1cb78b?{'count':_0x453e16,'rows':_0x1cb78b}:null;}})[_0xce24('0x20')](respondWithResult(_0x904535,null))[_0xce24('0x40')](handleError(_0x904535,null));};exports['addConfiguration']=function(_0x564390,_0x436196,_0x3e4167){if(_0x564390['body']['id']){delete _0x564390[_0xce24('0x3f')]['id'];}return db[_0xce24('0x27')]['findOne']({'where':{'id':_0x564390['params']['id']}})[_0xce24('0x20')](handleEntityNotFound(_0x436196,null))[_0xce24('0x20')](function(_0x55dd89){if(_0x55dd89){_0x564390[_0xce24('0x3f')][_0xce24('0x49')]=_0x55dd89['id'];_0x564390['body']['Subjects']=integrations[_0xce24('0x4a')](_0x564390[_0xce24('0x3f')][_0xce24('0x4b')],_0x564390[_0xce24('0x3f')][_0xce24('0x4c')]);_0x564390[_0xce24('0x3f')][_0xce24('0x4d')]=integrations[_0xce24('0x4e')](_0x564390['body']['channel'],_0x564390[_0xce24('0x3f')][_0xce24('0x4c')]);return db[_0xce24('0x45')][_0xce24('0x3e')](_0x564390[_0xce24('0x3f')],{'include':[{'model':db[_0xce24('0x4f')],'as':_0xce24('0x50')},{'model':db[_0xce24('0x4f')],'as':_0xce24('0x4d')}]});}return null;})[_0xce24('0x20')](respondWithResult(_0x436196,null))[_0xce24('0x40')](handleError(_0x436196,null));};var md5=require(_0xce24('0x51'));exports[_0xce24('0x52')]=function(_0x52a252,_0x5215f4,_0xfae3b7){var _0x18cae4=null;var _0x54d4b4=null;var _0x2569d1=null;var _0xbe97dc=null;var _0x39e705='';return db[_0xce24('0x27')]['findOne']({'where':{'id':_0x52a252[_0xce24('0x42')]['id']},'attributes':['id',_0xce24('0x23'),'username','description',_0xce24('0x53'),'remoteUri',_0xce24('0x54'),_0xce24('0x55')]})[_0xce24('0x20')](handleEntityNotFound(_0x5215f4,null))[_0xce24('0x20')](function(_0x274539){if(_0x274539){_0x18cae4=_0x274539[_0xce24('0x56')];_0x54d4b4=_0x274539['accessKey'];_0x2569d1=_0x274539[_0xce24('0x53')];_0x39e705=_0x274539[_0xce24('0x57')];var _0x45a59d=_0x39e705[_0xce24('0x58')](-0x1);if(_0x45a59d==='/'){_0x39e705=_0x39e705[_0xce24('0x59')](0x0,_0x39e705[_0xce24('0x5a')](_0x45a59d));}_0xbe97dc=util[_0xce24('0x5b')]('%s/webservice.php',_0x39e705);var _0x1987e1={'method':'GET','uri':_0xbe97dc,'qs':{'operation':_0xce24('0x5c'),'username':_0x274539[_0xce24('0x56')]},'json':!![]};return rp(_0x1987e1);}})['then'](function(_0x51e62e){if(_0x51e62e[_0xce24('0x5d')]){var _0x4c07e2={'method':_0xce24('0x5e'),'uri':_0xbe97dc,'form':{'operation':'login','username':_0x18cae4,'accessKey':md5(_0x51e62e[_0xce24('0x5f')][_0xce24('0x60')]+_0x54d4b4)},'json':!![]};return rp(_0x4c07e2);}})[_0xce24('0x20')](function(_0x4536b3){if(_0x4536b3[_0xce24('0x5d')]){var _0x4955c7={'method':_0xce24('0x61'),'uri':_0xbe97dc,'qs':{'operation':_0xce24('0x62'),'username':_0x18cae4,'sessionName':_0x4536b3['result']['sessionName'],'elementType':_0x2569d1},'json':!![]};return rp(_0x4955c7);}})[_0xce24('0x20')](function(_0x50ee9f){if(_0x50ee9f[_0xce24('0x5d')]){var _0x3e7a4c=[_0xce24('0x63'),_0xce24('0x64'),_0xce24('0x65')];_[_0xce24('0x66')](_0x50ee9f['result'][_0xce24('0x2f')],function(_0xc4020){return _0x3e7a4c[_0xce24('0x67')](_0xc4020[_0xce24('0x4c')][_0xce24('0x23')]);});_[_0xce24('0x66')](_0x50ee9f[_0xce24('0x5f')][_0xce24('0x2f')],function(_0x50c0bf){return _0x50c0bf[_0xce24('0x68')]===_0xce24('0x69');});return{'count':_0x50ee9f[_0xce24('0x5f')][_0xce24('0x2f')][_0xce24('0x31')],'rows':_[_0xce24('0x26')](_0x50ee9f['result'][_0xce24('0x2f')],function(_0x3cdf7f){return{'id':_0x3cdf7f[_0xce24('0x23')],'name':_0x3cdf7f[_0xce24('0x6a')],'custom':_[_0xce24('0x6b')](_0x3cdf7f['name'],_0xce24('0x6c'))?!![]:![],'options':_0x3cdf7f[_0xce24('0x4c')][_0xce24('0x23')]===_0xce24('0x6d')&&_0x3cdf7f[_0xce24('0x4c')]['picklistValues'][_0xce24('0x31')]>0x0?_['map'](_0x3cdf7f['type'][_0xce24('0x6e')],function(_0x1577b0){return{'name':_0x1577b0[_0xce24('0x6a')],'value':_0x1577b0[_0xce24('0x6f')]};}):[]};})};}})[_0xce24('0x20')](respondWithResult(_0x5215f4,null))[_0xce24('0x40')](function(_0x1c020a){console['log'](_0xce24('0x70')+_0x1c020a);var _0x32bc56=_0x52a252[_0xce24('0x2e')][_0xce24('0x71')]?0x1f4:_0x1c020a[_0xce24('0x72')]||0x1f4;logger[_0xce24('0x21')](_0xce24('0x73'),_0xce24('0x52'),_0x32bc56,JSON[_0xce24('0x74')](_0x1c020a));delete _0x1c020a[_0xce24('0x23')];if(_0x32bc56===0x191){_0x32bc56=0x190;}_0x5215f4[_0xce24('0x16')](_0x32bc56)[_0xce24('0x24')](_0x52a252['query']['test']?{'message':_0xce24('0x75'),'statusCode':_0x1c020a[_0xce24('0x72')]}:_0x1c020a);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 5414320..2e81ce9 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 _0x00de=['VtigerAccount','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0x00de,0x12d));var _0xe00d=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x00de[_0x1cb18a];return _0x22442e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe00d('0x0'))(_0xe00d('0x1'));var moment=require(_0xe00d('0x2'));var BPromise=require(_0xe00d('0x3'));var rp=require(_0xe00d('0x4'));var fs=require('fs');var path=require(_0xe00d('0x5'));var rimraf=require('rimraf');var config=require(_0xe00d('0x6'));var attributes=require(_0xe00d('0x7'));var integrations=require(_0xe00d('0x8'));module[_0xe00d('0x9')]=function(_0x53af05,_0x599c01){return _0x53af05[_0xe00d('0xa')](_0xe00d('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8ece=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x825094,_0x3d36fc){var _0x1e0b68=function(_0x5cf5b0){while(--_0x5cf5b0){_0x825094['push'](_0x825094['shift']());}};_0x1e0b68(++_0x3d36fc);}(_0x8ece,0xbd));var _0xe8ec=function(_0x2fadb7,_0x4e1a79){_0x2fadb7=_0x2fadb7-0x0;var _0x39634c=_0x8ece[_0x2fadb7];return _0x39634c;};'use strict';var _=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var logger=require(_0xe8ec('0x2'))('api');var moment=require(_0xe8ec('0x3'));var BPromise=require(_0xe8ec('0x4'));var rp=require(_0xe8ec('0x5'));var fs=require('fs');var path=require(_0xe8ec('0x6'));var rimraf=require(_0xe8ec('0x7'));var config=require(_0xe8ec('0x8'));var attributes=require(_0xe8ec('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4bc835,_0x293798){return _0x4bc835['define'](_0xe8ec('0xa'),attributes,{'tableName':_0xe8ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 5ce36b7..f444405 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 _0xee5b=['map','model','attributes','catch','ShowVtigerAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','include'];(function(_0x4febcd,_0x141f0c){var _0x253421=function(_0x4768dc){while(--_0x4768dc){_0x4febcd['push'](_0x4febcd['shift']());}};_0x253421(++_0x141f0c);}(_0xee5b,0x1f4));var _0xbee5=function(_0x25cba5,_0x4e1d0f){_0x25cba5=_0x25cba5-0x0;var _0x2e9a08=_0xee5b[_0x25cba5];return _0x2e9a08;};'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')]('VtigerAccount,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});}exports[_0xbee5('0x15')]=function(_0x538460){var _0x11b4a3=this;return new Promise(function(_0x3c3f4e,_0x35eb5c){return db[_0xbee5('0x16')][_0xbee5('0x17')]({'raw':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')]['attributes']||null:null,'limit':_0x538460['options']?_0x538460[_0xbee5('0x18')]['limit']||null:null,'include':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')],function(_0x359ccf){return{'model':db[_0x359ccf[_0xbee5('0x1d')]],'as':_0x359ccf['as'],'attributes':_0x359ccf[_0xbee5('0x1e')],'include':_0x359ccf['include']?_['map'](_0x359ccf['include'],function(_0x519473){return{'model':db[_0x519473['model']],'as':_0x519473['as'],'attributes':_0x519473[_0xbee5('0x1e')],'include':_0x519473[_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x519473[_0xbee5('0x1b')],function(_0x169042){return{'model':db[_0x169042[_0xbee5('0x1d')]],'as':_0x169042['as'],'attributes':_0x169042[_0xbee5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36b50f){logger[_0xbee5('0xb')](_0xbee5('0x15'),_0x538460);logger[_0xbee5('0xd')](_0xbee5('0x15'),_0x538460,JSON['stringify'](_0x36b50f));_0x3c3f4e(_0x36b50f);})[_0xbee5('0x1f')](function(_0x15ffb1){logger[_0xbee5('0x11')](_0xbee5('0x15'),_0x15ffb1[_0xbee5('0x13')],_0x538460);_0x35eb5c(_0x11b4a3[_0xbee5('0x11')](0x1f4,_0x15ffb1[_0xbee5('0x13')]));});});};exports[_0xbee5('0x20')]=function(_0x2ccb91){var _0x59c2e4=this;return new Promise(function(_0x22df5f,_0x5b10a6){return db[_0xbee5('0x16')]['find']({'raw':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91['options'][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x2ccb91['options']?_0x2ccb91[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91[_0xbee5('0x18')]['attributes']||null:null,'include':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x2ccb91['options'][_0xbee5('0x1b')],function(_0x28f8e3){return{'model':db[_0x28f8e3[_0xbee5('0x1d')]],'as':_0x28f8e3['as'],'attributes':_0x28f8e3[_0xbee5('0x1e')],'include':_0x28f8e3['include']?_[_0xbee5('0x1c')](_0x28f8e3[_0xbee5('0x1b')],function(_0x3e854){return{'model':db[_0x3e854[_0xbee5('0x1d')]],'as':_0x3e854['as'],'attributes':_0x3e854['attributes'],'include':_0x3e854[_0xbee5('0x1b')]?_['map'](_0x3e854[_0xbee5('0x1b')],function(_0x58a2e3){return{'model':db[_0x58a2e3['model']],'as':_0x58a2e3['as'],'attributes':_0x58a2e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xbee5('0xa')](function(_0x315523){logger[_0xbee5('0xb')](_0xbee5('0x20'),_0x2ccb91);logger[_0xbee5('0xd')](_0xbee5('0x20'),_0x2ccb91,JSON[_0xbee5('0x10')](_0x315523));_0x22df5f(_0x315523);})[_0xbee5('0x1f')](function(_0x58452a){logger[_0xbee5('0x11')]('ShowVtigerAccount',_0x58452a[_0xbee5('0x13')],_0x2ccb91);_0x5b10a6(_0x59c2e4[_0xbee5('0x11')](0x1f4,_0x58452a[_0xbee5('0x13')]));});});}; \ No newline at end of file +var _0x3c81=['debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowVtigerAccount','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x2b7806,_0x3b0257){var _0x162485=function(_0x5174f3){while(--_0x5174f3){_0x2b7806['push'](_0x2b7806['shift']());}};_0x162485(++_0x3b0257);}(_0x3c81,0x102));var _0x13c8=function(_0x41e1ad,_0x5e7553){_0x41e1ad=_0x41e1ad-0x0;var _0x20a09d=_0x3c81[_0x41e1ad];return _0x20a09d;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});}exports[_0x13c8('0x15')]=function(_0xce1ad2){var _0x28f07e=this;return new Promise(function(_0x346417,_0x251c38){return db[_0x13c8('0x16')][_0x13c8('0x17')]({'raw':_0xce1ad2[_0x13c8('0x18')]?_0xce1ad2['options'][_0x13c8('0x19')]===undefined?!![]:![]:!![],'where':_0xce1ad2[_0x13c8('0x18')]?_0xce1ad2[_0x13c8('0x18')][_0x13c8('0x1a')]||null:null,'attributes':_0xce1ad2['options']?_0xce1ad2[_0x13c8('0x18')][_0x13c8('0x1b')]||null:null,'limit':_0xce1ad2[_0x13c8('0x18')]?_0xce1ad2[_0x13c8('0x18')][_0x13c8('0x1c')]||null:null,'include':_0xce1ad2[_0x13c8('0x18')]?_0xce1ad2['options'][_0x13c8('0x1d')]?_[_0x13c8('0x1e')](_0xce1ad2[_0x13c8('0x18')][_0x13c8('0x1d')],function(_0x577df6){return{'model':db[_0x577df6[_0x13c8('0x1f')]],'as':_0x577df6['as'],'attributes':_0x577df6[_0x13c8('0x1b')],'include':_0x577df6['include']?_['map'](_0x577df6[_0x13c8('0x1d')],function(_0x4aff35){return{'model':db[_0x4aff35['model']],'as':_0x4aff35['as'],'attributes':_0x4aff35['attributes'],'include':_0x4aff35[_0x13c8('0x1d')]?_[_0x13c8('0x1e')](_0x4aff35['include'],function(_0x4df077){return{'model':db[_0x4df077[_0x13c8('0x1f')]],'as':_0x4df077['as'],'attributes':_0x4df077['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c7dc4){logger[_0x13c8('0xb')](_0x13c8('0x15'),_0xce1ad2);logger['debug']('GetVtigerAccount',_0xce1ad2,JSON[_0x13c8('0x10')](_0x1c7dc4));_0x346417(_0x1c7dc4);})[_0x13c8('0x20')](function(_0x399840){logger[_0x13c8('0x11')](_0x13c8('0x15'),_0x399840[_0x13c8('0x13')],_0xce1ad2);_0x251c38(_0x28f07e[_0x13c8('0x11')](0x1f4,_0x399840['message']));});});};exports[_0x13c8('0x21')]=function(_0xcbc9b7){var _0x5a5911=this;return new Promise(function(_0x5c85e4,_0x23a725){return db[_0x13c8('0x16')]['find']({'raw':_0xcbc9b7[_0x13c8('0x18')]?_0xcbc9b7[_0x13c8('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xcbc9b7[_0x13c8('0x18')]?_0xcbc9b7[_0x13c8('0x18')][_0x13c8('0x1a')]||null:null,'attributes':_0xcbc9b7[_0x13c8('0x18')]?_0xcbc9b7[_0x13c8('0x18')][_0x13c8('0x1b')]||null:null,'include':_0xcbc9b7[_0x13c8('0x18')]?_0xcbc9b7[_0x13c8('0x18')]['include']?_['map'](_0xcbc9b7[_0x13c8('0x18')][_0x13c8('0x1d')],function(_0x517d01){return{'model':db[_0x517d01[_0x13c8('0x1f')]],'as':_0x517d01['as'],'attributes':_0x517d01['attributes'],'include':_0x517d01[_0x13c8('0x1d')]?_['map'](_0x517d01[_0x13c8('0x1d')],function(_0x53de18){return{'model':db[_0x53de18[_0x13c8('0x1f')]],'as':_0x53de18['as'],'attributes':_0x53de18[_0x13c8('0x1b')],'include':_0x53de18[_0x13c8('0x1d')]?_[_0x13c8('0x1e')](_0x53de18[_0x13c8('0x1d')],function(_0x5287f2){return{'model':db[_0x5287f2[_0x13c8('0x1f')]],'as':_0x5287f2['as'],'attributes':_0x5287f2[_0x13c8('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x362b9c){logger[_0x13c8('0xb')](_0x13c8('0x21'),_0xcbc9b7);logger['debug']('ShowVtigerAccount',_0xcbc9b7,JSON['stringify'](_0x362b9c));_0x5c85e4(_0x362b9c);})[_0x13c8('0x20')](function(_0x2c8218){logger[_0x13c8('0x11')](_0x13c8('0x21'),_0x2c8218[_0x13c8('0x13')],_0xcbc9b7);_0x23a725(_0x5a5911[_0x13c8('0x11')](0x1f4,_0x2c8218[_0x13c8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index c220413..cf7fd58 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 _0x9dc5=['/:id/descriptions','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x9dc5,0x90));var _0x59dc=function(_0x7f01a0,_0x592ed3){_0x7f01a0=_0x7f01a0-0x0;var _0x257a59=_0x9dc5[_0x7f01a0];return _0x257a59;};'use strict';var multer=require(_0x59dc('0x0'));var util=require(_0x59dc('0x1'));var path=require(_0x59dc('0x2'));var timeout=require(_0x59dc('0x3'));var express=require(_0x59dc('0x4'));var router=express[_0x59dc('0x5')]();var fs_extra=require(_0x59dc('0x6'));var auth=require(_0x59dc('0x7'));var interaction=require(_0x59dc('0x8'));var config=require(_0x59dc('0x9'));var controller=require(_0x59dc('0xa'));router[_0x59dc('0xb')]('/',auth[_0x59dc('0xc')](),controller['index']);router[_0x59dc('0xb')]('/:id',auth[_0x59dc('0xc')](),controller[_0x59dc('0xd')]);router[_0x59dc('0xb')](_0x59dc('0xe'),auth['isAuthenticated'](),controller[_0x59dc('0xf')]);router[_0x59dc('0xb')](_0x59dc('0x10'),auth[_0x59dc('0xc')](),controller[_0x59dc('0x11')]);router[_0x59dc('0xb')](_0x59dc('0x12'),auth[_0x59dc('0xc')](),controller['getDescriptions']);router[_0x59dc('0x13')]('/',auth[_0x59dc('0xc')](),controller[_0x59dc('0x14')]);router[_0x59dc('0x15')](_0x59dc('0x16'),auth[_0x59dc('0xc')](),controller[_0x59dc('0x17')]);router[_0x59dc('0x18')](_0x59dc('0x16'),auth[_0x59dc('0xc')](),controller[_0x59dc('0x19')]);module[_0x59dc('0x1a')]=router; \ No newline at end of file +var _0xdd3f=['index','isAuthenticated','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdd3f,0x10b));var _0xfdd3=function(_0xbcd2e1,_0x380105){_0xbcd2e1=_0xbcd2e1-0x0;var _0xfb252c=_0xdd3f[_0xbcd2e1];return _0xfb252c;};'use strict';var multer=require(_0xfdd3('0x0'));var util=require(_0xfdd3('0x1'));var path=require(_0xfdd3('0x2'));var timeout=require(_0xfdd3('0x3'));var express=require(_0xfdd3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfdd3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfdd3('0x6'));var controller=require(_0xfdd3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xfdd3('0x8')]);router['get']('/:id',auth[_0xfdd3('0x9')](),controller[_0xfdd3('0xa')]);router[_0xfdd3('0xb')](_0xfdd3('0xc'),auth['isAuthenticated'](),controller[_0xfdd3('0xd')]);router['get'](_0xfdd3('0xe'),auth['isAuthenticated'](),controller[_0xfdd3('0xf')]);router[_0xfdd3('0xb')](_0xfdd3('0x10'),auth['isAuthenticated'](),controller[_0xfdd3('0x11')]);router[_0xfdd3('0x12')]('/',auth['isAuthenticated'](),controller[_0xfdd3('0x13')]);router[_0xfdd3('0x14')](_0xfdd3('0x15'),auth['isAuthenticated'](),controller[_0xfdd3('0x16')]);router['delete'](_0xfdd3('0x15'),auth[_0xfdd3('0x9')](),controller[_0xfdd3('0x17')]);module[_0xfdd3('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 18114ba..3068cbb 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 _0x32c0=['STRING','sequelize'];(function(_0x25f517,_0x37246a){var _0x248420=function(_0x17bb36){while(--_0x17bb36){_0x25f517['push'](_0x25f517['shift']());}};_0x248420(++_0x37246a);}(_0x32c0,0x1e5));var _0x032c=function(_0x247dc9,_0x153177){_0x247dc9=_0x247dc9-0x0;var _0x1fb2ba=_0x32c0[_0x247dc9];return _0x1fb2ba;};'use strict';var Sequelize=require(_0x032c('0x0'));module['exports']={'name':{'type':Sequelize[_0x032c('0x1')]},'description':{'type':Sequelize[_0x032c('0x1')]}}; \ No newline at end of file +var _0xdc8f=['sequelize','STRING'];(function(_0x536bd7,_0x4c3342){var _0x59e1dd=function(_0x218dbb){while(--_0x218dbb){_0x536bd7['push'](_0x536bd7['shift']());}};_0x59e1dd(++_0x4c3342);}(_0xdc8f,0xc2));var _0xfdc8=function(_0x2e1b3f,_0x5bbe92){_0x2e1b3f=_0x2e1b3f-0x0;var _0x202a55=_0xdc8f[_0x2e1b3f];return _0x202a55;};'use strict';var Sequelize=require(_0xfdc8('0x0'));module['exports']={'name':{'type':Sequelize[_0xfdc8('0x1')]},'description':{'type':Sequelize[_0xfdc8('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 84f69e7..ad93f61 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 _0x253c=['includeAll','include','rows','catch','show','rawAttributes','options','create','body','find','params','getFields','findOne','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','error','stack','name','send','index','VtigerConfiguration','fieldName','key','model','map','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x253c,0xb0));var _0xc253=function(_0x4fd767,_0x25cdca){_0x4fd767=_0x4fd767-0x0;var _0x48e469=_0x253c[_0x4fd767];return _0x48e469;};'use strict';var emlformat=require(_0xc253('0x0'));var rimraf=require(_0xc253('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc253('0x2'));var rp=require(_0xc253('0x3'));var moment=require(_0xc253('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc253('0x5'));var util=require(_0xc253('0x6'));var path=require(_0xc253('0x7'));var sox=require(_0xc253('0x8'));var csv=require(_0xc253('0x9'));var ejs=require(_0xc253('0xa'));var fs=require('fs');var fs_extra=require(_0xc253('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc253('0xc'));var jsforce=require(_0xc253('0xd'));var deskjs=require(_0xc253('0xe'));var toCsv=require(_0xc253('0x9'));var querystring=require(_0xc253('0xf'));var Papa=require(_0xc253('0x10'));var Redis=require(_0xc253('0x11'));var authService=require(_0xc253('0x12'));var qs=require(_0xc253('0x13'));var as=require(_0xc253('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc253('0x15'));var utils=require(_0xc253('0x16'));var config=require(_0xc253('0x17'));var licenseUtil=require(_0xc253('0x18'));var db=require(_0xc253('0x19'))['db'];function respondWithStatusCode(_0x5b3d16,_0x367347){_0x367347=_0x367347||0xcc;return function(_0x32927b){if(_0x32927b){return _0x5b3d16[_0xc253('0x1a')](_0x367347);}return _0x5b3d16[_0xc253('0x1b')](_0x367347)[_0xc253('0x1c')]();};}function respondWithResult(_0x542714,_0x562ea6){_0x562ea6=_0x562ea6||0xc8;return function(_0x3f54e2){if(_0x3f54e2){return _0x542714[_0xc253('0x1b')](_0x562ea6)[_0xc253('0x1d')](_0x3f54e2);}};}function respondWithFilteredResult(_0x9595db,_0xc9705){return function(_0x3f17ad){if(_0x3f17ad){var _0x4d96c0=typeof _0xc9705[_0xc253('0x1e')]===_0xc253('0x1f')&&typeof _0xc9705['limit']===_0xc253('0x1f');var _0x29cdcb=_0x3f17ad[_0xc253('0x20')];var _0x4a32e8=_0x4d96c0?0x0:_0xc9705[_0xc253('0x1e')];var _0xefd19b=_0x4d96c0?_0x3f17ad[_0xc253('0x20')]:_0xc9705[_0xc253('0x1e')]+_0xc9705[_0xc253('0x21')];var _0x58ea0e;if(_0xefd19b>=_0x29cdcb){_0xefd19b=_0x29cdcb;_0x58ea0e=0xc8;}else{_0x58ea0e=0xce;}_0x9595db[_0xc253('0x1b')](_0x58ea0e);return _0x9595db[_0xc253('0x22')](_0xc253('0x23'),_0x4a32e8+'-'+_0xefd19b+'/'+_0x29cdcb)[_0xc253('0x1d')](_0x3f17ad);}return null;};}function patchUpdates(_0x24de64){return function(_0x238541){try{jsonpatch['apply'](_0x238541,_0x24de64,!![]);}catch(_0x57f7be){return BPromise['reject'](_0x57f7be);}return _0x238541['save']();};}function saveUpdates(_0x31964f,_0x22d1ea){return function(_0x1bce60){if(_0x1bce60){return _0x1bce60[_0xc253('0x24')](_0x31964f)[_0xc253('0x25')](function(_0x35778e){return _0x35778e;});}return null;};}function removeEntity(_0x1d6000,_0x165761){return function(_0x31b703){if(_0x31b703){return _0x31b703[_0xc253('0x26')]()['then'](function(){_0x1d6000['status'](0xcc)[_0xc253('0x1c')]();});}};}function handleEntityNotFound(_0x36b5db,_0x99b6f4){return function(_0x1929bb){if(!_0x1929bb){_0x36b5db['sendStatus'](0x194);}return _0x1929bb;};}function handleError(_0x226131,_0x186c37){_0x186c37=_0x186c37||0x1f4;return function(_0x3690f2){logger[_0xc253('0x27')](_0x3690f2[_0xc253('0x28')]);if(_0x3690f2[_0xc253('0x29')]){delete _0x3690f2[_0xc253('0x29')];}_0x226131[_0xc253('0x1b')](_0x186c37)[_0xc253('0x2a')](_0x3690f2);};}exports[_0xc253('0x2b')]=function(_0x467579,_0x2ea195){var _0x1a3c26={},_0x2df16={},_0x517db5={'count':0x0,'rows':[]};var _0x264dde=_['map'](db[_0xc253('0x2c')]['rawAttributes'],function(_0x1670db){return{'name':_0x1670db[_0xc253('0x2d')],'type':_0x1670db['type'][_0xc253('0x2e')]};});_0x2df16[_0xc253('0x2f')]=_[_0xc253('0x30')](_0x264dde,_0xc253('0x29'));_0x2df16['query']=_[_0xc253('0x31')](_0x467579['query']);_0x2df16[_0xc253('0x32')]=_[_0xc253('0x33')](_0x2df16[_0xc253('0x2f')],_0x2df16[_0xc253('0x34')]);_0x1a3c26[_0xc253('0x35')]=_['intersection'](_0x2df16[_0xc253('0x2f')],qs[_0xc253('0x36')](_0x467579['query'][_0xc253('0x36')]));_0x1a3c26['attributes']=_0x1a3c26[_0xc253('0x35')][_0xc253('0x37')]?_0x1a3c26['attributes']:_0x2df16[_0xc253('0x2f')];if(!_0x467579[_0xc253('0x34')]['hasOwnProperty'](_0xc253('0x38'))){_0x1a3c26[_0xc253('0x21')]=qs['limit'](_0x467579[_0xc253('0x34')][_0xc253('0x21')]);_0x1a3c26[_0xc253('0x1e')]=qs[_0xc253('0x1e')](_0x467579[_0xc253('0x34')][_0xc253('0x1e')]);}_0x1a3c26[_0xc253('0x39')]=qs[_0xc253('0x3a')](_0x467579[_0xc253('0x34')][_0xc253('0x3a')]);_0x1a3c26[_0xc253('0x3b')]=qs['filters'](_[_0xc253('0x3c')](_0x467579[_0xc253('0x34')],_0x2df16['filters']),_0x264dde);if(_0x467579[_0xc253('0x34')][_0xc253('0x3d')]){_0x1a3c26[_0xc253('0x3b')]=_[_0xc253('0x3e')](_0x1a3c26[_0xc253('0x3b')],{'$or':_[_0xc253('0x30')](_0x264dde,function(_0xdadbad){if(_0xdadbad[_0xc253('0x3f')]!=='VIRTUAL'){var _0xdb72ac={};_0xdb72ac[_0xdadbad['name']]={'$like':'%'+_0x467579[_0xc253('0x34')][_0xc253('0x3d')]+'%'};return _0xdb72ac;}})});}_0x1a3c26=_[_0xc253('0x3e')]({},_0x1a3c26,_0x467579['options']);var _0x5e1495={'where':_0x1a3c26[_0xc253('0x3b')]};return db['VtigerConfiguration']['count'](_0x5e1495)[_0xc253('0x25')](function(_0x72d02){_0x517db5[_0xc253('0x20')]=_0x72d02;if(_0x467579['query'][_0xc253('0x40')]){_0x1a3c26[_0xc253('0x41')]=[{'all':!![]}];}return db[_0xc253('0x2c')]['findAll'](_0x1a3c26);})[_0xc253('0x25')](function(_0xb406bd){_0x517db5[_0xc253('0x42')]=_0xb406bd;return _0x517db5;})[_0xc253('0x25')](respondWithFilteredResult(_0x2ea195,_0x1a3c26))[_0xc253('0x43')](handleError(_0x2ea195,null));};exports[_0xc253('0x44')]=function(_0x490486,_0x30d326){var _0x6138f7={'raw':![],'where':{'id':_0x490486['params']['id']}},_0x5c155d={};_0x5c155d[_0xc253('0x2f')]=_[_0xc253('0x31')](db['VtigerConfiguration'][_0xc253('0x45')]);_0x5c155d[_0xc253('0x34')]=_[_0xc253('0x31')](_0x490486['query']);_0x5c155d[_0xc253('0x32')]=_[_0xc253('0x33')](_0x5c155d[_0xc253('0x2f')],_0x5c155d[_0xc253('0x34')]);_0x6138f7[_0xc253('0x35')]=_[_0xc253('0x33')](_0x5c155d['model'],qs[_0xc253('0x36')](_0x490486[_0xc253('0x34')]['fields']));_0x6138f7[_0xc253('0x35')]=_0x6138f7[_0xc253('0x35')]['length']?_0x6138f7[_0xc253('0x35')]:_0x5c155d[_0xc253('0x2f')];if(_0x490486[_0xc253('0x34')]['includeAll']){_0x6138f7['include']=[{'all':!![]}];}_0x6138f7=_[_0xc253('0x3e')]({},_0x6138f7,_0x490486[_0xc253('0x46')]);return db[_0xc253('0x2c')]['find'](_0x6138f7)[_0xc253('0x25')](handleEntityNotFound(_0x30d326,null))[_0xc253('0x25')](respondWithResult(_0x30d326,null))[_0xc253('0x43')](handleError(_0x30d326,null));};exports[_0xc253('0x47')]=function(_0x1a6777,_0x1f554a){return db[_0xc253('0x2c')][_0xc253('0x47')](_0x1a6777['body'],{})[_0xc253('0x25')](respondWithResult(_0x1f554a,0xc9))[_0xc253('0x43')](handleError(_0x1f554a,null));};exports[_0xc253('0x24')]=function(_0x159c4d,_0x593d41){if(_0x159c4d[_0xc253('0x48')]['id']){delete _0x159c4d[_0xc253('0x48')]['id'];}return db[_0xc253('0x2c')][_0xc253('0x49')]({'where':{'id':_0x159c4d[_0xc253('0x4a')]['id']}})[_0xc253('0x25')](handleEntityNotFound(_0x593d41,null))[_0xc253('0x25')](saveUpdates(_0x159c4d[_0xc253('0x48')],null))['then'](respondWithResult(_0x593d41,null))[_0xc253('0x43')](handleError(_0x593d41,null));};exports[_0xc253('0x26')]=function(_0x1ae6ce,_0x1f3ff6){return db[_0xc253('0x2c')][_0xc253('0x49')]({'where':{'id':_0x1ae6ce['params']['id']}})[_0xc253('0x25')](handleEntityNotFound(_0x1f3ff6,null))[_0xc253('0x25')](removeEntity(_0x1f3ff6,null))[_0xc253('0x43')](handleError(_0x1f3ff6,null));};exports[_0xc253('0x4b')]=function(_0x442c45,_0x1df9db,_0x175dd0){var _0x108d93={};var _0xcbb7ed={};var _0x15734b;var _0x4cb650;return db[_0xc253('0x2c')][_0xc253('0x4c')]({'where':{'id':_0x442c45[_0xc253('0x4a')]['id']}})[_0xc253('0x25')](handleEntityNotFound(_0x1df9db,null))[_0xc253('0x25')](function(_0x5d4390){if(_0x5d4390){_0x15734b=_0x5d4390;_0xcbb7ed['model']=_[_0xc253('0x31')](db['VtigerField'][_0xc253('0x45')]);_0xcbb7ed[_0xc253('0x34')]=_[_0xc253('0x31')](_0x442c45[_0xc253('0x34')]);_0xcbb7ed[_0xc253('0x32')]=_['intersection'](_0xcbb7ed[_0xc253('0x2f')],_0xcbb7ed[_0xc253('0x34')]);_0x108d93[_0xc253('0x35')]=_[_0xc253('0x33')](_0xcbb7ed[_0xc253('0x2f')],qs[_0xc253('0x36')](_0x442c45[_0xc253('0x34')]['fields']));_0x108d93['attributes']=_0x108d93[_0xc253('0x35')][_0xc253('0x37')]?_0x108d93[_0xc253('0x35')]:_0xcbb7ed[_0xc253('0x2f')];_0x108d93['order']=qs[_0xc253('0x3a')](_0x442c45['query'][_0xc253('0x3a')]);_0x108d93[_0xc253('0x3b')]=qs[_0xc253('0x32')](_[_0xc253('0x3c')](_0x442c45[_0xc253('0x34')],_0xcbb7ed[_0xc253('0x32')]));if(_0x442c45[_0xc253('0x34')][_0xc253('0x3d')]){_0x108d93[_0xc253('0x3b')]=_[_0xc253('0x3e')](_0x108d93[_0xc253('0x3b')],{'$or':_[_0xc253('0x30')](_0x108d93[_0xc253('0x35')],function(_0x412d57){var _0x2a7085={};_0x2a7085[_0x412d57]={'$like':'%'+_0x442c45[_0xc253('0x34')]['filter']+'%'};return _0x2a7085;})});}_0x108d93=_[_0xc253('0x3e')]({},_0x108d93,_0x442c45[_0xc253('0x46')]);return _0x15734b['getFields'](_0x108d93);}})['then'](function(_0xf97490){if(_0xf97490){_0x4cb650=_0xf97490[_0xc253('0x37')];if(!_0x442c45['query']['hasOwnProperty'](_0xc253('0x38'))){_0x108d93[_0xc253('0x21')]=qs[_0xc253('0x21')](_0x442c45[_0xc253('0x34')][_0xc253('0x21')]);_0x108d93[_0xc253('0x1e')]=qs['offset'](_0x442c45['query']['offset']);}return _0x15734b['getFields'](_0x108d93);}})['then'](function(_0x21dd68){if(_0x21dd68){return _0x21dd68?{'count':_0x4cb650,'rows':_0x21dd68}:null;}})[_0xc253('0x25')](respondWithResult(_0x1df9db,null))[_0xc253('0x43')](handleError(_0x1df9db,null));};exports[_0xc253('0x4d')]=function(_0x390b52,_0xd0c999,_0xc01881){var _0x546068={};var _0xd5250={};var _0x4ed2cb;var _0x201073;return db[_0xc253('0x2c')][_0xc253('0x4c')]({'where':{'id':_0x390b52[_0xc253('0x4a')]['id']}})[_0xc253('0x25')](handleEntityNotFound(_0xd0c999,null))[_0xc253('0x25')](function(_0xa03c2d){if(_0xa03c2d){_0x4ed2cb=_0xa03c2d;_0xd5250[_0xc253('0x2f')]=_[_0xc253('0x31')](db['VtigerField']['rawAttributes']);_0xd5250['query']=_[_0xc253('0x31')](_0x390b52[_0xc253('0x34')]);_0xd5250[_0xc253('0x32')]=_[_0xc253('0x33')](_0xd5250[_0xc253('0x2f')],_0xd5250['query']);_0x546068[_0xc253('0x35')]=_['intersection'](_0xd5250[_0xc253('0x2f')],qs['fields'](_0x390b52['query'][_0xc253('0x36')]));_0x546068['attributes']=_0x546068['attributes'][_0xc253('0x37')]?_0x546068[_0xc253('0x35')]:_0xd5250[_0xc253('0x2f')];_0x546068[_0xc253('0x39')]=qs['sort'](_0x390b52['query']['sort']);_0x546068[_0xc253('0x3b')]=qs[_0xc253('0x32')](_['pick'](_0x390b52[_0xc253('0x34')],_0xd5250[_0xc253('0x32')]));if(_0x390b52[_0xc253('0x34')][_0xc253('0x3d')]){_0x546068[_0xc253('0x3b')]=_['merge'](_0x546068[_0xc253('0x3b')],{'$or':_[_0xc253('0x30')](_0x546068['attributes'],function(_0x577fa0){var _0x195897={};_0x195897[_0x577fa0]={'$like':'%'+_0x390b52[_0xc253('0x34')][_0xc253('0x3d')]+'%'};return _0x195897;})});}_0x546068=_[_0xc253('0x3e')]({},_0x546068,_0x390b52['options']);return _0x4ed2cb[_0xc253('0x4d')](_0x546068);}})[_0xc253('0x25')](function(_0x32f60e){if(_0x32f60e){_0x201073=_0x32f60e['length'];if(!_0x390b52[_0xc253('0x34')][_0xc253('0x4e')](_0xc253('0x38'))){_0x546068['limit']=qs[_0xc253('0x21')](_0x390b52[_0xc253('0x34')]['limit']);_0x546068[_0xc253('0x1e')]=qs[_0xc253('0x1e')](_0x390b52[_0xc253('0x34')][_0xc253('0x1e')]);}return _0x4ed2cb[_0xc253('0x4d')](_0x546068);}})[_0xc253('0x25')](function(_0x36ef73){if(_0x36ef73){return _0x36ef73?{'count':_0x201073,'rows':_0x36ef73}:null;}})['then'](respondWithResult(_0xd0c999,null))[_0xc253('0x43')](handleError(_0xd0c999,null));};exports[_0xc253('0x4f')]=function(_0xa50421,_0x30eeec,_0x299bb4){var _0x4cf703={};var _0x5c6927={};var _0xc2e866;var _0x496d43;return db[_0xc253('0x2c')]['findOne']({'where':{'id':_0xa50421[_0xc253('0x4a')]['id']}})['then'](handleEntityNotFound(_0x30eeec,null))[_0xc253('0x25')](function(_0xca681c){if(_0xca681c){_0xc2e866=_0xca681c;_0x5c6927[_0xc253('0x2f')]=_[_0xc253('0x31')](db['VtigerField']['rawAttributes']);_0x5c6927[_0xc253('0x34')]=_[_0xc253('0x31')](_0xa50421[_0xc253('0x34')]);_0x5c6927['filters']=_[_0xc253('0x33')](_0x5c6927[_0xc253('0x2f')],_0x5c6927['query']);_0x4cf703[_0xc253('0x35')]=_[_0xc253('0x33')](_0x5c6927[_0xc253('0x2f')],qs[_0xc253('0x36')](_0xa50421[_0xc253('0x34')]['fields']));_0x4cf703['attributes']=_0x4cf703['attributes']['length']?_0x4cf703[_0xc253('0x35')]:_0x5c6927[_0xc253('0x2f')];_0x4cf703[_0xc253('0x39')]=qs[_0xc253('0x3a')](_0xa50421[_0xc253('0x34')][_0xc253('0x3a')]);_0x4cf703[_0xc253('0x3b')]=qs[_0xc253('0x32')](_[_0xc253('0x3c')](_0xa50421['query'],_0x5c6927[_0xc253('0x32')]));if(_0xa50421[_0xc253('0x34')][_0xc253('0x3d')]){_0x4cf703['where']=_['merge'](_0x4cf703['where'],{'$or':_[_0xc253('0x30')](_0x4cf703[_0xc253('0x35')],function(_0x569056){var _0x21f768={};_0x21f768[_0x569056]={'$like':'%'+_0xa50421['query'][_0xc253('0x3d')]+'%'};return _0x21f768;})});}_0x4cf703=_[_0xc253('0x3e')]({},_0x4cf703,_0xa50421[_0xc253('0x46')]);return _0xc2e866[_0xc253('0x4f')](_0x4cf703);}})[_0xc253('0x25')](function(_0x36af8f){if(_0x36af8f){_0x496d43=_0x36af8f[_0xc253('0x37')];if(!_0xa50421[_0xc253('0x34')]['hasOwnProperty'](_0xc253('0x38'))){_0x4cf703[_0xc253('0x21')]=qs[_0xc253('0x21')](_0xa50421[_0xc253('0x34')][_0xc253('0x21')]);_0x4cf703[_0xc253('0x1e')]=qs[_0xc253('0x1e')](_0xa50421[_0xc253('0x34')][_0xc253('0x1e')]);}return _0xc2e866[_0xc253('0x4f')](_0x4cf703);}})['then'](function(_0x2f45e8){if(_0x2f45e8){return _0x2f45e8?{'count':_0x496d43,'rows':_0x2f45e8}:null;}})['then'](respondWithResult(_0x30eeec,null))[_0xc253('0x43')](handleError(_0x30eeec,null));}; \ No newline at end of file +var _0xe539=['jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','params','keys','find','catch','create','destroy','findOne','length','pick','getSubjects','VtigerField','order','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x5c8a09,_0x232960){var _0x43e3a5=function(_0x11fd76){while(--_0x11fd76){_0x5c8a09['push'](_0x5c8a09['shift']());}};_0x43e3a5(++_0x232960);}(_0xe539,0x164));var _0x9e53=function(_0x2d89ce,_0x24d58d){_0x2d89ce=_0x2d89ce-0x0;var _0x3fad10=_0xe539[_0x2d89ce];return _0x3fad10;};'use strict';var emlformat=require(_0x9e53('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9e53('0x1'));var jsonpatch=require(_0x9e53('0x2'));var rp=require(_0x9e53('0x3'));var moment=require(_0x9e53('0x4'));var BPromise=require(_0x9e53('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9e53('0x6'));var sox=require(_0x9e53('0x7'));var csv=require(_0x9e53('0x8'));var ejs=require(_0x9e53('0x9'));var fs=require('fs');var fs_extra=require(_0x9e53('0xa'));var _=require(_0x9e53('0xb'));var squel=require(_0x9e53('0xc'));var crypto=require(_0x9e53('0xd'));var jsforce=require(_0x9e53('0xe'));var deskjs=require(_0x9e53('0xf'));var toCsv=require(_0x9e53('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9e53('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9e53('0x11'));var as=require(_0x9e53('0x12'));var hardwareService=require(_0x9e53('0x13'));var logger=require(_0x9e53('0x14'))('api');var utils=require(_0x9e53('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9e53('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a8038,_0x430447){_0x430447=_0x430447||0xcc;return function(_0x4adbba){if(_0x4adbba){return _0x1a8038[_0x9e53('0x17')](_0x430447);}return _0x1a8038[_0x9e53('0x18')](_0x430447)[_0x9e53('0x19')]();};}function respondWithResult(_0x2f6993,_0x25a34b){_0x25a34b=_0x25a34b||0xc8;return function(_0x58d755){if(_0x58d755){return _0x2f6993[_0x9e53('0x18')](_0x25a34b)[_0x9e53('0x1a')](_0x58d755);}};}function respondWithFilteredResult(_0x577d8b,_0x2c1c22){return function(_0x2da3d3){if(_0x2da3d3){var _0x7aac11=typeof _0x2c1c22[_0x9e53('0x1b')]===_0x9e53('0x1c')&&typeof _0x2c1c22[_0x9e53('0x1d')]==='undefined';var _0x36d685=_0x2da3d3[_0x9e53('0x1e')];var _0x7a58c4=_0x7aac11?0x0:_0x2c1c22[_0x9e53('0x1b')];var _0x1ccfb2=_0x7aac11?_0x2da3d3[_0x9e53('0x1e')]:_0x2c1c22[_0x9e53('0x1b')]+_0x2c1c22[_0x9e53('0x1d')];var _0x1524ba;if(_0x1ccfb2>=_0x36d685){_0x1ccfb2=_0x36d685;_0x1524ba=0xc8;}else{_0x1524ba=0xce;}_0x577d8b[_0x9e53('0x18')](_0x1524ba);return _0x577d8b['set'](_0x9e53('0x1f'),_0x7a58c4+'-'+_0x1ccfb2+'/'+_0x36d685)[_0x9e53('0x1a')](_0x2da3d3);}return null;};}function patchUpdates(_0x4c811c){return function(_0x1dba0d){try{jsonpatch['apply'](_0x1dba0d,_0x4c811c,!![]);}catch(_0x163185){return BPromise['reject'](_0x163185);}return _0x1dba0d[_0x9e53('0x20')]();};}function saveUpdates(_0x224216,_0x3ae54c){return function(_0x13dac7){if(_0x13dac7){return _0x13dac7[_0x9e53('0x21')](_0x224216)['then'](function(_0x3a298e){return _0x3a298e;});}return null;};}function removeEntity(_0x48635f,_0x432259){return function(_0x548475){if(_0x548475){return _0x548475['destroy']()[_0x9e53('0x22')](function(){_0x48635f[_0x9e53('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3485c6,_0x365f27){return function(_0x3e91ed){if(!_0x3e91ed){_0x3485c6[_0x9e53('0x17')](0x194);}return _0x3e91ed;};}function handleError(_0x5d8b35,_0x2a20c5){_0x2a20c5=_0x2a20c5||0x1f4;return function(_0x5ba797){logger[_0x9e53('0x23')](_0x5ba797[_0x9e53('0x24')]);if(_0x5ba797[_0x9e53('0x25')]){delete _0x5ba797[_0x9e53('0x25')];}_0x5d8b35[_0x9e53('0x18')](_0x2a20c5)[_0x9e53('0x26')](_0x5ba797);};}exports[_0x9e53('0x27')]=function(_0x18c749,_0x56ab62){var _0x10f876={},_0x2acbab={},_0x2e6b7b={'count':0x0,'rows':[]};var _0x421553=_['map'](db[_0x9e53('0x28')][_0x9e53('0x29')],function(_0x494395){return{'name':_0x494395[_0x9e53('0x2a')],'type':_0x494395[_0x9e53('0x2b')][_0x9e53('0x2c')]};});_0x2acbab[_0x9e53('0x2d')]=_[_0x9e53('0x2e')](_0x421553,_0x9e53('0x25'));_0x2acbab[_0x9e53('0x2f')]=_['keys'](_0x18c749[_0x9e53('0x2f')]);_0x2acbab[_0x9e53('0x30')]=_['intersection'](_0x2acbab[_0x9e53('0x2d')],_0x2acbab[_0x9e53('0x2f')]);_0x10f876[_0x9e53('0x31')]=_[_0x9e53('0x32')](_0x2acbab[_0x9e53('0x2d')],qs[_0x9e53('0x33')](_0x18c749[_0x9e53('0x2f')]['fields']));_0x10f876[_0x9e53('0x31')]=_0x10f876[_0x9e53('0x31')]['length']?_0x10f876['attributes']:_0x2acbab[_0x9e53('0x2d')];if(!_0x18c749[_0x9e53('0x2f')][_0x9e53('0x34')](_0x9e53('0x35'))){_0x10f876[_0x9e53('0x1d')]=qs[_0x9e53('0x1d')](_0x18c749[_0x9e53('0x2f')][_0x9e53('0x1d')]);_0x10f876[_0x9e53('0x1b')]=qs[_0x9e53('0x1b')](_0x18c749[_0x9e53('0x2f')]['offset']);}_0x10f876['order']=qs[_0x9e53('0x36')](_0x18c749[_0x9e53('0x2f')][_0x9e53('0x36')]);_0x10f876['where']=qs['filters'](_['pick'](_0x18c749[_0x9e53('0x2f')],_0x2acbab['filters']),_0x421553);if(_0x18c749[_0x9e53('0x2f')][_0x9e53('0x37')]){_0x10f876['where']=_[_0x9e53('0x38')](_0x10f876[_0x9e53('0x39')],{'$or':_[_0x9e53('0x2e')](_0x421553,function(_0x5194d8){if(_0x5194d8[_0x9e53('0x2b')]!=='VIRTUAL'){var _0xb7c5b4={};_0xb7c5b4[_0x5194d8[_0x9e53('0x25')]]={'$like':'%'+_0x18c749[_0x9e53('0x2f')][_0x9e53('0x37')]+'%'};return _0xb7c5b4;}})});}_0x10f876=_[_0x9e53('0x38')]({},_0x10f876,_0x18c749[_0x9e53('0x3a')]);var _0x335908={'where':_0x10f876[_0x9e53('0x39')]};return db[_0x9e53('0x28')]['count'](_0x335908)[_0x9e53('0x22')](function(_0x212264){_0x2e6b7b[_0x9e53('0x1e')]=_0x212264;if(_0x18c749[_0x9e53('0x2f')][_0x9e53('0x3b')]){_0x10f876[_0x9e53('0x3c')]=[{'all':!![]}];}return db[_0x9e53('0x28')]['findAll'](_0x10f876);})[_0x9e53('0x22')](function(_0x1ac4b9){_0x2e6b7b['rows']=_0x1ac4b9;return _0x2e6b7b;})[_0x9e53('0x22')](respondWithFilteredResult(_0x56ab62,_0x10f876))['catch'](handleError(_0x56ab62,null));};exports['show']=function(_0x6067e0,_0xb39ee5){var _0xb78901={'raw':![],'where':{'id':_0x6067e0[_0x9e53('0x3d')]['id']}},_0x34f6d8={};_0x34f6d8['model']=_[_0x9e53('0x3e')](db[_0x9e53('0x28')]['rawAttributes']);_0x34f6d8[_0x9e53('0x2f')]=_[_0x9e53('0x3e')](_0x6067e0[_0x9e53('0x2f')]);_0x34f6d8[_0x9e53('0x30')]=_['intersection'](_0x34f6d8['model'],_0x34f6d8[_0x9e53('0x2f')]);_0xb78901[_0x9e53('0x31')]=_[_0x9e53('0x32')](_0x34f6d8[_0x9e53('0x2d')],qs[_0x9e53('0x33')](_0x6067e0[_0x9e53('0x2f')][_0x9e53('0x33')]));_0xb78901[_0x9e53('0x31')]=_0xb78901[_0x9e53('0x31')]['length']?_0xb78901[_0x9e53('0x31')]:_0x34f6d8[_0x9e53('0x2d')];if(_0x6067e0[_0x9e53('0x2f')][_0x9e53('0x3b')]){_0xb78901[_0x9e53('0x3c')]=[{'all':!![]}];}_0xb78901=_[_0x9e53('0x38')]({},_0xb78901,_0x6067e0['options']);return db['VtigerConfiguration'][_0x9e53('0x3f')](_0xb78901)['then'](handleEntityNotFound(_0xb39ee5,null))[_0x9e53('0x22')](respondWithResult(_0xb39ee5,null))[_0x9e53('0x40')](handleError(_0xb39ee5,null));};exports['create']=function(_0x3586d3,_0x33114e){return db['VtigerConfiguration'][_0x9e53('0x41')](_0x3586d3['body'],{})[_0x9e53('0x22')](respondWithResult(_0x33114e,0xc9))[_0x9e53('0x40')](handleError(_0x33114e,null));};exports['update']=function(_0x3697d5,_0x17b47){if(_0x3697d5['body']['id']){delete _0x3697d5['body']['id'];}return db[_0x9e53('0x28')][_0x9e53('0x3f')]({'where':{'id':_0x3697d5['params']['id']}})[_0x9e53('0x22')](handleEntityNotFound(_0x17b47,null))[_0x9e53('0x22')](saveUpdates(_0x3697d5['body'],null))[_0x9e53('0x22')](respondWithResult(_0x17b47,null))['catch'](handleError(_0x17b47,null));};exports[_0x9e53('0x42')]=function(_0x1c2b26,_0x421f06){return db['VtigerConfiguration']['find']({'where':{'id':_0x1c2b26[_0x9e53('0x3d')]['id']}})[_0x9e53('0x22')](handleEntityNotFound(_0x421f06,null))[_0x9e53('0x22')](removeEntity(_0x421f06,null))[_0x9e53('0x40')](handleError(_0x421f06,null));};exports['getFields']=function(_0x405f29,_0x8dac63,_0x50fc7a){var _0x158367={};var _0x39ae84={};var _0x323ea7;var _0x1b1797;return db[_0x9e53('0x28')][_0x9e53('0x43')]({'where':{'id':_0x405f29[_0x9e53('0x3d')]['id']}})['then'](handleEntityNotFound(_0x8dac63,null))[_0x9e53('0x22')](function(_0xdae953){if(_0xdae953){_0x323ea7=_0xdae953;_0x39ae84[_0x9e53('0x2d')]=_[_0x9e53('0x3e')](db['VtigerField'][_0x9e53('0x29')]);_0x39ae84[_0x9e53('0x2f')]=_[_0x9e53('0x3e')](_0x405f29['query']);_0x39ae84['filters']=_['intersection'](_0x39ae84[_0x9e53('0x2d')],_0x39ae84[_0x9e53('0x2f')]);_0x158367[_0x9e53('0x31')]=_[_0x9e53('0x32')](_0x39ae84[_0x9e53('0x2d')],qs[_0x9e53('0x33')](_0x405f29['query'][_0x9e53('0x33')]));_0x158367['attributes']=_0x158367[_0x9e53('0x31')][_0x9e53('0x44')]?_0x158367[_0x9e53('0x31')]:_0x39ae84['model'];_0x158367['order']=qs['sort'](_0x405f29['query'][_0x9e53('0x36')]);_0x158367['where']=qs['filters'](_[_0x9e53('0x45')](_0x405f29[_0x9e53('0x2f')],_0x39ae84['filters']));if(_0x405f29['query'][_0x9e53('0x37')]){_0x158367[_0x9e53('0x39')]=_[_0x9e53('0x38')](_0x158367['where'],{'$or':_[_0x9e53('0x2e')](_0x158367[_0x9e53('0x31')],function(_0xa5bcaf){var _0x2ee6a8={};_0x2ee6a8[_0xa5bcaf]={'$like':'%'+_0x405f29[_0x9e53('0x2f')][_0x9e53('0x37')]+'%'};return _0x2ee6a8;})});}_0x158367=_[_0x9e53('0x38')]({},_0x158367,_0x405f29[_0x9e53('0x3a')]);return _0x323ea7['getFields'](_0x158367);}})[_0x9e53('0x22')](function(_0x12b7b5){if(_0x12b7b5){_0x1b1797=_0x12b7b5['length'];if(!_0x405f29['query'][_0x9e53('0x34')]('nolimit')){_0x158367[_0x9e53('0x1d')]=qs[_0x9e53('0x1d')](_0x405f29[_0x9e53('0x2f')][_0x9e53('0x1d')]);_0x158367[_0x9e53('0x1b')]=qs[_0x9e53('0x1b')](_0x405f29[_0x9e53('0x2f')]['offset']);}return _0x323ea7['getFields'](_0x158367);}})[_0x9e53('0x22')](function(_0x519162){if(_0x519162){return _0x519162?{'count':_0x1b1797,'rows':_0x519162}:null;}})[_0x9e53('0x22')](respondWithResult(_0x8dac63,null))[_0x9e53('0x40')](handleError(_0x8dac63,null));};exports[_0x9e53('0x46')]=function(_0x1b889e,_0x31d696,_0x3863c3){var _0x58d874={};var _0x7f1f08={};var _0x3e0cc0;var _0x585f4d;return db[_0x9e53('0x28')]['findOne']({'where':{'id':_0x1b889e[_0x9e53('0x3d')]['id']}})[_0x9e53('0x22')](handleEntityNotFound(_0x31d696,null))['then'](function(_0xa0bb43){if(_0xa0bb43){_0x3e0cc0=_0xa0bb43;_0x7f1f08['model']=_[_0x9e53('0x3e')](db[_0x9e53('0x47')][_0x9e53('0x29')]);_0x7f1f08[_0x9e53('0x2f')]=_[_0x9e53('0x3e')](_0x1b889e[_0x9e53('0x2f')]);_0x7f1f08[_0x9e53('0x30')]=_[_0x9e53('0x32')](_0x7f1f08[_0x9e53('0x2d')],_0x7f1f08['query']);_0x58d874[_0x9e53('0x31')]=_[_0x9e53('0x32')](_0x7f1f08[_0x9e53('0x2d')],qs['fields'](_0x1b889e[_0x9e53('0x2f')][_0x9e53('0x33')]));_0x58d874['attributes']=_0x58d874[_0x9e53('0x31')][_0x9e53('0x44')]?_0x58d874[_0x9e53('0x31')]:_0x7f1f08[_0x9e53('0x2d')];_0x58d874[_0x9e53('0x48')]=qs[_0x9e53('0x36')](_0x1b889e[_0x9e53('0x2f')][_0x9e53('0x36')]);_0x58d874[_0x9e53('0x39')]=qs[_0x9e53('0x30')](_[_0x9e53('0x45')](_0x1b889e[_0x9e53('0x2f')],_0x7f1f08[_0x9e53('0x30')]));if(_0x1b889e[_0x9e53('0x2f')][_0x9e53('0x37')]){_0x58d874['where']=_[_0x9e53('0x38')](_0x58d874[_0x9e53('0x39')],{'$or':_['map'](_0x58d874[_0x9e53('0x31')],function(_0x295fc9){var _0x2693d2={};_0x2693d2[_0x295fc9]={'$like':'%'+_0x1b889e[_0x9e53('0x2f')][_0x9e53('0x37')]+'%'};return _0x2693d2;})});}_0x58d874=_['merge']({},_0x58d874,_0x1b889e[_0x9e53('0x3a')]);return _0x3e0cc0['getSubjects'](_0x58d874);}})[_0x9e53('0x22')](function(_0x435ebb){if(_0x435ebb){_0x585f4d=_0x435ebb[_0x9e53('0x44')];if(!_0x1b889e[_0x9e53('0x2f')]['hasOwnProperty']('nolimit')){_0x58d874['limit']=qs[_0x9e53('0x1d')](_0x1b889e[_0x9e53('0x2f')][_0x9e53('0x1d')]);_0x58d874['offset']=qs['offset'](_0x1b889e[_0x9e53('0x2f')][_0x9e53('0x1b')]);}return _0x3e0cc0[_0x9e53('0x46')](_0x58d874);}})['then'](function(_0x230fa3){if(_0x230fa3){return _0x230fa3?{'count':_0x585f4d,'rows':_0x230fa3}:null;}})['then'](respondWithResult(_0x31d696,null))[_0x9e53('0x40')](handleError(_0x31d696,null));};exports[_0x9e53('0x49')]=function(_0x3d354b,_0x27f712,_0x39c855){var _0x596633={};var _0x160a9e={};var _0x27e23e;var _0x1e6c24;return db[_0x9e53('0x28')][_0x9e53('0x43')]({'where':{'id':_0x3d354b[_0x9e53('0x3d')]['id']}})[_0x9e53('0x22')](handleEntityNotFound(_0x27f712,null))['then'](function(_0x2d4662){if(_0x2d4662){_0x27e23e=_0x2d4662;_0x160a9e['model']=_['keys'](db[_0x9e53('0x47')][_0x9e53('0x29')]);_0x160a9e['query']=_[_0x9e53('0x3e')](_0x3d354b[_0x9e53('0x2f')]);_0x160a9e['filters']=_['intersection'](_0x160a9e['model'],_0x160a9e[_0x9e53('0x2f')]);_0x596633[_0x9e53('0x31')]=_[_0x9e53('0x32')](_0x160a9e[_0x9e53('0x2d')],qs['fields'](_0x3d354b['query']['fields']));_0x596633[_0x9e53('0x31')]=_0x596633[_0x9e53('0x31')][_0x9e53('0x44')]?_0x596633['attributes']:_0x160a9e[_0x9e53('0x2d')];_0x596633[_0x9e53('0x48')]=qs['sort'](_0x3d354b['query'][_0x9e53('0x36')]);_0x596633['where']=qs[_0x9e53('0x30')](_[_0x9e53('0x45')](_0x3d354b['query'],_0x160a9e[_0x9e53('0x30')]));if(_0x3d354b['query'][_0x9e53('0x37')]){_0x596633[_0x9e53('0x39')]=_[_0x9e53('0x38')](_0x596633[_0x9e53('0x39')],{'$or':_[_0x9e53('0x2e')](_0x596633['attributes'],function(_0x5782ae){var _0x5000dd={};_0x5000dd[_0x5782ae]={'$like':'%'+_0x3d354b[_0x9e53('0x2f')][_0x9e53('0x37')]+'%'};return _0x5000dd;})});}_0x596633=_[_0x9e53('0x38')]({},_0x596633,_0x3d354b[_0x9e53('0x3a')]);return _0x27e23e[_0x9e53('0x49')](_0x596633);}})['then'](function(_0x1b5652){if(_0x1b5652){_0x1e6c24=_0x1b5652['length'];if(!_0x3d354b[_0x9e53('0x2f')][_0x9e53('0x34')]('nolimit')){_0x596633['limit']=qs[_0x9e53('0x1d')](_0x3d354b[_0x9e53('0x2f')][_0x9e53('0x1d')]);_0x596633['offset']=qs[_0x9e53('0x1b')](_0x3d354b[_0x9e53('0x2f')][_0x9e53('0x1b')]);}return _0x27e23e[_0x9e53('0x49')](_0x596633);}})[_0x9e53('0x22')](function(_0x737eb8){if(_0x737eb8){return _0x737eb8?{'count':_0x1e6c24,'rows':_0x737eb8}:null;}})[_0x9e53('0x22')](respondWithResult(_0x27f712,null))[_0x9e53('0x40')](handleError(_0x27f712,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 80f1239..a6a0c59 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 _0xda3a=['VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xda3a,0x10c));var _0xada3=function(_0x53362e,_0x2a3afa){_0x53362e=_0x53362e-0x0;var _0x57fcc8=_0xda3a[_0x53362e];return _0x57fcc8;};'use strict';var _=require(_0xada3('0x0'));var util=require(_0xada3('0x1'));var logger=require(_0xada3('0x2'))(_0xada3('0x3'));var moment=require('moment');var BPromise=require(_0xada3('0x4'));var rp=require(_0xada3('0x5'));var fs=require('fs');var path=require(_0xada3('0x6'));var rimraf=require(_0xada3('0x7'));var config=require(_0xada3('0x8'));var attributes=require(_0xada3('0x9'));module[_0xada3('0xa')]=function(_0x3053cc,_0x3e7536){return _0x3053cc[_0xada3('0xb')](_0xada3('0xc'),attributes,{'tableName':_0xada3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf240=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xf240,0xc2));var _0x0f24=function(_0x5a3932,_0x2ceafa){_0x5a3932=_0x5a3932-0x0;var _0x4f188e=_0xf240[_0x5a3932];return _0x4f188e;};'use strict';var _=require('lodash');var util=require(_0x0f24('0x0'));var logger=require(_0x0f24('0x1'))(_0x0f24('0x2'));var moment=require(_0x0f24('0x3'));var BPromise=require(_0x0f24('0x4'));var rp=require(_0x0f24('0x5'));var fs=require('fs');var path=require(_0x0f24('0x6'));var rimraf=require(_0x0f24('0x7'));var config=require(_0x0f24('0x8'));var attributes=require(_0x0f24('0x9'));module[_0x0f24('0xa')]=function(_0x22cd23,_0x3aa7ba){return _0x22cd23[_0x0f24('0xb')](_0x0f24('0xc'),attributes,{'tableName':_0x0f24('0xd'),'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 246227f..0d7b58e 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 _0x523a=['debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x32d1a9,_0x1b470c){var _0x50eaf1=function(_0x5cac22){while(--_0x5cac22){_0x32d1a9['push'](_0x32d1a9['shift']());}};_0x50eaf1(++_0x1b470c);}(_0x523a,0x1bf));var _0xa523=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x523a[_0x1562a2];return _0x39a636;};'use strict';var _=require('lodash');var util=require(_0xa523('0x0'));var moment=require('moment');var BPromise=require(_0xa523('0x1'));var rs=require(_0xa523('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa523('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa523('0x4'))(_0xa523('0x5'));var config=require(_0xa523('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xa523('0x7')][_0xa523('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x24324b,_0x7a5afa,_0x28a135){return new BPromise(function(_0xd0b139,_0x37b51d){return client[_0xa523('0x9')](_0x24324b,_0x28a135)[_0xa523('0xa')](function(_0x282e00){logger[_0xa523('0xb')](_0xa523('0xc'),_0x7a5afa,'request\x20sent');logger[_0xa523('0xd')](_0xa523('0xe'),_0x7a5afa,'request\x20sent',JSON[_0xa523('0xf')](_0x282e00));if(_0x282e00[_0xa523('0x10')]){if(_0x282e00[_0xa523('0x10')][_0xa523('0x11')]===0x1f4){logger[_0xa523('0x10')](_0xa523('0xc'),_0x7a5afa,_0x282e00[_0xa523('0x10')]['message']);return _0x37b51d(_0x282e00[_0xa523('0x10')][_0xa523('0x12')]);}logger[_0xa523('0x10')](_0xa523('0xc'),_0x7a5afa,_0x282e00[_0xa523('0x10')][_0xa523('0x12')]);return _0xd0b139(_0x282e00[_0xa523('0x10')][_0xa523('0x12')]);}else{logger[_0xa523('0xb')](_0xa523('0xc'),_0x7a5afa,'request\x20sent');_0xd0b139(_0x282e00['result'][_0xa523('0x12')]);}})[_0xa523('0x13')](function(_0x14febf){logger['error'](_0xa523('0xc'),_0x7a5afa,_0x14febf);_0x37b51d(_0x14febf);});});} \ No newline at end of file +var _0x4b5e=['info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x4b5e,0x133));var _0xe4b5=function(_0x4c5e7e,_0x2dca3b){_0x4c5e7e=_0x4c5e7e-0x0;var _0x3628df=_0x4b5e[_0x4c5e7e];return _0x3628df;};'use strict';var _=require(_0xe4b5('0x0'));var util=require(_0xe4b5('0x1'));var moment=require(_0xe4b5('0x2'));var BPromise=require(_0xe4b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4b5('0x4'));var db=require(_0xe4b5('0x5'))['db'];var utils=require(_0xe4b5('0x6'));var logger=require(_0xe4b5('0x7'))(_0xe4b5('0x8'));var config=require(_0xe4b5('0x9'));var jayson=require(_0xe4b5('0xa'));var client=jayson[_0xe4b5('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48c59f,_0x262ab2,_0x17618f){return new BPromise(function(_0x26f8aa,_0x7bcad0){return client['request'](_0x48c59f,_0x17618f)[_0xe4b5('0xc')](function(_0x2c4acc){logger[_0xe4b5('0xd')](_0xe4b5('0xe'),_0x262ab2,'request\x20sent');logger[_0xe4b5('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x262ab2,_0xe4b5('0x10'),JSON[_0xe4b5('0x11')](_0x2c4acc));if(_0x2c4acc['error']){if(_0x2c4acc[_0xe4b5('0x12')]['code']===0x1f4){logger[_0xe4b5('0x12')](_0xe4b5('0xe'),_0x262ab2,_0x2c4acc['error'][_0xe4b5('0x13')]);return _0x7bcad0(_0x2c4acc['error']['message']);}logger[_0xe4b5('0x12')](_0xe4b5('0xe'),_0x262ab2,_0x2c4acc['error'][_0xe4b5('0x13')]);return _0x26f8aa(_0x2c4acc[_0xe4b5('0x12')]['message']);}else{logger[_0xe4b5('0xd')](_0xe4b5('0xe'),_0x262ab2,_0xe4b5('0x10'));_0x26f8aa(_0x2c4acc['result'][_0xe4b5('0x13')]);}})['catch'](function(_0x34b858){logger[_0xe4b5('0x12')](_0xe4b5('0xe'),_0x262ab2,_0x34b858);_0x7bcad0(_0x34b858);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 587ba24..4d615e8 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 _0xa04b=['post','create','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x4d81ce,_0x56a418){var _0x12dfce=function(_0x31d3e4){while(--_0x31d3e4){_0x4d81ce['push'](_0x4d81ce['shift']());}};_0x12dfce(++_0x56a418);}(_0xa04b,0x149));var _0xba04=function(_0x3452f4,_0x217853){_0x3452f4=_0x3452f4-0x0;var _0x979a81=_0xa04b[_0x3452f4];return _0x979a81;};'use strict';var multer=require(_0xba04('0x0'));var util=require(_0xba04('0x1'));var path=require(_0xba04('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xba04('0x3')]();var fs_extra=require(_0xba04('0x4'));var auth=require(_0xba04('0x5'));var interaction=require(_0xba04('0x6'));var config=require(_0xba04('0x7'));var controller=require('./intVtigerField.controller');router[_0xba04('0x8')]('/',auth[_0xba04('0x9')](),controller[_0xba04('0xa')]);router[_0xba04('0x8')](_0xba04('0xb'),auth['isAuthenticated'](),controller[_0xba04('0xc')]);router[_0xba04('0xd')]('/',auth[_0xba04('0x9')](),controller[_0xba04('0xe')]);router['put'](_0xba04('0xb'),auth[_0xba04('0x9')](),controller['update']);router[_0xba04('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xba04('0x10')]);module[_0xba04('0x11')]=router; \ No newline at end of file +var _0xbd99=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','index','/:id','isAuthenticated','show','post','create','put','update','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3bff73,_0x758311){var _0x2d96b7=function(_0x4d031e){while(--_0x4d031e){_0x3bff73['push'](_0x3bff73['shift']());}};_0x2d96b7(++_0x758311);}(_0xbd99,0xf0));var _0x9bd9=function(_0x22a1f7,_0x3f0edf){_0x22a1f7=_0x22a1f7-0x0;var _0x68ebd5=_0xbd99[_0x22a1f7];return _0x68ebd5;};'use strict';var multer=require(_0x9bd9('0x0'));var util=require(_0x9bd9('0x1'));var path=require(_0x9bd9('0x2'));var timeout=require(_0x9bd9('0x3'));var express=require(_0x9bd9('0x4'));var router=express[_0x9bd9('0x5')]();var fs_extra=require(_0x9bd9('0x6'));var auth=require(_0x9bd9('0x7'));var interaction=require(_0x9bd9('0x8'));var config=require(_0x9bd9('0x9'));var controller=require(_0x9bd9('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x9bd9('0xb')]);router['get'](_0x9bd9('0xc'),auth[_0x9bd9('0xd')](),controller[_0x9bd9('0xe')]);router[_0x9bd9('0xf')]('/',auth[_0x9bd9('0xd')](),controller[_0x9bd9('0x10')]);router[_0x9bd9('0x11')](_0x9bd9('0xc'),auth['isAuthenticated'](),controller[_0x9bd9('0x12')]);router['delete'](_0x9bd9('0xc'),auth[_0x9bd9('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 8ea38d1..9d2828d 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 _0x806e=['exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM'];(function(_0x413aac,_0x5e2430){var _0x569b11=function(_0x52e060){while(--_0x52e060){_0x413aac['push'](_0x413aac['shift']());}};_0x569b11(++_0x5e2430);}(_0x806e,0x150));var _0xe806=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x806e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xe806('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe806('0x1'),_0xe806('0x2'),_0xe806('0x3'),_0xe806('0x4'),_0xe806('0x5')),'defaultValue':_0xe806('0x1')},'content':{'type':Sequelize[_0xe806('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe806('0x7')](_0xe806('0x1'),_0xe806('0x2'),_0xe806('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xe806('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe806('0x6')]}}; \ No newline at end of file +var _0x8331=['exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x50650d,_0x4c2c28){var _0x55f9d4=function(_0x57bfdc){while(--_0x57bfdc){_0x50650d['push'](_0x50650d['shift']());}};_0x55f9d4(++_0x4c2c28);}(_0x8331,0x180));var _0x1833=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0x8331[_0x1a9204];return _0x17ca68;};'use strict';var Sequelize=require('sequelize');module[_0x1833('0x0')]={'type':{'type':Sequelize[_0x1833('0x1')](_0x1833('0x2'),_0x1833('0x3'),_0x1833('0x4'),'keyValue',_0x1833('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1833('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1833('0x1')]('string',_0x1833('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x1833('0x6')]},'idField':{'type':Sequelize[_0x1833('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1833('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1833('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5f08b4a..e760d54 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 _0xa90a=['type','key','model','keys','filters','query','fields','attributes','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','create','body','find','rimraf','fast-json-patch','bluebird','mustache','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','VtigerField','rawAttributes','fieldName'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa90a,0xb4));var _0xaa90=function(_0x377bf8,_0xf4d2e9){_0x377bf8=_0x377bf8-0x0;var _0x58ab9f=_0xa90a[_0x377bf8];return _0x58ab9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa90('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa90('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaa90('0x2'));var Mustache=require(_0xaa90('0x3'));var util=require('util');var path=require(_0xaa90('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaa90('0x5'));var fs=require('fs');var fs_extra=require(_0xaa90('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa90('0x7'));var jsforce=require(_0xaa90('0x8'));var deskjs=require(_0xaa90('0x9'));var toCsv=require(_0xaa90('0xa'));var querystring=require(_0xaa90('0xb'));var Papa=require(_0xaa90('0xc'));var Redis=require(_0xaa90('0xd'));var authService=require(_0xaa90('0xe'));var qs=require(_0xaa90('0xf'));var as=require(_0xaa90('0x10'));var hardwareService=require(_0xaa90('0x11'));var logger=require(_0xaa90('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xaa90('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xaa90('0x14'))['db'];function respondWithStatusCode(_0xfa92d4,_0x228324){_0x228324=_0x228324||0xcc;return function(_0x28c573){if(_0x28c573){return _0xfa92d4['sendStatus'](_0x228324);}return _0xfa92d4[_0xaa90('0x15')](_0x228324)[_0xaa90('0x16')]();};}function respondWithResult(_0x40cd85,_0x2c6309){_0x2c6309=_0x2c6309||0xc8;return function(_0x852d98){if(_0x852d98){return _0x40cd85['status'](_0x2c6309)[_0xaa90('0x17')](_0x852d98);}};}function respondWithFilteredResult(_0x393587,_0x4ff79e){return function(_0x2b6a8d){if(_0x2b6a8d){var _0x64c368=typeof _0x4ff79e[_0xaa90('0x18')]===_0xaa90('0x19')&&typeof _0x4ff79e[_0xaa90('0x1a')]===_0xaa90('0x19');var _0x532bdd=_0x2b6a8d[_0xaa90('0x1b')];var _0x104ace=_0x64c368?0x0:_0x4ff79e['offset'];var _0x135f81=_0x64c368?_0x2b6a8d[_0xaa90('0x1b')]:_0x4ff79e['offset']+_0x4ff79e['limit'];var _0x2d459a;if(_0x135f81>=_0x532bdd){_0x135f81=_0x532bdd;_0x2d459a=0xc8;}else{_0x2d459a=0xce;}_0x393587[_0xaa90('0x15')](_0x2d459a);return _0x393587[_0xaa90('0x1c')](_0xaa90('0x1d'),_0x104ace+'-'+_0x135f81+'/'+_0x532bdd)[_0xaa90('0x17')](_0x2b6a8d);}return null;};}function patchUpdates(_0x1544a8){return function(_0x2e5a7c){try{jsonpatch[_0xaa90('0x1e')](_0x2e5a7c,_0x1544a8,!![]);}catch(_0x49ddc6){return BPromise[_0xaa90('0x1f')](_0x49ddc6);}return _0x2e5a7c[_0xaa90('0x20')]();};}function saveUpdates(_0x414d81,_0x190906){return function(_0x206222){if(_0x206222){return _0x206222[_0xaa90('0x21')](_0x414d81)[_0xaa90('0x22')](function(_0x5b8dc2){return _0x5b8dc2;});}return null;};}function removeEntity(_0x18e74d,_0x3790e6){return function(_0x11107c){if(_0x11107c){return _0x11107c[_0xaa90('0x23')]()['then'](function(){_0x18e74d[_0xaa90('0x15')](0xcc)[_0xaa90('0x16')]();});}};}function handleEntityNotFound(_0x3cb767,_0x5d8b90){return function(_0x3e4cdc){if(!_0x3e4cdc){_0x3cb767[_0xaa90('0x24')](0x194);}return _0x3e4cdc;};}function handleError(_0x408be8,_0x57e447){_0x57e447=_0x57e447||0x1f4;return function(_0x121ad2){logger[_0xaa90('0x25')](_0x121ad2[_0xaa90('0x26')]);if(_0x121ad2['name']){delete _0x121ad2[_0xaa90('0x27')];}_0x408be8['status'](_0x57e447)[_0xaa90('0x28')](_0x121ad2);};}exports[_0xaa90('0x29')]=function(_0x1eb40c,_0x19df28){var _0x22a690={},_0xd62f9f={},_0x27f529={'count':0x0,'rows':[]};var _0x253ad2=_['map'](db[_0xaa90('0x2a')][_0xaa90('0x2b')],function(_0x42b6a7){return{'name':_0x42b6a7[_0xaa90('0x2c')],'type':_0x42b6a7[_0xaa90('0x2d')][_0xaa90('0x2e')]};});_0xd62f9f[_0xaa90('0x2f')]=_['map'](_0x253ad2,'name');_0xd62f9f['query']=_[_0xaa90('0x30')](_0x1eb40c['query']);_0xd62f9f[_0xaa90('0x31')]=_['intersection'](_0xd62f9f[_0xaa90('0x2f')],_0xd62f9f[_0xaa90('0x32')]);_0x22a690['attributes']=_['intersection'](_0xd62f9f[_0xaa90('0x2f')],qs[_0xaa90('0x33')](_0x1eb40c[_0xaa90('0x32')][_0xaa90('0x33')]));_0x22a690[_0xaa90('0x34')]=_0x22a690['attributes']['length']?_0x22a690[_0xaa90('0x34')]:_0xd62f9f[_0xaa90('0x2f')];if(!_0x1eb40c[_0xaa90('0x32')]['hasOwnProperty'](_0xaa90('0x35'))){_0x22a690[_0xaa90('0x1a')]=qs[_0xaa90('0x1a')](_0x1eb40c[_0xaa90('0x32')]['limit']);_0x22a690[_0xaa90('0x18')]=qs['offset'](_0x1eb40c[_0xaa90('0x32')]['offset']);}_0x22a690[_0xaa90('0x36')]=qs[_0xaa90('0x37')](_0x1eb40c[_0xaa90('0x32')][_0xaa90('0x37')]);_0x22a690[_0xaa90('0x38')]=qs['filters'](_[_0xaa90('0x39')](_0x1eb40c[_0xaa90('0x32')],_0xd62f9f[_0xaa90('0x31')]),_0x253ad2);if(_0x1eb40c[_0xaa90('0x32')][_0xaa90('0x3a')]){_0x22a690[_0xaa90('0x38')]=_[_0xaa90('0x3b')](_0x22a690['where'],{'$or':_[_0xaa90('0x3c')](_0x253ad2,function(_0x4be508){if(_0x4be508[_0xaa90('0x2d')]!==_0xaa90('0x3d')){var _0x11e168={};_0x11e168[_0x4be508['name']]={'$like':'%'+_0x1eb40c['query'][_0xaa90('0x3a')]+'%'};return _0x11e168;}})});}_0x22a690=_[_0xaa90('0x3b')]({},_0x22a690,_0x1eb40c[_0xaa90('0x3e')]);var _0x23e4fa={'where':_0x22a690[_0xaa90('0x38')]};return db[_0xaa90('0x2a')][_0xaa90('0x1b')](_0x23e4fa)[_0xaa90('0x22')](function(_0x2ceebc){_0x27f529[_0xaa90('0x1b')]=_0x2ceebc;if(_0x1eb40c['query']['includeAll']){_0x22a690[_0xaa90('0x3f')]=[{'all':!![]}];}return db[_0xaa90('0x2a')][_0xaa90('0x40')](_0x22a690);})[_0xaa90('0x22')](function(_0xaedd2c){_0x27f529[_0xaa90('0x41')]=_0xaedd2c;return _0x27f529;})[_0xaa90('0x22')](respondWithFilteredResult(_0x19df28,_0x22a690))[_0xaa90('0x42')](handleError(_0x19df28,null));};exports[_0xaa90('0x43')]=function(_0x3abc4c,_0x4d7970){var _0x5b4cc4={'raw':!![],'where':{'id':_0x3abc4c[_0xaa90('0x44')]['id']}},_0x3feea7={};_0x3feea7[_0xaa90('0x2f')]=_['keys'](db['VtigerField']['rawAttributes']);_0x3feea7['query']=_['keys'](_0x3abc4c[_0xaa90('0x32')]);_0x3feea7[_0xaa90('0x31')]=_[_0xaa90('0x45')](_0x3feea7[_0xaa90('0x2f')],_0x3feea7[_0xaa90('0x32')]);_0x5b4cc4['attributes']=_[_0xaa90('0x45')](_0x3feea7[_0xaa90('0x2f')],qs[_0xaa90('0x33')](_0x3abc4c[_0xaa90('0x32')]['fields']));_0x5b4cc4['attributes']=_0x5b4cc4['attributes'][_0xaa90('0x46')]?_0x5b4cc4['attributes']:_0x3feea7[_0xaa90('0x2f')];if(_0x3abc4c[_0xaa90('0x32')][_0xaa90('0x47')]){_0x5b4cc4['include']=[{'all':!![]}];}_0x5b4cc4=_['merge']({},_0x5b4cc4,_0x3abc4c[_0xaa90('0x3e')]);return db[_0xaa90('0x2a')]['find'](_0x5b4cc4)[_0xaa90('0x22')](handleEntityNotFound(_0x4d7970,null))[_0xaa90('0x22')](respondWithResult(_0x4d7970,null))[_0xaa90('0x42')](handleError(_0x4d7970,null));};exports['create']=function(_0x2258cb,_0x527c16){return db[_0xaa90('0x2a')][_0xaa90('0x48')](_0x2258cb[_0xaa90('0x49')],{})[_0xaa90('0x22')](respondWithResult(_0x527c16,0xc9))['catch'](handleError(_0x527c16,null));};exports['update']=function(_0x2d205b,_0x20e2d3){if(_0x2d205b[_0xaa90('0x49')]['id']){delete _0x2d205b[_0xaa90('0x49')]['id'];}return db[_0xaa90('0x2a')][_0xaa90('0x4a')]({'where':{'id':_0x2d205b['params']['id']}})[_0xaa90('0x22')](handleEntityNotFound(_0x20e2d3,null))[_0xaa90('0x22')](saveUpdates(_0x2d205b[_0xaa90('0x49')],null))['then'](respondWithResult(_0x20e2d3,null))[_0xaa90('0x42')](handleError(_0x20e2d3,null));};exports['destroy']=function(_0x512418,_0x9504c5){return db[_0xaa90('0x2a')][_0xaa90('0x4a')]({'where':{'id':_0x512418[_0xaa90('0x44')]['id']}})[_0xaa90('0x22')](handleEntityNotFound(_0x9504c5,null))['then'](removeEntity(_0x9504c5,null))[_0xaa90('0x42')](handleError(_0x9504c5,null));}; \ No newline at end of file +var _0x60a0=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','VtigerField','findAll','rows','catch','show','rawAttributes','includeAll','find','body','params','eml-format','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map'];(function(_0x31043f,_0x36aa0d){var _0x145387=function(_0x12dd2f){while(--_0x12dd2f){_0x31043f['push'](_0x31043f['shift']());}};_0x145387(++_0x36aa0d);}(_0x60a0,0x1e1));var _0x060a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x60a0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x060a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x060a('0x1'));var rp=require('request-promise');var moment=require(_0x060a('0x2'));var BPromise=require(_0x060a('0x3'));var Mustache=require('mustache');var util=require(_0x060a('0x4'));var path=require(_0x060a('0x5'));var sox=require(_0x060a('0x6'));var csv=require(_0x060a('0x7'));var ejs=require(_0x060a('0x8'));var fs=require('fs');var fs_extra=require(_0x060a('0x9'));var _=require(_0x060a('0xa'));var squel=require('squel');var crypto=require(_0x060a('0xb'));var jsforce=require(_0x060a('0xc'));var deskjs=require(_0x060a('0xd'));var toCsv=require(_0x060a('0x7'));var querystring=require(_0x060a('0xe'));var Papa=require(_0x060a('0xf'));var Redis=require('ioredis');var authService=require(_0x060a('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x060a('0x11'));var hardwareService=require(_0x060a('0x12'));var logger=require(_0x060a('0x13'))(_0x060a('0x14'));var utils=require(_0x060a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x060a('0x16'))['db'];function respondWithStatusCode(_0x378478,_0x10e7a6){_0x10e7a6=_0x10e7a6||0xcc;return function(_0x5aaccc){if(_0x5aaccc){return _0x378478[_0x060a('0x17')](_0x10e7a6);}return _0x378478[_0x060a('0x18')](_0x10e7a6)[_0x060a('0x19')]();};}function respondWithResult(_0x27c769,_0x183017){_0x183017=_0x183017||0xc8;return function(_0x14ab70){if(_0x14ab70){return _0x27c769[_0x060a('0x18')](_0x183017)[_0x060a('0x1a')](_0x14ab70);}};}function respondWithFilteredResult(_0x2de0ba,_0x3a77d4){return function(_0x47def1){if(_0x47def1){var _0x1835ae=typeof _0x3a77d4[_0x060a('0x1b')]==='undefined'&&typeof _0x3a77d4[_0x060a('0x1c')]===_0x060a('0x1d');var _0x416ab8=_0x47def1[_0x060a('0x1e')];var _0x40fee5=_0x1835ae?0x0:_0x3a77d4[_0x060a('0x1b')];var _0x416f73=_0x1835ae?_0x47def1[_0x060a('0x1e')]:_0x3a77d4[_0x060a('0x1b')]+_0x3a77d4['limit'];var _0xe329f9;if(_0x416f73>=_0x416ab8){_0x416f73=_0x416ab8;_0xe329f9=0xc8;}else{_0xe329f9=0xce;}_0x2de0ba[_0x060a('0x18')](_0xe329f9);return _0x2de0ba[_0x060a('0x1f')](_0x060a('0x20'),_0x40fee5+'-'+_0x416f73+'/'+_0x416ab8)[_0x060a('0x1a')](_0x47def1);}return null;};}function patchUpdates(_0x4de504){return function(_0x11e2fc){try{jsonpatch[_0x060a('0x21')](_0x11e2fc,_0x4de504,!![]);}catch(_0x4d053a){return BPromise[_0x060a('0x22')](_0x4d053a);}return _0x11e2fc[_0x060a('0x23')]();};}function saveUpdates(_0x407704,_0x3a52d6){return function(_0x5dec63){if(_0x5dec63){return _0x5dec63[_0x060a('0x24')](_0x407704)['then'](function(_0x3bd1b8){return _0x3bd1b8;});}return null;};}function removeEntity(_0x4153f8,_0x1f5cb1){return function(_0x36dddb){if(_0x36dddb){return _0x36dddb[_0x060a('0x25')]()[_0x060a('0x26')](function(){_0x4153f8['status'](0xcc)[_0x060a('0x19')]();});}};}function handleEntityNotFound(_0x53b420,_0x743d5){return function(_0x7cbba2){if(!_0x7cbba2){_0x53b420['sendStatus'](0x194);}return _0x7cbba2;};}function handleError(_0x6e4c01,_0x46d279){_0x46d279=_0x46d279||0x1f4;return function(_0x57967c){logger[_0x060a('0x27')](_0x57967c['stack']);if(_0x57967c[_0x060a('0x28')]){delete _0x57967c[_0x060a('0x28')];}_0x6e4c01['status'](_0x46d279)[_0x060a('0x29')](_0x57967c);};}exports[_0x060a('0x2a')]=function(_0x3d0cc6,_0x18acff){var _0x212e0f={},_0x5e9e94={},_0x955097={'count':0x0,'rows':[]};var _0x1a5749=_[_0x060a('0x2b')](db['VtigerField']['rawAttributes'],function(_0x119a2f){return{'name':_0x119a2f[_0x060a('0x2c')],'type':_0x119a2f[_0x060a('0x2d')][_0x060a('0x2e')]};});_0x5e9e94[_0x060a('0x2f')]=_['map'](_0x1a5749,_0x060a('0x28'));_0x5e9e94[_0x060a('0x30')]=_[_0x060a('0x31')](_0x3d0cc6[_0x060a('0x30')]);_0x5e9e94[_0x060a('0x32')]=_[_0x060a('0x33')](_0x5e9e94['model'],_0x5e9e94['query']);_0x212e0f[_0x060a('0x34')]=_['intersection'](_0x5e9e94[_0x060a('0x2f')],qs[_0x060a('0x35')](_0x3d0cc6[_0x060a('0x30')]['fields']));_0x212e0f['attributes']=_0x212e0f[_0x060a('0x34')][_0x060a('0x36')]?_0x212e0f[_0x060a('0x34')]:_0x5e9e94[_0x060a('0x2f')];if(!_0x3d0cc6[_0x060a('0x30')][_0x060a('0x37')](_0x060a('0x38'))){_0x212e0f[_0x060a('0x1c')]=qs[_0x060a('0x1c')](_0x3d0cc6[_0x060a('0x30')][_0x060a('0x1c')]);_0x212e0f['offset']=qs[_0x060a('0x1b')](_0x3d0cc6[_0x060a('0x30')][_0x060a('0x1b')]);}_0x212e0f[_0x060a('0x39')]=qs[_0x060a('0x3a')](_0x3d0cc6['query'][_0x060a('0x3a')]);_0x212e0f[_0x060a('0x3b')]=qs[_0x060a('0x32')](_['pick'](_0x3d0cc6[_0x060a('0x30')],_0x5e9e94[_0x060a('0x32')]),_0x1a5749);if(_0x3d0cc6[_0x060a('0x30')][_0x060a('0x3c')]){_0x212e0f[_0x060a('0x3b')]=_['merge'](_0x212e0f[_0x060a('0x3b')],{'$or':_[_0x060a('0x2b')](_0x1a5749,function(_0x39dea2){if(_0x39dea2[_0x060a('0x2d')]!==_0x060a('0x3d')){var _0x5689dd={};_0x5689dd[_0x39dea2['name']]={'$like':'%'+_0x3d0cc6[_0x060a('0x30')][_0x060a('0x3c')]+'%'};return _0x5689dd;}})});}_0x212e0f=_[_0x060a('0x3e')]({},_0x212e0f,_0x3d0cc6[_0x060a('0x3f')]);var _0x41adf6={'where':_0x212e0f[_0x060a('0x3b')]};return db['VtigerField'][_0x060a('0x1e')](_0x41adf6)[_0x060a('0x26')](function(_0x15240f){_0x955097['count']=_0x15240f;if(_0x3d0cc6[_0x060a('0x30')]['includeAll']){_0x212e0f[_0x060a('0x40')]=[{'all':!![]}];}return db[_0x060a('0x41')][_0x060a('0x42')](_0x212e0f);})[_0x060a('0x26')](function(_0x34fa1c){_0x955097[_0x060a('0x43')]=_0x34fa1c;return _0x955097;})[_0x060a('0x26')](respondWithFilteredResult(_0x18acff,_0x212e0f))[_0x060a('0x44')](handleError(_0x18acff,null));};exports[_0x060a('0x45')]=function(_0x521a2e,_0x117a78){var _0x5b0d20={'raw':!![],'where':{'id':_0x521a2e['params']['id']}},_0x3f00fe={};_0x3f00fe[_0x060a('0x2f')]=_[_0x060a('0x31')](db[_0x060a('0x41')][_0x060a('0x46')]);_0x3f00fe[_0x060a('0x30')]=_['keys'](_0x521a2e[_0x060a('0x30')]);_0x3f00fe['filters']=_[_0x060a('0x33')](_0x3f00fe[_0x060a('0x2f')],_0x3f00fe[_0x060a('0x30')]);_0x5b0d20[_0x060a('0x34')]=_[_0x060a('0x33')](_0x3f00fe[_0x060a('0x2f')],qs[_0x060a('0x35')](_0x521a2e['query']['fields']));_0x5b0d20[_0x060a('0x34')]=_0x5b0d20[_0x060a('0x34')][_0x060a('0x36')]?_0x5b0d20[_0x060a('0x34')]:_0x3f00fe[_0x060a('0x2f')];if(_0x521a2e['query'][_0x060a('0x47')]){_0x5b0d20[_0x060a('0x40')]=[{'all':!![]}];}_0x5b0d20=_[_0x060a('0x3e')]({},_0x5b0d20,_0x521a2e[_0x060a('0x3f')]);return db[_0x060a('0x41')][_0x060a('0x48')](_0x5b0d20)[_0x060a('0x26')](handleEntityNotFound(_0x117a78,null))[_0x060a('0x26')](respondWithResult(_0x117a78,null))[_0x060a('0x44')](handleError(_0x117a78,null));};exports['create']=function(_0x276471,_0x5eb465){return db[_0x060a('0x41')]['create'](_0x276471[_0x060a('0x49')],{})['then'](respondWithResult(_0x5eb465,0xc9))['catch'](handleError(_0x5eb465,null));};exports[_0x060a('0x24')]=function(_0x4fcb98,_0x451c98){if(_0x4fcb98[_0x060a('0x49')]['id']){delete _0x4fcb98[_0x060a('0x49')]['id'];}return db[_0x060a('0x41')][_0x060a('0x48')]({'where':{'id':_0x4fcb98[_0x060a('0x4a')]['id']}})[_0x060a('0x26')](handleEntityNotFound(_0x451c98,null))[_0x060a('0x26')](saveUpdates(_0x4fcb98[_0x060a('0x49')],null))[_0x060a('0x26')](respondWithResult(_0x451c98,null))['catch'](handleError(_0x451c98,null));};exports['destroy']=function(_0xa76bd6,_0x163e29){return db[_0x060a('0x41')]['find']({'where':{'id':_0xa76bd6[_0x060a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x163e29,null))['then'](removeEntity(_0x163e29,null))[_0x060a('0x44')](handleError(_0x163e29,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 0a63856..6893fc2 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 _0xc9b1=['VtigerField','int_vtiger_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0xc9b1,0x66));var _0x1c9b=function(_0x576abd,_0x3bac48){_0x576abd=_0x576abd-0x0;var _0x3d54ab=_0xc9b1[_0x576abd];return _0x3d54ab;};'use strict';var _=require(_0x1c9b('0x0'));var util=require(_0x1c9b('0x1'));var logger=require(_0x1c9b('0x2'))(_0x1c9b('0x3'));var moment=require(_0x1c9b('0x4'));var BPromise=require(_0x1c9b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c9b('0x6'));var rimraf=require(_0x1c9b('0x7'));var config=require(_0x1c9b('0x8'));var attributes=require('./intVtigerField.attributes');module['exports']=function(_0x2cb1c3,_0x594074){return _0x2cb1c3[_0x1c9b('0x9')](_0x1c9b('0xa'),attributes,{'tableName':_0x1c9b('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x1c9b('0xc'),_0x1c9b('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd3ef=['moment','bluebird','request-promise','path','rimraf','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','util','api'];(function(_0x17213c,_0x18a955){var _0x4f1628=function(_0x3e6361){while(--_0x3e6361){_0x17213c['push'](_0x17213c['shift']());}};_0x4f1628(++_0x18a955);}(_0xd3ef,0x1d2));var _0xfd3e=function(_0x1f5143,_0x5e31e6){_0x1f5143=_0x1f5143-0x0;var _0x383a38=_0xd3ef[_0x1f5143];return _0x383a38;};'use strict';var _=require('lodash');var util=require(_0xfd3e('0x0'));var logger=require('../../config/logger')(_0xfd3e('0x1'));var moment=require(_0xfd3e('0x2'));var BPromise=require(_0xfd3e('0x3'));var rp=require(_0xfd3e('0x4'));var fs=require('fs');var path=require(_0xfd3e('0x5'));var rimraf=require(_0xfd3e('0x6'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0xfd3e('0x7')]=function(_0x221067,_0x152c37){return _0x221067[_0xfd3e('0x8')](_0xfd3e('0x9'),attributes,{'tableName':_0xfd3e('0xa'),'paranoid':![],'indexes':[{'name':_0xfd3e('0xb'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index 2be3c6f..17242e2 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 _0xebd0=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','VtigerField,\x20%s,\x20%s','message'];(function(_0xe9660d,_0x5801c9){var _0x167062=function(_0x35c9d7){while(--_0x35c9d7){_0xe9660d['push'](_0xe9660d['shift']());}};_0x167062(++_0x5801c9);}(_0xebd0,0x1b1));var _0x0ebd=function(_0x5b4362,_0x2ec5e6){_0x5b4362=_0x5b4362-0x0;var _0x3a72be=_0xebd0[_0x5b4362];return _0x3a72be;};'use strict';var _=require('lodash');var util=require(_0x0ebd('0x0'));var moment=require(_0x0ebd('0x1'));var BPromise=require(_0x0ebd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ebd('0x3'));var db=require(_0x0ebd('0x4'))['db'];var utils=require(_0x0ebd('0x5'));var logger=require('../../config/logger')(_0x0ebd('0x6'));var config=require('../../config/environment');var jayson=require(_0x0ebd('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x537010,_0x910ab1,_0x28b6d3){return new BPromise(function(_0x460f03,_0x258035){return client['request'](_0x537010,_0x28b6d3)[_0x0ebd('0x8')](function(_0x1c82a5){logger[_0x0ebd('0x9')]('VtigerField,\x20%s,\x20%s',_0x910ab1,_0x0ebd('0xa'));logger[_0x0ebd('0xb')](_0x0ebd('0xc'),_0x910ab1,_0x0ebd('0xa'),JSON[_0x0ebd('0xd')](_0x1c82a5));if(_0x1c82a5[_0x0ebd('0xe')]){if(_0x1c82a5[_0x0ebd('0xe')]['code']===0x1f4){logger[_0x0ebd('0xe')](_0x0ebd('0xf'),_0x910ab1,_0x1c82a5['error'][_0x0ebd('0x10')]);return _0x258035(_0x1c82a5[_0x0ebd('0xe')][_0x0ebd('0x10')]);}logger[_0x0ebd('0xe')](_0x0ebd('0xf'),_0x910ab1,_0x1c82a5[_0x0ebd('0xe')][_0x0ebd('0x10')]);return _0x460f03(_0x1c82a5[_0x0ebd('0xe')][_0x0ebd('0x10')]);}else{logger[_0x0ebd('0x9')](_0x0ebd('0xf'),_0x910ab1,'request\x20sent');_0x460f03(_0x1c82a5['result'][_0x0ebd('0x10')]);}})[_0x0ebd('0x11')](function(_0x2a746c){logger['error'](_0x0ebd('0xf'),_0x910ab1,_0x2a746c);_0x258035(_0x2a746c);});});} \ No newline at end of file +var _0x1b70=['client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1b70,0xb6));var _0x01b7=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x1b70[_0x500c0];return _0xdd146f;};'use strict';var _=require(_0x01b7('0x0'));var util=require(_0x01b7('0x1'));var moment=require('moment');var BPromise=require(_0x01b7('0x2'));var rs=require(_0x01b7('0x3'));var fs=require('fs');var Redis=require(_0x01b7('0x4'));var db=require(_0x01b7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x01b7('0x6'))(_0x01b7('0x7'));var config=require(_0x01b7('0x8'));var jayson=require(_0x01b7('0x9'));var client=jayson[_0x01b7('0xa')][_0x01b7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ca3d5,_0x2d3b7c,_0x3aba1d){return new BPromise(function(_0x56286e,_0xfd0c57){return client[_0x01b7('0xc')](_0x1ca3d5,_0x3aba1d)[_0x01b7('0xd')](function(_0x4346f1){logger['info'](_0x01b7('0xe'),_0x2d3b7c,_0x01b7('0xf'));logger[_0x01b7('0x10')](_0x01b7('0x11'),_0x2d3b7c,_0x01b7('0xf'),JSON['stringify'](_0x4346f1));if(_0x4346f1['error']){if(_0x4346f1[_0x01b7('0x12')][_0x01b7('0x13')]===0x1f4){logger['error'](_0x01b7('0xe'),_0x2d3b7c,_0x4346f1[_0x01b7('0x12')][_0x01b7('0x14')]);return _0xfd0c57(_0x4346f1[_0x01b7('0x12')][_0x01b7('0x14')]);}logger[_0x01b7('0x12')](_0x01b7('0xe'),_0x2d3b7c,_0x4346f1[_0x01b7('0x12')][_0x01b7('0x14')]);return _0x56286e(_0x4346f1[_0x01b7('0x12')][_0x01b7('0x14')]);}else{logger[_0x01b7('0x15')]('VtigerField,\x20%s,\x20%s',_0x2d3b7c,'request\x20sent');_0x56286e(_0x4346f1[_0x01b7('0x16')]['message']);}})[_0x01b7('0x17')](function(_0x5aaca7){logger[_0x01b7('0x12')](_0x01b7('0xe'),_0x2d3b7c,_0x5aaca7);_0xfd0c57(_0x5aaca7);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 8a2ae88..ae79c64 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 _0x53ea=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x356005,_0x411466){var _0x2bb35b=function(_0x449cfb){while(--_0x449cfb){_0x356005['push'](_0x356005['shift']());}};_0x2bb35b(++_0x411466);}(_0x53ea,0x16c));var _0xa53e=function(_0x896589,_0x281b66){_0x896589=_0x896589-0x0;var _0x54e664=_0x53ea[_0x896589];return _0x54e664;};'use strict';var multer=require(_0xa53e('0x0'));var util=require(_0xa53e('0x1'));var path=require(_0xa53e('0x2'));var timeout=require(_0xa53e('0x3'));var express=require(_0xa53e('0x4'));var router=express['Router']();var fs_extra=require(_0xa53e('0x5'));var auth=require(_0xa53e('0x6'));var interaction=require(_0xa53e('0x7'));var config=require(_0xa53e('0x8'));var controller=require(_0xa53e('0x9'));router[_0xa53e('0xa')]('/',auth[_0xa53e('0xb')](),controller[_0xa53e('0xc')]);router['get'](_0xa53e('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xa53e('0xe'),auth[_0xa53e('0xb')](),controller[_0xa53e('0xf')]);router['get'](_0xa53e('0x10'),auth[_0xa53e('0xb')](),controller[_0xa53e('0x11')]);router[_0xa53e('0x12')]('/',auth[_0xa53e('0xb')](),controller['create']);router[_0xa53e('0x12')](_0xa53e('0xe'),auth['isAuthenticated'](),controller[_0xa53e('0x13')]);router[_0xa53e('0x14')](_0xa53e('0xd'),auth[_0xa53e('0xb')](),controller['update']);router[_0xa53e('0x15')](_0xa53e('0xd'),auth[_0xa53e('0xb')](),controller[_0xa53e('0x16')]);module['exports']=router; \ No newline at end of file +var _0x9c51=['create','addConfiguration','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','getFields','post'];(function(_0x5b50a8,_0x3c22c1){var _0x573b78=function(_0x3b74e3){while(--_0x3b74e3){_0x5b50a8['push'](_0x5b50a8['shift']());}};_0x573b78(++_0x3c22c1);}(_0x9c51,0x8f));var _0x19c5=function(_0x163a5f,_0x500870){_0x163a5f=_0x163a5f-0x0;var _0x23a1fe=_0x9c51[_0x163a5f];return _0x23a1fe;};'use strict';var multer=require(_0x19c5('0x0'));var util=require(_0x19c5('0x1'));var path=require(_0x19c5('0x2'));var timeout=require(_0x19c5('0x3'));var express=require('express');var router=express[_0x19c5('0x4')]();var fs_extra=require(_0x19c5('0x5'));var auth=require(_0x19c5('0x6'));var interaction=require(_0x19c5('0x7'));var config=require(_0x19c5('0x8'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x19c5('0x9')](),controller[_0x19c5('0xa')]);router[_0x19c5('0xb')](_0x19c5('0xc'),auth[_0x19c5('0x9')](),controller[_0x19c5('0xd')]);router['get'](_0x19c5('0xe'),auth[_0x19c5('0x9')](),controller[_0x19c5('0xf')]);router['get']('/:id/fields',auth[_0x19c5('0x9')](),controller[_0x19c5('0x10')]);router[_0x19c5('0x11')]('/',auth[_0x19c5('0x9')](),controller[_0x19c5('0x12')]);router[_0x19c5('0x11')](_0x19c5('0xe'),auth[_0x19c5('0x9')](),controller[_0x19c5('0x13')]);router['put'](_0x19c5('0xc'),auth[_0x19c5('0x9')](),controller['update']);router[_0x19c5('0x14')](_0x19c5('0xc'),auth[_0x19c5('0x9')](),controller[_0x19c5('0x15')]);module[_0x19c5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 084f48d..6c18e7a 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 _0xf567=['sequelize','exports','STRING','username','remoteUri','ENUM','token','password','integrationTab','newTab'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xf567,0x118));var _0x7f56=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf567[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x7f56('0x0'));module[_0x7f56('0x1')]={'name':{'type':Sequelize[_0x7f56('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7f56('0x2')],'unique':_0x7f56('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x7f56('0x2')]},'remoteUri':{'type':Sequelize[_0x7f56('0x2')],'unique':_0x7f56('0x4')},'authType':{'type':Sequelize[_0x7f56('0x5')]('password',_0x7f56('0x6')),'defaultValue':_0x7f56('0x7')},'serverUrl':{'type':Sequelize[_0x7f56('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x7f56('0x8'),_0x7f56('0x9')),'defaultValue':_0x7f56('0x8')}}; \ No newline at end of file +var _0xdfb1=['token','password','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x9444d4,_0x9fb7c7){var _0x435330=function(_0x151a93){while(--_0x151a93){_0x9444d4['push'](_0x9444d4['shift']());}};_0x435330(++_0x9fb7c7);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x155020,_0x28d3ad){_0x155020=_0x155020-0x0;var _0x27fcdc=_0xdfb1[_0x155020];return _0x27fcdc;};'use strict';var Sequelize=require(_0x1dfb('0x0'));module[_0x1dfb('0x1')]={'name':{'type':Sequelize[_0x1dfb('0x2')]},'description':{'type':Sequelize[_0x1dfb('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1dfb('0x3')},'password':{'type':Sequelize[_0x1dfb('0x2')]},'token':{'type':Sequelize[_0x1dfb('0x2')]},'remoteUri':{'type':Sequelize[_0x1dfb('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password',_0x1dfb('0x4')),'defaultValue':_0x1dfb('0x5')},'serverUrl':{'type':Sequelize[_0x1dfb('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1dfb('0x6'),_0x1dfb('0x7')),'defaultValue':_0x1dfb('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index b35fec0..33aede7 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 _0x0abf=['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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','error','name','send','index','map','ZendeskAccount','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','destroy','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','toString','base64','Basic\x20%s','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test'];(function(_0x14e7a3,_0x4f853c){var _0x40380a=function(_0x1645bd){while(--_0x1645bd){_0x14e7a3['push'](_0x14e7a3['shift']());}};_0x40380a(++_0x4f853c);}(_0x0abf,0xe8));var _0xf0ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0abf[_0x19e35c];return _0x3e1fe8;};'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 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'];var integrations=require(_0xf0ab('0x17'));function respondWithStatusCode(_0x34ccdc,_0x4fdd5f){_0x4fdd5f=_0x4fdd5f||0xcc;return function(_0x39b4e7){if(_0x39b4e7){return _0x34ccdc[_0xf0ab('0x18')](_0x4fdd5f);}return _0x34ccdc[_0xf0ab('0x19')](_0x4fdd5f)[_0xf0ab('0x1a')]();};}function respondWithResult(_0x1824ef,_0x36cabe){_0x36cabe=_0x36cabe||0xc8;return function(_0x3d7129){if(_0x3d7129){return _0x1824ef[_0xf0ab('0x19')](_0x36cabe)[_0xf0ab('0x1b')](_0x3d7129);}};}function respondWithFilteredResult(_0x3c5bfd,_0x20f453){return function(_0x221bac){if(_0x221bac){var _0x200cf5=typeof _0x20f453[_0xf0ab('0x1c')]===_0xf0ab('0x1d')&&typeof _0x20f453['limit']===_0xf0ab('0x1d');var _0x9e3b47=_0x221bac[_0xf0ab('0x1e')];var _0x1ffeb5=_0x200cf5?0x0:_0x20f453[_0xf0ab('0x1c')];var _0xb9a33=_0x200cf5?_0x221bac[_0xf0ab('0x1e')]:_0x20f453[_0xf0ab('0x1c')]+_0x20f453[_0xf0ab('0x1f')];var _0x1874a5;if(_0xb9a33>=_0x9e3b47){_0xb9a33=_0x9e3b47;_0x1874a5=0xc8;}else{_0x1874a5=0xce;}_0x3c5bfd[_0xf0ab('0x19')](_0x1874a5);return _0x3c5bfd[_0xf0ab('0x20')](_0xf0ab('0x21'),_0x1ffeb5+'-'+_0xb9a33+'/'+_0x9e3b47)[_0xf0ab('0x1b')](_0x221bac);}return null;};}function patchUpdates(_0x2cd961){return function(_0x45c1c9){try{jsonpatch['apply'](_0x45c1c9,_0x2cd961,!![]);}catch(_0x153492){return BPromise[_0xf0ab('0x22')](_0x153492);}return _0x45c1c9[_0xf0ab('0x23')]();};}function saveUpdates(_0x11ab3a,_0x3bf6a1){return function(_0x374531){if(_0x374531){return _0x374531[_0xf0ab('0x24')](_0x11ab3a)[_0xf0ab('0x25')](function(_0x36ad01){return _0x36ad01;});}return null;};}function removeEntity(_0x18bb37,_0x43119f){return function(_0x5645b2){if(_0x5645b2){return _0x5645b2['destroy']()['then'](function(){_0x18bb37[_0xf0ab('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3eca32,_0x16b979){return function(_0x51ac90){if(!_0x51ac90){_0x3eca32[_0xf0ab('0x18')](0x194);}return _0x51ac90;};}function handleError(_0x22671e,_0x10bf5f){_0x10bf5f=_0x10bf5f||0x1f4;return function(_0x38fb71){logger[_0xf0ab('0x26')](_0x38fb71['stack']);if(_0x38fb71[_0xf0ab('0x27')]){delete _0x38fb71['name'];}_0x22671e['status'](_0x10bf5f)[_0xf0ab('0x28')](_0x38fb71);};}exports[_0xf0ab('0x29')]=function(_0x1b223d,_0x445160){var _0x43476c={},_0x174052={},_0x367302={'count':0x0,'rows':[]};var _0x14da9c=_[_0xf0ab('0x2a')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')],function(_0x199753){return{'name':_0x199753['fieldName'],'type':_0x199753[_0xf0ab('0x2d')][_0xf0ab('0x2e')]};});_0x174052['model']=_['map'](_0x14da9c,_0xf0ab('0x27'));_0x174052[_0xf0ab('0x2f')]=_[_0xf0ab('0x30')](_0x1b223d['query']);_0x174052['filters']=_[_0xf0ab('0x31')](_0x174052['model'],_0x174052[_0xf0ab('0x2f')]);_0x43476c['attributes']=_[_0xf0ab('0x31')](_0x174052[_0xf0ab('0x32')],qs['fields'](_0x1b223d['query'][_0xf0ab('0x33')]));_0x43476c[_0xf0ab('0x34')]=_0x43476c[_0xf0ab('0x34')][_0xf0ab('0x35')]?_0x43476c[_0xf0ab('0x34')]:_0x174052[_0xf0ab('0x32')];if(!_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x43476c[_0xf0ab('0x1f')]=qs[_0xf0ab('0x1f')](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x1f')]);_0x43476c[_0xf0ab('0x1c')]=qs['offset'](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x1c')]);}_0x43476c[_0xf0ab('0x38')]=qs['sort'](_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x39')]);_0x43476c[_0xf0ab('0x3a')]=qs['filters'](_[_0xf0ab('0x3b')](_0x1b223d['query'],_0x174052[_0xf0ab('0x3c')]),_0x14da9c);if(_0x1b223d['query'][_0xf0ab('0x3d')]){_0x43476c[_0xf0ab('0x3a')]=_[_0xf0ab('0x3e')](_0x43476c[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x2a')](_0x14da9c,function(_0x1dfb2e){if(_0x1dfb2e['type']!==_0xf0ab('0x3f')){var _0x683d08={};_0x683d08[_0x1dfb2e['name']]={'$like':'%'+_0x1b223d[_0xf0ab('0x2f')][_0xf0ab('0x3d')]+'%'};return _0x683d08;}})});}_0x43476c=_[_0xf0ab('0x3e')]({},_0x43476c,_0x1b223d[_0xf0ab('0x40')]);var _0x31fa72={'where':_0x43476c[_0xf0ab('0x3a')]};return db[_0xf0ab('0x2b')]['count'](_0x31fa72)[_0xf0ab('0x25')](function(_0x4f6e93){_0x367302[_0xf0ab('0x1e')]=_0x4f6e93;if(_0x1b223d['query'][_0xf0ab('0x41')]){_0x43476c[_0xf0ab('0x42')]=[{'all':!![]}];}return db[_0xf0ab('0x2b')][_0xf0ab('0x43')](_0x43476c);})[_0xf0ab('0x25')](function(_0x553d07){_0x367302[_0xf0ab('0x44')]=_0x553d07;return _0x367302;})[_0xf0ab('0x25')](respondWithFilteredResult(_0x445160,_0x43476c))[_0xf0ab('0x45')](handleError(_0x445160,null));};exports[_0xf0ab('0x46')]=function(_0x191caf,_0x17a73){var _0x45849c={'raw':![],'where':{'id':_0x191caf[_0xf0ab('0x47')]['id']}},_0x413f5c={};_0x413f5c[_0xf0ab('0x32')]=_[_0xf0ab('0x30')](db[_0xf0ab('0x2b')][_0xf0ab('0x2c')]);_0x413f5c['query']=_['keys'](_0x191caf[_0xf0ab('0x2f')]);_0x413f5c['filters']=_[_0xf0ab('0x31')](_0x413f5c[_0xf0ab('0x32')],_0x413f5c['query']);_0x45849c[_0xf0ab('0x34')]=_[_0xf0ab('0x31')](_0x413f5c['model'],qs[_0xf0ab('0x33')](_0x191caf[_0xf0ab('0x2f')][_0xf0ab('0x33')]));_0x45849c[_0xf0ab('0x34')]=_0x45849c[_0xf0ab('0x34')][_0xf0ab('0x35')]?_0x45849c[_0xf0ab('0x34')]:_0x413f5c[_0xf0ab('0x32')];if(_0x191caf[_0xf0ab('0x2f')][_0xf0ab('0x41')]){_0x45849c[_0xf0ab('0x42')]=[{'all':!![]}];}_0x45849c=_[_0xf0ab('0x3e')]({},_0x45849c,_0x191caf[_0xf0ab('0x40')]);return db[_0xf0ab('0x2b')]['find'](_0x45849c)['then'](handleEntityNotFound(_0x17a73,null))[_0xf0ab('0x25')](respondWithResult(_0x17a73,null))['catch'](handleError(_0x17a73,null));};exports['create']=function(_0x4e57d3,_0xc3b68d){return db[_0xf0ab('0x2b')][_0xf0ab('0x48')](_0x4e57d3[_0xf0ab('0x49')],{})[_0xf0ab('0x25')](respondWithResult(_0xc3b68d,0xc9))[_0xf0ab('0x45')](handleError(_0xc3b68d,null));};exports[_0xf0ab('0x24')]=function(_0x1a0f21,_0xc6862b){if(_0x1a0f21[_0xf0ab('0x49')]['id']){delete _0x1a0f21[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2b')]['find']({'where':{'id':_0x1a0f21[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0xc6862b,null))[_0xf0ab('0x25')](saveUpdates(_0x1a0f21[_0xf0ab('0x49')],null))[_0xf0ab('0x25')](respondWithResult(_0xc6862b,null))[_0xf0ab('0x45')](handleError(_0xc6862b,null));};exports[_0xf0ab('0x4a')]=function(_0x2e6c5e,_0x47f564){return db['ZendeskAccount']['find']({'where':{'id':_0x2e6c5e[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x47f564,null))['then'](removeEntity(_0x47f564,null))[_0xf0ab('0x45')](handleError(_0x47f564,null));};exports[_0xf0ab('0x4b')]=function(_0x4edb01,_0x1a9981,_0x53d6a4){var _0x1352ac={};var _0xe4ef6d={};var _0x187389;var _0x33112b;return db[_0xf0ab('0x2b')]['findOne']({'where':{'id':_0x4edb01[_0xf0ab('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a9981,null))[_0xf0ab('0x25')](function(_0x4c9d2b){if(_0x4c9d2b){_0x187389=_0x4c9d2b;_0xe4ef6d[_0xf0ab('0x32')]=_['keys'](db['ZendeskConfiguration'][_0xf0ab('0x2c')]);_0xe4ef6d['query']=_[_0xf0ab('0x30')](_0x4edb01['query']);_0xe4ef6d[_0xf0ab('0x3c')]=_['intersection'](_0xe4ef6d[_0xf0ab('0x32')],_0xe4ef6d[_0xf0ab('0x2f')]);_0x1352ac[_0xf0ab('0x34')]=_['intersection'](_0xe4ef6d['model'],qs['fields'](_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x33')]));_0x1352ac['attributes']=_0x1352ac['attributes'][_0xf0ab('0x35')]?_0x1352ac[_0xf0ab('0x34')]:_0xe4ef6d[_0xf0ab('0x32')];_0x1352ac[_0xf0ab('0x38')]=qs[_0xf0ab('0x39')](_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x39')]);_0x1352ac[_0xf0ab('0x3a')]=qs[_0xf0ab('0x3c')](_[_0xf0ab('0x3b')](_0x4edb01[_0xf0ab('0x2f')],_0xe4ef6d['filters']));if(_0x4edb01[_0xf0ab('0x2f')]['filter']){_0x1352ac[_0xf0ab('0x3a')]=_[_0xf0ab('0x3e')](_0x1352ac[_0xf0ab('0x3a')],{'$or':_[_0xf0ab('0x2a')](_0x1352ac[_0xf0ab('0x34')],function(_0x3c168f){var _0x152e80={};_0x152e80[_0x3c168f]={'$like':'%'+_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x3d')]+'%'};return _0x152e80;})});}_0x1352ac=_[_0xf0ab('0x3e')]({},_0x1352ac,_0x4edb01['options']);return _0x187389[_0xf0ab('0x4b')](_0x1352ac);}})[_0xf0ab('0x25')](function(_0x4062b7){if(_0x4062b7){_0x33112b=_0x4062b7[_0xf0ab('0x35')];if(!_0x4edb01[_0xf0ab('0x2f')][_0xf0ab('0x36')](_0xf0ab('0x37'))){_0x1352ac[_0xf0ab('0x1f')]=qs[_0xf0ab('0x1f')](_0x4edb01['query']['limit']);_0x1352ac[_0xf0ab('0x1c')]=qs[_0xf0ab('0x1c')](_0x4edb01[_0xf0ab('0x2f')]['offset']);}return _0x187389[_0xf0ab('0x4b')](_0x1352ac);}})[_0xf0ab('0x25')](function(_0xd61dcf){if(_0xd61dcf){return _0xd61dcf?{'count':_0x33112b,'rows':_0xd61dcf}:null;}})['then'](respondWithResult(_0x1a9981,null))[_0xf0ab('0x45')](handleError(_0x1a9981,null));};exports[_0xf0ab('0x4c')]=function(_0x3fc57e,_0x3d333f,_0x23f4f8){if(_0x3fc57e['body']['id']){delete _0x3fc57e[_0xf0ab('0x49')]['id'];}return db[_0xf0ab('0x2b')][_0xf0ab('0x4d')]({'where':{'id':_0x3fc57e[_0xf0ab('0x47')]['id']}})[_0xf0ab('0x25')](handleEntityNotFound(_0x3d333f,null))[_0xf0ab('0x25')](function(_0xe3fc19){if(_0xe3fc19){_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x4e')]=_0xe3fc19['id'];_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x4f')]=integrations[_0xf0ab('0x50')](_0x3fc57e[_0xf0ab('0x49')]['channel'],_0x3fc57e['body'][_0xf0ab('0x2d')]);_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x51')]=integrations['getDescriptions'](_0x3fc57e[_0xf0ab('0x49')]['channel'],_0x3fc57e[_0xf0ab('0x49')][_0xf0ab('0x2d')]);return db[_0xf0ab('0x52')]['create'](_0x3fc57e[_0xf0ab('0x49')],{'include':[{'model':db['ZendeskField'],'as':'Subjects'},{'model':db[_0xf0ab('0x53')],'as':_0xf0ab('0x51')}]});}return null;})[_0xf0ab('0x25')](respondWithResult(_0x3d333f,null))['catch'](handleError(_0x3d333f,null));};exports[_0xf0ab('0x54')]=function(_0x92ade0,_0x1035b3,_0x122c41){var _0x5b6923='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x92ade0[_0xf0ab('0x47')]['id']},'attributes':['id',_0xf0ab('0x55'),_0xf0ab('0x56'),_0xf0ab('0x57'),_0xf0ab('0x58'),_0xf0ab('0x59')]})[_0xf0ab('0x25')](handleEntityNotFound(_0x1035b3,null))[_0xf0ab('0x25')](function(_0x3119d1){if(_0x3119d1){_0x5b6923=_0x3119d1[_0xf0ab('0x59')];var _0x228334=_0x5b6923['slice'](-0x1);if(_0x228334==='/'){_0x5b6923=_0x5b6923[_0xf0ab('0x5a')](0x0,_0x5b6923[_0xf0ab('0x5b')](_0x228334));}var _0x24e4f5={'method':_0xf0ab('0x5c'),'uri':util[_0xf0ab('0x5d')](_0xf0ab('0x5e'),_0x5b6923,_0xf0ab('0x5f')),'json':!![]};switch(_0x3119d1[_0xf0ab('0x58')]){case'password':_0x24e4f5[_0xf0ab('0x60')]={'Authorization':util[_0xf0ab('0x5d')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x3119d1[_0xf0ab('0x55')],_0x3119d1[_0xf0ab('0x56')]))[_0xf0ab('0x61')](_0xf0ab('0x62')))};break;case _0xf0ab('0x57'):_0x24e4f5[_0xf0ab('0x60')]={'Authorization':util['format'](_0xf0ab('0x63'),new Buffer(util['format'](_0xf0ab('0x64'),_0x3119d1['username'],_0x3119d1[_0xf0ab('0x57')]))['toString'](_0xf0ab('0x62')))};break;default:throw new db['Sequelize']['ValidationError'](_0xf0ab('0x65'));}return rp(_0x24e4f5);}})[_0xf0ab('0x25')](function(_0x1f37a2){if(_0x1f37a2){var _0xd96ca8=[_0xf0ab('0x66'),_0xf0ab('0x67'),_0xf0ab('0x68'),_0xf0ab('0x69')];_[_0xf0ab('0x6a')](_0x1f37a2[_0xf0ab('0x5f')],function(_0x1650c0){return _0xd96ca8[_0xf0ab('0x6b')](_0x1650c0[_0xf0ab('0x2d')]);});return{'count':_0x1f37a2['ticket_fields'][_0xf0ab('0x35')],'rows':_[_0xf0ab('0x2a')](_0x1f37a2[_0xf0ab('0x5f')],function(_0x12acef){return{'id':_0x12acef['id'],'name':_0x12acef[_0xf0ab('0x6c')]>0x7?_0x12acef[_0xf0ab('0x6d')]:_0x12acef[_0xf0ab('0x2d')],'custom':_0x12acef[_0xf0ab('0x6c')]>0x7?!![]:![],'options':_0x12acef[_0xf0ab('0x6e')]?_0x12acef[_0xf0ab('0x6e')]:_0x12acef[_0xf0ab('0x6f')]?_0x12acef[_0xf0ab('0x6f')]:[]};})};}})['then'](respondWithResult(_0x1035b3,null))[_0xf0ab('0x45')](function(_0x1f18cd){var _0x3221ff=_0x92ade0[_0xf0ab('0x2f')]['test']?0x1f4:_0x1f18cd[_0xf0ab('0x70')]||0x1f4;logger[_0xf0ab('0x26')](_0xf0ab('0x71'),_0xf0ab('0x54'),_0x3221ff,JSON[_0xf0ab('0x72')](_0x1f18cd));delete _0x1f18cd['name'];if(_0x3221ff===0x191){_0x3221ff=0x190;}_0x1035b3[_0xf0ab('0x19')](_0x3221ff)[_0xf0ab('0x28')](_0x92ade0['query'][_0xf0ab('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x1f18cd[_0xf0ab('0x70')]}:_0x1f18cd);});}; \ No newline at end of file +var _0x0fd9=['getConfigurations','ZendeskConfiguration','pick','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','authType','remoteUri','substring','lastIndexOf','%s/%s','format','Basic\x20%s','%s:%s','base64','token','headers','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','ticket_fields','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','create','body','find'];(function(_0x52b5b3,_0x2b87db){var _0x54f753=function(_0x359d96){while(--_0x359d96){_0x52b5b3['push'](_0x52b5b3['shift']());}};_0x54f753(++_0x2b87db);}(_0x0fd9,0xa3));var _0x90fd=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x0fd9[_0x1f36bb];return _0xaf97fa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90fd('0x0'));var zipdir=require(_0x90fd('0x1'));var jsonpatch=require(_0x90fd('0x2'));var rp=require(_0x90fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90fd('0x4'));var util=require(_0x90fd('0x5'));var path=require(_0x90fd('0x6'));var sox=require(_0x90fd('0x7'));var csv=require(_0x90fd('0x8'));var ejs=require(_0x90fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90fd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90fd('0xb'));var toCsv=require(_0x90fd('0x8'));var querystring=require('querystring');var Papa=require(_0x90fd('0xc'));var Redis=require(_0x90fd('0xd'));var authService=require(_0x90fd('0xe'));var qs=require(_0x90fd('0xf'));var as=require(_0x90fd('0x10'));var hardwareService=require(_0x90fd('0x11'));var logger=require(_0x90fd('0x12'))(_0x90fd('0x13'));var utils=require(_0x90fd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90fd('0x15'));var db=require(_0x90fd('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1439ed,_0x37a0f8){_0x37a0f8=_0x37a0f8||0xcc;return function(_0x19a594){if(_0x19a594){return _0x1439ed['sendStatus'](_0x37a0f8);}return _0x1439ed[_0x90fd('0x17')](_0x37a0f8)['end']();};}function respondWithResult(_0x1cae40,_0xb402d9){_0xb402d9=_0xb402d9||0xc8;return function(_0x18bdb6){if(_0x18bdb6){return _0x1cae40[_0x90fd('0x17')](_0xb402d9)[_0x90fd('0x18')](_0x18bdb6);}};}function respondWithFilteredResult(_0x442a19,_0x296a64){return function(_0x4eb953){if(_0x4eb953){var _0x4f6b7b=typeof _0x296a64[_0x90fd('0x19')]===_0x90fd('0x1a')&&typeof _0x296a64['limit']===_0x90fd('0x1a');var _0x13a694=_0x4eb953[_0x90fd('0x1b')];var _0x4d8f3b=_0x4f6b7b?0x0:_0x296a64[_0x90fd('0x19')];var _0x16e9e3=_0x4f6b7b?_0x4eb953[_0x90fd('0x1b')]:_0x296a64[_0x90fd('0x19')]+_0x296a64[_0x90fd('0x1c')];var _0x58866f;if(_0x16e9e3>=_0x13a694){_0x16e9e3=_0x13a694;_0x58866f=0xc8;}else{_0x58866f=0xce;}_0x442a19[_0x90fd('0x17')](_0x58866f);return _0x442a19[_0x90fd('0x1d')](_0x90fd('0x1e'),_0x4d8f3b+'-'+_0x16e9e3+'/'+_0x13a694)[_0x90fd('0x18')](_0x4eb953);}return null;};}function patchUpdates(_0x19e79b){return function(_0x34ab93){try{jsonpatch[_0x90fd('0x1f')](_0x34ab93,_0x19e79b,!![]);}catch(_0x83fde){return BPromise[_0x90fd('0x20')](_0x83fde);}return _0x34ab93['save']();};}function saveUpdates(_0x35ce4e,_0xc4e4e2){return function(_0xf3044b){if(_0xf3044b){return _0xf3044b[_0x90fd('0x21')](_0x35ce4e)[_0x90fd('0x22')](function(_0x3ad6c6){return _0x3ad6c6;});}return null;};}function removeEntity(_0x30f67e,_0x300262){return function(_0x5152f6){if(_0x5152f6){return _0x5152f6[_0x90fd('0x23')]()['then'](function(){_0x30f67e[_0x90fd('0x17')](0xcc)[_0x90fd('0x24')]();});}};}function handleEntityNotFound(_0x2ffea2,_0x31667c){return function(_0x18beb5){if(!_0x18beb5){_0x2ffea2['sendStatus'](0x194);}return _0x18beb5;};}function handleError(_0x35c38d,_0xe333f0){_0xe333f0=_0xe333f0||0x1f4;return function(_0x2fffe6){logger[_0x90fd('0x25')](_0x2fffe6[_0x90fd('0x26')]);if(_0x2fffe6[_0x90fd('0x27')]){delete _0x2fffe6['name'];}_0x35c38d['status'](_0xe333f0)[_0x90fd('0x28')](_0x2fffe6);};}exports[_0x90fd('0x29')]=function(_0x2924e9,_0x404971){var _0x397aaf={},_0x59b3e8={},_0x4f69e7={'count':0x0,'rows':[]};var _0x3781bb=_[_0x90fd('0x2a')](db[_0x90fd('0x2b')][_0x90fd('0x2c')],function(_0x4a3ae4){return{'name':_0x4a3ae4['fieldName'],'type':_0x4a3ae4[_0x90fd('0x2d')][_0x90fd('0x2e')]};});_0x59b3e8[_0x90fd('0x2f')]=_[_0x90fd('0x2a')](_0x3781bb,'name');_0x59b3e8[_0x90fd('0x30')]=_[_0x90fd('0x31')](_0x2924e9[_0x90fd('0x30')]);_0x59b3e8[_0x90fd('0x32')]=_[_0x90fd('0x33')](_0x59b3e8[_0x90fd('0x2f')],_0x59b3e8[_0x90fd('0x30')]);_0x397aaf[_0x90fd('0x34')]=_[_0x90fd('0x33')](_0x59b3e8[_0x90fd('0x2f')],qs[_0x90fd('0x35')](_0x2924e9[_0x90fd('0x30')][_0x90fd('0x35')]));_0x397aaf[_0x90fd('0x34')]=_0x397aaf[_0x90fd('0x34')][_0x90fd('0x36')]?_0x397aaf['attributes']:_0x59b3e8[_0x90fd('0x2f')];if(!_0x2924e9[_0x90fd('0x30')][_0x90fd('0x37')](_0x90fd('0x38'))){_0x397aaf[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x2924e9[_0x90fd('0x30')][_0x90fd('0x1c')]);_0x397aaf[_0x90fd('0x19')]=qs[_0x90fd('0x19')](_0x2924e9[_0x90fd('0x30')][_0x90fd('0x19')]);}_0x397aaf[_0x90fd('0x39')]=qs['sort'](_0x2924e9[_0x90fd('0x30')][_0x90fd('0x3a')]);_0x397aaf[_0x90fd('0x3b')]=qs[_0x90fd('0x32')](_['pick'](_0x2924e9[_0x90fd('0x30')],_0x59b3e8[_0x90fd('0x32')]),_0x3781bb);if(_0x2924e9[_0x90fd('0x30')]['filter']){_0x397aaf['where']=_[_0x90fd('0x3c')](_0x397aaf[_0x90fd('0x3b')],{'$or':_[_0x90fd('0x2a')](_0x3781bb,function(_0xb7c342){if(_0xb7c342[_0x90fd('0x2d')]!==_0x90fd('0x3d')){var _0x2c5842={};_0x2c5842[_0xb7c342[_0x90fd('0x27')]]={'$like':'%'+_0x2924e9[_0x90fd('0x30')][_0x90fd('0x3e')]+'%'};return _0x2c5842;}})});}_0x397aaf=_[_0x90fd('0x3c')]({},_0x397aaf,_0x2924e9[_0x90fd('0x3f')]);var _0x21dc9c={'where':_0x397aaf[_0x90fd('0x3b')]};return db[_0x90fd('0x2b')][_0x90fd('0x1b')](_0x21dc9c)[_0x90fd('0x22')](function(_0x131239){_0x4f69e7['count']=_0x131239;if(_0x2924e9[_0x90fd('0x30')][_0x90fd('0x40')]){_0x397aaf[_0x90fd('0x41')]=[{'all':!![]}];}return db['ZendeskAccount']['findAll'](_0x397aaf);})['then'](function(_0x45f37d){_0x4f69e7[_0x90fd('0x42')]=_0x45f37d;return _0x4f69e7;})[_0x90fd('0x22')](respondWithFilteredResult(_0x404971,_0x397aaf))[_0x90fd('0x43')](handleError(_0x404971,null));};exports[_0x90fd('0x44')]=function(_0x311c7e,_0x363365){var _0x733d4d={'raw':![],'where':{'id':_0x311c7e[_0x90fd('0x45')]['id']}},_0x94e96d={};_0x94e96d[_0x90fd('0x2f')]=_[_0x90fd('0x31')](db[_0x90fd('0x2b')][_0x90fd('0x2c')]);_0x94e96d[_0x90fd('0x30')]=_['keys'](_0x311c7e['query']);_0x94e96d[_0x90fd('0x32')]=_[_0x90fd('0x33')](_0x94e96d[_0x90fd('0x2f')],_0x94e96d['query']);_0x733d4d['attributes']=_[_0x90fd('0x33')](_0x94e96d[_0x90fd('0x2f')],qs['fields'](_0x311c7e['query'][_0x90fd('0x35')]));_0x733d4d[_0x90fd('0x34')]=_0x733d4d['attributes']['length']?_0x733d4d[_0x90fd('0x34')]:_0x94e96d[_0x90fd('0x2f')];if(_0x311c7e[_0x90fd('0x30')]['includeAll']){_0x733d4d[_0x90fd('0x41')]=[{'all':!![]}];}_0x733d4d=_[_0x90fd('0x3c')]({},_0x733d4d,_0x311c7e['options']);return db['ZendeskAccount']['find'](_0x733d4d)[_0x90fd('0x22')](handleEntityNotFound(_0x363365,null))[_0x90fd('0x22')](respondWithResult(_0x363365,null))['catch'](handleError(_0x363365,null));};exports[_0x90fd('0x46')]=function(_0x2b73f7,_0x2d47dc){return db[_0x90fd('0x2b')][_0x90fd('0x46')](_0x2b73f7['body'],{})['then'](respondWithResult(_0x2d47dc,0xc9))[_0x90fd('0x43')](handleError(_0x2d47dc,null));};exports[_0x90fd('0x21')]=function(_0x125874,_0x17b6b0){if(_0x125874[_0x90fd('0x47')]['id']){delete _0x125874[_0x90fd('0x47')]['id'];}return db[_0x90fd('0x2b')][_0x90fd('0x48')]({'where':{'id':_0x125874[_0x90fd('0x45')]['id']}})[_0x90fd('0x22')](handleEntityNotFound(_0x17b6b0,null))['then'](saveUpdates(_0x125874[_0x90fd('0x47')],null))[_0x90fd('0x22')](respondWithResult(_0x17b6b0,null))[_0x90fd('0x43')](handleError(_0x17b6b0,null));};exports[_0x90fd('0x23')]=function(_0x4b47bc,_0x4cf061){return db[_0x90fd('0x2b')]['find']({'where':{'id':_0x4b47bc['params']['id']}})[_0x90fd('0x22')](handleEntityNotFound(_0x4cf061,null))[_0x90fd('0x22')](removeEntity(_0x4cf061,null))[_0x90fd('0x43')](handleError(_0x4cf061,null));};exports[_0x90fd('0x49')]=function(_0x13c428,_0x1fc655,_0x3241b5){var _0x5502f2={};var _0x55653c={};var _0x1b81dc;var _0x43d076;return db[_0x90fd('0x2b')]['findOne']({'where':{'id':_0x13c428[_0x90fd('0x45')]['id']}})[_0x90fd('0x22')](handleEntityNotFound(_0x1fc655,null))[_0x90fd('0x22')](function(_0x3494f7){if(_0x3494f7){_0x1b81dc=_0x3494f7;_0x55653c[_0x90fd('0x2f')]=_[_0x90fd('0x31')](db[_0x90fd('0x4a')][_0x90fd('0x2c')]);_0x55653c['query']=_['keys'](_0x13c428[_0x90fd('0x30')]);_0x55653c[_0x90fd('0x32')]=_[_0x90fd('0x33')](_0x55653c['model'],_0x55653c[_0x90fd('0x30')]);_0x5502f2[_0x90fd('0x34')]=_[_0x90fd('0x33')](_0x55653c[_0x90fd('0x2f')],qs[_0x90fd('0x35')](_0x13c428[_0x90fd('0x30')]['fields']));_0x5502f2[_0x90fd('0x34')]=_0x5502f2['attributes'][_0x90fd('0x36')]?_0x5502f2['attributes']:_0x55653c[_0x90fd('0x2f')];_0x5502f2[_0x90fd('0x39')]=qs[_0x90fd('0x3a')](_0x13c428[_0x90fd('0x30')]['sort']);_0x5502f2[_0x90fd('0x3b')]=qs[_0x90fd('0x32')](_[_0x90fd('0x4b')](_0x13c428[_0x90fd('0x30')],_0x55653c[_0x90fd('0x32')]));if(_0x13c428[_0x90fd('0x30')]['filter']){_0x5502f2['where']=_['merge'](_0x5502f2['where'],{'$or':_['map'](_0x5502f2[_0x90fd('0x34')],function(_0x3b98e2){var _0x278db5={};_0x278db5[_0x3b98e2]={'$like':'%'+_0x13c428[_0x90fd('0x30')][_0x90fd('0x3e')]+'%'};return _0x278db5;})});}_0x5502f2=_['merge']({},_0x5502f2,_0x13c428['options']);return _0x1b81dc['getConfigurations'](_0x5502f2);}})[_0x90fd('0x22')](function(_0x24ad4d){if(_0x24ad4d){_0x43d076=_0x24ad4d['length'];if(!_0x13c428[_0x90fd('0x30')][_0x90fd('0x37')](_0x90fd('0x38'))){_0x5502f2[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x13c428[_0x90fd('0x30')][_0x90fd('0x1c')]);_0x5502f2[_0x90fd('0x19')]=qs[_0x90fd('0x19')](_0x13c428['query'][_0x90fd('0x19')]);}return _0x1b81dc[_0x90fd('0x49')](_0x5502f2);}})[_0x90fd('0x22')](function(_0x53e2bb){if(_0x53e2bb){return _0x53e2bb?{'count':_0x43d076,'rows':_0x53e2bb}:null;}})['then'](respondWithResult(_0x1fc655,null))[_0x90fd('0x43')](handleError(_0x1fc655,null));};exports[_0x90fd('0x4c')]=function(_0x479c8c,_0x5f4645,_0x4d761c){if(_0x479c8c['body']['id']){delete _0x479c8c[_0x90fd('0x47')]['id'];}return db[_0x90fd('0x2b')][_0x90fd('0x4d')]({'where':{'id':_0x479c8c[_0x90fd('0x45')]['id']}})[_0x90fd('0x22')](handleEntityNotFound(_0x5f4645,null))[_0x90fd('0x22')](function(_0x321cfb){if(_0x321cfb){_0x479c8c[_0x90fd('0x47')]['AccountId']=_0x321cfb['id'];_0x479c8c[_0x90fd('0x47')][_0x90fd('0x4e')]=integrations[_0x90fd('0x4f')](_0x479c8c['body'][_0x90fd('0x50')],_0x479c8c[_0x90fd('0x47')]['type']);_0x479c8c['body'][_0x90fd('0x51')]=integrations[_0x90fd('0x52')](_0x479c8c[_0x90fd('0x47')]['channel'],_0x479c8c[_0x90fd('0x47')]['type']);return db['ZendeskConfiguration'][_0x90fd('0x46')](_0x479c8c['body'],{'include':[{'model':db[_0x90fd('0x53')],'as':_0x90fd('0x4e')},{'model':db['ZendeskField'],'as':_0x90fd('0x51')}]});}return null;})[_0x90fd('0x22')](respondWithResult(_0x5f4645,null))[_0x90fd('0x43')](handleError(_0x5f4645,null));};exports[_0x90fd('0x54')]=function(_0x6a7a62,_0xd1ecc,_0x4d2436){var _0x4c5fd3='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x6a7a62[_0x90fd('0x45')]['id']},'attributes':['id',_0x90fd('0x55'),_0x90fd('0x56'),'token',_0x90fd('0x57'),_0x90fd('0x58')]})['then'](handleEntityNotFound(_0xd1ecc,null))[_0x90fd('0x22')](function(_0x23959f){if(_0x23959f){_0x4c5fd3=_0x23959f[_0x90fd('0x58')];var _0x24ce65=_0x4c5fd3['slice'](-0x1);if(_0x24ce65==='/'){_0x4c5fd3=_0x4c5fd3[_0x90fd('0x59')](0x0,_0x4c5fd3[_0x90fd('0x5a')](_0x24ce65));}var _0x5d08e9={'method':'GET','uri':util['format'](_0x90fd('0x5b'),_0x4c5fd3,'ticket_fields'),'json':!![]};switch(_0x23959f['authType']){case _0x90fd('0x56'):_0x5d08e9['headers']={'Authorization':util[_0x90fd('0x5c')](_0x90fd('0x5d'),new Buffer(util[_0x90fd('0x5c')](_0x90fd('0x5e'),_0x23959f[_0x90fd('0x55')],_0x23959f[_0x90fd('0x56')]))['toString'](_0x90fd('0x5f')))};break;case _0x90fd('0x60'):_0x5d08e9[_0x90fd('0x61')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x90fd('0x5c')](_0x90fd('0x62'),_0x23959f[_0x90fd('0x55')],_0x23959f[_0x90fd('0x60')]))[_0x90fd('0x63')](_0x90fd('0x5f')))};break;default:throw new db[(_0x90fd('0x64'))][(_0x90fd('0x65'))](_0x90fd('0x66'));}return rp(_0x5d08e9);}})[_0x90fd('0x22')](function(_0x1742b3){if(_0x1742b3){var _0x1547d5=[_0x90fd('0x67'),_0x90fd('0x68'),_0x90fd('0x69'),_0x90fd('0x6a')];_[_0x90fd('0x6b')](_0x1742b3['ticket_fields'],function(_0x2b61ea){return _0x1547d5[_0x90fd('0x6c')](_0x2b61ea[_0x90fd('0x2d')]);});return{'count':_0x1742b3[_0x90fd('0x6d')][_0x90fd('0x36')],'rows':_[_0x90fd('0x2a')](_0x1742b3[_0x90fd('0x6d')],function(_0x4935db){return{'id':_0x4935db['id'],'name':_0x4935db[_0x90fd('0x6e')]>0x7?_0x4935db[_0x90fd('0x6f')]:_0x4935db[_0x90fd('0x2d')],'custom':_0x4935db[_0x90fd('0x6e')]>0x7?!![]:![],'options':_0x4935db['system_field_options']?_0x4935db[_0x90fd('0x70')]:_0x4935db[_0x90fd('0x71')]?_0x4935db[_0x90fd('0x71')]:[]};})};}})[_0x90fd('0x22')](respondWithResult(_0xd1ecc,null))[_0x90fd('0x43')](function(_0x5264f3){var _0x5dd5f0=_0x6a7a62[_0x90fd('0x30')][_0x90fd('0x72')]?0x1f4:_0x5264f3[_0x90fd('0x73')]||0x1f4;logger[_0x90fd('0x25')](_0x90fd('0x74'),_0x90fd('0x54'),_0x5dd5f0,JSON['stringify'](_0x5264f3));delete _0x5264f3[_0x90fd('0x27')];if(_0x5dd5f0===0x191){_0x5dd5f0=0x190;}_0xd1ecc[_0x90fd('0x17')](_0x5dd5f0)[_0x90fd('0x28')](_0x6a7a62[_0x90fd('0x30')][_0x90fd('0x72')]?{'message':_0x90fd('0x75'),'statusCode':_0x5264f3[_0x90fd('0x73')]}:_0x5264f3);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 86b8b66..f765343 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 _0x0526=['../../components/integrations/configuration','exports','int_zendesk_accounts','lodash','../../config/logger','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x367c11,_0x1bbacc){var _0x429f19=function(_0x3ab355){while(--_0x3ab355){_0x367c11['push'](_0x367c11['shift']());}};_0x429f19(++_0x1bbacc);}(_0x0526,0x11b));var _0x6052=function(_0x4b9bde,_0x3af597){_0x4b9bde=_0x4b9bde-0x0;var _0x53b7db=_0x0526[_0x4b9bde];return _0x53b7db;};'use strict';var _=require(_0x6052('0x0'));var util=require('util');var logger=require(_0x6052('0x1'))('api');var moment=require(_0x6052('0x2'));var BPromise=require(_0x6052('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6052('0x4'));var rimraf=require(_0x6052('0x5'));var config=require(_0x6052('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x6052('0x7'));module[_0x6052('0x8')]=function(_0x37eec3,_0x440fe3){return _0x37eec3['define']('ZendeskAccount',attributes,{'tableName':_0x6052('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5523=['bluebird','request-promise','path','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5523,0x14e));var _0x3552=function(_0x441a88,_0xa54bc5){_0x441a88=_0x441a88-0x0;var _0x2229d5=_0x5523[_0x441a88];return _0x2229d5;};'use strict';var _=require(_0x3552('0x0'));var util=require(_0x3552('0x1'));var logger=require(_0x3552('0x2'))('api');var moment=require(_0x3552('0x3'));var BPromise=require(_0x3552('0x4'));var rp=require(_0x3552('0x5'));var fs=require('fs');var path=require(_0x3552('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3552('0x7'));var integrations=require(_0x3552('0x8'));module[_0x3552('0x9')]=function(_0x5134b2,_0x570822){return _0x5134b2[_0x3552('0xa')](_0x3552('0xb'),attributes,{'tableName':_0x3552('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 61ccbb4..dc59774 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 _0x4299=['code','message','info','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','rpc','client','http','request','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0x4299,0x1cd));var _0x9429=function(_0x161d66,_0x2406f7){_0x161d66=_0x161d66-0x0;var _0x1561b4=_0x4299[_0x161d66];return _0x1561b4;};'use strict';var _=require(_0x9429('0x0'));var util=require(_0x9429('0x1'));var moment=require(_0x9429('0x2'));var BPromise=require(_0x9429('0x3'));var rs=require(_0x9429('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9429('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9429('0x6')][_0x9429('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x6b8e47,_0x37c3fe,_0x4565d1){return new BPromise(function(_0x3fdb2c,_0x174069){return client[_0x9429('0x8')](_0x6b8e47,_0x4565d1)['then'](function(_0x5d3d82){logger['info'](_0x9429('0x9'),_0x37c3fe,_0x9429('0xa'));logger[_0x9429('0xb')](_0x9429('0xc'),_0x37c3fe,_0x9429('0xa'),JSON[_0x9429('0xd')](_0x5d3d82));if(_0x5d3d82[_0x9429('0xe')]){if(_0x5d3d82[_0x9429('0xe')][_0x9429('0xf')]===0x1f4){logger[_0x9429('0xe')](_0x9429('0x9'),_0x37c3fe,_0x5d3d82['error'][_0x9429('0x10')]);return _0x174069(_0x5d3d82[_0x9429('0xe')][_0x9429('0x10')]);}logger[_0x9429('0xe')](_0x9429('0x9'),_0x37c3fe,_0x5d3d82[_0x9429('0xe')]['message']);return _0x3fdb2c(_0x5d3d82[_0x9429('0xe')][_0x9429('0x10')]);}else{logger[_0x9429('0x11')](_0x9429('0x9'),_0x37c3fe,_0x9429('0xa'));_0x3fdb2c(_0x5d3d82[_0x9429('0x12')]['message']);}})[_0x9429('0x13')](function(_0x2f8029){logger[_0x9429('0xe')](_0x9429('0x9'),_0x37c3fe,_0x2f8029);_0x174069(_0x2f8029);});});}exports[_0x9429('0x14')]=function(_0x2064b7){var _0x145aa0=this;return new Promise(function(_0x5c196d,_0x147ea2){return db[_0x9429('0x15')][_0x9429('0x16')]({'raw':_0x2064b7[_0x9429('0x17')]?_0x2064b7[_0x9429('0x17')][_0x9429('0x18')]===undefined?!![]:![]:!![],'where':_0x2064b7[_0x9429('0x17')]?_0x2064b7[_0x9429('0x17')][_0x9429('0x19')]||null:null,'attributes':_0x2064b7[_0x9429('0x17')]?_0x2064b7[_0x9429('0x17')]['attributes']||null:null,'limit':_0x2064b7[_0x9429('0x17')]?_0x2064b7['options'][_0x9429('0x1a')]||null:null,'include':_0x2064b7[_0x9429('0x17')]?_0x2064b7['options'][_0x9429('0x1b')]?_[_0x9429('0x1c')](_0x2064b7[_0x9429('0x17')][_0x9429('0x1b')],function(_0xeccf1b){return{'model':db[_0xeccf1b[_0x9429('0x1d')]],'as':_0xeccf1b['as'],'attributes':_0xeccf1b[_0x9429('0x1e')],'include':_0xeccf1b[_0x9429('0x1b')]?_[_0x9429('0x1c')](_0xeccf1b[_0x9429('0x1b')],function(_0x1f93ed){return{'model':db[_0x1f93ed[_0x9429('0x1d')]],'as':_0x1f93ed['as'],'attributes':_0x1f93ed['attributes'],'include':_0x1f93ed['include']?_[_0x9429('0x1c')](_0x1f93ed[_0x9429('0x1b')],function(_0x563929){return{'model':db[_0x563929['model']],'as':_0x563929['as'],'attributes':_0x563929[_0x9429('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9429('0x1f')](function(_0x1a4436){logger[_0x9429('0x11')](_0x9429('0x14'),_0x2064b7);logger[_0x9429('0xb')](_0x9429('0x14'),_0x2064b7,JSON['stringify'](_0x1a4436));_0x5c196d(_0x1a4436);})[_0x9429('0x13')](function(_0x5b97fa){logger['error'](_0x9429('0x14'),_0x5b97fa[_0x9429('0x10')],_0x2064b7);_0x147ea2(_0x145aa0[_0x9429('0xe')](0x1f4,_0x5b97fa[_0x9429('0x10')]));});});};exports[_0x9429('0x20')]=function(_0x1e8b5e){var _0x4ff996=this;return new Promise(function(_0x5717cc,_0x338c61){return db[_0x9429('0x15')][_0x9429('0x21')]({'raw':_0x1e8b5e['options']?_0x1e8b5e[_0x9429('0x17')][_0x9429('0x18')]===undefined?!![]:![]:!![],'where':_0x1e8b5e[_0x9429('0x17')]?_0x1e8b5e[_0x9429('0x17')][_0x9429('0x19')]||null:null,'attributes':_0x1e8b5e[_0x9429('0x17')]?_0x1e8b5e[_0x9429('0x17')][_0x9429('0x1e')]||null:null,'include':_0x1e8b5e[_0x9429('0x17')]?_0x1e8b5e[_0x9429('0x17')]['include']?_[_0x9429('0x1c')](_0x1e8b5e[_0x9429('0x17')][_0x9429('0x1b')],function(_0x58a410){return{'model':db[_0x58a410[_0x9429('0x1d')]],'as':_0x58a410['as'],'attributes':_0x58a410[_0x9429('0x1e')],'include':_0x58a410['include']?_[_0x9429('0x1c')](_0x58a410[_0x9429('0x1b')],function(_0x23a196){return{'model':db[_0x23a196[_0x9429('0x1d')]],'as':_0x23a196['as'],'attributes':_0x23a196[_0x9429('0x1e')],'include':_0x23a196[_0x9429('0x1b')]?_[_0x9429('0x1c')](_0x23a196[_0x9429('0x1b')],function(_0x4575b5){return{'model':db[_0x4575b5['model']],'as':_0x4575b5['as'],'attributes':_0x4575b5[_0x9429('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9429('0x1f')](function(_0x1acd64){logger[_0x9429('0x11')](_0x9429('0x20'),_0x1e8b5e);logger['debug'](_0x9429('0x20'),_0x1e8b5e,JSON['stringify'](_0x1acd64));_0x5717cc(_0x1acd64);})['catch'](function(_0x4722b0){logger['error'](_0x9429('0x20'),_0x4722b0[_0x9429('0x10')],_0x1e8b5e);_0x338c61(_0x4ff996[_0x9429('0xe')](0x1f4,_0x4722b0[_0x9429('0x10')]));});});}; \ No newline at end of file +var _0x184e=['request\x20sent','stringify','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZendeskAccount,\x20%s,\x20%s','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x408c04,_0x137cb9){var _0x4aa1b8=function(_0xf5ac3){while(--_0xf5ac3){_0x408c04['push'](_0x408c04['shift']());}};_0x4aa1b8(++_0x137cb9);}(_0x184e,0x1a0));var _0xe184=function(_0x1cd674,_0x8d3638){_0x1cd674=_0x1cd674-0x0;var _0x27928f=_0x184e[_0x1cd674];return _0x27928f;};'use strict';var _=require(_0xe184('0x0'));var util=require(_0xe184('0x1'));var moment=require(_0xe184('0x2'));var BPromise=require(_0xe184('0x3'));var rs=require(_0xe184('0x4'));var fs=require('fs');var Redis=require(_0xe184('0x5'));var db=require(_0xe184('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe184('0x7'))(_0xe184('0x8'));var config=require(_0xe184('0x9'));var jayson=require(_0xe184('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4d0a6e,_0x4d0857,_0x5cb03c){return new BPromise(function(_0x37691f,_0x294514){return client[_0xe184('0xb')](_0x4d0a6e,_0x5cb03c)[_0xe184('0xc')](function(_0x2373bf){logger[_0xe184('0xd')](_0xe184('0xe'),_0x4d0857,'request\x20sent');logger['debug'](_0xe184('0xf'),_0x4d0857,_0xe184('0x10'),JSON[_0xe184('0x11')](_0x2373bf));if(_0x2373bf[_0xe184('0x12')]){if(_0x2373bf['error'][_0xe184('0x13')]===0x1f4){logger[_0xe184('0x12')](_0xe184('0xe'),_0x4d0857,_0x2373bf['error'][_0xe184('0x14')]);return _0x294514(_0x2373bf[_0xe184('0x12')][_0xe184('0x14')]);}logger['error'](_0xe184('0xe'),_0x4d0857,_0x2373bf[_0xe184('0x12')]['message']);return _0x37691f(_0x2373bf['error'][_0xe184('0x14')]);}else{logger[_0xe184('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x4d0857,_0xe184('0x10'));_0x37691f(_0x2373bf['result'][_0xe184('0x14')]);}})[_0xe184('0x15')](function(_0x3b1347){logger['error'](_0xe184('0xe'),_0x4d0857,_0x3b1347);_0x294514(_0x3b1347);});});}exports[_0xe184('0x16')]=function(_0x2ed8fe){var _0x21548a=this;return new Promise(function(_0x96654,_0x1a474b){return db[_0xe184('0x17')][_0xe184('0x18')]({'raw':_0x2ed8fe[_0xe184('0x19')]?_0x2ed8fe[_0xe184('0x19')][_0xe184('0x1a')]===undefined?!![]:![]:!![],'where':_0x2ed8fe['options']?_0x2ed8fe['options'][_0xe184('0x1b')]||null:null,'attributes':_0x2ed8fe[_0xe184('0x19')]?_0x2ed8fe[_0xe184('0x19')][_0xe184('0x1c')]||null:null,'limit':_0x2ed8fe[_0xe184('0x19')]?_0x2ed8fe['options'][_0xe184('0x1d')]||null:null,'include':_0x2ed8fe[_0xe184('0x19')]?_0x2ed8fe['options'][_0xe184('0x1e')]?_[_0xe184('0x1f')](_0x2ed8fe[_0xe184('0x19')][_0xe184('0x1e')],function(_0x319b97){return{'model':db[_0x319b97['model']],'as':_0x319b97['as'],'attributes':_0x319b97[_0xe184('0x1c')],'include':_0x319b97['include']?_[_0xe184('0x1f')](_0x319b97[_0xe184('0x1e')],function(_0x3f5d65){return{'model':db[_0x3f5d65[_0xe184('0x20')]],'as':_0x3f5d65['as'],'attributes':_0x3f5d65[_0xe184('0x1c')],'include':_0x3f5d65[_0xe184('0x1e')]?_[_0xe184('0x1f')](_0x3f5d65[_0xe184('0x1e')],function(_0x12895f){return{'model':db[_0x12895f[_0xe184('0x20')]],'as':_0x12895f['as'],'attributes':_0x12895f[_0xe184('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe184('0xc')](function(_0x362487){logger[_0xe184('0xd')](_0xe184('0x16'),_0x2ed8fe);logger[_0xe184('0x21')]('GetZendeskAccount',_0x2ed8fe,JSON[_0xe184('0x11')](_0x362487));_0x96654(_0x362487);})[_0xe184('0x15')](function(_0x5ac76b){logger[_0xe184('0x12')](_0xe184('0x16'),_0x5ac76b[_0xe184('0x14')],_0x2ed8fe);_0x1a474b(_0x21548a[_0xe184('0x12')](0x1f4,_0x5ac76b[_0xe184('0x14')]));});});};exports[_0xe184('0x22')]=function(_0x2132c0){var _0x2dd9e4=this;return new Promise(function(_0x58f62b,_0x405746){return db[_0xe184('0x17')][_0xe184('0x23')]({'raw':_0x2132c0['options']?_0x2132c0[_0xe184('0x19')][_0xe184('0x1a')]===undefined?!![]:![]:!![],'where':_0x2132c0['options']?_0x2132c0[_0xe184('0x19')][_0xe184('0x1b')]||null:null,'attributes':_0x2132c0[_0xe184('0x19')]?_0x2132c0['options'][_0xe184('0x1c')]||null:null,'include':_0x2132c0[_0xe184('0x19')]?_0x2132c0[_0xe184('0x19')][_0xe184('0x1e')]?_[_0xe184('0x1f')](_0x2132c0['options'][_0xe184('0x1e')],function(_0x34e3a7){return{'model':db[_0x34e3a7[_0xe184('0x20')]],'as':_0x34e3a7['as'],'attributes':_0x34e3a7[_0xe184('0x1c')],'include':_0x34e3a7['include']?_['map'](_0x34e3a7[_0xe184('0x1e')],function(_0x114792){return{'model':db[_0x114792['model']],'as':_0x114792['as'],'attributes':_0x114792[_0xe184('0x1c')],'include':_0x114792['include']?_[_0xe184('0x1f')](_0x114792[_0xe184('0x1e')],function(_0x20d889){return{'model':db[_0x20d889[_0xe184('0x20')]],'as':_0x20d889['as'],'attributes':_0x20d889[_0xe184('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe184('0xc')](function(_0x57ebc4){logger['info']('ShowZendeskAccount',_0x2132c0);logger['debug'](_0xe184('0x22'),_0x2132c0,JSON[_0xe184('0x11')](_0x57ebc4));_0x58f62b(_0x57ebc4);})[_0xe184('0x15')](function(_0x5cd84d){logger['error'](_0xe184('0x22'),_0x5cd84d[_0xe184('0x14')],_0x2132c0);_0x405746(_0x2dd9e4[_0xe184('0x12')](0x1f4,_0x5cd84d[_0xe184('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 7b60559..055f62d 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 _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x235a5a,_0x5d6771){var _0x467c02=function(_0xdeb0de){while(--_0xdeb0de){_0x235a5a['push'](_0x235a5a['shift']());}};_0x467c02(++_0x5d6771);}(_0xa571,0x107));var _0x1a57=function(_0x52f9e0,_0x19bef6){_0x52f9e0=_0x52f9e0-0x0;var _0x284efb=_0xa571[_0x52f9e0];return _0x284efb;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','put','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x4f97e8,_0x1131e5){var _0xbf0bef=function(_0xa59828){while(--_0xa59828){_0x4f97e8['push'](_0x4f97e8['shift']());}};_0xbf0bef(++_0x1131e5);}(_0xda3f,0xec));var _0xfda3=function(_0x3b8cd1,_0x502501){_0x3b8cd1=_0x3b8cd1-0x0;var _0x297f49=_0xda3f[_0x3b8cd1];return _0x297f49;};'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('./intZendeskConfiguration.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('0x5')]('/:id/descriptions',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0x5')](_0xfda3('0xe'),auth[_0xfda3('0x6')](),controller['getTags']);router[_0xfda3('0xf')]('/',auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xf')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0xfda3('0x11')](_0xfda3('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x12')]);module[_0xfda3('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 84350fa..56518d3 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 _0xe67c=['exports','STRING','sequelize'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xe67c,0xa1));var _0xce67=function(_0x338d75,_0x3158ce){_0x338d75=_0x338d75-0x0;var _0x4f8c06=_0xe67c[_0x338d75];return _0x4f8c06;};'use strict';var Sequelize=require(_0xce67('0x0'));module[_0xce67('0x1')]={'name':{'type':Sequelize[_0xce67('0x2')]},'description':{'type':Sequelize[_0xce67('0x2')]}}; \ No newline at end of file +var _0x6777=['exports','STRING','sequelize'];(function(_0x34f05b,_0x3b4069){var _0x567602=function(_0x56604a){while(--_0x56604a){_0x34f05b['push'](_0x34f05b['shift']());}};_0x567602(++_0x3b4069);}(_0x6777,0xa4));var _0x7677=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0x6777[_0x27ddf5];return _0x26e74a;};'use strict';var Sequelize=require(_0x7677('0x0'));module[_0x7677('0x1')]={'name':{'type':Sequelize[_0x7677('0x2')]},'description':{'type':Sequelize[_0x7677('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 8ffadde..be1181b 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 _0x3cae=['../../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','reject','save','update','then','destroy','end','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filter','merge','options','includeAll','include','findAll','catch','show','params','length','find','create','body','findOne','ZendeskField','sort','pick','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x54aa55,_0x14c95b){var _0x456fa1=function(_0x408dd6){while(--_0x408dd6){_0x54aa55['push'](_0x54aa55['shift']());}};_0x456fa1(++_0x14c95b);}(_0x3cae,0x19c));var _0xe3ca=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x3cae[_0x8ba19a];return _0x2bd8b4;};'use strict';var emlformat=require(_0xe3ca('0x0'));var rimraf=require(_0xe3ca('0x1'));var zipdir=require(_0xe3ca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe3ca('0x3'));var moment=require(_0xe3ca('0x4'));var BPromise=require(_0xe3ca('0x5'));var Mustache=require(_0xe3ca('0x6'));var util=require(_0xe3ca('0x7'));var path=require(_0xe3ca('0x8'));var sox=require('sox');var csv=require(_0xe3ca('0x9'));var ejs=require(_0xe3ca('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe3ca('0xb'));var squel=require(_0xe3ca('0xc'));var crypto=require('crypto');var jsforce=require(_0xe3ca('0xd'));var deskjs=require(_0xe3ca('0xe'));var toCsv=require(_0xe3ca('0x9'));var querystring=require(_0xe3ca('0xf'));var Papa=require(_0xe3ca('0x10'));var Redis=require(_0xe3ca('0x11'));var authService=require(_0xe3ca('0x12'));var qs=require(_0xe3ca('0x13'));var as=require(_0xe3ca('0x14'));var hardwareService=require(_0xe3ca('0x15'));var logger=require('../../config/logger')(_0xe3ca('0x16'));var utils=require(_0xe3ca('0x17'));var config=require(_0xe3ca('0x18'));var licenseUtil=require(_0xe3ca('0x19'));var db=require(_0xe3ca('0x1a'))['db'];function respondWithStatusCode(_0x1b4382,_0x57237e){_0x57237e=_0x57237e||0xcc;return function(_0x1ec6a6){if(_0x1ec6a6){return _0x1b4382[_0xe3ca('0x1b')](_0x57237e);}return _0x1b4382[_0xe3ca('0x1c')](_0x57237e)['end']();};}function respondWithResult(_0x15fada,_0x500002){_0x500002=_0x500002||0xc8;return function(_0x383c04){if(_0x383c04){return _0x15fada[_0xe3ca('0x1c')](_0x500002)[_0xe3ca('0x1d')](_0x383c04);}};}function respondWithFilteredResult(_0x30304b,_0x5cdc7c){return function(_0x15638f){if(_0x15638f){var _0x32fe2b=typeof _0x5cdc7c[_0xe3ca('0x1e')]===_0xe3ca('0x1f')&&typeof _0x5cdc7c['limit']===_0xe3ca('0x1f');var _0x53cf8d=_0x15638f[_0xe3ca('0x20')];var _0x5e33a9=_0x32fe2b?0x0:_0x5cdc7c[_0xe3ca('0x1e')];var _0x49eede=_0x32fe2b?_0x15638f['count']:_0x5cdc7c[_0xe3ca('0x1e')]+_0x5cdc7c[_0xe3ca('0x21')];var _0x11ee20;if(_0x49eede>=_0x53cf8d){_0x49eede=_0x53cf8d;_0x11ee20=0xc8;}else{_0x11ee20=0xce;}_0x30304b[_0xe3ca('0x1c')](_0x11ee20);return _0x30304b[_0xe3ca('0x22')](_0xe3ca('0x23'),_0x5e33a9+'-'+_0x49eede+'/'+_0x53cf8d)[_0xe3ca('0x1d')](_0x15638f);}return null;};}function patchUpdates(_0x14f3a0){return function(_0x17e6c1){try{jsonpatch[_0xe3ca('0x24')](_0x17e6c1,_0x14f3a0,!![]);}catch(_0x443d02){return BPromise[_0xe3ca('0x25')](_0x443d02);}return _0x17e6c1[_0xe3ca('0x26')]();};}function saveUpdates(_0x3fb32a,_0x343958){return function(_0x304466){if(_0x304466){return _0x304466[_0xe3ca('0x27')](_0x3fb32a)[_0xe3ca('0x28')](function(_0x26552d){return _0x26552d;});}return null;};}function removeEntity(_0x9cd1f,_0x4cdd38){return function(_0x554b63){if(_0x554b63){return _0x554b63[_0xe3ca('0x29')]()['then'](function(){_0x9cd1f[_0xe3ca('0x1c')](0xcc)[_0xe3ca('0x2a')]();});}};}function handleEntityNotFound(_0x1d5ccf,_0x446b74){return function(_0x58d861){if(!_0x58d861){_0x1d5ccf[_0xe3ca('0x1b')](0x194);}return _0x58d861;};}function handleError(_0x5cf227,_0x1b5f6a){_0x1b5f6a=_0x1b5f6a||0x1f4;return function(_0x4f878f){logger[_0xe3ca('0x2b')](_0x4f878f[_0xe3ca('0x2c')]);if(_0x4f878f[_0xe3ca('0x2d')]){delete _0x4f878f[_0xe3ca('0x2d')];}_0x5cf227['status'](_0x1b5f6a)[_0xe3ca('0x2e')](_0x4f878f);};}exports[_0xe3ca('0x2f')]=function(_0x18af99,_0x297fcd){var _0x3273cb={},_0x361fbb={},_0x912637={'count':0x0,'rows':[]};var _0x237e34=_[_0xe3ca('0x30')](db[_0xe3ca('0x31')][_0xe3ca('0x32')],function(_0x46e034){return{'name':_0x46e034['fieldName'],'type':_0x46e034[_0xe3ca('0x33')]['key']};});_0x361fbb[_0xe3ca('0x34')]=_[_0xe3ca('0x30')](_0x237e34,'name');_0x361fbb[_0xe3ca('0x35')]=_[_0xe3ca('0x36')](_0x18af99[_0xe3ca('0x35')]);_0x361fbb[_0xe3ca('0x37')]=_['intersection'](_0x361fbb[_0xe3ca('0x34')],_0x361fbb[_0xe3ca('0x35')]);_0x3273cb['attributes']=_[_0xe3ca('0x38')](_0x361fbb[_0xe3ca('0x34')],qs['fields'](_0x18af99[_0xe3ca('0x35')][_0xe3ca('0x39')]));_0x3273cb[_0xe3ca('0x3a')]=_0x3273cb[_0xe3ca('0x3a')]['length']?_0x3273cb['attributes']:_0x361fbb['model'];if(!_0x18af99[_0xe3ca('0x35')][_0xe3ca('0x3b')](_0xe3ca('0x3c'))){_0x3273cb[_0xe3ca('0x21')]=qs['limit'](_0x18af99[_0xe3ca('0x35')][_0xe3ca('0x21')]);_0x3273cb[_0xe3ca('0x1e')]=qs[_0xe3ca('0x1e')](_0x18af99[_0xe3ca('0x35')][_0xe3ca('0x1e')]);}_0x3273cb[_0xe3ca('0x3d')]=qs['sort'](_0x18af99[_0xe3ca('0x35')]['sort']);_0x3273cb[_0xe3ca('0x3e')]=qs[_0xe3ca('0x37')](_['pick'](_0x18af99['query'],_0x361fbb[_0xe3ca('0x37')]),_0x237e34);if(_0x18af99[_0xe3ca('0x35')][_0xe3ca('0x3f')]){_0x3273cb['where']=_[_0xe3ca('0x40')](_0x3273cb[_0xe3ca('0x3e')],{'$or':_['map'](_0x237e34,function(_0x208fee){if(_0x208fee[_0xe3ca('0x33')]!=='VIRTUAL'){var _0x3e7c94={};_0x3e7c94[_0x208fee[_0xe3ca('0x2d')]]={'$like':'%'+_0x18af99[_0xe3ca('0x35')][_0xe3ca('0x3f')]+'%'};return _0x3e7c94;}})});}_0x3273cb=_[_0xe3ca('0x40')]({},_0x3273cb,_0x18af99[_0xe3ca('0x41')]);var _0xedd994={'where':_0x3273cb[_0xe3ca('0x3e')]};return db[_0xe3ca('0x31')][_0xe3ca('0x20')](_0xedd994)[_0xe3ca('0x28')](function(_0x465c48){_0x912637[_0xe3ca('0x20')]=_0x465c48;if(_0x18af99[_0xe3ca('0x35')][_0xe3ca('0x42')]){_0x3273cb[_0xe3ca('0x43')]=[{'all':!![]}];}return db[_0xe3ca('0x31')][_0xe3ca('0x44')](_0x3273cb);})['then'](function(_0x41d5bf){_0x912637['rows']=_0x41d5bf;return _0x912637;})[_0xe3ca('0x28')](respondWithFilteredResult(_0x297fcd,_0x3273cb))[_0xe3ca('0x45')](handleError(_0x297fcd,null));};exports[_0xe3ca('0x46')]=function(_0x49bdaf,_0x4544da){var _0x1fdcb6={'raw':![],'where':{'id':_0x49bdaf[_0xe3ca('0x47')]['id']}},_0x2dd8e3={};_0x2dd8e3[_0xe3ca('0x34')]=_[_0xe3ca('0x36')](db[_0xe3ca('0x31')]['rawAttributes']);_0x2dd8e3[_0xe3ca('0x35')]=_[_0xe3ca('0x36')](_0x49bdaf[_0xe3ca('0x35')]);_0x2dd8e3[_0xe3ca('0x37')]=_[_0xe3ca('0x38')](_0x2dd8e3[_0xe3ca('0x34')],_0x2dd8e3[_0xe3ca('0x35')]);_0x1fdcb6[_0xe3ca('0x3a')]=_[_0xe3ca('0x38')](_0x2dd8e3[_0xe3ca('0x34')],qs[_0xe3ca('0x39')](_0x49bdaf[_0xe3ca('0x35')][_0xe3ca('0x39')]));_0x1fdcb6[_0xe3ca('0x3a')]=_0x1fdcb6['attributes'][_0xe3ca('0x48')]?_0x1fdcb6['attributes']:_0x2dd8e3[_0xe3ca('0x34')];if(_0x49bdaf[_0xe3ca('0x35')][_0xe3ca('0x42')]){_0x1fdcb6[_0xe3ca('0x43')]=[{'all':!![]}];}_0x1fdcb6=_[_0xe3ca('0x40')]({},_0x1fdcb6,_0x49bdaf[_0xe3ca('0x41')]);return db[_0xe3ca('0x31')][_0xe3ca('0x49')](_0x1fdcb6)[_0xe3ca('0x28')](handleEntityNotFound(_0x4544da,null))['then'](respondWithResult(_0x4544da,null))[_0xe3ca('0x45')](handleError(_0x4544da,null));};exports[_0xe3ca('0x4a')]=function(_0x199039,_0x1ab3da){return db[_0xe3ca('0x31')][_0xe3ca('0x4a')](_0x199039[_0xe3ca('0x4b')],{})[_0xe3ca('0x28')](respondWithResult(_0x1ab3da,0xc9))['catch'](handleError(_0x1ab3da,null));};exports[_0xe3ca('0x27')]=function(_0x54e0a7,_0x571af5){if(_0x54e0a7[_0xe3ca('0x4b')]['id']){delete _0x54e0a7[_0xe3ca('0x4b')]['id'];}return db[_0xe3ca('0x31')][_0xe3ca('0x49')]({'where':{'id':_0x54e0a7[_0xe3ca('0x47')]['id']}})[_0xe3ca('0x28')](handleEntityNotFound(_0x571af5,null))['then'](saveUpdates(_0x54e0a7[_0xe3ca('0x4b')],null))[_0xe3ca('0x28')](respondWithResult(_0x571af5,null))['catch'](handleError(_0x571af5,null));};exports[_0xe3ca('0x29')]=function(_0x50c854,_0x5ce1c8){return db[_0xe3ca('0x31')]['find']({'where':{'id':_0x50c854[_0xe3ca('0x47')]['id']}})[_0xe3ca('0x28')](handleEntityNotFound(_0x5ce1c8,null))[_0xe3ca('0x28')](removeEntity(_0x5ce1c8,null))[_0xe3ca('0x45')](handleError(_0x5ce1c8,null));};exports['getFields']=function(_0x4bb9c6,_0x1a6d9b,_0x158472){var _0x716c39={};var _0x425e90={};var _0x38d0fb;var _0x3df4cd;return db[_0xe3ca('0x31')][_0xe3ca('0x4c')]({'where':{'id':_0x4bb9c6[_0xe3ca('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a6d9b,null))[_0xe3ca('0x28')](function(_0x2c9878){if(_0x2c9878){_0x38d0fb=_0x2c9878;_0x425e90[_0xe3ca('0x34')]=_['keys'](db[_0xe3ca('0x4d')][_0xe3ca('0x32')]);_0x425e90['query']=_['keys'](_0x4bb9c6[_0xe3ca('0x35')]);_0x425e90['filters']=_[_0xe3ca('0x38')](_0x425e90[_0xe3ca('0x34')],_0x425e90[_0xe3ca('0x35')]);_0x716c39['attributes']=_[_0xe3ca('0x38')](_0x425e90[_0xe3ca('0x34')],qs[_0xe3ca('0x39')](_0x4bb9c6[_0xe3ca('0x35')][_0xe3ca('0x39')]));_0x716c39[_0xe3ca('0x3a')]=_0x716c39[_0xe3ca('0x3a')][_0xe3ca('0x48')]?_0x716c39[_0xe3ca('0x3a')]:_0x425e90[_0xe3ca('0x34')];_0x716c39[_0xe3ca('0x3d')]=qs['sort'](_0x4bb9c6[_0xe3ca('0x35')][_0xe3ca('0x4e')]);_0x716c39['where']=qs[_0xe3ca('0x37')](_[_0xe3ca('0x4f')](_0x4bb9c6['query'],_0x425e90[_0xe3ca('0x37')]));if(_0x4bb9c6[_0xe3ca('0x35')][_0xe3ca('0x3f')]){_0x716c39[_0xe3ca('0x3e')]=_[_0xe3ca('0x40')](_0x716c39[_0xe3ca('0x3e')],{'$or':_[_0xe3ca('0x30')](_0x716c39[_0xe3ca('0x3a')],function(_0x3e2d6e){var _0x3727e0={};_0x3727e0[_0x3e2d6e]={'$like':'%'+_0x4bb9c6[_0xe3ca('0x35')]['filter']+'%'};return _0x3727e0;})});}_0x716c39=_['merge']({},_0x716c39,_0x4bb9c6[_0xe3ca('0x41')]);return _0x38d0fb['getFields'](_0x716c39);}})[_0xe3ca('0x28')](function(_0x3aacc5){if(_0x3aacc5){_0x3df4cd=_0x3aacc5[_0xe3ca('0x48')];if(!_0x4bb9c6['query'][_0xe3ca('0x3b')](_0xe3ca('0x3c'))){_0x716c39[_0xe3ca('0x21')]=qs[_0xe3ca('0x21')](_0x4bb9c6[_0xe3ca('0x35')][_0xe3ca('0x21')]);_0x716c39['offset']=qs[_0xe3ca('0x1e')](_0x4bb9c6['query']['offset']);}return _0x38d0fb[_0xe3ca('0x50')](_0x716c39);}})[_0xe3ca('0x28')](function(_0x52db7c){if(_0x52db7c){return _0x52db7c?{'count':_0x3df4cd,'rows':_0x52db7c}:null;}})[_0xe3ca('0x28')](respondWithResult(_0x1a6d9b,null))[_0xe3ca('0x45')](handleError(_0x1a6d9b,null));};exports[_0xe3ca('0x51')]=function(_0x4053c6,_0x5a557a,_0x1a52bd){var _0x47b8dc={};var _0x412e6d={};var _0x2f3bb5;var _0x367d56;return db['ZendeskConfiguration'][_0xe3ca('0x4c')]({'where':{'id':_0x4053c6[_0xe3ca('0x47')]['id']}})['then'](handleEntityNotFound(_0x5a557a,null))['then'](function(_0x1ef999){if(_0x1ef999){_0x2f3bb5=_0x1ef999;_0x412e6d['model']=_['keys'](db[_0xe3ca('0x4d')][_0xe3ca('0x32')]);_0x412e6d['query']=_[_0xe3ca('0x36')](_0x4053c6['query']);_0x412e6d['filters']=_[_0xe3ca('0x38')](_0x412e6d[_0xe3ca('0x34')],_0x412e6d['query']);_0x47b8dc[_0xe3ca('0x3a')]=_[_0xe3ca('0x38')](_0x412e6d[_0xe3ca('0x34')],qs[_0xe3ca('0x39')](_0x4053c6[_0xe3ca('0x35')][_0xe3ca('0x39')]));_0x47b8dc[_0xe3ca('0x3a')]=_0x47b8dc['attributes'][_0xe3ca('0x48')]?_0x47b8dc[_0xe3ca('0x3a')]:_0x412e6d[_0xe3ca('0x34')];_0x47b8dc[_0xe3ca('0x3d')]=qs[_0xe3ca('0x4e')](_0x4053c6[_0xe3ca('0x35')]['sort']);_0x47b8dc[_0xe3ca('0x3e')]=qs[_0xe3ca('0x37')](_[_0xe3ca('0x4f')](_0x4053c6[_0xe3ca('0x35')],_0x412e6d[_0xe3ca('0x37')]));if(_0x4053c6[_0xe3ca('0x35')][_0xe3ca('0x3f')]){_0x47b8dc['where']=_[_0xe3ca('0x40')](_0x47b8dc['where'],{'$or':_[_0xe3ca('0x30')](_0x47b8dc[_0xe3ca('0x3a')],function(_0x3c9da5){var _0x452158={};_0x452158[_0x3c9da5]={'$like':'%'+_0x4053c6[_0xe3ca('0x35')][_0xe3ca('0x3f')]+'%'};return _0x452158;})});}_0x47b8dc=_[_0xe3ca('0x40')]({},_0x47b8dc,_0x4053c6[_0xe3ca('0x41')]);return _0x2f3bb5[_0xe3ca('0x51')](_0x47b8dc);}})[_0xe3ca('0x28')](function(_0x592355){if(_0x592355){_0x367d56=_0x592355['length'];if(!_0x4053c6['query'][_0xe3ca('0x3b')](_0xe3ca('0x3c'))){_0x47b8dc[_0xe3ca('0x21')]=qs[_0xe3ca('0x21')](_0x4053c6[_0xe3ca('0x35')][_0xe3ca('0x21')]);_0x47b8dc[_0xe3ca('0x1e')]=qs[_0xe3ca('0x1e')](_0x4053c6[_0xe3ca('0x35')]['offset']);}return _0x2f3bb5[_0xe3ca('0x51')](_0x47b8dc);}})['then'](function(_0x53702d){if(_0x53702d){return _0x53702d?{'count':_0x367d56,'rows':_0x53702d}:null;}})['then'](respondWithResult(_0x5a557a,null))['catch'](handleError(_0x5a557a,null));};exports[_0xe3ca('0x52')]=function(_0x22a39f,_0x4e4da9,_0x2f0277){var _0x5d7966={};var _0x1a25e4={};var _0x53a2d2;var _0x4e296b;return db['ZendeskConfiguration'][_0xe3ca('0x4c')]({'where':{'id':_0x22a39f[_0xe3ca('0x47')]['id']}})[_0xe3ca('0x28')](handleEntityNotFound(_0x4e4da9,null))['then'](function(_0x1358f2){if(_0x1358f2){_0x53a2d2=_0x1358f2;_0x1a25e4[_0xe3ca('0x34')]=_[_0xe3ca('0x36')](db[_0xe3ca('0x4d')]['rawAttributes']);_0x1a25e4['query']=_[_0xe3ca('0x36')](_0x22a39f[_0xe3ca('0x35')]);_0x1a25e4[_0xe3ca('0x37')]=_[_0xe3ca('0x38')](_0x1a25e4[_0xe3ca('0x34')],_0x1a25e4[_0xe3ca('0x35')]);_0x5d7966[_0xe3ca('0x3a')]=_['intersection'](_0x1a25e4[_0xe3ca('0x34')],qs[_0xe3ca('0x39')](_0x22a39f[_0xe3ca('0x35')][_0xe3ca('0x39')]));_0x5d7966[_0xe3ca('0x3a')]=_0x5d7966[_0xe3ca('0x3a')][_0xe3ca('0x48')]?_0x5d7966[_0xe3ca('0x3a')]:_0x1a25e4[_0xe3ca('0x34')];_0x5d7966['order']=qs[_0xe3ca('0x4e')](_0x22a39f[_0xe3ca('0x35')][_0xe3ca('0x4e')]);_0x5d7966[_0xe3ca('0x3e')]=qs['filters'](_[_0xe3ca('0x4f')](_0x22a39f[_0xe3ca('0x35')],_0x1a25e4[_0xe3ca('0x37')]));if(_0x22a39f[_0xe3ca('0x35')][_0xe3ca('0x3f')]){_0x5d7966[_0xe3ca('0x3e')]=_[_0xe3ca('0x40')](_0x5d7966[_0xe3ca('0x3e')],{'$or':_[_0xe3ca('0x30')](_0x5d7966[_0xe3ca('0x3a')],function(_0x78b839){var _0x54098e={};_0x54098e[_0x78b839]={'$like':'%'+_0x22a39f[_0xe3ca('0x35')][_0xe3ca('0x3f')]+'%'};return _0x54098e;})});}_0x5d7966=_[_0xe3ca('0x40')]({},_0x5d7966,_0x22a39f['options']);return _0x53a2d2[_0xe3ca('0x52')](_0x5d7966);}})['then'](function(_0x17332b){if(_0x17332b){_0x4e296b=_0x17332b[_0xe3ca('0x48')];if(!_0x22a39f['query'][_0xe3ca('0x3b')](_0xe3ca('0x3c'))){_0x5d7966[_0xe3ca('0x21')]=qs[_0xe3ca('0x21')](_0x22a39f['query']['limit']);_0x5d7966[_0xe3ca('0x1e')]=qs[_0xe3ca('0x1e')](_0x22a39f[_0xe3ca('0x35')][_0xe3ca('0x1e')]);}return _0x53a2d2['getDescriptions'](_0x5d7966);}})[_0xe3ca('0x28')](function(_0x14fbc0){if(_0x14fbc0){return _0x14fbc0?{'count':_0x4e296b,'rows':_0x14fbc0}:null;}})[_0xe3ca('0x28')](respondWithResult(_0x4e4da9,null))['catch'](handleError(_0x4e4da9,null));};exports['getTags']=function(_0x10dfe4,_0x508238,_0x430b03){var _0x1e2b99={};var _0x193020={};var _0x510add;var _0x4b4e05;return db[_0xe3ca('0x31')][_0xe3ca('0x4c')]({'where':{'id':_0x10dfe4[_0xe3ca('0x47')]['id']}})[_0xe3ca('0x28')](handleEntityNotFound(_0x508238,null))[_0xe3ca('0x28')](function(_0x131f15){if(_0x131f15){_0x510add=_0x131f15;_0x193020['model']=_[_0xe3ca('0x36')](db[_0xe3ca('0x53')][_0xe3ca('0x32')]);_0x193020[_0xe3ca('0x35')]=_[_0xe3ca('0x36')](_0x10dfe4[_0xe3ca('0x35')]);_0x193020[_0xe3ca('0x37')]=_[_0xe3ca('0x38')](_0x193020[_0xe3ca('0x34')],_0x193020[_0xe3ca('0x35')]);_0x1e2b99[_0xe3ca('0x3a')]=_[_0xe3ca('0x38')](_0x193020[_0xe3ca('0x34')],qs[_0xe3ca('0x39')](_0x10dfe4[_0xe3ca('0x35')][_0xe3ca('0x39')]));_0x1e2b99['attributes']=_0x1e2b99[_0xe3ca('0x3a')][_0xe3ca('0x48')]?_0x1e2b99['attributes']:_0x193020[_0xe3ca('0x34')];_0x1e2b99[_0xe3ca('0x3d')]=qs['sort'](_0x10dfe4['query'][_0xe3ca('0x4e')]);_0x1e2b99[_0xe3ca('0x3e')]=qs[_0xe3ca('0x37')](_[_0xe3ca('0x4f')](_0x10dfe4[_0xe3ca('0x35')],_0x193020['filters']));if(_0x10dfe4['query'][_0xe3ca('0x3f')]){_0x1e2b99[_0xe3ca('0x3e')]=_['merge'](_0x1e2b99[_0xe3ca('0x3e')],{'$or':_[_0xe3ca('0x30')](_0x1e2b99['attributes'],function(_0x86cda8){var _0x3fba3f={};_0x3fba3f[_0x86cda8]={'$like':'%'+_0x10dfe4[_0xe3ca('0x35')][_0xe3ca('0x3f')]+'%'};return _0x3fba3f;})});}_0x1e2b99=_[_0xe3ca('0x40')]({},_0x1e2b99,_0x10dfe4['options']);return _0x510add[_0xe3ca('0x54')](_0x1e2b99);}})[_0xe3ca('0x28')](function(_0x2ec77b){if(_0x2ec77b){_0x4b4e05=_0x2ec77b[_0xe3ca('0x48')];if(!_0x10dfe4[_0xe3ca('0x35')][_0xe3ca('0x3b')](_0xe3ca('0x3c'))){_0x1e2b99[_0xe3ca('0x21')]=qs[_0xe3ca('0x21')](_0x10dfe4[_0xe3ca('0x35')][_0xe3ca('0x21')]);_0x1e2b99[_0xe3ca('0x1e')]=qs[_0xe3ca('0x1e')](_0x10dfe4[_0xe3ca('0x35')][_0xe3ca('0x1e')]);}return _0x510add[_0xe3ca('0x54')](_0x1e2b99);}})[_0xe3ca('0x28')](function(_0x74fbff){if(_0x74fbff){return _0x74fbff?{'count':_0x4b4e05,'rows':_0x74fbff}:null;}})[_0xe3ca('0x28')](respondWithResult(_0x508238,null))[_0xe3ca('0x45')](handleError(_0x508238,null));};exports['setTags']=function(_0xa91711,_0x1a7cc9,_0x2480c4){if(_0xa91711['body']['id']){delete _0xa91711[_0xe3ca('0x4b')]['id'];}return db[_0xe3ca('0x31')]['findOne']({'where':{'id':_0xa91711[_0xe3ca('0x47')]['id']}})[_0xe3ca('0x28')](handleEntityNotFound(_0x1a7cc9,null))[_0xe3ca('0x28')](function(_0x196673){if(_0x196673){return _0x196673[_0xe3ca('0x55')](_0xa91711['body']['ids']||[]);}return null;})[_0xe3ca('0x28')](respondWithResult(_0x1a7cc9,null))['catch'](handleError(_0x1a7cc9,null));}; \ No newline at end of file +var _0x9d93=['model','query','filters','intersection','fields','attributes','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','body','find','findOne','ZendeskField','length','getFields','hasOwnProperty','nolimit','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','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','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','update','then','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x9d93,0xce));var _0x39d9=function(_0x39b206,_0x19f860){_0x39b206=_0x39b206-0x0;var _0x84d2b5=_0x9d93[_0x39b206];return _0x84d2b5;};'use strict';var emlformat=require(_0x39d9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x39d9('0x1'));var jsonpatch=require(_0x39d9('0x2'));var rp=require(_0x39d9('0x3'));var moment=require(_0x39d9('0x4'));var BPromise=require(_0x39d9('0x5'));var Mustache=require(_0x39d9('0x6'));var util=require(_0x39d9('0x7'));var path=require(_0x39d9('0x8'));var sox=require(_0x39d9('0x9'));var csv=require(_0x39d9('0xa'));var ejs=require(_0x39d9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x39d9('0xc'));var squel=require(_0x39d9('0xd'));var crypto=require(_0x39d9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x39d9('0xf'));var toCsv=require(_0x39d9('0xa'));var querystring=require('querystring');var Papa=require(_0x39d9('0x10'));var Redis=require(_0x39d9('0x11'));var authService=require(_0x39d9('0x12'));var qs=require(_0x39d9('0x13'));var as=require(_0x39d9('0x14'));var hardwareService=require(_0x39d9('0x15'));var logger=require(_0x39d9('0x16'))('api');var utils=require(_0x39d9('0x17'));var config=require(_0x39d9('0x18'));var licenseUtil=require(_0x39d9('0x19'));var db=require(_0x39d9('0x1a'))['db'];function respondWithStatusCode(_0x4e7e9b,_0xd0dae){_0xd0dae=_0xd0dae||0xcc;return function(_0x2a4540){if(_0x2a4540){return _0x4e7e9b[_0x39d9('0x1b')](_0xd0dae);}return _0x4e7e9b['status'](_0xd0dae)[_0x39d9('0x1c')]();};}function respondWithResult(_0x4da4e8,_0x1e63bc){_0x1e63bc=_0x1e63bc||0xc8;return function(_0x2b6e59){if(_0x2b6e59){return _0x4da4e8['status'](_0x1e63bc)[_0x39d9('0x1d')](_0x2b6e59);}};}function respondWithFilteredResult(_0x1b0ff2,_0x4e7965){return function(_0xf23bb3){if(_0xf23bb3){var _0x3a693f=typeof _0x4e7965[_0x39d9('0x1e')]===_0x39d9('0x1f')&&typeof _0x4e7965[_0x39d9('0x20')]===_0x39d9('0x1f');var _0x266b46=_0xf23bb3[_0x39d9('0x21')];var _0x3ef247=_0x3a693f?0x0:_0x4e7965[_0x39d9('0x1e')];var _0x2dfd91=_0x3a693f?_0xf23bb3['count']:_0x4e7965[_0x39d9('0x1e')]+_0x4e7965[_0x39d9('0x20')];var _0x2a3090;if(_0x2dfd91>=_0x266b46){_0x2dfd91=_0x266b46;_0x2a3090=0xc8;}else{_0x2a3090=0xce;}_0x1b0ff2[_0x39d9('0x22')](_0x2a3090);return _0x1b0ff2[_0x39d9('0x23')]('Content-Range',_0x3ef247+'-'+_0x2dfd91+'/'+_0x266b46)[_0x39d9('0x1d')](_0xf23bb3);}return null;};}function patchUpdates(_0x13ac66){return function(_0x4ddc0b){try{jsonpatch['apply'](_0x4ddc0b,_0x13ac66,!![]);}catch(_0x5da10c){return BPromise[_0x39d9('0x24')](_0x5da10c);}return _0x4ddc0b[_0x39d9('0x25')]();};}function saveUpdates(_0x3f3020,_0x475a05){return function(_0x2a2f76){if(_0x2a2f76){return _0x2a2f76[_0x39d9('0x26')](_0x3f3020)[_0x39d9('0x27')](function(_0x40c853){return _0x40c853;});}return null;};}function removeEntity(_0x23446b,_0x392887){return function(_0x48e9e8){if(_0x48e9e8){return _0x48e9e8[_0x39d9('0x28')]()[_0x39d9('0x27')](function(){_0x23446b['status'](0xcc)[_0x39d9('0x1c')]();});}};}function handleEntityNotFound(_0x4b3dbc,_0x5d9f60){return function(_0xe3a26f){if(!_0xe3a26f){_0x4b3dbc['sendStatus'](0x194);}return _0xe3a26f;};}function handleError(_0x581f82,_0x170903){_0x170903=_0x170903||0x1f4;return function(_0x11cd73){logger[_0x39d9('0x29')](_0x11cd73[_0x39d9('0x2a')]);if(_0x11cd73['name']){delete _0x11cd73[_0x39d9('0x2b')];}_0x581f82[_0x39d9('0x22')](_0x170903)[_0x39d9('0x2c')](_0x11cd73);};}exports[_0x39d9('0x2d')]=function(_0x3451ca,_0x5c0929){var _0x27326e={},_0x2731a4={},_0x4781a0={'count':0x0,'rows':[]};var _0x5c354f=_[_0x39d9('0x2e')](db[_0x39d9('0x2f')][_0x39d9('0x30')],function(_0x4e3b92){return{'name':_0x4e3b92[_0x39d9('0x31')],'type':_0x4e3b92[_0x39d9('0x32')][_0x39d9('0x33')]};});_0x2731a4[_0x39d9('0x34')]=_[_0x39d9('0x2e')](_0x5c354f,'name');_0x2731a4[_0x39d9('0x35')]=_['keys'](_0x3451ca[_0x39d9('0x35')]);_0x2731a4[_0x39d9('0x36')]=_['intersection'](_0x2731a4['model'],_0x2731a4['query']);_0x27326e['attributes']=_[_0x39d9('0x37')](_0x2731a4['model'],qs[_0x39d9('0x38')](_0x3451ca['query'][_0x39d9('0x38')]));_0x27326e[_0x39d9('0x39')]=_0x27326e['attributes']['length']?_0x27326e[_0x39d9('0x39')]:_0x2731a4[_0x39d9('0x34')];if(!_0x3451ca[_0x39d9('0x35')]['hasOwnProperty']('nolimit')){_0x27326e[_0x39d9('0x20')]=qs['limit'](_0x3451ca[_0x39d9('0x35')][_0x39d9('0x20')]);_0x27326e[_0x39d9('0x1e')]=qs[_0x39d9('0x1e')](_0x3451ca['query'][_0x39d9('0x1e')]);}_0x27326e[_0x39d9('0x3a')]=qs['sort'](_0x3451ca['query'][_0x39d9('0x3b')]);_0x27326e['where']=qs[_0x39d9('0x36')](_[_0x39d9('0x3c')](_0x3451ca[_0x39d9('0x35')],_0x2731a4[_0x39d9('0x36')]),_0x5c354f);if(_0x3451ca[_0x39d9('0x35')][_0x39d9('0x3d')]){_0x27326e[_0x39d9('0x3e')]=_[_0x39d9('0x3f')](_0x27326e[_0x39d9('0x3e')],{'$or':_['map'](_0x5c354f,function(_0x42998a){if(_0x42998a[_0x39d9('0x32')]!==_0x39d9('0x40')){var _0x3ed864={};_0x3ed864[_0x42998a[_0x39d9('0x2b')]]={'$like':'%'+_0x3451ca[_0x39d9('0x35')][_0x39d9('0x3d')]+'%'};return _0x3ed864;}})});}_0x27326e=_[_0x39d9('0x3f')]({},_0x27326e,_0x3451ca[_0x39d9('0x41')]);var _0x551456={'where':_0x27326e[_0x39d9('0x3e')]};return db['ZendeskConfiguration'][_0x39d9('0x21')](_0x551456)[_0x39d9('0x27')](function(_0x10445c){_0x4781a0[_0x39d9('0x21')]=_0x10445c;if(_0x3451ca[_0x39d9('0x35')][_0x39d9('0x42')]){_0x27326e[_0x39d9('0x43')]=[{'all':!![]}];}return db[_0x39d9('0x2f')]['findAll'](_0x27326e);})['then'](function(_0x556ba2){_0x4781a0['rows']=_0x556ba2;return _0x4781a0;})[_0x39d9('0x27')](respondWithFilteredResult(_0x5c0929,_0x27326e))[_0x39d9('0x44')](handleError(_0x5c0929,null));};exports[_0x39d9('0x45')]=function(_0x5cf8d0,_0x1b9ecf){var _0x21d324={'raw':![],'where':{'id':_0x5cf8d0[_0x39d9('0x46')]['id']}},_0x25d839={};_0x25d839[_0x39d9('0x34')]=_['keys'](db[_0x39d9('0x2f')][_0x39d9('0x30')]);_0x25d839[_0x39d9('0x35')]=_[_0x39d9('0x47')](_0x5cf8d0['query']);_0x25d839[_0x39d9('0x36')]=_[_0x39d9('0x37')](_0x25d839[_0x39d9('0x34')],_0x25d839[_0x39d9('0x35')]);_0x21d324[_0x39d9('0x39')]=_[_0x39d9('0x37')](_0x25d839[_0x39d9('0x34')],qs['fields'](_0x5cf8d0[_0x39d9('0x35')][_0x39d9('0x38')]));_0x21d324[_0x39d9('0x39')]=_0x21d324[_0x39d9('0x39')]['length']?_0x21d324['attributes']:_0x25d839['model'];if(_0x5cf8d0[_0x39d9('0x35')][_0x39d9('0x42')]){_0x21d324[_0x39d9('0x43')]=[{'all':!![]}];}_0x21d324=_[_0x39d9('0x3f')]({},_0x21d324,_0x5cf8d0[_0x39d9('0x41')]);return db['ZendeskConfiguration']['find'](_0x21d324)[_0x39d9('0x27')](handleEntityNotFound(_0x1b9ecf,null))[_0x39d9('0x27')](respondWithResult(_0x1b9ecf,null))[_0x39d9('0x44')](handleError(_0x1b9ecf,null));};exports['create']=function(_0x83cd29,_0x3915a1){return db[_0x39d9('0x2f')]['create'](_0x83cd29[_0x39d9('0x48')],{})[_0x39d9('0x27')](respondWithResult(_0x3915a1,0xc9))['catch'](handleError(_0x3915a1,null));};exports[_0x39d9('0x26')]=function(_0x1ef223,_0x42b6e1){if(_0x1ef223[_0x39d9('0x48')]['id']){delete _0x1ef223[_0x39d9('0x48')]['id'];}return db[_0x39d9('0x2f')][_0x39d9('0x49')]({'where':{'id':_0x1ef223['params']['id']}})[_0x39d9('0x27')](handleEntityNotFound(_0x42b6e1,null))[_0x39d9('0x27')](saveUpdates(_0x1ef223[_0x39d9('0x48')],null))['then'](respondWithResult(_0x42b6e1,null))[_0x39d9('0x44')](handleError(_0x42b6e1,null));};exports[_0x39d9('0x28')]=function(_0x25d634,_0x5c5be9){return db[_0x39d9('0x2f')]['find']({'where':{'id':_0x25d634[_0x39d9('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c5be9,null))[_0x39d9('0x27')](removeEntity(_0x5c5be9,null))[_0x39d9('0x44')](handleError(_0x5c5be9,null));};exports['getFields']=function(_0x3ef7f9,_0x48573a,_0x14aa1d){var _0xa20351={};var _0x138840={};var _0x39477b;var _0x4fd80f;return db['ZendeskConfiguration'][_0x39d9('0x4a')]({'where':{'id':_0x3ef7f9[_0x39d9('0x46')]['id']}})[_0x39d9('0x27')](handleEntityNotFound(_0x48573a,null))[_0x39d9('0x27')](function(_0x1d496f){if(_0x1d496f){_0x39477b=_0x1d496f;_0x138840[_0x39d9('0x34')]=_[_0x39d9('0x47')](db[_0x39d9('0x4b')]['rawAttributes']);_0x138840[_0x39d9('0x35')]=_[_0x39d9('0x47')](_0x3ef7f9[_0x39d9('0x35')]);_0x138840[_0x39d9('0x36')]=_[_0x39d9('0x37')](_0x138840['model'],_0x138840[_0x39d9('0x35')]);_0xa20351[_0x39d9('0x39')]=_['intersection'](_0x138840[_0x39d9('0x34')],qs['fields'](_0x3ef7f9[_0x39d9('0x35')]['fields']));_0xa20351['attributes']=_0xa20351[_0x39d9('0x39')][_0x39d9('0x4c')]?_0xa20351[_0x39d9('0x39')]:_0x138840[_0x39d9('0x34')];_0xa20351[_0x39d9('0x3a')]=qs[_0x39d9('0x3b')](_0x3ef7f9[_0x39d9('0x35')][_0x39d9('0x3b')]);_0xa20351[_0x39d9('0x3e')]=qs['filters'](_[_0x39d9('0x3c')](_0x3ef7f9['query'],_0x138840['filters']));if(_0x3ef7f9[_0x39d9('0x35')]['filter']){_0xa20351['where']=_[_0x39d9('0x3f')](_0xa20351['where'],{'$or':_[_0x39d9('0x2e')](_0xa20351['attributes'],function(_0x1341e7){var _0x4060fd={};_0x4060fd[_0x1341e7]={'$like':'%'+_0x3ef7f9['query'][_0x39d9('0x3d')]+'%'};return _0x4060fd;})});}_0xa20351=_[_0x39d9('0x3f')]({},_0xa20351,_0x3ef7f9['options']);return _0x39477b[_0x39d9('0x4d')](_0xa20351);}})[_0x39d9('0x27')](function(_0x5d1bb9){if(_0x5d1bb9){_0x4fd80f=_0x5d1bb9['length'];if(!_0x3ef7f9['query'][_0x39d9('0x4e')]('nolimit')){_0xa20351[_0x39d9('0x20')]=qs[_0x39d9('0x20')](_0x3ef7f9[_0x39d9('0x35')]['limit']);_0xa20351[_0x39d9('0x1e')]=qs['offset'](_0x3ef7f9[_0x39d9('0x35')][_0x39d9('0x1e')]);}return _0x39477b[_0x39d9('0x4d')](_0xa20351);}})[_0x39d9('0x27')](function(_0x1fc5cf){if(_0x1fc5cf){return _0x1fc5cf?{'count':_0x4fd80f,'rows':_0x1fc5cf}:null;}})[_0x39d9('0x27')](respondWithResult(_0x48573a,null))[_0x39d9('0x44')](handleError(_0x48573a,null));};exports['getSubjects']=function(_0xc655d9,_0x2a46e1,_0x8eaa25){var _0x52fa34={};var _0x737d0={};var _0x2f15ca;var _0xcd550e;return db[_0x39d9('0x2f')][_0x39d9('0x4a')]({'where':{'id':_0xc655d9[_0x39d9('0x46')]['id']}})[_0x39d9('0x27')](handleEntityNotFound(_0x2a46e1,null))[_0x39d9('0x27')](function(_0x335841){if(_0x335841){_0x2f15ca=_0x335841;_0x737d0['model']=_[_0x39d9('0x47')](db['ZendeskField'][_0x39d9('0x30')]);_0x737d0['query']=_[_0x39d9('0x47')](_0xc655d9[_0x39d9('0x35')]);_0x737d0[_0x39d9('0x36')]=_['intersection'](_0x737d0['model'],_0x737d0['query']);_0x52fa34['attributes']=_['intersection'](_0x737d0[_0x39d9('0x34')],qs['fields'](_0xc655d9[_0x39d9('0x35')][_0x39d9('0x38')]));_0x52fa34[_0x39d9('0x39')]=_0x52fa34[_0x39d9('0x39')]['length']?_0x52fa34['attributes']:_0x737d0[_0x39d9('0x34')];_0x52fa34[_0x39d9('0x3a')]=qs[_0x39d9('0x3b')](_0xc655d9[_0x39d9('0x35')][_0x39d9('0x3b')]);_0x52fa34[_0x39d9('0x3e')]=qs[_0x39d9('0x36')](_['pick'](_0xc655d9[_0x39d9('0x35')],_0x737d0['filters']));if(_0xc655d9[_0x39d9('0x35')][_0x39d9('0x3d')]){_0x52fa34[_0x39d9('0x3e')]=_[_0x39d9('0x3f')](_0x52fa34[_0x39d9('0x3e')],{'$or':_[_0x39d9('0x2e')](_0x52fa34[_0x39d9('0x39')],function(_0x200964){var _0x2855c0={};_0x2855c0[_0x200964]={'$like':'%'+_0xc655d9['query']['filter']+'%'};return _0x2855c0;})});}_0x52fa34=_[_0x39d9('0x3f')]({},_0x52fa34,_0xc655d9['options']);return _0x2f15ca['getSubjects'](_0x52fa34);}})['then'](function(_0x462661){if(_0x462661){_0xcd550e=_0x462661['length'];if(!_0xc655d9[_0x39d9('0x35')]['hasOwnProperty'](_0x39d9('0x4f'))){_0x52fa34[_0x39d9('0x20')]=qs[_0x39d9('0x20')](_0xc655d9['query'][_0x39d9('0x20')]);_0x52fa34[_0x39d9('0x1e')]=qs['offset'](_0xc655d9[_0x39d9('0x35')][_0x39d9('0x1e')]);}return _0x2f15ca[_0x39d9('0x50')](_0x52fa34);}})[_0x39d9('0x27')](function(_0x3b6914){if(_0x3b6914){return _0x3b6914?{'count':_0xcd550e,'rows':_0x3b6914}:null;}})[_0x39d9('0x27')](respondWithResult(_0x2a46e1,null))[_0x39d9('0x44')](handleError(_0x2a46e1,null));};exports[_0x39d9('0x51')]=function(_0x29a719,_0x11e0c8,_0x14a562){var _0x3aa458={};var _0x351f5c={};var _0x49e9cf;var _0x1c9ec2;return db['ZendeskConfiguration'][_0x39d9('0x4a')]({'where':{'id':_0x29a719[_0x39d9('0x46')]['id']}})['then'](handleEntityNotFound(_0x11e0c8,null))[_0x39d9('0x27')](function(_0x357b15){if(_0x357b15){_0x49e9cf=_0x357b15;_0x351f5c[_0x39d9('0x34')]=_['keys'](db[_0x39d9('0x4b')][_0x39d9('0x30')]);_0x351f5c[_0x39d9('0x35')]=_[_0x39d9('0x47')](_0x29a719[_0x39d9('0x35')]);_0x351f5c[_0x39d9('0x36')]=_[_0x39d9('0x37')](_0x351f5c[_0x39d9('0x34')],_0x351f5c[_0x39d9('0x35')]);_0x3aa458['attributes']=_[_0x39d9('0x37')](_0x351f5c['model'],qs[_0x39d9('0x38')](_0x29a719['query']['fields']));_0x3aa458[_0x39d9('0x39')]=_0x3aa458[_0x39d9('0x39')][_0x39d9('0x4c')]?_0x3aa458[_0x39d9('0x39')]:_0x351f5c[_0x39d9('0x34')];_0x3aa458[_0x39d9('0x3a')]=qs[_0x39d9('0x3b')](_0x29a719['query'][_0x39d9('0x3b')]);_0x3aa458[_0x39d9('0x3e')]=qs[_0x39d9('0x36')](_[_0x39d9('0x3c')](_0x29a719[_0x39d9('0x35')],_0x351f5c[_0x39d9('0x36')]));if(_0x29a719[_0x39d9('0x35')][_0x39d9('0x3d')]){_0x3aa458[_0x39d9('0x3e')]=_[_0x39d9('0x3f')](_0x3aa458['where'],{'$or':_[_0x39d9('0x2e')](_0x3aa458[_0x39d9('0x39')],function(_0xd7064f){var _0x33cd22={};_0x33cd22[_0xd7064f]={'$like':'%'+_0x29a719[_0x39d9('0x35')][_0x39d9('0x3d')]+'%'};return _0x33cd22;})});}_0x3aa458=_[_0x39d9('0x3f')]({},_0x3aa458,_0x29a719['options']);return _0x49e9cf[_0x39d9('0x51')](_0x3aa458);}})[_0x39d9('0x27')](function(_0x432df3){if(_0x432df3){_0x1c9ec2=_0x432df3[_0x39d9('0x4c')];if(!_0x29a719[_0x39d9('0x35')][_0x39d9('0x4e')](_0x39d9('0x4f'))){_0x3aa458[_0x39d9('0x20')]=qs[_0x39d9('0x20')](_0x29a719[_0x39d9('0x35')][_0x39d9('0x20')]);_0x3aa458[_0x39d9('0x1e')]=qs[_0x39d9('0x1e')](_0x29a719[_0x39d9('0x35')]['offset']);}return _0x49e9cf[_0x39d9('0x51')](_0x3aa458);}})[_0x39d9('0x27')](function(_0x3fe951){if(_0x3fe951){return _0x3fe951?{'count':_0x1c9ec2,'rows':_0x3fe951}:null;}})[_0x39d9('0x27')](respondWithResult(_0x11e0c8,null))['catch'](handleError(_0x11e0c8,null));};exports['getTags']=function(_0x220b5d,_0x451567,_0x1c3b52){var _0x445e2f={};var _0x2604f8={};var _0x2f4750;var _0x30bfa5;return db[_0x39d9('0x2f')][_0x39d9('0x4a')]({'where':{'id':_0x220b5d[_0x39d9('0x46')]['id']}})[_0x39d9('0x27')](handleEntityNotFound(_0x451567,null))[_0x39d9('0x27')](function(_0x45f629){if(_0x45f629){_0x2f4750=_0x45f629;_0x2604f8[_0x39d9('0x34')]=_[_0x39d9('0x47')](db[_0x39d9('0x52')][_0x39d9('0x30')]);_0x2604f8[_0x39d9('0x35')]=_[_0x39d9('0x47')](_0x220b5d[_0x39d9('0x35')]);_0x2604f8[_0x39d9('0x36')]=_[_0x39d9('0x37')](_0x2604f8[_0x39d9('0x34')],_0x2604f8[_0x39d9('0x35')]);_0x445e2f[_0x39d9('0x39')]=_[_0x39d9('0x37')](_0x2604f8[_0x39d9('0x34')],qs[_0x39d9('0x38')](_0x220b5d[_0x39d9('0x35')][_0x39d9('0x38')]));_0x445e2f['attributes']=_0x445e2f[_0x39d9('0x39')][_0x39d9('0x4c')]?_0x445e2f['attributes']:_0x2604f8[_0x39d9('0x34')];_0x445e2f[_0x39d9('0x3a')]=qs['sort'](_0x220b5d[_0x39d9('0x35')][_0x39d9('0x3b')]);_0x445e2f[_0x39d9('0x3e')]=qs[_0x39d9('0x36')](_['pick'](_0x220b5d[_0x39d9('0x35')],_0x2604f8[_0x39d9('0x36')]));if(_0x220b5d[_0x39d9('0x35')][_0x39d9('0x3d')]){_0x445e2f['where']=_[_0x39d9('0x3f')](_0x445e2f[_0x39d9('0x3e')],{'$or':_[_0x39d9('0x2e')](_0x445e2f[_0x39d9('0x39')],function(_0x3d0dbd){var _0x23804d={};_0x23804d[_0x3d0dbd]={'$like':'%'+_0x220b5d['query']['filter']+'%'};return _0x23804d;})});}_0x445e2f=_[_0x39d9('0x3f')]({},_0x445e2f,_0x220b5d[_0x39d9('0x41')]);return _0x2f4750[_0x39d9('0x53')](_0x445e2f);}})[_0x39d9('0x27')](function(_0x5ce68a){if(_0x5ce68a){_0x30bfa5=_0x5ce68a['length'];if(!_0x220b5d[_0x39d9('0x35')][_0x39d9('0x4e')](_0x39d9('0x4f'))){_0x445e2f[_0x39d9('0x20')]=qs[_0x39d9('0x20')](_0x220b5d[_0x39d9('0x35')]['limit']);_0x445e2f[_0x39d9('0x1e')]=qs[_0x39d9('0x1e')](_0x220b5d[_0x39d9('0x35')][_0x39d9('0x1e')]);}return _0x2f4750['getTags'](_0x445e2f);}})[_0x39d9('0x27')](function(_0x2f1f8e){if(_0x2f1f8e){return _0x2f1f8e?{'count':_0x30bfa5,'rows':_0x2f1f8e}:null;}})[_0x39d9('0x27')](respondWithResult(_0x451567,null))['catch'](handleError(_0x451567,null));};exports[_0x39d9('0x54')]=function(_0x54957e,_0x4665ed,_0x36b489){if(_0x54957e[_0x39d9('0x48')]['id']){delete _0x54957e['body']['id'];}return db[_0x39d9('0x2f')][_0x39d9('0x4a')]({'where':{'id':_0x54957e[_0x39d9('0x46')]['id']}})[_0x39d9('0x27')](handleEntityNotFound(_0x4665ed,null))[_0x39d9('0x27')](function(_0x410d1f){if(_0x410d1f){return _0x410d1f[_0x39d9('0x54')](_0x54957e[_0x39d9('0x48')][_0x39d9('0x55')]||[]);}return null;})[_0x39d9('0x27')](respondWithResult(_0x4665ed,null))[_0x39d9('0x44')](handleError(_0x4665ed,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index e857bca..45a59cb 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 _0xe1e3=['exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','api','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x592eeb,_0x10ef82){var _0x3ea777=function(_0x4ca4f7){while(--_0x4ca4f7){_0x592eeb['push'](_0x592eeb['shift']());}};_0x3ea777(++_0x10ef82);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0xb5a306,_0x48753c){_0xb5a306=_0xb5a306-0x0;var _0x3ac0c2=_0xe1e3[_0xb5a306];return _0x3ac0c2;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var logger=require('../../config/logger')(_0x3e1e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3e1e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e1e('0x4'));var config=require(_0x3e1e('0x5'));var attributes=require(_0x3e1e('0x6'));module[_0x3e1e('0x7')]=function(_0x40d6d8,_0x25701f){return _0x40d6d8['define'](_0x3e1e('0x8'),attributes,{'tableName':_0x3e1e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1775=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','util'];(function(_0x1716cc,_0x4c5296){var _0x52e40b=function(_0x182dc1){while(--_0x182dc1){_0x1716cc['push'](_0x1716cc['shift']());}};_0x52e40b(++_0x4c5296);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var logger=require(_0x5177('0x1'))(_0x5177('0x2'));var moment=require(_0x5177('0x3'));var BPromise=require(_0x5177('0x4'));var rp=require(_0x5177('0x5'));var fs=require('fs');var path=require(_0x5177('0x6'));var rimraf=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var attributes=require(_0x5177('0x9'));module[_0x5177('0xa')]=function(_0x2c5c42,_0x153c1a){return _0x2c5c42[_0x5177('0xb')](_0x5177('0xc'),attributes,{'tableName':_0x5177('0xd'),'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 951dc28..13c8916 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 _0x9dcb=['request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info'];(function(_0x1d8c1c,_0x3154ec){var _0x30c472=function(_0x180dfa){while(--_0x180dfa){_0x1d8c1c['push'](_0x1d8c1c['shift']());}};_0x30c472(++_0x3154ec);}(_0x9dcb,0x1d7));var _0xb9dc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9dcb[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb9dc('0x0'));var BPromise=require(_0xb9dc('0x1'));var rs=require(_0xb9dc('0x2'));var fs=require('fs');var Redis=require(_0xb9dc('0x3'));var db=require(_0xb9dc('0x4'))['db'];var utils=require(_0xb9dc('0x5'));var logger=require(_0xb9dc('0x6'))('rpc');var config=require(_0xb9dc('0x7'));var jayson=require(_0xb9dc('0x8'));var client=jayson[_0xb9dc('0x9')][_0xb9dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20597e,_0xf0ee14,_0x304e9d){return new BPromise(function(_0x479204,_0xa53b61){return client['request'](_0x20597e,_0x304e9d)['then'](function(_0x53ee97){logger[_0xb9dc('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0xf0ee14,_0xb9dc('0xc'));logger[_0xb9dc('0xd')](_0xb9dc('0xe'),_0xf0ee14,'request\x20sent',JSON[_0xb9dc('0xf')](_0x53ee97));if(_0x53ee97[_0xb9dc('0x10')]){if(_0x53ee97[_0xb9dc('0x10')]['code']===0x1f4){logger[_0xb9dc('0x10')](_0xb9dc('0x11'),_0xf0ee14,_0x53ee97[_0xb9dc('0x10')][_0xb9dc('0x12')]);return _0xa53b61(_0x53ee97[_0xb9dc('0x10')]['message']);}logger['error'](_0xb9dc('0x11'),_0xf0ee14,_0x53ee97['error']['message']);return _0x479204(_0x53ee97[_0xb9dc('0x10')][_0xb9dc('0x12')]);}else{logger[_0xb9dc('0xb')](_0xb9dc('0x11'),_0xf0ee14,_0xb9dc('0xc'));_0x479204(_0x53ee97[_0xb9dc('0x13')]['message']);}})[_0xb9dc('0x14')](function(_0x4b4949){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0xf0ee14,_0x4b4949);_0xa53b61(_0x4b4949);});});} \ No newline at end of file +var _0x06bf=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x1ca7ed,_0x2cccb4){var _0x5d706a=function(_0x304db1){while(--_0x304db1){_0x1ca7ed['push'](_0x1ca7ed['shift']());}};_0x5d706a(++_0x2cccb4);}(_0x06bf,0x1b6));var _0xf06b=function(_0x1df526,_0x54a6c7){_0x1df526=_0x1df526-0x0;var _0x5cc61c=_0x06bf[_0x1df526];return _0x5cc61c;};'use strict';var _=require(_0xf06b('0x0'));var util=require(_0xf06b('0x1'));var moment=require(_0xf06b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf06b('0x3'));var db=require(_0xf06b('0x4'))['db'];var utils=require(_0xf06b('0x5'));var logger=require('../../config/logger')(_0xf06b('0x6'));var config=require(_0xf06b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf06b('0x8')][_0xf06b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10d7dd,_0x4db9a0,_0x53e5de){return new BPromise(function(_0x507f7c,_0x5aafbc){return client[_0xf06b('0xa')](_0x10d7dd,_0x53e5de)[_0xf06b('0xb')](function(_0x19b2ee){logger[_0xf06b('0xc')](_0xf06b('0xd'),_0x4db9a0,'request\x20sent');logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4db9a0,_0xf06b('0xe'),JSON[_0xf06b('0xf')](_0x19b2ee));if(_0x19b2ee['error']){if(_0x19b2ee[_0xf06b('0x10')][_0xf06b('0x11')]===0x1f4){logger['error'](_0xf06b('0xd'),_0x4db9a0,_0x19b2ee['error'][_0xf06b('0x12')]);return _0x5aafbc(_0x19b2ee[_0xf06b('0x10')]['message']);}logger[_0xf06b('0x10')](_0xf06b('0xd'),_0x4db9a0,_0x19b2ee[_0xf06b('0x10')][_0xf06b('0x12')]);return _0x507f7c(_0x19b2ee['error'][_0xf06b('0x12')]);}else{logger[_0xf06b('0xc')](_0xf06b('0xd'),_0x4db9a0,_0xf06b('0xe'));_0x507f7c(_0x19b2ee[_0xf06b('0x13')][_0xf06b('0x12')]);}})[_0xf06b('0x14')](function(_0x1bd094){logger[_0xf06b('0x10')](_0xf06b('0xd'),_0x4db9a0,_0x1bd094);_0x5aafbc(_0x1bd094);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 3b095c5..910a2c5 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 _0x2f67=['/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get'];(function(_0xf820fe,_0x165aef){var _0x445f08=function(_0x1f9649){while(--_0x1f9649){_0xf820fe['push'](_0xf820fe['shift']());}};_0x445f08(++_0x165aef);}(_0x2f67,0x147));var _0x72f6=function(_0x1f96a1,_0x1172dc){_0x1f96a1=_0x1f96a1-0x0;var _0x4b70f2=_0x2f67[_0x1f96a1];return _0x4b70f2;};'use strict';var multer=require('multer');var util=require(_0x72f6('0x0'));var path=require(_0x72f6('0x1'));var timeout=require(_0x72f6('0x2'));var express=require(_0x72f6('0x3'));var router=express[_0x72f6('0x4')]();var fs_extra=require(_0x72f6('0x5'));var auth=require(_0x72f6('0x6'));var interaction=require(_0x72f6('0x7'));var config=require(_0x72f6('0x8'));var controller=require(_0x72f6('0x9'));router['get']('/',auth[_0x72f6('0xa')](),controller[_0x72f6('0xb')]);router[_0x72f6('0xc')](_0x72f6('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x72f6('0xe')]('/',auth[_0x72f6('0xa')](),controller[_0x72f6('0xf')]);router[_0x72f6('0x10')](_0x72f6('0xd'),auth[_0x72f6('0xa')](),controller[_0x72f6('0x11')]);router['delete']('/:id',auth[_0x72f6('0xa')](),controller[_0x72f6('0x12')]);module[_0x72f6('0x13')]=router; \ No newline at end of file +var _0x5681=['/:id','show','post','put','update','destroy','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5681,0x105));var _0x1568=function(_0x8386ea,_0x45474d){_0x8386ea=_0x8386ea-0x0;var _0x369414=_0x5681[_0x8386ea];return _0x369414;};'use strict';var multer=require('multer');var util=require(_0x1568('0x0'));var path=require(_0x1568('0x1'));var timeout=require(_0x1568('0x2'));var express=require('express');var router=express[_0x1568('0x3')]();var fs_extra=require(_0x1568('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1568('0x5'));var config=require('../../config/environment');var controller=require(_0x1568('0x6'));router[_0x1568('0x7')]('/',auth[_0x1568('0x8')](),controller['index']);router[_0x1568('0x7')](_0x1568('0x9'),auth[_0x1568('0x8')](),controller[_0x1568('0xa')]);router[_0x1568('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1568('0xc')](_0x1568('0x9'),auth[_0x1568('0x8')](),controller[_0x1568('0xd')]);router['delete']('/:id',auth[_0x1568('0x8')](),controller[_0x1568('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 9636b99..e68437b 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 _0x99ab=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x5820b7,_0x5d9dca){var _0x14cf2b=function(_0x3fee49){while(--_0x3fee49){_0x5820b7['push'](_0x5820b7['shift']());}};_0x14cf2b(++_0x5d9dca);}(_0x99ab,0x135));var _0xb99a=function(_0x426c08,_0x24d6ab){_0x426c08=_0x426c08-0x0;var _0x151d08=_0x99ab[_0x426c08];return _0x151d08;};'use strict';var Sequelize=require(_0xb99a('0x0'));module[_0xb99a('0x1')]={'type':{'type':Sequelize[_0xb99a('0x2')](_0xb99a('0x3'),_0xb99a('0x4'),_0xb99a('0x5'),_0xb99a('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xb99a('0x7')]},'key':{'type':Sequelize[_0xb99a('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xb99a('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xb99a('0x7')]},'idField':{'type':Sequelize[_0xb99a('0x7')]},'nameField':{'type':Sequelize[_0xb99a('0x7')]},'customField':{'type':Sequelize[_0xb99a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfe03=['sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x14fedc,_0x36a213){var _0x538f1f=function(_0x139f5d){while(--_0x139f5d){_0x14fedc['push'](_0x14fedc['shift']());}};_0x538f1f(++_0x36a213);}(_0xfe03,0x122));var _0x3fe0=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0xfe03[_0x54b283];return _0x2462b3;};'use strict';var Sequelize=require(_0x3fe0('0x0'));module[_0x3fe0('0x1')]={'type':{'type':Sequelize['ENUM'](_0x3fe0('0x2'),_0x3fe0('0x3'),'customVariable',_0x3fe0('0x4'),_0x3fe0('0x5')),'defaultValue':_0x3fe0('0x2')},'content':{'type':Sequelize[_0x3fe0('0x6')]},'key':{'type':Sequelize[_0x3fe0('0x6')]},'keyType':{'type':Sequelize[_0x3fe0('0x7')](_0x3fe0('0x2'),_0x3fe0('0x3'),_0x3fe0('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3fe0('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3fe0('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3fe0('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 4d8a0cd..0d5235a 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 _0x76d8=['desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','limit','count','status','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','options','includeAll','include','ZendeskField','findAll','rows','show','params','length','catch','create','body','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x76d8,0x168));var _0x876d=function(_0x57c4ff,_0x102e4e){_0x57c4ff=_0x57c4ff-0x0;var _0x21649c=_0x76d8[_0x57c4ff];return _0x21649c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x876d('0x0'));var zipdir=require(_0x876d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x876d('0x2'));var moment=require(_0x876d('0x3'));var BPromise=require(_0x876d('0x4'));var Mustache=require(_0x876d('0x5'));var util=require(_0x876d('0x6'));var path=require(_0x876d('0x7'));var sox=require(_0x876d('0x8'));var csv=require(_0x876d('0x9'));var ejs=require(_0x876d('0xa'));var fs=require('fs');var fs_extra=require(_0x876d('0xb'));var _=require(_0x876d('0xc'));var squel=require('squel');var crypto=require(_0x876d('0xd'));var jsforce=require(_0x876d('0xe'));var deskjs=require(_0x876d('0xf'));var toCsv=require(_0x876d('0x9'));var querystring=require('querystring');var Papa=require(_0x876d('0x10'));var Redis=require(_0x876d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x876d('0x12'));var as=require(_0x876d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x876d('0x14'));var utils=require(_0x876d('0x15'));var config=require(_0x876d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x876d('0x17'))['db'];function respondWithStatusCode(_0x5229e9,_0x21f2f4){_0x21f2f4=_0x21f2f4||0xcc;return function(_0x46de9d){if(_0x46de9d){return _0x5229e9[_0x876d('0x18')](_0x21f2f4);}return _0x5229e9['status'](_0x21f2f4)[_0x876d('0x19')]();};}function respondWithResult(_0x143df8,_0x547a6b){_0x547a6b=_0x547a6b||0xc8;return function(_0x2887cb){if(_0x2887cb){return _0x143df8['status'](_0x547a6b)[_0x876d('0x1a')](_0x2887cb);}};}function respondWithFilteredResult(_0x2b1f5a,_0x3929e2){return function(_0x26be54){if(_0x26be54){var _0x9da73d=typeof _0x3929e2['offset']===_0x876d('0x1b')&&typeof _0x3929e2[_0x876d('0x1c')]===_0x876d('0x1b');var _0xe85478=_0x26be54[_0x876d('0x1d')];var _0x5c4fea=_0x9da73d?0x0:_0x3929e2['offset'];var _0x418ccf=_0x9da73d?_0x26be54['count']:_0x3929e2['offset']+_0x3929e2[_0x876d('0x1c')];var _0xb3a302;if(_0x418ccf>=_0xe85478){_0x418ccf=_0xe85478;_0xb3a302=0xc8;}else{_0xb3a302=0xce;}_0x2b1f5a[_0x876d('0x1e')](_0xb3a302);return _0x2b1f5a[_0x876d('0x1f')](_0x876d('0x20'),_0x5c4fea+'-'+_0x418ccf+'/'+_0xe85478)[_0x876d('0x1a')](_0x26be54);}return null;};}function patchUpdates(_0x3f37d0){return function(_0x22e3e7){try{jsonpatch['apply'](_0x22e3e7,_0x3f37d0,!![]);}catch(_0x14c5ea){return BPromise[_0x876d('0x21')](_0x14c5ea);}return _0x22e3e7[_0x876d('0x22')]();};}function saveUpdates(_0x506a0e,_0x358712){return function(_0x2de362){if(_0x2de362){return _0x2de362[_0x876d('0x23')](_0x506a0e)[_0x876d('0x24')](function(_0x37253d){return _0x37253d;});}return null;};}function removeEntity(_0x5200b6,_0x573f1a){return function(_0x1828fa){if(_0x1828fa){return _0x1828fa['destroy']()[_0x876d('0x24')](function(){_0x5200b6[_0x876d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x231043,_0x179e36){return function(_0xae777b){if(!_0xae777b){_0x231043[_0x876d('0x18')](0x194);}return _0xae777b;};}function handleError(_0x6706e6,_0xa0ae12){_0xa0ae12=_0xa0ae12||0x1f4;return function(_0x467a73){logger[_0x876d('0x25')](_0x467a73[_0x876d('0x26')]);if(_0x467a73['name']){delete _0x467a73[_0x876d('0x27')];}_0x6706e6[_0x876d('0x1e')](_0xa0ae12)[_0x876d('0x28')](_0x467a73);};}exports[_0x876d('0x29')]=function(_0x42f661,_0x1f8016){var _0x256075={},_0x1b6002={},_0x547956={'count':0x0,'rows':[]};var _0x455975=_[_0x876d('0x2a')](db['ZendeskField'][_0x876d('0x2b')],function(_0x44f94f){return{'name':_0x44f94f[_0x876d('0x2c')],'type':_0x44f94f[_0x876d('0x2d')][_0x876d('0x2e')]};});_0x1b6002['model']=_['map'](_0x455975,_0x876d('0x27'));_0x1b6002[_0x876d('0x2f')]=_[_0x876d('0x30')](_0x42f661[_0x876d('0x2f')]);_0x1b6002[_0x876d('0x31')]=_[_0x876d('0x32')](_0x1b6002[_0x876d('0x33')],_0x1b6002[_0x876d('0x2f')]);_0x256075[_0x876d('0x34')]=_['intersection'](_0x1b6002[_0x876d('0x33')],qs['fields'](_0x42f661[_0x876d('0x2f')]['fields']));_0x256075[_0x876d('0x34')]=_0x256075[_0x876d('0x34')]['length']?_0x256075['attributes']:_0x1b6002['model'];if(!_0x42f661[_0x876d('0x2f')][_0x876d('0x35')](_0x876d('0x36'))){_0x256075['limit']=qs[_0x876d('0x1c')](_0x42f661[_0x876d('0x2f')][_0x876d('0x1c')]);_0x256075['offset']=qs[_0x876d('0x37')](_0x42f661[_0x876d('0x2f')][_0x876d('0x37')]);}_0x256075[_0x876d('0x38')]=qs[_0x876d('0x39')](_0x42f661[_0x876d('0x2f')]['sort']);_0x256075[_0x876d('0x3a')]=qs[_0x876d('0x31')](_[_0x876d('0x3b')](_0x42f661[_0x876d('0x2f')],_0x1b6002[_0x876d('0x31')]),_0x455975);if(_0x42f661['query']['filter']){_0x256075['where']=_[_0x876d('0x3c')](_0x256075[_0x876d('0x3a')],{'$or':_['map'](_0x455975,function(_0x2150b1){if(_0x2150b1['type']!=='VIRTUAL'){var _0x28e90c={};_0x28e90c[_0x2150b1[_0x876d('0x27')]]={'$like':'%'+_0x42f661[_0x876d('0x2f')][_0x876d('0x3d')]+'%'};return _0x28e90c;}})});}_0x256075=_[_0x876d('0x3c')]({},_0x256075,_0x42f661[_0x876d('0x3e')]);var _0x40459d={'where':_0x256075[_0x876d('0x3a')]};return db['ZendeskField']['count'](_0x40459d)[_0x876d('0x24')](function(_0x3078a2){_0x547956[_0x876d('0x1d')]=_0x3078a2;if(_0x42f661['query'][_0x876d('0x3f')]){_0x256075[_0x876d('0x40')]=[{'all':!![]}];}return db[_0x876d('0x41')][_0x876d('0x42')](_0x256075);})[_0x876d('0x24')](function(_0x5a0940){_0x547956[_0x876d('0x43')]=_0x5a0940;return _0x547956;})[_0x876d('0x24')](respondWithFilteredResult(_0x1f8016,_0x256075))['catch'](handleError(_0x1f8016,null));};exports[_0x876d('0x44')]=function(_0xf6cd12,_0x2e11a5){var _0x74cc1={'raw':!![],'where':{'id':_0xf6cd12[_0x876d('0x45')]['id']}},_0x3c4a34={};_0x3c4a34['model']=_[_0x876d('0x30')](db[_0x876d('0x41')][_0x876d('0x2b')]);_0x3c4a34[_0x876d('0x2f')]=_['keys'](_0xf6cd12[_0x876d('0x2f')]);_0x3c4a34[_0x876d('0x31')]=_[_0x876d('0x32')](_0x3c4a34[_0x876d('0x33')],_0x3c4a34[_0x876d('0x2f')]);_0x74cc1[_0x876d('0x34')]=_[_0x876d('0x32')](_0x3c4a34[_0x876d('0x33')],qs['fields'](_0xf6cd12[_0x876d('0x2f')]['fields']));_0x74cc1[_0x876d('0x34')]=_0x74cc1['attributes'][_0x876d('0x46')]?_0x74cc1[_0x876d('0x34')]:_0x3c4a34[_0x876d('0x33')];if(_0xf6cd12[_0x876d('0x2f')][_0x876d('0x3f')]){_0x74cc1[_0x876d('0x40')]=[{'all':!![]}];}_0x74cc1=_[_0x876d('0x3c')]({},_0x74cc1,_0xf6cd12['options']);return db[_0x876d('0x41')]['find'](_0x74cc1)['then'](handleEntityNotFound(_0x2e11a5,null))[_0x876d('0x24')](respondWithResult(_0x2e11a5,null))[_0x876d('0x47')](handleError(_0x2e11a5,null));};exports[_0x876d('0x48')]=function(_0x2c06cc,_0x5b62c3){return db[_0x876d('0x41')]['create'](_0x2c06cc[_0x876d('0x49')],{})['then'](respondWithResult(_0x5b62c3,0xc9))[_0x876d('0x47')](handleError(_0x5b62c3,null));};exports[_0x876d('0x23')]=function(_0x3ee0e8,_0x3b05f3){if(_0x3ee0e8[_0x876d('0x49')]['id']){delete _0x3ee0e8[_0x876d('0x49')]['id'];}return db[_0x876d('0x41')][_0x876d('0x4a')]({'where':{'id':_0x3ee0e8[_0x876d('0x45')]['id']}})[_0x876d('0x24')](handleEntityNotFound(_0x3b05f3,null))[_0x876d('0x24')](saveUpdates(_0x3ee0e8[_0x876d('0x49')],null))[_0x876d('0x24')](respondWithResult(_0x3b05f3,null))[_0x876d('0x47')](handleError(_0x3b05f3,null));};exports['destroy']=function(_0x1d9fcd,_0x7f9a83){return db[_0x876d('0x41')]['find']({'where':{'id':_0x1d9fcd[_0x876d('0x45')]['id']}})[_0x876d('0x24')](handleEntityNotFound(_0x7f9a83,null))[_0x876d('0x24')](removeEntity(_0x7f9a83,null))['catch'](handleError(_0x7f9a83,null));}; \ No newline at end of file +var _0x9336=['fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','count','set','Content-Range','save','update','then','error','name','send','index','map','ZendeskField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','params','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x5de02c,_0x2bca83){var _0x5bee77=function(_0x447356){while(--_0x447356){_0x5de02c['push'](_0x5de02c['shift']());}};_0x5bee77(++_0x2bca83);}(_0x9336,0x1a5));var _0x6933=function(_0x45cd92,_0x202715){_0x45cd92=_0x45cd92-0x0;var _0x54b4d4=_0x9336[_0x45cd92];return _0x54b4d4;};'use strict';var emlformat=require(_0x6933('0x0'));var rimraf=require(_0x6933('0x1'));var zipdir=require(_0x6933('0x2'));var jsonpatch=require(_0x6933('0x3'));var rp=require('request-promise');var moment=require(_0x6933('0x4'));var BPromise=require(_0x6933('0x5'));var Mustache=require(_0x6933('0x6'));var util=require(_0x6933('0x7'));var path=require('path');var sox=require(_0x6933('0x8'));var csv=require(_0x6933('0x9'));var ejs=require(_0x6933('0xa'));var fs=require('fs');var fs_extra=require(_0x6933('0xb'));var _=require(_0x6933('0xc'));var squel=require(_0x6933('0xd'));var crypto=require(_0x6933('0xe'));var jsforce=require(_0x6933('0xf'));var deskjs=require(_0x6933('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6933('0x11'));var as=require(_0x6933('0x12'));var hardwareService=require(_0x6933('0x13'));var logger=require(_0x6933('0x14'))(_0x6933('0x15'));var utils=require(_0x6933('0x16'));var config=require(_0x6933('0x17'));var licenseUtil=require(_0x6933('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x137b4e,_0x1608b3){_0x1608b3=_0x1608b3||0xcc;return function(_0x584dbe){if(_0x584dbe){return _0x137b4e[_0x6933('0x19')](_0x1608b3);}return _0x137b4e['status'](_0x1608b3)[_0x6933('0x1a')]();};}function respondWithResult(_0x28ed99,_0x2819f0){_0x2819f0=_0x2819f0||0xc8;return function(_0x40cb80){if(_0x40cb80){return _0x28ed99[_0x6933('0x1b')](_0x2819f0)[_0x6933('0x1c')](_0x40cb80);}};}function respondWithFilteredResult(_0x2fcba2,_0x9cc7d){return function(_0x2ca2bc){if(_0x2ca2bc){var _0x5a98fc=typeof _0x9cc7d[_0x6933('0x1d')]==='undefined'&&typeof _0x9cc7d[_0x6933('0x1e')]==='undefined';var _0x5f751b=_0x2ca2bc[_0x6933('0x1f')];var _0x14bec0=_0x5a98fc?0x0:_0x9cc7d[_0x6933('0x1d')];var _0x520d18=_0x5a98fc?_0x2ca2bc['count']:_0x9cc7d[_0x6933('0x1d')]+_0x9cc7d[_0x6933('0x1e')];var _0x40dda7;if(_0x520d18>=_0x5f751b){_0x520d18=_0x5f751b;_0x40dda7=0xc8;}else{_0x40dda7=0xce;}_0x2fcba2['status'](_0x40dda7);return _0x2fcba2[_0x6933('0x20')](_0x6933('0x21'),_0x14bec0+'-'+_0x520d18+'/'+_0x5f751b)[_0x6933('0x1c')](_0x2ca2bc);}return null;};}function patchUpdates(_0xc62c42){return function(_0xbd8a1e){try{jsonpatch['apply'](_0xbd8a1e,_0xc62c42,!![]);}catch(_0x32b2fb){return BPromise['reject'](_0x32b2fb);}return _0xbd8a1e[_0x6933('0x22')]();};}function saveUpdates(_0x427cbc,_0x4ba6e6){return function(_0x34f76d){if(_0x34f76d){return _0x34f76d[_0x6933('0x23')](_0x427cbc)[_0x6933('0x24')](function(_0x809e03){return _0x809e03;});}return null;};}function removeEntity(_0x459b09,_0x242bfc){return function(_0x37905d){if(_0x37905d){return _0x37905d['destroy']()[_0x6933('0x24')](function(){_0x459b09[_0x6933('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x187e97,_0x253db2){return function(_0x437595){if(!_0x437595){_0x187e97[_0x6933('0x19')](0x194);}return _0x437595;};}function handleError(_0x573d80,_0x3c5635){_0x3c5635=_0x3c5635||0x1f4;return function(_0x5db5d3){logger[_0x6933('0x25')](_0x5db5d3['stack']);if(_0x5db5d3[_0x6933('0x26')]){delete _0x5db5d3[_0x6933('0x26')];}_0x573d80['status'](_0x3c5635)[_0x6933('0x27')](_0x5db5d3);};}exports[_0x6933('0x28')]=function(_0x182388,_0x34085a){var _0xdbddc2={},_0x27ab48={},_0x5d31db={'count':0x0,'rows':[]};var _0x525d21=_[_0x6933('0x29')](db[_0x6933('0x2a')][_0x6933('0x2b')],function(_0x1d6e1){return{'name':_0x1d6e1['fieldName'],'type':_0x1d6e1[_0x6933('0x2c')][_0x6933('0x2d')]};});_0x27ab48[_0x6933('0x2e')]=_[_0x6933('0x29')](_0x525d21,_0x6933('0x26'));_0x27ab48[_0x6933('0x2f')]=_[_0x6933('0x30')](_0x182388['query']);_0x27ab48[_0x6933('0x31')]=_[_0x6933('0x32')](_0x27ab48[_0x6933('0x2e')],_0x27ab48[_0x6933('0x2f')]);_0xdbddc2['attributes']=_[_0x6933('0x32')](_0x27ab48[_0x6933('0x2e')],qs[_0x6933('0x33')](_0x182388[_0x6933('0x2f')][_0x6933('0x33')]));_0xdbddc2[_0x6933('0x34')]=_0xdbddc2['attributes'][_0x6933('0x35')]?_0xdbddc2['attributes']:_0x27ab48[_0x6933('0x2e')];if(!_0x182388[_0x6933('0x2f')][_0x6933('0x36')](_0x6933('0x37'))){_0xdbddc2['limit']=qs[_0x6933('0x1e')](_0x182388[_0x6933('0x2f')][_0x6933('0x1e')]);_0xdbddc2[_0x6933('0x1d')]=qs[_0x6933('0x1d')](_0x182388[_0x6933('0x2f')][_0x6933('0x1d')]);}_0xdbddc2[_0x6933('0x38')]=qs[_0x6933('0x39')](_0x182388['query'][_0x6933('0x39')]);_0xdbddc2[_0x6933('0x3a')]=qs[_0x6933('0x31')](_[_0x6933('0x3b')](_0x182388[_0x6933('0x2f')],_0x27ab48['filters']),_0x525d21);if(_0x182388[_0x6933('0x2f')]['filter']){_0xdbddc2[_0x6933('0x3a')]=_[_0x6933('0x3c')](_0xdbddc2['where'],{'$or':_[_0x6933('0x29')](_0x525d21,function(_0x2cf859){if(_0x2cf859[_0x6933('0x2c')]!==_0x6933('0x3d')){var _0x5512ee={};_0x5512ee[_0x2cf859[_0x6933('0x26')]]={'$like':'%'+_0x182388['query']['filter']+'%'};return _0x5512ee;}})});}_0xdbddc2=_['merge']({},_0xdbddc2,_0x182388['options']);var _0x29f6dc={'where':_0xdbddc2[_0x6933('0x3a')]};return db[_0x6933('0x2a')][_0x6933('0x1f')](_0x29f6dc)[_0x6933('0x24')](function(_0x58b8b7){_0x5d31db[_0x6933('0x1f')]=_0x58b8b7;if(_0x182388[_0x6933('0x2f')][_0x6933('0x3e')]){_0xdbddc2[_0x6933('0x3f')]=[{'all':!![]}];}return db[_0x6933('0x2a')]['findAll'](_0xdbddc2);})[_0x6933('0x24')](function(_0x48f4de){_0x5d31db[_0x6933('0x40')]=_0x48f4de;return _0x5d31db;})['then'](respondWithFilteredResult(_0x34085a,_0xdbddc2))['catch'](handleError(_0x34085a,null));};exports['show']=function(_0x2d9555,_0x12b24e){var _0x1751d4={'raw':!![],'where':{'id':_0x2d9555[_0x6933('0x41')]['id']}},_0x1bcf8f={};_0x1bcf8f[_0x6933('0x2e')]=_[_0x6933('0x30')](db['ZendeskField'][_0x6933('0x2b')]);_0x1bcf8f[_0x6933('0x2f')]=_['keys'](_0x2d9555[_0x6933('0x2f')]);_0x1bcf8f[_0x6933('0x31')]=_[_0x6933('0x32')](_0x1bcf8f[_0x6933('0x2e')],_0x1bcf8f[_0x6933('0x2f')]);_0x1751d4[_0x6933('0x34')]=_['intersection'](_0x1bcf8f[_0x6933('0x2e')],qs[_0x6933('0x33')](_0x2d9555[_0x6933('0x2f')][_0x6933('0x33')]));_0x1751d4[_0x6933('0x34')]=_0x1751d4[_0x6933('0x34')][_0x6933('0x35')]?_0x1751d4[_0x6933('0x34')]:_0x1bcf8f[_0x6933('0x2e')];if(_0x2d9555['query'][_0x6933('0x3e')]){_0x1751d4[_0x6933('0x3f')]=[{'all':!![]}];}_0x1751d4=_['merge']({},_0x1751d4,_0x2d9555[_0x6933('0x42')]);return db[_0x6933('0x2a')][_0x6933('0x43')](_0x1751d4)['then'](handleEntityNotFound(_0x12b24e,null))[_0x6933('0x24')](respondWithResult(_0x12b24e,null))[_0x6933('0x44')](handleError(_0x12b24e,null));};exports[_0x6933('0x45')]=function(_0x1c64ea,_0x394ed3){return db[_0x6933('0x2a')]['create'](_0x1c64ea[_0x6933('0x46')],{})[_0x6933('0x24')](respondWithResult(_0x394ed3,0xc9))[_0x6933('0x44')](handleError(_0x394ed3,null));};exports[_0x6933('0x23')]=function(_0x92770,_0x55072d){if(_0x92770[_0x6933('0x46')]['id']){delete _0x92770[_0x6933('0x46')]['id'];}return db[_0x6933('0x2a')][_0x6933('0x43')]({'where':{'id':_0x92770[_0x6933('0x41')]['id']}})[_0x6933('0x24')](handleEntityNotFound(_0x55072d,null))[_0x6933('0x24')](saveUpdates(_0x92770[_0x6933('0x46')],null))[_0x6933('0x24')](respondWithResult(_0x55072d,null))['catch'](handleError(_0x55072d,null));};exports[_0x6933('0x47')]=function(_0x281959,_0x3588eb){return db[_0x6933('0x2a')]['find']({'where':{'id':_0x281959[_0x6933('0x41')]['id']}})[_0x6933('0x24')](handleEntityNotFound(_0x3588eb,null))[_0x6933('0x24')](removeEntity(_0x3588eb,null))[_0x6933('0x44')](handleError(_0x3588eb,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 3102131..e62347e 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 _0xae9d=['util','api','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','define','zendesk_unique_index','idField','lodash'];(function(_0x1b3353,_0x50bb4b){var _0xd32749=function(_0x5e41a5){while(--_0x5e41a5){_0x1b3353['push'](_0x1b3353['shift']());}};_0xd32749(++_0x50bb4b);}(_0xae9d,0x1ac));var _0xdae9=function(_0x58379a,_0x1840de){_0x58379a=_0x58379a-0x0;var _0xf88d78=_0xae9d[_0x58379a];return _0xf88d78;};'use strict';var _=require(_0xdae9('0x0'));var util=require(_0xdae9('0x1'));var logger=require('../../config/logger')(_0xdae9('0x2'));var moment=require('moment');var BPromise=require(_0xdae9('0x3'));var rp=require(_0xdae9('0x4'));var fs=require('fs');var path=require(_0xdae9('0x5'));var rimraf=require(_0xdae9('0x6'));var config=require('../../config/environment');var attributes=require(_0xdae9('0x7'));module['exports']=function(_0x39d4f9,_0x1e526c){return _0x39d4f9[_0xdae9('0x8')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xdae9('0x9'),'fields':[_0xdae9('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3966=['define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x29c11c,_0x4a7ee4){var _0x20087e=function(_0x1f372b){while(--_0x1f372b){_0x29c11c['push'](_0x29c11c['shift']());}};_0x20087e(++_0x4a7ee4);}(_0x3966,0x150));var _0x6396=function(_0xc19f4e,_0x458dfb){_0xc19f4e=_0xc19f4e-0x0;var _0x23c2b9=_0x3966[_0xc19f4e];return _0x23c2b9;};'use strict';var _=require(_0x6396('0x0'));var util=require(_0x6396('0x1'));var logger=require(_0x6396('0x2'))(_0x6396('0x3'));var moment=require('moment');var BPromise=require(_0x6396('0x4'));var rp=require(_0x6396('0x5'));var fs=require('fs');var path=require(_0x6396('0x6'));var rimraf=require('rimraf');var config=require(_0x6396('0x7'));var attributes=require('./intZendeskField.attributes');module[_0x6396('0x8')]=function(_0x57d567,_0x9ff2c2){return _0x57d567[_0x6396('0x9')](_0x6396('0xa'),attributes,{'tableName':_0x6396('0xb'),'paranoid':![],'indexes':[{'name':_0x6396('0xc'),'fields':[_0x6396('0xd'),_0x6396('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 5ea1e24..054fa71 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 _0xbf96=['../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x2e4b12,_0x1d2450){var _0x261964=function(_0x572f82){while(--_0x572f82){_0x2e4b12['push'](_0x2e4b12['shift']());}};_0x261964(++_0x1d2450);}(_0xbf96,0x72));var _0x6bf9=function(_0x13bb37,_0x4754ed){_0x13bb37=_0x13bb37-0x0;var _0x2fc853=_0xbf96[_0x13bb37];return _0x2fc853;};'use strict';var _=require(_0x6bf9('0x0'));var util=require(_0x6bf9('0x1'));var moment=require(_0x6bf9('0x2'));var BPromise=require(_0x6bf9('0x3'));var rs=require(_0x6bf9('0x4'));var fs=require('fs');var Redis=require(_0x6bf9('0x5'));var db=require(_0x6bf9('0x6'))['db'];var utils=require(_0x6bf9('0x7'));var logger=require('../../config/logger')(_0x6bf9('0x8'));var config=require(_0x6bf9('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6bf9('0xa')][_0x6bf9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x186bec,_0x399ea1,_0x4a771b){return new BPromise(function(_0xed8cf8,_0x5bfa45){return client[_0x6bf9('0xc')](_0x186bec,_0x4a771b)[_0x6bf9('0xd')](function(_0x47a9b0){logger[_0x6bf9('0xe')](_0x6bf9('0xf'),_0x399ea1,_0x6bf9('0x10'));logger[_0x6bf9('0x11')](_0x6bf9('0x12'),_0x399ea1,_0x6bf9('0x10'),JSON['stringify'](_0x47a9b0));if(_0x47a9b0[_0x6bf9('0x13')]){if(_0x47a9b0[_0x6bf9('0x13')][_0x6bf9('0x14')]===0x1f4){logger['error'](_0x6bf9('0xf'),_0x399ea1,_0x47a9b0['error'][_0x6bf9('0x15')]);return _0x5bfa45(_0x47a9b0[_0x6bf9('0x13')]['message']);}logger[_0x6bf9('0x13')](_0x6bf9('0xf'),_0x399ea1,_0x47a9b0[_0x6bf9('0x13')][_0x6bf9('0x15')]);return _0xed8cf8(_0x47a9b0[_0x6bf9('0x13')]['message']);}else{logger[_0x6bf9('0xe')](_0x6bf9('0xf'),_0x399ea1,'request\x20sent');_0xed8cf8(_0x47a9b0[_0x6bf9('0x16')]['message']);}})[_0x6bf9('0x17')](function(_0x529de1){logger[_0x6bf9('0x13')](_0x6bf9('0xf'),_0x399ea1,_0x529de1);_0x5bfa45(_0x529de1);});});} \ No newline at end of file +var _0x6ed8=['info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x35a1cb,_0x5985c3){var _0x2cd095=function(_0x196ced){while(--_0x196ced){_0x35a1cb['push'](_0x35a1cb['shift']());}};_0x2cd095(++_0x5985c3);}(_0x6ed8,0x170));var _0x86ed=function(_0x54229d,_0x3937cd){_0x54229d=_0x54229d-0x0;var _0x9b165e=_0x6ed8[_0x54229d];return _0x9b165e;};'use strict';var _=require(_0x86ed('0x0'));var util=require(_0x86ed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x86ed('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86ed('0x3'))['db'];var utils=require(_0x86ed('0x4'));var logger=require('../../config/logger')(_0x86ed('0x5'));var config=require(_0x86ed('0x6'));var jayson=require(_0x86ed('0x7'));var client=jayson[_0x86ed('0x8')][_0x86ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x381e10,_0x17bdbb,_0x1afa03){return new BPromise(function(_0x4680cd,_0x557912){return client[_0x86ed('0xa')](_0x381e10,_0x1afa03)[_0x86ed('0xb')](function(_0x26e2b8){logger[_0x86ed('0xc')](_0x86ed('0xd'),_0x17bdbb,_0x86ed('0xe'));logger[_0x86ed('0xf')](_0x86ed('0x10'),_0x17bdbb,'request\x20sent',JSON['stringify'](_0x26e2b8));if(_0x26e2b8[_0x86ed('0x11')]){if(_0x26e2b8[_0x86ed('0x11')]['code']===0x1f4){logger[_0x86ed('0x11')]('ZendeskField,\x20%s,\x20%s',_0x17bdbb,_0x26e2b8[_0x86ed('0x11')]['message']);return _0x557912(_0x26e2b8['error'][_0x86ed('0x12')]);}logger[_0x86ed('0x11')]('ZendeskField,\x20%s,\x20%s',_0x17bdbb,_0x26e2b8[_0x86ed('0x11')][_0x86ed('0x12')]);return _0x4680cd(_0x26e2b8[_0x86ed('0x11')][_0x86ed('0x12')]);}else{logger[_0x86ed('0xc')](_0x86ed('0xd'),_0x17bdbb,_0x86ed('0xe'));_0x4680cd(_0x26e2b8[_0x86ed('0x13')][_0x86ed('0x12')]);}})['catch'](function(_0x237af9){logger[_0x86ed('0x11')]('ZendeskField,\x20%s,\x20%s',_0x17bdbb,_0x237af9);_0x557912(_0x237af9);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index d99f6bf..2391e8f 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 _0xc9ac=['destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete'];(function(_0x267da8,_0x4895a9){var _0x29cfd0=function(_0x5dfafd){while(--_0x5dfafd){_0x267da8['push'](_0x267da8['shift']());}};_0x29cfd0(++_0x4895a9);}(_0xc9ac,0xaa));var _0xcc9a=function(_0x562593,_0x53e7e9){_0x562593=_0x562593-0x0;var _0x2a4117=_0xc9ac[_0x562593];return _0x2a4117;};'use strict';var multer=require(_0xcc9a('0x0'));var util=require(_0xcc9a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc9a('0x2'));var router=express[_0xcc9a('0x3')]();var fs_extra=require(_0xcc9a('0x4'));var auth=require(_0xcc9a('0x5'));var interaction=require(_0xcc9a('0x6'));var config=require('../../config/environment');var controller=require(_0xcc9a('0x7'));router['get']('/',auth[_0xcc9a('0x8')](),controller[_0xcc9a('0x9')]);router[_0xcc9a('0xa')](_0xcc9a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xcc9a('0xa')](_0xcc9a('0xc'),auth[_0xcc9a('0x8')](),controller[_0xcc9a('0xd')]);router[_0xcc9a('0xa')](_0xcc9a('0xe'),auth[_0xcc9a('0x8')](),controller[_0xcc9a('0xf')]);router[_0xcc9a('0x10')]('/',auth['isAuthenticated'](),controller[_0xcc9a('0x11')]);router[_0xcc9a('0x10')](_0xcc9a('0xc'),auth[_0xcc9a('0x8')](),controller[_0xcc9a('0x12')]);router[_0xcc9a('0x13')]('/:id',auth[_0xcc9a('0x8')](),controller[_0xcc9a('0x14')]);router[_0xcc9a('0x15')]('/:id',auth[_0xcc9a('0x8')](),controller[_0xcc9a('0x16')]);module[_0xcc9a('0x17')]=router; \ No newline at end of file +var _0x04d6=['getFields','post','create','addConfiguration','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x366270,_0x303631){var _0xe9680e=function(_0x576d45){while(--_0x576d45){_0x366270['push'](_0x366270['shift']());}};_0xe9680e(++_0x303631);}(_0x04d6,0x1ea));var _0x604d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x04d6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x604d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x604d('0x1'));var router=express[_0x604d('0x2')]();var fs_extra=require(_0x604d('0x3'));var auth=require(_0x604d('0x4'));var interaction=require(_0x604d('0x5'));var config=require(_0x604d('0x6'));var controller=require('./intZohoAccount.controller');router[_0x604d('0x7')]('/',auth[_0x604d('0x8')](),controller['index']);router[_0x604d('0x7')](_0x604d('0x9'),auth[_0x604d('0x8')](),controller[_0x604d('0xa')]);router[_0x604d('0x7')](_0x604d('0xb'),auth[_0x604d('0x8')](),controller[_0x604d('0xc')]);router[_0x604d('0x7')](_0x604d('0xd'),auth['isAuthenticated'](),controller[_0x604d('0xe')]);router[_0x604d('0xf')]('/',auth[_0x604d('0x8')](),controller[_0x604d('0x10')]);router[_0x604d('0xf')](_0x604d('0xb'),auth['isAuthenticated'](),controller[_0x604d('0x11')]);router['put']('/:id',auth[_0x604d('0x8')](),controller['update']);router[_0x604d('0x12')](_0x604d('0x9'),auth[_0x604d('0x8')](),controller[_0x604d('0x13')]);module[_0x604d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index a716446..7280aa6 100644 --- a/server/api/intZohoAccount/intZohoAccount.attributes.js +++ b/server/api/intZohoAccount/intZohoAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['STRING','sequelize','exports'];(function(_0x1bfe44,_0x4e410e){var _0x1103cb=function(_0x1e850e){while(--_0x1e850e){_0x1bfe44['push'](_0x1bfe44['shift']());}};_0x1103cb(++_0x4e410e);}(_0x54ef,0x112));var _0xf54e=function(_0x40fc0b,_0x14d5da){_0x40fc0b=_0x40fc0b-0x0;var _0x53e021=_0x54ef[_0x40fc0b];return _0x53e021;};'use strict';var Sequelize=require(_0xf54e('0x0'));module[_0xf54e('0x1')]={'name':{'type':Sequelize[_0xf54e('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf54e('0x2')]},'zone':{'type':Sequelize[_0xf54e('0x2')]},'clientId':{'type':Sequelize[_0xf54e('0x2')]},'clientSecret':{'type':Sequelize[_0xf54e('0x2')]},'serverUrl':{'type':Sequelize[_0xf54e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xf54e('0x2')]},'refreshToken':{'type':Sequelize[_0xf54e('0x2')]}}; \ No newline at end of file +var _0x153f=['exports','STRING','sequelize'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x153f,0x15b));var _0xf153=function(_0x55d5dd,_0xb59933){_0x55d5dd=_0x55d5dd-0x0;var _0x1f7f8d=_0x153f[_0x55d5dd];return _0x1f7f8d;};'use strict';var Sequelize=require(_0xf153('0x0'));module[_0xf153('0x1')]={'name':{'type':Sequelize[_0xf153('0x2')]},'description':{'type':Sequelize[_0xf153('0x2')]},'host':{'type':Sequelize[_0xf153('0x2')]},'zone':{'type':Sequelize[_0xf153('0x2')]},'clientId':{'type':Sequelize[_0xf153('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf153('0x2')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xf153('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 4a81851..683fad3 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 _0x8af1=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','name','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','ZohoAccount','include','findAll','rows','catch','show','length','includeAll','find','create','body','params','getConfigurations','ZohoConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','error','Owner','WhoId','Call_Duration','Call_Result','remove','api_name','system_mandatory','push','custom_field','data_type','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis'];(function(_0x25f805,_0x59caf3){var _0xf6628f=function(_0x3cb938){while(--_0x3cb938){_0x25f805['push'](_0x25f805['shift']());}};_0xf6628f(++_0x59caf3);}(_0x8af1,0xe4));var _0x18af=function(_0x3d78d7,_0x44acea){_0x3d78d7=_0x3d78d7-0x0;var _0x4b6784=_0x8af1[_0x3d78d7];return _0x4b6784;};'use strict';var emlformat=require(_0x18af('0x0'));var rimraf=require(_0x18af('0x1'));var zipdir=require(_0x18af('0x2'));var jsonpatch=require(_0x18af('0x3'));var rp=require('request-promise');var moment=require(_0x18af('0x4'));var BPromise=require(_0x18af('0x5'));var Mustache=require(_0x18af('0x6'));var util=require(_0x18af('0x7'));var path=require(_0x18af('0x8'));var sox=require(_0x18af('0x9'));var csv=require('to-csv');var ejs=require(_0x18af('0xa'));var fs=require('fs');var fs_extra=require(_0x18af('0xb'));var _=require(_0x18af('0xc'));var squel=require(_0x18af('0xd'));var crypto=require('crypto');var jsforce=require(_0x18af('0xe'));var deskjs=require(_0x18af('0xf'));var toCsv=require('to-csv');var querystring=require(_0x18af('0x10'));var Papa=require('papaparse');var Redis=require(_0x18af('0x11'));var authService=require(_0x18af('0x12'));var qs=require(_0x18af('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x18af('0x14'));var logger=require(_0x18af('0x15'))(_0x18af('0x16'));var utils=require(_0x18af('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x18af('0x18'));var db=require(_0x18af('0x19'))['db'];var integrations=require(_0x18af('0x1a'));function respondWithStatusCode(_0x15e996,_0x24d8e8){_0x24d8e8=_0x24d8e8||0xcc;return function(_0x1cf8eb){if(_0x1cf8eb){return _0x15e996[_0x18af('0x1b')](_0x24d8e8);}return _0x15e996[_0x18af('0x1c')](_0x24d8e8)['end']();};}function respondWithResult(_0x256966,_0x4f7728){_0x4f7728=_0x4f7728||0xc8;return function(_0x833839){if(_0x833839){return _0x256966['status'](_0x4f7728)[_0x18af('0x1d')](_0x833839);}};}function respondWithFilteredResult(_0x9fce7d,_0x4b7184){return function(_0x18653c){if(_0x18653c){var _0xe5b025=typeof _0x4b7184[_0x18af('0x1e')]==='undefined'&&typeof _0x4b7184[_0x18af('0x1f')]===_0x18af('0x20');var _0x432be3=_0x18653c[_0x18af('0x21')];var _0x27948f=_0xe5b025?0x0:_0x4b7184['offset'];var _0x16b7b7=_0xe5b025?_0x18653c['count']:_0x4b7184[_0x18af('0x1e')]+_0x4b7184[_0x18af('0x1f')];var _0x1ef824;if(_0x16b7b7>=_0x432be3){_0x16b7b7=_0x432be3;_0x1ef824=0xc8;}else{_0x1ef824=0xce;}_0x9fce7d[_0x18af('0x1c')](_0x1ef824);return _0x9fce7d[_0x18af('0x22')]('Content-Range',_0x27948f+'-'+_0x16b7b7+'/'+_0x432be3)[_0x18af('0x1d')](_0x18653c);}return null;};}function patchUpdates(_0x11a09f){return function(_0x5a0dd4){try{jsonpatch[_0x18af('0x23')](_0x5a0dd4,_0x11a09f,!![]);}catch(_0x3f323d){return BPromise[_0x18af('0x24')](_0x3f323d);}return _0x5a0dd4['save']();};}function saveUpdates(_0x355546,_0x12ae38){return function(_0x2bfa98){if(_0x2bfa98){return _0x2bfa98[_0x18af('0x25')](_0x355546)[_0x18af('0x26')](function(_0x2b46f0){return _0x2b46f0;});}return null;};}function removeEntity(_0x4946eb,_0xee2ba7){return function(_0x224a9c){if(_0x224a9c){return _0x224a9c[_0x18af('0x27')]()['then'](function(){_0x4946eb[_0x18af('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c9f77,_0x4c1092){return function(_0x4ac6c3){if(!_0x4ac6c3){_0x1c9f77[_0x18af('0x1b')](0x194);}return _0x4ac6c3;};}function handleError(_0x204383,_0x164954){_0x164954=_0x164954||0x1f4;return function(_0x4bae34){logger['error'](_0x4bae34['stack']);if(_0x4bae34[_0x18af('0x28')]){delete _0x4bae34[_0x18af('0x28')];}_0x204383[_0x18af('0x1c')](_0x164954)['send'](_0x4bae34);};}exports['index']=function(_0x498efd,_0x581d0f){var _0x41c5eb={},_0x4fe0d8={},_0x230746={'count':0x0,'rows':[]};var _0x575152=_[_0x18af('0x29')](db['ZohoAccount'][_0x18af('0x2a')],function(_0xdf8c0f){return{'name':_0xdf8c0f[_0x18af('0x2b')],'type':_0xdf8c0f[_0x18af('0x2c')]['key']};});_0x4fe0d8[_0x18af('0x2d')]=_[_0x18af('0x29')](_0x575152,_0x18af('0x28'));_0x4fe0d8[_0x18af('0x2e')]=_[_0x18af('0x2f')](_0x498efd[_0x18af('0x2e')]);_0x4fe0d8[_0x18af('0x30')]=_['intersection'](_0x4fe0d8[_0x18af('0x2d')],_0x4fe0d8[_0x18af('0x2e')]);_0x41c5eb[_0x18af('0x31')]=_[_0x18af('0x32')](_0x4fe0d8['model'],qs[_0x18af('0x33')](_0x498efd[_0x18af('0x2e')][_0x18af('0x33')]));_0x41c5eb[_0x18af('0x31')]=_0x41c5eb[_0x18af('0x31')]['length']?_0x41c5eb[_0x18af('0x31')]:_0x4fe0d8[_0x18af('0x2d')];if(!_0x498efd[_0x18af('0x2e')][_0x18af('0x34')](_0x18af('0x35'))){_0x41c5eb[_0x18af('0x1f')]=qs[_0x18af('0x1f')](_0x498efd[_0x18af('0x2e')][_0x18af('0x1f')]);_0x41c5eb[_0x18af('0x1e')]=qs[_0x18af('0x1e')](_0x498efd['query'][_0x18af('0x1e')]);}_0x41c5eb[_0x18af('0x36')]=qs['sort'](_0x498efd['query'][_0x18af('0x37')]);_0x41c5eb[_0x18af('0x38')]=qs[_0x18af('0x30')](_[_0x18af('0x39')](_0x498efd[_0x18af('0x2e')],_0x4fe0d8[_0x18af('0x30')]),_0x575152);if(_0x498efd[_0x18af('0x2e')][_0x18af('0x3a')]){_0x41c5eb[_0x18af('0x38')]=_['merge'](_0x41c5eb[_0x18af('0x38')],{'$or':_[_0x18af('0x29')](_0x575152,function(_0x342ed5){if(_0x342ed5[_0x18af('0x2c')]!==_0x18af('0x3b')){var _0x50d168={};_0x50d168[_0x342ed5[_0x18af('0x28')]]={'$like':'%'+_0x498efd[_0x18af('0x2e')][_0x18af('0x3a')]+'%'};return _0x50d168;}})});}_0x41c5eb=_[_0x18af('0x3c')]({},_0x41c5eb,_0x498efd[_0x18af('0x3d')]);var _0x4292cf={'where':_0x41c5eb['where']};return db[_0x18af('0x3e')][_0x18af('0x21')](_0x4292cf)[_0x18af('0x26')](function(_0x2c7b96){_0x230746['count']=_0x2c7b96;if(_0x498efd[_0x18af('0x2e')]['includeAll']){_0x41c5eb[_0x18af('0x3f')]=[{'all':!![]}];}return db[_0x18af('0x3e')][_0x18af('0x40')](_0x41c5eb);})['then'](function(_0x2a634c){_0x230746[_0x18af('0x41')]=_0x2a634c;return _0x230746;})[_0x18af('0x26')](respondWithFilteredResult(_0x581d0f,_0x41c5eb))[_0x18af('0x42')](handleError(_0x581d0f,null));};exports[_0x18af('0x43')]=function(_0xdcaec2,_0x4b177a){var _0x138dbb={'raw':![],'where':{'id':_0xdcaec2['params']['id']}},_0x5552ad={};_0x5552ad[_0x18af('0x2d')]=_[_0x18af('0x2f')](db['ZohoAccount'][_0x18af('0x2a')]);_0x5552ad['query']=_[_0x18af('0x2f')](_0xdcaec2['query']);_0x5552ad[_0x18af('0x30')]=_['intersection'](_0x5552ad['model'],_0x5552ad[_0x18af('0x2e')]);_0x138dbb['attributes']=_[_0x18af('0x32')](_0x5552ad[_0x18af('0x2d')],qs['fields'](_0xdcaec2[_0x18af('0x2e')]['fields']));_0x138dbb[_0x18af('0x31')]=_0x138dbb[_0x18af('0x31')][_0x18af('0x44')]?_0x138dbb['attributes']:_0x5552ad[_0x18af('0x2d')];if(_0xdcaec2[_0x18af('0x2e')][_0x18af('0x45')]){_0x138dbb[_0x18af('0x3f')]=[{'all':!![]}];}_0x138dbb=_[_0x18af('0x3c')]({},_0x138dbb,_0xdcaec2['options']);return db[_0x18af('0x3e')][_0x18af('0x46')](_0x138dbb)[_0x18af('0x26')](handleEntityNotFound(_0x4b177a,null))['then'](respondWithResult(_0x4b177a,null))['catch'](handleError(_0x4b177a,null));};exports[_0x18af('0x47')]=function(_0x18e2b1,_0x407636){return db[_0x18af('0x3e')]['create'](_0x18e2b1['body'],{})[_0x18af('0x26')](respondWithResult(_0x407636,0xc9))[_0x18af('0x42')](handleError(_0x407636,null));};exports['update']=function(_0x113a91,_0x6a083c){if(_0x113a91[_0x18af('0x48')]['id']){delete _0x113a91[_0x18af('0x48')]['id'];}return db[_0x18af('0x3e')][_0x18af('0x46')]({'where':{'id':_0x113a91[_0x18af('0x49')]['id']}})['then'](handleEntityNotFound(_0x6a083c,null))[_0x18af('0x26')](saveUpdates(_0x113a91[_0x18af('0x48')],null))[_0x18af('0x26')](respondWithResult(_0x6a083c,null))[_0x18af('0x42')](handleError(_0x6a083c,null));};exports['destroy']=function(_0x1aeb55,_0xb183c8){return db[_0x18af('0x3e')]['find']({'where':{'id':_0x1aeb55['params']['id']}})['then'](handleEntityNotFound(_0xb183c8,null))['then'](removeEntity(_0xb183c8,null))[_0x18af('0x42')](handleError(_0xb183c8,null));};exports[_0x18af('0x4a')]=function(_0x54b91e,_0x2b99cd,_0x326de6){var _0x1fabd3={};var _0x205d2b={};var _0x460345;var _0x20112d;return db[_0x18af('0x3e')]['findOne']({'where':{'id':_0x54b91e['params']['id']}})['then'](handleEntityNotFound(_0x2b99cd,null))[_0x18af('0x26')](function(_0x3f543a){if(_0x3f543a){_0x460345=_0x3f543a;_0x205d2b[_0x18af('0x2d')]=_[_0x18af('0x2f')](db[_0x18af('0x4b')]['rawAttributes']);_0x205d2b['query']=_['keys'](_0x54b91e[_0x18af('0x2e')]);_0x205d2b['filters']=_['intersection'](_0x205d2b[_0x18af('0x2d')],_0x205d2b[_0x18af('0x2e')]);_0x1fabd3[_0x18af('0x31')]=_[_0x18af('0x32')](_0x205d2b[_0x18af('0x2d')],qs[_0x18af('0x33')](_0x54b91e[_0x18af('0x2e')]['fields']));_0x1fabd3[_0x18af('0x31')]=_0x1fabd3[_0x18af('0x31')][_0x18af('0x44')]?_0x1fabd3['attributes']:_0x205d2b[_0x18af('0x2d')];_0x1fabd3[_0x18af('0x36')]=qs[_0x18af('0x37')](_0x54b91e['query'][_0x18af('0x37')]);_0x1fabd3[_0x18af('0x38')]=qs[_0x18af('0x30')](_[_0x18af('0x39')](_0x54b91e[_0x18af('0x2e')],_0x205d2b['filters']));if(_0x54b91e[_0x18af('0x2e')]['filter']){_0x1fabd3[_0x18af('0x38')]=_['merge'](_0x1fabd3[_0x18af('0x38')],{'$or':_['map'](_0x1fabd3[_0x18af('0x31')],function(_0x16386c){var _0x291b57={};_0x291b57[_0x16386c]={'$like':'%'+_0x54b91e[_0x18af('0x2e')][_0x18af('0x3a')]+'%'};return _0x291b57;})});}_0x1fabd3=_[_0x18af('0x3c')]({},_0x1fabd3,_0x54b91e[_0x18af('0x3d')]);return _0x460345[_0x18af('0x4a')](_0x1fabd3);}})[_0x18af('0x26')](function(_0x4a7d57){if(_0x4a7d57){_0x20112d=_0x4a7d57[_0x18af('0x44')];if(!_0x54b91e['query'][_0x18af('0x34')](_0x18af('0x35'))){_0x1fabd3['limit']=qs[_0x18af('0x1f')](_0x54b91e[_0x18af('0x2e')][_0x18af('0x1f')]);_0x1fabd3['offset']=qs[_0x18af('0x1e')](_0x54b91e[_0x18af('0x2e')][_0x18af('0x1e')]);}return _0x460345[_0x18af('0x4a')](_0x1fabd3);}})['then'](function(_0x243efe){if(_0x243efe){return _0x243efe?{'count':_0x20112d,'rows':_0x243efe}:null;}})[_0x18af('0x26')](respondWithResult(_0x2b99cd,null))['catch'](handleError(_0x2b99cd,null));};exports[_0x18af('0x4c')]=function(_0x406baa,_0x578342,_0x33bf04){if(_0x406baa[_0x18af('0x48')]['id']){delete _0x406baa[_0x18af('0x48')]['id'];}return db[_0x18af('0x3e')]['findOne']({'where':{'id':_0x406baa[_0x18af('0x49')]['id']}})[_0x18af('0x26')](handleEntityNotFound(_0x578342,null))['then'](function(_0x35051e){if(_0x35051e){_0x406baa[_0x18af('0x48')][_0x18af('0x4d')]=_0x35051e['id'];_0x406baa['body'][_0x18af('0x4e')]=integrations['getSubjects'](_0x406baa[_0x18af('0x48')][_0x18af('0x4f')],_0x406baa[_0x18af('0x48')][_0x18af('0x2c')]);_0x406baa['body'][_0x18af('0x50')]=integrations['getDescriptions'](_0x406baa[_0x18af('0x48')][_0x18af('0x4f')],_0x406baa[_0x18af('0x48')]['type']);return db[_0x18af('0x4b')][_0x18af('0x47')](_0x406baa[_0x18af('0x48')],{'include':[{'model':db['ZohoField'],'as':_0x18af('0x4e')},{'model':db['ZohoField'],'as':_0x18af('0x50')}]});}return null;})[_0x18af('0x26')](respondWithResult(_0x578342,null))[_0x18af('0x42')](handleError(_0x578342,null));};function getAccessToken(_0x21283b){return new Promise(function(_0x18dda1,_0x286522){var _0x16198b;switch(_0x21283b[_0x18af('0x51')]){case'US':_0x16198b=_0x18af('0x52');break;case'AU':_0x16198b=_0x18af('0x53');break;case'EU':_0x16198b=_0x18af('0x54');break;case'IN':_0x16198b=_0x18af('0x55');break;case'CN':_0x16198b=_0x18af('0x56');break;default:_0x16198b=_0x18af('0x54');break;}var _0x34718a={'method':_0x18af('0x57'),'uri':_0x16198b+_0x18af('0x58'),'qs':{'refresh_token':_0x21283b[_0x18af('0x59')],'client_id':_0x21283b[_0x18af('0x5a')],'client_secret':_0x21283b[_0x18af('0x5b')],'grant_type':_0x18af('0x5c')},'json':!![]};return rp(_0x34718a)[_0x18af('0x26')](function(_0x5ad787){if(_0x5ad787[_0x18af('0x5d')]){_0x18dda1(_0x5ad787[_0x18af('0x5d')]);}else{_0x286522(_0x18af('0x5e'));}})['catch'](function(_0x441e5a){_0x286522(_0x441e5a);});});}exports['getFields']=function(_0x1b65aa,_0x5d67c6,_0x21437e){var _0x5f4062,_0xe3306,_0x196d5a,_0x3fe9d2,_0x3d2da4;return db['ZohoAccount']['findOne']({'where':{'id':_0x1b65aa[_0x18af('0x49')]['id']},'attributes':['id',_0x18af('0x5f'),'zone','clientId',_0x18af('0x5b'),_0x18af('0x60'),_0x18af('0x61'),_0x18af('0x59')]})[_0x18af('0x26')](handleEntityNotFound(_0x5d67c6,null))[_0x18af('0x26')](function(_0x4c8c4a){_0x3d2da4=_0x4c8c4a;_0x5f4062=_0x3d2da4['host'];_0xe3306=_0x5f4062===_0x18af('0x62')?'eu':'com';_0x196d5a=_0x3d2da4[_0x18af('0x60')];var _0x45b249=_0x196d5a['slice'](-0x1);if(_0x45b249==='/'||_0x45b249==='\x5c'||_0x45b249===':'){_0x196d5a=_0x196d5a[_0x18af('0x63')](0x0,_0x196d5a[_0x18af('0x64')](_0x45b249));}if(!_0x3d2da4[_0x18af('0x59')]){throw new Error(_0x18af('0x65'));}return getAccessToken(_0x3d2da4);})[_0x18af('0x26')](function(_0x3bd73d){if(_0x3bd73d){return rp({'method':_0x18af('0x66'),'uri':util[_0x18af('0x67')](_0x18af('0x68'),_0xe3306),'qs':{'module':'Calls'},'headers':{'Authorization':_0x18af('0x69')+_0x3bd73d},'json':!![]});}})[_0x18af('0x26')](function(_0x89bc87){if(_0x89bc87){if(_0x89bc87[_0x18af('0x6a')]&&_0x89bc87[_0x18af('0x6a')][_0x18af('0x6b')]){throw new Error(_0x89bc87['response']['error']['message']);}var _0x4886b8=[];var _0x3bd1de=[];var _0x3b876c=[_0x18af('0x6c'),'Subject','Description',_0x18af('0x6d'),_0x18af('0x6e'),_0x18af('0x6f'),'Call_Start_Time','Call_Type'];_0x3bd1de=_[_0x18af('0x70')](_0x89bc87[_0x18af('0x33')],function(_0x282487){return _0x3b876c['includes'](_0x282487[_0x18af('0x71')]);});for(var _0x983c67=0x0;_0x983c67<_0x3bd1de['length'];_0x983c67++){if(_0x3bd1de[_0x983c67][_0x18af('0x72')]===![]){_0x4886b8[_0x18af('0x73')]({'id':_0x3bd1de[_0x983c67]['id'],'name':_0x3bd1de[_0x983c67]['display_label'],'custom':_0x3bd1de[_0x983c67][_0x18af('0x74')],'options':_0x3bd1de[_0x983c67][_0x18af('0x75')]==='picklist'&&_0x3bd1de[_0x983c67][_0x18af('0x76')]['length']>-0x1?_['map'](_0x3bd1de[_0x983c67]['pick_list_values'],function(_0x54564c){return{'name':_0x54564c,'value':_0x54564c};}):[]});}}return{'count':_0x4886b8['length'],'rows':_0x4886b8};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5d67c6,null))[_0x18af('0x42')](function(_0x2beadd){var _0x220087=_0x1b65aa[_0x18af('0x2e')][_0x18af('0x77')]?0x1f4:_0x2beadd['statusCode']||0x1f4;logger['error'](_0x18af('0x78'),'getFields',_0x220087,JSON['stringify'](_0x2beadd));delete _0x2beadd['name'];if(_0x220087===0x191){_0x220087=0x190;}_0x5d67c6['status'](_0x220087)['send'](_0x1b65aa['query']['test']?{'message':_0x18af('0x79'),'statusCode':_0x2beadd[_0x18af('0x7a')]}:_0x2beadd);});}; \ No newline at end of file +var _0xa505=['channel','ZohoField','Descriptions','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','clientId','serverUrl','code','refreshToken','host','zoho.eu','com','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoAccount','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','ZohoConfiguration','order','filter','getConfigurations','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','getDescriptions'];(function(_0x14c5f1,_0x31e408){var _0x478efb=function(_0x43ddb3){while(--_0x43ddb3){_0x14c5f1['push'](_0x14c5f1['shift']());}};_0x478efb(++_0x31e408);}(_0xa505,0x13b));var _0x5a50=function(_0x141e4a,_0x111e03){_0x141e4a=_0x141e4a-0x0;var _0x3e6800=_0xa505[_0x141e4a];return _0x3e6800;};'use strict';var emlformat=require(_0x5a50('0x0'));var rimraf=require(_0x5a50('0x1'));var zipdir=require(_0x5a50('0x2'));var jsonpatch=require(_0x5a50('0x3'));var rp=require(_0x5a50('0x4'));var moment=require(_0x5a50('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5a50('0x6'));var util=require('util');var path=require(_0x5a50('0x7'));var sox=require('sox');var csv=require(_0x5a50('0x8'));var ejs=require(_0x5a50('0x9'));var fs=require('fs');var fs_extra=require(_0x5a50('0xa'));var _=require(_0x5a50('0xb'));var squel=require(_0x5a50('0xc'));var crypto=require(_0x5a50('0xd'));var jsforce=require(_0x5a50('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5a50('0x8'));var querystring=require(_0x5a50('0xf'));var Papa=require('papaparse');var Redis=require(_0x5a50('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5a50('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a50('0x12'));var logger=require(_0x5a50('0x13'))('api');var utils=require(_0x5a50('0x14'));var config=require(_0x5a50('0x15'));var licenseUtil=require(_0x5a50('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5a50('0x17'));function respondWithStatusCode(_0x4ad80e,_0x320685){_0x320685=_0x320685||0xcc;return function(_0xf2c700){if(_0xf2c700){return _0x4ad80e['sendStatus'](_0x320685);}return _0x4ad80e['status'](_0x320685)[_0x5a50('0x18')]();};}function respondWithResult(_0x320f6b,_0x311625){_0x311625=_0x311625||0xc8;return function(_0xf49b75){if(_0xf49b75){return _0x320f6b[_0x5a50('0x19')](_0x311625)[_0x5a50('0x1a')](_0xf49b75);}};}function respondWithFilteredResult(_0x269348,_0x848e4a){return function(_0x184761){if(_0x184761){var _0x947f85=typeof _0x848e4a[_0x5a50('0x1b')]===_0x5a50('0x1c')&&typeof _0x848e4a[_0x5a50('0x1d')]===_0x5a50('0x1c');var _0x35ee41=_0x184761[_0x5a50('0x1e')];var _0x269648=_0x947f85?0x0:_0x848e4a[_0x5a50('0x1b')];var _0x1018b4=_0x947f85?_0x184761[_0x5a50('0x1e')]:_0x848e4a[_0x5a50('0x1b')]+_0x848e4a[_0x5a50('0x1d')];var _0x3a4546;if(_0x1018b4>=_0x35ee41){_0x1018b4=_0x35ee41;_0x3a4546=0xc8;}else{_0x3a4546=0xce;}_0x269348['status'](_0x3a4546);return _0x269348[_0x5a50('0x1f')](_0x5a50('0x20'),_0x269648+'-'+_0x1018b4+'/'+_0x35ee41)[_0x5a50('0x1a')](_0x184761);}return null;};}function patchUpdates(_0xd8f2a4){return function(_0x3cbc30){try{jsonpatch[_0x5a50('0x21')](_0x3cbc30,_0xd8f2a4,!![]);}catch(_0x1968a8){return BPromise[_0x5a50('0x22')](_0x1968a8);}return _0x3cbc30[_0x5a50('0x23')]();};}function saveUpdates(_0x492abd,_0x342572){return function(_0x10a3ec){if(_0x10a3ec){return _0x10a3ec[_0x5a50('0x24')](_0x492abd)[_0x5a50('0x25')](function(_0x4c059e){return _0x4c059e;});}return null;};}function removeEntity(_0xcd6d8f,_0x485014){return function(_0x2611f6){if(_0x2611f6){return _0x2611f6[_0x5a50('0x26')]()[_0x5a50('0x25')](function(){_0xcd6d8f[_0x5a50('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40ee5c,_0x542ae4){return function(_0x2d428d){if(!_0x2d428d){_0x40ee5c[_0x5a50('0x27')](0x194);}return _0x2d428d;};}function handleError(_0x770097,_0x6c44fa){_0x6c44fa=_0x6c44fa||0x1f4;return function(_0x206ce5){logger[_0x5a50('0x28')](_0x206ce5[_0x5a50('0x29')]);if(_0x206ce5['name']){delete _0x206ce5[_0x5a50('0x2a')];}_0x770097[_0x5a50('0x19')](_0x6c44fa)[_0x5a50('0x2b')](_0x206ce5);};}exports[_0x5a50('0x2c')]=function(_0x3e8163,_0x3ea835){var _0x3427e5={},_0x43b8cd={},_0x5c88bb={'count':0x0,'rows':[]};var _0x575683=_[_0x5a50('0x2d')](db[_0x5a50('0x2e')]['rawAttributes'],function(_0x510fa6){return{'name':_0x510fa6[_0x5a50('0x2f')],'type':_0x510fa6[_0x5a50('0x30')][_0x5a50('0x31')]};});_0x43b8cd[_0x5a50('0x32')]=_[_0x5a50('0x2d')](_0x575683,_0x5a50('0x2a'));_0x43b8cd['query']=_[_0x5a50('0x33')](_0x3e8163[_0x5a50('0x34')]);_0x43b8cd[_0x5a50('0x35')]=_['intersection'](_0x43b8cd['model'],_0x43b8cd['query']);_0x3427e5[_0x5a50('0x36')]=_[_0x5a50('0x37')](_0x43b8cd['model'],qs[_0x5a50('0x38')](_0x3e8163[_0x5a50('0x34')][_0x5a50('0x38')]));_0x3427e5[_0x5a50('0x36')]=_0x3427e5[_0x5a50('0x36')][_0x5a50('0x39')]?_0x3427e5[_0x5a50('0x36')]:_0x43b8cd[_0x5a50('0x32')];if(!_0x3e8163[_0x5a50('0x34')]['hasOwnProperty']('nolimit')){_0x3427e5[_0x5a50('0x1d')]=qs['limit'](_0x3e8163[_0x5a50('0x34')][_0x5a50('0x1d')]);_0x3427e5[_0x5a50('0x1b')]=qs[_0x5a50('0x1b')](_0x3e8163['query'][_0x5a50('0x1b')]);}_0x3427e5['order']=qs[_0x5a50('0x3a')](_0x3e8163[_0x5a50('0x34')][_0x5a50('0x3a')]);_0x3427e5[_0x5a50('0x3b')]=qs[_0x5a50('0x35')](_[_0x5a50('0x3c')](_0x3e8163[_0x5a50('0x34')],_0x43b8cd[_0x5a50('0x35')]),_0x575683);if(_0x3e8163['query']['filter']){_0x3427e5[_0x5a50('0x3b')]=_[_0x5a50('0x3d')](_0x3427e5[_0x5a50('0x3b')],{'$or':_[_0x5a50('0x2d')](_0x575683,function(_0x5bb4b2){if(_0x5bb4b2[_0x5a50('0x30')]!==_0x5a50('0x3e')){var _0x86a692={};_0x86a692[_0x5bb4b2[_0x5a50('0x2a')]]={'$like':'%'+_0x3e8163[_0x5a50('0x34')]['filter']+'%'};return _0x86a692;}})});}_0x3427e5=_[_0x5a50('0x3d')]({},_0x3427e5,_0x3e8163[_0x5a50('0x3f')]);var _0x39541f={'where':_0x3427e5['where']};return db['ZohoAccount']['count'](_0x39541f)[_0x5a50('0x25')](function(_0x25f254){_0x5c88bb[_0x5a50('0x1e')]=_0x25f254;if(_0x3e8163[_0x5a50('0x34')][_0x5a50('0x40')]){_0x3427e5[_0x5a50('0x41')]=[{'all':!![]}];}return db[_0x5a50('0x2e')][_0x5a50('0x42')](_0x3427e5);})['then'](function(_0x10052b){_0x5c88bb[_0x5a50('0x43')]=_0x10052b;return _0x5c88bb;})[_0x5a50('0x25')](respondWithFilteredResult(_0x3ea835,_0x3427e5))[_0x5a50('0x44')](handleError(_0x3ea835,null));};exports[_0x5a50('0x45')]=function(_0x6df715,_0x8f760a){var _0x2bfe00={'raw':![],'where':{'id':_0x6df715[_0x5a50('0x46')]['id']}},_0x163f86={};_0x163f86[_0x5a50('0x32')]=_['keys'](db[_0x5a50('0x2e')][_0x5a50('0x47')]);_0x163f86[_0x5a50('0x34')]=_[_0x5a50('0x33')](_0x6df715[_0x5a50('0x34')]);_0x163f86[_0x5a50('0x35')]=_[_0x5a50('0x37')](_0x163f86[_0x5a50('0x32')],_0x163f86[_0x5a50('0x34')]);_0x2bfe00[_0x5a50('0x36')]=_[_0x5a50('0x37')](_0x163f86[_0x5a50('0x32')],qs[_0x5a50('0x38')](_0x6df715[_0x5a50('0x34')][_0x5a50('0x38')]));_0x2bfe00['attributes']=_0x2bfe00['attributes'][_0x5a50('0x39')]?_0x2bfe00[_0x5a50('0x36')]:_0x163f86[_0x5a50('0x32')];if(_0x6df715[_0x5a50('0x34')][_0x5a50('0x40')]){_0x2bfe00['include']=[{'all':!![]}];}_0x2bfe00=_[_0x5a50('0x3d')]({},_0x2bfe00,_0x6df715[_0x5a50('0x3f')]);return db[_0x5a50('0x2e')][_0x5a50('0x48')](_0x2bfe00)[_0x5a50('0x25')](handleEntityNotFound(_0x8f760a,null))['then'](respondWithResult(_0x8f760a,null))[_0x5a50('0x44')](handleError(_0x8f760a,null));};exports[_0x5a50('0x49')]=function(_0x3babee,_0x2a9e7e){return db[_0x5a50('0x2e')]['create'](_0x3babee[_0x5a50('0x4a')],{})[_0x5a50('0x25')](respondWithResult(_0x2a9e7e,0xc9))[_0x5a50('0x44')](handleError(_0x2a9e7e,null));};exports[_0x5a50('0x24')]=function(_0x440033,_0xab2eba){if(_0x440033[_0x5a50('0x4a')]['id']){delete _0x440033[_0x5a50('0x4a')]['id'];}return db[_0x5a50('0x2e')][_0x5a50('0x48')]({'where':{'id':_0x440033[_0x5a50('0x46')]['id']}})[_0x5a50('0x25')](handleEntityNotFound(_0xab2eba,null))['then'](saveUpdates(_0x440033[_0x5a50('0x4a')],null))[_0x5a50('0x25')](respondWithResult(_0xab2eba,null))[_0x5a50('0x44')](handleError(_0xab2eba,null));};exports[_0x5a50('0x26')]=function(_0x3a5e9b,_0x3ae2c3){return db[_0x5a50('0x2e')]['find']({'where':{'id':_0x3a5e9b[_0x5a50('0x46')]['id']}})[_0x5a50('0x25')](handleEntityNotFound(_0x3ae2c3,null))['then'](removeEntity(_0x3ae2c3,null))['catch'](handleError(_0x3ae2c3,null));};exports['getConfigurations']=function(_0xf16873,_0x2d78bd,_0x4cab50){var _0x82edad={};var _0x28bd47={};var _0x2494cb;var _0x3ddcdc;return db[_0x5a50('0x2e')]['findOne']({'where':{'id':_0xf16873[_0x5a50('0x46')]['id']}})[_0x5a50('0x25')](handleEntityNotFound(_0x2d78bd,null))[_0x5a50('0x25')](function(_0x17fe9e){if(_0x17fe9e){_0x2494cb=_0x17fe9e;_0x28bd47[_0x5a50('0x32')]=_[_0x5a50('0x33')](db[_0x5a50('0x4b')][_0x5a50('0x47')]);_0x28bd47[_0x5a50('0x34')]=_[_0x5a50('0x33')](_0xf16873[_0x5a50('0x34')]);_0x28bd47[_0x5a50('0x35')]=_['intersection'](_0x28bd47['model'],_0x28bd47[_0x5a50('0x34')]);_0x82edad[_0x5a50('0x36')]=_[_0x5a50('0x37')](_0x28bd47[_0x5a50('0x32')],qs['fields'](_0xf16873[_0x5a50('0x34')][_0x5a50('0x38')]));_0x82edad[_0x5a50('0x36')]=_0x82edad[_0x5a50('0x36')]['length']?_0x82edad[_0x5a50('0x36')]:_0x28bd47['model'];_0x82edad[_0x5a50('0x4c')]=qs[_0x5a50('0x3a')](_0xf16873[_0x5a50('0x34')][_0x5a50('0x3a')]);_0x82edad[_0x5a50('0x3b')]=qs[_0x5a50('0x35')](_['pick'](_0xf16873[_0x5a50('0x34')],_0x28bd47['filters']));if(_0xf16873[_0x5a50('0x34')][_0x5a50('0x4d')]){_0x82edad[_0x5a50('0x3b')]=_[_0x5a50('0x3d')](_0x82edad['where'],{'$or':_[_0x5a50('0x2d')](_0x82edad[_0x5a50('0x36')],function(_0x3b8979){var _0x53e4d5={};_0x53e4d5[_0x3b8979]={'$like':'%'+_0xf16873[_0x5a50('0x34')][_0x5a50('0x4d')]+'%'};return _0x53e4d5;})});}_0x82edad=_[_0x5a50('0x3d')]({},_0x82edad,_0xf16873[_0x5a50('0x3f')]);return _0x2494cb[_0x5a50('0x4e')](_0x82edad);}})['then'](function(_0x59a4bd){if(_0x59a4bd){_0x3ddcdc=_0x59a4bd[_0x5a50('0x39')];if(!_0xf16873[_0x5a50('0x34')][_0x5a50('0x4f')](_0x5a50('0x50'))){_0x82edad[_0x5a50('0x1d')]=qs[_0x5a50('0x1d')](_0xf16873[_0x5a50('0x34')][_0x5a50('0x1d')]);_0x82edad[_0x5a50('0x1b')]=qs[_0x5a50('0x1b')](_0xf16873['query'][_0x5a50('0x1b')]);}return _0x2494cb[_0x5a50('0x4e')](_0x82edad);}})[_0x5a50('0x25')](function(_0x3c9c33){if(_0x3c9c33){return _0x3c9c33?{'count':_0x3ddcdc,'rows':_0x3c9c33}:null;}})[_0x5a50('0x25')](respondWithResult(_0x2d78bd,null))[_0x5a50('0x44')](handleError(_0x2d78bd,null));};exports[_0x5a50('0x51')]=function(_0x4bf91e,_0xe3e8ea,_0xa116dd){if(_0x4bf91e['body']['id']){delete _0x4bf91e[_0x5a50('0x4a')]['id'];}return db[_0x5a50('0x2e')][_0x5a50('0x52')]({'where':{'id':_0x4bf91e[_0x5a50('0x46')]['id']}})[_0x5a50('0x25')](handleEntityNotFound(_0xe3e8ea,null))[_0x5a50('0x25')](function(_0x178ef5){if(_0x178ef5){_0x4bf91e[_0x5a50('0x4a')][_0x5a50('0x53')]=_0x178ef5['id'];_0x4bf91e[_0x5a50('0x4a')][_0x5a50('0x54')]=integrations[_0x5a50('0x55')](_0x4bf91e[_0x5a50('0x4a')]['channel'],_0x4bf91e[_0x5a50('0x4a')][_0x5a50('0x30')]);_0x4bf91e['body']['Descriptions']=integrations[_0x5a50('0x56')](_0x4bf91e[_0x5a50('0x4a')][_0x5a50('0x57')],_0x4bf91e[_0x5a50('0x4a')][_0x5a50('0x30')]);return db[_0x5a50('0x4b')][_0x5a50('0x49')](_0x4bf91e['body'],{'include':[{'model':db[_0x5a50('0x58')],'as':'Subjects'},{'model':db[_0x5a50('0x58')],'as':_0x5a50('0x59')}]});}return null;})['then'](respondWithResult(_0xe3e8ea,null))[_0x5a50('0x44')](handleError(_0xe3e8ea,null));};function getAccessToken(_0x4d7f80){return new Promise(function(_0x429441,_0x1622cd){var _0x5f3f8c;switch(_0x4d7f80[_0x5a50('0x5a')]){case'US':_0x5f3f8c='https://accounts.zoho.com';break;case'AU':_0x5f3f8c=_0x5a50('0x5b');break;case'EU':_0x5f3f8c=_0x5a50('0x5c');break;case'IN':_0x5f3f8c=_0x5a50('0x5d');break;case'CN':_0x5f3f8c=_0x5a50('0x5e');break;default:_0x5f3f8c=_0x5a50('0x5c');break;}var _0x1d64fe={'method':'POST','uri':_0x5f3f8c+_0x5a50('0x5f'),'qs':{'refresh_token':_0x4d7f80['refreshToken'],'client_id':_0x4d7f80['clientId'],'client_secret':_0x4d7f80[_0x5a50('0x60')],'grant_type':_0x5a50('0x61')},'json':!![]};return rp(_0x1d64fe)[_0x5a50('0x25')](function(_0x1185f4){if(_0x1185f4[_0x5a50('0x62')]){_0x429441(_0x1185f4['access_token']);}else{_0x1622cd(_0x5a50('0x63'));}})[_0x5a50('0x44')](function(_0x54c784){_0x1622cd(_0x54c784);});});}exports['getFields']=function(_0x23eabd,_0x29a686,_0x52656f){var _0x2fe227,_0xf58035,_0x2aafac,_0x656b2a,_0x5db164;return db['ZohoAccount'][_0x5a50('0x52')]({'where':{'id':_0x23eabd['params']['id']},'attributes':['id','host',_0x5a50('0x5a'),_0x5a50('0x64'),_0x5a50('0x60'),_0x5a50('0x65'),_0x5a50('0x66'),_0x5a50('0x67')]})[_0x5a50('0x25')](handleEntityNotFound(_0x29a686,null))[_0x5a50('0x25')](function(_0x23c5cd){_0x5db164=_0x23c5cd;_0x2fe227=_0x5db164[_0x5a50('0x68')];_0xf58035=_0x2fe227===_0x5a50('0x69')?'eu':_0x5a50('0x6a');_0x2aafac=_0x5db164[_0x5a50('0x65')];var _0x93d4de=_0x2aafac['slice'](-0x1);if(_0x93d4de==='/'||_0x93d4de==='\x5c'||_0x93d4de===':'){_0x2aafac=_0x2aafac['substring'](0x0,_0x2aafac[_0x5a50('0x6b')](_0x93d4de));}if(!_0x5db164[_0x5a50('0x67')]){throw new Error(_0x5a50('0x6c'));}return getAccessToken(_0x5db164);})['then'](function(_0x40ca42){if(_0x40ca42){return rp({'method':'GET','uri':util[_0x5a50('0x6d')](_0x5a50('0x6e'),_0xf58035),'qs':{'module':_0x5a50('0x6f')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x40ca42},'json':!![]});}})[_0x5a50('0x25')](function(_0x542c70){if(_0x542c70){if(_0x542c70[_0x5a50('0x70')]&&_0x542c70['response'][_0x5a50('0x28')]){throw new Error(_0x542c70[_0x5a50('0x70')][_0x5a50('0x28')][_0x5a50('0x71')]);}var _0x1fc740=[];var _0x7bf5cd=[];var _0x1bde0c=[_0x5a50('0x72'),_0x5a50('0x73'),_0x5a50('0x74'),_0x5a50('0x75'),_0x5a50('0x76'),_0x5a50('0x77'),_0x5a50('0x78'),_0x5a50('0x79')];_0x7bf5cd=_['remove'](_0x542c70[_0x5a50('0x38')],function(_0x294dc3){return _0x1bde0c[_0x5a50('0x7a')](_0x294dc3[_0x5a50('0x7b')]);});for(var _0x1613b4=0x0;_0x1613b4<_0x7bf5cd[_0x5a50('0x39')];_0x1613b4++){if(_0x7bf5cd[_0x1613b4][_0x5a50('0x7c')]===![]){_0x1fc740['push']({'id':_0x7bf5cd[_0x1613b4]['id'],'name':_0x7bf5cd[_0x1613b4][_0x5a50('0x7d')],'custom':_0x7bf5cd[_0x1613b4][_0x5a50('0x7e')],'options':_0x7bf5cd[_0x1613b4][_0x5a50('0x7f')]===_0x5a50('0x80')&&_0x7bf5cd[_0x1613b4][_0x5a50('0x81')][_0x5a50('0x39')]>-0x1?_[_0x5a50('0x2d')](_0x7bf5cd[_0x1613b4]['pick_list_values'],function(_0x324aae){return{'name':_0x324aae,'value':_0x324aae};}):[]});}}return{'count':_0x1fc740[_0x5a50('0x39')],'rows':_0x1fc740};}else{return{'count':0x0,'rows':[]};}})[_0x5a50('0x25')](respondWithResult(_0x29a686,null))[_0x5a50('0x44')](function(_0x560c0b){var _0x241001=_0x23eabd['query']['test']?0x1f4:_0x560c0b[_0x5a50('0x82')]||0x1f4;logger[_0x5a50('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x5a50('0x83'),_0x241001,JSON['stringify'](_0x560c0b));delete _0x560c0b[_0x5a50('0x2a')];if(_0x241001===0x191){_0x241001=0x190;}_0x29a686['status'](_0x241001)[_0x5a50('0x2b')](_0x23eabd[_0x5a50('0x34')][_0x5a50('0x84')]?{'message':_0x5a50('0x85'),'statusCode':_0x560c0b['statusCode']}:_0x560c0b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index b0ab65b..7afd114 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 _0x5463=['../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','substring','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x54c9dd,_0x233a86){var _0x855156=function(_0x2dd60b){while(--_0x2dd60b){_0x54c9dd['push'](_0x54c9dd['shift']());}};_0x855156(++_0x233a86);}(_0x5463,0x1dc));var _0x3546=function(_0xba748,_0x4876c9){_0xba748=_0xba748-0x0;var _0x5412b3=_0x5463[_0xba748];return _0x5412b3;};'use strict';var _=require(_0x3546('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3546('0x1'));var moment=require(_0x3546('0x2'));var BPromise=require(_0x3546('0x3'));var rp=require(_0x3546('0x4'));var fs=require('fs');var path=require(_0x3546('0x5'));var rimraf=require(_0x3546('0x6'));var config=require(_0x3546('0x7'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x3546('0x8'));module[_0x3546('0x9')]=function(_0x3a613e,_0x33b7e1){return _0x3a613e[_0x3546('0xa')](_0x3546('0xb'),attributes,{'tableName':_0x3546('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x174456,_0x21be6c,_0x538514){if(_0x174456[_0x3546('0xd')](_0x3546('0xe'))||_0x174456[_0x3546('0xd')](_0x3546('0xf'))||_0x174456[_0x3546('0xd')](_0x3546('0x10'))||_0x174456[_0x3546('0xd')](_0x3546('0x11'))||_0x174456[_0x3546('0xd')]('code')||_0x174456[_0x3546('0xd')](_0x3546('0x12'))){var _0x2d74a8,_0x4d2b47;_0x2d74a8=_0x174456['serverUrl'];var _0x599d2b=_0x2d74a8[_0x3546('0x13')](-0x1);if(_0x599d2b==='/'||_0x599d2b==='\x5c'||_0x599d2b===':'){_0x2d74a8=_0x2d74a8['substring'](0x0,_0x2d74a8[_0x3546('0x14')](_0x599d2b));}switch(_0x174456[_0x3546('0xe')]){case'US':_0x4d2b47=_0x3546('0x15');break;case'AU':_0x4d2b47='https://accounts.zoho.com.au';break;case'IN':_0x4d2b47=_0x3546('0x16');break;case'CN':_0x4d2b47='https://accounts.zoho.com.cn';break;default:_0x4d2b47='https://accounts.zoho.eu';break;}var _0x222a09={'method':_0x3546('0x17'),'uri':_0x4d2b47+_0x3546('0x18'),'form':{'grant_type':_0x3546('0x19'),'client_id':_0x174456[_0x3546('0x10')],'client_secret':_0x174456['clientSecret'],'redirect_uri':_0x174456[_0x3546('0xf')],'code':_0x174456[_0x3546('0x1a')]},'headers':{'Content-Type':_0x3546('0x1b')}};return rp(_0x222a09)[_0x3546('0x1c')](function(_0x5f03e9){var _0x29a473=JSON[_0x3546('0x1d')](_0x5f03e9);if(_0x29a473[_0x3546('0x1e')]){_0x174456[_0x3546('0x1f')]=_0x29a473['refresh_token'];logger[_0x3546('0x20')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x174456[_0x3546('0x21')],_0x174456['id']));}else{logger[_0x3546('0x22')](util[_0x3546('0x23')](_0x3546('0x24'),_0x174456[_0x3546('0x21')],_0x174456['id']),util[_0x3546('0x25')](_0x29a473,{'showHidden':![],'depth':null}));}return _0x538514(null,_0x21be6c);})[_0x3546('0x26')](function(_0x230a89){logger['error'](util['format'](_0x3546('0x24'),_0x174456[_0x3546('0x21')],_0x174456['id']),util[_0x3546('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x538514(_0x230a89);});}else{return _0x538514(null,_0x21be6c);}},'beforeUpdate':function(_0x109641,_0x3e6a5a,_0x333e99){if(_0x109641[_0x3546('0xd')]('zone')||_0x109641[_0x3546('0xd')](_0x3546('0xf'))||_0x109641[_0x3546('0xd')]('clientId')||_0x109641['changed'](_0x3546('0x11'))||_0x109641[_0x3546('0xd')](_0x3546('0x1a'))||_0x109641[_0x3546('0xd')](_0x3546('0x12'))){var _0x1971a0,_0xdf8abc;_0x1971a0=_0x109641[_0x3546('0xf')];var _0x801b19=_0x1971a0['slice'](-0x1);if(_0x801b19==='/'||_0x801b19==='\x5c'||_0x801b19===':'){_0x1971a0=_0x1971a0[_0x3546('0x27')](0x0,_0x1971a0['lastIndexOf'](_0x801b19));}switch(_0x109641['zone']){case'US':_0xdf8abc=_0x3546('0x15');break;case'AU':_0xdf8abc=_0x3546('0x28');break;case'IN':_0xdf8abc='https://accounts.zoho.in';break;case'CN':_0xdf8abc=_0x3546('0x29');break;default:_0xdf8abc=_0x3546('0x2a');break;}var _0x2c927e={'method':_0x3546('0x17'),'uri':_0xdf8abc+'/oauth/v2/token','form':{'grant_type':_0x3546('0x19'),'client_id':_0x109641[_0x3546('0x10')],'client_secret':_0x109641['clientSecret'],'redirect_uri':_0x109641[_0x3546('0xf')],'code':_0x109641[_0x3546('0x1a')]},'headers':{'Content-Type':_0x3546('0x1b')}};return rp(_0x2c927e)[_0x3546('0x1c')](function(_0x40b73b){var _0x117f99=JSON[_0x3546('0x1d')](_0x40b73b);if(_0x117f99[_0x3546('0x1e')]){_0x109641['refreshToken']=_0x117f99[_0x3546('0x1e')];logger['info'](util['format'](_0x3546('0x2b'),_0x109641['name'],_0x109641['id']));}else{logger['error'](util[_0x3546('0x23')](_0x3546('0x24'),_0x109641['name'],_0x109641['id']),util[_0x3546('0x25')](_0x117f99,{'showHidden':![],'depth':null}));}return _0x333e99(null,_0x3e6a5a);})[_0x3546('0x26')](function(_0x3c102f){logger[_0x3546('0x22')](util[_0x3546('0x23')](_0x3546('0x24'),_0x109641[_0x3546('0x21')],_0x109641['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x333e99(_0x3c102f);});}else{return _0x333e99(null,_0x3e6a5a);}}}});}; \ No newline at end of file +var _0xa868=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','changed','serverUrl','clientId','clientSecret','host','slice','substring','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','name','https://accounts.zoho.com','https://accounts.zoho.com.cn','parse','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d'];(function(_0x57cb4f,_0x541f57){var _0x29bb45=function(_0x462bee){while(--_0x462bee){_0x57cb4f['push'](_0x57cb4f['shift']());}};_0x29bb45(++_0x541f57);}(_0xa868,0x1b8));var _0x8a86=function(_0x4a79fd,_0x429333){_0x4a79fd=_0x4a79fd-0x0;var _0xef2f88=_0xa868[_0x4a79fd];return _0xef2f88;};'use strict';var _=require(_0x8a86('0x0'));var util=require(_0x8a86('0x1'));var logger=require(_0x8a86('0x2'))(_0x8a86('0x3'));var moment=require(_0x8a86('0x4'));var BPromise=require(_0x8a86('0x5'));var rp=require(_0x8a86('0x6'));var fs=require('fs');var path=require(_0x8a86('0x7'));var rimraf=require(_0x8a86('0x8'));var config=require(_0x8a86('0x9'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x8a86('0xa')]=function(_0x368ab8,_0xc8d504){return _0x368ab8['define']('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x26dfb9,_0x3559e6,_0x5a1695){if(_0x26dfb9[_0x8a86('0xb')]('zone')||_0x26dfb9[_0x8a86('0xb')](_0x8a86('0xc'))||_0x26dfb9[_0x8a86('0xb')](_0x8a86('0xd'))||_0x26dfb9[_0x8a86('0xb')](_0x8a86('0xe'))||_0x26dfb9[_0x8a86('0xb')]('code')||_0x26dfb9[_0x8a86('0xb')](_0x8a86('0xf'))){var _0xcef982,_0x55645c;_0xcef982=_0x26dfb9['serverUrl'];var _0x3eb3f3=_0xcef982[_0x8a86('0x10')](-0x1);if(_0x3eb3f3==='/'||_0x3eb3f3==='\x5c'||_0x3eb3f3===':'){_0xcef982=_0xcef982[_0x8a86('0x11')](0x0,_0xcef982['lastIndexOf'](_0x3eb3f3));}switch(_0x26dfb9[_0x8a86('0x12')]){case'US':_0x55645c='https://accounts.zoho.com';break;case'AU':_0x55645c=_0x8a86('0x13');break;case'IN':_0x55645c=_0x8a86('0x14');break;case'CN':_0x55645c='https://accounts.zoho.com.cn';break;default:_0x55645c=_0x8a86('0x15');break;}var _0x25ef14={'method':_0x8a86('0x16'),'uri':_0x55645c+_0x8a86('0x17'),'form':{'grant_type':_0x8a86('0x18'),'client_id':_0x26dfb9[_0x8a86('0xd')],'client_secret':_0x26dfb9['clientSecret'],'redirect_uri':_0x26dfb9[_0x8a86('0xc')],'code':_0x26dfb9[_0x8a86('0x19')]},'headers':{'Content-Type':_0x8a86('0x1a')}};return rp(_0x25ef14)[_0x8a86('0x1b')](function(_0x1bcbd6){var _0x58bcc6=JSON['parse'](_0x1bcbd6);if(_0x58bcc6[_0x8a86('0x1c')]){_0x26dfb9[_0x8a86('0x1d')]=_0x58bcc6[_0x8a86('0x1c')];logger[_0x8a86('0x1e')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x26dfb9['name'],_0x26dfb9['id']));}else{logger[_0x8a86('0x1f')](util['format'](_0x8a86('0x20'),_0x26dfb9['name'],_0x26dfb9['id']),util[_0x8a86('0x21')](_0x58bcc6,{'showHidden':![],'depth':null}));}return _0x5a1695(null,_0x3559e6);})['catch'](function(_0x29a223){logger[_0x8a86('0x1f')](util['format'](_0x8a86('0x20'),_0x26dfb9[_0x8a86('0x22')],_0x26dfb9['id']),util[_0x8a86('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x5a1695(_0x29a223);});}else{return _0x5a1695(null,_0x3559e6);}},'beforeUpdate':function(_0x1c372f,_0x339132,_0x3e7e60){if(_0x1c372f['changed'](_0x8a86('0x12'))||_0x1c372f[_0x8a86('0xb')](_0x8a86('0xc'))||_0x1c372f[_0x8a86('0xb')]('clientId')||_0x1c372f[_0x8a86('0xb')](_0x8a86('0xe'))||_0x1c372f[_0x8a86('0xb')](_0x8a86('0x19'))||_0x1c372f['changed'](_0x8a86('0xf'))){var _0x5162d8,_0x686b5b;_0x5162d8=_0x1c372f[_0x8a86('0xc')];var _0xc00e35=_0x5162d8[_0x8a86('0x10')](-0x1);if(_0xc00e35==='/'||_0xc00e35==='\x5c'||_0xc00e35===':'){_0x5162d8=_0x5162d8[_0x8a86('0x11')](0x0,_0x5162d8['lastIndexOf'](_0xc00e35));}switch(_0x1c372f[_0x8a86('0x12')]){case'US':_0x686b5b=_0x8a86('0x23');break;case'AU':_0x686b5b=_0x8a86('0x13');break;case'IN':_0x686b5b='https://accounts.zoho.in';break;case'CN':_0x686b5b=_0x8a86('0x24');break;default:_0x686b5b=_0x8a86('0x15');break;}var _0x44805f={'method':_0x8a86('0x16'),'uri':_0x686b5b+_0x8a86('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x1c372f[_0x8a86('0xd')],'client_secret':_0x1c372f['clientSecret'],'redirect_uri':_0x1c372f['serverUrl'],'code':_0x1c372f[_0x8a86('0x19')]},'headers':{'Content-Type':_0x8a86('0x1a')}};return rp(_0x44805f)['then'](function(_0x287c58){var _0x1a8c61=JSON[_0x8a86('0x25')](_0x287c58);if(_0x1a8c61['refresh_token']){_0x1c372f[_0x8a86('0x1d')]=_0x1a8c61[_0x8a86('0x1c')];logger[_0x8a86('0x1e')](util[_0x8a86('0x26')](_0x8a86('0x27'),_0x1c372f[_0x8a86('0x22')],_0x1c372f['id']));}else{logger[_0x8a86('0x1f')](util[_0x8a86('0x26')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1c372f[_0x8a86('0x22')],_0x1c372f['id']),util[_0x8a86('0x21')](_0x1a8c61,{'showHidden':![],'depth':null}));}return _0x3e7e60(null,_0x339132);})['catch'](function(_0x16cf2a){logger[_0x8a86('0x1f')](util['format'](_0x8a86('0x20'),_0x1c372f['name'],_0x1c372f['id']),util[_0x8a86('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x3e7e60(_0x16cf2a);});}else{return _0x3e7e60(null,_0x339132);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index f214ee2..15ce901 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 _0x3d04=['result','ZohoAccount','options','where','attributes','limit','include','map','model','GetZohoAccount','debug','catch','find','raw','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','stringify','error','ZohoAccount,\x20%s,\x20%s','message','info'];(function(_0x1981aa,_0x196b04){var _0x7e028b=function(_0xc0107d){while(--_0xc0107d){_0x1981aa['push'](_0x1981aa['shift']());}};_0x7e028b(++_0x196b04);}(_0x3d04,0xbe));var _0x43d0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d04[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x43d0('0x0'));var util=require(_0x43d0('0x1'));var moment=require(_0x43d0('0x2'));var BPromise=require(_0x43d0('0x3'));var rs=require(_0x43d0('0x4'));var fs=require('fs');var Redis=require(_0x43d0('0x5'));var db=require(_0x43d0('0x6'))['db'];var utils=require(_0x43d0('0x7'));var logger=require('../../config/logger')(_0x43d0('0x8'));var config=require(_0x43d0('0x9'));var jayson=require(_0x43d0('0xa'));var client=jayson[_0x43d0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x484271,_0x50919e,_0x5efb95){return new BPromise(function(_0x457550,_0x3344d3){return client[_0x43d0('0xc')](_0x484271,_0x5efb95)[_0x43d0('0xd')](function(_0x44a763){logger['info']('ZohoAccount,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x50919e,_0x43d0('0xe'),JSON[_0x43d0('0xf')](_0x44a763));if(_0x44a763[_0x43d0('0x10')]){if(_0x44a763[_0x43d0('0x10')]['code']===0x1f4){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x44a763['error'][_0x43d0('0x12')]);return _0x3344d3(_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);}logger['error'](_0x43d0('0x11'),_0x50919e,_0x44a763[_0x43d0('0x10')][_0x43d0('0x12')]);return _0x457550(_0x44a763['error'][_0x43d0('0x12')]);}else{logger[_0x43d0('0x13')](_0x43d0('0x11'),_0x50919e,_0x43d0('0xe'));_0x457550(_0x44a763[_0x43d0('0x14')]['message']);}})['catch'](function(_0x1e91a7){logger[_0x43d0('0x10')](_0x43d0('0x11'),_0x50919e,_0x1e91a7);_0x3344d3(_0x1e91a7);});});}exports['GetZohoAccount']=function(_0x2c641e){var _0x532402=this;return new Promise(function(_0x2c9d06,_0x468ca2){return db[_0x43d0('0x15')]['findAll']({'raw':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x17')]||null:null,'attributes':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x18')]||null:null,'limit':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x19')]||null:null,'include':_0x2c641e[_0x43d0('0x16')]?_0x2c641e[_0x43d0('0x16')][_0x43d0('0x1a')]?_[_0x43d0('0x1b')](_0x2c641e[_0x43d0('0x16')][_0x43d0('0x1a')],function(_0x48aa18){return{'model':db[_0x48aa18[_0x43d0('0x1c')]],'as':_0x48aa18['as'],'attributes':_0x48aa18[_0x43d0('0x18')],'include':_0x48aa18['include']?_[_0x43d0('0x1b')](_0x48aa18['include'],function(_0x29c111){return{'model':db[_0x29c111[_0x43d0('0x1c')]],'as':_0x29c111['as'],'attributes':_0x29c111['attributes'],'include':_0x29c111[_0x43d0('0x1a')]?_[_0x43d0('0x1b')](_0x29c111['include'],function(_0x12df30){return{'model':db[_0x12df30[_0x43d0('0x1c')]],'as':_0x12df30['as'],'attributes':_0x12df30[_0x43d0('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x447725){logger[_0x43d0('0x13')](_0x43d0('0x1d'),_0x2c641e);logger[_0x43d0('0x1e')](_0x43d0('0x1d'),_0x2c641e,JSON[_0x43d0('0xf')](_0x447725));_0x2c9d06(_0x447725);})[_0x43d0('0x1f')](function(_0x4a3cd4){logger[_0x43d0('0x10')](_0x43d0('0x1d'),_0x4a3cd4[_0x43d0('0x12')],_0x2c641e);_0x468ca2(_0x532402['error'](0x1f4,_0x4a3cd4['message']));});});};exports['ShowZohoAccount']=function(_0x3c1ea3){var _0x2db9dc=this;return new Promise(function(_0x10086b,_0x13e3c9){return db[_0x43d0('0x15')][_0x43d0('0x20')]({'raw':_0x3c1ea3['options']?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x21')]===undefined?!![]:![]:!![],'where':_0x3c1ea3[_0x43d0('0x16')]?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x17')]||null:null,'attributes':_0x3c1ea3[_0x43d0('0x16')]?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x18')]||null:null,'include':_0x3c1ea3[_0x43d0('0x16')]?_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x1a')]?_['map'](_0x3c1ea3[_0x43d0('0x16')][_0x43d0('0x1a')],function(_0x45ec78){return{'model':db[_0x45ec78[_0x43d0('0x1c')]],'as':_0x45ec78['as'],'attributes':_0x45ec78['attributes'],'include':_0x45ec78[_0x43d0('0x1a')]?_['map'](_0x45ec78[_0x43d0('0x1a')],function(_0x23cc5b){return{'model':db[_0x23cc5b['model']],'as':_0x23cc5b['as'],'attributes':_0x23cc5b[_0x43d0('0x18')],'include':_0x23cc5b[_0x43d0('0x1a')]?_[_0x43d0('0x1b')](_0x23cc5b[_0x43d0('0x1a')],function(_0x154db6){return{'model':db[_0x154db6[_0x43d0('0x1c')]],'as':_0x154db6['as'],'attributes':_0x154db6[_0x43d0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x43d0('0xd')](function(_0x7b7983){logger[_0x43d0('0x13')](_0x43d0('0x22'),_0x3c1ea3);logger['debug'](_0x43d0('0x22'),_0x3c1ea3,JSON[_0x43d0('0xf')](_0x7b7983));_0x10086b(_0x7b7983);})[_0x43d0('0x1f')](function(_0x7891c5){logger[_0x43d0('0x10')](_0x43d0('0x22'),_0x7891c5[_0x43d0('0x12')],_0x3c1ea3);_0x13e3c9(_0x2db9dc[_0x43d0('0x10')](0x1f4,_0x7891c5[_0x43d0('0x12')]));});});}; \ No newline at end of file +var _0x77d4=['util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowZohoAccount','find'];(function(_0x1359c3,_0x55326c){var _0x2a1cbe=function(_0x37735f){while(--_0x37735f){_0x1359c3['push'](_0x1359c3['shift']());}};_0x2a1cbe(++_0x55326c);}(_0x77d4,0x108));var _0x477d=function(_0x317b0e,_0x984a20){_0x317b0e=_0x317b0e-0x0;var _0x3cd572=_0x77d4[_0x317b0e];return _0x3cd572;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});}exports[_0x477d('0x13')]=function(_0x5d5553){var _0x367965=this;return new Promise(function(_0x1399d7,_0x159beb){return db[_0x477d('0x14')][_0x477d('0x15')]({'raw':_0x5d5553[_0x477d('0x16')]?_0x5d5553['options'][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x5d5553['options']?_0x5d5553[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x19')]||null:null,'limit':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1a')]||null:null,'include':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')],function(_0x4e6a44){return{'model':db[_0x4e6a44[_0x477d('0x1d')]],'as':_0x4e6a44['as'],'attributes':_0x4e6a44['attributes'],'include':_0x4e6a44[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x4e6a44[_0x477d('0x1b')],function(_0x2287b4){return{'model':db[_0x2287b4['model']],'as':_0x2287b4['as'],'attributes':_0x2287b4[_0x477d('0x19')],'include':_0x2287b4[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x2287b4['include'],function(_0x585648){return{'model':db[_0x585648[_0x477d('0x1d')]],'as':_0x585648['as'],'attributes':_0x585648[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x5c8ef1){logger[_0x477d('0xa')](_0x477d('0x13'),_0x5d5553);logger[_0x477d('0x1e')](_0x477d('0x13'),_0x5d5553,JSON[_0x477d('0xe')](_0x5c8ef1));_0x1399d7(_0x5c8ef1);})['catch'](function(_0x2fc959){logger[_0x477d('0xf')](_0x477d('0x13'),_0x2fc959[_0x477d('0x11')],_0x5d5553);_0x159beb(_0x367965[_0x477d('0xf')](0x1f4,_0x2fc959[_0x477d('0x11')]));});});};exports[_0x477d('0x1f')]=function(_0x98b5d9){var _0x204541=this;return new Promise(function(_0x8fe6c4,_0x41b790){return db[_0x477d('0x14')][_0x477d('0x20')]({'raw':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9['options'][_0x477d('0x19')]||null:null,'include':_0x98b5d9['options']?_0x98b5d9[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x98b5d9['options'][_0x477d('0x1b')],function(_0x1201a9){return{'model':db[_0x1201a9[_0x477d('0x1d')]],'as':_0x1201a9['as'],'attributes':_0x1201a9[_0x477d('0x19')],'include':_0x1201a9[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x1201a9[_0x477d('0x1b')],function(_0xf84c4c){return{'model':db[_0xf84c4c[_0x477d('0x1d')]],'as':_0xf84c4c['as'],'attributes':_0xf84c4c[_0x477d('0x19')],'include':_0xf84c4c['include']?_[_0x477d('0x1c')](_0xf84c4c[_0x477d('0x1b')],function(_0xb41cd8){return{'model':db[_0xb41cd8['model']],'as':_0xb41cd8['as'],'attributes':_0xb41cd8[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x1b0410){logger['info']('ShowZohoAccount',_0x98b5d9);logger[_0x477d('0x1e')](_0x477d('0x1f'),_0x98b5d9,JSON[_0x477d('0xe')](_0x1b0410));_0x8fe6c4(_0x1b0410);})[_0x477d('0x12')](function(_0x1c0d86){logger['error'](_0x477d('0x1f'),_0x1c0d86['message'],_0x98b5d9);_0x41b790(_0x204541[_0x477d('0xf')](0x1f4,_0x1c0d86[_0x477d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 256aaeb..c75aca5 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 _0xb4a6=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete'];(function(_0x5bc2ca,_0x5dccf8){var _0x385c32=function(_0x57279a){while(--_0x57279a){_0x5bc2ca['push'](_0x5bc2ca['shift']());}};_0x385c32(++_0x5dccf8);}(_0xb4a6,0x1e2));var _0x6b4a=function(_0x47397f,_0x45ba05){_0x47397f=_0x47397f-0x0;var _0xba5ff1=_0xb4a6[_0x47397f];return _0xba5ff1;};'use strict';var multer=require(_0x6b4a('0x0'));var util=require(_0x6b4a('0x1'));var path=require(_0x6b4a('0x2'));var timeout=require(_0x6b4a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6b4a('0x4'));var auth=require(_0x6b4a('0x5'));var interaction=require(_0x6b4a('0x6'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router['get']('/',auth[_0x6b4a('0x7')](),controller['index']);router[_0x6b4a('0x8')]('/:id',auth[_0x6b4a('0x7')](),controller[_0x6b4a('0x9')]);router[_0x6b4a('0x8')](_0x6b4a('0xa'),auth[_0x6b4a('0x7')](),controller['getFields']);router[_0x6b4a('0x8')](_0x6b4a('0xb'),auth[_0x6b4a('0x7')](),controller['getSubjects']);router[_0x6b4a('0x8')](_0x6b4a('0xc'),auth[_0x6b4a('0x7')](),controller[_0x6b4a('0xd')]);router[_0x6b4a('0xe')]('/',auth[_0x6b4a('0x7')](),controller[_0x6b4a('0xf')]);router['put']('/:id',auth[_0x6b4a('0x7')](),controller[_0x6b4a('0x10')]);router[_0x6b4a('0x11')]('/:id',auth[_0x6b4a('0x7')](),controller[_0x6b4a('0x12')]);module[_0x6b4a('0x13')]=router; \ No newline at end of file +var _0x7f82=['show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','destroy','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x5ae1a2,_0x3601ba){var _0x9ac42f=function(_0x16abe8){while(--_0x16abe8){_0x5ae1a2['push'](_0x5ae1a2['shift']());}};_0x9ac42f(++_0x3601ba);}(_0x7f82,0x129));var _0x27f8=function(_0x5c2c7c,_0xa7d3b1){_0x5c2c7c=_0x5c2c7c-0x0;var _0xea7ffe=_0x7f82[_0x5c2c7c];return _0xea7ffe;};'use strict';var multer=require(_0x27f8('0x0'));var util=require('util');var path=require(_0x27f8('0x1'));var timeout=require(_0x27f8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x27f8('0x3'));var interaction=require(_0x27f8('0x4'));var config=require(_0x27f8('0x5'));var controller=require(_0x27f8('0x6'));router[_0x27f8('0x7')]('/',auth[_0x27f8('0x8')](),controller[_0x27f8('0x9')]);router[_0x27f8('0x7')](_0x27f8('0xa'),auth[_0x27f8('0x8')](),controller[_0x27f8('0xb')]);router[_0x27f8('0x7')](_0x27f8('0xc'),auth['isAuthenticated'](),controller[_0x27f8('0xd')]);router[_0x27f8('0x7')](_0x27f8('0xe'),auth[_0x27f8('0x8')](),controller[_0x27f8('0xf')]);router['get'](_0x27f8('0x10'),auth[_0x27f8('0x8')](),controller['getDescriptions']);router[_0x27f8('0x11')]('/',auth[_0x27f8('0x8')](),controller[_0x27f8('0x12')]);router['put'](_0x27f8('0xa'),auth[_0x27f8('0x8')](),controller[_0x27f8('0x13')]);router[_0x27f8('0x14')](_0x27f8('0xa'),auth[_0x27f8('0x8')](),controller[_0x27f8('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index f81cd14..7105f16 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 _0x89ec=['ENUM','lead','contact','nothing','sequelize','exports','STRING'];(function(_0x44754d,_0x335b0c){var _0x45cec6=function(_0x306c3b){while(--_0x306c3b){_0x44754d['push'](_0x44754d['shift']());}};_0x45cec6(++_0x335b0c);}(_0x89ec,0x1e0));var _0xc89e=function(_0x2c99ed,_0x31ed55){_0x2c99ed=_0x2c99ed-0x0;var _0x4530cd=_0x89ec[_0x2c99ed];return _0x4530cd;};'use strict';var Sequelize=require(_0xc89e('0x0'));module[_0xc89e('0x1')]={'name':{'type':Sequelize[_0xc89e('0x2')]},'moduleCreate':{'type':Sequelize[_0xc89e('0x3')](_0xc89e('0x4'),_0xc89e('0x5'),_0xc89e('0x6')),'defaultValue':_0xc89e('0x4')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0xc89e('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xc89e('0x2')]}}; \ No newline at end of file +var _0xac4b=['nothing','lead','ENUM','contact_lead','sequelize','exports','STRING','contact'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0xac4b,0xb4));var _0xbac4=function(_0xf6a5cd,_0x4cf536){_0xf6a5cd=_0xf6a5cd-0x0;var _0x1dc12d=_0xac4b[_0xf6a5cd];return _0x1dc12d;};'use strict';var Sequelize=require(_0xbac4('0x0'));module[_0xbac4('0x1')]={'name':{'type':Sequelize[_0xbac4('0x2')]},'moduleCreate':{'type':Sequelize['ENUM']('lead',_0xbac4('0x3'),_0xbac4('0x4')),'defaultValue':_0xbac4('0x5')},'moduleSearch':{'type':Sequelize[_0xbac4('0x6')](_0xbac4('0x7'),'contact','lead'),'defaultValue':_0xbac4('0x7')},'description':{'type':Sequelize[_0xbac4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 78b0dd1..0c51291 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 _0x372e=['hasOwnProperty','sort','where','filters','pick','filter','VIRTUAL','merge','options','then','includeAll','include','ZohoConfiguration','params','fields','find','catch','create','body','destroy','getFields','findOne','ZohoField','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','length'];(function(_0x4cdb65,_0x1371d2){var _0x257cf0=function(_0x973a70){while(--_0x973a70){_0x4cdb65['push'](_0x4cdb65['shift']());}};_0x257cf0(++_0x1371d2);}(_0x372e,0xbd));var _0xe372=function(_0xa048d0,_0x4c95f4){_0xa048d0=_0xa048d0-0x0;var _0x24b90e=_0x372e[_0xa048d0];return _0x24b90e;};'use strict';var emlformat=require(_0xe372('0x0'));var rimraf=require(_0xe372('0x1'));var zipdir=require(_0xe372('0x2'));var jsonpatch=require(_0xe372('0x3'));var rp=require(_0xe372('0x4'));var moment=require('moment');var BPromise=require(_0xe372('0x5'));var Mustache=require(_0xe372('0x6'));var util=require(_0xe372('0x7'));var path=require(_0xe372('0x8'));var sox=require(_0xe372('0x9'));var csv=require('to-csv');var ejs=require(_0xe372('0xa'));var fs=require('fs');var fs_extra=require(_0xe372('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe372('0xc'));var jsforce=require(_0xe372('0xd'));var deskjs=require(_0xe372('0xe'));var toCsv=require(_0xe372('0xf'));var querystring=require(_0xe372('0x10'));var Papa=require(_0xe372('0x11'));var Redis=require(_0xe372('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe372('0x13'));var hardwareService=require(_0xe372('0x14'));var logger=require(_0xe372('0x15'))(_0xe372('0x16'));var utils=require(_0xe372('0x17'));var config=require(_0xe372('0x18'));var licenseUtil=require(_0xe372('0x19'));var db=require(_0xe372('0x1a'))['db'];function respondWithStatusCode(_0x37f375,_0x1258ab){_0x1258ab=_0x1258ab||0xcc;return function(_0x3aaef2){if(_0x3aaef2){return _0x37f375[_0xe372('0x1b')](_0x1258ab);}return _0x37f375[_0xe372('0x1c')](_0x1258ab)[_0xe372('0x1d')]();};}function respondWithResult(_0x2fae29,_0x23fa8f){_0x23fa8f=_0x23fa8f||0xc8;return function(_0xa6701f){if(_0xa6701f){return _0x2fae29[_0xe372('0x1c')](_0x23fa8f)['json'](_0xa6701f);}};}function respondWithFilteredResult(_0x5b7dc1,_0x23705d){return function(_0x5442d9){if(_0x5442d9){var _0x51de16=typeof _0x23705d['offset']===_0xe372('0x1e')&&typeof _0x23705d['limit']===_0xe372('0x1e');var _0x269770=_0x5442d9[_0xe372('0x1f')];var _0x2ad9dd=_0x51de16?0x0:_0x23705d[_0xe372('0x20')];var _0x34e4c2=_0x51de16?_0x5442d9[_0xe372('0x1f')]:_0x23705d['offset']+_0x23705d[_0xe372('0x21')];var _0x193488;if(_0x34e4c2>=_0x269770){_0x34e4c2=_0x269770;_0x193488=0xc8;}else{_0x193488=0xce;}_0x5b7dc1[_0xe372('0x1c')](_0x193488);return _0x5b7dc1['set'](_0xe372('0x22'),_0x2ad9dd+'-'+_0x34e4c2+'/'+_0x269770)[_0xe372('0x23')](_0x5442d9);}return null;};}function patchUpdates(_0x3ce397){return function(_0x31479c){try{jsonpatch[_0xe372('0x24')](_0x31479c,_0x3ce397,!![]);}catch(_0x4ed97f){return BPromise[_0xe372('0x25')](_0x4ed97f);}return _0x31479c[_0xe372('0x26')]();};}function saveUpdates(_0x5f445b,_0x4f719b){return function(_0x332796){if(_0x332796){return _0x332796[_0xe372('0x27')](_0x5f445b)['then'](function(_0x1ef9bd){return _0x1ef9bd;});}return null;};}function removeEntity(_0x584f98,_0x1a6ac8){return function(_0x5099a4){if(_0x5099a4){return _0x5099a4['destroy']()['then'](function(){_0x584f98[_0xe372('0x1c')](0xcc)[_0xe372('0x1d')]();});}};}function handleEntityNotFound(_0xd34592,_0x2f8bdc){return function(_0x414778){if(!_0x414778){_0xd34592['sendStatus'](0x194);}return _0x414778;};}function handleError(_0x5e64c5,_0x1bf5cf){_0x1bf5cf=_0x1bf5cf||0x1f4;return function(_0x592352){logger['error'](_0x592352[_0xe372('0x28')]);if(_0x592352[_0xe372('0x29')]){delete _0x592352['name'];}_0x5e64c5[_0xe372('0x1c')](_0x1bf5cf)[_0xe372('0x2a')](_0x592352);};}exports[_0xe372('0x2b')]=function(_0xef0bc1,_0x29e859){var _0xc1d79b={},_0x2002c4={},_0x2cc393={'count':0x0,'rows':[]};var _0x4de50e=_[_0xe372('0x2c')](db['ZohoConfiguration'][_0xe372('0x2d')],function(_0x1cb7ef){return{'name':_0x1cb7ef['fieldName'],'type':_0x1cb7ef[_0xe372('0x2e')][_0xe372('0x2f')]};});_0x2002c4[_0xe372('0x30')]=_['map'](_0x4de50e,_0xe372('0x29'));_0x2002c4[_0xe372('0x31')]=_[_0xe372('0x32')](_0xef0bc1[_0xe372('0x31')]);_0x2002c4['filters']=_[_0xe372('0x33')](_0x2002c4[_0xe372('0x30')],_0x2002c4[_0xe372('0x31')]);_0xc1d79b[_0xe372('0x34')]=_[_0xe372('0x33')](_0x2002c4['model'],qs['fields'](_0xef0bc1['query']['fields']));_0xc1d79b['attributes']=_0xc1d79b[_0xe372('0x34')][_0xe372('0x35')]?_0xc1d79b['attributes']:_0x2002c4[_0xe372('0x30')];if(!_0xef0bc1[_0xe372('0x31')][_0xe372('0x36')]('nolimit')){_0xc1d79b[_0xe372('0x21')]=qs[_0xe372('0x21')](_0xef0bc1['query'][_0xe372('0x21')]);_0xc1d79b[_0xe372('0x20')]=qs['offset'](_0xef0bc1['query'][_0xe372('0x20')]);}_0xc1d79b['order']=qs['sort'](_0xef0bc1[_0xe372('0x31')][_0xe372('0x37')]);_0xc1d79b[_0xe372('0x38')]=qs[_0xe372('0x39')](_[_0xe372('0x3a')](_0xef0bc1[_0xe372('0x31')],_0x2002c4[_0xe372('0x39')]),_0x4de50e);if(_0xef0bc1[_0xe372('0x31')][_0xe372('0x3b')]){_0xc1d79b[_0xe372('0x38')]=_['merge'](_0xc1d79b['where'],{'$or':_[_0xe372('0x2c')](_0x4de50e,function(_0xdbcbb9){if(_0xdbcbb9[_0xe372('0x2e')]!==_0xe372('0x3c')){var _0x1654a4={};_0x1654a4[_0xdbcbb9[_0xe372('0x29')]]={'$like':'%'+_0xef0bc1[_0xe372('0x31')]['filter']+'%'};return _0x1654a4;}})});}_0xc1d79b=_[_0xe372('0x3d')]({},_0xc1d79b,_0xef0bc1[_0xe372('0x3e')]);var _0x5d1eb3={'where':_0xc1d79b[_0xe372('0x38')]};return db['ZohoConfiguration'][_0xe372('0x1f')](_0x5d1eb3)[_0xe372('0x3f')](function(_0x2bc558){_0x2cc393['count']=_0x2bc558;if(_0xef0bc1[_0xe372('0x31')][_0xe372('0x40')]){_0xc1d79b[_0xe372('0x41')]=[{'all':!![]}];}return db[_0xe372('0x42')]['findAll'](_0xc1d79b);})[_0xe372('0x3f')](function(_0x22d7d1){_0x2cc393['rows']=_0x22d7d1;return _0x2cc393;})[_0xe372('0x3f')](respondWithFilteredResult(_0x29e859,_0xc1d79b))['catch'](handleError(_0x29e859,null));};exports['show']=function(_0x3a94aa,_0x1f18aa){var _0x221874={'raw':![],'where':{'id':_0x3a94aa[_0xe372('0x43')]['id']}},_0x44a6a8={};_0x44a6a8[_0xe372('0x30')]=_[_0xe372('0x32')](db[_0xe372('0x42')][_0xe372('0x2d')]);_0x44a6a8[_0xe372('0x31')]=_[_0xe372('0x32')](_0x3a94aa[_0xe372('0x31')]);_0x44a6a8[_0xe372('0x39')]=_['intersection'](_0x44a6a8[_0xe372('0x30')],_0x44a6a8[_0xe372('0x31')]);_0x221874[_0xe372('0x34')]=_['intersection'](_0x44a6a8[_0xe372('0x30')],qs[_0xe372('0x44')](_0x3a94aa[_0xe372('0x31')][_0xe372('0x44')]));_0x221874[_0xe372('0x34')]=_0x221874['attributes'][_0xe372('0x35')]?_0x221874['attributes']:_0x44a6a8[_0xe372('0x30')];if(_0x3a94aa[_0xe372('0x31')][_0xe372('0x40')]){_0x221874[_0xe372('0x41')]=[{'all':!![]}];}_0x221874=_[_0xe372('0x3d')]({},_0x221874,_0x3a94aa['options']);return db[_0xe372('0x42')][_0xe372('0x45')](_0x221874)[_0xe372('0x3f')](handleEntityNotFound(_0x1f18aa,null))[_0xe372('0x3f')](respondWithResult(_0x1f18aa,null))[_0xe372('0x46')](handleError(_0x1f18aa,null));};exports['create']=function(_0x4ab65c,_0x4027c4){return db[_0xe372('0x42')][_0xe372('0x47')](_0x4ab65c[_0xe372('0x48')],{})[_0xe372('0x3f')](respondWithResult(_0x4027c4,0xc9))[_0xe372('0x46')](handleError(_0x4027c4,null));};exports[_0xe372('0x27')]=function(_0x45bea4,_0x21ce46){if(_0x45bea4[_0xe372('0x48')]['id']){delete _0x45bea4[_0xe372('0x48')]['id'];}return db[_0xe372('0x42')][_0xe372('0x45')]({'where':{'id':_0x45bea4['params']['id']}})[_0xe372('0x3f')](handleEntityNotFound(_0x21ce46,null))[_0xe372('0x3f')](saveUpdates(_0x45bea4[_0xe372('0x48')],null))[_0xe372('0x3f')](respondWithResult(_0x21ce46,null))[_0xe372('0x46')](handleError(_0x21ce46,null));};exports[_0xe372('0x49')]=function(_0x475437,_0x55522c){return db['ZohoConfiguration'][_0xe372('0x45')]({'where':{'id':_0x475437[_0xe372('0x43')]['id']}})['then'](handleEntityNotFound(_0x55522c,null))['then'](removeEntity(_0x55522c,null))[_0xe372('0x46')](handleError(_0x55522c,null));};exports[_0xe372('0x4a')]=function(_0x46acdf,_0xc42eea,_0x12e219){var _0xee5019={};var _0x361157={};var _0x387174;var _0xfafa2f;return db[_0xe372('0x42')][_0xe372('0x4b')]({'where':{'id':_0x46acdf['params']['id']}})['then'](handleEntityNotFound(_0xc42eea,null))[_0xe372('0x3f')](function(_0x415fb3){if(_0x415fb3){_0x387174=_0x415fb3;_0x361157[_0xe372('0x30')]=_[_0xe372('0x32')](db[_0xe372('0x4c')][_0xe372('0x2d')]);_0x361157[_0xe372('0x31')]=_[_0xe372('0x32')](_0x46acdf['query']);_0x361157['filters']=_[_0xe372('0x33')](_0x361157[_0xe372('0x30')],_0x361157[_0xe372('0x31')]);_0xee5019[_0xe372('0x34')]=_[_0xe372('0x33')](_0x361157['model'],qs[_0xe372('0x44')](_0x46acdf['query'][_0xe372('0x44')]));_0xee5019[_0xe372('0x34')]=_0xee5019[_0xe372('0x34')][_0xe372('0x35')]?_0xee5019[_0xe372('0x34')]:_0x361157['model'];_0xee5019[_0xe372('0x4d')]=qs[_0xe372('0x37')](_0x46acdf['query'][_0xe372('0x37')]);_0xee5019[_0xe372('0x38')]=qs[_0xe372('0x39')](_[_0xe372('0x3a')](_0x46acdf[_0xe372('0x31')],_0x361157[_0xe372('0x39')]));if(_0x46acdf[_0xe372('0x31')][_0xe372('0x3b')]){_0xee5019[_0xe372('0x38')]=_['merge'](_0xee5019[_0xe372('0x38')],{'$or':_['map'](_0xee5019['attributes'],function(_0x3d9267){var _0x2fd920={};_0x2fd920[_0x3d9267]={'$like':'%'+_0x46acdf[_0xe372('0x31')][_0xe372('0x3b')]+'%'};return _0x2fd920;})});}_0xee5019=_[_0xe372('0x3d')]({},_0xee5019,_0x46acdf['options']);return _0x387174[_0xe372('0x4a')](_0xee5019);}})['then'](function(_0x3cb43d){if(_0x3cb43d){_0xfafa2f=_0x3cb43d[_0xe372('0x35')];if(!_0x46acdf['query'][_0xe372('0x36')](_0xe372('0x4e'))){_0xee5019[_0xe372('0x21')]=qs['limit'](_0x46acdf['query'][_0xe372('0x21')]);_0xee5019[_0xe372('0x20')]=qs['offset'](_0x46acdf[_0xe372('0x31')][_0xe372('0x20')]);}return _0x387174[_0xe372('0x4a')](_0xee5019);}})[_0xe372('0x3f')](function(_0x10e671){if(_0x10e671){return _0x10e671?{'count':_0xfafa2f,'rows':_0x10e671}:null;}})[_0xe372('0x3f')](respondWithResult(_0xc42eea,null))[_0xe372('0x46')](handleError(_0xc42eea,null));};exports[_0xe372('0x4f')]=function(_0xe7fa33,_0x47b4c4,_0x2268e4){var _0x42925f={};var _0x155e57={};var _0x4991e6;var _0x3700b6;return db[_0xe372('0x42')][_0xe372('0x4b')]({'where':{'id':_0xe7fa33['params']['id']}})['then'](handleEntityNotFound(_0x47b4c4,null))[_0xe372('0x3f')](function(_0x11b91e){if(_0x11b91e){_0x4991e6=_0x11b91e;_0x155e57[_0xe372('0x30')]=_[_0xe372('0x32')](db[_0xe372('0x4c')][_0xe372('0x2d')]);_0x155e57[_0xe372('0x31')]=_[_0xe372('0x32')](_0xe7fa33[_0xe372('0x31')]);_0x155e57['filters']=_[_0xe372('0x33')](_0x155e57[_0xe372('0x30')],_0x155e57[_0xe372('0x31')]);_0x42925f[_0xe372('0x34')]=_['intersection'](_0x155e57[_0xe372('0x30')],qs[_0xe372('0x44')](_0xe7fa33['query'][_0xe372('0x44')]));_0x42925f[_0xe372('0x34')]=_0x42925f[_0xe372('0x34')]['length']?_0x42925f[_0xe372('0x34')]:_0x155e57[_0xe372('0x30')];_0x42925f[_0xe372('0x4d')]=qs[_0xe372('0x37')](_0xe7fa33['query'][_0xe372('0x37')]);_0x42925f[_0xe372('0x38')]=qs[_0xe372('0x39')](_['pick'](_0xe7fa33['query'],_0x155e57[_0xe372('0x39')]));if(_0xe7fa33[_0xe372('0x31')][_0xe372('0x3b')]){_0x42925f[_0xe372('0x38')]=_['merge'](_0x42925f[_0xe372('0x38')],{'$or':_[_0xe372('0x2c')](_0x42925f[_0xe372('0x34')],function(_0x3769e6){var _0x5a56e3={};_0x5a56e3[_0x3769e6]={'$like':'%'+_0xe7fa33[_0xe372('0x31')]['filter']+'%'};return _0x5a56e3;})});}_0x42925f=_[_0xe372('0x3d')]({},_0x42925f,_0xe7fa33[_0xe372('0x3e')]);return _0x4991e6[_0xe372('0x4f')](_0x42925f);}})[_0xe372('0x3f')](function(_0x4df325){if(_0x4df325){_0x3700b6=_0x4df325[_0xe372('0x35')];if(!_0xe7fa33[_0xe372('0x31')]['hasOwnProperty'](_0xe372('0x4e'))){_0x42925f['limit']=qs[_0xe372('0x21')](_0xe7fa33[_0xe372('0x31')][_0xe372('0x21')]);_0x42925f[_0xe372('0x20')]=qs['offset'](_0xe7fa33[_0xe372('0x31')][_0xe372('0x20')]);}return _0x4991e6['getSubjects'](_0x42925f);}})['then'](function(_0x55cbc3){if(_0x55cbc3){return _0x55cbc3?{'count':_0x3700b6,'rows':_0x55cbc3}:null;}})[_0xe372('0x3f')](respondWithResult(_0x47b4c4,null))[_0xe372('0x46')](handleError(_0x47b4c4,null));};exports[_0xe372('0x50')]=function(_0x1e33d6,_0x2f1388,_0x1d9245){var _0x2075bd={};var _0x45d1db={};var _0x29085c;var _0x125c61;return db[_0xe372('0x42')]['findOne']({'where':{'id':_0x1e33d6[_0xe372('0x43')]['id']}})[_0xe372('0x3f')](handleEntityNotFound(_0x2f1388,null))[_0xe372('0x3f')](function(_0x5055de){if(_0x5055de){_0x29085c=_0x5055de;_0x45d1db[_0xe372('0x30')]=_[_0xe372('0x32')](db[_0xe372('0x4c')]['rawAttributes']);_0x45d1db[_0xe372('0x31')]=_[_0xe372('0x32')](_0x1e33d6[_0xe372('0x31')]);_0x45d1db[_0xe372('0x39')]=_['intersection'](_0x45d1db[_0xe372('0x30')],_0x45d1db[_0xe372('0x31')]);_0x2075bd[_0xe372('0x34')]=_[_0xe372('0x33')](_0x45d1db['model'],qs[_0xe372('0x44')](_0x1e33d6[_0xe372('0x31')]['fields']));_0x2075bd[_0xe372('0x34')]=_0x2075bd[_0xe372('0x34')][_0xe372('0x35')]?_0x2075bd['attributes']:_0x45d1db[_0xe372('0x30')];_0x2075bd['order']=qs[_0xe372('0x37')](_0x1e33d6[_0xe372('0x31')]['sort']);_0x2075bd[_0xe372('0x38')]=qs[_0xe372('0x39')](_[_0xe372('0x3a')](_0x1e33d6[_0xe372('0x31')],_0x45d1db[_0xe372('0x39')]));if(_0x1e33d6[_0xe372('0x31')][_0xe372('0x3b')]){_0x2075bd[_0xe372('0x38')]=_['merge'](_0x2075bd[_0xe372('0x38')],{'$or':_[_0xe372('0x2c')](_0x2075bd[_0xe372('0x34')],function(_0x5473d5){var _0x5afdaa={};_0x5afdaa[_0x5473d5]={'$like':'%'+_0x1e33d6[_0xe372('0x31')][_0xe372('0x3b')]+'%'};return _0x5afdaa;})});}_0x2075bd=_[_0xe372('0x3d')]({},_0x2075bd,_0x1e33d6[_0xe372('0x3e')]);return _0x29085c[_0xe372('0x50')](_0x2075bd);}})[_0xe372('0x3f')](function(_0x295350){if(_0x295350){_0x125c61=_0x295350[_0xe372('0x35')];if(!_0x1e33d6[_0xe372('0x31')][_0xe372('0x36')]('nolimit')){_0x2075bd[_0xe372('0x21')]=qs[_0xe372('0x21')](_0x1e33d6[_0xe372('0x31')][_0xe372('0x21')]);_0x2075bd[_0xe372('0x20')]=qs['offset'](_0x1e33d6[_0xe372('0x31')][_0xe372('0x20')]);}return _0x29085c[_0xe372('0x50')](_0x2075bd);}})[_0xe372('0x3f')](function(_0x28dbff){if(_0x28dbff){return _0x28dbff?{'count':_0x125c61,'rows':_0x28dbff}:null;}})[_0xe372('0x3f')](respondWithResult(_0x2f1388,null))['catch'](handleError(_0x2f1388,null));}; \ No newline at end of file +var _0x33c4=['filters','pick','getFields','findOne','getDescriptions','ZohoField','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','ZohoConfiguration','type','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','rawAttributes'];(function(_0x5d580b,_0x21b6bb){var _0x3e1998=function(_0x53f549){while(--_0x53f549){_0x5d580b['push'](_0x5d580b['shift']());}};_0x3e1998(++_0x21b6bb);}(_0x33c4,0xf0));var _0x433c=function(_0x22818b,_0x3c8c44){_0x22818b=_0x22818b-0x0;var _0x5e9a47=_0x33c4[_0x22818b];return _0x5e9a47;};'use strict';var emlformat=require(_0x433c('0x0'));var rimraf=require(_0x433c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x433c('0x2'));var rp=require(_0x433c('0x3'));var moment=require(_0x433c('0x4'));var BPromise=require(_0x433c('0x5'));var Mustache=require(_0x433c('0x6'));var util=require('util');var path=require(_0x433c('0x7'));var sox=require(_0x433c('0x8'));var csv=require(_0x433c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x433c('0xa'));var squel=require(_0x433c('0xb'));var crypto=require(_0x433c('0xc'));var jsforce=require(_0x433c('0xd'));var deskjs=require(_0x433c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x433c('0xf'));var Papa=require(_0x433c('0x10'));var Redis=require(_0x433c('0x11'));var authService=require(_0x433c('0x12'));var qs=require(_0x433c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x433c('0x14'))(_0x433c('0x15'));var utils=require(_0x433c('0x16'));var config=require(_0x433c('0x17'));var licenseUtil=require(_0x433c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19e90a,_0x40d8d7){_0x40d8d7=_0x40d8d7||0xcc;return function(_0x48fbcc){if(_0x48fbcc){return _0x19e90a[_0x433c('0x19')](_0x40d8d7);}return _0x19e90a[_0x433c('0x1a')](_0x40d8d7)[_0x433c('0x1b')]();};}function respondWithResult(_0x4bee6a,_0x59f85d){_0x59f85d=_0x59f85d||0xc8;return function(_0x517e9e){if(_0x517e9e){return _0x4bee6a['status'](_0x59f85d)['json'](_0x517e9e);}};}function respondWithFilteredResult(_0x4b2723,_0x5f4930){return function(_0x441753){if(_0x441753){var _0x515af0=typeof _0x5f4930['offset']===_0x433c('0x1c')&&typeof _0x5f4930[_0x433c('0x1d')]===_0x433c('0x1c');var _0x2cd8f2=_0x441753[_0x433c('0x1e')];var _0x285cfb=_0x515af0?0x0:_0x5f4930[_0x433c('0x1f')];var _0x184e52=_0x515af0?_0x441753[_0x433c('0x1e')]:_0x5f4930[_0x433c('0x1f')]+_0x5f4930[_0x433c('0x1d')];var _0x3f2174;if(_0x184e52>=_0x2cd8f2){_0x184e52=_0x2cd8f2;_0x3f2174=0xc8;}else{_0x3f2174=0xce;}_0x4b2723[_0x433c('0x1a')](_0x3f2174);return _0x4b2723[_0x433c('0x20')](_0x433c('0x21'),_0x285cfb+'-'+_0x184e52+'/'+_0x2cd8f2)['json'](_0x441753);}return null;};}function patchUpdates(_0x11e25d){return function(_0x1f0ff4){try{jsonpatch[_0x433c('0x22')](_0x1f0ff4,_0x11e25d,!![]);}catch(_0x5d1f23){return BPromise['reject'](_0x5d1f23);}return _0x1f0ff4[_0x433c('0x23')]();};}function saveUpdates(_0x354e1e,_0x1440aa){return function(_0x59d535){if(_0x59d535){return _0x59d535[_0x433c('0x24')](_0x354e1e)[_0x433c('0x25')](function(_0x32861d){return _0x32861d;});}return null;};}function removeEntity(_0x5ccdf1,_0x56fae7){return function(_0x5cd358){if(_0x5cd358){return _0x5cd358[_0x433c('0x26')]()[_0x433c('0x25')](function(){_0x5ccdf1['status'](0xcc)[_0x433c('0x1b')]();});}};}function handleEntityNotFound(_0x5a5026,_0x8e6ebc){return function(_0x1ad338){if(!_0x1ad338){_0x5a5026[_0x433c('0x19')](0x194);}return _0x1ad338;};}function handleError(_0x51ec44,_0x122515){_0x122515=_0x122515||0x1f4;return function(_0x2cc4b7){logger['error'](_0x2cc4b7[_0x433c('0x27')]);if(_0x2cc4b7[_0x433c('0x28')]){delete _0x2cc4b7[_0x433c('0x28')];}_0x51ec44[_0x433c('0x1a')](_0x122515)[_0x433c('0x29')](_0x2cc4b7);};}exports[_0x433c('0x2a')]=function(_0x26ee69,_0x1381e7){var _0x255566={},_0x628865={},_0x1ef859={'count':0x0,'rows':[]};var _0x47783c=_['map'](db[_0x433c('0x2b')]['rawAttributes'],function(_0x379389){return{'name':_0x379389['fieldName'],'type':_0x379389[_0x433c('0x2c')]['key']};});_0x628865[_0x433c('0x2d')]=_[_0x433c('0x2e')](_0x47783c,_0x433c('0x28'));_0x628865['query']=_[_0x433c('0x2f')](_0x26ee69['query']);_0x628865['filters']=_[_0x433c('0x30')](_0x628865['model'],_0x628865[_0x433c('0x31')]);_0x255566[_0x433c('0x32')]=_[_0x433c('0x30')](_0x628865[_0x433c('0x2d')],qs['fields'](_0x26ee69[_0x433c('0x31')][_0x433c('0x33')]));_0x255566[_0x433c('0x32')]=_0x255566['attributes']['length']?_0x255566[_0x433c('0x32')]:_0x628865['model'];if(!_0x26ee69['query'][_0x433c('0x34')](_0x433c('0x35'))){_0x255566[_0x433c('0x1d')]=qs[_0x433c('0x1d')](_0x26ee69[_0x433c('0x31')]['limit']);_0x255566['offset']=qs[_0x433c('0x1f')](_0x26ee69['query'][_0x433c('0x1f')]);}_0x255566[_0x433c('0x36')]=qs[_0x433c('0x37')](_0x26ee69[_0x433c('0x31')][_0x433c('0x37')]);_0x255566[_0x433c('0x38')]=qs['filters'](_['pick'](_0x26ee69[_0x433c('0x31')],_0x628865['filters']),_0x47783c);if(_0x26ee69[_0x433c('0x31')][_0x433c('0x39')]){_0x255566[_0x433c('0x38')]=_[_0x433c('0x3a')](_0x255566[_0x433c('0x38')],{'$or':_[_0x433c('0x2e')](_0x47783c,function(_0x3d4301){if(_0x3d4301['type']!==_0x433c('0x3b')){var _0x59550c={};_0x59550c[_0x3d4301['name']]={'$like':'%'+_0x26ee69[_0x433c('0x31')][_0x433c('0x39')]+'%'};return _0x59550c;}})});}_0x255566=_['merge']({},_0x255566,_0x26ee69[_0x433c('0x3c')]);var _0x10c0c4={'where':_0x255566[_0x433c('0x38')]};return db[_0x433c('0x2b')]['count'](_0x10c0c4)[_0x433c('0x25')](function(_0x23b0cb){_0x1ef859[_0x433c('0x1e')]=_0x23b0cb;if(_0x26ee69[_0x433c('0x31')][_0x433c('0x3d')]){_0x255566[_0x433c('0x3e')]=[{'all':!![]}];}return db[_0x433c('0x2b')][_0x433c('0x3f')](_0x255566);})['then'](function(_0x263f6f){_0x1ef859[_0x433c('0x40')]=_0x263f6f;return _0x1ef859;})[_0x433c('0x25')](respondWithFilteredResult(_0x1381e7,_0x255566))[_0x433c('0x41')](handleError(_0x1381e7,null));};exports['show']=function(_0xb155f0,_0x184486){var _0x568bc6={'raw':![],'where':{'id':_0xb155f0[_0x433c('0x42')]['id']}},_0x5d5ed8={};_0x5d5ed8[_0x433c('0x2d')]=_[_0x433c('0x2f')](db[_0x433c('0x2b')]['rawAttributes']);_0x5d5ed8[_0x433c('0x31')]=_[_0x433c('0x2f')](_0xb155f0[_0x433c('0x31')]);_0x5d5ed8['filters']=_[_0x433c('0x30')](_0x5d5ed8['model'],_0x5d5ed8[_0x433c('0x31')]);_0x568bc6['attributes']=_[_0x433c('0x30')](_0x5d5ed8['model'],qs[_0x433c('0x33')](_0xb155f0[_0x433c('0x31')][_0x433c('0x33')]));_0x568bc6[_0x433c('0x32')]=_0x568bc6[_0x433c('0x32')][_0x433c('0x43')]?_0x568bc6[_0x433c('0x32')]:_0x5d5ed8['model'];if(_0xb155f0['query'][_0x433c('0x3d')]){_0x568bc6['include']=[{'all':!![]}];}_0x568bc6=_[_0x433c('0x3a')]({},_0x568bc6,_0xb155f0[_0x433c('0x3c')]);return db[_0x433c('0x2b')][_0x433c('0x44')](_0x568bc6)[_0x433c('0x25')](handleEntityNotFound(_0x184486,null))['then'](respondWithResult(_0x184486,null))[_0x433c('0x41')](handleError(_0x184486,null));};exports[_0x433c('0x45')]=function(_0x4feae4,_0x3199c7){return db[_0x433c('0x2b')][_0x433c('0x45')](_0x4feae4[_0x433c('0x46')],{})[_0x433c('0x25')](respondWithResult(_0x3199c7,0xc9))['catch'](handleError(_0x3199c7,null));};exports[_0x433c('0x24')]=function(_0x1d87e2,_0x3f8436){if(_0x1d87e2[_0x433c('0x46')]['id']){delete _0x1d87e2[_0x433c('0x46')]['id'];}return db[_0x433c('0x2b')]['find']({'where':{'id':_0x1d87e2[_0x433c('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f8436,null))[_0x433c('0x25')](saveUpdates(_0x1d87e2[_0x433c('0x46')],null))[_0x433c('0x25')](respondWithResult(_0x3f8436,null))[_0x433c('0x41')](handleError(_0x3f8436,null));};exports[_0x433c('0x26')]=function(_0x21f8b7,_0x3dc0c8){return db['ZohoConfiguration'][_0x433c('0x44')]({'where':{'id':_0x21f8b7['params']['id']}})['then'](handleEntityNotFound(_0x3dc0c8,null))[_0x433c('0x25')](removeEntity(_0x3dc0c8,null))['catch'](handleError(_0x3dc0c8,null));};exports['getFields']=function(_0x4e483d,_0x2889db,_0x125955){var _0x10e969={};var _0x368b9c={};var _0x34271b;var _0x5578b3;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x4e483d[_0x433c('0x42')]['id']}})[_0x433c('0x25')](handleEntityNotFound(_0x2889db,null))['then'](function(_0x453916){if(_0x453916){_0x34271b=_0x453916;_0x368b9c[_0x433c('0x2d')]=_[_0x433c('0x2f')](db['ZohoField'][_0x433c('0x47')]);_0x368b9c[_0x433c('0x31')]=_[_0x433c('0x2f')](_0x4e483d['query']);_0x368b9c[_0x433c('0x48')]=_[_0x433c('0x30')](_0x368b9c[_0x433c('0x2d')],_0x368b9c[_0x433c('0x31')]);_0x10e969[_0x433c('0x32')]=_[_0x433c('0x30')](_0x368b9c[_0x433c('0x2d')],qs['fields'](_0x4e483d['query']['fields']));_0x10e969['attributes']=_0x10e969[_0x433c('0x32')]['length']?_0x10e969[_0x433c('0x32')]:_0x368b9c[_0x433c('0x2d')];_0x10e969[_0x433c('0x36')]=qs[_0x433c('0x37')](_0x4e483d['query']['sort']);_0x10e969[_0x433c('0x38')]=qs['filters'](_[_0x433c('0x49')](_0x4e483d[_0x433c('0x31')],_0x368b9c[_0x433c('0x48')]));if(_0x4e483d[_0x433c('0x31')][_0x433c('0x39')]){_0x10e969['where']=_[_0x433c('0x3a')](_0x10e969[_0x433c('0x38')],{'$or':_[_0x433c('0x2e')](_0x10e969[_0x433c('0x32')],function(_0x21bd35){var _0x1c1901={};_0x1c1901[_0x21bd35]={'$like':'%'+_0x4e483d[_0x433c('0x31')]['filter']+'%'};return _0x1c1901;})});}_0x10e969=_[_0x433c('0x3a')]({},_0x10e969,_0x4e483d[_0x433c('0x3c')]);return _0x34271b[_0x433c('0x4a')](_0x10e969);}})[_0x433c('0x25')](function(_0x238f51){if(_0x238f51){_0x5578b3=_0x238f51[_0x433c('0x43')];if(!_0x4e483d[_0x433c('0x31')][_0x433c('0x34')](_0x433c('0x35'))){_0x10e969[_0x433c('0x1d')]=qs[_0x433c('0x1d')](_0x4e483d[_0x433c('0x31')][_0x433c('0x1d')]);_0x10e969['offset']=qs[_0x433c('0x1f')](_0x4e483d[_0x433c('0x31')][_0x433c('0x1f')]);}return _0x34271b[_0x433c('0x4a')](_0x10e969);}})[_0x433c('0x25')](function(_0x3f6d2c){if(_0x3f6d2c){return _0x3f6d2c?{'count':_0x5578b3,'rows':_0x3f6d2c}:null;}})[_0x433c('0x25')](respondWithResult(_0x2889db,null))['catch'](handleError(_0x2889db,null));};exports['getSubjects']=function(_0x45e7fe,_0x11af4f,_0x21a247){var _0x578aba={};var _0x53fdee={};var _0x5ad35a;var _0x2b6a6b;return db[_0x433c('0x2b')][_0x433c('0x4b')]({'where':{'id':_0x45e7fe[_0x433c('0x42')]['id']}})[_0x433c('0x25')](handleEntityNotFound(_0x11af4f,null))[_0x433c('0x25')](function(_0xaaed7d){if(_0xaaed7d){_0x5ad35a=_0xaaed7d;_0x53fdee[_0x433c('0x2d')]=_[_0x433c('0x2f')](db['ZohoField'][_0x433c('0x47')]);_0x53fdee['query']=_[_0x433c('0x2f')](_0x45e7fe[_0x433c('0x31')]);_0x53fdee['filters']=_['intersection'](_0x53fdee[_0x433c('0x2d')],_0x53fdee['query']);_0x578aba[_0x433c('0x32')]=_[_0x433c('0x30')](_0x53fdee[_0x433c('0x2d')],qs[_0x433c('0x33')](_0x45e7fe[_0x433c('0x31')]['fields']));_0x578aba[_0x433c('0x32')]=_0x578aba[_0x433c('0x32')]['length']?_0x578aba['attributes']:_0x53fdee[_0x433c('0x2d')];_0x578aba[_0x433c('0x36')]=qs['sort'](_0x45e7fe[_0x433c('0x31')][_0x433c('0x37')]);_0x578aba['where']=qs[_0x433c('0x48')](_['pick'](_0x45e7fe[_0x433c('0x31')],_0x53fdee[_0x433c('0x48')]));if(_0x45e7fe[_0x433c('0x31')][_0x433c('0x39')]){_0x578aba[_0x433c('0x38')]=_['merge'](_0x578aba[_0x433c('0x38')],{'$or':_['map'](_0x578aba[_0x433c('0x32')],function(_0x5ef6de){var _0x1306ff={};_0x1306ff[_0x5ef6de]={'$like':'%'+_0x45e7fe['query'][_0x433c('0x39')]+'%'};return _0x1306ff;})});}_0x578aba=_[_0x433c('0x3a')]({},_0x578aba,_0x45e7fe['options']);return _0x5ad35a['getSubjects'](_0x578aba);}})['then'](function(_0x923880){if(_0x923880){_0x2b6a6b=_0x923880['length'];if(!_0x45e7fe[_0x433c('0x31')]['hasOwnProperty'](_0x433c('0x35'))){_0x578aba[_0x433c('0x1d')]=qs[_0x433c('0x1d')](_0x45e7fe['query']['limit']);_0x578aba[_0x433c('0x1f')]=qs['offset'](_0x45e7fe['query']['offset']);}return _0x5ad35a['getSubjects'](_0x578aba);}})[_0x433c('0x25')](function(_0x1f9fde){if(_0x1f9fde){return _0x1f9fde?{'count':_0x2b6a6b,'rows':_0x1f9fde}:null;}})[_0x433c('0x25')](respondWithResult(_0x11af4f,null))[_0x433c('0x41')](handleError(_0x11af4f,null));};exports[_0x433c('0x4c')]=function(_0xdb8340,_0x3ac7e9,_0x7a74c0){var _0xe6a1d6={};var _0xe6b32={};var _0x5afadb;var _0x14681c;return db['ZohoConfiguration'][_0x433c('0x4b')]({'where':{'id':_0xdb8340[_0x433c('0x42')]['id']}})[_0x433c('0x25')](handleEntityNotFound(_0x3ac7e9,null))['then'](function(_0xc69f11){if(_0xc69f11){_0x5afadb=_0xc69f11;_0xe6b32[_0x433c('0x2d')]=_[_0x433c('0x2f')](db[_0x433c('0x4d')][_0x433c('0x47')]);_0xe6b32[_0x433c('0x31')]=_['keys'](_0xdb8340[_0x433c('0x31')]);_0xe6b32['filters']=_[_0x433c('0x30')](_0xe6b32[_0x433c('0x2d')],_0xe6b32['query']);_0xe6a1d6[_0x433c('0x32')]=_['intersection'](_0xe6b32[_0x433c('0x2d')],qs[_0x433c('0x33')](_0xdb8340['query'][_0x433c('0x33')]));_0xe6a1d6[_0x433c('0x32')]=_0xe6a1d6[_0x433c('0x32')][_0x433c('0x43')]?_0xe6a1d6[_0x433c('0x32')]:_0xe6b32[_0x433c('0x2d')];_0xe6a1d6['order']=qs['sort'](_0xdb8340[_0x433c('0x31')][_0x433c('0x37')]);_0xe6a1d6['where']=qs[_0x433c('0x48')](_['pick'](_0xdb8340[_0x433c('0x31')],_0xe6b32['filters']));if(_0xdb8340[_0x433c('0x31')][_0x433c('0x39')]){_0xe6a1d6[_0x433c('0x38')]=_[_0x433c('0x3a')](_0xe6a1d6[_0x433c('0x38')],{'$or':_['map'](_0xe6a1d6[_0x433c('0x32')],function(_0x168f0d){var _0x56e13d={};_0x56e13d[_0x168f0d]={'$like':'%'+_0xdb8340[_0x433c('0x31')][_0x433c('0x39')]+'%'};return _0x56e13d;})});}_0xe6a1d6=_[_0x433c('0x3a')]({},_0xe6a1d6,_0xdb8340['options']);return _0x5afadb['getDescriptions'](_0xe6a1d6);}})['then'](function(_0x48b8b5){if(_0x48b8b5){_0x14681c=_0x48b8b5['length'];if(!_0xdb8340[_0x433c('0x31')][_0x433c('0x34')](_0x433c('0x35'))){_0xe6a1d6[_0x433c('0x1d')]=qs[_0x433c('0x1d')](_0xdb8340[_0x433c('0x31')][_0x433c('0x1d')]);_0xe6a1d6[_0x433c('0x1f')]=qs[_0x433c('0x1f')](_0xdb8340[_0x433c('0x31')][_0x433c('0x1f')]);}return _0x5afadb[_0x433c('0x4c')](_0xe6a1d6);}})[_0x433c('0x25')](function(_0x3346c5){if(_0x3346c5){return _0x3346c5?{'count':_0x14681c,'rows':_0x3346c5}:null;}})[_0x433c('0x25')](respondWithResult(_0x3ac7e9,null))[_0x433c('0x41')](handleError(_0x3ac7e9,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 94f39b7..31863fe 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 _0x457d=['int_zoho_configurations','lodash','../../config/logger','moment','bluebird','request-promise','exports','define'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x457d,0xf1));var _0xd457=function(_0x2064c8,_0x168039){_0x2064c8=_0x2064c8-0x0;var _0x23af73=_0x457d[_0x2064c8];return _0x23af73;};'use strict';var _=require(_0xd457('0x0'));var util=require('util');var logger=require(_0xd457('0x1'))('api');var moment=require(_0xd457('0x2'));var BPromise=require(_0xd457('0x3'));var rp=require(_0xd457('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0xd457('0x5')]=function(_0x370ecb,_0x5b96b0){return _0x370ecb[_0xd457('0x6')]('ZohoConfiguration',attributes,{'tableName':_0xd457('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3537=['define','int_zoho_configurations','util','api','moment','bluebird','request-promise','exports'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x3537,0x1b2));var _0x7353=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x3537[_0x12f688];return _0x59c3de;};'use strict';var _=require('lodash');var util=require(_0x7353('0x0'));var logger=require('../../config/logger')(_0x7353('0x1'));var moment=require(_0x7353('0x2'));var BPromise=require(_0x7353('0x3'));var rp=require(_0x7353('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x7353('0x5')]=function(_0x5b52d7,_0x498b9a){return _0x5b52d7[_0x7353('0x6')]('ZohoConfiguration',attributes,{'tableName':_0x7353('0x7'),'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 210a86c..3a2ad6c 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 _0xf9b3=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0xf9b3,0x87));var _0x3f9b=function(_0x1021e0,_0x205bfa){_0x1021e0=_0x1021e0-0x0;var _0x506fa8=_0xf9b3[_0x1021e0];return _0x506fa8;};'use strict';var _=require(_0x3f9b('0x0'));var util=require(_0x3f9b('0x1'));var moment=require(_0x3f9b('0x2'));var BPromise=require(_0x3f9b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f9b('0x4'));var db=require(_0x3f9b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f9b('0x6'))(_0x3f9b('0x7'));var config=require(_0x3f9b('0x8'));var jayson=require(_0x3f9b('0x9'));var client=jayson['client'][_0x3f9b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ee034,_0x38b3fb,_0x75f4d4){return new BPromise(function(_0xe64514,_0x3a307f){return client[_0x3f9b('0xb')](_0x4ee034,_0x75f4d4)['then'](function(_0x5e5cfe){logger[_0x3f9b('0xc')](_0x3f9b('0xd'),_0x38b3fb,_0x3f9b('0xe'));logger[_0x3f9b('0xf')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x38b3fb,_0x3f9b('0xe'),JSON[_0x3f9b('0x10')](_0x5e5cfe));if(_0x5e5cfe[_0x3f9b('0x11')]){if(_0x5e5cfe['error']['code']===0x1f4){logger[_0x3f9b('0x11')](_0x3f9b('0xd'),_0x38b3fb,_0x5e5cfe[_0x3f9b('0x11')][_0x3f9b('0x12')]);return _0x3a307f(_0x5e5cfe[_0x3f9b('0x11')][_0x3f9b('0x12')]);}logger[_0x3f9b('0x11')](_0x3f9b('0xd'),_0x38b3fb,_0x5e5cfe[_0x3f9b('0x11')][_0x3f9b('0x12')]);return _0xe64514(_0x5e5cfe[_0x3f9b('0x11')][_0x3f9b('0x12')]);}else{logger[_0x3f9b('0xc')](_0x3f9b('0xd'),_0x38b3fb,_0x3f9b('0xe'));_0xe64514(_0x5e5cfe[_0x3f9b('0x13')][_0x3f9b('0x12')]);}})[_0x3f9b('0x14')](function(_0x3bf857){logger[_0x3f9b('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x38b3fb,_0x3bf857);_0x3a307f(_0x3bf857);});});} \ No newline at end of file +var _0x1b04=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','bluebird','randomstring'];(function(_0x480e5a,_0x405b5b){var _0x27b9a6=function(_0x38e763){while(--_0x38e763){_0x480e5a['push'](_0x480e5a['shift']());}};_0x27b9a6(++_0x405b5b);}(_0x1b04,0x11d));var _0x41b0=function(_0x193fc6,_0x5e0f10){_0x193fc6=_0x193fc6-0x0;var _0x81628f=_0x1b04[_0x193fc6];return _0x81628f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x41b0('0x0'));var BPromise=require(_0x41b0('0x1'));var rs=require(_0x41b0('0x2'));var fs=require('fs');var Redis=require(_0x41b0('0x3'));var db=require(_0x41b0('0x4'))['db'];var utils=require(_0x41b0('0x5'));var logger=require(_0x41b0('0x6'))(_0x41b0('0x7'));var config=require(_0x41b0('0x8'));var jayson=require(_0x41b0('0x9'));var client=jayson[_0x41b0('0xa')][_0x41b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12a69d,_0x3da426,_0x3c0700){return new BPromise(function(_0x5181ba,_0x3dc9a4){return client[_0x41b0('0xc')](_0x12a69d,_0x3c0700)[_0x41b0('0xd')](function(_0x13caf1){logger[_0x41b0('0xe')](_0x41b0('0xf'),_0x3da426,'request\x20sent');logger[_0x41b0('0x10')](_0x41b0('0x11'),_0x3da426,_0x41b0('0x12'),JSON[_0x41b0('0x13')](_0x13caf1));if(_0x13caf1[_0x41b0('0x14')]){if(_0x13caf1[_0x41b0('0x14')][_0x41b0('0x15')]===0x1f4){logger[_0x41b0('0x14')](_0x41b0('0xf'),_0x3da426,_0x13caf1[_0x41b0('0x14')]['message']);return _0x3dc9a4(_0x13caf1[_0x41b0('0x14')][_0x41b0('0x16')]);}logger[_0x41b0('0x14')](_0x41b0('0xf'),_0x3da426,_0x13caf1[_0x41b0('0x14')]['message']);return _0x5181ba(_0x13caf1[_0x41b0('0x14')][_0x41b0('0x16')]);}else{logger['info'](_0x41b0('0xf'),_0x3da426,_0x41b0('0x12'));_0x5181ba(_0x13caf1['result']['message']);}})[_0x41b0('0x17')](function(_0x548b69){logger[_0x41b0('0x14')](_0x41b0('0xf'),_0x3da426,_0x548b69);_0x3dc9a4(_0x548b69);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 3dc504f..a5e3d09 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 _0x9ba9=['delete','destroy','util','path','express','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','isAuthenticated','index','get','/:id','show','create','put','update'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x9ba9,0xb2));var _0x99ba=function(_0x3a40cd,_0x3ad255){_0x3a40cd=_0x3a40cd-0x0;var _0x25332a=_0x9ba9[_0x3a40cd];return _0x25332a;};'use strict';var multer=require('multer');var util=require(_0x99ba('0x0'));var path=require(_0x99ba('0x1'));var timeout=require('connect-timeout');var express=require(_0x99ba('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x99ba('0x3'));var interaction=require(_0x99ba('0x4'));var config=require('../../config/environment');var controller=require(_0x99ba('0x5'));router['get']('/',auth[_0x99ba('0x6')](),controller[_0x99ba('0x7')]);router[_0x99ba('0x8')](_0x99ba('0x9'),auth[_0x99ba('0x6')](),controller[_0x99ba('0xa')]);router['post']('/',auth[_0x99ba('0x6')](),controller[_0x99ba('0xb')]);router[_0x99ba('0xc')](_0x99ba('0x9'),auth[_0x99ba('0x6')](),controller[_0x99ba('0xd')]);router[_0x99ba('0xe')](_0x99ba('0x9'),auth[_0x99ba('0x6')](),controller[_0x99ba('0xf')]);module['exports']=router; \ No newline at end of file +var _0xbdfb=['../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra'];(function(_0x5612ec,_0x56d030){var _0x244e78=function(_0x3a07b6){while(--_0x3a07b6){_0x5612ec['push'](_0x5612ec['shift']());}};_0x244e78(++_0x56d030);}(_0xbdfb,0xb6));var _0xbbdf=function(_0x3ba57e,_0x2e6810){_0x3ba57e=_0x3ba57e-0x0;var _0x5d95cf=_0xbdfb[_0x3ba57e];return _0x5d95cf;};'use strict';var multer=require('multer');var util=require(_0xbbdf('0x0'));var path=require(_0xbbdf('0x1'));var timeout=require('connect-timeout');var express=require(_0xbbdf('0x2'));var router=express[_0xbbdf('0x3')]();var fs_extra=require(_0xbbdf('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbbdf('0x5'));var controller=require(_0xbbdf('0x6'));router[_0xbbdf('0x7')]('/',auth[_0xbbdf('0x8')](),controller[_0xbbdf('0x9')]);router[_0xbbdf('0x7')](_0xbbdf('0xa'),auth[_0xbbdf('0x8')](),controller['show']);router['post']('/',auth[_0xbbdf('0x8')](),controller[_0xbbdf('0xb')]);router[_0xbbdf('0xc')]('/:id',auth[_0xbbdf('0x8')](),controller[_0xbbdf('0xd')]);router[_0xbbdf('0xe')]('/:id',auth[_0xbbdf('0x8')](),controller[_0xbbdf('0xf')]);module[_0xbbdf('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 7199e43..ec1cf1e 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 _0x3291=['keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x26c9c2,_0x281275){var _0x2c90e8=function(_0x40f359){while(--_0x40f359){_0x26c9c2['push'](_0x26c9c2['shift']());}};_0x2c90e8(++_0x281275);}(_0x3291,0xa5));var _0x1329=function(_0x3a1703,_0x456b67){_0x3a1703=_0x3a1703-0x0;var _0x5a49cf=_0x3291[_0x3a1703];return _0x5a49cf;};'use strict';var Sequelize=require(_0x1329('0x0'));module[_0x1329('0x1')]={'type':{'type':Sequelize[_0x1329('0x2')]('string',_0x1329('0x3'),_0x1329('0x4'),_0x1329('0x5'),_0x1329('0x6')),'defaultValue':_0x1329('0x7')},'content':{'type':Sequelize[_0x1329('0x8')]},'key':{'type':Sequelize[_0x1329('0x8')]},'keyType':{'type':Sequelize[_0x1329('0x2')](_0x1329('0x7'),_0x1329('0x3'),_0x1329('0x4'))},'keyContent':{'type':Sequelize[_0x1329('0x8')]},'idField':{'type':Sequelize[_0x1329('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1329('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1329('0x8')]}}; \ No newline at end of file +var _0x0505=['string','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','STRING'];(function(_0x339a04,_0x15f35c){var _0x144941=function(_0x1c6d7c){while(--_0x1c6d7c){_0x339a04['push'](_0x339a04['shift']());}};_0x144941(++_0x15f35c);}(_0x0505,0xa2));var _0x5050=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x0505[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0x5050('0x0'));module[_0x5050('0x1')]={'type':{'type':Sequelize[_0x5050('0x2')]('string',_0x5050('0x3'),_0x5050('0x4'),_0x5050('0x5'),_0x5050('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5050('0x7')]},'key':{'type':Sequelize[_0x5050('0x7')]},'keyType':{'type':Sequelize[_0x5050('0x2')](_0x5050('0x8'),_0x5050('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5050('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5050('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5050('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 77ff550..63d3b2f 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 _0xb579=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set','json','reject','save','update','then','sendStatus','stack','name','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body'];(function(_0x42e935,_0x414934){var _0x43685b=function(_0x2a7414){while(--_0x2a7414){_0x42e935['push'](_0x42e935['shift']());}};_0x43685b(++_0x414934);}(_0xb579,0x169));var _0x9b57=function(_0x54b6ae,_0x568da8){_0x54b6ae=_0x54b6ae-0x0;var _0x17012d=_0xb579[_0x54b6ae];return _0x17012d;};'use strict';var emlformat=require(_0x9b57('0x0'));var rimraf=require(_0x9b57('0x1'));var zipdir=require(_0x9b57('0x2'));var jsonpatch=require(_0x9b57('0x3'));var rp=require(_0x9b57('0x4'));var moment=require(_0x9b57('0x5'));var BPromise=require(_0x9b57('0x6'));var Mustache=require(_0x9b57('0x7'));var util=require(_0x9b57('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x9b57('0x9'));var ejs=require(_0x9b57('0xa'));var fs=require('fs');var fs_extra=require(_0x9b57('0xb'));var _=require(_0x9b57('0xc'));var squel=require(_0x9b57('0xd'));var crypto=require(_0x9b57('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b57('0x9'));var querystring=require(_0x9b57('0xf'));var Papa=require(_0x9b57('0x10'));var Redis=require(_0x9b57('0x11'));var authService=require(_0x9b57('0x12'));var qs=require(_0x9b57('0x13'));var as=require(_0x9b57('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b57('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x9b57('0x16'));var licenseUtil=require(_0x9b57('0x17'));var db=require(_0x9b57('0x18'))['db'];function respondWithStatusCode(_0x5a0b0a,_0x4f9b69){_0x4f9b69=_0x4f9b69||0xcc;return function(_0x3c28cd){if(_0x3c28cd){return _0x5a0b0a['sendStatus'](_0x4f9b69);}return _0x5a0b0a['status'](_0x4f9b69)[_0x9b57('0x19')]();};}function respondWithResult(_0x3e47dc,_0x2dd41a){_0x2dd41a=_0x2dd41a||0xc8;return function(_0xe5b0ad){if(_0xe5b0ad){return _0x3e47dc[_0x9b57('0x1a')](_0x2dd41a)['json'](_0xe5b0ad);}};}function respondWithFilteredResult(_0x3b6ea8,_0x3fc251){return function(_0x1c8f68){if(_0x1c8f68){var _0x29a521=typeof _0x3fc251[_0x9b57('0x1b')]===_0x9b57('0x1c')&&typeof _0x3fc251['limit']===_0x9b57('0x1c');var _0x4632b8=_0x1c8f68['count'];var _0x4afd53=_0x29a521?0x0:_0x3fc251[_0x9b57('0x1b')];var _0xcfbd77=_0x29a521?_0x1c8f68[_0x9b57('0x1d')]:_0x3fc251['offset']+_0x3fc251[_0x9b57('0x1e')];var _0xadc6db;if(_0xcfbd77>=_0x4632b8){_0xcfbd77=_0x4632b8;_0xadc6db=0xc8;}else{_0xadc6db=0xce;}_0x3b6ea8[_0x9b57('0x1a')](_0xadc6db);return _0x3b6ea8[_0x9b57('0x1f')]('Content-Range',_0x4afd53+'-'+_0xcfbd77+'/'+_0x4632b8)[_0x9b57('0x20')](_0x1c8f68);}return null;};}function patchUpdates(_0x4c074d){return function(_0x5a57c6){try{jsonpatch['apply'](_0x5a57c6,_0x4c074d,!![]);}catch(_0x7453eb){return BPromise[_0x9b57('0x21')](_0x7453eb);}return _0x5a57c6[_0x9b57('0x22')]();};}function saveUpdates(_0xbd6341,_0x31831b){return function(_0x4d34ec){if(_0x4d34ec){return _0x4d34ec[_0x9b57('0x23')](_0xbd6341)[_0x9b57('0x24')](function(_0xbce53){return _0xbce53;});}return null;};}function removeEntity(_0x34ccae,_0x751945){return function(_0x218bf9){if(_0x218bf9){return _0x218bf9['destroy']()[_0x9b57('0x24')](function(){_0x34ccae['status'](0xcc)[_0x9b57('0x19')]();});}};}function handleEntityNotFound(_0xcf09c4,_0x59ac82){return function(_0x9b8efe){if(!_0x9b8efe){_0xcf09c4[_0x9b57('0x25')](0x194);}return _0x9b8efe;};}function handleError(_0x3eacfd,_0x4c33ec){_0x4c33ec=_0x4c33ec||0x1f4;return function(_0x5cb0a6){logger['error'](_0x5cb0a6[_0x9b57('0x26')]);if(_0x5cb0a6[_0x9b57('0x27')]){delete _0x5cb0a6[_0x9b57('0x27')];}_0x3eacfd[_0x9b57('0x1a')](_0x4c33ec)['send'](_0x5cb0a6);};}exports[_0x9b57('0x28')]=function(_0x330b42,_0x29a52f){var _0xa5964e={},_0x34f3ee={},_0x30034c={'count':0x0,'rows':[]};var _0x593c55=_[_0x9b57('0x29')](db[_0x9b57('0x2a')][_0x9b57('0x2b')],function(_0x2b2341){return{'name':_0x2b2341[_0x9b57('0x2c')],'type':_0x2b2341[_0x9b57('0x2d')][_0x9b57('0x2e')]};});_0x34f3ee[_0x9b57('0x2f')]=_[_0x9b57('0x29')](_0x593c55,'name');_0x34f3ee[_0x9b57('0x30')]=_[_0x9b57('0x31')](_0x330b42[_0x9b57('0x30')]);_0x34f3ee[_0x9b57('0x32')]=_['intersection'](_0x34f3ee[_0x9b57('0x2f')],_0x34f3ee['query']);_0xa5964e[_0x9b57('0x33')]=_[_0x9b57('0x34')](_0x34f3ee[_0x9b57('0x2f')],qs['fields'](_0x330b42[_0x9b57('0x30')][_0x9b57('0x35')]));_0xa5964e[_0x9b57('0x33')]=_0xa5964e['attributes']['length']?_0xa5964e['attributes']:_0x34f3ee[_0x9b57('0x2f')];if(!_0x330b42['query'][_0x9b57('0x36')]('nolimit')){_0xa5964e[_0x9b57('0x1e')]=qs[_0x9b57('0x1e')](_0x330b42[_0x9b57('0x30')][_0x9b57('0x1e')]);_0xa5964e['offset']=qs['offset'](_0x330b42['query']['offset']);}_0xa5964e['order']=qs[_0x9b57('0x37')](_0x330b42[_0x9b57('0x30')][_0x9b57('0x37')]);_0xa5964e[_0x9b57('0x38')]=qs[_0x9b57('0x32')](_['pick'](_0x330b42[_0x9b57('0x30')],_0x34f3ee[_0x9b57('0x32')]),_0x593c55);if(_0x330b42[_0x9b57('0x30')][_0x9b57('0x39')]){_0xa5964e[_0x9b57('0x38')]=_[_0x9b57('0x3a')](_0xa5964e[_0x9b57('0x38')],{'$or':_[_0x9b57('0x29')](_0x593c55,function(_0x11ea36){if(_0x11ea36[_0x9b57('0x2d')]!==_0x9b57('0x3b')){var _0x3c208b={};_0x3c208b[_0x11ea36['name']]={'$like':'%'+_0x330b42[_0x9b57('0x30')][_0x9b57('0x39')]+'%'};return _0x3c208b;}})});}_0xa5964e=_[_0x9b57('0x3a')]({},_0xa5964e,_0x330b42[_0x9b57('0x3c')]);var _0x528c05={'where':_0xa5964e['where']};return db['ZohoField']['count'](_0x528c05)['then'](function(_0x58b202){_0x30034c[_0x9b57('0x1d')]=_0x58b202;if(_0x330b42['query'][_0x9b57('0x3d')]){_0xa5964e[_0x9b57('0x3e')]=[{'all':!![]}];}return db[_0x9b57('0x2a')][_0x9b57('0x3f')](_0xa5964e);})['then'](function(_0x3f74fd){_0x30034c[_0x9b57('0x40')]=_0x3f74fd;return _0x30034c;})[_0x9b57('0x24')](respondWithFilteredResult(_0x29a52f,_0xa5964e))[_0x9b57('0x41')](handleError(_0x29a52f,null));};exports[_0x9b57('0x42')]=function(_0x310731,_0x4844f1){var _0x591240={'raw':!![],'where':{'id':_0x310731[_0x9b57('0x43')]['id']}},_0x242044={};_0x242044[_0x9b57('0x2f')]=_['keys'](db[_0x9b57('0x2a')][_0x9b57('0x2b')]);_0x242044[_0x9b57('0x30')]=_['keys'](_0x310731[_0x9b57('0x30')]);_0x242044[_0x9b57('0x32')]=_[_0x9b57('0x34')](_0x242044['model'],_0x242044[_0x9b57('0x30')]);_0x591240['attributes']=_['intersection'](_0x242044[_0x9b57('0x2f')],qs['fields'](_0x310731[_0x9b57('0x30')][_0x9b57('0x35')]));_0x591240[_0x9b57('0x33')]=_0x591240[_0x9b57('0x33')][_0x9b57('0x44')]?_0x591240['attributes']:_0x242044[_0x9b57('0x2f')];if(_0x310731[_0x9b57('0x30')][_0x9b57('0x3d')]){_0x591240[_0x9b57('0x3e')]=[{'all':!![]}];}_0x591240=_[_0x9b57('0x3a')]({},_0x591240,_0x310731[_0x9b57('0x3c')]);return db[_0x9b57('0x2a')]['find'](_0x591240)[_0x9b57('0x24')](handleEntityNotFound(_0x4844f1,null))[_0x9b57('0x24')](respondWithResult(_0x4844f1,null))['catch'](handleError(_0x4844f1,null));};exports[_0x9b57('0x45')]=function(_0x501bdb,_0x3e1997){return db['ZohoField'][_0x9b57('0x45')](_0x501bdb['body'],{})[_0x9b57('0x24')](respondWithResult(_0x3e1997,0xc9))[_0x9b57('0x41')](handleError(_0x3e1997,null));};exports[_0x9b57('0x23')]=function(_0x24a6ac,_0x5a0e3f){if(_0x24a6ac[_0x9b57('0x46')]['id']){delete _0x24a6ac[_0x9b57('0x46')]['id'];}return db['ZohoField'][_0x9b57('0x47')]({'where':{'id':_0x24a6ac[_0x9b57('0x43')]['id']}})[_0x9b57('0x24')](handleEntityNotFound(_0x5a0e3f,null))[_0x9b57('0x24')](saveUpdates(_0x24a6ac['body'],null))['then'](respondWithResult(_0x5a0e3f,null))['catch'](handleError(_0x5a0e3f,null));};exports['destroy']=function(_0x28fa45,_0x1af6d6){return db['ZohoField'][_0x9b57('0x47')]({'where':{'id':_0x28fa45[_0x9b57('0x43')]['id']}})[_0x9b57('0x24')](handleEntityNotFound(_0x1af6d6,null))[_0x9b57('0x24')](removeEntity(_0x1af6d6,null))[_0x9b57('0x41')](handleError(_0x1af6d6,null));}; \ No newline at end of file +var _0xb286=['json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','find','catch','create','update','body','params','eml-format','rimraf','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status'];(function(_0x2a1e2d,_0x195473){var _0x32b8cc=function(_0x57582d){while(--_0x57582d){_0x2a1e2d['push'](_0x2a1e2d['shift']());}};_0x32b8cc(++_0x195473);}(_0xb286,0x151));var _0x6b28=function(_0x2930a1,_0x305c69){_0x2930a1=_0x2930a1-0x0;var _0x5c7fa2=_0xb286[_0x2930a1];return _0x5c7fa2;};'use strict';var emlformat=require(_0x6b28('0x0'));var rimraf=require(_0x6b28('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6b28('0x2'));var path=require(_0x6b28('0x3'));var sox=require(_0x6b28('0x4'));var csv=require(_0x6b28('0x5'));var ejs=require(_0x6b28('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b28('0x7'));var squel=require(_0x6b28('0x8'));var crypto=require(_0x6b28('0x9'));var jsforce=require(_0x6b28('0xa'));var deskjs=require(_0x6b28('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6b28('0xc'));var Papa=require(_0x6b28('0xd'));var Redis=require(_0x6b28('0xe'));var authService=require(_0x6b28('0xf'));var qs=require(_0x6b28('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b28('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6b28('0x12'));var config=require(_0x6b28('0x13'));var licenseUtil=require(_0x6b28('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6dbb1e,_0x4d5f64){_0x4d5f64=_0x4d5f64||0xcc;return function(_0x18ab61){if(_0x18ab61){return _0x6dbb1e[_0x6b28('0x15')](_0x4d5f64);}return _0x6dbb1e[_0x6b28('0x16')](_0x4d5f64)['end']();};}function respondWithResult(_0x25fdae,_0x5b13d8){_0x5b13d8=_0x5b13d8||0xc8;return function(_0x108dfe){if(_0x108dfe){return _0x25fdae[_0x6b28('0x16')](_0x5b13d8)[_0x6b28('0x17')](_0x108dfe);}};}function respondWithFilteredResult(_0x4962ca,_0x4ddec1){return function(_0x139751){if(_0x139751){var _0x108a08=typeof _0x4ddec1['offset']===_0x6b28('0x18')&&typeof _0x4ddec1['limit']==='undefined';var _0x14a47b=_0x139751[_0x6b28('0x19')];var _0x499082=_0x108a08?0x0:_0x4ddec1[_0x6b28('0x1a')];var _0x4b8a08=_0x108a08?_0x139751[_0x6b28('0x19')]:_0x4ddec1[_0x6b28('0x1a')]+_0x4ddec1[_0x6b28('0x1b')];var _0x5f40b3;if(_0x4b8a08>=_0x14a47b){_0x4b8a08=_0x14a47b;_0x5f40b3=0xc8;}else{_0x5f40b3=0xce;}_0x4962ca['status'](_0x5f40b3);return _0x4962ca[_0x6b28('0x1c')](_0x6b28('0x1d'),_0x499082+'-'+_0x4b8a08+'/'+_0x14a47b)[_0x6b28('0x17')](_0x139751);}return null;};}function patchUpdates(_0x37e2f5){return function(_0x77b579){try{jsonpatch[_0x6b28('0x1e')](_0x77b579,_0x37e2f5,!![]);}catch(_0x2b825c){return BPromise['reject'](_0x2b825c);}return _0x77b579[_0x6b28('0x1f')]();};}function saveUpdates(_0x3ddd28,_0xa6d667){return function(_0x1bed78){if(_0x1bed78){return _0x1bed78['update'](_0x3ddd28)[_0x6b28('0x20')](function(_0x289221){return _0x289221;});}return null;};}function removeEntity(_0x2a8a5d,_0x319945){return function(_0x32707a){if(_0x32707a){return _0x32707a[_0x6b28('0x21')]()['then'](function(){_0x2a8a5d['status'](0xcc)[_0x6b28('0x22')]();});}};}function handleEntityNotFound(_0x17191f,_0xcb3730){return function(_0x2975a2){if(!_0x2975a2){_0x17191f[_0x6b28('0x15')](0x194);}return _0x2975a2;};}function handleError(_0x289d15,_0xda5a5){_0xda5a5=_0xda5a5||0x1f4;return function(_0x335d68){logger['error'](_0x335d68[_0x6b28('0x23')]);if(_0x335d68[_0x6b28('0x24')]){delete _0x335d68['name'];}_0x289d15[_0x6b28('0x16')](_0xda5a5)[_0x6b28('0x25')](_0x335d68);};}exports[_0x6b28('0x26')]=function(_0xe4808e,_0x53ed3a){var _0x2a18ee={},_0x57ee8c={},_0x6e1b6f={'count':0x0,'rows':[]};var _0x59245f=_[_0x6b28('0x27')](db[_0x6b28('0x28')][_0x6b28('0x29')],function(_0x58de00){return{'name':_0x58de00[_0x6b28('0x2a')],'type':_0x58de00[_0x6b28('0x2b')][_0x6b28('0x2c')]};});_0x57ee8c[_0x6b28('0x2d')]=_['map'](_0x59245f,_0x6b28('0x24'));_0x57ee8c[_0x6b28('0x2e')]=_[_0x6b28('0x2f')](_0xe4808e[_0x6b28('0x2e')]);_0x57ee8c[_0x6b28('0x30')]=_[_0x6b28('0x31')](_0x57ee8c[_0x6b28('0x2d')],_0x57ee8c[_0x6b28('0x2e')]);_0x2a18ee[_0x6b28('0x32')]=_[_0x6b28('0x31')](_0x57ee8c['model'],qs[_0x6b28('0x33')](_0xe4808e[_0x6b28('0x2e')][_0x6b28('0x33')]));_0x2a18ee[_0x6b28('0x32')]=_0x2a18ee[_0x6b28('0x32')][_0x6b28('0x34')]?_0x2a18ee[_0x6b28('0x32')]:_0x57ee8c[_0x6b28('0x2d')];if(!_0xe4808e[_0x6b28('0x2e')][_0x6b28('0x35')](_0x6b28('0x36'))){_0x2a18ee[_0x6b28('0x1b')]=qs[_0x6b28('0x1b')](_0xe4808e[_0x6b28('0x2e')][_0x6b28('0x1b')]);_0x2a18ee[_0x6b28('0x1a')]=qs['offset'](_0xe4808e[_0x6b28('0x2e')][_0x6b28('0x1a')]);}_0x2a18ee[_0x6b28('0x37')]=qs['sort'](_0xe4808e['query'][_0x6b28('0x38')]);_0x2a18ee[_0x6b28('0x39')]=qs[_0x6b28('0x30')](_[_0x6b28('0x3a')](_0xe4808e[_0x6b28('0x2e')],_0x57ee8c[_0x6b28('0x30')]),_0x59245f);if(_0xe4808e['query'][_0x6b28('0x3b')]){_0x2a18ee[_0x6b28('0x39')]=_['merge'](_0x2a18ee[_0x6b28('0x39')],{'$or':_[_0x6b28('0x27')](_0x59245f,function(_0x1ef70f){if(_0x1ef70f[_0x6b28('0x2b')]!=='VIRTUAL'){var _0x2c2d9a={};_0x2c2d9a[_0x1ef70f[_0x6b28('0x24')]]={'$like':'%'+_0xe4808e[_0x6b28('0x2e')]['filter']+'%'};return _0x2c2d9a;}})});}_0x2a18ee=_[_0x6b28('0x3c')]({},_0x2a18ee,_0xe4808e['options']);var _0x48b90a={'where':_0x2a18ee['where']};return db[_0x6b28('0x28')][_0x6b28('0x19')](_0x48b90a)[_0x6b28('0x20')](function(_0x48ba59){_0x6e1b6f[_0x6b28('0x19')]=_0x48ba59;if(_0xe4808e[_0x6b28('0x2e')][_0x6b28('0x3d')]){_0x2a18ee[_0x6b28('0x3e')]=[{'all':!![]}];}return db['ZohoField'][_0x6b28('0x3f')](_0x2a18ee);})[_0x6b28('0x20')](function(_0x38bac1){_0x6e1b6f[_0x6b28('0x40')]=_0x38bac1;return _0x6e1b6f;})[_0x6b28('0x20')](respondWithFilteredResult(_0x53ed3a,_0x2a18ee))['catch'](handleError(_0x53ed3a,null));};exports[_0x6b28('0x41')]=function(_0x4b2851,_0x2f4dd8){var _0x1b1ba9={'raw':!![],'where':{'id':_0x4b2851['params']['id']}},_0x59315b={};_0x59315b[_0x6b28('0x2d')]=_[_0x6b28('0x2f')](db[_0x6b28('0x28')][_0x6b28('0x29')]);_0x59315b[_0x6b28('0x2e')]=_[_0x6b28('0x2f')](_0x4b2851[_0x6b28('0x2e')]);_0x59315b['filters']=_[_0x6b28('0x31')](_0x59315b['model'],_0x59315b[_0x6b28('0x2e')]);_0x1b1ba9['attributes']=_[_0x6b28('0x31')](_0x59315b['model'],qs[_0x6b28('0x33')](_0x4b2851[_0x6b28('0x2e')][_0x6b28('0x33')]));_0x1b1ba9[_0x6b28('0x32')]=_0x1b1ba9[_0x6b28('0x32')]['length']?_0x1b1ba9[_0x6b28('0x32')]:_0x59315b['model'];if(_0x4b2851['query']['includeAll']){_0x1b1ba9[_0x6b28('0x3e')]=[{'all':!![]}];}_0x1b1ba9=_[_0x6b28('0x3c')]({},_0x1b1ba9,_0x4b2851['options']);return db[_0x6b28('0x28')][_0x6b28('0x42')](_0x1b1ba9)[_0x6b28('0x20')](handleEntityNotFound(_0x2f4dd8,null))['then'](respondWithResult(_0x2f4dd8,null))[_0x6b28('0x43')](handleError(_0x2f4dd8,null));};exports[_0x6b28('0x44')]=function(_0x22b33d,_0x5e1fb6){return db[_0x6b28('0x28')][_0x6b28('0x44')](_0x22b33d['body'],{})[_0x6b28('0x20')](respondWithResult(_0x5e1fb6,0xc9))[_0x6b28('0x43')](handleError(_0x5e1fb6,null));};exports[_0x6b28('0x45')]=function(_0x20c4c3,_0x1ca0a1){if(_0x20c4c3['body']['id']){delete _0x20c4c3[_0x6b28('0x46')]['id'];}return db[_0x6b28('0x28')]['find']({'where':{'id':_0x20c4c3[_0x6b28('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ca0a1,null))[_0x6b28('0x20')](saveUpdates(_0x20c4c3[_0x6b28('0x46')],null))[_0x6b28('0x20')](respondWithResult(_0x1ca0a1,null))[_0x6b28('0x43')](handleError(_0x1ca0a1,null));};exports[_0x6b28('0x21')]=function(_0x36c45a,_0x20cfaf){return db[_0x6b28('0x28')]['find']({'where':{'id':_0x36c45a[_0x6b28('0x47')]['id']}})[_0x6b28('0x20')](handleEntityNotFound(_0x20cfaf,null))[_0x6b28('0x20')](removeEntity(_0x20cfaf,null))[_0x6b28('0x43')](handleError(_0x20cfaf,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b64a274..c17aa0e 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 _0x7046=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','ZohoField','idField'];(function(_0x3becfe,_0x560b41){var _0x4ac303=function(_0xd74dc9){while(--_0xd74dc9){_0x3becfe['push'](_0x3becfe['shift']());}};_0x4ac303(++_0x560b41);}(_0x7046,0x144));var _0x6704=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7046[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x6704('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2272=['define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','exports'];(function(_0x259c94,_0x4723f6){var _0x5c251b=function(_0x557cfc){while(--_0x557cfc){_0x259c94['push'](_0x259c94['shift']());}};_0x5c251b(++_0x4723f6);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var logger=require(_0x2227('0x2'))(_0x2227('0x3'));var moment=require(_0x2227('0x4'));var BPromise=require('bluebird');var rp=require(_0x2227('0x5'));var fs=require('fs');var path=require(_0x2227('0x6'));var rimraf=require(_0x2227('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x2227('0x8')]=function(_0x3b8661,_0xb33647){return _0x3b8661[_0x2227('0x9')](_0x2227('0xa'),attributes,{'tableName':_0x2227('0xb'),'paranoid':![],'indexes':[{'name':_0x2227('0xc'),'fields':[_0x2227('0xd'),_0x2227('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index de1f79f..5935e3b 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 _0xe646=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xe646,0x68));var _0x6e64=function(_0x456ad2,_0x524e60){_0x456ad2=_0x456ad2-0x0;var _0x5a67cd=_0xe646[_0x456ad2];return _0x5a67cd;};'use strict';var _=require(_0x6e64('0x0'));var util=require(_0x6e64('0x1'));var moment=require(_0x6e64('0x2'));var BPromise=require(_0x6e64('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e64('0x4'));var db=require(_0x6e64('0x5'))['db'];var utils=require(_0x6e64('0x6'));var logger=require('../../config/logger')(_0x6e64('0x7'));var config=require(_0x6e64('0x8'));var jayson=require(_0x6e64('0x9'));var client=jayson['client'][_0x6e64('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x245c44,_0x27c187,_0x15e319){return new BPromise(function(_0x3c0da4,_0x55f474){return client['request'](_0x245c44,_0x15e319)['then'](function(_0x2fc843){logger[_0x6e64('0xb')](_0x6e64('0xc'),_0x27c187,_0x6e64('0xd'));logger[_0x6e64('0xe')](_0x6e64('0xf'),_0x27c187,_0x6e64('0xd'),JSON[_0x6e64('0x10')](_0x2fc843));if(_0x2fc843[_0x6e64('0x11')]){if(_0x2fc843['error']['code']===0x1f4){logger['error'](_0x6e64('0xc'),_0x27c187,_0x2fc843['error'][_0x6e64('0x12')]);return _0x55f474(_0x2fc843['error'][_0x6e64('0x12')]);}logger[_0x6e64('0x11')](_0x6e64('0xc'),_0x27c187,_0x2fc843['error'][_0x6e64('0x12')]);return _0x3c0da4(_0x2fc843[_0x6e64('0x11')][_0x6e64('0x12')]);}else{logger[_0x6e64('0xb')]('ZohoField,\x20%s,\x20%s',_0x27c187,_0x6e64('0xd'));_0x3c0da4(_0x2fc843[_0x6e64('0x13')][_0x6e64('0x12')]);}})[_0x6e64('0x14')](function(_0x943ca9){logger[_0x6e64('0x11')]('ZohoField,\x20%s,\x20%s',_0x27c187,_0x943ca9);_0x55f474(_0x943ca9);});});} \ No newline at end of file +var _0x5519=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x2952f8,_0x4e1a08){var _0x4871b0=function(_0x3103b4){while(--_0x3103b4){_0x2952f8['push'](_0x2952f8['shift']());}};_0x4871b0(++_0x4e1a08);}(_0x5519,0x1c9));var _0x9551=function(_0xba4220,_0x5217a7){_0xba4220=_0xba4220-0x0;var _0x4cdb9d=_0x5519[_0xba4220];return _0x4cdb9d;};'use strict';var _=require(_0x9551('0x0'));var util=require(_0x9551('0x1'));var moment=require('moment');var BPromise=require(_0x9551('0x2'));var rs=require(_0x9551('0x3'));var fs=require('fs');var Redis=require(_0x9551('0x4'));var db=require(_0x9551('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9551('0x6'));var config=require(_0x9551('0x7'));var jayson=require(_0x9551('0x8'));var client=jayson[_0x9551('0x9')][_0x9551('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1fd329,_0x2221f8,_0x240c26){return new BPromise(function(_0x282e70,_0x54496c){return client[_0x9551('0xb')](_0x1fd329,_0x240c26)['then'](function(_0x25cd4e){logger[_0x9551('0xc')](_0x9551('0xd'),_0x2221f8,_0x9551('0xe'));logger[_0x9551('0xf')](_0x9551('0x10'),_0x2221f8,_0x9551('0xe'),JSON[_0x9551('0x11')](_0x25cd4e));if(_0x25cd4e['error']){if(_0x25cd4e[_0x9551('0x12')]['code']===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x2221f8,_0x25cd4e[_0x9551('0x12')][_0x9551('0x13')]);return _0x54496c(_0x25cd4e[_0x9551('0x12')][_0x9551('0x13')]);}logger[_0x9551('0x12')]('ZohoField,\x20%s,\x20%s',_0x2221f8,_0x25cd4e[_0x9551('0x12')][_0x9551('0x13')]);return _0x282e70(_0x25cd4e[_0x9551('0x12')][_0x9551('0x13')]);}else{logger[_0x9551('0xc')](_0x9551('0xd'),_0x2221f8,_0x9551('0xe'));_0x282e70(_0x25cd4e[_0x9551('0x14')]['message']);}})[_0x9551('0x15')](function(_0x524b2c){logger[_0x9551('0x12')]('ZohoField,\x20%s,\x20%s',_0x2221f8,_0x524b2c);_0x54496c(_0x524b2c);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index ef9250f..36436a1 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x59037e,_0x20a047){var _0x4478d1=function(_0x471e5e){while(--_0x471e5e){_0x59037e['push'](_0x59037e['shift']());}};_0x4478d1(++_0x20a047);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x437b02,_0x34b630){var _0xf8c681=function(_0x28f83e){while(--_0x28f83e){_0x437b02['push'](_0x437b02['shift']());}};_0xf8c681(++_0x34b630);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 75ac0c0..1ea90b9 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 _0x4a24=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0x4cb066,_0x3d9464){var _0x1763d7=function(_0x55c2e0){while(--_0x55c2e0){_0x4cb066['push'](_0x4cb066['shift']());}};_0x1763d7(++_0x3d9464);}(_0x4a24,0xa9));var _0x44a2=function(_0xb3b452,_0x582e8e){_0xb3b452=_0xb3b452-0x0;var _0x238983=_0x4a24[_0xb3b452];return _0x238983;};'use strict';var Sequelize=require(_0x44a2('0x0'));module[_0x44a2('0x1')]={'name':{'type':Sequelize[_0x44a2('0x2')],'allowNull':![],'unique':_0x44a2('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x44a2('0x3')},'main':{'type':Sequelize[_0x44a2('0x2')],'defaultValue':_0x44a2('0x4')},'filename':{'type':Sequelize[_0x44a2('0x2')]},'path':{'type':Sequelize[_0x44a2('0x2')]},'type':{'type':Sequelize[_0x44a2('0x2')]},'size':{'type':Sequelize[_0x44a2('0x5')]},'active':{'type':Sequelize[_0x44a2('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x44a2('0x2')]},'logo':{'type':Sequelize[_0x44a2('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x44a2('0x7')},'description':{'type':Sequelize[_0x44a2('0x2')]},'title':{'type':Sequelize[_0x44a2('0x2')]},'remoteUri':{'type':Sequelize[_0x44a2('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xebed=['state','exports','STRING','unique_name_and_version','app.js','BOOLEAN'];(function(_0x2794d2,_0x263225){var _0x8c13e2=function(_0x2c1e18){while(--_0x2c1e18){_0x2794d2['push'](_0x2794d2['shift']());}};_0x8c13e2(++_0x263225);}(_0xebed,0x1a5));var _0xdebe=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0xebed[_0x3e69ae];return _0x3d7f42;};'use strict';var Sequelize=require('sequelize');module[_0xdebe('0x0')]={'name':{'type':Sequelize[_0xdebe('0x1')],'allowNull':![],'unique':_0xdebe('0x2')},'version':{'type':Sequelize[_0xdebe('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xdebe('0x1')],'defaultValue':_0xdebe('0x3')},'filename':{'type':Sequelize[_0xdebe('0x1')]},'path':{'type':Sequelize[_0xdebe('0x1')]},'type':{'type':Sequelize[_0xdebe('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xdebe('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xdebe('0x1')]},'state':{'type':Sequelize[_0xdebe('0x1')],'unique':_0xdebe('0x5')},'description':{'type':Sequelize[_0xdebe('0x1')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xdebe('0x1')]},'link':{'type':Sequelize[_0xdebe('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 80c8edb..e0ec837 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 _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','Integration','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','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'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x5f2f,0x73));var _0xf5f2=function(_0x50e5c9,_0xb955b4){_0x50e5c9=_0x50e5c9-0x0;var _0x1543a8=_0x5f2f[_0x50e5c9];return _0x1543a8;};'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')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file +var _0x71ab=['query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','Integration','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','destroy','error','stack','name','send','index','map','type','key'];(function(_0x27a5bb,_0x3f4cfb){var _0x2e17ea=function(_0x22912d){while(--_0x22912d){_0x27a5bb['push'](_0x27a5bb['shift']());}};_0x2e17ea(++_0x3f4cfb);}(_0x71ab,0x64));var _0xb71a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x71ab[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb71a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb71a('0x1'));var rp=require('request-promise');var moment=require(_0xb71a('0x2'));var BPromise=require(_0xb71a('0x3'));var Mustache=require(_0xb71a('0x4'));var util=require(_0xb71a('0x5'));var path=require(_0xb71a('0x6'));var sox=require(_0xb71a('0x7'));var csv=require(_0xb71a('0x8'));var ejs=require(_0xb71a('0x9'));var fs=require('fs');var fs_extra=require(_0xb71a('0xa'));var _=require(_0xb71a('0xb'));var squel=require(_0xb71a('0xc'));var crypto=require(_0xb71a('0xd'));var jsforce=require(_0xb71a('0xe'));var deskjs=require(_0xb71a('0xf'));var toCsv=require(_0xb71a('0x8'));var querystring=require(_0xb71a('0x10'));var Papa=require(_0xb71a('0x11'));var Redis=require(_0xb71a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb71a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb71a('0x14'));var logger=require(_0xb71a('0x15'))(_0xb71a('0x16'));var utils=require('../../config/utils');var config=require(_0xb71a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb71a('0x18'))['db'];function respondWithStatusCode(_0x50030d,_0x50b43b){_0x50b43b=_0x50b43b||0xcc;return function(_0x3346a5){if(_0x3346a5){return _0x50030d[_0xb71a('0x19')](_0x50b43b);}return _0x50030d[_0xb71a('0x1a')](_0x50b43b)[_0xb71a('0x1b')]();};}function respondWithResult(_0x483d77,_0x47ee48){_0x47ee48=_0x47ee48||0xc8;return function(_0x5364e3){if(_0x5364e3){return _0x483d77[_0xb71a('0x1a')](_0x47ee48)[_0xb71a('0x1c')](_0x5364e3);}};}function respondWithFilteredResult(_0x15252a,_0x42fc55){return function(_0x3cd0f0){if(_0x3cd0f0){var _0x1e9363=typeof _0x42fc55[_0xb71a('0x1d')]===_0xb71a('0x1e')&&typeof _0x42fc55[_0xb71a('0x1f')]==='undefined';var _0x1ca65e=_0x3cd0f0[_0xb71a('0x20')];var _0x374c8c=_0x1e9363?0x0:_0x42fc55[_0xb71a('0x1d')];var _0x2bdb61=_0x1e9363?_0x3cd0f0[_0xb71a('0x20')]:_0x42fc55[_0xb71a('0x1d')]+_0x42fc55[_0xb71a('0x1f')];var _0x20bdfe;if(_0x2bdb61>=_0x1ca65e){_0x2bdb61=_0x1ca65e;_0x20bdfe=0xc8;}else{_0x20bdfe=0xce;}_0x15252a[_0xb71a('0x1a')](_0x20bdfe);return _0x15252a[_0xb71a('0x21')]('Content-Range',_0x374c8c+'-'+_0x2bdb61+'/'+_0x1ca65e)['json'](_0x3cd0f0);}return null;};}function patchUpdates(_0x1358f2){return function(_0x578fe4){try{jsonpatch['apply'](_0x578fe4,_0x1358f2,!![]);}catch(_0x4d8871){return BPromise[_0xb71a('0x22')](_0x4d8871);}return _0x578fe4['save']();};}function saveUpdates(_0x76d6dc,_0x4227c7){return function(_0x3ac77b){if(_0x3ac77b){return _0x3ac77b[_0xb71a('0x23')](_0x76d6dc)[_0xb71a('0x24')](function(_0x14b2a1){return _0x14b2a1;});}return null;};}function removeEntity(_0x2f4fac,_0x14aac7){return function(_0x5f3f19){if(_0x5f3f19){return _0x5f3f19[_0xb71a('0x25')]()[_0xb71a('0x24')](function(){_0x2f4fac[_0xb71a('0x1a')](0xcc)[_0xb71a('0x1b')]();});}};}function handleEntityNotFound(_0x3401f7,_0x1a010d){return function(_0x20ed75){if(!_0x20ed75){_0x3401f7[_0xb71a('0x19')](0x194);}return _0x20ed75;};}function handleError(_0x31085b,_0x2a847a){_0x2a847a=_0x2a847a||0x1f4;return function(_0x45b849){logger[_0xb71a('0x26')](_0x45b849[_0xb71a('0x27')]);if(_0x45b849['name']){delete _0x45b849[_0xb71a('0x28')];}_0x31085b[_0xb71a('0x1a')](_0x2a847a)[_0xb71a('0x29')](_0x45b849);};}exports[_0xb71a('0x2a')]=function(_0x2fbd73,_0x38178c){var _0x44826e={},_0x25364c={},_0x42c086={'count':0x0,'rows':[]};var _0x421fcf=_[_0xb71a('0x2b')](db['Integration']['rawAttributes'],function(_0x3112d3){return{'name':_0x3112d3['fieldName'],'type':_0x3112d3[_0xb71a('0x2c')][_0xb71a('0x2d')]};});_0x25364c['model']=_[_0xb71a('0x2b')](_0x421fcf,_0xb71a('0x28'));_0x25364c[_0xb71a('0x2e')]=_[_0xb71a('0x2f')](_0x2fbd73[_0xb71a('0x2e')]);_0x25364c[_0xb71a('0x30')]=_['intersection'](_0x25364c[_0xb71a('0x31')],_0x25364c[_0xb71a('0x2e')]);_0x44826e[_0xb71a('0x32')]=_[_0xb71a('0x33')](_0x25364c['model'],qs[_0xb71a('0x34')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x34')]));_0x44826e[_0xb71a('0x32')]=_0x44826e[_0xb71a('0x32')][_0xb71a('0x35')]?_0x44826e[_0xb71a('0x32')]:_0x25364c[_0xb71a('0x31')];if(!_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x36')]('nolimit')){_0x44826e['limit']=qs[_0xb71a('0x1f')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1f')]);_0x44826e[_0xb71a('0x1d')]=qs[_0xb71a('0x1d')](_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x1d')]);}_0x44826e['order']=qs[_0xb71a('0x37')](_0x2fbd73['query'][_0xb71a('0x37')]);_0x44826e[_0xb71a('0x38')]=qs[_0xb71a('0x30')](_[_0xb71a('0x39')](_0x2fbd73['query'],_0x25364c[_0xb71a('0x30')]),_0x421fcf);if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]){_0x44826e[_0xb71a('0x38')]=_[_0xb71a('0x3b')](_0x44826e[_0xb71a('0x38')],{'$or':_[_0xb71a('0x2b')](_0x421fcf,function(_0x2756b9){if(_0x2756b9[_0xb71a('0x2c')]!=='VIRTUAL'){var _0x24a3af={};_0x24a3af[_0x2756b9['name']]={'$like':'%'+_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3a')]+'%'};return _0x24a3af;}})});}_0x44826e=_[_0xb71a('0x3b')]({},_0x44826e,_0x2fbd73[_0xb71a('0x3c')]);var _0xce7b8a={'where':_0x44826e[_0xb71a('0x38')]};return db['Integration']['count'](_0xce7b8a)['then'](function(_0x35fea9){_0x42c086['count']=_0x35fea9;if(_0x2fbd73[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x44826e[_0xb71a('0x3e')]=[{'all':!![]}];}return db[_0xb71a('0x3f')][_0xb71a('0x40')](_0x44826e);})[_0xb71a('0x24')](function(_0x59530a){_0x42c086[_0xb71a('0x41')]=_0x59530a;return _0x42c086;})[_0xb71a('0x24')](respondWithFilteredResult(_0x38178c,_0x44826e))[_0xb71a('0x42')](handleError(_0x38178c,null));};exports[_0xb71a('0x43')]=function(_0x7d305,_0x2f08d2){var _0x55cbca={'raw':![],'where':{'id':_0x7d305[_0xb71a('0x44')]['id']}},_0x2afff3={};_0x2afff3[_0xb71a('0x31')]=_[_0xb71a('0x2f')](db[_0xb71a('0x3f')][_0xb71a('0x45')]);_0x2afff3[_0xb71a('0x2e')]=_['keys'](_0x7d305['query']);_0x2afff3[_0xb71a('0x30')]=_[_0xb71a('0x33')](_0x2afff3[_0xb71a('0x31')],_0x2afff3[_0xb71a('0x2e')]);_0x55cbca['attributes']=_[_0xb71a('0x33')](_0x2afff3['model'],qs[_0xb71a('0x34')](_0x7d305[_0xb71a('0x2e')]['fields']));_0x55cbca[_0xb71a('0x32')]=_0x55cbca[_0xb71a('0x32')][_0xb71a('0x35')]?_0x55cbca[_0xb71a('0x32')]:_0x2afff3['model'];if(_0x7d305[_0xb71a('0x2e')][_0xb71a('0x3d')]){_0x55cbca[_0xb71a('0x3e')]=[{'all':!![]}];}_0x55cbca=_['merge']({},_0x55cbca,_0x7d305[_0xb71a('0x3c')]);return db[_0xb71a('0x3f')][_0xb71a('0x46')](_0x55cbca)['then'](handleEntityNotFound(_0x2f08d2,null))[_0xb71a('0x24')](respondWithResult(_0x2f08d2,null))[_0xb71a('0x42')](handleError(_0x2f08d2,null));};exports[_0xb71a('0x47')]=function(_0x1f29b7,_0x365bed){return db['Integration'][_0xb71a('0x47')](_0x1f29b7[_0xb71a('0x48')],{})[_0xb71a('0x24')](respondWithResult(_0x365bed,0xc9))[_0xb71a('0x42')](handleError(_0x365bed,null));};exports['update']=function(_0x48fbde,_0x23b4c0){if(_0x48fbde[_0xb71a('0x48')]['id']){delete _0x48fbde[_0xb71a('0x48')]['id'];}return db[_0xb71a('0x3f')][_0xb71a('0x46')]({'where':{'id':_0x48fbde[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x23b4c0,null))[_0xb71a('0x24')](saveUpdates(_0x48fbde[_0xb71a('0x48')],null))[_0xb71a('0x24')](respondWithResult(_0x23b4c0,null))['catch'](handleError(_0x23b4c0,null));};exports[_0xb71a('0x25')]=function(_0x2ce711,_0x500196){return db[_0xb71a('0x3f')]['find']({'where':{'id':_0x2ce711[_0xb71a('0x44')]['id']}})[_0xb71a('0x24')](handleEntityNotFound(_0x500196,null))[_0xb71a('0x24')](removeEntity(_0x500196,null))[_0xb71a('0x42')](handleError(_0x500196,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b98c023..01e4e6c 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 _0x3e77=['request-promise','path','exports','define','Integration','integrations','util','../../config/logger','api','moment','bluebird'];(function(_0x5856b2,_0x1b52f3){var _0x2c6f11=function(_0x17106a){while(--_0x17106a){_0x5856b2['push'](_0x5856b2['shift']());}};_0x2c6f11(++_0x1b52f3);}(_0x3e77,0x1c9));var _0x73e7=function(_0x3d1672,_0x25ffe4){_0x3d1672=_0x3d1672-0x0;var _0x1f014e=_0x3e77[_0x3d1672];return _0x1f014e;};'use strict';var _=require('lodash');var util=require(_0x73e7('0x0'));var logger=require(_0x73e7('0x1'))(_0x73e7('0x2'));var moment=require(_0x73e7('0x3'));var BPromise=require(_0x73e7('0x4'));var rp=require(_0x73e7('0x5'));var fs=require('fs');var path=require(_0x73e7('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0x73e7('0x7')]=function(_0x454ac4,_0x400184){return _0x454ac4[_0x73e7('0x8')](_0x73e7('0x9'),attributes,{'tableName':_0x73e7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6933=['rimraf','exports','define','integrations','api','moment'];(function(_0x432a17,_0x27fb53){var _0x1dda81=function(_0x5be833){while(--_0x5be833){_0x432a17['push'](_0x432a17['shift']());}};_0x1dda81(++_0x27fb53);}(_0x6933,0x1d8));var _0x3693=function(_0x2a07c9,_0x185c10){_0x2a07c9=_0x2a07c9-0x0;var _0x4e5723=_0x6933[_0x2a07c9];return _0x4e5723;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3693('0x0'));var moment=require(_0x3693('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3693('0x2'));var config=require('../../config/environment');var attributes=require('./integration.attributes');module[_0x3693('0x3')]=function(_0x11715b,_0x3ccfa1){return _0x11715b[_0x3693('0x4')]('Integration',attributes,{'tableName':_0x3693('0x5'),'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 35f8b1a..6b59152 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x1c8fc2,_0x147a7a){var _0x2e0c85=function(_0x2ba4b4){while(--_0x2ba4b4){_0x1c8fc2['push'](_0x1c8fc2['shift']());}};_0x2e0c85(++_0x147a7a);}(_0x1a85,0x178));var _0x51a8=function(_0x38ed15,_0x2b12e8){_0x38ed15=_0x38ed15-0x0;var _0x29db8b=_0x1a85[_0x38ed15];return _0x29db8b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('Integration,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x52f366,_0x18b3e4){var _0x1a1d13=function(_0x254f07){while(--_0x254f07){_0x52f366['push'](_0x52f366['shift']());}};_0x1a1d13(++_0x18b3e4);}(_0x6d38,0x1ef));var _0x86d3=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x6d38[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 15ab5a7..e5f2aeb 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 _0xdb28=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','update'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xdb28,0x106));var _0x8db2=function(_0x4e5fb8,_0x2a3ad3){_0x4e5fb8=_0x4e5fb8-0x0;var _0x471122=_0xdb28[_0x4e5fb8];return _0x471122;};'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('./integrationReport.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post']('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0xf')]);router[_0x8db2('0x10')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x11')]);router['delete'](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x12')]);module[_0x8db2('0x13')]=router; \ No newline at end of file +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(_0x342364,_0x889180){var _0x117105=function(_0x35f074){while(--_0x35f074){_0x342364['push'](_0x342364['shift']());}};_0x117105(++_0x889180);}(_0xef0f,0x168));var _0xfef0=function(_0x34c3ba,_0x4d1f3c){_0x34c3ba=_0x34c3ba-0x0;var _0x1c0a76=_0xef0f[_0x34c3ba];return _0x1c0a76;};'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 df4f1fc..7c2918a 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 _0x2e82=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize'];(function(_0x4dc2ff,_0x1d251e){var _0x5b4ae8=function(_0x5429dd){while(--_0x5429dd){_0x4dc2ff['push'](_0x4dc2ff['shift']());}};_0x5b4ae8(++_0x1d251e);}(_0x2e82,0x103));var _0x22e8=function(_0x2c1245,_0x52f442){_0x2c1245=_0x2c1245-0x0;var _0x1d8848=_0x2e82[_0x2c1245];return _0x1d8848;};'use strict';var Sequelize=require(_0x22e8('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x22e8('0x1')]},'exitStatus':{'type':Sequelize[_0x22e8('0x1')]},'ticketId':{'type':Sequelize[_0x22e8('0x1')]},'integrationId':{'type':Sequelize[_0x22e8('0x2')]},'contacts':{'type':Sequelize[_0x22e8('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x22e8('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x22e8('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x22e8('0x1')]},'agentcalledAt':{'type':Sequelize[_0x22e8('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x22e8('0x2')]},'agentcomplete':{'type':Sequelize[_0x22e8('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x22e8('0x3')]},'talktime':{'type':Sequelize[_0x22e8('0x2')]},'agentacw':{'type':Sequelize[_0x22e8('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x22e8('0x2')]},'reason':{'type':Sequelize[_0x22e8('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x22e8('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x22e8('0x3')]},'agentdump':{'type':Sequelize[_0x22e8('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x22e8('0x1')]},'channel':{'type':Sequelize[_0x22e8('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x22e8('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x22e8('0x1')]},'language':{'type':Sequelize[_0x22e8('0x1')]},'accountcode':{'type':Sequelize[_0x22e8('0x1')]},'context':{'type':Sequelize[_0x22e8('0x1')]},'exten':{'type':Sequelize[_0x22e8('0x1')]},'priority':{'type':Sequelize[_0x22e8('0x1')]},'destchannel':{'type':Sequelize[_0x22e8('0x1')]},'destchannelstate':{'type':Sequelize[_0x22e8('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x22e8('0x1')]},'destcalleridname':{'type':Sequelize[_0x22e8('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x22e8('0x1')]},'destaccountcode':{'type':Sequelize[_0x22e8('0x1')]},'destcontext':{'type':Sequelize[_0x22e8('0x1')]},'destexten':{'type':Sequelize[_0x22e8('0x1')]},'destpriority':{'type':Sequelize[_0x22e8('0x1')]},'destuniqueid':{'type':Sequelize[_0x22e8('0x1')]},'messageId':{'type':Sequelize[_0x22e8('0x1')]},'inReplyTo':{'type':Sequelize[_0x22e8('0x1')]},'subject':{'type':Sequelize[_0x22e8('0x1')]},'from':{'type':Sequelize[_0x22e8('0x1')]},'to':{'type':Sequelize[_0x22e8('0x1')]},'cc':{'type':Sequelize[_0x22e8('0x1')]},'attachment':{'type':Sequelize[_0x22e8('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x22e8('0x5')]},'status':{'type':Sequelize[_0x22e8('0x6')](_0x22e8('0x7'),'SENDING',_0x22e8('0x8'),_0x22e8('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x22e8('0x1')]},'projectId':{'type':Sequelize[_0x22e8('0x2')]}}; \ No newline at end of file +var _0x24ab=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24ab,0x1c9));var _0xb24a=function(_0x247a8e,_0x3a97ee){_0x247a8e=_0x247a8e-0x0;var _0x3adeb2=_0x24ab[_0x247a8e];return _0x3adeb2;};'use strict';var Sequelize=require(_0xb24a('0x0'));module[_0xb24a('0x1')]={'integration':{'type':Sequelize[_0xb24a('0x2')]},'eventChannel':{'type':Sequelize[_0xb24a('0x2')]},'exitStatus':{'type':Sequelize[_0xb24a('0x2')]},'ticketId':{'type':Sequelize[_0xb24a('0x2')]},'integrationId':{'type':Sequelize[_0xb24a('0x3')]},'contacts':{'type':Sequelize[_0xb24a('0x2')]},'uniqueid':{'type':Sequelize[_0xb24a('0x2')]},'calleridnum':{'type':Sequelize[_0xb24a('0x2')]},'calleridname':{'type':Sequelize[_0xb24a('0x2')]},'queue':{'type':Sequelize[_0xb24a('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb24a('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb24a('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xb24a('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb24a('0x4')]},'talktime':{'type':Sequelize[_0xb24a('0x3')]},'agentacw':{'type':Sequelize[_0xb24a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb24a('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xb24a('0x4')]},'lastevent':{'type':Sequelize[_0xb24a('0x2')]},'channel':{'type':Sequelize[_0xb24a('0x2')]},'channelstate':{'type':Sequelize[_0xb24a('0x3')]},'channelstatedesc':{'type':Sequelize[_0xb24a('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb24a('0x2')]},'connectedlinename':{'type':Sequelize[_0xb24a('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb24a('0x2')]},'context':{'type':Sequelize[_0xb24a('0x2')]},'exten':{'type':Sequelize[_0xb24a('0x2')]},'priority':{'type':Sequelize[_0xb24a('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xb24a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb24a('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb24a('0x2')]},'destcalleridname':{'type':Sequelize[_0xb24a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xb24a('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xb24a('0x2')]},'destcontext':{'type':Sequelize[_0xb24a('0x2')]},'destexten':{'type':Sequelize[_0xb24a('0x2')]},'destpriority':{'type':Sequelize[_0xb24a('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xb24a('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0xb24a('0x2')]},'from':{'type':Sequelize[_0xb24a('0x2')]},'to':{'type':Sequelize[_0xb24a('0x2')]},'cc':{'type':Sequelize[_0xb24a('0x2')]},'attachment':{'type':Sequelize[_0xb24a('0x6')]},'html':{'type':Sequelize[_0xb24a('0x6')]},'text':{'type':Sequelize[_0xb24a('0x6')]},'status':{'type':Sequelize[_0xb24a('0x7')](_0xb24a('0x8'),_0xb24a('0x9'),_0xb24a('0xa'),_0xb24a('0xb'))},'url':{'type':Sequelize[_0xb24a('0x2')]},'app':{'type':Sequelize[_0xb24a('0x2')]},'appdata':{'type':Sequelize[_0xb24a('0x2')]},'projectId':{'type':Sequelize[_0xb24a('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 9e62cff..843bfda 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 _0x8088=['offset','set','Content-Range','save','update','end','sendStatus','error','stack','send','index','IntegrationReport','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','then','include','rows','catch','show','params','keys','fields','includeAll','options','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count'];(function(_0x1ab97c,_0x2ebad8){var _0x3e520a=function(_0x1cff4e){while(--_0x1cff4e){_0x1ab97c['push'](_0x1ab97c['shift']());}};_0x3e520a(++_0x2ebad8);}(_0x8088,0x16a));var _0x8808=function(_0x4b0b88,_0x5c2c38){_0x4b0b88=_0x4b0b88-0x0;var _0x1ba3d3=_0x8088[_0x4b0b88];return _0x1ba3d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8808('0x0'));var zipdir=require(_0x8808('0x1'));var jsonpatch=require(_0x8808('0x2'));var rp=require(_0x8808('0x3'));var moment=require(_0x8808('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8808('0x5'));var util=require(_0x8808('0x6'));var path=require(_0x8808('0x7'));var sox=require(_0x8808('0x8'));var csv=require(_0x8808('0x9'));var ejs=require(_0x8808('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8808('0xb'));var squel=require(_0x8808('0xc'));var crypto=require(_0x8808('0xd'));var jsforce=require(_0x8808('0xe'));var deskjs=require(_0x8808('0xf'));var toCsv=require(_0x8808('0x9'));var querystring=require(_0x8808('0x10'));var Papa=require(_0x8808('0x11'));var Redis=require(_0x8808('0x12'));var authService=require(_0x8808('0x13'));var qs=require(_0x8808('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8808('0x15'));var logger=require(_0x8808('0x16'))(_0x8808('0x17'));var utils=require(_0x8808('0x18'));var config=require(_0x8808('0x19'));var licenseUtil=require(_0x8808('0x1a'));var db=require(_0x8808('0x1b'))['db'];function respondWithStatusCode(_0xa0e4de,_0x1b7014){_0x1b7014=_0x1b7014||0xcc;return function(_0x46962d){if(_0x46962d){return _0xa0e4de['sendStatus'](_0x1b7014);}return _0xa0e4de[_0x8808('0x1c')](_0x1b7014)['end']();};}function respondWithResult(_0x284e0c,_0x534432){_0x534432=_0x534432||0xc8;return function(_0x3defe2){if(_0x3defe2){return _0x284e0c[_0x8808('0x1c')](_0x534432)[_0x8808('0x1d')](_0x3defe2);}};}function respondWithFilteredResult(_0x60e626,_0x2d03f6){return function(_0x1cc4bf){if(_0x1cc4bf){var _0x31f2cc=typeof _0x2d03f6['offset']===_0x8808('0x1e')&&typeof _0x2d03f6[_0x8808('0x1f')]===_0x8808('0x1e');var _0x4f50fa=_0x1cc4bf[_0x8808('0x20')];var _0x4a1b20=_0x31f2cc?0x0:_0x2d03f6[_0x8808('0x21')];var _0x4756d3=_0x31f2cc?_0x1cc4bf[_0x8808('0x20')]:_0x2d03f6[_0x8808('0x21')]+_0x2d03f6[_0x8808('0x1f')];var _0x383e57;if(_0x4756d3>=_0x4f50fa){_0x4756d3=_0x4f50fa;_0x383e57=0xc8;}else{_0x383e57=0xce;}_0x60e626['status'](_0x383e57);return _0x60e626[_0x8808('0x22')](_0x8808('0x23'),_0x4a1b20+'-'+_0x4756d3+'/'+_0x4f50fa)[_0x8808('0x1d')](_0x1cc4bf);}return null;};}function patchUpdates(_0x4f9d13){return function(_0x31e539){try{jsonpatch['apply'](_0x31e539,_0x4f9d13,!![]);}catch(_0x2c2ea4){return BPromise['reject'](_0x2c2ea4);}return _0x31e539[_0x8808('0x24')]();};}function saveUpdates(_0x34505b,_0x1b2ef2){return function(_0xcff505){if(_0xcff505){return _0xcff505[_0x8808('0x25')](_0x34505b)['then'](function(_0x3c7e04){return _0x3c7e04;});}return null;};}function removeEntity(_0xb87518,_0x1b4cb7){return function(_0x156e1d){if(_0x156e1d){return _0x156e1d['destroy']()['then'](function(){_0xb87518[_0x8808('0x1c')](0xcc)[_0x8808('0x26')]();});}};}function handleEntityNotFound(_0x259dbf,_0x480b94){return function(_0x1b7d4c){if(!_0x1b7d4c){_0x259dbf[_0x8808('0x27')](0x194);}return _0x1b7d4c;};}function handleError(_0x466d4e,_0x54c471){_0x54c471=_0x54c471||0x1f4;return function(_0x25cb5d){logger[_0x8808('0x28')](_0x25cb5d[_0x8808('0x29')]);if(_0x25cb5d['name']){delete _0x25cb5d['name'];}_0x466d4e[_0x8808('0x1c')](_0x54c471)[_0x8808('0x2a')](_0x25cb5d);};}exports[_0x8808('0x2b')]=function(_0x5d6112,_0x4f6bb8){var _0x2d4975={},_0x23568c={},_0x132192={'count':0x0,'rows':[]};var _0xd20749=_['map'](db[_0x8808('0x2c')][_0x8808('0x2d')],function(_0x155f81){return{'name':_0x155f81[_0x8808('0x2e')],'type':_0x155f81[_0x8808('0x2f')][_0x8808('0x30')]};});_0x23568c[_0x8808('0x31')]=_['map'](_0xd20749,_0x8808('0x32'));_0x23568c['query']=_['keys'](_0x5d6112['query']);_0x23568c[_0x8808('0x33')]=_['intersection'](_0x23568c[_0x8808('0x31')],_0x23568c[_0x8808('0x34')]);_0x2d4975[_0x8808('0x35')]=_['intersection'](_0x23568c[_0x8808('0x31')],qs['fields'](_0x5d6112[_0x8808('0x34')]['fields']));_0x2d4975['attributes']=_0x2d4975[_0x8808('0x35')][_0x8808('0x36')]?_0x2d4975[_0x8808('0x35')]:_0x23568c[_0x8808('0x31')];if(!_0x5d6112[_0x8808('0x34')][_0x8808('0x37')]('nolimit')){_0x2d4975[_0x8808('0x1f')]=qs[_0x8808('0x1f')](_0x5d6112['query']['limit']);_0x2d4975['offset']=qs[_0x8808('0x21')](_0x5d6112['query'][_0x8808('0x21')]);}_0x2d4975[_0x8808('0x38')]=qs['sort'](_0x5d6112['query'][_0x8808('0x39')]);_0x2d4975[_0x8808('0x3a')]=qs[_0x8808('0x33')](_[_0x8808('0x3b')](_0x5d6112[_0x8808('0x34')],_0x23568c[_0x8808('0x33')]),_0xd20749);if(_0x5d6112[_0x8808('0x34')]['filter']){_0x2d4975[_0x8808('0x3a')]=_[_0x8808('0x3c')](_0x2d4975['where'],{'$or':_[_0x8808('0x3d')](_0xd20749,function(_0x9b3704){if(_0x9b3704[_0x8808('0x2f')]!==_0x8808('0x3e')){var _0x43875b={};_0x43875b[_0x9b3704['name']]={'$like':'%'+_0x5d6112[_0x8808('0x34')][_0x8808('0x3f')]+'%'};return _0x43875b;}})});}_0x2d4975=_[_0x8808('0x3c')]({},_0x2d4975,_0x5d6112['options']);var _0x554f18={'where':_0x2d4975[_0x8808('0x3a')]};return db[_0x8808('0x2c')][_0x8808('0x20')](_0x554f18)[_0x8808('0x40')](function(_0x4fa00d){_0x132192['count']=_0x4fa00d;if(_0x5d6112[_0x8808('0x34')]['includeAll']){_0x2d4975[_0x8808('0x41')]=[{'all':!![]}];}return db[_0x8808('0x2c')]['findAll'](_0x2d4975);})['then'](function(_0x10a24f){_0x132192[_0x8808('0x42')]=_0x10a24f;return _0x132192;})[_0x8808('0x40')](respondWithFilteredResult(_0x4f6bb8,_0x2d4975))[_0x8808('0x43')](handleError(_0x4f6bb8,null));};exports[_0x8808('0x44')]=function(_0xee10f5,_0x115d7d){var _0x1b6e52={'raw':![],'where':{'id':_0xee10f5[_0x8808('0x45')]['id']}},_0x2dedb2={};_0x2dedb2[_0x8808('0x31')]=_['keys'](db[_0x8808('0x2c')][_0x8808('0x2d')]);_0x2dedb2[_0x8808('0x34')]=_[_0x8808('0x46')](_0xee10f5[_0x8808('0x34')]);_0x2dedb2['filters']=_['intersection'](_0x2dedb2[_0x8808('0x31')],_0x2dedb2[_0x8808('0x34')]);_0x1b6e52[_0x8808('0x35')]=_['intersection'](_0x2dedb2[_0x8808('0x31')],qs[_0x8808('0x47')](_0xee10f5[_0x8808('0x34')][_0x8808('0x47')]));_0x1b6e52[_0x8808('0x35')]=_0x1b6e52[_0x8808('0x35')][_0x8808('0x36')]?_0x1b6e52[_0x8808('0x35')]:_0x2dedb2[_0x8808('0x31')];if(_0xee10f5[_0x8808('0x34')][_0x8808('0x48')]){_0x1b6e52[_0x8808('0x41')]=[{'all':!![]}];}_0x1b6e52=_['merge']({},_0x1b6e52,_0xee10f5[_0x8808('0x49')]);return db[_0x8808('0x2c')]['find'](_0x1b6e52)['then'](handleEntityNotFound(_0x115d7d,null))[_0x8808('0x40')](respondWithResult(_0x115d7d,null))['catch'](handleError(_0x115d7d,null));};exports[_0x8808('0x4a')]=function(_0x1bdb43,_0x2228c0){return db[_0x8808('0x2c')]['create'](_0x1bdb43['body'],{})[_0x8808('0x40')](respondWithResult(_0x2228c0,0xc9))[_0x8808('0x43')](handleError(_0x2228c0,null));};exports[_0x8808('0x25')]=function(_0x2506a6,_0x38784c){if(_0x2506a6[_0x8808('0x4b')]['id']){delete _0x2506a6['body']['id'];}return db[_0x8808('0x2c')]['find']({'where':{'id':_0x2506a6[_0x8808('0x45')]['id']}})[_0x8808('0x40')](handleEntityNotFound(_0x38784c,null))[_0x8808('0x40')](saveUpdates(_0x2506a6[_0x8808('0x4b')],null))[_0x8808('0x40')](respondWithResult(_0x38784c,null))[_0x8808('0x43')](handleError(_0x38784c,null));};exports[_0x8808('0x4c')]=function(_0x206f1a,_0x13c01b){return db['IntegrationReport'][_0x8808('0x4d')]({'where':{'id':_0x206f1a[_0x8808('0x45')]['id']}})['then'](handleEntityNotFound(_0x13c01b,null))[_0x8808('0x40')](removeEntity(_0x13c01b,null))[_0x8808('0x43')](handleError(_0x13c01b,null));};exports[_0x8808('0x4e')]=function(_0x3e231c,_0x277a28){return db['IntegrationReport']['describe']()[_0x8808('0x40')](respondWithResult(_0x277a28,null))[_0x8808('0x43')](handleError(_0x277a28,null));}; \ No newline at end of file +var _0x0b70=['type','VIRTUAL','options','includeAll','include','findAll','show','params','length','catch','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','end','status','json','undefined','limit','offset','count','apply','save','update','then','sendStatus','stack','name','IntegrationReport','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge'];(function(_0x53437b,_0x33a52a){var _0x60e84b=function(_0x10275b){while(--_0x10275b){_0x53437b['push'](_0x53437b['shift']());}};_0x60e84b(++_0x33a52a);}(_0x0b70,0x12a));var _0x00b7=function(_0x267345,_0x365252){_0x267345=_0x267345-0x0;var _0x350b03=_0x0b70[_0x267345];return _0x350b03;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x00b7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x00b7('0x1'));var rp=require(_0x00b7('0x2'));var moment=require(_0x00b7('0x3'));var BPromise=require(_0x00b7('0x4'));var Mustache=require(_0x00b7('0x5'));var util=require(_0x00b7('0x6'));var path=require(_0x00b7('0x7'));var sox=require(_0x00b7('0x8'));var csv=require(_0x00b7('0x9'));var ejs=require(_0x00b7('0xa'));var fs=require('fs');var fs_extra=require(_0x00b7('0xb'));var _=require(_0x00b7('0xc'));var squel=require('squel');var crypto=require(_0x00b7('0xd'));var jsforce=require(_0x00b7('0xe'));var deskjs=require(_0x00b7('0xf'));var toCsv=require(_0x00b7('0x9'));var querystring=require(_0x00b7('0x10'));var Papa=require('papaparse');var Redis=require(_0x00b7('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x00b7('0x12'));var as=require(_0x00b7('0x13'));var hardwareService=require(_0x00b7('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x00b7('0x15'));var config=require(_0x00b7('0x16'));var licenseUtil=require(_0x00b7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c6ab0,_0x3ed2c2){_0x3ed2c2=_0x3ed2c2||0xcc;return function(_0x226b2e){if(_0x226b2e){return _0x3c6ab0['sendStatus'](_0x3ed2c2);}return _0x3c6ab0['status'](_0x3ed2c2)[_0x00b7('0x18')]();};}function respondWithResult(_0x393d58,_0xff110a){_0xff110a=_0xff110a||0xc8;return function(_0x514ff0){if(_0x514ff0){return _0x393d58[_0x00b7('0x19')](_0xff110a)[_0x00b7('0x1a')](_0x514ff0);}};}function respondWithFilteredResult(_0x46254b,_0x49f975){return function(_0x17b5b1){if(_0x17b5b1){var _0x561d87=typeof _0x49f975['offset']===_0x00b7('0x1b')&&typeof _0x49f975[_0x00b7('0x1c')]===_0x00b7('0x1b');var _0x50705b=_0x17b5b1['count'];var _0x15676e=_0x561d87?0x0:_0x49f975[_0x00b7('0x1d')];var _0x46aefe=_0x561d87?_0x17b5b1[_0x00b7('0x1e')]:_0x49f975[_0x00b7('0x1d')]+_0x49f975[_0x00b7('0x1c')];var _0x49a9c7;if(_0x46aefe>=_0x50705b){_0x46aefe=_0x50705b;_0x49a9c7=0xc8;}else{_0x49a9c7=0xce;}_0x46254b['status'](_0x49a9c7);return _0x46254b['set']('Content-Range',_0x15676e+'-'+_0x46aefe+'/'+_0x50705b)[_0x00b7('0x1a')](_0x17b5b1);}return null;};}function patchUpdates(_0x5a62aa){return function(_0x335e95){try{jsonpatch[_0x00b7('0x1f')](_0x335e95,_0x5a62aa,!![]);}catch(_0x38d271){return BPromise['reject'](_0x38d271);}return _0x335e95[_0x00b7('0x20')]();};}function saveUpdates(_0x4416e1,_0x59f349){return function(_0x2c02ae){if(_0x2c02ae){return _0x2c02ae[_0x00b7('0x21')](_0x4416e1)[_0x00b7('0x22')](function(_0x13ea51){return _0x13ea51;});}return null;};}function removeEntity(_0x587141,_0x128789){return function(_0x3eb91b){if(_0x3eb91b){return _0x3eb91b['destroy']()[_0x00b7('0x22')](function(){_0x587141['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fe30a,_0x3f9dd9){return function(_0x555946){if(!_0x555946){_0x4fe30a[_0x00b7('0x23')](0x194);}return _0x555946;};}function handleError(_0x2ee05d,_0x4040e3){_0x4040e3=_0x4040e3||0x1f4;return function(_0x20d52e){logger['error'](_0x20d52e[_0x00b7('0x24')]);if(_0x20d52e[_0x00b7('0x25')]){delete _0x20d52e[_0x00b7('0x25')];}_0x2ee05d[_0x00b7('0x19')](_0x4040e3)['send'](_0x20d52e);};}exports['index']=function(_0x20ffc7,_0x421ede){var _0x53f788={},_0x5b825b={},_0x40dfbb={'count':0x0,'rows':[]};var _0x13fcd4=_['map'](db[_0x00b7('0x26')][_0x00b7('0x27')],function(_0xd446c1){return{'name':_0xd446c1[_0x00b7('0x28')],'type':_0xd446c1['type'][_0x00b7('0x29')]};});_0x5b825b[_0x00b7('0x2a')]=_[_0x00b7('0x2b')](_0x13fcd4,_0x00b7('0x25'));_0x5b825b[_0x00b7('0x2c')]=_[_0x00b7('0x2d')](_0x20ffc7[_0x00b7('0x2c')]);_0x5b825b['filters']=_['intersection'](_0x5b825b[_0x00b7('0x2a')],_0x5b825b[_0x00b7('0x2c')]);_0x53f788[_0x00b7('0x2e')]=_[_0x00b7('0x2f')](_0x5b825b[_0x00b7('0x2a')],qs[_0x00b7('0x30')](_0x20ffc7['query'][_0x00b7('0x30')]));_0x53f788[_0x00b7('0x2e')]=_0x53f788[_0x00b7('0x2e')]['length']?_0x53f788[_0x00b7('0x2e')]:_0x5b825b[_0x00b7('0x2a')];if(!_0x20ffc7[_0x00b7('0x2c')][_0x00b7('0x31')](_0x00b7('0x32'))){_0x53f788[_0x00b7('0x1c')]=qs[_0x00b7('0x1c')](_0x20ffc7[_0x00b7('0x2c')][_0x00b7('0x1c')]);_0x53f788[_0x00b7('0x1d')]=qs[_0x00b7('0x1d')](_0x20ffc7['query'][_0x00b7('0x1d')]);}_0x53f788[_0x00b7('0x33')]=qs[_0x00b7('0x34')](_0x20ffc7[_0x00b7('0x2c')]['sort']);_0x53f788[_0x00b7('0x35')]=qs['filters'](_['pick'](_0x20ffc7[_0x00b7('0x2c')],_0x5b825b[_0x00b7('0x36')]),_0x13fcd4);if(_0x20ffc7[_0x00b7('0x2c')][_0x00b7('0x37')]){_0x53f788[_0x00b7('0x35')]=_[_0x00b7('0x38')](_0x53f788[_0x00b7('0x35')],{'$or':_[_0x00b7('0x2b')](_0x13fcd4,function(_0x5e59e8){if(_0x5e59e8[_0x00b7('0x39')]!==_0x00b7('0x3a')){var _0x1f8b2a={};_0x1f8b2a[_0x5e59e8[_0x00b7('0x25')]]={'$like':'%'+_0x20ffc7[_0x00b7('0x2c')]['filter']+'%'};return _0x1f8b2a;}})});}_0x53f788=_['merge']({},_0x53f788,_0x20ffc7[_0x00b7('0x3b')]);var _0x4e1238={'where':_0x53f788[_0x00b7('0x35')]};return db[_0x00b7('0x26')][_0x00b7('0x1e')](_0x4e1238)[_0x00b7('0x22')](function(_0x6d710d){_0x40dfbb[_0x00b7('0x1e')]=_0x6d710d;if(_0x20ffc7[_0x00b7('0x2c')][_0x00b7('0x3c')]){_0x53f788[_0x00b7('0x3d')]=[{'all':!![]}];}return db['IntegrationReport'][_0x00b7('0x3e')](_0x53f788);})[_0x00b7('0x22')](function(_0xe6ae2a){_0x40dfbb['rows']=_0xe6ae2a;return _0x40dfbb;})[_0x00b7('0x22')](respondWithFilteredResult(_0x421ede,_0x53f788))['catch'](handleError(_0x421ede,null));};exports[_0x00b7('0x3f')]=function(_0x55f847,_0x4f1884){var _0x504bb9={'raw':![],'where':{'id':_0x55f847[_0x00b7('0x40')]['id']}},_0x1e26b4={};_0x1e26b4[_0x00b7('0x2a')]=_['keys'](db['IntegrationReport']['rawAttributes']);_0x1e26b4[_0x00b7('0x2c')]=_[_0x00b7('0x2d')](_0x55f847[_0x00b7('0x2c')]);_0x1e26b4[_0x00b7('0x36')]=_['intersection'](_0x1e26b4[_0x00b7('0x2a')],_0x1e26b4[_0x00b7('0x2c')]);_0x504bb9[_0x00b7('0x2e')]=_[_0x00b7('0x2f')](_0x1e26b4['model'],qs['fields'](_0x55f847[_0x00b7('0x2c')][_0x00b7('0x30')]));_0x504bb9[_0x00b7('0x2e')]=_0x504bb9['attributes'][_0x00b7('0x41')]?_0x504bb9[_0x00b7('0x2e')]:_0x1e26b4[_0x00b7('0x2a')];if(_0x55f847[_0x00b7('0x2c')][_0x00b7('0x3c')]){_0x504bb9['include']=[{'all':!![]}];}_0x504bb9=_[_0x00b7('0x38')]({},_0x504bb9,_0x55f847['options']);return db[_0x00b7('0x26')]['find'](_0x504bb9)[_0x00b7('0x22')](handleEntityNotFound(_0x4f1884,null))[_0x00b7('0x22')](respondWithResult(_0x4f1884,null))[_0x00b7('0x42')](handleError(_0x4f1884,null));};exports['create']=function(_0x1836ba,_0x3d9ea9){return db['IntegrationReport'][_0x00b7('0x43')](_0x1836ba[_0x00b7('0x44')],{})[_0x00b7('0x22')](respondWithResult(_0x3d9ea9,0xc9))[_0x00b7('0x42')](handleError(_0x3d9ea9,null));};exports['update']=function(_0x4f3434,_0x186576){if(_0x4f3434[_0x00b7('0x44')]['id']){delete _0x4f3434['body']['id'];}return db['IntegrationReport'][_0x00b7('0x45')]({'where':{'id':_0x4f3434['params']['id']}})['then'](handleEntityNotFound(_0x186576,null))[_0x00b7('0x22')](saveUpdates(_0x4f3434[_0x00b7('0x44')],null))[_0x00b7('0x22')](respondWithResult(_0x186576,null))[_0x00b7('0x42')](handleError(_0x186576,null));};exports['destroy']=function(_0xf8060d,_0x1e955f){return db['IntegrationReport'][_0x00b7('0x45')]({'where':{'id':_0xf8060d[_0x00b7('0x40')]['id']}})[_0x00b7('0x22')](handleEntityNotFound(_0x1e955f,null))['then'](removeEntity(_0x1e955f,null))[_0x00b7('0x42')](handleError(_0x1e955f,null));};exports[_0x00b7('0x46')]=function(_0x5530f1,_0x134064){return db[_0x00b7('0x26')]['describe']()[_0x00b7('0x22')](respondWithResult(_0x134064,null))[_0x00b7('0x42')](handleError(_0x134064,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 426046a..bcc5b9c 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 _0xb417=['moment','request-promise','path','rimraf','IntegrationReport','report_integration','lodash','util','api'];(function(_0x4e7858,_0xe7fbf3){var _0x376196=function(_0x310d45){while(--_0x310d45){_0x4e7858['push'](_0x4e7858['shift']());}};_0x376196(++_0xe7fbf3);}(_0xb417,0xc3));var _0x7b41=function(_0x45ccf6,_0x187595){_0x45ccf6=_0x45ccf6-0x0;var _0x140e18=_0xb417[_0x45ccf6];return _0x140e18;};'use strict';var _=require(_0x7b41('0x0'));var util=require(_0x7b41('0x1'));var logger=require('../../config/logger')(_0x7b41('0x2'));var moment=require(_0x7b41('0x3'));var BPromise=require('bluebird');var rp=require(_0x7b41('0x4'));var fs=require('fs');var path=require(_0x7b41('0x5'));var rimraf=require(_0x7b41('0x6'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module['exports']=function(_0xa3495e,_0x4b683e){return _0xa3495e['define'](_0x7b41('0x7'),attributes,{'tableName':_0x7b41('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x28b0=['exports','define','IntegrationReport','report_integration','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0xd13171,_0xc54453){var _0x452bd0=function(_0x3c0628){while(--_0x3c0628){_0xd13171['push'](_0xd13171['shift']());}};_0x452bd0(++_0xc54453);}(_0x28b0,0x144));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x028b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x028b('0x1'));var moment=require('moment');var BPromise=require(_0x028b('0x2'));var rp=require(_0x028b('0x3'));var fs=require('fs');var path=require(_0x028b('0x4'));var rimraf=require(_0x028b('0x5'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x028b('0x6')]=function(_0x496041,_0x1aa5f2){return _0x496041[_0x028b('0x7')](_0x028b('0x8'),attributes,{'tableName':_0x028b('0x9'),'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 1948ffc..c68a4b3 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 _0xc6ac=['http','request','then','info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x56200b,_0x2986cc){var _0x292c95=function(_0x387b4d){while(--_0x387b4d){_0x56200b['push'](_0x56200b['shift']());}};_0x292c95(++_0x2986cc);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1e6f66,_0x180a3a){_0x1e6f66=_0x1e6f66-0x0;var _0x278242=_0xc6ac[_0x1e6f66];return _0x278242;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));var BPromise=require(_0xcc6a('0x3'));var rs=require(_0xcc6a('0x4'));var fs=require('fs');var Redis=require(_0xcc6a('0x5'));var db=require(_0xcc6a('0x6'))['db'];var utils=require(_0xcc6a('0x7'));var logger=require(_0xcc6a('0x8'))(_0xcc6a('0x9'));var config=require(_0xcc6a('0xa'));var jayson=require(_0xcc6a('0xb'));var client=jayson[_0xcc6a('0xc')][_0xcc6a('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5f3887,_0x3dd497,_0x11b919){return new BPromise(function(_0xf02261,_0x560cc4){return client[_0xcc6a('0xe')](_0x5f3887,_0x11b919)[_0xcc6a('0xf')](function(_0x7806a0){logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,'request\x20sent');logger[_0xcc6a('0x12')](_0xcc6a('0x13'),_0x3dd497,_0xcc6a('0x14'),JSON['stringify'](_0x7806a0));if(_0x7806a0[_0xcc6a('0x15')]){if(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x16')]===0x1f4){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0x560cc4(_0x7806a0[_0xcc6a('0x15')]['message']);}logger['error'](_0xcc6a('0x11'),_0x3dd497,_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);return _0xf02261(_0x7806a0[_0xcc6a('0x15')][_0xcc6a('0x17')]);}else{logger[_0xcc6a('0x10')](_0xcc6a('0x11'),_0x3dd497,_0xcc6a('0x14'));_0xf02261(_0x7806a0['result']['message']);}})['catch'](function(_0x395a55){logger[_0xcc6a('0x15')](_0xcc6a('0x11'),_0x3dd497,_0x395a55);_0x560cc4(_0x395a55);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xc2c7,0x134));var _0x7c2c=function(_0x27978e,_0x129769){_0x27978e=_0x27978e-0x0;var _0x18f8e5=_0xc2c7[_0x27978e];return _0x18f8e5;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 991461f..911b830 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 _0x0cfe=['isAuthenticated','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','index','/:id','show'];(function(_0x1183f7,_0x5d8040){var _0x3e2456=function(_0x12be90){while(--_0x12be90){_0x1183f7['push'](_0x1183f7['shift']());}};_0x3e2456(++_0x5d8040);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x2aeea6,_0x38bb98){_0x2aeea6=_0x2aeea6-0x0;var _0x12614a=_0x0cfe[_0x2aeea6];return _0x12614a;};'use strict';var multer=require(_0xe0cf('0x0'));var util=require('util');var path=require(_0xe0cf('0x1'));var timeout=require(_0xe0cf('0x2'));var express=require(_0xe0cf('0x3'));var router=express['Router']();var fs_extra=require(_0xe0cf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe0cf('0x5'));var config=require(_0xe0cf('0x6'));var controller=require(_0xe0cf('0x7'));router[_0xe0cf('0x8')]('/',auth['isAuthenticated'](),controller[_0xe0cf('0x9')]);router[_0xe0cf('0x8')](_0xe0cf('0xa'),auth['isAuthenticated'](),controller[_0xe0cf('0xb')]);router[_0xe0cf('0x8')]('/:id/sub_intervals',auth[_0xe0cf('0xc')](),controller[_0xe0cf('0xd')]);router[_0xe0cf('0xe')]('/',auth[_0xe0cf('0xc')](),controller[_0xe0cf('0xf')]);router[_0xe0cf('0xe')]('/:id/sub_intervals',auth[_0xe0cf('0xc')](),controller[_0xe0cf('0x10')]);router[_0xe0cf('0xe')](_0xe0cf('0x11'),auth[_0xe0cf('0xc')](),controller[_0xe0cf('0x12')]);router[_0xe0cf('0x13')](_0xe0cf('0xa'),auth[_0xe0cf('0xc')](),controller[_0xe0cf('0x14')]);router[_0xe0cf('0x15')](_0xe0cf('0xa'),auth['isAuthenticated'](),controller[_0xe0cf('0x16')]);module[_0xe0cf('0x17')]=router; \ No newline at end of file +var _0xd714=['update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd714,0x1e4));var _0x4d71=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0xd714[_0x595013];return _0x2a29e3;};'use strict';var multer=require(_0x4d71('0x0'));var util=require(_0x4d71('0x1'));var path=require('path');var timeout=require(_0x4d71('0x2'));var express=require(_0x4d71('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4d71('0x4'));var interaction=require(_0x4d71('0x5'));var config=require(_0x4d71('0x6'));var controller=require(_0x4d71('0x7'));router[_0x4d71('0x8')]('/',auth[_0x4d71('0x9')](),controller[_0x4d71('0xa')]);router[_0x4d71('0x8')](_0x4d71('0xb'),auth[_0x4d71('0x9')](),controller[_0x4d71('0xc')]);router[_0x4d71('0x8')](_0x4d71('0xd'),auth[_0x4d71('0x9')](),controller[_0x4d71('0xe')]);router[_0x4d71('0xf')]('/',auth['isAuthenticated'](),controller[_0x4d71('0x10')]);router[_0x4d71('0xf')](_0x4d71('0xd'),auth[_0x4d71('0x9')](),controller['addInterval']);router[_0x4d71('0xf')](_0x4d71('0x11'),auth['isAuthenticated'](),controller[_0x4d71('0x12')]);router[_0x4d71('0x13')](_0x4d71('0xb'),auth[_0x4d71('0x9')](),controller[_0x4d71('0x14')]);router[_0x4d71('0x15')]('/:id',auth[_0x4d71('0x9')](),controller[_0x4d71('0x16')]);module[_0x4d71('0x17')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index fd59791..e055746 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 _0x78b5=['sequelize','exports','STRING'];(function(_0x4cb58a,_0x2a62e0){var _0x592f29=function(_0x260804){while(--_0x260804){_0x4cb58a['push'](_0x4cb58a['shift']());}};_0x592f29(++_0x2a62e0);}(_0x78b5,0x162));var _0x578b=function(_0x4e6121,_0x4d7322){_0x4e6121=_0x4e6121-0x0;var _0x38480a=_0x78b5[_0x4e6121];return _0x38480a;};'use strict';var Sequelize=require(_0x578b('0x0'));module[_0x578b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x578b('0x2')]},'interval':{'type':Sequelize[_0x578b('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x7d1e=['STRING','sequelize'];(function(_0x4b45bc,_0x2193ca){var _0x11d660=function(_0x2d3500){while(--_0x2d3500){_0x4b45bc['push'](_0x4b45bc['shift']());}};_0x11d660(++_0x2193ca);}(_0x7d1e,0x123));var _0xe7d1=function(_0x3f3a92,_0xb232c){_0x3f3a92=_0x3f3a92-0x0;var _0x52727a=_0x7d1e[_0x3f3a92];return _0x52727a;};'use strict';var Sequelize=require(_0xe7d1('0x0'));module['exports']={'name':{'type':Sequelize[_0xe7d1('0x1')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xe7d1('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index f0fe991..7483299 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 _0x655d=['hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addInterval','getIntervals','findOne','length','addIntervals','transaction','IntervalId','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','Intervals','error','index','map','Interval','fieldName','type','key','model','name','query','keys','intersection','attributes','fields'];(function(_0x270981,_0x13f876){var _0x44ae1e=function(_0x399b59){while(--_0x399b59){_0x270981['push'](_0x270981['shift']());}};_0x44ae1e(++_0x13f876);}(_0x655d,0xd8));var _0xd655=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x655d[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xd655('0x0'));var rimraf=require(_0xd655('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd655('0x2'));var rp=require(_0xd655('0x3'));var moment=require('moment');var BPromise=require(_0xd655('0x4'));var Mustache=require(_0xd655('0x5'));var util=require(_0xd655('0x6'));var path=require(_0xd655('0x7'));var sox=require('sox');var csv=require(_0xd655('0x8'));var ejs=require(_0xd655('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd655('0xa'));var crypto=require(_0xd655('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd655('0x8'));var querystring=require(_0xd655('0xc'));var Papa=require(_0xd655('0xd'));var Redis=require('ioredis');var authService=require(_0xd655('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd655('0xf'));var logger=require(_0xd655('0x10'))(_0xd655('0x11'));var utils=require(_0xd655('0x12'));var config=require(_0xd655('0x13'));var licenseUtil=require(_0xd655('0x14'));var db=require(_0xd655('0x15'))['db'];var extensions=require(_0xd655('0x16'));function respondWithStatusCode(_0x4f8e01,_0x91ac1e){_0x91ac1e=_0x91ac1e||0xcc;return function(_0x19f749){if(_0x19f749){return _0x4f8e01[_0xd655('0x17')](_0x91ac1e);}return _0x4f8e01[_0xd655('0x18')](_0x91ac1e)[_0xd655('0x19')]();};}function respondWithResult(_0x3a23b3,_0x2f1a11){_0x2f1a11=_0x2f1a11||0xc8;return function(_0x2034a2){if(_0x2034a2){return _0x3a23b3[_0xd655('0x18')](_0x2f1a11)[_0xd655('0x1a')](_0x2034a2);}};}function respondWithFilteredResult(_0x3c6776,_0xc432a8){return function(_0x1ed972){if(_0x1ed972){var _0x49bab8=typeof _0xc432a8[_0xd655('0x1b')]===_0xd655('0x1c')&&typeof _0xc432a8[_0xd655('0x1d')]===_0xd655('0x1c');var _0x10d7ff=_0x1ed972[_0xd655('0x1e')];var _0x291fec=_0x49bab8?0x0:_0xc432a8[_0xd655('0x1b')];var _0xe1d6ec=_0x49bab8?_0x1ed972[_0xd655('0x1e')]:_0xc432a8[_0xd655('0x1b')]+_0xc432a8[_0xd655('0x1d')];var _0xff3703;if(_0xe1d6ec>=_0x10d7ff){_0xe1d6ec=_0x10d7ff;_0xff3703=0xc8;}else{_0xff3703=0xce;}_0x3c6776['status'](_0xff3703);return _0x3c6776[_0xd655('0x1f')]('Content-Range',_0x291fec+'-'+_0xe1d6ec+'/'+_0x10d7ff)[_0xd655('0x1a')](_0x1ed972);}return null;};}function patchUpdates(_0x2938ac){return function(_0x40e85b){try{jsonpatch[_0xd655('0x20')](_0x40e85b,_0x2938ac,!![]);}catch(_0x15d054){return BPromise['reject'](_0x15d054);}return _0x40e85b[_0xd655('0x21')]();};}function saveUpdates(_0x2f87b4,_0x33c56e){return function(_0x3da6b7){if(_0x3da6b7){return _0x3da6b7[_0xd655('0x22')](_0x2f87b4)['then'](function(_0x121b56){return _0x121b56;});}return null;};}function removeEntity(_0x50a9f9,_0x442537){return function(_0x1e3d98){if(_0x1e3d98){return _0x1e3d98['destroy']()[_0xd655('0x23')](function(){var _0x1cbd29=_0x1e3d98['get']({'plain':!![]});var _0x3bc00d=_0xd655('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x3bc00d,'resourceId':_0x1cbd29['id']}})['then'](function(){return _0x1e3d98;});})[_0xd655('0x23')](function(){_0x50a9f9[_0xd655('0x18')](0xcc)[_0xd655('0x19')]();});}};}function handleEntityNotFound(_0x5b8896,_0x49a175){return function(_0xc1899e){if(!_0xc1899e){_0x5b8896[_0xd655('0x17')](0x194);}return _0xc1899e;};}function handleError(_0x146038,_0x26b6b7){_0x26b6b7=_0x26b6b7||0x1f4;return function(_0x1aa8c1){logger[_0xd655('0x25')](_0x1aa8c1['stack']);if(_0x1aa8c1['name']){delete _0x1aa8c1['name'];}_0x146038[_0xd655('0x18')](_0x26b6b7)['send'](_0x1aa8c1);};}exports[_0xd655('0x26')]=function(_0x3a1f0a,_0x10b77b){var _0x494d0a={},_0x3933c5={},_0x2c84c3={'count':0x0,'rows':[]};var _0x4581ad=_[_0xd655('0x27')](db[_0xd655('0x28')]['rawAttributes'],function(_0x2b38bc){return{'name':_0x2b38bc[_0xd655('0x29')],'type':_0x2b38bc[_0xd655('0x2a')][_0xd655('0x2b')]};});_0x3933c5[_0xd655('0x2c')]=_['map'](_0x4581ad,_0xd655('0x2d'));_0x3933c5[_0xd655('0x2e')]=_[_0xd655('0x2f')](_0x3a1f0a[_0xd655('0x2e')]);_0x3933c5['filters']=_[_0xd655('0x30')](_0x3933c5['model'],_0x3933c5[_0xd655('0x2e')]);_0x494d0a[_0xd655('0x31')]=_[_0xd655('0x30')](_0x3933c5['model'],qs['fields'](_0x3a1f0a[_0xd655('0x2e')][_0xd655('0x32')]));_0x494d0a[_0xd655('0x31')]=_0x494d0a['attributes']['length']?_0x494d0a[_0xd655('0x31')]:_0x3933c5['model'];if(!_0x3a1f0a[_0xd655('0x2e')][_0xd655('0x33')](_0xd655('0x34'))){_0x494d0a[_0xd655('0x1d')]=qs[_0xd655('0x1d')](_0x3a1f0a[_0xd655('0x2e')][_0xd655('0x1d')]);_0x494d0a[_0xd655('0x1b')]=qs[_0xd655('0x1b')](_0x3a1f0a[_0xd655('0x2e')][_0xd655('0x1b')]);}_0x494d0a[_0xd655('0x35')]=qs['sort'](_0x3a1f0a[_0xd655('0x2e')][_0xd655('0x36')]);_0x494d0a['where']=qs[_0xd655('0x37')](_[_0xd655('0x38')](_0x3a1f0a[_0xd655('0x2e')],_0x3933c5['filters']),_0x4581ad);if(_0x3a1f0a[_0xd655('0x2e')][_0xd655('0x39')]){_0x494d0a[_0xd655('0x3a')]=_[_0xd655('0x3b')](_0x494d0a[_0xd655('0x3a')],{'$or':_[_0xd655('0x27')](_0x4581ad,function(_0x558fcf){if(_0x558fcf[_0xd655('0x2a')]!==_0xd655('0x3c')){var _0x535071={};_0x535071[_0x558fcf[_0xd655('0x2d')]]={'$like':'%'+_0x3a1f0a['query'][_0xd655('0x39')]+'%'};return _0x535071;}})});}_0x494d0a=_['merge']({},_0x494d0a,_0x3a1f0a[_0xd655('0x3d')]);var _0x6102db={'where':_0x494d0a[_0xd655('0x3a')]};return db[_0xd655('0x28')]['count'](_0x6102db)[_0xd655('0x23')](function(_0x1f909b){_0x2c84c3[_0xd655('0x1e')]=_0x1f909b;if(_0x3a1f0a[_0xd655('0x2e')][_0xd655('0x3e')]){_0x494d0a[_0xd655('0x3f')]=[{'all':!![]}];}return db[_0xd655('0x28')][_0xd655('0x40')](_0x494d0a);})[_0xd655('0x23')](function(_0x2d81ba){_0x2c84c3[_0xd655('0x41')]=_0x2d81ba;return _0x2c84c3;})['then'](respondWithFilteredResult(_0x10b77b,_0x494d0a))['catch'](handleError(_0x10b77b,null));};exports[_0xd655('0x42')]=function(_0x31f5c3,_0x59f5a3){var _0x363bb4={'raw':!![],'where':{'id':_0x31f5c3[_0xd655('0x43')]['id']}},_0x3bff26={};_0x3bff26[_0xd655('0x2c')]=_[_0xd655('0x2f')](db[_0xd655('0x28')][_0xd655('0x44')]);_0x3bff26['query']=_[_0xd655('0x2f')](_0x31f5c3[_0xd655('0x2e')]);_0x3bff26[_0xd655('0x37')]=_['intersection'](_0x3bff26[_0xd655('0x2c')],_0x3bff26[_0xd655('0x2e')]);_0x363bb4[_0xd655('0x31')]=_[_0xd655('0x30')](_0x3bff26['model'],qs[_0xd655('0x32')](_0x31f5c3[_0xd655('0x2e')][_0xd655('0x32')]));_0x363bb4[_0xd655('0x31')]=_0x363bb4[_0xd655('0x31')]['length']?_0x363bb4[_0xd655('0x31')]:_0x3bff26[_0xd655('0x2c')];if(_0x31f5c3[_0xd655('0x2e')]['includeAll']){_0x363bb4[_0xd655('0x3f')]=[{'all':!![]}];}_0x363bb4=_[_0xd655('0x3b')]({},_0x363bb4,_0x31f5c3['options']);return db[_0xd655('0x28')][_0xd655('0x45')](_0x363bb4)[_0xd655('0x23')](handleEntityNotFound(_0x59f5a3,null))[_0xd655('0x23')](respondWithResult(_0x59f5a3,null))[_0xd655('0x46')](handleError(_0x59f5a3,null));};exports[_0xd655('0x47')]=function(_0x16b5fd,_0x4db6c1){return db['Interval']['create'](_0x16b5fd[_0xd655('0x48')],{})[_0xd655('0x23')](function(_0x58382e){var _0x35ee8d=_0x16b5fd['user'][_0xd655('0x49')]({'plain':!![]});if(!_0x35ee8d)throw new Error(_0xd655('0x4a'));if(_0x35ee8d[_0xd655('0x4b')]===_0xd655('0x4c')){var _0x30a7a1=_0x58382e['get']({'plain':!![]});var _0x1184a9=_0xd655('0x24');return db[_0xd655('0x4d')][_0xd655('0x45')]({'where':{'name':_0x1184a9,'userProfileId':_0x35ee8d['userProfileId']},'raw':!![]})[_0xd655('0x23')](function(_0x1fb984){if(_0x1fb984&&_0x1fb984[_0xd655('0x4e')]===0x0){return db[_0xd655('0x4f')][_0xd655('0x47')]({'name':_0x30a7a1[_0xd655('0x2d')],'resourceId':_0x30a7a1['id'],'type':_0x1fb984[_0xd655('0x2d')],'sectionId':_0x1fb984['id']},{})[_0xd655('0x23')](function(){return _0x58382e;});}else{return _0x58382e;}})[_0xd655('0x46')](function(_0x5094e3){logger[_0xd655('0x25')](_0xd655('0x50'),_0x5094e3);throw _0x5094e3;});}return _0x58382e;})[_0xd655('0x23')](respondWithResult(_0x4db6c1,0xc9))[_0xd655('0x46')](handleError(_0x4db6c1,null));};exports['update']=function(_0x361abe,_0x90b15b){if(_0x361abe[_0xd655('0x48')]['id']){delete _0x361abe['body']['id'];}return db['Interval'][_0xd655('0x45')]({'where':{'id':_0x361abe[_0xd655('0x43')]['id']}})[_0xd655('0x23')](handleEntityNotFound(_0x90b15b,null))['then'](saveUpdates(_0x361abe[_0xd655('0x48')],null))[_0xd655('0x23')](respondWithResult(_0x90b15b,null))[_0xd655('0x46')](handleError(_0x90b15b,null));};exports[_0xd655('0x51')]=function(_0x285170,_0x4d5417){return db[_0xd655('0x28')][_0xd655('0x45')]({'where':{'id':_0x285170[_0xd655('0x43')]['id']}})['then'](handleEntityNotFound(_0x4d5417,null))['then'](removeEntity(_0x4d5417,null))['catch'](handleError(_0x4d5417,null));};exports[_0xd655('0x52')]=function(_0x50a849,_0x3d63af,_0x382f17){if(_0x50a849[_0xd655('0x48')]['id']){delete _0x50a849['body']['id'];}return db[_0xd655('0x28')][_0xd655('0x45')]({'where':{'id':_0x50a849[_0xd655('0x43')]['id']}})[_0xd655('0x23')](handleEntityNotFound(_0x3d63af,null))[_0xd655('0x23')](function(_0x1d70d7){if(_0x1d70d7){_0x50a849['body']['IntervalId']=_0x1d70d7['id'];return db[_0xd655('0x28')]['create'](_0x50a849['body']);}})[_0xd655('0x23')](respondWithResult(_0x3d63af,null))[_0xd655('0x46')](handleError(_0x3d63af,null));};exports[_0xd655('0x53')]=function(_0x266a5a,_0x5918e1,_0x415bc7){var _0x409036={};var _0x3ba9ba={};var _0x5faa0c;var _0x463621;return db['Interval'][_0xd655('0x54')]({'where':{'id':_0x266a5a[_0xd655('0x43')]['id']}})[_0xd655('0x23')](handleEntityNotFound(_0x5918e1,null))[_0xd655('0x23')](function(_0x3d8555){if(_0x3d8555){_0x5faa0c=_0x3d8555;_0x3ba9ba[_0xd655('0x2c')]=_[_0xd655('0x2f')](db['Interval']['rawAttributes']);_0x3ba9ba[_0xd655('0x2e')]=_['keys'](_0x266a5a['query']);_0x3ba9ba[_0xd655('0x37')]=_[_0xd655('0x30')](_0x3ba9ba[_0xd655('0x2c')],_0x3ba9ba[_0xd655('0x2e')]);_0x409036[_0xd655('0x31')]=_[_0xd655('0x30')](_0x3ba9ba[_0xd655('0x2c')],qs[_0xd655('0x32')](_0x266a5a[_0xd655('0x2e')][_0xd655('0x32')]));_0x409036[_0xd655('0x31')]=_0x409036[_0xd655('0x31')][_0xd655('0x55')]?_0x409036[_0xd655('0x31')]:_0x3ba9ba['model'];_0x409036[_0xd655('0x35')]=qs['sort'](_0x266a5a['query'][_0xd655('0x36')]);_0x409036[_0xd655('0x3a')]=qs['filters'](_[_0xd655('0x38')](_0x266a5a[_0xd655('0x2e')],_0x3ba9ba['filters']));if(_0x266a5a[_0xd655('0x2e')][_0xd655('0x39')]){_0x409036['where']=_['merge'](_0x409036[_0xd655('0x3a')],{'$or':_[_0xd655('0x27')](_0x409036[_0xd655('0x31')],function(_0x9f506e){var _0x1827c4={};_0x1827c4[_0x9f506e]={'$like':'%'+_0x266a5a[_0xd655('0x2e')][_0xd655('0x39')]+'%'};return _0x1827c4;})});}_0x409036=_[_0xd655('0x3b')]({},_0x409036,_0x266a5a[_0xd655('0x3d')]);return _0x5faa0c[_0xd655('0x53')](_0x409036);}})['then'](function(_0x1fc6e3){if(_0x1fc6e3){_0x463621=_0x1fc6e3[_0xd655('0x55')];if(!_0x266a5a[_0xd655('0x2e')][_0xd655('0x33')]('nolimit')){_0x409036[_0xd655('0x1d')]=qs[_0xd655('0x1d')](_0x266a5a[_0xd655('0x2e')][_0xd655('0x1d')]);_0x409036[_0xd655('0x1b')]=qs[_0xd655('0x1b')](_0x266a5a[_0xd655('0x2e')]['offset']);}return _0x5faa0c['getIntervals'](_0x409036);}})[_0xd655('0x23')](function(_0x5ad7ce){if(_0x5ad7ce){return _0x5ad7ce?{'count':_0x463621,'rows':_0x5ad7ce}:null;}})['then'](respondWithResult(_0x5918e1,null))[_0xd655('0x46')](handleError(_0x5918e1,null));};exports[_0xd655('0x56')]=function(_0x4f1386,_0x356b4b,_0x13e854){return db[_0xd655('0x28')][_0xd655('0x54')]({'where':{'id':_0x4f1386[_0xd655('0x43')]['id']}})['then'](handleEntityNotFound(_0x356b4b,null))[_0xd655('0x23')](function(_0x173753){if(_0x173753){return db['sequelize'][_0xd655('0x57')](function(_0xff3af){return db[_0xd655('0x28')][_0xd655('0x51')]({'where':{'IntervalId':_0x4f1386['params']['id']},'transaction':_0xff3af})['then'](function(_0x31c082){var _0x2bf26f=_['map'](_0x4f1386['body'],function(_0xb0613a){delete _0xb0613a['id'];_0xb0613a[_0xd655('0x58')]=_0x4f1386[_0xd655('0x43')]['id'];return _0xb0613a;});return db[_0xd655('0x28')]['bulkCreate'](_0x2bf26f,{'transaction':_0xff3af});});})['then'](function(){return db[_0xd655('0x28')][_0xd655('0x40')]({'where':{'IntervalId':_0x4f1386[_0xd655('0x43')]['id']}});});}})[_0xd655('0x23')](respondWithResult(_0x356b4b,null))[_0xd655('0x46')](handleError(_0x356b4b,null));}; \ No newline at end of file +var _0x2844=['VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','length','find','create','body','role','user','Intervals','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','IntervalId','getIntervals','findOne','options','addIntervals','sequelize','transaction','bulkCreate','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge'];(function(_0x5104d1,_0x39a97b){var _0x37410f=function(_0x3b872e){while(--_0x3b872e){_0x5104d1['push'](_0x5104d1['shift']());}};_0x37410f(++_0x39a97b);}(_0x2844,0xd9));var _0x4284=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x2844[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require(_0x4284('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4284('0x1'));var jsonpatch=require(_0x4284('0x2'));var rp=require(_0x4284('0x3'));var moment=require(_0x4284('0x4'));var BPromise=require(_0x4284('0x5'));var Mustache=require(_0x4284('0x6'));var util=require(_0x4284('0x7'));var path=require(_0x4284('0x8'));var sox=require(_0x4284('0x9'));var csv=require(_0x4284('0xa'));var ejs=require(_0x4284('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4284('0xc'));var jsforce=require(_0x4284('0xd'));var deskjs=require(_0x4284('0xe'));var toCsv=require(_0x4284('0xa'));var querystring=require(_0x4284('0xf'));var Papa=require('papaparse');var Redis=require(_0x4284('0x10'));var authService=require(_0x4284('0x11'));var qs=require(_0x4284('0x12'));var as=require(_0x4284('0x13'));var hardwareService=require(_0x4284('0x14'));var logger=require(_0x4284('0x15'))(_0x4284('0x16'));var utils=require(_0x4284('0x17'));var config=require(_0x4284('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4284('0x19'))['db'];var extensions=require(_0x4284('0x1a'));function respondWithStatusCode(_0x382532,_0x4c0282){_0x4c0282=_0x4c0282||0xcc;return function(_0x3dc6b2){if(_0x3dc6b2){return _0x382532[_0x4284('0x1b')](_0x4c0282);}return _0x382532[_0x4284('0x1c')](_0x4c0282)[_0x4284('0x1d')]();};}function respondWithResult(_0x26b0db,_0x57e9a2){_0x57e9a2=_0x57e9a2||0xc8;return function(_0x4a1142){if(_0x4a1142){return _0x26b0db[_0x4284('0x1c')](_0x57e9a2)[_0x4284('0x1e')](_0x4a1142);}};}function respondWithFilteredResult(_0x5782de,_0x304820){return function(_0x3ab197){if(_0x3ab197){var _0xc7c1b6=typeof _0x304820[_0x4284('0x1f')]===_0x4284('0x20')&&typeof _0x304820[_0x4284('0x21')]==='undefined';var _0x141515=_0x3ab197[_0x4284('0x22')];var _0x191799=_0xc7c1b6?0x0:_0x304820[_0x4284('0x1f')];var _0x48e496=_0xc7c1b6?_0x3ab197[_0x4284('0x22')]:_0x304820[_0x4284('0x1f')]+_0x304820[_0x4284('0x21')];var _0x5760a4;if(_0x48e496>=_0x141515){_0x48e496=_0x141515;_0x5760a4=0xc8;}else{_0x5760a4=0xce;}_0x5782de[_0x4284('0x1c')](_0x5760a4);return _0x5782de[_0x4284('0x23')](_0x4284('0x24'),_0x191799+'-'+_0x48e496+'/'+_0x141515)[_0x4284('0x1e')](_0x3ab197);}return null;};}function patchUpdates(_0x163a85){return function(_0x186e63){try{jsonpatch['apply'](_0x186e63,_0x163a85,!![]);}catch(_0x4d80d0){return BPromise[_0x4284('0x25')](_0x4d80d0);}return _0x186e63[_0x4284('0x26')]();};}function saveUpdates(_0x1edd35,_0x1d1213){return function(_0x319119){if(_0x319119){return _0x319119[_0x4284('0x27')](_0x1edd35)[_0x4284('0x28')](function(_0x245d4c){return _0x245d4c;});}return null;};}function removeEntity(_0x363c76,_0x414aad){return function(_0x3f18b3){if(_0x3f18b3){return _0x3f18b3[_0x4284('0x29')]()[_0x4284('0x28')](function(){var _0x730c8b=_0x3f18b3[_0x4284('0x2a')]({'plain':!![]});var _0x2ab611='Intervals';return db[_0x4284('0x2b')]['destroy']({'where':{'type':_0x2ab611,'resourceId':_0x730c8b['id']}})['then'](function(){return _0x3f18b3;});})[_0x4284('0x28')](function(){_0x363c76[_0x4284('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26fcfc,_0xaa6bb0){return function(_0x586cae){if(!_0x586cae){_0x26fcfc[_0x4284('0x1b')](0x194);}return _0x586cae;};}function handleError(_0x54209b,_0x9dfb7a){_0x9dfb7a=_0x9dfb7a||0x1f4;return function(_0x3339d3){logger[_0x4284('0x2c')](_0x3339d3[_0x4284('0x2d')]);if(_0x3339d3[_0x4284('0x2e')]){delete _0x3339d3['name'];}_0x54209b[_0x4284('0x1c')](_0x9dfb7a)[_0x4284('0x2f')](_0x3339d3);};}exports['index']=function(_0x4fea17,_0x5f37d6){var _0x497b16={},_0xbb34e7={},_0xbbc90e={'count':0x0,'rows':[]};var _0x44ad77=_[_0x4284('0x30')](db[_0x4284('0x31')][_0x4284('0x32')],function(_0x51ebcb){return{'name':_0x51ebcb[_0x4284('0x33')],'type':_0x51ebcb[_0x4284('0x34')][_0x4284('0x35')]};});_0xbb34e7[_0x4284('0x36')]=_[_0x4284('0x30')](_0x44ad77,_0x4284('0x2e'));_0xbb34e7[_0x4284('0x37')]=_[_0x4284('0x38')](_0x4fea17['query']);_0xbb34e7['filters']=_[_0x4284('0x39')](_0xbb34e7[_0x4284('0x36')],_0xbb34e7['query']);_0x497b16[_0x4284('0x3a')]=_[_0x4284('0x39')](_0xbb34e7[_0x4284('0x36')],qs[_0x4284('0x3b')](_0x4fea17['query']['fields']));_0x497b16[_0x4284('0x3a')]=_0x497b16[_0x4284('0x3a')]['length']?_0x497b16['attributes']:_0xbb34e7[_0x4284('0x36')];if(!_0x4fea17[_0x4284('0x37')][_0x4284('0x3c')](_0x4284('0x3d'))){_0x497b16[_0x4284('0x21')]=qs[_0x4284('0x21')](_0x4fea17[_0x4284('0x37')]['limit']);_0x497b16[_0x4284('0x1f')]=qs['offset'](_0x4fea17[_0x4284('0x37')][_0x4284('0x1f')]);}_0x497b16[_0x4284('0x3e')]=qs[_0x4284('0x3f')](_0x4fea17[_0x4284('0x37')][_0x4284('0x3f')]);_0x497b16[_0x4284('0x40')]=qs['filters'](_[_0x4284('0x41')](_0x4fea17[_0x4284('0x37')],_0xbb34e7[_0x4284('0x42')]),_0x44ad77);if(_0x4fea17[_0x4284('0x37')]['filter']){_0x497b16[_0x4284('0x40')]=_[_0x4284('0x43')](_0x497b16[_0x4284('0x40')],{'$or':_[_0x4284('0x30')](_0x44ad77,function(_0x2b642e){if(_0x2b642e[_0x4284('0x34')]!==_0x4284('0x44')){var _0x47b645={};_0x47b645[_0x2b642e[_0x4284('0x2e')]]={'$like':'%'+_0x4fea17['query'][_0x4284('0x45')]+'%'};return _0x47b645;}})});}_0x497b16=_[_0x4284('0x43')]({},_0x497b16,_0x4fea17['options']);var _0x1a88ae={'where':_0x497b16[_0x4284('0x40')]};return db[_0x4284('0x31')][_0x4284('0x22')](_0x1a88ae)[_0x4284('0x28')](function(_0x159996){_0xbbc90e[_0x4284('0x22')]=_0x159996;if(_0x4fea17[_0x4284('0x37')][_0x4284('0x46')]){_0x497b16[_0x4284('0x47')]=[{'all':!![]}];}return db[_0x4284('0x31')][_0x4284('0x48')](_0x497b16);})[_0x4284('0x28')](function(_0x5025a2){_0xbbc90e[_0x4284('0x49')]=_0x5025a2;return _0xbbc90e;})[_0x4284('0x28')](respondWithFilteredResult(_0x5f37d6,_0x497b16))[_0x4284('0x4a')](handleError(_0x5f37d6,null));};exports[_0x4284('0x4b')]=function(_0x24996c,_0x51da69){var _0x4c4b01={'raw':!![],'where':{'id':_0x24996c['params']['id']}},_0x159439={};_0x159439[_0x4284('0x36')]=_[_0x4284('0x38')](db[_0x4284('0x31')][_0x4284('0x32')]);_0x159439[_0x4284('0x37')]=_[_0x4284('0x38')](_0x24996c[_0x4284('0x37')]);_0x159439[_0x4284('0x42')]=_[_0x4284('0x39')](_0x159439[_0x4284('0x36')],_0x159439['query']);_0x4c4b01[_0x4284('0x3a')]=_[_0x4284('0x39')](_0x159439[_0x4284('0x36')],qs[_0x4284('0x3b')](_0x24996c[_0x4284('0x37')][_0x4284('0x3b')]));_0x4c4b01[_0x4284('0x3a')]=_0x4c4b01[_0x4284('0x3a')][_0x4284('0x4c')]?_0x4c4b01['attributes']:_0x159439[_0x4284('0x36')];if(_0x24996c[_0x4284('0x37')][_0x4284('0x46')]){_0x4c4b01[_0x4284('0x47')]=[{'all':!![]}];}_0x4c4b01=_[_0x4284('0x43')]({},_0x4c4b01,_0x24996c['options']);return db[_0x4284('0x31')][_0x4284('0x4d')](_0x4c4b01)[_0x4284('0x28')](handleEntityNotFound(_0x51da69,null))[_0x4284('0x28')](respondWithResult(_0x51da69,null))[_0x4284('0x4a')](handleError(_0x51da69,null));};exports[_0x4284('0x4e')]=function(_0x4c1e71,_0x220496){return db[_0x4284('0x31')][_0x4284('0x4e')](_0x4c1e71[_0x4284('0x4f')],{})[_0x4284('0x28')](function(_0x360ead){var _0x493415=_0x4c1e71['user'][_0x4284('0x2a')]({'plain':!![]});if(!_0x493415)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x493415[_0x4284('0x50')]===_0x4284('0x51')){var _0x4e43a9=_0x360ead['get']({'plain':!![]});var _0x5c2981=_0x4284('0x52');return db[_0x4284('0x53')][_0x4284('0x4d')]({'where':{'name':_0x5c2981,'userProfileId':_0x493415['userProfileId']},'raw':!![]})[_0x4284('0x28')](function(_0x4df1ce){if(_0x4df1ce&&_0x4df1ce[_0x4284('0x54')]===0x0){return db[_0x4284('0x2b')]['create']({'name':_0x4e43a9[_0x4284('0x2e')],'resourceId':_0x4e43a9['id'],'type':_0x4df1ce[_0x4284('0x2e')],'sectionId':_0x4df1ce['id']},{})[_0x4284('0x28')](function(){return _0x360ead;});}else{return _0x360ead;}})[_0x4284('0x4a')](function(_0x4a1bc0){logger['error'](_0x4284('0x55'),_0x4a1bc0);throw _0x4a1bc0;});}return _0x360ead;})['then'](respondWithResult(_0x220496,0xc9))[_0x4284('0x4a')](handleError(_0x220496,null));};exports[_0x4284('0x27')]=function(_0x3614a8,_0x1c9c49){if(_0x3614a8['body']['id']){delete _0x3614a8['body']['id'];}return db[_0x4284('0x31')]['find']({'where':{'id':_0x3614a8['params']['id']}})[_0x4284('0x28')](handleEntityNotFound(_0x1c9c49,null))[_0x4284('0x28')](saveUpdates(_0x3614a8[_0x4284('0x4f')],null))['then'](respondWithResult(_0x1c9c49,null))[_0x4284('0x4a')](handleError(_0x1c9c49,null));};exports[_0x4284('0x29')]=function(_0x282801,_0x31962d){return db[_0x4284('0x31')]['find']({'where':{'id':_0x282801[_0x4284('0x56')]['id']}})[_0x4284('0x28')](handleEntityNotFound(_0x31962d,null))[_0x4284('0x28')](removeEntity(_0x31962d,null))[_0x4284('0x4a')](handleError(_0x31962d,null));};exports['addInterval']=function(_0x1fdfd2,_0x17e05c,_0x502d28){if(_0x1fdfd2[_0x4284('0x4f')]['id']){delete _0x1fdfd2[_0x4284('0x4f')]['id'];}return db[_0x4284('0x31')][_0x4284('0x4d')]({'where':{'id':_0x1fdfd2[_0x4284('0x56')]['id']}})['then'](handleEntityNotFound(_0x17e05c,null))['then'](function(_0x221e67){if(_0x221e67){_0x1fdfd2[_0x4284('0x4f')][_0x4284('0x57')]=_0x221e67['id'];return db[_0x4284('0x31')]['create'](_0x1fdfd2[_0x4284('0x4f')]);}})['then'](respondWithResult(_0x17e05c,null))[_0x4284('0x4a')](handleError(_0x17e05c,null));};exports[_0x4284('0x58')]=function(_0x261829,_0x13aa1f,_0x3935d5){var _0x99b102={};var _0x4f9330={};var _0x241ea1;var _0xda020;return db[_0x4284('0x31')][_0x4284('0x59')]({'where':{'id':_0x261829[_0x4284('0x56')]['id']}})[_0x4284('0x28')](handleEntityNotFound(_0x13aa1f,null))[_0x4284('0x28')](function(_0x4d573b){if(_0x4d573b){_0x241ea1=_0x4d573b;_0x4f9330[_0x4284('0x36')]=_[_0x4284('0x38')](db['Interval']['rawAttributes']);_0x4f9330[_0x4284('0x37')]=_[_0x4284('0x38')](_0x261829[_0x4284('0x37')]);_0x4f9330[_0x4284('0x42')]=_['intersection'](_0x4f9330[_0x4284('0x36')],_0x4f9330[_0x4284('0x37')]);_0x99b102[_0x4284('0x3a')]=_[_0x4284('0x39')](_0x4f9330[_0x4284('0x36')],qs[_0x4284('0x3b')](_0x261829[_0x4284('0x37')][_0x4284('0x3b')]));_0x99b102[_0x4284('0x3a')]=_0x99b102[_0x4284('0x3a')][_0x4284('0x4c')]?_0x99b102['attributes']:_0x4f9330[_0x4284('0x36')];_0x99b102[_0x4284('0x3e')]=qs[_0x4284('0x3f')](_0x261829[_0x4284('0x37')][_0x4284('0x3f')]);_0x99b102[_0x4284('0x40')]=qs[_0x4284('0x42')](_[_0x4284('0x41')](_0x261829[_0x4284('0x37')],_0x4f9330[_0x4284('0x42')]));if(_0x261829[_0x4284('0x37')][_0x4284('0x45')]){_0x99b102['where']=_[_0x4284('0x43')](_0x99b102[_0x4284('0x40')],{'$or':_[_0x4284('0x30')](_0x99b102[_0x4284('0x3a')],function(_0xba28d3){var _0xe4e24f={};_0xe4e24f[_0xba28d3]={'$like':'%'+_0x261829[_0x4284('0x37')][_0x4284('0x45')]+'%'};return _0xe4e24f;})});}_0x99b102=_[_0x4284('0x43')]({},_0x99b102,_0x261829[_0x4284('0x5a')]);return _0x241ea1[_0x4284('0x58')](_0x99b102);}})['then'](function(_0x4821c4){if(_0x4821c4){_0xda020=_0x4821c4[_0x4284('0x4c')];if(!_0x261829[_0x4284('0x37')][_0x4284('0x3c')](_0x4284('0x3d'))){_0x99b102[_0x4284('0x21')]=qs[_0x4284('0x21')](_0x261829[_0x4284('0x37')][_0x4284('0x21')]);_0x99b102['offset']=qs[_0x4284('0x1f')](_0x261829[_0x4284('0x37')][_0x4284('0x1f')]);}return _0x241ea1[_0x4284('0x58')](_0x99b102);}})['then'](function(_0x55e603){if(_0x55e603){return _0x55e603?{'count':_0xda020,'rows':_0x55e603}:null;}})['then'](respondWithResult(_0x13aa1f,null))[_0x4284('0x4a')](handleError(_0x13aa1f,null));};exports[_0x4284('0x5b')]=function(_0x2e17ae,_0x34a50b,_0x3e65c0){return db['Interval']['findOne']({'where':{'id':_0x2e17ae[_0x4284('0x56')]['id']}})[_0x4284('0x28')](handleEntityNotFound(_0x34a50b,null))[_0x4284('0x28')](function(_0x5621cd){if(_0x5621cd){return db[_0x4284('0x5c')][_0x4284('0x5d')](function(_0x1e843e){return db[_0x4284('0x31')][_0x4284('0x29')]({'where':{'IntervalId':_0x2e17ae[_0x4284('0x56')]['id']},'transaction':_0x1e843e})[_0x4284('0x28')](function(_0x258c77){var _0x2910d5=_[_0x4284('0x30')](_0x2e17ae['body'],function(_0x4b1720){delete _0x4b1720['id'];_0x4b1720[_0x4284('0x57')]=_0x2e17ae[_0x4284('0x56')]['id'];return _0x4b1720;});return db[_0x4284('0x31')][_0x4284('0x5e')](_0x2910d5,{'transaction':_0x1e843e});});})[_0x4284('0x28')](function(){return db[_0x4284('0x31')][_0x4284('0x48')]({'where':{'IntervalId':_0x2e17ae['params']['id']}});});}})[_0x4284('0x28')](respondWithResult(_0x34a50b,null))[_0x4284('0x4a')](handleError(_0x34a50b,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 3331edb..0ee0b48 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 _0xfbf0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','tools_intervals','rewrite','util'];(function(_0x17c283,_0x587fcc){var _0x4e0800=function(_0x537bc3){while(--_0x537bc3){_0x17c283['push'](_0x17c283['shift']());}};_0x4e0800(++_0x587fcc);}(_0xfbf0,0x187));var _0x0fbf=function(_0x20c9b2,_0x55d7b1){_0x20c9b2=_0x20c9b2-0x0;var _0x2c6030=_0xfbf0[_0x20c9b2];return _0x2c6030;};'use strict';var _=require('lodash');var util=require(_0x0fbf('0x0'));var logger=require('../../config/logger')(_0x0fbf('0x1'));var moment=require(_0x0fbf('0x2'));var BPromise=require(_0x0fbf('0x3'));var rp=require(_0x0fbf('0x4'));var fs=require('fs');var path=require(_0x0fbf('0x5'));var rimraf=require(_0x0fbf('0x6'));var config=require(_0x0fbf('0x7'));var attributes=require(_0x0fbf('0x8'));var extensions=require(_0x0fbf('0x9'));module[_0x0fbf('0xa')]=function(_0x224098,_0x17acc8){return _0x224098[_0x0fbf('0xb')]('Interval',attributes,{'tableName':_0x0fbf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x34d95a,_0x13bc92){extensions[_0x0fbf('0xd')](_0x224098,_0x34d95a);},'afterBulkCreate':function(_0x596a2e,_0x173e55,_0x2ab28c){_0x2ab28c();extensions['rewrite'](_0x224098,_0x596a2e[0x0]);},'afterUpdate':function(_0x5eefca,_0x13e1aa){extensions[_0x0fbf('0xd')](_0x224098,_0x5eefca);},'afterDestroy':function(_0x20ed13,_0x4586f4){extensions[_0x0fbf('0xd')](_0x224098,_0x20ed13);}}});}; \ No newline at end of file +var _0xec3f=['bluebird','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api','moment'];(function(_0xa89f26,_0x53b9be){var _0x3df3bb=function(_0x5f502b){while(--_0x5f502b){_0xa89f26['push'](_0xa89f26['shift']());}};_0x3df3bb(++_0x53b9be);}(_0xec3f,0xdb));var _0xfec3=function(_0x3288e9,_0x273acf){_0x3288e9=_0x3288e9-0x0;var _0x3def59=_0xec3f[_0x3288e9];return _0x3def59;};'use strict';var _=require(_0xfec3('0x0'));var util=require(_0xfec3('0x1'));var logger=require(_0xfec3('0x2'))(_0xfec3('0x3'));var moment=require(_0xfec3('0x4'));var BPromise=require(_0xfec3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfec3('0x6'));var rimraf=require('rimraf');var config=require(_0xfec3('0x7'));var attributes=require(_0xfec3('0x8'));var extensions=require(_0xfec3('0x9'));module[_0xfec3('0xa')]=function(_0x2c9cb5,_0x448462){return _0x2c9cb5['define'](_0xfec3('0xb'),attributes,{'tableName':_0xfec3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x472120,_0x4b27fd){extensions[_0xfec3('0xd')](_0x2c9cb5,_0x472120);},'afterBulkCreate':function(_0x5797c,_0xddafe7,_0x4fabef){_0x4fabef();extensions[_0xfec3('0xd')](_0x2c9cb5,_0x5797c[0x0]);},'afterUpdate':function(_0x4c85e5,_0x267115){extensions[_0xfec3('0xd')](_0x2c9cb5,_0x4c85e5);},'afterDestroy':function(_0x325b46,_0x537378){extensions[_0xfec3('0xd')](_0x2c9cb5,_0x325b46);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 396c592..12921bf 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(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 65602df..39b77c1 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x20e259,_0x519610){var _0x135622=function(_0x53550d){while(--_0x53550d){_0x20e259['push'](_0x20e259['shift']());}};_0x135622(++_0x519610);}(_0x2ef3,0xba));var _0x32ef=function(_0x4378b8,_0x12cde8){_0x4378b8=_0x4378b8-0x0;var _0x1b3c6e=_0x2ef3[_0x4378b8];return _0x1b3c6e;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb10b,0x12a));var _0xbb10=function(_0x55b3b5,_0x254983){_0x55b3b5=_0x55b3b5-0x0;var _0x5297a9=_0xb10b[_0x55b3b5];return _0x5297a9;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('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 c884276..d49c75d 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 _0x55a0=['status','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','key','summary','Report','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','application/json','Basic\x20','toString','request','utf8','data','end','statusCode','parse','error'];(function(_0x1a5b61,_0x367c99){var _0x2479e5=function(_0x56d3e4){while(--_0x56d3e4){_0x1a5b61['push'](_0x1a5b61['shift']());}};_0x2479e5(++_0x367c99);}(_0x55a0,0xbb));var _0x055a=function(_0x1c1c5e,_0x270b07){_0x1c1c5e=_0x1c1c5e-0x0;var _0x236279=_0x55a0[_0x1c1c5e];return _0x236279;};'use strict';var BPromise=require(_0x055a('0x0'));var https=require(_0x055a('0x1'));var logger=require(_0x055a('0x2'))(_0x055a('0x3'));var USERNAME=_0x055a('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x21605b,_0x4afbf6){var _0x57bb0b={'fields':{'project':{'key':_0x21605b[_0x055a('0x5')]||'MOTGUI'},'summary':(_0x21605b[_0x055a('0x6')]||_0x055a('0x7'))+'\x20from\x20'+_0x21605b['ip'],'description':_0x21605b['description']||JSON[_0x055a('0x8')](_0x21605b),'issuetype':{'name':_0x21605b[_0x055a('0x9')]||_0x055a('0xa')}}};_0x57bb0b[_0x055a('0xb')][_0x055a('0xc')]=_0x21605b[_0x055a('0xd')];_0x57bb0b[_0x055a('0xb')][_0x055a('0xe')]=_0x21605b[_0x055a('0xf')];_0x57bb0b[_0x055a('0xb')][_0x055a('0x10')]=_0x21605b[_0x055a('0x11')];_0x57bb0b[_0x055a('0xb')]['customfield_11503']=_0x21605b[_0x055a('0x12')];_0x57bb0b[_0x055a('0xb')][_0x055a('0x13')]=_0x21605b[_0x055a('0x14')];_0x57bb0b[_0x055a('0xb')][_0x055a('0x15')]=_0x21605b['ip'];var _0x3f685c={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x055a('0x16'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x055a('0x17'),'Authorization':_0x055a('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x055a('0x19')]('base64')}};var _0x7e555c=JSON[_0x055a('0x8')](_0x57bb0b);var _0x1cde42=https[_0x055a('0x1a')](_0x3f685c,function(_0x2e3fa9){_0x2e3fa9['setEncoding'](_0x055a('0x1b'));var _0x56ef3e='';_0x2e3fa9['on'](_0x055a('0x1c'),function(_0x389c5c){_0x56ef3e+=_0x389c5c;});_0x2e3fa9['on'](_0x055a('0x1d'),function(){if(_0x4afbf6){return _0x4afbf6['status'](_0x2e3fa9[_0x055a('0x1e')])['json'](JSON[_0x055a('0x1f')](_0x56ef3e));}});});_0x1cde42['on'](_0x055a('0x20'),function(_0x479531){if(_0x4afbf6){return _0x4afbf6[_0x055a('0x21')](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x055a('0x22')}]});}});_0x1cde42[_0x055a('0x23')](_0x7e555c);_0x1cde42[_0x055a('0x1d')]();}exports[_0x055a('0x24')]=openIssue;exports[_0x055a('0x25')]=function(_0x1e9d76,_0x368bd5){_0x1e9d76[_0x055a('0x26')]['ip']=_0x1e9d76[_0x055a('0x27')][_0x055a('0x28')]||_0x1e9d76[_0x055a('0x29')][_0x055a('0x2a')]||_0x1e9d76['socket'][_0x055a('0x2a')]||_0x1e9d76[_0x055a('0x29')][_0x055a('0x2b')][_0x055a('0x2a')];return openIssue(_0x1e9d76['body'],_0x368bd5);}; \ No newline at end of file +var _0x3a74=['support','3eAmWpBVP0','key','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','toString','request','setEncoding','utf8','data','status','statusCode','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','send','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a74,0x110));var _0x43a7=function(_0x344992,_0x36511a){_0x344992=_0x344992-0x0;var _0x1342e5=_0x3a74[_0x344992];return _0x1342e5;};'use strict';var BPromise=require(_0x43a7('0x0'));var https=require(_0x43a7('0x1'));var logger=require(_0x43a7('0x2'))(_0x43a7('0x3'));var USERNAME=_0x43a7('0x4');var PASSWORD=_0x43a7('0x5');function openIssue(_0x541e95,_0x50b200){var _0x87e8ef={'fields':{'project':{'key':_0x541e95[_0x43a7('0x6')]||'MOTGUI'},'summary':(_0x541e95[_0x43a7('0x7')]||_0x43a7('0x8'))+'\x20from\x20'+_0x541e95['ip'],'description':_0x541e95[_0x43a7('0x9')]||JSON[_0x43a7('0xa')](_0x541e95),'issuetype':{'name':_0x541e95[_0x43a7('0xb')]||_0x43a7('0xc')}}};_0x87e8ef[_0x43a7('0xd')][_0x43a7('0xe')]=_0x541e95[_0x43a7('0xf')];_0x87e8ef[_0x43a7('0xd')][_0x43a7('0x10')]=_0x541e95['oldToken'];_0x87e8ef[_0x43a7('0xd')][_0x43a7('0x11')]=_0x541e95[_0x43a7('0x12')];_0x87e8ef[_0x43a7('0xd')]['customfield_11503']=_0x541e95[_0x43a7('0x13')];_0x87e8ef[_0x43a7('0xd')][_0x43a7('0x14')]=_0x541e95[_0x43a7('0x15')];_0x87e8ef[_0x43a7('0xd')][_0x43a7('0x16')]=_0x541e95['ip'];var _0x29d4e0={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x43a7('0x17'),'method':_0x43a7('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0x43a7('0x19'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x43a7('0x1a')]('base64')}};var _0x342efa=JSON[_0x43a7('0xa')](_0x87e8ef);var _0x408f4f=https[_0x43a7('0x1b')](_0x29d4e0,function(_0x33fae2){_0x33fae2[_0x43a7('0x1c')](_0x43a7('0x1d'));var _0x3be68a='';_0x33fae2['on'](_0x43a7('0x1e'),function(_0x3c440f){_0x3be68a+=_0x3c440f;});_0x33fae2['on']('end',function(){if(_0x50b200){return _0x50b200[_0x43a7('0x1f')](_0x33fae2[_0x43a7('0x20')])['json'](JSON[_0x43a7('0x21')](_0x3be68a));}});});_0x408f4f['on']('error',function(_0x43c100){if(_0x50b200){return _0x50b200[_0x43a7('0x1f')](0x1f4)[_0x43a7('0x22')]({'errors':[{'message':_0x43a7('0x23'),'type':_0x43a7('0x24')}]});}});_0x408f4f[_0x43a7('0x25')](_0x342efa);_0x408f4f[_0x43a7('0x26')]();}exports[_0x43a7('0x27')]=openIssue;exports[_0x43a7('0x28')]=function(_0x5730cd,_0x4bcbba){_0x5730cd[_0x43a7('0x29')]['ip']=_0x5730cd['headers'][_0x43a7('0x2a')]||_0x5730cd[_0x43a7('0x2b')][_0x43a7('0x2c')]||_0x5730cd['socket'][_0x43a7('0x2c')]||_0x5730cd[_0x43a7('0x2b')][_0x43a7('0x2d')][_0x43a7('0x2c')];return openIssue(_0x5730cd[_0x43a7('0x29')],_0x4bcbba);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 783e52c..d8dbc19 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 _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x37ec87,_0x6e5fb8){var _0xdf586a=function(_0x2048c2){while(--_0x2048c2){_0x37ec87['push'](_0x37ec87['shift']());}};_0xdf586a(++_0x6e5fb8);}(_0xe706,0xa3));var _0x6e70=function(_0x27e2c8,_0x5f40a0){_0x27e2c8=_0x27e2c8-0x0;var _0x5454d4=_0xe706[_0x27e2c8];return _0x5454d4;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0x668b=['get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','index'];(function(_0x2ce497,_0x2171b4){var _0x83d068=function(_0x59ec7c){while(--_0x59ec7c){_0x2ce497['push'](_0x2ce497['shift']());}};_0x83d068(++_0x2171b4);}(_0x668b,0x140));var _0xb668=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x668b[_0x3ee1fe];return _0x1ae57a;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var controller=require(_0xb668('0x7'));router['get']('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0xa')](_0xb668('0xb'),auth[_0xb668('0x8')](),controller[_0xb668('0xc')]);router['get'](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0xe')]);router[_0xb668('0xf')]('/',auth[_0xb668('0x8')](),controller[_0xb668('0x10')]);router[_0xb668('0x11')](_0xb668('0xd'),auth['isAuthenticated'](),controller[_0xb668('0x12')]);router[_0xb668('0x13')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x14')]);module[_0xb668('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index a91fdbc..a7bd9f9 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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x7a54,0x106));var _0x47a5=function(_0x1613ed,_0x35cf37){_0x1613ed=_0x1613ed-0x0;var _0x1fb416=_0x7a54[_0x1613ed];return _0x1fb416;};'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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x3be03f,_0x264726){_0x3be03f=_0x3be03f-0x0;var _0xe8514c=_0x7a54[_0x3be03f];return _0xe8514c;};'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 5a632e7..2e0a587 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 _0xfd20=['map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','options','create','body','find','destroy','describe','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','then','end','error','stack','name','send'];(function(_0x128520,_0x32089b){var _0x1c13a8=function(_0x4956b3){while(--_0x4956b3){_0x128520['push'](_0x128520['shift']());}};_0x1c13a8(++_0x32089b);}(_0xfd20,0x66));var _0x0fd2=function(_0x479f6f,_0x1c26c4){_0x479f6f=_0x479f6f-0x0;var _0x24e701=_0xfd20[_0x479f6f];return _0x24e701;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fd2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0fd2('0x1'));var moment=require(_0x0fd2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0fd2('0x3'));var util=require('util');var path=require(_0x0fd2('0x4'));var sox=require(_0x0fd2('0x5'));var csv=require(_0x0fd2('0x6'));var ejs=require(_0x0fd2('0x7'));var fs=require('fs');var fs_extra=require(_0x0fd2('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0fd2('0x9'));var jsforce=require(_0x0fd2('0xa'));var deskjs=require(_0x0fd2('0xb'));var toCsv=require(_0x0fd2('0x6'));var querystring=require(_0x0fd2('0xc'));var Papa=require(_0x0fd2('0xd'));var Redis=require(_0x0fd2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x0fd2('0xf'));var as=require(_0x0fd2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fd2('0x11'))('api');var utils=require(_0x0fd2('0x12'));var config=require(_0x0fd2('0x13'));var licenseUtil=require(_0x0fd2('0x14'));var db=require(_0x0fd2('0x15'))['db'];function respondWithStatusCode(_0xdf592d,_0x3504cf){_0x3504cf=_0x3504cf||0xcc;return function(_0x1f7a6e){if(_0x1f7a6e){return _0xdf592d[_0x0fd2('0x16')](_0x3504cf);}return _0xdf592d['status'](_0x3504cf)['end']();};}function respondWithResult(_0x1a9acb,_0x99de24){_0x99de24=_0x99de24||0xc8;return function(_0x21dcc5){if(_0x21dcc5){return _0x1a9acb[_0x0fd2('0x17')](_0x99de24)['json'](_0x21dcc5);}};}function respondWithFilteredResult(_0x280253,_0x4f074a){return function(_0x50b723){if(_0x50b723){var _0x2b6254=typeof _0x4f074a['offset']===_0x0fd2('0x18')&&typeof _0x4f074a['limit']===_0x0fd2('0x18');var _0x4cd2bf=_0x50b723[_0x0fd2('0x19')];var _0x15c9de=_0x2b6254?0x0:_0x4f074a['offset'];var _0x2b25d2=_0x2b6254?_0x50b723['count']:_0x4f074a[_0x0fd2('0x1a')]+_0x4f074a[_0x0fd2('0x1b')];var _0x3fb07e;if(_0x2b25d2>=_0x4cd2bf){_0x2b25d2=_0x4cd2bf;_0x3fb07e=0xc8;}else{_0x3fb07e=0xce;}_0x280253[_0x0fd2('0x17')](_0x3fb07e);return _0x280253[_0x0fd2('0x1c')](_0x0fd2('0x1d'),_0x15c9de+'-'+_0x2b25d2+'/'+_0x4cd2bf)[_0x0fd2('0x1e')](_0x50b723);}return null;};}function patchUpdates(_0x1a72ca){return function(_0x1b848d){try{jsonpatch[_0x0fd2('0x1f')](_0x1b848d,_0x1a72ca,!![]);}catch(_0x5c50ad){return BPromise['reject'](_0x5c50ad);}return _0x1b848d['save']();};}function saveUpdates(_0x4156d2,_0x36072a){return function(_0x53ab17){if(_0x53ab17){return _0x53ab17['update'](_0x4156d2)[_0x0fd2('0x20')](function(_0x25563c){return _0x25563c;});}return null;};}function removeEntity(_0x6be8d8,_0x29398f){return function(_0x25cdd2){if(_0x25cdd2){return _0x25cdd2['destroy']()[_0x0fd2('0x20')](function(){_0x6be8d8[_0x0fd2('0x17')](0xcc)[_0x0fd2('0x21')]();});}};}function handleEntityNotFound(_0x54cce1,_0x4c77a8){return function(_0x11bb10){if(!_0x11bb10){_0x54cce1[_0x0fd2('0x16')](0x194);}return _0x11bb10;};}function handleError(_0x4d0924,_0x400133){_0x400133=_0x400133||0x1f4;return function(_0x429fef){logger[_0x0fd2('0x22')](_0x429fef[_0x0fd2('0x23')]);if(_0x429fef[_0x0fd2('0x24')]){delete _0x429fef[_0x0fd2('0x24')];}_0x4d0924[_0x0fd2('0x17')](_0x400133)[_0x0fd2('0x25')](_0x429fef);};}exports['index']=function(_0x37d519,_0x434018){var _0x235c90={},_0x1ca259={},_0x33cf1a={'count':0x0,'rows':[]};var _0x564419=_[_0x0fd2('0x26')](db[_0x0fd2('0x27')][_0x0fd2('0x28')],function(_0x1a7a98){return{'name':_0x1a7a98[_0x0fd2('0x29')],'type':_0x1a7a98[_0x0fd2('0x2a')][_0x0fd2('0x2b')]};});_0x1ca259[_0x0fd2('0x2c')]=_['map'](_0x564419,_0x0fd2('0x24'));_0x1ca259['query']=_['keys'](_0x37d519[_0x0fd2('0x2d')]);_0x1ca259['filters']=_[_0x0fd2('0x2e')](_0x1ca259['model'],_0x1ca259[_0x0fd2('0x2d')]);_0x235c90['attributes']=_['intersection'](_0x1ca259[_0x0fd2('0x2c')],qs[_0x0fd2('0x2f')](_0x37d519[_0x0fd2('0x2d')]['fields']));_0x235c90['attributes']=_0x235c90[_0x0fd2('0x30')]['length']?_0x235c90[_0x0fd2('0x30')]:_0x1ca259[_0x0fd2('0x2c')];if(!_0x37d519[_0x0fd2('0x2d')][_0x0fd2('0x31')](_0x0fd2('0x32'))){_0x235c90[_0x0fd2('0x1b')]=qs[_0x0fd2('0x1b')](_0x37d519['query'][_0x0fd2('0x1b')]);_0x235c90[_0x0fd2('0x1a')]=qs['offset'](_0x37d519['query'][_0x0fd2('0x1a')]);}_0x235c90['order']=qs['sort'](_0x37d519[_0x0fd2('0x2d')][_0x0fd2('0x33')]);_0x235c90[_0x0fd2('0x34')]=qs[_0x0fd2('0x35')](_[_0x0fd2('0x36')](_0x37d519[_0x0fd2('0x2d')],_0x1ca259[_0x0fd2('0x35')]),_0x564419);if(_0x37d519[_0x0fd2('0x2d')][_0x0fd2('0x37')]){_0x235c90[_0x0fd2('0x34')]=_[_0x0fd2('0x38')](_0x235c90[_0x0fd2('0x34')],{'$or':_[_0x0fd2('0x26')](_0x564419,function(_0x3a3986){if(_0x3a3986[_0x0fd2('0x2a')]!==_0x0fd2('0x39')){var _0x50643e={};_0x50643e[_0x3a3986[_0x0fd2('0x24')]]={'$like':'%'+_0x37d519[_0x0fd2('0x2d')][_0x0fd2('0x37')]+'%'};return _0x50643e;}})});}_0x235c90=_[_0x0fd2('0x38')]({},_0x235c90,_0x37d519['options']);var _0x286543={'where':_0x235c90['where']};return db[_0x0fd2('0x27')][_0x0fd2('0x19')](_0x286543)['then'](function(_0x43e585){_0x33cf1a[_0x0fd2('0x19')]=_0x43e585;if(_0x37d519[_0x0fd2('0x2d')][_0x0fd2('0x3a')]){_0x235c90[_0x0fd2('0x3b')]=[{'all':!![]}];}return db[_0x0fd2('0x27')]['findAll'](_0x235c90);})[_0x0fd2('0x20')](function(_0x409321){_0x33cf1a[_0x0fd2('0x3c')]=_0x409321;return _0x33cf1a;})[_0x0fd2('0x20')](respondWithFilteredResult(_0x434018,_0x235c90))[_0x0fd2('0x3d')](handleError(_0x434018,null));};exports['show']=function(_0x258569,_0x2e804d){var _0x554476={'raw':!![],'where':{'id':_0x258569[_0x0fd2('0x3e')]['id']}},_0x252fb1={};_0x252fb1[_0x0fd2('0x2c')]=_[_0x0fd2('0x3f')](db[_0x0fd2('0x27')][_0x0fd2('0x28')]);_0x252fb1[_0x0fd2('0x2d')]=_[_0x0fd2('0x3f')](_0x258569['query']);_0x252fb1['filters']=_[_0x0fd2('0x2e')](_0x252fb1[_0x0fd2('0x2c')],_0x252fb1['query']);_0x554476[_0x0fd2('0x30')]=_['intersection'](_0x252fb1[_0x0fd2('0x2c')],qs[_0x0fd2('0x2f')](_0x258569[_0x0fd2('0x2d')][_0x0fd2('0x2f')]));_0x554476[_0x0fd2('0x30')]=_0x554476[_0x0fd2('0x30')]['length']?_0x554476['attributes']:_0x252fb1[_0x0fd2('0x2c')];if(_0x258569['query'][_0x0fd2('0x3a')]){_0x554476[_0x0fd2('0x3b')]=[{'all':!![]}];}_0x554476=_[_0x0fd2('0x38')]({},_0x554476,_0x258569[_0x0fd2('0x40')]);return db[_0x0fd2('0x27')]['find'](_0x554476)[_0x0fd2('0x20')](handleEntityNotFound(_0x2e804d,null))['then'](respondWithResult(_0x2e804d,null))[_0x0fd2('0x3d')](handleError(_0x2e804d,null));};exports[_0x0fd2('0x41')]=function(_0x5352cc,_0x337daa){return db['JscriptyAnswerReport']['create'](_0x5352cc[_0x0fd2('0x42')],{})[_0x0fd2('0x20')](respondWithResult(_0x337daa,0xc9))[_0x0fd2('0x3d')](handleError(_0x337daa,null));};exports['update']=function(_0x30ac02,_0x119e21){if(_0x30ac02[_0x0fd2('0x42')]['id']){delete _0x30ac02[_0x0fd2('0x42')]['id'];}return db['JscriptyAnswerReport'][_0x0fd2('0x43')]({'where':{'id':_0x30ac02[_0x0fd2('0x3e')]['id']}})[_0x0fd2('0x20')](handleEntityNotFound(_0x119e21,null))[_0x0fd2('0x20')](saveUpdates(_0x30ac02[_0x0fd2('0x42')],null))[_0x0fd2('0x20')](respondWithResult(_0x119e21,null))[_0x0fd2('0x3d')](handleError(_0x119e21,null));};exports[_0x0fd2('0x44')]=function(_0x2377bd,_0x4322b4){return db[_0x0fd2('0x27')]['find']({'where':{'id':_0x2377bd[_0x0fd2('0x3e')]['id']}})[_0x0fd2('0x20')](handleEntityNotFound(_0x4322b4,null))['then'](removeEntity(_0x4322b4,null))[_0x0fd2('0x3d')](handleError(_0x4322b4,null));};exports['describe']=function(_0x19650c,_0x5193b7){return db[_0x0fd2('0x27')][_0x0fd2('0x45')]()[_0x0fd2('0x20')](respondWithResult(_0x5193b7,null))['catch'](handleError(_0x5193b7,null));}; \ No newline at end of file +var _0xafb9=['fieldName','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','rawAttributes','create','body','update','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','stack','send','index','map','JscriptyAnswerReport'];(function(_0x29d986,_0x29f7dd){var _0x31e2c3=function(_0x1cb574){while(--_0x1cb574){_0x29d986['push'](_0x29d986['shift']());}};_0x31e2c3(++_0x29f7dd);}(_0xafb9,0x68));var _0x9afb=function(_0xbfb3ef,_0x34a60f){_0xbfb3ef=_0xbfb3ef-0x0;var _0x1cc527=_0xafb9[_0xbfb3ef];return _0x1cc527;};'use strict';var emlformat=require(_0x9afb('0x0'));var rimraf=require(_0x9afb('0x1'));var zipdir=require(_0x9afb('0x2'));var jsonpatch=require(_0x9afb('0x3'));var rp=require(_0x9afb('0x4'));var moment=require(_0x9afb('0x5'));var BPromise=require(_0x9afb('0x6'));var Mustache=require(_0x9afb('0x7'));var util=require(_0x9afb('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x9afb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9afb('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x9afb('0xb'));var jsforce=require(_0x9afb('0xc'));var deskjs=require(_0x9afb('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9afb('0xe'));var Papa=require(_0x9afb('0xf'));var Redis=require(_0x9afb('0x10'));var authService=require(_0x9afb('0x11'));var qs=require(_0x9afb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9afb('0x13'))(_0x9afb('0x14'));var utils=require(_0x9afb('0x15'));var config=require(_0x9afb('0x16'));var licenseUtil=require(_0x9afb('0x17'));var db=require(_0x9afb('0x18'))['db'];function respondWithStatusCode(_0x374094,_0x34e849){_0x34e849=_0x34e849||0xcc;return function(_0x464462){if(_0x464462){return _0x374094[_0x9afb('0x19')](_0x34e849);}return _0x374094['status'](_0x34e849)[_0x9afb('0x1a')]();};}function respondWithResult(_0x572a02,_0x59fd82){_0x59fd82=_0x59fd82||0xc8;return function(_0x2f286f){if(_0x2f286f){return _0x572a02[_0x9afb('0x1b')](_0x59fd82)[_0x9afb('0x1c')](_0x2f286f);}};}function respondWithFilteredResult(_0x2d664d,_0x46b16f){return function(_0x39cdf1){if(_0x39cdf1){var _0xd111f1=typeof _0x46b16f['offset']===_0x9afb('0x1d')&&typeof _0x46b16f[_0x9afb('0x1e')]===_0x9afb('0x1d');var _0x190cb8=_0x39cdf1[_0x9afb('0x1f')];var _0x508433=_0xd111f1?0x0:_0x46b16f[_0x9afb('0x20')];var _0x50a7e4=_0xd111f1?_0x39cdf1[_0x9afb('0x1f')]:_0x46b16f[_0x9afb('0x20')]+_0x46b16f['limit'];var _0x4a1c74;if(_0x50a7e4>=_0x190cb8){_0x50a7e4=_0x190cb8;_0x4a1c74=0xc8;}else{_0x4a1c74=0xce;}_0x2d664d[_0x9afb('0x1b')](_0x4a1c74);return _0x2d664d[_0x9afb('0x21')](_0x9afb('0x22'),_0x508433+'-'+_0x50a7e4+'/'+_0x190cb8)[_0x9afb('0x1c')](_0x39cdf1);}return null;};}function patchUpdates(_0x3bd256){return function(_0x57b4e2){try{jsonpatch[_0x9afb('0x23')](_0x57b4e2,_0x3bd256,!![]);}catch(_0x4dc307){return BPromise['reject'](_0x4dc307);}return _0x57b4e2[_0x9afb('0x24')]();};}function saveUpdates(_0x3c3e48,_0x3d67bb){return function(_0x2d3938){if(_0x2d3938){return _0x2d3938['update'](_0x3c3e48)[_0x9afb('0x25')](function(_0x725a04){return _0x725a04;});}return null;};}function removeEntity(_0x49ba5f,_0x571bd9){return function(_0x5b5dab){if(_0x5b5dab){return _0x5b5dab[_0x9afb('0x26')]()['then'](function(){_0x49ba5f[_0x9afb('0x1b')](0xcc)[_0x9afb('0x1a')]();});}};}function handleEntityNotFound(_0x50a919,_0x324293){return function(_0x28beba){if(!_0x28beba){_0x50a919[_0x9afb('0x19')](0x194);}return _0x28beba;};}function handleError(_0x337d81,_0x530fbe){_0x530fbe=_0x530fbe||0x1f4;return function(_0x348255){logger['error'](_0x348255[_0x9afb('0x27')]);if(_0x348255['name']){delete _0x348255['name'];}_0x337d81[_0x9afb('0x1b')](_0x530fbe)[_0x9afb('0x28')](_0x348255);};}exports[_0x9afb('0x29')]=function(_0x13a33e,_0x119e04){var _0x3e3f57={},_0x46673d={},_0x5aabd5={'count':0x0,'rows':[]};var _0x494ef8=_[_0x9afb('0x2a')](db[_0x9afb('0x2b')]['rawAttributes'],function(_0x1d0bed){return{'name':_0x1d0bed[_0x9afb('0x2c')],'type':_0x1d0bed['type'][_0x9afb('0x2d')]};});_0x46673d[_0x9afb('0x2e')]=_[_0x9afb('0x2a')](_0x494ef8,_0x9afb('0x2f'));_0x46673d[_0x9afb('0x30')]=_[_0x9afb('0x31')](_0x13a33e[_0x9afb('0x30')]);_0x46673d[_0x9afb('0x32')]=_['intersection'](_0x46673d['model'],_0x46673d[_0x9afb('0x30')]);_0x3e3f57[_0x9afb('0x33')]=_[_0x9afb('0x34')](_0x46673d[_0x9afb('0x2e')],qs[_0x9afb('0x35')](_0x13a33e[_0x9afb('0x30')][_0x9afb('0x35')]));_0x3e3f57['attributes']=_0x3e3f57['attributes'][_0x9afb('0x36')]?_0x3e3f57[_0x9afb('0x33')]:_0x46673d['model'];if(!_0x13a33e[_0x9afb('0x30')]['hasOwnProperty'](_0x9afb('0x37'))){_0x3e3f57[_0x9afb('0x1e')]=qs['limit'](_0x13a33e[_0x9afb('0x30')]['limit']);_0x3e3f57[_0x9afb('0x20')]=qs[_0x9afb('0x20')](_0x13a33e[_0x9afb('0x30')][_0x9afb('0x20')]);}_0x3e3f57[_0x9afb('0x38')]=qs[_0x9afb('0x39')](_0x13a33e[_0x9afb('0x30')][_0x9afb('0x39')]);_0x3e3f57['where']=qs[_0x9afb('0x32')](_['pick'](_0x13a33e[_0x9afb('0x30')],_0x46673d[_0x9afb('0x32')]),_0x494ef8);if(_0x13a33e[_0x9afb('0x30')][_0x9afb('0x3a')]){_0x3e3f57[_0x9afb('0x3b')]=_[_0x9afb('0x3c')](_0x3e3f57[_0x9afb('0x3b')],{'$or':_[_0x9afb('0x2a')](_0x494ef8,function(_0x2433f0){if(_0x2433f0['type']!==_0x9afb('0x3d')){var _0x56f8d9={};_0x56f8d9[_0x2433f0[_0x9afb('0x2f')]]={'$like':'%'+_0x13a33e[_0x9afb('0x30')][_0x9afb('0x3a')]+'%'};return _0x56f8d9;}})});}_0x3e3f57=_['merge']({},_0x3e3f57,_0x13a33e[_0x9afb('0x3e')]);var _0xaf29dc={'where':_0x3e3f57[_0x9afb('0x3b')]};return db[_0x9afb('0x2b')][_0x9afb('0x1f')](_0xaf29dc)[_0x9afb('0x25')](function(_0x1e210a){_0x5aabd5['count']=_0x1e210a;if(_0x13a33e[_0x9afb('0x30')][_0x9afb('0x3f')]){_0x3e3f57[_0x9afb('0x40')]=[{'all':!![]}];}return db[_0x9afb('0x2b')][_0x9afb('0x41')](_0x3e3f57);})[_0x9afb('0x25')](function(_0x90bb7f){_0x5aabd5[_0x9afb('0x42')]=_0x90bb7f;return _0x5aabd5;})['then'](respondWithFilteredResult(_0x119e04,_0x3e3f57))[_0x9afb('0x43')](handleError(_0x119e04,null));};exports['show']=function(_0x47a735,_0x5ccc95){var _0xc72355={'raw':!![],'where':{'id':_0x47a735['params']['id']}},_0x3250c9={};_0x3250c9[_0x9afb('0x2e')]=_[_0x9afb('0x31')](db[_0x9afb('0x2b')][_0x9afb('0x44')]);_0x3250c9[_0x9afb('0x30')]=_[_0x9afb('0x31')](_0x47a735[_0x9afb('0x30')]);_0x3250c9[_0x9afb('0x32')]=_[_0x9afb('0x34')](_0x3250c9['model'],_0x3250c9[_0x9afb('0x30')]);_0xc72355[_0x9afb('0x33')]=_[_0x9afb('0x34')](_0x3250c9[_0x9afb('0x2e')],qs['fields'](_0x47a735[_0x9afb('0x30')][_0x9afb('0x35')]));_0xc72355[_0x9afb('0x33')]=_0xc72355['attributes'][_0x9afb('0x36')]?_0xc72355[_0x9afb('0x33')]:_0x3250c9[_0x9afb('0x2e')];if(_0x47a735[_0x9afb('0x30')][_0x9afb('0x3f')]){_0xc72355[_0x9afb('0x40')]=[{'all':!![]}];}_0xc72355=_[_0x9afb('0x3c')]({},_0xc72355,_0x47a735['options']);return db['JscriptyAnswerReport']['find'](_0xc72355)[_0x9afb('0x25')](handleEntityNotFound(_0x5ccc95,null))[_0x9afb('0x25')](respondWithResult(_0x5ccc95,null))['catch'](handleError(_0x5ccc95,null));};exports[_0x9afb('0x45')]=function(_0xdcfefd,_0x26e88a){return db[_0x9afb('0x2b')][_0x9afb('0x45')](_0xdcfefd[_0x9afb('0x46')],{})[_0x9afb('0x25')](respondWithResult(_0x26e88a,0xc9))[_0x9afb('0x43')](handleError(_0x26e88a,null));};exports[_0x9afb('0x47')]=function(_0x215764,_0x12594c){if(_0x215764['body']['id']){delete _0x215764['body']['id'];}return db[_0x9afb('0x2b')]['find']({'where':{'id':_0x215764[_0x9afb('0x48')]['id']}})[_0x9afb('0x25')](handleEntityNotFound(_0x12594c,null))[_0x9afb('0x25')](saveUpdates(_0x215764[_0x9afb('0x46')],null))[_0x9afb('0x25')](respondWithResult(_0x12594c,null))['catch'](handleError(_0x12594c,null));};exports[_0x9afb('0x26')]=function(_0x5a5b8b,_0x2ebeae){return db[_0x9afb('0x2b')][_0x9afb('0x49')]({'where':{'id':_0x5a5b8b[_0x9afb('0x48')]['id']}})[_0x9afb('0x25')](handleEntityNotFound(_0x2ebeae,null))[_0x9afb('0x25')](removeEntity(_0x2ebeae,null))[_0x9afb('0x43')](handleError(_0x2ebeae,null));};exports['describe']=function(_0x276997,_0x44c5ad){return db[_0x9afb('0x2b')]['describe']()[_0x9afb('0x25')](respondWithResult(_0x44c5ad,null))[_0x9afb('0x43')](handleError(_0x44c5ad,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index d17ca28..f306a95 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 _0xd6ce=['define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2878d6,_0x480dae){var _0x16b6ee=function(_0x384bcb){while(--_0x384bcb){_0x2878d6['push'](_0x2878d6['shift']());}};_0x16b6ee(++_0x480dae);}(_0xd6ce,0x87));var _0xed6c=function(_0x2590ae,_0x49e8bb){_0x2590ae=_0x2590ae-0x0;var _0x3cd435=_0xd6ce[_0x2590ae];return _0x3cd435;};'use strict';var _=require('lodash');var util=require(_0xed6c('0x0'));var logger=require(_0xed6c('0x1'))(_0xed6c('0x2'));var moment=require(_0xed6c('0x3'));var BPromise=require(_0xed6c('0x4'));var rp=require(_0xed6c('0x5'));var fs=require('fs');var path=require(_0xed6c('0x6'));var rimraf=require(_0xed6c('0x7'));var config=require(_0xed6c('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x325e37,_0x23b4c3){return _0x325e37[_0xed6c('0x9')](_0xed6c('0xa'),attributes,{'tableName':_0xed6c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f91=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','lodash','util','api','moment'];(function(_0x4e8e83,_0x228a98){var _0x2de2be=function(_0x450d2f){while(--_0x450d2f){_0x4e8e83['push'](_0x4e8e83['shift']());}};_0x2de2be(++_0x228a98);}(_0x3f91,0x1f4));var _0x13f9=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x3f91[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0x13f9('0x0'));var util=require(_0x13f9('0x1'));var logger=require('../../config/logger')(_0x13f9('0x2'));var moment=require(_0x13f9('0x3'));var BPromise=require(_0x13f9('0x4'));var rp=require(_0x13f9('0x5'));var fs=require('fs');var path=require(_0x13f9('0x6'));var rimraf=require(_0x13f9('0x7'));var config=require(_0x13f9('0x8'));var attributes=require(_0x13f9('0x9'));module['exports']=function(_0xc406,_0xe5d905){return _0xc406[_0x13f9('0xa')](_0x13f9('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 60e314a..22c19ca 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 _0x5a93=['then','info','JscriptyAnswerReport,\x20%s,\x20%s','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x5eba44,_0x319493){var _0x1aed17=function(_0x579f31){while(--_0x579f31){_0x5eba44['push'](_0x5eba44['shift']());}};_0x1aed17(++_0x319493);}(_0x5a93,0xe7));var _0x35a9=function(_0x155feb,_0x5ef0a7){_0x155feb=_0x155feb-0x0;var _0x150e55=_0x5a93[_0x155feb];return _0x150e55;};'use strict';var _=require('lodash');var util=require(_0x35a9('0x0'));var moment=require(_0x35a9('0x1'));var BPromise=require(_0x35a9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35a9('0x3'));var db=require(_0x35a9('0x4'))['db'];var utils=require(_0x35a9('0x5'));var logger=require('../../config/logger')(_0x35a9('0x6'));var config=require(_0x35a9('0x7'));var jayson=require(_0x35a9('0x8'));var client=jayson['client'][_0x35a9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35bdb8,_0x3c468b,_0x24a99d){return new BPromise(function(_0x21c4d4,_0x5649fd){return client[_0x35a9('0xa')](_0x35bdb8,_0x24a99d)[_0x35a9('0xb')](function(_0x4a6bd5){logger[_0x35a9('0xc')](_0x35a9('0xd'),_0x3c468b,'request\x20sent');logger['debug'](_0x35a9('0xe'),_0x3c468b,_0x35a9('0xf'),JSON[_0x35a9('0x10')](_0x4a6bd5));if(_0x4a6bd5['error']){if(_0x4a6bd5[_0x35a9('0x11')][_0x35a9('0x12')]===0x1f4){logger['error'](_0x35a9('0xd'),_0x3c468b,_0x4a6bd5[_0x35a9('0x11')][_0x35a9('0x13')]);return _0x5649fd(_0x4a6bd5[_0x35a9('0x11')][_0x35a9('0x13')]);}logger[_0x35a9('0x11')](_0x35a9('0xd'),_0x3c468b,_0x4a6bd5['error'][_0x35a9('0x13')]);return _0x21c4d4(_0x4a6bd5[_0x35a9('0x11')][_0x35a9('0x13')]);}else{logger[_0x35a9('0xc')](_0x35a9('0xd'),_0x3c468b,_0x35a9('0xf'));_0x21c4d4(_0x4a6bd5[_0x35a9('0x14')][_0x35a9('0x13')]);}})[_0x35a9('0x15')](function(_0x1879a6){logger[_0x35a9('0x11')](_0x35a9('0xd'),_0x3c468b,_0x1879a6);_0x5649fd(_0x1879a6);});});} \ No newline at end of file +var _0x7519=['debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1ffe75,_0x59931f){var _0x56bcdc=function(_0x1c1760){while(--_0x1c1760){_0x1ffe75['push'](_0x1ffe75['shift']());}};_0x56bcdc(++_0x59931f);}(_0x7519,0xc2));var _0x9751=function(_0x207cfe,_0x3053c7){_0x207cfe=_0x207cfe-0x0;var _0xf02ff3=_0x7519[_0x207cfe];return _0xf02ff3;};'use strict';var _=require(_0x9751('0x0'));var util=require(_0x9751('0x1'));var moment=require(_0x9751('0x2'));var BPromise=require(_0x9751('0x3'));var rs=require(_0x9751('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9751('0x5'));var logger=require(_0x9751('0x6'))(_0x9751('0x7'));var config=require(_0x9751('0x8'));var jayson=require(_0x9751('0x9'));var client=jayson[_0x9751('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdc9532,_0x590912,_0x2f852a){return new BPromise(function(_0x2d8523,_0x45be2e){return client[_0x9751('0xb')](_0xdc9532,_0x2f852a)[_0x9751('0xc')](function(_0x55ff4e){logger[_0x9751('0xd')](_0x9751('0xe'),_0x590912,_0x9751('0xf'));logger[_0x9751('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x590912,_0x9751('0xf'),JSON[_0x9751('0x11')](_0x55ff4e));if(_0x55ff4e[_0x9751('0x12')]){if(_0x55ff4e[_0x9751('0x12')]['code']===0x1f4){logger[_0x9751('0x12')](_0x9751('0xe'),_0x590912,_0x55ff4e['error'][_0x9751('0x13')]);return _0x45be2e(_0x55ff4e[_0x9751('0x12')][_0x9751('0x13')]);}logger[_0x9751('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x590912,_0x55ff4e[_0x9751('0x12')][_0x9751('0x13')]);return _0x2d8523(_0x55ff4e[_0x9751('0x12')]['message']);}else{logger[_0x9751('0xd')](_0x9751('0xe'),_0x590912,_0x9751('0xf'));_0x2d8523(_0x55ff4e['result'][_0x9751('0x13')]);}})[_0x9751('0x14')](function(_0x5ad5e0){logger[_0x9751('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x590912,_0x5ad5e0);_0x45be2e(_0x5ad5e0);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 696d56c..8c7ae72 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 _0x56b7=['clone','put','update','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','getSessions','/:id/answers','getAnswers','30s','post','create'];(function(_0x2a7779,_0xc7297d){var _0x360cef=function(_0x4f3172){while(--_0x4f3172){_0x2a7779['push'](_0x2a7779['shift']());}};_0x360cef(++_0xc7297d);}(_0x56b7,0xbd));var _0x756b=function(_0x1878db,_0x18d9f6){_0x1878db=_0x1878db-0x0;var _0x1ae242=_0x56b7[_0x1878db];return _0x1ae242;};'use strict';var multer=require(_0x756b('0x0'));var util=require('util');var path=require(_0x756b('0x1'));var timeout=require('connect-timeout');var express=require(_0x756b('0x2'));var router=express[_0x756b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x756b('0x4'));var interaction=require(_0x756b('0x5'));var config=require('../../config/environment');var controller=require(_0x756b('0x6'));router[_0x756b('0x7')]('/',auth[_0x756b('0x8')](),controller[_0x756b('0x9')]);router[_0x756b('0x7')](_0x756b('0xa'),auth['isAuthenticated'](),controller[_0x756b('0xb')]);router[_0x756b('0x7')]('/:id/sessions',auth['isAuthenticated'](),controller[_0x756b('0xc')]);router[_0x756b('0x7')](_0x756b('0xd'),auth['isAuthenticated'](),controller[_0x756b('0xe')]);router['get']('/:id/summary',auth[_0x756b('0x8')](),timeout(_0x756b('0xf')),controller['getSummary']);router[_0x756b('0x10')]('/',auth['isAuthenticated'](),controller[_0x756b('0x11')]);router[_0x756b('0x10')]('/:id/clone',auth[_0x756b('0x8')](),controller[_0x756b('0x12')]);router[_0x756b('0x13')](_0x756b('0xa'),auth['isAuthenticated'](),controller[_0x756b('0x14')]);router['delete'](_0x756b('0xa'),auth[_0x756b('0x8')](),controller[_0x756b('0x15')]);module[_0x756b('0x16')]=router; \ No newline at end of file +var _0xf5b0=['isAuthenticated','index','/:id','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get'];(function(_0x8a44ac,_0x3625e6){var _0x4bf66a=function(_0x3330f1){while(--_0x3330f1){_0x8a44ac['push'](_0x8a44ac['shift']());}};_0x4bf66a(++_0x3625e6);}(_0xf5b0,0x17d));var _0x0f5b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xf5b0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0f5b('0x0'));var util=require(_0x0f5b('0x1'));var path=require(_0x0f5b('0x2'));var timeout=require('connect-timeout');var express=require(_0x0f5b('0x3'));var router=express['Router']();var fs_extra=require(_0x0f5b('0x4'));var auth=require(_0x0f5b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0f5b('0x6'));var controller=require(_0x0f5b('0x7'));router[_0x0f5b('0x8')]('/',auth[_0x0f5b('0x9')](),controller[_0x0f5b('0xa')]);router[_0x0f5b('0x8')](_0x0f5b('0xb'),auth[_0x0f5b('0x9')](),controller['show']);router[_0x0f5b('0x8')](_0x0f5b('0xc'),auth['isAuthenticated'](),controller[_0x0f5b('0xd')]);router[_0x0f5b('0x8')](_0x0f5b('0xe'),auth[_0x0f5b('0x9')](),controller[_0x0f5b('0xf')]);router['get']('/:id/summary',auth[_0x0f5b('0x9')](),timeout(_0x0f5b('0x10')),controller[_0x0f5b('0x11')]);router[_0x0f5b('0x12')]('/',auth[_0x0f5b('0x9')](),controller[_0x0f5b('0x13')]);router[_0x0f5b('0x12')](_0x0f5b('0x14'),auth[_0x0f5b('0x9')](),controller['clone']);router[_0x0f5b('0x15')](_0x0f5b('0xb'),auth[_0x0f5b('0x9')](),controller[_0x0f5b('0x16')]);router[_0x0f5b('0x17')](_0x0f5b('0xb'),auth['isAuthenticated'](),controller[_0x0f5b('0x18')]);module[_0x0f5b('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 1b983c3..b7b1beb 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 _0xad1c=['BOOLEAN','sequelize','lodash','exports','STRING','name','TEXT','isObjectLike','setDataValue','stringify','isString','formData','getDataValue','description'];(function(_0x2e7d8,_0x74ff7c){var _0x20978a=function(_0x5d5f1e){while(--_0x5d5f1e){_0x2e7d8['push'](_0x2e7d8['shift']());}};_0x20978a(++_0x74ff7c);}(_0xad1c,0x8d));var _0xcad1=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0xad1c[_0x3826ad];return _0x17b900;};'use strict';var Sequelize=require(_0xcad1('0x0'));var _=require(_0xcad1('0x1'));var util=require('util');module[_0xcad1('0x2')]={'name':{'type':Sequelize[_0xcad1('0x3')],'unique':_0xcad1('0x4')},'description':{'type':Sequelize[_0xcad1('0x3')]},'formData':{'type':Sequelize[_0xcad1('0x5')]('long'),'set':function(_0x36f63f){if(_[_0xcad1('0x6')](_0x36f63f)){this[_0xcad1('0x7')]('formData',JSON[_0xcad1('0x8')](_0x36f63f));}else if(_[_0xcad1('0x9')](_0x36f63f)){this[_0xcad1('0x7')](_0xcad1('0xa'),_0x36f63f);}else{this[_0xcad1('0x7')]('formData',util['format']('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0xcad1('0xb')](_0xcad1('0x4'))||'',this[_0xcad1('0xb')](_0xcad1('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xcad1('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xcad1('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x83e7=['lodash','exports','STRING','name','isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN'];(function(_0x10179c,_0x4b1043){var _0xd34609=function(_0x35b2a1){while(--_0x35b2a1){_0x10179c['push'](_0x10179c['shift']());}};_0xd34609(++_0x4b1043);}(_0x83e7,0xb6));var _0x783e=function(_0x24e721,_0x4aec0c){_0x24e721=_0x24e721-0x0;var _0x16434e=_0x83e7[_0x24e721];return _0x16434e;};'use strict';var Sequelize=require('sequelize');var _=require(_0x783e('0x0'));var util=require('util');module[_0x783e('0x1')]={'name':{'type':Sequelize[_0x783e('0x2')],'unique':_0x783e('0x3')},'description':{'type':Sequelize[_0x783e('0x2')]},'formData':{'type':Sequelize['TEXT']('long'),'set':function(_0x7b5e7d){if(_[_0x783e('0x4')](_0x7b5e7d)){this[_0x783e('0x5')](_0x783e('0x6'),JSON[_0x783e('0x7')](_0x7b5e7d));}else if(_[_0x783e('0x8')](_0x7b5e7d)){this[_0x783e('0x5')](_0x783e('0x6'),_0x7b5e7d);}else{this[_0x783e('0x5')](_0x783e('0x6'),util[_0x783e('0x9')](_0x783e('0xa'),this[_0x783e('0xb')](_0x783e('0x3'))||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x783e('0xc')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 491df79..9aeb070 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 _0x4d08=['type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','keys','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','UserProfileSection','autoAssociation','findOne','pick','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','SessionId','answer','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','download','format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','JscriptyProject','rawAttributes'];(function(_0x1eac4f,_0x100225){var _0x43b5ff=function(_0x5b9678){while(--_0x5b9678){_0x1eac4f['push'](_0x1eac4f['shift']());}};_0x43b5ff(++_0x100225);}(_0x4d08,0x1a5));var _0x84d0=function(_0x22868f,_0x450f48){_0x22868f=_0x22868f-0x0;var _0x97bc75=_0x4d08[_0x22868f];return _0x97bc75;};'use strict';var emlformat=require(_0x84d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84d0('0x1'));var jsonpatch=require(_0x84d0('0x2'));var rp=require(_0x84d0('0x3'));var moment=require(_0x84d0('0x4'));var BPromise=require(_0x84d0('0x5'));var Mustache=require('mustache');var util=require(_0x84d0('0x6'));var path=require(_0x84d0('0x7'));var sox=require(_0x84d0('0x8'));var csv=require(_0x84d0('0x9'));var ejs=require(_0x84d0('0xa'));var fs=require('fs');var fs_extra=require(_0x84d0('0xb'));var _=require(_0x84d0('0xc'));var squel=require(_0x84d0('0xd'));var crypto=require(_0x84d0('0xe'));var jsforce=require(_0x84d0('0xf'));var deskjs=require(_0x84d0('0x10'));var toCsv=require(_0x84d0('0x9'));var querystring=require(_0x84d0('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x84d0('0x12'));var as=require(_0x84d0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x84d0('0x14'));var utils=require(_0x84d0('0x15'));var config=require(_0x84d0('0x16'));var licenseUtil=require(_0x84d0('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4dd600,_0x539b9a){_0x539b9a=_0x539b9a||0xcc;return function(_0x410e3a){if(_0x410e3a){return _0x4dd600[_0x84d0('0x18')](_0x539b9a);}return _0x4dd600[_0x84d0('0x19')](_0x539b9a)[_0x84d0('0x1a')]();};}function respondWithResult(_0x1b72f0,_0x2bdf1f){_0x2bdf1f=_0x2bdf1f||0xc8;return function(_0x28570a){if(_0x28570a){return _0x1b72f0[_0x84d0('0x19')](_0x2bdf1f)[_0x84d0('0x1b')](_0x28570a);}};}function respondWithFilteredResult(_0x1add3d,_0x487b2d){return function(_0x56f2b2){if(_0x56f2b2){var _0x2beef2=typeof _0x487b2d[_0x84d0('0x1c')]===_0x84d0('0x1d')&&typeof _0x487b2d['limit']==='undefined';var _0x21c40e=_0x56f2b2[_0x84d0('0x1e')];var _0x2c1443=_0x2beef2?0x0:_0x487b2d[_0x84d0('0x1c')];var _0x525ee2=_0x2beef2?_0x56f2b2[_0x84d0('0x1e')]:_0x487b2d[_0x84d0('0x1c')]+_0x487b2d['limit'];var _0x31c1af;if(_0x525ee2>=_0x21c40e){_0x525ee2=_0x21c40e;_0x31c1af=0xc8;}else{_0x31c1af=0xce;}_0x1add3d['status'](_0x31c1af);return _0x1add3d[_0x84d0('0x1f')](_0x84d0('0x20'),_0x2c1443+'-'+_0x525ee2+'/'+_0x21c40e)[_0x84d0('0x1b')](_0x56f2b2);}return null;};}function patchUpdates(_0x53c431){return function(_0x334e2b){try{jsonpatch[_0x84d0('0x21')](_0x334e2b,_0x53c431,!![]);}catch(_0x427af8){return BPromise[_0x84d0('0x22')](_0x427af8);}return _0x334e2b['save']();};}function saveUpdates(_0x96204,_0x15f936){return function(_0x5b030d){if(_0x5b030d){return _0x5b030d[_0x84d0('0x23')](_0x96204)[_0x84d0('0x24')](function(_0x4d25f7){return _0x4d25f7;});}return null;};}function removeEntity(_0x3e25c3,_0x316d04){return function(_0x52d30d){if(_0x52d30d){return _0x52d30d[_0x84d0('0x25')]()[_0x84d0('0x24')](function(){var _0x31fada=_0x52d30d[_0x84d0('0x26')]({'plain':!![]});var _0x4bd31e='Projects';return db[_0x84d0('0x27')]['destroy']({'where':{'type':_0x4bd31e,'resourceId':_0x31fada['id']}})[_0x84d0('0x24')](function(){return _0x52d30d;});})['then'](function(){_0x3e25c3[_0x84d0('0x19')](0xcc)[_0x84d0('0x1a')]();});}};}function handleEntityNotFound(_0x90d4d1,_0x3f99e0){return function(_0x173fe3){if(!_0x173fe3){_0x90d4d1[_0x84d0('0x18')](0x194);}return _0x173fe3;};}function handleError(_0x5dab03,_0x5764be){_0x5764be=_0x5764be||0x1f4;return function(_0x290391){logger['error'](_0x290391[_0x84d0('0x28')]);if(_0x290391[_0x84d0('0x29')]){delete _0x290391[_0x84d0('0x29')];}_0x5dab03[_0x84d0('0x19')](_0x5764be)[_0x84d0('0x2a')](_0x290391);};}exports[_0x84d0('0x2b')]=function(_0x60756f,_0xb6f8bf){var _0x414512={},_0x51a69c={},_0x5bdce9={'count':0x0,'rows':[]};var _0x2c93c2=_[_0x84d0('0x2c')](db[_0x84d0('0x2d')][_0x84d0('0x2e')],function(_0x45852d){return{'name':_0x45852d['fieldName'],'type':_0x45852d[_0x84d0('0x2f')]['key']};});_0x51a69c[_0x84d0('0x30')]=_['map'](_0x2c93c2,_0x84d0('0x29'));_0x51a69c[_0x84d0('0x31')]=_['keys'](_0x60756f['query']);_0x51a69c[_0x84d0('0x32')]=_[_0x84d0('0x33')](_0x51a69c[_0x84d0('0x30')],_0x51a69c['query']);_0x414512[_0x84d0('0x34')]=_['intersection'](_0x51a69c[_0x84d0('0x30')],qs[_0x84d0('0x35')](_0x60756f[_0x84d0('0x31')][_0x84d0('0x35')]));_0x414512[_0x84d0('0x34')]=_0x414512['attributes'][_0x84d0('0x36')]?_0x414512[_0x84d0('0x34')]:_0x51a69c[_0x84d0('0x30')];if(!_0x60756f[_0x84d0('0x31')][_0x84d0('0x37')](_0x84d0('0x38'))){_0x414512[_0x84d0('0x39')]=qs[_0x84d0('0x39')](_0x60756f[_0x84d0('0x31')][_0x84d0('0x39')]);_0x414512[_0x84d0('0x1c')]=qs['offset'](_0x60756f[_0x84d0('0x31')][_0x84d0('0x1c')]);}_0x414512[_0x84d0('0x3a')]=qs[_0x84d0('0x3b')](_0x60756f['query'][_0x84d0('0x3b')]);_0x414512[_0x84d0('0x3c')]=qs[_0x84d0('0x32')](_['pick'](_0x60756f[_0x84d0('0x31')],_0x51a69c[_0x84d0('0x32')]),_0x2c93c2);if(_0x60756f['query'][_0x84d0('0x3d')]){_0x414512['where']=_[_0x84d0('0x3e')](_0x414512[_0x84d0('0x3c')],{'$or':_[_0x84d0('0x2c')](_0x2c93c2,function(_0x2e48b8){if(_0x2e48b8[_0x84d0('0x2f')]!==_0x84d0('0x3f')){var _0x216582={};_0x216582[_0x2e48b8[_0x84d0('0x29')]]={'$like':'%'+_0x60756f[_0x84d0('0x31')][_0x84d0('0x3d')]+'%'};return _0x216582;}})});}_0x414512=_[_0x84d0('0x3e')]({},_0x414512,_0x60756f['options']);var _0x55c34e={'where':_0x414512['where']};return db[_0x84d0('0x2d')][_0x84d0('0x1e')](_0x55c34e)[_0x84d0('0x24')](function(_0x30a319){_0x5bdce9[_0x84d0('0x1e')]=_0x30a319;if(_0x60756f[_0x84d0('0x31')][_0x84d0('0x40')]){_0x414512['include']=[{'all':!![]}];}return db[_0x84d0('0x2d')][_0x84d0('0x41')](_0x414512);})[_0x84d0('0x24')](function(_0x4da9e6){_0x5bdce9[_0x84d0('0x42')]=_0x4da9e6;return _0x5bdce9;})[_0x84d0('0x24')](respondWithFilteredResult(_0xb6f8bf,_0x414512))[_0x84d0('0x43')](handleError(_0xb6f8bf,null));};exports['show']=function(_0xebccda,_0x41da6c){var _0x3aeefc={'raw':![],'where':{'id':_0xebccda['params']['id']}},_0x21b2e8={};_0x21b2e8['model']=_[_0x84d0('0x44')](db[_0x84d0('0x2d')][_0x84d0('0x2e')]);_0x21b2e8['query']=_[_0x84d0('0x44')](_0xebccda[_0x84d0('0x31')]);_0x21b2e8['filters']=_['intersection'](_0x21b2e8['model'],_0x21b2e8[_0x84d0('0x31')]);_0x3aeefc[_0x84d0('0x34')]=_[_0x84d0('0x33')](_0x21b2e8[_0x84d0('0x30')],qs[_0x84d0('0x35')](_0xebccda[_0x84d0('0x31')]['fields']));_0x3aeefc[_0x84d0('0x34')]=_0x3aeefc['attributes'][_0x84d0('0x36')]?_0x3aeefc[_0x84d0('0x34')]:_0x21b2e8[_0x84d0('0x30')];if(_0xebccda[_0x84d0('0x31')][_0x84d0('0x40')]){_0x3aeefc[_0x84d0('0x45')]=[{'all':!![]}];}_0x3aeefc=_[_0x84d0('0x3e')]({},_0x3aeefc,_0xebccda[_0x84d0('0x46')]);return db[_0x84d0('0x2d')]['find'](_0x3aeefc)['then'](handleEntityNotFound(_0x41da6c,null))[_0x84d0('0x24')](respondWithResult(_0x41da6c,null))[_0x84d0('0x43')](handleError(_0x41da6c,null));};exports[_0x84d0('0x47')]=function(_0x204683,_0x13e77d){return db['JscriptyProject'][_0x84d0('0x47')](_0x204683[_0x84d0('0x48')],{})[_0x84d0('0x24')](function(_0x1e1765){var _0x305de4=_0x204683[_0x84d0('0x49')][_0x84d0('0x26')]({'plain':!![]});if(!_0x305de4)throw new Error(_0x84d0('0x4a'));if(_0x305de4[_0x84d0('0x4b')]===_0x84d0('0x49')){var _0x101de1=_0x1e1765['get']({'plain':!![]});var _0x343615=_0x84d0('0x4c');return db['UserProfileSection'][_0x84d0('0x4d')]({'where':{'name':_0x343615,'userProfileId':_0x305de4[_0x84d0('0x4e')]},'raw':!![]})[_0x84d0('0x24')](function(_0x541010){if(_0x541010&&_0x541010['autoAssociation']===0x0){return db[_0x84d0('0x27')]['create']({'name':_0x101de1[_0x84d0('0x29')],'resourceId':_0x101de1['id'],'type':_0x541010[_0x84d0('0x29')],'sectionId':_0x541010['id']},{})[_0x84d0('0x24')](function(){return _0x1e1765;});}else{return _0x1e1765;}})['catch'](function(_0x22e917){logger['error'](_0x84d0('0x4f'),_0x22e917);throw _0x22e917;});}return _0x1e1765;})['then'](respondWithResult(_0x13e77d,0xc9))[_0x84d0('0x43')](handleError(_0x13e77d,null));};exports[_0x84d0('0x50')]=function(_0x434e03,_0x329850){var _0x399f1e={'where':{'id':_0x434e03[_0x84d0('0x51')]['id']}},_0x1a3251={};_0x1a3251[_0x84d0('0x30')]=_[_0x84d0('0x44')](db['JscriptyProject']['rawAttributes']);_0x399f1e['attributes']=_['intersection'](_0x1a3251['model'],qs[_0x84d0('0x35')](_0x434e03[_0x84d0('0x31')]['fields']));_0x399f1e[_0x84d0('0x34')]=_0x399f1e[_0x84d0('0x34')]['length']?_0x399f1e[_0x84d0('0x34')]:_0x1a3251[_0x84d0('0x30')];if(_0x434e03['query'][_0x84d0('0x40')]){_0x399f1e[_0x84d0('0x45')]=[{'all':!![]}];}_0x399f1e=_['merge']({},_0x399f1e,_0x434e03[_0x84d0('0x46')]);return db['JscriptyProject'][_0x84d0('0x4d')](_0x399f1e)[_0x84d0('0x24')](handleEntityNotFound(_0x329850,null))[_0x84d0('0x24')](function(_0x46918a){if(_0x46918a){var _0x532e8d=_0x46918a[_0x84d0('0x26')]({'plain':!![]});_0x532e8d=qs[_0x84d0('0x52')](_0x532e8d,['id',_0x84d0('0x53'),_0x84d0('0x54')]);_0x434e03[_0x84d0('0x48')]=_[_0x84d0('0x52')](_0x434e03[_0x84d0('0x48')],['id',_0x84d0('0x53'),'updatedAt']);return db[_0x84d0('0x2d')]['create'](_['merge'](_0x532e8d,_0x434e03[_0x84d0('0x48')]),{'include':_0x434e03['query'][_0x84d0('0x40')]?[{'all':!![]}]:undefined})['then'](function(_0x574463){var _0x2987e3=_0x434e03[_0x84d0('0x49')][_0x84d0('0x26')]({'plain':!![]});if(!_0x2987e3)throw new Error(_0x84d0('0x4a'));if(_0x2987e3[_0x84d0('0x4b')]==='user'){var _0x52e465=_0x574463[_0x84d0('0x26')]({'plain':!![]});var _0x40fd0d='Projects';return db[_0x84d0('0x55')][_0x84d0('0x4d')]({'where':{'name':_0x40fd0d,'userProfileId':_0x2987e3[_0x84d0('0x4e')]},'raw':!![]})[_0x84d0('0x24')](function(_0x258b14){if(_0x258b14&&_0x258b14[_0x84d0('0x56')]===0x0){return db[_0x84d0('0x27')]['create']({'name':_0x52e465['name'],'resourceId':_0x52e465['id'],'type':_0x258b14['name'],'sectionId':_0x258b14['id']},{})[_0x84d0('0x24')](function(){return _0x574463;});}else{return _0x574463;}})[_0x84d0('0x43')](function(_0x66ede0){logger['error'](_0x84d0('0x4f'),_0x66ede0);throw _0x66ede0;});}return _0x574463;});}})[_0x84d0('0x24')](respondWithResult(_0x329850,0xc9))[_0x84d0('0x43')](handleError(_0x329850,null));};exports[_0x84d0('0x23')]=function(_0x25de3e,_0x1f5910){if(_0x25de3e[_0x84d0('0x48')]['id']){delete _0x25de3e['body']['id'];}return db['JscriptyProject'][_0x84d0('0x4d')]({'where':{'id':_0x25de3e[_0x84d0('0x51')]['id']}})['then'](handleEntityNotFound(_0x1f5910,null))[_0x84d0('0x24')](saveUpdates(_0x25de3e[_0x84d0('0x48')],null))[_0x84d0('0x24')](respondWithResult(_0x1f5910,null))['catch'](handleError(_0x1f5910,null));};exports[_0x84d0('0x25')]=function(_0x39eabd,_0x503482){return db['JscriptyProject'][_0x84d0('0x4d')]({'where':{'id':_0x39eabd['params']['id']}})['then'](handleEntityNotFound(_0x503482,null))['then'](removeEntity(_0x503482,null))[_0x84d0('0x43')](handleError(_0x503482,null));};exports['getSessions']=function(_0xaa170b,_0x3c4901,_0x456ca6){var _0x4de293={'raw':!![],'where':{}};var _0x165f1c={};var _0x590e2a={'count':0x0,'rows':[]};return db[_0x84d0('0x2d')][_0x84d0('0x57')]({'where':{'id':_0xaa170b['params']['id']}})[_0x84d0('0x24')](handleEntityNotFound(_0x3c4901,null))[_0x84d0('0x24')](function(_0x3dc268){if(_0x3dc268){_0x165f1c[_0x84d0('0x30')]=_[_0x84d0('0x44')](db['JscriptySessionReport'][_0x84d0('0x2e')]);_0x165f1c['query']=_['keys'](_0xaa170b[_0x84d0('0x31')]);_0x165f1c[_0x84d0('0x32')]=_[_0x84d0('0x33')](_0x165f1c[_0x84d0('0x30')],_0x165f1c[_0x84d0('0x31')]);_0x4de293[_0x84d0('0x34')]=_[_0x84d0('0x33')](_0x165f1c[_0x84d0('0x30')],qs['fields'](_0xaa170b[_0x84d0('0x31')][_0x84d0('0x35')]));_0x4de293[_0x84d0('0x34')]=_0x4de293[_0x84d0('0x34')]['length']?_0x4de293['attributes']:_0x165f1c[_0x84d0('0x30')];if(!_0xaa170b['query'][_0x84d0('0x37')]('nolimit')){_0x4de293[_0x84d0('0x39')]=qs['limit'](_0xaa170b[_0x84d0('0x31')]['limit']);_0x4de293['offset']=qs[_0x84d0('0x1c')](_0xaa170b['query'][_0x84d0('0x1c')]);}_0x4de293[_0x84d0('0x3a')]=qs[_0x84d0('0x3b')](_0xaa170b['query'][_0x84d0('0x3b')]);_0x4de293[_0x84d0('0x3c')]=qs[_0x84d0('0x32')](_[_0x84d0('0x58')](_0xaa170b[_0x84d0('0x31')],_0x165f1c[_0x84d0('0x32')]));_0x4de293[_0x84d0('0x3c')][_0x84d0('0x59')]=_0x3dc268['id'];if(_0xaa170b[_0x84d0('0x31')][_0x84d0('0x3d')]){_0x4de293['where']=_['merge'](_0x4de293[_0x84d0('0x3c')],{'$or':_[_0x84d0('0x2c')](_0x4de293[_0x84d0('0x34')],function(_0x50d01e){var _0x4c7cca={};_0x4c7cca[_0x50d01e]={'$like':'%'+_0xaa170b['query']['filter']+'%'};return _0x4c7cca;})});}_0x4de293=_[_0x84d0('0x3e')]({},_0x4de293,_0xaa170b[_0x84d0('0x46')]);return db[_0x84d0('0x5a')][_0x84d0('0x1e')]({'where':_0x4de293[_0x84d0('0x3c')]})[_0x84d0('0x24')](function(_0x52b48e){_0x590e2a['count']=_0x52b48e;if(_0xaa170b[_0x84d0('0x31')]['includeAll']){_0x4de293[_0x84d0('0x45')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x84d0('0x41')](_0x4de293);})[_0x84d0('0x24')](function(_0x2f65d1){_0x590e2a['rows']=_0x2f65d1;return _0x590e2a;});}})[_0x84d0('0x24')](respondWithFilteredResult(_0x3c4901,_0x4de293))[_0x84d0('0x43')](handleError(_0x3c4901,null));};exports[_0x84d0('0x5b')]=function(_0x35e9b6,_0x3bd095,_0x22c4fa){var _0x3e1087={'raw':!![],'where':{}};var _0xd61b62={};var _0x12fb85={'count':0x0,'rows':[]};return db[_0x84d0('0x2d')][_0x84d0('0x57')]({'where':{'id':_0x35e9b6[_0x84d0('0x51')]['id']}})[_0x84d0('0x24')](handleEntityNotFound(_0x3bd095,null))[_0x84d0('0x24')](function(_0x35931b){if(_0x35931b){_0xd61b62[_0x84d0('0x30')]=_['keys'](db[_0x84d0('0x5c')]['rawAttributes']);_0xd61b62[_0x84d0('0x31')]=_[_0x84d0('0x44')](_0x35e9b6[_0x84d0('0x31')]);_0xd61b62[_0x84d0('0x32')]=_[_0x84d0('0x33')](_0xd61b62[_0x84d0('0x30')],_0xd61b62[_0x84d0('0x31')]);_0x3e1087[_0x84d0('0x34')]=_['intersection'](_0xd61b62[_0x84d0('0x30')],qs[_0x84d0('0x35')](_0x35e9b6[_0x84d0('0x31')][_0x84d0('0x35')]));_0x3e1087[_0x84d0('0x34')]=_0x3e1087['attributes'][_0x84d0('0x36')]?_0x3e1087[_0x84d0('0x34')]:_0xd61b62['model'];if(!_0x35e9b6[_0x84d0('0x31')]['hasOwnProperty'](_0x84d0('0x38'))){_0x3e1087['limit']=qs[_0x84d0('0x39')](_0x35e9b6[_0x84d0('0x31')][_0x84d0('0x39')]);_0x3e1087['offset']=qs[_0x84d0('0x1c')](_0x35e9b6[_0x84d0('0x31')][_0x84d0('0x1c')]);}_0x3e1087['order']=qs[_0x84d0('0x3b')](_0x35e9b6['query'][_0x84d0('0x3b')]);_0x3e1087[_0x84d0('0x3c')]=qs[_0x84d0('0x32')](_[_0x84d0('0x58')](_0x35e9b6['query'],_0xd61b62['filters']));_0x3e1087[_0x84d0('0x3c')]['ProjectId']=_0x35931b['id'];if(_0x35e9b6[_0x84d0('0x31')]['filter']){_0x3e1087['where']=_[_0x84d0('0x3e')](_0x3e1087['where'],{'$or':_[_0x84d0('0x2c')](_0x3e1087[_0x84d0('0x34')],function(_0x49bd6c){var _0x597e18={};_0x597e18[_0x49bd6c]={'$like':'%'+_0x35e9b6[_0x84d0('0x31')]['filter']+'%'};return _0x597e18;})});}_0x3e1087=_[_0x84d0('0x3e')]({},_0x3e1087,_0x35e9b6['options']);return db[_0x84d0('0x5c')][_0x84d0('0x1e')]({'where':_0x3e1087[_0x84d0('0x3c')]})['then'](function(_0x5c6869){_0x12fb85['count']=_0x5c6869;if(_0x35e9b6[_0x84d0('0x31')][_0x84d0('0x40')]){_0x3e1087['include']=[{'all':!![]}];}return db[_0x84d0('0x5c')][_0x84d0('0x41')](_0x3e1087);})[_0x84d0('0x24')](function(_0x2f10b8){_0x12fb85[_0x84d0('0x42')]=_0x2f10b8;return _0x12fb85;});}})[_0x84d0('0x24')](respondWithFilteredResult(_0x3bd095,_0x3e1087))[_0x84d0('0x43')](handleError(_0x3bd095,null));};function char(_0x4fdf20){return _0x84d0('0x5d')===typeof _0x4fdf20?String[_0x84d0('0x5e')][_0x84d0('0x21')](null,arguments):_0x4fdf20;}function needsEncapsulation(_0x186aaf){return!!_0x186aaf&&(_0x186aaf[_0x84d0('0x5f')]()['indexOf'](char(0xd))>=0x0||_0x186aaf[_0x84d0('0x5f')]()[_0x84d0('0x60')](char(0xa))>=0x0||_0x186aaf[_0x84d0('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0x186aaf[_0x84d0('0x5f')]()[_0x84d0('0x60')](char(0x22))>=0x0);}function encapsulate(_0x3806c1){var _0x373e54=char(0x22),_0x441329='\x5c'+char(0x22),_0x209850=_0x3806c1[_0x84d0('0x5f')]()[_0x84d0('0x61')](new RegExp(_0x373e54,'g'),_0x441329);return _0x373e54+_0x209850+_0x373e54;}exports[_0x84d0('0x62')]=function(_0x338001,_0x2436d5,_0x1da89f){var _0x2866ce,_0x9f9c55;var _0x4328f7={'where':{'ProjectId':_0x338001[_0x84d0('0x51')]['id']}};if(_0x338001['query'][_0x84d0('0x63')]){_0x4328f7[_0x84d0('0x3c')]['starttime']=JSON[_0x84d0('0x64')](_0x338001[_0x84d0('0x31')][_0x84d0('0x63')]);}return db[_0x84d0('0x5a')]['findAll'](_0x4328f7)['then'](handleEntityNotFound(_0x2436d5,null))[_0x84d0('0x24')](function(_0x500a48){if(_0x500a48){_0x2866ce=_0x500a48;return db[_0x84d0('0x65')][_0x84d0('0x41')]({'where':{'SessionId':{'$in':_[_0x84d0('0x2c')](_0x2866ce,'id')},'ProjectId':_0x338001['params']['id']},'order':_0x84d0('0x66')});}})['then'](handleEntityNotFound(_0x2436d5,null))['then'](function(_0x13e365){if(_0x13e365){_0x9f9c55=_0x13e365;var _0xda04b5={};for(var _0x29f1e3=0x0,_0x4d0efd=_0x9f9c55['length'];_0x29f1e3<_0x4d0efd;_0x29f1e3++){if(!_0xda04b5[_0x84d0('0x37')](_0x9f9c55[_0x29f1e3][_0x84d0('0x67')])){_0xda04b5[_0x9f9c55[_0x29f1e3][_0x84d0('0x67')]]=needsEncapsulation(_0x9f9c55[_0x29f1e3][_0x84d0('0x68')])?encapsulate(_0x9f9c55[_0x29f1e3][_0x84d0('0x68')]):_0x9f9c55[_0x29f1e3][_0x84d0('0x68')];}}var _0x514047=[],_0x361c8b={};for(var _0x750b52=0x0,_0x3fca9f=_0x2866ce[_0x84d0('0x36')];_0x750b52<_0x3fca9f;_0x750b52++){_0x361c8b={'ProjectId':_0x338001[_0x84d0('0x51')]['id'],'SessionId':_0x2866ce[_0x750b52]['id'],'StartTime':moment(_0x2866ce[_0x750b52][_0x84d0('0x69')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x5c1825=0x0,_0x4f6033=_0x9f9c55[_0x84d0('0x36')];_0x5c1825<_0x4f6033;_0x5c1825++){if(_0x9f9c55[_0x5c1825][_0x84d0('0x6a')]==_0x2866ce[_0x750b52]['id']&&_0xda04b5['hasOwnProperty'](_0x9f9c55[_0x5c1825][_0x84d0('0x67')])){_0x361c8b[_0xda04b5[_0x9f9c55[_0x5c1825][_0x84d0('0x67')]]]=_0x9f9c55[_0x5c1825][_0x84d0('0x6b')];}}for(var _0xfa0c8 in _0xda04b5){if(!_0x361c8b[_0x84d0('0x37')](_0xda04b5[_0xfa0c8])){_0x361c8b[_0xda04b5[_0xfa0c8]]=null;}}_0x514047['push'](_0x361c8b);}return _0x514047;}})[_0x84d0('0x24')](function(_0x1355b3){if(!_[_0x84d0('0x6c')](_0x1355b3)){var _0x1a1949=toCsv(_0x1355b3);var _0x12fe2c=Date['now']();fs[_0x84d0('0x6d')](util['format'](_0x84d0('0x6e'),_0x338001[_0x84d0('0x51')]['id'],_0x12fe2c),_0x1a1949);_0x2436d5[_0x84d0('0x6f')](_0x84d0('0x70'),_0x84d0('0x71')+util['format'](_0x84d0('0x72'),_0x338001[_0x84d0('0x51')]['id'],_0x12fe2c));_0x2436d5[_0x84d0('0x6f')]('Content-type','text/csv');return _0x2436d5[_0x84d0('0x73')](util[_0x84d0('0x74')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x338001[_0x84d0('0x51')]['id'],_0x12fe2c));}else{return _0x2436d5[_0x84d0('0x18')](0xcc);}})[_0x84d0('0x43')](handleError(_0x2436d5,null));}; \ No newline at end of file +var _0x1956=['end','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','createdAt','updatedAt','role','user','UserProfileSection','getSessions','findOne','nolimit','order','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','apply','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','UserProfileResource'];(function(_0x399b24,_0x2d6c6a){var _0x5971c7=function(_0x268fa7){while(--_0x268fa7){_0x399b24['push'](_0x399b24['shift']());}};_0x5971c7(++_0x2d6c6a);}(_0x1956,0x15c));var _0x6195=function(_0x365be9,_0x3c88b9){_0x365be9=_0x365be9-0x0;var _0x185c12=_0x1956[_0x365be9];return _0x185c12;};'use strict';var emlformat=require(_0x6195('0x0'));var rimraf=require(_0x6195('0x1'));var zipdir=require(_0x6195('0x2'));var jsonpatch=require(_0x6195('0x3'));var rp=require(_0x6195('0x4'));var moment=require(_0x6195('0x5'));var BPromise=require(_0x6195('0x6'));var Mustache=require('mustache');var util=require(_0x6195('0x7'));var path=require(_0x6195('0x8'));var sox=require(_0x6195('0x9'));var csv=require(_0x6195('0xa'));var ejs=require(_0x6195('0xb'));var fs=require('fs');var fs_extra=require(_0x6195('0xc'));var _=require(_0x6195('0xd'));var squel=require(_0x6195('0xe'));var crypto=require(_0x6195('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6195('0x10'));var toCsv=require(_0x6195('0xa'));var querystring=require(_0x6195('0x11'));var Papa=require(_0x6195('0x12'));var Redis=require(_0x6195('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6195('0x14'));var as=require(_0x6195('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6195('0x16'))(_0x6195('0x17'));var utils=require(_0x6195('0x18'));var config=require(_0x6195('0x19'));var licenseUtil=require(_0x6195('0x1a'));var db=require(_0x6195('0x1b'))['db'];function respondWithStatusCode(_0x1282f5,_0x96b635){_0x96b635=_0x96b635||0xcc;return function(_0x51b975){if(_0x51b975){return _0x1282f5[_0x6195('0x1c')](_0x96b635);}return _0x1282f5[_0x6195('0x1d')](_0x96b635)['end']();};}function respondWithResult(_0x29c5e0,_0x431b3d){_0x431b3d=_0x431b3d||0xc8;return function(_0x5320f7){if(_0x5320f7){return _0x29c5e0[_0x6195('0x1d')](_0x431b3d)[_0x6195('0x1e')](_0x5320f7);}};}function respondWithFilteredResult(_0x1af54a,_0x397370){return function(_0x6653b7){if(_0x6653b7){var _0x1a555f=typeof _0x397370[_0x6195('0x1f')]===_0x6195('0x20')&&typeof _0x397370['limit']==='undefined';var _0x21bf76=_0x6653b7[_0x6195('0x21')];var _0x6174a3=_0x1a555f?0x0:_0x397370[_0x6195('0x1f')];var _0x3b42a0=_0x1a555f?_0x6653b7['count']:_0x397370[_0x6195('0x1f')]+_0x397370['limit'];var _0x40134d;if(_0x3b42a0>=_0x21bf76){_0x3b42a0=_0x21bf76;_0x40134d=0xc8;}else{_0x40134d=0xce;}_0x1af54a[_0x6195('0x1d')](_0x40134d);return _0x1af54a[_0x6195('0x22')](_0x6195('0x23'),_0x6174a3+'-'+_0x3b42a0+'/'+_0x21bf76)[_0x6195('0x1e')](_0x6653b7);}return null;};}function patchUpdates(_0x4e9673){return function(_0x4cadf3){try{jsonpatch['apply'](_0x4cadf3,_0x4e9673,!![]);}catch(_0x5595e0){return BPromise[_0x6195('0x24')](_0x5595e0);}return _0x4cadf3[_0x6195('0x25')]();};}function saveUpdates(_0xc1e5d9,_0x4f2d43){return function(_0x5bed95){if(_0x5bed95){return _0x5bed95[_0x6195('0x26')](_0xc1e5d9)['then'](function(_0x4181f3){return _0x4181f3;});}return null;};}function removeEntity(_0x11cc46,_0x184080){return function(_0x5dbe2c){if(_0x5dbe2c){return _0x5dbe2c[_0x6195('0x27')]()[_0x6195('0x28')](function(){var _0xd03b87=_0x5dbe2c['get']({'plain':!![]});var _0x5b83dc='Projects';return db[_0x6195('0x29')][_0x6195('0x27')]({'where':{'type':_0x5b83dc,'resourceId':_0xd03b87['id']}})[_0x6195('0x28')](function(){return _0x5dbe2c;});})[_0x6195('0x28')](function(){_0x11cc46[_0x6195('0x1d')](0xcc)[_0x6195('0x2a')]();});}};}function handleEntityNotFound(_0x251e21,_0x25a227){return function(_0x44c5ef){if(!_0x44c5ef){_0x251e21[_0x6195('0x1c')](0x194);}return _0x44c5ef;};}function handleError(_0x566e1e,_0x20c3e2){_0x20c3e2=_0x20c3e2||0x1f4;return function(_0x5af2af){logger[_0x6195('0x2b')](_0x5af2af[_0x6195('0x2c')]);if(_0x5af2af[_0x6195('0x2d')]){delete _0x5af2af[_0x6195('0x2d')];}_0x566e1e[_0x6195('0x1d')](_0x20c3e2)[_0x6195('0x2e')](_0x5af2af);};}exports[_0x6195('0x2f')]=function(_0x208c93,_0x217ac1){var _0x3839fd={},_0x21d93c={},_0x52d3ff={'count':0x0,'rows':[]};var _0x611d5=_[_0x6195('0x30')](db[_0x6195('0x31')][_0x6195('0x32')],function(_0x559e31){return{'name':_0x559e31[_0x6195('0x33')],'type':_0x559e31['type'][_0x6195('0x34')]};});_0x21d93c[_0x6195('0x35')]=_['map'](_0x611d5,_0x6195('0x2d'));_0x21d93c[_0x6195('0x36')]=_['keys'](_0x208c93[_0x6195('0x36')]);_0x21d93c[_0x6195('0x37')]=_[_0x6195('0x38')](_0x21d93c[_0x6195('0x35')],_0x21d93c[_0x6195('0x36')]);_0x3839fd[_0x6195('0x39')]=_[_0x6195('0x38')](_0x21d93c[_0x6195('0x35')],qs[_0x6195('0x3a')](_0x208c93['query'][_0x6195('0x3a')]));_0x3839fd[_0x6195('0x39')]=_0x3839fd[_0x6195('0x39')]['length']?_0x3839fd[_0x6195('0x39')]:_0x21d93c[_0x6195('0x35')];if(!_0x208c93[_0x6195('0x36')][_0x6195('0x3b')]('nolimit')){_0x3839fd[_0x6195('0x3c')]=qs[_0x6195('0x3c')](_0x208c93[_0x6195('0x36')][_0x6195('0x3c')]);_0x3839fd['offset']=qs['offset'](_0x208c93[_0x6195('0x36')][_0x6195('0x1f')]);}_0x3839fd['order']=qs[_0x6195('0x3d')](_0x208c93[_0x6195('0x36')]['sort']);_0x3839fd[_0x6195('0x3e')]=qs[_0x6195('0x37')](_[_0x6195('0x3f')](_0x208c93[_0x6195('0x36')],_0x21d93c[_0x6195('0x37')]),_0x611d5);if(_0x208c93[_0x6195('0x36')][_0x6195('0x40')]){_0x3839fd[_0x6195('0x3e')]=_['merge'](_0x3839fd[_0x6195('0x3e')],{'$or':_[_0x6195('0x30')](_0x611d5,function(_0x3f9e43){if(_0x3f9e43['type']!==_0x6195('0x41')){var _0x2a871f={};_0x2a871f[_0x3f9e43[_0x6195('0x2d')]]={'$like':'%'+_0x208c93[_0x6195('0x36')][_0x6195('0x40')]+'%'};return _0x2a871f;}})});}_0x3839fd=_['merge']({},_0x3839fd,_0x208c93[_0x6195('0x42')]);var _0xbcbc4b={'where':_0x3839fd[_0x6195('0x3e')]};return db[_0x6195('0x31')][_0x6195('0x21')](_0xbcbc4b)[_0x6195('0x28')](function(_0x353a65){_0x52d3ff[_0x6195('0x21')]=_0x353a65;if(_0x208c93[_0x6195('0x36')][_0x6195('0x43')]){_0x3839fd[_0x6195('0x44')]=[{'all':!![]}];}return db['JscriptyProject'][_0x6195('0x45')](_0x3839fd);})[_0x6195('0x28')](function(_0x45a188){_0x52d3ff[_0x6195('0x46')]=_0x45a188;return _0x52d3ff;})[_0x6195('0x28')](respondWithFilteredResult(_0x217ac1,_0x3839fd))['catch'](handleError(_0x217ac1,null));};exports[_0x6195('0x47')]=function(_0x1bc105,_0x45e392){var _0x11b900={'raw':![],'where':{'id':_0x1bc105[_0x6195('0x48')]['id']}},_0x35bd25={};_0x35bd25[_0x6195('0x35')]=_[_0x6195('0x49')](db['JscriptyProject'][_0x6195('0x32')]);_0x35bd25[_0x6195('0x36')]=_[_0x6195('0x49')](_0x1bc105[_0x6195('0x36')]);_0x35bd25[_0x6195('0x37')]=_[_0x6195('0x38')](_0x35bd25['model'],_0x35bd25[_0x6195('0x36')]);_0x11b900[_0x6195('0x39')]=_[_0x6195('0x38')](_0x35bd25[_0x6195('0x35')],qs[_0x6195('0x3a')](_0x1bc105[_0x6195('0x36')][_0x6195('0x3a')]));_0x11b900['attributes']=_0x11b900[_0x6195('0x39')][_0x6195('0x4a')]?_0x11b900[_0x6195('0x39')]:_0x35bd25[_0x6195('0x35')];if(_0x1bc105['query']['includeAll']){_0x11b900[_0x6195('0x44')]=[{'all':!![]}];}_0x11b900=_['merge']({},_0x11b900,_0x1bc105[_0x6195('0x42')]);return db[_0x6195('0x31')][_0x6195('0x4b')](_0x11b900)[_0x6195('0x28')](handleEntityNotFound(_0x45e392,null))['then'](respondWithResult(_0x45e392,null))[_0x6195('0x4c')](handleError(_0x45e392,null));};exports[_0x6195('0x4d')]=function(_0x3feac1,_0x1ea3e7){return db['JscriptyProject'][_0x6195('0x4d')](_0x3feac1[_0x6195('0x4e')],{})['then'](function(_0x4aec1e){var _0x3da422=_0x3feac1['user'][_0x6195('0x4f')]({'plain':!![]});if(!_0x3da422)throw new Error(_0x6195('0x50'));if(_0x3da422['role']==='user'){var _0x589bad=_0x4aec1e[_0x6195('0x4f')]({'plain':!![]});var _0x2a686a=_0x6195('0x51');return db['UserProfileSection'][_0x6195('0x4b')]({'where':{'name':_0x2a686a,'userProfileId':_0x3da422[_0x6195('0x52')]},'raw':!![]})['then'](function(_0x8cf212){if(_0x8cf212&&_0x8cf212[_0x6195('0x53')]===0x0){return db[_0x6195('0x29')][_0x6195('0x4d')]({'name':_0x589bad[_0x6195('0x2d')],'resourceId':_0x589bad['id'],'type':_0x8cf212[_0x6195('0x2d')],'sectionId':_0x8cf212['id']},{})[_0x6195('0x28')](function(){return _0x4aec1e;});}else{return _0x4aec1e;}})[_0x6195('0x4c')](function(_0x5842c0){logger[_0x6195('0x2b')](_0x6195('0x54'),_0x5842c0);throw _0x5842c0;});}return _0x4aec1e;})['then'](respondWithResult(_0x1ea3e7,0xc9))[_0x6195('0x4c')](handleError(_0x1ea3e7,null));};exports[_0x6195('0x55')]=function(_0x5c23ab,_0x20defd){var _0x460983={'where':{'id':_0x5c23ab[_0x6195('0x48')]['id']}},_0x4f536b={};_0x4f536b[_0x6195('0x35')]=_['keys'](db[_0x6195('0x31')][_0x6195('0x32')]);_0x460983[_0x6195('0x39')]=_[_0x6195('0x38')](_0x4f536b[_0x6195('0x35')],qs[_0x6195('0x3a')](_0x5c23ab[_0x6195('0x36')][_0x6195('0x3a')]));_0x460983[_0x6195('0x39')]=_0x460983[_0x6195('0x39')]['length']?_0x460983['attributes']:_0x4f536b[_0x6195('0x35')];if(_0x5c23ab[_0x6195('0x36')][_0x6195('0x43')]){_0x460983[_0x6195('0x44')]=[{'all':!![]}];}_0x460983=_[_0x6195('0x56')]({},_0x460983,_0x5c23ab[_0x6195('0x42')]);return db['JscriptyProject'][_0x6195('0x4b')](_0x460983)[_0x6195('0x28')](handleEntityNotFound(_0x20defd,null))[_0x6195('0x28')](function(_0x21b444){if(_0x21b444){var _0x532aaa=_0x21b444[_0x6195('0x4f')]({'plain':!![]});_0x532aaa=qs[_0x6195('0x57')](_0x532aaa,['id',_0x6195('0x58'),_0x6195('0x59')]);_0x5c23ab[_0x6195('0x4e')]=_['omit'](_0x5c23ab['body'],['id',_0x6195('0x58'),_0x6195('0x59')]);return db[_0x6195('0x31')][_0x6195('0x4d')](_[_0x6195('0x56')](_0x532aaa,_0x5c23ab[_0x6195('0x4e')]),{'include':_0x5c23ab[_0x6195('0x36')][_0x6195('0x43')]?[{'all':!![]}]:undefined})[_0x6195('0x28')](function(_0x1f7988){var _0x440696=_0x5c23ab['user'][_0x6195('0x4f')]({'plain':!![]});if(!_0x440696)throw new Error(_0x6195('0x50'));if(_0x440696[_0x6195('0x5a')]===_0x6195('0x5b')){var _0x1ef3e4=_0x1f7988[_0x6195('0x4f')]({'plain':!![]});var _0x17aece=_0x6195('0x51');return db[_0x6195('0x5c')][_0x6195('0x4b')]({'where':{'name':_0x17aece,'userProfileId':_0x440696[_0x6195('0x52')]},'raw':!![]})[_0x6195('0x28')](function(_0x187c98){if(_0x187c98&&_0x187c98[_0x6195('0x53')]===0x0){return db[_0x6195('0x29')]['create']({'name':_0x1ef3e4[_0x6195('0x2d')],'resourceId':_0x1ef3e4['id'],'type':_0x187c98[_0x6195('0x2d')],'sectionId':_0x187c98['id']},{})[_0x6195('0x28')](function(){return _0x1f7988;});}else{return _0x1f7988;}})[_0x6195('0x4c')](function(_0x10f978){logger[_0x6195('0x2b')](_0x6195('0x54'),_0x10f978);throw _0x10f978;});}return _0x1f7988;});}})['then'](respondWithResult(_0x20defd,0xc9))[_0x6195('0x4c')](handleError(_0x20defd,null));};exports[_0x6195('0x26')]=function(_0x3e6c67,_0x3494ee){if(_0x3e6c67[_0x6195('0x4e')]['id']){delete _0x3e6c67[_0x6195('0x4e')]['id'];}return db[_0x6195('0x31')][_0x6195('0x4b')]({'where':{'id':_0x3e6c67['params']['id']}})['then'](handleEntityNotFound(_0x3494ee,null))[_0x6195('0x28')](saveUpdates(_0x3e6c67[_0x6195('0x4e')],null))[_0x6195('0x28')](respondWithResult(_0x3494ee,null))[_0x6195('0x4c')](handleError(_0x3494ee,null));};exports[_0x6195('0x27')]=function(_0x36f5a4,_0x50d603){return db[_0x6195('0x31')][_0x6195('0x4b')]({'where':{'id':_0x36f5a4[_0x6195('0x48')]['id']}})['then'](handleEntityNotFound(_0x50d603,null))['then'](removeEntity(_0x50d603,null))[_0x6195('0x4c')](handleError(_0x50d603,null));};exports[_0x6195('0x5d')]=function(_0x691505,_0x3ecfba,_0x1bc14a){var _0x2d7dfa={'raw':!![],'where':{}};var _0x2e2f06={};var _0x393964={'count':0x0,'rows':[]};return db[_0x6195('0x31')][_0x6195('0x5e')]({'where':{'id':_0x691505['params']['id']}})[_0x6195('0x28')](handleEntityNotFound(_0x3ecfba,null))[_0x6195('0x28')](function(_0x31cb77){if(_0x31cb77){_0x2e2f06['model']=_[_0x6195('0x49')](db['JscriptySessionReport']['rawAttributes']);_0x2e2f06[_0x6195('0x36')]=_[_0x6195('0x49')](_0x691505[_0x6195('0x36')]);_0x2e2f06[_0x6195('0x37')]=_[_0x6195('0x38')](_0x2e2f06[_0x6195('0x35')],_0x2e2f06[_0x6195('0x36')]);_0x2d7dfa['attributes']=_[_0x6195('0x38')](_0x2e2f06[_0x6195('0x35')],qs['fields'](_0x691505[_0x6195('0x36')][_0x6195('0x3a')]));_0x2d7dfa[_0x6195('0x39')]=_0x2d7dfa[_0x6195('0x39')]['length']?_0x2d7dfa[_0x6195('0x39')]:_0x2e2f06[_0x6195('0x35')];if(!_0x691505[_0x6195('0x36')]['hasOwnProperty'](_0x6195('0x5f'))){_0x2d7dfa[_0x6195('0x3c')]=qs[_0x6195('0x3c')](_0x691505[_0x6195('0x36')][_0x6195('0x3c')]);_0x2d7dfa[_0x6195('0x1f')]=qs[_0x6195('0x1f')](_0x691505['query'][_0x6195('0x1f')]);}_0x2d7dfa[_0x6195('0x60')]=qs[_0x6195('0x3d')](_0x691505['query'][_0x6195('0x3d')]);_0x2d7dfa[_0x6195('0x3e')]=qs['filters'](_['pick'](_0x691505[_0x6195('0x36')],_0x2e2f06[_0x6195('0x37')]));_0x2d7dfa[_0x6195('0x3e')][_0x6195('0x61')]=_0x31cb77['id'];if(_0x691505[_0x6195('0x36')][_0x6195('0x40')]){_0x2d7dfa['where']=_['merge'](_0x2d7dfa[_0x6195('0x3e')],{'$or':_['map'](_0x2d7dfa[_0x6195('0x39')],function(_0x3533de){var _0x23e8ee={};_0x23e8ee[_0x3533de]={'$like':'%'+_0x691505[_0x6195('0x36')][_0x6195('0x40')]+'%'};return _0x23e8ee;})});}_0x2d7dfa=_[_0x6195('0x56')]({},_0x2d7dfa,_0x691505[_0x6195('0x42')]);return db[_0x6195('0x62')][_0x6195('0x21')]({'where':_0x2d7dfa[_0x6195('0x3e')]})[_0x6195('0x28')](function(_0x16576c){_0x393964[_0x6195('0x21')]=_0x16576c;if(_0x691505[_0x6195('0x36')][_0x6195('0x43')]){_0x2d7dfa['include']=[{'all':!![]}];}return db[_0x6195('0x62')][_0x6195('0x45')](_0x2d7dfa);})[_0x6195('0x28')](function(_0x195ba1){_0x393964[_0x6195('0x46')]=_0x195ba1;return _0x393964;});}})[_0x6195('0x28')](respondWithFilteredResult(_0x3ecfba,_0x2d7dfa))[_0x6195('0x4c')](handleError(_0x3ecfba,null));};exports[_0x6195('0x63')]=function(_0x58a03a,_0xe517be,_0xbc1944){var _0x5a809a={'raw':!![],'where':{}};var _0xeb2f6a={};var _0x46316a={'count':0x0,'rows':[]};return db[_0x6195('0x31')][_0x6195('0x5e')]({'where':{'id':_0x58a03a[_0x6195('0x48')]['id']}})[_0x6195('0x28')](handleEntityNotFound(_0xe517be,null))['then'](function(_0x40c727){if(_0x40c727){_0xeb2f6a[_0x6195('0x35')]=_[_0x6195('0x49')](db[_0x6195('0x64')][_0x6195('0x32')]);_0xeb2f6a[_0x6195('0x36')]=_[_0x6195('0x49')](_0x58a03a[_0x6195('0x36')]);_0xeb2f6a['filters']=_['intersection'](_0xeb2f6a[_0x6195('0x35')],_0xeb2f6a[_0x6195('0x36')]);_0x5a809a['attributes']=_[_0x6195('0x38')](_0xeb2f6a['model'],qs[_0x6195('0x3a')](_0x58a03a[_0x6195('0x36')][_0x6195('0x3a')]));_0x5a809a[_0x6195('0x39')]=_0x5a809a[_0x6195('0x39')]['length']?_0x5a809a[_0x6195('0x39')]:_0xeb2f6a[_0x6195('0x35')];if(!_0x58a03a[_0x6195('0x36')][_0x6195('0x3b')]('nolimit')){_0x5a809a[_0x6195('0x3c')]=qs[_0x6195('0x3c')](_0x58a03a[_0x6195('0x36')][_0x6195('0x3c')]);_0x5a809a[_0x6195('0x1f')]=qs[_0x6195('0x1f')](_0x58a03a[_0x6195('0x36')]['offset']);}_0x5a809a[_0x6195('0x60')]=qs[_0x6195('0x3d')](_0x58a03a[_0x6195('0x36')][_0x6195('0x3d')]);_0x5a809a['where']=qs[_0x6195('0x37')](_[_0x6195('0x3f')](_0x58a03a[_0x6195('0x36')],_0xeb2f6a['filters']));_0x5a809a[_0x6195('0x3e')][_0x6195('0x61')]=_0x40c727['id'];if(_0x58a03a[_0x6195('0x36')][_0x6195('0x40')]){_0x5a809a[_0x6195('0x3e')]=_['merge'](_0x5a809a[_0x6195('0x3e')],{'$or':_[_0x6195('0x30')](_0x5a809a[_0x6195('0x39')],function(_0x1e978a){var _0x4074c3={};_0x4074c3[_0x1e978a]={'$like':'%'+_0x58a03a['query'][_0x6195('0x40')]+'%'};return _0x4074c3;})});}_0x5a809a=_[_0x6195('0x56')]({},_0x5a809a,_0x58a03a[_0x6195('0x42')]);return db[_0x6195('0x64')]['count']({'where':_0x5a809a[_0x6195('0x3e')]})[_0x6195('0x28')](function(_0x38b8bd){_0x46316a[_0x6195('0x21')]=_0x38b8bd;if(_0x58a03a[_0x6195('0x36')][_0x6195('0x43')]){_0x5a809a[_0x6195('0x44')]=[{'all':!![]}];}return db[_0x6195('0x64')]['findAll'](_0x5a809a);})[_0x6195('0x28')](function(_0x436dd3){_0x46316a[_0x6195('0x46')]=_0x436dd3;return _0x46316a;});}})[_0x6195('0x28')](respondWithFilteredResult(_0xe517be,_0x5a809a))['catch'](handleError(_0xe517be,null));};function char(_0x4edab3){return _0x6195('0x65')===typeof _0x4edab3?String[_0x6195('0x66')][_0x6195('0x67')](null,arguments):_0x4edab3;}function needsEncapsulation(_0x4c5cda){return!!_0x4c5cda&&(_0x4c5cda[_0x6195('0x68')]()['indexOf'](char(0xd))>=0x0||_0x4c5cda[_0x6195('0x68')]()[_0x6195('0x69')](char(0xa))>=0x0||_0x4c5cda[_0x6195('0x68')]()[_0x6195('0x69')](char(0x2c))>=0x0||_0x4c5cda[_0x6195('0x68')]()[_0x6195('0x69')](char(0x22))>=0x0);}function encapsulate(_0x4dd628){var _0x3f0c69=char(0x22),_0x582fe4='\x5c'+char(0x22),_0x91e220=_0x4dd628[_0x6195('0x68')]()[_0x6195('0x6a')](new RegExp(_0x3f0c69,'g'),_0x582fe4);return _0x3f0c69+_0x91e220+_0x3f0c69;}exports[_0x6195('0x6b')]=function(_0x20af35,_0x343275,_0x41a3d4){var _0x45363b,_0x19d6f5;var _0x600032={'where':{'ProjectId':_0x20af35[_0x6195('0x48')]['id']}};if(_0x20af35[_0x6195('0x36')][_0x6195('0x6c')]){_0x600032[_0x6195('0x3e')]['starttime']=JSON[_0x6195('0x6d')](_0x20af35[_0x6195('0x36')][_0x6195('0x6c')]);}return db[_0x6195('0x62')][_0x6195('0x45')](_0x600032)[_0x6195('0x28')](handleEntityNotFound(_0x343275,null))['then'](function(_0x282f48){if(_0x282f48){_0x45363b=_0x282f48;return db[_0x6195('0x6e')][_0x6195('0x45')]({'where':{'SessionId':{'$in':_[_0x6195('0x30')](_0x45363b,'id')},'ProjectId':_0x20af35['params']['id']},'order':_0x6195('0x6f')});}})[_0x6195('0x28')](handleEntityNotFound(_0x343275,null))[_0x6195('0x28')](function(_0x34b4e8){if(_0x34b4e8){_0x19d6f5=_0x34b4e8;var _0x4f27da={};for(var _0x38ba43=0x0,_0x12c3ee=_0x19d6f5['length'];_0x38ba43<_0x12c3ee;_0x38ba43++){if(!_0x4f27da[_0x6195('0x3b')](_0x19d6f5[_0x38ba43][_0x6195('0x70')])){_0x4f27da[_0x19d6f5[_0x38ba43][_0x6195('0x70')]]=needsEncapsulation(_0x19d6f5[_0x38ba43][_0x6195('0x71')])?encapsulate(_0x19d6f5[_0x38ba43][_0x6195('0x71')]):_0x19d6f5[_0x38ba43]['question'];}}var _0x825885=[],_0x56d2b7={};for(var _0x39f1c1=0x0,_0x5540f3=_0x45363b[_0x6195('0x4a')];_0x39f1c1<_0x5540f3;_0x39f1c1++){_0x56d2b7={'ProjectId':_0x20af35['params']['id'],'SessionId':_0x45363b[_0x39f1c1]['id'],'StartTime':moment(_0x45363b[_0x39f1c1][_0x6195('0x72')])[_0x6195('0x73')](_0x6195('0x74'))};for(var _0x3200f7=0x0,_0x401bdb=_0x19d6f5[_0x6195('0x4a')];_0x3200f7<_0x401bdb;_0x3200f7++){if(_0x19d6f5[_0x3200f7][_0x6195('0x75')]==_0x45363b[_0x39f1c1]['id']&&_0x4f27da[_0x6195('0x3b')](_0x19d6f5[_0x3200f7][_0x6195('0x70')])){_0x56d2b7[_0x4f27da[_0x19d6f5[_0x3200f7][_0x6195('0x70')]]]=_0x19d6f5[_0x3200f7][_0x6195('0x76')];}}for(var _0x50f16b in _0x4f27da){if(!_0x56d2b7[_0x6195('0x3b')](_0x4f27da[_0x50f16b])){_0x56d2b7[_0x4f27da[_0x50f16b]]=null;}}_0x825885[_0x6195('0x77')](_0x56d2b7);}return _0x825885;}})[_0x6195('0x28')](function(_0x457125){if(!_[_0x6195('0x78')](_0x457125)){var _0x332219=toCsv(_0x457125);var _0x2cbacd=Date['now']();fs[_0x6195('0x79')](util[_0x6195('0x73')](_0x6195('0x7a'),_0x20af35[_0x6195('0x48')]['id'],_0x2cbacd),_0x332219);_0x343275[_0x6195('0x7b')](_0x6195('0x7c'),_0x6195('0x7d')+util['format'](_0x6195('0x7e'),_0x20af35[_0x6195('0x48')]['id'],_0x2cbacd));_0x343275[_0x6195('0x7b')](_0x6195('0x7f'),_0x6195('0x80'));return _0x343275[_0x6195('0x81')](util[_0x6195('0x73')](_0x6195('0x7a'),_0x20af35[_0x6195('0x48')]['id'],_0x2cbacd));}else{return _0x343275[_0x6195('0x1c')](0xcc);}})[_0x6195('0x4c')](handleError(_0x343275,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index e208d86..6918fa2 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 _0x769c=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','JscriptyProject','jscripty_projects'];(function(_0x16eb11,_0x1a2251){var _0x3ae7ef=function(_0x575a01){while(--_0x575a01){_0x16eb11['push'](_0x16eb11['shift']());}};_0x3ae7ef(++_0x1a2251);}(_0x769c,0x96));var _0xc769=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x769c[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xc769('0x0'));var util=require('util');var logger=require(_0xc769('0x1'))(_0xc769('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc769('0x3'));var fs=require('fs');var path=require(_0xc769('0x4'));var rimraf=require(_0xc769('0x5'));var config=require(_0xc769('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0xc769('0x7')]=function(_0x39a639,_0x4d9c51){return _0x39a639['define'](_0xc769('0x8'),attributes,{'tableName':_0xc769('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fed=['exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','request-promise','path','./jscriptyProject.attributes'];(function(_0x1fe739,_0x170a50){var _0x31de26=function(_0x2c2a05){while(--_0x2c2a05){_0x1fe739['push'](_0x1fe739['shift']());}};_0x31de26(++_0x170a50);}(_0x2fed,0x7c));var _0xd2fe=function(_0x1d7461,_0x32da57){_0x1d7461=_0x1d7461-0x0;var _0x17268d=_0x2fed[_0x1d7461];return _0x17268d;};'use strict';var _=require(_0xd2fe('0x0'));var util=require(_0xd2fe('0x1'));var logger=require(_0xd2fe('0x2'))(_0xd2fe('0x3'));var moment=require(_0xd2fe('0x4'));var BPromise=require('bluebird');var rp=require(_0xd2fe('0x5'));var fs=require('fs');var path=require(_0xd2fe('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd2fe('0x7'));module[_0xd2fe('0x8')]=function(_0xd85f89,_0x5be4d3){return _0xd85f89[_0xd2fe('0x9')](_0xd2fe('0xa'),attributes,{'tableName':_0xd2fe('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 d706d80..5432e22 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x33bb6f,_0x8516dd){var _0x29f99a=function(_0x1412f6){while(--_0x1412f6){_0x33bb6f['push'](_0x33bb6f['shift']());}};_0x29f99a(++_0x8516dd);}(_0xaa88,0x137));var _0x8aa8=function(_0x15bbf1,_0x40ef96){_0x15bbf1=_0x15bbf1-0x0;var _0x5c4b47=_0xaa88[_0x15bbf1];return _0x5c4b47;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x1caf3f,_0x1b4800){var _0x1905f0=function(_0x36e1eb){while(--_0x36e1eb){_0x1caf3f['push'](_0x1caf3f['shift']());}};_0x1905f0(++_0x1b4800);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 6a69371..0cb07f2 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 _0x080f=['index','/describe','/:id','show','post','create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated'];(function(_0x5ac2d2,_0x3104dc){var _0x4311a2=function(_0x148fa9){while(--_0x148fa9){_0x5ac2d2['push'](_0x5ac2d2['shift']());}};_0x4311a2(++_0x3104dc);}(_0x080f,0xc7));var _0xf080=function(_0x5415bc,_0x3d5334){_0x5415bc=_0x5415bc-0x0;var _0x21dc2e=_0x080f[_0x5415bc];return _0x21dc2e;};'use strict';var multer=require(_0xf080('0x0'));var util=require(_0xf080('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf080('0x2'));var router=express[_0xf080('0x3')]();var fs_extra=require(_0xf080('0x4'));var auth=require(_0xf080('0x5'));var interaction=require(_0xf080('0x6'));var config=require(_0xf080('0x7'));var controller=require(_0xf080('0x8'));router[_0xf080('0x9')]('/',auth[_0xf080('0xa')](),controller[_0xf080('0xb')]);router[_0xf080('0x9')](_0xf080('0xc'),auth[_0xf080('0xa')](),controller['describe']);router[_0xf080('0x9')](_0xf080('0xd'),auth[_0xf080('0xa')](),controller[_0xf080('0xe')]);router[_0xf080('0xf')]('/',auth['isAuthenticated'](),controller[_0xf080('0x10')]);router[_0xf080('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xf080('0x12')]);router[_0xf080('0x13')](_0xf080('0xd'),auth[_0xf080('0xa')](),controller['destroy']);module[_0xf080('0x14')]=router; \ No newline at end of file +var _0x86b7=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','exports'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0x86b7,0x160));var _0x786b=function(_0x24b4cb,_0x48da0e){_0x24b4cb=_0x24b4cb-0x0;var _0x2717e3=_0x86b7[_0x24b4cb];return _0x2717e3;};'use strict';var multer=require(_0x786b('0x0'));var util=require(_0x786b('0x1'));var path=require(_0x786b('0x2'));var timeout=require('connect-timeout');var express=require(_0x786b('0x3'));var router=express[_0x786b('0x4')]();var fs_extra=require(_0x786b('0x5'));var auth=require(_0x786b('0x6'));var interaction=require(_0x786b('0x7'));var config=require(_0x786b('0x8'));var controller=require(_0x786b('0x9'));router['get']('/',auth[_0x786b('0xa')](),controller[_0x786b('0xb')]);router[_0x786b('0xc')](_0x786b('0xd'),auth[_0x786b('0xa')](),controller[_0x786b('0xe')]);router[_0x786b('0xc')](_0x786b('0xf'),auth[_0x786b('0xa')](),controller[_0x786b('0x10')]);router[_0x786b('0x11')]('/',auth['isAuthenticated'](),controller[_0x786b('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x786b('0x13')]);router[_0x786b('0x14')](_0x786b('0xf'),auth[_0x786b('0xa')](),controller['destroy']);module[_0x786b('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index bcca5cb..7f8f77c 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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x31af72,_0x300e1b){_0x31af72=_0x31af72-0x0;var _0x37aa9a=_0x7a54[_0x31af72];return _0x37aa9a;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a54,0x106));var _0x47a5=function(_0x324fcf,_0x23aacb){_0x324fcf=_0x324fcf-0x0;var _0x37bc8d=_0x7a54[_0x324fcf];return _0x37bc8d;};'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 0c3d858..04aab1a 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 _0x0da1=['pick','VIRTUAL','filter','merge','options','JscriptyQuestionReport','includeAll','include','findAll','catch','params','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','stack','name','send','index','map','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x45b972,_0x55be4a){var _0x354b76=function(_0x90cba1){while(--_0x90cba1){_0x45b972['push'](_0x45b972['shift']());}};_0x354b76(++_0x55be4a);}(_0x0da1,0xf1));var _0x10da=function(_0x424a9a,_0x2dd9af){_0x424a9a=_0x424a9a-0x0;var _0xa7831c=_0x0da1[_0x424a9a];return _0xa7831c;};'use strict';var emlformat=require(_0x10da('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x10da('0x1'));var jsonpatch=require(_0x10da('0x2'));var rp=require(_0x10da('0x3'));var moment=require(_0x10da('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x10da('0x5'));var util=require(_0x10da('0x6'));var path=require(_0x10da('0x7'));var sox=require(_0x10da('0x8'));var csv=require(_0x10da('0x9'));var ejs=require(_0x10da('0xa'));var fs=require('fs');var fs_extra=require(_0x10da('0xb'));var _=require('lodash');var squel=require(_0x10da('0xc'));var crypto=require(_0x10da('0xd'));var jsforce=require(_0x10da('0xe'));var deskjs=require(_0x10da('0xf'));var toCsv=require(_0x10da('0x9'));var querystring=require(_0x10da('0x10'));var Papa=require('papaparse');var Redis=require(_0x10da('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x10da('0x12'));var as=require(_0x10da('0x13'));var hardwareService=require(_0x10da('0x14'));var logger=require(_0x10da('0x15'))(_0x10da('0x16'));var utils=require('../../config/utils');var config=require(_0x10da('0x17'));var licenseUtil=require(_0x10da('0x18'));var db=require(_0x10da('0x19'))['db'];function respondWithStatusCode(_0x29d38e,_0x3805cf){_0x3805cf=_0x3805cf||0xcc;return function(_0x23e430){if(_0x23e430){return _0x29d38e[_0x10da('0x1a')](_0x3805cf);}return _0x29d38e[_0x10da('0x1b')](_0x3805cf)[_0x10da('0x1c')]();};}function respondWithResult(_0x729d2b,_0x38d66d){_0x38d66d=_0x38d66d||0xc8;return function(_0x50c714){if(_0x50c714){return _0x729d2b[_0x10da('0x1b')](_0x38d66d)[_0x10da('0x1d')](_0x50c714);}};}function respondWithFilteredResult(_0x1cfed7,_0xbcc5bd){return function(_0x4a8d10){if(_0x4a8d10){var _0xf4e0bc=typeof _0xbcc5bd[_0x10da('0x1e')]===_0x10da('0x1f')&&typeof _0xbcc5bd[_0x10da('0x20')]===_0x10da('0x1f');var _0x35192f=_0x4a8d10[_0x10da('0x21')];var _0x1bdbc0=_0xf4e0bc?0x0:_0xbcc5bd[_0x10da('0x1e')];var _0x53b65f=_0xf4e0bc?_0x4a8d10[_0x10da('0x21')]:_0xbcc5bd[_0x10da('0x1e')]+_0xbcc5bd[_0x10da('0x20')];var _0x793f44;if(_0x53b65f>=_0x35192f){_0x53b65f=_0x35192f;_0x793f44=0xc8;}else{_0x793f44=0xce;}_0x1cfed7[_0x10da('0x1b')](_0x793f44);return _0x1cfed7[_0x10da('0x22')](_0x10da('0x23'),_0x1bdbc0+'-'+_0x53b65f+'/'+_0x35192f)[_0x10da('0x1d')](_0x4a8d10);}return null;};}function patchUpdates(_0x1fc03c){return function(_0x1b8aaa){try{jsonpatch['apply'](_0x1b8aaa,_0x1fc03c,!![]);}catch(_0x12fb85){return BPromise[_0x10da('0x24')](_0x12fb85);}return _0x1b8aaa[_0x10da('0x25')]();};}function saveUpdates(_0x4951fd,_0x2f2520){return function(_0x15e743){if(_0x15e743){return _0x15e743['update'](_0x4951fd)['then'](function(_0x23f7d2){return _0x23f7d2;});}return null;};}function removeEntity(_0x47b988,_0x3ec065){return function(_0x202dcc){if(_0x202dcc){return _0x202dcc['destroy']()[_0x10da('0x26')](function(){_0x47b988[_0x10da('0x1b')](0xcc)[_0x10da('0x1c')]();});}};}function handleEntityNotFound(_0x565ed7,_0x3540ee){return function(_0x33f731){if(!_0x33f731){_0x565ed7[_0x10da('0x1a')](0x194);}return _0x33f731;};}function handleError(_0x53a43c,_0x4e11f7){_0x4e11f7=_0x4e11f7||0x1f4;return function(_0x59aed4){logger['error'](_0x59aed4[_0x10da('0x27')]);if(_0x59aed4[_0x10da('0x28')]){delete _0x59aed4['name'];}_0x53a43c['status'](_0x4e11f7)[_0x10da('0x29')](_0x59aed4);};}exports[_0x10da('0x2a')]=function(_0x41bdaf,_0x2c1c49){var _0x3b7b99={},_0x2a51f2={},_0x527cf0={'count':0x0,'rows':[]};var _0x14deef=_[_0x10da('0x2b')](db['JscriptyQuestionReport']['rawAttributes'],function(_0xff167c){return{'name':_0xff167c[_0x10da('0x2c')],'type':_0xff167c[_0x10da('0x2d')]['key']};});_0x2a51f2[_0x10da('0x2e')]=_[_0x10da('0x2b')](_0x14deef,_0x10da('0x28'));_0x2a51f2['query']=_[_0x10da('0x2f')](_0x41bdaf[_0x10da('0x30')]);_0x2a51f2['filters']=_[_0x10da('0x31')](_0x2a51f2[_0x10da('0x2e')],_0x2a51f2[_0x10da('0x30')]);_0x3b7b99[_0x10da('0x32')]=_[_0x10da('0x31')](_0x2a51f2['model'],qs['fields'](_0x41bdaf[_0x10da('0x30')][_0x10da('0x33')]));_0x3b7b99[_0x10da('0x32')]=_0x3b7b99[_0x10da('0x32')][_0x10da('0x34')]?_0x3b7b99[_0x10da('0x32')]:_0x2a51f2[_0x10da('0x2e')];if(!_0x41bdaf[_0x10da('0x30')][_0x10da('0x35')](_0x10da('0x36'))){_0x3b7b99[_0x10da('0x20')]=qs[_0x10da('0x20')](_0x41bdaf[_0x10da('0x30')][_0x10da('0x20')]);_0x3b7b99[_0x10da('0x1e')]=qs[_0x10da('0x1e')](_0x41bdaf[_0x10da('0x30')][_0x10da('0x1e')]);}_0x3b7b99[_0x10da('0x37')]=qs[_0x10da('0x38')](_0x41bdaf[_0x10da('0x30')][_0x10da('0x38')]);_0x3b7b99[_0x10da('0x39')]=qs[_0x10da('0x3a')](_[_0x10da('0x3b')](_0x41bdaf['query'],_0x2a51f2[_0x10da('0x3a')]),_0x14deef);if(_0x41bdaf[_0x10da('0x30')]['filter']){_0x3b7b99[_0x10da('0x39')]=_['merge'](_0x3b7b99[_0x10da('0x39')],{'$or':_[_0x10da('0x2b')](_0x14deef,function(_0x1d21a6){if(_0x1d21a6[_0x10da('0x2d')]!==_0x10da('0x3c')){var _0x373135={};_0x373135[_0x1d21a6['name']]={'$like':'%'+_0x41bdaf[_0x10da('0x30')][_0x10da('0x3d')]+'%'};return _0x373135;}})});}_0x3b7b99=_[_0x10da('0x3e')]({},_0x3b7b99,_0x41bdaf[_0x10da('0x3f')]);var _0x2880ee={'where':_0x3b7b99['where']};return db[_0x10da('0x40')][_0x10da('0x21')](_0x2880ee)['then'](function(_0x288bcd){_0x527cf0[_0x10da('0x21')]=_0x288bcd;if(_0x41bdaf[_0x10da('0x30')][_0x10da('0x41')]){_0x3b7b99[_0x10da('0x42')]=[{'all':!![]}];}return db[_0x10da('0x40')][_0x10da('0x43')](_0x3b7b99);})[_0x10da('0x26')](function(_0xc9a11d){_0x527cf0['rows']=_0xc9a11d;return _0x527cf0;})[_0x10da('0x26')](respondWithFilteredResult(_0x2c1c49,_0x3b7b99))[_0x10da('0x44')](handleError(_0x2c1c49,null));};exports['show']=function(_0x5d27f8,_0x37b957){var _0x582b98={'raw':!![],'where':{'id':_0x5d27f8[_0x10da('0x45')]['id']}},_0x410285={};_0x410285[_0x10da('0x2e')]=_[_0x10da('0x2f')](db[_0x10da('0x40')]['rawAttributes']);_0x410285[_0x10da('0x30')]=_[_0x10da('0x2f')](_0x5d27f8['query']);_0x410285[_0x10da('0x3a')]=_['intersection'](_0x410285[_0x10da('0x2e')],_0x410285['query']);_0x582b98[_0x10da('0x32')]=_[_0x10da('0x31')](_0x410285[_0x10da('0x2e')],qs[_0x10da('0x33')](_0x5d27f8[_0x10da('0x30')][_0x10da('0x33')]));_0x582b98['attributes']=_0x582b98[_0x10da('0x32')][_0x10da('0x34')]?_0x582b98[_0x10da('0x32')]:_0x410285['model'];if(_0x5d27f8[_0x10da('0x30')][_0x10da('0x41')]){_0x582b98[_0x10da('0x42')]=[{'all':!![]}];}_0x582b98=_[_0x10da('0x3e')]({},_0x582b98,_0x5d27f8['options']);return db[_0x10da('0x40')][_0x10da('0x46')](_0x582b98)[_0x10da('0x26')](handleEntityNotFound(_0x37b957,null))['then'](respondWithResult(_0x37b957,null))['catch'](handleError(_0x37b957,null));};exports[_0x10da('0x47')]=function(_0x6dd9be,_0x48067e){return db[_0x10da('0x40')][_0x10da('0x47')](_0x6dd9be[_0x10da('0x48')],{})[_0x10da('0x26')](respondWithResult(_0x48067e,0xc9))['catch'](handleError(_0x48067e,null));};exports[_0x10da('0x49')]=function(_0x4fd28e,_0x4df80b){if(_0x4fd28e[_0x10da('0x48')]['id']){delete _0x4fd28e[_0x10da('0x48')]['id'];}return db[_0x10da('0x40')][_0x10da('0x46')]({'where':{'id':_0x4fd28e[_0x10da('0x45')]['id']}})[_0x10da('0x26')](handleEntityNotFound(_0x4df80b,null))[_0x10da('0x26')](saveUpdates(_0x4fd28e[_0x10da('0x48')],null))[_0x10da('0x26')](respondWithResult(_0x4df80b,null))['catch'](handleError(_0x4df80b,null));};exports['destroy']=function(_0x41a835,_0x504a94){return db[_0x10da('0x40')]['find']({'where':{'id':_0x41a835[_0x10da('0x45')]['id']}})[_0x10da('0x26')](handleEntityNotFound(_0x504a94,null))[_0x10da('0x26')](removeEntity(_0x504a94,null))[_0x10da('0x44')](handleError(_0x504a94,null));};exports[_0x10da('0x4a')]=function(_0xe27a86,_0x420a48){return db[_0x10da('0x40')][_0x10da('0x4a')]()[_0x10da('0x26')](respondWithResult(_0x420a48,null))[_0x10da('0x44')](handleError(_0x420a48,null));}; \ No newline at end of file +var _0x5120=['where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','find','create','body','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','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','apply','reject','save','update','then','end','stack','name','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x5120,0x179));var _0x0512=function(_0x34967e,_0x11f483){_0x34967e=_0x34967e-0x0;var _0x406971=_0x5120[_0x34967e];return _0x406971;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0512('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0512('0x1'));var rp=require(_0x0512('0x2'));var moment=require(_0x0512('0x3'));var BPromise=require(_0x0512('0x4'));var Mustache=require(_0x0512('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0512('0x6'));var ejs=require(_0x0512('0x7'));var fs=require('fs');var fs_extra=require(_0x0512('0x8'));var _=require(_0x0512('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0512('0xa'));var deskjs=require(_0x0512('0xb'));var toCsv=require(_0x0512('0x6'));var querystring=require('querystring');var Papa=require(_0x0512('0xc'));var Redis=require(_0x0512('0xd'));var authService=require(_0x0512('0xe'));var qs=require(_0x0512('0xf'));var as=require(_0x0512('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0512('0x11'))('api');var utils=require(_0x0512('0x12'));var config=require(_0x0512('0x13'));var licenseUtil=require(_0x0512('0x14'));var db=require(_0x0512('0x15'))['db'];function respondWithStatusCode(_0x174782,_0x531fd5){_0x531fd5=_0x531fd5||0xcc;return function(_0x601604){if(_0x601604){return _0x174782[_0x0512('0x16')](_0x531fd5);}return _0x174782[_0x0512('0x17')](_0x531fd5)['end']();};}function respondWithResult(_0x1bd761,_0x5afe41){_0x5afe41=_0x5afe41||0xc8;return function(_0x3703b2){if(_0x3703b2){return _0x1bd761[_0x0512('0x17')](_0x5afe41)[_0x0512('0x18')](_0x3703b2);}};}function respondWithFilteredResult(_0x2fe085,_0x50bec6){return function(_0x11490f){if(_0x11490f){var _0x114c03=typeof _0x50bec6['offset']===_0x0512('0x19')&&typeof _0x50bec6[_0x0512('0x1a')]===_0x0512('0x19');var _0x5e1da6=_0x11490f[_0x0512('0x1b')];var _0x1007b4=_0x114c03?0x0:_0x50bec6[_0x0512('0x1c')];var _0x5643b8=_0x114c03?_0x11490f['count']:_0x50bec6[_0x0512('0x1c')]+_0x50bec6[_0x0512('0x1a')];var _0x2cee73;if(_0x5643b8>=_0x5e1da6){_0x5643b8=_0x5e1da6;_0x2cee73=0xc8;}else{_0x2cee73=0xce;}_0x2fe085[_0x0512('0x17')](_0x2cee73);return _0x2fe085[_0x0512('0x1d')]('Content-Range',_0x1007b4+'-'+_0x5643b8+'/'+_0x5e1da6)[_0x0512('0x18')](_0x11490f);}return null;};}function patchUpdates(_0x17c575){return function(_0x3ff964){try{jsonpatch[_0x0512('0x1e')](_0x3ff964,_0x17c575,!![]);}catch(_0x23051f){return BPromise[_0x0512('0x1f')](_0x23051f);}return _0x3ff964[_0x0512('0x20')]();};}function saveUpdates(_0x158352,_0xf28f81){return function(_0x967613){if(_0x967613){return _0x967613[_0x0512('0x21')](_0x158352)[_0x0512('0x22')](function(_0x54702b){return _0x54702b;});}return null;};}function removeEntity(_0x4f0111,_0x404d1d){return function(_0xa80dc1){if(_0xa80dc1){return _0xa80dc1['destroy']()[_0x0512('0x22')](function(){_0x4f0111[_0x0512('0x17')](0xcc)[_0x0512('0x23')]();});}};}function handleEntityNotFound(_0x2689ff,_0x3d5343){return function(_0x20ef5f){if(!_0x20ef5f){_0x2689ff[_0x0512('0x16')](0x194);}return _0x20ef5f;};}function handleError(_0x5c0966,_0x3cebfb){_0x3cebfb=_0x3cebfb||0x1f4;return function(_0x16012b){logger['error'](_0x16012b[_0x0512('0x24')]);if(_0x16012b[_0x0512('0x25')]){delete _0x16012b[_0x0512('0x25')];}_0x5c0966[_0x0512('0x17')](_0x3cebfb)['send'](_0x16012b);};}exports[_0x0512('0x26')]=function(_0x3c48f3,_0x56ad0b){var _0x4b7244={},_0x310282={},_0xf067c6={'count':0x0,'rows':[]};var _0x5dc083=_[_0x0512('0x27')](db[_0x0512('0x28')]['rawAttributes'],function(_0x2001d0){return{'name':_0x2001d0[_0x0512('0x29')],'type':_0x2001d0[_0x0512('0x2a')][_0x0512('0x2b')]};});_0x310282[_0x0512('0x2c')]=_[_0x0512('0x27')](_0x5dc083,_0x0512('0x25'));_0x310282[_0x0512('0x2d')]=_[_0x0512('0x2e')](_0x3c48f3['query']);_0x310282[_0x0512('0x2f')]=_['intersection'](_0x310282[_0x0512('0x2c')],_0x310282['query']);_0x4b7244[_0x0512('0x30')]=_[_0x0512('0x31')](_0x310282[_0x0512('0x2c')],qs[_0x0512('0x32')](_0x3c48f3[_0x0512('0x2d')][_0x0512('0x32')]));_0x4b7244[_0x0512('0x30')]=_0x4b7244[_0x0512('0x30')]['length']?_0x4b7244[_0x0512('0x30')]:_0x310282[_0x0512('0x2c')];if(!_0x3c48f3[_0x0512('0x2d')][_0x0512('0x33')](_0x0512('0x34'))){_0x4b7244[_0x0512('0x1a')]=qs[_0x0512('0x1a')](_0x3c48f3[_0x0512('0x2d')][_0x0512('0x1a')]);_0x4b7244[_0x0512('0x1c')]=qs['offset'](_0x3c48f3[_0x0512('0x2d')][_0x0512('0x1c')]);}_0x4b7244[_0x0512('0x35')]=qs[_0x0512('0x36')](_0x3c48f3[_0x0512('0x2d')][_0x0512('0x36')]);_0x4b7244[_0x0512('0x37')]=qs[_0x0512('0x2f')](_[_0x0512('0x38')](_0x3c48f3['query'],_0x310282[_0x0512('0x2f')]),_0x5dc083);if(_0x3c48f3[_0x0512('0x2d')][_0x0512('0x39')]){_0x4b7244['where']=_[_0x0512('0x3a')](_0x4b7244['where'],{'$or':_[_0x0512('0x27')](_0x5dc083,function(_0xdf7c08){if(_0xdf7c08[_0x0512('0x2a')]!==_0x0512('0x3b')){var _0x1e0385={};_0x1e0385[_0xdf7c08['name']]={'$like':'%'+_0x3c48f3[_0x0512('0x2d')][_0x0512('0x39')]+'%'};return _0x1e0385;}})});}_0x4b7244=_[_0x0512('0x3a')]({},_0x4b7244,_0x3c48f3[_0x0512('0x3c')]);var _0x3d3c02={'where':_0x4b7244[_0x0512('0x37')]};return db[_0x0512('0x28')][_0x0512('0x1b')](_0x3d3c02)[_0x0512('0x22')](function(_0x43f6f5){_0xf067c6[_0x0512('0x1b')]=_0x43f6f5;if(_0x3c48f3[_0x0512('0x2d')]['includeAll']){_0x4b7244[_0x0512('0x3d')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x0512('0x3e')](_0x4b7244);})[_0x0512('0x22')](function(_0x19b59b){_0xf067c6['rows']=_0x19b59b;return _0xf067c6;})[_0x0512('0x22')](respondWithFilteredResult(_0x56ad0b,_0x4b7244))[_0x0512('0x3f')](handleError(_0x56ad0b,null));};exports[_0x0512('0x40')]=function(_0x55148b,_0x4fb243){var _0x3b3916={'raw':!![],'where':{'id':_0x55148b[_0x0512('0x41')]['id']}},_0x4e13f8={};_0x4e13f8[_0x0512('0x2c')]=_[_0x0512('0x2e')](db[_0x0512('0x28')][_0x0512('0x42')]);_0x4e13f8['query']=_['keys'](_0x55148b[_0x0512('0x2d')]);_0x4e13f8['filters']=_[_0x0512('0x31')](_0x4e13f8[_0x0512('0x2c')],_0x4e13f8[_0x0512('0x2d')]);_0x3b3916['attributes']=_['intersection'](_0x4e13f8[_0x0512('0x2c')],qs['fields'](_0x55148b[_0x0512('0x2d')][_0x0512('0x32')]));_0x3b3916[_0x0512('0x30')]=_0x3b3916[_0x0512('0x30')]['length']?_0x3b3916[_0x0512('0x30')]:_0x4e13f8[_0x0512('0x2c')];if(_0x55148b[_0x0512('0x2d')]['includeAll']){_0x3b3916[_0x0512('0x3d')]=[{'all':!![]}];}_0x3b3916=_['merge']({},_0x3b3916,_0x55148b[_0x0512('0x3c')]);return db[_0x0512('0x28')][_0x0512('0x43')](_0x3b3916)['then'](handleEntityNotFound(_0x4fb243,null))[_0x0512('0x22')](respondWithResult(_0x4fb243,null))['catch'](handleError(_0x4fb243,null));};exports[_0x0512('0x44')]=function(_0x24a726,_0x2920b0){return db[_0x0512('0x28')]['create'](_0x24a726[_0x0512('0x45')],{})[_0x0512('0x22')](respondWithResult(_0x2920b0,0xc9))[_0x0512('0x3f')](handleError(_0x2920b0,null));};exports[_0x0512('0x21')]=function(_0x153400,_0xa4fbb3){if(_0x153400[_0x0512('0x45')]['id']){delete _0x153400['body']['id'];}return db[_0x0512('0x28')]['find']({'where':{'id':_0x153400[_0x0512('0x41')]['id']}})[_0x0512('0x22')](handleEntityNotFound(_0xa4fbb3,null))[_0x0512('0x22')](saveUpdates(_0x153400['body'],null))['then'](respondWithResult(_0xa4fbb3,null))[_0x0512('0x3f')](handleError(_0xa4fbb3,null));};exports[_0x0512('0x46')]=function(_0x417583,_0x27d1a6){return db[_0x0512('0x28')][_0x0512('0x43')]({'where':{'id':_0x417583['params']['id']}})[_0x0512('0x22')](handleEntityNotFound(_0x27d1a6,null))['then'](removeEntity(_0x27d1a6,null))[_0x0512('0x3f')](handleError(_0x27d1a6,null));};exports['describe']=function(_0x4745d2,_0x3caab9){return db[_0x0512('0x28')][_0x0512('0x47')]()['then'](respondWithResult(_0x3caab9,null))[_0x0512('0x3f')](handleError(_0x3caab9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 0222813..e03987e 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 _0x0d7b=['report_jscripty_questions','lodash','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport'];(function(_0x4ad493,_0x421d2a){var _0x45cf27=function(_0x5309b6){while(--_0x5309b6){_0x4ad493['push'](_0x4ad493['shift']());}};_0x45cf27(++_0x421d2a);}(_0x0d7b,0xdd));var _0xb0d7=function(_0x244c3f,_0x48986d){_0x244c3f=_0x244c3f-0x0;var _0x562d48=_0x0d7b[_0x244c3f];return _0x562d48;};'use strict';var _=require(_0xb0d7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb0d7('0x1'));var BPromise=require(_0xb0d7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb0d7('0x3'));var rimraf=require(_0xb0d7('0x4'));var config=require(_0xb0d7('0x5'));var attributes=require(_0xb0d7('0x6'));module[_0xb0d7('0x7')]=function(_0x3d6c2f,_0x419991){return _0x3d6c2f['define'](_0xb0d7('0x8'),attributes,{'tableName':_0xb0d7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa898=['path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3f8851,_0x51e8a3){var _0xf3440=function(_0x507ed9){while(--_0x507ed9){_0x3f8851['push'](_0x3f8851['shift']());}};_0xf3440(++_0x51e8a3);}(_0xa898,0x158));var _0x8a89=function(_0x28dd8f,_0x572ef5){_0x28dd8f=_0x28dd8f-0x0;var _0x4809d1=_0xa898[_0x28dd8f];return _0x4809d1;};'use strict';var _=require(_0x8a89('0x0'));var util=require(_0x8a89('0x1'));var logger=require(_0x8a89('0x2'))(_0x8a89('0x3'));var moment=require(_0x8a89('0x4'));var BPromise=require(_0x8a89('0x5'));var rp=require(_0x8a89('0x6'));var fs=require('fs');var path=require(_0x8a89('0x7'));var rimraf=require(_0x8a89('0x8'));var config=require(_0x8a89('0x9'));var attributes=require(_0x8a89('0xa'));module[_0x8a89('0xb')]=function(_0x1a90af,_0x44ed78){return _0x1a90af['define'](_0x8a89('0xc'),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 ea81ff5..3b31ad1 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 _0x7d37=['then','info','request\x20sent','debug','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request'];(function(_0x57730a,_0x3d41e1){var _0x2b5037=function(_0x4a93ff){while(--_0x4a93ff){_0x57730a['push'](_0x57730a['shift']());}};_0x2b5037(++_0x3d41e1);}(_0x7d37,0xba));var _0x77d3=function(_0x2d13e5,_0x1d74bf){_0x2d13e5=_0x2d13e5-0x0;var _0x578aca=_0x7d37[_0x2d13e5];return _0x578aca;};'use strict';var _=require(_0x77d3('0x0'));var util=require(_0x77d3('0x1'));var moment=require(_0x77d3('0x2'));var BPromise=require(_0x77d3('0x3'));var rs=require(_0x77d3('0x4'));var fs=require('fs');var Redis=require(_0x77d3('0x5'));var db=require(_0x77d3('0x6'))['db'];var utils=require(_0x77d3('0x7'));var logger=require(_0x77d3('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x77d3('0x9'));var client=jayson['client'][_0x77d3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7d67b,_0x2741bc,_0x4bdbdc){return new BPromise(function(_0x69849,_0x1cf56d){return client[_0x77d3('0xb')](_0x7d67b,_0x4bdbdc)[_0x77d3('0xc')](function(_0xae9db){logger[_0x77d3('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2741bc,_0x77d3('0xe'));logger[_0x77d3('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x2741bc,_0x77d3('0xe'),JSON[_0x77d3('0x10')](_0xae9db));if(_0xae9db[_0x77d3('0x11')]){if(_0xae9db['error'][_0x77d3('0x12')]===0x1f4){logger['error'](_0x77d3('0x13'),_0x2741bc,_0xae9db['error'][_0x77d3('0x14')]);return _0x1cf56d(_0xae9db[_0x77d3('0x11')]['message']);}logger['error'](_0x77d3('0x13'),_0x2741bc,_0xae9db[_0x77d3('0x11')]['message']);return _0x69849(_0xae9db[_0x77d3('0x11')]['message']);}else{logger[_0x77d3('0xd')](_0x77d3('0x13'),_0x2741bc,'request\x20sent');_0x69849(_0xae9db[_0x77d3('0x15')][_0x77d3('0x14')]);}})['catch'](function(_0xf3bad4){logger['error'](_0x77d3('0x13'),_0x2741bc,_0xf3bad4);_0x1cf56d(_0xf3bad4);});});} \ No newline at end of file +var _0x92b7=['jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x92b7,0xcf));var _0x792b=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x92b7[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x792b('0x0'));var util=require(_0x792b('0x1'));var moment=require('moment');var BPromise=require(_0x792b('0x2'));var rs=require(_0x792b('0x3'));var fs=require('fs');var Redis=require(_0x792b('0x4'));var db=require(_0x792b('0x5'))['db'];var utils=require(_0x792b('0x6'));var logger=require(_0x792b('0x7'))(_0x792b('0x8'));var config=require('../../config/environment');var jayson=require(_0x792b('0x9'));var client=jayson[_0x792b('0xa')][_0x792b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c92fe,_0x1990e7,_0x207cc6){return new BPromise(function(_0x5f7d95,_0x15468f){return client[_0x792b('0xc')](_0x5c92fe,_0x207cc6)[_0x792b('0xd')](function(_0x344dba){logger[_0x792b('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1990e7,_0x792b('0xf'));logger[_0x792b('0x10')](_0x792b('0x11'),_0x1990e7,_0x792b('0xf'),JSON['stringify'](_0x344dba));if(_0x344dba[_0x792b('0x12')]){if(_0x344dba[_0x792b('0x12')][_0x792b('0x13')]===0x1f4){logger[_0x792b('0x12')](_0x792b('0x14'),_0x1990e7,_0x344dba[_0x792b('0x12')][_0x792b('0x15')]);return _0x15468f(_0x344dba[_0x792b('0x12')][_0x792b('0x15')]);}logger[_0x792b('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1990e7,_0x344dba[_0x792b('0x12')][_0x792b('0x15')]);return _0x5f7d95(_0x344dba[_0x792b('0x12')][_0x792b('0x15')]);}else{logger['info'](_0x792b('0x14'),_0x1990e7,_0x792b('0xf'));_0x5f7d95(_0x344dba[_0x792b('0x16')][_0x792b('0x15')]);}})[_0x792b('0x17')](function(_0x591746){logger[_0x792b('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1990e7,_0x591746);_0x15468f(_0x591746);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4dc8dcf..19cd61a 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 _0x2823=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/questions','getQuestions','post','put','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x52389e,_0x12dd17){var _0x8ce131=function(_0x30fee6){while(--_0x30fee6){_0x52389e['push'](_0x52389e['shift']());}};_0x8ce131(++_0x12dd17);}(_0x2823,0x173));var _0x3282=function(_0x3e11b8,_0x31bbf7){_0x3e11b8=_0x3e11b8-0x0;var _0x73274d=_0x2823[_0x3e11b8];return _0x73274d;};'use strict';var multer=require(_0x3282('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3282('0x1'));var express=require(_0x3282('0x2'));var router=express[_0x3282('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3282('0x4'));var interaction=require(_0x3282('0x5'));var config=require(_0x3282('0x6'));var controller=require(_0x3282('0x7'));router['get']('/',auth[_0x3282('0x8')](),controller[_0x3282('0x9')]);router[_0x3282('0xa')](_0x3282('0xb'),auth[_0x3282('0x8')](),controller[_0x3282('0xc')]);router[_0x3282('0xa')](_0x3282('0xd'),auth[_0x3282('0x8')](),controller[_0x3282('0xe')]);router[_0x3282('0xa')](_0x3282('0xf'),auth[_0x3282('0x8')](),controller[_0x3282('0x10')]);router[_0x3282('0x11')]('/',auth[_0x3282('0x8')](),controller['create']);router[_0x3282('0x12')](_0x3282('0xd'),auth[_0x3282('0x8')](),controller['update']);router[_0x3282('0x13')](_0x3282('0xd'),auth[_0x3282('0x8')](),controller[_0x3282('0x14')]);module[_0x3282('0x15')]=router; \ No newline at end of file +var _0x646e=['delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','/describe','isAuthenticated','/:id','getQuestions','post','create','put','update'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x646e,0x1a7));var _0xe646=function(_0x19322d,_0x513668){_0x19322d=_0x19322d-0x0;var _0x7c7864=_0x646e[_0x19322d];return _0x7c7864;};'use strict';var multer=require('multer');var util=require(_0xe646('0x0'));var path=require(_0xe646('0x1'));var timeout=require(_0xe646('0x2'));var express=require(_0xe646('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe646('0x4'));var interaction=require(_0xe646('0x5'));var config=require(_0xe646('0x6'));var controller=require(_0xe646('0x7'));router[_0xe646('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe646('0x8')](_0xe646('0x9'),auth[_0xe646('0xa')](),controller['describe']);router[_0xe646('0x8')](_0xe646('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe646('0x8')]('/:id/questions',auth['isAuthenticated'](),controller[_0xe646('0xc')]);router[_0xe646('0xd')]('/',auth['isAuthenticated'](),controller[_0xe646('0xe')]);router[_0xe646('0xf')](_0xe646('0xb'),auth[_0xe646('0xa')](),controller[_0xe646('0x10')]);router[_0xe646('0x11')](_0xe646('0xb'),auth[_0xe646('0xa')](),controller[_0xe646('0x12')]);module[_0xe646('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 1616c2f..ff7b008 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 _0x96ae=['exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x4eb27a,_0xd465be){var _0x4b1416=function(_0x1d2f94){while(--_0x1d2f94){_0x4eb27a['push'](_0x4eb27a['shift']());}};_0x4b1416(++_0xd465be);}(_0x96ae,0xda));var _0xe96a=function(_0x3df93e,_0x5af13a){_0x3df93e=_0x3df93e-0x0;var _0x2d4f2a=_0x96ae[_0x3df93e];return _0x2d4f2a;};'use strict';var moment=require(_0xe96a('0x0'));var Sequelize=require(_0xe96a('0x1'));module[_0xe96a('0x2')]={'starttime':{'type':Sequelize[_0xe96a('0x3')],'set':function(_0x4a77e4){this[_0xe96a('0x4')](_0xe96a('0x5'),_0x4a77e4);this['setDataValue'](_0xe96a('0x6'),moment()[_0xe96a('0x7')](_0xe96a('0x8')));}},'endtime':{'type':Sequelize[_0xe96a('0x3')]},'membername':{'type':Sequelize[_0xe96a('0x9')]},'projectname':{'type':Sequelize[_0xe96a('0x9')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe96a('0x9')]},'calleridnum':{'type':Sequelize[_0xe96a('0x9')]},'completed':{'type':Sequelize[_0xe96a('0xa')],'defaultValue':![]}}; \ No newline at end of file +var _0x4489=['sequelize','DATE','setDataValue','starttime','STRING','BOOLEAN','moment'];(function(_0xa1ae5c,_0x44beef){var _0x4573c1=function(_0x2580ec){while(--_0x2580ec){_0xa1ae5c['push'](_0xa1ae5c['shift']());}};_0x4573c1(++_0x44beef);}(_0x4489,0x164));var _0x9448=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4489[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x9448('0x0'));var Sequelize=require(_0x9448('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x9448('0x2')],'set':function(_0x12e7d8){this[_0x9448('0x3')](_0x9448('0x4'),_0x12e7d8);this['setDataValue']('endtime',moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x9448('0x5')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9448('0x5')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x9448('0x5')]},'calleridnum':{'type':Sequelize[_0x9448('0x5')]},'completed':{'type':Sequelize[_0x9448('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 9ca5368..c1f332e 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 _0x86df=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','name','send','index','map','JscriptySessionReport','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','length','create','body','update','params','find','describe','getQuestions','findOne','pick','SessionId','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x5aa023,_0x1cf1d2){var _0x31ceb5=function(_0x40f643){while(--_0x40f643){_0x5aa023['push'](_0x5aa023['shift']());}};_0x31ceb5(++_0x1cf1d2);}(_0x86df,0x95));var _0xf86d=function(_0x55fc1b,_0x16d022){_0x55fc1b=_0x55fc1b-0x0;var _0x26257d=_0x86df[_0x55fc1b];return _0x26257d;};'use strict';var emlformat=require(_0xf86d('0x0'));var rimraf=require(_0xf86d('0x1'));var zipdir=require(_0xf86d('0x2'));var jsonpatch=require(_0xf86d('0x3'));var rp=require('request-promise');var moment=require(_0xf86d('0x4'));var BPromise=require(_0xf86d('0x5'));var Mustache=require(_0xf86d('0x6'));var util=require('util');var path=require(_0xf86d('0x7'));var sox=require('sox');var csv=require(_0xf86d('0x8'));var ejs=require(_0xf86d('0x9'));var fs=require('fs');var fs_extra=require(_0xf86d('0xa'));var _=require(_0xf86d('0xb'));var squel=require(_0xf86d('0xc'));var crypto=require(_0xf86d('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf86d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf86d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf86d('0x10'));var logger=require(_0xf86d('0x11'))(_0xf86d('0x12'));var utils=require('../../config/utils');var config=require(_0xf86d('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf86d('0x14'))['db'];function respondWithStatusCode(_0x165c94,_0x411f5d){_0x411f5d=_0x411f5d||0xcc;return function(_0x11acd5){if(_0x11acd5){return _0x165c94['sendStatus'](_0x411f5d);}return _0x165c94[_0xf86d('0x15')](_0x411f5d)['end']();};}function respondWithResult(_0x4e41a0,_0x49150e){_0x49150e=_0x49150e||0xc8;return function(_0x3e924c){if(_0x3e924c){return _0x4e41a0['status'](_0x49150e)[_0xf86d('0x16')](_0x3e924c);}};}function respondWithFilteredResult(_0x1f30f6,_0x238ffa){return function(_0x40840e){if(_0x40840e){var _0x4f744f=typeof _0x238ffa['offset']==='undefined'&&typeof _0x238ffa[_0xf86d('0x17')]===_0xf86d('0x18');var _0x5c6ac6=_0x40840e[_0xf86d('0x19')];var _0x5494b6=_0x4f744f?0x0:_0x238ffa[_0xf86d('0x1a')];var _0x41ddb6=_0x4f744f?_0x40840e[_0xf86d('0x19')]:_0x238ffa['offset']+_0x238ffa[_0xf86d('0x17')];var _0x41528e;if(_0x41ddb6>=_0x5c6ac6){_0x41ddb6=_0x5c6ac6;_0x41528e=0xc8;}else{_0x41528e=0xce;}_0x1f30f6[_0xf86d('0x15')](_0x41528e);return _0x1f30f6[_0xf86d('0x1b')](_0xf86d('0x1c'),_0x5494b6+'-'+_0x41ddb6+'/'+_0x5c6ac6)[_0xf86d('0x16')](_0x40840e);}return null;};}function patchUpdates(_0x11e8fe){return function(_0x492b67){try{jsonpatch[_0xf86d('0x1d')](_0x492b67,_0x11e8fe,!![]);}catch(_0x75fde6){return BPromise[_0xf86d('0x1e')](_0x75fde6);}return _0x492b67[_0xf86d('0x1f')]();};}function saveUpdates(_0x357bdd,_0x52ecc2){return function(_0x677409){if(_0x677409){return _0x677409['update'](_0x357bdd)[_0xf86d('0x20')](function(_0x5caa96){return _0x5caa96;});}return null;};}function removeEntity(_0x143c04,_0x32851c){return function(_0x58e7fe){if(_0x58e7fe){return _0x58e7fe[_0xf86d('0x21')]()[_0xf86d('0x20')](function(){_0x143c04[_0xf86d('0x15')](0xcc)[_0xf86d('0x22')]();});}};}function handleEntityNotFound(_0x2330b9,_0x2a88b5){return function(_0x22c448){if(!_0x22c448){_0x2330b9[_0xf86d('0x23')](0x194);}return _0x22c448;};}function handleError(_0x36d1ae,_0x13df83){_0x13df83=_0x13df83||0x1f4;return function(_0x596147){logger[_0xf86d('0x24')](_0x596147['stack']);if(_0x596147[_0xf86d('0x25')]){delete _0x596147[_0xf86d('0x25')];}_0x36d1ae[_0xf86d('0x15')](_0x13df83)[_0xf86d('0x26')](_0x596147);};}exports[_0xf86d('0x27')]=function(_0x334bcf,_0xf3ec83){var _0x423070={},_0x5893f1={},_0x21dae1={'count':0x0,'rows':[]};var _0x5c0377=_[_0xf86d('0x28')](db[_0xf86d('0x29')]['rawAttributes'],function(_0x465b81){return{'name':_0x465b81['fieldName'],'type':_0x465b81[_0xf86d('0x2a')][_0xf86d('0x2b')]};});_0x5893f1['model']=_[_0xf86d('0x28')](_0x5c0377,_0xf86d('0x25'));_0x5893f1[_0xf86d('0x2c')]=_[_0xf86d('0x2d')](_0x334bcf[_0xf86d('0x2c')]);_0x5893f1[_0xf86d('0x2e')]=_[_0xf86d('0x2f')](_0x5893f1[_0xf86d('0x30')],_0x5893f1[_0xf86d('0x2c')]);_0x423070[_0xf86d('0x31')]=_[_0xf86d('0x2f')](_0x5893f1[_0xf86d('0x30')],qs[_0xf86d('0x32')](_0x334bcf[_0xf86d('0x2c')]['fields']));_0x423070['attributes']=_0x423070[_0xf86d('0x31')]['length']?_0x423070[_0xf86d('0x31')]:_0x5893f1[_0xf86d('0x30')];if(!_0x334bcf['query'][_0xf86d('0x33')](_0xf86d('0x34'))){_0x423070[_0xf86d('0x17')]=qs[_0xf86d('0x17')](_0x334bcf[_0xf86d('0x2c')][_0xf86d('0x17')]);_0x423070[_0xf86d('0x1a')]=qs['offset'](_0x334bcf[_0xf86d('0x2c')][_0xf86d('0x1a')]);}_0x423070[_0xf86d('0x35')]=qs[_0xf86d('0x36')](_0x334bcf[_0xf86d('0x2c')]['sort']);_0x423070['where']=qs[_0xf86d('0x2e')](_['pick'](_0x334bcf[_0xf86d('0x2c')],_0x5893f1[_0xf86d('0x2e')]),_0x5c0377);if(_0x334bcf['query'][_0xf86d('0x37')]){_0x423070[_0xf86d('0x38')]=_[_0xf86d('0x39')](_0x423070[_0xf86d('0x38')],{'$or':_[_0xf86d('0x28')](_0x5c0377,function(_0x1d1c4f){if(_0x1d1c4f[_0xf86d('0x2a')]!=='VIRTUAL'){var _0x4b4522={};_0x4b4522[_0x1d1c4f['name']]={'$like':'%'+_0x334bcf[_0xf86d('0x2c')][_0xf86d('0x37')]+'%'};return _0x4b4522;}})});}_0x423070=_[_0xf86d('0x39')]({},_0x423070,_0x334bcf[_0xf86d('0x3a')]);var _0x10ab2c={'where':_0x423070[_0xf86d('0x38')]};return db['JscriptySessionReport'][_0xf86d('0x19')](_0x10ab2c)[_0xf86d('0x20')](function(_0x2c0ba1){_0x21dae1['count']=_0x2c0ba1;if(_0x334bcf[_0xf86d('0x2c')][_0xf86d('0x3b')]){_0x423070[_0xf86d('0x3c')]=[{'all':!![]}];}return db[_0xf86d('0x29')][_0xf86d('0x3d')](_0x423070);})['then'](function(_0x1a61b7){_0x21dae1[_0xf86d('0x3e')]=_0x1a61b7;return _0x21dae1;})[_0xf86d('0x20')](respondWithFilteredResult(_0xf3ec83,_0x423070))[_0xf86d('0x3f')](handleError(_0xf3ec83,null));};exports[_0xf86d('0x40')]=function(_0x4533fa,_0x1efccb){var _0x1aead9={'raw':!![],'where':{'id':_0x4533fa['params']['id']}},_0x5e3c69={};_0x5e3c69[_0xf86d('0x30')]=_[_0xf86d('0x2d')](db[_0xf86d('0x29')][_0xf86d('0x41')]);_0x5e3c69[_0xf86d('0x2c')]=_[_0xf86d('0x2d')](_0x4533fa[_0xf86d('0x2c')]);_0x5e3c69['filters']=_[_0xf86d('0x2f')](_0x5e3c69[_0xf86d('0x30')],_0x5e3c69[_0xf86d('0x2c')]);_0x1aead9[_0xf86d('0x31')]=_[_0xf86d('0x2f')](_0x5e3c69[_0xf86d('0x30')],qs[_0xf86d('0x32')](_0x4533fa['query'][_0xf86d('0x32')]));_0x1aead9['attributes']=_0x1aead9[_0xf86d('0x31')][_0xf86d('0x42')]?_0x1aead9['attributes']:_0x5e3c69[_0xf86d('0x30')];if(_0x4533fa[_0xf86d('0x2c')][_0xf86d('0x3b')]){_0x1aead9[_0xf86d('0x3c')]=[{'all':!![]}];}_0x1aead9=_[_0xf86d('0x39')]({},_0x1aead9,_0x4533fa['options']);return db['JscriptySessionReport']['find'](_0x1aead9)['then'](handleEntityNotFound(_0x1efccb,null))['then'](respondWithResult(_0x1efccb,null))[_0xf86d('0x3f')](handleError(_0x1efccb,null));};exports[_0xf86d('0x43')]=function(_0x1fa519,_0x1c4b62){return db[_0xf86d('0x29')]['create'](_0x1fa519[_0xf86d('0x44')],{})[_0xf86d('0x20')](respondWithResult(_0x1c4b62,0xc9))[_0xf86d('0x3f')](handleError(_0x1c4b62,null));};exports[_0xf86d('0x45')]=function(_0x521554,_0x341156){if(_0x521554['body']['id']){delete _0x521554[_0xf86d('0x44')]['id'];}return db[_0xf86d('0x29')]['find']({'where':{'id':_0x521554[_0xf86d('0x46')]['id']}})[_0xf86d('0x20')](handleEntityNotFound(_0x341156,null))[_0xf86d('0x20')](saveUpdates(_0x521554[_0xf86d('0x44')],null))['then'](respondWithResult(_0x341156,null))['catch'](handleError(_0x341156,null));};exports[_0xf86d('0x21')]=function(_0x24d5d8,_0x5e5ea4){return db[_0xf86d('0x29')][_0xf86d('0x47')]({'where':{'id':_0x24d5d8[_0xf86d('0x46')]['id']}})[_0xf86d('0x20')](handleEntityNotFound(_0x5e5ea4,null))[_0xf86d('0x20')](removeEntity(_0x5e5ea4,null))[_0xf86d('0x3f')](handleError(_0x5e5ea4,null));};exports[_0xf86d('0x48')]=function(_0x2243cf,_0x14c4ee){return db[_0xf86d('0x29')]['describe']()[_0xf86d('0x20')](respondWithResult(_0x14c4ee,null))['catch'](handleError(_0x14c4ee,null));};exports[_0xf86d('0x49')]=function(_0x49d25d,_0x1989fc,_0x32fe5e){var _0x35b1d5={'raw':!![],'where':{}};var _0x155b62={};var _0xabd169={'count':0x0,'rows':[]};return db[_0xf86d('0x29')][_0xf86d('0x4a')]({'where':{'id':_0x49d25d[_0xf86d('0x46')]['id']}})[_0xf86d('0x20')](handleEntityNotFound(_0x1989fc,null))[_0xf86d('0x20')](function(_0x4f85f){if(_0x4f85f){_0x155b62[_0xf86d('0x30')]=_['keys'](db['JscriptyQuestionReport'][_0xf86d('0x41')]);_0x155b62[_0xf86d('0x2c')]=_['keys'](_0x49d25d[_0xf86d('0x2c')]);_0x155b62[_0xf86d('0x2e')]=_[_0xf86d('0x2f')](_0x155b62[_0xf86d('0x30')],_0x155b62[_0xf86d('0x2c')]);_0x35b1d5[_0xf86d('0x31')]=_[_0xf86d('0x2f')](_0x155b62[_0xf86d('0x30')],qs['fields'](_0x49d25d[_0xf86d('0x2c')][_0xf86d('0x32')]));_0x35b1d5[_0xf86d('0x31')]=_0x35b1d5[_0xf86d('0x31')]['length']?_0x35b1d5[_0xf86d('0x31')]:_0x155b62[_0xf86d('0x30')];if(!_0x49d25d[_0xf86d('0x2c')][_0xf86d('0x33')](_0xf86d('0x34'))){_0x35b1d5[_0xf86d('0x17')]=qs[_0xf86d('0x17')](_0x49d25d[_0xf86d('0x2c')][_0xf86d('0x17')]);_0x35b1d5[_0xf86d('0x1a')]=qs[_0xf86d('0x1a')](_0x49d25d['query'][_0xf86d('0x1a')]);}_0x35b1d5[_0xf86d('0x35')]=qs[_0xf86d('0x36')](_0x49d25d[_0xf86d('0x2c')][_0xf86d('0x36')]);_0x35b1d5[_0xf86d('0x38')]=qs[_0xf86d('0x2e')](_[_0xf86d('0x4b')](_0x49d25d[_0xf86d('0x2c')],_0x155b62['filters']));_0x35b1d5[_0xf86d('0x38')][_0xf86d('0x4c')]=_0x4f85f['id'];if(_0x49d25d[_0xf86d('0x2c')][_0xf86d('0x37')]){_0x35b1d5[_0xf86d('0x38')]=_['merge'](_0x35b1d5[_0xf86d('0x38')],{'$or':_[_0xf86d('0x28')](_0x35b1d5['attributes'],function(_0x903862){var _0x137b79={};_0x137b79[_0x903862]={'$like':'%'+_0x49d25d[_0xf86d('0x2c')][_0xf86d('0x37')]+'%'};return _0x137b79;})});}_0x35b1d5=_[_0xf86d('0x39')]({},_0x35b1d5,_0x49d25d[_0xf86d('0x3a')]);return db[_0xf86d('0x4d')]['count']({'where':_0x35b1d5[_0xf86d('0x38')]})['then'](function(_0x4a753b){_0xabd169[_0xf86d('0x19')]=_0x4a753b;if(_0x49d25d[_0xf86d('0x2c')][_0xf86d('0x3b')]){_0x35b1d5[_0xf86d('0x3c')]=[{'all':!![]}];}return db[_0xf86d('0x4d')][_0xf86d('0x3d')](_0x35b1d5);})['then'](function(_0x5b7c59){_0xabd169[_0xf86d('0x3e')]=_0x5b7c59;return _0xabd169;});}})[_0xf86d('0x20')](respondWithFilteredResult(_0x1989fc,_0x35b1d5))[_0xf86d('0x3f')](handleError(_0x1989fc,null));}; \ No newline at end of file +var _0xce6d=['then','destroy','error','stack','name','send','index','map','JscriptySessionReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','SessionId','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','reject','save','update'];(function(_0x142ed4,_0x2cd4d7){var _0x3fb06a=function(_0x4a3d88){while(--_0x4a3d88){_0x142ed4['push'](_0x142ed4['shift']());}};_0x3fb06a(++_0x2cd4d7);}(_0xce6d,0xd0));var _0xdce6=function(_0x3203a1,_0x46c498){_0x3203a1=_0x3203a1-0x0;var _0x24215e=_0xce6d[_0x3203a1];return _0x24215e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdce6('0x0'));var zipdir=require(_0xdce6('0x1'));var jsonpatch=require(_0xdce6('0x2'));var rp=require(_0xdce6('0x3'));var moment=require('moment');var BPromise=require(_0xdce6('0x4'));var Mustache=require(_0xdce6('0x5'));var util=require(_0xdce6('0x6'));var path=require('path');var sox=require(_0xdce6('0x7'));var csv=require(_0xdce6('0x8'));var ejs=require(_0xdce6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdce6('0xa'));var squel=require(_0xdce6('0xb'));var crypto=require(_0xdce6('0xc'));var jsforce=require(_0xdce6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdce6('0x8'));var querystring=require(_0xdce6('0xe'));var Papa=require(_0xdce6('0xf'));var Redis=require(_0xdce6('0x10'));var authService=require(_0xdce6('0x11'));var qs=require(_0xdce6('0x12'));var as=require(_0xdce6('0x13'));var hardwareService=require(_0xdce6('0x14'));var logger=require(_0xdce6('0x15'))(_0xdce6('0x16'));var utils=require(_0xdce6('0x17'));var config=require(_0xdce6('0x18'));var licenseUtil=require(_0xdce6('0x19'));var db=require(_0xdce6('0x1a'))['db'];function respondWithStatusCode(_0x156143,_0x2f46be){_0x2f46be=_0x2f46be||0xcc;return function(_0x5317dc){if(_0x5317dc){return _0x156143['sendStatus'](_0x2f46be);}return _0x156143[_0xdce6('0x1b')](_0x2f46be)[_0xdce6('0x1c')]();};}function respondWithResult(_0x36776c,_0x1b2b0b){_0x1b2b0b=_0x1b2b0b||0xc8;return function(_0x79ae1b){if(_0x79ae1b){return _0x36776c['status'](_0x1b2b0b)[_0xdce6('0x1d')](_0x79ae1b);}};}function respondWithFilteredResult(_0x7a77c9,_0xe9cfc){return function(_0x1bc2d0){if(_0x1bc2d0){var _0x27bd89=typeof _0xe9cfc['offset']===_0xdce6('0x1e')&&typeof _0xe9cfc[_0xdce6('0x1f')]===_0xdce6('0x1e');var _0x615a59=_0x1bc2d0['count'];var _0x4a1478=_0x27bd89?0x0:_0xe9cfc[_0xdce6('0x20')];var _0x5af4e6=_0x27bd89?_0x1bc2d0[_0xdce6('0x21')]:_0xe9cfc[_0xdce6('0x20')]+_0xe9cfc[_0xdce6('0x1f')];var _0x1e3c1e;if(_0x5af4e6>=_0x615a59){_0x5af4e6=_0x615a59;_0x1e3c1e=0xc8;}else{_0x1e3c1e=0xce;}_0x7a77c9[_0xdce6('0x1b')](_0x1e3c1e);return _0x7a77c9[_0xdce6('0x22')]('Content-Range',_0x4a1478+'-'+_0x5af4e6+'/'+_0x615a59)['json'](_0x1bc2d0);}return null;};}function patchUpdates(_0x315286){return function(_0x1bc37e){try{jsonpatch['apply'](_0x1bc37e,_0x315286,!![]);}catch(_0x9fd39f){return BPromise[_0xdce6('0x23')](_0x9fd39f);}return _0x1bc37e[_0xdce6('0x24')]();};}function saveUpdates(_0x1d80b8,_0x38665){return function(_0x14a66a){if(_0x14a66a){return _0x14a66a[_0xdce6('0x25')](_0x1d80b8)[_0xdce6('0x26')](function(_0x304d13){return _0x304d13;});}return null;};}function removeEntity(_0x412b31,_0x31c70d){return function(_0x4e0ee4){if(_0x4e0ee4){return _0x4e0ee4[_0xdce6('0x27')]()[_0xdce6('0x26')](function(){_0x412b31['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3008ae,_0x335eb5){return function(_0x2682ed){if(!_0x2682ed){_0x3008ae['sendStatus'](0x194);}return _0x2682ed;};}function handleError(_0x3af3c7,_0xc1671e){_0xc1671e=_0xc1671e||0x1f4;return function(_0x1df528){logger[_0xdce6('0x28')](_0x1df528[_0xdce6('0x29')]);if(_0x1df528[_0xdce6('0x2a')]){delete _0x1df528[_0xdce6('0x2a')];}_0x3af3c7[_0xdce6('0x1b')](_0xc1671e)[_0xdce6('0x2b')](_0x1df528);};}exports[_0xdce6('0x2c')]=function(_0x33fadf,_0x2d83b0){var _0x77105b={},_0x5c35aa={},_0x284d4b={'count':0x0,'rows':[]};var _0x4764c2=_[_0xdce6('0x2d')](db[_0xdce6('0x2e')]['rawAttributes'],function(_0x5975d9){return{'name':_0x5975d9[_0xdce6('0x2f')],'type':_0x5975d9[_0xdce6('0x30')][_0xdce6('0x31')]};});_0x5c35aa[_0xdce6('0x32')]=_[_0xdce6('0x2d')](_0x4764c2,_0xdce6('0x2a'));_0x5c35aa[_0xdce6('0x33')]=_[_0xdce6('0x34')](_0x33fadf[_0xdce6('0x33')]);_0x5c35aa[_0xdce6('0x35')]=_[_0xdce6('0x36')](_0x5c35aa[_0xdce6('0x32')],_0x5c35aa['query']);_0x77105b[_0xdce6('0x37')]=_[_0xdce6('0x36')](_0x5c35aa['model'],qs['fields'](_0x33fadf[_0xdce6('0x33')][_0xdce6('0x38')]));_0x77105b[_0xdce6('0x37')]=_0x77105b[_0xdce6('0x37')]['length']?_0x77105b['attributes']:_0x5c35aa[_0xdce6('0x32')];if(!_0x33fadf[_0xdce6('0x33')][_0xdce6('0x39')]('nolimit')){_0x77105b[_0xdce6('0x1f')]=qs['limit'](_0x33fadf[_0xdce6('0x33')][_0xdce6('0x1f')]);_0x77105b[_0xdce6('0x20')]=qs[_0xdce6('0x20')](_0x33fadf['query'][_0xdce6('0x20')]);}_0x77105b[_0xdce6('0x3a')]=qs[_0xdce6('0x3b')](_0x33fadf[_0xdce6('0x33')][_0xdce6('0x3b')]);_0x77105b[_0xdce6('0x3c')]=qs[_0xdce6('0x35')](_[_0xdce6('0x3d')](_0x33fadf[_0xdce6('0x33')],_0x5c35aa[_0xdce6('0x35')]),_0x4764c2);if(_0x33fadf[_0xdce6('0x33')]['filter']){_0x77105b[_0xdce6('0x3c')]=_[_0xdce6('0x3e')](_0x77105b[_0xdce6('0x3c')],{'$or':_[_0xdce6('0x2d')](_0x4764c2,function(_0x8f592e){if(_0x8f592e[_0xdce6('0x30')]!=='VIRTUAL'){var _0x4e1ff1={};_0x4e1ff1[_0x8f592e[_0xdce6('0x2a')]]={'$like':'%'+_0x33fadf['query'][_0xdce6('0x3f')]+'%'};return _0x4e1ff1;}})});}_0x77105b=_[_0xdce6('0x3e')]({},_0x77105b,_0x33fadf[_0xdce6('0x40')]);var _0x305767={'where':_0x77105b[_0xdce6('0x3c')]};return db[_0xdce6('0x2e')][_0xdce6('0x21')](_0x305767)[_0xdce6('0x26')](function(_0x10b02c){_0x284d4b[_0xdce6('0x21')]=_0x10b02c;if(_0x33fadf[_0xdce6('0x33')][_0xdce6('0x41')]){_0x77105b[_0xdce6('0x42')]=[{'all':!![]}];}return db[_0xdce6('0x2e')][_0xdce6('0x43')](_0x77105b);})[_0xdce6('0x26')](function(_0x571e18){_0x284d4b[_0xdce6('0x44')]=_0x571e18;return _0x284d4b;})[_0xdce6('0x26')](respondWithFilteredResult(_0x2d83b0,_0x77105b))[_0xdce6('0x45')](handleError(_0x2d83b0,null));};exports[_0xdce6('0x46')]=function(_0x3d0314,_0x32eb31){var _0x27bf23={'raw':!![],'where':{'id':_0x3d0314[_0xdce6('0x47')]['id']}},_0x2b04d7={};_0x2b04d7[_0xdce6('0x32')]=_[_0xdce6('0x34')](db[_0xdce6('0x2e')][_0xdce6('0x48')]);_0x2b04d7['query']=_[_0xdce6('0x34')](_0x3d0314[_0xdce6('0x33')]);_0x2b04d7[_0xdce6('0x35')]=_[_0xdce6('0x36')](_0x2b04d7['model'],_0x2b04d7['query']);_0x27bf23[_0xdce6('0x37')]=_[_0xdce6('0x36')](_0x2b04d7['model'],qs[_0xdce6('0x38')](_0x3d0314[_0xdce6('0x33')][_0xdce6('0x38')]));_0x27bf23[_0xdce6('0x37')]=_0x27bf23[_0xdce6('0x37')][_0xdce6('0x49')]?_0x27bf23[_0xdce6('0x37')]:_0x2b04d7[_0xdce6('0x32')];if(_0x3d0314[_0xdce6('0x33')][_0xdce6('0x41')]){_0x27bf23[_0xdce6('0x42')]=[{'all':!![]}];}_0x27bf23=_['merge']({},_0x27bf23,_0x3d0314[_0xdce6('0x40')]);return db[_0xdce6('0x2e')][_0xdce6('0x4a')](_0x27bf23)['then'](handleEntityNotFound(_0x32eb31,null))['then'](respondWithResult(_0x32eb31,null))['catch'](handleError(_0x32eb31,null));};exports[_0xdce6('0x4b')]=function(_0x18ea79,_0x29aa49){return db[_0xdce6('0x2e')]['create'](_0x18ea79[_0xdce6('0x4c')],{})[_0xdce6('0x26')](respondWithResult(_0x29aa49,0xc9))[_0xdce6('0x45')](handleError(_0x29aa49,null));};exports[_0xdce6('0x25')]=function(_0x4e8b68,_0x511b7f){if(_0x4e8b68[_0xdce6('0x4c')]['id']){delete _0x4e8b68['body']['id'];}return db[_0xdce6('0x2e')][_0xdce6('0x4a')]({'where':{'id':_0x4e8b68[_0xdce6('0x47')]['id']}})['then'](handleEntityNotFound(_0x511b7f,null))[_0xdce6('0x26')](saveUpdates(_0x4e8b68[_0xdce6('0x4c')],null))[_0xdce6('0x26')](respondWithResult(_0x511b7f,null))[_0xdce6('0x45')](handleError(_0x511b7f,null));};exports[_0xdce6('0x27')]=function(_0x36b99a,_0x586568){return db['JscriptySessionReport'][_0xdce6('0x4a')]({'where':{'id':_0x36b99a[_0xdce6('0x47')]['id']}})[_0xdce6('0x26')](handleEntityNotFound(_0x586568,null))['then'](removeEntity(_0x586568,null))[_0xdce6('0x45')](handleError(_0x586568,null));};exports['describe']=function(_0x42fe8e,_0x21a4aa){return db['JscriptySessionReport'][_0xdce6('0x4d')]()[_0xdce6('0x26')](respondWithResult(_0x21a4aa,null))[_0xdce6('0x45')](handleError(_0x21a4aa,null));};exports[_0xdce6('0x4e')]=function(_0x2d2256,_0x255614,_0x1385b5){var _0x221408={'raw':!![],'where':{}};var _0x167989={};var _0x1be4c6={'count':0x0,'rows':[]};return db[_0xdce6('0x2e')][_0xdce6('0x4f')]({'where':{'id':_0x2d2256[_0xdce6('0x47')]['id']}})['then'](handleEntityNotFound(_0x255614,null))[_0xdce6('0x26')](function(_0x49d0a8){if(_0x49d0a8){_0x167989[_0xdce6('0x32')]=_[_0xdce6('0x34')](db[_0xdce6('0x50')][_0xdce6('0x48')]);_0x167989[_0xdce6('0x33')]=_[_0xdce6('0x34')](_0x2d2256[_0xdce6('0x33')]);_0x167989['filters']=_[_0xdce6('0x36')](_0x167989[_0xdce6('0x32')],_0x167989['query']);_0x221408[_0xdce6('0x37')]=_[_0xdce6('0x36')](_0x167989[_0xdce6('0x32')],qs['fields'](_0x2d2256[_0xdce6('0x33')][_0xdce6('0x38')]));_0x221408[_0xdce6('0x37')]=_0x221408['attributes'][_0xdce6('0x49')]?_0x221408['attributes']:_0x167989['model'];if(!_0x2d2256[_0xdce6('0x33')][_0xdce6('0x39')]('nolimit')){_0x221408[_0xdce6('0x1f')]=qs[_0xdce6('0x1f')](_0x2d2256[_0xdce6('0x33')][_0xdce6('0x1f')]);_0x221408[_0xdce6('0x20')]=qs[_0xdce6('0x20')](_0x2d2256['query'][_0xdce6('0x20')]);}_0x221408[_0xdce6('0x3a')]=qs[_0xdce6('0x3b')](_0x2d2256[_0xdce6('0x33')][_0xdce6('0x3b')]);_0x221408[_0xdce6('0x3c')]=qs[_0xdce6('0x35')](_[_0xdce6('0x3d')](_0x2d2256[_0xdce6('0x33')],_0x167989[_0xdce6('0x35')]));_0x221408[_0xdce6('0x3c')][_0xdce6('0x51')]=_0x49d0a8['id'];if(_0x2d2256[_0xdce6('0x33')][_0xdce6('0x3f')]){_0x221408[_0xdce6('0x3c')]=_[_0xdce6('0x3e')](_0x221408[_0xdce6('0x3c')],{'$or':_[_0xdce6('0x2d')](_0x221408['attributes'],function(_0x57e68c){var _0x41e577={};_0x41e577[_0x57e68c]={'$like':'%'+_0x2d2256[_0xdce6('0x33')][_0xdce6('0x3f')]+'%'};return _0x41e577;})});}_0x221408=_[_0xdce6('0x3e')]({},_0x221408,_0x2d2256[_0xdce6('0x40')]);return db[_0xdce6('0x50')][_0xdce6('0x21')]({'where':_0x221408[_0xdce6('0x3c')]})[_0xdce6('0x26')](function(_0x2eb5ec){_0x1be4c6[_0xdce6('0x21')]=_0x2eb5ec;if(_0x2d2256['query'][_0xdce6('0x41')]){_0x221408['include']=[{'all':!![]}];}return db[_0xdce6('0x50')][_0xdce6('0x43')](_0x221408);})[_0xdce6('0x26')](function(_0x15268e){_0x1be4c6['rows']=_0x15268e;return _0x1be4c6;});}})[_0xdce6('0x26')](respondWithFilteredResult(_0x255614,_0x221408))[_0xdce6('0x45')](handleError(_0x255614,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 234178c..76f2442 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 _0x814b=['define','JscriptySessionReport','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports'];(function(_0x57cde3,_0x5e34ce){var _0xc6757e=function(_0x1511c0){while(--_0x1511c0){_0x57cde3['push'](_0x57cde3['shift']());}};_0xc6757e(++_0x5e34ce);}(_0x814b,0x1a2));var _0xb814=function(_0x1261c2,_0x3ef819){_0x1261c2=_0x1261c2-0x0;var _0x3aabd2=_0x814b[_0x1261c2];return _0x3aabd2;};'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':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2acd24,_0xf315ac){_0x2acd24=_0x2acd24-0x0;var _0x546099=_0x7fbe[_0x2acd24];return _0x546099;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 53d923d..79dea2f 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 _0x71ab=['http','request','then','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptySessionReport,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2b1651,_0x4b9cb7){var _0x3a01eb=function(_0x2b2dac){while(--_0x2b2dac){_0x2b1651['push'](_0x2b1651['shift']());}};_0x3a01eb(++_0x4b9cb7);}(_0x71ab,0x64));var _0xb71a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x71ab[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file +var _0x32f4=['info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x9861ff,_0x41fb17){var _0x48852b=function(_0x557001){while(--_0x557001){_0x9861ff['push'](_0x9861ff['shift']());}};_0x48852b(++_0x41fb17);}(_0x32f4,0x154));var _0x432f=function(_0x10ad5c,_0x5cd5eb){_0x10ad5c=_0x10ad5c-0x0;var _0x2a0d9c=_0x32f4[_0x10ad5c];return _0x2a0d9c;};'use strict';var _=require(_0x432f('0x0'));var util=require(_0x432f('0x1'));var moment=require(_0x432f('0x2'));var BPromise=require(_0x432f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x432f('0x4'));var db=require(_0x432f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x432f('0x6'))(_0x432f('0x7'));var config=require(_0x432f('0x8'));var jayson=require(_0x432f('0x9'));var client=jayson[_0x432f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b5f08,_0x2f66fd,_0x32b062){return new BPromise(function(_0x4a5b56,_0x2a2ef6){return client['request'](_0x5b5f08,_0x32b062)[_0x432f('0xb')](function(_0x340fe9){logger[_0x432f('0xc')](_0x432f('0xd'),_0x2f66fd,_0x432f('0xe'));logger['debug'](_0x432f('0xf'),_0x2f66fd,'request\x20sent',JSON[_0x432f('0x10')](_0x340fe9));if(_0x340fe9['error']){if(_0x340fe9[_0x432f('0x11')][_0x432f('0x12')]===0x1f4){logger['error'](_0x432f('0xd'),_0x2f66fd,_0x340fe9[_0x432f('0x11')]['message']);return _0x2a2ef6(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x2f66fd,_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);return _0x4a5b56(_0x340fe9[_0x432f('0x11')][_0x432f('0x13')]);}else{logger[_0x432f('0xc')]('JscriptySessionReport,\x20%s,\x20%s',_0x2f66fd,_0x432f('0xe'));_0x4a5b56(_0x340fe9[_0x432f('0x14')][_0x432f('0x13')]);}})[_0x432f('0x15')](function(_0x5bae29){logger[_0x432f('0x11')](_0x432f('0xd'),_0x2f66fd,_0x5bae29);_0x2a2ef6(_0x5bae29);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 1c4eb7a..62f1cc8 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 _0x119a=['../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3ee4d2,_0x44f1c4){var _0x43c786=function(_0x1b1cf4){while(--_0x1b1cf4){_0x3ee4d2['push'](_0x3ee4d2['shift']());}};_0x43c786(++_0x44f1c4);}(_0x119a,0x69));var _0xa119=function(_0x493642,_0x5c978b){_0x493642=_0x493642-0x0;var _0x85c7b3=_0x119a[_0x493642];return _0x85c7b3;};'use strict';var multer=require(_0xa119('0x0'));var util=require(_0xa119('0x1'));var path=require(_0xa119('0x2'));var timeout=require('connect-timeout');var express=require(_0xa119('0x3'));var router=express[_0xa119('0x4')]();var fs_extra=require(_0xa119('0x5'));var auth=require(_0xa119('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa119('0x7'));var controller=require(_0xa119('0x8'));router[_0xa119('0x9')]('/',controller[_0xa119('0xa')]);router[_0xa119('0xb')](_0xa119('0xc'),auth[_0xa119('0xd')](),controller[_0xa119('0xe')]);module[_0xa119('0xf')]=router; \ No newline at end of file +var _0xd13e=['../../components/auth/service','../../config/environment','./license.controller','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','Router'];(function(_0x348675,_0x3cad73){var _0x5de4a5=function(_0x463d95){while(--_0x463d95){_0x348675['push'](_0x348675['shift']());}};_0x5de4a5(++_0x3cad73);}(_0xd13e,0x193));var _0xed13=function(_0x532ce5,_0x1ef5d6){_0x532ce5=_0x532ce5-0x0;var _0x40f7d6=_0xd13e[_0x532ce5];return _0x40f7d6;};'use strict';var multer=require(_0xed13('0x0'));var util=require(_0xed13('0x1'));var path=require(_0xed13('0x2'));var timeout=require(_0xed13('0x3'));var express=require('express');var router=express[_0xed13('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xed13('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xed13('0x6'));var controller=require(_0xed13('0x7'));router['get']('/',controller['index']);router['put'](_0xed13('0x8'),auth[_0xed13('0x9')](),controller[_0xed13('0xa')]);module[_0xed13('0xb')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 785887a..d15fa37 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 _0x924d=['INTEGER','sequelize','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x924d,0x97));var _0xd924=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0x924d[_0x5e42a7];return _0x36d21b;};'use strict';var Sequelize=require(_0xd924('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xd924('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0xd924('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0650=['TEXT','STRING','sequelize','exports'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x0650,0x6e));var _0x0065=function(_0x322c2e,_0x462f77){_0x322c2e=_0x322c2e-0x0;var _0xb563cd=_0x0650[_0x322c2e];return _0xb563cd;};'use strict';var Sequelize=require(_0x0065('0x0'));module[_0x0065('0x1')]={'license':{'type':Sequelize[_0x0065('0x2')]},'data1':{'type':Sequelize[_0x0065('0x3')]},'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 b9deb92..30b492c 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 _0x7a54=['count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','model','License','query','keys','intersection','attributes','fields','length','options','getLicense','body','find','checkLicense','key','demo','catch','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'];(function(_0x2fd03f,_0x1c2e23){var _0x21f1e2=function(_0x19c10e){while(--_0x19c10e){_0x2fd03f['push'](_0x2fd03f['shift']());}};_0x21f1e2(++_0x1c2e23);}(_0x7a54,0x106));var _0x47a5=function(_0xe7851d,_0x522083){_0xe7851d=_0xe7851d-0x0;var _0x137fcc=_0x7a54[_0xe7851d];return _0x137fcc;};'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);};}var utilLicense=require(_0x47a5('0x14'));exports[_0x47a5('0x29')]=function(_0x16631f,_0x361bfa){var _0x1127f8={'raw':!![],'where':{'id':0x1}},_0x11a4fa={};_0x11a4fa[_0x47a5('0x2a')]=_['keys'](db[_0x47a5('0x2b')]['rawAttributes']);_0x11a4fa[_0x47a5('0x2c')]=_[_0x47a5('0x2d')](_0x16631f[_0x47a5('0x2c')]);_0x11a4fa['filters']=_[_0x47a5('0x2e')](_0x11a4fa[_0x47a5('0x2a')],_0x11a4fa[_0x47a5('0x2c')]);_0x1127f8[_0x47a5('0x2f')]=_['intersection'](_0x11a4fa['model'],qs[_0x47a5('0x30')](_0x16631f[_0x47a5('0x2c')]['fields']));_0x1127f8['attributes']=_0x1127f8[_0x47a5('0x2f')][_0x47a5('0x31')]?_0x1127f8['attributes']:_0x11a4fa[_0x47a5('0x2a')];_0x1127f8=_['merge']({},_0x1127f8,_0x16631f[_0x47a5('0x32')]);return utilLicense[_0x47a5('0x33')](_0x1127f8)['then'](respondWithResult(_0x361bfa,null))['catch'](handleError(_0x361bfa,null));};exports[_0x47a5('0x22')]=function(_0x5910bb,_0x403028){if(_0x5910bb[_0x47a5('0x34')]['id']){delete _0x5910bb[_0x47a5('0x34')]['id'];}return db['License'][_0x47a5('0x35')]({'where':{'id':_0x5910bb['params']['id']}})['then'](handleEntityNotFound(_0x403028,null))[_0x47a5('0x23')](function(_0x5a8a7c){var _0x25cce0=_0x5a8a7c['get']({'plain':!![]});return utilLicense[_0x47a5('0x36')](_0x25cce0,_0x5910bb[_0x47a5('0x34')][_0x47a5('0x37')]);})[_0x47a5('0x23')](function(_0x36add5){if(!_0x36add5[_0x47a5('0x38')]){return saveUpdates(_0x5910bb[_0x47a5('0x34')],null);}return _0x36add5;})[_0x47a5('0x23')](respondWithResult(_0x403028,null))[_0x47a5('0x39')](handleError(_0x403028,null));}; \ No newline at end of file +var _0x1261=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','index','model','License','query','intersection','fields','attributes','merge','options','getLicense','catch','body','find','params','get','key','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis'];(function(_0xbb1d83,_0x5dbbf0){var _0x4165d0=function(_0x3ccb9d){while(--_0x3ccb9d){_0xbb1d83['push'](_0xbb1d83['shift']());}};_0x4165d0(++_0x5dbbf0);}(_0x1261,0x144));var _0x1126=function(_0x270dba,_0x1817d2){_0x270dba=_0x270dba-0x0;var _0x36b83b=_0x1261[_0x270dba];return _0x36b83b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}var utilLicense=require('../../config/license/util');exports[_0x1126('0x29')]=function(_0x23d2bc,_0x4a334a){var _0x3fa694={'raw':!![],'where':{'id':0x1}},_0x4bf807={};_0x4bf807[_0x1126('0x2a')]=_['keys'](db[_0x1126('0x2b')]['rawAttributes']);_0x4bf807[_0x1126('0x2c')]=_['keys'](_0x23d2bc['query']);_0x4bf807['filters']=_[_0x1126('0x2d')](_0x4bf807[_0x1126('0x2a')],_0x4bf807[_0x1126('0x2c')]);_0x3fa694['attributes']=_[_0x1126('0x2d')](_0x4bf807[_0x1126('0x2a')],qs['fields'](_0x23d2bc[_0x1126('0x2c')][_0x1126('0x2e')]));_0x3fa694[_0x1126('0x2f')]=_0x3fa694[_0x1126('0x2f')]['length']?_0x3fa694['attributes']:_0x4bf807[_0x1126('0x2a')];_0x3fa694=_[_0x1126('0x30')]({},_0x3fa694,_0x23d2bc[_0x1126('0x31')]);return utilLicense[_0x1126('0x32')](_0x3fa694)['then'](respondWithResult(_0x4a334a,null))[_0x1126('0x33')](handleError(_0x4a334a,null));};exports[_0x1126('0x24')]=function(_0x313ebe,_0x22436c){if(_0x313ebe[_0x1126('0x34')]['id']){delete _0x313ebe['body']['id'];}return db[_0x1126('0x2b')][_0x1126('0x35')]({'where':{'id':_0x313ebe[_0x1126('0x36')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x22436c,null))['then'](function(_0x4ca51c){var _0x22827a=_0x4ca51c[_0x1126('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x22827a,_0x313ebe[_0x1126('0x34')][_0x1126('0x38')]);})[_0x1126('0x25')](function(_0x5c08b9){if(!_0x5c08b9['demo']){return saveUpdates(_0x313ebe[_0x1126('0x34')],null);}return _0x5c08b9;})[_0x1126('0x25')](respondWithResult(_0x22436c,null))[_0x1126('0x33')](handleError(_0x22436c,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index aa89665..e394ecb 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 _0x989c=['api','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x989c,0xda));var _0xc989=function(_0x23979f,_0x4618d7){_0x23979f=_0x23979f-0x0;var _0x85a86c=_0x989c[_0x23979f];return _0x85a86c;};'use strict';var _=require(_0xc989('0x0'));var util=require(_0xc989('0x1'));var logger=require(_0xc989('0x2'))(_0xc989('0x3'));var moment=require('moment');var BPromise=require(_0xc989('0x4'));var rp=require(_0xc989('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc989('0x6'));var config=require(_0xc989('0x7'));var attributes=require(_0xc989('0x8'));module[_0xc989('0x9')]=function(_0x38cda9,_0x3657a3){return _0x38cda9[_0xc989('0xa')](_0xc989('0xb'),attributes,{'tableName':_0xc989('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x254b=['api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','define','lodash','util','../../config/logger'];(function(_0xd1a6b4,_0x5b3dcb){var _0x26b757=function(_0x26b877){while(--_0x26b877){_0xd1a6b4['push'](_0xd1a6b4['shift']());}};_0x26b757(++_0x5b3dcb);}(_0x254b,0x110));var _0xb254=function(_0x4709c8,_0x3384ca){_0x4709c8=_0x4709c8-0x0;var _0x478cdd=_0x254b[_0x4709c8];return _0x478cdd;};'use strict';var _=require(_0xb254('0x0'));var util=require(_0xb254('0x1'));var logger=require(_0xb254('0x2'))(_0xb254('0x3'));var moment=require(_0xb254('0x4'));var BPromise=require('bluebird');var rp=require(_0xb254('0x5'));var fs=require('fs');var path=require(_0xb254('0x6'));var rimraf=require(_0xb254('0x7'));var config=require(_0xb254('0x8'));var attributes=require(_0xb254('0x9'));module['exports']=function(_0x72bc05,_0x4fa1db){return _0x72bc05[_0xb254('0xa')]('License',attributes,{'tableName':'license','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 615cdf4..a3d6288 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 _0x08f4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x1f5143,_0x5e31e6){var _0x383a38=function(_0x2c123c){while(--_0x2c123c){_0x1f5143['push'](_0x1f5143['shift']());}};_0x383a38(++_0x5e31e6);}(_0x08f4,0x140));var _0x408f=function(_0x405fd3,_0x32c9d0){_0x405fd3=_0x405fd3-0x0;var _0x6410a2=_0x08f4[_0x405fd3];return _0x6410a2;};'use strict';var _=require(_0x408f('0x0'));var util=require(_0x408f('0x1'));var moment=require('moment');var BPromise=require(_0x408f('0x2'));var rs=require(_0x408f('0x3'));var fs=require('fs');var Redis=require(_0x408f('0x4'));var db=require(_0x408f('0x5'))['db'];var utils=require(_0x408f('0x6'));var logger=require(_0x408f('0x7'))(_0x408f('0x8'));var config=require('../../config/environment');var jayson=require(_0x408f('0x9'));var client=jayson[_0x408f('0xa')][_0x408f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b4f58,_0x132dfa,_0x155375){return new BPromise(function(_0x4f488e,_0x4b3210){return client['request'](_0x4b4f58,_0x155375)[_0x408f('0xc')](function(_0x5db0eb){logger[_0x408f('0xd')]('License,\x20%s,\x20%s',_0x132dfa,_0x408f('0xe'));logger[_0x408f('0xf')](_0x408f('0x10'),_0x132dfa,_0x408f('0xe'),JSON[_0x408f('0x11')](_0x5db0eb));if(_0x5db0eb[_0x408f('0x12')]){if(_0x5db0eb['error'][_0x408f('0x13')]===0x1f4){logger[_0x408f('0x12')](_0x408f('0x14'),_0x132dfa,_0x5db0eb['error']['message']);return _0x4b3210(_0x5db0eb[_0x408f('0x12')][_0x408f('0x15')]);}logger[_0x408f('0x12')](_0x408f('0x14'),_0x132dfa,_0x5db0eb[_0x408f('0x12')][_0x408f('0x15')]);return _0x4f488e(_0x5db0eb['error'][_0x408f('0x15')]);}else{logger[_0x408f('0xd')]('License,\x20%s,\x20%s',_0x132dfa,'request\x20sent');_0x4f488e(_0x5db0eb[_0x408f('0x16')][_0x408f('0x15')]);}})['catch'](function(_0x31e24b){logger['error'](_0x408f('0x14'),_0x132dfa,_0x31e24b);_0x4b3210(_0x31e24b);});});} \ No newline at end of file +var _0x03a7=['client','http','request','then','info','request\x20sent','debug','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x5d23e1,_0x104aab){var _0x474cb8=function(_0x34b5e8){while(--_0x34b5e8){_0x5d23e1['push'](_0x5d23e1['shift']());}};_0x474cb8(++_0x104aab);}(_0x03a7,0x195));var _0x703a=function(_0x4406d3,_0x22a6d9){_0x4406d3=_0x4406d3-0x0;var _0x187293=_0x03a7[_0x4406d3];return _0x187293;};'use strict';var _=require(_0x703a('0x0'));var util=require('util');var moment=require(_0x703a('0x1'));var BPromise=require(_0x703a('0x2'));var rs=require(_0x703a('0x3'));var fs=require('fs');var Redis=require(_0x703a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x703a('0x5'));var logger=require(_0x703a('0x6'))('rpc');var config=require(_0x703a('0x7'));var jayson=require(_0x703a('0x8'));var client=jayson[_0x703a('0x9')][_0x703a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3730fe,_0x27d550,_0x36e66d){return new BPromise(function(_0x134781,_0x2fb64e){return client[_0x703a('0xb')](_0x3730fe,_0x36e66d)[_0x703a('0xc')](function(_0x78dce0){logger[_0x703a('0xd')]('License,\x20%s,\x20%s',_0x27d550,_0x703a('0xe'));logger[_0x703a('0xf')]('License,\x20%s,\x20%s,\x20%s',_0x27d550,_0x703a('0xe'),JSON[_0x703a('0x10')](_0x78dce0));if(_0x78dce0[_0x703a('0x11')]){if(_0x78dce0['error'][_0x703a('0x12')]===0x1f4){logger[_0x703a('0x11')](_0x703a('0x13'),_0x27d550,_0x78dce0[_0x703a('0x11')][_0x703a('0x14')]);return _0x2fb64e(_0x78dce0[_0x703a('0x11')][_0x703a('0x14')]);}logger[_0x703a('0x11')](_0x703a('0x13'),_0x27d550,_0x78dce0[_0x703a('0x11')]['message']);return _0x134781(_0x78dce0[_0x703a('0x11')][_0x703a('0x14')]);}else{logger[_0x703a('0xd')](_0x703a('0x13'),_0x27d550,_0x703a('0xe'));_0x134781(_0x78dce0[_0x703a('0x15')][_0x703a('0x14')]);}})[_0x703a('0x16')](function(_0x4ce60b){logger['error'](_0x703a('0x13'),_0x27d550,_0x4ce60b);_0x2fb64e(_0x4ce60b);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index c836636..f3583ad 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 _0x272c=['delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getAnswers','/:id/in_servers','getSmtp','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','send','addAgents','put','update'];(function(_0x8d5377,_0x18f365){var _0x4d254c=function(_0x441efc){while(--_0x441efc){_0x8d5377['push'](_0x8d5377['shift']());}};_0x4d254c(++_0x18f365);}(_0x272c,0x17f));var _0xc272=function(_0x32a66c,_0x239a9f){_0x32a66c=_0x32a66c-0x0;var _0x60348c=_0x272c[_0x32a66c];return _0x60348c;};'use strict';var multer=require('multer');var util=require(_0xc272('0x0'));var path=require(_0xc272('0x1'));var timeout=require('connect-timeout');var express=require(_0xc272('0x2'));var router=express[_0xc272('0x3')]();var fs_extra=require(_0xc272('0x4'));var auth=require(_0xc272('0x5'));var interaction=require(_0xc272('0x6'));var config=require(_0xc272('0x7'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0xc272('0x8')](),controller[_0xc272('0x9')]);router[_0xc272('0xa')](_0xc272('0xb'),auth[_0xc272('0x8')](),controller[_0xc272('0xc')]);router[_0xc272('0xa')](_0xc272('0xd'),auth[_0xc272('0x8')](),controller[_0xc272('0xe')]);router[_0xc272('0xa')](_0xc272('0xf'),auth[_0xc272('0x8')](),controller['getDispositions']);router[_0xc272('0xa')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xc272('0x10')]);router[_0xc272('0xa')](_0xc272('0x11'),auth[_0xc272('0x8')](),controller['getImap']);router[_0xc272('0xa')]('/:id/out_servers',auth[_0xc272('0x8')](),controller[_0xc272('0x12')]);router[_0xc272('0xa')]('/:id/interactions',auth[_0xc272('0x8')](),controller[_0xc272('0x13')]);router[_0xc272('0xa')](_0xc272('0x14'),auth[_0xc272('0x8')](),controller['getApplications']);router['get'](_0xc272('0x15'),auth[_0xc272('0x8')](),controller[_0xc272('0x16')]);router[_0xc272('0xa')](_0xc272('0x17'),auth[_0xc272('0x8')](),controller[_0xc272('0x18')]);router[_0xc272('0xa')](_0xc272('0x19'),auth[_0xc272('0x8')](),controller[_0xc272('0x1a')]);router[_0xc272('0x1b')](_0xc272('0xf'),auth[_0xc272('0x8')](),controller[_0xc272('0x1c')]);router[_0xc272('0x1b')](_0xc272('0x1d'),auth[_0xc272('0x8')](),controller[_0xc272('0x1e')]);router['post']('/',auth[_0xc272('0x8')](),controller['create']);router[_0xc272('0x1b')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xc272('0x1f')]);router['post'](_0xc272('0x20'),auth[_0xc272('0x8')](),controller[_0xc272('0x21')]);router['post']('/:id/interactions',auth[_0xc272('0x8')](),controller[_0xc272('0x22')]);router[_0xc272('0x1b')]('/:id/applications',auth[_0xc272('0x8')](),controller[_0xc272('0x23')]);router[_0xc272('0x1b')]('/:id/send',auth['isAuthenticated'](),controller[_0xc272('0x24')]);router[_0xc272('0x1b')](_0xc272('0x19'),auth[_0xc272('0x8')](),controller[_0xc272('0x25')]);router[_0xc272('0x26')](_0xc272('0xd'),auth['isAuthenticated'](),controller[_0xc272('0x27')]);router[_0xc272('0x28')](_0xc272('0xf'),auth[_0xc272('0x8')](),controller[_0xc272('0x29')]);router[_0xc272('0x28')](_0xc272('0x1d'),auth[_0xc272('0x8')](),controller[_0xc272('0x2a')]);router[_0xc272('0x28')](_0xc272('0x11'),auth[_0xc272('0x8')](),controller[_0xc272('0x2b')]);router[_0xc272('0x28')](_0xc272('0x20'),auth[_0xc272('0x8')](),controller['removeSmtp']);router[_0xc272('0x28')](_0xc272('0xd'),auth[_0xc272('0x8')](),controller[_0xc272('0x2c')]);router['delete']('/:id/users',auth[_0xc272('0x8')](),controller[_0xc272('0x2d')]);module[_0xc272('0x2e')]=router; \ No newline at end of file +var _0xb5a0=['getInteractions','/:id/applications','/:id/messages','/:id/verify','/:id/users','getAgents','/:id/dispositions','post','addAnswer','create','addImap','addSmtp','addInteraction','addApplications','/:id/send','addAgents','put','/:id','removeDispositions','removeAnswers','delete','removeImap','removeSmtp','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions'];(function(_0x5959c9,_0x2ed153){var _0x4ffcbc=function(_0x459b7a){while(--_0x459b7a){_0x5959c9['push'](_0x5959c9['shift']());}};_0x4ffcbc(++_0x2ed153);}(_0xb5a0,0xd1));var _0x0b5a=function(_0x42ca58,_0x423bf9){_0x42ca58=_0x42ca58-0x0;var _0x1a3a40=_0xb5a0[_0x42ca58];return _0x1a3a40;};'use strict';var multer=require(_0x0b5a('0x0'));var util=require(_0x0b5a('0x1'));var path=require('path');var timeout=require(_0x0b5a('0x2'));var express=require(_0x0b5a('0x3'));var router=express[_0x0b5a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0b5a('0x5'));var interaction=require(_0x0b5a('0x6'));var config=require(_0x0b5a('0x7'));var controller=require('./mailAccount.controller');router[_0x0b5a('0x8')]('/',auth[_0x0b5a('0x9')](),controller[_0x0b5a('0xa')]);router[_0x0b5a('0x8')](_0x0b5a('0xb'),auth[_0x0b5a('0x9')](),controller['describe']);router['get']('/:id',auth[_0x0b5a('0x9')](),controller[_0x0b5a('0xc')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x0b5a('0xd')]);router[_0x0b5a('0x8')](_0x0b5a('0xe'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0xf')]);router[_0x0b5a('0x8')](_0x0b5a('0x10'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x11')]);router[_0x0b5a('0x8')](_0x0b5a('0x12'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x13')]);router[_0x0b5a('0x8')](_0x0b5a('0x14'),auth['isAuthenticated'](),controller[_0x0b5a('0x15')]);router[_0x0b5a('0x8')](_0x0b5a('0x16'),auth[_0x0b5a('0x9')](),controller['getApplications']);router['get'](_0x0b5a('0x17'),auth[_0x0b5a('0x9')](),controller['getMessages']);router[_0x0b5a('0x8')](_0x0b5a('0x18'),auth['isAuthenticated'](),controller['verifySmtp']);router[_0x0b5a('0x8')](_0x0b5a('0x19'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x1a')]);router['post'](_0x0b5a('0x1b'),auth[_0x0b5a('0x9')](),controller['addDisposition']);router[_0x0b5a('0x1c')](_0x0b5a('0xe'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x1d')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0b5a('0x1e')]);router[_0x0b5a('0x1c')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0x0b5a('0x1f')]);router[_0x0b5a('0x1c')](_0x0b5a('0x12'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x20')]);router[_0x0b5a('0x1c')](_0x0b5a('0x14'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x21')]);router['post'](_0x0b5a('0x16'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x22')]);router[_0x0b5a('0x1c')](_0x0b5a('0x23'),auth[_0x0b5a('0x9')](),controller['send']);router[_0x0b5a('0x1c')](_0x0b5a('0x19'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x24')]);router[_0x0b5a('0x25')](_0x0b5a('0x26'),auth[_0x0b5a('0x9')](),controller['update']);router['delete'](_0x0b5a('0x1b'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x27')]);router['delete'](_0x0b5a('0xe'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x28')]);router[_0x0b5a('0x29')]('/:id/in_servers',auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x2a')]);router[_0x0b5a('0x29')](_0x0b5a('0x12'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x2b')]);router[_0x0b5a('0x29')](_0x0b5a('0x26'),auth['isAuthenticated'](),controller['destroy']);router[_0x0b5a('0x29')](_0x0b5a('0x19'),auth[_0x0b5a('0x9')](),controller[_0x0b5a('0x2c')]);module[_0x0b5a('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 3b145f5..90b510d 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 _0x029b=['UNSIGNED','TEXT','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','INTEGER'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x029b,0x66));var _0xb029=function(_0x14ec73,_0x1d3261){_0x14ec73=_0x14ec73-0x0;var _0x4bc9ea=_0x029b[_0x14ec73];return _0x4bc9ea;};'use strict';var Sequelize=require(_0xb029('0x0'));module[_0xb029('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xb029('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xb029('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xb029('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xb029('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb029('0x2')],'allowNull':![],'defaultValue':_0xb029('0x4')},'fontSize':{'type':Sequelize[_0xb029('0x5')](0x2)[_0xb029('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb029('0x7')],'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[_0xb029('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb029('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb029('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb029('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xb029('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xb029('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x266df5){if(!_0x266df5)this[_0xb029('0x9')](_0xb029('0xa'),null);this[_0xb029('0x9')](_0xb029('0xb'),_0x266df5);}}}; \ No newline at end of file +var _0xe5b3=['STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0xe5b3,0x133));var _0x3e5b=function(_0x1b4f2b,_0x5de61a){_0x1b4f2b=_0x1b4f2b-0x0;var _0x31ba9b=_0xe5b3[_0x1b4f2b];return _0x31ba9b;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'description':{'type':Sequelize[_0x3e5b('0x1')]},'name':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x3e5b('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x3e5b('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x3e5b('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x3e5b('0x3')]},'markAsUnread':{'type':Sequelize[_0x3e5b('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x3e5b('0x1')],'allowNull':![],'defaultValue':_0x3e5b('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x3e5b('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x3e5b('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x3e5b('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3e5b('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3e5b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3e5b('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3e5b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3e5b('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x3e5b('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x3e5b('0x2')],'defaultValue':![],'comment':_0x3e5b('0x8'),'set':function(_0x522e9e){if(!_0x522e9e)this[_0x3e5b('0x9')]('mandatoryDispositionPauseId',null);this[_0x3e5b('0x9')](_0x3e5b('0xa'),_0x522e9e);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5a782eb..32fb4b5 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 _0x35db=['verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','register','jayson/promise','client','http','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','Smtp','Pause','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailAccount','includeAll','findAll','rows','show','MailServerOut','find','body','mandatoryDispositionPause','describe','MailAccountId','Disposition','create','getDispositions','findOne','params','hasOwnProperty','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','ListId','isNil','active','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','getInteractions','include','CmContact','Contact','User','fullname','internal','Tag','tag','addApplications','sequelize','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','Contacts','updatedAt','from','format','email','attachments','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages'];(function(_0x10aed1,_0x366f8d){var _0x3f3d71=function(_0x338f2f){while(--_0x338f2f){_0x10aed1['push'](_0x10aed1['shift']());}};_0x3f3d71(++_0x366f8d);}(_0x35db,0x184));var _0xb35d=function(_0x5a0274,_0x223afd){_0x5a0274=_0x5a0274-0x0;var _0x25130a=_0x35db[_0x5a0274];return _0x25130a;};'use strict';var emlformat=require(_0xb35d('0x0'));var rimraf=require(_0xb35d('0x1'));var zipdir=require(_0xb35d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb35d('0x3'));var moment=require(_0xb35d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb35d('0x5'));var util=require(_0xb35d('0x6'));var path=require('path');var sox=require(_0xb35d('0x7'));var csv=require(_0xb35d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb35d('0x9'));var crypto=require(_0xb35d('0xa'));var jsforce=require(_0xb35d('0xb'));var deskjs=require(_0xb35d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var htmlToText=require(_0xb35d('0xd'));var juice=require(_0xb35d('0xe'));var Redis=require(_0xb35d('0xf'));var authService=require(_0xb35d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb35d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb35d('0x12'))(_0xb35d('0x13'));var utils=require(_0xb35d('0x14'));var config=require(_0xb35d('0x15'));var licenseUtil=require(_0xb35d('0x16'));var db=require(_0xb35d('0x17'))['db'];config[_0xb35d('0x18')]=_[_0xb35d('0x19')](config[_0xb35d('0x18')],{'host':_0xb35d('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb35d('0x1b'))[_0xb35d('0x1c')](socket);var jayson=require(_0xb35d('0x1d'));var client=jayson[_0xb35d('0x1e')][_0xb35d('0x1f')]({'port':0x232b});function respondWithRpcPromise(_0x5b712e,_0x322a2d,_0x498c9a,_0x31e2d9){return new BPromise(function(_0x3a9fe9,_0xb5af9e){var _0x832c59=_0x31e2d9||client;return _0x832c59['request'](_0x5b712e,_0x498c9a)[_0xb35d('0x20')](function(_0x30bafd){logger[_0xb35d('0x21')](_0xb35d('0x22'),_0x322a2d,_0xb35d('0x23'));logger['debug'](_0xb35d('0x24'),_0x322a2d,'request\x20sent',JSON['stringify'](_0x30bafd));if(_0x30bafd['error']){if(_0x30bafd['error'][_0xb35d('0x25')]===0x1f4){logger[_0xb35d('0x26')](_0xb35d('0x22'),_0x322a2d,_0x30bafd[_0xb35d('0x26')][_0xb35d('0x27')]);return _0xb5af9e(_0x30bafd['error'][_0xb35d('0x27')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x322a2d,_0x30bafd['error'][_0xb35d('0x27')]);return _0x3a9fe9(_0x30bafd['error'][_0xb35d('0x27')]);}else{logger['info'](_0xb35d('0x22'),_0x322a2d,_0xb35d('0x23'));_0x3a9fe9(_0x30bafd[_0xb35d('0x28')]['message']);}})[_0xb35d('0x29')](function(_0x18bea4){logger[_0xb35d('0x26')](_0xb35d('0x22'),_0x322a2d,_0x18bea4);_0xb5af9e(_0x18bea4);});});}function respondWithStatusCode(_0x24277e,_0x3bbe88){_0x3bbe88=_0x3bbe88||0xcc;return function(_0x2b6d7f){if(_0x2b6d7f){return _0x24277e[_0xb35d('0x2a')](_0x3bbe88);}return _0x24277e[_0xb35d('0x2b')](_0x3bbe88)[_0xb35d('0x2c')]();};}function respondWithResult(_0x198f73,_0x65a074){_0x65a074=_0x65a074||0xc8;return function(_0xa195f7){if(_0xa195f7){return _0x198f73[_0xb35d('0x2b')](_0x65a074)[_0xb35d('0x2d')](_0xa195f7);}};}function respondWithFilteredResult(_0x95c71b,_0x31d6e4){return function(_0x2c9c1b){if(_0x2c9c1b){var _0x3f2281=typeof _0x31d6e4['offset']===_0xb35d('0x2e')&&typeof _0x31d6e4[_0xb35d('0x2f')]==='undefined';var _0x3db2b5=_0x2c9c1b[_0xb35d('0x30')];var _0x3e9f51=_0x3f2281?0x0:_0x31d6e4[_0xb35d('0x31')];var _0x1e3e31=_0x3f2281?_0x2c9c1b[_0xb35d('0x30')]:_0x31d6e4[_0xb35d('0x31')]+_0x31d6e4[_0xb35d('0x2f')];var _0x5b464c;if(_0x1e3e31>=_0x3db2b5){_0x1e3e31=_0x3db2b5;_0x5b464c=0xc8;}else{_0x5b464c=0xce;}_0x95c71b[_0xb35d('0x2b')](_0x5b464c);return _0x95c71b[_0xb35d('0x32')](_0xb35d('0x33'),_0x3e9f51+'-'+_0x1e3e31+'/'+_0x3db2b5)[_0xb35d('0x2d')](_0x2c9c1b);}return null;};}function patchUpdates(_0x41094e){return function(_0x4e849d){try{jsonpatch[_0xb35d('0x34')](_0x4e849d,_0x41094e,!![]);}catch(_0x5ab664){return BPromise['reject'](_0x5ab664);}return _0x4e849d['save']();};}function saveUpdates(_0x4e26a9,_0x182644){return function(_0x3d2a95){if(_0x3d2a95){return _0x3d2a95[_0xb35d('0x35')](_0x4e26a9)[_0xb35d('0x20')](function(_0x1f802c){return _0x1f802c;});}return null;};}function removeEntity(_0x43f166,_0x10421){return function(_0x17b76b){if(_0x17b76b){return _0x17b76b[_0xb35d('0x36')]()[_0xb35d('0x20')](function(){var _0x339483=_0x17b76b[_0xb35d('0x37')]({'plain':!![]});var _0x15e206=_0xb35d('0x38');return db[_0xb35d('0x39')]['destroy']({'where':{'type':_0x15e206,'resourceId':_0x339483['id']}})['then'](function(){return _0x17b76b;});})['then'](function(){_0x43f166[_0xb35d('0x2b')](0xcc)[_0xb35d('0x2c')]();});}};}function handleEntityNotFound(_0x1df5ca,_0x5c8bad){return function(_0x2b54d9){if(!_0x2b54d9){_0x1df5ca[_0xb35d('0x2a')](0x194);}return _0x2b54d9;};}function handleError(_0x39d41e,_0x58042a){_0x58042a=_0x58042a||0x1f4;return function(_0x5b22d8){logger['error'](_0x5b22d8[_0xb35d('0x3a')]);if(_0x5b22d8[_0xb35d('0x3b')]){delete _0x5b22d8[_0xb35d('0x3b')];}_0x39d41e['status'](_0x58042a)[_0xb35d('0x3c')](_0x5b22d8);};}exports[_0xb35d('0x3d')]=function(_0x13a07a,_0x55821c){var _0xad4eb7={'include':[{'model':db[_0xb35d('0x3e')],'as':_0xb35d('0x3f')},{'model':db['MailServerOut'],'as':_0xb35d('0x40')},{'model':db[_0xb35d('0x41')],'as':'mandatoryDispositionPause'}]},_0x4daff1={},_0x9e0fd={'count':0x0,'rows':[]};var _0xdb1170=_['map'](db['MailAccount'][_0xb35d('0x42')],function(_0x5ad00c){return{'name':_0x5ad00c[_0xb35d('0x43')],'type':_0x5ad00c[_0xb35d('0x44')][_0xb35d('0x45')]};});_0x4daff1[_0xb35d('0x46')]=_[_0xb35d('0x47')](_0xdb1170,_0xb35d('0x3b'));_0x4daff1[_0xb35d('0x48')]=_[_0xb35d('0x49')](_0x13a07a[_0xb35d('0x48')]);_0x4daff1[_0xb35d('0x4a')]=_['intersection'](_0x4daff1['model'],_0x4daff1[_0xb35d('0x48')]);_0xad4eb7[_0xb35d('0x4b')]=_[_0xb35d('0x4c')](_0x4daff1[_0xb35d('0x46')],qs[_0xb35d('0x4d')](_0x13a07a[_0xb35d('0x48')]['fields']));_0xad4eb7[_0xb35d('0x4b')]=_0xad4eb7[_0xb35d('0x4b')][_0xb35d('0x4e')]?_0xad4eb7[_0xb35d('0x4b')]:_0x4daff1[_0xb35d('0x46')];if(!_0x13a07a[_0xb35d('0x48')]['hasOwnProperty'](_0xb35d('0x4f'))){_0xad4eb7['limit']=qs['limit'](_0x13a07a['query'][_0xb35d('0x2f')]);_0xad4eb7[_0xb35d('0x31')]=qs['offset'](_0x13a07a[_0xb35d('0x48')][_0xb35d('0x31')]);}_0xad4eb7[_0xb35d('0x50')]=qs[_0xb35d('0x51')](_0x13a07a[_0xb35d('0x48')][_0xb35d('0x51')]);_0xad4eb7[_0xb35d('0x52')]=qs[_0xb35d('0x4a')](_[_0xb35d('0x53')](_0x13a07a[_0xb35d('0x48')],_0x4daff1[_0xb35d('0x4a')]),_0xdb1170);if(_0x13a07a[_0xb35d('0x48')][_0xb35d('0x54')]){_0xad4eb7['where']=_[_0xb35d('0x55')](_0xad4eb7['where'],{'$or':_['map'](_0xdb1170,function(_0x4164ae){if(_0x4164ae[_0xb35d('0x44')]!==_0xb35d('0x56')){var _0x2d05b7={};_0x2d05b7[_0x4164ae[_0xb35d('0x3b')]]={'$like':'%'+_0x13a07a[_0xb35d('0x48')][_0xb35d('0x54')]+'%'};return _0x2d05b7;}})});}_0xad4eb7=_['merge']({},_0xad4eb7,_0x13a07a[_0xb35d('0x57')]);var _0x5fd6af={'where':_0xad4eb7['where']};return db[_0xb35d('0x58')][_0xb35d('0x30')](_0x5fd6af)[_0xb35d('0x20')](function(_0x3b885b){_0x9e0fd[_0xb35d('0x30')]=_0x3b885b;if(_0x13a07a['query'][_0xb35d('0x59')]){_0xad4eb7['include']=[{'all':!![]}];}return db[_0xb35d('0x58')][_0xb35d('0x5a')](_0xad4eb7);})['then'](function(_0x5931c0){_0x9e0fd[_0xb35d('0x5b')]=_0x5931c0;return _0x9e0fd;})[_0xb35d('0x20')](respondWithFilteredResult(_0x55821c,_0xad4eb7))['catch'](handleError(_0x55821c,null));};exports[_0xb35d('0x5c')]=function(_0x2faeef,_0x2e93fe){var _0x47c64d={'raw':![],'where':{'id':_0x2faeef['params']['id']},'include':[{'model':db[_0xb35d('0x3e')],'as':_0xb35d('0x3f')},{'model':db[_0xb35d('0x5d')],'as':_0xb35d('0x40')},{'model':db[_0xb35d('0x41')],'as':'mandatoryDispositionPause'}]},_0x76a32a={};_0x76a32a[_0xb35d('0x46')]=_[_0xb35d('0x49')](db[_0xb35d('0x58')][_0xb35d('0x42')]);_0x76a32a[_0xb35d('0x48')]=_['keys'](_0x2faeef[_0xb35d('0x48')]);_0x76a32a[_0xb35d('0x4a')]=_[_0xb35d('0x4c')](_0x76a32a[_0xb35d('0x46')],_0x76a32a[_0xb35d('0x48')]);_0x47c64d[_0xb35d('0x4b')]=_[_0xb35d('0x4c')](_0x76a32a[_0xb35d('0x46')],qs['fields'](_0x2faeef[_0xb35d('0x48')][_0xb35d('0x4d')]));_0x47c64d[_0xb35d('0x4b')]=_0x47c64d[_0xb35d('0x4b')][_0xb35d('0x4e')]?_0x47c64d[_0xb35d('0x4b')]:_0x76a32a[_0xb35d('0x46')];if(_0x2faeef['query'][_0xb35d('0x59')]){_0x47c64d['include']=[{'all':!![]}];}_0x47c64d=_[_0xb35d('0x55')]({},_0x47c64d,_0x2faeef[_0xb35d('0x57')]);return db[_0xb35d('0x58')][_0xb35d('0x5e')](_0x47c64d)['then'](handleEntityNotFound(_0x2e93fe,null))[_0xb35d('0x20')](respondWithResult(_0x2e93fe,null))['catch'](handleError(_0x2e93fe,null));};exports[_0xb35d('0x35')]=function(_0x406272,_0x859421){if(_0x406272[_0xb35d('0x5f')]['id']){delete _0x406272[_0xb35d('0x5f')]['id'];}return db[_0xb35d('0x58')][_0xb35d('0x5e')]({'where':{'id':_0x406272['params']['id']},'include':[{'model':db[_0xb35d('0x3e')],'as':_0xb35d('0x3f')},{'model':db[_0xb35d('0x5d')],'as':_0xb35d('0x40')},{'model':db[_0xb35d('0x41')],'as':_0xb35d('0x60')}]})[_0xb35d('0x20')](handleEntityNotFound(_0x859421,null))['then'](saveUpdates(_0x406272[_0xb35d('0x5f')],null))[_0xb35d('0x20')](function(_0x246670){if(_0x246670&&_0x406272[_0xb35d('0x5f')][_0xb35d('0x3f')]){return db['MailServerIn'][_0xb35d('0x35')](_0x406272[_0xb35d('0x5f')][_0xb35d('0x3f')],{'where':{'MailAccountId':_0x246670['id']}})[_0xb35d('0x20')](function(){return _0x246670;});}return _0x246670;})[_0xb35d('0x20')](function(_0x47eaf4){if(_0x47eaf4&&_0x406272[_0xb35d('0x5f')]['Smtp']){return db[_0xb35d('0x5d')]['update'](_0x406272[_0xb35d('0x5f')][_0xb35d('0x40')],{'where':{'MailAccountId':_0x47eaf4['id']}})['then'](function(){return _0x47eaf4;});}return _0x47eaf4;})[_0xb35d('0x20')](respondWithResult(_0x859421,null))[_0xb35d('0x29')](handleError(_0x859421,null));};exports[_0xb35d('0x61')]=function(_0x434496,_0x3b78d0){return db[_0xb35d('0x58')][_0xb35d('0x61')]()['then'](respondWithResult(_0x3b78d0,null))[_0xb35d('0x29')](handleError(_0x3b78d0,null));};exports['addDisposition']=function(_0x324d1b,_0x3c7276,_0x22659d){if(_0x324d1b[_0xb35d('0x5f')]['id']){delete _0x324d1b[_0xb35d('0x5f')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x324d1b['params']['id']}})['then'](handleEntityNotFound(_0x3c7276,null))[_0xb35d('0x20')](function(_0x3d9d4b){if(_0x3d9d4b){_0x324d1b[_0xb35d('0x5f')][_0xb35d('0x62')]=_0x3d9d4b['id'];return db[_0xb35d('0x63')][_0xb35d('0x64')](_0x324d1b[_0xb35d('0x5f')]);}})[_0xb35d('0x20')](respondWithResult(_0x3c7276,null))[_0xb35d('0x29')](handleError(_0x3c7276,null));};exports[_0xb35d('0x65')]=function(_0xa0d4df,_0x2bf6e1,_0x5cf8e1){var _0x3d4ed7={'raw':![],'where':{}};var _0x232516={};var _0x2d4a81={'count':0x0,'rows':[]};return db[_0xb35d('0x58')][_0xb35d('0x66')]({'where':{'id':_0xa0d4df[_0xb35d('0x67')]['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x2bf6e1,null))['then'](function(_0x2bbce2){if(_0x2bbce2){_0x232516[_0xb35d('0x46')]=_['keys'](db['Disposition']['rawAttributes']);_0x232516[_0xb35d('0x48')]=_[_0xb35d('0x49')](_0xa0d4df[_0xb35d('0x48')]);_0x232516[_0xb35d('0x4a')]=_[_0xb35d('0x4c')](_0x232516[_0xb35d('0x46')],_0x232516[_0xb35d('0x48')]);_0x3d4ed7[_0xb35d('0x4b')]=_[_0xb35d('0x4c')](_0x232516[_0xb35d('0x46')],qs['fields'](_0xa0d4df[_0xb35d('0x48')][_0xb35d('0x4d')]));_0x3d4ed7[_0xb35d('0x4b')]=_0x3d4ed7[_0xb35d('0x4b')][_0xb35d('0x4e')]?_0x3d4ed7[_0xb35d('0x4b')]:_0x232516['model'];if(!_0xa0d4df[_0xb35d('0x48')][_0xb35d('0x68')]('nolimit')){_0x3d4ed7['limit']=qs[_0xb35d('0x2f')](_0xa0d4df[_0xb35d('0x48')][_0xb35d('0x2f')]);_0x3d4ed7[_0xb35d('0x31')]=qs[_0xb35d('0x31')](_0xa0d4df[_0xb35d('0x48')][_0xb35d('0x31')]);}_0x3d4ed7[_0xb35d('0x50')]=qs['sort'](_0xa0d4df['query'][_0xb35d('0x51')]);_0x3d4ed7[_0xb35d('0x52')]=qs[_0xb35d('0x4a')](_[_0xb35d('0x53')](_0xa0d4df['query'],_0x232516[_0xb35d('0x4a')]));_0x3d4ed7[_0xb35d('0x52')][_0xb35d('0x62')]=_0x2bbce2['id'];if(_0xa0d4df['query'][_0xb35d('0x54')]){_0x3d4ed7['where']=_[_0xb35d('0x55')](_0x3d4ed7[_0xb35d('0x52')],{'$or':_[_0xb35d('0x47')](_0x3d4ed7['attributes'],function(_0x50a5a5){var _0x169e7e={};_0x169e7e[_0x50a5a5]={'$like':'%'+_0xa0d4df[_0xb35d('0x48')]['filter']+'%'};return _0x169e7e;})});}_0x3d4ed7=_['merge']({},_0x3d4ed7,_0xa0d4df[_0xb35d('0x57')]);return db['Disposition'][_0xb35d('0x30')]({'where':_0x3d4ed7[_0xb35d('0x52')]})[_0xb35d('0x20')](function(_0x359b3c){_0x2d4a81[_0xb35d('0x30')]=_0x359b3c;if(_0xa0d4df[_0xb35d('0x48')][_0xb35d('0x59')]){_0x3d4ed7['include']=[{'all':!![]}];}return db['Disposition'][_0xb35d('0x5a')](_0x3d4ed7);})[_0xb35d('0x20')](function(_0x238329){_0x2d4a81[_0xb35d('0x5b')]=_0x238329;return _0x2d4a81;});}})[_0xb35d('0x20')](respondWithFilteredResult(_0x2bf6e1,_0x3d4ed7))['catch'](handleError(_0x2bf6e1,null));};exports[_0xb35d('0x69')]=function(_0xe0b483,_0x457a9a,_0x50886e){return db[_0xb35d('0x58')][_0xb35d('0x5e')]({'where':{'id':_0xe0b483[_0xb35d('0x67')]['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x457a9a,null))['then'](function(_0x372d97){if(_0x372d97){return _0x372d97['removeDispositions'](_0xe0b483[_0xb35d('0x48')]['ids']);}})[_0xb35d('0x20')](respondWithStatusCode(_0x457a9a,null))[_0xb35d('0x29')](handleError(_0x457a9a,null));};exports[_0xb35d('0x6a')]=function(_0x104475,_0x45aebc,_0xcb3a05){if(_0x104475[_0xb35d('0x5f')]['id']){delete _0x104475[_0xb35d('0x5f')]['id'];}return db[_0xb35d('0x58')][_0xb35d('0x5e')]({'where':{'id':_0x104475[_0xb35d('0x67')]['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x45aebc,null))[_0xb35d('0x20')](function(_0x1bd7ef){if(_0x1bd7ef){_0x104475[_0xb35d('0x5f')][_0xb35d('0x62')]=_0x1bd7ef['id'];return db[_0xb35d('0x6b')]['create'](_0x104475[_0xb35d('0x5f')]);}})['then'](respondWithResult(_0x45aebc,null))[_0xb35d('0x29')](handleError(_0x45aebc,null));};exports[_0xb35d('0x6c')]=function(_0x30c270,_0x543ca0,_0x50186c){var _0x42f337={'raw':![],'where':{}};var _0xa96961={};var _0x2168e6={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x30c270[_0xb35d('0x67')]['id']}})['then'](handleEntityNotFound(_0x543ca0,null))[_0xb35d('0x20')](function(_0x8cc911){if(_0x8cc911){_0xa96961[_0xb35d('0x46')]=_[_0xb35d('0x49')](db[_0xb35d('0x6b')]['rawAttributes']);_0xa96961[_0xb35d('0x48')]=_[_0xb35d('0x49')](_0x30c270['query']);_0xa96961[_0xb35d('0x4a')]=_['intersection'](_0xa96961[_0xb35d('0x46')],_0xa96961[_0xb35d('0x48')]);_0x42f337[_0xb35d('0x4b')]=_[_0xb35d('0x4c')](_0xa96961['model'],qs[_0xb35d('0x4d')](_0x30c270[_0xb35d('0x48')][_0xb35d('0x4d')]));_0x42f337[_0xb35d('0x4b')]=_0x42f337[_0xb35d('0x4b')][_0xb35d('0x4e')]?_0x42f337[_0xb35d('0x4b')]:_0xa96961['model'];if(!_0x30c270[_0xb35d('0x48')][_0xb35d('0x68')]('nolimit')){_0x42f337['limit']=qs[_0xb35d('0x2f')](_0x30c270['query']['limit']);_0x42f337['offset']=qs['offset'](_0x30c270[_0xb35d('0x48')][_0xb35d('0x31')]);}_0x42f337['order']=qs['sort'](_0x30c270[_0xb35d('0x48')][_0xb35d('0x51')]);_0x42f337[_0xb35d('0x52')]=qs['filters'](_[_0xb35d('0x53')](_0x30c270['query'],_0xa96961[_0xb35d('0x4a')]));_0x42f337[_0xb35d('0x52')][_0xb35d('0x62')]=_0x8cc911['id'];if(_0x30c270[_0xb35d('0x48')][_0xb35d('0x54')]){_0x42f337[_0xb35d('0x52')]=_[_0xb35d('0x55')](_0x42f337[_0xb35d('0x52')],{'$or':_[_0xb35d('0x47')](_0x42f337[_0xb35d('0x4b')],function(_0x27dd48){var _0x2dcb1b={};_0x2dcb1b[_0x27dd48]={'$like':'%'+_0x30c270[_0xb35d('0x48')][_0xb35d('0x54')]+'%'};return _0x2dcb1b;})});}_0x42f337=_['merge']({},_0x42f337,_0x30c270['options']);return db[_0xb35d('0x6b')][_0xb35d('0x30')]({'where':_0x42f337[_0xb35d('0x52')]})[_0xb35d('0x20')](function(_0x408918){_0x2168e6['count']=_0x408918;if(_0x30c270[_0xb35d('0x48')][_0xb35d('0x59')]){_0x42f337['include']=[{'all':!![]}];}return db[_0xb35d('0x6b')]['findAll'](_0x42f337);})['then'](function(_0x23e548){_0x2168e6[_0xb35d('0x5b')]=_0x23e548;return _0x2168e6;});}})[_0xb35d('0x20')](respondWithFilteredResult(_0x543ca0,_0x42f337))[_0xb35d('0x29')](handleError(_0x543ca0,null));};exports[_0xb35d('0x6d')]=function(_0x264461,_0x3bfb90,_0x5b8617){return db['MailAccount']['find']({'where':{'id':_0x264461[_0xb35d('0x67')]['id']}})['then'](handleEntityNotFound(_0x3bfb90,null))['then'](function(_0x1d47cf){if(_0x1d47cf){return _0x1d47cf[_0xb35d('0x6d')](_0x264461['query'][_0xb35d('0x6e')]);}})[_0xb35d('0x20')](respondWithStatusCode(_0x3bfb90,null))['catch'](handleError(_0x3bfb90,null));};exports[_0xb35d('0x64')]=function(_0x42f651,_0x1e0a59){var _0x364c37={'name':_0x42f651[_0xb35d('0x5f')][_0xb35d('0x3b')],'key':_0x42f651[_0xb35d('0x5f')][_0xb35d('0x45')],'email':_0x42f651[_0xb35d('0x5f')]['email'],'ListId':_0x42f651[_0xb35d('0x5f')][_0xb35d('0x6f')],'active':!_[_0xb35d('0x70')](_0x42f651[_0xb35d('0x5f')][_0xb35d('0x71')])?_0x42f651[_0xb35d('0x5f')]['active']:!![],'description':_0x42f651[_0xb35d('0x5f')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0xb35d('0x70')](_0x42f651[_0xb35d('0x5f')]['cservice'])){if(_0x42f651['body'][_0xb35d('0x72')]){_0x364c37[_0xb35d('0x3f')][_0xb35d('0x73')]=_0x364c37[_0xb35d('0x40')]['user']=_0x42f651[_0xb35d('0x5f')][_0xb35d('0x74')];_0x364c37[_0xb35d('0x3f')][_0xb35d('0x75')]=_0x364c37[_0xb35d('0x40')][_0xb35d('0x76')]=_0x42f651[_0xb35d('0x5f')][_0xb35d('0x77')];}else{_0x364c37[_0xb35d('0x3f')][_0xb35d('0x78')]=_0x364c37[_0xb35d('0x40')][_0xb35d('0x78')]=![];}_0x364c37[_0xb35d('0x3f')][_0xb35d('0x79')]=_0x42f651[_0xb35d('0x5f')][_0xb35d('0x3f')]['host'];_0x364c37[_0xb35d('0x3f')][_0xb35d('0x7a')]=_0x42f651[_0xb35d('0x5f')]['Imap'][_0xb35d('0x7a')];_0x364c37[_0xb35d('0x40')][_0xb35d('0x79')]=_0x42f651[_0xb35d('0x5f')][_0xb35d('0x40')]['host'];_0x364c37[_0xb35d('0x40')][_0xb35d('0x7a')]=_0x42f651[_0xb35d('0x5f')][_0xb35d('0x40')][_0xb35d('0x7a')];}else{_0x364c37['Imap'][_0xb35d('0x7b')]=_0x364c37[_0xb35d('0x40')][_0xb35d('0x7b')]=_0x42f651[_0xb35d('0x5f')]['cservice'];_0x364c37['Imap'][_0xb35d('0x73')]=_0x364c37[_0xb35d('0x40')][_0xb35d('0x73')]=_0x42f651[_0xb35d('0x5f')][_0xb35d('0x74')];_0x364c37[_0xb35d('0x3f')]['password']=_0x364c37[_0xb35d('0x40')][_0xb35d('0x76')]=_0x42f651['body'][_0xb35d('0x77')];}return db[_0xb35d('0x58')][_0xb35d('0x64')](_0x364c37,{'include':[{'model':db[_0xb35d('0x5d')],'as':_0xb35d('0x40')},{'model':db[_0xb35d('0x3e')],'as':_0xb35d('0x3f')}]})[_0xb35d('0x20')](function(_0x38f2a1){var _0x15d24a=_0x42f651[_0xb35d('0x73')][_0xb35d('0x37')]({'plain':!![]});if(!_0x15d24a)throw new Error(_0xb35d('0x7c'));if(_0x15d24a[_0xb35d('0x7d')]===_0xb35d('0x73')){var _0x17ab73=_0x38f2a1[_0xb35d('0x37')]({'plain':!![]});return db[_0xb35d('0x7e')]['find']({'where':{'name':_0xb35d('0x38'),'userProfileId':_0x15d24a[_0xb35d('0x7f')]},'raw':!![]})['then'](function(_0x44e4ae){if(_0x44e4ae&&_0x44e4ae[_0xb35d('0x80')]===0x0){return db['UserProfileResource']['create']({'name':_0x17ab73[_0xb35d('0x3b')],'resourceId':_0x17ab73['id'],'type':_0x44e4ae[_0xb35d('0x3b')],'sectionId':_0x44e4ae['id']},{})[_0xb35d('0x20')](function(){return _0x38f2a1;});}else{return _0x38f2a1;}})[_0xb35d('0x29')](function(_0x4120a5){logger[_0xb35d('0x26')](_0xb35d('0x81'),_0x4120a5);throw _0x4120a5;});}return _0x38f2a1;})['then'](respondWithResult(_0x1e0a59,0xc9))[_0xb35d('0x29')](handleError(_0x1e0a59,null));};exports['getImap']=function(_0x2ff31a,_0x13be28,_0x836013){return db['MailAccount'][_0xb35d('0x66')]({'where':{'id':_0x2ff31a[_0xb35d('0x67')]['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x13be28,null))[_0xb35d('0x20')](function(_0x275d04){if(_0x275d04){return _0x275d04['getImap']();}return null;})['then'](respondWithResult(_0x13be28,null))['catch'](handleError(_0x13be28,null));};exports[_0xb35d('0x82')]=function(_0x56f940,_0x41c617,_0x3f7d2e){if(_0x56f940['body']['id']){delete _0x56f940[_0xb35d('0x5f')]['id'];}return db[_0xb35d('0x58')][_0xb35d('0x5e')]({'where':{'id':_0x56f940[_0xb35d('0x67')]['id']}})['then'](handleEntityNotFound(_0x41c617,null))[_0xb35d('0x20')](function(_0x526343){if(_0x526343){_0x56f940[_0xb35d('0x5f')][_0xb35d('0x62')]=_0x526343['id'];return db[_0xb35d('0x3e')][_0xb35d('0x64')](_0x56f940[_0xb35d('0x5f')]);}})[_0xb35d('0x20')](respondWithResult(_0x41c617,null))[_0xb35d('0x29')](handleError(_0x41c617,null));};exports[_0xb35d('0x83')]=function(_0x1821a1,_0x2f6733,_0x306b15){return db[_0xb35d('0x58')]['findOne']({'where':{'id':_0x1821a1[_0xb35d('0x67')]['id']}})['then'](handleEntityNotFound(_0x2f6733,null))[_0xb35d('0x20')](function(_0x2e89ee){if(_0x2e89ee){return _0x2e89ee[_0xb35d('0x84')](null);}return null;})[_0xb35d('0x20')](respondWithStatusCode(_0x2f6733,null))[_0xb35d('0x29')](handleError(_0x2f6733,null));};exports['getSmtp']=function(_0x51b38c,_0x3dc34b,_0x4b66ff){return db['MailAccount'][_0xb35d('0x66')]({'where':{'id':_0x51b38c[_0xb35d('0x67')]['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x3dc34b,null))['then'](function(_0x590de7){if(_0x590de7){return _0x590de7[_0xb35d('0x85')]();}return null;})['then'](respondWithResult(_0x3dc34b,null))[_0xb35d('0x29')](handleError(_0x3dc34b,null));};exports[_0xb35d('0x86')]=function(_0x181f89,_0x5edecf,_0x3e7313){if(_0x181f89[_0xb35d('0x5f')]['id']){delete _0x181f89[_0xb35d('0x5f')]['id'];}return db[_0xb35d('0x58')][_0xb35d('0x5e')]({'where':{'id':_0x181f89[_0xb35d('0x67')]['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x5edecf,null))[_0xb35d('0x20')](function(_0x4ffc88){if(_0x4ffc88){_0x181f89[_0xb35d('0x5f')][_0xb35d('0x62')]=_0x4ffc88['id'];return db['MailServerOut'][_0xb35d('0x64')](_0x181f89[_0xb35d('0x5f')]);}})['then'](respondWithResult(_0x5edecf,null))[_0xb35d('0x29')](handleError(_0x5edecf,null));};exports[_0xb35d('0x87')]=function(_0x318bc7,_0x432ce6,_0x3eb043){return db[_0xb35d('0x58')]['findOne']({'where':{'id':_0x318bc7[_0xb35d('0x67')]['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x432ce6,null))[_0xb35d('0x20')](function(_0x13374e){if(_0x13374e){return _0x13374e[_0xb35d('0x88')](null);}return null;})['then'](respondWithStatusCode(_0x432ce6,null))[_0xb35d('0x29')](handleError(_0x432ce6,null));};exports[_0xb35d('0x89')]=function(_0x59a0fa,_0x5ef573,_0x1c7c8d){return db[_0xb35d('0x8a')]['find']({'where':{'id':_0x59a0fa[_0xb35d('0x67')]['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x5ef573,null))[_0xb35d('0x20')](function(_0x393679){if(_0x393679){return _0x393679['addInteraction'](_0x59a0fa[_0xb35d('0x5f')]['ids'],_['omit'](_0x59a0fa[_0xb35d('0x5f')],[_0xb35d('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x5ef573,null))[_0xb35d('0x29')](handleError(_0x5ef573,null));};exports[_0xb35d('0x8b')]=function(_0x13f281,_0x2d0336,_0x3ebed5){var _0x2d24e5={'raw':![],'where':{}};var _0x3d8060={};var _0x41faf4={'count':0x0,'rows':[]};return db[_0xb35d('0x58')]['findOne']({'where':{'id':_0x13f281[_0xb35d('0x67')]['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x2d0336,null))[_0xb35d('0x20')](function(_0x439dbb){if(_0x439dbb){_0x3d8060[_0xb35d('0x46')]=_['keys'](db[_0xb35d('0x8a')][_0xb35d('0x42')]);_0x3d8060[_0xb35d('0x48')]=_[_0xb35d('0x49')](_0x13f281[_0xb35d('0x48')]);_0x3d8060[_0xb35d('0x4a')]=_[_0xb35d('0x4c')](_0x3d8060[_0xb35d('0x46')],_0x3d8060[_0xb35d('0x48')]);_0x2d24e5['attributes']=_[_0xb35d('0x4c')](_0x3d8060[_0xb35d('0x46')],qs[_0xb35d('0x4d')](_0x13f281[_0xb35d('0x48')]['fields']));_0x2d24e5[_0xb35d('0x4b')]=_0x2d24e5[_0xb35d('0x4b')][_0xb35d('0x4e')]?_0x2d24e5[_0xb35d('0x4b')]:_0x3d8060[_0xb35d('0x46')];if(!_0x13f281[_0xb35d('0x48')]['hasOwnProperty'](_0xb35d('0x4f'))){_0x2d24e5[_0xb35d('0x2f')]=qs['limit'](_0x13f281[_0xb35d('0x48')]['limit']);_0x2d24e5[_0xb35d('0x31')]=qs[_0xb35d('0x31')](_0x13f281[_0xb35d('0x48')][_0xb35d('0x31')]);}_0x2d24e5['order']=qs[_0xb35d('0x51')](_0x13f281[_0xb35d('0x48')]['sort']);_0x2d24e5[_0xb35d('0x52')]=qs[_0xb35d('0x4a')](_[_0xb35d('0x53')](_0x13f281['query'],_0x3d8060['filters']));_0x2d24e5['where'][_0xb35d('0x62')]=_0x439dbb['id'];if(_0x13f281[_0xb35d('0x48')]['filter']){_0x2d24e5[_0xb35d('0x52')]=_['merge'](_0x2d24e5[_0xb35d('0x52')],{'$or':_[_0xb35d('0x47')](_0x2d24e5[_0xb35d('0x4b')],function(_0x301168){var _0x52c634={};_0x52c634[_0x301168]={'$like':'%'+_0x13f281[_0xb35d('0x48')]['filter']+'%'};return _0x52c634;})});}_0x2d24e5=_['merge']({},_0x2d24e5,_0x13f281['options']);return db['MailInteraction']['count']({'where':_0x2d24e5[_0xb35d('0x52')]})['then'](function(_0x3e4a35){_0x41faf4[_0xb35d('0x30')]=_0x3e4a35;if(_0x13f281[_0xb35d('0x48')][_0xb35d('0x59')]){_0x2d24e5[_0xb35d('0x8c')]=[{'model':db[_0xb35d('0x8d')],'as':_0xb35d('0x8e'),'required':![]},{'model':db[_0xb35d('0x8f')],'as':'Owner','attributes':[_0xb35d('0x3b'),_0xb35d('0x90'),_0xb35d('0x91')],'required':![]},{'model':db[_0xb35d('0x92')],'as':'Tags','attributes':['id','name','color'],'where':_0x13f281[_0xb35d('0x48')][_0xb35d('0x93')]?{'id':_0x13f281['query'][_0xb35d('0x93')]}:undefined,'required':_0x13f281[_0xb35d('0x48')][_0xb35d('0x93')]?!![]:![]}];}return db[_0xb35d('0x8a')]['findAll'](_0x2d24e5);})[_0xb35d('0x20')](function(_0x31ed7f){_0x41faf4[_0xb35d('0x5b')]=_0x31ed7f;return _0x41faf4;});}})[_0xb35d('0x20')](respondWithFilteredResult(_0x2d0336,_0x2d24e5))[_0xb35d('0x29')](handleError(_0x2d0336,null));};exports[_0xb35d('0x94')]=function(_0x5e56a5,_0x428330,_0x8e0c62){return db[_0xb35d('0x58')][_0xb35d('0x66')]({'where':{'id':_0x5e56a5[_0xb35d('0x67')]['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x428330,null))[_0xb35d('0x20')](function(_0x25271a){if(_0x25271a){return db[_0xb35d('0x95')]['transaction'](function(_0x113adb){return db[_0xb35d('0x96')][_0xb35d('0x36')]({'where':{'MailAccountId':_0x5e56a5[_0xb35d('0x67')]['id']},'transaction':_0x113adb})['then'](function(_0x1c5e61){var _0x3e5044=_[_0xb35d('0x47')](_0x5e56a5['body'],function(_0x55aef0){_0x55aef0['MailAccountId']=_0x5e56a5[_0xb35d('0x67')]['id'];return _0x55aef0;});return db[_0xb35d('0x96')][_0xb35d('0x97')](_0x3e5044,{'transaction':_0x113adb});});})[_0xb35d('0x20')](function(){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x5e56a5[_0xb35d('0x67')]['id']},'order':_0xb35d('0x98')});});}})[_0xb35d('0x20')](respondWithResult(_0x428330,null))[_0xb35d('0x29')](handleError(_0x428330,null));};exports[_0xb35d('0x99')]=function(_0x55e18c,_0xee8c53,_0x290bb4){var _0x1c9c71={};var _0x2511be={};var _0x4f0350;var _0x367582;return db[_0xb35d('0x58')][_0xb35d('0x66')]({'where':{'id':_0x55e18c[_0xb35d('0x67')]['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0xee8c53,null))[_0xb35d('0x20')](function(_0x70baa4){if(_0x70baa4){_0x4f0350=_0x70baa4;_0x2511be['model']=_[_0xb35d('0x49')](db['MailApplication'][_0xb35d('0x42')]);_0x2511be[_0xb35d('0x48')]=_[_0xb35d('0x49')](_0x55e18c[_0xb35d('0x48')]);_0x2511be[_0xb35d('0x4a')]=_[_0xb35d('0x4c')](_0x2511be[_0xb35d('0x46')],_0x2511be[_0xb35d('0x48')]);_0x1c9c71['attributes']=_[_0xb35d('0x4c')](_0x2511be['model'],qs['fields'](_0x55e18c[_0xb35d('0x48')]['fields']));_0x1c9c71[_0xb35d('0x4b')]=_0x1c9c71[_0xb35d('0x4b')][_0xb35d('0x4e')]?_0x1c9c71['attributes']:_0x2511be['model'];_0x1c9c71[_0xb35d('0x50')]=qs['sort'](_0x55e18c[_0xb35d('0x48')][_0xb35d('0x51')]);_0x1c9c71[_0xb35d('0x52')]=qs[_0xb35d('0x4a')](_['pick'](_0x55e18c[_0xb35d('0x48')],_0x2511be[_0xb35d('0x4a')]));if(_0x55e18c['query'][_0xb35d('0x54')]){_0x1c9c71[_0xb35d('0x52')]=_[_0xb35d('0x55')](_0x1c9c71['where'],{'$or':_[_0xb35d('0x47')](_0x1c9c71[_0xb35d('0x4b')],function(_0xde72f0){var _0x21519b={};_0x21519b[_0xde72f0]={'$like':'%'+_0x55e18c[_0xb35d('0x48')]['filter']+'%'};return _0x21519b;})});}_0x1c9c71=_[_0xb35d('0x55')]({},_0x1c9c71,_0x55e18c[_0xb35d('0x57')]);return _0x4f0350['getApplications'](_0x1c9c71);}})[_0xb35d('0x20')](function(_0x3056a1){if(_0x3056a1){_0x367582=_0x3056a1[_0xb35d('0x4e')];if(!_0x55e18c[_0xb35d('0x48')][_0xb35d('0x68')]('nolimit')){_0x1c9c71[_0xb35d('0x2f')]=qs[_0xb35d('0x2f')](_0x55e18c[_0xb35d('0x48')][_0xb35d('0x2f')]);_0x1c9c71[_0xb35d('0x31')]=qs['offset'](_0x55e18c[_0xb35d('0x48')]['offset']);}return _0x4f0350['getApplications'](_0x1c9c71);}})['then'](function(_0xf4495e){if(_0xf4495e){return _0xf4495e?{'count':_0x367582,'rows':_0xf4495e}:null;}})[_0xb35d('0x20')](respondWithResult(_0xee8c53,null))[_0xb35d('0x29')](handleError(_0xee8c53,null));};exports[_0xb35d('0x9a')]=function(_0x54a58c,_0x3e7b80,_0x4e8a48){var _0x22bb01={'raw':!![],'where':{}};var _0x38edc2={};var _0x2bb178={'count':0x0,'rows':[]};return db[_0xb35d('0x58')][_0xb35d('0x66')]({'where':{'id':_0x54a58c[_0xb35d('0x67')]['id']}})['then'](handleEntityNotFound(_0x3e7b80,null))[_0xb35d('0x20')](function(_0x524292){if(_0x524292){_0x38edc2[_0xb35d('0x46')]=_['keys'](db[_0xb35d('0x9b')]['rawAttributes']);_0x38edc2[_0xb35d('0x48')]=_[_0xb35d('0x49')](_0x54a58c[_0xb35d('0x48')]);_0x38edc2[_0xb35d('0x4a')]=_['intersection'](_0x38edc2[_0xb35d('0x46')],_0x38edc2[_0xb35d('0x48')]);_0x22bb01[_0xb35d('0x4b')]=_[_0xb35d('0x4c')](_0x38edc2['model'],qs[_0xb35d('0x4d')](_0x54a58c[_0xb35d('0x48')][_0xb35d('0x4d')]));_0x22bb01['attributes']=_0x22bb01[_0xb35d('0x4b')][_0xb35d('0x4e')]?_0x22bb01[_0xb35d('0x4b')]:_0x38edc2[_0xb35d('0x46')];if(!_0x54a58c[_0xb35d('0x48')][_0xb35d('0x68')](_0xb35d('0x4f'))){_0x22bb01[_0xb35d('0x2f')]=qs['limit'](_0x54a58c[_0xb35d('0x48')][_0xb35d('0x2f')]);_0x22bb01['offset']=qs[_0xb35d('0x31')](_0x54a58c['query']['offset']);}_0x22bb01[_0xb35d('0x50')]=qs[_0xb35d('0x51')](_0x54a58c['query'][_0xb35d('0x51')]);_0x22bb01[_0xb35d('0x52')]=qs[_0xb35d('0x4a')](_[_0xb35d('0x53')](_0x54a58c[_0xb35d('0x48')],_0x38edc2[_0xb35d('0x4a')]));_0x22bb01['where']['MailAccountId']=_0x524292['id'];if(_0x54a58c['query']['filter']){_0x22bb01[_0xb35d('0x52')]=_[_0xb35d('0x55')](_0x22bb01[_0xb35d('0x52')],{'$or':_[_0xb35d('0x47')](_0x22bb01['attributes'],function(_0x410a8a){var _0x16d8f2={};_0x16d8f2[_0x410a8a]={'$like':'%'+_0x54a58c[_0xb35d('0x48')]['filter']+'%'};return _0x16d8f2;})});}if(_0x54a58c[_0xb35d('0x48')]['$gte']){var _0x5ef857=_0x54a58c[_0xb35d('0x48')]['$gte'][_0xb35d('0x9c')](',');var _0x2968ff={};_0x2968ff[_0x5ef857[0x0]]={'$gte':moment(_0x5ef857[0x1])['format'](_0xb35d('0x9d'))};_0x22bb01['where']=_['merge'](_0x22bb01[_0xb35d('0x52')],_0x2968ff);}_0x22bb01=_[_0xb35d('0x55')]({},_0x22bb01,_0x54a58c[_0xb35d('0x57')]);return db['MailMessage'][_0xb35d('0x30')]({'where':_0x22bb01['where']})['then'](function(_0x5c5564){_0x2bb178[_0xb35d('0x30')]=_0x5c5564;if(_0x54a58c[_0xb35d('0x48')][_0xb35d('0x59')]){_0x22bb01[_0xb35d('0x8c')]=[{'all':!![]}];}return db[_0xb35d('0x9b')][_0xb35d('0x5a')](_0x22bb01);})[_0xb35d('0x20')](function(_0x5da351){if(_0x54a58c[_0xb35d('0x48')][_0xb35d('0x9e')]==='true'){for(var _0x25b98d=0x0;_0x25b98d<_0x5da351[_0xb35d('0x4e')];_0x25b98d++){_0x5da351[_0x25b98d][_0xb35d('0x5f')]=juice(_0x5da351[_0x25b98d]['body']);}}_0x2bb178['rows']=_0x5da351;return _0x2bb178;});}})['then'](respondWithFilteredResult(_0x3e7b80,_0x22bb01))[_0xb35d('0x29')](handleError(_0x3e7b80,null));};exports['send']=function(_0x1b9b58,_0x5d6f5f,_0xc05a7){var _0x2f4357,_0x4d228a={},_0x6a4d58;if(_0x1b9b58[_0xb35d('0x5f')]['to']){_0x6a4d58=_0x1b9b58['body']['to'][_0xb35d('0x9c')](',')[0x0];}return db['MailAccount'][_0xb35d('0x5e')]({'where':{'id':_0x1b9b58[_0xb35d('0x67')]['id']},'include':[{'model':db[_0xb35d('0x9f')],'as':'List','include':[{'model':db[_0xb35d('0x8d')],'as':_0xb35d('0xa0'),'where':{'email':_0x6a4d58},'limit':0x1,'order':[[_0xb35d('0xa1'),'DESC']]}]},{'model':db[_0xb35d('0x5d')],'as':'Smtp','raw':!![]}]})[_0xb35d('0x20')](handleEntityNotFound(_0x5d6f5f,null))[_0xb35d('0x20')](function(_0x56c8ba){if(_0x56c8ba){_0x2f4357=_0x56c8ba;if(_0x56c8ba[_0xb35d('0x40')]){if(_[_0xb35d('0x70')](_0x1b9b58[_0xb35d('0x5f')][_0xb35d('0xa2')])){_0x1b9b58[_0xb35d('0x5f')][_0xb35d('0xa2')]=util[_0xb35d('0xa3')]('%s\x20<%s>',_0x56c8ba[_0xb35d('0x3b')],_0x56c8ba[_0xb35d('0xa4')]||_0x56c8ba['Smtp'][_0xb35d('0x73')]);}if(_0x1b9b58['body'][_0xb35d('0xa5')]&&_0x1b9b58[_0xb35d('0x5f')][_0xb35d('0xa5')]['length']){for(var _0x37c12a=0x0;_0x37c12a<_0x1b9b58['body'][_0xb35d('0xa5')][_0xb35d('0x4e')];_0x37c12a+=0x1){_0x1b9b58[_0xb35d('0x5f')][_0xb35d('0xa5')][_0x37c12a]={'filename':_0x1b9b58[_0xb35d('0x5f')]['attachments'][_0x37c12a][_0xb35d('0x3b')],'path':path['join'](config['root'],_0xb35d('0xa6'),_0x1b9b58[_0xb35d('0x5f')]['attachments'][_0x37c12a][_0xb35d('0xa7')])};}}var _0x300e2f={'tls':{'rejectUnauthorized':![]}};if(_[_0xb35d('0x70')](_0x56c8ba[_0xb35d('0x40')][_0xb35d('0x7b')])){if(_0x56c8ba['Smtp'][_0xb35d('0x78')]){_0x300e2f[_0xb35d('0xa8')]={'user':_0x56c8ba['Smtp'][_0xb35d('0x73')],'pass':_0x56c8ba[_0xb35d('0x40')][_0xb35d('0x76')]};}_0x300e2f['host']=_0x56c8ba['Smtp'][_0xb35d('0x79')];_0x300e2f[_0xb35d('0x7a')]=_0x56c8ba[_0xb35d('0x40')][_0xb35d('0x7a')];_0x300e2f[_0xb35d('0xa9')]=_0x56c8ba[_0xb35d('0x40')][_0xb35d('0xa9')];}else{_0x300e2f[_0xb35d('0x7b')]=_0x56c8ba[_0xb35d('0x40')]['service'];_0x300e2f['auth']={'user':_0x56c8ba[_0xb35d('0x40')][_0xb35d('0x73')],'pass':_0x56c8ba[_0xb35d('0x40')][_0xb35d('0x76')]};}return respondWithRpcPromise(_0xb35d('0xaa'),_0xb35d('0xab'),{'account':_0x300e2f,'message':_0x1b9b58[_0xb35d('0x5f')]});}else{throw new Error(_0xb35d('0xac'));}}})['then'](function(_0x3ac580){if(_0x3ac580){_0x4d228a=_0x3ac580;if(_0x2f4357['List']){if(_0x2f4357['List'][_0xb35d('0xa0')]['length']){return _0x2f4357['List']['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xb35d('0x19')](_0x1b9b58['body'],{'firstName':_0x1b9b58[_0xb35d('0x5f')]['to'],'email':_0x1b9b58[_0xb35d('0x5f')]['to'],'phone':_0x1b9b58[_0xb35d('0x5f')]['to'],'ListId':_0x2f4357[_0xb35d('0x6f')]}));}}else{throw new Error(_0xb35d('0xac'));}}})['then'](function(_0x588c2d){if(_0x588c2d){var _0x1c727e={'UserId':_0x1b9b58[_0xb35d('0x73')]['id'],'ContactId':_0x588c2d['id'],'MailAccountId':_0x2f4357['id'],'inReplyTo':_0x4d228a[_0xb35d('0xad')],'to':_0x1b9b58[_0xb35d('0x5f')][_0xb35d('0xa2')],'cc':_0x1b9b58['body']['cc'],'subject':_0x1b9b58[_0xb35d('0x5f')][_0xb35d('0xae')],'attach':_0x1b9b58['body'][_0xb35d('0xaf')],'firstMsgDirection':_0xb35d('0xb0'),'lastMsgAt':moment()[_0xb35d('0xa3')](_0xb35d('0x9d')),'lastMsgDirection':_0xb35d('0xb0'),'Messages':[_[_0xb35d('0x55')](_0x1b9b58[_0xb35d('0x5f')],{'messageId':_0x4d228a[_0xb35d('0xad')],'sentAt':moment()[_0xb35d('0xa3')](_0xb35d('0x9d')),'read':!![],'MailAccountId':_0x2f4357['id'],'UserId':_0x1b9b58[_0xb35d('0x73')]['id'],'ContactId':_0x588c2d['id']})]};if(_0x1b9b58[_0xb35d('0x5f')][_0xb35d('0xb1')]){_0x1c727e=_['merge'](_0x1c727e,_0x1b9b58[_0xb35d('0x5f')]['Interaction']);}return db['MailInteraction']['create'](_0x1c727e,{'include':[{'model':db['MailMessage'],'as':_0xb35d('0xb2')}]});}})[_0xb35d('0x20')](respondWithResult(_0x5d6f5f,null))[_0xb35d('0x29')](handleError(_0x5d6f5f,null));};exports[_0xb35d('0xb3')]=function(_0x2c13a6,_0x167638,_0x5a1d61){return db[_0xb35d('0x58')][_0xb35d('0x5e')]({'where':{'id':_0x2c13a6[_0xb35d('0x67')]['id']},'include':[{'model':db[_0xb35d('0x5d')],'as':_0xb35d('0x40'),'raw':!![]}]})[_0xb35d('0x20')](handleEntityNotFound(_0x167638,null))[_0xb35d('0x20')](function(_0xfd65b7){if(_0xfd65b7&&_0xfd65b7[_0xb35d('0x40')]){var _0x38fecb={'id':_0xfd65b7['id'],'tls':{'rejectUnauthorized':![]}};if(_0xfd65b7[_0xb35d('0x40')]['service']){_0x38fecb[_0xb35d('0x7b')]=_0xfd65b7[_0xb35d('0x40')][_0xb35d('0x7b')];}else{_0x38fecb['host']=_0xfd65b7[_0xb35d('0x40')]['host'];_0x38fecb[_0xb35d('0x7a')]=_0xfd65b7['Smtp']['port'];_0x38fecb['secure']=_0xfd65b7[_0xb35d('0x40')][_0xb35d('0xa9')];}if(_0xfd65b7[_0xb35d('0x40')][_0xb35d('0x78')]){_0x38fecb[_0xb35d('0xa8')]={'user':_0xfd65b7['Smtp'][_0xb35d('0x73')],'pass':_0xfd65b7[_0xb35d('0x40')]['pass']};}return respondWithRpcPromise(_0xb35d('0xb4'),_0xb35d('0xb3'),{'account':_0x38fecb});}})[_0xb35d('0x20')](respondWithResult(_0x167638,null))[_0xb35d('0x29')](handleError(_0x167638,null));};exports[_0xb35d('0x36')]=function(_0x4a918d,_0x2b5a73){return db['MailAccount'][_0xb35d('0x5e')]({'where':{'id':_0x4a918d[_0xb35d('0x67')]['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x2b5a73,null))[_0xb35d('0x20')](function(_0xd47484){if(_0xd47484&&_0xd47484[_0xb35d('0x7b')]){throw new db['Sequelize']['ValidationError'](_0xb35d('0xb5'));}return _0xd47484;})[_0xb35d('0x20')](removeEntity(_0x2b5a73,null))['catch'](handleError(_0x2b5a73,null));};exports[_0xb35d('0xb6')]=function(_0x2ec065,_0x279053,_0xbc598e){return db[_0xb35d('0x58')]['find']({'where':{'id':_0x2ec065['params']['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x279053,null))[_0xb35d('0x20')](function(_0x517067){if(_0x517067){return _0x517067[_0xb35d('0xb6')](_0x2ec065[_0xb35d('0x5f')][_0xb35d('0x6e')],_['omit'](_0x2ec065['body'],[_0xb35d('0x6e'),'id'])||{})[_0xb35d('0xb7')](function(_0x14a48c){for(var _0x976693=0x0;_0x976693<_0x2ec065[_0xb35d('0x5f')][_0xb35d('0x6e')][_0xb35d('0x4e')];_0x976693+=0x1){socket[_0xb35d('0xb8')](_0xb35d('0xb9'),{'UserId':Number(_0x2ec065[_0xb35d('0x5f')][_0xb35d('0x6e')][_0x976693]),'MailAccountId':Number(_0x2ec065[_0xb35d('0x67')]['id'])});}return _0x14a48c;});}})['then'](respondWithResult(_0x279053,null))[_0xb35d('0x29')](handleError(_0x279053,null));};exports['removeAgents']=function(_0x52a73c,_0x21b5b1,_0x355213){return db[_0xb35d('0x58')][_0xb35d('0x5e')]({'where':{'id':_0x52a73c['params']['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x21b5b1,null))['then'](function(_0x37db92){if(_0x37db92){return _0x37db92['removeAgents'](_0x52a73c[_0xb35d('0x48')][_0xb35d('0x6e')])['then'](function(){if(_[_0xb35d('0xba')](_0x52a73c[_0xb35d('0x48')][_0xb35d('0x6e')])){for(var _0x39df69=0x0;_0x39df69<_0x52a73c[_0xb35d('0x48')]['ids'][_0xb35d('0x4e')];_0x39df69+=0x1){socket[_0xb35d('0xb8')](_0xb35d('0xbb'),{'UserId':Number(_0x52a73c[_0xb35d('0x48')][_0xb35d('0x6e')][_0x39df69]),'MailAccountId':Number(_0x52a73c[_0xb35d('0x67')]['id'])});}}else{socket[_0xb35d('0xb8')]('userMailAccount:remove',{'UserId':Number(_0x52a73c['query'][_0xb35d('0x6e')]),'MailAccountId':Number(_0x52a73c[_0xb35d('0x67')]['id'])});}});}})[_0xb35d('0x20')](respondWithStatusCode(_0x21b5b1,null))[_0xb35d('0x29')](handleError(_0x21b5b1,null));};exports[_0xb35d('0xbc')]=function(_0x1cabd3,_0x5316b3,_0x382a01){var _0x3604f1={};var _0x4e8785={};var _0x115b52;var _0xcd798d;return db[_0xb35d('0x58')]['findOne']({'where':{'id':_0x1cabd3['params']['id']}})[_0xb35d('0x20')](handleEntityNotFound(_0x5316b3,null))[_0xb35d('0x20')](function(_0x4fb9e4){if(_0x4fb9e4){_0x115b52=_0x4fb9e4;_0x4e8785[_0xb35d('0x46')]=_[_0xb35d('0x49')](db[_0xb35d('0x8f')][_0xb35d('0x42')]);_0x4e8785['query']=_['keys'](_0x1cabd3[_0xb35d('0x48')]);_0x4e8785[_0xb35d('0x4a')]=_[_0xb35d('0x4c')](_0x4e8785['model'],_0x4e8785['query']);_0x3604f1['attributes']=_[_0xb35d('0x4c')](_0x4e8785['model'],qs['fields'](_0x1cabd3[_0xb35d('0x48')][_0xb35d('0x4d')]));_0x3604f1[_0xb35d('0x4b')]=_0x3604f1['attributes']['length']?_0x3604f1[_0xb35d('0x4b')]:_0x4e8785['model'];_0x3604f1['order']=qs['sort'](_0x1cabd3[_0xb35d('0x48')][_0xb35d('0x51')]);_0x3604f1[_0xb35d('0x52')]=qs[_0xb35d('0x4a')](_[_0xb35d('0x53')](_0x1cabd3[_0xb35d('0x48')],_0x4e8785[_0xb35d('0x4a')]));if(_0x1cabd3[_0xb35d('0x48')][_0xb35d('0x54')]){_0x3604f1[_0xb35d('0x52')]=_[_0xb35d('0x55')](_0x3604f1[_0xb35d('0x52')],{'$or':_[_0xb35d('0x47')](_0x3604f1[_0xb35d('0x4b')],function(_0x5c8403){var _0x18cdbf={};_0x18cdbf[_0x5c8403]={'$like':'%'+_0x1cabd3['query']['filter']+'%'};return _0x18cdbf;})});}_0x3604f1=_['merge']({},_0x3604f1,_0x1cabd3['options']);return _0x115b52[_0xb35d('0xbc')](_0x3604f1);}})[_0xb35d('0x20')](function(_0x197425){if(_0x197425){_0xcd798d=_0x197425[_0xb35d('0x4e')];if(!_0x1cabd3[_0xb35d('0x48')][_0xb35d('0x68')](_0xb35d('0x4f'))){_0x3604f1[_0xb35d('0x2f')]=qs[_0xb35d('0x2f')](_0x1cabd3[_0xb35d('0x48')][_0xb35d('0x2f')]);_0x3604f1[_0xb35d('0x31')]=qs[_0xb35d('0x31')](_0x1cabd3[_0xb35d('0x48')][_0xb35d('0x31')]);}return _0x115b52[_0xb35d('0xbc')](_0x3604f1);}})[_0xb35d('0x20')](function(_0x4a93e6){if(_0x4a93e6){return _0x4a93e6?{'count':_0xcd798d,'rows':_0x4a93e6}:null;}})[_0xb35d('0x20')](respondWithResult(_0x5316b3,null))[_0xb35d('0x29')](handleError(_0x5316b3,null));}; \ No newline at end of file +var _0x81ce=['pick','where','merge','VIRTUAL','options','rows','show','params','MailServerOut','mandatoryDispositionPause','include','find','body','describe','addDisposition','MailAccountId','create','getDispositions','Disposition','filter','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','includeAll','removeAnswers','ids','email','ListId','isNil','active','description','user','cuser','password','pass','cpassword','authentication','host','port','service','cservice','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','internal','Tag','Tags','color','tag','findAll','addApplications','transaction','MailApplication','destroy','findAndCountAll','priority','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','true','CmList','List','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','messageId','subject','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','User','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','html-to-text','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','jayson/promise','client','http','request','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','get','MailAccounts','UserProfileResource','end','name','send','MailServerIn','Imap','Smtp','Pause','map','MailAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0xc6590c,_0x5b6a79){var _0x2a1e8e=function(_0x2eb449){while(--_0x2eb449){_0xc6590c['push'](_0xc6590c['shift']());}};_0x2a1e8e(++_0x5b6a79);}(_0x81ce,0x73));var _0xe81c=function(_0x1879a6,_0x2cb4df){_0x1879a6=_0x1879a6-0x0;var _0x3ca317=_0x81ce[_0x1879a6];return _0x3ca317;};'use strict';var emlformat=require(_0xe81c('0x0'));var rimraf=require(_0xe81c('0x1'));var zipdir=require(_0xe81c('0x2'));var jsonpatch=require(_0xe81c('0x3'));var rp=require(_0xe81c('0x4'));var moment=require(_0xe81c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe81c('0x6'));var path=require(_0xe81c('0x7'));var sox=require(_0xe81c('0x8'));var csv=require(_0xe81c('0x9'));var ejs=require(_0xe81c('0xa'));var fs=require('fs');var fs_extra=require(_0xe81c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe81c('0xc'));var toCsv=require(_0xe81c('0x9'));var querystring=require(_0xe81c('0xd'));var Papa=require('papaparse');var htmlToText=require(_0xe81c('0xe'));var juice=require(_0xe81c('0xf'));var Redis=require(_0xe81c('0x10'));var authService=require(_0xe81c('0x11'));var qs=require(_0xe81c('0x12'));var as=require(_0xe81c('0x13'));var hardwareService=require(_0xe81c('0x14'));var logger=require(_0xe81c('0x15'))(_0xe81c('0x16'));var utils=require(_0xe81c('0x17'));var config=require(_0xe81c('0x18'));var licenseUtil=require(_0xe81c('0x19'));var db=require(_0xe81c('0x1a'))['db'];config[_0xe81c('0x1b')]=_[_0xe81c('0x1c')](config[_0xe81c('0x1b')],{'host':_0xe81c('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);var jayson=require(_0xe81c('0x1e'));var client=jayson[_0xe81c('0x1f')][_0xe81c('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x43abf6,_0xc6732f,_0x5947c6,_0x1761ce){return new BPromise(function(_0x978d9f,_0xecfe18){var _0x5979dd=_0x1761ce||client;return _0x5979dd[_0xe81c('0x21')](_0x43abf6,_0x5947c6)['then'](function(_0x50cf46){logger['info'](_0xe81c('0x22'),_0xc6732f,_0xe81c('0x23'));logger[_0xe81c('0x24')](_0xe81c('0x25'),_0xc6732f,_0xe81c('0x23'),JSON['stringify'](_0x50cf46));if(_0x50cf46[_0xe81c('0x26')]){if(_0x50cf46[_0xe81c('0x26')]['code']===0x1f4){logger[_0xe81c('0x26')](_0xe81c('0x22'),_0xc6732f,_0x50cf46['error'][_0xe81c('0x27')]);return _0xecfe18(_0x50cf46[_0xe81c('0x26')]['message']);}logger[_0xe81c('0x26')](_0xe81c('0x22'),_0xc6732f,_0x50cf46[_0xe81c('0x26')][_0xe81c('0x27')]);return _0x978d9f(_0x50cf46[_0xe81c('0x26')][_0xe81c('0x27')]);}else{logger[_0xe81c('0x28')]('MailAccount,\x20%s,\x20%s',_0xc6732f,_0xe81c('0x23'));_0x978d9f(_0x50cf46[_0xe81c('0x29')][_0xe81c('0x27')]);}})[_0xe81c('0x2a')](function(_0x5baaa7){logger[_0xe81c('0x26')](_0xe81c('0x22'),_0xc6732f,_0x5baaa7);_0xecfe18(_0x5baaa7);});});}function respondWithStatusCode(_0x3428dd,_0x124d69){_0x124d69=_0x124d69||0xcc;return function(_0x258a79){if(_0x258a79){return _0x3428dd[_0xe81c('0x2b')](_0x124d69);}return _0x3428dd[_0xe81c('0x2c')](_0x124d69)['end']();};}function respondWithResult(_0x4a818f,_0x4eac02){_0x4eac02=_0x4eac02||0xc8;return function(_0x27417f){if(_0x27417f){return _0x4a818f[_0xe81c('0x2c')](_0x4eac02)[_0xe81c('0x2d')](_0x27417f);}};}function respondWithFilteredResult(_0x2c2a78,_0xb03856){return function(_0x16cb90){if(_0x16cb90){var _0x289299=typeof _0xb03856[_0xe81c('0x2e')]===_0xe81c('0x2f')&&typeof _0xb03856[_0xe81c('0x30')]===_0xe81c('0x2f');var _0x199891=_0x16cb90[_0xe81c('0x31')];var _0x2d1ec4=_0x289299?0x0:_0xb03856[_0xe81c('0x2e')];var _0x67c39e=_0x289299?_0x16cb90['count']:_0xb03856[_0xe81c('0x2e')]+_0xb03856[_0xe81c('0x30')];var _0x4fd7e8;if(_0x67c39e>=_0x199891){_0x67c39e=_0x199891;_0x4fd7e8=0xc8;}else{_0x4fd7e8=0xce;}_0x2c2a78[_0xe81c('0x2c')](_0x4fd7e8);return _0x2c2a78[_0xe81c('0x32')]('Content-Range',_0x2d1ec4+'-'+_0x67c39e+'/'+_0x199891)['json'](_0x16cb90);}return null;};}function patchUpdates(_0x887bf7){return function(_0x5d978c){try{jsonpatch[_0xe81c('0x33')](_0x5d978c,_0x887bf7,!![]);}catch(_0x4f0708){return BPromise['reject'](_0x4f0708);}return _0x5d978c[_0xe81c('0x34')]();};}function saveUpdates(_0x2bbda2,_0x42b46a){return function(_0x3ebc9a){if(_0x3ebc9a){return _0x3ebc9a[_0xe81c('0x35')](_0x2bbda2)[_0xe81c('0x36')](function(_0x378c92){return _0x378c92;});}return null;};}function removeEntity(_0xfef64a,_0xb8c5c){return function(_0x29fb84){if(_0x29fb84){return _0x29fb84['destroy']()[_0xe81c('0x36')](function(){var _0x443832=_0x29fb84[_0xe81c('0x37')]({'plain':!![]});var _0x28b805=_0xe81c('0x38');return db[_0xe81c('0x39')]['destroy']({'where':{'type':_0x28b805,'resourceId':_0x443832['id']}})[_0xe81c('0x36')](function(){return _0x29fb84;});})[_0xe81c('0x36')](function(){_0xfef64a['status'](0xcc)[_0xe81c('0x3a')]();});}};}function handleEntityNotFound(_0x1e9629,_0x57d734){return function(_0x5ca025){if(!_0x5ca025){_0x1e9629[_0xe81c('0x2b')](0x194);}return _0x5ca025;};}function handleError(_0x19be84,_0x4ba4ef){_0x4ba4ef=_0x4ba4ef||0x1f4;return function(_0x21ce32){logger['error'](_0x21ce32['stack']);if(_0x21ce32['name']){delete _0x21ce32[_0xe81c('0x3b')];}_0x19be84['status'](_0x4ba4ef)[_0xe81c('0x3c')](_0x21ce32);};}exports['index']=function(_0x407fcb,_0x3f6519){var _0x31eca1={'include':[{'model':db[_0xe81c('0x3d')],'as':_0xe81c('0x3e')},{'model':db['MailServerOut'],'as':_0xe81c('0x3f')},{'model':db[_0xe81c('0x40')],'as':'mandatoryDispositionPause'}]},_0xcb81d={},_0x334e99={'count':0x0,'rows':[]};var _0x34c568=_[_0xe81c('0x41')](db[_0xe81c('0x42')][_0xe81c('0x43')],function(_0x44032f){return{'name':_0x44032f['fieldName'],'type':_0x44032f[_0xe81c('0x44')][_0xe81c('0x45')]};});_0xcb81d[_0xe81c('0x46')]=_[_0xe81c('0x41')](_0x34c568,_0xe81c('0x3b'));_0xcb81d[_0xe81c('0x47')]=_[_0xe81c('0x48')](_0x407fcb[_0xe81c('0x47')]);_0xcb81d[_0xe81c('0x49')]=_[_0xe81c('0x4a')](_0xcb81d[_0xe81c('0x46')],_0xcb81d[_0xe81c('0x47')]);_0x31eca1[_0xe81c('0x4b')]=_[_0xe81c('0x4a')](_0xcb81d[_0xe81c('0x46')],qs[_0xe81c('0x4c')](_0x407fcb[_0xe81c('0x47')][_0xe81c('0x4c')]));_0x31eca1[_0xe81c('0x4b')]=_0x31eca1[_0xe81c('0x4b')][_0xe81c('0x4d')]?_0x31eca1[_0xe81c('0x4b')]:_0xcb81d[_0xe81c('0x46')];if(!_0x407fcb[_0xe81c('0x47')][_0xe81c('0x4e')](_0xe81c('0x4f'))){_0x31eca1[_0xe81c('0x30')]=qs[_0xe81c('0x30')](_0x407fcb['query'][_0xe81c('0x30')]);_0x31eca1[_0xe81c('0x2e')]=qs[_0xe81c('0x2e')](_0x407fcb['query'][_0xe81c('0x2e')]);}_0x31eca1[_0xe81c('0x50')]=qs['sort'](_0x407fcb['query'][_0xe81c('0x51')]);_0x31eca1['where']=qs[_0xe81c('0x49')](_[_0xe81c('0x52')](_0x407fcb[_0xe81c('0x47')],_0xcb81d[_0xe81c('0x49')]),_0x34c568);if(_0x407fcb[_0xe81c('0x47')]['filter']){_0x31eca1[_0xe81c('0x53')]=_[_0xe81c('0x54')](_0x31eca1[_0xe81c('0x53')],{'$or':_[_0xe81c('0x41')](_0x34c568,function(_0x84b125){if(_0x84b125[_0xe81c('0x44')]!==_0xe81c('0x55')){var _0x4200b0={};_0x4200b0[_0x84b125['name']]={'$like':'%'+_0x407fcb[_0xe81c('0x47')]['filter']+'%'};return _0x4200b0;}})});}_0x31eca1=_[_0xe81c('0x54')]({},_0x31eca1,_0x407fcb[_0xe81c('0x56')]);var _0x56077d={'where':_0x31eca1[_0xe81c('0x53')]};return db[_0xe81c('0x42')][_0xe81c('0x31')](_0x56077d)[_0xe81c('0x36')](function(_0x334610){_0x334e99['count']=_0x334610;if(_0x407fcb[_0xe81c('0x47')]['includeAll']){_0x31eca1['include']=[{'all':!![]}];}return db[_0xe81c('0x42')]['findAll'](_0x31eca1);})[_0xe81c('0x36')](function(_0x165cb8){_0x334e99[_0xe81c('0x57')]=_0x165cb8;return _0x334e99;})['then'](respondWithFilteredResult(_0x3f6519,_0x31eca1))[_0xe81c('0x2a')](handleError(_0x3f6519,null));};exports[_0xe81c('0x58')]=function(_0x36b0fb,_0x2f47b8){var _0x50eeca={'raw':![],'where':{'id':_0x36b0fb[_0xe81c('0x59')]['id']},'include':[{'model':db[_0xe81c('0x3d')],'as':_0xe81c('0x3e')},{'model':db[_0xe81c('0x5a')],'as':_0xe81c('0x3f')},{'model':db['Pause'],'as':_0xe81c('0x5b')}]},_0x98a8c9={};_0x98a8c9[_0xe81c('0x46')]=_[_0xe81c('0x48')](db['MailAccount'][_0xe81c('0x43')]);_0x98a8c9['query']=_[_0xe81c('0x48')](_0x36b0fb[_0xe81c('0x47')]);_0x98a8c9['filters']=_[_0xe81c('0x4a')](_0x98a8c9['model'],_0x98a8c9['query']);_0x50eeca[_0xe81c('0x4b')]=_[_0xe81c('0x4a')](_0x98a8c9[_0xe81c('0x46')],qs[_0xe81c('0x4c')](_0x36b0fb[_0xe81c('0x47')]['fields']));_0x50eeca['attributes']=_0x50eeca[_0xe81c('0x4b')][_0xe81c('0x4d')]?_0x50eeca[_0xe81c('0x4b')]:_0x98a8c9[_0xe81c('0x46')];if(_0x36b0fb['query']['includeAll']){_0x50eeca[_0xe81c('0x5c')]=[{'all':!![]}];}_0x50eeca=_['merge']({},_0x50eeca,_0x36b0fb[_0xe81c('0x56')]);return db[_0xe81c('0x42')][_0xe81c('0x5d')](_0x50eeca)[_0xe81c('0x36')](handleEntityNotFound(_0x2f47b8,null))[_0xe81c('0x36')](respondWithResult(_0x2f47b8,null))['catch'](handleError(_0x2f47b8,null));};exports[_0xe81c('0x35')]=function(_0x3e0f91,_0x79b5ac){if(_0x3e0f91[_0xe81c('0x5e')]['id']){delete _0x3e0f91[_0xe81c('0x5e')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x3e0f91[_0xe81c('0x59')]['id']},'include':[{'model':db[_0xe81c('0x3d')],'as':_0xe81c('0x3e')},{'model':db[_0xe81c('0x5a')],'as':_0xe81c('0x3f')},{'model':db['Pause'],'as':_0xe81c('0x5b')}]})[_0xe81c('0x36')](handleEntityNotFound(_0x79b5ac,null))[_0xe81c('0x36')](saveUpdates(_0x3e0f91[_0xe81c('0x5e')],null))['then'](function(_0x2f770b){if(_0x2f770b&&_0x3e0f91[_0xe81c('0x5e')][_0xe81c('0x3e')]){return db['MailServerIn'][_0xe81c('0x35')](_0x3e0f91['body'][_0xe81c('0x3e')],{'where':{'MailAccountId':_0x2f770b['id']}})['then'](function(){return _0x2f770b;});}return _0x2f770b;})[_0xe81c('0x36')](function(_0x2adcb9){if(_0x2adcb9&&_0x3e0f91['body'][_0xe81c('0x3f')]){return db[_0xe81c('0x5a')][_0xe81c('0x35')](_0x3e0f91[_0xe81c('0x5e')][_0xe81c('0x3f')],{'where':{'MailAccountId':_0x2adcb9['id']}})['then'](function(){return _0x2adcb9;});}return _0x2adcb9;})[_0xe81c('0x36')](respondWithResult(_0x79b5ac,null))[_0xe81c('0x2a')](handleError(_0x79b5ac,null));};exports[_0xe81c('0x5f')]=function(_0x11482a,_0x2e07b0){return db['MailAccount']['describe']()[_0xe81c('0x36')](respondWithResult(_0x2e07b0,null))[_0xe81c('0x2a')](handleError(_0x2e07b0,null));};exports[_0xe81c('0x60')]=function(_0x21fc2b,_0x5a6d3b,_0x4dfdc4){if(_0x21fc2b[_0xe81c('0x5e')]['id']){delete _0x21fc2b[_0xe81c('0x5e')]['id'];}return db[_0xe81c('0x42')][_0xe81c('0x5d')]({'where':{'id':_0x21fc2b['params']['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x5a6d3b,null))['then'](function(_0x374fa1){if(_0x374fa1){_0x21fc2b[_0xe81c('0x5e')][_0xe81c('0x61')]=_0x374fa1['id'];return db['Disposition'][_0xe81c('0x62')](_0x21fc2b['body']);}})['then'](respondWithResult(_0x5a6d3b,null))['catch'](handleError(_0x5a6d3b,null));};exports[_0xe81c('0x63')]=function(_0x56b895,_0x29e8bc,_0x1b3501){var _0x3e850d={'raw':![],'where':{}};var _0x27c6f0={};var _0x5001f6={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x56b895[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x29e8bc,null))[_0xe81c('0x36')](function(_0x5d1eb0){if(_0x5d1eb0){_0x27c6f0[_0xe81c('0x46')]=_['keys'](db[_0xe81c('0x64')][_0xe81c('0x43')]);_0x27c6f0[_0xe81c('0x47')]=_[_0xe81c('0x48')](_0x56b895[_0xe81c('0x47')]);_0x27c6f0['filters']=_[_0xe81c('0x4a')](_0x27c6f0[_0xe81c('0x46')],_0x27c6f0[_0xe81c('0x47')]);_0x3e850d[_0xe81c('0x4b')]=_[_0xe81c('0x4a')](_0x27c6f0[_0xe81c('0x46')],qs['fields'](_0x56b895[_0xe81c('0x47')][_0xe81c('0x4c')]));_0x3e850d[_0xe81c('0x4b')]=_0x3e850d[_0xe81c('0x4b')][_0xe81c('0x4d')]?_0x3e850d['attributes']:_0x27c6f0['model'];if(!_0x56b895[_0xe81c('0x47')]['hasOwnProperty'](_0xe81c('0x4f'))){_0x3e850d[_0xe81c('0x30')]=qs[_0xe81c('0x30')](_0x56b895['query'][_0xe81c('0x30')]);_0x3e850d[_0xe81c('0x2e')]=qs[_0xe81c('0x2e')](_0x56b895[_0xe81c('0x47')][_0xe81c('0x2e')]);}_0x3e850d[_0xe81c('0x50')]=qs[_0xe81c('0x51')](_0x56b895['query'][_0xe81c('0x51')]);_0x3e850d['where']=qs[_0xe81c('0x49')](_[_0xe81c('0x52')](_0x56b895['query'],_0x27c6f0[_0xe81c('0x49')]));_0x3e850d[_0xe81c('0x53')][_0xe81c('0x61')]=_0x5d1eb0['id'];if(_0x56b895[_0xe81c('0x47')][_0xe81c('0x65')]){_0x3e850d[_0xe81c('0x53')]=_['merge'](_0x3e850d[_0xe81c('0x53')],{'$or':_[_0xe81c('0x41')](_0x3e850d[_0xe81c('0x4b')],function(_0xbd2d57){var _0x4d1c1c={};_0x4d1c1c[_0xbd2d57]={'$like':'%'+_0x56b895[_0xe81c('0x47')][_0xe81c('0x65')]+'%'};return _0x4d1c1c;})});}_0x3e850d=_[_0xe81c('0x54')]({},_0x3e850d,_0x56b895['options']);return db[_0xe81c('0x64')][_0xe81c('0x31')]({'where':_0x3e850d['where']})['then'](function(_0x4d9c23){_0x5001f6['count']=_0x4d9c23;if(_0x56b895[_0xe81c('0x47')]['includeAll']){_0x3e850d['include']=[{'all':!![]}];}return db[_0xe81c('0x64')]['findAll'](_0x3e850d);})[_0xe81c('0x36')](function(_0x2d3fee){_0x5001f6['rows']=_0x2d3fee;return _0x5001f6;});}})[_0xe81c('0x36')](respondWithFilteredResult(_0x29e8bc,_0x3e850d))[_0xe81c('0x2a')](handleError(_0x29e8bc,null));};exports[_0xe81c('0x66')]=function(_0x4274a3,_0x2e3d71,_0x4a3148){return db['MailAccount'][_0xe81c('0x5d')]({'where':{'id':_0x4274a3[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x2e3d71,null))['then'](function(_0x2e178e){if(_0x2e178e){return _0x2e178e['removeDispositions'](_0x4274a3[_0xe81c('0x47')]['ids']);}})[_0xe81c('0x36')](respondWithStatusCode(_0x2e3d71,null))[_0xe81c('0x2a')](handleError(_0x2e3d71,null));};exports[_0xe81c('0x67')]=function(_0x9b3ce5,_0x4d97dd,_0x29a21a){if(_0x9b3ce5[_0xe81c('0x5e')]['id']){delete _0x9b3ce5['body']['id'];}return db[_0xe81c('0x42')][_0xe81c('0x5d')]({'where':{'id':_0x9b3ce5[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x4d97dd,null))[_0xe81c('0x36')](function(_0x246692){if(_0x246692){_0x9b3ce5[_0xe81c('0x5e')]['MailAccountId']=_0x246692['id'];return db[_0xe81c('0x68')]['create'](_0x9b3ce5[_0xe81c('0x5e')]);}})['then'](respondWithResult(_0x4d97dd,null))['catch'](handleError(_0x4d97dd,null));};exports[_0xe81c('0x69')]=function(_0x49b720,_0x40b2cc,_0x368dea){var _0x405d4a={'raw':![],'where':{}};var _0x1c163c={};var _0x29d90a={'count':0x0,'rows':[]};return db[_0xe81c('0x42')][_0xe81c('0x6a')]({'where':{'id':_0x49b720[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x40b2cc,null))[_0xe81c('0x36')](function(_0x1e4221){if(_0x1e4221){_0x1c163c[_0xe81c('0x46')]=_[_0xe81c('0x48')](db[_0xe81c('0x68')][_0xe81c('0x43')]);_0x1c163c['query']=_[_0xe81c('0x48')](_0x49b720[_0xe81c('0x47')]);_0x1c163c[_0xe81c('0x49')]=_['intersection'](_0x1c163c[_0xe81c('0x46')],_0x1c163c[_0xe81c('0x47')]);_0x405d4a[_0xe81c('0x4b')]=_[_0xe81c('0x4a')](_0x1c163c[_0xe81c('0x46')],qs[_0xe81c('0x4c')](_0x49b720['query'][_0xe81c('0x4c')]));_0x405d4a['attributes']=_0x405d4a['attributes'][_0xe81c('0x4d')]?_0x405d4a[_0xe81c('0x4b')]:_0x1c163c[_0xe81c('0x46')];if(!_0x49b720[_0xe81c('0x47')]['hasOwnProperty']('nolimit')){_0x405d4a[_0xe81c('0x30')]=qs[_0xe81c('0x30')](_0x49b720[_0xe81c('0x47')][_0xe81c('0x30')]);_0x405d4a[_0xe81c('0x2e')]=qs[_0xe81c('0x2e')](_0x49b720['query'][_0xe81c('0x2e')]);}_0x405d4a['order']=qs[_0xe81c('0x51')](_0x49b720[_0xe81c('0x47')]['sort']);_0x405d4a['where']=qs[_0xe81c('0x49')](_[_0xe81c('0x52')](_0x49b720['query'],_0x1c163c['filters']));_0x405d4a[_0xe81c('0x53')][_0xe81c('0x61')]=_0x1e4221['id'];if(_0x49b720['query']['filter']){_0x405d4a[_0xe81c('0x53')]=_[_0xe81c('0x54')](_0x405d4a[_0xe81c('0x53')],{'$or':_[_0xe81c('0x41')](_0x405d4a[_0xe81c('0x4b')],function(_0x5c8a18){var _0x60b96e={};_0x60b96e[_0x5c8a18]={'$like':'%'+_0x49b720[_0xe81c('0x47')][_0xe81c('0x65')]+'%'};return _0x60b96e;})});}_0x405d4a=_['merge']({},_0x405d4a,_0x49b720[_0xe81c('0x56')]);return db[_0xe81c('0x68')][_0xe81c('0x31')]({'where':_0x405d4a['where']})[_0xe81c('0x36')](function(_0x26f2ca){_0x29d90a['count']=_0x26f2ca;if(_0x49b720['query'][_0xe81c('0x6b')]){_0x405d4a[_0xe81c('0x5c')]=[{'all':!![]}];}return db[_0xe81c('0x68')]['findAll'](_0x405d4a);})['then'](function(_0x455c06){_0x29d90a[_0xe81c('0x57')]=_0x455c06;return _0x29d90a;});}})[_0xe81c('0x36')](respondWithFilteredResult(_0x40b2cc,_0x405d4a))[_0xe81c('0x2a')](handleError(_0x40b2cc,null));};exports[_0xe81c('0x6c')]=function(_0x47965a,_0x189679,_0x472965){return db[_0xe81c('0x42')][_0xe81c('0x5d')]({'where':{'id':_0x47965a[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x189679,null))[_0xe81c('0x36')](function(_0x17d38d){if(_0x17d38d){return _0x17d38d[_0xe81c('0x6c')](_0x47965a[_0xe81c('0x47')][_0xe81c('0x6d')]);}})[_0xe81c('0x36')](respondWithStatusCode(_0x189679,null))[_0xe81c('0x2a')](handleError(_0x189679,null));};exports[_0xe81c('0x62')]=function(_0x145d9e,_0x200dd1){var _0x19afaa={'name':_0x145d9e['body'][_0xe81c('0x3b')],'key':_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x45')],'email':_0x145d9e['body'][_0xe81c('0x6e')],'ListId':_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x6f')],'active':!_[_0xe81c('0x70')](_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x71')])?_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x71')]:!![],'description':_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x72')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x145d9e[_0xe81c('0x5e')]['cservice'])){if(_0x145d9e['body']['cauthentication']){_0x19afaa[_0xe81c('0x3e')][_0xe81c('0x73')]=_0x19afaa[_0xe81c('0x3f')][_0xe81c('0x73')]=_0x145d9e['body'][_0xe81c('0x74')];_0x19afaa[_0xe81c('0x3e')][_0xe81c('0x75')]=_0x19afaa[_0xe81c('0x3f')][_0xe81c('0x76')]=_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x77')];}else{_0x19afaa[_0xe81c('0x3e')][_0xe81c('0x78')]=_0x19afaa[_0xe81c('0x3f')][_0xe81c('0x78')]=![];}_0x19afaa[_0xe81c('0x3e')][_0xe81c('0x79')]=_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x3e')]['host'];_0x19afaa['Imap'][_0xe81c('0x7a')]=_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x3e')][_0xe81c('0x7a')];_0x19afaa[_0xe81c('0x3f')][_0xe81c('0x79')]=_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x3f')]['host'];_0x19afaa[_0xe81c('0x3f')][_0xe81c('0x7a')]=_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x3f')]['port'];}else{_0x19afaa[_0xe81c('0x3e')][_0xe81c('0x7b')]=_0x19afaa[_0xe81c('0x3f')][_0xe81c('0x7b')]=_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x7c')];_0x19afaa[_0xe81c('0x3e')][_0xe81c('0x73')]=_0x19afaa[_0xe81c('0x3f')][_0xe81c('0x73')]=_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x74')];_0x19afaa[_0xe81c('0x3e')][_0xe81c('0x75')]=_0x19afaa[_0xe81c('0x3f')][_0xe81c('0x76')]=_0x145d9e[_0xe81c('0x5e')][_0xe81c('0x77')];}return db[_0xe81c('0x42')][_0xe81c('0x62')](_0x19afaa,{'include':[{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xe81c('0x3d')],'as':_0xe81c('0x3e')}]})[_0xe81c('0x36')](function(_0x3dbf70){var _0x580e92=_0x145d9e[_0xe81c('0x73')][_0xe81c('0x37')]({'plain':!![]});if(!_0x580e92)throw new Error(_0xe81c('0x7d'));if(_0x580e92[_0xe81c('0x7e')]===_0xe81c('0x73')){var _0x339f2f=_0x3dbf70['get']({'plain':!![]});return db[_0xe81c('0x7f')][_0xe81c('0x5d')]({'where':{'name':_0xe81c('0x38'),'userProfileId':_0x580e92[_0xe81c('0x80')]},'raw':!![]})[_0xe81c('0x36')](function(_0x135f7b){if(_0x135f7b&&_0x135f7b[_0xe81c('0x81')]===0x0){return db[_0xe81c('0x39')]['create']({'name':_0x339f2f[_0xe81c('0x3b')],'resourceId':_0x339f2f['id'],'type':_0x135f7b[_0xe81c('0x3b')],'sectionId':_0x135f7b['id']},{})[_0xe81c('0x36')](function(){return _0x3dbf70;});}else{return _0x3dbf70;}})[_0xe81c('0x2a')](function(_0x1261bb){logger[_0xe81c('0x26')](_0xe81c('0x82'),_0x1261bb);throw _0x1261bb;});}return _0x3dbf70;})[_0xe81c('0x36')](respondWithResult(_0x200dd1,0xc9))[_0xe81c('0x2a')](handleError(_0x200dd1,null));};exports[_0xe81c('0x83')]=function(_0x334914,_0x56e0a5,_0x27b48d){return db[_0xe81c('0x42')][_0xe81c('0x6a')]({'where':{'id':_0x334914[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x56e0a5,null))['then'](function(_0x512ae7){if(_0x512ae7){return _0x512ae7[_0xe81c('0x83')]();}return null;})[_0xe81c('0x36')](respondWithResult(_0x56e0a5,null))['catch'](handleError(_0x56e0a5,null));};exports[_0xe81c('0x84')]=function(_0x1653da,_0x55d555,_0x5c873c){if(_0x1653da['body']['id']){delete _0x1653da[_0xe81c('0x5e')]['id'];}return db['MailAccount'][_0xe81c('0x5d')]({'where':{'id':_0x1653da[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x55d555,null))[_0xe81c('0x36')](function(_0x1747d3){if(_0x1747d3){_0x1653da[_0xe81c('0x5e')][_0xe81c('0x61')]=_0x1747d3['id'];return db[_0xe81c('0x3d')][_0xe81c('0x62')](_0x1653da[_0xe81c('0x5e')]);}})[_0xe81c('0x36')](respondWithResult(_0x55d555,null))[_0xe81c('0x2a')](handleError(_0x55d555,null));};exports[_0xe81c('0x85')]=function(_0x17b42c,_0x3d886c,_0x4c57c1){return db[_0xe81c('0x42')]['findOne']({'where':{'id':_0x17b42c[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x3d886c,null))[_0xe81c('0x36')](function(_0xb503e3){if(_0xb503e3){return _0xb503e3[_0xe81c('0x86')](null);}return null;})[_0xe81c('0x36')](respondWithStatusCode(_0x3d886c,null))['catch'](handleError(_0x3d886c,null));};exports[_0xe81c('0x87')]=function(_0x2b622c,_0x3f7bf8,_0x4402ed){return db['MailAccount']['findOne']({'where':{'id':_0x2b622c[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x3f7bf8,null))[_0xe81c('0x36')](function(_0x4690e4){if(_0x4690e4){return _0x4690e4[_0xe81c('0x87')]();}return null;})[_0xe81c('0x36')](respondWithResult(_0x3f7bf8,null))[_0xe81c('0x2a')](handleError(_0x3f7bf8,null));};exports[_0xe81c('0x88')]=function(_0x21d580,_0xa93be4,_0x3c1635){if(_0x21d580[_0xe81c('0x5e')]['id']){delete _0x21d580[_0xe81c('0x5e')]['id'];}return db[_0xe81c('0x42')][_0xe81c('0x5d')]({'where':{'id':_0x21d580['params']['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0xa93be4,null))[_0xe81c('0x36')](function(_0x29524c){if(_0x29524c){_0x21d580[_0xe81c('0x5e')][_0xe81c('0x61')]=_0x29524c['id'];return db['MailServerOut'][_0xe81c('0x62')](_0x21d580['body']);}})[_0xe81c('0x36')](respondWithResult(_0xa93be4,null))[_0xe81c('0x2a')](handleError(_0xa93be4,null));};exports[_0xe81c('0x89')]=function(_0x141c6b,_0x5c43d4,_0xa50b1d){return db[_0xe81c('0x42')][_0xe81c('0x6a')]({'where':{'id':_0x141c6b['params']['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x5c43d4,null))['then'](function(_0x258700){if(_0x258700){return _0x258700[_0xe81c('0x8a')](null);}return null;})['then'](respondWithStatusCode(_0x5c43d4,null))[_0xe81c('0x2a')](handleError(_0x5c43d4,null));};exports['addInteraction']=function(_0x449702,_0x628266,_0x2131a4){return db[_0xe81c('0x8b')][_0xe81c('0x5d')]({'where':{'id':_0x449702['params']['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x628266,null))[_0xe81c('0x36')](function(_0x3b42bb){if(_0x3b42bb){return _0x3b42bb[_0xe81c('0x8c')](_0x449702[_0xe81c('0x5e')]['ids'],_[_0xe81c('0x8d')](_0x449702[_0xe81c('0x5e')],[_0xe81c('0x6d'),'id'])||{});}})[_0xe81c('0x36')](respondWithResult(_0x628266,null))[_0xe81c('0x2a')](handleError(_0x628266,null));};exports[_0xe81c('0x8e')]=function(_0x430977,_0x2a0b5b,_0x41938c){var _0x46f3fe={'raw':![],'where':{}};var _0x446519={};var _0x529ba0={'count':0x0,'rows':[]};return db[_0xe81c('0x42')][_0xe81c('0x6a')]({'where':{'id':_0x430977[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x2a0b5b,null))[_0xe81c('0x36')](function(_0x387e2a){if(_0x387e2a){_0x446519[_0xe81c('0x46')]=_[_0xe81c('0x48')](db[_0xe81c('0x8b')]['rawAttributes']);_0x446519[_0xe81c('0x47')]=_[_0xe81c('0x48')](_0x430977['query']);_0x446519[_0xe81c('0x49')]=_[_0xe81c('0x4a')](_0x446519[_0xe81c('0x46')],_0x446519[_0xe81c('0x47')]);_0x46f3fe[_0xe81c('0x4b')]=_['intersection'](_0x446519['model'],qs[_0xe81c('0x4c')](_0x430977['query']['fields']));_0x46f3fe[_0xe81c('0x4b')]=_0x46f3fe[_0xe81c('0x4b')][_0xe81c('0x4d')]?_0x46f3fe[_0xe81c('0x4b')]:_0x446519[_0xe81c('0x46')];if(!_0x430977[_0xe81c('0x47')][_0xe81c('0x4e')]('nolimit')){_0x46f3fe[_0xe81c('0x30')]=qs[_0xe81c('0x30')](_0x430977[_0xe81c('0x47')][_0xe81c('0x30')]);_0x46f3fe[_0xe81c('0x2e')]=qs[_0xe81c('0x2e')](_0x430977[_0xe81c('0x47')][_0xe81c('0x2e')]);}_0x46f3fe[_0xe81c('0x50')]=qs[_0xe81c('0x51')](_0x430977[_0xe81c('0x47')]['sort']);_0x46f3fe['where']=qs[_0xe81c('0x49')](_[_0xe81c('0x52')](_0x430977[_0xe81c('0x47')],_0x446519[_0xe81c('0x49')]));_0x46f3fe[_0xe81c('0x53')][_0xe81c('0x61')]=_0x387e2a['id'];if(_0x430977[_0xe81c('0x47')][_0xe81c('0x65')]){_0x46f3fe['where']=_[_0xe81c('0x54')](_0x46f3fe['where'],{'$or':_[_0xe81c('0x41')](_0x46f3fe['attributes'],function(_0x5c0518){var _0x2c7e66={};_0x2c7e66[_0x5c0518]={'$like':'%'+_0x430977[_0xe81c('0x47')][_0xe81c('0x65')]+'%'};return _0x2c7e66;})});}_0x46f3fe=_[_0xe81c('0x54')]({},_0x46f3fe,_0x430977[_0xe81c('0x56')]);return db[_0xe81c('0x8b')][_0xe81c('0x31')]({'where':_0x46f3fe[_0xe81c('0x53')]})[_0xe81c('0x36')](function(_0x509a4c){_0x529ba0[_0xe81c('0x31')]=_0x509a4c;if(_0x430977['query'][_0xe81c('0x6b')]){_0x46f3fe[_0xe81c('0x5c')]=[{'model':db[_0xe81c('0x8f')],'as':_0xe81c('0x90'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xe81c('0x3b'),'fullname',_0xe81c('0x91')],'required':![]},{'model':db[_0xe81c('0x92')],'as':_0xe81c('0x93'),'attributes':['id',_0xe81c('0x3b'),_0xe81c('0x94')],'where':_0x430977[_0xe81c('0x47')][_0xe81c('0x95')]?{'id':_0x430977['query'][_0xe81c('0x95')]}:undefined,'required':_0x430977[_0xe81c('0x47')][_0xe81c('0x95')]?!![]:![]}];}return db[_0xe81c('0x8b')][_0xe81c('0x96')](_0x46f3fe);})[_0xe81c('0x36')](function(_0x3a9e2d){_0x529ba0[_0xe81c('0x57')]=_0x3a9e2d;return _0x529ba0;});}})[_0xe81c('0x36')](respondWithFilteredResult(_0x2a0b5b,_0x46f3fe))[_0xe81c('0x2a')](handleError(_0x2a0b5b,null));};exports[_0xe81c('0x97')]=function(_0x519c6a,_0x2ddba4,_0x4ba56f){return db[_0xe81c('0x42')][_0xe81c('0x6a')]({'where':{'id':_0x519c6a[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x2ddba4,null))[_0xe81c('0x36')](function(_0x537724){if(_0x537724){return db['sequelize'][_0xe81c('0x98')](function(_0x59be50){return db[_0xe81c('0x99')][_0xe81c('0x9a')]({'where':{'MailAccountId':_0x519c6a[_0xe81c('0x59')]['id']},'transaction':_0x59be50})[_0xe81c('0x36')](function(_0x47f1cf){var _0x5df2b4=_['map'](_0x519c6a[_0xe81c('0x5e')],function(_0x22fa49){_0x22fa49[_0xe81c('0x61')]=_0x519c6a[_0xe81c('0x59')]['id'];return _0x22fa49;});return db['MailApplication']['bulkCreate'](_0x5df2b4,{'transaction':_0x59be50});});})[_0xe81c('0x36')](function(){return db[_0xe81c('0x99')][_0xe81c('0x9b')]({'where':{'MailAccountId':_0x519c6a[_0xe81c('0x59')]['id']},'order':_0xe81c('0x9c')});});}})['then'](respondWithResult(_0x2ddba4,null))[_0xe81c('0x2a')](handleError(_0x2ddba4,null));};exports[_0xe81c('0x9d')]=function(_0x37a1bd,_0x1f1274,_0x50dec9){var _0x2c7a12={};var _0x40f9cf={};var _0x35a4a7;var _0x15b000;return db['MailAccount'][_0xe81c('0x6a')]({'where':{'id':_0x37a1bd[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x1f1274,null))['then'](function(_0x49ca93){if(_0x49ca93){_0x35a4a7=_0x49ca93;_0x40f9cf[_0xe81c('0x46')]=_[_0xe81c('0x48')](db[_0xe81c('0x99')][_0xe81c('0x43')]);_0x40f9cf[_0xe81c('0x47')]=_[_0xe81c('0x48')](_0x37a1bd[_0xe81c('0x47')]);_0x40f9cf['filters']=_[_0xe81c('0x4a')](_0x40f9cf[_0xe81c('0x46')],_0x40f9cf['query']);_0x2c7a12['attributes']=_['intersection'](_0x40f9cf['model'],qs['fields'](_0x37a1bd[_0xe81c('0x47')]['fields']));_0x2c7a12[_0xe81c('0x4b')]=_0x2c7a12[_0xe81c('0x4b')][_0xe81c('0x4d')]?_0x2c7a12[_0xe81c('0x4b')]:_0x40f9cf['model'];_0x2c7a12[_0xe81c('0x50')]=qs[_0xe81c('0x51')](_0x37a1bd[_0xe81c('0x47')][_0xe81c('0x51')]);_0x2c7a12[_0xe81c('0x53')]=qs[_0xe81c('0x49')](_[_0xe81c('0x52')](_0x37a1bd[_0xe81c('0x47')],_0x40f9cf['filters']));if(_0x37a1bd[_0xe81c('0x47')]['filter']){_0x2c7a12[_0xe81c('0x53')]=_[_0xe81c('0x54')](_0x2c7a12[_0xe81c('0x53')],{'$or':_[_0xe81c('0x41')](_0x2c7a12['attributes'],function(_0x228d7d){var _0x531c79={};_0x531c79[_0x228d7d]={'$like':'%'+_0x37a1bd[_0xe81c('0x47')][_0xe81c('0x65')]+'%'};return _0x531c79;})});}_0x2c7a12=_[_0xe81c('0x54')]({},_0x2c7a12,_0x37a1bd[_0xe81c('0x56')]);return _0x35a4a7[_0xe81c('0x9d')](_0x2c7a12);}})[_0xe81c('0x36')](function(_0xe28cae){if(_0xe28cae){_0x15b000=_0xe28cae['length'];if(!_0x37a1bd['query'][_0xe81c('0x4e')](_0xe81c('0x4f'))){_0x2c7a12['limit']=qs[_0xe81c('0x30')](_0x37a1bd[_0xe81c('0x47')][_0xe81c('0x30')]);_0x2c7a12[_0xe81c('0x2e')]=qs[_0xe81c('0x2e')](_0x37a1bd[_0xe81c('0x47')][_0xe81c('0x2e')]);}return _0x35a4a7[_0xe81c('0x9d')](_0x2c7a12);}})['then'](function(_0x11cc34){if(_0x11cc34){return _0x11cc34?{'count':_0x15b000,'rows':_0x11cc34}:null;}})[_0xe81c('0x36')](respondWithResult(_0x1f1274,null))[_0xe81c('0x2a')](handleError(_0x1f1274,null));};exports[_0xe81c('0x9e')]=function(_0x26cd11,_0x5950dc,_0x4d4656){var _0xbb667={'raw':!![],'where':{}};var _0x543686={};var _0x3ef15a={'count':0x0,'rows':[]};return db[_0xe81c('0x42')][_0xe81c('0x6a')]({'where':{'id':_0x26cd11[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x5950dc,null))['then'](function(_0x30db86){if(_0x30db86){_0x543686['model']=_[_0xe81c('0x48')](db['MailMessage'][_0xe81c('0x43')]);_0x543686[_0xe81c('0x47')]=_[_0xe81c('0x48')](_0x26cd11[_0xe81c('0x47')]);_0x543686['filters']=_['intersection'](_0x543686[_0xe81c('0x46')],_0x543686[_0xe81c('0x47')]);_0xbb667[_0xe81c('0x4b')]=_[_0xe81c('0x4a')](_0x543686['model'],qs[_0xe81c('0x4c')](_0x26cd11[_0xe81c('0x47')][_0xe81c('0x4c')]));_0xbb667[_0xe81c('0x4b')]=_0xbb667[_0xe81c('0x4b')]['length']?_0xbb667[_0xe81c('0x4b')]:_0x543686[_0xe81c('0x46')];if(!_0x26cd11[_0xe81c('0x47')][_0xe81c('0x4e')](_0xe81c('0x4f'))){_0xbb667[_0xe81c('0x30')]=qs[_0xe81c('0x30')](_0x26cd11['query'][_0xe81c('0x30')]);_0xbb667[_0xe81c('0x2e')]=qs['offset'](_0x26cd11[_0xe81c('0x47')]['offset']);}_0xbb667[_0xe81c('0x50')]=qs['sort'](_0x26cd11[_0xe81c('0x47')][_0xe81c('0x51')]);_0xbb667[_0xe81c('0x53')]=qs['filters'](_[_0xe81c('0x52')](_0x26cd11[_0xe81c('0x47')],_0x543686[_0xe81c('0x49')]));_0xbb667[_0xe81c('0x53')][_0xe81c('0x61')]=_0x30db86['id'];if(_0x26cd11[_0xe81c('0x47')]['filter']){_0xbb667[_0xe81c('0x53')]=_[_0xe81c('0x54')](_0xbb667['where'],{'$or':_[_0xe81c('0x41')](_0xbb667[_0xe81c('0x4b')],function(_0x3a19b){var _0x617015={};_0x617015[_0x3a19b]={'$like':'%'+_0x26cd11[_0xe81c('0x47')][_0xe81c('0x65')]+'%'};return _0x617015;})});}if(_0x26cd11[_0xe81c('0x47')][_0xe81c('0x9f')]){var _0x157269=_0x26cd11[_0xe81c('0x47')]['$gte'][_0xe81c('0xa0')](',');var _0x5e3be3={};_0x5e3be3[_0x157269[0x0]]={'$gte':moment(_0x157269[0x1])[_0xe81c('0xa1')](_0xe81c('0xa2'))};_0xbb667[_0xe81c('0x53')]=_[_0xe81c('0x54')](_0xbb667['where'],_0x5e3be3);}_0xbb667=_[_0xe81c('0x54')]({},_0xbb667,_0x26cd11[_0xe81c('0x56')]);return db[_0xe81c('0xa3')][_0xe81c('0x31')]({'where':_0xbb667['where']})['then'](function(_0x5b504e){_0x3ef15a[_0xe81c('0x31')]=_0x5b504e;if(_0x26cd11[_0xe81c('0x47')][_0xe81c('0x6b')]){_0xbb667[_0xe81c('0x5c')]=[{'all':!![]}];}return db[_0xe81c('0xa3')][_0xe81c('0x96')](_0xbb667);})[_0xe81c('0x36')](function(_0x417572){if(_0x26cd11[_0xe81c('0x47')]['inlineCss']===_0xe81c('0xa4')){for(var _0x351736=0x0;_0x351736<_0x417572[_0xe81c('0x4d')];_0x351736++){_0x417572[_0x351736][_0xe81c('0x5e')]=juice(_0x417572[_0x351736][_0xe81c('0x5e')]);}}_0x3ef15a[_0xe81c('0x57')]=_0x417572;return _0x3ef15a;});}})['then'](respondWithFilteredResult(_0x5950dc,_0xbb667))[_0xe81c('0x2a')](handleError(_0x5950dc,null));};exports[_0xe81c('0x3c')]=function(_0x683d96,_0x33b84e,_0x392f36){var _0x5b9a36,_0x23450d={},_0x314003;if(_0x683d96[_0xe81c('0x5e')]['to']){_0x314003=_0x683d96['body']['to'][_0xe81c('0xa0')](',')[0x0];}return db['MailAccount'][_0xe81c('0x5d')]({'where':{'id':_0x683d96['params']['id']},'include':[{'model':db[_0xe81c('0xa5')],'as':_0xe81c('0xa6'),'include':[{'model':db[_0xe81c('0x8f')],'as':_0xe81c('0xa7'),'where':{'email':_0x314003},'limit':0x1,'order':[[_0xe81c('0xa8'),_0xe81c('0xa9')]]}]},{'model':db[_0xe81c('0x5a')],'as':_0xe81c('0x3f'),'raw':!![]}]})[_0xe81c('0x36')](handleEntityNotFound(_0x33b84e,null))[_0xe81c('0x36')](function(_0x41c9b6){if(_0x41c9b6){_0x5b9a36=_0x41c9b6;if(_0x41c9b6[_0xe81c('0x3f')]){if(_[_0xe81c('0x70')](_0x683d96['body'][_0xe81c('0xaa')])){_0x683d96[_0xe81c('0x5e')][_0xe81c('0xaa')]=util['format'](_0xe81c('0xab'),_0x41c9b6['name'],_0x41c9b6[_0xe81c('0x6e')]||_0x41c9b6[_0xe81c('0x3f')][_0xe81c('0x73')]);}if(_0x683d96[_0xe81c('0x5e')][_0xe81c('0xac')]&&_0x683d96['body']['attachments'][_0xe81c('0x4d')]){for(var _0x1a8103=0x0;_0x1a8103<_0x683d96[_0xe81c('0x5e')][_0xe81c('0xac')][_0xe81c('0x4d')];_0x1a8103+=0x1){_0x683d96['body'][_0xe81c('0xac')][_0x1a8103]={'filename':_0x683d96['body'][_0xe81c('0xac')][_0x1a8103][_0xe81c('0x3b')],'path':path[_0xe81c('0xad')](config[_0xe81c('0xae')],_0xe81c('0xaf'),_0x683d96[_0xe81c('0x5e')][_0xe81c('0xac')][_0x1a8103][_0xe81c('0xb0')])};}}var _0x299691={'tls':{'rejectUnauthorized':![]}};if(_[_0xe81c('0x70')](_0x41c9b6[_0xe81c('0x3f')]['service'])){if(_0x41c9b6[_0xe81c('0x3f')][_0xe81c('0x78')]){_0x299691[_0xe81c('0xb1')]={'user':_0x41c9b6[_0xe81c('0x3f')][_0xe81c('0x73')],'pass':_0x41c9b6['Smtp'][_0xe81c('0x76')]};}_0x299691['host']=_0x41c9b6['Smtp']['host'];_0x299691[_0xe81c('0x7a')]=_0x41c9b6['Smtp']['port'];_0x299691[_0xe81c('0xb2')]=_0x41c9b6[_0xe81c('0x3f')][_0xe81c('0xb2')];}else{_0x299691[_0xe81c('0x7b')]=_0x41c9b6[_0xe81c('0x3f')][_0xe81c('0x7b')];_0x299691[_0xe81c('0xb1')]={'user':_0x41c9b6['Smtp'][_0xe81c('0x73')],'pass':_0x41c9b6['Smtp']['pass']};}return respondWithRpcPromise(_0xe81c('0xb3'),'sendMail',{'account':_0x299691,'message':_0x683d96[_0xe81c('0x5e')]});}else{throw new Error(_0xe81c('0xb4'));}}})[_0xe81c('0x36')](function(_0x1127c2){if(_0x1127c2){_0x23450d=_0x1127c2;if(_0x5b9a36[_0xe81c('0xa6')]){if(_0x5b9a36[_0xe81c('0xa6')][_0xe81c('0xa7')][_0xe81c('0x4d')]){return _0x5b9a36[_0xe81c('0xa6')][_0xe81c('0xa7')][0x0];}else{return db['CmContact'][_0xe81c('0x62')](_[_0xe81c('0x1c')](_0x683d96[_0xe81c('0x5e')],{'firstName':_0x683d96[_0xe81c('0x5e')]['to'],'email':_0x683d96[_0xe81c('0x5e')]['to'],'phone':_0x683d96[_0xe81c('0x5e')]['to'],'ListId':_0x5b9a36[_0xe81c('0x6f')]}));}}else{throw new Error('List\x20not\x20found');}}})[_0xe81c('0x36')](function(_0x515c78){if(_0x515c78){var _0x570f9b={'UserId':_0x683d96[_0xe81c('0x73')]['id'],'ContactId':_0x515c78['id'],'MailAccountId':_0x5b9a36['id'],'inReplyTo':_0x23450d[_0xe81c('0xb5')],'to':_0x683d96[_0xe81c('0x5e')]['from'],'cc':_0x683d96[_0xe81c('0x5e')]['cc'],'subject':_0x683d96[_0xe81c('0x5e')][_0xe81c('0xb6')],'attach':_0x683d96[_0xe81c('0x5e')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0xe81c('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xe81c('0xb7'),'Messages':[_['merge'](_0x683d96['body'],{'messageId':_0x23450d['messageId'],'sentAt':moment()[_0xe81c('0xa1')](_0xe81c('0xa2')),'read':!![],'MailAccountId':_0x5b9a36['id'],'UserId':_0x683d96['user']['id'],'ContactId':_0x515c78['id']})]};if(_0x683d96['body'][_0xe81c('0xb8')]){_0x570f9b=_[_0xe81c('0x54')](_0x570f9b,_0x683d96['body'][_0xe81c('0xb8')]);}return db[_0xe81c('0x8b')][_0xe81c('0x62')](_0x570f9b,{'include':[{'model':db[_0xe81c('0xa3')],'as':'Messages'}]});}})[_0xe81c('0x36')](respondWithResult(_0x33b84e,null))[_0xe81c('0x2a')](handleError(_0x33b84e,null));};exports[_0xe81c('0xb9')]=function(_0x2613d6,_0x86ab40,_0x1da0c9){return db[_0xe81c('0x42')][_0xe81c('0x5d')]({'where':{'id':_0x2613d6[_0xe81c('0x59')]['id']},'include':[{'model':db[_0xe81c('0x5a')],'as':_0xe81c('0x3f'),'raw':!![]}]})[_0xe81c('0x36')](handleEntityNotFound(_0x86ab40,null))['then'](function(_0x41f102){if(_0x41f102&&_0x41f102[_0xe81c('0x3f')]){var _0x8a1c55={'id':_0x41f102['id'],'tls':{'rejectUnauthorized':![]}};if(_0x41f102[_0xe81c('0x3f')]['service']){_0x8a1c55[_0xe81c('0x7b')]=_0x41f102['Smtp']['service'];}else{_0x8a1c55[_0xe81c('0x79')]=_0x41f102[_0xe81c('0x3f')][_0xe81c('0x79')];_0x8a1c55['port']=_0x41f102[_0xe81c('0x3f')]['port'];_0x8a1c55[_0xe81c('0xb2')]=_0x41f102[_0xe81c('0x3f')][_0xe81c('0xb2')];}if(_0x41f102[_0xe81c('0x3f')][_0xe81c('0x78')]){_0x8a1c55['auth']={'user':_0x41f102['Smtp'][_0xe81c('0x73')],'pass':_0x41f102[_0xe81c('0x3f')]['pass']};}return respondWithRpcPromise(_0xe81c('0xba'),_0xe81c('0xb9'),{'account':_0x8a1c55});}})[_0xe81c('0x36')](respondWithResult(_0x86ab40,null))['catch'](handleError(_0x86ab40,null));};exports['destroy']=function(_0x4415b2,_0x4e60f5){return db[_0xe81c('0x42')][_0xe81c('0x5d')]({'where':{'id':_0x4415b2[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x4e60f5,null))[_0xe81c('0x36')](function(_0x3789b8){if(_0x3789b8&&_0x3789b8[_0xe81c('0x7b')]){throw new db[(_0xe81c('0xbb'))][(_0xe81c('0xbc'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3789b8;})[_0xe81c('0x36')](removeEntity(_0x4e60f5,null))[_0xe81c('0x2a')](handleError(_0x4e60f5,null));};exports['addAgents']=function(_0x5eeed3,_0x27f014,_0x130517){return db[_0xe81c('0x42')][_0xe81c('0x5d')]({'where':{'id':_0x5eeed3[_0xe81c('0x59')]['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x27f014,null))[_0xe81c('0x36')](function(_0x3d3ec0){if(_0x3d3ec0){return _0x3d3ec0[_0xe81c('0xbd')](_0x5eeed3['body'][_0xe81c('0x6d')],_[_0xe81c('0x8d')](_0x5eeed3[_0xe81c('0x5e')],['ids','id'])||{})[_0xe81c('0xbe')](function(_0x1d750f){for(var _0x9ef3d1=0x0;_0x9ef3d1<_0x5eeed3[_0xe81c('0x5e')][_0xe81c('0x6d')][_0xe81c('0x4d')];_0x9ef3d1+=0x1){socket[_0xe81c('0xbf')](_0xe81c('0xc0'),{'UserId':Number(_0x5eeed3['body'][_0xe81c('0x6d')][_0x9ef3d1]),'MailAccountId':Number(_0x5eeed3['params']['id'])});}return _0x1d750f;});}})['then'](respondWithResult(_0x27f014,null))[_0xe81c('0x2a')](handleError(_0x27f014,null));};exports['removeAgents']=function(_0x2acd82,_0x25c5bc,_0x4ab66c){return db[_0xe81c('0x42')]['find']({'where':{'id':_0x2acd82[_0xe81c('0x59')]['id']}})['then'](handleEntityNotFound(_0x25c5bc,null))[_0xe81c('0x36')](function(_0xf0c8f0){if(_0xf0c8f0){return _0xf0c8f0['removeAgents'](_0x2acd82['query'][_0xe81c('0x6d')])[_0xe81c('0x36')](function(){if(_[_0xe81c('0xc1')](_0x2acd82[_0xe81c('0x47')][_0xe81c('0x6d')])){for(var _0x529576=0x0;_0x529576<_0x2acd82[_0xe81c('0x47')][_0xe81c('0x6d')][_0xe81c('0x4d')];_0x529576+=0x1){socket['emit'](_0xe81c('0xc2'),{'UserId':Number(_0x2acd82['query'][_0xe81c('0x6d')][_0x529576]),'MailAccountId':Number(_0x2acd82[_0xe81c('0x59')]['id'])});}}else{socket[_0xe81c('0xbf')]('userMailAccount:remove',{'UserId':Number(_0x2acd82[_0xe81c('0x47')][_0xe81c('0x6d')]),'MailAccountId':Number(_0x2acd82[_0xe81c('0x59')]['id'])});}});}})[_0xe81c('0x36')](respondWithStatusCode(_0x25c5bc,null))[_0xe81c('0x2a')](handleError(_0x25c5bc,null));};exports['getAgents']=function(_0x39214f,_0x9219b6,_0x3d7c5e){var _0xe71f58={};var _0x268d1c={};var _0x5e3b8a;var _0x664149;return db['MailAccount'][_0xe81c('0x6a')]({'where':{'id':_0x39214f['params']['id']}})[_0xe81c('0x36')](handleEntityNotFound(_0x9219b6,null))['then'](function(_0x5a6d98){if(_0x5a6d98){_0x5e3b8a=_0x5a6d98;_0x268d1c[_0xe81c('0x46')]=_[_0xe81c('0x48')](db[_0xe81c('0xc3')][_0xe81c('0x43')]);_0x268d1c['query']=_[_0xe81c('0x48')](_0x39214f[_0xe81c('0x47')]);_0x268d1c['filters']=_[_0xe81c('0x4a')](_0x268d1c['model'],_0x268d1c[_0xe81c('0x47')]);_0xe71f58[_0xe81c('0x4b')]=_['intersection'](_0x268d1c[_0xe81c('0x46')],qs[_0xe81c('0x4c')](_0x39214f[_0xe81c('0x47')][_0xe81c('0x4c')]));_0xe71f58[_0xe81c('0x4b')]=_0xe71f58[_0xe81c('0x4b')][_0xe81c('0x4d')]?_0xe71f58['attributes']:_0x268d1c[_0xe81c('0x46')];_0xe71f58[_0xe81c('0x50')]=qs['sort'](_0x39214f[_0xe81c('0x47')][_0xe81c('0x51')]);_0xe71f58[_0xe81c('0x53')]=qs[_0xe81c('0x49')](_[_0xe81c('0x52')](_0x39214f[_0xe81c('0x47')],_0x268d1c[_0xe81c('0x49')]));if(_0x39214f[_0xe81c('0x47')]['filter']){_0xe71f58[_0xe81c('0x53')]=_[_0xe81c('0x54')](_0xe71f58[_0xe81c('0x53')],{'$or':_[_0xe81c('0x41')](_0xe71f58['attributes'],function(_0x57a6b3){var _0x4bf0b0={};_0x4bf0b0[_0x57a6b3]={'$like':'%'+_0x39214f[_0xe81c('0x47')][_0xe81c('0x65')]+'%'};return _0x4bf0b0;})});}_0xe71f58=_[_0xe81c('0x54')]({},_0xe71f58,_0x39214f[_0xe81c('0x56')]);return _0x5e3b8a['getAgents'](_0xe71f58);}})[_0xe81c('0x36')](function(_0x419631){if(_0x419631){_0x664149=_0x419631[_0xe81c('0x4d')];if(!_0x39214f[_0xe81c('0x47')]['hasOwnProperty'](_0xe81c('0x4f'))){_0xe71f58[_0xe81c('0x30')]=qs['limit'](_0x39214f[_0xe81c('0x47')][_0xe81c('0x30')]);_0xe71f58[_0xe81c('0x2e')]=qs[_0xe81c('0x2e')](_0x39214f['query']['offset']);}return _0x5e3b8a[_0xe81c('0xc4')](_0xe71f58);}})[_0xe81c('0x36')](function(_0x39cb01){if(_0x39cb01){return _0x39cb01?{'count':_0x664149,'rows':_0x39cb01}:null;}})[_0xe81c('0x36')](respondWithResult(_0x9219b6,null))[_0xe81c('0x2a')](handleError(_0x9219b6,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 0dbae2a..2e855d1 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 _0x722c=['save','update','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x722c,0x1e4));var _0xc722=function(_0x272448,_0x723491){_0x272448=_0x272448-0x0;var _0x2f075b=_0x722c[_0x272448];return _0x2f075b;};'use strict';var EventEmitter=require(_0xc722('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xc722('0x1')](0x0);var events={'afterCreate':_0xc722('0x2'),'afterUpdate':_0xc722('0x3'),'afterDestroy':_0xc722('0x4')};function emitEvent(_0x428d68){return function(_0x5ae56b,_0x4e4541,_0x5b9487){MailAccountEvents['emit'](_0x428d68+':'+_0x5ae56b['id'],_0x5ae56b);MailAccountEvents[_0xc722('0x5')](_0x428d68,_0x5ae56b);_0x5b9487(null);};}for(var e in events){if(events[_0xc722('0x6')](e)){var event=events[e];MailAccount[_0xc722('0x7')](e,emitEvent(event));}}module[_0xc722('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xee3c=['events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xee3c,0x14a));var _0xcee3=function(_0x1b2345,_0x5f5d56){_0x1b2345=_0x1b2345-0x0;var _0x27bcc6=_0xee3c[_0x1b2345];return _0x27bcc6;};'use strict';var EventEmitter=require(_0xcee3('0x0'));var MailAccount=require(_0xcee3('0x1'))['db'][_0xcee3('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xcee3('0x3')](0x0);var events={'afterCreate':_0xcee3('0x4'),'afterUpdate':_0xcee3('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4a7681){return function(_0x435892,_0x4cd398,_0x39d2a8){MailAccountEvents[_0xcee3('0x6')](_0x4a7681+':'+_0x435892['id'],_0x435892);MailAccountEvents[_0xcee3('0x6')](_0x4a7681,_0x435892);_0x39d2a8(null);};}for(var e in events){if(events[_0xcee3('0x7')](e)){var event=events[e];MailAccount[_0xcee3('0x8')](e,emitEvent(event));}}module[_0xcee3('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 6f9f3d5..de60d00 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 _0xbb36=['rimraf','../../config/environment','./mailAccount.attributes','MailAccount','lodash','moment','bluebird','request-promise','path'];(function(_0x346924,_0x1b6461){var _0x2d1718=function(_0x11c81d){while(--_0x11c81d){_0x346924['push'](_0x346924['shift']());}};_0x2d1718(++_0x1b6461);}(_0xbb36,0xaf));var _0x6bb3=function(_0x324a33,_0xa395f1){_0x324a33=_0x324a33-0x0;var _0x281322=_0xbb36[_0x324a33];return _0x281322;};'use strict';var _=require(_0x6bb3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6bb3('0x1'));var BPromise=require(_0x6bb3('0x2'));var rp=require(_0x6bb3('0x3'));var fs=require('fs');var path=require(_0x6bb3('0x4'));var rimraf=require(_0x6bb3('0x5'));var config=require(_0x6bb3('0x6'));var attributes=require(_0x6bb3('0x7'));module['exports']=function(_0x5a26f9,_0x1968dc){return _0x5a26f9['define'](_0x6bb3('0x8'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dd5=['exports','define','mail_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./mailAccount.attributes'];(function(_0x48472a,_0x1bc83e){var _0x4f0858=function(_0x1dac10){while(--_0x1dac10){_0x48472a['push'](_0x48472a['shift']());}};_0x4f0858(++_0x1bc83e);}(_0x7dd5,0x179));var _0x57dd=function(_0x1c5bb8,_0x5a14fd){_0x1c5bb8=_0x1c5bb8-0x0;var _0x167fe3=_0x7dd5[_0x1c5bb8];return _0x167fe3;};'use strict';var _=require(_0x57dd('0x0'));var util=require(_0x57dd('0x1'));var logger=require(_0x57dd('0x2'))('api');var moment=require(_0x57dd('0x3'));var BPromise=require('bluebird');var rp=require(_0x57dd('0x4'));var fs=require('fs');var path=require(_0x57dd('0x5'));var rimraf=require(_0x57dd('0x6'));var config=require('../../config/environment');var attributes=require(_0x57dd('0x7'));module[_0x57dd('0x8')]=function(_0x5855f5,_0x21fc41){return _0x5855f5[_0x57dd('0x9')]('MailAccount',attributes,{'tableName':_0x57dd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index f00e287..922c800 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 _0x17b0=['mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','account','CmList','List','Contacts','DESC','MailApplication','Applications','Smtp','get','omit','applications','priority','push','length','close','autoclose','*,*,*,*','create','List\x20not\x20found','contact','messageId','attach','format','YYYY-MM-DD\x20HH:mm:ss','find','MailMessage','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','subject','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','Attachments','UserId','agent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','findAll','options','where','map','include','model','attributes','then','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','from','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes'];(function(_0x6952e2,_0x3ca4a6){var _0xb1c46d=function(_0x37c5ca){while(--_0x37c5ca){_0x6952e2['push'](_0x6952e2['shift']());}};_0xb1c46d(++_0x3ca4a6);}(_0x17b0,0x97));var _0x017b=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x17b0[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x017b('0x0'));var util=require('util');var moment=require(_0x017b('0x1'));var BPromise=require(_0x017b('0x2'));var rs=require(_0x017b('0x3'));var fs=require('fs');var Redis=require(_0x017b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x017b('0x5'));var logger=require(_0x017b('0x6'))(_0x017b('0x7'));var config=require(_0x017b('0x8'));var jayson=require(_0x017b('0x9'));var client=jayson[_0x017b('0xa')][_0x017b('0xb')]({'port':0x232c});config[_0x017b('0xc')]=_[_0x017b('0xd')](config[_0x017b('0xc')],{'host':_0x017b('0xe'),'port':0x18eb});var socket=require(_0x017b('0xf'))(new Redis(config[_0x017b('0xc')]));require(_0x017b('0x10'))[_0x017b('0x11')](socket);function respondWithRpcPromise(_0x3dbde6,_0x4d031b,_0x488202){return new BPromise(function(_0x5e06fc,_0x458024){return client[_0x017b('0x12')](_0x3dbde6,_0x488202)['then'](function(_0x1cf291){logger[_0x017b('0x13')](_0x017b('0x14'),_0x4d031b,_0x017b('0x15'));logger[_0x017b('0x16')](_0x017b('0x17'),_0x4d031b,_0x017b('0x15'),JSON[_0x017b('0x18')](_0x1cf291));if(_0x1cf291[_0x017b('0x19')]){if(_0x1cf291[_0x017b('0x19')]['code']===0x1f4){logger[_0x017b('0x19')](_0x017b('0x14'),_0x4d031b,_0x1cf291[_0x017b('0x19')]['message']);return _0x458024(_0x1cf291['error']['message']);}logger['error'](_0x017b('0x14'),_0x4d031b,_0x1cf291['error'][_0x017b('0x1a')]);return _0x5e06fc(_0x1cf291[_0x017b('0x19')][_0x017b('0x1a')]);}else{logger[_0x017b('0x13')](_0x017b('0x14'),_0x4d031b,'request\x20sent');_0x5e06fc(_0x1cf291[_0x017b('0x1b')]['message']);}})[_0x017b('0x1c')](function(_0x3a8b70){logger['error'](_0x017b('0x14'),_0x4d031b,_0x3a8b70);_0x458024(_0x3a8b70);});});}exports[_0x017b('0x1d')]=function(_0x12c502){var _0x2dc6bd=this;return new Promise(function(_0x33972a,_0x2c100a){return db['MailAccount'][_0x017b('0x1e')]({'raw':_0x12c502[_0x017b('0x1f')]?_0x12c502['options']['raw']===undefined?!![]:![]:!![],'where':_0x12c502['options']?_0x12c502[_0x017b('0x1f')][_0x017b('0x20')]||null:null,'attributes':_0x12c502['options']?_0x12c502['options']['attributes']||null:null,'limit':_0x12c502[_0x017b('0x1f')]?_0x12c502[_0x017b('0x1f')]['limit']||null:null,'include':_0x12c502['options']?_0x12c502[_0x017b('0x1f')]['include']?_[_0x017b('0x21')](_0x12c502[_0x017b('0x1f')][_0x017b('0x22')],function(_0x1d473b){return{'model':db[_0x1d473b[_0x017b('0x23')]],'as':_0x1d473b['as'],'attributes':_0x1d473b[_0x017b('0x24')],'include':_0x1d473b[_0x017b('0x22')]?_['map'](_0x1d473b[_0x017b('0x22')],function(_0x4815ce){return{'model':db[_0x4815ce['model']],'as':_0x4815ce['as'],'attributes':_0x4815ce[_0x017b('0x24')],'include':_0x4815ce['include']?_[_0x017b('0x21')](_0x4815ce[_0x017b('0x22')],function(_0x171d13){return{'model':db[_0x171d13[_0x017b('0x23')]],'as':_0x171d13['as'],'attributes':_0x171d13[_0x017b('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x14b3dd){logger[_0x017b('0x13')](_0x017b('0x1d'),_0x12c502);logger[_0x017b('0x16')](_0x017b('0x1d'),_0x12c502,JSON['stringify'](_0x14b3dd));_0x33972a(_0x14b3dd);})[_0x017b('0x1c')](function(_0x5d4b94){logger[_0x017b('0x19')](_0x017b('0x1d'),_0x5d4b94[_0x017b('0x1a')],_0x12c502);_0x2c100a(_0x2dc6bd['error'](0x1f4,_0x5d4b94[_0x017b('0x1a')]));});});};exports['ShowMailAccount']=function(_0x2037c3){var _0x186343=this;return new Promise(function(_0x14c8e0,_0x33cb0e){return db['MailAccount']['find']({'raw':_0x2037c3[_0x017b('0x1f')]?_0x2037c3[_0x017b('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2037c3[_0x017b('0x1f')]?_0x2037c3['options'][_0x017b('0x20')]||null:null,'attributes':_0x2037c3['options']?_0x2037c3[_0x017b('0x1f')]['attributes']||null:null,'include':_0x2037c3[_0x017b('0x1f')]?_0x2037c3['options']['include']?_[_0x017b('0x21')](_0x2037c3['options'][_0x017b('0x22')],function(_0x63f5cb){return{'model':db[_0x63f5cb[_0x017b('0x23')]],'as':_0x63f5cb['as'],'attributes':_0x63f5cb[_0x017b('0x24')],'include':_0x63f5cb['include']?_[_0x017b('0x21')](_0x63f5cb[_0x017b('0x22')],function(_0x564339){return{'model':db[_0x564339[_0x017b('0x23')]],'as':_0x564339['as'],'attributes':_0x564339[_0x017b('0x24')],'include':_0x564339[_0x017b('0x22')]?_[_0x017b('0x21')](_0x564339[_0x017b('0x22')],function(_0x262c66){return{'model':db[_0x262c66['model']],'as':_0x262c66['as'],'attributes':_0x262c66['attributes']};}):[]};}):[]};}):[]:[]})[_0x017b('0x25')](function(_0x409c98){logger[_0x017b('0x13')]('ShowMailAccount',_0x2037c3);logger[_0x017b('0x16')](_0x017b('0x26'),_0x2037c3,JSON[_0x017b('0x18')](_0x409c98));_0x14c8e0(_0x409c98);})[_0x017b('0x1c')](function(_0x346823){logger['error'](_0x017b('0x26'),_0x346823[_0x017b('0x1a')],_0x2037c3);_0x33cb0e(_0x186343['error'](0x1f4,_0x346823['message']));});});};exports[_0x017b('0x27')]=function(_0x58e674){var _0x3a4502=this;return new Promise(function(_0x5d1d4b,_0x4fed35){var _0x2764a4={'body':_0x58e674[_0x017b('0x28')],'channel':_0x017b('0x29')};var _0x2e23a1=_[_0x017b('0x2a')](_[_0x017b('0x2b')](db[_0x017b('0x2c')]['rawAttributes']),[_0x017b('0x2d'),_0x017b('0x2e'),_0x017b('0x2f'),_0x017b('0x30')]);var _0x301f5e=![];if(_0x58e674[_0x017b('0x28')]['id']){delete _0x58e674[_0x017b('0x28')]['id'];}if(_['isNil'](_0x58e674[_0x017b('0x28')][_0x017b('0x31')])){return _0x4fed35(_0x3a4502[_0x017b('0x19')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x017b('0x32')](_0x58e674[_0x017b('0x28')]['body'])||_0x58e674['body']['body']===''){return _0x4fed35(_0x3a4502[_0x017b('0x19')](0x1f4,_0x017b('0x33')));}if(_[_0x017b('0x32')](_0x58e674['body'][_0x017b('0x34')])){return _0x4fed35(_0x3a4502[_0x017b('0x19')](0x1f4,_0x017b('0x35')+_0x2e23a1));}if(!_[_0x017b('0x36')](_0x2e23a1,_0x58e674[_0x017b('0x28')][_0x017b('0x34')])){return _0x4fed35(_0x3a4502[_0x017b('0x19')](0x1f4,_0x017b('0x37')+_0x2e23a1));}var _0x5a0067={};_0x5a0067[_0x58e674[_0x017b('0x28')][_0x017b('0x34')]]=_0x58e674['body']['from'];return db[_0x017b('0x38')]['find']({'where':{'id':_0x58e674[_0x017b('0x39')]['id']},'include':[{'model':db[_0x017b('0x3a')],'as':_0x017b('0x3b'),'include':[{'model':db[_0x017b('0x2c')],'as':_0x017b('0x3c'),'where':_0x5a0067,'limit':0x1,'order':[['updatedAt',_0x017b('0x3d')]]}]},{'model':db[_0x017b('0x3e')],'as':_0x017b('0x3f')},{'model':db['MailServerOut'],'as':_0x017b('0x40')}]})['then'](function(_0x24654a){if(_0x24654a&&_0x24654a['List']){var _0x1ea5a4=_0x24654a[_0x017b('0x41')]({'plain':!![]});_0x2764a4[_0x017b('0x39')]=_[_0x017b('0x42')](_0x1ea5a4,[_0x017b('0x3f'),_0x017b('0x3b')]);_0x2764a4[_0x017b('0x43')]=_0x1ea5a4[_0x017b('0x3f')];_0x2764a4['list']=_0x1ea5a4['List'];_0x2764a4[_0x017b('0x43')]=_['orderBy'](_0x2764a4['applications'],[_0x017b('0x44')],['asc']);if(_0x2764a4[_0x017b('0x39')]&&_0x2764a4[_0x017b('0x39')]['autoclose']){_0x2764a4[_0x017b('0x43')][_0x017b('0x45')]({'id':0x0,'priority':_0x2764a4[_0x017b('0x43')][_0x017b('0x46')]+0x1,'app':_0x017b('0x47'),'appdata':_0x017b('0x48'),'interval':_0x017b('0x49')});}if(_0x2764a4[_0x017b('0x39')][_0x017b('0x3f')]){delete _0x2764a4[_0x017b('0x39')][_0x017b('0x3f')];}if(_0x2764a4[_0x017b('0x39')][_0x017b('0x3b')]){delete _0x2764a4[_0x017b('0x39')][_0x017b('0x3b')];}if(_0x1ea5a4[_0x017b('0x3b')][_0x017b('0x3c')][_0x017b('0x46')]){return _0x1ea5a4[_0x017b('0x3b')][_0x017b('0x3c')][0x0];}var _0xe92639=_[_0x017b('0xd')](_0x58e674[_0x017b('0x28')],{'firstName':_0x58e674[_0x017b('0x28')]['from'],'ListId':_0x1ea5a4[_0x017b('0x30')]});_0xe92639[_0x58e674[_0x017b('0x28')][_0x017b('0x34')]]=_0x58e674[_0x017b('0x28')][_0x017b('0x31')];return db[_0x017b('0x2c')][_0x017b('0x4a')](_0xe92639);}else{throw new Error(_0x017b('0x4b'));}})['then'](function(_0x593cce){_0x2764a4[_0x017b('0x4c')]=_0x593cce;if(_0x593cce){if(!_0x58e674[_0x017b('0x28')]['message']['messageId']){_0x58e674['body'][_0x017b('0x1a')]['messageId']=rs['generate']()+'\x20'+_0x58e674[_0x017b('0x28')][_0x017b('0x1a')][_0x017b('0x31')];}var _0x2e81d2={'ContactId':_0x593cce['id'],'MailAccountId':_0x58e674['account']['id'],'inReplyTo':_0x58e674['body'][_0x017b('0x1a')][_0x017b('0x4d')],'to':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')]['from'],'cc':_0x58e674['body'][_0x017b('0x1a')]['cc'],'subject':_0x58e674[_0x017b('0x28')]['message']['subject'],'attach':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')][_0x017b('0x4e')],'lastMsgAt':moment()[_0x017b('0x4f')](_0x017b('0x50')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x017b('0x51')]({'where':{'closed':![],'MailAccountId':_0x58e674[_0x017b('0x39')]['id']},'include':[{'model':db[_0x017b('0x52')],'as':'Messages','attributes':[_0x017b('0x4d')],'where':{'messageId':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')][_0x017b('0x53')]}}]})[_0x017b('0x25')](function(_0x11eb2e){if(_0x11eb2e){return[_0x11eb2e,![]];}return db[_0x017b('0x54')]['create'](_0x2e81d2)[_0x017b('0x25')](function(_0x4ff460){return[_0x4ff460,!![]];});});}else{throw new Error(_0x017b('0x55'));}})[_0x017b('0x56')](function(_0x48b491,_0x524170){if(_0x48b491){_0x301f5e=_0x524170;if(!_0x524170){return _0x48b491['update']({'inReplyTo':_0x58e674[_0x017b('0x28')]['message'][_0x017b('0x4d')],'to':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')]['from'],'cc':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')]['cc'],'subject':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')][_0x017b('0x57')],'attach':_0x48b491[_0x017b('0x4e')]?_0x48b491[_0x017b('0x4e')]:_0x58e674[_0x017b('0x28')][_0x017b('0x1a')]['attach'],'substatus':null,'substatusAt':moment()[_0x017b('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0x017b('0x50')),'lastMsgDirection':'in'});}else{return _0x48b491;}}})['then'](function(_0x34dbb3){_0x2764a4[_0x017b('0x58')]=_0x34dbb3['get']({'plain':!![]});_0x2764a4[_0x017b('0x58')][_0x017b('0x59')]=_0x301f5e;return db[_0x017b('0x52')][_0x017b('0x4a')]({'body':_0x58e674[_0x017b('0x28')][_0x017b('0x28')],'MailAccountId':_0x58e674['account']['id'],'MailInteractionId':_0x34dbb3['id'],'direction':'in','ContactId':_0x2764a4[_0x017b('0x4c')]['id'],'messageId':_0x58e674[_0x017b('0x28')]['message']['messageId'],'from':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')][_0x017b('0x31')],'to':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')]['to'],'cc':_0x58e674[_0x017b('0x28')]['message']['cc'],'subject':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')][_0x017b('0x57')],'attach':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')][_0x017b('0x4e')],'Attachments':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')][_0x017b('0x5a')],'originTo':_0x58e674[_0x017b('0x28')]['message'][_0x017b('0x5b')],'originCc':_0x58e674['body'][_0x017b('0x1a')][_0x017b('0x5c')],'bcc':_0x58e674['body'][_0x017b('0x1a')][_0x017b('0x5d')],'ChatWebsiteId':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')][_0x017b('0x5e')]||null,'originChannel':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')][_0x017b('0x5f')]||_0x017b('0x60'),'ChatOfflineMessageId':_0x58e674[_0x017b('0x28')][_0x017b('0x1a')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x017b('0x61')],'as':_0x017b('0x62')}]});})[_0x017b('0x25')](function(_0x25e0b2){_0x2764a4['message']=_0x25e0b2;if(_0x2764a4[_0x017b('0x58')][_0x017b('0x63')]){return db['User'][_0x017b('0x51')]({'attributes':['id','name'],'where':{'id':_0x2764a4['interaction'][_0x017b('0x63')]}})[_0x017b('0x25')](function(_0x31139f){if(_0x31139f){_0x2764a4[_0x017b('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':_0x017b('0x64'),'appdata':_0x31139f['name']+','+(_0x2764a4['account']['waitForTheAssignedAgent']||0xa),'interval':_0x017b('0x49')});}return respondWithRpcPromise(_0x017b('0x65'),_0x017b('0x66'),_0x2764a4);});}return respondWithRpcPromise('Start',_0x017b('0x66'),_0x2764a4);})[_0x017b('0x25')](function(_0x5a8d15){_0x5d1d4b(_0x5a8d15);})['catch'](function(_0x2f747a){_0x4fed35(_0x3a4502[_0x017b('0x19')](0x1f4,_0x2f747a['message']));});});}; \ No newline at end of file +var _0x7bc8=['spread','YYYY-MM-DD\x20HH:mm:ss','interaction','get','created','MailMessage','attachments','originTo','originCc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','startRouting','Start','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','options','raw','attributes','limit','include','map','model','GetMailAccount','MailAccount','find','where','ShowMailAccount','catch','NotifyMailAccount','body','mail','difference','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','then','applications','list','orderBy','asc','push','close','autoclose','*,*,*,*','length','contact','generate','messageId','subject','attach','format','MailInteraction','Messages','inReplyTo','create'];(function(_0x32e079,_0x4ce862){var _0x15a582=function(_0x5e64ed){while(--_0x5e64ed){_0x32e079['push'](_0x32e079['shift']());}};_0x15a582(++_0x4ce862);}(_0x7bc8,0x7d));var _0x87bc=function(_0x5b78fe,_0x44542c){_0x5b78fe=_0x5b78fe-0x0;var _0x24ac3c=_0x7bc8[_0x5b78fe];return _0x24ac3c;};'use strict';var _=require('lodash');var util=require(_0x87bc('0x0'));var moment=require(_0x87bc('0x1'));var BPromise=require(_0x87bc('0x2'));var rs=require(_0x87bc('0x3'));var fs=require('fs');var Redis=require(_0x87bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x87bc('0x5'));var logger=require(_0x87bc('0x6'))(_0x87bc('0x7'));var config=require(_0x87bc('0x8'));var jayson=require(_0x87bc('0x9'));var client=jayson[_0x87bc('0xa')][_0x87bc('0xb')]({'port':0x232c});config[_0x87bc('0xc')]=_[_0x87bc('0xd')](config['redis'],{'host':_0x87bc('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87bc('0xc')]));require(_0x87bc('0xf'))[_0x87bc('0x10')](socket);function respondWithRpcPromise(_0x513aa4,_0x4cdcaf,_0x638663){return new BPromise(function(_0x1f55b9,_0x3d037a){return client[_0x87bc('0x11')](_0x513aa4,_0x638663)['then'](function(_0x4daf80){logger[_0x87bc('0x12')](_0x87bc('0x13'),_0x4cdcaf,_0x87bc('0x14'));logger[_0x87bc('0x15')](_0x87bc('0x16'),_0x4cdcaf,_0x87bc('0x14'),JSON[_0x87bc('0x17')](_0x4daf80));if(_0x4daf80[_0x87bc('0x18')]){if(_0x4daf80[_0x87bc('0x18')][_0x87bc('0x19')]===0x1f4){logger['error'](_0x87bc('0x13'),_0x4cdcaf,_0x4daf80[_0x87bc('0x18')][_0x87bc('0x1a')]);return _0x3d037a(_0x4daf80['error'][_0x87bc('0x1a')]);}logger[_0x87bc('0x18')](_0x87bc('0x13'),_0x4cdcaf,_0x4daf80[_0x87bc('0x18')][_0x87bc('0x1a')]);return _0x1f55b9(_0x4daf80[_0x87bc('0x18')][_0x87bc('0x1a')]);}else{logger[_0x87bc('0x12')](_0x87bc('0x13'),_0x4cdcaf,_0x87bc('0x14'));_0x1f55b9(_0x4daf80['result']['message']);}})['catch'](function(_0x5af837){logger['error'](_0x87bc('0x13'),_0x4cdcaf,_0x5af837);_0x3d037a(_0x5af837);});});}exports['GetMailAccount']=function(_0x4f5f1c){var _0x48c012=this;return new Promise(function(_0x3690ca,_0x24f6e2){return db['MailAccount']['findAll']({'raw':_0x4f5f1c[_0x87bc('0x1b')]?_0x4f5f1c[_0x87bc('0x1b')][_0x87bc('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f5f1c['options']?_0x4f5f1c['options']['where']||null:null,'attributes':_0x4f5f1c[_0x87bc('0x1b')]?_0x4f5f1c[_0x87bc('0x1b')][_0x87bc('0x1d')]||null:null,'limit':_0x4f5f1c['options']?_0x4f5f1c[_0x87bc('0x1b')][_0x87bc('0x1e')]||null:null,'include':_0x4f5f1c[_0x87bc('0x1b')]?_0x4f5f1c[_0x87bc('0x1b')][_0x87bc('0x1f')]?_[_0x87bc('0x20')](_0x4f5f1c[_0x87bc('0x1b')]['include'],function(_0x3dd23f){return{'model':db[_0x3dd23f[_0x87bc('0x21')]],'as':_0x3dd23f['as'],'attributes':_0x3dd23f[_0x87bc('0x1d')],'include':_0x3dd23f['include']?_['map'](_0x3dd23f[_0x87bc('0x1f')],function(_0x154b45){return{'model':db[_0x154b45['model']],'as':_0x154b45['as'],'attributes':_0x154b45[_0x87bc('0x1d')],'include':_0x154b45[_0x87bc('0x1f')]?_['map'](_0x154b45['include'],function(_0x1f1e2a){return{'model':db[_0x1f1e2a[_0x87bc('0x21')]],'as':_0x1f1e2a['as'],'attributes':_0x1f1e2a[_0x87bc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a90f3){logger[_0x87bc('0x12')](_0x87bc('0x22'),_0x4f5f1c);logger[_0x87bc('0x15')](_0x87bc('0x22'),_0x4f5f1c,JSON[_0x87bc('0x17')](_0x2a90f3));_0x3690ca(_0x2a90f3);})['catch'](function(_0x2780ff){logger['error']('GetMailAccount',_0x2780ff[_0x87bc('0x1a')],_0x4f5f1c);_0x24f6e2(_0x48c012[_0x87bc('0x18')](0x1f4,_0x2780ff[_0x87bc('0x1a')]));});});};exports['ShowMailAccount']=function(_0x14b49e){var _0x40d5bd=this;return new Promise(function(_0x31fee1,_0x34aa74){return db[_0x87bc('0x23')][_0x87bc('0x24')]({'raw':_0x14b49e['options']?_0x14b49e[_0x87bc('0x1b')][_0x87bc('0x1c')]===undefined?!![]:![]:!![],'where':_0x14b49e['options']?_0x14b49e['options'][_0x87bc('0x25')]||null:null,'attributes':_0x14b49e[_0x87bc('0x1b')]?_0x14b49e[_0x87bc('0x1b')][_0x87bc('0x1d')]||null:null,'include':_0x14b49e[_0x87bc('0x1b')]?_0x14b49e[_0x87bc('0x1b')][_0x87bc('0x1f')]?_[_0x87bc('0x20')](_0x14b49e[_0x87bc('0x1b')][_0x87bc('0x1f')],function(_0x3f4ba0){return{'model':db[_0x3f4ba0[_0x87bc('0x21')]],'as':_0x3f4ba0['as'],'attributes':_0x3f4ba0['attributes'],'include':_0x3f4ba0[_0x87bc('0x1f')]?_['map'](_0x3f4ba0[_0x87bc('0x1f')],function(_0x3b7b3c){return{'model':db[_0x3b7b3c[_0x87bc('0x21')]],'as':_0x3b7b3c['as'],'attributes':_0x3b7b3c[_0x87bc('0x1d')],'include':_0x3b7b3c[_0x87bc('0x1f')]?_['map'](_0x3b7b3c['include'],function(_0x33c1dd){return{'model':db[_0x33c1dd[_0x87bc('0x21')]],'as':_0x33c1dd['as'],'attributes':_0x33c1dd[_0x87bc('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44afba){logger['info']('ShowMailAccount',_0x14b49e);logger['debug'](_0x87bc('0x26'),_0x14b49e,JSON[_0x87bc('0x17')](_0x44afba));_0x31fee1(_0x44afba);})[_0x87bc('0x27')](function(_0x3d9849){logger[_0x87bc('0x18')](_0x87bc('0x26'),_0x3d9849['message'],_0x14b49e);_0x34aa74(_0x40d5bd[_0x87bc('0x18')](0x1f4,_0x3d9849['message']));});});};exports[_0x87bc('0x28')]=function(_0x38b333){var _0x56340c=this;return new Promise(function(_0x36c6ff,_0x2a0238){var _0x4a86ef={'body':_0x38b333[_0x87bc('0x29')],'channel':_0x87bc('0x2a')};var _0x10d516=_[_0x87bc('0x2b')](_['keys'](db[_0x87bc('0x2c')]['rawAttributes']),[_0x87bc('0x2d'),_0x87bc('0x2e'),_0x87bc('0x2f'),_0x87bc('0x30')]);var _0x16dc7e=![];if(_0x38b333[_0x87bc('0x29')]['id']){delete _0x38b333[_0x87bc('0x29')]['id'];}if(_[_0x87bc('0x31')](_0x38b333[_0x87bc('0x29')][_0x87bc('0x32')])){return _0x2a0238(_0x56340c[_0x87bc('0x18')](0x1f4,_0x87bc('0x33')));}if(_['isNil'](_0x38b333['body'][_0x87bc('0x29')])||_0x38b333[_0x87bc('0x29')][_0x87bc('0x29')]===''){return _0x2a0238(_0x56340c[_0x87bc('0x18')](0x1f4,_0x87bc('0x34')));}if(_[_0x87bc('0x31')](_0x38b333[_0x87bc('0x29')][_0x87bc('0x35')])){return _0x2a0238(_0x56340c[_0x87bc('0x18')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x10d516));}if(!_['includes'](_0x10d516,_0x38b333[_0x87bc('0x29')][_0x87bc('0x35')])){return _0x2a0238(_0x56340c[_0x87bc('0x18')](0x1f4,_0x87bc('0x36')+_0x10d516));}var _0x406ae8={};_0x406ae8[_0x38b333[_0x87bc('0x29')][_0x87bc('0x35')]]=_0x38b333[_0x87bc('0x29')][_0x87bc('0x32')];return db[_0x87bc('0x23')][_0x87bc('0x24')]({'where':{'id':_0x38b333[_0x87bc('0x37')]['id']},'include':[{'model':db[_0x87bc('0x38')],'as':_0x87bc('0x39'),'include':[{'model':db[_0x87bc('0x2c')],'as':_0x87bc('0x3a'),'where':_0x406ae8,'limit':0x1,'order':[[_0x87bc('0x2e'),_0x87bc('0x3b')]]}]},{'model':db[_0x87bc('0x3c')],'as':_0x87bc('0x3d')},{'model':db[_0x87bc('0x3e')],'as':'Smtp'}]})[_0x87bc('0x3f')](function(_0x2f1120){if(_0x2f1120&&_0x2f1120[_0x87bc('0x39')]){var _0x6e46b4=_0x2f1120['get']({'plain':!![]});_0x4a86ef[_0x87bc('0x37')]=_['omit'](_0x6e46b4,[_0x87bc('0x3d'),'List']);_0x4a86ef[_0x87bc('0x40')]=_0x6e46b4[_0x87bc('0x3d')];_0x4a86ef[_0x87bc('0x41')]=_0x6e46b4[_0x87bc('0x39')];_0x4a86ef[_0x87bc('0x40')]=_[_0x87bc('0x42')](_0x4a86ef[_0x87bc('0x40')],['priority'],[_0x87bc('0x43')]);if(_0x4a86ef[_0x87bc('0x37')]&&_0x4a86ef[_0x87bc('0x37')]['autoclose']){_0x4a86ef[_0x87bc('0x40')][_0x87bc('0x44')]({'id':0x0,'priority':_0x4a86ef[_0x87bc('0x40')]['length']+0x1,'app':_0x87bc('0x45'),'appdata':_0x87bc('0x46'),'interval':_0x87bc('0x47')});}if(_0x4a86ef['account'][_0x87bc('0x3d')]){delete _0x4a86ef['account'][_0x87bc('0x3d')];}if(_0x4a86ef[_0x87bc('0x37')][_0x87bc('0x39')]){delete _0x4a86ef[_0x87bc('0x37')][_0x87bc('0x39')];}if(_0x6e46b4[_0x87bc('0x39')][_0x87bc('0x3a')][_0x87bc('0x48')]){return _0x6e46b4['List']['Contacts'][0x0];}var _0x1e0c71=_[_0x87bc('0xd')](_0x38b333[_0x87bc('0x29')],{'firstName':_0x38b333['body'][_0x87bc('0x32')],'ListId':_0x6e46b4[_0x87bc('0x30')]});_0x1e0c71[_0x38b333['body'][_0x87bc('0x35')]]=_0x38b333['body'][_0x87bc('0x32')];return db['CmContact']['create'](_0x1e0c71);}else{throw new Error('List\x20not\x20found');}})[_0x87bc('0x3f')](function(_0x46e90f){_0x4a86ef[_0x87bc('0x49')]=_0x46e90f;if(_0x46e90f){if(!_0x38b333[_0x87bc('0x29')]['message']['messageId']){_0x38b333[_0x87bc('0x29')][_0x87bc('0x1a')]['messageId']=rs[_0x87bc('0x4a')]()+'\x20'+_0x38b333[_0x87bc('0x29')]['message'][_0x87bc('0x32')];}var _0x349a7d={'ContactId':_0x46e90f['id'],'MailAccountId':_0x38b333[_0x87bc('0x37')]['id'],'inReplyTo':_0x38b333['body'][_0x87bc('0x1a')][_0x87bc('0x4b')],'to':_0x38b333['body'][_0x87bc('0x1a')][_0x87bc('0x32')],'cc':_0x38b333[_0x87bc('0x29')]['message']['cc'],'subject':_0x38b333[_0x87bc('0x29')]['message'][_0x87bc('0x4c')],'attach':_0x38b333[_0x87bc('0x29')]['message'][_0x87bc('0x4d')],'lastMsgAt':moment()[_0x87bc('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x87bc('0x4f')][_0x87bc('0x24')]({'where':{'closed':![],'MailAccountId':_0x38b333['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x87bc('0x50'),'attributes':[_0x87bc('0x4b')],'where':{'messageId':_0x38b333[_0x87bc('0x29')][_0x87bc('0x1a')][_0x87bc('0x51')]}}]})[_0x87bc('0x3f')](function(_0x3ad651){if(_0x3ad651){return[_0x3ad651,![]];}return db[_0x87bc('0x4f')][_0x87bc('0x52')](_0x349a7d)[_0x87bc('0x3f')](function(_0x25ac79){return[_0x25ac79,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x87bc('0x53')](function(_0x579368,_0x154d8a){if(_0x579368){_0x16dc7e=_0x154d8a;if(!_0x154d8a){return _0x579368['update']({'inReplyTo':_0x38b333[_0x87bc('0x29')][_0x87bc('0x1a')][_0x87bc('0x4b')],'to':_0x38b333[_0x87bc('0x29')][_0x87bc('0x1a')][_0x87bc('0x32')],'cc':_0x38b333['body'][_0x87bc('0x1a')]['cc'],'subject':_0x38b333[_0x87bc('0x29')][_0x87bc('0x1a')][_0x87bc('0x4c')],'attach':_0x579368['attach']?_0x579368[_0x87bc('0x4d')]:_0x38b333[_0x87bc('0x29')]['message']['attach'],'substatus':null,'substatusAt':moment()[_0x87bc('0x4e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x87bc('0x4e')](_0x87bc('0x54')),'lastMsgDirection':'in'});}else{return _0x579368;}}})[_0x87bc('0x3f')](function(_0x41de0b){_0x4a86ef[_0x87bc('0x55')]=_0x41de0b[_0x87bc('0x56')]({'plain':!![]});_0x4a86ef['interaction'][_0x87bc('0x57')]=_0x16dc7e;return db[_0x87bc('0x58')][_0x87bc('0x52')]({'body':_0x38b333['body'][_0x87bc('0x29')],'MailAccountId':_0x38b333[_0x87bc('0x37')]['id'],'MailInteractionId':_0x41de0b['id'],'direction':'in','ContactId':_0x4a86ef[_0x87bc('0x49')]['id'],'messageId':_0x38b333[_0x87bc('0x29')]['message'][_0x87bc('0x4b')],'from':_0x38b333[_0x87bc('0x29')]['message'][_0x87bc('0x32')],'to':_0x38b333[_0x87bc('0x29')][_0x87bc('0x1a')]['to'],'cc':_0x38b333[_0x87bc('0x29')][_0x87bc('0x1a')]['cc'],'subject':_0x38b333[_0x87bc('0x29')][_0x87bc('0x1a')]['subject'],'attach':_0x38b333[_0x87bc('0x29')][_0x87bc('0x1a')][_0x87bc('0x4d')],'Attachments':_0x38b333['body'][_0x87bc('0x1a')][_0x87bc('0x59')],'originTo':_0x38b333['body'][_0x87bc('0x1a')][_0x87bc('0x5a')],'originCc':_0x38b333['body']['message'][_0x87bc('0x5b')],'bcc':_0x38b333[_0x87bc('0x29')][_0x87bc('0x1a')]['bcc'],'ChatWebsiteId':_0x38b333['body']['message'][_0x87bc('0x5c')]||null,'originChannel':_0x38b333[_0x87bc('0x29')]['message'][_0x87bc('0x5d')]||'Email','ChatOfflineMessageId':_0x38b333[_0x87bc('0x29')][_0x87bc('0x1a')][_0x87bc('0x5e')]||null},{'include':[{'model':db[_0x87bc('0x5f')],'as':_0x87bc('0x60')}]});})[_0x87bc('0x3f')](function(_0x27453f){_0x4a86ef['message']=_0x27453f;if(_0x4a86ef[_0x87bc('0x55')][_0x87bc('0x61')]){return db[_0x87bc('0x62')][_0x87bc('0x24')]({'attributes':['id',_0x87bc('0x63')],'where':{'id':_0x4a86ef[_0x87bc('0x55')][_0x87bc('0x61')]}})['then'](function(_0x3247a2){if(_0x3247a2){_0x4a86ef['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x87bc('0x64'),'appdata':_0x3247a2['name']+','+(_0x4a86ef[_0x87bc('0x37')][_0x87bc('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x87bc('0x66'),_0x4a86ef);});}return respondWithRpcPromise(_0x87bc('0x67'),'startRouting',_0x4a86ef);})[_0x87bc('0x3f')](function(_0x2a865e){_0x36c6ff(_0x2a865e);})[_0x87bc('0x27')](function(_0x593ea6){_0x2a0238(_0x56340c[_0x87bc('0x18')](0x1f4,_0x593ea6[_0x87bc('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 22066dc..6213e28 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 _0xe55d=['update','emit','removeListener','length','mailAccount:','save','remove'];(function(_0x282eae,_0x5994be){var _0x57d70d=function(_0xbfdc92){while(--_0xbfdc92){_0x282eae['push'](_0x282eae['shift']());}};_0x57d70d(++_0x5994be);}(_0xe55d,0x9f));var _0xde55=function(_0x3a98a1,_0x38ab32){_0x3a98a1=_0x3a98a1-0x0;var _0x406eec=_0xe55d[_0x3a98a1];return _0x406eec;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xde55('0x0'),_0xde55('0x1'),_0xde55('0x2')];function createListener(_0x1996d0,_0x43e01b){return function(_0xc317b6){_0x43e01b[_0xde55('0x3')](_0x1996d0,_0xc317b6);};}function removeListener(_0x177378,_0x1d693d){return function(){MailAccountEvents[_0xde55('0x4')](_0x177378,_0x1d693d);};}exports['register']=function(_0x490fa3){for(var _0x3db776=0x0,_0x4cb01e=events[_0xde55('0x5')];_0x3db776<_0x4cb01e;_0x3db776++){var _0x38f243=events[_0x3db776];var _0x28370e=createListener(_0xde55('0x6')+_0x38f243,_0x490fa3);MailAccountEvents['on'](_0x38f243,_0x28370e);}}; \ No newline at end of file +var _0x0bb0=['update','register','length','mailAccount:','./mailAccount.events','remove'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0bb0,0x11e));var _0x00bb=function(_0x28a6f4,_0xfc14f7){_0x28a6f4=_0x28a6f4-0x0;var _0x1d7d63=_0x0bb0[_0x28a6f4];return _0x1d7d63;};'use strict';var MailAccountEvents=require(_0x00bb('0x0'));var events=['save',_0x00bb('0x1'),_0x00bb('0x2')];function createListener(_0x25e1ee,_0x47654d){return function(_0x102160){_0x47654d['emit'](_0x25e1ee,_0x102160);};}function removeListener(_0x51369a,_0x506171){return function(){MailAccountEvents['removeListener'](_0x51369a,_0x506171);};}exports[_0x00bb('0x3')]=function(_0xa45378){for(var _0x2cbaa5=0x0,_0x237e7c=events[_0x00bb('0x4')];_0x2cbaa5<_0x237e7c;_0x2cbaa5++){var _0x41fa8b=events[_0x2cbaa5];var _0x5104d0=createListener(_0x00bb('0x5')+_0x41fa8b,_0xa45378);MailAccountEvents['on'](_0x41fa8b,_0x5104d0);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 43969bd..6c03c31 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 _0x3bdf=['put','isAuthenticated','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','show'];(function(_0x1ede59,_0x3f3064){var _0x5e906b=function(_0x5b7dfd){while(--_0x5b7dfd){_0x1ede59['push'](_0x1ede59['shift']());}};_0x5e906b(++_0x3f3064);}(_0x3bdf,0x1a6));var _0xf3bd=function(_0x210d64,_0x372df5){_0x210d64=_0x210d64-0x0;var _0xeee0b9=_0x3bdf[_0x210d64];return _0xeee0b9;};'use strict';var multer=require(_0xf3bd('0x0'));var util=require('util');var path=require(_0xf3bd('0x1'));var timeout=require(_0xf3bd('0x2'));var express=require(_0xf3bd('0x3'));var router=express[_0xf3bd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf3bd('0x5'));var config=require(_0xf3bd('0x6'));var controller=require(_0xf3bd('0x7'));router['get'](_0xf3bd('0x8'),auth['isAuthenticated'](),controller[_0xf3bd('0x9')]);router[_0xf3bd('0xa')](_0xf3bd('0x8'),auth[_0xf3bd('0xb')](),controller[_0xf3bd('0xc')]);router[_0xf3bd('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xf3bd('0xe')]);module[_0xf3bd('0xf')]=router; \ No newline at end of file +var _0x99b3=['delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x99b3,0x103));var _0x399b=function(_0x3d468e,_0x292ebe){_0x3d468e=_0x3d468e-0x0;var _0x22fbbf=_0x99b3[_0x3d468e];return _0x22fbbf;};'use strict';var multer=require(_0x399b('0x0'));var util=require(_0x399b('0x1'));var path=require(_0x399b('0x2'));var timeout=require('connect-timeout');var express=require(_0x399b('0x3'));var router=express['Router']();var fs_extra=require(_0x399b('0x4'));var auth=require(_0x399b('0x5'));var interaction=require(_0x399b('0x6'));var config=require(_0x399b('0x7'));var controller=require(_0x399b('0x8'));router[_0x399b('0x9')](_0x399b('0xa'),auth[_0x399b('0xb')](),controller['show']);router['put'](_0x399b('0xa'),auth[_0x399b('0xb')](),controller[_0x399b('0xc')]);router[_0x399b('0xd')](_0x399b('0xa'),auth[_0x399b('0xb')](),controller[_0x399b('0xe')]);module[_0x399b('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index f559ed8..55f3ebc 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 _0x56e5=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x113507,_0x531ffa){var _0x551d79=function(_0x30020d){while(--_0x30020d){_0x113507['push'](_0x113507['shift']());}};_0x551d79(++_0x531ffa);}(_0x56e5,0x16a));var _0x556e=function(_0x42004d,_0x127961){_0x42004d=_0x42004d-0x0;var _0xb47cd4=_0x56e5[_0x42004d];return _0xb47cd4;};'use strict';var Sequelize=require(_0x556e('0x0'));module[_0x556e('0x1')]={'priority':{'type':Sequelize[_0x556e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x556e('0x3')},'appdata':{'type':Sequelize[_0x556e('0x4')]()},'description':{'type':Sequelize[_0x556e('0x5')]},'interval':{'type':Sequelize[_0x556e('0x5')],'defaultValue':_0x556e('0x6')}}; \ No newline at end of file +var _0x263e=['exports','INTEGER','TEXT','STRING','*,*,*,*'];(function(_0x5da27f,_0x504b76){var _0x54a3fb=function(_0x3b65a8){while(--_0x3b65a8){_0x5da27f['push'](_0x5da27f['shift']());}};_0x54a3fb(++_0x504b76);}(_0x263e,0xbe));var _0xe263=function(_0x364b32,_0x4dec35){_0x364b32=_0x364b32-0x0;var _0x3f3ea0=_0x263e[_0x364b32];return _0x3f3ea0;};'use strict';var Sequelize=require('sequelize');module[_0xe263('0x0')]={'priority':{'type':Sequelize[_0xe263('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xe263('0x2')]()},'description':{'type':Sequelize[_0xe263('0x3')]},'interval':{'type':Sequelize[_0xe263('0x3')],'defaultValue':_0xe263('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 8bdb1da..61cbecc 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 _0xedd9=['query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','show','params','keys','MailApplication','rawAttributes'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0xedd9,0xfc));var _0x9edd=function(_0x2e76f8,_0x449014){_0x2e76f8=_0x2e76f8-0x0;var _0x4b355e=_0xedd9[_0x2e76f8];return _0x4b355e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={'raw':!![],'where':{'id':_0x52746a[_0x9edd('0x27')]['id']}},_0x2ae8dd={};_0x2ae8dd['model']=_[_0x9edd('0x28')](db[_0x9edd('0x29')][_0x9edd('0x2a')]);_0x2ae8dd[_0x9edd('0x2b')]=_[_0x9edd('0x28')](_0x52746a[_0x9edd('0x2b')]);_0x2ae8dd[_0x9edd('0x2c')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],_0x2ae8dd[_0x9edd('0x2b')]);_0x28cfae[_0x9edd('0x2f')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],qs[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2b')]['fields']));_0x28cfae[_0x9edd('0x2f')]=_0x28cfae[_0x9edd('0x2f')][_0x9edd('0x31')]?_0x28cfae['attributes']:_0x2ae8dd[_0x9edd('0x2e')];if(_0x52746a[_0x9edd('0x2b')][_0x9edd('0x32')]){_0x28cfae[_0x9edd('0x33')]=[{'all':!![]}];}_0x28cfae=_[_0x9edd('0x34')]({},_0x28cfae,_0x52746a[_0x9edd('0x35')]);return db[_0x9edd('0x29')][_0x9edd('0x36')](_0x28cfae)[_0x9edd('0x21')](handleEntityNotFound(_0x238b22,null))[_0x9edd('0x21')](respondWithResult(_0x238b22,null))[_0x9edd('0x37')](handleError(_0x238b22,null));};exports[_0x9edd('0x38')]=function(_0x27eb7e,_0x14f780){if(_0x27eb7e['body']['id']){delete _0x27eb7e[_0x9edd('0x39')]['id'];}return db['MailApplication'][_0x9edd('0x36')]({'where':{'id':_0x27eb7e[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x14f780,null))[_0x9edd('0x21')](saveUpdates(_0x27eb7e[_0x9edd('0x39')],null))['then'](respondWithResult(_0x14f780,null))[_0x9edd('0x37')](handleError(_0x14f780,null));};exports[_0x9edd('0x3a')]=function(_0x2b3469,_0x38e9be){return db[_0x9edd('0x29')][_0x9edd('0x36')]({'where':{'id':_0x2b3469[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x38e9be,null))[_0x9edd('0x21')](removeEntity(_0x38e9be,null))[_0x9edd('0x37')](handleError(_0x38e9be,null));}; \ No newline at end of file +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x5b1389,_0x3f0664){var _0x559a88=function(_0x12ad09){while(--_0x12ad09){_0x5b1389['push'](_0x5b1389['shift']());}};_0x559a88(++_0x3f0664);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 4d7ea39..7f8eea2 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 _0x4643=['api','moment','path','rimraf','../../config/environment','./mailApplication.attributes','exports','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0x4643,0x15a));var _0x3464=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4643[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x3464('0x0'));var util=require(_0x3464('0x1'));var logger=require('../../config/logger')(_0x3464('0x2'));var moment=require(_0x3464('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3464('0x4'));var rimraf=require(_0x3464('0x5'));var config=require(_0x3464('0x6'));var attributes=require(_0x3464('0x7'));module[_0x3464('0x8')]=function(_0x5832f8,_0x1f6113){return _0x5832f8['define']('MailApplication',attributes,{'tableName':_0x3464('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3464('0xa'),'collate':_0x3464('0xb')});}; \ No newline at end of file +var _0xd483=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x4920f2,_0xa4bfbf){var _0x1f27cf=function(_0x4d94ad){while(--_0x4d94ad){_0x4920f2['push'](_0x4920f2['shift']());}};_0x1f27cf(++_0xa4bfbf);}(_0xd483,0xfd));var _0x3d48=function(_0x45af8c,_0x42ecfd){_0x45af8c=_0x45af8c-0x0;var _0x4f8b30=_0xd483[_0x45af8c];return _0x4f8b30;};'use strict';var _=require(_0x3d48('0x0'));var util=require(_0x3d48('0x1'));var logger=require(_0x3d48('0x2'))(_0x3d48('0x3'));var moment=require(_0x3d48('0x4'));var BPromise=require(_0x3d48('0x5'));var rp=require(_0x3d48('0x6'));var fs=require('fs');var path=require(_0x3d48('0x7'));var rimraf=require(_0x3d48('0x8'));var config=require(_0x3d48('0x9'));var attributes=require(_0x3d48('0xa'));module[_0x3d48('0xb')]=function(_0x1fb576,_0x326a27){return _0x1fb576[_0x3d48('0xc')](_0x3d48('0xd'),attributes,{'tableName':_0x3d48('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3d48('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 2da7fbc..4fe3764 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 _0x1ef9=['options','raw','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body'];(function(_0x1b25c1,_0x2c6ce6){var _0x1e4447=function(_0xaaafca){while(--_0xaaafca){_0x1b25c1['push'](_0x1b25c1['shift']());}};_0x1e4447(++_0x2c6ce6);}(_0x1ef9,0x1b5));var _0x91ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ef9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91ef('0x0'));var util=require(_0x91ef('0x1'));var moment=require(_0x91ef('0x2'));var BPromise=require(_0x91ef('0x3'));var rs=require(_0x91ef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x91ef('0x5'));var logger=require(_0x91ef('0x6'))(_0x91ef('0x7'));var config=require(_0x91ef('0x8'));var jayson=require(_0x91ef('0x9'));var client=jayson[_0x91ef('0xa')][_0x91ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58cb99,_0x15da04,_0x5b1a8f){return new BPromise(function(_0x14cdf8,_0x27ad0f){return client[_0x91ef('0xc')](_0x58cb99,_0x5b1a8f)[_0x91ef('0xd')](function(_0x1d53de){logger['info'](_0x91ef('0xe'),_0x15da04,_0x91ef('0xf'));logger[_0x91ef('0x10')](_0x91ef('0x11'),_0x15da04,'request\x20sent',JSON[_0x91ef('0x12')](_0x1d53de));if(_0x1d53de[_0x91ef('0x13')]){if(_0x1d53de[_0x91ef('0x13')][_0x91ef('0x14')]===0x1f4){logger['error'](_0x91ef('0xe'),_0x15da04,_0x1d53de[_0x91ef('0x13')]['message']);return _0x27ad0f(_0x1d53de[_0x91ef('0x13')][_0x91ef('0x15')]);}logger[_0x91ef('0x13')](_0x91ef('0xe'),_0x15da04,_0x1d53de['error'][_0x91ef('0x15')]);return _0x14cdf8(_0x1d53de[_0x91ef('0x13')][_0x91ef('0x15')]);}else{logger['info'](_0x91ef('0xe'),_0x15da04,_0x91ef('0xf'));_0x14cdf8(_0x1d53de[_0x91ef('0x16')]['message']);}})[_0x91ef('0x17')](function(_0x406a8d){logger[_0x91ef('0x13')](_0x91ef('0xe'),_0x15da04,_0x406a8d);_0x27ad0f(_0x406a8d);});});}exports[_0x91ef('0x18')]=function(_0x34dd4e){var _0x48fb63=this;return new Promise(function(_0x1eb155,_0x5c6f44){return db[_0x91ef('0x19')][_0x91ef('0x1a')](_0x34dd4e[_0x91ef('0x1b')],{'raw':_0x34dd4e[_0x91ef('0x1c')]?_0x34dd4e[_0x91ef('0x1c')][_0x91ef('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34dd4e[_0x91ef('0x1c')]?_0x34dd4e[_0x91ef('0x1c')]['where']||null:null,'attributes':_0x34dd4e['options']?_0x34dd4e['options']['attributes']||null:null,'limit':_0x34dd4e[_0x91ef('0x1c')]?_0x34dd4e[_0x91ef('0x1c')][_0x91ef('0x1e')]||null:null})[_0x91ef('0xd')](function(_0x164dfc){logger['info'](_0x91ef('0x18'),_0x34dd4e);logger['debug'](_0x91ef('0x18'),_0x34dd4e,JSON['stringify'](_0x164dfc));_0x1eb155(_0x164dfc);})[_0x91ef('0x17')](function(_0x3599c5){logger[_0x91ef('0x13')](_0x91ef('0x18'),_0x3599c5[_0x91ef('0x15')],_0x34dd4e);_0x5c6f44(_0x48fb63['error'](0x1f4,_0x3599c5[_0x91ef('0x15')]));});});}; \ No newline at end of file +var _0x2b4b=['update','body','options','raw','where','attributes','limit','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','UpdateMailApplication','MailApplication'];(function(_0xe35e6d,_0x4f1b86){var _0x7483d9=function(_0x57fec1){while(--_0x57fec1){_0xe35e6d['push'](_0xe35e6d['shift']());}};_0x7483d9(++_0x4f1b86);}(_0x2b4b,0x67));var _0xb2b4=function(_0x972ee0,_0x456351){_0x972ee0=_0x972ee0-0x0;var _0x9476f1=_0x2b4b[_0x972ee0];return _0x9476f1;};'use strict';var _=require(_0xb2b4('0x0'));var util=require(_0xb2b4('0x1'));var moment=require(_0xb2b4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb2b4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb2b4('0x4'));var logger=require(_0xb2b4('0x5'))(_0xb2b4('0x6'));var config=require(_0xb2b4('0x7'));var jayson=require(_0xb2b4('0x8'));var client=jayson['client'][_0xb2b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25dc7d,_0x59069c,_0x4a6266){return new BPromise(function(_0xc368b4,_0x3f76fb){return client[_0xb2b4('0xa')](_0x25dc7d,_0x4a6266)[_0xb2b4('0xb')](function(_0x1d21f3){logger[_0xb2b4('0xc')]('MailApplication,\x20%s,\x20%s',_0x59069c,_0xb2b4('0xd'));logger[_0xb2b4('0xe')](_0xb2b4('0xf'),_0x59069c,_0xb2b4('0xd'),JSON[_0xb2b4('0x10')](_0x1d21f3));if(_0x1d21f3[_0xb2b4('0x11')]){if(_0x1d21f3[_0xb2b4('0x11')][_0xb2b4('0x12')]===0x1f4){logger[_0xb2b4('0x11')](_0xb2b4('0x13'),_0x59069c,_0x1d21f3[_0xb2b4('0x11')][_0xb2b4('0x14')]);return _0x3f76fb(_0x1d21f3['error'][_0xb2b4('0x14')]);}logger[_0xb2b4('0x11')](_0xb2b4('0x13'),_0x59069c,_0x1d21f3['error'][_0xb2b4('0x14')]);return _0xc368b4(_0x1d21f3[_0xb2b4('0x11')][_0xb2b4('0x14')]);}else{logger[_0xb2b4('0xc')](_0xb2b4('0x13'),_0x59069c,'request\x20sent');_0xc368b4(_0x1d21f3[_0xb2b4('0x15')][_0xb2b4('0x14')]);}})[_0xb2b4('0x16')](function(_0x3126a8){logger[_0xb2b4('0x11')](_0xb2b4('0x13'),_0x59069c,_0x3126a8);_0x3f76fb(_0x3126a8);});});}exports[_0xb2b4('0x17')]=function(_0x1c699d){var _0x477717=this;return new Promise(function(_0x1c7f47,_0x467e4b){return db[_0xb2b4('0x18')][_0xb2b4('0x19')](_0x1c699d[_0xb2b4('0x1a')],{'raw':_0x1c699d[_0xb2b4('0x1b')]?_0x1c699d[_0xb2b4('0x1b')][_0xb2b4('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c699d[_0xb2b4('0x1b')]?_0x1c699d[_0xb2b4('0x1b')][_0xb2b4('0x1d')]||null:null,'attributes':_0x1c699d['options']?_0x1c699d[_0xb2b4('0x1b')][_0xb2b4('0x1e')]||null:null,'limit':_0x1c699d['options']?_0x1c699d[_0xb2b4('0x1b')][_0xb2b4('0x1f')]||null:null})[_0xb2b4('0xb')](function(_0x518748){logger[_0xb2b4('0xc')](_0xb2b4('0x17'),_0x1c699d);logger[_0xb2b4('0xe')](_0xb2b4('0x17'),_0x1c699d,JSON[_0xb2b4('0x10')](_0x518748));_0x1c7f47(_0x518748);})['catch'](function(_0x4f4604){logger[_0xb2b4('0x11')](_0xb2b4('0x17'),_0x4f4604[_0xb2b4('0x14')],_0x1c699d);_0x467e4b(_0x477717[_0xb2b4('0x11')](0x1f4,_0x4f4604[_0xb2b4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 29649cd..8d1d53d 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 _0xf74a=['removeTags','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','mail','mailinteraction:addtags','addTags','put','/:id','tracked','update','mailinteraction:destroy','destroy','delete','/:id/tags'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf74a,0x198));var _0xaf74=function(_0x3e2e40,_0x4b3c4f){_0x3e2e40=_0x3e2e40-0x0;var _0x27d03d=_0xf74a[_0x3e2e40];return _0x27d03d;};'use strict';var express=require(_0xaf74('0x0'));var router=express[_0xaf74('0x1')]();var auth=require(_0xaf74('0x2'));var interaction=require(_0xaf74('0x3'));var controller=require(_0xaf74('0x4'));router[_0xaf74('0x5')]('/',auth[_0xaf74('0x6')](),controller[_0xaf74('0x7')]);router[_0xaf74('0x5')]('/describe',auth[_0xaf74('0x6')](),controller[_0xaf74('0x8')]);router['get']('/:id',auth[_0xaf74('0x6')](),controller[_0xaf74('0x9')]);router['get'](_0xaf74('0xa'),auth[_0xaf74('0x6')](),controller[_0xaf74('0xb')]);router[_0xaf74('0x5')](_0xaf74('0xc'),auth[_0xaf74('0x6')](),controller[_0xaf74('0xd')]);router[_0xaf74('0xe')]('/',auth[_0xaf74('0x6')](),controller[_0xaf74('0xf')]);router[_0xaf74('0xe')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post']('/:id/tags',auth[_0xaf74('0x6')](),interaction['tracked'](_0xaf74('0x10'),_0xaf74('0x11')),controller[_0xaf74('0x12')]);router[_0xaf74('0x13')](_0xaf74('0x14'),auth[_0xaf74('0x6')](),interaction[_0xaf74('0x15')](_0xaf74('0x10'),'mailinteraction:update'),controller[_0xaf74('0x16')]);router['delete'](_0xaf74('0x14'),auth[_0xaf74('0x6')](),interaction['tracked'](_0xaf74('0x10'),_0xaf74('0x17')),controller[_0xaf74('0x18')]);router[_0xaf74('0x19')](_0xaf74('0x1a'),auth[_0xaf74('0x6')](),controller[_0xaf74('0x1b')]);module[_0xaf74('0x1c')]=router; \ No newline at end of file +var _0xc9f5=['/:id','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','./mailInteraction.controller','isAuthenticated','index','get','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','tracked','mail','mailinteraction:addtags','addTags'];(function(_0x4ea087,_0xe3f3cc){var _0x26e98c=function(_0x52e9e6){while(--_0x52e9e6){_0x4ea087['push'](_0x4ea087['shift']());}};_0x26e98c(++_0xe3f3cc);}(_0xc9f5,0x14c));var _0x5c9f=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0xc9f5[_0x1034ee];return _0x2922af;};'use strict';var express=require(_0x5c9f('0x0'));var router=express['Router']();var auth=require(_0x5c9f('0x1'));var interaction=require('../../components/interaction/service');var controller=require(_0x5c9f('0x2'));router['get']('/',auth[_0x5c9f('0x3')](),controller[_0x5c9f('0x4')]);router[_0x5c9f('0x5')](_0x5c9f('0x6'),auth['isAuthenticated'](),controller[_0x5c9f('0x7')]);router[_0x5c9f('0x5')]('/:id',auth[_0x5c9f('0x3')](),controller[_0x5c9f('0x8')]);router[_0x5c9f('0x5')](_0x5c9f('0x9'),auth[_0x5c9f('0x3')](),controller[_0x5c9f('0xa')]);router[_0x5c9f('0x5')](_0x5c9f('0xb'),auth[_0x5c9f('0x3')](),controller[_0x5c9f('0xc')]);router[_0x5c9f('0xd')]('/',auth[_0x5c9f('0x3')](),controller[_0x5c9f('0xe')]);router[_0x5c9f('0xd')]('/:id/messages',auth[_0x5c9f('0x3')](),controller['addMessage']);router[_0x5c9f('0xd')]('/:id/tags',auth[_0x5c9f('0x3')](),interaction[_0x5c9f('0xf')](_0x5c9f('0x10'),_0x5c9f('0x11')),controller[_0x5c9f('0x12')]);router['put'](_0x5c9f('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x5c9f('0x10'),_0x5c9f('0x14')),controller[_0x5c9f('0x15')]);router[_0x5c9f('0x16')](_0x5c9f('0x13'),auth[_0x5c9f('0x3')](),interaction[_0x5c9f('0xf')]('mail',_0x5c9f('0x17')),controller[_0x5c9f('0x18')]);router[_0x5c9f('0x16')]('/:id/tags',auth[_0x5c9f('0x3')](),controller[_0x5c9f('0x19')]);module[_0x5c9f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 8cf1a57..3b37f94 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 _0x747e=['long','TEXT','DATE','ENUM','out','sequelize','iconv','exports','BOOLEAN','STRING'];(function(_0x3b69ab,_0x203420){var _0x23de31=function(_0x4cfdaa){while(--_0x4cfdaa){_0x3b69ab['push'](_0x3b69ab['shift']());}};_0x23de31(++_0x203420);}(_0x747e,0x159));var _0xe747=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x747e[_0x2bc3f4];return _0x14ac53;};'use strict';var Sequelize=require(_0xe747('0x0'));var iconv=require(_0xe747('0x1'));module[_0xe747('0x2')]={'closed':{'type':Sequelize[_0xe747('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe747('0x4')]},'secondDisposition':{'type':Sequelize[_0xe747('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe747('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xe747('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0xe747('0x5'))},'subject':{'type':Sequelize[_0xe747('0x6')]()},'attach':{'type':Sequelize[_0xe747('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe747('0x7')]},'substatus':{'type':Sequelize[_0xe747('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xe747('0x7')]},'firstMsgDirection':{'type':Sequelize[_0xe747('0x8')]('in',_0xe747('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe747('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xe747('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe747('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x88a5=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out'];(function(_0x233de7,_0x109f02){var _0x26940c=function(_0x474b79){while(--_0x474b79){_0x233de7['push'](_0x233de7['shift']());}};_0x26940c(++_0x109f02);}(_0x88a5,0x90));var _0x588a=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x88a5[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x588a('0x0'));module[_0x588a('0x1')]={'closed':{'type':Sequelize[_0x588a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x588a('0x3')]},'disposition':{'type':Sequelize[_0x588a('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x588a('0x4')](0x1fe)},'to':{'type':Sequelize[_0x588a('0x4')]},'cc':{'type':Sequelize[_0x588a('0x5')]('long')},'subject':{'type':Sequelize[_0x588a('0x5')]()},'attach':{'type':Sequelize[_0x588a('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x588a('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x588a('0x6')]('in',_0x588a('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x588a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x588a('0x6')]('in',_0x588a('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x588a('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 e5193ee..2896280 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 _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','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)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xb10b,0x12a));var _0xbb10=function(_0x35b7ba,_0x155c7f){_0x35b7ba=_0x35b7ba-0x0;var _0x25ea5e=_0xb10b[_0x35b7ba];return _0x25ea5e;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,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(_0x27f72a,_0x278936){var _0x820aea=function(_0x183b17){while(--_0x183b17){_0x27f72a['push'](_0x27f72a['shift']());}};_0x820aea(++_0x278936);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 86806d9..44fa3ed 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 _0xcb59=['MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','findAll','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0xcb59,0x18e));var _0x9cb5=function(_0x41a666,_0x2a92fa){_0x41a666=_0x41a666-0x0;var _0x4bfb56=_0xcb59[_0x41a666];return _0x4bfb56;};'use strict';var EventEmitter=require(_0x9cb5('0x0'));var MailInteraction=require(_0x9cb5('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x9cb5('0x1'))['db'][_0x9cb5('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9cb5('0x3')](0x0);var events={'afterCreate':_0x9cb5('0x4'),'afterUpdate':_0x9cb5('0x5'),'afterDestroy':_0x9cb5('0x6')};function emitEvent(_0x42f508){return function(_0x21787c,_0x7a13ed,_0x1f6d15){_0x21787c[_0x9cb5('0x7')]({'attributes':['id'],'raw':!![]})[_0x9cb5('0x8')](function(_0x26acbe){_0x21787c[_0x9cb5('0x9')]('Users',_0x26acbe['map'](function(_0x3cfc9e){return{'id':_0x3cfc9e['id']};}));return MailMessage[_0x9cb5('0xa')]({'where':{'MailInteractionId':_0x21787c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9cb5('0x8')](function(_0x410d5b){_0x21787c[_0x9cb5('0x9')]('unreadMessages',_0x410d5b['length']);MailInteractionEvents[_0x9cb5('0xb')](_0x42f508+':'+_0x21787c['id'],_0x21787c);MailInteractionEvents[_0x9cb5('0xb')](_0x42f508,_0x21787c);_0x1f6d15(null);})[_0x9cb5('0xc')](_0x1f6d15(null));};}for(var e in events){if(events[_0x9cb5('0xd')](e)){var event=events[e];MailInteraction[_0x9cb5('0xe')](e,emitEvent(event));}}module[_0x9cb5('0xf')]=MailInteractionEvents; \ No newline at end of file +var _0x09a4=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','getUsers','then','setDataValue','map','findAll','unreadMessages','catch','hasOwnProperty','hook','exports'];(function(_0x19efb6,_0x45aa78){var _0x4180c0=function(_0x1a76ee){while(--_0x1a76ee){_0x19efb6['push'](_0x19efb6['shift']());}};_0x4180c0(++_0x45aa78);}(_0x09a4,0x1e0));var _0x409a=function(_0x2a4bb1,_0x23bd64){_0x2a4bb1=_0x2a4bb1-0x0;var _0x29a201=_0x09a4[_0x2a4bb1];return _0x29a201;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x409a('0x0'))['db'][_0x409a('0x1')];var MailMessage=require(_0x409a('0x0'))['db'][_0x409a('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x409a('0x3')](0x0);var events={'afterCreate':_0x409a('0x4'),'afterUpdate':_0x409a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2cb167){return function(_0x2e3906,_0x35ca73,_0x43bf86){_0x2e3906[_0x409a('0x6')]({'attributes':['id'],'raw':!![]})[_0x409a('0x7')](function(_0x16c290){_0x2e3906[_0x409a('0x8')]('Users',_0x16c290[_0x409a('0x9')](function(_0x4818a5){return{'id':_0x4818a5['id']};}));return MailMessage[_0x409a('0xa')]({'where':{'MailInteractionId':_0x2e3906['id'],'direction':'in','read':![]},'raw':!![]});})[_0x409a('0x7')](function(_0x3d6300){_0x2e3906[_0x409a('0x8')](_0x409a('0xb'),_0x3d6300['length']);MailInteractionEvents['emit'](_0x2cb167+':'+_0x2e3906['id'],_0x2e3906);MailInteractionEvents['emit'](_0x2cb167,_0x2e3906);_0x43bf86(null);})[_0x409a('0xc')](_0x43bf86(null));};}for(var e in events){if(events[_0x409a('0xd')](e)){var event=events[e];MailInteraction[_0x409a('0xe')](e,emitEvent(event));}}module[_0x409a('0xf')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index c7a25c1..3d0084f 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 _0x80a3=['subject','FULLTEXT','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','substatus','format','changed','models','get','MailMessage','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions'];(function(_0xc7d00e,_0x53faef){var _0x39bf39=function(_0x19cbec){while(--_0x19cbec){_0xc7d00e['push'](_0xc7d00e['shift']());}};_0x39bf39(++_0x53faef);}(_0x80a3,0xa2));var _0x380a=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x80a3[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x380a('0x0'));var util=require(_0x380a('0x1'));var logger=require(_0x380a('0x2'))('api');var moment=require(_0x380a('0x3'));var BPromise=require(_0x380a('0x4'));var rp=require(_0x380a('0x5'));var fs=require('fs');var path=require(_0x380a('0x6'));var rimraf=require(_0x380a('0x7'));var config=require(_0x380a('0x8'));var attributes=require(_0x380a('0x9'));module[_0x380a('0xa')]=function(_0xb1fc6d,_0x27bb05){return _0xb1fc6d[_0x380a('0xb')]('MailInteraction',attributes,{'tableName':_0x380a('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x380a('0xd'),'to'],'type':_0x380a('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xc23308,_0x3c0712,_0xe2d194){if(_0xc23308['substatus']){_0xc23308[_0x380a('0xf')]=moment()['format'](_0x380a('0x10'));}if(_0xc23308[_0x380a('0x11')]){_0xc23308[_0x380a('0x12')]=moment()['format'](_0x380a('0x10'));}_0xe2d194(null,_0x3c0712);},'beforeUpdate':function(_0x225285,_0x198ad5,_0x59d922){if(_0x225285['changed'](_0x380a('0x13'))){_0x225285['substatusAt']=_0x225285[_0x380a('0x13')]?moment()[_0x380a('0x14')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x225285[_0x380a('0x15')]('closed')){_0x225285['closedAt']=moment()[_0x380a('0x14')](_0x380a('0x10'));_0x225285['substatus']=null;_0x225285['substatusAt']=null;}_0x59d922(null,_0x225285);},'afterUpdate':function(_0x233280,_0x39ec98,_0x4975db){var _0x1ea610=_0xb1fc6d[_0x380a('0x16')];var _0x3d41d7=_0x233280[_0x380a('0x17')]({'plain':!![]});if(_0x3d41d7[_0x380a('0x11')]){return _0x1ea610[_0x380a('0x18')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x3d41d7['id']}})['then'](function(){_0x4975db();})['catch'](function(_0xfa4904){_0x4975db(_0xfa4904);});}else{_0x4975db();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0783=['get','MailMessage','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x0783,0x16b));var _0x3078=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0783[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3078('0x0'));var util=require(_0x3078('0x1'));var logger=require(_0x3078('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3078('0x3'));var rp=require(_0x3078('0x4'));var fs=require('fs');var path=require(_0x3078('0x5'));var rimraf=require('rimraf');var config=require(_0x3078('0x6'));var attributes=require(_0x3078('0x7'));module[_0x3078('0x8')]=function(_0x5a58fc,_0x3ddf8e){return _0x5a58fc[_0x3078('0x9')]('MailInteraction',attributes,{'tableName':_0x3078('0xa'),'paranoid':![],'indexes':[{'name':_0x3078('0xb'),'fields':[_0x3078('0xc'),'to'],'type':_0x3078('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2d771d,_0x5608f8,_0x29c6a6){if(_0x2d771d[_0x3078('0xe')]){_0x2d771d[_0x3078('0xf')]=moment()[_0x3078('0x10')](_0x3078('0x11'));}if(_0x2d771d['closed']){_0x2d771d[_0x3078('0x12')]=moment()[_0x3078('0x10')](_0x3078('0x11'));}_0x29c6a6(null,_0x5608f8);},'beforeUpdate':function(_0x10e862,_0x351d98,_0x1f9918){if(_0x10e862['changed'](_0x3078('0xe'))){_0x10e862[_0x3078('0xf')]=_0x10e862[_0x3078('0xe')]?moment()[_0x3078('0x10')](_0x3078('0x11')):null;}if(_0x10e862[_0x3078('0x13')](_0x3078('0x14'))){_0x10e862[_0x3078('0x12')]=moment()['format'](_0x3078('0x11'));_0x10e862[_0x3078('0xe')]=null;_0x10e862[_0x3078('0xf')]=null;}_0x1f9918(null,_0x10e862);},'afterUpdate':function(_0x55f437,_0x41641a,_0x536d86){var _0x27680d=_0x5a58fc['models'];var _0x393fb7=_0x55f437[_0x3078('0x15')]({'plain':!![]});if(_0x393fb7[_0x3078('0x14')]){return _0x27680d[_0x3078('0x16')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x393fb7['id']}})['then'](function(){_0x536d86();})['catch'](function(_0x5a916a){_0x536d86(_0x5a916a);});}else{_0x536d86();}}},'charset':'utf8mb4','collate':_0x3078('0x17')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 1861d85..e0048f6 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 _0x6d53=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','client','http','defaults','localhost','redis','./mailInteraction.socket','register','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','MailInteraction','update','body','options','raw','where','limit','UpdateMailInteraction','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','debug'];(function(_0x3a380c,_0x46ddfd){var _0x3a1750=function(_0x2af6d6){while(--_0x2af6d6){_0x3a380c['push'](_0x3a380c['shift']());}};_0x3a1750(++_0x46ddfd);}(_0x6d53,0x17a));var _0x36d5=function(_0xd78541,_0x2c53a8){_0xd78541=_0xd78541-0x0;var _0x3dc0d4=_0x6d53[_0xd78541];return _0x3dc0d4;};'use strict';var _=require(_0x36d5('0x0'));var util=require(_0x36d5('0x1'));var moment=require('moment');var BPromise=require(_0x36d5('0x2'));var rs=require(_0x36d5('0x3'));var fs=require('fs');var Redis=require(_0x36d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x36d5('0x5'));var logger=require('../../config/logger')(_0x36d5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x36d5('0x7')][_0x36d5('0x8')]({'port':0x232a});config['redis']=_[_0x36d5('0x9')](config['redis'],{'host':_0x36d5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36d5('0xb')]));require(_0x36d5('0xc'))[_0x36d5('0xd')](socket);function respondWithRpcPromise(_0x4bff77,_0x2a4d9e,_0x5e9177){return new BPromise(function(_0x250a36,_0x4c21f5){return client[_0x36d5('0xe')](_0x4bff77,_0x5e9177)[_0x36d5('0xf')](function(_0xc42c3b){logger['info'](_0x36d5('0x10'),_0x2a4d9e,_0x36d5('0x11'));logger['debug'](_0x36d5('0x12'),_0x2a4d9e,_0x36d5('0x11'),JSON[_0x36d5('0x13')](_0xc42c3b));if(_0xc42c3b['error']){if(_0xc42c3b[_0x36d5('0x14')][_0x36d5('0x15')]===0x1f4){logger[_0x36d5('0x14')](_0x36d5('0x10'),_0x2a4d9e,_0xc42c3b[_0x36d5('0x14')][_0x36d5('0x16')]);return _0x4c21f5(_0xc42c3b['error']['message']);}logger['error'](_0x36d5('0x10'),_0x2a4d9e,_0xc42c3b[_0x36d5('0x14')][_0x36d5('0x16')]);return _0x250a36(_0xc42c3b[_0x36d5('0x14')][_0x36d5('0x16')]);}else{logger[_0x36d5('0x17')](_0x36d5('0x10'),_0x2a4d9e,_0x36d5('0x11'));_0x250a36(_0xc42c3b[_0x36d5('0x18')][_0x36d5('0x16')]);}})[_0x36d5('0x19')](function(_0x36121f){logger[_0x36d5('0x14')](_0x36d5('0x10'),_0x2a4d9e,_0x36121f);_0x4c21f5(_0x36121f);});});}exports['UpdateMailInteraction']=function(_0x4e0419){var _0x2d32a9=this;return new Promise(function(_0x2d3157,_0x2d2ed4){return db[_0x36d5('0x1a')][_0x36d5('0x1b')](_0x4e0419[_0x36d5('0x1c')],{'raw':_0x4e0419[_0x36d5('0x1d')]?_0x4e0419[_0x36d5('0x1d')][_0x36d5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e0419[_0x36d5('0x1d')]?_0x4e0419[_0x36d5('0x1d')][_0x36d5('0x1f')]||null:null,'attributes':_0x4e0419[_0x36d5('0x1d')]?_0x4e0419[_0x36d5('0x1d')]['attributes']||null:null,'limit':_0x4e0419[_0x36d5('0x1d')]?_0x4e0419[_0x36d5('0x1d')][_0x36d5('0x20')]||null:null})[_0x36d5('0xf')](function(_0x562f7e){logger[_0x36d5('0x17')]('UpdateMailInteraction',_0x4e0419);logger['debug'](_0x36d5('0x21'),_0x4e0419,JSON[_0x36d5('0x13')](_0x562f7e));_0x2d3157(_0x562f7e);})['catch'](function(_0x31e970){logger[_0x36d5('0x14')]('UpdateMailInteraction',_0x31e970[_0x36d5('0x16')],_0x4e0419);_0x2d2ed4(_0x2d32a9[_0x36d5('0x14')](0x1f4,_0x31e970['message']));});});};exports[_0x36d5('0x22')]=function(_0xbcc8e){return new Promise(function(_0x4a4a6c,_0x49adad){return db[_0x36d5('0x1a')][_0x36d5('0x23')]({'where':_0xbcc8e[_0x36d5('0x1d')]?_0xbcc8e[_0x36d5('0x1d')][_0x36d5('0x1f')]||null:null})[_0x36d5('0xf')](function(_0x2e45da){if(_0x2e45da){return _0x2e45da[_0x36d5('0x24')](_0xbcc8e[_0x36d5('0x1c')][_0x36d5('0x25')],_[_0x36d5('0x26')](_0xbcc8e[_0x36d5('0x1c')],[_0x36d5('0x25'),'id'])||{});}})[_0x36d5('0x27')](function(_0x48c43b){logger[_0x36d5('0x17')](_0x36d5('0x28'),_0xbcc8e);logger[_0x36d5('0x29')]('AddTags',_0xbcc8e,JSON['stringify'](_0x48c43b));_0x4a4a6c(_0x48c43b);})[_0x36d5('0x19')](function(_0x58104d){logger['error'](_0x36d5('0x28'),_0x58104d[_0x36d5('0x16')],_0xbcc8e);_0x49adad(_this['error'](0x1f4,_0x58104d[_0x36d5('0x16')]));});});}; \ No newline at end of file +var _0xcf30=['MailInteraction','addTags','ids','omit','body','AddTags','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','MailInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','UpdateMailInteraction','update','options','raw','where','limit','AddTagsToMailInteraction'];(function(_0x19a615,_0xd4d958){var _0x212cc9=function(_0x3bbf87){while(--_0x3bbf87){_0x19a615['push'](_0x19a615['shift']());}};_0x212cc9(++_0xd4d958);}(_0xcf30,0x128));var _0x0cf3=function(_0xfe715a,_0x30fabf){_0xfe715a=_0xfe715a-0x0;var _0x45f896=_0xcf30[_0xfe715a];return _0x45f896;};'use strict';var _=require(_0x0cf3('0x0'));var util=require(_0x0cf3('0x1'));var moment=require(_0x0cf3('0x2'));var BPromise=require(_0x0cf3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cf3('0x4'));var db=require(_0x0cf3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x0cf3('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x0cf3('0x7')]=_[_0x0cf3('0x8')](config[_0x0cf3('0x7')],{'host':_0x0cf3('0x9'),'port':0x18eb});var socket=require(_0x0cf3('0xa'))(new Redis(config['redis']));require(_0x0cf3('0xb'))['register'](socket);function respondWithRpcPromise(_0x141e8c,_0x1e3416,_0x18b2d1){return new BPromise(function(_0x1793a4,_0x1937c6){return client[_0x0cf3('0xc')](_0x141e8c,_0x18b2d1)[_0x0cf3('0xd')](function(_0x2e7cbc){logger['info'](_0x0cf3('0xe'),_0x1e3416,'request\x20sent');logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x1e3416,_0x0cf3('0xf'),JSON[_0x0cf3('0x10')](_0x2e7cbc));if(_0x2e7cbc['error']){if(_0x2e7cbc['error']['code']===0x1f4){logger[_0x0cf3('0x11')](_0x0cf3('0xe'),_0x1e3416,_0x2e7cbc[_0x0cf3('0x11')][_0x0cf3('0x12')]);return _0x1937c6(_0x2e7cbc[_0x0cf3('0x11')]['message']);}logger[_0x0cf3('0x11')](_0x0cf3('0xe'),_0x1e3416,_0x2e7cbc['error'][_0x0cf3('0x12')]);return _0x1793a4(_0x2e7cbc[_0x0cf3('0x11')][_0x0cf3('0x12')]);}else{logger[_0x0cf3('0x13')](_0x0cf3('0xe'),_0x1e3416,_0x0cf3('0xf'));_0x1793a4(_0x2e7cbc[_0x0cf3('0x14')][_0x0cf3('0x12')]);}})['catch'](function(_0x159846){logger[_0x0cf3('0x11')]('MailInteraction,\x20%s,\x20%s',_0x1e3416,_0x159846);_0x1937c6(_0x159846);});});}exports[_0x0cf3('0x15')]=function(_0x8e4561){var _0xa81872=this;return new Promise(function(_0x496516,_0x327694){return db['MailInteraction'][_0x0cf3('0x16')](_0x8e4561['body'],{'raw':_0x8e4561[_0x0cf3('0x17')]?_0x8e4561[_0x0cf3('0x17')][_0x0cf3('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8e4561['options']?_0x8e4561[_0x0cf3('0x17')][_0x0cf3('0x19')]||null:null,'attributes':_0x8e4561['options']?_0x8e4561[_0x0cf3('0x17')]['attributes']||null:null,'limit':_0x8e4561[_0x0cf3('0x17')]?_0x8e4561['options'][_0x0cf3('0x1a')]||null:null})[_0x0cf3('0xd')](function(_0x4d0f5b){logger[_0x0cf3('0x13')](_0x0cf3('0x15'),_0x8e4561);logger['debug'](_0x0cf3('0x15'),_0x8e4561,JSON[_0x0cf3('0x10')](_0x4d0f5b));_0x496516(_0x4d0f5b);})['catch'](function(_0x5aed05){logger[_0x0cf3('0x11')](_0x0cf3('0x15'),_0x5aed05[_0x0cf3('0x12')],_0x8e4561);_0x327694(_0xa81872[_0x0cf3('0x11')](0x1f4,_0x5aed05['message']));});});};exports[_0x0cf3('0x1b')]=function(_0x32cf18){return new Promise(function(_0x4cb2bb,_0x1a1e94){return db[_0x0cf3('0x1c')]['find']({'where':_0x32cf18[_0x0cf3('0x17')]?_0x32cf18[_0x0cf3('0x17')][_0x0cf3('0x19')]||null:null})[_0x0cf3('0xd')](function(_0x46a83e){if(_0x46a83e){return _0x46a83e[_0x0cf3('0x1d')](_0x32cf18['body'][_0x0cf3('0x1e')],_[_0x0cf3('0x1f')](_0x32cf18[_0x0cf3('0x20')],[_0x0cf3('0x1e'),'id'])||{});}})['spread'](function(_0x189642){logger[_0x0cf3('0x13')](_0x0cf3('0x21'),_0x32cf18);logger[_0x0cf3('0x22')](_0x0cf3('0x21'),_0x32cf18,JSON[_0x0cf3('0x10')](_0x189642));_0x4cb2bb(_0x189642);})[_0x0cf3('0x23')](function(_0x14f58d){logger['error'](_0x0cf3('0x21'),_0x14f58d[_0x0cf3('0x12')],_0x32cf18);_0x1a1e94(_this['error'](0x1f4,_0x14f58d[_0x0cf3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index cf24c67..8474ab3 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 _0x0715=['remove','update','emit','removeListener','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x3a9620,_0x18d840){var _0x21defb=function(_0x53107d){while(--_0x53107d){_0x3a9620['push'](_0x3a9620['shift']());}};_0x21defb(++_0x18d840);}(_0x0715,0xde));var _0x5071=function(_0xfaa53c,_0x2cb4a7){_0xfaa53c=_0xfaa53c-0x0;var _0x5c1ae0=_0x0715[_0xfaa53c];return _0x5c1ae0;};'use strict';var MailInteractionEvents=require(_0x5071('0x0'));var events=[_0x5071('0x1'),_0x5071('0x2'),_0x5071('0x3')];function createListener(_0xcad3b2,_0x3b7944){return function(_0x1a8bd0){_0x3b7944[_0x5071('0x4')](_0xcad3b2,_0x1a8bd0);};}function removeListener(_0x1d4e5c,_0x42d644){return function(){MailInteractionEvents[_0x5071('0x5')](_0x1d4e5c,_0x42d644);};}exports['register']=function(_0x430d2d){for(var _0x8ba11=0x0,_0x4a2d1a=events[_0x5071('0x6')];_0x8ba11<_0x4a2d1a;_0x8ba11++){var _0x119cde=events[_0x8ba11];var _0x6c38bb=createListener(_0x5071('0x7')+_0x119cde,_0x430d2d);MailInteractionEvents['on'](_0x119cde,_0x6c38bb);}}; \ No newline at end of file +var _0x52b6=['mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0x5acb01,_0x13bc19){var _0x2aa560=function(_0x24baa8){while(--_0x24baa8){_0x5acb01['push'](_0x5acb01['shift']());}};_0x2aa560(++_0x13bc19);}(_0x52b6,0x157));var _0x652b=function(_0xbd5c58,_0x167170){_0xbd5c58=_0xbd5c58-0x0;var _0x1826ae=_0x52b6[_0xbd5c58];return _0x1826ae;};'use strict';var MailInteractionEvents=require(_0x652b('0x0'));var events=[_0x652b('0x1'),_0x652b('0x2'),_0x652b('0x3')];function createListener(_0x565501,_0x42160b){return function(_0x1653fd){_0x42160b[_0x652b('0x4')](_0x565501,_0x1653fd);};}function removeListener(_0x342095,_0x1a554){return function(){MailInteractionEvents['removeListener'](_0x342095,_0x1a554);};}exports['register']=function(_0x5e8eaa){for(var _0x10ca3c=0x0,_0x2ce7e8=events['length'];_0x10ca3c<_0x2ce7e8;_0x10ca3c++){var _0x33b140=events[_0x10ca3c];var _0xe72c07=createListener(_0x652b('0x5')+_0x33b140,_0x5e8eaa);MailInteractionEvents['on'](_0x33b140,_0xe72c07);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 478400a..79ebb60 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 _0xe1a8=['get','index','/describe','isAuthenticated','describe','/:id','/:id/download','download','post','tracked','mail','mailmessage:create','create','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0xe1a8,0x6f));var _0x8e1a=function(_0x1377d8,_0x455246){_0x1377d8=_0x1377d8-0x0;var _0x3bbee0=_0xe1a8[_0x1377d8];return _0x3bbee0;};'use strict';var multer=require(_0x8e1a('0x0'));var util=require(_0x8e1a('0x1'));var path=require(_0x8e1a('0x2'));var timeout=require(_0x8e1a('0x3'));var express=require(_0x8e1a('0x4'));var router=express[_0x8e1a('0x5')]();var fs_extra=require(_0x8e1a('0x6'));var auth=require(_0x8e1a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8e1a('0x8'));var controller=require('./mailMessage.controller');router[_0x8e1a('0x9')]('/',auth['isAuthenticated'](),controller[_0x8e1a('0xa')]);router['get'](_0x8e1a('0xb'),auth[_0x8e1a('0xc')](),controller[_0x8e1a('0xd')]);router[_0x8e1a('0x9')](_0x8e1a('0xe'),auth[_0x8e1a('0xc')](),controller['show']);router[_0x8e1a('0x9')](_0x8e1a('0xf'),auth[_0x8e1a('0xc')](),controller[_0x8e1a('0x10')]);router[_0x8e1a('0x11')]('/',auth['isAuthenticated'](),interaction[_0x8e1a('0x12')](_0x8e1a('0x13'),_0x8e1a('0x14')),controller[_0x8e1a('0x15')]);router['put'](_0x8e1a('0xe'),auth[_0x8e1a('0xc')](),controller['update']);router['put'](_0x8e1a('0x16'),auth[_0x8e1a('0xc')](),controller[_0x8e1a('0x17')]);router[_0x8e1a('0x18')](_0x8e1a('0x19'),auth[_0x8e1a('0xc')](),controller[_0x8e1a('0x1a')]);router[_0x8e1a('0x1b')](_0x8e1a('0xe'),auth['isAuthenticated'](),controller[_0x8e1a('0x1c')]);module[_0x8e1a('0x1d')]=router; \ No newline at end of file +var _0x8278=['create','update','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail'];(function(_0x1d2c74,_0x588523){var _0x13c38d=function(_0x262996){while(--_0x262996){_0x1d2c74['push'](_0x1d2c74['shift']());}};_0x13c38d(++_0x588523);}(_0x8278,0x1ae));var _0x8827=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8278[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8827('0x0'));var util=require(_0x8827('0x1'));var path=require(_0x8827('0x2'));var timeout=require(_0x8827('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8827('0x4'));var auth=require(_0x8827('0x5'));var interaction=require(_0x8827('0x6'));var config=require(_0x8827('0x7'));var controller=require('./mailMessage.controller');router[_0x8827('0x8')]('/',auth[_0x8827('0x9')](),controller[_0x8827('0xa')]);router[_0x8827('0x8')](_0x8827('0xb'),auth[_0x8827('0x9')](),controller[_0x8827('0xc')]);router[_0x8827('0x8')](_0x8827('0xd'),auth[_0x8827('0x9')](),controller[_0x8827('0xe')]);router[_0x8827('0x8')](_0x8827('0xf'),auth['isAuthenticated'](),controller[_0x8827('0x10')]);router[_0x8827('0x11')]('/',auth['isAuthenticated'](),interaction[_0x8827('0x12')](_0x8827('0x13'),'mailmessage:create'),controller[_0x8827('0x14')]);router['put']('/:id',auth[_0x8827('0x9')](),controller[_0x8827('0x15')]);router[_0x8827('0x16')](_0x8827('0x17'),auth['isAuthenticated'](),controller[_0x8827('0x18')]);router[_0x8827('0x16')](_0x8827('0x19'),auth[_0x8827('0x9')](),controller[_0x8827('0x1a')]);router[_0x8827('0x1b')](_0x8827('0xd'),auth['isAuthenticated'](),controller[_0x8827('0x1c')]);module[_0x8827('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 796a75a..f44db91 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 _0x8275=['STRING','INTEGER','BOOLEAN','DATE','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','ENUM','out'];(function(_0x327dc3,_0x3e78d2){var _0x599437=function(_0x1fbad5){while(--_0x1fbad5){_0x327dc3['push'](_0x327dc3['shift']());}};_0x599437(++_0x3e78d2);}(_0x8275,0x180));var _0x5827=function(_0x26b8d8,_0x294304){_0x26b8d8=_0x26b8d8-0x0;var _0x1b2aa2=_0x8275[_0x26b8d8];return _0x1b2aa2;};'use strict';var Sequelize=require(_0x5827('0x0'));var _=require(_0x5827('0x1'));module[_0x5827('0x2')]={'body':{'type':Sequelize[_0x5827('0x3')](_0x5827('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5827('0x3')](_0x5827('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x5827('0x6')]('in',_0x5827('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x5827('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x5827('0x4'))},'cc':{'type':Sequelize[_0x5827('0x3')](_0x5827('0x4'))},'bcc':{'type':Sequelize[_0x5827('0x3')](_0x5827('0x4'))},'subject':{'type':Sequelize[_0x5827('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x5827('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x5827('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x5827('0xb')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x5827('0x6')](_0x5827('0xc'),_0x5827('0xd')),'defaultValue':_0x5827('0xc'),'allowNull':![]}}; \ No newline at end of file +var _0x9f75=['long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','lodash','TEXT'];(function(_0x1f50e9,_0x30a1fc){var _0x2302e0=function(_0x35623c){while(--_0x35623c){_0x1f50e9['push'](_0x1f50e9['shift']());}};_0x2302e0(++_0x30a1fc);}(_0x9f75,0x65));var _0x59f7=function(_0x2810cd,_0x50e1c3){_0x2810cd=_0x2810cd-0x0;var _0x325ed1=_0x9f75[_0x2810cd];return _0x325ed1;};'use strict';var Sequelize=require(_0x59f7('0x0'));var _=require(_0x59f7('0x1'));module['exports']={'body':{'type':Sequelize[_0x59f7('0x2')](_0x59f7('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x59f7('0x2')](_0x59f7('0x4'))},'read':{'type':Sequelize[_0x59f7('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x59f7('0x6')]('in','out'),'defaultValue':_0x59f7('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x59f7('0x8')](0x1fe)},'from':{'type':Sequelize[_0x59f7('0x8')]},'to':{'type':Sequelize[_0x59f7('0x2')](_0x59f7('0x3'))},'cc':{'type':Sequelize[_0x59f7('0x2')](_0x59f7('0x3'))},'bcc':{'type':Sequelize[_0x59f7('0x2')](_0x59f7('0x3'))},'subject':{'type':Sequelize[_0x59f7('0x2')]},'sentAt':{'type':Sequelize[_0x59f7('0x9')]},'attach':{'type':Sequelize[_0x59f7('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x59f7('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize['TEXT'](_0x59f7('0x3'))},'originCc':{'type':Sequelize[_0x59f7('0x2')](_0x59f7('0x3'))},'originChannel':{'type':Sequelize[_0x59f7('0x6')](_0x59f7('0xb'),_0x59f7('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 1915022..f56e9e9 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(_0x113a7c,_0x5c860e){var _0x2f6fdc=function(_0x3ea61d){while(--_0x3ea61d){_0x113a7c['push'](_0x113a7c['shift']());}};_0x2f6fdc(++_0x5c860e);}(_0x7217,0x19e));var _0x7721=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7217[_0x24237f];return _0x48298e;};'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 _0xedd9=['params','describe','create','secret','split','MailAccount','MailAccountId','List','CmContact','updatedAt','DESC','MailServerOut','Smtp','isNil','port','secure','authentication','auth','service','user','pass','attachments','join','server/files/attachments','defaults','ListId','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','agent','UserId','MailInteraction','MailInteractionId','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','sequelize','Sequelize','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','reject','fromString','rejectmessage','unix','toString','root','server','files','tmp','message-%s.eml','from','subject','createdAt','headers','bcc','Bcc','Attachments','basename','existsSync','readFileSync','build','download','unlinkSync','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','redis','localhost','socket.io-emitter','register','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','json','undefined','limit','count','offset','Content-Range','update','then','destroy','status','end','sendStatus','stack','name','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','filters','find','body'];(function(_0x4efd0d,_0x5f5b41){var _0x7e36f8=function(_0x34bee2){while(--_0x34bee2){_0x4efd0d['push'](_0x4efd0d['shift']());}};_0x7e36f8(++_0x5f5b41);}(_0xedd9,0xfc));var _0x9edd=function(_0x13c4b5,_0x1e2b80){_0x13c4b5=_0x13c4b5-0x0;var _0xab5f07=_0xedd9[_0x13c4b5];return _0xab5f07;};'use strict';var emlformat=require('eml-format');var moment=require(_0x9edd('0x0'));var BPromise=require(_0x9edd('0x1'));var util=require(_0x9edd('0x2'));var path=require(_0x9edd('0x3'));var fs=require('fs');var _=require(_0x9edd('0x4'));var Redis=require(_0x9edd('0x5'));var htmlToText=require(_0x9edd('0x6'));var qs=require(_0x9edd('0x7'));var logger=require('../../config/logger')(_0x9edd('0x8'));var interaction_log=require(_0x9edd('0x9'))(_0x9edd('0xa'));var config=require(_0x9edd('0xb'));var db=require('../../mysqldb')['db'];config[_0x9edd('0xc')]=_['defaults'](config[_0x9edd('0xc')],{'host':_0x9edd('0xd'),'port':0x18eb});var socket=require(_0x9edd('0xe'))(new Redis(config[_0x9edd('0xc')]));require('./mailMessage.socket')[_0x9edd('0xf')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9edd('0x10')][_0x9edd('0x11')]({'port':0x232c});var client9003=jayson['client'][_0x9edd('0x11')]({'port':0x232b});var client9002=jayson[_0x9edd('0x10')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30c0d7,_0x1b73d1,_0x25e64c,_0xfd544a){return new BPromise(function(_0x287ddd,_0x3a7b84){var _0xfca576=_0xfd544a||client;return _0xfca576[_0x9edd('0x12')](_0x30c0d7,_0x25e64c)['then'](function(_0x176bfa){logger[_0x9edd('0x13')](_0x9edd('0x14'),_0x1b73d1,_0x9edd('0x15'));logger[_0x9edd('0x16')](_0x9edd('0x17'),_0x1b73d1,_0x9edd('0x15'),JSON[_0x9edd('0x18')](_0x176bfa));if(_0x176bfa['error']){if(_0x176bfa[_0x9edd('0x19')][_0x9edd('0x1a')]===0x1f4){logger[_0x9edd('0x19')]('MailMessage,\x20%s,\x20%s',_0x1b73d1,_0x176bfa[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x3a7b84(_0x176bfa[_0x9edd('0x19')]['message']);}logger[_0x9edd('0x19')]('MailMessage,\x20%s,\x20%s',_0x1b73d1,_0x176bfa[_0x9edd('0x19')][_0x9edd('0x1b')]);return _0x287ddd(_0x176bfa['error']['message']);}else{logger[_0x9edd('0x13')]('MailMessage,\x20%s,\x20%s',_0x1b73d1,_0x9edd('0x15'));_0x287ddd(_0x176bfa['result']['message']);}})[_0x9edd('0x1c')](function(_0x1c46a8){logger['error']('MailMessage,\x20%s,\x20%s',_0x1b73d1,_0x1c46a8);_0x3a7b84(_0x1c46a8);});});}function respondWithResult(_0x341d67,_0x186186){_0x186186=_0x186186||0xc8;return function(_0x477878){if(_0x477878){return _0x341d67['status'](_0x186186)[_0x9edd('0x1d')](_0x477878);}};}function respondWithFilteredResult(_0x1dca43,_0x44a6c1){return function(_0x2ca65f){if(_0x2ca65f){var _0x339a0d=typeof _0x44a6c1['offset']===_0x9edd('0x1e')&&typeof _0x44a6c1[_0x9edd('0x1f')]===_0x9edd('0x1e');var _0x2f9f86=_0x2ca65f[_0x9edd('0x20')];var _0x4d507f=_0x339a0d?0x0:_0x44a6c1['offset'];var _0x3276ee=_0x339a0d?_0x2ca65f[_0x9edd('0x20')]:_0x44a6c1[_0x9edd('0x21')]+_0x44a6c1[_0x9edd('0x1f')];var _0x3c2227;if(_0x3276ee>=_0x2f9f86){_0x3276ee=_0x2f9f86;_0x3c2227=0xc8;}else{_0x3c2227=0xce;}_0x1dca43['status'](_0x3c2227);return _0x1dca43['set'](_0x9edd('0x22'),_0x4d507f+'-'+_0x3276ee+'/'+_0x2f9f86)[_0x9edd('0x1d')](_0x2ca65f);}return null;};}function saveUpdates(_0x1c762c){return function(_0x52746a){if(_0x52746a){return _0x52746a[_0x9edd('0x23')](_0x1c762c)[_0x9edd('0x24')](function(_0x2ae8dd){return _0x2ae8dd;});}return null;};}function removeEntity(_0x41af53){return function(_0x5eccfb){if(_0x5eccfb){return _0x5eccfb[_0x9edd('0x25')]()[_0x9edd('0x24')](function(){_0x41af53[_0x9edd('0x26')](0xcc)[_0x9edd('0x27')]();});}};}function handleEntityNotFound(_0xbbf08f){return function(_0x42e664){if(!_0x42e664){_0xbbf08f[_0x9edd('0x28')](0x194);}return _0x42e664;};}function handleError(_0x1fba7b,_0x19b6c1){_0x19b6c1=_0x19b6c1||0x1f4;return function(_0x1c2e2b){logger[_0x9edd('0x19')](_0x1c2e2b[_0x9edd('0x29')]);if(_0x1c2e2b[_0x9edd('0x2a')]){delete _0x1c2e2b[_0x9edd('0x2a')];}_0x1fba7b[_0x9edd('0x26')](_0x19b6c1)['send'](_0x1c2e2b);};}exports[_0x9edd('0x2b')]=function(_0x259259,_0x267c74){var _0x5d1707={},_0x2d2f88={},_0x3990fb={'count':0x0,'rows':[]};var _0xde9b13=_[_0x9edd('0x2c')](db[_0x9edd('0x2d')][_0x9edd('0x2e')],function(_0x473068){return{'name':_0x473068[_0x9edd('0x2f')],'type':_0x473068[_0x9edd('0x30')][_0x9edd('0x31')]};});_0x2d2f88[_0x9edd('0x32')]=_[_0x9edd('0x2c')](_0xde9b13,_0x9edd('0x2a'));_0x2d2f88[_0x9edd('0x33')]=_['keys'](_0x259259[_0x9edd('0x33')]);_0x2d2f88['filters']=_[_0x9edd('0x34')](_0x2d2f88[_0x9edd('0x32')],_0x2d2f88[_0x9edd('0x33')]);_0x5d1707[_0x9edd('0x35')]=_[_0x9edd('0x34')](_0x2d2f88['model'],qs[_0x9edd('0x36')](_0x259259[_0x9edd('0x33')][_0x9edd('0x36')]));_0x5d1707[_0x9edd('0x35')]=_0x5d1707[_0x9edd('0x35')][_0x9edd('0x37')]?_0x5d1707[_0x9edd('0x35')]:_0x2d2f88[_0x9edd('0x32')];if(!_0x259259[_0x9edd('0x33')][_0x9edd('0x38')]('nolimit')){_0x5d1707[_0x9edd('0x1f')]=qs['limit'](_0x259259[_0x9edd('0x33')]['limit']);_0x5d1707[_0x9edd('0x21')]=qs[_0x9edd('0x21')](_0x259259[_0x9edd('0x33')]['offset']);}_0x5d1707[_0x9edd('0x39')]=qs[_0x9edd('0x3a')](_0x259259[_0x9edd('0x33')]['sort']);_0x5d1707[_0x9edd('0x3b')]=qs['filters'](_[_0x9edd('0x3c')](_0x259259[_0x9edd('0x33')],_0x2d2f88['filters']),_0xde9b13);if(_0x259259[_0x9edd('0x33')][_0x9edd('0x3d')]){_0x5d1707[_0x9edd('0x3b')]=_[_0x9edd('0x3e')](_0x5d1707['where'],{'$or':_[_0x9edd('0x2c')](_0xde9b13,function(_0x5bbdf8){if(_0x5bbdf8[_0x9edd('0x30')]!==_0x9edd('0x3f')){var _0x587d74={};_0x587d74[_0x5bbdf8[_0x9edd('0x2a')]]={'$like':'%'+_0x259259['query']['filter']+'%'};return _0x587d74;}})});}_0x5d1707=_[_0x9edd('0x3e')]({},_0x5d1707,_0x259259[_0x9edd('0x40')]);var _0x1f276b={'where':_0x5d1707[_0x9edd('0x3b')]};return db[_0x9edd('0x2d')][_0x9edd('0x20')](_0x1f276b)[_0x9edd('0x24')](function(_0x75efbe){_0x3990fb[_0x9edd('0x20')]=_0x75efbe;if(_0x259259[_0x9edd('0x33')][_0x9edd('0x41')]){_0x5d1707[_0x9edd('0x42')]=[{'all':!![]}];}return db[_0x9edd('0x2d')][_0x9edd('0x43')](_0x5d1707);})[_0x9edd('0x24')](function(_0x5416f8){_0x3990fb[_0x9edd('0x44')]=_0x5416f8;return _0x3990fb;})[_0x9edd('0x24')](respondWithFilteredResult(_0x267c74,_0x5d1707))[_0x9edd('0x1c')](handleError(_0x267c74,null));};exports[_0x9edd('0x45')]=function(_0x241929,_0x3ecdfd){var _0x10d41e={'raw':!![],'where':{'id':_0x241929['params']['id']}},_0x4e9ad1={};_0x4e9ad1['model']=_[_0x9edd('0x46')](db['MailMessage'][_0x9edd('0x2e')]);_0x4e9ad1[_0x9edd('0x33')]=_[_0x9edd('0x46')](_0x241929[_0x9edd('0x33')]);_0x4e9ad1[_0x9edd('0x47')]=_['intersection'](_0x4e9ad1[_0x9edd('0x32')],_0x4e9ad1[_0x9edd('0x33')]);_0x10d41e[_0x9edd('0x35')]=_['intersection'](_0x4e9ad1[_0x9edd('0x32')],qs[_0x9edd('0x36')](_0x241929[_0x9edd('0x33')][_0x9edd('0x36')]));_0x10d41e[_0x9edd('0x35')]=_0x10d41e[_0x9edd('0x35')]['length']?_0x10d41e[_0x9edd('0x35')]:_0x4e9ad1[_0x9edd('0x32')];if(_0x241929['query'][_0x9edd('0x41')]){_0x10d41e[_0x9edd('0x42')]=[{'all':!![]}];}_0x10d41e=_['merge']({},_0x10d41e,_0x241929[_0x9edd('0x40')]);return db[_0x9edd('0x2d')][_0x9edd('0x48')](_0x10d41e)['then'](handleEntityNotFound(_0x3ecdfd,null))[_0x9edd('0x24')](respondWithResult(_0x3ecdfd,null))[_0x9edd('0x1c')](handleError(_0x3ecdfd,null));};exports[_0x9edd('0x23')]=function(_0x28c7bd,_0x53f6e3){if(_0x28c7bd[_0x9edd('0x49')]['id']){delete _0x28c7bd[_0x9edd('0x49')]['id'];}return db[_0x9edd('0x2d')]['find']({'where':{'id':_0x28c7bd[_0x9edd('0x4a')]['id']}})[_0x9edd('0x24')](handleEntityNotFound(_0x53f6e3,null))['then'](saveUpdates(_0x28c7bd[_0x9edd('0x49')],null))['then'](respondWithResult(_0x53f6e3,null))[_0x9edd('0x1c')](handleError(_0x53f6e3,null));};exports[_0x9edd('0x25')]=function(_0x24245f,_0x3fcdf5){return db[_0x9edd('0x2d')][_0x9edd('0x48')]({'where':{'id':_0x24245f[_0x9edd('0x4a')]['id']}})[_0x9edd('0x24')](handleEntityNotFound(_0x3fcdf5,null))[_0x9edd('0x24')](removeEntity(_0x3fcdf5,null))[_0x9edd('0x1c')](handleError(_0x3fcdf5,null));};exports[_0x9edd('0x4b')]=function(_0x5a3b1d,_0x161bea){return db[_0x9edd('0x2d')][_0x9edd('0x4b')]()['then'](respondWithResult(_0x161bea,null))[_0x9edd('0x1c')](handleError(_0x161bea,null));};exports['create']=function(_0x54d83d,_0x54ecfa){return db[_0x9edd('0x2d')][_0x9edd('0x4c')](_0x54d83d[_0x9edd('0x49')])[_0x9edd('0x24')](function(_0x48a900){if(_0x48a900){if(_0x48a900['direction']==='out'&&!_0x48a900[_0x9edd('0x4d')]){var _0x5f666b,_0xd5090a,_0x1091ff;if(_0x54d83d[_0x9edd('0x49')]['to']){_0xd5090a=_0x54d83d[_0x9edd('0x49')]['to'][_0x9edd('0x4e')](',')[0x0];}return db[_0x9edd('0x4f')]['findOne']({'where':{'id':_0x48a900[_0x9edd('0x50')]},'include':[{'model':db['CmList'],'as':_0x9edd('0x51'),'include':[{'model':db[_0x9edd('0x52')],'as':'Contacts','where':{'email':_0xd5090a},'limit':0x1,'order':[[_0x9edd('0x53'),_0x9edd('0x54')]]}]},{'model':db[_0x9edd('0x55')],'as':'Smtp','raw':!![]}]})[_0x9edd('0x24')](function(_0x2e1ce3){_0x5f666b=_0x2e1ce3;if(_0x5f666b&&_0x5f666b[_0x9edd('0x56')]){var _0x15ebfa={'tls':{'rejectUnauthorized':![]}};if(_[_0x9edd('0x57')](_0x5f666b[_0x9edd('0x56')]['service'])){_0x15ebfa['host']=_0x5f666b[_0x9edd('0x56')]['host'];_0x15ebfa[_0x9edd('0x58')]=_0x5f666b[_0x9edd('0x56')][_0x9edd('0x58')];_0x15ebfa[_0x9edd('0x59')]=_0x5f666b['Smtp'][_0x9edd('0x59')];if(_0x5f666b['Smtp'][_0x9edd('0x5a')]){_0x15ebfa[_0x9edd('0x5b')]={'user':_0x5f666b[_0x9edd('0x56')]['user'],'pass':_0x5f666b[_0x9edd('0x56')]['pass']};}}else{_0x15ebfa[_0x9edd('0x5c')]=_0x5f666b[_0x9edd('0x56')]['service'];_0x15ebfa[_0x9edd('0x5b')]={'user':_0x5f666b['Smtp'][_0x9edd('0x5d')],'pass':_0x5f666b[_0x9edd('0x56')][_0x9edd('0x5e')]};_0x15ebfa['secure']=_0x5f666b[_0x9edd('0x56')][_0x9edd('0x59')];}if(_0x54d83d[_0x9edd('0x49')][_0x9edd('0x5f')]&&_0x54d83d[_0x9edd('0x49')]['attachments']['length']){for(var _0x2e1a96=0x0;_0x2e1a96<_0x54d83d[_0x9edd('0x49')]['attachments']['length'];_0x2e1a96+=0x1){_0x54d83d['body'][_0x9edd('0x5f')][_0x2e1a96]={'filename':_0x54d83d['body']['attachments'][_0x2e1a96][_0x9edd('0x2a')],'path':path[_0x9edd('0x60')](config['root'],_0x9edd('0x61'),_0x54d83d[_0x9edd('0x49')][_0x9edd('0x5f')][_0x2e1a96]['basename'])};}}_0x1091ff={'account':_0x15ebfa,'message':_0x54d83d[_0x9edd('0x49')]};return;}})['then'](function(){if(_0x5f666b[_0x9edd('0x51')]){if(_0x5f666b[_0x9edd('0x51')]['Contacts'][_0x9edd('0x37')]){return _0x5f666b[_0x9edd('0x51')]['Contacts'][0x0];}else{return db[_0x9edd('0x52')][_0x9edd('0x4c')](_[_0x9edd('0x62')](_0x54d83d[_0x9edd('0x49')],{'firstName':_0x54d83d['body']['to'],'email':_0x54d83d[_0x9edd('0x49')]['to'],'phone':_0x54d83d['body']['to'],'ListId':_0x5f666b[_0x9edd('0x63')]}));}}else{throw new Error(_0x9edd('0x64'));}})[_0x9edd('0x24')](function(){if(_0x1091ff){return respondWithRpcPromise('SendMail',_0x9edd('0x65'),_0x1091ff,client9003)[_0x9edd('0x24')](function(_0x130dba){return _0x48a900[_0x9edd('0x23')]({'read':!![],'messageId':_0x130dba[_0x9edd('0x66')],'sentAt':moment()[_0x9edd('0x67')](_0x9edd('0x68'))});})['catch'](function(_0x5e29d0){logger[_0x9edd('0x19')]('%s',JSON[_0x9edd('0x18')](_0x5e29d0));return _0x48a900;});}return _0x48a900;});}return _0x48a900;}})[_0x9edd('0x24')](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x1c')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x69')]=function(_0x52f6f3,_0x2e40c8){var _0x5d56a={'agent':{},'channel':_0x9edd('0x6a')};if(_0x52f6f3['body']['id']){delete _0x52f6f3[_0x9edd('0x49')]['id'];}_0x52f6f3[_0x9edd('0x49')]['read']=!![];_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6b')]=moment()['format'](_0x9edd('0x68'));_0x52f6f3[_0x9edd('0x49')]['UserId']=_0x52f6f3[_0x9edd('0x49')]['UserId']||_0x52f6f3['user']['id'];_0x5d56a[_0x9edd('0x6c')]['id']=_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6d')];return db['MailMessage'][_0x9edd('0x48')]({'where':{'id':_0x52f6f3[_0x9edd('0x4a')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2e40c8,null))[_0x9edd('0x24')](saveUpdates(_0x52f6f3[_0x9edd('0x49')],null))[_0x9edd('0x24')](function(_0x1ad198){if(_0x1ad198){_0x5d56a['message']=_0x1ad198['get']({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'id':_0x1ad198[_0x9edd('0x6f')]}});}return null;})[_0x9edd('0x24')](handleEntityNotFound(_0x2e40c8,null))[_0x9edd('0x24')](function(_0x3cfd35){if(_0x3cfd35){return _0x3cfd35[_0x9edd('0x23')]({'UserId':_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6d')],'read1stAt':_[_0x9edd('0x57')](_0x3cfd35[_0x9edd('0x70')])?moment()['format'](_0x9edd('0x68')):undefined});}return null;})[_0x9edd('0x24')](function(_0x2c7562){if(_0x2c7562){_0x5d56a[_0x9edd('0x71')]=_0x2c7562[_0x9edd('0x72')]({'plain':!![]});interaction_log[_0x9edd('0x13')](_0x9edd('0x73'),_0x52f6f3['user']['id'],_0x52f6f3[_0x9edd('0x5d')][_0x9edd('0x2a')],_0x52f6f3['user'][_0x9edd('0x74')],_0x5d56a[_0x9edd('0x71')]['id'],_0x52f6f3['body']?JSON[_0x9edd('0x18')](_0x52f6f3[_0x9edd('0x49')]):_0x9edd('0x75'));return respondWithRpcPromise('AcceptMessage',_0x9edd('0x76'),_0x5d56a);}return null;})[_0x9edd('0x24')](function(_0x3f04d3){var _0x5a7de3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3f04d3['message']['ContactId'];return db[_0x9edd('0x77')][_0x9edd('0x33')](_0x5a7de3,{'type':db[_0x9edd('0x78')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x56d794){return _0x56d794;});})[_0x9edd('0x24')](function(_0x20762d){if(_0x20762d){_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x79')]=_0x20762d[0x0];if(!_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6d')])return;return db[_0x9edd('0x7a')][_0x9edd('0x48')]({'where':{'id':_0x52f6f3[_0x9edd('0x49')][_0x9edd('0x6d')],'role':_0x9edd('0x6c')},'attributes':['id','name',_0x9edd('0x7b'),_0x9edd('0x7c'),_0x9edd('0x7d')],'raw':!![]});}return null;})[_0x9edd('0x24')](function(_0x104afc){if(!_0x104afc)return null;_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x6c')]=_0x104afc;return _0x5d56a;})[_0x9edd('0x24')](function(_0x4a7889){if(_0x4a7889){if(_0x52f6f3['body'][_0x9edd('0x7e')]){_0x5d56a['message'][_0x9edd('0x7f')]=util['format'](_0x9edd('0x80'),_0x52f6f3[_0x9edd('0x5d')]['name']);_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x81')]=_0x5d56a['channel'];_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x82')]=_0x9edd('0x69');_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x49')]=htmlToText['fromString'](_0x5d56a[_0x9edd('0x1b')][_0x9edd('0x49')]);return respondWithRpcPromise(_0x9edd('0x83'),_0x9edd('0x83'),{'event':_0x9edd('0x84'),'message':_0x5d56a['message']},client9002)['then'](function(){return _0x5d56a;});}return _0x5d56a;}return null;})['then'](respondWithResult(_0x2e40c8,null))['catch'](handleError(_0x2e40c8,null));};exports['reject']=function(_0x2da088,_0x5d566e){var _0x58cb3f={'agent':{},'channel':_0x9edd('0x6a')};if(_0x2da088[_0x9edd('0x49')]['id']){delete _0x2da088[_0x9edd('0x49')]['id'];}_0x2da088[_0x9edd('0x49')][_0x9edd('0x6d')]=_0x2da088[_0x9edd('0x49')][_0x9edd('0x6d')]||_0x2da088[_0x9edd('0x5d')]['id'];_0x58cb3f[_0x9edd('0x6c')]['id']=_0x2da088[_0x9edd('0x49')]['UserId'];return db[_0x9edd('0x2d')][_0x9edd('0x48')]({'where':{'id':_0x2da088[_0x9edd('0x4a')]['id'],'UserId':null}})[_0x9edd('0x24')](handleEntityNotFound(_0x5d566e,null))[_0x9edd('0x24')](function(_0x23e925){if(_0x23e925){_0x58cb3f[_0x9edd('0x1b')]=_0x23e925[_0x9edd('0x72')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x23e925[_0x9edd('0x6f')]}});}return null;})[_0x9edd('0x24')](handleEntityNotFound(_0x5d566e,null))[_0x9edd('0x24')](function(_0x120d0f){if(_0x120d0f){_0x58cb3f[_0x9edd('0x71')]=_0x120d0f[_0x9edd('0x72')]({'plain':!![]});interaction_log[_0x9edd('0x13')](_0x9edd('0x85'),_0x2da088[_0x9edd('0x5d')]['id'],_0x2da088[_0x9edd('0x5d')][_0x9edd('0x2a')],_0x2da088[_0x9edd('0x5d')][_0x9edd('0x74')],_0x58cb3f[_0x9edd('0x71')]['id'],_0x2da088['body']?JSON[_0x9edd('0x18')](_0x2da088[_0x9edd('0x49')]):'null');return respondWithRpcPromise(_0x9edd('0x86'),_0x9edd('0x87'),_0x58cb3f);}return null;})[_0x9edd('0x24')](function(_0x2b4d4c){var _0x559503=_0x9edd('0x88')+_0x2b4d4c[_0x9edd('0x1b')][_0x9edd('0x89')];return db[_0x9edd('0x77')][_0x9edd('0x33')](_0x559503,{'type':db['Sequelize'][_0x9edd('0x8a')][_0x9edd('0x8b')],'raw':!![]})[_0x9edd('0x24')](function(_0x4633eb){return _0x4633eb;});})[_0x9edd('0x24')](function(_0x59927d){if(_0x59927d){_0x58cb3f['message'][_0x9edd('0x79')]=_0x59927d[0x0];if(!_0x2da088['body'][_0x9edd('0x6d')])return;return db['User'][_0x9edd('0x48')]({'where':{'id':_0x2da088[_0x9edd('0x49')][_0x9edd('0x6d')],'role':_0x9edd('0x6c')},'attributes':['id',_0x9edd('0x2a'),_0x9edd('0x7b'),'email',_0x9edd('0x7d')],'raw':!![]});}return null;})[_0x9edd('0x24')](function(_0x3aae72){if(!_0x3aae72)return null;_0x58cb3f[_0x9edd('0x1b')][_0x9edd('0x6c')]=_0x3aae72;return _0x58cb3f;})[_0x9edd('0x24')](function(_0x2f8fb6){if(_0x2f8fb6){_0x2f8fb6[_0x9edd('0x1b')]['interface']=util[_0x9edd('0x67')](_0x9edd('0x80'),_0x2da088[_0x9edd('0x5d')][_0x9edd('0x2a')]);_0x2f8fb6[_0x9edd('0x1b')][_0x9edd('0x81')]=_0x58cb3f[_0x9edd('0x81')];_0x2f8fb6[_0x9edd('0x1b')][_0x9edd('0x82')]=_0x9edd('0x8c');_0x2f8fb6[_0x9edd('0x1b')][_0x9edd('0x49')]=htmlToText[_0x9edd('0x8d')](_0x58cb3f[_0x9edd('0x1b')][_0x9edd('0x49')]);respondWithRpcPromise(_0x9edd('0x83'),_0x9edd('0x83'),{'event':_0x9edd('0x8e'),'message':_0x2f8fb6[_0x9edd('0x1b')]},client9002);return _0x58cb3f;}return null;})[_0x9edd('0x24')](respondWithResult(_0x5d566e,null))[_0x9edd('0x1c')](handleError(_0x5d566e,null));};exports['download']=function(_0xa704eb,_0x553018){var _0x4ca7e4=moment()[_0x9edd('0x8f')]()[_0x9edd('0x90')]();var _0x220c00=path[_0x9edd('0x60')](config[_0x9edd('0x91')],_0x9edd('0x92'),_0x9edd('0x93'),_0x9edd('0x94'));var _0x3e5a45=path[_0x9edd('0x60')](config['root'],_0x9edd('0x92'),_0x9edd('0x93'),'attachments');var _0x568067=util[_0x9edd('0x67')](_0x9edd('0x95'),_0x4ca7e4);return db[_0x9edd('0x2d')][_0x9edd('0x48')]({'where':{'id':_0xa704eb['params']['id']},'attributes':['id','body',_0x9edd('0x96'),'to','cc','bcc',_0x9edd('0x97'),_0x9edd('0x98')],'include':_0xa704eb[_0x9edd('0x33')]['attachments']?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x9edd('0x24')](handleEntityNotFound(_0x553018,null))[_0x9edd('0x24')](function(_0x7b0fc8){if(_0x7b0fc8){var _0x5bfbfd=_0x7b0fc8;var _0xb2e72={'from':_0x5bfbfd[_0x9edd('0x96')],'to':_0x5bfbfd['to'],'subject':_0x5bfbfd['subject'],'html':_0x5bfbfd[_0x9edd('0x49')],'headers':{'Date':moment(_0x5bfbfd[_0x9edd('0x98')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x7b0fc8['cc']){_0xb2e72[_0x9edd('0x99')]['Cc']=_0x7b0fc8['cc'];}if(_0x7b0fc8[_0x9edd('0x9a')]){_0xb2e72['headers'][_0x9edd('0x9b')]=_0x7b0fc8[_0x9edd('0x9a')];}return new BPromise(function(_0x54c6a0,_0x201d76){if(_0x7b0fc8['Attachments']){for(var _0x308a0f=0x0;_0x308a0f<_0x7b0fc8[_0x9edd('0x9c')][_0x9edd('0x37')];_0x308a0f++){var _0x742e13=_0x7b0fc8[_0x9edd('0x9c')][_0x308a0f];var _0x3e6426=path['join'](_0x3e5a45,_0x742e13[_0x9edd('0x9d')]);if(fs[_0x9edd('0x9e')](_0x3e6426)){_0xb2e72[_0x9edd('0x5f')]['push']({'name':_0x742e13[_0x9edd('0x2a')],'contentType':_0x742e13['type'],'data':fs[_0x9edd('0x9f')](_0x3e6426)});}}}emlformat[_0x9edd('0xa0')](_0xb2e72,function(_0x25da04,_0x41b0ea){if(_0x25da04)return _0x201d76(_0x25da04);fs['writeFileSync'](path['join'](_0x220c00,_0x568067),_0x41b0ea);return _0x54c6a0(_0x41b0ea);});});}})['then'](function(_0x12dcfa){if(_0x12dcfa){return _0x553018[_0x9edd('0xa1')](path[_0x9edd('0x60')](_0x220c00,_0x568067),_0x568067,function(_0x50af78){if(!_0x50af78)fs[_0x9edd('0xa2')](path[_0x9edd('0x60')](_0x220c00,_0x568067));});}})[_0x9edd('0x1c')](handleError(_0x553018,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 23f992c..fbb3f7c 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 _0x34fc=['../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x12742b,_0x357c7e){var _0x47cd8=function(_0x55a8a7){while(--_0x55a8a7){_0x12742b['push'](_0x12742b['shift']());}};_0x47cd8(++_0x357c7e);}(_0x34fc,0x170));var _0xc34f=function(_0x3feb42,_0x3425d7){_0x3feb42=_0x3feb42-0x0;var _0x54edc2=_0x34fc[_0x3feb42];return _0x54edc2;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xc34f('0x0'))['db'][_0xc34f('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc34f('0x2'),'afterUpdate':_0xc34f('0x3'),'afterDestroy':_0xc34f('0x4')};function emitEvent(_0x3591f1){return function(_0x18d32c,_0x41eabe,_0x16bb6a){MailMessageEvents[_0xc34f('0x5')](_0x3591f1+':'+_0x18d32c['id'],_0x18d32c);MailMessageEvents['emit'](_0x3591f1,_0x18d32c);_0x16bb6a(null);};}for(var e in events){if(events[_0xc34f('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xc34f('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x2d92=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5d5177,_0x24d3c8){var _0x195c11=function(_0x5e4f32){while(--_0x5e4f32){_0x5d5177['push'](_0x5d5177['shift']());}};_0x195c11(++_0x24d3c8);}(_0x2d92,0x18c));var _0x22d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d92[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x22d9('0x0'));var MailMessage=require(_0x22d9('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x22d9('0x2')](0x0);var events={'afterCreate':_0x22d9('0x3'),'afterUpdate':_0x22d9('0x4'),'afterDestroy':_0x22d9('0x5')};function emitEvent(_0x27f1f7){return function(_0x5005e7,_0x2ae340,_0x24d250){MailMessageEvents[_0x22d9('0x6')](_0x27f1f7+':'+_0x5005e7['id'],_0x5005e7);MailMessageEvents[_0x22d9('0x6')](_0x27f1f7,_0x5005e7);_0x24d250(null);};}for(var e in events){if(events[_0x22d9('0x7')](e)){var event=events[e];MailMessage[_0x22d9('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 761cafa..422cc85 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 _0x8aaf=['fti_mail_messages','plainBody','subject','FULLTEXT','body','models','direction','toLowerCase','out','isNil','UserId','findOne','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','MailMessage','messageId'];(function(_0x2be39d,_0x24d0f1){var _0x36d216=function(_0x10fec0){while(--_0x10fec0){_0x2be39d['push'](_0x2be39d['shift']());}};_0x36d216(++_0x24d0f1);}(_0x8aaf,0x128));var _0xf8aa=function(_0x37a051,_0x1adc10){_0x37a051=_0x37a051-0x0;var _0x4cf9a4=_0x8aaf[_0x37a051];return _0x4cf9a4;};'use strict';var _=require(_0xf8aa('0x0'));var util=require(_0xf8aa('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf8aa('0x2'));var BPromise=require(_0xf8aa('0x3'));var rp=require('request-promise');var htmlToText=require(_0xf8aa('0x4'));var fs=require('fs');var path=require(_0xf8aa('0x5'));var rimraf=require(_0xf8aa('0x6'));var config=require(_0xf8aa('0x7'));var attributes=require(_0xf8aa('0x8'));module[_0xf8aa('0x9')]=function(_0x26c296,_0x231655){return _0x26c296['define'](_0xf8aa('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xf8aa('0xb'),'fields':[_0xf8aa('0xb')]},{'name':_0xf8aa('0xc'),'fields':[_0xf8aa('0xd'),_0xf8aa('0xe')],'type':_0xf8aa('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x9d3cae,_0x549914,_0x59875d){if(_0x9d3cae[_0xf8aa('0x10')]){_0x9d3cae[_0xf8aa('0xd')]=htmlToText['fromString'](_0x9d3cae[_0xf8aa('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x59875d(null,_0x549914);},'afterCreate':function(_0x253df6,_0x1500ff,_0x413e72){var _0x529e7d=_0x26c296[_0xf8aa('0x11')];var _0x38fdbf=_0x253df6['get']({'plain':!![]});if(_0x38fdbf[_0xf8aa('0x12')][_0xf8aa('0x13')]()==='in'||_0x38fdbf[_0xf8aa('0x12')]['toLowerCase']()===_0xf8aa('0x14')&&!_0x38fdbf['secret']&&!_[_0xf8aa('0x15')](_0x38fdbf[_0xf8aa('0x16')])){_0x529e7d['MailInteraction'][_0xf8aa('0x17')]({'where':{'id':_0x38fdbf['MailInteractionId']}})['then'](function(_0x1c35b5){if(_0x1c35b5){_0x1c35b5[_0xf8aa('0x18')]({'lastMsgAt':_0x38fdbf['createdAt'],'lastMsgDirection':_0x38fdbf[_0xf8aa('0x12')][_0xf8aa('0x13')]()});}})['catch'](function(_0x1bff55){console[_0xf8aa('0x19')](_0x1bff55);});}_0x413e72();}},'charset':_0xf8aa('0x1a'),'collate':_0xf8aa('0x1b')});}; \ No newline at end of file +var _0xdae1=['UserId','MailInteraction','findOne','then','update','createdAt','error','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','toLowerCase','direction','out','secret','isNil'];(function(_0x3d3f6c,_0x39da52){var _0x4a34c7=function(_0x41be02){while(--_0x41be02){_0x3d3f6c['push'](_0x3d3f6c['shift']());}};_0x4a34c7(++_0x39da52);}(_0xdae1,0x90));var _0x1dae=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xdae1[_0x68ee8b];return _0x5148f7;};'use strict';var _=require('lodash');var util=require(_0x1dae('0x0'));var logger=require('../../config/logger')(_0x1dae('0x1'));var moment=require(_0x1dae('0x2'));var BPromise=require(_0x1dae('0x3'));var rp=require(_0x1dae('0x4'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x1dae('0x5'));var rimraf=require(_0x1dae('0x6'));var config=require(_0x1dae('0x7'));var attributes=require(_0x1dae('0x8'));module[_0x1dae('0x9')]=function(_0x35468e,_0x4337c9){return _0x35468e[_0x1dae('0xa')](_0x1dae('0xb'),attributes,{'tableName':_0x1dae('0xc'),'paranoid':![],'indexes':[{'name':_0x1dae('0xd'),'fields':[_0x1dae('0xd')]},{'name':_0x1dae('0xe'),'fields':[_0x1dae('0xf'),_0x1dae('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3f44fa,_0x375d42,_0x4161b7){if(_0x3f44fa[_0x1dae('0x11')]){_0x3f44fa[_0x1dae('0xf')]=htmlToText[_0x1dae('0x12')](_0x3f44fa[_0x1dae('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4161b7(null,_0x375d42);},'afterCreate':function(_0x27b845,_0x1b3b63,_0x1d8aa2){var _0x2c738f=_0x35468e[_0x1dae('0x13')];var _0x52a5c8=_0x27b845[_0x1dae('0x14')]({'plain':!![]});if(_0x52a5c8['direction'][_0x1dae('0x15')]()==='in'||_0x52a5c8[_0x1dae('0x16')][_0x1dae('0x15')]()===_0x1dae('0x17')&&!_0x52a5c8[_0x1dae('0x18')]&&!_[_0x1dae('0x19')](_0x52a5c8[_0x1dae('0x1a')])){_0x2c738f[_0x1dae('0x1b')][_0x1dae('0x1c')]({'where':{'id':_0x52a5c8['MailInteractionId']}})[_0x1dae('0x1d')](function(_0x1bcf71){if(_0x1bcf71){_0x1bcf71[_0x1dae('0x1e')]({'lastMsgAt':_0x52a5c8[_0x1dae('0x1f')],'lastMsgDirection':_0x52a5c8[_0x1dae('0x16')][_0x1dae('0x15')]()});}})['catch'](function(_0x3f1ccd){console[_0x1dae('0x20')](_0x3f1ccd);});}_0x1d8aa2();}},'charset':'utf8mb4','collate':_0x1dae('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 62d9467..fef5ecd 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 _0x5b12=['MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','create','options','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','defaults','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x5b12,0xa3));var _0x25b1=function(_0x1b68c5,_0x8bc8a3){_0x1b68c5=_0x1b68c5-0x0;var _0x23940b=_0x5b12[_0x1b68c5];return _0x23940b;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});config['redis']=_[_0x25b1('0x8')](config[_0x25b1('0x9')],{'host':_0x25b1('0xa'),'port':0x18eb});var socket=require(_0x25b1('0xb'))(new Redis(config[_0x25b1('0x9')]));require(_0x25b1('0xc'))[_0x25b1('0xd')](socket);function respondWithRpcPromise(_0x6235e2,_0x5b7224,_0x2b739e){return new BPromise(function(_0x1c28cf,_0x2cee35){return client[_0x25b1('0xe')](_0x6235e2,_0x2b739e)[_0x25b1('0xf')](function(_0x8a71af){logger[_0x25b1('0x10')](_0x25b1('0x11'),_0x5b7224,_0x25b1('0x12'));logger[_0x25b1('0x13')](_0x25b1('0x14'),_0x5b7224,_0x25b1('0x12'),JSON[_0x25b1('0x15')](_0x8a71af));if(_0x8a71af[_0x25b1('0x16')]){if(_0x8a71af[_0x25b1('0x16')][_0x25b1('0x17')]===0x1f4){logger['error'](_0x25b1('0x11'),_0x5b7224,_0x8a71af[_0x25b1('0x16')]['message']);return _0x2cee35(_0x8a71af[_0x25b1('0x16')][_0x25b1('0x18')]);}logger[_0x25b1('0x16')]('MailMessage,\x20%s,\x20%s',_0x5b7224,_0x8a71af['error'][_0x25b1('0x18')]);return _0x1c28cf(_0x8a71af['error'][_0x25b1('0x18')]);}else{logger[_0x25b1('0x10')](_0x25b1('0x11'),_0x5b7224,_0x25b1('0x12'));_0x1c28cf(_0x8a71af[_0x25b1('0x19')][_0x25b1('0x18')]);}})[_0x25b1('0x1a')](function(_0x292463){logger['error']('MailMessage,\x20%s,\x20%s',_0x5b7224,_0x292463);_0x2cee35(_0x292463);});});}exports[_0x25b1('0x1b')]=function(_0x501dc8){var _0x174f4a=this;return new Promise(function(_0x50ae0f,_0x3bfd7d){return db['MailMessage'][_0x25b1('0x1c')](_0x501dc8['body'],{'raw':_0x501dc8[_0x25b1('0x1d')]?_0x501dc8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x3bca9f){logger[_0x25b1('0x10')]('CreateMailMessage',_0x501dc8);logger[_0x25b1('0x13')](_0x25b1('0x1b'),_0x501dc8,JSON[_0x25b1('0x15')](_0x3bca9f));_0x50ae0f(_0x3bca9f);})[_0x25b1('0x1a')](function(_0x1aabbb){logger['error'](_0x25b1('0x1b'),_0x1aabbb[_0x25b1('0x18')],_0x501dc8);_0x3bfd7d(_0x174f4a[_0x25b1('0x16')](0x1f4,_0x1aabbb[_0x25b1('0x18')]));});});}; \ No newline at end of file +var _0xfff0=['rpc','../../config/environment','client','http','redis','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','create','body','options','CreateMailMessage','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x3695e5,_0x4fd15b){var _0x1b1190=function(_0x557522){while(--_0x557522){_0x3695e5['push'](_0x3695e5['shift']());}};_0x1b1190(++_0x4fd15b);}(_0xfff0,0x139));var _0x0fff=function(_0x478fff,_0xe0314e){_0x478fff=_0x478fff-0x0;var _0x37e349=_0xfff0[_0x478fff];return _0x37e349;};'use strict';var _=require('lodash');var util=require(_0x0fff('0x0'));var moment=require(_0x0fff('0x1'));var BPromise=require(_0x0fff('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0fff('0x3'));var db=require(_0x0fff('0x4'))['db'];var utils=require(_0x0fff('0x5'));var logger=require('../../config/logger')(_0x0fff('0x6'));var config=require(_0x0fff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0fff('0x8')][_0x0fff('0x9')]({'port':0x232a});config[_0x0fff('0xa')]=_['defaults'](config[_0x0fff('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0fff('0xb'))(new Redis(config['redis']));require(_0x0fff('0xc'))[_0x0fff('0xd')](socket);function respondWithRpcPromise(_0x4cc3f3,_0x227d28,_0x377b2f){return new BPromise(function(_0x1de923,_0x289e01){return client[_0x0fff('0xe')](_0x4cc3f3,_0x377b2f)[_0x0fff('0xf')](function(_0x363c0d){logger[_0x0fff('0x10')](_0x0fff('0x11'),_0x227d28,_0x0fff('0x12'));logger[_0x0fff('0x13')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x227d28,_0x0fff('0x12'),JSON['stringify'](_0x363c0d));if(_0x363c0d[_0x0fff('0x14')]){if(_0x363c0d[_0x0fff('0x14')][_0x0fff('0x15')]===0x1f4){logger[_0x0fff('0x14')]('MailMessage,\x20%s,\x20%s',_0x227d28,_0x363c0d['error'][_0x0fff('0x16')]);return _0x289e01(_0x363c0d['error']['message']);}logger['error'](_0x0fff('0x11'),_0x227d28,_0x363c0d[_0x0fff('0x14')]['message']);return _0x1de923(_0x363c0d[_0x0fff('0x14')][_0x0fff('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x227d28,'request\x20sent');_0x1de923(_0x363c0d[_0x0fff('0x17')][_0x0fff('0x16')]);}})[_0x0fff('0x18')](function(_0x3762dc){logger[_0x0fff('0x14')](_0x0fff('0x11'),_0x227d28,_0x3762dc);_0x289e01(_0x3762dc);});});}exports['CreateMailMessage']=function(_0x44a54a){var _0x136520=this;return new Promise(function(_0x48e6f9,_0x49d211){return db['MailMessage'][_0x0fff('0x19')](_0x44a54a[_0x0fff('0x1a')],{'raw':_0x44a54a[_0x0fff('0x1b')]?_0x44a54a[_0x0fff('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x0fff('0xf')](function(_0x2f8665){logger[_0x0fff('0x10')](_0x0fff('0x1c'),_0x44a54a);logger[_0x0fff('0x13')](_0x0fff('0x1c'),_0x44a54a,JSON['stringify'](_0x2f8665));_0x48e6f9(_0x2f8665);})[_0x0fff('0x18')](function(_0x29f702){logger[_0x0fff('0x14')](_0x0fff('0x1c'),_0x29f702[_0x0fff('0x16')],_0x44a54a);_0x49d211(_0x136520[_0x0fff('0x14')](0x1f4,_0x29f702['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 7c53d2d..03006a5 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 _0x7dc2=['update','emit','length','mailMessage:','./mailMessage.events','save','remove'];(function(_0x14b188,_0x24b12b){var _0x1888c0=function(_0x5f5dc0){while(--_0x5f5dc0){_0x14b188['push'](_0x14b188['shift']());}};_0x1888c0(++_0x24b12b);}(_0x7dc2,0xeb));var _0x27dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7dc2[_0x20a584];return _0x4b41a8;};'use strict';var MailMessageEvents=require(_0x27dc('0x0'));var events=[_0x27dc('0x1'),_0x27dc('0x2'),_0x27dc('0x3')];function createListener(_0x4b88cf,_0x1c7e17){return function(_0x577933){_0x1c7e17[_0x27dc('0x4')](_0x4b88cf,_0x577933);};}function removeListener(_0x2e9340,_0x274bd3){return function(){MailMessageEvents['removeListener'](_0x2e9340,_0x274bd3);};}exports['register']=function(_0x1c7d69){for(var _0x140cf9=0x0,_0x18b976=events[_0x27dc('0x5')];_0x140cf9<_0x18b976;_0x140cf9++){var _0x565944=events[_0x140cf9];var _0x4fe150=createListener(_0x27dc('0x6')+_0x565944,_0x1c7d69);MailMessageEvents['on'](_0x565944,_0x4fe150);}}; \ No newline at end of file +var _0xb2b3=['mailMessage:','./mailMessage.events','save','remove','update','removeListener','register','length'];(function(_0x2fc571,_0x408679){var _0x22dfb5=function(_0x5c2829){while(--_0x5c2829){_0x2fc571['push'](_0x2fc571['shift']());}};_0x22dfb5(++_0x408679);}(_0xb2b3,0x71));var _0x3b2b=function(_0x2e17f9,_0x1fe9e9){_0x2e17f9=_0x2e17f9-0x0;var _0x1dcbfb=_0xb2b3[_0x2e17f9];return _0x1dcbfb;};'use strict';var MailMessageEvents=require(_0x3b2b('0x0'));var events=[_0x3b2b('0x1'),_0x3b2b('0x2'),_0x3b2b('0x3')];function createListener(_0xf005ed,_0x3de73b){return function(_0x2059f0){_0x3de73b['emit'](_0xf005ed,_0x2059f0);};}function removeListener(_0x3eff63,_0x222c10){return function(){MailMessageEvents[_0x3b2b('0x4')](_0x3eff63,_0x222c10);};}exports[_0x3b2b('0x5')]=function(_0x2581eb){for(var _0xc53a84=0x0,_0x83e7ef=events[_0x3b2b('0x6')];_0xc53a84<_0x83e7ef;_0xc53a84++){var _0x1a9054=events[_0xc53a84];var _0x3ec416=createListener(_0x3b2b('0x7')+_0x1a9054,_0x2581eb);MailMessageEvents['on'](_0x1a9054,_0x3ec416);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index c5cd92a..0e84fe2 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 _0x276f=['getTeams','/:id/users','getAgents','create','addTeams','post','addAgents','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','getMembers','/:id/teams'];(function(_0x533e41,_0x3f6738){var _0x1756b0=function(_0x14d389){while(--_0x14d389){_0x533e41['push'](_0x533e41['shift']());}};_0x1756b0(++_0x3f6738);}(_0x276f,0x1a2));var _0xf276=function(_0x5461f2,_0x325588){_0x5461f2=_0x5461f2-0x0;var _0x2e4d62=_0x276f[_0x5461f2];return _0x2e4d62;};'use strict';var multer=require(_0xf276('0x0'));var util=require(_0xf276('0x1'));var path=require(_0xf276('0x2'));var timeout=require(_0xf276('0x3'));var express=require(_0xf276('0x4'));var router=express[_0xf276('0x5')]();var fs_extra=require(_0xf276('0x6'));var auth=require(_0xf276('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf276('0x8'));var controller=require('./mailQueue.controller');router[_0xf276('0x9')]('/',auth[_0xf276('0xa')](),controller[_0xf276('0xb')]);router[_0xf276('0x9')](_0xf276('0xc'),auth[_0xf276('0xa')](),controller[_0xf276('0xd')]);router[_0xf276('0x9')](_0xf276('0xe'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/members',auth[_0xf276('0xa')](),controller[_0xf276('0xf')]);router[_0xf276('0x9')](_0xf276('0x10'),auth[_0xf276('0xa')](),controller[_0xf276('0x11')]);router['get'](_0xf276('0x12'),auth[_0xf276('0xa')](),controller[_0xf276('0x13')]);router['post']('/',auth[_0xf276('0xa')](),controller[_0xf276('0x14')]);router['post'](_0xf276('0x10'),auth[_0xf276('0xa')](),controller[_0xf276('0x15')]);router[_0xf276('0x16')](_0xf276('0x12'),auth[_0xf276('0xa')](),controller[_0xf276('0x17')]);router[_0xf276('0x18')](_0xf276('0xe'),auth['isAuthenticated'](),controller[_0xf276('0x19')]);router[_0xf276('0x1a')]('/:id',auth[_0xf276('0xa')](),controller[_0xf276('0x1b')]);router['delete']('/:id/teams',auth[_0xf276('0xa')](),controller['removeTeams']);router[_0xf276('0x1a')](_0xf276('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xf276('0x1c')]=router; \ No newline at end of file +var _0x5145=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','update','destroy','delete','exports','multer','util','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5145,0x102));var _0x5514=function(_0x2c3135,_0x38e21f){_0x2c3135=_0x2c3135-0x0;var _0x333704=_0x5145[_0x2c3135];return _0x333704;};'use strict';var multer=require(_0x5514('0x0'));var util=require(_0x5514('0x1'));var path=require(_0x5514('0x2'));var timeout=require(_0x5514('0x3'));var express=require(_0x5514('0x4'));var router=express[_0x5514('0x5')]();var fs_extra=require(_0x5514('0x6'));var auth=require(_0x5514('0x7'));var interaction=require(_0x5514('0x8'));var config=require(_0x5514('0x9'));var controller=require(_0x5514('0xa'));router[_0x5514('0xb')]('/',auth[_0x5514('0xc')](),controller['index']);router[_0x5514('0xb')](_0x5514('0xd'),auth[_0x5514('0xc')](),controller[_0x5514('0xe')]);router['get'](_0x5514('0xf'),auth[_0x5514('0xc')](),controller[_0x5514('0x10')]);router['get']('/:id/members',auth[_0x5514('0xc')](),controller[_0x5514('0x11')]);router[_0x5514('0xb')](_0x5514('0x12'),auth['isAuthenticated'](),controller[_0x5514('0x13')]);router[_0x5514('0xb')](_0x5514('0x14'),auth['isAuthenticated'](),controller['getAgents']);router[_0x5514('0x15')]('/',auth[_0x5514('0xc')](),controller[_0x5514('0x16')]);router[_0x5514('0x15')](_0x5514('0x12'),auth[_0x5514('0xc')](),controller['addTeams']);router[_0x5514('0x15')](_0x5514('0x14'),auth[_0x5514('0xc')](),controller[_0x5514('0x17')]);router[_0x5514('0x18')](_0x5514('0xf'),auth['isAuthenticated'](),controller[_0x5514('0x19')]);router['delete']('/:id',auth[_0x5514('0xc')](),controller[_0x5514('0x1a')]);router[_0x5514('0x1b')]('/:id/teams',auth[_0x5514('0xc')](),controller['removeTeams']);router[_0x5514('0x1b')](_0x5514('0x14'),auth[_0x5514('0xc')](),controller['removeAgents']);module[_0x5514('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 58395d8..138ac92 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 _0x8622=['name','INTEGER','ENUM','beepall','exports','STRING'];(function(_0x25289a,_0x4e9fee){var _0x579ab9=function(_0x3b23f3){while(--_0x3b23f3){_0x25289a['push'](_0x25289a['shift']());}};_0x579ab9(++_0x4e9fee);}(_0x8622,0xe2));var _0x2862=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8622[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x2862('0x0')]={'name':{'type':Sequelize[_0x2862('0x1')],'unique':_0x2862('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2862('0x1')]},'timeout':{'type':Sequelize[_0x2862('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2862('0x4')]('rrmemory',_0x2862('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x0093=['STRING','INTEGER','ENUM','roundrobin'];(function(_0x10b7b1,_0x1f83b6){var _0x49caf4=function(_0x36dee7){while(--_0x36dee7){_0x10b7b1['push'](_0x10b7b1['shift']());}};_0x49caf4(++_0x1f83b6);}(_0x0093,0xec));var _0x3009=function(_0xf69f10,_0x1a2637){_0xf69f10=_0xf69f10-0x0;var _0x50d82e=_0x0093[_0xf69f10];return _0x50d82e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3009('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x3009('0x0')]},'timeout':{'type':Sequelize[_0x3009('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3009('0x2')]('rrmemory','beepall',_0x3009('0x3'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 589f049..820114d 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 _0x878f=['MailQueue','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','error','body','describe','getMembers','findOne','hasOwnProperty','MailQueueId','filter','UserMailQueue','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','Agents','online','voicePause','flatMap','sequelize','transaction','each','forEach','userMailQueue:save','ids','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','SELECT','every','TeamId','includes','all','union','compact','removeTeams','removeAgents','addAgents','omit','spread','emit','isArray','userMailQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','map'];(function(_0x17bc96,_0x340d18){var _0x40c246=function(_0x45903f){while(--_0x45903f){_0x17bc96['push'](_0x17bc96['shift']());}};_0x40c246(++_0x340d18);}(_0x878f,0x173));var _0xf878=function(_0xafd503,_0x2cef60){_0xafd503=_0xafd503-0x0;var _0x476398=_0x878f[_0xafd503];return _0x476398;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf878('0x0'));var zipdir=require(_0xf878('0x1'));var jsonpatch=require(_0xf878('0x2'));var rp=require(_0xf878('0x3'));var moment=require(_0xf878('0x4'));var BPromise=require(_0xf878('0x5'));var Mustache=require(_0xf878('0x6'));var util=require(_0xf878('0x7'));var path=require(_0xf878('0x8'));var sox=require(_0xf878('0x9'));var csv=require(_0xf878('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf878('0xb'));var squel=require(_0xf878('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf878('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf878('0xd'));var authService=require(_0xf878('0xe'));var qs=require(_0xf878('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf878('0x10'));var logger=require(_0xf878('0x11'))('api');var utils=require(_0xf878('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xf878('0x13'));var db=require(_0xf878('0x14'))['db'];config[_0xf878('0x15')]=_['defaults'](config[_0xf878('0x15')],{'host':_0xf878('0x16'),'port':0x18eb});var socket=require(_0xf878('0x17'))(new Redis(config['redis']));require(_0xf878('0x18'))[_0xf878('0x19')](socket);function respondWithStatusCode(_0x119e9e,_0x492260){_0x492260=_0x492260||0xcc;return function(_0x568a3a){if(_0x568a3a){return _0x119e9e[_0xf878('0x1a')](_0x492260);}return _0x119e9e[_0xf878('0x1b')](_0x492260)[_0xf878('0x1c')]();};}function respondWithResult(_0x6dbeca,_0x44aacc){_0x44aacc=_0x44aacc||0xc8;return function(_0x186a02){if(_0x186a02){return _0x6dbeca[_0xf878('0x1b')](_0x44aacc)[_0xf878('0x1d')](_0x186a02);}};}function respondWithFilteredResult(_0x3c5dee,_0x3a55f3){return function(_0x3b2e1b){if(_0x3b2e1b){var _0x47a91a=typeof _0x3a55f3[_0xf878('0x1e')]===_0xf878('0x1f')&&typeof _0x3a55f3[_0xf878('0x20')]===_0xf878('0x1f');var _0x3714f6=_0x3b2e1b[_0xf878('0x21')];var _0x17089c=_0x47a91a?0x0:_0x3a55f3['offset'];var _0x73f6bf=_0x47a91a?_0x3b2e1b[_0xf878('0x21')]:_0x3a55f3[_0xf878('0x1e')]+_0x3a55f3['limit'];var _0x432e5d;if(_0x73f6bf>=_0x3714f6){_0x73f6bf=_0x3714f6;_0x432e5d=0xc8;}else{_0x432e5d=0xce;}_0x3c5dee[_0xf878('0x1b')](_0x432e5d);return _0x3c5dee[_0xf878('0x22')](_0xf878('0x23'),_0x17089c+'-'+_0x73f6bf+'/'+_0x3714f6)[_0xf878('0x1d')](_0x3b2e1b);}return null;};}function patchUpdates(_0x442450){return function(_0x1cbc92){try{jsonpatch[_0xf878('0x24')](_0x1cbc92,_0x442450,!![]);}catch(_0x212436){return BPromise[_0xf878('0x25')](_0x212436);}return _0x1cbc92[_0xf878('0x26')]();};}function saveUpdates(_0x566995,_0x2ac38b){return function(_0x5b0b06){if(_0x5b0b06){return _0x5b0b06[_0xf878('0x27')](_0x566995)[_0xf878('0x28')](function(_0x35b3b4){return _0x35b3b4;});}return null;};}function removeEntity(_0x280036,_0x20449e){return function(_0x5ebaa0){if(_0x5ebaa0){return _0x5ebaa0['destroy']()['then'](function(){var _0x242926=_0x5ebaa0[_0xf878('0x29')]({'plain':!![]});var _0x38fa87='MailQueues';return db[_0xf878('0x2a')][_0xf878('0x2b')]({'where':{'type':_0x38fa87,'resourceId':_0x242926['id']}})[_0xf878('0x28')](function(){return _0x5ebaa0;});})[_0xf878('0x28')](function(){_0x280036[_0xf878('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x502322,_0x9a127d){return function(_0x5d9c97){if(!_0x5d9c97){_0x502322['sendStatus'](0x194);}return _0x5d9c97;};}function handleError(_0x31e2e1,_0x52da83){_0x52da83=_0x52da83||0x1f4;return function(_0x969ee3){logger['error'](_0x969ee3[_0xf878('0x2c')]);if(_0x969ee3['name']){delete _0x969ee3[_0xf878('0x2d')];}_0x31e2e1['status'](_0x52da83)[_0xf878('0x2e')](_0x969ee3);};}exports[_0xf878('0x2f')]=function(_0x233a00,_0x1f5331){var _0x27c53b={},_0x716782={},_0x5aed48={'count':0x0,'rows':[]};var _0x3b8fa5=_[_0xf878('0x30')](db[_0xf878('0x31')][_0xf878('0x32')],function(_0xd11e68){return{'name':_0xd11e68['fieldName'],'type':_0xd11e68[_0xf878('0x33')][_0xf878('0x34')]};});_0x716782['model']=_[_0xf878('0x30')](_0x3b8fa5,_0xf878('0x2d'));_0x716782[_0xf878('0x35')]=_[_0xf878('0x36')](_0x233a00[_0xf878('0x35')]);_0x716782['filters']=_[_0xf878('0x37')](_0x716782[_0xf878('0x38')],_0x716782[_0xf878('0x35')]);_0x27c53b[_0xf878('0x39')]=_['intersection'](_0x716782[_0xf878('0x38')],qs['fields'](_0x233a00['query'][_0xf878('0x3a')]));_0x27c53b[_0xf878('0x39')]=_0x27c53b[_0xf878('0x39')][_0xf878('0x3b')]?_0x27c53b[_0xf878('0x39')]:_0x716782['model'];if(!_0x233a00[_0xf878('0x35')]['hasOwnProperty'](_0xf878('0x3c'))){_0x27c53b[_0xf878('0x20')]=qs['limit'](_0x233a00[_0xf878('0x35')][_0xf878('0x20')]);_0x27c53b['offset']=qs[_0xf878('0x1e')](_0x233a00[_0xf878('0x35')]['offset']);}_0x27c53b[_0xf878('0x3d')]=qs[_0xf878('0x3e')](_0x233a00[_0xf878('0x35')][_0xf878('0x3e')]);_0x27c53b[_0xf878('0x3f')]=qs[_0xf878('0x40')](_[_0xf878('0x41')](_0x233a00['query'],_0x716782[_0xf878('0x40')]),_0x3b8fa5);if(_0x233a00[_0xf878('0x35')]['filter']){_0x27c53b[_0xf878('0x3f')]=_['merge'](_0x27c53b['where'],{'$or':_[_0xf878('0x30')](_0x3b8fa5,function(_0x379fc1){if(_0x379fc1[_0xf878('0x33')]!==_0xf878('0x42')){var _0x1b2eb0={};_0x1b2eb0[_0x379fc1['name']]={'$like':'%'+_0x233a00[_0xf878('0x35')]['filter']+'%'};return _0x1b2eb0;}})});}_0x27c53b=_[_0xf878('0x43')]({},_0x27c53b,_0x233a00[_0xf878('0x44')]);var _0x4f6be1={'where':_0x27c53b['where']};return db[_0xf878('0x31')][_0xf878('0x21')](_0x4f6be1)[_0xf878('0x28')](function(_0x2f6ee5){_0x5aed48[_0xf878('0x21')]=_0x2f6ee5;if(_0x233a00[_0xf878('0x35')][_0xf878('0x45')]){_0x27c53b[_0xf878('0x46')]=[{'all':!![]}];}return db[_0xf878('0x31')]['findAll'](_0x27c53b);})[_0xf878('0x28')](function(_0x21b4fb){_0x5aed48[_0xf878('0x47')]=_0x21b4fb;return _0x5aed48;})[_0xf878('0x28')](respondWithFilteredResult(_0x1f5331,_0x27c53b))[_0xf878('0x48')](handleError(_0x1f5331,null));};exports[_0xf878('0x49')]=function(_0x47dbfa,_0xc14b89){var _0xf055ce={'raw':!![],'where':{'id':_0x47dbfa[_0xf878('0x4a')]['id']}},_0x1f57d0={};_0x1f57d0[_0xf878('0x38')]=_['keys'](db[_0xf878('0x31')][_0xf878('0x32')]);_0x1f57d0[_0xf878('0x35')]=_[_0xf878('0x36')](_0x47dbfa['query']);_0x1f57d0[_0xf878('0x40')]=_[_0xf878('0x37')](_0x1f57d0[_0xf878('0x38')],_0x1f57d0['query']);_0xf055ce['attributes']=_[_0xf878('0x37')](_0x1f57d0['model'],qs['fields'](_0x47dbfa['query'][_0xf878('0x3a')]));_0xf055ce['attributes']=_0xf055ce[_0xf878('0x39')][_0xf878('0x3b')]?_0xf055ce[_0xf878('0x39')]:_0x1f57d0[_0xf878('0x38')];if(_0x47dbfa[_0xf878('0x35')][_0xf878('0x45')]){_0xf055ce[_0xf878('0x46')]=[{'all':!![]}];}_0xf055ce=_['merge']({},_0xf055ce,_0x47dbfa[_0xf878('0x44')]);return db[_0xf878('0x31')][_0xf878('0x4b')](_0xf055ce)[_0xf878('0x28')](handleEntityNotFound(_0xc14b89,null))[_0xf878('0x28')](respondWithResult(_0xc14b89,null))['catch'](handleError(_0xc14b89,null));};exports['create']=function(_0xb4f8fb,_0x18c9dc){return db['MailQueue'][_0xf878('0x4c')](_0xb4f8fb['body'],{})[_0xf878('0x28')](function(_0x31adde){var _0x379912=_0xb4f8fb[_0xf878('0x4d')]['get']({'plain':!![]});if(!_0x379912)throw new Error(_0xf878('0x4e'));if(_0x379912[_0xf878('0x4f')]===_0xf878('0x4d')){var _0x5a88d1=_0x31adde[_0xf878('0x29')]({'plain':!![]});var _0x30df05=_0xf878('0x50');return db[_0xf878('0x51')]['find']({'where':{'name':_0x30df05,'userProfileId':_0x379912[_0xf878('0x52')]},'raw':!![]})[_0xf878('0x28')](function(_0x3f9fce){if(_0x3f9fce&&_0x3f9fce['autoAssociation']===0x0){return db[_0xf878('0x2a')][_0xf878('0x4c')]({'name':_0x5a88d1[_0xf878('0x2d')],'resourceId':_0x5a88d1['id'],'type':_0x3f9fce[_0xf878('0x2d')],'sectionId':_0x3f9fce['id']},{})['then'](function(){return _0x31adde;});}else{return _0x31adde;}})['catch'](function(_0x58b95f){logger[_0xf878('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x58b95f);throw _0x58b95f;});}return _0x31adde;})['then'](respondWithResult(_0x18c9dc,0xc9))['catch'](handleError(_0x18c9dc,null));};exports[_0xf878('0x27')]=function(_0xf844a8,_0x5caa6d){if(_0xf844a8[_0xf878('0x54')]['id']){delete _0xf844a8[_0xf878('0x54')]['id'];}return db[_0xf878('0x31')]['find']({'where':{'id':_0xf844a8['params']['id']}})[_0xf878('0x28')](handleEntityNotFound(_0x5caa6d,null))['then'](saveUpdates(_0xf844a8[_0xf878('0x54')],null))[_0xf878('0x28')](respondWithResult(_0x5caa6d,null))[_0xf878('0x48')](handleError(_0x5caa6d,null));};exports[_0xf878('0x2b')]=function(_0x143801,_0x344aa4){return db['MailQueue'][_0xf878('0x4b')]({'where':{'id':_0x143801[_0xf878('0x4a')]['id']}})['then'](handleEntityNotFound(_0x344aa4,null))[_0xf878('0x28')](removeEntity(_0x344aa4,null))[_0xf878('0x48')](handleError(_0x344aa4,null));};exports[_0xf878('0x55')]=function(_0x282985,_0x263f26){return db[_0xf878('0x31')][_0xf878('0x55')]()['then'](respondWithResult(_0x263f26,null))[_0xf878('0x48')](handleError(_0x263f26,null));};exports[_0xf878('0x56')]=function(_0xedcf9d,_0x52b94e,_0x392242){var _0x560e0b={'raw':!![],'where':{}},_0x44325d={},_0x10c48c;return db[_0xf878('0x31')][_0xf878('0x57')]({'where':{'id':_0xedcf9d[_0xf878('0x4a')]['id']}})[_0xf878('0x28')](handleEntityNotFound(_0x52b94e,null))[_0xf878('0x28')](function(_0x176c7c){if(_0x176c7c){_0x10c48c=_0x176c7c[_0xf878('0x29')]({'plain':!![]});_0x44325d[_0xf878('0x38')]=_['keys'](db['UserMailQueue']['rawAttributes']);_0x44325d[_0xf878('0x35')]=_['keys'](_0xedcf9d[_0xf878('0x35')]);_0x44325d[_0xf878('0x40')]=_['intersection'](_0x44325d['model'],_0x44325d[_0xf878('0x35')]);_0x560e0b[_0xf878('0x39')]=_[_0xf878('0x37')](_0x44325d[_0xf878('0x38')],qs[_0xf878('0x3a')](_0xedcf9d[_0xf878('0x35')][_0xf878('0x3a')]));_0x560e0b[_0xf878('0x39')]=_0x560e0b[_0xf878('0x39')][_0xf878('0x3b')]?_0x560e0b[_0xf878('0x39')]:_0x44325d[_0xf878('0x38')];if(!_0xedcf9d[_0xf878('0x35')][_0xf878('0x58')](_0xf878('0x3c'))){_0x560e0b[_0xf878('0x20')]=qs[_0xf878('0x20')](_0xedcf9d[_0xf878('0x35')]['limit']);_0x560e0b[_0xf878('0x1e')]=qs['offset'](_0xedcf9d[_0xf878('0x35')][_0xf878('0x1e')]);}_0x560e0b[_0xf878('0x3d')]=qs[_0xf878('0x3e')](_0xedcf9d[_0xf878('0x35')][_0xf878('0x3e')]);_0x560e0b[_0xf878('0x3f')]=qs[_0xf878('0x40')](_[_0xf878('0x41')](_0xedcf9d['query'],_0x44325d[_0xf878('0x40')]));_0x560e0b[_0xf878('0x3f')][_0xf878('0x59')]=_0x176c7c['id'];if(_0xedcf9d[_0xf878('0x35')]['filter']){_0x560e0b[_0xf878('0x3f')]=_[_0xf878('0x43')](_0x560e0b[_0xf878('0x3f')],{'$or':_[_0xf878('0x30')](_0x560e0b[_0xf878('0x39')],function(_0x5be758){var _0x5860f6={};_0x5860f6[_0x5be758]={'$like':'%'+_0xedcf9d[_0xf878('0x35')][_0xf878('0x5a')]+'%'};return _0x5860f6;})});}_0x560e0b=_[_0xf878('0x43')]({},_0x560e0b,_0xedcf9d[_0xf878('0x44')]);return db[_0xf878('0x5b')][_0xf878('0x5c')](_0x560e0b);}})[_0xf878('0x28')](function(_0x3bae55){if(_0x3bae55){return db[_0xf878('0x5d')][_0xf878('0x5e')]({'where':{'id':_[_0xf878('0x30')](_0x3bae55,_0xf878('0x5f')),'role':_0xf878('0x60')},'attributes':['id',_0xf878('0x2d'),_0xf878('0x61'),_0xf878('0x62'),_0xf878('0x63')]});}})['then'](function(_0x3ee3e0){if(_0x3ee3e0){return{'count':_0x3ee3e0[_0xf878('0x21')],'rows':_[_0xf878('0x30')](_0x3ee3e0[_0xf878('0x47')],function(_0x38e932){return{'membername':_0x38e932[_0xf878('0x2d')],'UserId':_0x38e932['id'],'queue_name':_0x10c48c[_0xf878('0x2d')],'MailQueueId':_0x10c48c['id'],'interface':util[_0xf878('0x64')](_0xf878('0x65'),'SIP',_0x38e932[_0xf878('0x2d')]),'penalty':0x0,'paused':_0x38e932[_0xf878('0x61')],'createdAt':_0x38e932[_0xf878('0x63')],'updatedAt':_0x38e932[_0xf878('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf878('0x28')](respondWithFilteredResult(_0x52b94e,_0x560e0b))[_0xf878('0x48')](handleError(_0x52b94e,null));};exports[_0xf878('0x66')]=function(_0x4d8104,_0x591b5e,_0x12859b){var _0x54ecdd={};var _0x338e77={};var _0x33b243;var _0x3a1862;return db[_0xf878('0x31')]['findOne']({'where':{'id':_0x4d8104[_0xf878('0x4a')]['id']}})[_0xf878('0x28')](handleEntityNotFound(_0x591b5e,null))[_0xf878('0x28')](function(_0x1403cf){if(_0x1403cf){_0x33b243=_0x1403cf;_0x338e77['model']=_[_0xf878('0x36')](db['Team'][_0xf878('0x32')]);_0x338e77[_0xf878('0x35')]=_[_0xf878('0x36')](_0x4d8104[_0xf878('0x35')]);_0x338e77[_0xf878('0x40')]=_['intersection'](_0x338e77[_0xf878('0x38')],_0x338e77[_0xf878('0x35')]);_0x54ecdd[_0xf878('0x39')]=_[_0xf878('0x37')](_0x338e77['model'],qs[_0xf878('0x3a')](_0x4d8104['query'][_0xf878('0x3a')]));_0x54ecdd[_0xf878('0x39')]=_0x54ecdd[_0xf878('0x39')][_0xf878('0x3b')]?_0x54ecdd[_0xf878('0x39')]:_0x338e77[_0xf878('0x38')];_0x54ecdd[_0xf878('0x3d')]=qs[_0xf878('0x3e')](_0x4d8104['query']['sort']);_0x54ecdd['where']=qs[_0xf878('0x40')](_[_0xf878('0x41')](_0x4d8104['query'],_0x338e77['filters']));if(_0x4d8104[_0xf878('0x35')]['filter']){_0x54ecdd[_0xf878('0x3f')]=_[_0xf878('0x43')](_0x54ecdd[_0xf878('0x3f')],{'$or':_[_0xf878('0x30')](_0x54ecdd[_0xf878('0x39')],function(_0x1d4827){var _0xc49d9e={};_0xc49d9e[_0x1d4827]={'$like':'%'+_0x4d8104[_0xf878('0x35')][_0xf878('0x5a')]+'%'};return _0xc49d9e;})});}_0x54ecdd=_['merge']({},_0x54ecdd,_0x4d8104[_0xf878('0x44')]);return _0x33b243[_0xf878('0x66')](_0x54ecdd);}})[_0xf878('0x28')](function(_0x4800cc){if(_0x4800cc){_0x3a1862=_0x4800cc[_0xf878('0x3b')];if(!_0x4d8104[_0xf878('0x35')]['hasOwnProperty'](_0xf878('0x3c'))){_0x54ecdd[_0xf878('0x20')]=qs[_0xf878('0x20')](_0x4d8104[_0xf878('0x35')][_0xf878('0x20')]);_0x54ecdd[_0xf878('0x1e')]=qs[_0xf878('0x1e')](_0x4d8104[_0xf878('0x35')]['offset']);}return _0x33b243[_0xf878('0x66')](_0x54ecdd);}})['then'](function(_0x58f8d8){if(_0x58f8d8){return _0x58f8d8?{'count':_0x3a1862,'rows':_0x58f8d8}:null;}})[_0xf878('0x28')](respondWithResult(_0x591b5e,null))[_0xf878('0x48')](handleError(_0x591b5e,null));};exports['addTeams']=function(_0x12a57f,_0x37c753,_0x1486e6){var _0xa0499=_0x12a57f[_0xf878('0x54')]['ids'];return db[_0xf878('0x67')][_0xf878('0x5c')]({'where':{'id':_0xa0499},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf878('0x68'),'attributes':['id',_0xf878('0x2d'),_0xf878('0x69'),_0xf878('0x6a'),'interface'],'raw':!![]}]})['then'](function(_0xaf9ba9){if(_0xaf9ba9){var _0x5adf7b=_[_0xf878('0x6b')](_0xaf9ba9,function(_0x1ea03d){var _0x19afe4=_0x1ea03d[_0xf878('0x29')]({'plain':!![]});return _0x19afe4[_0xf878('0x68')];});return db[_0xf878('0x31')][_0xf878('0x4b')]({'where':{'id':_0x12a57f[_0xf878('0x4a')]['id']}})[_0xf878('0x28')](function(_0x6de91a){return db[_0xf878('0x6c')][_0xf878('0x6d')](function(_0x1053d8){return _0x6de91a['addTeams'](_0xa0499,{'transaction':_0x1053d8})[_0xf878('0x28')](function(){return BPromise[_0xf878('0x6e')](_0x5adf7b,function(_0x333f5b){return db[_0xf878('0x5b')]['findOrCreate']({'where':{'UserId':_0x333f5b['id'],'MailQueueId':_0x12a57f[_0xf878('0x4a')]['id']},'transaction':_0x1053d8});});})['then'](function(){_0x5adf7b[_0xf878('0x6f')](function(_0x38a62f){socket['emit'](_0xf878('0x70'),{'UserId':_0x38a62f['id'],'MailQueueId':_0x6de91a['id']});});});});});}})[_0xf878('0x28')](respondWithStatusCode(_0x37c753,null))['catch'](handleError(_0x37c753,null));};exports['removeTeams']=function(_0x138f6f,_0x11ef6a,_0x11b5f6){return db[_0xf878('0x67')][_0xf878('0x5c')]({'where':{'id':_0x138f6f[_0xf878('0x35')][_0xf878('0x71')]},'attributes':['id'],'include':[{'model':db[_0xf878('0x5d')],'as':_0xf878('0x68'),'attributes':['id'],'raw':!![]}]})[_0xf878('0x28')](handleEntityNotFound(_0x11ef6a,null))['then'](function(_0x100b05){var _0x18fad8=_[_0xf878('0x30')](_0x100b05,'id');var _0x54cc44=[];var _0x3d4e43=[];var _0x482a2d=squel[_0xf878('0x72')]();_0x482a2d[_0xf878('0x73')]('tq.TeamId')[_0xf878('0x74')](_0xf878('0x75'),'tq')[_0xf878('0x76')](_0xf878('0x77'),'ut',_0xf878('0x78'))[_0xf878('0x3f')](_0xf878('0x79'),_0x138f6f['params']['id']);for(var _0x127d09=0x0;_0x127d09<_0x100b05[_0xf878('0x3b')];_0x127d09+=0x1){let _0x1523f8=_0x100b05[_0x127d09];for(var _0x58bf97=0x0;_0x58bf97<_0x1523f8['Agents'][_0xf878('0x3b')];_0x58bf97+=0x1){let _0x26c667=_0x1523f8['Agents'][_0x58bf97];var _0x13a66f=_0x482a2d[_0xf878('0x7a')]();_0x13a66f['where']('ut.UserId\x20=\x20?',_0x26c667['id']);_0x3d4e43['push'](db[_0xf878('0x6c')]['query'](_0x13a66f[_0xf878('0x7b')](),{'type':db[_0xf878('0x6c')]['QueryTypes'][_0xf878('0x7c')]})['then'](function(_0x3956b6){if(_0x3956b6[_0xf878('0x3b')]===0x1){return _0x26c667['id'];}else{var _0x345db6=_[_0xf878('0x7d')](_[_0xf878('0x30')](_0x3956b6,_0xf878('0x7e')),function(_0x8d90c){return _[_0xf878('0x7f')](_0x18fad8,_0x8d90c);});if(_0x345db6){return _0x26c667['id'];}}}));}}return BPromise[_0xf878('0x80')](_0x3d4e43)['then'](function(_0x31396f){_0x54cc44=_(_0x54cc44)[_0xf878('0x81')](_0x31396f)[_0xf878('0x82')]()['value']();return db[_0xf878('0x31')][_0xf878('0x4b')]({'where':{'id':_0x138f6f[_0xf878('0x4a')]['id']}})[_0xf878('0x28')](function(_0x132308){return db[_0xf878('0x6c')][_0xf878('0x6d')](function(_0x5cf765){return _0x132308[_0xf878('0x83')](_0x138f6f[_0xf878('0x35')][_0xf878('0x71')],{'transaction':_0x5cf765})['then'](function(){if(!_['isEmpty'](_0x54cc44)){return _0x132308[_0xf878('0x84')](_0x54cc44,{'transaction':_0x5cf765});}})[_0xf878('0x28')](function(){_0x54cc44[_0xf878('0x6f')](function(_0x184704){socket['emit']('userMailQueue:remove',{'UserId':_0x184704,'MailQueueId':_0x132308['id']});});});});});});})[_0xf878('0x28')](respondWithStatusCode(_0x11ef6a,null))[_0xf878('0x48')](handleError(_0x11ef6a,null));};exports[_0xf878('0x85')]=function(_0x4b2bec,_0x48a7ca,_0x2822fb){return db[_0xf878('0x31')][_0xf878('0x4b')]({'where':{'id':_0x4b2bec['params']['id']}})[_0xf878('0x28')](handleEntityNotFound(_0x48a7ca,null))[_0xf878('0x28')](function(_0xdba94b){if(_0xdba94b){return _0xdba94b[_0xf878('0x85')](_0x4b2bec[_0xf878('0x54')][_0xf878('0x71')],_[_0xf878('0x86')](_0x4b2bec[_0xf878('0x54')],[_0xf878('0x71'),'id'])||{})[_0xf878('0x87')](function(_0x3428d0){for(var _0x4017bf=0x0;_0x4017bf<_0x4b2bec[_0xf878('0x54')][_0xf878('0x71')][_0xf878('0x3b')];_0x4017bf+=0x1){socket[_0xf878('0x88')](_0xf878('0x70'),{'UserId':Number(_0x4b2bec[_0xf878('0x54')]['ids'][_0x4017bf]),'MailQueueId':Number(_0x4b2bec[_0xf878('0x4a')]['id'])});}return _0x3428d0;});}})[_0xf878('0x28')](respondWithResult(_0x48a7ca,null))[_0xf878('0x48')](handleError(_0x48a7ca,null));};exports[_0xf878('0x84')]=function(_0x19efa2,_0x39ea68,_0x556ca5){return db['MailQueue'][_0xf878('0x4b')]({'where':{'id':_0x19efa2[_0xf878('0x4a')]['id']}})[_0xf878('0x28')](handleEntityNotFound(_0x39ea68,null))[_0xf878('0x28')](function(_0x4cb5a3){if(_0x4cb5a3){return _0x4cb5a3['removeAgents'](_0x19efa2[_0xf878('0x35')][_0xf878('0x71')])[_0xf878('0x28')](function(){if(_[_0xf878('0x89')](_0x19efa2[_0xf878('0x35')][_0xf878('0x71')])){for(var _0x552e84=0x0;_0x552e84<_0x19efa2[_0xf878('0x35')][_0xf878('0x71')]['length'];_0x552e84+=0x1){socket[_0xf878('0x88')](_0xf878('0x8a'),{'UserId':Number(_0x19efa2[_0xf878('0x35')]['ids'][_0x552e84]),'MailQueueId':Number(_0x19efa2[_0xf878('0x4a')]['id'])});}}else{socket[_0xf878('0x88')]('userMailQueue:remove',{'UserId':Number(_0x19efa2[_0xf878('0x35')][_0xf878('0x71')]),'MailQueueId':Number(_0x19efa2[_0xf878('0x4a')]['id'])});}});}})[_0xf878('0x28')](respondWithStatusCode(_0x39ea68,null))[_0xf878('0x48')](handleError(_0x39ea68,null));};exports['getAgents']=function(_0x1ddc1f,_0x2548ac,_0x3e4092){var _0x1179cc={};var _0x4e0db6={};var _0x56700c;var _0x626b89;return db[_0xf878('0x31')][_0xf878('0x57')]({'where':{'id':_0x1ddc1f[_0xf878('0x4a')]['id']}})[_0xf878('0x28')](handleEntityNotFound(_0x2548ac,null))[_0xf878('0x28')](function(_0x1539a4){if(_0x1539a4){_0x56700c=_0x1539a4;_0x4e0db6[_0xf878('0x38')]=_[_0xf878('0x36')](db[_0xf878('0x5d')][_0xf878('0x32')]);_0x4e0db6[_0xf878('0x35')]=_['keys'](_0x1ddc1f['query']);_0x4e0db6['filters']=_['intersection'](_0x4e0db6[_0xf878('0x38')],_0x4e0db6['query']);_0x1179cc[_0xf878('0x39')]=_[_0xf878('0x37')](_0x4e0db6['model'],qs[_0xf878('0x3a')](_0x1ddc1f[_0xf878('0x35')]['fields']));_0x1179cc[_0xf878('0x39')]=_0x1179cc[_0xf878('0x39')]['length']?_0x1179cc['attributes']:_0x4e0db6[_0xf878('0x38')];_0x1179cc[_0xf878('0x3d')]=qs[_0xf878('0x3e')](_0x1ddc1f[_0xf878('0x35')]['sort']);_0x1179cc[_0xf878('0x3f')]=qs[_0xf878('0x40')](_[_0xf878('0x41')](_0x1ddc1f[_0xf878('0x35')],_0x4e0db6['filters']));if(_0x1ddc1f[_0xf878('0x35')]['filter']){_0x1179cc[_0xf878('0x3f')]=_[_0xf878('0x43')](_0x1179cc['where'],{'$or':_[_0xf878('0x30')](_0x1179cc['attributes'],function(_0x3b83b6){var _0x53f3af={};_0x53f3af[_0x3b83b6]={'$like':'%'+_0x1ddc1f['query'][_0xf878('0x5a')]+'%'};return _0x53f3af;})});}_0x1179cc=_['merge']({},_0x1179cc,_0x1ddc1f[_0xf878('0x44')]);return _0x56700c[_0xf878('0x8b')](_0x1179cc);}})[_0xf878('0x28')](function(_0x147a88){if(_0x147a88){_0x626b89=_0x147a88[_0xf878('0x3b')];if(!_0x1ddc1f[_0xf878('0x35')][_0xf878('0x58')]('nolimit')){_0x1179cc[_0xf878('0x20')]=qs['limit'](_0x1ddc1f[_0xf878('0x35')][_0xf878('0x20')]);_0x1179cc[_0xf878('0x1e')]=qs['offset'](_0x1ddc1f['query'][_0xf878('0x1e')]);}return _0x56700c[_0xf878('0x8b')](_0x1179cc);}})[_0xf878('0x28')](function(_0x2e261d){if(_0x2e261d){return _0x2e261d?{'count':_0x626b89,'rows':_0x2e261d}:null;}})[_0xf878('0x28')](respondWithResult(_0x2548ac,null))[_0xf878('0x48')](handleError(_0x2548ac,null));}; \ No newline at end of file +var _0x23c6=['attributes','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','MailQueues','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserMailQueue','length','hasOwnProperty','MailQueueId','findAndCountAll','agent','mailPause','updatedAt','format','%s/%s','SIP','createdAt','Team','pick','getTeams','addTeams','ids','User','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userMailQueue:save','removeTeams','Agents','select','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','every','TeamId','all','union','compact','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','omit','spread','getAgents','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','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','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','error','name','map','MailQueue','fieldName','type','key','model','query','keys','fields'];(function(_0x4ee9b5,_0x5c652e){var _0x1f1c81=function(_0x43c960){while(--_0x43c960){_0x4ee9b5['push'](_0x4ee9b5['shift']());}};_0x1f1c81(++_0x5c652e);}(_0x23c6,0xe1));var _0x623c=function(_0x10cb65,_0xa09d0b){_0x10cb65=_0x10cb65-0x0;var _0xeaa06a=_0x23c6[_0x10cb65];return _0xeaa06a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x623c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x623c('0x1'));var moment=require(_0x623c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x623c('0x3'));var util=require(_0x623c('0x4'));var path=require(_0x623c('0x5'));var sox=require(_0x623c('0x6'));var csv=require('to-csv');var ejs=require(_0x623c('0x7'));var fs=require('fs');var fs_extra=require(_0x623c('0x8'));var _=require(_0x623c('0x9'));var squel=require('squel');var crypto=require(_0x623c('0xa'));var jsforce=require(_0x623c('0xb'));var deskjs=require(_0x623c('0xc'));var toCsv=require(_0x623c('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x623c('0xe'));var authService=require(_0x623c('0xf'));var qs=require(_0x623c('0x10'));var as=require(_0x623c('0x11'));var hardwareService=require(_0x623c('0x12'));var logger=require(_0x623c('0x13'))(_0x623c('0x14'));var utils=require('../../config/utils');var config=require(_0x623c('0x15'));var licenseUtil=require(_0x623c('0x16'));var db=require(_0x623c('0x17'))['db'];config[_0x623c('0x18')]=_['defaults'](config[_0x623c('0x18')],{'host':_0x623c('0x19'),'port':0x18eb});var socket=require(_0x623c('0x1a'))(new Redis(config[_0x623c('0x18')]));require(_0x623c('0x1b'))[_0x623c('0x1c')](socket);function respondWithStatusCode(_0x232123,_0x2bbb2c){_0x2bbb2c=_0x2bbb2c||0xcc;return function(_0x47da2e){if(_0x47da2e){return _0x232123[_0x623c('0x1d')](_0x2bbb2c);}return _0x232123[_0x623c('0x1e')](_0x2bbb2c)[_0x623c('0x1f')]();};}function respondWithResult(_0x3e64af,_0x56012c){_0x56012c=_0x56012c||0xc8;return function(_0x1cc8a8){if(_0x1cc8a8){return _0x3e64af[_0x623c('0x1e')](_0x56012c)[_0x623c('0x20')](_0x1cc8a8);}};}function respondWithFilteredResult(_0x38a387,_0x5a61fd){return function(_0x3df56b){if(_0x3df56b){var _0x21ed5d=typeof _0x5a61fd[_0x623c('0x21')]===_0x623c('0x22')&&typeof _0x5a61fd[_0x623c('0x23')]==='undefined';var _0x4717ec=_0x3df56b['count'];var _0x463e3c=_0x21ed5d?0x0:_0x5a61fd['offset'];var _0x4da219=_0x21ed5d?_0x3df56b[_0x623c('0x24')]:_0x5a61fd[_0x623c('0x21')]+_0x5a61fd[_0x623c('0x23')];var _0x3ad344;if(_0x4da219>=_0x4717ec){_0x4da219=_0x4717ec;_0x3ad344=0xc8;}else{_0x3ad344=0xce;}_0x38a387[_0x623c('0x1e')](_0x3ad344);return _0x38a387[_0x623c('0x25')](_0x623c('0x26'),_0x463e3c+'-'+_0x4da219+'/'+_0x4717ec)[_0x623c('0x20')](_0x3df56b);}return null;};}function patchUpdates(_0x160860){return function(_0x307051){try{jsonpatch['apply'](_0x307051,_0x160860,!![]);}catch(_0x4c47f7){return BPromise[_0x623c('0x27')](_0x4c47f7);}return _0x307051[_0x623c('0x28')]();};}function saveUpdates(_0x30a7ff,_0x2f3d93){return function(_0x5a39b6){if(_0x5a39b6){return _0x5a39b6[_0x623c('0x29')](_0x30a7ff)[_0x623c('0x2a')](function(_0xa25834){return _0xa25834;});}return null;};}function removeEntity(_0x53db34,_0x2021a4){return function(_0xa61869){if(_0xa61869){return _0xa61869['destroy']()[_0x623c('0x2a')](function(){var _0x5cb067=_0xa61869[_0x623c('0x2b')]({'plain':!![]});var _0x486141='MailQueues';return db[_0x623c('0x2c')][_0x623c('0x2d')]({'where':{'type':_0x486141,'resourceId':_0x5cb067['id']}})[_0x623c('0x2a')](function(){return _0xa61869;});})['then'](function(){_0x53db34[_0x623c('0x1e')](0xcc)[_0x623c('0x1f')]();});}};}function handleEntityNotFound(_0x194b89,_0x25a740){return function(_0x102655){if(!_0x102655){_0x194b89[_0x623c('0x1d')](0x194);}return _0x102655;};}function handleError(_0x376a51,_0x58419c){_0x58419c=_0x58419c||0x1f4;return function(_0x16bbe7){logger[_0x623c('0x2e')](_0x16bbe7['stack']);if(_0x16bbe7[_0x623c('0x2f')]){delete _0x16bbe7[_0x623c('0x2f')];}_0x376a51['status'](_0x58419c)['send'](_0x16bbe7);};}exports['index']=function(_0x3078fd,_0x263118){var _0x233fba={},_0x25ca18={},_0x368518={'count':0x0,'rows':[]};var _0x9f9706=_[_0x623c('0x30')](db[_0x623c('0x31')]['rawAttributes'],function(_0x1cb292){return{'name':_0x1cb292[_0x623c('0x32')],'type':_0x1cb292[_0x623c('0x33')][_0x623c('0x34')]};});_0x25ca18[_0x623c('0x35')]=_[_0x623c('0x30')](_0x9f9706,_0x623c('0x2f'));_0x25ca18[_0x623c('0x36')]=_[_0x623c('0x37')](_0x3078fd[_0x623c('0x36')]);_0x25ca18['filters']=_['intersection'](_0x25ca18[_0x623c('0x35')],_0x25ca18['query']);_0x233fba['attributes']=_['intersection'](_0x25ca18[_0x623c('0x35')],qs[_0x623c('0x38')](_0x3078fd[_0x623c('0x36')][_0x623c('0x38')]));_0x233fba['attributes']=_0x233fba[_0x623c('0x39')]['length']?_0x233fba['attributes']:_0x25ca18[_0x623c('0x35')];if(!_0x3078fd[_0x623c('0x36')]['hasOwnProperty'](_0x623c('0x3a'))){_0x233fba['limit']=qs[_0x623c('0x23')](_0x3078fd['query'][_0x623c('0x23')]);_0x233fba[_0x623c('0x21')]=qs[_0x623c('0x21')](_0x3078fd[_0x623c('0x36')][_0x623c('0x21')]);}_0x233fba[_0x623c('0x3b')]=qs[_0x623c('0x3c')](_0x3078fd[_0x623c('0x36')][_0x623c('0x3c')]);_0x233fba[_0x623c('0x3d')]=qs[_0x623c('0x3e')](_['pick'](_0x3078fd[_0x623c('0x36')],_0x25ca18[_0x623c('0x3e')]),_0x9f9706);if(_0x3078fd[_0x623c('0x36')][_0x623c('0x3f')]){_0x233fba[_0x623c('0x3d')]=_[_0x623c('0x40')](_0x233fba[_0x623c('0x3d')],{'$or':_[_0x623c('0x30')](_0x9f9706,function(_0xa901be){if(_0xa901be['type']!==_0x623c('0x41')){var _0x560b97={};_0x560b97[_0xa901be[_0x623c('0x2f')]]={'$like':'%'+_0x3078fd[_0x623c('0x36')][_0x623c('0x3f')]+'%'};return _0x560b97;}})});}_0x233fba=_[_0x623c('0x40')]({},_0x233fba,_0x3078fd[_0x623c('0x42')]);var _0x1d07a3={'where':_0x233fba[_0x623c('0x3d')]};return db[_0x623c('0x31')][_0x623c('0x24')](_0x1d07a3)[_0x623c('0x2a')](function(_0x51340a){_0x368518[_0x623c('0x24')]=_0x51340a;if(_0x3078fd[_0x623c('0x36')]['includeAll']){_0x233fba[_0x623c('0x43')]=[{'all':!![]}];}return db[_0x623c('0x31')][_0x623c('0x44')](_0x233fba);})[_0x623c('0x2a')](function(_0x2c8ba7){_0x368518[_0x623c('0x45')]=_0x2c8ba7;return _0x368518;})['then'](respondWithFilteredResult(_0x263118,_0x233fba))[_0x623c('0x46')](handleError(_0x263118,null));};exports[_0x623c('0x47')]=function(_0x2cafac,_0x42ee48){var _0x7501aa={'raw':!![],'where':{'id':_0x2cafac[_0x623c('0x48')]['id']}},_0x1ebd8d={};_0x1ebd8d['model']=_['keys'](db[_0x623c('0x31')][_0x623c('0x49')]);_0x1ebd8d[_0x623c('0x36')]=_[_0x623c('0x37')](_0x2cafac[_0x623c('0x36')]);_0x1ebd8d[_0x623c('0x3e')]=_[_0x623c('0x4a')](_0x1ebd8d['model'],_0x1ebd8d[_0x623c('0x36')]);_0x7501aa[_0x623c('0x39')]=_[_0x623c('0x4a')](_0x1ebd8d['model'],qs[_0x623c('0x38')](_0x2cafac['query'][_0x623c('0x38')]));_0x7501aa[_0x623c('0x39')]=_0x7501aa[_0x623c('0x39')]['length']?_0x7501aa[_0x623c('0x39')]:_0x1ebd8d[_0x623c('0x35')];if(_0x2cafac[_0x623c('0x36')][_0x623c('0x4b')]){_0x7501aa[_0x623c('0x43')]=[{'all':!![]}];}_0x7501aa=_[_0x623c('0x40')]({},_0x7501aa,_0x2cafac['options']);return db[_0x623c('0x31')][_0x623c('0x4c')](_0x7501aa)[_0x623c('0x2a')](handleEntityNotFound(_0x42ee48,null))[_0x623c('0x2a')](respondWithResult(_0x42ee48,null))['catch'](handleError(_0x42ee48,null));};exports[_0x623c('0x4d')]=function(_0xacbd5a,_0x5b41fc){return db[_0x623c('0x31')]['create'](_0xacbd5a[_0x623c('0x4e')],{})['then'](function(_0x576cdf){var _0x34445f=_0xacbd5a['user'][_0x623c('0x2b')]({'plain':!![]});if(!_0x34445f)throw new Error(_0x623c('0x4f'));if(_0x34445f['role']===_0x623c('0x50')){var _0x4dc023=_0x576cdf[_0x623c('0x2b')]({'plain':!![]});var _0x481ba7=_0x623c('0x51');return db[_0x623c('0x52')][_0x623c('0x4c')]({'where':{'name':_0x481ba7,'userProfileId':_0x34445f[_0x623c('0x53')]},'raw':!![]})[_0x623c('0x2a')](function(_0x4d47a2){if(_0x4d47a2&&_0x4d47a2[_0x623c('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4dc023[_0x623c('0x2f')],'resourceId':_0x4dc023['id'],'type':_0x4d47a2[_0x623c('0x2f')],'sectionId':_0x4d47a2['id']},{})[_0x623c('0x2a')](function(){return _0x576cdf;});}else{return _0x576cdf;}})['catch'](function(_0x258ad6){logger[_0x623c('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x258ad6);throw _0x258ad6;});}return _0x576cdf;})['then'](respondWithResult(_0x5b41fc,0xc9))[_0x623c('0x46')](handleError(_0x5b41fc,null));};exports[_0x623c('0x29')]=function(_0x42a4aa,_0x472730){if(_0x42a4aa['body']['id']){delete _0x42a4aa[_0x623c('0x4e')]['id'];}return db['MailQueue'][_0x623c('0x4c')]({'where':{'id':_0x42a4aa[_0x623c('0x48')]['id']}})[_0x623c('0x2a')](handleEntityNotFound(_0x472730,null))[_0x623c('0x2a')](saveUpdates(_0x42a4aa[_0x623c('0x4e')],null))[_0x623c('0x2a')](respondWithResult(_0x472730,null))[_0x623c('0x46')](handleError(_0x472730,null));};exports[_0x623c('0x2d')]=function(_0x1011cd,_0x4b4f93){return db[_0x623c('0x31')][_0x623c('0x4c')]({'where':{'id':_0x1011cd[_0x623c('0x48')]['id']}})[_0x623c('0x2a')](handleEntityNotFound(_0x4b4f93,null))['then'](removeEntity(_0x4b4f93,null))[_0x623c('0x46')](handleError(_0x4b4f93,null));};exports[_0x623c('0x55')]=function(_0x3b433e,_0x1f7e30){return db[_0x623c('0x31')][_0x623c('0x55')]()[_0x623c('0x2a')](respondWithResult(_0x1f7e30,null))['catch'](handleError(_0x1f7e30,null));};exports[_0x623c('0x56')]=function(_0x5a9700,_0x5ee537,_0x374e54){var _0x48bee5={'raw':!![],'where':{}},_0xa63505={},_0xa9bdad;return db[_0x623c('0x31')][_0x623c('0x57')]({'where':{'id':_0x5a9700[_0x623c('0x48')]['id']}})['then'](handleEntityNotFound(_0x5ee537,null))['then'](function(_0x360c20){if(_0x360c20){_0xa9bdad=_0x360c20['get']({'plain':!![]});_0xa63505[_0x623c('0x35')]=_[_0x623c('0x37')](db[_0x623c('0x58')]['rawAttributes']);_0xa63505['query']=_['keys'](_0x5a9700[_0x623c('0x36')]);_0xa63505['filters']=_[_0x623c('0x4a')](_0xa63505[_0x623c('0x35')],_0xa63505['query']);_0x48bee5[_0x623c('0x39')]=_[_0x623c('0x4a')](_0xa63505[_0x623c('0x35')],qs[_0x623c('0x38')](_0x5a9700[_0x623c('0x36')][_0x623c('0x38')]));_0x48bee5['attributes']=_0x48bee5[_0x623c('0x39')][_0x623c('0x59')]?_0x48bee5[_0x623c('0x39')]:_0xa63505[_0x623c('0x35')];if(!_0x5a9700[_0x623c('0x36')][_0x623c('0x5a')](_0x623c('0x3a'))){_0x48bee5[_0x623c('0x23')]=qs['limit'](_0x5a9700[_0x623c('0x36')]['limit']);_0x48bee5[_0x623c('0x21')]=qs[_0x623c('0x21')](_0x5a9700['query'][_0x623c('0x21')]);}_0x48bee5[_0x623c('0x3b')]=qs[_0x623c('0x3c')](_0x5a9700[_0x623c('0x36')][_0x623c('0x3c')]);_0x48bee5[_0x623c('0x3d')]=qs[_0x623c('0x3e')](_['pick'](_0x5a9700[_0x623c('0x36')],_0xa63505[_0x623c('0x3e')]));_0x48bee5[_0x623c('0x3d')][_0x623c('0x5b')]=_0x360c20['id'];if(_0x5a9700[_0x623c('0x36')][_0x623c('0x3f')]){_0x48bee5[_0x623c('0x3d')]=_[_0x623c('0x40')](_0x48bee5['where'],{'$or':_[_0x623c('0x30')](_0x48bee5[_0x623c('0x39')],function(_0x17ea41){var _0x2ee606={};_0x2ee606[_0x17ea41]={'$like':'%'+_0x5a9700[_0x623c('0x36')]['filter']+'%'};return _0x2ee606;})});}_0x48bee5=_[_0x623c('0x40')]({},_0x48bee5,_0x5a9700[_0x623c('0x42')]);return db[_0x623c('0x58')][_0x623c('0x44')](_0x48bee5);}})[_0x623c('0x2a')](function(_0x3126dd){if(_0x3126dd){return db['User'][_0x623c('0x5c')]({'where':{'id':_[_0x623c('0x30')](_0x3126dd,'UserId'),'role':_0x623c('0x5d')},'attributes':['id','name',_0x623c('0x5e'),_0x623c('0x5f'),'createdAt']});}})['then'](function(_0x358c2d){if(_0x358c2d){return{'count':_0x358c2d['count'],'rows':_['map'](_0x358c2d['rows'],function(_0x269b77){return{'membername':_0x269b77[_0x623c('0x2f')],'UserId':_0x269b77['id'],'queue_name':_0xa9bdad[_0x623c('0x2f')],'MailQueueId':_0xa9bdad['id'],'interface':util[_0x623c('0x60')](_0x623c('0x61'),_0x623c('0x62'),_0x269b77[_0x623c('0x2f')]),'penalty':0x0,'paused':_0x269b77[_0x623c('0x5e')],'createdAt':_0x269b77[_0x623c('0x63')],'updatedAt':_0x269b77[_0x623c('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x623c('0x2a')](respondWithFilteredResult(_0x5ee537,_0x48bee5))['catch'](handleError(_0x5ee537,null));};exports['getTeams']=function(_0x947c8e,_0xb1f40f,_0x1f5395){var _0x5c0986={};var _0x43c2c6={};var _0x4d0de3;var _0x3c5b74;return db[_0x623c('0x31')][_0x623c('0x57')]({'where':{'id':_0x947c8e[_0x623c('0x48')]['id']}})[_0x623c('0x2a')](handleEntityNotFound(_0xb1f40f,null))[_0x623c('0x2a')](function(_0x35ef11){if(_0x35ef11){_0x4d0de3=_0x35ef11;_0x43c2c6[_0x623c('0x35')]=_[_0x623c('0x37')](db[_0x623c('0x64')][_0x623c('0x49')]);_0x43c2c6['query']=_[_0x623c('0x37')](_0x947c8e[_0x623c('0x36')]);_0x43c2c6[_0x623c('0x3e')]=_['intersection'](_0x43c2c6['model'],_0x43c2c6[_0x623c('0x36')]);_0x5c0986[_0x623c('0x39')]=_[_0x623c('0x4a')](_0x43c2c6[_0x623c('0x35')],qs[_0x623c('0x38')](_0x947c8e[_0x623c('0x36')]['fields']));_0x5c0986['attributes']=_0x5c0986['attributes']['length']?_0x5c0986[_0x623c('0x39')]:_0x43c2c6[_0x623c('0x35')];_0x5c0986[_0x623c('0x3b')]=qs[_0x623c('0x3c')](_0x947c8e[_0x623c('0x36')][_0x623c('0x3c')]);_0x5c0986[_0x623c('0x3d')]=qs[_0x623c('0x3e')](_[_0x623c('0x65')](_0x947c8e[_0x623c('0x36')],_0x43c2c6['filters']));if(_0x947c8e['query'][_0x623c('0x3f')]){_0x5c0986['where']=_[_0x623c('0x40')](_0x5c0986[_0x623c('0x3d')],{'$or':_[_0x623c('0x30')](_0x5c0986[_0x623c('0x39')],function(_0x4c1406){var _0x14317b={};_0x14317b[_0x4c1406]={'$like':'%'+_0x947c8e[_0x623c('0x36')][_0x623c('0x3f')]+'%'};return _0x14317b;})});}_0x5c0986=_[_0x623c('0x40')]({},_0x5c0986,_0x947c8e['options']);return _0x4d0de3[_0x623c('0x66')](_0x5c0986);}})[_0x623c('0x2a')](function(_0x101889){if(_0x101889){_0x3c5b74=_0x101889['length'];if(!_0x947c8e[_0x623c('0x36')][_0x623c('0x5a')](_0x623c('0x3a'))){_0x5c0986[_0x623c('0x23')]=qs[_0x623c('0x23')](_0x947c8e[_0x623c('0x36')][_0x623c('0x23')]);_0x5c0986[_0x623c('0x21')]=qs['offset'](_0x947c8e['query'][_0x623c('0x21')]);}return _0x4d0de3[_0x623c('0x66')](_0x5c0986);}})[_0x623c('0x2a')](function(_0x668d67){if(_0x668d67){return _0x668d67?{'count':_0x3c5b74,'rows':_0x668d67}:null;}})[_0x623c('0x2a')](respondWithResult(_0xb1f40f,null))[_0x623c('0x46')](handleError(_0xb1f40f,null));};exports[_0x623c('0x67')]=function(_0x22f46a,_0x5eccfa,_0x2b0a98){var _0x1f5e9e=_0x22f46a[_0x623c('0x4e')][_0x623c('0x68')];return db[_0x623c('0x64')][_0x623c('0x44')]({'where':{'id':_0x1f5e9e},'attributes':['id'],'include':[{'model':db[_0x623c('0x69')],'as':'Agents','attributes':['id',_0x623c('0x2f'),_0x623c('0x6a'),_0x623c('0x6b'),'interface'],'raw':!![]}]})[_0x623c('0x2a')](function(_0x1a20c3){if(_0x1a20c3){var _0x47bcfb=_[_0x623c('0x6c')](_0x1a20c3,function(_0x210583){var _0x2c9262=_0x210583[_0x623c('0x2b')]({'plain':!![]});return _0x2c9262['Agents'];});return db[_0x623c('0x31')][_0x623c('0x4c')]({'where':{'id':_0x22f46a[_0x623c('0x48')]['id']}})['then'](function(_0x310c84){return db[_0x623c('0x6d')][_0x623c('0x6e')](function(_0x1be7d5){return _0x310c84['addTeams'](_0x1f5e9e,{'transaction':_0x1be7d5})['then'](function(){return BPromise[_0x623c('0x6f')](_0x47bcfb,function(_0x5bd10d){return db[_0x623c('0x58')][_0x623c('0x70')]({'where':{'UserId':_0x5bd10d['id'],'MailQueueId':_0x22f46a['params']['id']},'transaction':_0x1be7d5});});})['then'](function(){_0x47bcfb[_0x623c('0x71')](function(_0xf4ae5d){socket['emit'](_0x623c('0x72'),{'UserId':_0xf4ae5d['id'],'MailQueueId':_0x310c84['id']});});});});});}})['then'](respondWithStatusCode(_0x5eccfa,null))['catch'](handleError(_0x5eccfa,null));};exports[_0x623c('0x73')]=function(_0x3ce7ca,_0x1bce15,_0x13259e){return db['Team'][_0x623c('0x44')]({'where':{'id':_0x3ce7ca['query'][_0x623c('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x623c('0x74'),'attributes':['id'],'raw':!![]}]})[_0x623c('0x2a')](handleEntityNotFound(_0x1bce15,null))['then'](function(_0x3fde40){var _0x4fcd17=_[_0x623c('0x30')](_0x3fde40,'id');var _0xdfa9b7=[];var _0x4c5a88=[];var _0x3320e2=squel[_0x623c('0x75')]();_0x3320e2['field']('tq.TeamId')[_0x623c('0x76')](_0x623c('0x77'),'tq')[_0x623c('0x78')]('user_has_teams','ut',_0x623c('0x79'))[_0x623c('0x3d')](_0x623c('0x7a'),_0x3ce7ca[_0x623c('0x48')]['id']);for(var _0x15a916=0x0;_0x15a916<_0x3fde40[_0x623c('0x59')];_0x15a916+=0x1){let _0x5b9437=_0x3fde40[_0x15a916];for(var _0x255431=0x0;_0x255431<_0x5b9437[_0x623c('0x74')][_0x623c('0x59')];_0x255431+=0x1){let _0x42f83e=_0x5b9437[_0x623c('0x74')][_0x255431];var _0x2dc938=_0x3320e2[_0x623c('0x7b')]();_0x2dc938['where'](_0x623c('0x7c'),_0x42f83e['id']);_0x4c5a88[_0x623c('0x7d')](db[_0x623c('0x6d')][_0x623c('0x36')](_0x2dc938[_0x623c('0x7e')](),{'type':db[_0x623c('0x6d')]['QueryTypes']['SELECT']})['then'](function(_0x1874f3){if(_0x1874f3['length']===0x1){return _0x42f83e['id'];}else{var _0x4319c3=_[_0x623c('0x7f')](_[_0x623c('0x30')](_0x1874f3,_0x623c('0x80')),function(_0x428bb3){return _['includes'](_0x4fcd17,_0x428bb3);});if(_0x4319c3){return _0x42f83e['id'];}}}));}}return BPromise[_0x623c('0x81')](_0x4c5a88)[_0x623c('0x2a')](function(_0x1550db){_0xdfa9b7=_(_0xdfa9b7)[_0x623c('0x82')](_0x1550db)[_0x623c('0x83')]()[_0x623c('0x84')]();return db[_0x623c('0x31')]['find']({'where':{'id':_0x3ce7ca[_0x623c('0x48')]['id']}})[_0x623c('0x2a')](function(_0x5f0731){return db[_0x623c('0x6d')][_0x623c('0x6e')](function(_0x30c71a){return _0x5f0731[_0x623c('0x73')](_0x3ce7ca[_0x623c('0x36')]['ids'],{'transaction':_0x30c71a})[_0x623c('0x2a')](function(){if(!_[_0x623c('0x85')](_0xdfa9b7)){return _0x5f0731[_0x623c('0x86')](_0xdfa9b7,{'transaction':_0x30c71a});}})[_0x623c('0x2a')](function(){_0xdfa9b7[_0x623c('0x71')](function(_0x29528c){socket[_0x623c('0x87')](_0x623c('0x88'),{'UserId':_0x29528c,'MailQueueId':_0x5f0731['id']});});});});});});})[_0x623c('0x2a')](respondWithStatusCode(_0x1bce15,null))['catch'](handleError(_0x1bce15,null));};exports[_0x623c('0x89')]=function(_0x34b4da,_0x40fbe1,_0x1db553){return db[_0x623c('0x31')][_0x623c('0x4c')]({'where':{'id':_0x34b4da[_0x623c('0x48')]['id']}})[_0x623c('0x2a')](handleEntityNotFound(_0x40fbe1,null))[_0x623c('0x2a')](function(_0x375459){if(_0x375459){return _0x375459[_0x623c('0x89')](_0x34b4da[_0x623c('0x4e')][_0x623c('0x68')],_[_0x623c('0x8a')](_0x34b4da[_0x623c('0x4e')],[_0x623c('0x68'),'id'])||{})[_0x623c('0x8b')](function(_0x153944){for(var _0x2e2dd3=0x0;_0x2e2dd3<_0x34b4da['body'][_0x623c('0x68')][_0x623c('0x59')];_0x2e2dd3+=0x1){socket[_0x623c('0x87')]('userMailQueue:save',{'UserId':Number(_0x34b4da[_0x623c('0x4e')][_0x623c('0x68')][_0x2e2dd3]),'MailQueueId':Number(_0x34b4da[_0x623c('0x48')]['id'])});}return _0x153944;});}})[_0x623c('0x2a')](respondWithResult(_0x40fbe1,null))[_0x623c('0x46')](handleError(_0x40fbe1,null));};exports[_0x623c('0x86')]=function(_0x5a4019,_0x169d7a,_0x47255c){return db['MailQueue']['find']({'where':{'id':_0x5a4019['params']['id']}})[_0x623c('0x2a')](handleEntityNotFound(_0x169d7a,null))[_0x623c('0x2a')](function(_0x1a503d){if(_0x1a503d){return _0x1a503d['removeAgents'](_0x5a4019[_0x623c('0x36')][_0x623c('0x68')])['then'](function(){if(_['isArray'](_0x5a4019[_0x623c('0x36')][_0x623c('0x68')])){for(var _0x4f7af3=0x0;_0x4f7af3<_0x5a4019[_0x623c('0x36')][_0x623c('0x68')][_0x623c('0x59')];_0x4f7af3+=0x1){socket[_0x623c('0x87')]('userMailQueue:remove',{'UserId':Number(_0x5a4019[_0x623c('0x36')][_0x623c('0x68')][_0x4f7af3]),'MailQueueId':Number(_0x5a4019[_0x623c('0x48')]['id'])});}}else{socket[_0x623c('0x87')](_0x623c('0x88'),{'UserId':Number(_0x5a4019['query']['ids']),'MailQueueId':Number(_0x5a4019[_0x623c('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x169d7a,null))['catch'](handleError(_0x169d7a,null));};exports['getAgents']=function(_0x9159f7,_0xee73ed,_0x3cc51a){var _0x14de71={};var _0x19154f={};var _0xd02397;var _0x518869;return db[_0x623c('0x31')]['findOne']({'where':{'id':_0x9159f7['params']['id']}})[_0x623c('0x2a')](handleEntityNotFound(_0xee73ed,null))[_0x623c('0x2a')](function(_0x12d2fc){if(_0x12d2fc){_0xd02397=_0x12d2fc;_0x19154f[_0x623c('0x35')]=_[_0x623c('0x37')](db[_0x623c('0x69')][_0x623c('0x49')]);_0x19154f[_0x623c('0x36')]=_[_0x623c('0x37')](_0x9159f7[_0x623c('0x36')]);_0x19154f[_0x623c('0x3e')]=_['intersection'](_0x19154f[_0x623c('0x35')],_0x19154f[_0x623c('0x36')]);_0x14de71[_0x623c('0x39')]=_['intersection'](_0x19154f['model'],qs[_0x623c('0x38')](_0x9159f7[_0x623c('0x36')][_0x623c('0x38')]));_0x14de71[_0x623c('0x39')]=_0x14de71['attributes']['length']?_0x14de71[_0x623c('0x39')]:_0x19154f['model'];_0x14de71[_0x623c('0x3b')]=qs[_0x623c('0x3c')](_0x9159f7['query'][_0x623c('0x3c')]);_0x14de71[_0x623c('0x3d')]=qs[_0x623c('0x3e')](_[_0x623c('0x65')](_0x9159f7[_0x623c('0x36')],_0x19154f['filters']));if(_0x9159f7[_0x623c('0x36')][_0x623c('0x3f')]){_0x14de71[_0x623c('0x3d')]=_[_0x623c('0x40')](_0x14de71[_0x623c('0x3d')],{'$or':_['map'](_0x14de71[_0x623c('0x39')],function(_0x5e351d){var _0x507953={};_0x507953[_0x5e351d]={'$like':'%'+_0x9159f7[_0x623c('0x36')][_0x623c('0x3f')]+'%'};return _0x507953;})});}_0x14de71=_[_0x623c('0x40')]({},_0x14de71,_0x9159f7['options']);return _0xd02397[_0x623c('0x8c')](_0x14de71);}})['then'](function(_0x2f47fa){if(_0x2f47fa){_0x518869=_0x2f47fa[_0x623c('0x59')];if(!_0x9159f7[_0x623c('0x36')][_0x623c('0x5a')]('nolimit')){_0x14de71[_0x623c('0x23')]=qs[_0x623c('0x23')](_0x9159f7['query'][_0x623c('0x23')]);_0x14de71[_0x623c('0x21')]=qs['offset'](_0x9159f7[_0x623c('0x36')][_0x623c('0x21')]);}return _0xd02397[_0x623c('0x8c')](_0x14de71);}})[_0x623c('0x2a')](function(_0x53c431){if(_0x53c431){return _0x53c431?{'count':_0x518869,'rows':_0x53c431}:null;}})[_0x623c('0x2a')](respondWithResult(_0xee73ed,null))[_0x623c('0x46')](handleError(_0xee73ed,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index b2f8a28..2a942b1 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 _0xe4e9=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x39f267,_0xd87fbe){var _0x44fc23=function(_0x5cf3b3){while(--_0x5cf3b3){_0x39f267['push'](_0x39f267['shift']());}};_0x44fc23(++_0xd87fbe);}(_0xe4e9,0x1bb));var _0x9e4e=function(_0xf5c060,_0x616e88){_0xf5c060=_0xf5c060-0x0;var _0x26f4f8=_0xe4e9[_0xf5c060];return _0x26f4f8;};'use strict';var EventEmitter=require(_0x9e4e('0x0'));var MailQueue=require(_0x9e4e('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x9e4e('0x2')](0x0);var events={'afterCreate':_0x9e4e('0x3'),'afterUpdate':_0x9e4e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3ad0d4){return function(_0x49b872,_0x1eb332,_0x492d86){MailQueueEvents[_0x9e4e('0x5')](_0x3ad0d4+':'+_0x49b872['id'],_0x49b872);MailQueueEvents[_0x9e4e('0x5')](_0x3ad0d4,_0x49b872);_0x492d86(null);};}for(var e in events){if(events[_0x9e4e('0x6')](e)){var event=events[e];MailQueue[_0x9e4e('0x7')](e,emitEvent(event));}}module[_0x9e4e('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xdffb=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0xdffb,0xd4));var _0xbdff=function(_0x4db341,_0x2e2ccf){_0x4db341=_0x4db341-0x0;var _0x4ce26d=_0xdffb[_0x4db341];return _0x4ce26d;};'use strict';var EventEmitter=require(_0xbdff('0x0'));var MailQueue=require(_0xbdff('0x1'))['db'][_0xbdff('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xbdff('0x3')](0x0);var events={'afterCreate':_0xbdff('0x4'),'afterUpdate':'update','afterDestroy':_0xbdff('0x5')};function emitEvent(_0x5af77c){return function(_0x3c6623,_0x47c2f5,_0xe89627){MailQueueEvents[_0xbdff('0x6')](_0x5af77c+':'+_0x3c6623['id'],_0x3c6623);MailQueueEvents[_0xbdff('0x6')](_0x5af77c,_0x3c6623);_0xe89627(null);};}for(var e in events){if(events[_0xbdff('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xbdff('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 963c155..6f9b1c5 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 _0x99bd=['exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x430f7c,_0x12d9cf){var _0x5d9804=function(_0x44c866){while(--_0x44c866){_0x430f7c['push'](_0x430f7c['shift']());}};_0x5d9804(++_0x12d9cf);}(_0x99bd,0xf4));var _0xd99b=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0x99bd[_0xc0a3d3];return _0x3386e8;};'use strict';var _=require(_0xd99b('0x0'));var util=require(_0xd99b('0x1'));var logger=require(_0xd99b('0x2'))(_0xd99b('0x3'));var moment=require(_0xd99b('0x4'));var BPromise=require('bluebird');var rp=require(_0xd99b('0x5'));var fs=require('fs');var path=require(_0xd99b('0x6'));var rimraf=require(_0xd99b('0x7'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0xd99b('0x8')]=function(_0x4683a7,_0x1b5c52){return _0x4683a7[_0xd99b('0x9')](_0xd99b('0xa'),attributes,{'tableName':_0xd99b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a9c=['util','../../config/logger','api','path','rimraf','../../config/environment','exports','lodash'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x4a9c,0x15f));var _0xc4a9=function(_0x39bc45,_0x3128d4){_0x39bc45=_0x39bc45-0x0;var _0xc25466=_0x4a9c[_0x39bc45];return _0xc25466;};'use strict';var _=require(_0xc4a9('0x0'));var util=require(_0xc4a9('0x1'));var logger=require(_0xc4a9('0x2'))(_0xc4a9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc4a9('0x4'));var rimraf=require(_0xc4a9('0x5'));var config=require(_0xc4a9('0x6'));var attributes=require('./mailQueue.attributes');module[_0xc4a9('0x7')]=function(_0x4d9c1c,_0x53774f){return _0x4d9c1c['define']('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 2c1d527..84483f5 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 _0x40b5=['message','info','result','catch','GetMailQueue','options','raw','attributes','limit','include','map','model','ShowMailQueue','MailQueue','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x40b5,0x1d7));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x540b('0x0'));var util=require(_0x540b('0x1'));var moment=require(_0x540b('0x2'));var BPromise=require(_0x540b('0x3'));var rs=require(_0x540b('0x4'));var fs=require('fs');var Redis=require(_0x540b('0x5'));var db=require(_0x540b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x540b('0x7'))(_0x540b('0x8'));var config=require(_0x540b('0x9'));var jayson=require(_0x540b('0xa'));var client=jayson[_0x540b('0xb')]['http']({'port':0x232a});config[_0x540b('0xc')]=_[_0x540b('0xd')](config[_0x540b('0xc')],{'host':_0x540b('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x540b('0xc')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4eb9aa,_0x13dc02,_0x5db746){return new BPromise(function(_0x1746d4,_0x4e295b){return client['request'](_0x4eb9aa,_0x5db746)[_0x540b('0xf')](function(_0x79866b){logger['info'](_0x540b('0x10'),_0x13dc02,_0x540b('0x11'));logger[_0x540b('0x12')](_0x540b('0x13'),_0x13dc02,'request\x20sent',JSON[_0x540b('0x14')](_0x79866b));if(_0x79866b[_0x540b('0x15')]){if(_0x79866b[_0x540b('0x15')][_0x540b('0x16')]===0x1f4){logger['error'](_0x540b('0x10'),_0x13dc02,_0x79866b['error']['message']);return _0x4e295b(_0x79866b[_0x540b('0x15')][_0x540b('0x17')]);}logger[_0x540b('0x15')](_0x540b('0x10'),_0x13dc02,_0x79866b[_0x540b('0x15')]['message']);return _0x1746d4(_0x79866b[_0x540b('0x15')][_0x540b('0x17')]);}else{logger[_0x540b('0x18')](_0x540b('0x10'),_0x13dc02,_0x540b('0x11'));_0x1746d4(_0x79866b[_0x540b('0x19')][_0x540b('0x17')]);}})[_0x540b('0x1a')](function(_0x3d5b62){logger['error'](_0x540b('0x10'),_0x13dc02,_0x3d5b62);_0x4e295b(_0x3d5b62);});});}exports[_0x540b('0x1b')]=function(_0x5900ed){var _0x135cd7=this;return new Promise(function(_0x4b3ec6,_0x342cbd){return db['MailQueue']['findAll']({'raw':_0x5900ed[_0x540b('0x1c')]?_0x5900ed['options'][_0x540b('0x1d')]===undefined?!![]:![]:!![],'where':_0x5900ed[_0x540b('0x1c')]?_0x5900ed[_0x540b('0x1c')]['where']||null:null,'attributes':_0x5900ed[_0x540b('0x1c')]?_0x5900ed[_0x540b('0x1c')][_0x540b('0x1e')]||null:null,'limit':_0x5900ed[_0x540b('0x1c')]?_0x5900ed[_0x540b('0x1c')][_0x540b('0x1f')]||null:null,'include':_0x5900ed[_0x540b('0x1c')]?_0x5900ed[_0x540b('0x1c')][_0x540b('0x20')]?_[_0x540b('0x21')](_0x5900ed['options'][_0x540b('0x20')],function(_0x462e6f){return{'model':db[_0x462e6f['model']],'as':_0x462e6f['as'],'attributes':_0x462e6f['attributes'],'include':_0x462e6f[_0x540b('0x20')]?_[_0x540b('0x21')](_0x462e6f[_0x540b('0x20')],function(_0x341b22){return{'model':db[_0x341b22['model']],'as':_0x341b22['as'],'attributes':_0x341b22[_0x540b('0x1e')],'include':_0x341b22[_0x540b('0x20')]?_[_0x540b('0x21')](_0x341b22[_0x540b('0x20')],function(_0xd3f5f6){return{'model':db[_0xd3f5f6[_0x540b('0x22')]],'as':_0xd3f5f6['as'],'attributes':_0xd3f5f6[_0x540b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x574c97){logger['info'](_0x540b('0x1b'),_0x5900ed);logger[_0x540b('0x12')](_0x540b('0x1b'),_0x5900ed,JSON['stringify'](_0x574c97));_0x4b3ec6(_0x574c97);})['catch'](function(_0x3926aa){logger[_0x540b('0x15')]('GetMailQueue',_0x3926aa[_0x540b('0x17')],_0x5900ed);_0x342cbd(_0x135cd7[_0x540b('0x15')](0x1f4,_0x3926aa[_0x540b('0x17')]));});});};exports[_0x540b('0x23')]=function(_0x3735ca){var _0x3fd64f=this;return new Promise(function(_0x184f8c,_0x113a93){return db[_0x540b('0x24')]['find']({'raw':_0x3735ca[_0x540b('0x1c')]?_0x3735ca['options'][_0x540b('0x1d')]===undefined?!![]:![]:!![],'where':_0x3735ca[_0x540b('0x1c')]?_0x3735ca[_0x540b('0x1c')][_0x540b('0x25')]||null:null,'attributes':_0x3735ca[_0x540b('0x1c')]?_0x3735ca[_0x540b('0x1c')][_0x540b('0x1e')]||null:null,'include':_0x3735ca[_0x540b('0x1c')]?_0x3735ca[_0x540b('0x1c')][_0x540b('0x20')]?_['map'](_0x3735ca[_0x540b('0x1c')]['include'],function(_0x56ba4d){return{'model':db[_0x56ba4d['model']],'as':_0x56ba4d['as'],'attributes':_0x56ba4d['attributes'],'include':_0x56ba4d['include']?_[_0x540b('0x21')](_0x56ba4d['include'],function(_0x1c6eec){return{'model':db[_0x1c6eec[_0x540b('0x22')]],'as':_0x1c6eec['as'],'attributes':_0x1c6eec['attributes'],'include':_0x1c6eec['include']?_[_0x540b('0x21')](_0x1c6eec['include'],function(_0x1c584c){return{'model':db[_0x1c584c[_0x540b('0x22')]],'as':_0x1c584c['as'],'attributes':_0x1c584c[_0x540b('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x540b('0xf')](function(_0x13e47f){logger['info'](_0x540b('0x23'),_0x3735ca);logger[_0x540b('0x12')](_0x540b('0x23'),_0x3735ca,JSON[_0x540b('0x14')](_0x13e47f));_0x184f8c(_0x13e47f);})['catch'](function(_0x4df448){logger[_0x540b('0x15')]('ShowMailQueue',_0x4df448[_0x540b('0x17')],_0x3735ca);_0x113a93(_0x3fd64f[_0x540b('0x15')](0x1f4,_0x4df448[_0x540b('0x17')]));});});}; \ No newline at end of file +var _0x9a89=['MailQueue,\x20%s,\x20%s','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','raw','where','attributes','include','map','model','debug','GetMailQueue','ShowMailQueue','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','request','then','info'];(function(_0x13930b,_0x1b6ab6){var _0x461279=function(_0x411f0a){while(--_0x411f0a){_0x13930b['push'](_0x13930b['shift']());}};_0x461279(++_0x1b6ab6);}(_0x9a89,0xce));var _0x99a8=function(_0x23fe00,_0x1cd3d2){_0x23fe00=_0x23fe00-0x0;var _0x52b085=_0x9a89[_0x23fe00];return _0x52b085;};'use strict';var _=require(_0x99a8('0x0'));var util=require(_0x99a8('0x1'));var moment=require(_0x99a8('0x2'));var BPromise=require(_0x99a8('0x3'));var rs=require(_0x99a8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99a8('0x5'))['db'];var utils=require(_0x99a8('0x6'));var logger=require('../../config/logger')(_0x99a8('0x7'));var config=require('../../config/environment');var jayson=require(_0x99a8('0x8'));var client=jayson[_0x99a8('0x9')][_0x99a8('0xa')]({'port':0x232a});config[_0x99a8('0xb')]=_['defaults'](config[_0x99a8('0xb')],{'host':_0x99a8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x99a8('0xb')]));require('./mailQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3ee89a,_0x131f04,_0x41cc40){return new BPromise(function(_0x2abf59,_0xc7f6a){return client[_0x99a8('0xd')](_0x3ee89a,_0x41cc40)[_0x99a8('0xe')](function(_0x262745){logger[_0x99a8('0xf')](_0x99a8('0x10'),_0x131f04,_0x99a8('0x11'));logger['debug'](_0x99a8('0x12'),_0x131f04,_0x99a8('0x11'),JSON[_0x99a8('0x13')](_0x262745));if(_0x262745['error']){if(_0x262745[_0x99a8('0x14')][_0x99a8('0x15')]===0x1f4){logger[_0x99a8('0x14')](_0x99a8('0x10'),_0x131f04,_0x262745[_0x99a8('0x14')][_0x99a8('0x16')]);return _0xc7f6a(_0x262745[_0x99a8('0x14')][_0x99a8('0x16')]);}logger[_0x99a8('0x14')](_0x99a8('0x10'),_0x131f04,_0x262745[_0x99a8('0x14')][_0x99a8('0x16')]);return _0x2abf59(_0x262745[_0x99a8('0x14')]['message']);}else{logger['info'](_0x99a8('0x10'),_0x131f04,_0x99a8('0x11'));_0x2abf59(_0x262745[_0x99a8('0x17')][_0x99a8('0x16')]);}})[_0x99a8('0x18')](function(_0x42388b){logger[_0x99a8('0x14')](_0x99a8('0x10'),_0x131f04,_0x42388b);_0xc7f6a(_0x42388b);});});}exports['GetMailQueue']=function(_0x4e77d9){var _0x1007d4=this;return new Promise(function(_0x10722b,_0x186ed9){return db[_0x99a8('0x19')][_0x99a8('0x1a')]({'raw':_0x4e77d9[_0x99a8('0x1b')]?_0x4e77d9[_0x99a8('0x1b')][_0x99a8('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e77d9[_0x99a8('0x1b')]?_0x4e77d9[_0x99a8('0x1b')][_0x99a8('0x1d')]||null:null,'attributes':_0x4e77d9[_0x99a8('0x1b')]?_0x4e77d9[_0x99a8('0x1b')][_0x99a8('0x1e')]||null:null,'limit':_0x4e77d9[_0x99a8('0x1b')]?_0x4e77d9[_0x99a8('0x1b')]['limit']||null:null,'include':_0x4e77d9[_0x99a8('0x1b')]?_0x4e77d9[_0x99a8('0x1b')][_0x99a8('0x1f')]?_[_0x99a8('0x20')](_0x4e77d9[_0x99a8('0x1b')][_0x99a8('0x1f')],function(_0x1c1bd2){return{'model':db[_0x1c1bd2[_0x99a8('0x21')]],'as':_0x1c1bd2['as'],'attributes':_0x1c1bd2[_0x99a8('0x1e')],'include':_0x1c1bd2['include']?_[_0x99a8('0x20')](_0x1c1bd2[_0x99a8('0x1f')],function(_0x3c6b77){return{'model':db[_0x3c6b77[_0x99a8('0x21')]],'as':_0x3c6b77['as'],'attributes':_0x3c6b77[_0x99a8('0x1e')],'include':_0x3c6b77[_0x99a8('0x1f')]?_[_0x99a8('0x20')](_0x3c6b77[_0x99a8('0x1f')],function(_0x369af6){return{'model':db[_0x369af6[_0x99a8('0x21')]],'as':_0x369af6['as'],'attributes':_0x369af6[_0x99a8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x99a8('0xe')](function(_0x308185){logger['info']('GetMailQueue',_0x4e77d9);logger[_0x99a8('0x22')]('GetMailQueue',_0x4e77d9,JSON[_0x99a8('0x13')](_0x308185));_0x10722b(_0x308185);})['catch'](function(_0x88f889){logger[_0x99a8('0x14')](_0x99a8('0x23'),_0x88f889[_0x99a8('0x16')],_0x4e77d9);_0x186ed9(_0x1007d4[_0x99a8('0x14')](0x1f4,_0x88f889[_0x99a8('0x16')]));});});};exports[_0x99a8('0x24')]=function(_0x1a6da5){var _0x406e77=this;return new Promise(function(_0x4234e7,_0x26ad8b){return db[_0x99a8('0x19')]['find']({'raw':_0x1a6da5[_0x99a8('0x1b')]?_0x1a6da5[_0x99a8('0x1b')][_0x99a8('0x1c')]===undefined?!![]:![]:!![],'where':_0x1a6da5[_0x99a8('0x1b')]?_0x1a6da5[_0x99a8('0x1b')][_0x99a8('0x1d')]||null:null,'attributes':_0x1a6da5[_0x99a8('0x1b')]?_0x1a6da5['options'][_0x99a8('0x1e')]||null:null,'include':_0x1a6da5[_0x99a8('0x1b')]?_0x1a6da5[_0x99a8('0x1b')]['include']?_[_0x99a8('0x20')](_0x1a6da5['options']['include'],function(_0x2cf4de){return{'model':db[_0x2cf4de[_0x99a8('0x21')]],'as':_0x2cf4de['as'],'attributes':_0x2cf4de[_0x99a8('0x1e')],'include':_0x2cf4de['include']?_[_0x99a8('0x20')](_0x2cf4de[_0x99a8('0x1f')],function(_0x5c543d){return{'model':db[_0x5c543d[_0x99a8('0x21')]],'as':_0x5c543d['as'],'attributes':_0x5c543d['attributes'],'include':_0x5c543d['include']?_['map'](_0x5c543d['include'],function(_0x533f22){return{'model':db[_0x533f22['model']],'as':_0x533f22['as'],'attributes':_0x533f22[_0x99a8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x99a8('0xe')](function(_0x27d4da){logger['info'](_0x99a8('0x24'),_0x1a6da5);logger[_0x99a8('0x22')](_0x99a8('0x24'),_0x1a6da5,JSON[_0x99a8('0x13')](_0x27d4da));_0x4234e7(_0x27d4da);})[_0x99a8('0x18')](function(_0x11e420){logger[_0x99a8('0x14')](_0x99a8('0x24'),_0x11e420[_0x99a8('0x16')],_0x1a6da5);_0x26ad8b(_0x406e77[_0x99a8('0x14')](0x1f4,_0x11e420[_0x99a8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index e03e05d..5813cb8 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 _0x9529=['length','mailQueue:','./mailQueue.events','save','emit','removeListener','register'];(function(_0x247d50,_0x116b0b){var _0x312f9b=function(_0x3115e6){while(--_0x3115e6){_0x247d50['push'](_0x247d50['shift']());}};_0x312f9b(++_0x116b0b);}(_0x9529,0x12f));var _0x9952=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9529[_0x321bb2];return _0x9c12ed;};'use strict';var MailQueueEvents=require(_0x9952('0x0'));var events=[_0x9952('0x1'),'remove','update'];function createListener(_0x3ba34f,_0x5454dd){return function(_0x50085f){_0x5454dd[_0x9952('0x2')](_0x3ba34f,_0x50085f);};}function removeListener(_0x2d68b7,_0x58711c){return function(){MailQueueEvents[_0x9952('0x3')](_0x2d68b7,_0x58711c);};}exports[_0x9952('0x4')]=function(_0x4804e3){for(var _0x25e7a7=0x0,_0x64ec24=events[_0x9952('0x5')];_0x25e7a7<_0x64ec24;_0x25e7a7++){var _0x297c14=events[_0x25e7a7];var _0x3c4b54=createListener(_0x9952('0x6')+_0x297c14,_0x4804e3);MailQueueEvents['on'](_0x297c14,_0x3c4b54);}}; \ No newline at end of file +var _0xd8fd=['removeListener','register','length','mailQueue:','./mailQueue.events','save','update','emit'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xd8fd,0x16c));var _0xdd8f=function(_0x494f4d,_0x2807fa){_0x494f4d=_0x494f4d-0x0;var _0x3e7dfc=_0xd8fd[_0x494f4d];return _0x3e7dfc;};'use strict';var MailQueueEvents=require(_0xdd8f('0x0'));var events=[_0xdd8f('0x1'),'remove',_0xdd8f('0x2')];function createListener(_0x203152,_0xc091a3){return function(_0x39ba06){_0xc091a3[_0xdd8f('0x3')](_0x203152,_0x39ba06);};}function removeListener(_0x4d9c04,_0x3b496c){return function(){MailQueueEvents[_0xdd8f('0x4')](_0x4d9c04,_0x3b496c);};}exports[_0xdd8f('0x5')]=function(_0x55700c){for(var _0x53a655=0x0,_0x2d80a9=events[_0xdd8f('0x6')];_0x53a655<_0x2d80a9;_0x53a655++){var _0x5d7168=events[_0x53a655];var _0x156406=createListener(_0xdd8f('0x7')+_0x5d7168,_0x55700c);MailQueueEvents['on'](_0x5d7168,_0x156406);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 24a4771..cc8dc79 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 _0xb05d=['../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2ef6a0,_0x5dee99){var _0x3bf8bd=function(_0x504833){while(--_0x504833){_0x2ef6a0['push'](_0x2ef6a0['shift']());}};_0x3bf8bd(++_0x5dee99);}(_0xb05d,0x19d));var _0xdb05=function(_0x10791d,_0x2562b6){_0x10791d=_0x10791d-0x0;var _0x1b4f9c=_0xb05d[_0x10791d];return _0x1b4f9c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdb05('0x0'));var timeout=require(_0xdb05('0x1'));var express=require(_0xdb05('0x2'));var router=express[_0xdb05('0x3')]();var fs_extra=require(_0xdb05('0x4'));var auth=require(_0xdb05('0x5'));var interaction=require(_0xdb05('0x6'));var config=require(_0xdb05('0x7'));var controller=require(_0xdb05('0x8'));router['get']('/',auth[_0xdb05('0x9')](),controller[_0xdb05('0xa')]);router[_0xdb05('0xb')](_0xdb05('0xc'),auth[_0xdb05('0x9')](),controller['describe']);router[_0xdb05('0xb')](_0xdb05('0xd'),auth[_0xdb05('0x9')](),controller[_0xdb05('0xe')]);router[_0xdb05('0xf')]('/',auth[_0xdb05('0x9')](),controller[_0xdb05('0x10')]);router[_0xdb05('0x11')](_0xdb05('0xd'),auth[_0xdb05('0x9')](),controller[_0xdb05('0x12')]);router[_0xdb05('0x13')](_0xdb05('0xd'),auth[_0xdb05('0x9')](),controller['destroy']);module[_0xdb05('0x14')]=router; \ No newline at end of file +var _0x663f=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get'];(function(_0x56260c,_0x3594bc){var _0x3293b9=function(_0x3e1744){while(--_0x3e1744){_0x56260c['push'](_0x56260c['shift']());}};_0x3293b9(++_0x3594bc);}(_0x663f,0xe4));var _0xf663=function(_0x46800d,_0x588500){_0x46800d=_0x46800d-0x0;var _0x3824cd=_0x663f[_0x46800d];return _0x3824cd;};'use strict';var multer=require(_0xf663('0x0'));var util=require(_0xf663('0x1'));var path=require(_0xf663('0x2'));var timeout=require(_0xf663('0x3'));var express=require(_0xf663('0x4'));var router=express[_0xf663('0x5')]();var fs_extra=require(_0xf663('0x6'));var auth=require(_0xf663('0x7'));var interaction=require(_0xf663('0x8'));var config=require(_0xf663('0x9'));var controller=require(_0xf663('0xa'));router[_0xf663('0xb')]('/',auth[_0xf663('0xc')](),controller[_0xf663('0xd')]);router[_0xf663('0xb')](_0xf663('0xe'),auth['isAuthenticated'](),controller[_0xf663('0xf')]);router[_0xf663('0xb')](_0xf663('0x10'),auth[_0xf663('0xc')](),controller[_0xf663('0x11')]);router[_0xf663('0x12')]('/',auth[_0xf663('0xc')](),controller[_0xf663('0x13')]);router[_0xf663('0x14')](_0xf663('0x10'),auth['isAuthenticated'](),controller[_0xf663('0x15')]);router[_0xf663('0x16')](_0xf663('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xf663('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 17f5b18..c38d428 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 _0xc6ac=['STRING','DATE','moment'];(function(_0x31c129,_0xaf1b93){var _0x51d513=function(_0x30d059){while(--_0x30d059){_0x31c129['push'](_0x31c129['shift']());}};_0x51d513(++_0xaf1b93);}(_0xc6ac,0xb3));var _0xcc6a=function(_0x27805b,_0x66db22){_0x27805b=_0x27805b-0x0;var _0x24b450=_0xc6ac[_0x27805b];return _0x24b450;};'use strict';var moment=require(_0xcc6a('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xcc6a('0x1')]},'joinAt':{'type':Sequelize[_0xcc6a('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xcc6a('0x2')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xcc6a('0x1')]}}; \ No newline at end of file +var _0x20c3=['STRING','DATE','moment','sequelize','exports'];(function(_0x295116,_0x23dd12){var _0x4aa164=function(_0x1c0446){while(--_0x1c0446){_0x295116['push'](_0x295116['shift']());}};_0x4aa164(++_0x23dd12);}(_0x20c3,0x1b0));var _0x320c=function(_0x1f2d32,_0x1b50ed){_0x1f2d32=_0x1f2d32-0x0;var _0xe3dc96=_0x20c3[_0x1f2d32];return _0xe3dc96;};'use strict';var moment=require(_0x320c('0x0'));var Sequelize=require(_0x320c('0x1'));module[_0x320c('0x2')]={'uniqueid':{'type':Sequelize[_0x320c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x320c('0x3')]},'joinAt':{'type':Sequelize[_0x320c('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x320c('0x4')]},'exitAt':{'type':Sequelize[_0x320c('0x4')]},'reason':{'type':Sequelize[_0x320c('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 5ac3795..82826c5 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 _0x4888=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','apply','reject','save','then','sendStatus','error','name','send','index','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','MailQueueReport','includeAll','include','rows','catch','params','options','create','body','update','find','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x4888,0x198));var _0x8488=function(_0x171ac7,_0x339c8d){_0x171ac7=_0x171ac7-0x0;var _0x94478d=_0x4888[_0x171ac7];return _0x94478d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14462e,_0x3d1f7a){_0x3d1f7a=_0x3d1f7a||0xcc;return function(_0x58f83d){if(_0x58f83d){return _0x14462e['sendStatus'](_0x3d1f7a);}return _0x14462e[_0x8488('0x17')](_0x3d1f7a)['end']();};}function respondWithResult(_0x214083,_0x4e94fc){_0x4e94fc=_0x4e94fc||0xc8;return function(_0x5161a3){if(_0x5161a3){return _0x214083[_0x8488('0x17')](_0x4e94fc)[_0x8488('0x18')](_0x5161a3);}};}function respondWithFilteredResult(_0x5700b,_0x2bcb7c){return function(_0x3b3cfa){if(_0x3b3cfa){var _0x8d3b3d=typeof _0x2bcb7c[_0x8488('0x19')]==='undefined'&&typeof _0x2bcb7c[_0x8488('0x1a')]===_0x8488('0x1b');var _0x3edfe4=_0x3b3cfa[_0x8488('0x1c')];var _0x60ae2f=_0x8d3b3d?0x0:_0x2bcb7c[_0x8488('0x19')];var _0x1aedb1=_0x8d3b3d?_0x3b3cfa[_0x8488('0x1c')]:_0x2bcb7c[_0x8488('0x19')]+_0x2bcb7c[_0x8488('0x1a')];var _0x10bfd6;if(_0x1aedb1>=_0x3edfe4){_0x1aedb1=_0x3edfe4;_0x10bfd6=0xc8;}else{_0x10bfd6=0xce;}_0x5700b[_0x8488('0x17')](_0x10bfd6);return _0x5700b[_0x8488('0x1d')]('Content-Range',_0x60ae2f+'-'+_0x1aedb1+'/'+_0x3edfe4)['json'](_0x3b3cfa);}return null;};}function patchUpdates(_0x340d6b){return function(_0x12d40f){try{jsonpatch[_0x8488('0x1e')](_0x12d40f,_0x340d6b,!![]);}catch(_0x3c9fc2){return BPromise[_0x8488('0x1f')](_0x3c9fc2);}return _0x12d40f[_0x8488('0x20')]();};}function saveUpdates(_0x43b672,_0x3c078c){return function(_0x39dd43){if(_0x39dd43){return _0x39dd43['update'](_0x43b672)[_0x8488('0x21')](function(_0x4e07e1){return _0x4e07e1;});}return null;};}function removeEntity(_0x140b0b,_0x1361a6){return function(_0x290b33){if(_0x290b33){return _0x290b33['destroy']()['then'](function(){_0x140b0b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x472624,_0x51fe30){return function(_0x58057a){if(!_0x58057a){_0x472624[_0x8488('0x22')](0x194);}return _0x58057a;};}function handleError(_0x2f350a,_0x2b3c97){_0x2b3c97=_0x2b3c97||0x1f4;return function(_0x6ebee0){logger[_0x8488('0x23')](_0x6ebee0['stack']);if(_0x6ebee0[_0x8488('0x24')]){delete _0x6ebee0[_0x8488('0x24')];}_0x2f350a[_0x8488('0x17')](_0x2b3c97)[_0x8488('0x25')](_0x6ebee0);};}exports[_0x8488('0x26')]=function(_0x27f5cf,_0x2c15ff){var _0x296b6c={},_0x368f9c={},_0x1d9317={'count':0x0,'rows':[]};var _0x888b24=_['map'](db['MailQueueReport']['rawAttributes'],function(_0x292fe8){return{'name':_0x292fe8[_0x8488('0x27')],'type':_0x292fe8[_0x8488('0x28')][_0x8488('0x29')]};});_0x368f9c[_0x8488('0x2a')]=_[_0x8488('0x2b')](_0x888b24,'name');_0x368f9c[_0x8488('0x2c')]=_[_0x8488('0x2d')](_0x27f5cf[_0x8488('0x2c')]);_0x368f9c[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x368f9c['model'],_0x368f9c[_0x8488('0x2c')]);_0x296b6c[_0x8488('0x30')]=_['intersection'](_0x368f9c[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x31')]));_0x296b6c[_0x8488('0x30')]=_0x296b6c['attributes'][_0x8488('0x32')]?_0x296b6c[_0x8488('0x30')]:_0x368f9c[_0x8488('0x2a')];if(!_0x27f5cf['query'][_0x8488('0x33')]('nolimit')){_0x296b6c[_0x8488('0x1a')]=qs[_0x8488('0x1a')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x1a')]);_0x296b6c['offset']=qs[_0x8488('0x19')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x19')]);}_0x296b6c['order']=qs[_0x8488('0x34')](_0x27f5cf[_0x8488('0x2c')][_0x8488('0x34')]);_0x296b6c[_0x8488('0x35')]=qs[_0x8488('0x2e')](_[_0x8488('0x36')](_0x27f5cf[_0x8488('0x2c')],_0x368f9c[_0x8488('0x2e')]),_0x888b24);if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]){_0x296b6c[_0x8488('0x35')]=_['merge'](_0x296b6c['where'],{'$or':_[_0x8488('0x2b')](_0x888b24,function(_0x36c17a){if(_0x36c17a[_0x8488('0x28')]!==_0x8488('0x38')){var _0x2d9fa1={};_0x2d9fa1[_0x36c17a[_0x8488('0x24')]]={'$like':'%'+_0x27f5cf[_0x8488('0x2c')][_0x8488('0x37')]+'%'};return _0x2d9fa1;}})});}_0x296b6c=_[_0x8488('0x39')]({},_0x296b6c,_0x27f5cf['options']);var _0xf5a0a0={'where':_0x296b6c[_0x8488('0x35')]};return db[_0x8488('0x3a')]['count'](_0xf5a0a0)[_0x8488('0x21')](function(_0xa50c4b){_0x1d9317[_0x8488('0x1c')]=_0xa50c4b;if(_0x27f5cf[_0x8488('0x2c')][_0x8488('0x3b')]){_0x296b6c[_0x8488('0x3c')]=[{'all':!![]}];}return db[_0x8488('0x3a')]['findAll'](_0x296b6c);})[_0x8488('0x21')](function(_0x1c33a1){_0x1d9317[_0x8488('0x3d')]=_0x1c33a1;return _0x1d9317;})['then'](respondWithFilteredResult(_0x2c15ff,_0x296b6c))[_0x8488('0x3e')](handleError(_0x2c15ff,null));};exports['show']=function(_0x40ee7e,_0x34b11b){var _0x5cbd11={'raw':!![],'where':{'id':_0x40ee7e[_0x8488('0x3f')]['id']}},_0x22a3f3={};_0x22a3f3[_0x8488('0x2a')]=_[_0x8488('0x2d')](db[_0x8488('0x3a')]['rawAttributes']);_0x22a3f3[_0x8488('0x2c')]=_['keys'](_0x40ee7e[_0x8488('0x2c')]);_0x22a3f3[_0x8488('0x2e')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],_0x22a3f3[_0x8488('0x2c')]);_0x5cbd11[_0x8488('0x30')]=_[_0x8488('0x2f')](_0x22a3f3[_0x8488('0x2a')],qs[_0x8488('0x31')](_0x40ee7e[_0x8488('0x2c')][_0x8488('0x31')]));_0x5cbd11[_0x8488('0x30')]=_0x5cbd11[_0x8488('0x30')][_0x8488('0x32')]?_0x5cbd11[_0x8488('0x30')]:_0x22a3f3[_0x8488('0x2a')];if(_0x40ee7e[_0x8488('0x2c')]['includeAll']){_0x5cbd11[_0x8488('0x3c')]=[{'all':!![]}];}_0x5cbd11=_[_0x8488('0x39')]({},_0x5cbd11,_0x40ee7e[_0x8488('0x40')]);return db[_0x8488('0x3a')]['find'](_0x5cbd11)[_0x8488('0x21')](handleEntityNotFound(_0x34b11b,null))[_0x8488('0x21')](respondWithResult(_0x34b11b,null))[_0x8488('0x3e')](handleError(_0x34b11b,null));};exports[_0x8488('0x41')]=function(_0x52042c,_0x1f0516){return db[_0x8488('0x3a')][_0x8488('0x41')](_0x52042c[_0x8488('0x42')],{})[_0x8488('0x21')](respondWithResult(_0x1f0516,0xc9))[_0x8488('0x3e')](handleError(_0x1f0516,null));};exports[_0x8488('0x43')]=function(_0x299d8e,_0x1bc2e1){if(_0x299d8e[_0x8488('0x42')]['id']){delete _0x299d8e[_0x8488('0x42')]['id'];}return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x299d8e['params']['id']}})['then'](handleEntityNotFound(_0x1bc2e1,null))[_0x8488('0x21')](saveUpdates(_0x299d8e[_0x8488('0x42')],null))[_0x8488('0x21')](respondWithResult(_0x1bc2e1,null))[_0x8488('0x3e')](handleError(_0x1bc2e1,null));};exports[_0x8488('0x45')]=function(_0x22d22c,_0x25f2dc){return db[_0x8488('0x3a')][_0x8488('0x44')]({'where':{'id':_0x22d22c['params']['id']}})[_0x8488('0x21')](handleEntityNotFound(_0x25f2dc,null))[_0x8488('0x21')](removeEntity(_0x25f2dc,null))['catch'](handleError(_0x25f2dc,null));};exports[_0x8488('0x46')]=function(_0x313e00,_0x186747){return db[_0x8488('0x3a')]['describe']()[_0x8488('0x21')](respondWithResult(_0x186747,null))[_0x8488('0x3e')](handleError(_0x186747,null));}; \ No newline at end of file +var _0xda2d=['send','index','map','MailQueueReport','rawAttributes','fieldName','type','model','filters','fields','query','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','keys','intersection','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','error','name'];(function(_0x526818,_0x30c916){var _0x44c7e3=function(_0x364d90){while(--_0x364d90){_0x526818['push'](_0x526818['shift']());}};_0x44c7e3(++_0x30c916);}(_0xda2d,0x102));var _0xdda2=function(_0x157702,_0x46e386){_0x157702=_0x157702-0x0;var _0x35a0ab=_0xda2d[_0x157702];return _0x35a0ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda2('0x0'));var zipdir=require(_0xdda2('0x1'));var jsonpatch=require(_0xdda2('0x2'));var rp=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdda2('0x5'));var sox=require(_0xdda2('0x6'));var csv=require(_0xdda2('0x7'));var ejs=require(_0xdda2('0x8'));var fs=require('fs');var fs_extra=require(_0xdda2('0x9'));var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56d25d,_0xa6446b){_0xa6446b=_0xa6446b||0xcc;return function(_0x320f73){if(_0x320f73){return _0x56d25d[_0xdda2('0x19')](_0xa6446b);}return _0x56d25d[_0xdda2('0x1a')](_0xa6446b)[_0xdda2('0x1b')]();};}function respondWithResult(_0x475222,_0x3490f1){_0x3490f1=_0x3490f1||0xc8;return function(_0x4df902){if(_0x4df902){return _0x475222[_0xdda2('0x1a')](_0x3490f1)['json'](_0x4df902);}};}function respondWithFilteredResult(_0xbef148,_0xb6b01e){return function(_0x3553d5){if(_0x3553d5){var _0x457764=typeof _0xb6b01e[_0xdda2('0x1c')]==='undefined'&&typeof _0xb6b01e['limit']===_0xdda2('0x1d');var _0x518c6d=_0x3553d5[_0xdda2('0x1e')];var _0x1a3b35=_0x457764?0x0:_0xb6b01e[_0xdda2('0x1c')];var _0x2b6ee8=_0x457764?_0x3553d5[_0xdda2('0x1e')]:_0xb6b01e[_0xdda2('0x1c')]+_0xb6b01e[_0xdda2('0x1f')];var _0x351151;if(_0x2b6ee8>=_0x518c6d){_0x2b6ee8=_0x518c6d;_0x351151=0xc8;}else{_0x351151=0xce;}_0xbef148[_0xdda2('0x1a')](_0x351151);return _0xbef148[_0xdda2('0x20')](_0xdda2('0x21'),_0x1a3b35+'-'+_0x2b6ee8+'/'+_0x518c6d)[_0xdda2('0x22')](_0x3553d5);}return null;};}function patchUpdates(_0x4eed30){return function(_0x41fe7d){try{jsonpatch['apply'](_0x41fe7d,_0x4eed30,!![]);}catch(_0xc4567c){return BPromise[_0xdda2('0x23')](_0xc4567c);}return _0x41fe7d[_0xdda2('0x24')]();};}function saveUpdates(_0x4c5226,_0x347ee6){return function(_0x5a9bb8){if(_0x5a9bb8){return _0x5a9bb8[_0xdda2('0x25')](_0x4c5226)[_0xdda2('0x26')](function(_0x4ac3eb){return _0x4ac3eb;});}return null;};}function removeEntity(_0x144f1e,_0xfda248){return function(_0x2528d7){if(_0x2528d7){return _0x2528d7[_0xdda2('0x27')]()[_0xdda2('0x26')](function(){_0x144f1e['status'](0xcc)[_0xdda2('0x1b')]();});}};}function handleEntityNotFound(_0x4be5ea,_0x2391a5){return function(_0x31d48b){if(!_0x31d48b){_0x4be5ea['sendStatus'](0x194);}return _0x31d48b;};}function handleError(_0x4e97dc,_0x28da54){_0x28da54=_0x28da54||0x1f4;return function(_0x4567e7){logger[_0xdda2('0x28')](_0x4567e7['stack']);if(_0x4567e7[_0xdda2('0x29')]){delete _0x4567e7[_0xdda2('0x29')];}_0x4e97dc[_0xdda2('0x1a')](_0x28da54)[_0xdda2('0x2a')](_0x4567e7);};}exports[_0xdda2('0x2b')]=function(_0x91b41a,_0x4bb8a4){var _0x24c37d={},_0x255bbc={},_0x53acb5={'count':0x0,'rows':[]};var _0x45e800=_[_0xdda2('0x2c')](db[_0xdda2('0x2d')][_0xdda2('0x2e')],function(_0x5540e5){return{'name':_0x5540e5[_0xdda2('0x2f')],'type':_0x5540e5[_0xdda2('0x30')]['key']};});_0x255bbc[_0xdda2('0x31')]=_['map'](_0x45e800,_0xdda2('0x29'));_0x255bbc['query']=_['keys'](_0x91b41a['query']);_0x255bbc[_0xdda2('0x32')]=_['intersection'](_0x255bbc[_0xdda2('0x31')],_0x255bbc['query']);_0x24c37d['attributes']=_['intersection'](_0x255bbc[_0xdda2('0x31')],qs[_0xdda2('0x33')](_0x91b41a[_0xdda2('0x34')][_0xdda2('0x33')]));_0x24c37d[_0xdda2('0x35')]=_0x24c37d[_0xdda2('0x35')][_0xdda2('0x36')]?_0x24c37d[_0xdda2('0x35')]:_0x255bbc[_0xdda2('0x31')];if(!_0x91b41a[_0xdda2('0x34')]['hasOwnProperty'](_0xdda2('0x37'))){_0x24c37d[_0xdda2('0x1f')]=qs[_0xdda2('0x1f')](_0x91b41a[_0xdda2('0x34')][_0xdda2('0x1f')]);_0x24c37d[_0xdda2('0x1c')]=qs[_0xdda2('0x1c')](_0x91b41a['query']['offset']);}_0x24c37d[_0xdda2('0x38')]=qs[_0xdda2('0x39')](_0x91b41a[_0xdda2('0x34')]['sort']);_0x24c37d['where']=qs[_0xdda2('0x32')](_[_0xdda2('0x3a')](_0x91b41a[_0xdda2('0x34')],_0x255bbc[_0xdda2('0x32')]),_0x45e800);if(_0x91b41a[_0xdda2('0x34')]['filter']){_0x24c37d[_0xdda2('0x3b')]=_[_0xdda2('0x3c')](_0x24c37d['where'],{'$or':_['map'](_0x45e800,function(_0x98bf47){if(_0x98bf47[_0xdda2('0x30')]!==_0xdda2('0x3d')){var _0x2708f4={};_0x2708f4[_0x98bf47[_0xdda2('0x29')]]={'$like':'%'+_0x91b41a['query'][_0xdda2('0x3e')]+'%'};return _0x2708f4;}})});}_0x24c37d=_[_0xdda2('0x3c')]({},_0x24c37d,_0x91b41a[_0xdda2('0x3f')]);var _0x1a7262={'where':_0x24c37d['where']};return db['MailQueueReport'][_0xdda2('0x1e')](_0x1a7262)[_0xdda2('0x26')](function(_0x7a25fe){_0x53acb5['count']=_0x7a25fe;if(_0x91b41a[_0xdda2('0x34')]['includeAll']){_0x24c37d[_0xdda2('0x40')]=[{'all':!![]}];}return db['MailQueueReport'][_0xdda2('0x41')](_0x24c37d);})[_0xdda2('0x26')](function(_0x1db762){_0x53acb5[_0xdda2('0x42')]=_0x1db762;return _0x53acb5;})['then'](respondWithFilteredResult(_0x4bb8a4,_0x24c37d))[_0xdda2('0x43')](handleError(_0x4bb8a4,null));};exports['show']=function(_0x392f70,_0x4d3b78){var _0x1d1678={'raw':!![],'where':{'id':_0x392f70[_0xdda2('0x44')]['id']}},_0x12589b={};_0x12589b[_0xdda2('0x31')]=_[_0xdda2('0x45')](db['MailQueueReport'][_0xdda2('0x2e')]);_0x12589b[_0xdda2('0x34')]=_['keys'](_0x392f70[_0xdda2('0x34')]);_0x12589b['filters']=_[_0xdda2('0x46')](_0x12589b[_0xdda2('0x31')],_0x12589b[_0xdda2('0x34')]);_0x1d1678[_0xdda2('0x35')]=_[_0xdda2('0x46')](_0x12589b[_0xdda2('0x31')],qs[_0xdda2('0x33')](_0x392f70[_0xdda2('0x34')][_0xdda2('0x33')]));_0x1d1678[_0xdda2('0x35')]=_0x1d1678[_0xdda2('0x35')][_0xdda2('0x36')]?_0x1d1678[_0xdda2('0x35')]:_0x12589b['model'];if(_0x392f70['query']['includeAll']){_0x1d1678[_0xdda2('0x40')]=[{'all':!![]}];}_0x1d1678=_[_0xdda2('0x3c')]({},_0x1d1678,_0x392f70['options']);return db[_0xdda2('0x2d')][_0xdda2('0x47')](_0x1d1678)[_0xdda2('0x26')](handleEntityNotFound(_0x4d3b78,null))['then'](respondWithResult(_0x4d3b78,null))[_0xdda2('0x43')](handleError(_0x4d3b78,null));};exports[_0xdda2('0x48')]=function(_0x4eada0,_0x5f0aa8){return db[_0xdda2('0x2d')]['create'](_0x4eada0[_0xdda2('0x49')],{})['then'](respondWithResult(_0x5f0aa8,0xc9))[_0xdda2('0x43')](handleError(_0x5f0aa8,null));};exports[_0xdda2('0x25')]=function(_0x50bd88,_0x585665){if(_0x50bd88[_0xdda2('0x49')]['id']){delete _0x50bd88[_0xdda2('0x49')]['id'];}return db[_0xdda2('0x2d')][_0xdda2('0x47')]({'where':{'id':_0x50bd88['params']['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x585665,null))[_0xdda2('0x26')](saveUpdates(_0x50bd88[_0xdda2('0x49')],null))[_0xdda2('0x26')](respondWithResult(_0x585665,null))[_0xdda2('0x43')](handleError(_0x585665,null));};exports['destroy']=function(_0x1a56cc,_0x40b610){return db['MailQueueReport'][_0xdda2('0x47')]({'where':{'id':_0x1a56cc[_0xdda2('0x44')]['id']}})[_0xdda2('0x26')](handleEntityNotFound(_0x40b610,null))[_0xdda2('0x26')](removeEntity(_0x40b610,null))[_0xdda2('0x43')](handleError(_0x40b610,null));};exports[_0xdda2('0x4a')]=function(_0x4b6519,_0x2c58c7){return db['MailQueueReport'][_0xdda2('0x4a')]()['then'](respondWithResult(_0x2c58c7,null))[_0xdda2('0x43')](handleError(_0x2c58c7,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index bb340f7..b0b976b 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 _0x88a1=['exports','define','MailQueueReport','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','./mailQueueReport.attributes'];(function(_0x418734,_0x3ae8b8){var _0x194dc0=function(_0xc8af3e){while(--_0xc8af3e){_0x418734['push'](_0x418734['shift']());}};_0x194dc0(++_0x3ae8b8);}(_0x88a1,0x1c7));var _0x188a=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x88a1[_0x3a8db5];return _0x2c03cd;};'use strict';var _=require(_0x188a('0x0'));var util=require('util');var logger=require(_0x188a('0x1'))('api');var moment=require(_0x188a('0x2'));var BPromise=require(_0x188a('0x3'));var rp=require(_0x188a('0x4'));var fs=require('fs');var path=require(_0x188a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x188a('0x6'));module[_0x188a('0x7')]=function(_0x1f7e63,_0x5d616f){return _0x1f7e63[_0x188a('0x8')](_0x188a('0x9'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x188a('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf0a8=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0xf0a8,0xb4));var _0x8f0a=function(_0x46c28e,_0x559e9b){_0x46c28e=_0x46c28e-0x0;var _0x6653ba=_0xf0a8[_0x46c28e];return _0x6653ba;};'use strict';var _=require(_0x8f0a('0x0'));var util=require(_0x8f0a('0x1'));var logger=require(_0x8f0a('0x2'))(_0x8f0a('0x3'));var moment=require(_0x8f0a('0x4'));var BPromise=require(_0x8f0a('0x5'));var rp=require(_0x8f0a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f0a('0x7'));var config=require(_0x8f0a('0x8'));var attributes=require(_0x8f0a('0x9'));module[_0x8f0a('0xa')]=function(_0x32146a,_0x3276d7){return _0x32146a[_0x8f0a('0xb')](_0x8f0a('0xc'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x8f0a('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index b224864..23b9fe2 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 _0x7a54=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','MailQueueReport','create','body','options','raw','CreateMailQueueReport','UpdateMailQueueReport','update','where','attributes','limit','then','lodash','util'];(function(_0x12343b,_0x29b0e5){var _0x36f73d=function(_0x27b277){while(--_0x27b277){_0x12343b['push'](_0x12343b['shift']());}};_0x36f73d(++_0x29b0e5);}(_0x7a54,0x106));var _0x47a5=function(_0x2fc769,_0x34e8a7){_0x2fc769=_0x2fc769-0x0;var _0x3f2798=_0x7a54[_0x2fc769];return _0x3f2798;};'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')]('MailQueueReport,\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['CreateMailQueueReport']=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')]('CreateMailQueueReport',_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')]));});});};exports[_0x47a5('0x1b')]=function(_0x513981){var _0x28747d=this;return new Promise(function(_0xc4cd63,_0x4437f1){return db[_0x47a5('0x15')][_0x47a5('0x1c')](_0x513981['body'],{'raw':_0x513981['options']?_0x513981[_0x47a5('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x513981[_0x47a5('0x18')]?_0x513981['options'][_0x47a5('0x1d')]||null:null,'attributes':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1e')]||null:null,'limit':_0x513981[_0x47a5('0x18')]?_0x513981[_0x47a5('0x18')][_0x47a5('0x1f')]||null:null})[_0x47a5('0x20')](function(_0x16631f){logger[_0x47a5('0xb')](_0x47a5('0x1b'),_0x513981);logger[_0x47a5('0xd')](_0x47a5('0x1b'),_0x513981,JSON['stringify'](_0x16631f));_0xc4cd63(_0x16631f);})[_0x47a5('0x14')](function(_0x51833b){logger[_0x47a5('0xf')](_0x47a5('0x1b'),_0x51833b[_0x47a5('0x11')],_0x513981);_0x4437f1(_0x28747d['error'](0x1f4,_0x51833b[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x3386fd,_0x8596f4){var _0x19e6f6=function(_0x4bd4ec){while(--_0x4bd4ec){_0x3386fd['push'](_0x3386fd['shift']());}};_0x19e6f6(++_0x8596f4);}(_0x2ef3,0xba));var _0x32ef=function(_0x14a3c9,_0x1771c0){_0x14a3c9=_0x14a3c9-0x0;var _0xc82e7=_0x2ef3[_0x14a3c9];return _0xc82e7;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index e5aec06..7e11d03 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x266f2e,_0x590e8f){var _0x3d0a0c=function(_0x3314b3){while(--_0x3314b3){_0x266f2e['push'](_0x266f2e['shift']());}};_0x3d0a0c(++_0x590e8f);}(_0xedd9,0xfc));var _0x9edd=function(_0x58185e,_0x22b245){_0x58185e=_0x58185e-0x0;var _0x7c103c=_0xedd9[_0x58185e];return _0x7c103c;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x57dffb,_0x218ca8){var _0x1eff9a=function(_0x1caaa5){while(--_0x1caaa5){_0x57dffb['push'](_0x57dffb['shift']());}};_0x1eff9a(++_0x218ca8);}(_0xe706,0xa3));var _0x6e70=function(_0x1265fa,_0x1a1fed){_0x1265fa=_0x1265fa-0x0;var _0x1fe35e=_0xe706[_0x1265fa];return _0x1fe35e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 4df1187..bb2a4f8 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 _0x3495=['STRING','BOOLEAN','INTEGER','INBOX','sequelize','exports'];(function(_0x5e1c8b,_0xbe766e){var _0x14156f=function(_0x15257b){while(--_0x15257b){_0x5e1c8b['push'](_0x5e1c8b['shift']());}};_0x14156f(++_0xbe766e);}(_0x3495,0x1de));var _0x5349=function(_0x5184a8,_0x2905f0){_0x5184a8=_0x5184a8-0x0;var _0x3a6bfd=_0x3495[_0x5184a8];return _0x3a6bfd;};'use strict';var Sequelize=require(_0x5349('0x0'));module[_0x5349('0x1')]={'description':{'type':Sequelize[_0x5349('0x2')]},'host':{'type':Sequelize[_0x5349('0x2')]},'authentication':{'type':Sequelize[_0x5349('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5349('0x2')]},'password':{'type':Sequelize[_0x5349('0x2')]},'port':{'type':Sequelize[_0x5349('0x4')]},'tls':{'type':Sequelize[_0x5349('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x5349('0x5')},'connTimeout':{'type':Sequelize[_0x5349('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x5349('0x2')]}}; \ No newline at end of file +var _0x69d3=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x263b73,_0x3c0a19){var _0x4f620a=function(_0x36e1ac){while(--_0x36e1ac){_0x263b73['push'](_0x263b73['shift']());}};_0x4f620a(++_0x3c0a19);}(_0x69d3,0xda));var _0x369d=function(_0x54184f,_0x11c77b){_0x54184f=_0x54184f-0x0;var _0x4d411b=_0x69d3[_0x54184f];return _0x4d411b;};'use strict';var Sequelize=require(_0x369d('0x0'));module[_0x369d('0x1')]={'description':{'type':Sequelize[_0x369d('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x369d('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x369d('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x369d('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x369d('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x369d('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x369d('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 38a3912..8033ece 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 _0xfa30=['define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0xfa30,0x145));var _0x0fa3=function(_0x2e3819,_0x5d3ec2){_0x2e3819=_0x2e3819-0x0;var _0x4ecaff=_0xfa30[_0x2e3819];return _0x4ecaff;};'use strict';var _=require(_0x0fa3('0x0'));var util=require(_0x0fa3('0x1'));var logger=require(_0x0fa3('0x2'))(_0x0fa3('0x3'));var moment=require(_0x0fa3('0x4'));var BPromise=require(_0x0fa3('0x5'));var rp=require(_0x0fa3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0fa3('0x7'));var config=require(_0x0fa3('0x8'));var attributes=require(_0x0fa3('0x9'));module[_0x0fa3('0xa')]=function(_0x3ab3e0,_0x4676c7){return _0x3ab3e0[_0x0fa3('0xb')](_0x0fa3('0xc'),attributes,{'tableName':_0x0fa3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb978=['define','mail_servers_in','lodash','../../config/logger','api','request-promise','../../config/environment','./mailServerIn.attributes'];(function(_0x5ebf6a,_0x47963a){var _0x5742d9=function(_0x3d356c){while(--_0x3d356c){_0x5ebf6a['push'](_0x5ebf6a['shift']());}};_0x5742d9(++_0x47963a);}(_0xb978,0x1aa));var _0x8b97=function(_0x777bd2,_0x58a9c7){_0x777bd2=_0x777bd2-0x0;var _0x2e0259=_0xb978[_0x777bd2];return _0x2e0259;};'use strict';var _=require(_0x8b97('0x0'));var util=require('util');var logger=require(_0x8b97('0x1'))(_0x8b97('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8b97('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8b97('0x4'));var attributes=require(_0x8b97('0x5'));module['exports']=function(_0x26f8af,_0x2eb2a3){return _0x26f8af[_0x8b97('0x6')]('MailServerIn',attributes,{'tableName':_0x8b97('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 5c0b666..a56c45b 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 _0x8cc8=['model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetMailServerIn','MailServerIn','findAll','options','attributes','limit','include','map'];(function(_0x34da93,_0x265c57){var _0x21c0cf=function(_0x5145cf){while(--_0x5145cf){_0x34da93['push'](_0x34da93['shift']());}};_0x21c0cf(++_0x265c57);}(_0x8cc8,0x177));var _0x88cc=function(_0x36690d,_0x23a717){_0x36690d=_0x36690d-0x0;var _0x146ff5=_0x8cc8[_0x36690d];return _0x146ff5;};'use strict';var _=require(_0x88cc('0x0'));var util=require(_0x88cc('0x1'));var moment=require(_0x88cc('0x2'));var BPromise=require(_0x88cc('0x3'));var rs=require(_0x88cc('0x4'));var fs=require('fs');var Redis=require(_0x88cc('0x5'));var db=require(_0x88cc('0x6'))['db'];var utils=require(_0x88cc('0x7'));var logger=require(_0x88cc('0x8'))(_0x88cc('0x9'));var config=require(_0x88cc('0xa'));var jayson=require(_0x88cc('0xb'));var client=jayson[_0x88cc('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58bdd5,_0x3d35ed,_0x2db13a){return new BPromise(function(_0x219585,_0x4471b0){return client['request'](_0x58bdd5,_0x2db13a)[_0x88cc('0xd')](function(_0x2e77ae){logger['info'](_0x88cc('0xe'),_0x3d35ed,'request\x20sent');logger[_0x88cc('0xf')](_0x88cc('0x10'),_0x3d35ed,_0x88cc('0x11'),JSON[_0x88cc('0x12')](_0x2e77ae));if(_0x2e77ae['error']){if(_0x2e77ae[_0x88cc('0x13')][_0x88cc('0x14')]===0x1f4){logger[_0x88cc('0x13')](_0x88cc('0xe'),_0x3d35ed,_0x2e77ae[_0x88cc('0x13')][_0x88cc('0x15')]);return _0x4471b0(_0x2e77ae[_0x88cc('0x13')][_0x88cc('0x15')]);}logger['error'](_0x88cc('0xe'),_0x3d35ed,_0x2e77ae[_0x88cc('0x13')][_0x88cc('0x15')]);return _0x219585(_0x2e77ae[_0x88cc('0x13')][_0x88cc('0x15')]);}else{logger[_0x88cc('0x16')]('MailServerIn,\x20%s,\x20%s',_0x3d35ed,_0x88cc('0x11'));_0x219585(_0x2e77ae[_0x88cc('0x17')][_0x88cc('0x15')]);}})[_0x88cc('0x18')](function(_0x13ff73){logger['error'](_0x88cc('0xe'),_0x3d35ed,_0x13ff73);_0x4471b0(_0x13ff73);});});}exports[_0x88cc('0x19')]=function(_0x34fb65){var _0x3a6289=this;return new Promise(function(_0x33144a,_0x4a377a){return db[_0x88cc('0x1a')][_0x88cc('0x1b')]({'raw':_0x34fb65['options']?_0x34fb65[_0x88cc('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x34fb65[_0x88cc('0x1c')]?_0x34fb65[_0x88cc('0x1c')]['where']||null:null,'attributes':_0x34fb65[_0x88cc('0x1c')]?_0x34fb65[_0x88cc('0x1c')][_0x88cc('0x1d')]||null:null,'limit':_0x34fb65[_0x88cc('0x1c')]?_0x34fb65[_0x88cc('0x1c')][_0x88cc('0x1e')]||null:null,'include':_0x34fb65['options']?_0x34fb65[_0x88cc('0x1c')][_0x88cc('0x1f')]?_[_0x88cc('0x20')](_0x34fb65[_0x88cc('0x1c')][_0x88cc('0x1f')],function(_0x3c2353){return{'model':db[_0x3c2353[_0x88cc('0x21')]],'as':_0x3c2353['as'],'attributes':_0x3c2353[_0x88cc('0x1d')],'include':_0x3c2353[_0x88cc('0x1f')]?_[_0x88cc('0x20')](_0x3c2353[_0x88cc('0x1f')],function(_0x35c695){return{'model':db[_0x35c695[_0x88cc('0x21')]],'as':_0x35c695['as'],'attributes':_0x35c695['attributes'],'include':_0x35c695[_0x88cc('0x1f')]?_[_0x88cc('0x20')](_0x35c695[_0x88cc('0x1f')],function(_0x3474b6){return{'model':db[_0x3474b6[_0x88cc('0x21')]],'as':_0x3474b6['as'],'attributes':_0x3474b6[_0x88cc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x88cc('0xd')](function(_0xdced80){logger['info']('GetMailServerIn',_0x34fb65);logger[_0x88cc('0xf')](_0x88cc('0x19'),_0x34fb65,JSON[_0x88cc('0x12')](_0xdced80));_0x33144a(_0xdced80);})['catch'](function(_0x570ea0){logger[_0x88cc('0x13')](_0x88cc('0x19'),_0x570ea0['message'],_0x34fb65);_0x4a377a(_0x3a6289[_0x88cc('0x13')](0x1f4,_0x570ea0[_0x88cc('0x15')]));});});}; \ No newline at end of file +var _0x6652=['raw','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options'];(function(_0x27f67f,_0x2f5de7){var _0x1b12b2=function(_0x32783e){while(--_0x32783e){_0x27f67f['push'](_0x27f67f['shift']());}};_0x1b12b2(++_0x2f5de7);}(_0x6652,0xf3));var _0x2665=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0x6652[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0x2665('0x0'));var util=require(_0x2665('0x1'));var moment=require(_0x2665('0x2'));var BPromise=require(_0x2665('0x3'));var rs=require(_0x2665('0x4'));var fs=require('fs');var Redis=require(_0x2665('0x5'));var db=require(_0x2665('0x6'))['db'];var utils=require(_0x2665('0x7'));var logger=require(_0x2665('0x8'))('rpc');var config=require(_0x2665('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2665('0xa')][_0x2665('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb5be6,_0x20a2c5,_0xf51be5){return new BPromise(function(_0x540a5c,_0x5bc4d9){return client[_0x2665('0xc')](_0xb5be6,_0xf51be5)[_0x2665('0xd')](function(_0x3164e0){logger[_0x2665('0xe')](_0x2665('0xf'),_0x20a2c5,_0x2665('0x10'));logger[_0x2665('0x11')](_0x2665('0x12'),_0x20a2c5,_0x2665('0x10'),JSON[_0x2665('0x13')](_0x3164e0));if(_0x3164e0[_0x2665('0x14')]){if(_0x3164e0[_0x2665('0x14')][_0x2665('0x15')]===0x1f4){logger[_0x2665('0x14')](_0x2665('0xf'),_0x20a2c5,_0x3164e0[_0x2665('0x14')][_0x2665('0x16')]);return _0x5bc4d9(_0x3164e0[_0x2665('0x14')][_0x2665('0x16')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x20a2c5,_0x3164e0[_0x2665('0x14')]['message']);return _0x540a5c(_0x3164e0[_0x2665('0x14')]['message']);}else{logger[_0x2665('0xe')]('MailServerIn,\x20%s,\x20%s',_0x20a2c5,'request\x20sent');_0x540a5c(_0x3164e0[_0x2665('0x17')][_0x2665('0x16')]);}})[_0x2665('0x18')](function(_0x42db54){logger[_0x2665('0x14')](_0x2665('0xf'),_0x20a2c5,_0x42db54);_0x5bc4d9(_0x42db54);});});}exports[_0x2665('0x19')]=function(_0x42fd74){var _0x5ac806=this;return new Promise(function(_0x4e56c9,_0x1b5190){return db[_0x2665('0x1a')][_0x2665('0x1b')]({'raw':_0x42fd74[_0x2665('0x1c')]?_0x42fd74['options'][_0x2665('0x1d')]===undefined?!![]:![]:!![],'where':_0x42fd74[_0x2665('0x1c')]?_0x42fd74['options']['where']||null:null,'attributes':_0x42fd74[_0x2665('0x1c')]?_0x42fd74[_0x2665('0x1c')][_0x2665('0x1e')]||null:null,'limit':_0x42fd74[_0x2665('0x1c')]?_0x42fd74[_0x2665('0x1c')]['limit']||null:null,'include':_0x42fd74[_0x2665('0x1c')]?_0x42fd74['options'][_0x2665('0x1f')]?_[_0x2665('0x20')](_0x42fd74[_0x2665('0x1c')][_0x2665('0x1f')],function(_0x59470b){return{'model':db[_0x59470b[_0x2665('0x21')]],'as':_0x59470b['as'],'attributes':_0x59470b[_0x2665('0x1e')],'include':_0x59470b[_0x2665('0x1f')]?_['map'](_0x59470b[_0x2665('0x1f')],function(_0x3eabd8){return{'model':db[_0x3eabd8['model']],'as':_0x3eabd8['as'],'attributes':_0x3eabd8[_0x2665('0x1e')],'include':_0x3eabd8['include']?_[_0x2665('0x20')](_0x3eabd8[_0x2665('0x1f')],function(_0x32eb3b){return{'model':db[_0x32eb3b[_0x2665('0x21')]],'as':_0x32eb3b['as'],'attributes':_0x32eb3b[_0x2665('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2665('0xd')](function(_0x2c9d1a){logger['info'](_0x2665('0x19'),_0x42fd74);logger[_0x2665('0x11')](_0x2665('0x19'),_0x42fd74,JSON[_0x2665('0x13')](_0x2c9d1a));_0x4e56c9(_0x2c9d1a);})[_0x2665('0x18')](function(_0x748b7b){logger['error']('GetMailServerIn',_0x748b7b[_0x2665('0x16')],_0x42fd74);_0x1b5190(_0x5ac806[_0x2665('0x14')](0x1f4,_0x748b7b['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 08d1331..367d2dc 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(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_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 diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 9c8cef8..4e33bbf 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 _0x803d=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x26dfc5,_0x138166){var _0x566350=function(_0x28b148){while(--_0x28b148){_0x26dfc5['push'](_0x26dfc5['shift']());}};_0x566350(++_0x138166);}(_0x803d,0x15a));var _0xd803=function(_0x4831f0,_0x27d59c){_0x4831f0=_0x4831f0-0x0;var _0x35ff52=_0x803d[_0x4831f0];return _0x35ff52;};'use strict';var Sequelize=require(_0xd803('0x0'));module['exports']={'description':{'type':Sequelize[_0xd803('0x1')]},'host':{'type':Sequelize[_0xd803('0x1')]},'user':{'type':Sequelize[_0xd803('0x1')]},'pass':{'type':Sequelize[_0xd803('0x1')]},'port':{'type':Sequelize[_0xd803('0x2')]},'secure':{'type':Sequelize[_0xd803('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xd803('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7f6a=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x45ce82,_0x4fe2bc){var _0x2f58e9=function(_0x3aada6){while(--_0x3aada6){_0x45ce82['push'](_0x45ce82['shift']());}};_0x2f58e9(++_0x4fe2bc);}(_0x7f6a,0x1b5));var _0xa7f6=function(_0x227331,_0x19be4c){_0x227331=_0x227331-0x0;var _0x31e1dc=_0x7f6a[_0x227331];return _0x31e1dc;};'use strict';var Sequelize=require(_0xa7f6('0x0'));module[_0xa7f6('0x1')]={'description':{'type':Sequelize[_0xa7f6('0x2')]},'host':{'type':Sequelize[_0xa7f6('0x2')]},'user':{'type':Sequelize[_0xa7f6('0x2')]},'pass':{'type':Sequelize[_0xa7f6('0x2')]},'port':{'type':Sequelize[_0xa7f6('0x3')]},'secure':{'type':Sequelize[_0xa7f6('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0xa7f6('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index d573ddc..035bb76 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 _0xf73f=['catch','show','keys','rawAttributes','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','apply','save','update','then','error','stack','name','send','index','map','MailServerOut','fieldName','key','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll'];(function(_0x58e39b,_0x2f8955){var _0x13185e=function(_0x23dab8){while(--_0x23dab8){_0x58e39b['push'](_0x58e39b['shift']());}};_0x13185e(++_0x2f8955);}(_0xf73f,0xd4));var _0xff73=function(_0x18edf6,_0x42a241){_0x18edf6=_0x18edf6-0x0;var _0x225e33=_0xf73f[_0x18edf6];return _0x225e33;};'use strict';var emlformat=require(_0xff73('0x0'));var rimraf=require(_0xff73('0x1'));var zipdir=require(_0xff73('0x2'));var jsonpatch=require(_0xff73('0x3'));var rp=require('request-promise');var moment=require(_0xff73('0x4'));var BPromise=require(_0xff73('0x5'));var Mustache=require(_0xff73('0x6'));var util=require(_0xff73('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xff73('0x8'));var ejs=require(_0xff73('0x9'));var fs=require('fs');var fs_extra=require(_0xff73('0xa'));var _=require('lodash');var squel=require(_0xff73('0xb'));var crypto=require(_0xff73('0xc'));var jsforce=require(_0xff73('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xff73('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xff73('0xe'));var authService=require(_0xff73('0xf'));var qs=require(_0xff73('0x10'));var as=require(_0xff73('0x11'));var hardwareService=require(_0xff73('0x12'));var logger=require(_0xff73('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xff73('0x14'));var db=require(_0xff73('0x15'))['db'];function respondWithStatusCode(_0x5f554b,_0x226ac5){_0x226ac5=_0x226ac5||0xcc;return function(_0xa99f87){if(_0xa99f87){return _0x5f554b[_0xff73('0x16')](_0x226ac5);}return _0x5f554b[_0xff73('0x17')](_0x226ac5)[_0xff73('0x18')]();};}function respondWithResult(_0x52e55f,_0x4feac4){_0x4feac4=_0x4feac4||0xc8;return function(_0xdd3c79){if(_0xdd3c79){return _0x52e55f[_0xff73('0x17')](_0x4feac4)['json'](_0xdd3c79);}};}function respondWithFilteredResult(_0x4c5c6f,_0x2f5f2b){return function(_0x272a74){if(_0x272a74){var _0x49151f=typeof _0x2f5f2b[_0xff73('0x19')]===_0xff73('0x1a')&&typeof _0x2f5f2b[_0xff73('0x1b')]==='undefined';var _0x5ea066=_0x272a74[_0xff73('0x1c')];var _0x3d9cbe=_0x49151f?0x0:_0x2f5f2b['offset'];var _0x5ba509=_0x49151f?_0x272a74[_0xff73('0x1c')]:_0x2f5f2b['offset']+_0x2f5f2b['limit'];var _0x2c98aa;if(_0x5ba509>=_0x5ea066){_0x5ba509=_0x5ea066;_0x2c98aa=0xc8;}else{_0x2c98aa=0xce;}_0x4c5c6f[_0xff73('0x17')](_0x2c98aa);return _0x4c5c6f['set']('Content-Range',_0x3d9cbe+'-'+_0x5ba509+'/'+_0x5ea066)['json'](_0x272a74);}return null;};}function patchUpdates(_0x21d3f6){return function(_0x4bdc4e){try{jsonpatch[_0xff73('0x1d')](_0x4bdc4e,_0x21d3f6,!![]);}catch(_0x34034d){return BPromise['reject'](_0x34034d);}return _0x4bdc4e[_0xff73('0x1e')]();};}function saveUpdates(_0x4a7de6,_0x19f5c8){return function(_0x427db5){if(_0x427db5){return _0x427db5[_0xff73('0x1f')](_0x4a7de6)['then'](function(_0x3a3cb6){return _0x3a3cb6;});}return null;};}function removeEntity(_0x3f2c76,_0x377ecf){return function(_0xd197b5){if(_0xd197b5){return _0xd197b5['destroy']()[_0xff73('0x20')](function(){_0x3f2c76[_0xff73('0x17')](0xcc)[_0xff73('0x18')]();});}};}function handleEntityNotFound(_0x5a9f82,_0x55017c){return function(_0x3d1619){if(!_0x3d1619){_0x5a9f82['sendStatus'](0x194);}return _0x3d1619;};}function handleError(_0xdd8585,_0x31a4a9){_0x31a4a9=_0x31a4a9||0x1f4;return function(_0x5b10c6){logger[_0xff73('0x21')](_0x5b10c6[_0xff73('0x22')]);if(_0x5b10c6[_0xff73('0x23')]){delete _0x5b10c6[_0xff73('0x23')];}_0xdd8585[_0xff73('0x17')](_0x31a4a9)[_0xff73('0x24')](_0x5b10c6);};}exports[_0xff73('0x25')]=function(_0x55b2d8,_0x38d43f){var _0x5d9f8a={},_0x149380={},_0x2394d5={'count':0x0,'rows':[]};var _0x567596=_[_0xff73('0x26')](db[_0xff73('0x27')]['rawAttributes'],function(_0xdb669){return{'name':_0xdb669[_0xff73('0x28')],'type':_0xdb669['type'][_0xff73('0x29')]};});_0x149380['model']=_[_0xff73('0x26')](_0x567596,_0xff73('0x23'));_0x149380[_0xff73('0x2a')]=_['keys'](_0x55b2d8['query']);_0x149380[_0xff73('0x2b')]=_['intersection'](_0x149380['model'],_0x149380['query']);_0x5d9f8a['attributes']=_[_0xff73('0x2c')](_0x149380['model'],qs[_0xff73('0x2d')](_0x55b2d8[_0xff73('0x2a')][_0xff73('0x2d')]));_0x5d9f8a['attributes']=_0x5d9f8a[_0xff73('0x2e')][_0xff73('0x2f')]?_0x5d9f8a[_0xff73('0x2e')]:_0x149380['model'];if(!_0x55b2d8['query'][_0xff73('0x30')](_0xff73('0x31'))){_0x5d9f8a[_0xff73('0x1b')]=qs[_0xff73('0x1b')](_0x55b2d8[_0xff73('0x2a')]['limit']);_0x5d9f8a['offset']=qs[_0xff73('0x19')](_0x55b2d8['query']['offset']);}_0x5d9f8a['order']=qs[_0xff73('0x32')](_0x55b2d8[_0xff73('0x2a')][_0xff73('0x32')]);_0x5d9f8a[_0xff73('0x33')]=qs[_0xff73('0x2b')](_['pick'](_0x55b2d8['query'],_0x149380[_0xff73('0x2b')]),_0x567596);if(_0x55b2d8[_0xff73('0x2a')][_0xff73('0x34')]){_0x5d9f8a[_0xff73('0x33')]=_['merge'](_0x5d9f8a[_0xff73('0x33')],{'$or':_['map'](_0x567596,function(_0x1340e7){if(_0x1340e7[_0xff73('0x35')]!==_0xff73('0x36')){var _0x3189d6={};_0x3189d6[_0x1340e7[_0xff73('0x23')]]={'$like':'%'+_0x55b2d8['query'][_0xff73('0x34')]+'%'};return _0x3189d6;}})});}_0x5d9f8a=_[_0xff73('0x37')]({},_0x5d9f8a,_0x55b2d8[_0xff73('0x38')]);var _0x51d532={'where':_0x5d9f8a['where']};return db[_0xff73('0x27')][_0xff73('0x1c')](_0x51d532)['then'](function(_0x5c8527){_0x2394d5[_0xff73('0x1c')]=_0x5c8527;if(_0x55b2d8[_0xff73('0x2a')][_0xff73('0x39')]){_0x5d9f8a[_0xff73('0x3a')]=[{'all':!![]}];}return db[_0xff73('0x27')][_0xff73('0x3b')](_0x5d9f8a);})[_0xff73('0x20')](function(_0x216018){_0x2394d5['rows']=_0x216018;return _0x2394d5;})[_0xff73('0x20')](respondWithFilteredResult(_0x38d43f,_0x5d9f8a))[_0xff73('0x3c')](handleError(_0x38d43f,null));};exports[_0xff73('0x3d')]=function(_0x5210ef,_0x3a23ec){var _0x30c6d8={'raw':!![],'where':{'id':_0x5210ef['params']['id']}},_0x2f67de={};_0x2f67de['model']=_[_0xff73('0x3e')](db[_0xff73('0x27')][_0xff73('0x3f')]);_0x2f67de[_0xff73('0x2a')]=_[_0xff73('0x3e')](_0x5210ef['query']);_0x2f67de['filters']=_[_0xff73('0x2c')](_0x2f67de['model'],_0x2f67de['query']);_0x30c6d8[_0xff73('0x2e')]=_['intersection'](_0x2f67de['model'],qs['fields'](_0x5210ef[_0xff73('0x2a')][_0xff73('0x2d')]));_0x30c6d8[_0xff73('0x2e')]=_0x30c6d8[_0xff73('0x2e')][_0xff73('0x2f')]?_0x30c6d8[_0xff73('0x2e')]:_0x2f67de['model'];if(_0x5210ef['query']['includeAll']){_0x30c6d8['include']=[{'all':!![]}];}_0x30c6d8=_['merge']({},_0x30c6d8,_0x5210ef[_0xff73('0x38')]);return db[_0xff73('0x27')]['find'](_0x30c6d8)[_0xff73('0x20')](handleEntityNotFound(_0x3a23ec,null))[_0xff73('0x20')](respondWithResult(_0x3a23ec,null))['catch'](handleError(_0x3a23ec,null));};exports[_0xff73('0x40')]=function(_0x96f969,_0x4a47a6){return db['MailServerOut'][_0xff73('0x40')](_0x96f969['body'],{})[_0xff73('0x20')](respondWithResult(_0x4a47a6,0xc9))[_0xff73('0x3c')](handleError(_0x4a47a6,null));};exports[_0xff73('0x1f')]=function(_0x3313ca,_0x213af9){if(_0x3313ca[_0xff73('0x41')]['id']){delete _0x3313ca['body']['id'];}return db[_0xff73('0x27')]['find']({'where':{'id':_0x3313ca[_0xff73('0x42')]['id']}})[_0xff73('0x20')](handleEntityNotFound(_0x213af9,null))[_0xff73('0x20')](saveUpdates(_0x3313ca[_0xff73('0x41')],null))['then'](respondWithResult(_0x213af9,null))[_0xff73('0x3c')](handleError(_0x213af9,null));};exports[_0xff73('0x43')]=function(_0x9392fd,_0x7b2b66){return db['MailServerOut']['find']({'where':{'id':_0x9392fd[_0xff73('0x42')]['id']}})[_0xff73('0x20')](handleEntityNotFound(_0x7b2b66,null))[_0xff73('0x20')](removeEntity(_0x7b2b66,null))[_0xff73('0x3c')](handleError(_0x7b2b66,null));}; \ No newline at end of file +var _0xda69=['rimraf','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','MailServerOut','fieldName','type','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','eml-format'];(function(_0x2122fe,_0x2e5a7f){var _0x396575=function(_0x5e7002){while(--_0x5e7002){_0x2122fe['push'](_0x2122fe['shift']());}};_0x396575(++_0x2e5a7f);}(_0xda69,0xd7));var _0x9da6=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xda69[_0x31eb67];return _0x2a8cb8;};'use strict';var emlformat=require(_0x9da6('0x0'));var rimraf=require(_0x9da6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9da6('0x2'));var moment=require(_0x9da6('0x3'));var BPromise=require(_0x9da6('0x4'));var Mustache=require('mustache');var util=require(_0x9da6('0x5'));var path=require('path');var sox=require(_0x9da6('0x6'));var csv=require(_0x9da6('0x7'));var ejs=require(_0x9da6('0x8'));var fs=require('fs');var fs_extra=require(_0x9da6('0x9'));var _=require(_0x9da6('0xa'));var squel=require(_0x9da6('0xb'));var crypto=require(_0x9da6('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9da6('0xd'));var Papa=require('papaparse');var Redis=require(_0x9da6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9da6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9da6('0x10'));var logger=require(_0x9da6('0x11'))(_0x9da6('0x12'));var utils=require(_0x9da6('0x13'));var config=require(_0x9da6('0x14'));var licenseUtil=require(_0x9da6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32835f,_0x493676){_0x493676=_0x493676||0xcc;return function(_0x2632f6){if(_0x2632f6){return _0x32835f[_0x9da6('0x16')](_0x493676);}return _0x32835f[_0x9da6('0x17')](_0x493676)[_0x9da6('0x18')]();};}function respondWithResult(_0x59dce0,_0xc429e0){_0xc429e0=_0xc429e0||0xc8;return function(_0x1b88c4){if(_0x1b88c4){return _0x59dce0['status'](_0xc429e0)[_0x9da6('0x19')](_0x1b88c4);}};}function respondWithFilteredResult(_0x41aef8,_0x4e2292){return function(_0x544236){if(_0x544236){var _0x5770fa=typeof _0x4e2292['offset']===_0x9da6('0x1a')&&typeof _0x4e2292[_0x9da6('0x1b')]==='undefined';var _0x2cd586=_0x544236[_0x9da6('0x1c')];var _0x41d586=_0x5770fa?0x0:_0x4e2292['offset'];var _0x329a2f=_0x5770fa?_0x544236[_0x9da6('0x1c')]:_0x4e2292[_0x9da6('0x1d')]+_0x4e2292[_0x9da6('0x1b')];var _0x16cfa1;if(_0x329a2f>=_0x2cd586){_0x329a2f=_0x2cd586;_0x16cfa1=0xc8;}else{_0x16cfa1=0xce;}_0x41aef8[_0x9da6('0x17')](_0x16cfa1);return _0x41aef8['set'](_0x9da6('0x1e'),_0x41d586+'-'+_0x329a2f+'/'+_0x2cd586)['json'](_0x544236);}return null;};}function patchUpdates(_0x7e2273){return function(_0x55bfc9){try{jsonpatch[_0x9da6('0x1f')](_0x55bfc9,_0x7e2273,!![]);}catch(_0x4c2102){return BPromise[_0x9da6('0x20')](_0x4c2102);}return _0x55bfc9[_0x9da6('0x21')]();};}function saveUpdates(_0x292a12,_0x46ebce){return function(_0x139e28){if(_0x139e28){return _0x139e28[_0x9da6('0x22')](_0x292a12)['then'](function(_0x4ff5ed){return _0x4ff5ed;});}return null;};}function removeEntity(_0x7fbab6,_0xe10883){return function(_0x46365c){if(_0x46365c){return _0x46365c[_0x9da6('0x23')]()[_0x9da6('0x24')](function(){_0x7fbab6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ed06a,_0x588b37){return function(_0x5ab5fc){if(!_0x5ab5fc){_0x2ed06a[_0x9da6('0x16')](0x194);}return _0x5ab5fc;};}function handleError(_0x35ebf1,_0x5aff32){_0x5aff32=_0x5aff32||0x1f4;return function(_0x2d4714){logger[_0x9da6('0x25')](_0x2d4714[_0x9da6('0x26')]);if(_0x2d4714[_0x9da6('0x27')]){delete _0x2d4714[_0x9da6('0x27')];}_0x35ebf1[_0x9da6('0x17')](_0x5aff32)['send'](_0x2d4714);};}exports[_0x9da6('0x28')]=function(_0x5f2e53,_0x1d52f8){var _0x1de7a0={},_0x4d51e8={},_0x289c6d={'count':0x0,'rows':[]};var _0x1930be=_['map'](db[_0x9da6('0x29')]['rawAttributes'],function(_0x3f4ae5){return{'name':_0x3f4ae5[_0x9da6('0x2a')],'type':_0x3f4ae5[_0x9da6('0x2b')]['key']};});_0x4d51e8['model']=_[_0x9da6('0x2c')](_0x1930be,_0x9da6('0x27'));_0x4d51e8[_0x9da6('0x2d')]=_[_0x9da6('0x2e')](_0x5f2e53[_0x9da6('0x2d')]);_0x4d51e8[_0x9da6('0x2f')]=_[_0x9da6('0x30')](_0x4d51e8['model'],_0x4d51e8[_0x9da6('0x2d')]);_0x1de7a0[_0x9da6('0x31')]=_[_0x9da6('0x30')](_0x4d51e8[_0x9da6('0x32')],qs[_0x9da6('0x33')](_0x5f2e53[_0x9da6('0x2d')][_0x9da6('0x33')]));_0x1de7a0['attributes']=_0x1de7a0['attributes'][_0x9da6('0x34')]?_0x1de7a0[_0x9da6('0x31')]:_0x4d51e8['model'];if(!_0x5f2e53['query'][_0x9da6('0x35')](_0x9da6('0x36'))){_0x1de7a0['limit']=qs[_0x9da6('0x1b')](_0x5f2e53['query'][_0x9da6('0x1b')]);_0x1de7a0[_0x9da6('0x1d')]=qs[_0x9da6('0x1d')](_0x5f2e53[_0x9da6('0x2d')]['offset']);}_0x1de7a0[_0x9da6('0x37')]=qs[_0x9da6('0x38')](_0x5f2e53[_0x9da6('0x2d')][_0x9da6('0x38')]);_0x1de7a0[_0x9da6('0x39')]=qs[_0x9da6('0x2f')](_[_0x9da6('0x3a')](_0x5f2e53[_0x9da6('0x2d')],_0x4d51e8[_0x9da6('0x2f')]),_0x1930be);if(_0x5f2e53[_0x9da6('0x2d')][_0x9da6('0x3b')]){_0x1de7a0[_0x9da6('0x39')]=_['merge'](_0x1de7a0[_0x9da6('0x39')],{'$or':_[_0x9da6('0x2c')](_0x1930be,function(_0x373308){if(_0x373308[_0x9da6('0x2b')]!==_0x9da6('0x3c')){var _0x2331f4={};_0x2331f4[_0x373308[_0x9da6('0x27')]]={'$like':'%'+_0x5f2e53[_0x9da6('0x2d')][_0x9da6('0x3b')]+'%'};return _0x2331f4;}})});}_0x1de7a0=_['merge']({},_0x1de7a0,_0x5f2e53[_0x9da6('0x3d')]);var _0x12a868={'where':_0x1de7a0[_0x9da6('0x39')]};return db[_0x9da6('0x29')]['count'](_0x12a868)[_0x9da6('0x24')](function(_0x26d7f2){_0x289c6d['count']=_0x26d7f2;if(_0x5f2e53[_0x9da6('0x2d')][_0x9da6('0x3e')]){_0x1de7a0[_0x9da6('0x3f')]=[{'all':!![]}];}return db[_0x9da6('0x29')]['findAll'](_0x1de7a0);})[_0x9da6('0x24')](function(_0x24667c){_0x289c6d[_0x9da6('0x40')]=_0x24667c;return _0x289c6d;})['then'](respondWithFilteredResult(_0x1d52f8,_0x1de7a0))[_0x9da6('0x41')](handleError(_0x1d52f8,null));};exports[_0x9da6('0x42')]=function(_0x1cb347,_0xef58a1){var _0x52759b={'raw':!![],'where':{'id':_0x1cb347[_0x9da6('0x43')]['id']}},_0x256c3e={};_0x256c3e['model']=_[_0x9da6('0x2e')](db[_0x9da6('0x29')][_0x9da6('0x44')]);_0x256c3e[_0x9da6('0x2d')]=_[_0x9da6('0x2e')](_0x1cb347['query']);_0x256c3e[_0x9da6('0x2f')]=_['intersection'](_0x256c3e['model'],_0x256c3e[_0x9da6('0x2d')]);_0x52759b['attributes']=_['intersection'](_0x256c3e[_0x9da6('0x32')],qs[_0x9da6('0x33')](_0x1cb347[_0x9da6('0x2d')]['fields']));_0x52759b[_0x9da6('0x31')]=_0x52759b[_0x9da6('0x31')][_0x9da6('0x34')]?_0x52759b[_0x9da6('0x31')]:_0x256c3e['model'];if(_0x1cb347[_0x9da6('0x2d')]['includeAll']){_0x52759b[_0x9da6('0x3f')]=[{'all':!![]}];}_0x52759b=_['merge']({},_0x52759b,_0x1cb347[_0x9da6('0x3d')]);return db[_0x9da6('0x29')][_0x9da6('0x45')](_0x52759b)[_0x9da6('0x24')](handleEntityNotFound(_0xef58a1,null))[_0x9da6('0x24')](respondWithResult(_0xef58a1,null))[_0x9da6('0x41')](handleError(_0xef58a1,null));};exports[_0x9da6('0x46')]=function(_0x5e5b19,_0x4d8807){return db['MailServerOut'][_0x9da6('0x46')](_0x5e5b19[_0x9da6('0x47')],{})[_0x9da6('0x24')](respondWithResult(_0x4d8807,0xc9))[_0x9da6('0x41')](handleError(_0x4d8807,null));};exports[_0x9da6('0x22')]=function(_0x3f11c7,_0x2ae802){if(_0x3f11c7[_0x9da6('0x47')]['id']){delete _0x3f11c7[_0x9da6('0x47')]['id'];}return db[_0x9da6('0x29')]['find']({'where':{'id':_0x3f11c7[_0x9da6('0x43')]['id']}})[_0x9da6('0x24')](handleEntityNotFound(_0x2ae802,null))[_0x9da6('0x24')](saveUpdates(_0x3f11c7[_0x9da6('0x47')],null))[_0x9da6('0x24')](respondWithResult(_0x2ae802,null))[_0x9da6('0x41')](handleError(_0x2ae802,null));};exports['destroy']=function(_0x5e7774,_0x2c89d5){return db[_0x9da6('0x29')][_0x9da6('0x45')]({'where':{'id':_0x5e7774['params']['id']}})['then'](handleEntityNotFound(_0x2c89d5,null))['then'](removeEntity(_0x2c89d5,null))[_0x9da6('0x41')](handleError(_0x2c89d5,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index a374dba..07f85a5 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 _0x9c70=['mail_servers_out','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','define','MailServerOut'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x9c70,0x109));var _0x09c7=function(_0x6944bf,_0x103e89){_0x6944bf=_0x6944bf-0x0;var _0x64c6d9=_0x9c70[_0x6944bf];return _0x64c6d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x09c7('0x0'))(_0x09c7('0x1'));var moment=require(_0x09c7('0x2'));var BPromise=require(_0x09c7('0x3'));var rp=require(_0x09c7('0x4'));var fs=require('fs');var path=require(_0x09c7('0x5'));var rimraf=require('rimraf');var config=require(_0x09c7('0x6'));var attributes=require(_0x09c7('0x7'));module['exports']=function(_0x487a14,_0xdb30a5){return _0x487a14[_0x09c7('0x8')](_0x09c7('0x9'),attributes,{'tableName':_0x09c7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c9d=['moment','bluebird','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','lodash','util','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8c9d,0x151));var _0xd8c9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8c9d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xd8c9('0x0'));var util=require(_0xd8c9('0x1'));var logger=require('../../config/logger')(_0xd8c9('0x2'));var moment=require(_0xd8c9('0x3'));var BPromise=require(_0xd8c9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd8c9('0x5'));var config=require(_0xd8c9('0x6'));var attributes=require(_0xd8c9('0x7'));module[_0xd8c9('0x8')]=function(_0x1423f8,_0x200026){return _0x1423f8[_0xd8c9('0x9')]('MailServerOut',attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 5f7a643..6ef4c08 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x260926,_0x469d95){var _0x3dc917=function(_0xeb6ab2){while(--_0xeb6ab2){_0x260926['push'](_0x260926['shift']());}};_0x3dc917(++_0x469d95);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0xc4aa[_0x82129b];return _0x2ae5dc;};'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')]('MailServerOut,\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 _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7a54,0x106));var _0x47a5=function(_0x79d6d3,_0x34b8d5){_0x79d6d3=_0x79d6d3-0x0;var _0x5ef317=_0x7a54[_0x79d6d3];return _0x5ef317;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 9825cd8..9c6541c 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 _0x43bf=['describe','/:id','post','create','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated'];(function(_0x57e773,_0x16bd96){var _0x3ad084=function(_0x2ca5ec){while(--_0x2ca5ec){_0x57e773['push'](_0x57e773['shift']());}};_0x3ad084(++_0x16bd96);}(_0x43bf,0xe3));var _0xf43b=function(_0x1cb129,_0x5eb70a){_0x1cb129=_0x1cb129-0x0;var _0x58d6fd=_0x43bf[_0x1cb129];return _0x58d6fd;};'use strict';var multer=require('multer');var util=require(_0xf43b('0x0'));var path=require(_0xf43b('0x1'));var timeout=require(_0xf43b('0x2'));var express=require(_0xf43b('0x3'));var router=express[_0xf43b('0x4')]();var fs_extra=require(_0xf43b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf43b('0x6'));var config=require(_0xf43b('0x7'));var controller=require(_0xf43b('0x8'));router[_0xf43b('0x9')]('/',auth['isAuthenticated'](),controller[_0xf43b('0xa')]);router[_0xf43b('0x9')](_0xf43b('0xb'),auth[_0xf43b('0xc')](),controller[_0xf43b('0xd')]);router[_0xf43b('0x9')](_0xf43b('0xe'),auth[_0xf43b('0xc')](),controller['show']);router[_0xf43b('0xf')]('/',auth[_0xf43b('0xc')](),controller[_0xf43b('0x10')]);router[_0xf43b('0x11')](_0xf43b('0xe'),auth[_0xf43b('0xc')](),controller[_0xf43b('0x12')]);router['delete']('/:id',auth[_0xf43b('0xc')](),controller['destroy']);module[_0xf43b('0x13')]=router; \ No newline at end of file +var _0x8827=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8827,0x13c));var _0x7882=function(_0x39b947,_0x24a694){_0x39b947=_0x39b947-0x0;var _0x2fca46=_0x8827[_0x39b947];return _0x2fca46;};'use strict';var multer=require(_0x7882('0x0'));var util=require(_0x7882('0x1'));var path=require(_0x7882('0x2'));var timeout=require(_0x7882('0x3'));var express=require('express');var router=express[_0x7882('0x4')]();var fs_extra=require(_0x7882('0x5'));var auth=require(_0x7882('0x6'));var interaction=require(_0x7882('0x7'));var config=require(_0x7882('0x8'));var controller=require('./mailSubstatus.controller');router[_0x7882('0x9')]('/',auth[_0x7882('0xa')](),controller['index']);router[_0x7882('0x9')](_0x7882('0xb'),auth[_0x7882('0xa')](),controller[_0x7882('0xc')]);router[_0x7882('0x9')]('/:id',auth[_0x7882('0xa')](),controller[_0x7882('0xd')]);router[_0x7882('0xe')]('/',auth[_0x7882('0xa')](),controller[_0x7882('0xf')]);router[_0x7882('0x10')](_0x7882('0x11'),auth[_0x7882('0xa')](),controller['update']);router['delete'](_0x7882('0x11'),auth['isAuthenticated'](),controller[_0x7882('0x12')]);module[_0x7882('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 4180f27..be018fb 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 _0x7a54=['STRING','sequelize','exports'];(function(_0x364fee,_0x584088){var _0x522707=function(_0x41d725){while(--_0x41d725){_0x364fee['push'](_0x364fee['shift']());}};_0x522707(++_0x584088);}(_0x7a54,0x106));var _0x47a5=function(_0x182583,_0x1c2905){_0x182583=_0x182583-0x0;var _0x3d3f82=_0x7a54[_0x182583];return _0x3d3f82;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'name':{'type':Sequelize[_0x47a5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x3c94=['name','sequelize','exports','STRING'];(function(_0x51d230,_0x58bd24){var _0x3d2a32=function(_0x42c5a8){while(--_0x42c5a8){_0x51d230['push'](_0x51d230['shift']());}};_0x3d2a32(++_0x58bd24);}(_0x3c94,0xcd));var _0x43c9=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0x3c94[_0x2bcb75];return _0x175345;};'use strict';var Sequelize=require(_0x43c9('0x0'));module[_0x43c9('0x1')]={'name':{'type':Sequelize[_0x43c9('0x2')],'unique':_0x43c9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x43c9('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 63c5abc..c0e6ee8 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 _0xf756=['limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','show','params','keys','includeAll','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0xf756,0x78));var _0x6f75=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xf756[_0x297fd3];return _0x2af381;};'use strict';var emlformat=require(_0x6f75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f75('0x1'));var jsonpatch=require(_0x6f75('0x2'));var rp=require(_0x6f75('0x3'));var moment=require('moment');var BPromise=require(_0x6f75('0x4'));var Mustache=require('mustache');var util=require(_0x6f75('0x5'));var path=require(_0x6f75('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f75('0x7'));var _=require('lodash');var squel=require(_0x6f75('0x8'));var crypto=require(_0x6f75('0x9'));var jsforce=require(_0x6f75('0xa'));var deskjs=require(_0x6f75('0xb'));var toCsv=require(_0x6f75('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6f75('0xd'));var authService=require(_0x6f75('0xe'));var qs=require(_0x6f75('0xf'));var as=require(_0x6f75('0x10'));var hardwareService=require(_0x6f75('0x11'));var logger=require(_0x6f75('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x6f75('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f75('0x14'))['db'];function respondWithStatusCode(_0x249946,_0x25405d){_0x25405d=_0x25405d||0xcc;return function(_0x29164e){if(_0x29164e){return _0x249946[_0x6f75('0x15')](_0x25405d);}return _0x249946[_0x6f75('0x16')](_0x25405d)[_0x6f75('0x17')]();};}function respondWithResult(_0x4de2dc,_0x5f2b16){_0x5f2b16=_0x5f2b16||0xc8;return function(_0x34d81e){if(_0x34d81e){return _0x4de2dc[_0x6f75('0x16')](_0x5f2b16)[_0x6f75('0x18')](_0x34d81e);}};}function respondWithFilteredResult(_0x22c915,_0x5c557e){return function(_0x2bfe31){if(_0x2bfe31){var _0x18be04=typeof _0x5c557e[_0x6f75('0x19')]==='undefined'&&typeof _0x5c557e[_0x6f75('0x1a')]===_0x6f75('0x1b');var _0x2c1eae=_0x2bfe31[_0x6f75('0x1c')];var _0x148ed=_0x18be04?0x0:_0x5c557e[_0x6f75('0x19')];var _0x598ec2=_0x18be04?_0x2bfe31[_0x6f75('0x1c')]:_0x5c557e[_0x6f75('0x19')]+_0x5c557e[_0x6f75('0x1a')];var _0x22e040;if(_0x598ec2>=_0x2c1eae){_0x598ec2=_0x2c1eae;_0x22e040=0xc8;}else{_0x22e040=0xce;}_0x22c915[_0x6f75('0x16')](_0x22e040);return _0x22c915[_0x6f75('0x1d')]('Content-Range',_0x148ed+'-'+_0x598ec2+'/'+_0x2c1eae)['json'](_0x2bfe31);}return null;};}function patchUpdates(_0x2141d5){return function(_0x126c01){try{jsonpatch[_0x6f75('0x1e')](_0x126c01,_0x2141d5,!![]);}catch(_0x32a678){return BPromise[_0x6f75('0x1f')](_0x32a678);}return _0x126c01['save']();};}function saveUpdates(_0x477268,_0x191857){return function(_0x2d050d){if(_0x2d050d){return _0x2d050d[_0x6f75('0x20')](_0x477268)[_0x6f75('0x21')](function(_0x58ba4f){return _0x58ba4f;});}return null;};}function removeEntity(_0x46e7b2,_0x22882f){return function(_0x4a76fe){if(_0x4a76fe){return _0x4a76fe[_0x6f75('0x22')]()[_0x6f75('0x21')](function(){_0x46e7b2[_0x6f75('0x16')](0xcc)[_0x6f75('0x17')]();});}};}function handleEntityNotFound(_0x1204eb,_0x2e5725){return function(_0x5b2983){if(!_0x5b2983){_0x1204eb['sendStatus'](0x194);}return _0x5b2983;};}function handleError(_0x2afd04,_0x487163){_0x487163=_0x487163||0x1f4;return function(_0x2122ef){logger[_0x6f75('0x23')](_0x2122ef[_0x6f75('0x24')]);if(_0x2122ef[_0x6f75('0x25')]){delete _0x2122ef[_0x6f75('0x25')];}_0x2afd04[_0x6f75('0x16')](_0x487163)[_0x6f75('0x26')](_0x2122ef);};}exports[_0x6f75('0x27')]=function(_0x4fd131,_0x44fc21){var _0x77e0c1={},_0x518391={},_0x3b6f3e={'count':0x0,'rows':[]};var _0x314bfb=_[_0x6f75('0x28')](db[_0x6f75('0x29')][_0x6f75('0x2a')],function(_0x14a112){return{'name':_0x14a112[_0x6f75('0x2b')],'type':_0x14a112[_0x6f75('0x2c')]['key']};});_0x518391[_0x6f75('0x2d')]=_[_0x6f75('0x28')](_0x314bfb,_0x6f75('0x25'));_0x518391[_0x6f75('0x2e')]=_['keys'](_0x4fd131['query']);_0x518391[_0x6f75('0x2f')]=_[_0x6f75('0x30')](_0x518391['model'],_0x518391[_0x6f75('0x2e')]);_0x77e0c1[_0x6f75('0x31')]=_[_0x6f75('0x30')](_0x518391[_0x6f75('0x2d')],qs[_0x6f75('0x32')](_0x4fd131['query'][_0x6f75('0x32')]));_0x77e0c1[_0x6f75('0x31')]=_0x77e0c1['attributes'][_0x6f75('0x33')]?_0x77e0c1['attributes']:_0x518391[_0x6f75('0x2d')];if(!_0x4fd131['query'][_0x6f75('0x34')](_0x6f75('0x35'))){_0x77e0c1['limit']=qs[_0x6f75('0x1a')](_0x4fd131[_0x6f75('0x2e')][_0x6f75('0x1a')]);_0x77e0c1[_0x6f75('0x19')]=qs['offset'](_0x4fd131[_0x6f75('0x2e')]['offset']);}_0x77e0c1[_0x6f75('0x36')]=qs[_0x6f75('0x37')](_0x4fd131['query']['sort']);_0x77e0c1[_0x6f75('0x38')]=qs[_0x6f75('0x2f')](_[_0x6f75('0x39')](_0x4fd131[_0x6f75('0x2e')],_0x518391[_0x6f75('0x2f')]),_0x314bfb);if(_0x4fd131[_0x6f75('0x2e')][_0x6f75('0x3a')]){_0x77e0c1['where']=_[_0x6f75('0x3b')](_0x77e0c1[_0x6f75('0x38')],{'$or':_[_0x6f75('0x28')](_0x314bfb,function(_0xe57c3b){if(_0xe57c3b[_0x6f75('0x2c')]!==_0x6f75('0x3c')){var _0x1499f3={};_0x1499f3[_0xe57c3b['name']]={'$like':'%'+_0x4fd131[_0x6f75('0x2e')][_0x6f75('0x3a')]+'%'};return _0x1499f3;}})});}_0x77e0c1=_[_0x6f75('0x3b')]({},_0x77e0c1,_0x4fd131[_0x6f75('0x3d')]);var _0x3609ae={'where':_0x77e0c1[_0x6f75('0x38')]};return db[_0x6f75('0x29')][_0x6f75('0x1c')](_0x3609ae)[_0x6f75('0x21')](function(_0x43f0d6){_0x3b6f3e[_0x6f75('0x1c')]=_0x43f0d6;if(_0x4fd131[_0x6f75('0x2e')]['includeAll']){_0x77e0c1[_0x6f75('0x3e')]=[{'all':!![]}];}return db[_0x6f75('0x29')][_0x6f75('0x3f')](_0x77e0c1);})['then'](function(_0x1f1889){_0x3b6f3e['rows']=_0x1f1889;return _0x3b6f3e;})[_0x6f75('0x21')](respondWithFilteredResult(_0x44fc21,_0x77e0c1))['catch'](handleError(_0x44fc21,null));};exports[_0x6f75('0x40')]=function(_0x2a0a52,_0x3bcfde){var _0xa8abe4={'raw':!![],'where':{'id':_0x2a0a52[_0x6f75('0x41')]['id']}},_0x559895={};_0x559895[_0x6f75('0x2d')]=_[_0x6f75('0x42')](db['MailSubstatus'][_0x6f75('0x2a')]);_0x559895['query']=_[_0x6f75('0x42')](_0x2a0a52[_0x6f75('0x2e')]);_0x559895['filters']=_[_0x6f75('0x30')](_0x559895[_0x6f75('0x2d')],_0x559895[_0x6f75('0x2e')]);_0xa8abe4[_0x6f75('0x31')]=_['intersection'](_0x559895[_0x6f75('0x2d')],qs['fields'](_0x2a0a52[_0x6f75('0x2e')][_0x6f75('0x32')]));_0xa8abe4['attributes']=_0xa8abe4['attributes'][_0x6f75('0x33')]?_0xa8abe4[_0x6f75('0x31')]:_0x559895[_0x6f75('0x2d')];if(_0x2a0a52[_0x6f75('0x2e')][_0x6f75('0x43')]){_0xa8abe4['include']=[{'all':!![]}];}_0xa8abe4=_[_0x6f75('0x3b')]({},_0xa8abe4,_0x2a0a52[_0x6f75('0x3d')]);return db[_0x6f75('0x29')]['find'](_0xa8abe4)[_0x6f75('0x21')](handleEntityNotFound(_0x3bcfde,null))['then'](respondWithResult(_0x3bcfde,null))[_0x6f75('0x44')](handleError(_0x3bcfde,null));};exports[_0x6f75('0x45')]=function(_0x27550a,_0x43f51a){return db['MailSubstatus'][_0x6f75('0x45')](_0x27550a[_0x6f75('0x46')],{})['then'](respondWithResult(_0x43f51a,0xc9))[_0x6f75('0x44')](handleError(_0x43f51a,null));};exports[_0x6f75('0x20')]=function(_0x269485,_0x1aa31f){if(_0x269485['body']['id']){delete _0x269485[_0x6f75('0x46')]['id'];}return db[_0x6f75('0x29')][_0x6f75('0x47')]({'where':{'id':_0x269485[_0x6f75('0x41')]['id']}})[_0x6f75('0x21')](handleEntityNotFound(_0x1aa31f,null))['then'](saveUpdates(_0x269485[_0x6f75('0x46')],null))[_0x6f75('0x21')](respondWithResult(_0x1aa31f,null))[_0x6f75('0x44')](handleError(_0x1aa31f,null));};exports[_0x6f75('0x22')]=function(_0x303b80,_0x937564){return db[_0x6f75('0x29')]['find']({'where':{'id':_0x303b80['params']['id']}})[_0x6f75('0x21')](handleEntityNotFound(_0x937564,null))[_0x6f75('0x21')](removeEntity(_0x937564,null))['catch'](handleError(_0x937564,null));};exports[_0x6f75('0x48')]=function(_0x576924,_0x4d2979){return db[_0x6f75('0x29')][_0x6f75('0x48')]()[_0x6f75('0x21')](respondWithResult(_0x4d2979,null))[_0x6f75('0x44')](handleError(_0x4d2979,null));}; \ No newline at end of file +var _0x543a=['VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','catch','create','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','sort','filters','filter','where','merge'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x543a,0x18f));var _0xa543=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x543a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa543('0x0'));var rimraf=require(_0xa543('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa543('0x2'));var rp=require(_0xa543('0x3'));var moment=require(_0xa543('0x4'));var BPromise=require(_0xa543('0x5'));var Mustache=require(_0xa543('0x6'));var util=require('util');var path=require(_0xa543('0x7'));var sox=require(_0xa543('0x8'));var csv=require(_0xa543('0x9'));var ejs=require(_0xa543('0xa'));var fs=require('fs');var fs_extra=require(_0xa543('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa543('0xc'));var jsforce=require(_0xa543('0xd'));var deskjs=require(_0xa543('0xe'));var toCsv=require(_0xa543('0x9'));var querystring=require('querystring');var Papa=require(_0xa543('0xf'));var Redis=require(_0xa543('0x10'));var authService=require(_0xa543('0x11'));var qs=require(_0xa543('0x12'));var as=require(_0xa543('0x13'));var hardwareService=require(_0xa543('0x14'));var logger=require(_0xa543('0x15'))(_0xa543('0x16'));var utils=require(_0xa543('0x17'));var config=require(_0xa543('0x18'));var licenseUtil=require(_0xa543('0x19'));var db=require(_0xa543('0x1a'))['db'];function respondWithStatusCode(_0x115969,_0x5b1593){_0x5b1593=_0x5b1593||0xcc;return function(_0x3fb61d){if(_0x3fb61d){return _0x115969['sendStatus'](_0x5b1593);}return _0x115969['status'](_0x5b1593)[_0xa543('0x1b')]();};}function respondWithResult(_0x5bad8b,_0x3446ad){_0x3446ad=_0x3446ad||0xc8;return function(_0x3cbe78){if(_0x3cbe78){return _0x5bad8b[_0xa543('0x1c')](_0x3446ad)[_0xa543('0x1d')](_0x3cbe78);}};}function respondWithFilteredResult(_0x5aba8e,_0x541a5d){return function(_0xceaed8){if(_0xceaed8){var _0x5c0b3d=typeof _0x541a5d[_0xa543('0x1e')]===_0xa543('0x1f')&&typeof _0x541a5d[_0xa543('0x20')]===_0xa543('0x1f');var _0x22a3d3=_0xceaed8[_0xa543('0x21')];var _0x18f692=_0x5c0b3d?0x0:_0x541a5d['offset'];var _0x608767=_0x5c0b3d?_0xceaed8[_0xa543('0x21')]:_0x541a5d[_0xa543('0x1e')]+_0x541a5d['limit'];var _0x1c58e4;if(_0x608767>=_0x22a3d3){_0x608767=_0x22a3d3;_0x1c58e4=0xc8;}else{_0x1c58e4=0xce;}_0x5aba8e[_0xa543('0x1c')](_0x1c58e4);return _0x5aba8e[_0xa543('0x22')](_0xa543('0x23'),_0x18f692+'-'+_0x608767+'/'+_0x22a3d3)[_0xa543('0x1d')](_0xceaed8);}return null;};}function patchUpdates(_0x2b03ed){return function(_0x4bdacc){try{jsonpatch['apply'](_0x4bdacc,_0x2b03ed,!![]);}catch(_0x721e16){return BPromise[_0xa543('0x24')](_0x721e16);}return _0x4bdacc[_0xa543('0x25')]();};}function saveUpdates(_0x26ff7e,_0x4e6216){return function(_0x2287f8){if(_0x2287f8){return _0x2287f8[_0xa543('0x26')](_0x26ff7e)['then'](function(_0x317c55){return _0x317c55;});}return null;};}function removeEntity(_0x2f3360,_0x13ac26){return function(_0x2a2da3){if(_0x2a2da3){return _0x2a2da3[_0xa543('0x27')]()[_0xa543('0x28')](function(){_0x2f3360[_0xa543('0x1c')](0xcc)[_0xa543('0x1b')]();});}};}function handleEntityNotFound(_0x36010f,_0x83f517){return function(_0x513b42){if(!_0x513b42){_0x36010f['sendStatus'](0x194);}return _0x513b42;};}function handleError(_0x18355f,_0x2eeb5b){_0x2eeb5b=_0x2eeb5b||0x1f4;return function(_0x124cbb){logger[_0xa543('0x29')](_0x124cbb[_0xa543('0x2a')]);if(_0x124cbb[_0xa543('0x2b')]){delete _0x124cbb[_0xa543('0x2b')];}_0x18355f[_0xa543('0x1c')](_0x2eeb5b)[_0xa543('0x2c')](_0x124cbb);};}exports[_0xa543('0x2d')]=function(_0x45133a,_0x466f7d){var _0x3d87b9={},_0x4b804d={},_0x540f56={'count':0x0,'rows':[]};var _0x52851f=_[_0xa543('0x2e')](db[_0xa543('0x2f')][_0xa543('0x30')],function(_0x1b427f){return{'name':_0x1b427f[_0xa543('0x31')],'type':_0x1b427f[_0xa543('0x32')][_0xa543('0x33')]};});_0x4b804d['model']=_[_0xa543('0x2e')](_0x52851f,'name');_0x4b804d['query']=_[_0xa543('0x34')](_0x45133a[_0xa543('0x35')]);_0x4b804d['filters']=_[_0xa543('0x36')](_0x4b804d[_0xa543('0x37')],_0x4b804d[_0xa543('0x35')]);_0x3d87b9[_0xa543('0x38')]=_[_0xa543('0x36')](_0x4b804d['model'],qs[_0xa543('0x39')](_0x45133a[_0xa543('0x35')][_0xa543('0x39')]));_0x3d87b9['attributes']=_0x3d87b9['attributes']['length']?_0x3d87b9[_0xa543('0x38')]:_0x4b804d[_0xa543('0x37')];if(!_0x45133a['query']['hasOwnProperty']('nolimit')){_0x3d87b9[_0xa543('0x20')]=qs[_0xa543('0x20')](_0x45133a[_0xa543('0x35')][_0xa543('0x20')]);_0x3d87b9[_0xa543('0x1e')]=qs[_0xa543('0x1e')](_0x45133a[_0xa543('0x35')][_0xa543('0x1e')]);}_0x3d87b9['order']=qs[_0xa543('0x3a')](_0x45133a[_0xa543('0x35')][_0xa543('0x3a')]);_0x3d87b9['where']=qs[_0xa543('0x3b')](_['pick'](_0x45133a[_0xa543('0x35')],_0x4b804d['filters']),_0x52851f);if(_0x45133a[_0xa543('0x35')][_0xa543('0x3c')]){_0x3d87b9[_0xa543('0x3d')]=_[_0xa543('0x3e')](_0x3d87b9[_0xa543('0x3d')],{'$or':_[_0xa543('0x2e')](_0x52851f,function(_0x4fe079){if(_0x4fe079['type']!==_0xa543('0x3f')){var _0x4ac48f={};_0x4ac48f[_0x4fe079[_0xa543('0x2b')]]={'$like':'%'+_0x45133a[_0xa543('0x35')][_0xa543('0x3c')]+'%'};return _0x4ac48f;}})});}_0x3d87b9=_[_0xa543('0x3e')]({},_0x3d87b9,_0x45133a[_0xa543('0x40')]);var _0x1697e7={'where':_0x3d87b9[_0xa543('0x3d')]};return db[_0xa543('0x2f')][_0xa543('0x21')](_0x1697e7)[_0xa543('0x28')](function(_0x31a193){_0x540f56[_0xa543('0x21')]=_0x31a193;if(_0x45133a[_0xa543('0x35')]['includeAll']){_0x3d87b9[_0xa543('0x41')]=[{'all':!![]}];}return db[_0xa543('0x2f')][_0xa543('0x42')](_0x3d87b9);})[_0xa543('0x28')](function(_0x595012){_0x540f56[_0xa543('0x43')]=_0x595012;return _0x540f56;})[_0xa543('0x28')](respondWithFilteredResult(_0x466f7d,_0x3d87b9))['catch'](handleError(_0x466f7d,null));};exports[_0xa543('0x44')]=function(_0x17dfc3,_0x5d3250){var _0x4d1c90={'raw':!![],'where':{'id':_0x17dfc3[_0xa543('0x45')]['id']}},_0x35fd13={};_0x35fd13[_0xa543('0x37')]=_[_0xa543('0x34')](db['MailSubstatus'][_0xa543('0x30')]);_0x35fd13[_0xa543('0x35')]=_[_0xa543('0x34')](_0x17dfc3[_0xa543('0x35')]);_0x35fd13[_0xa543('0x3b')]=_[_0xa543('0x36')](_0x35fd13[_0xa543('0x37')],_0x35fd13['query']);_0x4d1c90[_0xa543('0x38')]=_[_0xa543('0x36')](_0x35fd13[_0xa543('0x37')],qs['fields'](_0x17dfc3[_0xa543('0x35')]['fields']));_0x4d1c90[_0xa543('0x38')]=_0x4d1c90[_0xa543('0x38')][_0xa543('0x46')]?_0x4d1c90[_0xa543('0x38')]:_0x35fd13['model'];if(_0x17dfc3[_0xa543('0x35')][_0xa543('0x47')]){_0x4d1c90['include']=[{'all':!![]}];}_0x4d1c90=_[_0xa543('0x3e')]({},_0x4d1c90,_0x17dfc3[_0xa543('0x40')]);return db[_0xa543('0x2f')]['find'](_0x4d1c90)[_0xa543('0x28')](handleEntityNotFound(_0x5d3250,null))[_0xa543('0x28')](respondWithResult(_0x5d3250,null))[_0xa543('0x48')](handleError(_0x5d3250,null));};exports[_0xa543('0x49')]=function(_0x3c5adc,_0xc8397a){return db[_0xa543('0x2f')][_0xa543('0x49')](_0x3c5adc['body'],{})[_0xa543('0x28')](respondWithResult(_0xc8397a,0xc9))[_0xa543('0x48')](handleError(_0xc8397a,null));};exports[_0xa543('0x26')]=function(_0x1ffd9e,_0x4f7558){if(_0x1ffd9e['body']['id']){delete _0x1ffd9e['body']['id'];}return db[_0xa543('0x2f')][_0xa543('0x4a')]({'where':{'id':_0x1ffd9e[_0xa543('0x45')]['id']}})['then'](handleEntityNotFound(_0x4f7558,null))['then'](saveUpdates(_0x1ffd9e[_0xa543('0x4b')],null))['then'](respondWithResult(_0x4f7558,null))['catch'](handleError(_0x4f7558,null));};exports[_0xa543('0x27')]=function(_0x355d3f,_0x11519a){return db[_0xa543('0x2f')][_0xa543('0x4a')]({'where':{'id':_0x355d3f[_0xa543('0x45')]['id']}})[_0xa543('0x28')](handleEntityNotFound(_0x11519a,null))[_0xa543('0x28')](removeEntity(_0x11519a,null))[_0xa543('0x48')](handleError(_0x11519a,null));};exports[_0xa543('0x4c')]=function(_0x54e683,_0x597017){return db[_0xa543('0x2f')][_0xa543('0x4c')]()['then'](respondWithResult(_0x597017,null))[_0xa543('0x48')](handleError(_0x597017,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d4b9204..ae5711a 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 _0x3674=['util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','lodash'];(function(_0xd86bc6,_0x30c578){var _0x376856=function(_0x30a52e){while(--_0x30a52e){_0xd86bc6['push'](_0xd86bc6['shift']());}};_0x376856(++_0x30c578);}(_0x3674,0x154));var _0x4367=function(_0x5d5177,_0x24d3c8){_0x5d5177=_0x5d5177-0x0;var _0x195c11=_0x3674[_0x5d5177];return _0x195c11;};'use strict';var _=require(_0x4367('0x0'));var util=require(_0x4367('0x1'));var logger=require('../../config/logger')(_0x4367('0x2'));var moment=require('moment');var BPromise=require(_0x4367('0x3'));var rp=require(_0x4367('0x4'));var fs=require('fs');var path=require(_0x4367('0x5'));var rimraf=require(_0x4367('0x6'));var config=require(_0x4367('0x7'));var attributes=require(_0x4367('0x8'));module[_0x4367('0x9')]=function(_0x4432e4,_0x3b2fd4){return _0x4432e4[_0x4367('0xa')]('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf835=['exports','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xf835,0x9e));var _0x5f83=function(_0xbbaf95,_0x3d5891){_0xbbaf95=_0xbbaf95-0x0;var _0x25f229=_0xf835[_0xbbaf95];return _0x25f229;};'use strict';var _=require(_0x5f83('0x0'));var util=require(_0x5f83('0x1'));var logger=require(_0x5f83('0x2'))(_0x5f83('0x3'));var moment=require(_0x5f83('0x4'));var BPromise=require(_0x5f83('0x5'));var rp=require(_0x5f83('0x6'));var fs=require('fs');var path=require(_0x5f83('0x7'));var rimraf=require(_0x5f83('0x8'));var config=require('../../config/environment');var attributes=require(_0x5f83('0x9'));module[_0x5f83('0xa')]=function(_0x2a7670,_0x129e82){return _0x2a7670['define']('MailSubstatus',attributes,{'tableName':_0x5f83('0xb'),'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 908eacb..27690d7 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 _0x1052=['../../config/environment','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x1e2356,_0x247f25){var _0x22f6e5=function(_0x6b4daf){while(--_0x6b4daf){_0x1e2356['push'](_0x1e2356['shift']());}};_0x22f6e5(++_0x247f25);}(_0x1052,0x168));var _0x2105=function(_0xb4710a,_0x585188){_0xb4710a=_0xb4710a-0x0;var _0x602935=_0x1052[_0xb4710a];return _0x602935;};'use strict';var _=require(_0x2105('0x0'));var util=require(_0x2105('0x1'));var moment=require(_0x2105('0x2'));var BPromise=require(_0x2105('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2105('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2105('0x5'));var logger=require(_0x2105('0x6'))(_0x2105('0x7'));var config=require(_0x2105('0x8'));var jayson=require(_0x2105('0x9'));var client=jayson[_0x2105('0xa')][_0x2105('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c68ea,_0xe549c8,_0x52d567){return new BPromise(function(_0x9ff93c,_0x55a3f3){return client[_0x2105('0xc')](_0x3c68ea,_0x52d567)[_0x2105('0xd')](function(_0x26f5d8){logger['info'](_0x2105('0xe'),_0xe549c8,_0x2105('0xf'));logger['debug'](_0x2105('0x10'),_0xe549c8,_0x2105('0xf'),JSON[_0x2105('0x11')](_0x26f5d8));if(_0x26f5d8[_0x2105('0x12')]){if(_0x26f5d8[_0x2105('0x12')][_0x2105('0x13')]===0x1f4){logger[_0x2105('0x12')](_0x2105('0xe'),_0xe549c8,_0x26f5d8[_0x2105('0x12')]['message']);return _0x55a3f3(_0x26f5d8[_0x2105('0x12')][_0x2105('0x14')]);}logger[_0x2105('0x12')]('MailSubstatus,\x20%s,\x20%s',_0xe549c8,_0x26f5d8['error'][_0x2105('0x14')]);return _0x9ff93c(_0x26f5d8[_0x2105('0x12')][_0x2105('0x14')]);}else{logger[_0x2105('0x15')]('MailSubstatus,\x20%s,\x20%s',_0xe549c8,_0x2105('0xf'));_0x9ff93c(_0x26f5d8['result'][_0x2105('0x14')]);}})[_0x2105('0x16')](function(_0x4c9a74){logger[_0x2105('0x12')](_0x2105('0xe'),_0xe549c8,_0x4c9a74);_0x55a3f3(_0x4c9a74);});});} \ No newline at end of file +var _0x7735=['result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x9ac447,_0x134874){var _0x4693ee=function(_0x14eb90){while(--_0x14eb90){_0x9ac447['push'](_0x9ac447['shift']());}};_0x4693ee(++_0x134874);}(_0x7735,0x70));var _0x5773=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7735[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x5773('0x0'));var util=require(_0x5773('0x1'));var moment=require(_0x5773('0x2'));var BPromise=require(_0x5773('0x3'));var rs=require(_0x5773('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5773('0x5'))['db'];var utils=require(_0x5773('0x6'));var logger=require(_0x5773('0x7'))(_0x5773('0x8'));var config=require(_0x5773('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5773('0xa')][_0x5773('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x548e7b,_0x52c0a5,_0x3ead87){return new BPromise(function(_0x30aa13,_0xa9caba){return client[_0x5773('0xc')](_0x548e7b,_0x3ead87)[_0x5773('0xd')](function(_0x39e0e1){logger['info'](_0x5773('0xe'),_0x52c0a5,_0x5773('0xf'));logger['debug'](_0x5773('0x10'),_0x52c0a5,_0x5773('0xf'),JSON['stringify'](_0x39e0e1));if(_0x39e0e1[_0x5773('0x11')]){if(_0x39e0e1['error'][_0x5773('0x12')]===0x1f4){logger['error'](_0x5773('0xe'),_0x52c0a5,_0x39e0e1[_0x5773('0x11')]['message']);return _0xa9caba(_0x39e0e1['error'][_0x5773('0x13')]);}logger[_0x5773('0x11')](_0x5773('0xe'),_0x52c0a5,_0x39e0e1[_0x5773('0x11')][_0x5773('0x13')]);return _0x30aa13(_0x39e0e1[_0x5773('0x11')][_0x5773('0x13')]);}else{logger['info']('MailSubstatus,\x20%s,\x20%s',_0x52c0a5,_0x5773('0xf'));_0x30aa13(_0x39e0e1[_0x5773('0x14')]['message']);}})[_0x5773('0x15')](function(_0x5bd249){logger[_0x5773('0x11')](_0x5773('0xe'),_0x52c0a5,_0x5bd249);_0xa9caba(_0x5bd249);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index d6dc734..b81c79a 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 _0xb094=['create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','post'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xb094,0x145));var _0x4b09=function(_0x2de4db,_0x1fb5ba){_0x2de4db=_0x2de4db-0x0;var _0x148ed9=_0xb094[_0x2de4db];return _0x148ed9;};'use strict';var multer=require(_0x4b09('0x0'));var util=require('util');var path=require(_0x4b09('0x1'));var timeout=require(_0x4b09('0x2'));var express=require(_0x4b09('0x3'));var router=express[_0x4b09('0x4')]();var fs_extra=require(_0x4b09('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4b09('0x6'));var controller=require(_0x4b09('0x7'));router['get']('/',auth[_0x4b09('0x8')](),controller[_0x4b09('0x9')]);router[_0x4b09('0xa')](_0x4b09('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x4b09('0xc'),auth['isAuthenticated'](),controller[_0x4b09('0xd')]);router[_0x4b09('0xe')]('/',auth[_0x4b09('0x8')](),controller[_0x4b09('0xf')]);router[_0x4b09('0x10')](_0x4b09('0xc'),auth[_0x4b09('0x8')](),controller[_0x4b09('0x11')]);router['delete'](_0x4b09('0xc'),auth['isAuthenticated'](),controller[_0x4b09('0x12')]);module[_0x4b09('0x13')]=router; \ No newline at end of file +var _0x48a3=['index','/describe','describe','/:id','show','post','create','put','update','delete','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated'];(function(_0x16d991,_0x3f07cc){var _0x4f41c3=function(_0x18d679){while(--_0x18d679){_0x16d991['push'](_0x16d991['shift']());}};_0x4f41c3(++_0x3f07cc);}(_0x48a3,0x82));var _0x348a=function(_0x3df45b,_0xe6e277){_0x3df45b=_0x3df45b-0x0;var _0x24f10b=_0x48a3[_0x3df45b];return _0x24f10b;};'use strict';var multer=require('multer');var util=require(_0x348a('0x0'));var path=require(_0x348a('0x1'));var timeout=require(_0x348a('0x2'));var express=require(_0x348a('0x3'));var router=express['Router']();var fs_extra=require(_0x348a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x348a('0x5'));var config=require(_0x348a('0x6'));var controller=require(_0x348a('0x7'));router[_0x348a('0x8')]('/',auth[_0x348a('0x9')](),controller[_0x348a('0xa')]);router[_0x348a('0x8')](_0x348a('0xb'),auth[_0x348a('0x9')](),controller[_0x348a('0xc')]);router[_0x348a('0x8')](_0x348a('0xd'),auth[_0x348a('0x9')](),controller[_0x348a('0xe')]);router[_0x348a('0xf')]('/',auth[_0x348a('0x9')](),controller[_0x348a('0x10')]);router[_0x348a('0x11')]('/:id',auth[_0x348a('0x9')](),controller[_0x348a('0x12')]);router[_0x348a('0x13')](_0x348a('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 13f39a7..328ac28 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x56478f,_0x37d750){var _0x36fcd5=function(_0x131821){while(--_0x131821){_0x56478f['push'](_0x56478f['shift']());}};_0x36fcd5(++_0x37d750);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0x4b84[_0x1ac6e5];return _0x5877dc;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x586fa2,_0x1a45bc){var _0x515be9=function(_0x4e90d5){while(--_0x4e90d5){_0x586fa2['push'](_0x586fa2['shift']());}};_0x515be9(++_0x1a45bc);}(_0x008c,0x188));var _0xc008=function(_0x343d36,_0x5f248a){_0x343d36=_0x343d36-0x0;var _0x3bd305=_0x008c[_0x343d36];return _0x3bd305;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 73a385f..974e621 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 _0x8f23=['length','limit','sort','where','filter','merge','VIRTUAL','options','MailTransferReport','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','fieldName','type','key','map','name','query','keys','filters','intersection','model','attributes','fields'];(function(_0xe5aac7,_0xb9f178){var _0xa932=function(_0x29c20a){while(--_0x29c20a){_0xe5aac7['push'](_0xe5aac7['shift']());}};_0xa932(++_0xb9f178);}(_0x8f23,0xa5));var _0x38f2=function(_0x6e7ca7,_0x1a6f34){_0x6e7ca7=_0x6e7ca7-0x0;var _0x2dd156=_0x8f23[_0x6e7ca7];return _0x2dd156;};'use strict';var emlformat=require(_0x38f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x38f2('0x1'));var jsonpatch=require(_0x38f2('0x2'));var rp=require(_0x38f2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x38f2('0x4'));var util=require(_0x38f2('0x5'));var path=require(_0x38f2('0x6'));var sox=require(_0x38f2('0x7'));var csv=require(_0x38f2('0x8'));var ejs=require(_0x38f2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38f2('0xa'));var squel=require('squel');var crypto=require(_0x38f2('0xb'));var jsforce=require(_0x38f2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x38f2('0xd'));var Redis=require('ioredis');var authService=require(_0x38f2('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x38f2('0xf'));var hardwareService=require(_0x38f2('0x10'));var logger=require(_0x38f2('0x11'))('api');var utils=require(_0x38f2('0x12'));var config=require(_0x38f2('0x13'));var licenseUtil=require(_0x38f2('0x14'));var db=require(_0x38f2('0x15'))['db'];function respondWithStatusCode(_0x1f7880,_0x4a3c53){_0x4a3c53=_0x4a3c53||0xcc;return function(_0xec6b57){if(_0xec6b57){return _0x1f7880[_0x38f2('0x16')](_0x4a3c53);}return _0x1f7880[_0x38f2('0x17')](_0x4a3c53)['end']();};}function respondWithResult(_0x4246a4,_0x1ec9f1){_0x1ec9f1=_0x1ec9f1||0xc8;return function(_0x3d85c5){if(_0x3d85c5){return _0x4246a4[_0x38f2('0x17')](_0x1ec9f1)[_0x38f2('0x18')](_0x3d85c5);}};}function respondWithFilteredResult(_0x58ff79,_0xecdb1a){return function(_0x3ca4fb){if(_0x3ca4fb){var _0x5efdb9=typeof _0xecdb1a[_0x38f2('0x19')]===_0x38f2('0x1a')&&typeof _0xecdb1a['limit']===_0x38f2('0x1a');var _0x53c444=_0x3ca4fb[_0x38f2('0x1b')];var _0x40f5ea=_0x5efdb9?0x0:_0xecdb1a['offset'];var _0x203638=_0x5efdb9?_0x3ca4fb['count']:_0xecdb1a['offset']+_0xecdb1a['limit'];var _0x13666d;if(_0x203638>=_0x53c444){_0x203638=_0x53c444;_0x13666d=0xc8;}else{_0x13666d=0xce;}_0x58ff79[_0x38f2('0x17')](_0x13666d);return _0x58ff79[_0x38f2('0x1c')](_0x38f2('0x1d'),_0x40f5ea+'-'+_0x203638+'/'+_0x53c444)[_0x38f2('0x18')](_0x3ca4fb);}return null;};}function patchUpdates(_0x5833bf){return function(_0x3c2a56){try{jsonpatch[_0x38f2('0x1e')](_0x3c2a56,_0x5833bf,!![]);}catch(_0x330119){return BPromise[_0x38f2('0x1f')](_0x330119);}return _0x3c2a56[_0x38f2('0x20')]();};}function saveUpdates(_0x552ab9,_0x138500){return function(_0x10e86d){if(_0x10e86d){return _0x10e86d[_0x38f2('0x21')](_0x552ab9)[_0x38f2('0x22')](function(_0x7cc14f){return _0x7cc14f;});}return null;};}function removeEntity(_0x39bb5e,_0x1fdcbe){return function(_0x558e51){if(_0x558e51){return _0x558e51[_0x38f2('0x23')]()[_0x38f2('0x22')](function(){_0x39bb5e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x320e60,_0x137b86){return function(_0x4c72dd){if(!_0x4c72dd){_0x320e60[_0x38f2('0x16')](0x194);}return _0x4c72dd;};}function handleError(_0x392f92,_0x32dbba){_0x32dbba=_0x32dbba||0x1f4;return function(_0x4118d6){logger[_0x38f2('0x24')](_0x4118d6[_0x38f2('0x25')]);if(_0x4118d6['name']){delete _0x4118d6['name'];}_0x392f92[_0x38f2('0x17')](_0x32dbba)['send'](_0x4118d6);};}exports[_0x38f2('0x26')]=function(_0x18da42,_0xc5bfd3){var _0x48dc81={},_0x76defc={},_0x152863={'count':0x0,'rows':[]};var _0x51418d=_['map'](db['MailTransferReport']['rawAttributes'],function(_0x3c2e29){return{'name':_0x3c2e29[_0x38f2('0x27')],'type':_0x3c2e29[_0x38f2('0x28')][_0x38f2('0x29')]};});_0x76defc['model']=_[_0x38f2('0x2a')](_0x51418d,_0x38f2('0x2b'));_0x76defc[_0x38f2('0x2c')]=_[_0x38f2('0x2d')](_0x18da42[_0x38f2('0x2c')]);_0x76defc[_0x38f2('0x2e')]=_[_0x38f2('0x2f')](_0x76defc[_0x38f2('0x30')],_0x76defc[_0x38f2('0x2c')]);_0x48dc81[_0x38f2('0x31')]=_[_0x38f2('0x2f')](_0x76defc['model'],qs[_0x38f2('0x32')](_0x18da42[_0x38f2('0x2c')][_0x38f2('0x32')]));_0x48dc81['attributes']=_0x48dc81[_0x38f2('0x31')][_0x38f2('0x33')]?_0x48dc81[_0x38f2('0x31')]:_0x76defc[_0x38f2('0x30')];if(!_0x18da42[_0x38f2('0x2c')]['hasOwnProperty']('nolimit')){_0x48dc81['limit']=qs['limit'](_0x18da42['query'][_0x38f2('0x34')]);_0x48dc81[_0x38f2('0x19')]=qs['offset'](_0x18da42[_0x38f2('0x2c')][_0x38f2('0x19')]);}_0x48dc81['order']=qs[_0x38f2('0x35')](_0x18da42['query']['sort']);_0x48dc81[_0x38f2('0x36')]=qs['filters'](_['pick'](_0x18da42[_0x38f2('0x2c')],_0x76defc[_0x38f2('0x2e')]),_0x51418d);if(_0x18da42[_0x38f2('0x2c')][_0x38f2('0x37')]){_0x48dc81[_0x38f2('0x36')]=_[_0x38f2('0x38')](_0x48dc81['where'],{'$or':_['map'](_0x51418d,function(_0x513949){if(_0x513949[_0x38f2('0x28')]!==_0x38f2('0x39')){var _0x45e999={};_0x45e999[_0x513949[_0x38f2('0x2b')]]={'$like':'%'+_0x18da42[_0x38f2('0x2c')]['filter']+'%'};return _0x45e999;}})});}_0x48dc81=_['merge']({},_0x48dc81,_0x18da42[_0x38f2('0x3a')]);var _0xcd3d89={'where':_0x48dc81['where']};return db[_0x38f2('0x3b')][_0x38f2('0x1b')](_0xcd3d89)[_0x38f2('0x22')](function(_0x31a055){_0x152863[_0x38f2('0x1b')]=_0x31a055;if(_0x18da42[_0x38f2('0x2c')][_0x38f2('0x3c')]){_0x48dc81['include']=[{'all':!![]}];}return db[_0x38f2('0x3b')][_0x38f2('0x3d')](_0x48dc81);})[_0x38f2('0x22')](function(_0x566908){_0x152863[_0x38f2('0x3e')]=_0x566908;return _0x152863;})[_0x38f2('0x22')](respondWithFilteredResult(_0xc5bfd3,_0x48dc81))[_0x38f2('0x3f')](handleError(_0xc5bfd3,null));};exports[_0x38f2('0x40')]=function(_0x2c1dfe,_0xf35335){var _0x1324f5={'raw':!![],'where':{'id':_0x2c1dfe['params']['id']}},_0x34678a={};_0x34678a['model']=_['keys'](db[_0x38f2('0x3b')][_0x38f2('0x41')]);_0x34678a[_0x38f2('0x2c')]=_[_0x38f2('0x2d')](_0x2c1dfe[_0x38f2('0x2c')]);_0x34678a[_0x38f2('0x2e')]=_[_0x38f2('0x2f')](_0x34678a[_0x38f2('0x30')],_0x34678a['query']);_0x1324f5[_0x38f2('0x31')]=_[_0x38f2('0x2f')](_0x34678a[_0x38f2('0x30')],qs[_0x38f2('0x32')](_0x2c1dfe[_0x38f2('0x2c')][_0x38f2('0x32')]));_0x1324f5[_0x38f2('0x31')]=_0x1324f5[_0x38f2('0x31')][_0x38f2('0x33')]?_0x1324f5[_0x38f2('0x31')]:_0x34678a[_0x38f2('0x30')];if(_0x2c1dfe[_0x38f2('0x2c')][_0x38f2('0x3c')]){_0x1324f5[_0x38f2('0x42')]=[{'all':!![]}];}_0x1324f5=_[_0x38f2('0x38')]({},_0x1324f5,_0x2c1dfe[_0x38f2('0x3a')]);return db[_0x38f2('0x3b')][_0x38f2('0x43')](_0x1324f5)['then'](handleEntityNotFound(_0xf35335,null))[_0x38f2('0x22')](respondWithResult(_0xf35335,null))[_0x38f2('0x3f')](handleError(_0xf35335,null));};exports[_0x38f2('0x44')]=function(_0x4eeb58,_0x308c68){return db[_0x38f2('0x3b')][_0x38f2('0x44')](_0x4eeb58['body'],{})['then'](respondWithResult(_0x308c68,0xc9))['catch'](handleError(_0x308c68,null));};exports['update']=function(_0x282966,_0x54a92b){if(_0x282966[_0x38f2('0x45')]['id']){delete _0x282966['body']['id'];}return db['MailTransferReport'][_0x38f2('0x43')]({'where':{'id':_0x282966[_0x38f2('0x46')]['id']}})[_0x38f2('0x22')](handleEntityNotFound(_0x54a92b,null))[_0x38f2('0x22')](saveUpdates(_0x282966['body'],null))[_0x38f2('0x22')](respondWithResult(_0x54a92b,null))['catch'](handleError(_0x54a92b,null));};exports['destroy']=function(_0x760484,_0x54a6ad){return db[_0x38f2('0x3b')][_0x38f2('0x43')]({'where':{'id':_0x760484[_0x38f2('0x46')]['id']}})[_0x38f2('0x22')](handleEntityNotFound(_0x54a6ad,null))[_0x38f2('0x22')](removeEntity(_0x54a6ad,null))[_0x38f2('0x3f')](handleError(_0x54a6ad,null));};exports[_0x38f2('0x47')]=function(_0x3a54d1,_0x442b12){return db['MailTransferReport']['describe']()['then'](respondWithResult(_0x442b12,null))[_0x38f2('0x3f')](handleError(_0x442b12,null));}; \ No newline at end of file +var _0xb4a6=['type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','filter','where','merge','options','includeAll','findAll','rows','catch','show','include','find','create','body','describe','eml-format','zip-dir','request-promise','moment','util','sox','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','count','offset','limit','set','Content-Range','save','update','destroy','then','sendStatus','error','name','send','index','map','MailTransferReport','rawAttributes','fieldName'];(function(_0x20511d,_0x6618e5){var _0x38efa0=function(_0x4e184a){while(--_0x4e184a){_0x20511d['push'](_0x20511d['shift']());}};_0x38efa0(++_0x6618e5);}(_0xb4a6,0x1b2));var _0x6b4a=function(_0xfbb2c4,_0x26b45a){_0xfbb2c4=_0xfbb2c4-0x0;var _0x440158=_0xb4a6[_0xfbb2c4];return _0x440158;};'use strict';var emlformat=require(_0x6b4a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b4a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b4a('0x2'));var moment=require(_0x6b4a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6b4a('0x4'));var path=require('path');var sox=require(_0x6b4a('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b4a('0x6'));var _=require(_0x6b4a('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b4a('0x8'));var deskjs=require(_0x6b4a('0x9'));var toCsv=require('to-csv');var querystring=require(_0x6b4a('0xa'));var Papa=require(_0x6b4a('0xb'));var Redis=require(_0x6b4a('0xc'));var authService=require(_0x6b4a('0xd'));var qs=require(_0x6b4a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b4a('0xf'))(_0x6b4a('0x10'));var utils=require(_0x6b4a('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x6b4a('0x12'));var db=require(_0x6b4a('0x13'))['db'];function respondWithStatusCode(_0x34d43b,_0x177008){_0x177008=_0x177008||0xcc;return function(_0x5dd291){if(_0x5dd291){return _0x34d43b['sendStatus'](_0x177008);}return _0x34d43b['status'](_0x177008)[_0x6b4a('0x14')]();};}function respondWithResult(_0x5e721f,_0x136e86){_0x136e86=_0x136e86||0xc8;return function(_0x40fe48){if(_0x40fe48){return _0x5e721f[_0x6b4a('0x15')](_0x136e86)[_0x6b4a('0x16')](_0x40fe48);}};}function respondWithFilteredResult(_0x9c9fbd,_0x4f9fd9){return function(_0x2d601e){if(_0x2d601e){var _0x47d83e=typeof _0x4f9fd9['offset']===_0x6b4a('0x17')&&typeof _0x4f9fd9['limit']===_0x6b4a('0x17');var _0x2beccc=_0x2d601e[_0x6b4a('0x18')];var _0x144db4=_0x47d83e?0x0:_0x4f9fd9[_0x6b4a('0x19')];var _0x3dc09e=_0x47d83e?_0x2d601e[_0x6b4a('0x18')]:_0x4f9fd9['offset']+_0x4f9fd9[_0x6b4a('0x1a')];var _0x10af56;if(_0x3dc09e>=_0x2beccc){_0x3dc09e=_0x2beccc;_0x10af56=0xc8;}else{_0x10af56=0xce;}_0x9c9fbd[_0x6b4a('0x15')](_0x10af56);return _0x9c9fbd[_0x6b4a('0x1b')](_0x6b4a('0x1c'),_0x144db4+'-'+_0x3dc09e+'/'+_0x2beccc)[_0x6b4a('0x16')](_0x2d601e);}return null;};}function patchUpdates(_0x7a16de){return function(_0x55f38e){try{jsonpatch['apply'](_0x55f38e,_0x7a16de,!![]);}catch(_0x29f25c){return BPromise['reject'](_0x29f25c);}return _0x55f38e[_0x6b4a('0x1d')]();};}function saveUpdates(_0x2da938,_0x17f8f3){return function(_0x8db2a7){if(_0x8db2a7){return _0x8db2a7[_0x6b4a('0x1e')](_0x2da938)['then'](function(_0x36d0a5){return _0x36d0a5;});}return null;};}function removeEntity(_0xb4ae0,_0x1cc885){return function(_0x77fc5b){if(_0x77fc5b){return _0x77fc5b[_0x6b4a('0x1f')]()[_0x6b4a('0x20')](function(){_0xb4ae0[_0x6b4a('0x15')](0xcc)[_0x6b4a('0x14')]();});}};}function handleEntityNotFound(_0x2a8e79,_0x19f068){return function(_0x49d988){if(!_0x49d988){_0x2a8e79[_0x6b4a('0x21')](0x194);}return _0x49d988;};}function handleError(_0xf98427,_0x23e9c6){_0x23e9c6=_0x23e9c6||0x1f4;return function(_0x4e5bf6){logger[_0x6b4a('0x22')](_0x4e5bf6['stack']);if(_0x4e5bf6[_0x6b4a('0x23')]){delete _0x4e5bf6[_0x6b4a('0x23')];}_0xf98427[_0x6b4a('0x15')](_0x23e9c6)[_0x6b4a('0x24')](_0x4e5bf6);};}exports[_0x6b4a('0x25')]=function(_0x3047cc,_0x4f0bc4){var _0x23b154={},_0x4cdee3={},_0x1c7400={'count':0x0,'rows':[]};var _0x209dc6=_[_0x6b4a('0x26')](db[_0x6b4a('0x27')][_0x6b4a('0x28')],function(_0x76853a){return{'name':_0x76853a[_0x6b4a('0x29')],'type':_0x76853a[_0x6b4a('0x2a')][_0x6b4a('0x2b')]};});_0x4cdee3[_0x6b4a('0x2c')]=_[_0x6b4a('0x26')](_0x209dc6,'name');_0x4cdee3['query']=_[_0x6b4a('0x2d')](_0x3047cc[_0x6b4a('0x2e')]);_0x4cdee3[_0x6b4a('0x2f')]=_[_0x6b4a('0x30')](_0x4cdee3[_0x6b4a('0x2c')],_0x4cdee3['query']);_0x23b154[_0x6b4a('0x31')]=_[_0x6b4a('0x30')](_0x4cdee3['model'],qs['fields'](_0x3047cc[_0x6b4a('0x2e')][_0x6b4a('0x32')]));_0x23b154[_0x6b4a('0x31')]=_0x23b154[_0x6b4a('0x31')][_0x6b4a('0x33')]?_0x23b154[_0x6b4a('0x31')]:_0x4cdee3['model'];if(!_0x3047cc[_0x6b4a('0x2e')]['hasOwnProperty'](_0x6b4a('0x34'))){_0x23b154[_0x6b4a('0x1a')]=qs['limit'](_0x3047cc[_0x6b4a('0x2e')][_0x6b4a('0x1a')]);_0x23b154[_0x6b4a('0x19')]=qs[_0x6b4a('0x19')](_0x3047cc[_0x6b4a('0x2e')][_0x6b4a('0x19')]);}_0x23b154[_0x6b4a('0x35')]=qs['sort'](_0x3047cc[_0x6b4a('0x2e')]['sort']);_0x23b154['where']=qs[_0x6b4a('0x2f')](_['pick'](_0x3047cc[_0x6b4a('0x2e')],_0x4cdee3[_0x6b4a('0x2f')]),_0x209dc6);if(_0x3047cc[_0x6b4a('0x2e')][_0x6b4a('0x36')]){_0x23b154[_0x6b4a('0x37')]=_[_0x6b4a('0x38')](_0x23b154[_0x6b4a('0x37')],{'$or':_[_0x6b4a('0x26')](_0x209dc6,function(_0x36f275){if(_0x36f275[_0x6b4a('0x2a')]!=='VIRTUAL'){var _0x51e2c1={};_0x51e2c1[_0x36f275[_0x6b4a('0x23')]]={'$like':'%'+_0x3047cc[_0x6b4a('0x2e')]['filter']+'%'};return _0x51e2c1;}})});}_0x23b154=_[_0x6b4a('0x38')]({},_0x23b154,_0x3047cc[_0x6b4a('0x39')]);var _0x2ef738={'where':_0x23b154[_0x6b4a('0x37')]};return db['MailTransferReport'][_0x6b4a('0x18')](_0x2ef738)[_0x6b4a('0x20')](function(_0x135a96){_0x1c7400['count']=_0x135a96;if(_0x3047cc['query'][_0x6b4a('0x3a')]){_0x23b154['include']=[{'all':!![]}];}return db[_0x6b4a('0x27')][_0x6b4a('0x3b')](_0x23b154);})[_0x6b4a('0x20')](function(_0x2e5075){_0x1c7400[_0x6b4a('0x3c')]=_0x2e5075;return _0x1c7400;})[_0x6b4a('0x20')](respondWithFilteredResult(_0x4f0bc4,_0x23b154))[_0x6b4a('0x3d')](handleError(_0x4f0bc4,null));};exports[_0x6b4a('0x3e')]=function(_0x5a2550,_0x1f4552){var _0x35d8cc={'raw':!![],'where':{'id':_0x5a2550['params']['id']}},_0x655f7f={};_0x655f7f['model']=_['keys'](db['MailTransferReport'][_0x6b4a('0x28')]);_0x655f7f[_0x6b4a('0x2e')]=_['keys'](_0x5a2550[_0x6b4a('0x2e')]);_0x655f7f[_0x6b4a('0x2f')]=_[_0x6b4a('0x30')](_0x655f7f[_0x6b4a('0x2c')],_0x655f7f['query']);_0x35d8cc[_0x6b4a('0x31')]=_[_0x6b4a('0x30')](_0x655f7f[_0x6b4a('0x2c')],qs[_0x6b4a('0x32')](_0x5a2550[_0x6b4a('0x2e')][_0x6b4a('0x32')]));_0x35d8cc['attributes']=_0x35d8cc[_0x6b4a('0x31')]['length']?_0x35d8cc[_0x6b4a('0x31')]:_0x655f7f[_0x6b4a('0x2c')];if(_0x5a2550[_0x6b4a('0x2e')]['includeAll']){_0x35d8cc[_0x6b4a('0x3f')]=[{'all':!![]}];}_0x35d8cc=_[_0x6b4a('0x38')]({},_0x35d8cc,_0x5a2550['options']);return db['MailTransferReport'][_0x6b4a('0x40')](_0x35d8cc)[_0x6b4a('0x20')](handleEntityNotFound(_0x1f4552,null))[_0x6b4a('0x20')](respondWithResult(_0x1f4552,null))[_0x6b4a('0x3d')](handleError(_0x1f4552,null));};exports['create']=function(_0xe9b123,_0x5ea5b7){return db['MailTransferReport'][_0x6b4a('0x41')](_0xe9b123[_0x6b4a('0x42')],{})[_0x6b4a('0x20')](respondWithResult(_0x5ea5b7,0xc9))[_0x6b4a('0x3d')](handleError(_0x5ea5b7,null));};exports['update']=function(_0x1b426d,_0x5033ed){if(_0x1b426d[_0x6b4a('0x42')]['id']){delete _0x1b426d['body']['id'];}return db[_0x6b4a('0x27')]['find']({'where':{'id':_0x1b426d['params']['id']}})[_0x6b4a('0x20')](handleEntityNotFound(_0x5033ed,null))[_0x6b4a('0x20')](saveUpdates(_0x1b426d[_0x6b4a('0x42')],null))[_0x6b4a('0x20')](respondWithResult(_0x5033ed,null))[_0x6b4a('0x3d')](handleError(_0x5033ed,null));};exports[_0x6b4a('0x1f')]=function(_0x372e45,_0x18e431){return db['MailTransferReport'][_0x6b4a('0x40')]({'where':{'id':_0x372e45['params']['id']}})[_0x6b4a('0x20')](handleEntityNotFound(_0x18e431,null))[_0x6b4a('0x20')](removeEntity(_0x18e431,null))[_0x6b4a('0x3d')](handleError(_0x18e431,null));};exports[_0x6b4a('0x43')]=function(_0xdda308,_0x4f5f2e){return db[_0x6b4a('0x27')][_0x6b4a('0x43')]()[_0x6b4a('0x20')](respondWithResult(_0x4f5f2e,null))['catch'](handleError(_0x4f5f2e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 4f2390c..cebe5f5 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 _0x9879=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x205b46,_0x3ca65b){var _0x2b6ae8=function(_0x1f4ae9){while(--_0x1f4ae9){_0x205b46['push'](_0x205b46['shift']());}};_0x2b6ae8(++_0x3ca65b);}(_0x9879,0x98));var _0x9987=function(_0x396e1f,_0x2a8a3b){_0x396e1f=_0x396e1f-0x0;var _0x371664=_0x9879[_0x396e1f];return _0x371664;};'use strict';var _=require(_0x9987('0x0'));var util=require(_0x9987('0x1'));var logger=require(_0x9987('0x2'))('api');var moment=require(_0x9987('0x3'));var BPromise=require('bluebird');var rp=require(_0x9987('0x4'));var fs=require('fs');var path=require(_0x9987('0x5'));var rimraf=require(_0x9987('0x6'));var config=require(_0x9987('0x7'));var attributes=require(_0x9987('0x8'));module[_0x9987('0x9')]=function(_0x4258df,_0x4d479d){return _0x4258df[_0x9987('0xa')]('MailTransferReport',attributes,{'tableName':_0x9987('0xb'),'paranoid':![],'indexes':[{'name':_0x9987('0xc'),'fields':[_0x9987('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6453=['uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer'];(function(_0x148503,_0x587053){var _0x55dc91=function(_0x54b127){while(--_0x54b127){_0x148503['push'](_0x148503['shift']());}};_0x55dc91(++_0x587053);}(_0x6453,0x88));var _0x3645=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0x6453[_0x5b5cde];return _0x364ad2;};'use strict';var _=require(_0x3645('0x0'));var util=require(_0x3645('0x1'));var logger=require('../../config/logger')(_0x3645('0x2'));var moment=require(_0x3645('0x3'));var BPromise=require(_0x3645('0x4'));var rp=require(_0x3645('0x5'));var fs=require('fs');var path=require(_0x3645('0x6'));var rimraf=require(_0x3645('0x7'));var config=require(_0x3645('0x8'));var attributes=require(_0x3645('0x9'));module[_0x3645('0xa')]=function(_0x19b19c,_0xe951){return _0x19b19c[_0x3645('0xb')](_0x3645('0xc'),attributes,{'tableName':_0x3645('0xd'),'paranoid':![],'indexes':[{'name':_0x3645('0xe'),'fields':[_0x3645('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index dcd3644..21bd671 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 _0x2619=['rpc','../../config/environment','client','http','then','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x56a03f,_0x9078da){var _0xe824=function(_0x510b4c){while(--_0x510b4c){_0x56a03f['push'](_0x56a03f['shift']());}};_0xe824(++_0x9078da);}(_0x2619,0x152));var _0x9261=function(_0x2ebb06,_0x4bc635){_0x2ebb06=_0x2ebb06-0x0;var _0x587b17=_0x2619[_0x2ebb06];return _0x587b17;};'use strict';var _=require(_0x9261('0x0'));var util=require(_0x9261('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9261('0x2'));var fs=require('fs');var Redis=require(_0x9261('0x3'));var db=require(_0x9261('0x4'))['db'];var utils=require(_0x9261('0x5'));var logger=require(_0x9261('0x6'))(_0x9261('0x7'));var config=require(_0x9261('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9261('0x9')][_0x9261('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad8b83,_0x596dfe,_0x33623f){return new BPromise(function(_0x2a0e7d,_0x1d9d96){return client['request'](_0xad8b83,_0x33623f)[_0x9261('0xb')](function(_0x1eb782){logger[_0x9261('0xc')]('MailTransferReport,\x20%s,\x20%s',_0x596dfe,_0x9261('0xd'));logger[_0x9261('0xe')](_0x9261('0xf'),_0x596dfe,_0x9261('0xd'),JSON[_0x9261('0x10')](_0x1eb782));if(_0x1eb782[_0x9261('0x11')]){if(_0x1eb782['error'][_0x9261('0x12')]===0x1f4){logger[_0x9261('0x11')](_0x9261('0x13'),_0x596dfe,_0x1eb782[_0x9261('0x11')][_0x9261('0x14')]);return _0x1d9d96(_0x1eb782[_0x9261('0x11')][_0x9261('0x14')]);}logger[_0x9261('0x11')]('MailTransferReport,\x20%s,\x20%s',_0x596dfe,_0x1eb782[_0x9261('0x11')][_0x9261('0x14')]);return _0x2a0e7d(_0x1eb782['error']['message']);}else{logger[_0x9261('0xc')](_0x9261('0x13'),_0x596dfe,_0x9261('0xd'));_0x2a0e7d(_0x1eb782[_0x9261('0x15')][_0x9261('0x14')]);}})[_0x9261('0x16')](function(_0x213e4c){logger['error'](_0x9261('0x13'),_0x596dfe,_0x213e4c);_0x1d9d96(_0x213e4c);});});} \ No newline at end of file +var _0x73fa=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x561247,_0x1640e8){var _0xbfc8c3=function(_0x17e1dd){while(--_0x17e1dd){_0x561247['push'](_0x561247['shift']());}};_0xbfc8c3(++_0x1640e8);}(_0x73fa,0xfc));var _0xa73f=function(_0x3eb1c1,_0x1bb418){_0x3eb1c1=_0x3eb1c1-0x0;var _0x53645a=_0x73fa[_0x3eb1c1];return _0x53645a;};'use strict';var _=require(_0xa73f('0x0'));var util=require(_0xa73f('0x1'));var moment=require(_0xa73f('0x2'));var BPromise=require(_0xa73f('0x3'));var rs=require(_0xa73f('0x4'));var fs=require('fs');var Redis=require(_0xa73f('0x5'));var db=require(_0xa73f('0x6'))['db'];var utils=require(_0xa73f('0x7'));var logger=require(_0xa73f('0x8'))('rpc');var config=require(_0xa73f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa73f('0xa')][_0xa73f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x259730,_0x2830db,_0x42b3ee){return new BPromise(function(_0x3215ba,_0x596635){return client[_0xa73f('0xc')](_0x259730,_0x42b3ee)[_0xa73f('0xd')](function(_0x1c98ba){logger[_0xa73f('0xe')](_0xa73f('0xf'),_0x2830db,_0xa73f('0x10'));logger[_0xa73f('0x11')](_0xa73f('0x12'),_0x2830db,'request\x20sent',JSON[_0xa73f('0x13')](_0x1c98ba));if(_0x1c98ba[_0xa73f('0x14')]){if(_0x1c98ba[_0xa73f('0x14')]['code']===0x1f4){logger[_0xa73f('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x2830db,_0x1c98ba[_0xa73f('0x14')][_0xa73f('0x15')]);return _0x596635(_0x1c98ba[_0xa73f('0x14')][_0xa73f('0x15')]);}logger[_0xa73f('0x14')](_0xa73f('0xf'),_0x2830db,_0x1c98ba[_0xa73f('0x14')]['message']);return _0x3215ba(_0x1c98ba[_0xa73f('0x14')][_0xa73f('0x15')]);}else{logger[_0xa73f('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x2830db,_0xa73f('0x10'));_0x3215ba(_0x1c98ba[_0xa73f('0x16')]['message']);}})[_0xa73f('0x17')](function(_0x25dec8){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x2830db,_0x25dec8);_0x596635(_0x25dec8);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 8c58ecd..2ab364f 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 _0x9d1b=['express','Router','fs-extra','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','/:id','create','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0xc472e2,_0x53d69e){var _0x703b5b=function(_0xf0c0cc){while(--_0xf0c0cc){_0xc472e2['push'](_0xc472e2['shift']());}};_0x703b5b(++_0x53d69e);}(_0x9d1b,0xce));var _0xb9d1=function(_0x4733d3,_0x454290){_0x4733d3=_0x4733d3-0x0;var _0x1b9a44=_0x9d1b[_0x4733d3];return _0x1b9a44;};'use strict';var multer=require(_0xb9d1('0x0'));var util=require('util');var path=require(_0xb9d1('0x1'));var timeout=require(_0xb9d1('0x2'));var express=require(_0xb9d1('0x3'));var router=express[_0xb9d1('0x4')]();var fs_extra=require(_0xb9d1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb9d1('0x6'));var controller=require(_0xb9d1('0x7'));router[_0xb9d1('0x8')]('/',auth['isAuthenticated'](),controller[_0xb9d1('0x9')]);router[_0xb9d1('0x8')](_0xb9d1('0xa'),auth[_0xb9d1('0xb')](),controller['describe']);router[_0xb9d1('0x8')](_0xb9d1('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xb9d1('0xb')](),controller[_0xb9d1('0xd')]);router[_0xb9d1('0xe')](_0xb9d1('0xc'),auth['isAuthenticated'](),controller[_0xb9d1('0xf')]);router[_0xb9d1('0x10')]('/:id',auth[_0xb9d1('0xb')](),controller[_0xb9d1('0x11')]);module[_0xb9d1('0x12')]=router; \ No newline at end of file +var _0x4c18=['express','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','destroy','multer','connect-timeout'];(function(_0x4d70ff,_0x1b070b){var _0x4221f4=function(_0x4767ed){while(--_0x4767ed){_0x4d70ff['push'](_0x4d70ff['shift']());}};_0x4221f4(++_0x1b070b);}(_0x4c18,0x1ce));var _0x84c1=function(_0x12aa80,_0x495a45){_0x12aa80=_0x12aa80-0x0;var _0x354282=_0x4c18[_0x12aa80];return _0x354282;};'use strict';var multer=require(_0x84c1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x84c1('0x1'));var express=require(_0x84c1('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x84c1('0x3'));var interaction=require(_0x84c1('0x4'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x84c1('0x5')]('/',auth['isAuthenticated'](),controller[_0x84c1('0x6')]);router['get'](_0x84c1('0x7'),auth[_0x84c1('0x8')](),controller[_0x84c1('0x9')]);router[_0x84c1('0x5')](_0x84c1('0xa'),auth[_0x84c1('0x8')](),controller['show']);router[_0x84c1('0xb')]('/',auth[_0x84c1('0x8')](),controller[_0x84c1('0xc')]);router[_0x84c1('0xd')](_0x84c1('0xa'),auth[_0x84c1('0x8')](),controller[_0x84c1('0xe')]);router['delete'](_0x84c1('0xa'),auth['isAuthenticated'](),controller[_0x84c1('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index e65711a..2e5c874 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 _0xba33=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds'];(function(_0x46ee24,_0xd03d74){var _0x1e3f0d=function(_0x21bbe2){while(--_0x21bbe2){_0x46ee24['push'](_0x46ee24['shift']());}};_0x1e3f0d(++_0xd03d74);}(_0xba33,0xf1));var _0x3ba3=function(_0x20737e,_0x34af27){_0x20737e=_0x20737e-0x0;var _0xa41f5d=_0xba33[_0x20737e];return _0xa41f5d;};'use strict';var Sequelize=require(_0x3ba3('0x0'));var moment=require(_0x3ba3('0x1'));module[_0x3ba3('0x2')]={'channel':{'type':Sequelize[_0x3ba3('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3ba3('0x3')]},'type':{'type':Sequelize[_0x3ba3('0x3')],'defaultValue':_0x3ba3('0x4'),'comment':_0x3ba3('0x5')},'duration':{'type':Sequelize[_0x3ba3('0x6')]},'enterAt':{'type':Sequelize[_0x3ba3('0x7')]},'exitAt':{'type':Sequelize[_0x3ba3('0x7')],'set':function(_0xd24f52){var _0xe9e300=moment(_0xd24f52);var _0xfbfa81=moment(this[_0x3ba3('0x8')]('enterAt'));var _0x17a6d3=_0xe9e300[_0x3ba3('0x9')](_0xfbfa81,_0x3ba3('0xa'));this[_0x3ba3('0xb')](_0x3ba3('0xc'),_0xd24f52);this['setDataValue'](_0x3ba3('0xd'),_0x17a6d3||null);}},'data1':{'type':Sequelize[_0x3ba3('0x3')],'comment':_0x3ba3('0xe')},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0x3ba3('0xf')},'data4':{'type':Sequelize[_0x3ba3('0x3')],'comment':_0x3ba3('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0x3ba3('0x11')},'role':{'type':Sequelize[_0x3ba3('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x3ba3('0x3')]}}; \ No newline at end of file +var _0x3657=['STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','diff','seconds','exitAt','setDataValue','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports'];(function(_0x431e18,_0x42f0e5){var _0x7d6d56=function(_0x1c8553){while(--_0x1c8553){_0x431e18['push'](_0x431e18['shift']());}};_0x7d6d56(++_0x42f0e5);}(_0x3657,0x183));var _0x7365=function(_0x17730a,_0x362127){_0x17730a=_0x17730a-0x0;var _0x485db1=_0x3657[_0x17730a];return _0x485db1;};'use strict';var Sequelize=require(_0x7365('0x0'));var moment=require(_0x7365('0x1'));module[_0x7365('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x7365('0x3')]},'interface':{'type':Sequelize[_0x7365('0x3')]},'type':{'type':Sequelize[_0x7365('0x3')],'defaultValue':_0x7365('0x4'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0x7365('0x5')]},'enterAt':{'type':Sequelize[_0x7365('0x6')]},'exitAt':{'type':Sequelize[_0x7365('0x6')],'set':function(_0x51998b){var _0x2c19f5=moment(_0x51998b);var _0x40c0c7=moment(this[_0x7365('0x7')]('enterAt'));var _0x244a3e=_0x2c19f5[_0x7365('0x8')](_0x40c0c7,_0x7365('0x9'));this['setDataValue'](_0x7365('0xa'),_0x51998b);this[_0x7365('0xb')]('duration',_0x244a3e||null);}},'data1':{'type':Sequelize[_0x7365('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x7365('0x3')],'comment':_0x7365('0xc')},'data3':{'type':Sequelize[_0x7365('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x7365('0x3')],'comment':_0x7365('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0x7365('0xe')},'role':{'type':Sequelize[_0x7365('0x3')]},'internal':{'type':Sequelize[_0x7365('0x5')]},'uniqueid':{'type':Sequelize[_0x7365('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d57198f..e108acf 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x13c578,_0x487883){var _0x2bfa32=function(_0x41f94b){while(--_0x41f94b){_0x13c578['push'](_0x13c578['shift']());}};_0x2bfa32(++_0x487883);}(_0x9c44,0x178));var _0x49c4=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x9c44[_0x1caf6a];return _0x1bf493;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xedd9,0xfc));var _0x9edd=function(_0x6094fc,_0x59927f){_0x6094fc=_0x6094fc-0x0;var _0x4864a9=_0xedd9[_0x6094fc];return _0x4864a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 8c7d157..e47cd82 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 _0x347a=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','report_member','membername_interface','membername','interface','lodash'];(function(_0x1c83e8,_0x21689f){var _0x2af775=function(_0x113e5d){while(--_0x113e5d){_0x1c83e8['push'](_0x1c83e8['shift']());}};_0x2af775(++_0x21689f);}(_0x347a,0x12f));var _0xa347=function(_0xa4c85,_0x2b52a7){_0xa4c85=_0xa4c85-0x0;var _0x172c1f=_0x347a[_0xa4c85];return _0x172c1f;};'use strict';var _=require(_0xa347('0x0'));var util=require(_0xa347('0x1'));var logger=require(_0xa347('0x2'))(_0xa347('0x3'));var moment=require(_0xa347('0x4'));var BPromise=require(_0xa347('0x5'));var rp=require(_0xa347('0x6'));var fs=require('fs');var path=require(_0xa347('0x7'));var rimraf=require(_0xa347('0x8'));var config=require(_0xa347('0x9'));var attributes=require(_0xa347('0xa'));module['exports']=function(_0x5cb45b,_0x48ad21){return _0x5cb45b[_0xa347('0xb')]('MemberReport',attributes,{'tableName':_0xa347('0xc'),'paranoid':![],'indexes':[{'name':_0xa347('0xd'),'fields':[_0xa347('0xe'),_0xa347('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf71=['./memberReport.attributes','exports','define','MemberReport','report_member','interface','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x53e787,_0x4298e6){var _0x2781a0=function(_0x21f861){while(--_0x21f861){_0x53e787['push'](_0x53e787['shift']());}};_0x2781a0(++_0x4298e6);}(_0xcf71,0xba));var _0x1cf7=function(_0x275fa1,_0x28af28){_0x275fa1=_0x275fa1-0x0;var _0x5c04db=_0xcf71[_0x275fa1];return _0x5c04db;};'use strict';var _=require(_0x1cf7('0x0'));var util=require(_0x1cf7('0x1'));var logger=require(_0x1cf7('0x2'))(_0x1cf7('0x3'));var moment=require('moment');var BPromise=require(_0x1cf7('0x4'));var rp=require(_0x1cf7('0x5'));var fs=require('fs');var path=require(_0x1cf7('0x6'));var rimraf=require(_0x1cf7('0x7'));var config=require(_0x1cf7('0x8'));var attributes=require(_0x1cf7('0x9'));module[_0x1cf7('0xa')]=function(_0x20e097,_0x314796){return _0x20e097[_0x1cf7('0xb')](_0x1cf7('0xc'),attributes,{'tableName':_0x1cf7('0xd'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':['membername',_0x1cf7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index c604339..7064ff6 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 _0x5353=['../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','message','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','map','include','model','debug','stringify','catch','CreateMemberReport','create','UpdateMemberReport','update','body','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5353,0x12f));var _0x3535=function(_0x58fa74,_0x31115f){_0x58fa74=_0x58fa74-0x0;var _0x2cdd4e=_0x5353[_0x58fa74];return _0x2cdd4e;};'use strict';var _=require(_0x3535('0x0'));var util=require('util');var moment=require(_0x3535('0x1'));var BPromise=require(_0x3535('0x2'));var rs=require(_0x3535('0x3'));var fs=require('fs');var Redis=require(_0x3535('0x4'));var db=require(_0x3535('0x5'))['db'];var utils=require(_0x3535('0x6'));var logger=require(_0x3535('0x7'))(_0x3535('0x8'));var config=require(_0x3535('0x9'));var jayson=require(_0x3535('0xa'));var client=jayson['client'][_0x3535('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x498868,_0x1c92fd,_0x268873){return new BPromise(function(_0x3e3500,_0x5437a2){return client[_0x3535('0xc')](_0x498868,_0x268873)[_0x3535('0xd')](function(_0x2da555){logger[_0x3535('0xe')](_0x3535('0xf'),_0x1c92fd,_0x3535('0x10'));logger['debug'](_0x3535('0x11'),_0x1c92fd,_0x3535('0x10'),JSON['stringify'](_0x2da555));if(_0x2da555[_0x3535('0x12')]){if(_0x2da555['error']['code']===0x1f4){logger[_0x3535('0x12')](_0x3535('0xf'),_0x1c92fd,_0x2da555[_0x3535('0x12')][_0x3535('0x13')]);return _0x5437a2(_0x2da555[_0x3535('0x12')][_0x3535('0x13')]);}logger[_0x3535('0x12')]('MemberReport,\x20%s,\x20%s',_0x1c92fd,_0x2da555[_0x3535('0x12')]['message']);return _0x3e3500(_0x2da555[_0x3535('0x12')][_0x3535('0x13')]);}else{logger[_0x3535('0xe')]('MemberReport,\x20%s,\x20%s',_0x1c92fd,_0x3535('0x10'));_0x3e3500(_0x2da555['result'][_0x3535('0x13')]);}})['catch'](function(_0x519c33){logger[_0x3535('0x12')](_0x3535('0xf'),_0x1c92fd,_0x519c33);_0x5437a2(_0x519c33);});});}exports[_0x3535('0x14')]=function(_0x298235){var _0x1dfdfe=this;return new Promise(function(_0x2a1705,_0x4340df){return db[_0x3535('0x15')][_0x3535('0x16')]({'raw':_0x298235[_0x3535('0x17')]?_0x298235[_0x3535('0x17')][_0x3535('0x18')]===undefined?!![]:![]:!![],'where':_0x298235['options']?_0x298235['options'][_0x3535('0x19')]||null:null,'attributes':_0x298235['options']?_0x298235['options'][_0x3535('0x1a')]||null:null,'limit':_0x298235[_0x3535('0x17')]?_0x298235[_0x3535('0x17')]['limit']||null:null,'include':_0x298235['options']?_0x298235[_0x3535('0x17')]['include']?_[_0x3535('0x1b')](_0x298235['options'][_0x3535('0x1c')],function(_0x4d372e){return{'model':db[_0x4d372e[_0x3535('0x1d')]],'as':_0x4d372e['as'],'attributes':_0x4d372e['attributes'],'include':_0x4d372e['include']?_[_0x3535('0x1b')](_0x4d372e[_0x3535('0x1c')],function(_0x5a25d1){return{'model':db[_0x5a25d1[_0x3535('0x1d')]],'as':_0x5a25d1['as'],'attributes':_0x5a25d1[_0x3535('0x1a')],'include':_0x5a25d1[_0x3535('0x1c')]?_[_0x3535('0x1b')](_0x5a25d1['include'],function(_0x2bbe00){return{'model':db[_0x2bbe00[_0x3535('0x1d')]],'as':_0x2bbe00['as'],'attributes':_0x2bbe00[_0x3535('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3535('0xd')](function(_0x40009c){logger[_0x3535('0xe')](_0x3535('0x14'),_0x298235);logger[_0x3535('0x1e')]('GetMemberReport',_0x298235,JSON[_0x3535('0x1f')](_0x40009c));_0x2a1705(_0x40009c);})[_0x3535('0x20')](function(_0x4cf180){logger[_0x3535('0x12')](_0x3535('0x14'),_0x4cf180[_0x3535('0x13')],_0x298235);_0x4340df(_0x1dfdfe['error'](0x1f4,_0x4cf180['message']));});});};exports[_0x3535('0x21')]=function(_0x3ccb51){var _0x5918e4=this;return new Promise(function(_0x33a8e1,_0x207c14){return db[_0x3535('0x15')][_0x3535('0x22')](_0x3ccb51['body'],{'raw':_0x3ccb51[_0x3535('0x17')]?_0x3ccb51[_0x3535('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x3535('0xd')](function(_0x1509b0){logger[_0x3535('0xe')](_0x3535('0x21'),_0x3ccb51);logger[_0x3535('0x1e')](_0x3535('0x21'),_0x3ccb51,JSON[_0x3535('0x1f')](_0x1509b0));_0x33a8e1(_0x1509b0);})['catch'](function(_0x57b875){logger[_0x3535('0x12')](_0x3535('0x21'),_0x57b875[_0x3535('0x13')],_0x3ccb51);_0x207c14(_0x5918e4[_0x3535('0x12')](0x1f4,_0x57b875[_0x3535('0x13')]));});});};exports[_0x3535('0x23')]=function(_0x1cdce8){var _0x3209d8=this;return new Promise(function(_0x482ba9,_0x3a99ab){return db[_0x3535('0x15')][_0x3535('0x24')](_0x1cdce8[_0x3535('0x25')],{'raw':_0x1cdce8[_0x3535('0x17')]?_0x1cdce8[_0x3535('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cdce8[_0x3535('0x17')]?_0x1cdce8['options'][_0x3535('0x19')]||null:null,'attributes':_0x1cdce8[_0x3535('0x17')]?_0x1cdce8['options'][_0x3535('0x1a')]||null:null,'limit':_0x1cdce8[_0x3535('0x17')]?_0x1cdce8[_0x3535('0x17')][_0x3535('0x26')]||null:null})['then'](function(_0x47b9c3){logger[_0x3535('0xe')](_0x3535('0x23'),_0x1cdce8);logger[_0x3535('0x1e')](_0x3535('0x23'),_0x1cdce8,JSON[_0x3535('0x1f')](_0x47b9c3));_0x482ba9(_0x47b9c3);})[_0x3535('0x20')](function(_0x4778e3){logger[_0x3535('0x12')](_0x3535('0x23'),_0x4778e3[_0x3535('0x13')],_0x1cdce8);_0x3a99ab(_0x3209d8[_0x3535('0x12')](0x1f4,_0x4778e3[_0x3535('0x13')]));});});}; \ No newline at end of file +var _0xd046=['util','moment','bluebird','ioredis','../../config/logger','../../config/environment','http','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','create','body','CreateMemberReport','UpdateMemberReport','update'];(function(_0xed1f28,_0x46fc77){var _0x3b643d=function(_0x2e2c41){while(--_0x2e2c41){_0xed1f28['push'](_0xed1f28['shift']());}};_0x3b643d(++_0x46fc77);}(_0xd046,0x129));var _0x6d04=function(_0xf7e8e,_0x38bab3){_0xf7e8e=_0xf7e8e-0x0;var _0x6f1045=_0xd046[_0xf7e8e];return _0x6f1045;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var moment=require(_0x6d04('0x1'));var BPromise=require(_0x6d04('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d04('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6d04('0x4'))('rpc');var config=require(_0x6d04('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6d04('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1968c4,_0x4f83bc,_0x569c7b){return new BPromise(function(_0x2e2c01,_0x42aa22){return client['request'](_0x1968c4,_0x569c7b)['then'](function(_0x27a3d6){logger['info'](_0x6d04('0x7'),_0x4f83bc,'request\x20sent');logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x4f83bc,_0x6d04('0x8'),JSON[_0x6d04('0x9')](_0x27a3d6));if(_0x27a3d6[_0x6d04('0xa')]){if(_0x27a3d6[_0x6d04('0xa')]['code']===0x1f4){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x42aa22(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);return _0x2e2c01(_0x27a3d6[_0x6d04('0xa')][_0x6d04('0xb')]);}else{logger[_0x6d04('0xc')](_0x6d04('0x7'),_0x4f83bc,_0x6d04('0x8'));_0x2e2c01(_0x27a3d6[_0x6d04('0xd')][_0x6d04('0xb')]);}})[_0x6d04('0xe')](function(_0xed5538){logger[_0x6d04('0xa')](_0x6d04('0x7'),_0x4f83bc,_0xed5538);_0x42aa22(_0xed5538);});});}exports[_0x6d04('0xf')]=function(_0x2bc798){var _0x3ad325=this;return new Promise(function(_0x4e93b5,_0x3657a1){return db[_0x6d04('0x10')][_0x6d04('0x11')]({'raw':_0x2bc798[_0x6d04('0x12')]?_0x2bc798[_0x6d04('0x12')][_0x6d04('0x13')]===undefined?!![]:![]:!![],'where':_0x2bc798[_0x6d04('0x12')]?_0x2bc798[_0x6d04('0x12')][_0x6d04('0x14')]||null:null,'attributes':_0x2bc798[_0x6d04('0x12')]?_0x2bc798[_0x6d04('0x12')][_0x6d04('0x15')]||null:null,'limit':_0x2bc798[_0x6d04('0x12')]?_0x2bc798['options'][_0x6d04('0x16')]||null:null,'include':_0x2bc798[_0x6d04('0x12')]?_0x2bc798['options']['include']?_[_0x6d04('0x17')](_0x2bc798[_0x6d04('0x12')][_0x6d04('0x18')],function(_0xe8f198){return{'model':db[_0xe8f198[_0x6d04('0x19')]],'as':_0xe8f198['as'],'attributes':_0xe8f198[_0x6d04('0x15')],'include':_0xe8f198[_0x6d04('0x18')]?_[_0x6d04('0x17')](_0xe8f198[_0x6d04('0x18')],function(_0x38e90f){return{'model':db[_0x38e90f[_0x6d04('0x19')]],'as':_0x38e90f['as'],'attributes':_0x38e90f[_0x6d04('0x15')],'include':_0x38e90f[_0x6d04('0x18')]?_[_0x6d04('0x17')](_0x38e90f['include'],function(_0x1dc29b){return{'model':db[_0x1dc29b[_0x6d04('0x19')]],'as':_0x1dc29b['as'],'attributes':_0x1dc29b[_0x6d04('0x15')]};}):[]};}):[]};}):[]:[]})[_0x6d04('0x1a')](function(_0x4256a3){logger[_0x6d04('0xc')]('GetMemberReport',_0x2bc798);logger[_0x6d04('0x1b')](_0x6d04('0xf'),_0x2bc798,JSON[_0x6d04('0x9')](_0x4256a3));_0x4e93b5(_0x4256a3);})[_0x6d04('0xe')](function(_0x2ed2bb){logger['error']('GetMemberReport',_0x2ed2bb['message'],_0x2bc798);_0x3657a1(_0x3ad325['error'](0x1f4,_0x2ed2bb[_0x6d04('0xb')]));});});};exports['CreateMemberReport']=function(_0x43eb48){var _0x4ed123=this;return new Promise(function(_0x26be38,_0xee1291){return db[_0x6d04('0x10')][_0x6d04('0x1c')](_0x43eb48[_0x6d04('0x1d')],{'raw':_0x43eb48[_0x6d04('0x12')]?_0x43eb48[_0x6d04('0x12')][_0x6d04('0x13')]===undefined?!![]:![]:!![]})[_0x6d04('0x1a')](function(_0xff4c36){logger['info']('CreateMemberReport',_0x43eb48);logger[_0x6d04('0x1b')](_0x6d04('0x1e'),_0x43eb48,JSON[_0x6d04('0x9')](_0xff4c36));_0x26be38(_0xff4c36);})[_0x6d04('0xe')](function(_0x592f01){logger[_0x6d04('0xa')](_0x6d04('0x1e'),_0x592f01[_0x6d04('0xb')],_0x43eb48);_0xee1291(_0x4ed123[_0x6d04('0xa')](0x1f4,_0x592f01['message']));});});};exports[_0x6d04('0x1f')]=function(_0x1d86d2){var _0x1e03a4=this;return new Promise(function(_0x184da2,_0x2f59ef){return db[_0x6d04('0x10')][_0x6d04('0x20')](_0x1d86d2[_0x6d04('0x1d')],{'raw':_0x1d86d2[_0x6d04('0x12')]?_0x1d86d2[_0x6d04('0x12')][_0x6d04('0x13')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d86d2[_0x6d04('0x12')]?_0x1d86d2[_0x6d04('0x12')][_0x6d04('0x14')]||null:null,'attributes':_0x1d86d2[_0x6d04('0x12')]?_0x1d86d2['options'][_0x6d04('0x15')]||null:null,'limit':_0x1d86d2['options']?_0x1d86d2[_0x6d04('0x12')][_0x6d04('0x16')]||null:null})['then'](function(_0x39991b){logger[_0x6d04('0xc')](_0x6d04('0x1f'),_0x1d86d2);logger[_0x6d04('0x1b')](_0x6d04('0x1f'),_0x1d86d2,JSON[_0x6d04('0x9')](_0x39991b));_0x184da2(_0x39991b);})[_0x6d04('0xe')](function(_0x1246a7){logger['error'](_0x6d04('0x1f'),_0x1246a7[_0x6d04('0xb')],_0x1d86d2);_0x2f59ef(_0x1e03a4[_0x6d04('0xa')](0x1f4,_0x1246a7[_0x6d04('0xb')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index e737002..99d7f12 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 _0x01aa=['../../components/interaction/service','../../config/environment','get','index','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01aa,0x1ef));var _0xa01a=function(_0x189400,_0x227151){_0x189400=_0x189400-0x0;var _0x4e3626=_0x01aa[_0x189400];return _0x4e3626;};'use strict';var multer=require(_0xa01a('0x0'));var util=require(_0xa01a('0x1'));var path=require('path');var timeout=require(_0xa01a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa01a('0x3'));var auth=require(_0xa01a('0x4'));var interaction=require(_0xa01a('0x5'));var config=require(_0xa01a('0x6'));var controller=require('./migration.controller');router[_0xa01a('0x7')]('/',controller[_0xa01a('0x8')]);module[_0xa01a('0x9')]=router; \ No newline at end of file +var _0x5cae=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','util','path'];(function(_0x4ea417,_0x34c685){var _0x3723a9=function(_0x1d3a21){while(--_0x1d3a21){_0x4ea417['push'](_0x4ea417['shift']());}};_0x3723a9(++_0x34c685);}(_0x5cae,0xb1));var _0xe5ca=function(_0x26d823,_0x3f2031){_0x26d823=_0x26d823-0x0;var _0x5c24b1=_0x5cae[_0x26d823];return _0x5c24b1;};'use strict';var multer=require(_0xe5ca('0x0'));var util=require(_0xe5ca('0x1'));var path=require(_0xe5ca('0x2'));var timeout=require('connect-timeout');var express=require(_0xe5ca('0x3'));var router=express[_0xe5ca('0x4')]();var fs_extra=require(_0xe5ca('0x5'));var auth=require(_0xe5ca('0x6'));var interaction=require(_0xe5ca('0x7'));var config=require(_0xe5ca('0x8'));var controller=require(_0xe5ca('0x9'));router[_0xe5ca('0xa')]('/',controller[_0xe5ca('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 259af75..f761a75 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 _0xfc8b=['exports','version'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0xfc8b,0x1a4));var _0xbfc8=function(_0x22e35e,_0x42b21a){_0x22e35e=_0x22e35e-0x0;var _0x496312=_0xfc8b[_0x22e35e];return _0x496312;};'use strict';var Sequelize=require('sequelize');module[_0xbfc8('0x0')]={'version':{'type':Sequelize['STRING'],'unique':_0xbfc8('0x1')}}; \ No newline at end of file +var _0x1f07=['version','STRING'];(function(_0x5b268c,_0x4d9ebc){var _0x4772a1=function(_0x2a8171){while(--_0x2a8171){_0x5b268c['push'](_0x5b268c['shift']());}};_0x4772a1(++_0x4d9ebc);}(_0x1f07,0x109));var _0x71f0=function(_0x4f2551,_0x1e669b){_0x4f2551=_0x4f2551-0x0;var _0x23c222=_0x1f07[_0x4f2551];return _0x23c222;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0x71f0('0x0')],'unique':_0x71f0('0x1')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 73ef419..5c95d8a 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 _0x26d2=['set','Content-Range','apply','reject','save','update','then','destroy','status','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','Migration','includeAll','include','rows','catch','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','limit','count'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x26d2,0xeb));var _0x226d=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x26d2[_0x20ef64];return _0x3707d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x226d('0x0'));var rp=require(_0x226d('0x1'));var moment=require(_0x226d('0x2'));var BPromise=require(_0x226d('0x3'));var Mustache=require(_0x226d('0x4'));var util=require(_0x226d('0x5'));var path=require(_0x226d('0x6'));var sox=require('sox');var csv=require(_0x226d('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x226d('0x8'));var crypto=require('crypto');var jsforce=require(_0x226d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x226d('0x7'));var querystring=require('querystring');var Papa=require(_0x226d('0xa'));var Redis=require(_0x226d('0xb'));var authService=require(_0x226d('0xc'));var qs=require(_0x226d('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x226d('0xe'));var logger=require('../../config/logger')(_0x226d('0xf'));var utils=require(_0x226d('0x10'));var config=require(_0x226d('0x11'));var licenseUtil=require(_0x226d('0x12'));var db=require(_0x226d('0x13'))['db'];function respondWithStatusCode(_0x11fcc3,_0x2de022){_0x2de022=_0x2de022||0xcc;return function(_0x287678){if(_0x287678){return _0x11fcc3['sendStatus'](_0x2de022);}return _0x11fcc3['status'](_0x2de022)[_0x226d('0x14')]();};}function respondWithResult(_0x30f54b,_0x2588ce){_0x2588ce=_0x2588ce||0xc8;return function(_0x361506){if(_0x361506){return _0x30f54b['status'](_0x2588ce)[_0x226d('0x15')](_0x361506);}};}function respondWithFilteredResult(_0x8284a6,_0xdeaffb){return function(_0xb9754f){if(_0xb9754f){var _0x5bc735=typeof _0xdeaffb['offset']===_0x226d('0x16')&&typeof _0xdeaffb[_0x226d('0x17')]===_0x226d('0x16');var _0x144c2a=_0xb9754f[_0x226d('0x18')];var _0x53293b=_0x5bc735?0x0:_0xdeaffb['offset'];var _0x2747c4=_0x5bc735?_0xb9754f[_0x226d('0x18')]:_0xdeaffb['offset']+_0xdeaffb[_0x226d('0x17')];var _0x95a7c3;if(_0x2747c4>=_0x144c2a){_0x2747c4=_0x144c2a;_0x95a7c3=0xc8;}else{_0x95a7c3=0xce;}_0x8284a6['status'](_0x95a7c3);return _0x8284a6[_0x226d('0x19')](_0x226d('0x1a'),_0x53293b+'-'+_0x2747c4+'/'+_0x144c2a)[_0x226d('0x15')](_0xb9754f);}return null;};}function patchUpdates(_0x249314){return function(_0x56c3af){try{jsonpatch[_0x226d('0x1b')](_0x56c3af,_0x249314,!![]);}catch(_0x1c6030){return BPromise[_0x226d('0x1c')](_0x1c6030);}return _0x56c3af[_0x226d('0x1d')]();};}function saveUpdates(_0x2073d6,_0x25a2c2){return function(_0x1f0df3){if(_0x1f0df3){return _0x1f0df3[_0x226d('0x1e')](_0x2073d6)[_0x226d('0x1f')](function(_0x23168b){return _0x23168b;});}return null;};}function removeEntity(_0x595d77,_0x173aff){return function(_0x52b0cf){if(_0x52b0cf){return _0x52b0cf[_0x226d('0x20')]()[_0x226d('0x1f')](function(){_0x595d77[_0x226d('0x21')](0xcc)[_0x226d('0x14')]();});}};}function handleEntityNotFound(_0x3d2df1,_0x5d78a4){return function(_0x492fbd){if(!_0x492fbd){_0x3d2df1[_0x226d('0x22')](0x194);}return _0x492fbd;};}function handleError(_0x1057cf,_0x57f017){_0x57f017=_0x57f017||0x1f4;return function(_0x104404){logger['error'](_0x104404['stack']);if(_0x104404[_0x226d('0x23')]){delete _0x104404['name'];}_0x1057cf[_0x226d('0x21')](_0x57f017)[_0x226d('0x24')](_0x104404);};}exports[_0x226d('0x25')]=function(_0xda6575,_0x24e27a){var _0x13a47f={},_0x298557={},_0x39f31b={'count':0x0,'rows':[]};var _0x6edf=_[_0x226d('0x26')](db['Migration'][_0x226d('0x27')],function(_0x568abc){return{'name':_0x568abc[_0x226d('0x28')],'type':_0x568abc[_0x226d('0x29')][_0x226d('0x2a')]};});_0x298557['model']=_['map'](_0x6edf,_0x226d('0x23'));_0x298557[_0x226d('0x2b')]=_[_0x226d('0x2c')](_0xda6575[_0x226d('0x2b')]);_0x298557[_0x226d('0x2d')]=_[_0x226d('0x2e')](_0x298557[_0x226d('0x2f')],_0x298557[_0x226d('0x2b')]);_0x13a47f[_0x226d('0x30')]=_[_0x226d('0x2e')](_0x298557[_0x226d('0x2f')],qs[_0x226d('0x31')](_0xda6575['query'][_0x226d('0x31')]));_0x13a47f[_0x226d('0x30')]=_0x13a47f[_0x226d('0x30')][_0x226d('0x32')]?_0x13a47f[_0x226d('0x30')]:_0x298557[_0x226d('0x2f')];if(!_0xda6575[_0x226d('0x2b')]['hasOwnProperty'](_0x226d('0x33'))){_0x13a47f['limit']=qs[_0x226d('0x17')](_0xda6575['query'][_0x226d('0x17')]);_0x13a47f[_0x226d('0x34')]=qs[_0x226d('0x34')](_0xda6575[_0x226d('0x2b')]['offset']);}_0x13a47f[_0x226d('0x35')]=qs['sort'](_0xda6575['query'][_0x226d('0x36')]);_0x13a47f[_0x226d('0x37')]=qs[_0x226d('0x2d')](_[_0x226d('0x38')](_0xda6575['query'],_0x298557[_0x226d('0x2d')]),_0x6edf);if(_0xda6575[_0x226d('0x2b')][_0x226d('0x39')]){_0x13a47f['where']=_[_0x226d('0x3a')](_0x13a47f['where'],{'$or':_[_0x226d('0x26')](_0x6edf,function(_0x5439ea){if(_0x5439ea[_0x226d('0x29')]!==_0x226d('0x3b')){var _0x190788={};_0x190788[_0x5439ea['name']]={'$like':'%'+_0xda6575[_0x226d('0x2b')][_0x226d('0x39')]+'%'};return _0x190788;}})});}_0x13a47f=_[_0x226d('0x3a')]({},_0x13a47f,_0xda6575['options']);var _0x5dacc2={'where':_0x13a47f[_0x226d('0x37')]};return db[_0x226d('0x3c')][_0x226d('0x18')](_0x5dacc2)[_0x226d('0x1f')](function(_0x4a5ac5){_0x39f31b[_0x226d('0x18')]=_0x4a5ac5;if(_0xda6575[_0x226d('0x2b')][_0x226d('0x3d')]){_0x13a47f[_0x226d('0x3e')]=[{'all':!![]}];}return db[_0x226d('0x3c')]['findAll'](_0x13a47f);})['then'](function(_0x199f9f){_0x39f31b[_0x226d('0x3f')]=_0x199f9f;return _0x39f31b;})[_0x226d('0x1f')](respondWithFilteredResult(_0x24e27a,_0x13a47f))[_0x226d('0x40')](handleError(_0x24e27a,null));}; \ No newline at end of file +var _0xcfce=['catch','eml-format','zip-dir','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','status','error','stack','name','send','index','map','Migration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xcfce,0x187));var _0xecfc=function(_0x36940e,_0x11f338){_0x36940e=_0x36940e-0x0;var _0x3283f2=_0xcfce[_0x36940e];return _0x3283f2;};'use strict';var emlformat=require(_0xecfc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xecfc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xecfc('0x2'));var moment=require('moment');var BPromise=require(_0xecfc('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xecfc('0x4'));var sox=require('sox');var csv=require(_0xecfc('0x5'));var ejs=require(_0xecfc('0x6'));var fs=require('fs');var fs_extra=require(_0xecfc('0x7'));var _=require(_0xecfc('0x8'));var squel=require(_0xecfc('0x9'));var crypto=require(_0xecfc('0xa'));var jsforce=require(_0xecfc('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xecfc('0x5'));var querystring=require(_0xecfc('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xecfc('0xd'));var qs=require(_0xecfc('0xe'));var as=require(_0xecfc('0xf'));var hardwareService=require(_0xecfc('0x10'));var logger=require('../../config/logger')(_0xecfc('0x11'));var utils=require(_0xecfc('0x12'));var config=require(_0xecfc('0x13'));var licenseUtil=require(_0xecfc('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x125a8a,_0x5a0e89){_0x5a0e89=_0x5a0e89||0xcc;return function(_0xd6cf03){if(_0xd6cf03){return _0x125a8a[_0xecfc('0x15')](_0x5a0e89);}return _0x125a8a['status'](_0x5a0e89)['end']();};}function respondWithResult(_0x1e046f,_0x43364b){_0x43364b=_0x43364b||0xc8;return function(_0x16ee36){if(_0x16ee36){return _0x1e046f['status'](_0x43364b)[_0xecfc('0x16')](_0x16ee36);}};}function respondWithFilteredResult(_0x547b00,_0xb52d03){return function(_0x383528){if(_0x383528){var _0x25f173=typeof _0xb52d03[_0xecfc('0x17')]===_0xecfc('0x18')&&typeof _0xb52d03[_0xecfc('0x19')]==='undefined';var _0x4dff5c=_0x383528['count'];var _0x16485b=_0x25f173?0x0:_0xb52d03[_0xecfc('0x17')];var _0xf16db4=_0x25f173?_0x383528[_0xecfc('0x1a')]:_0xb52d03[_0xecfc('0x17')]+_0xb52d03[_0xecfc('0x19')];var _0x1a27f9;if(_0xf16db4>=_0x4dff5c){_0xf16db4=_0x4dff5c;_0x1a27f9=0xc8;}else{_0x1a27f9=0xce;}_0x547b00['status'](_0x1a27f9);return _0x547b00[_0xecfc('0x1b')]('Content-Range',_0x16485b+'-'+_0xf16db4+'/'+_0x4dff5c)['json'](_0x383528);}return null;};}function patchUpdates(_0xfe4ca8){return function(_0x481762){try{jsonpatch[_0xecfc('0x1c')](_0x481762,_0xfe4ca8,!![]);}catch(_0x35a8f8){return BPromise[_0xecfc('0x1d')](_0x35a8f8);}return _0x481762[_0xecfc('0x1e')]();};}function saveUpdates(_0x2529ac,_0x139dd3){return function(_0x453153){if(_0x453153){return _0x453153[_0xecfc('0x1f')](_0x2529ac)['then'](function(_0x496a34){return _0x496a34;});}return null;};}function removeEntity(_0x51be10,_0x18f30b){return function(_0x48dcbb){if(_0x48dcbb){return _0x48dcbb[_0xecfc('0x20')]()[_0xecfc('0x21')](function(){_0x51be10[_0xecfc('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41a98d,_0x21b76b){return function(_0x580c64){if(!_0x580c64){_0x41a98d[_0xecfc('0x15')](0x194);}return _0x580c64;};}function handleError(_0x2762c9,_0x8e2347){_0x8e2347=_0x8e2347||0x1f4;return function(_0x208e1d){logger[_0xecfc('0x23')](_0x208e1d[_0xecfc('0x24')]);if(_0x208e1d[_0xecfc('0x25')]){delete _0x208e1d['name'];}_0x2762c9[_0xecfc('0x22')](_0x8e2347)[_0xecfc('0x26')](_0x208e1d);};}exports[_0xecfc('0x27')]=function(_0x34a29e,_0x5e6f03){var _0x321251={},_0x9b936c={},_0xc055f7={'count':0x0,'rows':[]};var _0x2e078c=_[_0xecfc('0x28')](db[_0xecfc('0x29')][_0xecfc('0x2a')],function(_0x53d1fd){return{'name':_0x53d1fd[_0xecfc('0x2b')],'type':_0x53d1fd[_0xecfc('0x2c')]['key']};});_0x9b936c[_0xecfc('0x2d')]=_['map'](_0x2e078c,_0xecfc('0x25'));_0x9b936c[_0xecfc('0x2e')]=_['keys'](_0x34a29e[_0xecfc('0x2e')]);_0x9b936c[_0xecfc('0x2f')]=_[_0xecfc('0x30')](_0x9b936c['model'],_0x9b936c[_0xecfc('0x2e')]);_0x321251[_0xecfc('0x31')]=_[_0xecfc('0x30')](_0x9b936c[_0xecfc('0x2d')],qs[_0xecfc('0x32')](_0x34a29e['query'][_0xecfc('0x32')]));_0x321251['attributes']=_0x321251['attributes'][_0xecfc('0x33')]?_0x321251[_0xecfc('0x31')]:_0x9b936c[_0xecfc('0x2d')];if(!_0x34a29e[_0xecfc('0x2e')][_0xecfc('0x34')]('nolimit')){_0x321251['limit']=qs[_0xecfc('0x19')](_0x34a29e[_0xecfc('0x2e')][_0xecfc('0x19')]);_0x321251[_0xecfc('0x17')]=qs[_0xecfc('0x17')](_0x34a29e[_0xecfc('0x2e')]['offset']);}_0x321251[_0xecfc('0x35')]=qs[_0xecfc('0x36')](_0x34a29e['query']['sort']);_0x321251[_0xecfc('0x37')]=qs[_0xecfc('0x2f')](_[_0xecfc('0x38')](_0x34a29e[_0xecfc('0x2e')],_0x9b936c[_0xecfc('0x2f')]),_0x2e078c);if(_0x34a29e[_0xecfc('0x2e')][_0xecfc('0x39')]){_0x321251[_0xecfc('0x37')]=_[_0xecfc('0x3a')](_0x321251[_0xecfc('0x37')],{'$or':_[_0xecfc('0x28')](_0x2e078c,function(_0x966afc){if(_0x966afc[_0xecfc('0x2c')]!==_0xecfc('0x3b')){var _0xef22ba={};_0xef22ba[_0x966afc[_0xecfc('0x25')]]={'$like':'%'+_0x34a29e[_0xecfc('0x2e')][_0xecfc('0x39')]+'%'};return _0xef22ba;}})});}_0x321251=_[_0xecfc('0x3a')]({},_0x321251,_0x34a29e['options']);var _0x2d1587={'where':_0x321251[_0xecfc('0x37')]};return db[_0xecfc('0x29')]['count'](_0x2d1587)[_0xecfc('0x21')](function(_0x25fd5b){_0xc055f7[_0xecfc('0x1a')]=_0x25fd5b;if(_0x34a29e[_0xecfc('0x2e')][_0xecfc('0x3c')]){_0x321251[_0xecfc('0x3d')]=[{'all':!![]}];}return db['Migration'][_0xecfc('0x3e')](_0x321251);})[_0xecfc('0x21')](function(_0x4e1f88){_0xc055f7[_0xecfc('0x3f')]=_0x4e1f88;return _0xc055f7;})[_0xecfc('0x21')](respondWithFilteredResult(_0x5e6f03,_0x321251))[_0xecfc('0x40')](handleError(_0x5e6f03,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index b40cd71..5f98634 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 _0xe64a=['bluebird','./migration.attributes','Migration','migrations','lodash','util','../../config/logger','api','moment'];(function(_0x526729,_0x2156b0){var _0x1b4fb3=function(_0xf786fd){while(--_0xf786fd){_0x526729['push'](_0x526729['shift']());}};_0x1b4fb3(++_0x2156b0);}(_0xe64a,0x1d8));var _0xae64=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe64a[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var logger=require(_0xae64('0x2'))(_0xae64('0x3'));var moment=require(_0xae64('0x4'));var BPromise=require(_0xae64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xae64('0x6'));module['exports']=function(_0x23974b,_0x32af29){return _0x23974b['define'](_0xae64('0x7'),attributes,{'tableName':_0xae64('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4aa=['exports','Migration','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb4aa,0xad));var _0xab4a=function(_0x3d47ec,_0x45ef81){_0x3d47ec=_0x3d47ec-0x0;var _0x2000e4=_0xb4aa[_0x3d47ec];return _0x2000e4;};'use strict';var _=require('lodash');var util=require(_0xab4a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xab4a('0x1'));var BPromise=require(_0xab4a('0x2'));var rp=require(_0xab4a('0x3'));var fs=require('fs');var path=require(_0xab4a('0x4'));var rimraf=require(_0xab4a('0x5'));var config=require(_0xab4a('0x6'));var attributes=require('./migration.attributes');module[_0xab4a('0x7')]=function(_0x1f94f1,_0x477cc6){return _0x1f94f1['define'](_0xab4a('0x8'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index 32cff04..65b297f 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 _0x559a=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x5d3369,_0xe47921){var _0x51c215=function(_0x24c0f1){while(--_0x24c0f1){_0x5d3369['push'](_0x5d3369['shift']());}};_0x51c215(++_0xe47921);}(_0x559a,0xb3));var _0xa559=function(_0x237210,_0x170cc8){_0x237210=_0x237210-0x0;var _0x278fc0=_0x559a[_0x237210];return _0x278fc0;};'use strict';var _=require(_0xa559('0x0'));var util=require(_0xa559('0x1'));var moment=require('moment');var BPromise=require(_0xa559('0x2'));var rs=require(_0xa559('0x3'));var fs=require('fs');var Redis=require(_0xa559('0x4'));var db=require(_0xa559('0x5'))['db'];var utils=require(_0xa559('0x6'));var logger=require(_0xa559('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa559('0x8'));var client=jayson[_0xa559('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2edab4,_0x1a5cec,_0x4eada1){return new BPromise(function(_0xb8055,_0x218e3b){return client[_0xa559('0xa')](_0x2edab4,_0x4eada1)[_0xa559('0xb')](function(_0x48aa9a){logger[_0xa559('0xc')](_0xa559('0xd'),_0x1a5cec,_0xa559('0xe'));logger[_0xa559('0xf')]('Migration,\x20%s,\x20%s,\x20%s',_0x1a5cec,'request\x20sent',JSON[_0xa559('0x10')](_0x48aa9a));if(_0x48aa9a[_0xa559('0x11')]){if(_0x48aa9a['error'][_0xa559('0x12')]===0x1f4){logger['error'](_0xa559('0xd'),_0x1a5cec,_0x48aa9a['error'][_0xa559('0x13')]);return _0x218e3b(_0x48aa9a[_0xa559('0x11')][_0xa559('0x13')]);}logger['error'](_0xa559('0xd'),_0x1a5cec,_0x48aa9a[_0xa559('0x11')]['message']);return _0xb8055(_0x48aa9a[_0xa559('0x11')][_0xa559('0x13')]);}else{logger[_0xa559('0xc')](_0xa559('0xd'),_0x1a5cec,'request\x20sent');_0xb8055(_0x48aa9a[_0xa559('0x14')]['message']);}})[_0xa559('0x15')](function(_0x1387b6){logger['error'](_0xa559('0xd'),_0x1a5cec,_0x1387b6);_0x218e3b(_0x1387b6);});});} \ No newline at end of file +var _0xb48d=['Migration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s'];(function(_0xbca15c,_0x5ac4cc){var _0x2f2a88=function(_0x1ab4b6){while(--_0x1ab4b6){_0xbca15c['push'](_0xbca15c['shift']());}};_0x2f2a88(++_0x5ac4cc);}(_0xb48d,0x194));var _0xdb48=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb48d[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0xdb48('0x0'));var util=require('util');var moment=require(_0xdb48('0x1'));var BPromise=require('bluebird');var rs=require(_0xdb48('0x2'));var fs=require('fs');var Redis=require(_0xdb48('0x3'));var db=require(_0xdb48('0x4'))['db'];var utils=require(_0xdb48('0x5'));var logger=require('../../config/logger')(_0xdb48('0x6'));var config=require('../../config/environment');var jayson=require(_0xdb48('0x7'));var client=jayson[_0xdb48('0x8')][_0xdb48('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5db721,_0x4e834c,_0x251ce5){return new BPromise(function(_0x173933,_0x5f2b47){return client[_0xdb48('0xa')](_0x5db721,_0x251ce5)[_0xdb48('0xb')](function(_0x4ddac8){logger[_0xdb48('0xc')](_0xdb48('0xd'),_0x4e834c,'request\x20sent');logger['debug'](_0xdb48('0xe'),_0x4e834c,_0xdb48('0xf'),JSON[_0xdb48('0x10')](_0x4ddac8));if(_0x4ddac8['error']){if(_0x4ddac8[_0xdb48('0x11')][_0xdb48('0x12')]===0x1f4){logger['error'](_0xdb48('0xd'),_0x4e834c,_0x4ddac8[_0xdb48('0x11')][_0xdb48('0x13')]);return _0x5f2b47(_0x4ddac8[_0xdb48('0x11')][_0xdb48('0x13')]);}logger[_0xdb48('0x11')]('Migration,\x20%s,\x20%s',_0x4e834c,_0x4ddac8[_0xdb48('0x11')][_0xdb48('0x13')]);return _0x173933(_0x4ddac8[_0xdb48('0x11')]['message']);}else{logger[_0xdb48('0xc')]('Migration,\x20%s,\x20%s',_0x4e834c,_0xdb48('0xf'));_0x173933(_0x4ddac8[_0xdb48('0x14')][_0xdb48('0x13')]);}})[_0xdb48('0x15')](function(_0x43c3ad){logger['error']('Migration,\x20%s,\x20%s',_0x4e834c,_0x43c3ad);_0x5f2b47(_0x43c3ad);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 8d17113..d309f91 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 _0x1b64=['index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated'];(function(_0xe8a634,_0x37d81f){var _0x564614=function(_0x271255){while(--_0x271255){_0xe8a634['push'](_0xe8a634['shift']());}};_0x564614(++_0x37d81f);}(_0x1b64,0x76));var _0x41b6=function(_0xb12533,_0x4a5dbb){_0xb12533=_0xb12533-0x0;var _0x3f1c6f=_0x1b64[_0xb12533];return _0x3f1c6f;};'use strict';var multer=require(_0x41b6('0x0'));var util=require(_0x41b6('0x1'));var path=require('path');var timeout=require(_0x41b6('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x41b6('0x3'));var interaction=require(_0x41b6('0x4'));var config=require(_0x41b6('0x5'));var controller=require(_0x41b6('0x6'));router['get']('/',auth[_0x41b6('0x7')](),controller[_0x41b6('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x41b6('0x9')]);router[_0x41b6('0xa')]('/',auth[_0x41b6('0x7')](),controller[_0x41b6('0xb')]);router[_0x41b6('0xc')](_0x41b6('0xd'),auth['isAuthenticated'](),controller[_0x41b6('0xe')]);router[_0x41b6('0xf')](_0x41b6('0xd'),auth[_0x41b6('0x7')](),controller[_0x41b6('0x10')]);module[_0x41b6('0x11')]=router; \ No newline at end of file +var _0x682b=['exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','post','update','delete','destroy'];(function(_0x246f52,_0x1a63ab){var _0x4d1abe=function(_0x1f7f23){while(--_0x1f7f23){_0x246f52['push'](_0x246f52['shift']());}};_0x4d1abe(++_0x1a63ab);}(_0x682b,0x1e1));var _0xb682=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x682b[_0x13b8f3];return _0x1a6d06;};'use strict';var multer=require(_0xb682('0x0'));var util=require(_0xb682('0x1'));var path=require('path');var timeout=require(_0xb682('0x2'));var express=require('express');var router=express[_0xb682('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb682('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb682('0x5'));var controller=require(_0xb682('0x6'));router[_0xb682('0x7')]('/',auth[_0xb682('0x8')](),controller['index']);router[_0xb682('0x7')](_0xb682('0x9'),auth[_0xb682('0x8')](),controller['show']);router[_0xb682('0xa')]('/',auth[_0xb682('0x8')](),controller['create']);router['put'](_0xb682('0x9'),auth['isAuthenticated'](),controller[_0xb682('0xb')]);router[_0xb682('0xc')](_0xb682('0x9'),auth[_0xb682('0x8')](),controller[_0xb682('0xd')]);module[_0xb682('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d4888f9..04b27e0 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 _0xfd9c=['turn','STRING','sequelize','ENUM','localnet','externip','stun'];(function(_0x2829ea,_0xe11bbd){var _0x59c50c=function(_0x3f5caa){while(--_0x3f5caa){_0x2829ea['push'](_0x2829ea['shift']());}};_0x59c50c(++_0xe11bbd);}(_0xfd9c,0x6b));var _0xcfd9=function(_0x4bcf38,_0x3c12be){_0x4bcf38=_0x4bcf38-0x0;var _0x4a89be=_0xfd9c[_0x4bcf38];return _0x4a89be;};'use strict';var Sequelize=require(_0xcfd9('0x0'));module['exports']={'type':{'type':Sequelize[_0xcfd9('0x1')](_0xcfd9('0x2'),_0xcfd9('0x3'),_0xcfd9('0x4'),_0xcfd9('0x5'))},'value':{'type':Sequelize[_0xcfd9('0x6')]},'username':{'type':Sequelize[_0xcfd9('0x6')]},'password':{'type':Sequelize[_0xcfd9('0x6')]}}; \ No newline at end of file +var _0x62c7=['exports','ENUM','localnet','externip','stun','turn','STRING'];(function(_0x15ecac,_0x201875){var _0x20aad2=function(_0x34d996){while(--_0x34d996){_0x15ecac['push'](_0x15ecac['shift']());}};_0x20aad2(++_0x201875);}(_0x62c7,0xd2));var _0x762c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x62c7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x762c('0x0')]={'type':{'type':Sequelize[_0x762c('0x1')](_0x762c('0x2'),_0x762c('0x3'),_0x762c('0x4'),_0x762c('0x5'))},'value':{'type':Sequelize[_0x762c('0x6')]},'username':{'type':Sequelize[_0x762c('0x6')]},'password':{'type':Sequelize[_0x762c('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 667986f..3b74c48 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 _0xea04=['save','then','destroy','sendStatus','stack','name','Network','fieldName','type','key','model','map','query','filters','intersection','attributes','length','order','sort','where','filter','VIRTUAL','options','includeAll','findAll','keys','rawAttributes','fields','include','merge','find','create','transaction','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','res_stun_monitor.so','readFileSync','server/files/templates/turn_multiple.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','sequelize','params','/etc/asterisk/stun_xcally.conf','update','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','catch','status','end','offset','undefined','limit','count','set','Content-Range','json'];(function(_0xcda0c3,_0x36be80){var _0x28a157=function(_0x4d8923){while(--_0x4d8923){_0xcda0c3['push'](_0xcda0c3['shift']());}};_0x28a157(++_0x36be80);}(_0xea04,0x1d1));var _0x4ea0=function(_0xdb357c,_0x3786b6){_0xdb357c=_0xdb357c-0x0;var _0x5c8735=_0xea04[_0xdb357c];return _0x5c8735;};'use strict';var emlformat=require(_0x4ea0('0x0'));var rimraf=require(_0x4ea0('0x1'));var zipdir=require(_0x4ea0('0x2'));var jsonpatch=require(_0x4ea0('0x3'));var rp=require('request-promise');var moment=require(_0x4ea0('0x4'));var BPromise=require(_0x4ea0('0x5'));var Mustache=require(_0x4ea0('0x6'));var util=require(_0x4ea0('0x7'));var path=require(_0x4ea0('0x8'));var sox=require('sox');var csv=require(_0x4ea0('0x9'));var ejs=require(_0x4ea0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ea0('0xb'));var squel=require('squel');var crypto=require(_0x4ea0('0xc'));var jsforce=require(_0x4ea0('0xd'));var deskjs=require(_0x4ea0('0xe'));var toCsv=require(_0x4ea0('0x9'));var querystring=require('querystring');var Papa=require(_0x4ea0('0xf'));var Redis=require(_0x4ea0('0x10'));var authService=require(_0x4ea0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4ea0('0x12'));var hardwareService=require(_0x4ea0('0x13'));var logger=require(_0x4ea0('0x14'))('api');var utils=require(_0x4ea0('0x15'));var config=require(_0x4ea0('0x16'));var licenseUtil=require(_0x4ea0('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4ea0('0x18'));var client=jayson[_0x4ea0('0x19')][_0x4ea0('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2bf11e,_0x376dc1,_0x1f7ab0,_0x55077a){return new BPromise(function(_0x4a0c31,_0x53595e){var _0x1e861a=_0x55077a||client;return _0x1e861a[_0x4ea0('0x1b')](_0x2bf11e,_0x1f7ab0)['then'](function(_0x38efa7){logger[_0x4ea0('0x1c')]('Network,\x20%s,\x20%s',_0x376dc1,_0x4ea0('0x1d'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x376dc1,_0x4ea0('0x1d'),JSON[_0x4ea0('0x1e')](_0x38efa7));if(_0x38efa7['error']){if(_0x38efa7[_0x4ea0('0x1f')][_0x4ea0('0x20')]===0x1f4){logger[_0x4ea0('0x1f')](_0x4ea0('0x21'),_0x376dc1,_0x38efa7[_0x4ea0('0x1f')][_0x4ea0('0x22')]);return _0x53595e(_0x38efa7[_0x4ea0('0x1f')][_0x4ea0('0x22')]);}logger['error'](_0x4ea0('0x21'),_0x376dc1,_0x38efa7[_0x4ea0('0x1f')][_0x4ea0('0x22')]);return _0x4a0c31(_0x38efa7['error'][_0x4ea0('0x22')]);}else{logger[_0x4ea0('0x1c')](_0x4ea0('0x21'),_0x376dc1,_0x4ea0('0x1d'));_0x4a0c31(_0x38efa7['result']['message']);}})[_0x4ea0('0x23')](function(_0xf41be4){logger[_0x4ea0('0x1f')](_0x4ea0('0x21'),_0x376dc1,_0xf41be4);_0x53595e(_0xf41be4);});});}function respondWithStatusCode(_0x1d8233,_0x2d1e83){_0x2d1e83=_0x2d1e83||0xcc;return function(_0x5d6b23){if(_0x5d6b23){return _0x1d8233['sendStatus'](_0x2d1e83);}return _0x1d8233[_0x4ea0('0x24')](_0x2d1e83)[_0x4ea0('0x25')]();};}function respondWithResult(_0x3e7365,_0x5baa26){_0x5baa26=_0x5baa26||0xc8;return function(_0x5bb17d){if(_0x5bb17d){return _0x3e7365['status'](_0x5baa26)['json'](_0x5bb17d);}};}function respondWithFilteredResult(_0x5db2b1,_0x514c11){return function(_0x233a72){if(_0x233a72){var _0x239cb4=typeof _0x514c11[_0x4ea0('0x26')]===_0x4ea0('0x27')&&typeof _0x514c11[_0x4ea0('0x28')]===_0x4ea0('0x27');var _0x152e12=_0x233a72[_0x4ea0('0x29')];var _0x1c574d=_0x239cb4?0x0:_0x514c11['offset'];var _0x4b8718=_0x239cb4?_0x233a72[_0x4ea0('0x29')]:_0x514c11[_0x4ea0('0x26')]+_0x514c11[_0x4ea0('0x28')];var _0x24ad72;if(_0x4b8718>=_0x152e12){_0x4b8718=_0x152e12;_0x24ad72=0xc8;}else{_0x24ad72=0xce;}_0x5db2b1[_0x4ea0('0x24')](_0x24ad72);return _0x5db2b1[_0x4ea0('0x2a')](_0x4ea0('0x2b'),_0x1c574d+'-'+_0x4b8718+'/'+_0x152e12)[_0x4ea0('0x2c')](_0x233a72);}return null;};}function patchUpdates(_0xf61ea7){return function(_0x361422){try{jsonpatch['apply'](_0x361422,_0xf61ea7,!![]);}catch(_0xbfe7c){return BPromise['reject'](_0xbfe7c);}return _0x361422[_0x4ea0('0x2d')]();};}function saveUpdates(_0x228353,_0x42cbe7){return function(_0x51082e){if(_0x51082e){return _0x51082e['update'](_0x228353)[_0x4ea0('0x2e')](function(_0x49bdc5){return _0x49bdc5;});}return null;};}function removeEntity(_0xf0885a,_0x645ab8){return function(_0x2b9579){if(_0x2b9579){return _0x2b9579[_0x4ea0('0x2f')]()[_0x4ea0('0x2e')](function(){_0xf0885a[_0x4ea0('0x24')](0xcc)[_0x4ea0('0x25')]();});}};}function handleEntityNotFound(_0x53099d,_0x525c55){return function(_0x53ac3e){if(!_0x53ac3e){_0x53099d[_0x4ea0('0x30')](0x194);}return _0x53ac3e;};}function handleError(_0x885bb,_0x275083){_0x275083=_0x275083||0x1f4;return function(_0x5857a4){logger['error'](_0x5857a4[_0x4ea0('0x31')]);if(_0x5857a4['name']){delete _0x5857a4[_0x4ea0('0x32')];}_0x885bb[_0x4ea0('0x24')](_0x275083)['send'](_0x5857a4);};}exports['index']=function(_0x3a793d,_0x2f1c8b){var _0x2bea3b={},_0x41df2e={},_0x3de98a={'count':0x0,'rows':[]};var _0x457555=_['map'](db[_0x4ea0('0x33')]['rawAttributes'],function(_0x4a51d7){return{'name':_0x4a51d7[_0x4ea0('0x34')],'type':_0x4a51d7[_0x4ea0('0x35')][_0x4ea0('0x36')]};});_0x41df2e[_0x4ea0('0x37')]=_[_0x4ea0('0x38')](_0x457555,_0x4ea0('0x32'));_0x41df2e[_0x4ea0('0x39')]=_['keys'](_0x3a793d[_0x4ea0('0x39')]);_0x41df2e[_0x4ea0('0x3a')]=_[_0x4ea0('0x3b')](_0x41df2e['model'],_0x41df2e['query']);_0x2bea3b['attributes']=_[_0x4ea0('0x3b')](_0x41df2e[_0x4ea0('0x37')],qs['fields'](_0x3a793d[_0x4ea0('0x39')]['fields']));_0x2bea3b[_0x4ea0('0x3c')]=_0x2bea3b['attributes'][_0x4ea0('0x3d')]?_0x2bea3b[_0x4ea0('0x3c')]:_0x41df2e[_0x4ea0('0x37')];if(!_0x3a793d[_0x4ea0('0x39')]['hasOwnProperty']('nolimit')){_0x2bea3b['limit']=qs[_0x4ea0('0x28')](_0x3a793d['query']['limit']);_0x2bea3b[_0x4ea0('0x26')]=qs[_0x4ea0('0x26')](_0x3a793d[_0x4ea0('0x39')][_0x4ea0('0x26')]);}_0x2bea3b[_0x4ea0('0x3e')]=qs[_0x4ea0('0x3f')](_0x3a793d[_0x4ea0('0x39')][_0x4ea0('0x3f')]);_0x2bea3b[_0x4ea0('0x40')]=qs[_0x4ea0('0x3a')](_['pick'](_0x3a793d['query'],_0x41df2e['filters']),_0x457555);if(_0x3a793d[_0x4ea0('0x39')][_0x4ea0('0x41')]){_0x2bea3b['where']=_['merge'](_0x2bea3b[_0x4ea0('0x40')],{'$or':_['map'](_0x457555,function(_0x23f6b6){if(_0x23f6b6[_0x4ea0('0x35')]!==_0x4ea0('0x42')){var _0x2aa708={};_0x2aa708[_0x23f6b6['name']]={'$like':'%'+_0x3a793d['query'][_0x4ea0('0x41')]+'%'};return _0x2aa708;}})});}_0x2bea3b=_['merge']({},_0x2bea3b,_0x3a793d[_0x4ea0('0x43')]);var _0x1aabb7={'where':_0x2bea3b[_0x4ea0('0x40')]};return db[_0x4ea0('0x33')][_0x4ea0('0x29')](_0x1aabb7)['then'](function(_0x3ba8bf){_0x3de98a[_0x4ea0('0x29')]=_0x3ba8bf;if(_0x3a793d[_0x4ea0('0x39')][_0x4ea0('0x44')]){_0x2bea3b['include']=[{'all':!![]}];}return db[_0x4ea0('0x33')][_0x4ea0('0x45')](_0x2bea3b);})[_0x4ea0('0x2e')](function(_0x37d7fe){_0x3de98a['rows']=_0x37d7fe;return _0x3de98a;})[_0x4ea0('0x2e')](respondWithFilteredResult(_0x2f1c8b,_0x2bea3b))['catch'](handleError(_0x2f1c8b,null));};exports['show']=function(_0x56c173,_0x10318c){var _0x4c02c4={'raw':!![],'where':{'id':_0x56c173['params']['id']}},_0x2b07c1={};_0x2b07c1['model']=_[_0x4ea0('0x46')](db[_0x4ea0('0x33')][_0x4ea0('0x47')]);_0x2b07c1[_0x4ea0('0x39')]=_[_0x4ea0('0x46')](_0x56c173[_0x4ea0('0x39')]);_0x2b07c1[_0x4ea0('0x3a')]=_['intersection'](_0x2b07c1['model'],_0x2b07c1[_0x4ea0('0x39')]);_0x4c02c4[_0x4ea0('0x3c')]=_[_0x4ea0('0x3b')](_0x2b07c1[_0x4ea0('0x37')],qs[_0x4ea0('0x48')](_0x56c173[_0x4ea0('0x39')][_0x4ea0('0x48')]));_0x4c02c4[_0x4ea0('0x3c')]=_0x4c02c4['attributes'][_0x4ea0('0x3d')]?_0x4c02c4[_0x4ea0('0x3c')]:_0x2b07c1['model'];if(_0x56c173[_0x4ea0('0x39')]['includeAll']){_0x4c02c4[_0x4ea0('0x49')]=[{'all':!![]}];}_0x4c02c4=_[_0x4ea0('0x4a')]({},_0x4c02c4,_0x56c173[_0x4ea0('0x43')]);return db[_0x4ea0('0x33')][_0x4ea0('0x4b')](_0x4c02c4)[_0x4ea0('0x2e')](handleEntityNotFound(_0x10318c,null))['then'](respondWithResult(_0x10318c,null))[_0x4ea0('0x23')](handleError(_0x10318c,null));};exports[_0x4ea0('0x4c')]=function(_0x468149,_0xca0157,_0x333cc4){var _0x716bbe;return db['sequelize'][_0x4ea0('0x4d')](function(_0x45058d){return db[_0x4ea0('0x33')][_0x4ea0('0x4c')](_0x468149[_0x4ea0('0x4e')],{'raw':!![]})[_0x4ea0('0x2e')](function(_0x5af59b){_0x716bbe=_0x5af59b;return db[_0x4ea0('0x33')]['findAll']({'where':{'type':_0x468149['body'][_0x4ea0('0x35')]},'raw':!![]});})['then'](function(_0x336c90){if(_0x716bbe['type'][_0x4ea0('0x4f')]()==_0x4ea0('0x50')){var _0x56501f=fs['readFileSync'](path[_0x4ea0('0x51')](config[_0x4ea0('0x52')],_0x4ea0('0x53')),_0x4ea0('0x54'));var _0x3bff03=ejs['render'](_0x56501f,{'networks':_0x336c90||[]});fs[_0x4ea0('0x55')]('/etc/asterisk/stun_xcally.conf',_0x3bff03);return respondWithRpcPromise(_0x4ea0('0x56'),_0x4ea0('0x4c'),{'module':_0x4ea0('0x57')});}else if(_0x716bbe[_0x4ea0('0x35')][_0x4ea0('0x4f')]()=='TURN'){var _0x8f5c32=fs[_0x4ea0('0x58')](path[_0x4ea0('0x51')](config['root'],_0x4ea0('0x59')),_0x4ea0('0x54'));var _0x4fb0f0=ejs[_0x4ea0('0x5a')](_0x8f5c32,{'networks':_0x336c90||[]});fs[_0x4ea0('0x55')]('/etc/asterisk/turn_xcally.conf',_0x4fb0f0);return respondWithRpcPromise(_0x4ea0('0x56'),_0x4ea0('0x4c'),{'module':'res_stun_monitor.so'});}else{var _0x5e8b38=fs['readFileSync'](path[_0x4ea0('0x51')](config[_0x4ea0('0x52')],'server/files/templates/network.ejs'),_0x4ea0('0x54'));var _0x1da8b9=ejs['render'](_0x5e8b38,{'networks':_0x336c90||[]});fs[_0x4ea0('0x55')](util[_0x4ea0('0x5b')](_0x4ea0('0x5c'),_0x468149[_0x4ea0('0x4e')]['type']['toLowerCase']()),_0x1da8b9);return respondWithRpcPromise(_0x4ea0('0x56'),_0x4ea0('0x4c'),{'module':_0x4ea0('0x5d')});}return null;})['then'](function(){return _0x716bbe;});})[_0x4ea0('0x2e')](respondWithResult(_0xca0157,0xc9))[_0x4ea0('0x23')](handleError(_0xca0157,null));};exports['update']=function(_0x26bd42,_0x421522,_0x5c1815){var _0x41dcb2;return db[_0x4ea0('0x5e')][_0x4ea0('0x4d')](function(_0x4965fa){return db[_0x4ea0('0x33')][_0x4ea0('0x4b')]({'where':{'id':_0x26bd42[_0x4ea0('0x5f')]['id']}})[_0x4ea0('0x2e')](handleEntityNotFound(_0x421522,null))['then'](saveUpdates(_0x26bd42['body'],null))[_0x4ea0('0x2e')](function(_0x4e8bd7){if(_0x4e8bd7){_0x41dcb2=_0x4e8bd7;return db['Network'][_0x4ea0('0x45')]({'where':{'type':_0x41dcb2['type']},'raw':!![]});}return null;})['then'](function(_0x23da92){if(_0x41dcb2[_0x4ea0('0x35')][_0x4ea0('0x4f')]()==_0x4ea0('0x50')){var _0x45d336=fs['readFileSync'](path['join'](config[_0x4ea0('0x52')],'server/files/templates/stun_multiple.ejs'),_0x4ea0('0x54'));var _0x5f4e6e=ejs['render'](_0x45d336,{'networks':_0x23da92||[]});fs[_0x4ea0('0x55')](_0x4ea0('0x60'),_0x5f4e6e);return respondWithRpcPromise(_0x4ea0('0x56'),_0x4ea0('0x61'),{'module':_0x4ea0('0x57')});}else if(_0x41dcb2[_0x4ea0('0x35')][_0x4ea0('0x4f')]()==_0x4ea0('0x62')){var _0x1a635c=fs[_0x4ea0('0x58')](path['join'](config[_0x4ea0('0x52')],_0x4ea0('0x59')),'utf8');var _0x551917=ejs[_0x4ea0('0x5a')](_0x1a635c,{'networks':_0x23da92||[]});fs['writeFileSync'](_0x4ea0('0x63'),_0x551917);return respondWithRpcPromise(_0x4ea0('0x56'),_0x4ea0('0x61'),{'module':'res_stun_monitor.so'});}else{var _0x491d76=fs[_0x4ea0('0x58')](path[_0x4ea0('0x51')](config[_0x4ea0('0x52')],_0x4ea0('0x64')),_0x4ea0('0x54'));var _0x369d6e=ejs[_0x4ea0('0x5a')](_0x491d76,{'networks':_0x23da92||[]});fs[_0x4ea0('0x55')](util[_0x4ea0('0x5b')](_0x4ea0('0x5c'),_0x26bd42['body'][_0x4ea0('0x35')][_0x4ea0('0x65')]()),_0x369d6e);return respondWithRpcPromise(_0x4ea0('0x56'),_0x4ea0('0x61'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x2fae29){if(_0x2fae29){return _0x41dcb2;}return null;});})[_0x4ea0('0x2e')](respondWithResult(_0x421522,null))[_0x4ea0('0x23')](handleError(_0x421522,null));};exports[_0x4ea0('0x2f')]=function(_0x133611,_0x59eba9,_0x29f338){var _0x5aac38;return db['Network'][_0x4ea0('0x4b')]({'where':{'id':_0x133611['params']['id']}})[_0x4ea0('0x2e')](function(_0x18fbb3){_0x5aac38=_0x18fbb3;return _0x18fbb3;})[_0x4ea0('0x2e')](handleEntityNotFound(_0x59eba9,null))[_0x4ea0('0x2e')](removeEntity(_0x59eba9,null))[_0x4ea0('0x2e')](function(){if(_0x5aac38){return db[_0x4ea0('0x33')][_0x4ea0('0x45')]({'where':{'type':_0x5aac38[_0x4ea0('0x35')]},'raw':!![]});}})[_0x4ea0('0x2e')](function(_0x26a92d){if(_0x5aac38[_0x4ea0('0x35')]['toUpperCase']()==_0x4ea0('0x50')){var _0x50cb70=fs[_0x4ea0('0x58')](path['join'](config[_0x4ea0('0x52')],_0x4ea0('0x53')),_0x4ea0('0x54'));var _0x41657e=ejs[_0x4ea0('0x5a')](_0x50cb70,{'networks':_0x26a92d||[]});fs[_0x4ea0('0x55')]('/etc/asterisk/stun_xcally.conf',_0x41657e);return respondWithRpcPromise(_0x4ea0('0x56'),_0x4ea0('0x2f'),{'module':_0x4ea0('0x57')});}else if(_0x5aac38[_0x4ea0('0x35')][_0x4ea0('0x4f')]()=='TURN'){var _0x402e70=fs[_0x4ea0('0x58')](path['join'](config['root'],_0x4ea0('0x59')),'utf8');var _0x5b2bdc=ejs[_0x4ea0('0x5a')](_0x402e70,{'networks':_0x26a92d||[]});fs[_0x4ea0('0x55')](_0x4ea0('0x63'),_0x5b2bdc);return respondWithRpcPromise(_0x4ea0('0x56'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x5afc1e=fs[_0x4ea0('0x58')](path['join'](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x5e55fe=ejs[_0x4ea0('0x5a')](_0x5afc1e,{'networks':_0x26a92d||[]});fs[_0x4ea0('0x55')](util[_0x4ea0('0x5b')](_0x4ea0('0x5c'),_0x133611['body']['type'][_0x4ea0('0x65')]()),_0x5e55fe);return respondWithRpcPromise('Reload',_0x4ea0('0x2f'),{'module':_0x4ea0('0x5d')});}return null;})[_0x4ea0('0x23')](handleError(_0x59eba9,null));}; \ No newline at end of file +var _0x27e6=['json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','Network','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','keys','includeAll','find','create','transaction','body','STUN','readFileSync','join','root','render','writeFileSync','/etc/asterisk/stun_xcally.conf','toUpperCase','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','Reload','chan_sip.so','sequelize','server/files/templates/stun_multiple.ejs','res_stun_monitor.so','TURN','toLowerCase','params','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','sendStatus','status'];(function(_0x4a22f7,_0x12b819){var _0x5bf2f4=function(_0x2a6768){while(--_0x2a6768){_0x4a22f7['push'](_0x4a22f7['shift']());}};_0x5bf2f4(++_0x12b819);}(_0x27e6,0x121));var _0x627e=function(_0x45e54f,_0x2f1966){_0x45e54f=_0x45e54f-0x0;var _0x120a5e=_0x27e6[_0x45e54f];return _0x120a5e;};'use strict';var emlformat=require(_0x627e('0x0'));var rimraf=require(_0x627e('0x1'));var zipdir=require(_0x627e('0x2'));var jsonpatch=require(_0x627e('0x3'));var rp=require(_0x627e('0x4'));var moment=require('moment');var BPromise=require(_0x627e('0x5'));var Mustache=require(_0x627e('0x6'));var util=require(_0x627e('0x7'));var path=require(_0x627e('0x8'));var sox=require('sox');var csv=require(_0x627e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x627e('0xa'));var squel=require(_0x627e('0xb'));var crypto=require(_0x627e('0xc'));var jsforce=require(_0x627e('0xd'));var deskjs=require(_0x627e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x627e('0xf'));var Papa=require(_0x627e('0x10'));var Redis=require(_0x627e('0x11'));var authService=require(_0x627e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x627e('0x13'));var hardwareService=require(_0x627e('0x14'));var logger=require(_0x627e('0x15'))(_0x627e('0x16'));var utils=require(_0x627e('0x17'));var config=require(_0x627e('0x18'));var licenseUtil=require(_0x627e('0x19'));var db=require(_0x627e('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x627e('0x1b')][_0x627e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xd1d2ad,_0x4f2f76,_0x148bcf,_0xc18de4){return new BPromise(function(_0x3abfc6,_0x5b3a31){var _0x1b0686=_0xc18de4||client;return _0x1b0686['request'](_0xd1d2ad,_0x148bcf)[_0x627e('0x1d')](function(_0x82d324){logger['info'](_0x627e('0x1e'),_0x4f2f76,'request\x20sent');logger[_0x627e('0x1f')](_0x627e('0x20'),_0x4f2f76,'request\x20sent',JSON[_0x627e('0x21')](_0x82d324));if(_0x82d324['error']){if(_0x82d324[_0x627e('0x22')]['code']===0x1f4){logger['error'](_0x627e('0x1e'),_0x4f2f76,_0x82d324['error']['message']);return _0x5b3a31(_0x82d324[_0x627e('0x22')]['message']);}logger[_0x627e('0x22')](_0x627e('0x1e'),_0x4f2f76,_0x82d324[_0x627e('0x22')][_0x627e('0x23')]);return _0x3abfc6(_0x82d324['error'][_0x627e('0x23')]);}else{logger[_0x627e('0x24')](_0x627e('0x1e'),_0x4f2f76,_0x627e('0x25'));_0x3abfc6(_0x82d324[_0x627e('0x26')][_0x627e('0x23')]);}})['catch'](function(_0x391405){logger[_0x627e('0x22')](_0x627e('0x1e'),_0x4f2f76,_0x391405);_0x5b3a31(_0x391405);});});}function respondWithStatusCode(_0x5c2f1f,_0x4c6d30){_0x4c6d30=_0x4c6d30||0xcc;return function(_0x43d4df){if(_0x43d4df){return _0x5c2f1f[_0x627e('0x27')](_0x4c6d30);}return _0x5c2f1f[_0x627e('0x28')](_0x4c6d30)['end']();};}function respondWithResult(_0x36af8d,_0x2f1441){_0x2f1441=_0x2f1441||0xc8;return function(_0x413a11){if(_0x413a11){return _0x36af8d[_0x627e('0x28')](_0x2f1441)[_0x627e('0x29')](_0x413a11);}};}function respondWithFilteredResult(_0x303500,_0x2e7947){return function(_0x5ad443){if(_0x5ad443){var _0x5e407a=typeof _0x2e7947[_0x627e('0x2a')]===_0x627e('0x2b')&&typeof _0x2e7947['limit']===_0x627e('0x2b');var _0x101f81=_0x5ad443[_0x627e('0x2c')];var _0x14a6a6=_0x5e407a?0x0:_0x2e7947[_0x627e('0x2a')];var _0x29e485=_0x5e407a?_0x5ad443[_0x627e('0x2c')]:_0x2e7947[_0x627e('0x2a')]+_0x2e7947[_0x627e('0x2d')];var _0x228468;if(_0x29e485>=_0x101f81){_0x29e485=_0x101f81;_0x228468=0xc8;}else{_0x228468=0xce;}_0x303500[_0x627e('0x28')](_0x228468);return _0x303500['set'](_0x627e('0x2e'),_0x14a6a6+'-'+_0x29e485+'/'+_0x101f81)[_0x627e('0x29')](_0x5ad443);}return null;};}function patchUpdates(_0x33f555){return function(_0x38b96e){try{jsonpatch[_0x627e('0x2f')](_0x38b96e,_0x33f555,!![]);}catch(_0x1a9516){return BPromise[_0x627e('0x30')](_0x1a9516);}return _0x38b96e[_0x627e('0x31')]();};}function saveUpdates(_0x34564b,_0x413633){return function(_0x162dbb){if(_0x162dbb){return _0x162dbb[_0x627e('0x32')](_0x34564b)[_0x627e('0x1d')](function(_0x58e7ae){return _0x58e7ae;});}return null;};}function removeEntity(_0x3b483b,_0x3e477f){return function(_0x4c8709){if(_0x4c8709){return _0x4c8709[_0x627e('0x33')]()['then'](function(){_0x3b483b[_0x627e('0x28')](0xcc)[_0x627e('0x34')]();});}};}function handleEntityNotFound(_0x4062b9,_0x8498fe){return function(_0x58d552){if(!_0x58d552){_0x4062b9['sendStatus'](0x194);}return _0x58d552;};}function handleError(_0x4a7eb8,_0x450d1f){_0x450d1f=_0x450d1f||0x1f4;return function(_0x2a34fc){logger[_0x627e('0x22')](_0x2a34fc[_0x627e('0x35')]);if(_0x2a34fc[_0x627e('0x36')]){delete _0x2a34fc['name'];}_0x4a7eb8[_0x627e('0x28')](_0x450d1f)[_0x627e('0x37')](_0x2a34fc);};}exports[_0x627e('0x38')]=function(_0x96401a,_0x3c1327){var _0x542f02={},_0x46b696={},_0x2b7c23={'count':0x0,'rows':[]};var _0x23b832=_[_0x627e('0x39')](db[_0x627e('0x3a')][_0x627e('0x3b')],function(_0x5f5bec){return{'name':_0x5f5bec[_0x627e('0x3c')],'type':_0x5f5bec['type']['key']};});_0x46b696[_0x627e('0x3d')]=_[_0x627e('0x39')](_0x23b832,_0x627e('0x36'));_0x46b696[_0x627e('0x3e')]=_['keys'](_0x96401a[_0x627e('0x3e')]);_0x46b696['filters']=_[_0x627e('0x3f')](_0x46b696['model'],_0x46b696['query']);_0x542f02[_0x627e('0x40')]=_['intersection'](_0x46b696['model'],qs[_0x627e('0x41')](_0x96401a[_0x627e('0x3e')][_0x627e('0x41')]));_0x542f02[_0x627e('0x40')]=_0x542f02['attributes'][_0x627e('0x42')]?_0x542f02[_0x627e('0x40')]:_0x46b696[_0x627e('0x3d')];if(!_0x96401a[_0x627e('0x3e')][_0x627e('0x43')](_0x627e('0x44'))){_0x542f02['limit']=qs[_0x627e('0x2d')](_0x96401a[_0x627e('0x3e')][_0x627e('0x2d')]);_0x542f02[_0x627e('0x2a')]=qs[_0x627e('0x2a')](_0x96401a[_0x627e('0x3e')][_0x627e('0x2a')]);}_0x542f02[_0x627e('0x45')]=qs[_0x627e('0x46')](_0x96401a[_0x627e('0x3e')][_0x627e('0x46')]);_0x542f02[_0x627e('0x47')]=qs['filters'](_[_0x627e('0x48')](_0x96401a[_0x627e('0x3e')],_0x46b696['filters']),_0x23b832);if(_0x96401a[_0x627e('0x3e')]['filter']){_0x542f02[_0x627e('0x47')]=_['merge'](_0x542f02[_0x627e('0x47')],{'$or':_[_0x627e('0x39')](_0x23b832,function(_0x5a4a58){if(_0x5a4a58[_0x627e('0x49')]!==_0x627e('0x4a')){var _0x29daa7={};_0x29daa7[_0x5a4a58[_0x627e('0x36')]]={'$like':'%'+_0x96401a[_0x627e('0x3e')]['filter']+'%'};return _0x29daa7;}})});}_0x542f02=_[_0x627e('0x4b')]({},_0x542f02,_0x96401a[_0x627e('0x4c')]);var _0x83cb70={'where':_0x542f02[_0x627e('0x47')]};return db[_0x627e('0x3a')][_0x627e('0x2c')](_0x83cb70)[_0x627e('0x1d')](function(_0x318c00){_0x2b7c23[_0x627e('0x2c')]=_0x318c00;if(_0x96401a[_0x627e('0x3e')]['includeAll']){_0x542f02[_0x627e('0x4d')]=[{'all':!![]}];}return db['Network'][_0x627e('0x4e')](_0x542f02);})[_0x627e('0x1d')](function(_0x331c87){_0x2b7c23[_0x627e('0x4f')]=_0x331c87;return _0x2b7c23;})[_0x627e('0x1d')](respondWithFilteredResult(_0x3c1327,_0x542f02))[_0x627e('0x50')](handleError(_0x3c1327,null));};exports[_0x627e('0x51')]=function(_0x5e3187,_0x1f8d23){var _0x17dc15={'raw':!![],'where':{'id':_0x5e3187['params']['id']}},_0x3a459a={};_0x3a459a[_0x627e('0x3d')]=_[_0x627e('0x52')](db[_0x627e('0x3a')]['rawAttributes']);_0x3a459a[_0x627e('0x3e')]=_[_0x627e('0x52')](_0x5e3187[_0x627e('0x3e')]);_0x3a459a['filters']=_[_0x627e('0x3f')](_0x3a459a[_0x627e('0x3d')],_0x3a459a[_0x627e('0x3e')]);_0x17dc15[_0x627e('0x40')]=_[_0x627e('0x3f')](_0x3a459a[_0x627e('0x3d')],qs['fields'](_0x5e3187['query'][_0x627e('0x41')]));_0x17dc15[_0x627e('0x40')]=_0x17dc15[_0x627e('0x40')][_0x627e('0x42')]?_0x17dc15[_0x627e('0x40')]:_0x3a459a[_0x627e('0x3d')];if(_0x5e3187[_0x627e('0x3e')][_0x627e('0x53')]){_0x17dc15[_0x627e('0x4d')]=[{'all':!![]}];}_0x17dc15=_[_0x627e('0x4b')]({},_0x17dc15,_0x5e3187[_0x627e('0x4c')]);return db[_0x627e('0x3a')][_0x627e('0x54')](_0x17dc15)[_0x627e('0x1d')](handleEntityNotFound(_0x1f8d23,null))[_0x627e('0x1d')](respondWithResult(_0x1f8d23,null))[_0x627e('0x50')](handleError(_0x1f8d23,null));};exports[_0x627e('0x55')]=function(_0x47d0f7,_0x182d43,_0x2fe21e){var _0x120b04;return db['sequelize'][_0x627e('0x56')](function(_0x3ed39c){return db[_0x627e('0x3a')][_0x627e('0x55')](_0x47d0f7[_0x627e('0x57')],{'raw':!![]})['then'](function(_0x280805){_0x120b04=_0x280805;return db[_0x627e('0x3a')][_0x627e('0x4e')]({'where':{'type':_0x47d0f7[_0x627e('0x57')]['type']},'raw':!![]});})[_0x627e('0x1d')](function(_0x3b25b2){if(_0x120b04[_0x627e('0x49')]['toUpperCase']()==_0x627e('0x58')){var _0xd55a61=fs[_0x627e('0x59')](path[_0x627e('0x5a')](config[_0x627e('0x5b')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0xa162a9=ejs[_0x627e('0x5c')](_0xd55a61,{'networks':_0x3b25b2||[]});fs[_0x627e('0x5d')](_0x627e('0x5e'),_0xa162a9);return respondWithRpcPromise('Reload',_0x627e('0x55'),{'module':'res_stun_monitor.so'});}else if(_0x120b04[_0x627e('0x49')][_0x627e('0x5f')]()=='TURN'){var _0x19ceda=fs[_0x627e('0x59')](path[_0x627e('0x5a')](config[_0x627e('0x5b')],_0x627e('0x60')),_0x627e('0x61'));var _0x17272c=ejs[_0x627e('0x5c')](_0x19ceda,{'networks':_0x3b25b2||[]});fs[_0x627e('0x5d')](_0x627e('0x62'),_0x17272c);return respondWithRpcPromise('Reload',_0x627e('0x55'),{'module':'res_stun_monitor.so'});}else{var _0xa51ecb=fs[_0x627e('0x59')](path['join'](config[_0x627e('0x5b')],_0x627e('0x63')),'utf8');var _0x25a951=ejs['render'](_0xa51ecb,{'networks':_0x3b25b2||[]});fs['writeFileSync'](util['format'](_0x627e('0x64'),_0x47d0f7[_0x627e('0x57')][_0x627e('0x49')]['toLowerCase']()),_0x25a951);return respondWithRpcPromise(_0x627e('0x65'),_0x627e('0x55'),{'module':_0x627e('0x66')});}return null;})['then'](function(){return _0x120b04;});})['then'](respondWithResult(_0x182d43,0xc9))['catch'](handleError(_0x182d43,null));};exports[_0x627e('0x32')]=function(_0x47dffe,_0x4c0819,_0x500c1f){var _0x284eb5;return db[_0x627e('0x67')][_0x627e('0x56')](function(_0x43b278){return db[_0x627e('0x3a')][_0x627e('0x54')]({'where':{'id':_0x47dffe['params']['id']}})[_0x627e('0x1d')](handleEntityNotFound(_0x4c0819,null))[_0x627e('0x1d')](saveUpdates(_0x47dffe[_0x627e('0x57')],null))[_0x627e('0x1d')](function(_0x23624b){if(_0x23624b){_0x284eb5=_0x23624b;return db[_0x627e('0x3a')]['findAll']({'where':{'type':_0x284eb5[_0x627e('0x49')]},'raw':!![]});}return null;})[_0x627e('0x1d')](function(_0x39c5aa){if(_0x284eb5[_0x627e('0x49')]['toUpperCase']()==_0x627e('0x58')){var _0xc47d22=fs['readFileSync'](path[_0x627e('0x5a')](config[_0x627e('0x5b')],_0x627e('0x68')),_0x627e('0x61'));var _0x5dadd7=ejs['render'](_0xc47d22,{'networks':_0x39c5aa||[]});fs[_0x627e('0x5d')](_0x627e('0x5e'),_0x5dadd7);return respondWithRpcPromise('Reload',_0x627e('0x32'),{'module':_0x627e('0x69')});}else if(_0x284eb5[_0x627e('0x49')][_0x627e('0x5f')]()==_0x627e('0x6a')){var _0x12527e=fs[_0x627e('0x59')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0x627e('0x61'));var _0x4f6d85=ejs[_0x627e('0x5c')](_0x12527e,{'networks':_0x39c5aa||[]});fs[_0x627e('0x5d')]('/etc/asterisk/turn_xcally.conf',_0x4f6d85);return respondWithRpcPromise(_0x627e('0x65'),_0x627e('0x32'),{'module':_0x627e('0x69')});}else{var _0x563e57=fs[_0x627e('0x59')](path[_0x627e('0x5a')](config['root'],_0x627e('0x63')),'utf8');var _0x2fa1f5=ejs['render'](_0x563e57,{'networks':_0x39c5aa||[]});fs[_0x627e('0x5d')](util['format'](_0x627e('0x64'),_0x47dffe[_0x627e('0x57')]['type'][_0x627e('0x6b')]()),_0x2fa1f5);return respondWithRpcPromise(_0x627e('0x65'),'update',{'module':_0x627e('0x66')});}return null;})[_0x627e('0x1d')](function(_0x67f000){if(_0x67f000){return _0x284eb5;}return null;});})[_0x627e('0x1d')](respondWithResult(_0x4c0819,null))['catch'](handleError(_0x4c0819,null));};exports[_0x627e('0x33')]=function(_0x31e56d,_0x43e96d,_0x389476){var _0x604d30;return db[_0x627e('0x3a')][_0x627e('0x54')]({'where':{'id':_0x31e56d[_0x627e('0x6c')]['id']}})[_0x627e('0x1d')](function(_0x484062){_0x604d30=_0x484062;return _0x484062;})[_0x627e('0x1d')](handleEntityNotFound(_0x43e96d,null))['then'](removeEntity(_0x43e96d,null))['then'](function(){if(_0x604d30){return db[_0x627e('0x3a')][_0x627e('0x4e')]({'where':{'type':_0x604d30[_0x627e('0x49')]},'raw':!![]});}})['then'](function(_0x143679){if(_0x604d30['type'][_0x627e('0x5f')]()==_0x627e('0x58')){var _0x209f3f=fs[_0x627e('0x59')](path[_0x627e('0x5a')](config[_0x627e('0x5b')],'server/files/templates/stun_multiple.ejs'),_0x627e('0x61'));var _0x3f4fa3=ejs[_0x627e('0x5c')](_0x209f3f,{'networks':_0x143679||[]});fs[_0x627e('0x5d')](_0x627e('0x5e'),_0x3f4fa3);return respondWithRpcPromise(_0x627e('0x65'),_0x627e('0x33'),{'module':_0x627e('0x69')});}else if(_0x604d30[_0x627e('0x49')][_0x627e('0x5f')]()==_0x627e('0x6a')){var _0x22cd7b=fs[_0x627e('0x59')](path['join'](config['root'],_0x627e('0x60')),_0x627e('0x61'));var _0x273b79=ejs[_0x627e('0x5c')](_0x22cd7b,{'networks':_0x143679||[]});fs['writeFileSync'](_0x627e('0x62'),_0x273b79);return respondWithRpcPromise(_0x627e('0x65'),'destroy',{'module':_0x627e('0x69')});}else{var _0x509d73=fs['readFileSync'](path[_0x627e('0x5a')](config['root'],_0x627e('0x63')),_0x627e('0x61'));var _0xc69ce3=ejs['render'](_0x509d73,{'networks':_0x143679||[]});fs[_0x627e('0x5d')](util[_0x627e('0x6d')](_0x627e('0x64'),_0x31e56d[_0x627e('0x57')][_0x627e('0x49')][_0x627e('0x6b')]()),_0xc69ce3);return respondWithRpcPromise(_0x627e('0x65'),'destroy',{'module':_0x627e('0x66')});}return null;})[_0x627e('0x50')](handleError(_0x43e96d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index e449b29..34b1e56 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 _0xb9a7=['exports','define','Network','network','util','bluebird','path','rimraf','../../config/environment','./network.attributes'];(function(_0x4c4add,_0xb19f2c){var _0x35dd4e=function(_0x3f335b){while(--_0x3f335b){_0x4c4add['push'](_0x4c4add['shift']());}};_0x35dd4e(++_0xb19f2c);}(_0xb9a7,0x112));var _0x7b9a=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xb9a7[_0x4f9b18];return _0x29f20c;};'use strict';var _=require('lodash');var util=require(_0x7b9a('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7b9a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7b9a('0x2'));var rimraf=require(_0x7b9a('0x3'));var config=require(_0x7b9a('0x4'));var attributes=require(_0x7b9a('0x5'));module[_0x7b9a('0x6')]=function(_0xf6dae2,_0x22764f){return _0xf6dae2[_0x7b9a('0x7')](_0x7b9a('0x8'),attributes,{'tableName':_0x7b9a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0db9=['network','lodash','moment','bluebird','path','../../config/environment','./network.attributes','define','Network'];(function(_0x532d47,_0x1a4c97){var _0xed19c1=function(_0x1c6a2c){while(--_0x1c6a2c){_0x532d47['push'](_0x532d47['shift']());}};_0xed19c1(++_0x1a4c97);}(_0x0db9,0xa3));var _0x90db=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0x0db9[_0x32b30c];return _0xcfc212;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x90db('0x1'));var BPromise=require(_0x90db('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x90db('0x3'));var rimraf=require('rimraf');var config=require(_0x90db('0x4'));var attributes=require(_0x90db('0x5'));module['exports']=function(_0x2d02a1,_0x242774){return _0x2d02a1[_0x90db('0x6')](_0x90db('0x7'),attributes,{'tableName':_0x90db('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index aca8002..9ee5131 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x17dc7f,_0x411b06){_0x17dc7f=_0x17dc7f-0x0;var _0x683e4b=_0x7a54[_0x17dc7f];return _0x683e4b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x2e8d1d,_0x28b649){_0x2e8d1d=_0x2e8d1d-0x0;var _0x237805=_0x7a54[_0x2e8d1d];return _0x237805;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 5cf039a..f3b5533 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 _0x9d2f=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','connect-timeout'];(function(_0x541f52,_0x2551b2){var _0x57d9e4=function(_0x7d1f30){while(--_0x7d1f30){_0x541f52['push'](_0x541f52['shift']());}};_0x57d9e4(++_0x2551b2);}(_0x9d2f,0x6d));var _0xf9d2=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x9d2f[_0x119d5a];return _0x15bff4;};'use strict';var multer=require('multer');var util=require(_0xf9d2('0x0'));var path=require('path');var timeout=require(_0xf9d2('0x1'));var express=require(_0xf9d2('0x2'));var router=express[_0xf9d2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf9d2('0x4'));var interaction=require(_0xf9d2('0x5'));var config=require(_0xf9d2('0x6'));var controller=require(_0xf9d2('0x7'));router[_0xf9d2('0x8')]('/',auth[_0xf9d2('0x9')](),controller[_0xf9d2('0xa')]);router['get'](_0xf9d2('0xb'),auth[_0xf9d2('0x9')](),controller[_0xf9d2('0xc')]);router[_0xf9d2('0x8')](_0xf9d2('0xd'),auth[_0xf9d2('0x9')](),controller['show']);router[_0xf9d2('0x8')](_0xf9d2('0xe'),auth[_0xf9d2('0x9')](),controller[_0xf9d2('0xf')]);router[_0xf9d2('0x8')]('/:id/canned_answers',auth[_0xf9d2('0x9')](),controller[_0xf9d2('0x10')]);router[_0xf9d2('0x8')](_0xf9d2('0x11'),auth[_0xf9d2('0x9')](),controller[_0xf9d2('0x12')]);router[_0xf9d2('0x8')](_0xf9d2('0x13'),auth['isAuthenticated'](),controller[_0xf9d2('0x14')]);router[_0xf9d2('0x8')](_0xf9d2('0x15'),auth[_0xf9d2('0x9')](),controller[_0xf9d2('0x16')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf9d2('0x17')]);router[_0xf9d2('0x18')]('/:id/dispositions',auth[_0xf9d2('0x9')](),controller[_0xf9d2('0x19')]);router[_0xf9d2('0x18')](_0xf9d2('0x1a'),auth[_0xf9d2('0x9')](),controller[_0xf9d2('0x1b')]);router['post'](_0xf9d2('0x1c'),controller['notify']);router[_0xf9d2('0x18')]('/:id/applications',auth[_0xf9d2('0x9')](),controller['addApplications']);router['post']('/:id/users',auth[_0xf9d2('0x9')](),controller['addAgents']);router['post'](_0xf9d2('0x1d'),auth[_0xf9d2('0x9')](),controller['send']);router[_0xf9d2('0x1e')](_0xf9d2('0xd'),auth['isAuthenticated'](),controller[_0xf9d2('0x1f')]);router[_0xf9d2('0x20')](_0xf9d2('0xd'),auth['isAuthenticated'](),controller[_0xf9d2('0x21')]);router[_0xf9d2('0x20')](_0xf9d2('0xe'),auth['isAuthenticated'](),controller[_0xf9d2('0x22')]);router['delete'](_0xf9d2('0x1a'),auth[_0xf9d2('0x9')](),controller[_0xf9d2('0x23')]);router[_0xf9d2('0x20')](_0xf9d2('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xf9d2('0x24')]=router; \ No newline at end of file +var _0x6880=['removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','getApplications','post','create','addAnswer','notify','/:id/applications','addApplications','/:id/users','addAgents','/:id/send','send','update','delete','destroy','removeDispositions'];(function(_0x5ede63,_0x3721ef){var _0x154318=function(_0x50ef23){while(--_0x50ef23){_0x5ede63['push'](_0x5ede63['shift']());}};_0x154318(++_0x3721ef);}(_0x6880,0x86));var _0x0688=function(_0x89ebd5,_0x55d6d6){_0x89ebd5=_0x89ebd5-0x0;var _0x35586b=_0x6880[_0x89ebd5];return _0x35586b;};'use strict';var multer=require(_0x0688('0x0'));var util=require(_0x0688('0x1'));var path=require(_0x0688('0x2'));var timeout=require('connect-timeout');var express=require(_0x0688('0x3'));var router=express['Router']();var fs_extra=require(_0x0688('0x4'));var auth=require(_0x0688('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0688('0x6'));var controller=require('./openchannelAccount.controller');router[_0x0688('0x7')]('/',auth[_0x0688('0x8')](),controller[_0x0688('0x9')]);router[_0x0688('0x7')]('/describe',auth[_0x0688('0x8')](),controller[_0x0688('0xa')]);router['get'](_0x0688('0xb'),auth[_0x0688('0x8')](),controller[_0x0688('0xc')]);router[_0x0688('0x7')](_0x0688('0xd'),auth[_0x0688('0x8')](),controller['getDispositions']);router[_0x0688('0x7')](_0x0688('0xe'),auth[_0x0688('0x8')](),controller[_0x0688('0xf')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0x0688('0x10')]);router['get']('/:id/interactions',auth[_0x0688('0x8')](),controller['getInteractions']);router[_0x0688('0x7')]('/:id/users',auth[_0x0688('0x8')](),controller['getAgents']);router[_0x0688('0x11')]('/',auth[_0x0688('0x8')](),controller[_0x0688('0x12')]);router[_0x0688('0x11')]('/:id/dispositions',auth[_0x0688('0x8')](),controller['addDisposition']);router[_0x0688('0x11')](_0x0688('0xe'),auth[_0x0688('0x8')](),controller[_0x0688('0x13')]);router[_0x0688('0x11')]('/:id/notify',controller[_0x0688('0x14')]);router[_0x0688('0x11')](_0x0688('0x15'),auth[_0x0688('0x8')](),controller[_0x0688('0x16')]);router['post'](_0x0688('0x17'),auth[_0x0688('0x8')](),controller[_0x0688('0x18')]);router[_0x0688('0x11')](_0x0688('0x19'),auth[_0x0688('0x8')](),controller[_0x0688('0x1a')]);router['put'](_0x0688('0xb'),auth['isAuthenticated'](),controller[_0x0688('0x1b')]);router[_0x0688('0x1c')]('/:id',auth[_0x0688('0x8')](),controller[_0x0688('0x1d')]);router[_0x0688('0x1c')](_0x0688('0xd'),auth[_0x0688('0x8')](),controller[_0x0688('0x1e')]);router[_0x0688('0x1c')](_0x0688('0xe'),auth[_0x0688('0x8')](),controller['removeAnswers']);router[_0x0688('0x1c')](_0x0688('0x17'),auth[_0x0688('0x8')](),controller[_0x0688('0x1f')]);module[_0x0688('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 5c7a138..a7f590f 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 _0xa839=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x3e86b8,_0x119b8c){var _0x1cee52=function(_0xf3d198){while(--_0xf3d198){_0x3e86b8['push'](_0x3e86b8['shift']());}};_0x1cee52(++_0x119b8c);}(_0xa839,0x1a9));var _0x9a83=function(_0x5aac52,_0x4356a5){_0x5aac52=_0x5aac52-0x0;var _0x383ba1=_0xa839[_0x5aac52];return _0x383ba1;};'use strict';var Sequelize=require(_0x9a83('0x0'));var rs=require('randomstring');module[_0x9a83('0x1')]={'name':{'type':Sequelize[_0x9a83('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x9a83('0x2')],'defaultValue':function(){return rs[_0x9a83('0x3')]();}},'replyUri':{'type':Sequelize[_0x9a83('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9a83('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9a83('0x4')],'defaultValue':function(){return _0x9a83('0x5');}},'notificationSound':{'type':Sequelize[_0x9a83('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9a83('0x2')]},'queueTransfer':{'type':Sequelize[_0x9a83('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9a83('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9a83('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9a83('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9a83('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9a83('0x6')],'defaultValue':![],'comment':_0x9a83('0x9'),'set':function(_0x355ab5){if(!_0x355ab5)this[_0x9a83('0xa')]('mandatoryDispositionPauseId',null);this[_0x9a83('0xa')](_0x9a83('0xb'),_0x355ab5);}}}; \ No newline at end of file +var _0xba79=['sequelize','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x9c7d6a,_0x1aa2cc){var _0x145395=function(_0x12c9ec){while(--_0x12c9ec){_0x9c7d6a['push'](_0x9c7d6a['shift']());}};_0x145395(++_0x1aa2cc);}(_0xba79,0xe4));var _0x9ba7=function(_0x5062da,_0x4400d2){_0x5062da=_0x5062da-0x0;var _0x46d327=_0xba79[_0x5062da];return _0x46d327;};'use strict';var Sequelize=require(_0x9ba7('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9ba7('0x1')]},'token':{'type':Sequelize[_0x9ba7('0x1')],'defaultValue':function(){return rs[_0x9ba7('0x2')]();}},'replyUri':{'type':Sequelize[_0x9ba7('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x9ba7('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9ba7('0x3')],'defaultValue':function(){return _0x9ba7('0x4');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9ba7('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9ba7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9ba7('0x1')]},'queueTransfer':{'type':Sequelize[_0x9ba7('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9ba7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9ba7('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9ba7('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9ba7('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x9ba7('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x9ba7('0x5')],'defaultValue':![],'comment':_0x9ba7('0x8'),'set':function(_0x57ec85){if(!_0x57ec85)this['setDataValue'](_0x9ba7('0x9'),null);this[_0x9ba7('0xa')](_0x9ba7('0xb'),_0x57ec85);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 4e2474f..d80b195 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 _0xac11=['user','role','UserProfileSection','find','userProfileId','autoAssociation','update','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','addAnswer','CannedAnswer','ids','notify','openchannel','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','Applications','List','account','applications','list','orderBy','priority','asc','defaults','contact','firstName','threadId','OpenchannelInteraction','externalUrl','spread','lastName','messageId','interaction','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Owner','fullname','internal','Tag','color','tag','addAgents','emit','removeAgents','userOpenchannelAccount:remove','getAgents','DESC','ListId','out','Messages','dataValues','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','map','OpenchannelAccount','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','show','params','mandatoryDispositionPause','keys','includeAll','include','create','body'];(function(_0x4a81d4,_0x59e60b){var _0xe41e75=function(_0x51ede7){while(--_0x51ede7){_0x4a81d4['push'](_0x4a81d4['shift']());}};_0xe41e75(++_0x59e60b);}(_0xac11,0x117));var _0x1ac1=function(_0x280aeb,_0x8ebab6){_0x280aeb=_0x280aeb-0x0;var _0x208d48=_0xac11[_0x280aeb];return _0x208d48;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ac1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1ac1('0x1'));var moment=require(_0x1ac1('0x2'));var BPromise=require(_0x1ac1('0x3'));var Mustache=require(_0x1ac1('0x4'));var util=require(_0x1ac1('0x5'));var path=require('path');var sox=require(_0x1ac1('0x6'));var csv=require(_0x1ac1('0x7'));var ejs=require(_0x1ac1('0x8'));var fs=require('fs');var fs_extra=require(_0x1ac1('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1ac1('0xa'));var jsforce=require(_0x1ac1('0xb'));var deskjs=require(_0x1ac1('0xc'));var toCsv=require(_0x1ac1('0x7'));var querystring=require(_0x1ac1('0xd'));var Papa=require(_0x1ac1('0xe'));var Redis=require(_0x1ac1('0xf'));var authService=require(_0x1ac1('0x10'));var qs=require(_0x1ac1('0x11'));var as=require(_0x1ac1('0x12'));var hardwareService=require(_0x1ac1('0x13'));var logger=require(_0x1ac1('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1ac1('0x15'));var licenseUtil=require(_0x1ac1('0x16'));var db=require(_0x1ac1('0x17'))['db'];config['redis']=_['defaults'](config[_0x1ac1('0x18')],{'host':_0x1ac1('0x19'),'port':0x18eb});var socket=require(_0x1ac1('0x1a'))(new Redis(config[_0x1ac1('0x18')]));require(_0x1ac1('0x1b'))[_0x1ac1('0x1c')](socket);var jayson=require(_0x1ac1('0x1d'));var client=jayson[_0x1ac1('0x1e')][_0x1ac1('0x1f')]({'port':0x232c});var client9002=jayson[_0x1ac1('0x1e')][_0x1ac1('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x546d02,_0x11be16,_0x4ad4ba,_0x35cda6){return new BPromise(function(_0x113834,_0xa748e5){var _0xdb07d2=_0x35cda6||client;return _0xdb07d2[_0x1ac1('0x20')](_0x546d02,_0x4ad4ba)[_0x1ac1('0x21')](function(_0x12162c){logger[_0x1ac1('0x22')](_0x1ac1('0x23'),_0x11be16,_0x1ac1('0x24'));logger[_0x1ac1('0x25')](_0x1ac1('0x26'),_0x11be16,_0x1ac1('0x24'),JSON[_0x1ac1('0x27')](_0x12162c));if(_0x12162c[_0x1ac1('0x28')]){if(_0x12162c['error'][_0x1ac1('0x29')]===0x1f4){logger[_0x1ac1('0x28')](_0x1ac1('0x23'),_0x11be16,_0x12162c[_0x1ac1('0x28')][_0x1ac1('0x2a')]);return _0xa748e5(_0x12162c['error']['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x11be16,_0x12162c[_0x1ac1('0x28')][_0x1ac1('0x2a')]);return _0x113834(_0x12162c[_0x1ac1('0x28')][_0x1ac1('0x2a')]);}else{logger[_0x1ac1('0x22')](_0x1ac1('0x23'),_0x11be16,_0x1ac1('0x24'));_0x113834(_0x12162c[_0x1ac1('0x2b')][_0x1ac1('0x2a')]);}})[_0x1ac1('0x2c')](function(_0x1e3b47){logger[_0x1ac1('0x28')](_0x1ac1('0x23'),_0x11be16,_0x1e3b47);_0xa748e5(_0x1e3b47);});});}function respondWithStatusCode(_0x1134bd,_0x136027){_0x136027=_0x136027||0xcc;return function(_0x2e337d){if(_0x2e337d){return _0x1134bd['sendStatus'](_0x136027);}return _0x1134bd['status'](_0x136027)[_0x1ac1('0x2d')]();};}function respondWithResult(_0x1773e2,_0x56620b){_0x56620b=_0x56620b||0xc8;return function(_0x160640){if(_0x160640){return _0x1773e2[_0x1ac1('0x2e')](_0x56620b)[_0x1ac1('0x2f')](_0x160640);}};}function respondWithFilteredResult(_0x93e1ac,_0x537b25){return function(_0x11df4f){if(_0x11df4f){var _0x488365=typeof _0x537b25[_0x1ac1('0x30')]==='undefined'&&typeof _0x537b25[_0x1ac1('0x31')]===_0x1ac1('0x32');var _0x4e5578=_0x11df4f['count'];var _0x12a3f5=_0x488365?0x0:_0x537b25[_0x1ac1('0x30')];var _0x3f9966=_0x488365?_0x11df4f[_0x1ac1('0x33')]:_0x537b25[_0x1ac1('0x30')]+_0x537b25['limit'];var _0x5d32c3;if(_0x3f9966>=_0x4e5578){_0x3f9966=_0x4e5578;_0x5d32c3=0xc8;}else{_0x5d32c3=0xce;}_0x93e1ac['status'](_0x5d32c3);return _0x93e1ac[_0x1ac1('0x34')](_0x1ac1('0x35'),_0x12a3f5+'-'+_0x3f9966+'/'+_0x4e5578)[_0x1ac1('0x2f')](_0x11df4f);}return null;};}function patchUpdates(_0x76daea){return function(_0x196b17){try{jsonpatch[_0x1ac1('0x36')](_0x196b17,_0x76daea,!![]);}catch(_0x3f3e0e){return BPromise[_0x1ac1('0x37')](_0x3f3e0e);}return _0x196b17[_0x1ac1('0x38')]();};}function saveUpdates(_0x48060d,_0x573e96){return function(_0x58061f){if(_0x58061f){return _0x58061f['update'](_0x48060d)[_0x1ac1('0x21')](function(_0x1bf4d8){return _0x1bf4d8;});}return null;};}function removeEntity(_0x3f752c,_0x473396){return function(_0x302290){if(_0x302290){return _0x302290['destroy']()[_0x1ac1('0x21')](function(){var _0x542dc3=_0x302290[_0x1ac1('0x39')]({'plain':!![]});var _0x131078=_0x1ac1('0x3a');return db[_0x1ac1('0x3b')][_0x1ac1('0x3c')]({'where':{'type':_0x131078,'resourceId':_0x542dc3['id']}})['then'](function(){return _0x302290;});})[_0x1ac1('0x21')](function(){_0x3f752c[_0x1ac1('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7a38da,_0x120f0f){return function(_0x24d9aa){if(!_0x24d9aa){_0x7a38da['sendStatus'](0x194);}return _0x24d9aa;};}function handleError(_0x483dbc,_0xf4ae4b){_0xf4ae4b=_0xf4ae4b||0x1f4;return function(_0x406889){logger[_0x1ac1('0x28')](_0x406889[_0x1ac1('0x3d')]);if(_0x406889[_0x1ac1('0x3e')]){delete _0x406889['name'];}_0x483dbc[_0x1ac1('0x2e')](_0xf4ae4b)[_0x1ac1('0x3f')](_0x406889);};}exports[_0x1ac1('0x40')]=function(_0x53a3ad,_0x5a8240){var _0x5de40b={'include':[{'model':db[_0x1ac1('0x41')],'as':'mandatoryDispositionPause'}]},_0x228ada={},_0x1e6305={'count':0x0,'rows':[]};var _0x109eba=_[_0x1ac1('0x42')](db[_0x1ac1('0x43')][_0x1ac1('0x44')],function(_0xca1b46){return{'name':_0xca1b46['fieldName'],'type':_0xca1b46['type'][_0x1ac1('0x45')]};});_0x228ada[_0x1ac1('0x46')]=_[_0x1ac1('0x42')](_0x109eba,_0x1ac1('0x3e'));_0x228ada[_0x1ac1('0x47')]=_['keys'](_0x53a3ad[_0x1ac1('0x47')]);_0x228ada[_0x1ac1('0x48')]=_[_0x1ac1('0x49')](_0x228ada[_0x1ac1('0x46')],_0x228ada[_0x1ac1('0x47')]);_0x5de40b[_0x1ac1('0x4a')]=_['intersection'](_0x228ada[_0x1ac1('0x46')],qs[_0x1ac1('0x4b')](_0x53a3ad[_0x1ac1('0x47')][_0x1ac1('0x4b')]));_0x5de40b[_0x1ac1('0x4a')]=_0x5de40b['attributes'][_0x1ac1('0x4c')]?_0x5de40b[_0x1ac1('0x4a')]:_0x228ada[_0x1ac1('0x46')];if(!_0x53a3ad[_0x1ac1('0x47')][_0x1ac1('0x4d')](_0x1ac1('0x4e'))){_0x5de40b[_0x1ac1('0x31')]=qs[_0x1ac1('0x31')](_0x53a3ad[_0x1ac1('0x47')][_0x1ac1('0x31')]);_0x5de40b['offset']=qs[_0x1ac1('0x30')](_0x53a3ad[_0x1ac1('0x47')]['offset']);}_0x5de40b[_0x1ac1('0x4f')]=qs[_0x1ac1('0x50')](_0x53a3ad[_0x1ac1('0x47')][_0x1ac1('0x50')]);_0x5de40b[_0x1ac1('0x51')]=qs[_0x1ac1('0x48')](_[_0x1ac1('0x52')](_0x53a3ad[_0x1ac1('0x47')],_0x228ada[_0x1ac1('0x48')]),_0x109eba);if(_0x53a3ad[_0x1ac1('0x47')][_0x1ac1('0x53')]){_0x5de40b['where']=_[_0x1ac1('0x54')](_0x5de40b[_0x1ac1('0x51')],{'$or':_[_0x1ac1('0x42')](_0x109eba,function(_0xaf2431){if(_0xaf2431[_0x1ac1('0x55')]!==_0x1ac1('0x56')){var _0x44786e={};_0x44786e[_0xaf2431[_0x1ac1('0x3e')]]={'$like':'%'+_0x53a3ad[_0x1ac1('0x47')][_0x1ac1('0x53')]+'%'};return _0x44786e;}})});}_0x5de40b=_[_0x1ac1('0x54')]({},_0x5de40b,_0x53a3ad[_0x1ac1('0x57')]);var _0x4e6221={'where':_0x5de40b[_0x1ac1('0x51')]};return db[_0x1ac1('0x43')][_0x1ac1('0x33')](_0x4e6221)[_0x1ac1('0x21')](function(_0x28799b){_0x1e6305['count']=_0x28799b;if(_0x53a3ad[_0x1ac1('0x47')]['includeAll']){_0x5de40b['include']=[{'all':!![]}];}return db[_0x1ac1('0x43')][_0x1ac1('0x58')](_0x5de40b);})[_0x1ac1('0x21')](function(_0x36f026){_0x1e6305['rows']=_0x36f026;return _0x1e6305;})['then'](respondWithFilteredResult(_0x5a8240,_0x5de40b))[_0x1ac1('0x2c')](handleError(_0x5a8240,null));};exports[_0x1ac1('0x59')]=function(_0x30ebee,_0x266c12){var _0x411968={'raw':![],'where':{'id':_0x30ebee[_0x1ac1('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0x1ac1('0x5b')}]},_0x5ca979={};_0x5ca979[_0x1ac1('0x46')]=_[_0x1ac1('0x5c')](db[_0x1ac1('0x43')][_0x1ac1('0x44')]);_0x5ca979[_0x1ac1('0x47')]=_[_0x1ac1('0x5c')](_0x30ebee['query']);_0x5ca979[_0x1ac1('0x48')]=_['intersection'](_0x5ca979[_0x1ac1('0x46')],_0x5ca979[_0x1ac1('0x47')]);_0x411968[_0x1ac1('0x4a')]=_[_0x1ac1('0x49')](_0x5ca979[_0x1ac1('0x46')],qs[_0x1ac1('0x4b')](_0x30ebee[_0x1ac1('0x47')][_0x1ac1('0x4b')]));_0x411968[_0x1ac1('0x4a')]=_0x411968[_0x1ac1('0x4a')][_0x1ac1('0x4c')]?_0x411968[_0x1ac1('0x4a')]:_0x5ca979[_0x1ac1('0x46')];if(_0x30ebee[_0x1ac1('0x47')][_0x1ac1('0x5d')]){_0x411968[_0x1ac1('0x5e')]=[{'all':!![]}];}_0x411968=_[_0x1ac1('0x54')]({},_0x411968,_0x30ebee[_0x1ac1('0x57')]);return db[_0x1ac1('0x43')]['find'](_0x411968)[_0x1ac1('0x21')](handleEntityNotFound(_0x266c12,null))[_0x1ac1('0x21')](respondWithResult(_0x266c12,null))['catch'](handleError(_0x266c12,null));};exports[_0x1ac1('0x5f')]=function(_0x1c904f,_0x257d4f){return db['OpenchannelAccount'][_0x1ac1('0x5f')](_0x1c904f[_0x1ac1('0x60')],{})['then'](function(_0x194fcc){var _0x5b121b=_0x1c904f[_0x1ac1('0x61')]['get']({'plain':!![]});if(!_0x5b121b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b121b[_0x1ac1('0x62')]===_0x1ac1('0x61')){var _0x49876d=_0x194fcc[_0x1ac1('0x39')]({'plain':!![]});var _0x57368f='OpenchannelAccounts';return db[_0x1ac1('0x63')][_0x1ac1('0x64')]({'where':{'name':_0x57368f,'userProfileId':_0x5b121b[_0x1ac1('0x65')]},'raw':!![]})[_0x1ac1('0x21')](function(_0x246a4d){if(_0x246a4d&&_0x246a4d[_0x1ac1('0x66')]===0x0){return db[_0x1ac1('0x3b')]['create']({'name':_0x49876d[_0x1ac1('0x3e')],'resourceId':_0x49876d['id'],'type':_0x246a4d[_0x1ac1('0x3e')],'sectionId':_0x246a4d['id']},{})[_0x1ac1('0x21')](function(){return _0x194fcc;});}else{return _0x194fcc;}})['catch'](function(_0xc75346){logger[_0x1ac1('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc75346);throw _0xc75346;});}return _0x194fcc;})[_0x1ac1('0x21')](respondWithResult(_0x257d4f,0xc9))[_0x1ac1('0x2c')](handleError(_0x257d4f,null));};exports[_0x1ac1('0x67')]=function(_0x4a600e,_0x366d1f){if(_0x4a600e[_0x1ac1('0x60')]['id']){delete _0x4a600e[_0x1ac1('0x60')]['id'];}return db[_0x1ac1('0x43')]['find']({'where':{'id':_0x4a600e[_0x1ac1('0x5a')]['id']},'include':[{'model':db[_0x1ac1('0x41')],'as':_0x1ac1('0x5b')}]})[_0x1ac1('0x21')](handleEntityNotFound(_0x366d1f,null))[_0x1ac1('0x21')](saveUpdates(_0x4a600e['body'],null))[_0x1ac1('0x21')](respondWithResult(_0x366d1f,null))[_0x1ac1('0x2c')](handleError(_0x366d1f,null));};exports[_0x1ac1('0x3c')]=function(_0x17ed18,_0x50a83b){return db[_0x1ac1('0x43')][_0x1ac1('0x64')]({'where':{'id':_0x17ed18[_0x1ac1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x50a83b,null))[_0x1ac1('0x21')](removeEntity(_0x50a83b,null))[_0x1ac1('0x2c')](handleError(_0x50a83b,null));};exports[_0x1ac1('0x68')]=function(_0x24bb64,_0x20a37f){return db[_0x1ac1('0x43')]['describe']()[_0x1ac1('0x21')](respondWithResult(_0x20a37f,null))['catch'](handleError(_0x20a37f,null));};exports[_0x1ac1('0x69')]=function(_0x3eae17,_0x46eb66,_0x405359){if(_0x3eae17[_0x1ac1('0x60')]['id']){delete _0x3eae17[_0x1ac1('0x60')]['id'];}return db[_0x1ac1('0x43')][_0x1ac1('0x64')]({'where':{'id':_0x3eae17[_0x1ac1('0x5a')]['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x46eb66,null))[_0x1ac1('0x21')](function(_0x24c74b){if(_0x24c74b){_0x3eae17['body'][_0x1ac1('0x6a')]=_0x24c74b['id'];return db[_0x1ac1('0x6b')][_0x1ac1('0x5f')](_0x3eae17['body']);}})[_0x1ac1('0x21')](respondWithResult(_0x46eb66,null))[_0x1ac1('0x2c')](handleError(_0x46eb66,null));};exports[_0x1ac1('0x6c')]=function(_0x120f55,_0x1a2ea0,_0xe9d930){var _0x1b482b={'raw':![],'where':{}};var _0x503e35={};var _0x21a63d={'count':0x0,'rows':[]};return db[_0x1ac1('0x43')][_0x1ac1('0x6d')]({'where':{'id':_0x120f55['params']['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x1a2ea0,null))[_0x1ac1('0x21')](function(_0x432a61){if(_0x432a61){_0x503e35[_0x1ac1('0x46')]=_[_0x1ac1('0x5c')](db[_0x1ac1('0x6b')][_0x1ac1('0x44')]);_0x503e35[_0x1ac1('0x47')]=_[_0x1ac1('0x5c')](_0x120f55[_0x1ac1('0x47')]);_0x503e35[_0x1ac1('0x48')]=_['intersection'](_0x503e35[_0x1ac1('0x46')],_0x503e35[_0x1ac1('0x47')]);_0x1b482b['attributes']=_[_0x1ac1('0x49')](_0x503e35[_0x1ac1('0x46')],qs['fields'](_0x120f55[_0x1ac1('0x47')][_0x1ac1('0x4b')]));_0x1b482b[_0x1ac1('0x4a')]=_0x1b482b[_0x1ac1('0x4a')][_0x1ac1('0x4c')]?_0x1b482b[_0x1ac1('0x4a')]:_0x503e35['model'];if(!_0x120f55[_0x1ac1('0x47')][_0x1ac1('0x4d')](_0x1ac1('0x4e'))){_0x1b482b[_0x1ac1('0x31')]=qs[_0x1ac1('0x31')](_0x120f55[_0x1ac1('0x47')][_0x1ac1('0x31')]);_0x1b482b[_0x1ac1('0x30')]=qs[_0x1ac1('0x30')](_0x120f55[_0x1ac1('0x47')][_0x1ac1('0x30')]);}_0x1b482b['order']=qs['sort'](_0x120f55['query'][_0x1ac1('0x50')]);_0x1b482b[_0x1ac1('0x51')]=qs['filters'](_[_0x1ac1('0x52')](_0x120f55['query'],_0x503e35['filters']));_0x1b482b[_0x1ac1('0x51')]['OpenchannelAccountId']=_0x432a61['id'];if(_0x120f55[_0x1ac1('0x47')][_0x1ac1('0x53')]){_0x1b482b[_0x1ac1('0x51')]=_[_0x1ac1('0x54')](_0x1b482b[_0x1ac1('0x51')],{'$or':_['map'](_0x1b482b[_0x1ac1('0x4a')],function(_0x16ddcc){var _0x20e4c8={};_0x20e4c8[_0x16ddcc]={'$like':'%'+_0x120f55['query'][_0x1ac1('0x53')]+'%'};return _0x20e4c8;})});}_0x1b482b=_[_0x1ac1('0x54')]({},_0x1b482b,_0x120f55[_0x1ac1('0x57')]);return db[_0x1ac1('0x6b')][_0x1ac1('0x33')]({'where':_0x1b482b['where']})[_0x1ac1('0x21')](function(_0x2d7ddf){_0x21a63d[_0x1ac1('0x33')]=_0x2d7ddf;if(_0x120f55[_0x1ac1('0x47')]['includeAll']){_0x1b482b[_0x1ac1('0x5e')]=[{'all':!![]}];}return db['Disposition'][_0x1ac1('0x58')](_0x1b482b);})['then'](function(_0x4d1147){_0x21a63d[_0x1ac1('0x6e')]=_0x4d1147;return _0x21a63d;});}})[_0x1ac1('0x21')](respondWithFilteredResult(_0x1a2ea0,_0x1b482b))[_0x1ac1('0x2c')](handleError(_0x1a2ea0,null));};exports[_0x1ac1('0x6f')]=function(_0x1cbfa4,_0x24502a,_0x23a72c){return db[_0x1ac1('0x43')][_0x1ac1('0x64')]({'where':{'id':_0x1cbfa4[_0x1ac1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x24502a,null))[_0x1ac1('0x21')](function(_0x1a6eff){if(_0x1a6eff){return _0x1a6eff[_0x1ac1('0x6f')](_0x1cbfa4[_0x1ac1('0x47')]['ids']);}})['then'](respondWithStatusCode(_0x24502a,null))[_0x1ac1('0x2c')](handleError(_0x24502a,null));};exports[_0x1ac1('0x70')]=function(_0x3d5820,_0x3f239b,_0x29b321){if(_0x3d5820[_0x1ac1('0x60')]['id']){delete _0x3d5820['body']['id'];}return db['OpenchannelAccount'][_0x1ac1('0x64')]({'where':{'id':_0x3d5820[_0x1ac1('0x5a')]['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x3f239b,null))[_0x1ac1('0x21')](function(_0x1eae6f){if(_0x1eae6f){_0x3d5820[_0x1ac1('0x60')]['OpenchannelAccountId']=_0x1eae6f['id'];return db[_0x1ac1('0x71')][_0x1ac1('0x5f')](_0x3d5820[_0x1ac1('0x60')]);}})[_0x1ac1('0x21')](respondWithResult(_0x3f239b,null))[_0x1ac1('0x2c')](handleError(_0x3f239b,null));};exports['getAnswers']=function(_0x5f1fc8,_0x19eeeb,_0x370788){var _0x3b0b92={'raw':![],'where':{}};var _0x5b12eb={};var _0x2a401c={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x1ac1('0x6d')]({'where':{'id':_0x5f1fc8[_0x1ac1('0x5a')]['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x19eeeb,null))['then'](function(_0x1a5a1d){if(_0x1a5a1d){_0x5b12eb[_0x1ac1('0x46')]=_[_0x1ac1('0x5c')](db[_0x1ac1('0x71')][_0x1ac1('0x44')]);_0x5b12eb[_0x1ac1('0x47')]=_[_0x1ac1('0x5c')](_0x5f1fc8[_0x1ac1('0x47')]);_0x5b12eb[_0x1ac1('0x48')]=_[_0x1ac1('0x49')](_0x5b12eb[_0x1ac1('0x46')],_0x5b12eb[_0x1ac1('0x47')]);_0x3b0b92['attributes']=_['intersection'](_0x5b12eb[_0x1ac1('0x46')],qs[_0x1ac1('0x4b')](_0x5f1fc8[_0x1ac1('0x47')][_0x1ac1('0x4b')]));_0x3b0b92[_0x1ac1('0x4a')]=_0x3b0b92['attributes'][_0x1ac1('0x4c')]?_0x3b0b92[_0x1ac1('0x4a')]:_0x5b12eb['model'];if(!_0x5f1fc8[_0x1ac1('0x47')][_0x1ac1('0x4d')]('nolimit')){_0x3b0b92[_0x1ac1('0x31')]=qs['limit'](_0x5f1fc8[_0x1ac1('0x47')]['limit']);_0x3b0b92[_0x1ac1('0x30')]=qs[_0x1ac1('0x30')](_0x5f1fc8[_0x1ac1('0x47')]['offset']);}_0x3b0b92['order']=qs[_0x1ac1('0x50')](_0x5f1fc8[_0x1ac1('0x47')]['sort']);_0x3b0b92[_0x1ac1('0x51')]=qs[_0x1ac1('0x48')](_[_0x1ac1('0x52')](_0x5f1fc8[_0x1ac1('0x47')],_0x5b12eb[_0x1ac1('0x48')]));_0x3b0b92[_0x1ac1('0x51')][_0x1ac1('0x6a')]=_0x1a5a1d['id'];if(_0x5f1fc8[_0x1ac1('0x47')][_0x1ac1('0x53')]){_0x3b0b92[_0x1ac1('0x51')]=_['merge'](_0x3b0b92[_0x1ac1('0x51')],{'$or':_['map'](_0x3b0b92[_0x1ac1('0x4a')],function(_0xad38e6){var _0x11a6c8={};_0x11a6c8[_0xad38e6]={'$like':'%'+_0x5f1fc8['query'][_0x1ac1('0x53')]+'%'};return _0x11a6c8;})});}_0x3b0b92=_[_0x1ac1('0x54')]({},_0x3b0b92,_0x5f1fc8[_0x1ac1('0x57')]);return db[_0x1ac1('0x71')][_0x1ac1('0x33')]({'where':_0x3b0b92[_0x1ac1('0x51')]})['then'](function(_0x344a95){_0x2a401c['count']=_0x344a95;if(_0x5f1fc8[_0x1ac1('0x47')][_0x1ac1('0x5d')]){_0x3b0b92[_0x1ac1('0x5e')]=[{'all':!![]}];}return db[_0x1ac1('0x71')]['findAll'](_0x3b0b92);})[_0x1ac1('0x21')](function(_0x16b939){_0x2a401c[_0x1ac1('0x6e')]=_0x16b939;return _0x2a401c;});}})[_0x1ac1('0x21')](respondWithFilteredResult(_0x19eeeb,_0x3b0b92))[_0x1ac1('0x2c')](handleError(_0x19eeeb,null));};exports['removeAnswers']=function(_0x4fdaf0,_0x517cd4,_0x4de86b){return db[_0x1ac1('0x43')][_0x1ac1('0x64')]({'where':{'id':_0x4fdaf0[_0x1ac1('0x5a')]['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x517cd4,null))[_0x1ac1('0x21')](function(_0x5eea09){if(_0x5eea09){return _0x5eea09['removeAnswers'](_0x4fdaf0['query'][_0x1ac1('0x72')]);}})['then'](respondWithStatusCode(_0x517cd4,null))['catch'](handleError(_0x517cd4,null));};exports[_0x1ac1('0x73')]=function(_0x2ab5bc,_0x235a73,_0x9501c){var _0x10909a={'body':_0x2ab5bc[_0x1ac1('0x60')],'channel':_0x1ac1('0x74')};var _0x4d3613=[];var _0x10f6fc=[];var _0x34f6c8={};var _0x2c8685=![];return db['CmContact'][_0x1ac1('0x68')]()[_0x1ac1('0x21')](function(_0x31480a){if(!_0x31480a){throw new db['Sequelize']['ValidationError'](_0x1ac1('0x75'));}_0x4d3613=_['difference'](_[_0x1ac1('0x5c')](_0x31480a),[_0x1ac1('0x76'),'updatedAt']);_0x10f6fc=_[_0x1ac1('0x77')](_['keys'](_0x31480a),[_0x1ac1('0x76'),_0x1ac1('0x78'),_0x1ac1('0x79'),'ListId']);if(_0x2ab5bc[_0x1ac1('0x60')]['id']){delete _0x2ab5bc['body']['id'];}if(_[_0x1ac1('0x7a')](_0x2ab5bc['body'][_0x1ac1('0x7b')])){throw new db[(_0x1ac1('0x7c'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x1ac1('0x7a')](_0x2ab5bc['body'][_0x1ac1('0x60')])||_0x2ab5bc['body'][_0x1ac1('0x60')]===''){throw new db[(_0x1ac1('0x7c'))]['ValidationError'](_0x1ac1('0x7d'));}if(_['isNil'](_0x2ab5bc['body']['mapKey'])){throw new db[(_0x1ac1('0x7c'))][(_0x1ac1('0x7e'))](_0x1ac1('0x7f')+_0x10f6fc);}if(!_[_0x1ac1('0x80')](_0x10f6fc,_0x2ab5bc['body'][_0x1ac1('0x81')])){throw new db[(_0x1ac1('0x7c'))][(_0x1ac1('0x7e'))](_0x1ac1('0x82')+_0x10f6fc);}_0x34f6c8[_0x2ab5bc['body'][_0x1ac1('0x81')]]=_0x2ab5bc[_0x1ac1('0x60')][_0x1ac1('0x7b')];})[_0x1ac1('0x21')](function(){return db[_0x1ac1('0x43')]['find']({'where':{'id':_0x2ab5bc[_0x1ac1('0x5a')]['id']},'include':[{'model':db[_0x1ac1('0x83')],'as':'List','include':[{'model':db[_0x1ac1('0x84')],'as':_0x1ac1('0x85'),'where':_0x34f6c8,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x1ac1('0x86')}]});})['then'](handleEntityNotFound(_0x235a73,null))['then'](function(_0x303dc2){if(_0x303dc2&&_0x303dc2[_0x1ac1('0x87')]){_0x10909a[_0x1ac1('0x88')]=_0x303dc2;_0x10909a[_0x1ac1('0x89')]=_0x303dc2[_0x1ac1('0x86')];_0x10909a[_0x1ac1('0x8a')]=_0x303dc2[_0x1ac1('0x87')];_0x10909a[_0x1ac1('0x89')]=_[_0x1ac1('0x8b')](_0x10909a[_0x1ac1('0x89')],[_0x1ac1('0x8c')],[_0x1ac1('0x8d')]);if(_0x10909a[_0x1ac1('0x88')]['Applications']){delete _0x10909a['account'][_0x1ac1('0x86')];}if(_0x10909a[_0x1ac1('0x88')][_0x1ac1('0x87')]&&_0x10909a[_0x1ac1('0x88')][_0x1ac1('0x87')]['Contacts'][_0x1ac1('0x4c')]){return _0x10909a[_0x1ac1('0x88')]['List']['Contacts'][0x0];}var _0x50f9f9=_[_0x1ac1('0x8e')](_0x2ab5bc[_0x1ac1('0x60')],{'firstName':_0x2ab5bc[_0x1ac1('0x60')][_0x1ac1('0x7b')],'ListId':_0x303dc2['ListId']});_0x50f9f9[_0x2ab5bc['body'][_0x1ac1('0x81')]]=_0x2ab5bc[_0x1ac1('0x60')]['from'];return db[_0x1ac1('0x84')][_0x1ac1('0x5f')](_0x50f9f9,{'fields':_0x4d3613,'raw':!![]});}})[_0x1ac1('0x21')](handleEntityNotFound(_0x235a73,null))[_0x1ac1('0x21')](function(_0x134f69){_0x10909a[_0x1ac1('0x8f')]=_0x134f69;if(_0x134f69){var _0x3eeeb9={'ContactId':_0x134f69['id'],'OpenchannelAccountId':_0x2ab5bc['params']['id'],'from':(_0x134f69[_0x1ac1('0x90')]||'')+'\x20'+(_0x134f69['lastName']||'')};var _0x228220={'OpenchannelAccountId':_0x2ab5bc[_0x1ac1('0x5a')]['id'],'closed':![]};if(_0x2ab5bc[_0x1ac1('0x60')][_0x1ac1('0x91')]){_0x228220[_0x1ac1('0x91')]=_0x2ab5bc[_0x1ac1('0x60')]['threadId'];return db[_0x1ac1('0x92')][_0x1ac1('0x64')]({'where':_0x228220})[_0x1ac1('0x21')](function(_0x49a021){if(_0x49a021){return[_0x49a021,![]];}_0x3eeeb9[_0x1ac1('0x91')]=_0x2ab5bc[_0x1ac1('0x60')][_0x1ac1('0x91')];_0x3eeeb9[_0x1ac1('0x93')]=_0x2ab5bc[_0x1ac1('0x60')][_0x1ac1('0x93')];return db[_0x1ac1('0x92')][_0x1ac1('0x5f')](_0x3eeeb9)[_0x1ac1('0x21')](function(_0x23f963){return[_0x23f963,!![]];});});}else{_0x228220[_0x1ac1('0x91')]=null;}_0x228220['ContactId']=_0x134f69['id'];return db[_0x1ac1('0x92')]['find']({'where':_0x228220})[_0x1ac1('0x21')](function(_0x109e39){if(_0x109e39){return[_0x109e39,![]];}return db[_0x1ac1('0x92')][_0x1ac1('0x5f')](_0x3eeeb9)[_0x1ac1('0x21')](function(_0x4123e0){return[_0x4123e0,!![]];});});}})[_0x1ac1('0x94')](function(_0x248b69,_0x4fcaf6){if(_0x248b69){_0x2c8685=_0x4fcaf6;if(!_0x4fcaf6){var _0x2b65bf={'from':(_0x10909a[_0x1ac1('0x8f')]['firstName']||'')+'\x20'+(_0x10909a[_0x1ac1('0x8f')][_0x1ac1('0x95')]||'')};if(_0x2ab5bc[_0x1ac1('0x60')]['threadId']&&_0x2ab5bc[_0x1ac1('0x60')]['messageId']&&_0x2ab5bc[_0x1ac1('0x60')][_0x1ac1('0x91')]!=_0x2ab5bc['body'][_0x1ac1('0x96')]){_0x2b65bf[_0x1ac1('0x91')]=_0x2ab5bc[_0x1ac1('0x60')][_0x1ac1('0x96')];}return _0x248b69[_0x1ac1('0x67')](_0x2b65bf);}else{return _0x248b69;}}})[_0x1ac1('0x21')](function(_0x283741){_0x10909a[_0x1ac1('0x97')]=_0x283741[_0x1ac1('0x39')]({'plain':!![]});_0x10909a[_0x1ac1('0x97')]['created']=_0x2c8685;if(_0x10909a[_0x1ac1('0x97')]['created']){if(_0x10909a[_0x1ac1('0x88')]['autoclose']){_0x10909a[_0x1ac1('0x89')][_0x1ac1('0x98')]({'id':0x0,'priority':_0x10909a[_0x1ac1('0x89')][_0x1ac1('0x4c')]+0x1,'app':_0x1ac1('0x99'),'appdata':_0x1ac1('0x9a'),'interval':_0x1ac1('0x9b')});}}return db[_0x1ac1('0x9c')][_0x1ac1('0x5f')]({'body':_0x2ab5bc[_0x1ac1('0x60')][_0x1ac1('0x60')],'OpenchannelAccountId':_0x2ab5bc['params']['id'],'OpenchannelInteractionId':_0x283741['id'],'direction':'in','ContactId':_0x10909a[_0x1ac1('0x8f')]['id'],'AttachmentId':_0x2ab5bc['body'][_0x1ac1('0x9d')]});})[_0x1ac1('0x21')](function(_0x30ae73){_0x10909a['message']=_0x30ae73;if(_0x10909a[_0x1ac1('0x97')]['UserId']){return db[_0x1ac1('0x9e')][_0x1ac1('0x64')]({'attributes':['id',_0x1ac1('0x3e')],'where':{'id':_0x10909a['interaction'][_0x1ac1('0x9f')]}})[_0x1ac1('0x21')](function(_0x44c985){if(_0x44c985){_0x10909a['applications'][_0x1ac1('0xa0')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x44c985[_0x1ac1('0x3e')]+','+(_0x10909a[_0x1ac1('0x88')][_0x1ac1('0xa1')]||0xa),'interval':_0x1ac1('0x9b')});_0x10909a[_0x1ac1('0xa2')]=![];}return respondWithRpcPromise(_0x1ac1('0xa3'),_0x1ac1('0xa4'),_0x10909a);});}return respondWithRpcPromise('Start',_0x1ac1('0xa4'),_0x10909a);})[_0x1ac1('0x21')](function(_0x2ae6c4){respondWithRpcPromise('EventManager',_0x1ac1('0xa5'),{'event':_0x1ac1('0x73'),'message':_0x2ae6c4},client9002);return _0x2ae6c4;})[_0x1ac1('0x21')](respondWithResult(_0x235a73,null))[_0x1ac1('0x2c')](handleError(_0x235a73,null));};exports[_0x1ac1('0xa6')]=function(_0x4dacb0,_0x6ed674,_0x524837){return db['OpenchannelAccount'][_0x1ac1('0x6d')]({'where':{'id':_0x4dacb0['params']['id']}})['then'](handleEntityNotFound(_0x6ed674,null))[_0x1ac1('0x21')](function(_0x573e36){if(_0x573e36){return db[_0x1ac1('0xa7')]['transaction'](function(_0x1431ba){return db[_0x1ac1('0xa8')][_0x1ac1('0x3c')]({'where':{'OpenchannelAccountId':_0x4dacb0['params']['id']},'transaction':_0x1431ba})[_0x1ac1('0x21')](function(_0x228136){var _0x55ae92=_[_0x1ac1('0x42')](_0x4dacb0['body'],function(_0x2c5994){_0x2c5994[_0x1ac1('0x6a')]=_0x4dacb0[_0x1ac1('0x5a')]['id'];return _0x2c5994;});return db['OpenchannelApplication'][_0x1ac1('0xa9')](_0x55ae92,{'transaction':_0x1431ba});});})[_0x1ac1('0x21')](function(){return db['OpenchannelApplication'][_0x1ac1('0xaa')]({'where':{'OpenchannelAccountId':_0x4dacb0[_0x1ac1('0x5a')]['id']},'order':_0x1ac1('0x8c')});});}})[_0x1ac1('0x21')](respondWithResult(_0x6ed674,null))[_0x1ac1('0x2c')](handleError(_0x6ed674,null));};exports[_0x1ac1('0xab')]=function(_0x4d0020,_0x2a43cc,_0x3b8b52){var _0x549447={};var _0x1ded1f={};var _0x43a7d8;var _0x3e7b57;return db[_0x1ac1('0x43')]['findOne']({'where':{'id':_0x4d0020[_0x1ac1('0x5a')]['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x2a43cc,null))[_0x1ac1('0x21')](function(_0x40ec61){if(_0x40ec61){_0x43a7d8=_0x40ec61;_0x1ded1f['model']=_[_0x1ac1('0x5c')](db['OpenchannelApplication'][_0x1ac1('0x44')]);_0x1ded1f[_0x1ac1('0x47')]=_[_0x1ac1('0x5c')](_0x4d0020[_0x1ac1('0x47')]);_0x1ded1f[_0x1ac1('0x48')]=_[_0x1ac1('0x49')](_0x1ded1f[_0x1ac1('0x46')],_0x1ded1f[_0x1ac1('0x47')]);_0x549447[_0x1ac1('0x4a')]=_['intersection'](_0x1ded1f[_0x1ac1('0x46')],qs[_0x1ac1('0x4b')](_0x4d0020[_0x1ac1('0x47')][_0x1ac1('0x4b')]));_0x549447[_0x1ac1('0x4a')]=_0x549447[_0x1ac1('0x4a')][_0x1ac1('0x4c')]?_0x549447[_0x1ac1('0x4a')]:_0x1ded1f[_0x1ac1('0x46')];_0x549447[_0x1ac1('0x4f')]=qs[_0x1ac1('0x50')](_0x4d0020['query'][_0x1ac1('0x50')]);_0x549447[_0x1ac1('0x51')]=qs[_0x1ac1('0x48')](_['pick'](_0x4d0020[_0x1ac1('0x47')],_0x1ded1f[_0x1ac1('0x48')]));if(_0x4d0020[_0x1ac1('0x47')]['filter']){_0x549447['where']=_[_0x1ac1('0x54')](_0x549447[_0x1ac1('0x51')],{'$or':_['map'](_0x549447[_0x1ac1('0x4a')],function(_0x3658d3){var _0x9ea2c3={};_0x9ea2c3[_0x3658d3]={'$like':'%'+_0x4d0020['query']['filter']+'%'};return _0x9ea2c3;})});}_0x549447=_[_0x1ac1('0x54')]({},_0x549447,_0x4d0020[_0x1ac1('0x57')]);return _0x43a7d8[_0x1ac1('0xab')](_0x549447);}})[_0x1ac1('0x21')](function(_0x3eea0){if(_0x3eea0){_0x3e7b57=_0x3eea0[_0x1ac1('0x4c')];if(!_0x4d0020[_0x1ac1('0x47')][_0x1ac1('0x4d')](_0x1ac1('0x4e'))){_0x549447[_0x1ac1('0x31')]=qs[_0x1ac1('0x31')](_0x4d0020[_0x1ac1('0x47')][_0x1ac1('0x31')]);_0x549447[_0x1ac1('0x30')]=qs[_0x1ac1('0x30')](_0x4d0020['query']['offset']);}return _0x43a7d8[_0x1ac1('0xab')](_0x549447);}})[_0x1ac1('0x21')](function(_0x2f71be){if(_0x2f71be){return _0x2f71be?{'count':_0x3e7b57,'rows':_0x2f71be}:null;}})['then'](respondWithResult(_0x2a43cc,null))['catch'](handleError(_0x2a43cc,null));};exports['getInteractions']=function(_0x18c0d7,_0x522063,_0x239a34){var _0x54cb2a={'raw':![],'where':{}};var _0x85729e={};var _0x44d27b={'count':0x0,'rows':[]};return db[_0x1ac1('0x43')][_0x1ac1('0x6d')]({'where':{'id':_0x18c0d7[_0x1ac1('0x5a')]['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x522063,null))[_0x1ac1('0x21')](function(_0x3269cc){if(_0x3269cc){_0x85729e[_0x1ac1('0x46')]=_[_0x1ac1('0x5c')](db['OpenchannelInteraction'][_0x1ac1('0x44')]);_0x85729e[_0x1ac1('0x47')]=_['keys'](_0x18c0d7[_0x1ac1('0x47')]);_0x85729e[_0x1ac1('0x48')]=_[_0x1ac1('0x49')](_0x85729e[_0x1ac1('0x46')],_0x85729e[_0x1ac1('0x47')]);_0x54cb2a[_0x1ac1('0x4a')]=_[_0x1ac1('0x49')](_0x85729e[_0x1ac1('0x46')],qs['fields'](_0x18c0d7[_0x1ac1('0x47')]['fields']));_0x54cb2a[_0x1ac1('0x4a')]=_0x54cb2a['attributes'][_0x1ac1('0x4c')]?_0x54cb2a[_0x1ac1('0x4a')]:_0x85729e[_0x1ac1('0x46')];if(!_0x18c0d7[_0x1ac1('0x47')][_0x1ac1('0x4d')](_0x1ac1('0x4e'))){_0x54cb2a[_0x1ac1('0x31')]=qs[_0x1ac1('0x31')](_0x18c0d7[_0x1ac1('0x47')]['limit']);_0x54cb2a[_0x1ac1('0x30')]=qs[_0x1ac1('0x30')](_0x18c0d7[_0x1ac1('0x47')][_0x1ac1('0x30')]);}_0x54cb2a[_0x1ac1('0x4f')]=qs[_0x1ac1('0x50')](_0x18c0d7[_0x1ac1('0x47')]['sort']);_0x54cb2a[_0x1ac1('0x51')]=qs[_0x1ac1('0x48')](_[_0x1ac1('0x52')](_0x18c0d7['query'],_0x85729e[_0x1ac1('0x48')]));_0x54cb2a['where'][_0x1ac1('0x6a')]=_0x3269cc['id'];if(_0x18c0d7[_0x1ac1('0x47')][_0x1ac1('0x53')]){_0x54cb2a[_0x1ac1('0x51')]=_['merge'](_0x54cb2a[_0x1ac1('0x51')],{'$or':_[_0x1ac1('0x42')](_0x54cb2a['attributes'],function(_0x2fc602){var _0x1044b3={};_0x1044b3[_0x2fc602]={'$like':'%'+_0x18c0d7['query']['filter']+'%'};return _0x1044b3;})});}_0x54cb2a=_[_0x1ac1('0x54')]({},_0x54cb2a,_0x18c0d7[_0x1ac1('0x57')]);return db[_0x1ac1('0x92')][_0x1ac1('0x33')]({'where':_0x54cb2a[_0x1ac1('0x51')]})['then'](function(_0xda4496){_0x44d27b['count']=_0xda4496;if(_0x18c0d7[_0x1ac1('0x47')][_0x1ac1('0x5d')]){_0x54cb2a[_0x1ac1('0x5e')]=[{'model':db[_0x1ac1('0x84')],'as':'Contact','required':![]},{'model':db[_0x1ac1('0x9e')],'as':_0x1ac1('0xac'),'attributes':[_0x1ac1('0x3e'),_0x1ac1('0xad'),_0x1ac1('0xae')],'required':![]},{'model':db[_0x1ac1('0xaf')],'as':'Tags','attributes':['id',_0x1ac1('0x3e'),_0x1ac1('0xb0')],'where':_0x18c0d7[_0x1ac1('0x47')][_0x1ac1('0xb1')]?{'id':_0x18c0d7['query'][_0x1ac1('0xb1')]}:undefined,'required':_0x18c0d7[_0x1ac1('0x47')][_0x1ac1('0xb1')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x54cb2a);})[_0x1ac1('0x21')](function(_0x27c38b){_0x44d27b['rows']=_0x27c38b;return _0x44d27b;});}})[_0x1ac1('0x21')](respondWithFilteredResult(_0x522063,_0x54cb2a))['catch'](handleError(_0x522063,null));};exports[_0x1ac1('0xb2')]=function(_0x35aecd,_0x13f628,_0x45970b){return db[_0x1ac1('0x43')]['find']({'where':{'id':_0x35aecd[_0x1ac1('0x5a')]['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x13f628,null))[_0x1ac1('0x21')](function(_0x1e96f1){if(_0x1e96f1){return _0x1e96f1[_0x1ac1('0xb2')](_0x35aecd[_0x1ac1('0x60')]['ids'],_['omit'](_0x35aecd[_0x1ac1('0x60')],[_0x1ac1('0x72'),'id'])||{})[_0x1ac1('0x94')](function(_0x17833c){for(var _0x2e5d72=0x0;_0x2e5d72<_0x35aecd['body'][_0x1ac1('0x72')][_0x1ac1('0x4c')];_0x2e5d72+=0x1){socket[_0x1ac1('0xb3')]('userOpenchannelAccount:save',{'UserId':Number(_0x35aecd[_0x1ac1('0x60')][_0x1ac1('0x72')][_0x2e5d72]),'OpenchannelAccountId':Number(_0x35aecd[_0x1ac1('0x5a')]['id'])});}return _0x17833c;});}})[_0x1ac1('0x21')](respondWithResult(_0x13f628,null))[_0x1ac1('0x2c')](handleError(_0x13f628,null));};exports[_0x1ac1('0xb4')]=function(_0x5e5b75,_0x550fed,_0x4b33c3){return db[_0x1ac1('0x43')][_0x1ac1('0x64')]({'where':{'id':_0x5e5b75[_0x1ac1('0x5a')]['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x550fed,null))[_0x1ac1('0x21')](function(_0x12b323){if(_0x12b323){return _0x12b323[_0x1ac1('0xb4')](_0x5e5b75[_0x1ac1('0x47')][_0x1ac1('0x72')])[_0x1ac1('0x21')](function(){if(_['isArray'](_0x5e5b75['query'][_0x1ac1('0x72')])){for(var _0x307685=0x0;_0x307685<_0x5e5b75[_0x1ac1('0x47')]['ids'][_0x1ac1('0x4c')];_0x307685+=0x1){socket['emit'](_0x1ac1('0xb5'),{'UserId':Number(_0x5e5b75[_0x1ac1('0x47')][_0x1ac1('0x72')][_0x307685]),'OpenchannelAccountId':Number(_0x5e5b75[_0x1ac1('0x5a')]['id'])});}}else{socket[_0x1ac1('0xb3')](_0x1ac1('0xb5'),{'UserId':Number(_0x5e5b75[_0x1ac1('0x47')][_0x1ac1('0x72')]),'OpenchannelAccountId':Number(_0x5e5b75[_0x1ac1('0x5a')]['id'])});}});}})[_0x1ac1('0x21')](respondWithStatusCode(_0x550fed,null))[_0x1ac1('0x2c')](handleError(_0x550fed,null));};exports[_0x1ac1('0xb6')]=function(_0x42304a,_0x558559,_0x1849a7){var _0x467fac={};var _0x19ce6d={};var _0x585edd;var _0x1c776e;return db[_0x1ac1('0x43')][_0x1ac1('0x6d')]({'where':{'id':_0x42304a[_0x1ac1('0x5a')]['id']}})[_0x1ac1('0x21')](handleEntityNotFound(_0x558559,null))[_0x1ac1('0x21')](function(_0x9b528f){if(_0x9b528f){_0x585edd=_0x9b528f;_0x19ce6d[_0x1ac1('0x46')]=_[_0x1ac1('0x5c')](db[_0x1ac1('0x9e')][_0x1ac1('0x44')]);_0x19ce6d[_0x1ac1('0x47')]=_[_0x1ac1('0x5c')](_0x42304a[_0x1ac1('0x47')]);_0x19ce6d[_0x1ac1('0x48')]=_[_0x1ac1('0x49')](_0x19ce6d[_0x1ac1('0x46')],_0x19ce6d[_0x1ac1('0x47')]);_0x467fac[_0x1ac1('0x4a')]=_['intersection'](_0x19ce6d['model'],qs[_0x1ac1('0x4b')](_0x42304a[_0x1ac1('0x47')][_0x1ac1('0x4b')]));_0x467fac[_0x1ac1('0x4a')]=_0x467fac[_0x1ac1('0x4a')]['length']?_0x467fac[_0x1ac1('0x4a')]:_0x19ce6d[_0x1ac1('0x46')];_0x467fac['order']=qs[_0x1ac1('0x50')](_0x42304a[_0x1ac1('0x47')]['sort']);_0x467fac[_0x1ac1('0x51')]=qs[_0x1ac1('0x48')](_[_0x1ac1('0x52')](_0x42304a['query'],_0x19ce6d[_0x1ac1('0x48')]));if(_0x42304a[_0x1ac1('0x47')][_0x1ac1('0x53')]){_0x467fac[_0x1ac1('0x51')]=_[_0x1ac1('0x54')](_0x467fac[_0x1ac1('0x51')],{'$or':_[_0x1ac1('0x42')](_0x467fac['attributes'],function(_0x576797){var _0x1f3291={};_0x1f3291[_0x576797]={'$like':'%'+_0x42304a['query'][_0x1ac1('0x53')]+'%'};return _0x1f3291;})});}_0x467fac=_['merge']({},_0x467fac,_0x42304a[_0x1ac1('0x57')]);return _0x585edd[_0x1ac1('0xb6')](_0x467fac);}})[_0x1ac1('0x21')](function(_0x51e787){if(_0x51e787){_0x1c776e=_0x51e787['length'];if(!_0x42304a[_0x1ac1('0x47')][_0x1ac1('0x4d')](_0x1ac1('0x4e'))){_0x467fac[_0x1ac1('0x31')]=qs['limit'](_0x42304a[_0x1ac1('0x47')][_0x1ac1('0x31')]);_0x467fac[_0x1ac1('0x30')]=qs[_0x1ac1('0x30')](_0x42304a[_0x1ac1('0x47')][_0x1ac1('0x30')]);}return _0x585edd[_0x1ac1('0xb6')](_0x467fac);}})['then'](function(_0x1bd948){if(_0x1bd948){return _0x1bd948?{'count':_0x1c776e,'rows':_0x1bd948}:null;}})[_0x1ac1('0x21')](respondWithResult(_0x558559,null))[_0x1ac1('0x2c')](handleError(_0x558559,null));};exports[_0x1ac1('0x3f')]=function(_0x3366c0,_0x3c92de,_0x53bcff){var _0x46b85b,_0x51b196,_0x35d5a1;if(_[_0x1ac1('0x7a')](_0x3366c0['body'][_0x1ac1('0x60')])||_0x3366c0[_0x1ac1('0x60')][_0x1ac1('0x60')]===''){throw new db['Sequelize']['ValidationError'](_0x1ac1('0x7d'));}if(_[_0x1ac1('0x7a')](_0x3366c0[_0x1ac1('0x60')]['to'])){}_0x46b85b=_0x3366c0['body']['to'];return db['OpenchannelAccount'][_0x1ac1('0x6d')]({'where':{'id':_0x3366c0[_0x1ac1('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3c92de,null))['then'](function(_0x1f1295){if(_0x1f1295){return db['OpenchannelAccount']['find']({'where':{'id':_0x1f1295['id']},'include':[{'model':db[_0x1ac1('0x83')],'as':_0x1ac1('0x87'),'include':[{'model':db[_0x1ac1('0x84')],'as':_0x1ac1('0x85'),'where':{[_0x1f1295[_0x1ac1('0x81')]]:_0x46b85b},'limit':0x1,'order':[['updatedAt',_0x1ac1('0xb7')]]}]}]})[_0x1ac1('0x21')](handleEntityNotFound(_0x3c92de,null))[_0x1ac1('0x21')](function(_0x20751f){if(_0x20751f&&_0x20751f[_0x1ac1('0x87')]){_0x51b196=_0x20751f[_0x1ac1('0x39')]({'plain':!![]});if(_0x51b196[_0x1ac1('0x87')]&&_0x51b196[_0x1ac1('0x87')]['Contacts'][_0x1ac1('0x4c')]){return _0x51b196['List'][_0x1ac1('0x85')][0x0];}return db[_0x1ac1('0x84')][_0x1ac1('0x5f')](_[_0x1ac1('0x8e')](_0x3366c0[_0x1ac1('0x60')],{'firstName':_0x46b85b,[_0x20751f[_0x1ac1('0x81')]]:_0x46b85b,'phone':_0x46b85b,'ListId':_0x51b196[_0x1ac1('0xb8')]}));}})[_0x1ac1('0x21')](handleEntityNotFound(_0x3c92de,null))[_0x1ac1('0x21')](function(_0x2b7262){if(_0x2b7262){_0x35d5a1=_0x2b7262;return db[_0x1ac1('0x92')][_0x1ac1('0x64')]({'where':{'ContactId':_0x35d5a1['id'],'closed':![],'OpenchannelAccountId':_0x51b196['id']}})['then'](function(_0x277d77){if(_0x277d77){return[_0x277d77,![]];}return db['OpenchannelInteraction'][_0x1ac1('0x5f')]({'UserId':_0x3366c0[_0x1ac1('0x61')]['id'],'ContactId':_0x35d5a1['id'],'OpenchannelAccountId':_0x51b196['id'],'lastMsgDirection':_0x1ac1('0xb9'),'Messages':[_[_0x1ac1('0x54')](_0x3366c0[_0x1ac1('0x60')],{'read':![],'body':_0x3366c0['body'][_0x1ac1('0x60')],'OpenchannelAccountId':_0x51b196['id'],'UserId':_0x3366c0[_0x1ac1('0x61')]['id'],'ContactId':_0x35d5a1['id']})]},{'include':[{'model':db[_0x1ac1('0x9c')],'as':_0x1ac1('0xba')}]})[_0x1ac1('0x21')](function(_0x7f8b36){return[_0x7f8b36,!![]];});});}})['spread'](function(_0x3295ed,_0x35d695){if(_0x35d695){return _0x3295ed;}return db[_0x1ac1('0x9c')][_0x1ac1('0x5f')](_[_0x1ac1('0x54')](_0x3366c0['body'],{'read':![],'body':_0x3366c0['body']['body'],'OpenchannelAccountId':_0x51b196['id'],'OpenchannelInteractionId':_0x3295ed['id'],'UserId':_0x3366c0[_0x1ac1('0x61')]['id'],'ContactId':_0x35d5a1['id']}))[_0x1ac1('0x21')](function(_0x39cb0f){_0x3295ed[_0x1ac1('0xbb')][_0x1ac1('0xba')]=[];_0x3295ed['dataValues'][_0x1ac1('0xba')]['push'](_0x39cb0f['dataValues']);return _0x3295ed;});});}})['then'](respondWithResult(_0x3c92de,null))['catch'](handleError(_0x3c92de,null));}; \ No newline at end of file +var _0x3c06=['info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelAccount','includeAll','include','findAll','show','Pause','rawAttributes','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','params','OpenchannelAccountId','Disposition','getDispositions','findOne','order','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','notify','openchannel','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','defaults','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','getApplications','Contact','Owner','fullname','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','DESC','out','Messages','spread','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','request','then'];(function(_0x502b13,_0x2ad398){var _0x39d36d=function(_0x556608){while(--_0x556608){_0x502b13['push'](_0x502b13['shift']());}};_0x39d36d(++_0x2ad398);}(_0x3c06,0x9e));var _0x63c0=function(_0x2e4d6b,_0x2750de){_0x2e4d6b=_0x2e4d6b-0x0;var _0x121440=_0x3c06[_0x2e4d6b];return _0x121440;};'use strict';var emlformat=require(_0x63c0('0x0'));var rimraf=require(_0x63c0('0x1'));var zipdir=require(_0x63c0('0x2'));var jsonpatch=require(_0x63c0('0x3'));var rp=require(_0x63c0('0x4'));var moment=require(_0x63c0('0x5'));var BPromise=require(_0x63c0('0x6'));var Mustache=require(_0x63c0('0x7'));var util=require(_0x63c0('0x8'));var path=require(_0x63c0('0x9'));var sox=require(_0x63c0('0xa'));var csv=require(_0x63c0('0xb'));var ejs=require(_0x63c0('0xc'));var fs=require('fs');var fs_extra=require(_0x63c0('0xd'));var _=require(_0x63c0('0xe'));var squel=require('squel');var crypto=require(_0x63c0('0xf'));var jsforce=require(_0x63c0('0x10'));var deskjs=require(_0x63c0('0x11'));var toCsv=require(_0x63c0('0xb'));var querystring=require(_0x63c0('0x12'));var Papa=require(_0x63c0('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x63c0('0x14'));var hardwareService=require(_0x63c0('0x15'));var logger=require('../../config/logger')(_0x63c0('0x16'));var utils=require(_0x63c0('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x63c0('0x18'));var db=require(_0x63c0('0x19'))['db'];config[_0x63c0('0x1a')]=_['defaults'](config[_0x63c0('0x1a')],{'host':_0x63c0('0x1b'),'port':0x18eb});var socket=require(_0x63c0('0x1c'))(new Redis(config[_0x63c0('0x1a')]));require(_0x63c0('0x1d'))[_0x63c0('0x1e')](socket);var jayson=require(_0x63c0('0x1f'));var client=jayson['client'][_0x63c0('0x20')]({'port':0x232c});var client9002=jayson[_0x63c0('0x21')][_0x63c0('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xe9be2f,_0x3c4eb2,_0x1ff77e,_0x35cff5){return new BPromise(function(_0x3d25e2,_0x1712d5){var _0x285f52=_0x35cff5||client;return _0x285f52[_0x63c0('0x22')](_0xe9be2f,_0x1ff77e)[_0x63c0('0x23')](function(_0x3976c6){logger[_0x63c0('0x24')](_0x63c0('0x25'),_0x3c4eb2,'request\x20sent');logger[_0x63c0('0x26')](_0x63c0('0x27'),_0x3c4eb2,_0x63c0('0x28'),JSON['stringify'](_0x3976c6));if(_0x3976c6[_0x63c0('0x29')]){if(_0x3976c6['error'][_0x63c0('0x2a')]===0x1f4){logger[_0x63c0('0x29')]('OpenchannelAccount,\x20%s,\x20%s',_0x3c4eb2,_0x3976c6[_0x63c0('0x29')]['message']);return _0x1712d5(_0x3976c6['error'][_0x63c0('0x2b')]);}logger[_0x63c0('0x29')](_0x63c0('0x25'),_0x3c4eb2,_0x3976c6['error'][_0x63c0('0x2b')]);return _0x3d25e2(_0x3976c6[_0x63c0('0x29')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x3c4eb2,_0x63c0('0x28'));_0x3d25e2(_0x3976c6[_0x63c0('0x2c')][_0x63c0('0x2b')]);}})[_0x63c0('0x2d')](function(_0x502b6c){logger[_0x63c0('0x29')](_0x63c0('0x25'),_0x3c4eb2,_0x502b6c);_0x1712d5(_0x502b6c);});});}function respondWithStatusCode(_0x14ba4f,_0x2eba13){_0x2eba13=_0x2eba13||0xcc;return function(_0x40ece5){if(_0x40ece5){return _0x14ba4f[_0x63c0('0x2e')](_0x2eba13);}return _0x14ba4f[_0x63c0('0x2f')](_0x2eba13)[_0x63c0('0x30')]();};}function respondWithResult(_0x5d6b08,_0x1b2a56){_0x1b2a56=_0x1b2a56||0xc8;return function(_0x45b150){if(_0x45b150){return _0x5d6b08[_0x63c0('0x2f')](_0x1b2a56)[_0x63c0('0x31')](_0x45b150);}};}function respondWithFilteredResult(_0x499549,_0xc077bb){return function(_0x3475ca){if(_0x3475ca){var _0x3e9fba=typeof _0xc077bb[_0x63c0('0x32')]===_0x63c0('0x33')&&typeof _0xc077bb['limit']===_0x63c0('0x33');var _0x1007e6=_0x3475ca[_0x63c0('0x34')];var _0x32542e=_0x3e9fba?0x0:_0xc077bb[_0x63c0('0x32')];var _0x2feee9=_0x3e9fba?_0x3475ca[_0x63c0('0x34')]:_0xc077bb[_0x63c0('0x32')]+_0xc077bb[_0x63c0('0x35')];var _0x4eca70;if(_0x2feee9>=_0x1007e6){_0x2feee9=_0x1007e6;_0x4eca70=0xc8;}else{_0x4eca70=0xce;}_0x499549[_0x63c0('0x2f')](_0x4eca70);return _0x499549[_0x63c0('0x36')](_0x63c0('0x37'),_0x32542e+'-'+_0x2feee9+'/'+_0x1007e6)[_0x63c0('0x31')](_0x3475ca);}return null;};}function patchUpdates(_0x78bd19){return function(_0x4dff7b){try{jsonpatch[_0x63c0('0x38')](_0x4dff7b,_0x78bd19,!![]);}catch(_0x87ffa0){return BPromise['reject'](_0x87ffa0);}return _0x4dff7b[_0x63c0('0x39')]();};}function saveUpdates(_0x5bc3c9,_0x3d6f88){return function(_0x12e48e){if(_0x12e48e){return _0x12e48e[_0x63c0('0x3a')](_0x5bc3c9)[_0x63c0('0x23')](function(_0x3c4c6c){return _0x3c4c6c;});}return null;};}function removeEntity(_0x542153,_0x2d6ccd){return function(_0x15f768){if(_0x15f768){return _0x15f768[_0x63c0('0x3b')]()[_0x63c0('0x23')](function(){var _0x144a10=_0x15f768['get']({'plain':!![]});var _0xd169be=_0x63c0('0x3c');return db[_0x63c0('0x3d')][_0x63c0('0x3b')]({'where':{'type':_0xd169be,'resourceId':_0x144a10['id']}})[_0x63c0('0x23')](function(){return _0x15f768;});})[_0x63c0('0x23')](function(){_0x542153[_0x63c0('0x2f')](0xcc)[_0x63c0('0x30')]();});}};}function handleEntityNotFound(_0x1bf22a,_0x1f9d8f){return function(_0x13eb55){if(!_0x13eb55){_0x1bf22a[_0x63c0('0x2e')](0x194);}return _0x13eb55;};}function handleError(_0x46b142,_0x4f5ef1){_0x4f5ef1=_0x4f5ef1||0x1f4;return function(_0x4bbcb3){logger[_0x63c0('0x29')](_0x4bbcb3[_0x63c0('0x3e')]);if(_0x4bbcb3[_0x63c0('0x3f')]){delete _0x4bbcb3[_0x63c0('0x3f')];}_0x46b142[_0x63c0('0x2f')](_0x4f5ef1)[_0x63c0('0x40')](_0x4bbcb3);};}exports[_0x63c0('0x41')]=function(_0x35d566,_0x2e8667){var _0x4f48bd={'include':[{'model':db['Pause'],'as':_0x63c0('0x42')}]},_0x166301={},_0x2d93c0={'count':0x0,'rows':[]};var _0x4eaa00=_[_0x63c0('0x43')](db['OpenchannelAccount']['rawAttributes'],function(_0x2ebe7a){return{'name':_0x2ebe7a[_0x63c0('0x44')],'type':_0x2ebe7a[_0x63c0('0x45')][_0x63c0('0x46')]};});_0x166301[_0x63c0('0x47')]=_['map'](_0x4eaa00,_0x63c0('0x3f'));_0x166301[_0x63c0('0x48')]=_[_0x63c0('0x49')](_0x35d566[_0x63c0('0x48')]);_0x166301[_0x63c0('0x4a')]=_[_0x63c0('0x4b')](_0x166301[_0x63c0('0x47')],_0x166301[_0x63c0('0x48')]);_0x4f48bd[_0x63c0('0x4c')]=_[_0x63c0('0x4b')](_0x166301['model'],qs[_0x63c0('0x4d')](_0x35d566['query']['fields']));_0x4f48bd[_0x63c0('0x4c')]=_0x4f48bd['attributes'][_0x63c0('0x4e')]?_0x4f48bd[_0x63c0('0x4c')]:_0x166301[_0x63c0('0x47')];if(!_0x35d566[_0x63c0('0x48')][_0x63c0('0x4f')](_0x63c0('0x50'))){_0x4f48bd[_0x63c0('0x35')]=qs[_0x63c0('0x35')](_0x35d566[_0x63c0('0x48')]['limit']);_0x4f48bd[_0x63c0('0x32')]=qs[_0x63c0('0x32')](_0x35d566[_0x63c0('0x48')][_0x63c0('0x32')]);}_0x4f48bd['order']=qs[_0x63c0('0x51')](_0x35d566[_0x63c0('0x48')]['sort']);_0x4f48bd[_0x63c0('0x52')]=qs[_0x63c0('0x4a')](_[_0x63c0('0x53')](_0x35d566[_0x63c0('0x48')],_0x166301[_0x63c0('0x4a')]),_0x4eaa00);if(_0x35d566[_0x63c0('0x48')][_0x63c0('0x54')]){_0x4f48bd[_0x63c0('0x52')]=_[_0x63c0('0x55')](_0x4f48bd[_0x63c0('0x52')],{'$or':_[_0x63c0('0x43')](_0x4eaa00,function(_0x58e236){if(_0x58e236[_0x63c0('0x45')]!==_0x63c0('0x56')){var _0xc2e872={};_0xc2e872[_0x58e236[_0x63c0('0x3f')]]={'$like':'%'+_0x35d566[_0x63c0('0x48')][_0x63c0('0x54')]+'%'};return _0xc2e872;}})});}_0x4f48bd=_['merge']({},_0x4f48bd,_0x35d566[_0x63c0('0x57')]);var _0x2f80e9={'where':_0x4f48bd[_0x63c0('0x52')]};return db[_0x63c0('0x58')][_0x63c0('0x34')](_0x2f80e9)[_0x63c0('0x23')](function(_0x11e91c){_0x2d93c0[_0x63c0('0x34')]=_0x11e91c;if(_0x35d566['query'][_0x63c0('0x59')]){_0x4f48bd[_0x63c0('0x5a')]=[{'all':!![]}];}return db[_0x63c0('0x58')][_0x63c0('0x5b')](_0x4f48bd);})[_0x63c0('0x23')](function(_0x4a3428){_0x2d93c0['rows']=_0x4a3428;return _0x2d93c0;})[_0x63c0('0x23')](respondWithFilteredResult(_0x2e8667,_0x4f48bd))[_0x63c0('0x2d')](handleError(_0x2e8667,null));};exports[_0x63c0('0x5c')]=function(_0x11db54,_0x426a8f){var _0x2c28b8={'raw':![],'where':{'id':_0x11db54['params']['id']},'include':[{'model':db[_0x63c0('0x5d')],'as':_0x63c0('0x42')}]},_0x30bd53={};_0x30bd53['model']=_[_0x63c0('0x49')](db[_0x63c0('0x58')][_0x63c0('0x5e')]);_0x30bd53[_0x63c0('0x48')]=_['keys'](_0x11db54[_0x63c0('0x48')]);_0x30bd53[_0x63c0('0x4a')]=_[_0x63c0('0x4b')](_0x30bd53[_0x63c0('0x47')],_0x30bd53['query']);_0x2c28b8['attributes']=_[_0x63c0('0x4b')](_0x30bd53[_0x63c0('0x47')],qs[_0x63c0('0x4d')](_0x11db54[_0x63c0('0x48')][_0x63c0('0x4d')]));_0x2c28b8[_0x63c0('0x4c')]=_0x2c28b8[_0x63c0('0x4c')][_0x63c0('0x4e')]?_0x2c28b8[_0x63c0('0x4c')]:_0x30bd53['model'];if(_0x11db54[_0x63c0('0x48')][_0x63c0('0x59')]){_0x2c28b8['include']=[{'all':!![]}];}_0x2c28b8=_['merge']({},_0x2c28b8,_0x11db54[_0x63c0('0x57')]);return db[_0x63c0('0x58')][_0x63c0('0x5f')](_0x2c28b8)[_0x63c0('0x23')](handleEntityNotFound(_0x426a8f,null))['then'](respondWithResult(_0x426a8f,null))[_0x63c0('0x2d')](handleError(_0x426a8f,null));};exports[_0x63c0('0x60')]=function(_0x1ddb70,_0x581219){return db[_0x63c0('0x58')][_0x63c0('0x60')](_0x1ddb70[_0x63c0('0x61')],{})[_0x63c0('0x23')](function(_0x19a6ec){var _0x55c8c0=_0x1ddb70['user'][_0x63c0('0x62')]({'plain':!![]});if(!_0x55c8c0)throw new Error(_0x63c0('0x63'));if(_0x55c8c0[_0x63c0('0x64')]===_0x63c0('0x65')){var _0x2e7780=_0x19a6ec[_0x63c0('0x62')]({'plain':!![]});var _0x739f92=_0x63c0('0x3c');return db[_0x63c0('0x66')][_0x63c0('0x5f')]({'where':{'name':_0x739f92,'userProfileId':_0x55c8c0[_0x63c0('0x67')]},'raw':!![]})[_0x63c0('0x23')](function(_0xeb8110){if(_0xeb8110&&_0xeb8110[_0x63c0('0x68')]===0x0){return db[_0x63c0('0x3d')][_0x63c0('0x60')]({'name':_0x2e7780['name'],'resourceId':_0x2e7780['id'],'type':_0xeb8110['name'],'sectionId':_0xeb8110['id']},{})[_0x63c0('0x23')](function(){return _0x19a6ec;});}else{return _0x19a6ec;}})[_0x63c0('0x2d')](function(_0x3676be){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3676be);throw _0x3676be;});}return _0x19a6ec;})[_0x63c0('0x23')](respondWithResult(_0x581219,0xc9))['catch'](handleError(_0x581219,null));};exports['update']=function(_0x3be12f,_0x324f9f){if(_0x3be12f[_0x63c0('0x61')]['id']){delete _0x3be12f['body']['id'];}return db[_0x63c0('0x58')][_0x63c0('0x5f')]({'where':{'id':_0x3be12f['params']['id']},'include':[{'model':db['Pause'],'as':_0x63c0('0x42')}]})[_0x63c0('0x23')](handleEntityNotFound(_0x324f9f,null))[_0x63c0('0x23')](saveUpdates(_0x3be12f[_0x63c0('0x61')],null))[_0x63c0('0x23')](respondWithResult(_0x324f9f,null))['catch'](handleError(_0x324f9f,null));};exports[_0x63c0('0x3b')]=function(_0x3931ca,_0x7c4c03){return db[_0x63c0('0x58')][_0x63c0('0x5f')]({'where':{'id':_0x3931ca['params']['id']}})[_0x63c0('0x23')](handleEntityNotFound(_0x7c4c03,null))['then'](removeEntity(_0x7c4c03,null))[_0x63c0('0x2d')](handleError(_0x7c4c03,null));};exports[_0x63c0('0x69')]=function(_0x72e880,_0x3ed1d9){return db[_0x63c0('0x58')][_0x63c0('0x69')]()['then'](respondWithResult(_0x3ed1d9,null))['catch'](handleError(_0x3ed1d9,null));};exports[_0x63c0('0x6a')]=function(_0x2af90c,_0x34fbd5,_0x40fe24){if(_0x2af90c[_0x63c0('0x61')]['id']){delete _0x2af90c[_0x63c0('0x61')]['id'];}return db[_0x63c0('0x58')]['find']({'where':{'id':_0x2af90c[_0x63c0('0x6b')]['id']}})[_0x63c0('0x23')](handleEntityNotFound(_0x34fbd5,null))[_0x63c0('0x23')](function(_0x752354){if(_0x752354){_0x2af90c['body'][_0x63c0('0x6c')]=_0x752354['id'];return db[_0x63c0('0x6d')][_0x63c0('0x60')](_0x2af90c[_0x63c0('0x61')]);}})[_0x63c0('0x23')](respondWithResult(_0x34fbd5,null))[_0x63c0('0x2d')](handleError(_0x34fbd5,null));};exports[_0x63c0('0x6e')]=function(_0x27387d,_0x4fac67,_0x28ed1d){var _0x100466={'raw':![],'where':{}};var _0x55da80={};var _0x2395d1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x63c0('0x6f')]({'where':{'id':_0x27387d[_0x63c0('0x6b')]['id']}})[_0x63c0('0x23')](handleEntityNotFound(_0x4fac67,null))['then'](function(_0x11986e){if(_0x11986e){_0x55da80[_0x63c0('0x47')]=_[_0x63c0('0x49')](db[_0x63c0('0x6d')][_0x63c0('0x5e')]);_0x55da80[_0x63c0('0x48')]=_[_0x63c0('0x49')](_0x27387d[_0x63c0('0x48')]);_0x55da80['filters']=_[_0x63c0('0x4b')](_0x55da80[_0x63c0('0x47')],_0x55da80[_0x63c0('0x48')]);_0x100466[_0x63c0('0x4c')]=_[_0x63c0('0x4b')](_0x55da80[_0x63c0('0x47')],qs['fields'](_0x27387d[_0x63c0('0x48')][_0x63c0('0x4d')]));_0x100466[_0x63c0('0x4c')]=_0x100466[_0x63c0('0x4c')][_0x63c0('0x4e')]?_0x100466[_0x63c0('0x4c')]:_0x55da80[_0x63c0('0x47')];if(!_0x27387d[_0x63c0('0x48')]['hasOwnProperty'](_0x63c0('0x50'))){_0x100466[_0x63c0('0x35')]=qs[_0x63c0('0x35')](_0x27387d['query']['limit']);_0x100466['offset']=qs[_0x63c0('0x32')](_0x27387d[_0x63c0('0x48')][_0x63c0('0x32')]);}_0x100466[_0x63c0('0x70')]=qs[_0x63c0('0x51')](_0x27387d[_0x63c0('0x48')][_0x63c0('0x51')]);_0x100466['where']=qs[_0x63c0('0x4a')](_[_0x63c0('0x53')](_0x27387d[_0x63c0('0x48')],_0x55da80[_0x63c0('0x4a')]));_0x100466['where'][_0x63c0('0x6c')]=_0x11986e['id'];if(_0x27387d[_0x63c0('0x48')][_0x63c0('0x54')]){_0x100466[_0x63c0('0x52')]=_[_0x63c0('0x55')](_0x100466[_0x63c0('0x52')],{'$or':_['map'](_0x100466[_0x63c0('0x4c')],function(_0x3facc1){var _0x21a706={};_0x21a706[_0x3facc1]={'$like':'%'+_0x27387d['query'][_0x63c0('0x54')]+'%'};return _0x21a706;})});}_0x100466=_[_0x63c0('0x55')]({},_0x100466,_0x27387d[_0x63c0('0x57')]);return db['Disposition'][_0x63c0('0x34')]({'where':_0x100466[_0x63c0('0x52')]})[_0x63c0('0x23')](function(_0x35abec){_0x2395d1['count']=_0x35abec;if(_0x27387d['query'][_0x63c0('0x59')]){_0x100466[_0x63c0('0x5a')]=[{'all':!![]}];}return db['Disposition'][_0x63c0('0x5b')](_0x100466);})[_0x63c0('0x23')](function(_0x375774){_0x2395d1[_0x63c0('0x71')]=_0x375774;return _0x2395d1;});}})[_0x63c0('0x23')](respondWithFilteredResult(_0x4fac67,_0x100466))['catch'](handleError(_0x4fac67,null));};exports[_0x63c0('0x72')]=function(_0x55ca26,_0x27789b,_0x59bd7c){return db['OpenchannelAccount']['find']({'where':{'id':_0x55ca26[_0x63c0('0x6b')]['id']}})['then'](handleEntityNotFound(_0x27789b,null))['then'](function(_0x117944){if(_0x117944){return _0x117944[_0x63c0('0x72')](_0x55ca26[_0x63c0('0x48')][_0x63c0('0x73')]);}})[_0x63c0('0x23')](respondWithStatusCode(_0x27789b,null))[_0x63c0('0x2d')](handleError(_0x27789b,null));};exports[_0x63c0('0x74')]=function(_0x3d21bd,_0x90e3c1,_0xe3533a){if(_0x3d21bd['body']['id']){delete _0x3d21bd['body']['id'];}return db['OpenchannelAccount'][_0x63c0('0x5f')]({'where':{'id':_0x3d21bd[_0x63c0('0x6b')]['id']}})[_0x63c0('0x23')](handleEntityNotFound(_0x90e3c1,null))['then'](function(_0x4f110d){if(_0x4f110d){_0x3d21bd['body'][_0x63c0('0x6c')]=_0x4f110d['id'];return db['CannedAnswer'][_0x63c0('0x60')](_0x3d21bd[_0x63c0('0x61')]);}})[_0x63c0('0x23')](respondWithResult(_0x90e3c1,null))[_0x63c0('0x2d')](handleError(_0x90e3c1,null));};exports['getAnswers']=function(_0x5f4031,_0x3aa561,_0x453665){var _0x488c5a={'raw':![],'where':{}};var _0x4557d4={};var _0x3c0f6f={'count':0x0,'rows':[]};return db[_0x63c0('0x58')][_0x63c0('0x6f')]({'where':{'id':_0x5f4031[_0x63c0('0x6b')]['id']}})['then'](handleEntityNotFound(_0x3aa561,null))[_0x63c0('0x23')](function(_0x54db81){if(_0x54db81){_0x4557d4[_0x63c0('0x47')]=_['keys'](db[_0x63c0('0x75')][_0x63c0('0x5e')]);_0x4557d4[_0x63c0('0x48')]=_[_0x63c0('0x49')](_0x5f4031['query']);_0x4557d4[_0x63c0('0x4a')]=_[_0x63c0('0x4b')](_0x4557d4[_0x63c0('0x47')],_0x4557d4[_0x63c0('0x48')]);_0x488c5a[_0x63c0('0x4c')]=_['intersection'](_0x4557d4[_0x63c0('0x47')],qs[_0x63c0('0x4d')](_0x5f4031[_0x63c0('0x48')][_0x63c0('0x4d')]));_0x488c5a['attributes']=_0x488c5a[_0x63c0('0x4c')][_0x63c0('0x4e')]?_0x488c5a[_0x63c0('0x4c')]:_0x4557d4[_0x63c0('0x47')];if(!_0x5f4031[_0x63c0('0x48')]['hasOwnProperty'](_0x63c0('0x50'))){_0x488c5a[_0x63c0('0x35')]=qs[_0x63c0('0x35')](_0x5f4031[_0x63c0('0x48')][_0x63c0('0x35')]);_0x488c5a[_0x63c0('0x32')]=qs[_0x63c0('0x32')](_0x5f4031[_0x63c0('0x48')][_0x63c0('0x32')]);}_0x488c5a[_0x63c0('0x70')]=qs['sort'](_0x5f4031[_0x63c0('0x48')]['sort']);_0x488c5a[_0x63c0('0x52')]=qs[_0x63c0('0x4a')](_['pick'](_0x5f4031['query'],_0x4557d4['filters']));_0x488c5a[_0x63c0('0x52')][_0x63c0('0x6c')]=_0x54db81['id'];if(_0x5f4031[_0x63c0('0x48')][_0x63c0('0x54')]){_0x488c5a[_0x63c0('0x52')]=_['merge'](_0x488c5a[_0x63c0('0x52')],{'$or':_['map'](_0x488c5a[_0x63c0('0x4c')],function(_0x5487a3){var _0x11666f={};_0x11666f[_0x5487a3]={'$like':'%'+_0x5f4031[_0x63c0('0x48')][_0x63c0('0x54')]+'%'};return _0x11666f;})});}_0x488c5a=_[_0x63c0('0x55')]({},_0x488c5a,_0x5f4031[_0x63c0('0x57')]);return db['CannedAnswer'][_0x63c0('0x34')]({'where':_0x488c5a['where']})['then'](function(_0x1346bc){_0x3c0f6f[_0x63c0('0x34')]=_0x1346bc;if(_0x5f4031[_0x63c0('0x48')][_0x63c0('0x59')]){_0x488c5a[_0x63c0('0x5a')]=[{'all':!![]}];}return db[_0x63c0('0x75')][_0x63c0('0x5b')](_0x488c5a);})[_0x63c0('0x23')](function(_0x281ce3){_0x3c0f6f['rows']=_0x281ce3;return _0x3c0f6f;});}})['then'](respondWithFilteredResult(_0x3aa561,_0x488c5a))[_0x63c0('0x2d')](handleError(_0x3aa561,null));};exports[_0x63c0('0x76')]=function(_0x535f11,_0x2c6d92,_0x4a48f6){return db[_0x63c0('0x58')][_0x63c0('0x5f')]({'where':{'id':_0x535f11['params']['id']}})[_0x63c0('0x23')](handleEntityNotFound(_0x2c6d92,null))[_0x63c0('0x23')](function(_0x318bbd){if(_0x318bbd){return _0x318bbd['removeAnswers'](_0x535f11[_0x63c0('0x48')][_0x63c0('0x73')]);}})['then'](respondWithStatusCode(_0x2c6d92,null))[_0x63c0('0x2d')](handleError(_0x2c6d92,null));};exports[_0x63c0('0x77')]=function(_0x731791,_0x52baa5,_0x17e050){var _0x337791={'body':_0x731791[_0x63c0('0x61')],'channel':_0x63c0('0x78')};var _0x57d1d5=[];var _0x396536=[];var _0x4734a3={};var _0x512fdf=![];return db['CmContact']['describe']()[_0x63c0('0x23')](function(_0x33d4fd){if(!_0x33d4fd){throw new db['Sequelize'][(_0x63c0('0x79'))](_0x63c0('0x7a'));}_0x57d1d5=_['difference'](_[_0x63c0('0x49')](_0x33d4fd),[_0x63c0('0x7b'),_0x63c0('0x7c')]);_0x396536=_[_0x63c0('0x7d')](_[_0x63c0('0x49')](_0x33d4fd),[_0x63c0('0x7b'),_0x63c0('0x7c'),'CompanyId',_0x63c0('0x7e')]);if(_0x731791['body']['id']){delete _0x731791[_0x63c0('0x61')]['id'];}if(_[_0x63c0('0x7f')](_0x731791['body'][_0x63c0('0x80')])){throw new db[(_0x63c0('0x81'))][(_0x63c0('0x79'))](_0x63c0('0x82'));}if(_['isNil'](_0x731791[_0x63c0('0x61')][_0x63c0('0x61')])||_0x731791['body']['body']===''){throw new db[(_0x63c0('0x81'))][(_0x63c0('0x79'))](_0x63c0('0x83'));}if(_[_0x63c0('0x7f')](_0x731791[_0x63c0('0x61')][_0x63c0('0x84')])){throw new db['Sequelize']['ValidationError'](_0x63c0('0x85')+_0x396536);}if(!_[_0x63c0('0x86')](_0x396536,_0x731791[_0x63c0('0x61')][_0x63c0('0x84')])){throw new db[(_0x63c0('0x81'))][(_0x63c0('0x79'))](_0x63c0('0x87')+_0x396536);}_0x4734a3[_0x731791[_0x63c0('0x61')][_0x63c0('0x84')]]=_0x731791['body'][_0x63c0('0x80')];})[_0x63c0('0x23')](function(){return db[_0x63c0('0x58')][_0x63c0('0x5f')]({'where':{'id':_0x731791[_0x63c0('0x6b')]['id']},'include':[{'model':db['CmList'],'as':_0x63c0('0x88'),'include':[{'model':db[_0x63c0('0x89')],'as':_0x63c0('0x8a'),'where':_0x4734a3,'limit':0x1,'order':[[_0x63c0('0x7c'),'DESC']]}]},{'model':db[_0x63c0('0x8b')],'as':_0x63c0('0x8c')}]});})[_0x63c0('0x23')](handleEntityNotFound(_0x52baa5,null))[_0x63c0('0x23')](function(_0x519ded){if(_0x519ded&&_0x519ded[_0x63c0('0x88')]){_0x337791[_0x63c0('0x8d')]=_0x519ded;_0x337791[_0x63c0('0x8e')]=_0x519ded[_0x63c0('0x8c')];_0x337791['list']=_0x519ded[_0x63c0('0x88')];_0x337791[_0x63c0('0x8e')]=_[_0x63c0('0x8f')](_0x337791[_0x63c0('0x8e')],[_0x63c0('0x90')],[_0x63c0('0x91')]);if(_0x337791[_0x63c0('0x8d')]['Applications']){delete _0x337791[_0x63c0('0x8d')]['Applications'];}if(_0x337791['account'][_0x63c0('0x88')]&&_0x337791[_0x63c0('0x8d')][_0x63c0('0x88')][_0x63c0('0x8a')]['length']){return _0x337791[_0x63c0('0x8d')]['List'][_0x63c0('0x8a')][0x0];}var _0x512d0e=_[_0x63c0('0x92')](_0x731791[_0x63c0('0x61')],{'firstName':_0x731791[_0x63c0('0x61')]['from'],'ListId':_0x519ded[_0x63c0('0x7e')]});_0x512d0e[_0x731791[_0x63c0('0x61')]['mapKey']]=_0x731791[_0x63c0('0x61')][_0x63c0('0x80')];return db['CmContact']['create'](_0x512d0e,{'fields':_0x57d1d5,'raw':!![]});}})[_0x63c0('0x23')](handleEntityNotFound(_0x52baa5,null))['then'](function(_0xa3144a){_0x337791[_0x63c0('0x93')]=_0xa3144a;if(_0xa3144a){var _0x14cb9c={'ContactId':_0xa3144a['id'],'OpenchannelAccountId':_0x731791[_0x63c0('0x6b')]['id'],'from':(_0xa3144a[_0x63c0('0x94')]||'')+'\x20'+(_0xa3144a[_0x63c0('0x95')]||'')};var _0x5a2a11={'OpenchannelAccountId':_0x731791[_0x63c0('0x6b')]['id'],'closed':![]};if(_0x731791[_0x63c0('0x61')][_0x63c0('0x96')]){_0x5a2a11[_0x63c0('0x96')]=_0x731791[_0x63c0('0x61')][_0x63c0('0x96')];return db['OpenchannelInteraction'][_0x63c0('0x5f')]({'where':_0x5a2a11})[_0x63c0('0x23')](function(_0x275fbc){if(_0x275fbc){return[_0x275fbc,![]];}_0x14cb9c[_0x63c0('0x96')]=_0x731791['body'][_0x63c0('0x96')];_0x14cb9c[_0x63c0('0x97')]=_0x731791[_0x63c0('0x61')][_0x63c0('0x97')];return db[_0x63c0('0x98')][_0x63c0('0x60')](_0x14cb9c)['then'](function(_0x51f373){return[_0x51f373,!![]];});});}else{_0x5a2a11[_0x63c0('0x96')]=null;}_0x5a2a11['ContactId']=_0xa3144a['id'];return db[_0x63c0('0x98')][_0x63c0('0x5f')]({'where':_0x5a2a11})[_0x63c0('0x23')](function(_0x14a49b){if(_0x14a49b){return[_0x14a49b,![]];}return db['OpenchannelInteraction']['create'](_0x14cb9c)[_0x63c0('0x23')](function(_0x2fffd2){return[_0x2fffd2,!![]];});});}})['spread'](function(_0x12ecd1,_0x3c4bdb){if(_0x12ecd1){_0x512fdf=_0x3c4bdb;if(!_0x3c4bdb){var _0x915d53={'from':(_0x337791[_0x63c0('0x93')]['firstName']||'')+'\x20'+(_0x337791[_0x63c0('0x93')][_0x63c0('0x95')]||'')};if(_0x731791[_0x63c0('0x61')][_0x63c0('0x96')]&&_0x731791[_0x63c0('0x61')][_0x63c0('0x99')]&&_0x731791['body']['threadId']!=_0x731791[_0x63c0('0x61')][_0x63c0('0x99')]){_0x915d53[_0x63c0('0x96')]=_0x731791[_0x63c0('0x61')]['messageId'];}return _0x12ecd1[_0x63c0('0x3a')](_0x915d53);}else{return _0x12ecd1;}}})[_0x63c0('0x23')](function(_0x4d194b){_0x337791['interaction']=_0x4d194b[_0x63c0('0x62')]({'plain':!![]});_0x337791[_0x63c0('0x9a')][_0x63c0('0x9b')]=_0x512fdf;if(_0x337791[_0x63c0('0x9a')][_0x63c0('0x9b')]){if(_0x337791[_0x63c0('0x8d')][_0x63c0('0x9c')]){_0x337791[_0x63c0('0x8e')][_0x63c0('0x9d')]({'id':0x0,'priority':_0x337791[_0x63c0('0x8e')][_0x63c0('0x4e')]+0x1,'app':_0x63c0('0x9e'),'appdata':_0x63c0('0x9f'),'interval':_0x63c0('0xa0')});}}return db[_0x63c0('0xa1')][_0x63c0('0x60')]({'body':_0x731791[_0x63c0('0x61')]['body'],'OpenchannelAccountId':_0x731791[_0x63c0('0x6b')]['id'],'OpenchannelInteractionId':_0x4d194b['id'],'direction':'in','ContactId':_0x337791['contact']['id'],'AttachmentId':_0x731791[_0x63c0('0x61')][_0x63c0('0xa2')]});})[_0x63c0('0x23')](function(_0x3863b2){_0x337791[_0x63c0('0x2b')]=_0x3863b2;if(_0x337791[_0x63c0('0x9a')][_0x63c0('0xa3')]){return db[_0x63c0('0xa4')][_0x63c0('0x5f')]({'attributes':['id',_0x63c0('0x3f')],'where':{'id':_0x337791['interaction'][_0x63c0('0xa3')]}})[_0x63c0('0x23')](function(_0x51c4c2){if(_0x51c4c2){_0x337791[_0x63c0('0x8e')][_0x63c0('0xa5')]({'id':0x0,'priority':0x0,'app':_0x63c0('0xa6'),'appdata':_0x51c4c2['name']+','+(_0x337791[_0x63c0('0x8d')][_0x63c0('0xa7')]||0xa),'interval':'*,*,*,*'});_0x337791['forcedOwnership']=![];}return respondWithRpcPromise('Start',_0x63c0('0xa8'),_0x337791);});}return respondWithRpcPromise('Start',_0x63c0('0xa8'),_0x337791);})['then'](function(_0x448580){respondWithRpcPromise(_0x63c0('0xa9'),_0x63c0('0xa9'),{'event':_0x63c0('0x77'),'message':_0x448580},client9002);return _0x448580;})[_0x63c0('0x23')](respondWithResult(_0x52baa5,null))[_0x63c0('0x2d')](handleError(_0x52baa5,null));};exports[_0x63c0('0xaa')]=function(_0x55a978,_0x1b2aa1,_0x24eda9){return db[_0x63c0('0x58')]['findOne']({'where':{'id':_0x55a978[_0x63c0('0x6b')]['id']}})['then'](handleEntityNotFound(_0x1b2aa1,null))[_0x63c0('0x23')](function(_0x3b732e){if(_0x3b732e){return db[_0x63c0('0xab')][_0x63c0('0xac')](function(_0x30de60){return db[_0x63c0('0x8b')]['destroy']({'where':{'OpenchannelAccountId':_0x55a978[_0x63c0('0x6b')]['id']},'transaction':_0x30de60})['then'](function(_0xe9f4ae){var _0x4891ad=_['map'](_0x55a978[_0x63c0('0x61')],function(_0x461212){_0x461212['OpenchannelAccountId']=_0x55a978[_0x63c0('0x6b')]['id'];return _0x461212;});return db[_0x63c0('0x8b')][_0x63c0('0xad')](_0x4891ad,{'transaction':_0x30de60});});})[_0x63c0('0x23')](function(){return db[_0x63c0('0x8b')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x55a978['params']['id']},'order':_0x63c0('0x90')});});}})['then'](respondWithResult(_0x1b2aa1,null))['catch'](handleError(_0x1b2aa1,null));};exports['getApplications']=function(_0xc5b860,_0x2f73ae,_0x2f32e6){var _0x3394d0={};var _0x9deec0={};var _0x1254eb;var _0x428740;return db[_0x63c0('0x58')]['findOne']({'where':{'id':_0xc5b860[_0x63c0('0x6b')]['id']}})[_0x63c0('0x23')](handleEntityNotFound(_0x2f73ae,null))[_0x63c0('0x23')](function(_0xb7fbb5){if(_0xb7fbb5){_0x1254eb=_0xb7fbb5;_0x9deec0[_0x63c0('0x47')]=_[_0x63c0('0x49')](db[_0x63c0('0x8b')]['rawAttributes']);_0x9deec0[_0x63c0('0x48')]=_[_0x63c0('0x49')](_0xc5b860['query']);_0x9deec0[_0x63c0('0x4a')]=_[_0x63c0('0x4b')](_0x9deec0['model'],_0x9deec0[_0x63c0('0x48')]);_0x3394d0[_0x63c0('0x4c')]=_[_0x63c0('0x4b')](_0x9deec0[_0x63c0('0x47')],qs[_0x63c0('0x4d')](_0xc5b860[_0x63c0('0x48')][_0x63c0('0x4d')]));_0x3394d0[_0x63c0('0x4c')]=_0x3394d0[_0x63c0('0x4c')][_0x63c0('0x4e')]?_0x3394d0[_0x63c0('0x4c')]:_0x9deec0['model'];_0x3394d0[_0x63c0('0x70')]=qs[_0x63c0('0x51')](_0xc5b860[_0x63c0('0x48')][_0x63c0('0x51')]);_0x3394d0[_0x63c0('0x52')]=qs[_0x63c0('0x4a')](_[_0x63c0('0x53')](_0xc5b860[_0x63c0('0x48')],_0x9deec0[_0x63c0('0x4a')]));if(_0xc5b860['query'][_0x63c0('0x54')]){_0x3394d0['where']=_[_0x63c0('0x55')](_0x3394d0[_0x63c0('0x52')],{'$or':_[_0x63c0('0x43')](_0x3394d0[_0x63c0('0x4c')],function(_0x336966){var _0x405a41={};_0x405a41[_0x336966]={'$like':'%'+_0xc5b860[_0x63c0('0x48')][_0x63c0('0x54')]+'%'};return _0x405a41;})});}_0x3394d0=_[_0x63c0('0x55')]({},_0x3394d0,_0xc5b860['options']);return _0x1254eb['getApplications'](_0x3394d0);}})[_0x63c0('0x23')](function(_0x11426b){if(_0x11426b){_0x428740=_0x11426b['length'];if(!_0xc5b860[_0x63c0('0x48')][_0x63c0('0x4f')](_0x63c0('0x50'))){_0x3394d0[_0x63c0('0x35')]=qs['limit'](_0xc5b860[_0x63c0('0x48')][_0x63c0('0x35')]);_0x3394d0[_0x63c0('0x32')]=qs['offset'](_0xc5b860[_0x63c0('0x48')][_0x63c0('0x32')]);}return _0x1254eb[_0x63c0('0xae')](_0x3394d0);}})[_0x63c0('0x23')](function(_0x177d99){if(_0x177d99){return _0x177d99?{'count':_0x428740,'rows':_0x177d99}:null;}})[_0x63c0('0x23')](respondWithResult(_0x2f73ae,null))['catch'](handleError(_0x2f73ae,null));};exports['getInteractions']=function(_0x1e849a,_0x32555e,_0x4606b1){var _0xc38084={'raw':![],'where':{}};var _0x126071={};var _0x40cb3a={'count':0x0,'rows':[]};return db[_0x63c0('0x58')]['findOne']({'where':{'id':_0x1e849a[_0x63c0('0x6b')]['id']}})[_0x63c0('0x23')](handleEntityNotFound(_0x32555e,null))[_0x63c0('0x23')](function(_0x4b11e8){if(_0x4b11e8){_0x126071[_0x63c0('0x47')]=_[_0x63c0('0x49')](db['OpenchannelInteraction'][_0x63c0('0x5e')]);_0x126071[_0x63c0('0x48')]=_[_0x63c0('0x49')](_0x1e849a[_0x63c0('0x48')]);_0x126071[_0x63c0('0x4a')]=_[_0x63c0('0x4b')](_0x126071[_0x63c0('0x47')],_0x126071[_0x63c0('0x48')]);_0xc38084[_0x63c0('0x4c')]=_[_0x63c0('0x4b')](_0x126071[_0x63c0('0x47')],qs[_0x63c0('0x4d')](_0x1e849a['query'][_0x63c0('0x4d')]));_0xc38084[_0x63c0('0x4c')]=_0xc38084['attributes'][_0x63c0('0x4e')]?_0xc38084['attributes']:_0x126071[_0x63c0('0x47')];if(!_0x1e849a['query'][_0x63c0('0x4f')](_0x63c0('0x50'))){_0xc38084[_0x63c0('0x35')]=qs[_0x63c0('0x35')](_0x1e849a[_0x63c0('0x48')]['limit']);_0xc38084[_0x63c0('0x32')]=qs[_0x63c0('0x32')](_0x1e849a['query'][_0x63c0('0x32')]);}_0xc38084[_0x63c0('0x70')]=qs[_0x63c0('0x51')](_0x1e849a[_0x63c0('0x48')][_0x63c0('0x51')]);_0xc38084[_0x63c0('0x52')]=qs[_0x63c0('0x4a')](_[_0x63c0('0x53')](_0x1e849a['query'],_0x126071[_0x63c0('0x4a')]));_0xc38084['where'][_0x63c0('0x6c')]=_0x4b11e8['id'];if(_0x1e849a[_0x63c0('0x48')][_0x63c0('0x54')]){_0xc38084[_0x63c0('0x52')]=_[_0x63c0('0x55')](_0xc38084[_0x63c0('0x52')],{'$or':_[_0x63c0('0x43')](_0xc38084[_0x63c0('0x4c')],function(_0x508faa){var _0x31d035={};_0x31d035[_0x508faa]={'$like':'%'+_0x1e849a['query'][_0x63c0('0x54')]+'%'};return _0x31d035;})});}_0xc38084=_['merge']({},_0xc38084,_0x1e849a[_0x63c0('0x57')]);return db[_0x63c0('0x98')][_0x63c0('0x34')]({'where':_0xc38084[_0x63c0('0x52')]})['then'](function(_0x57e565){_0x40cb3a['count']=_0x57e565;if(_0x1e849a[_0x63c0('0x48')][_0x63c0('0x59')]){_0xc38084[_0x63c0('0x5a')]=[{'model':db['CmContact'],'as':_0x63c0('0xaf'),'required':![]},{'model':db['User'],'as':_0x63c0('0xb0'),'attributes':['name',_0x63c0('0xb1'),'internal'],'required':![]},{'model':db[_0x63c0('0xb2')],'as':_0x63c0('0xb3'),'attributes':['id','name','color'],'where':_0x1e849a[_0x63c0('0x48')][_0x63c0('0xb4')]?{'id':_0x1e849a['query'][_0x63c0('0xb4')]}:undefined,'required':_0x1e849a[_0x63c0('0x48')][_0x63c0('0xb4')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0xc38084);})[_0x63c0('0x23')](function(_0x4b7ae7){_0x40cb3a['rows']=_0x4b7ae7;return _0x40cb3a;});}})[_0x63c0('0x23')](respondWithFilteredResult(_0x32555e,_0xc38084))['catch'](handleError(_0x32555e,null));};exports[_0x63c0('0xb5')]=function(_0x4bda6d,_0x19f08a,_0xe30703){return db[_0x63c0('0x58')][_0x63c0('0x5f')]({'where':{'id':_0x4bda6d[_0x63c0('0x6b')]['id']}})[_0x63c0('0x23')](handleEntityNotFound(_0x19f08a,null))[_0x63c0('0x23')](function(_0x254d6b){if(_0x254d6b){return _0x254d6b[_0x63c0('0xb5')](_0x4bda6d[_0x63c0('0x61')][_0x63c0('0x73')],_[_0x63c0('0xb6')](_0x4bda6d[_0x63c0('0x61')],[_0x63c0('0x73'),'id'])||{})['spread'](function(_0x53ceaa){for(var _0x4f05a5=0x0;_0x4f05a5<_0x4bda6d[_0x63c0('0x61')][_0x63c0('0x73')][_0x63c0('0x4e')];_0x4f05a5+=0x1){socket[_0x63c0('0xb7')](_0x63c0('0xb8'),{'UserId':Number(_0x4bda6d[_0x63c0('0x61')][_0x63c0('0x73')][_0x4f05a5]),'OpenchannelAccountId':Number(_0x4bda6d[_0x63c0('0x6b')]['id'])});}return _0x53ceaa;});}})['then'](respondWithResult(_0x19f08a,null))[_0x63c0('0x2d')](handleError(_0x19f08a,null));};exports['removeAgents']=function(_0x4602c8,_0x890175,_0x3658aa){return db[_0x63c0('0x58')][_0x63c0('0x5f')]({'where':{'id':_0x4602c8[_0x63c0('0x6b')]['id']}})[_0x63c0('0x23')](handleEntityNotFound(_0x890175,null))[_0x63c0('0x23')](function(_0x598b8f){if(_0x598b8f){return _0x598b8f[_0x63c0('0xb9')](_0x4602c8[_0x63c0('0x48')][_0x63c0('0x73')])[_0x63c0('0x23')](function(){if(_['isArray'](_0x4602c8[_0x63c0('0x48')][_0x63c0('0x73')])){for(var _0x3e0e4a=0x0;_0x3e0e4a<_0x4602c8[_0x63c0('0x48')]['ids'][_0x63c0('0x4e')];_0x3e0e4a+=0x1){socket[_0x63c0('0xb7')](_0x63c0('0xba'),{'UserId':Number(_0x4602c8['query'][_0x63c0('0x73')][_0x3e0e4a]),'OpenchannelAccountId':Number(_0x4602c8[_0x63c0('0x6b')]['id'])});}}else{socket[_0x63c0('0xb7')](_0x63c0('0xba'),{'UserId':Number(_0x4602c8['query'][_0x63c0('0x73')]),'OpenchannelAccountId':Number(_0x4602c8[_0x63c0('0x6b')]['id'])});}});}})[_0x63c0('0x23')](respondWithStatusCode(_0x890175,null))[_0x63c0('0x2d')](handleError(_0x890175,null));};exports[_0x63c0('0xbb')]=function(_0x45f98f,_0x33ad00,_0x11ed8e){var _0x2574db={};var _0x5c1022={};var _0x2d4a47;var _0x527ca4;return db[_0x63c0('0x58')][_0x63c0('0x6f')]({'where':{'id':_0x45f98f[_0x63c0('0x6b')]['id']}})[_0x63c0('0x23')](handleEntityNotFound(_0x33ad00,null))[_0x63c0('0x23')](function(_0x5dbccb){if(_0x5dbccb){_0x2d4a47=_0x5dbccb;_0x5c1022[_0x63c0('0x47')]=_[_0x63c0('0x49')](db[_0x63c0('0xa4')][_0x63c0('0x5e')]);_0x5c1022[_0x63c0('0x48')]=_[_0x63c0('0x49')](_0x45f98f[_0x63c0('0x48')]);_0x5c1022[_0x63c0('0x4a')]=_[_0x63c0('0x4b')](_0x5c1022[_0x63c0('0x47')],_0x5c1022[_0x63c0('0x48')]);_0x2574db[_0x63c0('0x4c')]=_[_0x63c0('0x4b')](_0x5c1022[_0x63c0('0x47')],qs[_0x63c0('0x4d')](_0x45f98f[_0x63c0('0x48')][_0x63c0('0x4d')]));_0x2574db[_0x63c0('0x4c')]=_0x2574db['attributes'][_0x63c0('0x4e')]?_0x2574db['attributes']:_0x5c1022[_0x63c0('0x47')];_0x2574db['order']=qs[_0x63c0('0x51')](_0x45f98f[_0x63c0('0x48')][_0x63c0('0x51')]);_0x2574db[_0x63c0('0x52')]=qs[_0x63c0('0x4a')](_[_0x63c0('0x53')](_0x45f98f[_0x63c0('0x48')],_0x5c1022['filters']));if(_0x45f98f[_0x63c0('0x48')][_0x63c0('0x54')]){_0x2574db['where']=_['merge'](_0x2574db[_0x63c0('0x52')],{'$or':_[_0x63c0('0x43')](_0x2574db['attributes'],function(_0x151cf5){var _0x263890={};_0x263890[_0x151cf5]={'$like':'%'+_0x45f98f[_0x63c0('0x48')][_0x63c0('0x54')]+'%'};return _0x263890;})});}_0x2574db=_[_0x63c0('0x55')]({},_0x2574db,_0x45f98f[_0x63c0('0x57')]);return _0x2d4a47[_0x63c0('0xbb')](_0x2574db);}})['then'](function(_0x1e0460){if(_0x1e0460){_0x527ca4=_0x1e0460[_0x63c0('0x4e')];if(!_0x45f98f['query'][_0x63c0('0x4f')]('nolimit')){_0x2574db[_0x63c0('0x35')]=qs[_0x63c0('0x35')](_0x45f98f[_0x63c0('0x48')][_0x63c0('0x35')]);_0x2574db[_0x63c0('0x32')]=qs[_0x63c0('0x32')](_0x45f98f[_0x63c0('0x48')][_0x63c0('0x32')]);}return _0x2d4a47['getAgents'](_0x2574db);}})[_0x63c0('0x23')](function(_0xb42058){if(_0xb42058){return _0xb42058?{'count':_0x527ca4,'rows':_0xb42058}:null;}})[_0x63c0('0x23')](respondWithResult(_0x33ad00,null))[_0x63c0('0x2d')](handleError(_0x33ad00,null));};exports['send']=function(_0x5529ac,_0x554899,_0x5da73c){var _0x1ae63d,_0x470ecb,_0x2c17ae;if(_[_0x63c0('0x7f')](_0x5529ac[_0x63c0('0x61')][_0x63c0('0x61')])||_0x5529ac['body']['body']===''){throw new db[(_0x63c0('0x81'))][(_0x63c0('0x79'))](_0x63c0('0x83'));}if(_[_0x63c0('0x7f')](_0x5529ac[_0x63c0('0x61')]['to'])){}_0x1ae63d=_0x5529ac[_0x63c0('0x61')]['to'];return db['OpenchannelAccount'][_0x63c0('0x6f')]({'where':{'id':_0x5529ac[_0x63c0('0x6b')]['id']}})['then'](handleEntityNotFound(_0x554899,null))['then'](function(_0x337a51){if(_0x337a51){return db[_0x63c0('0x58')][_0x63c0('0x5f')]({'where':{'id':_0x337a51['id']},'include':[{'model':db[_0x63c0('0xbc')],'as':'List','include':[{'model':db[_0x63c0('0x89')],'as':_0x63c0('0x8a'),'where':{[_0x337a51[_0x63c0('0x84')]]:_0x1ae63d},'limit':0x1,'order':[[_0x63c0('0x7c'),_0x63c0('0xbd')]]}]}]})[_0x63c0('0x23')](handleEntityNotFound(_0x554899,null))[_0x63c0('0x23')](function(_0x1977de){if(_0x1977de&&_0x1977de[_0x63c0('0x88')]){_0x470ecb=_0x1977de['get']({'plain':!![]});if(_0x470ecb[_0x63c0('0x88')]&&_0x470ecb[_0x63c0('0x88')][_0x63c0('0x8a')][_0x63c0('0x4e')]){return _0x470ecb[_0x63c0('0x88')][_0x63c0('0x8a')][0x0];}return db[_0x63c0('0x89')][_0x63c0('0x60')](_[_0x63c0('0x92')](_0x5529ac[_0x63c0('0x61')],{'firstName':_0x1ae63d,[_0x1977de[_0x63c0('0x84')]]:_0x1ae63d,'phone':_0x1ae63d,'ListId':_0x470ecb[_0x63c0('0x7e')]}));}})[_0x63c0('0x23')](handleEntityNotFound(_0x554899,null))[_0x63c0('0x23')](function(_0x1f7dbf){if(_0x1f7dbf){_0x2c17ae=_0x1f7dbf;return db[_0x63c0('0x98')]['find']({'where':{'ContactId':_0x2c17ae['id'],'closed':![],'OpenchannelAccountId':_0x470ecb['id']}})['then'](function(_0x518236){if(_0x518236){return[_0x518236,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x5529ac[_0x63c0('0x65')]['id'],'ContactId':_0x2c17ae['id'],'OpenchannelAccountId':_0x470ecb['id'],'lastMsgDirection':_0x63c0('0xbe'),'Messages':[_['merge'](_0x5529ac[_0x63c0('0x61')],{'read':![],'body':_0x5529ac['body'][_0x63c0('0x61')],'OpenchannelAccountId':_0x470ecb['id'],'UserId':_0x5529ac[_0x63c0('0x65')]['id'],'ContactId':_0x2c17ae['id']})]},{'include':[{'model':db[_0x63c0('0xa1')],'as':_0x63c0('0xbf')}]})[_0x63c0('0x23')](function(_0x246bfc){return[_0x246bfc,!![]];});});}})[_0x63c0('0xc0')](function(_0xa64730,_0x5184c2){if(_0x5184c2){return _0xa64730;}return db[_0x63c0('0xa1')][_0x63c0('0x60')](_['merge'](_0x5529ac[_0x63c0('0x61')],{'read':![],'body':_0x5529ac[_0x63c0('0x61')][_0x63c0('0x61')],'OpenchannelAccountId':_0x470ecb['id'],'OpenchannelInteractionId':_0xa64730['id'],'UserId':_0x5529ac[_0x63c0('0x65')]['id'],'ContactId':_0x2c17ae['id']}))[_0x63c0('0x23')](function(_0x5db252){_0xa64730['dataValues'][_0x63c0('0xbf')]=[];_0xa64730['dataValues'][_0x63c0('0xbf')][_0x63c0('0x9d')](_0x5db252[_0x63c0('0xc1')]);return _0xa64730;});});}})[_0x63c0('0x23')](respondWithResult(_0x554899,null))['catch'](handleError(_0x554899,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 3acea8a..b6276a3 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 _0xa74f=['remove','hasOwnProperty','hook','exports','OpenchannelAccount','update'];(function(_0xf613ff,_0x19cb1f){var _0x395e62=function(_0x1f50ad){while(--_0x1f50ad){_0xf613ff['push'](_0xf613ff['shift']());}};_0x395e62(++_0x19cb1f);}(_0xa74f,0x9a));var _0xfa74=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0xa74f[_0x31a576];return _0x30b1d3;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0xfa74('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfa74('0x1'),'afterDestroy':_0xfa74('0x2')};function emitEvent(_0x394a1e){return function(_0x25a9b7,_0x5b367b,_0x141625){OpenchannelAccountEvents['emit'](_0x394a1e+':'+_0x25a9b7['id'],_0x25a9b7);OpenchannelAccountEvents['emit'](_0x394a1e,_0x25a9b7);_0x141625(null);};}for(var e in events){if(events[_0xfa74('0x3')](e)){var event=events[e];OpenchannelAccount[_0xfa74('0x4')](e,emitEvent(event));}}module[_0xfa74('0x5')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xda55=['update','remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xda55,0x6d));var _0x5da5=function(_0x46b8d9,_0x431db3){_0x46b8d9=_0x46b8d9-0x0;var _0x383b8f=_0xda55[_0x46b8d9];return _0x383b8f;};'use strict';var EventEmitter=require(_0x5da5('0x0'));var OpenchannelAccount=require(_0x5da5('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5da5('0x2'),'afterUpdate':_0x5da5('0x3'),'afterDestroy':_0x5da5('0x4')};function emitEvent(_0x50cf9f){return function(_0x1c3afd,_0x5da254,_0x3400e9){OpenchannelAccountEvents['emit'](_0x50cf9f+':'+_0x1c3afd['id'],_0x1c3afd);OpenchannelAccountEvents[_0x5da5('0x5')](_0x50cf9f,_0x1c3afd);_0x3400e9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x5da5('0x6')](e,emitEvent(event));}}module[_0x5da5('0x7')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 80125a3..059c253 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(_0x329972,_0x55c84a){var _0x5808a5=function(_0x2a4e79){while(--_0x2a4e79){_0x329972['push'](_0x329972['shift']());}};_0x5808a5(++_0x55c84a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0xa56e60,_0x1449b6){var _0x8bfec6=function(_0x4bfd6e){while(--_0x4bfd6e){_0xa56e60['push'](_0xa56e60['shift']());}};_0x8bfec6(++_0x1449b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 95a307b..4a12173 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 _0xa902=['client','http','redis','./openchannelAccount.socket','register','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0xadbaeb,_0x13c8c9){var _0x3bb7f2=function(_0x4b4eb8){while(--_0x4b4eb8){_0xadbaeb['push'](_0xadbaeb['shift']());}};_0x3bb7f2(++_0x13c8c9);}(_0xa902,0x8d));var _0x2a90=function(_0x53926b,_0x13d461){_0x53926b=_0x53926b-0x0;var _0x2d6071=_0xa902[_0x53926b];return _0x2d6071;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});config[_0x2a90('0xb')]=_['defaults'](config[_0x2a90('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a90('0xb')]));require(_0x2a90('0xc'))[_0x2a90('0xd')](socket);function respondWithRpcPromise(_0x2b0a20,_0x18a60e,_0x56550f){return new BPromise(function(_0x361571,_0x3dadc2){return client[_0x2a90('0xe')](_0x2b0a20,_0x56550f)[_0x2a90('0xf')](function(_0x541e22){logger[_0x2a90('0x10')]('OpenchannelAccount,\x20%s,\x20%s',_0x18a60e,_0x2a90('0x11'));logger['debug'](_0x2a90('0x12'),_0x18a60e,'request\x20sent',JSON[_0x2a90('0x13')](_0x541e22));if(_0x541e22[_0x2a90('0x14')]){if(_0x541e22[_0x2a90('0x14')]['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x18a60e,_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);return _0x3dadc2(_0x541e22['error'][_0x2a90('0x15')]);}logger[_0x2a90('0x14')](_0x2a90('0x16'),_0x18a60e,_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);return _0x361571(_0x541e22[_0x2a90('0x14')][_0x2a90('0x15')]);}else{logger[_0x2a90('0x10')](_0x2a90('0x16'),_0x18a60e,'request\x20sent');_0x361571(_0x541e22[_0x2a90('0x17')][_0x2a90('0x15')]);}})[_0x2a90('0x18')](function(_0x52622c){logger[_0x2a90('0x14')](_0x2a90('0x16'),_0x18a60e,_0x52622c);_0x3dadc2(_0x52622c);});});} \ No newline at end of file +var _0x34b7=['redis','defaults','localhost','socket.io-emitter','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x377b59,_0x1f167d){var _0x2cae54=function(_0x292df1){while(--_0x292df1){_0x377b59['push'](_0x377b59['shift']());}};_0x2cae54(++_0x1f167d);}(_0x34b7,0x196));var _0x734b=function(_0x356596,_0x1a1a8c){_0x356596=_0x356596-0x0;var _0x231fa9=_0x34b7[_0x356596];return _0x231fa9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x734b('0x0'));var BPromise=require(_0x734b('0x1'));var rs=require(_0x734b('0x2'));var fs=require('fs');var Redis=require(_0x734b('0x3'));var db=require(_0x734b('0x4'))['db'];var utils=require(_0x734b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x734b('0x6'));var jayson=require(_0x734b('0x7'));var client=jayson[_0x734b('0x8')][_0x734b('0x9')]({'port':0x232a});config[_0x734b('0xa')]=_[_0x734b('0xb')](config['redis'],{'host':_0x734b('0xc'),'port':0x18eb});var socket=require(_0x734b('0xd'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x19a88e,_0x598dee,_0x43c5e0){return new BPromise(function(_0x333738,_0x2860a2){return client[_0x734b('0xe')](_0x19a88e,_0x43c5e0)[_0x734b('0xf')](function(_0x16e451){logger[_0x734b('0x10')](_0x734b('0x11'),_0x598dee,_0x734b('0x12'));logger[_0x734b('0x13')](_0x734b('0x14'),_0x598dee,_0x734b('0x12'),JSON[_0x734b('0x15')](_0x16e451));if(_0x16e451[_0x734b('0x16')]){if(_0x16e451['error'][_0x734b('0x17')]===0x1f4){logger[_0x734b('0x16')](_0x734b('0x11'),_0x598dee,_0x16e451[_0x734b('0x16')][_0x734b('0x18')]);return _0x2860a2(_0x16e451[_0x734b('0x16')][_0x734b('0x18')]);}logger[_0x734b('0x16')](_0x734b('0x11'),_0x598dee,_0x16e451[_0x734b('0x16')][_0x734b('0x18')]);return _0x333738(_0x16e451['error'][_0x734b('0x18')]);}else{logger[_0x734b('0x10')](_0x734b('0x11'),_0x598dee,_0x734b('0x12'));_0x333738(_0x16e451['result']['message']);}})[_0x734b('0x19')](function(_0x3033cd){logger[_0x734b('0x16')](_0x734b('0x11'),_0x598dee,_0x3033cd);_0x2860a2(_0x3033cd);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index c09015a..b88c01b 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 _0x7ae7=['openchannelAccount:','./openchannelAccount.events','save','update','emit','removeListener','register','length'];(function(_0x6a8452,_0x28e406){var _0xdd6acc=function(_0x4aa5a3){while(--_0x4aa5a3){_0x6a8452['push'](_0x6a8452['shift']());}};_0xdd6acc(++_0x28e406);}(_0x7ae7,0xd9));var _0x77ae=function(_0x3a47aa,_0x19d90e){_0x3a47aa=_0x3a47aa-0x0;var _0x146448=_0x7ae7[_0x3a47aa];return _0x146448;};'use strict';var OpenchannelAccountEvents=require(_0x77ae('0x0'));var events=[_0x77ae('0x1'),'remove',_0x77ae('0x2')];function createListener(_0x13da67,_0x176048){return function(_0xf7c23c){_0x176048[_0x77ae('0x3')](_0x13da67,_0xf7c23c);};}function removeListener(_0x897790,_0x1a4fc0){return function(){OpenchannelAccountEvents[_0x77ae('0x4')](_0x897790,_0x1a4fc0);};}exports[_0x77ae('0x5')]=function(_0x3dd200){for(var _0x276be6=0x0,_0x1fcff8=events[_0x77ae('0x6')];_0x276be6<_0x1fcff8;_0x276be6++){var _0x56197f=events[_0x276be6];var _0x131f0b=createListener(_0x77ae('0x7')+_0x56197f,_0x3dd200);OpenchannelAccountEvents['on'](_0x56197f,_0x131f0b);}}; \ No newline at end of file +var _0x5397=['emit','register','length','save','remove','update'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x5397,0x105));var _0x7539=function(_0xec8828,_0x4f3f68){_0xec8828=_0xec8828-0x0;var _0x4d7cc9=_0x5397[_0xec8828];return _0x4d7cc9;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x7539('0x0'),_0x7539('0x1'),_0x7539('0x2')];function createListener(_0x120f30,_0xad56a4){return function(_0x2f82e7){_0xad56a4[_0x7539('0x3')](_0x120f30,_0x2f82e7);};}function removeListener(_0x218a3a,_0x394310){return function(){OpenchannelAccountEvents['removeListener'](_0x218a3a,_0x394310);};}exports[_0x7539('0x4')]=function(_0x3486c2){for(var _0x4486c0=0x0,_0x2e3897=events[_0x7539('0x5')];_0x4486c0<_0x2e3897;_0x4486c0++){var _0x55b824=events[_0x4486c0];var _0x18ba43=createListener('openchannelAccount:'+_0x55b824,_0x3486c2);OpenchannelAccountEvents['on'](_0x55b824,_0x18ba43);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 05f3a4b..6f0961e 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 _0x363a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','show','create','put','delete','destroy','exports','util','path'];(function(_0x23d966,_0xe4e1b){var _0x5aed49=function(_0x18f77f){while(--_0x18f77f){_0x23d966['push'](_0x23d966['shift']());}};_0x5aed49(++_0xe4e1b);}(_0x363a,0x1c9));var _0xa363=function(_0x43841f,_0x4df0c4){_0x43841f=_0x43841f-0x0;var _0x417f61=_0x363a[_0x43841f];return _0x417f61;};'use strict';var multer=require('multer');var util=require(_0xa363('0x0'));var path=require(_0xa363('0x1'));var timeout=require(_0xa363('0x2'));var express=require(_0xa363('0x3'));var router=express[_0xa363('0x4')]();var fs_extra=require(_0xa363('0x5'));var auth=require(_0xa363('0x6'));var interaction=require(_0xa363('0x7'));var config=require('../../config/environment');var controller=require(_0xa363('0x8'));router[_0xa363('0x9')]('/',auth[_0xa363('0xa')](),controller['index']);router[_0xa363('0x9')]('/:id',auth[_0xa363('0xa')](),controller[_0xa363('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa363('0xc')]);router[_0xa363('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa363('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa363('0xf')]);module[_0xa363('0x10')]=router; \ No newline at end of file +var _0x9d5c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','create','delete','exports','multer','util'];(function(_0x4ecc5f,_0x5f5678){var _0x52fcb8=function(_0x17818b){while(--_0x17818b){_0x4ecc5f['push'](_0x4ecc5f['shift']());}};_0x52fcb8(++_0x5f5678);}(_0x9d5c,0x8e));var _0xc9d5=function(_0x5c49c2,_0x3a1dc9){_0x5c49c2=_0x5c49c2-0x0;var _0x363e8a=_0x9d5c[_0x5c49c2];return _0x363e8a;};'use strict';var multer=require(_0xc9d5('0x0'));var util=require(_0xc9d5('0x1'));var path=require('path');var timeout=require(_0xc9d5('0x2'));var express=require(_0xc9d5('0x3'));var router=express[_0xc9d5('0x4')]();var fs_extra=require(_0xc9d5('0x5'));var auth=require(_0xc9d5('0x6'));var interaction=require(_0xc9d5('0x7'));var config=require(_0xc9d5('0x8'));var controller=require(_0xc9d5('0x9'));router[_0xc9d5('0xa')]('/',auth[_0xc9d5('0xb')](),controller[_0xc9d5('0xc')]);router[_0xc9d5('0xa')](_0xc9d5('0xd'),auth[_0xc9d5('0xb')](),controller['show']);router[_0xc9d5('0xe')]('/',auth['isAuthenticated'](),controller[_0xc9d5('0xf')]);router['put'](_0xc9d5('0xd'),auth[_0xc9d5('0xb')](),controller['update']);router[_0xc9d5('0x10')](_0xc9d5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xc9d5('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 46e74b7..9e3ac91 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 _0x408f=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x5d284d,_0x3b89f1){var _0x1d758=function(_0x1d3afc){while(--_0x1d3afc){_0x5d284d['push'](_0x5d284d['shift']());}};_0x1d758(++_0x3b89f1);}(_0x408f,0xec));var _0xf408=function(_0x1a421a,_0x5c1a29){_0x1a421a=_0x1a421a-0x0;var _0x4cce81=_0x408f[_0x1a421a];return _0x4cce81;};'use strict';var Sequelize=require(_0xf408('0x0'));module[_0xf408('0x1')]={'priority':{'type':Sequelize[_0xf408('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf408('0x3')],'allowNull':![],'defaultValue':_0xf408('0x4')},'appdata':{'type':Sequelize[_0xf408('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf408('0x3')],'defaultValue':_0xf408('0x6')}}; \ No newline at end of file +var _0xc9be=['INTEGER','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x19882d,_0x3dee8b){var _0x6485fb=function(_0x4b6cca){while(--_0x4b6cca){_0x19882d['push'](_0x19882d['shift']());}};_0x6485fb(++_0x3dee8b);}(_0xc9be,0x1cc));var _0xec9b=function(_0x652c41,_0x156042){_0x652c41=_0x652c41-0x0;var _0x3156a6=_0xc9be[_0x652c41];return _0x3156a6;};'use strict';var Sequelize=require(_0xec9b('0x0'));module[_0xec9b('0x1')]={'priority':{'type':Sequelize[_0xec9b('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xec9b('0x3')]()},'description':{'type':Sequelize[_0xec9b('0x4')]},'interval':{'type':Sequelize[_0xec9b('0x4')],'defaultValue':_0xec9b('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a43c26e..0ff892e 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 _0x91f1=['moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','Content-Range','apply','update','destroy','then','end','sendStatus','error','name','send','map','OpenchannelApplication','fieldName','type','key','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','rawAttributes','intersection','length','catch','create','body','find','eml-format','rimraf','fast-json-patch'];(function(_0x3167de,_0x4ab6cf){var _0x13736b=function(_0x243a52){while(--_0x243a52){_0x3167de['push'](_0x3167de['shift']());}};_0x13736b(++_0x4ab6cf);}(_0x91f1,0x1b3));var _0x191f=function(_0x28c44a,_0x32c52a){_0x28c44a=_0x28c44a-0x0;var _0x425a26=_0x91f1[_0x28c44a];return _0x425a26;};'use strict';var emlformat=require(_0x191f('0x0'));var rimraf=require(_0x191f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x191f('0x2'));var rp=require('request-promise');var moment=require(_0x191f('0x3'));var BPromise=require(_0x191f('0x4'));var Mustache=require(_0x191f('0x5'));var util=require('util');var path=require(_0x191f('0x6'));var sox=require(_0x191f('0x7'));var csv=require(_0x191f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x191f('0x9'));var _=require(_0x191f('0xa'));var squel=require(_0x191f('0xb'));var crypto=require('crypto');var jsforce=require(_0x191f('0xc'));var deskjs=require(_0x191f('0xd'));var toCsv=require(_0x191f('0x8'));var querystring=require('querystring');var Papa=require(_0x191f('0xe'));var Redis=require(_0x191f('0xf'));var authService=require(_0x191f('0x10'));var qs=require(_0x191f('0x11'));var as=require(_0x191f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x191f('0x13'))(_0x191f('0x14'));var utils=require(_0x191f('0x15'));var config=require(_0x191f('0x16'));var licenseUtil=require(_0x191f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x180097,_0x26d77a){_0x26d77a=_0x26d77a||0xcc;return function(_0x24850d){if(_0x24850d){return _0x180097['sendStatus'](_0x26d77a);}return _0x180097['status'](_0x26d77a)['end']();};}function respondWithResult(_0x589815,_0x260709){_0x260709=_0x260709||0xc8;return function(_0x39f00e){if(_0x39f00e){return _0x589815[_0x191f('0x18')](_0x260709)[_0x191f('0x19')](_0x39f00e);}};}function respondWithFilteredResult(_0x7d4d0a,_0x39e2e3){return function(_0xdbf728){if(_0xdbf728){var _0xc00d56=typeof _0x39e2e3[_0x191f('0x1a')]==='undefined'&&typeof _0x39e2e3[_0x191f('0x1b')]==='undefined';var _0x2fe364=_0xdbf728[_0x191f('0x1c')];var _0x540d31=_0xc00d56?0x0:_0x39e2e3['offset'];var _0x2907b8=_0xc00d56?_0xdbf728['count']:_0x39e2e3[_0x191f('0x1a')]+_0x39e2e3['limit'];var _0x55859b;if(_0x2907b8>=_0x2fe364){_0x2907b8=_0x2fe364;_0x55859b=0xc8;}else{_0x55859b=0xce;}_0x7d4d0a[_0x191f('0x18')](_0x55859b);return _0x7d4d0a[_0x191f('0x1d')](_0x191f('0x1e'),_0x540d31+'-'+_0x2907b8+'/'+_0x2fe364)[_0x191f('0x19')](_0xdbf728);}return null;};}function patchUpdates(_0x3330c2){return function(_0x38853e){try{jsonpatch[_0x191f('0x1f')](_0x38853e,_0x3330c2,!![]);}catch(_0x1e7812){return BPromise['reject'](_0x1e7812);}return _0x38853e['save']();};}function saveUpdates(_0x316c66,_0x3657d8){return function(_0x2942a2){if(_0x2942a2){return _0x2942a2[_0x191f('0x20')](_0x316c66)['then'](function(_0xe9aca6){return _0xe9aca6;});}return null;};}function removeEntity(_0x28137f,_0x4226c0){return function(_0x4e23d5){if(_0x4e23d5){return _0x4e23d5[_0x191f('0x21')]()[_0x191f('0x22')](function(){_0x28137f[_0x191f('0x18')](0xcc)[_0x191f('0x23')]();});}};}function handleEntityNotFound(_0x1dacea,_0x40fae6){return function(_0x15c962){if(!_0x15c962){_0x1dacea[_0x191f('0x24')](0x194);}return _0x15c962;};}function handleError(_0xc32c65,_0x2753d6){_0x2753d6=_0x2753d6||0x1f4;return function(_0x441b62){logger[_0x191f('0x25')](_0x441b62['stack']);if(_0x441b62[_0x191f('0x26')]){delete _0x441b62['name'];}_0xc32c65[_0x191f('0x18')](_0x2753d6)[_0x191f('0x27')](_0x441b62);};}exports['index']=function(_0x451908,_0x4be518){var _0x5c8655={},_0x32ab43={},_0x3705da={'count':0x0,'rows':[]};var _0x54b135=_[_0x191f('0x28')](db[_0x191f('0x29')]['rawAttributes'],function(_0xfaf516){return{'name':_0xfaf516[_0x191f('0x2a')],'type':_0xfaf516[_0x191f('0x2b')][_0x191f('0x2c')]};});_0x32ab43[_0x191f('0x2d')]=_[_0x191f('0x28')](_0x54b135,_0x191f('0x26'));_0x32ab43['query']=_[_0x191f('0x2e')](_0x451908[_0x191f('0x2f')]);_0x32ab43[_0x191f('0x30')]=_['intersection'](_0x32ab43[_0x191f('0x2d')],_0x32ab43[_0x191f('0x2f')]);_0x5c8655[_0x191f('0x31')]=_['intersection'](_0x32ab43[_0x191f('0x2d')],qs[_0x191f('0x32')](_0x451908[_0x191f('0x2f')]['fields']));_0x5c8655[_0x191f('0x31')]=_0x5c8655[_0x191f('0x31')]['length']?_0x5c8655[_0x191f('0x31')]:_0x32ab43['model'];if(!_0x451908[_0x191f('0x2f')][_0x191f('0x33')](_0x191f('0x34'))){_0x5c8655[_0x191f('0x1b')]=qs[_0x191f('0x1b')](_0x451908['query'][_0x191f('0x1b')]);_0x5c8655['offset']=qs[_0x191f('0x1a')](_0x451908[_0x191f('0x2f')][_0x191f('0x1a')]);}_0x5c8655[_0x191f('0x35')]=qs[_0x191f('0x36')](_0x451908[_0x191f('0x2f')][_0x191f('0x36')]);_0x5c8655[_0x191f('0x37')]=qs[_0x191f('0x30')](_[_0x191f('0x38')](_0x451908[_0x191f('0x2f')],_0x32ab43[_0x191f('0x30')]),_0x54b135);if(_0x451908[_0x191f('0x2f')][_0x191f('0x39')]){_0x5c8655[_0x191f('0x37')]=_[_0x191f('0x3a')](_0x5c8655['where'],{'$or':_[_0x191f('0x28')](_0x54b135,function(_0xffff8e){if(_0xffff8e[_0x191f('0x2b')]!==_0x191f('0x3b')){var _0x51154f={};_0x51154f[_0xffff8e[_0x191f('0x26')]]={'$like':'%'+_0x451908[_0x191f('0x2f')][_0x191f('0x39')]+'%'};return _0x51154f;}})});}_0x5c8655=_[_0x191f('0x3a')]({},_0x5c8655,_0x451908[_0x191f('0x3c')]);var _0x44a434={'where':_0x5c8655['where']};return db['OpenchannelApplication']['count'](_0x44a434)[_0x191f('0x22')](function(_0x8149d0){_0x3705da[_0x191f('0x1c')]=_0x8149d0;if(_0x451908[_0x191f('0x2f')][_0x191f('0x3d')]){_0x5c8655[_0x191f('0x3e')]=[{'all':!![]}];}return db[_0x191f('0x29')][_0x191f('0x3f')](_0x5c8655);})[_0x191f('0x22')](function(_0x46da2d){_0x3705da['rows']=_0x46da2d;return _0x3705da;})['then'](respondWithFilteredResult(_0x4be518,_0x5c8655))['catch'](handleError(_0x4be518,null));};exports[_0x191f('0x40')]=function(_0x4daa77,_0x51e3c4){var _0x2b3e87={'raw':!![],'where':{'id':_0x4daa77[_0x191f('0x41')]['id']}},_0x3eb5f6={};_0x3eb5f6['model']=_[_0x191f('0x2e')](db[_0x191f('0x29')][_0x191f('0x42')]);_0x3eb5f6[_0x191f('0x2f')]=_['keys'](_0x4daa77[_0x191f('0x2f')]);_0x3eb5f6[_0x191f('0x30')]=_['intersection'](_0x3eb5f6[_0x191f('0x2d')],_0x3eb5f6[_0x191f('0x2f')]);_0x2b3e87[_0x191f('0x31')]=_[_0x191f('0x43')](_0x3eb5f6[_0x191f('0x2d')],qs[_0x191f('0x32')](_0x4daa77[_0x191f('0x2f')][_0x191f('0x32')]));_0x2b3e87[_0x191f('0x31')]=_0x2b3e87[_0x191f('0x31')][_0x191f('0x44')]?_0x2b3e87[_0x191f('0x31')]:_0x3eb5f6[_0x191f('0x2d')];if(_0x4daa77[_0x191f('0x2f')]['includeAll']){_0x2b3e87[_0x191f('0x3e')]=[{'all':!![]}];}_0x2b3e87=_[_0x191f('0x3a')]({},_0x2b3e87,_0x4daa77[_0x191f('0x3c')]);return db[_0x191f('0x29')]['find'](_0x2b3e87)[_0x191f('0x22')](handleEntityNotFound(_0x51e3c4,null))[_0x191f('0x22')](respondWithResult(_0x51e3c4,null))[_0x191f('0x45')](handleError(_0x51e3c4,null));};exports[_0x191f('0x46')]=function(_0x260ae0,_0x3edc34){return db[_0x191f('0x29')][_0x191f('0x46')](_0x260ae0['body'],{})[_0x191f('0x22')](respondWithResult(_0x3edc34,0xc9))['catch'](handleError(_0x3edc34,null));};exports[_0x191f('0x20')]=function(_0x5ec85e,_0x2c5072){if(_0x5ec85e[_0x191f('0x47')]['id']){delete _0x5ec85e[_0x191f('0x47')]['id'];}return db[_0x191f('0x29')][_0x191f('0x48')]({'where':{'id':_0x5ec85e[_0x191f('0x41')]['id']}})[_0x191f('0x22')](handleEntityNotFound(_0x2c5072,null))[_0x191f('0x22')](saveUpdates(_0x5ec85e['body'],null))['then'](respondWithResult(_0x2c5072,null))['catch'](handleError(_0x2c5072,null));};exports[_0x191f('0x21')]=function(_0x2d6a02,_0x58ba52){return db[_0x191f('0x29')][_0x191f('0x48')]({'where':{'id':_0x2d6a02[_0x191f('0x41')]['id']}})[_0x191f('0x22')](handleEntityNotFound(_0x58ba52,null))['then'](removeEntity(_0x58ba52,null))[_0x191f('0x45')](handleError(_0x58ba52,null));}; \ No newline at end of file +var _0x522c=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','keys','includeAll','catch','create','body','find','params','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x522c,0x1f2));var _0xc522=function(_0x125892,_0x53598a){_0x125892=_0x125892-0x0;var _0x36fa5e=_0x522c[_0x125892];return _0x36fa5e;};'use strict';var emlformat=require(_0xc522('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc522('0x1'));var rp=require(_0xc522('0x2'));var moment=require(_0xc522('0x3'));var BPromise=require(_0xc522('0x4'));var Mustache=require('mustache');var util=require(_0xc522('0x5'));var path=require(_0xc522('0x6'));var sox=require('sox');var csv=require(_0xc522('0x7'));var ejs=require(_0xc522('0x8'));var fs=require('fs');var fs_extra=require(_0xc522('0x9'));var _=require(_0xc522('0xa'));var squel=require(_0xc522('0xb'));var crypto=require(_0xc522('0xc'));var jsforce=require(_0xc522('0xd'));var deskjs=require(_0xc522('0xe'));var toCsv=require(_0xc522('0x7'));var querystring=require(_0xc522('0xf'));var Papa=require(_0xc522('0x10'));var Redis=require(_0xc522('0x11'));var authService=require(_0xc522('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc522('0x13'));var utils=require('../../config/utils');var config=require(_0xc522('0x14'));var licenseUtil=require(_0xc522('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a2492,_0x4f40dc){_0x4f40dc=_0x4f40dc||0xcc;return function(_0x5e5825){if(_0x5e5825){return _0x5a2492[_0xc522('0x16')](_0x4f40dc);}return _0x5a2492[_0xc522('0x17')](_0x4f40dc)[_0xc522('0x18')]();};}function respondWithResult(_0x3d1631,_0x16b651){_0x16b651=_0x16b651||0xc8;return function(_0x49cb8d){if(_0x49cb8d){return _0x3d1631[_0xc522('0x17')](_0x16b651)[_0xc522('0x19')](_0x49cb8d);}};}function respondWithFilteredResult(_0x58a4f5,_0x357e63){return function(_0x52c948){if(_0x52c948){var _0x277e2c=typeof _0x357e63[_0xc522('0x1a')]===_0xc522('0x1b')&&typeof _0x357e63[_0xc522('0x1c')]===_0xc522('0x1b');var _0x36f578=_0x52c948[_0xc522('0x1d')];var _0x449830=_0x277e2c?0x0:_0x357e63['offset'];var _0x162ddf=_0x277e2c?_0x52c948[_0xc522('0x1d')]:_0x357e63['offset']+_0x357e63[_0xc522('0x1c')];var _0x40c598;if(_0x162ddf>=_0x36f578){_0x162ddf=_0x36f578;_0x40c598=0xc8;}else{_0x40c598=0xce;}_0x58a4f5[_0xc522('0x17')](_0x40c598);return _0x58a4f5[_0xc522('0x1e')](_0xc522('0x1f'),_0x449830+'-'+_0x162ddf+'/'+_0x36f578)[_0xc522('0x19')](_0x52c948);}return null;};}function patchUpdates(_0x19776c){return function(_0x3a3144){try{jsonpatch[_0xc522('0x20')](_0x3a3144,_0x19776c,!![]);}catch(_0x418da9){return BPromise[_0xc522('0x21')](_0x418da9);}return _0x3a3144[_0xc522('0x22')]();};}function saveUpdates(_0x5365f4,_0x410d86){return function(_0x42281c){if(_0x42281c){return _0x42281c[_0xc522('0x23')](_0x5365f4)['then'](function(_0x2e695d){return _0x2e695d;});}return null;};}function removeEntity(_0x16af1d,_0x2db8d0){return function(_0x8108e8){if(_0x8108e8){return _0x8108e8[_0xc522('0x24')]()[_0xc522('0x25')](function(){_0x16af1d[_0xc522('0x17')](0xcc)[_0xc522('0x18')]();});}};}function handleEntityNotFound(_0x29df89,_0x4c094c){return function(_0x2dfbd1){if(!_0x2dfbd1){_0x29df89['sendStatus'](0x194);}return _0x2dfbd1;};}function handleError(_0x216eee,_0x54450c){_0x54450c=_0x54450c||0x1f4;return function(_0x175965){logger['error'](_0x175965['stack']);if(_0x175965[_0xc522('0x26')]){delete _0x175965[_0xc522('0x26')];}_0x216eee[_0xc522('0x17')](_0x54450c)[_0xc522('0x27')](_0x175965);};}exports[_0xc522('0x28')]=function(_0x2caa2a,_0x46f778){var _0x43f3d9={},_0x173be5={},_0x53f813={'count':0x0,'rows':[]};var _0x504b76=_[_0xc522('0x29')](db[_0xc522('0x2a')][_0xc522('0x2b')],function(_0x344a4a){return{'name':_0x344a4a[_0xc522('0x2c')],'type':_0x344a4a[_0xc522('0x2d')][_0xc522('0x2e')]};});_0x173be5['model']=_[_0xc522('0x29')](_0x504b76,_0xc522('0x26'));_0x173be5[_0xc522('0x2f')]=_['keys'](_0x2caa2a['query']);_0x173be5[_0xc522('0x30')]=_[_0xc522('0x31')](_0x173be5[_0xc522('0x32')],_0x173be5['query']);_0x43f3d9['attributes']=_[_0xc522('0x31')](_0x173be5[_0xc522('0x32')],qs[_0xc522('0x33')](_0x2caa2a['query'][_0xc522('0x33')]));_0x43f3d9[_0xc522('0x34')]=_0x43f3d9[_0xc522('0x34')][_0xc522('0x35')]?_0x43f3d9['attributes']:_0x173be5['model'];if(!_0x2caa2a[_0xc522('0x2f')][_0xc522('0x36')](_0xc522('0x37'))){_0x43f3d9[_0xc522('0x1c')]=qs[_0xc522('0x1c')](_0x2caa2a['query'][_0xc522('0x1c')]);_0x43f3d9[_0xc522('0x1a')]=qs[_0xc522('0x1a')](_0x2caa2a[_0xc522('0x2f')][_0xc522('0x1a')]);}_0x43f3d9[_0xc522('0x38')]=qs[_0xc522('0x39')](_0x2caa2a['query'][_0xc522('0x39')]);_0x43f3d9['where']=qs[_0xc522('0x30')](_[_0xc522('0x3a')](_0x2caa2a[_0xc522('0x2f')],_0x173be5[_0xc522('0x30')]),_0x504b76);if(_0x2caa2a['query'][_0xc522('0x3b')]){_0x43f3d9[_0xc522('0x3c')]=_[_0xc522('0x3d')](_0x43f3d9[_0xc522('0x3c')],{'$or':_[_0xc522('0x29')](_0x504b76,function(_0xf04fa6){if(_0xf04fa6['type']!==_0xc522('0x3e')){var _0x218cd7={};_0x218cd7[_0xf04fa6[_0xc522('0x26')]]={'$like':'%'+_0x2caa2a[_0xc522('0x2f')][_0xc522('0x3b')]+'%'};return _0x218cd7;}})});}_0x43f3d9=_[_0xc522('0x3d')]({},_0x43f3d9,_0x2caa2a[_0xc522('0x3f')]);var _0xbc0445={'where':_0x43f3d9['where']};return db[_0xc522('0x2a')][_0xc522('0x1d')](_0xbc0445)['then'](function(_0x48d249){_0x53f813['count']=_0x48d249;if(_0x2caa2a[_0xc522('0x2f')]['includeAll']){_0x43f3d9[_0xc522('0x40')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xc522('0x41')](_0x43f3d9);})[_0xc522('0x25')](function(_0x212168){_0x53f813[_0xc522('0x42')]=_0x212168;return _0x53f813;})[_0xc522('0x25')](respondWithFilteredResult(_0x46f778,_0x43f3d9))['catch'](handleError(_0x46f778,null));};exports['show']=function(_0x2d066d,_0xcb0e43){var _0xc5e076={'raw':!![],'where':{'id':_0x2d066d['params']['id']}},_0x142280={};_0x142280['model']=_[_0xc522('0x43')](db[_0xc522('0x2a')][_0xc522('0x2b')]);_0x142280[_0xc522('0x2f')]=_['keys'](_0x2d066d['query']);_0x142280[_0xc522('0x30')]=_['intersection'](_0x142280[_0xc522('0x32')],_0x142280[_0xc522('0x2f')]);_0xc5e076[_0xc522('0x34')]=_[_0xc522('0x31')](_0x142280[_0xc522('0x32')],qs[_0xc522('0x33')](_0x2d066d[_0xc522('0x2f')][_0xc522('0x33')]));_0xc5e076[_0xc522('0x34')]=_0xc5e076[_0xc522('0x34')][_0xc522('0x35')]?_0xc5e076[_0xc522('0x34')]:_0x142280[_0xc522('0x32')];if(_0x2d066d[_0xc522('0x2f')][_0xc522('0x44')]){_0xc5e076[_0xc522('0x40')]=[{'all':!![]}];}_0xc5e076=_[_0xc522('0x3d')]({},_0xc5e076,_0x2d066d[_0xc522('0x3f')]);return db[_0xc522('0x2a')]['find'](_0xc5e076)[_0xc522('0x25')](handleEntityNotFound(_0xcb0e43,null))[_0xc522('0x25')](respondWithResult(_0xcb0e43,null))[_0xc522('0x45')](handleError(_0xcb0e43,null));};exports[_0xc522('0x46')]=function(_0x2d2204,_0x35c97c){return db[_0xc522('0x2a')][_0xc522('0x46')](_0x2d2204[_0xc522('0x47')],{})[_0xc522('0x25')](respondWithResult(_0x35c97c,0xc9))[_0xc522('0x45')](handleError(_0x35c97c,null));};exports[_0xc522('0x23')]=function(_0x5747e0,_0x3321c0){if(_0x5747e0[_0xc522('0x47')]['id']){delete _0x5747e0['body']['id'];}return db[_0xc522('0x2a')][_0xc522('0x48')]({'where':{'id':_0x5747e0[_0xc522('0x49')]['id']}})['then'](handleEntityNotFound(_0x3321c0,null))['then'](saveUpdates(_0x5747e0[_0xc522('0x47')],null))[_0xc522('0x25')](respondWithResult(_0x3321c0,null))[_0xc522('0x45')](handleError(_0x3321c0,null));};exports[_0xc522('0x24')]=function(_0x42dbd4,_0x41bcfc){return db[_0xc522('0x2a')]['find']({'where':{'id':_0x42dbd4[_0xc522('0x49')]['id']}})[_0xc522('0x25')](handleEntityNotFound(_0x41bcfc,null))[_0xc522('0x25')](removeEntity(_0x41bcfc,null))[_0xc522('0x45')](handleError(_0x41bcfc,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 9336727..bcfc2de 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 _0xa154=['utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications'];(function(_0x5ef7b8,_0x15cc07){var _0x2c7148=function(_0x398519){while(--_0x398519){_0x5ef7b8['push'](_0x5ef7b8['shift']());}};_0x2c7148(++_0x15cc07);}(_0xa154,0x11f));var _0x4a15=function(_0x59f655,_0x1c12aa){_0x59f655=_0x59f655-0x0;var _0x1dbb6e=_0xa154[_0x59f655];return _0x1dbb6e;};'use strict';var _=require(_0x4a15('0x0'));var util=require(_0x4a15('0x1'));var logger=require(_0x4a15('0x2'))(_0x4a15('0x3'));var moment=require(_0x4a15('0x4'));var BPromise=require(_0x4a15('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a15('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4a15('0x7'));module[_0x4a15('0x8')]=function(_0x1208a0,_0x57304f){return _0x1208a0[_0x4a15('0x9')](_0x4a15('0xa'),attributes,{'tableName':_0x4a15('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4a15('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa633=['exports','define','OpenchannelApplication','utf8mb4','lodash','util','../../config/logger','api','bluebird','rimraf','./openchannelApplication.attributes'];(function(_0x30c2ae,_0x4c98a2){var _0x1ee1cc=function(_0x165922){while(--_0x165922){_0x30c2ae['push'](_0x30c2ae['shift']());}};_0x1ee1cc(++_0x4c98a2);}(_0xa633,0x164));var _0x3a63=function(_0x49764d,_0x29d032){_0x49764d=_0x49764d-0x0;var _0x4948e7=_0xa633[_0x49764d];return _0x4948e7;};'use strict';var _=require(_0x3a63('0x0'));var util=require(_0x3a63('0x1'));var logger=require(_0x3a63('0x2'))(_0x3a63('0x3'));var moment=require('moment');var BPromise=require(_0x3a63('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3a63('0x5'));var config=require('../../config/environment');var attributes=require(_0x3a63('0x6'));module[_0x3a63('0x7')]=function(_0xb78f23,_0x3bb1a9){return _0xb78f23[_0x3a63('0x8')](_0x3a63('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3a63('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 2409cae..410dc6a 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 _0x3308=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','info','result','catch','UpdateOpenchannelApplication','body','options','raw','where','limit','lodash','util'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x3308,0x1ce));var _0x8330=function(_0x402022,_0x437e51){_0x402022=_0x402022-0x0;var _0x165422=_0x3308[_0x402022];return _0x165422;};'use strict';var _=require(_0x8330('0x0'));var util=require(_0x8330('0x1'));var moment=require(_0x8330('0x2'));var BPromise=require(_0x8330('0x3'));var rs=require(_0x8330('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8330('0x5'))['db'];var utils=require(_0x8330('0x6'));var logger=require(_0x8330('0x7'))(_0x8330('0x8'));var config=require('../../config/environment');var jayson=require(_0x8330('0x9'));var client=jayson[_0x8330('0xa')][_0x8330('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e1511,_0x3afa73,_0x2c7953){return new BPromise(function(_0x422acd,_0x89f8c7){return client[_0x8330('0xc')](_0x2e1511,_0x2c7953)[_0x8330('0xd')](function(_0x217503){logger['info']('OpenchannelApplication,\x20%s,\x20%s',_0x3afa73,_0x8330('0xe'));logger['debug'](_0x8330('0xf'),_0x3afa73,_0x8330('0xe'),JSON[_0x8330('0x10')](_0x217503));if(_0x217503[_0x8330('0x11')]){if(_0x217503['error']['code']===0x1f4){logger[_0x8330('0x11')](_0x8330('0x12'),_0x3afa73,_0x217503[_0x8330('0x11')][_0x8330('0x13')]);return _0x89f8c7(_0x217503[_0x8330('0x11')][_0x8330('0x13')]);}logger['error'](_0x8330('0x12'),_0x3afa73,_0x217503[_0x8330('0x11')][_0x8330('0x13')]);return _0x422acd(_0x217503[_0x8330('0x11')][_0x8330('0x13')]);}else{logger[_0x8330('0x14')]('OpenchannelApplication,\x20%s,\x20%s',_0x3afa73,_0x8330('0xe'));_0x422acd(_0x217503[_0x8330('0x15')][_0x8330('0x13')]);}})[_0x8330('0x16')](function(_0x1df41d){logger[_0x8330('0x11')](_0x8330('0x12'),_0x3afa73,_0x1df41d);_0x89f8c7(_0x1df41d);});});}exports[_0x8330('0x17')]=function(_0x4d4ab9){var _0x556af2=this;return new Promise(function(_0x16984d,_0x12d3e7){return db['OpenchannelApplication']['update'](_0x4d4ab9[_0x8330('0x18')],{'raw':_0x4d4ab9[_0x8330('0x19')]?_0x4d4ab9[_0x8330('0x19')][_0x8330('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d4ab9[_0x8330('0x19')]?_0x4d4ab9[_0x8330('0x19')][_0x8330('0x1b')]||null:null,'attributes':_0x4d4ab9[_0x8330('0x19')]?_0x4d4ab9[_0x8330('0x19')]['attributes']||null:null,'limit':_0x4d4ab9[_0x8330('0x19')]?_0x4d4ab9[_0x8330('0x19')][_0x8330('0x1c')]||null:null})[_0x8330('0xd')](function(_0x925c47){logger['info'](_0x8330('0x17'),_0x4d4ab9);logger['debug']('UpdateOpenchannelApplication',_0x4d4ab9,JSON[_0x8330('0x10')](_0x925c47));_0x16984d(_0x925c47);})[_0x8330('0x16')](function(_0x48f926){logger[_0x8330('0x11')](_0x8330('0x17'),_0x48f926[_0x8330('0x13')],_0x4d4ab9);_0x12d3e7(_0x556af2[_0x8330('0x11')](0x1f4,_0x48f926[_0x8330('0x13')]));});});}; \ No newline at end of file +var _0xa86b=['request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','update','body','options','where','attributes','limit','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x2e0443,_0x7e5974){var _0x52d450=function(_0x3a9985){while(--_0x3a9985){_0x2e0443['push'](_0x2e0443['shift']());}};_0x52d450(++_0x7e5974);}(_0xa86b,0xac));var _0xba86=function(_0x2b2814,_0x244e1c){_0x2b2814=_0x2b2814-0x0;var _0x545e19=_0xa86b[_0x2b2814];return _0x545e19;};'use strict';var _=require(_0xba86('0x0'));var util=require(_0xba86('0x1'));var moment=require(_0xba86('0x2'));var BPromise=require(_0xba86('0x3'));var rs=require(_0xba86('0x4'));var fs=require('fs');var Redis=require(_0xba86('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xba86('0x6'));var logger=require(_0xba86('0x7'))('rpc');var config=require(_0xba86('0x8'));var jayson=require(_0xba86('0x9'));var client=jayson[_0xba86('0xa')][_0xba86('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a0e67,_0x2ddac3,_0x45605d){return new BPromise(function(_0x58f578,_0x44f597){return client[_0xba86('0xc')](_0x1a0e67,_0x45605d)['then'](function(_0x37e996){logger[_0xba86('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x2ddac3,_0xba86('0xe'));logger['debug'](_0xba86('0xf'),_0x2ddac3,_0xba86('0xe'),JSON[_0xba86('0x10')](_0x37e996));if(_0x37e996[_0xba86('0x11')]){if(_0x37e996[_0xba86('0x11')]['code']===0x1f4){logger[_0xba86('0x11')](_0xba86('0x12'),_0x2ddac3,_0x37e996[_0xba86('0x11')][_0xba86('0x13')]);return _0x44f597(_0x37e996[_0xba86('0x11')][_0xba86('0x13')]);}logger['error'](_0xba86('0x12'),_0x2ddac3,_0x37e996[_0xba86('0x11')][_0xba86('0x13')]);return _0x58f578(_0x37e996[_0xba86('0x11')][_0xba86('0x13')]);}else{logger[_0xba86('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x2ddac3,_0xba86('0xe'));_0x58f578(_0x37e996[_0xba86('0x14')][_0xba86('0x13')]);}})[_0xba86('0x15')](function(_0x3bb0ed){logger[_0xba86('0x11')](_0xba86('0x12'),_0x2ddac3,_0x3bb0ed);_0x44f597(_0x3bb0ed);});});}exports[_0xba86('0x16')]=function(_0x2a35b3){var _0xb61e22=this;return new Promise(function(_0x5c2913,_0x40d4f6){return db['OpenchannelApplication'][_0xba86('0x17')](_0x2a35b3[_0xba86('0x18')],{'raw':_0x2a35b3['options']?_0x2a35b3[_0xba86('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a35b3[_0xba86('0x19')]?_0x2a35b3[_0xba86('0x19')][_0xba86('0x1a')]||null:null,'attributes':_0x2a35b3[_0xba86('0x19')]?_0x2a35b3[_0xba86('0x19')][_0xba86('0x1b')]||null:null,'limit':_0x2a35b3['options']?_0x2a35b3['options'][_0xba86('0x1c')]||null:null})[_0xba86('0x1d')](function(_0xf83f4a){logger[_0xba86('0xd')]('UpdateOpenchannelApplication',_0x2a35b3);logger[_0xba86('0x1e')]('UpdateOpenchannelApplication',_0x2a35b3,JSON[_0xba86('0x10')](_0xf83f4a));_0x5c2913(_0xf83f4a);})['catch'](function(_0x176df2){logger['error'](_0xba86('0x16'),_0x176df2[_0xba86('0x13')],_0x2a35b3);_0x40d4f6(_0xb61e22[_0xba86('0x11')](0x1f4,_0x176df2[_0xba86('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index cb8016b..5a6dd7a 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 _0xde04=['destroy','delete','removeTags','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','openchannelinteraction:destroy'];(function(_0x2702c4,_0x40106f){var _0x5e7434=function(_0x22d716){while(--_0x22d716){_0x2702c4['push'](_0x2702c4['shift']());}};_0x5e7434(++_0x40106f);}(_0xde04,0x95));var _0x4de0=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xde04[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x4de0('0x0'));var util=require(_0x4de0('0x1'));var path=require('path');var timeout=require(_0x4de0('0x2'));var express=require('express');var router=express[_0x4de0('0x3')]();var fs_extra=require(_0x4de0('0x4'));var auth=require(_0x4de0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x4de0('0x6')](),controller[_0x4de0('0x7')]);router['get'](_0x4de0('0x8'),auth['isAuthenticated'](),controller[_0x4de0('0x9')]);router[_0x4de0('0xa')](_0x4de0('0xb'),auth[_0x4de0('0x6')](),controller[_0x4de0('0xc')]);router[_0x4de0('0xa')](_0x4de0('0xd'),auth[_0x4de0('0x6')](),controller[_0x4de0('0xe')]);router[_0x4de0('0xa')](_0x4de0('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x4de0('0x10')]('/',auth[_0x4de0('0x6')](),controller['create']);router[_0x4de0('0x10')](_0x4de0('0xd'),auth[_0x4de0('0x6')](),controller[_0x4de0('0x11')]);router[_0x4de0('0x10')](_0x4de0('0x12'),auth['isAuthenticated'](),interaction[_0x4de0('0x13')](_0x4de0('0x14'),_0x4de0('0x15')),controller[_0x4de0('0x16')]);router['put'](_0x4de0('0xb'),auth['isAuthenticated'](),interaction[_0x4de0('0x13')]('openchannel',_0x4de0('0x17')),controller['update']);router['delete'](_0x4de0('0xb'),auth[_0x4de0('0x6')](),interaction[_0x4de0('0x13')](_0x4de0('0x14'),_0x4de0('0x18')),controller[_0x4de0('0x19')]);router[_0x4de0('0x1a')](_0x4de0('0x12'),auth[_0x4de0('0x6')](),controller[_0x4de0('0x1b')]);module[_0x4de0('0x1c')]=router; \ No newline at end of file +var _0x9267=['post','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','/:id','openchannel','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/messages','getMessages','/:id/download','download'];(function(_0x5d85f0,_0x74d66a){var _0x151e2c=function(_0x1cd129){while(--_0x1cd129){_0x5d85f0['push'](_0x5d85f0['shift']());}};_0x151e2c(++_0x74d66a);}(_0x9267,0x1ef));var _0x7926=function(_0x2efcca,_0x2c69b5){_0x2efcca=_0x2efcca-0x0;var _0x406d96=_0x9267[_0x2efcca];return _0x406d96;};'use strict';var multer=require(_0x7926('0x0'));var util=require(_0x7926('0x1'));var path=require(_0x7926('0x2'));var timeout=require(_0x7926('0x3'));var express=require('express');var router=express[_0x7926('0x4')]();var fs_extra=require(_0x7926('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7926('0x6'));var config=require(_0x7926('0x7'));var controller=require('./openchannelInteraction.controller');router[_0x7926('0x8')]('/',auth[_0x7926('0x9')](),controller['index']);router[_0x7926('0x8')](_0x7926('0xa'),auth[_0x7926('0x9')](),controller[_0x7926('0xb')]);router['get']('/:id',auth[_0x7926('0x9')](),controller[_0x7926('0xc')]);router['get'](_0x7926('0xd'),auth[_0x7926('0x9')](),controller[_0x7926('0xe')]);router[_0x7926('0x8')](_0x7926('0xf'),auth[_0x7926('0x9')](),controller[_0x7926('0x10')]);router[_0x7926('0x11')]('/',auth[_0x7926('0x9')](),controller['create']);router[_0x7926('0x11')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x7926('0x12'),auth[_0x7926('0x9')](),interaction[_0x7926('0x13')]('openchannel',_0x7926('0x14')),controller[_0x7926('0x15')]);router[_0x7926('0x16')](_0x7926('0x17'),auth[_0x7926('0x9')](),interaction[_0x7926('0x13')](_0x7926('0x18'),_0x7926('0x19')),controller[_0x7926('0x1a')]);router['delete'](_0x7926('0x17'),auth[_0x7926('0x9')](),interaction[_0x7926('0x13')](_0x7926('0x18'),_0x7926('0x1b')),controller[_0x7926('0x1c')]);router[_0x7926('0x1d')](_0x7926('0x12'),auth[_0x7926('0x9')](),controller[_0x7926('0x1e')]);module[_0x7926('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 13bd14d..211f98c 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 _0x10c4=['STRING','ENUM','out','sequelize','BOOLEAN','DATE'];(function(_0x4c84c9,_0x4d200e){var _0x3707fd=function(_0x19113a){while(--_0x19113a){_0x4c84c9['push'](_0x4c84c9['shift']());}};_0x3707fd(++_0x4d200e);}(_0x10c4,0x16b));var _0x410c=function(_0x410260,_0x3a83df){_0x410260=_0x410260-0x0;var _0x56ead7=_0x10c4[_0x410260];return _0x56ead7;};'use strict';var Sequelize=require(_0x410c('0x0'));module['exports']={'closed':{'type':Sequelize[_0x410c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x410c('0x2')]},'disposition':{'type':Sequelize[_0x410c('0x3')]},'secondDisposition':{'type':Sequelize[_0x410c('0x3')]},'thirdDisposition':{'type':Sequelize[_0x410c('0x3')]},'note':{'type':Sequelize[_0x410c('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x410c('0x3')]},'externalUrl':{'type':Sequelize[_0x410c('0x3')]},'lastMsgAt':{'type':Sequelize[_0x410c('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x410c('0x4')]('in',_0x410c('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x410c('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x410c('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0xedd9=['exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xedd9,0xfc));var _0x9edd=function(_0x242582,_0x12d90d){_0x242582=_0x242582-0x0;var _0x382e33=_0xedd9[_0x242582];return _0x382e33;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'closed':{'type':Sequelize[_0x9edd('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9edd('0x2')]},'disposition':{'type':Sequelize[_0x9edd('0x3')]},'secondDisposition':{'type':Sequelize[_0x9edd('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9edd('0x3')]},'note':{'type':Sequelize[_0x9edd('0x3')]},'read1stAt':{'type':Sequelize[_0x9edd('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x9edd('0x3')]},'lastMsgAt':{'type':Sequelize[_0x9edd('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x9edd('0x4')]('in',_0x9edd('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x9edd('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 84d7cae..5ec4b23 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 _0x97ae=['params','includeAll','include','options','catch','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','disposition','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','renderFile','downloadInteraction.ejs','.pdf','log','err','unlinkSync','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','OpenchannelInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','search','parseSearch','sqlOperator','conditions','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','type','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','body','some','compact','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','having','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','role','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','OpenchannelInteractionId','rows'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x97ae,0x12b));var _0xe97a=function(_0x3fca7f,_0x1a048e){_0x3fca7f=_0x3fca7f-0x0;var _0x3d71cd=_0x97ae[_0x3fca7f];return _0x3d71cd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe97a('0x0'));var jsonpatch=require(_0xe97a('0x1'));var rp=require(_0xe97a('0x2'));var moment=require(_0xe97a('0x3'));var BPromise=require(_0xe97a('0x4'));var Mustache=require(_0xe97a('0x5'));var util=require(_0xe97a('0x6'));var path=require(_0xe97a('0x7'));var sox=require('sox');var csv=require(_0xe97a('0x8'));var ejs=require(_0xe97a('0x9'));var fs=require('fs');var fs_extra=require(_0xe97a('0xa'));var _=require(_0xe97a('0xb'));var squel=require(_0xe97a('0xc'));var crypto=require('crypto');var jsforce=require(_0xe97a('0xd'));var deskjs=require(_0xe97a('0xe'));var toCsv=require(_0xe97a('0x8'));var querystring=require(_0xe97a('0xf'));var Papa=require(_0xe97a('0x10'));var Redis=require('ioredis');var authService=require(_0xe97a('0x11'));var qs=require(_0xe97a('0x12'));var as=require(_0xe97a('0x13'));var pdf=require(_0xe97a('0x14'));var hardwareService=require(_0xe97a('0x15'));var logger=require(_0xe97a('0x16'))(_0xe97a('0x17'));var utils=require('../../config/utils');var config=require(_0xe97a('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe97a('0x19')]=_['defaults'](config['redis'],{'host':_0xe97a('0x1a'),'port':0x18eb});var socket=require(_0xe97a('0x1b'))(new Redis(config[_0xe97a('0x19')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithStatusCode(_0x56efa4,_0x22683d){_0x22683d=_0x22683d||0xcc;return function(_0xbae7e6){if(_0xbae7e6){return _0x56efa4[_0xe97a('0x1c')](_0x22683d);}return _0x56efa4[_0xe97a('0x1d')](_0x22683d)[_0xe97a('0x1e')]();};}function respondWithResult(_0x3a18b0,_0x307e60){_0x307e60=_0x307e60||0xc8;return function(_0x54ba12){if(_0x54ba12){return _0x3a18b0[_0xe97a('0x1d')](_0x307e60)[_0xe97a('0x1f')](_0x54ba12);}};}function respondWithFilteredResult(_0x437f4b,_0x24e5d2){return function(_0x2cbe81){if(_0x2cbe81){var _0x492aa8=typeof _0x24e5d2[_0xe97a('0x20')]==='undefined'&&typeof _0x24e5d2[_0xe97a('0x21')]===_0xe97a('0x22');var _0x4e1aa9=_0x2cbe81[_0xe97a('0x23')];var _0xb7b2ab=_0x492aa8?0x0:_0x24e5d2[_0xe97a('0x20')];var _0x4bb5c4=_0x492aa8?_0x2cbe81[_0xe97a('0x23')]:_0x24e5d2['offset']+_0x24e5d2[_0xe97a('0x21')];var _0x5d1ebc;if(_0x4bb5c4>=_0x4e1aa9){_0x4bb5c4=_0x4e1aa9;_0x5d1ebc=0xc8;}else{_0x5d1ebc=0xce;}_0x437f4b[_0xe97a('0x1d')](_0x5d1ebc);return _0x437f4b[_0xe97a('0x24')]('Content-Range',_0xb7b2ab+'-'+_0x4bb5c4+'/'+_0x4e1aa9)['json'](_0x2cbe81);}return null;};}function patchUpdates(_0x5d9558){return function(_0x1d9557){try{jsonpatch['apply'](_0x1d9557,_0x5d9558,!![]);}catch(_0x390d31){return BPromise[_0xe97a('0x25')](_0x390d31);}return _0x1d9557[_0xe97a('0x26')]();};}function saveUpdates(_0x537ba2,_0x578df8){return function(_0x5f0845){if(_0x5f0845){return _0x5f0845[_0xe97a('0x27')](_0x537ba2)[_0xe97a('0x28')](function(_0x3db158){return _0x3db158;});}return null;};}function removeEntity(_0xa5fe32,_0x55e578){return function(_0x27f65c){if(_0x27f65c){return _0x27f65c[_0xe97a('0x29')]()['then'](function(){_0xa5fe32[_0xe97a('0x1d')](0xcc)[_0xe97a('0x1e')]();});}};}function handleEntityNotFound(_0x101292,_0x1af1df){return function(_0x545d43){if(!_0x545d43){_0x101292[_0xe97a('0x1c')](0x194);}return _0x545d43;};}function handleError(_0x1e32ef,_0x28fece){_0x28fece=_0x28fece||0x1f4;return function(_0x10b3e3){logger[_0xe97a('0x2a')](_0x10b3e3[_0xe97a('0x2b')]);if(_0x10b3e3['name']){delete _0x10b3e3[_0xe97a('0x2c')];}_0x1e32ef['status'](_0x28fece)[_0xe97a('0x2d')](_0x10b3e3);};}function getInteractionUsers(_0x48df30,_0x270885){return new BPromise(function(_0x53e744,_0x20597c){try{if(_0x270885[_0x48df30['id']]){_0x48df30[_0xe97a('0x2e')]=_[_0xe97a('0x2f')](_0x270885[_0x48df30['id']],function(_0x2f157d){return{'id':_0x2f157d['id'],'fullname':_0x2f157d[_0xe97a('0x30')]};});}}catch(_0x2bfc12){_0x20597c(_0x2bfc12);}_0x53e744(_0x48df30);});}function getInteractionTags(_0x14135b,_0x69b7c1){return new BPromise(function(_0x1c6ee0,_0x2a7433){try{if(_0x14135b[_0xe97a('0x31')]){_0x14135b[_0xe97a('0x32')]=[];_0x14135b[_0xe97a('0x31')][_0xe97a('0x33')](',')[_0xe97a('0x34')](function(_0x4b550f){_0x14135b[_0xe97a('0x32')][_0xe97a('0x35')](_0x69b7c1[_0x4b550f]);});}delete _0x14135b[_0xe97a('0x31')];}catch(_0xd16952){_0x2a7433(_0xd16952);}_0x1c6ee0(_0x14135b);});}function updateOpenchannelInteraction(_0x5ee70d,_0x2adf85,_0x24aa14){return new BPromise(function(_0x57d417,_0x30d983){return getInteractionUsers(_0x5ee70d,_0x24aa14)[_0xe97a('0x28')](function(_0x4e4a63){return getInteractionTags(_0x4e4a63,_0x2adf85);})[_0xe97a('0x28')](function(_0x151cdd){_0x57d417(_0x151cdd);})['catch'](function(_0x42fd2e){_0x30d983(_0x42fd2e);});});}exports['index']=function(_0x5bdec7,_0x897763){var _0x548c5c={},_0x2eb57c={},_0x192761={'count':0x0,'rows':[]};var _0x40ab6a=_[_0xe97a('0x2f')](db[_0xe97a('0x36')][_0xe97a('0x37')],function(_0x4d02cf){return{'name':_0x4d02cf[_0xe97a('0x38')],'type':_0x4d02cf['type'][_0xe97a('0x39')]};});_0x2eb57c[_0xe97a('0x3a')]=_['map'](_0x40ab6a,_0xe97a('0x2c'));_0x2eb57c[_0xe97a('0x3b')]=_[_0xe97a('0x3c')](_0x5bdec7['query']);_0x2eb57c[_0xe97a('0x3d')]=_[_0xe97a('0x3e')](_0x2eb57c[_0xe97a('0x3a')],_0x2eb57c[_0xe97a('0x3b')]);_0x548c5c['attributes']=_[_0xe97a('0x3e')](_0x2eb57c[_0xe97a('0x3a')],qs[_0xe97a('0x3f')](_0x5bdec7[_0xe97a('0x3b')][_0xe97a('0x3f')]));_0x548c5c['attributes']=_0x548c5c[_0xe97a('0x40')][_0xe97a('0x41')]?_0x548c5c[_0xe97a('0x40')]:_0x2eb57c['model'];if(!_0x5bdec7[_0xe97a('0x3b')][_0xe97a('0x42')](_0xe97a('0x43'))){_0x548c5c[_0xe97a('0x21')]=qs['limit'](_0x5bdec7[_0xe97a('0x3b')][_0xe97a('0x21')]);_0x548c5c[_0xe97a('0x20')]=qs[_0xe97a('0x20')](_0x5bdec7[_0xe97a('0x3b')][_0xe97a('0x20')]);}_0x548c5c[_0xe97a('0x44')]=qs[_0xe97a('0x45')](_0x5bdec7[_0xe97a('0x3b')][_0xe97a('0x45')]);_0x548c5c[_0xe97a('0x46')]=qs[_0xe97a('0x3d')](_[_0xe97a('0x47')](_0x5bdec7['query'],_0x2eb57c['filters']),_0x40ab6a);var _0x2d217c=[];var _0x231d64=squel[_0xe97a('0x48')]()[_0xe97a('0x49')]('id')[_0xe97a('0x49')]('name')[_0xe97a('0x49')](_0xe97a('0x4a'))[_0xe97a('0x4b')]('tools_tags');var _0x37d252=squel['select']()['field']('u.id')[_0xe97a('0x49')](_0xe97a('0x4c'))['field'](_0xe97a('0x4d'))[_0xe97a('0x4b')](_0xe97a('0x4e'),'ui')[_0xe97a('0x4f')](_0xe97a('0x50'),'u',_0xe97a('0x51'));var _0x2bd802=squel[_0xe97a('0x48')]()[_0xe97a('0x4b')](_0xe97a('0x52'),'i')[_0xe97a('0x4f')]('cm_contacts','c',_0xe97a('0x53'))[_0xe97a('0x4f')](_0xe97a('0x50'),'o',_0xe97a('0x54'))['left_join'](_0xe97a('0x55'),'a',_0xe97a('0x56'))[_0xe97a('0x4f')](_0xe97a('0x57'),'me',_0xe97a('0x58'))[_0xe97a('0x4f')](_0xe97a('0x59'),'it',_0xe97a('0x5a'))[_0xe97a('0x4f')](_0xe97a('0x5b'),'t','t.id\x20=\x20it.TagId');var _0x59876e=squel['expr']();var _0x3d5ebb=[];var _0x47e244=squel['expr']();var _0x394567;if(_0x5bdec7[_0xe97a('0x3b')][_0xe97a('0x5c')]){_0x394567=as[_0xe97a('0x5d')](_0x5bdec7[_0xe97a('0x3b')][_0xe97a('0x5c')]);var _0xcc66f7=_0x394567[_0xe97a('0x5e')];for(var _0x436daf=0x0;_0x436daf<_0x394567['conditions'][_0xe97a('0x41')];_0x436daf++){var _0x173679=_0x394567[_0xe97a('0x5f')][_0x436daf];var _0x2717a6='i';var _0x27a615=_['find'](_0x40ab6a,[_0xe97a('0x2c'),_0x173679[_0xe97a('0x49')]]);if(!_0x27a615){switch(_0x173679[_0xe97a('0x49')]){case'unreadMessages':if(_0x173679[_0xe97a('0x60')]==0x1){_0x2bd802['having']('`'+_0x173679[_0xe97a('0x49')]+_0xe97a('0x61'));}else{_0x2bd802['having']('`'+_0x173679[_0xe97a('0x49')]+_0xe97a('0x62'));}break;case _0xe97a('0x63'):if(_0x173679[_0xe97a('0x64')]===_0xe97a('0x65')){if(_0x173679[_0xe97a('0x60')][_0xe97a('0x33')]('\x20')['length']>0x1){_0x59876e[_0xcc66f7](_0xe97a('0x66'),qs[_0xe97a('0x67')](_0x173679[_0xe97a('0x60')]),null);}else{var _0x105976='%'+_0x173679[_0xe97a('0x60')]+'%';_0x59876e[_0xcc66f7](_0xe97a('0x68'),_0x105976,_0x105976,_0x105976);}}else{_0x27a615=_['find'](_0x40ab6a,['name',_0xe97a('0x69')]);_0x173679[_0xe97a('0x49')]=_0xe97a('0x69');_0x26bc20=as['buildExpression'](_0x2717a6,_0x27a615[_0xe97a('0x6a')],_0x173679);_0x59876e[_0xcc66f7](_0x26bc20[_0xe97a('0x6b')],_0x26bc20['value'][_0xe97a('0x6c')],_0x26bc20[_0xe97a('0x60')][_0xe97a('0x1e')]);}break;case _0xe97a('0x6d'):var _0x56d404=_0x173679[_0xe97a('0x60')]['split'](',')[_0xe97a('0x2f')](function(_0x2f4242){return Number(_0x2f4242);});_0x56d404['forEach'](function(_0x115cf5){_0x47e244['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x115cf5+',%');});_0x3d5ebb=_[_0xe97a('0x6e')](_0x3d5ebb,_0x56d404);break;case _0xe97a('0x6f'):if(_0x173679[_0xe97a('0x64')]===_0xe97a('0x65')){_0x59876e[_0xcc66f7](_0xe97a('0x70'),'%'+_0x173679[_0xe97a('0x60')]+'%',null);}else{_0x27a615=_[_0xe97a('0x71')](_0x40ab6a,[_0xe97a('0x2c'),_0xe97a('0x72')]);_0x173679[_0xe97a('0x49')]='UserId';_0x26bc20=as[_0xe97a('0x73')](_0x2717a6,_0x27a615[_0xe97a('0x6a')],_0x173679);_0x59876e[_0xcc66f7](_0x26bc20[_0xe97a('0x6b')],_0x26bc20['value'][_0xe97a('0x6c')],_0x26bc20[_0xe97a('0x60')][_0xe97a('0x1e')]);}break;case _0xe97a('0x74'):_0x26bc20=as['buildExpression']('me',null,_0x173679);_0x59876e[_0xcc66f7](_0x26bc20[_0xe97a('0x6b')],_0x26bc20['value']['start'],_0x26bc20[_0xe97a('0x60')][_0xe97a('0x1e')]);break;}}else{var _0x26bc20=as[_0xe97a('0x73')](_0x2717a6,_0x27a615[_0xe97a('0x6a')],_0x173679);_0x59876e[_0xcc66f7](_0x26bc20[_0xe97a('0x6b')],_0x26bc20['value'][_0xe97a('0x6c')],_0x26bc20[_0xe97a('0x60')][_0xe97a('0x1e')]);}}}else{var _0x2bc09c=_(_0x5bdec7[_0xe97a('0x3b')])['keys']()[_0xe97a('0x2f')](function(_0xf5df6d){return _[_0xe97a('0x75')](_0x40ab6a,[_0xe97a('0x2c'),_0xf5df6d])?_0xf5df6d:undefined;})[_0xe97a('0x76')]()[_0xe97a('0x60')]();if(!_['isEmpty'](_0x2bc09c)){_0x2bc09c[_0xe97a('0x34')](function(_0xa6beff){if(_0xa6beff===_0xe97a('0x77')){_0x2bd802['where'](_0xe97a('0x78'),[][_0xe97a('0x79')](_0x5bdec7[_0xe97a('0x3b')][_0xa6beff]));}else if(_0xa6beff==='createdAt'){var _0x2a7273=JSON[_0xe97a('0x7a')](_0x5bdec7[_0xe97a('0x3b')][_0xa6beff])['$gte'];var _0x466353=JSON[_0xe97a('0x7a')](_0x5bdec7['query'][_0xa6beff])['$lte'];_0x2bd802[_0xe97a('0x46')](_0xe97a('0x7b'),_0x2a7273,_0x466353);}else{if(_0x5bdec7[_0xe97a('0x3b')][_0xa6beff]==='null'){_0x2bd802[_0xe97a('0x46')]('i.'+_0xa6beff+_0xe97a('0x7c'));}else{_0x2bd802['where']('i.'+_0xa6beff+_0xe97a('0x7d'),_0x5bdec7['query'][_0xa6beff]);}}});}if(_0x5bdec7['query'][_0xe97a('0x7e')]){if(_0x5bdec7[_0xe97a('0x3b')]['read']==0x1){_0x2bd802[_0xe97a('0x7f')]('`unreadMessages`\x20=\x200');}else{_0x2bd802[_0xe97a('0x7f')](_0xe97a('0x80'));}}if(_0x5bdec7['query'][_0xe97a('0x81')]){_0x3d5ebb=_[_0xe97a('0x82')](_0x5bdec7[_0xe97a('0x3b')]['tag'])?_0x5bdec7['query'][_0xe97a('0x81')]:new Array(_0x5bdec7['query'][_0xe97a('0x81')]);_0x3d5ebb[_0xe97a('0x34')](function(_0x3227f7){_0x47e244['or'](_0xe97a('0x83'),'%,'+_0x3227f7+',%');});}if(_0x5bdec7[_0xe97a('0x3b')][_0xe97a('0x84')]){var _0x50a780=_0x5bdec7['query'][_0xe97a('0x84')][_0xe97a('0x85')]('\x5c','\x5c\x5c')[_0xe97a('0x85')](/'/g,'\x27\x27');if(qs[_0xe97a('0x86')](_0x50a780)){_0x59876e['or'](_0xe97a('0x87'),_0x50a780+'%');}else{_0x59876e['or'](_0xe97a('0x88'),qs[_0xe97a('0x67')](_0x50a780))['or'](_0xe97a('0x89'),_0x50a780+'%')['or'](_0xe97a('0x8a'),_0x50a780+'%');}}}_0x2bd802[_0xe97a('0x46')](_0x59876e);_0x2bd802['group'](_0xe97a('0x8b'));var _0x176fe6={'type':db['Sequelize']['QueryTypes'][_0xe97a('0x8c')],'raw':!![]};var _0x4dcb6e=_0x2bd802[_0xe97a('0x8d')]();_0x4dcb6e[_0xe97a('0x49')](_0xe97a('0x8b'));_0x4dcb6e[_0xe97a('0x49')](_0xe97a('0x8e'),_0xe97a('0x8f'));if(_0x548c5c[_0xe97a('0x44')]){_0x548c5c['order']['forEach'](function(_0x5d9541){var _0x31521e=_0x5d9541[0x0]===_0xe97a('0x90')?_0x5d9541[0x0]:'i.'+_0x5d9541[0x0];_0x2bd802[_0xe97a('0x44')](_0x31521e,_0x5d9541[0x1]===_0xe97a('0x91')?![]:!![]);});}if(!_['isEmpty'](_0x3d5ebb)){_0x2bd802[_0xe97a('0x7f')](_0x47e244);_0x4dcb6e['where'](_0xe97a('0x92'),_0x3d5ebb);}BPromise[_0xe97a('0x93')]()[_0xe97a('0x28')](function(){if(!_0x394567){if(_0x5bdec7[_0xe97a('0x3b')][_0xe97a('0x77')])return;_0x4dcb6e[_0xe97a('0x46')](_0xe97a('0x94'));_0x2bd802[_0xe97a('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5bdec7['user'][_0xe97a('0x95')]!==_0xe97a('0x96'))return;return _0x5bdec7[_0xe97a('0x97')][_0xe97a('0x98')]({'attributes':['id'],'raw':!![]})['then'](function(_0x207495){if(_['isEmpty'](_0x207495)){_0x4dcb6e[_0xe97a('0x46')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x2bd802['where'](_0xe97a('0x99'));}else{_0x4dcb6e[_0xe97a('0x46')](_0xe97a('0x78'),_[_0xe97a('0x2f')](_0x207495,'id'));_0x2bd802[_0xe97a('0x46')](_0xe97a('0x78'),_['map'](_0x207495,'id'));}});})['then'](function(){if(_0x5bdec7['user'][_0xe97a('0x95')]===_0xe97a('0x96')&&!_0x394567&&!_0x5bdec7[_0xe97a('0x3b')][_0xe97a('0x77')])return[];return db[_0xe97a('0x9a')][_0xe97a('0x3b')](_0x4dcb6e[_0xe97a('0x9b')](),_0x176fe6);})[_0xe97a('0x28')](function(_0x307462){_0x192761[_0xe97a('0x23')]=_0x307462[_0xe97a('0x41')];if(_0x192761[_0xe97a('0x23')]===0x0)return[];return db['sequelize'][_0xe97a('0x3b')](_0x231d64[_0xe97a('0x9b')](),_0x176fe6)['then'](function(_0x92e02a){_0x2d217c=_['keyBy'](_0x92e02a,'id');_0x176fe6=_[_0xe97a('0x9c')](_0x176fe6,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5bdec7[_0xe97a('0x3b')][_0xe97a('0x3f')]){_0x548c5c[_0xe97a('0x40')][_0xe97a('0x34')](function(_0x52978a){_0x2bd802['field']('i.'+_0x52978a);});}else{_0x2bd802[_0xe97a('0x49')](_0xe97a('0x8e'),_0xe97a('0x8f'));_0x2bd802[_0xe97a('0x49')](_0xe97a('0x9d'),_0xe97a('0x9e'));_0x2bd802[_0xe97a('0x49')](_0xe97a('0x9f'),'Account.mandatoryDisposition');_0x2bd802[_0xe97a('0x49')](_0xe97a('0xa0'),_0xe97a('0x90'));_0x2bd802[_0xe97a('0x49')](_0xe97a('0xa1'));_0x2bd802['field'](_0xe97a('0xa2'),'Contact.firstName');_0x2bd802[_0xe97a('0x49')](_0xe97a('0xa3'),_0xe97a('0xa4'));_0x2bd802[_0xe97a('0x49')](_0xe97a('0xa5'),_0xe97a('0xa6'));_0x2bd802[_0xe97a('0x49')]('c.phone',_0xe97a('0xa7'));_0x2bd802[_0xe97a('0x49')](_0xe97a('0xa8'),_0xe97a('0xa9'));_0x2bd802[_0xe97a('0x49')](_0xe97a('0xaa'),'Contact.fax');_0x2bd802[_0xe97a('0x49')]('o.fullname',_0xe97a('0xab'));_0x2bd802[_0xe97a('0x49')](_0xe97a('0xac'),_0xe97a('0xad'));_0x2bd802[_0xe97a('0x49')](_0xe97a('0xae'),_0xe97a('0x31'));}if(_0x548c5c[_0xe97a('0x21')])_0x2bd802['limit'](_0x548c5c['limit']);if(_0x548c5c[_0xe97a('0x20')])_0x2bd802[_0xe97a('0x20')](_0x548c5c[_0xe97a('0x20')]);return db[_0xe97a('0x9a')]['query'](_0x2bd802['toString'](),_0x176fe6);})['then'](function(_0x49cf00){if(_0x49cf00[_0xe97a('0x41')]>0x0)_0x37d252[_0xe97a('0x46')]('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x49cf00,'id'));return db[_0xe97a('0x9a')]['query'](_0x37d252[_0xe97a('0x9b')](),_0x176fe6)[_0xe97a('0x28')](function(_0x575ab2){var _0x2c6a5f=_['groupBy'](_0x575ab2,_0xe97a('0xaf'));var _0x31b382=[];_0x49cf00['forEach'](function(_0x1e6b06){_0x31b382['push'](updateOpenchannelInteraction(_0x1e6b06,_0x2d217c,_0x2c6a5f));});return BPromise['all'](_0x31b382);});});})[_0xe97a('0x28')](function(_0x45f4ea){_0x192761[_0xe97a('0xb0')]=_0x45f4ea;return _0x192761;})[_0xe97a('0x28')](respondWithFilteredResult(_0x897763,_0x548c5c))['catch'](handleError(_0x897763,null));};exports['show']=function(_0x236d8f,_0x4031f6){var _0x57bc9d={};if(_0x236d8f[_0xe97a('0x3b')][_0xe97a('0x6a')]&&_0x236d8f[_0xe97a('0x3b')][_0xe97a('0x6a')]===_0xe97a('0x4b')){_0x57bc9d['from']=_0x236d8f[_0xe97a('0xb1')]['id'];}else{_0x57bc9d['id']=_0x236d8f[_0xe97a('0xb1')]['id'];}var _0x42001d={'raw':![],'where':_0x57bc9d},_0x6a2507={};_0x6a2507[_0xe97a('0x3a')]=_['keys'](db['OpenchannelInteraction'][_0xe97a('0x37')]);_0x6a2507[_0xe97a('0x3b')]=_[_0xe97a('0x3c')](_0x236d8f[_0xe97a('0x3b')]);_0x6a2507[_0xe97a('0x3d')]=_[_0xe97a('0x3e')](_0x6a2507[_0xe97a('0x3a')],_0x6a2507['query']);_0x42001d[_0xe97a('0x40')]=_['intersection'](_0x6a2507[_0xe97a('0x3a')],qs[_0xe97a('0x3f')](_0x236d8f[_0xe97a('0x3b')][_0xe97a('0x3f')]));_0x42001d['attributes']=_0x42001d[_0xe97a('0x40')][_0xe97a('0x41')]?_0x42001d[_0xe97a('0x40')]:_0x6a2507[_0xe97a('0x3a')];if(_0x236d8f[_0xe97a('0x3b')][_0xe97a('0xb2')]){_0x42001d[_0xe97a('0xb3')]=[{'all':!![]}];}_0x42001d=_[_0xe97a('0x9c')]({},_0x42001d,_0x236d8f[_0xe97a('0xb4')]);return db[_0xe97a('0x36')]['find'](_0x42001d)['then'](handleEntityNotFound(_0x4031f6,null))[_0xe97a('0x28')](respondWithResult(_0x4031f6,null))[_0xe97a('0xb5')](handleError(_0x4031f6,null));};exports[_0xe97a('0xb6')]=function(_0x849676,_0x5993cd){return db[_0xe97a('0x36')][_0xe97a('0xb6')](_0x849676[_0xe97a('0x74')],{})[_0xe97a('0x28')](respondWithResult(_0x5993cd,0xc9))[_0xe97a('0xb5')](handleError(_0x5993cd,null));};exports[_0xe97a('0x27')]=function(_0x5d7975,_0x35640d){if(_0x5d7975[_0xe97a('0x74')]['id']){delete _0x5d7975['body']['id'];}return db[_0xe97a('0x36')][_0xe97a('0x71')]({'where':{'id':_0x5d7975['params']['id']}})['then'](handleEntityNotFound(_0x35640d,null))[_0xe97a('0x28')](saveUpdates(_0x5d7975[_0xe97a('0x74')],null))[_0xe97a('0x28')](respondWithResult(_0x35640d,null))[_0xe97a('0xb5')](handleError(_0x35640d,null));};exports[_0xe97a('0x29')]=function(_0x1060f5,_0x1e9793){return db[_0xe97a('0x36')][_0xe97a('0x71')]({'where':{'id':_0x1060f5[_0xe97a('0xb1')]['id']}})['then'](handleEntityNotFound(_0x1e9793,null))[_0xe97a('0x28')](removeEntity(_0x1e9793,null))['catch'](handleError(_0x1e9793,null));};exports[_0xe97a('0xb7')]=function(_0xf943d6,_0xd5a431){return db[_0xe97a('0x36')][_0xe97a('0xb7')]()[_0xe97a('0x28')](respondWithResult(_0xd5a431,null))[_0xe97a('0xb5')](handleError(_0xd5a431,null));};exports[_0xe97a('0xb8')]=function(_0x38572f,_0x3b5779,_0x711dd6){return db[_0xe97a('0xb9')]['find']({'where':{'id':_0x38572f[_0xe97a('0xb1')]['id']}})[_0xe97a('0x28')](handleEntityNotFound(_0x3b5779,null))[_0xe97a('0x28')](function(_0x4fd7a8){if(_0x4fd7a8){return _0x4fd7a8['addMessage'](_0x38572f[_0xe97a('0x74')][_0xe97a('0xba')],_[_0xe97a('0xbb')](_0x38572f['body'],[_0xe97a('0xba'),'id'])||{});}})[_0xe97a('0x28')](respondWithResult(_0x3b5779,null))[_0xe97a('0xb5')](handleError(_0x3b5779,null));};exports[_0xe97a('0xbc')]=function(_0x31d53f,_0x36a556,_0x2fed48){var _0x22bdd8={'raw':![],'where':{}};var _0x4ab597={};var _0x201692={'count':0x0,'rows':[]};return db[_0xe97a('0x36')][_0xe97a('0xbd')]({'where':{'id':_0x31d53f[_0xe97a('0xb1')]['id']}})[_0xe97a('0x28')](handleEntityNotFound(_0x36a556,null))['then'](function(_0x8d1934){if(_0x8d1934){_0x4ab597[_0xe97a('0x3a')]=_[_0xe97a('0x3c')](db[_0xe97a('0xb9')][_0xe97a('0x37')]);_0x4ab597[_0xe97a('0x3b')]=_['keys'](_0x31d53f[_0xe97a('0x3b')]);_0x4ab597[_0xe97a('0x3d')]=_[_0xe97a('0x3e')](_0x4ab597[_0xe97a('0x3a')],_0x4ab597[_0xe97a('0x3b')]);_0x22bdd8[_0xe97a('0x40')]=_['intersection'](_0x4ab597[_0xe97a('0x3a')],qs[_0xe97a('0x3f')](_0x31d53f['query'][_0xe97a('0x3f')]));_0x22bdd8[_0xe97a('0x40')]=_0x22bdd8[_0xe97a('0x40')][_0xe97a('0x41')]?_0x22bdd8[_0xe97a('0x40')]:_0x4ab597['model'];if(!_0x31d53f[_0xe97a('0x3b')][_0xe97a('0x42')](_0xe97a('0x43'))){_0x22bdd8[_0xe97a('0x21')]=qs[_0xe97a('0x21')](_0x31d53f[_0xe97a('0x3b')]['limit']);_0x22bdd8[_0xe97a('0x20')]=qs[_0xe97a('0x20')](_0x31d53f[_0xe97a('0x3b')][_0xe97a('0x20')]);}_0x22bdd8[_0xe97a('0x44')]=qs[_0xe97a('0x45')](_0x31d53f[_0xe97a('0x3b')]['sort']);_0x22bdd8['where']=qs[_0xe97a('0x3d')](_[_0xe97a('0x47')](_0x31d53f['query'],_0x4ab597['filters']));_0x22bdd8['where'][_0xe97a('0xaf')]=_0x8d1934['id'];if(_0x31d53f[_0xe97a('0x3b')][_0xe97a('0x84')]){_0x22bdd8[_0xe97a('0x46')]=_[_0xe97a('0x9c')](_0x22bdd8[_0xe97a('0x46')],{'$or':_['map'](_0x22bdd8[_0xe97a('0x40')],function(_0x2ace07){var _0xb8f88c={};_0xb8f88c[_0x2ace07]={'$like':'%'+_0x31d53f[_0xe97a('0x3b')][_0xe97a('0x84')]+'%'};return _0xb8f88c;})});}if(_0x31d53f[_0xe97a('0x3b')][_0xe97a('0xbe')]){var _0xd51f74=_0x31d53f['query'][_0xe97a('0xbe')][_0xe97a('0x33')](',');var _0x16b005={};_0x16b005[_0xd51f74[0x0]]={'$gte':moment(_0xd51f74[0x1])[_0xe97a('0xbf')](_0xe97a('0xc0'))};_0x22bdd8[_0xe97a('0x46')]=_[_0xe97a('0x9c')](_0x22bdd8[_0xe97a('0x46')],_0x16b005);}_0x22bdd8=_[_0xe97a('0x9c')]({},_0x22bdd8,_0x31d53f[_0xe97a('0xb4')]);return db[_0xe97a('0xb9')]['count']({'where':_0x22bdd8[_0xe97a('0x46')]})[_0xe97a('0x28')](function(_0x16610b){_0x201692[_0xe97a('0x23')]=_0x16610b;if(_0x31d53f[_0xe97a('0x3b')][_0xe97a('0xb2')]){_0x22bdd8['include']=[{'all':!![]}];}return db[_0xe97a('0xb9')][_0xe97a('0xc1')](_0x22bdd8);})[_0xe97a('0x28')](function(_0x36a78f){_0x201692[_0xe97a('0xb0')]=_0x36a78f;return _0x201692;});}})['then'](respondWithFilteredResult(_0x36a556,_0x22bdd8))[_0xe97a('0xb5')](handleError(_0x36a556,null));};exports[_0xe97a('0xc2')]=function(_0x4a1037,_0x3c9820,_0x5b34e2){return db[_0xe97a('0x36')][_0xe97a('0x71')]({'where':{'id':_0x4a1037[_0xe97a('0xb1')]['id']}})[_0xe97a('0x28')](handleEntityNotFound(_0x3c9820,null))['then'](function(_0x468b21){if(_0x468b21){return _0x468b21['setTags'](_0x4a1037['body']['ids'],_[_0xe97a('0xbb')](_0x4a1037[_0xe97a('0x74')],[_0xe97a('0xba'),'id'])||{})[_0xe97a('0xc3')](function(){return db['Tag']['findAll']({'attributes':['id',_0xe97a('0x2c'),_0xe97a('0x4a')],'where':{'id':_0x4a1037[_0xe97a('0x74')][_0xe97a('0xba')]}});})[_0xe97a('0x28')](function(_0x49a3eb){socket[_0xe97a('0xc4')](_0xe97a('0xc5'),{'id':Number(_0x4a1037[_0xe97a('0xb1')]['id']),'tags':_0x49a3eb||[]});return{'id':Number(_0x4a1037[_0xe97a('0xb1')]['id']),'tags':_0x49a3eb||[]};});}})[_0xe97a('0x28')](respondWithResult(_0x3c9820,null))[_0xe97a('0xb5')](handleError(_0x3c9820,null));};exports[_0xe97a('0xc6')]=function(_0x499f09,_0x4ab369,_0x4a3fcf){return db[_0xe97a('0x36')][_0xe97a('0x71')]({'where':{'id':_0x499f09[_0xe97a('0xb1')]['id']}})[_0xe97a('0x28')](handleEntityNotFound(_0x4ab369,null))[_0xe97a('0x28')](function(_0x51b8c8){if(_0x51b8c8){return _0x51b8c8[_0xe97a('0xc6')](_0x499f09[_0xe97a('0x3b')][_0xe97a('0xba')]);}})[_0xe97a('0x28')](respondWithStatusCode(_0x4ab369,null))[_0xe97a('0xb5')](handleError(_0x4ab369,null));};exports[_0xe97a('0xc7')]=function(_0x84cc9b,_0x2d6262){var _0x5b99ad=moment()[_0xe97a('0xc8')]()[_0xe97a('0x9b')]();var _0x141c9b=path[_0xe97a('0xc9')](config['root'],_0xe97a('0xca'),_0xe97a('0xcb'),_0xe97a('0xcc'));var _0x5b4f9f=path[_0xe97a('0xc9')](config[_0xe97a('0xcd')],_0xe97a('0xca'),_0xe97a('0xcb'),_0xe97a('0xce'));var _0x5e5506=path[_0xe97a('0xc9')](_0x141c9b,_0x5b99ad);var _0x347045=util[_0xe97a('0xbf')](_0xe97a('0xcf'),_0x84cc9b[_0xe97a('0xb1')]['id'],_0x5b99ad);var _0x26eccd=path[_0xe97a('0xc9')](_0x141c9b,_0x347045);var _0x12644d=[];_0x12644d['push']({'model':db[_0xe97a('0x6f')],'as':_0xe97a('0x6f'),'attributes':['id',_0xe97a('0x30')],'raw':!![]});_0x12644d['push']({'model':db[_0xe97a('0xd0')],'as':_0xe97a('0x63'),'attributes':['id',_0xe97a('0xd1'),_0xe97a('0xd2')],'raw':!![]});if(_0x84cc9b[_0xe97a('0x3b')]['attachments']){_0x12644d[_0xe97a('0x35')]({'model':db[_0xe97a('0xd3')],'as':_0xe97a('0xd3'),'raw':!![]});}var _0x4b2108=[{'model':db[_0xe97a('0xb9')],'as':_0xe97a('0xd4'),'attributes':['id','body',_0xe97a('0xd5'),_0xe97a('0xd6'),_0xe97a('0xd7'),_0xe97a('0x7e')],'include':_0x12644d}];_0x4b2108[_0xe97a('0x35')]({'model':db[_0xe97a('0xd8')],'as':_0xe97a('0xd9'),'attributes':['id',_0xe97a('0x2c')]});_0x4b2108[_0xe97a('0x35')]({'model':db[_0xe97a('0x6f')],'as':_0xe97a('0xda'),'attributes':['id',_0xe97a('0x30')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x84cc9b[_0xe97a('0xb1')]['id']},'include':_0x4b2108})[_0xe97a('0x28')](handleEntityNotFound(_0x2d6262,null))[_0xe97a('0x28')](function(_0x455c53){if(_0x455c53){var _0x5ef8fc=_0x455c53[_0xe97a('0xdb')]({'plain':!![]});fs[_0xe97a('0xdc')](_0x5e5506);var _0x289a09={'channel':_0xe97a('0xdd'),'account':_0x5ef8fc[_0xe97a('0xd9')][_0xe97a('0x2c')],'agent':_0x5ef8fc[_0xe97a('0xda')]?_0x5ef8fc[_0xe97a('0xda')]['fullname']:_0xe97a('0xde'),'createdAt':moment(_0x5ef8fc[_0xe97a('0xd5')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xe97a('0x9b')](),'closedAt':_0x5ef8fc['closed']?moment(_0x5ef8fc['closedAt'])[_0xe97a('0xbf')](_0xe97a('0xc0'))['toString']():'','disposition':_0x5ef8fc[_0xe97a('0xdf')],'visibility':_0x5ef8fc['threadId']?'Public':_0xe97a('0xe0'),'messages':_(_0x5ef8fc[_0xe97a('0xd4')])['filter']({'secret':![]})[_0xe97a('0x2f')](function(_0x3c6428){if(_0x3c6428[_0xe97a('0xd3')]){var _0x3c10ab=path[_0xe97a('0xc9')](_0x5b4f9f,_0x3c6428[_0xe97a('0xd3')][_0xe97a('0xe1')]);if(fs[_0xe97a('0xe2')](_0x3c10ab)){fs[_0xe97a('0xe3')](_0x3c10ab)[_0xe97a('0xe4')](fs[_0xe97a('0xe5')](path[_0xe97a('0xc9')](_0x5e5506,_0x3c6428['Attachment'][_0xe97a('0xe1')])));}}return{'date':moment(_0x3c6428[_0xe97a('0xd5')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xe97a('0x9b')](),'sender':_0x3c6428['direction']===_0xe97a('0xe6')?_0x3c6428[_0xe97a('0x6f')]?_0x3c6428['User'][_0xe97a('0x30')]:_0xe97a('0xe7'):_0x3c6428[_0xe97a('0x63')][_0xe97a('0xd1')]+(_0x3c6428[_0xe97a('0x63')][_0xe97a('0xd2')]?'\x20'+_0x3c6428[_0xe97a('0x63')][_0xe97a('0xd2')]:''),'body':_0x3c6428['Attachment']?_0x3c6428['Attachment']['basename']:_0x3c6428[_0xe97a('0x74')],'direction':_0x3c6428[_0xe97a('0xd6')]===_0xe97a('0xe6')?'A':'C','secret':_0x3c6428[_0xe97a('0xd7')],'read':_0x3c6428['read'],'attachment':_0x3c6428[_0xe97a('0xd3')]};})[_0xe97a('0x60')]()};return ejs[_0xe97a('0xe8')](path[_0xe97a('0xc9')](config[_0xe97a('0xcd')],_0xe97a('0xca'),'views',_0xe97a('0xe9')),{'interaction':_0x289a09})['then'](function(_0x17f1b5){var _0x80e0b=path[_0xe97a('0xc9')](_0x5e5506,'transcript-'+_0x5ef8fc['id']+'-'+_0x5b99ad+_0xe97a('0xea'));var _0x3faa79={'path':_0x80e0b,'channel':_0xe97a('0xdd'),'interactionId':_0x5ef8fc['id']};return pdf['createPdfFromHTML'](_0x17f1b5,_0x3faa79);})[_0xe97a('0x28')](function(){return new BPromise(function(_0x14b52a,_0x4cb9ed){zipdir(_0x5e5506,{'saveTo':_0x26eccd},function(_0x486224,_0x537135){if(_0x486224)return _0x4cb9ed(_0x486224);return _0x14b52a(_0x537135);});})[_0xe97a('0x28')](function(){return new BPromise(function(_0x4a5492,_0x43835f){rimraf(_0x5e5506,function(_0x36c655){if(_0x36c655)_0x43835f(_0x36c655);return _0x4a5492();});});})['then'](function(){return _0x2d6262[_0xe97a('0xc7')](_0x26eccd,_0x347045,function(_0xc98177){if(_0xc98177){console[_0xe97a('0xeb')](_0xe97a('0xec'),_0xc98177);}else{fs[_0xe97a('0xed')](_0x26eccd);}});});});}else{return _0x2d6262['sendStatus'](0xc8);}})[_0xe97a('0xb5')](handleError(_0x2d6262,null));}; \ No newline at end of file +var _0xeb2e=['i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','role','toString','sequelize','keyBy','merge','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','c.mobile','c.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','OpenchannelInteractionId','params','includeAll','options','create','describe','ids','omit','findOne','format','YYYY-MM-DD\x20HH:mm:ss','OpenchannelMessage','findAll','rows','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','transcript-%d-%s.zip','CmContact','firstName','lastName','attachments','Attachment','Messages','secret','OpenchannelAccount','Account','Owner','get','Openchannel','N.A.','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createReadStream','createWriteStream','direction','renderFile','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','stack','name','send','map','fullname','TagIds','split','forEach','Tags','push','catch','index','OpenchannelInteraction','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','field','from','tools_tags','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','openchannel_interactions','cm_contacts','a.id\x20=\x20i.OpenchannelAccountId','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','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','body','type','keys','some','compact','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric'];(function(_0x2c7780,_0x100f4a){var _0x580bc8=function(_0x3d435c){while(--_0x3d435c){_0x2c7780['push'](_0x2c7780['shift']());}};_0x580bc8(++_0x100f4a);}(_0xeb2e,0x14a));var _0xeeb2=function(_0x2d30a4,_0x111993){_0x2d30a4=_0x2d30a4-0x0;var _0x3e7256=_0xeb2e[_0x2d30a4];return _0x3e7256;};'use strict';var emlformat=require(_0xeeb2('0x0'));var rimraf=require(_0xeeb2('0x1'));var zipdir=require(_0xeeb2('0x2'));var jsonpatch=require(_0xeeb2('0x3'));var rp=require(_0xeeb2('0x4'));var moment=require(_0xeeb2('0x5'));var BPromise=require(_0xeeb2('0x6'));var Mustache=require('mustache');var util=require(_0xeeb2('0x7'));var path=require(_0xeeb2('0x8'));var sox=require(_0xeeb2('0x9'));var csv=require(_0xeeb2('0xa'));var ejs=require(_0xeeb2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeeb2('0xc'));var squel=require('squel');var crypto=require(_0xeeb2('0xd'));var jsforce=require(_0xeeb2('0xe'));var deskjs=require(_0xeeb2('0xf'));var toCsv=require(_0xeeb2('0xa'));var querystring=require(_0xeeb2('0x10'));var Papa=require('papaparse');var Redis=require(_0xeeb2('0x11'));var authService=require(_0xeeb2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xeeb2('0x13'));var pdf=require(_0xeeb2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeeb2('0x15'))(_0xeeb2('0x16'));var utils=require(_0xeeb2('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xeeb2('0x18'))['db'];config[_0xeeb2('0x19')]=_[_0xeeb2('0x1a')](config[_0xeeb2('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xeeb2('0x1b'))(new Redis(config[_0xeeb2('0x19')]));require(_0xeeb2('0x1c'))[_0xeeb2('0x1d')](socket);function respondWithStatusCode(_0x5b1a0c,_0x5888b0){_0x5888b0=_0x5888b0||0xcc;return function(_0x22cf84){if(_0x22cf84){return _0x5b1a0c[_0xeeb2('0x1e')](_0x5888b0);}return _0x5b1a0c[_0xeeb2('0x1f')](_0x5888b0)['end']();};}function respondWithResult(_0x306038,_0x42631b){_0x42631b=_0x42631b||0xc8;return function(_0x3f860d){if(_0x3f860d){return _0x306038[_0xeeb2('0x1f')](_0x42631b)['json'](_0x3f860d);}};}function respondWithFilteredResult(_0x5defb9,_0x1ade81){return function(_0x377c11){if(_0x377c11){var _0xbb315e=typeof _0x1ade81[_0xeeb2('0x20')]===_0xeeb2('0x21')&&typeof _0x1ade81[_0xeeb2('0x22')]===_0xeeb2('0x21');var _0x5b2cf1=_0x377c11[_0xeeb2('0x23')];var _0x9d7f9=_0xbb315e?0x0:_0x1ade81[_0xeeb2('0x20')];var _0x46aded=_0xbb315e?_0x377c11['count']:_0x1ade81[_0xeeb2('0x20')]+_0x1ade81['limit'];var _0x3715fd;if(_0x46aded>=_0x5b2cf1){_0x46aded=_0x5b2cf1;_0x3715fd=0xc8;}else{_0x3715fd=0xce;}_0x5defb9[_0xeeb2('0x1f')](_0x3715fd);return _0x5defb9[_0xeeb2('0x24')](_0xeeb2('0x25'),_0x9d7f9+'-'+_0x46aded+'/'+_0x5b2cf1)['json'](_0x377c11);}return null;};}function patchUpdates(_0x38f2fd){return function(_0x113963){try{jsonpatch['apply'](_0x113963,_0x38f2fd,!![]);}catch(_0x2261b4){return BPromise['reject'](_0x2261b4);}return _0x113963[_0xeeb2('0x26')]();};}function saveUpdates(_0x15252d,_0x5b4187){return function(_0x4cc366){if(_0x4cc366){return _0x4cc366[_0xeeb2('0x27')](_0x15252d)[_0xeeb2('0x28')](function(_0x382392){return _0x382392;});}return null;};}function removeEntity(_0x36d232,_0x5a6324){return function(_0x24ac80){if(_0x24ac80){return _0x24ac80[_0xeeb2('0x29')]()[_0xeeb2('0x28')](function(){_0x36d232[_0xeeb2('0x1f')](0xcc)[_0xeeb2('0x2a')]();});}};}function handleEntityNotFound(_0xdf27b,_0xb88e5c){return function(_0xebcfca){if(!_0xebcfca){_0xdf27b[_0xeeb2('0x1e')](0x194);}return _0xebcfca;};}function handleError(_0x3fb110,_0xcaa272){_0xcaa272=_0xcaa272||0x1f4;return function(_0x30f800){logger['error'](_0x30f800[_0xeeb2('0x2b')]);if(_0x30f800[_0xeeb2('0x2c')]){delete _0x30f800['name'];}_0x3fb110['status'](_0xcaa272)[_0xeeb2('0x2d')](_0x30f800);};}function getInteractionUsers(_0x1c5551,_0x94ff6c){return new BPromise(function(_0x3f6da0,_0x5c14da){try{if(_0x94ff6c[_0x1c5551['id']]){_0x1c5551['Users']=_[_0xeeb2('0x2e')](_0x94ff6c[_0x1c5551['id']],function(_0x46957e){return{'id':_0x46957e['id'],'fullname':_0x46957e[_0xeeb2('0x2f')]};});}}catch(_0x1c6806){_0x5c14da(_0x1c6806);}_0x3f6da0(_0x1c5551);});}function getInteractionTags(_0x1d4f8e,_0x342381){return new BPromise(function(_0x1743df,_0x3d3d0b){try{if(_0x1d4f8e[_0xeeb2('0x30')]){_0x1d4f8e['Tags']=[];_0x1d4f8e[_0xeeb2('0x30')][_0xeeb2('0x31')](',')[_0xeeb2('0x32')](function(_0x3b4bc5){_0x1d4f8e[_0xeeb2('0x33')][_0xeeb2('0x34')](_0x342381[_0x3b4bc5]);});}delete _0x1d4f8e[_0xeeb2('0x30')];}catch(_0x167a83){_0x3d3d0b(_0x167a83);}_0x1743df(_0x1d4f8e);});}function updateOpenchannelInteraction(_0x57006,_0x29ccec,_0x2d3f93){return new BPromise(function(_0x4699bf,_0x1afa63){return getInteractionUsers(_0x57006,_0x2d3f93)[_0xeeb2('0x28')](function(_0x160e64){return getInteractionTags(_0x160e64,_0x29ccec);})[_0xeeb2('0x28')](function(_0x584078){_0x4699bf(_0x584078);})[_0xeeb2('0x35')](function(_0xf5ef33){_0x1afa63(_0xf5ef33);});});}exports[_0xeeb2('0x36')]=function(_0x3c39f1,_0x1ad49e){var _0x462c71={},_0x58fb3a={},_0x4a89cf={'count':0x0,'rows':[]};var _0x3cae66=_[_0xeeb2('0x2e')](db[_0xeeb2('0x37')][_0xeeb2('0x38')],function(_0x541f99){return{'name':_0x541f99[_0xeeb2('0x39')],'type':_0x541f99['type'][_0xeeb2('0x3a')]};});_0x58fb3a['model']=_[_0xeeb2('0x2e')](_0x3cae66,'name');_0x58fb3a[_0xeeb2('0x3b')]=_['keys'](_0x3c39f1[_0xeeb2('0x3b')]);_0x58fb3a[_0xeeb2('0x3c')]=_[_0xeeb2('0x3d')](_0x58fb3a[_0xeeb2('0x3e')],_0x58fb3a[_0xeeb2('0x3b')]);_0x462c71[_0xeeb2('0x3f')]=_[_0xeeb2('0x3d')](_0x58fb3a[_0xeeb2('0x3e')],qs[_0xeeb2('0x40')](_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x40')]));_0x462c71['attributes']=_0x462c71[_0xeeb2('0x3f')]['length']?_0x462c71[_0xeeb2('0x3f')]:_0x58fb3a[_0xeeb2('0x3e')];if(!_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x41')](_0xeeb2('0x42'))){_0x462c71[_0xeeb2('0x22')]=qs['limit'](_0x3c39f1['query'][_0xeeb2('0x22')]);_0x462c71[_0xeeb2('0x20')]=qs[_0xeeb2('0x20')](_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x20')]);}_0x462c71[_0xeeb2('0x43')]=qs[_0xeeb2('0x44')](_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x44')]);_0x462c71[_0xeeb2('0x45')]=qs[_0xeeb2('0x3c')](_[_0xeeb2('0x46')](_0x3c39f1[_0xeeb2('0x3b')],_0x58fb3a[_0xeeb2('0x3c')]),_0x3cae66);var _0x1b110b=[];var _0x44172e=squel['select']()[_0xeeb2('0x47')]('id')[_0xeeb2('0x47')](_0xeeb2('0x2c'))[_0xeeb2('0x47')]('color')[_0xeeb2('0x48')](_0xeeb2('0x49'));var _0x5080fb=squel['select']()[_0xeeb2('0x47')](_0xeeb2('0x4a'))['field']('u.fullname')['field'](_0xeeb2('0x4b'))[_0xeeb2('0x48')](_0xeeb2('0x4c'),'ui')[_0xeeb2('0x4d')](_0xeeb2('0x4e'),'u',_0xeeb2('0x4f'));var _0x150274=squel[_0xeeb2('0x50')]()['from'](_0xeeb2('0x51'),'i')[_0xeeb2('0x4d')](_0xeeb2('0x52'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xeeb2('0x4d')](_0xeeb2('0x4e'),'o','o.id\x20=\x20i.UserId')['left_join']('openchannel_accounts','a',_0xeeb2('0x53'))['left_join']('openchannel_messages','me',_0xeeb2('0x54'))[_0xeeb2('0x4d')](_0xeeb2('0x55'),'it',_0xeeb2('0x56'))[_0xeeb2('0x4d')](_0xeeb2('0x49'),'t',_0xeeb2('0x57'));var _0x258d2c=squel[_0xeeb2('0x58')]();var _0x363e22=[];var _0x12dac4=squel['expr']();var _0x17fbf7;if(_0x3c39f1['query'][_0xeeb2('0x59')]){_0x17fbf7=as[_0xeeb2('0x5a')](_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x59')]);var _0xc79060=_0x17fbf7[_0xeeb2('0x5b')];for(var _0x15aa0d=0x0;_0x15aa0d<_0x17fbf7[_0xeeb2('0x5c')][_0xeeb2('0x5d')];_0x15aa0d++){var _0x2173b4=_0x17fbf7[_0xeeb2('0x5c')][_0x15aa0d];var _0x291f0c='i';var _0x5be3ca=_[_0xeeb2('0x5e')](_0x3cae66,[_0xeeb2('0x2c'),_0x2173b4[_0xeeb2('0x47')]]);if(!_0x5be3ca){switch(_0x2173b4[_0xeeb2('0x47')]){case _0xeeb2('0x5f'):if(_0x2173b4[_0xeeb2('0x60')]==0x1){_0x150274[_0xeeb2('0x61')]('`'+_0x2173b4[_0xeeb2('0x47')]+_0xeeb2('0x62'));}else{_0x150274[_0xeeb2('0x61')]('`'+_0x2173b4[_0xeeb2('0x47')]+_0xeeb2('0x63'));}break;case _0xeeb2('0x64'):if(_0x2173b4['operator']===_0xeeb2('0x65')){if(_0x2173b4[_0xeeb2('0x60')][_0xeeb2('0x31')]('\x20')[_0xeeb2('0x5d')]>0x1){_0x258d2c[_0xc79060](_0xeeb2('0x66'),qs[_0xeeb2('0x67')](_0x2173b4[_0xeeb2('0x60')]),null);}else{var _0x5d407b='%'+_0x2173b4[_0xeeb2('0x60')]+'%';_0x258d2c[_0xc79060]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5d407b,_0x5d407b,_0x5d407b);}}else{_0x5be3ca=_[_0xeeb2('0x5e')](_0x3cae66,['name',_0xeeb2('0x68')]);_0x2173b4[_0xeeb2('0x47')]=_0xeeb2('0x68');_0x242969=as[_0xeeb2('0x69')](_0x291f0c,_0x5be3ca['type'],_0x2173b4);_0x258d2c[_0xc79060](_0x242969[_0xeeb2('0x6a')],_0x242969[_0xeeb2('0x60')][_0xeeb2('0x6b')],_0x242969[_0xeeb2('0x60')][_0xeeb2('0x2a')]);}break;case _0xeeb2('0x6c'):var _0x4e84db=_0x2173b4[_0xeeb2('0x60')][_0xeeb2('0x31')](',')[_0xeeb2('0x2e')](function(_0x4e7223){return Number(_0x4e7223);});_0x4e84db['forEach'](function(_0x4cdd39){_0x12dac4['or'](_0xeeb2('0x6d'),'%,'+_0x4cdd39+',%');});_0x363e22=_[_0xeeb2('0x6e')](_0x363e22,_0x4e84db);break;case _0xeeb2('0x6f'):if(_0x2173b4[_0xeeb2('0x70')]===_0xeeb2('0x65')){_0x258d2c[_0xc79060](_0xeeb2('0x71'),'%'+_0x2173b4[_0xeeb2('0x60')]+'%',null);}else{_0x5be3ca=_[_0xeeb2('0x5e')](_0x3cae66,['name',_0xeeb2('0x72')]);_0x2173b4[_0xeeb2('0x47')]=_0xeeb2('0x72');_0x242969=as[_0xeeb2('0x69')](_0x291f0c,_0x5be3ca['type'],_0x2173b4);_0x258d2c[_0xc79060](_0x242969[_0xeeb2('0x6a')],_0x242969[_0xeeb2('0x60')][_0xeeb2('0x6b')],_0x242969[_0xeeb2('0x60')][_0xeeb2('0x2a')]);}break;case _0xeeb2('0x73'):_0x242969=as[_0xeeb2('0x69')]('me',null,_0x2173b4);_0x258d2c[_0xc79060](_0x242969['text'],_0x242969[_0xeeb2('0x60')]['start'],_0x242969['value']['end']);break;}}else{var _0x242969=as[_0xeeb2('0x69')](_0x291f0c,_0x5be3ca[_0xeeb2('0x74')],_0x2173b4);_0x258d2c[_0xc79060](_0x242969[_0xeeb2('0x6a')],_0x242969[_0xeeb2('0x60')]['start'],_0x242969[_0xeeb2('0x60')][_0xeeb2('0x2a')]);}}}else{var _0x58431f=_(_0x3c39f1[_0xeeb2('0x3b')])[_0xeeb2('0x75')]()[_0xeeb2('0x2e')](function(_0x4fa447){return _[_0xeeb2('0x76')](_0x3cae66,['name',_0x4fa447])?_0x4fa447:undefined;})[_0xeeb2('0x77')]()[_0xeeb2('0x60')]();if(!_[_0xeeb2('0x78')](_0x58431f)){_0x58431f[_0xeeb2('0x32')](function(_0x2fb623){if(_0x2fb623===_0xeeb2('0x79')){_0x150274[_0xeeb2('0x45')](_0xeeb2('0x7a'),[]['concat'](_0x3c39f1[_0xeeb2('0x3b')][_0x2fb623]));}else if(_0x2fb623===_0xeeb2('0x7b')){var _0x4d0270=JSON[_0xeeb2('0x7c')](_0x3c39f1[_0xeeb2('0x3b')][_0x2fb623])[_0xeeb2('0x7d')];var _0x58c66a=JSON[_0xeeb2('0x7c')](_0x3c39f1['query'][_0x2fb623])[_0xeeb2('0x7e')];_0x150274[_0xeeb2('0x45')](_0xeeb2('0x7f'),_0x4d0270,_0x58c66a);}else{if(_0x3c39f1[_0xeeb2('0x3b')][_0x2fb623]===_0xeeb2('0x80')){_0x150274[_0xeeb2('0x45')]('i.'+_0x2fb623+_0xeeb2('0x81'));}else{_0x150274['where']('i.'+_0x2fb623+'\x20=\x20?',_0x3c39f1[_0xeeb2('0x3b')][_0x2fb623]);}}});}if(_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x82')]){if(_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x82')]==0x1){_0x150274[_0xeeb2('0x61')](_0xeeb2('0x83'));}else{_0x150274[_0xeeb2('0x61')](_0xeeb2('0x84'));}}if(_0x3c39f1[_0xeeb2('0x3b')]['tag']){_0x363e22=_[_0xeeb2('0x85')](_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x86')])?_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x86')]:new Array(_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x86')]);_0x363e22[_0xeeb2('0x32')](function(_0x53f217){_0x12dac4['or'](_0xeeb2('0x6d'),'%,'+_0x53f217+',%');});}if(_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x87')]){var _0x51c0c2=_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x87')][_0xeeb2('0x88')]('\x5c','\x5c\x5c')[_0xeeb2('0x88')](/'/g,'\x27\x27');if(qs[_0xeeb2('0x89')](_0x51c0c2)){_0x258d2c['or'](_0xeeb2('0x8a'),_0x51c0c2+'%');}else{_0x258d2c['or'](_0xeeb2('0x8b'),qs[_0xeeb2('0x67')](_0x51c0c2))['or'](_0xeeb2('0x8c'),_0x51c0c2+'%')['or'](_0xeeb2('0x8d'),_0x51c0c2+'%');}}}_0x150274[_0xeeb2('0x45')](_0x258d2c);_0x150274['group']('i.id');var _0x2ca9c3={'type':db[_0xeeb2('0x8e')][_0xeeb2('0x8f')]['SELECT'],'raw':!![]};var _0x11f1bd=_0x150274[_0xeeb2('0x90')]();_0x11f1bd['field'](_0xeeb2('0x91'));_0x11f1bd[_0xeeb2('0x47')](_0xeeb2('0x92'),_0xeeb2('0x5f'));if(_0x462c71[_0xeeb2('0x43')]){_0x462c71[_0xeeb2('0x43')][_0xeeb2('0x32')](function(_0x5ec5ee){var _0x24dafb=_0x5ec5ee[0x0]==='contactName'?_0x5ec5ee[0x0]:'i.'+_0x5ec5ee[0x0];_0x150274[_0xeeb2('0x43')](_0x24dafb,_0x5ec5ee[0x1]==='DESC'?![]:!![]);});}if(!_[_0xeeb2('0x78')](_0x363e22)){_0x150274['having'](_0x12dac4);_0x11f1bd[_0xeeb2('0x45')](_0xeeb2('0x93'),_0x363e22);}BPromise['resolve']()[_0xeeb2('0x28')](function(){if(!_0x17fbf7){if(_0x3c39f1['query'][_0xeeb2('0x79')])return;_0x11f1bd[_0xeeb2('0x45')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x150274['where'](_0xeeb2('0x94'));return;}if(_0x3c39f1['user']['role']!==_0xeeb2('0x95'))return;return _0x3c39f1[_0xeeb2('0x96')][_0xeeb2('0x97')]({'attributes':['id'],'raw':!![]})[_0xeeb2('0x28')](function(_0x1465f5){if(_[_0xeeb2('0x78')](_0x1465f5)){_0x11f1bd['where'](_0xeeb2('0x98'));_0x150274[_0xeeb2('0x45')](_0xeeb2('0x98'));}else{_0x11f1bd['where'](_0xeeb2('0x7a'),_[_0xeeb2('0x2e')](_0x1465f5,'id'));_0x150274['where'](_0xeeb2('0x7a'),_['map'](_0x1465f5,'id'));}});})[_0xeeb2('0x28')](function(){if(_0x3c39f1['user'][_0xeeb2('0x99')]==='agent'&&!_0x17fbf7&&!_0x3c39f1[_0xeeb2('0x3b')][_0xeeb2('0x79')])return[];return db['sequelize']['query'](_0x11f1bd[_0xeeb2('0x9a')](),_0x2ca9c3);})[_0xeeb2('0x28')](function(_0x3d19b9){_0x4a89cf['count']=_0x3d19b9[_0xeeb2('0x5d')];if(_0x4a89cf[_0xeeb2('0x23')]===0x0)return[];return db[_0xeeb2('0x9b')]['query'](_0x44172e[_0xeeb2('0x9a')](),_0x2ca9c3)[_0xeeb2('0x28')](function(_0x7459e0){_0x1b110b=_[_0xeeb2('0x9c')](_0x7459e0,'id');_0x2ca9c3=_[_0xeeb2('0x9d')](_0x2ca9c3,{'model':db['OpenchannelInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3c39f1['query']['fields']){_0x462c71[_0xeeb2('0x3f')][_0xeeb2('0x32')](function(_0x3348d1){_0x150274[_0xeeb2('0x47')]('i.'+_0x3348d1);});}else{_0x150274[_0xeeb2('0x47')](_0xeeb2('0x92'),_0xeeb2('0x5f'));_0x150274[_0xeeb2('0x47')](_0xeeb2('0x9e'),'Account.key');_0x150274[_0xeeb2('0x47')](_0xeeb2('0x9f'),_0xeeb2('0xa0'));_0x150274[_0xeeb2('0x47')](_0xeeb2('0xa1'),'contactName');_0x150274[_0xeeb2('0x47')](_0xeeb2('0xa2'));_0x150274['field'](_0xeeb2('0xa3'),_0xeeb2('0xa4'));_0x150274[_0xeeb2('0x47')](_0xeeb2('0xa5'),_0xeeb2('0xa6'));_0x150274[_0xeeb2('0x47')]('c.email','Contact.email');_0x150274[_0xeeb2('0x47')](_0xeeb2('0xa7'),'Contact.phone');_0x150274[_0xeeb2('0x47')](_0xeeb2('0xa8'),'Contact.mobile');_0x150274[_0xeeb2('0x47')](_0xeeb2('0xa9'),'Contact.fax');_0x150274[_0xeeb2('0x47')]('o.fullname',_0xeeb2('0xaa'));_0x150274['field'](_0xeeb2('0xab'),'Owner.internal');_0x150274[_0xeeb2('0x47')](_0xeeb2('0xac'),'TagIds');}if(_0x462c71[_0xeeb2('0x22')])_0x150274[_0xeeb2('0x22')](_0x462c71['limit']);if(_0x462c71['offset'])_0x150274['offset'](_0x462c71[_0xeeb2('0x20')]);return db[_0xeeb2('0x9b')][_0xeeb2('0x3b')](_0x150274['toString'](),_0x2ca9c3);})[_0xeeb2('0x28')](function(_0x2f7096){if(_0x2f7096[_0xeeb2('0x5d')]>0x0)_0x5080fb['where']('ui.OpenchannelInteractionId\x20IN\x20?',_[_0xeeb2('0x2e')](_0x2f7096,'id'));return db[_0xeeb2('0x9b')][_0xeeb2('0x3b')](_0x5080fb[_0xeeb2('0x9a')](),_0x2ca9c3)[_0xeeb2('0x28')](function(_0x46b00e){var _0x301e41=_['groupBy'](_0x46b00e,_0xeeb2('0xad'));var _0x55bb65=[];_0x2f7096[_0xeeb2('0x32')](function(_0x3eab7d){_0x55bb65[_0xeeb2('0x34')](updateOpenchannelInteraction(_0x3eab7d,_0x1b110b,_0x301e41));});return BPromise['all'](_0x55bb65);});});})[_0xeeb2('0x28')](function(_0x505ffb){_0x4a89cf['rows']=_0x505ffb;return _0x4a89cf;})[_0xeeb2('0x28')](respondWithFilteredResult(_0x1ad49e,_0x462c71))[_0xeeb2('0x35')](handleError(_0x1ad49e,null));};exports['show']=function(_0x4baa9f,_0x4eb36e){var _0x2904ca={};if(_0x4baa9f['query'][_0xeeb2('0x74')]&&_0x4baa9f[_0xeeb2('0x3b')][_0xeeb2('0x74')]===_0xeeb2('0x48')){_0x2904ca[_0xeeb2('0x48')]=_0x4baa9f[_0xeeb2('0xae')]['id'];}else{_0x2904ca['id']=_0x4baa9f[_0xeeb2('0xae')]['id'];}var _0x553230={'raw':![],'where':_0x2904ca},_0x256b91={};_0x256b91['model']=_['keys'](db['OpenchannelInteraction'][_0xeeb2('0x38')]);_0x256b91[_0xeeb2('0x3b')]=_['keys'](_0x4baa9f[_0xeeb2('0x3b')]);_0x256b91[_0xeeb2('0x3c')]=_['intersection'](_0x256b91[_0xeeb2('0x3e')],_0x256b91[_0xeeb2('0x3b')]);_0x553230['attributes']=_[_0xeeb2('0x3d')](_0x256b91['model'],qs[_0xeeb2('0x40')](_0x4baa9f[_0xeeb2('0x3b')][_0xeeb2('0x40')]));_0x553230[_0xeeb2('0x3f')]=_0x553230[_0xeeb2('0x3f')][_0xeeb2('0x5d')]?_0x553230[_0xeeb2('0x3f')]:_0x256b91['model'];if(_0x4baa9f[_0xeeb2('0x3b')][_0xeeb2('0xaf')]){_0x553230['include']=[{'all':!![]}];}_0x553230=_[_0xeeb2('0x9d')]({},_0x553230,_0x4baa9f[_0xeeb2('0xb0')]);return db['OpenchannelInteraction']['find'](_0x553230)[_0xeeb2('0x28')](handleEntityNotFound(_0x4eb36e,null))['then'](respondWithResult(_0x4eb36e,null))['catch'](handleError(_0x4eb36e,null));};exports[_0xeeb2('0xb1')]=function(_0x29ddc7,_0x1f0bff){return db[_0xeeb2('0x37')]['create'](_0x29ddc7['body'],{})[_0xeeb2('0x28')](respondWithResult(_0x1f0bff,0xc9))[_0xeeb2('0x35')](handleError(_0x1f0bff,null));};exports[_0xeeb2('0x27')]=function(_0x455f16,_0x460fb6){if(_0x455f16[_0xeeb2('0x73')]['id']){delete _0x455f16[_0xeeb2('0x73')]['id'];}return db[_0xeeb2('0x37')][_0xeeb2('0x5e')]({'where':{'id':_0x455f16[_0xeeb2('0xae')]['id']}})['then'](handleEntityNotFound(_0x460fb6,null))[_0xeeb2('0x28')](saveUpdates(_0x455f16['body'],null))[_0xeeb2('0x28')](respondWithResult(_0x460fb6,null))[_0xeeb2('0x35')](handleError(_0x460fb6,null));};exports['destroy']=function(_0x115180,_0x4bbac3){return db[_0xeeb2('0x37')][_0xeeb2('0x5e')]({'where':{'id':_0x115180['params']['id']}})[_0xeeb2('0x28')](handleEntityNotFound(_0x4bbac3,null))[_0xeeb2('0x28')](removeEntity(_0x4bbac3,null))[_0xeeb2('0x35')](handleError(_0x4bbac3,null));};exports[_0xeeb2('0xb2')]=function(_0xca3616,_0x4410a0){return db[_0xeeb2('0x37')][_0xeeb2('0xb2')]()[_0xeeb2('0x28')](respondWithResult(_0x4410a0,null))[_0xeeb2('0x35')](handleError(_0x4410a0,null));};exports['addMessage']=function(_0x555f0e,_0x308361,_0x2b82ac){return db['OpenchannelMessage'][_0xeeb2('0x5e')]({'where':{'id':_0x555f0e[_0xeeb2('0xae')]['id']}})['then'](handleEntityNotFound(_0x308361,null))['then'](function(_0x2dabbe){if(_0x2dabbe){return _0x2dabbe['addMessage'](_0x555f0e['body'][_0xeeb2('0xb3')],_[_0xeeb2('0xb4')](_0x555f0e[_0xeeb2('0x73')],[_0xeeb2('0xb3'),'id'])||{});}})[_0xeeb2('0x28')](respondWithResult(_0x308361,null))['catch'](handleError(_0x308361,null));};exports['getMessages']=function(_0x28406e,_0x4d1604,_0x3dfa21){var _0x2ff378={'raw':![],'where':{}};var _0x5c2966={};var _0x19d994={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xeeb2('0xb5')]({'where':{'id':_0x28406e[_0xeeb2('0xae')]['id']}})['then'](handleEntityNotFound(_0x4d1604,null))[_0xeeb2('0x28')](function(_0x56f403){if(_0x56f403){_0x5c2966[_0xeeb2('0x3e')]=_[_0xeeb2('0x75')](db['OpenchannelMessage'][_0xeeb2('0x38')]);_0x5c2966[_0xeeb2('0x3b')]=_[_0xeeb2('0x75')](_0x28406e['query']);_0x5c2966[_0xeeb2('0x3c')]=_[_0xeeb2('0x3d')](_0x5c2966[_0xeeb2('0x3e')],_0x5c2966[_0xeeb2('0x3b')]);_0x2ff378[_0xeeb2('0x3f')]=_['intersection'](_0x5c2966['model'],qs['fields'](_0x28406e[_0xeeb2('0x3b')][_0xeeb2('0x40')]));_0x2ff378[_0xeeb2('0x3f')]=_0x2ff378[_0xeeb2('0x3f')]['length']?_0x2ff378[_0xeeb2('0x3f')]:_0x5c2966[_0xeeb2('0x3e')];if(!_0x28406e[_0xeeb2('0x3b')][_0xeeb2('0x41')](_0xeeb2('0x42'))){_0x2ff378[_0xeeb2('0x22')]=qs[_0xeeb2('0x22')](_0x28406e[_0xeeb2('0x3b')][_0xeeb2('0x22')]);_0x2ff378[_0xeeb2('0x20')]=qs[_0xeeb2('0x20')](_0x28406e[_0xeeb2('0x3b')][_0xeeb2('0x20')]);}_0x2ff378['order']=qs['sort'](_0x28406e['query']['sort']);_0x2ff378[_0xeeb2('0x45')]=qs['filters'](_[_0xeeb2('0x46')](_0x28406e[_0xeeb2('0x3b')],_0x5c2966[_0xeeb2('0x3c')]));_0x2ff378[_0xeeb2('0x45')]['OpenchannelInteractionId']=_0x56f403['id'];if(_0x28406e[_0xeeb2('0x3b')][_0xeeb2('0x87')]){_0x2ff378[_0xeeb2('0x45')]=_[_0xeeb2('0x9d')](_0x2ff378['where'],{'$or':_[_0xeeb2('0x2e')](_0x2ff378[_0xeeb2('0x3f')],function(_0x521bbd){var _0x1dc567={};_0x1dc567[_0x521bbd]={'$like':'%'+_0x28406e[_0xeeb2('0x3b')]['filter']+'%'};return _0x1dc567;})});}if(_0x28406e[_0xeeb2('0x3b')][_0xeeb2('0x7d')]){var _0x546fa=_0x28406e['query'][_0xeeb2('0x7d')]['split'](',');var _0x23491b={};_0x23491b[_0x546fa[0x0]]={'$gte':moment(_0x546fa[0x1])[_0xeeb2('0xb6')](_0xeeb2('0xb7'))};_0x2ff378[_0xeeb2('0x45')]=_[_0xeeb2('0x9d')](_0x2ff378[_0xeeb2('0x45')],_0x23491b);}_0x2ff378=_[_0xeeb2('0x9d')]({},_0x2ff378,_0x28406e['options']);return db[_0xeeb2('0xb8')]['count']({'where':_0x2ff378[_0xeeb2('0x45')]})[_0xeeb2('0x28')](function(_0x2f6d03){_0x19d994[_0xeeb2('0x23')]=_0x2f6d03;if(_0x28406e[_0xeeb2('0x3b')][_0xeeb2('0xaf')]){_0x2ff378['include']=[{'all':!![]}];}return db[_0xeeb2('0xb8')][_0xeeb2('0xb9')](_0x2ff378);})['then'](function(_0x2f4fb6){_0x19d994[_0xeeb2('0xba')]=_0x2f4fb6;return _0x19d994;});}})[_0xeeb2('0x28')](respondWithFilteredResult(_0x4d1604,_0x2ff378))[_0xeeb2('0x35')](handleError(_0x4d1604,null));};exports[_0xeeb2('0xbb')]=function(_0x1ec70e,_0x517356,_0x8d9cc6){return db[_0xeeb2('0x37')][_0xeeb2('0x5e')]({'where':{'id':_0x1ec70e[_0xeeb2('0xae')]['id']}})[_0xeeb2('0x28')](handleEntityNotFound(_0x517356,null))['then'](function(_0x2ff6b8){if(_0x2ff6b8){return _0x2ff6b8[_0xeeb2('0xbc')](_0x1ec70e['body']['ids'],_[_0xeeb2('0xb4')](_0x1ec70e[_0xeeb2('0x73')],[_0xeeb2('0xb3'),'id'])||{})[_0xeeb2('0xbd')](function(){return db[_0xeeb2('0x6c')]['findAll']({'attributes':['id',_0xeeb2('0x2c'),_0xeeb2('0xbe')],'where':{'id':_0x1ec70e[_0xeeb2('0x73')][_0xeeb2('0xb3')]}});})[_0xeeb2('0x28')](function(_0x234551){socket[_0xeeb2('0xbf')](_0xeeb2('0xc0'),{'id':Number(_0x1ec70e[_0xeeb2('0xae')]['id']),'tags':_0x234551||[]});return{'id':Number(_0x1ec70e[_0xeeb2('0xae')]['id']),'tags':_0x234551||[]};});}})[_0xeeb2('0x28')](respondWithResult(_0x517356,null))[_0xeeb2('0x35')](handleError(_0x517356,null));};exports[_0xeeb2('0xc1')]=function(_0x7c6d5a,_0x1394cc,_0x40fe57){return db[_0xeeb2('0x37')][_0xeeb2('0x5e')]({'where':{'id':_0x7c6d5a['params']['id']}})['then'](handleEntityNotFound(_0x1394cc,null))[_0xeeb2('0x28')](function(_0x28ac17){if(_0x28ac17){return _0x28ac17[_0xeeb2('0xc1')](_0x7c6d5a['query'][_0xeeb2('0xb3')]);}})[_0xeeb2('0x28')](respondWithStatusCode(_0x1394cc,null))[_0xeeb2('0x35')](handleError(_0x1394cc,null));};exports[_0xeeb2('0xc2')]=function(_0x2ef9d1,_0x5e150f){var _0x27719c=moment()[_0xeeb2('0xc3')]()['toString']();var _0x201c48=path[_0xeeb2('0xc4')](config['root'],_0xeeb2('0xc5'),_0xeeb2('0xc6'),_0xeeb2('0xc7'));var _0x965b5a=path[_0xeeb2('0xc4')](config[_0xeeb2('0xc8')],_0xeeb2('0xc5'),_0xeeb2('0xc6'),'attachments');var _0x226ff3=path[_0xeeb2('0xc4')](_0x201c48,_0x27719c);var _0x37968e=util[_0xeeb2('0xb6')](_0xeeb2('0xc9'),_0x2ef9d1['params']['id'],_0x27719c);var _0x4a4ee8=path['join'](_0x201c48,_0x37968e);var _0x1c6f1d=[];_0x1c6f1d[_0xeeb2('0x34')]({'model':db[_0xeeb2('0x6f')],'as':_0xeeb2('0x6f'),'attributes':['id',_0xeeb2('0x2f')],'raw':!![]});_0x1c6f1d[_0xeeb2('0x34')]({'model':db[_0xeeb2('0xca')],'as':_0xeeb2('0x64'),'attributes':['id',_0xeeb2('0xcb'),_0xeeb2('0xcc')],'raw':!![]});if(_0x2ef9d1['query'][_0xeeb2('0xcd')]){_0x1c6f1d['push']({'model':db[_0xeeb2('0xce')],'as':_0xeeb2('0xce'),'raw':!![]});}var _0x3a7711=[{'model':db[_0xeeb2('0xb8')],'as':_0xeeb2('0xcf'),'attributes':['id',_0xeeb2('0x73'),_0xeeb2('0x7b'),'direction',_0xeeb2('0xd0'),'read'],'include':_0x1c6f1d}];_0x3a7711[_0xeeb2('0x34')]({'model':db[_0xeeb2('0xd1')],'as':_0xeeb2('0xd2'),'attributes':['id',_0xeeb2('0x2c')]});_0x3a7711[_0xeeb2('0x34')]({'model':db[_0xeeb2('0x6f')],'as':_0xeeb2('0xd3'),'attributes':['id',_0xeeb2('0x2f')]});return db[_0xeeb2('0x37')][_0xeeb2('0x5e')]({'where':{'id':_0x2ef9d1[_0xeeb2('0xae')]['id']},'include':_0x3a7711})['then'](handleEntityNotFound(_0x5e150f,null))[_0xeeb2('0x28')](function(_0x15e070){if(_0x15e070){var _0x17894b=_0x15e070[_0xeeb2('0xd4')]({'plain':!![]});fs['mkdirSync'](_0x226ff3);var _0xc96a98={'channel':_0xeeb2('0xd5'),'account':_0x17894b[_0xeeb2('0xd2')][_0xeeb2('0x2c')],'agent':_0x17894b[_0xeeb2('0xd3')]?_0x17894b[_0xeeb2('0xd3')]['fullname']:_0xeeb2('0xd6'),'createdAt':moment(_0x17894b[_0xeeb2('0x7b')])['format'](_0xeeb2('0xb7'))[_0xeeb2('0x9a')](),'closedAt':_0x17894b[_0xeeb2('0xd7')]?moment(_0x17894b[_0xeeb2('0xd8')])[_0xeeb2('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x17894b[_0xeeb2('0xd9')],'visibility':_0x17894b[_0xeeb2('0xda')]?_0xeeb2('0xdb'):_0xeeb2('0xdc'),'messages':_(_0x17894b[_0xeeb2('0xcf')])[_0xeeb2('0x87')]({'secret':![]})[_0xeeb2('0x2e')](function(_0x446bb2){if(_0x446bb2[_0xeeb2('0xce')]){var _0x126e0b=path[_0xeeb2('0xc4')](_0x965b5a,_0x446bb2[_0xeeb2('0xce')][_0xeeb2('0xdd')]);if(fs[_0xeeb2('0xde')](_0x126e0b)){fs[_0xeeb2('0xdf')](_0x126e0b)['pipe'](fs[_0xeeb2('0xe0')](path[_0xeeb2('0xc4')](_0x226ff3,_0x446bb2[_0xeeb2('0xce')][_0xeeb2('0xdd')])));}}return{'date':moment(_0x446bb2[_0xeeb2('0x7b')])[_0xeeb2('0xb6')](_0xeeb2('0xb7'))[_0xeeb2('0x9a')](),'sender':_0x446bb2[_0xeeb2('0xe1')]==='out'?_0x446bb2['User']?_0x446bb2[_0xeeb2('0x6f')]['fullname']:'System':_0x446bb2[_0xeeb2('0x64')][_0xeeb2('0xcb')]+(_0x446bb2[_0xeeb2('0x64')][_0xeeb2('0xcc')]?'\x20'+_0x446bb2['Contact'][_0xeeb2('0xcc')]:''),'body':_0x446bb2['Attachment']?_0x446bb2['Attachment'][_0xeeb2('0xdd')]:_0x446bb2['body'],'direction':_0x446bb2[_0xeeb2('0xe1')]==='out'?'A':'C','secret':_0x446bb2[_0xeeb2('0xd0')],'read':_0x446bb2['read'],'attachment':_0x446bb2[_0xeeb2('0xce')]};})[_0xeeb2('0x60')]()};return ejs[_0xeeb2('0xe2')](path['join'](config[_0xeeb2('0xc8')],_0xeeb2('0xc5'),_0xeeb2('0xe3'),'downloadInteraction.ejs'),{'interaction':_0xc96a98})['then'](function(_0x3e457a){var _0x50d92f=path['join'](_0x226ff3,_0xeeb2('0xe4')+_0x17894b['id']+'-'+_0x27719c+_0xeeb2('0xe5'));var _0x20bb03={'path':_0x50d92f,'channel':_0xeeb2('0xd5'),'interactionId':_0x17894b['id']};return pdf[_0xeeb2('0xe6')](_0x3e457a,_0x20bb03);})['then'](function(){return new BPromise(function(_0xd25c62,_0x56b57c){zipdir(_0x226ff3,{'saveTo':_0x4a4ee8},function(_0x5b2c41,_0x57c01f){if(_0x5b2c41)return _0x56b57c(_0x5b2c41);return _0xd25c62(_0x57c01f);});})[_0xeeb2('0x28')](function(){return new BPromise(function(_0x1ef90b,_0x4dbe6b){rimraf(_0x226ff3,function(_0x26a1f6){if(_0x26a1f6)_0x4dbe6b(_0x26a1f6);return _0x1ef90b();});});})[_0xeeb2('0x28')](function(){return _0x5e150f[_0xeeb2('0xc2')](_0x4a4ee8,_0x37968e,function(_0x24acbc){if(_0x24acbc){console[_0xeeb2('0xe7')](_0xeeb2('0xe8'),_0x24acbc);}else{fs[_0xeeb2('0xe9')](_0x4a4ee8);}});});});}else{return _0x5e150f['sendStatus'](0xc8);}})[_0xeeb2('0x35')](handleError(_0x5e150f,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index b7f2fb8..24572aa 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 _0x3072=['findAll','unreadMessages','length','emit','catch','exports','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3072,0x1aa));var _0x2307=function(_0x1f8d7d,_0x4bb45){_0x1f8d7d=_0x1f8d7d-0x0;var _0x2bf5fc=_0x3072[_0x1f8d7d];return _0x2bf5fc;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require('../../mysqldb')['db'][_0x2307('0x0')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x2307('0x1')](0x0);var events={'afterCreate':_0x2307('0x2'),'afterUpdate':_0x2307('0x3'),'afterDestroy':_0x2307('0x4')};function emitEvent(_0x5727ec){return function(_0x269786,_0x34d983,_0x3b1abd){_0x269786[_0x2307('0x5')]({'attributes':['id'],'raw':!![]})[_0x2307('0x6')](function(_0x241b2f){_0x269786[_0x2307('0x7')]('Users',_0x241b2f[_0x2307('0x8')](function(_0x713a28){return{'id':_0x713a28['id']};}));return OpenchannelMessage[_0x2307('0x9')]({'where':{'OpenchannelInteractionId':_0x269786['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2307('0x6')](function(_0x4d7b9e){_0x269786[_0x2307('0x7')](_0x2307('0xa'),_0x4d7b9e[_0x2307('0xb')]);OpenchannelInteractionEvents[_0x2307('0xc')](_0x5727ec+':'+_0x269786['id'],_0x269786);OpenchannelInteractionEvents[_0x2307('0xc')](_0x5727ec,_0x269786);_0x3b1abd(null);})[_0x2307('0xd')](_0x3b1abd(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x2307('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x511d=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','hasOwnProperty','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x58b2dc,_0x5502da){var _0x16817d=function(_0x19c9c8){while(--_0x19c9c8){_0x58b2dc['push'](_0x58b2dc['shift']());}};_0x16817d(++_0x5502da);}(_0x511d,0x163));var _0xd511=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x511d[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xd511('0x0'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xd511('0x0'))['db'][_0xd511('0x1')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xd511('0x2')](0x0);var events={'afterCreate':_0xd511('0x3'),'afterUpdate':_0xd511('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b189a){return function(_0x1b87ae,_0x503883,_0x52638b){_0x1b87ae[_0xd511('0x5')]({'attributes':['id'],'raw':!![]})[_0xd511('0x6')](function(_0x3804dd){_0x1b87ae[_0xd511('0x7')](_0xd511('0x8'),_0x3804dd[_0xd511('0x9')](function(_0x34a653){return{'id':_0x34a653['id']};}));return OpenchannelMessage[_0xd511('0xa')]({'where':{'OpenchannelInteractionId':_0x1b87ae['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd511('0x6')](function(_0x1de696){_0x1b87ae[_0xd511('0x7')](_0xd511('0xb'),_0x1de696[_0xd511('0xc')]);OpenchannelInteractionEvents['emit'](_0x2b189a+':'+_0x1b87ae['id'],_0x1b87ae);OpenchannelInteractionEvents['emit'](_0x2b189a,_0x1b87ae);_0x52638b(null);})['catch'](_0x52638b(null));};}for(var e in events){if(events[_0xd511('0xd')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xd511('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 3979baa..ba03c45 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 _0x0d74=['openchannel_interactions','utf8mb4','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','bluebird','request-promise','path','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x9e5369,_0x3f3a4a){var _0x3d2cb8=function(_0x38ceb5){while(--_0x38ceb5){_0x9e5369['push'](_0x9e5369['shift']());}};_0x3d2cb8(++_0x3f3a4a);}(_0x0d74,0x1c9));var _0x40d7=function(_0x397cc9,_0x2210fb){_0x397cc9=_0x397cc9-0x0;var _0x2a038c=_0x0d74[_0x397cc9];return _0x2a038c;};'use strict';var _=require('lodash');var util=require(_0x40d7('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x40d7('0x1'));var rp=require(_0x40d7('0x2'));var fs=require('fs');var path=require(_0x40d7('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x40d7('0x4'));module[_0x40d7('0x5')]=function(_0x98659b,_0x2035dc){return _0x98659b[_0x40d7('0x6')](_0x40d7('0x7'),attributes,{'tableName':_0x40d7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x40d7('0x9'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x54ed26,_0x5d960e,_0x7359e8){if(_0x54ed26[_0x40d7('0xa')](_0x40d7('0xb'))){_0x54ed26[_0x40d7('0xc')]=moment()[_0x40d7('0xd')](_0x40d7('0xe'));}_0x7359e8(null,_0x54ed26);}}});}; \ No newline at end of file +var _0xd8fd=['../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x25f7d1,_0x5016e4){var _0x4f4172=function(_0x5e74c6){while(--_0x5e74c6){_0x25f7d1['push'](_0x25f7d1['shift']());}};_0x4f4172(++_0x5016e4);}(_0xd8fd,0xe4));var _0xdd8f=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0xd8fd[_0x1ee0a1];return _0x1d2d5b;};'use strict';var _=require(_0xdd8f('0x0'));var util=require('util');var logger=require(_0xdd8f('0x1'))('api');var moment=require(_0xdd8f('0x2'));var BPromise=require(_0xdd8f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd8f('0x4'));var rimraf=require(_0xdd8f('0x5'));var config=require(_0xdd8f('0x6'));var attributes=require(_0xdd8f('0x7'));module['exports']=function(_0x5c3212,_0x7371bb){return _0x5c3212[_0xdd8f('0x8')](_0xdd8f('0x9'),attributes,{'tableName':_0xdd8f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdd8f('0xb'),'collate':_0xdd8f('0xc'),'hooks':{'beforeUpdate':function(_0x55e839,_0x110619,_0x28fa29){if(_0x55e839[_0xdd8f('0xd')](_0xdd8f('0xe'))){_0x55e839[_0xdd8f('0xf')]=moment()[_0xdd8f('0x10')](_0xdd8f('0x11'));}_0x28fa29(null,_0x55e839);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 29d2a31..7130ae7 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 _0xaf0b=['where','attributes','limit','then','stringify','OpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw'];(function(_0xf97383,_0x242f75){var _0x506e4e=function(_0x2b1577){while(--_0x2b1577){_0xf97383['push'](_0xf97383['shift']());}};_0x506e4e(++_0x242f75);}(_0xaf0b,0x1cd));var _0xbaf0=function(_0x58560f,_0x36d293){_0x58560f=_0x58560f-0x0;var _0x488442=_0xaf0b[_0x58560f];return _0x488442;};'use strict';var _=require(_0xbaf0('0x0'));var util=require(_0xbaf0('0x1'));var moment=require(_0xbaf0('0x2'));var BPromise=require(_0xbaf0('0x3'));var rs=require(_0xbaf0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbaf0('0x5'))['db'];var utils=require(_0xbaf0('0x6'));var logger=require('../../config/logger')(_0xbaf0('0x7'));var config=require(_0xbaf0('0x8'));var jayson=require(_0xbaf0('0x9'));var client=jayson[_0xbaf0('0xa')][_0xbaf0('0xb')]({'port':0x232a});config[_0xbaf0('0xc')]=_[_0xbaf0('0xd')](config[_0xbaf0('0xc')],{'host':_0xbaf0('0xe'),'port':0x18eb});var socket=require(_0xbaf0('0xf'))(new Redis(config['redis']));require(_0xbaf0('0x10'))[_0xbaf0('0x11')](socket);function respondWithRpcPromise(_0x1ea2d5,_0x36c24d,_0x3ebd3e){return new BPromise(function(_0x8e5caf,_0x30afff){return client[_0xbaf0('0x12')](_0x1ea2d5,_0x3ebd3e)['then'](function(_0x2a3d2f){logger[_0xbaf0('0x13')](_0xbaf0('0x14'),_0x36c24d,_0xbaf0('0x15'));logger[_0xbaf0('0x16')](_0xbaf0('0x17'),_0x36c24d,_0xbaf0('0x15'),JSON['stringify'](_0x2a3d2f));if(_0x2a3d2f[_0xbaf0('0x18')]){if(_0x2a3d2f[_0xbaf0('0x18')][_0xbaf0('0x19')]===0x1f4){logger['error'](_0xbaf0('0x14'),_0x36c24d,_0x2a3d2f[_0xbaf0('0x18')][_0xbaf0('0x1a')]);return _0x30afff(_0x2a3d2f[_0xbaf0('0x18')][_0xbaf0('0x1a')]);}logger[_0xbaf0('0x18')](_0xbaf0('0x14'),_0x36c24d,_0x2a3d2f['error'][_0xbaf0('0x1a')]);return _0x8e5caf(_0x2a3d2f[_0xbaf0('0x18')][_0xbaf0('0x1a')]);}else{logger[_0xbaf0('0x13')](_0xbaf0('0x14'),_0x36c24d,_0xbaf0('0x15'));_0x8e5caf(_0x2a3d2f[_0xbaf0('0x1b')][_0xbaf0('0x1a')]);}})[_0xbaf0('0x1c')](function(_0x2e4c10){logger['error'](_0xbaf0('0x14'),_0x36c24d,_0x2e4c10);_0x30afff(_0x2e4c10);});});}exports[_0xbaf0('0x1d')]=function(_0x44282f){var _0x4555cd=this;return new Promise(function(_0x4f19fb,_0x48ab27){return db['OpenchannelInteraction'][_0xbaf0('0x1e')](_0x44282f[_0xbaf0('0x1f')],{'raw':_0x44282f[_0xbaf0('0x20')]?_0x44282f[_0xbaf0('0x20')][_0xbaf0('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44282f[_0xbaf0('0x20')]?_0x44282f[_0xbaf0('0x20')][_0xbaf0('0x22')]||null:null,'attributes':_0x44282f[_0xbaf0('0x20')]?_0x44282f[_0xbaf0('0x20')][_0xbaf0('0x23')]||null:null,'limit':_0x44282f[_0xbaf0('0x20')]?_0x44282f['options'][_0xbaf0('0x24')]||null:null})[_0xbaf0('0x25')](function(_0x13e367){logger[_0xbaf0('0x13')]('UpdateOpenchannelInteraction',_0x44282f);logger['debug'](_0xbaf0('0x1d'),_0x44282f,JSON[_0xbaf0('0x26')](_0x13e367));_0x4f19fb(_0x13e367);})['catch'](function(_0x5a3053){logger[_0xbaf0('0x18')](_0xbaf0('0x1d'),_0x5a3053['message'],_0x44282f);_0x48ab27(_0x4555cd[_0xbaf0('0x18')](0x1f4,_0x5a3053[_0xbaf0('0x1a')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x32a850){return new Promise(function(_0xa60c5a,_0x2161d9){return db[_0xbaf0('0x27')][_0xbaf0('0x28')]({'where':_0x32a850[_0xbaf0('0x20')]?_0x32a850[_0xbaf0('0x20')][_0xbaf0('0x22')]||null:null})[_0xbaf0('0x25')](function(_0x334c58){if(_0x334c58){return _0x334c58['addTags'](_0x32a850[_0xbaf0('0x1f')][_0xbaf0('0x29')],_[_0xbaf0('0x2a')](_0x32a850[_0xbaf0('0x1f')],[_0xbaf0('0x29'),'id'])||{});}})[_0xbaf0('0x2b')](function(_0x317820){logger[_0xbaf0('0x13')](_0xbaf0('0x2c'),_0x32a850);logger[_0xbaf0('0x16')]('AddTags',_0x32a850,JSON[_0xbaf0('0x26')](_0x317820));_0xa60c5a(_0x317820);})['catch'](function(_0x5cb98f){logger[_0xbaf0('0x18')](_0xbaf0('0x2c'),_0x5cb98f[_0xbaf0('0x1a')],_0x32a850);_0x2161d9(_this[_0xbaf0('0x18')](0x1f4,_0x5cb98f[_0xbaf0('0x1a')]));});});}; \ No newline at end of file +var _0x859c=['rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelInteraction','update','options','raw','where','attributes','limit','UpdateOpenchannelInteraction','debug','AddTagsToOpenchannelInteraction','find','body','omit','ids','spread','AddTags','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f4b38,_0x56456a){var _0x291ace=function(_0x222151){while(--_0x222151){_0x2f4b38['push'](_0x2f4b38['shift']());}};_0x291ace(++_0x56456a);}(_0x859c,0x1a8));var _0xc859=function(_0x627b53,_0x89e407){_0x627b53=_0x627b53-0x0;var _0x3e27b7=_0x859c[_0x627b53];return _0x3e27b7;};'use strict';var _=require('lodash');var util=require(_0xc859('0x0'));var moment=require(_0xc859('0x1'));var BPromise=require(_0xc859('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc859('0x3'))['db'];var utils=require(_0xc859('0x4'));var logger=require(_0xc859('0x5'))(_0xc859('0x6'));var config=require(_0xc859('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc859('0x8')][_0xc859('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xc859('0xa')],{'host':_0xc859('0xb'),'port':0x18eb});var socket=require(_0xc859('0xc'))(new Redis(config[_0xc859('0xa')]));require(_0xc859('0xd'))[_0xc859('0xe')](socket);function respondWithRpcPromise(_0x2f6257,_0x146774,_0x267008){return new BPromise(function(_0x54ceef,_0x1c4a18){return client[_0xc859('0xf')](_0x2f6257,_0x267008)[_0xc859('0x10')](function(_0x4a9a8c){logger[_0xc859('0x11')](_0xc859('0x12'),_0x146774,_0xc859('0x13'));logger['debug'](_0xc859('0x14'),_0x146774,_0xc859('0x13'),JSON[_0xc859('0x15')](_0x4a9a8c));if(_0x4a9a8c['error']){if(_0x4a9a8c[_0xc859('0x16')][_0xc859('0x17')]===0x1f4){logger[_0xc859('0x16')](_0xc859('0x12'),_0x146774,_0x4a9a8c[_0xc859('0x16')][_0xc859('0x18')]);return _0x1c4a18(_0x4a9a8c['error'][_0xc859('0x18')]);}logger[_0xc859('0x16')]('OpenchannelInteraction,\x20%s,\x20%s',_0x146774,_0x4a9a8c[_0xc859('0x16')][_0xc859('0x18')]);return _0x54ceef(_0x4a9a8c[_0xc859('0x16')]['message']);}else{logger[_0xc859('0x11')](_0xc859('0x12'),_0x146774,_0xc859('0x13'));_0x54ceef(_0x4a9a8c[_0xc859('0x19')]['message']);}})['catch'](function(_0x36bb46){logger[_0xc859('0x16')](_0xc859('0x12'),_0x146774,_0x36bb46);_0x1c4a18(_0x36bb46);});});}exports['UpdateOpenchannelInteraction']=function(_0x509cde){var _0x356963=this;return new Promise(function(_0x42a960,_0x38a3fc){return db[_0xc859('0x1a')][_0xc859('0x1b')](_0x509cde['body'],{'raw':_0x509cde[_0xc859('0x1c')]?_0x509cde[_0xc859('0x1c')][_0xc859('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x509cde['options']?_0x509cde['options'][_0xc859('0x1e')]||null:null,'attributes':_0x509cde['options']?_0x509cde[_0xc859('0x1c')][_0xc859('0x1f')]||null:null,'limit':_0x509cde[_0xc859('0x1c')]?_0x509cde['options'][_0xc859('0x20')]||null:null})[_0xc859('0x10')](function(_0x2a4f31){logger[_0xc859('0x11')](_0xc859('0x21'),_0x509cde);logger[_0xc859('0x22')]('UpdateOpenchannelInteraction',_0x509cde,JSON[_0xc859('0x15')](_0x2a4f31));_0x42a960(_0x2a4f31);})['catch'](function(_0x234cfe){logger['error'](_0xc859('0x21'),_0x234cfe[_0xc859('0x18')],_0x509cde);_0x38a3fc(_0x356963[_0xc859('0x16')](0x1f4,_0x234cfe[_0xc859('0x18')]));});});};exports[_0xc859('0x23')]=function(_0x316762){return new Promise(function(_0x21977b,_0x15b695){return db['OpenchannelInteraction'][_0xc859('0x24')]({'where':_0x316762[_0xc859('0x1c')]?_0x316762[_0xc859('0x1c')]['where']||null:null})[_0xc859('0x10')](function(_0x36313d){if(_0x36313d){return _0x36313d['addTags'](_0x316762[_0xc859('0x25')]['ids'],_[_0xc859('0x26')](_0x316762[_0xc859('0x25')],[_0xc859('0x27'),'id'])||{});}})[_0xc859('0x28')](function(_0x22966b){logger[_0xc859('0x11')]('AddTags',_0x316762);logger[_0xc859('0x22')](_0xc859('0x29'),_0x316762,JSON[_0xc859('0x15')](_0x22966b));_0x21977b(_0x22966b);})[_0xc859('0x2a')](function(_0x5ae9bc){logger[_0xc859('0x16')]('AddTags',_0x5ae9bc['message'],_0x316762);_0x15b695(_this['error'](0x1f4,_0x5ae9bc['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f1c9116..41da997 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 _0x59f3=['emit','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x36b3f0,_0x2ba39d){var _0x35ff51=function(_0x2286a8){while(--_0x2286a8){_0x36b3f0['push'](_0x36b3f0['shift']());}};_0x35ff51(++_0x2ba39d);}(_0x59f3,0x13f));var _0x359f=function(_0x4a367f,_0x4e05f2){_0x4a367f=_0x4a367f-0x0;var _0x2bedd5=_0x59f3[_0x4a367f];return _0x2bedd5;};'use strict';var OpenchannelInteractionEvents=require(_0x359f('0x0'));var events=[_0x359f('0x1'),_0x359f('0x2'),'update'];function createListener(_0x3acb13,_0x4c039b){return function(_0x2a3a40){_0x4c039b[_0x359f('0x3')](_0x3acb13,_0x2a3a40);};}function removeListener(_0x232c41,_0x567440){return function(){OpenchannelInteractionEvents[_0x359f('0x4')](_0x232c41,_0x567440);};}exports['register']=function(_0x26e127){for(var _0x2e0254=0x0,_0x90dfdd=events[_0x359f('0x5')];_0x2e0254<_0x90dfdd;_0x2e0254++){var _0x3764e8=events[_0x2e0254];var _0x4b0041=createListener(_0x359f('0x6')+_0x3764e8,_0x26e127);OpenchannelInteractionEvents['on'](_0x3764e8,_0x4b0041);}}; \ No newline at end of file +var _0x22cc=['./openchannelInteraction.events','save','remove','update','emit','removeListener','register','openchannelInteraction:'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x22cc,0x90));var _0xc22c=function(_0x38b14f,_0xd08fa8){_0x38b14f=_0x38b14f-0x0;var _0x22a324=_0x22cc[_0x38b14f];return _0x22a324;};'use strict';var OpenchannelInteractionEvents=require(_0xc22c('0x0'));var events=[_0xc22c('0x1'),_0xc22c('0x2'),_0xc22c('0x3')];function createListener(_0x6b87e8,_0x40c0bd){return function(_0x2d7ea1){_0x40c0bd[_0xc22c('0x4')](_0x6b87e8,_0x2d7ea1);};}function removeListener(_0x19e8e4,_0x11b524){return function(){OpenchannelInteractionEvents[_0xc22c('0x5')](_0x19e8e4,_0x11b524);};}exports[_0xc22c('0x6')]=function(_0x3c8ebd){for(var _0x4d5695=0x0,_0x4226f8=events['length'];_0x4d5695<_0x4226f8;_0x4d5695++){var _0x5185e0=events[_0x4d5695];var _0x300060=createListener(_0xc22c('0x7')+_0x5185e0,_0x3c8ebd);OpenchannelInteractionEvents['on'](_0x5185e0,_0x300060);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 6302bdb..8b96f80 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x35ec5e,_0x45022b){var _0x599f1d=function(_0x4212e4){while(--_0x4212e4){_0x35ec5e['push'](_0x35ec5e['shift']());}};_0x599f1d(++_0x45022b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x2096b2,_0x53c8bd){var _0x540b16=function(_0x4f7d38){while(--_0x4f7d38){_0x2096b2['push'](_0x2096b2['shift']());}};_0x540b16(++_0x53c8bd);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 78d00b4..58c4fa9 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 _0xabad=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x3a7448,_0x6234df){var _0x3e4494=function(_0x4e0ec3){while(--_0x4e0ec3){_0x3a7448['push'](_0x3a7448['shift']());}};_0x3e4494(++_0x6234df);}(_0xabad,0x150));var _0xdaba=function(_0x508a0a,_0x3ed316){_0x508a0a=_0x508a0a-0x0;var _0x4acf06=_0xabad[_0x508a0a];return _0x4acf06;};'use strict';var Sequelize=require(_0xdaba('0x0'));module['exports']={'body':{'type':Sequelize[_0xdaba('0x1')](_0xdaba('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdaba('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdaba('0x4')]('in',_0xdaba('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xdaba('0x6')]},'providerName':{'type':Sequelize[_0xdaba('0x7')]},'providerResponse':{'type':Sequelize[_0xdaba('0x1')]}}; \ No newline at end of file +var _0xb574=['medium','BOOLEAN','ENUM','out','DATE','STRING','sequelize','exports'];(function(_0x2c3bfa,_0x25c738){var _0x7fbc67=function(_0x5b84cd){while(--_0x5b84cd){_0x2c3bfa['push'](_0x2c3bfa['shift']());}};_0x7fbc67(++_0x25c738);}(_0xb574,0x106));var _0x4b57=function(_0x1aec93,_0xb3b977){_0x1aec93=_0x1aec93-0x0;var _0x3f234f=_0xb574[_0x1aec93];return _0x3f234f;};'use strict';var Sequelize=require(_0x4b57('0x0'));module[_0x4b57('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4b57('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4b57('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4b57('0x4')]('in',_0x4b57('0x5')),'defaultValue':_0x4b57('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4b57('0x6')]},'providerName':{'type':Sequelize[_0x4b57('0x7')]},'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 29e3715..cdcb8db 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 _0xa026=['../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','offset','limit','count','Content-Range','apply','save','update','stack','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','includeAll','findAll','show','params','include','options','find','create','body','describe','openchannel-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','UserId','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','reject','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','User','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5c9967,_0x59304e){var _0x319e8c=function(_0x412f4f){while(--_0x412f4f){_0x5c9967['push'](_0x5c9967['shift']());}};_0x319e8c(++_0x59304e);}(_0xa026,0x1f4));var _0x6a02=function(_0x3816c2,_0xb221e1){_0x3816c2=_0x3816c2-0x0;var _0x144669=_0xa026[_0x3816c2];return _0x144669;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a02('0x0'));var zipdir=require(_0x6a02('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a02('0x2'));var moment=require(_0x6a02('0x3'));var BPromise=require(_0x6a02('0x4'));var Mustache=require(_0x6a02('0x5'));var util=require(_0x6a02('0x6'));var path=require(_0x6a02('0x7'));var sox=require('sox');var csv=require(_0x6a02('0x8'));var ejs=require(_0x6a02('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a02('0xa'));var squel=require(_0x6a02('0xb'));var crypto=require(_0x6a02('0xc'));var jsforce=require(_0x6a02('0xd'));var deskjs=require(_0x6a02('0xe'));var toCsv=require(_0x6a02('0x8'));var querystring=require(_0x6a02('0xf'));var Papa=require('papaparse');var Redis=require(_0x6a02('0x10'));var authService=require(_0x6a02('0x11'));var qs=require(_0x6a02('0x12'));var as=require(_0x6a02('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a02('0x14'))(_0x6a02('0x15'));var utils=require(_0x6a02('0x16'));var config=require(_0x6a02('0x17'));var licenseUtil=require(_0x6a02('0x18'));var db=require(_0x6a02('0x19'))['db'];config[_0x6a02('0x1a')]=_[_0x6a02('0x1b')](config[_0x6a02('0x1a')],{'host':_0x6a02('0x1c'),'port':0x18eb});var socket=require(_0x6a02('0x1d'))(new Redis(config[_0x6a02('0x1a')]));require(_0x6a02('0x1e'))[_0x6a02('0x1f')](socket);var jayson=require(_0x6a02('0x20'));var client=jayson['client'][_0x6a02('0x21')]({'port':0x232c});var client9002=jayson[_0x6a02('0x22')][_0x6a02('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x521d70,_0x3e5c92,_0x27ca26,_0x2ca19d){return new BPromise(function(_0x472d30,_0x107193){var _0x115387=_0x2ca19d||client;return _0x115387[_0x6a02('0x23')](_0x521d70,_0x27ca26)[_0x6a02('0x24')](function(_0x1469ec){logger[_0x6a02('0x25')](_0x6a02('0x26'),_0x3e5c92,_0x6a02('0x27'));logger[_0x6a02('0x28')](_0x6a02('0x29'),_0x3e5c92,_0x6a02('0x27'),JSON[_0x6a02('0x2a')](_0x1469ec));if(_0x1469ec[_0x6a02('0x2b')]){if(_0x1469ec[_0x6a02('0x2b')][_0x6a02('0x2c')]===0x1f4){logger['error'](_0x6a02('0x26'),_0x3e5c92,_0x1469ec[_0x6a02('0x2b')][_0x6a02('0x2d')]);return _0x107193(_0x1469ec['error']['message']);}logger[_0x6a02('0x2b')](_0x6a02('0x26'),_0x3e5c92,_0x1469ec[_0x6a02('0x2b')]['message']);return _0x472d30(_0x1469ec[_0x6a02('0x2b')]['message']);}else{logger[_0x6a02('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e5c92,_0x6a02('0x27'));_0x472d30(_0x1469ec['result'][_0x6a02('0x2d')]);}})[_0x6a02('0x2e')](function(_0x15e341){logger[_0x6a02('0x2b')](_0x6a02('0x26'),_0x3e5c92,_0x15e341);_0x107193(_0x15e341);});});}function respondWithStatusCode(_0x1fe405,_0x2e6ca9){_0x2e6ca9=_0x2e6ca9||0xcc;return function(_0x32deb7){if(_0x32deb7){return _0x1fe405[_0x6a02('0x2f')](_0x2e6ca9);}return _0x1fe405[_0x6a02('0x30')](_0x2e6ca9)[_0x6a02('0x31')]();};}function respondWithResult(_0x3e36a7,_0x1ab581){_0x1ab581=_0x1ab581||0xc8;return function(_0x34e938){if(_0x34e938){return _0x3e36a7[_0x6a02('0x30')](_0x1ab581)['json'](_0x34e938);}};}function respondWithFilteredResult(_0x43a033,_0x14a900){return function(_0x20aa0e){if(_0x20aa0e){var _0x5cad1c=typeof _0x14a900[_0x6a02('0x32')]==='undefined'&&typeof _0x14a900[_0x6a02('0x33')]==='undefined';var _0x2ed9a7=_0x20aa0e['count'];var _0x7c14d7=_0x5cad1c?0x0:_0x14a900[_0x6a02('0x32')];var _0x3b645c=_0x5cad1c?_0x20aa0e[_0x6a02('0x34')]:_0x14a900['offset']+_0x14a900[_0x6a02('0x33')];var _0x46cf58;if(_0x3b645c>=_0x2ed9a7){_0x3b645c=_0x2ed9a7;_0x46cf58=0xc8;}else{_0x46cf58=0xce;}_0x43a033['status'](_0x46cf58);return _0x43a033['set'](_0x6a02('0x35'),_0x7c14d7+'-'+_0x3b645c+'/'+_0x2ed9a7)['json'](_0x20aa0e);}return null;};}function patchUpdates(_0x24b3f2){return function(_0x314d3a){try{jsonpatch[_0x6a02('0x36')](_0x314d3a,_0x24b3f2,!![]);}catch(_0x28f067){return BPromise['reject'](_0x28f067);}return _0x314d3a[_0x6a02('0x37')]();};}function saveUpdates(_0x3fc3db,_0x1db090){return function(_0x54b9ad){if(_0x54b9ad){return _0x54b9ad[_0x6a02('0x38')](_0x3fc3db)[_0x6a02('0x24')](function(_0xc865d4){return _0xc865d4;});}return null;};}function removeEntity(_0x49ba23,_0x4a460c){return function(_0x417518){if(_0x417518){return _0x417518['destroy']()[_0x6a02('0x24')](function(){_0x49ba23[_0x6a02('0x30')](0xcc)[_0x6a02('0x31')]();});}};}function handleEntityNotFound(_0x1a961b,_0x38e200){return function(_0x5d2e0c){if(!_0x5d2e0c){_0x1a961b[_0x6a02('0x2f')](0x194);}return _0x5d2e0c;};}function handleError(_0x3d3162,_0x1cfe41){_0x1cfe41=_0x1cfe41||0x1f4;return function(_0x4b8df2){logger[_0x6a02('0x2b')](_0x4b8df2[_0x6a02('0x39')]);if(_0x4b8df2[_0x6a02('0x3a')]){delete _0x4b8df2['name'];}_0x3d3162[_0x6a02('0x30')](_0x1cfe41)[_0x6a02('0x3b')](_0x4b8df2);};}exports[_0x6a02('0x3c')]=function(_0x229abf,_0x44faf1){var _0x12da95={},_0x2a8358={},_0x2cb777={'count':0x0,'rows':[]};var _0x1a051d=_[_0x6a02('0x3d')](db[_0x6a02('0x3e')][_0x6a02('0x3f')],function(_0x25a7e9){return{'name':_0x25a7e9[_0x6a02('0x40')],'type':_0x25a7e9[_0x6a02('0x41')]['key']};});_0x2a8358[_0x6a02('0x42')]=_[_0x6a02('0x3d')](_0x1a051d,'name');_0x2a8358[_0x6a02('0x43')]=_[_0x6a02('0x44')](_0x229abf[_0x6a02('0x43')]);_0x2a8358['filters']=_[_0x6a02('0x45')](_0x2a8358[_0x6a02('0x42')],_0x2a8358[_0x6a02('0x43')]);_0x12da95[_0x6a02('0x46')]=_[_0x6a02('0x45')](_0x2a8358[_0x6a02('0x42')],qs[_0x6a02('0x47')](_0x229abf[_0x6a02('0x43')][_0x6a02('0x47')]));_0x12da95[_0x6a02('0x46')]=_0x12da95[_0x6a02('0x46')][_0x6a02('0x48')]?_0x12da95[_0x6a02('0x46')]:_0x2a8358[_0x6a02('0x42')];if(!_0x229abf[_0x6a02('0x43')][_0x6a02('0x49')](_0x6a02('0x4a'))){_0x12da95['limit']=qs[_0x6a02('0x33')](_0x229abf[_0x6a02('0x43')][_0x6a02('0x33')]);_0x12da95[_0x6a02('0x32')]=qs[_0x6a02('0x32')](_0x229abf['query'][_0x6a02('0x32')]);}_0x12da95[_0x6a02('0x4b')]=qs[_0x6a02('0x4c')](_0x229abf[_0x6a02('0x43')][_0x6a02('0x4c')]);_0x12da95[_0x6a02('0x4d')]=qs[_0x6a02('0x4e')](_[_0x6a02('0x4f')](_0x229abf['query'],_0x2a8358['filters']),_0x1a051d);if(_0x229abf[_0x6a02('0x43')]['filter']){_0x12da95['where']=_['merge'](_0x12da95[_0x6a02('0x4d')],{'$or':_[_0x6a02('0x3d')](_0x1a051d,function(_0x2cccf2){if(_0x2cccf2['type']!==_0x6a02('0x50')){var _0xb75b50={};_0xb75b50[_0x2cccf2[_0x6a02('0x3a')]]={'$like':'%'+_0x229abf[_0x6a02('0x43')][_0x6a02('0x51')]+'%'};return _0xb75b50;}})});}_0x12da95=_[_0x6a02('0x52')]({},_0x12da95,_0x229abf['options']);var _0x4009ee={'where':_0x12da95['where']};return db[_0x6a02('0x3e')]['count'](_0x4009ee)[_0x6a02('0x24')](function(_0x34fab8){_0x2cb777[_0x6a02('0x34')]=_0x34fab8;if(_0x229abf[_0x6a02('0x43')][_0x6a02('0x53')]){_0x12da95['include']=[{'all':!![]}];}return db[_0x6a02('0x3e')][_0x6a02('0x54')](_0x12da95);})[_0x6a02('0x24')](function(_0x3b7e71){_0x2cb777['rows']=_0x3b7e71;return _0x2cb777;})[_0x6a02('0x24')](respondWithFilteredResult(_0x44faf1,_0x12da95))[_0x6a02('0x2e')](handleError(_0x44faf1,null));};exports[_0x6a02('0x55')]=function(_0x1d35b7,_0x562ae2){var _0x43d7a0={'raw':!![],'where':{'id':_0x1d35b7[_0x6a02('0x56')]['id']}},_0xcbdb2={};_0xcbdb2['model']=_['keys'](db['OpenchannelMessage'][_0x6a02('0x3f')]);_0xcbdb2[_0x6a02('0x43')]=_[_0x6a02('0x44')](_0x1d35b7[_0x6a02('0x43')]);_0xcbdb2[_0x6a02('0x4e')]=_[_0x6a02('0x45')](_0xcbdb2[_0x6a02('0x42')],_0xcbdb2[_0x6a02('0x43')]);_0x43d7a0[_0x6a02('0x46')]=_['intersection'](_0xcbdb2[_0x6a02('0x42')],qs[_0x6a02('0x47')](_0x1d35b7[_0x6a02('0x43')]['fields']));_0x43d7a0[_0x6a02('0x46')]=_0x43d7a0['attributes'][_0x6a02('0x48')]?_0x43d7a0[_0x6a02('0x46')]:_0xcbdb2['model'];if(_0x1d35b7['query'][_0x6a02('0x53')]){_0x43d7a0[_0x6a02('0x57')]=[{'all':!![]}];}_0x43d7a0=_['merge']({},_0x43d7a0,_0x1d35b7[_0x6a02('0x58')]);return db['OpenchannelMessage'][_0x6a02('0x59')](_0x43d7a0)['then'](handleEntityNotFound(_0x562ae2,null))[_0x6a02('0x24')](respondWithResult(_0x562ae2,null))[_0x6a02('0x2e')](handleError(_0x562ae2,null));};exports[_0x6a02('0x5a')]=function(_0x27ee5d,_0x3a6b7f){return db['OpenchannelMessage']['create'](_0x27ee5d['body'],{})['then'](respondWithResult(_0x3a6b7f,0xc9))[_0x6a02('0x2e')](handleError(_0x3a6b7f,null));};exports[_0x6a02('0x38')]=function(_0x315875,_0x3722b7){if(_0x315875[_0x6a02('0x5b')]['id']){delete _0x315875[_0x6a02('0x5b')]['id'];}return db['OpenchannelMessage'][_0x6a02('0x59')]({'where':{'id':_0x315875[_0x6a02('0x56')]['id']}})[_0x6a02('0x24')](handleEntityNotFound(_0x3722b7,null))['then'](saveUpdates(_0x315875[_0x6a02('0x5b')],null))[_0x6a02('0x24')](respondWithResult(_0x3722b7,null))[_0x6a02('0x2e')](handleError(_0x3722b7,null));};exports['destroy']=function(_0x1cc9f4,_0x4f16e2){return db[_0x6a02('0x3e')]['find']({'where':{'id':_0x1cc9f4[_0x6a02('0x56')]['id']}})[_0x6a02('0x24')](handleEntityNotFound(_0x4f16e2,null))['then'](removeEntity(_0x4f16e2,null))[_0x6a02('0x2e')](handleError(_0x4f16e2,null));};exports[_0x6a02('0x5c')]=function(_0x3ae85a,_0x473368){return db[_0x6a02('0x3e')][_0x6a02('0x5c')]()['then'](respondWithResult(_0x473368,null))[_0x6a02('0x2e')](handleError(_0x473368,null));};var interaction_log=require(_0x6a02('0x14'))(_0x6a02('0x5d'));exports[_0x6a02('0x5e')]=function(_0x3d1e57,_0x446eaa,_0x71009e){var _0x4c937d={'agent':{},'channel':'openchannel'};if(_0x3d1e57[_0x6a02('0x5b')]['id']){delete _0x3d1e57[_0x6a02('0x5b')]['id'];}_0x3d1e57[_0x6a02('0x5b')][_0x6a02('0x5f')]=!![];_0x3d1e57[_0x6a02('0x5b')]['readAt']=moment()[_0x6a02('0x60')](_0x6a02('0x61'));_0x3d1e57[_0x6a02('0x5b')]['UserId']=_0x3d1e57[_0x6a02('0x5b')]['UserId']||_0x3d1e57[_0x6a02('0x62')]['id'];_0x4c937d[_0x6a02('0x63')]['id']=_0x3d1e57[_0x6a02('0x5b')]['UserId'];return db[_0x6a02('0x3e')]['find']({'where':{'id':_0x3d1e57[_0x6a02('0x56')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x446eaa,null))[_0x6a02('0x24')](saveUpdates(_0x3d1e57[_0x6a02('0x5b')],null))[_0x6a02('0x24')](function(_0x345f9e){if(_0x345f9e){_0x4c937d['message']=_0x345f9e[_0x6a02('0x64')]({'plain':!![]});return db[_0x6a02('0x65')][_0x6a02('0x59')]({'where':{'id':_0x345f9e[_0x6a02('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x446eaa,null))[_0x6a02('0x24')](function(_0x1814a8){if(_0x1814a8){return _0x1814a8[_0x6a02('0x38')]({'UserId':_0x3d1e57[_0x6a02('0x5b')]['UserId'],'read1stAt':_['isNil'](_0x1814a8[_0x6a02('0x67')])?moment()[_0x6a02('0x60')](_0x6a02('0x61')):undefined});}return null;})[_0x6a02('0x24')](function(_0x234e78){if(_0x234e78){_0x4c937d[_0x6a02('0x68')]=_0x234e78[_0x6a02('0x64')]({'plain':!![]});interaction_log[_0x6a02('0x25')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d1e57[_0x6a02('0x62')]['id'],_0x3d1e57['user'][_0x6a02('0x3a')],_0x3d1e57['user'][_0x6a02('0x69')],_0x4c937d[_0x6a02('0x68')]['id'],_0x3d1e57[_0x6a02('0x5b')]?JSON[_0x6a02('0x2a')](_0x3d1e57[_0x6a02('0x5b')]):_0x6a02('0x6a'));return respondWithRpcPromise(_0x6a02('0x6b'),'acceptMessage',_0x4c937d);}return null;})['then'](function(_0x7d5ddd){var _0x4a5d36=_0x6a02('0x6c')+_0x7d5ddd[_0x6a02('0x2d')][_0x6a02('0x6d')];return db[_0x6a02('0x6e')]['query'](_0x4a5d36,{'type':db[_0x6a02('0x6f')]['QueryTypes'][_0x6a02('0x70')],'raw':!![]})[_0x6a02('0x24')](function(_0x3e7194){return _0x3e7194;});})['then'](function(_0xd66f96){if(_0xd66f96){_0x4c937d[_0x6a02('0x2d')][_0x6a02('0x71')]=_0xd66f96[0x0];if(!_0x3d1e57[_0x6a02('0x5b')][_0x6a02('0x72')])return;return db['User'][_0x6a02('0x59')]({'where':{'id':_0x3d1e57['body'][_0x6a02('0x72')],'role':_0x6a02('0x63')},'attributes':['id','name',_0x6a02('0x73'),'email',_0x6a02('0x74')],'raw':!![]});}return null;})[_0x6a02('0x24')](function(_0x10bb70){if(!_0x10bb70)return null;_0x4c937d[_0x6a02('0x2d')][_0x6a02('0x63')]=_0x10bb70;return _0x4c937d;})[_0x6a02('0x24')](function(_0x53fa46){if(_0x53fa46){if(_0x3d1e57[_0x6a02('0x5b')][_0x6a02('0x75')]){_0x4c937d[_0x6a02('0x2d')][_0x6a02('0x76')]=util[_0x6a02('0x60')](_0x6a02('0x77'),_0x3d1e57['user'][_0x6a02('0x3a')]);_0x4c937d['message'][_0x6a02('0x78')]=_0x4c937d[_0x6a02('0x78')];_0x4c937d[_0x6a02('0x2d')][_0x6a02('0x79')]=_0x6a02('0x5e');return respondWithRpcPromise(_0x6a02('0x7a'),_0x6a02('0x7a'),{'event':_0x6a02('0x7b'),'message':_0x4c937d[_0x6a02('0x2d')]},client9002)[_0x6a02('0x24')](function(){return _0x4c937d;});}return _0x4c937d;}return null;})[_0x6a02('0x24')](respondWithResult(_0x446eaa,null))[_0x6a02('0x2e')](handleError(_0x446eaa,null));};var interaction_log=require(_0x6a02('0x14'))(_0x6a02('0x5d'));exports[_0x6a02('0x7c')]=function(_0x819532,_0x568052,_0x5d96e9){var _0x4fc8aa={'agent':{},'channel':_0x6a02('0x7d')};if(_0x819532[_0x6a02('0x5b')]['id']){delete _0x819532['body']['id'];}_0x819532[_0x6a02('0x5b')]['UserId']=_0x819532['body'][_0x6a02('0x72')]||_0x819532[_0x6a02('0x62')]['id'];_0x4fc8aa['agent']['id']=_0x819532['body'][_0x6a02('0x72')];return db[_0x6a02('0x3e')][_0x6a02('0x59')]({'where':{'id':_0x819532['params']['id'],'UserId':null}})[_0x6a02('0x24')](handleEntityNotFound(_0x568052,null))[_0x6a02('0x24')](function(_0x3a696e){if(_0x3a696e){_0x4fc8aa[_0x6a02('0x2d')]=_0x3a696e[_0x6a02('0x64')]({'plain':!![]});return db[_0x6a02('0x65')][_0x6a02('0x59')]({'where':{'id':_0x3a696e[_0x6a02('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x568052,null))[_0x6a02('0x24')](function(_0x3b978){if(_0x3b978){_0x4fc8aa[_0x6a02('0x68')]=_0x3b978['get']({'plain':!![]});interaction_log[_0x6a02('0x25')](_0x6a02('0x7e'),_0x819532['user']['id'],_0x819532[_0x6a02('0x62')][_0x6a02('0x3a')],_0x819532[_0x6a02('0x62')]['role'],_0x4fc8aa[_0x6a02('0x68')]['id'],_0x819532[_0x6a02('0x5b')]?JSON[_0x6a02('0x2a')](_0x819532['body']):_0x6a02('0x6a'));return respondWithRpcPromise(_0x6a02('0x7f'),_0x6a02('0x80'),_0x4fc8aa);}return null;})[_0x6a02('0x24')](function(_0x3f856e){var _0x3f7cec=_0x6a02('0x6c')+_0x3f856e[_0x6a02('0x2d')]['ContactId'];return db[_0x6a02('0x6e')][_0x6a02('0x43')](_0x3f7cec,{'type':db[_0x6a02('0x6f')][_0x6a02('0x81')][_0x6a02('0x70')],'raw':!![]})['then'](function(_0x10785a){return _0x10785a;});})[_0x6a02('0x24')](function(_0x325955){if(_0x325955){_0x4fc8aa['message'][_0x6a02('0x71')]=_0x325955[0x0];if(!_0x819532['body'][_0x6a02('0x72')])return;return db[_0x6a02('0x82')][_0x6a02('0x59')]({'where':{'id':_0x819532[_0x6a02('0x5b')][_0x6a02('0x72')],'role':_0x6a02('0x63')},'attributes':['id',_0x6a02('0x3a'),_0x6a02('0x73'),'email',_0x6a02('0x74')],'raw':!![]});}return null;})[_0x6a02('0x24')](function(_0x3373f4){if(!_0x3373f4)return null;_0x4fc8aa[_0x6a02('0x2d')][_0x6a02('0x63')]=_0x3373f4;return _0x4fc8aa;})[_0x6a02('0x24')](function(_0x37e23f){if(_0x37e23f){_0x37e23f['message'][_0x6a02('0x76')]=util[_0x6a02('0x60')]('SIP/%s',_0x819532[_0x6a02('0x62')][_0x6a02('0x3a')]);_0x37e23f['message']['channel']=_0x4fc8aa[_0x6a02('0x78')];_0x37e23f['message'][_0x6a02('0x79')]=_0x6a02('0x7c');respondWithRpcPromise(_0x6a02('0x7a'),_0x6a02('0x7a'),{'event':'rejectmessage','message':_0x37e23f['message']},client9002);return _0x4fc8aa;}return null;})[_0x6a02('0x24')](respondWithResult(_0x568052,null))[_0x6a02('0x2e')](handleError(_0x568052,null));}; \ No newline at end of file +var _0xc87d=['query','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','type','VIRTUAL','options','OpenchannelMessage','includeAll','include','findAll','rows','show','params','length','create','body','find','describe','../../config/logger','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteractionId','isNil','read1stAt','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','openchannel-interactions','openchannel','OpenchannelInteraction','RejectMessage','rejectMessage','sequelize','fullname','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','stack','name','map','rawAttributes','fieldName','key','keys','filters','intersection','model'];(function(_0x5cbee4,_0xd8172e){var _0x28ee85=function(_0x53de5f){while(--_0x53de5f){_0x5cbee4['push'](_0x5cbee4['shift']());}};_0x28ee85(++_0xd8172e);}(_0xc87d,0xc0));var _0xdc87=function(_0x2dbe9a,_0x1c8e18){_0x2dbe9a=_0x2dbe9a-0x0;var _0x1da014=_0xc87d[_0x2dbe9a];return _0x1da014;};'use strict';var emlformat=require(_0xdc87('0x0'));var rimraf=require(_0xdc87('0x1'));var zipdir=require(_0xdc87('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdc87('0x3'));var moment=require('moment');var BPromise=require(_0xdc87('0x4'));var Mustache=require('mustache');var util=require(_0xdc87('0x5'));var path=require(_0xdc87('0x6'));var sox=require(_0xdc87('0x7'));var csv=require(_0xdc87('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc87('0x9'));var squel=require(_0xdc87('0xa'));var crypto=require(_0xdc87('0xb'));var jsforce=require(_0xdc87('0xc'));var deskjs=require(_0xdc87('0xd'));var toCsv=require(_0xdc87('0x8'));var querystring=require(_0xdc87('0xe'));var Papa=require(_0xdc87('0xf'));var Redis=require(_0xdc87('0x10'));var authService=require(_0xdc87('0x11'));var qs=require(_0xdc87('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xdc87('0x13'));var config=require(_0xdc87('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc87('0x15'))['db'];config[_0xdc87('0x16')]=_['defaults'](config[_0xdc87('0x16')],{'host':_0xdc87('0x17'),'port':0x18eb});var socket=require(_0xdc87('0x18'))(new Redis(config['redis']));require(_0xdc87('0x19'))['register'](socket);var jayson=require(_0xdc87('0x1a'));var client=jayson[_0xdc87('0x1b')][_0xdc87('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xdc87('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x117ab4,_0x55ff2c,_0x4b6dac,_0x4651cb){return new BPromise(function(_0x31d758,_0x1afd9c){var _0x496ce1=_0x4651cb||client;return _0x496ce1[_0xdc87('0x1d')](_0x117ab4,_0x4b6dac)[_0xdc87('0x1e')](function(_0x2c71f1){logger[_0xdc87('0x1f')](_0xdc87('0x20'),_0x55ff2c,_0xdc87('0x21'));logger['debug'](_0xdc87('0x22'),_0x55ff2c,_0xdc87('0x21'),JSON[_0xdc87('0x23')](_0x2c71f1));if(_0x2c71f1['error']){if(_0x2c71f1['error']['code']===0x1f4){logger[_0xdc87('0x24')](_0xdc87('0x20'),_0x55ff2c,_0x2c71f1[_0xdc87('0x24')]['message']);return _0x1afd9c(_0x2c71f1[_0xdc87('0x24')]['message']);}logger[_0xdc87('0x24')](_0xdc87('0x20'),_0x55ff2c,_0x2c71f1[_0xdc87('0x24')][_0xdc87('0x25')]);return _0x31d758(_0x2c71f1[_0xdc87('0x24')][_0xdc87('0x25')]);}else{logger['info'](_0xdc87('0x20'),_0x55ff2c,'request\x20sent');_0x31d758(_0x2c71f1[_0xdc87('0x26')][_0xdc87('0x25')]);}})[_0xdc87('0x27')](function(_0x4e94e0){logger[_0xdc87('0x24')](_0xdc87('0x20'),_0x55ff2c,_0x4e94e0);_0x1afd9c(_0x4e94e0);});});}function respondWithStatusCode(_0x2a6aae,_0x1ec0e0){_0x1ec0e0=_0x1ec0e0||0xcc;return function(_0x12aa83){if(_0x12aa83){return _0x2a6aae[_0xdc87('0x28')](_0x1ec0e0);}return _0x2a6aae[_0xdc87('0x29')](_0x1ec0e0)[_0xdc87('0x2a')]();};}function respondWithResult(_0x4f8740,_0x4ab14d){_0x4ab14d=_0x4ab14d||0xc8;return function(_0x585049){if(_0x585049){return _0x4f8740['status'](_0x4ab14d)[_0xdc87('0x2b')](_0x585049);}};}function respondWithFilteredResult(_0x46c0b8,_0x4719bc){return function(_0x5e82f3){if(_0x5e82f3){var _0x4a6455=typeof _0x4719bc[_0xdc87('0x2c')]===_0xdc87('0x2d')&&typeof _0x4719bc[_0xdc87('0x2e')]===_0xdc87('0x2d');var _0x455788=_0x5e82f3[_0xdc87('0x2f')];var _0x2e359e=_0x4a6455?0x0:_0x4719bc['offset'];var _0x17378a=_0x4a6455?_0x5e82f3[_0xdc87('0x2f')]:_0x4719bc[_0xdc87('0x2c')]+_0x4719bc[_0xdc87('0x2e')];var _0x2ddc02;if(_0x17378a>=_0x455788){_0x17378a=_0x455788;_0x2ddc02=0xc8;}else{_0x2ddc02=0xce;}_0x46c0b8['status'](_0x2ddc02);return _0x46c0b8[_0xdc87('0x30')]('Content-Range',_0x2e359e+'-'+_0x17378a+'/'+_0x455788)['json'](_0x5e82f3);}return null;};}function patchUpdates(_0x3e4b3a){return function(_0x205375){try{jsonpatch[_0xdc87('0x31')](_0x205375,_0x3e4b3a,!![]);}catch(_0x1efd66){return BPromise[_0xdc87('0x32')](_0x1efd66);}return _0x205375[_0xdc87('0x33')]();};}function saveUpdates(_0x1262df,_0x1346aa){return function(_0x450170){if(_0x450170){return _0x450170[_0xdc87('0x34')](_0x1262df)['then'](function(_0xcb82f3){return _0xcb82f3;});}return null;};}function removeEntity(_0x25a6de,_0x5aad43){return function(_0x16f78a){if(_0x16f78a){return _0x16f78a[_0xdc87('0x35')]()[_0xdc87('0x1e')](function(){_0x25a6de[_0xdc87('0x29')](0xcc)[_0xdc87('0x2a')]();});}};}function handleEntityNotFound(_0x7e7271,_0x1d78ed){return function(_0x30892b){if(!_0x30892b){_0x7e7271[_0xdc87('0x28')](0x194);}return _0x30892b;};}function handleError(_0x19da3b,_0x49cab2){_0x49cab2=_0x49cab2||0x1f4;return function(_0x595e35){logger[_0xdc87('0x24')](_0x595e35[_0xdc87('0x36')]);if(_0x595e35['name']){delete _0x595e35[_0xdc87('0x37')];}_0x19da3b[_0xdc87('0x29')](_0x49cab2)['send'](_0x595e35);};}exports['index']=function(_0x109d7d,_0x268783){var _0x42043e={},_0x4b6f20={},_0x1f6d6b={'count':0x0,'rows':[]};var _0x461c48=_[_0xdc87('0x38')](db['OpenchannelMessage'][_0xdc87('0x39')],function(_0x29333c){return{'name':_0x29333c[_0xdc87('0x3a')],'type':_0x29333c['type'][_0xdc87('0x3b')]};});_0x4b6f20['model']=_['map'](_0x461c48,'name');_0x4b6f20['query']=_[_0xdc87('0x3c')](_0x109d7d['query']);_0x4b6f20[_0xdc87('0x3d')]=_[_0xdc87('0x3e')](_0x4b6f20[_0xdc87('0x3f')],_0x4b6f20[_0xdc87('0x40')]);_0x42043e[_0xdc87('0x41')]=_['intersection'](_0x4b6f20[_0xdc87('0x3f')],qs[_0xdc87('0x42')](_0x109d7d[_0xdc87('0x40')][_0xdc87('0x42')]));_0x42043e[_0xdc87('0x41')]=_0x42043e[_0xdc87('0x41')]['length']?_0x42043e['attributes']:_0x4b6f20[_0xdc87('0x3f')];if(!_0x109d7d[_0xdc87('0x40')][_0xdc87('0x43')](_0xdc87('0x44'))){_0x42043e[_0xdc87('0x2e')]=qs[_0xdc87('0x2e')](_0x109d7d[_0xdc87('0x40')][_0xdc87('0x2e')]);_0x42043e[_0xdc87('0x2c')]=qs[_0xdc87('0x2c')](_0x109d7d[_0xdc87('0x40')]['offset']);}_0x42043e['order']=qs[_0xdc87('0x45')](_0x109d7d['query'][_0xdc87('0x45')]);_0x42043e['where']=qs[_0xdc87('0x3d')](_[_0xdc87('0x46')](_0x109d7d[_0xdc87('0x40')],_0x4b6f20[_0xdc87('0x3d')]),_0x461c48);if(_0x109d7d['query'][_0xdc87('0x47')]){_0x42043e[_0xdc87('0x48')]=_['merge'](_0x42043e['where'],{'$or':_[_0xdc87('0x38')](_0x461c48,function(_0x4c70ec){if(_0x4c70ec[_0xdc87('0x49')]!==_0xdc87('0x4a')){var _0x12dfc6={};_0x12dfc6[_0x4c70ec[_0xdc87('0x37')]]={'$like':'%'+_0x109d7d[_0xdc87('0x40')][_0xdc87('0x47')]+'%'};return _0x12dfc6;}})});}_0x42043e=_['merge']({},_0x42043e,_0x109d7d[_0xdc87('0x4b')]);var _0x3b02e6={'where':_0x42043e[_0xdc87('0x48')]};return db[_0xdc87('0x4c')][_0xdc87('0x2f')](_0x3b02e6)[_0xdc87('0x1e')](function(_0x55c456){_0x1f6d6b[_0xdc87('0x2f')]=_0x55c456;if(_0x109d7d[_0xdc87('0x40')][_0xdc87('0x4d')]){_0x42043e[_0xdc87('0x4e')]=[{'all':!![]}];}return db[_0xdc87('0x4c')][_0xdc87('0x4f')](_0x42043e);})[_0xdc87('0x1e')](function(_0x1c1426){_0x1f6d6b[_0xdc87('0x50')]=_0x1c1426;return _0x1f6d6b;})['then'](respondWithFilteredResult(_0x268783,_0x42043e))[_0xdc87('0x27')](handleError(_0x268783,null));};exports[_0xdc87('0x51')]=function(_0x393848,_0x3aba78){var _0x3378f1={'raw':!![],'where':{'id':_0x393848[_0xdc87('0x52')]['id']}},_0x14a885={};_0x14a885[_0xdc87('0x3f')]=_[_0xdc87('0x3c')](db[_0xdc87('0x4c')][_0xdc87('0x39')]);_0x14a885[_0xdc87('0x40')]=_[_0xdc87('0x3c')](_0x393848[_0xdc87('0x40')]);_0x14a885['filters']=_[_0xdc87('0x3e')](_0x14a885[_0xdc87('0x3f')],_0x14a885[_0xdc87('0x40')]);_0x3378f1[_0xdc87('0x41')]=_[_0xdc87('0x3e')](_0x14a885['model'],qs['fields'](_0x393848[_0xdc87('0x40')][_0xdc87('0x42')]));_0x3378f1[_0xdc87('0x41')]=_0x3378f1['attributes'][_0xdc87('0x53')]?_0x3378f1[_0xdc87('0x41')]:_0x14a885[_0xdc87('0x3f')];if(_0x393848['query']['includeAll']){_0x3378f1[_0xdc87('0x4e')]=[{'all':!![]}];}_0x3378f1=_['merge']({},_0x3378f1,_0x393848[_0xdc87('0x4b')]);return db[_0xdc87('0x4c')]['find'](_0x3378f1)[_0xdc87('0x1e')](handleEntityNotFound(_0x3aba78,null))[_0xdc87('0x1e')](respondWithResult(_0x3aba78,null))['catch'](handleError(_0x3aba78,null));};exports[_0xdc87('0x54')]=function(_0x4cd8c3,_0x2f934f){return db[_0xdc87('0x4c')]['create'](_0x4cd8c3[_0xdc87('0x55')],{})[_0xdc87('0x1e')](respondWithResult(_0x2f934f,0xc9))[_0xdc87('0x27')](handleError(_0x2f934f,null));};exports[_0xdc87('0x34')]=function(_0x4e550b,_0x12609c){if(_0x4e550b[_0xdc87('0x55')]['id']){delete _0x4e550b[_0xdc87('0x55')]['id'];}return db[_0xdc87('0x4c')][_0xdc87('0x56')]({'where':{'id':_0x4e550b[_0xdc87('0x52')]['id']}})[_0xdc87('0x1e')](handleEntityNotFound(_0x12609c,null))[_0xdc87('0x1e')](saveUpdates(_0x4e550b[_0xdc87('0x55')],null))[_0xdc87('0x1e')](respondWithResult(_0x12609c,null))['catch'](handleError(_0x12609c,null));};exports[_0xdc87('0x35')]=function(_0x30f26d,_0x387c4e){return db[_0xdc87('0x4c')]['find']({'where':{'id':_0x30f26d[_0xdc87('0x52')]['id']}})['then'](handleEntityNotFound(_0x387c4e,null))[_0xdc87('0x1e')](removeEntity(_0x387c4e,null))[_0xdc87('0x27')](handleError(_0x387c4e,null));};exports[_0xdc87('0x57')]=function(_0x4504f3,_0x2c25ca){return db[_0xdc87('0x4c')][_0xdc87('0x57')]()[_0xdc87('0x1e')](respondWithResult(_0x2c25ca,null))['catch'](handleError(_0x2c25ca,null));};var interaction_log=require(_0xdc87('0x58'))('openchannel-interactions');exports['accept']=function(_0x2224ec,_0xf6ed7,_0x1f81b7){var _0x5c17fd={'agent':{},'channel':'openchannel'};if(_0x2224ec[_0xdc87('0x55')]['id']){delete _0x2224ec[_0xdc87('0x55')]['id'];}_0x2224ec[_0xdc87('0x55')]['read']=!![];_0x2224ec['body'][_0xdc87('0x59')]=moment()[_0xdc87('0x5a')](_0xdc87('0x5b'));_0x2224ec[_0xdc87('0x55')]['UserId']=_0x2224ec[_0xdc87('0x55')][_0xdc87('0x5c')]||_0x2224ec['user']['id'];_0x5c17fd[_0xdc87('0x5d')]['id']=_0x2224ec[_0xdc87('0x55')][_0xdc87('0x5c')];return db[_0xdc87('0x4c')]['find']({'where':{'id':_0x2224ec[_0xdc87('0x52')]['id'],'UserId':null}})[_0xdc87('0x1e')](handleEntityNotFound(_0xf6ed7,null))[_0xdc87('0x1e')](saveUpdates(_0x2224ec[_0xdc87('0x55')],null))[_0xdc87('0x1e')](function(_0xc12e83){if(_0xc12e83){_0x5c17fd[_0xdc87('0x25')]=_0xc12e83[_0xdc87('0x5e')]({'plain':!![]});return db['OpenchannelInteraction'][_0xdc87('0x56')]({'where':{'id':_0xc12e83[_0xdc87('0x5f')]}});}return null;})[_0xdc87('0x1e')](handleEntityNotFound(_0xf6ed7,null))[_0xdc87('0x1e')](function(_0x78e6e6){if(_0x78e6e6){return _0x78e6e6[_0xdc87('0x34')]({'UserId':_0x2224ec[_0xdc87('0x55')][_0xdc87('0x5c')],'read1stAt':_[_0xdc87('0x60')](_0x78e6e6[_0xdc87('0x61')])?moment()[_0xdc87('0x5a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x371ac8){if(_0x371ac8){_0x5c17fd['interaction']=_0x371ac8['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2224ec['user']['id'],_0x2224ec['user'][_0xdc87('0x37')],_0x2224ec[_0xdc87('0x62')][_0xdc87('0x63')],_0x5c17fd[_0xdc87('0x64')]['id'],_0x2224ec[_0xdc87('0x55')]?JSON[_0xdc87('0x23')](_0x2224ec[_0xdc87('0x55')]):_0xdc87('0x65'));return respondWithRpcPromise(_0xdc87('0x66'),_0xdc87('0x67'),_0x5c17fd);}return null;})['then'](function(_0x6c4519){var _0x406781=_0xdc87('0x68')+_0x6c4519[_0xdc87('0x25')][_0xdc87('0x69')];return db['sequelize']['query'](_0x406781,{'type':db[_0xdc87('0x6a')][_0xdc87('0x6b')][_0xdc87('0x6c')],'raw':!![]})[_0xdc87('0x1e')](function(_0x16100b){return _0x16100b;});})[_0xdc87('0x1e')](function(_0x3c6889){if(_0x3c6889){_0x5c17fd[_0xdc87('0x25')][_0xdc87('0x6d')]=_0x3c6889[0x0];if(!_0x2224ec[_0xdc87('0x55')][_0xdc87('0x5c')])return;return db[_0xdc87('0x6e')][_0xdc87('0x56')]({'where':{'id':_0x2224ec[_0xdc87('0x55')][_0xdc87('0x5c')],'role':_0xdc87('0x5d')},'attributes':['id',_0xdc87('0x37'),'fullname',_0xdc87('0x6f'),_0xdc87('0x70')],'raw':!![]});}return null;})[_0xdc87('0x1e')](function(_0x2e6a2f){if(!_0x2e6a2f)return null;_0x5c17fd['message']['agent']=_0x2e6a2f;return _0x5c17fd;})['then'](function(_0x47fc52){if(_0x47fc52){if(_0x2224ec[_0xdc87('0x55')][_0xdc87('0x71')]){_0x5c17fd['message'][_0xdc87('0x72')]=util[_0xdc87('0x5a')](_0xdc87('0x73'),_0x2224ec[_0xdc87('0x62')][_0xdc87('0x37')]);_0x5c17fd[_0xdc87('0x25')]['channel']=_0x5c17fd[_0xdc87('0x74')];_0x5c17fd['message'][_0xdc87('0x75')]=_0xdc87('0x76');return respondWithRpcPromise(_0xdc87('0x77'),_0xdc87('0x77'),{'event':_0xdc87('0x78'),'message':_0x5c17fd[_0xdc87('0x25')]},client9002)[_0xdc87('0x1e')](function(){return _0x5c17fd;});}return _0x5c17fd;}return null;})['then'](respondWithResult(_0xf6ed7,null))[_0xdc87('0x27')](handleError(_0xf6ed7,null));};var interaction_log=require('../../config/logger')(_0xdc87('0x79'));exports['reject']=function(_0xc4416e,_0x3c5b56,_0x219130){var _0xb94c83={'agent':{},'channel':_0xdc87('0x7a')};if(_0xc4416e[_0xdc87('0x55')]['id']){delete _0xc4416e[_0xdc87('0x55')]['id'];}_0xc4416e[_0xdc87('0x55')][_0xdc87('0x5c')]=_0xc4416e[_0xdc87('0x55')]['UserId']||_0xc4416e[_0xdc87('0x62')]['id'];_0xb94c83[_0xdc87('0x5d')]['id']=_0xc4416e[_0xdc87('0x55')][_0xdc87('0x5c')];return db[_0xdc87('0x4c')][_0xdc87('0x56')]({'where':{'id':_0xc4416e[_0xdc87('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c5b56,null))[_0xdc87('0x1e')](function(_0x4b3f2b){if(_0x4b3f2b){_0xb94c83['message']=_0x4b3f2b[_0xdc87('0x5e')]({'plain':!![]});return db[_0xdc87('0x7b')]['find']({'where':{'id':_0x4b3f2b[_0xdc87('0x5f')]}});}return null;})[_0xdc87('0x1e')](handleEntityNotFound(_0x3c5b56,null))['then'](function(_0x118d8c){if(_0x118d8c){_0xb94c83[_0xdc87('0x64')]=_0x118d8c[_0xdc87('0x5e')]({'plain':!![]});interaction_log[_0xdc87('0x1f')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xc4416e['user']['id'],_0xc4416e[_0xdc87('0x62')][_0xdc87('0x37')],_0xc4416e[_0xdc87('0x62')][_0xdc87('0x63')],_0xb94c83[_0xdc87('0x64')]['id'],_0xc4416e[_0xdc87('0x55')]?JSON['stringify'](_0xc4416e['body']):_0xdc87('0x65'));return respondWithRpcPromise(_0xdc87('0x7c'),_0xdc87('0x7d'),_0xb94c83);}return null;})[_0xdc87('0x1e')](function(_0x3bf19b){var _0x140871=_0xdc87('0x68')+_0x3bf19b[_0xdc87('0x25')]['ContactId'];return db[_0xdc87('0x7e')][_0xdc87('0x40')](_0x140871,{'type':db[_0xdc87('0x6a')][_0xdc87('0x6b')][_0xdc87('0x6c')],'raw':!![]})[_0xdc87('0x1e')](function(_0x2836ac){return _0x2836ac;});})[_0xdc87('0x1e')](function(_0x4435bc){if(_0x4435bc){_0xb94c83['message'][_0xdc87('0x6d')]=_0x4435bc[0x0];if(!_0xc4416e[_0xdc87('0x55')]['UserId'])return;return db[_0xdc87('0x6e')][_0xdc87('0x56')]({'where':{'id':_0xc4416e[_0xdc87('0x55')][_0xdc87('0x5c')],'role':'agent'},'attributes':['id',_0xdc87('0x37'),_0xdc87('0x7f'),'email',_0xdc87('0x70')],'raw':!![]});}return null;})[_0xdc87('0x1e')](function(_0x5bacba){if(!_0x5bacba)return null;_0xb94c83[_0xdc87('0x25')]['agent']=_0x5bacba;return _0xb94c83;})['then'](function(_0x5f45ca){if(_0x5f45ca){_0x5f45ca[_0xdc87('0x25')]['interface']=util[_0xdc87('0x5a')](_0xdc87('0x73'),_0xc4416e[_0xdc87('0x62')][_0xdc87('0x37')]);_0x5f45ca[_0xdc87('0x25')][_0xdc87('0x74')]=_0xb94c83[_0xdc87('0x74')];_0x5f45ca[_0xdc87('0x25')][_0xdc87('0x75')]=_0xdc87('0x32');respondWithRpcPromise(_0xdc87('0x77'),'EventManager',{'event':'rejectmessage','message':_0x5f45ca[_0xdc87('0x25')]},client9002);return _0xb94c83;}return null;})[_0xdc87('0x1e')](respondWithResult(_0x3c5b56,null))[_0xdc87('0x27')](handleError(_0x3c5b56,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 70c39ed..29429bf 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 _0xab5d=['emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x15942a,_0x13b58c){var _0x36a9fb=function(_0x549c27){while(--_0x549c27){_0x15942a['push'](_0x15942a['shift']());}};_0x36a9fb(++_0x13b58c);}(_0xab5d,0x190));var _0xdab5=function(_0x370118,_0x5debad){_0x370118=_0x370118-0x0;var _0x543f25=_0xab5d[_0x370118];return _0x543f25;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xdab5('0x0'))['db'][_0xdab5('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xdab5('0x2')](0x0);var events={'afterCreate':_0xdab5('0x3'),'afterUpdate':_0xdab5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4f14e1){return function(_0x12a6e8,_0x4f199f,_0x423fb5){OpenchannelMessageEvents[_0xdab5('0x5')](_0x4f14e1+':'+_0x12a6e8['id'],_0x12a6e8);OpenchannelMessageEvents['emit'](_0x4f14e1,_0x12a6e8);_0x423fb5(null);};}for(var e in events){if(events[_0xdab5('0x6')](e)){var event=events[e];OpenchannelMessage[_0xdab5('0x7')](e,emitEvent(event));}}module[_0xdab5('0x8')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xde14=['emit','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x4a82ac,_0x1fb931){var _0x58ee97=function(_0xc7050a){while(--_0xc7050a){_0x4a82ac['push'](_0x4a82ac['shift']());}};_0x58ee97(++_0x1fb931);}(_0xde14,0x123));var _0x4de1=function(_0x1e589a,_0x440156){_0x1e589a=_0x1e589a-0x0;var _0x471fdc=_0xde14[_0x1e589a];return _0x471fdc;};'use strict';var EventEmitter=require(_0x4de1('0x0'));var OpenchannelMessage=require(_0x4de1('0x1'))['db'][_0x4de1('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x333632){return function(_0x2e9c7c,_0x3d6fdb,_0x85c71e){OpenchannelMessageEvents[_0x4de1('0x3')](_0x333632+':'+_0x2e9c7c['id'],_0x2e9c7c);OpenchannelMessageEvents['emit'](_0x333632,_0x2e9c7c);_0x85c71e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x4de1('0x4')](e,emitEvent(event));}}module[_0x4de1('0x5')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 83c7f1d..a450bc9 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 _0x3423=['update','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','get','info','OpenchannelMessage,\x20%s,\x20%s','format','replyUri','length','Interaction','omit','POST','GET','afterCreate','threadId','error','inspect','finally','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','toLowerCase','direction','out','isNil','UserId','findOne','OpenchannelInteractionId','then'];(function(_0x57302f,_0x178aec){var _0x5726de=function(_0x136d6f){while(--_0x136d6f){_0x57302f['push'](_0x57302f['shift']());}};_0x5726de(++_0x178aec);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3342('0x0'))(_0x3342('0x1'));var moment=require(_0x3342('0x2'));var BPromise=require(_0x3342('0x3'));var rp=require(_0x3342('0x4'));var fs=require('fs');var path=require(_0x3342('0x5'));var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require(_0x3342('0x8'));module[_0x3342('0x9')]=function(_0x467453,_0x2ccbe0){return _0x467453[_0x3342('0xa')](_0x3342('0xb'),attributes,{'tableName':_0x3342('0xc'),'paranoid':![],'indexes':[{'name':_0x3342('0xd'),'fields':[_0x3342('0xe')],'type':_0x3342('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x9cc419,_0x4ae4f3,_0x582c37){var _0x2d0cb0=_0x467453['models'];var _0x5a1fba=_0x9cc419['get']({'plain':!![]});if(_0x5a1fba['direction'][_0x3342('0x10')]()==='in'||_0x5a1fba[_0x3342('0x11')]['toLowerCase']()===_0x3342('0x12')&&!_0x5a1fba['secret']&&!_[_0x3342('0x13')](_0x5a1fba[_0x3342('0x14')])){_0x2d0cb0['OpenchannelInteraction'][_0x3342('0x15')]({'where':{'id':_0x5a1fba[_0x3342('0x16')]}})[_0x3342('0x17')](function(_0xe4689e){if(_0xe4689e){_0xe4689e[_0x3342('0x18')]({'lastMsgAt':_0x5a1fba[_0x3342('0x19')],'lastMsgDirection':_0x5a1fba[_0x3342('0x11')]['toLowerCase']()});}})[_0x3342('0x1a')](function(_0x19bd71){console['error'](_0x19bd71);});}if(_0x5a1fba[_0x3342('0x11')]===_0x3342('0x12')&&!_0x5a1fba['secret']){var _0x554f9c;_0x2d0cb0[_0x3342('0x1b')][_0x3342('0x1c')]()[_0x3342('0x17')](function(_0x2075cb){return _0x2d0cb0[_0x3342('0x1d')][_0x3342('0x1e')]({'where':{'id':_0x5a1fba[_0x3342('0x1f')]},'include':[{'model':_0x2d0cb0[_0x3342('0x20')],'as':_0x3342('0x21'),'where':{'id':_0x5a1fba['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x2d0cb0[_0x3342('0x1b')],'as':_0x3342('0x22'),'attributes':_[_0x3342('0x23')](_0x2075cb)}]}]});})['then'](function(_0x3cb86f){_0x554f9c=_0x3cb86f[_0x3342('0x24')]({'plain':!![]});if(_0x554f9c&&_0x554f9c['replyUri']){logger[_0x3342('0x25')](_0x3342('0x26'),'afterCreate',util[_0x3342('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5a1fba['id'],_0x554f9c[_0x3342('0x28')]));if(_0x554f9c[_0x3342('0x21')]&&_0x554f9c[_0x3342('0x21')][_0x3342('0x29')]){_0x5a1fba[_0x3342('0x2a')]=_[_0x3342('0x2b')](_0x554f9c[_0x3342('0x21')][0x0],_0x3342('0x22'));_0x5a1fba['Contact']=_0x554f9c[_0x3342('0x21')][0x0]['Contact'];}var _0x4ae4f3={'method':_0x3342('0x2c'),'uri':encodeURI(_0x554f9c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4ae4f3['method']){case _0x3342('0x2d'):_0x4ae4f3['qs']=_0x5a1fba;break;case'POST':_0x4ae4f3[_0x3342('0xe')]=_0x5a1fba;break;}return rp(_0x4ae4f3)['then'](function(_0x524286){logger['info'](_0x3342('0x26'),_0x3342('0x2e'),util[_0x3342('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x5a1fba['id'],_0x554f9c[_0x3342('0x28')]));if(_0x524286[_0x3342('0xe')][_0x3342('0x2f')]&&_0x524286[_0x3342('0xe')]['threadId']!=_0x5a1fba[_0x3342('0x2a')][_0x3342('0x2f')]){return _0x2d0cb0[_0x3342('0x20')][_0x3342('0x18')]({'threadId':_0x524286[_0x3342('0xe')][_0x3342('0x2f')]},{'logging':!![],'where':{'id':_0x5a1fba[_0x3342('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x9cc419[_0x3342('0x18')]({'read':!![]});})['catch'](function(_0x9c9def){logger[_0x3342('0x30')]('OpenchannelMessage,\x20%s,\x20%s',_0x3342('0x2e'),util[_0x3342('0x31')](_0x9c9def,{'showHidden':![],'depth':null}));_0x582c37();});}else{_0x582c37();}})[_0x3342('0x32')](function(){_0x582c37();});}else{_0x582c37();}}},'charset':_0x3342('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4213=['describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','GET','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch'];(function(_0x5c30bc,_0x26bba5){var _0x3c9c2c=function(_0x1ba310){while(--_0x1ba310){_0x5c30bc['push'](_0x5c30bc['shift']());}};_0x3c9c2c(++_0x26bba5);}(_0x4213,0x77));var _0x3421=function(_0x244780,_0x2e5ba4){_0x244780=_0x244780-0x0;var _0x53d247=_0x4213[_0x244780];return _0x53d247;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var logger=require(_0x3421('0x2'))(_0x3421('0x3'));var moment=require(_0x3421('0x4'));var BPromise=require(_0x3421('0x5'));var rp=require(_0x3421('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3421('0x7'));var config=require('../../config/environment');var attributes=require(_0x3421('0x8'));module[_0x3421('0x9')]=function(_0x2155f8,_0x2a04e0){return _0x2155f8['define'](_0x3421('0xa'),attributes,{'tableName':_0x3421('0xb'),'paranoid':![],'indexes':[{'name':_0x3421('0xc'),'fields':[_0x3421('0xd')],'type':_0x3421('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ddfce,_0x1f20cf,_0x58d511){var _0x4ff986=_0x2155f8[_0x3421('0xf')];var _0x4b9d24=_0x4ddfce[_0x3421('0x10')]({'plain':!![]});if(_0x4b9d24[_0x3421('0x11')][_0x3421('0x12')]()==='in'||_0x4b9d24[_0x3421('0x11')][_0x3421('0x12')]()===_0x3421('0x13')&&!_0x4b9d24[_0x3421('0x14')]&&!_['isNil'](_0x4b9d24[_0x3421('0x15')])){_0x4ff986[_0x3421('0x16')][_0x3421('0x17')]({'where':{'id':_0x4b9d24[_0x3421('0x18')]}})[_0x3421('0x19')](function(_0x3f4672){if(_0x3f4672){_0x3f4672[_0x3421('0x1a')]({'lastMsgAt':_0x4b9d24['createdAt'],'lastMsgDirection':_0x4b9d24[_0x3421('0x11')]['toLowerCase']()});}})[_0x3421('0x1b')](function(_0x5257ad){console['error'](_0x5257ad);});}if(_0x4b9d24[_0x3421('0x11')]==='out'&&!_0x4b9d24[_0x3421('0x14')]){var _0x23694b;_0x4ff986['CmContact'][_0x3421('0x1c')]()[_0x3421('0x19')](function(_0x130d3c){return _0x4ff986[_0x3421('0x1d')][_0x3421('0x1e')]({'where':{'id':_0x4b9d24[_0x3421('0x1f')]},'include':[{'model':_0x4ff986[_0x3421('0x16')],'as':_0x3421('0x20'),'where':{'id':_0x4b9d24[_0x3421('0x18')]},'limit':0x1,'include':[{'model':_0x4ff986[_0x3421('0x21')],'as':_0x3421('0x22'),'attributes':_['keys'](_0x130d3c)}]}]});})[_0x3421('0x19')](function(_0x4b59a5){_0x23694b=_0x4b59a5['get']({'plain':!![]});if(_0x23694b&&_0x23694b['replyUri']){logger[_0x3421('0x23')](_0x3421('0x24'),_0x3421('0x25'),util[_0x3421('0x26')](_0x3421('0x27'),_0x4b9d24['id'],_0x23694b[_0x3421('0x28')]));if(_0x23694b[_0x3421('0x20')]&&_0x23694b[_0x3421('0x20')][_0x3421('0x29')]){_0x4b9d24[_0x3421('0x2a')]=_['omit'](_0x23694b['Interactions'][0x0],'Contact');_0x4b9d24[_0x3421('0x22')]=_0x23694b[_0x3421('0x20')][0x0][_0x3421('0x22')];}var _0x1f20cf={'method':'POST','uri':encodeURI(_0x23694b[_0x3421('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1f20cf['method']){case _0x3421('0x2b'):_0x1f20cf['qs']=_0x4b9d24;break;case'POST':_0x1f20cf[_0x3421('0xd')]=_0x4b9d24;break;}return rp(_0x1f20cf)[_0x3421('0x19')](function(_0x36d75f){logger[_0x3421('0x23')](_0x3421('0x24'),'afterCreate',util[_0x3421('0x26')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x4b9d24['id'],_0x23694b['replyUri']));if(_0x36d75f[_0x3421('0xd')]['threadId']&&_0x36d75f['body'][_0x3421('0x2c')]!=_0x4b9d24['Interaction'][_0x3421('0x2c')]){return _0x4ff986['OpenchannelInteraction'][_0x3421('0x1a')]({'threadId':_0x36d75f[_0x3421('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x4b9d24[_0x3421('0x2a')]['id']}});}else{return;}})[_0x3421('0x19')](function(){return _0x4ddfce[_0x3421('0x1a')]({'read':!![]});})['catch'](function(_0x3a89b6){logger['error'](_0x3421('0x24'),_0x3421('0x25'),util[_0x3421('0x2d')](_0x3a89b6,{'showHidden':![],'depth':null}));_0x58d511();});}else{_0x58d511();}})[_0x3421('0x2e')](function(){_0x58d511();});}else{_0x58d511();}}},'charset':_0x3421('0x2f'),'collate':_0x3421('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 7adbaf6..727abb0 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x467d69,_0x5ede36){var _0x169da6=function(_0x2f0727){while(--_0x2f0727){_0x467d69['push'](_0x467d69['shift']());}};_0x169da6(++_0x5ede36);}(_0x7a54,0x106));var _0x47a5=function(_0xfc0b99,_0x5dae31){_0xfc0b99=_0xfc0b99-0x0;var _0x211a6c=_0x7a54[_0xfc0b99];return _0x211a6c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x239a47,_0x5c5d5e){var _0x12d6ac=function(_0x4e2022){while(--_0x4e2022){_0x239a47['push'](_0x239a47['shift']());}};_0x12d6ac(++_0x5c5d5e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1c3d97,_0x18389b){_0x1c3d97=_0x1c3d97-0x0;var _0x2713fb=_0x5f2f[_0x1c3d97];return _0x2713fb;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 6eb7105..68e6797 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 _0x8075=['openchannelMessage:','./openchannelMessage.events','save','update','length'];(function(_0x406115,_0x19f7a1){var _0xbbabdb=function(_0x28554d){while(--_0x28554d){_0x406115['push'](_0x406115['shift']());}};_0xbbabdb(++_0x19f7a1);}(_0x8075,0xab));var _0x5807=function(_0x39af92,_0x5e240f){_0x39af92=_0x39af92-0x0;var _0x11f60f=_0x8075[_0x39af92];return _0x11f60f;};'use strict';var OpenchannelMessageEvents=require(_0x5807('0x0'));var events=[_0x5807('0x1'),'remove',_0x5807('0x2')];function createListener(_0x5efb54,_0x37a443){return function(_0x11de2e){_0x37a443['emit'](_0x5efb54,_0x11de2e);};}function removeListener(_0x35d426,_0x8f6a62){return function(){OpenchannelMessageEvents['removeListener'](_0x35d426,_0x8f6a62);};}exports['register']=function(_0x984f3d){for(var _0x5b471b=0x0,_0x308e83=events[_0x5807('0x3')];_0x5b471b<_0x308e83;_0x5b471b++){var _0x2b84d0=events[_0x5b471b];var _0x1e98cf=createListener(_0x5807('0x4')+_0x2b84d0,_0x984f3d);OpenchannelMessageEvents['on'](_0x2b84d0,_0x1e98cf);}}; \ No newline at end of file +var _0xc77b=['save','remove','emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events'];(function(_0x161690,_0x4967ea){var _0x13af94=function(_0x4f3902){while(--_0x4f3902){_0x161690['push'](_0x161690['shift']());}};_0x13af94(++_0x4967ea);}(_0xc77b,0x187));var _0xbc77=function(_0x478355,_0x4b8fb2){_0x478355=_0x478355-0x0;var _0xec3e63=_0xc77b[_0x478355];return _0xec3e63;};'use strict';var OpenchannelMessageEvents=require(_0xbc77('0x0'));var events=[_0xbc77('0x1'),_0xbc77('0x2'),'update'];function createListener(_0x65b0af,_0x185649){return function(_0x1e388a){_0x185649[_0xbc77('0x3')](_0x65b0af,_0x1e388a);};}function removeListener(_0x337316,_0x279473){return function(){OpenchannelMessageEvents[_0xbc77('0x4')](_0x337316,_0x279473);};}exports[_0xbc77('0x5')]=function(_0x4783d4){for(var _0x378251=0x0,_0x40a25d=events[_0xbc77('0x6')];_0x378251<_0x40a25d;_0x378251++){var _0x22e6c8=events[_0x378251];var _0x6f5ae7=createListener(_0xbc77('0x7')+_0x22e6c8,_0x4783d4);OpenchannelMessageEvents['on'](_0x22e6c8,_0x6f5ae7);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 6c37884..99db487 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 _0x42fe=['create','post','addTeams','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x42fe,0xa0));var _0xe42f=function(_0x198e50,_0x1f8708){_0x198e50=_0x198e50-0x0;var _0x478867=_0x42fe[_0x198e50];return _0x478867;};'use strict';var multer=require(_0xe42f('0x0'));var util=require(_0xe42f('0x1'));var path=require(_0xe42f('0x2'));var timeout=require(_0xe42f('0x3'));var express=require(_0xe42f('0x4'));var router=express[_0xe42f('0x5')]();var fs_extra=require(_0xe42f('0x6'));var auth=require(_0xe42f('0x7'));var interaction=require(_0xe42f('0x8'));var config=require(_0xe42f('0x9'));var controller=require('./openchannelQueue.controller');router[_0xe42f('0xa')]('/',auth[_0xe42f('0xb')](),controller[_0xe42f('0xc')]);router[_0xe42f('0xa')](_0xe42f('0xd'),auth[_0xe42f('0xb')](),controller['describe']);router[_0xe42f('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xe42f('0xe')]);router[_0xe42f('0xa')](_0xe42f('0xf'),auth[_0xe42f('0xb')](),controller[_0xe42f('0x10')]);router[_0xe42f('0xa')](_0xe42f('0x11'),auth[_0xe42f('0xb')](),controller[_0xe42f('0x12')]);router[_0xe42f('0xa')](_0xe42f('0x13'),auth[_0xe42f('0xb')](),controller['getAgents']);router['post']('/',auth[_0xe42f('0xb')](),controller[_0xe42f('0x14')]);router[_0xe42f('0x15')](_0xe42f('0x11'),auth[_0xe42f('0xb')](),controller[_0xe42f('0x16')]);router[_0xe42f('0x15')](_0xe42f('0x13'),auth[_0xe42f('0xb')](),controller['addAgents']);router[_0xe42f('0x17')](_0xe42f('0x18'),auth[_0xe42f('0xb')](),controller[_0xe42f('0x19')]);router[_0xe42f('0x1a')](_0xe42f('0x18'),auth[_0xe42f('0xb')](),controller[_0xe42f('0x1b')]);router['delete'](_0xe42f('0x11'),auth['isAuthenticated'](),controller[_0xe42f('0x1c')]);router[_0xe42f('0x1a')](_0xe42f('0x13'),auth['isAuthenticated'](),controller[_0xe42f('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x7eea=['get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','create','post','/:id/users','update','delete','removeAgents','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./openchannelQueue.controller'];(function(_0x48d3f0,_0x22f27f){var _0x1f8412=function(_0x114456){while(--_0x114456){_0x48d3f0['push'](_0x48d3f0['shift']());}};_0x1f8412(++_0x22f27f);}(_0x7eea,0x1dc));var _0xa7ee=function(_0x1cea27,_0x56f6e6){_0x1cea27=_0x1cea27-0x0;var _0x44ea37=_0x7eea[_0x1cea27];return _0x44ea37;};'use strict';var multer=require(_0xa7ee('0x0'));var util=require(_0xa7ee('0x1'));var path=require(_0xa7ee('0x2'));var timeout=require('connect-timeout');var express=require(_0xa7ee('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa7ee('0x4'));var config=require(_0xa7ee('0x5'));var controller=require(_0xa7ee('0x6'));router[_0xa7ee('0x7')]('/',auth[_0xa7ee('0x8')](),controller['index']);router['get']('/describe',auth[_0xa7ee('0x8')](),controller[_0xa7ee('0x9')]);router['get'](_0xa7ee('0xa'),auth[_0xa7ee('0x8')](),controller[_0xa7ee('0xb')]);router[_0xa7ee('0x7')](_0xa7ee('0xc'),auth['isAuthenticated'](),controller[_0xa7ee('0xd')]);router[_0xa7ee('0x7')](_0xa7ee('0xe'),auth['isAuthenticated'](),controller['getTeams']);router[_0xa7ee('0x7')]('/:id/users',auth[_0xa7ee('0x8')](),controller[_0xa7ee('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa7ee('0x10')]);router['post'](_0xa7ee('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0xa7ee('0x11')](_0xa7ee('0x12'),auth[_0xa7ee('0x8')](),controller['addAgents']);router['put']('/:id',auth[_0xa7ee('0x8')](),controller[_0xa7ee('0x13')]);router[_0xa7ee('0x14')]('/:id',auth[_0xa7ee('0x8')](),controller['destroy']);router['delete'](_0xa7ee('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xa7ee('0x14')]('/:id/users',auth[_0xa7ee('0x8')](),controller[_0xa7ee('0x15')]);module[_0xa7ee('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index c7fc3b4..650bbec 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 _0x70d6=['name','STRING','INTEGER','ENUM','rrmemory','beepall','sequelize','exports'];(function(_0x4bdd38,_0xbe7ab4){var _0x42905a=function(_0x3d8628){while(--_0x3d8628){_0x4bdd38['push'](_0x4bdd38['shift']());}};_0x42905a(++_0xbe7ab4);}(_0x70d6,0x1b6));var _0x670d=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x70d6[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x670d('0x0'));module[_0x670d('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x670d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x670d('0x3')]},'timeout':{'type':Sequelize[_0x670d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x670d('0x5')](_0x670d('0x6'),_0x670d('0x7'),'roundrobin')}}; \ No newline at end of file +var _0x9548=['ENUM','rrmemory','roundrobin','sequelize','exports','name'];(function(_0x5774be,_0x2259d3){var _0x4914b4=function(_0x1eebc3){while(--_0x1eebc3){_0x5774be['push'](_0x5774be['shift']());}};_0x4914b4(++_0x2259d3);}(_0x9548,0x1dd));var _0x8954=function(_0x1a18e8,_0x2e0582){_0x1a18e8=_0x1a18e8-0x0;var _0x46ed90=_0x9548[_0x1a18e8];return _0x46ed90;};'use strict';var Sequelize=require(_0x8954('0x0'));module[_0x8954('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8954('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8954('0x3')](_0x8954('0x4'),'beepall',_0x8954('0x5'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index a02ba70..e614b33 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 _0xc259=['count','offset','set','json','apply','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','pick','OpenchannelQueueId','options','findAndCountAll','openchannelPause','updatedAt','format','SIP','createdAt','getTeams','Team','nolimit','ids','User','Agents','interface','flatMap','sequelize','transaction','addTeams','UserOpenchannelQueue','findOrCreate','forEach','userOpenchannelQueue:save','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','TeamId','includes','all','union','value','removeTeams','isEmpty','emit','addAgents','omit','spread','removeAgents','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','status','undefined'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xc259,0x68));var _0x9c25=function(_0x169a2d,_0x25ccaa){_0x169a2d=_0x169a2d-0x0;var _0x3bceda=_0xc259[_0x169a2d];return _0x3bceda;};'use strict';var emlformat=require(_0x9c25('0x0'));var rimraf=require(_0x9c25('0x1'));var zipdir=require(_0x9c25('0x2'));var jsonpatch=require(_0x9c25('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9c25('0x4'));var Mustache=require(_0x9c25('0x5'));var util=require(_0x9c25('0x6'));var path=require(_0x9c25('0x7'));var sox=require(_0x9c25('0x8'));var csv=require('to-csv');var ejs=require(_0x9c25('0x9'));var fs=require('fs');var fs_extra=require(_0x9c25('0xa'));var _=require(_0x9c25('0xb'));var squel=require(_0x9c25('0xc'));var crypto=require(_0x9c25('0xd'));var jsforce=require(_0x9c25('0xe'));var deskjs=require(_0x9c25('0xf'));var toCsv=require(_0x9c25('0x10'));var querystring=require(_0x9c25('0x11'));var Papa=require('papaparse');var Redis=require(_0x9c25('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9c25('0x13'));var as=require(_0x9c25('0x14'));var hardwareService=require(_0x9c25('0x15'));var logger=require(_0x9c25('0x16'))(_0x9c25('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c25('0x18'));var db=require(_0x9c25('0x19'))['db'];config[_0x9c25('0x1a')]=_[_0x9c25('0x1b')](config['redis'],{'host':_0x9c25('0x1c'),'port':0x18eb});var socket=require(_0x9c25('0x1d'))(new Redis(config[_0x9c25('0x1a')]));require(_0x9c25('0x1e'))[_0x9c25('0x1f')](socket);function respondWithStatusCode(_0x59d5ed,_0x1e9897){_0x1e9897=_0x1e9897||0xcc;return function(_0x150712){if(_0x150712){return _0x59d5ed[_0x9c25('0x20')](_0x1e9897);}return _0x59d5ed['status'](_0x1e9897)[_0x9c25('0x21')]();};}function respondWithResult(_0x346420,_0x28ae3e){_0x28ae3e=_0x28ae3e||0xc8;return function(_0x53075b){if(_0x53075b){return _0x346420[_0x9c25('0x22')](_0x28ae3e)['json'](_0x53075b);}};}function respondWithFilteredResult(_0x1c4c9c,_0x355051){return function(_0x3b75ef){if(_0x3b75ef){var _0x4dc553=typeof _0x355051['offset']===_0x9c25('0x23')&&typeof _0x355051['limit']===_0x9c25('0x23');var _0x224e6e=_0x3b75ef[_0x9c25('0x24')];var _0x4e6717=_0x4dc553?0x0:_0x355051[_0x9c25('0x25')];var _0x9c0aac=_0x4dc553?_0x3b75ef[_0x9c25('0x24')]:_0x355051[_0x9c25('0x25')]+_0x355051['limit'];var _0x217bae;if(_0x9c0aac>=_0x224e6e){_0x9c0aac=_0x224e6e;_0x217bae=0xc8;}else{_0x217bae=0xce;}_0x1c4c9c['status'](_0x217bae);return _0x1c4c9c[_0x9c25('0x26')]('Content-Range',_0x4e6717+'-'+_0x9c0aac+'/'+_0x224e6e)[_0x9c25('0x27')](_0x3b75ef);}return null;};}function patchUpdates(_0x12501d){return function(_0x16f86e){try{jsonpatch[_0x9c25('0x28')](_0x16f86e,_0x12501d,!![]);}catch(_0x1b234a){return BPromise[_0x9c25('0x29')](_0x1b234a);}return _0x16f86e[_0x9c25('0x2a')]();};}function saveUpdates(_0x257181,_0x2ba985){return function(_0x1864bf){if(_0x1864bf){return _0x1864bf[_0x9c25('0x2b')](_0x257181)['then'](function(_0x55b8bb){return _0x55b8bb;});}return null;};}function removeEntity(_0x44ac95,_0xd88c30){return function(_0x4decd1){if(_0x4decd1){return _0x4decd1['destroy']()[_0x9c25('0x2c')](function(){var _0x69ea7a=_0x4decd1[_0x9c25('0x2d')]({'plain':!![]});var _0x509890=_0x9c25('0x2e');return db[_0x9c25('0x2f')][_0x9c25('0x30')]({'where':{'type':_0x509890,'resourceId':_0x69ea7a['id']}})['then'](function(){return _0x4decd1;});})[_0x9c25('0x2c')](function(){_0x44ac95[_0x9c25('0x22')](0xcc)[_0x9c25('0x21')]();});}};}function handleEntityNotFound(_0x5f0f23,_0x144794){return function(_0x865511){if(!_0x865511){_0x5f0f23['sendStatus'](0x194);}return _0x865511;};}function handleError(_0x5b8ebf,_0x2d7a9e){_0x2d7a9e=_0x2d7a9e||0x1f4;return function(_0x518c5d){logger['error'](_0x518c5d[_0x9c25('0x31')]);if(_0x518c5d['name']){delete _0x518c5d[_0x9c25('0x32')];}_0x5b8ebf[_0x9c25('0x22')](_0x2d7a9e)[_0x9c25('0x33')](_0x518c5d);};}exports[_0x9c25('0x34')]=function(_0x36ec6d,_0x478671){var _0x420025={},_0x5b59c3={},_0x509a93={'count':0x0,'rows':[]};var _0x4dd37e=_[_0x9c25('0x35')](db[_0x9c25('0x36')][_0x9c25('0x37')],function(_0x535ff4){return{'name':_0x535ff4[_0x9c25('0x38')],'type':_0x535ff4[_0x9c25('0x39')][_0x9c25('0x3a')]};});_0x5b59c3[_0x9c25('0x3b')]=_['map'](_0x4dd37e,_0x9c25('0x32'));_0x5b59c3[_0x9c25('0x3c')]=_['keys'](_0x36ec6d[_0x9c25('0x3c')]);_0x5b59c3[_0x9c25('0x3d')]=_[_0x9c25('0x3e')](_0x5b59c3[_0x9c25('0x3b')],_0x5b59c3[_0x9c25('0x3c')]);_0x420025[_0x9c25('0x3f')]=_[_0x9c25('0x3e')](_0x5b59c3[_0x9c25('0x3b')],qs[_0x9c25('0x40')](_0x36ec6d[_0x9c25('0x3c')][_0x9c25('0x40')]));_0x420025['attributes']=_0x420025[_0x9c25('0x3f')][_0x9c25('0x41')]?_0x420025[_0x9c25('0x3f')]:_0x5b59c3[_0x9c25('0x3b')];if(!_0x36ec6d[_0x9c25('0x3c')][_0x9c25('0x42')]('nolimit')){_0x420025[_0x9c25('0x43')]=qs[_0x9c25('0x43')](_0x36ec6d[_0x9c25('0x3c')][_0x9c25('0x43')]);_0x420025[_0x9c25('0x25')]=qs[_0x9c25('0x25')](_0x36ec6d[_0x9c25('0x3c')][_0x9c25('0x25')]);}_0x420025[_0x9c25('0x44')]=qs['sort'](_0x36ec6d[_0x9c25('0x3c')][_0x9c25('0x45')]);_0x420025[_0x9c25('0x46')]=qs[_0x9c25('0x3d')](_['pick'](_0x36ec6d[_0x9c25('0x3c')],_0x5b59c3['filters']),_0x4dd37e);if(_0x36ec6d['query'][_0x9c25('0x47')]){_0x420025['where']=_['merge'](_0x420025[_0x9c25('0x46')],{'$or':_[_0x9c25('0x35')](_0x4dd37e,function(_0x55d5f4){if(_0x55d5f4[_0x9c25('0x39')]!==_0x9c25('0x48')){var _0x1f1a35={};_0x1f1a35[_0x55d5f4[_0x9c25('0x32')]]={'$like':'%'+_0x36ec6d['query'][_0x9c25('0x47')]+'%'};return _0x1f1a35;}})});}_0x420025=_[_0x9c25('0x49')]({},_0x420025,_0x36ec6d['options']);var _0x8bd8ce={'where':_0x420025[_0x9c25('0x46')]};return db[_0x9c25('0x36')]['count'](_0x8bd8ce)[_0x9c25('0x2c')](function(_0x1c1379){_0x509a93[_0x9c25('0x24')]=_0x1c1379;if(_0x36ec6d[_0x9c25('0x3c')][_0x9c25('0x4a')]){_0x420025['include']=[{'all':!![]}];}return db[_0x9c25('0x36')][_0x9c25('0x4b')](_0x420025);})['then'](function(_0x449707){_0x509a93[_0x9c25('0x4c')]=_0x449707;return _0x509a93;})[_0x9c25('0x2c')](respondWithFilteredResult(_0x478671,_0x420025))[_0x9c25('0x4d')](handleError(_0x478671,null));};exports[_0x9c25('0x4e')]=function(_0x5dccf9,_0x2a71f3){var _0x2f8b76={'raw':!![],'where':{'id':_0x5dccf9[_0x9c25('0x4f')]['id']}},_0x1e099f={};_0x1e099f['model']=_['keys'](db[_0x9c25('0x36')][_0x9c25('0x37')]);_0x1e099f['query']=_[_0x9c25('0x50')](_0x5dccf9[_0x9c25('0x3c')]);_0x1e099f[_0x9c25('0x3d')]=_['intersection'](_0x1e099f['model'],_0x1e099f[_0x9c25('0x3c')]);_0x2f8b76[_0x9c25('0x3f')]=_[_0x9c25('0x3e')](_0x1e099f[_0x9c25('0x3b')],qs['fields'](_0x5dccf9['query'][_0x9c25('0x40')]));_0x2f8b76['attributes']=_0x2f8b76[_0x9c25('0x3f')][_0x9c25('0x41')]?_0x2f8b76[_0x9c25('0x3f')]:_0x1e099f[_0x9c25('0x3b')];if(_0x5dccf9['query']['includeAll']){_0x2f8b76['include']=[{'all':!![]}];}_0x2f8b76=_[_0x9c25('0x49')]({},_0x2f8b76,_0x5dccf9['options']);return db[_0x9c25('0x36')]['find'](_0x2f8b76)[_0x9c25('0x2c')](handleEntityNotFound(_0x2a71f3,null))[_0x9c25('0x2c')](respondWithResult(_0x2a71f3,null))[_0x9c25('0x4d')](handleError(_0x2a71f3,null));};exports['create']=function(_0x54e246,_0x4935e5){return db[_0x9c25('0x36')][_0x9c25('0x51')](_0x54e246[_0x9c25('0x52')],{})[_0x9c25('0x2c')](function(_0x5a3f11){var _0x2cd587=_0x54e246[_0x9c25('0x53')][_0x9c25('0x2d')]({'plain':!![]});if(!_0x2cd587)throw new Error(_0x9c25('0x54'));if(_0x2cd587[_0x9c25('0x55')]===_0x9c25('0x53')){var _0x47f863=_0x5a3f11[_0x9c25('0x2d')]({'plain':!![]});var _0x5e76fc=_0x9c25('0x2e');return db[_0x9c25('0x56')]['find']({'where':{'name':_0x5e76fc,'userProfileId':_0x2cd587['userProfileId']},'raw':!![]})['then'](function(_0x1946b9){if(_0x1946b9&&_0x1946b9['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x47f863[_0x9c25('0x32')],'resourceId':_0x47f863['id'],'type':_0x1946b9[_0x9c25('0x32')],'sectionId':_0x1946b9['id']},{})['then'](function(){return _0x5a3f11;});}else{return _0x5a3f11;}})[_0x9c25('0x4d')](function(_0x3cd7a3){logger[_0x9c25('0x57')](_0x9c25('0x58'),_0x3cd7a3);throw _0x3cd7a3;});}return _0x5a3f11;})[_0x9c25('0x2c')](respondWithResult(_0x4935e5,0xc9))[_0x9c25('0x4d')](handleError(_0x4935e5,null));};exports[_0x9c25('0x2b')]=function(_0x226e1b,_0x5edc8d){if(_0x226e1b[_0x9c25('0x52')]['id']){delete _0x226e1b[_0x9c25('0x52')]['id'];}return db['OpenchannelQueue'][_0x9c25('0x59')]({'where':{'id':_0x226e1b[_0x9c25('0x4f')]['id']}})[_0x9c25('0x2c')](handleEntityNotFound(_0x5edc8d,null))[_0x9c25('0x2c')](saveUpdates(_0x226e1b[_0x9c25('0x52')],null))[_0x9c25('0x2c')](respondWithResult(_0x5edc8d,null))[_0x9c25('0x4d')](handleError(_0x5edc8d,null));};exports[_0x9c25('0x30')]=function(_0x217c33,_0x4452e9){return db['OpenchannelQueue'][_0x9c25('0x59')]({'where':{'id':_0x217c33[_0x9c25('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4452e9,null))[_0x9c25('0x2c')](removeEntity(_0x4452e9,null))[_0x9c25('0x4d')](handleError(_0x4452e9,null));};exports[_0x9c25('0x5a')]=function(_0x107754,_0x2bcfce){return db[_0x9c25('0x36')][_0x9c25('0x5a')]()['then'](respondWithResult(_0x2bcfce,null))[_0x9c25('0x4d')](handleError(_0x2bcfce,null));};exports[_0x9c25('0x5b')]=function(_0x3155e6,_0x2e105f,_0x1b63cb){var _0x21ad13={'raw':!![],'where':{}},_0x1cb943={},_0x502335;return db[_0x9c25('0x36')][_0x9c25('0x5c')]({'where':{'id':_0x3155e6[_0x9c25('0x4f')]['id']}})[_0x9c25('0x2c')](handleEntityNotFound(_0x2e105f,null))['then'](function(_0x1cd1be){if(_0x1cd1be){_0x502335=_0x1cd1be[_0x9c25('0x2d')]({'plain':!![]});_0x1cb943['model']=_['keys'](db['UserOpenchannelQueue']['rawAttributes']);_0x1cb943['query']=_[_0x9c25('0x50')](_0x3155e6[_0x9c25('0x3c')]);_0x1cb943[_0x9c25('0x3d')]=_[_0x9c25('0x3e')](_0x1cb943[_0x9c25('0x3b')],_0x1cb943['query']);_0x21ad13['attributes']=_[_0x9c25('0x3e')](_0x1cb943[_0x9c25('0x3b')],qs['fields'](_0x3155e6[_0x9c25('0x3c')][_0x9c25('0x40')]));_0x21ad13[_0x9c25('0x3f')]=_0x21ad13[_0x9c25('0x3f')][_0x9c25('0x41')]?_0x21ad13[_0x9c25('0x3f')]:_0x1cb943['model'];if(!_0x3155e6['query'][_0x9c25('0x42')]('nolimit')){_0x21ad13[_0x9c25('0x43')]=qs[_0x9c25('0x43')](_0x3155e6[_0x9c25('0x3c')][_0x9c25('0x43')]);_0x21ad13[_0x9c25('0x25')]=qs[_0x9c25('0x25')](_0x3155e6[_0x9c25('0x3c')]['offset']);}_0x21ad13[_0x9c25('0x44')]=qs['sort'](_0x3155e6[_0x9c25('0x3c')]['sort']);_0x21ad13[_0x9c25('0x46')]=qs[_0x9c25('0x3d')](_[_0x9c25('0x5d')](_0x3155e6[_0x9c25('0x3c')],_0x1cb943[_0x9c25('0x3d')]));_0x21ad13[_0x9c25('0x46')][_0x9c25('0x5e')]=_0x1cd1be['id'];if(_0x3155e6[_0x9c25('0x3c')][_0x9c25('0x47')]){_0x21ad13[_0x9c25('0x46')]=_[_0x9c25('0x49')](_0x21ad13['where'],{'$or':_[_0x9c25('0x35')](_0x21ad13[_0x9c25('0x3f')],function(_0x1961a3){var _0x451e9a={};_0x451e9a[_0x1961a3]={'$like':'%'+_0x3155e6[_0x9c25('0x3c')][_0x9c25('0x47')]+'%'};return _0x451e9a;})});}_0x21ad13=_['merge']({},_0x21ad13,_0x3155e6[_0x9c25('0x5f')]);return db['UserOpenchannelQueue'][_0x9c25('0x4b')](_0x21ad13);}})[_0x9c25('0x2c')](function(_0x26cda9){if(_0x26cda9){return db['User'][_0x9c25('0x60')]({'where':{'id':_[_0x9c25('0x35')](_0x26cda9,'UserId'),'role':'agent'},'attributes':['id',_0x9c25('0x32'),_0x9c25('0x61'),_0x9c25('0x62'),'createdAt']});}})[_0x9c25('0x2c')](function(_0x383cf7){if(_0x383cf7){return{'count':_0x383cf7[_0x9c25('0x24')],'rows':_[_0x9c25('0x35')](_0x383cf7[_0x9c25('0x4c')],function(_0x2c8ce4){return{'membername':_0x2c8ce4[_0x9c25('0x32')],'UserId':_0x2c8ce4['id'],'queue_name':_0x502335['name'],'OpenchannelQueueId':_0x502335['id'],'interface':util[_0x9c25('0x63')]('%s/%s',_0x9c25('0x64'),_0x2c8ce4['name']),'penalty':0x0,'paused':_0x2c8ce4[_0x9c25('0x61')],'createdAt':_0x2c8ce4[_0x9c25('0x65')],'updatedAt':_0x2c8ce4[_0x9c25('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9c25('0x2c')](respondWithFilteredResult(_0x2e105f,_0x21ad13))['catch'](handleError(_0x2e105f,null));};exports[_0x9c25('0x66')]=function(_0x52b7bc,_0xa16396,_0x5d4d5d){var _0x180cbc={};var _0x189019={};var _0x10d382;var _0x17e2ac;return db[_0x9c25('0x36')]['findOne']({'where':{'id':_0x52b7bc['params']['id']}})[_0x9c25('0x2c')](handleEntityNotFound(_0xa16396,null))['then'](function(_0x584f6a){if(_0x584f6a){_0x10d382=_0x584f6a;_0x189019[_0x9c25('0x3b')]=_[_0x9c25('0x50')](db[_0x9c25('0x67')]['rawAttributes']);_0x189019['query']=_['keys'](_0x52b7bc['query']);_0x189019[_0x9c25('0x3d')]=_[_0x9c25('0x3e')](_0x189019[_0x9c25('0x3b')],_0x189019[_0x9c25('0x3c')]);_0x180cbc[_0x9c25('0x3f')]=_['intersection'](_0x189019[_0x9c25('0x3b')],qs[_0x9c25('0x40')](_0x52b7bc[_0x9c25('0x3c')][_0x9c25('0x40')]));_0x180cbc[_0x9c25('0x3f')]=_0x180cbc[_0x9c25('0x3f')][_0x9c25('0x41')]?_0x180cbc[_0x9c25('0x3f')]:_0x189019[_0x9c25('0x3b')];_0x180cbc[_0x9c25('0x44')]=qs[_0x9c25('0x45')](_0x52b7bc[_0x9c25('0x3c')][_0x9c25('0x45')]);_0x180cbc[_0x9c25('0x46')]=qs[_0x9c25('0x3d')](_[_0x9c25('0x5d')](_0x52b7bc[_0x9c25('0x3c')],_0x189019['filters']));if(_0x52b7bc[_0x9c25('0x3c')]['filter']){_0x180cbc[_0x9c25('0x46')]=_['merge'](_0x180cbc[_0x9c25('0x46')],{'$or':_[_0x9c25('0x35')](_0x180cbc[_0x9c25('0x3f')],function(_0x954415){var _0x5b2f7b={};_0x5b2f7b[_0x954415]={'$like':'%'+_0x52b7bc[_0x9c25('0x3c')][_0x9c25('0x47')]+'%'};return _0x5b2f7b;})});}_0x180cbc=_[_0x9c25('0x49')]({},_0x180cbc,_0x52b7bc['options']);return _0x10d382[_0x9c25('0x66')](_0x180cbc);}})[_0x9c25('0x2c')](function(_0x4a4cc6){if(_0x4a4cc6){_0x17e2ac=_0x4a4cc6[_0x9c25('0x41')];if(!_0x52b7bc[_0x9c25('0x3c')][_0x9c25('0x42')](_0x9c25('0x68'))){_0x180cbc[_0x9c25('0x43')]=qs[_0x9c25('0x43')](_0x52b7bc['query'][_0x9c25('0x43')]);_0x180cbc[_0x9c25('0x25')]=qs[_0x9c25('0x25')](_0x52b7bc[_0x9c25('0x3c')][_0x9c25('0x25')]);}return _0x10d382[_0x9c25('0x66')](_0x180cbc);}})['then'](function(_0x3ef98f){if(_0x3ef98f){return _0x3ef98f?{'count':_0x17e2ac,'rows':_0x3ef98f}:null;}})[_0x9c25('0x2c')](respondWithResult(_0xa16396,null))[_0x9c25('0x4d')](handleError(_0xa16396,null));};exports['addTeams']=function(_0x12217a,_0x4b68c9,_0x574b41){var _0x149361=_0x12217a[_0x9c25('0x52')][_0x9c25('0x69')];return db[_0x9c25('0x67')][_0x9c25('0x4b')]({'where':{'id':_0x149361},'attributes':['id'],'include':[{'model':db[_0x9c25('0x6a')],'as':_0x9c25('0x6b'),'attributes':['id','name','online','voicePause',_0x9c25('0x6c')],'raw':!![]}]})[_0x9c25('0x2c')](function(_0x38f803){if(_0x38f803){var _0x52e6c3=_[_0x9c25('0x6d')](_0x38f803,function(_0x103b51){var _0x327ff2=_0x103b51['get']({'plain':!![]});return _0x327ff2[_0x9c25('0x6b')];});return db[_0x9c25('0x36')]['find']({'where':{'id':_0x12217a['params']['id']}})[_0x9c25('0x2c')](function(_0x1358c5){return db[_0x9c25('0x6e')][_0x9c25('0x6f')](function(_0x223f12){return _0x1358c5[_0x9c25('0x70')](_0x149361,{'transaction':_0x223f12})['then'](function(){return BPromise['each'](_0x52e6c3,function(_0x5a2021){return db[_0x9c25('0x71')][_0x9c25('0x72')]({'where':{'UserId':_0x5a2021['id'],'OpenchannelQueueId':_0x12217a[_0x9c25('0x4f')]['id']},'transaction':_0x223f12});});})[_0x9c25('0x2c')](function(){_0x52e6c3[_0x9c25('0x73')](function(_0x599f22){socket['emit'](_0x9c25('0x74'),{'UserId':_0x599f22['id'],'OpenchannelQueueId':_0x1358c5['id']});});});});});}})[_0x9c25('0x2c')](respondWithStatusCode(_0x4b68c9,null))[_0x9c25('0x4d')](handleError(_0x4b68c9,null));};exports['removeTeams']=function(_0x34b72a,_0x2ed88d,_0x55ad13){return db[_0x9c25('0x67')][_0x9c25('0x4b')]({'where':{'id':_0x34b72a[_0x9c25('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9c25('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x9c25('0x2c')](handleEntityNotFound(_0x2ed88d,null))[_0x9c25('0x2c')](function(_0x31a9eb){var _0xc8deeb=_['map'](_0x31a9eb,'id');var _0x19a192=[];var _0x541159=[];var _0x5d9792=squel['select']();_0x5d9792['field'](_0x9c25('0x75'))['from']('team_has_openchannel_queues','tq')[_0x9c25('0x76')](_0x9c25('0x77'),'ut',_0x9c25('0x78'))[_0x9c25('0x46')](_0x9c25('0x79'),_0x34b72a[_0x9c25('0x4f')]['id']);for(var _0x54a282=0x0;_0x54a282<_0x31a9eb['length'];_0x54a282+=0x1){let _0x504942=_0x31a9eb[_0x54a282];for(var _0x39a80a=0x0;_0x39a80a<_0x504942['Agents'][_0x9c25('0x41')];_0x39a80a+=0x1){let _0x390df9=_0x504942[_0x9c25('0x6b')][_0x39a80a];var _0x3ab277=_0x5d9792[_0x9c25('0x7a')]();_0x3ab277[_0x9c25('0x46')](_0x9c25('0x7b'),_0x390df9['id']);_0x541159[_0x9c25('0x7c')](db[_0x9c25('0x6e')][_0x9c25('0x3c')](_0x3ab277['toString'](),{'type':db['sequelize']['QueryTypes']['SELECT']})['then'](function(_0x41056e){if(_0x41056e[_0x9c25('0x41')]===0x1){return _0x390df9['id'];}else{var _0x36040e=_['every'](_[_0x9c25('0x35')](_0x41056e,_0x9c25('0x7d')),function(_0xa60886){return _[_0x9c25('0x7e')](_0xc8deeb,_0xa60886);});if(_0x36040e){return _0x390df9['id'];}}}));}}return BPromise[_0x9c25('0x7f')](_0x541159)[_0x9c25('0x2c')](function(_0x2dfb45){_0x19a192=_(_0x19a192)[_0x9c25('0x80')](_0x2dfb45)['compact']()[_0x9c25('0x81')]();return db[_0x9c25('0x36')][_0x9c25('0x59')]({'where':{'id':_0x34b72a['params']['id']}})['then'](function(_0x514ae9){return db[_0x9c25('0x6e')]['transaction'](function(_0x2121a7){return _0x514ae9[_0x9c25('0x82')](_0x34b72a['query']['ids'],{'transaction':_0x2121a7})[_0x9c25('0x2c')](function(){if(!_[_0x9c25('0x83')](_0x19a192)){return _0x514ae9['removeAgents'](_0x19a192,{'transaction':_0x2121a7});}})[_0x9c25('0x2c')](function(){_0x19a192['forEach'](function(_0xd348ad){socket[_0x9c25('0x84')]('userOpenchannelQueue:remove',{'UserId':_0xd348ad,'OpenchannelQueueId':_0x514ae9['id']});});});});});});})['then'](respondWithStatusCode(_0x2ed88d,null))['catch'](handleError(_0x2ed88d,null));};exports[_0x9c25('0x85')]=function(_0x206921,_0x175b47,_0x286b03){return db[_0x9c25('0x36')][_0x9c25('0x59')]({'where':{'id':_0x206921['params']['id']}})['then'](handleEntityNotFound(_0x175b47,null))[_0x9c25('0x2c')](function(_0x475ca3){if(_0x475ca3){return _0x475ca3['addAgents'](_0x206921[_0x9c25('0x52')][_0x9c25('0x69')],_[_0x9c25('0x86')](_0x206921[_0x9c25('0x52')],['ids','id'])||{})[_0x9c25('0x87')](function(_0x49ac22){for(var _0x45b43a=0x0;_0x45b43a<_0x206921[_0x9c25('0x52')]['ids'][_0x9c25('0x41')];_0x45b43a+=0x1){socket[_0x9c25('0x84')]('userOpenchannelQueue:save',{'UserId':Number(_0x206921[_0x9c25('0x52')][_0x9c25('0x69')][_0x45b43a]),'OpenchannelQueueId':Number(_0x206921[_0x9c25('0x4f')]['id'])});}return _0x49ac22;});}})[_0x9c25('0x2c')](respondWithResult(_0x175b47,null))['catch'](handleError(_0x175b47,null));};exports[_0x9c25('0x88')]=function(_0x16e9b1,_0x2e712c,_0x28c5b1){return db[_0x9c25('0x36')][_0x9c25('0x59')]({'where':{'id':_0x16e9b1[_0x9c25('0x4f')]['id']}})[_0x9c25('0x2c')](handleEntityNotFound(_0x2e712c,null))[_0x9c25('0x2c')](function(_0x2bf727){if(_0x2bf727){return _0x2bf727[_0x9c25('0x88')](_0x16e9b1[_0x9c25('0x3c')]['ids'])[_0x9c25('0x2c')](function(){if(_[_0x9c25('0x89')](_0x16e9b1[_0x9c25('0x3c')][_0x9c25('0x69')])){for(var _0x5c8aac=0x0;_0x5c8aac<_0x16e9b1[_0x9c25('0x3c')][_0x9c25('0x69')][_0x9c25('0x41')];_0x5c8aac+=0x1){socket[_0x9c25('0x84')](_0x9c25('0x8a'),{'UserId':Number(_0x16e9b1[_0x9c25('0x3c')][_0x9c25('0x69')][_0x5c8aac]),'OpenchannelQueueId':Number(_0x16e9b1['params']['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x16e9b1[_0x9c25('0x3c')][_0x9c25('0x69')]),'OpenchannelQueueId':Number(_0x16e9b1[_0x9c25('0x4f')]['id'])});}});}})[_0x9c25('0x2c')](respondWithStatusCode(_0x2e712c,null))['catch'](handleError(_0x2e712c,null));};exports[_0x9c25('0x8b')]=function(_0x5ca8cf,_0x4ea272,_0x26226c){var _0x3484db={};var _0x294bb5={};var _0x28408e;var _0x4ef6fb;return db[_0x9c25('0x36')][_0x9c25('0x5c')]({'where':{'id':_0x5ca8cf[_0x9c25('0x4f')]['id']}})[_0x9c25('0x2c')](handleEntityNotFound(_0x4ea272,null))[_0x9c25('0x2c')](function(_0x59e69a){if(_0x59e69a){_0x28408e=_0x59e69a;_0x294bb5[_0x9c25('0x3b')]=_[_0x9c25('0x50')](db[_0x9c25('0x6a')][_0x9c25('0x37')]);_0x294bb5[_0x9c25('0x3c')]=_[_0x9c25('0x50')](_0x5ca8cf[_0x9c25('0x3c')]);_0x294bb5[_0x9c25('0x3d')]=_[_0x9c25('0x3e')](_0x294bb5[_0x9c25('0x3b')],_0x294bb5['query']);_0x3484db['attributes']=_[_0x9c25('0x3e')](_0x294bb5[_0x9c25('0x3b')],qs['fields'](_0x5ca8cf[_0x9c25('0x3c')][_0x9c25('0x40')]));_0x3484db['attributes']=_0x3484db[_0x9c25('0x3f')][_0x9c25('0x41')]?_0x3484db[_0x9c25('0x3f')]:_0x294bb5[_0x9c25('0x3b')];_0x3484db[_0x9c25('0x44')]=qs[_0x9c25('0x45')](_0x5ca8cf[_0x9c25('0x3c')][_0x9c25('0x45')]);_0x3484db[_0x9c25('0x46')]=qs[_0x9c25('0x3d')](_['pick'](_0x5ca8cf[_0x9c25('0x3c')],_0x294bb5[_0x9c25('0x3d')]));if(_0x5ca8cf[_0x9c25('0x3c')][_0x9c25('0x47')]){_0x3484db['where']=_['merge'](_0x3484db[_0x9c25('0x46')],{'$or':_[_0x9c25('0x35')](_0x3484db[_0x9c25('0x3f')],function(_0x43e877){var _0x2f6800={};_0x2f6800[_0x43e877]={'$like':'%'+_0x5ca8cf[_0x9c25('0x3c')][_0x9c25('0x47')]+'%'};return _0x2f6800;})});}_0x3484db=_['merge']({},_0x3484db,_0x5ca8cf[_0x9c25('0x5f')]);return _0x28408e[_0x9c25('0x8b')](_0x3484db);}})['then'](function(_0x5e4d70){if(_0x5e4d70){_0x4ef6fb=_0x5e4d70[_0x9c25('0x41')];if(!_0x5ca8cf[_0x9c25('0x3c')]['hasOwnProperty'](_0x9c25('0x68'))){_0x3484db[_0x9c25('0x43')]=qs[_0x9c25('0x43')](_0x5ca8cf['query'][_0x9c25('0x43')]);_0x3484db[_0x9c25('0x25')]=qs[_0x9c25('0x25')](_0x5ca8cf['query'][_0x9c25('0x25')]);}return _0x28408e[_0x9c25('0x8b')](_0x3484db);}})[_0x9c25('0x2c')](function(_0x114fcf){if(_0x114fcf){return _0x114fcf?{'count':_0x4ef6fb,'rows':_0x114fcf}:null;}})[_0x9c25('0x2c')](respondWithResult(_0x4ea272,null))[_0x9c25('0x4d')](handleError(_0x4ea272,null));}; \ No newline at end of file +var _0x4c26=['field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','TeamId','includes','union','compact','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','index','map','OpenchannelQueue','rawAttributes','keys','query','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','length','find','create','role','user','OpenchannelQueues','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','findAndCountAll','UserId','agent','updatedAt','%s/%s','openchannelPause','createdAt','Team','getTeams','addTeams','ids','User','Agents','online','interface','transaction','each','emit','removeTeams','findAll','select'];(function(_0x1d0bac,_0x32daab){var _0x23a124=function(_0xd100f1){while(--_0xd100f1){_0x1d0bac['push'](_0x1d0bac['shift']());}};_0x23a124(++_0x32daab);}(_0x4c26,0xa2));var _0x64c2=function(_0x4fdf93,_0x2f1950){_0x4fdf93=_0x4fdf93-0x0;var _0x305fa6=_0x4c26[_0x4fdf93];return _0x305fa6;};'use strict';var emlformat=require(_0x64c2('0x0'));var rimraf=require(_0x64c2('0x1'));var zipdir=require(_0x64c2('0x2'));var jsonpatch=require(_0x64c2('0x3'));var rp=require(_0x64c2('0x4'));var moment=require('moment');var BPromise=require(_0x64c2('0x5'));var Mustache=require(_0x64c2('0x6'));var util=require('util');var path=require(_0x64c2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x64c2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64c2('0x9'));var squel=require(_0x64c2('0xa'));var crypto=require(_0x64c2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x64c2('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x64c2('0xd'));var Redis=require(_0x64c2('0xe'));var authService=require(_0x64c2('0xf'));var qs=require(_0x64c2('0x10'));var as=require(_0x64c2('0x11'));var hardwareService=require(_0x64c2('0x12'));var logger=require(_0x64c2('0x13'))(_0x64c2('0x14'));var utils=require(_0x64c2('0x15'));var config=require(_0x64c2('0x16'));var licenseUtil=require(_0x64c2('0x17'));var db=require('../../mysqldb')['db'];config[_0x64c2('0x18')]=_[_0x64c2('0x19')](config[_0x64c2('0x18')],{'host':_0x64c2('0x1a'),'port':0x18eb});var socket=require(_0x64c2('0x1b'))(new Redis(config[_0x64c2('0x18')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x389d72,_0x54ae2f){_0x54ae2f=_0x54ae2f||0xcc;return function(_0x2c6113){if(_0x2c6113){return _0x389d72[_0x64c2('0x1c')](_0x54ae2f);}return _0x389d72['status'](_0x54ae2f)[_0x64c2('0x1d')]();};}function respondWithResult(_0x354b61,_0xa307dc){_0xa307dc=_0xa307dc||0xc8;return function(_0x19a76f){if(_0x19a76f){return _0x354b61[_0x64c2('0x1e')](_0xa307dc)[_0x64c2('0x1f')](_0x19a76f);}};}function respondWithFilteredResult(_0x13f720,_0x46ed74){return function(_0x5d2402){if(_0x5d2402){var _0x2a0b38=typeof _0x46ed74['offset']==='undefined'&&typeof _0x46ed74[_0x64c2('0x20')]==='undefined';var _0x12d136=_0x5d2402[_0x64c2('0x21')];var _0x142c56=_0x2a0b38?0x0:_0x46ed74[_0x64c2('0x22')];var _0x3a9958=_0x2a0b38?_0x5d2402[_0x64c2('0x21')]:_0x46ed74['offset']+_0x46ed74[_0x64c2('0x20')];var _0x52657e;if(_0x3a9958>=_0x12d136){_0x3a9958=_0x12d136;_0x52657e=0xc8;}else{_0x52657e=0xce;}_0x13f720[_0x64c2('0x1e')](_0x52657e);return _0x13f720[_0x64c2('0x23')](_0x64c2('0x24'),_0x142c56+'-'+_0x3a9958+'/'+_0x12d136)['json'](_0x5d2402);}return null;};}function patchUpdates(_0x3b64ef){return function(_0x180c0b){try{jsonpatch[_0x64c2('0x25')](_0x180c0b,_0x3b64ef,!![]);}catch(_0x395a5b){return BPromise[_0x64c2('0x26')](_0x395a5b);}return _0x180c0b['save']();};}function saveUpdates(_0xc87946,_0x3c6993){return function(_0x17cfeb){if(_0x17cfeb){return _0x17cfeb[_0x64c2('0x27')](_0xc87946)[_0x64c2('0x28')](function(_0x1c4b56){return _0x1c4b56;});}return null;};}function removeEntity(_0x583107,_0xbe1723){return function(_0xf18349){if(_0xf18349){return _0xf18349[_0x64c2('0x29')]()['then'](function(){var _0x5f4a7d=_0xf18349[_0x64c2('0x2a')]({'plain':!![]});var _0xee5a81='OpenchannelQueues';return db[_0x64c2('0x2b')][_0x64c2('0x29')]({'where':{'type':_0xee5a81,'resourceId':_0x5f4a7d['id']}})[_0x64c2('0x28')](function(){return _0xf18349;});})[_0x64c2('0x28')](function(){_0x583107[_0x64c2('0x1e')](0xcc)[_0x64c2('0x1d')]();});}};}function handleEntityNotFound(_0x3ee710,_0x2110fa){return function(_0x2bdd7c){if(!_0x2bdd7c){_0x3ee710[_0x64c2('0x1c')](0x194);}return _0x2bdd7c;};}function handleError(_0x2eee7f,_0x4d487f){_0x4d487f=_0x4d487f||0x1f4;return function(_0x11a223){logger['error'](_0x11a223[_0x64c2('0x2c')]);if(_0x11a223[_0x64c2('0x2d')]){delete _0x11a223['name'];}_0x2eee7f[_0x64c2('0x1e')](_0x4d487f)['send'](_0x11a223);};}exports[_0x64c2('0x2e')]=function(_0xf1311b,_0x1a5863){var _0x22d185={},_0x27243e={},_0x127373={'count':0x0,'rows':[]};var _0x12a69a=_[_0x64c2('0x2f')](db[_0x64c2('0x30')][_0x64c2('0x31')],function(_0x5c87fc){return{'name':_0x5c87fc['fieldName'],'type':_0x5c87fc['type']['key']};});_0x27243e['model']=_[_0x64c2('0x2f')](_0x12a69a,_0x64c2('0x2d'));_0x27243e['query']=_[_0x64c2('0x32')](_0xf1311b[_0x64c2('0x33')]);_0x27243e[_0x64c2('0x34')]=_[_0x64c2('0x35')](_0x27243e[_0x64c2('0x36')],_0x27243e['query']);_0x22d185['attributes']=_[_0x64c2('0x35')](_0x27243e['model'],qs['fields'](_0xf1311b['query'][_0x64c2('0x37')]));_0x22d185[_0x64c2('0x38')]=_0x22d185['attributes']['length']?_0x22d185[_0x64c2('0x38')]:_0x27243e[_0x64c2('0x36')];if(!_0xf1311b[_0x64c2('0x33')][_0x64c2('0x39')](_0x64c2('0x3a'))){_0x22d185[_0x64c2('0x20')]=qs[_0x64c2('0x20')](_0xf1311b[_0x64c2('0x33')][_0x64c2('0x20')]);_0x22d185['offset']=qs[_0x64c2('0x22')](_0xf1311b[_0x64c2('0x33')][_0x64c2('0x22')]);}_0x22d185['order']=qs[_0x64c2('0x3b')](_0xf1311b[_0x64c2('0x33')]['sort']);_0x22d185[_0x64c2('0x3c')]=qs[_0x64c2('0x34')](_[_0x64c2('0x3d')](_0xf1311b[_0x64c2('0x33')],_0x27243e['filters']),_0x12a69a);if(_0xf1311b[_0x64c2('0x33')][_0x64c2('0x3e')]){_0x22d185[_0x64c2('0x3c')]=_[_0x64c2('0x3f')](_0x22d185[_0x64c2('0x3c')],{'$or':_[_0x64c2('0x2f')](_0x12a69a,function(_0x4152f9){if(_0x4152f9['type']!=='VIRTUAL'){var _0x157e34={};_0x157e34[_0x4152f9[_0x64c2('0x2d')]]={'$like':'%'+_0xf1311b[_0x64c2('0x33')]['filter']+'%'};return _0x157e34;}})});}_0x22d185=_[_0x64c2('0x3f')]({},_0x22d185,_0xf1311b[_0x64c2('0x40')]);var _0x1f094a={'where':_0x22d185['where']};return db[_0x64c2('0x30')][_0x64c2('0x21')](_0x1f094a)[_0x64c2('0x28')](function(_0x4a8e88){_0x127373[_0x64c2('0x21')]=_0x4a8e88;if(_0xf1311b['query'][_0x64c2('0x41')]){_0x22d185[_0x64c2('0x42')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x22d185);})[_0x64c2('0x28')](function(_0x1caa44){_0x127373[_0x64c2('0x43')]=_0x1caa44;return _0x127373;})[_0x64c2('0x28')](respondWithFilteredResult(_0x1a5863,_0x22d185))[_0x64c2('0x44')](handleError(_0x1a5863,null));};exports[_0x64c2('0x45')]=function(_0x4a2ccc,_0x1f8fb4){var _0x2a6e68={'raw':!![],'where':{'id':_0x4a2ccc['params']['id']}},_0x44ac9f={};_0x44ac9f[_0x64c2('0x36')]=_[_0x64c2('0x32')](db[_0x64c2('0x30')][_0x64c2('0x31')]);_0x44ac9f[_0x64c2('0x33')]=_[_0x64c2('0x32')](_0x4a2ccc[_0x64c2('0x33')]);_0x44ac9f['filters']=_[_0x64c2('0x35')](_0x44ac9f[_0x64c2('0x36')],_0x44ac9f[_0x64c2('0x33')]);_0x2a6e68[_0x64c2('0x38')]=_['intersection'](_0x44ac9f['model'],qs[_0x64c2('0x37')](_0x4a2ccc[_0x64c2('0x33')][_0x64c2('0x37')]));_0x2a6e68[_0x64c2('0x38')]=_0x2a6e68[_0x64c2('0x38')][_0x64c2('0x46')]?_0x2a6e68[_0x64c2('0x38')]:_0x44ac9f[_0x64c2('0x36')];if(_0x4a2ccc['query']['includeAll']){_0x2a6e68[_0x64c2('0x42')]=[{'all':!![]}];}_0x2a6e68=_[_0x64c2('0x3f')]({},_0x2a6e68,_0x4a2ccc['options']);return db['OpenchannelQueue'][_0x64c2('0x47')](_0x2a6e68)[_0x64c2('0x28')](handleEntityNotFound(_0x1f8fb4,null))[_0x64c2('0x28')](respondWithResult(_0x1f8fb4,null))[_0x64c2('0x44')](handleError(_0x1f8fb4,null));};exports[_0x64c2('0x48')]=function(_0x54849b,_0x575ec2){return db[_0x64c2('0x30')][_0x64c2('0x48')](_0x54849b['body'],{})['then'](function(_0x448d4e){var _0x5431ef=_0x54849b['user']['get']({'plain':!![]});if(!_0x5431ef)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5431ef[_0x64c2('0x49')]===_0x64c2('0x4a')){var _0x420d09=_0x448d4e[_0x64c2('0x2a')]({'plain':!![]});var _0x1c6f6c=_0x64c2('0x4b');return db['UserProfileSection'][_0x64c2('0x47')]({'where':{'name':_0x1c6f6c,'userProfileId':_0x5431ef['userProfileId']},'raw':!![]})[_0x64c2('0x28')](function(_0x20a8fa){if(_0x20a8fa&&_0x20a8fa[_0x64c2('0x4c')]===0x0){return db[_0x64c2('0x2b')][_0x64c2('0x48')]({'name':_0x420d09[_0x64c2('0x2d')],'resourceId':_0x420d09['id'],'type':_0x20a8fa[_0x64c2('0x2d')],'sectionId':_0x20a8fa['id']},{})['then'](function(){return _0x448d4e;});}else{return _0x448d4e;}})[_0x64c2('0x44')](function(_0x3db046){logger[_0x64c2('0x4d')](_0x64c2('0x4e'),_0x3db046);throw _0x3db046;});}return _0x448d4e;})[_0x64c2('0x28')](respondWithResult(_0x575ec2,0xc9))[_0x64c2('0x44')](handleError(_0x575ec2,null));};exports[_0x64c2('0x27')]=function(_0x419a0a,_0x26f8b5){if(_0x419a0a[_0x64c2('0x4f')]['id']){delete _0x419a0a['body']['id'];}return db[_0x64c2('0x30')][_0x64c2('0x47')]({'where':{'id':_0x419a0a[_0x64c2('0x50')]['id']}})[_0x64c2('0x28')](handleEntityNotFound(_0x26f8b5,null))[_0x64c2('0x28')](saveUpdates(_0x419a0a[_0x64c2('0x4f')],null))[_0x64c2('0x28')](respondWithResult(_0x26f8b5,null))[_0x64c2('0x44')](handleError(_0x26f8b5,null));};exports['destroy']=function(_0x59bd97,_0x3c3b2e){return db[_0x64c2('0x30')][_0x64c2('0x47')]({'where':{'id':_0x59bd97[_0x64c2('0x50')]['id']}})[_0x64c2('0x28')](handleEntityNotFound(_0x3c3b2e,null))[_0x64c2('0x28')](removeEntity(_0x3c3b2e,null))['catch'](handleError(_0x3c3b2e,null));};exports[_0x64c2('0x51')]=function(_0x4ee721,_0x42e6ad){return db[_0x64c2('0x30')][_0x64c2('0x51')]()[_0x64c2('0x28')](respondWithResult(_0x42e6ad,null))[_0x64c2('0x44')](handleError(_0x42e6ad,null));};exports[_0x64c2('0x52')]=function(_0x59ef91,_0x3690d5,_0x66cc5e){var _0x482c7d={'raw':!![],'where':{}},_0x32d393={},_0x22e480;return db[_0x64c2('0x30')][_0x64c2('0x53')]({'where':{'id':_0x59ef91[_0x64c2('0x50')]['id']}})[_0x64c2('0x28')](handleEntityNotFound(_0x3690d5,null))['then'](function(_0x11721d){if(_0x11721d){_0x22e480=_0x11721d[_0x64c2('0x2a')]({'plain':!![]});_0x32d393[_0x64c2('0x36')]=_['keys'](db[_0x64c2('0x54')][_0x64c2('0x31')]);_0x32d393[_0x64c2('0x33')]=_[_0x64c2('0x32')](_0x59ef91[_0x64c2('0x33')]);_0x32d393[_0x64c2('0x34')]=_[_0x64c2('0x35')](_0x32d393[_0x64c2('0x36')],_0x32d393[_0x64c2('0x33')]);_0x482c7d[_0x64c2('0x38')]=_[_0x64c2('0x35')](_0x32d393[_0x64c2('0x36')],qs[_0x64c2('0x37')](_0x59ef91['query'][_0x64c2('0x37')]));_0x482c7d[_0x64c2('0x38')]=_0x482c7d[_0x64c2('0x38')][_0x64c2('0x46')]?_0x482c7d['attributes']:_0x32d393[_0x64c2('0x36')];if(!_0x59ef91[_0x64c2('0x33')][_0x64c2('0x39')](_0x64c2('0x3a'))){_0x482c7d['limit']=qs[_0x64c2('0x20')](_0x59ef91[_0x64c2('0x33')][_0x64c2('0x20')]);_0x482c7d[_0x64c2('0x22')]=qs[_0x64c2('0x22')](_0x59ef91[_0x64c2('0x33')][_0x64c2('0x22')]);}_0x482c7d[_0x64c2('0x55')]=qs[_0x64c2('0x3b')](_0x59ef91['query'][_0x64c2('0x3b')]);_0x482c7d[_0x64c2('0x3c')]=qs['filters'](_[_0x64c2('0x3d')](_0x59ef91[_0x64c2('0x33')],_0x32d393[_0x64c2('0x34')]));_0x482c7d['where'][_0x64c2('0x56')]=_0x11721d['id'];if(_0x59ef91[_0x64c2('0x33')][_0x64c2('0x3e')]){_0x482c7d[_0x64c2('0x3c')]=_[_0x64c2('0x3f')](_0x482c7d[_0x64c2('0x3c')],{'$or':_['map'](_0x482c7d[_0x64c2('0x38')],function(_0x1474c0){var _0x5e097b={};_0x5e097b[_0x1474c0]={'$like':'%'+_0x59ef91['query'][_0x64c2('0x3e')]+'%'};return _0x5e097b;})});}_0x482c7d=_[_0x64c2('0x3f')]({},_0x482c7d,_0x59ef91['options']);return db[_0x64c2('0x54')]['findAll'](_0x482c7d);}})[_0x64c2('0x28')](function(_0x33f2a0){if(_0x33f2a0){return db['User'][_0x64c2('0x57')]({'where':{'id':_[_0x64c2('0x2f')](_0x33f2a0,_0x64c2('0x58')),'role':_0x64c2('0x59')},'attributes':['id',_0x64c2('0x2d'),'openchannelPause',_0x64c2('0x5a'),'createdAt']});}})[_0x64c2('0x28')](function(_0x1dc9ff){if(_0x1dc9ff){return{'count':_0x1dc9ff[_0x64c2('0x21')],'rows':_[_0x64c2('0x2f')](_0x1dc9ff['rows'],function(_0x55dfd9){return{'membername':_0x55dfd9[_0x64c2('0x2d')],'UserId':_0x55dfd9['id'],'queue_name':_0x22e480[_0x64c2('0x2d')],'OpenchannelQueueId':_0x22e480['id'],'interface':util['format'](_0x64c2('0x5b'),'SIP',_0x55dfd9['name']),'penalty':0x0,'paused':_0x55dfd9[_0x64c2('0x5c')],'createdAt':_0x55dfd9[_0x64c2('0x5d')],'updatedAt':_0x55dfd9[_0x64c2('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x64c2('0x28')](respondWithFilteredResult(_0x3690d5,_0x482c7d))['catch'](handleError(_0x3690d5,null));};exports['getTeams']=function(_0x3c10de,_0x1a9dad,_0x414b8a){var _0x489af3={};var _0x1d6703={};var _0x49ecf4;var _0x226ef2;return db['OpenchannelQueue'][_0x64c2('0x53')]({'where':{'id':_0x3c10de[_0x64c2('0x50')]['id']}})[_0x64c2('0x28')](handleEntityNotFound(_0x1a9dad,null))[_0x64c2('0x28')](function(_0x5270e6){if(_0x5270e6){_0x49ecf4=_0x5270e6;_0x1d6703['model']=_[_0x64c2('0x32')](db[_0x64c2('0x5e')]['rawAttributes']);_0x1d6703['query']=_[_0x64c2('0x32')](_0x3c10de['query']);_0x1d6703[_0x64c2('0x34')]=_[_0x64c2('0x35')](_0x1d6703['model'],_0x1d6703[_0x64c2('0x33')]);_0x489af3['attributes']=_['intersection'](_0x1d6703[_0x64c2('0x36')],qs[_0x64c2('0x37')](_0x3c10de[_0x64c2('0x33')][_0x64c2('0x37')]));_0x489af3[_0x64c2('0x38')]=_0x489af3[_0x64c2('0x38')][_0x64c2('0x46')]?_0x489af3[_0x64c2('0x38')]:_0x1d6703[_0x64c2('0x36')];_0x489af3[_0x64c2('0x55')]=qs['sort'](_0x3c10de['query']['sort']);_0x489af3['where']=qs[_0x64c2('0x34')](_[_0x64c2('0x3d')](_0x3c10de[_0x64c2('0x33')],_0x1d6703[_0x64c2('0x34')]));if(_0x3c10de[_0x64c2('0x33')]['filter']){_0x489af3[_0x64c2('0x3c')]=_['merge'](_0x489af3[_0x64c2('0x3c')],{'$or':_[_0x64c2('0x2f')](_0x489af3[_0x64c2('0x38')],function(_0x563ecc){var _0x277074={};_0x277074[_0x563ecc]={'$like':'%'+_0x3c10de[_0x64c2('0x33')][_0x64c2('0x3e')]+'%'};return _0x277074;})});}_0x489af3=_[_0x64c2('0x3f')]({},_0x489af3,_0x3c10de[_0x64c2('0x40')]);return _0x49ecf4['getTeams'](_0x489af3);}})[_0x64c2('0x28')](function(_0xcb809a){if(_0xcb809a){_0x226ef2=_0xcb809a['length'];if(!_0x3c10de['query'][_0x64c2('0x39')](_0x64c2('0x3a'))){_0x489af3[_0x64c2('0x20')]=qs[_0x64c2('0x20')](_0x3c10de[_0x64c2('0x33')][_0x64c2('0x20')]);_0x489af3[_0x64c2('0x22')]=qs[_0x64c2('0x22')](_0x3c10de[_0x64c2('0x33')]['offset']);}return _0x49ecf4[_0x64c2('0x5f')](_0x489af3);}})[_0x64c2('0x28')](function(_0x2e2f0a){if(_0x2e2f0a){return _0x2e2f0a?{'count':_0x226ef2,'rows':_0x2e2f0a}:null;}})[_0x64c2('0x28')](respondWithResult(_0x1a9dad,null))[_0x64c2('0x44')](handleError(_0x1a9dad,null));};exports[_0x64c2('0x60')]=function(_0x1f8bb0,_0x19b511,_0x1de0a8){var _0x5bf3e0=_0x1f8bb0[_0x64c2('0x4f')][_0x64c2('0x61')];return db['Team']['findAll']({'where':{'id':_0x5bf3e0},'attributes':['id'],'include':[{'model':db[_0x64c2('0x62')],'as':_0x64c2('0x63'),'attributes':['id','name',_0x64c2('0x64'),'voicePause',_0x64c2('0x65')],'raw':!![]}]})[_0x64c2('0x28')](function(_0x5dc21d){if(_0x5dc21d){var _0x2c4e40=_['flatMap'](_0x5dc21d,function(_0x2680a1){var _0x40a5ed=_0x2680a1['get']({'plain':!![]});return _0x40a5ed[_0x64c2('0x63')];});return db[_0x64c2('0x30')]['find']({'where':{'id':_0x1f8bb0[_0x64c2('0x50')]['id']}})[_0x64c2('0x28')](function(_0x42670b){return db['sequelize'][_0x64c2('0x66')](function(_0x47f673){return _0x42670b[_0x64c2('0x60')](_0x5bf3e0,{'transaction':_0x47f673})[_0x64c2('0x28')](function(){return BPromise[_0x64c2('0x67')](_0x2c4e40,function(_0x13efcd){return db[_0x64c2('0x54')]['findOrCreate']({'where':{'UserId':_0x13efcd['id'],'OpenchannelQueueId':_0x1f8bb0['params']['id']},'transaction':_0x47f673});});})['then'](function(){_0x2c4e40['forEach'](function(_0xf6110e){socket[_0x64c2('0x68')]('userOpenchannelQueue:save',{'UserId':_0xf6110e['id'],'OpenchannelQueueId':_0x42670b['id']});});});});});}})[_0x64c2('0x28')](respondWithStatusCode(_0x19b511,null))['catch'](handleError(_0x19b511,null));};exports[_0x64c2('0x69')]=function(_0x2bef92,_0x546cf9,_0x2d40de){return db[_0x64c2('0x5e')][_0x64c2('0x6a')]({'where':{'id':_0x2bef92['query'][_0x64c2('0x61')]},'attributes':['id'],'include':[{'model':db[_0x64c2('0x62')],'as':_0x64c2('0x63'),'attributes':['id'],'raw':!![]}]})[_0x64c2('0x28')](handleEntityNotFound(_0x546cf9,null))[_0x64c2('0x28')](function(_0x3be25b){var _0x6ed73f=_[_0x64c2('0x2f')](_0x3be25b,'id');var _0x54b0bf=[];var _0x646860=[];var _0x217394=squel[_0x64c2('0x6b')]();_0x217394[_0x64c2('0x6c')](_0x64c2('0x6d'))[_0x64c2('0x6e')](_0x64c2('0x6f'),'tq')[_0x64c2('0x70')](_0x64c2('0x71'),'ut',_0x64c2('0x72'))['where']('OpenchannelQueueId\x20=\x20?',_0x2bef92['params']['id']);for(var _0x1c63af=0x0;_0x1c63af<_0x3be25b[_0x64c2('0x46')];_0x1c63af+=0x1){let _0xabeef7=_0x3be25b[_0x1c63af];for(var _0x1492eb=0x0;_0x1492eb<_0xabeef7[_0x64c2('0x63')][_0x64c2('0x46')];_0x1492eb+=0x1){let _0x4e714d=_0xabeef7['Agents'][_0x1492eb];var _0x4b985d=_0x217394[_0x64c2('0x73')]();_0x4b985d['where'](_0x64c2('0x74'),_0x4e714d['id']);_0x646860[_0x64c2('0x75')](db[_0x64c2('0x76')][_0x64c2('0x33')](_0x4b985d[_0x64c2('0x77')](),{'type':db[_0x64c2('0x76')]['QueryTypes']['SELECT']})[_0x64c2('0x28')](function(_0x2af054){if(_0x2af054[_0x64c2('0x46')]===0x1){return _0x4e714d['id'];}else{var _0x1be15e=_['every'](_['map'](_0x2af054,_0x64c2('0x78')),function(_0x56346b){return _[_0x64c2('0x79')](_0x6ed73f,_0x56346b);});if(_0x1be15e){return _0x4e714d['id'];}}}));}}return BPromise['all'](_0x646860)[_0x64c2('0x28')](function(_0x46e85c){_0x54b0bf=_(_0x54b0bf)[_0x64c2('0x7a')](_0x46e85c)[_0x64c2('0x7b')]()[_0x64c2('0x7c')]();return db['OpenchannelQueue'][_0x64c2('0x47')]({'where':{'id':_0x2bef92[_0x64c2('0x50')]['id']}})[_0x64c2('0x28')](function(_0x4a18f4){return db[_0x64c2('0x76')]['transaction'](function(_0x476ab0){return _0x4a18f4['removeTeams'](_0x2bef92['query'][_0x64c2('0x61')],{'transaction':_0x476ab0})['then'](function(){if(!_[_0x64c2('0x7d')](_0x54b0bf)){return _0x4a18f4[_0x64c2('0x7e')](_0x54b0bf,{'transaction':_0x476ab0});}})[_0x64c2('0x28')](function(){_0x54b0bf[_0x64c2('0x7f')](function(_0xa648d1){socket[_0x64c2('0x68')](_0x64c2('0x80'),{'UserId':_0xa648d1,'OpenchannelQueueId':_0x4a18f4['id']});});});});});});})[_0x64c2('0x28')](respondWithStatusCode(_0x546cf9,null))[_0x64c2('0x44')](handleError(_0x546cf9,null));};exports[_0x64c2('0x81')]=function(_0x5d8a56,_0xbf809b,_0x54b8c9){return db[_0x64c2('0x30')][_0x64c2('0x47')]({'where':{'id':_0x5d8a56[_0x64c2('0x50')]['id']}})[_0x64c2('0x28')](handleEntityNotFound(_0xbf809b,null))[_0x64c2('0x28')](function(_0x1c9e35){if(_0x1c9e35){return _0x1c9e35[_0x64c2('0x81')](_0x5d8a56[_0x64c2('0x4f')][_0x64c2('0x61')],_[_0x64c2('0x82')](_0x5d8a56['body'],[_0x64c2('0x61'),'id'])||{})[_0x64c2('0x83')](function(_0x3300c0){for(var _0x3fea54=0x0;_0x3fea54<_0x5d8a56[_0x64c2('0x4f')]['ids'][_0x64c2('0x46')];_0x3fea54+=0x1){socket[_0x64c2('0x68')](_0x64c2('0x84'),{'UserId':Number(_0x5d8a56[_0x64c2('0x4f')][_0x64c2('0x61')][_0x3fea54]),'OpenchannelQueueId':Number(_0x5d8a56['params']['id'])});}return _0x3300c0;});}})[_0x64c2('0x28')](respondWithResult(_0xbf809b,null))[_0x64c2('0x44')](handleError(_0xbf809b,null));};exports[_0x64c2('0x7e')]=function(_0xd8bbcc,_0x255cfc,_0xd51916){return db[_0x64c2('0x30')][_0x64c2('0x47')]({'where':{'id':_0xd8bbcc[_0x64c2('0x50')]['id']}})[_0x64c2('0x28')](handleEntityNotFound(_0x255cfc,null))['then'](function(_0x206a51){if(_0x206a51){return _0x206a51[_0x64c2('0x7e')](_0xd8bbcc['query'][_0x64c2('0x61')])[_0x64c2('0x28')](function(){if(_[_0x64c2('0x85')](_0xd8bbcc[_0x64c2('0x33')][_0x64c2('0x61')])){for(var _0xf08297=0x0;_0xf08297<_0xd8bbcc[_0x64c2('0x33')]['ids'][_0x64c2('0x46')];_0xf08297+=0x1){socket['emit'](_0x64c2('0x80'),{'UserId':Number(_0xd8bbcc['query']['ids'][_0xf08297]),'OpenchannelQueueId':Number(_0xd8bbcc[_0x64c2('0x50')]['id'])});}}else{socket['emit'](_0x64c2('0x80'),{'UserId':Number(_0xd8bbcc['query'][_0x64c2('0x61')]),'OpenchannelQueueId':Number(_0xd8bbcc[_0x64c2('0x50')]['id'])});}});}})[_0x64c2('0x28')](respondWithStatusCode(_0x255cfc,null))[_0x64c2('0x44')](handleError(_0x255cfc,null));};exports['getAgents']=function(_0x512f75,_0x55a963,_0x459b33){var _0x5bdd02={};var _0x56b458={};var _0x3591b6;var _0x54bcce;return db['OpenchannelQueue'][_0x64c2('0x53')]({'where':{'id':_0x512f75[_0x64c2('0x50')]['id']}})['then'](handleEntityNotFound(_0x55a963,null))[_0x64c2('0x28')](function(_0x4c528d){if(_0x4c528d){_0x3591b6=_0x4c528d;_0x56b458[_0x64c2('0x36')]=_[_0x64c2('0x32')](db['User'][_0x64c2('0x31')]);_0x56b458[_0x64c2('0x33')]=_[_0x64c2('0x32')](_0x512f75[_0x64c2('0x33')]);_0x56b458[_0x64c2('0x34')]=_[_0x64c2('0x35')](_0x56b458[_0x64c2('0x36')],_0x56b458[_0x64c2('0x33')]);_0x5bdd02[_0x64c2('0x38')]=_[_0x64c2('0x35')](_0x56b458['model'],qs[_0x64c2('0x37')](_0x512f75[_0x64c2('0x33')]['fields']));_0x5bdd02[_0x64c2('0x38')]=_0x5bdd02[_0x64c2('0x38')]['length']?_0x5bdd02[_0x64c2('0x38')]:_0x56b458[_0x64c2('0x36')];_0x5bdd02['order']=qs[_0x64c2('0x3b')](_0x512f75[_0x64c2('0x33')][_0x64c2('0x3b')]);_0x5bdd02[_0x64c2('0x3c')]=qs[_0x64c2('0x34')](_[_0x64c2('0x3d')](_0x512f75[_0x64c2('0x33')],_0x56b458['filters']));if(_0x512f75[_0x64c2('0x33')][_0x64c2('0x3e')]){_0x5bdd02['where']=_['merge'](_0x5bdd02['where'],{'$or':_[_0x64c2('0x2f')](_0x5bdd02[_0x64c2('0x38')],function(_0x113612){var _0x54d5df={};_0x54d5df[_0x113612]={'$like':'%'+_0x512f75[_0x64c2('0x33')][_0x64c2('0x3e')]+'%'};return _0x54d5df;})});}_0x5bdd02=_[_0x64c2('0x3f')]({},_0x5bdd02,_0x512f75[_0x64c2('0x40')]);return _0x3591b6[_0x64c2('0x86')](_0x5bdd02);}})['then'](function(_0x3edd19){if(_0x3edd19){_0x54bcce=_0x3edd19[_0x64c2('0x46')];if(!_0x512f75[_0x64c2('0x33')][_0x64c2('0x39')](_0x64c2('0x3a'))){_0x5bdd02[_0x64c2('0x20')]=qs[_0x64c2('0x20')](_0x512f75[_0x64c2('0x33')]['limit']);_0x5bdd02[_0x64c2('0x22')]=qs[_0x64c2('0x22')](_0x512f75['query'][_0x64c2('0x22')]);}return _0x3591b6[_0x64c2('0x86')](_0x5bdd02);}})[_0x64c2('0x28')](function(_0x457c0c){if(_0x457c0c){return _0x457c0c?{'count':_0x54bcce,'rows':_0x457c0c}:null;}})[_0x64c2('0x28')](respondWithResult(_0x55a963,null))[_0x64c2('0x44')](handleError(_0x55a963,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 0f259f4..2e4b915 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 _0xd19c=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x239f45,_0x365217){var _0x34ddad=function(_0x44dcd7){while(--_0x44dcd7){_0x239f45['push'](_0x239f45['shift']());}};_0x34ddad(++_0x365217);}(_0xd19c,0xad));var _0xcd19=function(_0xf22f9a,_0x5a8ae1){_0xf22f9a=_0xf22f9a-0x0;var _0x4ac4f8=_0xd19c[_0xf22f9a];return _0x4ac4f8;};'use strict';var EventEmitter=require(_0xcd19('0x0'));var OpenchannelQueue=require(_0xcd19('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xcd19('0x2')](0x0);var events={'afterCreate':_0xcd19('0x3'),'afterUpdate':_0xcd19('0x4'),'afterDestroy':_0xcd19('0x5')};function emitEvent(_0x275b41){return function(_0x54bc8b,_0x4f1236,_0x5bfa88){OpenchannelQueueEvents[_0xcd19('0x6')](_0x275b41+':'+_0x54bc8b['id'],_0x54bc8b);OpenchannelQueueEvents[_0xcd19('0x6')](_0x275b41,_0x54bc8b);_0x5bfa88(null);};}for(var e in events){if(events[_0xcd19('0x7')](e)){var event=events[e];OpenchannelQueue[_0xcd19('0x8')](e,emitEvent(event));}}module[_0xcd19('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x2905=['emit','hasOwnProperty','exports','events','setMaxListeners','save'];(function(_0x4f2f93,_0x22320b){var _0x5cab22=function(_0x3fd477){while(--_0x3fd477){_0x4f2f93['push'](_0x4f2f93['shift']());}};_0x5cab22(++_0x22320b);}(_0x2905,0x1e9));var _0x5290=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2905[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x5290('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x5290('0x1')](0x0);var events={'afterCreate':_0x5290('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x12289d){return function(_0x4ee657,_0xaacbb0,_0x476623){OpenchannelQueueEvents[_0x5290('0x3')](_0x12289d+':'+_0x4ee657['id'],_0x4ee657);OpenchannelQueueEvents['emit'](_0x12289d,_0x4ee657);_0x476623(null);};}for(var e in events){if(events[_0x5290('0x4')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x5290('0x5')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 521f463..c3c9aed 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 _0x9f99=['moment','path','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f99,0x102));var _0x99f9=function(_0x102fd6,_0x3e77c0){_0x102fd6=_0x102fd6-0x0;var _0x59d05c=_0x9f99[_0x102fd6];return _0x59d05c;};'use strict';var _=require(_0x99f9('0x0'));var util=require('util');var logger=require(_0x99f9('0x1'))(_0x99f9('0x2'));var moment=require(_0x99f9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x99f9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x99f9('0x5'));module[_0x99f9('0x6')]=function(_0x4fbf1f,_0x66a2c7){return _0x4fbf1f[_0x99f9('0x7')]('OpenchannelQueue',attributes,{'tableName':_0x99f9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x286a=['openchannel_queues','lodash','util','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x286a,0xfe));var _0xa286=function(_0x127a22,_0x1be8de){_0x127a22=_0x127a22-0x0;var _0x58335b=_0x286a[_0x127a22];return _0x58335b;};'use strict';var _=require(_0xa286('0x0'));var util=require(_0xa286('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa286('0x2'));var fs=require('fs');var path=require(_0xa286('0x3'));var rimraf=require(_0xa286('0x4'));var config=require(_0xa286('0x5'));var attributes=require(_0xa286('0x6'));module[_0xa286('0x7')]=function(_0x3607dd,_0x3821fe){return _0x3607dd[_0xa286('0x8')](_0xa286('0x9'),attributes,{'tableName':_0xa286('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 6ae7dc8..ac6a884 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 _0x9c1f=['result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','GetOpenchannelQueue','ShowOpenchannelQueue','find','then','lodash','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0x9c1f,0x16e));var _0xf9c1=function(_0x2cab5e,_0x26af90){_0x2cab5e=_0x2cab5e-0x0;var _0x3ed6bc=_0x9c1f[_0x2cab5e];return _0x3ed6bc;};'use strict';var _=require(_0xf9c1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf9c1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf9c1('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9c1('0x3'))(_0xf9c1('0x4'));var config=require(_0xf9c1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf9c1('0x6')][_0xf9c1('0x7')]({'port':0x232a});config[_0xf9c1('0x8')]=_[_0xf9c1('0x9')](config[_0xf9c1('0x8')],{'host':_0xf9c1('0xa'),'port':0x18eb});var socket=require(_0xf9c1('0xb'))(new Redis(config[_0xf9c1('0x8')]));require(_0xf9c1('0xc'))[_0xf9c1('0xd')](socket);function respondWithRpcPromise(_0xbb718c,_0x4287f7,_0x19f196){return new BPromise(function(_0x373bec,_0x421c60){return client[_0xf9c1('0xe')](_0xbb718c,_0x19f196)['then'](function(_0x2d3341){logger['info'](_0xf9c1('0xf'),_0x4287f7,_0xf9c1('0x10'));logger[_0xf9c1('0x11')](_0xf9c1('0x12'),_0x4287f7,'request\x20sent',JSON[_0xf9c1('0x13')](_0x2d3341));if(_0x2d3341['error']){if(_0x2d3341[_0xf9c1('0x14')][_0xf9c1('0x15')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x4287f7,_0x2d3341[_0xf9c1('0x14')][_0xf9c1('0x16')]);return _0x421c60(_0x2d3341[_0xf9c1('0x14')]['message']);}logger[_0xf9c1('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x4287f7,_0x2d3341['error'][_0xf9c1('0x16')]);return _0x373bec(_0x2d3341['error'][_0xf9c1('0x16')]);}else{logger[_0xf9c1('0x17')](_0xf9c1('0xf'),_0x4287f7,'request\x20sent');_0x373bec(_0x2d3341[_0xf9c1('0x18')][_0xf9c1('0x16')]);}})[_0xf9c1('0x19')](function(_0xb09cc2){logger['error'](_0xf9c1('0xf'),_0x4287f7,_0xb09cc2);_0x421c60(_0xb09cc2);});});}exports['GetOpenchannelQueue']=function(_0x3653bd){var _0x520065=this;return new Promise(function(_0x505bb6,_0x52d11b){return db[_0xf9c1('0x1a')][_0xf9c1('0x1b')]({'raw':_0x3653bd[_0xf9c1('0x1c')]?_0x3653bd[_0xf9c1('0x1c')][_0xf9c1('0x1d')]===undefined?!![]:![]:!![],'where':_0x3653bd['options']?_0x3653bd[_0xf9c1('0x1c')][_0xf9c1('0x1e')]||null:null,'attributes':_0x3653bd[_0xf9c1('0x1c')]?_0x3653bd['options'][_0xf9c1('0x1f')]||null:null,'limit':_0x3653bd[_0xf9c1('0x1c')]?_0x3653bd[_0xf9c1('0x1c')]['limit']||null:null,'include':_0x3653bd['options']?_0x3653bd[_0xf9c1('0x1c')][_0xf9c1('0x20')]?_[_0xf9c1('0x21')](_0x3653bd[_0xf9c1('0x1c')][_0xf9c1('0x20')],function(_0x1cfe2e){return{'model':db[_0x1cfe2e[_0xf9c1('0x22')]],'as':_0x1cfe2e['as'],'attributes':_0x1cfe2e[_0xf9c1('0x1f')],'include':_0x1cfe2e[_0xf9c1('0x20')]?_[_0xf9c1('0x21')](_0x1cfe2e[_0xf9c1('0x20')],function(_0x2014f7){return{'model':db[_0x2014f7['model']],'as':_0x2014f7['as'],'attributes':_0x2014f7[_0xf9c1('0x1f')],'include':_0x2014f7['include']?_['map'](_0x2014f7['include'],function(_0x1ba29a){return{'model':db[_0x1ba29a['model']],'as':_0x1ba29a['as'],'attributes':_0x1ba29a[_0xf9c1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5827cb){logger['info'](_0xf9c1('0x23'),_0x3653bd);logger[_0xf9c1('0x11')]('GetOpenchannelQueue',_0x3653bd,JSON[_0xf9c1('0x13')](_0x5827cb));_0x505bb6(_0x5827cb);})[_0xf9c1('0x19')](function(_0x4f5990){logger[_0xf9c1('0x14')]('GetOpenchannelQueue',_0x4f5990[_0xf9c1('0x16')],_0x3653bd);_0x52d11b(_0x520065[_0xf9c1('0x14')](0x1f4,_0x4f5990[_0xf9c1('0x16')]));});});};exports[_0xf9c1('0x24')]=function(_0x3a62c6){var _0x3d823b=this;return new Promise(function(_0x4ceb8d,_0x4da7f8){return db[_0xf9c1('0x1a')][_0xf9c1('0x25')]({'raw':_0x3a62c6[_0xf9c1('0x1c')]?_0x3a62c6[_0xf9c1('0x1c')][_0xf9c1('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a62c6[_0xf9c1('0x1c')]?_0x3a62c6[_0xf9c1('0x1c')][_0xf9c1('0x1e')]||null:null,'attributes':_0x3a62c6['options']?_0x3a62c6[_0xf9c1('0x1c')][_0xf9c1('0x1f')]||null:null,'include':_0x3a62c6[_0xf9c1('0x1c')]?_0x3a62c6[_0xf9c1('0x1c')][_0xf9c1('0x20')]?_[_0xf9c1('0x21')](_0x3a62c6['options'][_0xf9c1('0x20')],function(_0x2f993e){return{'model':db[_0x2f993e['model']],'as':_0x2f993e['as'],'attributes':_0x2f993e[_0xf9c1('0x1f')],'include':_0x2f993e[_0xf9c1('0x20')]?_[_0xf9c1('0x21')](_0x2f993e['include'],function(_0x381c3b){return{'model':db[_0x381c3b[_0xf9c1('0x22')]],'as':_0x381c3b['as'],'attributes':_0x381c3b[_0xf9c1('0x1f')],'include':_0x381c3b[_0xf9c1('0x20')]?_[_0xf9c1('0x21')](_0x381c3b[_0xf9c1('0x20')],function(_0x4d726e){return{'model':db[_0x4d726e[_0xf9c1('0x22')]],'as':_0x4d726e['as'],'attributes':_0x4d726e[_0xf9c1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf9c1('0x26')](function(_0x31760f){logger['info']('ShowOpenchannelQueue',_0x3a62c6);logger[_0xf9c1('0x11')](_0xf9c1('0x24'),_0x3a62c6,JSON[_0xf9c1('0x13')](_0x31760f));_0x4ceb8d(_0x31760f);})['catch'](function(_0x30b189){logger[_0xf9c1('0x14')](_0xf9c1('0x24'),_0x30b189['message'],_0x3a62c6);_0x4da7f8(_0x3d823b[_0xf9c1('0x14')](0x1f4,_0x30b189[_0xf9c1('0x16')]));});});}; \ No newline at end of file +var _0xc3df=['model','debug','stringify','ShowOpenchannelQueue','OpenchannelQueue','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','defaults','redis','socket.io-emitter','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetOpenchannelQueue','findAll','options','raw','attributes','include','map'];(function(_0x3fae35,_0x5a2b36){var _0x1fda09=function(_0x420573){while(--_0x420573){_0x3fae35['push'](_0x3fae35['shift']());}};_0x1fda09(++_0x5a2b36);}(_0xc3df,0x95));var _0xfc3d=function(_0x39e1f0,_0x560848){_0x39e1f0=_0x39e1f0-0x0;var _0x240e82=_0xc3df[_0x39e1f0];return _0x240e82;};'use strict';var _=require(_0xfc3d('0x0'));var util=require(_0xfc3d('0x1'));var moment=require(_0xfc3d('0x2'));var BPromise=require('bluebird');var rs=require(_0xfc3d('0x3'));var fs=require('fs');var Redis=require(_0xfc3d('0x4'));var db=require(_0xfc3d('0x5'))['db'];var utils=require(_0xfc3d('0x6'));var logger=require(_0xfc3d('0x7'))(_0xfc3d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfc3d('0x9')]['http']({'port':0x232a});config['redis']=_[_0xfc3d('0xa')](config[_0xfc3d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xfc3d('0xc'))(new Redis(config[_0xfc3d('0xb')]));require('./openchannelQueue.socket')[_0xfc3d('0xd')](socket);function respondWithRpcPromise(_0xafbf15,_0x3602e1,_0x99fe8){return new BPromise(function(_0x2d0c61,_0x49a333){return client[_0xfc3d('0xe')](_0xafbf15,_0x99fe8)[_0xfc3d('0xf')](function(_0x57cd69){logger[_0xfc3d('0x10')](_0xfc3d('0x11'),_0x3602e1,_0xfc3d('0x12'));logger['debug'](_0xfc3d('0x13'),_0x3602e1,_0xfc3d('0x12'),JSON['stringify'](_0x57cd69));if(_0x57cd69[_0xfc3d('0x14')]){if(_0x57cd69[_0xfc3d('0x14')][_0xfc3d('0x15')]===0x1f4){logger[_0xfc3d('0x14')](_0xfc3d('0x11'),_0x3602e1,_0x57cd69['error'][_0xfc3d('0x16')]);return _0x49a333(_0x57cd69[_0xfc3d('0x14')][_0xfc3d('0x16')]);}logger['error'](_0xfc3d('0x11'),_0x3602e1,_0x57cd69['error'][_0xfc3d('0x16')]);return _0x2d0c61(_0x57cd69[_0xfc3d('0x14')][_0xfc3d('0x16')]);}else{logger[_0xfc3d('0x10')]('OpenchannelQueue,\x20%s,\x20%s',_0x3602e1,_0xfc3d('0x12'));_0x2d0c61(_0x57cd69['result'][_0xfc3d('0x16')]);}})[_0xfc3d('0x17')](function(_0x9611ac){logger[_0xfc3d('0x14')](_0xfc3d('0x11'),_0x3602e1,_0x9611ac);_0x49a333(_0x9611ac);});});}exports[_0xfc3d('0x18')]=function(_0x297c8e){var _0x29a47b=this;return new Promise(function(_0x521c21,_0x2502c5){return db['OpenchannelQueue'][_0xfc3d('0x19')]({'raw':_0x297c8e[_0xfc3d('0x1a')]?_0x297c8e[_0xfc3d('0x1a')][_0xfc3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x297c8e[_0xfc3d('0x1a')]?_0x297c8e['options']['where']||null:null,'attributes':_0x297c8e[_0xfc3d('0x1a')]?_0x297c8e['options'][_0xfc3d('0x1c')]||null:null,'limit':_0x297c8e['options']?_0x297c8e[_0xfc3d('0x1a')]['limit']||null:null,'include':_0x297c8e['options']?_0x297c8e['options'][_0xfc3d('0x1d')]?_[_0xfc3d('0x1e')](_0x297c8e[_0xfc3d('0x1a')][_0xfc3d('0x1d')],function(_0x4b8378){return{'model':db[_0x4b8378['model']],'as':_0x4b8378['as'],'attributes':_0x4b8378['attributes'],'include':_0x4b8378[_0xfc3d('0x1d')]?_[_0xfc3d('0x1e')](_0x4b8378['include'],function(_0x202a93){return{'model':db[_0x202a93['model']],'as':_0x202a93['as'],'attributes':_0x202a93['attributes'],'include':_0x202a93[_0xfc3d('0x1d')]?_[_0xfc3d('0x1e')](_0x202a93[_0xfc3d('0x1d')],function(_0x14c7bb){return{'model':db[_0x14c7bb[_0xfc3d('0x1f')]],'as':_0x14c7bb['as'],'attributes':_0x14c7bb[_0xfc3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfc3d('0xf')](function(_0x1fd228){logger[_0xfc3d('0x10')]('GetOpenchannelQueue',_0x297c8e);logger[_0xfc3d('0x20')](_0xfc3d('0x18'),_0x297c8e,JSON[_0xfc3d('0x21')](_0x1fd228));_0x521c21(_0x1fd228);})[_0xfc3d('0x17')](function(_0x5e2282){logger['error'](_0xfc3d('0x18'),_0x5e2282[_0xfc3d('0x16')],_0x297c8e);_0x2502c5(_0x29a47b[_0xfc3d('0x14')](0x1f4,_0x5e2282[_0xfc3d('0x16')]));});});};exports[_0xfc3d('0x22')]=function(_0x31b629){var _0x234a38=this;return new Promise(function(_0x3f6d00,_0x420067){return db[_0xfc3d('0x23')]['find']({'raw':_0x31b629['options']?_0x31b629[_0xfc3d('0x1a')][_0xfc3d('0x1b')]===undefined?!![]:![]:!![],'where':_0x31b629[_0xfc3d('0x1a')]?_0x31b629[_0xfc3d('0x1a')]['where']||null:null,'attributes':_0x31b629['options']?_0x31b629['options'][_0xfc3d('0x1c')]||null:null,'include':_0x31b629['options']?_0x31b629[_0xfc3d('0x1a')][_0xfc3d('0x1d')]?_['map'](_0x31b629[_0xfc3d('0x1a')][_0xfc3d('0x1d')],function(_0x4d3a3c){return{'model':db[_0x4d3a3c['model']],'as':_0x4d3a3c['as'],'attributes':_0x4d3a3c[_0xfc3d('0x1c')],'include':_0x4d3a3c[_0xfc3d('0x1d')]?_[_0xfc3d('0x1e')](_0x4d3a3c[_0xfc3d('0x1d')],function(_0x4a589b){return{'model':db[_0x4a589b[_0xfc3d('0x1f')]],'as':_0x4a589b['as'],'attributes':_0x4a589b[_0xfc3d('0x1c')],'include':_0x4a589b[_0xfc3d('0x1d')]?_[_0xfc3d('0x1e')](_0x4a589b['include'],function(_0x5dfdcb){return{'model':db[_0x5dfdcb[_0xfc3d('0x1f')]],'as':_0x5dfdcb['as'],'attributes':_0x5dfdcb[_0xfc3d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfc3d('0xf')](function(_0x36ac89){logger[_0xfc3d('0x10')]('ShowOpenchannelQueue',_0x31b629);logger['debug'](_0xfc3d('0x22'),_0x31b629,JSON[_0xfc3d('0x21')](_0x36ac89));_0x3f6d00(_0x36ac89);})[_0xfc3d('0x17')](function(_0x3282fd){logger[_0xfc3d('0x14')](_0xfc3d('0x22'),_0x3282fd[_0xfc3d('0x16')],_0x31b629);_0x420067(_0x234a38['error'](0x1f4,_0x3282fd[_0xfc3d('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index e948830..e4259ac 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 _0x72da=['update','emit','removeListener','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x114582,_0x296fbb){var _0x18b96a=function(_0x4f95e2){while(--_0x4f95e2){_0x114582['push'](_0x114582['shift']());}};_0x18b96a(++_0x296fbb);}(_0x72da,0x14d));var _0xa72d=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x72da[_0x1bb58c];return _0x277586;};'use strict';var OpenchannelQueueEvents=require(_0xa72d('0x0'));var events=[_0xa72d('0x1'),_0xa72d('0x2'),_0xa72d('0x3')];function createListener(_0x36da35,_0x1440f0){return function(_0x219eda){_0x1440f0[_0xa72d('0x4')](_0x36da35,_0x219eda);};}function removeListener(_0x29a885,_0x4b7c37){return function(){OpenchannelQueueEvents[_0xa72d('0x5')](_0x29a885,_0x4b7c37);};}exports['register']=function(_0x24c1a2){for(var _0x2f8d8c=0x0,_0x3a5b95=events[_0xa72d('0x6')];_0x2f8d8c<_0x3a5b95;_0x2f8d8c++){var _0x3bcdcb=events[_0x2f8d8c];var _0x3db818=createListener(_0xa72d('0x7')+_0x3bcdcb,_0x24c1a2);OpenchannelQueueEvents['on'](_0x3bcdcb,_0x3db818);}}; \ No newline at end of file +var _0x9c9c=['save','remove','update','emit','removeListener','openchannelQueue:'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9c9c,0x1ec));var _0xc9c9=function(_0x35741f,_0x1bfb4f){_0x35741f=_0x35741f-0x0;var _0x2cd2b7=_0x9c9c[_0x35741f];return _0x2cd2b7;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xc9c9('0x0'),_0xc9c9('0x1'),_0xc9c9('0x2')];function createListener(_0x18d426,_0x291b8c){return function(_0x222f5b){_0x291b8c[_0xc9c9('0x3')](_0x18d426,_0x222f5b);};}function removeListener(_0x4427ec,_0x5042d4){return function(){OpenchannelQueueEvents[_0xc9c9('0x4')](_0x4427ec,_0x5042d4);};}exports['register']=function(_0x50da91){for(var _0x3de514=0x0,_0x7a86ab=events['length'];_0x3de514<_0x7a86ab;_0x3de514++){var _0x2551c5=events[_0x3de514];var _0xc6d92e=createListener(_0xc9c9('0x5')+_0x2551c5,_0x50da91);OpenchannelQueueEvents['on'](_0x2551c5,_0xc6d92e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index daefbfd..b229464 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 _0x8e50=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','delete','exports','multer'];(function(_0x4aa327,_0x5a1291){var _0x34c83a=function(_0x4ae31e){while(--_0x4ae31e){_0x4aa327['push'](_0x4aa327['shift']());}};_0x34c83a(++_0x5a1291);}(_0x8e50,0x1d3));var _0x08e5=function(_0x20d110,_0x316444){_0x20d110=_0x20d110-0x0;var _0x1b9c9c=_0x8e50[_0x20d110];return _0x1b9c9c;};'use strict';var multer=require(_0x08e5('0x0'));var util=require(_0x08e5('0x1'));var path=require('path');var timeout=require(_0x08e5('0x2'));var express=require(_0x08e5('0x3'));var router=express['Router']();var fs_extra=require(_0x08e5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x08e5('0x5'));var config=require(_0x08e5('0x6'));var controller=require(_0x08e5('0x7'));router[_0x08e5('0x8')]('/',auth['isAuthenticated'](),controller[_0x08e5('0x9')]);router[_0x08e5('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x08e5('0x8')](_0x08e5('0xa'),auth[_0x08e5('0xb')](),controller[_0x08e5('0xc')]);router[_0x08e5('0xd')]('/',auth['isAuthenticated'](),controller[_0x08e5('0xe')]);router[_0x08e5('0xf')](_0x08e5('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x08e5('0x10')](_0x08e5('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x08e5('0x11')]=router; \ No newline at end of file +var _0x2d5a=['show','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x2d5a,0x123));var _0xa2d5=function(_0x1ea489,_0x11db84){_0x1ea489=_0x1ea489-0x0;var _0x4cdb4b=_0x2d5a[_0x1ea489];return _0x4cdb4b;};'use strict';var multer=require(_0xa2d5('0x0'));var util=require(_0xa2d5('0x1'));var path=require(_0xa2d5('0x2'));var timeout=require(_0xa2d5('0x3'));var express=require(_0xa2d5('0x4'));var router=express[_0xa2d5('0x5')]();var fs_extra=require(_0xa2d5('0x6'));var auth=require(_0xa2d5('0x7'));var interaction=require(_0xa2d5('0x8'));var config=require(_0xa2d5('0x9'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0xa2d5('0xa')](),controller['index']);router[_0xa2d5('0xb')](_0xa2d5('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xa2d5('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa2d5('0xd')]);router['post']('/',auth[_0xa2d5('0xa')](),controller[_0xa2d5('0xe')]);router['put'](_0xa2d5('0xf'),auth[_0xa2d5('0xa')](),controller[_0xa2d5('0x10')]);router[_0xa2d5('0x11')]('/:id',auth[_0xa2d5('0xa')](),controller[_0xa2d5('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c19074d..5a9dbee 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 _0xbad8=['moment','sequelize','exports','DATE','STRING'];(function(_0x404cbb,_0x5941ee){var _0xab483d=function(_0x12a2a6){while(--_0x12a2a6){_0x404cbb['push'](_0x404cbb['shift']());}};_0xab483d(++_0x5941ee);}(_0xbad8,0x10e));var _0x8bad=function(_0x1b92a6,_0x14444b){_0x1b92a6=_0x1b92a6-0x0;var _0x24be5b=_0xbad8[_0x1b92a6];return _0x24be5b;};'use strict';var moment=require(_0x8bad('0x0'));var Sequelize=require(_0x8bad('0x1'));module[_0x8bad('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8bad('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8bad('0x3')]},'exitAt':{'type':Sequelize[_0x8bad('0x3')]},'reason':{'type':Sequelize[_0x8bad('0x4')]}}; \ No newline at end of file +var _0x9723=['DATE','STRING','moment','sequelize','exports'];(function(_0x5a6dc5,_0x4a7a46){var _0x2b6dcd=function(_0x207808){while(--_0x207808){_0x5a6dc5['push'](_0x5a6dc5['shift']());}};_0x2b6dcd(++_0x4a7a46);}(_0x9723,0xac));var _0x3972=function(_0x19115e,_0x507bab){_0x19115e=_0x19115e-0x0;var _0x45bbd4=_0x9723[_0x19115e];return _0x45bbd4;};'use strict';var moment=require(_0x3972('0x0'));var Sequelize=require(_0x3972('0x1'));module[_0x3972('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3972('0x3')]},'leaveAt':{'type':Sequelize[_0x3972('0x3')]},'acceptAt':{'type':Sequelize[_0x3972('0x3')]},'exitAt':{'type':Sequelize[_0x3972('0x3')]},'reason':{'type':Sequelize[_0x3972('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 09e0576..6e28091 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 _0x763c=['body','describe','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create'];(function(_0x19847f,_0x95897f){var _0x28a3cc=function(_0x3ea2a5){while(--_0x3ea2a5){_0x19847f['push'](_0x19847f['shift']());}};_0x28a3cc(++_0x95897f);}(_0x763c,0x1d0));var _0xc763=function(_0x4206cd,_0x16efc2){_0x4206cd=_0x4206cd-0x0;var _0xea5a62=_0x763c[_0x4206cd];return _0xea5a62;};'use strict';var emlformat=require(_0xc763('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc763('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc763('0x2'));var moment=require(_0xc763('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc763('0x4'));var util=require(_0xc763('0x5'));var path=require(_0xc763('0x6'));var sox=require(_0xc763('0x7'));var csv=require(_0xc763('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc763('0x9'));var _=require(_0xc763('0xa'));var squel=require(_0xc763('0xb'));var crypto=require(_0xc763('0xc'));var jsforce=require(_0xc763('0xd'));var deskjs=require(_0xc763('0xe'));var toCsv=require(_0xc763('0x8'));var querystring=require('querystring');var Papa=require(_0xc763('0xf'));var Redis=require(_0xc763('0x10'));var authService=require(_0xc763('0x11'));var qs=require(_0xc763('0x12'));var as=require(_0xc763('0x13'));var hardwareService=require(_0xc763('0x14'));var logger=require(_0xc763('0x15'))(_0xc763('0x16'));var utils=require('../../config/utils');var config=require(_0xc763('0x17'));var licenseUtil=require(_0xc763('0x18'));var db=require(_0xc763('0x19'))['db'];function respondWithStatusCode(_0x5380b5,_0x166d16){_0x166d16=_0x166d16||0xcc;return function(_0x5a9ae9){if(_0x5a9ae9){return _0x5380b5[_0xc763('0x1a')](_0x166d16);}return _0x5380b5[_0xc763('0x1b')](_0x166d16)[_0xc763('0x1c')]();};}function respondWithResult(_0x445aba,_0x2946c6){_0x2946c6=_0x2946c6||0xc8;return function(_0x2aa3ab){if(_0x2aa3ab){return _0x445aba[_0xc763('0x1b')](_0x2946c6)[_0xc763('0x1d')](_0x2aa3ab);}};}function respondWithFilteredResult(_0x4e7abf,_0x546629){return function(_0x7e5bd0){if(_0x7e5bd0){var _0x1c636b=typeof _0x546629[_0xc763('0x1e')]===_0xc763('0x1f')&&typeof _0x546629[_0xc763('0x20')]==='undefined';var _0x47749a=_0x7e5bd0[_0xc763('0x21')];var _0x3de7d9=_0x1c636b?0x0:_0x546629[_0xc763('0x1e')];var _0x5c0e44=_0x1c636b?_0x7e5bd0[_0xc763('0x21')]:_0x546629['offset']+_0x546629[_0xc763('0x20')];var _0x7a6bdd;if(_0x5c0e44>=_0x47749a){_0x5c0e44=_0x47749a;_0x7a6bdd=0xc8;}else{_0x7a6bdd=0xce;}_0x4e7abf[_0xc763('0x1b')](_0x7a6bdd);return _0x4e7abf[_0xc763('0x22')](_0xc763('0x23'),_0x3de7d9+'-'+_0x5c0e44+'/'+_0x47749a)[_0xc763('0x1d')](_0x7e5bd0);}return null;};}function patchUpdates(_0x55eedc){return function(_0x104b87){try{jsonpatch[_0xc763('0x24')](_0x104b87,_0x55eedc,!![]);}catch(_0xbe8075){return BPromise['reject'](_0xbe8075);}return _0x104b87[_0xc763('0x25')]();};}function saveUpdates(_0x5cd8c6,_0x85e0f0){return function(_0x5d47ad){if(_0x5d47ad){return _0x5d47ad[_0xc763('0x26')](_0x5cd8c6)[_0xc763('0x27')](function(_0x25e9fe){return _0x25e9fe;});}return null;};}function removeEntity(_0x14c435,_0x5b8d42){return function(_0x28fb76){if(_0x28fb76){return _0x28fb76[_0xc763('0x28')]()[_0xc763('0x27')](function(){_0x14c435[_0xc763('0x1b')](0xcc)[_0xc763('0x1c')]();});}};}function handleEntityNotFound(_0x335a8e,_0xc516f9){return function(_0x36537b){if(!_0x36537b){_0x335a8e[_0xc763('0x1a')](0x194);}return _0x36537b;};}function handleError(_0x5c5550,_0x22bc7c){_0x22bc7c=_0x22bc7c||0x1f4;return function(_0x5cc846){logger[_0xc763('0x29')](_0x5cc846[_0xc763('0x2a')]);if(_0x5cc846[_0xc763('0x2b')]){delete _0x5cc846['name'];}_0x5c5550['status'](_0x22bc7c)[_0xc763('0x2c')](_0x5cc846);};}exports['index']=function(_0x1418cc,_0x5ef19d){var _0xb2cab7={},_0x2682f3={},_0x159707={'count':0x0,'rows':[]};var _0x3f4ef7=_[_0xc763('0x2d')](db[_0xc763('0x2e')][_0xc763('0x2f')],function(_0x131125){return{'name':_0x131125[_0xc763('0x30')],'type':_0x131125['type'][_0xc763('0x31')]};});_0x2682f3[_0xc763('0x32')]=_[_0xc763('0x2d')](_0x3f4ef7,_0xc763('0x2b'));_0x2682f3['query']=_[_0xc763('0x33')](_0x1418cc[_0xc763('0x34')]);_0x2682f3[_0xc763('0x35')]=_['intersection'](_0x2682f3[_0xc763('0x32')],_0x2682f3[_0xc763('0x34')]);_0xb2cab7[_0xc763('0x36')]=_[_0xc763('0x37')](_0x2682f3[_0xc763('0x32')],qs[_0xc763('0x38')](_0x1418cc[_0xc763('0x34')][_0xc763('0x38')]));_0xb2cab7['attributes']=_0xb2cab7['attributes'][_0xc763('0x39')]?_0xb2cab7[_0xc763('0x36')]:_0x2682f3[_0xc763('0x32')];if(!_0x1418cc[_0xc763('0x34')][_0xc763('0x3a')](_0xc763('0x3b'))){_0xb2cab7['limit']=qs[_0xc763('0x20')](_0x1418cc['query'][_0xc763('0x20')]);_0xb2cab7[_0xc763('0x1e')]=qs[_0xc763('0x1e')](_0x1418cc[_0xc763('0x34')][_0xc763('0x1e')]);}_0xb2cab7[_0xc763('0x3c')]=qs['sort'](_0x1418cc['query']['sort']);_0xb2cab7[_0xc763('0x3d')]=qs[_0xc763('0x35')](_[_0xc763('0x3e')](_0x1418cc[_0xc763('0x34')],_0x2682f3[_0xc763('0x35')]),_0x3f4ef7);if(_0x1418cc[_0xc763('0x34')][_0xc763('0x3f')]){_0xb2cab7[_0xc763('0x3d')]=_[_0xc763('0x40')](_0xb2cab7[_0xc763('0x3d')],{'$or':_[_0xc763('0x2d')](_0x3f4ef7,function(_0x223b2c){if(_0x223b2c['type']!==_0xc763('0x41')){var _0x5a3997={};_0x5a3997[_0x223b2c[_0xc763('0x2b')]]={'$like':'%'+_0x1418cc['query'][_0xc763('0x3f')]+'%'};return _0x5a3997;}})});}_0xb2cab7=_['merge']({},_0xb2cab7,_0x1418cc[_0xc763('0x42')]);var _0x195a78={'where':_0xb2cab7['where']};return db[_0xc763('0x2e')][_0xc763('0x21')](_0x195a78)[_0xc763('0x27')](function(_0x332a65){_0x159707[_0xc763('0x21')]=_0x332a65;if(_0x1418cc[_0xc763('0x34')][_0xc763('0x43')]){_0xb2cab7[_0xc763('0x44')]=[{'all':!![]}];}return db[_0xc763('0x2e')][_0xc763('0x45')](_0xb2cab7);})['then'](function(_0x672cc4){_0x159707[_0xc763('0x46')]=_0x672cc4;return _0x159707;})[_0xc763('0x27')](respondWithFilteredResult(_0x5ef19d,_0xb2cab7))['catch'](handleError(_0x5ef19d,null));};exports['show']=function(_0x6ca715,_0x1a4114){var _0x17715d={'raw':!![],'where':{'id':_0x6ca715[_0xc763('0x47')]['id']}},_0x5c7726={};_0x5c7726[_0xc763('0x32')]=_[_0xc763('0x33')](db[_0xc763('0x2e')][_0xc763('0x2f')]);_0x5c7726['query']=_[_0xc763('0x33')](_0x6ca715[_0xc763('0x34')]);_0x5c7726['filters']=_[_0xc763('0x37')](_0x5c7726[_0xc763('0x32')],_0x5c7726[_0xc763('0x34')]);_0x17715d[_0xc763('0x36')]=_['intersection'](_0x5c7726[_0xc763('0x32')],qs[_0xc763('0x38')](_0x6ca715[_0xc763('0x34')][_0xc763('0x38')]));_0x17715d[_0xc763('0x36')]=_0x17715d[_0xc763('0x36')]['length']?_0x17715d[_0xc763('0x36')]:_0x5c7726[_0xc763('0x32')];if(_0x6ca715[_0xc763('0x34')][_0xc763('0x43')]){_0x17715d[_0xc763('0x44')]=[{'all':!![]}];}_0x17715d=_[_0xc763('0x40')]({},_0x17715d,_0x6ca715[_0xc763('0x42')]);return db[_0xc763('0x2e')][_0xc763('0x48')](_0x17715d)['then'](handleEntityNotFound(_0x1a4114,null))['then'](respondWithResult(_0x1a4114,null))[_0xc763('0x49')](handleError(_0x1a4114,null));};exports[_0xc763('0x4a')]=function(_0x4501fd,_0x4faf3a){return db[_0xc763('0x2e')][_0xc763('0x4a')](_0x4501fd[_0xc763('0x4b')],{})[_0xc763('0x27')](respondWithResult(_0x4faf3a,0xc9))[_0xc763('0x49')](handleError(_0x4faf3a,null));};exports['update']=function(_0x6d35,_0x3fa847){if(_0x6d35['body']['id']){delete _0x6d35['body']['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x6d35['params']['id']}})['then'](handleEntityNotFound(_0x3fa847,null))[_0xc763('0x27')](saveUpdates(_0x6d35[_0xc763('0x4b')],null))[_0xc763('0x27')](respondWithResult(_0x3fa847,null))[_0xc763('0x49')](handleError(_0x3fa847,null));};exports['destroy']=function(_0x1a1474,_0x4a36e0){return db[_0xc763('0x2e')][_0xc763('0x48')]({'where':{'id':_0x1a1474['params']['id']}})[_0xc763('0x27')](handleEntityNotFound(_0x4a36e0,null))['then'](removeEntity(_0x4a36e0,null))[_0xc763('0x49')](handleError(_0x4a36e0,null));};exports[_0xc763('0x4c')]=function(_0x3f4dbb,_0x507c7f){return db[_0xc763('0x2e')][_0xc763('0x4c')]()[_0xc763('0x27')](respondWithResult(_0x507c7f,null))[_0xc763('0x49')](handleError(_0x507c7f,null));}; \ No newline at end of file +var _0xf568=['body','describe','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','params','length','find','catch','create'];(function(_0x1bdc52,_0x4876a9){var _0xdf3fa3=function(_0x2a3ba4){while(--_0x2a3ba4){_0x1bdc52['push'](_0x1bdc52['shift']());}};_0xdf3fa3(++_0x4876a9);}(_0xf568,0x122));var _0x8f56=function(_0x1e38fc,_0x3abb47){_0x1e38fc=_0x1e38fc-0x0;var _0x2e2aab=_0xf568[_0x1e38fc];return _0x2e2aab;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8f56('0x0'));var jsonpatch=require(_0x8f56('0x1'));var rp=require('request-promise');var moment=require(_0x8f56('0x2'));var BPromise=require(_0x8f56('0x3'));var Mustache=require(_0x8f56('0x4'));var util=require(_0x8f56('0x5'));var path=require(_0x8f56('0x6'));var sox=require(_0x8f56('0x7'));var csv=require('to-csv');var ejs=require(_0x8f56('0x8'));var fs=require('fs');var fs_extra=require(_0x8f56('0x9'));var _=require(_0x8f56('0xa'));var squel=require(_0x8f56('0xb'));var crypto=require('crypto');var jsforce=require(_0x8f56('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8f56('0xd'));var querystring=require(_0x8f56('0xe'));var Papa=require(_0x8f56('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8f56('0x10'));var hardwareService=require(_0x8f56('0x11'));var logger=require('../../config/logger')(_0x8f56('0x12'));var utils=require(_0x8f56('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8f56('0x14'));var db=require(_0x8f56('0x15'))['db'];function respondWithStatusCode(_0x3ac878,_0x54c817){_0x54c817=_0x54c817||0xcc;return function(_0x4a3efe){if(_0x4a3efe){return _0x3ac878[_0x8f56('0x16')](_0x54c817);}return _0x3ac878[_0x8f56('0x17')](_0x54c817)[_0x8f56('0x18')]();};}function respondWithResult(_0x87c97,_0x567ff2){_0x567ff2=_0x567ff2||0xc8;return function(_0x4717b6){if(_0x4717b6){return _0x87c97[_0x8f56('0x17')](_0x567ff2)[_0x8f56('0x19')](_0x4717b6);}};}function respondWithFilteredResult(_0x3c0ec1,_0x272007){return function(_0x137e7f){if(_0x137e7f){var _0x3c95a4=typeof _0x272007[_0x8f56('0x1a')]===_0x8f56('0x1b')&&typeof _0x272007[_0x8f56('0x1c')]===_0x8f56('0x1b');var _0x1659bc=_0x137e7f[_0x8f56('0x1d')];var _0x424c76=_0x3c95a4?0x0:_0x272007['offset'];var _0x3ba680=_0x3c95a4?_0x137e7f[_0x8f56('0x1d')]:_0x272007['offset']+_0x272007['limit'];var _0x5a773a;if(_0x3ba680>=_0x1659bc){_0x3ba680=_0x1659bc;_0x5a773a=0xc8;}else{_0x5a773a=0xce;}_0x3c0ec1[_0x8f56('0x17')](_0x5a773a);return _0x3c0ec1[_0x8f56('0x1e')](_0x8f56('0x1f'),_0x424c76+'-'+_0x3ba680+'/'+_0x1659bc)[_0x8f56('0x19')](_0x137e7f);}return null;};}function patchUpdates(_0x2ab650){return function(_0x1d9c2b){try{jsonpatch['apply'](_0x1d9c2b,_0x2ab650,!![]);}catch(_0x46ecc1){return BPromise[_0x8f56('0x20')](_0x46ecc1);}return _0x1d9c2b[_0x8f56('0x21')]();};}function saveUpdates(_0x8352ee,_0x4802e7){return function(_0x160978){if(_0x160978){return _0x160978[_0x8f56('0x22')](_0x8352ee)[_0x8f56('0x23')](function(_0x5db169){return _0x5db169;});}return null;};}function removeEntity(_0x22b3f0,_0x530bd9){return function(_0x1ebf76){if(_0x1ebf76){return _0x1ebf76[_0x8f56('0x24')]()[_0x8f56('0x23')](function(){_0x22b3f0[_0x8f56('0x17')](0xcc)[_0x8f56('0x18')]();});}};}function handleEntityNotFound(_0x3e32ea,_0x2a9ab2){return function(_0x44ef29){if(!_0x44ef29){_0x3e32ea[_0x8f56('0x16')](0x194);}return _0x44ef29;};}function handleError(_0x1dd162,_0x403370){_0x403370=_0x403370||0x1f4;return function(_0x135b6d){logger[_0x8f56('0x25')](_0x135b6d[_0x8f56('0x26')]);if(_0x135b6d[_0x8f56('0x27')]){delete _0x135b6d['name'];}_0x1dd162['status'](_0x403370)[_0x8f56('0x28')](_0x135b6d);};}exports['index']=function(_0x3194a3,_0x5ae0d6){var _0x398e01={},_0x34945f={},_0x180df5={'count':0x0,'rows':[]};var _0x5d4854=_[_0x8f56('0x29')](db[_0x8f56('0x2a')][_0x8f56('0x2b')],function(_0x15e4cf){return{'name':_0x15e4cf[_0x8f56('0x2c')],'type':_0x15e4cf[_0x8f56('0x2d')][_0x8f56('0x2e')]};});_0x34945f[_0x8f56('0x2f')]=_[_0x8f56('0x29')](_0x5d4854,_0x8f56('0x27'));_0x34945f[_0x8f56('0x30')]=_[_0x8f56('0x31')](_0x3194a3['query']);_0x34945f['filters']=_['intersection'](_0x34945f[_0x8f56('0x2f')],_0x34945f[_0x8f56('0x30')]);_0x398e01[_0x8f56('0x32')]=_[_0x8f56('0x33')](_0x34945f[_0x8f56('0x2f')],qs[_0x8f56('0x34')](_0x3194a3[_0x8f56('0x30')][_0x8f56('0x34')]));_0x398e01[_0x8f56('0x32')]=_0x398e01[_0x8f56('0x32')]['length']?_0x398e01[_0x8f56('0x32')]:_0x34945f[_0x8f56('0x2f')];if(!_0x3194a3['query'][_0x8f56('0x35')](_0x8f56('0x36'))){_0x398e01['limit']=qs[_0x8f56('0x1c')](_0x3194a3[_0x8f56('0x30')][_0x8f56('0x1c')]);_0x398e01[_0x8f56('0x1a')]=qs[_0x8f56('0x1a')](_0x3194a3['query'][_0x8f56('0x1a')]);}_0x398e01[_0x8f56('0x37')]=qs['sort'](_0x3194a3[_0x8f56('0x30')][_0x8f56('0x38')]);_0x398e01[_0x8f56('0x39')]=qs[_0x8f56('0x3a')](_[_0x8f56('0x3b')](_0x3194a3['query'],_0x34945f[_0x8f56('0x3a')]),_0x5d4854);if(_0x3194a3[_0x8f56('0x30')][_0x8f56('0x3c')]){_0x398e01[_0x8f56('0x39')]=_[_0x8f56('0x3d')](_0x398e01[_0x8f56('0x39')],{'$or':_['map'](_0x5d4854,function(_0x429766){if(_0x429766[_0x8f56('0x2d')]!==_0x8f56('0x3e')){var _0x2b4d6={};_0x2b4d6[_0x429766['name']]={'$like':'%'+_0x3194a3[_0x8f56('0x30')][_0x8f56('0x3c')]+'%'};return _0x2b4d6;}})});}_0x398e01=_[_0x8f56('0x3d')]({},_0x398e01,_0x3194a3[_0x8f56('0x3f')]);var _0x17f2bf={'where':_0x398e01['where']};return db[_0x8f56('0x2a')][_0x8f56('0x1d')](_0x17f2bf)[_0x8f56('0x23')](function(_0xfd9431){_0x180df5['count']=_0xfd9431;if(_0x3194a3[_0x8f56('0x30')]['includeAll']){_0x398e01[_0x8f56('0x40')]=[{'all':!![]}];}return db[_0x8f56('0x2a')]['findAll'](_0x398e01);})[_0x8f56('0x23')](function(_0x48d209){_0x180df5['rows']=_0x48d209;return _0x180df5;})[_0x8f56('0x23')](respondWithFilteredResult(_0x5ae0d6,_0x398e01))['catch'](handleError(_0x5ae0d6,null));};exports['show']=function(_0x54983a,_0x1e8238){var _0x48baa8={'raw':!![],'where':{'id':_0x54983a[_0x8f56('0x41')]['id']}},_0x31b9bf={};_0x31b9bf['model']=_['keys'](db[_0x8f56('0x2a')][_0x8f56('0x2b')]);_0x31b9bf['query']=_[_0x8f56('0x31')](_0x54983a[_0x8f56('0x30')]);_0x31b9bf['filters']=_[_0x8f56('0x33')](_0x31b9bf[_0x8f56('0x2f')],_0x31b9bf[_0x8f56('0x30')]);_0x48baa8[_0x8f56('0x32')]=_['intersection'](_0x31b9bf[_0x8f56('0x2f')],qs[_0x8f56('0x34')](_0x54983a['query'][_0x8f56('0x34')]));_0x48baa8[_0x8f56('0x32')]=_0x48baa8[_0x8f56('0x32')][_0x8f56('0x42')]?_0x48baa8['attributes']:_0x31b9bf['model'];if(_0x54983a['query']['includeAll']){_0x48baa8[_0x8f56('0x40')]=[{'all':!![]}];}_0x48baa8=_[_0x8f56('0x3d')]({},_0x48baa8,_0x54983a[_0x8f56('0x3f')]);return db[_0x8f56('0x2a')][_0x8f56('0x43')](_0x48baa8)[_0x8f56('0x23')](handleEntityNotFound(_0x1e8238,null))[_0x8f56('0x23')](respondWithResult(_0x1e8238,null))[_0x8f56('0x44')](handleError(_0x1e8238,null));};exports[_0x8f56('0x45')]=function(_0x566845,_0xeda589){return db[_0x8f56('0x2a')][_0x8f56('0x45')](_0x566845[_0x8f56('0x46')],{})[_0x8f56('0x23')](respondWithResult(_0xeda589,0xc9))[_0x8f56('0x44')](handleError(_0xeda589,null));};exports['update']=function(_0x4de287,_0x5e25aa){if(_0x4de287[_0x8f56('0x46')]['id']){delete _0x4de287['body']['id'];}return db['OpenchannelQueueReport'][_0x8f56('0x43')]({'where':{'id':_0x4de287[_0x8f56('0x41')]['id']}})[_0x8f56('0x23')](handleEntityNotFound(_0x5e25aa,null))[_0x8f56('0x23')](saveUpdates(_0x4de287['body'],null))['then'](respondWithResult(_0x5e25aa,null))[_0x8f56('0x44')](handleError(_0x5e25aa,null));};exports['destroy']=function(_0x365873,_0x531851){return db[_0x8f56('0x2a')][_0x8f56('0x43')]({'where':{'id':_0x365873['params']['id']}})['then'](handleEntityNotFound(_0x531851,null))[_0x8f56('0x23')](removeEntity(_0x531851,null))[_0x8f56('0x44')](handleError(_0x531851,null));};exports[_0x8f56('0x47')]=function(_0x2bdbf7,_0x236dc2){return db[_0x8f56('0x2a')][_0x8f56('0x47')]()['then'](respondWithResult(_0x236dc2,null))[_0x8f56('0x44')](handleError(_0x236dc2,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 4b8d221..e35defe 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x2babd5,_0x6316c){var _0x11b6a5=function(_0x133859){while(--_0x133859){_0x2babd5['push'](_0x2babd5['shift']());}};_0x11b6a5(++_0x6316c);}(_0x7a54,0x106));var _0x47a5=function(_0x52d542,_0x1ec619){_0x52d542=_0x52d542-0x0;var _0x545a08=_0x7a54[_0x52d542];return _0x545a08;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x49aef2,_0x1417db){var _0x5bbe18=function(_0x130eb2){while(--_0x130eb2){_0x49aef2['push'](_0x49aef2['shift']());}};_0x5bbe18(++_0x1417db);}(_0x7a54,0x106));var _0x47a5=function(_0x5a529d,_0x541b0a){_0x5a529d=_0x5a529d-0x0;var _0x32b9dd=_0x7a54[_0x5a529d];return _0x32b9dd;};'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 6cc8f37..8627cb9 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 _0x4f7b=['where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','raw','CreateOpenchannelQueueReport','debug','UpdateOpenchannelQueueReport','update','options'];(function(_0x510826,_0x1f0f82){var _0x294167=function(_0x5536d9){while(--_0x5536d9){_0x510826['push'](_0x510826['shift']());}};_0x294167(++_0x1f0f82);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x19b56a,_0x2d275b){_0x19b56a=_0x19b56a-0x0;var _0x447e7=_0x4f7b[_0x19b56a];return _0x447e7;};'use strict';var _=require(_0xb4f7('0x0'));var util=require(_0xb4f7('0x1'));var moment=require(_0xb4f7('0x2'));var BPromise=require(_0xb4f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb4f7('0x4'));var db=require(_0xb4f7('0x5'))['db'];var utils=require(_0xb4f7('0x6'));var logger=require(_0xb4f7('0x7'))(_0xb4f7('0x8'));var config=require(_0xb4f7('0x9'));var jayson=require(_0xb4f7('0xa'));var client=jayson[_0xb4f7('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27872e,_0x5e7b94,_0x179391){return new BPromise(function(_0xf56d08,_0x2849ed){return client['request'](_0x27872e,_0x179391)[_0xb4f7('0xc')](function(_0x5af41f){logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));logger['debug'](_0xb4f7('0x10'),_0x5e7b94,_0xb4f7('0xf'),JSON[_0xb4f7('0x11')](_0x5af41f));if(_0x5af41f[_0xb4f7('0x12')]){if(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x13')]===0x1f4){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f['error'][_0xb4f7('0x14')]);return _0x2849ed(_0x5af41f[_0xb4f7('0x12')][_0xb4f7('0x14')]);}logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0x5af41f[_0xb4f7('0x12')]['message']);return _0xf56d08(_0x5af41f[_0xb4f7('0x12')]['message']);}else{logger[_0xb4f7('0xd')](_0xb4f7('0xe'),_0x5e7b94,_0xb4f7('0xf'));_0xf56d08(_0x5af41f[_0xb4f7('0x15')][_0xb4f7('0x14')]);}})[_0xb4f7('0x16')](function(_0xbc599a){logger[_0xb4f7('0x12')](_0xb4f7('0xe'),_0x5e7b94,_0xbc599a);_0x2849ed(_0xbc599a);});});}exports['CreateOpenchannelQueueReport']=function(_0x53b135){var _0x3a78b7=this;return new Promise(function(_0x22e273,_0x4b93fc){return db[_0xb4f7('0x17')][_0xb4f7('0x18')](_0x53b135[_0xb4f7('0x19')],{'raw':_0x53b135['options']?_0x53b135['options'][_0xb4f7('0x1a')]===undefined?!![]:![]:!![]})[_0xb4f7('0xc')](function(_0x5cc40e){logger[_0xb4f7('0xd')](_0xb4f7('0x1b'),_0x53b135);logger[_0xb4f7('0x1c')](_0xb4f7('0x1b'),_0x53b135,JSON['stringify'](_0x5cc40e));_0x22e273(_0x5cc40e);})[_0xb4f7('0x16')](function(_0x56bac5){logger[_0xb4f7('0x12')](_0xb4f7('0x1b'),_0x56bac5[_0xb4f7('0x14')],_0x53b135);_0x4b93fc(_0x3a78b7[_0xb4f7('0x12')](0x1f4,_0x56bac5[_0xb4f7('0x14')]));});});};exports[_0xb4f7('0x1d')]=function(_0x493d81){var _0x1fe0cf=this;return new Promise(function(_0x291166,_0x19e549){return db[_0xb4f7('0x17')][_0xb4f7('0x1e')](_0x493d81[_0xb4f7('0x19')],{'raw':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x493d81[_0xb4f7('0x1f')]?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x20')]||null:null,'attributes':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x21')]||null:null,'limit':_0x493d81['options']?_0x493d81[_0xb4f7('0x1f')][_0xb4f7('0x22')]||null:null})[_0xb4f7('0xc')](function(_0x35582a){logger['info'](_0xb4f7('0x1d'),_0x493d81);logger[_0xb4f7('0x1c')](_0xb4f7('0x1d'),_0x493d81,JSON[_0xb4f7('0x11')](_0x35582a));_0x291166(_0x35582a);})['catch'](function(_0x4ea802){logger[_0xb4f7('0x12')]('UpdateOpenchannelQueueReport',_0x4ea802[_0xb4f7('0x14')],_0x493d81);_0x19e549(_0x1fe0cf[_0xb4f7('0x12')](0x1f4,_0x4ea802['message']));});});}; \ No newline at end of file +var _0xeb3b=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','raw','debug','stringify','UpdateOpenchannelQueueReport','update','options','where','attributes','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0xeb3b[_0x3f6b1b];return _0x4a3d2b;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var moment=require(_0xbeb3('0x2'));var BPromise=require(_0xbeb3('0x3'));var rs=require(_0xbeb3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbeb3('0x5'));var logger=require('../../config/logger')(_0xbeb3('0x6'));var config=require('../../config/environment');var jayson=require(_0xbeb3('0x7'));var client=jayson[_0xbeb3('0x8')][_0xbeb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x294cc9,_0x406927,_0x143255){return new BPromise(function(_0x5a6a06,_0x241dbb){return client[_0xbeb3('0xa')](_0x294cc9,_0x143255)[_0xbeb3('0xb')](function(_0x3b61ac){logger[_0xbeb3('0xc')](_0xbeb3('0xd'),_0x406927,_0xbeb3('0xe'));logger['debug'](_0xbeb3('0xf'),_0x406927,_0xbeb3('0xe'),JSON['stringify'](_0x3b61ac));if(_0x3b61ac[_0xbeb3('0x10')]){if(_0x3b61ac[_0xbeb3('0x10')][_0xbeb3('0x11')]===0x1f4){logger[_0xbeb3('0x10')](_0xbeb3('0xd'),_0x406927,_0x3b61ac[_0xbeb3('0x10')]['message']);return _0x241dbb(_0x3b61ac['error'][_0xbeb3('0x12')]);}logger[_0xbeb3('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x406927,_0x3b61ac['error'][_0xbeb3('0x12')]);return _0x5a6a06(_0x3b61ac[_0xbeb3('0x10')][_0xbeb3('0x12')]);}else{logger[_0xbeb3('0xc')](_0xbeb3('0xd'),_0x406927,'request\x20sent');_0x5a6a06(_0x3b61ac[_0xbeb3('0x13')]['message']);}})[_0xbeb3('0x14')](function(_0x4e7d99){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x406927,_0x4e7d99);_0x241dbb(_0x4e7d99);});});}exports[_0xbeb3('0x15')]=function(_0x44a4bb){var _0x32275b=this;return new Promise(function(_0x10b15d,_0x5d0689){return db[_0xbeb3('0x16')][_0xbeb3('0x17')](_0x44a4bb[_0xbeb3('0x18')],{'raw':_0x44a4bb['options']?_0x44a4bb['options'][_0xbeb3('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1d917b){logger['info']('CreateOpenchannelQueueReport',_0x44a4bb);logger[_0xbeb3('0x1a')](_0xbeb3('0x15'),_0x44a4bb,JSON[_0xbeb3('0x1b')](_0x1d917b));_0x10b15d(_0x1d917b);})['catch'](function(_0x301899){logger[_0xbeb3('0x10')]('CreateOpenchannelQueueReport',_0x301899[_0xbeb3('0x12')],_0x44a4bb);_0x5d0689(_0x32275b[_0xbeb3('0x10')](0x1f4,_0x301899['message']));});});};exports[_0xbeb3('0x1c')]=function(_0x278fe4){var _0x16b079=this;return new Promise(function(_0x42c6c3,_0x2bc188){return db[_0xbeb3('0x16')][_0xbeb3('0x1d')](_0x278fe4[_0xbeb3('0x18')],{'raw':_0x278fe4[_0xbeb3('0x1e')]?_0x278fe4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x278fe4[_0xbeb3('0x1e')]?_0x278fe4['options'][_0xbeb3('0x1f')]||null:null,'attributes':_0x278fe4[_0xbeb3('0x1e')]?_0x278fe4[_0xbeb3('0x1e')][_0xbeb3('0x20')]||null:null,'limit':_0x278fe4['options']?_0x278fe4[_0xbeb3('0x1e')]['limit']||null:null})[_0xbeb3('0xb')](function(_0xab301c){logger['info']('UpdateOpenchannelQueueReport',_0x278fe4);logger[_0xbeb3('0x1a')]('UpdateOpenchannelQueueReport',_0x278fe4,JSON['stringify'](_0xab301c));_0x42c6c3(_0xab301c);})['catch'](function(_0x5bfef7){logger[_0xbeb3('0x10')]('UpdateOpenchannelQueueReport',_0x5bfef7[_0xbeb3('0x12')],_0x278fe4);_0x2bc188(_0x16b079[_0xbeb3('0x10')](0x1f4,_0x5bfef7[_0xbeb3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 9546584..62800fa 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 _0x8e21=['index','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e21,0x73));var _0x18e2=function(_0x483102,_0x54e93d){_0x483102=_0x483102-0x0;var _0x5cc885=_0x8e21[_0x483102];return _0x5cc885;};'use strict';var multer=require(_0x18e2('0x0'));var util=require(_0x18e2('0x1'));var path=require('path');var timeout=require(_0x18e2('0x2'));var express=require(_0x18e2('0x3'));var router=express[_0x18e2('0x4')]();var fs_extra=require(_0x18e2('0x5'));var auth=require(_0x18e2('0x6'));var interaction=require(_0x18e2('0x7'));var config=require('../../config/environment');var controller=require(_0x18e2('0x8'));router[_0x18e2('0x9')]('/',auth[_0x18e2('0xa')](),controller[_0x18e2('0xb')]);router[_0x18e2('0x9')](_0x18e2('0xc'),auth[_0x18e2('0xa')](),controller['describe']);router[_0x18e2('0x9')](_0x18e2('0xd'),auth[_0x18e2('0xa')](),controller[_0x18e2('0xe')]);router[_0x18e2('0xf')]('/',auth[_0x18e2('0xa')](),controller[_0x18e2('0x10')]);router[_0x18e2('0x11')]('/:id',auth[_0x18e2('0xa')](),controller['update']);router[_0x18e2('0x12')](_0x18e2('0xd'),auth[_0x18e2('0xa')](),controller[_0x18e2('0x13')]);module[_0x18e2('0x14')]=router; \ No newline at end of file +var _0xbd83=['post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x91d048,_0x1f5811){var _0x1ed14f=function(_0x4eab7d){while(--_0x4eab7d){_0x91d048['push'](_0x91d048['shift']());}};_0x1ed14f(++_0x1f5811);}(_0xbd83,0x1be));var _0x3bd8=function(_0x208d75,_0x92d742){_0x208d75=_0x208d75-0x0;var _0x382d27=_0xbd83[_0x208d75];return _0x382d27;};'use strict';var multer=require(_0x3bd8('0x0'));var util=require(_0x3bd8('0x1'));var path=require('path');var timeout=require(_0x3bd8('0x2'));var express=require(_0x3bd8('0x3'));var router=express['Router']();var fs_extra=require(_0x3bd8('0x4'));var auth=require(_0x3bd8('0x5'));var interaction=require(_0x3bd8('0x6'));var config=require('../../config/environment');var controller=require(_0x3bd8('0x7'));router[_0x3bd8('0x8')]('/',auth[_0x3bd8('0x9')](),controller[_0x3bd8('0xa')]);router[_0x3bd8('0x8')](_0x3bd8('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x3bd8('0x8')](_0x3bd8('0xc'),auth[_0x3bd8('0x9')](),controller[_0x3bd8('0xd')]);router[_0x3bd8('0xe')]('/',auth[_0x3bd8('0x9')](),controller[_0x3bd8('0xf')]);router['put'](_0x3bd8('0xc'),auth[_0x3bd8('0x9')](),controller[_0x3bd8('0x10')]);router[_0x3bd8('0x11')]('/:id',auth[_0x3bd8('0x9')](),controller[_0x3bd8('0x12')]);module[_0x3bd8('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 1ee4aee..71cf70e 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x13cab0,_0x14d825){var _0x38804f=function(_0x1bffaf){while(--_0x1bffaf){_0x13cab0['push'](_0x13cab0['shift']());}};_0x38804f(++_0x14d825);}(_0x9bde,0xe1));var _0xe9bd=function(_0x57aafb,_0x45d154){_0x57aafb=_0x57aafb-0x0;var _0x4756bd=_0x9bde[_0x57aafb];return _0x4756bd;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x57eb2d,_0x5e4918){var _0xd8e18=function(_0x189389){while(--_0x189389){_0x57eb2d['push'](_0x57eb2d['shift']());}};_0xd8e18(++_0x5e4918);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 2fc08c4..a7c1780 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 _0xffb6=['limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','error','name','index','OpenchannelTransferReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','then','include','findAll','catch','show','params','keys','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../mysqldb','sendStatus','status','json','undefined'];(function(_0x559a80,_0x3d193d){var _0x42f555=function(_0x24e596){while(--_0x24e596){_0x559a80['push'](_0x559a80['shift']());}};_0x42f555(++_0x3d193d);}(_0xffb6,0xc8));var _0x6ffb=function(_0xfc8404,_0x152d6f){_0xfc8404=_0xfc8404-0x0;var _0x271cac=_0xffb6[_0xfc8404];return _0x271cac;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ffb('0x0'));var jsonpatch=require(_0x6ffb('0x1'));var rp=require(_0x6ffb('0x2'));var moment=require(_0x6ffb('0x3'));var BPromise=require(_0x6ffb('0x4'));var Mustache=require(_0x6ffb('0x5'));var util=require(_0x6ffb('0x6'));var path=require('path');var sox=require(_0x6ffb('0x7'));var csv=require(_0x6ffb('0x8'));var ejs=require(_0x6ffb('0x9'));var fs=require('fs');var fs_extra=require(_0x6ffb('0xa'));var _=require(_0x6ffb('0xb'));var squel=require(_0x6ffb('0xc'));var crypto=require(_0x6ffb('0xd'));var jsforce=require(_0x6ffb('0xe'));var deskjs=require(_0x6ffb('0xf'));var toCsv=require(_0x6ffb('0x8'));var querystring=require('querystring');var Papa=require(_0x6ffb('0x10'));var Redis=require(_0x6ffb('0x11'));var authService=require(_0x6ffb('0x12'));var qs=require(_0x6ffb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ffb('0x14'))('api');var utils=require(_0x6ffb('0x15'));var config=require(_0x6ffb('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ffb('0x17'))['db'];function respondWithStatusCode(_0x539055,_0x3a9982){_0x3a9982=_0x3a9982||0xcc;return function(_0x3a0157){if(_0x3a0157){return _0x539055[_0x6ffb('0x18')](_0x3a9982);}return _0x539055[_0x6ffb('0x19')](_0x3a9982)['end']();};}function respondWithResult(_0x110ee8,_0x3fc8d5){_0x3fc8d5=_0x3fc8d5||0xc8;return function(_0x1b925a){if(_0x1b925a){return _0x110ee8[_0x6ffb('0x19')](_0x3fc8d5)[_0x6ffb('0x1a')](_0x1b925a);}};}function respondWithFilteredResult(_0x343eba,_0x3e28da){return function(_0x4aa26c){if(_0x4aa26c){var _0x3f21ad=typeof _0x3e28da['offset']===_0x6ffb('0x1b')&&typeof _0x3e28da[_0x6ffb('0x1c')]===_0x6ffb('0x1b');var _0x13a811=_0x4aa26c[_0x6ffb('0x1d')];var _0x4ecaf3=_0x3f21ad?0x0:_0x3e28da['offset'];var _0x155849=_0x3f21ad?_0x4aa26c[_0x6ffb('0x1d')]:_0x3e28da[_0x6ffb('0x1e')]+_0x3e28da[_0x6ffb('0x1c')];var _0x566b14;if(_0x155849>=_0x13a811){_0x155849=_0x13a811;_0x566b14=0xc8;}else{_0x566b14=0xce;}_0x343eba['status'](_0x566b14);return _0x343eba[_0x6ffb('0x1f')](_0x6ffb('0x20'),_0x4ecaf3+'-'+_0x155849+'/'+_0x13a811)['json'](_0x4aa26c);}return null;};}function patchUpdates(_0x17ce88){return function(_0x55630b){try{jsonpatch[_0x6ffb('0x21')](_0x55630b,_0x17ce88,!![]);}catch(_0x37353d){return BPromise[_0x6ffb('0x22')](_0x37353d);}return _0x55630b[_0x6ffb('0x23')]();};}function saveUpdates(_0x14f740,_0x56119e){return function(_0x2ed7d7){if(_0x2ed7d7){return _0x2ed7d7[_0x6ffb('0x24')](_0x14f740)['then'](function(_0x3f5758){return _0x3f5758;});}return null;};}function removeEntity(_0x438a7e,_0x234249){return function(_0x5bd759){if(_0x5bd759){return _0x5bd759[_0x6ffb('0x25')]()['then'](function(){_0x438a7e[_0x6ffb('0x19')](0xcc)[_0x6ffb('0x26')]();});}};}function handleEntityNotFound(_0x105d0d,_0x51fbd1){return function(_0x203eaf){if(!_0x203eaf){_0x105d0d[_0x6ffb('0x18')](0x194);}return _0x203eaf;};}function handleError(_0x31c450,_0x57663c){_0x57663c=_0x57663c||0x1f4;return function(_0x49372a){logger[_0x6ffb('0x27')](_0x49372a['stack']);if(_0x49372a[_0x6ffb('0x28')]){delete _0x49372a['name'];}_0x31c450[_0x6ffb('0x19')](_0x57663c)['send'](_0x49372a);};}exports[_0x6ffb('0x29')]=function(_0x2478a2,_0x3ed1f4){var _0x9197af={},_0x37774c={},_0x2d4eb0={'count':0x0,'rows':[]};var _0x11ef36=_['map'](db[_0x6ffb('0x2a')][_0x6ffb('0x2b')],function(_0xc0db50){return{'name':_0xc0db50[_0x6ffb('0x2c')],'type':_0xc0db50['type'][_0x6ffb('0x2d')]};});_0x37774c[_0x6ffb('0x2e')]=_[_0x6ffb('0x2f')](_0x11ef36,_0x6ffb('0x28'));_0x37774c['query']=_['keys'](_0x2478a2[_0x6ffb('0x30')]);_0x37774c[_0x6ffb('0x31')]=_[_0x6ffb('0x32')](_0x37774c[_0x6ffb('0x2e')],_0x37774c[_0x6ffb('0x30')]);_0x9197af['attributes']=_[_0x6ffb('0x32')](_0x37774c[_0x6ffb('0x2e')],qs[_0x6ffb('0x33')](_0x2478a2[_0x6ffb('0x30')][_0x6ffb('0x33')]));_0x9197af[_0x6ffb('0x34')]=_0x9197af[_0x6ffb('0x34')][_0x6ffb('0x35')]?_0x9197af['attributes']:_0x37774c['model'];if(!_0x2478a2[_0x6ffb('0x30')]['hasOwnProperty'](_0x6ffb('0x36'))){_0x9197af[_0x6ffb('0x1c')]=qs[_0x6ffb('0x1c')](_0x2478a2[_0x6ffb('0x30')][_0x6ffb('0x1c')]);_0x9197af[_0x6ffb('0x1e')]=qs[_0x6ffb('0x1e')](_0x2478a2['query'][_0x6ffb('0x1e')]);}_0x9197af[_0x6ffb('0x37')]=qs[_0x6ffb('0x38')](_0x2478a2[_0x6ffb('0x30')]['sort']);_0x9197af[_0x6ffb('0x39')]=qs[_0x6ffb('0x31')](_[_0x6ffb('0x3a')](_0x2478a2['query'],_0x37774c['filters']),_0x11ef36);if(_0x2478a2[_0x6ffb('0x30')][_0x6ffb('0x3b')]){_0x9197af['where']=_[_0x6ffb('0x3c')](_0x9197af[_0x6ffb('0x39')],{'$or':_[_0x6ffb('0x2f')](_0x11ef36,function(_0x36c578){if(_0x36c578[_0x6ffb('0x3d')]!==_0x6ffb('0x3e')){var _0x299db7={};_0x299db7[_0x36c578[_0x6ffb('0x28')]]={'$like':'%'+_0x2478a2[_0x6ffb('0x30')][_0x6ffb('0x3b')]+'%'};return _0x299db7;}})});}_0x9197af=_['merge']({},_0x9197af,_0x2478a2[_0x6ffb('0x3f')]);var _0x17b963={'where':_0x9197af[_0x6ffb('0x39')]};return db[_0x6ffb('0x2a')][_0x6ffb('0x1d')](_0x17b963)[_0x6ffb('0x40')](function(_0x37f2ff){_0x2d4eb0[_0x6ffb('0x1d')]=_0x37f2ff;if(_0x2478a2[_0x6ffb('0x30')]['includeAll']){_0x9197af[_0x6ffb('0x41')]=[{'all':!![]}];}return db[_0x6ffb('0x2a')][_0x6ffb('0x42')](_0x9197af);})[_0x6ffb('0x40')](function(_0x2f750f){_0x2d4eb0['rows']=_0x2f750f;return _0x2d4eb0;})[_0x6ffb('0x40')](respondWithFilteredResult(_0x3ed1f4,_0x9197af))[_0x6ffb('0x43')](handleError(_0x3ed1f4,null));};exports[_0x6ffb('0x44')]=function(_0x53b2d6,_0x5c89d3){var _0x13dbe3={'raw':!![],'where':{'id':_0x53b2d6[_0x6ffb('0x45')]['id']}},_0x37997f={};_0x37997f[_0x6ffb('0x2e')]=_[_0x6ffb('0x46')](db[_0x6ffb('0x2a')][_0x6ffb('0x2b')]);_0x37997f[_0x6ffb('0x30')]=_[_0x6ffb('0x46')](_0x53b2d6[_0x6ffb('0x30')]);_0x37997f[_0x6ffb('0x31')]=_['intersection'](_0x37997f['model'],_0x37997f['query']);_0x13dbe3[_0x6ffb('0x34')]=_[_0x6ffb('0x32')](_0x37997f[_0x6ffb('0x2e')],qs[_0x6ffb('0x33')](_0x53b2d6[_0x6ffb('0x30')]['fields']));_0x13dbe3[_0x6ffb('0x34')]=_0x13dbe3[_0x6ffb('0x34')][_0x6ffb('0x35')]?_0x13dbe3[_0x6ffb('0x34')]:_0x37997f[_0x6ffb('0x2e')];if(_0x53b2d6[_0x6ffb('0x30')][_0x6ffb('0x47')]){_0x13dbe3[_0x6ffb('0x41')]=[{'all':!![]}];}_0x13dbe3=_[_0x6ffb('0x3c')]({},_0x13dbe3,_0x53b2d6[_0x6ffb('0x3f')]);return db[_0x6ffb('0x2a')][_0x6ffb('0x48')](_0x13dbe3)[_0x6ffb('0x40')](handleEntityNotFound(_0x5c89d3,null))['then'](respondWithResult(_0x5c89d3,null))[_0x6ffb('0x43')](handleError(_0x5c89d3,null));};exports[_0x6ffb('0x49')]=function(_0x5b5b34,_0x189b32){return db[_0x6ffb('0x2a')]['create'](_0x5b5b34['body'],{})[_0x6ffb('0x40')](respondWithResult(_0x189b32,0xc9))[_0x6ffb('0x43')](handleError(_0x189b32,null));};exports[_0x6ffb('0x24')]=function(_0x29b89a,_0x5456f5){if(_0x29b89a[_0x6ffb('0x4a')]['id']){delete _0x29b89a[_0x6ffb('0x4a')]['id'];}return db[_0x6ffb('0x2a')][_0x6ffb('0x48')]({'where':{'id':_0x29b89a[_0x6ffb('0x45')]['id']}})[_0x6ffb('0x40')](handleEntityNotFound(_0x5456f5,null))[_0x6ffb('0x40')](saveUpdates(_0x29b89a['body'],null))[_0x6ffb('0x40')](respondWithResult(_0x5456f5,null))[_0x6ffb('0x43')](handleError(_0x5456f5,null));};exports[_0x6ffb('0x25')]=function(_0x1751f0,_0x5cdfbb){return db[_0x6ffb('0x2a')][_0x6ffb('0x48')]({'where':{'id':_0x1751f0[_0x6ffb('0x45')]['id']}})[_0x6ffb('0x40')](handleEntityNotFound(_0x5cdfbb,null))['then'](removeEntity(_0x5cdfbb,null))[_0x6ffb('0x43')](handleError(_0x5cdfbb,null));};exports['describe']=function(_0x226f85,_0x188767){return db[_0x6ffb('0x2a')][_0x6ffb('0x4b')]()[_0x6ffb('0x40')](respondWithResult(_0x188767,null))[_0x6ffb('0x43')](handleError(_0x188767,null));}; \ No newline at end of file +var _0x1ce5=['length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','request-promise','moment','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','set','apply','update','then','destroy','sendStatus','error','stack','name','index','map','OpenchannelTransferReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x5885bc,_0x191e09){var _0x6b59e9=function(_0x22333a){while(--_0x22333a){_0x5885bc['push'](_0x5885bc['shift']());}};_0x6b59e9(++_0x191e09);}(_0x1ce5,0x1e9));var _0x51ce=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x1ce5[_0x4a7631];return _0x1a5a6f;};'use strict';var emlformat=require(_0x51ce('0x0'));var rimraf=require(_0x51ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51ce('0x2'));var moment=require(_0x51ce('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x51ce('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x51ce('0x5'));var ejs=require(_0x51ce('0x6'));var fs=require('fs');var fs_extra=require(_0x51ce('0x7'));var _=require('lodash');var squel=require(_0x51ce('0x8'));var crypto=require(_0x51ce('0x9'));var jsforce=require(_0x51ce('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x51ce('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x51ce('0xc'));var qs=require(_0x51ce('0xd'));var as=require(_0x51ce('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x51ce('0xf'));var utils=require(_0x51ce('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x51ce('0x11'));var db=require(_0x51ce('0x12'))['db'];function respondWithStatusCode(_0xa71ea5,_0x1990cd){_0x1990cd=_0x1990cd||0xcc;return function(_0xe9d9a9){if(_0xe9d9a9){return _0xa71ea5['sendStatus'](_0x1990cd);}return _0xa71ea5[_0x51ce('0x13')](_0x1990cd)[_0x51ce('0x14')]();};}function respondWithResult(_0x5d9826,_0x307fb0){_0x307fb0=_0x307fb0||0xc8;return function(_0x2d2373){if(_0x2d2373){return _0x5d9826['status'](_0x307fb0)[_0x51ce('0x15')](_0x2d2373);}};}function respondWithFilteredResult(_0x1b66a6,_0x58807a){return function(_0x2ea13a){if(_0x2ea13a){var _0x3072bf=typeof _0x58807a['offset']==='undefined'&&typeof _0x58807a[_0x51ce('0x16')]==='undefined';var _0x1347c9=_0x2ea13a['count'];var _0xa6c661=_0x3072bf?0x0:_0x58807a['offset'];var _0x165d3e=_0x3072bf?_0x2ea13a[_0x51ce('0x17')]:_0x58807a[_0x51ce('0x18')]+_0x58807a['limit'];var _0x21207c;if(_0x165d3e>=_0x1347c9){_0x165d3e=_0x1347c9;_0x21207c=0xc8;}else{_0x21207c=0xce;}_0x1b66a6[_0x51ce('0x13')](_0x21207c);return _0x1b66a6[_0x51ce('0x19')]('Content-Range',_0xa6c661+'-'+_0x165d3e+'/'+_0x1347c9)[_0x51ce('0x15')](_0x2ea13a);}return null;};}function patchUpdates(_0x4cb207){return function(_0x1ec694){try{jsonpatch[_0x51ce('0x1a')](_0x1ec694,_0x4cb207,!![]);}catch(_0xf62f20){return BPromise['reject'](_0xf62f20);}return _0x1ec694['save']();};}function saveUpdates(_0x1004f0,_0x1327c7){return function(_0x1cdbc5){if(_0x1cdbc5){return _0x1cdbc5[_0x51ce('0x1b')](_0x1004f0)[_0x51ce('0x1c')](function(_0x5bf997){return _0x5bf997;});}return null;};}function removeEntity(_0x4318c8,_0xbc7ff){return function(_0x2741da){if(_0x2741da){return _0x2741da[_0x51ce('0x1d')]()['then'](function(){_0x4318c8[_0x51ce('0x13')](0xcc)[_0x51ce('0x14')]();});}};}function handleEntityNotFound(_0x450d41,_0x3d49ef){return function(_0x19d48a){if(!_0x19d48a){_0x450d41[_0x51ce('0x1e')](0x194);}return _0x19d48a;};}function handleError(_0x19c05e,_0x58ffa7){_0x58ffa7=_0x58ffa7||0x1f4;return function(_0x48e448){logger[_0x51ce('0x1f')](_0x48e448[_0x51ce('0x20')]);if(_0x48e448[_0x51ce('0x21')]){delete _0x48e448[_0x51ce('0x21')];}_0x19c05e[_0x51ce('0x13')](_0x58ffa7)['send'](_0x48e448);};}exports[_0x51ce('0x22')]=function(_0x583e46,_0x2e057f){var _0x1bf09c={},_0x17211d={},_0x5cbb5c={'count':0x0,'rows':[]};var _0x3f559c=_[_0x51ce('0x23')](db[_0x51ce('0x24')]['rawAttributes'],function(_0xa34c9a){return{'name':_0xa34c9a[_0x51ce('0x25')],'type':_0xa34c9a[_0x51ce('0x26')][_0x51ce('0x27')]};});_0x17211d[_0x51ce('0x28')]=_[_0x51ce('0x23')](_0x3f559c,_0x51ce('0x21'));_0x17211d[_0x51ce('0x29')]=_[_0x51ce('0x2a')](_0x583e46[_0x51ce('0x29')]);_0x17211d[_0x51ce('0x2b')]=_['intersection'](_0x17211d['model'],_0x17211d[_0x51ce('0x29')]);_0x1bf09c['attributes']=_[_0x51ce('0x2c')](_0x17211d['model'],qs[_0x51ce('0x2d')](_0x583e46['query'][_0x51ce('0x2d')]));_0x1bf09c['attributes']=_0x1bf09c[_0x51ce('0x2e')][_0x51ce('0x2f')]?_0x1bf09c[_0x51ce('0x2e')]:_0x17211d['model'];if(!_0x583e46[_0x51ce('0x29')][_0x51ce('0x30')]('nolimit')){_0x1bf09c['limit']=qs[_0x51ce('0x16')](_0x583e46[_0x51ce('0x29')][_0x51ce('0x16')]);_0x1bf09c['offset']=qs[_0x51ce('0x18')](_0x583e46[_0x51ce('0x29')][_0x51ce('0x18')]);}_0x1bf09c[_0x51ce('0x31')]=qs[_0x51ce('0x32')](_0x583e46['query']['sort']);_0x1bf09c['where']=qs[_0x51ce('0x2b')](_['pick'](_0x583e46[_0x51ce('0x29')],_0x17211d[_0x51ce('0x2b')]),_0x3f559c);if(_0x583e46['query'][_0x51ce('0x33')]){_0x1bf09c['where']=_[_0x51ce('0x34')](_0x1bf09c[_0x51ce('0x35')],{'$or':_[_0x51ce('0x23')](_0x3f559c,function(_0x496507){if(_0x496507['type']!==_0x51ce('0x36')){var _0x5b4471={};_0x5b4471[_0x496507[_0x51ce('0x21')]]={'$like':'%'+_0x583e46[_0x51ce('0x29')][_0x51ce('0x33')]+'%'};return _0x5b4471;}})});}_0x1bf09c=_['merge']({},_0x1bf09c,_0x583e46[_0x51ce('0x37')]);var _0x30b95d={'where':_0x1bf09c[_0x51ce('0x35')]};return db['OpenchannelTransferReport']['count'](_0x30b95d)[_0x51ce('0x1c')](function(_0x514a2d){_0x5cbb5c[_0x51ce('0x17')]=_0x514a2d;if(_0x583e46[_0x51ce('0x29')][_0x51ce('0x38')]){_0x1bf09c[_0x51ce('0x39')]=[{'all':!![]}];}return db[_0x51ce('0x24')]['findAll'](_0x1bf09c);})[_0x51ce('0x1c')](function(_0x26c229){_0x5cbb5c[_0x51ce('0x3a')]=_0x26c229;return _0x5cbb5c;})['then'](respondWithFilteredResult(_0x2e057f,_0x1bf09c))[_0x51ce('0x3b')](handleError(_0x2e057f,null));};exports[_0x51ce('0x3c')]=function(_0x5ec759,_0x1be0c4){var _0x2bea36={'raw':!![],'where':{'id':_0x5ec759[_0x51ce('0x3d')]['id']}},_0x120842={};_0x120842[_0x51ce('0x28')]=_[_0x51ce('0x2a')](db['OpenchannelTransferReport'][_0x51ce('0x3e')]);_0x120842[_0x51ce('0x29')]=_[_0x51ce('0x2a')](_0x5ec759[_0x51ce('0x29')]);_0x120842[_0x51ce('0x2b')]=_[_0x51ce('0x2c')](_0x120842[_0x51ce('0x28')],_0x120842[_0x51ce('0x29')]);_0x2bea36[_0x51ce('0x2e')]=_[_0x51ce('0x2c')](_0x120842[_0x51ce('0x28')],qs[_0x51ce('0x2d')](_0x5ec759[_0x51ce('0x29')][_0x51ce('0x2d')]));_0x2bea36['attributes']=_0x2bea36[_0x51ce('0x2e')][_0x51ce('0x2f')]?_0x2bea36[_0x51ce('0x2e')]:_0x120842[_0x51ce('0x28')];if(_0x5ec759[_0x51ce('0x29')][_0x51ce('0x38')]){_0x2bea36[_0x51ce('0x39')]=[{'all':!![]}];}_0x2bea36=_['merge']({},_0x2bea36,_0x5ec759['options']);return db[_0x51ce('0x24')][_0x51ce('0x3f')](_0x2bea36)['then'](handleEntityNotFound(_0x1be0c4,null))[_0x51ce('0x1c')](respondWithResult(_0x1be0c4,null))[_0x51ce('0x3b')](handleError(_0x1be0c4,null));};exports[_0x51ce('0x40')]=function(_0x159bce,_0x449fff){return db['OpenchannelTransferReport']['create'](_0x159bce[_0x51ce('0x41')],{})['then'](respondWithResult(_0x449fff,0xc9))[_0x51ce('0x3b')](handleError(_0x449fff,null));};exports[_0x51ce('0x1b')]=function(_0x4ae615,_0xba8025){if(_0x4ae615[_0x51ce('0x41')]['id']){delete _0x4ae615[_0x51ce('0x41')]['id'];}return db[_0x51ce('0x24')][_0x51ce('0x3f')]({'where':{'id':_0x4ae615[_0x51ce('0x3d')]['id']}})[_0x51ce('0x1c')](handleEntityNotFound(_0xba8025,null))['then'](saveUpdates(_0x4ae615['body'],null))[_0x51ce('0x1c')](respondWithResult(_0xba8025,null))[_0x51ce('0x3b')](handleError(_0xba8025,null));};exports[_0x51ce('0x1d')]=function(_0x2a3d0c,_0x4ec7ca){return db[_0x51ce('0x24')][_0x51ce('0x3f')]({'where':{'id':_0x2a3d0c[_0x51ce('0x3d')]['id']}})[_0x51ce('0x1c')](handleEntityNotFound(_0x4ec7ca,null))[_0x51ce('0x1c')](removeEntity(_0x4ec7ca,null))[_0x51ce('0x3b')](handleError(_0x4ec7ca,null));};exports[_0x51ce('0x42')]=function(_0x4722d0,_0x245db5){return db['OpenchannelTransferReport'][_0x51ce('0x42')]()[_0x51ce('0x1c')](respondWithResult(_0x245db5,null))[_0x51ce('0x3b')](handleError(_0x245db5,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 57d464e..80f6f13 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 _0x2d44=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','lodash','util'];(function(_0xcc933b,_0xc40184){var _0x17d7dd=function(_0x7bae64){while(--_0x7bae64){_0xcc933b['push'](_0xcc933b['shift']());}};_0x17d7dd(++_0xc40184);}(_0x2d44,0x1de));var _0x42d4=function(_0x2ba830,_0x3ebb5a){_0x2ba830=_0x2ba830-0x0;var _0x44b421=_0x2d44[_0x2ba830];return _0x44b421;};'use strict';var _=require(_0x42d4('0x0'));var util=require(_0x42d4('0x1'));var logger=require(_0x42d4('0x2'))(_0x42d4('0x3'));var moment=require('moment');var BPromise=require(_0x42d4('0x4'));var rp=require(_0x42d4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42d4('0x6'));var config=require(_0x42d4('0x7'));var attributes=require(_0x42d4('0x8'));module['exports']=function(_0x445f10,_0x536b40){return _0x445f10[_0x42d4('0x9')](_0x42d4('0xa'),attributes,{'tableName':_0x42d4('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xeebc=['define','OpenchannelTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports'];(function(_0x33d24d,_0x2caeed){var _0x36d286=function(_0x5bca11){while(--_0x5bca11){_0x33d24d['push'](_0x33d24d['shift']());}};_0x36d286(++_0x2caeed);}(_0xeebc,0x16f));var _0xceeb=function(_0x3f51cd,_0x288893){_0x3f51cd=_0x3f51cd-0x0;var _0xd35ce0=_0xeebc[_0x3f51cd];return _0xd35ce0;};'use strict';var _=require(_0xceeb('0x0'));var util=require(_0xceeb('0x1'));var logger=require(_0xceeb('0x2'))(_0xceeb('0x3'));var moment=require(_0xceeb('0x4'));var BPromise=require(_0xceeb('0x5'));var rp=require(_0xceeb('0x6'));var fs=require('fs');var path=require(_0xceeb('0x7'));var rimraf=require(_0xceeb('0x8'));var config=require('../../config/environment');var attributes=require(_0xceeb('0x9'));module[_0xceeb('0xa')]=function(_0x179d34,_0x3b90e7){return _0x179d34[_0xceeb('0xb')](_0xceeb('0xc'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xceeb('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 4bb30c6..9c0c147 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 _0x24ca=['request\x20sent','stringify','error','code','message','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x24ca,0x8c));var _0xa24c=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0x24ca[_0x3b0912];return _0xa8f339;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa24c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa24c('0x2'));var db=require(_0xa24c('0x3'))['db'];var utils=require(_0xa24c('0x4'));var logger=require('../../config/logger')(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var jayson=require(_0xa24c('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52147a,_0x2288d4,_0x3c10d9){return new BPromise(function(_0x1218ea,_0x3c3959){return client[_0xa24c('0x8')](_0x52147a,_0x3c10d9)[_0xa24c('0x9')](function(_0x5bedc6){logger[_0xa24c('0xa')](_0xa24c('0xb'),_0x2288d4,_0xa24c('0xc'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2288d4,_0xa24c('0xc'),JSON[_0xa24c('0xd')](_0x5bedc6));if(_0x5bedc6[_0xa24c('0xe')]){if(_0x5bedc6[_0xa24c('0xe')][_0xa24c('0xf')]===0x1f4){logger[_0xa24c('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2288d4,_0x5bedc6['error']['message']);return _0x3c3959(_0x5bedc6[_0xa24c('0xe')][_0xa24c('0x10')]);}logger[_0xa24c('0xe')](_0xa24c('0xb'),_0x2288d4,_0x5bedc6[_0xa24c('0xe')]['message']);return _0x1218ea(_0x5bedc6[_0xa24c('0xe')]['message']);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x2288d4,_0xa24c('0xc'));_0x1218ea(_0x5bedc6[_0xa24c('0x11')][_0xa24c('0x10')]);}})[_0xa24c('0x12')](function(_0x204e7a){logger[_0xa24c('0xe')](_0xa24c('0xb'),_0x2288d4,_0x204e7a);_0x3c3959(_0x204e7a);});});} \ No newline at end of file +var _0xdad2=['request','then','info','request\x20sent','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x5cc55a,_0x33e6a3){var _0x49c3ab=function(_0x538162){while(--_0x538162){_0x5cc55a['push'](_0x5cc55a['shift']());}};_0x49c3ab(++_0x33e6a3);}(_0xdad2,0x14c));var _0x2dad=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xdad2[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x2dad('0x0'));var moment=require(_0x2dad('0x1'));var BPromise=require('bluebird');var rs=require(_0x2dad('0x2'));var fs=require('fs');var Redis=require(_0x2dad('0x3'));var db=require(_0x2dad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2dad('0x5'))(_0x2dad('0x6'));var config=require('../../config/environment');var jayson=require(_0x2dad('0x7'));var client=jayson[_0x2dad('0x8')][_0x2dad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf0022b,_0x51dec0,_0x5b6aa2){return new BPromise(function(_0x217e41,_0x3c696f){return client[_0x2dad('0xa')](_0xf0022b,_0x5b6aa2)[_0x2dad('0xb')](function(_0x24bb74){logger[_0x2dad('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x51dec0,_0x2dad('0xd'));logger['debug'](_0x2dad('0xe'),_0x51dec0,_0x2dad('0xd'),JSON['stringify'](_0x24bb74));if(_0x24bb74[_0x2dad('0xf')]){if(_0x24bb74[_0x2dad('0xf')][_0x2dad('0x10')]===0x1f4){logger['error'](_0x2dad('0x11'),_0x51dec0,_0x24bb74[_0x2dad('0xf')]['message']);return _0x3c696f(_0x24bb74[_0x2dad('0xf')][_0x2dad('0x12')]);}logger[_0x2dad('0xf')](_0x2dad('0x11'),_0x51dec0,_0x24bb74['error'][_0x2dad('0x12')]);return _0x217e41(_0x24bb74[_0x2dad('0xf')][_0x2dad('0x12')]);}else{logger[_0x2dad('0xc')](_0x2dad('0x11'),_0x51dec0,'request\x20sent');_0x217e41(_0x24bb74['result'][_0x2dad('0x12')]);}})['catch'](function(_0x5d5897){logger['error'](_0x2dad('0x11'),_0x51dec0,_0x5d5897);_0x3c696f(_0x5d5897);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 0d6f57c..899d3c7 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 _0xc50a=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','put','update','delete'];(function(_0x34fcba,_0x2a0bee){var _0x5c4f41=function(_0x44b38b){while(--_0x44b38b){_0x34fcba['push'](_0x34fcba['shift']());}};_0x5c4f41(++_0x2a0bee);}(_0xc50a,0x122));var _0xac50=function(_0x9df809,_0x41081b){_0x9df809=_0x9df809-0x0;var _0x21b292=_0xc50a[_0x9df809];return _0x21b292;};'use strict';var multer=require(_0xac50('0x0'));var util=require(_0xac50('0x1'));var path=require(_0xac50('0x2'));var timeout=require(_0xac50('0x3'));var express=require(_0xac50('0x4'));var router=express[_0xac50('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xac50('0x6'));var config=require(_0xac50('0x7'));var controller=require(_0xac50('0x8'));router[_0xac50('0x9')]('/',auth[_0xac50('0xa')](),controller[_0xac50('0xb')]);router[_0xac50('0x9')](_0xac50('0xc'),auth[_0xac50('0xa')](),controller['show']);router['post']('/',auth[_0xac50('0xa')](),controller['create']);router[_0xac50('0xd')](_0xac50('0xc'),auth[_0xac50('0xa')](),controller[_0xac50('0xe')]);router[_0xac50('0xf')](_0xac50('0xc'),auth[_0xac50('0xa')](),controller[_0xac50('0x10')]);module[_0xac50('0x11')]=router; \ No newline at end of file +var _0xfc5a=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./pause.controller','isAuthenticated','index','get','/:id','show','post','create','put'];(function(_0x6d3bcb,_0x13d055){var _0x3b4104=function(_0x50f3e7){while(--_0x50f3e7){_0x6d3bcb['push'](_0x6d3bcb['shift']());}};_0x3b4104(++_0x13d055);}(_0xfc5a,0x169));var _0xafc5=function(_0x35f4f6,_0x29131d){_0x35f4f6=_0x35f4f6-0x0;var _0x516d9f=_0xfc5a[_0x35f4f6];return _0x516d9f;};'use strict';var multer=require(_0xafc5('0x0'));var util=require(_0xafc5('0x1'));var path=require(_0xafc5('0x2'));var timeout=require(_0xafc5('0x3'));var express=require(_0xafc5('0x4'));var router=express[_0xafc5('0x5')]();var fs_extra=require(_0xafc5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xafc5('0x7'));var config=require('../../config/environment');var controller=require(_0xafc5('0x8'));router['get']('/',auth[_0xafc5('0x9')](),controller[_0xafc5('0xa')]);router[_0xafc5('0xb')](_0xafc5('0xc'),auth[_0xafc5('0x9')](),controller[_0xafc5('0xd')]);router[_0xafc5('0xe')]('/',auth[_0xafc5('0x9')](),controller[_0xafc5('0xf')]);router[_0xafc5('0x10')](_0xafc5('0xc'),auth[_0xafc5('0x9')](),controller[_0xafc5('0x11')]);router[_0xafc5('0x12')]('/:id',auth[_0xafc5('0x9')](),controller[_0xafc5('0x13')]);module[_0xafc5('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 55e84d4..e4e7a50 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 _0xe4c2=['STRING','name','sequelize','exports'];(function(_0x262ede,_0x4418d7){var _0x4b78b5=function(_0x4806c9){while(--_0x4806c9){_0x262ede['push'](_0x262ede['shift']());}};_0x4b78b5(++_0x4418d7);}(_0xe4c2,0x136));var _0x2e4c=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0xe4c2[_0x26b5ff];return _0x58603e;};'use strict';var Sequelize=require(_0x2e4c('0x0'));module[_0x2e4c('0x1')]={'name':{'type':Sequelize[_0x2e4c('0x2')],'unique':_0x2e4c('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2e4c('0x2')]}}; \ No newline at end of file +var _0x5c00=['exports'];(function(_0x36175d,_0x3d17c4){var _0x170546=function(_0x5a4326){while(--_0x5a4326){_0x36175d['push'](_0x36175d['shift']());}};_0x170546(++_0x3d17c4);}(_0x5c00,0x1ce));var _0x05c0=function(_0x2adaa9,_0x298fc0){_0x2adaa9=_0x2adaa9-0x0;var _0x2a3124=_0x5c00[_0x2adaa9];return _0x2a3124;};'use strict';var Sequelize=require('sequelize');module[_0x05c0('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 1c4d441..2fc00c5 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 _0xc878=['type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','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','destroy','eml-format','zip-dir','fast-json-patch','moment','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','reject','update','then','get','Pauses','UserProfileResource','sendStatus','error','name','send','index','map','Pause','rawAttributes'];(function(_0x2fb567,_0x2daef1){var _0x5602aa=function(_0x3cc506){while(--_0x3cc506){_0x2fb567['push'](_0x2fb567['shift']());}};_0x5602aa(++_0x2daef1);}(_0xc878,0x74));var _0x8c87=function(_0x5b8310,_0x77ea6f){_0x5b8310=_0x5b8310-0x0;var _0xd3ebc1=_0xc878[_0x5b8310];return _0xd3ebc1;};'use strict';var emlformat=require(_0x8c87('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c87('0x1'));var jsonpatch=require(_0x8c87('0x2'));var rp=require('request-promise');var moment=require(_0x8c87('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8c87('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c87('0x5'));var _=require(_0x8c87('0x6'));var squel=require(_0x8c87('0x7'));var crypto=require(_0x8c87('0x8'));var jsforce=require(_0x8c87('0x9'));var deskjs=require(_0x8c87('0xa'));var toCsv=require('to-csv');var querystring=require(_0x8c87('0xb'));var Papa=require(_0x8c87('0xc'));var Redis=require(_0x8c87('0xd'));var authService=require(_0x8c87('0xe'));var qs=require(_0x8c87('0xf'));var as=require(_0x8c87('0x10'));var hardwareService=require(_0x8c87('0x11'));var logger=require(_0x8c87('0x12'))(_0x8c87('0x13'));var utils=require(_0x8c87('0x14'));var config=require(_0x8c87('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x8c87('0x16'))['db'];function respondWithStatusCode(_0x1974fb,_0xdc78f9){_0xdc78f9=_0xdc78f9||0xcc;return function(_0x47b28a){if(_0x47b28a){return _0x1974fb['sendStatus'](_0xdc78f9);}return _0x1974fb[_0x8c87('0x17')](_0xdc78f9)[_0x8c87('0x18')]();};}function respondWithResult(_0x4a8898,_0x21c0f3){_0x21c0f3=_0x21c0f3||0xc8;return function(_0x406798){if(_0x406798){return _0x4a8898[_0x8c87('0x17')](_0x21c0f3)[_0x8c87('0x19')](_0x406798);}};}function respondWithFilteredResult(_0x272bee,_0x134672){return function(_0x2e81b9){if(_0x2e81b9){var _0x165d8e=typeof _0x134672['offset']===_0x8c87('0x1a')&&typeof _0x134672['limit']===_0x8c87('0x1a');var _0x3c961c=_0x2e81b9[_0x8c87('0x1b')];var _0x15cb37=_0x165d8e?0x0:_0x134672[_0x8c87('0x1c')];var _0x4b09da=_0x165d8e?_0x2e81b9[_0x8c87('0x1b')]:_0x134672[_0x8c87('0x1c')]+_0x134672[_0x8c87('0x1d')];var _0x180418;if(_0x4b09da>=_0x3c961c){_0x4b09da=_0x3c961c;_0x180418=0xc8;}else{_0x180418=0xce;}_0x272bee[_0x8c87('0x17')](_0x180418);return _0x272bee[_0x8c87('0x1e')]('Content-Range',_0x15cb37+'-'+_0x4b09da+'/'+_0x3c961c)[_0x8c87('0x19')](_0x2e81b9);}return null;};}function patchUpdates(_0x5c2a3b){return function(_0x5dfe6a){try{jsonpatch[_0x8c87('0x1f')](_0x5dfe6a,_0x5c2a3b,!![]);}catch(_0x51536f){return BPromise[_0x8c87('0x20')](_0x51536f);}return _0x5dfe6a['save']();};}function saveUpdates(_0x557430,_0x9f12ef){return function(_0x46d952){if(_0x46d952){return _0x46d952[_0x8c87('0x21')](_0x557430)['then'](function(_0xfe489e){return _0xfe489e;});}return null;};}function removeEntity(_0x1c196e,_0x4ea7b0){return function(_0x52b2a3){if(_0x52b2a3){return _0x52b2a3['destroy']()[_0x8c87('0x22')](function(){var _0x2d2f55=_0x52b2a3[_0x8c87('0x23')]({'plain':!![]});var _0x16067e=_0x8c87('0x24');return db[_0x8c87('0x25')]['destroy']({'where':{'type':_0x16067e,'resourceId':_0x2d2f55['id']}})[_0x8c87('0x22')](function(){return _0x52b2a3;});})['then'](function(){_0x1c196e['status'](0xcc)[_0x8c87('0x18')]();});}};}function handleEntityNotFound(_0x41f323,_0x54cf){return function(_0x16591b){if(!_0x16591b){_0x41f323[_0x8c87('0x26')](0x194);}return _0x16591b;};}function handleError(_0x49aba1,_0x7c6ddc){_0x7c6ddc=_0x7c6ddc||0x1f4;return function(_0x39c75e){logger[_0x8c87('0x27')](_0x39c75e['stack']);if(_0x39c75e[_0x8c87('0x28')]){delete _0x39c75e[_0x8c87('0x28')];}_0x49aba1['status'](_0x7c6ddc)[_0x8c87('0x29')](_0x39c75e);};}exports[_0x8c87('0x2a')]=function(_0x1949f5,_0x35a9cb){var _0x2c07c2={},_0x5375d0={},_0x388176={'count':0x0,'rows':[]};var _0x439450=_[_0x8c87('0x2b')](db[_0x8c87('0x2c')][_0x8c87('0x2d')],function(_0x3a2f7e){return{'name':_0x3a2f7e['fieldName'],'type':_0x3a2f7e[_0x8c87('0x2e')][_0x8c87('0x2f')]};});_0x5375d0[_0x8c87('0x30')]=_[_0x8c87('0x2b')](_0x439450,_0x8c87('0x28'));_0x5375d0[_0x8c87('0x31')]=_[_0x8c87('0x32')](_0x1949f5[_0x8c87('0x31')]);_0x5375d0[_0x8c87('0x33')]=_[_0x8c87('0x34')](_0x5375d0['model'],_0x5375d0[_0x8c87('0x31')]);_0x2c07c2[_0x8c87('0x35')]=_[_0x8c87('0x34')](_0x5375d0['model'],qs[_0x8c87('0x36')](_0x1949f5[_0x8c87('0x31')][_0x8c87('0x36')]));_0x2c07c2[_0x8c87('0x35')]=_0x2c07c2[_0x8c87('0x35')]['length']?_0x2c07c2[_0x8c87('0x35')]:_0x5375d0[_0x8c87('0x30')];if(!_0x1949f5[_0x8c87('0x31')]['hasOwnProperty'](_0x8c87('0x37'))){_0x2c07c2['limit']=qs[_0x8c87('0x1d')](_0x1949f5[_0x8c87('0x31')]['limit']);_0x2c07c2[_0x8c87('0x1c')]=qs[_0x8c87('0x1c')](_0x1949f5[_0x8c87('0x31')][_0x8c87('0x1c')]);}_0x2c07c2[_0x8c87('0x38')]=qs['sort'](_0x1949f5['query']['sort']);_0x2c07c2['where']=qs[_0x8c87('0x33')](_['pick'](_0x1949f5['query'],_0x5375d0[_0x8c87('0x33')]),_0x439450);if(_0x1949f5[_0x8c87('0x31')][_0x8c87('0x39')]){_0x2c07c2[_0x8c87('0x3a')]=_[_0x8c87('0x3b')](_0x2c07c2[_0x8c87('0x3a')],{'$or':_['map'](_0x439450,function(_0x5056db){if(_0x5056db[_0x8c87('0x2e')]!==_0x8c87('0x3c')){var _0x2e5f3f={};_0x2e5f3f[_0x5056db['name']]={'$like':'%'+_0x1949f5['query']['filter']+'%'};return _0x2e5f3f;}})});}_0x2c07c2=_[_0x8c87('0x3b')]({},_0x2c07c2,_0x1949f5[_0x8c87('0x3d')]);var _0x1543e7={'where':_0x2c07c2['where']};return db[_0x8c87('0x2c')]['count'](_0x1543e7)['then'](function(_0x1f8cae){_0x388176[_0x8c87('0x1b')]=_0x1f8cae;if(_0x1949f5['query']['includeAll']){_0x2c07c2[_0x8c87('0x3e')]=[{'all':!![]}];}return db[_0x8c87('0x2c')][_0x8c87('0x3f')](_0x2c07c2);})[_0x8c87('0x22')](function(_0x54ae86){_0x388176[_0x8c87('0x40')]=_0x54ae86;return _0x388176;})['then'](respondWithFilteredResult(_0x35a9cb,_0x2c07c2))[_0x8c87('0x41')](handleError(_0x35a9cb,null));};exports[_0x8c87('0x42')]=function(_0x4070e4,_0x34fead){var _0x24d14c={'raw':!![],'where':{'id':_0x4070e4[_0x8c87('0x43')]['id']}},_0xbea020={};_0xbea020[_0x8c87('0x30')]=_[_0x8c87('0x32')](db[_0x8c87('0x2c')][_0x8c87('0x2d')]);_0xbea020[_0x8c87('0x31')]=_[_0x8c87('0x32')](_0x4070e4[_0x8c87('0x31')]);_0xbea020['filters']=_[_0x8c87('0x34')](_0xbea020[_0x8c87('0x30')],_0xbea020['query']);_0x24d14c[_0x8c87('0x35')]=_['intersection'](_0xbea020['model'],qs['fields'](_0x4070e4[_0x8c87('0x31')]['fields']));_0x24d14c[_0x8c87('0x35')]=_0x24d14c['attributes'][_0x8c87('0x44')]?_0x24d14c[_0x8c87('0x35')]:_0xbea020['model'];if(_0x4070e4[_0x8c87('0x31')][_0x8c87('0x45')]){_0x24d14c[_0x8c87('0x3e')]=[{'all':!![]}];}_0x24d14c=_[_0x8c87('0x3b')]({},_0x24d14c,_0x4070e4['options']);return db['Pause'][_0x8c87('0x46')](_0x24d14c)[_0x8c87('0x22')](handleEntityNotFound(_0x34fead,null))[_0x8c87('0x22')](respondWithResult(_0x34fead,null))[_0x8c87('0x41')](handleError(_0x34fead,null));};exports[_0x8c87('0x47')]=function(_0x14be9a,_0x5a9201){return db[_0x8c87('0x2c')][_0x8c87('0x47')](_0x14be9a[_0x8c87('0x48')],{})[_0x8c87('0x22')](function(_0x387adf){var _0x48be1f=_0x14be9a[_0x8c87('0x49')][_0x8c87('0x23')]({'plain':!![]});if(!_0x48be1f)throw new Error(_0x8c87('0x4a'));if(_0x48be1f[_0x8c87('0x4b')]===_0x8c87('0x49')){var _0x2451e6=_0x387adf['get']({'plain':!![]});var _0x420b06='Pauses';return db[_0x8c87('0x4c')][_0x8c87('0x46')]({'where':{'name':_0x420b06,'userProfileId':_0x48be1f[_0x8c87('0x4d')]},'raw':!![]})[_0x8c87('0x22')](function(_0x1df433){if(_0x1df433&&_0x1df433[_0x8c87('0x4e')]===0x0){return db[_0x8c87('0x25')][_0x8c87('0x47')]({'name':_0x2451e6['name'],'resourceId':_0x2451e6['id'],'type':_0x1df433[_0x8c87('0x28')],'sectionId':_0x1df433['id']},{})[_0x8c87('0x22')](function(){return _0x387adf;});}else{return _0x387adf;}})[_0x8c87('0x41')](function(_0x24a22a){logger[_0x8c87('0x27')](_0x8c87('0x4f'),_0x24a22a);throw _0x24a22a;});}return _0x387adf;})['then'](respondWithResult(_0x5a9201,0xc9))[_0x8c87('0x41')](handleError(_0x5a9201,null));};exports[_0x8c87('0x21')]=function(_0xa19ac5,_0x8838c7){if(_0xa19ac5[_0x8c87('0x48')]['id']){delete _0xa19ac5[_0x8c87('0x48')]['id'];}return db['Pause'][_0x8c87('0x46')]({'where':{'id':_0xa19ac5[_0x8c87('0x43')]['id']}})[_0x8c87('0x22')](handleEntityNotFound(_0x8838c7,null))['then'](saveUpdates(_0xa19ac5[_0x8c87('0x48')],null))[_0x8c87('0x22')](respondWithResult(_0x8838c7,null))[_0x8c87('0x41')](handleError(_0x8838c7,null));};exports[_0x8c87('0x50')]=function(_0x492ec8,_0x4f9af1){return db[_0x8c87('0x2c')][_0x8c87('0x46')]({'where':{'id':_0x492ec8[_0x8c87('0x43')]['id']}})['then'](handleEntityNotFound(_0x4f9af1,null))[_0x8c87('0x22')](removeEntity(_0x4f9af1,null))[_0x8c87('0x41')](handleError(_0x4f9af1,null));}; \ No newline at end of file +var _0xa534=['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','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','Pauses','stack','name','send','Pause','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','options','includeAll','include','findAll','rows','show','params','keys','find','catch','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','create','body','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox'];(function(_0x320f4d,_0x480288){var _0x5cea13=function(_0x2b3019){while(--_0x2b3019){_0x320f4d['push'](_0x320f4d['shift']());}};_0x5cea13(++_0x480288);}(_0xa534,0x138));var _0x4a53=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0xa534[_0x3c8e9a];return _0x2d4c57;};'use strict';var emlformat=require(_0x4a53('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4a53('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4a53('0x2'));var BPromise=require(_0x4a53('0x3'));var Mustache=require(_0x4a53('0x4'));var util=require(_0x4a53('0x5'));var path=require(_0x4a53('0x6'));var sox=require(_0x4a53('0x7'));var csv=require(_0x4a53('0x8'));var ejs=require(_0x4a53('0x9'));var fs=require('fs');var fs_extra=require(_0x4a53('0xa'));var _=require('lodash');var squel=require(_0x4a53('0xb'));var crypto=require(_0x4a53('0xc'));var jsforce=require(_0x4a53('0xd'));var deskjs=require(_0x4a53('0xe'));var toCsv=require(_0x4a53('0x8'));var querystring=require(_0x4a53('0xf'));var Papa=require(_0x4a53('0x10'));var Redis=require(_0x4a53('0x11'));var authService=require(_0x4a53('0x12'));var qs=require(_0x4a53('0x13'));var as=require(_0x4a53('0x14'));var hardwareService=require(_0x4a53('0x15'));var logger=require(_0x4a53('0x16'))(_0x4a53('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4a53('0x18'));var db=require(_0x4a53('0x19'))['db'];function respondWithStatusCode(_0x42a681,_0x31129b){_0x31129b=_0x31129b||0xcc;return function(_0x4f790a){if(_0x4f790a){return _0x42a681[_0x4a53('0x1a')](_0x31129b);}return _0x42a681['status'](_0x31129b)[_0x4a53('0x1b')]();};}function respondWithResult(_0x1c2de1,_0xf3aa1){_0xf3aa1=_0xf3aa1||0xc8;return function(_0x5a14a4){if(_0x5a14a4){return _0x1c2de1[_0x4a53('0x1c')](_0xf3aa1)[_0x4a53('0x1d')](_0x5a14a4);}};}function respondWithFilteredResult(_0x516f9b,_0x2c1082){return function(_0x101161){if(_0x101161){var _0x5e586e=typeof _0x2c1082[_0x4a53('0x1e')]===_0x4a53('0x1f')&&typeof _0x2c1082[_0x4a53('0x20')]==='undefined';var _0x3d76fa=_0x101161['count'];var _0x120a52=_0x5e586e?0x0:_0x2c1082[_0x4a53('0x1e')];var _0x5947ee=_0x5e586e?_0x101161[_0x4a53('0x21')]:_0x2c1082[_0x4a53('0x1e')]+_0x2c1082[_0x4a53('0x20')];var _0x13f563;if(_0x5947ee>=_0x3d76fa){_0x5947ee=_0x3d76fa;_0x13f563=0xc8;}else{_0x13f563=0xce;}_0x516f9b[_0x4a53('0x1c')](_0x13f563);return _0x516f9b[_0x4a53('0x22')]('Content-Range',_0x120a52+'-'+_0x5947ee+'/'+_0x3d76fa)[_0x4a53('0x1d')](_0x101161);}return null;};}function patchUpdates(_0x309453){return function(_0x2286c6){try{jsonpatch[_0x4a53('0x23')](_0x2286c6,_0x309453,!![]);}catch(_0x1c85fa){return BPromise['reject'](_0x1c85fa);}return _0x2286c6[_0x4a53('0x24')]();};}function saveUpdates(_0x1719fd,_0x2a2bcb){return function(_0x4e28b8){if(_0x4e28b8){return _0x4e28b8[_0x4a53('0x25')](_0x1719fd)[_0x4a53('0x26')](function(_0x20b77e){return _0x20b77e;});}return null;};}function removeEntity(_0xde35d8,_0x573eb2){return function(_0x17c088){if(_0x17c088){return _0x17c088[_0x4a53('0x27')]()[_0x4a53('0x26')](function(){var _0x1c66f5=_0x17c088[_0x4a53('0x28')]({'plain':!![]});var _0x33433c=_0x4a53('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x33433c,'resourceId':_0x1c66f5['id']}})[_0x4a53('0x26')](function(){return _0x17c088;});})[_0x4a53('0x26')](function(){_0xde35d8[_0x4a53('0x1c')](0xcc)[_0x4a53('0x1b')]();});}};}function handleEntityNotFound(_0x4adf0f,_0x57ec46){return function(_0x386df0){if(!_0x386df0){_0x4adf0f[_0x4a53('0x1a')](0x194);}return _0x386df0;};}function handleError(_0x107046,_0x3bde2c){_0x3bde2c=_0x3bde2c||0x1f4;return function(_0x5dfbd4){logger['error'](_0x5dfbd4[_0x4a53('0x2a')]);if(_0x5dfbd4[_0x4a53('0x2b')]){delete _0x5dfbd4[_0x4a53('0x2b')];}_0x107046['status'](_0x3bde2c)[_0x4a53('0x2c')](_0x5dfbd4);};}exports['index']=function(_0x2f20a3,_0x23c37a){var _0x1df033={},_0x446f9e={},_0x2aaae2={'count':0x0,'rows':[]};var _0x205e87=_['map'](db[_0x4a53('0x2d')][_0x4a53('0x2e')],function(_0x2842dd){return{'name':_0x2842dd['fieldName'],'type':_0x2842dd[_0x4a53('0x2f')][_0x4a53('0x30')]};});_0x446f9e['model']=_['map'](_0x205e87,_0x4a53('0x2b'));_0x446f9e[_0x4a53('0x31')]=_['keys'](_0x2f20a3[_0x4a53('0x31')]);_0x446f9e[_0x4a53('0x32')]=_['intersection'](_0x446f9e[_0x4a53('0x33')],_0x446f9e[_0x4a53('0x31')]);_0x1df033[_0x4a53('0x34')]=_[_0x4a53('0x35')](_0x446f9e[_0x4a53('0x33')],qs['fields'](_0x2f20a3[_0x4a53('0x31')][_0x4a53('0x36')]));_0x1df033[_0x4a53('0x34')]=_0x1df033['attributes'][_0x4a53('0x37')]?_0x1df033[_0x4a53('0x34')]:_0x446f9e[_0x4a53('0x33')];if(!_0x2f20a3[_0x4a53('0x31')][_0x4a53('0x38')](_0x4a53('0x39'))){_0x1df033['limit']=qs[_0x4a53('0x20')](_0x2f20a3[_0x4a53('0x31')]['limit']);_0x1df033['offset']=qs['offset'](_0x2f20a3['query'][_0x4a53('0x1e')]);}_0x1df033['order']=qs[_0x4a53('0x3a')](_0x2f20a3[_0x4a53('0x31')][_0x4a53('0x3a')]);_0x1df033[_0x4a53('0x3b')]=qs[_0x4a53('0x32')](_['pick'](_0x2f20a3[_0x4a53('0x31')],_0x446f9e[_0x4a53('0x32')]),_0x205e87);if(_0x2f20a3[_0x4a53('0x31')][_0x4a53('0x3c')]){_0x1df033[_0x4a53('0x3b')]=_[_0x4a53('0x3d')](_0x1df033[_0x4a53('0x3b')],{'$or':_[_0x4a53('0x3e')](_0x205e87,function(_0x1afeb2){if(_0x1afeb2[_0x4a53('0x2f')]!=='VIRTUAL'){var _0x337aaf={};_0x337aaf[_0x1afeb2[_0x4a53('0x2b')]]={'$like':'%'+_0x2f20a3['query'][_0x4a53('0x3c')]+'%'};return _0x337aaf;}})});}_0x1df033=_['merge']({},_0x1df033,_0x2f20a3[_0x4a53('0x3f')]);var _0x1bb16d={'where':_0x1df033['where']};return db[_0x4a53('0x2d')][_0x4a53('0x21')](_0x1bb16d)[_0x4a53('0x26')](function(_0x369e53){_0x2aaae2[_0x4a53('0x21')]=_0x369e53;if(_0x2f20a3[_0x4a53('0x31')][_0x4a53('0x40')]){_0x1df033[_0x4a53('0x41')]=[{'all':!![]}];}return db[_0x4a53('0x2d')][_0x4a53('0x42')](_0x1df033);})[_0x4a53('0x26')](function(_0x4d6080){_0x2aaae2[_0x4a53('0x43')]=_0x4d6080;return _0x2aaae2;})[_0x4a53('0x26')](respondWithFilteredResult(_0x23c37a,_0x1df033))['catch'](handleError(_0x23c37a,null));};exports[_0x4a53('0x44')]=function(_0x3c2cc4,_0x5b75a6){var _0x51baa7={'raw':!![],'where':{'id':_0x3c2cc4[_0x4a53('0x45')]['id']}},_0x4c7ce4={};_0x4c7ce4[_0x4a53('0x33')]=_[_0x4a53('0x46')](db[_0x4a53('0x2d')][_0x4a53('0x2e')]);_0x4c7ce4[_0x4a53('0x31')]=_[_0x4a53('0x46')](_0x3c2cc4['query']);_0x4c7ce4[_0x4a53('0x32')]=_[_0x4a53('0x35')](_0x4c7ce4['model'],_0x4c7ce4[_0x4a53('0x31')]);_0x51baa7[_0x4a53('0x34')]=_[_0x4a53('0x35')](_0x4c7ce4['model'],qs[_0x4a53('0x36')](_0x3c2cc4[_0x4a53('0x31')][_0x4a53('0x36')]));_0x51baa7[_0x4a53('0x34')]=_0x51baa7['attributes'][_0x4a53('0x37')]?_0x51baa7[_0x4a53('0x34')]:_0x4c7ce4[_0x4a53('0x33')];if(_0x3c2cc4[_0x4a53('0x31')][_0x4a53('0x40')]){_0x51baa7[_0x4a53('0x41')]=[{'all':!![]}];}_0x51baa7=_['merge']({},_0x51baa7,_0x3c2cc4[_0x4a53('0x3f')]);return db[_0x4a53('0x2d')][_0x4a53('0x47')](_0x51baa7)[_0x4a53('0x26')](handleEntityNotFound(_0x5b75a6,null))[_0x4a53('0x26')](respondWithResult(_0x5b75a6,null))[_0x4a53('0x48')](handleError(_0x5b75a6,null));};exports['create']=function(_0x52dfa3,_0x3eadd3){return db['Pause']['create'](_0x52dfa3['body'],{})['then'](function(_0x30bb87){var _0x5f8c99=_0x52dfa3[_0x4a53('0x49')][_0x4a53('0x28')]({'plain':!![]});if(!_0x5f8c99)throw new Error(_0x4a53('0x4a'));if(_0x5f8c99['role']===_0x4a53('0x49')){var _0x4577a8=_0x30bb87[_0x4a53('0x28')]({'plain':!![]});var _0x23e8fb='Pauses';return db['UserProfileSection'][_0x4a53('0x47')]({'where':{'name':_0x23e8fb,'userProfileId':_0x5f8c99[_0x4a53('0x4b')]},'raw':!![]})['then'](function(_0x2b283b){if(_0x2b283b&&_0x2b283b[_0x4a53('0x4c')]===0x0){return db[_0x4a53('0x4d')][_0x4a53('0x4e')]({'name':_0x4577a8[_0x4a53('0x2b')],'resourceId':_0x4577a8['id'],'type':_0x2b283b[_0x4a53('0x2b')],'sectionId':_0x2b283b['id']},{})[_0x4a53('0x26')](function(){return _0x30bb87;});}else{return _0x30bb87;}})[_0x4a53('0x48')](function(_0xf0a575){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf0a575);throw _0xf0a575;});}return _0x30bb87;})['then'](respondWithResult(_0x3eadd3,0xc9))[_0x4a53('0x48')](handleError(_0x3eadd3,null));};exports[_0x4a53('0x25')]=function(_0x3fbcaa,_0x26e6c6){if(_0x3fbcaa[_0x4a53('0x4f')]['id']){delete _0x3fbcaa['body']['id'];}return db[_0x4a53('0x2d')][_0x4a53('0x47')]({'where':{'id':_0x3fbcaa[_0x4a53('0x45')]['id']}})[_0x4a53('0x26')](handleEntityNotFound(_0x26e6c6,null))['then'](saveUpdates(_0x3fbcaa[_0x4a53('0x4f')],null))['then'](respondWithResult(_0x26e6c6,null))['catch'](handleError(_0x26e6c6,null));};exports[_0x4a53('0x27')]=function(_0x59f456,_0x1729d0){return db[_0x4a53('0x2d')][_0x4a53('0x47')]({'where':{'id':_0x59f456[_0x4a53('0x45')]['id']}})[_0x4a53('0x26')](handleEntityNotFound(_0x1729d0,null))[_0x4a53('0x26')](removeEntity(_0x1729d0,null))[_0x4a53('0x48')](handleError(_0x1729d0,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c4d269f..12a172f 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 _0x326f=['tools_pauses','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x18e27c,_0x4c2c08){var _0x3bef7b=function(_0x200f42){while(--_0x200f42){_0x18e27c['push'](_0x18e27c['shift']());}};_0x3bef7b(++_0x4c2c08);}(_0x326f,0xd1));var _0xf326=function(_0x465d6d,_0x3bf9e2){_0x465d6d=_0x465d6d-0x0;var _0x4bb4b7=_0x326f[_0x465d6d];return _0x4bb4b7;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index a7e3ab0..61e6158 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x6465a2,_0x3920d0){var _0x1264d8=function(_0x333140){while(--_0x333140){_0x6465a2['push'](_0x6465a2['shift']());}};_0x1264d8(++_0x3920d0);}(_0x7a54,0x106));var _0x47a5=function(_0x396f89,_0x1ace30){_0x396f89=_0x396f89-0x0;var _0x31473c=_0x7a54[_0x396f89];return _0x31473c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x2b1f38,_0x5dacff){var _0x4aad9f=function(_0x384ed5){while(--_0x384ed5){_0x2b1f38['push'](_0x2b1f38['shift']());}};_0x4aad9f(++_0x5dacff);}(_0xb10b,0x12a));var _0xbb10=function(_0x203f90,_0x1f112d){_0x203f90=_0x203f90-0x0;var _0x3f8714=_0xb10b[_0x203f90];return _0x3f8714;};'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 efda529..7ace2a8 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 _0xa8a8=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','/:id/download','download','diskStorage','join','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','single','file','upload','post','put','update','delete','multer','util'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4835e2,_0x5bc771){_0x4835e2=_0x4835e2-0x0;var _0x50d6af=_0xa8a8[_0x4835e2];return _0x50d6af;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var fs_extra=require(_0x8a8a('0x5'));var auth=require(_0x8a8a('0x6'));var interaction=require(_0x8a8a('0x7'));var config=require(_0x8a8a('0x8'));var controller=require(_0x8a8a('0x9'));router[_0x8a8a('0xa')]('/',auth[_0x8a8a('0xb')](),controller[_0x8a8a('0xc')]);router[_0x8a8a('0xa')](_0x8a8a('0xd'),controller[_0x8a8a('0xe')]);router[_0x8a8a('0xa')](_0x8a8a('0xf'),auth[_0x8a8a('0xb')](),controller['show']);router['get'](_0x8a8a('0x10'),auth['isAuthenticated'](),controller[_0x8a8a('0x11')]);var upload=multer({'storage':multer[_0x8a8a('0x12')]({'destination':function(_0x532621,_0x118380,_0x76b586){_0x76b586(null,path[_0x8a8a('0x13')](config['root'],_0x8a8a('0x14')));},'filename':function(_0x42fab7,_0x330796,_0x234481){_0x330796['originalname']=_0x330796[_0x8a8a('0x15')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x234481(null,util[_0x8a8a('0x16')](_0x8a8a('0x17'),path[_0x8a8a('0x18')](_0x330796[_0x8a8a('0x15')],path[_0x8a8a('0x19')](_0x330796[_0x8a8a('0x15')])),Date[_0x8a8a('0x1a')](),path['extname'](_0x330796[_0x8a8a('0x15')])));}})});router['post']('/',upload[_0x8a8a('0x1b')](_0x8a8a('0x1c')),controller[_0x8a8a('0x1d')]);router[_0x8a8a('0x1e')](_0x8a8a('0xd'),controller['webhookPost']);router[_0x8a8a('0x1f')](_0x8a8a('0xf'),auth[_0x8a8a('0xb')](),controller[_0x8a8a('0x20')]);router[_0x8a8a('0x21')](_0x8a8a('0xf'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file +var _0xd2ea=['./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','download','diskStorage','root','server/files/plugins','originalname','replace','extname','now','post','single','file','upload','webhookPost','put','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x15b399,_0x59db1a){var _0x199f2d=function(_0x3bd31c){while(--_0x3bd31c){_0x15b399['push'](_0x15b399['shift']());}};_0x199f2d(++_0x59db1a);}(_0xd2ea,0x15f));var _0xad2e=function(_0x38f91b,_0xc0fdc7){_0x38f91b=_0x38f91b-0x0;var _0xe8cfde=_0xd2ea[_0x38f91b];return _0xe8cfde;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),controller[_0xad2e('0xd')]);router['get'](_0xad2e('0xe'),auth[_0xad2e('0xb')](),controller['show']);router[_0xad2e('0xa')]('/:id/download',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);var upload=multer({'storage':multer[_0xad2e('0x10')]({'destination':function(_0x24c5da,_0x489f25,_0x7df3c6){_0x7df3c6(null,path['join'](config[_0xad2e('0x11')],_0xad2e('0x12')));},'filename':function(_0x433696,_0x42e2f2,_0x59a342){_0x42e2f2[_0xad2e('0x13')]=_0x42e2f2['originalname'][_0xad2e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59a342(null,util['format']('%s-%s%s',path['basename'](_0x42e2f2['originalname'],path[_0xad2e('0x15')](_0x42e2f2[_0xad2e('0x13')])),Date[_0xad2e('0x16')](),path[_0xad2e('0x15')](_0x42e2f2[_0xad2e('0x13')])));}})});router[_0xad2e('0x17')]('/',upload[_0xad2e('0x18')](_0xad2e('0x19')),controller[_0xad2e('0x1a')]);router[_0xad2e('0x17')](_0xad2e('0xc'),controller[_0xad2e('0x1b')]);router[_0xad2e('0x1c')](_0xad2e('0xe'),auth[_0xad2e('0xb')](),controller['update']);router[_0xad2e('0x1d')](_0xad2e('0xe'),auth['isAuthenticated'](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 2a6252e..c015b07 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 _0x323f=['always','never','exports','STRING','html','script','TEXT','BOOLEAN','ENUM','adminOnly','agentOnly'];(function(_0x848d40,_0x2b3c4e){var _0x5b9ae9=function(_0x5fd813){while(--_0x5fd813){_0x848d40['push'](_0x848d40['shift']());}};_0x5b9ae9(++_0x2b3c4e);}(_0x323f,0xc8));var _0xf323=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x323f[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require('sequelize');module[_0xf323('0x0')]={'name':{'type':Sequelize[_0xf323('0x1')]},'type':{'type':Sequelize['ENUM'](_0xf323('0x2'),_0xf323('0x3'))},'description':{'type':Sequelize[_0xf323('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0xf323('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0xf323('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xf323('0x6')](_0xf323('0x7'),_0xf323('0x8'),_0xf323('0x9'),_0xf323('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xf323('0x1')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xf323('0x1')]},'scriptPath':{'type':Sequelize[_0xf323('0x1')]}}; \ No newline at end of file +var _0xc5cf=['agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','ENUM'];(function(_0x139ff6,_0xddca5){var _0x71b083=function(_0x4cf27a){while(--_0x4cf27a){_0x139ff6['push'](_0x139ff6['shift']());}};_0x71b083(++_0xddca5);}(_0xc5cf,0x174));var _0xfc5c=function(_0x1074d2,_0x46d688){_0x1074d2=_0x1074d2-0x0;var _0x441adb=_0xc5cf[_0x1074d2];return _0x441adb;};'use strict';var Sequelize=require(_0xfc5c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM']('html',_0xfc5c('0x1'))},'description':{'type':Sequelize[_0xfc5c('0x2')]},'version':{'type':Sequelize[_0xfc5c('0x2')]},'path':{'type':Sequelize[_0xfc5c('0x3')],'comment':_0xfc5c('0x4')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xfc5c('0x5')]('adminOnly',_0xfc5c('0x6'),'always','never'),'defaultValue':_0xfc5c('0x7'),'comment':_0xfc5c('0x8')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xfc5c('0x3')]},'agentUrl':{'type':Sequelize[_0xfc5c('0x3')]},'scriptName':{'type':Sequelize[_0xfc5c('0x3')]},'scriptPath':{'type':Sequelize[_0xfc5c('0x3')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index ffb04e9..d97046b 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 _0x490b=['statusCode','webhookPost','resolve','http://localhost:','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','extract-zip','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','apply','reject','save','update','then','destroy','Plugins','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','params','length','includeAll','find','download','join','root','server/files/plugins','%s.zip','createWriteStream','code','ENOENT','error','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Sequelize','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','extname','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','always','icon','icon-apps','version','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type'];(function(_0x5e5dd7,_0xb8b59c){var _0x567cad=function(_0x212481){while(--_0x212481){_0x5e5dd7['push'](_0x5e5dd7['shift']());}};_0x567cad(++_0xb8b59c);}(_0x490b,0xb2));var _0xb490=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0x490b[_0x2f6541];return _0x4d76d8;};'use strict';var emlformat=require(_0xb490('0x0'));var rimraf=require(_0xb490('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb490('0x2'));var rp=require('request-promise');var moment=require(_0xb490('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb490('0x4'));var util=require(_0xb490('0x5'));var path=require(_0xb490('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb490('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb490('0x8'));var squel=require(_0xb490('0x9'));var crypto=require(_0xb490('0xa'));var jsforce=require(_0xb490('0xb'));var deskjs=require(_0xb490('0xc'));var toCsv=require(_0xb490('0xd'));var querystring=require(_0xb490('0xe'));var Papa=require(_0xb490('0xf'));var extract=require(_0xb490('0x10'));var rimraf=require(_0xb490('0x1'));var archiver=require('archiver');var Redis=require(_0xb490('0x11'));var authService=require(_0xb490('0x12'));var qs=require(_0xb490('0x13'));var as=require(_0xb490('0x14'));var hardwareService=require(_0xb490('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xb490('0x16'));var config=require(_0xb490('0x17'));var licenseUtil=require(_0xb490('0x18'));var db=require(_0xb490('0x19'))['db'];config['redis']=_[_0xb490('0x1a')](config[_0xb490('0x1b')],{'host':_0xb490('0x1c'),'port':0x18eb});var socket=require(_0xb490('0x1d'))(new Redis(config[_0xb490('0x1b')]));require(_0xb490('0x1e'))[_0xb490('0x1f')](socket);function respondWithStatusCode(_0x31b866,_0x5b1051){_0x5b1051=_0x5b1051||0xcc;return function(_0xc9876b){if(_0xc9876b){return _0x31b866[_0xb490('0x20')](_0x5b1051);}return _0x31b866[_0xb490('0x21')](_0x5b1051)[_0xb490('0x22')]();};}function respondWithResult(_0x3d878b,_0x3b6d7d){_0x3b6d7d=_0x3b6d7d||0xc8;return function(_0x1d6fd2){if(_0x1d6fd2){return _0x3d878b['status'](_0x3b6d7d)['json'](_0x1d6fd2);}};}function respondWithFilteredResult(_0x552134,_0x5c43fc){return function(_0x518da7){if(_0x518da7){var _0x4856f8=typeof _0x5c43fc['offset']===_0xb490('0x23')&&typeof _0x5c43fc[_0xb490('0x24')]==='undefined';var _0x1c4215=_0x518da7['count'];var _0x171530=_0x4856f8?0x0:_0x5c43fc[_0xb490('0x25')];var _0x2c97ae=_0x4856f8?_0x518da7[_0xb490('0x26')]:_0x5c43fc['offset']+_0x5c43fc[_0xb490('0x24')];var _0x384cac;if(_0x2c97ae>=_0x1c4215){_0x2c97ae=_0x1c4215;_0x384cac=0xc8;}else{_0x384cac=0xce;}_0x552134[_0xb490('0x21')](_0x384cac);return _0x552134[_0xb490('0x27')](_0xb490('0x28'),_0x171530+'-'+_0x2c97ae+'/'+_0x1c4215)[_0xb490('0x29')](_0x518da7);}return null;};}function patchUpdates(_0x2ffbae){return function(_0x1f618e){try{jsonpatch[_0xb490('0x2a')](_0x1f618e,_0x2ffbae,!![]);}catch(_0x32aa31){return BPromise[_0xb490('0x2b')](_0x32aa31);}return _0x1f618e[_0xb490('0x2c')]();};}function saveUpdates(_0x1089ab,_0x3ed45b){return function(_0x483d5b){if(_0x483d5b){return _0x483d5b[_0xb490('0x2d')](_0x1089ab)[_0xb490('0x2e')](function(_0x1966d9){return _0x1966d9;});}return null;};}function removeEntity(_0xcc6a22,_0x48bd4a){return function(_0xc71ef7){if(_0xc71ef7){return _0xc71ef7[_0xb490('0x2f')]()[_0xb490('0x2e')](function(){var _0x3dff33=_0xc71ef7['get']({'plain':!![]});var _0x21d3ce=_0xb490('0x30');return db['UserProfileResource']['destroy']({'where':{'type':_0x21d3ce,'resourceId':_0x3dff33['id']}})[_0xb490('0x2e')](function(){return _0xc71ef7;});})[_0xb490('0x2e')](function(){_0xcc6a22[_0xb490('0x21')](0xcc)[_0xb490('0x22')]();});}};}function handleEntityNotFound(_0x59c6fe,_0x3052dd){return function(_0x1e6dae){if(!_0x1e6dae){_0x59c6fe[_0xb490('0x20')](0x194);}return _0x1e6dae;};}function handleError(_0x184a61,_0x2b3e68){_0x2b3e68=_0x2b3e68||0x1f4;return function(_0xda71f5){logger['error'](_0xda71f5[_0xb490('0x31')]);if(_0xda71f5[_0xb490('0x32')]){delete _0xda71f5[_0xb490('0x32')];}_0x184a61[_0xb490('0x21')](_0x2b3e68)[_0xb490('0x33')](_0xda71f5);};}exports[_0xb490('0x34')]=function(_0x4a82d7,_0x320dd5){var _0x11548e={},_0x1ca714={},_0x5b1743={'count':0x0,'rows':[]};var _0xb44674=_[_0xb490('0x35')](db[_0xb490('0x36')][_0xb490('0x37')],function(_0x1f2ea1){return{'name':_0x1f2ea1[_0xb490('0x38')],'type':_0x1f2ea1[_0xb490('0x39')]['key']};});_0x1ca714[_0xb490('0x3a')]=_[_0xb490('0x35')](_0xb44674,_0xb490('0x32'));_0x1ca714[_0xb490('0x3b')]=_[_0xb490('0x3c')](_0x4a82d7['query']);_0x1ca714[_0xb490('0x3d')]=_[_0xb490('0x3e')](_0x1ca714[_0xb490('0x3a')],_0x1ca714[_0xb490('0x3b')]);_0x11548e[_0xb490('0x3f')]=_[_0xb490('0x3e')](_0x1ca714[_0xb490('0x3a')],qs[_0xb490('0x40')](_0x4a82d7[_0xb490('0x3b')][_0xb490('0x40')]));_0x11548e[_0xb490('0x3f')]=_0x11548e[_0xb490('0x3f')]['length']?_0x11548e[_0xb490('0x3f')]:_0x1ca714[_0xb490('0x3a')];if(!_0x4a82d7[_0xb490('0x3b')]['hasOwnProperty']('nolimit')){_0x11548e[_0xb490('0x24')]=qs[_0xb490('0x24')](_0x4a82d7[_0xb490('0x3b')][_0xb490('0x24')]);_0x11548e['offset']=qs['offset'](_0x4a82d7['query'][_0xb490('0x25')]);}_0x11548e[_0xb490('0x41')]=qs['sort'](_0x4a82d7['query'][_0xb490('0x42')]);_0x11548e[_0xb490('0x43')]=qs[_0xb490('0x3d')](_[_0xb490('0x44')](_0x4a82d7['query'],_0x1ca714[_0xb490('0x3d')]),_0xb44674);if(_0x4a82d7[_0xb490('0x3b')]['filter']){_0x11548e[_0xb490('0x43')]=_[_0xb490('0x45')](_0x11548e[_0xb490('0x43')],{'$or':_[_0xb490('0x35')](_0xb44674,function(_0x2ffa0a){if(_0x2ffa0a[_0xb490('0x39')]!==_0xb490('0x46')){var _0x83e881={};_0x83e881[_0x2ffa0a[_0xb490('0x32')]]={'$like':'%'+_0x4a82d7[_0xb490('0x3b')][_0xb490('0x47')]+'%'};return _0x83e881;}})});}_0x11548e=_[_0xb490('0x45')]({},_0x11548e,_0x4a82d7[_0xb490('0x48')]);var _0x2a62d1={'where':_0x11548e[_0xb490('0x43')]};return db[_0xb490('0x36')]['count'](_0x2a62d1)[_0xb490('0x2e')](function(_0x1e7d95){_0x5b1743['count']=_0x1e7d95;if(_0x4a82d7[_0xb490('0x3b')]['includeAll']){_0x11548e[_0xb490('0x49')]=[{'all':!![]}];}return db[_0xb490('0x36')][_0xb490('0x4a')](_0x11548e);})[_0xb490('0x2e')](function(_0x1ce790){_0x5b1743[_0xb490('0x4b')]=_0x1ce790;return _0x5b1743;})['then'](respondWithFilteredResult(_0x320dd5,_0x11548e))[_0xb490('0x4c')](handleError(_0x320dd5,null));};exports['show']=function(_0x59c2b9,_0x298e6a){var _0x2482ac={'raw':!![],'where':{'id':_0x59c2b9[_0xb490('0x4d')]['id']}},_0x3d6a64={};_0x3d6a64[_0xb490('0x3a')]=_[_0xb490('0x3c')](db[_0xb490('0x36')]['rawAttributes']);_0x3d6a64[_0xb490('0x3b')]=_[_0xb490('0x3c')](_0x59c2b9['query']);_0x3d6a64[_0xb490('0x3d')]=_[_0xb490('0x3e')](_0x3d6a64[_0xb490('0x3a')],_0x3d6a64['query']);_0x2482ac[_0xb490('0x3f')]=_[_0xb490('0x3e')](_0x3d6a64['model'],qs[_0xb490('0x40')](_0x59c2b9[_0xb490('0x3b')][_0xb490('0x40')]));_0x2482ac['attributes']=_0x2482ac['attributes'][_0xb490('0x4e')]?_0x2482ac['attributes']:_0x3d6a64['model'];if(_0x59c2b9[_0xb490('0x3b')][_0xb490('0x4f')]){_0x2482ac[_0xb490('0x49')]=[{'all':!![]}];}_0x2482ac=_[_0xb490('0x45')]({},_0x2482ac,_0x59c2b9['options']);return db[_0xb490('0x36')][_0xb490('0x50')](_0x2482ac)[_0xb490('0x2e')](handleEntityNotFound(_0x298e6a,null))[_0xb490('0x2e')](respondWithResult(_0x298e6a,null))['catch'](handleError(_0x298e6a,null));};exports[_0xb490('0x51')]=function(_0x313d0c,_0x49bf93,_0x162b73){return db['Plugin'][_0xb490('0x50')]({'where':{'id':_0x313d0c[_0xb490('0x4d')]['id']},'attributes':[_0xb490('0x32'),_0xb490('0x6')],'raw':!![]})[_0xb490('0x2e')](handleEntityNotFound(_0x49bf93,null))['then'](function(_0x5b0b91){if(_0x5b0b91){var _0x286958=path[_0xb490('0x52')](config[_0xb490('0x53')],_0xb490('0x54'),util['format'](_0xb490('0x55'),path['basename'](_0x5b0b91[_0xb490('0x6')])));var _0x355268=fs[_0xb490('0x56')](_0x286958);var _0x36ee7d=archiver('zip',{'zlib':{'level':0x9}});_0x36ee7d['on']('warning',function(_0x55d272){if(_0x55d272[_0xb490('0x57')]===_0xb490('0x58')){logger[_0xb490('0x59')](_0x55d272);}else{throw new db['Sequelize'][(_0xb490('0x5a'))](_0xb490('0x5b'));}});_0x36ee7d['on'](_0xb490('0x59'),function(_0x387a43){throw new db['Sequelize'][(_0xb490('0x5a'))](_0xb490('0x5b'));});_0x36ee7d[_0xb490('0x5c')](_0x355268);_0x36ee7d[_0xb490('0x5d')](_0xb490('0x5e'),{'cwd':path[_0xb490('0x52')](config[_0xb490('0x53')],_0xb490('0x54'),path[_0xb490('0x5f')](_0x5b0b91['path'])),'ignore':[path[_0xb490('0x52')](path[_0xb490('0x60')](_0x5b0b91['path']),_0xb490('0x61')),path[_0xb490('0x52')](path[_0xb490('0x60')](_0x5b0b91[_0xb490('0x6')]),_0xb490('0x62'))],'nodir':!![]})[_0xb490('0x63')]();_0x355268['on'](_0xb490('0x64'),function(){if(!fs[_0xb490('0x65')](_0x286958)){throw new db[(_0xb490('0x66'))][(_0xb490('0x5a'))](_0xb490('0x67'));}return _0x49bf93[_0xb490('0x51')](_0x286958,util[_0xb490('0x68')](_0xb490('0x55'),path[_0xb490('0x60')](_0x5b0b91['path'])),function(_0x23c78e){if(_0x23c78e){throw new db[(_0xb490('0x66'))][(_0xb490('0x5a'))](_0xb490('0x69'));}fs[_0xb490('0x6a')](_0x286958);logger[_0xb490('0x6b')](_0xb490('0x6c'));logger[_0xb490('0x6b')](_0xb490('0x6d'));});});}return null;})['catch'](handleError(_0x49bf93,null));};exports[_0xb490('0x6e')]=function(_0x580b3a,_0xf05989,_0x4aa16f){var _0x554421=path[_0xb490('0x60')](_0x580b3a['file']['filename'],path[_0xb490('0x6f')](_0x580b3a[_0xb490('0x70')]['filename']));var _0x1316f0=path['join'](config[_0xb490('0x53')],_0xb490('0x54'),_0x580b3a[_0xb490('0x70')][_0xb490('0x71')]);var _0x491982=path[_0xb490('0x52')](config['root'],_0xb490('0x54'),_0x554421);logger[_0xb490('0x6b')]('Plugin\x20upload\x20filepath:\x20%s',_0x1316f0);logger[_0xb490('0x6b')](_0xb490('0x72'),_0x491982);try{fs[_0xb490('0x73')](_0x1316f0,parseInt(_0xb490('0x74'),0x8));extract(_0x1316f0,{'dir':_0x491982},function(_0x5db9c6){if(_0x5db9c6){logger[_0xb490('0x59')](_0x5db9c6);handleError(_0x5db9c6,!![]);};var _0x297744=fs[_0xb490('0x75')](_0x491982);if(_0x297744['length']>0x1){removeReferences(_0x1316f0,_0x491982);logger['error'](_0xb490('0x76'));return _0x4aa16f(new Error('Invalid\x20plugin\x20structure'));}var _0x108507=fs['lstatSync'](path[_0xb490('0x52')](_0x491982,_0x297744[0x0]));if(_0x108507[_0xb490('0x77')]()){removeReferences(_0x1316f0,_0x491982);logger[_0xb490('0x59')](_0xb490('0x76'));return _0x4aa16f(new Error(_0xb490('0x76')));}if(_0x108507[_0xb490('0x78')]()){var _0x543d95=fs['readdirSync'](path[_0xb490('0x52')](_0x491982,_0x297744[0x0]));if(_0x543d95[_0xb490('0x4e')]===0x0){removeReferences(_0x1316f0,_0x491982);logger[_0xb490('0x59')](_0xb490('0x76'));return _0x4aa16f(new Error('Invalid\x20plugin\x20structure'));}var _0x30d38c=_0x543d95['some'](function(_0x15efd6){return _0x15efd6===_0xb490('0x79');});if(!_0x30d38c){return _0x4aa16f(new Error(_0xb490('0x7a')));}var _0x5df4dd=fs[_0xb490('0x7b')](path['join'](_0x491982,_0x297744[0x0],'manifest.json'));var _0x37f120=JSON[_0xb490('0x7c')](_0x5df4dd);if(_0xb490('0x23')==typeof _0x37f120[_0xb490('0x32')]){return _0x4aa16f(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x37f120[_0xb490('0x39')]){return _0x4aa16f(new Error(_0xb490('0x7d')));}if(_0xb490('0x23')==typeof _0x37f120['version']){return _0x4aa16f(new Error(_0xb490('0x7e')));}if(_0xb490('0x23')==typeof _0x37f120[_0xb490('0x7f')]){return _0x4aa16f(new Error(_0xb490('0x80')));}if(_0x37f120[_0xb490('0x39')]===_0xb490('0x81')){if(_0xb490('0x23')==typeof _0x37f120[_0xb490('0x7f')][_0xb490('0x82')]){return _0x4aa16f(new Error(_0xb490('0x83')));}if(_0xb490('0x23')==typeof _0x37f120[_0xb490('0x7f')][_0xb490('0x82')][_0xb490('0x84')]&&_0xb490('0x23')==typeof _0x37f120[_0xb490('0x7f')]['views']['agent']){return _0x4aa16f(new Error(_0xb490('0x85')));}}else if(_0x37f120[_0xb490('0x39')]===_0xb490('0x86')){if(_0xb490('0x23')==typeof _0x37f120['parameters'][_0xb490('0x87')]){return _0x4aa16f(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xb490('0x23')==typeof _0x37f120[_0xb490('0x7f')][_0xb490('0x88')]){return _0x4aa16f(new Error(_0xb490('0x89')));}}else{return _0x4aa16f(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xfa61e9=_0x37f120[_0xb490('0x32')];var _0x335791=_0x37f120['description'];var _0xc61f60=_0x37f120[_0xb490('0x39')];var _0x2df484=_0x37f120['sidebar']?_0x37f120['sidebar']:_0xb490('0x8a');var _0x58aeef=_0x37f120[_0xb490('0x8b')]?_0x37f120[_0xb490('0x8b')]:_0xb490('0x8c');var _0x37836c='';var _0x11fe22='';var _0x506c75='';var _0x4b1d37='';var _0x336810=_0x37f120[_0xb490('0x8d')];if(_0xc61f60==='html'){if(_0xb490('0x23')!=typeof _0x37f120[_0xb490('0x7f')][_0xb490('0x82')][_0xb490('0x84')]){var _0x41e63c=_0x37f120[_0xb490('0x7f')]['views'][_0xb490('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xb490('0x8e')](_0x41e63c)){_0x37836c=path[_0xb490('0x52')](_0xb490('0x8f'),_0x554421,_0x297744[0x0],_0x41e63c);}else{_0x37836c=_0x41e63c;}}else{logger[_0xb490('0x6b')](_0xb490('0x90'));}if(_0xb490('0x23')!=typeof _0x37f120[_0xb490('0x7f')][_0xb490('0x82')][_0xb490('0x91')]){var _0xdcbcf7=_0x37f120['parameters']['views'][_0xb490('0x91')];if(!/^(f|ht)tps?:\/\//i['test'](_0xdcbcf7)){_0x11fe22=path[_0xb490('0x52')]('plugins',_0x554421,_0x297744[0x0],_0xdcbcf7);}else{_0x11fe22=_0xdcbcf7;}}else{logger[_0xb490('0x6b')](_0xb490('0x92'));}}else if(_0xc61f60==='script'){_0x506c75=_0x37f120[_0xb490('0x7f')][_0xb490('0x87')];_0x4b1d37=_0x37f120[_0xb490('0x7f')][_0xb490('0x88')];if(_0xb490('0x23')!=typeof _0x37f120['parameters'][_0xb490('0x82')]){if(_0xb490('0x23')!=typeof _0x37f120[_0xb490('0x7f')][_0xb490('0x82')][_0xb490('0x84')]){var _0x41e63c=_0x37f120['parameters'][_0xb490('0x82')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x41e63c)){_0x37836c=path['join'](_0xb490('0x8f'),_0x554421,_0x297744[0x0],_0x41e63c);}else{_0x37836c=_0x41e63c;}}if(_0xb490('0x23')!=typeof _0x37f120[_0xb490('0x7f')][_0xb490('0x82')][_0xb490('0x91')]){var _0xdcbcf7=_0x37f120[_0xb490('0x7f')][_0xb490('0x82')][_0xb490('0x91')];if(!/^(f|ht)tps?:\/\//i['test'](_0xdcbcf7)){_0x11fe22=path[_0xb490('0x52')](_0xb490('0x8f'),_0x554421,_0x297744[0x0],_0xdcbcf7);}else{_0x11fe22=_0xdcbcf7;}}}}var _0x220024={'name':_0xfa61e9,'description':_0x335791,'path':path[_0xb490('0x52')](_0x554421,_0x297744[0x0]),'type':_0xc61f60,'sidebar':_0x2df484,'icon':_0x58aeef,'adminUrl':_0x37836c,'agentUrl':_0x11fe22,'scriptName':_0x506c75,'scriptPath':_0x4b1d37,'version':_0x336810};removeReferences(_0x1316f0,null);return db[_0xb490('0x36')][_0xb490('0x93')](_0x220024)[_0xb490('0x2e')](function(_0x106f03){var _0x2162b9={'role':_0x580b3a[_0xb490('0x94')][_0xb490('0x95')],'userProfileId':_0x580b3a[_0xb490('0x94')][_0xb490('0x96')]};if(!_0x2162b9)throw new Error(_0xb490('0x97'));if(_0x2162b9['role']==='user'){var _0x3ec051=_0x106f03[_0xb490('0x98')]({'plain':!![]});return db[_0xb490('0x99')][_0xb490('0x50')]({'where':{'name':'Plugins','userProfileId':_0x2162b9[_0xb490('0x96')]},'raw':!![]})[_0xb490('0x2e')](function(_0xc6da78){if(_0xc6da78&&_0xc6da78[_0xb490('0x9a')]===0x0){return db[_0xb490('0x9b')][_0xb490('0x93')]({'name':_0x3ec051['name'],'resourceId':_0x3ec051['id'],'type':_0xc6da78[_0xb490('0x32')],'sectionId':_0xc6da78['id']},{})[_0xb490('0x2e')](function(){return _0x106f03;});}else{return _0x106f03;}})['catch'](function(_0xde26dc){logger['error'](_0xb490('0x9c'),_0xde26dc);throw _0xde26dc;});}return _0x106f03;})[_0xb490('0x2e')](respondWithResult(_0xf05989,null))[_0xb490('0x4c')](handleError(_0xf05989,null));}});}catch(_0x3b329a){_0xf05989[_0xb490('0x21')](0x1f4)[_0xb490('0x33')](_0x3b329a);}};function removeReferences(_0x2c56cc,_0x3171b4){try{if(_0x2c56cc){fs[_0xb490('0x6a')](_0x2c56cc);logger['info'](_0xb490('0x9d'));}if(_0x3171b4){rimraf(_0x3171b4,function(){});logger[_0xb490('0x6b')](_0xb490('0x9e'));}}catch(_0x3c0d84){logger[_0xb490('0x59')](_0x3c0d84);}}exports[_0xb490('0x2d')]=function(_0x455cd1,_0x520f55,_0x42a044){return db['Plugin'][_0xb490('0x50')]({'where':{'id':_0x455cd1[_0xb490('0x4d')]['id']}})[_0xb490('0x2e')](handleEntityNotFound(_0x520f55,null))[_0xb490('0x2e')](saveUpdates(_0x455cd1[_0xb490('0x94')],null))[_0xb490('0x2e')](respondWithResult(_0x520f55,null))[_0xb490('0x4c')](handleError(_0x520f55,null));};exports[_0xb490('0x9f')]=function(_0x203a1e,_0x2f3326,_0x4c8723){return db[_0xb490('0x36')][_0xb490('0x50')]({'where':{'id':_0x203a1e['params']['id']}})[_0xb490('0x2e')](function(_0x302aeb){if(_0x302aeb){return _0x302aeb[_0xb490('0x2f')]();}})[_0xb490('0x2e')](function(_0x311fe3){rimraf(path[_0xb490('0x52')](config[_0xb490('0x53')],'server/files/plugins',path[_0xb490('0x5f')](_0x311fe3[_0xb490('0x6')])),function(){});return _0x311fe3;})[_0xb490('0x2e')](handleEntityNotFound(_0x2f3326,null))[_0xb490('0x2e')](respondWithStatusCode(_0x2f3326,null))[_0xb490('0x4c')](handleError(_0x2f3326,null));};exports['webhookGet']=function(_0x56a1be,_0xa9f846,_0xd4ce5c){return BPromise['resolve']()['then'](function(){if(!_0x56a1be[_0xb490('0x3b')][_0xb490('0x6')]){throw new Error(_0xb490('0xa0'));}if(!_0x56a1be['query'][_0xb490('0xa1')]){throw new Error(_0xb490('0xa2'));}var _0x3281cc=_0x56a1be[_0xb490('0x3b')]['hostname']?_0x56a1be[_0xb490('0x3b')][_0xb490('0xa3')]+':'+_0x56a1be['query'][_0xb490('0xa1')]:'http://localhost:'+_0x56a1be[_0xb490('0x3b')]['port'];var _0x1fe6d2=_0x56a1be[_0xb490('0x3b')][_0xb490('0x29')]?_0x56a1be[_0xb490('0x3b')][_0xb490('0x29')]:!![];var _0x4dcff5=_0x56a1be[_0xb490('0x3b')][_0xb490('0xa4')]?_0x56a1be[_0xb490('0x3b')][_0xb490('0xa4')]:null;var _0x1f4d53={'method':_0x56a1be[_0xb490('0xa5')],'uri':util[_0xb490('0x68')](_0xb490('0xa6'),_0x3281cc,_0x56a1be['query'][_0xb490('0x6')]),'json':_0x1fe6d2,'resolveWithFullResponse':!![],'encoding':_0x4dcff5,'qs':_0x56a1be['query']};if(_0x56a1be['headers']){_0x1f4d53[_0xb490('0xa7')]=_0x56a1be[_0xb490('0xa7')];if(_0x1f4d53['headers']['content-length']){delete _0x1f4d53[_0xb490('0xa7')][_0xb490('0xa8')];}}if(_0x1f4d53[_0xb490('0xa7')][_0xb490('0xa9')]){delete _0x1f4d53[_0xb490('0xa7')][_0xb490('0xa9')];}return rp(_0x1f4d53);})[_0xb490('0x2e')](function(_0x29b983){if(_0x29b983){_0xa9f846['set'](_0x29b983[_0xb490('0xa7')]);logger[_0xb490('0x6b')](_0x29b983[_0xb490('0x94')]);if(_['endsWith'](_0x56a1be[_0xb490('0x3b')][_0xb490('0x6')],_0xb490('0x51'))&&_0x29b983[_0xb490('0xaa')]==0x1f4){return _0xa9f846['sendStatus'](_0x29b983[_0xb490('0xaa')]);}else{return _0xa9f846['status'](_0x29b983[_0xb490('0xaa')])[_0xb490('0x33')](_0x29b983[_0xb490('0x94')]);}}else{return _0xa9f846[_0xb490('0x20')](0xc8);}})[_0xb490('0x4c')](handleError(_0xa9f846,null));};exports[_0xb490('0xab')]=function(_0x3576b4,_0x37f91c,_0x246683){return BPromise[_0xb490('0xac')]()[_0xb490('0x2e')](function(){if(!_0x3576b4[_0xb490('0x3b')][_0xb490('0x6')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3576b4['query'][_0xb490('0xa1')]){throw new Error(_0xb490('0xa2'));}var _0x1865e9=_0x3576b4[_0xb490('0x3b')]['hostname']?_0x3576b4[_0xb490('0x3b')][_0xb490('0xa3')]+':'+_0x3576b4[_0xb490('0x3b')][_0xb490('0xa1')]:_0xb490('0xad')+_0x3576b4['query'][_0xb490('0xa1')];var _0x3d7409=_0x3576b4[_0xb490('0x3b')][_0xb490('0x29')]?_0x3576b4[_0xb490('0x3b')][_0xb490('0x29')]:!![];var _0x15b520=_0x3576b4[_0xb490('0x3b')]['encoding']?_0x3576b4[_0xb490('0x3b')][_0xb490('0xa4')]:null;var _0x48e8e3={'method':_0x3576b4['method'],'uri':util[_0xb490('0x68')](_0xb490('0xa6'),_0x1865e9,_0x3576b4[_0xb490('0x3b')][_0xb490('0x6')]),'json':_0x3d7409,'resolveWithFullResponse':!![],'encoding':_0x15b520,'body':_0x3576b4[_0xb490('0x94')]};if(_0x3576b4[_0xb490('0xa7')]){_0x48e8e3[_0xb490('0xa7')]=_0x3576b4[_0xb490('0xa7')];if(_0x48e8e3[_0xb490('0xa7')]['content-length']){delete _0x48e8e3[_0xb490('0xa7')][_0xb490('0xa8')];}}if(_0x48e8e3['headers'][_0xb490('0xa9')]){delete _0x48e8e3['headers'][_0xb490('0xa9')];}return rp(_0x48e8e3);})[_0xb490('0x2e')](function(_0x152fd2){if(_0x152fd2){_0x37f91c[_0xb490('0x27')](_0x152fd2['headers']);logger[_0xb490('0x6b')](_0x152fd2[_0xb490('0x94')]);return _0x37f91c[_0xb490('0x21')](_0x152fd2['statusCode'])[_0xb490('0x33')](_0x152fd2[_0xb490('0x94')]);}else{return _0x37f91c['sendStatus'](0xc8);}})[_0xb490('0x4c')](handleError(_0x37f91c,null));}; \ No newline at end of file +var _0xcb86=['index','map','Plugin','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','type','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','merge','find','download','join','server/files/plugins','%s.zip','basename','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','glob','**/*','root','dirname','node_modules/**/*','attachments/**/*','finalize','close','Plugin\x20not\x20found','format','unlinkSync','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','version','test','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','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','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','headers','content-length','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','%s%s','content-type','eml-format','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','save','update','then','get','Plugins','destroy','error','stack','name','send'];(function(_0x21b74b,_0x543c76){var _0x518cc6=function(_0x5b3010){while(--_0x5b3010){_0x21b74b['push'](_0x21b74b['shift']());}};_0x518cc6(++_0x543c76);}(_0xcb86,0x78));var _0x6cb8=function(_0x47ba70,_0x8fd4c8){_0x47ba70=_0x47ba70-0x0;var _0x3eea35=_0xcb86[_0x47ba70];return _0x3eea35;};'use strict';var emlformat=require(_0x6cb8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6cb8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6cb8('0x2'));var Mustache=require(_0x6cb8('0x3'));var util=require('util');var path=require(_0x6cb8('0x4'));var sox=require(_0x6cb8('0x5'));var csv=require(_0x6cb8('0x6'));var ejs=require(_0x6cb8('0x7'));var fs=require('fs');var fs_extra=require(_0x6cb8('0x8'));var _=require(_0x6cb8('0x9'));var squel=require(_0x6cb8('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6cb8('0xb'));var toCsv=require(_0x6cb8('0x6'));var querystring=require(_0x6cb8('0xc'));var Papa=require(_0x6cb8('0xd'));var extract=require('extract-zip');var rimraf=require(_0x6cb8('0xe'));var archiver=require(_0x6cb8('0xf'));var Redis=require(_0x6cb8('0x10'));var authService=require(_0x6cb8('0x11'));var qs=require(_0x6cb8('0x12'));var as=require(_0x6cb8('0x13'));var hardwareService=require(_0x6cb8('0x14'));var logger=require(_0x6cb8('0x15'))(_0x6cb8('0x16'));var utils=require(_0x6cb8('0x17'));var config=require(_0x6cb8('0x18'));var licenseUtil=require(_0x6cb8('0x19'));var db=require(_0x6cb8('0x1a'))['db'];config[_0x6cb8('0x1b')]=_[_0x6cb8('0x1c')](config[_0x6cb8('0x1b')],{'host':_0x6cb8('0x1d'),'port':0x18eb});var socket=require(_0x6cb8('0x1e'))(new Redis(config[_0x6cb8('0x1b')]));require(_0x6cb8('0x1f'))[_0x6cb8('0x20')](socket);function respondWithStatusCode(_0x47f9d1,_0x38b5ee){_0x38b5ee=_0x38b5ee||0xcc;return function(_0x35936b){if(_0x35936b){return _0x47f9d1[_0x6cb8('0x21')](_0x38b5ee);}return _0x47f9d1[_0x6cb8('0x22')](_0x38b5ee)[_0x6cb8('0x23')]();};}function respondWithResult(_0x5ea030,_0x169337){_0x169337=_0x169337||0xc8;return function(_0x5df3bd){if(_0x5df3bd){return _0x5ea030[_0x6cb8('0x22')](_0x169337)[_0x6cb8('0x24')](_0x5df3bd);}};}function respondWithFilteredResult(_0x519c5a,_0x391921){return function(_0xfa8f79){if(_0xfa8f79){var _0x3dc986=typeof _0x391921[_0x6cb8('0x25')]===_0x6cb8('0x26')&&typeof _0x391921[_0x6cb8('0x27')]===_0x6cb8('0x26');var _0x51f254=_0xfa8f79['count'];var _0x2d54a4=_0x3dc986?0x0:_0x391921[_0x6cb8('0x25')];var _0x13452b=_0x3dc986?_0xfa8f79[_0x6cb8('0x28')]:_0x391921['offset']+_0x391921[_0x6cb8('0x27')];var _0x5bb028;if(_0x13452b>=_0x51f254){_0x13452b=_0x51f254;_0x5bb028=0xc8;}else{_0x5bb028=0xce;}_0x519c5a['status'](_0x5bb028);return _0x519c5a[_0x6cb8('0x29')]('Content-Range',_0x2d54a4+'-'+_0x13452b+'/'+_0x51f254)['json'](_0xfa8f79);}return null;};}function patchUpdates(_0x1fc319){return function(_0x2e36ae){try{jsonpatch['apply'](_0x2e36ae,_0x1fc319,!![]);}catch(_0x209529){return BPromise['reject'](_0x209529);}return _0x2e36ae[_0x6cb8('0x2a')]();};}function saveUpdates(_0x1a6582,_0x2c2c3b){return function(_0x535b85){if(_0x535b85){return _0x535b85[_0x6cb8('0x2b')](_0x1a6582)[_0x6cb8('0x2c')](function(_0x33d401){return _0x33d401;});}return null;};}function removeEntity(_0x16b67d,_0xde9b87){return function(_0x10af5c){if(_0x10af5c){return _0x10af5c['destroy']()[_0x6cb8('0x2c')](function(){var _0x4d040d=_0x10af5c[_0x6cb8('0x2d')]({'plain':!![]});var _0x46524e=_0x6cb8('0x2e');return db['UserProfileResource'][_0x6cb8('0x2f')]({'where':{'type':_0x46524e,'resourceId':_0x4d040d['id']}})['then'](function(){return _0x10af5c;});})[_0x6cb8('0x2c')](function(){_0x16b67d[_0x6cb8('0x22')](0xcc)[_0x6cb8('0x23')]();});}};}function handleEntityNotFound(_0x427ed4,_0x59729f){return function(_0x5d8766){if(!_0x5d8766){_0x427ed4[_0x6cb8('0x21')](0x194);}return _0x5d8766;};}function handleError(_0x3159b8,_0x2ef696){_0x2ef696=_0x2ef696||0x1f4;return function(_0x3d3726){logger[_0x6cb8('0x30')](_0x3d3726[_0x6cb8('0x31')]);if(_0x3d3726['name']){delete _0x3d3726[_0x6cb8('0x32')];}_0x3159b8[_0x6cb8('0x22')](_0x2ef696)[_0x6cb8('0x33')](_0x3d3726);};}exports[_0x6cb8('0x34')]=function(_0x1d62d3,_0x21172e){var _0xe0b5d9={},_0x33efe5={},_0x427cdb={'count':0x0,'rows':[]};var _0x43b416=_[_0x6cb8('0x35')](db[_0x6cb8('0x36')]['rawAttributes'],function(_0x33a002){return{'name':_0x33a002[_0x6cb8('0x37')],'type':_0x33a002['type'][_0x6cb8('0x38')]};});_0x33efe5['model']=_['map'](_0x43b416,_0x6cb8('0x32'));_0x33efe5[_0x6cb8('0x39')]=_[_0x6cb8('0x3a')](_0x1d62d3[_0x6cb8('0x39')]);_0x33efe5['filters']=_[_0x6cb8('0x3b')](_0x33efe5[_0x6cb8('0x3c')],_0x33efe5[_0x6cb8('0x39')]);_0xe0b5d9[_0x6cb8('0x3d')]=_[_0x6cb8('0x3b')](_0x33efe5[_0x6cb8('0x3c')],qs[_0x6cb8('0x3e')](_0x1d62d3['query'][_0x6cb8('0x3e')]));_0xe0b5d9[_0x6cb8('0x3d')]=_0xe0b5d9['attributes'][_0x6cb8('0x3f')]?_0xe0b5d9[_0x6cb8('0x3d')]:_0x33efe5[_0x6cb8('0x3c')];if(!_0x1d62d3[_0x6cb8('0x39')][_0x6cb8('0x40')](_0x6cb8('0x41'))){_0xe0b5d9[_0x6cb8('0x27')]=qs[_0x6cb8('0x27')](_0x1d62d3['query'][_0x6cb8('0x27')]);_0xe0b5d9['offset']=qs[_0x6cb8('0x25')](_0x1d62d3[_0x6cb8('0x39')][_0x6cb8('0x25')]);}_0xe0b5d9[_0x6cb8('0x42')]=qs['sort'](_0x1d62d3[_0x6cb8('0x39')]['sort']);_0xe0b5d9[_0x6cb8('0x43')]=qs[_0x6cb8('0x44')](_[_0x6cb8('0x45')](_0x1d62d3[_0x6cb8('0x39')],_0x33efe5['filters']),_0x43b416);if(_0x1d62d3[_0x6cb8('0x39')]['filter']){_0xe0b5d9[_0x6cb8('0x43')]=_['merge'](_0xe0b5d9[_0x6cb8('0x43')],{'$or':_['map'](_0x43b416,function(_0x323832){if(_0x323832[_0x6cb8('0x46')]!==_0x6cb8('0x47')){var _0x4d1ea2={};_0x4d1ea2[_0x323832[_0x6cb8('0x32')]]={'$like':'%'+_0x1d62d3[_0x6cb8('0x39')]['filter']+'%'};return _0x4d1ea2;}})});}_0xe0b5d9=_['merge']({},_0xe0b5d9,_0x1d62d3['options']);var _0x154cfb={'where':_0xe0b5d9['where']};return db[_0x6cb8('0x36')][_0x6cb8('0x28')](_0x154cfb)[_0x6cb8('0x2c')](function(_0x2862e7){_0x427cdb[_0x6cb8('0x28')]=_0x2862e7;if(_0x1d62d3[_0x6cb8('0x39')][_0x6cb8('0x48')]){_0xe0b5d9[_0x6cb8('0x49')]=[{'all':!![]}];}return db['Plugin'][_0x6cb8('0x4a')](_0xe0b5d9);})[_0x6cb8('0x2c')](function(_0x2ea991){_0x427cdb['rows']=_0x2ea991;return _0x427cdb;})[_0x6cb8('0x2c')](respondWithFilteredResult(_0x21172e,_0xe0b5d9))[_0x6cb8('0x4b')](handleError(_0x21172e,null));};exports[_0x6cb8('0x4c')]=function(_0x579a58,_0x9c1ecb){var _0x5d2ed7={'raw':!![],'where':{'id':_0x579a58[_0x6cb8('0x4d')]['id']}},_0x99ded6={};_0x99ded6['model']=_[_0x6cb8('0x3a')](db[_0x6cb8('0x36')][_0x6cb8('0x4e')]);_0x99ded6[_0x6cb8('0x39')]=_[_0x6cb8('0x3a')](_0x579a58['query']);_0x99ded6[_0x6cb8('0x44')]=_[_0x6cb8('0x3b')](_0x99ded6[_0x6cb8('0x3c')],_0x99ded6[_0x6cb8('0x39')]);_0x5d2ed7[_0x6cb8('0x3d')]=_[_0x6cb8('0x3b')](_0x99ded6[_0x6cb8('0x3c')],qs[_0x6cb8('0x3e')](_0x579a58[_0x6cb8('0x39')][_0x6cb8('0x3e')]));_0x5d2ed7[_0x6cb8('0x3d')]=_0x5d2ed7[_0x6cb8('0x3d')][_0x6cb8('0x3f')]?_0x5d2ed7[_0x6cb8('0x3d')]:_0x99ded6[_0x6cb8('0x3c')];if(_0x579a58[_0x6cb8('0x39')][_0x6cb8('0x48')]){_0x5d2ed7['include']=[{'all':!![]}];}_0x5d2ed7=_[_0x6cb8('0x4f')]({},_0x5d2ed7,_0x579a58['options']);return db['Plugin'][_0x6cb8('0x50')](_0x5d2ed7)['then'](handleEntityNotFound(_0x9c1ecb,null))[_0x6cb8('0x2c')](respondWithResult(_0x9c1ecb,null))[_0x6cb8('0x4b')](handleError(_0x9c1ecb,null));};exports[_0x6cb8('0x51')]=function(_0x35a172,_0x15d0b2,_0x4606f6){return db[_0x6cb8('0x36')][_0x6cb8('0x50')]({'where':{'id':_0x35a172['params']['id']},'attributes':[_0x6cb8('0x32'),_0x6cb8('0x4')],'raw':!![]})[_0x6cb8('0x2c')](handleEntityNotFound(_0x15d0b2,null))[_0x6cb8('0x2c')](function(_0x362a19){if(_0x362a19){var _0x52bcb2=path[_0x6cb8('0x52')](config['root'],_0x6cb8('0x53'),util['format'](_0x6cb8('0x54'),path[_0x6cb8('0x55')](_0x362a19['path'])));var _0x9a076f=fs['createWriteStream'](_0x52bcb2);var _0x2006e9=archiver('zip',{'zlib':{'level':0x9}});_0x2006e9['on'](_0x6cb8('0x56'),function(_0xf75bfc){if(_0xf75bfc[_0x6cb8('0x57')]===_0x6cb8('0x58')){logger[_0x6cb8('0x30')](_0xf75bfc);}else{throw new db[(_0x6cb8('0x59'))]['Error'](_0x6cb8('0x5a'));}});_0x2006e9['on'](_0x6cb8('0x30'),function(_0x38f526){throw new db[(_0x6cb8('0x59'))][(_0x6cb8('0x5b'))](_0x6cb8('0x5a'));});_0x2006e9['pipe'](_0x9a076f);_0x2006e9[_0x6cb8('0x5c')](_0x6cb8('0x5d'),{'cwd':path[_0x6cb8('0x52')](config[_0x6cb8('0x5e')],_0x6cb8('0x53'),path[_0x6cb8('0x5f')](_0x362a19['path'])),'ignore':[path['join'](path[_0x6cb8('0x55')](_0x362a19[_0x6cb8('0x4')]),_0x6cb8('0x60')),path[_0x6cb8('0x52')](path[_0x6cb8('0x55')](_0x362a19[_0x6cb8('0x4')]),_0x6cb8('0x61'))],'nodir':!![]})[_0x6cb8('0x62')]();_0x9a076f['on'](_0x6cb8('0x63'),function(){if(!fs['existsSync'](_0x52bcb2)){throw new db[(_0x6cb8('0x59'))][(_0x6cb8('0x5b'))](_0x6cb8('0x64'));}return _0x15d0b2['download'](_0x52bcb2,util[_0x6cb8('0x65')](_0x6cb8('0x54'),path[_0x6cb8('0x55')](_0x362a19[_0x6cb8('0x4')])),function(_0x46da45){if(_0x46da45){throw new db['Sequelize'][(_0x6cb8('0x5b'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0x6cb8('0x66')](_0x52bcb2);logger[_0x6cb8('0x67')]('Download\x20completed');logger[_0x6cb8('0x67')](_0x6cb8('0x68'));});});}return null;})[_0x6cb8('0x4b')](handleError(_0x15d0b2,null));};exports[_0x6cb8('0x69')]=function(_0x202aee,_0x2ca41e,_0x4904f6){var _0x3cae25=path['basename'](_0x202aee[_0x6cb8('0x6a')][_0x6cb8('0x6b')],path[_0x6cb8('0x6c')](_0x202aee[_0x6cb8('0x6a')][_0x6cb8('0x6b')]));var _0x2fa147=path['join'](config[_0x6cb8('0x5e')],_0x6cb8('0x53'),_0x202aee['file'][_0x6cb8('0x6b')]);var _0xe76290=path[_0x6cb8('0x52')](config['root'],_0x6cb8('0x53'),_0x3cae25);logger[_0x6cb8('0x67')](_0x6cb8('0x6d'),_0x2fa147);logger[_0x6cb8('0x67')]('Plugin\x20upload\x20destination:\x20%s',_0xe76290);try{fs[_0x6cb8('0x6e')](_0x2fa147,parseInt(_0x6cb8('0x6f'),0x8));extract(_0x2fa147,{'dir':_0xe76290},function(_0xa92a30){if(_0xa92a30){logger[_0x6cb8('0x30')](_0xa92a30);handleError(_0xa92a30,!![]);};var _0x39b530=fs[_0x6cb8('0x70')](_0xe76290);if(_0x39b530[_0x6cb8('0x3f')]>0x1){removeReferences(_0x2fa147,_0xe76290);logger[_0x6cb8('0x30')](_0x6cb8('0x71'));return _0x4904f6(new Error(_0x6cb8('0x71')));}var _0x25edd2=fs[_0x6cb8('0x72')](path[_0x6cb8('0x52')](_0xe76290,_0x39b530[0x0]));if(_0x25edd2['isFile']()){removeReferences(_0x2fa147,_0xe76290);logger[_0x6cb8('0x30')](_0x6cb8('0x71'));return _0x4904f6(new Error('Invalid\x20plugin\x20structure'));}if(_0x25edd2['isDirectory']()){var _0x38d002=fs[_0x6cb8('0x70')](path[_0x6cb8('0x52')](_0xe76290,_0x39b530[0x0]));if(_0x38d002[_0x6cb8('0x3f')]===0x0){removeReferences(_0x2fa147,_0xe76290);logger[_0x6cb8('0x30')](_0x6cb8('0x71'));return _0x4904f6(new Error(_0x6cb8('0x71')));}var _0x48cc65=_0x38d002[_0x6cb8('0x73')](function(_0x51802d){return _0x51802d===_0x6cb8('0x74');});if(!_0x48cc65){return _0x4904f6(new Error(_0x6cb8('0x75')));}var _0x789b4f=fs[_0x6cb8('0x76')](path[_0x6cb8('0x52')](_0xe76290,_0x39b530[0x0],'manifest.json'));var _0x27e602=JSON['parse'](_0x789b4f);if('undefined'==typeof _0x27e602[_0x6cb8('0x32')]){return _0x4904f6(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x6cb8('0x26')==typeof _0x27e602[_0x6cb8('0x46')]){return _0x4904f6(new Error(_0x6cb8('0x77')));}if(_0x6cb8('0x26')==typeof _0x27e602['version']){return _0x4904f6(new Error(_0x6cb8('0x78')));}if(_0x6cb8('0x26')==typeof _0x27e602['parameters']){return _0x4904f6(new Error(_0x6cb8('0x79')));}if(_0x27e602['type']===_0x6cb8('0x7a')){if(_0x6cb8('0x26')==typeof _0x27e602[_0x6cb8('0x7b')][_0x6cb8('0x7c')]){return _0x4904f6(new Error(_0x6cb8('0x7d')));}if(_0x6cb8('0x26')==typeof _0x27e602['parameters'][_0x6cb8('0x7c')][_0x6cb8('0x7e')]&&_0x6cb8('0x26')==typeof _0x27e602[_0x6cb8('0x7b')]['views']['agent']){return _0x4904f6(new Error(_0x6cb8('0x7f')));}}else if(_0x27e602[_0x6cb8('0x46')]==='script'){if(_0x6cb8('0x26')==typeof _0x27e602['parameters']['scriptName']){return _0x4904f6(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0x6cb8('0x26')==typeof _0x27e602[_0x6cb8('0x7b')][_0x6cb8('0x80')]){return _0x4904f6(new Error(_0x6cb8('0x81')));}}else{return _0x4904f6(new Error(_0x6cb8('0x82')));}var _0x2a784e=_0x27e602[_0x6cb8('0x32')];var _0x76a783=_0x27e602[_0x6cb8('0x83')];var _0x15310e=_0x27e602[_0x6cb8('0x46')];var _0x240992=_0x27e602[_0x6cb8('0x84')]?_0x27e602['sidebar']:_0x6cb8('0x85');var _0x301315=_0x27e602[_0x6cb8('0x86')]?_0x27e602[_0x6cb8('0x86')]:_0x6cb8('0x87');var _0x56900f='';var _0x4fc8d8='';var _0x35e6f5='';var _0x596b53='';var _0x557351=_0x27e602[_0x6cb8('0x88')];if(_0x15310e===_0x6cb8('0x7a')){if('undefined'!=typeof _0x27e602[_0x6cb8('0x7b')][_0x6cb8('0x7c')][_0x6cb8('0x7e')]){var _0x47307b=_0x27e602['parameters'][_0x6cb8('0x7c')][_0x6cb8('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x6cb8('0x89')](_0x47307b)){_0x56900f=path['join']('plugins',_0x3cae25,_0x39b530[0x0],_0x47307b);}else{_0x56900f=_0x47307b;}}else{logger[_0x6cb8('0x67')](_0x6cb8('0x8a'));}if(_0x6cb8('0x26')!=typeof _0x27e602['parameters'][_0x6cb8('0x7c')][_0x6cb8('0x8b')]){var _0x3c678d=_0x27e602['parameters'][_0x6cb8('0x7c')][_0x6cb8('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x6cb8('0x89')](_0x3c678d)){_0x4fc8d8=path[_0x6cb8('0x52')]('plugins',_0x3cae25,_0x39b530[0x0],_0x3c678d);}else{_0x4fc8d8=_0x3c678d;}}else{logger[_0x6cb8('0x67')](_0x6cb8('0x8c'));}}else if(_0x15310e===_0x6cb8('0x8d')){_0x35e6f5=_0x27e602[_0x6cb8('0x7b')][_0x6cb8('0x8e')];_0x596b53=_0x27e602['parameters'][_0x6cb8('0x80')];if(_0x6cb8('0x26')!=typeof _0x27e602[_0x6cb8('0x7b')][_0x6cb8('0x7c')]){if(_0x6cb8('0x26')!=typeof _0x27e602[_0x6cb8('0x7b')][_0x6cb8('0x7c')][_0x6cb8('0x7e')]){var _0x47307b=_0x27e602[_0x6cb8('0x7b')][_0x6cb8('0x7c')][_0x6cb8('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x6cb8('0x89')](_0x47307b)){_0x56900f=path[_0x6cb8('0x52')](_0x6cb8('0x8f'),_0x3cae25,_0x39b530[0x0],_0x47307b);}else{_0x56900f=_0x47307b;}}if(_0x6cb8('0x26')!=typeof _0x27e602['parameters'][_0x6cb8('0x7c')]['agent']){var _0x3c678d=_0x27e602[_0x6cb8('0x7b')][_0x6cb8('0x7c')][_0x6cb8('0x8b')];if(!/^(f|ht)tps?:\/\//i[_0x6cb8('0x89')](_0x3c678d)){_0x4fc8d8=path[_0x6cb8('0x52')]('plugins',_0x3cae25,_0x39b530[0x0],_0x3c678d);}else{_0x4fc8d8=_0x3c678d;}}}}var _0x19846a={'name':_0x2a784e,'description':_0x76a783,'path':path[_0x6cb8('0x52')](_0x3cae25,_0x39b530[0x0]),'type':_0x15310e,'sidebar':_0x240992,'icon':_0x301315,'adminUrl':_0x56900f,'agentUrl':_0x4fc8d8,'scriptName':_0x35e6f5,'scriptPath':_0x596b53,'version':_0x557351};removeReferences(_0x2fa147,null);return db[_0x6cb8('0x36')][_0x6cb8('0x90')](_0x19846a)[_0x6cb8('0x2c')](function(_0x11d50f){var _0x2a992f={'role':_0x202aee['body']['role'],'userProfileId':_0x202aee[_0x6cb8('0x91')][_0x6cb8('0x92')]};if(!_0x2a992f)throw new Error(_0x6cb8('0x93'));if(_0x2a992f[_0x6cb8('0x94')]===_0x6cb8('0x95')){var _0x4a069a=_0x11d50f['get']({'plain':!![]});return db[_0x6cb8('0x96')][_0x6cb8('0x50')]({'where':{'name':_0x6cb8('0x2e'),'userProfileId':_0x2a992f[_0x6cb8('0x92')]},'raw':!![]})[_0x6cb8('0x2c')](function(_0x4fb343){if(_0x4fb343&&_0x4fb343[_0x6cb8('0x97')]===0x0){return db['UserProfileResource'][_0x6cb8('0x90')]({'name':_0x4a069a[_0x6cb8('0x32')],'resourceId':_0x4a069a['id'],'type':_0x4fb343['name'],'sectionId':_0x4fb343['id']},{})[_0x6cb8('0x2c')](function(){return _0x11d50f;});}else{return _0x11d50f;}})[_0x6cb8('0x4b')](function(_0x216910){logger[_0x6cb8('0x30')](_0x6cb8('0x98'),_0x216910);throw _0x216910;});}return _0x11d50f;})['then'](respondWithResult(_0x2ca41e,null))['catch'](handleError(_0x2ca41e,null));}});}catch(_0x433015){_0x2ca41e[_0x6cb8('0x22')](0x1f4)['send'](_0x433015);}};function removeReferences(_0x72a4d8,_0x29270a){try{if(_0x72a4d8){fs[_0x6cb8('0x66')](_0x72a4d8);logger['info'](_0x6cb8('0x99'));}if(_0x29270a){rimraf(_0x29270a,function(){});logger[_0x6cb8('0x67')](_0x6cb8('0x9a'));}}catch(_0x588771){logger['error'](_0x588771);}}exports['update']=function(_0x19466,_0x33a170,_0xf7aeb7){return db['Plugin'][_0x6cb8('0x50')]({'where':{'id':_0x19466[_0x6cb8('0x4d')]['id']}})[_0x6cb8('0x2c')](handleEntityNotFound(_0x33a170,null))[_0x6cb8('0x2c')](saveUpdates(_0x19466[_0x6cb8('0x91')],null))[_0x6cb8('0x2c')](respondWithResult(_0x33a170,null))[_0x6cb8('0x4b')](handleError(_0x33a170,null));};exports[_0x6cb8('0x9b')]=function(_0xdc3a3a,_0x37f30a,_0x2cae5e){return db[_0x6cb8('0x36')][_0x6cb8('0x50')]({'where':{'id':_0xdc3a3a[_0x6cb8('0x4d')]['id']}})['then'](function(_0x13dd1b){if(_0x13dd1b){return _0x13dd1b['destroy']();}})['then'](function(_0x5d52eb){rimraf(path[_0x6cb8('0x52')](config['root'],_0x6cb8('0x53'),path[_0x6cb8('0x5f')](_0x5d52eb[_0x6cb8('0x4')])),function(){});return _0x5d52eb;})[_0x6cb8('0x2c')](handleEntityNotFound(_0x37f30a,null))[_0x6cb8('0x2c')](respondWithStatusCode(_0x37f30a,null))['catch'](handleError(_0x37f30a,null));};exports[_0x6cb8('0x9c')]=function(_0xd47149,_0x230fa7,_0x7c1438){return BPromise[_0x6cb8('0x9d')]()['then'](function(){if(!_0xd47149[_0x6cb8('0x39')]['path']){throw new Error(_0x6cb8('0x9e'));}if(!_0xd47149[_0x6cb8('0x39')][_0x6cb8('0x9f')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x540c5d=_0xd47149[_0x6cb8('0x39')][_0x6cb8('0xa0')]?_0xd47149[_0x6cb8('0x39')]['hostname']+':'+_0xd47149[_0x6cb8('0x39')]['port']:_0x6cb8('0xa1')+_0xd47149['query']['port'];var _0x2b8d0e=_0xd47149['query'][_0x6cb8('0x24')]?_0xd47149[_0x6cb8('0x39')][_0x6cb8('0x24')]:!![];var _0x2bcc41=_0xd47149['query']['encoding']?_0xd47149[_0x6cb8('0x39')][_0x6cb8('0xa2')]:null;var _0x37cad6={'method':_0xd47149[_0x6cb8('0xa3')],'uri':util[_0x6cb8('0x65')]('%s%s',_0x540c5d,_0xd47149[_0x6cb8('0x39')][_0x6cb8('0x4')]),'json':_0x2b8d0e,'resolveWithFullResponse':!![],'encoding':_0x2bcc41,'qs':_0xd47149[_0x6cb8('0x39')]};if(_0xd47149[_0x6cb8('0xa4')]){_0x37cad6[_0x6cb8('0xa4')]=_0xd47149['headers'];if(_0x37cad6['headers'][_0x6cb8('0xa5')]){delete _0x37cad6[_0x6cb8('0xa4')][_0x6cb8('0xa5')];}}if(_0x37cad6['headers']['content-type']){delete _0x37cad6[_0x6cb8('0xa4')]['content-type'];}return rp(_0x37cad6);})[_0x6cb8('0x2c')](function(_0x1a239b){if(_0x1a239b){_0x230fa7['set'](_0x1a239b['headers']);logger['info'](_0x1a239b['body']);if(_[_0x6cb8('0xa6')](_0xd47149[_0x6cb8('0x39')]['path'],_0x6cb8('0x51'))&&_0x1a239b[_0x6cb8('0xa7')]==0x1f4){return _0x230fa7[_0x6cb8('0x21')](_0x1a239b[_0x6cb8('0xa7')]);}else{return _0x230fa7[_0x6cb8('0x22')](_0x1a239b['statusCode'])['send'](_0x1a239b[_0x6cb8('0x91')]);}}else{return _0x230fa7['sendStatus'](0xc8);}})['catch'](handleError(_0x230fa7,null));};exports[_0x6cb8('0xa8')]=function(_0x2d6b81,_0x138956,_0x1c6c82){return BPromise['resolve']()[_0x6cb8('0x2c')](function(){if(!_0x2d6b81['query'][_0x6cb8('0x4')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2d6b81[_0x6cb8('0x39')][_0x6cb8('0x9f')]){throw new Error(_0x6cb8('0xa9'));}var _0x23e5e6=_0x2d6b81['query'][_0x6cb8('0xa0')]?_0x2d6b81['query'][_0x6cb8('0xa0')]+':'+_0x2d6b81[_0x6cb8('0x39')][_0x6cb8('0x9f')]:'http://localhost:'+_0x2d6b81[_0x6cb8('0x39')][_0x6cb8('0x9f')];var _0xbaab17=_0x2d6b81[_0x6cb8('0x39')]['json']?_0x2d6b81['query'][_0x6cb8('0x24')]:!![];var _0x8a47b5=_0x2d6b81['query'][_0x6cb8('0xa2')]?_0x2d6b81[_0x6cb8('0x39')][_0x6cb8('0xa2')]:null;var _0x1e0082={'method':_0x2d6b81[_0x6cb8('0xa3')],'uri':util[_0x6cb8('0x65')](_0x6cb8('0xaa'),_0x23e5e6,_0x2d6b81[_0x6cb8('0x39')][_0x6cb8('0x4')]),'json':_0xbaab17,'resolveWithFullResponse':!![],'encoding':_0x8a47b5,'body':_0x2d6b81[_0x6cb8('0x91')]};if(_0x2d6b81[_0x6cb8('0xa4')]){_0x1e0082[_0x6cb8('0xa4')]=_0x2d6b81['headers'];if(_0x1e0082[_0x6cb8('0xa4')][_0x6cb8('0xa5')]){delete _0x1e0082['headers'][_0x6cb8('0xa5')];}}if(_0x1e0082[_0x6cb8('0xa4')][_0x6cb8('0xab')]){delete _0x1e0082[_0x6cb8('0xa4')]['content-type'];}return rp(_0x1e0082);})[_0x6cb8('0x2c')](function(_0x485493){if(_0x485493){_0x138956[_0x6cb8('0x29')](_0x485493['headers']);logger[_0x6cb8('0x67')](_0x485493[_0x6cb8('0x91')]);return _0x138956[_0x6cb8('0x22')](_0x485493[_0x6cb8('0xa7')])['send'](_0x485493[_0x6cb8('0x91')]);}else{return _0x138956[_0x6cb8('0x21')](0xc8);}})[_0x6cb8('0x4b')](handleError(_0x138956,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 35a80d6..015177a 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0x5fc3[_0x368587];return _0x42d33c;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var Plugin=require(_0x35fc('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){PluginEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);PluginEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0x0024=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x2d32be,_0x4343cb){var _0x58bde0=function(_0x39a305){while(--_0x39a305){_0x2d32be['push'](_0x2d32be['shift']());}};_0x58bde0(++_0x4343cb);}(_0x0024,0xa8));var _0x4002=function(_0x2eda6d,_0x384926){_0x2eda6d=_0x2eda6d-0x0;var _0x437f47=_0x0024[_0x2eda6d];return _0x437f47;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x4002('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x4002('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4002('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4f3b32){return function(_0x423907,_0x1190e7,_0x5ca2fe){PluginEvents['emit'](_0x4f3b32+':'+_0x423907['id'],_0x423907);PluginEvents[_0x4002('0x3')](_0x4f3b32,_0x423907);_0x5ca2fe(null);};}for(var e in events){if(events[_0x4002('0x4')](e)){var event=events[e];Plugin[_0x4002('0x5')](e,emitEvent(event));}}module[_0x4002('0x6')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 2d8ad60..93f43fc 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 _0x28e8=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./plugin.attributes','exports','define','Plugin','plugins'];(function(_0x3c86b4,_0x431782){var _0x268334=function(_0x77a2cc){while(--_0x77a2cc){_0x3c86b4['push'](_0x3c86b4['shift']());}};_0x268334(++_0x431782);}(_0x28e8,0x1e0));var _0x828e=function(_0x4da250,_0x4a839c){_0x4da250=_0x4da250-0x0;var _0x5ab4ba=_0x28e8[_0x4da250];return _0x5ab4ba;};'use strict';var _=require(_0x828e('0x0'));var util=require('util');var logger=require(_0x828e('0x1'))(_0x828e('0x2'));var moment=require(_0x828e('0x3'));var BPromise=require(_0x828e('0x4'));var rp=require(_0x828e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x828e('0x6'));var config=require('../../config/environment');var attributes=require(_0x828e('0x7'));module[_0x828e('0x8')]=function(_0x11513c,_0x586c64){return _0x11513c[_0x828e('0x9')](_0x828e('0xa'),attributes,{'tableName':_0x828e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3261=['api','path','../../config/environment','./plugin.attributes','util','../../config/logger'];(function(_0x2ef644,_0x2ab0ff){var _0x11f00e=function(_0x32983a){while(--_0x32983a){_0x2ef644['push'](_0x2ef644['shift']());}};_0x11f00e(++_0x2ab0ff);}(_0x3261,0x7c));var _0x1326=function(_0x299ed7,_0x4f7ee4){_0x299ed7=_0x299ed7-0x0;var _0x28dfed=_0x3261[_0x299ed7];return _0x28dfed;};'use strict';var _=require('lodash');var util=require(_0x1326('0x0'));var logger=require(_0x1326('0x1'))(_0x1326('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1326('0x3'));var rimraf=require('rimraf');var config=require(_0x1326('0x4'));var attributes=require(_0x1326('0x5'));module['exports']=function(_0x10daf6,_0xb1268){return _0x10daf6['define']('Plugin',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 2b6e0a4..c424eae 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 _0xf077=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Plugin,\x20%s,\x20%s','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','moment'];(function(_0x32a486,_0x5c75fd){var _0x329274=function(_0x21ecd1){while(--_0x21ecd1){_0x32a486['push'](_0x32a486['shift']());}};_0x329274(++_0x5c75fd);}(_0xf077,0x17f));var _0x7f07=function(_0x448bbc,_0x5e6f39){_0x448bbc=_0x448bbc-0x0;var _0x27c735=_0xf077[_0x448bbc];return _0x27c735;};'use strict';var _=require(_0x7f07('0x0'));var util=require('util');var moment=require(_0x7f07('0x1'));var BPromise=require(_0x7f07('0x2'));var rs=require(_0x7f07('0x3'));var fs=require('fs');var Redis=require(_0x7f07('0x4'));var db=require(_0x7f07('0x5'))['db'];var utils=require(_0x7f07('0x6'));var logger=require(_0x7f07('0x7'))('rpc');var config=require(_0x7f07('0x8'));var jayson=require(_0x7f07('0x9'));var client=jayson[_0x7f07('0xa')][_0x7f07('0xb')]({'port':0x232a});config[_0x7f07('0xc')]=_['defaults'](config[_0x7f07('0xc')],{'host':_0x7f07('0xd'),'port':0x18eb});var socket=require(_0x7f07('0xe'))(new Redis(config['redis']));require(_0x7f07('0xf'))[_0x7f07('0x10')](socket);function respondWithRpcPromise(_0x3001f7,_0x2b2a6c,_0x2ef4c0){return new BPromise(function(_0x3fa68d,_0x266b3c){return client[_0x7f07('0x11')](_0x3001f7,_0x2ef4c0)[_0x7f07('0x12')](function(_0xeb68f9){logger['info']('Plugin,\x20%s,\x20%s',_0x2b2a6c,_0x7f07('0x13'));logger[_0x7f07('0x14')](_0x7f07('0x15'),_0x2b2a6c,'request\x20sent',JSON[_0x7f07('0x16')](_0xeb68f9));if(_0xeb68f9['error']){if(_0xeb68f9[_0x7f07('0x17')][_0x7f07('0x18')]===0x1f4){logger[_0x7f07('0x17')]('Plugin,\x20%s,\x20%s',_0x2b2a6c,_0xeb68f9[_0x7f07('0x17')][_0x7f07('0x19')]);return _0x266b3c(_0xeb68f9[_0x7f07('0x17')][_0x7f07('0x19')]);}logger['error'](_0x7f07('0x1a'),_0x2b2a6c,_0xeb68f9[_0x7f07('0x17')]['message']);return _0x3fa68d(_0xeb68f9['error']['message']);}else{logger['info'](_0x7f07('0x1a'),_0x2b2a6c,_0x7f07('0x13'));_0x3fa68d(_0xeb68f9[_0x7f07('0x1b')][_0x7f07('0x19')]);}})[_0x7f07('0x1c')](function(_0x148054){logger[_0x7f07('0x17')](_0x7f07('0x1a'),_0x2b2a6c,_0x148054);_0x266b3c(_0x148054);});});}exports[_0x7f07('0x1d')]=function(_0x6980c){var _0x5e8740=this;return new Promise(function(_0xb54635,_0x3ec02a){return db[_0x7f07('0x1e')][_0x7f07('0x1f')](_0x6980c[_0x7f07('0x20')],{'raw':_0x6980c['options']?_0x6980c[_0x7f07('0x21')][_0x7f07('0x22')]===undefined?!![]:![]:!![]})[_0x7f07('0x12')](function(_0x5d6b76){logger['info']('CreatePlugin',_0x6980c);logger['debug']('CreatePlugin',_0x6980c,JSON['stringify'](_0x5d6b76));_0xb54635(_0x5d6b76);})[_0x7f07('0x1c')](function(_0x29b7e4){logger[_0x7f07('0x17')](_0x7f07('0x1d'),_0x29b7e4[_0x7f07('0x19')],_0x6980c);_0x3ec02a(_0x5e8740[_0x7f07('0x17')](0x1f4,_0x29b7e4['message']));});});}; \ No newline at end of file +var _0x9972=['socket.io-emitter','./plugin.socket','register','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','Plugin','create','body','options','raw','CreatePlugin','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0xfb42e6,_0x5f5d4b){var _0x27265b=function(_0x163e81){while(--_0x163e81){_0xfb42e6['push'](_0xfb42e6['shift']());}};_0x27265b(++_0x5f5d4b);}(_0x9972,0xeb));var _0x2997=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9972[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x2997('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2997('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2997('0x2'))['db'];var utils=require(_0x2997('0x3'));var logger=require(_0x2997('0x4'))(_0x2997('0x5'));var config=require(_0x2997('0x6'));var jayson=require(_0x2997('0x7'));var client=jayson[_0x2997('0x8')][_0x2997('0x9')]({'port':0x232a});config[_0x2997('0xa')]=_[_0x2997('0xb')](config[_0x2997('0xa')],{'host':_0x2997('0xc'),'port':0x18eb});var socket=require(_0x2997('0xd'))(new Redis(config['redis']));require(_0x2997('0xe'))[_0x2997('0xf')](socket);function respondWithRpcPromise(_0x2e9b7a,_0x484dc4,_0x3729df){return new BPromise(function(_0x4b1fd0,_0x1b0b0a){return client['request'](_0x2e9b7a,_0x3729df)['then'](function(_0x58cd8e){logger[_0x2997('0x10')](_0x2997('0x11'),_0x484dc4,_0x2997('0x12'));logger[_0x2997('0x13')]('Plugin,\x20%s,\x20%s,\x20%s',_0x484dc4,'request\x20sent',JSON[_0x2997('0x14')](_0x58cd8e));if(_0x58cd8e[_0x2997('0x15')]){if(_0x58cd8e['error'][_0x2997('0x16')]===0x1f4){logger[_0x2997('0x15')](_0x2997('0x11'),_0x484dc4,_0x58cd8e[_0x2997('0x15')][_0x2997('0x17')]);return _0x1b0b0a(_0x58cd8e[_0x2997('0x15')]['message']);}logger[_0x2997('0x15')](_0x2997('0x11'),_0x484dc4,_0x58cd8e['error']['message']);return _0x4b1fd0(_0x58cd8e[_0x2997('0x15')][_0x2997('0x17')]);}else{logger[_0x2997('0x10')]('Plugin,\x20%s,\x20%s',_0x484dc4,_0x2997('0x12'));_0x4b1fd0(_0x58cd8e['result'][_0x2997('0x17')]);}})[_0x2997('0x18')](function(_0x12cb98){logger[_0x2997('0x15')]('Plugin,\x20%s,\x20%s',_0x484dc4,_0x12cb98);_0x1b0b0a(_0x12cb98);});});}exports['CreatePlugin']=function(_0x592761){var _0x2bc0fa=this;return new Promise(function(_0x19a325,_0x4578a4){return db[_0x2997('0x19')][_0x2997('0x1a')](_0x592761[_0x2997('0x1b')],{'raw':_0x592761[_0x2997('0x1c')]?_0x592761['options'][_0x2997('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x10ff97){logger[_0x2997('0x10')]('CreatePlugin',_0x592761);logger[_0x2997('0x13')](_0x2997('0x1e'),_0x592761,JSON[_0x2997('0x14')](_0x10ff97));_0x19a325(_0x10ff97);})[_0x2997('0x18')](function(_0x154ccf){logger[_0x2997('0x15')]('CreatePlugin',_0x154ccf[_0x2997('0x17')],_0x592761);_0x4578a4(_0x2bc0fa[_0x2997('0x15')](0x1f4,_0x154ccf[_0x2997('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index b94edab..8df1802 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 _0xfe47=['remove','update','emit','removeListener','length','plugin:','./plugin.events'];(function(_0x449b54,_0x3776f3){var _0x32d6b9=function(_0xbce7c4){while(--_0xbce7c4){_0x449b54['push'](_0x449b54['shift']());}};_0x32d6b9(++_0x3776f3);}(_0xfe47,0xd1));var _0x7fe4=function(_0x4b3358,_0x5cda77){_0x4b3358=_0x4b3358-0x0;var _0x1ea011=_0xfe47[_0x4b3358];return _0x1ea011;};'use strict';var PluginEvents=require(_0x7fe4('0x0'));var events=['save',_0x7fe4('0x1'),_0x7fe4('0x2')];function createListener(_0x54c751,_0x3e67f4){return function(_0x41740e){_0x3e67f4[_0x7fe4('0x3')](_0x54c751,_0x41740e);};}function removeListener(_0xe804bb,_0x2298bb){return function(){PluginEvents[_0x7fe4('0x4')](_0xe804bb,_0x2298bb);};}exports['register']=function(_0x148743){for(var _0x47f307=0x0,_0x144b19=events[_0x7fe4('0x5')];_0x47f307<_0x144b19;_0x47f307++){var _0x166a07=events[_0x47f307];var _0x5cf1f1=createListener(_0x7fe4('0x6')+_0x166a07,_0x148743);PluginEvents['on'](_0x166a07,_0x5cf1f1);}}; \ No newline at end of file +var _0xdcf6=['plugin:','./plugin.events','save','remove','emit','register','length'];(function(_0x3d292f,_0x3c56dc){var _0xbafb5c=function(_0x34e99f){while(--_0x34e99f){_0x3d292f['push'](_0x3d292f['shift']());}};_0xbafb5c(++_0x3c56dc);}(_0xdcf6,0x189));var _0x6dcf=function(_0x280587,_0x4e9971){_0x280587=_0x280587-0x0;var _0x3b7543=_0xdcf6[_0x280587];return _0x3b7543;};'use strict';var PluginEvents=require(_0x6dcf('0x0'));var events=[_0x6dcf('0x1'),_0x6dcf('0x2'),'update'];function createListener(_0xe88066,_0x989526){return function(_0x50470f){_0x989526[_0x6dcf('0x3')](_0xe88066,_0x50470f);};}function removeListener(_0x35429f,_0x402121){return function(){PluginEvents['removeListener'](_0x35429f,_0x402121);};}exports[_0x6dcf('0x4')]=function(_0x4ba4bb){for(var _0xc17471=0x0,_0x5b02d2=events[_0x6dcf('0x5')];_0xc17471<_0x5b02d2;_0xc17471++){var _0x14c7c2=events[_0xc17471];var _0x36fdbf=createListener(_0x6dcf('0x6')+_0x14c7c2,_0x4ba4bb);PluginEvents['on'](_0x14c7c2,_0x36fdbf);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 808c5fa..249299e 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(_0x1a08ba,_0x51b51d){var _0x2e66ba=function(_0x52dd88){while(--_0x52dd88){_0x1a08ba['push'](_0x1a08ba['shift']());}};_0x2e66ba(++_0x51b51d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x202d3d,_0x5beba3){var _0xc28de5=function(_0x5b197d){while(--_0x5b197d){_0x202d3d['push'](_0x202d3d['shift']());}};_0xc28de5(++_0x5beba3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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 5656733..dc112d0 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 _0x2dae=['stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','sendStatus','status','json','error'];(function(_0x4afe3b,_0x255e0d){var _0x2c22d1=function(_0x313847){while(--_0x313847){_0x4afe3b['push'](_0x4afe3b['shift']());}};_0x2c22d1(++_0x255e0d);}(_0x2dae,0xc3));var _0xe2da=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0x2dae[_0x3438cf];return _0x278698;};'use strict';var _=require(_0xe2da('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var path=require(_0xe2da('0x3'));var exec=require(_0xe2da('0x4'))[_0xe2da('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x25b9f2,_0x439b5d){return function(_0x77e45e){if(!_0x77e45e){_0x25b9f2[_0xe2da('0x6')](0x194);;}return _0x77e45e;};}function respondWithResult(_0x523c60,_0x3e3e25){_0x3e3e25=_0x3e3e25||0xc8;return function(_0x89c70b){if(_0x89c70b){return _0x523c60[_0xe2da('0x7')](_0x3e3e25)[_0xe2da('0x8')](_0x89c70b);}return null;};}function handleError(_0x238da3,_0x1c71ea){_0x1c71ea=_0x1c71ea||0x1f4;return function(_0x29960a){logger[_0xe2da('0x9')](_0x29960a[_0xe2da('0xa')]);if(_0x29960a['name']){delete _0x29960a[_0xe2da('0xb')];}_0x238da3[_0xe2da('0x7')](_0x1c71ea)[_0xe2da('0xc')](_0x29960a);};}function execChildProcess(){return new BPromise(function(_0x17086c,_0x3c1309){exec(_0xe2da('0xd'),function(_0x1a29b9,_0x173244,_0x5aab71){logger[_0xe2da('0xe')](_0x173244);logger['info'](_0x5aab71);if(_0x1a29b9){logger[_0xe2da('0x9')](_0x1a29b9);return _0x3c1309(_0x1a29b9);}return _0x17086c(_0x173244);});});}exports[_0xe2da('0xf')]=function(_0x37064e,_0x411b9f){return pm2[_0xe2da('0x10')]()[_0xe2da('0x11')](function(_0x295a86){if(_0x295a86){var _0x48584b=_[_0xe2da('0x12')](_0x295a86,function(_0x5e1702){return _0x5e1702['name']===_0xe2da('0x13')||_0x5e1702[_0xe2da('0xb')]===_0xe2da('0x14');});return{'rows':_0x48584b,'count':_0x48584b['length']};}return null;})[_0xe2da('0x11')](respondWithResult(_0x411b9f,null))[_0xe2da('0x15')](handleError(_0x411b9f,null));};exports[_0xe2da('0x16')]=function(_0x33568f,_0x4e1623){return pm2[_0xe2da('0x17')](_0x33568f[_0xe2da('0x18')]['id'])[_0xe2da('0x11')](respondWithResult(_0x4e1623,null))[_0xe2da('0x11')](handleEntityNotFound(_0x4e1623,null))[_0xe2da('0x15')](handleError(_0x4e1623,null));};exports['create']=function(_0x56eeb1,_0x2e16b2){if(_0x56eeb1['body'][_0xe2da('0xb')]&&_0x56eeb1[_0xe2da('0x19')][_0xe2da('0x1a')]){var _0x203d36=path[_0xe2da('0x1b')](__dirname,_0xe2da('0x1c'),_0x56eeb1['body'][_0xe2da('0x1a')]);var _0x53cc4e=process[_0xe2da('0x1d')]();process[_0xe2da('0x1e')](path[_0xe2da('0x1f')](_0x203d36));return execChildProcess()[_0xe2da('0x11')](function(_0x30dea4){process[_0xe2da('0x1e')](_0x53cc4e);return pm2[_0xe2da('0x20')]({'name':_0x56eeb1[_0xe2da('0x19')]['name'],'script':_0x203d36});})[_0xe2da('0x11')](function(_0x357bff){pm2[_0xe2da('0x21')]();return _0x357bff[0x0];})[_0xe2da('0x11')](respondWithResult(_0x2e16b2,0xc9))[_0xe2da('0x15')](handleError(_0x2e16b2,null));}else{return _0x2e16b2[_0xe2da('0x7')](0x1f4)[_0xe2da('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xe2da('0x22')]=function(_0x3e23d7,_0x1dc228){if(_0x3e23d7[_0xe2da('0x19')]['id']){delete _0x3e23d7[_0xe2da('0x19')]['id'];}var _0x2b6c9e={'online':_0xe2da('0x23'),'stopped':_0xe2da('0x24')};if(_0x2b6c9e['hasOwnProperty'](_0x3e23d7['body']['status'])){return pm2[_0x2b6c9e[_0x3e23d7[_0xe2da('0x19')][_0xe2da('0x7')]]](_0x3e23d7[_0xe2da('0x18')]['id'])[_0xe2da('0x11')](respondWithResult(_0x1dc228,0xc8))['catch'](handleError(_0x1dc228,null));}else{return _0x1dc228['status'](0x1f4)[_0xe2da('0xc')]({'message':_0xe2da('0x25')});}};exports[_0xe2da('0x26')]=function(_0x39f983,_0x7ab5ee){if(_0x39f983[_0xe2da('0x19')]['id']){delete _0x39f983[_0xe2da('0x19')]['id'];}if(_0x39f983[_0xe2da('0x18')]['id']){return pm2[_0xe2da('0x27')](_0x39f983['params']['id'])['then'](function(_0x672767){pm2[_0xe2da('0x21')]();return _0x672767[0x0];})[_0xe2da('0x11')](respondWithResult(_0x7ab5ee,null))[_0xe2da('0x15')](handleError(_0x7ab5ee,null));}else{return _0x7ab5ee[_0xe2da('0x7')](0x1f4)[_0xe2da('0xc')]({'message':_0xe2da('0x28')});}}; \ No newline at end of file +var _0x0102=['length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','delete','../../config/pm2','../../config/logger','api','path','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','express'];(function(_0x4d438a,_0x4ecd81){var _0x5a56e3=function(_0x242431){while(--_0x242431){_0x4d438a['push'](_0x4d438a['shift']());}};_0x5a56e3(++_0x4ecd81);}(_0x0102,0x186));var _0x2010=function(_0x13df7e,_0x11989f){_0x13df7e=_0x13df7e-0x0;var _0x13db62=_0x0102[_0x13df7e];return _0x13db62;};'use strict';var _=require('lodash');var pm2=require(_0x2010('0x0'));var logger=require(_0x2010('0x1'))(_0x2010('0x2'));var path=require(_0x2010('0x3'));var exec=require('child_process')['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x4e30b3,_0x59082d){return function(_0x22e49f){if(!_0x22e49f){_0x4e30b3[_0x2010('0x4')](0x194);;}return _0x22e49f;};}function respondWithResult(_0x130725,_0x304264){_0x304264=_0x304264||0xc8;return function(_0x4eeb67){if(_0x4eeb67){return _0x130725[_0x2010('0x5')](_0x304264)['json'](_0x4eeb67);}return null;};}function handleError(_0x4728c0,_0x160e41){_0x160e41=_0x160e41||0x1f4;return function(_0x48dd91){logger[_0x2010('0x6')](_0x48dd91[_0x2010('0x7')]);if(_0x48dd91[_0x2010('0x8')]){delete _0x48dd91[_0x2010('0x8')];}_0x4728c0[_0x2010('0x5')](_0x160e41)[_0x2010('0x9')](_0x48dd91);};}function execChildProcess(){return new BPromise(function(_0x289ad4,_0x466c71){exec(_0x2010('0xa'),function(_0x39a821,_0x1d3b39,_0x32fe2e){logger[_0x2010('0xb')](_0x1d3b39);logger[_0x2010('0xb')](_0x32fe2e);if(_0x39a821){logger[_0x2010('0x6')](_0x39a821);return _0x466c71(_0x39a821);}return _0x289ad4(_0x1d3b39);});});}exports[_0x2010('0xc')]=function(_0x528a38,_0x579340){return pm2[_0x2010('0xd')]()[_0x2010('0xe')](function(_0x2e8ec2){if(_0x2e8ec2){var _0x10b587=_[_0x2010('0xf')](_0x2e8ec2,function(_0x335be4){return _0x335be4['name']===_0x2010('0x10')||_0x335be4[_0x2010('0x8')]==='motion2';});return{'rows':_0x10b587,'count':_0x10b587[_0x2010('0x11')]};}return null;})[_0x2010('0xe')](respondWithResult(_0x579340,null))[_0x2010('0x12')](handleError(_0x579340,null));};exports[_0x2010('0x13')]=function(_0x2d0bf2,_0x11bd28){return pm2[_0x2010('0x14')](_0x2d0bf2[_0x2010('0x15')]['id'])[_0x2010('0xe')](respondWithResult(_0x11bd28,null))['then'](handleEntityNotFound(_0x11bd28,null))['catch'](handleError(_0x11bd28,null));};exports[_0x2010('0x16')]=function(_0x38a15a,_0x3f9d62){if(_0x38a15a[_0x2010('0x17')]['name']&&_0x38a15a['body'][_0x2010('0x18')]){var _0x171e45=path[_0x2010('0x19')](__dirname,_0x2010('0x1a'),_0x38a15a[_0x2010('0x17')][_0x2010('0x18')]);var _0x4f621c=process[_0x2010('0x1b')]();process[_0x2010('0x1c')](path['dirname'](_0x171e45));return execChildProcess()['then'](function(_0x50aecc){process[_0x2010('0x1c')](_0x4f621c);return pm2['start']({'name':_0x38a15a[_0x2010('0x17')]['name'],'script':_0x171e45});})['then'](function(_0xdb57be){pm2[_0x2010('0x1d')]();return _0xdb57be[0x0];})['then'](respondWithResult(_0x3f9d62,0xc9))[_0x2010('0x12')](handleError(_0x3f9d62,null));}else{return _0x3f9d62['status'](0x1f4)[_0x2010('0x9')]({'message':_0x2010('0x1e')});}};exports[_0x2010('0x1f')]=function(_0x3dcea4,_0x3c5862){if(_0x3dcea4[_0x2010('0x17')]['id']){delete _0x3dcea4[_0x2010('0x17')]['id'];}var _0x3eb4dc={'online':_0x2010('0x20'),'stopped':_0x2010('0x21')};if(_0x3eb4dc[_0x2010('0x22')](_0x3dcea4[_0x2010('0x17')]['status'])){return pm2[_0x3eb4dc[_0x3dcea4[_0x2010('0x17')]['status']]](_0x3dcea4[_0x2010('0x15')]['id'])[_0x2010('0xe')](respondWithResult(_0x3c5862,0xc8))[_0x2010('0x12')](handleError(_0x3c5862,null));}else{return _0x3c5862[_0x2010('0x5')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0x2010('0x23')]=function(_0x48d9f2,_0x2839f2){if(_0x48d9f2[_0x2010('0x17')]['id']){delete _0x48d9f2['body']['id'];}if(_0x48d9f2[_0x2010('0x15')]['id']){return pm2[_0x2010('0x24')](_0x48d9f2[_0x2010('0x15')]['id'])[_0x2010('0xe')](function(_0x692ddc){pm2['dump']();return _0x692ddc[0x0];})[_0x2010('0xe')](respondWithResult(_0x2839f2,null))[_0x2010('0x12')](handleError(_0x2839f2,null));}else{return _0x2839f2[_0x2010('0x5')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 86cb483..1588adb 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 _0xe027=['isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./realtime.controller'];(function(_0x116c88,_0x4fe04b){var _0x5b0616=function(_0x53d87a){while(--_0x53d87a){_0x116c88['push'](_0x116c88['shift']());}};_0x5b0616(++_0x4fe04b);}(_0xe027,0x106));var _0x7e02=function(_0x177161,_0x5c0929){_0x177161=_0x177161-0x0;var _0x19ff36=_0xe027[_0x177161];return _0x19ff36;};'use strict';var multer=require(_0x7e02('0x0'));var util=require(_0x7e02('0x1'));var path=require(_0x7e02('0x2'));var timeout=require(_0x7e02('0x3'));var express=require(_0x7e02('0x4'));var router=express[_0x7e02('0x5')]();var fs_extra=require(_0x7e02('0x6'));var auth=require(_0x7e02('0x7'));var interaction=require(_0x7e02('0x8'));var config=require(_0x7e02('0x9'));var controller=require(_0x7e02('0xa'));router['get']('/queues',auth[_0x7e02('0xb')](),controller['getQueues']);module[_0x7e02('0xc')]=router; \ No newline at end of file +var _0xfa28=['../../config/environment','./realtime.controller','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1d7599,_0x49929f){var _0x55da12=function(_0x3f7a5f){while(--_0x3f7a5f){_0x1d7599['push'](_0x1d7599['shift']());}};_0x55da12(++_0x49929f);}(_0xfa28,0x1c6));var _0x8fa2=function(_0x2df724,_0x411382){_0x2df724=_0x2df724-0x0;var _0x1b2504=_0xfa28[_0x2df724];return _0x1b2504;};'use strict';var multer=require(_0x8fa2('0x0'));var util=require(_0x8fa2('0x1'));var path=require(_0x8fa2('0x2'));var timeout=require(_0x8fa2('0x3'));var express=require(_0x8fa2('0x4'));var router=express[_0x8fa2('0x5')]();var fs_extra=require(_0x8fa2('0x6'));var auth=require(_0x8fa2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8fa2('0x8'));var controller=require(_0x8fa2('0x9'));router['get']('/queues',auth['isAuthenticated'](),controller['getQueues']);module[_0x8fa2('0xa')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 74997a7..b5e8e40 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 _0x6451=['all','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','Realtime,\x20%s,\x20%s','request\x20sent','debug','Realtime,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','send','getQueues','chat','sms','openchannel','fax','voice','resolve','query','channel','includes','toLowerCase','Invalid\x20channel','startCase','map','rawAttributes','fieldName','type','getOptions','user','userProfileId','outbound','QueueCampaigns','Queues','name','filter','UserProfile','getResources','findAndCountAll','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','loggedIn','available','waiting','paused','push','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','talking','agents','find','merge','pick','getAgents','UserId','online','loggedInDb','Queue','QueueId','Pause','User','findAll','agent','length'];(function(_0x5e69b9,_0x1f1e9f){var _0x28c551=function(_0x39137d){while(--_0x39137d){_0x5e69b9['push'](_0x5e69b9['shift']());}};_0x28c551(++_0x1f1e9f);}(_0x6451,0x1e9));var _0x1645=function(_0x1efbf0,_0x340627){_0x1efbf0=_0x1efbf0-0x0;var _0x188287=_0x6451[_0x1efbf0];return _0x188287;};'use strict';var emlformat=require(_0x1645('0x0'));var rimraf=require(_0x1645('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1645('0x2'));var rp=require(_0x1645('0x3'));var moment=require(_0x1645('0x4'));var BPromise=require(_0x1645('0x5'));var Mustache=require(_0x1645('0x6'));var util=require(_0x1645('0x7'));var path=require(_0x1645('0x8'));var sox=require('sox');var csv=require(_0x1645('0x9'));var ejs=require(_0x1645('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1645('0xb'));var squel=require(_0x1645('0xc'));var crypto=require(_0x1645('0xd'));var jsforce=require(_0x1645('0xe'));var deskjs=require(_0x1645('0xf'));var toCsv=require(_0x1645('0x9'));var querystring=require('querystring');var Papa=require(_0x1645('0x10'));var Redis=require(_0x1645('0x11'));var authService=require(_0x1645('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1645('0x13'));var logger=require(_0x1645('0x14'))(_0x1645('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1645('0x16'))['db'];var jayson=require(_0x1645('0x17'));var client=jayson[_0x1645('0x18')][_0x1645('0x19')]({'port':0x232a});var routingClient=jayson['client'][_0x1645('0x19')]({'port':0x232c});function respondWithRpcPromise(_0x3e51db,_0x27708e,_0x35a0a3,_0x156dcb){return new BPromise(function(_0x1d7beb,_0x4a4d90){var _0x248d1f=_0x156dcb||client;return _0x248d1f[_0x1645('0x1a')](_0x3e51db,_0x35a0a3)[_0x1645('0x1b')](function(_0x16b914){logger[_0x1645('0x1c')](_0x1645('0x1d'),_0x27708e,_0x1645('0x1e'));logger[_0x1645('0x1f')](_0x1645('0x20'),_0x27708e,'request\x20sent',JSON[_0x1645('0x21')](_0x16b914));if(_0x16b914[_0x1645('0x22')]){if(_0x16b914[_0x1645('0x22')][_0x1645('0x23')]===0x1f4){logger[_0x1645('0x22')]('Realtime,\x20%s,\x20%s',_0x27708e,_0x16b914['error'][_0x1645('0x24')]);return _0x4a4d90(_0x16b914[_0x1645('0x22')][_0x1645('0x24')]);}logger[_0x1645('0x22')](_0x1645('0x1d'),_0x27708e,_0x16b914[_0x1645('0x22')]['message']);return _0x1d7beb(_0x16b914[_0x1645('0x22')][_0x1645('0x24')]);}else{logger[_0x1645('0x1c')](_0x1645('0x1d'),_0x27708e,_0x1645('0x1e'));_0x1d7beb(_0x16b914[_0x1645('0x25')][_0x1645('0x24')]);}})[_0x1645('0x26')](function(_0x300b89){logger[_0x1645('0x22')](_0x1645('0x1d'),_0x27708e,_0x300b89);_0x4a4d90(_0x300b89);});});}function respondWithStatusCode(_0xa2347c,_0x2421dd){_0x2421dd=_0x2421dd||0xcc;return function(_0x5e63e5){if(_0x5e63e5){return _0xa2347c[_0x1645('0x27')](_0x2421dd);}return _0xa2347c['status'](_0x2421dd)[_0x1645('0x28')]();};}function respondWithResult(_0x4aff42,_0x2ffd29){_0x2ffd29=_0x2ffd29||0xc8;return function(_0x122d22){if(_0x122d22){return _0x4aff42[_0x1645('0x29')](_0x2ffd29)[_0x1645('0x2a')](_0x122d22);}};}function respondWithFilteredResult(_0x2d196b,_0x34b2f9){return function(_0x29c5b0){if(_0x29c5b0){var _0x4b9c35=typeof _0x34b2f9['offset']===_0x1645('0x2b')&&typeof _0x34b2f9[_0x1645('0x2c')]===_0x1645('0x2b');var _0x3a1ba6=_0x29c5b0[_0x1645('0x2d')];var _0x17ed3a=_0x4b9c35?0x0:_0x34b2f9[_0x1645('0x2e')];var _0x1ba0e1=_0x4b9c35?_0x29c5b0[_0x1645('0x2d')]:_0x34b2f9[_0x1645('0x2e')]+_0x34b2f9['limit'];var _0x576882;if(_0x1ba0e1>=_0x3a1ba6){_0x1ba0e1=_0x3a1ba6;_0x576882=0xc8;}else{_0x576882=0xce;}_0x2d196b['status'](_0x576882);return _0x2d196b[_0x1645('0x2f')](_0x1645('0x30'),_0x17ed3a+'-'+_0x1ba0e1+'/'+_0x3a1ba6)['json'](_0x29c5b0);}return null;};}function patchUpdates(_0x46dc31){return function(_0x3cc32e){try{jsonpatch['apply'](_0x3cc32e,_0x46dc31,!![]);}catch(_0xdc5484){return BPromise[_0x1645('0x31')](_0xdc5484);}return _0x3cc32e[_0x1645('0x32')]();};}function saveUpdates(_0x33687d,_0x431a7e){return function(_0x5e87d8){if(_0x5e87d8){return _0x5e87d8[_0x1645('0x33')](_0x33687d)[_0x1645('0x1b')](function(_0x57b858){return _0x57b858;});}return null;};}function removeEntity(_0x6b25bc,_0x3d748d){return function(_0x3b99fe){if(_0x3b99fe){return _0x3b99fe['destroy']()[_0x1645('0x1b')](function(){_0x6b25bc[_0x1645('0x29')](0xcc)[_0x1645('0x28')]();});}};}function handleEntityNotFound(_0x45cd65,_0x4bf1ed){return function(_0x44d54b){if(!_0x44d54b){_0x45cd65['sendStatus'](0x194);}return _0x44d54b;};}function handleError(_0x3a083f,_0x2e4f52){_0x2e4f52=_0x2e4f52||0x1f4;return function(_0x3b2a6a){logger[_0x1645('0x22')](_0x3b2a6a['stack']);if(_0x3b2a6a['name']){delete _0x3b2a6a['name'];}_0x3a083f['status'](_0x2e4f52)[_0x1645('0x34')](_0x3b2a6a);};}exports[_0x1645('0x35')]=function(_0x2abe2a,_0x4d334d){var _0x533237=['mail',_0x1645('0x36'),_0x1645('0x37'),_0x1645('0x38'),_0x1645('0x39'),'whatsapp',_0x1645('0x3a')];var _0x537ffc={'count':0x0,'rows':[]},_0x30fda2={},_0x106b8a;Promise[_0x1645('0x3b')]()[_0x1645('0x1b')](function(){if(_0x2abe2a[_0x1645('0x3c')][_0x1645('0x3d')]){if(!_[_0x1645('0x3e')](_0x533237,_0x2abe2a[_0x1645('0x3c')][_0x1645('0x3d')][_0x1645('0x3f')]()))throw new Error(_0x1645('0x40'));_0x106b8a=_0x2abe2a['query'][_0x1645('0x3d')][_0x1645('0x3f')]();}var _0x5b1f7f=_[_0x1645('0x41')](_0x106b8a)+'Queue';var _0x5212bb=_[_0x1645('0x42')](db[_0x5b1f7f][_0x1645('0x43')],function(_0x307f44){return{'name':_0x307f44[_0x1645('0x44')],'type':_0x307f44[_0x1645('0x45')]['key']};});_0x30fda2=qs[_0x1645('0x46')](_0x5212bb,_0x2abe2a);if(_0x2abe2a['user']['role']===_0x1645('0x47')){var _0x6520f5={'params':{'id':_0x2abe2a[_0x1645('0x47')][_0x1645('0x48')]},'query':{'section':_0x106b8a===_0x1645('0x3a')&&_0x2abe2a[_0x1645('0x3c')]['type']===_0x1645('0x49')?_0x1645('0x4a'):_[_0x1645('0x41')](_0x106b8a)+_0x1645('0x4b'),'type':_0x2abe2a[_0x1645('0x3c')][_0x1645('0x45')],'nolimit':!![],'sort':_0x1645('0x4c'),'filter':_0x2abe2a[_0x1645('0x3c')][_0x1645('0x4d')]}};return db[_0x1645('0x4e')][_0x1645('0x4f')](_0x6520f5);}return db[_0x5b1f7f][_0x1645('0x50')](_0x30fda2);})[_0x1645('0x1b')](function(_0x1eaad0){_0x537ffc[_0x1645('0x2d')]=_0x1eaad0[_0x1645('0x2d')];var _0x9339e7=_0x106b8a==='voice'?client:routingClient;return _0x9339e7[_0x1645('0x1a')](_[_0x1645('0x41')](_0x106b8a)+_0x1645('0x4b'),_0x2abe2a)[_0x1645('0x1b')](function(_0x31e163){if(_0x31e163[_0x1645('0x22')])throw new Error(util['format'](_0x1645('0x51'),_0x106b8a));var _0x174515=_0x31e163[_0x1645('0x25')];var _0x59faec=[_0x1645('0x52'),_0x1645('0x53'),_0x1645('0x54'),'talking',_0x1645('0x55')];if(_0x106b8a==='voice'&&_0x2abe2a[_0x1645('0x3c')][_0x1645('0x45')]==='outbound'){_0x59faec[_0x1645('0x56')](_0x1645('0x57'),_0x1645('0x58'),_0x1645('0x24'),_0x1645('0x59'),_0x1645('0x5a'),_0x1645('0x5b'),_0x1645('0x5c'),_0x1645('0x5d'),_0x1645('0x5e'),'erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor',_0x1645('0x5f'),_0x1645('0x60'),_0x1645('0x61'),_0x1645('0x62'),_0x1645('0x63'),_0x1645('0x64'),'predictiveIntervalDroppedCallsTimeout',_0x1645('0x65'),_0x1645('0x66'),_0x1645('0x67'));}var _0x20097f=_0x1eaad0[_0x1645('0x68')][_0x1645('0x42')](function(_0x50e119){var _0x5b87a2=_0x50e119['get']({'plain':!![]});_0x5b87a2[_0x1645('0x55')]=0x0;_0x5b87a2['loggedInDb']=0x0;_0x5b87a2[_0x1645('0x52')]=0x0;_0x5b87a2[_0x1645('0x53')]=0x0;_0x5b87a2[_0x1645('0x55')]=0x0;_0x5b87a2[_0x1645('0x54')]=0x0;if(_0x106b8a==='voice'){_0x5b87a2[_0x1645('0x69')]=0x0;if(_0x2abe2a[_0x1645('0x3c')][_0x1645('0x45')]===_0x1645('0x49')){_0x5b87a2[_0x1645('0x57')]=0x0;_0x5b87a2[_0x1645('0x58')]=0x0;}}_0x5b87a2[_0x1645('0x6a')]=[];var _0x51568e=_[_0x1645('0x6b')](_0x174515['rows'],['id',_0x5b87a2['id']]);if(_0x51568e)_[_0x1645('0x6c')](_0x5b87a2,_[_0x1645('0x6d')](_0x51568e,_0x59faec));if(_0x106b8a===_0x1645('0x3a')){return _0x50e119[_0x1645('0x6e')]({'attributes':['id','name','online'],'joinTableAttributes':[],'raw':!![]})[_0x1645('0x1b')](function(_0x3f5a49){return _0x50e119['getMembers']({'raw':!![]})['then'](function(_0x32c2fb){for(var _0x5645e7=0x0;_0x5645e7<_0x3f5a49['length'];_0x5645e7++){var _0x2afcb2=_[_0x1645('0x6b')](_0x32c2fb,[_0x1645('0x6f'),_0x3f5a49[_0x5645e7]['id']]);var _0x3d0a81={'id':_0x3f5a49[_0x5645e7]['id'],'name':_0x3f5a49[_0x5645e7]['name'],'online':Boolean(_0x3f5a49[_0x5645e7]['online']),'paused':_0x2afcb2?Boolean(_0x2afcb2[_0x1645('0x55')]):![]};if(_0x3d0a81[_0x1645('0x70')])_0x5b87a2[_0x1645('0x71')]++;if(_0x3d0a81[_0x1645('0x55')])_0x5b87a2[_0x1645('0x55')]++;_0x5b87a2[_0x1645('0x6a')]['push'](_0x3d0a81);}return _0x5b87a2;});});}else{var _0x14265e='User'+_[_0x1645('0x41')](_0x106b8a)+_0x1645('0x72');var _0x4db365=_[_0x1645('0x41')](_0x106b8a)+_0x1645('0x73');var _0x2d72af=_0x106b8a+_0x1645('0x74');return db[_0x14265e]['findAll']({'where':{['userQueueKey']:_0x50e119['id']},'raw':!![]})[_0x1645('0x1b')](function(_0x17c84d){return db[_0x1645('0x75')][_0x1645('0x76')]({'attributes':['id',_0x1645('0x4c'),_0x1645('0x70'),_0x2d72af],'where':{'id':_[_0x1645('0x42')](_0x17c84d,_0x1645('0x6f')),'role':_0x1645('0x77')},'raw':!![]});})[_0x1645('0x1b')](function(_0x143395){for(var _0x207d37=0x0;_0x207d37<_0x143395[_0x1645('0x78')];_0x207d37++){var _0xbec368={'id':_0x143395[_0x207d37]['id'],'name':_0x143395[_0x207d37][_0x1645('0x4c')],'online':Boolean(_0x143395[_0x207d37][_0x1645('0x70')]),'paused':Boolean(_0x143395[_0x207d37][_0x2d72af])};if(_0xbec368[_0x1645('0x70')])_0x5b87a2['loggedInDb']++;if(_0xbec368['paused'])_0x5b87a2[_0x1645('0x55')]++;_0x5b87a2['agents'][_0x1645('0x56')](_0xbec368);}return _0x5b87a2;});}});return Promise[_0x1645('0x79')](_0x20097f);});})[_0x1645('0x1b')](function(_0x92dc0d){_0x537ffc[_0x1645('0x68')]=_0x92dc0d;return _0x537ffc;})[_0x1645('0x1b')](respondWithFilteredResult(_0x4d334d,_0x30fda2))[_0x1645('0x26')](handleError(_0x4d334d,null));}; \ No newline at end of file +var _0x1471=['type','startCase','Queues','filter','UserProfile','getResources','findAndCountAll','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','available','waiting','talking','outbound','push','pTalking','originated','dialMethod','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','get','loggedInDb','loggedIn','find','rows','merge','pick','getMembers','length','UserId','online','paused','agents','User','QueueId','Pause','findAll','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','Realtime,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','getQueues','mail','sms','openchannel','whatsapp','voice','resolve','query','channel','includes','toLowerCase','Invalid\x20channel','Queue','map','rawAttributes','fieldName','key','user','role'];(function(_0x37c7db,_0x4c8ea7){var _0x202b12=function(_0x1ed634){while(--_0x1ed634){_0x37c7db['push'](_0x37c7db['shift']());}};_0x202b12(++_0x4c8ea7);}(_0x1471,0xab));var _0x1147=function(_0x2e3207,_0x4f0460){_0x2e3207=_0x2e3207-0x0;var _0x4e025d=_0x1471[_0x2e3207];return _0x4e025d;};'use strict';var emlformat=require(_0x1147('0x0'));var rimraf=require(_0x1147('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1147('0x2'));var moment=require(_0x1147('0x3'));var BPromise=require(_0x1147('0x4'));var Mustache=require(_0x1147('0x5'));var util=require(_0x1147('0x6'));var path=require('path');var sox=require(_0x1147('0x7'));var csv=require('to-csv');var ejs=require(_0x1147('0x8'));var fs=require('fs');var fs_extra=require(_0x1147('0x9'));var _=require(_0x1147('0xa'));var squel=require(_0x1147('0xb'));var crypto=require(_0x1147('0xc'));var jsforce=require(_0x1147('0xd'));var deskjs=require(_0x1147('0xe'));var toCsv=require(_0x1147('0xf'));var querystring=require(_0x1147('0x10'));var Papa=require('papaparse');var Redis=require(_0x1147('0x11'));var authService=require(_0x1147('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1147('0x13'));var hardwareService=require(_0x1147('0x14'));var logger=require(_0x1147('0x15'))(_0x1147('0x16'));var utils=require(_0x1147('0x17'));var config=require(_0x1147('0x18'));var licenseUtil=require(_0x1147('0x19'));var db=require(_0x1147('0x1a'))['db'];var jayson=require(_0x1147('0x1b'));var client=jayson[_0x1147('0x1c')][_0x1147('0x1d')]({'port':0x232a});var routingClient=jayson['client'][_0x1147('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x217aee,_0x137fce,_0xbe72c1,_0x4fd311){return new BPromise(function(_0xdbccd0,_0x75cccb){var _0xc68fa0=_0x4fd311||client;return _0xc68fa0[_0x1147('0x1e')](_0x217aee,_0xbe72c1)['then'](function(_0x403646){logger[_0x1147('0x1f')]('Realtime,\x20%s,\x20%s',_0x137fce,_0x1147('0x20'));logger[_0x1147('0x21')]('Realtime,\x20%s,\x20%s,\x20%s',_0x137fce,'request\x20sent',JSON[_0x1147('0x22')](_0x403646));if(_0x403646['error']){if(_0x403646[_0x1147('0x23')][_0x1147('0x24')]===0x1f4){logger['error'](_0x1147('0x25'),_0x137fce,_0x403646[_0x1147('0x23')][_0x1147('0x26')]);return _0x75cccb(_0x403646[_0x1147('0x23')][_0x1147('0x26')]);}logger[_0x1147('0x23')](_0x1147('0x25'),_0x137fce,_0x403646[_0x1147('0x23')]['message']);return _0xdbccd0(_0x403646[_0x1147('0x23')][_0x1147('0x26')]);}else{logger[_0x1147('0x1f')](_0x1147('0x25'),_0x137fce,_0x1147('0x20'));_0xdbccd0(_0x403646[_0x1147('0x27')]['message']);}})[_0x1147('0x28')](function(_0x1250a5){logger[_0x1147('0x23')](_0x1147('0x25'),_0x137fce,_0x1250a5);_0x75cccb(_0x1250a5);});});}function respondWithStatusCode(_0x43cdea,_0x4748c5){_0x4748c5=_0x4748c5||0xcc;return function(_0x5a91ce){if(_0x5a91ce){return _0x43cdea[_0x1147('0x29')](_0x4748c5);}return _0x43cdea['status'](_0x4748c5)['end']();};}function respondWithResult(_0x510aa9,_0x3778e8){_0x3778e8=_0x3778e8||0xc8;return function(_0x32a6bd){if(_0x32a6bd){return _0x510aa9[_0x1147('0x2a')](_0x3778e8)[_0x1147('0x2b')](_0x32a6bd);}};}function respondWithFilteredResult(_0x278c16,_0x48713c){return function(_0x36302f){if(_0x36302f){var _0x261dd0=typeof _0x48713c[_0x1147('0x2c')]===_0x1147('0x2d')&&typeof _0x48713c[_0x1147('0x2e')]===_0x1147('0x2d');var _0x576484=_0x36302f['count'];var _0x2b95ef=_0x261dd0?0x0:_0x48713c[_0x1147('0x2c')];var _0x2b6229=_0x261dd0?_0x36302f[_0x1147('0x2f')]:_0x48713c['offset']+_0x48713c['limit'];var _0x3316cc;if(_0x2b6229>=_0x576484){_0x2b6229=_0x576484;_0x3316cc=0xc8;}else{_0x3316cc=0xce;}_0x278c16[_0x1147('0x2a')](_0x3316cc);return _0x278c16[_0x1147('0x30')](_0x1147('0x31'),_0x2b95ef+'-'+_0x2b6229+'/'+_0x576484)[_0x1147('0x2b')](_0x36302f);}return null;};}function patchUpdates(_0x54bd41){return function(_0x507b0a){try{jsonpatch[_0x1147('0x32')](_0x507b0a,_0x54bd41,!![]);}catch(_0x16f38f){return BPromise[_0x1147('0x33')](_0x16f38f);}return _0x507b0a[_0x1147('0x34')]();};}function saveUpdates(_0x113867,_0x5d3791){return function(_0x83c18a){if(_0x83c18a){return _0x83c18a[_0x1147('0x35')](_0x113867)[_0x1147('0x36')](function(_0x1ad506){return _0x1ad506;});}return null;};}function removeEntity(_0x1b5f3e,_0x11ca48){return function(_0x5b865e){if(_0x5b865e){return _0x5b865e[_0x1147('0x37')]()['then'](function(){_0x1b5f3e['status'](0xcc)[_0x1147('0x38')]();});}};}function handleEntityNotFound(_0x3d2abf,_0xf4514d){return function(_0x32d81d){if(!_0x32d81d){_0x3d2abf[_0x1147('0x29')](0x194);}return _0x32d81d;};}function handleError(_0x34937c,_0x39822b){_0x39822b=_0x39822b||0x1f4;return function(_0xe0de59){logger[_0x1147('0x23')](_0xe0de59[_0x1147('0x39')]);if(_0xe0de59[_0x1147('0x3a')]){delete _0xe0de59[_0x1147('0x3a')];}_0x34937c['status'](_0x39822b)[_0x1147('0x3b')](_0xe0de59);};}exports[_0x1147('0x3c')]=function(_0x38824c,_0x22b709){var _0x45a1bd=[_0x1147('0x3d'),'chat',_0x1147('0x3e'),_0x1147('0x3f'),'fax',_0x1147('0x40'),_0x1147('0x41')];var _0x2bdaa1={'count':0x0,'rows':[]},_0x4211a3={},_0x4c0e3e;Promise[_0x1147('0x42')]()[_0x1147('0x36')](function(){if(_0x38824c[_0x1147('0x43')][_0x1147('0x44')]){if(!_[_0x1147('0x45')](_0x45a1bd,_0x38824c[_0x1147('0x43')][_0x1147('0x44')][_0x1147('0x46')]()))throw new Error(_0x1147('0x47'));_0x4c0e3e=_0x38824c['query']['channel']['toLowerCase']();}var _0x2d7691=_['startCase'](_0x4c0e3e)+_0x1147('0x48');var _0x2aa40a=_[_0x1147('0x49')](db[_0x2d7691][_0x1147('0x4a')],function(_0x42a587){return{'name':_0x42a587[_0x1147('0x4b')],'type':_0x42a587['type'][_0x1147('0x4c')]};});_0x4211a3=qs['getOptions'](_0x2aa40a,_0x38824c);if(_0x38824c[_0x1147('0x4d')][_0x1147('0x4e')]===_0x1147('0x4d')){var _0x518498={'params':{'id':_0x38824c[_0x1147('0x4d')]['userProfileId']},'query':{'section':_0x4c0e3e==='voice'&&_0x38824c[_0x1147('0x43')][_0x1147('0x4f')]==='outbound'?'QueueCampaigns':_[_0x1147('0x50')](_0x4c0e3e)+_0x1147('0x51'),'type':_0x38824c[_0x1147('0x43')][_0x1147('0x4f')],'nolimit':!![],'sort':'name','filter':_0x38824c[_0x1147('0x43')][_0x1147('0x52')]}};return db[_0x1147('0x53')][_0x1147('0x54')](_0x518498);}return db[_0x2d7691][_0x1147('0x55')](_0x4211a3);})[_0x1147('0x36')](function(_0x1e8595){_0x2bdaa1[_0x1147('0x2f')]=_0x1e8595[_0x1147('0x2f')];var _0xae5355=_0x4c0e3e===_0x1147('0x41')?client:routingClient;return _0xae5355[_0x1147('0x1e')](_['startCase'](_0x4c0e3e)+_0x1147('0x51'),_0x38824c)[_0x1147('0x36')](function(_0x4008b6){if(_0x4008b6[_0x1147('0x23')])throw new Error(util[_0x1147('0x56')](_0x1147('0x57'),_0x4c0e3e));var _0x5d15a6=_0x4008b6[_0x1147('0x27')];var _0x17a020=['loggedIn',_0x1147('0x58'),_0x1147('0x59'),_0x1147('0x5a'),'paused'];if(_0x4c0e3e===_0x1147('0x41')&&_0x38824c[_0x1147('0x43')][_0x1147('0x4f')]===_0x1147('0x5b')){_0x17a020[_0x1147('0x5c')](_0x1147('0x5d'),_0x1147('0x5e'),_0x1147('0x26'),'dialActive',_0x1147('0x5f'),'Trunk','startPredictive',_0x1147('0x60'),_0x1147('0x61'),'erlangCallToSecond',_0x1147('0x62'),_0x1147('0x63'),_0x1147('0x64'),_0x1147('0x65'),_0x1147('0x66'),_0x1147('0x67'),'predictiveIntervalTotalCalls',_0x1147('0x68'),_0x1147('0x69'),'predictiveIntervalDroppedCallsCallersExit',_0x1147('0x6a'),_0x1147('0x6b'));}var _0x5361dd=_0x1e8595['rows'][_0x1147('0x49')](function(_0x2548a5){var _0x20211c=_0x2548a5[_0x1147('0x6c')]({'plain':!![]});_0x20211c['paused']=0x0;_0x20211c[_0x1147('0x6d')]=0x0;_0x20211c[_0x1147('0x6e')]=0x0;_0x20211c[_0x1147('0x58')]=0x0;_0x20211c['paused']=0x0;_0x20211c[_0x1147('0x59')]=0x0;if(_0x4c0e3e===_0x1147('0x41')){_0x20211c[_0x1147('0x5a')]=0x0;if(_0x38824c[_0x1147('0x43')][_0x1147('0x4f')]==='outbound'){_0x20211c[_0x1147('0x5d')]=0x0;_0x20211c[_0x1147('0x5e')]=0x0;}}_0x20211c['agents']=[];var _0x3ddb5c=_[_0x1147('0x6f')](_0x5d15a6[_0x1147('0x70')],['id',_0x20211c['id']]);if(_0x3ddb5c)_[_0x1147('0x71')](_0x20211c,_[_0x1147('0x72')](_0x3ddb5c,_0x17a020));if(_0x4c0e3e==='voice'){return _0x2548a5['getAgents']({'attributes':['id',_0x1147('0x3a'),'online'],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x14958f){return _0x2548a5[_0x1147('0x73')]({'raw':!![]})['then'](function(_0x5bb9fd){for(var _0x5926ec=0x0;_0x5926ec<_0x14958f[_0x1147('0x74')];_0x5926ec++){var _0x3d5e31=_[_0x1147('0x6f')](_0x5bb9fd,[_0x1147('0x75'),_0x14958f[_0x5926ec]['id']]);var _0x3cde26={'id':_0x14958f[_0x5926ec]['id'],'name':_0x14958f[_0x5926ec][_0x1147('0x3a')],'online':Boolean(_0x14958f[_0x5926ec][_0x1147('0x76')]),'paused':_0x3d5e31?Boolean(_0x3d5e31[_0x1147('0x77')]):![]};if(_0x3cde26['online'])_0x20211c['loggedInDb']++;if(_0x3cde26[_0x1147('0x77')])_0x20211c[_0x1147('0x77')]++;_0x20211c[_0x1147('0x78')][_0x1147('0x5c')](_0x3cde26);}return _0x20211c;});});}else{var _0x1bf950=_0x1147('0x79')+_[_0x1147('0x50')](_0x4c0e3e)+_0x1147('0x48');var _0x53989c=_[_0x1147('0x50')](_0x4c0e3e)+_0x1147('0x7a');var _0x3a9556=_0x4c0e3e+_0x1147('0x7b');return db[_0x1bf950]['findAll']({'where':{['userQueueKey']:_0x2548a5['id']},'raw':!![]})[_0x1147('0x36')](function(_0x630106){return db[_0x1147('0x79')][_0x1147('0x7c')]({'attributes':['id','name',_0x1147('0x76'),_0x3a9556],'where':{'id':_[_0x1147('0x49')](_0x630106,_0x1147('0x75')),'role':'agent'},'raw':!![]});})[_0x1147('0x36')](function(_0x4dfc47){for(var _0x234899=0x0;_0x234899<_0x4dfc47['length'];_0x234899++){var _0x2db121={'id':_0x4dfc47[_0x234899]['id'],'name':_0x4dfc47[_0x234899][_0x1147('0x3a')],'online':Boolean(_0x4dfc47[_0x234899][_0x1147('0x76')]),'paused':Boolean(_0x4dfc47[_0x234899][_0x3a9556])};if(_0x2db121['online'])_0x20211c[_0x1147('0x6d')]++;if(_0x2db121[_0x1147('0x77')])_0x20211c[_0x1147('0x77')]++;_0x20211c['agents'][_0x1147('0x5c')](_0x2db121);}return _0x20211c;});}});return Promise['all'](_0x5361dd);});})[_0x1147('0x36')](function(_0x2d9564){_0x2bdaa1[_0x1147('0x70')]=_0x2d9564;return _0x2bdaa1;})['then'](respondWithFilteredResult(_0x22b709,_0x4211a3))[_0x1147('0x28')](handleError(_0x22b709,null));}; \ No newline at end of file diff --git a/server/api/realtime/realtime.model.js b/server/api/realtime/realtime.model.js index b4cb63a..ccc66b9 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 _0xb525=['../../config/environment','exports','define','Realtime','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1150b5,_0x347ad9){var _0x3d4f87=function(_0x1eda3a){while(--_0x1eda3a){_0x1150b5['push'](_0x1150b5['shift']());}};_0x3d4f87(++_0x347ad9);}(_0xb525,0xf4));var _0x5b52=function(_0x2f3b2c,_0x4483ed){_0x2f3b2c=_0x2f3b2c-0x0;var _0x4df029=_0xb525[_0x2f3b2c];return _0x4df029;};'use strict';var _=require(_0x5b52('0x0'));var util=require(_0x5b52('0x1'));var logger=require(_0x5b52('0x2'))(_0x5b52('0x3'));var moment=require(_0x5b52('0x4'));var BPromise=require('bluebird');var rp=require(_0x5b52('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5b52('0x6'));;module[_0x5b52('0x7')]=function(_0x39c008,_0x21ad83){return _0x39c008[_0x5b52('0x8')](_0x5b52('0x9'),[],{});}; \ No newline at end of file +var _0x224d=['request-promise','define','Realtime','util','../../config/logger','api','moment','bluebird'];(function(_0x2b108d,_0x222668){var _0x41b55b=function(_0x9fa712){while(--_0x9fa712){_0x2b108d['push'](_0x2b108d['shift']());}};_0x41b55b(++_0x222668);}(_0x224d,0x17b));var _0xd224=function(_0x13f5fe,_0x460a12){_0x13f5fe=_0x13f5fe-0x0;var _0x481c05=_0x224d[_0x13f5fe];return _0x481c05;};'use strict';var _=require('lodash');var util=require(_0xd224('0x0'));var logger=require(_0xd224('0x1'))(_0xd224('0x2'));var moment=require(_0xd224('0x3'));var BPromise=require(_0xd224('0x4'));var rp=require(_0xd224('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');;module['exports']=function(_0x194247,_0x3ef1e5){return _0x194247[_0xd224('0x6')](_0xd224('0x7'),[],{});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 6ea6c24..5e89afd 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xbe6b45,_0x135386){var _0x2b8e56=function(_0x12782b){while(--_0x12782b){_0xbe6b45['push'](_0xbe6b45['shift']());}};_0x2b8e56(++_0x135386);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1d1219,_0x23fc71){_0x1d1219=_0x1d1219-0x0;var _0x5b5b89=_0xcb91[_0x1d1219];return _0x5b5b89;};'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(_0x38c861,_0x37c537){var _0x147e86=function(_0x52c5c4){while(--_0x52c5c4){_0x38c861['push'](_0x38c861['shift']());}};_0x147e86(++_0x37c537);}(_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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 4266082..5f5eaee 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 _0xed5c=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0x99868f,_0xbdb8e7){var _0x27a71b=function(_0x41feca){while(--_0x41feca){_0x99868f['push'](_0x99868f['shift']());}};_0x27a71b(++_0xbdb8e7);}(_0xed5c,0x81));var _0xced5=function(_0x5db3c8,_0x3b49e8){_0x5db3c8=_0x5db3c8-0x0;var _0x17f0d8=_0xed5c[_0x5db3c8];return _0x17f0d8;};'use strict';var Sequelize=require(_0xced5('0x0'));module[_0xced5('0x1')]={'state':{'type':Sequelize[_0xced5('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xced5('0x3')]},'scheduledat':{'type':Sequelize[_0xced5('0x4')]},'uniqueid':{'type':Sequelize[_0xced5('0x3')]},'starttime':{'type':Sequelize[_0xced5('0x4')]},'responsetime':{'type':Sequelize[_0xced5('0x4')]},'ringtime':{'type':Sequelize[_0xced5('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xced5('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xced5('0x3')]}}; \ No newline at end of file +var _0xb931=['STRING','DATE','INTEGER'];(function(_0x17b39c,_0x4d030b){var _0x171c0e=function(_0x599145){while(--_0x599145){_0x17b39c['push'](_0x17b39c['shift']());}};_0x171c0e(++_0x4d030b);}(_0xb931,0x155));var _0x1b93=function(_0x2911d4,_0x573340){_0x2911d4=_0x2911d4-0x0;var _0x5daf83=_0xb931[_0x2911d4];return _0x5daf83;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x1b93('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x1b93('0x1')]},'starttime':{'type':Sequelize[_0x1b93('0x2')]},'responsetime':{'type':Sequelize[_0x1b93('0x2')]},'ringtime':{'type':Sequelize[_0x1b93('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x1b93('0x1')]},'campaigntype':{'type':Sequelize[_0x1b93('0x1')]},'membername':{'type':Sequelize[_0x1b93('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 5091bf9..04f0baa 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 _0x07a1=['path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview','util','../../config/logger','moment','request-promise'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x07a1,0x98));var _0x107a=function(_0xda582a,_0x4f6f35){_0xda582a=_0xda582a-0x0;var _0x3dfb4b=_0x07a1[_0xda582a];return _0x3dfb4b;};'use strict';var _=require('lodash');var util=require(_0x107a('0x0'));var logger=require(_0x107a('0x1'))('api');var moment=require(_0x107a('0x2'));var BPromise=require('bluebird');var rp=require(_0x107a('0x3'));var fs=require('fs');var path=require(_0x107a('0x4'));var rimraf=require(_0x107a('0x5'));var config=require(_0x107a('0x6'));var attributes=require(_0x107a('0x7'));module[_0x107a('0x8')]=function(_0x2b982f,_0x55b226){return _0x2b982f[_0x107a('0x9')](_0x107a('0xa'),attributes,{'tableName':_0x107a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x982f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview'];(function(_0xbdcd6,_0x44a2fd){var _0x3a70b7=function(_0x18b480){while(--_0x18b480){_0xbdcd6['push'](_0xbdcd6['shift']());}};_0x3a70b7(++_0x44a2fd);}(_0x982f,0x193));var _0xf982=function(_0x51f020,_0x2a832a){_0x51f020=_0x51f020-0x0;var _0xcc4868=_0x982f[_0x51f020];return _0xcc4868;};'use strict';var _=require(_0xf982('0x0'));var util=require(_0xf982('0x1'));var logger=require(_0xf982('0x2'))(_0xf982('0x3'));var moment=require(_0xf982('0x4'));var BPromise=require(_0xf982('0x5'));var rp=require(_0xf982('0x6'));var fs=require('fs');var path=require(_0xf982('0x7'));var rimraf=require(_0xf982('0x8'));var config=require(_0xf982('0x9'));var attributes=require(_0xf982('0xa'));module['exports']=function(_0x32e4dc,_0x5d32fd){return _0x32e4dc['define'](_0xf982('0xb'),attributes,{'tableName':_0xf982('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index 0f55be2..c470f0e 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 _0xc6eb=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x104f00,_0xa6698e){var _0x11e7f7=function(_0x10ff17){while(--_0x10ff17){_0x104f00['push'](_0x104f00['shift']());}};_0x11e7f7(++_0xa6698e);}(_0xc6eb,0x161));var _0xbc6e=function(_0x8f82df,_0x4ad0e9){_0x8f82df=_0x8f82df-0x0;var _0x19212a=_0xc6eb[_0x8f82df];return _0x19212a;};'use strict';var _=require(_0xbc6e('0x0'));var util=require(_0xbc6e('0x1'));var moment=require(_0xbc6e('0x2'));var BPromise=require(_0xbc6e('0x3'));var rs=require(_0xbc6e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc6e('0x5'))['db'];var utils=require(_0xbc6e('0x6'));var logger=require(_0xbc6e('0x7'))(_0xbc6e('0x8'));var config=require(_0xbc6e('0x9'));var jayson=require(_0xbc6e('0xa'));var client=jayson[_0xbc6e('0xb')][_0xbc6e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12b032,_0x350e9c,_0x59cdfc){return new BPromise(function(_0x23432e,_0xf002ed){return client[_0xbc6e('0xd')](_0x12b032,_0x59cdfc)[_0xbc6e('0xe')](function(_0x380409){logger[_0xbc6e('0xf')](_0xbc6e('0x10'),_0x350e9c,_0xbc6e('0x11'));logger[_0xbc6e('0x12')](_0xbc6e('0x13'),_0x350e9c,_0xbc6e('0x11'),JSON[_0xbc6e('0x14')](_0x380409));if(_0x380409[_0xbc6e('0x15')]){if(_0x380409[_0xbc6e('0x15')][_0xbc6e('0x16')]===0x1f4){logger[_0xbc6e('0x15')](_0xbc6e('0x10'),_0x350e9c,_0x380409[_0xbc6e('0x15')][_0xbc6e('0x17')]);return _0xf002ed(_0x380409['error'][_0xbc6e('0x17')]);}logger['error'](_0xbc6e('0x10'),_0x350e9c,_0x380409[_0xbc6e('0x15')][_0xbc6e('0x17')]);return _0x23432e(_0x380409[_0xbc6e('0x15')]['message']);}else{logger[_0xbc6e('0xf')]('ReportAgentPreview,\x20%s,\x20%s',_0x350e9c,'request\x20sent');_0x23432e(_0x380409['result'][_0xbc6e('0x17')]);}})[_0xbc6e('0x18')](function(_0x10f722){logger[_0xbc6e('0x15')]('ReportAgentPreview,\x20%s,\x20%s',_0x350e9c,_0x10f722);_0xf002ed(_0x10f722);});});}exports[_0xbc6e('0x19')]=function(_0x7eae8b){var _0x5aaa98=this;return new Promise(function(_0x447fc0,_0x2d198e){return db['ReportAgentPreview'][_0xbc6e('0x1a')](_0x7eae8b[_0xbc6e('0x1b')],{'raw':_0x7eae8b['options']?_0x7eae8b[_0xbc6e('0x1c')][_0xbc6e('0x1d')]===undefined?!![]:![]:!![]})[_0xbc6e('0xe')](function(_0x2021bc){logger[_0xbc6e('0xf')]('CreateReportAgentPreview',_0x7eae8b);logger[_0xbc6e('0x12')](_0xbc6e('0x19'),_0x7eae8b,JSON[_0xbc6e('0x14')](_0x2021bc));_0x447fc0(_0x2021bc);})['catch'](function(_0x1c9070){logger[_0xbc6e('0x15')](_0xbc6e('0x19'),_0x1c9070['message'],_0x7eae8b);_0x2d198e(_0x5aaa98['error'](0x1f4,_0x1c9070[_0xbc6e('0x17')]));});});}; \ No newline at end of file +var _0xdd54=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','info','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xdd54,0x159));var _0x4dd5=function(_0xe261ee,_0x2a2183){_0xe261ee=_0xe261ee-0x0;var _0x1e06b3=_0xdd54[_0xe261ee];return _0x1e06b3;};'use strict';var _=require(_0x4dd5('0x0'));var util=require(_0x4dd5('0x1'));var moment=require(_0x4dd5('0x2'));var BPromise=require(_0x4dd5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4dd5('0x4'));var db=require(_0x4dd5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4dd5('0x6'));var config=require(_0x4dd5('0x7'));var jayson=require(_0x4dd5('0x8'));var client=jayson[_0x4dd5('0x9')][_0x4dd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x447b6c,_0x3df13a,_0x51f586){return new BPromise(function(_0x146965,_0x1e3094){return client[_0x4dd5('0xb')](_0x447b6c,_0x51f586)[_0x4dd5('0xc')](function(_0x2122da){logger['info'](_0x4dd5('0xd'),_0x3df13a,_0x4dd5('0xe'));logger[_0x4dd5('0xf')](_0x4dd5('0x10'),_0x3df13a,_0x4dd5('0xe'),JSON['stringify'](_0x2122da));if(_0x2122da[_0x4dd5('0x11')]){if(_0x2122da['error'][_0x4dd5('0x12')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x3df13a,_0x2122da['error']['message']);return _0x1e3094(_0x2122da[_0x4dd5('0x11')]['message']);}logger[_0x4dd5('0x11')](_0x4dd5('0xd'),_0x3df13a,_0x2122da['error'][_0x4dd5('0x13')]);return _0x146965(_0x2122da[_0x4dd5('0x11')]['message']);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x3df13a,_0x4dd5('0xe'));_0x146965(_0x2122da[_0x4dd5('0x14')][_0x4dd5('0x13')]);}})[_0x4dd5('0x15')](function(_0x5d41a4){logger[_0x4dd5('0x11')](_0x4dd5('0xd'),_0x3df13a,_0x5d41a4);_0x1e3094(_0x5d41a4);});});}exports[_0x4dd5('0x16')]=function(_0x1dc77b){var _0x38840b=this;return new Promise(function(_0x4125cb,_0x310641){return db[_0x4dd5('0x17')][_0x4dd5('0x18')](_0x1dc77b[_0x4dd5('0x19')],{'raw':_0x1dc77b[_0x4dd5('0x1a')]?_0x1dc77b['options'][_0x4dd5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x532092){logger[_0x4dd5('0x1c')]('CreateReportAgentPreview',_0x1dc77b);logger['debug']('CreateReportAgentPreview',_0x1dc77b,JSON[_0x4dd5('0x1d')](_0x532092));_0x4125cb(_0x532092);})[_0x4dd5('0x15')](function(_0x47d3fa){logger[_0x4dd5('0x11')](_0x4dd5('0x16'),_0x47d3fa[_0x4dd5('0x13')],_0x1dc77b);_0x310641(_0x38840b[_0x4dd5('0x11')](0x1f4,_0x47d3fa[_0x4dd5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 6c34960..269537e 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 _0x6ea6=['sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','/outbound','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify'];(function(_0x4a9b42,_0x1f78bc){var _0x294ce2=function(_0x425804){while(--_0x425804){_0x4a9b42['push'](_0x4a9b42['shift']());}};_0x294ce2(++_0x1f78bc);}(_0x6ea6,0x14f));var _0x66ea=function(_0x427d3a,_0x23724c){_0x427d3a=_0x427d3a-0x0;var _0xe5c521=_0x6ea6[_0x427d3a];return _0xe5c521;};'use strict';var multer=require(_0x66ea('0x0'));var util=require(_0x66ea('0x1'));var path=require(_0x66ea('0x2'));var express=require(_0x66ea('0x3'));var router=express[_0x66ea('0x4')]();var auth=require(_0x66ea('0x5'));var controller=require(_0x66ea('0x6'));router[_0x66ea('0x7')](_0x66ea('0x8'),auth[_0x66ea('0x9')](),controller[_0x66ea('0xa')]);router['get'](_0x66ea('0xb'),auth[_0x66ea('0x9')](),controller['voiceChannelMixMonitor']);router[_0x66ea('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x66ea('0x9')](),controller[_0x66ea('0xc')]);router[_0x66ea('0x7')](_0x66ea('0xd'),auth[_0x66ea('0x9')](),controller[_0x66ea('0xe')]);router[_0x66ea('0x7')](_0x66ea('0xf'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x10')]);router[_0x66ea('0x7')](_0x66ea('0x11'),auth['isAuthenticated'](),controller[_0x66ea('0x12')]);router[_0x66ea('0x7')](_0x66ea('0x13'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x14')]);router[_0x66ea('0x7')](_0x66ea('0x15'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x16')]);router[_0x66ea('0x7')](_0x66ea('0x17'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x18')]);router[_0x66ea('0x7')](_0x66ea('0x19'),auth['isAuthenticated'](),controller[_0x66ea('0x1a')]);router['get'](_0x66ea('0x1b'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x1c')]);router[_0x66ea('0x7')](_0x66ea('0x1d'),auth['isAuthenticated'](),controller[_0x66ea('0x1e')]);router[_0x66ea('0x7')](_0x66ea('0x1f'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x20')]);router[_0x66ea('0x7')](_0x66ea('0x21'),auth['isAuthenticated'](),controller[_0x66ea('0x22')]);router[_0x66ea('0x7')]('/voice/queues/channels/:uniqueid/hangup',auth[_0x66ea('0x9')](),controller[_0x66ea('0x23')]);router[_0x66ea('0x7')](_0x66ea('0x24'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x25')]);router[_0x66ea('0x7')]('/voice/queues/:id',auth[_0x66ea('0x9')](),controller[_0x66ea('0x26')]);router[_0x66ea('0x27')](_0x66ea('0x28'),auth[_0x66ea('0x9')](),controller['updateVoiceQueue']);router[_0x66ea('0x7')](_0x66ea('0x29'),auth[_0x66ea('0x9')](),controller['outbound']);router[_0x66ea('0x7')]('/outbound/channels',auth[_0x66ea('0x9')](),controller[_0x66ea('0x2a')]);router[_0x66ea('0x7')](_0x66ea('0x2b'),auth[_0x66ea('0x9')](),controller['agents']);router['put'](_0x66ea('0x2c'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x2d')]);router[_0x66ea('0x7')]('/telephones',auth[_0x66ea('0x9')](),controller[_0x66ea('0x2e')]);router[_0x66ea('0x7')](_0x66ea('0x2f'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x30')]);router[_0x66ea('0x7')]('/campaigns',auth['isAuthenticated'](),controller[_0x66ea('0x31')]);router[_0x66ea('0x7')](_0x66ea('0x32'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x33')]);router['get'](_0x66ea('0x34'),auth[_0x66ea('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0x66ea('0x7')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x66ea('0x35')]);router[_0x66ea('0x7')]('/openchannel/queues/waitinginteractions',auth[_0x66ea('0x9')](),controller[_0x66ea('0x36')]);router[_0x66ea('0x7')]('/openchannel/queues/:id/waitinginteractions',auth[_0x66ea('0x9')](),controller[_0x66ea('0x37')]);router[_0x66ea('0x7')](_0x66ea('0x38'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x39')]);router[_0x66ea('0x7')](_0x66ea('0x3a'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x3b')]);router[_0x66ea('0x7')]('/fax/queues/waitinginteractions',auth[_0x66ea('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0x66ea('0x3c')](_0x66ea('0x3d'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x3e')](_0x66ea('0x3f')));router[_0x66ea('0x7')](_0x66ea('0x40'),auth['isAuthenticated'](),controller[_0x66ea('0x41')]);router[_0x66ea('0x3c')](_0x66ea('0x42'),auth[_0x66ea('0x9')](),controller['queueNotify']('chat'));router[_0x66ea('0x7')](_0x66ea('0x43'),auth['isAuthenticated'](),controller[_0x66ea('0x44')]);router[_0x66ea('0x3c')]('/fax/queues/:id/notify',auth[_0x66ea('0x9')](),controller[_0x66ea('0x3e')](_0x66ea('0x45')));router['get'](_0x66ea('0x46'),auth[_0x66ea('0x9')](),controller['showFaxQueues']);router[_0x66ea('0x3c')](_0x66ea('0x47'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x3e')](_0x66ea('0x48')));router[_0x66ea('0x7')](_0x66ea('0x49'),auth[_0x66ea('0x9')](),controller['showOpenchannelQueues']);router[_0x66ea('0x3c')](_0x66ea('0x4a'),auth[_0x66ea('0x9')](),controller['queueNotify'](_0x66ea('0x4b')));router['post'](_0x66ea('0x4c'),auth['isAuthenticated'](),controller[_0x66ea('0x3e')]('whatsapp'));router[_0x66ea('0x7')](_0x66ea('0x4d'),auth['isAuthenticated'](),controller[_0x66ea('0x4e')]);router['get'](_0x66ea('0x4f'),auth[_0x66ea('0x9')](),controller[_0x66ea('0x50')]);router[_0x66ea('0x3c')]('/agents/:id/notify',auth['isAuthenticated'](),controller['agentNotify']);module[_0x66ea('0x51')]=router; \ No newline at end of file +var _0x58be=['/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','showWhatsappQueues','agentNotify','multer','util','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/mail/queues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup'];(function(_0x1c90a7,_0x115e4d){var _0x408b33=function(_0x4b2b46){while(--_0x4b2b46){_0x1c90a7['push'](_0x1c90a7['shift']());}};_0x408b33(++_0x115e4d);}(_0x58be,0xc4));var _0xe58b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x58be[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe58b('0x0'));var util=require(_0xe58b('0x1'));var path=require('path');var express=require(_0xe58b('0x2'));var router=express[_0xe58b('0x3')]();var auth=require(_0xe58b('0x4'));var controller=require(_0xe58b('0x5'));router[_0xe58b('0x6')](_0xe58b('0x7'),auth[_0xe58b('0x8')](),controller['voiceChannels']);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0xe58b('0x8')](),controller['voiceChannelMixMonitor']);router['get'](_0xe58b('0x9'),auth['isAuthenticated'](),controller[_0xe58b('0xa')]);router[_0xe58b('0x6')]('/voice/queues',auth[_0xe58b('0x8')](),controller['voiceQueues']);router[_0xe58b('0x6')]('/chat/queues',auth[_0xe58b('0x8')](),controller['chatQueues']);router[_0xe58b('0x6')](_0xe58b('0xb'),auth[_0xe58b('0x8')](),controller['mailQueues']);router['get'](_0xe58b('0xc'),auth[_0xe58b('0x8')](),controller['mailAccounts']);router['get'](_0xe58b('0xd'),auth[_0xe58b('0x8')](),controller[_0xe58b('0xe')]);router[_0xe58b('0x6')](_0xe58b('0xf'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x10')]);router[_0xe58b('0x6')](_0xe58b('0x11'),auth[_0xe58b('0x8')](),controller['whatsappQueues']);router[_0xe58b('0x6')]('/fax/queues',auth[_0xe58b('0x8')](),controller['faxQueues']);router[_0xe58b('0x6')](_0xe58b('0x12'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x13')]);router[_0xe58b('0x6')](_0xe58b('0x14'),auth['isAuthenticated'](),controller[_0xe58b('0x15')]);router['get'](_0xe58b('0x16'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x17')]);router[_0xe58b('0x6')](_0xe58b('0x18'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x19')]);router[_0xe58b('0x6')](_0xe58b('0x1a'),auth['isAuthenticated'](),controller['voiceQueuesChannelRedirect']);router[_0xe58b('0x6')](_0xe58b('0x1b'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x1c')]);router[_0xe58b('0x1d')](_0xe58b('0x1b'),auth['isAuthenticated'](),controller[_0xe58b('0x1e')]);router['get']('/outbound',auth['isAuthenticated'](),controller[_0xe58b('0x1f')]);router[_0xe58b('0x6')]('/outbound/channels',auth['isAuthenticated'](),controller[_0xe58b('0x20')]);router[_0xe58b('0x6')](_0xe58b('0x21'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x22')]);router[_0xe58b('0x1d')](_0xe58b('0x23'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x24')]);router['get'](_0xe58b('0x25'),auth[_0xe58b('0x8')](),controller['telephones']);router['get']('/trunks',auth[_0xe58b('0x8')](),controller['trunks']);router[_0xe58b('0x6')](_0xe58b('0x26'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x27')]);router['get']('/fax/accounts',auth[_0xe58b('0x8')](),controller[_0xe58b('0x28')]);router[_0xe58b('0x6')](_0xe58b('0x29'),auth[_0xe58b('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0xe58b('0x6')](_0xe58b('0x2a'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x2b')]);router['get'](_0xe58b('0x2c'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x2d')]);router[_0xe58b('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0xe58b('0x8')](),controller[_0xe58b('0x2e')]);router[_0xe58b('0x6')](_0xe58b('0x2f'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x30')]);router[_0xe58b('0x6')](_0xe58b('0x31'),auth['isAuthenticated'](),controller[_0xe58b('0x32')]);router[_0xe58b('0x6')](_0xe58b('0x33'),auth['isAuthenticated'](),controller[_0xe58b('0x34')]);router['post'](_0xe58b('0x35'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x36')]('mail'));router[_0xe58b('0x6')](_0xe58b('0x37'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x38')]);router[_0xe58b('0x39')](_0xe58b('0x3a'),auth['isAuthenticated'](),controller['queueNotify'](_0xe58b('0x3b')));router[_0xe58b('0x6')](_0xe58b('0x3c'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x3d')]);router[_0xe58b('0x39')](_0xe58b('0x3e'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x36')](_0xe58b('0x3f')));router[_0xe58b('0x6')](_0xe58b('0x40'),auth[_0xe58b('0x8')](),controller['showFaxQueues']);router[_0xe58b('0x39')]('/openchannel/queues/:id/notify',auth[_0xe58b('0x8')](),controller[_0xe58b('0x36')](_0xe58b('0x41')));router[_0xe58b('0x6')](_0xe58b('0x42'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x43')]);router[_0xe58b('0x39')]('/sms/queues/:id/notify',auth[_0xe58b('0x8')](),controller[_0xe58b('0x36')](_0xe58b('0x44')));router['post'](_0xe58b('0x45'),auth[_0xe58b('0x8')](),controller['queueNotify']('whatsapp'));router['get'](_0xe58b('0x46'),auth[_0xe58b('0x8')](),controller[_0xe58b('0x47')]);router[_0xe58b('0x6')]('/whatsapp/queues/:id',auth[_0xe58b('0x8')](),controller[_0xe58b('0x48')]);router['post']('/agents/:id/notify',auth[_0xe58b('0x8')](),controller[_0xe58b('0x49')]);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 69f0d58..95dc4e0 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 _0x31f0=['YYYY-MM-DD\x20HH:mm:ss','MemberReport','findOrCreate','interface','SIP/%s','capacity','telephones','Telephones','trunks','Trunks','chatQueues','ChatQueues','MailQueues','showMailQueues','MailAccounts','OpenchannelQueues','smsQueues','SmsQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','uniq','value','filter','indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','InteractionId','From','create','Start','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','chat','agent','Agent\x20not\x20found','MessageId','TransferReport','agentTransferTimeout','bluebird','lodash','../../mysqldb','../../config/logger','api','jayson/promise','http','client','then','error','code','message','result','catch','status','sendStatus','name','send','isNil','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','INTERACTION','length','format'];(function(_0x3a9083,_0x3c9f8d){var _0x160306=function(_0x312020){while(--_0x312020){_0x3a9083['push'](_0x3a9083['shift']());}};_0x160306(++_0x3c9f8d);}(_0x31f0,0xb7));var _0x031f=function(_0x5d8156,_0x368dac){_0x5d8156=_0x5d8156-0x0;var _0x4d5fd4=_0x31f0[_0x5d8156];return _0x4d5fd4;};'use strict';var BPromise=require(_0x031f('0x0'));var moment=require('moment');var _=require(_0x031f('0x1'));var util=require('util');var db=require(_0x031f('0x2'))['db'];var logger=require(_0x031f('0x3'))(_0x031f('0x4'));var jayson=require(_0x031f('0x5'));var amiClient=jayson['client'][_0x031f('0x6')]({'port':0x232a});var mailClient=jayson[_0x031f('0x7')]['http']({'port':0x232b});var routingClient=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){var _0x3e41ed=_0x365f59?_0x365f59:amiClient;return _0x3e41ed['request'](_0x3dc98e,_0x487e65)[_0x031f('0x8')](function(_0x24145f){if(_0x24145f[_0x031f('0x9')]){if(_0x24145f[_0x031f('0x9')][_0x031f('0xa')]===0x1f4){return _0x2569b6(_0x24145f[_0x031f('0x9')][_0x031f('0xb')]);}return _0x4300b4(_0x24145f[_0x031f('0x9')]['message']);}else{_0x4300b4(_0x24145f[_0x031f('0xc')]);}})[_0x031f('0xd')](function(_0x28da6e){_0x2569b6(_0x28da6e);});});}function respondWithResult(_0x351052,_0x3819bb){_0x3819bb=_0x3819bb||0xc8;return function(_0x405896){if(_0x405896){return _0x351052[_0x031f('0xe')](_0x3819bb)['json'](_0x405896);}return _0x351052[_0x031f('0xf')](0x194);};}function handleError(_0x23b40c,_0x17a699){_0x17a699=_0x17a699||0x1f4;return function(_0x2e3dfe){logger[_0x031f('0x9')](_0x2e3dfe['stack']);if(_0x2e3dfe['name']){delete _0x2e3dfe[_0x031f('0x10')];}_0x23b40c[_0x031f('0xe')](_0x17a699)[_0x031f('0x11')](_0x2e3dfe);};}function findById(_0x286177){return function(_0x5196b1){if(!_[_0x031f('0x12')](_0x286177)&&!_[_0x031f('0x12')](_0x5196b1)&&!_['isNil'](_0x5196b1[_0x031f('0x13')])){return _['find'](_0x5196b1[_0x031f('0x13')],function(_0x5f2199){return _0x5f2199['id']==_0x286177;});}return null;};}exports[_0x031f('0x14')]=function(_0xaa155,_0x1ceddc){return respondWithRpcPromise(_0x031f('0x15'),_0xaa155[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x1ceddc,null))[_0x031f('0xd')](handleError(_0x1ceddc,null));};exports[_0x031f('0x17')]=function(_0x29dd6e,_0x48a76e){return respondWithRpcPromise(_0x031f('0x18'),_[_0x031f('0x19')](_0x29dd6e[_0x031f('0x16')],_0x29dd6e['params']))['then'](respondWithResult(_0x48a76e,null))[_0x031f('0xd')](handleError(_0x48a76e,null));};exports['voiceChannelStopMixMonitor']=function(_0x3472a2,_0x57f6c4){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x3472a2[_0x031f('0x16')],_0x3472a2[_0x031f('0x1a')]))[_0x031f('0x8')](respondWithResult(_0x57f6c4,null))[_0x031f('0xd')](handleError(_0x57f6c4,null));};exports['voiceQueues']=function(_0x374b65,_0x5a64c0){return respondWithRpcPromise(_0x031f('0x1b'),_0x374b65[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x5a64c0,null))['catch'](handleError(_0x5a64c0,null));};exports[_0x031f('0x1c')]=function(_0x3b2a51,_0x54b44e){return respondWithRpcPromise(_0x031f('0x1b'),_0x3b2a51[_0x031f('0x16')])[_0x031f('0x8')](findById(_0x3b2a51['params']['id']))[_0x031f('0x8')](respondWithResult(_0x54b44e,null))[_0x031f('0xd')](handleError(_0x54b44e,null));};exports[_0x031f('0x1d')]=function(_0xaf5bea,_0xfaa36){return respondWithRpcPromise(_0x031f('0x1e'),_['merge'](_0xaf5bea[_0x031f('0x1f')],_0xaf5bea[_0x031f('0x1a')]))[_0x031f('0x8')](respondWithResult(_0xfaa36,null))[_0x031f('0xd')](handleError(_0xfaa36,null));};exports[_0x031f('0x20')]=function(_0x2d24f0,_0x378692){return respondWithRpcPromise(_0x031f('0x21'),_[_0x031f('0x19')](_0x2d24f0[_0x031f('0x16')],_0x2d24f0[_0x031f('0x1a')]))['then'](respondWithResult(_0x378692,null))[_0x031f('0xd')](handleError(_0x378692,null));};exports[_0x031f('0x22')]=function(_0xb3a6bd,_0x2f2616){return respondWithRpcPromise(_0x031f('0x23'),_0xb3a6bd[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x2f2616,null))[_0x031f('0xd')](handleError(_0x2f2616,null));};exports[_0x031f('0x24')]=function(_0xb7284d,_0x12bd77){return respondWithRpcPromise(_0x031f('0x25'),_[_0x031f('0x19')](_0xb7284d['query'],_0xb7284d[_0x031f('0x1a')]))[_0x031f('0x8')](respondWithResult(_0x12bd77,null))['catch'](handleError(_0x12bd77,null));};exports[_0x031f('0x26')]=function(_0x1fde6b,_0x4ec696){return respondWithRpcPromise(_0x031f('0x27'),_[_0x031f('0x19')](_0x1fde6b[_0x031f('0x16')],_0x1fde6b[_0x031f('0x1a')]))['then'](respondWithResult(_0x4ec696,null))['catch'](handleError(_0x4ec696,null));};exports[_0x031f('0x28')]=function(_0x555b89,_0x43ab76){return respondWithRpcPromise(_0x031f('0x29'),_[_0x031f('0x19')](_0x555b89['query'],_0x555b89['params']))[_0x031f('0x8')](respondWithResult(_0x43ab76,null))['catch'](handleError(_0x43ab76,null));};exports['outbound']=function(_0x2d489a,_0x45e3a4){return respondWithRpcPromise(_0x031f('0x2a'),_0x2d489a[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x45e3a4,null))[_0x031f('0xd')](handleError(_0x45e3a4,null));};exports[_0x031f('0x2b')]=function(_0x55c85f,_0x17a970){return respondWithRpcPromise(_0x031f('0x2c'),_0x55c85f[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x17a970,null))['catch'](handleError(_0x17a970,null));};exports[_0x031f('0x2d')]=function(_0x10f590,_0x2dba8b){var _0x5895f6;return respondWithRpcPromise(_0x031f('0x2e'),_0x10f590[_0x031f('0x16')])['then'](function(_0x36bafa){_0x5895f6=_0x36bafa;return respondWithRpcPromise(_0x031f('0x2e'),_0x10f590['query'],routingClient);})['then'](function(_0x178135){return _[_0x031f('0x19')]({},_0x178135,_0x5895f6);})[_0x031f('0x8')](respondWithResult(_0x2dba8b,null))[_0x031f('0xd')](handleError(_0x2dba8b,null));};exports[_0x031f('0x2f')]=function(_0xf0fb95,_0xe07087){if(_0xf0fb95['body']&&_0xf0fb95[_0x031f('0x1f')][_0x031f('0x30')]&&_0xf0fb95['user']&&_0xf0fb95[_0x031f('0x31')]['name']){for(var _0x456a98 in _0xf0fb95[_0x031f('0x1f')]['interaction']){if(_0xf0fb95[_0x031f('0x1f')][_0x031f('0x30')][_0x031f('0x32')](_0x456a98)){db['MemberReport'][_0x031f('0x33')]({'where':{'channel':_0x456a98,'membername':_0xf0fb95[_0x031f('0x31')][_0x031f('0x10')],'type':_0x031f('0x34'),'exitAt':null,'uniqueid':_0xf0fb95[_0x031f('0x1f')][_0x031f('0x30')][_0x456a98]&&_0xf0fb95[_0x031f('0x1f')][_0x031f('0x30')][_0x456a98][_0x031f('0x35')]?{'$notIn':_0xf0fb95['body'][_0x031f('0x30')][_0x456a98]}:{'$ne':null}}})[_0x031f('0x8')](function(_0x28f2b3){var _0x3205ce=moment()[_0x031f('0x36')](_0x031f('0x37'));for(var _0x2111c5=0x0,_0x33d24b=_0x28f2b3[_0x031f('0x35')];_0x2111c5<_0x33d24b;_0x2111c5+=0x1){_0x28f2b3[_0x2111c5]['updateAttributes']({'exitAt':_0x3205ce});}});for(var _0x38539a=0x0;_0x38539a<_0xf0fb95['body']['interaction'][_0x456a98][_0x031f('0x35')];_0x38539a+=0x1){db[_0x031f('0x38')][_0x031f('0x39')]({'where':{'channel':_0x456a98,'membername':_0xf0fb95[_0x031f('0x31')][_0x031f('0x10')],'type':'INTERACTION','uniqueid':_0xf0fb95[_0x031f('0x1f')][_0x031f('0x30')][_0x456a98][_0x38539a],'exitAt':null},'defaults':{'channel':_0x456a98,'membername':_0xf0fb95[_0x031f('0x31')]['name'],'interface':_[_0x031f('0x12')](_0xf0fb95[_0x031f('0x31')][_0x031f('0x3a')])?util[_0x031f('0x36')](_0x031f('0x3b'),_0xf0fb95[_0x031f('0x31')]['name']):_0xf0fb95['user'][_0x031f('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x031f('0x36')](_0x031f('0x37')),'role':'agent','internal':_0xf0fb95[_0x031f('0x31')]['internal'],'uniqueid':_0xf0fb95['body'][_0x031f('0x30')][_0x456a98][_0x38539a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0xf0fb95[_0x031f('0x1a')]['id'],'capacity':_0xf0fb95['body'][_0x031f('0x3c')]},routingClient)[_0x031f('0x8')](respondWithResult(_0xe07087,null))['catch'](handleError(_0xe07087,null));};exports[_0x031f('0x3d')]=function(_0x2e7abe,_0x57e32d){return respondWithRpcPromise(_0x031f('0x3e'),_0x2e7abe['query'])[_0x031f('0x8')](respondWithResult(_0x57e32d,null))['catch'](handleError(_0x57e32d,null));};exports[_0x031f('0x3f')]=function(_0x24848b,_0x393807){return respondWithRpcPromise(_0x031f('0x40'),_0x24848b[_0x031f('0x16')])['then'](respondWithResult(_0x393807,null))[_0x031f('0xd')](handleError(_0x393807,null));};exports['campaigns']=function(_0x186957,_0x414350){return respondWithRpcPromise('Campaigns',_0x186957[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x414350,null))['catch'](handleError(_0x414350,null));};exports[_0x031f('0x41')]=function(_0x154ad2,_0x22a547){return respondWithRpcPromise('ChatQueues',_0x154ad2[_0x031f('0x16')],routingClient)['then'](respondWithResult(_0x22a547,null))[_0x031f('0xd')](handleError(_0x22a547,null));};exports['showChatQueues']=function(_0x3bd6f4,_0x561a2b){return respondWithRpcPromise(_0x031f('0x42'),_0x3bd6f4[_0x031f('0x16')],routingClient)['then'](findById(_0x3bd6f4['params']['id']))[_0x031f('0x8')](respondWithResult(_0x561a2b,null))[_0x031f('0xd')](handleError(_0x561a2b,null));};exports['mailQueues']=function(_0x434c0f,_0xb44c73){return respondWithRpcPromise(_0x031f('0x43'),_0x434c0f[_0x031f('0x16')],routingClient)[_0x031f('0x8')](respondWithResult(_0xb44c73,null))[_0x031f('0xd')](handleError(_0xb44c73,null));};exports[_0x031f('0x44')]=function(_0x405398,_0x4b25e5){return respondWithRpcPromise(_0x031f('0x43'),_0x405398[_0x031f('0x16')],routingClient)[_0x031f('0x8')](findById(_0x405398['params']['id']))[_0x031f('0x8')](respondWithResult(_0x4b25e5,null))[_0x031f('0xd')](handleError(_0x4b25e5,null));};exports['mailAccounts']=function(_0xb86dcd,_0x14506b){return respondWithRpcPromise(_0x031f('0x45'),_0xb86dcd[_0x031f('0x16')],mailClient)['then'](respondWithResult(_0x14506b,null))['catch'](handleError(_0x14506b,null));};exports['openchannelQueues']=function(_0x4e2d0d,_0x9f76f3){return respondWithRpcPromise(_0x031f('0x46'),_0x4e2d0d['query'],routingClient)[_0x031f('0x8')](respondWithResult(_0x9f76f3,null))[_0x031f('0xd')](handleError(_0x9f76f3,null));};exports['showOpenchannelQueues']=function(_0x110495,_0x26ecb0){return respondWithRpcPromise(_0x031f('0x46'),_0x110495[_0x031f('0x16')],routingClient)[_0x031f('0x8')](findById(_0x110495[_0x031f('0x1a')]['id']))[_0x031f('0x8')](respondWithResult(_0x26ecb0,null))[_0x031f('0xd')](handleError(_0x26ecb0,null));};exports[_0x031f('0x47')]=function(_0x557a32,_0x138e0d){return respondWithRpcPromise('SmsQueues',_0x557a32[_0x031f('0x16')],routingClient)[_0x031f('0x8')](respondWithResult(_0x138e0d,null))[_0x031f('0xd')](handleError(_0x138e0d,null));};exports['showSmsQueues']=function(_0x4c1b74,_0xdb3d45){return respondWithRpcPromise(_0x031f('0x48'),_0x4c1b74[_0x031f('0x16')],routingClient)[_0x031f('0x8')](findById(_0x4c1b74['params']['id']))[_0x031f('0x8')](respondWithResult(_0xdb3d45,null))['catch'](handleError(_0xdb3d45,null));};exports['whatsappQueues']=function(_0x2179ee,_0x534bae){return respondWithRpcPromise('WhatsappQueues',_0x2179ee[_0x031f('0x16')],routingClient)[_0x031f('0x8')](respondWithResult(_0x534bae,null))[_0x031f('0xd')](handleError(_0x534bae,null));};exports[_0x031f('0x49')]=function(_0xe125d9,_0x584899){return respondWithRpcPromise('WhatsappQueues',_0xe125d9[_0x031f('0x16')],routingClient)['then'](findById(_0xe125d9[_0x031f('0x1a')]['id']))[_0x031f('0x8')](respondWithResult(_0x584899,null))['catch'](handleError(_0x584899,null));};exports[_0x031f('0x4a')]=function(_0xee136c,_0x439095){return respondWithRpcPromise(_0x031f('0x4b'),_0xee136c[_0x031f('0x16')],routingClient)[_0x031f('0x8')](respondWithResult(_0x439095,null))['catch'](handleError(_0x439095,null));};exports['showFaxQueues']=function(_0x3bcc7e,_0x232b62){return respondWithRpcPromise(_0x031f('0x4b'),_0x3bcc7e[_0x031f('0x16')],routingClient)[_0x031f('0x8')](findById(_0x3bcc7e[_0x031f('0x1a')]['id']))[_0x031f('0x8')](respondWithResult(_0x232b62,null))['catch'](handleError(_0x232b62,null));};exports['faxAccounts']=function(_0x4bd283,_0x5ddf46){return respondWithRpcPromise(_0x031f('0x4c'),_0x4bd283[_0x031f('0x16')])[_0x031f('0x8')](respondWithResult(_0x5ddf46,null))['catch'](handleError(_0x5ddf46,null));};exports[_0x031f('0x4d')]=function(_0x2e56e3,_0x5133a6){return respondWithRpcPromise(_0x031f('0x4e'),_0x2e56e3[_0x031f('0x16')],routingClient)[_0x031f('0x8')](respondWithResult(_0x5133a6,null))[_0x031f('0xd')](handleError(_0x5133a6,null));};exports[_0x031f('0x4f')]=function(_0x1e10f6,_0x982c1b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x1e10f6['query'],routingClient)[_0x031f('0x8')](respondWithResult(_0x982c1b,null))['catch'](handleError(_0x982c1b,null));};exports[_0x031f('0x50')]=function(_0x523f69,_0x13251c){return respondWithRpcPromise(_0x031f('0x51'),_0x523f69[_0x031f('0x16')],routingClient)['then'](respondWithResult(_0x13251c,null))[_0x031f('0xd')](handleError(_0x13251c,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0xa31a3,_0xffb00){return respondWithRpcPromise(_0x031f('0x51'),_0xa31a3['query'],routingClient)[_0x031f('0x8')](function(_0x398e7c){if(_0xa31a3[_0x031f('0x16')][_0x031f('0x52')]!==undefined){var _0x45330f=_(_0x398e7c['rows'])['filter']([_0xa31a3[_0x031f('0x16')][_0x031f('0x52')],_0xa31a3['params']['id']])[_0x031f('0x53')]('queue_id')[_0x031f('0x54')]()[_0x031f('0x55')]();return _0x398e7c[_0x031f('0x13')][_0x031f('0x56')](function(_0x52bb92){return _0x45330f[_0x031f('0x57')](_0x52bb92[_0x031f('0x58')])>-0x1;});}else{return _0x398e7c[_0x031f('0x13')]['filter'](function(_0x1328ba){return _0x1328ba[_0x031f('0x58')]===parseInt(_0xa31a3['params']['id']);});}})[_0x031f('0x8')](respondWithResult(_0xffb00,null))[_0x031f('0xd')](handleError(_0xffb00,null));};exports[_0x031f('0x59')]=function(_0x2fb2a8,_0x104025){return respondWithRpcPromise(_0x031f('0x5a'),_0x2fb2a8[_0x031f('0x16')],routingClient)['then'](respondWithResult(_0x104025,null))[_0x031f('0xd')](handleError(_0x104025,null));};exports[_0x031f('0x5b')]=function(_0x23cc40,_0x5b19c1){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x23cc40[_0x031f('0x16')],routingClient)['then'](respondWithResult(_0x5b19c1,null))['catch'](handleError(_0x5b19c1,null));};exports[_0x031f('0x5c')]=function(_0x184bbd,_0x1c8055){return respondWithRpcPromise(_0x031f('0x5d'),_0x184bbd[_0x031f('0x16')],routingClient)[_0x031f('0x8')](respondWithResult(_0x1c8055,null))[_0x031f('0xd')](handleError(_0x1c8055,null));};exports[_0x031f('0x5e')]=function(_0xecbfed){return function(_0x30a3ea,_0x3166bb){var _0x49505e,_0x1a5fd2;var _0x2d867f=_[_0x031f('0x5f')](_0xecbfed);var _0x8290bf=_0xecbfed==='chat'?_0x031f('0x60'):'Account';return db[_0x2d867f+'Queue'][_0x031f('0x61')]({'raw':!![],'where':{'id':_0x30a3ea[_0x031f('0x1a')]['id']}})['then'](function(_0x510bb6){if(_[_0x031f('0x12')](_0x510bb6)){throw new Error(_0x2d867f+_0x031f('0x62'));}_0x49505e=_0x510bb6;return db[_0x2d867f+_0x031f('0x63')][_0x031f('0x61')]({'where':{'id':_0x30a3ea[_0x031f('0x1f')][_0x031f('0x64')]},'include':[{'model':db[_0x2d867f+'Interaction'],'as':_0x031f('0x65')},{'model':db[_0x2d867f+_0x8290bf],'as':_0x031f('0x66')}]});})['then'](function(_0x25ea89){if(_[_0x031f('0x12')](_0x25ea89)){throw new Error(_0x2d867f+_0x031f('0x67'));}_0x1a5fd2=_0x25ea89;return _0x25ea89[_0x031f('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x031f('0x8')](function(){var _0x20a8c6={'uniqueid':_0xecbfed+'.'+_0x1a5fd2['id']+'.'+_0x1a5fd2[_0x031f('0x65')]['id'],'FromUserId':_0x30a3ea['user']['id'],'type':_0x031f('0x69')};_0x20a8c6[_0x2d867f+'MessageId']=_0x1a5fd2['id'];_0x20a8c6[_0x2d867f+_0x031f('0x6a')]=_0x1a5fd2[_0x031f('0x65')]['id'];_0x20a8c6[_0x031f('0x6b')+_0x2d867f+_0x8290bf+'Id']=_0x1a5fd2['Account']['id'];_0x20a8c6['To'+_0x2d867f+'QueueId']=_0x49505e['id'];return db[_0x2d867f+'TransferReport'][_0x031f('0x6c')](_0x20a8c6);})[_0x031f('0x8')](function(){return respondWithRpcPromise(_0x031f('0x6d'),{'channel':_0xecbfed,'interaction':_0x1a5fd2[_0x031f('0x65')],'message':_0x1a5fd2,'account':_0x1a5fd2[_0x031f('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':_0x031f('0x69'),'appdata':_0x49505e[_0x031f('0x10')]+','+(_0x1a5fd2['Account']['queueTransferTimeout']||0x12c),'interval':_0x031f('0x6e')}]},routingClient);})[_0x031f('0x8')](respondWithResult(_0x3166bb,null))['catch'](handleError(_0x3166bb,null));};};exports[_0x031f('0x6f')]=function(_0x4afad0,_0x1c31d5){var _0x20d85a,_0x5a6db6;if(_[_0x031f('0x12')](_0x4afad0[_0x031f('0x1f')]['channel'])){throw new Error(_0x031f('0x70'));}var _0x3c7dee=_0x4afad0[_0x031f('0x1f')]['channel'];var _0xa9b5e2=_[_0x031f('0x5f')](_0x3c7dee);var _0x1f6f71=_0x3c7dee===_0x031f('0x71')?_0x031f('0x60'):_0x031f('0x66');return db['User'][_0x031f('0x61')]({'raw':!![],'where':{'id':_0x4afad0[_0x031f('0x1a')]['id'],'role':_0x031f('0x72')}})[_0x031f('0x8')](function(_0x4ef395){if(_[_0x031f('0x12')](_0x4ef395)){throw new Error(_0x031f('0x73'));}_0x20d85a=_0x4ef395;return db[_0xa9b5e2+'Message'][_0x031f('0x61')]({'where':{'id':_0x4afad0[_0x031f('0x1f')][_0x031f('0x64')]},'include':[{'model':db[_0xa9b5e2+_0x031f('0x65')],'as':_0x031f('0x65')},{'model':db[_0xa9b5e2+_0x1f6f71],'as':_0x031f('0x66')}]});})[_0x031f('0x8')](function(_0xb35eef){if(_[_0x031f('0x12')](_0xb35eef)){throw new Error(_0xa9b5e2+_0x031f('0x67'));}_0x5a6db6=_0xb35eef;return _0xb35eef[_0x031f('0x68')]({'read':0x0,'readAt':null,'UserId':null});})[_0x031f('0x8')](function(){var _0x4b077c={'uniqueid':_0x3c7dee+'.'+_0x5a6db6['id']+'.'+_0x5a6db6[_0x031f('0x65')]['id'],'FromUserId':_0x4afad0[_0x031f('0x31')]['id'],'type':'queue','ToUserId':_0x20d85a['id']};_0x4b077c[_0xa9b5e2+_0x031f('0x74')]=_0x5a6db6['id'];_0x4b077c[_0xa9b5e2+_0x031f('0x6a')]=_0x5a6db6[_0x031f('0x65')]['id'];_0x4b077c[_0x031f('0x6b')+_0xa9b5e2+_0x1f6f71+'Id']=_0x5a6db6[_0x031f('0x66')]['id'];return db[_0xa9b5e2+_0x031f('0x75')]['create'](_0x4b077c);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x3c7dee,'interaction':_0x5a6db6[_0x031f('0x65')],'message':_0x5a6db6,'account':_0x5a6db6[_0x031f('0x66')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20d85a[_0x031f('0x10')]+','+(_0x5a6db6[_0x031f('0x66')][_0x031f('0x76')]||0x12c),'interval':_0x031f('0x6e')}]},routingClient);})['then'](respondWithResult(_0x1c31d5,null))[_0x031f('0xd')](handleError(_0x1c31d5,null));}; \ No newline at end of file +var _0x814b=['whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','From','QueueId','create','Start','queue','queueTransferTimeout','Channel\x20field\x20is\x20mandatory','channel','capitalize','chat','User','Agent\x20not\x20found','InteractionId','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','code','message','catch','status','json','sendStatus','stack','name','send','isNil','rows','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','params','voiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','agents','Agents','agentCapacity','user','interaction','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','MailAccounts','openchannelQueues','showOpenchannelQueues','SmsQueues','showSmsQueues'];(function(_0x5dca18,_0x5d480c){var _0x4dc040=function(_0x5f38da){while(--_0x5f38da){_0x5dca18['push'](_0x5dca18['shift']());}};_0x4dc040(++_0x5d480c);}(_0x814b,0x1a2));var _0xb814=function(_0x19d7bf,_0x265436){_0x19d7bf=_0x19d7bf-0x0;var _0x46494c=_0x814b[_0x19d7bf];return _0x46494c;};'use strict';var BPromise=require(_0xb814('0x0'));var moment=require(_0xb814('0x1'));var _=require(_0xb814('0x2'));var util=require(_0xb814('0x3'));var db=require(_0xb814('0x4'))['db'];var logger=require(_0xb814('0x5'))('api');var jayson=require(_0xb814('0x6'));var amiClient=jayson[_0xb814('0x7')][_0xb814('0x8')]({'port':0x232a});var mailClient=jayson[_0xb814('0x7')][_0xb814('0x8')]({'port':0x232b});var routingClient=jayson[_0xb814('0x7')]['http']({'port':0x232c});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){var _0x186d5a=_0x5c8539?_0x5c8539:amiClient;return _0x186d5a[_0xb814('0x9')](_0x3b0829,_0x2e6272)[_0xb814('0xa')](function(_0x21d4a5){if(_0x21d4a5[_0xb814('0xb')]){if(_0x21d4a5[_0xb814('0xb')][_0xb814('0xc')]===0x1f4){return _0x2913a6(_0x21d4a5[_0xb814('0xb')][_0xb814('0xd')]);}return _0x271af9(_0x21d4a5['error'][_0xb814('0xd')]);}else{_0x271af9(_0x21d4a5['result']);}})[_0xb814('0xe')](function(_0x15d6ef){_0x2913a6(_0x15d6ef);});});}function respondWithResult(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xc8;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0xf')](_0x2cc46b)[_0xb814('0x10')](_0x2ce718);}return _0x35b10d[_0xb814('0x11')](0x194);};}function handleError(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0x1f4;return function(_0x3f4881){logger[_0xb814('0xb')](_0x3f4881[_0xb814('0x12')]);if(_0x3f4881[_0xb814('0x13')]){delete _0x3f4881[_0xb814('0x13')];}_0xa0a2e5[_0xb814('0xf')](_0x2ab627)[_0xb814('0x14')](_0x3f4881);};}function findById(_0x265a83){return function(_0x125ce2){if(!_[_0xb814('0x15')](_0x265a83)&&!_[_0xb814('0x15')](_0x125ce2)&&!_['isNil'](_0x125ce2[_0xb814('0x16')])){return _['find'](_0x125ce2[_0xb814('0x16')],function(_0xfac75b){return _0xfac75b['id']==_0x265a83;});}return null;};}exports['voiceChannels']=function(_0x4b55a7,_0x55d63c){return respondWithRpcPromise(_0xb814('0x17'),_0x4b55a7['query'])['then'](respondWithResult(_0x55d63c,null))[_0xb814('0xe')](handleError(_0x55d63c,null));};exports[_0xb814('0x18')]=function(_0x25b6b6,_0x4e139e){return respondWithRpcPromise(_0xb814('0x19'),_['merge'](_0x25b6b6[_0xb814('0x1a')],_0x25b6b6[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x4e139e,null))[_0xb814('0xe')](handleError(_0x4e139e,null));};exports[_0xb814('0x1c')]=function(_0x2bd039,_0x1f5d40){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_[_0xb814('0x1d')](_0x2bd039['query'],_0x2bd039[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x1f5d40,null))[_0xb814('0xe')](handleError(_0x1f5d40,null));};exports[_0xb814('0x1e')]=function(_0x1c8a2e,_0xb9e57d){return respondWithRpcPromise(_0xb814('0x1f'),_0x1c8a2e['query'])[_0xb814('0xa')](respondWithResult(_0xb9e57d,null))[_0xb814('0xe')](handleError(_0xb9e57d,null));};exports[_0xb814('0x20')]=function(_0x349394,_0x32ed56){return respondWithRpcPromise(_0xb814('0x1f'),_0x349394[_0xb814('0x1a')])[_0xb814('0xa')](findById(_0x349394['params']['id']))[_0xb814('0xa')](respondWithResult(_0x32ed56,null))[_0xb814('0xe')](handleError(_0x32ed56,null));};exports['updateVoiceQueue']=function(_0x9008b2,_0x37d24d){return respondWithRpcPromise(_0xb814('0x21'),_['merge'](_0x9008b2[_0xb814('0x22')],_0x9008b2[_0xb814('0x1b')]))['then'](respondWithResult(_0x37d24d,null))[_0xb814('0xe')](handleError(_0x37d24d,null));};exports['voiceQueuesPreview']=function(_0x6efe9a,_0x5f3e9b){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xb814('0x1d')](_0x6efe9a['query'],_0x6efe9a[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x5f3e9b,null))[_0xb814('0xe')](handleError(_0x5f3e9b,null));};exports['voiceQueuesChannels']=function(_0x51d5ae,_0x26d3a9){return respondWithRpcPromise(_0xb814('0x23'),_0x51d5ae['query'])[_0xb814('0xa')](respondWithResult(_0x26d3a9,null))[_0xb814('0xe')](handleError(_0x26d3a9,null));};exports[_0xb814('0x24')]=function(_0x217b7e,_0x1b78de){return respondWithRpcPromise(_0xb814('0x25'),_[_0xb814('0x1d')](_0x217b7e['query'],_0x217b7e[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x1b78de,null))[_0xb814('0xe')](handleError(_0x1b78de,null));};exports[_0xb814('0x26')]=function(_0x14100d,_0x4ff31a){return respondWithRpcPromise(_0xb814('0x27'),_['merge'](_0x14100d[_0xb814('0x1a')],_0x14100d[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x4ff31a,null))['catch'](handleError(_0x4ff31a,null));};exports[_0xb814('0x28')]=function(_0xbdb3e9,_0x4ea6f8){return respondWithRpcPromise(_0xb814('0x29'),_[_0xb814('0x1d')](_0xbdb3e9[_0xb814('0x1a')],_0xbdb3e9[_0xb814('0x1b')]))[_0xb814('0xa')](respondWithResult(_0x4ea6f8,null))[_0xb814('0xe')](handleError(_0x4ea6f8,null));};exports['outbound']=function(_0xa6ce87,_0x4e4684){return respondWithRpcPromise(_0xb814('0x2a'),_0xa6ce87['query'])[_0xb814('0xa')](respondWithResult(_0x4e4684,null))['catch'](handleError(_0x4e4684,null));};exports[_0xb814('0x2b')]=function(_0x26675a,_0x54a7fb){return respondWithRpcPromise('OutboundChannels',_0x26675a['query'])['then'](respondWithResult(_0x54a7fb,null))[_0xb814('0xe')](handleError(_0x54a7fb,null));};exports[_0xb814('0x2c')]=function(_0x38cdc2,_0x42c2ed){var _0x51cdba;return respondWithRpcPromise('Agents',_0x38cdc2[_0xb814('0x1a')])['then'](function(_0x2a93da){_0x51cdba=_0x2a93da;return respondWithRpcPromise(_0xb814('0x2d'),_0x38cdc2[_0xb814('0x1a')],routingClient);})[_0xb814('0xa')](function(_0x42653f){return _[_0xb814('0x1d')]({},_0x42653f,_0x51cdba);})[_0xb814('0xa')](respondWithResult(_0x42c2ed,null))[_0xb814('0xe')](handleError(_0x42c2ed,null));};exports[_0xb814('0x2e')]=function(_0x4b6ff8,_0x544d36){if(_0x4b6ff8['body']&&_0x4b6ff8[_0xb814('0x22')]['interaction']&&_0x4b6ff8[_0xb814('0x2f')]&&_0x4b6ff8['user'][_0xb814('0x13')]){for(var _0x44ff56 in _0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')]){if(_0x4b6ff8['body'][_0xb814('0x30')][_0xb814('0x31')](_0x44ff56)){db[_0xb814('0x32')][_0xb814('0x33')]({'where':{'channel':_0x44ff56,'membername':_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x13')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')][_0x44ff56]&&_0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')][_0x44ff56][_0xb814('0x34')]?{'$notIn':_0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')][_0x44ff56]}:{'$ne':null}}})['then'](function(_0x4a5e84){var _0xe751c3=moment()[_0xb814('0x35')](_0xb814('0x36'));for(var _0x2bf906=0x0,_0x43f1b=_0x4a5e84[_0xb814('0x34')];_0x2bf906<_0x43f1b;_0x2bf906+=0x1){_0x4a5e84[_0x2bf906][_0xb814('0x37')]({'exitAt':_0xe751c3});}});for(var _0x40af85=0x0;_0x40af85<_0x4b6ff8[_0xb814('0x22')][_0xb814('0x30')][_0x44ff56][_0xb814('0x34')];_0x40af85+=0x1){db['MemberReport'][_0xb814('0x38')]({'where':{'channel':_0x44ff56,'membername':_0x4b6ff8[_0xb814('0x2f')]['name'],'type':_0xb814('0x39'),'uniqueid':_0x4b6ff8['body'][_0xb814('0x30')][_0x44ff56][_0x40af85],'exitAt':null},'defaults':{'channel':_0x44ff56,'membername':_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x13')],'interface':_[_0xb814('0x15')](_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x3a')])?util[_0xb814('0x35')](_0xb814('0x3b'),_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x13')]):_0x4b6ff8['user']['interface'],'type':_0xb814('0x39'),'enterAt':moment()[_0xb814('0x35')](_0xb814('0x36')),'role':_0xb814('0x3c'),'internal':_0x4b6ff8[_0xb814('0x2f')][_0xb814('0x3d')],'uniqueid':_0x4b6ff8[_0xb814('0x22')]['interaction'][_0x44ff56][_0x40af85]}});}}}}return respondWithRpcPromise(_0xb814('0x3e'),{'id':_0x4b6ff8[_0xb814('0x1b')]['id'],'capacity':_0x4b6ff8[_0xb814('0x22')]['capacity']},routingClient)[_0xb814('0xa')](respondWithResult(_0x544d36,null))['catch'](handleError(_0x544d36,null));};exports[_0xb814('0x3f')]=function(_0x5dc28e,_0x403872){return respondWithRpcPromise(_0xb814('0x40'),_0x5dc28e['query'])[_0xb814('0xa')](respondWithResult(_0x403872,null))[_0xb814('0xe')](handleError(_0x403872,null));};exports[_0xb814('0x41')]=function(_0x5209d1,_0x3da050){return respondWithRpcPromise('Trunks',_0x5209d1[_0xb814('0x1a')])[_0xb814('0xa')](respondWithResult(_0x3da050,null))['catch'](handleError(_0x3da050,null));};exports[_0xb814('0x42')]=function(_0x4a3f84,_0x539be7){return respondWithRpcPromise(_0xb814('0x43'),_0x4a3f84[_0xb814('0x1a')])[_0xb814('0xa')](respondWithResult(_0x539be7,null))['catch'](handleError(_0x539be7,null));};exports[_0xb814('0x44')]=function(_0x538b0f,_0xf88d23){return respondWithRpcPromise(_0xb814('0x45'),_0x538b0f['query'],routingClient)[_0xb814('0xa')](respondWithResult(_0xf88d23,null))['catch'](handleError(_0xf88d23,null));};exports[_0xb814('0x46')]=function(_0x1656ed,_0xb2bd82){return respondWithRpcPromise(_0xb814('0x45'),_0x1656ed[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](findById(_0x1656ed[_0xb814('0x1b')]['id']))[_0xb814('0xa')](respondWithResult(_0xb2bd82,null))['catch'](handleError(_0xb2bd82,null));};exports[_0xb814('0x47')]=function(_0x5441c5,_0x5d71d5){return respondWithRpcPromise(_0xb814('0x48'),_0x5441c5[_0xb814('0x1a')],routingClient)['then'](respondWithResult(_0x5d71d5,null))[_0xb814('0xe')](handleError(_0x5d71d5,null));};exports['showMailQueues']=function(_0x48362c,_0x2114ca){return respondWithRpcPromise('MailQueues',_0x48362c[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](findById(_0x48362c[_0xb814('0x1b')]['id']))['then'](respondWithResult(_0x2114ca,null))[_0xb814('0xe')](handleError(_0x2114ca,null));};exports['mailAccounts']=function(_0x2ef77d,_0x1e9196){return respondWithRpcPromise(_0xb814('0x49'),_0x2ef77d[_0xb814('0x1a')],mailClient)[_0xb814('0xa')](respondWithResult(_0x1e9196,null))[_0xb814('0xe')](handleError(_0x1e9196,null));};exports[_0xb814('0x4a')]=function(_0x113350,_0x46014f){return respondWithRpcPromise('OpenchannelQueues',_0x113350[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x46014f,null))[_0xb814('0xe')](handleError(_0x46014f,null));};exports[_0xb814('0x4b')]=function(_0x3b35a8,_0x3d4843){return respondWithRpcPromise('OpenchannelQueues',_0x3b35a8[_0xb814('0x1a')],routingClient)['then'](findById(_0x3b35a8[_0xb814('0x1b')]['id']))[_0xb814('0xa')](respondWithResult(_0x3d4843,null))[_0xb814('0xe')](handleError(_0x3d4843,null));};exports['smsQueues']=function(_0x150e73,_0x579351){return respondWithRpcPromise(_0xb814('0x4c'),_0x150e73['query'],routingClient)[_0xb814('0xa')](respondWithResult(_0x579351,null))[_0xb814('0xe')](handleError(_0x579351,null));};exports[_0xb814('0x4d')]=function(_0x1b024f,_0x3377d4){return respondWithRpcPromise(_0xb814('0x4c'),_0x1b024f[_0xb814('0x1a')],routingClient)['then'](findById(_0x1b024f[_0xb814('0x1b')]['id']))['then'](respondWithResult(_0x3377d4,null))[_0xb814('0xe')](handleError(_0x3377d4,null));};exports[_0xb814('0x4e')]=function(_0x1b989d,_0x3dcaeb){return respondWithRpcPromise(_0xb814('0x4f'),_0x1b989d[_0xb814('0x1a')],routingClient)['then'](respondWithResult(_0x3dcaeb,null))[_0xb814('0xe')](handleError(_0x3dcaeb,null));};exports[_0xb814('0x50')]=function(_0x4a49ba,_0x3bb2b4){return respondWithRpcPromise(_0xb814('0x4f'),_0x4a49ba[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](findById(_0x4a49ba[_0xb814('0x1b')]['id']))['then'](respondWithResult(_0x3bb2b4,null))[_0xb814('0xe')](handleError(_0x3bb2b4,null));};exports['faxQueues']=function(_0x24594a,_0x16f8f2){return respondWithRpcPromise(_0xb814('0x51'),_0x24594a[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x16f8f2,null))[_0xb814('0xe')](handleError(_0x16f8f2,null));};exports['showFaxQueues']=function(_0x506bf2,_0x5d064b){return respondWithRpcPromise(_0xb814('0x51'),_0x506bf2['query'],routingClient)[_0xb814('0xa')](findById(_0x506bf2[_0xb814('0x1b')]['id']))[_0xb814('0xa')](respondWithResult(_0x5d064b,null))['catch'](handleError(_0x5d064b,null));};exports[_0xb814('0x52')]=function(_0x3e5ce8,_0xee204){return respondWithRpcPromise('FaxAccounts',_0x3e5ce8[_0xb814('0x1a')])[_0xb814('0xa')](respondWithResult(_0xee204,null))[_0xb814('0xe')](handleError(_0xee204,null));};exports[_0xb814('0x53')]=function(_0x555be0,_0x5dedd7){return respondWithRpcPromise(_0xb814('0x54'),_0x555be0[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x5dedd7,null))[_0xb814('0xe')](handleError(_0x5dedd7,null));};exports[_0xb814('0x55')]=function(_0xe5fc12,_0x34a0b3){return respondWithRpcPromise(_0xb814('0x56'),_0xe5fc12[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x34a0b3,null))[_0xb814('0xe')](handleError(_0x34a0b3,null));};exports[_0xb814('0x57')]=function(_0x3ef474,_0x21fc41){return respondWithRpcPromise(_0xb814('0x58'),_0x3ef474['query'],routingClient)[_0xb814('0xa')](respondWithResult(_0x21fc41,null))[_0xb814('0xe')](handleError(_0x21fc41,null));};exports[_0xb814('0x59')]=function(_0x357b90,_0xec821a){return respondWithRpcPromise(_0xb814('0x58'),_0x357b90['query'],routingClient)[_0xb814('0xa')](function(_0x52e1fc){if(_0x357b90[_0xb814('0x1a')][_0xb814('0x5a')]!==undefined){var _0x3c5a58=_(_0x52e1fc[_0xb814('0x16')])[_0xb814('0x5b')]([_0x357b90['query']['type'],_0x357b90[_0xb814('0x1b')]['id']])[_0xb814('0x5c')](_0xb814('0x5d'))[_0xb814('0x5e')]()['value']();return _0x52e1fc[_0xb814('0x16')]['filter'](function(_0x39073c){return _0x3c5a58[_0xb814('0x5f')](_0x39073c['queue_id'])>-0x1;});}else{return _0x52e1fc['rows'][_0xb814('0x5b')](function(_0x52e17a){return _0x52e17a[_0xb814('0x5d')]===parseInt(_0x357b90[_0xb814('0x1b')]['id']);});}})[_0xb814('0xa')](respondWithResult(_0xec821a,null))[_0xb814('0xe')](handleError(_0xec821a,null));};exports[_0xb814('0x60')]=function(_0x420bde,_0x40fe4a){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x420bde[_0xb814('0x1a')],routingClient)['then'](respondWithResult(_0x40fe4a,null))[_0xb814('0xe')](handleError(_0x40fe4a,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2838cb,_0x43ee60){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2838cb[_0xb814('0x1a')],routingClient)['then'](respondWithResult(_0x43ee60,null))[_0xb814('0xe')](handleError(_0x43ee60,null));};exports[_0xb814('0x61')]=function(_0x4e15c2,_0x5a0c4a){return respondWithRpcPromise(_0xb814('0x62'),_0x4e15c2[_0xb814('0x1a')],routingClient)[_0xb814('0xa')](respondWithResult(_0x5a0c4a,null))[_0xb814('0xe')](handleError(_0x5a0c4a,null));};exports[_0xb814('0x63')]=function(_0x4394da){return function(_0x2b12a9,_0x314600){var _0x8cb107,_0x34f49c;var _0x53e705=_['capitalize'](_0x4394da);var _0x5bee4d=_0x4394da==='chat'?'Website':_0xb814('0x64');return db[_0x53e705+_0xb814('0x65')][_0xb814('0x66')]({'raw':!![],'where':{'id':_0x2b12a9['params']['id']}})[_0xb814('0xa')](function(_0x1fb1ea){if(_[_0xb814('0x15')](_0x1fb1ea)){throw new Error(_0x53e705+_0xb814('0x67'));}_0x8cb107=_0x1fb1ea;return db[_0x53e705+_0xb814('0x68')][_0xb814('0x66')]({'where':{'id':_0x2b12a9[_0xb814('0x22')][_0xb814('0x69')]},'include':[{'model':db[_0x53e705+'Interaction'],'as':_0xb814('0x6a')},{'model':db[_0x53e705+_0x5bee4d],'as':_0xb814('0x64')}]});})[_0xb814('0xa')](function(_0x30faa0){if(_['isNil'](_0x30faa0)){throw new Error(_0x53e705+_0xb814('0x6b'));}_0x34f49c=_0x30faa0;return _0x30faa0[_0xb814('0x6c')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb814('0xa')](function(){var _0x3037f2={'uniqueid':_0x4394da+'.'+_0x34f49c['id']+'.'+_0x34f49c[_0xb814('0x6a')]['id'],'FromUserId':_0x2b12a9['user']['id'],'type':'queue'};_0x3037f2[_0x53e705+_0xb814('0x6d')]=_0x34f49c['id'];_0x3037f2[_0x53e705+'InteractionId']=_0x34f49c[_0xb814('0x6a')]['id'];_0x3037f2[_0xb814('0x6e')+_0x53e705+_0x5bee4d+'Id']=_0x34f49c['Account']['id'];_0x3037f2['To'+_0x53e705+_0xb814('0x6f')]=_0x8cb107['id'];return db[_0x53e705+'TransferReport'][_0xb814('0x70')](_0x3037f2);})['then'](function(){return respondWithRpcPromise(_0xb814('0x71'),{'channel':_0x4394da,'interaction':_0x34f49c[_0xb814('0x6a')],'message':_0x34f49c,'account':_0x34f49c[_0xb814('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb814('0x72'),'appdata':_0x8cb107[_0xb814('0x13')]+','+(_0x34f49c[_0xb814('0x64')][_0xb814('0x73')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x314600,null))[_0xb814('0xe')](handleError(_0x314600,null));};};exports['agentNotify']=function(_0x511e03,_0x2d0061){var _0x8fbda1,_0x25d42d;if(_['isNil'](_0x511e03[_0xb814('0x22')]['channel'])){throw new Error(_0xb814('0x74'));}var _0x19d508=_0x511e03[_0xb814('0x22')][_0xb814('0x75')];var _0x4c8a00=_[_0xb814('0x76')](_0x19d508);var _0xc0ff3c=_0x19d508===_0xb814('0x77')?'Website':_0xb814('0x64');return db[_0xb814('0x78')][_0xb814('0x66')]({'raw':!![],'where':{'id':_0x511e03['params']['id'],'role':_0xb814('0x3c')}})[_0xb814('0xa')](function(_0x9dc06b){if(_[_0xb814('0x15')](_0x9dc06b)){throw new Error(_0xb814('0x79'));}_0x8fbda1=_0x9dc06b;return db[_0x4c8a00+_0xb814('0x68')][_0xb814('0x66')]({'where':{'id':_0x511e03[_0xb814('0x22')][_0xb814('0x69')]},'include':[{'model':db[_0x4c8a00+_0xb814('0x6a')],'as':_0xb814('0x6a')},{'model':db[_0x4c8a00+_0xc0ff3c],'as':_0xb814('0x64')}]});})[_0xb814('0xa')](function(_0x5b8d2e){if(_['isNil'](_0x5b8d2e)){throw new Error(_0x4c8a00+_0xb814('0x6b'));}_0x25d42d=_0x5b8d2e;return _0x5b8d2e['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xb814('0xa')](function(){var _0x3949fd={'uniqueid':_0x19d508+'.'+_0x25d42d['id']+'.'+_0x25d42d[_0xb814('0x6a')]['id'],'FromUserId':_0x511e03[_0xb814('0x2f')]['id'],'type':_0xb814('0x72'),'ToUserId':_0x8fbda1['id']};_0x3949fd[_0x4c8a00+_0xb814('0x6d')]=_0x25d42d['id'];_0x3949fd[_0x4c8a00+_0xb814('0x7a')]=_0x25d42d['Interaction']['id'];_0x3949fd['From'+_0x4c8a00+_0xc0ff3c+'Id']=_0x25d42d[_0xb814('0x64')]['id'];return db[_0x4c8a00+'TransferReport'][_0xb814('0x70')](_0x3949fd);})[_0xb814('0xa')](function(){return respondWithRpcPromise(_0xb814('0x71'),{'channel':_0x19d508,'interaction':_0x25d42d['Interaction'],'message':_0x25d42d,'account':_0x25d42d[_0xb814('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb814('0x3c'),'appdata':_0x8fbda1[_0xb814('0x13')]+','+(_0x25d42d[_0xb814('0x64')][_0xb814('0x7b')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xb814('0xa')](respondWithResult(_0x2d0061,null))[_0xb814('0xe')](handleError(_0x2d0061,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index ebe5070..84191f9 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 _0xd6da=['destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','run','post','create','put','delete'];(function(_0x74118b,_0x239694){var _0x257525=function(_0x531db8){while(--_0x531db8){_0x74118b['push'](_0x74118b['shift']());}};_0x257525(++_0x239694);}(_0xd6da,0x158));var _0xad6d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6da[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xad6d('0x0'));var path=require('path');var timeout=require(_0xad6d('0x1'));var express=require(_0xad6d('0x2'));var router=express['Router']();var fs_extra=require(_0xad6d('0x3'));var auth=require(_0xad6d('0x4'));var interaction=require(_0xad6d('0x5'));var config=require('../../config/environment');var controller=require('./schedule.controller');router['get']('/',auth[_0xad6d('0x6')](),controller[_0xad6d('0x7')]);router[_0xad6d('0x8')](_0xad6d('0x9'),auth[_0xad6d('0x6')](),controller[_0xad6d('0xa')]);router['get']('/:id/run',auth['isAuthenticated'](),controller[_0xad6d('0xb')]);router[_0xad6d('0xc')]('/',auth[_0xad6d('0x6')](),controller[_0xad6d('0xd')]);router[_0xad6d('0xe')](_0xad6d('0x9'),auth[_0xad6d('0x6')](),controller['update']);router[_0xad6d('0xf')](_0xad6d('0x9'),auth[_0xad6d('0x6')](),controller[_0xad6d('0x10')]);module[_0xad6d('0x11')]=router; \ No newline at end of file +var _0x5d07=['show','post','create','put','update','delete','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./schedule.controller','get','isAuthenticated','index','/:id'];(function(_0x2ff725,_0x178b22){var _0x228d5d=function(_0x130ffd){while(--_0x130ffd){_0x2ff725['push'](_0x2ff725['shift']());}};_0x228d5d(++_0x178b22);}(_0x5d07,0x105));var _0x75d0=function(_0x4d30e5,_0x341957){_0x4d30e5=_0x4d30e5-0x0;var _0x5880b1=_0x5d07[_0x4d30e5];return _0x5880b1;};'use strict';var multer=require('multer');var util=require(_0x75d0('0x0'));var path=require('path');var timeout=require(_0x75d0('0x1'));var express=require(_0x75d0('0x2'));var router=express[_0x75d0('0x3')]();var fs_extra=require(_0x75d0('0x4'));var auth=require(_0x75d0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x75d0('0x6'));router[_0x75d0('0x7')]('/',auth[_0x75d0('0x8')](),controller[_0x75d0('0x9')]);router[_0x75d0('0x7')](_0x75d0('0xa'),auth['isAuthenticated'](),controller[_0x75d0('0xb')]);router['get']('/:id/run',auth[_0x75d0('0x8')](),controller['run']);router[_0x75d0('0xc')]('/',auth[_0x75d0('0x8')](),controller[_0x75d0('0xd')]);router[_0x75d0('0xe')](_0x75d0('0xa'),auth[_0x75d0('0x8')](),controller[_0x75d0('0xf')]);router[_0x75d0('0x10')]('/:id',auth[_0x75d0('0x8')](),controller['destroy']);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 80f3faf..1a39c72 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 _0x6097=['quarters','weeks','days','minutes','xlsx','csv','custom','default','TEXT','sequelize','STRING','BOOLEAN','DATE','ENUM'];(function(_0x24b676,_0x22006b){var _0x38dda3=function(_0x5b2d2a){while(--_0x5b2d2a){_0x24b676['push'](_0x24b676['shift']());}};_0x38dda3(++_0x22006b);}(_0x6097,0x167));var _0x7609=function(_0x4a80f6,_0x3d43ad){_0x4a80f6=_0x4a80f6-0x0;var _0x5bc762=_0x6097[_0x4a80f6];return _0x5bc762;};'use strict';var Sequelize=require(_0x7609('0x0'));module['exports']={'name':{'type':Sequelize[_0x7609('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x7609('0x1')]},'active':{'type':Sequelize[_0x7609('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7609('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x7609('0x3')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7609('0x3')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7609('0x4')]('years',_0x7609('0x5'),'months',_0x7609('0x6'),_0x7609('0x7'),'hours',_0x7609('0x8')),'allowNull':![],'defaultValue':_0x7609('0x7')},'output':{'type':Sequelize[_0x7609('0x4')]('csv','pdf',_0x7609('0x9')),'allowNull':![],'defaultValue':_0x7609('0xa')},'type':{'type':Sequelize[_0x7609('0x4')](_0x7609('0xb'),_0x7609('0xc')),'allowNull':![],'defaultValue':_0x7609('0xb')},'sendMail':{'type':Sequelize[_0x7609('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x7609('0x1')]},'cc':{'type':Sequelize[_0x7609('0xd')]},'bcc':{'type':Sequelize[_0x7609('0xd')]},'sendIfEmpty':{'type':Sequelize[_0x7609('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x55bb=['days','hours','csv','pdf','xlsx','custom','default','BOOLEAN','TEXT','exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks'];(function(_0x56be45,_0x10cd0e){var _0x1b75d3=function(_0x314616){while(--_0x314616){_0x56be45['push'](_0x56be45['shift']());}};_0x1b75d3(++_0x10cd0e);}(_0x55bb,0x185));var _0xb55b=function(_0x230753,_0x2966d6){_0x230753=_0x230753-0x0;var _0x4a57b9=_0x55bb[_0x230753];return _0x4a57b9;};'use strict';var Sequelize=require('sequelize');module[_0xb55b('0x0')]={'name':{'type':Sequelize[_0xb55b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb55b('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb55b('0x2')},'startAt':{'type':Sequelize[_0xb55b('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb55b('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb55b('0x5')](_0xb55b('0x6'),_0xb55b('0x7'),_0xb55b('0x8'),_0xb55b('0x9'),_0xb55b('0xa'),_0xb55b('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xb55b('0xa')},'output':{'type':Sequelize[_0xb55b('0x5')](_0xb55b('0xc'),_0xb55b('0xd'),_0xb55b('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xb55b('0x5')](_0xb55b('0xf'),_0xb55b('0x10')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xb55b('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0xb55b('0x1')]},'cc':{'type':Sequelize[_0xb55b('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index b8dd9a4..c574973 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 _0x8955=['sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','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','get','UserProfileResource','destroy','error','stack','name','send','map','Schedule','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','keys','find','create','body','user','Scheduler','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path'];(function(_0x31bf22,_0x311d80){var _0x568602=function(_0x5401cb){while(--_0x5401cb){_0x31bf22['push'](_0x31bf22['shift']());}};_0x568602(++_0x311d80);}(_0x8955,0xf7));var _0x5895=function(_0x1f08d2,_0x3f44e1){_0x1f08d2=_0x1f08d2-0x0;var _0x1521bf=_0x8955[_0x1f08d2];return _0x1521bf;};'use strict';var emlformat=require(_0x5895('0x0'));var rimraf=require(_0x5895('0x1'));var zipdir=require(_0x5895('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5895('0x3'));var moment=require('moment');var BPromise=require(_0x5895('0x4'));var Mustache=require(_0x5895('0x5'));var util=require(_0x5895('0x6'));var path=require(_0x5895('0x7'));var sox=require(_0x5895('0x8'));var csv=require('to-csv');var ejs=require(_0x5895('0x9'));var fs=require('fs');var fs_extra=require(_0x5895('0xa'));var _=require(_0x5895('0xb'));var squel=require(_0x5895('0xc'));var crypto=require(_0x5895('0xd'));var jsforce=require(_0x5895('0xe'));var deskjs=require(_0x5895('0xf'));var toCsv=require(_0x5895('0x10'));var querystring=require(_0x5895('0x11'));var Papa=require(_0x5895('0x12'));var Redis=require(_0x5895('0x13'));var authService=require(_0x5895('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5895('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5895('0x16'));var utils=require(_0x5895('0x17'));var config=require(_0x5895('0x18'));var licenseUtil=require(_0x5895('0x19'));var db=require(_0x5895('0x1a'))['db'];function respondWithStatusCode(_0x3fa4a7,_0x7c74dd){_0x7c74dd=_0x7c74dd||0xcc;return function(_0x54ba54){if(_0x54ba54){return _0x3fa4a7[_0x5895('0x1b')](_0x7c74dd);}return _0x3fa4a7[_0x5895('0x1c')](_0x7c74dd)[_0x5895('0x1d')]();};}function respondWithResult(_0x19c942,_0x4d39a9){_0x4d39a9=_0x4d39a9||0xc8;return function(_0x516849){if(_0x516849){return _0x19c942[_0x5895('0x1c')](_0x4d39a9)[_0x5895('0x1e')](_0x516849);}};}function respondWithFilteredResult(_0x557def,_0x941563){return function(_0x42bd31){if(_0x42bd31){var _0x571249=typeof _0x941563[_0x5895('0x1f')]===_0x5895('0x20')&&typeof _0x941563[_0x5895('0x21')]==='undefined';var _0x58ce4a=_0x42bd31[_0x5895('0x22')];var _0x5d64d1=_0x571249?0x0:_0x941563[_0x5895('0x1f')];var _0x56565e=_0x571249?_0x42bd31['count']:_0x941563[_0x5895('0x1f')]+_0x941563[_0x5895('0x21')];var _0x32a384;if(_0x56565e>=_0x58ce4a){_0x56565e=_0x58ce4a;_0x32a384=0xc8;}else{_0x32a384=0xce;}_0x557def[_0x5895('0x1c')](_0x32a384);return _0x557def[_0x5895('0x23')](_0x5895('0x24'),_0x5d64d1+'-'+_0x56565e+'/'+_0x58ce4a)[_0x5895('0x1e')](_0x42bd31);}return null;};}function patchUpdates(_0x429030){return function(_0x2e6949){try{jsonpatch[_0x5895('0x25')](_0x2e6949,_0x429030,!![]);}catch(_0x1d4ccd){return BPromise[_0x5895('0x26')](_0x1d4ccd);}return _0x2e6949[_0x5895('0x27')]();};}function saveUpdates(_0x573541,_0xaa2f16){return function(_0x246802){if(_0x246802){return _0x246802[_0x5895('0x28')](_0x573541)[_0x5895('0x29')](function(_0x414087){return _0x414087;});}return null;};}function removeEntity(_0x5e20b0,_0x4d944b){return function(_0x579fa4){if(_0x579fa4){return _0x579fa4['destroy']()[_0x5895('0x29')](function(){var _0x4d9699=_0x579fa4[_0x5895('0x2a')]({'plain':!![]});var _0x5b1734='Scheduler';return db[_0x5895('0x2b')][_0x5895('0x2c')]({'where':{'type':_0x5b1734,'resourceId':_0x4d9699['id']}})[_0x5895('0x29')](function(){return _0x579fa4;});})[_0x5895('0x29')](function(){_0x5e20b0['status'](0xcc)[_0x5895('0x1d')]();});}};}function handleEntityNotFound(_0x3da497,_0x5ba79d){return function(_0x380fa1){if(!_0x380fa1){_0x3da497[_0x5895('0x1b')](0x194);}return _0x380fa1;};}function handleError(_0x4833b8,_0x203531){_0x203531=_0x203531||0x1f4;return function(_0x2d8403){logger[_0x5895('0x2d')](_0x2d8403[_0x5895('0x2e')]);if(_0x2d8403[_0x5895('0x2f')]){delete _0x2d8403[_0x5895('0x2f')];}_0x4833b8[_0x5895('0x1c')](_0x203531)[_0x5895('0x30')](_0x2d8403);};}exports['index']=function(_0x19c191,_0x43090b){var _0x16295d={},_0x3b9a59={},_0x25951a={'count':0x0,'rows':[]};var _0x791206=_[_0x5895('0x31')](db[_0x5895('0x32')]['rawAttributes'],function(_0x3ccddd){return{'name':_0x3ccddd[_0x5895('0x33')],'type':_0x3ccddd['type']['key']};});_0x3b9a59[_0x5895('0x34')]=_[_0x5895('0x31')](_0x791206,'name');_0x3b9a59[_0x5895('0x35')]=_['keys'](_0x19c191['query']);_0x3b9a59['filters']=_[_0x5895('0x36')](_0x3b9a59[_0x5895('0x34')],_0x3b9a59[_0x5895('0x35')]);_0x16295d[_0x5895('0x37')]=_[_0x5895('0x36')](_0x3b9a59[_0x5895('0x34')],qs[_0x5895('0x38')](_0x19c191[_0x5895('0x35')][_0x5895('0x38')]));_0x16295d[_0x5895('0x37')]=_0x16295d['attributes'][_0x5895('0x39')]?_0x16295d[_0x5895('0x37')]:_0x3b9a59['model'];if(!_0x19c191['query'][_0x5895('0x3a')](_0x5895('0x3b'))){_0x16295d[_0x5895('0x21')]=qs[_0x5895('0x21')](_0x19c191[_0x5895('0x35')][_0x5895('0x21')]);_0x16295d[_0x5895('0x1f')]=qs[_0x5895('0x1f')](_0x19c191[_0x5895('0x35')][_0x5895('0x1f')]);}_0x16295d[_0x5895('0x3c')]=qs[_0x5895('0x3d')](_0x19c191['query'][_0x5895('0x3d')]);_0x16295d[_0x5895('0x3e')]=qs[_0x5895('0x3f')](_[_0x5895('0x40')](_0x19c191[_0x5895('0x35')],_0x3b9a59['filters']),_0x791206);if(_0x19c191[_0x5895('0x35')]['filter']){_0x16295d[_0x5895('0x3e')]=_[_0x5895('0x41')](_0x16295d['where'],{'$or':_['map'](_0x791206,function(_0x96387c){if(_0x96387c[_0x5895('0x42')]!==_0x5895('0x43')){var _0x131ac9={};_0x131ac9[_0x96387c[_0x5895('0x2f')]]={'$like':'%'+_0x19c191[_0x5895('0x35')][_0x5895('0x44')]+'%'};return _0x131ac9;}})});}_0x16295d=_[_0x5895('0x41')]({},_0x16295d,_0x19c191[_0x5895('0x45')]);var _0x57658d={'where':_0x16295d[_0x5895('0x3e')]};return db[_0x5895('0x32')]['count'](_0x57658d)['then'](function(_0x21578d){_0x25951a[_0x5895('0x22')]=_0x21578d;if(_0x19c191[_0x5895('0x35')][_0x5895('0x46')]){_0x16295d[_0x5895('0x47')]=[{'all':!![]}];}return db['Schedule'][_0x5895('0x48')](_0x16295d);})[_0x5895('0x29')](function(_0x540439){_0x25951a['rows']=_0x540439;return _0x25951a;})[_0x5895('0x29')](respondWithFilteredResult(_0x43090b,_0x16295d))[_0x5895('0x49')](handleError(_0x43090b,null));};exports['show']=function(_0x1d3973,_0x344ade){var _0x681f90={'raw':![],'where':{'id':_0x1d3973['params']['id']}},_0x4930c4={};_0x4930c4[_0x5895('0x34')]=_[_0x5895('0x4a')](db[_0x5895('0x32')]['rawAttributes']);_0x4930c4['query']=_[_0x5895('0x4a')](_0x1d3973[_0x5895('0x35')]);_0x4930c4[_0x5895('0x3f')]=_[_0x5895('0x36')](_0x4930c4[_0x5895('0x34')],_0x4930c4[_0x5895('0x35')]);_0x681f90[_0x5895('0x37')]=_[_0x5895('0x36')](_0x4930c4[_0x5895('0x34')],qs['fields'](_0x1d3973[_0x5895('0x35')][_0x5895('0x38')]));_0x681f90[_0x5895('0x37')]=_0x681f90[_0x5895('0x37')][_0x5895('0x39')]?_0x681f90['attributes']:_0x4930c4[_0x5895('0x34')];if(_0x1d3973[_0x5895('0x35')]['includeAll']){_0x681f90[_0x5895('0x47')]=[{'all':!![]}];}_0x681f90=_[_0x5895('0x41')]({},_0x681f90,_0x1d3973[_0x5895('0x45')]);return db[_0x5895('0x32')][_0x5895('0x4b')](_0x681f90)[_0x5895('0x29')](handleEntityNotFound(_0x344ade,null))[_0x5895('0x29')](respondWithResult(_0x344ade,null))[_0x5895('0x49')](handleError(_0x344ade,null));};exports[_0x5895('0x4c')]=function(_0x4a48e5,_0x45be07){return db[_0x5895('0x32')]['create'](_0x4a48e5[_0x5895('0x4d')],{})['then'](function(_0x100445){var _0x2ee22e=_0x4a48e5[_0x5895('0x4e')][_0x5895('0x2a')]({'plain':!![]});if(!_0x2ee22e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2ee22e['role']===_0x5895('0x4e')){var _0x21b8dc=_0x100445[_0x5895('0x2a')]({'plain':!![]});var _0x4789ef=_0x5895('0x4f');return db[_0x5895('0x50')][_0x5895('0x4b')]({'where':{'name':_0x4789ef,'userProfileId':_0x2ee22e[_0x5895('0x51')]},'raw':!![]})[_0x5895('0x29')](function(_0x485d1b){if(_0x485d1b&&_0x485d1b['autoAssociation']===0x0){return db[_0x5895('0x2b')][_0x5895('0x4c')]({'name':_0x21b8dc['name'],'resourceId':_0x21b8dc['id'],'type':_0x485d1b['name'],'sectionId':_0x485d1b['id']},{})[_0x5895('0x29')](function(){return _0x100445;});}else{return _0x100445;}})[_0x5895('0x49')](function(_0x3746fa){logger[_0x5895('0x2d')](_0x5895('0x52'),_0x3746fa);throw _0x3746fa;});}return _0x100445;})[_0x5895('0x29')](respondWithResult(_0x45be07,0xc9))['catch'](handleError(_0x45be07,null));};exports['update']=function(_0x37758b,_0x51504e){if(_0x37758b['body']['id']){delete _0x37758b[_0x5895('0x4d')]['id'];}return db[_0x5895('0x32')]['find']({'where':{'id':_0x37758b[_0x5895('0x53')]['id']}})[_0x5895('0x29')](handleEntityNotFound(_0x51504e,null))[_0x5895('0x29')](saveUpdates(_0x37758b[_0x5895('0x4d')],null))[_0x5895('0x29')](respondWithResult(_0x51504e,null))[_0x5895('0x49')](handleError(_0x51504e,null));};exports[_0x5895('0x2c')]=function(_0x529a76,_0x4c57b4){return db['Schedule'][_0x5895('0x4b')]({'where':{'id':_0x529a76[_0x5895('0x53')]['id']}})[_0x5895('0x29')](handleEntityNotFound(_0x4c57b4,null))[_0x5895('0x29')](removeEntity(_0x4c57b4,null))[_0x5895('0x49')](handleError(_0x4c57b4,null));};exports['run']=function(_0x2f649f,_0x1f51c5,_0x51c27c){var _0x52c102=require('../../config/schedule');return db['Schedule']['find']({'where':{'id':_0x2f649f[_0x5895('0x53')]['id']},'raw':!![]})[_0x5895('0x29')](handleEntityNotFound(_0x1f51c5,null))[_0x5895('0x29')](function(){_0x52c102[_0x5895('0x54')](_0x2f649f['params']['id']);})[_0x5895('0x29')](respondWithStatusCode(_0x1f51c5,null))[_0x5895('0x49')](handleError(_0x1f51c5,null));}; \ No newline at end of file +var _0x3398=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','run','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','destroy','then','get','UserProfileResource','end','sendStatus','error','name','index','map','Schedule','rawAttributes','fieldName','key','keys','filters','attributes','intersection','model','fields','query','hasOwnProperty','nolimit','sort','where','filter','merge','type'];(function(_0x31c9b0,_0x3b3bfa){var _0x3c117b=function(_0x1d2e52){while(--_0x1d2e52){_0x31c9b0['push'](_0x31c9b0['shift']());}};_0x3c117b(++_0x3b3bfa);}(_0x3398,0x1be));var _0x8339=function(_0x3242fe,_0x3e1fff){_0x3242fe=_0x3242fe-0x0;var _0x4532c5=_0x3398[_0x3242fe];return _0x4532c5;};'use strict';var emlformat=require(_0x8339('0x0'));var rimraf=require(_0x8339('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8339('0x2'));var moment=require(_0x8339('0x3'));var BPromise=require(_0x8339('0x4'));var Mustache=require(_0x8339('0x5'));var util=require(_0x8339('0x6'));var path=require(_0x8339('0x7'));var sox=require(_0x8339('0x8'));var csv=require('to-csv');var ejs=require(_0x8339('0x9'));var fs=require('fs');var fs_extra=require(_0x8339('0xa'));var _=require(_0x8339('0xb'));var squel=require(_0x8339('0xc'));var crypto=require(_0x8339('0xd'));var jsforce=require(_0x8339('0xe'));var deskjs=require(_0x8339('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8339('0x10'));var Papa=require(_0x8339('0x11'));var Redis=require(_0x8339('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8339('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8339('0x14'))(_0x8339('0x15'));var utils=require(_0x8339('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8339('0x17'));var db=require(_0x8339('0x18'))['db'];function respondWithStatusCode(_0x6ee24c,_0x10e7ed){_0x10e7ed=_0x10e7ed||0xcc;return function(_0x34c832){if(_0x34c832){return _0x6ee24c['sendStatus'](_0x10e7ed);}return _0x6ee24c['status'](_0x10e7ed)['end']();};}function respondWithResult(_0x57799e,_0x3f6fff){_0x3f6fff=_0x3f6fff||0xc8;return function(_0x4382cc){if(_0x4382cc){return _0x57799e['status'](_0x3f6fff)[_0x8339('0x19')](_0x4382cc);}};}function respondWithFilteredResult(_0x482404,_0x246a55){return function(_0x53efca){if(_0x53efca){var _0x517ae6=typeof _0x246a55[_0x8339('0x1a')]===_0x8339('0x1b')&&typeof _0x246a55[_0x8339('0x1c')]===_0x8339('0x1b');var _0x5b7884=_0x53efca['count'];var _0x377df3=_0x517ae6?0x0:_0x246a55[_0x8339('0x1a')];var _0x323577=_0x517ae6?_0x53efca[_0x8339('0x1d')]:_0x246a55[_0x8339('0x1a')]+_0x246a55[_0x8339('0x1c')];var _0xb8e700;if(_0x323577>=_0x5b7884){_0x323577=_0x5b7884;_0xb8e700=0xc8;}else{_0xb8e700=0xce;}_0x482404[_0x8339('0x1e')](_0xb8e700);return _0x482404[_0x8339('0x1f')](_0x8339('0x20'),_0x377df3+'-'+_0x323577+'/'+_0x5b7884)[_0x8339('0x19')](_0x53efca);}return null;};}function patchUpdates(_0x4b8b7d){return function(_0x17abbc){try{jsonpatch['apply'](_0x17abbc,_0x4b8b7d,!![]);}catch(_0x27bfdc){return BPromise[_0x8339('0x21')](_0x27bfdc);}return _0x17abbc[_0x8339('0x22')]();};}function saveUpdates(_0x48ff50,_0x34a6cc){return function(_0x174c05){if(_0x174c05){return _0x174c05[_0x8339('0x23')](_0x48ff50)['then'](function(_0x3550d1){return _0x3550d1;});}return null;};}function removeEntity(_0x352c25,_0x289ab2){return function(_0x14d1c9){if(_0x14d1c9){return _0x14d1c9[_0x8339('0x24')]()[_0x8339('0x25')](function(){var _0x25cb9c=_0x14d1c9[_0x8339('0x26')]({'plain':!![]});var _0x11dd03='Scheduler';return db[_0x8339('0x27')][_0x8339('0x24')]({'where':{'type':_0x11dd03,'resourceId':_0x25cb9c['id']}})['then'](function(){return _0x14d1c9;});})[_0x8339('0x25')](function(){_0x352c25[_0x8339('0x1e')](0xcc)[_0x8339('0x28')]();});}};}function handleEntityNotFound(_0x47dabd,_0x316fa4){return function(_0x11d74b){if(!_0x11d74b){_0x47dabd[_0x8339('0x29')](0x194);}return _0x11d74b;};}function handleError(_0x36c9f2,_0x45ee04){_0x45ee04=_0x45ee04||0x1f4;return function(_0x5ecf05){logger[_0x8339('0x2a')](_0x5ecf05['stack']);if(_0x5ecf05[_0x8339('0x2b')]){delete _0x5ecf05['name'];}_0x36c9f2[_0x8339('0x1e')](_0x45ee04)['send'](_0x5ecf05);};}exports[_0x8339('0x2c')]=function(_0x4d5d4e,_0x278ca9){var _0x2ffdeb={},_0x46c970={},_0x300193={'count':0x0,'rows':[]};var _0x15ce9b=_[_0x8339('0x2d')](db[_0x8339('0x2e')][_0x8339('0x2f')],function(_0x478943){return{'name':_0x478943[_0x8339('0x30')],'type':_0x478943['type'][_0x8339('0x31')]};});_0x46c970['model']=_[_0x8339('0x2d')](_0x15ce9b,_0x8339('0x2b'));_0x46c970['query']=_[_0x8339('0x32')](_0x4d5d4e['query']);_0x46c970[_0x8339('0x33')]=_['intersection'](_0x46c970['model'],_0x46c970['query']);_0x2ffdeb[_0x8339('0x34')]=_[_0x8339('0x35')](_0x46c970[_0x8339('0x36')],qs[_0x8339('0x37')](_0x4d5d4e[_0x8339('0x38')]['fields']));_0x2ffdeb[_0x8339('0x34')]=_0x2ffdeb[_0x8339('0x34')]['length']?_0x2ffdeb[_0x8339('0x34')]:_0x46c970['model'];if(!_0x4d5d4e[_0x8339('0x38')][_0x8339('0x39')](_0x8339('0x3a'))){_0x2ffdeb[_0x8339('0x1c')]=qs[_0x8339('0x1c')](_0x4d5d4e[_0x8339('0x38')][_0x8339('0x1c')]);_0x2ffdeb['offset']=qs[_0x8339('0x1a')](_0x4d5d4e[_0x8339('0x38')][_0x8339('0x1a')]);}_0x2ffdeb['order']=qs[_0x8339('0x3b')](_0x4d5d4e[_0x8339('0x38')][_0x8339('0x3b')]);_0x2ffdeb[_0x8339('0x3c')]=qs[_0x8339('0x33')](_['pick'](_0x4d5d4e[_0x8339('0x38')],_0x46c970[_0x8339('0x33')]),_0x15ce9b);if(_0x4d5d4e[_0x8339('0x38')][_0x8339('0x3d')]){_0x2ffdeb[_0x8339('0x3c')]=_[_0x8339('0x3e')](_0x2ffdeb['where'],{'$or':_[_0x8339('0x2d')](_0x15ce9b,function(_0x5d1436){if(_0x5d1436[_0x8339('0x3f')]!==_0x8339('0x40')){var _0x590df6={};_0x590df6[_0x5d1436[_0x8339('0x2b')]]={'$like':'%'+_0x4d5d4e[_0x8339('0x38')][_0x8339('0x3d')]+'%'};return _0x590df6;}})});}_0x2ffdeb=_['merge']({},_0x2ffdeb,_0x4d5d4e[_0x8339('0x41')]);var _0x1ac58f={'where':_0x2ffdeb[_0x8339('0x3c')]};return db[_0x8339('0x2e')][_0x8339('0x1d')](_0x1ac58f)[_0x8339('0x25')](function(_0x38aee2){_0x300193['count']=_0x38aee2;if(_0x4d5d4e[_0x8339('0x38')][_0x8339('0x42')]){_0x2ffdeb[_0x8339('0x43')]=[{'all':!![]}];}return db[_0x8339('0x2e')][_0x8339('0x44')](_0x2ffdeb);})[_0x8339('0x25')](function(_0x41e2c2){_0x300193[_0x8339('0x45')]=_0x41e2c2;return _0x300193;})[_0x8339('0x25')](respondWithFilteredResult(_0x278ca9,_0x2ffdeb))[_0x8339('0x46')](handleError(_0x278ca9,null));};exports[_0x8339('0x47')]=function(_0x147d08,_0xd1e126){var _0x37d58c={'raw':![],'where':{'id':_0x147d08[_0x8339('0x48')]['id']}},_0x10ef3c={};_0x10ef3c[_0x8339('0x36')]=_[_0x8339('0x32')](db[_0x8339('0x2e')][_0x8339('0x2f')]);_0x10ef3c[_0x8339('0x38')]=_[_0x8339('0x32')](_0x147d08[_0x8339('0x38')]);_0x10ef3c[_0x8339('0x33')]=_[_0x8339('0x35')](_0x10ef3c[_0x8339('0x36')],_0x10ef3c['query']);_0x37d58c[_0x8339('0x34')]=_[_0x8339('0x35')](_0x10ef3c[_0x8339('0x36')],qs['fields'](_0x147d08['query'][_0x8339('0x37')]));_0x37d58c[_0x8339('0x34')]=_0x37d58c[_0x8339('0x34')][_0x8339('0x49')]?_0x37d58c['attributes']:_0x10ef3c[_0x8339('0x36')];if(_0x147d08['query']['includeAll']){_0x37d58c[_0x8339('0x43')]=[{'all':!![]}];}_0x37d58c=_['merge']({},_0x37d58c,_0x147d08[_0x8339('0x41')]);return db[_0x8339('0x2e')][_0x8339('0x4a')](_0x37d58c)['then'](handleEntityNotFound(_0xd1e126,null))[_0x8339('0x25')](respondWithResult(_0xd1e126,null))['catch'](handleError(_0xd1e126,null));};exports[_0x8339('0x4b')]=function(_0x16e736,_0x3db522){return db[_0x8339('0x2e')][_0x8339('0x4b')](_0x16e736['body'],{})[_0x8339('0x25')](function(_0x1f55f6){var _0x34d367=_0x16e736[_0x8339('0x4c')][_0x8339('0x26')]({'plain':!![]});if(!_0x34d367)throw new Error(_0x8339('0x4d'));if(_0x34d367[_0x8339('0x4e')]===_0x8339('0x4c')){var _0xc981e3=_0x1f55f6[_0x8339('0x26')]({'plain':!![]});var _0x424d36='Scheduler';return db[_0x8339('0x4f')]['find']({'where':{'name':_0x424d36,'userProfileId':_0x34d367['userProfileId']},'raw':!![]})[_0x8339('0x25')](function(_0x1f20d6){if(_0x1f20d6&&_0x1f20d6[_0x8339('0x50')]===0x0){return db['UserProfileResource'][_0x8339('0x4b')]({'name':_0xc981e3[_0x8339('0x2b')],'resourceId':_0xc981e3['id'],'type':_0x1f20d6[_0x8339('0x2b')],'sectionId':_0x1f20d6['id']},{})[_0x8339('0x25')](function(){return _0x1f55f6;});}else{return _0x1f55f6;}})[_0x8339('0x46')](function(_0x59b813){logger['error'](_0x8339('0x51'),_0x59b813);throw _0x59b813;});}return _0x1f55f6;})['then'](respondWithResult(_0x3db522,0xc9))[_0x8339('0x46')](handleError(_0x3db522,null));};exports[_0x8339('0x23')]=function(_0x4bc218,_0x34c3b6){if(_0x4bc218[_0x8339('0x52')]['id']){delete _0x4bc218[_0x8339('0x52')]['id'];}return db[_0x8339('0x2e')][_0x8339('0x4a')]({'where':{'id':_0x4bc218['params']['id']}})[_0x8339('0x25')](handleEntityNotFound(_0x34c3b6,null))['then'](saveUpdates(_0x4bc218[_0x8339('0x52')],null))[_0x8339('0x25')](respondWithResult(_0x34c3b6,null))[_0x8339('0x46')](handleError(_0x34c3b6,null));};exports['destroy']=function(_0x381198,_0x55966d){return db[_0x8339('0x2e')][_0x8339('0x4a')]({'where':{'id':_0x381198[_0x8339('0x48')]['id']}})[_0x8339('0x25')](handleEntityNotFound(_0x55966d,null))['then'](removeEntity(_0x55966d,null))['catch'](handleError(_0x55966d,null));};exports['run']=function(_0x3273d3,_0x253911,_0x1b00c9){var _0x128faf=require(_0x8339('0x53'));return db[_0x8339('0x2e')][_0x8339('0x4a')]({'where':{'id':_0x3273d3[_0x8339('0x48')]['id']},'raw':!![]})[_0x8339('0x25')](handleEntityNotFound(_0x253911,null))['then'](function(){_0x128faf[_0x8339('0x54')](_0x3273d3[_0x8339('0x48')]['id']);})[_0x8339('0x25')](respondWithStatusCode(_0x253911,null))['catch'](handleError(_0x253911,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 11da8b9..92d437c 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 _0x39b3=['./schedule.attributes','Schedule','tools_schedules','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4b4ac0,_0x2b6a0b){var _0xd2cce1=function(_0x232b6f){while(--_0x232b6f){_0x4b4ac0['push'](_0x4b4ac0['shift']());}};_0xd2cce1(++_0x2b6a0b);}(_0x39b3,0xea));var _0x339b=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x39b3[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require(_0x339b('0x0'));var logger=require(_0x339b('0x1'))(_0x339b('0x2'));var moment=require(_0x339b('0x3'));var BPromise=require(_0x339b('0x4'));var rp=require(_0x339b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x339b('0x6'));var config=require(_0x339b('0x7'));var attributes=require(_0x339b('0x8'));module['exports']=function(_0x7ca604,_0x2cfc41){return _0x7ca604['define'](_0x339b('0x9'),attributes,{'tableName':_0x339b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x998b=['bluebird','request-promise','rimraf','../../config/environment','exports','define','tools_schedules','util','../../config/logger','api','moment'];(function(_0x4696f6,_0x3c9be6){var _0x796810=function(_0x2f67fc){while(--_0x2f67fc){_0x4696f6['push'](_0x4696f6['shift']());}};_0x796810(++_0x3c9be6);}(_0x998b,0x96));var _0xb998=function(_0x2947a7,_0x514668){_0x2947a7=_0x2947a7-0x0;var _0x15c8a8=_0x998b[_0x2947a7];return _0x15c8a8;};'use strict';var _=require('lodash');var util=require(_0xb998('0x0'));var logger=require(_0xb998('0x1'))(_0xb998('0x2'));var moment=require(_0xb998('0x3'));var BPromise=require(_0xb998('0x4'));var rp=require(_0xb998('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb998('0x6'));var config=require(_0xb998('0x7'));var attributes=require('./schedule.attributes');module[_0xb998('0x8')]=function(_0x5a12ad,_0x15f6f0){return _0x5a12ad[_0xb998('0x9')]('Schedule',attributes,{'tableName':_0xb998('0xa'),'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 d347b7b..8e43b97 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 _0xc98f=['error','message','Schedule,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x43d686,_0x5ab2b9){var _0x3b93d4=function(_0x29695b){while(--_0x29695b){_0x43d686['push'](_0x43d686['shift']());}};_0x3b93d4(++_0x5ab2b9);}(_0xc98f,0x185));var _0xfc98=function(_0x9d7df2,_0x4815ac){_0x9d7df2=_0x9d7df2-0x0;var _0xf0689e=_0xc98f[_0x9d7df2];return _0xf0689e;};'use strict';var _=require(_0xfc98('0x0'));var util=require(_0xfc98('0x1'));var moment=require('moment');var BPromise=require(_0xfc98('0x2'));var rs=require(_0xfc98('0x3'));var fs=require('fs');var Redis=require(_0xfc98('0x4'));var db=require(_0xfc98('0x5'))['db'];var utils=require(_0xfc98('0x6'));var logger=require(_0xfc98('0x7'))(_0xfc98('0x8'));var config=require(_0xfc98('0x9'));var jayson=require(_0xfc98('0xa'));var client=jayson[_0xfc98('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20bdd6,_0x587fe2,_0x49e56c){return new BPromise(function(_0x2ef5cf,_0x2a4f78){return client[_0xfc98('0xc')](_0x20bdd6,_0x49e56c)[_0xfc98('0xd')](function(_0x9180fe){logger[_0xfc98('0xe')]('Schedule,\x20%s,\x20%s',_0x587fe2,_0xfc98('0xf'));logger[_0xfc98('0x10')](_0xfc98('0x11'),_0x587fe2,_0xfc98('0xf'),JSON[_0xfc98('0x12')](_0x9180fe));if(_0x9180fe[_0xfc98('0x13')]){if(_0x9180fe['error']['code']===0x1f4){logger[_0xfc98('0x13')]('Schedule,\x20%s,\x20%s',_0x587fe2,_0x9180fe[_0xfc98('0x13')][_0xfc98('0x14')]);return _0x2a4f78(_0x9180fe[_0xfc98('0x13')][_0xfc98('0x14')]);}logger['error']('Schedule,\x20%s,\x20%s',_0x587fe2,_0x9180fe['error'][_0xfc98('0x14')]);return _0x2ef5cf(_0x9180fe[_0xfc98('0x13')][_0xfc98('0x14')]);}else{logger[_0xfc98('0xe')](_0xfc98('0x15'),_0x587fe2,_0xfc98('0xf'));_0x2ef5cf(_0x9180fe[_0xfc98('0x16')][_0xfc98('0x14')]);}})[_0xfc98('0x17')](function(_0x532839){logger[_0xfc98('0x13')](_0xfc98('0x15'),_0x587fe2,_0x532839);_0x2a4f78(_0x532839);});});} \ No newline at end of file +var _0x96e1=['../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x41e94c,_0x386a89){var _0x325eae=function(_0xc0b4aa){while(--_0xc0b4aa){_0x41e94c['push'](_0x41e94c['shift']());}};_0x325eae(++_0x386a89);}(_0x96e1,0x89));var _0x196e=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x96e1[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x196e('0x0'));var util=require(_0x196e('0x1'));var moment=require('moment');var BPromise=require(_0x196e('0x2'));var rs=require(_0x196e('0x3'));var fs=require('fs');var Redis=require(_0x196e('0x4'));var db=require(_0x196e('0x5'))['db'];var utils=require(_0x196e('0x6'));var logger=require(_0x196e('0x7'))('rpc');var config=require(_0x196e('0x8'));var jayson=require(_0x196e('0x9'));var client=jayson[_0x196e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x245a83,_0x14de46,_0x8bf5e){return new BPromise(function(_0x402f70,_0x362187){return client[_0x196e('0xb')](_0x245a83,_0x8bf5e)[_0x196e('0xc')](function(_0x32799e){logger[_0x196e('0xd')](_0x196e('0xe'),_0x14de46,_0x196e('0xf'));logger[_0x196e('0x10')](_0x196e('0x11'),_0x14de46,'request\x20sent',JSON[_0x196e('0x12')](_0x32799e));if(_0x32799e['error']){if(_0x32799e[_0x196e('0x13')][_0x196e('0x14')]===0x1f4){logger['error'](_0x196e('0xe'),_0x14de46,_0x32799e[_0x196e('0x13')][_0x196e('0x15')]);return _0x362187(_0x32799e[_0x196e('0x13')]['message']);}logger[_0x196e('0x13')]('Schedule,\x20%s,\x20%s',_0x14de46,_0x32799e[_0x196e('0x13')][_0x196e('0x15')]);return _0x402f70(_0x32799e[_0x196e('0x13')][_0x196e('0x15')]);}else{logger[_0x196e('0xd')](_0x196e('0xe'),_0x14de46,_0x196e('0xf'));_0x402f70(_0x32799e[_0x196e('0x16')][_0x196e('0x15')]);}})[_0x196e('0x17')](function(_0x201b5f){logger[_0x196e('0x13')](_0x196e('0xe'),_0x14de46,_0x201b5f);_0x362187(_0x201b5f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 4e56465..73d1758 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 _0xc390=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','index','/describe','describe','show','/:id/download','isAuthenticated','download','post','create','put','/:id','update','delete','destroy','util','path'];(function(_0x31c01d,_0xb18ea2){var _0x53b31f=function(_0x44cbe0){while(--_0x44cbe0){_0x31c01d['push'](_0x31c01d['shift']());}};_0x53b31f(++_0xb18ea2);}(_0xc390,0x9f));var _0x0c39=function(_0x2d3764,_0x18b828){_0x2d3764=_0x2d3764-0x0;var _0x270abf=_0xc390[_0x2d3764];return _0x270abf;};'use strict';var multer=require('multer');var util=require(_0x0c39('0x0'));var path=require(_0x0c39('0x1'));var timeout=require(_0x0c39('0x2'));var express=require(_0x0c39('0x3'));var router=express[_0x0c39('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0c39('0x5'));var interaction=require(_0x0c39('0x6'));var config=require('../../config/environment');var controller=require(_0x0c39('0x7'));router[_0x0c39('0x8')]('/',auth['isAuthenticated'](),controller[_0x0c39('0x9')]);router[_0x0c39('0x8')](_0x0c39('0xa'),auth['isAuthenticated'](),controller[_0x0c39('0xb')]);router[_0x0c39('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0c39('0xc')]);router[_0x0c39('0x8')](_0x0c39('0xd'),auth[_0x0c39('0xe')](),controller[_0x0c39('0xf')]);router[_0x0c39('0x10')]('/',auth[_0x0c39('0xe')](),controller[_0x0c39('0x11')]);router[_0x0c39('0x12')](_0x0c39('0x13'),auth[_0x0c39('0xe')](),controller[_0x0c39('0x14')]);router[_0x0c39('0x15')](_0x0c39('0x13'),auth[_0x0c39('0xe')](),controller[_0x0c39('0x16')]);module['exports']=router; \ No newline at end of file +var _0xd88b=['isAuthenticated','describe','/:id','show','/:id/download','download','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get','index','/describe'];(function(_0x5246a4,_0x42f2ba){var _0x2c8235=function(_0x5a7253){while(--_0x5a7253){_0x5246a4['push'](_0x5246a4['shift']());}};_0x2c8235(++_0x42f2ba);}(_0xd88b,0x174));var _0xbd88=function(_0x52e15a,_0x4b1730){_0x52e15a=_0x52e15a-0x0;var _0x1f68e0=_0xd88b[_0x52e15a];return _0x1f68e0;};'use strict';var multer=require(_0xbd88('0x0'));var util=require(_0xbd88('0x1'));var path=require('path');var timeout=require(_0xbd88('0x2'));var express=require(_0xbd88('0x3'));var router=express[_0xbd88('0x4')]();var fs_extra=require(_0xbd88('0x5'));var auth=require(_0xbd88('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbd88('0x7'));var controller=require(_0xbd88('0x8'));router[_0xbd88('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd88('0xa')]);router[_0xbd88('0x9')](_0xbd88('0xb'),auth[_0xbd88('0xc')](),controller[_0xbd88('0xd')]);router[_0xbd88('0x9')](_0xbd88('0xe'),auth[_0xbd88('0xc')](),controller[_0xbd88('0xf')]);router['get'](_0xbd88('0x10'),auth['isAuthenticated'](),controller[_0xbd88('0x11')]);router[_0xbd88('0x12')]('/',auth['isAuthenticated'](),controller[_0xbd88('0x13')]);router[_0xbd88('0x14')]('/:id',auth[_0xbd88('0xc')](),controller[_0xbd88('0x15')]);router[_0xbd88('0x16')](_0xbd88('0xe'),auth[_0xbd88('0xc')](),controller['destroy']);module[_0xbd88('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4ff0156..49bcd33 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 _0xd232=['setDataValue','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','STRING','replace','value','INTEGER'];(function(_0x1edbbe,_0x11b3f4){var _0x20ed51=function(_0x122d28){while(--_0x122d28){_0x1edbbe['push'](_0x1edbbe['shift']());}};_0x20ed51(++_0x11b3f4);}(_0xd232,0x74));var _0x2d23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd232[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x2d23('0x0'));var moment=require('moment');var path=require(_0x2d23('0x1'));var config=require(_0x2d23('0x2'));module[_0x2d23('0x3')]={'format':{'type':Sequelize[_0x2d23('0x4')],'get':function(){return this[_0x2d23('0x5')]('value')?path['extname'](this[_0x2d23('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2d23('0x6')]},'value':{'type':Sequelize[_0x2d23('0x6')],'set':function(_0x15c735){var _0x53ac18=_0x15c735[_0x2d23('0x7')](/\\/g,'/');this['setDataValue'](_0x2d23('0x8'),_0x53ac18);}},'rating':{'type':Sequelize[_0x2d23('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2d23('0x9')],'set':function(_0x7847cb){this[_0x2d23('0xa')](_0x2d23('0xb'),moment()[_0x2d23('0xc')](_0x7847cb,'ms'));this['setDataValue'](_0x2d23('0xd'),moment());this[_0x2d23('0xa')](_0x2d23('0xe'),_0x7847cb);}},'startedAt':{'type':Sequelize[_0x2d23('0xf')],'get':function(){return moment(this[_0x2d23('0x5')](_0x2d23('0xb')))[_0x2d23('0x10')](_0x2d23('0x11'))[_0x2d23('0x12')]();}},'closedAt':{'type':Sequelize[_0x2d23('0xf')],'get':function(){return moment(this[_0x2d23('0x5')](_0x2d23('0xd')))['format'](_0x2d23('0x11'))[_0x2d23('0x12')]();}},'createdAt':{'type':Sequelize[_0x2d23('0xf')],'get':function(){return moment(this[_0x2d23('0x5')](_0x2d23('0x13')))['format'](_0x2d23('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x2d23('0xf')],'get':function(){return moment(this['getDataValue'](_0x2d23('0x14')))[_0x2d23('0x10')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0xba38=['moment','path','../../config/environment','VIRTUAL','value','extname','getDataValue','STRING','replace','setDataValue','INTEGER','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0xba38,0x190));var _0x8ba3=function(_0x11fc8e,_0xa84ab3){_0x11fc8e=_0x11fc8e-0x0;var _0x13f836=_0xba38[_0x11fc8e];return _0x13f836;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8ba3('0x0'));var path=require(_0x8ba3('0x1'));var config=require(_0x8ba3('0x2'));module['exports']={'format':{'type':Sequelize[_0x8ba3('0x3')],'get':function(){return this['getDataValue'](_0x8ba3('0x4'))?path[_0x8ba3('0x5')](this[_0x8ba3('0x6')](_0x8ba3('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x8ba3('0x7')]},'channel':{'type':Sequelize[_0x8ba3('0x7')]},'value':{'type':Sequelize[_0x8ba3('0x7')],'set':function(_0x17276c){var _0x193e7e=_0x17276c[_0x8ba3('0x8')](/\\/g,'/');this[_0x8ba3('0x9')](_0x8ba3('0x4'),_0x193e7e);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8ba3('0xa')],'set':function(_0x3041b5){this['setDataValue'](_0x8ba3('0xb'),moment()['subtract'](_0x3041b5,'ms'));this[_0x8ba3('0x9')](_0x8ba3('0xc'),moment());this[_0x8ba3('0x9')](_0x8ba3('0xd'),_0x3041b5);}},'startedAt':{'type':Sequelize[_0x8ba3('0xe')],'get':function(){return moment(this[_0x8ba3('0x6')](_0x8ba3('0xb')))[_0x8ba3('0xf')](_0x8ba3('0x10'))['toString']();}},'closedAt':{'type':Sequelize[_0x8ba3('0xe')],'get':function(){return moment(this[_0x8ba3('0x6')]('closedAt'))[_0x8ba3('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x8ba3('0x11')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8ba3('0x6')](_0x8ba3('0x12')))['format'](_0x8ba3('0x10'))[_0x8ba3('0x11')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x8ba3('0x6')](_0x8ba3('0x13')))['format']('MM-DD-YYYY\x20HH:mm')[_0x8ba3('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 900c283..725a457 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 _0x207c=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb'];(function(_0x21fc56,_0x2d2906){var _0x1d09bb=function(_0x103adc){while(--_0x103adc){_0x21fc56['push'](_0x21fc56['shift']());}};_0x1d09bb(++_0x2d2906);}(_0x207c,0x1e8));var _0xc207=function(_0x5abb00,_0x342d70){_0x5abb00=_0x5abb00-0x0;var _0xf9b854=_0x207c[_0x5abb00];return _0xf9b854;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc207('0x0'));var zipdir=require(_0xc207('0x1'));var jsonpatch=require(_0xc207('0x2'));var rp=require(_0xc207('0x3'));var moment=require(_0xc207('0x4'));var BPromise=require(_0xc207('0x5'));var Mustache=require(_0xc207('0x6'));var util=require('util');var path=require(_0xc207('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc207('0x8'));var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];function respondWithStatusCode(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xcc;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0x16')](_0x59d401);}return _0x2782ce[_0xc207('0x17')](_0x59d401)[_0xc207('0x18')]();};}function respondWithResult(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0xc8;return function(_0xc62672){if(_0xc62672){return _0xe993a0[_0xc207('0x17')](_0x51e967)[_0xc207('0x19')](_0xc62672);}};}function respondWithFilteredResult(_0x4031ad,_0x4ef6c4){return function(_0x564cef){if(_0x564cef){var _0x554e5c=typeof _0x4ef6c4[_0xc207('0x1a')]===_0xc207('0x1b')&&typeof _0x4ef6c4[_0xc207('0x1c')]===_0xc207('0x1b');var _0x4b8f44=_0x564cef[_0xc207('0x1d')];var _0x282595=_0x554e5c?0x0:_0x4ef6c4[_0xc207('0x1a')];var _0x5f288e=_0x554e5c?_0x564cef[_0xc207('0x1d')]:_0x4ef6c4['offset']+_0x4ef6c4[_0xc207('0x1c')];var _0x33ddb1;if(_0x5f288e>=_0x4b8f44){_0x5f288e=_0x4b8f44;_0x33ddb1=0xc8;}else{_0x33ddb1=0xce;}_0x4031ad[_0xc207('0x17')](_0x33ddb1);return _0x4031ad[_0xc207('0x1e')](_0xc207('0x1f'),_0x282595+'-'+_0x5f288e+'/'+_0x4b8f44)[_0xc207('0x19')](_0x564cef);}return null;};}function patchUpdates(_0x35c0b0){return function(_0x464dea){try{jsonpatch[_0xc207('0x20')](_0x464dea,_0x35c0b0,!![]);}catch(_0x2bd2eb){return BPromise[_0xc207('0x21')](_0x2bd2eb);}return _0x464dea[_0xc207('0x22')]();};}function saveUpdates(_0x40de25,_0x4b52a7){return function(_0x163b36){if(_0x163b36){return _0x163b36['update'](_0x40de25)[_0xc207('0x23')](function(_0x3ac142){return _0x3ac142;});}return null;};}function removeEntity(_0x1eabe8,_0x83253f){return function(_0x3539f4){if(_0x3539f4){return _0x3539f4[_0xc207('0x24')]()[_0xc207('0x23')](function(){_0x1eabe8[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();});}};}function handleEntityNotFound(_0x2385f7,_0x25c91e){return function(_0x27df03){if(!_0x27df03){_0x2385f7[_0xc207('0x16')](0x194);}return _0x27df03;};}function handleError(_0x138970,_0x1445d3){_0x1445d3=_0x1445d3||0x1f4;return function(_0x56a066){logger[_0xc207('0x25')](_0x56a066['stack']);if(_0x56a066['name']){delete _0x56a066[_0xc207('0x26')];}_0x138970[_0xc207('0x17')](_0x1445d3)[_0xc207('0x27')](_0x56a066);};}exports[_0xc207('0x28')]=function(_0x6a653d,_0x478af7){var _0xe5e848={},_0x463ac8={},_0x6223ef={'count':0x0,'rows':[]};var _0x1bec3f=_[_0xc207('0x29')](db[_0xc207('0x2a')][_0xc207('0x2b')],function(_0x27bc72){return{'name':_0x27bc72[_0xc207('0x2c')],'type':_0x27bc72[_0xc207('0x2d')][_0xc207('0x2e')]};});_0x463ac8[_0xc207('0x2f')]=_[_0xc207('0x30')](_['map'](_0x1bec3f,_0xc207('0x26')),[_0xc207('0x31')]);_0x463ac8[_0xc207('0x32')]=_[_0xc207('0x33')](_0x6a653d[_0xc207('0x32')]);_0x463ac8[_0xc207('0x34')]=_['intersection'](_0x463ac8[_0xc207('0x2f')],_0x463ac8[_0xc207('0x32')]);_0xe5e848[_0xc207('0x35')]=_[_0xc207('0x36')](_0x463ac8['model'],qs[_0xc207('0x37')](_0x6a653d[_0xc207('0x32')][_0xc207('0x37')]));_0xe5e848[_0xc207('0x35')]=_0xe5e848[_0xc207('0x35')][_0xc207('0x38')]?_0xe5e848[_0xc207('0x35')]:_0x463ac8[_0xc207('0x2f')];if(!_0x6a653d[_0xc207('0x32')]['hasOwnProperty']('nolimit')){_0xe5e848[_0xc207('0x1c')]=qs[_0xc207('0x1c')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1c')]);_0xe5e848['offset']=qs[_0xc207('0x1a')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1a')]);}_0xe5e848[_0xc207('0x39')]=qs[_0xc207('0x3a')](_0x6a653d['query'][_0xc207('0x3a')]);_0xe5e848[_0xc207('0x3b')]=qs['filters'](_[_0xc207('0x3c')](_0x6a653d['query'],_0x463ac8[_0xc207('0x34')]),_0x1bec3f);if(_0x6a653d[_0xc207('0x32')]['filter']){_0xe5e848[_0xc207('0x3b')]=_[_0xc207('0x3d')](_0xe5e848[_0xc207('0x3b')],{'$or':_['map'](_0x1bec3f,function(_0x5b3041){if(_0x5b3041[_0xc207('0x2d')]!==_0xc207('0x3e')){var _0x41d66c={};_0x41d66c[_0x5b3041[_0xc207('0x26')]]={'$like':'%'+_0x6a653d['query'][_0xc207('0x3f')]+'%'};return _0x41d66c;}})});}_0xe5e848=_['merge']({},_0xe5e848,_0x6a653d['options']);var _0x4c10ed={'where':_0xe5e848['where']};return db[_0xc207('0x2a')][_0xc207('0x1d')](_0x4c10ed)[_0xc207('0x23')](function(_0x487f98){_0x6223ef[_0xc207('0x1d')]=_0x487f98;if(_0x6a653d[_0xc207('0x32')][_0xc207('0x40')]){_0xe5e848[_0xc207('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xc207('0x42')](_0xe5e848);})[_0xc207('0x23')](function(_0x123a46){_0x6223ef[_0xc207('0x43')]=_0x123a46;return _0x6223ef;})[_0xc207('0x23')](respondWithFilteredResult(_0x478af7,_0xe5e848))['catch'](handleError(_0x478af7,null));};exports[_0xc207('0x44')]=function(_0x19a67d,_0x3a935a){var _0x471a85={'raw':![],'where':{'id':_0x19a67d[_0xc207('0x45')]['id']}},_0x153490={};_0x153490[_0xc207('0x2f')]=_[_0xc207('0x33')](db[_0xc207('0x2a')]['rawAttributes']);_0x153490[_0xc207('0x32')]=_[_0xc207('0x33')](_0x19a67d['query']);_0x153490[_0xc207('0x34')]=_[_0xc207('0x36')](_0x153490[_0xc207('0x2f')],_0x153490[_0xc207('0x32')]);_0x471a85[_0xc207('0x35')]=_['intersection'](_0x153490[_0xc207('0x2f')],qs[_0xc207('0x37')](_0x19a67d[_0xc207('0x32')]['fields']));_0x471a85[_0xc207('0x35')]=_0x471a85[_0xc207('0x35')][_0xc207('0x38')]?_0x471a85[_0xc207('0x35')]:_0x153490['model'];if(_0x19a67d['query'][_0xc207('0x40')]){_0x471a85[_0xc207('0x41')]=[{'all':!![]}];}_0x471a85=_[_0xc207('0x3d')]({},_0x471a85,_0x19a67d[_0xc207('0x46')]);return db[_0xc207('0x2a')][_0xc207('0x47')](_0x471a85)[_0xc207('0x23')](handleEntityNotFound(_0x3a935a,null))[_0xc207('0x23')](respondWithResult(_0x3a935a,null))[_0xc207('0x48')](handleError(_0x3a935a,null));};exports[_0xc207('0x49')]=function(_0x2afcd1,_0x2fda4f){return db['ScreenRecording']['create'](_0x2afcd1[_0xc207('0x4a')],{})[_0xc207('0x23')](respondWithResult(_0x2fda4f,0xc9))[_0xc207('0x48')](handleError(_0x2fda4f,null));};exports['update']=function(_0x2b89e0,_0x3f712d){if(_0x2b89e0[_0xc207('0x4a')]['id']){delete _0x2b89e0[_0xc207('0x4a')]['id'];}delete _0x2b89e0['body'][_0xc207('0x4b')];delete _0x2b89e0['body'][_0xc207('0x4c')];delete _0x2b89e0['body']['closedAt'];delete _0x2b89e0[_0xc207('0x4a')][_0xc207('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x2b89e0['params']['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x3f712d,null))[_0xc207('0x23')](saveUpdates(_0x2b89e0[_0xc207('0x4a')],null))[_0xc207('0x23')](respondWithResult(_0x3f712d,null))[_0xc207('0x48')](handleError(_0x3f712d,null));};exports[_0xc207('0x4e')]=function(_0x3dc457,_0x1dfdee){return db['ScreenRecording'][_0xc207('0x4e')]()[_0xc207('0x23')](respondWithResult(_0x1dfdee,null))['catch'](handleError(_0x1dfdee,null));};exports['download']=function(_0x362001,_0x47c630,_0x49a78b){var _0x2634d6=require(_0xc207('0x4f'));var _0x356c8c=![];var _0x3b2448={};if(_0x362001[_0xc207('0x32')][_0xc207('0x2d')]&&_0x362001[_0xc207('0x32')][_0xc207('0x2d')]===_0xc207('0x50')){_0x3b2448[_0xc207('0x50')]=_0x362001[_0xc207('0x45')]['id'];}else{_0x3b2448['id']=_0x362001['params']['id'];}return db['ScreenRecording'][_0xc207('0x47')]({'where':_0x3b2448,'attributes':['id',_0xc207('0x4d')],'raw':!![]})[_0xc207('0x23')](handleEntityNotFound(_0x47c630,null))[_0xc207('0x23')](function(_0xaff7a0){if(_0xaff7a0){var _0x21c12b=path[_0xc207('0x51')](config[_0xc207('0x52')],_0xc207('0x53'),_0xaff7a0['value']);var _0x1cc4e3=util[_0xc207('0x31')](_0xc207('0x54'),_0x21c12b);if(fs[_0xc207('0x55')](_0x1cc4e3)){_0x356c8c=!![];return _0x2634d6['decryptFile'](_0x1cc4e3,_0x21c12b,config[_0xc207('0x56')][_0xc207('0x57')])[_0xc207('0x23')](function(){return _0xaff7a0;});}return _0xaff7a0;}})[_0xc207('0x23')](function(_0x464263){if(_0x464263){var _0x45ad58=path[_0xc207('0x51')](config['root'],_0xc207('0x53'),_0x464263[_0xc207('0x4d')]);if(!fs[_0xc207('0x55')](_0x45ad58)){throw new db[(_0xc207('0x58'))]['ValidationError'](_0xc207('0x59'));}if(_0x464263['filename']){return _0x47c630['download'](_0x45ad58,_0x464263[_0xc207('0x5a')]+path[_0xc207('0x5b')](_0x45ad58),function(){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}else{return _0x47c630[_0xc207('0x5d')](_0x45ad58,function(_0x441d5f){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}}})[_0xc207('0x48')](function(_0x33c372){if(_0x33c372[_0xc207('0x5e')]===_0xc207('0x59')){_0x47c630[_0xc207('0x17')](0x194)[_0xc207('0x27')](_0xc207('0x5f'));}else{return handleError(_0x47c630,null);}});};exports[_0xc207('0x24')]=function(_0x282ae5,_0x501bca){return db[_0xc207('0x2a')]['find']({'where':{'id':_0x282ae5[_0xc207('0x45')]['id']}})[_0xc207('0x23')](function(_0x2ade23){if(_['isNil'](_0x2ade23)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2ade23;})[_0xc207('0x23')](function(_0x3ac0dd){var _0x2f18a2=path['join'](config[_0xc207('0x52')],_0xc207('0x53'),_0x3ac0dd[_0xc207('0x4d')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2f18a2);if(!_[_0xc207('0x60')](_0x3ac0dd['value'])&&fs[_0xc207('0x55')](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}_0x2f18a2=_0x2f18a2+_0xc207('0x65');if(!_[_0xc207('0x60')](_0x3ac0dd[_0xc207('0x4d')])&&fs['existsSync'](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}return _0x3ac0dd;})[_0xc207('0x23')](function(_0x14050a){if(!_0x14050a)throw new InternalError();return _0x14050a[_0xc207('0x24')]();})[_0xc207('0x23')](function(){_0x501bca[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();})[_0xc207('0x48')](handleError(_0x501bca,null));}; \ No newline at end of file +var _0x84ab=['describe','download','join','existsSync','decryptFile','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','isNil','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','error','stack','name','send','rawAttributes','type','key','model','differenceBy','map','format','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','ScreenRecording','rows','params','keys','intersection','find','catch','body','createdAt','value'];(function(_0x5a5952,_0x156afe){var _0x4b638c=function(_0x4dfa19){while(--_0x4dfa19){_0x5a5952['push'](_0x5a5952['shift']());}};_0x4b638c(++_0x156afe);}(_0x84ab,0x12f));var _0xb84a=function(_0x59162a,_0x10e547){_0x59162a=_0x59162a-0x0;var _0x35e50d=_0x84ab[_0x59162a];return _0x35e50d;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x409df0,_0x19bdfa){return function(_0x3258a9){if(!_0x3258a9){_0x409df0[_0xb84a('0x16')](0x194);}return _0x3258a9;};}function handleError(_0x3ff0bc,_0x3b6805){_0x3b6805=_0x3b6805||0x1f4;return function(_0xd468c3){logger[_0xb84a('0x24')](_0xd468c3[_0xb84a('0x25')]);if(_0xd468c3[_0xb84a('0x26')]){delete _0xd468c3[_0xb84a('0x26')];}_0x3ff0bc[_0xb84a('0x17')](_0x3b6805)[_0xb84a('0x27')](_0xd468c3);};}exports['index']=function(_0x582954,_0x4608ce){var _0x2c30b0={},_0x4dab4e={},_0x1f690a={'count':0x0,'rows':[]};var _0x36b4f4=_['map'](db['ScreenRecording'][_0xb84a('0x28')],function(_0x8e9319){return{'name':_0x8e9319['fieldName'],'type':_0x8e9319[_0xb84a('0x29')][_0xb84a('0x2a')]};});_0x4dab4e[_0xb84a('0x2b')]=_[_0xb84a('0x2c')](_[_0xb84a('0x2d')](_0x36b4f4,_0xb84a('0x26')),[_0xb84a('0x2e')]);_0x4dab4e[_0xb84a('0x2f')]=_['keys'](_0x582954[_0xb84a('0x2f')]);_0x4dab4e['filters']=_['intersection'](_0x4dab4e[_0xb84a('0x2b')],_0x4dab4e[_0xb84a('0x2f')]);_0x2c30b0['attributes']=_['intersection'](_0x4dab4e[_0xb84a('0x2b')],qs[_0xb84a('0x30')](_0x582954[_0xb84a('0x2f')][_0xb84a('0x30')]));_0x2c30b0[_0xb84a('0x31')]=_0x2c30b0[_0xb84a('0x31')][_0xb84a('0x32')]?_0x2c30b0[_0xb84a('0x31')]:_0x4dab4e['model'];if(!_0x582954[_0xb84a('0x2f')][_0xb84a('0x33')](_0xb84a('0x34'))){_0x2c30b0[_0xb84a('0x1c')]=qs[_0xb84a('0x1c')](_0x582954[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x2c30b0['offset']=qs[_0xb84a('0x1a')](_0x582954['query'][_0xb84a('0x1a')]);}_0x2c30b0[_0xb84a('0x35')]=qs[_0xb84a('0x36')](_0x582954['query']['sort']);_0x2c30b0[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_[_0xb84a('0x39')](_0x582954[_0xb84a('0x2f')],_0x4dab4e[_0xb84a('0x38')]),_0x36b4f4);if(_0x582954['query'][_0xb84a('0x3a')]){_0x2c30b0[_0xb84a('0x37')]=_['merge'](_0x2c30b0[_0xb84a('0x37')],{'$or':_[_0xb84a('0x2d')](_0x36b4f4,function(_0x19634b){if(_0x19634b[_0xb84a('0x29')]!=='VIRTUAL'){var _0x57a1a8={};_0x57a1a8[_0x19634b['name']]={'$like':'%'+_0x582954[_0xb84a('0x2f')][_0xb84a('0x3a')]+'%'};return _0x57a1a8;}})});}_0x2c30b0=_[_0xb84a('0x3b')]({},_0x2c30b0,_0x582954[_0xb84a('0x3c')]);var _0x55b0b8={'where':_0x2c30b0[_0xb84a('0x37')]};return db['ScreenRecording'][_0xb84a('0x1d')](_0x55b0b8)['then'](function(_0x48db18){_0x1f690a['count']=_0x48db18;if(_0x582954[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x2c30b0[_0xb84a('0x3e')]=[{'all':!![]}];}return db[_0xb84a('0x3f')]['findAll'](_0x2c30b0);})[_0xb84a('0x22')](function(_0x42f0b6){_0x1f690a[_0xb84a('0x40')]=_0x42f0b6;return _0x1f690a;})[_0xb84a('0x22')](respondWithFilteredResult(_0x4608ce,_0x2c30b0))['catch'](handleError(_0x4608ce,null));};exports['show']=function(_0x15a621,_0x1f3e04){var _0x541cc4={'raw':![],'where':{'id':_0x15a621[_0xb84a('0x41')]['id']}},_0x1045ee={};_0x1045ee[_0xb84a('0x2b')]=_[_0xb84a('0x42')](db[_0xb84a('0x3f')][_0xb84a('0x28')]);_0x1045ee[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x15a621[_0xb84a('0x2f')]);_0x1045ee[_0xb84a('0x38')]=_[_0xb84a('0x43')](_0x1045ee[_0xb84a('0x2b')],_0x1045ee[_0xb84a('0x2f')]);_0x541cc4[_0xb84a('0x31')]=_[_0xb84a('0x43')](_0x1045ee['model'],qs[_0xb84a('0x30')](_0x15a621[_0xb84a('0x2f')][_0xb84a('0x30')]));_0x541cc4[_0xb84a('0x31')]=_0x541cc4[_0xb84a('0x31')][_0xb84a('0x32')]?_0x541cc4['attributes']:_0x1045ee[_0xb84a('0x2b')];if(_0x15a621['query'][_0xb84a('0x3d')]){_0x541cc4[_0xb84a('0x3e')]=[{'all':!![]}];}_0x541cc4=_[_0xb84a('0x3b')]({},_0x541cc4,_0x15a621[_0xb84a('0x3c')]);return db['ScreenRecording'][_0xb84a('0x44')](_0x541cc4)[_0xb84a('0x22')](handleEntityNotFound(_0x1f3e04,null))[_0xb84a('0x22')](respondWithResult(_0x1f3e04,null))['catch'](handleError(_0x1f3e04,null));};exports['create']=function(_0x385986,_0x10b0cc){return db[_0xb84a('0x3f')]['create'](_0x385986['body'],{})['then'](respondWithResult(_0x10b0cc,0xc9))[_0xb84a('0x45')](handleError(_0x10b0cc,null));};exports[_0xb84a('0x21')]=function(_0x38f329,_0x4476bc){if(_0x38f329[_0xb84a('0x46')]['id']){delete _0x38f329['body']['id'];}delete _0x38f329['body']['duration'];delete _0x38f329['body'][_0xb84a('0x47')];delete _0x38f329[_0xb84a('0x46')]['closedAt'];delete _0x38f329[_0xb84a('0x46')][_0xb84a('0x48')];return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':{'id':_0x38f329[_0xb84a('0x41')]['id']}})[_0xb84a('0x22')](handleEntityNotFound(_0x4476bc,null))['then'](saveUpdates(_0x38f329['body'],null))[_0xb84a('0x22')](respondWithResult(_0x4476bc,null))['catch'](handleError(_0x4476bc,null));};exports[_0xb84a('0x49')]=function(_0x4d1a29,_0x575908){return db['ScreenRecording'][_0xb84a('0x49')]()[_0xb84a('0x22')](respondWithResult(_0x575908,null))[_0xb84a('0x45')](handleError(_0x575908,null));};exports[_0xb84a('0x4a')]=function(_0x33adfc,_0x46f7eb,_0x37ca26){var _0x29ff35=require('../../components/encryptor');var _0x5afdd0=![];var _0x4c5bdf={};if(_0x33adfc[_0xb84a('0x2f')][_0xb84a('0x29')]&&_0x33adfc['query'][_0xb84a('0x29')]==='uniqueid'){_0x4c5bdf['uniqueid']=_0x33adfc['params']['id'];}else{_0x4c5bdf['id']=_0x33adfc[_0xb84a('0x41')]['id'];}return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':_0x4c5bdf,'attributes':['id','value'],'raw':!![]})[_0xb84a('0x22')](handleEntityNotFound(_0x46f7eb,null))[_0xb84a('0x22')](function(_0x136d61){if(_0x136d61){var _0x505994=path[_0xb84a('0x4b')](config['root'],'server/files/screen_recordings',_0x136d61[_0xb84a('0x48')]);var _0x47a8a2=util[_0xb84a('0x2e')]('%s.cypher',_0x505994);if(fs[_0xb84a('0x4c')](_0x47a8a2)){_0x5afdd0=!![];return _0x29ff35[_0xb84a('0x4d')](_0x47a8a2,_0x505994,config[_0xb84a('0x4e')][_0xb84a('0x4f')])['then'](function(){return _0x136d61;});}return _0x136d61;}})['then'](function(_0x4fc998){if(_0x4fc998){var _0x40b392=path[_0xb84a('0x4b')](config['root'],'server/files/screen_recordings',_0x4fc998[_0xb84a('0x48')]);if(!fs[_0xb84a('0x4c')](_0x40b392)){throw new db[(_0xb84a('0x50'))]['ValidationError'](_0xb84a('0x51'));}if(_0x4fc998[_0xb84a('0x52')]){return _0x46f7eb['download'](_0x40b392,_0x4fc998[_0xb84a('0x52')]+path[_0xb84a('0x53')](_0x40b392),function(){if(_0x5afdd0){fs[_0xb84a('0x54')](_0x40b392);}});}else{return _0x46f7eb[_0xb84a('0x4a')](_0x40b392,function(_0x3bbc69){if(_0x5afdd0){fs[_0xb84a('0x54')](_0x40b392);}});}}})[_0xb84a('0x45')](function(_0x47c27f){if(_0x47c27f[_0xb84a('0x55')]===_0xb84a('0x51')){_0x46f7eb['status'](0x194)[_0xb84a('0x27')](_0xb84a('0x56'));}else{return handleError(_0x46f7eb,null);}});};exports[_0xb84a('0x23')]=function(_0x3e16d8,_0x347998){return db[_0xb84a('0x3f')][_0xb84a('0x44')]({'where':{'id':_0x3e16d8[_0xb84a('0x41')]['id']}})[_0xb84a('0x22')](function(_0x5dd660){if(_[_0xb84a('0x57')](_0x5dd660)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5dd660;})['then'](function(_0x19d635){var _0x5e11c8=path[_0xb84a('0x4b')](config['root'],_0xb84a('0x58'),_0x19d635[_0xb84a('0x48')]);logger['info'](_0xb84a('0x59'),_0x5e11c8);if(!_[_0xb84a('0x57')](_0x19d635[_0xb84a('0x48')])&&fs[_0xb84a('0x4c')](_0x5e11c8)){logger[_0xb84a('0x5a')](_0xb84a('0x5b')+_0x5e11c8+_0xb84a('0x5c'));fs['unlinkSync'](_0x5e11c8);}_0x5e11c8=_0x5e11c8+_0xb84a('0x5d');if(!_['isNil'](_0x19d635['value'])&&fs[_0xb84a('0x4c')](_0x5e11c8)){logger[_0xb84a('0x5a')](_0xb84a('0x5b')+_0x5e11c8+_0xb84a('0x5c'));fs['unlinkSync'](_0x5e11c8);}return _0x19d635;})['then'](function(_0x43031f){if(!_0x43031f)throw new InternalError();return _0x43031f[_0xb84a('0x23')]();})[_0xb84a('0x22')](function(){_0x347998[_0xb84a('0x17')](0xcc)['end']();})[_0xb84a('0x45')](handleError(_0x347998,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index ed8fdee..6828d9f 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 _0x0c0a=['path','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util','api','moment','request-promise'];(function(_0x2211e7,_0x1cfebc){var _0x471445=function(_0x4b6c4b){while(--_0x4b6c4b){_0x2211e7['push'](_0x2211e7['shift']());}};_0x471445(++_0x1cfebc);}(_0x0c0a,0x1e7));var _0xa0c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c0a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa0c0('0x0'));var util=require(_0xa0c0('0x1'));var logger=require('../../config/logger')(_0xa0c0('0x2'));var moment=require(_0xa0c0('0x3'));var BPromise=require('bluebird');var rp=require(_0xa0c0('0x4'));var fs=require('fs');var path=require(_0xa0c0('0x5'));var rimraf=require('rimraf');var config=require(_0xa0c0('0x6'));var attributes=require(_0xa0c0('0x7'));module[_0xa0c0('0x8')]=function(_0x30cc7c,_0x8495c7){return _0x30cc7c[_0xa0c0('0x9')]('ScreenRecording',attributes,{'tableName':_0xa0c0('0xa'),'paranoid':![],'indexes':[{'name':_0xa0c0('0xb'),'fields':[_0xa0c0('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb5f=['exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger','api','request-promise','rimraf','./screenRecording.attributes'];(function(_0x2fe0e6,_0x364b92){var _0x40916d=function(_0x17b4a4){while(--_0x17b4a4){_0x2fe0e6['push'](_0x2fe0e6['shift']());}};_0x40916d(++_0x364b92);}(_0xfb5f,0x131));var _0xffb5=function(_0x5974e1,_0x381f9c){_0x5974e1=_0x5974e1-0x0;var _0x496135=_0xfb5f[_0x5974e1];return _0x496135;};'use strict';var _=require(_0xffb5('0x0'));var util=require(_0xffb5('0x1'));var logger=require(_0xffb5('0x2'))(_0xffb5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xffb5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffb5('0x5'));var config=require('../../config/environment');var attributes=require(_0xffb5('0x6'));module[_0xffb5('0x7')]=function(_0x23b53b,_0x420b42){return _0x23b53b[_0xffb5('0x8')](_0xffb5('0x9'),attributes,{'tableName':_0xffb5('0xa'),'paranoid':![],'indexes':[{'name':_0xffb5('0xb'),'fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 6944dfe..c1ecd6b 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 _0xf7d7=['info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x43d106,_0x96a475){var _0x2160bc=function(_0x1219fb){while(--_0x1219fb){_0x43d106['push'](_0x43d106['shift']());}};_0x2160bc(++_0x96a475);}(_0xf7d7,0xb2));var _0x7f7d=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0xf7d7[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0x7f7d('0x0'));var util=require(_0x7f7d('0x1'));var moment=require(_0x7f7d('0x2'));var BPromise=require(_0x7f7d('0x3'));var rs=require(_0x7f7d('0x4'));var fs=require('fs');var Redis=require(_0x7f7d('0x5'));var db=require(_0x7f7d('0x6'))['db'];var utils=require(_0x7f7d('0x7'));var logger=require(_0x7f7d('0x8'))(_0x7f7d('0x9'));var config=require(_0x7f7d('0xa'));var jayson=require(_0x7f7d('0xb'));var client=jayson[_0x7f7d('0xc')][_0x7f7d('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x39ac6d,_0x564049,_0x2155e9){return new BPromise(function(_0x4816b2,_0x2cd12c){return client['request'](_0x39ac6d,_0x2155e9)['then'](function(_0x223a3e){logger[_0x7f7d('0xe')](_0x7f7d('0xf'),_0x564049,_0x7f7d('0x10'));logger[_0x7f7d('0x11')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x564049,_0x7f7d('0x10'),JSON[_0x7f7d('0x12')](_0x223a3e));if(_0x223a3e[_0x7f7d('0x13')]){if(_0x223a3e[_0x7f7d('0x13')][_0x7f7d('0x14')]===0x1f4){logger[_0x7f7d('0x13')](_0x7f7d('0xf'),_0x564049,_0x223a3e[_0x7f7d('0x13')][_0x7f7d('0x15')]);return _0x2cd12c(_0x223a3e[_0x7f7d('0x13')]['message']);}logger['error'](_0x7f7d('0xf'),_0x564049,_0x223a3e[_0x7f7d('0x13')][_0x7f7d('0x15')]);return _0x4816b2(_0x223a3e[_0x7f7d('0x13')][_0x7f7d('0x15')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x564049,'request\x20sent');_0x4816b2(_0x223a3e[_0x7f7d('0x16')][_0x7f7d('0x15')]);}})[_0x7f7d('0x17')](function(_0x3b5fd6){logger[_0x7f7d('0x13')](_0x7f7d('0xf'),_0x564049,_0x3b5fd6);_0x2cd12c(_0x3b5fd6);});});} \ No newline at end of file +var _0x76f1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash'];(function(_0x248485,_0x514163){var _0x3e4762=function(_0x479813){while(--_0x479813){_0x248485['push'](_0x248485['shift']());}};_0x3e4762(++_0x514163);}(_0x76f1,0x1da));var _0x176f=function(_0x6912a5,_0x50f199){_0x6912a5=_0x6912a5-0x0;var _0x22653c=_0x76f1[_0x6912a5];return _0x22653c;};'use strict';var _=require(_0x176f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x176f('0x1'));var db=require(_0x176f('0x2'))['db'];var utils=require(_0x176f('0x3'));var logger=require(_0x176f('0x4'))(_0x176f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x176f('0x6')][_0x176f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3d0116,_0x33e1e9,_0x795f4){return new BPromise(function(_0x7b1fe0,_0x56cd67){return client[_0x176f('0x8')](_0x3d0116,_0x795f4)[_0x176f('0x9')](function(_0x3e6ceb){logger['info'](_0x176f('0xa'),_0x33e1e9,_0x176f('0xb'));logger[_0x176f('0xc')](_0x176f('0xd'),_0x33e1e9,_0x176f('0xb'),JSON['stringify'](_0x3e6ceb));if(_0x3e6ceb[_0x176f('0xe')]){if(_0x3e6ceb[_0x176f('0xe')]['code']===0x1f4){logger[_0x176f('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x33e1e9,_0x3e6ceb[_0x176f('0xe')][_0x176f('0xf')]);return _0x56cd67(_0x3e6ceb[_0x176f('0xe')]['message']);}logger[_0x176f('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x33e1e9,_0x3e6ceb[_0x176f('0xe')][_0x176f('0xf')]);return _0x7b1fe0(_0x3e6ceb[_0x176f('0xe')][_0x176f('0xf')]);}else{logger[_0x176f('0x10')](_0x176f('0xa'),_0x33e1e9,_0x176f('0xb'));_0x7b1fe0(_0x3e6ceb[_0x176f('0x11')]['message']);}})[_0x176f('0x12')](function(_0x444b60){logger[_0x176f('0xe')](_0x176f('0xa'),_0x33e1e9,_0x444b60);_0x56cd67(_0x444b60);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index dc32f3f..25c6780 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 _0x9103=['/now','getDate','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','originalname','single','file','addLogo','format','logologin','addLogoLogin','addPreferred','favicon','post','/:id/favicon','put','/:id','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x9103,0x115));var _0x3910=function(_0x2ef8f1,_0x1280a3){_0x2ef8f1=_0x2ef8f1-0x0;var _0x17498d=_0x9103[_0x2ef8f1];return _0x17498d;};'use strict';var multer=require(_0x3910('0x0'));var util=require(_0x3910('0x1'));var path=require('path');var timeout=require(_0x3910('0x2'));var express=require('express');var router=express[_0x3910('0x3')]();var fs_extra=require(_0x3910('0x4'));var auth=require(_0x3910('0x5'));var interaction=require(_0x3910('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router['get']('/',auth[_0x3910('0x7')](),controller[_0x3910('0x8')]);router[_0x3910('0x9')](_0x3910('0xa'),controller[_0x3910('0xb')]);router['get']('/:id',controller['show']);router[_0x3910('0x9')](_0x3910('0xc'),controller[_0x3910('0xd')]);router[_0x3910('0x9')](_0x3910('0xe'),controller[_0x3910('0xf')]);router['get'](_0x3910('0x10'),controller[_0x3910('0x11')]);router[_0x3910('0x9')](_0x3910('0x12'),controller[_0x3910('0x13')]);router[_0x3910('0x9')]('/:id/favicon',controller[_0x3910('0x14')]);var upload=multer({'storage':multer[_0x3910('0x15')]({'destination':function(_0x55674b,_0x5cbf5b,_0x42e5f6){_0x42e5f6(null,path[_0x3910('0x16')](config[_0x3910('0x17')],_0x3910('0x18')));},'filename':function(_0x1d3f59,_0x48faff,_0x21feb6){_0x21feb6(null,util['format'](_0x3910('0x19'),_0x3910('0x1a'),path[_0x3910('0x1b')](_0x48faff[_0x3910('0x1c')])));}})});router['post'](_0x3910('0xc'),upload[_0x3910('0x1d')](_0x3910('0x1e')),controller[_0x3910('0x1f')]);var upload=multer({'storage':multer[_0x3910('0x15')]({'destination':function(_0x2b15d9,_0x4943cf,_0x26a4b5){_0x26a4b5(null,path[_0x3910('0x16')](config['root'],_0x3910('0x18')));},'filename':function(_0x5d6de3,_0x30ce7f,_0x300119){_0x300119(null,util[_0x3910('0x20')](_0x3910('0x19'),_0x3910('0x21'),path[_0x3910('0x1b')](_0x30ce7f[_0x3910('0x1c')])));}})});router['post'](_0x3910('0xe'),upload[_0x3910('0x1d')](_0x3910('0x1e')),controller[_0x3910('0x22')]);var upload=multer({'storage':multer[_0x3910('0x15')]({'destination':function(_0x199661,_0x5b8dbc,_0x30da51){_0x30da51(null,path[_0x3910('0x16')](config[_0x3910('0x17')],_0x3910('0x18')));},'filename':function(_0x56dbea,_0x10fa46,_0x48c898){_0x48c898(null,util[_0x3910('0x20')]('%s%s','preferred',path[_0x3910('0x1b')](_0x10fa46[_0x3910('0x1c')])));}})});router['post'](_0x3910('0x12'),upload[_0x3910('0x1d')](_0x3910('0x1e')),controller[_0x3910('0x23')]);var upload=multer({'storage':multer[_0x3910('0x15')]({'destination':function(_0x5e889f,_0x27ac38,_0x4d61e5){_0x4d61e5(null,path[_0x3910('0x16')](config[_0x3910('0x17')],'server/files/images/logos/'));},'filename':function(_0x3c39fa,_0x310d70,_0x491716){_0x491716(null,util[_0x3910('0x20')](_0x3910('0x19'),_0x3910('0x24'),path['extname'](_0x310d70[_0x3910('0x1c')])));}})});router[_0x3910('0x25')](_0x3910('0x26'),upload[_0x3910('0x1d')](_0x3910('0x1e')),controller['addFavicon']);router[_0x3910('0x27')](_0x3910('0x28'),auth[_0x3910('0x7')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x7122=['/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','addLogo','logologin','file','addLogoLogin','preferred','addPreferred','favicon','put','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','show'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7122,0x199));var _0x2712=function(_0x3f9e46,_0x112e60){_0x3f9e46=_0x3f9e46-0x0;var _0xf6778d=_0x7122[_0x3f9e46];return _0xf6778d;};'use strict';var multer=require(_0x2712('0x0'));var util=require(_0x2712('0x1'));var path=require(_0x2712('0x2'));var timeout=require(_0x2712('0x3'));var express=require(_0x2712('0x4'));var router=express[_0x2712('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2712('0x6'));var interaction=require(_0x2712('0x7'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x2712('0x8')]('/',auth['isAuthenticated'](),controller[_0x2712('0x9')]);router['get']('/now',controller['getDate']);router[_0x2712('0x8')]('/:id',controller[_0x2712('0xa')]);router[_0x2712('0x8')](_0x2712('0xb'),controller[_0x2712('0xc')]);router[_0x2712('0x8')](_0x2712('0xd'),controller[_0x2712('0xe')]);router[_0x2712('0x8')](_0x2712('0xf'),controller['gdpr']);router['get'](_0x2712('0x10'),controller[_0x2712('0x11')]);router['get'](_0x2712('0x12'),controller[_0x2712('0x13')]);var upload=multer({'storage':multer[_0x2712('0x14')]({'destination':function(_0x4a84d9,_0x3ceec9,_0x2e7bfd){_0x2e7bfd(null,path[_0x2712('0x15')](config[_0x2712('0x16')],_0x2712('0x17')));},'filename':function(_0x1e7dae,_0x285635,_0x7113fc){_0x7113fc(null,util[_0x2712('0x18')](_0x2712('0x19'),'logo',path[_0x2712('0x1a')](_0x285635[_0x2712('0x1b')])));}})});router[_0x2712('0x1c')]('/:id/logo',upload[_0x2712('0x1d')]('file'),controller[_0x2712('0x1e')]);var upload=multer({'storage':multer[_0x2712('0x14')]({'destination':function(_0x34ac26,_0x25bc29,_0x52fbb9){_0x52fbb9(null,path['join'](config['root'],_0x2712('0x17')));},'filename':function(_0x3cb23,_0x2e47ac,_0x11158c){_0x11158c(null,util[_0x2712('0x18')]('%s%s',_0x2712('0x1f'),path[_0x2712('0x1a')](_0x2e47ac[_0x2712('0x1b')])));}})});router['post'](_0x2712('0xd'),upload['single'](_0x2712('0x20')),controller[_0x2712('0x21')]);var upload=multer({'storage':multer[_0x2712('0x14')]({'destination':function(_0x20cd77,_0xb40b51,_0x310549){_0x310549(null,path[_0x2712('0x15')](config[_0x2712('0x16')],_0x2712('0x17')));},'filename':function(_0x1a3332,_0x5dcbb1,_0x3c988b){_0x3c988b(null,util['format'](_0x2712('0x19'),_0x2712('0x22'),path[_0x2712('0x1a')](_0x5dcbb1[_0x2712('0x1b')])));}})});router[_0x2712('0x1c')](_0x2712('0x10'),upload[_0x2712('0x1d')](_0x2712('0x20')),controller[_0x2712('0x23')]);var upload=multer({'storage':multer[_0x2712('0x14')]({'destination':function(_0x5ea8d8,_0x3000c1,_0x33479b){_0x33479b(null,path[_0x2712('0x15')](config[_0x2712('0x16')],_0x2712('0x17')));},'filename':function(_0x11e2ba,_0x502d58,_0x18f0a4){_0x18f0a4(null,util['format'](_0x2712('0x19'),_0x2712('0x24'),path[_0x2712('0x1a')](_0x502d58[_0x2712('0x1b')])));}})});router[_0x2712('0x1c')]('/:id/favicon',upload['single'](_0x2712('0x20')),controller['addFavicon']);router[_0x2712('0x25')](_0x2712('0x26'),auth[_0x2712('0x27')](),controller[_0x2712('0x28')]);module[_0x2712('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 0d143a1..c4c2698 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 _0x7a54=['UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x58f32b,_0x29aa86){var _0x21e895=function(_0x1e319a){while(--_0x1e319a){_0x58f32b['push'](_0x58f32b['shift']());}};_0x21e895(++_0x29aa86);}(_0x7a54,0x106));var _0x47a5=function(_0x1580e7,_0x35895a){_0x1580e7=_0x1580e7-0x0;var _0x193792=_0x7a54[_0x1580e7];return _0x193792;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'min_internal':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':_0x47a5('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x5')},'logo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLogo':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x47a5('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x47a5('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x47a5('0x4')]},'defaultPreferred':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x47a5('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x47a5('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x47a5('0x2')]},'transcribeRegion':{'type':Sequelize[_0x47a5('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x47a5('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x47a5('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x2ef3=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','INTEGER','min_internal'];(function(_0x1a6a7a,_0x33db75){var _0x3baeb8=function(_0x81a145){while(--_0x81a145){_0x1a6a7a['push'](_0x1a6a7a['shift']());}};_0x3baeb8(++_0x33db75);}(_0x2ef3,0xba));var _0x32ef=function(_0x4e6446,_0x1a8226){_0x4e6446=_0x4e6446-0x0;var _0x17e617=_0x2ef3[_0x4e6446];return _0x17e617;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'min_internal':{'type':Sequelize[_0x32ef('0x2')](0xb),'unique':_0x32ef('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x32ef('0x2')](0xb),'unique':_0x32ef('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':_0x32ef('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x32ef('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x32ef('0x5')]},'turnaddr':{'type':Sequelize[_0x32ef('0x5')]},'turnusername':{'type':Sequelize[_0x32ef('0x5')]},'turnpassword':{'type':Sequelize[_0x32ef('0x5')]},'pageTitle':{'type':Sequelize[_0x32ef('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':_0x32ef('0x8')},'enableEmailPreview':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x32ef('0x5')]},'defaultFavicon':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x32ef('0x2')]},'transcribeRegion':{'type':Sequelize[_0x32ef('0x5')]},'sentiment':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x32ef('0x5')]},'language':{'type':Sequelize[_0x32ef('0x5')]},'bucket':{'type':Sequelize[_0x32ef('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x32ef('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index af72fc8..e3166ef 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 _0xa400=['reject','save','update','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','params','keys','include','body','find','file','filename','getLogo','server/files/images/logos','getLicense','logo','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','upperFirst','custom','default_logo.svg','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','securePassword','addPreferred','getPreferred','default_preferred.png','default','Sequelize','addFavicon','default_favicon.ico','getDate','now','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','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','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply'];(function(_0xf82ac3,_0x1bb5db){var _0x581d49=function(_0x5491b5){while(--_0x5491b5){_0xf82ac3['push'](_0xf82ac3['shift']());}};_0x581d49(++_0x1bb5db);}(_0xa400,0xc1));var _0x0a40=function(_0x5b909f,_0x2e3289){_0x5b909f=_0x5b909f-0x0;var _0x308ed9=_0xa400[_0x5b909f];return _0x308ed9;};'use strict';var emlformat=require(_0x0a40('0x0'));var rimraf=require(_0x0a40('0x1'));var zipdir=require(_0x0a40('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a40('0x3'));var Mustache=require(_0x0a40('0x4'));var util=require('util');var path=require(_0x0a40('0x5'));var sox=require('sox');var csv=require(_0x0a40('0x6'));var ejs=require(_0x0a40('0x7'));var fs=require('fs');var fs_extra=require(_0x0a40('0x8'));var _=require(_0x0a40('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a40('0xa'));var toCsv=require(_0x0a40('0x6'));var querystring=require(_0x0a40('0xb'));var Papa=require(_0x0a40('0xc'));var Redis=require(_0x0a40('0xd'));var authService=require(_0x0a40('0xe'));var qs=require(_0x0a40('0xf'));var as=require(_0x0a40('0x10'));var hardwareService=require(_0x0a40('0x11'));var logger=require(_0x0a40('0x12'))(_0x0a40('0x13'));var utils=require(_0x0a40('0x14'));var config=require(_0x0a40('0x15'));var licenseUtil=require(_0x0a40('0x16'));var db=require(_0x0a40('0x17'))['db'];var jayson=require(_0x0a40('0x18'));var client=jayson[_0x0a40('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58d54e,_0x4e92f7,_0x34c424,_0x1b5104){return new BPromise(function(_0x5de1de,_0x339fb6){var _0x527f22=_0x1b5104||client;return _0x527f22[_0x0a40('0x1a')](_0x58d54e,_0x34c424)[_0x0a40('0x1b')](function(_0x4e3954){logger[_0x0a40('0x1c')](_0x0a40('0x1d'),_0x4e92f7,_0x0a40('0x1e'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x4e92f7,_0x0a40('0x1e'),JSON[_0x0a40('0x1f')](_0x4e3954));if(_0x4e3954[_0x0a40('0x20')]){if(_0x4e3954[_0x0a40('0x20')][_0x0a40('0x21')]===0x1f4){logger['error'](_0x0a40('0x1d'),_0x4e92f7,_0x4e3954[_0x0a40('0x20')][_0x0a40('0x22')]);return _0x339fb6(_0x4e3954['error'][_0x0a40('0x22')]);}logger['error']('Setting,\x20%s,\x20%s',_0x4e92f7,_0x4e3954['error'][_0x0a40('0x22')]);return _0x5de1de(_0x4e3954[_0x0a40('0x20')]['message']);}else{logger['info'](_0x0a40('0x1d'),_0x4e92f7,_0x0a40('0x1e'));_0x5de1de(_0x4e3954[_0x0a40('0x23')][_0x0a40('0x22')]);}})[_0x0a40('0x24')](function(_0x550209){logger[_0x0a40('0x20')](_0x0a40('0x1d'),_0x4e92f7,_0x550209);_0x339fb6(_0x550209);});});}function respondWithStatusCode(_0x290405,_0x2ab128){_0x2ab128=_0x2ab128||0xcc;return function(_0x559340){if(_0x559340){return _0x290405[_0x0a40('0x25')](_0x2ab128);}return _0x290405[_0x0a40('0x26')](_0x2ab128)[_0x0a40('0x27')]();};}function respondWithResult(_0x1f90d1,_0x1b817c){_0x1b817c=_0x1b817c||0xc8;return function(_0x48cc2e){if(_0x48cc2e){return _0x1f90d1[_0x0a40('0x26')](_0x1b817c)[_0x0a40('0x28')](_0x48cc2e);}};}function respondWithFilteredResult(_0x21ccdc,_0x4e766e){return function(_0x3d08a9){if(_0x3d08a9){var _0x44ed96=typeof _0x4e766e[_0x0a40('0x29')]==='undefined'&&typeof _0x4e766e['limit']===_0x0a40('0x2a');var _0x377bfc=_0x3d08a9[_0x0a40('0x2b')];var _0x4bb083=_0x44ed96?0x0:_0x4e766e[_0x0a40('0x29')];var _0x19c28d=_0x44ed96?_0x3d08a9[_0x0a40('0x2b')]:_0x4e766e[_0x0a40('0x29')]+_0x4e766e[_0x0a40('0x2c')];var _0x3c4229;if(_0x19c28d>=_0x377bfc){_0x19c28d=_0x377bfc;_0x3c4229=0xc8;}else{_0x3c4229=0xce;}_0x21ccdc[_0x0a40('0x26')](_0x3c4229);return _0x21ccdc['set'](_0x0a40('0x2d'),_0x4bb083+'-'+_0x19c28d+'/'+_0x377bfc)['json'](_0x3d08a9);}return null;};}function patchUpdates(_0x13afe9){return function(_0x253c04){try{jsonpatch[_0x0a40('0x2e')](_0x253c04,_0x13afe9,!![]);}catch(_0x148202){return BPromise[_0x0a40('0x2f')](_0x148202);}return _0x253c04[_0x0a40('0x30')]();};}function saveUpdates(_0x2e4966,_0xafc73d){return function(_0x3eba1f){if(_0x3eba1f){return _0x3eba1f[_0x0a40('0x31')](_0x2e4966)[_0x0a40('0x1b')](function(_0x39b0a5){return _0x39b0a5;});}return null;};}function removeEntity(_0x1d8088,_0x35f3c0){return function(_0x125db2){if(_0x125db2){return _0x125db2[_0x0a40('0x32')]()['then'](function(){_0x1d8088[_0x0a40('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c7923,_0x1a0616){return function(_0x33bd24){if(!_0x33bd24){_0x4c7923[_0x0a40('0x25')](0x194);}return _0x33bd24;};}function handleError(_0x2b1afc,_0x5df1e5){_0x5df1e5=_0x5df1e5||0x1f4;return function(_0x1511ef){logger[_0x0a40('0x20')](_0x1511ef[_0x0a40('0x33')]);if(_0x1511ef['name']){delete _0x1511ef[_0x0a40('0x34')];}_0x2b1afc[_0x0a40('0x26')](_0x5df1e5)[_0x0a40('0x35')](_0x1511ef);};}exports[_0x0a40('0x36')]=function(_0x13651c,_0x2b975b){var _0x8a8820={},_0x4f227c={},_0x569ace={'count':0x0,'rows':[]};var _0x281dea=_[_0x0a40('0x37')](db[_0x0a40('0x38')][_0x0a40('0x39')],function(_0x534e82){return{'name':_0x534e82[_0x0a40('0x3a')],'type':_0x534e82['type'][_0x0a40('0x3b')]};});_0x4f227c[_0x0a40('0x3c')]=_['map'](_0x281dea,_0x0a40('0x34'));_0x4f227c[_0x0a40('0x3d')]=_['keys'](_0x13651c['query']);_0x4f227c[_0x0a40('0x3e')]=_[_0x0a40('0x3f')](_0x4f227c[_0x0a40('0x3c')],_0x4f227c['query']);_0x8a8820[_0x0a40('0x40')]=_['intersection'](_0x4f227c[_0x0a40('0x3c')],qs[_0x0a40('0x41')](_0x13651c[_0x0a40('0x3d')][_0x0a40('0x41')]));_0x8a8820[_0x0a40('0x40')]=_0x8a8820[_0x0a40('0x40')]['length']?_0x8a8820['attributes']:_0x4f227c[_0x0a40('0x3c')];if(!_0x13651c['query'][_0x0a40('0x42')]('nolimit')){_0x8a8820[_0x0a40('0x2c')]=qs[_0x0a40('0x2c')](_0x13651c[_0x0a40('0x3d')][_0x0a40('0x2c')]);_0x8a8820['offset']=qs[_0x0a40('0x29')](_0x13651c[_0x0a40('0x3d')][_0x0a40('0x29')]);}_0x8a8820['order']=qs['sort'](_0x13651c[_0x0a40('0x3d')][_0x0a40('0x43')]);_0x8a8820[_0x0a40('0x44')]=qs['filters'](_[_0x0a40('0x45')](_0x13651c[_0x0a40('0x3d')],_0x4f227c[_0x0a40('0x3e')]),_0x281dea);if(_0x13651c[_0x0a40('0x3d')][_0x0a40('0x46')]){_0x8a8820[_0x0a40('0x44')]=_[_0x0a40('0x47')](_0x8a8820[_0x0a40('0x44')],{'$or':_['map'](_0x281dea,function(_0x36b618){if(_0x36b618[_0x0a40('0x48')]!==_0x0a40('0x49')){var _0x2284aa={};_0x2284aa[_0x36b618[_0x0a40('0x34')]]={'$like':'%'+_0x13651c[_0x0a40('0x3d')]['filter']+'%'};return _0x2284aa;}})});}_0x8a8820=_['merge']({},_0x8a8820,_0x13651c[_0x0a40('0x4a')]);var _0x141c26={'where':_0x8a8820[_0x0a40('0x44')]};return db[_0x0a40('0x38')][_0x0a40('0x2b')](_0x141c26)[_0x0a40('0x1b')](function(_0xd232ae){_0x569ace[_0x0a40('0x2b')]=_0xd232ae;if(_0x13651c[_0x0a40('0x3d')][_0x0a40('0x4b')]){_0x8a8820['include']=[{'all':!![]}];}return db[_0x0a40('0x38')][_0x0a40('0x4c')](_0x8a8820);})[_0x0a40('0x1b')](function(_0x38f642){_0x569ace['rows']=_0x38f642;return _0x569ace;})['then'](respondWithFilteredResult(_0x2b975b,_0x8a8820))[_0x0a40('0x24')](handleError(_0x2b975b,null));};exports['show']=function(_0x321e41,_0x5c9d1f){var _0x56f0cb={'raw':![],'where':{'id':_0x321e41[_0x0a40('0x4d')]['id']}},_0x383fab={};_0x383fab[_0x0a40('0x3c')]=_['keys'](db['Setting'][_0x0a40('0x39')]);_0x383fab[_0x0a40('0x3d')]=_[_0x0a40('0x4e')](_0x321e41['query']);_0x383fab[_0x0a40('0x3e')]=_[_0x0a40('0x3f')](_0x383fab[_0x0a40('0x3c')],_0x383fab[_0x0a40('0x3d')]);_0x56f0cb[_0x0a40('0x40')]=_[_0x0a40('0x3f')](_0x383fab['model'],qs[_0x0a40('0x41')](_0x321e41[_0x0a40('0x3d')]['fields']));_0x56f0cb[_0x0a40('0x40')]=_0x56f0cb['attributes']['length']?_0x56f0cb[_0x0a40('0x40')]:_0x383fab['model'];if(_0x321e41[_0x0a40('0x3d')][_0x0a40('0x4b')]){_0x56f0cb[_0x0a40('0x4f')]=[{'all':!![]}];}_0x56f0cb=_[_0x0a40('0x47')]({},_0x56f0cb,_0x321e41[_0x0a40('0x4a')]);return db[_0x0a40('0x38')]['find'](_0x56f0cb)[_0x0a40('0x1b')](handleEntityNotFound(_0x5c9d1f,null))[_0x0a40('0x1b')](respondWithResult(_0x5c9d1f,null))[_0x0a40('0x24')](handleError(_0x5c9d1f,null));};exports[_0x0a40('0x31')]=function(_0x1d663b,_0x245df8){if(_0x1d663b[_0x0a40('0x50')]['id']){delete _0x1d663b[_0x0a40('0x50')]['id'];}return db[_0x0a40('0x38')][_0x0a40('0x51')]({'where':{'id':_0x1d663b[_0x0a40('0x4d')]['id']}})[_0x0a40('0x1b')](handleEntityNotFound(_0x245df8,null))['then'](saveUpdates(_0x1d663b[_0x0a40('0x50')],null))[_0x0a40('0x1b')](respondWithResult(_0x245df8,null))[_0x0a40('0x24')](handleError(_0x245df8,null));};exports['addLogo']=function(_0x4cf3ef,_0x2fb66e,_0x109a89){if(_0x4cf3ef[_0x0a40('0x52')]&&_0x4cf3ef[_0x0a40('0x52')][_0x0a40('0x53')]){_0x4cf3ef[_0x0a40('0x50')]['logo']=_0x4cf3ef[_0x0a40('0x52')]['filename'];}return db['Setting'][_0x0a40('0x51')]({'where':{'id':_0x4cf3ef[_0x0a40('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2fb66e,null))[_0x0a40('0x1b')](saveUpdates(_0x4cf3ef[_0x0a40('0x50')],null))[_0x0a40('0x1b')](respondWithResult(_0x2fb66e,null))[_0x0a40('0x24')](handleError(_0x2fb66e,null));};exports['addLogoLogin']=function(_0x4a5c14,_0x216931,_0x385a7f){if(_0x4a5c14[_0x0a40('0x52')]&&_0x4a5c14[_0x0a40('0x52')][_0x0a40('0x53')]){_0x4a5c14[_0x0a40('0x50')]['loginLogo']=_0x4a5c14[_0x0a40('0x52')][_0x0a40('0x53')];}return db[_0x0a40('0x38')][_0x0a40('0x51')]({'where':{'id':_0x4a5c14[_0x0a40('0x4d')]['id']}})[_0x0a40('0x1b')](handleEntityNotFound(_0x216931,null))[_0x0a40('0x1b')](saveUpdates(_0x4a5c14['body'],null))[_0x0a40('0x1b')](respondWithResult(_0x216931,null))['catch'](handleError(_0x216931,null));};var utilLicense=require(_0x0a40('0x16'));exports[_0x0a40('0x54')]=function(_0x22324b,_0x44ab8d,_0x26f535){var _0x228d8d=_0x0a40('0x55');var _0x294e8d={'custom':![]};return utilLicense[_0x0a40('0x56')]()['then'](function(_0x18650){if(_0x18650){_0x294e8d=_0x18650;}return db[_0x0a40('0x38')][_0x0a40('0x51')]({'where':{'id':_0x22324b[_0x0a40('0x4d')]['id']},'attributes':[_0x0a40('0x57'),_0x0a40('0x58'),_0x0a40('0x59'),_0x0a40('0x5a'),_0x0a40('0x5b'),_0x0a40('0x5c'),_0x0a40('0x5d'),_0x0a40('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x44ab8d,null))[_0x0a40('0x1b')](function(_0x1a6554){if(_0x1a6554){var _0x51e0ca=_0x1a6554[_0x0a40('0x57')]&&fs[_0x0a40('0x5f')](path['join'](config[_0x0a40('0x60')],_0x228d8d,_[_0x0a40('0x61')](_0x1a6554[_0x0a40('0x57')])))?path[_0x0a40('0x62')](config['root'],_0x228d8d,_[_0x0a40('0x61')](_0x1a6554['logo'])):path['join'](config['root'],_0x228d8d,_[_0x0a40('0x61')]('default_logo.svg'));var _0x1c4ad6='default'+_[_0x0a40('0x63')](_0x0a40('0x57'));if(_0x1a6554[_0x1c4ad6]||!_0x294e8d[_0x0a40('0x64')]){_0x51e0ca=path[_0x0a40('0x62')](config[_0x0a40('0x60')],_0x228d8d,_[_0x0a40('0x61')](_0x0a40('0x65')));}if(!fs[_0x0a40('0x5f')](_0x51e0ca)){throw new db['Sequelize'][(_0x0a40('0x66'))](_[_0x0a40('0x63')](_0x0a40('0x57'))+_0x0a40('0x67'));}return _0x44ab8d[_0x0a40('0x68')](_0x51e0ca);}})[_0x0a40('0x24')](handleError(_0x44ab8d,null));};var utilLicense=require(_0x0a40('0x16'));exports[_0x0a40('0x69')]=function(_0x18d202,_0x4d046b,_0x4850d9){var _0x246ac9='server/files/images/logos';var _0x911dd5={'custom':![]};return utilLicense[_0x0a40('0x56')]()[_0x0a40('0x1b')](function(_0x3723a3){if(_0x3723a3){_0x911dd5=_0x3723a3;}return db[_0x0a40('0x38')]['find']({'where':{'id':_0x18d202[_0x0a40('0x4d')]['id']},'attributes':['logo',_0x0a40('0x58'),_0x0a40('0x59'),_0x0a40('0x5a'),_0x0a40('0x5b'),_0x0a40('0x5c'),_0x0a40('0x5d'),_0x0a40('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x4d046b,null))[_0x0a40('0x1b')](function(_0x4c30b){if(_0x4c30b){var _0xc84cae=_0x4c30b[_0x0a40('0x58')]&&fs[_0x0a40('0x5f')](path[_0x0a40('0x62')](config[_0x0a40('0x60')],_0x246ac9,_[_0x0a40('0x61')](_0x4c30b[_0x0a40('0x58')])))?path['join'](config[_0x0a40('0x60')],_0x246ac9,_[_0x0a40('0x61')](_0x4c30b[_0x0a40('0x58')])):path[_0x0a40('0x62')](config['root'],_0x246ac9,_[_0x0a40('0x61')](_0x0a40('0x6a')));var _0x8b3f47='default'+_['upperFirst'](_0x0a40('0x58'));if(_0x4c30b[_0x8b3f47]||!_0x911dd5[_0x0a40('0x64')]){_0xc84cae=path[_0x0a40('0x62')](config[_0x0a40('0x60')],_0x246ac9,_['toLower'](_0x0a40('0x6a')));}if(!fs['existsSync'](_0xc84cae)){throw new db['Sequelize'][(_0x0a40('0x66'))](_[_0x0a40('0x63')](_0x0a40('0x58'))+_0x0a40('0x67'));}return _0x4d046b[_0x0a40('0x68')](_0xc84cae);}})[_0x0a40('0x24')](handleError(_0x4d046b,null));};exports['gdpr']=function(_0x1e582b,_0x210860){return db[_0x0a40('0x38')][_0x0a40('0x51')]({'where':{'id':_0x1e582b[_0x0a40('0x4d')]['id']},'attributes':[_0x0a40('0x6b')]})['then'](respondWithResult(_0x210860,null))['catch'](handleError(_0x210860,null));};exports[_0x0a40('0x6c')]=function(_0x4ca4e9,_0x591c6d,_0x1076db){if(_0x4ca4e9[_0x0a40('0x52')]&&_0x4ca4e9[_0x0a40('0x52')]['filename']){_0x4ca4e9[_0x0a40('0x50')]['preferred']=_0x4ca4e9[_0x0a40('0x52')][_0x0a40('0x53')];}return db['Setting']['find']({'where':{'id':_0x4ca4e9[_0x0a40('0x4d')]['id']}})[_0x0a40('0x1b')](handleEntityNotFound(_0x591c6d,null))[_0x0a40('0x1b')](saveUpdates(_0x4ca4e9[_0x0a40('0x50')],null))[_0x0a40('0x1b')](respondWithResult(_0x591c6d,null))[_0x0a40('0x24')](handleError(_0x591c6d,null));};var utilLicense=require(_0x0a40('0x16'));exports[_0x0a40('0x6d')]=function(_0x4dbe23,_0x1f3611,_0x1ab55d){var _0x5004ef=_0x0a40('0x55');var _0x589252={'custom':![]};return utilLicense[_0x0a40('0x56')]()[_0x0a40('0x1b')](function(_0x11d271){if(_0x11d271){_0x589252=_0x11d271;}return db['Setting'][_0x0a40('0x51')]({'where':{'id':_0x4dbe23['params']['id']},'attributes':[_0x0a40('0x57'),_0x0a40('0x58'),_0x0a40('0x59'),_0x0a40('0x5a'),_0x0a40('0x5b'),_0x0a40('0x5c'),_0x0a40('0x5d'),_0x0a40('0x5e')],'raw':!![]});})[_0x0a40('0x1b')](handleEntityNotFound(_0x1f3611,null))['then'](function(_0xc48469){if(_0xc48469){var _0x36c0a3=_0xc48469[_0x0a40('0x59')]&&fs[_0x0a40('0x5f')](path[_0x0a40('0x62')](config[_0x0a40('0x60')],_0x5004ef,_[_0x0a40('0x61')](_0xc48469[_0x0a40('0x59')])))?path['join'](config['root'],_0x5004ef,_[_0x0a40('0x61')](_0xc48469[_0x0a40('0x59')])):path[_0x0a40('0x62')](config[_0x0a40('0x60')],_0x5004ef,_['toLower'](_0x0a40('0x6e')));var _0x466dca=_0x0a40('0x6f')+_[_0x0a40('0x63')](_0x0a40('0x59'));if(_0xc48469[_0x466dca]||!_0x589252[_0x0a40('0x64')]||!_0x589252[_0x0a40('0x59')]){_0x36c0a3=path[_0x0a40('0x62')](config['root'],_0x5004ef,_[_0x0a40('0x61')](_0x0a40('0x6e')));}if(!fs[_0x0a40('0x5f')](_0x36c0a3)){throw new db[(_0x0a40('0x70'))][(_0x0a40('0x66'))](_[_0x0a40('0x63')](_0x0a40('0x59'))+'\x20not\x20found');}return _0x1f3611['download'](_0x36c0a3);}})[_0x0a40('0x24')](handleError(_0x1f3611,null));};exports[_0x0a40('0x71')]=function(_0x1d8788,_0x4abfc8,_0x4b3780){if(_0x1d8788['file']&&_0x1d8788[_0x0a40('0x52')]['filename']){_0x1d8788[_0x0a40('0x50')][_0x0a40('0x5a')]=_0x1d8788[_0x0a40('0x52')][_0x0a40('0x53')];}return db[_0x0a40('0x38')][_0x0a40('0x51')]({'where':{'id':_0x1d8788[_0x0a40('0x4d')]['id']}})[_0x0a40('0x1b')](handleEntityNotFound(_0x4abfc8,null))[_0x0a40('0x1b')](saveUpdates(_0x1d8788['body'],null))['then'](respondWithResult(_0x4abfc8,null))[_0x0a40('0x24')](handleError(_0x4abfc8,null));};var utilLicense=require(_0x0a40('0x16'));exports['getFavicon']=function(_0x3e646c,_0x512791,_0x1cb04d){var _0x147315=_0x0a40('0x55');var _0x47cb8a={'custom':![]};return utilLicense[_0x0a40('0x56')]()[_0x0a40('0x1b')](function(_0x289e48){if(_0x289e48){_0x47cb8a=_0x289e48;}return db[_0x0a40('0x38')][_0x0a40('0x51')]({'where':{'id':_0x3e646c[_0x0a40('0x4d')]['id']},'attributes':[_0x0a40('0x57'),'loginLogo',_0x0a40('0x59'),_0x0a40('0x5a'),_0x0a40('0x5b'),_0x0a40('0x5c'),_0x0a40('0x5d'),_0x0a40('0x5e')],'raw':!![]});})[_0x0a40('0x1b')](handleEntityNotFound(_0x512791,null))[_0x0a40('0x1b')](function(_0x23ad91){if(_0x23ad91){var _0x4140e6=_0x23ad91['favicon']&&fs[_0x0a40('0x5f')](path[_0x0a40('0x62')](config[_0x0a40('0x60')],_0x147315,_[_0x0a40('0x61')](_0x23ad91[_0x0a40('0x5a')])))?path[_0x0a40('0x62')](config[_0x0a40('0x60')],_0x147315,_[_0x0a40('0x61')](_0x23ad91['favicon'])):path[_0x0a40('0x62')](config['root'],_0x147315,_['toLower']('default_favicon.ico'));var _0x54d31b=_0x0a40('0x6f')+_[_0x0a40('0x63')]('favicon');if(_0x23ad91[_0x54d31b]||!_0x47cb8a[_0x0a40('0x64')]){_0x4140e6=path['join'](config[_0x0a40('0x60')],_0x147315,_[_0x0a40('0x61')](_0x0a40('0x72')));}if(!fs[_0x0a40('0x5f')](_0x4140e6)){throw new db[(_0x0a40('0x70'))][(_0x0a40('0x66'))](_['upperFirst']('favicon')+_0x0a40('0x67'));}return _0x512791['download'](_0x4140e6);}})[_0x0a40('0x24')](handleError(_0x512791,null));};exports[_0x0a40('0x73')]=function(_0x46895e,_0x373a1b){var _0x15b1d1={'offset':moment()['utcOffset']()};_0x15b1d1[_0x0a40('0x74')]=moment()[_0x0a40('0x75')](_0x15b1d1[_0x0a40('0x29')])[_0x0a40('0x76')](_0x0a40('0x77'));return _0x373a1b['status'](0xc8)['send'](_0x15b1d1);}; \ No newline at end of file +var _0xab29=['set','apply','reject','save','update','destroy','end','stack','name','send','index','Setting','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','map','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','params','length','options','find','body','file','filename','loginLogo','getLogo','defaultLoginLogo','defaultPreferred','logo','join','root','toLower','default_logo.svg','default','custom','existsSync','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','server/files/images/logos','getLicense','preferred','defaultLogo','defaultFavicon','default_loginLogo.svg','addPreferred','getPreferred','default_preferred.png','../../config/license/util','favicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','moment','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','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','undefined','count','offset','limit'];(function(_0x149c1f,_0x7b4dc6){var _0x309eeb=function(_0x19863c){while(--_0x19863c){_0x149c1f['push'](_0x149c1f['shift']());}};_0x309eeb(++_0x7b4dc6);}(_0xab29,0x145));var _0x9ab2=function(_0x2aebde,_0x129d06){_0x2aebde=_0x2aebde-0x0;var _0x415e4f=_0xab29[_0x2aebde];return _0x415e4f;};'use strict';var emlformat=require(_0x9ab2('0x0'));var rimraf=require(_0x9ab2('0x1'));var zipdir=require(_0x9ab2('0x2'));var jsonpatch=require(_0x9ab2('0x3'));var rp=require('request-promise');var moment=require(_0x9ab2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9ab2('0x5'));var util=require(_0x9ab2('0x6'));var path=require(_0x9ab2('0x7'));var sox=require(_0x9ab2('0x8'));var csv=require(_0x9ab2('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ab2('0xa'));var _=require(_0x9ab2('0xb'));var squel=require(_0x9ab2('0xc'));var crypto=require(_0x9ab2('0xd'));var jsforce=require(_0x9ab2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9ab2('0x9'));var querystring=require(_0x9ab2('0xf'));var Papa=require(_0x9ab2('0x10'));var Redis=require(_0x9ab2('0x11'));var authService=require(_0x9ab2('0x12'));var qs=require(_0x9ab2('0x13'));var as=require(_0x9ab2('0x14'));var hardwareService=require(_0x9ab2('0x15'));var logger=require(_0x9ab2('0x16'))('api');var utils=require(_0x9ab2('0x17'));var config=require(_0x9ab2('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x9ab2('0x19'));var client=jayson[_0x9ab2('0x1a')][_0x9ab2('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x55cc45,_0x2bdac5,_0x314432,_0x55c9d6){return new BPromise(function(_0x3a594f,_0x43debd){var _0x305b86=_0x55c9d6||client;return _0x305b86[_0x9ab2('0x1c')](_0x55cc45,_0x314432)[_0x9ab2('0x1d')](function(_0x117a33){logger[_0x9ab2('0x1e')](_0x9ab2('0x1f'),_0x2bdac5,'request\x20sent');logger[_0x9ab2('0x20')](_0x9ab2('0x21'),_0x2bdac5,_0x9ab2('0x22'),JSON[_0x9ab2('0x23')](_0x117a33));if(_0x117a33[_0x9ab2('0x24')]){if(_0x117a33[_0x9ab2('0x24')]['code']===0x1f4){logger['error'](_0x9ab2('0x1f'),_0x2bdac5,_0x117a33['error'][_0x9ab2('0x25')]);return _0x43debd(_0x117a33[_0x9ab2('0x24')]['message']);}logger[_0x9ab2('0x24')](_0x9ab2('0x1f'),_0x2bdac5,_0x117a33['error'][_0x9ab2('0x25')]);return _0x3a594f(_0x117a33[_0x9ab2('0x24')][_0x9ab2('0x25')]);}else{logger[_0x9ab2('0x1e')](_0x9ab2('0x1f'),_0x2bdac5,_0x9ab2('0x22'));_0x3a594f(_0x117a33[_0x9ab2('0x26')][_0x9ab2('0x25')]);}})[_0x9ab2('0x27')](function(_0x3e70b4){logger[_0x9ab2('0x24')](_0x9ab2('0x1f'),_0x2bdac5,_0x3e70b4);_0x43debd(_0x3e70b4);});});}function respondWithStatusCode(_0x3b7037,_0x5a0b32){_0x5a0b32=_0x5a0b32||0xcc;return function(_0x37a1da){if(_0x37a1da){return _0x3b7037[_0x9ab2('0x28')](_0x5a0b32);}return _0x3b7037[_0x9ab2('0x29')](_0x5a0b32)['end']();};}function respondWithResult(_0x1f9b3b,_0x4486cc){_0x4486cc=_0x4486cc||0xc8;return function(_0x2f560d){if(_0x2f560d){return _0x1f9b3b[_0x9ab2('0x29')](_0x4486cc)[_0x9ab2('0x2a')](_0x2f560d);}};}function respondWithFilteredResult(_0x393223,_0x1c7142){return function(_0x2d9db7){if(_0x2d9db7){var _0x40a983=typeof _0x1c7142['offset']==='undefined'&&typeof _0x1c7142['limit']===_0x9ab2('0x2b');var _0x43ad26=_0x2d9db7[_0x9ab2('0x2c')];var _0x3f6662=_0x40a983?0x0:_0x1c7142[_0x9ab2('0x2d')];var _0x2a01dc=_0x40a983?_0x2d9db7[_0x9ab2('0x2c')]:_0x1c7142[_0x9ab2('0x2d')]+_0x1c7142[_0x9ab2('0x2e')];var _0x181119;if(_0x2a01dc>=_0x43ad26){_0x2a01dc=_0x43ad26;_0x181119=0xc8;}else{_0x181119=0xce;}_0x393223['status'](_0x181119);return _0x393223[_0x9ab2('0x2f')]('Content-Range',_0x3f6662+'-'+_0x2a01dc+'/'+_0x43ad26)[_0x9ab2('0x2a')](_0x2d9db7);}return null;};}function patchUpdates(_0x27b991){return function(_0x4e8252){try{jsonpatch[_0x9ab2('0x30')](_0x4e8252,_0x27b991,!![]);}catch(_0x583b0c){return BPromise[_0x9ab2('0x31')](_0x583b0c);}return _0x4e8252[_0x9ab2('0x32')]();};}function saveUpdates(_0x26856c,_0x434b93){return function(_0x3abaf3){if(_0x3abaf3){return _0x3abaf3[_0x9ab2('0x33')](_0x26856c)[_0x9ab2('0x1d')](function(_0xf6c79d){return _0xf6c79d;});}return null;};}function removeEntity(_0x24b0c8,_0x4e498c){return function(_0x4eb730){if(_0x4eb730){return _0x4eb730[_0x9ab2('0x34')]()[_0x9ab2('0x1d')](function(){_0x24b0c8[_0x9ab2('0x29')](0xcc)[_0x9ab2('0x35')]();});}};}function handleEntityNotFound(_0xf41123,_0x4adb67){return function(_0x54eeba){if(!_0x54eeba){_0xf41123[_0x9ab2('0x28')](0x194);}return _0x54eeba;};}function handleError(_0x551476,_0x1134e2){_0x1134e2=_0x1134e2||0x1f4;return function(_0x1270d1){logger[_0x9ab2('0x24')](_0x1270d1[_0x9ab2('0x36')]);if(_0x1270d1[_0x9ab2('0x37')]){delete _0x1270d1[_0x9ab2('0x37')];}_0x551476[_0x9ab2('0x29')](_0x1134e2)[_0x9ab2('0x38')](_0x1270d1);};}exports[_0x9ab2('0x39')]=function(_0x3c958,_0x2280b2){var _0x397af8={},_0x220d58={},_0x3cfa1b={'count':0x0,'rows':[]};var _0x1b214b=_['map'](db[_0x9ab2('0x3a')][_0x9ab2('0x3b')],function(_0xa1bbf5){return{'name':_0xa1bbf5[_0x9ab2('0x3c')],'type':_0xa1bbf5[_0x9ab2('0x3d')][_0x9ab2('0x3e')]};});_0x220d58[_0x9ab2('0x3f')]=_['map'](_0x1b214b,_0x9ab2('0x37'));_0x220d58[_0x9ab2('0x40')]=_['keys'](_0x3c958[_0x9ab2('0x40')]);_0x220d58[_0x9ab2('0x41')]=_[_0x9ab2('0x42')](_0x220d58[_0x9ab2('0x3f')],_0x220d58[_0x9ab2('0x40')]);_0x397af8[_0x9ab2('0x43')]=_[_0x9ab2('0x42')](_0x220d58[_0x9ab2('0x3f')],qs[_0x9ab2('0x44')](_0x3c958[_0x9ab2('0x40')][_0x9ab2('0x44')]));_0x397af8[_0x9ab2('0x43')]=_0x397af8[_0x9ab2('0x43')]['length']?_0x397af8[_0x9ab2('0x43')]:_0x220d58['model'];if(!_0x3c958[_0x9ab2('0x40')][_0x9ab2('0x45')]('nolimit')){_0x397af8['limit']=qs[_0x9ab2('0x2e')](_0x3c958[_0x9ab2('0x40')]['limit']);_0x397af8[_0x9ab2('0x2d')]=qs['offset'](_0x3c958[_0x9ab2('0x40')][_0x9ab2('0x2d')]);}_0x397af8[_0x9ab2('0x46')]=qs['sort'](_0x3c958[_0x9ab2('0x40')]['sort']);_0x397af8[_0x9ab2('0x47')]=qs[_0x9ab2('0x41')](_[_0x9ab2('0x48')](_0x3c958[_0x9ab2('0x40')],_0x220d58[_0x9ab2('0x41')]),_0x1b214b);if(_0x3c958['query']['filter']){_0x397af8['where']=_['merge'](_0x397af8[_0x9ab2('0x47')],{'$or':_[_0x9ab2('0x49')](_0x1b214b,function(_0x4a4ba2){if(_0x4a4ba2[_0x9ab2('0x3d')]!==_0x9ab2('0x4a')){var _0x1e21f2={};_0x1e21f2[_0x4a4ba2[_0x9ab2('0x37')]]={'$like':'%'+_0x3c958['query'][_0x9ab2('0x4b')]+'%'};return _0x1e21f2;}})});}_0x397af8=_[_0x9ab2('0x4c')]({},_0x397af8,_0x3c958['options']);var _0x24ff93={'where':_0x397af8[_0x9ab2('0x47')]};return db[_0x9ab2('0x3a')][_0x9ab2('0x2c')](_0x24ff93)[_0x9ab2('0x1d')](function(_0x1da995){_0x3cfa1b['count']=_0x1da995;if(_0x3c958[_0x9ab2('0x40')][_0x9ab2('0x4d')]){_0x397af8[_0x9ab2('0x4e')]=[{'all':!![]}];}return db[_0x9ab2('0x3a')][_0x9ab2('0x4f')](_0x397af8);})[_0x9ab2('0x1d')](function(_0x50cfe9){_0x3cfa1b[_0x9ab2('0x50')]=_0x50cfe9;return _0x3cfa1b;})['then'](respondWithFilteredResult(_0x2280b2,_0x397af8))[_0x9ab2('0x27')](handleError(_0x2280b2,null));};exports[_0x9ab2('0x51')]=function(_0x48b368,_0x4833bd){var _0x12a3cf={'raw':![],'where':{'id':_0x48b368[_0x9ab2('0x52')]['id']}},_0x4e867c={};_0x4e867c[_0x9ab2('0x3f')]=_['keys'](db['Setting']['rawAttributes']);_0x4e867c[_0x9ab2('0x40')]=_['keys'](_0x48b368[_0x9ab2('0x40')]);_0x4e867c[_0x9ab2('0x41')]=_[_0x9ab2('0x42')](_0x4e867c[_0x9ab2('0x3f')],_0x4e867c['query']);_0x12a3cf[_0x9ab2('0x43')]=_[_0x9ab2('0x42')](_0x4e867c[_0x9ab2('0x3f')],qs[_0x9ab2('0x44')](_0x48b368[_0x9ab2('0x40')]['fields']));_0x12a3cf[_0x9ab2('0x43')]=_0x12a3cf[_0x9ab2('0x43')][_0x9ab2('0x53')]?_0x12a3cf[_0x9ab2('0x43')]:_0x4e867c['model'];if(_0x48b368[_0x9ab2('0x40')][_0x9ab2('0x4d')]){_0x12a3cf['include']=[{'all':!![]}];}_0x12a3cf=_['merge']({},_0x12a3cf,_0x48b368[_0x9ab2('0x54')]);return db[_0x9ab2('0x3a')][_0x9ab2('0x55')](_0x12a3cf)[_0x9ab2('0x1d')](handleEntityNotFound(_0x4833bd,null))['then'](respondWithResult(_0x4833bd,null))[_0x9ab2('0x27')](handleError(_0x4833bd,null));};exports[_0x9ab2('0x33')]=function(_0x4f994d,_0x4d46a2){if(_0x4f994d[_0x9ab2('0x56')]['id']){delete _0x4f994d['body']['id'];}return db[_0x9ab2('0x3a')][_0x9ab2('0x55')]({'where':{'id':_0x4f994d[_0x9ab2('0x52')]['id']}})['then'](handleEntityNotFound(_0x4d46a2,null))[_0x9ab2('0x1d')](saveUpdates(_0x4f994d[_0x9ab2('0x56')],null))['then'](respondWithResult(_0x4d46a2,null))[_0x9ab2('0x27')](handleError(_0x4d46a2,null));};exports['addLogo']=function(_0x4ff380,_0x526ba6,_0x524f14){if(_0x4ff380[_0x9ab2('0x57')]&&_0x4ff380[_0x9ab2('0x57')][_0x9ab2('0x58')]){_0x4ff380[_0x9ab2('0x56')]['logo']=_0x4ff380['file'][_0x9ab2('0x58')];}return db[_0x9ab2('0x3a')][_0x9ab2('0x55')]({'where':{'id':_0x4ff380[_0x9ab2('0x52')]['id']}})[_0x9ab2('0x1d')](handleEntityNotFound(_0x526ba6,null))[_0x9ab2('0x1d')](saveUpdates(_0x4ff380[_0x9ab2('0x56')],null))[_0x9ab2('0x1d')](respondWithResult(_0x526ba6,null))['catch'](handleError(_0x526ba6,null));};exports['addLogoLogin']=function(_0x69221e,_0x122dae,_0x246736){if(_0x69221e[_0x9ab2('0x57')]&&_0x69221e['file'][_0x9ab2('0x58')]){_0x69221e['body'][_0x9ab2('0x59')]=_0x69221e[_0x9ab2('0x57')]['filename'];}return db[_0x9ab2('0x3a')]['find']({'where':{'id':_0x69221e[_0x9ab2('0x52')]['id']}})[_0x9ab2('0x1d')](handleEntityNotFound(_0x122dae,null))['then'](saveUpdates(_0x69221e[_0x9ab2('0x56')],null))['then'](respondWithResult(_0x122dae,null))[_0x9ab2('0x27')](handleError(_0x122dae,null));};var utilLicense=require('../../config/license/util');exports[_0x9ab2('0x5a')]=function(_0x38fcce,_0xeccaa6,_0x525adc){var _0x227a26='server/files/images/logos';var _0x3bc4c7={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x37135f){if(_0x37135f){_0x3bc4c7=_0x37135f;}return db[_0x9ab2('0x3a')]['find']({'where':{'id':_0x38fcce['params']['id']},'attributes':['logo','loginLogo','preferred','favicon','defaultLogo',_0x9ab2('0x5b'),_0x9ab2('0x5c'),'defaultFavicon'],'raw':!![]});})[_0x9ab2('0x1d')](handleEntityNotFound(_0xeccaa6,null))[_0x9ab2('0x1d')](function(_0x426312){if(_0x426312){var _0x1e91e1=_0x426312[_0x9ab2('0x5d')]&&fs['existsSync'](path[_0x9ab2('0x5e')](config[_0x9ab2('0x5f')],_0x227a26,_['toLower'](_0x426312[_0x9ab2('0x5d')])))?path[_0x9ab2('0x5e')](config[_0x9ab2('0x5f')],_0x227a26,_[_0x9ab2('0x60')](_0x426312[_0x9ab2('0x5d')])):path[_0x9ab2('0x5e')](config['root'],_0x227a26,_[_0x9ab2('0x60')](_0x9ab2('0x61')));var _0x41fca7=_0x9ab2('0x62')+_['upperFirst']('logo');if(_0x426312[_0x41fca7]||!_0x3bc4c7[_0x9ab2('0x63')]){_0x1e91e1=path[_0x9ab2('0x5e')](config['root'],_0x227a26,_[_0x9ab2('0x60')](_0x9ab2('0x61')));}if(!fs[_0x9ab2('0x64')](_0x1e91e1)){throw new db[(_0x9ab2('0x65'))][(_0x9ab2('0x66'))](_[_0x9ab2('0x67')]('logo')+_0x9ab2('0x68'));}return _0xeccaa6[_0x9ab2('0x69')](_0x1e91e1);}})[_0x9ab2('0x27')](handleError(_0xeccaa6,null));};var utilLicense=require('../../config/license/util');exports[_0x9ab2('0x6a')]=function(_0x54c06b,_0x15eb33,_0x449ff3){var _0x1592f7=_0x9ab2('0x6b');var _0x38cc76={'custom':![]};return utilLicense[_0x9ab2('0x6c')]()['then'](function(_0x3b1fe1){if(_0x3b1fe1){_0x38cc76=_0x3b1fe1;}return db['Setting'][_0x9ab2('0x55')]({'where':{'id':_0x54c06b[_0x9ab2('0x52')]['id']},'attributes':[_0x9ab2('0x5d'),_0x9ab2('0x59'),_0x9ab2('0x6d'),'favicon',_0x9ab2('0x6e'),_0x9ab2('0x5b'),_0x9ab2('0x5c'),_0x9ab2('0x6f')],'raw':!![]});})[_0x9ab2('0x1d')](handleEntityNotFound(_0x15eb33,null))[_0x9ab2('0x1d')](function(_0x85d83b){if(_0x85d83b){var _0x140b36=_0x85d83b['loginLogo']&&fs[_0x9ab2('0x64')](path['join'](config[_0x9ab2('0x5f')],_0x1592f7,_[_0x9ab2('0x60')](_0x85d83b[_0x9ab2('0x59')])))?path[_0x9ab2('0x5e')](config['root'],_0x1592f7,_[_0x9ab2('0x60')](_0x85d83b['loginLogo'])):path[_0x9ab2('0x5e')](config[_0x9ab2('0x5f')],_0x1592f7,_[_0x9ab2('0x60')](_0x9ab2('0x70')));var _0x4d7976='default'+_[_0x9ab2('0x67')](_0x9ab2('0x59'));if(_0x85d83b[_0x4d7976]||!_0x38cc76[_0x9ab2('0x63')]){_0x140b36=path[_0x9ab2('0x5e')](config[_0x9ab2('0x5f')],_0x1592f7,_[_0x9ab2('0x60')](_0x9ab2('0x70')));}if(!fs['existsSync'](_0x140b36)){throw new db[(_0x9ab2('0x65'))][(_0x9ab2('0x66'))](_[_0x9ab2('0x67')]('loginLogo')+_0x9ab2('0x68'));}return _0x15eb33[_0x9ab2('0x69')](_0x140b36);}})['catch'](handleError(_0x15eb33,null));};exports['gdpr']=function(_0x501abb,_0x573ccf){return db[_0x9ab2('0x3a')][_0x9ab2('0x55')]({'where':{'id':_0x501abb[_0x9ab2('0x52')]['id']},'attributes':['securePassword']})[_0x9ab2('0x1d')](respondWithResult(_0x573ccf,null))[_0x9ab2('0x27')](handleError(_0x573ccf,null));};exports[_0x9ab2('0x71')]=function(_0x3ab231,_0x59c514,_0x46e77b){if(_0x3ab231[_0x9ab2('0x57')]&&_0x3ab231[_0x9ab2('0x57')]['filename']){_0x3ab231[_0x9ab2('0x56')]['preferred']=_0x3ab231[_0x9ab2('0x57')][_0x9ab2('0x58')];}return db[_0x9ab2('0x3a')][_0x9ab2('0x55')]({'where':{'id':_0x3ab231[_0x9ab2('0x52')]['id']}})['then'](handleEntityNotFound(_0x59c514,null))[_0x9ab2('0x1d')](saveUpdates(_0x3ab231[_0x9ab2('0x56')],null))[_0x9ab2('0x1d')](respondWithResult(_0x59c514,null))[_0x9ab2('0x27')](handleError(_0x59c514,null));};var utilLicense=require('../../config/license/util');exports[_0x9ab2('0x72')]=function(_0x48473a,_0x13d617,_0x33b0b7){var _0x5e8bc0=_0x9ab2('0x6b');var _0x2566c2={'custom':![]};return utilLicense['getLicense']()[_0x9ab2('0x1d')](function(_0xae11e4){if(_0xae11e4){_0x2566c2=_0xae11e4;}return db[_0x9ab2('0x3a')]['find']({'where':{'id':_0x48473a[_0x9ab2('0x52')]['id']},'attributes':[_0x9ab2('0x5d'),_0x9ab2('0x59'),_0x9ab2('0x6d'),'favicon',_0x9ab2('0x6e'),_0x9ab2('0x5b'),_0x9ab2('0x5c'),_0x9ab2('0x6f')],'raw':!![]});})[_0x9ab2('0x1d')](handleEntityNotFound(_0x13d617,null))[_0x9ab2('0x1d')](function(_0x2a4a3f){if(_0x2a4a3f){var _0x49d71c=_0x2a4a3f[_0x9ab2('0x6d')]&&fs[_0x9ab2('0x64')](path[_0x9ab2('0x5e')](config[_0x9ab2('0x5f')],_0x5e8bc0,_[_0x9ab2('0x60')](_0x2a4a3f[_0x9ab2('0x6d')])))?path[_0x9ab2('0x5e')](config[_0x9ab2('0x5f')],_0x5e8bc0,_['toLower'](_0x2a4a3f[_0x9ab2('0x6d')])):path[_0x9ab2('0x5e')](config['root'],_0x5e8bc0,_[_0x9ab2('0x60')](_0x9ab2('0x73')));var _0x2599f4=_0x9ab2('0x62')+_[_0x9ab2('0x67')](_0x9ab2('0x6d'));if(_0x2a4a3f[_0x2599f4]||!_0x2566c2[_0x9ab2('0x63')]||!_0x2566c2['preferred']){_0x49d71c=path[_0x9ab2('0x5e')](config[_0x9ab2('0x5f')],_0x5e8bc0,_[_0x9ab2('0x60')](_0x9ab2('0x73')));}if(!fs[_0x9ab2('0x64')](_0x49d71c)){throw new db[(_0x9ab2('0x65'))]['ValidationError'](_[_0x9ab2('0x67')]('preferred')+_0x9ab2('0x68'));}return _0x13d617[_0x9ab2('0x69')](_0x49d71c);}})['catch'](handleError(_0x13d617,null));};exports['addFavicon']=function(_0x170cfd,_0x4ff2b1,_0x142fd7){if(_0x170cfd[_0x9ab2('0x57')]&&_0x170cfd[_0x9ab2('0x57')]['filename']){_0x170cfd['body']['favicon']=_0x170cfd[_0x9ab2('0x57')][_0x9ab2('0x58')];}return db[_0x9ab2('0x3a')][_0x9ab2('0x55')]({'where':{'id':_0x170cfd['params']['id']}})[_0x9ab2('0x1d')](handleEntityNotFound(_0x4ff2b1,null))[_0x9ab2('0x1d')](saveUpdates(_0x170cfd[_0x9ab2('0x56')],null))[_0x9ab2('0x1d')](respondWithResult(_0x4ff2b1,null))['catch'](handleError(_0x4ff2b1,null));};var utilLicense=require(_0x9ab2('0x74'));exports['getFavicon']=function(_0x1d87c7,_0x2519f1,_0x332c8f){var _0x5e7536='server/files/images/logos';var _0xa2fae1={'custom':![]};return utilLicense[_0x9ab2('0x6c')]()[_0x9ab2('0x1d')](function(_0x48d68b){if(_0x48d68b){_0xa2fae1=_0x48d68b;}return db[_0x9ab2('0x3a')][_0x9ab2('0x55')]({'where':{'id':_0x1d87c7[_0x9ab2('0x52')]['id']},'attributes':[_0x9ab2('0x5d'),'loginLogo',_0x9ab2('0x6d'),'favicon',_0x9ab2('0x6e'),'defaultLoginLogo','defaultPreferred',_0x9ab2('0x6f')],'raw':!![]});})[_0x9ab2('0x1d')](handleEntityNotFound(_0x2519f1,null))[_0x9ab2('0x1d')](function(_0x24aa1b){if(_0x24aa1b){var _0x2b14e1=_0x24aa1b['favicon']&&fs['existsSync'](path[_0x9ab2('0x5e')](config[_0x9ab2('0x5f')],_0x5e7536,_[_0x9ab2('0x60')](_0x24aa1b[_0x9ab2('0x75')])))?path[_0x9ab2('0x5e')](config[_0x9ab2('0x5f')],_0x5e7536,_[_0x9ab2('0x60')](_0x24aa1b[_0x9ab2('0x75')])):path[_0x9ab2('0x5e')](config[_0x9ab2('0x5f')],_0x5e7536,_[_0x9ab2('0x60')](_0x9ab2('0x76')));var _0x2bc1c8=_0x9ab2('0x62')+_[_0x9ab2('0x67')](_0x9ab2('0x75'));if(_0x24aa1b[_0x2bc1c8]||!_0xa2fae1[_0x9ab2('0x63')]){_0x2b14e1=path[_0x9ab2('0x5e')](config[_0x9ab2('0x5f')],_0x5e7536,_[_0x9ab2('0x60')](_0x9ab2('0x76')));}if(!fs[_0x9ab2('0x64')](_0x2b14e1)){throw new db[(_0x9ab2('0x65'))][(_0x9ab2('0x66'))](_['upperFirst'](_0x9ab2('0x75'))+_0x9ab2('0x68'));}return _0x2519f1[_0x9ab2('0x69')](_0x2b14e1);}})[_0x9ab2('0x27')](handleError(_0x2519f1,null));};exports[_0x9ab2('0x77')]=function(_0x3f0a0c,_0x6d88ab){var _0x3831b6={'offset':moment()[_0x9ab2('0x78')]()};_0x3831b6[_0x9ab2('0x79')]=moment()[_0x9ab2('0x78')](_0x3831b6[_0x9ab2('0x2d')])[_0x9ab2('0x7a')](_0x9ab2('0x7b'));return _0x6d88ab[_0x9ab2('0x29')](0xc8)[_0x9ab2('0x38')](_0x3831b6);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 70e1271..5f3c04d 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 _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x2e2645,_0x3be489){var _0xf7e2f8=function(_0xae8590){while(--_0xae8590){_0x2e2645['push'](_0x2e2645['shift']());}};_0xf7e2f8(++_0x3be489);}(_0x34e8,0x12c));var _0x834e=function(_0x203c2f,_0x728945){_0x203c2f=_0x203c2f-0x0;var _0x46ab2a=_0x34e8[_0x203c2f];return _0x46ab2a;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Setting','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./setting.attributes'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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':'settings','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 9337e6b..e004de5 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 _0xf794=['info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSetting','find','raw','options','where','attributes','map','include','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xf794,0x168));var _0x4f79=function(_0x568c10,_0x3117f3){_0x568c10=_0x568c10-0x0;var _0xd3b6f0=_0xf794[_0x568c10];return _0xd3b6f0;};'use strict';var _=require(_0x4f79('0x0'));var util=require(_0x4f79('0x1'));var moment=require(_0x4f79('0x2'));var BPromise=require(_0x4f79('0x3'));var rs=require(_0x4f79('0x4'));var fs=require('fs');var Redis=require(_0x4f79('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f79('0x6'));var logger=require('../../config/logger')(_0x4f79('0x7'));var config=require(_0x4f79('0x8'));var jayson=require(_0x4f79('0x9'));var client=jayson['client'][_0x4f79('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23e4b4,_0x225ec2,_0x5b7a55){return new BPromise(function(_0x27dcb8,_0x23b7fd){return client['request'](_0x23e4b4,_0x5b7a55)[_0x4f79('0xb')](function(_0x128174){logger[_0x4f79('0xc')](_0x4f79('0xd'),_0x225ec2,_0x4f79('0xe'));logger[_0x4f79('0xf')]('Setting,\x20%s,\x20%s,\x20%s',_0x225ec2,_0x4f79('0xe'),JSON[_0x4f79('0x10')](_0x128174));if(_0x128174[_0x4f79('0x11')]){if(_0x128174[_0x4f79('0x11')][_0x4f79('0x12')]===0x1f4){logger[_0x4f79('0x11')](_0x4f79('0xd'),_0x225ec2,_0x128174[_0x4f79('0x11')][_0x4f79('0x13')]);return _0x23b7fd(_0x128174[_0x4f79('0x11')]['message']);}logger[_0x4f79('0x11')](_0x4f79('0xd'),_0x225ec2,_0x128174[_0x4f79('0x11')][_0x4f79('0x13')]);return _0x27dcb8(_0x128174[_0x4f79('0x11')][_0x4f79('0x13')]);}else{logger[_0x4f79('0xc')](_0x4f79('0xd'),_0x225ec2,_0x4f79('0xe'));_0x27dcb8(_0x128174[_0x4f79('0x14')][_0x4f79('0x13')]);}})[_0x4f79('0x15')](function(_0x19def9){logger[_0x4f79('0x11')](_0x4f79('0xd'),_0x225ec2,_0x19def9);_0x23b7fd(_0x19def9);});});}exports[_0x4f79('0x16')]=function(_0x1970f1){var _0x3b988f=this;return new Promise(function(_0x4dc7d7,_0x591d74){return db['Setting'][_0x4f79('0x17')]({'raw':_0x1970f1['options']?_0x1970f1['options'][_0x4f79('0x18')]===undefined?!![]:![]:!![],'where':_0x1970f1[_0x4f79('0x19')]?_0x1970f1[_0x4f79('0x19')][_0x4f79('0x1a')]||null:null,'attributes':_0x1970f1[_0x4f79('0x19')]?_0x1970f1[_0x4f79('0x19')][_0x4f79('0x1b')]||null:null,'include':_0x1970f1[_0x4f79('0x19')]?_0x1970f1['options']['include']?_[_0x4f79('0x1c')](_0x1970f1[_0x4f79('0x19')][_0x4f79('0x1d')],function(_0xba4d31){return{'model':db[_0xba4d31[_0x4f79('0x1e')]],'as':_0xba4d31['as'],'attributes':_0xba4d31[_0x4f79('0x1b')],'include':_0xba4d31['include']?_['map'](_0xba4d31[_0x4f79('0x1d')],function(_0x566a15){return{'model':db[_0x566a15[_0x4f79('0x1e')]],'as':_0x566a15['as'],'attributes':_0x566a15['attributes'],'include':_0x566a15[_0x4f79('0x1d')]?_[_0x4f79('0x1c')](_0x566a15[_0x4f79('0x1d')],function(_0x9a8721){return{'model':db[_0x9a8721[_0x4f79('0x1e')]],'as':_0x9a8721['as'],'attributes':_0x9a8721[_0x4f79('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f79('0xb')](function(_0x31862a){logger[_0x4f79('0xc')](_0x4f79('0x16'),_0x1970f1);logger[_0x4f79('0xf')]('ShowSetting',_0x1970f1,JSON['stringify'](_0x31862a));_0x4dc7d7(_0x31862a);})['catch'](function(_0x38a5a8){logger[_0x4f79('0x11')](_0x4f79('0x16'),_0x38a5a8[_0x4f79('0x13')],_0x1970f1);_0x591d74(_0x3b988f[_0x4f79('0x11')](0x1f4,_0x38a5a8[_0x4f79('0x13')]));});});}; \ No newline at end of file +var _0xfb53=['attributes','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','ShowSetting','find','options','raw','include','map','model'];(function(_0x19d5d2,_0x54d565){var _0x300cbd=function(_0x33b496){while(--_0x33b496){_0x19d5d2['push'](_0x19d5d2['shift']());}};_0x300cbd(++_0x54d565);}(_0xfb53,0xb0));var _0x3fb5=function(_0x16a496,_0x2380e2){_0x16a496=_0x16a496-0x0;var _0x5d2c35=_0xfb53[_0x16a496];return _0x5d2c35;};'use strict';var _=require(_0x3fb5('0x0'));var util=require(_0x3fb5('0x1'));var moment=require(_0x3fb5('0x2'));var BPromise=require(_0x3fb5('0x3'));var rs=require(_0x3fb5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3fb5('0x5'))['db'];var utils=require(_0x3fb5('0x6'));var logger=require('../../config/logger')(_0x3fb5('0x7'));var config=require(_0x3fb5('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51be5b,_0xc7fd76,_0x657c2){return new BPromise(function(_0x3a5c05,_0x47c7e2){return client['request'](_0x51be5b,_0x657c2)[_0x3fb5('0x9')](function(_0x1563c1){logger[_0x3fb5('0xa')]('Setting,\x20%s,\x20%s',_0xc7fd76,_0x3fb5('0xb'));logger[_0x3fb5('0xc')](_0x3fb5('0xd'),_0xc7fd76,_0x3fb5('0xb'),JSON[_0x3fb5('0xe')](_0x1563c1));if(_0x1563c1[_0x3fb5('0xf')]){if(_0x1563c1[_0x3fb5('0xf')][_0x3fb5('0x10')]===0x1f4){logger['error'](_0x3fb5('0x11'),_0xc7fd76,_0x1563c1['error'][_0x3fb5('0x12')]);return _0x47c7e2(_0x1563c1['error']['message']);}logger[_0x3fb5('0xf')](_0x3fb5('0x11'),_0xc7fd76,_0x1563c1[_0x3fb5('0xf')][_0x3fb5('0x12')]);return _0x3a5c05(_0x1563c1[_0x3fb5('0xf')][_0x3fb5('0x12')]);}else{logger[_0x3fb5('0xa')](_0x3fb5('0x11'),_0xc7fd76,'request\x20sent');_0x3a5c05(_0x1563c1[_0x3fb5('0x13')][_0x3fb5('0x12')]);}})['catch'](function(_0x32ce3e){logger[_0x3fb5('0xf')](_0x3fb5('0x11'),_0xc7fd76,_0x32ce3e);_0x47c7e2(_0x32ce3e);});});}exports[_0x3fb5('0x14')]=function(_0x1ef3b9){var _0x44f5e4=this;return new Promise(function(_0x1c24d7,_0x336c3d){return db['Setting'][_0x3fb5('0x15')]({'raw':_0x1ef3b9[_0x3fb5('0x16')]?_0x1ef3b9[_0x3fb5('0x16')][_0x3fb5('0x17')]===undefined?!![]:![]:!![],'where':_0x1ef3b9['options']?_0x1ef3b9['options']['where']||null:null,'attributes':_0x1ef3b9[_0x3fb5('0x16')]?_0x1ef3b9['options']['attributes']||null:null,'include':_0x1ef3b9['options']?_0x1ef3b9[_0x3fb5('0x16')][_0x3fb5('0x18')]?_[_0x3fb5('0x19')](_0x1ef3b9[_0x3fb5('0x16')][_0x3fb5('0x18')],function(_0x40b1bc){return{'model':db[_0x40b1bc[_0x3fb5('0x1a')]],'as':_0x40b1bc['as'],'attributes':_0x40b1bc['attributes'],'include':_0x40b1bc[_0x3fb5('0x18')]?_[_0x3fb5('0x19')](_0x40b1bc[_0x3fb5('0x18')],function(_0x593b35){return{'model':db[_0x593b35[_0x3fb5('0x1a')]],'as':_0x593b35['as'],'attributes':_0x593b35[_0x3fb5('0x1b')],'include':_0x593b35[_0x3fb5('0x18')]?_[_0x3fb5('0x19')](_0x593b35['include'],function(_0x134129){return{'model':db[_0x134129[_0x3fb5('0x1a')]],'as':_0x134129['as'],'attributes':_0x134129[_0x3fb5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3fb5('0x9')](function(_0x419b1f){logger[_0x3fb5('0xa')]('ShowSetting',_0x1ef3b9);logger[_0x3fb5('0xc')]('ShowSetting',_0x1ef3b9,JSON['stringify'](_0x419b1f));_0x1c24d7(_0x419b1f);})[_0x3fb5('0x1c')](function(_0x5c45a0){logger[_0x3fb5('0xf')](_0x3fb5('0x14'),_0x5c45a0[_0x3fb5('0x12')],_0x1ef3b9);_0x336c3d(_0x44f5e4['error'](0x1f4,_0x5c45a0[_0x3fb5('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 14c00bf..499ce00 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 _0x53ec=['send','status','update','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./smsAccount.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/status','statusGet','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send'];(function(_0x56e9be,_0x5f4d30){var _0x40e2ab=function(_0x23162e){while(--_0x23162e){_0x56e9be['push'](_0x56e9be['shift']());}};_0x40e2ab(++_0x5f4d30);}(_0x53ec,0x192));var _0xc53e=function(_0x5c4c71,_0x3445f8){_0x5c4c71=_0x5c4c71-0x0;var _0x167d6b=_0x53ec[_0x5c4c71];return _0x167d6b;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xa')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router['get']('/:id/canned_answers',auth[_0xc53e('0x9')](),controller['getAnswers']);router['get'](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x12')]);router[_0xc53e('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xc53e('0x13')]);router[_0xc53e('0xa')](_0xc53e('0x14'),controller[_0xc53e('0x15')]);router[_0xc53e('0xa')](_0xc53e('0x16'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x17')]);router[_0xc53e('0x18')]('/',auth[_0xc53e('0x9')](),controller['create']);router[_0xc53e('0x18')](_0xc53e('0xf'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x19')]);router[_0xc53e('0x18')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1b')]);router[_0xc53e('0x18')]('/:id/notify',controller['notify']);router[_0xc53e('0x18')](_0xc53e('0x11'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1c')]);router[_0xc53e('0x18')](_0xc53e('0x1d'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x1e')]);router[_0xc53e('0x18')](_0xc53e('0x14'),controller[_0xc53e('0x1f')]);router[_0xc53e('0x18')](_0xc53e('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0x20')]);router[_0xc53e('0x21')](_0xc53e('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0xc53e('0x21')]('/:id/dispositions',auth[_0xc53e('0x9')](),controller[_0xc53e('0x22')]);router[_0xc53e('0x21')](_0xc53e('0x1a'),auth[_0xc53e('0x9')](),controller['removeAnswers']);router[_0xc53e('0x21')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xc53e('0x23')]=router; \ No newline at end of file +var _0x8ef6=['addApplications','/:id/send','send','status','update','delete','destroy','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/status','statusGet','/:id/users','getAgents','create','post','addDisposition','addAnswer','notify'];(function(_0x7ba05c,_0x3abdf6){var _0x3920ae=function(_0x562189){while(--_0x562189){_0x7ba05c['push'](_0x7ba05c['shift']());}};_0x3920ae(++_0x3abdf6);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1cde35,_0x5276ec){_0x1cde35=_0x1cde35-0x0;var _0x3f2db5=_0x8ef6[_0x1cde35];return _0x3f2db5;};'use strict';var multer=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var path=require(_0x68ef('0x2'));var timeout=require(_0x68ef('0x3'));var express=require(_0x68ef('0x4'));var router=express[_0x68ef('0x5')]();var fs_extra=require(_0x68ef('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var controller=require(_0x68ef('0x9'));router[_0x68ef('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x68ef('0xa')](_0x68ef('0xb'),auth[_0x68ef('0xc')](),controller['describe']);router[_0x68ef('0xa')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0xe')]);router[_0x68ef('0xa')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x10')]);router[_0x68ef('0xa')](_0x68ef('0x11'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x12')]);router['get'](_0x68ef('0x13'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x14')]);router[_0x68ef('0xa')](_0x68ef('0x15'),auth[_0x68ef('0xc')](),controller['getInteractions']);router[_0x68ef('0xa')](_0x68ef('0x16'),controller[_0x68ef('0x17')]);router['get'](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x19')]);router['post']('/',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1a')]);router[_0x68ef('0x1b')](_0x68ef('0xf'),auth['isAuthenticated'](),controller[_0x68ef('0x1c')]);router['post']('/:id/canned_answers',auth[_0x68ef('0xc')](),controller[_0x68ef('0x1d')]);router['post']('/:id/notify',controller[_0x68ef('0x1e')]);router[_0x68ef('0x1b')](_0x68ef('0x13'),auth['isAuthenticated'](),controller[_0x68ef('0x1f')]);router[_0x68ef('0x1b')](_0x68ef('0x20'),auth['isAuthenticated'](),controller[_0x68ef('0x21')]);router[_0x68ef('0x1b')]('/:id/status',controller[_0x68ef('0x22')]);router[_0x68ef('0x1b')](_0x68ef('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x23')]);router[_0x68ef('0x24')](_0x68ef('0xd'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x25')]);router[_0x68ef('0x24')](_0x68ef('0xf'),auth[_0x68ef('0xc')](),controller['removeDispositions']);router[_0x68ef('0x24')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router[_0x68ef('0x24')](_0x68ef('0x18'),auth[_0x68ef('0xc')](),controller[_0x68ef('0x26')]);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 1466b8f..84baba4 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 _0xcf5e=['STRING','name','generate','twilio','clickatell','infobip','intelepeer','ENUM','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','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xcf5e,0xa8));var _0xecf5=function(_0x3534e8,_0x49ce64){_0x3534e8=_0x3534e8-0x0;var _0x22cc31=_0xcf5e[_0x3534e8];return _0x22cc31;};'use strict';var Sequelize=require(_0xecf5('0x0'));var rs=require(_0xecf5('0x1'));module[_0xecf5('0x2')]={'name':{'type':Sequelize[_0xecf5('0x3')],'unique':_0xecf5('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xecf5('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xecf5('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xecf5('0x3')],'defaultValue':function(){return rs[_0xecf5('0x5')]();}},'phone':{'type':Sequelize[_0xecf5('0x3')]},'type':{'type':Sequelize['ENUM'](_0xecf5('0x6'),'skebby','connectel','clicksend','plivo',_0xecf5('0x7'),'bandwidth','csc',_0xecf5('0x8'),_0xecf5('0x9'))},'accountSid':{'type':Sequelize[_0xecf5('0x3')]},'authId':{'type':Sequelize[_0xecf5('0x3')]},'authToken':{'type':Sequelize[_0xecf5('0x3')]},'smsMethod':{'type':Sequelize[_0xecf5('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0xecf5('0x3')]},'password':{'type':Sequelize[_0xecf5('0x3')]},'apiKey':{'type':Sequelize[_0xecf5('0x3')]},'applicationId':{'type':Sequelize[_0xecf5('0x3')]},'accountId':{'type':Sequelize[_0xecf5('0x3')]},'senderString':{'type':Sequelize[_0xecf5('0x3')]},'deliveryReport':{'type':Sequelize[_0xecf5('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0xecf5('0x3')]},'notificationTemplate':{'type':Sequelize[_0xecf5('0xc')],'defaultValue':function(){return _0xecf5('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xecf5('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xecf5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xecf5('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xecf5('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xecf5('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xecf5('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xecf5('0xe')],'comment':_0xecf5('0xf')},'mandatoryDisposition':{'type':Sequelize[_0xecf5('0xb')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x21025b){if(!_0x21025b)this[_0xecf5('0x10')](_0xecf5('0x11'),null);this[_0xecf5('0x10')](_0xecf5('0x12'),_0x21025b);}}}; \ No newline at end of file +var _0x64ba=['generate','clicksend','csc','infobip','ENUM','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','mandatoryDisposition','sequelize','randomstring','STRING'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x64ba,0xb1));var _0xa64b=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x64ba[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0xa64b('0x0'));var rs=require(_0xa64b('0x1'));module['exports']={'name':{'type':Sequelize[_0xa64b('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xa64b('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xa64b('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xa64b('0x2')],'defaultValue':function(){return rs[_0xa64b('0x3')]();}},'phone':{'type':Sequelize[_0xa64b('0x2')]},'type':{'type':Sequelize['ENUM']('twilio','skebby','connectel',_0xa64b('0x4'),'plivo','clickatell','bandwidth',_0xa64b('0x5'),_0xa64b('0x6'),'intelepeer')},'accountSid':{'type':Sequelize[_0xa64b('0x2')]},'authId':{'type':Sequelize[_0xa64b('0x2')]},'authToken':{'type':Sequelize[_0xa64b('0x2')]},'smsMethod':{'type':Sequelize[_0xa64b('0x7')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa64b('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xa64b('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xa64b('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xa64b('0x2')]},'notificationTemplate':{'type':Sequelize[_0xa64b('0x8')],'defaultValue':function(){return _0xa64b('0x9');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa64b('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa64b('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa64b('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa64b('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa64b('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa64b('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa64b('0xb')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa64b('0xa')],'defaultValue':![],'comment':_0xa64b('0xc'),'set':function(_0x4697dc){if(!_0x4697dc)this[_0xa64b('0xd')]('mandatoryDispositionPauseId',null);this[_0xa64b('0xd')](_0xa64b('0xe'),_0x4697dc);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 99f21ed..26336fe 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 _0x51d6=['map','SmsAccount','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','SmsAccountId','CannedAnswer','getAnswers','removeAnswers','notify','SmsApplication','Applications','orderBy','priority','asc','account','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','CmContact','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','agent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','\x0a','addApplications','transaction','bulkCreate','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','message_id','status_code','infobip','groupName','DELIVERED','bandwidth','redif','inspect','error_code','RECEIVED_BY_RECIPIENT','DELIVRD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','mustache','util','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','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','code','error','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51d6,0x189));var _0x651d=function(_0x445a25,_0x2324d8){_0x445a25=_0x445a25-0x0;var _0x2c72ac=_0x51d6[_0x445a25];return _0x2c72ac;};'use strict';var emlformat=require(_0x651d('0x0'));var rimraf=require(_0x651d('0x1'));var zipdir=require(_0x651d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x651d('0x3'));var util=require(_0x651d('0x4'));var path=require('path');var sox=require(_0x651d('0x5'));var csv=require(_0x651d('0x6'));var ejs=require(_0x651d('0x7'));var fs=require('fs');var fs_extra=require(_0x651d('0x8'));var _=require(_0x651d('0x9'));var squel=require(_0x651d('0xa'));var crypto=require(_0x651d('0xb'));var jsforce=require(_0x651d('0xc'));var deskjs=require(_0x651d('0xd'));var toCsv=require(_0x651d('0x6'));var querystring=require(_0x651d('0xe'));var Papa=require(_0x651d('0xf'));var Redis=require(_0x651d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x651d('0x11'));var as=require(_0x651d('0x12'));var hardwareService=require(_0x651d('0x13'));var logger=require(_0x651d('0x14'))(_0x651d('0x15'));var utils=require(_0x651d('0x16'));var config=require(_0x651d('0x17'));var licenseUtil=require(_0x651d('0x18'));var db=require(_0x651d('0x19'))['db'];config[_0x651d('0x1a')]=_[_0x651d('0x1b')](config[_0x651d('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x651d('0x1c'))(new Redis(config[_0x651d('0x1a')]));require(_0x651d('0x1d'))[_0x651d('0x1e')](socket);var jayson=require(_0x651d('0x1f'));var client=jayson[_0x651d('0x20')][_0x651d('0x21')]({'port':0x232c});function respondWithRpcPromise(_0x5d0ee1,_0x5b39c4,_0x3ad9d4,_0x1c293b){return new BPromise(function(_0x523b90,_0x40583f){var _0x35bb84=_0x1c293b||client;return _0x35bb84[_0x651d('0x22')](_0x5d0ee1,_0x3ad9d4)['then'](function(_0x3916ed){logger[_0x651d('0x23')]('SmsAccount,\x20%s,\x20%s',_0x5b39c4,'request\x20sent');logger[_0x651d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x5b39c4,_0x651d('0x25'),JSON[_0x651d('0x26')](_0x3916ed));if(_0x3916ed['error']){if(_0x3916ed['error'][_0x651d('0x27')]===0x1f4){logger[_0x651d('0x28')](_0x651d('0x29'),_0x5b39c4,_0x3916ed[_0x651d('0x28')]['message']);return _0x40583f(_0x3916ed['error'][_0x651d('0x2a')]);}logger[_0x651d('0x28')](_0x651d('0x29'),_0x5b39c4,_0x3916ed[_0x651d('0x28')][_0x651d('0x2a')]);return _0x523b90(_0x3916ed[_0x651d('0x28')][_0x651d('0x2a')]);}else{logger[_0x651d('0x23')](_0x651d('0x29'),_0x5b39c4,_0x651d('0x25'));_0x523b90(_0x3916ed[_0x651d('0x2b')][_0x651d('0x2a')]);}})[_0x651d('0x2c')](function(_0x15cb9f){logger[_0x651d('0x28')](_0x651d('0x29'),_0x5b39c4,_0x15cb9f);_0x40583f(_0x15cb9f);});});}function respondWithStatusCode(_0x269e2c,_0x904b1d){_0x904b1d=_0x904b1d||0xcc;return function(_0xe69777){if(_0xe69777){return _0x269e2c[_0x651d('0x2d')](_0x904b1d);}return _0x269e2c[_0x651d('0x2e')](_0x904b1d)[_0x651d('0x2f')]();};}function respondWithResult(_0x1af322,_0x5d4560){_0x5d4560=_0x5d4560||0xc8;return function(_0x59f380){if(_0x59f380){return _0x1af322[_0x651d('0x2e')](_0x5d4560)[_0x651d('0x30')](_0x59f380);}};}function respondWithFilteredResult(_0x3dde82,_0x3be984){return function(_0x342465){if(_0x342465){var _0x1717af=typeof _0x3be984[_0x651d('0x31')]===_0x651d('0x32')&&typeof _0x3be984[_0x651d('0x33')]==='undefined';var _0x2655f6=_0x342465[_0x651d('0x34')];var _0x4694c1=_0x1717af?0x0:_0x3be984['offset'];var _0x4cbd19=_0x1717af?_0x342465[_0x651d('0x34')]:_0x3be984[_0x651d('0x31')]+_0x3be984[_0x651d('0x33')];var _0x47c2a8;if(_0x4cbd19>=_0x2655f6){_0x4cbd19=_0x2655f6;_0x47c2a8=0xc8;}else{_0x47c2a8=0xce;}_0x3dde82['status'](_0x47c2a8);return _0x3dde82[_0x651d('0x35')]('Content-Range',_0x4694c1+'-'+_0x4cbd19+'/'+_0x2655f6)[_0x651d('0x30')](_0x342465);}return null;};}function patchUpdates(_0x53192e){return function(_0x2141e6){try{jsonpatch[_0x651d('0x36')](_0x2141e6,_0x53192e,!![]);}catch(_0x2da0be){return BPromise[_0x651d('0x37')](_0x2da0be);}return _0x2141e6[_0x651d('0x38')]();};}function saveUpdates(_0xcf39aa,_0x3584b4){return function(_0x1f2f2f){if(_0x1f2f2f){return _0x1f2f2f['update'](_0xcf39aa)['then'](function(_0x51bcb4){return _0x51bcb4;});}return null;};}function removeEntity(_0x315999,_0x1c81e9){return function(_0x22e423){if(_0x22e423){return _0x22e423[_0x651d('0x39')]()[_0x651d('0x3a')](function(){var _0x336672=_0x22e423['get']({'plain':!![]});var _0x3084f8=_0x651d('0x3b');return db[_0x651d('0x3c')][_0x651d('0x39')]({'where':{'type':_0x3084f8,'resourceId':_0x336672['id']}})[_0x651d('0x3a')](function(){return _0x22e423;});})['then'](function(){_0x315999['status'](0xcc)[_0x651d('0x2f')]();});}};}function handleEntityNotFound(_0x2605b9,_0x3ff5c5){return function(_0x36255c){if(!_0x36255c){_0x2605b9[_0x651d('0x2d')](0x194);}return _0x36255c;};}function handleError(_0x4cbbee,_0x4b3141){_0x4b3141=_0x4b3141||0x1f4;return function(_0x2f24c7){logger['error'](_0x2f24c7[_0x651d('0x3d')]);if(_0x2f24c7[_0x651d('0x3e')]){delete _0x2f24c7['name'];}_0x4cbbee[_0x651d('0x2e')](_0x4b3141)[_0x651d('0x3f')](_0x2f24c7);};}exports[_0x651d('0x40')]=function(_0xfc7626,_0x216ded){var _0x4aeb0e={'include':[{'model':db[_0x651d('0x41')],'as':_0x651d('0x42')}]},_0x5956c6={},_0x5ea498={'count':0x0,'rows':[]};var _0x41eb8d=_[_0x651d('0x43')](db[_0x651d('0x44')]['rawAttributes'],function(_0x36ea80){return{'name':_0x36ea80[_0x651d('0x45')],'type':_0x36ea80['type'][_0x651d('0x46')]};});_0x5956c6[_0x651d('0x47')]=_[_0x651d('0x43')](_0x41eb8d,'name');_0x5956c6['query']=_[_0x651d('0x48')](_0xfc7626[_0x651d('0x49')]);_0x5956c6[_0x651d('0x4a')]=_[_0x651d('0x4b')](_0x5956c6[_0x651d('0x47')],_0x5956c6[_0x651d('0x49')]);_0x4aeb0e[_0x651d('0x4c')]=_[_0x651d('0x4b')](_0x5956c6['model'],qs[_0x651d('0x4d')](_0xfc7626[_0x651d('0x49')][_0x651d('0x4d')]));_0x4aeb0e[_0x651d('0x4c')]=_0x4aeb0e[_0x651d('0x4c')][_0x651d('0x4e')]?_0x4aeb0e['attributes']:_0x5956c6[_0x651d('0x47')];if(!_0xfc7626[_0x651d('0x49')][_0x651d('0x4f')]('nolimit')){_0x4aeb0e[_0x651d('0x33')]=qs[_0x651d('0x33')](_0xfc7626[_0x651d('0x49')][_0x651d('0x33')]);_0x4aeb0e[_0x651d('0x31')]=qs['offset'](_0xfc7626[_0x651d('0x49')]['offset']);}_0x4aeb0e[_0x651d('0x50')]=qs['sort'](_0xfc7626[_0x651d('0x49')][_0x651d('0x51')]);_0x4aeb0e[_0x651d('0x52')]=qs['filters'](_[_0x651d('0x53')](_0xfc7626['query'],_0x5956c6[_0x651d('0x4a')]),_0x41eb8d);if(_0xfc7626[_0x651d('0x49')][_0x651d('0x54')]){_0x4aeb0e[_0x651d('0x52')]=_['merge'](_0x4aeb0e[_0x651d('0x52')],{'$or':_[_0x651d('0x43')](_0x41eb8d,function(_0x548b68){if(_0x548b68[_0x651d('0x55')]!=='VIRTUAL'){var _0x2a783={};_0x2a783[_0x548b68[_0x651d('0x3e')]]={'$like':'%'+_0xfc7626[_0x651d('0x49')][_0x651d('0x54')]+'%'};return _0x2a783;}})});}_0x4aeb0e=_[_0x651d('0x56')]({},_0x4aeb0e,_0xfc7626[_0x651d('0x57')]);var _0x253968={'where':_0x4aeb0e[_0x651d('0x52')]};return db[_0x651d('0x44')][_0x651d('0x34')](_0x253968)['then'](function(_0x3b846d){_0x5ea498[_0x651d('0x34')]=_0x3b846d;if(_0xfc7626[_0x651d('0x49')][_0x651d('0x58')]){_0x4aeb0e[_0x651d('0x59')]=[{'all':!![]}];}return db[_0x651d('0x44')][_0x651d('0x5a')](_0x4aeb0e);})['then'](function(_0x52ee2f){_0x5ea498[_0x651d('0x5b')]=_0x52ee2f;return _0x5ea498;})[_0x651d('0x3a')](respondWithFilteredResult(_0x216ded,_0x4aeb0e))['catch'](handleError(_0x216ded,null));};exports[_0x651d('0x5c')]=function(_0x3afd57,_0x43d623){var _0x40c259={'raw':![],'where':{'id':_0x3afd57[_0x651d('0x5d')]['id']},'include':[{'model':db[_0x651d('0x41')],'as':_0x651d('0x42')}]},_0x368675={};_0x368675[_0x651d('0x47')]=_['keys'](db['SmsAccount'][_0x651d('0x5e')]);_0x368675[_0x651d('0x49')]=_[_0x651d('0x48')](_0x3afd57[_0x651d('0x49')]);_0x368675[_0x651d('0x4a')]=_['intersection'](_0x368675[_0x651d('0x47')],_0x368675['query']);_0x40c259[_0x651d('0x4c')]=_[_0x651d('0x4b')](_0x368675['model'],qs[_0x651d('0x4d')](_0x3afd57[_0x651d('0x49')][_0x651d('0x4d')]));_0x40c259[_0x651d('0x4c')]=_0x40c259[_0x651d('0x4c')]['length']?_0x40c259[_0x651d('0x4c')]:_0x368675[_0x651d('0x47')];if(_0x3afd57['query'][_0x651d('0x58')]){_0x40c259[_0x651d('0x59')]=[{'all':!![]}];}_0x40c259=_[_0x651d('0x56')]({},_0x40c259,_0x3afd57[_0x651d('0x57')]);return db[_0x651d('0x44')][_0x651d('0x5f')](_0x40c259)[_0x651d('0x3a')](handleEntityNotFound(_0x43d623,null))[_0x651d('0x3a')](respondWithResult(_0x43d623,null))[_0x651d('0x2c')](handleError(_0x43d623,null));};exports[_0x651d('0x60')]=function(_0x48f1b7,_0x3a19e0){return db[_0x651d('0x44')]['create'](_0x48f1b7['body'],{})[_0x651d('0x3a')](function(_0x4470bb){var _0x51fc53=_0x48f1b7[_0x651d('0x61')]['get']({'plain':!![]});if(!_0x51fc53)throw new Error(_0x651d('0x62'));if(_0x51fc53[_0x651d('0x63')]===_0x651d('0x61')){var _0x4b5be8=_0x4470bb[_0x651d('0x64')]({'plain':!![]});var _0x2f4eeb=_0x651d('0x3b');return db[_0x651d('0x65')]['find']({'where':{'name':_0x2f4eeb,'userProfileId':_0x51fc53[_0x651d('0x66')]},'raw':!![]})[_0x651d('0x3a')](function(_0x42be9e){if(_0x42be9e&&_0x42be9e[_0x651d('0x67')]===0x0){return db['UserProfileResource'][_0x651d('0x60')]({'name':_0x4b5be8['name'],'resourceId':_0x4b5be8['id'],'type':_0x42be9e[_0x651d('0x3e')],'sectionId':_0x42be9e['id']},{})['then'](function(){return _0x4470bb;});}else{return _0x4470bb;}})[_0x651d('0x2c')](function(_0x133877){logger[_0x651d('0x28')](_0x651d('0x68'),_0x133877);throw _0x133877;});}return _0x4470bb;})[_0x651d('0x3a')](respondWithResult(_0x3a19e0,0xc9))[_0x651d('0x2c')](handleError(_0x3a19e0,null));};exports[_0x651d('0x69')]=function(_0x46e18d,_0x9e9624){if(_0x46e18d[_0x651d('0x6a')]['id']){delete _0x46e18d[_0x651d('0x6a')]['id'];}return db[_0x651d('0x44')][_0x651d('0x5f')]({'where':{'id':_0x46e18d[_0x651d('0x5d')]['id']},'include':[{'model':db[_0x651d('0x41')],'as':_0x651d('0x42')}]})[_0x651d('0x3a')](handleEntityNotFound(_0x9e9624,null))[_0x651d('0x3a')](saveUpdates(_0x46e18d['body'],null))[_0x651d('0x3a')](respondWithResult(_0x9e9624,null))[_0x651d('0x2c')](handleError(_0x9e9624,null));};exports[_0x651d('0x39')]=function(_0x3c40e5,_0x340d51){return db[_0x651d('0x44')][_0x651d('0x5f')]({'where':{'id':_0x3c40e5[_0x651d('0x5d')]['id']}})[_0x651d('0x3a')](handleEntityNotFound(_0x340d51,null))[_0x651d('0x3a')](removeEntity(_0x340d51,null))[_0x651d('0x2c')](handleError(_0x340d51,null));};exports[_0x651d('0x6b')]=function(_0x1f9286,_0x27ac3a){return db[_0x651d('0x44')][_0x651d('0x6b')]()[_0x651d('0x3a')](respondWithResult(_0x27ac3a,null))[_0x651d('0x2c')](handleError(_0x27ac3a,null));};exports[_0x651d('0x6c')]=function(_0x491ce1,_0x5dd298,_0x1412c1){if(_0x491ce1[_0x651d('0x6a')]['id']){delete _0x491ce1[_0x651d('0x6a')]['id'];}return db[_0x651d('0x44')][_0x651d('0x5f')]({'where':{'id':_0x491ce1[_0x651d('0x5d')]['id']}})[_0x651d('0x3a')](handleEntityNotFound(_0x5dd298,null))['then'](function(_0x1e6169){if(_0x1e6169){_0x491ce1[_0x651d('0x6a')]['SmsAccountId']=_0x1e6169['id'];return db[_0x651d('0x6d')][_0x651d('0x60')](_0x491ce1[_0x651d('0x6a')]);}})[_0x651d('0x3a')](respondWithResult(_0x5dd298,null))['catch'](handleError(_0x5dd298,null));};exports[_0x651d('0x6e')]=function(_0x53b66d,_0x90b5b1,_0x3eec09){var _0x1c11c5={'raw':![],'where':{}};var _0x3384df={};var _0x473ec7={'count':0x0,'rows':[]};return db[_0x651d('0x44')][_0x651d('0x6f')]({'where':{'id':_0x53b66d['params']['id']}})['then'](handleEntityNotFound(_0x90b5b1,null))[_0x651d('0x3a')](function(_0x21d29f){if(_0x21d29f){_0x3384df[_0x651d('0x47')]=_[_0x651d('0x48')](db[_0x651d('0x6d')][_0x651d('0x5e')]);_0x3384df[_0x651d('0x49')]=_[_0x651d('0x48')](_0x53b66d[_0x651d('0x49')]);_0x3384df['filters']=_[_0x651d('0x4b')](_0x3384df[_0x651d('0x47')],_0x3384df[_0x651d('0x49')]);_0x1c11c5[_0x651d('0x4c')]=_[_0x651d('0x4b')](_0x3384df[_0x651d('0x47')],qs[_0x651d('0x4d')](_0x53b66d[_0x651d('0x49')]['fields']));_0x1c11c5[_0x651d('0x4c')]=_0x1c11c5['attributes']['length']?_0x1c11c5[_0x651d('0x4c')]:_0x3384df['model'];if(!_0x53b66d[_0x651d('0x49')][_0x651d('0x4f')](_0x651d('0x70'))){_0x1c11c5[_0x651d('0x33')]=qs[_0x651d('0x33')](_0x53b66d[_0x651d('0x49')][_0x651d('0x33')]);_0x1c11c5[_0x651d('0x31')]=qs[_0x651d('0x31')](_0x53b66d[_0x651d('0x49')]['offset']);}_0x1c11c5['order']=qs['sort'](_0x53b66d['query'][_0x651d('0x51')]);_0x1c11c5['where']=qs['filters'](_[_0x651d('0x53')](_0x53b66d['query'],_0x3384df['filters']));_0x1c11c5[_0x651d('0x52')]['SmsAccountId']=_0x21d29f['id'];if(_0x53b66d[_0x651d('0x49')][_0x651d('0x54')]){_0x1c11c5[_0x651d('0x52')]=_['merge'](_0x1c11c5['where'],{'$or':_[_0x651d('0x43')](_0x1c11c5[_0x651d('0x4c')],function(_0x314f54){var _0x37d512={};_0x37d512[_0x314f54]={'$like':'%'+_0x53b66d['query'][_0x651d('0x54')]+'%'};return _0x37d512;})});}_0x1c11c5=_['merge']({},_0x1c11c5,_0x53b66d[_0x651d('0x57')]);return db[_0x651d('0x6d')][_0x651d('0x34')]({'where':_0x1c11c5['where']})[_0x651d('0x3a')](function(_0x1aa26d){_0x473ec7[_0x651d('0x34')]=_0x1aa26d;if(_0x53b66d[_0x651d('0x49')][_0x651d('0x58')]){_0x1c11c5[_0x651d('0x59')]=[{'all':!![]}];}return db[_0x651d('0x6d')][_0x651d('0x5a')](_0x1c11c5);})['then'](function(_0x8f9423){_0x473ec7[_0x651d('0x5b')]=_0x8f9423;return _0x473ec7;});}})['then'](respondWithFilteredResult(_0x90b5b1,_0x1c11c5))[_0x651d('0x2c')](handleError(_0x90b5b1,null));};exports['removeDispositions']=function(_0x5399d4,_0xb160cd,_0x5de6d7){return db['SmsAccount']['find']({'where':{'id':_0x5399d4['params']['id']}})[_0x651d('0x3a')](handleEntityNotFound(_0xb160cd,null))[_0x651d('0x3a')](function(_0x317ffe){if(_0x317ffe){return _0x317ffe[_0x651d('0x71')](_0x5399d4[_0x651d('0x49')][_0x651d('0x72')]);}})[_0x651d('0x3a')](respondWithStatusCode(_0xb160cd,null))[_0x651d('0x2c')](handleError(_0xb160cd,null));};exports[_0x651d('0x73')]=function(_0x3702b6,_0x592fd7,_0x39389a){if(_0x3702b6['body']['id']){delete _0x3702b6['body']['id'];}return db[_0x651d('0x44')][_0x651d('0x5f')]({'where':{'id':_0x3702b6[_0x651d('0x5d')]['id']}})[_0x651d('0x3a')](handleEntityNotFound(_0x592fd7,null))[_0x651d('0x3a')](function(_0x5095ee){if(_0x5095ee){_0x3702b6[_0x651d('0x6a')][_0x651d('0x74')]=_0x5095ee['id'];return db[_0x651d('0x75')][_0x651d('0x60')](_0x3702b6[_0x651d('0x6a')]);}})[_0x651d('0x3a')](respondWithResult(_0x592fd7,null))[_0x651d('0x2c')](handleError(_0x592fd7,null));};exports[_0x651d('0x76')]=function(_0x18a9c8,_0x385cc5,_0x5bbb73){var _0x51d31e={'raw':![],'where':{}};var _0x40de0f={};var _0x109203={'count':0x0,'rows':[]};return db[_0x651d('0x44')][_0x651d('0x6f')]({'where':{'id':_0x18a9c8[_0x651d('0x5d')]['id']}})[_0x651d('0x3a')](handleEntityNotFound(_0x385cc5,null))[_0x651d('0x3a')](function(_0x544a50){if(_0x544a50){_0x40de0f[_0x651d('0x47')]=_[_0x651d('0x48')](db[_0x651d('0x75')]['rawAttributes']);_0x40de0f[_0x651d('0x49')]=_[_0x651d('0x48')](_0x18a9c8[_0x651d('0x49')]);_0x40de0f[_0x651d('0x4a')]=_['intersection'](_0x40de0f[_0x651d('0x47')],_0x40de0f[_0x651d('0x49')]);_0x51d31e[_0x651d('0x4c')]=_[_0x651d('0x4b')](_0x40de0f['model'],qs[_0x651d('0x4d')](_0x18a9c8['query'][_0x651d('0x4d')]));_0x51d31e[_0x651d('0x4c')]=_0x51d31e[_0x651d('0x4c')][_0x651d('0x4e')]?_0x51d31e[_0x651d('0x4c')]:_0x40de0f[_0x651d('0x47')];if(!_0x18a9c8[_0x651d('0x49')][_0x651d('0x4f')](_0x651d('0x70'))){_0x51d31e['limit']=qs['limit'](_0x18a9c8[_0x651d('0x49')]['limit']);_0x51d31e[_0x651d('0x31')]=qs[_0x651d('0x31')](_0x18a9c8[_0x651d('0x49')][_0x651d('0x31')]);}_0x51d31e[_0x651d('0x50')]=qs[_0x651d('0x51')](_0x18a9c8[_0x651d('0x49')][_0x651d('0x51')]);_0x51d31e['where']=qs[_0x651d('0x4a')](_[_0x651d('0x53')](_0x18a9c8[_0x651d('0x49')],_0x40de0f[_0x651d('0x4a')]));_0x51d31e[_0x651d('0x52')]['SmsAccountId']=_0x544a50['id'];if(_0x18a9c8[_0x651d('0x49')][_0x651d('0x54')]){_0x51d31e[_0x651d('0x52')]=_[_0x651d('0x56')](_0x51d31e[_0x651d('0x52')],{'$or':_[_0x651d('0x43')](_0x51d31e[_0x651d('0x4c')],function(_0x3d33c2){var _0x15b79e={};_0x15b79e[_0x3d33c2]={'$like':'%'+_0x18a9c8['query'][_0x651d('0x54')]+'%'};return _0x15b79e;})});}_0x51d31e=_[_0x651d('0x56')]({},_0x51d31e,_0x18a9c8[_0x651d('0x57')]);return db[_0x651d('0x75')][_0x651d('0x34')]({'where':_0x51d31e['where']})[_0x651d('0x3a')](function(_0xf45e2b){_0x109203[_0x651d('0x34')]=_0xf45e2b;if(_0x18a9c8[_0x651d('0x49')][_0x651d('0x58')]){_0x51d31e[_0x651d('0x59')]=[{'all':!![]}];}return db[_0x651d('0x75')][_0x651d('0x5a')](_0x51d31e);})['then'](function(_0xf26751){_0x109203[_0x651d('0x5b')]=_0xf26751;return _0x109203;});}})[_0x651d('0x3a')](respondWithFilteredResult(_0x385cc5,_0x51d31e))[_0x651d('0x2c')](handleError(_0x385cc5,null));};exports[_0x651d('0x77')]=function(_0x378ce0,_0x16a172,_0x1450f3){return db[_0x651d('0x44')]['find']({'where':{'id':_0x378ce0['params']['id']}})[_0x651d('0x3a')](handleEntityNotFound(_0x16a172,null))[_0x651d('0x3a')](function(_0x4801d3){if(_0x4801d3){return _0x4801d3[_0x651d('0x77')](_0x378ce0[_0x651d('0x49')][_0x651d('0x72')]);}})['then'](respondWithStatusCode(_0x16a172,null))[_0x651d('0x2c')](handleError(_0x16a172,null));};exports[_0x651d('0x78')]=function(_0x48abdd,_0x23a219,_0x4c3cdf){var _0x2d4daa={'channel':'sms'};var _0x529c18=[];var _0x334d12=[];var _0x5c93eb={};return db[_0x651d('0x44')][_0x651d('0x5f')]({'where':{'id':_0x48abdd['params']['id']},'include':[{'model':db[_0x651d('0x79')],'as':_0x651d('0x7a')}]})[_0x651d('0x3a')](handleEntityNotFound(_0x23a219,null))[_0x651d('0x3a')](function(_0x5b1fd0){_0x2d4daa['account']=_0x5b1fd0;_0x2d4daa['applications']=_[_0x651d('0x7b')](_0x5b1fd0[_0x651d('0x7a')],[_0x651d('0x7c')],[_0x651d('0x7d')]);if(_0x2d4daa[_0x651d('0x7e')]['Applications']){delete _0x2d4daa[_0x651d('0x7e')][_0x651d('0x7a')];}return db['CmContact']['describe']();})[_0x651d('0x3a')](function(_0x44abef){if(!_0x44abef){throw new db[(_0x651d('0x7f'))][(_0x651d('0x80'))](_0x651d('0x81'));}_0x529c18=_[_0x651d('0x82')](_[_0x651d('0x48')](_0x44abef),['createdAt',_0x651d('0x83')]);_0x334d12=_[_0x651d('0x82')](_[_0x651d('0x48')](_0x44abef),['createdAt','updatedAt',_0x651d('0x84'),_0x651d('0x85')]);_0x2d4daa[_0x651d('0x6a')]={'mapKey':_0x651d('0x86')};if(_0x2d4daa[_0x651d('0x7e')][_0x651d('0x55')]){switch(_0x2d4daa[_0x651d('0x7e')][_0x651d('0x55')]){case _0x651d('0x87'):_0x2d4daa[_0x651d('0x6a')][_0x651d('0x88')]=_0x48abdd[_0x651d('0x6a')][_0x651d('0x89')];_0x2d4daa[_0x651d('0x6a')][_0x651d('0x6a')]=_0x48abdd[_0x651d('0x6a')][_0x651d('0x8a')];_0x2d4daa[_0x651d('0x6a')][_0x651d('0x8b')]=_0x48abdd[_0x651d('0x6a')][_0x651d('0x8c')];break;case _0x651d('0x8d'):_0x2d4daa[_0x651d('0x6a')][_0x651d('0x88')]='+'+_0x48abdd[_0x651d('0x6a')][_0x651d('0x8e')];_0x2d4daa[_0x651d('0x6a')][_0x651d('0x6a')]=_0x48abdd[_0x651d('0x6a')][_0x651d('0x8f')];break;case _0x651d('0x90'):_0x2d4daa[_0x651d('0x6a')][_0x651d('0x88')]=_0x48abdd[_0x651d('0x6a')][_0x651d('0x88')];_0x2d4daa[_0x651d('0x6a')][_0x651d('0x6a')]=_0x48abdd['body']['message'];break;case _0x651d('0x91'):_0x2d4daa[_0x651d('0x6a')][_0x651d('0x88')]=_0x48abdd[_0x651d('0x6a')][_0x651d('0x88')];_0x2d4daa[_0x651d('0x6a')][_0x651d('0x6a')]=_0x48abdd['body'][_0x651d('0x6a')];_0x2d4daa['body'][_0x651d('0x8b')]=_0x48abdd[_0x651d('0x6a')]['message_id'];break;case'plivo':_0x2d4daa[_0x651d('0x6a')]['from']=_0x48abdd[_0x651d('0x6a')][_0x651d('0x89')];_0x2d4daa['body'][_0x651d('0x6a')]=_0x48abdd['body'][_0x651d('0x92')];_0x2d4daa[_0x651d('0x6a')]['messageId']=_0x48abdd[_0x651d('0x6a')][_0x651d('0x93')];break;case'infobip':_0x2d4daa[_0x651d('0x6a')][_0x651d('0x88')]='+'+_0x48abdd[_0x651d('0x6a')]['results'][0x0][_0x651d('0x88')];_0x2d4daa[_0x651d('0x6a')]['body']=_0x48abdd[_0x651d('0x6a')]['results'][0x0][_0x651d('0x8f')];_0x2d4daa['body'][_0x651d('0x8b')]=_0x48abdd['body'][_0x651d('0x94')][0x0]['messageId'];break;case _0x651d('0x95'):_0x2d4daa['body'][_0x651d('0x88')]=_0x48abdd[_0x651d('0x6a')][_0x651d('0x96')];_0x2d4daa[_0x651d('0x6a')][_0x651d('0x6a')]=_0x48abdd['body'][_0x651d('0x97')]['message'];break;case _0x651d('0x98'):_0x2d4daa[_0x651d('0x6a')][_0x651d('0x88')]=_0x48abdd['body'][_0x651d('0x99')];_0x2d4daa[_0x651d('0x6a')][_0x651d('0x6a')]=_0x48abdd[_0x651d('0x6a')][_0x651d('0x8f')];_0x2d4daa['body'][_0x651d('0x8b')]=_0x48abdd[_0x651d('0x6a')]['replyMessageId'];break;case'bandwidth':_0x2d4daa[_0x651d('0x6a')]['messageId']=_0x48abdd[_0x651d('0x6a')][0x0][_0x651d('0x2a')]['id'];_0x2d4daa[_0x651d('0x6a')]['from']=_0x48abdd[_0x651d('0x6a')][0x0]['message']['from'];_0x2d4daa[_0x651d('0x6a')]['body']=_0x48abdd[_0x651d('0x6a')][0x0][_0x651d('0x2a')][_0x651d('0x8f')];break;case _0x651d('0x9a'):_0x2d4daa[_0x651d('0x6a')][_0x651d('0x88')]=_0x48abdd[_0x651d('0x6a')][_0x651d('0x88')];_0x2d4daa[_0x651d('0x6a')][_0x651d('0x6a')]=_0x48abdd['body'][_0x651d('0x2a')];_0x2d4daa[_0x651d('0x6a')][_0x651d('0x8b')]=_0x48abdd[_0x651d('0x6a')][_0x651d('0x9b')];break;}}if(_0x2d4daa[_0x651d('0x6a')]['id']){delete _0x2d4daa[_0x651d('0x6a')]['id'];}if(_[_0x651d('0x9c')](_0x2d4daa['body'][_0x651d('0x88')])){throw new db[(_0x651d('0x7f'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x651d('0x9c')](_0x2d4daa[_0x651d('0x6a')][_0x651d('0x6a')])||_0x2d4daa[_0x651d('0x6a')][_0x651d('0x6a')]===''){throw new db[(_0x651d('0x7f'))]['ValidationError'](_0x651d('0x9d'));}if(_[_0x651d('0x9c')](_0x2d4daa[_0x651d('0x6a')][_0x651d('0x9e')])){throw new db[(_0x651d('0x7f'))][(_0x651d('0x80'))](_0x651d('0x9f')+_0x334d12);}if(!_[_0x651d('0xa0')](_0x334d12,_0x2d4daa['body'][_0x651d('0x9e')])){throw new db[(_0x651d('0x7f'))][(_0x651d('0x80'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x334d12);}_0x5c93eb[_0x2d4daa[_0x651d('0x6a')][_0x651d('0x9e')]]=_0x2d4daa['body'][_0x651d('0x88')];return db[_0x651d('0xa1')]['find']({'where':{'id':_0x2d4daa[_0x651d('0x7e')]['ListId']},'include':[{'model':db[_0x651d('0xa2')],'as':_0x651d('0xa3'),'where':_0x5c93eb,'limit':0x1,'order':[[_0x651d('0x83'),_0x651d('0xa4')]]}]});})[_0x651d('0x3a')](handleEntityNotFound(_0x23a219,null))[_0x651d('0x3a')](function(_0xaf5a5e){if(_0xaf5a5e){_0x2d4daa[_0x651d('0xa5')]=_[_0x651d('0xa6')](_0xaf5a5e,[_0x651d('0xa3')]);if(_0xaf5a5e[_0x651d('0xa3')][_0x651d('0x4e')]){return _0xaf5a5e[_0x651d('0xa3')][0x0];}var _0x131851=_[_0x651d('0x1b')](_0x2d4daa[_0x651d('0x6a')],{'firstName':_0x2d4daa[_0x651d('0x6a')][_0x651d('0x88')],'ListId':_0xaf5a5e['id']});_0x131851[_0x2d4daa['body'][_0x651d('0x9e')]]=_0x2d4daa['body'][_0x651d('0x88')];return db[_0x651d('0xa2')]['create'](_0x131851,{'fields':_0x529c18,'raw':!![]});}})[_0x651d('0x3a')](handleEntityNotFound(_0x23a219,null))['then'](function(_0x49ebf2){if(_0x49ebf2){_0x2d4daa['contact']=_0x49ebf2;var _0x34e79d={'ContactId':_0x49ebf2['id'],'phone':_0x2d4daa[_0x651d('0x6a')][_0x651d('0x88')],'SmsAccountId':_0x48abdd[_0x651d('0x5d')]['id']};var _0x291e0f={'ContactId':_0x49ebf2['id'],'SmsAccountId':_0x48abdd['params']['id'],'closed':![]};return db[_0x651d('0xa7')][_0x651d('0x5f')]({'where':_0x291e0f})[_0x651d('0x3a')](function(_0x1e2408){if(_0x1e2408){return[_0x1e2408,![]];}return db['SmsInteraction'][_0x651d('0x60')](_0x34e79d)[_0x651d('0x3a')](function(_0x1d85b7){return[_0x1d85b7,!![]];});});}})[_0x651d('0xa8')](function(_0x2bf2db,_0x286acf){_0x2d4daa['interaction']=_0x2bf2db['get']({'plain':!![]});_0x2d4daa[_0x651d('0xa9')][_0x651d('0xaa')]=![];if(_0x286acf){if(_0x2d4daa[_0x651d('0x7e')][_0x651d('0xab')]){_0x2d4daa[_0x651d('0xac')][_0x651d('0xad')]({'id':0x0,'priority':_0x2d4daa[_0x651d('0xac')][_0x651d('0x4e')]+0x1,'app':_0x651d('0xae'),'appdata':_0x651d('0xaf'),'interval':_0x651d('0xb0')});}_0x2d4daa[_0x651d('0xa9')]['created']=!![];}return db[_0x651d('0xb1')][_0x651d('0x60')]({'phone':_0x2d4daa[_0x651d('0x6a')][_0x651d('0x88')],'messageId':_0x2d4daa[_0x651d('0x6a')]['messageId'],'body':_0x2d4daa[_0x651d('0x6a')][_0x651d('0x6a')],'SmsAccountId':_0x48abdd[_0x651d('0x5d')]['id'],'SmsInteractionId':_0x2bf2db['id'],'direction':'in','ContactId':_0x2bf2db[_0x651d('0xb2')],'AttachmentId':_0x2d4daa['body']['AttachmentId']});})[_0x651d('0x3a')](function(_0xd54c5c){_0x2d4daa[_0x651d('0x2a')]=_0xd54c5c;if(_0x2d4daa['interaction'][_0x651d('0xb3')]){return db['User'][_0x651d('0x5f')]({'attributes':['id',_0x651d('0x3e')],'where':{'id':_0x2d4daa[_0x651d('0xa9')][_0x651d('0xb3')]}})['then'](function(_0x18f89b){if(_0x18f89b){_0x2d4daa[_0x651d('0xac')]['unshift']({'id':0x0,'priority':0x0,'app':_0x651d('0xb4'),'appdata':_0x18f89b[_0x651d('0x3e')]+','+(_0x2d4daa['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x651d('0xb5'),'startRouting',_0x2d4daa);});}return respondWithRpcPromise(_0x651d('0xb5'),_0x651d('0xb6'),_0x2d4daa);})[_0x651d('0x3a')](function(_0x789d39){if(_0x789d39){var _0x3bad51=0xc8;var _0x17eec3=_0x651d('0xb7');logger[_0x651d('0x23')](_0x651d('0xb8'),_0x17eec3,_0x3bad51,_0x651d('0xb9'));logger[_0x651d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x17eec3,_0x3bad51,_0x651d('0xb9'),JSON['stringify'](_0x789d39));if(_0x2d4daa['account'][_0x651d('0x55')]===_0x651d('0x87')){return _0x23a219[_0x651d('0x2e')](_0x3bad51)[_0x651d('0x35')](_0x651d('0xba'),'text/xml')[_0x651d('0x3f')](_0x651d('0xbb'));}else{return _0x23a219['status'](_0x3bad51)[_0x651d('0x30')](_0x789d39);}}})[_0x651d('0x2c')](handleError(_0x23a219,null));};exports[_0x651d('0xbc')]=function(_0x15da8c,_0x4a912e,_0x5a3f8e){return db[_0x651d('0x44')][_0x651d('0x6f')]({'where':{'id':_0x15da8c[_0x651d('0x5d')]['id']}})[_0x651d('0x3a')](handleEntityNotFound(_0x4a912e,null))[_0x651d('0x3a')](function(_0x382bd1){if(_0x382bd1){return db['sequelize'][_0x651d('0xbd')](function(_0x2605d0){return db[_0x651d('0x79')][_0x651d('0x39')]({'where':{'SmsAccountId':_0x15da8c['params']['id']},'transaction':_0x2605d0})[_0x651d('0x3a')](function(_0x70381f){var _0x725c93=_['map'](_0x15da8c[_0x651d('0x6a')],function(_0x3c2029){_0x3c2029['SmsAccountId']=_0x15da8c['params']['id'];return _0x3c2029;});return db[_0x651d('0x79')][_0x651d('0xbe')](_0x725c93,{'transaction':_0x2605d0});});})['then'](function(){return db[_0x651d('0x79')]['findAndCountAll']({'where':{'SmsAccountId':_0x15da8c[_0x651d('0x5d')]['id']},'order':_0x651d('0x7c')});});}})[_0x651d('0x3a')](respondWithResult(_0x4a912e,null))[_0x651d('0x2c')](handleError(_0x4a912e,null));};exports[_0x651d('0xbf')]=function(_0x21eae1,_0x5005ed,_0x2ee09f){var _0x52ab06={};var _0x519e38={};var _0x1004e8;var _0x2b6609;return db[_0x651d('0x44')][_0x651d('0x6f')]({'where':{'id':_0x21eae1['params']['id']}})[_0x651d('0x3a')](handleEntityNotFound(_0x5005ed,null))[_0x651d('0x3a')](function(_0x43d737){if(_0x43d737){_0x1004e8=_0x43d737;_0x519e38[_0x651d('0x47')]=_[_0x651d('0x48')](db[_0x651d('0x79')][_0x651d('0x5e')]);_0x519e38[_0x651d('0x49')]=_[_0x651d('0x48')](_0x21eae1[_0x651d('0x49')]);_0x519e38[_0x651d('0x4a')]=_[_0x651d('0x4b')](_0x519e38[_0x651d('0x47')],_0x519e38['query']);_0x52ab06[_0x651d('0x4c')]=_[_0x651d('0x4b')](_0x519e38[_0x651d('0x47')],qs[_0x651d('0x4d')](_0x21eae1[_0x651d('0x49')][_0x651d('0x4d')]));_0x52ab06[_0x651d('0x4c')]=_0x52ab06[_0x651d('0x4c')][_0x651d('0x4e')]?_0x52ab06[_0x651d('0x4c')]:_0x519e38[_0x651d('0x47')];_0x52ab06[_0x651d('0x50')]=qs[_0x651d('0x51')](_0x21eae1[_0x651d('0x49')][_0x651d('0x51')]);_0x52ab06[_0x651d('0x52')]=qs[_0x651d('0x4a')](_[_0x651d('0x53')](_0x21eae1['query'],_0x519e38[_0x651d('0x4a')]));if(_0x21eae1[_0x651d('0x49')][_0x651d('0x54')]){_0x52ab06[_0x651d('0x52')]=_[_0x651d('0x56')](_0x52ab06[_0x651d('0x52')],{'$or':_[_0x651d('0x43')](_0x52ab06['attributes'],function(_0x4280b5){var _0x473308={};_0x473308[_0x4280b5]={'$like':'%'+_0x21eae1[_0x651d('0x49')][_0x651d('0x54')]+'%'};return _0x473308;})});}_0x52ab06=_[_0x651d('0x56')]({},_0x52ab06,_0x21eae1[_0x651d('0x57')]);return _0x1004e8[_0x651d('0xbf')](_0x52ab06);}})['then'](function(_0x2494e8){if(_0x2494e8){_0x2b6609=_0x2494e8[_0x651d('0x4e')];if(!_0x21eae1[_0x651d('0x49')][_0x651d('0x4f')]('nolimit')){_0x52ab06[_0x651d('0x33')]=qs['limit'](_0x21eae1[_0x651d('0x49')]['limit']);_0x52ab06[_0x651d('0x31')]=qs[_0x651d('0x31')](_0x21eae1[_0x651d('0x49')][_0x651d('0x31')]);}return _0x1004e8['getApplications'](_0x52ab06);}})[_0x651d('0x3a')](function(_0x19342a){if(_0x19342a){return _0x19342a?{'count':_0x2b6609,'rows':_0x19342a}:null;}})[_0x651d('0x3a')](respondWithResult(_0x5005ed,null))[_0x651d('0x2c')](handleError(_0x5005ed,null));};exports[_0x651d('0xc0')]=function(_0x1a8298,_0x453ad4,_0x15de8b){var _0x309802={'raw':![],'where':{}};var _0x1fa601={};var _0x5c9218={'count':0x0,'rows':[]};return db[_0x651d('0x44')][_0x651d('0x6f')]({'where':{'id':_0x1a8298['params']['id']}})[_0x651d('0x3a')](handleEntityNotFound(_0x453ad4,null))[_0x651d('0x3a')](function(_0x3601c7){if(_0x3601c7){_0x1fa601[_0x651d('0x47')]=_[_0x651d('0x48')](db[_0x651d('0xa7')]['rawAttributes']);_0x1fa601[_0x651d('0x49')]=_['keys'](_0x1a8298['query']);_0x1fa601[_0x651d('0x4a')]=_[_0x651d('0x4b')](_0x1fa601['model'],_0x1fa601[_0x651d('0x49')]);_0x309802['attributes']=_[_0x651d('0x4b')](_0x1fa601['model'],qs['fields'](_0x1a8298['query'][_0x651d('0x4d')]));_0x309802[_0x651d('0x4c')]=_0x309802['attributes']['length']?_0x309802['attributes']:_0x1fa601['model'];if(!_0x1a8298[_0x651d('0x49')][_0x651d('0x4f')](_0x651d('0x70'))){_0x309802['limit']=qs[_0x651d('0x33')](_0x1a8298[_0x651d('0x49')][_0x651d('0x33')]);_0x309802[_0x651d('0x31')]=qs['offset'](_0x1a8298[_0x651d('0x49')][_0x651d('0x31')]);}_0x309802[_0x651d('0x50')]=qs['sort'](_0x1a8298['query'][_0x651d('0x51')]);_0x309802[_0x651d('0x52')]=qs[_0x651d('0x4a')](_[_0x651d('0x53')](_0x1a8298[_0x651d('0x49')],_0x1fa601[_0x651d('0x4a')]));_0x309802['where']['SmsAccountId']=_0x3601c7['id'];if(_0x1a8298['query'][_0x651d('0x54')]){_0x309802[_0x651d('0x52')]=_['merge'](_0x309802['where'],{'$or':_[_0x651d('0x43')](_0x309802[_0x651d('0x4c')],function(_0xf8f391){var _0x572a7f={};_0x572a7f[_0xf8f391]={'$like':'%'+_0x1a8298['query']['filter']+'%'};return _0x572a7f;})});}_0x309802=_[_0x651d('0x56')]({},_0x309802,_0x1a8298[_0x651d('0x57')]);return db[_0x651d('0xa7')]['count']({'where':_0x309802[_0x651d('0x52')]})['then'](function(_0x4334cb){_0x5c9218['count']=_0x4334cb;if(_0x1a8298[_0x651d('0x49')][_0x651d('0x58')]){_0x309802[_0x651d('0x59')]=[{'model':db['CmContact'],'as':_0x651d('0xc1'),'required':![]},{'model':db[_0x651d('0xc2')],'as':_0x651d('0xc3'),'attributes':['name',_0x651d('0xc4'),_0x651d('0xc5')],'required':![]},{'model':db['Tag'],'as':_0x651d('0xc6'),'attributes':['id',_0x651d('0x3e'),'color'],'where':_0x1a8298['query']['tag']?{'id':_0x1a8298[_0x651d('0x49')]['tag']}:undefined,'required':_0x1a8298['query'][_0x651d('0xc7')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0x309802);})['then'](function(_0x102476){_0x5c9218[_0x651d('0x5b')]=_0x102476;return _0x5c9218;});}})[_0x651d('0x3a')](respondWithFilteredResult(_0x453ad4,_0x309802))['catch'](handleError(_0x453ad4,null));};exports[_0x651d('0x3f')]=function(_0x370e62,_0x4ce424,_0x1d1a0c){var _0x20d21a,_0x199a80,_0x4329cf;if(_[_0x651d('0x9c')](_0x370e62['body'][_0x651d('0x6a')])||_0x370e62[_0x651d('0x6a')][_0x651d('0x6a')]===''){throw new db[(_0x651d('0x7f'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x651d('0x9c')](_0x370e62[_0x651d('0x6a')]['to'])){throw new db['Sequelize']['ValidationError'](_0x651d('0xc8'));}_0x20d21a=_0x370e62[_0x651d('0x6a')]['to'];return db['SmsAccount'][_0x651d('0x5f')]({'where':{'id':_0x370e62['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x651d('0xa2')],'as':_0x651d('0xa3'),'where':{'mobile':_0x20d21a},'limit':0x1,'order':[[_0x651d('0x83'),_0x651d('0xa4')]]}]}]})[_0x651d('0x3a')](handleEntityNotFound(_0x4ce424,null))['then'](function(_0x261d67){if(_0x261d67&&_0x261d67['List']){_0x199a80=_0x261d67['get']({'plain':!![]});if(_0x199a80[_0x651d('0xc9')]&&_0x199a80[_0x651d('0xc9')]['Contacts'][_0x651d('0x4e')]){return _0x199a80[_0x651d('0xc9')][_0x651d('0xa3')][0x0];}return db[_0x651d('0xa2')]['create'](_['defaults'](_0x370e62[_0x651d('0x6a')],{'firstName':_0x20d21a,'mobile':_0x20d21a,'phone':_0x20d21a,'ListId':_0x199a80[_0x651d('0x85')]}));}})['then'](handleEntityNotFound(_0x4ce424,null))[_0x651d('0x3a')](function(_0x31be0e){if(_0x31be0e){_0x4329cf=_0x31be0e;return db[_0x651d('0xa7')][_0x651d('0x5f')]({'where':{'ContactId':_0x4329cf['id'],'closed':![],'SmsAccountId':_0x199a80['id']}})['then'](function(_0x534461){if(_0x534461){return[_0x534461,![]];}return db['SmsInteraction'][_0x651d('0x60')]({'UserId':_0x370e62[_0x651d('0x61')]['id'],'ContactId':_0x4329cf['id'],'SmsAccountId':_0x199a80['id'],'phone':_0x20d21a,'firstMsgDirection':_0x651d('0xca'),'Messages':[_['merge'](_0x370e62['body'],{'read':![],'body':_0x370e62[_0x651d('0x6a')][_0x651d('0x6a')],'phone':_0x20d21a,'SmsAccountId':_0x199a80['id'],'UserId':_0x370e62[_0x651d('0x61')]['id'],'ContactId':_0x4329cf['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0x651d('0xcb')}]})['then'](function(_0x32ab76){return[_0x32ab76,!![]];});});}})['spread'](function(_0x1988f6,_0xaa745b){if(_0xaa745b){return _0x1988f6;}return db['SmsMessage'][_0x651d('0x60')](_['merge'](_0x370e62['body'],{'read':![],'body':_0x370e62[_0x651d('0x6a')][_0x651d('0x6a')],'phone':_0x20d21a,'SmsAccountId':_0x199a80['id'],'SmsInteractionId':_0x1988f6['id'],'UserId':_0x370e62[_0x651d('0x61')]['id'],'ContactId':_0x4329cf['id']}))[_0x651d('0x3a')](function(_0x3a80d4){_0x1988f6[_0x651d('0xcc')][_0x651d('0xcb')]=[];_0x1988f6[_0x651d('0xcc')]['Messages'][_0x651d('0xad')](_0x3a80d4['dataValues']);return _0x1988f6;});})['then'](respondWithResult(_0x4ce424,null))[_0x651d('0x2c')](handleError(_0x4ce424,null));};exports[_0x651d('0x2e')]=function(_0x3025cc,_0x178958,_0xfce884){if(_0x3025cc[_0x651d('0x6a')]['id']){delete _0x3025cc[_0x651d('0x6a')]['id'];}var _0x6a3431,_0x36d801,_0x36caa0;return db[_0x651d('0x44')][_0x651d('0x5f')]({'where':{'id':_0x3025cc[_0x651d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x178958,null))['then'](function(_0x492e97){if(_0x492e97){_0x36caa0=_0x492e97;logger[_0x651d('0x24')](_0x651d('0xb8'),_0x651d('0x2e'),_0x651d('0xcd'),_0x492e97[_0x651d('0x55')],util['inspect'](_0x3025cc[_0x651d('0x6a')],{'showHidden':![],'depth':null}));switch(_0x492e97[_0x651d('0x55')]){case'skebby':if(_0x3025cc[_0x651d('0x6a')][_0x651d('0xce')]&&_0x3025cc['body'][_0x651d('0x2e')]){_0x36d801=_0x3025cc[_0x651d('0x6a')][_0x651d('0x2e')];return db[_0x651d('0xb1')]['find']({'where':{'messageId':_0x3025cc[_0x651d('0x6a')]['skebby_dispatch_id']}});}break;case _0x651d('0x90'):if(_0x3025cc[_0x651d('0x6a')][_0x651d('0xcf')]&&_0x3025cc[_0x651d('0x6a')][_0x651d('0xd0')]){_0x36d801=_0x3025cc[_0x651d('0x6a')][_0x651d('0xd0')];return db[_0x651d('0xb1')][_0x651d('0x5f')]({'where':{'messageId':_0x3025cc[_0x651d('0x6a')][_0x651d('0xcf')]}});}break;case'clicksend':if(_0x3025cc['body'][_0x651d('0xd1')]&&_0x3025cc[_0x651d('0x6a')][_0x651d('0xd2')]){_0x36d801=_0x3025cc[_0x651d('0x6a')][_0x651d('0xd2')];return db['SmsMessage'][_0x651d('0x5f')]({'where':{'messageId':_0x3025cc[_0x651d('0x6a')][_0x651d('0xd1')]}});}break;case _0x651d('0xd3'):var _0x289400=_0x3025cc[_0x651d('0x6a')][_0x651d('0x94')][0x0];if(_0x289400[_0x651d('0x8b')]&&_0x289400[_0x651d('0x2e')][_0x651d('0xd4')]===_0x651d('0xd5')){_0x36d801=_0x289400[_0x651d('0x2e')]['groupName'];return db[_0x651d('0xb1')][_0x651d('0x5f')]({'where':{'messageId':_0x289400[_0x651d('0x8b')]}});}break;case _0x651d('0x98'):if(_0x3025cc[_0x651d('0x6a')][_0x651d('0x8b')]&&_0x3025cc[_0x651d('0x6a')][_0x651d('0x2e')]){_0x36d801=_0x3025cc[_0x651d('0x6a')][_0x651d('0x2e')];return db['SmsMessage'][_0x651d('0x5f')]({'where':{'messageId':_0x3025cc[_0x651d('0x6a')][_0x651d('0x8b')]}});}break;case _0x651d('0xd6'):if(_0x3025cc[_0x651d('0x6a')][0x0][_0x651d('0x2a')]['id']){_0x36d801=_0x3025cc['body'][0x0]['type'];return db[_0x651d('0xb1')][_0x651d('0x5f')]({'where':{'messageId':_0x3025cc[_0x651d('0x6a')][0x0][_0x651d('0x2a')]['id']}});}break;case _0x651d('0x9a'):if(_0x3025cc['body']['redif']&&_0x3025cc[_0x651d('0x6a')][_0x651d('0x2e')]){_0x36d801=_0x3025cc[_0x651d('0x6a')][_0x651d('0x2e')];return db['SmsMessage'][_0x651d('0x5f')]({'where':{'messageId':_0x3025cc[_0x651d('0x6a')][_0x651d('0xd7')]}});}break;}}})[_0x651d('0x3a')](handleEntityNotFound(_0x178958,null))[_0x651d('0x3a')](function(_0x54cb64){if(_0x54cb64){_0x6a3431=_0x54cb64;switch(_0x36caa0['type']){case _0x651d('0x8d'):if(_0x36d801===_0x651d('0xd5')){return _0x6a3431[_0x651d('0x69')]({'read':!![]});}else{logger[_0x651d('0x28')](_0x651d('0xb8'),'status',_0x651d('0x8d'),util[_0x651d('0xd8')](_0x3025cc[_0x651d('0x6a')],{'showHidden':![],'depth':null}));}break;case _0x651d('0x90'):if(_0x36d801==='1'){return _0x6a3431['update']({'read':!![]});}else{logger[_0x651d('0x28')](_0x651d('0xb8'),'status',_0x651d('0x8d'),util[_0x651d('0xd8')](_0x3025cc[_0x651d('0x6a')],{'showHidden':![],'depth':null}));}break;case _0x651d('0x91'):if(!_0x3025cc[_0x651d('0x6a')][_0x651d('0xd9')]&&_0x36d801>=0xc8&&_0x36d801<=0xce){return _0x6a3431[_0x651d('0x69')]({'read':!![]});}else{logger[_0x651d('0x28')](_0x651d('0xb8'),_0x651d('0x2e'),'clicksend',util[_0x651d('0xd8')](_0x3025cc[_0x651d('0x6a')],{'showHidden':![],'depth':null}));}break;case _0x651d('0xd3'):var _0x1e69d2=_0x3025cc['body'][_0x651d('0x94')][0x0];if(_0x1e69d2[_0x651d('0x2e')][_0x651d('0xd4')]===_0x651d('0xd5')){return _0x6a3431[_0x651d('0x69')]({'read':!![]});}else{logger[_0x651d('0x28')](_0x651d('0xb8'),_0x651d('0x2e'),_0x651d('0xd3'),util[_0x651d('0xd8')](_0x3025cc[_0x651d('0x6a')],{'showHidden':![],'depth':null}));}break;case _0x651d('0x98'):if(_0x36d801=='DELIVERED_TO_GATEWAY'||_0x36d801==_0x651d('0xda')){return _0x6a3431['update']({'read':!![]});}else{logger[_0x651d('0x28')](_0x651d('0xb8'),'status',_0x651d('0x98'),util['inspect'](_0x3025cc['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x36d801=='message-delivered'){return _0x6a3431['update']({'read':!![]});}else{logger[_0x651d('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x651d('0x2e'),_0x651d('0xd6'),util['inspect'](_0x3025cc[_0x651d('0x6a')],{'showHidden':![],'depth':null}));}break;case _0x651d('0x9a'):if(_0x36d801===_0x651d('0xdb')||_0x36d801==='ACCEPTD'){return _0x6a3431[_0x651d('0x69')]({'read':!![]});}else{logger[_0x651d('0x28')](_0x651d('0xb8'),'status','intelepeer',util[_0x651d('0xd8')](_0x3025cc[_0x651d('0x6a')],{'showHidden':![],'depth':null}));}break;}return _0x6a3431;}})[_0x651d('0x3a')](respondWithResult(_0x178958,null))['catch'](handleError(_0x178958,null));};exports[_0x651d('0xdc')]=function(_0x441922,_0x21a0f3,_0x1e2b5f){var _0x446c53,_0x4dcaf5,_0x2aa00f;return db[_0x651d('0x44')][_0x651d('0x5f')]({'where':{'id':_0x441922[_0x651d('0x5d')]['id']}})[_0x651d('0x3a')](handleEntityNotFound(_0x21a0f3,null))[_0x651d('0x3a')](function(_0x528d40){if(_0x528d40){_0x2aa00f=_0x528d40;logger[_0x651d('0x24')](_0x651d('0xb8'),_0x651d('0x2e'),_0x651d('0xcd'),_0x528d40[_0x651d('0x55')],util[_0x651d('0xd8')](_0x441922[_0x651d('0x49')],{'showHidden':![],'depth':null}));switch(_0x528d40[_0x651d('0x55')]){case'csc':if(_0x441922[_0x651d('0x49')][_0x651d('0xdd')]&&_0x441922[_0x651d('0x49')][_0x651d('0xde')]){_0x4dcaf5=_0x441922[_0x651d('0x49')][_0x651d('0xde')];return db[_0x651d('0xb1')][_0x651d('0x5f')]({'where':{'messageId':_0x441922[_0x651d('0x49')][_0x651d('0xdd')]}});}break;}}})[_0x651d('0x3a')](handleEntityNotFound(_0x21a0f3,null))['then'](function(_0x10db39){if(_0x10db39){_0x446c53=_0x10db39;switch(_0x2aa00f[_0x651d('0x55')]){case _0x651d('0x95'):if(_0x4dcaf5==='2'||_0x4dcaf5==='6'){return _0x446c53[_0x651d('0x69')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x651d('0x2e'),'csc',util[_0x651d('0xd8')](_0x441922[_0x651d('0x49')],{'showHidden':![],'depth':null}));};break;}return _0x446c53;}})[_0x651d('0x3a')](respondWithResult(_0x21a0f3,null))['catch'](handleError(_0x21a0f3,null));};exports[_0x651d('0xdf')]=function(_0x42d822,_0x4e9fe9,_0x576518){return db['SmsAccount'][_0x651d('0x5f')]({'where':{'id':_0x42d822[_0x651d('0x5d')]['id']}})[_0x651d('0x3a')](handleEntityNotFound(_0x4e9fe9,null))[_0x651d('0x3a')](function(_0x5bb88e){if(_0x5bb88e){return _0x5bb88e[_0x651d('0xdf')](_0x42d822[_0x651d('0x6a')][_0x651d('0x72')],_[_0x651d('0xa6')](_0x42d822[_0x651d('0x6a')],[_0x651d('0x72'),'id'])||{})['spread'](function(_0xb801ea){for(var _0x1321ba=0x0;_0x1321ba<_0x42d822[_0x651d('0x6a')][_0x651d('0x72')][_0x651d('0x4e')];_0x1321ba+=0x1){socket['emit'](_0x651d('0xe0'),{'UserId':Number(_0x42d822[_0x651d('0x6a')]['ids'][_0x1321ba]),'SmsAccountId':Number(_0x42d822[_0x651d('0x5d')]['id'])});}return _0xb801ea;});}})['then'](respondWithResult(_0x4e9fe9,null))['catch'](handleError(_0x4e9fe9,null));};exports['removeAgents']=function(_0x3a3df6,_0x3f23f6,_0x182575){return db[_0x651d('0x44')][_0x651d('0x5f')]({'where':{'id':_0x3a3df6[_0x651d('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3f23f6,null))[_0x651d('0x3a')](function(_0x3f11fc){if(_0x3f11fc){return _0x3f11fc[_0x651d('0xe1')](_0x3a3df6[_0x651d('0x49')]['ids'])['then'](function(){if(_[_0x651d('0xe2')](_0x3a3df6[_0x651d('0x49')]['ids'])){for(var _0x3695b3=0x0;_0x3695b3<_0x3a3df6[_0x651d('0x49')][_0x651d('0x72')][_0x651d('0x4e')];_0x3695b3+=0x1){socket[_0x651d('0xe3')](_0x651d('0xe4'),{'UserId':Number(_0x3a3df6[_0x651d('0x49')][_0x651d('0x72')][_0x3695b3]),'SmsAccountId':Number(_0x3a3df6[_0x651d('0x5d')]['id'])});}}else{socket['emit'](_0x651d('0xe4'),{'UserId':Number(_0x3a3df6['query'][_0x651d('0x72')]),'SmsAccountId':Number(_0x3a3df6[_0x651d('0x5d')]['id'])});}});}})[_0x651d('0x3a')](respondWithStatusCode(_0x3f23f6,null))[_0x651d('0x2c')](handleError(_0x3f23f6,null));};exports[_0x651d('0xe5')]=function(_0xe5bb2f,_0x54d92e,_0x3e2395){var _0x3c1b84={};var _0xaa45b8={};var _0x51f0d0;var _0x1abb38;return db['SmsAccount'][_0x651d('0x6f')]({'where':{'id':_0xe5bb2f['params']['id']}})[_0x651d('0x3a')](handleEntityNotFound(_0x54d92e,null))[_0x651d('0x3a')](function(_0x35442d){if(_0x35442d){_0x51f0d0=_0x35442d;_0xaa45b8[_0x651d('0x47')]=_[_0x651d('0x48')](db[_0x651d('0xc2')]['rawAttributes']);_0xaa45b8[_0x651d('0x49')]=_['keys'](_0xe5bb2f[_0x651d('0x49')]);_0xaa45b8[_0x651d('0x4a')]=_[_0x651d('0x4b')](_0xaa45b8[_0x651d('0x47')],_0xaa45b8[_0x651d('0x49')]);_0x3c1b84['attributes']=_[_0x651d('0x4b')](_0xaa45b8['model'],qs['fields'](_0xe5bb2f[_0x651d('0x49')][_0x651d('0x4d')]));_0x3c1b84['attributes']=_0x3c1b84[_0x651d('0x4c')][_0x651d('0x4e')]?_0x3c1b84['attributes']:_0xaa45b8[_0x651d('0x47')];_0x3c1b84[_0x651d('0x50')]=qs[_0x651d('0x51')](_0xe5bb2f['query'][_0x651d('0x51')]);_0x3c1b84[_0x651d('0x52')]=qs['filters'](_[_0x651d('0x53')](_0xe5bb2f[_0x651d('0x49')],_0xaa45b8[_0x651d('0x4a')]));if(_0xe5bb2f[_0x651d('0x49')][_0x651d('0x54')]){_0x3c1b84[_0x651d('0x52')]=_['merge'](_0x3c1b84[_0x651d('0x52')],{'$or':_[_0x651d('0x43')](_0x3c1b84[_0x651d('0x4c')],function(_0x509070){var _0x172d94={};_0x172d94[_0x509070]={'$like':'%'+_0xe5bb2f[_0x651d('0x49')]['filter']+'%'};return _0x172d94;})});}_0x3c1b84=_['merge']({},_0x3c1b84,_0xe5bb2f[_0x651d('0x57')]);return _0x51f0d0[_0x651d('0xe5')](_0x3c1b84);}})[_0x651d('0x3a')](function(_0x27f9e4){if(_0x27f9e4){_0x1abb38=_0x27f9e4[_0x651d('0x4e')];if(!_0xe5bb2f[_0x651d('0x49')][_0x651d('0x4f')]('nolimit')){_0x3c1b84[_0x651d('0x33')]=qs[_0x651d('0x33')](_0xe5bb2f[_0x651d('0x49')][_0x651d('0x33')]);_0x3c1b84[_0x651d('0x31')]=qs['offset'](_0xe5bb2f[_0x651d('0x49')][_0x651d('0x31')]);}return _0x51f0d0[_0x651d('0xe5')](_0x3c1b84);}})['then'](function(_0x50c20c){if(_0x50c20c){return _0x50c20c?{'count':_0x1abb38,'rows':_0x50c20c}:null;}})[_0x651d('0x3a')](respondWithResult(_0x54d92e,null))[_0x651d('0x2c')](handleError(_0x54d92e,null));}; \ No newline at end of file +var _0xfb73=['ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','send','\x0a','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','to\x20is\x20mandatory','CmList','List','ListId','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','inspect','error_code','DELIVERED_TO_GATEWAY','ACCEPTD','statusGet','state','message-id','addAgents','removeAgents','emit','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','SmsAccounts','UserProfileResource','destroy','end','stack','name','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','Pause','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','params','SmsAccountId','Disposition','getDispositions','removeDispositions','ids','CannedAnswer','findOne','removeAnswers','sms','SmsApplication','account','applications','orderBy','Applications','priority','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','From','messageId','skebby','from','sender','text','connectel','clicksend','message_id','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','CmContact','contact','SmsInteraction','spread','interaction','created','autoclose','close','unmanaged','*,*,*,*','SmsMessage'];(function(_0x33cf30,_0x1d61c8){var _0x4ea338=function(_0x1f44b2){while(--_0x1f44b2){_0x33cf30['push'](_0x33cf30['shift']());}};_0x4ea338(++_0x1d61c8);}(_0xfb73,0x119));var _0x3fb7=function(_0x24b6da,_0x23bd55){_0x24b6da=_0x24b6da-0x0;var _0x464dd9=_0xfb73[_0x24b6da];return _0x464dd9;};'use strict';var emlformat=require(_0x3fb7('0x0'));var rimraf=require(_0x3fb7('0x1'));var zipdir=require(_0x3fb7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fb7('0x3'));var moment=require('moment');var BPromise=require(_0x3fb7('0x4'));var Mustache=require('mustache');var util=require(_0x3fb7('0x5'));var path=require('path');var sox=require(_0x3fb7('0x6'));var csv=require(_0x3fb7('0x7'));var ejs=require(_0x3fb7('0x8'));var fs=require('fs');var fs_extra=require(_0x3fb7('0x9'));var _=require(_0x3fb7('0xa'));var squel=require(_0x3fb7('0xb'));var crypto=require(_0x3fb7('0xc'));var jsforce=require(_0x3fb7('0xd'));var deskjs=require(_0x3fb7('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3fb7('0xf'));var Redis=require(_0x3fb7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3fb7('0x11'));var as=require(_0x3fb7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3fb7('0x13'))(_0x3fb7('0x14'));var utils=require(_0x3fb7('0x15'));var config=require(_0x3fb7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x3fb7('0x17'))['db'];config[_0x3fb7('0x18')]=_[_0x3fb7('0x19')](config[_0x3fb7('0x18')],{'host':_0x3fb7('0x1a'),'port':0x18eb});var socket=require(_0x3fb7('0x1b'))(new Redis(config[_0x3fb7('0x18')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x3fb7('0x1c'));var client=jayson[_0x3fb7('0x1d')][_0x3fb7('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x30664e,_0x3c2eef,_0x361ac3,_0x218405){return new BPromise(function(_0x2cffe5,_0x82df9f){var _0x50cdd2=_0x218405||client;return _0x50cdd2[_0x3fb7('0x1f')](_0x30664e,_0x361ac3)['then'](function(_0x127d67){logger[_0x3fb7('0x20')]('SmsAccount,\x20%s,\x20%s',_0x3c2eef,'request\x20sent');logger['debug'](_0x3fb7('0x21'),_0x3c2eef,_0x3fb7('0x22'),JSON['stringify'](_0x127d67));if(_0x127d67[_0x3fb7('0x23')]){if(_0x127d67[_0x3fb7('0x23')][_0x3fb7('0x24')]===0x1f4){logger[_0x3fb7('0x23')](_0x3fb7('0x25'),_0x3c2eef,_0x127d67[_0x3fb7('0x23')]['message']);return _0x82df9f(_0x127d67[_0x3fb7('0x23')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x3c2eef,_0x127d67[_0x3fb7('0x23')][_0x3fb7('0x26')]);return _0x2cffe5(_0x127d67[_0x3fb7('0x23')][_0x3fb7('0x26')]);}else{logger[_0x3fb7('0x20')](_0x3fb7('0x25'),_0x3c2eef,'request\x20sent');_0x2cffe5(_0x127d67[_0x3fb7('0x27')]['message']);}})[_0x3fb7('0x28')](function(_0x2139fd){logger[_0x3fb7('0x23')](_0x3fb7('0x25'),_0x3c2eef,_0x2139fd);_0x82df9f(_0x2139fd);});});}function respondWithStatusCode(_0x4d98b4,_0x1f536d){_0x1f536d=_0x1f536d||0xcc;return function(_0x21bc9e){if(_0x21bc9e){return _0x4d98b4[_0x3fb7('0x29')](_0x1f536d);}return _0x4d98b4[_0x3fb7('0x2a')](_0x1f536d)['end']();};}function respondWithResult(_0x5f2e7a,_0x8cb9cb){_0x8cb9cb=_0x8cb9cb||0xc8;return function(_0x590b24){if(_0x590b24){return _0x5f2e7a[_0x3fb7('0x2a')](_0x8cb9cb)['json'](_0x590b24);}};}function respondWithFilteredResult(_0x12a8fb,_0x1d2996){return function(_0x4e3f80){if(_0x4e3f80){var _0x2399d7=typeof _0x1d2996[_0x3fb7('0x2b')]===_0x3fb7('0x2c')&&typeof _0x1d2996[_0x3fb7('0x2d')]==='undefined';var _0x5e0c85=_0x4e3f80[_0x3fb7('0x2e')];var _0x21e988=_0x2399d7?0x0:_0x1d2996[_0x3fb7('0x2b')];var _0x3799e0=_0x2399d7?_0x4e3f80[_0x3fb7('0x2e')]:_0x1d2996[_0x3fb7('0x2b')]+_0x1d2996[_0x3fb7('0x2d')];var _0x18cf53;if(_0x3799e0>=_0x5e0c85){_0x3799e0=_0x5e0c85;_0x18cf53=0xc8;}else{_0x18cf53=0xce;}_0x12a8fb[_0x3fb7('0x2a')](_0x18cf53);return _0x12a8fb[_0x3fb7('0x2f')]('Content-Range',_0x21e988+'-'+_0x3799e0+'/'+_0x5e0c85)['json'](_0x4e3f80);}return null;};}function patchUpdates(_0x954e58){return function(_0x569b65){try{jsonpatch[_0x3fb7('0x30')](_0x569b65,_0x954e58,!![]);}catch(_0x39fc4f){return BPromise['reject'](_0x39fc4f);}return _0x569b65['save']();};}function saveUpdates(_0xfa8fe4,_0x50eaf8){return function(_0x3b4f4d){if(_0x3b4f4d){return _0x3b4f4d[_0x3fb7('0x31')](_0xfa8fe4)[_0x3fb7('0x32')](function(_0x1cc0f5){return _0x1cc0f5;});}return null;};}function removeEntity(_0x1521e6,_0x974f98){return function(_0x22b681){if(_0x22b681){return _0x22b681['destroy']()['then'](function(){var _0x240bd0=_0x22b681['get']({'plain':!![]});var _0x3631c9=_0x3fb7('0x33');return db[_0x3fb7('0x34')][_0x3fb7('0x35')]({'where':{'type':_0x3631c9,'resourceId':_0x240bd0['id']}})[_0x3fb7('0x32')](function(){return _0x22b681;});})[_0x3fb7('0x32')](function(){_0x1521e6[_0x3fb7('0x2a')](0xcc)[_0x3fb7('0x36')]();});}};}function handleEntityNotFound(_0x1154db,_0x2e5479){return function(_0x58f935){if(!_0x58f935){_0x1154db['sendStatus'](0x194);}return _0x58f935;};}function handleError(_0x57e26d,_0x40407d){_0x40407d=_0x40407d||0x1f4;return function(_0x2bdb67){logger[_0x3fb7('0x23')](_0x2bdb67[_0x3fb7('0x37')]);if(_0x2bdb67[_0x3fb7('0x38')]){delete _0x2bdb67[_0x3fb7('0x38')];}_0x57e26d[_0x3fb7('0x2a')](_0x40407d)['send'](_0x2bdb67);};}exports[_0x3fb7('0x39')]=function(_0x11b4f9,_0x2acd85){var _0x52118e={'include':[{'model':db['Pause'],'as':_0x3fb7('0x3a')}]},_0x482cda={},_0x516b63={'count':0x0,'rows':[]};var _0x3b89e7=_[_0x3fb7('0x3b')](db[_0x3fb7('0x3c')][_0x3fb7('0x3d')],function(_0x321a32){return{'name':_0x321a32['fieldName'],'type':_0x321a32[_0x3fb7('0x3e')][_0x3fb7('0x3f')]};});_0x482cda[_0x3fb7('0x40')]=_[_0x3fb7('0x3b')](_0x3b89e7,_0x3fb7('0x38'));_0x482cda[_0x3fb7('0x41')]=_[_0x3fb7('0x42')](_0x11b4f9[_0x3fb7('0x41')]);_0x482cda[_0x3fb7('0x43')]=_['intersection'](_0x482cda['model'],_0x482cda[_0x3fb7('0x41')]);_0x52118e[_0x3fb7('0x44')]=_[_0x3fb7('0x45')](_0x482cda[_0x3fb7('0x40')],qs[_0x3fb7('0x46')](_0x11b4f9[_0x3fb7('0x41')][_0x3fb7('0x46')]));_0x52118e[_0x3fb7('0x44')]=_0x52118e[_0x3fb7('0x44')][_0x3fb7('0x47')]?_0x52118e[_0x3fb7('0x44')]:_0x482cda['model'];if(!_0x11b4f9[_0x3fb7('0x41')][_0x3fb7('0x48')](_0x3fb7('0x49'))){_0x52118e[_0x3fb7('0x2d')]=qs[_0x3fb7('0x2d')](_0x11b4f9[_0x3fb7('0x41')][_0x3fb7('0x2d')]);_0x52118e[_0x3fb7('0x2b')]=qs['offset'](_0x11b4f9[_0x3fb7('0x41')][_0x3fb7('0x2b')]);}_0x52118e[_0x3fb7('0x4a')]=qs[_0x3fb7('0x4b')](_0x11b4f9['query'][_0x3fb7('0x4b')]);_0x52118e['where']=qs[_0x3fb7('0x43')](_[_0x3fb7('0x4c')](_0x11b4f9[_0x3fb7('0x41')],_0x482cda[_0x3fb7('0x43')]),_0x3b89e7);if(_0x11b4f9[_0x3fb7('0x41')][_0x3fb7('0x4d')]){_0x52118e[_0x3fb7('0x4e')]=_[_0x3fb7('0x4f')](_0x52118e[_0x3fb7('0x4e')],{'$or':_[_0x3fb7('0x3b')](_0x3b89e7,function(_0x1bc9fe){if(_0x1bc9fe[_0x3fb7('0x3e')]!=='VIRTUAL'){var _0x1f1b85={};_0x1f1b85[_0x1bc9fe[_0x3fb7('0x38')]]={'$like':'%'+_0x11b4f9[_0x3fb7('0x41')][_0x3fb7('0x4d')]+'%'};return _0x1f1b85;}})});}_0x52118e=_[_0x3fb7('0x4f')]({},_0x52118e,_0x11b4f9[_0x3fb7('0x50')]);var _0x20047d={'where':_0x52118e['where']};return db[_0x3fb7('0x3c')][_0x3fb7('0x2e')](_0x20047d)[_0x3fb7('0x32')](function(_0x276a45){_0x516b63['count']=_0x276a45;if(_0x11b4f9[_0x3fb7('0x41')][_0x3fb7('0x51')]){_0x52118e[_0x3fb7('0x52')]=[{'all':!![]}];}return db[_0x3fb7('0x3c')][_0x3fb7('0x53')](_0x52118e);})[_0x3fb7('0x32')](function(_0x4260d2){_0x516b63[_0x3fb7('0x54')]=_0x4260d2;return _0x516b63;})[_0x3fb7('0x32')](respondWithFilteredResult(_0x2acd85,_0x52118e))['catch'](handleError(_0x2acd85,null));};exports['show']=function(_0xd580da,_0x10d932){var _0x34791e={'raw':![],'where':{'id':_0xd580da['params']['id']},'include':[{'model':db[_0x3fb7('0x55')],'as':_0x3fb7('0x3a')}]},_0x369715={};_0x369715['model']=_[_0x3fb7('0x42')](db['SmsAccount'][_0x3fb7('0x3d')]);_0x369715['query']=_[_0x3fb7('0x42')](_0xd580da[_0x3fb7('0x41')]);_0x369715[_0x3fb7('0x43')]=_[_0x3fb7('0x45')](_0x369715[_0x3fb7('0x40')],_0x369715[_0x3fb7('0x41')]);_0x34791e[_0x3fb7('0x44')]=_['intersection'](_0x369715[_0x3fb7('0x40')],qs[_0x3fb7('0x46')](_0xd580da[_0x3fb7('0x41')][_0x3fb7('0x46')]));_0x34791e[_0x3fb7('0x44')]=_0x34791e[_0x3fb7('0x44')]['length']?_0x34791e[_0x3fb7('0x44')]:_0x369715[_0x3fb7('0x40')];if(_0xd580da[_0x3fb7('0x41')][_0x3fb7('0x51')]){_0x34791e['include']=[{'all':!![]}];}_0x34791e=_[_0x3fb7('0x4f')]({},_0x34791e,_0xd580da[_0x3fb7('0x50')]);return db[_0x3fb7('0x3c')]['find'](_0x34791e)['then'](handleEntityNotFound(_0x10d932,null))[_0x3fb7('0x32')](respondWithResult(_0x10d932,null))[_0x3fb7('0x28')](handleError(_0x10d932,null));};exports[_0x3fb7('0x56')]=function(_0x30fdb7,_0xb8d223){return db[_0x3fb7('0x3c')][_0x3fb7('0x56')](_0x30fdb7[_0x3fb7('0x57')],{})[_0x3fb7('0x32')](function(_0x750cd1){var _0x21be39=_0x30fdb7['user'][_0x3fb7('0x58')]({'plain':!![]});if(!_0x21be39)throw new Error(_0x3fb7('0x59'));if(_0x21be39[_0x3fb7('0x5a')]===_0x3fb7('0x5b')){var _0x1fc3bf=_0x750cd1['get']({'plain':!![]});var _0xa5b755='SmsAccounts';return db[_0x3fb7('0x5c')][_0x3fb7('0x5d')]({'where':{'name':_0xa5b755,'userProfileId':_0x21be39[_0x3fb7('0x5e')]},'raw':!![]})[_0x3fb7('0x32')](function(_0x254f77){if(_0x254f77&&_0x254f77[_0x3fb7('0x5f')]===0x0){return db[_0x3fb7('0x34')][_0x3fb7('0x56')]({'name':_0x1fc3bf[_0x3fb7('0x38')],'resourceId':_0x1fc3bf['id'],'type':_0x254f77[_0x3fb7('0x38')],'sectionId':_0x254f77['id']},{})[_0x3fb7('0x32')](function(){return _0x750cd1;});}else{return _0x750cd1;}})[_0x3fb7('0x28')](function(_0x4b6282){logger['error'](_0x3fb7('0x60'),_0x4b6282);throw _0x4b6282;});}return _0x750cd1;})[_0x3fb7('0x32')](respondWithResult(_0xb8d223,0xc9))[_0x3fb7('0x28')](handleError(_0xb8d223,null));};exports[_0x3fb7('0x31')]=function(_0x2e93a8,_0x59d088){if(_0x2e93a8[_0x3fb7('0x57')]['id']){delete _0x2e93a8[_0x3fb7('0x57')]['id'];}return db['SmsAccount'][_0x3fb7('0x5d')]({'where':{'id':_0x2e93a8['params']['id']},'include':[{'model':db[_0x3fb7('0x55')],'as':_0x3fb7('0x3a')}]})[_0x3fb7('0x32')](handleEntityNotFound(_0x59d088,null))[_0x3fb7('0x32')](saveUpdates(_0x2e93a8[_0x3fb7('0x57')],null))[_0x3fb7('0x32')](respondWithResult(_0x59d088,null))['catch'](handleError(_0x59d088,null));};exports[_0x3fb7('0x35')]=function(_0xf2c426,_0x457bf0){return db[_0x3fb7('0x3c')][_0x3fb7('0x5d')]({'where':{'id':_0xf2c426['params']['id']}})[_0x3fb7('0x32')](handleEntityNotFound(_0x457bf0,null))['then'](removeEntity(_0x457bf0,null))[_0x3fb7('0x28')](handleError(_0x457bf0,null));};exports[_0x3fb7('0x61')]=function(_0x1d2469,_0x3f3827){return db['SmsAccount'][_0x3fb7('0x61')]()['then'](respondWithResult(_0x3f3827,null))['catch'](handleError(_0x3f3827,null));};exports[_0x3fb7('0x62')]=function(_0x269cd7,_0x4e1b0c,_0x39b506){if(_0x269cd7[_0x3fb7('0x57')]['id']){delete _0x269cd7['body']['id'];}return db['SmsAccount'][_0x3fb7('0x5d')]({'where':{'id':_0x269cd7[_0x3fb7('0x63')]['id']}})[_0x3fb7('0x32')](handleEntityNotFound(_0x4e1b0c,null))[_0x3fb7('0x32')](function(_0x103cb3){if(_0x103cb3){_0x269cd7[_0x3fb7('0x57')][_0x3fb7('0x64')]=_0x103cb3['id'];return db[_0x3fb7('0x65')][_0x3fb7('0x56')](_0x269cd7[_0x3fb7('0x57')]);}})['then'](respondWithResult(_0x4e1b0c,null))[_0x3fb7('0x28')](handleError(_0x4e1b0c,null));};exports[_0x3fb7('0x66')]=function(_0x4efd1d,_0x24b62a,_0x5b5a79){var _0x206779={'raw':![],'where':{}};var _0x31c913={};var _0x5c855c={'count':0x0,'rows':[]};return db[_0x3fb7('0x3c')]['findOne']({'where':{'id':_0x4efd1d['params']['id']}})['then'](handleEntityNotFound(_0x24b62a,null))[_0x3fb7('0x32')](function(_0x5576f7){if(_0x5576f7){_0x31c913[_0x3fb7('0x40')]=_['keys'](db[_0x3fb7('0x65')][_0x3fb7('0x3d')]);_0x31c913[_0x3fb7('0x41')]=_[_0x3fb7('0x42')](_0x4efd1d['query']);_0x31c913[_0x3fb7('0x43')]=_[_0x3fb7('0x45')](_0x31c913[_0x3fb7('0x40')],_0x31c913[_0x3fb7('0x41')]);_0x206779[_0x3fb7('0x44')]=_[_0x3fb7('0x45')](_0x31c913['model'],qs[_0x3fb7('0x46')](_0x4efd1d[_0x3fb7('0x41')][_0x3fb7('0x46')]));_0x206779['attributes']=_0x206779[_0x3fb7('0x44')]['length']?_0x206779[_0x3fb7('0x44')]:_0x31c913[_0x3fb7('0x40')];if(!_0x4efd1d[_0x3fb7('0x41')][_0x3fb7('0x48')](_0x3fb7('0x49'))){_0x206779[_0x3fb7('0x2d')]=qs['limit'](_0x4efd1d[_0x3fb7('0x41')]['limit']);_0x206779['offset']=qs['offset'](_0x4efd1d[_0x3fb7('0x41')]['offset']);}_0x206779[_0x3fb7('0x4a')]=qs['sort'](_0x4efd1d[_0x3fb7('0x41')][_0x3fb7('0x4b')]);_0x206779[_0x3fb7('0x4e')]=qs[_0x3fb7('0x43')](_[_0x3fb7('0x4c')](_0x4efd1d[_0x3fb7('0x41')],_0x31c913[_0x3fb7('0x43')]));_0x206779[_0x3fb7('0x4e')][_0x3fb7('0x64')]=_0x5576f7['id'];if(_0x4efd1d[_0x3fb7('0x41')][_0x3fb7('0x4d')]){_0x206779[_0x3fb7('0x4e')]=_[_0x3fb7('0x4f')](_0x206779['where'],{'$or':_[_0x3fb7('0x3b')](_0x206779[_0x3fb7('0x44')],function(_0x1685e1){var _0x478943={};_0x478943[_0x1685e1]={'$like':'%'+_0x4efd1d[_0x3fb7('0x41')]['filter']+'%'};return _0x478943;})});}_0x206779=_[_0x3fb7('0x4f')]({},_0x206779,_0x4efd1d[_0x3fb7('0x50')]);return db[_0x3fb7('0x65')][_0x3fb7('0x2e')]({'where':_0x206779['where']})['then'](function(_0xabf330){_0x5c855c[_0x3fb7('0x2e')]=_0xabf330;if(_0x4efd1d['query'][_0x3fb7('0x51')]){_0x206779['include']=[{'all':!![]}];}return db[_0x3fb7('0x65')][_0x3fb7('0x53')](_0x206779);})['then'](function(_0x5b0c02){_0x5c855c[_0x3fb7('0x54')]=_0x5b0c02;return _0x5c855c;});}})[_0x3fb7('0x32')](respondWithFilteredResult(_0x24b62a,_0x206779))['catch'](handleError(_0x24b62a,null));};exports['removeDispositions']=function(_0x41c1b2,_0x1a4378,_0x4e4874){return db[_0x3fb7('0x3c')][_0x3fb7('0x5d')]({'where':{'id':_0x41c1b2[_0x3fb7('0x63')]['id']}})[_0x3fb7('0x32')](handleEntityNotFound(_0x1a4378,null))[_0x3fb7('0x32')](function(_0x4e3f6f){if(_0x4e3f6f){return _0x4e3f6f[_0x3fb7('0x67')](_0x41c1b2['query'][_0x3fb7('0x68')]);}})[_0x3fb7('0x32')](respondWithStatusCode(_0x1a4378,null))[_0x3fb7('0x28')](handleError(_0x1a4378,null));};exports['addAnswer']=function(_0x128744,_0x54ad88,_0x2eb84f){if(_0x128744[_0x3fb7('0x57')]['id']){delete _0x128744[_0x3fb7('0x57')]['id'];}return db['SmsAccount'][_0x3fb7('0x5d')]({'where':{'id':_0x128744[_0x3fb7('0x63')]['id']}})[_0x3fb7('0x32')](handleEntityNotFound(_0x54ad88,null))[_0x3fb7('0x32')](function(_0x5a8eb2){if(_0x5a8eb2){_0x128744[_0x3fb7('0x57')][_0x3fb7('0x64')]=_0x5a8eb2['id'];return db[_0x3fb7('0x69')][_0x3fb7('0x56')](_0x128744[_0x3fb7('0x57')]);}})[_0x3fb7('0x32')](respondWithResult(_0x54ad88,null))[_0x3fb7('0x28')](handleError(_0x54ad88,null));};exports['getAnswers']=function(_0x565586,_0xb7ba0,_0x27290d){var _0x4d3155={'raw':![],'where':{}};var _0x1f6ab5={};var _0x5814b1={'count':0x0,'rows':[]};return db[_0x3fb7('0x3c')][_0x3fb7('0x6a')]({'where':{'id':_0x565586[_0x3fb7('0x63')]['id']}})[_0x3fb7('0x32')](handleEntityNotFound(_0xb7ba0,null))[_0x3fb7('0x32')](function(_0x41a217){if(_0x41a217){_0x1f6ab5[_0x3fb7('0x40')]=_[_0x3fb7('0x42')](db[_0x3fb7('0x69')][_0x3fb7('0x3d')]);_0x1f6ab5[_0x3fb7('0x41')]=_[_0x3fb7('0x42')](_0x565586[_0x3fb7('0x41')]);_0x1f6ab5[_0x3fb7('0x43')]=_[_0x3fb7('0x45')](_0x1f6ab5[_0x3fb7('0x40')],_0x1f6ab5[_0x3fb7('0x41')]);_0x4d3155[_0x3fb7('0x44')]=_[_0x3fb7('0x45')](_0x1f6ab5[_0x3fb7('0x40')],qs[_0x3fb7('0x46')](_0x565586[_0x3fb7('0x41')][_0x3fb7('0x46')]));_0x4d3155['attributes']=_0x4d3155[_0x3fb7('0x44')][_0x3fb7('0x47')]?_0x4d3155['attributes']:_0x1f6ab5[_0x3fb7('0x40')];if(!_0x565586[_0x3fb7('0x41')][_0x3fb7('0x48')]('nolimit')){_0x4d3155[_0x3fb7('0x2d')]=qs['limit'](_0x565586[_0x3fb7('0x41')][_0x3fb7('0x2d')]);_0x4d3155[_0x3fb7('0x2b')]=qs['offset'](_0x565586['query'][_0x3fb7('0x2b')]);}_0x4d3155[_0x3fb7('0x4a')]=qs[_0x3fb7('0x4b')](_0x565586[_0x3fb7('0x41')][_0x3fb7('0x4b')]);_0x4d3155[_0x3fb7('0x4e')]=qs[_0x3fb7('0x43')](_[_0x3fb7('0x4c')](_0x565586[_0x3fb7('0x41')],_0x1f6ab5['filters']));_0x4d3155['where'][_0x3fb7('0x64')]=_0x41a217['id'];if(_0x565586[_0x3fb7('0x41')]['filter']){_0x4d3155[_0x3fb7('0x4e')]=_[_0x3fb7('0x4f')](_0x4d3155[_0x3fb7('0x4e')],{'$or':_[_0x3fb7('0x3b')](_0x4d3155[_0x3fb7('0x44')],function(_0x2ba446){var _0x43fad2={};_0x43fad2[_0x2ba446]={'$like':'%'+_0x565586['query'][_0x3fb7('0x4d')]+'%'};return _0x43fad2;})});}_0x4d3155=_[_0x3fb7('0x4f')]({},_0x4d3155,_0x565586[_0x3fb7('0x50')]);return db[_0x3fb7('0x69')][_0x3fb7('0x2e')]({'where':_0x4d3155[_0x3fb7('0x4e')]})[_0x3fb7('0x32')](function(_0x3b0adf){_0x5814b1[_0x3fb7('0x2e')]=_0x3b0adf;if(_0x565586[_0x3fb7('0x41')]['includeAll']){_0x4d3155[_0x3fb7('0x52')]=[{'all':!![]}];}return db[_0x3fb7('0x69')][_0x3fb7('0x53')](_0x4d3155);})[_0x3fb7('0x32')](function(_0x47705b){_0x5814b1['rows']=_0x47705b;return _0x5814b1;});}})[_0x3fb7('0x32')](respondWithFilteredResult(_0xb7ba0,_0x4d3155))[_0x3fb7('0x28')](handleError(_0xb7ba0,null));};exports[_0x3fb7('0x6b')]=function(_0x2c8533,_0x58f277,_0x2e7c5b){return db[_0x3fb7('0x3c')][_0x3fb7('0x5d')]({'where':{'id':_0x2c8533[_0x3fb7('0x63')]['id']}})[_0x3fb7('0x32')](handleEntityNotFound(_0x58f277,null))[_0x3fb7('0x32')](function(_0x3813b3){if(_0x3813b3){return _0x3813b3[_0x3fb7('0x6b')](_0x2c8533[_0x3fb7('0x41')][_0x3fb7('0x68')]);}})[_0x3fb7('0x32')](respondWithStatusCode(_0x58f277,null))[_0x3fb7('0x28')](handleError(_0x58f277,null));};exports['notify']=function(_0x5970c9,_0x30a7b2,_0x49ac2b){var _0x81afc0={'channel':_0x3fb7('0x6c')};var _0x265b31=[];var _0x2098b7=[];var _0x305ff0={};return db['SmsAccount']['find']({'where':{'id':_0x5970c9[_0x3fb7('0x63')]['id']},'include':[{'model':db[_0x3fb7('0x6d')],'as':'Applications'}]})[_0x3fb7('0x32')](handleEntityNotFound(_0x30a7b2,null))['then'](function(_0x503ac0){_0x81afc0[_0x3fb7('0x6e')]=_0x503ac0;_0x81afc0[_0x3fb7('0x6f')]=_[_0x3fb7('0x70')](_0x503ac0[_0x3fb7('0x71')],[_0x3fb7('0x72')],[_0x3fb7('0x73')]);if(_0x81afc0[_0x3fb7('0x6e')][_0x3fb7('0x71')]){delete _0x81afc0[_0x3fb7('0x6e')][_0x3fb7('0x71')];}return db['CmContact'][_0x3fb7('0x61')]();})[_0x3fb7('0x32')](function(_0xc3dd1){if(!_0xc3dd1){throw new db[(_0x3fb7('0x74'))][(_0x3fb7('0x75'))](_0x3fb7('0x76'));}_0x265b31=_[_0x3fb7('0x77')](_[_0x3fb7('0x42')](_0xc3dd1),[_0x3fb7('0x78'),_0x3fb7('0x79')]);_0x2098b7=_['difference'](_[_0x3fb7('0x42')](_0xc3dd1),[_0x3fb7('0x78'),'updatedAt',_0x3fb7('0x7a'),'ListId']);_0x81afc0['body']={'mapKey':_0x3fb7('0x7b')};if(_0x81afc0[_0x3fb7('0x6e')][_0x3fb7('0x3e')]){switch(_0x81afc0[_0x3fb7('0x6e')]['type']){case _0x3fb7('0x7c'):_0x81afc0[_0x3fb7('0x57')]['from']=_0x5970c9['body'][_0x3fb7('0x7d')];_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x57')]=_0x5970c9[_0x3fb7('0x57')]['Body'];_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x7e')]=_0x5970c9[_0x3fb7('0x57')]['MessageSid'];break;case _0x3fb7('0x7f'):_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x80')]='+'+_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x81')];_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x57')]=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x82')];break;case _0x3fb7('0x83'):_0x81afc0[_0x3fb7('0x57')]['from']=_0x5970c9[_0x3fb7('0x57')]['from'];_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x57')]=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x26')];break;case _0x3fb7('0x84'):_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x80')]=_0x5970c9['body'][_0x3fb7('0x80')];_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x57')]=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x57')];_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x7e')]=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x85')];break;case'plivo':_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x80')]=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x7d')];_0x81afc0['body'][_0x3fb7('0x57')]=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x86')];_0x81afc0['body'][_0x3fb7('0x7e')]=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x87')];break;case _0x3fb7('0x88'):_0x81afc0['body'][_0x3fb7('0x80')]='+'+_0x5970c9['body']['results'][0x0][_0x3fb7('0x80')];_0x81afc0['body'][_0x3fb7('0x57')]=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x89')][0x0]['text'];_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x7e')]=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x89')][0x0]['messageId'];break;case _0x3fb7('0x8a'):_0x81afc0['body'][_0x3fb7('0x80')]=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x8b')];_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x57')]=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x8c')][_0x3fb7('0x26')];break;case _0x3fb7('0x8d'):_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x80')]=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x8e')];_0x81afc0[_0x3fb7('0x57')]['body']=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x82')];_0x81afc0[_0x3fb7('0x57')]['messageId']=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x8f')];break;case _0x3fb7('0x90'):_0x81afc0[_0x3fb7('0x57')]['messageId']=_0x5970c9[_0x3fb7('0x57')][0x0]['message']['id'];_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x80')]=_0x5970c9[_0x3fb7('0x57')][0x0][_0x3fb7('0x26')][_0x3fb7('0x80')];_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x57')]=_0x5970c9[_0x3fb7('0x57')][0x0][_0x3fb7('0x26')][_0x3fb7('0x82')];break;case _0x3fb7('0x91'):_0x81afc0[_0x3fb7('0x57')]['from']=_0x5970c9['body'][_0x3fb7('0x80')];_0x81afc0[_0x3fb7('0x57')]['body']=_0x5970c9['body'][_0x3fb7('0x26')];_0x81afc0[_0x3fb7('0x57')]['messageId']=_0x5970c9[_0x3fb7('0x57')][_0x3fb7('0x92')];break;}}if(_0x81afc0[_0x3fb7('0x57')]['id']){delete _0x81afc0[_0x3fb7('0x57')]['id'];}if(_[_0x3fb7('0x93')](_0x81afc0['body'][_0x3fb7('0x80')])){throw new db[(_0x3fb7('0x74'))][(_0x3fb7('0x75'))](_0x3fb7('0x94'));}if(_[_0x3fb7('0x93')](_0x81afc0[_0x3fb7('0x57')]['body'])||_0x81afc0['body'][_0x3fb7('0x57')]===''){throw new db[(_0x3fb7('0x74'))]['ValidationError'](_0x3fb7('0x95'));}if(_['isNil'](_0x81afc0['body']['mapKey'])){throw new db[(_0x3fb7('0x74'))]['ValidationError'](_0x3fb7('0x96')+_0x2098b7);}if(!_[_0x3fb7('0x97')](_0x2098b7,_0x81afc0['body'][_0x3fb7('0x98')])){throw new db[(_0x3fb7('0x74'))]['ValidationError'](_0x3fb7('0x99')+_0x2098b7);}_0x305ff0[_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x98')]]=_0x81afc0['body'][_0x3fb7('0x80')];return db['CmList'][_0x3fb7('0x5d')]({'where':{'id':_0x81afc0[_0x3fb7('0x6e')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x3fb7('0x9a'),'where':_0x305ff0,'limit':0x1,'order':[['updatedAt',_0x3fb7('0x9b')]]}]});})['then'](handleEntityNotFound(_0x30a7b2,null))['then'](function(_0xbf9fc7){if(_0xbf9fc7){_0x81afc0[_0x3fb7('0x9c')]=_[_0x3fb7('0x9d')](_0xbf9fc7,['Contacts']);if(_0xbf9fc7[_0x3fb7('0x9a')][_0x3fb7('0x47')]){return _0xbf9fc7['Contacts'][0x0];}var _0x1047c1=_[_0x3fb7('0x19')](_0x81afc0[_0x3fb7('0x57')],{'firstName':_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x80')],'ListId':_0xbf9fc7['id']});_0x1047c1[_0x81afc0['body']['mapKey']]=_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x80')];return db[_0x3fb7('0x9e')]['create'](_0x1047c1,{'fields':_0x265b31,'raw':!![]});}})['then'](handleEntityNotFound(_0x30a7b2,null))['then'](function(_0x3e4a48){if(_0x3e4a48){_0x81afc0[_0x3fb7('0x9f')]=_0x3e4a48;var _0x222b9c={'ContactId':_0x3e4a48['id'],'phone':_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x80')],'SmsAccountId':_0x5970c9[_0x3fb7('0x63')]['id']};var _0x576550={'ContactId':_0x3e4a48['id'],'SmsAccountId':_0x5970c9['params']['id'],'closed':![]};return db['SmsInteraction']['find']({'where':_0x576550})[_0x3fb7('0x32')](function(_0x4a1536){if(_0x4a1536){return[_0x4a1536,![]];}return db[_0x3fb7('0xa0')]['create'](_0x222b9c)[_0x3fb7('0x32')](function(_0x1c7e19){return[_0x1c7e19,!![]];});});}})[_0x3fb7('0xa1')](function(_0x58ab5c,_0x34fdcd){_0x81afc0[_0x3fb7('0xa2')]=_0x58ab5c[_0x3fb7('0x58')]({'plain':!![]});_0x81afc0[_0x3fb7('0xa2')][_0x3fb7('0xa3')]=![];if(_0x34fdcd){if(_0x81afc0[_0x3fb7('0x6e')][_0x3fb7('0xa4')]){_0x81afc0['applications']['push']({'id':0x0,'priority':_0x81afc0[_0x3fb7('0x6f')][_0x3fb7('0x47')]+0x1,'app':_0x3fb7('0xa5'),'appdata':_0x3fb7('0xa6'),'interval':_0x3fb7('0xa7')});}_0x81afc0[_0x3fb7('0xa2')]['created']=!![];}return db[_0x3fb7('0xa8')]['create']({'phone':_0x81afc0[_0x3fb7('0x57')]['from'],'messageId':_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x7e')],'body':_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0x57')],'SmsAccountId':_0x5970c9[_0x3fb7('0x63')]['id'],'SmsInteractionId':_0x58ab5c['id'],'direction':'in','ContactId':_0x58ab5c[_0x3fb7('0xa9')],'AttachmentId':_0x81afc0[_0x3fb7('0x57')][_0x3fb7('0xaa')]});})[_0x3fb7('0x32')](function(_0x144349){_0x81afc0[_0x3fb7('0x26')]=_0x144349;if(_0x81afc0[_0x3fb7('0xa2')][_0x3fb7('0xab')]){return db[_0x3fb7('0xac')][_0x3fb7('0x5d')]({'attributes':['id','name'],'where':{'id':_0x81afc0[_0x3fb7('0xa2')]['UserId']}})[_0x3fb7('0x32')](function(_0x2049ee){if(_0x2049ee){_0x81afc0[_0x3fb7('0x6f')][_0x3fb7('0xad')]({'id':0x0,'priority':0x0,'app':_0x3fb7('0xae'),'appdata':_0x2049ee[_0x3fb7('0x38')]+','+(_0x81afc0['account'][_0x3fb7('0xaf')]||0xa),'interval':_0x3fb7('0xa7')});}return respondWithRpcPromise('Start',_0x3fb7('0xb0'),_0x81afc0);});}return respondWithRpcPromise(_0x3fb7('0xb1'),_0x3fb7('0xb0'),_0x81afc0);})['then'](function(_0x24a7a9){if(_0x24a7a9){var _0x2fd134=0xc8;var _0x1a3e5d=_0x3fb7('0xb2');logger['info'](_0x3fb7('0x21'),_0x1a3e5d,_0x2fd134,_0x3fb7('0xb3'));logger[_0x3fb7('0xb4')](_0x3fb7('0xb5'),_0x1a3e5d,_0x2fd134,_0x3fb7('0xb3'),JSON['stringify'](_0x24a7a9));if(_0x81afc0[_0x3fb7('0x6e')]['type']===_0x3fb7('0x7c')){return _0x30a7b2[_0x3fb7('0x2a')](_0x2fd134)['set'](_0x3fb7('0xb6'),'text/xml')[_0x3fb7('0xb7')](_0x3fb7('0xb8'));}else{return _0x30a7b2[_0x3fb7('0x2a')](_0x2fd134)['json'](_0x24a7a9);}}})[_0x3fb7('0x28')](handleError(_0x30a7b2,null));};exports[_0x3fb7('0xb9')]=function(_0x3ecf4f,_0x5a258b,_0x37adc5){return db[_0x3fb7('0x3c')]['findOne']({'where':{'id':_0x3ecf4f[_0x3fb7('0x63')]['id']}})[_0x3fb7('0x32')](handleEntityNotFound(_0x5a258b,null))['then'](function(_0x2b6ef5){if(_0x2b6ef5){return db[_0x3fb7('0xba')][_0x3fb7('0xbb')](function(_0x133ab7){return db[_0x3fb7('0x6d')][_0x3fb7('0x35')]({'where':{'SmsAccountId':_0x3ecf4f[_0x3fb7('0x63')]['id']},'transaction':_0x133ab7})[_0x3fb7('0x32')](function(_0x59b7d9){var _0x5415c9=_['map'](_0x3ecf4f[_0x3fb7('0x57')],function(_0x5f0894){_0x5f0894[_0x3fb7('0x64')]=_0x3ecf4f[_0x3fb7('0x63')]['id'];return _0x5f0894;});return db['SmsApplication'][_0x3fb7('0xbc')](_0x5415c9,{'transaction':_0x133ab7});});})[_0x3fb7('0x32')](function(){return db['SmsApplication'][_0x3fb7('0xbd')]({'where':{'SmsAccountId':_0x3ecf4f['params']['id']},'order':'priority'});});}})[_0x3fb7('0x32')](respondWithResult(_0x5a258b,null))[_0x3fb7('0x28')](handleError(_0x5a258b,null));};exports[_0x3fb7('0xbe')]=function(_0x25b00,_0x144d5f,_0x28b91c){var _0xfb3dc6={};var _0x5f4014={};var _0x2fa9a4;var _0x535f79;return db[_0x3fb7('0x3c')][_0x3fb7('0x6a')]({'where':{'id':_0x25b00[_0x3fb7('0x63')]['id']}})[_0x3fb7('0x32')](handleEntityNotFound(_0x144d5f,null))['then'](function(_0xea0fcf){if(_0xea0fcf){_0x2fa9a4=_0xea0fcf;_0x5f4014[_0x3fb7('0x40')]=_[_0x3fb7('0x42')](db['SmsApplication'][_0x3fb7('0x3d')]);_0x5f4014[_0x3fb7('0x41')]=_[_0x3fb7('0x42')](_0x25b00[_0x3fb7('0x41')]);_0x5f4014[_0x3fb7('0x43')]=_[_0x3fb7('0x45')](_0x5f4014[_0x3fb7('0x40')],_0x5f4014[_0x3fb7('0x41')]);_0xfb3dc6[_0x3fb7('0x44')]=_[_0x3fb7('0x45')](_0x5f4014[_0x3fb7('0x40')],qs[_0x3fb7('0x46')](_0x25b00[_0x3fb7('0x41')][_0x3fb7('0x46')]));_0xfb3dc6[_0x3fb7('0x44')]=_0xfb3dc6[_0x3fb7('0x44')][_0x3fb7('0x47')]?_0xfb3dc6[_0x3fb7('0x44')]:_0x5f4014[_0x3fb7('0x40')];_0xfb3dc6[_0x3fb7('0x4a')]=qs['sort'](_0x25b00[_0x3fb7('0x41')]['sort']);_0xfb3dc6['where']=qs[_0x3fb7('0x43')](_[_0x3fb7('0x4c')](_0x25b00[_0x3fb7('0x41')],_0x5f4014[_0x3fb7('0x43')]));if(_0x25b00['query'][_0x3fb7('0x4d')]){_0xfb3dc6[_0x3fb7('0x4e')]=_['merge'](_0xfb3dc6[_0x3fb7('0x4e')],{'$or':_['map'](_0xfb3dc6[_0x3fb7('0x44')],function(_0x12ac40){var _0x4f34fe={};_0x4f34fe[_0x12ac40]={'$like':'%'+_0x25b00[_0x3fb7('0x41')][_0x3fb7('0x4d')]+'%'};return _0x4f34fe;})});}_0xfb3dc6=_[_0x3fb7('0x4f')]({},_0xfb3dc6,_0x25b00[_0x3fb7('0x50')]);return _0x2fa9a4[_0x3fb7('0xbe')](_0xfb3dc6);}})['then'](function(_0x33606e){if(_0x33606e){_0x535f79=_0x33606e[_0x3fb7('0x47')];if(!_0x25b00['query'][_0x3fb7('0x48')]('nolimit')){_0xfb3dc6[_0x3fb7('0x2d')]=qs[_0x3fb7('0x2d')](_0x25b00['query']['limit']);_0xfb3dc6['offset']=qs['offset'](_0x25b00[_0x3fb7('0x41')]['offset']);}return _0x2fa9a4['getApplications'](_0xfb3dc6);}})[_0x3fb7('0x32')](function(_0x8271d6){if(_0x8271d6){return _0x8271d6?{'count':_0x535f79,'rows':_0x8271d6}:null;}})[_0x3fb7('0x32')](respondWithResult(_0x144d5f,null))[_0x3fb7('0x28')](handleError(_0x144d5f,null));};exports[_0x3fb7('0xbf')]=function(_0x27dcb3,_0x1e4731,_0x4d90a4){var _0x4cf4cd={'raw':![],'where':{}};var _0x3aacf2={};var _0x1042ac={'count':0x0,'rows':[]};return db[_0x3fb7('0x3c')][_0x3fb7('0x6a')]({'where':{'id':_0x27dcb3['params']['id']}})['then'](handleEntityNotFound(_0x1e4731,null))[_0x3fb7('0x32')](function(_0x44ea61){if(_0x44ea61){_0x3aacf2[_0x3fb7('0x40')]=_['keys'](db[_0x3fb7('0xa0')]['rawAttributes']);_0x3aacf2[_0x3fb7('0x41')]=_[_0x3fb7('0x42')](_0x27dcb3[_0x3fb7('0x41')]);_0x3aacf2['filters']=_['intersection'](_0x3aacf2[_0x3fb7('0x40')],_0x3aacf2[_0x3fb7('0x41')]);_0x4cf4cd[_0x3fb7('0x44')]=_[_0x3fb7('0x45')](_0x3aacf2[_0x3fb7('0x40')],qs[_0x3fb7('0x46')](_0x27dcb3[_0x3fb7('0x41')]['fields']));_0x4cf4cd['attributes']=_0x4cf4cd['attributes']['length']?_0x4cf4cd['attributes']:_0x3aacf2['model'];if(!_0x27dcb3['query']['hasOwnProperty'](_0x3fb7('0x49'))){_0x4cf4cd[_0x3fb7('0x2d')]=qs['limit'](_0x27dcb3[_0x3fb7('0x41')]['limit']);_0x4cf4cd[_0x3fb7('0x2b')]=qs['offset'](_0x27dcb3[_0x3fb7('0x41')]['offset']);}_0x4cf4cd[_0x3fb7('0x4a')]=qs[_0x3fb7('0x4b')](_0x27dcb3[_0x3fb7('0x41')][_0x3fb7('0x4b')]);_0x4cf4cd['where']=qs[_0x3fb7('0x43')](_[_0x3fb7('0x4c')](_0x27dcb3[_0x3fb7('0x41')],_0x3aacf2[_0x3fb7('0x43')]));_0x4cf4cd[_0x3fb7('0x4e')]['SmsAccountId']=_0x44ea61['id'];if(_0x27dcb3[_0x3fb7('0x41')][_0x3fb7('0x4d')]){_0x4cf4cd[_0x3fb7('0x4e')]=_[_0x3fb7('0x4f')](_0x4cf4cd['where'],{'$or':_[_0x3fb7('0x3b')](_0x4cf4cd['attributes'],function(_0x49c539){var _0x1a66d3={};_0x1a66d3[_0x49c539]={'$like':'%'+_0x27dcb3[_0x3fb7('0x41')][_0x3fb7('0x4d')]+'%'};return _0x1a66d3;})});}_0x4cf4cd=_[_0x3fb7('0x4f')]({},_0x4cf4cd,_0x27dcb3[_0x3fb7('0x50')]);return db[_0x3fb7('0xa0')][_0x3fb7('0x2e')]({'where':_0x4cf4cd[_0x3fb7('0x4e')]})['then'](function(_0x25ad10){_0x1042ac[_0x3fb7('0x2e')]=_0x25ad10;if(_0x27dcb3['query']['includeAll']){_0x4cf4cd[_0x3fb7('0x52')]=[{'model':db['CmContact'],'as':_0x3fb7('0xc0'),'required':![]},{'model':db[_0x3fb7('0xac')],'as':_0x3fb7('0xc1'),'attributes':[_0x3fb7('0x38'),_0x3fb7('0xc2'),_0x3fb7('0xc3')],'required':![]},{'model':db['Tag'],'as':_0x3fb7('0xc4'),'attributes':['id',_0x3fb7('0x38'),_0x3fb7('0xc5')],'where':_0x27dcb3[_0x3fb7('0x41')][_0x3fb7('0xc6')]?{'id':_0x27dcb3[_0x3fb7('0x41')]['tag']}:undefined,'required':_0x27dcb3[_0x3fb7('0x41')][_0x3fb7('0xc6')]?!![]:![]}];}return db[_0x3fb7('0xa0')][_0x3fb7('0x53')](_0x4cf4cd);})['then'](function(_0x535458){_0x1042ac[_0x3fb7('0x54')]=_0x535458;return _0x1042ac;});}})[_0x3fb7('0x32')](respondWithFilteredResult(_0x1e4731,_0x4cf4cd))[_0x3fb7('0x28')](handleError(_0x1e4731,null));};exports[_0x3fb7('0xb7')]=function(_0x33491e,_0xdb3cf2,_0x47b52d){var _0x44661d,_0x357ae2,_0x43c647;if(_[_0x3fb7('0x93')](_0x33491e[_0x3fb7('0x57')][_0x3fb7('0x57')])||_0x33491e[_0x3fb7('0x57')]['body']===''){throw new db['Sequelize'][(_0x3fb7('0x75'))](_0x3fb7('0x95'));}if(_[_0x3fb7('0x93')](_0x33491e[_0x3fb7('0x57')]['to'])){throw new db[(_0x3fb7('0x74'))][(_0x3fb7('0x75'))](_0x3fb7('0xc7'));}_0x44661d=_0x33491e['body']['to'];return db[_0x3fb7('0x3c')]['find']({'where':{'id':_0x33491e[_0x3fb7('0x63')]['id']},'include':[{'model':db[_0x3fb7('0xc8')],'as':_0x3fb7('0xc9'),'include':[{'model':db[_0x3fb7('0x9e')],'as':'Contacts','where':{'mobile':_0x44661d},'limit':0x1,'order':[[_0x3fb7('0x79'),_0x3fb7('0x9b')]]}]}]})[_0x3fb7('0x32')](handleEntityNotFound(_0xdb3cf2,null))[_0x3fb7('0x32')](function(_0x4aae88){if(_0x4aae88&&_0x4aae88[_0x3fb7('0xc9')]){_0x357ae2=_0x4aae88[_0x3fb7('0x58')]({'plain':!![]});if(_0x357ae2[_0x3fb7('0xc9')]&&_0x357ae2[_0x3fb7('0xc9')][_0x3fb7('0x9a')][_0x3fb7('0x47')]){return _0x357ae2[_0x3fb7('0xc9')][_0x3fb7('0x9a')][0x0];}return db['CmContact'][_0x3fb7('0x56')](_[_0x3fb7('0x19')](_0x33491e[_0x3fb7('0x57')],{'firstName':_0x44661d,'mobile':_0x44661d,'phone':_0x44661d,'ListId':_0x357ae2[_0x3fb7('0xca')]}));}})['then'](handleEntityNotFound(_0xdb3cf2,null))[_0x3fb7('0x32')](function(_0x5761a3){if(_0x5761a3){_0x43c647=_0x5761a3;return db[_0x3fb7('0xa0')]['find']({'where':{'ContactId':_0x43c647['id'],'closed':![],'SmsAccountId':_0x357ae2['id']}})[_0x3fb7('0x32')](function(_0x456446){if(_0x456446){return[_0x456446,![]];}return db[_0x3fb7('0xa0')][_0x3fb7('0x56')]({'UserId':_0x33491e[_0x3fb7('0x5b')]['id'],'ContactId':_0x43c647['id'],'SmsAccountId':_0x357ae2['id'],'phone':_0x44661d,'firstMsgDirection':_0x3fb7('0xcb'),'Messages':[_[_0x3fb7('0x4f')](_0x33491e[_0x3fb7('0x57')],{'read':![],'body':_0x33491e['body']['body'],'phone':_0x44661d,'SmsAccountId':_0x357ae2['id'],'UserId':_0x33491e['user']['id'],'ContactId':_0x43c647['id']})]},{'include':[{'model':db[_0x3fb7('0xa8')],'as':_0x3fb7('0xcc')}]})[_0x3fb7('0x32')](function(_0x34b39e){return[_0x34b39e,!![]];});});}})['spread'](function(_0x15c7ac,_0x3b65ef){if(_0x3b65ef){return _0x15c7ac;}return db[_0x3fb7('0xa8')][_0x3fb7('0x56')](_[_0x3fb7('0x4f')](_0x33491e['body'],{'read':![],'body':_0x33491e['body']['body'],'phone':_0x44661d,'SmsAccountId':_0x357ae2['id'],'SmsInteractionId':_0x15c7ac['id'],'UserId':_0x33491e[_0x3fb7('0x5b')]['id'],'ContactId':_0x43c647['id']}))[_0x3fb7('0x32')](function(_0xe23eac){_0x15c7ac[_0x3fb7('0xcd')][_0x3fb7('0xcc')]=[];_0x15c7ac[_0x3fb7('0xcd')][_0x3fb7('0xcc')]['push'](_0xe23eac['dataValues']);return _0x15c7ac;});})['then'](respondWithResult(_0xdb3cf2,null))[_0x3fb7('0x28')](handleError(_0xdb3cf2,null));};exports[_0x3fb7('0x2a')]=function(_0x59341e,_0x262ccc,_0x479be4){if(_0x59341e[_0x3fb7('0x57')]['id']){delete _0x59341e['body']['id'];}var _0x1687f6,_0x3622da,_0x74172b;return db[_0x3fb7('0x3c')]['find']({'where':{'id':_0x59341e[_0x3fb7('0x63')]['id']}})[_0x3fb7('0x32')](handleEntityNotFound(_0x262ccc,null))[_0x3fb7('0x32')](function(_0x19c708){if(_0x19c708){_0x74172b=_0x19c708;logger[_0x3fb7('0xb4')](_0x3fb7('0x21'),_0x3fb7('0x2a'),_0x3fb7('0xce'),_0x19c708[_0x3fb7('0x3e')],util['inspect'](_0x59341e[_0x3fb7('0x57')],{'showHidden':![],'depth':null}));switch(_0x19c708[_0x3fb7('0x3e')]){case _0x3fb7('0x7f'):if(_0x59341e[_0x3fb7('0x57')][_0x3fb7('0xcf')]&&_0x59341e['body'][_0x3fb7('0x2a')]){_0x3622da=_0x59341e['body']['status'];return db[_0x3fb7('0xa8')][_0x3fb7('0x5d')]({'where':{'messageId':_0x59341e[_0x3fb7('0x57')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x59341e[_0x3fb7('0x57')][_0x3fb7('0xd0')]&&_0x59341e[_0x3fb7('0x57')]['statusInt']){_0x3622da=_0x59341e[_0x3fb7('0x57')][_0x3fb7('0xd1')];return db['SmsMessage']['find']({'where':{'messageId':_0x59341e[_0x3fb7('0x57')]['requestid']}});}break;case _0x3fb7('0x84'):if(_0x59341e[_0x3fb7('0x57')][_0x3fb7('0x85')]&&_0x59341e['body'][_0x3fb7('0xd2')]){_0x3622da=_0x59341e['body'][_0x3fb7('0xd2')];return db['SmsMessage'][_0x3fb7('0x5d')]({'where':{'messageId':_0x59341e[_0x3fb7('0x57')][_0x3fb7('0x85')]}});}break;case _0x3fb7('0x88'):var _0x25b381=_0x59341e[_0x3fb7('0x57')][_0x3fb7('0x89')][0x0];if(_0x25b381[_0x3fb7('0x7e')]&&_0x25b381[_0x3fb7('0x2a')][_0x3fb7('0xd3')]===_0x3fb7('0xd4')){_0x3622da=_0x25b381[_0x3fb7('0x2a')][_0x3fb7('0xd3')];return db[_0x3fb7('0xa8')][_0x3fb7('0x5d')]({'where':{'messageId':_0x25b381['messageId']}});}break;case _0x3fb7('0x8d'):if(_0x59341e['body'][_0x3fb7('0x7e')]&&_0x59341e['body'][_0x3fb7('0x2a')]){_0x3622da=_0x59341e[_0x3fb7('0x57')]['status'];return db['SmsMessage']['find']({'where':{'messageId':_0x59341e[_0x3fb7('0x57')][_0x3fb7('0x7e')]}});}break;case'bandwidth':if(_0x59341e[_0x3fb7('0x57')][0x0][_0x3fb7('0x26')]['id']){_0x3622da=_0x59341e[_0x3fb7('0x57')][0x0][_0x3fb7('0x3e')];return db[_0x3fb7('0xa8')]['find']({'where':{'messageId':_0x59341e[_0x3fb7('0x57')][0x0]['message']['id']}});}break;case'intelepeer':if(_0x59341e[_0x3fb7('0x57')]['redif']&&_0x59341e[_0x3fb7('0x57')][_0x3fb7('0x2a')]){_0x3622da=_0x59341e[_0x3fb7('0x57')][_0x3fb7('0x2a')];return db['SmsMessage'][_0x3fb7('0x5d')]({'where':{'messageId':_0x59341e[_0x3fb7('0x57')]['redif']}});}break;}}})[_0x3fb7('0x32')](handleEntityNotFound(_0x262ccc,null))[_0x3fb7('0x32')](function(_0x501f42){if(_0x501f42){_0x1687f6=_0x501f42;switch(_0x74172b[_0x3fb7('0x3e')]){case _0x3fb7('0x7f'):if(_0x3622da===_0x3fb7('0xd4')){return _0x1687f6[_0x3fb7('0x31')]({'read':!![]});}else{logger['error'](_0x3fb7('0x21'),'status','skebby',util[_0x3fb7('0xd5')](_0x59341e['body'],{'showHidden':![],'depth':null}));}break;case _0x3fb7('0x83'):if(_0x3622da==='1'){return _0x1687f6[_0x3fb7('0x31')]({'read':!![]});}else{logger[_0x3fb7('0x23')](_0x3fb7('0x21'),_0x3fb7('0x2a'),'skebby',util['inspect'](_0x59341e[_0x3fb7('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3fb7('0x84'):if(!_0x59341e['body'][_0x3fb7('0xd6')]&&_0x3622da>=0xc8&&_0x3622da<=0xce){return _0x1687f6[_0x3fb7('0x31')]({'read':!![]});}else{logger[_0x3fb7('0x23')](_0x3fb7('0x21'),_0x3fb7('0x2a'),_0x3fb7('0x84'),util[_0x3fb7('0xd5')](_0x59341e[_0x3fb7('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3fb7('0x88'):var _0x2f2ff7=_0x59341e[_0x3fb7('0x57')]['results'][0x0];if(_0x2f2ff7[_0x3fb7('0x2a')]['groupName']==='DELIVERED'){return _0x1687f6['update']({'read':!![]});}else{logger[_0x3fb7('0x23')](_0x3fb7('0x21'),_0x3fb7('0x2a'),'infobip',util[_0x3fb7('0xd5')](_0x59341e['body'],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x3622da==_0x3fb7('0xd7')||_0x3622da=='RECEIVED_BY_RECIPIENT'){return _0x1687f6[_0x3fb7('0x31')]({'read':!![]});}else{logger['error'](_0x3fb7('0x21'),_0x3fb7('0x2a'),_0x3fb7('0x8d'),util[_0x3fb7('0xd5')](_0x59341e[_0x3fb7('0x57')],{'showHidden':![],'depth':null}));}break;case _0x3fb7('0x90'):if(_0x3622da=='message-delivered'){return _0x1687f6['update']({'read':!![]});}else{logger[_0x3fb7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x3fb7('0x90'),util['inspect'](_0x59341e['body'],{'showHidden':![],'depth':null}));}break;case _0x3fb7('0x91'):if(_0x3622da==='DELIVRD'||_0x3622da===_0x3fb7('0xd8')){return _0x1687f6['update']({'read':!![]});}else{logger[_0x3fb7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3fb7('0x2a'),'intelepeer',util[_0x3fb7('0xd5')](_0x59341e[_0x3fb7('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x1687f6;}})[_0x3fb7('0x32')](respondWithResult(_0x262ccc,null))[_0x3fb7('0x28')](handleError(_0x262ccc,null));};exports[_0x3fb7('0xd9')]=function(_0xf11bb3,_0x33a9ae,_0x29c863){var _0x46ccfc,_0x3c9dd2,_0xc72094;return db[_0x3fb7('0x3c')]['find']({'where':{'id':_0xf11bb3['params']['id']}})[_0x3fb7('0x32')](handleEntityNotFound(_0x33a9ae,null))[_0x3fb7('0x32')](function(_0xdf860d){if(_0xdf860d){_0xc72094=_0xdf860d;logger['debug'](_0x3fb7('0x21'),_0x3fb7('0x2a'),_0x3fb7('0xce'),_0xdf860d[_0x3fb7('0x3e')],util[_0x3fb7('0xd5')](_0xf11bb3[_0x3fb7('0x41')],{'showHidden':![],'depth':null}));switch(_0xdf860d[_0x3fb7('0x3e')]){case _0x3fb7('0x8a'):if(_0xf11bb3['query']['message-id']&&_0xf11bb3['query'][_0x3fb7('0xda')]){_0x3c9dd2=_0xf11bb3[_0x3fb7('0x41')][_0x3fb7('0xda')];return db[_0x3fb7('0xa8')]['find']({'where':{'messageId':_0xf11bb3[_0x3fb7('0x41')][_0x3fb7('0xdb')]}});}break;}}})[_0x3fb7('0x32')](handleEntityNotFound(_0x33a9ae,null))['then'](function(_0x509bc4){if(_0x509bc4){_0x46ccfc=_0x509bc4;switch(_0xc72094[_0x3fb7('0x3e')]){case'csc':if(_0x3c9dd2==='2'||_0x3c9dd2==='6'){return _0x46ccfc['update']({'read':!![]});}else{logger[_0x3fb7('0x23')](_0x3fb7('0x21'),_0x3fb7('0x2a'),'csc',util[_0x3fb7('0xd5')](_0xf11bb3['query'],{'showHidden':![],'depth':null}));};break;}return _0x46ccfc;}})[_0x3fb7('0x32')](respondWithResult(_0x33a9ae,null))[_0x3fb7('0x28')](handleError(_0x33a9ae,null));};exports['addAgents']=function(_0x330a0e,_0x2e7f09,_0x142d69){return db[_0x3fb7('0x3c')]['find']({'where':{'id':_0x330a0e[_0x3fb7('0x63')]['id']}})['then'](handleEntityNotFound(_0x2e7f09,null))[_0x3fb7('0x32')](function(_0x599e89){if(_0x599e89){return _0x599e89[_0x3fb7('0xdc')](_0x330a0e[_0x3fb7('0x57')]['ids'],_[_0x3fb7('0x9d')](_0x330a0e['body'],[_0x3fb7('0x68'),'id'])||{})['spread'](function(_0x31846e){for(var _0x3d1cbe=0x0;_0x3d1cbe<_0x330a0e[_0x3fb7('0x57')]['ids']['length'];_0x3d1cbe+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x330a0e[_0x3fb7('0x57')]['ids'][_0x3d1cbe]),'SmsAccountId':Number(_0x330a0e[_0x3fb7('0x63')]['id'])});}return _0x31846e;});}})[_0x3fb7('0x32')](respondWithResult(_0x2e7f09,null))[_0x3fb7('0x28')](handleError(_0x2e7f09,null));};exports['removeAgents']=function(_0x18536a,_0x386739,_0x259e08){return db[_0x3fb7('0x3c')][_0x3fb7('0x5d')]({'where':{'id':_0x18536a[_0x3fb7('0x63')]['id']}})['then'](handleEntityNotFound(_0x386739,null))[_0x3fb7('0x32')](function(_0x2f0b65){if(_0x2f0b65){return _0x2f0b65[_0x3fb7('0xdd')](_0x18536a[_0x3fb7('0x41')][_0x3fb7('0x68')])[_0x3fb7('0x32')](function(){if(_['isArray'](_0x18536a['query'][_0x3fb7('0x68')])){for(var _0x17d9bb=0x0;_0x17d9bb<_0x18536a[_0x3fb7('0x41')][_0x3fb7('0x68')][_0x3fb7('0x47')];_0x17d9bb+=0x1){socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x18536a[_0x3fb7('0x41')][_0x3fb7('0x68')][_0x17d9bb]),'SmsAccountId':Number(_0x18536a[_0x3fb7('0x63')]['id'])});}}else{socket[_0x3fb7('0xde')](_0x3fb7('0xdf'),{'UserId':Number(_0x18536a['query']['ids']),'SmsAccountId':Number(_0x18536a[_0x3fb7('0x63')]['id'])});}});}})[_0x3fb7('0x32')](respondWithStatusCode(_0x386739,null))[_0x3fb7('0x28')](handleError(_0x386739,null));};exports[_0x3fb7('0xe0')]=function(_0x5bc009,_0x2060ca,_0x58978f){var _0x2a5574={};var _0x5d12c1={};var _0x431306;var _0x3f02a0;return db[_0x3fb7('0x3c')]['findOne']({'where':{'id':_0x5bc009[_0x3fb7('0x63')]['id']}})[_0x3fb7('0x32')](handleEntityNotFound(_0x2060ca,null))['then'](function(_0x1471ab){if(_0x1471ab){_0x431306=_0x1471ab;_0x5d12c1[_0x3fb7('0x40')]=_[_0x3fb7('0x42')](db['User'][_0x3fb7('0x3d')]);_0x5d12c1[_0x3fb7('0x41')]=_[_0x3fb7('0x42')](_0x5bc009[_0x3fb7('0x41')]);_0x5d12c1[_0x3fb7('0x43')]=_[_0x3fb7('0x45')](_0x5d12c1[_0x3fb7('0x40')],_0x5d12c1[_0x3fb7('0x41')]);_0x2a5574[_0x3fb7('0x44')]=_[_0x3fb7('0x45')](_0x5d12c1[_0x3fb7('0x40')],qs[_0x3fb7('0x46')](_0x5bc009[_0x3fb7('0x41')][_0x3fb7('0x46')]));_0x2a5574[_0x3fb7('0x44')]=_0x2a5574[_0x3fb7('0x44')][_0x3fb7('0x47')]?_0x2a5574[_0x3fb7('0x44')]:_0x5d12c1[_0x3fb7('0x40')];_0x2a5574[_0x3fb7('0x4a')]=qs['sort'](_0x5bc009['query'][_0x3fb7('0x4b')]);_0x2a5574[_0x3fb7('0x4e')]=qs[_0x3fb7('0x43')](_['pick'](_0x5bc009[_0x3fb7('0x41')],_0x5d12c1[_0x3fb7('0x43')]));if(_0x5bc009['query'][_0x3fb7('0x4d')]){_0x2a5574[_0x3fb7('0x4e')]=_['merge'](_0x2a5574[_0x3fb7('0x4e')],{'$or':_['map'](_0x2a5574[_0x3fb7('0x44')],function(_0x45c701){var _0x209935={};_0x209935[_0x45c701]={'$like':'%'+_0x5bc009[_0x3fb7('0x41')][_0x3fb7('0x4d')]+'%'};return _0x209935;})});}_0x2a5574=_[_0x3fb7('0x4f')]({},_0x2a5574,_0x5bc009[_0x3fb7('0x50')]);return _0x431306[_0x3fb7('0xe0')](_0x2a5574);}})[_0x3fb7('0x32')](function(_0xeb0ebf){if(_0xeb0ebf){_0x3f02a0=_0xeb0ebf[_0x3fb7('0x47')];if(!_0x5bc009[_0x3fb7('0x41')][_0x3fb7('0x48')]('nolimit')){_0x2a5574[_0x3fb7('0x2d')]=qs[_0x3fb7('0x2d')](_0x5bc009[_0x3fb7('0x41')][_0x3fb7('0x2d')]);_0x2a5574[_0x3fb7('0x2b')]=qs[_0x3fb7('0x2b')](_0x5bc009[_0x3fb7('0x41')]['offset']);}return _0x431306[_0x3fb7('0xe0')](_0x2a5574);}})['then'](function(_0x1fb09f){if(_0x1fb09f){return _0x1fb09f?{'count':_0x3f02a0,'rows':_0x1fb09f}:null;}})['then'](respondWithResult(_0x2060ca,null))[_0x3fb7('0x28')](handleError(_0x2060ca,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 68b9aa8..b138a86 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 _0x0b7c=['../../mysqldb','SmsAccount','setMaxListeners','update','remove','hook','exports','events'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x0b7c,0x17f));var _0xc0b7=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x0b7c[_0x87b0ff];return _0x3bc0b2;};'use strict';var EventEmitter=require(_0xc0b7('0x0'));var SmsAccount=require(_0xc0b7('0x1'))['db'][_0xc0b7('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xc0b7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0b7('0x4'),'afterDestroy':_0xc0b7('0x5')};function emitEvent(_0x4e6726){return function(_0x4bbc51,_0xdd8554,_0x2b7eb4){SmsAccountEvents['emit'](_0x4e6726+':'+_0x4bbc51['id'],_0x4bbc51);SmsAccountEvents['emit'](_0x4e6726,_0x4bbc51);_0x2b7eb4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xc0b7('0x6')](e,emitEvent(event));}}module[_0xc0b7('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0xbeef=['save','update','remove','hasOwnProperty','hook','events','setMaxListeners'];(function(_0x479ccf,_0x479af5){var _0x42cd37=function(_0x3162de){while(--_0x3162de){_0x479ccf['push'](_0x479ccf['shift']());}};_0x42cd37(++_0x479af5);}(_0xbeef,0x8a));var _0xfbee=function(_0x293bfb,_0x1f636e){_0x293bfb=_0x293bfb-0x0;var _0x3db61f=_0xbeef[_0x293bfb];return _0x3db61f;};'use strict';var EventEmitter=require(_0xfbee('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xfbee('0x1')](0x0);var events={'afterCreate':_0xfbee('0x2'),'afterUpdate':_0xfbee('0x3'),'afterDestroy':_0xfbee('0x4')};function emitEvent(_0x59f22a){return function(_0x122e6c,_0x132a53,_0x521dd9){SmsAccountEvents['emit'](_0x59f22a+':'+_0x122e6c['id'],_0x122e6c);SmsAccountEvents['emit'](_0x59f22a,_0x122e6c);_0x521dd9(null);};}for(var e in events){if(events[_0xfbee('0x5')](e)){var event=events[e];SmsAccount[_0xfbee('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 1272773..1b446e1 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 _0xf682=['path','rimraf','../../config/environment','exports','define','sms_accounts','lodash','util','../../config/logger','api','request-promise'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xf682,0x12f));var _0x2f68=function(_0x4c6a85,_0x48410d){_0x4c6a85=_0x4c6a85-0x0;var _0x10ebb5=_0xf682[_0x4c6a85];return _0x10ebb5;};'use strict';var _=require(_0x2f68('0x0'));var util=require(_0x2f68('0x1'));var logger=require(_0x2f68('0x2'))(_0x2f68('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2f68('0x4'));var fs=require('fs');var path=require(_0x2f68('0x5'));var rimraf=require(_0x2f68('0x6'));var config=require(_0x2f68('0x7'));var attributes=require('./smsAccount.attributes');module[_0x2f68('0x8')]=function(_0x46dd32,_0x6f92f6){return _0x46dd32[_0x2f68('0x9')]('SmsAccount',attributes,{'tableName':_0x2f68('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fbc=['util','api','moment','bluebird','request-promise','path','./smsAccount.attributes','exports','define','sms_accounts'];(function(_0x2d53ba,_0x564bc1){var _0x504a58=function(_0xcbe0bb){while(--_0xcbe0bb){_0x2d53ba['push'](_0x2d53ba['shift']());}};_0x504a58(++_0x564bc1);}(_0x0fbc,0x1f4));var _0xc0fb=function(_0x175095,_0x486a85){_0x175095=_0x175095-0x0;var _0x137e14=_0x0fbc[_0x175095];return _0x137e14;};'use strict';var _=require('lodash');var util=require(_0xc0fb('0x0'));var logger=require('../../config/logger')(_0xc0fb('0x1'));var moment=require(_0xc0fb('0x2'));var BPromise=require(_0xc0fb('0x3'));var rp=require(_0xc0fb('0x4'));var fs=require('fs');var path=require(_0xc0fb('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc0fb('0x6'));module[_0xc0fb('0x7')]=function(_0x4acea9,_0x4c21c9){return _0x4acea9[_0xc0fb('0x8')]('SmsAccount',attributes,{'tableName':_0xc0fb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index d397b49..34a86ba 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 _0x4410=['../../config/environment','client','http','redis','socket.io-emitter','register','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','map','include','model','then','util','moment','bluebird','randomstring','rpc'];(function(_0x125eb9,_0x4aac10){var _0xf526ae=function(_0x7343b9){while(--_0x7343b9){_0x125eb9['push'](_0x125eb9['shift']());}};_0xf526ae(++_0x4aac10);}(_0x4410,0x18e));var _0x0441=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x4410[_0x1477ef];return _0x164acd;};'use strict';var _=require('lodash');var util=require(_0x0441('0x0'));var moment=require(_0x0441('0x1'));var BPromise=require(_0x0441('0x2'));var rs=require(_0x0441('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0441('0x4'));var config=require(_0x0441('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0441('0x6')][_0x0441('0x7')]({'port':0x232a});config[_0x0441('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0441('0x9'))(new Redis(config[_0x0441('0x8')]));require('./smsAccount.socket')[_0x0441('0xa')](socket);function respondWithRpcPromise(_0x187402,_0x356f88,_0xfc3b4d){return new BPromise(function(_0x363f8d,_0x35c4e2){return client['request'](_0x187402,_0xfc3b4d)['then'](function(_0x2e7593){logger[_0x0441('0xb')](_0x0441('0xc'),_0x356f88,_0x0441('0xd'));logger[_0x0441('0xe')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x356f88,'request\x20sent',JSON[_0x0441('0xf')](_0x2e7593));if(_0x2e7593['error']){if(_0x2e7593[_0x0441('0x10')][_0x0441('0x11')]===0x1f4){logger[_0x0441('0x10')](_0x0441('0xc'),_0x356f88,_0x2e7593[_0x0441('0x10')][_0x0441('0x12')]);return _0x35c4e2(_0x2e7593[_0x0441('0x10')][_0x0441('0x12')]);}logger[_0x0441('0x10')](_0x0441('0xc'),_0x356f88,_0x2e7593[_0x0441('0x10')][_0x0441('0x12')]);return _0x363f8d(_0x2e7593[_0x0441('0x10')]['message']);}else{logger[_0x0441('0xb')]('SmsAccount,\x20%s,\x20%s',_0x356f88,'request\x20sent');_0x363f8d(_0x2e7593[_0x0441('0x13')][_0x0441('0x12')]);}})[_0x0441('0x14')](function(_0x48642b){logger[_0x0441('0x10')](_0x0441('0xc'),_0x356f88,_0x48642b);_0x35c4e2(_0x48642b);});});}exports[_0x0441('0x15')]=function(_0x39044e){var _0x200fdf=this;return new Promise(function(_0x80f09c,_0x1c3b5f){return db[_0x0441('0x16')][_0x0441('0x17')]({'raw':_0x39044e[_0x0441('0x18')]?_0x39044e[_0x0441('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x39044e[_0x0441('0x18')]?_0x39044e[_0x0441('0x18')][_0x0441('0x19')]||null:null,'attributes':_0x39044e[_0x0441('0x18')]?_0x39044e[_0x0441('0x18')][_0x0441('0x1a')]||null:null,'include':_0x39044e[_0x0441('0x18')]?_0x39044e['options']['include']?_[_0x0441('0x1b')](_0x39044e[_0x0441('0x18')][_0x0441('0x1c')],function(_0x137d3b){return{'model':db[_0x137d3b[_0x0441('0x1d')]],'as':_0x137d3b['as'],'attributes':_0x137d3b[_0x0441('0x1a')],'include':_0x137d3b[_0x0441('0x1c')]?_[_0x0441('0x1b')](_0x137d3b[_0x0441('0x1c')],function(_0x1833dd){return{'model':db[_0x1833dd[_0x0441('0x1d')]],'as':_0x1833dd['as'],'attributes':_0x1833dd['attributes'],'include':_0x1833dd[_0x0441('0x1c')]?_['map'](_0x1833dd[_0x0441('0x1c')],function(_0x3f0795){return{'model':db[_0x3f0795['model']],'as':_0x3f0795['as'],'attributes':_0x3f0795[_0x0441('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0441('0x1e')](function(_0x257abd){logger[_0x0441('0xb')](_0x0441('0x15'),_0x39044e);logger[_0x0441('0xe')](_0x0441('0x15'),_0x39044e,JSON[_0x0441('0xf')](_0x257abd));_0x80f09c(_0x257abd);})[_0x0441('0x14')](function(_0x36cc53){logger['error']('ShowSmsAccount',_0x36cc53['message'],_0x39044e);_0x1c3b5f(_0x200fdf[_0x0441('0x10')](0x1f4,_0x36cc53[_0x0441('0x12')]));});});}; \ No newline at end of file +var _0x043c=['raw','attributes','include','model','lodash','util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','ShowSmsAccount','SmsAccount','find','options'];(function(_0x3b60e1,_0x50d5db){var _0x45b9a7=function(_0x5f39c2){while(--_0x5f39c2){_0x3b60e1['push'](_0x3b60e1['shift']());}};_0x45b9a7(++_0x50d5db);}(_0x043c,0x158));var _0xc043=function(_0x587dd0,_0x273922){_0x587dd0=_0x587dd0-0x0;var _0x56f153=_0x043c[_0x587dd0];return _0x56f153;};'use strict';var _=require(_0xc043('0x0'));var util=require(_0xc043('0x1'));var moment=require(_0xc043('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc043('0x3'))['db'];var utils=require(_0xc043('0x4'));var logger=require('../../config/logger')(_0xc043('0x5'));var config=require('../../config/environment');var jayson=require(_0xc043('0x6'));var client=jayson['client'][_0xc043('0x7')]({'port':0x232a});config[_0xc043('0x8')]=_[_0xc043('0x9')](config['redis'],{'host':_0xc043('0xa'),'port':0x18eb});var socket=require(_0xc043('0xb'))(new Redis(config[_0xc043('0x8')]));require(_0xc043('0xc'))[_0xc043('0xd')](socket);function respondWithRpcPromise(_0x5595d8,_0x491c54,_0x22d0b1){return new BPromise(function(_0x13504f,_0x389f72){return client[_0xc043('0xe')](_0x5595d8,_0x22d0b1)[_0xc043('0xf')](function(_0x4faafc){logger[_0xc043('0x10')]('SmsAccount,\x20%s,\x20%s',_0x491c54,'request\x20sent');logger[_0xc043('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x491c54,_0xc043('0x12'),JSON[_0xc043('0x13')](_0x4faafc));if(_0x4faafc[_0xc043('0x14')]){if(_0x4faafc[_0xc043('0x14')][_0xc043('0x15')]===0x1f4){logger[_0xc043('0x14')](_0xc043('0x16'),_0x491c54,_0x4faafc[_0xc043('0x14')][_0xc043('0x17')]);return _0x389f72(_0x4faafc[_0xc043('0x14')][_0xc043('0x17')]);}logger[_0xc043('0x14')]('SmsAccount,\x20%s,\x20%s',_0x491c54,_0x4faafc[_0xc043('0x14')][_0xc043('0x17')]);return _0x13504f(_0x4faafc[_0xc043('0x14')][_0xc043('0x17')]);}else{logger[_0xc043('0x10')]('SmsAccount,\x20%s,\x20%s',_0x491c54,_0xc043('0x12'));_0x13504f(_0x4faafc[_0xc043('0x18')][_0xc043('0x17')]);}})[_0xc043('0x19')](function(_0x4a857e){logger[_0xc043('0x14')]('SmsAccount,\x20%s,\x20%s',_0x491c54,_0x4a857e);_0x389f72(_0x4a857e);});});}exports[_0xc043('0x1a')]=function(_0x47544f){var _0x3819e3=this;return new Promise(function(_0x8fc67f,_0xb2d86b){return db[_0xc043('0x1b')][_0xc043('0x1c')]({'raw':_0x47544f[_0xc043('0x1d')]?_0x47544f[_0xc043('0x1d')][_0xc043('0x1e')]===undefined?!![]:![]:!![],'where':_0x47544f[_0xc043('0x1d')]?_0x47544f[_0xc043('0x1d')]['where']||null:null,'attributes':_0x47544f['options']?_0x47544f[_0xc043('0x1d')][_0xc043('0x1f')]||null:null,'include':_0x47544f[_0xc043('0x1d')]?_0x47544f[_0xc043('0x1d')][_0xc043('0x20')]?_['map'](_0x47544f[_0xc043('0x1d')]['include'],function(_0xa50a64){return{'model':db[_0xa50a64[_0xc043('0x21')]],'as':_0xa50a64['as'],'attributes':_0xa50a64['attributes'],'include':_0xa50a64['include']?_['map'](_0xa50a64[_0xc043('0x20')],function(_0x380594){return{'model':db[_0x380594[_0xc043('0x21')]],'as':_0x380594['as'],'attributes':_0x380594['attributes'],'include':_0x380594[_0xc043('0x20')]?_['map'](_0x380594[_0xc043('0x20')],function(_0x5f10ea){return{'model':db[_0x5f10ea['model']],'as':_0x5f10ea['as'],'attributes':_0x5f10ea[_0xc043('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xc043('0xf')](function(_0x3c75bb){logger['info']('ShowSmsAccount',_0x47544f);logger[_0xc043('0x11')]('ShowSmsAccount',_0x47544f,JSON[_0xc043('0x13')](_0x3c75bb));_0x8fc67f(_0x3c75bb);})[_0xc043('0x19')](function(_0x558699){logger[_0xc043('0x14')](_0xc043('0x1a'),_0x558699['message'],_0x47544f);_0xb2d86b(_0x3819e3[_0xc043('0x14')](0x1f4,_0x558699[_0xc043('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 7981d66..d90d482 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 6dacba5..3bb5d14 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(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x5d5504,_0xc375cd){var _0x18e885=function(_0xd07da3){while(--_0xd07da3){_0x5d5504['push'](_0x5d5504['shift']());}};_0x18e885(++_0xc375cd);}(_0x34e8,0x12c));var _0x834e=function(_0x9651c3,_0x24e5b1){_0x9651c3=_0x9651c3-0x0;var _0x122675=_0x34e8[_0x9651c3];return _0x122675;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 7088a46..6de79e4 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 _0x96db=['noop','TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x51d231,_0x1ef875){var _0x1c4c8f=function(_0x4a71eb){while(--_0x4a71eb){_0x51d231['push'](_0x51d231['shift']());}};_0x1c4c8f(++_0x1ef875);}(_0x96db,0x13f));var _0xb96d=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x96db[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require(_0xb96d('0x0'));module[_0xb96d('0x1')]={'priority':{'type':Sequelize[_0xb96d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb96d('0x3')},'appdata':{'type':Sequelize[_0xb96d('0x4')]()},'description':{'type':Sequelize[_0xb96d('0x5')]},'interval':{'type':Sequelize[_0xb96d('0x5')],'defaultValue':_0xb96d('0x6')}}; \ No newline at end of file +var _0x7b0a=['STRING','TEXT','*,*,*,*','sequelize','exports'];(function(_0x48be3a,_0x2ac55e){var _0x2e5435=function(_0x351a64){while(--_0x351a64){_0x48be3a['push'](_0x48be3a['shift']());}};_0x2e5435(++_0x2ac55e);}(_0x7b0a,0x143));var _0xa7b0=function(_0x469328,_0x46ea2e){_0x469328=_0x469328-0x0;var _0xacf1d6=_0x7b0a[_0x469328];return _0xacf1d6;};'use strict';var Sequelize=require(_0xa7b0('0x0'));module[_0xa7b0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xa7b0('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa7b0('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa7b0('0x2')],'defaultValue':_0xa7b0('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index dd60123..baef564 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 _0x5dee=['to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','SmsApplication','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','catch','params','includeAll','find','create','body','update','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4ac70e,_0x257743){var _0x51c643=function(_0xa2c769){while(--_0xa2c769){_0x4ac70e['push'](_0x4ac70e['shift']());}};_0x51c643(++_0x257743);}(_0x5dee,0xce));var _0xe5de=function(_0x358106,_0x5c3006){_0x358106=_0x358106-0x0;var _0x113bba=_0x5dee[_0x358106];return _0x113bba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5de('0x0'));var zipdir=require(_0xe5de('0x1'));var jsonpatch=require(_0xe5de('0x2'));var rp=require(_0xe5de('0x3'));var moment=require(_0xe5de('0x4'));var BPromise=require(_0xe5de('0x5'));var Mustache=require(_0xe5de('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xe5de('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5de('0x8'));var _=require(_0xe5de('0x9'));var squel=require(_0xe5de('0xa'));var crypto=require('crypto');var jsforce=require(_0xe5de('0xb'));var deskjs=require(_0xe5de('0xc'));var toCsv=require(_0xe5de('0x7'));var querystring=require('querystring');var Papa=require(_0xe5de('0xd'));var Redis=require('ioredis');var authService=require(_0xe5de('0xe'));var qs=require(_0xe5de('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5de('0x10'));var logger=require(_0xe5de('0x11'))('api');var utils=require(_0xe5de('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe5de('0x13'))['db'];function respondWithStatusCode(_0x4d1191,_0x35bb9d){_0x35bb9d=_0x35bb9d||0xcc;return function(_0x305a7b){if(_0x305a7b){return _0x4d1191[_0xe5de('0x14')](_0x35bb9d);}return _0x4d1191[_0xe5de('0x15')](_0x35bb9d)['end']();};}function respondWithResult(_0x1e33a0,_0x322e13){_0x322e13=_0x322e13||0xc8;return function(_0x5ae6cb){if(_0x5ae6cb){return _0x1e33a0[_0xe5de('0x15')](_0x322e13)['json'](_0x5ae6cb);}};}function respondWithFilteredResult(_0x1c8fc8,_0x7cc058){return function(_0x158fc7){if(_0x158fc7){var _0x236eb7=typeof _0x7cc058[_0xe5de('0x16')]==='undefined'&&typeof _0x7cc058[_0xe5de('0x17')]===_0xe5de('0x18');var _0x2a5de6=_0x158fc7[_0xe5de('0x19')];var _0xbd437f=_0x236eb7?0x0:_0x7cc058['offset'];var _0x520f7c=_0x236eb7?_0x158fc7[_0xe5de('0x19')]:_0x7cc058[_0xe5de('0x16')]+_0x7cc058[_0xe5de('0x17')];var _0xc8a3fa;if(_0x520f7c>=_0x2a5de6){_0x520f7c=_0x2a5de6;_0xc8a3fa=0xc8;}else{_0xc8a3fa=0xce;}_0x1c8fc8['status'](_0xc8a3fa);return _0x1c8fc8[_0xe5de('0x1a')](_0xe5de('0x1b'),_0xbd437f+'-'+_0x520f7c+'/'+_0x2a5de6)['json'](_0x158fc7);}return null;};}function patchUpdates(_0x3bcf20){return function(_0x28cdc9){try{jsonpatch[_0xe5de('0x1c')](_0x28cdc9,_0x3bcf20,!![]);}catch(_0xf2b2b7){return BPromise[_0xe5de('0x1d')](_0xf2b2b7);}return _0x28cdc9[_0xe5de('0x1e')]();};}function saveUpdates(_0x859cbc,_0x1feaf6){return function(_0x5c3349){if(_0x5c3349){return _0x5c3349['update'](_0x859cbc)[_0xe5de('0x1f')](function(_0x2964f8){return _0x2964f8;});}return null;};}function removeEntity(_0xcefced,_0x37e358){return function(_0x9e35c5){if(_0x9e35c5){return _0x9e35c5['destroy']()[_0xe5de('0x1f')](function(){_0xcefced[_0xe5de('0x15')](0xcc)[_0xe5de('0x20')]();});}};}function handleEntityNotFound(_0x297c87,_0x56f5ac){return function(_0x2162f2){if(!_0x2162f2){_0x297c87[_0xe5de('0x14')](0x194);}return _0x2162f2;};}function handleError(_0x9625c4,_0x3ac3f3){_0x3ac3f3=_0x3ac3f3||0x1f4;return function(_0x1e7bb8){logger[_0xe5de('0x21')](_0x1e7bb8[_0xe5de('0x22')]);if(_0x1e7bb8[_0xe5de('0x23')]){delete _0x1e7bb8[_0xe5de('0x23')];}_0x9625c4[_0xe5de('0x15')](_0x3ac3f3)[_0xe5de('0x24')](_0x1e7bb8);};}exports[_0xe5de('0x25')]=function(_0x31af7a,_0x5b52d7){var _0xb8e0ab={},_0x1e8ec4={},_0x2ed1a4={'count':0x0,'rows':[]};var _0x5eae3f=_['map'](db[_0xe5de('0x26')][_0xe5de('0x27')],function(_0x18ac47){return{'name':_0x18ac47['fieldName'],'type':_0x18ac47[_0xe5de('0x28')][_0xe5de('0x29')]};});_0x1e8ec4[_0xe5de('0x2a')]=_[_0xe5de('0x2b')](_0x5eae3f,_0xe5de('0x23'));_0x1e8ec4[_0xe5de('0x2c')]=_[_0xe5de('0x2d')](_0x31af7a[_0xe5de('0x2c')]);_0x1e8ec4[_0xe5de('0x2e')]=_[_0xe5de('0x2f')](_0x1e8ec4[_0xe5de('0x2a')],_0x1e8ec4[_0xe5de('0x2c')]);_0xb8e0ab[_0xe5de('0x30')]=_[_0xe5de('0x2f')](_0x1e8ec4[_0xe5de('0x2a')],qs[_0xe5de('0x31')](_0x31af7a[_0xe5de('0x2c')][_0xe5de('0x31')]));_0xb8e0ab[_0xe5de('0x30')]=_0xb8e0ab['attributes'][_0xe5de('0x32')]?_0xb8e0ab['attributes']:_0x1e8ec4['model'];if(!_0x31af7a[_0xe5de('0x2c')][_0xe5de('0x33')](_0xe5de('0x34'))){_0xb8e0ab[_0xe5de('0x17')]=qs[_0xe5de('0x17')](_0x31af7a[_0xe5de('0x2c')][_0xe5de('0x17')]);_0xb8e0ab[_0xe5de('0x16')]=qs[_0xe5de('0x16')](_0x31af7a['query'][_0xe5de('0x16')]);}_0xb8e0ab[_0xe5de('0x35')]=qs['sort'](_0x31af7a[_0xe5de('0x2c')][_0xe5de('0x36')]);_0xb8e0ab[_0xe5de('0x37')]=qs[_0xe5de('0x2e')](_[_0xe5de('0x38')](_0x31af7a[_0xe5de('0x2c')],_0x1e8ec4['filters']),_0x5eae3f);if(_0x31af7a[_0xe5de('0x2c')][_0xe5de('0x39')]){_0xb8e0ab[_0xe5de('0x37')]=_['merge'](_0xb8e0ab['where'],{'$or':_['map'](_0x5eae3f,function(_0x5e2578){if(_0x5e2578[_0xe5de('0x28')]!==_0xe5de('0x3a')){var _0x328b68={};_0x328b68[_0x5e2578[_0xe5de('0x23')]]={'$like':'%'+_0x31af7a[_0xe5de('0x2c')][_0xe5de('0x39')]+'%'};return _0x328b68;}})});}_0xb8e0ab=_[_0xe5de('0x3b')]({},_0xb8e0ab,_0x31af7a['options']);var _0x441bf2={'where':_0xb8e0ab[_0xe5de('0x37')]};return db[_0xe5de('0x26')][_0xe5de('0x19')](_0x441bf2)['then'](function(_0x3579f5){_0x2ed1a4[_0xe5de('0x19')]=_0x3579f5;if(_0x31af7a[_0xe5de('0x2c')]['includeAll']){_0xb8e0ab[_0xe5de('0x3c')]=[{'all':!![]}];}return db['SmsApplication'][_0xe5de('0x3d')](_0xb8e0ab);})[_0xe5de('0x1f')](function(_0x454a05){_0x2ed1a4[_0xe5de('0x3e')]=_0x454a05;return _0x2ed1a4;})[_0xe5de('0x1f')](respondWithFilteredResult(_0x5b52d7,_0xb8e0ab))[_0xe5de('0x3f')](handleError(_0x5b52d7,null));};exports['show']=function(_0x30c4ad,_0x21a152){var _0x77364={'raw':!![],'where':{'id':_0x30c4ad[_0xe5de('0x40')]['id']}},_0x18952c={};_0x18952c[_0xe5de('0x2a')]=_[_0xe5de('0x2d')](db['SmsApplication'][_0xe5de('0x27')]);_0x18952c[_0xe5de('0x2c')]=_[_0xe5de('0x2d')](_0x30c4ad[_0xe5de('0x2c')]);_0x18952c[_0xe5de('0x2e')]=_[_0xe5de('0x2f')](_0x18952c[_0xe5de('0x2a')],_0x18952c['query']);_0x77364[_0xe5de('0x30')]=_[_0xe5de('0x2f')](_0x18952c[_0xe5de('0x2a')],qs['fields'](_0x30c4ad[_0xe5de('0x2c')][_0xe5de('0x31')]));_0x77364[_0xe5de('0x30')]=_0x77364[_0xe5de('0x30')][_0xe5de('0x32')]?_0x77364[_0xe5de('0x30')]:_0x18952c[_0xe5de('0x2a')];if(_0x30c4ad['query'][_0xe5de('0x41')]){_0x77364[_0xe5de('0x3c')]=[{'all':!![]}];}_0x77364=_[_0xe5de('0x3b')]({},_0x77364,_0x30c4ad['options']);return db[_0xe5de('0x26')][_0xe5de('0x42')](_0x77364)[_0xe5de('0x1f')](handleEntityNotFound(_0x21a152,null))[_0xe5de('0x1f')](respondWithResult(_0x21a152,null))['catch'](handleError(_0x21a152,null));};exports[_0xe5de('0x43')]=function(_0x4fc636,_0x56ac1a){return db['SmsApplication'][_0xe5de('0x43')](_0x4fc636[_0xe5de('0x44')],{})[_0xe5de('0x1f')](respondWithResult(_0x56ac1a,0xc9))[_0xe5de('0x3f')](handleError(_0x56ac1a,null));};exports[_0xe5de('0x45')]=function(_0x132970,_0x27200c){if(_0x132970[_0xe5de('0x44')]['id']){delete _0x132970[_0xe5de('0x44')]['id'];}return db[_0xe5de('0x26')][_0xe5de('0x42')]({'where':{'id':_0x132970[_0xe5de('0x40')]['id']}})[_0xe5de('0x1f')](handleEntityNotFound(_0x27200c,null))['then'](saveUpdates(_0x132970['body'],null))['then'](respondWithResult(_0x27200c,null))[_0xe5de('0x3f')](handleError(_0x27200c,null));};exports[_0xe5de('0x46')]=function(_0x36d103,_0x4d25ec){return db[_0xe5de('0x26')][_0xe5de('0x42')]({'where':{'id':_0x36d103[_0xe5de('0x40')]['id']}})[_0xe5de('0x1f')](handleEntityNotFound(_0x4d25ec,null))[_0xe5de('0x1f')](removeEntity(_0x4d25ec,null))[_0xe5de('0x3f')](handleError(_0x4d25ec,null));}; \ No newline at end of file +var _0x36a4=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','name','send','index','SmsApplication','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','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'];(function(_0x496acd,_0x144020){var _0x5171b1=function(_0x302a6d){while(--_0x302a6d){_0x496acd['push'](_0x496acd['shift']());}};_0x5171b1(++_0x144020);}(_0x36a4,0x11f));var _0x436a=function(_0xbd1f50,_0x1abfa6){_0xbd1f50=_0xbd1f50-0x0;var _0x472bb2=_0x36a4[_0xbd1f50];return _0x472bb2;};'use strict';var emlformat=require(_0x436a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x436a('0x1'));var jsonpatch=require(_0x436a('0x2'));var rp=require('request-promise');var moment=require(_0x436a('0x3'));var BPromise=require(_0x436a('0x4'));var Mustache=require(_0x436a('0x5'));var util=require(_0x436a('0x6'));var path=require(_0x436a('0x7'));var sox=require(_0x436a('0x8'));var csv=require(_0x436a('0x9'));var ejs=require(_0x436a('0xa'));var fs=require('fs');var fs_extra=require(_0x436a('0xb'));var _=require(_0x436a('0xc'));var squel=require('squel');var crypto=require(_0x436a('0xd'));var jsforce=require(_0x436a('0xe'));var deskjs=require(_0x436a('0xf'));var toCsv=require(_0x436a('0x9'));var querystring=require(_0x436a('0x10'));var Papa=require(_0x436a('0x11'));var Redis=require(_0x436a('0x12'));var authService=require(_0x436a('0x13'));var qs=require(_0x436a('0x14'));var as=require(_0x436a('0x15'));var hardwareService=require(_0x436a('0x16'));var logger=require(_0x436a('0x17'))(_0x436a('0x18'));var utils=require(_0x436a('0x19'));var config=require(_0x436a('0x1a'));var licenseUtil=require(_0x436a('0x1b'));var db=require(_0x436a('0x1c'))['db'];function respondWithStatusCode(_0x29af20,_0x55ff3d){_0x55ff3d=_0x55ff3d||0xcc;return function(_0x83259e){if(_0x83259e){return _0x29af20[_0x436a('0x1d')](_0x55ff3d);}return _0x29af20[_0x436a('0x1e')](_0x55ff3d)[_0x436a('0x1f')]();};}function respondWithResult(_0x47f22a,_0x21ad29){_0x21ad29=_0x21ad29||0xc8;return function(_0x1145bc){if(_0x1145bc){return _0x47f22a['status'](_0x21ad29)[_0x436a('0x20')](_0x1145bc);}};}function respondWithFilteredResult(_0x1639ee,_0x4f6f1a){return function(_0x286a7d){if(_0x286a7d){var _0xe11aa0=typeof _0x4f6f1a[_0x436a('0x21')]==='undefined'&&typeof _0x4f6f1a['limit']===_0x436a('0x22');var _0x4a5406=_0x286a7d[_0x436a('0x23')];var _0x421e6c=_0xe11aa0?0x0:_0x4f6f1a[_0x436a('0x21')];var _0x3eb340=_0xe11aa0?_0x286a7d[_0x436a('0x23')]:_0x4f6f1a[_0x436a('0x21')]+_0x4f6f1a[_0x436a('0x24')];var _0xb9c01b;if(_0x3eb340>=_0x4a5406){_0x3eb340=_0x4a5406;_0xb9c01b=0xc8;}else{_0xb9c01b=0xce;}_0x1639ee['status'](_0xb9c01b);return _0x1639ee[_0x436a('0x25')](_0x436a('0x26'),_0x421e6c+'-'+_0x3eb340+'/'+_0x4a5406)[_0x436a('0x20')](_0x286a7d);}return null;};}function patchUpdates(_0x1d190e){return function(_0x32bea9){try{jsonpatch[_0x436a('0x27')](_0x32bea9,_0x1d190e,!![]);}catch(_0x3455b9){return BPromise[_0x436a('0x28')](_0x3455b9);}return _0x32bea9[_0x436a('0x29')]();};}function saveUpdates(_0x1176a7,_0x2a0472){return function(_0x3c5d6d){if(_0x3c5d6d){return _0x3c5d6d['update'](_0x1176a7)[_0x436a('0x2a')](function(_0x25fff9){return _0x25fff9;});}return null;};}function removeEntity(_0x4cf647,_0x3c23af){return function(_0x28453c){if(_0x28453c){return _0x28453c['destroy']()[_0x436a('0x2a')](function(){_0x4cf647[_0x436a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1066af,_0x49b0a5){return function(_0x47d1c1){if(!_0x47d1c1){_0x1066af[_0x436a('0x1d')](0x194);}return _0x47d1c1;};}function handleError(_0x57ca2c,_0x546a14){_0x546a14=_0x546a14||0x1f4;return function(_0x56ca41){logger[_0x436a('0x2b')](_0x56ca41['stack']);if(_0x56ca41['name']){delete _0x56ca41[_0x436a('0x2c')];}_0x57ca2c['status'](_0x546a14)[_0x436a('0x2d')](_0x56ca41);};}exports[_0x436a('0x2e')]=function(_0x5ae4ce,_0x218275){var _0x1e9b17={},_0x3f7ce1={},_0x50e85d={'count':0x0,'rows':[]};var _0x3e4714=_['map'](db[_0x436a('0x2f')][_0x436a('0x30')],function(_0x1acdbf){return{'name':_0x1acdbf[_0x436a('0x31')],'type':_0x1acdbf['type'][_0x436a('0x32')]};});_0x3f7ce1[_0x436a('0x33')]=_[_0x436a('0x34')](_0x3e4714,_0x436a('0x2c'));_0x3f7ce1['query']=_[_0x436a('0x35')](_0x5ae4ce[_0x436a('0x36')]);_0x3f7ce1[_0x436a('0x37')]=_[_0x436a('0x38')](_0x3f7ce1['model'],_0x3f7ce1[_0x436a('0x36')]);_0x1e9b17[_0x436a('0x39')]=_['intersection'](_0x3f7ce1[_0x436a('0x33')],qs[_0x436a('0x3a')](_0x5ae4ce[_0x436a('0x36')][_0x436a('0x3a')]));_0x1e9b17[_0x436a('0x39')]=_0x1e9b17[_0x436a('0x39')][_0x436a('0x3b')]?_0x1e9b17[_0x436a('0x39')]:_0x3f7ce1[_0x436a('0x33')];if(!_0x5ae4ce[_0x436a('0x36')][_0x436a('0x3c')](_0x436a('0x3d'))){_0x1e9b17[_0x436a('0x24')]=qs['limit'](_0x5ae4ce['query'][_0x436a('0x24')]);_0x1e9b17[_0x436a('0x21')]=qs[_0x436a('0x21')](_0x5ae4ce[_0x436a('0x36')][_0x436a('0x21')]);}_0x1e9b17[_0x436a('0x3e')]=qs[_0x436a('0x3f')](_0x5ae4ce['query'][_0x436a('0x3f')]);_0x1e9b17['where']=qs[_0x436a('0x37')](_[_0x436a('0x40')](_0x5ae4ce[_0x436a('0x36')],_0x3f7ce1[_0x436a('0x37')]),_0x3e4714);if(_0x5ae4ce[_0x436a('0x36')][_0x436a('0x41')]){_0x1e9b17[_0x436a('0x42')]=_[_0x436a('0x43')](_0x1e9b17['where'],{'$or':_[_0x436a('0x34')](_0x3e4714,function(_0x2a9d0f){if(_0x2a9d0f['type']!==_0x436a('0x44')){var _0x47b173={};_0x47b173[_0x2a9d0f[_0x436a('0x2c')]]={'$like':'%'+_0x5ae4ce[_0x436a('0x36')][_0x436a('0x41')]+'%'};return _0x47b173;}})});}_0x1e9b17=_[_0x436a('0x43')]({},_0x1e9b17,_0x5ae4ce[_0x436a('0x45')]);var _0x552b9f={'where':_0x1e9b17[_0x436a('0x42')]};return db[_0x436a('0x2f')][_0x436a('0x23')](_0x552b9f)['then'](function(_0x14ec7a){_0x50e85d[_0x436a('0x23')]=_0x14ec7a;if(_0x5ae4ce[_0x436a('0x36')][_0x436a('0x46')]){_0x1e9b17[_0x436a('0x47')]=[{'all':!![]}];}return db[_0x436a('0x2f')]['findAll'](_0x1e9b17);})[_0x436a('0x2a')](function(_0x4b186b){_0x50e85d[_0x436a('0x48')]=_0x4b186b;return _0x50e85d;})['then'](respondWithFilteredResult(_0x218275,_0x1e9b17))[_0x436a('0x49')](handleError(_0x218275,null));};exports['show']=function(_0x147e3b,_0x42109c){var _0x30c0c7={'raw':!![],'where':{'id':_0x147e3b[_0x436a('0x4a')]['id']}},_0x4b4fbd={};_0x4b4fbd[_0x436a('0x33')]=_['keys'](db[_0x436a('0x2f')][_0x436a('0x30')]);_0x4b4fbd[_0x436a('0x36')]=_['keys'](_0x147e3b[_0x436a('0x36')]);_0x4b4fbd[_0x436a('0x37')]=_[_0x436a('0x38')](_0x4b4fbd['model'],_0x4b4fbd['query']);_0x30c0c7[_0x436a('0x39')]=_[_0x436a('0x38')](_0x4b4fbd[_0x436a('0x33')],qs['fields'](_0x147e3b[_0x436a('0x36')][_0x436a('0x3a')]));_0x30c0c7[_0x436a('0x39')]=_0x30c0c7[_0x436a('0x39')][_0x436a('0x3b')]?_0x30c0c7[_0x436a('0x39')]:_0x4b4fbd[_0x436a('0x33')];if(_0x147e3b[_0x436a('0x36')][_0x436a('0x46')]){_0x30c0c7[_0x436a('0x47')]=[{'all':!![]}];}_0x30c0c7=_[_0x436a('0x43')]({},_0x30c0c7,_0x147e3b[_0x436a('0x45')]);return db[_0x436a('0x2f')][_0x436a('0x4b')](_0x30c0c7)[_0x436a('0x2a')](handleEntityNotFound(_0x42109c,null))[_0x436a('0x2a')](respondWithResult(_0x42109c,null))[_0x436a('0x49')](handleError(_0x42109c,null));};exports[_0x436a('0x4c')]=function(_0x2c9c94,_0xce824c){return db[_0x436a('0x2f')][_0x436a('0x4c')](_0x2c9c94[_0x436a('0x4d')],{})[_0x436a('0x2a')](respondWithResult(_0xce824c,0xc9))[_0x436a('0x49')](handleError(_0xce824c,null));};exports['update']=function(_0x4fa485,_0xcdee68){if(_0x4fa485[_0x436a('0x4d')]['id']){delete _0x4fa485[_0x436a('0x4d')]['id'];}return db[_0x436a('0x2f')][_0x436a('0x4b')]({'where':{'id':_0x4fa485[_0x436a('0x4a')]['id']}})[_0x436a('0x2a')](handleEntityNotFound(_0xcdee68,null))[_0x436a('0x2a')](saveUpdates(_0x4fa485[_0x436a('0x4d')],null))[_0x436a('0x2a')](respondWithResult(_0xcdee68,null))[_0x436a('0x49')](handleError(_0xcdee68,null));};exports['destroy']=function(_0x1651dc,_0xcee4d){return db['SmsApplication']['find']({'where':{'id':_0x1651dc['params']['id']}})['then'](handleEntityNotFound(_0xcee4d,null))[_0x436a('0x2a')](removeEntity(_0xcee4d,null))[_0x436a('0x49')](handleError(_0xcee4d,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 05220a6..f149662 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 _0x40cb=['path','rimraf','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4be313,_0x87e6c7){var _0x4855de=function(_0x3733c9){while(--_0x3733c9){_0x4be313['push'](_0x4be313['shift']());}};_0x4855de(++_0x87e6c7);}(_0x40cb,0x108));var _0xb40c=function(_0xcfd1c9,_0x4c7e6e){_0xcfd1c9=_0xcfd1c9-0x0;var _0x31c9de=_0x40cb[_0xcfd1c9];return _0x31c9de;};'use strict';var _=require(_0xb40c('0x0'));var util=require(_0xb40c('0x1'));var logger=require(_0xb40c('0x2'))(_0xb40c('0x3'));var moment=require('moment');var BPromise=require(_0xb40c('0x4'));var rp=require(_0xb40c('0x5'));var fs=require('fs');var path=require(_0xb40c('0x6'));var rimraf=require(_0xb40c('0x7'));var config=require('../../config/environment');var attributes=require(_0xb40c('0x8'));module[_0xb40c('0x9')]=function(_0x4c650d,_0x36120e){return _0x4c650d[_0xb40c('0xa')](_0xb40c('0xb'),attributes,{'tableName':_0xb40c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb40c('0xd'),'collate':_0xb40c('0xe')});}; \ No newline at end of file +var _0xd999=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','define','sms_applications','utf8mb4_unicode_ci'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xd999,0x9c));var _0x9d99=function(_0x36a3d1,_0x4a32cd){_0x36a3d1=_0x36a3d1-0x0;var _0x821ef4=_0xd999[_0x36a3d1];return _0x821ef4;};'use strict';var _=require(_0x9d99('0x0'));var util=require('util');var logger=require(_0x9d99('0x1'))(_0x9d99('0x2'));var moment=require(_0x9d99('0x3'));var BPromise=require(_0x9d99('0x4'));var rp=require(_0x9d99('0x5'));var fs=require('fs');var path=require(_0x9d99('0x6'));var rimraf=require(_0x9d99('0x7'));var config=require('../../config/environment');var attributes=require(_0x9d99('0x8'));module['exports']=function(_0x51e1eb,_0x2096dc){return _0x51e1eb[_0x9d99('0x9')]('SmsApplication',attributes,{'tableName':_0x9d99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9d99('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index b8d418a..ef60cfd 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 _0xb875=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x362a9d,_0x340349){var _0x5a214b=function(_0x1e113e){while(--_0x1e113e){_0x362a9d['push'](_0x362a9d['shift']());}};_0x5a214b(++_0x340349);}(_0xb875,0x167));var _0x5b87=function(_0x152347,_0x3d4b94){_0x152347=_0x152347-0x0;var _0x518b9a=_0xb875[_0x152347];return _0x518b9a;};'use strict';var _=require(_0x5b87('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5b87('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b87('0x2'))['db'];var utils=require(_0x5b87('0x3'));var logger=require('../../config/logger')(_0x5b87('0x4'));var config=require(_0x5b87('0x5'));var jayson=require(_0x5b87('0x6'));var client=jayson[_0x5b87('0x7')][_0x5b87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b27af,_0x1fc1a8,_0x46b1bf){return new BPromise(function(_0x1fb944,_0xb2888){return client['request'](_0x5b27af,_0x46b1bf)[_0x5b87('0x9')](function(_0x537f81){logger[_0x5b87('0xa')](_0x5b87('0xb'),_0x1fc1a8,_0x5b87('0xc'));logger[_0x5b87('0xd')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x1fc1a8,'request\x20sent',JSON[_0x5b87('0xe')](_0x537f81));if(_0x537f81[_0x5b87('0xf')]){if(_0x537f81['error'][_0x5b87('0x10')]===0x1f4){logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x537f81[_0x5b87('0xf')][_0x5b87('0x11')]);return _0xb2888(_0x537f81[_0x5b87('0xf')][_0x5b87('0x11')]);}logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x537f81['error'][_0x5b87('0x11')]);return _0x1fb944(_0x537f81['error'][_0x5b87('0x11')]);}else{logger[_0x5b87('0xa')]('SmsApplication,\x20%s,\x20%s',_0x1fc1a8,'request\x20sent');_0x1fb944(_0x537f81[_0x5b87('0x12')]['message']);}})[_0x5b87('0x13')](function(_0x175452){logger[_0x5b87('0xf')](_0x5b87('0xb'),_0x1fc1a8,_0x175452);_0xb2888(_0x175452);});});} \ No newline at end of file +var _0x5453=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1da1ca,_0x58b277){var _0x78944c=function(_0x12981c){while(--_0x12981c){_0x1da1ca['push'](_0x1da1ca['shift']());}};_0x78944c(++_0x58b277);}(_0x5453,0x18b));var _0x3545=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5453[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x3545('0x0'));var util=require(_0x3545('0x1'));var moment=require(_0x3545('0x2'));var BPromise=require(_0x3545('0x3'));var rs=require(_0x3545('0x4'));var fs=require('fs');var Redis=require(_0x3545('0x5'));var db=require(_0x3545('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3545('0x7'));var config=require(_0x3545('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3545('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x290aa5,_0x496d6b,_0x5d5808){return new BPromise(function(_0x2974ae,_0x3cf0cc){return client[_0x3545('0xa')](_0x290aa5,_0x5d5808)['then'](function(_0x21dc51){logger[_0x3545('0xb')](_0x3545('0xc'),_0x496d6b,_0x3545('0xd'));logger[_0x3545('0xe')](_0x3545('0xf'),_0x496d6b,_0x3545('0xd'),JSON['stringify'](_0x21dc51));if(_0x21dc51['error']){if(_0x21dc51[_0x3545('0x10')][_0x3545('0x11')]===0x1f4){logger[_0x3545('0x10')](_0x3545('0xc'),_0x496d6b,_0x21dc51['error']['message']);return _0x3cf0cc(_0x21dc51['error'][_0x3545('0x12')]);}logger[_0x3545('0x10')]('SmsApplication,\x20%s,\x20%s',_0x496d6b,_0x21dc51[_0x3545('0x10')]['message']);return _0x2974ae(_0x21dc51['error'][_0x3545('0x12')]);}else{logger[_0x3545('0xb')]('SmsApplication,\x20%s,\x20%s',_0x496d6b,_0x3545('0xd'));_0x2974ae(_0x21dc51[_0x3545('0x13')]['message']);}})[_0x3545('0x14')](function(_0x51f69b){logger[_0x3545('0x10')](_0x3545('0xc'),_0x496d6b,_0x51f69b);_0x3cf0cc(_0x51f69b);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 7c95687..dee999d 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 _0x9354=['/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x30d9e0,_0x5119a8){var _0x1b5f37=function(_0x3043ff){while(--_0x3043ff){_0x30d9e0['push'](_0x30d9e0['shift']());}};_0x1b5f37(++_0x5119a8);}(_0x9354,0x96));var _0x4935=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x9354[_0x999b85];return _0x1d7124;};'use strict';var multer=require('multer');var util=require(_0x4935('0x0'));var path=require(_0x4935('0x1'));var timeout=require('connect-timeout');var express=require(_0x4935('0x2'));var router=express[_0x4935('0x3')]();var fs_extra=require(_0x4935('0x4'));var auth=require(_0x4935('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4935('0x6'));var controller=require(_0x4935('0x7'));router[_0x4935('0x8')]('/',auth[_0x4935('0x9')](),controller[_0x4935('0xa')]);router[_0x4935('0x8')](_0x4935('0xb'),auth[_0x4935('0x9')](),controller[_0x4935('0xc')]);router['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x4935('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4935('0x12')]);router[_0x4935('0x13')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x13')](_0x4935('0x15'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')](_0x4935('0x17'),_0x4935('0x18')),controller[_0x4935('0x19')]);router[_0x4935('0x1a')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1b')),controller[_0x4935('0x1c')]);router[_0x4935('0x1d')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1e')),controller[_0x4935('0x1f')]);router['delete'](_0x4935('0x15'),auth[_0x4935('0x9')](),controller[_0x4935('0x20')]);module['exports']=router; \ No newline at end of file +var _0x36ee=['../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','sms','smsinteraction:update','update','delete','smsinteraction:destroy','/:id/tags','removeTags','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x33866f,_0x4fd12c){var _0x54a057=function(_0x1ee35a){while(--_0x1ee35a){_0x33866f['push'](_0x33866f['shift']());}};_0x54a057(++_0x4fd12c);}(_0x36ee,0xe8));var _0xe36e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x36ee[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['get'](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0xe')]);router['get'](_0xe36e('0xf'),auth['isAuthenticated'](),controller[_0xe36e('0x10')]);router[_0xe36e('0x8')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x12')]);router[_0xe36e('0x13')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x14')]);router['post'](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router[_0xe36e('0x13')]('/:id/tags',auth[_0xe36e('0x9')](),interaction['tracked']('sms',_0xe36e('0x16')),controller[_0xe36e('0x17')]);router[_0xe36e('0x18')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')](_0xe36e('0x1a'),_0xe36e('0x1b')),controller[_0xe36e('0x1c')]);router[_0xe36e('0x1d')]('/:id',auth[_0xe36e('0x9')](),interaction[_0xe36e('0x19')]('sms',_0xe36e('0x1e')),controller['destroy']);router[_0xe36e('0x1d')](_0xe36e('0x1f'),auth['isAuthenticated'](),controller[_0xe36e('0x20')]);module[_0xe36e('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index e28d39b..45acd23 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 _0x304b=['exports','BOOLEAN','DATE','STRING','ENUM','out','moment'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x304b,0xfb));var _0xb304=function(_0x1d701c,_0x338ce1){_0x1d701c=_0x1d701c-0x0;var _0x164129=_0x304b[_0x1d701c];return _0x164129;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb304('0x0'));module[_0xb304('0x1')]={'closed':{'type':Sequelize[_0xb304('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb304('0x3')]},'disposition':{'type':Sequelize[_0xb304('0x4')]},'secondDisposition':{'type':Sequelize[_0xb304('0x4')]},'thirdDisposition':{'type':Sequelize[_0xb304('0x4')]},'note':{'type':Sequelize[_0xb304('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb304('0x5')]('in',_0xb304('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb304('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb304('0x5')]('in',_0xb304('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb304('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x3561=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x5056a4,_0x510d7f){var _0x46d1f5=function(_0x21839a){while(--_0x21839a){_0x5056a4['push'](_0x5056a4['shift']());}};_0x46d1f5(++_0x510d7f);}(_0x3561,0x94));var _0x1356=function(_0x411704,_0xb8dba){_0x411704=_0x411704-0x0;var _0x21c0eb=_0x3561[_0x411704];return _0x21c0eb;};'use strict';var Sequelize=require(_0x1356('0x0'));var moment=require('moment');module[_0x1356('0x1')]={'closed':{'type':Sequelize[_0x1356('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1356('0x3')]},'disposition':{'type':Sequelize[_0x1356('0x4')]},'secondDisposition':{'type':Sequelize[_0x1356('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1356('0x4')]},'note':{'type':Sequelize[_0x1356('0x4')]},'phone':{'type':Sequelize[_0x1356('0x4')]},'read1stAt':{'type':Sequelize[_0x1356('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x1356('0x5')]('in',_0x1356('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1356('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x1356('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1356('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 97e6697..ae5f6e5 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 _0x6e90=['N.A.','closed','closedAt','disposition','Messages','out','System','direction','renderFile','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','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','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','update','then','error','name','send','Users','TagIds','Tags','forEach','push','index','map','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','u.id','u.fullname','user_has_sms_interactions','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','Contact','operator','split','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','compact','isEmpty','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','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','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','i.SmsAccountId\x20IS\x20NULL','agent','SmsAccountId','sequelize','toString','keyBy','SmsInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','all','catch','show','params','keys','rawAttributes','includeAll','include','merge','create','body','describe','addMessage','SmsMessage','ids','omit','findOne','SmsInteractionId','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','setTags','spread','emit','removeTags','download','join','root','server','tmp','files','fullname','CmContact','firstName','lastName','secret','SmsAccount','Owner','get','mkdirSync','Sms','Account'];(function(_0x108e32,_0xb0ad26){var _0x194645=function(_0x413f65){while(--_0x413f65){_0x108e32['push'](_0x108e32['shift']());}};_0x194645(++_0xb0ad26);}(_0x6e90,0xf5));var _0x06e9=function(_0x476b3a,_0x1d09be){_0x476b3a=_0x476b3a-0x0;var _0x113ea4=_0x6e90[_0x476b3a];return _0x113ea4;};'use strict';var emlformat=require(_0x06e9('0x0'));var rimraf=require(_0x06e9('0x1'));var zipdir=require(_0x06e9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06e9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x06e9('0x4'));var util=require(_0x06e9('0x5'));var path=require(_0x06e9('0x6'));var sox=require(_0x06e9('0x7'));var csv=require(_0x06e9('0x8'));var ejs=require(_0x06e9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06e9('0xa'));var squel=require(_0x06e9('0xb'));var crypto=require(_0x06e9('0xc'));var jsforce=require(_0x06e9('0xd'));var deskjs=require(_0x06e9('0xe'));var toCsv=require(_0x06e9('0x8'));var querystring=require(_0x06e9('0xf'));var Papa=require(_0x06e9('0x10'));var Redis=require(_0x06e9('0x11'));var authService=require(_0x06e9('0x12'));var qs=require(_0x06e9('0x13'));var as=require(_0x06e9('0x14'));var pdf=require(_0x06e9('0x15'));var hardwareService=require(_0x06e9('0x16'));var logger=require(_0x06e9('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x06e9('0x18'));var licenseUtil=require(_0x06e9('0x19'));var db=require(_0x06e9('0x1a'))['db'];config[_0x06e9('0x1b')]=_[_0x06e9('0x1c')](config[_0x06e9('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x06e9('0x1d'))(new Redis(config[_0x06e9('0x1b')]));require(_0x06e9('0x1e'))[_0x06e9('0x1f')](socket);function respondWithStatusCode(_0x1ab196,_0x250c85){_0x250c85=_0x250c85||0xcc;return function(_0xf808b6){if(_0xf808b6){return _0x1ab196[_0x06e9('0x20')](_0x250c85);}return _0x1ab196[_0x06e9('0x21')](_0x250c85)[_0x06e9('0x22')]();};}function respondWithResult(_0x999fee,_0x5c2652){_0x5c2652=_0x5c2652||0xc8;return function(_0x524301){if(_0x524301){return _0x999fee[_0x06e9('0x21')](_0x5c2652)[_0x06e9('0x23')](_0x524301);}};}function respondWithFilteredResult(_0x2dced5,_0x54167b){return function(_0x2df51f){if(_0x2df51f){var _0x22cc1e=typeof _0x54167b['offset']===_0x06e9('0x24')&&typeof _0x54167b[_0x06e9('0x25')]==='undefined';var _0x5950a7=_0x2df51f[_0x06e9('0x26')];var _0x36bc0e=_0x22cc1e?0x0:_0x54167b[_0x06e9('0x27')];var _0x3d6d4f=_0x22cc1e?_0x2df51f['count']:_0x54167b['offset']+_0x54167b['limit'];var _0x16e702;if(_0x3d6d4f>=_0x5950a7){_0x3d6d4f=_0x5950a7;_0x16e702=0xc8;}else{_0x16e702=0xce;}_0x2dced5[_0x06e9('0x21')](_0x16e702);return _0x2dced5[_0x06e9('0x28')]('Content-Range',_0x36bc0e+'-'+_0x3d6d4f+'/'+_0x5950a7)[_0x06e9('0x23')](_0x2df51f);}return null;};}function patchUpdates(_0x505e27){return function(_0x4e58d5){try{jsonpatch[_0x06e9('0x29')](_0x4e58d5,_0x505e27,!![]);}catch(_0x3a6936){return BPromise['reject'](_0x3a6936);}return _0x4e58d5['save']();};}function saveUpdates(_0x474941,_0x44e0c6){return function(_0x13f5ce){if(_0x13f5ce){return _0x13f5ce[_0x06e9('0x2a')](_0x474941)['then'](function(_0x2914c9){return _0x2914c9;});}return null;};}function removeEntity(_0x24b1ad,_0x405c41){return function(_0xe69735){if(_0xe69735){return _0xe69735['destroy']()[_0x06e9('0x2b')](function(){_0x24b1ad['status'](0xcc)[_0x06e9('0x22')]();});}};}function handleEntityNotFound(_0x426a29,_0x1f685){return function(_0x280bdd){if(!_0x280bdd){_0x426a29['sendStatus'](0x194);}return _0x280bdd;};}function handleError(_0x3c3f39,_0x13a981){_0x13a981=_0x13a981||0x1f4;return function(_0x5e58c2){logger[_0x06e9('0x2c')](_0x5e58c2['stack']);if(_0x5e58c2[_0x06e9('0x2d')]){delete _0x5e58c2[_0x06e9('0x2d')];}_0x3c3f39[_0x06e9('0x21')](_0x13a981)[_0x06e9('0x2e')](_0x5e58c2);};}function getInteractionUsers(_0x4d1b10,_0x490377){return new BPromise(function(_0x355858,_0x574bbf){try{if(_0x490377[_0x4d1b10['id']]){_0x4d1b10[_0x06e9('0x2f')]=_['map'](_0x490377[_0x4d1b10['id']],function(_0x2eeb67){return{'id':_0x2eeb67['id'],'fullname':_0x2eeb67['fullname']};});}}catch(_0x104467){_0x574bbf(_0x104467);}_0x355858(_0x4d1b10);});}function getInteractionTags(_0x544f2c,_0x2a5197){return new BPromise(function(_0x5ace90,_0x17beeb){try{if(_0x544f2c[_0x06e9('0x30')]){_0x544f2c[_0x06e9('0x31')]=[];_0x544f2c[_0x06e9('0x30')]['split'](',')[_0x06e9('0x32')](function(_0x37f9c4){_0x544f2c['Tags'][_0x06e9('0x33')](_0x2a5197[_0x37f9c4]);});}delete _0x544f2c[_0x06e9('0x30')];}catch(_0x44ed8d){_0x17beeb(_0x44ed8d);}_0x5ace90(_0x544f2c);});}function updateSmsInteraction(_0x5b68c4,_0x2b35b7,_0x499791){return new BPromise(function(_0xb4f877,_0x5139ba){return getInteractionUsers(_0x5b68c4,_0x499791)[_0x06e9('0x2b')](function(_0x2afbf7){return getInteractionTags(_0x2afbf7,_0x2b35b7);})[_0x06e9('0x2b')](function(_0x377aac){_0xb4f877(_0x377aac);})['catch'](function(_0x5135bf){_0x5139ba(_0x5135bf);});});}exports[_0x06e9('0x34')]=function(_0x23d5f6,_0x5b5e18){var _0x3580c7={},_0x432324={},_0x5e29a6={'count':0x0,'rows':[]};var _0x449f0c=_[_0x06e9('0x35')](db['SmsInteraction']['rawAttributes'],function(_0x4f6d6d){return{'name':_0x4f6d6d['fieldName'],'type':_0x4f6d6d[_0x06e9('0x36')][_0x06e9('0x37')]};});_0x432324[_0x06e9('0x38')]=_['map'](_0x449f0c,_0x06e9('0x2d'));_0x432324[_0x06e9('0x39')]=_['keys'](_0x23d5f6[_0x06e9('0x39')]);_0x432324['filters']=_[_0x06e9('0x3a')](_0x432324[_0x06e9('0x38')],_0x432324[_0x06e9('0x39')]);_0x3580c7[_0x06e9('0x3b')]=_[_0x06e9('0x3a')](_0x432324['model'],qs[_0x06e9('0x3c')](_0x23d5f6[_0x06e9('0x39')][_0x06e9('0x3c')]));_0x3580c7['attributes']=_0x3580c7['attributes'][_0x06e9('0x3d')]?_0x3580c7[_0x06e9('0x3b')]:_0x432324['model'];if(!_0x23d5f6[_0x06e9('0x39')][_0x06e9('0x3e')](_0x06e9('0x3f'))){_0x3580c7[_0x06e9('0x25')]=qs['limit'](_0x23d5f6[_0x06e9('0x39')][_0x06e9('0x25')]);_0x3580c7[_0x06e9('0x27')]=qs[_0x06e9('0x27')](_0x23d5f6['query'][_0x06e9('0x27')]);}_0x3580c7[_0x06e9('0x40')]=qs[_0x06e9('0x41')](_0x23d5f6[_0x06e9('0x39')][_0x06e9('0x41')]);_0x3580c7[_0x06e9('0x42')]=qs[_0x06e9('0x43')](_[_0x06e9('0x44')](_0x23d5f6['query'],_0x432324[_0x06e9('0x43')]),_0x449f0c);var _0x178b0f=[];var _0x43e06b=squel[_0x06e9('0x45')]()['field']('id')[_0x06e9('0x46')](_0x06e9('0x2d'))[_0x06e9('0x46')](_0x06e9('0x47'))[_0x06e9('0x48')]('tools_tags');var _0x4e6531=squel[_0x06e9('0x45')]()['field'](_0x06e9('0x49'))[_0x06e9('0x46')](_0x06e9('0x4a'))[_0x06e9('0x46')]('ui.SmsInteractionId')[_0x06e9('0x48')](_0x06e9('0x4b'),'ui')['left_join']('users','u',_0x06e9('0x4c'));var _0xde44f1=squel[_0x06e9('0x45')]()[_0x06e9('0x48')](_0x06e9('0x4d'),'i')[_0x06e9('0x4e')](_0x06e9('0x4f'),'c',_0x06e9('0x50'))[_0x06e9('0x4e')]('users','o',_0x06e9('0x51'))['left_join'](_0x06e9('0x52'),'a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x06e9('0x53'),'me',_0x06e9('0x54'))['left_join'](_0x06e9('0x55'),'it','it.SmsInteractionId\x20=\x20i.id')['left_join'](_0x06e9('0x56'),'t','t.id\x20=\x20it.TagId');var _0x2ec2f1=squel[_0x06e9('0x57')]();var _0xef7003=[];var _0x2f9dcb=squel['expr']();var _0x1f9c39;if(_0x23d5f6[_0x06e9('0x39')][_0x06e9('0x58')]){_0x1f9c39=as[_0x06e9('0x59')](_0x23d5f6[_0x06e9('0x39')][_0x06e9('0x58')]);var _0x5048c9=_0x1f9c39[_0x06e9('0x5a')];for(var _0x458402=0x0;_0x458402<_0x1f9c39[_0x06e9('0x5b')]['length'];_0x458402++){var _0x190c75=_0x1f9c39[_0x06e9('0x5b')][_0x458402];var _0x68ff1e='i';var _0x284bc6=_[_0x06e9('0x5c')](_0x449f0c,['name',_0x190c75[_0x06e9('0x46')]]);if(!_0x284bc6){switch(_0x190c75['field']){case _0x06e9('0x5d'):if(_0x190c75[_0x06e9('0x5e')]==0x1){_0xde44f1['having']('`'+_0x190c75['field']+'`\x20=\x200');}else{_0xde44f1[_0x06e9('0x5f')]('`'+_0x190c75[_0x06e9('0x46')]+'`\x20>\x200');}break;case _0x06e9('0x60'):if(_0x190c75[_0x06e9('0x61')]==='$substring'){if(_0x190c75['value'][_0x06e9('0x62')]('\x20')[_0x06e9('0x3d')]>0x1){_0x2ec2f1[_0x5048c9]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x06e9('0x63')](_0x190c75['value']),null);}else{var _0x5decbc='%'+_0x190c75['value']+'%';_0x2ec2f1[_0x5048c9]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5decbc,_0x5decbc,_0x5decbc);}}else{_0x284bc6=_['find'](_0x449f0c,['name',_0x06e9('0x64')]);_0x190c75[_0x06e9('0x46')]=_0x06e9('0x64');_0x350890=as[_0x06e9('0x65')](_0x68ff1e,_0x284bc6[_0x06e9('0x36')],_0x190c75);_0x2ec2f1[_0x5048c9](_0x350890[_0x06e9('0x66')],_0x350890[_0x06e9('0x5e')][_0x06e9('0x67')],_0x350890[_0x06e9('0x5e')][_0x06e9('0x22')]);}break;case _0x06e9('0x68'):var _0x3e0e9b=_0x190c75['value'][_0x06e9('0x62')](',')[_0x06e9('0x35')](function(_0x1831a9){return Number(_0x1831a9);});_0x3e0e9b[_0x06e9('0x32')](function(_0x5e8312){_0x2f9dcb['or'](_0x06e9('0x69'),'%,'+_0x5e8312+',%');});_0xef7003=_['union'](_0xef7003,_0x3e0e9b);break;case _0x06e9('0x6a'):if(_0x190c75[_0x06e9('0x61')]===_0x06e9('0x6b')){_0x2ec2f1[_0x5048c9](_0x06e9('0x6c'),'%'+_0x190c75[_0x06e9('0x5e')]+'%',null);}else{_0x284bc6=_[_0x06e9('0x5c')](_0x449f0c,['name',_0x06e9('0x6d')]);_0x190c75[_0x06e9('0x46')]=_0x06e9('0x6d');_0x350890=as['buildExpression'](_0x68ff1e,_0x284bc6[_0x06e9('0x36')],_0x190c75);_0x2ec2f1[_0x5048c9](_0x350890[_0x06e9('0x66')],_0x350890['value'][_0x06e9('0x67')],_0x350890[_0x06e9('0x5e')][_0x06e9('0x22')]);}break;case'body':_0x350890=as[_0x06e9('0x65')]('me',null,_0x190c75);_0x2ec2f1[_0x5048c9](_0x350890[_0x06e9('0x66')],_0x350890[_0x06e9('0x5e')]['start'],_0x350890[_0x06e9('0x5e')][_0x06e9('0x22')]);break;}}else{var _0x350890=as[_0x06e9('0x65')](_0x68ff1e,_0x284bc6[_0x06e9('0x36')],_0x190c75);_0x2ec2f1[_0x5048c9](_0x350890[_0x06e9('0x66')],_0x350890[_0x06e9('0x5e')][_0x06e9('0x67')],_0x350890['value'][_0x06e9('0x22')]);}}}else{var _0x1e3eee=_(_0x23d5f6['query'])['keys']()[_0x06e9('0x35')](function(_0x26ac58){return _[_0x06e9('0x6e')](_0x449f0c,[_0x06e9('0x2d'),_0x26ac58])?_0x26ac58:undefined;})[_0x06e9('0x6f')]()[_0x06e9('0x5e')]();if(!_[_0x06e9('0x70')](_0x1e3eee)){_0x1e3eee[_0x06e9('0x32')](function(_0x466d01){if(_0x466d01==='SmsAccountId'){_0xde44f1[_0x06e9('0x42')](_0x06e9('0x71'),[][_0x06e9('0x72')](_0x23d5f6[_0x06e9('0x39')][_0x466d01]));}else if(_0x466d01===_0x06e9('0x73')){var _0xca7886=JSON[_0x06e9('0x74')](_0x23d5f6[_0x06e9('0x39')][_0x466d01])[_0x06e9('0x75')];var _0x1392e6=JSON[_0x06e9('0x74')](_0x23d5f6[_0x06e9('0x39')][_0x466d01])[_0x06e9('0x76')];_0xde44f1[_0x06e9('0x42')](_0x06e9('0x77'),_0xca7886,_0x1392e6);}else{if(_0x23d5f6[_0x06e9('0x39')][_0x466d01]===_0x06e9('0x78')){_0xde44f1[_0x06e9('0x42')]('i.'+_0x466d01+_0x06e9('0x79'));}else{_0xde44f1['where']('i.'+_0x466d01+'\x20=\x20?',_0x23d5f6[_0x06e9('0x39')][_0x466d01]);}}});}if(_0x23d5f6['query'][_0x06e9('0x7a')]){if(_0x23d5f6[_0x06e9('0x39')][_0x06e9('0x7a')]==0x1){_0xde44f1[_0x06e9('0x5f')](_0x06e9('0x7b'));}else{_0xde44f1[_0x06e9('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0x23d5f6[_0x06e9('0x39')][_0x06e9('0x7c')]){_0xef7003=_[_0x06e9('0x7d')](_0x23d5f6['query'][_0x06e9('0x7c')])?_0x23d5f6['query']['tag']:new Array(_0x23d5f6[_0x06e9('0x39')]['tag']);_0xef7003[_0x06e9('0x32')](function(_0x97f74c){_0x2f9dcb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x97f74c+',%');});}if(_0x23d5f6[_0x06e9('0x39')][_0x06e9('0x7e')]){var _0x166245=_0x23d5f6[_0x06e9('0x39')][_0x06e9('0x7e')][_0x06e9('0x7f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x06e9('0x80')](_0x166245)){_0x2ec2f1['or'](_0x06e9('0x81'),_0x166245+'%')['or']('i.phone\x20LIKE\x20?',_0x166245+'%');}else{_0x2ec2f1['or'](_0x06e9('0x82'),qs[_0x06e9('0x63')](_0x166245))['or'](_0x06e9('0x83'),_0x166245+'%');}}}_0xde44f1[_0x06e9('0x42')](_0x2ec2f1);_0xde44f1[_0x06e9('0x84')]('i.id');var _0x55c8a0={'type':db['Sequelize'][_0x06e9('0x85')][_0x06e9('0x86')],'raw':!![]};var _0x339d6f=_0xde44f1[_0x06e9('0x87')]();_0x339d6f[_0x06e9('0x46')](_0x06e9('0x88'));_0x339d6f['field'](_0x06e9('0x89'),_0x06e9('0x5d'));if(_0x3580c7['order']){_0x3580c7[_0x06e9('0x40')]['forEach'](function(_0x37b5ff){var _0x5ae782=_0x37b5ff[0x0]===_0x06e9('0x8a')?_0x37b5ff[0x0]:'i.'+_0x37b5ff[0x0];_0xde44f1['order'](_0x5ae782,_0x37b5ff[0x1]===_0x06e9('0x8b')?![]:!![]);});}if(!_[_0x06e9('0x70')](_0xef7003)){_0xde44f1[_0x06e9('0x5f')](_0x2f9dcb);_0x339d6f['where'](_0x06e9('0x8c'),_0xef7003);}BPromise[_0x06e9('0x8d')]()[_0x06e9('0x2b')](function(){if(!_0x1f9c39){if(_0x23d5f6[_0x06e9('0x39')]['SmsAccountId'])return;_0x339d6f[_0x06e9('0x42')](_0x06e9('0x8e'));_0xde44f1['where'](_0x06e9('0x8e'));return;}if(_0x23d5f6[_0x06e9('0x8f')][_0x06e9('0x90')]!=='agent')return;return _0x23d5f6[_0x06e9('0x8f')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x06e9('0x2b')](function(_0xa5f643){if(_[_0x06e9('0x70')](_0xa5f643)){_0x339d6f[_0x06e9('0x42')](_0x06e9('0x91'));_0xde44f1[_0x06e9('0x42')](_0x06e9('0x91'));}else{_0x339d6f[_0x06e9('0x42')]('i.SmsAccountId\x20IN\x20?',_[_0x06e9('0x35')](_0xa5f643,'id'));_0xde44f1[_0x06e9('0x42')](_0x06e9('0x71'),_[_0x06e9('0x35')](_0xa5f643,'id'));}});})[_0x06e9('0x2b')](function(){if(_0x23d5f6[_0x06e9('0x8f')][_0x06e9('0x90')]===_0x06e9('0x92')&&!_0x1f9c39&&!_0x23d5f6[_0x06e9('0x39')][_0x06e9('0x93')])return[];return db[_0x06e9('0x94')][_0x06e9('0x39')](_0x339d6f[_0x06e9('0x95')](),_0x55c8a0);})[_0x06e9('0x2b')](function(_0x4ae6d0){_0x5e29a6['count']=_0x4ae6d0[_0x06e9('0x3d')];if(_0x5e29a6['count']===0x0)return[];return db[_0x06e9('0x94')][_0x06e9('0x39')](_0x43e06b['toString'](),_0x55c8a0)['then'](function(_0x21a50c){_0x178b0f=_[_0x06e9('0x96')](_0x21a50c,'id');_0x55c8a0=_['merge'](_0x55c8a0,{'model':db[_0x06e9('0x97')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x23d5f6[_0x06e9('0x39')]['fields']){_0x3580c7['attributes'][_0x06e9('0x32')](function(_0x2174c6){_0xde44f1['field']('i.'+_0x2174c6);});}else{_0xde44f1[_0x06e9('0x46')](_0x06e9('0x89'),_0x06e9('0x5d'));_0xde44f1[_0x06e9('0x46')](_0x06e9('0x98'),_0x06e9('0x99'));_0xde44f1['field'](_0x06e9('0x9a'),_0x06e9('0x9b'));_0xde44f1[_0x06e9('0x46')](_0x06e9('0x9c'),_0x06e9('0x8a'));_0xde44f1['field'](_0x06e9('0x9d'));_0xde44f1['field']('c.firstName','Contact.firstName');_0xde44f1[_0x06e9('0x46')]('c.lastName',_0x06e9('0x9e'));_0xde44f1[_0x06e9('0x46')]('c.email',_0x06e9('0x9f'));_0xde44f1['field'](_0x06e9('0xa0'),_0x06e9('0xa1'));_0xde44f1[_0x06e9('0x46')](_0x06e9('0xa2'),_0x06e9('0xa3'));_0xde44f1[_0x06e9('0x46')]('c.fax',_0x06e9('0xa4'));_0xde44f1[_0x06e9('0x46')](_0x06e9('0xa5'),_0x06e9('0xa6'));_0xde44f1[_0x06e9('0x46')]('o.internal',_0x06e9('0xa7'));_0xde44f1['field'](_0x06e9('0xa8'),_0x06e9('0x30'));}if(_0x3580c7[_0x06e9('0x25')])_0xde44f1[_0x06e9('0x25')](_0x3580c7[_0x06e9('0x25')]);if(_0x3580c7['offset'])_0xde44f1[_0x06e9('0x27')](_0x3580c7[_0x06e9('0x27')]);return db[_0x06e9('0x94')]['query'](_0xde44f1['toString'](),_0x55c8a0);})[_0x06e9('0x2b')](function(_0x5a8dd0){if(_0x5a8dd0[_0x06e9('0x3d')]>0x0)_0x4e6531[_0x06e9('0x42')](_0x06e9('0xa9'),_[_0x06e9('0x35')](_0x5a8dd0,'id'));return db[_0x06e9('0x94')][_0x06e9('0x39')](_0x4e6531[_0x06e9('0x95')](),_0x55c8a0)[_0x06e9('0x2b')](function(_0x1d32d4){var _0x5960c4=_['groupBy'](_0x1d32d4,'SmsInteractionId');var _0x219781=[];_0x5a8dd0['forEach'](function(_0x1cd53f){_0x219781[_0x06e9('0x33')](updateSmsInteraction(_0x1cd53f,_0x178b0f,_0x5960c4));});return BPromise[_0x06e9('0xaa')](_0x219781);});});})[_0x06e9('0x2b')](function(_0x3ef501){_0x5e29a6['rows']=_0x3ef501;return _0x5e29a6;})[_0x06e9('0x2b')](respondWithFilteredResult(_0x5b5e18,_0x3580c7))[_0x06e9('0xab')](handleError(_0x5b5e18,null));};exports[_0x06e9('0xac')]=function(_0x3b4ac8,_0x4212af){var _0x5de78b={'raw':![],'where':{'id':_0x3b4ac8[_0x06e9('0xad')]['id']}},_0x2cb5eb={};_0x2cb5eb[_0x06e9('0x38')]=_[_0x06e9('0xae')](db[_0x06e9('0x97')][_0x06e9('0xaf')]);_0x2cb5eb[_0x06e9('0x39')]=_['keys'](_0x3b4ac8[_0x06e9('0x39')]);_0x2cb5eb[_0x06e9('0x43')]=_[_0x06e9('0x3a')](_0x2cb5eb[_0x06e9('0x38')],_0x2cb5eb[_0x06e9('0x39')]);_0x5de78b['attributes']=_['intersection'](_0x2cb5eb[_0x06e9('0x38')],qs[_0x06e9('0x3c')](_0x3b4ac8[_0x06e9('0x39')][_0x06e9('0x3c')]));_0x5de78b['attributes']=_0x5de78b[_0x06e9('0x3b')]['length']?_0x5de78b[_0x06e9('0x3b')]:_0x2cb5eb[_0x06e9('0x38')];if(_0x3b4ac8[_0x06e9('0x39')][_0x06e9('0xb0')]){_0x5de78b[_0x06e9('0xb1')]=[{'all':!![]}];}_0x5de78b=_[_0x06e9('0xb2')]({},_0x5de78b,_0x3b4ac8['options']);return db['SmsInteraction'][_0x06e9('0x5c')](_0x5de78b)['then'](handleEntityNotFound(_0x4212af,null))[_0x06e9('0x2b')](respondWithResult(_0x4212af,null))['catch'](handleError(_0x4212af,null));};exports[_0x06e9('0xb3')]=function(_0x2cbac4,_0x2fbe15){return db[_0x06e9('0x97')]['create'](_0x2cbac4[_0x06e9('0xb4')],{})[_0x06e9('0x2b')](respondWithResult(_0x2fbe15,0xc9))[_0x06e9('0xab')](handleError(_0x2fbe15,null));};exports[_0x06e9('0x2a')]=function(_0x46ede9,_0x121d7b){if(_0x46ede9[_0x06e9('0xb4')]['id']){delete _0x46ede9[_0x06e9('0xb4')]['id'];}return db[_0x06e9('0x97')][_0x06e9('0x5c')]({'where':{'id':_0x46ede9[_0x06e9('0xad')]['id']}})['then'](handleEntityNotFound(_0x121d7b,null))[_0x06e9('0x2b')](saveUpdates(_0x46ede9[_0x06e9('0xb4')],null))[_0x06e9('0x2b')](respondWithResult(_0x121d7b,null))[_0x06e9('0xab')](handleError(_0x121d7b,null));};exports['destroy']=function(_0x445fef,_0x158b8b){return db[_0x06e9('0x97')]['find']({'where':{'id':_0x445fef[_0x06e9('0xad')]['id']}})[_0x06e9('0x2b')](handleEntityNotFound(_0x158b8b,null))[_0x06e9('0x2b')](removeEntity(_0x158b8b,null))[_0x06e9('0xab')](handleError(_0x158b8b,null));};exports[_0x06e9('0xb5')]=function(_0x575f16,_0x4f12e5){return db['SmsInteraction']['describe']()[_0x06e9('0x2b')](respondWithResult(_0x4f12e5,null))['catch'](handleError(_0x4f12e5,null));};exports[_0x06e9('0xb6')]=function(_0x2450f7,_0x2111d7,_0x566be2){return db[_0x06e9('0xb7')]['find']({'where':{'id':_0x2450f7[_0x06e9('0xad')]['id']}})[_0x06e9('0x2b')](handleEntityNotFound(_0x2111d7,null))[_0x06e9('0x2b')](function(_0x23e6f4){if(_0x23e6f4){return _0x23e6f4[_0x06e9('0xb6')](_0x2450f7[_0x06e9('0xb4')][_0x06e9('0xb8')],_[_0x06e9('0xb9')](_0x2450f7['body'],[_0x06e9('0xb8'),'id'])||{});}})['then'](respondWithResult(_0x2111d7,null))[_0x06e9('0xab')](handleError(_0x2111d7,null));};exports['getMessages']=function(_0x1434fe,_0x8b4311,_0x2ce5ad){var _0x63a65a={'raw':![],'where':{}};var _0x293e3f={};var _0x5b78b9={'count':0x0,'rows':[]};return db[_0x06e9('0x97')][_0x06e9('0xba')]({'where':{'id':_0x1434fe[_0x06e9('0xad')]['id']}})[_0x06e9('0x2b')](handleEntityNotFound(_0x8b4311,null))[_0x06e9('0x2b')](function(_0x36517c){if(_0x36517c){_0x293e3f['model']=_[_0x06e9('0xae')](db[_0x06e9('0xb7')][_0x06e9('0xaf')]);_0x293e3f[_0x06e9('0x39')]=_[_0x06e9('0xae')](_0x1434fe[_0x06e9('0x39')]);_0x293e3f[_0x06e9('0x43')]=_[_0x06e9('0x3a')](_0x293e3f[_0x06e9('0x38')],_0x293e3f[_0x06e9('0x39')]);_0x63a65a[_0x06e9('0x3b')]=_['intersection'](_0x293e3f[_0x06e9('0x38')],qs['fields'](_0x1434fe['query']['fields']));_0x63a65a[_0x06e9('0x3b')]=_0x63a65a['attributes'][_0x06e9('0x3d')]?_0x63a65a[_0x06e9('0x3b')]:_0x293e3f['model'];if(!_0x1434fe[_0x06e9('0x39')][_0x06e9('0x3e')]('nolimit')){_0x63a65a[_0x06e9('0x25')]=qs[_0x06e9('0x25')](_0x1434fe['query']['limit']);_0x63a65a[_0x06e9('0x27')]=qs['offset'](_0x1434fe['query'][_0x06e9('0x27')]);}_0x63a65a['order']=qs[_0x06e9('0x41')](_0x1434fe[_0x06e9('0x39')][_0x06e9('0x41')]);_0x63a65a[_0x06e9('0x42')]=qs['filters'](_['pick'](_0x1434fe[_0x06e9('0x39')],_0x293e3f[_0x06e9('0x43')]));_0x63a65a[_0x06e9('0x42')][_0x06e9('0xbb')]=_0x36517c['id'];if(_0x1434fe[_0x06e9('0x39')][_0x06e9('0x7e')]){_0x63a65a[_0x06e9('0x42')]=_[_0x06e9('0xb2')](_0x63a65a[_0x06e9('0x42')],{'$or':_['map'](_0x63a65a['attributes'],function(_0x2fd67f){var _0x38518d={};_0x38518d[_0x2fd67f]={'$like':'%'+_0x1434fe[_0x06e9('0x39')][_0x06e9('0x7e')]+'%'};return _0x38518d;})});}if(_0x1434fe[_0x06e9('0x39')]['$gte']){var _0x3f56ea=_0x1434fe['query'][_0x06e9('0x75')][_0x06e9('0x62')](',');var _0x31f5f5={};_0x31f5f5[_0x3f56ea[0x0]]={'$gte':moment(_0x3f56ea[0x1])[_0x06e9('0xbc')](_0x06e9('0xbd'))};_0x63a65a[_0x06e9('0x42')]=_[_0x06e9('0xb2')](_0x63a65a[_0x06e9('0x42')],_0x31f5f5);}_0x63a65a=_[_0x06e9('0xb2')]({},_0x63a65a,_0x1434fe[_0x06e9('0xbe')]);return db[_0x06e9('0xb7')][_0x06e9('0x26')]({'where':_0x63a65a[_0x06e9('0x42')]})[_0x06e9('0x2b')](function(_0x220209){_0x5b78b9[_0x06e9('0x26')]=_0x220209;if(_0x1434fe[_0x06e9('0x39')]['includeAll']){_0x63a65a[_0x06e9('0xb1')]=[{'all':!![]}];}return db[_0x06e9('0xb7')][_0x06e9('0xbf')](_0x63a65a);})['then'](function(_0x52f379){_0x5b78b9[_0x06e9('0xc0')]=_0x52f379;return _0x5b78b9;});}})[_0x06e9('0x2b')](respondWithFilteredResult(_0x8b4311,_0x63a65a))[_0x06e9('0xab')](handleError(_0x8b4311,null));};exports[_0x06e9('0xc1')]=function(_0x28e610,_0x253b6d,_0x1cc7a3){return db[_0x06e9('0x97')][_0x06e9('0x5c')]({'where':{'id':_0x28e610[_0x06e9('0xad')]['id']}})[_0x06e9('0x2b')](handleEntityNotFound(_0x253b6d,null))[_0x06e9('0x2b')](function(_0x5bcedf){if(_0x5bcedf){return _0x5bcedf[_0x06e9('0xc2')](_0x28e610['body'][_0x06e9('0xb8')],_[_0x06e9('0xb9')](_0x28e610[_0x06e9('0xb4')],[_0x06e9('0xb8'),'id'])||{})[_0x06e9('0xc3')](function(){return db['Tag'][_0x06e9('0xbf')]({'attributes':['id','name',_0x06e9('0x47')],'where':{'id':_0x28e610[_0x06e9('0xb4')]['ids']}});})[_0x06e9('0x2b')](function(_0x196c07){socket[_0x06e9('0xc4')]('smsInteractionTags:save',{'id':Number(_0x28e610[_0x06e9('0xad')]['id']),'tags':_0x196c07||[]});return{'id':Number(_0x28e610[_0x06e9('0xad')]['id']),'tags':_0x196c07||[]};});}})[_0x06e9('0x2b')](respondWithResult(_0x253b6d,null))[_0x06e9('0xab')](handleError(_0x253b6d,null));};exports['removeTags']=function(_0x3b0894,_0x4b01b2,_0xed2d59){return db['SmsInteraction'][_0x06e9('0x5c')]({'where':{'id':_0x3b0894[_0x06e9('0xad')]['id']}})[_0x06e9('0x2b')](handleEntityNotFound(_0x4b01b2,null))[_0x06e9('0x2b')](function(_0x41877c){if(_0x41877c){return _0x41877c[_0x06e9('0xc5')](_0x3b0894[_0x06e9('0x39')][_0x06e9('0xb8')]);}})['then'](respondWithStatusCode(_0x4b01b2,null))[_0x06e9('0xab')](handleError(_0x4b01b2,null));};exports[_0x06e9('0xc6')]=function(_0x524896,_0x2ed3a8){var _0x28a8d4=moment()['unix']()[_0x06e9('0x95')]();var _0x3a0f02=path[_0x06e9('0xc7')](config[_0x06e9('0xc8')],_0x06e9('0xc9'),'files',_0x06e9('0xca'));var _0x498413=path[_0x06e9('0xc7')](config[_0x06e9('0xc8')],'server',_0x06e9('0xcb'),'attachments');var _0x50d739=path['join'](_0x3a0f02,_0x28a8d4);var _0x132878=util[_0x06e9('0xbc')]('transcript-%d-%s.zip',_0x524896[_0x06e9('0xad')]['id'],_0x28a8d4);var _0x43f8b4=path['join'](_0x3a0f02,_0x132878);var _0x40e34a=[];_0x40e34a[_0x06e9('0x33')]({'model':db[_0x06e9('0x6a')],'as':_0x06e9('0x6a'),'attributes':['id',_0x06e9('0xcc')],'raw':!![]});_0x40e34a[_0x06e9('0x33')]({'model':db[_0x06e9('0xcd')],'as':'Contact','attributes':['id',_0x06e9('0xce'),_0x06e9('0xcf')],'raw':!![]});var _0x14c98d=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id','body','createdAt','direction',_0x06e9('0xd0'),'read'],'include':_0x40e34a}];_0x14c98d[_0x06e9('0x33')]({'model':db[_0x06e9('0xd1')],'as':'Account','attributes':['id',_0x06e9('0x2d')]});_0x14c98d['push']({'model':db[_0x06e9('0x6a')],'as':_0x06e9('0xd2'),'attributes':['id',_0x06e9('0xcc')]});return db['SmsInteraction']['find']({'where':{'id':_0x524896[_0x06e9('0xad')]['id']},'include':_0x14c98d})[_0x06e9('0x2b')](handleEntityNotFound(_0x2ed3a8,null))[_0x06e9('0x2b')](function(_0x399923){if(_0x399923){var _0x1d091c=_0x399923[_0x06e9('0xd3')]({'plain':!![]});fs[_0x06e9('0xd4')](_0x50d739);var _0x4abc81={'channel':_0x06e9('0xd5'),'account':_0x1d091c[_0x06e9('0xd6')]['name'],'agent':_0x1d091c[_0x06e9('0xd2')]?_0x1d091c[_0x06e9('0xd2')][_0x06e9('0xcc')]:_0x06e9('0xd7'),'createdAt':moment(_0x1d091c[_0x06e9('0x73')])[_0x06e9('0xbc')](_0x06e9('0xbd'))[_0x06e9('0x95')](),'closedAt':_0x1d091c[_0x06e9('0xd8')]?moment(_0x1d091c[_0x06e9('0xd9')])['format'](_0x06e9('0xbd'))[_0x06e9('0x95')]():'','disposition':_0x1d091c[_0x06e9('0xda')],'messages':_(_0x1d091c[_0x06e9('0xdb')])[_0x06e9('0x7e')]({'secret':![]})[_0x06e9('0x35')](function(_0x159db5){return{'date':moment(_0x159db5[_0x06e9('0x73')])['format'](_0x06e9('0xbd'))[_0x06e9('0x95')](),'sender':_0x159db5['direction']===_0x06e9('0xdc')?_0x159db5[_0x06e9('0x6a')]?_0x159db5[_0x06e9('0x6a')][_0x06e9('0xcc')]:_0x06e9('0xdd'):_0x159db5['Contact'][_0x06e9('0xce')]+(_0x159db5[_0x06e9('0x60')][_0x06e9('0xcf')]?'\x20'+_0x159db5[_0x06e9('0x60')][_0x06e9('0xcf')]:''),'body':_0x159db5[_0x06e9('0xb4')],'direction':_0x159db5[_0x06e9('0xde')]==='out'?'A':'C','secret':_0x159db5[_0x06e9('0xd0')],'read':_0x159db5[_0x06e9('0x7a')]};})[_0x06e9('0x5e')]()};return ejs[_0x06e9('0xdf')](path['join'](config[_0x06e9('0xc8')],_0x06e9('0xc9'),'views',_0x06e9('0xe0')),{'interaction':_0x4abc81})[_0x06e9('0x2b')](function(_0x50be0a){var _0x10f61c=path[_0x06e9('0xc7')](_0x50d739,_0x06e9('0xe1')+_0x1d091c['id']+'-'+_0x28a8d4+_0x06e9('0xe2'));var _0x4ecc3f={'path':_0x10f61c,'channel':_0x06e9('0xd5'),'interactionId':_0x1d091c['id']};return pdf['createPdfFromHTML'](_0x50be0a,_0x4ecc3f);})['then'](function(){return new BPromise(function(_0x1a7c7f,_0x4830a9){zipdir(_0x50d739,{'saveTo':_0x43f8b4},function(_0xcb56d7,_0x5e3ff2){if(_0xcb56d7)return _0x4830a9(_0xcb56d7);return _0x1a7c7f(_0x5e3ff2);});})[_0x06e9('0x2b')](function(){return new BPromise(function(_0x13d58e,_0x50732d){rimraf(_0x50d739,function(_0x130842){if(_0x130842)_0x50732d(_0x130842);return _0x13d58e();});});})[_0x06e9('0x2b')](function(){return _0x2ed3a8['download'](_0x43f8b4,_0x132878,function(_0x4ae542){if(_0x4ae542){console[_0x06e9('0xe3')](_0x06e9('0xe4'),_0x4ae542);}else{fs[_0x06e9('0xe5')](_0x43f8b4);}});});});}else{return _0x2ed3a8[_0x06e9('0x20')](0xc8);}})[_0x06e9('0xab')](handleError(_0x2ed3a8,null));}; \ No newline at end of file +var _0xde75=['views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','eml-format','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./smsInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','Users','map','fullname','TagIds','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','pick','select','field','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','left_join','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','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','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','text','some','compact','isEmpty','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','read','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','agent','i.SmsAccountId\x20IS\x20NULL','SmsAccountId','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.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','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','rows','show','params','include','options','create','describe','addMessage','SmsMessage','ids','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','findAll','color','emit','smsInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','transcript-%d-%s.zip','CmContact','Contact','lastName','secret','SmsAccount','Account','Owner','mkdirSync','Sms','N.A.','closedAt','Messages','direction','System','firstName','out','renderFile'];(function(_0x8267aa,_0x496ef0){var _0x2a437f=function(_0x447f72){while(--_0x447f72){_0x8267aa['push'](_0x8267aa['shift']());}};_0x2a437f(++_0x496ef0);}(_0xde75,0x1d3));var _0x5de7=function(_0x16b0dd,_0x307f93){_0x16b0dd=_0x16b0dd-0x0;var _0x16b1b6=_0xde75[_0x16b0dd];return _0x16b1b6;};'use strict';var emlformat=require(_0x5de7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5de7('0x1'));var BPromise=require(_0x5de7('0x2'));var Mustache=require(_0x5de7('0x3'));var util=require('util');var path=require(_0x5de7('0x4'));var sox=require(_0x5de7('0x5'));var csv=require(_0x5de7('0x6'));var ejs=require(_0x5de7('0x7'));var fs=require('fs');var fs_extra=require(_0x5de7('0x8'));var _=require(_0x5de7('0x9'));var squel=require(_0x5de7('0xa'));var crypto=require(_0x5de7('0xb'));var jsforce=require(_0x5de7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5de7('0x6'));var querystring=require(_0x5de7('0xd'));var Papa=require(_0x5de7('0xe'));var Redis=require(_0x5de7('0xf'));var authService=require(_0x5de7('0x10'));var qs=require(_0x5de7('0x11'));var as=require(_0x5de7('0x12'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5de7('0x13'))(_0x5de7('0x14'));var utils=require('../../config/utils');var config=require(_0x5de7('0x15'));var licenseUtil=require(_0x5de7('0x16'));var db=require(_0x5de7('0x17'))['db'];config[_0x5de7('0x18')]=_[_0x5de7('0x19')](config[_0x5de7('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5de7('0x18')]));require(_0x5de7('0x1a'))[_0x5de7('0x1b')](socket);function respondWithStatusCode(_0x425c37,_0x33c4ad){_0x33c4ad=_0x33c4ad||0xcc;return function(_0x27ffe7){if(_0x27ffe7){return _0x425c37[_0x5de7('0x1c')](_0x33c4ad);}return _0x425c37[_0x5de7('0x1d')](_0x33c4ad)['end']();};}function respondWithResult(_0x4a6e85,_0x3629f){_0x3629f=_0x3629f||0xc8;return function(_0x592c37){if(_0x592c37){return _0x4a6e85[_0x5de7('0x1d')](_0x3629f)[_0x5de7('0x1e')](_0x592c37);}};}function respondWithFilteredResult(_0x5e6070,_0x15d2ed){return function(_0x4e78a3){if(_0x4e78a3){var _0x2f9326=typeof _0x15d2ed['offset']===_0x5de7('0x1f')&&typeof _0x15d2ed[_0x5de7('0x20')]==='undefined';var _0x4aec58=_0x4e78a3[_0x5de7('0x21')];var _0x4ca40e=_0x2f9326?0x0:_0x15d2ed[_0x5de7('0x22')];var _0x1943e1=_0x2f9326?_0x4e78a3[_0x5de7('0x21')]:_0x15d2ed[_0x5de7('0x22')]+_0x15d2ed['limit'];var _0x28b3ba;if(_0x1943e1>=_0x4aec58){_0x1943e1=_0x4aec58;_0x28b3ba=0xc8;}else{_0x28b3ba=0xce;}_0x5e6070[_0x5de7('0x1d')](_0x28b3ba);return _0x5e6070[_0x5de7('0x23')](_0x5de7('0x24'),_0x4ca40e+'-'+_0x1943e1+'/'+_0x4aec58)['json'](_0x4e78a3);}return null;};}function patchUpdates(_0xbf6043){return function(_0x1a221c){try{jsonpatch[_0x5de7('0x25')](_0x1a221c,_0xbf6043,!![]);}catch(_0x33b886){return BPromise['reject'](_0x33b886);}return _0x1a221c[_0x5de7('0x26')]();};}function saveUpdates(_0xc70836,_0x3f99c9){return function(_0x308c8b){if(_0x308c8b){return _0x308c8b[_0x5de7('0x27')](_0xc70836)[_0x5de7('0x28')](function(_0x41d7fd){return _0x41d7fd;});}return null;};}function removeEntity(_0x2251b0,_0x465e38){return function(_0x11439b){if(_0x11439b){return _0x11439b[_0x5de7('0x29')]()[_0x5de7('0x28')](function(){_0x2251b0[_0x5de7('0x1d')](0xcc)[_0x5de7('0x2a')]();});}};}function handleEntityNotFound(_0x34d6c6,_0x57f2a6){return function(_0x58ea24){if(!_0x58ea24){_0x34d6c6[_0x5de7('0x1c')](0x194);}return _0x58ea24;};}function handleError(_0x3ef9e2,_0x83cac1){_0x83cac1=_0x83cac1||0x1f4;return function(_0x12f617){logger[_0x5de7('0x2b')](_0x12f617[_0x5de7('0x2c')]);if(_0x12f617[_0x5de7('0x2d')]){delete _0x12f617[_0x5de7('0x2d')];}_0x3ef9e2['status'](_0x83cac1)[_0x5de7('0x2e')](_0x12f617);};}function getInteractionUsers(_0x46484c,_0x4e7be8){return new BPromise(function(_0x423996,_0x5ee0b0){try{if(_0x4e7be8[_0x46484c['id']]){_0x46484c[_0x5de7('0x2f')]=_[_0x5de7('0x30')](_0x4e7be8[_0x46484c['id']],function(_0x481e68){return{'id':_0x481e68['id'],'fullname':_0x481e68[_0x5de7('0x31')]};});}}catch(_0x3df58b){_0x5ee0b0(_0x3df58b);}_0x423996(_0x46484c);});}function getInteractionTags(_0xe108de,_0x310c8a){return new BPromise(function(_0x309e3f,_0x480955){try{if(_0xe108de[_0x5de7('0x32')]){_0xe108de['Tags']=[];_0xe108de['TagIds']['split'](',')[_0x5de7('0x33')](function(_0x2e97a7){_0xe108de['Tags'][_0x5de7('0x34')](_0x310c8a[_0x2e97a7]);});}delete _0xe108de[_0x5de7('0x32')];}catch(_0x3e84c5){_0x480955(_0x3e84c5);}_0x309e3f(_0xe108de);});}function updateSmsInteraction(_0x36754f,_0x2c4897,_0x1f1f92){return new BPromise(function(_0x514c8f,_0xe754cf){return getInteractionUsers(_0x36754f,_0x1f1f92)['then'](function(_0x3482ec){return getInteractionTags(_0x3482ec,_0x2c4897);})[_0x5de7('0x28')](function(_0x3420fc){_0x514c8f(_0x3420fc);})[_0x5de7('0x35')](function(_0x5c2112){_0xe754cf(_0x5c2112);});});}exports[_0x5de7('0x36')]=function(_0x40cc9c,_0x4f055a){var _0x4b8b2a={},_0x6c633={},_0x3693bd={'count':0x0,'rows':[]};var _0x2cacf2=_[_0x5de7('0x30')](db[_0x5de7('0x37')][_0x5de7('0x38')],function(_0x1768af){return{'name':_0x1768af[_0x5de7('0x39')],'type':_0x1768af[_0x5de7('0x3a')][_0x5de7('0x3b')]};});_0x6c633[_0x5de7('0x3c')]=_['map'](_0x2cacf2,_0x5de7('0x2d'));_0x6c633[_0x5de7('0x3d')]=_[_0x5de7('0x3e')](_0x40cc9c[_0x5de7('0x3d')]);_0x6c633['filters']=_[_0x5de7('0x3f')](_0x6c633['model'],_0x6c633[_0x5de7('0x3d')]);_0x4b8b2a[_0x5de7('0x40')]=_[_0x5de7('0x3f')](_0x6c633[_0x5de7('0x3c')],qs[_0x5de7('0x41')](_0x40cc9c['query'][_0x5de7('0x41')]));_0x4b8b2a[_0x5de7('0x40')]=_0x4b8b2a[_0x5de7('0x40')]['length']?_0x4b8b2a[_0x5de7('0x40')]:_0x6c633[_0x5de7('0x3c')];if(!_0x40cc9c[_0x5de7('0x3d')][_0x5de7('0x42')]('nolimit')){_0x4b8b2a[_0x5de7('0x20')]=qs[_0x5de7('0x20')](_0x40cc9c[_0x5de7('0x3d')][_0x5de7('0x20')]);_0x4b8b2a[_0x5de7('0x22')]=qs[_0x5de7('0x22')](_0x40cc9c[_0x5de7('0x3d')][_0x5de7('0x22')]);}_0x4b8b2a[_0x5de7('0x43')]=qs[_0x5de7('0x44')](_0x40cc9c[_0x5de7('0x3d')][_0x5de7('0x44')]);_0x4b8b2a['where']=qs[_0x5de7('0x45')](_[_0x5de7('0x46')](_0x40cc9c[_0x5de7('0x3d')],_0x6c633[_0x5de7('0x45')]),_0x2cacf2);var _0x107d02=[];var _0x4faa93=squel[_0x5de7('0x47')]()[_0x5de7('0x48')]('id')['field'](_0x5de7('0x2d'))[_0x5de7('0x48')]('color')[_0x5de7('0x49')](_0x5de7('0x4a'));var _0x433d4f=squel['select']()[_0x5de7('0x48')](_0x5de7('0x4b'))[_0x5de7('0x48')](_0x5de7('0x4c'))['field'](_0x5de7('0x4d'))[_0x5de7('0x49')]('user_has_sms_interactions','ui')[_0x5de7('0x4e')]('users','u',_0x5de7('0x4f'));var _0x5b1cbf=squel[_0x5de7('0x47')]()[_0x5de7('0x49')](_0x5de7('0x50'),'i')[_0x5de7('0x4e')](_0x5de7('0x51'),'c',_0x5de7('0x52'))[_0x5de7('0x4e')]('users','o','o.id\x20=\x20i.UserId')['left_join'](_0x5de7('0x53'),'a',_0x5de7('0x54'))[_0x5de7('0x4e')](_0x5de7('0x55'),'me',_0x5de7('0x56'))[_0x5de7('0x4e')](_0x5de7('0x57'),'it',_0x5de7('0x58'))[_0x5de7('0x4e')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x10da7e=squel[_0x5de7('0x59')]();var _0x1174a4=[];var _0x528272=squel[_0x5de7('0x59')]();var _0x4d1adf;if(_0x40cc9c[_0x5de7('0x3d')][_0x5de7('0x5a')]){_0x4d1adf=as[_0x5de7('0x5b')](_0x40cc9c[_0x5de7('0x3d')]['search']);var _0x2a7a54=_0x4d1adf[_0x5de7('0x5c')];for(var _0x3fb85a=0x0;_0x3fb85a<_0x4d1adf[_0x5de7('0x5d')][_0x5de7('0x5e')];_0x3fb85a++){var _0x3271d7=_0x4d1adf[_0x5de7('0x5d')][_0x3fb85a];var _0x83b6c2='i';var _0x388342=_[_0x5de7('0x5f')](_0x2cacf2,[_0x5de7('0x2d'),_0x3271d7[_0x5de7('0x48')]]);if(!_0x388342){switch(_0x3271d7['field']){case _0x5de7('0x60'):if(_0x3271d7[_0x5de7('0x61')]==0x1){_0x5b1cbf['having']('`'+_0x3271d7[_0x5de7('0x48')]+'`\x20=\x200');}else{_0x5b1cbf[_0x5de7('0x62')]('`'+_0x3271d7[_0x5de7('0x48')]+_0x5de7('0x63'));}break;case'Contact':if(_0x3271d7[_0x5de7('0x64')]===_0x5de7('0x65')){if(_0x3271d7[_0x5de7('0x61')]['split']('\x20')[_0x5de7('0x5e')]>0x1){_0x10da7e[_0x2a7a54](_0x5de7('0x66'),qs[_0x5de7('0x67')](_0x3271d7[_0x5de7('0x61')]),null);}else{var _0xf22a7b='%'+_0x3271d7[_0x5de7('0x61')]+'%';_0x10da7e[_0x2a7a54](_0x5de7('0x68'),_0xf22a7b,_0xf22a7b,_0xf22a7b);}}else{_0x388342=_[_0x5de7('0x5f')](_0x2cacf2,[_0x5de7('0x2d'),_0x5de7('0x69')]);_0x3271d7['field']=_0x5de7('0x69');_0x4a2365=as[_0x5de7('0x6a')](_0x83b6c2,_0x388342[_0x5de7('0x3a')],_0x3271d7);_0x10da7e[_0x2a7a54](_0x4a2365['text'],_0x4a2365['value'][_0x5de7('0x6b')],_0x4a2365[_0x5de7('0x61')][_0x5de7('0x2a')]);}break;case'Tag':var _0x246a73=_0x3271d7[_0x5de7('0x61')]['split'](',')[_0x5de7('0x30')](function(_0x79cd){return Number(_0x79cd);});_0x246a73[_0x5de7('0x33')](function(_0x596e39){_0x528272['or'](_0x5de7('0x6c'),'%,'+_0x596e39+',%');});_0x1174a4=_[_0x5de7('0x6d')](_0x1174a4,_0x246a73);break;case _0x5de7('0x6e'):if(_0x3271d7['operator']===_0x5de7('0x65')){_0x10da7e[_0x2a7a54](_0x5de7('0x6f'),'%'+_0x3271d7[_0x5de7('0x61')]+'%',null);}else{_0x388342=_[_0x5de7('0x5f')](_0x2cacf2,[_0x5de7('0x2d'),_0x5de7('0x70')]);_0x3271d7['field']=_0x5de7('0x70');_0x4a2365=as[_0x5de7('0x6a')](_0x83b6c2,_0x388342['type'],_0x3271d7);_0x10da7e[_0x2a7a54](_0x4a2365['text'],_0x4a2365[_0x5de7('0x61')][_0x5de7('0x6b')],_0x4a2365['value'][_0x5de7('0x2a')]);}break;case _0x5de7('0x71'):_0x4a2365=as[_0x5de7('0x6a')]('me',null,_0x3271d7);_0x10da7e[_0x2a7a54](_0x4a2365[_0x5de7('0x72')],_0x4a2365[_0x5de7('0x61')][_0x5de7('0x6b')],_0x4a2365['value'][_0x5de7('0x2a')]);break;}}else{var _0x4a2365=as[_0x5de7('0x6a')](_0x83b6c2,_0x388342[_0x5de7('0x3a')],_0x3271d7);_0x10da7e[_0x2a7a54](_0x4a2365[_0x5de7('0x72')],_0x4a2365[_0x5de7('0x61')][_0x5de7('0x6b')],_0x4a2365['value']['end']);}}}else{var _0x147696=_(_0x40cc9c[_0x5de7('0x3d')])[_0x5de7('0x3e')]()[_0x5de7('0x30')](function(_0x59a626){return _[_0x5de7('0x73')](_0x2cacf2,[_0x5de7('0x2d'),_0x59a626])?_0x59a626:undefined;})[_0x5de7('0x74')]()['value']();if(!_[_0x5de7('0x75')](_0x147696)){_0x147696[_0x5de7('0x33')](function(_0xc9f01a){if(_0xc9f01a==='SmsAccountId'){_0x5b1cbf[_0x5de7('0x76')](_0x5de7('0x77'),[][_0x5de7('0x78')](_0x40cc9c['query'][_0xc9f01a]));}else if(_0xc9f01a===_0x5de7('0x79')){var _0x628852=JSON[_0x5de7('0x7a')](_0x40cc9c[_0x5de7('0x3d')][_0xc9f01a])['$gte'];var _0x2cbd2f=JSON['parse'](_0x40cc9c[_0x5de7('0x3d')][_0xc9f01a])[_0x5de7('0x7b')];_0x5b1cbf[_0x5de7('0x76')](_0x5de7('0x7c'),_0x628852,_0x2cbd2f);}else{if(_0x40cc9c[_0x5de7('0x3d')][_0xc9f01a]==='null'){_0x5b1cbf['where']('i.'+_0xc9f01a+'\x20IS\x20NULL');}else{_0x5b1cbf[_0x5de7('0x76')]('i.'+_0xc9f01a+'\x20=\x20?',_0x40cc9c['query'][_0xc9f01a]);}}});}if(_0x40cc9c['query'][_0x5de7('0x7d')]){if(_0x40cc9c[_0x5de7('0x3d')][_0x5de7('0x7d')]==0x1){_0x5b1cbf[_0x5de7('0x62')]('`unreadMessages`\x20=\x200');}else{_0x5b1cbf['having'](_0x5de7('0x7e'));}}if(_0x40cc9c[_0x5de7('0x3d')]['tag']){_0x1174a4=_[_0x5de7('0x7f')](_0x40cc9c[_0x5de7('0x3d')][_0x5de7('0x80')])?_0x40cc9c[_0x5de7('0x3d')][_0x5de7('0x80')]:new Array(_0x40cc9c[_0x5de7('0x3d')]['tag']);_0x1174a4['forEach'](function(_0x164f33){_0x528272['or'](_0x5de7('0x6c'),'%,'+_0x164f33+',%');});}if(_0x40cc9c[_0x5de7('0x3d')][_0x5de7('0x81')]){var _0x2eada1=_0x40cc9c[_0x5de7('0x3d')][_0x5de7('0x81')][_0x5de7('0x82')]('\x5c','\x5c\x5c')[_0x5de7('0x82')](/'/g,'\x27\x27');if(qs[_0x5de7('0x83')](_0x2eada1)){_0x10da7e['or'](_0x5de7('0x84'),_0x2eada1+'%')['or'](_0x5de7('0x85'),_0x2eada1+'%');}else{_0x10da7e['or'](_0x5de7('0x86'),qs['getFullTextValue'](_0x2eada1))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2eada1+'%');}}}_0x5b1cbf[_0x5de7('0x76')](_0x10da7e);_0x5b1cbf[_0x5de7('0x87')]('i.id');var _0x420e3a={'type':db[_0x5de7('0x88')][_0x5de7('0x89')][_0x5de7('0x8a')],'raw':!![]};var _0x272535=_0x5b1cbf[_0x5de7('0x8b')]();_0x272535[_0x5de7('0x48')](_0x5de7('0x8c'));_0x272535['field'](_0x5de7('0x8d'),'unreadMessages');if(_0x4b8b2a[_0x5de7('0x43')]){_0x4b8b2a[_0x5de7('0x43')][_0x5de7('0x33')](function(_0x2c2b3a){var _0x5bb81c=_0x2c2b3a[0x0]===_0x5de7('0x8e')?_0x2c2b3a[0x0]:'i.'+_0x2c2b3a[0x0];_0x5b1cbf[_0x5de7('0x43')](_0x5bb81c,_0x2c2b3a[0x1]===_0x5de7('0x8f')?![]:!![]);});}if(!_[_0x5de7('0x75')](_0x1174a4)){_0x5b1cbf['having'](_0x528272);_0x272535[_0x5de7('0x76')]('t.id\x20IN\x20?',_0x1174a4);}BPromise[_0x5de7('0x90')]()[_0x5de7('0x28')](function(){if(!_0x4d1adf){if(_0x40cc9c[_0x5de7('0x3d')]['SmsAccountId'])return;_0x272535[_0x5de7('0x76')](_0x5de7('0x91'));_0x5b1cbf[_0x5de7('0x76')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x40cc9c[_0x5de7('0x92')]['role']!==_0x5de7('0x93'))return;return _0x40cc9c[_0x5de7('0x92')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x41a3e7){if(_[_0x5de7('0x75')](_0x41a3e7)){_0x272535['where'](_0x5de7('0x94'));_0x5b1cbf[_0x5de7('0x76')](_0x5de7('0x94'));}else{_0x272535['where'](_0x5de7('0x77'),_[_0x5de7('0x30')](_0x41a3e7,'id'));_0x5b1cbf[_0x5de7('0x76')](_0x5de7('0x77'),_['map'](_0x41a3e7,'id'));}});})[_0x5de7('0x28')](function(){if(_0x40cc9c[_0x5de7('0x92')]['role']===_0x5de7('0x93')&&!_0x4d1adf&&!_0x40cc9c[_0x5de7('0x3d')][_0x5de7('0x95')])return[];return db[_0x5de7('0x96')][_0x5de7('0x3d')](_0x272535['toString'](),_0x420e3a);})[_0x5de7('0x28')](function(_0x10cf36){_0x3693bd[_0x5de7('0x21')]=_0x10cf36[_0x5de7('0x5e')];if(_0x3693bd[_0x5de7('0x21')]===0x0)return[];return db['sequelize'][_0x5de7('0x3d')](_0x4faa93[_0x5de7('0x97')](),_0x420e3a)[_0x5de7('0x28')](function(_0x3d44cc){_0x107d02=_[_0x5de7('0x98')](_0x3d44cc,'id');_0x420e3a=_[_0x5de7('0x99')](_0x420e3a,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x40cc9c[_0x5de7('0x3d')]['fields']){_0x4b8b2a[_0x5de7('0x40')][_0x5de7('0x33')](function(_0x1df87d){_0x5b1cbf[_0x5de7('0x48')]('i.'+_0x1df87d);});}else{_0x5b1cbf[_0x5de7('0x48')](_0x5de7('0x8d'),_0x5de7('0x60'));_0x5b1cbf[_0x5de7('0x48')](_0x5de7('0x9a'),_0x5de7('0x9b'));_0x5b1cbf['field'](_0x5de7('0x9c'),'Account.mandatoryDisposition');_0x5b1cbf[_0x5de7('0x48')](_0x5de7('0x9d'),_0x5de7('0x8e'));_0x5b1cbf[_0x5de7('0x48')](_0x5de7('0x9e'));_0x5b1cbf['field'](_0x5de7('0x9f'),_0x5de7('0xa0'));_0x5b1cbf['field'](_0x5de7('0xa1'),_0x5de7('0xa2'));_0x5b1cbf[_0x5de7('0x48')](_0x5de7('0xa3'),_0x5de7('0xa4'));_0x5b1cbf[_0x5de7('0x48')](_0x5de7('0xa5'),_0x5de7('0xa6'));_0x5b1cbf[_0x5de7('0x48')](_0x5de7('0xa7'),_0x5de7('0xa8'));_0x5b1cbf['field'](_0x5de7('0xa9'),_0x5de7('0xaa'));_0x5b1cbf[_0x5de7('0x48')](_0x5de7('0xab'),_0x5de7('0xac'));_0x5b1cbf[_0x5de7('0x48')](_0x5de7('0xad'),'Owner.internal');_0x5b1cbf[_0x5de7('0x48')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5de7('0x32'));}if(_0x4b8b2a[_0x5de7('0x20')])_0x5b1cbf['limit'](_0x4b8b2a['limit']);if(_0x4b8b2a[_0x5de7('0x22')])_0x5b1cbf['offset'](_0x4b8b2a['offset']);return db[_0x5de7('0x96')][_0x5de7('0x3d')](_0x5b1cbf[_0x5de7('0x97')](),_0x420e3a);})['then'](function(_0x3a5234){if(_0x3a5234['length']>0x0)_0x433d4f['where'](_0x5de7('0xae'),_['map'](_0x3a5234,'id'));return db[_0x5de7('0x96')][_0x5de7('0x3d')](_0x433d4f['toString'](),_0x420e3a)['then'](function(_0x2d03ac){var _0x234166=_[_0x5de7('0xaf')](_0x2d03ac,_0x5de7('0xb0'));var _0x19a3d5=[];_0x3a5234[_0x5de7('0x33')](function(_0x519cd2){_0x19a3d5[_0x5de7('0x34')](updateSmsInteraction(_0x519cd2,_0x107d02,_0x234166));});return BPromise['all'](_0x19a3d5);});});})['then'](function(_0x41d75c){_0x3693bd[_0x5de7('0xb1')]=_0x41d75c;return _0x3693bd;})[_0x5de7('0x28')](respondWithFilteredResult(_0x4f055a,_0x4b8b2a))[_0x5de7('0x35')](handleError(_0x4f055a,null));};exports[_0x5de7('0xb2')]=function(_0x11c87c,_0x401c67){var _0x5b0e74={'raw':![],'where':{'id':_0x11c87c[_0x5de7('0xb3')]['id']}},_0x36a008={};_0x36a008['model']=_['keys'](db['SmsInteraction'][_0x5de7('0x38')]);_0x36a008['query']=_['keys'](_0x11c87c[_0x5de7('0x3d')]);_0x36a008['filters']=_[_0x5de7('0x3f')](_0x36a008[_0x5de7('0x3c')],_0x36a008[_0x5de7('0x3d')]);_0x5b0e74[_0x5de7('0x40')]=_[_0x5de7('0x3f')](_0x36a008[_0x5de7('0x3c')],qs[_0x5de7('0x41')](_0x11c87c[_0x5de7('0x3d')][_0x5de7('0x41')]));_0x5b0e74[_0x5de7('0x40')]=_0x5b0e74[_0x5de7('0x40')][_0x5de7('0x5e')]?_0x5b0e74[_0x5de7('0x40')]:_0x36a008[_0x5de7('0x3c')];if(_0x11c87c[_0x5de7('0x3d')]['includeAll']){_0x5b0e74[_0x5de7('0xb4')]=[{'all':!![]}];}_0x5b0e74=_[_0x5de7('0x99')]({},_0x5b0e74,_0x11c87c[_0x5de7('0xb5')]);return db['SmsInteraction'][_0x5de7('0x5f')](_0x5b0e74)[_0x5de7('0x28')](handleEntityNotFound(_0x401c67,null))[_0x5de7('0x28')](respondWithResult(_0x401c67,null))['catch'](handleError(_0x401c67,null));};exports[_0x5de7('0xb6')]=function(_0x174379,_0x38db03){return db[_0x5de7('0x37')][_0x5de7('0xb6')](_0x174379['body'],{})[_0x5de7('0x28')](respondWithResult(_0x38db03,0xc9))[_0x5de7('0x35')](handleError(_0x38db03,null));};exports[_0x5de7('0x27')]=function(_0x2ed3f4,_0x48e6c3){if(_0x2ed3f4[_0x5de7('0x71')]['id']){delete _0x2ed3f4[_0x5de7('0x71')]['id'];}return db[_0x5de7('0x37')][_0x5de7('0x5f')]({'where':{'id':_0x2ed3f4[_0x5de7('0xb3')]['id']}})[_0x5de7('0x28')](handleEntityNotFound(_0x48e6c3,null))['then'](saveUpdates(_0x2ed3f4[_0x5de7('0x71')],null))[_0x5de7('0x28')](respondWithResult(_0x48e6c3,null))['catch'](handleError(_0x48e6c3,null));};exports['destroy']=function(_0xf822e4,_0x10fedb){return db[_0x5de7('0x37')]['find']({'where':{'id':_0xf822e4['params']['id']}})['then'](handleEntityNotFound(_0x10fedb,null))[_0x5de7('0x28')](removeEntity(_0x10fedb,null))[_0x5de7('0x35')](handleError(_0x10fedb,null));};exports[_0x5de7('0xb7')]=function(_0x2c0208,_0x3f3946){return db[_0x5de7('0x37')][_0x5de7('0xb7')]()[_0x5de7('0x28')](respondWithResult(_0x3f3946,null))[_0x5de7('0x35')](handleError(_0x3f3946,null));};exports[_0x5de7('0xb8')]=function(_0x16536a,_0x57ee58,_0x287a8b){return db[_0x5de7('0xb9')]['find']({'where':{'id':_0x16536a[_0x5de7('0xb3')]['id']}})[_0x5de7('0x28')](handleEntityNotFound(_0x57ee58,null))[_0x5de7('0x28')](function(_0x152f16){if(_0x152f16){return _0x152f16[_0x5de7('0xb8')](_0x16536a['body'][_0x5de7('0xba')],_['omit'](_0x16536a[_0x5de7('0x71')],[_0x5de7('0xba'),'id'])||{});}})[_0x5de7('0x28')](respondWithResult(_0x57ee58,null))[_0x5de7('0x35')](handleError(_0x57ee58,null));};exports[_0x5de7('0xbb')]=function(_0x1f45ef,_0x90522,_0x47a127){var _0x17a047={'raw':![],'where':{}};var _0x2d0cd0={};var _0x5b1d93={'count':0x0,'rows':[]};return db['SmsInteraction']['findOne']({'where':{'id':_0x1f45ef[_0x5de7('0xb3')]['id']}})['then'](handleEntityNotFound(_0x90522,null))[_0x5de7('0x28')](function(_0x2291e4){if(_0x2291e4){_0x2d0cd0[_0x5de7('0x3c')]=_[_0x5de7('0x3e')](db[_0x5de7('0xb9')]['rawAttributes']);_0x2d0cd0[_0x5de7('0x3d')]=_[_0x5de7('0x3e')](_0x1f45ef[_0x5de7('0x3d')]);_0x2d0cd0['filters']=_[_0x5de7('0x3f')](_0x2d0cd0[_0x5de7('0x3c')],_0x2d0cd0[_0x5de7('0x3d')]);_0x17a047[_0x5de7('0x40')]=_['intersection'](_0x2d0cd0['model'],qs['fields'](_0x1f45ef[_0x5de7('0x3d')][_0x5de7('0x41')]));_0x17a047[_0x5de7('0x40')]=_0x17a047[_0x5de7('0x40')][_0x5de7('0x5e')]?_0x17a047[_0x5de7('0x40')]:_0x2d0cd0[_0x5de7('0x3c')];if(!_0x1f45ef['query'][_0x5de7('0x42')]('nolimit')){_0x17a047[_0x5de7('0x20')]=qs[_0x5de7('0x20')](_0x1f45ef[_0x5de7('0x3d')][_0x5de7('0x20')]);_0x17a047[_0x5de7('0x22')]=qs[_0x5de7('0x22')](_0x1f45ef[_0x5de7('0x3d')][_0x5de7('0x22')]);}_0x17a047['order']=qs[_0x5de7('0x44')](_0x1f45ef[_0x5de7('0x3d')]['sort']);_0x17a047[_0x5de7('0x76')]=qs[_0x5de7('0x45')](_[_0x5de7('0x46')](_0x1f45ef['query'],_0x2d0cd0[_0x5de7('0x45')]));_0x17a047['where']['SmsInteractionId']=_0x2291e4['id'];if(_0x1f45ef[_0x5de7('0x3d')]['filter']){_0x17a047[_0x5de7('0x76')]=_[_0x5de7('0x99')](_0x17a047[_0x5de7('0x76')],{'$or':_[_0x5de7('0x30')](_0x17a047['attributes'],function(_0x52cfd4){var _0x598209={};_0x598209[_0x52cfd4]={'$like':'%'+_0x1f45ef[_0x5de7('0x3d')][_0x5de7('0x81')]+'%'};return _0x598209;})});}if(_0x1f45ef[_0x5de7('0x3d')][_0x5de7('0xbc')]){var _0x22af5b=_0x1f45ef[_0x5de7('0x3d')][_0x5de7('0xbc')][_0x5de7('0xbd')](',');var _0x78e654={};_0x78e654[_0x22af5b[0x0]]={'$gte':moment(_0x22af5b[0x1])[_0x5de7('0xbe')](_0x5de7('0xbf'))};_0x17a047['where']=_[_0x5de7('0x99')](_0x17a047['where'],_0x78e654);}_0x17a047=_[_0x5de7('0x99')]({},_0x17a047,_0x1f45ef[_0x5de7('0xb5')]);return db[_0x5de7('0xb9')][_0x5de7('0x21')]({'where':_0x17a047[_0x5de7('0x76')]})[_0x5de7('0x28')](function(_0x1a29de){_0x5b1d93[_0x5de7('0x21')]=_0x1a29de;if(_0x1f45ef[_0x5de7('0x3d')]['includeAll']){_0x17a047[_0x5de7('0xb4')]=[{'all':!![]}];}return db[_0x5de7('0xb9')]['findAll'](_0x17a047);})[_0x5de7('0x28')](function(_0x118d84){_0x5b1d93['rows']=_0x118d84;return _0x5b1d93;});}})['then'](respondWithFilteredResult(_0x90522,_0x17a047))[_0x5de7('0x35')](handleError(_0x90522,null));};exports[_0x5de7('0xc0')]=function(_0xc1e3e3,_0x1a35b6,_0x3d73a6){return db['SmsInteraction']['find']({'where':{'id':_0xc1e3e3[_0x5de7('0xb3')]['id']}})['then'](handleEntityNotFound(_0x1a35b6,null))['then'](function(_0x33ab3e){if(_0x33ab3e){return _0x33ab3e[_0x5de7('0xc1')](_0xc1e3e3['body'][_0x5de7('0xba')],_[_0x5de7('0xc2')](_0xc1e3e3[_0x5de7('0x71')],[_0x5de7('0xba'),'id'])||{})[_0x5de7('0xc3')](function(){return db['Tag'][_0x5de7('0xc4')]({'attributes':['id','name',_0x5de7('0xc5')],'where':{'id':_0xc1e3e3['body']['ids']}});})['then'](function(_0xa64d61){socket[_0x5de7('0xc6')](_0x5de7('0xc7'),{'id':Number(_0xc1e3e3['params']['id']),'tags':_0xa64d61||[]});return{'id':Number(_0xc1e3e3[_0x5de7('0xb3')]['id']),'tags':_0xa64d61||[]};});}})['then'](respondWithResult(_0x1a35b6,null))[_0x5de7('0x35')](handleError(_0x1a35b6,null));};exports[_0x5de7('0xc8')]=function(_0xb8de19,_0x28a795,_0x4a8701){return db[_0x5de7('0x37')][_0x5de7('0x5f')]({'where':{'id':_0xb8de19[_0x5de7('0xb3')]['id']}})[_0x5de7('0x28')](handleEntityNotFound(_0x28a795,null))['then'](function(_0xd79d66){if(_0xd79d66){return _0xd79d66[_0x5de7('0xc8')](_0xb8de19[_0x5de7('0x3d')][_0x5de7('0xba')]);}})[_0x5de7('0x28')](respondWithStatusCode(_0x28a795,null))[_0x5de7('0x35')](handleError(_0x28a795,null));};exports[_0x5de7('0xc9')]=function(_0x546c2a,_0x2d9e54){var _0x50e7fd=moment()[_0x5de7('0xca')]()[_0x5de7('0x97')]();var _0x32d334=path[_0x5de7('0xcb')](config['root'],_0x5de7('0xcc'),'files',_0x5de7('0xcd'));var _0x22140c=path[_0x5de7('0xcb')](config[_0x5de7('0xce')],'server',_0x5de7('0xcf'),'attachments');var _0x381803=path[_0x5de7('0xcb')](_0x32d334,_0x50e7fd);var _0xc14c0=util[_0x5de7('0xbe')](_0x5de7('0xd0'),_0x546c2a[_0x5de7('0xb3')]['id'],_0x50e7fd);var _0x2542e7=path['join'](_0x32d334,_0xc14c0);var _0x3fef0b=[];_0x3fef0b[_0x5de7('0x34')]({'model':db[_0x5de7('0x6e')],'as':_0x5de7('0x6e'),'attributes':['id',_0x5de7('0x31')],'raw':!![]});_0x3fef0b[_0x5de7('0x34')]({'model':db[_0x5de7('0xd1')],'as':_0x5de7('0xd2'),'attributes':['id','firstName',_0x5de7('0xd3')],'raw':!![]});var _0x53bd2d=[{'model':db[_0x5de7('0xb9')],'as':'Messages','attributes':['id',_0x5de7('0x71'),_0x5de7('0x79'),'direction',_0x5de7('0xd4'),'read'],'include':_0x3fef0b}];_0x53bd2d[_0x5de7('0x34')]({'model':db[_0x5de7('0xd5')],'as':_0x5de7('0xd6'),'attributes':['id',_0x5de7('0x2d')]});_0x53bd2d[_0x5de7('0x34')]({'model':db['User'],'as':_0x5de7('0xd7'),'attributes':['id',_0x5de7('0x31')]});return db[_0x5de7('0x37')]['find']({'where':{'id':_0x546c2a[_0x5de7('0xb3')]['id']},'include':_0x53bd2d})[_0x5de7('0x28')](handleEntityNotFound(_0x2d9e54,null))[_0x5de7('0x28')](function(_0x40802e){if(_0x40802e){var _0x349b6c=_0x40802e['get']({'plain':!![]});fs[_0x5de7('0xd8')](_0x381803);var _0x5840d4={'channel':_0x5de7('0xd9'),'account':_0x349b6c['Account']['name'],'agent':_0x349b6c['Owner']?_0x349b6c[_0x5de7('0xd7')][_0x5de7('0x31')]:_0x5de7('0xda'),'createdAt':moment(_0x349b6c[_0x5de7('0x79')])[_0x5de7('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5de7('0x97')](),'closedAt':_0x349b6c['closed']?moment(_0x349b6c[_0x5de7('0xdb')])[_0x5de7('0xbe')](_0x5de7('0xbf'))[_0x5de7('0x97')]():'','disposition':_0x349b6c['disposition'],'messages':_(_0x349b6c[_0x5de7('0xdc')])[_0x5de7('0x81')]({'secret':![]})[_0x5de7('0x30')](function(_0x5e17e4){return{'date':moment(_0x5e17e4['createdAt'])[_0x5de7('0xbe')]('YYYY-MM-DD\x20HH:mm:ss')[_0x5de7('0x97')](),'sender':_0x5e17e4[_0x5de7('0xdd')]==='out'?_0x5e17e4['User']?_0x5e17e4[_0x5de7('0x6e')][_0x5de7('0x31')]:_0x5de7('0xde'):_0x5e17e4[_0x5de7('0xd2')][_0x5de7('0xdf')]+(_0x5e17e4['Contact'][_0x5de7('0xd3')]?'\x20'+_0x5e17e4['Contact'][_0x5de7('0xd3')]:''),'body':_0x5e17e4[_0x5de7('0x71')],'direction':_0x5e17e4['direction']===_0x5de7('0xe0')?'A':'C','secret':_0x5e17e4['secret'],'read':_0x5e17e4['read']};})[_0x5de7('0x61')]()};return ejs[_0x5de7('0xe1')](path['join'](config[_0x5de7('0xce')],_0x5de7('0xcc'),_0x5de7('0xe2'),_0x5de7('0xe3')),{'interaction':_0x5840d4})[_0x5de7('0x28')](function(_0x51f10e){var _0x363e4b=path[_0x5de7('0xcb')](_0x381803,_0x5de7('0xe4')+_0x349b6c['id']+'-'+_0x50e7fd+'.pdf');var _0x30a61b={'path':_0x363e4b,'channel':_0x5de7('0xd9'),'interactionId':_0x349b6c['id']};return pdf[_0x5de7('0xe5')](_0x51f10e,_0x30a61b);})[_0x5de7('0x28')](function(){return new BPromise(function(_0x376385,_0x18d5e6){zipdir(_0x381803,{'saveTo':_0x2542e7},function(_0x53c405,_0x2d8437){if(_0x53c405)return _0x18d5e6(_0x53c405);return _0x376385(_0x2d8437);});})['then'](function(){return new BPromise(function(_0x268149,_0x34d465){rimraf(_0x381803,function(_0x586ec8){if(_0x586ec8)_0x34d465(_0x586ec8);return _0x268149();});});})[_0x5de7('0x28')](function(){return _0x2d9e54['download'](_0x2542e7,_0xc14c0,function(_0x3ebe0e){if(_0x3ebe0e){console[_0x5de7('0xe6')]('err',_0x3ebe0e);}else{fs['unlinkSync'](_0x2542e7);}});});});}else{return _0x2d9e54[_0x5de7('0x1c')](0xc8);}})['catch'](handleError(_0x2d9e54,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index cc9c2e9..f827cc3 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 _0x02ce=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update','remove','getUsers','then','Users','map','findAll'];(function(_0x3b6af7,_0x2310b1){var _0x1731cd=function(_0x9addf3){while(--_0x9addf3){_0x3b6af7['push'](_0x3b6af7['shift']());}};_0x1731cd(++_0x2310b1);}(_0x02ce,0x1ac));var _0xe02c=function(_0x198ab7,_0x546c3a){_0x198ab7=_0x198ab7-0x0;var _0x492305=_0x02ce[_0x198ab7];return _0x492305;};'use strict';var EventEmitter=require(_0xe02c('0x0'));var SmsInteraction=require(_0xe02c('0x1'))['db'][_0xe02c('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0xe02c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe02c('0x4'),'afterUpdate':_0xe02c('0x5'),'afterDestroy':_0xe02c('0x6')};function emitEvent(_0xf4b764){return function(_0x41b41c,_0x229653,_0x3f7436){_0x41b41c[_0xe02c('0x7')]({'attributes':['id'],'raw':!![]})[_0xe02c('0x8')](function(_0x4fecb3){_0x41b41c['setDataValue'](_0xe02c('0x9'),_0x4fecb3[_0xe02c('0xa')](function(_0x469932){return{'id':_0x469932['id']};}));return SmsMessage[_0xe02c('0xb')]({'where':{'SmsInteractionId':_0x41b41c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe02c('0x8')](function(_0x18a398){_0x41b41c[_0xe02c('0xc')](_0xe02c('0xd'),_0x18a398[_0xe02c('0xe')]);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764+':'+_0x41b41c['id'],_0x41b41c);SmsInteractionEvents[_0xe02c('0xf')](_0xf4b764,_0x41b41c);_0x3f7436(null);})[_0xe02c('0x10')](_0x3f7436(null));};}for(var e in events){if(events[_0xe02c('0x11')](e)){var event=events[e];SmsInteraction[_0xe02c('0x12')](e,emitEvent(event));}}module[_0xe02c('0x13')]=SmsInteractionEvents; \ No newline at end of file +var _0x6a95=['save','getUsers','then','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners'];(function(_0x3d8291,_0x560e85){var _0x2bad5c=function(_0x16d94d){while(--_0x16d94d){_0x3d8291['push'](_0x3d8291['shift']());}};_0x2bad5c(++_0x560e85);}(_0x6a95,0x1db));var _0x56a9=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0x6a95[_0x2576d7];return _0x16a08c;};'use strict';var EventEmitter=require(_0x56a9('0x0'));var SmsInteraction=require(_0x56a9('0x1'))['db'][_0x56a9('0x2')];var SmsMessage=require(_0x56a9('0x1'))['db'][_0x56a9('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x56a9('0x4')](0x0);var events={'afterCreate':_0x56a9('0x5'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x12cd60){return function(_0x83f534,_0x1b42ac,_0x2eb132){_0x83f534[_0x56a9('0x6')]({'attributes':['id'],'raw':!![]})[_0x56a9('0x7')](function(_0xd8aa7c){_0x83f534['setDataValue']('Users',_0xd8aa7c[_0x56a9('0x8')](function(_0x15f2ff){return{'id':_0x15f2ff['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x83f534['id'],'direction':'in','read':![]},'raw':!![]});})[_0x56a9('0x7')](function(_0x1eddfd){_0x83f534[_0x56a9('0x9')](_0x56a9('0xa'),_0x1eddfd[_0x56a9('0xb')]);SmsInteractionEvents[_0x56a9('0xc')](_0x12cd60+':'+_0x83f534['id'],_0x83f534);SmsInteractionEvents[_0x56a9('0xc')](_0x12cd60,_0x83f534);_0x2eb132(null);})[_0x56a9('0xd')](_0x2eb132(null));};}for(var e in events){if(events[_0x56a9('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x56a9('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 1b90f28..c9df9e0 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 _0x13d2=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','moment','request-promise','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction'];(function(_0x2b5318,_0x1dcff0){var _0x16e75b=function(_0xbe8e45){while(--_0xbe8e45){_0x2b5318['push'](_0x2b5318['shift']());}};_0x16e75b(++_0x1dcff0);}(_0x13d2,0x16c));var _0x213d=function(_0x381b45,_0x42c7fc){_0x381b45=_0x381b45-0x0;var _0x542f6f=_0x13d2[_0x381b45];return _0x542f6f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x213d('0x0'))('api');var moment=require(_0x213d('0x1'));var BPromise=require('bluebird');var rp=require(_0x213d('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x213d('0x3'));var attributes=require(_0x213d('0x4'));module[_0x213d('0x5')]=function(_0x25929e,_0x384cbc){return _0x25929e[_0x213d('0x6')](_0x213d('0x7'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a4e10,_0x40b958,_0x41fccf){if(_0x5a4e10[_0x213d('0x8')](_0x213d('0x9'))){_0x5a4e10[_0x213d('0xa')]=moment()['format'](_0x213d('0xb'));}_0x41fccf(null,_0x5a4e10);}}});}; \ No newline at end of file +var _0xfbda=['moment','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','closedAt','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','api'];(function(_0x484ef8,_0x54d577){var _0x14f83e=function(_0x3955c7){while(--_0x3955c7){_0x484ef8['push'](_0x484ef8['shift']());}};_0x14f83e(++_0x54d577);}(_0xfbda,0x8a));var _0xafbd=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xfbda[_0x4b7b62];return _0x2280df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xafbd('0x0'))(_0xafbd('0x1'));var moment=require(_0xafbd('0x2'));var BPromise=require('bluebird');var rp=require(_0xafbd('0x3'));var fs=require('fs');var path=require(_0xafbd('0x4'));var rimraf=require(_0xafbd('0x5'));var config=require(_0xafbd('0x6'));var attributes=require(_0xafbd('0x7'));module[_0xafbd('0x8')]=function(_0x37af6f,_0x209f85){return _0x37af6f[_0xafbd('0x9')](_0xafbd('0xa'),attributes,{'tableName':_0xafbd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x122ddc,_0x11e8b6,_0x2330ed){if(_0x122ddc['changed']('closed')){_0x122ddc[_0xafbd('0xc')]=moment()['format'](_0xafbd('0xd'));}_0x2330ed(null,_0x122ddc);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 254352a..05d1649 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 _0x669e=['body','ids','omit','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateSmsInteraction','options','raw','where','attributes','stringify','AddTagsToSmsInteraction','SmsInteraction','addTags'];(function(_0x3e8f4f,_0x1f5537){var _0x340b5d=function(_0x457cef){while(--_0x457cef){_0x3e8f4f['push'](_0x3e8f4f['shift']());}};_0x340b5d(++_0x1f5537);}(_0x669e,0x16c));var _0xe669=function(_0x494a4a,_0x5428fc){_0x494a4a=_0x494a4a-0x0;var _0x3242cd=_0x669e[_0x494a4a];return _0x3242cd;};'use strict';var _=require(_0xe669('0x0'));var util=require('util');var moment=require(_0xe669('0x1'));var BPromise=require(_0xe669('0x2'));var rs=require(_0xe669('0x3'));var fs=require('fs');var Redis=require(_0xe669('0x4'));var db=require(_0xe669('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe669('0x6'))(_0xe669('0x7'));var config=require(_0xe669('0x8'));var jayson=require(_0xe669('0x9'));var client=jayson[_0xe669('0xa')][_0xe669('0xb')]({'port':0x232a});config['redis']=_[_0xe669('0xc')](config[_0xe669('0xd')],{'host':_0xe669('0xe'),'port':0x18eb});var socket=require(_0xe669('0xf'))(new Redis(config[_0xe669('0xd')]));require(_0xe669('0x10'))[_0xe669('0x11')](socket);function respondWithRpcPromise(_0x124c05,_0x92fc4d,_0x195af1){return new BPromise(function(_0x2fb726,_0x4e09ca){return client[_0xe669('0x12')](_0x124c05,_0x195af1)[_0xe669('0x13')](function(_0x26f348){logger[_0xe669('0x14')](_0xe669('0x15'),_0x92fc4d,_0xe669('0x16'));logger['debug'](_0xe669('0x17'),_0x92fc4d,_0xe669('0x16'),JSON['stringify'](_0x26f348));if(_0x26f348[_0xe669('0x18')]){if(_0x26f348[_0xe669('0x18')]['code']===0x1f4){logger[_0xe669('0x18')](_0xe669('0x15'),_0x92fc4d,_0x26f348[_0xe669('0x18')]['message']);return _0x4e09ca(_0x26f348['error'][_0xe669('0x19')]);}logger[_0xe669('0x18')](_0xe669('0x15'),_0x92fc4d,_0x26f348[_0xe669('0x18')]['message']);return _0x2fb726(_0x26f348[_0xe669('0x18')][_0xe669('0x19')]);}else{logger[_0xe669('0x14')](_0xe669('0x15'),_0x92fc4d,_0xe669('0x16'));_0x2fb726(_0x26f348['result'][_0xe669('0x19')]);}})[_0xe669('0x1a')](function(_0x4fb33f){logger[_0xe669('0x18')](_0xe669('0x15'),_0x92fc4d,_0x4fb33f);_0x4e09ca(_0x4fb33f);});});}exports[_0xe669('0x1b')]=function(_0x502f22){var _0x51d8bc=this;return new Promise(function(_0x5bee4e,_0x461a68){return db['SmsInteraction']['update'](_0x502f22['body'],{'raw':_0x502f22['options']?_0x502f22[_0xe669('0x1c')][_0xe669('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x502f22[_0xe669('0x1c')]?_0x502f22[_0xe669('0x1c')][_0xe669('0x1e')]||null:null,'attributes':_0x502f22[_0xe669('0x1c')]?_0x502f22[_0xe669('0x1c')][_0xe669('0x1f')]||null:null,'limit':_0x502f22[_0xe669('0x1c')]?_0x502f22[_0xe669('0x1c')]['limit']||null:null})['then'](function(_0xdc564b){logger[_0xe669('0x14')](_0xe669('0x1b'),_0x502f22);logger['debug'](_0xe669('0x1b'),_0x502f22,JSON[_0xe669('0x20')](_0xdc564b));_0x5bee4e(_0xdc564b);})[_0xe669('0x1a')](function(_0x1a040f){logger['error'](_0xe669('0x1b'),_0x1a040f['message'],_0x502f22);_0x461a68(_0x51d8bc[_0xe669('0x18')](0x1f4,_0x1a040f[_0xe669('0x19')]));});});};exports[_0xe669('0x21')]=function(_0x3b70ab){return new Promise(function(_0x2d6a38,_0x861b8d){return db[_0xe669('0x22')]['find']({'where':_0x3b70ab[_0xe669('0x1c')]?_0x3b70ab[_0xe669('0x1c')][_0xe669('0x1e')]||null:null})[_0xe669('0x13')](function(_0x8eab90){if(_0x8eab90){return _0x8eab90[_0xe669('0x23')](_0x3b70ab[_0xe669('0x24')][_0xe669('0x25')],_[_0xe669('0x26')](_0x3b70ab['body'],[_0xe669('0x25'),'id'])||{});}})['spread'](function(_0xaa0722){logger[_0xe669('0x14')](_0xe669('0x27'),_0x3b70ab);logger['debug'](_0xe669('0x27'),_0x3b70ab,JSON[_0xe669('0x20')](_0xaa0722));_0x2d6a38(_0xaa0722);})['catch'](function(_0x54a7b3){logger['error'](_0xe669('0x27'),_0x54a7b3[_0xe669('0x19')],_0x3b70ab);_0x861b8d(_this[_0xe669('0x18')](0x1f4,_0x54a7b3[_0xe669('0x19')]));});});}; \ No newline at end of file +var _0x4988=['client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','request','info','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','SmsInteraction,\x20%s,\x20%s','message','result','UpdateSmsInteraction','SmsInteraction','update','options','where','attributes','then','debug','stringify','catch','find','body','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x8eebdf,_0x341089){var _0x27e056=function(_0x1c9db9){while(--_0x1c9db9){_0x8eebdf['push'](_0x8eebdf['shift']());}};_0x27e056(++_0x341089);}(_0x4988,0x1ba));var _0x8498=function(_0x3826d3,_0x2788c4){_0x3826d3=_0x3826d3-0x0;var _0x34a2c9=_0x4988[_0x3826d3];return _0x34a2c9;};'use strict';var _=require(_0x8498('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8498('0x1'));var rs=require(_0x8498('0x2'));var fs=require('fs');var Redis=require(_0x8498('0x3'));var db=require(_0x8498('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8498('0x5'))(_0x8498('0x6'));var config=require(_0x8498('0x7'));var jayson=require(_0x8498('0x8'));var client=jayson[_0x8498('0x9')][_0x8498('0xa')]({'port':0x232a});config[_0x8498('0xb')]=_[_0x8498('0xc')](config[_0x8498('0xb')],{'host':_0x8498('0xd'),'port':0x18eb});var socket=require(_0x8498('0xe'))(new Redis(config['redis']));require(_0x8498('0xf'))['register'](socket);function respondWithRpcPromise(_0x3d6ac6,_0x13bc2b,_0x2d3935){return new BPromise(function(_0x103baf,_0x4e47fb){return client[_0x8498('0x10')](_0x3d6ac6,_0x2d3935)['then'](function(_0x47911){logger[_0x8498('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x13bc2b,_0x8498('0x12'));logger['debug'](_0x8498('0x13'),_0x13bc2b,_0x8498('0x12'),JSON['stringify'](_0x47911));if(_0x47911['error']){if(_0x47911[_0x8498('0x14')][_0x8498('0x15')]===0x1f4){logger['error'](_0x8498('0x16'),_0x13bc2b,_0x47911[_0x8498('0x14')][_0x8498('0x17')]);return _0x4e47fb(_0x47911[_0x8498('0x14')][_0x8498('0x17')]);}logger[_0x8498('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x13bc2b,_0x47911[_0x8498('0x14')][_0x8498('0x17')]);return _0x103baf(_0x47911['error'][_0x8498('0x17')]);}else{logger[_0x8498('0x11')](_0x8498('0x16'),_0x13bc2b,'request\x20sent');_0x103baf(_0x47911[_0x8498('0x18')][_0x8498('0x17')]);}})['catch'](function(_0x538ca3){logger[_0x8498('0x14')](_0x8498('0x16'),_0x13bc2b,_0x538ca3);_0x4e47fb(_0x538ca3);});});}exports[_0x8498('0x19')]=function(_0x2c07d8){var _0x48f50a=this;return new Promise(function(_0x8be477,_0x59b49c){return db[_0x8498('0x1a')][_0x8498('0x1b')](_0x2c07d8['body'],{'raw':_0x2c07d8['options']?_0x2c07d8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c07d8['options']?_0x2c07d8[_0x8498('0x1c')][_0x8498('0x1d')]||null:null,'attributes':_0x2c07d8['options']?_0x2c07d8['options'][_0x8498('0x1e')]||null:null,'limit':_0x2c07d8[_0x8498('0x1c')]?_0x2c07d8['options']['limit']||null:null})[_0x8498('0x1f')](function(_0x53a962){logger[_0x8498('0x11')](_0x8498('0x19'),_0x2c07d8);logger[_0x8498('0x20')](_0x8498('0x19'),_0x2c07d8,JSON[_0x8498('0x21')](_0x53a962));_0x8be477(_0x53a962);})[_0x8498('0x22')](function(_0xe77a41){logger[_0x8498('0x14')](_0x8498('0x19'),_0xe77a41[_0x8498('0x17')],_0x2c07d8);_0x59b49c(_0x48f50a[_0x8498('0x14')](0x1f4,_0xe77a41['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x5dc388){return new Promise(function(_0x538d12,_0xdc5eed){return db[_0x8498('0x1a')][_0x8498('0x23')]({'where':_0x5dc388['options']?_0x5dc388[_0x8498('0x1c')][_0x8498('0x1d')]||null:null})['then'](function(_0x22e0f2){if(_0x22e0f2){return _0x22e0f2['addTags'](_0x5dc388[_0x8498('0x24')][_0x8498('0x25')],_[_0x8498('0x26')](_0x5dc388[_0x8498('0x24')],[_0x8498('0x25'),'id'])||{});}})[_0x8498('0x27')](function(_0x9d997){logger[_0x8498('0x11')](_0x8498('0x28'),_0x5dc388);logger[_0x8498('0x20')](_0x8498('0x28'),_0x5dc388,JSON['stringify'](_0x9d997));_0x538d12(_0x9d997);})[_0x8498('0x22')](function(_0x2c1733){logger['error']('AddTags',_0x2c1733['message'],_0x5dc388);_0xdc5eed(_this[_0x8498('0x14')](0x1f4,_0x2c1733[_0x8498('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 6e777d9..9597446 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 _0xa814=['remove','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa814,0x166));var _0x4a81=function(_0x5904a6,_0x44a84c){_0x5904a6=_0x5904a6-0x0;var _0x1e18b1=_0xa814[_0x5904a6];return _0x1e18b1;};'use strict';var SmsInteractionEvents=require(_0x4a81('0x0'));var events=[_0x4a81('0x1'),_0x4a81('0x2'),_0x4a81('0x3')];function createListener(_0x55d8da,_0xfc1b62){return function(_0x5a2927){_0xfc1b62[_0x4a81('0x4')](_0x55d8da,_0x5a2927);};}function removeListener(_0x583871,_0x576a32){return function(){SmsInteractionEvents[_0x4a81('0x5')](_0x583871,_0x576a32);};}exports[_0x4a81('0x6')]=function(_0x143e5c){for(var _0x52ff10=0x0,_0x2abced=events[_0x4a81('0x7')];_0x52ff10<_0x2abced;_0x52ff10++){var _0x54287c=events[_0x52ff10];var _0x5ec904=createListener(_0x4a81('0x8')+_0x54287c,_0x143e5c);SmsInteractionEvents['on'](_0x54287c,_0x5ec904);}}; \ No newline at end of file +var _0xf04b=['smsInteraction:','./smsInteraction.events','save','remove','update','emit','length'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf04b,0xd3));var _0xbf04=function(_0x5d56fa,_0xdbc916){_0x5d56fa=_0x5d56fa-0x0;var _0x286a55=_0xf04b[_0x5d56fa];return _0x286a55;};'use strict';var SmsInteractionEvents=require(_0xbf04('0x0'));var events=[_0xbf04('0x1'),_0xbf04('0x2'),_0xbf04('0x3')];function createListener(_0x3795e8,_0x2f2715){return function(_0x4e50f9){_0x2f2715[_0xbf04('0x4')](_0x3795e8,_0x4e50f9);};}function removeListener(_0x285a85,_0x36255d){return function(){SmsInteractionEvents['removeListener'](_0x285a85,_0x36255d);};}exports['register']=function(_0x19cddc){for(var _0x5d7a7e=0x0,_0x460a9a=events[_0xbf04('0x5')];_0x5d7a7e<_0x460a9a;_0x5d7a7e++){var _0x3d9d64=events[_0x5d7a7e];var _0x2c1e9d=createListener(_0xbf04('0x6')+_0x3d9d64,_0x19cddc);SmsInteractionEvents['on'](_0x3d9d64,_0x2c1e9d);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index d661541..65dfb81 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 _0x4d08=['index','/describe','describe','/:id','tracked','sms','post','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x4d08,0x1a5));var _0x84d0=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0x4d08[_0x2d4065];return _0xef6016;};'use strict';var multer=require(_0x84d0('0x0'));var util=require('util');var path=require(_0x84d0('0x1'));var timeout=require(_0x84d0('0x2'));var express=require(_0x84d0('0x3'));var router=express[_0x84d0('0x4')]();var fs_extra=require(_0x84d0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x84d0('0x6'));var config=require(_0x84d0('0x7'));var controller=require(_0x84d0('0x8'));router[_0x84d0('0x9')]('/',auth[_0x84d0('0xa')](),controller[_0x84d0('0xb')]);router[_0x84d0('0x9')](_0x84d0('0xc'),auth[_0x84d0('0xa')](),controller[_0x84d0('0xd')]);router[_0x84d0('0x9')](_0x84d0('0xe'),auth[_0x84d0('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),interaction[_0x84d0('0xf')](_0x84d0('0x10'),'smsmessage:create'),controller['create']);router[_0x84d0('0x11')](_0x84d0('0x12'),controller[_0x84d0('0x13')]);router[_0x84d0('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x84d0('0x14')](_0x84d0('0x15'),auth[_0x84d0('0xa')](),controller[_0x84d0('0x16')]);router[_0x84d0('0x14')](_0x84d0('0x17'),auth[_0x84d0('0xa')](),controller[_0x84d0('0x18')]);router[_0x84d0('0x19')](_0x84d0('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x84d0('0x1a')]=router; \ No newline at end of file +var _0x9a86=['isAuthenticated','index','/describe','describe','show','tracked','create','post','/:id/status','status','put','/:id/accept','accept','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get'];(function(_0xd3b97e,_0x3477fc){var _0x1c91ac=function(_0x35220f){while(--_0x35220f){_0xd3b97e['push'](_0xd3b97e['shift']());}};_0x1c91ac(++_0x3477fc);}(_0x9a86,0x1ed));var _0x69a8=function(_0x3efe87,_0x35ad48){_0x3efe87=_0x3efe87-0x0;var _0x56a4cc=_0x9a86[_0x3efe87];return _0x56a4cc;};'use strict';var multer=require(_0x69a8('0x0'));var util=require(_0x69a8('0x1'));var path=require('path');var timeout=require(_0x69a8('0x2'));var express=require(_0x69a8('0x3'));var router=express[_0x69a8('0x4')]();var fs_extra=require(_0x69a8('0x5'));var auth=require(_0x69a8('0x6'));var interaction=require(_0x69a8('0x7'));var config=require(_0x69a8('0x8'));var controller=require(_0x69a8('0x9'));router[_0x69a8('0xa')]('/',auth[_0x69a8('0xb')](),controller[_0x69a8('0xc')]);router[_0x69a8('0xa')](_0x69a8('0xd'),auth[_0x69a8('0xb')](),controller[_0x69a8('0xe')]);router[_0x69a8('0xa')]('/:id',auth[_0x69a8('0xb')](),controller[_0x69a8('0xf')]);router['post']('/',auth[_0x69a8('0xb')](),interaction[_0x69a8('0x10')]('sms','smsmessage:create'),controller[_0x69a8('0x11')]);router[_0x69a8('0x12')](_0x69a8('0x13'),controller[_0x69a8('0x14')]);router['put']('/:id',auth[_0x69a8('0xb')](),controller['update']);router[_0x69a8('0x15')](_0x69a8('0x16'),auth[_0x69a8('0xb')](),controller[_0x69a8('0x17')]);router[_0x69a8('0x15')]('/:id/reject',auth[_0x69a8('0xb')](),controller['reject']);router[_0x69a8('0x18')](_0x69a8('0x19'),auth['isAuthenticated'](),controller[_0x69a8('0x1a')]);module[_0x69a8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index d7ec02e..1434fb2 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 _0x2bce=['medium','out','STRING','BOOLEAN','sequelize','exports'];(function(_0x484d5c,_0x1537f7){var _0x1f59bc=function(_0x16fbf4){while(--_0x16fbf4){_0x484d5c['push'](_0x484d5c['shift']());}};_0x1f59bc(++_0x1537f7);}(_0x2bce,0xd6));var _0xe2bc=function(_0x4d8daa,_0x3efa9d){_0x4d8daa=_0x4d8daa-0x0;var _0x3aa9e3=_0x2bce[_0x4d8daa];return _0x3aa9e3;};'use strict';var Sequelize=require(_0xe2bc('0x0'));module[_0xe2bc('0x1')]={'body':{'type':Sequelize['TEXT'](_0xe2bc('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe2bc('0x3')),'defaultValue':_0xe2bc('0x3'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe2bc('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xe2bc('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe2bc('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9e06=['exports','TEXT','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x31c480,_0x13f64a){var _0x3687ce=function(_0x46fbc0){while(--_0x46fbc0){_0x31c480['push'](_0x31c480['shift']());}};_0x3687ce(++_0x13f64a);}(_0x9e06,0x14f));var _0x69e0=function(_0xff7a4c,_0x2da056){_0xff7a4c=_0xff7a4c-0x0;var _0x59dd72=_0x9e06[_0xff7a4c];return _0x59dd72;};'use strict';var Sequelize=require(_0x69e0('0x0'));module[_0x69e0('0x1')]={'body':{'type':Sequelize[_0x69e0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x69e0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x69e0('0x4')]('in',_0x69e0('0x5')),'defaultValue':_0x69e0('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x69e0('0x6')](0xbe)},'phone':{'type':Sequelize[_0x69e0('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x69e0('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 41bc94e..9c4bda4 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 _0xacf0=['end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','sendStatus','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','create','body','find','destroy','describe','sms','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','SmsInteractionId','interaction','info','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','sms-interactions','get','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','fullname','format','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status'];(function(_0x2fc026,_0xdc4f7a){var _0x34d056=function(_0x457d02){while(--_0x457d02){_0x2fc026['push'](_0x2fc026['shift']());}};_0x34d056(++_0xdc4f7a);}(_0xacf0,0x69));var _0x0acf=function(_0x1266f9,_0x40f076){_0x1266f9=_0x1266f9-0x0;var _0x56ced3=_0xacf0[_0x1266f9];return _0x56ced3;};'use strict';var emlformat=require(_0x0acf('0x0'));var rimraf=require(_0x0acf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0acf('0x2'));var rp=require(_0x0acf('0x3'));var moment=require(_0x0acf('0x4'));var BPromise=require(_0x0acf('0x5'));var Mustache=require('mustache');var util=require(_0x0acf('0x6'));var path=require(_0x0acf('0x7'));var sox=require(_0x0acf('0x8'));var csv=require(_0x0acf('0x9'));var ejs=require(_0x0acf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0acf('0xb'));var squel=require(_0x0acf('0xc'));var crypto=require(_0x0acf('0xd'));var jsforce=require(_0x0acf('0xe'));var deskjs=require(_0x0acf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0acf('0x10'));var Papa=require(_0x0acf('0x11'));var Redis=require(_0x0acf('0x12'));var authService=require(_0x0acf('0x13'));var qs=require(_0x0acf('0x14'));var as=require(_0x0acf('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0acf('0x16'))(_0x0acf('0x17'));var utils=require(_0x0acf('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0acf('0x19'));var db=require(_0x0acf('0x1a'))['db'];config['redis']=_['defaults'](config[_0x0acf('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x0acf('0x1c'))(new Redis(config[_0x0acf('0x1b')]));require('./smsMessage.socket')[_0x0acf('0x1d')](socket);var jayson=require(_0x0acf('0x1e'));var client=jayson[_0x0acf('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x0acf('0x1f')][_0x0acf('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5a8fc0,_0x33db63,_0x886490,_0x4ba68a){return new BPromise(function(_0x160df3,_0x9f5bd1){var _0x3ce484=_0x4ba68a||client;return _0x3ce484[_0x0acf('0x21')](_0x5a8fc0,_0x886490)[_0x0acf('0x22')](function(_0x451c22){logger['info'](_0x0acf('0x23'),_0x33db63,_0x0acf('0x24'));logger['debug'](_0x0acf('0x25'),_0x33db63,_0x0acf('0x24'),JSON[_0x0acf('0x26')](_0x451c22));if(_0x451c22[_0x0acf('0x27')]){if(_0x451c22[_0x0acf('0x27')][_0x0acf('0x28')]===0x1f4){logger[_0x0acf('0x27')](_0x0acf('0x23'),_0x33db63,_0x451c22['error'][_0x0acf('0x29')]);return _0x9f5bd1(_0x451c22['error'][_0x0acf('0x29')]);}logger[_0x0acf('0x27')](_0x0acf('0x23'),_0x33db63,_0x451c22[_0x0acf('0x27')][_0x0acf('0x29')]);return _0x160df3(_0x451c22[_0x0acf('0x27')][_0x0acf('0x29')]);}else{logger['info'](_0x0acf('0x23'),_0x33db63,_0x0acf('0x24'));_0x160df3(_0x451c22[_0x0acf('0x2a')][_0x0acf('0x29')]);}})[_0x0acf('0x2b')](function(_0x356b0c){logger[_0x0acf('0x27')](_0x0acf('0x23'),_0x33db63,_0x356b0c);_0x9f5bd1(_0x356b0c);});});}function respondWithStatusCode(_0x36b8f8,_0x3ee9b1){_0x3ee9b1=_0x3ee9b1||0xcc;return function(_0x19f81c){if(_0x19f81c){return _0x36b8f8['sendStatus'](_0x3ee9b1);}return _0x36b8f8[_0x0acf('0x2c')](_0x3ee9b1)[_0x0acf('0x2d')]();};}function respondWithResult(_0x3d6e80,_0x5df3e4){_0x5df3e4=_0x5df3e4||0xc8;return function(_0x57455e){if(_0x57455e){return _0x3d6e80[_0x0acf('0x2c')](_0x5df3e4)[_0x0acf('0x2e')](_0x57455e);}};}function respondWithFilteredResult(_0x29cdcd,_0x412f0e){return function(_0x5b4c92){if(_0x5b4c92){var _0x48cfa5=typeof _0x412f0e[_0x0acf('0x2f')]===_0x0acf('0x30')&&typeof _0x412f0e['limit']===_0x0acf('0x30');var _0x28172e=_0x5b4c92[_0x0acf('0x31')];var _0x2ad42a=_0x48cfa5?0x0:_0x412f0e['offset'];var _0x93ccfc=_0x48cfa5?_0x5b4c92[_0x0acf('0x31')]:_0x412f0e[_0x0acf('0x2f')]+_0x412f0e[_0x0acf('0x32')];var _0x4d6567;if(_0x93ccfc>=_0x28172e){_0x93ccfc=_0x28172e;_0x4d6567=0xc8;}else{_0x4d6567=0xce;}_0x29cdcd[_0x0acf('0x2c')](_0x4d6567);return _0x29cdcd[_0x0acf('0x33')](_0x0acf('0x34'),_0x2ad42a+'-'+_0x93ccfc+'/'+_0x28172e)[_0x0acf('0x2e')](_0x5b4c92);}return null;};}function patchUpdates(_0x239e9a){return function(_0x369360){try{jsonpatch['apply'](_0x369360,_0x239e9a,!![]);}catch(_0x1046ca){return BPromise[_0x0acf('0x35')](_0x1046ca);}return _0x369360[_0x0acf('0x36')]();};}function saveUpdates(_0x150488,_0x1de7e0){return function(_0x195036){if(_0x195036){return _0x195036[_0x0acf('0x37')](_0x150488)[_0x0acf('0x22')](function(_0x2b298a){return _0x2b298a;});}return null;};}function removeEntity(_0x8ab712,_0x30a225){return function(_0x288f69){if(_0x288f69){return _0x288f69['destroy']()[_0x0acf('0x22')](function(){_0x8ab712[_0x0acf('0x2c')](0xcc)[_0x0acf('0x2d')]();});}};}function handleEntityNotFound(_0x590844,_0x516b8f){return function(_0x1c757f){if(!_0x1c757f){_0x590844[_0x0acf('0x38')](0x194);}return _0x1c757f;};}function handleError(_0x1e9136,_0x106100){_0x106100=_0x106100||0x1f4;return function(_0x47c66c){logger['error'](_0x47c66c[_0x0acf('0x39')]);if(_0x47c66c[_0x0acf('0x3a')]){delete _0x47c66c['name'];}_0x1e9136['status'](_0x106100)[_0x0acf('0x3b')](_0x47c66c);};}exports[_0x0acf('0x3c')]=function(_0x11a968,_0x3fb849){var _0x398a01={},_0x4b653c={},_0x362950={'count':0x0,'rows':[]};var _0x374453=_[_0x0acf('0x3d')](db[_0x0acf('0x3e')][_0x0acf('0x3f')],function(_0x529996){return{'name':_0x529996[_0x0acf('0x40')],'type':_0x529996[_0x0acf('0x41')][_0x0acf('0x42')]};});_0x4b653c[_0x0acf('0x43')]=_[_0x0acf('0x3d')](_0x374453,_0x0acf('0x3a'));_0x4b653c[_0x0acf('0x44')]=_[_0x0acf('0x45')](_0x11a968[_0x0acf('0x44')]);_0x4b653c[_0x0acf('0x46')]=_[_0x0acf('0x47')](_0x4b653c[_0x0acf('0x43')],_0x4b653c['query']);_0x398a01['attributes']=_[_0x0acf('0x47')](_0x4b653c[_0x0acf('0x43')],qs['fields'](_0x11a968[_0x0acf('0x44')][_0x0acf('0x48')]));_0x398a01[_0x0acf('0x49')]=_0x398a01[_0x0acf('0x49')]['length']?_0x398a01[_0x0acf('0x49')]:_0x4b653c[_0x0acf('0x43')];if(!_0x11a968['query']['hasOwnProperty'](_0x0acf('0x4a'))){_0x398a01[_0x0acf('0x32')]=qs[_0x0acf('0x32')](_0x11a968['query'][_0x0acf('0x32')]);_0x398a01[_0x0acf('0x2f')]=qs['offset'](_0x11a968['query'][_0x0acf('0x2f')]);}_0x398a01[_0x0acf('0x4b')]=qs[_0x0acf('0x4c')](_0x11a968[_0x0acf('0x44')][_0x0acf('0x4c')]);_0x398a01[_0x0acf('0x4d')]=qs[_0x0acf('0x46')](_['pick'](_0x11a968['query'],_0x4b653c[_0x0acf('0x46')]),_0x374453);if(_0x11a968[_0x0acf('0x44')]['filter']){_0x398a01[_0x0acf('0x4d')]=_[_0x0acf('0x4e')](_0x398a01['where'],{'$or':_['map'](_0x374453,function(_0x42219d){if(_0x42219d[_0x0acf('0x41')]!==_0x0acf('0x4f')){var _0x1837ca={};_0x1837ca[_0x42219d[_0x0acf('0x3a')]]={'$like':'%'+_0x11a968[_0x0acf('0x44')]['filter']+'%'};return _0x1837ca;}})});}_0x398a01=_[_0x0acf('0x4e')]({},_0x398a01,_0x11a968[_0x0acf('0x50')]);var _0x2dcc51={'where':_0x398a01[_0x0acf('0x4d')]};return db['SmsMessage'][_0x0acf('0x31')](_0x2dcc51)[_0x0acf('0x22')](function(_0x536ad0){_0x362950[_0x0acf('0x31')]=_0x536ad0;if(_0x11a968[_0x0acf('0x44')][_0x0acf('0x51')]){_0x398a01[_0x0acf('0x52')]=[{'all':!![]}];}return db['SmsMessage'][_0x0acf('0x53')](_0x398a01);})['then'](function(_0x6b2d6f){_0x362950[_0x0acf('0x54')]=_0x6b2d6f;return _0x362950;})[_0x0acf('0x22')](respondWithFilteredResult(_0x3fb849,_0x398a01))[_0x0acf('0x2b')](handleError(_0x3fb849,null));};exports[_0x0acf('0x55')]=function(_0xfb9c03,_0x401bad){var _0x388218={'raw':!![],'where':{'id':_0xfb9c03[_0x0acf('0x56')]['id']}},_0x1b367f={};_0x1b367f[_0x0acf('0x43')]=_[_0x0acf('0x45')](db[_0x0acf('0x3e')][_0x0acf('0x3f')]);_0x1b367f[_0x0acf('0x44')]=_[_0x0acf('0x45')](_0xfb9c03['query']);_0x1b367f[_0x0acf('0x46')]=_[_0x0acf('0x47')](_0x1b367f[_0x0acf('0x43')],_0x1b367f[_0x0acf('0x44')]);_0x388218[_0x0acf('0x49')]=_[_0x0acf('0x47')](_0x1b367f[_0x0acf('0x43')],qs[_0x0acf('0x48')](_0xfb9c03['query']['fields']));_0x388218[_0x0acf('0x49')]=_0x388218['attributes'][_0x0acf('0x57')]?_0x388218['attributes']:_0x1b367f[_0x0acf('0x43')];if(_0xfb9c03[_0x0acf('0x44')][_0x0acf('0x51')]){_0x388218[_0x0acf('0x52')]=[{'all':!![]}];}_0x388218=_['merge']({},_0x388218,_0xfb9c03[_0x0acf('0x50')]);return db[_0x0acf('0x3e')]['find'](_0x388218)['then'](handleEntityNotFound(_0x401bad,null))[_0x0acf('0x22')](respondWithResult(_0x401bad,null))[_0x0acf('0x2b')](handleError(_0x401bad,null));};exports['create']=function(_0x47c2ec,_0x20abc8){return db[_0x0acf('0x3e')][_0x0acf('0x58')](_0x47c2ec['body'],{})[_0x0acf('0x22')](respondWithResult(_0x20abc8,0xc9))[_0x0acf('0x2b')](handleError(_0x20abc8,null));};exports['update']=function(_0x5be9fb,_0x382ecd){if(_0x5be9fb[_0x0acf('0x59')]['id']){delete _0x5be9fb[_0x0acf('0x59')]['id'];}return db[_0x0acf('0x3e')][_0x0acf('0x5a')]({'where':{'id':_0x5be9fb[_0x0acf('0x56')]['id']}})['then'](handleEntityNotFound(_0x382ecd,null))[_0x0acf('0x22')](saveUpdates(_0x5be9fb[_0x0acf('0x59')],null))[_0x0acf('0x22')](respondWithResult(_0x382ecd,null))['catch'](handleError(_0x382ecd,null));};exports[_0x0acf('0x5b')]=function(_0x42da94,_0xafd84c){return db[_0x0acf('0x3e')][_0x0acf('0x5a')]({'where':{'id':_0x42da94['params']['id']}})[_0x0acf('0x22')](handleEntityNotFound(_0xafd84c,null))[_0x0acf('0x22')](removeEntity(_0xafd84c,null))[_0x0acf('0x2b')](handleError(_0xafd84c,null));};exports[_0x0acf('0x5c')]=function(_0x5eeebf,_0x13a320){return db[_0x0acf('0x3e')]['describe']()['then'](respondWithResult(_0x13a320,null))[_0x0acf('0x2b')](handleError(_0x13a320,null));};var interaction_log=require(_0x0acf('0x16'))('sms-interactions');exports['accept']=function(_0x55a3ce,_0x340609,_0x22e6cd){var _0x3fffca={'agent':{},'channel':_0x0acf('0x5d')};if(_0x55a3ce['body']['id']){delete _0x55a3ce['body']['id'];}_0x55a3ce[_0x0acf('0x59')]['read']=!![];_0x55a3ce[_0x0acf('0x59')][_0x0acf('0x5e')]=moment()['format'](_0x0acf('0x5f'));_0x55a3ce[_0x0acf('0x59')][_0x0acf('0x60')]=_0x55a3ce[_0x0acf('0x59')][_0x0acf('0x60')]||_0x55a3ce[_0x0acf('0x61')]['id'];_0x3fffca[_0x0acf('0x62')]['id']=_0x55a3ce['body']['UserId'];return db['SmsMessage']['find']({'where':{'id':_0x55a3ce[_0x0acf('0x56')]['id'],'UserId':null}})[_0x0acf('0x22')](handleEntityNotFound(_0x340609,null))[_0x0acf('0x22')](saveUpdates(_0x55a3ce[_0x0acf('0x59')],null))[_0x0acf('0x22')](function(_0x477c30){if(_0x477c30){_0x3fffca[_0x0acf('0x29')]=_0x477c30['get']({'plain':!![]});return db['SmsInteraction'][_0x0acf('0x5a')]({'where':{'id':_0x477c30[_0x0acf('0x63')]}});}return null;})['then'](handleEntityNotFound(_0x340609,null))['then'](function(_0x1a18eb){if(_0x1a18eb){return _0x1a18eb['update']({'UserId':_0x55a3ce[_0x0acf('0x59')]['UserId'],'read1stAt':_['isNil'](_0x1a18eb['read1stAt'])?moment()['format'](_0x0acf('0x5f')):undefined});}return null;})[_0x0acf('0x22')](function(_0x5bdec6){if(_0x5bdec6){_0x3fffca[_0x0acf('0x64')]=_0x5bdec6['get']({'plain':!![]});interaction_log[_0x0acf('0x65')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x55a3ce[_0x0acf('0x61')]['id'],_0x55a3ce[_0x0acf('0x61')]['name'],_0x55a3ce['user'][_0x0acf('0x66')],_0x3fffca[_0x0acf('0x64')]['id'],_0x55a3ce[_0x0acf('0x59')]?JSON['stringify'](_0x55a3ce['body']):'null');return respondWithRpcPromise(_0x0acf('0x67'),_0x0acf('0x68'),_0x3fffca);}return null;})['then'](function(_0x184c1c){var _0x554f51=_0x0acf('0x69')+_0x184c1c[_0x0acf('0x29')]['ContactId'];return db[_0x0acf('0x6a')][_0x0acf('0x44')](_0x554f51,{'type':db[_0x0acf('0x6b')][_0x0acf('0x6c')][_0x0acf('0x6d')],'raw':!![]})[_0x0acf('0x22')](function(_0x19bec9){return _0x19bec9;});})[_0x0acf('0x22')](function(_0x2e072a){if(_0x2e072a){_0x3fffca[_0x0acf('0x29')][_0x0acf('0x6e')]=_0x2e072a[0x0];if(!_0x55a3ce[_0x0acf('0x59')][_0x0acf('0x60')])return;return db[_0x0acf('0x6f')][_0x0acf('0x5a')]({'where':{'id':_0x55a3ce[_0x0acf('0x59')]['UserId'],'role':_0x0acf('0x62')},'attributes':['id','name','fullname',_0x0acf('0x70'),_0x0acf('0x71')],'raw':!![]});}return null;})[_0x0acf('0x22')](function(_0x3f6e17){if(!_0x3f6e17)return null;_0x3fffca['message'][_0x0acf('0x62')]=_0x3f6e17;return _0x3fffca;})[_0x0acf('0x22')](function(_0xe7468){if(_0xe7468){if(_0x55a3ce[_0x0acf('0x59')][_0x0acf('0x72')]){_0x3fffca['message'][_0x0acf('0x73')]=util['format'](_0x0acf('0x74'),_0x55a3ce['user']['name']);_0x3fffca[_0x0acf('0x29')][_0x0acf('0x75')]=_0x3fffca[_0x0acf('0x75')];_0x3fffca[_0x0acf('0x29')][_0x0acf('0x76')]=_0x0acf('0x77');return respondWithRpcPromise(_0x0acf('0x78'),'EventManager',{'event':_0x0acf('0x79'),'message':_0x3fffca[_0x0acf('0x29')]},client9002)[_0x0acf('0x22')](function(){return _0x3fffca;});}return _0x3fffca;}return null;})[_0x0acf('0x22')](respondWithResult(_0x340609,null))['catch'](handleError(_0x340609,null));};var interaction_log=require(_0x0acf('0x16'))(_0x0acf('0x7a'));exports[_0x0acf('0x35')]=function(_0x514194,_0x229504,_0x2aa54c){var _0x6cf9b6={'agent':{},'channel':_0x0acf('0x5d')};if(_0x514194[_0x0acf('0x59')]['id']){delete _0x514194['body']['id'];}_0x514194[_0x0acf('0x59')][_0x0acf('0x60')]=_0x514194[_0x0acf('0x59')][_0x0acf('0x60')]||_0x514194[_0x0acf('0x61')]['id'];_0x6cf9b6[_0x0acf('0x62')]['id']=_0x514194[_0x0acf('0x59')][_0x0acf('0x60')];return db[_0x0acf('0x3e')][_0x0acf('0x5a')]({'where':{'id':_0x514194['params']['id'],'UserId':null}})[_0x0acf('0x22')](handleEntityNotFound(_0x229504,null))[_0x0acf('0x22')](function(_0x3c9c52){if(_0x3c9c52){_0x6cf9b6[_0x0acf('0x29')]=_0x3c9c52[_0x0acf('0x7b')]({'plain':!![]});return db[_0x0acf('0x7c')][_0x0acf('0x5a')]({'where':{'id':_0x3c9c52[_0x0acf('0x63')]}});}return null;})[_0x0acf('0x22')](handleEntityNotFound(_0x229504,null))[_0x0acf('0x22')](function(_0x3097cc){if(_0x3097cc){_0x6cf9b6[_0x0acf('0x64')]=_0x3097cc[_0x0acf('0x7b')]({'plain':!![]});interaction_log[_0x0acf('0x65')](_0x0acf('0x7d'),_0x514194['user']['id'],_0x514194[_0x0acf('0x61')]['name'],_0x514194['user'][_0x0acf('0x66')],_0x6cf9b6[_0x0acf('0x64')]['id'],_0x514194[_0x0acf('0x59')]?JSON['stringify'](_0x514194[_0x0acf('0x59')]):_0x0acf('0x7e'));return respondWithRpcPromise(_0x0acf('0x7f'),_0x0acf('0x80'),_0x6cf9b6);}return null;})[_0x0acf('0x22')](function(_0x1a98de){var _0x3bf8cd=_0x0acf('0x69')+_0x1a98de[_0x0acf('0x29')][_0x0acf('0x81')];return db[_0x0acf('0x6a')][_0x0acf('0x44')](_0x3bf8cd,{'type':db[_0x0acf('0x6b')][_0x0acf('0x6c')][_0x0acf('0x6d')],'raw':!![]})['then'](function(_0x551ec1){return _0x551ec1;});})['then'](function(_0x4c383a){if(_0x4c383a){_0x6cf9b6['message']['contact']=_0x4c383a[0x0];if(!_0x514194['body']['UserId'])return;return db[_0x0acf('0x6f')]['find']({'where':{'id':_0x514194[_0x0acf('0x59')][_0x0acf('0x60')],'role':_0x0acf('0x62')},'attributes':['id','name',_0x0acf('0x82'),_0x0acf('0x70'),_0x0acf('0x71')],'raw':!![]});}return null;})[_0x0acf('0x22')](function(_0x3797af){if(!_0x3797af)return null;_0x6cf9b6[_0x0acf('0x29')]['agent']=_0x3797af;return _0x6cf9b6;})[_0x0acf('0x22')](function(_0x569872){if(_0x569872){_0x569872[_0x0acf('0x29')][_0x0acf('0x73')]=util[_0x0acf('0x83')]('SIP/%s',_0x514194['user'][_0x0acf('0x3a')]);_0x569872[_0x0acf('0x29')][_0x0acf('0x75')]=_0x6cf9b6['channel'];_0x569872['message']['event']=_0x0acf('0x35');respondWithRpcPromise(_0x0acf('0x78'),_0x0acf('0x78'),{'event':_0x0acf('0x84'),'message':_0x569872['message']},client9002);return _0x6cf9b6;}return null;})[_0x0acf('0x22')](respondWithResult(_0x229504,null))['catch'](handleError(_0x229504,null));};exports[_0x0acf('0x2c')]=function(_0x31304c,_0x5d7df6,_0x48ea0d){if(_0x31304c[_0x0acf('0x59')]['id']){delete _0x31304c[_0x0acf('0x59')]['id'];}var _0x540ce4;return db['SmsMessage']['find']({'where':{'id':_0x31304c[_0x0acf('0x56')]['id']}})[_0x0acf('0x22')](handleEntityNotFound(_0x5d7df6,null))[_0x0acf('0x22')](function(_0x134ebe){if(_0x134ebe){_0x540ce4=_0x134ebe;return db[_0x0acf('0x85')][_0x0acf('0x5a')]({'where':{'id':_0x134ebe[_0x0acf('0x86')]}});}})[_0x0acf('0x22')](handleEntityNotFound(_0x5d7df6,null))[_0x0acf('0x22')](function(_0x808064){if(_0x808064){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x0acf('0x87'),_0x808064[_0x0acf('0x41')],util[_0x0acf('0x88')](_0x31304c['body'],{'showHidden':![],'depth':null}));switch(_0x808064[_0x0acf('0x41')]){case _0x0acf('0x89'):if(_0x31304c[_0x0acf('0x59')][_0x0acf('0x8a')]&&_0x31304c[_0x0acf('0x59')]['MessageSid']===_0x540ce4[_0x0acf('0x8b')]){return _0x540ce4[_0x0acf('0x37')]({'read':!![]});}else{logger['error'](_0x0acf('0x8c'),'status','twilio',util[_0x0acf('0x88')](_0x31304c[_0x0acf('0x59')],{'showHidden':![],'depth':null}));}break;case _0x0acf('0x8d'):if(_0x31304c[_0x0acf('0x59')]['MessageUUID']&&_0x31304c[_0x0acf('0x59')][_0x0acf('0x8e')]===_0x540ce4['messageId']&&_[_0x0acf('0x8f')](['sent','delivered'],_0x31304c['body'][_0x0acf('0x90')])>=0x0){return _0x540ce4['update']({'read':!![]});}else{logger['error'](_0x0acf('0x8c'),_0x0acf('0x2c'),_0x0acf('0x91'),util['inspect'](_0x31304c[_0x0acf('0x59')],{'showHidden':![],'depth':null}));}break;case _0x0acf('0x92'):var _0x158dda=_0x31304c[_0x0acf('0x59')][_0x0acf('0x93')][0x0];if(_0x158dda[_0x0acf('0x2c')][_0x0acf('0x94')]===_0x0acf('0x95')){return _0x540ce4[_0x0acf('0x37')]({'read':!![]});}else{logger['error'](_0x0acf('0x8c'),_0x0acf('0x2c'),_0x0acf('0x92'),util[_0x0acf('0x88')](_0x31304c[_0x0acf('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x540ce4;}})[_0x0acf('0x22')](respondWithResult(_0x5d7df6,null))['catch'](handleError(_0x5d7df6,null));}; \ No newline at end of file +var _0xaf9f=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','keys','find','create','body','describe','sms-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE: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','Sequelize','SELECT','contact','agent','fullname','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','email','internal','rejectmessage','SmsAccount','SmsAccountId','debug','inspect','twilio','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','results','groupName','infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xaf9f,0x16d));var _0xfaf9=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0xaf9f[_0x12d812];return _0x3711ab;};'use strict';var emlformat=require(_0xfaf9('0x0'));var rimraf=require(_0xfaf9('0x1'));var zipdir=require(_0xfaf9('0x2'));var jsonpatch=require(_0xfaf9('0x3'));var rp=require(_0xfaf9('0x4'));var moment=require(_0xfaf9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfaf9('0x6'));var csv=require(_0xfaf9('0x7'));var ejs=require(_0xfaf9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfaf9('0x9'));var squel=require(_0xfaf9('0xa'));var crypto=require(_0xfaf9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfaf9('0xc'));var toCsv=require(_0xfaf9('0x7'));var querystring=require(_0xfaf9('0xd'));var Papa=require(_0xfaf9('0xe'));var Redis=require('ioredis');var authService=require(_0xfaf9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfaf9('0x10'));var hardwareService=require(_0xfaf9('0x11'));var logger=require(_0xfaf9('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xfaf9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfaf9('0x14'))['db'];config[_0xfaf9('0x15')]=_[_0xfaf9('0x16')](config[_0xfaf9('0x15')],{'host':_0xfaf9('0x17'),'port':0x18eb});var socket=require(_0xfaf9('0x18'))(new Redis(config['redis']));require(_0xfaf9('0x19'))['register'](socket);var jayson=require(_0xfaf9('0x1a'));var client=jayson[_0xfaf9('0x1b')][_0xfaf9('0x1c')]({'port':0x232c});var client9002=jayson[_0xfaf9('0x1b')][_0xfaf9('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x50635a,_0x4af0aa,_0x1c6379,_0x390ba3){return new BPromise(function(_0x2e52b3,_0x30f000){var _0x37d8ad=_0x390ba3||client;return _0x37d8ad['request'](_0x50635a,_0x1c6379)[_0xfaf9('0x1d')](function(_0x23e8c1){logger[_0xfaf9('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x4af0aa,'request\x20sent');logger['debug'](_0xfaf9('0x1f'),_0x4af0aa,'request\x20sent',JSON[_0xfaf9('0x20')](_0x23e8c1));if(_0x23e8c1[_0xfaf9('0x21')]){if(_0x23e8c1[_0xfaf9('0x21')][_0xfaf9('0x22')]===0x1f4){logger[_0xfaf9('0x21')](_0xfaf9('0x23'),_0x4af0aa,_0x23e8c1[_0xfaf9('0x21')][_0xfaf9('0x24')]);return _0x30f000(_0x23e8c1[_0xfaf9('0x21')]['message']);}logger[_0xfaf9('0x21')](_0xfaf9('0x23'),_0x4af0aa,_0x23e8c1[_0xfaf9('0x21')][_0xfaf9('0x24')]);return _0x2e52b3(_0x23e8c1['error']['message']);}else{logger[_0xfaf9('0x1e')]('SmsMessage,\x20%s,\x20%s',_0x4af0aa,_0xfaf9('0x25'));_0x2e52b3(_0x23e8c1[_0xfaf9('0x26')][_0xfaf9('0x24')]);}})[_0xfaf9('0x27')](function(_0x582144){logger['error'](_0xfaf9('0x23'),_0x4af0aa,_0x582144);_0x30f000(_0x582144);});});}function respondWithStatusCode(_0x36d684,_0x384b8c){_0x384b8c=_0x384b8c||0xcc;return function(_0x1073c8){if(_0x1073c8){return _0x36d684[_0xfaf9('0x28')](_0x384b8c);}return _0x36d684[_0xfaf9('0x29')](_0x384b8c)[_0xfaf9('0x2a')]();};}function respondWithResult(_0x1fa4d9,_0x266f3d){_0x266f3d=_0x266f3d||0xc8;return function(_0x4215cb){if(_0x4215cb){return _0x1fa4d9[_0xfaf9('0x29')](_0x266f3d)['json'](_0x4215cb);}};}function respondWithFilteredResult(_0x405576,_0x435cdc){return function(_0x52532d){if(_0x52532d){var _0x1bb13a=typeof _0x435cdc[_0xfaf9('0x2b')]===_0xfaf9('0x2c')&&typeof _0x435cdc['limit']===_0xfaf9('0x2c');var _0x30f348=_0x52532d[_0xfaf9('0x2d')];var _0x3f9b68=_0x1bb13a?0x0:_0x435cdc[_0xfaf9('0x2b')];var _0x5816dc=_0x1bb13a?_0x52532d['count']:_0x435cdc[_0xfaf9('0x2b')]+_0x435cdc[_0xfaf9('0x2e')];var _0x129d25;if(_0x5816dc>=_0x30f348){_0x5816dc=_0x30f348;_0x129d25=0xc8;}else{_0x129d25=0xce;}_0x405576['status'](_0x129d25);return _0x405576[_0xfaf9('0x2f')](_0xfaf9('0x30'),_0x3f9b68+'-'+_0x5816dc+'/'+_0x30f348)[_0xfaf9('0x31')](_0x52532d);}return null;};}function patchUpdates(_0x1c4b10){return function(_0x5ad9c5){try{jsonpatch[_0xfaf9('0x32')](_0x5ad9c5,_0x1c4b10,!![]);}catch(_0x1f8b6e){return BPromise[_0xfaf9('0x33')](_0x1f8b6e);}return _0x5ad9c5[_0xfaf9('0x34')]();};}function saveUpdates(_0x350c5f,_0x33761c){return function(_0x3e42f1){if(_0x3e42f1){return _0x3e42f1[_0xfaf9('0x35')](_0x350c5f)[_0xfaf9('0x1d')](function(_0xc62548){return _0xc62548;});}return null;};}function removeEntity(_0x259071,_0x2db0c0){return function(_0x1f60f3){if(_0x1f60f3){return _0x1f60f3[_0xfaf9('0x36')]()[_0xfaf9('0x1d')](function(){_0x259071['status'](0xcc)[_0xfaf9('0x2a')]();});}};}function handleEntityNotFound(_0x21d791,_0x5c0be4){return function(_0x2376bf){if(!_0x2376bf){_0x21d791[_0xfaf9('0x28')](0x194);}return _0x2376bf;};}function handleError(_0x123b7d,_0x5d7abe){_0x5d7abe=_0x5d7abe||0x1f4;return function(_0x333ac7){logger[_0xfaf9('0x21')](_0x333ac7[_0xfaf9('0x37')]);if(_0x333ac7[_0xfaf9('0x38')]){delete _0x333ac7[_0xfaf9('0x38')];}_0x123b7d[_0xfaf9('0x29')](_0x5d7abe)[_0xfaf9('0x39')](_0x333ac7);};}exports['index']=function(_0x1cfa3c,_0x4f3aaf){var _0x2a9cd6={},_0x27bb1f={},_0x1ab9f0={'count':0x0,'rows':[]};var _0x36b2f5=_[_0xfaf9('0x3a')](db[_0xfaf9('0x3b')][_0xfaf9('0x3c')],function(_0x3a7081){return{'name':_0x3a7081[_0xfaf9('0x3d')],'type':_0x3a7081[_0xfaf9('0x3e')][_0xfaf9('0x3f')]};});_0x27bb1f[_0xfaf9('0x40')]=_[_0xfaf9('0x3a')](_0x36b2f5,_0xfaf9('0x38'));_0x27bb1f[_0xfaf9('0x41')]=_['keys'](_0x1cfa3c[_0xfaf9('0x41')]);_0x27bb1f[_0xfaf9('0x42')]=_[_0xfaf9('0x43')](_0x27bb1f[_0xfaf9('0x40')],_0x27bb1f[_0xfaf9('0x41')]);_0x2a9cd6[_0xfaf9('0x44')]=_[_0xfaf9('0x43')](_0x27bb1f[_0xfaf9('0x40')],qs[_0xfaf9('0x45')](_0x1cfa3c[_0xfaf9('0x41')]['fields']));_0x2a9cd6['attributes']=_0x2a9cd6['attributes']['length']?_0x2a9cd6[_0xfaf9('0x44')]:_0x27bb1f['model'];if(!_0x1cfa3c[_0xfaf9('0x41')][_0xfaf9('0x46')](_0xfaf9('0x47'))){_0x2a9cd6[_0xfaf9('0x2e')]=qs[_0xfaf9('0x2e')](_0x1cfa3c[_0xfaf9('0x41')]['limit']);_0x2a9cd6['offset']=qs[_0xfaf9('0x2b')](_0x1cfa3c['query'][_0xfaf9('0x2b')]);}_0x2a9cd6[_0xfaf9('0x48')]=qs[_0xfaf9('0x49')](_0x1cfa3c[_0xfaf9('0x41')][_0xfaf9('0x49')]);_0x2a9cd6[_0xfaf9('0x4a')]=qs[_0xfaf9('0x42')](_[_0xfaf9('0x4b')](_0x1cfa3c[_0xfaf9('0x41')],_0x27bb1f[_0xfaf9('0x42')]),_0x36b2f5);if(_0x1cfa3c[_0xfaf9('0x41')][_0xfaf9('0x4c')]){_0x2a9cd6['where']=_[_0xfaf9('0x4d')](_0x2a9cd6[_0xfaf9('0x4a')],{'$or':_['map'](_0x36b2f5,function(_0x5bd9db){if(_0x5bd9db[_0xfaf9('0x3e')]!==_0xfaf9('0x4e')){var _0x5df02c={};_0x5df02c[_0x5bd9db[_0xfaf9('0x38')]]={'$like':'%'+_0x1cfa3c[_0xfaf9('0x41')][_0xfaf9('0x4c')]+'%'};return _0x5df02c;}})});}_0x2a9cd6=_[_0xfaf9('0x4d')]({},_0x2a9cd6,_0x1cfa3c[_0xfaf9('0x4f')]);var _0x2ddf97={'where':_0x2a9cd6[_0xfaf9('0x4a')]};return db[_0xfaf9('0x3b')]['count'](_0x2ddf97)[_0xfaf9('0x1d')](function(_0x1b9e90){_0x1ab9f0['count']=_0x1b9e90;if(_0x1cfa3c[_0xfaf9('0x41')][_0xfaf9('0x50')]){_0x2a9cd6[_0xfaf9('0x51')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x2a9cd6);})[_0xfaf9('0x1d')](function(_0x5dd138){_0x1ab9f0['rows']=_0x5dd138;return _0x1ab9f0;})['then'](respondWithFilteredResult(_0x4f3aaf,_0x2a9cd6))[_0xfaf9('0x27')](handleError(_0x4f3aaf,null));};exports[_0xfaf9('0x52')]=function(_0x12391f,_0xd0f517){var _0x1bef55={'raw':!![],'where':{'id':_0x12391f[_0xfaf9('0x53')]['id']}},_0x5afee1={};_0x5afee1[_0xfaf9('0x40')]=_['keys'](db[_0xfaf9('0x3b')][_0xfaf9('0x3c')]);_0x5afee1[_0xfaf9('0x41')]=_[_0xfaf9('0x54')](_0x12391f[_0xfaf9('0x41')]);_0x5afee1[_0xfaf9('0x42')]=_[_0xfaf9('0x43')](_0x5afee1['model'],_0x5afee1[_0xfaf9('0x41')]);_0x1bef55[_0xfaf9('0x44')]=_['intersection'](_0x5afee1[_0xfaf9('0x40')],qs[_0xfaf9('0x45')](_0x12391f['query'][_0xfaf9('0x45')]));_0x1bef55[_0xfaf9('0x44')]=_0x1bef55[_0xfaf9('0x44')]['length']?_0x1bef55[_0xfaf9('0x44')]:_0x5afee1[_0xfaf9('0x40')];if(_0x12391f[_0xfaf9('0x41')][_0xfaf9('0x50')]){_0x1bef55[_0xfaf9('0x51')]=[{'all':!![]}];}_0x1bef55=_[_0xfaf9('0x4d')]({},_0x1bef55,_0x12391f[_0xfaf9('0x4f')]);return db[_0xfaf9('0x3b')][_0xfaf9('0x55')](_0x1bef55)['then'](handleEntityNotFound(_0xd0f517,null))[_0xfaf9('0x1d')](respondWithResult(_0xd0f517,null))[_0xfaf9('0x27')](handleError(_0xd0f517,null));};exports['create']=function(_0x30e20f,_0xd04aa7){return db['SmsMessage'][_0xfaf9('0x56')](_0x30e20f[_0xfaf9('0x57')],{})['then'](respondWithResult(_0xd04aa7,0xc9))[_0xfaf9('0x27')](handleError(_0xd04aa7,null));};exports[_0xfaf9('0x35')]=function(_0x1e55e2,_0x55c424){if(_0x1e55e2[_0xfaf9('0x57')]['id']){delete _0x1e55e2['body']['id'];}return db[_0xfaf9('0x3b')][_0xfaf9('0x55')]({'where':{'id':_0x1e55e2['params']['id']}})['then'](handleEntityNotFound(_0x55c424,null))[_0xfaf9('0x1d')](saveUpdates(_0x1e55e2['body'],null))[_0xfaf9('0x1d')](respondWithResult(_0x55c424,null))[_0xfaf9('0x27')](handleError(_0x55c424,null));};exports[_0xfaf9('0x36')]=function(_0x4ff7bb,_0x1423b2){return db['SmsMessage']['find']({'where':{'id':_0x4ff7bb['params']['id']}})[_0xfaf9('0x1d')](handleEntityNotFound(_0x1423b2,null))['then'](removeEntity(_0x1423b2,null))[_0xfaf9('0x27')](handleError(_0x1423b2,null));};exports['describe']=function(_0x463af6,_0xf10add){return db[_0xfaf9('0x3b')][_0xfaf9('0x58')]()['then'](respondWithResult(_0xf10add,null))[_0xfaf9('0x27')](handleError(_0xf10add,null));};var interaction_log=require(_0xfaf9('0x12'))(_0xfaf9('0x59'));exports[_0xfaf9('0x5a')]=function(_0x19ebf9,_0x17bbe4,_0x1fb83e){var _0x23d448={'agent':{},'channel':'sms'};if(_0x19ebf9[_0xfaf9('0x57')]['id']){delete _0x19ebf9[_0xfaf9('0x57')]['id'];}_0x19ebf9[_0xfaf9('0x57')][_0xfaf9('0x5b')]=!![];_0x19ebf9['body'][_0xfaf9('0x5c')]=moment()[_0xfaf9('0x5d')](_0xfaf9('0x5e'));_0x19ebf9[_0xfaf9('0x57')][_0xfaf9('0x5f')]=_0x19ebf9[_0xfaf9('0x57')][_0xfaf9('0x5f')]||_0x19ebf9[_0xfaf9('0x60')]['id'];_0x23d448['agent']['id']=_0x19ebf9[_0xfaf9('0x57')]['UserId'];return db[_0xfaf9('0x3b')][_0xfaf9('0x55')]({'where':{'id':_0x19ebf9['params']['id'],'UserId':null}})[_0xfaf9('0x1d')](handleEntityNotFound(_0x17bbe4,null))[_0xfaf9('0x1d')](saveUpdates(_0x19ebf9[_0xfaf9('0x57')],null))[_0xfaf9('0x1d')](function(_0x40a423){if(_0x40a423){_0x23d448[_0xfaf9('0x24')]=_0x40a423[_0xfaf9('0x61')]({'plain':!![]});return db['SmsInteraction'][_0xfaf9('0x55')]({'where':{'id':_0x40a423[_0xfaf9('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x17bbe4,null))[_0xfaf9('0x1d')](function(_0x2e74e7){if(_0x2e74e7){return _0x2e74e7[_0xfaf9('0x35')]({'UserId':_0x19ebf9[_0xfaf9('0x57')][_0xfaf9('0x5f')],'read1stAt':_[_0xfaf9('0x63')](_0x2e74e7[_0xfaf9('0x64')])?moment()[_0xfaf9('0x5d')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xfaf9('0x1d')](function(_0x140e21){if(_0x140e21){_0x23d448[_0xfaf9('0x65')]=_0x140e21[_0xfaf9('0x61')]({'plain':!![]});interaction_log[_0xfaf9('0x1e')](_0xfaf9('0x66'),_0x19ebf9['user']['id'],_0x19ebf9[_0xfaf9('0x60')]['name'],_0x19ebf9[_0xfaf9('0x60')][_0xfaf9('0x67')],_0x23d448[_0xfaf9('0x65')]['id'],_0x19ebf9[_0xfaf9('0x57')]?JSON[_0xfaf9('0x20')](_0x19ebf9[_0xfaf9('0x57')]):_0xfaf9('0x68'));return respondWithRpcPromise(_0xfaf9('0x69'),'acceptMessage',_0x23d448);}return null;})[_0xfaf9('0x1d')](function(_0x43a825){var _0x5724cb=_0xfaf9('0x6a')+_0x43a825['message'][_0xfaf9('0x6b')];return db[_0xfaf9('0x6c')][_0xfaf9('0x41')](_0x5724cb,{'type':db[_0xfaf9('0x6d')]['QueryTypes'][_0xfaf9('0x6e')],'raw':!![]})[_0xfaf9('0x1d')](function(_0x2c98f2){return _0x2c98f2;});})[_0xfaf9('0x1d')](function(_0x1368c4){if(_0x1368c4){_0x23d448['message'][_0xfaf9('0x6f')]=_0x1368c4[0x0];if(!_0x19ebf9[_0xfaf9('0x57')][_0xfaf9('0x5f')])return;return db['User'][_0xfaf9('0x55')]({'where':{'id':_0x19ebf9[_0xfaf9('0x57')][_0xfaf9('0x5f')],'role':_0xfaf9('0x70')},'attributes':['id','name',_0xfaf9('0x71'),'email','internal'],'raw':!![]});}return null;})['then'](function(_0x5d158b){if(!_0x5d158b)return null;_0x23d448['message']['agent']=_0x5d158b;return _0x23d448;})[_0xfaf9('0x1d')](function(_0x564490){if(_0x564490){if(_0x19ebf9[_0xfaf9('0x57')]['manual']){_0x23d448[_0xfaf9('0x24')][_0xfaf9('0x72')]=util[_0xfaf9('0x5d')](_0xfaf9('0x73'),_0x19ebf9[_0xfaf9('0x60')]['name']);_0x23d448[_0xfaf9('0x24')][_0xfaf9('0x74')]=_0x23d448[_0xfaf9('0x74')];_0x23d448['message'][_0xfaf9('0x75')]='accept';return respondWithRpcPromise(_0xfaf9('0x76'),_0xfaf9('0x76'),{'event':_0xfaf9('0x77'),'message':_0x23d448[_0xfaf9('0x24')]},client9002)[_0xfaf9('0x1d')](function(){return _0x23d448;});}return _0x23d448;}return null;})[_0xfaf9('0x1d')](respondWithResult(_0x17bbe4,null))[_0xfaf9('0x27')](handleError(_0x17bbe4,null));};var interaction_log=require(_0xfaf9('0x12'))('sms-interactions');exports['reject']=function(_0x707c03,_0x1af65e,_0x15a053){var _0x5df79={'agent':{},'channel':_0xfaf9('0x78')};if(_0x707c03['body']['id']){delete _0x707c03[_0xfaf9('0x57')]['id'];}_0x707c03[_0xfaf9('0x57')]['UserId']=_0x707c03['body'][_0xfaf9('0x5f')]||_0x707c03[_0xfaf9('0x60')]['id'];_0x5df79[_0xfaf9('0x70')]['id']=_0x707c03[_0xfaf9('0x57')][_0xfaf9('0x5f')];return db[_0xfaf9('0x3b')]['find']({'where':{'id':_0x707c03[_0xfaf9('0x53')]['id'],'UserId':null}})[_0xfaf9('0x1d')](handleEntityNotFound(_0x1af65e,null))['then'](function(_0x2a43f2){if(_0x2a43f2){_0x5df79['message']=_0x2a43f2['get']({'plain':!![]});return db[_0xfaf9('0x79')][_0xfaf9('0x55')]({'where':{'id':_0x2a43f2[_0xfaf9('0x62')]}});}return null;})[_0xfaf9('0x1d')](handleEntityNotFound(_0x1af65e,null))['then'](function(_0x3d5a03){if(_0x3d5a03){_0x5df79[_0xfaf9('0x65')]=_0x3d5a03[_0xfaf9('0x61')]({'plain':!![]});interaction_log[_0xfaf9('0x1e')](_0xfaf9('0x7a'),_0x707c03[_0xfaf9('0x60')]['id'],_0x707c03['user'][_0xfaf9('0x38')],_0x707c03[_0xfaf9('0x60')][_0xfaf9('0x67')],_0x5df79[_0xfaf9('0x65')]['id'],_0x707c03[_0xfaf9('0x57')]?JSON['stringify'](_0x707c03[_0xfaf9('0x57')]):'null');return respondWithRpcPromise(_0xfaf9('0x7b'),'rejectMessage',_0x5df79);}return null;})[_0xfaf9('0x1d')](function(_0x61e686){var _0x12931e=_0xfaf9('0x6a')+_0x61e686['message'][_0xfaf9('0x6b')];return db[_0xfaf9('0x6c')][_0xfaf9('0x41')](_0x12931e,{'type':db[_0xfaf9('0x6d')][_0xfaf9('0x7c')][_0xfaf9('0x6e')],'raw':!![]})[_0xfaf9('0x1d')](function(_0x56ec33){return _0x56ec33;});})[_0xfaf9('0x1d')](function(_0x26fb7e){if(_0x26fb7e){_0x5df79[_0xfaf9('0x24')][_0xfaf9('0x6f')]=_0x26fb7e[0x0];if(!_0x707c03[_0xfaf9('0x57')][_0xfaf9('0x5f')])return;return db['User'][_0xfaf9('0x55')]({'where':{'id':_0x707c03[_0xfaf9('0x57')][_0xfaf9('0x5f')],'role':_0xfaf9('0x70')},'attributes':['id',_0xfaf9('0x38'),_0xfaf9('0x71'),_0xfaf9('0x7d'),_0xfaf9('0x7e')],'raw':!![]});}return null;})['then'](function(_0x446240){if(!_0x446240)return null;_0x5df79[_0xfaf9('0x24')][_0xfaf9('0x70')]=_0x446240;return _0x5df79;})[_0xfaf9('0x1d')](function(_0x236180){if(_0x236180){_0x236180[_0xfaf9('0x24')][_0xfaf9('0x72')]=util[_0xfaf9('0x5d')](_0xfaf9('0x73'),_0x707c03['user'][_0xfaf9('0x38')]);_0x236180[_0xfaf9('0x24')][_0xfaf9('0x74')]=_0x5df79[_0xfaf9('0x74')];_0x236180['message'][_0xfaf9('0x75')]=_0xfaf9('0x33');respondWithRpcPromise(_0xfaf9('0x76'),_0xfaf9('0x76'),{'event':_0xfaf9('0x7f'),'message':_0x236180[_0xfaf9('0x24')]},client9002);return _0x5df79;}return null;})['then'](respondWithResult(_0x1af65e,null))[_0xfaf9('0x27')](handleError(_0x1af65e,null));};exports[_0xfaf9('0x29')]=function(_0x163ace,_0xc4b437,_0x506282){if(_0x163ace[_0xfaf9('0x57')]['id']){delete _0x163ace[_0xfaf9('0x57')]['id'];}var _0x8f99cc;return db[_0xfaf9('0x3b')][_0xfaf9('0x55')]({'where':{'id':_0x163ace[_0xfaf9('0x53')]['id']}})[_0xfaf9('0x1d')](handleEntityNotFound(_0xc4b437,null))[_0xfaf9('0x1d')](function(_0x48e9fc){if(_0x48e9fc){_0x8f99cc=_0x48e9fc;return db[_0xfaf9('0x80')][_0xfaf9('0x55')]({'where':{'id':_0x48e9fc[_0xfaf9('0x81')]}});}})[_0xfaf9('0x1d')](handleEntityNotFound(_0xc4b437,null))[_0xfaf9('0x1d')](function(_0x3f311a){if(_0x3f311a){logger[_0xfaf9('0x82')](_0xfaf9('0x1f'),'status','received\x20delivery\x20report\x20from',_0x3f311a['type'],util[_0xfaf9('0x83')](_0x163ace[_0xfaf9('0x57')],{'showHidden':![],'depth':null}));switch(_0x3f311a[_0xfaf9('0x3e')]){case _0xfaf9('0x84'):if(_0x163ace[_0xfaf9('0x57')]['MessageSid']&&_0x163ace[_0xfaf9('0x57')]['MessageSid']===_0x8f99cc[_0xfaf9('0x85')]){return _0x8f99cc[_0xfaf9('0x35')]({'read':!![]});}else{logger[_0xfaf9('0x21')](_0xfaf9('0x86'),'status','twilio',util[_0xfaf9('0x83')](_0x163ace['body'],{'showHidden':![],'depth':null}));}break;case _0xfaf9('0x87'):if(_0x163ace[_0xfaf9('0x57')][_0xfaf9('0x88')]&&_0x163ace[_0xfaf9('0x57')]['MessageUUID']===_0x8f99cc[_0xfaf9('0x85')]&&_['indexOf']([_0xfaf9('0x89'),_0xfaf9('0x8a')],_0x163ace[_0xfaf9('0x57')][_0xfaf9('0x8b')])>=0x0){return _0x8f99cc[_0xfaf9('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfaf9('0x29'),_0xfaf9('0x8c'),util[_0xfaf9('0x83')](_0x163ace[_0xfaf9('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5d829d=_0x163ace['body'][_0xfaf9('0x8d')][0x0];if(_0x5d829d[_0xfaf9('0x29')][_0xfaf9('0x8e')]==='DELIVERED'){return _0x8f99cc[_0xfaf9('0x35')]({'read':!![]});}else{logger[_0xfaf9('0x21')](_0xfaf9('0x86'),_0xfaf9('0x29'),_0xfaf9('0x8f'),util[_0xfaf9('0x83')](_0x163ace[_0xfaf9('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x8f99cc;}})[_0xfaf9('0x1d')](respondWithResult(_0xc4b437,null))[_0xfaf9('0x27')](handleError(_0xc4b437,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 6e0a73a..4cad878 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 _0x87c3=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage'];(function(_0x4b4a7b,_0x2ba538){var _0x3e1d7=function(_0x2a7543){while(--_0x2a7543){_0x4b4a7b['push'](_0x4b4a7b['shift']());}};_0x3e1d7(++_0x2ba538);}(_0x87c3,0xb1));var _0x387c=function(_0x41c4fc,_0x26098d){_0x41c4fc=_0x41c4fc-0x0;var _0x4bb3a8=_0x87c3[_0x41c4fc];return _0x4bb3a8;};'use strict';var EventEmitter=require(_0x387c('0x0'));var SmsMessage=require(_0x387c('0x1'))['db'][_0x387c('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x387c('0x3'),'afterUpdate':_0x387c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2d67ad){return function(_0xeb3603,_0x37f966,_0x442d95){SmsMessageEvents[_0x387c('0x5')](_0x2d67ad+':'+_0xeb3603['id'],_0xeb3603);SmsMessageEvents[_0x387c('0x5')](_0x2d67ad,_0xeb3603);_0x442d95(null);};}for(var e in events){if(events[_0x387c('0x6')](e)){var event=events[e];SmsMessage[_0x387c('0x7')](e,emitEvent(event));}}module[_0x387c('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0xd39e=['../../mysqldb','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x40cef6,_0x4874de){var _0x3ad583=function(_0x2daeb6){while(--_0x2daeb6){_0x40cef6['push'](_0x40cef6['shift']());}};_0x3ad583(++_0x4874de);}(_0xd39e,0x1b1));var _0xed39=function(_0x5326df,_0x4babd6){_0x5326df=_0x5326df-0x0;var _0x6a86fd=_0xd39e[_0x5326df];return _0x6a86fd;};'use strict';var EventEmitter=require(_0xed39('0x0'));var SmsMessage=require(_0xed39('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xed39('0x2'),'afterUpdate':'update','afterDestroy':_0xed39('0x3')};function emitEvent(_0x4a9c9a){return function(_0x7c82dd,_0x35b5b,_0x4ee2b6){SmsMessageEvents[_0xed39('0x4')](_0x4a9c9a+':'+_0x7c82dd['id'],_0x7c82dd);SmsMessageEvents[_0xed39('0x4')](_0x4a9c9a,_0x7c82dd);_0x4ee2b6(null);};}for(var e in events){if(events[_0xed39('0x5')](e)){var event=events[e];SmsMessage[_0xed39('0x6')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index fe7caa1..6a62d8a 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 _0xfbac=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsMessage.attributes','SmsMessage','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','user_key','session_key','internal_order_id','deliveryReport','read','inspect','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','senderString','format','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','infobip','baseUrl','/auth/1/session','application/json','IBSSO\x20','csc','crypto','login','text','timestamp','keys','sort','apiKey','createHash','md5','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','Token\x20not\x20received','finally'];(function(_0x232918,_0x5e0ea6){var _0x23efa5=function(_0x36817f){while(--_0x36817f){_0x232918['push'](_0x232918['shift']());}};_0x23efa5(++_0x5e0ea6);}(_0xfbac,0x167));var _0xcfba=function(_0x1b927f,_0x234ab6){_0x1b927f=_0x1b927f-0x0;var _0x3493a2=_0xfbac[_0x1b927f];return _0x3493a2;};'use strict';var _=require('lodash');var util=require(_0xcfba('0x0'));var logger=require(_0xcfba('0x1'))(_0xcfba('0x2'));var moment=require(_0xcfba('0x3'));var BPromise=require(_0xcfba('0x4'));var rp=require(_0xcfba('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcfba('0x6'));var attributes=require(_0xcfba('0x7'));module['exports']=function(_0x4eec09,_0x3bb3af){return _0x4eec09['define'](_0xcfba('0x8'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xcfba('0x9'),'fields':[_0xcfba('0x9')]},{'name':'fti_sms_messages','fields':[_0xcfba('0xa')],'type':_0xcfba('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xb47f0e,_0x460f01,_0x12d959){var _0x44af2e=_0x4eec09[_0xcfba('0xc')];var _0x4779bc=_0xb47f0e[_0xcfba('0xd')]({'plain':!![]});if(_0x4779bc[_0xcfba('0xe')][_0xcfba('0xf')]()==='in'||_0x4779bc[_0xcfba('0xe')]['toLowerCase']()==='out'&&!_0x4779bc[_0xcfba('0x10')]&&!_[_0xcfba('0x11')](_0x4779bc['UserId'])){_0x44af2e[_0xcfba('0x12')][_0xcfba('0x13')]({'where':{'id':_0x4779bc[_0xcfba('0x14')]}})[_0xcfba('0x15')](function(_0x2333ee){if(_0x2333ee){_0x2333ee[_0xcfba('0x16')]({'lastMsgAt':_0x4779bc[_0xcfba('0x17')],'lastMsgDirection':_0x4779bc[_0xcfba('0xe')][_0xcfba('0xf')]()});}})[_0xcfba('0x18')](function(_0x231192){console[_0xcfba('0x19')](_0x231192);});}if(_0x4779bc[_0xcfba('0xe')]==='out'&&!_0x4779bc[_0xcfba('0x10')]){var _0x1d7be2;_0x44af2e[_0xcfba('0x1a')][_0xcfba('0x1b')]({'where':{'id':_0x4779bc[_0xcfba('0x1c')]},'raw':!![]})[_0xcfba('0x15')](function(_0x112955){_0x1d7be2=_0x112955;if(_0x1d7be2&&_0x1d7be2['type']){switch(_0x1d7be2[_0xcfba('0x1d')]){case _0xcfba('0x1e'):var _0x35cec9=require('twilio');if(_0x1d7be2['accountSid']&&_0x1d7be2[_0xcfba('0x1f')]&&_0x1d7be2[_0xcfba('0x20')]){var _0x40a0df=new _0x35cec9(_0x1d7be2[_0xcfba('0x21')],_0x1d7be2[_0xcfba('0x1f')]);_0x40a0df[_0xcfba('0x22')]['create']({'body':_0x4779bc[_0xcfba('0xa')],'to':_0x4779bc['phone'],'from':_0x1d7be2[_0xcfba('0x20')],'statusCallback':_0x1d7be2[_0xcfba('0x23')]+'/api/sms/messages/'+_0x4779bc['id']+_0xcfba('0x24')+_0x1d7be2[_0xcfba('0x25')]})[_0xcfba('0x15')](function(_0x3fb061){if(_0x3fb061['sid']){return _0xb47f0e['update']({'messageId':_0x3fb061[_0xcfba('0x26')]});}})[_0xcfba('0x18')](function(_0x200a77){logger['error'](_0xcfba('0x27'),'afterCreate',_0xcfba('0x1e'),util['inspect'](_0x200a77,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcfba('0x27'),_0xcfba('0x28'),'twilio',_0xcfba('0x29'));}break;case _0xcfba('0x2a'):var _0x69bb2f=_0xcfba('0x2b');if(_0x1d7be2[_0xcfba('0x2c')]&&_0x1d7be2[_0xcfba('0x2d')]){var _0x2ee85c={'recipient':[_0x4779bc[_0xcfba('0x20')]],'message':_0x4779bc['body'],'message_type':_0x1d7be2[_0xcfba('0x2e')]};if(_0x1d7be2['smsMethod']&&_0x1d7be2['smsMethod']!=='SI'){_0x2ee85c[_0xcfba('0x2f')]=_0x1d7be2['phone'];}var _0x4ee341={'url':_0x69bb2f+'login?username='+_0x1d7be2[_0xcfba('0x2c')]+_0xcfba('0x30')+_0x1d7be2[_0xcfba('0x2d')],'method':_0xcfba('0x31')};rp(_0x4ee341)[_0xcfba('0x15')](function(_0x1aaf34){var _0x1a0a80=_0x1aaf34[_0xcfba('0x32')](';');var _0x5b0db9={'user_key':_0x1a0a80[0x0],'session_key':_0x1a0a80[0x1]};_0x4ee341={'url':_0x69bb2f+'sms','method':'POST','headers':{'user_key':_0x5b0db9[_0xcfba('0x33')],'Session_key':_0x5b0db9[_0xcfba('0x34')]},'json':!![],'body':_0x2ee85c};return rp(_0x4ee341);})['then'](function(_0x34f60b){if(_0x34f60b['total_sent']>=0x1){var _0x3a3366={'messageId':_0x34f60b[_0xcfba('0x35')]};if(_0x1d7be2[_0xcfba('0x2e')]!=='GP'||!_0x1d7be2[_0xcfba('0x36')]){_0x3a3366[_0xcfba('0x37')]=!![];}return _0xb47f0e[_0xcfba('0x16')](_0x3a3366);}else{return logger[_0xcfba('0x19')](_0xcfba('0x27'),'afterCreate',_0xcfba('0x2a'),util[_0xcfba('0x38')](_0x34f60b,{'showHidden':![],'depth':null}));}})[_0xcfba('0x18')](function(_0x3abf9d){return logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),'skebby',util[_0xcfba('0x38')](_0x3abf9d,{'showHidden':![],'depth':null}));});}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x2a'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x1d7be2[_0xcfba('0x1f')]){var _0x5d970f={'recipient':_0x4779bc[_0xcfba('0x20')],'message':_0x4779bc[_0xcfba('0xa')],'sender':_0x1d7be2['senderString']||_0x1d7be2[_0xcfba('0x20')],'authorization':_0x1d7be2[_0xcfba('0x1f')]};var _0x460f01={'method':'POST','uri':_0xcfba('0x39'),'body':_0x5d970f,'json':!![]};rp(_0x460f01)[_0xcfba('0x15')](function(_0x335f28){var _0x39f058={'messageId':_0x335f28[_0xcfba('0x3a')]};if(!_0x1d7be2[_0xcfba('0x36')]){_0x39f058[_0xcfba('0x37')]=!![];}return _0xb47f0e['update'](_0x39f058);})[_0xcfba('0x18')](function(_0x43c206){logger['error'](_0xcfba('0x27'),'afterCreate',_0xcfba('0x3b'),util['inspect'](_0x43c206,{'showHidden':![],'depth':null}));});}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x3b'),_0xcfba('0x3c'));}break;case _0xcfba('0x3d'):if(_0x1d7be2['username']&&_0x1d7be2[_0xcfba('0x2d')]){var _0x5d970f={'messages':[{'source':'xCALLY\x20Motion','to':_0x4779bc[_0xcfba('0x20')],'body':_0x4779bc[_0xcfba('0xa')],'from':_0x1d7be2[_0xcfba('0x3e')]||_0x1d7be2[_0xcfba('0x20')]}]};var _0x18d77f=util[_0xcfba('0x3f')]('%s:%s',_0x1d7be2['username'],_0x1d7be2['password']);var _0x460f01={'method':_0xcfba('0x40'),'uri':_0xcfba('0x41'),'body':_0x5d970f,'headers':{'Authorization':util[_0xcfba('0x3f')](_0xcfba('0x42'),new Buffer(_0x18d77f)[_0xcfba('0x43')](_0xcfba('0x44')))},'json':!![]};rp(_0x460f01)[_0xcfba('0x15')](function(_0x813013){if(_0x813013['http_code']>=0xc8&&_0x813013[_0xcfba('0x45')]<=0xce){if(_0x813013[_0xcfba('0x46')]&&_0x813013[_0xcfba('0x46')][_0xcfba('0x47')]>0x0){var _0x36ba07=_[_0xcfba('0x48')](_0x813013[_0xcfba('0x46')]['messages']);var _0x1c2f9b={'messageId':_0x36ba07[_0xcfba('0x49')]};if(!_0x1d7be2[_0xcfba('0x36')]){_0x1c2f9b[_0xcfba('0x37')]=!![];}return _0xb47f0e['update'](_0x1c2f9b);}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x4a'),util[_0xcfba('0x38')](_0x813013,{'showHidden':![],'depth':null}));}}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),'afterCreate','clickSend',util[_0xcfba('0x38')](_0x813013,{'showHidden':![],'depth':null}));}})[_0xcfba('0x18')](function(_0x3a5b52){logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),'clickSend',util['inspect'](_0x3a5b52,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcfba('0x27'),'afterCreate',_0xcfba('0x4a'),_0xcfba('0x4b'));}break;case _0xcfba('0x4c'):if(_0x1d7be2[_0xcfba('0x4d')]&&_0x1d7be2['authToken']){var _0x5d970f={'dst':_0x4779bc[_0xcfba('0x20')],'text':_0x4779bc[_0xcfba('0xa')],'src':_0x1d7be2[_0xcfba('0x3e')]||_0x1d7be2[_0xcfba('0x20')],'url':_0x1d7be2[_0xcfba('0x23')]+_0xcfba('0x4e')+_0x4779bc['id']+_0xcfba('0x24')+_0x1d7be2[_0xcfba('0x25')]};var _0x18d77f=util['format'](_0xcfba('0x4f'),_0x1d7be2[_0xcfba('0x4d')],_0x1d7be2[_0xcfba('0x1f')]);var _0x460f01={'method':_0xcfba('0x40'),'uri':util[_0xcfba('0x3f')](_0xcfba('0x50'),_0x1d7be2[_0xcfba('0x4d')]),'body':_0x5d970f,'headers':{'Authorization':util[_0xcfba('0x3f')](_0xcfba('0x42'),new Buffer(_0x18d77f)[_0xcfba('0x43')](_0xcfba('0x44')))},'json':!![]};rp(_0x460f01)[_0xcfba('0x15')](function(_0xbf1c0a){var _0x5f36ac={'messageId':_0xbf1c0a['message_uuid'][0x0]};return _0xb47f0e[_0xcfba('0x16')](_0x5f36ac);})[_0xcfba('0x18')](function(_0x28cd32){logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfba('0x28'),_0xcfba('0x4c'),util[_0xcfba('0x38')](_0x28cd32,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x4c'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xcfba('0x51'):if(_0x1d7be2[_0xcfba('0x2c')]&&_0x1d7be2[_0xcfba('0x2d')]){if(_0x1d7be2[_0xcfba('0x52')]){var _0x542f71={'method':'POST','uri':_0x1d7be2[_0xcfba('0x52')]+_0xcfba('0x53'),'body':{'username':_0x1d7be2['username'],'password':_0x1d7be2['password']},'json':!![]};return rp(_0x542f71)[_0xcfba('0x15')](function(_0x4cf3ef){var _0x3e9cf7={'method':_0xcfba('0x40'),'uri':_0x1d7be2[_0xcfba('0x52')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x1d7be2[_0xcfba('0x20')],'destinations':[{'to':_0x4779bc[_0xcfba('0x20')]}],'text':_0x4779bc[_0xcfba('0xa')],'notifyUrl':_0x1d7be2[_0xcfba('0x23')]+'/api/sms/messages/'+_0x4779bc['id']+_0xcfba('0x24')+_0x1d7be2[_0xcfba('0x25')],'notifyContentType':_0xcfba('0x54'),'callbackData':_0x1d7be2[_0xcfba('0x20')]+';'+_0x4779bc[_0xcfba('0xa')]}]},'headers':{'Authorization':_0xcfba('0x55')+_0x4cf3ef['token']},'json':!![]};return rp(_0x3e9cf7)[_0xcfba('0x15')](function(_0x331691){if(_0x331691[_0xcfba('0x22')]){var _0x48c81a={'messageId':_0x331691[_0xcfba('0x22')][0x0]['messageId']};if(!_0x1d7be2[_0xcfba('0x36')]){_0x48c81a[_0xcfba('0x37')]=!![];}return _0xb47f0e[_0xcfba('0x16')](_0x48c81a);}else{return logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfba('0x28'),_0xcfba('0x51'),util[_0xcfba('0x38')](_0x331691,{'showHidden':![],'depth':null}));}});})[_0xcfba('0x18')](function(_0x57fb01){return logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfba('0x28'),_0xcfba('0x51'),util[_0xcfba('0x38')](_0x57fb01,{'showHidden':![],'depth':null}));});}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),'afterCreate',_0xcfba('0x51'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x51'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xcfba('0x56'):var _0x5f5150=require(_0xcfba('0x57'));if(_0x1d7be2['apiKey']){var _0x453312={};_0x453312[_0xcfba('0x58')]=_0x1d7be2['username'];_0x453312['phone']=_0x4779bc[_0xcfba('0x20')];_0x453312[_0xcfba('0x2f')]=_0x1d7be2['phone'];_0x453312[_0xcfba('0x59')]=_0x4779bc[_0xcfba('0xa')];_0x453312[_0xcfba('0x5a')]=+new Date();var _0x385df0='';var _0xa554d0='';var _0x53c8f0=Object[_0xcfba('0x5b')](_0x453312);_0x53c8f0[_0xcfba('0x5c')]();for(var _0x587fe1=0x0;_0x587fe1<_0x53c8f0['length'];_0x587fe1++){if(_0x385df0!=''){_0x385df0+='&';}_0x385df0+=_0x53c8f0[_0x587fe1]+'='+encodeURIComponent(_0x453312[_0x53c8f0[_0x587fe1]]);_0xa554d0+=_0x453312[_0x53c8f0[_0x587fe1]];}_0xa554d0+=_0x1d7be2[_0xcfba('0x5d')];_0xa554d0=_0x5f5150[_0xcfba('0x5e')](_0xcfba('0x5f'))[_0xcfba('0x16')](_0xa554d0)['digest']('hex');if(_0x385df0!==''){_0x385df0+='&';}_0x385df0+='signature='+_0xa554d0;var _0x4ee341={'method':_0xcfba('0x31'),'uri':_0x1d7be2[_0xcfba('0x52')]+_0xcfba('0x60')+_0x385df0,'json':!![]};return rp(_0x4ee341)[_0xcfba('0x15')](function(_0x407012){var _0x4257c0=Object[_0xcfba('0x5b')](_0x407012);if(_0x407012[_0x4257c0[0x0]][_0xcfba('0x19')]&&parseInt(_0x407012[_0x4257c0[0x0]]['error'])===0x0){var _0xbfad3e={'messageId':_0x407012[_0x4257c0[0x0]][_0xcfba('0x61')]};if(!_0x1d7be2[_0xcfba('0x36')]){_0xbfad3e[_0xcfba('0x37')]=!![];}return _0xb47f0e[_0xcfba('0x16')](_0xbfad3e);}else{return logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x56'),util[_0xcfba('0x38')](_0x407012['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x182d7d){return logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x56'),util[_0xcfba('0x38')](_0x182d7d,{'showHidden':![],'depth':null}));});}else{logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x56'),_0xcfba('0x62'));}break;case _0xcfba('0x63'):if(_0x1d7be2[_0xcfba('0x5d')]){var _0x59e6f9={'method':_0xcfba('0x40'),'uri':_0xcfba('0x64'),'headers':{'Authorization':_0x1d7be2[_0xcfba('0x5d')]},'body':{'content':_0x4779bc[_0xcfba('0xa')],'to':[_0x4779bc['phone']],'from':_0x1d7be2[_0xcfba('0x20')],'binary':![],'clientMessageId':_0xcfba('0x65'),'charset':_0xcfba('0x66')},'json':!![]};rp(_0x59e6f9)[_0xcfba('0x15')](function(_0x274650){if(!_0x274650['error']){var _0x152db6={'messageId':_0x274650[_0xcfba('0x22')][0x0][_0xcfba('0x67')]};if(!_0x1d7be2[_0xcfba('0x36')]){_0x152db6[_0xcfba('0x37')]=!![];}return _0xb47f0e[_0xcfba('0x16')](_0x152db6);}else{return logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x63'),util[_0xcfba('0x38')](_0x274650['error'],{'showHidden':![],'depth':null}));}})[_0xcfba('0x18')](function(_0x51c5d9){return logger['error'](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x63'),util[_0xcfba('0x38')](_0x51c5d9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x63'),_0xcfba('0x62'));}break;case _0xcfba('0x68'):if(_0x1d7be2[_0xcfba('0x2c')]&&_0x1d7be2[_0xcfba('0x2d')]){var _0x18d77f=util[_0xcfba('0x3f')](_0xcfba('0x4f'),_0x1d7be2[_0xcfba('0x2c')],_0x1d7be2[_0xcfba('0x2d')]);var _0x460f01={'method':_0xcfba('0x40'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1d7be2[_0xcfba('0x69')]+_0xcfba('0x6a'),'body':{'to':[_0x4779bc[_0xcfba('0x20')]],'text':_0x4779bc[_0xcfba('0xa')],'from':_0x1d7be2[_0xcfba('0x20')],'applicationId':_0x1d7be2[_0xcfba('0x6b')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x18d77f)[_0xcfba('0x43')](_0xcfba('0x44')))},'json':!![]};rp(_0x460f01)[_0xcfba('0x15')](function(_0x312234){if(_0x312234['id']){var _0xc06ab3={'messageId':_0x312234['id']};return _0xb47f0e['update'](_0xc06ab3);}else{logger['error'](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x68'),util['inspect'](_0x312234,{'showHidden':![],'depth':null}));}})[_0xcfba('0x18')](function(_0x58c4c5){logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfba('0x28'),_0xcfba('0x68'),util[_0xcfba('0x38')](_0x58c4c5,{'showHidden':![],'depth':null}));});}else{logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfba('0x28'),_0xcfba('0x68'),_0xcfba('0x4b'));}break;case _0xcfba('0x6c'):if(_0x1d7be2[_0xcfba('0x5d')]){var _0x24f36e={};var _0x4ee341={'method':'POST','uri':_0xcfba('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x1d7be2[_0xcfba('0x5d')],'Content-Type':_0xcfba('0x54')},'body':{'from':_0x1d7be2[_0xcfba('0x20')],'to':_0x4779bc[_0xcfba('0x20')],'text':_0x4779bc[_0xcfba('0xa')]},'json':!![]};return rp(_0x4ee341)[_0xcfba('0x15')](function(_0x8233f1){if(_0x8233f1['code']==0xca){_0x24f36e[_0xcfba('0x6e')]=_0x8233f1;var _0x5f3b89={'method':_0xcfba('0x40'),'uri':_0xcfba('0x6f'),'headers':{'Authorization':_0xcfba('0x70')+_0x1d7be2[_0xcfba('0x5d')],'Content-Type':_0xcfba('0x54')},'body':{'refid':_0x24f36e[_0xcfba('0x6e')][_0xcfba('0x71')]},'json':!![]};return rp(_0x5f3b89)[_0xcfba('0x15')](function(_0x204b61){_0x24f36e[_0xcfba('0x72')]=_0x204b61;var _0x1d7df9={'messageId':_0x24f36e['message']['refid'],'read':!![]};return _0xb47f0e[_0xcfba('0x16')](_0x1d7df9);});}else{return logger[_0xcfba('0x19')](_0xcfba('0x27'),_0xcfba('0x28'),_0xcfba('0x6c'),util[_0xcfba('0x38')](_0x8233f1,{'showHidden':![],'depth':null}));}})[_0xcfba('0x18')](function(_0x4c9770){return logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xcfba('0x6c'),util['inspect'](_0x4c9770,{'showHidden':![],'depth':null}));});}else{return logger[_0xcfba('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xcfba('0x28'),'intelepeer',_0xcfba('0x73'));}break;}}})[_0xcfba('0x74')](function(){_0x12d959();});}else{_0x12d959();}}},'charset':_0xcfba('0x75'),'collate':_0xcfba('0x76')});}; \ No newline at end of file +var _0x3c0d=['utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','toLowerCase','direction','out','isNil','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','error','secret','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','create','phone','/api/sms/messages/','/status?token=','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','GET','split','sms','internal_order_id','deliveryReport','read','skebby','catch','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','format','%s:%s','username','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','clickSend','plivo','authId','remote','token','https://api.plivo.com/v1/Account/%s/Message/','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','infobip','Missing\x20parameters:\x20base_url','crypto','apiKey','login','timestamp','sort','length','digest','signature=','/external/get/send.php?','keys','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','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','refid','status','Token\x20not\x20received'];(function(_0x36379a,_0x48921e){var _0x1c6ced=function(_0x1a2361){while(--_0x1a2361){_0x36379a['push'](_0x36379a['shift']());}};_0x1c6ced(++_0x48921e);}(_0x3c0d,0xf6));var _0xd3c0=function(_0x277c37,_0x4c92ba){_0x277c37=_0x277c37-0x0;var _0x1ac05d=_0x3c0d[_0x277c37];return _0x1ac05d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd3c0('0x0'));var moment=require(_0xd3c0('0x1'));var BPromise=require(_0xd3c0('0x2'));var rp=require(_0xd3c0('0x3'));var fs=require('fs');var path=require(_0xd3c0('0x4'));var rimraf=require(_0xd3c0('0x5'));var config=require(_0xd3c0('0x6'));var attributes=require(_0xd3c0('0x7'));module[_0xd3c0('0x8')]=function(_0x4d5cf1,_0x36ce7f){return _0x4d5cf1['define'](_0xd3c0('0x9'),attributes,{'tableName':_0xd3c0('0xa'),'paranoid':![],'indexes':[{'name':_0xd3c0('0xb'),'fields':[_0xd3c0('0xb')]},{'name':_0xd3c0('0xc'),'fields':[_0xd3c0('0xd')],'type':_0xd3c0('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3414ff,_0x1d8905,_0x281945){var _0x51e63b=_0x4d5cf1[_0xd3c0('0xf')];var _0x4152c1=_0x3414ff['get']({'plain':!![]});if(_0x4152c1['direction'][_0xd3c0('0x10')]()==='in'||_0x4152c1[_0xd3c0('0x11')][_0xd3c0('0x10')]()===_0xd3c0('0x12')&&!_0x4152c1['secret']&&!_[_0xd3c0('0x13')](_0x4152c1[_0xd3c0('0x14')])){_0x51e63b[_0xd3c0('0x15')]['findOne']({'where':{'id':_0x4152c1[_0xd3c0('0x16')]}})[_0xd3c0('0x17')](function(_0x1b6250){if(_0x1b6250){_0x1b6250[_0xd3c0('0x18')]({'lastMsgAt':_0x4152c1[_0xd3c0('0x19')],'lastMsgDirection':_0x4152c1[_0xd3c0('0x11')]['toLowerCase']()});}})['catch'](function(_0x36f41c){console[_0xd3c0('0x1a')](_0x36f41c);});}if(_0x4152c1['direction']===_0xd3c0('0x12')&&!_0x4152c1[_0xd3c0('0x1b')]){var _0xa25a3e;_0x51e63b[_0xd3c0('0x1c')][_0xd3c0('0x1d')]({'where':{'id':_0x4152c1[_0xd3c0('0x1e')]},'raw':!![]})[_0xd3c0('0x17')](function(_0x53584a){_0xa25a3e=_0x53584a;if(_0xa25a3e&&_0xa25a3e['type']){switch(_0xa25a3e[_0xd3c0('0x1f')]){case'twilio':var _0x38aad0=require(_0xd3c0('0x20'));if(_0xa25a3e[_0xd3c0('0x21')]&&_0xa25a3e[_0xd3c0('0x22')]&&_0xa25a3e['phone']){var _0x54af55=new _0x38aad0(_0xa25a3e[_0xd3c0('0x21')],_0xa25a3e[_0xd3c0('0x22')]);_0x54af55[_0xd3c0('0x23')][_0xd3c0('0x24')]({'body':_0x4152c1['body'],'to':_0x4152c1[_0xd3c0('0x25')],'from':_0xa25a3e['phone'],'statusCallback':_0xa25a3e['remote']+_0xd3c0('0x26')+_0x4152c1['id']+_0xd3c0('0x27')+_0xa25a3e['token']})[_0xd3c0('0x17')](function(_0x454e45){if(_0x454e45['sid']){return _0x3414ff[_0xd3c0('0x18')]({'messageId':_0x454e45['sid']});}})['catch'](function(_0x23e772){logger[_0xd3c0('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd3c0('0x20'),util[_0xd3c0('0x28')](_0x23e772,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3c0('0x29'),_0xd3c0('0x20'),_0xd3c0('0x2a'));}break;case'skebby':var _0x215bb1=_0xd3c0('0x2b');if(_0xa25a3e['username']&&_0xa25a3e[_0xd3c0('0x2c')]){var _0x149b6a={'recipient':[_0x4152c1[_0xd3c0('0x25')]],'message':_0x4152c1[_0xd3c0('0xd')],'message_type':_0xa25a3e[_0xd3c0('0x2d')]};if(_0xa25a3e['smsMethod']&&_0xa25a3e[_0xd3c0('0x2d')]!=='SI'){_0x149b6a[_0xd3c0('0x2e')]=_0xa25a3e['phone'];}var _0x446298={'url':_0x215bb1+_0xd3c0('0x2f')+_0xa25a3e['username']+'&password='+_0xa25a3e[_0xd3c0('0x2c')],'method':_0xd3c0('0x30')};rp(_0x446298)[_0xd3c0('0x17')](function(_0x403b60){var _0xd875f8=_0x403b60[_0xd3c0('0x31')](';');var _0x2794a1={'user_key':_0xd875f8[0x0],'session_key':_0xd875f8[0x1]};_0x446298={'url':_0x215bb1+_0xd3c0('0x32'),'method':'POST','headers':{'user_key':_0x2794a1['user_key'],'Session_key':_0x2794a1['session_key']},'json':!![],'body':_0x149b6a};return rp(_0x446298);})[_0xd3c0('0x17')](function(_0x506c02){if(_0x506c02['total_sent']>=0x1){var _0x44817b={'messageId':_0x506c02[_0xd3c0('0x33')]};if(_0xa25a3e[_0xd3c0('0x2d')]!=='GP'||!_0xa25a3e[_0xd3c0('0x34')]){_0x44817b[_0xd3c0('0x35')]=!![];}return _0x3414ff['update'](_0x44817b);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xd3c0('0x36'),util[_0xd3c0('0x28')](_0x506c02,{'showHidden':![],'depth':null}));}})[_0xd3c0('0x37')](function(_0xcc8302){return logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),_0xd3c0('0x36'),util['inspect'](_0xcc8302,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xd3c0('0x38'),'afterCreate',_0xd3c0('0x36'),_0xd3c0('0x39'));}break;case _0xd3c0('0x3a'):if(_0xa25a3e[_0xd3c0('0x22')]){var _0x39ed04={'recipient':_0x4152c1[_0xd3c0('0x25')],'message':_0x4152c1['body'],'sender':_0xa25a3e[_0xd3c0('0x3b')]||_0xa25a3e[_0xd3c0('0x25')],'authorization':_0xa25a3e[_0xd3c0('0x22')]};var _0x1d8905={'method':_0xd3c0('0x3c'),'uri':_0xd3c0('0x3d'),'body':_0x39ed04,'json':!![]};rp(_0x1d8905)['then'](function(_0x5ccfd8){var _0x31a8b6={'messageId':_0x5ccfd8[_0xd3c0('0x3e')]};if(!_0xa25a3e[_0xd3c0('0x34')]){_0x31a8b6[_0xd3c0('0x35')]=!![];}return _0x3414ff[_0xd3c0('0x18')](_0x31a8b6);})[_0xd3c0('0x37')](function(_0x39d815){logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),'afterCreate',_0xd3c0('0x3a'),util[_0xd3c0('0x28')](_0x39d815,{'showHidden':![],'depth':null}));});}else{logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),'afterCreate','connectel',_0xd3c0('0x3f'));}break;case'clicksend':if(_0xa25a3e['username']&&_0xa25a3e[_0xd3c0('0x2c')]){var _0x39ed04={'messages':[{'source':_0xd3c0('0x40'),'to':_0x4152c1['phone'],'body':_0x4152c1['body'],'from':_0xa25a3e[_0xd3c0('0x3b')]||_0xa25a3e['phone']}]};var _0xa1f895=util[_0xd3c0('0x41')](_0xd3c0('0x42'),_0xa25a3e[_0xd3c0('0x43')],_0xa25a3e[_0xd3c0('0x2c')]);var _0x1d8905={'method':_0xd3c0('0x3c'),'uri':_0xd3c0('0x44'),'body':_0x39ed04,'headers':{'Authorization':util[_0xd3c0('0x41')](_0xd3c0('0x45'),new Buffer(_0xa1f895)[_0xd3c0('0x46')](_0xd3c0('0x47')))},'json':!![]};rp(_0x1d8905)[_0xd3c0('0x17')](function(_0x5bc21c){if(_0x5bc21c[_0xd3c0('0x48')]>=0xc8&&_0x5bc21c[_0xd3c0('0x48')]<=0xce){if(_0x5bc21c[_0xd3c0('0x49')]&&_0x5bc21c['data'][_0xd3c0('0x4a')]>0x0){var _0x3f4a52=_[_0xd3c0('0x4b')](_0x5bc21c[_0xd3c0('0x49')][_0xd3c0('0x23')]);var _0x5b4777={'messageId':_0x3f4a52['message_id']};if(!_0xa25a3e[_0xd3c0('0x34')]){_0x5b4777[_0xd3c0('0x35')]=!![];}return _0x3414ff['update'](_0x5b4777);}else{logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),_0xd3c0('0x4c'),util[_0xd3c0('0x28')](_0x5bc21c,{'showHidden':![],'depth':null}));}}else{logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),'afterCreate',_0xd3c0('0x4c'),util['inspect'](_0x5bc21c,{'showHidden':![],'depth':null}));}})[_0xd3c0('0x37')](function(_0x34ee81){logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),'afterCreate','clickSend',util['inspect'](_0x34ee81,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickSend',_0xd3c0('0x39'));}break;case _0xd3c0('0x4d'):if(_0xa25a3e[_0xd3c0('0x4e')]&&_0xa25a3e[_0xd3c0('0x22')]){var _0x39ed04={'dst':_0x4152c1[_0xd3c0('0x25')],'text':_0x4152c1[_0xd3c0('0xd')],'src':_0xa25a3e['senderString']||_0xa25a3e[_0xd3c0('0x25')],'url':_0xa25a3e[_0xd3c0('0x4f')]+_0xd3c0('0x26')+_0x4152c1['id']+'/status?token='+_0xa25a3e[_0xd3c0('0x50')]};var _0xa1f895=util[_0xd3c0('0x41')](_0xd3c0('0x42'),_0xa25a3e[_0xd3c0('0x4e')],_0xa25a3e['authToken']);var _0x1d8905={'method':_0xd3c0('0x3c'),'uri':util[_0xd3c0('0x41')](_0xd3c0('0x51'),_0xa25a3e[_0xd3c0('0x4e')]),'body':_0x39ed04,'headers':{'Authorization':util[_0xd3c0('0x41')](_0xd3c0('0x45'),new Buffer(_0xa1f895)[_0xd3c0('0x46')](_0xd3c0('0x47')))},'json':!![]};rp(_0x1d8905)[_0xd3c0('0x17')](function(_0x3c41bb){var _0x2fddb5={'messageId':_0x3c41bb['message_uuid'][0x0]};return _0x3414ff[_0xd3c0('0x18')](_0x2fddb5);})[_0xd3c0('0x37')](function(_0x5a6633){logger['error'](_0xd3c0('0x38'),_0xd3c0('0x29'),_0xd3c0('0x4d'),util['inspect'](_0x5a6633,{'showHidden':![],'depth':null}));});}else{logger[_0xd3c0('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3c0('0x29'),_0xd3c0('0x4d'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0xa25a3e['username']&&_0xa25a3e[_0xd3c0('0x2c')]){if(_0xa25a3e[_0xd3c0('0x52')]){var _0x191a52={'method':_0xd3c0('0x3c'),'uri':_0xa25a3e[_0xd3c0('0x52')]+_0xd3c0('0x53'),'body':{'username':_0xa25a3e[_0xd3c0('0x43')],'password':_0xa25a3e[_0xd3c0('0x2c')]},'json':!![]};return rp(_0x191a52)[_0xd3c0('0x17')](function(_0x4720b7){var _0x48fdbe={'method':_0xd3c0('0x3c'),'uri':_0xa25a3e[_0xd3c0('0x52')]+_0xd3c0('0x54'),'body':{'messages':[{'from':_0xa25a3e[_0xd3c0('0x25')],'destinations':[{'to':_0x4152c1['phone']}],'text':_0x4152c1[_0xd3c0('0xd')],'notifyUrl':_0xa25a3e[_0xd3c0('0x4f')]+'/api/sms/messages/'+_0x4152c1['id']+'/status?token='+_0xa25a3e['token'],'notifyContentType':_0xd3c0('0x55'),'callbackData':_0xa25a3e[_0xd3c0('0x25')]+';'+_0x4152c1['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x4720b7[_0xd3c0('0x50')]},'json':!![]};return rp(_0x48fdbe)['then'](function(_0x7b85b6){if(_0x7b85b6['messages']){var _0x3d785b={'messageId':_0x7b85b6[_0xd3c0('0x23')][0x0][_0xd3c0('0xb')]};if(!_0xa25a3e[_0xd3c0('0x34')]){_0x3d785b[_0xd3c0('0x35')]=!![];}return _0x3414ff[_0xd3c0('0x18')](_0x3d785b);}else{return logger[_0xd3c0('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3c0('0x29'),_0xd3c0('0x56'),util[_0xd3c0('0x28')](_0x7b85b6,{'showHidden':![],'depth':null}));}});})[_0xd3c0('0x37')](function(_0x276eb8){return logger[_0xd3c0('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3c0('0x29'),_0xd3c0('0x56'),util[_0xd3c0('0x28')](_0x276eb8,{'showHidden':![],'depth':null}));});}else{logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),_0xd3c0('0x56'),_0xd3c0('0x57'));}}else{logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),_0xd3c0('0x56'),'Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x1d069b=require(_0xd3c0('0x58'));if(_0xa25a3e[_0xd3c0('0x59')]){var _0x33271e={};_0x33271e[_0xd3c0('0x5a')]=_0xa25a3e['username'];_0x33271e[_0xd3c0('0x25')]=_0x4152c1[_0xd3c0('0x25')];_0x33271e[_0xd3c0('0x2e')]=_0xa25a3e[_0xd3c0('0x25')];_0x33271e['text']=_0x4152c1['body'];_0x33271e[_0xd3c0('0x5b')]=+new Date();var _0x125880='';var _0x5d4897='';var _0x318889=Object['keys'](_0x33271e);_0x318889[_0xd3c0('0x5c')]();for(var _0x20840c=0x0;_0x20840c<_0x318889[_0xd3c0('0x5d')];_0x20840c++){if(_0x125880!=''){_0x125880+='&';}_0x125880+=_0x318889[_0x20840c]+'='+encodeURIComponent(_0x33271e[_0x318889[_0x20840c]]);_0x5d4897+=_0x33271e[_0x318889[_0x20840c]];}_0x5d4897+=_0xa25a3e[_0xd3c0('0x59')];_0x5d4897=_0x1d069b['createHash']('md5')[_0xd3c0('0x18')](_0x5d4897)[_0xd3c0('0x5e')]('hex');if(_0x125880!==''){_0x125880+='&';}_0x125880+=_0xd3c0('0x5f')+_0x5d4897;var _0x446298={'method':'GET','uri':_0xa25a3e[_0xd3c0('0x52')]+_0xd3c0('0x60')+_0x125880,'json':!![]};return rp(_0x446298)['then'](function(_0x32bc01){var _0x59c2cc=Object[_0xd3c0('0x61')](_0x32bc01);if(_0x32bc01[_0x59c2cc[0x0]][_0xd3c0('0x1a')]&&parseInt(_0x32bc01[_0x59c2cc[0x0]][_0xd3c0('0x1a')])===0x0){var _0x24cd9e={'messageId':_0x32bc01[_0x59c2cc[0x0]][_0xd3c0('0x62')]};if(!_0xa25a3e[_0xd3c0('0x34')]){_0x24cd9e['read']=!![];}return _0x3414ff[_0xd3c0('0x18')](_0x24cd9e);}else{return logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),'csc',util[_0xd3c0('0x28')](_0x32bc01[_0xd3c0('0x1a')],{'showHidden':![],'depth':null}));}})[_0xd3c0('0x37')](function(_0x562335){return logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),_0xd3c0('0x63'),util['inspect'](_0x562335,{'showHidden':![],'depth':null}));});}else{logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),_0xd3c0('0x63'),_0xd3c0('0x64'));}break;case _0xd3c0('0x65'):if(_0xa25a3e[_0xd3c0('0x59')]){var _0x44fa26={'method':_0xd3c0('0x3c'),'uri':_0xd3c0('0x66'),'headers':{'Authorization':_0xa25a3e[_0xd3c0('0x59')]},'body':{'content':_0x4152c1[_0xd3c0('0xd')],'to':[_0x4152c1[_0xd3c0('0x25')]],'from':_0xa25a3e[_0xd3c0('0x25')],'binary':![],'clientMessageId':_0xd3c0('0x67'),'charset':_0xd3c0('0x68')},'json':!![]};rp(_0x44fa26)[_0xd3c0('0x17')](function(_0x583c33){if(!_0x583c33[_0xd3c0('0x1a')]){var _0x2b8f3a={'messageId':_0x583c33[_0xd3c0('0x23')][0x0][_0xd3c0('0x69')]};if(!_0xa25a3e[_0xd3c0('0x34')]){_0x2b8f3a[_0xd3c0('0x35')]=!![];}return _0x3414ff[_0xd3c0('0x18')](_0x2b8f3a);}else{return logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),'clickatell',util[_0xd3c0('0x28')](_0x583c33[_0xd3c0('0x1a')],{'showHidden':![],'depth':null}));}})[_0xd3c0('0x37')](function(_0x568bf0){return logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),_0xd3c0('0x65'),util[_0xd3c0('0x28')](_0x568bf0,{'showHidden':![],'depth':null}));});}else{logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),_0xd3c0('0x65'),'Missing\x20parameters:\x20apiKey');}break;case _0xd3c0('0x6a'):if(_0xa25a3e[_0xd3c0('0x43')]&&_0xa25a3e['password']){var _0xa1f895=util['format']('%s:%s',_0xa25a3e[_0xd3c0('0x43')],_0xa25a3e[_0xd3c0('0x2c')]);var _0x1d8905={'method':_0xd3c0('0x3c'),'uri':_0xd3c0('0x6b')+_0xa25a3e[_0xd3c0('0x6c')]+_0xd3c0('0x6d'),'body':{'to':[_0x4152c1[_0xd3c0('0x25')]],'text':_0x4152c1[_0xd3c0('0xd')],'from':_0xa25a3e['phone'],'applicationId':_0xa25a3e[_0xd3c0('0x6e')]},'headers':{'Authorization':util[_0xd3c0('0x41')]('Basic\x20%s',new Buffer(_0xa1f895)[_0xd3c0('0x46')](_0xd3c0('0x47')))},'json':!![]};rp(_0x1d8905)[_0xd3c0('0x17')](function(_0x1cc769){if(_0x1cc769['id']){var _0x465bc9={'messageId':_0x1cc769['id']};return _0x3414ff['update'](_0x465bc9);}else{logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),_0xd3c0('0x6a'),util[_0xd3c0('0x28')](_0x1cc769,{'showHidden':![],'depth':null}));}})[_0xd3c0('0x37')](function(_0x8a41c9){logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),'afterCreate',_0xd3c0('0x6a'),util['inspect'](_0x8a41c9,{'showHidden':![],'depth':null}));});}else{logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),_0xd3c0('0x6a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xd3c0('0x6f'):if(_0xa25a3e['apiKey']){var _0x253da0={};var _0x446298={'method':_0xd3c0('0x3c'),'uri':_0xd3c0('0x70'),'headers':{'Authorization':'Bearer\x20'+_0xa25a3e[_0xd3c0('0x59')],'Content-Type':_0xd3c0('0x55')},'body':{'from':_0xa25a3e[_0xd3c0('0x25')],'to':_0x4152c1[_0xd3c0('0x25')],'text':_0x4152c1[_0xd3c0('0xd')]},'json':!![]};return rp(_0x446298)[_0xd3c0('0x17')](function(_0x4cc403){if(_0x4cc403[_0xd3c0('0x71')]==0xca){_0x253da0[_0xd3c0('0x72')]=_0x4cc403;var _0x3b45d1={'method':'POST','uri':_0xd3c0('0x73'),'headers':{'Authorization':_0xd3c0('0x74')+_0xa25a3e[_0xd3c0('0x59')],'Content-Type':_0xd3c0('0x55')},'body':{'refid':_0x253da0[_0xd3c0('0x72')][_0xd3c0('0x75')]},'json':!![]};return rp(_0x3b45d1)[_0xd3c0('0x17')](function(_0x3bb59c){_0x253da0[_0xd3c0('0x76')]=_0x3bb59c;var _0x5eb308={'messageId':_0x253da0[_0xd3c0('0x72')][_0xd3c0('0x75')],'read':!![]};return _0x3414ff[_0xd3c0('0x18')](_0x5eb308);});}else{return logger[_0xd3c0('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xd3c0('0x29'),_0xd3c0('0x6f'),util[_0xd3c0('0x28')](_0x4cc403,{'showHidden':![],'depth':null}));}})[_0xd3c0('0x37')](function(_0x26ca48){return logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),'intelepeer',util['inspect'](_0x26ca48,{'showHidden':![],'depth':null}));});}else{return logger[_0xd3c0('0x1a')](_0xd3c0('0x38'),_0xd3c0('0x29'),'intelepeer',_0xd3c0('0x77'));}break;}}})['finally'](function(){_0x281945();});}else{_0x281945();}}},'charset':_0xd3c0('0x78'),'collate':_0xd3c0('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 09bfebf..aefff4b 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 _0x6036=['socket.io-emitter','redis','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsMessage','create','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','localhost'];(function(_0x5ce0f9,_0x4bcafb){var _0x45fcfe=function(_0x38925d){while(--_0x38925d){_0x5ce0f9['push'](_0x5ce0f9['shift']());}};_0x45fcfe(++_0x4bcafb);}(_0x6036,0xb2));var _0x6603=function(_0x5229d7,_0x19929b){_0x5229d7=_0x5229d7-0x0;var _0x532bf5=_0x6036[_0x5229d7];return _0x532bf5;};'use strict';var _=require(_0x6603('0x0'));var util=require(_0x6603('0x1'));var moment=require(_0x6603('0x2'));var BPromise=require(_0x6603('0x3'));var rs=require(_0x6603('0x4'));var fs=require('fs');var Redis=require(_0x6603('0x5'));var db=require(_0x6603('0x6'))['db'];var utils=require(_0x6603('0x7'));var logger=require(_0x6603('0x8'))('rpc');var config=require(_0x6603('0x9'));var jayson=require(_0x6603('0xa'));var client=jayson['client'][_0x6603('0xb')]({'port':0x232a});config['redis']=_[_0x6603('0xc')](config['redis'],{'host':_0x6603('0xd'),'port':0x18eb});var socket=require(_0x6603('0xe'))(new Redis(config[_0x6603('0xf')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3089a0,_0x38346d,_0xe5e683){return new BPromise(function(_0x5907a5,_0x5f12b5){return client['request'](_0x3089a0,_0xe5e683)[_0x6603('0x10')](function(_0x469cde){logger['info'](_0x6603('0x11'),_0x38346d,_0x6603('0x12'));logger[_0x6603('0x13')](_0x6603('0x14'),_0x38346d,_0x6603('0x12'),JSON[_0x6603('0x15')](_0x469cde));if(_0x469cde[_0x6603('0x16')]){if(_0x469cde[_0x6603('0x16')][_0x6603('0x17')]===0x1f4){logger[_0x6603('0x16')](_0x6603('0x11'),_0x38346d,_0x469cde[_0x6603('0x16')][_0x6603('0x18')]);return _0x5f12b5(_0x469cde[_0x6603('0x16')][_0x6603('0x18')]);}logger['error'](_0x6603('0x11'),_0x38346d,_0x469cde['error']['message']);return _0x5907a5(_0x469cde[_0x6603('0x16')][_0x6603('0x18')]);}else{logger[_0x6603('0x19')](_0x6603('0x11'),_0x38346d,_0x6603('0x12'));_0x5907a5(_0x469cde[_0x6603('0x1a')][_0x6603('0x18')]);}})[_0x6603('0x1b')](function(_0xe733ec){logger[_0x6603('0x16')]('SmsMessage,\x20%s,\x20%s',_0x38346d,_0xe733ec);_0x5f12b5(_0xe733ec);});});}exports[_0x6603('0x1c')]=function(_0x546042){var _0x493058=this;return new Promise(function(_0x2db959,_0x2f5cd1){return db['SmsMessage'][_0x6603('0x1d')](_0x546042['body'],{'raw':_0x546042[_0x6603('0x1e')]?_0x546042['options'][_0x6603('0x1f')]===undefined?!![]:![]:!![]})[_0x6603('0x10')](function(_0x142c83){logger[_0x6603('0x19')](_0x6603('0x1c'),_0x546042);logger[_0x6603('0x13')](_0x6603('0x1c'),_0x546042,JSON[_0x6603('0x15')](_0x142c83));_0x2db959(_0x142c83);})[_0x6603('0x1b')](function(_0x5b4eba){logger[_0x6603('0x16')](_0x6603('0x1c'),_0x5b4eba[_0x6603('0x18')],_0x546042);_0x2f5cd1(_0x493058[_0x6603('0x16')](0x1f4,_0x5b4eba['message']));});});}; \ No newline at end of file +var _0x93a7=['options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsMessage','create','body'];(function(_0x268651,_0x5648a9){var _0x4cca7b=function(_0x2c33cd){while(--_0x2c33cd){_0x268651['push'](_0x268651['shift']());}};_0x4cca7b(++_0x5648a9);}(_0x93a7,0xab));var _0x793a=function(_0x50939a,_0x245a75){_0x50939a=_0x50939a-0x0;var _0x3d2086=_0x93a7[_0x50939a];return _0x3d2086;};'use strict';var _=require(_0x793a('0x0'));var util=require(_0x793a('0x1'));var moment=require(_0x793a('0x2'));var BPromise=require('bluebird');var rs=require(_0x793a('0x3'));var fs=require('fs');var Redis=require(_0x793a('0x4'));var db=require(_0x793a('0x5'))['db'];var utils=require(_0x793a('0x6'));var logger=require(_0x793a('0x7'))('rpc');var config=require(_0x793a('0x8'));var jayson=require(_0x793a('0x9'));var client=jayson[_0x793a('0xa')][_0x793a('0xb')]({'port':0x232a});config[_0x793a('0xc')]=_[_0x793a('0xd')](config[_0x793a('0xc')],{'host':_0x793a('0xe'),'port':0x18eb});var socket=require(_0x793a('0xf'))(new Redis(config[_0x793a('0xc')]));require(_0x793a('0x10'))[_0x793a('0x11')](socket);function respondWithRpcPromise(_0x334819,_0xf22f56,_0x5e8bbf){return new BPromise(function(_0x4a32ec,_0x1e295f){return client[_0x793a('0x12')](_0x334819,_0x5e8bbf)[_0x793a('0x13')](function(_0xd72a90){logger[_0x793a('0x14')](_0x793a('0x15'),_0xf22f56,_0x793a('0x16'));logger[_0x793a('0x17')](_0x793a('0x18'),_0xf22f56,_0x793a('0x16'),JSON['stringify'](_0xd72a90));if(_0xd72a90[_0x793a('0x19')]){if(_0xd72a90[_0x793a('0x19')][_0x793a('0x1a')]===0x1f4){logger[_0x793a('0x19')](_0x793a('0x15'),_0xf22f56,_0xd72a90[_0x793a('0x19')][_0x793a('0x1b')]);return _0x1e295f(_0xd72a90['error'][_0x793a('0x1b')]);}logger[_0x793a('0x19')](_0x793a('0x15'),_0xf22f56,_0xd72a90[_0x793a('0x19')][_0x793a('0x1b')]);return _0x4a32ec(_0xd72a90[_0x793a('0x19')][_0x793a('0x1b')]);}else{logger[_0x793a('0x14')](_0x793a('0x15'),_0xf22f56,_0x793a('0x16'));_0x4a32ec(_0xd72a90[_0x793a('0x1c')]['message']);}})[_0x793a('0x1d')](function(_0x3c605a){logger[_0x793a('0x19')](_0x793a('0x15'),_0xf22f56,_0x3c605a);_0x1e295f(_0x3c605a);});});}exports[_0x793a('0x1e')]=function(_0x421ec8){var _0x235c05=this;return new Promise(function(_0x1f1e78,_0x4220cc){return db['SmsMessage'][_0x793a('0x1f')](_0x421ec8[_0x793a('0x20')],{'raw':_0x421ec8[_0x793a('0x21')]?_0x421ec8[_0x793a('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x793a('0x13')](function(_0x476579){logger[_0x793a('0x14')](_0x793a('0x1e'),_0x421ec8);logger['debug'](_0x793a('0x1e'),_0x421ec8,JSON['stringify'](_0x476579));_0x1f1e78(_0x476579);})[_0x793a('0x1d')](function(_0x50861c){logger[_0x793a('0x19')]('CreateSmsMessage',_0x50861c['message'],_0x421ec8);_0x4220cc(_0x235c05[_0x793a('0x19')](0x1f4,_0x50861c[_0x793a('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index afbe1b6..d020937 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 _0xbd8f=['save','update','emit','removeListener','smsMessage:','./smsMessage.events'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xbd8f,0x95));var _0xfbd8=function(_0x5abdfc,_0x385c27){_0x5abdfc=_0x5abdfc-0x0;var _0x124657=_0xbd8f[_0x5abdfc];return _0x124657;};'use strict';var SmsMessageEvents=require(_0xfbd8('0x0'));var events=[_0xfbd8('0x1'),'remove',_0xfbd8('0x2')];function createListener(_0x317e35,_0x91a023){return function(_0x4959ca){_0x91a023[_0xfbd8('0x3')](_0x317e35,_0x4959ca);};}function removeListener(_0x2e6ff2,_0x1a7e82){return function(){SmsMessageEvents[_0xfbd8('0x4')](_0x2e6ff2,_0x1a7e82);};}exports['register']=function(_0x531327){for(var _0x36a1dc=0x0,_0x22fbb7=events['length'];_0x36a1dc<_0x22fbb7;_0x36a1dc++){var _0x58de7b=events[_0x36a1dc];var _0x3f4a8c=createListener(_0xfbd8('0x5')+_0x58de7b,_0x531327);SmsMessageEvents['on'](_0x58de7b,_0x3f4a8c);}}; \ No newline at end of file +var _0x2431=['save','remove','update','removeListener','register','length','smsMessage:'];(function(_0x5786d8,_0x225e8e){var _0x4c4fe6=function(_0x2d84ae){while(--_0x2d84ae){_0x5786d8['push'](_0x5786d8['shift']());}};_0x4c4fe6(++_0x225e8e);}(_0x2431,0xee));var _0x1243=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x2431[_0x40a045];return _0x1a687c;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0x1243('0x0'),_0x1243('0x1'),_0x1243('0x2')];function createListener(_0xee7d32,_0x2c4488){return function(_0x2d34da){_0x2c4488['emit'](_0xee7d32,_0x2d34da);};}function removeListener(_0x45e11a,_0x264379){return function(){SmsMessageEvents[_0x1243('0x3')](_0x45e11a,_0x264379);};}exports[_0x1243('0x4')]=function(_0xf6b141){for(var _0x470f03=0x0,_0x5bd54a=events[_0x1243('0x5')];_0x470f03<_0x5bd54a;_0x470f03++){var _0x29599b=events[_0x470f03];var _0x2d0505=createListener(_0x1243('0x6')+_0x29599b,_0xf6b141);SmsMessageEvents['on'](_0x29599b,_0x2d0505);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 554f213..51d489c 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 _0x3273=['../../components/interaction/service','../../config/environment','index','get','/describe','describe','isAuthenticated','show','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3b1d06,_0x11890e){var _0x3ee6b6=function(_0x156c79){while(--_0x156c79){_0x3b1d06['push'](_0x3b1d06['shift']());}};_0x3ee6b6(++_0x11890e);}(_0x3273,0xe2));var _0x3327=function(_0x330d1f,_0x47c710){_0x330d1f=_0x330d1f-0x0;var _0x1df784=_0x3273[_0x330d1f];return _0x1df784;};'use strict';var multer=require('multer');var util=require(_0x3327('0x0'));var path=require(_0x3327('0x1'));var timeout=require(_0x3327('0x2'));var express=require(_0x3327('0x3'));var router=express['Router']();var fs_extra=require(_0x3327('0x4'));var auth=require(_0x3327('0x5'));var interaction=require(_0x3327('0x6'));var config=require(_0x3327('0x7'));var controller=require('./smsQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3327('0x8')]);router[_0x3327('0x9')](_0x3327('0xa'),auth['isAuthenticated'](),controller[_0x3327('0xb')]);router[_0x3327('0x9')]('/:id',auth[_0x3327('0xc')](),controller[_0x3327('0xd')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x3327('0xe')]);router[_0x3327('0x9')](_0x3327('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3327('0x9')](_0x3327('0x10'),auth['isAuthenticated'](),controller[_0x3327('0x11')]);router[_0x3327('0x12')]('/',auth[_0x3327('0xc')](),controller[_0x3327('0x13')]);router[_0x3327('0x12')](_0x3327('0xf'),auth[_0x3327('0xc')](),controller[_0x3327('0x14')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x3327('0x15')]);router[_0x3327('0x16')](_0x3327('0x17'),auth[_0x3327('0xc')](),controller[_0x3327('0x18')]);router[_0x3327('0x19')](_0x3327('0x17'),auth[_0x3327('0xc')](),controller[_0x3327('0x1a')]);router[_0x3327('0x19')](_0x3327('0xf'),auth[_0x3327('0xc')](),controller['removeTeams']);router[_0x3327('0x19')]('/:id/users',auth[_0x3327('0xc')](),controller[_0x3327('0x1b')]);module[_0x3327('0x1c')]=router; \ No newline at end of file +var _0xfcc3=['show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsQueue.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x124bcb,_0x5b02e0){var _0x4515f3=function(_0x258550){while(--_0x258550){_0x124bcb['push'](_0x124bcb['shift']());}};_0x4515f3(++_0x5b02e0);}(_0xfcc3,0x128));var _0x3fcc=function(_0x48228f,_0x5eaf2b){_0x48228f=_0x48228f-0x0;var _0x2f672a=_0xfcc3[_0x48228f];return _0x2f672a;};'use strict';var multer=require(_0x3fcc('0x0'));var util=require(_0x3fcc('0x1'));var path=require(_0x3fcc('0x2'));var timeout=require(_0x3fcc('0x3'));var express=require(_0x3fcc('0x4'));var router=express[_0x3fcc('0x5')]();var fs_extra=require(_0x3fcc('0x6'));var auth=require(_0x3fcc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3fcc('0x8'));router[_0x3fcc('0x9')]('/',auth[_0x3fcc('0xa')](),controller[_0x3fcc('0xb')]);router[_0x3fcc('0x9')]('/describe',auth[_0x3fcc('0xa')](),controller[_0x3fcc('0xc')]);router['get'](_0x3fcc('0xd'),auth[_0x3fcc('0xa')](),controller[_0x3fcc('0xe')]);router[_0x3fcc('0x9')](_0x3fcc('0xf'),auth[_0x3fcc('0xa')](),controller[_0x3fcc('0x10')]);router['get'](_0x3fcc('0x11'),auth['isAuthenticated'](),controller[_0x3fcc('0x12')]);router[_0x3fcc('0x9')](_0x3fcc('0x13'),auth[_0x3fcc('0xa')](),controller[_0x3fcc('0x14')]);router[_0x3fcc('0x15')]('/',auth[_0x3fcc('0xa')](),controller[_0x3fcc('0x16')]);router[_0x3fcc('0x15')](_0x3fcc('0x11'),auth[_0x3fcc('0xa')](),controller[_0x3fcc('0x17')]);router[_0x3fcc('0x15')](_0x3fcc('0x13'),auth[_0x3fcc('0xa')](),controller[_0x3fcc('0x18')]);router[_0x3fcc('0x19')](_0x3fcc('0xd'),auth[_0x3fcc('0xa')](),controller[_0x3fcc('0x1a')]);router[_0x3fcc('0x1b')](_0x3fcc('0xd'),auth[_0x3fcc('0xa')](),controller[_0x3fcc('0x1c')]);router[_0x3fcc('0x1b')](_0x3fcc('0x11'),auth['isAuthenticated'](),controller[_0x3fcc('0x1d')]);router[_0x3fcc('0x1b')](_0x3fcc('0x13'),auth[_0x3fcc('0xa')](),controller[_0x3fcc('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 92ba749..85388c6 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 _0xd63e=['exports','STRING','name','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x3326c3,_0x14382c){var _0x14eb8a=function(_0x2f2cb3){while(--_0x2f2cb3){_0x3326c3['push'](_0x3326c3['shift']());}};_0x14eb8a(++_0x14382c);}(_0xd63e,0x1a7));var _0xed63=function(_0x3132ea,_0x1c0e36){_0x3132ea=_0x3132ea-0x0;var _0x279bef=_0xd63e[_0x3132ea];return _0x279bef;};'use strict';var Sequelize=require(_0xed63('0x0'));module[_0xed63('0x1')]={'name':{'type':Sequelize[_0xed63('0x2')],'unique':_0xed63('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xed63('0x2')]},'timeout':{'type':Sequelize[_0xed63('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xed63('0x5'),_0xed63('0x6'),_0xed63('0x7'))}}; \ No newline at end of file +var _0xf991=['sequelize','exports','STRING','name','INTEGER','ENUM','beepall'];(function(_0x3ed4ed,_0x3fd6bd){var _0x20b6da=function(_0x26f4dd){while(--_0x26f4dd){_0x3ed4ed['push'](_0x3ed4ed['shift']());}};_0x20b6da(++_0x3fd6bd);}(_0xf991,0xcb));var _0x1f99=function(_0x2d4a54,_0x1f759f){_0x2d4a54=_0x2d4a54-0x0;var _0x489a0f=_0xf991[_0x2d4a54];return _0x489a0f;};'use strict';var Sequelize=require(_0x1f99('0x0'));module[_0x1f99('0x1')]={'name':{'type':Sequelize[_0x1f99('0x2')],'unique':_0x1f99('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x1f99('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1f99('0x5')]('rrmemory',_0x1f99('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 73be01c..f2c409c 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 _0x7784=['include','findAll','rows','show','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','UserProfileSection','userProfileId','autoAssociation','catch','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','omit','isArray','getAgents','rimraf','fast-json-patch','request-promise','moment','mustache','util','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./smsQueue.socket','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','SmsQueue','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0xf39b93,_0x2f7ad3){var _0x4c8c6a=function(_0xef89b){while(--_0xef89b){_0xf39b93['push'](_0xf39b93['shift']());}};_0x4c8c6a(++_0x2f7ad3);}(_0x7784,0xd4));var _0x4778=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x7784[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4778('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4778('0x1'));var rp=require(_0x4778('0x2'));var moment=require(_0x4778('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4778('0x4'));var util=require(_0x4778('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('fs-extra');var _=require(_0x4778('0x6'));var squel=require(_0x4778('0x7'));var crypto=require(_0x4778('0x8'));var jsforce=require(_0x4778('0x9'));var deskjs=require(_0x4778('0xa'));var toCsv=require(_0x4778('0xb'));var querystring=require('querystring');var Papa=require(_0x4778('0xc'));var Redis=require(_0x4778('0xd'));var authService=require(_0x4778('0xe'));var qs=require(_0x4778('0xf'));var as=require(_0x4778('0x10'));var hardwareService=require(_0x4778('0x11'));var logger=require(_0x4778('0x12'))(_0x4778('0x13'));var utils=require(_0x4778('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4778('0x15'));var db=require(_0x4778('0x16'))['db'];config[_0x4778('0x17')]=_[_0x4778('0x18')](config[_0x4778('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4778('0x17')]));require(_0x4778('0x19'))['register'](socket);function respondWithStatusCode(_0xa3a71e,_0x34db6c){_0x34db6c=_0x34db6c||0xcc;return function(_0x368830){if(_0x368830){return _0xa3a71e['sendStatus'](_0x34db6c);}return _0xa3a71e[_0x4778('0x1a')](_0x34db6c)['end']();};}function respondWithResult(_0x58c3d0,_0x85dc45){_0x85dc45=_0x85dc45||0xc8;return function(_0x5dc71b){if(_0x5dc71b){return _0x58c3d0[_0x4778('0x1a')](_0x85dc45)[_0x4778('0x1b')](_0x5dc71b);}};}function respondWithFilteredResult(_0x285daa,_0x1eb127){return function(_0x2c651d){if(_0x2c651d){var _0x15c3a0=typeof _0x1eb127[_0x4778('0x1c')]===_0x4778('0x1d')&&typeof _0x1eb127[_0x4778('0x1e')]===_0x4778('0x1d');var _0x19a70d=_0x2c651d[_0x4778('0x1f')];var _0x5d392b=_0x15c3a0?0x0:_0x1eb127[_0x4778('0x1c')];var _0x23f049=_0x15c3a0?_0x2c651d[_0x4778('0x1f')]:_0x1eb127['offset']+_0x1eb127[_0x4778('0x1e')];var _0x1c7c3d;if(_0x23f049>=_0x19a70d){_0x23f049=_0x19a70d;_0x1c7c3d=0xc8;}else{_0x1c7c3d=0xce;}_0x285daa[_0x4778('0x1a')](_0x1c7c3d);return _0x285daa[_0x4778('0x20')]('Content-Range',_0x5d392b+'-'+_0x23f049+'/'+_0x19a70d)['json'](_0x2c651d);}return null;};}function patchUpdates(_0x70d3ee){return function(_0x5942e7){try{jsonpatch['apply'](_0x5942e7,_0x70d3ee,!![]);}catch(_0x125d70){return BPromise[_0x4778('0x21')](_0x125d70);}return _0x5942e7[_0x4778('0x22')]();};}function saveUpdates(_0x1e9dda,_0x39c741){return function(_0x1172b9){if(_0x1172b9){return _0x1172b9[_0x4778('0x23')](_0x1e9dda)['then'](function(_0x26b65d){return _0x26b65d;});}return null;};}function removeEntity(_0x4fa715,_0x43e03b){return function(_0x17f5db){if(_0x17f5db){return _0x17f5db[_0x4778('0x24')]()[_0x4778('0x25')](function(){var _0x4e67f8=_0x17f5db[_0x4778('0x26')]({'plain':!![]});var _0x3cc366='SmsQueues';return db[_0x4778('0x27')][_0x4778('0x24')]({'where':{'type':_0x3cc366,'resourceId':_0x4e67f8['id']}})[_0x4778('0x25')](function(){return _0x17f5db;});})[_0x4778('0x25')](function(){_0x4fa715[_0x4778('0x1a')](0xcc)[_0x4778('0x28')]();});}};}function handleEntityNotFound(_0x1ef781,_0x5d6083){return function(_0x2a522f){if(!_0x2a522f){_0x1ef781[_0x4778('0x29')](0x194);}return _0x2a522f;};}function handleError(_0x354235,_0x119199){_0x119199=_0x119199||0x1f4;return function(_0x3f775a){logger[_0x4778('0x2a')](_0x3f775a[_0x4778('0x2b')]);if(_0x3f775a[_0x4778('0x2c')]){delete _0x3f775a[_0x4778('0x2c')];}_0x354235['status'](_0x119199)[_0x4778('0x2d')](_0x3f775a);};}exports[_0x4778('0x2e')]=function(_0x286e6f,_0x422421){var _0x48b96b={},_0x82a917={},_0x3e94f5={'count':0x0,'rows':[]};var _0x1973ee=_['map'](db[_0x4778('0x2f')]['rawAttributes'],function(_0x5c48a0){return{'name':_0x5c48a0['fieldName'],'type':_0x5c48a0[_0x4778('0x30')][_0x4778('0x31')]};});_0x82a917[_0x4778('0x32')]=_[_0x4778('0x33')](_0x1973ee,_0x4778('0x2c'));_0x82a917[_0x4778('0x34')]=_[_0x4778('0x35')](_0x286e6f[_0x4778('0x34')]);_0x82a917[_0x4778('0x36')]=_[_0x4778('0x37')](_0x82a917[_0x4778('0x32')],_0x82a917['query']);_0x48b96b[_0x4778('0x38')]=_[_0x4778('0x37')](_0x82a917['model'],qs[_0x4778('0x39')](_0x286e6f['query'][_0x4778('0x39')]));_0x48b96b[_0x4778('0x38')]=_0x48b96b[_0x4778('0x38')][_0x4778('0x3a')]?_0x48b96b[_0x4778('0x38')]:_0x82a917[_0x4778('0x32')];if(!_0x286e6f[_0x4778('0x34')][_0x4778('0x3b')](_0x4778('0x3c'))){_0x48b96b[_0x4778('0x1e')]=qs[_0x4778('0x1e')](_0x286e6f['query'][_0x4778('0x1e')]);_0x48b96b[_0x4778('0x1c')]=qs[_0x4778('0x1c')](_0x286e6f[_0x4778('0x34')][_0x4778('0x1c')]);}_0x48b96b[_0x4778('0x3d')]=qs[_0x4778('0x3e')](_0x286e6f[_0x4778('0x34')][_0x4778('0x3e')]);_0x48b96b['where']=qs[_0x4778('0x36')](_[_0x4778('0x3f')](_0x286e6f[_0x4778('0x34')],_0x82a917[_0x4778('0x36')]),_0x1973ee);if(_0x286e6f[_0x4778('0x34')][_0x4778('0x40')]){_0x48b96b[_0x4778('0x41')]=_[_0x4778('0x42')](_0x48b96b['where'],{'$or':_[_0x4778('0x33')](_0x1973ee,function(_0x18bfeb){if(_0x18bfeb['type']!==_0x4778('0x43')){var _0x3c2ca9={};_0x3c2ca9[_0x18bfeb['name']]={'$like':'%'+_0x286e6f[_0x4778('0x34')][_0x4778('0x40')]+'%'};return _0x3c2ca9;}})});}_0x48b96b=_[_0x4778('0x42')]({},_0x48b96b,_0x286e6f['options']);var _0x442ce8={'where':_0x48b96b['where']};return db[_0x4778('0x2f')][_0x4778('0x1f')](_0x442ce8)[_0x4778('0x25')](function(_0x408426){_0x3e94f5['count']=_0x408426;if(_0x286e6f[_0x4778('0x34')]['includeAll']){_0x48b96b[_0x4778('0x44')]=[{'all':!![]}];}return db['SmsQueue'][_0x4778('0x45')](_0x48b96b);})[_0x4778('0x25')](function(_0x4ddf37){_0x3e94f5[_0x4778('0x46')]=_0x4ddf37;return _0x3e94f5;})[_0x4778('0x25')](respondWithFilteredResult(_0x422421,_0x48b96b))['catch'](handleError(_0x422421,null));};exports[_0x4778('0x47')]=function(_0x42a5bc,_0x255bc5){var _0x2beb64={'raw':!![],'where':{'id':_0x42a5bc['params']['id']}},_0x5a5372={};_0x5a5372['model']=_[_0x4778('0x35')](db[_0x4778('0x2f')]['rawAttributes']);_0x5a5372[_0x4778('0x34')]=_[_0x4778('0x35')](_0x42a5bc[_0x4778('0x34')]);_0x5a5372['filters']=_[_0x4778('0x37')](_0x5a5372[_0x4778('0x32')],_0x5a5372['query']);_0x2beb64[_0x4778('0x38')]=_[_0x4778('0x37')](_0x5a5372[_0x4778('0x32')],qs[_0x4778('0x39')](_0x42a5bc[_0x4778('0x34')][_0x4778('0x39')]));_0x2beb64['attributes']=_0x2beb64[_0x4778('0x38')][_0x4778('0x3a')]?_0x2beb64[_0x4778('0x38')]:_0x5a5372[_0x4778('0x32')];if(_0x42a5bc[_0x4778('0x34')][_0x4778('0x48')]){_0x2beb64['include']=[{'all':!![]}];}_0x2beb64=_[_0x4778('0x42')]({},_0x2beb64,_0x42a5bc[_0x4778('0x49')]);return db['SmsQueue'][_0x4778('0x4a')](_0x2beb64)['then'](handleEntityNotFound(_0x255bc5,null))[_0x4778('0x25')](respondWithResult(_0x255bc5,null))['catch'](handleError(_0x255bc5,null));};exports[_0x4778('0x4b')]=function(_0x89d4f5,_0x56b193){return db[_0x4778('0x2f')][_0x4778('0x4b')](_0x89d4f5[_0x4778('0x4c')],{})[_0x4778('0x25')](function(_0x21aae4){var _0x1e77fd=_0x89d4f5[_0x4778('0x4d')][_0x4778('0x26')]({'plain':!![]});if(!_0x1e77fd)throw new Error(_0x4778('0x4e'));if(_0x1e77fd['role']===_0x4778('0x4d')){var _0x5c744a=_0x21aae4['get']({'plain':!![]});var _0x375fec=_0x4778('0x4f');return db[_0x4778('0x50')][_0x4778('0x4a')]({'where':{'name':_0x375fec,'userProfileId':_0x1e77fd[_0x4778('0x51')]},'raw':!![]})['then'](function(_0x5924cf){if(_0x5924cf&&_0x5924cf[_0x4778('0x52')]===0x0){return db[_0x4778('0x27')][_0x4778('0x4b')]({'name':_0x5c744a['name'],'resourceId':_0x5c744a['id'],'type':_0x5924cf['name'],'sectionId':_0x5924cf['id']},{})[_0x4778('0x25')](function(){return _0x21aae4;});}else{return _0x21aae4;}})[_0x4778('0x53')](function(_0x3f1336){logger[_0x4778('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f1336);throw _0x3f1336;});}return _0x21aae4;})[_0x4778('0x25')](respondWithResult(_0x56b193,0xc9))['catch'](handleError(_0x56b193,null));};exports[_0x4778('0x23')]=function(_0x252d96,_0xb0d10e){if(_0x252d96['body']['id']){delete _0x252d96[_0x4778('0x4c')]['id'];}return db[_0x4778('0x2f')]['find']({'where':{'id':_0x252d96[_0x4778('0x54')]['id']}})['then'](handleEntityNotFound(_0xb0d10e,null))[_0x4778('0x25')](saveUpdates(_0x252d96['body'],null))[_0x4778('0x25')](respondWithResult(_0xb0d10e,null))[_0x4778('0x53')](handleError(_0xb0d10e,null));};exports[_0x4778('0x24')]=function(_0x44a0b6,_0x1172ea){return db[_0x4778('0x2f')][_0x4778('0x4a')]({'where':{'id':_0x44a0b6[_0x4778('0x54')]['id']}})[_0x4778('0x25')](handleEntityNotFound(_0x1172ea,null))['then'](removeEntity(_0x1172ea,null))[_0x4778('0x53')](handleError(_0x1172ea,null));};exports[_0x4778('0x55')]=function(_0x338791,_0x235a28){return db['SmsQueue']['describe']()[_0x4778('0x25')](respondWithResult(_0x235a28,null))['catch'](handleError(_0x235a28,null));};exports[_0x4778('0x56')]=function(_0x1cea10,_0x4caffe,_0x3dec13){var _0x54d43a={'raw':!![],'where':{}},_0x57ad85={},_0x511f1d;return db[_0x4778('0x2f')][_0x4778('0x57')]({'where':{'id':_0x1cea10['params']['id']}})[_0x4778('0x25')](handleEntityNotFound(_0x4caffe,null))[_0x4778('0x25')](function(_0x1bab63){if(_0x1bab63){_0x511f1d=_0x1bab63['get']({'plain':!![]});_0x57ad85['model']=_[_0x4778('0x35')](db[_0x4778('0x58')][_0x4778('0x59')]);_0x57ad85[_0x4778('0x34')]=_['keys'](_0x1cea10[_0x4778('0x34')]);_0x57ad85[_0x4778('0x36')]=_['intersection'](_0x57ad85[_0x4778('0x32')],_0x57ad85[_0x4778('0x34')]);_0x54d43a['attributes']=_[_0x4778('0x37')](_0x57ad85[_0x4778('0x32')],qs[_0x4778('0x39')](_0x1cea10[_0x4778('0x34')][_0x4778('0x39')]));_0x54d43a[_0x4778('0x38')]=_0x54d43a[_0x4778('0x38')][_0x4778('0x3a')]?_0x54d43a[_0x4778('0x38')]:_0x57ad85['model'];if(!_0x1cea10[_0x4778('0x34')]['hasOwnProperty'](_0x4778('0x3c'))){_0x54d43a[_0x4778('0x1e')]=qs[_0x4778('0x1e')](_0x1cea10[_0x4778('0x34')][_0x4778('0x1e')]);_0x54d43a[_0x4778('0x1c')]=qs[_0x4778('0x1c')](_0x1cea10['query'][_0x4778('0x1c')]);}_0x54d43a[_0x4778('0x3d')]=qs['sort'](_0x1cea10[_0x4778('0x34')]['sort']);_0x54d43a[_0x4778('0x41')]=qs['filters'](_[_0x4778('0x3f')](_0x1cea10['query'],_0x57ad85[_0x4778('0x36')]));_0x54d43a[_0x4778('0x41')][_0x4778('0x5a')]=_0x1bab63['id'];if(_0x1cea10['query']['filter']){_0x54d43a[_0x4778('0x41')]=_[_0x4778('0x42')](_0x54d43a['where'],{'$or':_[_0x4778('0x33')](_0x54d43a['attributes'],function(_0x256354){var _0x26a438={};_0x26a438[_0x256354]={'$like':'%'+_0x1cea10[_0x4778('0x34')][_0x4778('0x40')]+'%'};return _0x26a438;})});}_0x54d43a=_[_0x4778('0x42')]({},_0x54d43a,_0x1cea10[_0x4778('0x49')]);return db['UserSmsQueue'][_0x4778('0x45')](_0x54d43a);}})[_0x4778('0x25')](function(_0x1874b6){if(_0x1874b6){return db[_0x4778('0x5b')][_0x4778('0x5c')]({'where':{'id':_['map'](_0x1874b6,_0x4778('0x5d')),'role':_0x4778('0x5e')},'attributes':['id',_0x4778('0x2c'),_0x4778('0x5f'),_0x4778('0x60'),'createdAt']});}})[_0x4778('0x25')](function(_0x3db0b3){if(_0x3db0b3){return{'count':_0x3db0b3[_0x4778('0x1f')],'rows':_[_0x4778('0x33')](_0x3db0b3[_0x4778('0x46')],function(_0xfcc350){return{'membername':_0xfcc350[_0x4778('0x2c')],'UserId':_0xfcc350['id'],'queue_name':_0x511f1d[_0x4778('0x2c')],'SmsQueueId':_0x511f1d['id'],'interface':util[_0x4778('0x61')](_0x4778('0x62'),_0x4778('0x63'),_0xfcc350['name']),'penalty':0x0,'paused':_0xfcc350[_0x4778('0x5f')],'createdAt':_0xfcc350['createdAt'],'updatedAt':_0xfcc350['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x4778('0x25')](respondWithFilteredResult(_0x4caffe,_0x54d43a))[_0x4778('0x53')](handleError(_0x4caffe,null));};exports[_0x4778('0x64')]=function(_0x3f6227,_0x14e2ba,_0x35acc7){var _0x5ac847={};var _0x5df9a0={};var _0x393ee1;var _0x1088db;return db[_0x4778('0x2f')][_0x4778('0x57')]({'where':{'id':_0x3f6227['params']['id']}})[_0x4778('0x25')](handleEntityNotFound(_0x14e2ba,null))[_0x4778('0x25')](function(_0x29b3e4){if(_0x29b3e4){_0x393ee1=_0x29b3e4;_0x5df9a0[_0x4778('0x32')]=_['keys'](db[_0x4778('0x65')]['rawAttributes']);_0x5df9a0[_0x4778('0x34')]=_[_0x4778('0x35')](_0x3f6227[_0x4778('0x34')]);_0x5df9a0['filters']=_['intersection'](_0x5df9a0[_0x4778('0x32')],_0x5df9a0['query']);_0x5ac847[_0x4778('0x38')]=_[_0x4778('0x37')](_0x5df9a0[_0x4778('0x32')],qs[_0x4778('0x39')](_0x3f6227[_0x4778('0x34')]['fields']));_0x5ac847[_0x4778('0x38')]=_0x5ac847['attributes'][_0x4778('0x3a')]?_0x5ac847['attributes']:_0x5df9a0['model'];_0x5ac847[_0x4778('0x3d')]=qs[_0x4778('0x3e')](_0x3f6227[_0x4778('0x34')][_0x4778('0x3e')]);_0x5ac847[_0x4778('0x41')]=qs['filters'](_['pick'](_0x3f6227[_0x4778('0x34')],_0x5df9a0[_0x4778('0x36')]));if(_0x3f6227[_0x4778('0x34')][_0x4778('0x40')]){_0x5ac847['where']=_[_0x4778('0x42')](_0x5ac847[_0x4778('0x41')],{'$or':_[_0x4778('0x33')](_0x5ac847[_0x4778('0x38')],function(_0xf1a876){var _0x3e3591={};_0x3e3591[_0xf1a876]={'$like':'%'+_0x3f6227['query'][_0x4778('0x40')]+'%'};return _0x3e3591;})});}_0x5ac847=_['merge']({},_0x5ac847,_0x3f6227['options']);return _0x393ee1[_0x4778('0x64')](_0x5ac847);}})[_0x4778('0x25')](function(_0xf546b2){if(_0xf546b2){_0x1088db=_0xf546b2[_0x4778('0x3a')];if(!_0x3f6227[_0x4778('0x34')]['hasOwnProperty'](_0x4778('0x3c'))){_0x5ac847[_0x4778('0x1e')]=qs[_0x4778('0x1e')](_0x3f6227[_0x4778('0x34')]['limit']);_0x5ac847[_0x4778('0x1c')]=qs[_0x4778('0x1c')](_0x3f6227[_0x4778('0x34')][_0x4778('0x1c')]);}return _0x393ee1['getTeams'](_0x5ac847);}})['then'](function(_0x243096){if(_0x243096){return _0x243096?{'count':_0x1088db,'rows':_0x243096}:null;}})['then'](respondWithResult(_0x14e2ba,null))['catch'](handleError(_0x14e2ba,null));};exports[_0x4778('0x66')]=function(_0x37c0e,_0x584502,_0x30dcf1){var _0x3ae1d6=_0x37c0e[_0x4778('0x4c')][_0x4778('0x67')];return db[_0x4778('0x65')][_0x4778('0x45')]({'where':{'id':_0x3ae1d6},'attributes':['id'],'include':[{'model':db[_0x4778('0x5b')],'as':_0x4778('0x68'),'attributes':['id','name',_0x4778('0x69'),_0x4778('0x6a'),_0x4778('0x6b')],'raw':!![]}]})[_0x4778('0x25')](function(_0x1b8bad){if(_0x1b8bad){var _0x212b18=_[_0x4778('0x6c')](_0x1b8bad,function(_0x5c242f){var _0x56456a=_0x5c242f[_0x4778('0x26')]({'plain':!![]});return _0x56456a[_0x4778('0x68')];});return db[_0x4778('0x2f')][_0x4778('0x4a')]({'where':{'id':_0x37c0e['params']['id']}})[_0x4778('0x25')](function(_0x204b02){return db[_0x4778('0x6d')][_0x4778('0x6e')](function(_0x427819){return _0x204b02[_0x4778('0x66')](_0x3ae1d6,{'transaction':_0x427819})['then'](function(){return BPromise[_0x4778('0x6f')](_0x212b18,function(_0x22b11d){return db[_0x4778('0x58')][_0x4778('0x70')]({'where':{'UserId':_0x22b11d['id'],'SmsQueueId':_0x37c0e[_0x4778('0x54')]['id']},'transaction':_0x427819});});})[_0x4778('0x25')](function(){_0x212b18[_0x4778('0x71')](function(_0x213aba){socket[_0x4778('0x72')](_0x4778('0x73'),{'UserId':_0x213aba['id'],'SmsQueueId':_0x204b02['id']});});});});});}})[_0x4778('0x25')](respondWithStatusCode(_0x584502,null))[_0x4778('0x53')](handleError(_0x584502,null));};exports[_0x4778('0x74')]=function(_0x50278b,_0x288e08,_0x13e70b){return db['Team']['findAll']({'where':{'id':_0x50278b[_0x4778('0x34')][_0x4778('0x67')]},'attributes':['id'],'include':[{'model':db[_0x4778('0x5b')],'as':_0x4778('0x68'),'attributes':['id'],'raw':!![]}]})[_0x4778('0x25')](handleEntityNotFound(_0x288e08,null))[_0x4778('0x25')](function(_0x5c5282){var _0x3f2a25=_[_0x4778('0x33')](_0x5c5282,'id');var _0x1d84a7=[];var _0x4e6b0d=[];var _0x147e19=squel[_0x4778('0x75')]();_0x147e19['field'](_0x4778('0x76'))[_0x4778('0x77')](_0x4778('0x78'),'tq')[_0x4778('0x79')]('user_has_teams','ut',_0x4778('0x7a'))['where'](_0x4778('0x7b'),_0x50278b[_0x4778('0x54')]['id']);for(var _0x37b3eb=0x0;_0x37b3eb<_0x5c5282[_0x4778('0x3a')];_0x37b3eb+=0x1){let _0x1ba2c0=_0x5c5282[_0x37b3eb];for(var _0x55bf25=0x0;_0x55bf25<_0x1ba2c0[_0x4778('0x68')][_0x4778('0x3a')];_0x55bf25+=0x1){let _0x72c944=_0x1ba2c0[_0x4778('0x68')][_0x55bf25];var _0x5b315d=_0x147e19[_0x4778('0x7c')]();_0x5b315d['where'](_0x4778('0x7d'),_0x72c944['id']);_0x4e6b0d[_0x4778('0x7e')](db[_0x4778('0x6d')][_0x4778('0x34')](_0x5b315d[_0x4778('0x7f')](),{'type':db['sequelize']['QueryTypes'][_0x4778('0x80')]})[_0x4778('0x25')](function(_0x3f73fb){if(_0x3f73fb[_0x4778('0x3a')]===0x1){return _0x72c944['id'];}else{var _0x2ed60d=_[_0x4778('0x81')](_[_0x4778('0x33')](_0x3f73fb,'TeamId'),function(_0x1edc9c){return _['includes'](_0x3f2a25,_0x1edc9c);});if(_0x2ed60d){return _0x72c944['id'];}}}));}}return BPromise[_0x4778('0x82')](_0x4e6b0d)['then'](function(_0xc4dfbb){_0x1d84a7=_(_0x1d84a7)[_0x4778('0x83')](_0xc4dfbb)[_0x4778('0x84')]()[_0x4778('0x85')]();return db[_0x4778('0x2f')]['find']({'where':{'id':_0x50278b[_0x4778('0x54')]['id']}})[_0x4778('0x25')](function(_0x141f3e){return db[_0x4778('0x6d')][_0x4778('0x6e')](function(_0xdc47f0){return _0x141f3e['removeTeams'](_0x50278b['query'][_0x4778('0x67')],{'transaction':_0xdc47f0})[_0x4778('0x25')](function(){if(!_[_0x4778('0x86')](_0x1d84a7)){return _0x141f3e[_0x4778('0x87')](_0x1d84a7,{'transaction':_0xdc47f0});}})[_0x4778('0x25')](function(){_0x1d84a7[_0x4778('0x71')](function(_0x1a963e){socket[_0x4778('0x72')](_0x4778('0x88'),{'UserId':_0x1a963e,'SmsQueueId':_0x141f3e['id']});});});});});});})['then'](respondWithStatusCode(_0x288e08,null))[_0x4778('0x53')](handleError(_0x288e08,null));};exports['addAgents']=function(_0x790c3f,_0x292e09,_0x21f3e3){return db['SmsQueue'][_0x4778('0x4a')]({'where':{'id':_0x790c3f[_0x4778('0x54')]['id']}})['then'](handleEntityNotFound(_0x292e09,null))[_0x4778('0x25')](function(_0x29cde6){if(_0x29cde6){return _0x29cde6['addAgents'](_0x790c3f[_0x4778('0x4c')][_0x4778('0x67')],_[_0x4778('0x89')](_0x790c3f[_0x4778('0x4c')],['ids','id'])||{})['spread'](function(_0x548272){for(var _0x488e1c=0x0;_0x488e1c<_0x790c3f[_0x4778('0x4c')]['ids'][_0x4778('0x3a')];_0x488e1c+=0x1){socket[_0x4778('0x72')](_0x4778('0x73'),{'UserId':Number(_0x790c3f['body'][_0x4778('0x67')][_0x488e1c]),'SmsQueueId':Number(_0x790c3f[_0x4778('0x54')]['id'])});}return _0x548272;});}})[_0x4778('0x25')](respondWithResult(_0x292e09,null))[_0x4778('0x53')](handleError(_0x292e09,null));};exports[_0x4778('0x87')]=function(_0x367ff8,_0x3cf6ce,_0x371224){return db[_0x4778('0x2f')]['find']({'where':{'id':_0x367ff8[_0x4778('0x54')]['id']}})[_0x4778('0x25')](handleEntityNotFound(_0x3cf6ce,null))[_0x4778('0x25')](function(_0x4190ca){if(_0x4190ca){return _0x4190ca['removeAgents'](_0x367ff8[_0x4778('0x34')][_0x4778('0x67')])['then'](function(){if(_[_0x4778('0x8a')](_0x367ff8['query'][_0x4778('0x67')])){for(var _0x3ab23a=0x0;_0x3ab23a<_0x367ff8['query'][_0x4778('0x67')]['length'];_0x3ab23a+=0x1){socket[_0x4778('0x72')](_0x4778('0x88'),{'UserId':Number(_0x367ff8[_0x4778('0x34')]['ids'][_0x3ab23a]),'SmsQueueId':Number(_0x367ff8[_0x4778('0x54')]['id'])});}}else{socket[_0x4778('0x72')]('userSmsQueue:remove',{'UserId':Number(_0x367ff8[_0x4778('0x34')]['ids']),'SmsQueueId':Number(_0x367ff8[_0x4778('0x54')]['id'])});}});}})[_0x4778('0x25')](respondWithStatusCode(_0x3cf6ce,null))[_0x4778('0x53')](handleError(_0x3cf6ce,null));};exports['getAgents']=function(_0xae9eaf,_0x30f176,_0x394640){var _0x77f822={};var _0x3376b0={};var _0x4c0c7c;var _0x8452ea;return db[_0x4778('0x2f')][_0x4778('0x57')]({'where':{'id':_0xae9eaf['params']['id']}})[_0x4778('0x25')](handleEntityNotFound(_0x30f176,null))[_0x4778('0x25')](function(_0x9fbbc9){if(_0x9fbbc9){_0x4c0c7c=_0x9fbbc9;_0x3376b0[_0x4778('0x32')]=_['keys'](db[_0x4778('0x5b')]['rawAttributes']);_0x3376b0['query']=_[_0x4778('0x35')](_0xae9eaf['query']);_0x3376b0['filters']=_[_0x4778('0x37')](_0x3376b0['model'],_0x3376b0[_0x4778('0x34')]);_0x77f822[_0x4778('0x38')]=_['intersection'](_0x3376b0['model'],qs[_0x4778('0x39')](_0xae9eaf[_0x4778('0x34')][_0x4778('0x39')]));_0x77f822[_0x4778('0x38')]=_0x77f822[_0x4778('0x38')]['length']?_0x77f822[_0x4778('0x38')]:_0x3376b0[_0x4778('0x32')];_0x77f822[_0x4778('0x3d')]=qs['sort'](_0xae9eaf[_0x4778('0x34')]['sort']);_0x77f822[_0x4778('0x41')]=qs[_0x4778('0x36')](_[_0x4778('0x3f')](_0xae9eaf[_0x4778('0x34')],_0x3376b0[_0x4778('0x36')]));if(_0xae9eaf[_0x4778('0x34')]['filter']){_0x77f822['where']=_[_0x4778('0x42')](_0x77f822[_0x4778('0x41')],{'$or':_[_0x4778('0x33')](_0x77f822['attributes'],function(_0x69b43f){var _0x1bf9cc={};_0x1bf9cc[_0x69b43f]={'$like':'%'+_0xae9eaf['query']['filter']+'%'};return _0x1bf9cc;})});}_0x77f822=_[_0x4778('0x42')]({},_0x77f822,_0xae9eaf['options']);return _0x4c0c7c[_0x4778('0x8b')](_0x77f822);}})[_0x4778('0x25')](function(_0x532827){if(_0x532827){_0x8452ea=_0x532827[_0x4778('0x3a')];if(!_0xae9eaf[_0x4778('0x34')][_0x4778('0x3b')](_0x4778('0x3c'))){_0x77f822[_0x4778('0x1e')]=qs[_0x4778('0x1e')](_0xae9eaf[_0x4778('0x34')][_0x4778('0x1e')]);_0x77f822[_0x4778('0x1c')]=qs['offset'](_0xae9eaf[_0x4778('0x34')][_0x4778('0x1c')]);}return _0x4c0c7c['getAgents'](_0x77f822);}})[_0x4778('0x25')](function(_0x414aa7){if(_0x414aa7){return _0x414aa7?{'count':_0x8452ea,'rows':_0x414aa7}:null;}})['then'](respondWithResult(_0x30f176,null))[_0x4778('0x53')](handleError(_0x30f176,null));}; \ No newline at end of file +var _0x261b=['zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./smsQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','stack','send','index','map','SmsQueue','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','name','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsQueues','UserProfileSection','userProfileId','autoAssociation','error','params','describe','getMembers','findOne','rawAttributes','order','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','Team','nolimit','addTeams','ids','Agents','online','voicePause','sequelize','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','transaction','removeAgents','addAgents','omit','spread','userSmsQueue:save','isArray','userSmsQueue:remove','getAgents','eml-format','rimraf'];(function(_0x2d5382,_0x27eed3){var _0x1c6160=function(_0xb4387b){while(--_0xb4387b){_0x2d5382['push'](_0x2d5382['shift']());}};_0x1c6160(++_0x27eed3);}(_0x261b,0x93));var _0xb261=function(_0x485e61,_0x31c653){_0x485e61=_0x485e61-0x0;var _0x27882f=_0x261b[_0x485e61];return _0x27882f;};'use strict';var emlformat=require(_0xb261('0x0'));var rimraf=require(_0xb261('0x1'));var zipdir=require(_0xb261('0x2'));var jsonpatch=require(_0xb261('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb261('0x4'));var Mustache=require(_0xb261('0x5'));var util=require(_0xb261('0x6'));var path=require(_0xb261('0x7'));var sox=require(_0xb261('0x8'));var csv=require(_0xb261('0x9'));var ejs=require(_0xb261('0xa'));var fs=require('fs');var fs_extra=require(_0xb261('0xb'));var _=require('lodash');var squel=require(_0xb261('0xc'));var crypto=require(_0xb261('0xd'));var jsforce=require(_0xb261('0xe'));var deskjs=require(_0xb261('0xf'));var toCsv=require(_0xb261('0x9'));var querystring=require(_0xb261('0x10'));var Papa=require(_0xb261('0x11'));var Redis=require(_0xb261('0x12'));var authService=require(_0xb261('0x13'));var qs=require(_0xb261('0x14'));var as=require(_0xb261('0x15'));var hardwareService=require(_0xb261('0x16'));var logger=require(_0xb261('0x17'))(_0xb261('0x18'));var utils=require(_0xb261('0x19'));var config=require(_0xb261('0x1a'));var licenseUtil=require(_0xb261('0x1b'));var db=require(_0xb261('0x1c'))['db'];config['redis']=_[_0xb261('0x1d')](config[_0xb261('0x1e')],{'host':_0xb261('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb261('0x20'))['register'](socket);function respondWithStatusCode(_0x30cfa9,_0x3e19c2){_0x3e19c2=_0x3e19c2||0xcc;return function(_0x3ca2ba){if(_0x3ca2ba){return _0x30cfa9[_0xb261('0x21')](_0x3e19c2);}return _0x30cfa9[_0xb261('0x22')](_0x3e19c2)[_0xb261('0x23')]();};}function respondWithResult(_0x3f2982,_0x178171){_0x178171=_0x178171||0xc8;return function(_0x41f1bd){if(_0x41f1bd){return _0x3f2982[_0xb261('0x22')](_0x178171)[_0xb261('0x24')](_0x41f1bd);}};}function respondWithFilteredResult(_0x23f97a,_0x43b85b){return function(_0x268ded){if(_0x268ded){var _0x2c7fb0=typeof _0x43b85b[_0xb261('0x25')]===_0xb261('0x26')&&typeof _0x43b85b['limit']==='undefined';var _0x1d4ad7=_0x268ded[_0xb261('0x27')];var _0x27031c=_0x2c7fb0?0x0:_0x43b85b['offset'];var _0x55187a=_0x2c7fb0?_0x268ded[_0xb261('0x27')]:_0x43b85b[_0xb261('0x25')]+_0x43b85b[_0xb261('0x28')];var _0x126ea9;if(_0x55187a>=_0x1d4ad7){_0x55187a=_0x1d4ad7;_0x126ea9=0xc8;}else{_0x126ea9=0xce;}_0x23f97a[_0xb261('0x22')](_0x126ea9);return _0x23f97a[_0xb261('0x29')](_0xb261('0x2a'),_0x27031c+'-'+_0x55187a+'/'+_0x1d4ad7)[_0xb261('0x24')](_0x268ded);}return null;};}function patchUpdates(_0x2cd3e1){return function(_0x3a0056){try{jsonpatch[_0xb261('0x2b')](_0x3a0056,_0x2cd3e1,!![]);}catch(_0x4b7af7){return BPromise['reject'](_0x4b7af7);}return _0x3a0056[_0xb261('0x2c')]();};}function saveUpdates(_0x4571cd,_0x4f992e){return function(_0x3b6f96){if(_0x3b6f96){return _0x3b6f96[_0xb261('0x2d')](_0x4571cd)[_0xb261('0x2e')](function(_0x4ef7e2){return _0x4ef7e2;});}return null;};}function removeEntity(_0x3f9d6c,_0x3d61d1){return function(_0x4fdf88){if(_0x4fdf88){return _0x4fdf88[_0xb261('0x2f')]()[_0xb261('0x2e')](function(){var _0x3a4c81=_0x4fdf88['get']({'plain':!![]});var _0x3cb91f='SmsQueues';return db[_0xb261('0x30')][_0xb261('0x2f')]({'where':{'type':_0x3cb91f,'resourceId':_0x3a4c81['id']}})[_0xb261('0x2e')](function(){return _0x4fdf88;});})[_0xb261('0x2e')](function(){_0x3f9d6c[_0xb261('0x22')](0xcc)[_0xb261('0x23')]();});}};}function handleEntityNotFound(_0x56a6f6,_0x389738){return function(_0xca6484){if(!_0xca6484){_0x56a6f6['sendStatus'](0x194);}return _0xca6484;};}function handleError(_0x1fa05e,_0x4830a1){_0x4830a1=_0x4830a1||0x1f4;return function(_0x420f6e){logger['error'](_0x420f6e[_0xb261('0x31')]);if(_0x420f6e['name']){delete _0x420f6e['name'];}_0x1fa05e[_0xb261('0x22')](_0x4830a1)[_0xb261('0x32')](_0x420f6e);};}exports[_0xb261('0x33')]=function(_0x21f673,_0x709e82){var _0x461f74={},_0x55538b={},_0x5c5406={'count':0x0,'rows':[]};var _0x6c8c98=_[_0xb261('0x34')](db[_0xb261('0x35')]['rawAttributes'],function(_0x3111ff){return{'name':_0x3111ff['fieldName'],'type':_0x3111ff[_0xb261('0x36')][_0xb261('0x37')]};});_0x55538b[_0xb261('0x38')]=_[_0xb261('0x34')](_0x6c8c98,'name');_0x55538b['query']=_[_0xb261('0x39')](_0x21f673[_0xb261('0x3a')]);_0x55538b[_0xb261('0x3b')]=_[_0xb261('0x3c')](_0x55538b[_0xb261('0x38')],_0x55538b[_0xb261('0x3a')]);_0x461f74[_0xb261('0x3d')]=_['intersection'](_0x55538b[_0xb261('0x38')],qs[_0xb261('0x3e')](_0x21f673[_0xb261('0x3a')]['fields']));_0x461f74['attributes']=_0x461f74[_0xb261('0x3d')][_0xb261('0x3f')]?_0x461f74['attributes']:_0x55538b[_0xb261('0x38')];if(!_0x21f673[_0xb261('0x3a')][_0xb261('0x40')]('nolimit')){_0x461f74[_0xb261('0x28')]=qs[_0xb261('0x28')](_0x21f673['query'][_0xb261('0x28')]);_0x461f74['offset']=qs['offset'](_0x21f673[_0xb261('0x3a')][_0xb261('0x25')]);}_0x461f74['order']=qs[_0xb261('0x41')](_0x21f673[_0xb261('0x3a')][_0xb261('0x41')]);_0x461f74[_0xb261('0x42')]=qs[_0xb261('0x3b')](_[_0xb261('0x43')](_0x21f673['query'],_0x55538b[_0xb261('0x3b')]),_0x6c8c98);if(_0x21f673[_0xb261('0x3a')][_0xb261('0x44')]){_0x461f74[_0xb261('0x42')]=_[_0xb261('0x45')](_0x461f74[_0xb261('0x42')],{'$or':_[_0xb261('0x34')](_0x6c8c98,function(_0x4db0f6){if(_0x4db0f6[_0xb261('0x36')]!=='VIRTUAL'){var _0x159d5f={};_0x159d5f[_0x4db0f6[_0xb261('0x46')]]={'$like':'%'+_0x21f673['query'][_0xb261('0x44')]+'%'};return _0x159d5f;}})});}_0x461f74=_[_0xb261('0x45')]({},_0x461f74,_0x21f673[_0xb261('0x47')]);var _0x36598e={'where':_0x461f74[_0xb261('0x42')]};return db['SmsQueue'][_0xb261('0x27')](_0x36598e)['then'](function(_0x165692){_0x5c5406[_0xb261('0x27')]=_0x165692;if(_0x21f673['query'][_0xb261('0x48')]){_0x461f74[_0xb261('0x49')]=[{'all':!![]}];}return db['SmsQueue'][_0xb261('0x4a')](_0x461f74);})[_0xb261('0x2e')](function(_0xb7a3ab){_0x5c5406[_0xb261('0x4b')]=_0xb7a3ab;return _0x5c5406;})['then'](respondWithFilteredResult(_0x709e82,_0x461f74))[_0xb261('0x4c')](handleError(_0x709e82,null));};exports[_0xb261('0x4d')]=function(_0x4c1dfd,_0x4737c7){var _0xc1f4e1={'raw':!![],'where':{'id':_0x4c1dfd['params']['id']}},_0x3b0b41={};_0x3b0b41[_0xb261('0x38')]=_[_0xb261('0x39')](db['SmsQueue']['rawAttributes']);_0x3b0b41[_0xb261('0x3a')]=_[_0xb261('0x39')](_0x4c1dfd[_0xb261('0x3a')]);_0x3b0b41[_0xb261('0x3b')]=_[_0xb261('0x3c')](_0x3b0b41[_0xb261('0x38')],_0x3b0b41[_0xb261('0x3a')]);_0xc1f4e1[_0xb261('0x3d')]=_[_0xb261('0x3c')](_0x3b0b41[_0xb261('0x38')],qs[_0xb261('0x3e')](_0x4c1dfd[_0xb261('0x3a')][_0xb261('0x3e')]));_0xc1f4e1['attributes']=_0xc1f4e1[_0xb261('0x3d')]['length']?_0xc1f4e1[_0xb261('0x3d')]:_0x3b0b41['model'];if(_0x4c1dfd[_0xb261('0x3a')]['includeAll']){_0xc1f4e1['include']=[{'all':!![]}];}_0xc1f4e1=_[_0xb261('0x45')]({},_0xc1f4e1,_0x4c1dfd[_0xb261('0x47')]);return db[_0xb261('0x35')][_0xb261('0x4e')](_0xc1f4e1)[_0xb261('0x2e')](handleEntityNotFound(_0x4737c7,null))[_0xb261('0x2e')](respondWithResult(_0x4737c7,null))['catch'](handleError(_0x4737c7,null));};exports[_0xb261('0x4f')]=function(_0x4b40a8,_0x287435){return db['SmsQueue'][_0xb261('0x4f')](_0x4b40a8[_0xb261('0x50')],{})['then'](function(_0x58d732){var _0x5a53e2=_0x4b40a8[_0xb261('0x51')][_0xb261('0x52')]({'plain':!![]});if(!_0x5a53e2)throw new Error(_0xb261('0x53'));if(_0x5a53e2['role']===_0xb261('0x51')){var _0x1b3453=_0x58d732[_0xb261('0x52')]({'plain':!![]});var _0x26f811=_0xb261('0x54');return db[_0xb261('0x55')][_0xb261('0x4e')]({'where':{'name':_0x26f811,'userProfileId':_0x5a53e2[_0xb261('0x56')]},'raw':!![]})['then'](function(_0x4f4df8){if(_0x4f4df8&&_0x4f4df8[_0xb261('0x57')]===0x0){return db['UserProfileResource'][_0xb261('0x4f')]({'name':_0x1b3453[_0xb261('0x46')],'resourceId':_0x1b3453['id'],'type':_0x4f4df8[_0xb261('0x46')],'sectionId':_0x4f4df8['id']},{})[_0xb261('0x2e')](function(){return _0x58d732;});}else{return _0x58d732;}})[_0xb261('0x4c')](function(_0x5050c6){logger[_0xb261('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5050c6);throw _0x5050c6;});}return _0x58d732;})[_0xb261('0x2e')](respondWithResult(_0x287435,0xc9))['catch'](handleError(_0x287435,null));};exports['update']=function(_0xa12284,_0x461af8){if(_0xa12284[_0xb261('0x50')]['id']){delete _0xa12284[_0xb261('0x50')]['id'];}return db[_0xb261('0x35')][_0xb261('0x4e')]({'where':{'id':_0xa12284['params']['id']}})[_0xb261('0x2e')](handleEntityNotFound(_0x461af8,null))[_0xb261('0x2e')](saveUpdates(_0xa12284[_0xb261('0x50')],null))[_0xb261('0x2e')](respondWithResult(_0x461af8,null))[_0xb261('0x4c')](handleError(_0x461af8,null));};exports[_0xb261('0x2f')]=function(_0x1ba85d,_0x1c1ec1){return db[_0xb261('0x35')]['find']({'where':{'id':_0x1ba85d[_0xb261('0x59')]['id']}})[_0xb261('0x2e')](handleEntityNotFound(_0x1c1ec1,null))[_0xb261('0x2e')](removeEntity(_0x1c1ec1,null))[_0xb261('0x4c')](handleError(_0x1c1ec1,null));};exports[_0xb261('0x5a')]=function(_0x37eb7d,_0x25152c){return db[_0xb261('0x35')][_0xb261('0x5a')]()[_0xb261('0x2e')](respondWithResult(_0x25152c,null))['catch'](handleError(_0x25152c,null));};exports[_0xb261('0x5b')]=function(_0x3cff48,_0x38e257,_0x40ec7c){var _0x438196={'raw':!![],'where':{}},_0x2d4c40={},_0x2af2b8;return db['SmsQueue'][_0xb261('0x5c')]({'where':{'id':_0x3cff48[_0xb261('0x59')]['id']}})[_0xb261('0x2e')](handleEntityNotFound(_0x38e257,null))['then'](function(_0x2d6df1){if(_0x2d6df1){_0x2af2b8=_0x2d6df1['get']({'plain':!![]});_0x2d4c40[_0xb261('0x38')]=_[_0xb261('0x39')](db['UserSmsQueue'][_0xb261('0x5d')]);_0x2d4c40[_0xb261('0x3a')]=_['keys'](_0x3cff48[_0xb261('0x3a')]);_0x2d4c40['filters']=_[_0xb261('0x3c')](_0x2d4c40['model'],_0x2d4c40[_0xb261('0x3a')]);_0x438196['attributes']=_[_0xb261('0x3c')](_0x2d4c40[_0xb261('0x38')],qs[_0xb261('0x3e')](_0x3cff48[_0xb261('0x3a')][_0xb261('0x3e')]));_0x438196[_0xb261('0x3d')]=_0x438196['attributes'][_0xb261('0x3f')]?_0x438196[_0xb261('0x3d')]:_0x2d4c40[_0xb261('0x38')];if(!_0x3cff48['query'][_0xb261('0x40')]('nolimit')){_0x438196[_0xb261('0x28')]=qs[_0xb261('0x28')](_0x3cff48[_0xb261('0x3a')][_0xb261('0x28')]);_0x438196[_0xb261('0x25')]=qs[_0xb261('0x25')](_0x3cff48['query'][_0xb261('0x25')]);}_0x438196[_0xb261('0x5e')]=qs[_0xb261('0x41')](_0x3cff48[_0xb261('0x3a')][_0xb261('0x41')]);_0x438196[_0xb261('0x42')]=qs[_0xb261('0x3b')](_['pick'](_0x3cff48['query'],_0x2d4c40[_0xb261('0x3b')]));_0x438196[_0xb261('0x42')][_0xb261('0x5f')]=_0x2d6df1['id'];if(_0x3cff48[_0xb261('0x3a')][_0xb261('0x44')]){_0x438196['where']=_[_0xb261('0x45')](_0x438196[_0xb261('0x42')],{'$or':_[_0xb261('0x34')](_0x438196[_0xb261('0x3d')],function(_0x455fee){var _0x582b20={};_0x582b20[_0x455fee]={'$like':'%'+_0x3cff48['query'][_0xb261('0x44')]+'%'};return _0x582b20;})});}_0x438196=_[_0xb261('0x45')]({},_0x438196,_0x3cff48[_0xb261('0x47')]);return db['UserSmsQueue'][_0xb261('0x4a')](_0x438196);}})[_0xb261('0x2e')](function(_0x47fd00){if(_0x47fd00){return db[_0xb261('0x60')][_0xb261('0x61')]({'where':{'id':_[_0xb261('0x34')](_0x47fd00,_0xb261('0x62')),'role':_0xb261('0x63')},'attributes':['id',_0xb261('0x46'),_0xb261('0x64'),'updatedAt',_0xb261('0x65')]});}})[_0xb261('0x2e')](function(_0x1299ec){if(_0x1299ec){return{'count':_0x1299ec['count'],'rows':_[_0xb261('0x34')](_0x1299ec[_0xb261('0x4b')],function(_0x33753b){return{'membername':_0x33753b[_0xb261('0x46')],'UserId':_0x33753b['id'],'queue_name':_0x2af2b8[_0xb261('0x46')],'SmsQueueId':_0x2af2b8['id'],'interface':util[_0xb261('0x66')](_0xb261('0x67'),_0xb261('0x68'),_0x33753b[_0xb261('0x46')]),'penalty':0x0,'paused':_0x33753b['smsPause'],'createdAt':_0x33753b[_0xb261('0x65')],'updatedAt':_0x33753b[_0xb261('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb261('0x2e')](respondWithFilteredResult(_0x38e257,_0x438196))[_0xb261('0x4c')](handleError(_0x38e257,null));};exports[_0xb261('0x6a')]=function(_0x209763,_0x5c99ff,_0x382ebb){var _0x2f5b89={};var _0x1fccaf={};var _0x2b63d6;var _0x284c6d;return db[_0xb261('0x35')]['findOne']({'where':{'id':_0x209763[_0xb261('0x59')]['id']}})[_0xb261('0x2e')](handleEntityNotFound(_0x5c99ff,null))[_0xb261('0x2e')](function(_0x177df8){if(_0x177df8){_0x2b63d6=_0x177df8;_0x1fccaf['model']=_[_0xb261('0x39')](db[_0xb261('0x6b')]['rawAttributes']);_0x1fccaf[_0xb261('0x3a')]=_[_0xb261('0x39')](_0x209763[_0xb261('0x3a')]);_0x1fccaf['filters']=_[_0xb261('0x3c')](_0x1fccaf['model'],_0x1fccaf['query']);_0x2f5b89[_0xb261('0x3d')]=_[_0xb261('0x3c')](_0x1fccaf[_0xb261('0x38')],qs[_0xb261('0x3e')](_0x209763[_0xb261('0x3a')][_0xb261('0x3e')]));_0x2f5b89[_0xb261('0x3d')]=_0x2f5b89[_0xb261('0x3d')][_0xb261('0x3f')]?_0x2f5b89[_0xb261('0x3d')]:_0x1fccaf[_0xb261('0x38')];_0x2f5b89[_0xb261('0x5e')]=qs[_0xb261('0x41')](_0x209763[_0xb261('0x3a')][_0xb261('0x41')]);_0x2f5b89[_0xb261('0x42')]=qs['filters'](_['pick'](_0x209763[_0xb261('0x3a')],_0x1fccaf[_0xb261('0x3b')]));if(_0x209763['query']['filter']){_0x2f5b89['where']=_[_0xb261('0x45')](_0x2f5b89[_0xb261('0x42')],{'$or':_[_0xb261('0x34')](_0x2f5b89[_0xb261('0x3d')],function(_0x488e5f){var _0x2e7896={};_0x2e7896[_0x488e5f]={'$like':'%'+_0x209763[_0xb261('0x3a')][_0xb261('0x44')]+'%'};return _0x2e7896;})});}_0x2f5b89=_['merge']({},_0x2f5b89,_0x209763[_0xb261('0x47')]);return _0x2b63d6['getTeams'](_0x2f5b89);}})[_0xb261('0x2e')](function(_0x2ae742){if(_0x2ae742){_0x284c6d=_0x2ae742[_0xb261('0x3f')];if(!_0x209763['query'][_0xb261('0x40')](_0xb261('0x6c'))){_0x2f5b89['limit']=qs['limit'](_0x209763[_0xb261('0x3a')][_0xb261('0x28')]);_0x2f5b89[_0xb261('0x25')]=qs[_0xb261('0x25')](_0x209763['query']['offset']);}return _0x2b63d6[_0xb261('0x6a')](_0x2f5b89);}})[_0xb261('0x2e')](function(_0x667f03){if(_0x667f03){return _0x667f03?{'count':_0x284c6d,'rows':_0x667f03}:null;}})[_0xb261('0x2e')](respondWithResult(_0x5c99ff,null))['catch'](handleError(_0x5c99ff,null));};exports[_0xb261('0x6d')]=function(_0x3326c1,_0xfd68d8,_0x2ed3ed){var _0x4f2126=_0x3326c1[_0xb261('0x50')][_0xb261('0x6e')];return db[_0xb261('0x6b')][_0xb261('0x4a')]({'where':{'id':_0x4f2126},'attributes':['id'],'include':[{'model':db[_0xb261('0x60')],'as':_0xb261('0x6f'),'attributes':['id',_0xb261('0x46'),_0xb261('0x70'),_0xb261('0x71'),'interface'],'raw':!![]}]})[_0xb261('0x2e')](function(_0x2ec361){if(_0x2ec361){var _0x18f6c8=_['flatMap'](_0x2ec361,function(_0x30664d){var _0x12faea=_0x30664d['get']({'plain':!![]});return _0x12faea[_0xb261('0x6f')];});return db['SmsQueue'][_0xb261('0x4e')]({'where':{'id':_0x3326c1[_0xb261('0x59')]['id']}})['then'](function(_0x74a440){return db[_0xb261('0x72')]['transaction'](function(_0x24d805){return _0x74a440[_0xb261('0x6d')](_0x4f2126,{'transaction':_0x24d805})['then'](function(){return BPromise[_0xb261('0x73')](_0x18f6c8,function(_0x4dfac1){return db['UserSmsQueue'][_0xb261('0x74')]({'where':{'UserId':_0x4dfac1['id'],'SmsQueueId':_0x3326c1[_0xb261('0x59')]['id']},'transaction':_0x24d805});});})[_0xb261('0x2e')](function(){_0x18f6c8[_0xb261('0x75')](function(_0x52b10d){socket[_0xb261('0x76')]('userSmsQueue:save',{'UserId':_0x52b10d['id'],'SmsQueueId':_0x74a440['id']});});});});});}})[_0xb261('0x2e')](respondWithStatusCode(_0xfd68d8,null))['catch'](handleError(_0xfd68d8,null));};exports[_0xb261('0x77')]=function(_0x1e1c67,_0x2e3134,_0x5b2f00){return db[_0xb261('0x6b')][_0xb261('0x4a')]({'where':{'id':_0x1e1c67['query'][_0xb261('0x6e')]},'attributes':['id'],'include':[{'model':db[_0xb261('0x60')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb261('0x2e')](handleEntityNotFound(_0x2e3134,null))[_0xb261('0x2e')](function(_0x800fcd){var _0x8848dd=_[_0xb261('0x34')](_0x800fcd,'id');var _0x4ca203=[];var _0x1d0c25=[];var _0x44901d=squel[_0xb261('0x78')]();_0x44901d[_0xb261('0x79')](_0xb261('0x7a'))['from'](_0xb261('0x7b'),'tq')[_0xb261('0x7c')](_0xb261('0x7d'),'ut',_0xb261('0x7e'))[_0xb261('0x42')](_0xb261('0x7f'),_0x1e1c67[_0xb261('0x59')]['id']);for(var _0x51e35c=0x0;_0x51e35c<_0x800fcd[_0xb261('0x3f')];_0x51e35c+=0x1){let _0x2ee332=_0x800fcd[_0x51e35c];for(var _0x3593be=0x0;_0x3593be<_0x2ee332[_0xb261('0x6f')]['length'];_0x3593be+=0x1){let _0x50aa52=_0x2ee332[_0xb261('0x6f')][_0x3593be];var _0x4b16de=_0x44901d[_0xb261('0x80')]();_0x4b16de[_0xb261('0x42')](_0xb261('0x81'),_0x50aa52['id']);_0x1d0c25[_0xb261('0x82')](db[_0xb261('0x72')][_0xb261('0x3a')](_0x4b16de[_0xb261('0x83')](),{'type':db[_0xb261('0x72')][_0xb261('0x84')][_0xb261('0x85')]})[_0xb261('0x2e')](function(_0x2fe7e7){if(_0x2fe7e7['length']===0x1){return _0x50aa52['id'];}else{var _0x115593=_[_0xb261('0x86')](_[_0xb261('0x34')](_0x2fe7e7,_0xb261('0x87')),function(_0x2836e1){return _[_0xb261('0x88')](_0x8848dd,_0x2836e1);});if(_0x115593){return _0x50aa52['id'];}}}));}}return BPromise['all'](_0x1d0c25)[_0xb261('0x2e')](function(_0x25b22a){_0x4ca203=_(_0x4ca203)[_0xb261('0x89')](_0x25b22a)[_0xb261('0x8a')]()[_0xb261('0x8b')]();return db['SmsQueue'][_0xb261('0x4e')]({'where':{'id':_0x1e1c67[_0xb261('0x59')]['id']}})[_0xb261('0x2e')](function(_0x525533){return db[_0xb261('0x72')][_0xb261('0x8c')](function(_0x7b2822){return _0x525533[_0xb261('0x77')](_0x1e1c67[_0xb261('0x3a')]['ids'],{'transaction':_0x7b2822})[_0xb261('0x2e')](function(){if(!_['isEmpty'](_0x4ca203)){return _0x525533[_0xb261('0x8d')](_0x4ca203,{'transaction':_0x7b2822});}})[_0xb261('0x2e')](function(){_0x4ca203[_0xb261('0x75')](function(_0x1de07c){socket[_0xb261('0x76')]('userSmsQueue:remove',{'UserId':_0x1de07c,'SmsQueueId':_0x525533['id']});});});});});});})[_0xb261('0x2e')](respondWithStatusCode(_0x2e3134,null))[_0xb261('0x4c')](handleError(_0x2e3134,null));};exports[_0xb261('0x8e')]=function(_0x16bad8,_0x2abcbf,_0x20389c){return db[_0xb261('0x35')][_0xb261('0x4e')]({'where':{'id':_0x16bad8['params']['id']}})[_0xb261('0x2e')](handleEntityNotFound(_0x2abcbf,null))['then'](function(_0x1f2b8b){if(_0x1f2b8b){return _0x1f2b8b['addAgents'](_0x16bad8[_0xb261('0x50')]['ids'],_[_0xb261('0x8f')](_0x16bad8[_0xb261('0x50')],['ids','id'])||{})[_0xb261('0x90')](function(_0x11ea13){for(var _0x2aba9f=0x0;_0x2aba9f<_0x16bad8['body'][_0xb261('0x6e')][_0xb261('0x3f')];_0x2aba9f+=0x1){socket[_0xb261('0x76')](_0xb261('0x91'),{'UserId':Number(_0x16bad8[_0xb261('0x50')]['ids'][_0x2aba9f]),'SmsQueueId':Number(_0x16bad8[_0xb261('0x59')]['id'])});}return _0x11ea13;});}})[_0xb261('0x2e')](respondWithResult(_0x2abcbf,null))[_0xb261('0x4c')](handleError(_0x2abcbf,null));};exports['removeAgents']=function(_0x147d45,_0x562126,_0x4759bc){return db[_0xb261('0x35')][_0xb261('0x4e')]({'where':{'id':_0x147d45['params']['id']}})[_0xb261('0x2e')](handleEntityNotFound(_0x562126,null))['then'](function(_0x2761ec){if(_0x2761ec){return _0x2761ec[_0xb261('0x8d')](_0x147d45[_0xb261('0x3a')][_0xb261('0x6e')])[_0xb261('0x2e')](function(){if(_[_0xb261('0x92')](_0x147d45[_0xb261('0x3a')][_0xb261('0x6e')])){for(var _0x5aa9ed=0x0;_0x5aa9ed<_0x147d45['query'][_0xb261('0x6e')][_0xb261('0x3f')];_0x5aa9ed+=0x1){socket[_0xb261('0x76')](_0xb261('0x93'),{'UserId':Number(_0x147d45[_0xb261('0x3a')][_0xb261('0x6e')][_0x5aa9ed]),'SmsQueueId':Number(_0x147d45[_0xb261('0x59')]['id'])});}}else{socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x147d45[_0xb261('0x3a')][_0xb261('0x6e')]),'SmsQueueId':Number(_0x147d45[_0xb261('0x59')]['id'])});}});}})[_0xb261('0x2e')](respondWithStatusCode(_0x562126,null))[_0xb261('0x4c')](handleError(_0x562126,null));};exports[_0xb261('0x94')]=function(_0x131b6e,_0x6440e2,_0x56956f){var _0xe1962c={};var _0xed5b86={};var _0x1181e5;var _0x7b37d5;return db[_0xb261('0x35')][_0xb261('0x5c')]({'where':{'id':_0x131b6e[_0xb261('0x59')]['id']}})[_0xb261('0x2e')](handleEntityNotFound(_0x6440e2,null))[_0xb261('0x2e')](function(_0x473b7a){if(_0x473b7a){_0x1181e5=_0x473b7a;_0xed5b86[_0xb261('0x38')]=_[_0xb261('0x39')](db[_0xb261('0x60')][_0xb261('0x5d')]);_0xed5b86[_0xb261('0x3a')]=_[_0xb261('0x39')](_0x131b6e[_0xb261('0x3a')]);_0xed5b86[_0xb261('0x3b')]=_[_0xb261('0x3c')](_0xed5b86[_0xb261('0x38')],_0xed5b86['query']);_0xe1962c[_0xb261('0x3d')]=_['intersection'](_0xed5b86[_0xb261('0x38')],qs[_0xb261('0x3e')](_0x131b6e[_0xb261('0x3a')][_0xb261('0x3e')]));_0xe1962c[_0xb261('0x3d')]=_0xe1962c[_0xb261('0x3d')][_0xb261('0x3f')]?_0xe1962c[_0xb261('0x3d')]:_0xed5b86[_0xb261('0x38')];_0xe1962c[_0xb261('0x5e')]=qs[_0xb261('0x41')](_0x131b6e['query'][_0xb261('0x41')]);_0xe1962c[_0xb261('0x42')]=qs[_0xb261('0x3b')](_[_0xb261('0x43')](_0x131b6e['query'],_0xed5b86[_0xb261('0x3b')]));if(_0x131b6e[_0xb261('0x3a')][_0xb261('0x44')]){_0xe1962c[_0xb261('0x42')]=_[_0xb261('0x45')](_0xe1962c[_0xb261('0x42')],{'$or':_['map'](_0xe1962c['attributes'],function(_0x1ebb97){var _0xe5c2b7={};_0xe5c2b7[_0x1ebb97]={'$like':'%'+_0x131b6e[_0xb261('0x3a')]['filter']+'%'};return _0xe5c2b7;})});}_0xe1962c=_[_0xb261('0x45')]({},_0xe1962c,_0x131b6e[_0xb261('0x47')]);return _0x1181e5[_0xb261('0x94')](_0xe1962c);}})[_0xb261('0x2e')](function(_0x3cc929){if(_0x3cc929){_0x7b37d5=_0x3cc929[_0xb261('0x3f')];if(!_0x131b6e['query'][_0xb261('0x40')](_0xb261('0x6c'))){_0xe1962c[_0xb261('0x28')]=qs[_0xb261('0x28')](_0x131b6e[_0xb261('0x3a')][_0xb261('0x28')]);_0xe1962c[_0xb261('0x25')]=qs[_0xb261('0x25')](_0x131b6e[_0xb261('0x3a')][_0xb261('0x25')]);}return _0x1181e5[_0xb261('0x94')](_0xe1962c);}})[_0xb261('0x2e')](function(_0x5c2dae){if(_0x5c2dae){return _0x5c2dae?{'count':_0x7b37d5,'rows':_0x5c2dae}:null;}})[_0xb261('0x2e')](respondWithResult(_0x6440e2,null))['catch'](handleError(_0x6440e2,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 26ebb4b..0ccec5d 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 _0x3cf0=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update'];(function(_0x5c524a,_0x2fc0d1){var _0xa7902f=function(_0x1b1241){while(--_0x1b1241){_0x5c524a['push'](_0x5c524a['shift']());}};_0xa7902f(++_0x2fc0d1);}(_0x3cf0,0x152));var _0x03cf=function(_0x42c6ed,_0x2ad4f4){_0x42c6ed=_0x42c6ed-0x0;var _0xb47ffc=_0x3cf0[_0x42c6ed];return _0xb47ffc;};'use strict';var EventEmitter=require(_0x03cf('0x0'));var SmsQueue=require(_0x03cf('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x03cf('0x2'),'afterUpdate':_0x03cf('0x3'),'afterDestroy':_0x03cf('0x4')};function emitEvent(_0x200886){return function(_0x55ee62,_0x427a94,_0x3ca0bf){SmsQueueEvents[_0x03cf('0x5')](_0x200886+':'+_0x55ee62['id'],_0x55ee62);SmsQueueEvents[_0x03cf('0x5')](_0x200886,_0x55ee62);_0x3ca0bf(null);};}for(var e in events){if(events[_0x03cf('0x6')](e)){var event=events[e];SmsQueue[_0x03cf('0x7')](e,emitEvent(event));}}module[_0x03cf('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xb5a7=['events','SmsQueue','save','update','emit','hasOwnProperty','exports'];(function(_0x2d34d6,_0x397ff9){var _0x1d3d12=function(_0x558800){while(--_0x558800){_0x2d34d6['push'](_0x2d34d6['shift']());}};_0x1d3d12(++_0x397ff9);}(_0xb5a7,0x8c));var _0x7b5a=function(_0x8fda2a,_0x560a0a){_0x8fda2a=_0x8fda2a-0x0;var _0x1656ab=_0xb5a7[_0x8fda2a];return _0x1656ab;};'use strict';var EventEmitter=require(_0x7b5a('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0x7b5a('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7b5a('0x2'),'afterUpdate':_0x7b5a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x47b536){return function(_0x2ecd6f,_0x17dd5e,_0x28dc15){SmsQueueEvents[_0x7b5a('0x4')](_0x47b536+':'+_0x2ecd6f['id'],_0x2ecd6f);SmsQueueEvents[_0x7b5a('0x4')](_0x47b536,_0x2ecd6f);_0x28dc15(null);};}for(var e in events){if(events[_0x7b5a('0x5')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x7b5a('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 07f05f7..634e036 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 _0xc2bd=['SmsQueue','sms_queues','lodash','api','bluebird','rimraf','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc2bd,0x1d7));var _0xdc2b=function(_0x33ab59,_0x217422){_0x33ab59=_0x33ab59-0x0;var _0x3fcb9c=_0xc2bd[_0x33ab59];return _0x3fcb9c;};'use strict';var _=require(_0xdc2b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdc2b('0x1'));var moment=require('moment');var BPromise=require(_0xdc2b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdc2b('0x3'));var config=require('../../config/environment');var attributes=require('./smsQueue.attributes');module[_0xdc2b('0x4')]=function(_0x2d2165,_0x579dc2){return _0x2d2165['define'](_0xdc2b('0x5'),attributes,{'tableName':_0xdc2b('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce49=['./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','api','bluebird','request-promise','path','../../config/environment'];(function(_0x5e9b9c,_0x192a85){var _0x2dc972=function(_0xff41ae){while(--_0xff41ae){_0x5e9b9c['push'](_0x5e9b9c['shift']());}};_0x2dc972(++_0x192a85);}(_0xce49,0xd6));var _0x9ce4=function(_0x7893dd,_0x4f12b6){_0x7893dd=_0x7893dd-0x0;var _0x3f5f89=_0xce49[_0x7893dd];return _0x3f5f89;};'use strict';var _=require('lodash');var util=require(_0x9ce4('0x0'));var logger=require('../../config/logger')(_0x9ce4('0x1'));var moment=require('moment');var BPromise=require(_0x9ce4('0x2'));var rp=require(_0x9ce4('0x3'));var fs=require('fs');var path=require(_0x9ce4('0x4'));var rimraf=require('rimraf');var config=require(_0x9ce4('0x5'));var attributes=require(_0x9ce4('0x6'));module[_0x9ce4('0x7')]=function(_0x197f3f,_0x4090d4){return _0x197f3f[_0x9ce4('0x8')](_0x9ce4('0x9'),attributes,{'tableName':_0x9ce4('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 7796a80..8bf825e 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 _0x0082=['map','model','then','catch','find','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','redis','defaults','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0082,0xf6));var _0x2008=function(_0x20a234,_0x209a9a){_0x20a234=_0x20a234-0x0;var _0x57cae4=_0x0082[_0x20a234];return _0x57cae4;};'use strict';var _=require(_0x2008('0x0'));var util=require(_0x2008('0x1'));var moment=require(_0x2008('0x2'));var BPromise=require(_0x2008('0x3'));var rs=require(_0x2008('0x4'));var fs=require('fs');var Redis=require(_0x2008('0x5'));var db=require(_0x2008('0x6'))['db'];var utils=require(_0x2008('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2008('0x8')][_0x2008('0x9')]({'port':0x232a});config[_0x2008('0xa')]=_[_0x2008('0xb')](config[_0x2008('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2008('0xc'))[_0x2008('0xd')](socket);function respondWithRpcPromise(_0x1121b5,_0x4d9967,_0x4fee19){return new BPromise(function(_0x5642e6,_0x3aa7cd){return client[_0x2008('0xe')](_0x1121b5,_0x4fee19)['then'](function(_0x2503ab){logger[_0x2008('0xf')](_0x2008('0x10'),_0x4d9967,'request\x20sent');logger[_0x2008('0x11')](_0x2008('0x12'),_0x4d9967,_0x2008('0x13'),JSON[_0x2008('0x14')](_0x2503ab));if(_0x2503ab[_0x2008('0x15')]){if(_0x2503ab[_0x2008('0x15')][_0x2008('0x16')]===0x1f4){logger['error'](_0x2008('0x10'),_0x4d9967,_0x2503ab['error'][_0x2008('0x17')]);return _0x3aa7cd(_0x2503ab['error']['message']);}logger[_0x2008('0x15')]('SmsQueue,\x20%s,\x20%s',_0x4d9967,_0x2503ab[_0x2008('0x15')][_0x2008('0x17')]);return _0x5642e6(_0x2503ab[_0x2008('0x15')][_0x2008('0x17')]);}else{logger[_0x2008('0xf')]('SmsQueue,\x20%s,\x20%s',_0x4d9967,_0x2008('0x13'));_0x5642e6(_0x2503ab[_0x2008('0x18')][_0x2008('0x17')]);}})['catch'](function(_0x48a70d){logger['error']('SmsQueue,\x20%s,\x20%s',_0x4d9967,_0x48a70d);_0x3aa7cd(_0x48a70d);});});}exports[_0x2008('0x19')]=function(_0x2317a0){var _0x5d6029=this;return new Promise(function(_0x161ecd,_0x1d7510){return db[_0x2008('0x1a')][_0x2008('0x1b')]({'raw':_0x2317a0[_0x2008('0x1c')]?_0x2317a0[_0x2008('0x1c')][_0x2008('0x1d')]===undefined?!![]:![]:!![],'where':_0x2317a0[_0x2008('0x1c')]?_0x2317a0[_0x2008('0x1c')][_0x2008('0x1e')]||null:null,'attributes':_0x2317a0[_0x2008('0x1c')]?_0x2317a0[_0x2008('0x1c')][_0x2008('0x1f')]||null:null,'limit':_0x2317a0[_0x2008('0x1c')]?_0x2317a0['options'][_0x2008('0x20')]||null:null,'include':_0x2317a0[_0x2008('0x1c')]?_0x2317a0[_0x2008('0x1c')][_0x2008('0x21')]?_[_0x2008('0x22')](_0x2317a0[_0x2008('0x1c')][_0x2008('0x21')],function(_0x1dae45){return{'model':db[_0x1dae45['model']],'as':_0x1dae45['as'],'attributes':_0x1dae45[_0x2008('0x1f')],'include':_0x1dae45[_0x2008('0x21')]?_['map'](_0x1dae45[_0x2008('0x21')],function(_0x1c4f89){return{'model':db[_0x1c4f89[_0x2008('0x23')]],'as':_0x1c4f89['as'],'attributes':_0x1c4f89[_0x2008('0x1f')],'include':_0x1c4f89[_0x2008('0x21')]?_['map'](_0x1c4f89[_0x2008('0x21')],function(_0x55f685){return{'model':db[_0x55f685[_0x2008('0x23')]],'as':_0x55f685['as'],'attributes':_0x55f685['attributes']};}):[]};}):[]};}):[]:[]})[_0x2008('0x24')](function(_0x484f36){logger[_0x2008('0xf')](_0x2008('0x19'),_0x2317a0);logger[_0x2008('0x11')](_0x2008('0x19'),_0x2317a0,JSON['stringify'](_0x484f36));_0x161ecd(_0x484f36);})[_0x2008('0x25')](function(_0x4da669){logger[_0x2008('0x15')]('GetSmsQueue',_0x4da669[_0x2008('0x17')],_0x2317a0);_0x1d7510(_0x5d6029['error'](0x1f4,_0x4da669['message']));});});};exports['ShowSmsQueue']=function(_0x345ebf){var _0x4521c6=this;return new Promise(function(_0x524646,_0x5888a3){return db['SmsQueue'][_0x2008('0x26')]({'raw':_0x345ebf[_0x2008('0x1c')]?_0x345ebf[_0x2008('0x1c')][_0x2008('0x1d')]===undefined?!![]:![]:!![],'where':_0x345ebf[_0x2008('0x1c')]?_0x345ebf[_0x2008('0x1c')][_0x2008('0x1e')]||null:null,'attributes':_0x345ebf[_0x2008('0x1c')]?_0x345ebf[_0x2008('0x1c')][_0x2008('0x1f')]||null:null,'include':_0x345ebf[_0x2008('0x1c')]?_0x345ebf[_0x2008('0x1c')][_0x2008('0x21')]?_[_0x2008('0x22')](_0x345ebf['options'][_0x2008('0x21')],function(_0x22397d){return{'model':db[_0x22397d[_0x2008('0x23')]],'as':_0x22397d['as'],'attributes':_0x22397d[_0x2008('0x1f')],'include':_0x22397d['include']?_[_0x2008('0x22')](_0x22397d['include'],function(_0x402465){return{'model':db[_0x402465[_0x2008('0x23')]],'as':_0x402465['as'],'attributes':_0x402465[_0x2008('0x1f')],'include':_0x402465[_0x2008('0x21')]?_[_0x2008('0x22')](_0x402465[_0x2008('0x21')],function(_0x1f58eb){return{'model':db[_0x1f58eb[_0x2008('0x23')]],'as':_0x1f58eb['as'],'attributes':_0x1f58eb[_0x2008('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2008('0x24')](function(_0x48b503){logger[_0x2008('0xf')](_0x2008('0x27'),_0x345ebf);logger[_0x2008('0x11')]('ShowSmsQueue',_0x345ebf,JSON[_0x2008('0x14')](_0x48b503));_0x524646(_0x48b503);})[_0x2008('0x25')](function(_0x7d3175){logger[_0x2008('0x15')]('ShowSmsQueue',_0x7d3175[_0x2008('0x17')],_0x345ebf);_0x5888a3(_0x4521c6['error'](0x1f4,_0x7d3175[_0x2008('0x17')]));});});}; \ No newline at end of file +var _0x2101=['register','request','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','SmsQueue','options','where','attributes','limit','include','map','model','then','GetSmsQueue','raw','ShowSmsQueue','stringify','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost'];(function(_0x19f9b2,_0x59b3a0){var _0x203985=function(_0x58a4b1){while(--_0x58a4b1){_0x19f9b2['push'](_0x19f9b2['shift']());}};_0x203985(++_0x59b3a0);}(_0x2101,0xa5));var _0x1210=function(_0x28b660,_0x8807b7){_0x28b660=_0x28b660-0x0;var _0x2663fc=_0x2101[_0x28b660];return _0x2663fc;};'use strict';var _=require(_0x1210('0x0'));var util=require(_0x1210('0x1'));var moment=require(_0x1210('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1210('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1210('0x4'))(_0x1210('0x5'));var config=require(_0x1210('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1210('0x7')]({'port':0x232a});config[_0x1210('0x8')]=_['defaults'](config[_0x1210('0x8')],{'host':_0x1210('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1210('0x8')]));require('./smsQueue.socket')[_0x1210('0xa')](socket);function respondWithRpcPromise(_0x1346c9,_0x305c14,_0x41ab17){return new BPromise(function(_0x10975d,_0x553d08){return client[_0x1210('0xb')](_0x1346c9,_0x41ab17)['then'](function(_0x49b0a1){logger[_0x1210('0xc')](_0x1210('0xd'),_0x305c14,'request\x20sent');logger[_0x1210('0xe')](_0x1210('0xf'),_0x305c14,_0x1210('0x10'),JSON['stringify'](_0x49b0a1));if(_0x49b0a1['error']){if(_0x49b0a1['error'][_0x1210('0x11')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x305c14,_0x49b0a1[_0x1210('0x12')][_0x1210('0x13')]);return _0x553d08(_0x49b0a1[_0x1210('0x12')][_0x1210('0x13')]);}logger[_0x1210('0x12')](_0x1210('0xd'),_0x305c14,_0x49b0a1[_0x1210('0x12')]['message']);return _0x10975d(_0x49b0a1[_0x1210('0x12')][_0x1210('0x13')]);}else{logger[_0x1210('0xc')](_0x1210('0xd'),_0x305c14,'request\x20sent');_0x10975d(_0x49b0a1[_0x1210('0x14')][_0x1210('0x13')]);}})[_0x1210('0x15')](function(_0x304e45){logger[_0x1210('0x12')](_0x1210('0xd'),_0x305c14,_0x304e45);_0x553d08(_0x304e45);});});}exports['GetSmsQueue']=function(_0x52a3a1){var _0x3bed13=this;return new Promise(function(_0x4fe0c9,_0x2425f7){return db[_0x1210('0x16')]['findAll']({'raw':_0x52a3a1[_0x1210('0x17')]?_0x52a3a1['options']['raw']===undefined?!![]:![]:!![],'where':_0x52a3a1[_0x1210('0x17')]?_0x52a3a1[_0x1210('0x17')][_0x1210('0x18')]||null:null,'attributes':_0x52a3a1[_0x1210('0x17')]?_0x52a3a1[_0x1210('0x17')][_0x1210('0x19')]||null:null,'limit':_0x52a3a1['options']?_0x52a3a1[_0x1210('0x17')][_0x1210('0x1a')]||null:null,'include':_0x52a3a1['options']?_0x52a3a1[_0x1210('0x17')][_0x1210('0x1b')]?_[_0x1210('0x1c')](_0x52a3a1[_0x1210('0x17')][_0x1210('0x1b')],function(_0x5b7614){return{'model':db[_0x5b7614[_0x1210('0x1d')]],'as':_0x5b7614['as'],'attributes':_0x5b7614[_0x1210('0x19')],'include':_0x5b7614['include']?_[_0x1210('0x1c')](_0x5b7614[_0x1210('0x1b')],function(_0x50bb59){return{'model':db[_0x50bb59[_0x1210('0x1d')]],'as':_0x50bb59['as'],'attributes':_0x50bb59['attributes'],'include':_0x50bb59['include']?_['map'](_0x50bb59[_0x1210('0x1b')],function(_0x5a5cb7){return{'model':db[_0x5a5cb7['model']],'as':_0x5a5cb7['as'],'attributes':_0x5a5cb7[_0x1210('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1210('0x1e')](function(_0x58ad00){logger[_0x1210('0xc')](_0x1210('0x1f'),_0x52a3a1);logger[_0x1210('0xe')](_0x1210('0x1f'),_0x52a3a1,JSON['stringify'](_0x58ad00));_0x4fe0c9(_0x58ad00);})[_0x1210('0x15')](function(_0x19d282){logger[_0x1210('0x12')](_0x1210('0x1f'),_0x19d282[_0x1210('0x13')],_0x52a3a1);_0x2425f7(_0x3bed13[_0x1210('0x12')](0x1f4,_0x19d282[_0x1210('0x13')]));});});};exports['ShowSmsQueue']=function(_0x3bf095){var _0x14b742=this;return new Promise(function(_0x32083f,_0x22f134){return db[_0x1210('0x16')]['find']({'raw':_0x3bf095[_0x1210('0x17')]?_0x3bf095['options'][_0x1210('0x20')]===undefined?!![]:![]:!![],'where':_0x3bf095[_0x1210('0x17')]?_0x3bf095[_0x1210('0x17')][_0x1210('0x18')]||null:null,'attributes':_0x3bf095[_0x1210('0x17')]?_0x3bf095[_0x1210('0x17')][_0x1210('0x19')]||null:null,'include':_0x3bf095[_0x1210('0x17')]?_0x3bf095['options'][_0x1210('0x1b')]?_[_0x1210('0x1c')](_0x3bf095[_0x1210('0x17')]['include'],function(_0x34158b){return{'model':db[_0x34158b[_0x1210('0x1d')]],'as':_0x34158b['as'],'attributes':_0x34158b[_0x1210('0x19')],'include':_0x34158b['include']?_[_0x1210('0x1c')](_0x34158b['include'],function(_0x3a3d28){return{'model':db[_0x3a3d28[_0x1210('0x1d')]],'as':_0x3a3d28['as'],'attributes':_0x3a3d28[_0x1210('0x19')],'include':_0x3a3d28[_0x1210('0x1b')]?_['map'](_0x3a3d28[_0x1210('0x1b')],function(_0x29b6ce){return{'model':db[_0x29b6ce['model']],'as':_0x29b6ce['as'],'attributes':_0x29b6ce['attributes']};}):[]};}):[]};}):[]:[]})[_0x1210('0x1e')](function(_0x5b4708){logger[_0x1210('0xc')](_0x1210('0x21'),_0x3bf095);logger[_0x1210('0xe')](_0x1210('0x21'),_0x3bf095,JSON[_0x1210('0x22')](_0x5b4708));_0x32083f(_0x5b4708);})[_0x1210('0x15')](function(_0x3d4919){logger[_0x1210('0x12')](_0x1210('0x21'),_0x3d4919[_0x1210('0x13')],_0x3bf095);_0x22f134(_0x14b742[_0x1210('0x12')](0x1f4,_0x3d4919['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index d99ca81..84c0ec5 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 _0xd166=['update','emit','removeListener','length','smsQueue:','save','remove'];(function(_0x47bad0,_0x442902){var _0x511471=function(_0x1ea76d){while(--_0x1ea76d){_0x47bad0['push'](_0x47bad0['shift']());}};_0x511471(++_0x442902);}(_0xd166,0x91));var _0x6d16=function(_0x2c64df,_0x29f51b){_0x2c64df=_0x2c64df-0x0;var _0x3108dd=_0xd166[_0x2c64df];return _0x3108dd;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x6d16('0x0'),_0x6d16('0x1'),_0x6d16('0x2')];function createListener(_0x1fd370,_0x272b29){return function(_0x2f0ca0){_0x272b29[_0x6d16('0x3')](_0x1fd370,_0x2f0ca0);};}function removeListener(_0xc7799c,_0x6a076f){return function(){SmsQueueEvents[_0x6d16('0x4')](_0xc7799c,_0x6a076f);};}exports['register']=function(_0x3cd291){for(var _0x597b0c=0x0,_0x4ccd69=events[_0x6d16('0x5')];_0x597b0c<_0x4ccd69;_0x597b0c++){var _0x5c7ecb=events[_0x597b0c];var _0x268c83=createListener(_0x6d16('0x6')+_0x5c7ecb,_0x3cd291);SmsQueueEvents['on'](_0x5c7ecb,_0x268c83);}}; \ No newline at end of file +var _0xfbb3=['update','emit','removeListener','register','length','./smsQueue.events','remove'];(function(_0x2e2960,_0x3ca764){var _0x7f702=function(_0x280596){while(--_0x280596){_0x2e2960['push'](_0x2e2960['shift']());}};_0x7f702(++_0x3ca764);}(_0xfbb3,0x140));var _0x3fbb=function(_0x5a7bd3,_0x4e7fb3){_0x5a7bd3=_0x5a7bd3-0x0;var _0x3bb83a=_0xfbb3[_0x5a7bd3];return _0x3bb83a;};'use strict';var SmsQueueEvents=require(_0x3fbb('0x0'));var events=['save',_0x3fbb('0x1'),_0x3fbb('0x2')];function createListener(_0x2c47df,_0x2b1d7c){return function(_0x2cc6c1){_0x2b1d7c[_0x3fbb('0x3')](_0x2c47df,_0x2cc6c1);};}function removeListener(_0x5e89ed,_0x5662a5){return function(){SmsQueueEvents[_0x3fbb('0x4')](_0x5e89ed,_0x5662a5);};}exports[_0x3fbb('0x5')]=function(_0x43a765){for(var _0x175388=0x0,_0x297565=events[_0x3fbb('0x6')];_0x175388<_0x297565;_0x175388++){var _0x1c88ad=events[_0x175388];var _0x9d42a9=createListener('smsQueue:'+_0x1c88ad,_0x43a765);SmsQueueEvents['on'](_0x1c88ad,_0x9d42a9);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index b357b64..1f078e3 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 _0x99b0=['get','show','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','/describe'];(function(_0x22a446,_0x3b56cc){var _0x1f5654=function(_0x1303e){while(--_0x1303e){_0x22a446['push'](_0x22a446['shift']());}};_0x1f5654(++_0x3b56cc);}(_0x99b0,0xf0));var _0x099b=function(_0x8f617,_0x791259){_0x8f617=_0x8f617-0x0;var _0x295342=_0x99b0[_0x8f617];return _0x295342;};'use strict';var multer=require(_0x099b('0x0'));var util=require(_0x099b('0x1'));var path=require('path');var timeout=require(_0x099b('0x2'));var express=require(_0x099b('0x3'));var router=express[_0x099b('0x4')]();var fs_extra=require(_0x099b('0x5'));var auth=require(_0x099b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x099b('0x7'));var controller=require(_0x099b('0x8'));router['get']('/',auth[_0x099b('0x9')](),controller[_0x099b('0xa')]);router['get'](_0x099b('0xb'),auth[_0x099b('0x9')](),controller['describe']);router[_0x099b('0xc')]('/:id',auth[_0x099b('0x9')](),controller[_0x099b('0xd')]);router[_0x099b('0xe')]('/',auth[_0x099b('0x9')](),controller[_0x099b('0xf')]);router[_0x099b('0x10')](_0x099b('0x11'),auth[_0x099b('0x9')](),controller[_0x099b('0x12')]);router['delete'](_0x099b('0x11'),auth[_0x099b('0x9')](),controller[_0x099b('0x13')]);module[_0x099b('0x14')]=router; \ No newline at end of file +var _0xe946=['post','put','delete','/:id','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','show'];(function(_0x41bea7,_0x506bc9){var _0x53a431=function(_0x4e6c33){while(--_0x4e6c33){_0x41bea7['push'](_0x41bea7['shift']());}};_0x53a431(++_0x506bc9);}(_0xe946,0x18d));var _0x6e94=function(_0x1cea7e,_0x4e9be8){_0x1cea7e=_0x1cea7e-0x0;var _0xdb85fa=_0xe946[_0x1cea7e];return _0xdb85fa;};'use strict';var multer=require('multer');var util=require(_0x6e94('0x0'));var path=require(_0x6e94('0x1'));var timeout=require('connect-timeout');var express=require(_0x6e94('0x2'));var router=express[_0x6e94('0x3')]();var fs_extra=require(_0x6e94('0x4'));var auth=require(_0x6e94('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6e94('0x6'));var controller=require('./smsQueueReport.controller');router[_0x6e94('0x7')]('/',auth[_0x6e94('0x8')](),controller['index']);router[_0x6e94('0x7')](_0x6e94('0x9'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x6e94('0x8')](),controller[_0x6e94('0xa')]);router[_0x6e94('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6e94('0xc')]('/:id',auth[_0x6e94('0x8')](),controller['update']);router[_0x6e94('0xd')](_0x6e94('0xe'),auth[_0x6e94('0x8')](),controller[_0x6e94('0xf')]);module[_0x6e94('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 7a88513..59df3a3 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 _0x6324=['STRING','DATE','sequelize','exports'];(function(_0x1ddc4c,_0x10e86a){var _0x56141e=function(_0x394d8c){while(--_0x394d8c){_0x1ddc4c['push'](_0x1ddc4c['shift']());}};_0x56141e(++_0x10e86a);}(_0x6324,0xa2));var _0x4632=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x6324[_0x4a599b];return _0x2d53d3;};'use strict';var moment=require('moment');var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'uniqueid':{'type':Sequelize[_0x4632('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4632('0x3')]},'leaveAt':{'type':Sequelize[_0x4632('0x3')]},'acceptAt':{'type':Sequelize[_0x4632('0x3')]},'exitAt':{'type':Sequelize[_0x4632('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfccd=['STRING','DATE','sequelize','exports'];(function(_0x433853,_0x410c17){var _0x5ea703=function(_0x5c6fa0){while(--_0x5c6fa0){_0x433853['push'](_0x433853['shift']());}};_0x5ea703(++_0x410c17);}(_0xfccd,0x106));var _0xdfcc=function(_0x430469,_0x20e783){_0x430469=_0x430469-0x0;var _0x1ca55e=_0xfccd[_0x430469];return _0x1ca55e;};'use strict';var moment=require('moment');var Sequelize=require(_0xdfcc('0x0'));module[_0xdfcc('0x1')]={'uniqueid':{'type':Sequelize[_0xdfcc('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdfcc('0x2')]},'joinAt':{'type':Sequelize[_0xdfcc('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xdfcc('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index ec344b1..5ce0e4b 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 _0x45fa=['include','rows','catch','show','params','options','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','SmsQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','includeAll'];(function(_0x2286b9,_0x2ffe8b){var _0x41a30e=function(_0x596adb){while(--_0x596adb){_0x2286b9['push'](_0x2286b9['shift']());}};_0x41a30e(++_0x2ffe8b);}(_0x45fa,0x187));var _0xa45f=function(_0x12bd0a,_0x44b39a){_0x12bd0a=_0x12bd0a-0x0;var _0x365893=_0x45fa[_0x12bd0a];return _0x365893;};'use strict';var emlformat=require(_0xa45f('0x0'));var rimraf=require(_0xa45f('0x1'));var zipdir=require(_0xa45f('0x2'));var jsonpatch=require(_0xa45f('0x3'));var rp=require(_0xa45f('0x4'));var moment=require(_0xa45f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa45f('0x6'));var util=require(_0xa45f('0x7'));var path=require(_0xa45f('0x8'));var sox=require(_0xa45f('0x9'));var csv=require(_0xa45f('0xa'));var ejs=require(_0xa45f('0xb'));var fs=require('fs');var fs_extra=require(_0xa45f('0xc'));var _=require(_0xa45f('0xd'));var squel=require(_0xa45f('0xe'));var crypto=require('crypto');var jsforce=require(_0xa45f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa45f('0xa'));var querystring=require(_0xa45f('0x10'));var Papa=require(_0xa45f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa45f('0x12'));var as=require(_0xa45f('0x13'));var hardwareService=require(_0xa45f('0x14'));var logger=require(_0xa45f('0x15'))(_0xa45f('0x16'));var utils=require(_0xa45f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa45f('0x18'));var db=require(_0xa45f('0x19'))['db'];function respondWithStatusCode(_0x236295,_0x1497bc){_0x1497bc=_0x1497bc||0xcc;return function(_0x26e42f){if(_0x26e42f){return _0x236295[_0xa45f('0x1a')](_0x1497bc);}return _0x236295[_0xa45f('0x1b')](_0x1497bc)[_0xa45f('0x1c')]();};}function respondWithResult(_0x463c8d,_0x38fcbf){_0x38fcbf=_0x38fcbf||0xc8;return function(_0xf239ea){if(_0xf239ea){return _0x463c8d[_0xa45f('0x1b')](_0x38fcbf)[_0xa45f('0x1d')](_0xf239ea);}};}function respondWithFilteredResult(_0xb9d42f,_0x33abd9){return function(_0x4fdaf7){if(_0x4fdaf7){var _0x124d3c=typeof _0x33abd9['offset']===_0xa45f('0x1e')&&typeof _0x33abd9['limit']===_0xa45f('0x1e');var _0xf7315e=_0x4fdaf7[_0xa45f('0x1f')];var _0x59e03f=_0x124d3c?0x0:_0x33abd9['offset'];var _0x38be47=_0x124d3c?_0x4fdaf7[_0xa45f('0x1f')]:_0x33abd9[_0xa45f('0x20')]+_0x33abd9[_0xa45f('0x21')];var _0x48593f;if(_0x38be47>=_0xf7315e){_0x38be47=_0xf7315e;_0x48593f=0xc8;}else{_0x48593f=0xce;}_0xb9d42f['status'](_0x48593f);return _0xb9d42f['set'](_0xa45f('0x22'),_0x59e03f+'-'+_0x38be47+'/'+_0xf7315e)[_0xa45f('0x1d')](_0x4fdaf7);}return null;};}function patchUpdates(_0x3193f2){return function(_0x209034){try{jsonpatch[_0xa45f('0x23')](_0x209034,_0x3193f2,!![]);}catch(_0x57d913){return BPromise[_0xa45f('0x24')](_0x57d913);}return _0x209034[_0xa45f('0x25')]();};}function saveUpdates(_0x45d6cf,_0x545d1e){return function(_0x54cf73){if(_0x54cf73){return _0x54cf73['update'](_0x45d6cf)[_0xa45f('0x26')](function(_0x4d9400){return _0x4d9400;});}return null;};}function removeEntity(_0x10efb8,_0x228e19){return function(_0x137b65){if(_0x137b65){return _0x137b65[_0xa45f('0x27')]()[_0xa45f('0x26')](function(){_0x10efb8[_0xa45f('0x1b')](0xcc)[_0xa45f('0x1c')]();});}};}function handleEntityNotFound(_0xf900c2,_0x5a3fa2){return function(_0x2e61a3){if(!_0x2e61a3){_0xf900c2[_0xa45f('0x1a')](0x194);}return _0x2e61a3;};}function handleError(_0xe343df,_0x59ae25){_0x59ae25=_0x59ae25||0x1f4;return function(_0x113df2){logger[_0xa45f('0x28')](_0x113df2[_0xa45f('0x29')]);if(_0x113df2['name']){delete _0x113df2[_0xa45f('0x2a')];}_0xe343df['status'](_0x59ae25)[_0xa45f('0x2b')](_0x113df2);};}exports['index']=function(_0x5d65d4,_0x417c48){var _0x354cb9={},_0x393160={},_0x2cbe7a={'count':0x0,'rows':[]};var _0x29b09b=_[_0xa45f('0x2c')](db[_0xa45f('0x2d')]['rawAttributes'],function(_0x1e0acd){return{'name':_0x1e0acd[_0xa45f('0x2e')],'type':_0x1e0acd[_0xa45f('0x2f')][_0xa45f('0x30')]};});_0x393160[_0xa45f('0x31')]=_[_0xa45f('0x2c')](_0x29b09b,_0xa45f('0x2a'));_0x393160[_0xa45f('0x32')]=_[_0xa45f('0x33')](_0x5d65d4[_0xa45f('0x32')]);_0x393160[_0xa45f('0x34')]=_[_0xa45f('0x35')](_0x393160[_0xa45f('0x31')],_0x393160['query']);_0x354cb9[_0xa45f('0x36')]=_[_0xa45f('0x35')](_0x393160['model'],qs[_0xa45f('0x37')](_0x5d65d4[_0xa45f('0x32')][_0xa45f('0x37')]));_0x354cb9['attributes']=_0x354cb9[_0xa45f('0x36')][_0xa45f('0x38')]?_0x354cb9[_0xa45f('0x36')]:_0x393160[_0xa45f('0x31')];if(!_0x5d65d4[_0xa45f('0x32')][_0xa45f('0x39')](_0xa45f('0x3a'))){_0x354cb9[_0xa45f('0x21')]=qs['limit'](_0x5d65d4[_0xa45f('0x32')][_0xa45f('0x21')]);_0x354cb9[_0xa45f('0x20')]=qs[_0xa45f('0x20')](_0x5d65d4[_0xa45f('0x32')][_0xa45f('0x20')]);}_0x354cb9[_0xa45f('0x3b')]=qs['sort'](_0x5d65d4[_0xa45f('0x32')]['sort']);_0x354cb9[_0xa45f('0x3c')]=qs[_0xa45f('0x34')](_['pick'](_0x5d65d4['query'],_0x393160[_0xa45f('0x34')]),_0x29b09b);if(_0x5d65d4[_0xa45f('0x32')][_0xa45f('0x3d')]){_0x354cb9[_0xa45f('0x3c')]=_[_0xa45f('0x3e')](_0x354cb9['where'],{'$or':_['map'](_0x29b09b,function(_0x5a718a){if(_0x5a718a['type']!==_0xa45f('0x3f')){var _0x5cedb2={};_0x5cedb2[_0x5a718a[_0xa45f('0x2a')]]={'$like':'%'+_0x5d65d4[_0xa45f('0x32')][_0xa45f('0x3d')]+'%'};return _0x5cedb2;}})});}_0x354cb9=_['merge']({},_0x354cb9,_0x5d65d4['options']);var _0x5347cc={'where':_0x354cb9['where']};return db['SmsQueueReport'][_0xa45f('0x1f')](_0x5347cc)[_0xa45f('0x26')](function(_0xf8481f){_0x2cbe7a[_0xa45f('0x1f')]=_0xf8481f;if(_0x5d65d4['query'][_0xa45f('0x40')]){_0x354cb9[_0xa45f('0x41')]=[{'all':!![]}];}return db['SmsQueueReport']['findAll'](_0x354cb9);})[_0xa45f('0x26')](function(_0x319fd1){_0x2cbe7a[_0xa45f('0x42')]=_0x319fd1;return _0x2cbe7a;})[_0xa45f('0x26')](respondWithFilteredResult(_0x417c48,_0x354cb9))[_0xa45f('0x43')](handleError(_0x417c48,null));};exports[_0xa45f('0x44')]=function(_0x5c058f,_0x12f6f2){var _0x43be2b={'raw':!![],'where':{'id':_0x5c058f[_0xa45f('0x45')]['id']}},_0x3c31d4={};_0x3c31d4[_0xa45f('0x31')]=_[_0xa45f('0x33')](db['SmsQueueReport']['rawAttributes']);_0x3c31d4[_0xa45f('0x32')]=_['keys'](_0x5c058f[_0xa45f('0x32')]);_0x3c31d4[_0xa45f('0x34')]=_[_0xa45f('0x35')](_0x3c31d4[_0xa45f('0x31')],_0x3c31d4['query']);_0x43be2b[_0xa45f('0x36')]=_[_0xa45f('0x35')](_0x3c31d4[_0xa45f('0x31')],qs[_0xa45f('0x37')](_0x5c058f['query'][_0xa45f('0x37')]));_0x43be2b[_0xa45f('0x36')]=_0x43be2b[_0xa45f('0x36')][_0xa45f('0x38')]?_0x43be2b[_0xa45f('0x36')]:_0x3c31d4['model'];if(_0x5c058f['query'][_0xa45f('0x40')]){_0x43be2b[_0xa45f('0x41')]=[{'all':!![]}];}_0x43be2b=_[_0xa45f('0x3e')]({},_0x43be2b,_0x5c058f[_0xa45f('0x46')]);return db[_0xa45f('0x2d')]['find'](_0x43be2b)[_0xa45f('0x26')](handleEntityNotFound(_0x12f6f2,null))[_0xa45f('0x26')](respondWithResult(_0x12f6f2,null))[_0xa45f('0x43')](handleError(_0x12f6f2,null));};exports[_0xa45f('0x47')]=function(_0x34b3e3,_0x1a92b3){return db[_0xa45f('0x2d')]['create'](_0x34b3e3[_0xa45f('0x48')],{})[_0xa45f('0x26')](respondWithResult(_0x1a92b3,0xc9))[_0xa45f('0x43')](handleError(_0x1a92b3,null));};exports[_0xa45f('0x49')]=function(_0x1c734e,_0x2bf9f2){if(_0x1c734e['body']['id']){delete _0x1c734e[_0xa45f('0x48')]['id'];}return db[_0xa45f('0x2d')]['find']({'where':{'id':_0x1c734e['params']['id']}})[_0xa45f('0x26')](handleEntityNotFound(_0x2bf9f2,null))[_0xa45f('0x26')](saveUpdates(_0x1c734e['body'],null))[_0xa45f('0x26')](respondWithResult(_0x2bf9f2,null))['catch'](handleError(_0x2bf9f2,null));};exports['destroy']=function(_0x36cf5a,_0xfde208){return db[_0xa45f('0x2d')][_0xa45f('0x4a')]({'where':{'id':_0x36cf5a[_0xa45f('0x45')]['id']}})[_0xa45f('0x26')](handleEntityNotFound(_0xfde208,null))[_0xa45f('0x26')](removeEntity(_0xfde208,null))[_0xa45f('0x43')](handleError(_0xfde208,null));};exports[_0xa45f('0x4b')]=function(_0x4bbe5f,_0x2d1d40){return db[_0xa45f('0x2d')][_0xa45f('0x4b')]()[_0xa45f('0x26')](respondWithResult(_0x2d1d40,null))[_0xa45f('0x43')](handleError(_0x2d1d40,null));}; \ No newline at end of file +var _0x55c1=['includeAll','find','create','update','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','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','set','apply','save','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','model','keys','intersection','query','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','fields','length'];(function(_0x507ac5,_0x33aaee){var _0x12c1bc=function(_0x5c953c){while(--_0x5c953c){_0x507ac5['push'](_0x507ac5['shift']());}};_0x12c1bc(++_0x33aaee);}(_0x55c1,0x9d));var _0x155c=function(_0x462042,_0x524279){_0x462042=_0x462042-0x0;var _0x585608=_0x55c1[_0x462042];return _0x585608;};'use strict';var emlformat=require(_0x155c('0x0'));var rimraf=require(_0x155c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x155c('0x2'));var rp=require(_0x155c('0x3'));var moment=require(_0x155c('0x4'));var BPromise=require(_0x155c('0x5'));var Mustache=require(_0x155c('0x6'));var util=require('util');var path=require('path');var sox=require(_0x155c('0x7'));var csv=require('to-csv');var ejs=require(_0x155c('0x8'));var fs=require('fs');var fs_extra=require(_0x155c('0x9'));var _=require('lodash');var squel=require(_0x155c('0xa'));var crypto=require(_0x155c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x155c('0xc'));var toCsv=require(_0x155c('0xd'));var querystring=require(_0x155c('0xe'));var Papa=require(_0x155c('0xf'));var Redis=require(_0x155c('0x10'));var authService=require(_0x155c('0x11'));var qs=require(_0x155c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x155c('0x13'));var logger=require(_0x155c('0x14'))(_0x155c('0x15'));var utils=require(_0x155c('0x16'));var config=require(_0x155c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x155c('0x18'))['db'];function respondWithStatusCode(_0x5a8a81,_0xc4fb1){_0xc4fb1=_0xc4fb1||0xcc;return function(_0x5512ad){if(_0x5512ad){return _0x5a8a81[_0x155c('0x19')](_0xc4fb1);}return _0x5a8a81[_0x155c('0x1a')](_0xc4fb1)[_0x155c('0x1b')]();};}function respondWithResult(_0x3e18e4,_0x40de2e){_0x40de2e=_0x40de2e||0xc8;return function(_0x522bed){if(_0x522bed){return _0x3e18e4['status'](_0x40de2e)[_0x155c('0x1c')](_0x522bed);}};}function respondWithFilteredResult(_0x5c0c0a,_0x3f278d){return function(_0x463e29){if(_0x463e29){var _0x1869d3=typeof _0x3f278d[_0x155c('0x1d')]===_0x155c('0x1e')&&typeof _0x3f278d[_0x155c('0x1f')]===_0x155c('0x1e');var _0x4651d6=_0x463e29['count'];var _0x5cb92b=_0x1869d3?0x0:_0x3f278d[_0x155c('0x1d')];var _0x5981dd=_0x1869d3?_0x463e29[_0x155c('0x20')]:_0x3f278d[_0x155c('0x1d')]+_0x3f278d['limit'];var _0x19ba8e;if(_0x5981dd>=_0x4651d6){_0x5981dd=_0x4651d6;_0x19ba8e=0xc8;}else{_0x19ba8e=0xce;}_0x5c0c0a[_0x155c('0x1a')](_0x19ba8e);return _0x5c0c0a[_0x155c('0x21')]('Content-Range',_0x5cb92b+'-'+_0x5981dd+'/'+_0x4651d6)[_0x155c('0x1c')](_0x463e29);}return null;};}function patchUpdates(_0x139690){return function(_0x22a67b){try{jsonpatch[_0x155c('0x22')](_0x22a67b,_0x139690,!![]);}catch(_0x235aa8){return BPromise['reject'](_0x235aa8);}return _0x22a67b[_0x155c('0x23')]();};}function saveUpdates(_0x2065f3,_0x2d93c3){return function(_0x1d65d0){if(_0x1d65d0){return _0x1d65d0['update'](_0x2065f3)[_0x155c('0x24')](function(_0x3fd42f){return _0x3fd42f;});}return null;};}function removeEntity(_0x50d03f,_0x19d7a4){return function(_0x3daa2b){if(_0x3daa2b){return _0x3daa2b[_0x155c('0x25')]()[_0x155c('0x24')](function(){_0x50d03f[_0x155c('0x1a')](0xcc)[_0x155c('0x1b')]();});}};}function handleEntityNotFound(_0x512bf9,_0xc79f9c){return function(_0x1d9435){if(!_0x1d9435){_0x512bf9[_0x155c('0x19')](0x194);}return _0x1d9435;};}function handleError(_0x50b3ba,_0x4b35f4){_0x4b35f4=_0x4b35f4||0x1f4;return function(_0x58fc11){logger[_0x155c('0x26')](_0x58fc11[_0x155c('0x27')]);if(_0x58fc11[_0x155c('0x28')]){delete _0x58fc11[_0x155c('0x28')];}_0x50b3ba[_0x155c('0x1a')](_0x4b35f4)[_0x155c('0x29')](_0x58fc11);};}exports[_0x155c('0x2a')]=function(_0x552c3e,_0x3ef5db){var _0x58613f={},_0x44c8b8={},_0x1b1cdf={'count':0x0,'rows':[]};var _0x52d1ac=_[_0x155c('0x2b')](db[_0x155c('0x2c')][_0x155c('0x2d')],function(_0x3373c6){return{'name':_0x3373c6['fieldName'],'type':_0x3373c6[_0x155c('0x2e')]['key']};});_0x44c8b8[_0x155c('0x2f')]=_[_0x155c('0x2b')](_0x52d1ac,_0x155c('0x28'));_0x44c8b8['query']=_[_0x155c('0x30')](_0x552c3e['query']);_0x44c8b8['filters']=_[_0x155c('0x31')](_0x44c8b8[_0x155c('0x2f')],_0x44c8b8[_0x155c('0x32')]);_0x58613f[_0x155c('0x33')]=_[_0x155c('0x31')](_0x44c8b8[_0x155c('0x2f')],qs['fields'](_0x552c3e['query']['fields']));_0x58613f['attributes']=_0x58613f[_0x155c('0x33')]['length']?_0x58613f[_0x155c('0x33')]:_0x44c8b8[_0x155c('0x2f')];if(!_0x552c3e[_0x155c('0x32')][_0x155c('0x34')](_0x155c('0x35'))){_0x58613f[_0x155c('0x1f')]=qs['limit'](_0x552c3e[_0x155c('0x32')]['limit']);_0x58613f[_0x155c('0x1d')]=qs[_0x155c('0x1d')](_0x552c3e[_0x155c('0x32')][_0x155c('0x1d')]);}_0x58613f['order']=qs[_0x155c('0x36')](_0x552c3e[_0x155c('0x32')][_0x155c('0x36')]);_0x58613f[_0x155c('0x37')]=qs[_0x155c('0x38')](_[_0x155c('0x39')](_0x552c3e[_0x155c('0x32')],_0x44c8b8[_0x155c('0x38')]),_0x52d1ac);if(_0x552c3e[_0x155c('0x32')][_0x155c('0x3a')]){_0x58613f[_0x155c('0x37')]=_['merge'](_0x58613f['where'],{'$or':_[_0x155c('0x2b')](_0x52d1ac,function(_0x2394fd){if(_0x2394fd['type']!==_0x155c('0x3b')){var _0x56905e={};_0x56905e[_0x2394fd[_0x155c('0x28')]]={'$like':'%'+_0x552c3e[_0x155c('0x32')][_0x155c('0x3a')]+'%'};return _0x56905e;}})});}_0x58613f=_[_0x155c('0x3c')]({},_0x58613f,_0x552c3e[_0x155c('0x3d')]);var _0x1aa6e7={'where':_0x58613f[_0x155c('0x37')]};return db[_0x155c('0x2c')][_0x155c('0x20')](_0x1aa6e7)[_0x155c('0x24')](function(_0x41d31c){_0x1b1cdf['count']=_0x41d31c;if(_0x552c3e[_0x155c('0x32')]['includeAll']){_0x58613f[_0x155c('0x3e')]=[{'all':!![]}];}return db[_0x155c('0x2c')][_0x155c('0x3f')](_0x58613f);})['then'](function(_0x31d80d){_0x1b1cdf[_0x155c('0x40')]=_0x31d80d;return _0x1b1cdf;})[_0x155c('0x24')](respondWithFilteredResult(_0x3ef5db,_0x58613f))[_0x155c('0x41')](handleError(_0x3ef5db,null));};exports['show']=function(_0x572b16,_0xfbeb){var _0x14d25a={'raw':!![],'where':{'id':_0x572b16['params']['id']}},_0x87d8b2={};_0x87d8b2['model']=_[_0x155c('0x30')](db[_0x155c('0x2c')][_0x155c('0x2d')]);_0x87d8b2[_0x155c('0x32')]=_[_0x155c('0x30')](_0x572b16[_0x155c('0x32')]);_0x87d8b2[_0x155c('0x38')]=_['intersection'](_0x87d8b2[_0x155c('0x2f')],_0x87d8b2['query']);_0x14d25a[_0x155c('0x33')]=_['intersection'](_0x87d8b2['model'],qs[_0x155c('0x42')](_0x572b16[_0x155c('0x32')][_0x155c('0x42')]));_0x14d25a[_0x155c('0x33')]=_0x14d25a[_0x155c('0x33')][_0x155c('0x43')]?_0x14d25a['attributes']:_0x87d8b2['model'];if(_0x572b16[_0x155c('0x32')][_0x155c('0x44')]){_0x14d25a[_0x155c('0x3e')]=[{'all':!![]}];}_0x14d25a=_[_0x155c('0x3c')]({},_0x14d25a,_0x572b16['options']);return db['SmsQueueReport'][_0x155c('0x45')](_0x14d25a)[_0x155c('0x24')](handleEntityNotFound(_0xfbeb,null))[_0x155c('0x24')](respondWithResult(_0xfbeb,null))[_0x155c('0x41')](handleError(_0xfbeb,null));};exports[_0x155c('0x46')]=function(_0x2c3441,_0x4afa1b){return db['SmsQueueReport'][_0x155c('0x46')](_0x2c3441['body'],{})[_0x155c('0x24')](respondWithResult(_0x4afa1b,0xc9))[_0x155c('0x41')](handleError(_0x4afa1b,null));};exports[_0x155c('0x47')]=function(_0x177615,_0x207d71){if(_0x177615[_0x155c('0x48')]['id']){delete _0x177615[_0x155c('0x48')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x177615[_0x155c('0x49')]['id']}})['then'](handleEntityNotFound(_0x207d71,null))[_0x155c('0x24')](saveUpdates(_0x177615[_0x155c('0x48')],null))[_0x155c('0x24')](respondWithResult(_0x207d71,null))[_0x155c('0x41')](handleError(_0x207d71,null));};exports['destroy']=function(_0x59abc1,_0xee89b5){return db[_0x155c('0x2c')][_0x155c('0x45')]({'where':{'id':_0x59abc1[_0x155c('0x49')]['id']}})[_0x155c('0x24')](handleEntityNotFound(_0xee89b5,null))['then'](removeEntity(_0xee89b5,null))[_0x155c('0x41')](handleError(_0xee89b5,null));};exports[_0x155c('0x4a')]=function(_0xa5b1d0,_0x541755){return db[_0x155c('0x2c')][_0x155c('0x4a')]()[_0x155c('0x24')](respondWithResult(_0x541755,null))[_0x155c('0x41')](handleError(_0x541755,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 904ff5e..3223a02 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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2fa800,_0x131c8e){var _0x10be69=function(_0x2e5b45){while(--_0x2e5b45){_0x2fa800['push'](_0x2fa800['shift']());}};_0x10be69(++_0x131c8e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index c2b1990..8c9a907 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 _0x4d55=['info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','catch','UpdateSmsQueueReport','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2b36f5,_0x5732dc){var _0x5f06b6=function(_0x5def4f){while(--_0x5def4f){_0x2b36f5['push'](_0x2b36f5['shift']());}};_0x5f06b6(++_0x5732dc);}(_0x4d55,0xe0));var _0x54d5=function(_0x470396,_0x3b01cb){_0x470396=_0x470396-0x0;var _0xfa58d9=_0x4d55[_0x470396];return _0xfa58d9;};'use strict';var _=require(_0x54d5('0x0'));var util=require('util');var moment=require(_0x54d5('0x1'));var BPromise=require(_0x54d5('0x2'));var rs=require(_0x54d5('0x3'));var fs=require('fs');var Redis=require(_0x54d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x54d5('0x5'));var logger=require(_0x54d5('0x6'))(_0x54d5('0x7'));var config=require(_0x54d5('0x8'));var jayson=require(_0x54d5('0x9'));var client=jayson[_0x54d5('0xa')][_0x54d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d6014,_0x1fd503,_0x49dca4){return new BPromise(function(_0x40de8b,_0x2979ab){return client[_0x54d5('0xc')](_0x1d6014,_0x49dca4)[_0x54d5('0xd')](function(_0x4a0038){logger[_0x54d5('0xe')](_0x54d5('0xf'),_0x1fd503,'request\x20sent');logger[_0x54d5('0x10')](_0x54d5('0x11'),_0x1fd503,_0x54d5('0x12'),JSON[_0x54d5('0x13')](_0x4a0038));if(_0x4a0038[_0x54d5('0x14')]){if(_0x4a0038[_0x54d5('0x14')]['code']===0x1f4){logger[_0x54d5('0x14')](_0x54d5('0xf'),_0x1fd503,_0x4a0038[_0x54d5('0x14')][_0x54d5('0x15')]);return _0x2979ab(_0x4a0038['error'][_0x54d5('0x15')]);}logger[_0x54d5('0x14')](_0x54d5('0xf'),_0x1fd503,_0x4a0038[_0x54d5('0x14')]['message']);return _0x40de8b(_0x4a0038['error'][_0x54d5('0x15')]);}else{logger[_0x54d5('0xe')](_0x54d5('0xf'),_0x1fd503,'request\x20sent');_0x40de8b(_0x4a0038[_0x54d5('0x16')]['message']);}})['catch'](function(_0x3417c9){logger[_0x54d5('0x14')](_0x54d5('0xf'),_0x1fd503,_0x3417c9);_0x2979ab(_0x3417c9);});});}exports[_0x54d5('0x17')]=function(_0xc4b3a0){var _0xd0a49=this;return new Promise(function(_0x81232,_0x21cd1a){return db[_0x54d5('0x18')][_0x54d5('0x19')](_0xc4b3a0[_0x54d5('0x1a')],{'raw':_0xc4b3a0[_0x54d5('0x1b')]?_0xc4b3a0['options'][_0x54d5('0x1c')]===undefined?!![]:![]:!![]})[_0x54d5('0xd')](function(_0x33dcca){logger[_0x54d5('0xe')]('CreateSmsQueueReport',_0xc4b3a0);logger[_0x54d5('0x10')](_0x54d5('0x17'),_0xc4b3a0,JSON[_0x54d5('0x13')](_0x33dcca));_0x81232(_0x33dcca);})[_0x54d5('0x1d')](function(_0x1e0ae7){logger[_0x54d5('0x14')]('CreateSmsQueueReport',_0x1e0ae7[_0x54d5('0x15')],_0xc4b3a0);_0x21cd1a(_0xd0a49['error'](0x1f4,_0x1e0ae7[_0x54d5('0x15')]));});});};exports[_0x54d5('0x1e')]=function(_0x5051bc){var _0x446c69=this;return new Promise(function(_0x4907bc,_0x1e122c){return db[_0x54d5('0x18')]['update'](_0x5051bc[_0x54d5('0x1a')],{'raw':_0x5051bc[_0x54d5('0x1b')]?_0x5051bc[_0x54d5('0x1b')][_0x54d5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5051bc[_0x54d5('0x1b')]?_0x5051bc[_0x54d5('0x1b')][_0x54d5('0x1f')]||null:null,'attributes':_0x5051bc[_0x54d5('0x1b')]?_0x5051bc[_0x54d5('0x1b')][_0x54d5('0x20')]||null:null,'limit':_0x5051bc[_0x54d5('0x1b')]?_0x5051bc['options'][_0x54d5('0x21')]||null:null})[_0x54d5('0xd')](function(_0x1cc9ca){logger[_0x54d5('0xe')](_0x54d5('0x1e'),_0x5051bc);logger[_0x54d5('0x10')](_0x54d5('0x1e'),_0x5051bc,JSON[_0x54d5('0x13')](_0x1cc9ca));_0x4907bc(_0x1cc9ca);})[_0x54d5('0x1d')](function(_0xd0c19c){logger[_0x54d5('0x14')](_0x54d5('0x1e'),_0xd0c19c[_0x54d5('0x15')],_0x5051bc);_0x1e122c(_0x446c69[_0x54d5('0x14')](0x1f4,_0xd0c19c['message']));});});}; \ No newline at end of file +var _0xd7d1=['options','raw','then','CreateSmsQueueReport','stringify','UpdateSmsQueueReport','update','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','SmsQueueReport','create','body'];(function(_0x22a9db,_0x4506c5){var _0x35715a=function(_0x4d9998){while(--_0x4d9998){_0x22a9db['push'](_0x22a9db['shift']());}};_0x35715a(++_0x4506c5);}(_0xd7d1,0xf8));var _0x1d7d=function(_0x3caa0a,_0x56ef22){_0x3caa0a=_0x3caa0a-0x0;var _0x249f04=_0xd7d1[_0x3caa0a];return _0x249f04;};'use strict';var _=require(_0x1d7d('0x0'));var util=require('util');var moment=require(_0x1d7d('0x1'));var BPromise=require(_0x1d7d('0x2'));var rs=require(_0x1d7d('0x3'));var fs=require('fs');var Redis=require(_0x1d7d('0x4'));var db=require(_0x1d7d('0x5'))['db'];var utils=require(_0x1d7d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1d7d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1d7d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b6c2e,_0x3b4a38,_0x30a701){return new BPromise(function(_0x9e28bd,_0x30fd10){return client[_0x1d7d('0x9')](_0x3b6c2e,_0x30a701)['then'](function(_0x9b7e8c){logger[_0x1d7d('0xa')](_0x1d7d('0xb'),_0x3b4a38,_0x1d7d('0xc'));logger[_0x1d7d('0xd')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3b4a38,_0x1d7d('0xc'),JSON['stringify'](_0x9b7e8c));if(_0x9b7e8c['error']){if(_0x9b7e8c[_0x1d7d('0xe')][_0x1d7d('0xf')]===0x1f4){logger[_0x1d7d('0xe')](_0x1d7d('0xb'),_0x3b4a38,_0x9b7e8c[_0x1d7d('0xe')]['message']);return _0x30fd10(_0x9b7e8c[_0x1d7d('0xe')][_0x1d7d('0x10')]);}logger['error'](_0x1d7d('0xb'),_0x3b4a38,_0x9b7e8c[_0x1d7d('0xe')][_0x1d7d('0x10')]);return _0x9e28bd(_0x9b7e8c[_0x1d7d('0xe')][_0x1d7d('0x10')]);}else{logger[_0x1d7d('0xa')](_0x1d7d('0xb'),_0x3b4a38,_0x1d7d('0xc'));_0x9e28bd(_0x9b7e8c[_0x1d7d('0x11')][_0x1d7d('0x10')]);}})[_0x1d7d('0x12')](function(_0xb8e450){logger[_0x1d7d('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x3b4a38,_0xb8e450);_0x30fd10(_0xb8e450);});});}exports['CreateSmsQueueReport']=function(_0x420d67){var _0x5bad96=this;return new Promise(function(_0x1d2c2c,_0x2f600f){return db[_0x1d7d('0x13')][_0x1d7d('0x14')](_0x420d67[_0x1d7d('0x15')],{'raw':_0x420d67['options']?_0x420d67[_0x1d7d('0x16')][_0x1d7d('0x17')]===undefined?!![]:![]:!![]})[_0x1d7d('0x18')](function(_0x5c61c5){logger[_0x1d7d('0xa')](_0x1d7d('0x19'),_0x420d67);logger['debug'](_0x1d7d('0x19'),_0x420d67,JSON[_0x1d7d('0x1a')](_0x5c61c5));_0x1d2c2c(_0x5c61c5);})[_0x1d7d('0x12')](function(_0x1ff6f0){logger[_0x1d7d('0xe')](_0x1d7d('0x19'),_0x1ff6f0['message'],_0x420d67);_0x2f600f(_0x5bad96[_0x1d7d('0xe')](0x1f4,_0x1ff6f0['message']));});});};exports[_0x1d7d('0x1b')]=function(_0x5643db){var _0x419cfd=this;return new Promise(function(_0x4a835e,_0x32b86b){return db[_0x1d7d('0x13')][_0x1d7d('0x1c')](_0x5643db[_0x1d7d('0x15')],{'raw':_0x5643db[_0x1d7d('0x16')]?_0x5643db[_0x1d7d('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5643db[_0x1d7d('0x16')]?_0x5643db[_0x1d7d('0x16')]['where']||null:null,'attributes':_0x5643db[_0x1d7d('0x16')]?_0x5643db[_0x1d7d('0x16')]['attributes']||null:null,'limit':_0x5643db['options']?_0x5643db[_0x1d7d('0x16')][_0x1d7d('0x1d')]||null:null})[_0x1d7d('0x18')](function(_0x10d24e){logger[_0x1d7d('0xa')](_0x1d7d('0x1b'),_0x5643db);logger['debug'](_0x1d7d('0x1b'),_0x5643db,JSON[_0x1d7d('0x1a')](_0x10d24e));_0x4a835e(_0x10d24e);})[_0x1d7d('0x12')](function(_0x527387){logger[_0x1d7d('0xe')](_0x1d7d('0x1b'),_0x527387[_0x1d7d('0x10')],_0x5643db);_0x32b86b(_0x419cfd[_0x1d7d('0xe')](0x1f4,_0x527387[_0x1d7d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index c01bb94..dc82988 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 _0x8d0e=['/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get'];(function(_0x3e29c2,_0x10e2f5){var _0x1d3af2=function(_0x5443a9){while(--_0x5443a9){_0x3e29c2['push'](_0x3e29c2['shift']());}};_0x1d3af2(++_0x10e2f5);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x125d24,_0x2a26e6){_0x125d24=_0x125d24-0x0;var _0x11e25b=_0x8d0e[_0x125d24];return _0x11e25b;};'use strict';var multer=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var path=require(_0xe8d0('0x2'));var timeout=require(_0xe8d0('0x3'));var express=require(_0xe8d0('0x4'));var router=express[_0xe8d0('0x5')]();var fs_extra=require(_0xe8d0('0x6'));var auth=require(_0xe8d0('0x7'));var interaction=require(_0xe8d0('0x8'));var config=require('../../config/environment');var controller=require(_0xe8d0('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0xe')]);router[_0xe8d0('0xb')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller['show']);router[_0xe8d0('0x10')]('/',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x11')]);router['put']('/:id',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x12')]);router[_0xe8d0('0x13')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe181=['/describe','isAuthenticated','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe181,0x68));var _0x1e18=function(_0x1b0c08,_0xd7531f){_0x1b0c08=_0x1b0c08-0x0;var _0x123dbf=_0xe181[_0x1b0c08];return _0x123dbf;};'use strict';var multer=require(_0x1e18('0x0'));var util=require('util');var path=require(_0x1e18('0x1'));var timeout=require(_0x1e18('0x2'));var express=require(_0x1e18('0x3'));var router=express[_0x1e18('0x4')]();var fs_extra=require(_0x1e18('0x5'));var auth=require(_0x1e18('0x6'));var interaction=require(_0x1e18('0x7'));var config=require('../../config/environment');var controller=require(_0x1e18('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1e18('0x9')]);router[_0x1e18('0xa')](_0x1e18('0xb'),auth[_0x1e18('0xc')](),controller[_0x1e18('0xd')]);router[_0x1e18('0xa')]('/:id',auth[_0x1e18('0xc')](),controller[_0x1e18('0xe')]);router[_0x1e18('0xf')]('/',auth[_0x1e18('0xc')](),controller[_0x1e18('0x10')]);router[_0x1e18('0x11')]('/:id',auth[_0x1e18('0xc')](),controller[_0x1e18('0x12')]);router[_0x1e18('0x13')](_0x1e18('0x14'),auth[_0x1e18('0xc')](),controller[_0x1e18('0x15')]);module[_0x1e18('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 9c12da1..028dbd5 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x347498,_0x332242){var _0x334f2b=function(_0x4156d1){while(--_0x4156d1){_0x347498['push'](_0x347498['shift']());}};_0x334f2b(++_0x332242);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x17017e,_0x509679){var _0xbc7086=function(_0x30679d){while(--_0x30679d){_0x17017e['push'](_0x17017e['shift']());}};_0xbc7086(++_0x509679);}(_0x34e8,0x12c));var _0x834e=function(_0x3b5e45,_0x5cff56){_0x3b5e45=_0x3b5e45-0x0;var _0x43b3f8=_0x34e8[_0x3b5e45];return _0x43b3f8;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 7270344..92032dc 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 _0x9c7a=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','SmsTransferReport','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs'];(function(_0x33de06,_0x380ff8){var _0x42f5fb=function(_0x5e3a8a){while(--_0x5e3a8a){_0x33de06['push'](_0x33de06['shift']());}};_0x42f5fb(++_0x380ff8);}(_0x9c7a,0x115));var _0xa9c7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c7a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa9c7('0x0'));var rimraf=require(_0xa9c7('0x1'));var zipdir=require(_0xa9c7('0x2'));var jsonpatch=require(_0xa9c7('0x3'));var rp=require(_0xa9c7('0x4'));var moment=require(_0xa9c7('0x5'));var BPromise=require(_0xa9c7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa9c7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c7('0x8'));var _=require(_0xa9c7('0x9'));var squel=require('squel');var crypto=require(_0xa9c7('0xa'));var jsforce=require(_0xa9c7('0xb'));var deskjs=require(_0xa9c7('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa9c7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa9c7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9c7('0xf'));var logger=require(_0xa9c7('0x10'))('api');var utils=require(_0xa9c7('0x11'));var config=require(_0xa9c7('0x12'));var licenseUtil=require(_0xa9c7('0x13'));var db=require(_0xa9c7('0x14'))['db'];function respondWithStatusCode(_0x25916b,_0x59536a){_0x59536a=_0x59536a||0xcc;return function(_0x4386e3){if(_0x4386e3){return _0x25916b[_0xa9c7('0x15')](_0x59536a);}return _0x25916b['status'](_0x59536a)[_0xa9c7('0x16')]();};}function respondWithResult(_0x443f2d,_0x394bf4){_0x394bf4=_0x394bf4||0xc8;return function(_0xd32302){if(_0xd32302){return _0x443f2d[_0xa9c7('0x17')](_0x394bf4)[_0xa9c7('0x18')](_0xd32302);}};}function respondWithFilteredResult(_0x1b874c,_0x5c32a6){return function(_0x2eddbb){if(_0x2eddbb){var _0x1c9982=typeof _0x5c32a6[_0xa9c7('0x19')]===_0xa9c7('0x1a')&&typeof _0x5c32a6[_0xa9c7('0x1b')]===_0xa9c7('0x1a');var _0x554818=_0x2eddbb[_0xa9c7('0x1c')];var _0x306b55=_0x1c9982?0x0:_0x5c32a6[_0xa9c7('0x19')];var _0x3686d8=_0x1c9982?_0x2eddbb['count']:_0x5c32a6[_0xa9c7('0x19')]+_0x5c32a6['limit'];var _0xf49124;if(_0x3686d8>=_0x554818){_0x3686d8=_0x554818;_0xf49124=0xc8;}else{_0xf49124=0xce;}_0x1b874c[_0xa9c7('0x17')](_0xf49124);return _0x1b874c[_0xa9c7('0x1d')]('Content-Range',_0x306b55+'-'+_0x3686d8+'/'+_0x554818)[_0xa9c7('0x18')](_0x2eddbb);}return null;};}function patchUpdates(_0x25e928){return function(_0x297195){try{jsonpatch[_0xa9c7('0x1e')](_0x297195,_0x25e928,!![]);}catch(_0x40be79){return BPromise[_0xa9c7('0x1f')](_0x40be79);}return _0x297195[_0xa9c7('0x20')]();};}function saveUpdates(_0x29f54b,_0x3158c7){return function(_0x2add46){if(_0x2add46){return _0x2add46[_0xa9c7('0x21')](_0x29f54b)[_0xa9c7('0x22')](function(_0x3ef895){return _0x3ef895;});}return null;};}function removeEntity(_0x34c421,_0x155ed6){return function(_0x137b1c){if(_0x137b1c){return _0x137b1c[_0xa9c7('0x23')]()[_0xa9c7('0x22')](function(){_0x34c421['status'](0xcc)[_0xa9c7('0x16')]();});}};}function handleEntityNotFound(_0x5215ca,_0x2612f2){return function(_0x3dc609){if(!_0x3dc609){_0x5215ca[_0xa9c7('0x15')](0x194);}return _0x3dc609;};}function handleError(_0x3d69ba,_0x39ff4b){_0x39ff4b=_0x39ff4b||0x1f4;return function(_0x5218e2){logger[_0xa9c7('0x24')](_0x5218e2['stack']);if(_0x5218e2[_0xa9c7('0x25')]){delete _0x5218e2[_0xa9c7('0x25')];}_0x3d69ba['status'](_0x39ff4b)[_0xa9c7('0x26')](_0x5218e2);};}exports[_0xa9c7('0x27')]=function(_0x325bb5,_0x407e10){var _0x151fa9={},_0x5a4752={},_0x5cc598={'count':0x0,'rows':[]};var _0x5afb71=_['map'](db[_0xa9c7('0x28')]['rawAttributes'],function(_0x471008){return{'name':_0x471008[_0xa9c7('0x29')],'type':_0x471008[_0xa9c7('0x2a')][_0xa9c7('0x2b')]};});_0x5a4752[_0xa9c7('0x2c')]=_[_0xa9c7('0x2d')](_0x5afb71,_0xa9c7('0x25'));_0x5a4752[_0xa9c7('0x2e')]=_[_0xa9c7('0x2f')](_0x325bb5[_0xa9c7('0x2e')]);_0x5a4752['filters']=_[_0xa9c7('0x30')](_0x5a4752[_0xa9c7('0x2c')],_0x5a4752[_0xa9c7('0x2e')]);_0x151fa9[_0xa9c7('0x31')]=_['intersection'](_0x5a4752[_0xa9c7('0x2c')],qs['fields'](_0x325bb5[_0xa9c7('0x2e')][_0xa9c7('0x32')]));_0x151fa9[_0xa9c7('0x31')]=_0x151fa9['attributes'][_0xa9c7('0x33')]?_0x151fa9[_0xa9c7('0x31')]:_0x5a4752[_0xa9c7('0x2c')];if(!_0x325bb5[_0xa9c7('0x2e')]['hasOwnProperty'](_0xa9c7('0x34'))){_0x151fa9['limit']=qs[_0xa9c7('0x1b')](_0x325bb5[_0xa9c7('0x2e')]['limit']);_0x151fa9[_0xa9c7('0x19')]=qs['offset'](_0x325bb5['query'][_0xa9c7('0x19')]);}_0x151fa9[_0xa9c7('0x35')]=qs['sort'](_0x325bb5['query'][_0xa9c7('0x36')]);_0x151fa9[_0xa9c7('0x37')]=qs[_0xa9c7('0x38')](_[_0xa9c7('0x39')](_0x325bb5[_0xa9c7('0x2e')],_0x5a4752['filters']),_0x5afb71);if(_0x325bb5[_0xa9c7('0x2e')][_0xa9c7('0x3a')]){_0x151fa9[_0xa9c7('0x37')]=_[_0xa9c7('0x3b')](_0x151fa9[_0xa9c7('0x37')],{'$or':_[_0xa9c7('0x2d')](_0x5afb71,function(_0xe9ca3b){if(_0xe9ca3b[_0xa9c7('0x2a')]!==_0xa9c7('0x3c')){var _0x598f4f={};_0x598f4f[_0xe9ca3b[_0xa9c7('0x25')]]={'$like':'%'+_0x325bb5[_0xa9c7('0x2e')][_0xa9c7('0x3a')]+'%'};return _0x598f4f;}})});}_0x151fa9=_[_0xa9c7('0x3b')]({},_0x151fa9,_0x325bb5[_0xa9c7('0x3d')]);var _0x3b1331={'where':_0x151fa9['where']};return db[_0xa9c7('0x28')][_0xa9c7('0x1c')](_0x3b1331)['then'](function(_0x5dfe19){_0x5cc598[_0xa9c7('0x1c')]=_0x5dfe19;if(_0x325bb5[_0xa9c7('0x2e')][_0xa9c7('0x3e')]){_0x151fa9[_0xa9c7('0x3f')]=[{'all':!![]}];}return db[_0xa9c7('0x28')]['findAll'](_0x151fa9);})[_0xa9c7('0x22')](function(_0x1e9fad){_0x5cc598[_0xa9c7('0x40')]=_0x1e9fad;return _0x5cc598;})[_0xa9c7('0x22')](respondWithFilteredResult(_0x407e10,_0x151fa9))[_0xa9c7('0x41')](handleError(_0x407e10,null));};exports[_0xa9c7('0x42')]=function(_0x597936,_0xd350f2){var _0x5efd49={'raw':!![],'where':{'id':_0x597936['params']['id']}},_0x481baa={};_0x481baa[_0xa9c7('0x2c')]=_[_0xa9c7('0x2f')](db['SmsTransferReport'][_0xa9c7('0x43')]);_0x481baa[_0xa9c7('0x2e')]=_[_0xa9c7('0x2f')](_0x597936[_0xa9c7('0x2e')]);_0x481baa['filters']=_[_0xa9c7('0x30')](_0x481baa[_0xa9c7('0x2c')],_0x481baa[_0xa9c7('0x2e')]);_0x5efd49['attributes']=_[_0xa9c7('0x30')](_0x481baa[_0xa9c7('0x2c')],qs[_0xa9c7('0x32')](_0x597936[_0xa9c7('0x2e')][_0xa9c7('0x32')]));_0x5efd49[_0xa9c7('0x31')]=_0x5efd49[_0xa9c7('0x31')][_0xa9c7('0x33')]?_0x5efd49[_0xa9c7('0x31')]:_0x481baa['model'];if(_0x597936[_0xa9c7('0x2e')][_0xa9c7('0x3e')]){_0x5efd49[_0xa9c7('0x3f')]=[{'all':!![]}];}_0x5efd49=_[_0xa9c7('0x3b')]({},_0x5efd49,_0x597936[_0xa9c7('0x3d')]);return db[_0xa9c7('0x28')][_0xa9c7('0x44')](_0x5efd49)[_0xa9c7('0x22')](handleEntityNotFound(_0xd350f2,null))[_0xa9c7('0x22')](respondWithResult(_0xd350f2,null))['catch'](handleError(_0xd350f2,null));};exports[_0xa9c7('0x45')]=function(_0x288534,_0x43daac){return db['SmsTransferReport']['create'](_0x288534[_0xa9c7('0x46')],{})[_0xa9c7('0x22')](respondWithResult(_0x43daac,0xc9))['catch'](handleError(_0x43daac,null));};exports[_0xa9c7('0x21')]=function(_0x4ce619,_0x4dcd01){if(_0x4ce619[_0xa9c7('0x46')]['id']){delete _0x4ce619['body']['id'];}return db[_0xa9c7('0x28')][_0xa9c7('0x44')]({'where':{'id':_0x4ce619[_0xa9c7('0x47')]['id']}})['then'](handleEntityNotFound(_0x4dcd01,null))[_0xa9c7('0x22')](saveUpdates(_0x4ce619[_0xa9c7('0x46')],null))[_0xa9c7('0x22')](respondWithResult(_0x4dcd01,null))[_0xa9c7('0x41')](handleError(_0x4dcd01,null));};exports[_0xa9c7('0x23')]=function(_0x146735,_0x508b8a){return db[_0xa9c7('0x28')][_0xa9c7('0x44')]({'where':{'id':_0x146735[_0xa9c7('0x47')]['id']}})[_0xa9c7('0x22')](handleEntityNotFound(_0x508b8a,null))[_0xa9c7('0x22')](removeEntity(_0x508b8a,null))[_0xa9c7('0x41')](handleError(_0x508b8a,null));};exports['describe']=function(_0x383626,_0x660f53){return db[_0xa9c7('0x28')][_0xa9c7('0x48')]()[_0xa9c7('0x22')](respondWithResult(_0x660f53,null))['catch'](handleError(_0x660f53,null));}; \ No newline at end of file +var _0xa5e5=['mustache','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','SmsTransferReport','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','where','filter','merge','includeAll','rows','catch','show','rawAttributes','include','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0xa5e5,0x8f));var _0x5a5e=function(_0x13fd59,_0x2e05b1){_0x13fd59=_0x13fd59-0x0;var _0x2e6ce7=_0xa5e5[_0x13fd59];return _0x2e6ce7;};'use strict';var emlformat=require(_0x5a5e('0x0'));var rimraf=require(_0x5a5e('0x1'));var zipdir=require(_0x5a5e('0x2'));var jsonpatch=require(_0x5a5e('0x3'));var rp=require(_0x5a5e('0x4'));var moment=require(_0x5a5e('0x5'));var BPromise=require(_0x5a5e('0x6'));var Mustache=require(_0x5a5e('0x7'));var util=require('util');var path=require(_0x5a5e('0x8'));var sox=require(_0x5a5e('0x9'));var csv=require('to-csv');var ejs=require(_0x5a5e('0xa'));var fs=require('fs');var fs_extra=require(_0x5a5e('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5a5e('0xc'));var jsforce=require(_0x5a5e('0xd'));var deskjs=require(_0x5a5e('0xe'));var toCsv=require(_0x5a5e('0xf'));var querystring=require(_0x5a5e('0x10'));var Papa=require(_0x5a5e('0x11'));var Redis=require(_0x5a5e('0x12'));var authService=require(_0x5a5e('0x13'));var qs=require(_0x5a5e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a5e('0x15'))(_0x5a5e('0x16'));var utils=require(_0x5a5e('0x17'));var config=require(_0x5a5e('0x18'));var licenseUtil=require(_0x5a5e('0x19'));var db=require(_0x5a5e('0x1a'))['db'];function respondWithStatusCode(_0x30e534,_0x21a814){_0x21a814=_0x21a814||0xcc;return function(_0x5a55e5){if(_0x5a55e5){return _0x30e534[_0x5a5e('0x1b')](_0x21a814);}return _0x30e534[_0x5a5e('0x1c')](_0x21a814)[_0x5a5e('0x1d')]();};}function respondWithResult(_0x4663d7,_0xb02b7f){_0xb02b7f=_0xb02b7f||0xc8;return function(_0x1672a3){if(_0x1672a3){return _0x4663d7[_0x5a5e('0x1c')](_0xb02b7f)[_0x5a5e('0x1e')](_0x1672a3);}};}function respondWithFilteredResult(_0xd5bbf4,_0x5c52a9){return function(_0x188062){if(_0x188062){var _0x4a6f1b=typeof _0x5c52a9[_0x5a5e('0x1f')]===_0x5a5e('0x20')&&typeof _0x5c52a9[_0x5a5e('0x21')]===_0x5a5e('0x20');var _0x47b5b2=_0x188062[_0x5a5e('0x22')];var _0x173cc8=_0x4a6f1b?0x0:_0x5c52a9[_0x5a5e('0x1f')];var _0x26505c=_0x4a6f1b?_0x188062[_0x5a5e('0x22')]:_0x5c52a9['offset']+_0x5c52a9['limit'];var _0x1bc554;if(_0x26505c>=_0x47b5b2){_0x26505c=_0x47b5b2;_0x1bc554=0xc8;}else{_0x1bc554=0xce;}_0xd5bbf4[_0x5a5e('0x1c')](_0x1bc554);return _0xd5bbf4[_0x5a5e('0x23')]('Content-Range',_0x173cc8+'-'+_0x26505c+'/'+_0x47b5b2)[_0x5a5e('0x1e')](_0x188062);}return null;};}function patchUpdates(_0x256418){return function(_0x547d43){try{jsonpatch[_0x5a5e('0x24')](_0x547d43,_0x256418,!![]);}catch(_0x30e779){return BPromise[_0x5a5e('0x25')](_0x30e779);}return _0x547d43['save']();};}function saveUpdates(_0x4f7915,_0x122ba2){return function(_0x50309a){if(_0x50309a){return _0x50309a[_0x5a5e('0x26')](_0x4f7915)['then'](function(_0x3385c5){return _0x3385c5;});}return null;};}function removeEntity(_0x232d19,_0x50767a){return function(_0x9f3101){if(_0x9f3101){return _0x9f3101[_0x5a5e('0x27')]()[_0x5a5e('0x28')](function(){_0x232d19[_0x5a5e('0x1c')](0xcc)[_0x5a5e('0x1d')]();});}};}function handleEntityNotFound(_0x581c26,_0x22f28a){return function(_0x4026de){if(!_0x4026de){_0x581c26[_0x5a5e('0x1b')](0x194);}return _0x4026de;};}function handleError(_0x356591,_0x4227f1){_0x4227f1=_0x4227f1||0x1f4;return function(_0x5e8375){logger[_0x5a5e('0x29')](_0x5e8375[_0x5a5e('0x2a')]);if(_0x5e8375['name']){delete _0x5e8375[_0x5a5e('0x2b')];}_0x356591['status'](_0x4227f1)[_0x5a5e('0x2c')](_0x5e8375);};}exports[_0x5a5e('0x2d')]=function(_0x47ff2d,_0x25f4b9){var _0x3f06f6={},_0x3af7d5={},_0x19d800={'count':0x0,'rows':[]};var _0x32826c=_['map'](db[_0x5a5e('0x2e')]['rawAttributes'],function(_0x292f84){return{'name':_0x292f84[_0x5a5e('0x2f')],'type':_0x292f84[_0x5a5e('0x30')][_0x5a5e('0x31')]};});_0x3af7d5[_0x5a5e('0x32')]=_[_0x5a5e('0x33')](_0x32826c,'name');_0x3af7d5[_0x5a5e('0x34')]=_[_0x5a5e('0x35')](_0x47ff2d[_0x5a5e('0x34')]);_0x3af7d5[_0x5a5e('0x36')]=_[_0x5a5e('0x37')](_0x3af7d5['model'],_0x3af7d5[_0x5a5e('0x34')]);_0x3f06f6['attributes']=_[_0x5a5e('0x37')](_0x3af7d5['model'],qs[_0x5a5e('0x38')](_0x47ff2d[_0x5a5e('0x34')]['fields']));_0x3f06f6['attributes']=_0x3f06f6[_0x5a5e('0x39')][_0x5a5e('0x3a')]?_0x3f06f6[_0x5a5e('0x39')]:_0x3af7d5['model'];if(!_0x47ff2d['query']['hasOwnProperty']('nolimit')){_0x3f06f6['limit']=qs[_0x5a5e('0x21')](_0x47ff2d[_0x5a5e('0x34')]['limit']);_0x3f06f6[_0x5a5e('0x1f')]=qs[_0x5a5e('0x1f')](_0x47ff2d[_0x5a5e('0x34')][_0x5a5e('0x1f')]);}_0x3f06f6[_0x5a5e('0x3b')]=qs['sort'](_0x47ff2d['query']['sort']);_0x3f06f6[_0x5a5e('0x3c')]=qs[_0x5a5e('0x36')](_['pick'](_0x47ff2d[_0x5a5e('0x34')],_0x3af7d5[_0x5a5e('0x36')]),_0x32826c);if(_0x47ff2d[_0x5a5e('0x34')][_0x5a5e('0x3d')]){_0x3f06f6['where']=_[_0x5a5e('0x3e')](_0x3f06f6[_0x5a5e('0x3c')],{'$or':_[_0x5a5e('0x33')](_0x32826c,function(_0x3e7ae2){if(_0x3e7ae2[_0x5a5e('0x30')]!=='VIRTUAL'){var _0x404540={};_0x404540[_0x3e7ae2[_0x5a5e('0x2b')]]={'$like':'%'+_0x47ff2d['query'][_0x5a5e('0x3d')]+'%'};return _0x404540;}})});}_0x3f06f6=_[_0x5a5e('0x3e')]({},_0x3f06f6,_0x47ff2d['options']);var _0x40705b={'where':_0x3f06f6['where']};return db[_0x5a5e('0x2e')][_0x5a5e('0x22')](_0x40705b)['then'](function(_0x28b4ec){_0x19d800['count']=_0x28b4ec;if(_0x47ff2d[_0x5a5e('0x34')][_0x5a5e('0x3f')]){_0x3f06f6['include']=[{'all':!![]}];}return db[_0x5a5e('0x2e')]['findAll'](_0x3f06f6);})[_0x5a5e('0x28')](function(_0x19d0c0){_0x19d800[_0x5a5e('0x40')]=_0x19d0c0;return _0x19d800;})[_0x5a5e('0x28')](respondWithFilteredResult(_0x25f4b9,_0x3f06f6))[_0x5a5e('0x41')](handleError(_0x25f4b9,null));};exports[_0x5a5e('0x42')]=function(_0x2721a8,_0x4ed30f){var _0x1df542={'raw':!![],'where':{'id':_0x2721a8['params']['id']}},_0x33a631={};_0x33a631[_0x5a5e('0x32')]=_[_0x5a5e('0x35')](db[_0x5a5e('0x2e')][_0x5a5e('0x43')]);_0x33a631[_0x5a5e('0x34')]=_[_0x5a5e('0x35')](_0x2721a8[_0x5a5e('0x34')]);_0x33a631[_0x5a5e('0x36')]=_[_0x5a5e('0x37')](_0x33a631['model'],_0x33a631[_0x5a5e('0x34')]);_0x1df542[_0x5a5e('0x39')]=_[_0x5a5e('0x37')](_0x33a631['model'],qs[_0x5a5e('0x38')](_0x2721a8[_0x5a5e('0x34')][_0x5a5e('0x38')]));_0x1df542[_0x5a5e('0x39')]=_0x1df542[_0x5a5e('0x39')][_0x5a5e('0x3a')]?_0x1df542[_0x5a5e('0x39')]:_0x33a631[_0x5a5e('0x32')];if(_0x2721a8[_0x5a5e('0x34')][_0x5a5e('0x3f')]){_0x1df542[_0x5a5e('0x44')]=[{'all':!![]}];}_0x1df542=_[_0x5a5e('0x3e')]({},_0x1df542,_0x2721a8[_0x5a5e('0x45')]);return db[_0x5a5e('0x2e')][_0x5a5e('0x46')](_0x1df542)[_0x5a5e('0x28')](handleEntityNotFound(_0x4ed30f,null))[_0x5a5e('0x28')](respondWithResult(_0x4ed30f,null))[_0x5a5e('0x41')](handleError(_0x4ed30f,null));};exports[_0x5a5e('0x47')]=function(_0x375d61,_0x254ed5){return db[_0x5a5e('0x2e')][_0x5a5e('0x47')](_0x375d61[_0x5a5e('0x48')],{})[_0x5a5e('0x28')](respondWithResult(_0x254ed5,0xc9))[_0x5a5e('0x41')](handleError(_0x254ed5,null));};exports[_0x5a5e('0x26')]=function(_0x2cac1e,_0x3396a5){if(_0x2cac1e[_0x5a5e('0x48')]['id']){delete _0x2cac1e[_0x5a5e('0x48')]['id'];}return db[_0x5a5e('0x2e')][_0x5a5e('0x46')]({'where':{'id':_0x2cac1e[_0x5a5e('0x49')]['id']}})[_0x5a5e('0x28')](handleEntityNotFound(_0x3396a5,null))[_0x5a5e('0x28')](saveUpdates(_0x2cac1e[_0x5a5e('0x48')],null))[_0x5a5e('0x28')](respondWithResult(_0x3396a5,null))[_0x5a5e('0x41')](handleError(_0x3396a5,null));};exports[_0x5a5e('0x27')]=function(_0x18f841,_0x3e7e87){return db[_0x5a5e('0x2e')][_0x5a5e('0x46')]({'where':{'id':_0x18f841[_0x5a5e('0x49')]['id']}})[_0x5a5e('0x28')](handleEntityNotFound(_0x3e7e87,null))[_0x5a5e('0x28')](removeEntity(_0x3e7e87,null))['catch'](handleError(_0x3e7e87,null));};exports[_0x5a5e('0x4a')]=function(_0x3213f6,_0x4ff58e){return db['SmsTransferReport'][_0x5a5e('0x4a')]()[_0x5a5e('0x28')](respondWithResult(_0x4ff58e,null))['catch'](handleError(_0x4ff58e,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 3215fd4..fd614e9 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 _0x53cf=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','lodash','util'];(function(_0xfc36d8,_0x233b0b){var _0x234f42=function(_0xad4ac4){while(--_0xad4ac4){_0xfc36d8['push'](_0xfc36d8['shift']());}};_0x234f42(++_0x233b0b);}(_0x53cf,0x1b0));var _0xf53c=function(_0x4590fb,_0x4c3297){_0x4590fb=_0x4590fb-0x0;var _0x1499c0=_0x53cf[_0x4590fb];return _0x1499c0;};'use strict';var _=require(_0xf53c('0x0'));var util=require(_0xf53c('0x1'));var logger=require(_0xf53c('0x2'))(_0xf53c('0x3'));var moment=require(_0xf53c('0x4'));var BPromise=require(_0xf53c('0x5'));var rp=require(_0xf53c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf53c('0x7'));var config=require(_0xf53c('0x8'));var attributes=require(_0xf53c('0x9'));module[_0xf53c('0xa')]=function(_0x4ce1c9,_0x163377){return _0x4ce1c9[_0xf53c('0xb')](_0xf53c('0xc'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf53c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x30be=['uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer'];(function(_0x2fa6cb,_0x536842){var _0x6378ca=function(_0x4742c3){while(--_0x4742c3){_0x2fa6cb['push'](_0x2fa6cb['shift']());}};_0x6378ca(++_0x536842);}(_0x30be,0xe1));var _0xe30b=function(_0x11c6b8,_0x5b2d7b){_0x11c6b8=_0x11c6b8-0x0;var _0x38b38f=_0x30be[_0x11c6b8];return _0x38b38f;};'use strict';var _=require(_0xe30b('0x0'));var util=require(_0xe30b('0x1'));var logger=require(_0xe30b('0x2'))('api');var moment=require(_0xe30b('0x3'));var BPromise=require(_0xe30b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe30b('0x5'));var rimraf=require(_0xe30b('0x6'));var config=require(_0xe30b('0x7'));var attributes=require(_0xe30b('0x8'));module[_0xe30b('0x9')]=function(_0xac430b,_0x31fdc6){return _0xac430b[_0xe30b('0xa')](_0xe30b('0xb'),attributes,{'tableName':_0xe30b('0xc'),'paranoid':![],'indexes':[{'name':_0xe30b('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 462a888..767daa9 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 _0x1666=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x66ef11,_0x42f78b){var _0x318579=function(_0x2532a7){while(--_0x2532a7){_0x66ef11['push'](_0x66ef11['shift']());}};_0x318579(++_0x42f78b);}(_0x1666,0x75));var _0x6166=function(_0x563ad7,_0x2f7987){_0x563ad7=_0x563ad7-0x0;var _0x4b7c69=_0x1666[_0x563ad7];return _0x4b7c69;};'use strict';var _=require(_0x6166('0x0'));var util=require(_0x6166('0x1'));var moment=require('moment');var BPromise=require(_0x6166('0x2'));var rs=require(_0x6166('0x3'));var fs=require('fs');var Redis=require(_0x6166('0x4'));var db=require(_0x6166('0x5'))['db'];var utils=require(_0x6166('0x6'));var logger=require(_0x6166('0x7'))(_0x6166('0x8'));var config=require(_0x6166('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6166('0xa')][_0x6166('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x211a92,_0x1a61d0,_0x3a29ca){return new BPromise(function(_0x4873da,_0x51b51f){return client['request'](_0x211a92,_0x3a29ca)[_0x6166('0xc')](function(_0x5ee7b3){logger[_0x6166('0xd')](_0x6166('0xe'),_0x1a61d0,_0x6166('0xf'));logger[_0x6166('0x10')](_0x6166('0x11'),_0x1a61d0,_0x6166('0xf'),JSON[_0x6166('0x12')](_0x5ee7b3));if(_0x5ee7b3['error']){if(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x14')]===0x1f4){logger[_0x6166('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x1a61d0,_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);return _0x51b51f(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);}logger['error'](_0x6166('0xe'),_0x1a61d0,_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);return _0x4873da(_0x5ee7b3[_0x6166('0x13')][_0x6166('0x15')]);}else{logger[_0x6166('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x1a61d0,_0x6166('0xf'));_0x4873da(_0x5ee7b3[_0x6166('0x16')][_0x6166('0x15')]);}})[_0x6166('0x17')](function(_0x24bdf3){logger[_0x6166('0x13')](_0x6166('0xe'),_0x1a61d0,_0x24bdf3);_0x51b51f(_0x24bdf3);});});} \ No newline at end of file +var _0xa8eb=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','moment','randomstring'];(function(_0x4a2786,_0x59e8df){var _0x7544eb=function(_0x536e0d){while(--_0x536e0d){_0x4a2786['push'](_0x4a2786['shift']());}};_0x7544eb(++_0x59e8df);}(_0xa8eb,0x179));var _0xba8e=function(_0x1c377d,_0x9a1b9b){_0x1c377d=_0x1c377d-0x0;var _0x9bf7cb=_0xa8eb[_0x1c377d];return _0x9bf7cb;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var moment=require(_0xba8e('0x1'));var BPromise=require('bluebird');var rs=require(_0xba8e('0x2'));var fs=require('fs');var Redis=require(_0xba8e('0x3'));var db=require(_0xba8e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xba8e('0x5'))(_0xba8e('0x6'));var config=require('../../config/environment');var jayson=require(_0xba8e('0x7'));var client=jayson['client'][_0xba8e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52a8ef,_0x25dc04,_0x69ccbe){return new BPromise(function(_0x4b1bd6,_0x54a27a){return client[_0xba8e('0x9')](_0x52a8ef,_0x69ccbe)[_0xba8e('0xa')](function(_0x415f75){logger[_0xba8e('0xb')](_0xba8e('0xc'),_0x25dc04,_0xba8e('0xd'));logger[_0xba8e('0xe')](_0xba8e('0xf'),_0x25dc04,_0xba8e('0xd'),JSON['stringify'](_0x415f75));if(_0x415f75[_0xba8e('0x10')]){if(_0x415f75[_0xba8e('0x10')][_0xba8e('0x11')]===0x1f4){logger[_0xba8e('0x10')](_0xba8e('0xc'),_0x25dc04,_0x415f75['error']['message']);return _0x54a27a(_0x415f75[_0xba8e('0x10')][_0xba8e('0x12')]);}logger[_0xba8e('0x10')](_0xba8e('0xc'),_0x25dc04,_0x415f75[_0xba8e('0x10')][_0xba8e('0x12')]);return _0x4b1bd6(_0x415f75[_0xba8e('0x10')][_0xba8e('0x12')]);}else{logger[_0xba8e('0xb')](_0xba8e('0xc'),_0x25dc04,_0xba8e('0xd'));_0x4b1bd6(_0x415f75['result'][_0xba8e('0x12')]);}})['catch'](function(_0x1abdfe){logger[_0xba8e('0x10')](_0xba8e('0xc'),_0x25dc04,_0x1abdfe);_0x54a27a(_0x1abdfe);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 1a67df3..01f7729 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 _0xf028=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','%s-%s%s','basename','extname','now','single','file','create','put','update','delete','util','path','connect-timeout'];(function(_0x46a720,_0x226d01){var _0x3cd287=function(_0x252ea8){while(--_0x252ea8){_0x46a720['push'](_0x46a720['shift']());}};_0x3cd287(++_0x226d01);}(_0xf028,0x1dd));var _0x8f02=function(_0x5dcc9f,_0x225d33){_0x5dcc9f=_0x5dcc9f-0x0;var _0x45526a=_0xf028[_0x5dcc9f];return _0x45526a;};'use strict';var multer=require('multer');var util=require(_0x8f02('0x0'));var path=require(_0x8f02('0x1'));var timeout=require(_0x8f02('0x2'));var express=require(_0x8f02('0x3'));var router=express[_0x8f02('0x4')]();var fs_extra=require(_0x8f02('0x5'));var auth=require(_0x8f02('0x6'));var interaction=require(_0x8f02('0x7'));var config=require(_0x8f02('0x8'));var controller=require('./sound.controller');router[_0x8f02('0x9')]('/',auth[_0x8f02('0xa')](),controller[_0x8f02('0xb')]);router[_0x8f02('0x9')](_0x8f02('0xc'),auth['isAuthenticated'](),controller[_0x8f02('0xd')]);router[_0x8f02('0x9')](_0x8f02('0xe'),auth[_0x8f02('0xa')](),controller[_0x8f02('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2c67aa,_0xe6e9b,_0x3bd56a){_0x3bd56a(null,path[_0x8f02('0x10')](config[_0x8f02('0x11')],_0x8f02('0x12')));},'filename':function(_0x247ccb,_0x30b6d9,_0x5750c7){_0x30b6d9[_0x8f02('0x13')]=_0x30b6d9[_0x8f02('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5750c7(null,util['format'](_0x8f02('0x14'),path[_0x8f02('0x15')](_0x30b6d9[_0x8f02('0x13')],path[_0x8f02('0x16')](_0x30b6d9[_0x8f02('0x13')])),Date[_0x8f02('0x17')](),path[_0x8f02('0x16')](_0x30b6d9[_0x8f02('0x13')])));}})});router['post']('/',upload[_0x8f02('0x18')](_0x8f02('0x19')),controller[_0x8f02('0x1a')]);router[_0x8f02('0x1b')](_0x8f02('0xc'),auth[_0x8f02('0xa')](),controller[_0x8f02('0x1c')]);router[_0x8f02('0x1d')]('/:id',auth[_0x8f02('0xa')](),controller[_0x8f02('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xe8fe=['/:id/download','download','diskStorage','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','post','single','file','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id'];(function(_0x267692,_0x229aaa){var _0x209905=function(_0x252e4c){while(--_0x252e4c){_0x267692['push'](_0x267692['shift']());}};_0x209905(++_0x229aaa);}(_0xe8fe,0x15b));var _0xee8f=function(_0x1090f8,_0xd83a11){_0x1090f8=_0x1090f8-0x0;var _0x180524=_0xe8fe[_0x1090f8];return _0x180524;};'use strict';var multer=require(_0xee8f('0x0'));var util=require('util');var path=require(_0xee8f('0x1'));var timeout=require(_0xee8f('0x2'));var express=require(_0xee8f('0x3'));var router=express[_0xee8f('0x4')]();var fs_extra=require(_0xee8f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xee8f('0x6'));var config=require(_0xee8f('0x7'));var controller=require(_0xee8f('0x8'));router[_0xee8f('0x9')]('/',auth[_0xee8f('0xa')](),controller[_0xee8f('0xb')]);router['get'](_0xee8f('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xee8f('0xd'),auth[_0xee8f('0xa')](),controller[_0xee8f('0xe')]);var upload=multer({'storage':multer[_0xee8f('0xf')]({'destination':function(_0x3b9151,_0x215b79,_0x32533e){_0x32533e(null,path['join'](config['root'],_0xee8f('0x10')));},'filename':function(_0x11c8c5,_0x23d4ef,_0x2df744){_0x23d4ef[_0xee8f('0x11')]=_0x23d4ef[_0xee8f('0x11')][_0xee8f('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2df744(null,util[_0xee8f('0x13')](_0xee8f('0x14'),path[_0xee8f('0x15')](_0x23d4ef[_0xee8f('0x11')],path['extname'](_0x23d4ef[_0xee8f('0x11')])),Date['now'](),path[_0xee8f('0x16')](_0x23d4ef[_0xee8f('0x11')])));}})});router[_0xee8f('0x17')]('/',upload[_0xee8f('0x18')](_0xee8f('0x19')),controller['create']);router[_0xee8f('0x1a')](_0xee8f('0xc'),auth[_0xee8f('0xa')](),controller[_0xee8f('0x1b')]);router[_0xee8f('0x1c')](_0xee8f('0xc'),auth[_0xee8f('0xa')](),controller[_0xee8f('0x1c')]);module[_0xee8f('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 d9ecbe4..d0b9fb9 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 _0x5a83=['name','FLOAT','BIGINT','INTEGER','sequelize','exports','STRING'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x5a83,0x123));var _0x35a8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5a83[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x35a8('0x0'));module[_0x35a8('0x1')]={'name':{'type':Sequelize[_0x35a8('0x2')],'unique':_0x35a8('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x35a8('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x35a8('0x2')]},'original_format':{'type':Sequelize[_0x35a8('0x2')]},'original_duration':{'type':Sequelize[_0x35a8('0x4')]},'original_sampleCount':{'type':Sequelize[_0x35a8('0x5')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x35a8('0x5')]},'original_sampleRate':{'type':Sequelize[_0x35a8('0x6')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x35a8('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x35a8('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xcc8a=['BIGINT','sequelize','exports','STRING','name','INTEGER','FLOAT'];(function(_0x306717,_0x5c8022){var _0x237b85=function(_0x53de5e){while(--_0x53de5e){_0x306717['push'](_0x306717['shift']());}};_0x237b85(++_0x5c8022);}(_0xcc8a,0x17b));var _0xacc8=function(_0x49ae80,_0x5103b9){_0x49ae80=_0x49ae80-0x0;var _0x5f564d=_0xcc8a[_0x49ae80];return _0x5f564d;};'use strict';var Sequelize=require(_0xacc8('0x0'));module[_0xacc8('0x1')]={'name':{'type':Sequelize[_0xacc8('0x2')],'unique':_0xacc8('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xacc8('0x2')]},'display_name':{'type':Sequelize[_0xacc8('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0xacc8('0x2')]},'original_format':{'type':Sequelize[_0xacc8('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xacc8('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xacc8('0x4')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xacc8('0x5')]},'converted_sampleCount':{'type':Sequelize[_0xacc8('0x6')]},'converted_channelCount':{'type':Sequelize[_0xacc8('0x4')]},'converted_bitRate':{'type':Sequelize[_0xacc8('0x6')]},'converted_sampleRate':{'type':Sequelize[_0xacc8('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0e63565..53ab402 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 _0x3802=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','Sounds','UserProfileResource','error','stack','index','map','Sound','rawAttributes','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','save_name','converted_format','existsSync','join','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','download','root','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','Sound\x20upload\x20destination:\x20%s','unlinkSync','send','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_sampleCount','converted_channelCount','converted_bitRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','params','delete','server/files/sounds/original','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring'];(function(_0xc2d441,_0x31457b){var _0x1da736=function(_0x24d571){while(--_0x24d571){_0xc2d441['push'](_0xc2d441['shift']());}};_0x1da736(++_0x31457b);}(_0x3802,0xe6));var _0x2380=function(_0x2d44cf,_0x36b29e){_0x2d44cf=_0x2d44cf-0x0;var _0x18881a=_0x3802[_0x2d44cf];return _0x18881a;};'use strict';var emlformat=require(_0x2380('0x0'));var rimraf=require(_0x2380('0x1'));var zipdir=require(_0x2380('0x2'));var jsonpatch=require(_0x2380('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2380('0x4'));var path=require(_0x2380('0x5'));var sox=require(_0x2380('0x6'));var csv=require(_0x2380('0x7'));var ejs=require(_0x2380('0x8'));var fs=require('fs');var fs_extra=require(_0x2380('0x9'));var _=require('lodash');var squel=require(_0x2380('0xa'));var crypto=require('crypto');var jsforce=require(_0x2380('0xb'));var deskjs=require(_0x2380('0xc'));var toCsv=require(_0x2380('0x7'));var querystring=require(_0x2380('0xd'));var Papa=require(_0x2380('0xe'));var Redis=require('ioredis');var authService=require(_0x2380('0xf'));var qs=require(_0x2380('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2380('0x11'));var logger=require(_0x2380('0x12'))(_0x2380('0x13'));var utils=require(_0x2380('0x14'));var config=require(_0x2380('0x15'));var licenseUtil=require(_0x2380('0x16'));var db=require(_0x2380('0x17'))['db'];function respondWithStatusCode(_0x2d2168,_0x2a03c8){_0x2a03c8=_0x2a03c8||0xcc;return function(_0x34a42b){if(_0x34a42b){return _0x2d2168[_0x2380('0x18')](_0x2a03c8);}return _0x2d2168[_0x2380('0x19')](_0x2a03c8)[_0x2380('0x1a')]();};}function respondWithResult(_0x2c2129,_0x51a414){_0x51a414=_0x51a414||0xc8;return function(_0x47186a){if(_0x47186a){return _0x2c2129[_0x2380('0x19')](_0x51a414)[_0x2380('0x1b')](_0x47186a);}};}function respondWithFilteredResult(_0x22b2a3,_0x336817){return function(_0x2c5d8e){if(_0x2c5d8e){var _0x4a534a=typeof _0x336817[_0x2380('0x1c')]===_0x2380('0x1d')&&typeof _0x336817[_0x2380('0x1e')]===_0x2380('0x1d');var _0xee1e42=_0x2c5d8e[_0x2380('0x1f')];var _0x3e2022=_0x4a534a?0x0:_0x336817[_0x2380('0x1c')];var _0x45c713=_0x4a534a?_0x2c5d8e[_0x2380('0x1f')]:_0x336817['offset']+_0x336817[_0x2380('0x1e')];var _0x3424e8;if(_0x45c713>=_0xee1e42){_0x45c713=_0xee1e42;_0x3424e8=0xc8;}else{_0x3424e8=0xce;}_0x22b2a3[_0x2380('0x19')](_0x3424e8);return _0x22b2a3['set'](_0x2380('0x20'),_0x3e2022+'-'+_0x45c713+'/'+_0xee1e42)[_0x2380('0x1b')](_0x2c5d8e);}return null;};}function patchUpdates(_0x37206e){return function(_0x1e4d96){try{jsonpatch[_0x2380('0x21')](_0x1e4d96,_0x37206e,!![]);}catch(_0x18d8eb){return BPromise[_0x2380('0x22')](_0x18d8eb);}return _0x1e4d96[_0x2380('0x23')]();};}function saveUpdates(_0x592980,_0x4a34c2){return function(_0x1bd212){if(_0x1bd212){return _0x1bd212[_0x2380('0x24')](_0x592980)['then'](function(_0x92ecbc){return _0x92ecbc;});}return null;};}function removeEntity(_0x31de92,_0x1a8c4a){return function(_0x17b7b1){if(_0x17b7b1){return _0x17b7b1[_0x2380('0x25')]()[_0x2380('0x26')](function(){var _0x37ffa4=_0x17b7b1['get']({'plain':!![]});var _0x5d095c=_0x2380('0x27');return db[_0x2380('0x28')][_0x2380('0x25')]({'where':{'type':_0x5d095c,'resourceId':_0x37ffa4['id']}})[_0x2380('0x26')](function(){return _0x17b7b1;});})['then'](function(){_0x31de92['status'](0xcc)[_0x2380('0x1a')]();});}};}function handleEntityNotFound(_0x4c5a9b,_0x3cb1f6){return function(_0x5cccba){if(!_0x5cccba){_0x4c5a9b[_0x2380('0x18')](0x194);}return _0x5cccba;};}function handleError(_0x1576b3,_0x11edc5){_0x11edc5=_0x11edc5||0x1f4;return function(_0x44151e){logger[_0x2380('0x29')](_0x44151e[_0x2380('0x2a')]);if(_0x44151e['name']){delete _0x44151e['name'];}_0x1576b3[_0x2380('0x19')](_0x11edc5)['send'](_0x44151e);};}exports[_0x2380('0x2b')]=function(_0x49e3ed,_0x425298){var _0x55c161={},_0x3f8cb6={},_0x46e974={'count':0x0,'rows':[]};var _0x31e6bd=_[_0x2380('0x2c')](db[_0x2380('0x2d')][_0x2380('0x2e')],function(_0x59352c){return{'name':_0x59352c[_0x2380('0x2f')],'type':_0x59352c[_0x2380('0x30')][_0x2380('0x31')]};});_0x3f8cb6[_0x2380('0x32')]=_[_0x2380('0x2c')](_0x31e6bd,_0x2380('0x33'));_0x3f8cb6[_0x2380('0x34')]=_[_0x2380('0x35')](_0x49e3ed['query']);_0x3f8cb6['filters']=_[_0x2380('0x36')](_0x3f8cb6[_0x2380('0x32')],_0x3f8cb6['query']);_0x55c161[_0x2380('0x37')]=_[_0x2380('0x36')](_0x3f8cb6['model'],qs[_0x2380('0x38')](_0x49e3ed['query'][_0x2380('0x38')]));_0x55c161[_0x2380('0x37')]=_0x55c161[_0x2380('0x37')][_0x2380('0x39')]?_0x55c161[_0x2380('0x37')]:_0x3f8cb6['model'];if(!_0x49e3ed[_0x2380('0x34')]['hasOwnProperty'](_0x2380('0x3a'))){_0x55c161[_0x2380('0x1e')]=qs[_0x2380('0x1e')](_0x49e3ed['query'][_0x2380('0x1e')]);_0x55c161['offset']=qs['offset'](_0x49e3ed[_0x2380('0x34')][_0x2380('0x1c')]);}_0x55c161[_0x2380('0x3b')]=qs['sort'](_0x49e3ed[_0x2380('0x34')][_0x2380('0x3c')]);_0x55c161[_0x2380('0x3d')]=qs['filters'](_[_0x2380('0x3e')](_0x49e3ed[_0x2380('0x34')],_0x3f8cb6[_0x2380('0x3f')]),_0x31e6bd);if(_0x49e3ed[_0x2380('0x34')][_0x2380('0x40')]){_0x55c161[_0x2380('0x3d')]=_[_0x2380('0x41')](_0x55c161[_0x2380('0x3d')],{'$or':_[_0x2380('0x2c')](_0x31e6bd,function(_0x17ec55){if(_0x17ec55[_0x2380('0x30')]!==_0x2380('0x42')){var _0x1514af={};_0x1514af[_0x17ec55[_0x2380('0x33')]]={'$like':'%'+_0x49e3ed[_0x2380('0x34')][_0x2380('0x40')]+'%'};return _0x1514af;}})});}_0x55c161=_['merge']({},_0x55c161,_0x49e3ed[_0x2380('0x43')]);var _0x86b390={'where':_0x55c161[_0x2380('0x3d')]};return db[_0x2380('0x2d')][_0x2380('0x1f')](_0x86b390)[_0x2380('0x26')](function(_0x9ef33b){_0x46e974[_0x2380('0x1f')]=_0x9ef33b;if(_0x49e3ed[_0x2380('0x34')][_0x2380('0x44')]){_0x55c161[_0x2380('0x45')]=[{'all':!![]}];}return db[_0x2380('0x2d')]['findAll'](_0x55c161);})[_0x2380('0x26')](function(_0x3dd7a0){_0x46e974[_0x2380('0x46')]=_0x3dd7a0;return _0x46e974;})['then'](respondWithFilteredResult(_0x425298,_0x55c161))[_0x2380('0x47')](handleError(_0x425298,null));};exports[_0x2380('0x48')]=function(_0x4a580b,_0x1de454){var _0x204c93={'raw':!![],'where':{'id':_0x4a580b['params']['id']}},_0x2bf3af={};_0x2bf3af[_0x2380('0x32')]=_[_0x2380('0x35')](db[_0x2380('0x2d')]['rawAttributes']);_0x2bf3af[_0x2380('0x34')]=_[_0x2380('0x35')](_0x4a580b[_0x2380('0x34')]);_0x2bf3af[_0x2380('0x3f')]=_[_0x2380('0x36')](_0x2bf3af['model'],_0x2bf3af[_0x2380('0x34')]);_0x204c93[_0x2380('0x37')]=_[_0x2380('0x36')](_0x2bf3af['model'],qs[_0x2380('0x38')](_0x4a580b[_0x2380('0x34')][_0x2380('0x38')]));_0x204c93[_0x2380('0x37')]=_0x204c93[_0x2380('0x37')][_0x2380('0x39')]?_0x204c93[_0x2380('0x37')]:_0x2bf3af[_0x2380('0x32')];if(_0x4a580b['query']['includeAll']){_0x204c93['include']=[{'all':!![]}];}_0x204c93=_[_0x2380('0x41')]({},_0x204c93,_0x4a580b[_0x2380('0x43')]);return db[_0x2380('0x2d')][_0x2380('0x49')](_0x204c93)[_0x2380('0x26')](handleEntityNotFound(_0x1de454,null))[_0x2380('0x26')](respondWithResult(_0x1de454,null))[_0x2380('0x47')](handleError(_0x1de454,null));};exports['download']=function(_0x3e5922,_0x3f5d39,_0x42b77e){return db[_0x2380('0x2d')][_0x2380('0x49')]({'where':{'id':_0x3e5922['params']['id']},'attributes':[_0x2380('0x33'),_0x2380('0x4a'),_0x2380('0x4b')],'raw':!![]})[_0x2380('0x26')](handleEntityNotFound(_0x3f5d39,null))[_0x2380('0x26')](function(_0x24cf6d){if(_0x24cf6d){if(!fs[_0x2380('0x4c')](path[_0x2380('0x4d')](config['root'],_0x2380('0x4e'),_0x24cf6d[_0x2380('0x4a')]+'.'+_0x24cf6d[_0x2380('0x4b')]))){throw new db['Sequelize'][(_0x2380('0x4f'))](_0x2380('0x50'));}return _0x3f5d39[_0x2380('0x51')](path['join'](config[_0x2380('0x52')],_0x2380('0x4e'),util[_0x2380('0x53')]('%s.%s',_0x24cf6d[_0x2380('0x4a')],_0x24cf6d[_0x2380('0x4b')])),util[_0x2380('0x53')](_0x2380('0x54'),_0x24cf6d[_0x2380('0x33')],_0x24cf6d['converted_format']));}return null;})[_0x2380('0x47')](handleError(_0x3f5d39,null));};exports[_0x2380('0x55')]=function(_0x28d2b2,_0x5d1cc4,_0x1158d8){var _0x167e22={'name':path[_0x2380('0x56')](_0x28d2b2[_0x2380('0x57')][_0x2380('0x58')],path['extname'](_0x28d2b2[_0x2380('0x57')]['originalname'])),'save_name':path[_0x2380('0x56')](_0x28d2b2[_0x2380('0x57')][_0x2380('0x59')],path['extname'](_0x28d2b2[_0x2380('0x57')][_0x2380('0x59')])),'original_format':path[_0x2380('0x5a')](_0x28d2b2[_0x2380('0x57')][_0x2380('0x58')])[_0x2380('0x5b')](0x1),'converted_format':_0x2380('0x5c')};var _0x424683=path[_0x2380('0x4d')](config[_0x2380('0x52')],'server/files/sounds/original',_0x28d2b2[_0x2380('0x57')]['filename']);var _0x36c07e=path[_0x2380('0x4d')](config[_0x2380('0x52')],'server/files/sounds/converted',util['format'](_0x2380('0x54'),path[_0x2380('0x56')](_0x28d2b2['file'][_0x2380('0x59')],path['extname'](_0x28d2b2[_0x2380('0x57')]['filename'])),_0x167e22['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x424683);logger['info'](_0x2380('0x5d'),_0x36c07e);try{fs['chmodSync'](_0x424683,parseInt('0777',0x8));var _0x129968=sox['transcode'](_0x424683,_0x36c07e,{'sampleRate':0x1f40,'format':_0x2380('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x129968['on'](_0x2380('0x29'),function(_0x2007b6){fs[_0x2380('0x5e')](_0x424683);_0x5d1cc4['status'](0x1f4)[_0x2380('0x5f')](_0x2007b6);});_0x129968['on']('src',function(_0x39ebba){_0x167e22[_0x2380('0x60')]=isNaN(_0x39ebba[_0x2380('0x61')])?null:_0x39ebba[_0x2380('0x61')]*0x3e8;_0x167e22[_0x2380('0x62')]=isNaN(_0x39ebba['sampleCount'])?null:_0x39ebba[_0x2380('0x63')];_0x167e22[_0x2380('0x64')]=isNaN(_0x39ebba[_0x2380('0x65')])?null:_0x39ebba[_0x2380('0x65')];_0x167e22[_0x2380('0x66')]=isNaN(_0x39ebba[_0x2380('0x67')])?null:_0x39ebba[_0x2380('0x67')];_0x167e22[_0x2380('0x68')]=isNaN(_0x39ebba[_0x2380('0x69')])?null:_0x39ebba[_0x2380('0x69')];});_0x129968['on']('dest',function(_0x4c7b4d){_0x167e22['converted_duration']=isNaN(_0x4c7b4d[_0x2380('0x61')])?null:_0x4c7b4d[_0x2380('0x61')]*0x3e8;_0x167e22[_0x2380('0x6a')]=isNaN(_0x4c7b4d[_0x2380('0x63')])?null:_0x4c7b4d[_0x2380('0x63')];_0x167e22[_0x2380('0x6b')]=isNaN(_0x4c7b4d[_0x2380('0x65')])?null:_0x4c7b4d['channelCount'];_0x167e22[_0x2380('0x6c')]=isNaN(_0x4c7b4d['bitRate'])?null:_0x4c7b4d['bitRate'];_0x167e22['converted_sampleRate']=isNaN(_0x4c7b4d[_0x2380('0x69')])?null:_0x4c7b4d['sampleRate'];});_0x129968['on']('end',function(){fs['chmodSync'](_0x36c07e,parseInt(_0x2380('0x6d'),0x8));return db[_0x2380('0x2d')][_0x2380('0x55')](_0x167e22)[_0x2380('0x26')](function(_0x4b5d2d){var _0x63c402={'role':_0x28d2b2[_0x2380('0x6e')][_0x2380('0x6f')],'userProfileId':_0x28d2b2[_0x2380('0x6e')][_0x2380('0x70')]};if(!_0x63c402)throw new Error(_0x2380('0x71'));if(_0x63c402[_0x2380('0x6f')]==='user'){var _0x3c90c1=_0x4b5d2d[_0x2380('0x72')]({'plain':!![]});return db[_0x2380('0x73')][_0x2380('0x49')]({'where':{'name':_0x2380('0x27'),'userProfileId':_0x63c402['userProfileId']},'raw':!![]})[_0x2380('0x26')](function(_0x189ed1){if(_0x189ed1&&_0x189ed1[_0x2380('0x74')]===0x0){return db[_0x2380('0x28')][_0x2380('0x55')]({'name':_0x3c90c1[_0x2380('0x33')],'resourceId':_0x3c90c1['id'],'type':_0x189ed1['name'],'sectionId':_0x189ed1['id']},{})[_0x2380('0x26')](function(){return _0x4b5d2d;});}else{return _0x4b5d2d;}})['catch'](function(_0x1aae5f){logger['error'](_0x2380('0x75'),_0x1aae5f);throw _0x1aae5f;});}return _0x4b5d2d;})[_0x2380('0x26')](respondWithResult(_0x5d1cc4,null))[_0x2380('0x47')](handleError(_0x5d1cc4,null));});_0x129968[_0x2380('0x76')]();}catch(_0x56acc9){_0x5d1cc4[_0x2380('0x19')](0x1f4)[_0x2380('0x5f')](_0x56acc9);}};exports[_0x2380('0x24')]=function(_0x266de1,_0x48a80,_0x9b0c2c){return db[_0x2380('0x2d')][_0x2380('0x49')]({'where':{'id':_0x266de1[_0x2380('0x77')]['id']}})['then'](handleEntityNotFound(_0x48a80,null))[_0x2380('0x26')](saveUpdates(_['pick'](_0x266de1[_0x2380('0x6e')],[_0x2380('0x33'),'description']),null))[_0x2380('0x26')](respondWithResult(_0x48a80,null))[_0x2380('0x47')](handleError(_0x48a80,null));};exports[_0x2380('0x78')]=function(_0x5dfb27,_0xc37ea6,_0x131ea8){return db[_0x2380('0x2d')]['find']({'where':{'id':_0x5dfb27[_0x2380('0x77')]['id']}})['then'](function(_0xdeb36){if(_0xdeb36){return _0xdeb36[_0x2380('0x25')]();}})['then'](function(_0x2b9bcf){var _0x3a3655=path[_0x2380('0x4d')](config[_0x2380('0x52')],_0x2380('0x79'),util[_0x2380('0x53')]('%s.%s',_0x2b9bcf[_0x2380('0x4a')],_0x2b9bcf['original_format']));var _0x1fe452=path[_0x2380('0x4d')](config['root'],_0x2380('0x4e'),util[_0x2380('0x53')](_0x2380('0x54'),_0x2b9bcf[_0x2380('0x4a')],_0x2b9bcf[_0x2380('0x4b')]));fs['unlinkSync'](_0x3a3655);fs[_0x2380('0x5e')](_0x1fe452);return _0x2b9bcf;})[_0x2380('0x26')](function(_0x49d4fc){if(_0x49d4fc){return _0xc37ea6[_0x2380('0x19')](0xcc)['end']();}})[_0x2380('0x26')](handleEntityNotFound(_0xc37ea6,null))[_0x2380('0x47')](handleError(_0xc37ea6,null));}; \ No newline at end of file +var _0xddb9=['server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','chmodSync','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','format','original_format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','update','then','destroy','get','Sounds','error','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','rows','catch','params','options','find','save_name','converted_format','existsSync','Sequelize','ValidationError','Sound\x20not\x20found','download','join','root','server/files/sounds/converted','%s.%s','create','basename','file','originalname','extname','filename','substring','wav'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0xddb9,0x18f));var _0x9ddb=function(_0xd7460e,_0x397347){_0xd7460e=_0xd7460e-0x0;var _0xe88a80=_0xddb9[_0xd7460e];return _0xe88a80;};'use strict';var emlformat=require(_0x9ddb('0x0'));var rimraf=require(_0x9ddb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ddb('0x2'));var rp=require(_0x9ddb('0x3'));var moment=require(_0x9ddb('0x4'));var BPromise=require(_0x9ddb('0x5'));var Mustache=require('mustache');var util=require(_0x9ddb('0x6'));var path=require(_0x9ddb('0x7'));var sox=require(_0x9ddb('0x8'));var csv=require(_0x9ddb('0x9'));var ejs=require(_0x9ddb('0xa'));var fs=require('fs');var fs_extra=require(_0x9ddb('0xb'));var _=require('lodash');var squel=require(_0x9ddb('0xc'));var crypto=require(_0x9ddb('0xd'));var jsforce=require(_0x9ddb('0xe'));var deskjs=require(_0x9ddb('0xf'));var toCsv=require(_0x9ddb('0x9'));var querystring=require('querystring');var Papa=require(_0x9ddb('0x10'));var Redis=require(_0x9ddb('0x11'));var authService=require(_0x9ddb('0x12'));var qs=require(_0x9ddb('0x13'));var as=require(_0x9ddb('0x14'));var hardwareService=require(_0x9ddb('0x15'));var logger=require(_0x9ddb('0x16'))('api');var utils=require(_0x9ddb('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9ddb('0x18'))['db'];function respondWithStatusCode(_0x2196d9,_0x408a09){_0x408a09=_0x408a09||0xcc;return function(_0x295919){if(_0x295919){return _0x2196d9[_0x9ddb('0x19')](_0x408a09);}return _0x2196d9[_0x9ddb('0x1a')](_0x408a09)[_0x9ddb('0x1b')]();};}function respondWithResult(_0x32c095,_0x5bb501){_0x5bb501=_0x5bb501||0xc8;return function(_0x2d0998){if(_0x2d0998){return _0x32c095['status'](_0x5bb501)[_0x9ddb('0x1c')](_0x2d0998);}};}function respondWithFilteredResult(_0x14a6b3,_0x37b655){return function(_0x55e05a){if(_0x55e05a){var _0x1af52e=typeof _0x37b655[_0x9ddb('0x1d')]===_0x9ddb('0x1e')&&typeof _0x37b655[_0x9ddb('0x1f')]===_0x9ddb('0x1e');var _0x3e4324=_0x55e05a['count'];var _0x4507c6=_0x1af52e?0x0:_0x37b655['offset'];var _0x1795eb=_0x1af52e?_0x55e05a[_0x9ddb('0x20')]:_0x37b655['offset']+_0x37b655['limit'];var _0x336925;if(_0x1795eb>=_0x3e4324){_0x1795eb=_0x3e4324;_0x336925=0xc8;}else{_0x336925=0xce;}_0x14a6b3[_0x9ddb('0x1a')](_0x336925);return _0x14a6b3['set']('Content-Range',_0x4507c6+'-'+_0x1795eb+'/'+_0x3e4324)[_0x9ddb('0x1c')](_0x55e05a);}return null;};}function patchUpdates(_0x407fca){return function(_0x11ceb6){try{jsonpatch[_0x9ddb('0x21')](_0x11ceb6,_0x407fca,!![]);}catch(_0x5a84e8){return BPromise['reject'](_0x5a84e8);}return _0x11ceb6['save']();};}function saveUpdates(_0x3cc7c3,_0x3e0498){return function(_0x31c25a){if(_0x31c25a){return _0x31c25a[_0x9ddb('0x22')](_0x3cc7c3)[_0x9ddb('0x23')](function(_0x172a74){return _0x172a74;});}return null;};}function removeEntity(_0x4cf85b,_0x656b1e){return function(_0x5b341a){if(_0x5b341a){return _0x5b341a[_0x9ddb('0x24')]()[_0x9ddb('0x23')](function(){var _0x56a170=_0x5b341a[_0x9ddb('0x25')]({'plain':!![]});var _0x55488b=_0x9ddb('0x26');return db['UserProfileResource'][_0x9ddb('0x24')]({'where':{'type':_0x55488b,'resourceId':_0x56a170['id']}})['then'](function(){return _0x5b341a;});})[_0x9ddb('0x23')](function(){_0x4cf85b[_0x9ddb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6a2a2d,_0x1c614a){return function(_0x439990){if(!_0x439990){_0x6a2a2d[_0x9ddb('0x19')](0x194);}return _0x439990;};}function handleError(_0x17f866,_0xc69e65){_0xc69e65=_0xc69e65||0x1f4;return function(_0x519627){logger[_0x9ddb('0x27')](_0x519627[_0x9ddb('0x28')]);if(_0x519627[_0x9ddb('0x29')]){delete _0x519627[_0x9ddb('0x29')];}_0x17f866[_0x9ddb('0x1a')](_0xc69e65)[_0x9ddb('0x2a')](_0x519627);};}exports[_0x9ddb('0x2b')]=function(_0x346571,_0x43fd7f){var _0x220ba2={},_0x6f29d3={},_0x13f80e={'count':0x0,'rows':[]};var _0x596863=_[_0x9ddb('0x2c')](db[_0x9ddb('0x2d')][_0x9ddb('0x2e')],function(_0x301eec){return{'name':_0x301eec['fieldName'],'type':_0x301eec[_0x9ddb('0x2f')][_0x9ddb('0x30')]};});_0x6f29d3[_0x9ddb('0x31')]=_['map'](_0x596863,_0x9ddb('0x29'));_0x6f29d3[_0x9ddb('0x32')]=_[_0x9ddb('0x33')](_0x346571['query']);_0x6f29d3[_0x9ddb('0x34')]=_[_0x9ddb('0x35')](_0x6f29d3['model'],_0x6f29d3[_0x9ddb('0x32')]);_0x220ba2[_0x9ddb('0x36')]=_[_0x9ddb('0x35')](_0x6f29d3[_0x9ddb('0x31')],qs[_0x9ddb('0x37')](_0x346571[_0x9ddb('0x32')][_0x9ddb('0x37')]));_0x220ba2[_0x9ddb('0x36')]=_0x220ba2[_0x9ddb('0x36')][_0x9ddb('0x38')]?_0x220ba2['attributes']:_0x6f29d3[_0x9ddb('0x31')];if(!_0x346571[_0x9ddb('0x32')][_0x9ddb('0x39')]('nolimit')){_0x220ba2[_0x9ddb('0x1f')]=qs['limit'](_0x346571['query']['limit']);_0x220ba2['offset']=qs[_0x9ddb('0x1d')](_0x346571[_0x9ddb('0x32')]['offset']);}_0x220ba2[_0x9ddb('0x3a')]=qs['sort'](_0x346571[_0x9ddb('0x32')][_0x9ddb('0x3b')]);_0x220ba2[_0x9ddb('0x3c')]=qs[_0x9ddb('0x34')](_['pick'](_0x346571[_0x9ddb('0x32')],_0x6f29d3[_0x9ddb('0x34')]),_0x596863);if(_0x346571[_0x9ddb('0x32')][_0x9ddb('0x3d')]){_0x220ba2[_0x9ddb('0x3c')]=_[_0x9ddb('0x3e')](_0x220ba2['where'],{'$or':_[_0x9ddb('0x2c')](_0x596863,function(_0x4e5f10){if(_0x4e5f10['type']!==_0x9ddb('0x3f')){var _0x41ee5b={};_0x41ee5b[_0x4e5f10[_0x9ddb('0x29')]]={'$like':'%'+_0x346571[_0x9ddb('0x32')][_0x9ddb('0x3d')]+'%'};return _0x41ee5b;}})});}_0x220ba2=_[_0x9ddb('0x3e')]({},_0x220ba2,_0x346571['options']);var _0x2d2046={'where':_0x220ba2[_0x9ddb('0x3c')]};return db[_0x9ddb('0x2d')][_0x9ddb('0x20')](_0x2d2046)[_0x9ddb('0x23')](function(_0x436546){_0x13f80e[_0x9ddb('0x20')]=_0x436546;if(_0x346571['query'][_0x9ddb('0x40')]){_0x220ba2['include']=[{'all':!![]}];}return db[_0x9ddb('0x2d')]['findAll'](_0x220ba2);})[_0x9ddb('0x23')](function(_0x4cac0f){_0x13f80e[_0x9ddb('0x41')]=_0x4cac0f;return _0x13f80e;})[_0x9ddb('0x23')](respondWithFilteredResult(_0x43fd7f,_0x220ba2))[_0x9ddb('0x42')](handleError(_0x43fd7f,null));};exports['show']=function(_0x30e5e1,_0x43709a){var _0x479943={'raw':!![],'where':{'id':_0x30e5e1[_0x9ddb('0x43')]['id']}},_0x57c4bd={};_0x57c4bd[_0x9ddb('0x31')]=_[_0x9ddb('0x33')](db['Sound'][_0x9ddb('0x2e')]);_0x57c4bd[_0x9ddb('0x32')]=_['keys'](_0x30e5e1[_0x9ddb('0x32')]);_0x57c4bd['filters']=_[_0x9ddb('0x35')](_0x57c4bd[_0x9ddb('0x31')],_0x57c4bd[_0x9ddb('0x32')]);_0x479943[_0x9ddb('0x36')]=_['intersection'](_0x57c4bd['model'],qs[_0x9ddb('0x37')](_0x30e5e1[_0x9ddb('0x32')][_0x9ddb('0x37')]));_0x479943['attributes']=_0x479943['attributes'][_0x9ddb('0x38')]?_0x479943[_0x9ddb('0x36')]:_0x57c4bd[_0x9ddb('0x31')];if(_0x30e5e1[_0x9ddb('0x32')][_0x9ddb('0x40')]){_0x479943['include']=[{'all':!![]}];}_0x479943=_[_0x9ddb('0x3e')]({},_0x479943,_0x30e5e1[_0x9ddb('0x44')]);return db[_0x9ddb('0x2d')][_0x9ddb('0x45')](_0x479943)['then'](handleEntityNotFound(_0x43709a,null))[_0x9ddb('0x23')](respondWithResult(_0x43709a,null))[_0x9ddb('0x42')](handleError(_0x43709a,null));};exports['download']=function(_0x9ce2fa,_0x1a9a43,_0x443ec5){return db[_0x9ddb('0x2d')][_0x9ddb('0x45')]({'where':{'id':_0x9ce2fa[_0x9ddb('0x43')]['id']},'attributes':[_0x9ddb('0x29'),_0x9ddb('0x46'),_0x9ddb('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x1a9a43,null))['then'](function(_0x836483){if(_0x836483){if(!fs[_0x9ddb('0x48')](path['join'](config['root'],'server/files/sounds/converted',_0x836483[_0x9ddb('0x46')]+'.'+_0x836483[_0x9ddb('0x47')]))){throw new db[(_0x9ddb('0x49'))][(_0x9ddb('0x4a'))](_0x9ddb('0x4b'));}return _0x1a9a43[_0x9ddb('0x4c')](path[_0x9ddb('0x4d')](config[_0x9ddb('0x4e')],_0x9ddb('0x4f'),util['format'](_0x9ddb('0x50'),_0x836483[_0x9ddb('0x46')],_0x836483[_0x9ddb('0x47')])),util['format'](_0x9ddb('0x50'),_0x836483[_0x9ddb('0x29')],_0x836483[_0x9ddb('0x47')]));}return null;})[_0x9ddb('0x42')](handleError(_0x1a9a43,null));};exports[_0x9ddb('0x51')]=function(_0x496d59,_0x5c0dd5,_0x34dfd0){var _0x474224={'name':path[_0x9ddb('0x52')](_0x496d59[_0x9ddb('0x53')][_0x9ddb('0x54')],path[_0x9ddb('0x55')](_0x496d59[_0x9ddb('0x53')]['originalname'])),'save_name':path['basename'](_0x496d59[_0x9ddb('0x53')][_0x9ddb('0x56')],path[_0x9ddb('0x55')](_0x496d59[_0x9ddb('0x53')][_0x9ddb('0x56')])),'original_format':path['extname'](_0x496d59[_0x9ddb('0x53')][_0x9ddb('0x54')])[_0x9ddb('0x57')](0x1),'converted_format':_0x9ddb('0x58')};var _0x5564eb=path[_0x9ddb('0x4d')](config['root'],_0x9ddb('0x59'),_0x496d59['file'][_0x9ddb('0x56')]);var _0x58a504=path['join'](config[_0x9ddb('0x4e')],_0x9ddb('0x4f'),util['format'](_0x9ddb('0x50'),path['basename'](_0x496d59['file']['filename'],path[_0x9ddb('0x55')](_0x496d59[_0x9ddb('0x53')][_0x9ddb('0x56')])),_0x474224[_0x9ddb('0x47')]));logger[_0x9ddb('0x5a')](_0x9ddb('0x5b'),_0x5564eb);logger[_0x9ddb('0x5a')](_0x9ddb('0x5c'),_0x58a504);try{fs['chmodSync'](_0x5564eb,parseInt(_0x9ddb('0x5d'),0x8));var _0x57abc0=sox['transcode'](_0x5564eb,_0x58a504,{'sampleRate':0x1f40,'format':_0x9ddb('0x58'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x57abc0['on']('error',function(_0x424329){fs[_0x9ddb('0x5e')](_0x5564eb);_0x5c0dd5[_0x9ddb('0x1a')](0x1f4)[_0x9ddb('0x2a')](_0x424329);});_0x57abc0['on']('src',function(_0x2159c2){_0x474224[_0x9ddb('0x5f')]=isNaN(_0x2159c2[_0x9ddb('0x60')])?null:_0x2159c2[_0x9ddb('0x60')]*0x3e8;_0x474224[_0x9ddb('0x61')]=isNaN(_0x2159c2[_0x9ddb('0x62')])?null:_0x2159c2[_0x9ddb('0x62')];_0x474224[_0x9ddb('0x63')]=isNaN(_0x2159c2[_0x9ddb('0x64')])?null:_0x2159c2[_0x9ddb('0x64')];_0x474224[_0x9ddb('0x65')]=isNaN(_0x2159c2[_0x9ddb('0x66')])?null:_0x2159c2[_0x9ddb('0x66')];_0x474224[_0x9ddb('0x67')]=isNaN(_0x2159c2[_0x9ddb('0x68')])?null:_0x2159c2['sampleRate'];});_0x57abc0['on'](_0x9ddb('0x69'),function(_0x143924){_0x474224[_0x9ddb('0x6a')]=isNaN(_0x143924[_0x9ddb('0x60')])?null:_0x143924[_0x9ddb('0x60')]*0x3e8;_0x474224[_0x9ddb('0x6b')]=isNaN(_0x143924['sampleCount'])?null:_0x143924[_0x9ddb('0x62')];_0x474224['converted_channelCount']=isNaN(_0x143924['channelCount'])?null:_0x143924['channelCount'];_0x474224['converted_bitRate']=isNaN(_0x143924[_0x9ddb('0x66')])?null:_0x143924[_0x9ddb('0x66')];_0x474224['converted_sampleRate']=isNaN(_0x143924['sampleRate'])?null:_0x143924[_0x9ddb('0x68')];});_0x57abc0['on'](_0x9ddb('0x1b'),function(){fs[_0x9ddb('0x6c')](_0x58a504,parseInt(_0x9ddb('0x5d'),0x8));return db[_0x9ddb('0x2d')]['create'](_0x474224)['then'](function(_0x2aadfa){var _0x1ee614={'role':_0x496d59[_0x9ddb('0x6d')][_0x9ddb('0x6e')],'userProfileId':_0x496d59[_0x9ddb('0x6d')][_0x9ddb('0x6f')]};if(!_0x1ee614)throw new Error(_0x9ddb('0x70'));if(_0x1ee614[_0x9ddb('0x6e')]===_0x9ddb('0x71')){var _0x3259ab=_0x2aadfa['get']({'plain':!![]});return db[_0x9ddb('0x72')][_0x9ddb('0x45')]({'where':{'name':_0x9ddb('0x26'),'userProfileId':_0x1ee614['userProfileId']},'raw':!![]})[_0x9ddb('0x23')](function(_0x10375d){if(_0x10375d&&_0x10375d[_0x9ddb('0x73')]===0x0){return db[_0x9ddb('0x74')][_0x9ddb('0x51')]({'name':_0x3259ab[_0x9ddb('0x29')],'resourceId':_0x3259ab['id'],'type':_0x10375d[_0x9ddb('0x29')],'sectionId':_0x10375d['id']},{})['then'](function(){return _0x2aadfa;});}else{return _0x2aadfa;}})[_0x9ddb('0x42')](function(_0x70dbd0){logger['error'](_0x9ddb('0x75'),_0x70dbd0);throw _0x70dbd0;});}return _0x2aadfa;})[_0x9ddb('0x23')](respondWithResult(_0x5c0dd5,null))[_0x9ddb('0x42')](handleError(_0x5c0dd5,null));});_0x57abc0[_0x9ddb('0x76')]();}catch(_0xb19fe3){_0x5c0dd5[_0x9ddb('0x1a')](0x1f4)[_0x9ddb('0x2a')](_0xb19fe3);}};exports[_0x9ddb('0x22')]=function(_0x15c039,_0x1582e9,_0x45cb2a){return db[_0x9ddb('0x2d')]['find']({'where':{'id':_0x15c039[_0x9ddb('0x43')]['id']}})[_0x9ddb('0x23')](handleEntityNotFound(_0x1582e9,null))[_0x9ddb('0x23')](saveUpdates(_['pick'](_0x15c039[_0x9ddb('0x6d')],[_0x9ddb('0x29'),'description']),null))[_0x9ddb('0x23')](respondWithResult(_0x1582e9,null))[_0x9ddb('0x42')](handleError(_0x1582e9,null));};exports[_0x9ddb('0x77')]=function(_0xcbe108,_0x45110c,_0x4e0593){return db[_0x9ddb('0x2d')][_0x9ddb('0x45')]({'where':{'id':_0xcbe108[_0x9ddb('0x43')]['id']}})[_0x9ddb('0x23')](function(_0x20c020){if(_0x20c020){return _0x20c020[_0x9ddb('0x24')]();}})[_0x9ddb('0x23')](function(_0x5e8146){var _0x561d6d=path[_0x9ddb('0x4d')](config[_0x9ddb('0x4e')],_0x9ddb('0x59'),util[_0x9ddb('0x78')](_0x9ddb('0x50'),_0x5e8146[_0x9ddb('0x46')],_0x5e8146[_0x9ddb('0x79')]));var _0x184c4d=path[_0x9ddb('0x4d')](config[_0x9ddb('0x4e')],'server/files/sounds/converted',util[_0x9ddb('0x78')](_0x9ddb('0x50'),_0x5e8146['save_name'],_0x5e8146['converted_format']));fs[_0x9ddb('0x5e')](_0x561d6d);fs[_0x9ddb('0x5e')](_0x184c4d);return _0x5e8146;})[_0x9ddb('0x23')](function(_0x3bfee5){if(_0x3bfee5){return _0x45110c[_0x9ddb('0x1a')](0xcc)[_0x9ddb('0x1b')]();}})['then'](handleEntityNotFound(_0x45110c,null))[_0x9ddb('0x42')](handleError(_0x45110c,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 9bee632..81d42a9 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 _0x6504=['../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4914ad,_0x551a18){var _0x3cd61f=function(_0x2a773e){while(--_0x2a773e){_0x4914ad['push'](_0x4914ad['shift']());}};_0x3cd61f(++_0x551a18);}(_0x6504,0x180));var _0x4650=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6504[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4650('0x0'));var logger=require(_0x4650('0x1'))(_0x4650('0x2'));var moment=require(_0x4650('0x3'));var BPromise=require(_0x4650('0x4'));var rp=require(_0x4650('0x5'));var fs=require('fs');var path=require(_0x4650('0x6'));var rimraf=require(_0x4650('0x7'));var config=require(_0x4650('0x8'));var attributes=require(_0x4650('0x9'));module[_0x4650('0xa')]=function(_0xce5a5b,_0xfd986f){return _0xce5a5b[_0x4650('0xb')](_0x4650('0xc'),attributes,{'tableName':_0x4650('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedb1=['../../config/environment','./sound.attributes','exports','define','tools_sounds','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x19c450,_0x5db640){var _0x571399=function(_0x3369dc){while(--_0x3369dc){_0x19c450['push'](_0x19c450['shift']());}};_0x571399(++_0x5db640);}(_0xedb1,0x1b5));var _0x1edb=function(_0x58cab6,_0x4170f7){_0x58cab6=_0x58cab6-0x0;var _0x43743b=_0xedb1[_0x58cab6];return _0x43743b;};'use strict';var _=require(_0x1edb('0x0'));var util=require(_0x1edb('0x1'));var logger=require(_0x1edb('0x2'))(_0x1edb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1edb('0x4'));var fs=require('fs');var path=require(_0x1edb('0x5'));var rimraf=require(_0x1edb('0x6'));var config=require(_0x1edb('0x7'));var attributes=require(_0x1edb('0x8'));module[_0x1edb('0x9')]=function(_0x1e0f79,_0x1d2097){return _0x1e0f79[_0x1edb('0xa')]('Sound',attributes,{'tableName':_0x1edb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index dff3ab2..bf405c2 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 _0xde3a=['client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','ShowSound','Sound','options','raw','where','attributes','include','model','map','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xde3a,0x89));var _0xade3=function(_0x5ad1ce,_0x17b9ff){_0x5ad1ce=_0x5ad1ce-0x0;var _0x4ac0ed=_0xde3a[_0x5ad1ce];return _0x4ac0ed;};'use strict';var _=require(_0xade3('0x0'));var util=require(_0xade3('0x1'));var moment=require(_0xade3('0x2'));var BPromise=require(_0xade3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xade3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xade3('0x5'))('rpc');var config=require(_0xade3('0x6'));var jayson=require(_0xade3('0x7'));var client=jayson[_0xade3('0x8')][_0xade3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ae583,_0x4a90d,_0x2d1660){return new BPromise(function(_0x2a7d0f,_0x2f8bf3){return client[_0xade3('0xa')](_0x5ae583,_0x2d1660)[_0xade3('0xb')](function(_0x497d06){logger[_0xade3('0xc')](_0xade3('0xd'),_0x4a90d,_0xade3('0xe'));logger[_0xade3('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x4a90d,_0xade3('0xe'),JSON[_0xade3('0x10')](_0x497d06));if(_0x497d06['error']){if(_0x497d06[_0xade3('0x11')]['code']===0x1f4){logger[_0xade3('0x11')]('Sound,\x20%s,\x20%s',_0x4a90d,_0x497d06[_0xade3('0x11')][_0xade3('0x12')]);return _0x2f8bf3(_0x497d06['error'][_0xade3('0x12')]);}logger['error']('Sound,\x20%s,\x20%s',_0x4a90d,_0x497d06['error'][_0xade3('0x12')]);return _0x2a7d0f(_0x497d06[_0xade3('0x11')]['message']);}else{logger[_0xade3('0xc')]('Sound,\x20%s,\x20%s',_0x4a90d,_0xade3('0xe'));_0x2a7d0f(_0x497d06['result'][_0xade3('0x12')]);}})[_0xade3('0x13')](function(_0xa1a51f){logger[_0xade3('0x11')]('Sound,\x20%s,\x20%s',_0x4a90d,_0xa1a51f);_0x2f8bf3(_0xa1a51f);});});}exports[_0xade3('0x14')]=function(_0x52f530){var _0x4d9a3c=this;return new Promise(function(_0x2ce810,_0x151dc){return db[_0xade3('0x15')]['find']({'raw':_0x52f530[_0xade3('0x16')]?_0x52f530[_0xade3('0x16')][_0xade3('0x17')]===undefined?!![]:![]:!![],'where':_0x52f530['options']?_0x52f530['options'][_0xade3('0x18')]||null:null,'attributes':_0x52f530[_0xade3('0x16')]?_0x52f530[_0xade3('0x16')][_0xade3('0x19')]||null:null,'include':_0x52f530[_0xade3('0x16')]?_0x52f530[_0xade3('0x16')]['include']?_['map'](_0x52f530[_0xade3('0x16')][_0xade3('0x1a')],function(_0x105e05){return{'model':db[_0x105e05[_0xade3('0x1b')]],'as':_0x105e05['as'],'attributes':_0x105e05['attributes'],'include':_0x105e05[_0xade3('0x1a')]?_['map'](_0x105e05[_0xade3('0x1a')],function(_0x5dafcd){return{'model':db[_0x5dafcd['model']],'as':_0x5dafcd['as'],'attributes':_0x5dafcd[_0xade3('0x19')],'include':_0x5dafcd['include']?_[_0xade3('0x1c')](_0x5dafcd[_0xade3('0x1a')],function(_0x1a654d){return{'model':db[_0x1a654d['model']],'as':_0x1a654d['as'],'attributes':_0x1a654d[_0xade3('0x19')]};}):[]};}):[]};}):[]:[]})[_0xade3('0xb')](function(_0x3c9e74){logger[_0xade3('0xc')](_0xade3('0x14'),_0x52f530);logger['debug'](_0xade3('0x14'),_0x52f530,JSON[_0xade3('0x10')](_0x3c9e74));_0x2ce810(_0x3c9e74);})[_0xade3('0x13')](function(_0x36c844){logger['error'](_0xade3('0x14'),_0x36c844[_0xade3('0x12')],_0x52f530);_0x151dc(_0x4d9a3c[_0xade3('0x11')](0x1f4,_0x36c844[_0xade3('0x12')]));});});}; \ No newline at end of file +var _0x2c04=['../../config/logger','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSound','find','options','raw','where','attributes','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4b99ed,_0x43c7f7){var _0x45f062=function(_0x59d7a6){while(--_0x59d7a6){_0x4b99ed['push'](_0x4b99ed['shift']());}};_0x45f062(++_0x43c7f7);}(_0x2c04,0x1b9));var _0x42c0=function(_0x2ea548,_0x52b514){_0x2ea548=_0x2ea548-0x0;var _0x1169da=_0x2c04[_0x2ea548];return _0x1169da;};'use strict';var _=require(_0x42c0('0x0'));var util=require(_0x42c0('0x1'));var moment=require(_0x42c0('0x2'));var BPromise=require(_0x42c0('0x3'));var rs=require(_0x42c0('0x4'));var fs=require('fs');var Redis=require(_0x42c0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x42c0('0x6'));var logger=require(_0x42c0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x42c0('0x8'));var client=jayson[_0x42c0('0x9')][_0x42c0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x522806,_0x122aed,_0x36ad39){return new BPromise(function(_0x195b85,_0x159a5b){return client[_0x42c0('0xb')](_0x522806,_0x36ad39)['then'](function(_0x2956a4){logger[_0x42c0('0xc')](_0x42c0('0xd'),_0x122aed,_0x42c0('0xe'));logger[_0x42c0('0xf')](_0x42c0('0x10'),_0x122aed,_0x42c0('0xe'),JSON[_0x42c0('0x11')](_0x2956a4));if(_0x2956a4['error']){if(_0x2956a4[_0x42c0('0x12')]['code']===0x1f4){logger[_0x42c0('0x12')]('Sound,\x20%s,\x20%s',_0x122aed,_0x2956a4[_0x42c0('0x12')]['message']);return _0x159a5b(_0x2956a4[_0x42c0('0x12')][_0x42c0('0x13')]);}logger[_0x42c0('0x12')](_0x42c0('0xd'),_0x122aed,_0x2956a4[_0x42c0('0x12')][_0x42c0('0x13')]);return _0x195b85(_0x2956a4[_0x42c0('0x12')][_0x42c0('0x13')]);}else{logger[_0x42c0('0xc')](_0x42c0('0xd'),_0x122aed,_0x42c0('0xe'));_0x195b85(_0x2956a4[_0x42c0('0x14')][_0x42c0('0x13')]);}})[_0x42c0('0x15')](function(_0x5547ff){logger[_0x42c0('0x12')](_0x42c0('0xd'),_0x122aed,_0x5547ff);_0x159a5b(_0x5547ff);});});}exports[_0x42c0('0x16')]=function(_0x54a4fa){var _0x144a48=this;return new Promise(function(_0x4969ab,_0x2841d2){return db['Sound'][_0x42c0('0x17')]({'raw':_0x54a4fa[_0x42c0('0x18')]?_0x54a4fa[_0x42c0('0x18')][_0x42c0('0x19')]===undefined?!![]:![]:!![],'where':_0x54a4fa[_0x42c0('0x18')]?_0x54a4fa['options'][_0x42c0('0x1a')]||null:null,'attributes':_0x54a4fa[_0x42c0('0x18')]?_0x54a4fa[_0x42c0('0x18')][_0x42c0('0x1b')]||null:null,'include':_0x54a4fa[_0x42c0('0x18')]?_0x54a4fa[_0x42c0('0x18')][_0x42c0('0x1c')]?_[_0x42c0('0x1d')](_0x54a4fa[_0x42c0('0x18')][_0x42c0('0x1c')],function(_0x29e2d2){return{'model':db[_0x29e2d2[_0x42c0('0x1e')]],'as':_0x29e2d2['as'],'attributes':_0x29e2d2['attributes'],'include':_0x29e2d2[_0x42c0('0x1c')]?_['map'](_0x29e2d2[_0x42c0('0x1c')],function(_0x320953){return{'model':db[_0x320953[_0x42c0('0x1e')]],'as':_0x320953['as'],'attributes':_0x320953['attributes'],'include':_0x320953['include']?_[_0x42c0('0x1d')](_0x320953['include'],function(_0x490219){return{'model':db[_0x490219['model']],'as':_0x490219['as'],'attributes':_0x490219[_0x42c0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x42c0('0x1f')](function(_0x580745){logger['info'](_0x42c0('0x16'),_0x54a4fa);logger[_0x42c0('0xf')](_0x42c0('0x16'),_0x54a4fa,JSON['stringify'](_0x580745));_0x4969ab(_0x580745);})['catch'](function(_0x528638){logger['error'](_0x42c0('0x16'),_0x528638[_0x42c0('0x13')],_0x54a4fa);_0x2841d2(_0x144a48[_0x42c0('0x12')](0x1f4,_0x528638[_0x42c0('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 1105354..a98c709 100644 --- a/server/api/squareMessage/index.js +++ b/server/api/squareMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x14a0=['get','isAuthenticated','/:id','show','create','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareMessage.controller'];(function(_0x33308a,_0x225be0){var _0x3e4fc4=function(_0x445268){while(--_0x445268){_0x33308a['push'](_0x33308a['shift']());}};_0x3e4fc4(++_0x225be0);}(_0x14a0,0x8e));var _0x014a=function(_0x5da038,_0x439e4c){_0x5da038=_0x5da038-0x0;var _0x2f45c1=_0x14a0[_0x5da038];return _0x2f45c1;};'use strict';var multer=require('multer');var util=require(_0x014a('0x0'));var path=require(_0x014a('0x1'));var timeout=require(_0x014a('0x2'));var express=require(_0x014a('0x3'));var router=express[_0x014a('0x4')]();var fs_extra=require(_0x014a('0x5'));var auth=require(_0x014a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x014a('0x7'));router[_0x014a('0x8')]('/',auth[_0x014a('0x9')](),controller['index']);router['get'](_0x014a('0xa'),auth[_0x014a('0x9')](),controller[_0x014a('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x014a('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x014a('0xd')]('/:id',auth[_0x014a('0x9')](),controller[_0x014a('0xe')]);module['exports']=router; \ No newline at end of file +var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x378aca,_0x13e103){var _0x1b7b4b=function(_0xed42d6){while(--_0xed42d6){_0x378aca['push'](_0x378aca['shift']());}};_0x1b7b4b(++_0x13e103);}(_0xda3f,0xec));var _0xfda3=function(_0x58cf51,_0x412930){_0x58cf51=_0x58cf51-0x0;var _0x516ddc=_0xda3f[_0x58cf51];return _0x516ddc;};'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('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index f69858b..c17d8c3 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 _0xc4e3=['TEXT','exports','STRING','medium','out'];(function(_0x367361,_0x311488){var _0x195d2d=function(_0x2b20a4){while(--_0x2b20a4){_0x367361['push'](_0x367361['shift']());}};_0x195d2d(++_0x311488);}(_0xc4e3,0x11e));var _0x3c4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4e3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x3c4e('0x0')]={'uniqueid':{'type':Sequelize[_0x3c4e('0x1')]},'body':{'type':Sequelize['TEXT'](_0x3c4e('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x3c4e('0x3')),'defaultValue':_0x3c4e('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0x3c4e('0x1')]},'providerResponse':{'type':Sequelize[_0x3c4e('0x4')]}}; \ No newline at end of file +var _0x53ab=['exports','STRING','medium','ENUM','out','TEXT'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0x53ab,0x13e));var _0xb53a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53ab[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xb53a('0x0')]={'uniqueid':{'type':Sequelize[_0xb53a('0x1')]},'body':{'type':Sequelize['TEXT'](_0xb53a('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0xb53a('0x3')]('in',_0xb53a('0x4')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0xb53a('0x1')]},'providerResponse':{'type':Sequelize[_0xb53a('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index f1fd726..19344c5 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 _0xa321=['params','keys','attributes','options','find','body','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','model','query','filters','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa321,0x9d));var _0x1a32=function(_0x2341c6,_0x3af092){_0x2341c6=_0x2341c6-0x0;var _0x54c34d=_0xa321[_0x2341c6];return _0x54c34d;};'use strict';var emlformat=require(_0x1a32('0x0'));var rimraf=require(_0x1a32('0x1'));var zipdir=require(_0x1a32('0x2'));var jsonpatch=require(_0x1a32('0x3'));var rp=require('request-promise');var moment=require(_0x1a32('0x4'));var BPromise=require(_0x1a32('0x5'));var Mustache=require('mustache');var util=require(_0x1a32('0x6'));var path=require(_0x1a32('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a32('0x8'));var _=require('lodash');var squel=require(_0x1a32('0x9'));var crypto=require(_0x1a32('0xa'));var jsforce=require(_0x1a32('0xb'));var deskjs=require(_0x1a32('0xc'));var toCsv=require(_0x1a32('0xd'));var querystring=require('querystring');var Papa=require(_0x1a32('0xe'));var Redis=require(_0x1a32('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1a32('0x10'));var as=require(_0x1a32('0x11'));var hardwareService=require(_0x1a32('0x12'));var logger=require(_0x1a32('0x13'))(_0x1a32('0x14'));var utils=require(_0x1a32('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1a32('0x16'));var db=require(_0x1a32('0x17'))['db'];function respondWithStatusCode(_0x3b710d,_0x5ea58a){_0x5ea58a=_0x5ea58a||0xcc;return function(_0x42a275){if(_0x42a275){return _0x3b710d[_0x1a32('0x18')](_0x5ea58a);}return _0x3b710d[_0x1a32('0x19')](_0x5ea58a)[_0x1a32('0x1a')]();};}function respondWithResult(_0x171cad,_0x4bcf66){_0x4bcf66=_0x4bcf66||0xc8;return function(_0x4498c7){if(_0x4498c7){return _0x171cad[_0x1a32('0x19')](_0x4bcf66)[_0x1a32('0x1b')](_0x4498c7);}};}function respondWithFilteredResult(_0x268b0a,_0x3400ba){return function(_0x2a66b2){if(_0x2a66b2){var _0x5c272a=typeof _0x3400ba[_0x1a32('0x1c')]===_0x1a32('0x1d')&&typeof _0x3400ba['limit']===_0x1a32('0x1d');var _0x1a68ef=_0x2a66b2[_0x1a32('0x1e')];var _0x3b2983=_0x5c272a?0x0:_0x3400ba[_0x1a32('0x1c')];var _0x303afb=_0x5c272a?_0x2a66b2[_0x1a32('0x1e')]:_0x3400ba[_0x1a32('0x1c')]+_0x3400ba[_0x1a32('0x1f')];var _0x17fcea;if(_0x303afb>=_0x1a68ef){_0x303afb=_0x1a68ef;_0x17fcea=0xc8;}else{_0x17fcea=0xce;}_0x268b0a[_0x1a32('0x19')](_0x17fcea);return _0x268b0a['set'](_0x1a32('0x20'),_0x3b2983+'-'+_0x303afb+'/'+_0x1a68ef)[_0x1a32('0x1b')](_0x2a66b2);}return null;};}function patchUpdates(_0x235fd0){return function(_0x5a12d5){try{jsonpatch[_0x1a32('0x21')](_0x5a12d5,_0x235fd0,!![]);}catch(_0xa7c5c1){return BPromise['reject'](_0xa7c5c1);}return _0x5a12d5[_0x1a32('0x22')]();};}function saveUpdates(_0x55c6a0,_0x125504){return function(_0x3f1409){if(_0x3f1409){return _0x3f1409['update'](_0x55c6a0)[_0x1a32('0x23')](function(_0x33fc4f){return _0x33fc4f;});}return null;};}function removeEntity(_0x2c93b0,_0x5e9a5e){return function(_0x2d6637){if(_0x2d6637){return _0x2d6637[_0x1a32('0x24')]()['then'](function(){_0x2c93b0[_0x1a32('0x19')](0xcc)[_0x1a32('0x1a')]();});}};}function handleEntityNotFound(_0x533700,_0x41c892){return function(_0x4b3b33){if(!_0x4b3b33){_0x533700['sendStatus'](0x194);}return _0x4b3b33;};}function handleError(_0x5edf08,_0x4c24b0){_0x4c24b0=_0x4c24b0||0x1f4;return function(_0x57eb3c){logger[_0x1a32('0x25')](_0x57eb3c[_0x1a32('0x26')]);if(_0x57eb3c[_0x1a32('0x27')]){delete _0x57eb3c[_0x1a32('0x27')];}_0x5edf08[_0x1a32('0x19')](_0x4c24b0)[_0x1a32('0x28')](_0x57eb3c);};}exports[_0x1a32('0x29')]=function(_0x2edc3e,_0x48d69d){var _0x3a51e2={},_0x2fe917={},_0x37d660={'count':0x0,'rows':[]};var _0x10c616=_[_0x1a32('0x2a')](db[_0x1a32('0x2b')][_0x1a32('0x2c')],function(_0x1211e2){return{'name':_0x1211e2[_0x1a32('0x2d')],'type':_0x1211e2['type'][_0x1a32('0x2e')]};});_0x2fe917[_0x1a32('0x2f')]=_['map'](_0x10c616,'name');_0x2fe917[_0x1a32('0x30')]=_['keys'](_0x2edc3e['query']);_0x2fe917[_0x1a32('0x31')]=_['intersection'](_0x2fe917['model'],_0x2fe917['query']);_0x3a51e2['attributes']=_[_0x1a32('0x32')](_0x2fe917[_0x1a32('0x2f')],qs[_0x1a32('0x33')](_0x2edc3e[_0x1a32('0x30')][_0x1a32('0x33')]));_0x3a51e2['attributes']=_0x3a51e2['attributes'][_0x1a32('0x34')]?_0x3a51e2['attributes']:_0x2fe917[_0x1a32('0x2f')];if(!_0x2edc3e[_0x1a32('0x30')][_0x1a32('0x35')]('nolimit')){_0x3a51e2[_0x1a32('0x1f')]=qs[_0x1a32('0x1f')](_0x2edc3e[_0x1a32('0x30')][_0x1a32('0x1f')]);_0x3a51e2[_0x1a32('0x1c')]=qs[_0x1a32('0x1c')](_0x2edc3e[_0x1a32('0x30')][_0x1a32('0x1c')]);}_0x3a51e2[_0x1a32('0x36')]=qs['sort'](_0x2edc3e[_0x1a32('0x30')][_0x1a32('0x37')]);_0x3a51e2[_0x1a32('0x38')]=qs['filters'](_[_0x1a32('0x39')](_0x2edc3e[_0x1a32('0x30')],_0x2fe917[_0x1a32('0x31')]),_0x10c616);if(_0x2edc3e[_0x1a32('0x30')][_0x1a32('0x3a')]){_0x3a51e2[_0x1a32('0x38')]=_[_0x1a32('0x3b')](_0x3a51e2[_0x1a32('0x38')],{'$or':_[_0x1a32('0x2a')](_0x10c616,function(_0x11f25c){if(_0x11f25c[_0x1a32('0x3c')]!==_0x1a32('0x3d')){var _0x1bdd9c={};_0x1bdd9c[_0x11f25c[_0x1a32('0x27')]]={'$like':'%'+_0x2edc3e[_0x1a32('0x30')]['filter']+'%'};return _0x1bdd9c;}})});}_0x3a51e2=_['merge']({},_0x3a51e2,_0x2edc3e['options']);var _0x299826={'where':_0x3a51e2[_0x1a32('0x38')]};return db[_0x1a32('0x2b')][_0x1a32('0x1e')](_0x299826)[_0x1a32('0x23')](function(_0x54150d){_0x37d660[_0x1a32('0x1e')]=_0x54150d;if(_0x2edc3e[_0x1a32('0x30')][_0x1a32('0x3e')]){_0x3a51e2[_0x1a32('0x3f')]=[{'all':!![]}];}return db[_0x1a32('0x2b')][_0x1a32('0x40')](_0x3a51e2);})['then'](function(_0x2e618e){_0x37d660[_0x1a32('0x41')]=_0x2e618e;return _0x37d660;})[_0x1a32('0x23')](respondWithFilteredResult(_0x48d69d,_0x3a51e2))[_0x1a32('0x42')](handleError(_0x48d69d,null));};exports[_0x1a32('0x43')]=function(_0x4d779c,_0x4b8551){var _0x4dbab5={'raw':!![],'where':{'id':_0x4d779c[_0x1a32('0x44')]['id']}},_0x5e58f7={};_0x5e58f7[_0x1a32('0x2f')]=_['keys'](db[_0x1a32('0x2b')][_0x1a32('0x2c')]);_0x5e58f7[_0x1a32('0x30')]=_[_0x1a32('0x45')](_0x4d779c[_0x1a32('0x30')]);_0x5e58f7[_0x1a32('0x31')]=_[_0x1a32('0x32')](_0x5e58f7[_0x1a32('0x2f')],_0x5e58f7[_0x1a32('0x30')]);_0x4dbab5[_0x1a32('0x46')]=_[_0x1a32('0x32')](_0x5e58f7[_0x1a32('0x2f')],qs[_0x1a32('0x33')](_0x4d779c['query'][_0x1a32('0x33')]));_0x4dbab5['attributes']=_0x4dbab5['attributes'][_0x1a32('0x34')]?_0x4dbab5['attributes']:_0x5e58f7[_0x1a32('0x2f')];if(_0x4d779c['query'][_0x1a32('0x3e')]){_0x4dbab5[_0x1a32('0x3f')]=[{'all':!![]}];}_0x4dbab5=_[_0x1a32('0x3b')]({},_0x4dbab5,_0x4d779c[_0x1a32('0x47')]);return db[_0x1a32('0x2b')][_0x1a32('0x48')](_0x4dbab5)[_0x1a32('0x23')](handleEntityNotFound(_0x4b8551,null))[_0x1a32('0x23')](respondWithResult(_0x4b8551,null))[_0x1a32('0x42')](handleError(_0x4b8551,null));};exports['create']=function(_0x3e0bad,_0x1514ef){return db[_0x1a32('0x2b')]['create'](_0x3e0bad[_0x1a32('0x49')],{})[_0x1a32('0x23')](respondWithResult(_0x1514ef,0xc9))[_0x1a32('0x42')](handleError(_0x1514ef,null));};exports[_0x1a32('0x4a')]=function(_0x18fbef,_0x4a902c){if(_0x18fbef[_0x1a32('0x49')]['id']){delete _0x18fbef[_0x1a32('0x49')]['id'];}return db[_0x1a32('0x2b')][_0x1a32('0x48')]({'where':{'id':_0x18fbef[_0x1a32('0x44')]['id']}})[_0x1a32('0x23')](handleEntityNotFound(_0x4a902c,null))[_0x1a32('0x23')](saveUpdates(_0x18fbef[_0x1a32('0x49')],null))[_0x1a32('0x23')](respondWithResult(_0x4a902c,null))['catch'](handleError(_0x4a902c,null));};exports[_0x1a32('0x24')]=function(_0xc50291,_0x19bd92){return db['SquareMessage'][_0x1a32('0x48')]({'where':{'id':_0xc50291[_0x1a32('0x44')]['id']}})['then'](handleEntityNotFound(_0x19bd92,null))[_0x1a32('0x23')](removeEntity(_0x19bd92,null))[_0x1a32('0x42')](handleError(_0x19bd92,null));}; \ No newline at end of file +var _0xb36b=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','options','SquareMessage','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','stack','name','index','rawAttributes','fieldName','type','key','map','query','intersection','model'];(function(_0x5831bc,_0x367e2c){var _0x8a0f61=function(_0x2136d5){while(--_0x2136d5){_0x5831bc['push'](_0x5831bc['shift']());}};_0x8a0f61(++_0x367e2c);}(_0xb36b,0xac));var _0xbb36=function(_0x25aaf8,_0x350d25){_0x25aaf8=_0x25aaf8-0x0;var _0x1f1bed=_0xb36b[_0x25aaf8];return _0x1f1bed;};'use strict';var emlformat=require(_0xbb36('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb36('0x1'));var jsonpatch=require(_0xbb36('0x2'));var rp=require(_0xbb36('0x3'));var moment=require(_0xbb36('0x4'));var BPromise=require(_0xbb36('0x5'));var Mustache=require('mustache');var util=require(_0xbb36('0x6'));var path=require(_0xbb36('0x7'));var sox=require(_0xbb36('0x8'));var csv=require(_0xbb36('0x9'));var ejs=require(_0xbb36('0xa'));var fs=require('fs');var fs_extra=require(_0xbb36('0xb'));var _=require(_0xbb36('0xc'));var squel=require(_0xbb36('0xd'));var crypto=require(_0xbb36('0xe'));var jsforce=require(_0xbb36('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbb36('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xbb36('0x11'));var qs=require(_0xbb36('0x12'));var as=require(_0xbb36('0x13'));var hardwareService=require(_0xbb36('0x14'));var logger=require(_0xbb36('0x15'))('api');var utils=require(_0xbb36('0x16'));var config=require(_0xbb36('0x17'));var licenseUtil=require(_0xbb36('0x18'));var db=require(_0xbb36('0x19'))['db'];function respondWithStatusCode(_0x55d7ba,_0x248529){_0x248529=_0x248529||0xcc;return function(_0x119403){if(_0x119403){return _0x55d7ba[_0xbb36('0x1a')](_0x248529);}return _0x55d7ba[_0xbb36('0x1b')](_0x248529)[_0xbb36('0x1c')]();};}function respondWithResult(_0x326c44,_0x3e8ceb){_0x3e8ceb=_0x3e8ceb||0xc8;return function(_0x8811d8){if(_0x8811d8){return _0x326c44[_0xbb36('0x1b')](_0x3e8ceb)[_0xbb36('0x1d')](_0x8811d8);}};}function respondWithFilteredResult(_0x8325a8,_0x4d022e){return function(_0x595c49){if(_0x595c49){var _0x3c5820=typeof _0x4d022e[_0xbb36('0x1e')]===_0xbb36('0x1f')&&typeof _0x4d022e[_0xbb36('0x20')]===_0xbb36('0x1f');var _0x18af40=_0x595c49[_0xbb36('0x21')];var _0x15c49a=_0x3c5820?0x0:_0x4d022e[_0xbb36('0x1e')];var _0x519a97=_0x3c5820?_0x595c49['count']:_0x4d022e[_0xbb36('0x1e')]+_0x4d022e[_0xbb36('0x20')];var _0x156918;if(_0x519a97>=_0x18af40){_0x519a97=_0x18af40;_0x156918=0xc8;}else{_0x156918=0xce;}_0x8325a8[_0xbb36('0x1b')](_0x156918);return _0x8325a8[_0xbb36('0x22')](_0xbb36('0x23'),_0x15c49a+'-'+_0x519a97+'/'+_0x18af40)[_0xbb36('0x1d')](_0x595c49);}return null;};}function patchUpdates(_0x22d35e){return function(_0x19a820){try{jsonpatch['apply'](_0x19a820,_0x22d35e,!![]);}catch(_0x617822){return BPromise[_0xbb36('0x24')](_0x617822);}return _0x19a820['save']();};}function saveUpdates(_0x2c92d2,_0x3b7358){return function(_0x1571f1){if(_0x1571f1){return _0x1571f1[_0xbb36('0x25')](_0x2c92d2)[_0xbb36('0x26')](function(_0x1e688b){return _0x1e688b;});}return null;};}function removeEntity(_0x5033e5,_0x523db7){return function(_0x42fd9c){if(_0x42fd9c){return _0x42fd9c['destroy']()[_0xbb36('0x26')](function(){_0x5033e5[_0xbb36('0x1b')](0xcc)[_0xbb36('0x1c')]();});}};}function handleEntityNotFound(_0xc1239,_0x218c99){return function(_0x537b24){if(!_0x537b24){_0xc1239[_0xbb36('0x1a')](0x194);}return _0x537b24;};}function handleError(_0x34c51e,_0x49b825){_0x49b825=_0x49b825||0x1f4;return function(_0x105e1d){logger['error'](_0x105e1d[_0xbb36('0x27')]);if(_0x105e1d[_0xbb36('0x28')]){delete _0x105e1d['name'];}_0x34c51e[_0xbb36('0x1b')](_0x49b825)['send'](_0x105e1d);};}exports[_0xbb36('0x29')]=function(_0x7c9948,_0x4b5f9c){var _0x4a3b55={},_0x1f6059={},_0x4e417a={'count':0x0,'rows':[]};var _0x24f231=_['map'](db['SquareMessage'][_0xbb36('0x2a')],function(_0x3df68e){return{'name':_0x3df68e[_0xbb36('0x2b')],'type':_0x3df68e[_0xbb36('0x2c')][_0xbb36('0x2d')]};});_0x1f6059['model']=_[_0xbb36('0x2e')](_0x24f231,'name');_0x1f6059[_0xbb36('0x2f')]=_['keys'](_0x7c9948[_0xbb36('0x2f')]);_0x1f6059['filters']=_[_0xbb36('0x30')](_0x1f6059[_0xbb36('0x31')],_0x1f6059[_0xbb36('0x2f')]);_0x4a3b55[_0xbb36('0x32')]=_[_0xbb36('0x30')](_0x1f6059[_0xbb36('0x31')],qs[_0xbb36('0x33')](_0x7c9948['query'][_0xbb36('0x33')]));_0x4a3b55['attributes']=_0x4a3b55[_0xbb36('0x32')][_0xbb36('0x34')]?_0x4a3b55['attributes']:_0x1f6059['model'];if(!_0x7c9948[_0xbb36('0x2f')][_0xbb36('0x35')](_0xbb36('0x36'))){_0x4a3b55[_0xbb36('0x20')]=qs[_0xbb36('0x20')](_0x7c9948['query'][_0xbb36('0x20')]);_0x4a3b55[_0xbb36('0x1e')]=qs[_0xbb36('0x1e')](_0x7c9948[_0xbb36('0x2f')]['offset']);}_0x4a3b55[_0xbb36('0x37')]=qs[_0xbb36('0x38')](_0x7c9948[_0xbb36('0x2f')]['sort']);_0x4a3b55[_0xbb36('0x39')]=qs[_0xbb36('0x3a')](_['pick'](_0x7c9948['query'],_0x1f6059[_0xbb36('0x3a')]),_0x24f231);if(_0x7c9948[_0xbb36('0x2f')]['filter']){_0x4a3b55['where']=_['merge'](_0x4a3b55['where'],{'$or':_[_0xbb36('0x2e')](_0x24f231,function(_0x43c926){if(_0x43c926['type']!=='VIRTUAL'){var _0x23cb6e={};_0x23cb6e[_0x43c926['name']]={'$like':'%'+_0x7c9948[_0xbb36('0x2f')]['filter']+'%'};return _0x23cb6e;}})});}_0x4a3b55=_[_0xbb36('0x3b')]({},_0x4a3b55,_0x7c9948[_0xbb36('0x3c')]);var _0x4f6709={'where':_0x4a3b55[_0xbb36('0x39')]};return db[_0xbb36('0x3d')]['count'](_0x4f6709)[_0xbb36('0x26')](function(_0x20c1d1){_0x4e417a[_0xbb36('0x21')]=_0x20c1d1;if(_0x7c9948['query'][_0xbb36('0x3e')]){_0x4a3b55['include']=[{'all':!![]}];}return db[_0xbb36('0x3d')][_0xbb36('0x3f')](_0x4a3b55);})[_0xbb36('0x26')](function(_0x4b4ea8){_0x4e417a[_0xbb36('0x40')]=_0x4b4ea8;return _0x4e417a;})['then'](respondWithFilteredResult(_0x4b5f9c,_0x4a3b55))['catch'](handleError(_0x4b5f9c,null));};exports[_0xbb36('0x41')]=function(_0x5622c8,_0x4433dc){var _0xbadba5={'raw':!![],'where':{'id':_0x5622c8[_0xbb36('0x42')]['id']}},_0x446b7d={};_0x446b7d['model']=_[_0xbb36('0x43')](db[_0xbb36('0x3d')]['rawAttributes']);_0x446b7d[_0xbb36('0x2f')]=_['keys'](_0x5622c8[_0xbb36('0x2f')]);_0x446b7d[_0xbb36('0x3a')]=_[_0xbb36('0x30')](_0x446b7d[_0xbb36('0x31')],_0x446b7d[_0xbb36('0x2f')]);_0xbadba5[_0xbb36('0x32')]=_[_0xbb36('0x30')](_0x446b7d['model'],qs[_0xbb36('0x33')](_0x5622c8[_0xbb36('0x2f')]['fields']));_0xbadba5[_0xbb36('0x32')]=_0xbadba5[_0xbb36('0x32')][_0xbb36('0x34')]?_0xbadba5[_0xbb36('0x32')]:_0x446b7d[_0xbb36('0x31')];if(_0x5622c8[_0xbb36('0x2f')][_0xbb36('0x3e')]){_0xbadba5[_0xbb36('0x44')]=[{'all':!![]}];}_0xbadba5=_['merge']({},_0xbadba5,_0x5622c8[_0xbb36('0x3c')]);return db[_0xbb36('0x3d')][_0xbb36('0x45')](_0xbadba5)[_0xbb36('0x26')](handleEntityNotFound(_0x4433dc,null))[_0xbb36('0x26')](respondWithResult(_0x4433dc,null))[_0xbb36('0x46')](handleError(_0x4433dc,null));};exports['create']=function(_0x4b5d9f,_0x3d7134){return db[_0xbb36('0x3d')][_0xbb36('0x47')](_0x4b5d9f['body'],{})[_0xbb36('0x26')](respondWithResult(_0x3d7134,0xc9))[_0xbb36('0x46')](handleError(_0x3d7134,null));};exports[_0xbb36('0x25')]=function(_0x422c4e,_0x4e62b3){if(_0x422c4e['body']['id']){delete _0x422c4e[_0xbb36('0x48')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x422c4e['params']['id']}})[_0xbb36('0x26')](handleEntityNotFound(_0x4e62b3,null))[_0xbb36('0x26')](saveUpdates(_0x422c4e[_0xbb36('0x48')],null))[_0xbb36('0x26')](respondWithResult(_0x4e62b3,null))['catch'](handleError(_0x4e62b3,null));};exports[_0xbb36('0x49')]=function(_0x56c6cf,_0x534ca4){return db['SquareMessage'][_0xbb36('0x45')]({'where':{'id':_0x56c6cf[_0xbb36('0x42')]['id']}})[_0xbb36('0x26')](handleEntityNotFound(_0x534ca4,null))[_0xbb36('0x26')](removeEntity(_0x534ca4,null))[_0xbb36('0x46')](handleError(_0x534ca4,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 7fbbf53..0448229 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 _0x41ad=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareMessage','lodash','util','../../config/logger'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x41ad,0x15c));var _0xd41a=function(_0x29da35,_0x2d5ad7){_0x29da35=_0x29da35-0x0;var _0x1fb617=_0x41ad[_0x29da35];return _0x1fb617;};'use strict';var _=require(_0xd41a('0x0'));var util=require(_0xd41a('0x1'));var logger=require(_0xd41a('0x2'))(_0xd41a('0x3'));var moment=require(_0xd41a('0x4'));var BPromise=require(_0xd41a('0x5'));var rp=require(_0xd41a('0x6'));var fs=require('fs');var path=require(_0xd41a('0x7'));var rimraf=require(_0xd41a('0x8'));var config=require(_0xd41a('0x9'));var attributes=require('./squareMessage.attributes');module[_0xd41a('0xa')]=function(_0x582b11,_0x373380){return _0x582b11[_0xd41a('0xb')](_0xd41a('0xc'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x355c=['request-promise','path','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x576ec6,_0x14d7c4){var _0x273398=function(_0x2410d0){while(--_0x2410d0){_0x576ec6['push'](_0x576ec6['shift']());}};_0x273398(++_0x14d7c4);}(_0x355c,0x89));var _0xc355=function(_0x4e1409,_0x2eb61d){_0x4e1409=_0x4e1409-0x0;var _0x37b0c1=_0x355c[_0x4e1409];return _0x37b0c1;};'use strict';var _=require(_0xc355('0x0'));var util=require(_0xc355('0x1'));var logger=require(_0xc355('0x2'))(_0xc355('0x3'));var moment=require(_0xc355('0x4'));var BPromise=require(_0xc355('0x5'));var rp=require(_0xc355('0x6'));var fs=require('fs');var path=require(_0xc355('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc355('0x8'));module[_0xc355('0x9')]=function(_0x2c100a,_0x4fb573){return _0x2c100a[_0xc355('0xa')](_0xc355('0xb'),attributes,{'tableName':_0xc355('0xc'),'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 3be5787..acece24 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 _0xbc8e=['info','SquareMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then'];(function(_0x189e97,_0x19c14f){var _0x5f140d=function(_0x1a0e4a){while(--_0x1a0e4a){_0x189e97['push'](_0x189e97['shift']());}};_0x5f140d(++_0x19c14f);}(_0xbc8e,0x153));var _0xebc8=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xbc8e[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xebc8('0x0'));var util=require(_0xebc8('0x1'));var moment=require(_0xebc8('0x2'));var BPromise=require(_0xebc8('0x3'));var rs=require(_0xebc8('0x4'));var fs=require('fs');var Redis=require(_0xebc8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xebc8('0x6'));var logger=require('../../config/logger')(_0xebc8('0x7'));var config=require(_0xebc8('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xebc8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4070f6,_0x544fdf,_0x3ef28f){return new BPromise(function(_0xf36cef,_0x80e81d){return client[_0xebc8('0xa')](_0x4070f6,_0x3ef28f)[_0xebc8('0xb')](function(_0x342650){logger[_0xebc8('0xc')](_0xebc8('0xd'),_0x544fdf,'request\x20sent');logger[_0xebc8('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x544fdf,_0xebc8('0xf'),JSON[_0xebc8('0x10')](_0x342650));if(_0x342650[_0xebc8('0x11')]){if(_0x342650[_0xebc8('0x11')]['code']===0x1f4){logger[_0xebc8('0x11')](_0xebc8('0xd'),_0x544fdf,_0x342650[_0xebc8('0x11')][_0xebc8('0x12')]);return _0x80e81d(_0x342650[_0xebc8('0x11')][_0xebc8('0x12')]);}logger[_0xebc8('0x11')](_0xebc8('0xd'),_0x544fdf,_0x342650[_0xebc8('0x11')]['message']);return _0xf36cef(_0x342650[_0xebc8('0x11')][_0xebc8('0x12')]);}else{logger[_0xebc8('0xc')]('SquareMessage,\x20%s,\x20%s',_0x544fdf,_0xebc8('0xf'));_0xf36cef(_0x342650[_0xebc8('0x13')][_0xebc8('0x12')]);}})[_0xebc8('0x14')](function(_0x46389c){logger[_0xebc8('0x11')](_0xebc8('0xd'),_0x544fdf,_0x46389c);_0x80e81d(_0x46389c);});});}exports[_0xebc8('0x15')]=function(_0x95eebf){var _0x3e9059=this;return new Promise(function(_0x5d1cab,_0x45969c){return db[_0xebc8('0x16')][_0xebc8('0x17')](_0x95eebf[_0xebc8('0x18')],{'raw':_0x95eebf[_0xebc8('0x19')]?_0x95eebf[_0xebc8('0x19')][_0xebc8('0x1a')]===undefined?!![]:![]:!![]})[_0xebc8('0xb')](function(_0x1f192c){logger[_0xebc8('0xc')](_0xebc8('0x15'),_0x95eebf);logger[_0xebc8('0xe')](_0xebc8('0x15'),_0x95eebf,JSON['stringify'](_0x1f192c));_0x5d1cab(_0x1f192c);})[_0xebc8('0x14')](function(_0x24c8d8){logger[_0xebc8('0x11')](_0xebc8('0x15'),_0x24c8d8[_0xebc8('0x12')],_0x95eebf);_0x45969c(_0x3e9059['error'](0x1f4,_0x24c8d8[_0xebc8('0x12')]));});});}; \ No newline at end of file +var _0x7503=['CreateSquareMessage','SquareMessage','create','body','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x55b52a,_0x1ff343){var _0x5d9a80=function(_0x3b2812){while(--_0x3b2812){_0x55b52a['push'](_0x55b52a['shift']());}};_0x5d9a80(++_0x1ff343);}(_0x7503,0x13c));var _0x3750=function(_0x139b63,_0x389ca8){_0x139b63=_0x139b63-0x0;var _0x2493f2=_0x7503[_0x139b63];return _0x2493f2;};'use strict';var _=require(_0x3750('0x0'));var util=require('util');var moment=require(_0x3750('0x1'));var BPromise=require('bluebird');var rs=require(_0x3750('0x2'));var fs=require('fs');var Redis=require(_0x3750('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3750('0x4'));var logger=require(_0x3750('0x5'))(_0x3750('0x6'));var config=require('../../config/environment');var jayson=require(_0x3750('0x7'));var client=jayson['client'][_0x3750('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a2117,_0x4b8d7f,_0x880aad){return new BPromise(function(_0x307070,_0xf31c32){return client['request'](_0x3a2117,_0x880aad)[_0x3750('0x9')](function(_0x4124f3){logger[_0x3750('0xa')](_0x3750('0xb'),_0x4b8d7f,_0x3750('0xc'));logger[_0x3750('0xd')](_0x3750('0xe'),_0x4b8d7f,_0x3750('0xc'),JSON[_0x3750('0xf')](_0x4124f3));if(_0x4124f3[_0x3750('0x10')]){if(_0x4124f3[_0x3750('0x10')][_0x3750('0x11')]===0x1f4){logger[_0x3750('0x10')](_0x3750('0xb'),_0x4b8d7f,_0x4124f3[_0x3750('0x10')][_0x3750('0x12')]);return _0xf31c32(_0x4124f3[_0x3750('0x10')][_0x3750('0x12')]);}logger[_0x3750('0x10')](_0x3750('0xb'),_0x4b8d7f,_0x4124f3['error'][_0x3750('0x12')]);return _0x307070(_0x4124f3[_0x3750('0x10')][_0x3750('0x12')]);}else{logger['info'](_0x3750('0xb'),_0x4b8d7f,'request\x20sent');_0x307070(_0x4124f3['result'][_0x3750('0x12')]);}})[_0x3750('0x13')](function(_0x56752f){logger[_0x3750('0x10')]('SquareMessage,\x20%s,\x20%s',_0x4b8d7f,_0x56752f);_0xf31c32(_0x56752f);});});}exports[_0x3750('0x14')]=function(_0x4ef94a){var _0x2b572d=this;return new Promise(function(_0x1b8f8e,_0x213728){return db[_0x3750('0x15')][_0x3750('0x16')](_0x4ef94a[_0x3750('0x17')],{'raw':_0x4ef94a['options']?_0x4ef94a['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x290348){logger[_0x3750('0xa')](_0x3750('0x14'),_0x4ef94a);logger[_0x3750('0xd')](_0x3750('0x14'),_0x4ef94a,JSON['stringify'](_0x290348));_0x1b8f8e(_0x290348);})[_0x3750('0x13')](function(_0x36994d){logger[_0x3750('0x10')](_0x3750('0x14'),_0x36994d['message'],_0x4ef94a);_0x213728(_0x2b572d[_0x3750('0x10')](0x1f4,_0x36994d[_0x3750('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 6e4332b..5b93303 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 _0xaa8e=['isAuthenticated','/:id','show','/:id/test','15s','test','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0xaa8e,0x1c4));var _0xeaa8=function(_0x427aba,_0xf9cc00){_0x427aba=_0x427aba-0x0;var _0x14911c=_0xaa8e[_0x427aba];return _0x14911c;};'use strict';var multer=require(_0xeaa8('0x0'));var util=require(_0xeaa8('0x1'));var path=require(_0xeaa8('0x2'));var timeout=require(_0xeaa8('0x3'));var express=require(_0xeaa8('0x4'));var router=express['Router']();var fs_extra=require(_0xeaa8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xeaa8('0x6'));var config=require(_0xeaa8('0x7'));var controller=require(_0xeaa8('0x8'));router[_0xeaa8('0x9')]('/',auth[_0xeaa8('0xa')](),controller['index']);router[_0xeaa8('0x9')](_0xeaa8('0xb'),auth['isAuthenticated'](),controller[_0xeaa8('0xc')]);router['get'](_0xeaa8('0xd'),auth[_0xeaa8('0xa')](),timeout(_0xeaa8('0xe')),controller[_0xeaa8('0xf')]);router[_0xeaa8('0x10')]('/',auth[_0xeaa8('0xa')](),controller[_0xeaa8('0x11')]);router['put'](_0xeaa8('0xb'),auth[_0xeaa8('0xa')](),controller[_0xeaa8('0x12')]);router[_0xeaa8('0x13')](_0xeaa8('0xb'),auth[_0xeaa8('0xa')](),controller[_0xeaa8('0x14')]);module[_0xeaa8('0x15')]=router; \ No newline at end of file +var _0x2375=['delete','/:id','destroy','multer','util','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','/:id/test','15s','test','post','create','update'];(function(_0x3662b4,_0x503b4d){var _0x50928c=function(_0x15db69){while(--_0x15db69){_0x3662b4['push'](_0x3662b4['shift']());}};_0x50928c(++_0x503b4d);}(_0x2375,0x16b));var _0x5237=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x2375[_0x3ea913];return _0x2b4f28;};'use strict';var multer=require(_0x5237('0x0'));var util=require(_0x5237('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5237('0x2'));var router=express['Router']();var fs_extra=require(_0x5237('0x3'));var auth=require(_0x5237('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5237('0x5'));var controller=require('./squareOdbc.controller');router[_0x5237('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5237('0x6')]('/:id',auth[_0x5237('0x7')](),controller[_0x5237('0x8')]);router[_0x5237('0x6')](_0x5237('0x9'),auth[_0x5237('0x7')](),timeout(_0x5237('0xa')),controller[_0x5237('0xb')]);router[_0x5237('0xc')]('/',auth['isAuthenticated'](),controller[_0x5237('0xd')]);router['put']('/:id',auth[_0x5237('0x7')](),controller[_0x5237('0xe')]);router[_0x5237('0xf')](_0x5237('0x10'),auth[_0x5237('0x7')](),controller[_0x5237('0x11')]);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 af9d4b6..0a62353 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 _0x6464=['sequelize','exports','STRING','name'];(function(_0x370e61,_0x5cdb90){var _0x4e9aa9=function(_0x38f2d7){while(--_0x38f2d7){_0x370e61['push'](_0x370e61['shift']());}};_0x4e9aa9(++_0x5cdb90);}(_0x6464,0xe4));var _0x4646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6464[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4646('0x0'));module[_0x4646('0x1')]={'name':{'type':Sequelize[_0x4646('0x2')],'unique':_0x4646('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4646('0x2')]},'description':{'type':Sequelize[_0x4646('0x2')]}}; \ No newline at end of file +var _0x23f3=['name','sequelize','exports','STRING'];(function(_0x5a3fb1,_0x243a9b){var _0x172cb9=function(_0x4aa08c){while(--_0x4aa08c){_0x5a3fb1['push'](_0x5a3fb1['shift']());}};_0x172cb9(++_0x243a9b);}(_0x23f3,0x1bd));var _0x323f=function(_0x11a103,_0x44db11){_0x11a103=_0x11a103-0x0;var _0x7defd1=_0x23f3[_0x11a103];return _0x7defd1;};'use strict';var Sequelize=require(_0x323f('0x0'));module[_0x323f('0x1')]={'name':{'type':Sequelize[_0x323f('0x2')],'unique':_0x323f('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x323f('0x2')]},'description':{'type':Sequelize[_0x323f('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 7fa67b3..04aacbc 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 _0x3cad=['UserProfileResource','destroy','error','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','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/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','get','ODBC'];(function(_0x4f96f4,_0xfbdb46){var _0x7de5b6=function(_0x5d2e9f){while(--_0x5d2e9f){_0x4f96f4['push'](_0x4f96f4['shift']());}};_0x7de5b6(++_0xfbdb46);}(_0x3cad,0x191));var _0xd3ca=function(_0x5c6406,_0x24f170){_0x5c6406=_0x5c6406-0x0;var _0x51c040=_0x3cad[_0x5c6406];return _0x51c040;};'use strict';var emlformat=require(_0xd3ca('0x0'));var rimraf=require(_0xd3ca('0x1'));var zipdir=require(_0xd3ca('0x2'));var jsonpatch=require(_0xd3ca('0x3'));var rp=require(_0xd3ca('0x4'));var moment=require(_0xd3ca('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd3ca('0x6'));var util=require('util');var path=require('path');var sox=require(_0xd3ca('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd3ca('0x8'));var _=require(_0xd3ca('0x9'));var squel=require(_0xd3ca('0xa'));var crypto=require(_0xd3ca('0xb'));var jsforce=require(_0xd3ca('0xc'));var deskjs=require(_0xd3ca('0xd'));var toCsv=require('to-csv');var querystring=require(_0xd3ca('0xe'));var Papa=require(_0xd3ca('0xf'));var Redis=require(_0xd3ca('0x10'));var authService=require(_0xd3ca('0x11'));var qs=require(_0xd3ca('0x12'));var as=require(_0xd3ca('0x13'));var hardwareService=require(_0xd3ca('0x14'));var logger=require(_0xd3ca('0x15'))(_0xd3ca('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd3ca('0x17'));var db=require(_0xd3ca('0x18'))['db'];function respondWithStatusCode(_0x33fbc4,_0x204c16){_0x204c16=_0x204c16||0xcc;return function(_0x44392f){if(_0x44392f){return _0x33fbc4[_0xd3ca('0x19')](_0x204c16);}return _0x33fbc4[_0xd3ca('0x1a')](_0x204c16)['end']();};}function respondWithResult(_0x2371ea,_0x4bdbd9){_0x4bdbd9=_0x4bdbd9||0xc8;return function(_0x15f6a8){if(_0x15f6a8){return _0x2371ea['status'](_0x4bdbd9)[_0xd3ca('0x1b')](_0x15f6a8);}};}function respondWithFilteredResult(_0xe5b6bb,_0x43b203){return function(_0x360271){if(_0x360271){var _0x21b9c2=typeof _0x43b203[_0xd3ca('0x1c')]===_0xd3ca('0x1d')&&typeof _0x43b203[_0xd3ca('0x1e')]===_0xd3ca('0x1d');var _0x42e8e8=_0x360271[_0xd3ca('0x1f')];var _0x56b5a3=_0x21b9c2?0x0:_0x43b203[_0xd3ca('0x1c')];var _0x98ffb1=_0x21b9c2?_0x360271[_0xd3ca('0x1f')]:_0x43b203['offset']+_0x43b203[_0xd3ca('0x1e')];var _0x33a57b;if(_0x98ffb1>=_0x42e8e8){_0x98ffb1=_0x42e8e8;_0x33a57b=0xc8;}else{_0x33a57b=0xce;}_0xe5b6bb[_0xd3ca('0x1a')](_0x33a57b);return _0xe5b6bb['set'](_0xd3ca('0x20'),_0x56b5a3+'-'+_0x98ffb1+'/'+_0x42e8e8)[_0xd3ca('0x1b')](_0x360271);}return null;};}function patchUpdates(_0x340774){return function(_0x2073c5){try{jsonpatch['apply'](_0x2073c5,_0x340774,!![]);}catch(_0x310fce){return BPromise[_0xd3ca('0x21')](_0x310fce);}return _0x2073c5[_0xd3ca('0x22')]();};}function saveUpdates(_0x5ef3cf,_0x14302f){return function(_0x1801e2){if(_0x1801e2){return _0x1801e2[_0xd3ca('0x23')](_0x5ef3cf)[_0xd3ca('0x24')](function(_0x361150){return _0x361150;});}return null;};}function removeEntity(_0x398ecd,_0x199007){return function(_0x500488){if(_0x500488){return _0x500488['destroy']()[_0xd3ca('0x24')](function(){var _0x392908=_0x500488[_0xd3ca('0x25')]({'plain':!![]});var _0x41d309=_0xd3ca('0x26');return db[_0xd3ca('0x27')][_0xd3ca('0x28')]({'where':{'type':_0x41d309,'resourceId':_0x392908['id']}})[_0xd3ca('0x24')](function(){return _0x500488;});})[_0xd3ca('0x24')](function(){_0x398ecd[_0xd3ca('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x407329,_0x3c7329){return function(_0x21a960){if(!_0x21a960){_0x407329[_0xd3ca('0x19')](0x194);}return _0x21a960;};}function handleError(_0x209b1f,_0x40094b){_0x40094b=_0x40094b||0x1f4;return function(_0x25c511){logger[_0xd3ca('0x29')](_0x25c511['stack']);if(_0x25c511[_0xd3ca('0x2a')]){delete _0x25c511['name'];}_0x209b1f[_0xd3ca('0x1a')](_0x40094b)[_0xd3ca('0x2b')](_0x25c511);};}exports[_0xd3ca('0x2c')]=function(_0x312668,_0x5278d5){var _0x2ac4f5={},_0x6690a3={},_0x58a39a={'count':0x0,'rows':[]};var _0x3fdf0a=_[_0xd3ca('0x2d')](db[_0xd3ca('0x2e')][_0xd3ca('0x2f')],function(_0x57b911){return{'name':_0x57b911[_0xd3ca('0x30')],'type':_0x57b911['type'][_0xd3ca('0x31')]};});_0x6690a3[_0xd3ca('0x32')]=_[_0xd3ca('0x2d')](_0x3fdf0a,_0xd3ca('0x2a'));_0x6690a3[_0xd3ca('0x33')]=_[_0xd3ca('0x34')](_0x312668[_0xd3ca('0x33')]);_0x6690a3[_0xd3ca('0x35')]=_[_0xd3ca('0x36')](_0x6690a3[_0xd3ca('0x32')],_0x6690a3[_0xd3ca('0x33')]);_0x2ac4f5['attributes']=_[_0xd3ca('0x36')](_0x6690a3[_0xd3ca('0x32')],qs[_0xd3ca('0x37')](_0x312668[_0xd3ca('0x33')][_0xd3ca('0x37')]));_0x2ac4f5[_0xd3ca('0x38')]=_0x2ac4f5[_0xd3ca('0x38')]['length']?_0x2ac4f5['attributes']:_0x6690a3[_0xd3ca('0x32')];if(!_0x312668['query'][_0xd3ca('0x39')](_0xd3ca('0x3a'))){_0x2ac4f5[_0xd3ca('0x1e')]=qs[_0xd3ca('0x1e')](_0x312668[_0xd3ca('0x33')][_0xd3ca('0x1e')]);_0x2ac4f5['offset']=qs[_0xd3ca('0x1c')](_0x312668[_0xd3ca('0x33')]['offset']);}_0x2ac4f5[_0xd3ca('0x3b')]=qs[_0xd3ca('0x3c')](_0x312668[_0xd3ca('0x33')][_0xd3ca('0x3c')]);_0x2ac4f5[_0xd3ca('0x3d')]=qs[_0xd3ca('0x35')](_[_0xd3ca('0x3e')](_0x312668[_0xd3ca('0x33')],_0x6690a3[_0xd3ca('0x35')]),_0x3fdf0a);if(_0x312668['query'][_0xd3ca('0x3f')]){_0x2ac4f5[_0xd3ca('0x3d')]=_[_0xd3ca('0x40')](_0x2ac4f5[_0xd3ca('0x3d')],{'$or':_[_0xd3ca('0x2d')](_0x3fdf0a,function(_0x463c8b){if(_0x463c8b[_0xd3ca('0x41')]!=='VIRTUAL'){var _0x1a8830={};_0x1a8830[_0x463c8b[_0xd3ca('0x2a')]]={'$like':'%'+_0x312668['query']['filter']+'%'};return _0x1a8830;}})});}_0x2ac4f5=_[_0xd3ca('0x40')]({},_0x2ac4f5,_0x312668[_0xd3ca('0x42')]);var _0xd51952={'where':_0x2ac4f5[_0xd3ca('0x3d')]};return db[_0xd3ca('0x2e')][_0xd3ca('0x1f')](_0xd51952)['then'](function(_0x4a7ed0){_0x58a39a['count']=_0x4a7ed0;if(_0x312668[_0xd3ca('0x33')][_0xd3ca('0x43')]){_0x2ac4f5[_0xd3ca('0x44')]=[{'all':!![]}];}return db[_0xd3ca('0x2e')][_0xd3ca('0x45')](_0x2ac4f5);})[_0xd3ca('0x24')](function(_0x17b0db){_0x58a39a[_0xd3ca('0x46')]=_0x17b0db;return _0x58a39a;})[_0xd3ca('0x24')](respondWithFilteredResult(_0x5278d5,_0x2ac4f5))['catch'](handleError(_0x5278d5,null));};exports[_0xd3ca('0x47')]=function(_0x5bdf4f,_0x1ff119){var _0x1f7a83={'raw':!![],'where':{'id':_0x5bdf4f['params']['id']}},_0x415254={};_0x415254[_0xd3ca('0x32')]=_[_0xd3ca('0x34')](db[_0xd3ca('0x2e')][_0xd3ca('0x2f')]);_0x415254[_0xd3ca('0x33')]=_[_0xd3ca('0x34')](_0x5bdf4f[_0xd3ca('0x33')]);_0x415254['filters']=_['intersection'](_0x415254[_0xd3ca('0x32')],_0x415254[_0xd3ca('0x33')]);_0x1f7a83[_0xd3ca('0x38')]=_[_0xd3ca('0x36')](_0x415254[_0xd3ca('0x32')],qs[_0xd3ca('0x37')](_0x5bdf4f[_0xd3ca('0x33')][_0xd3ca('0x37')]));_0x1f7a83[_0xd3ca('0x38')]=_0x1f7a83[_0xd3ca('0x38')][_0xd3ca('0x48')]?_0x1f7a83[_0xd3ca('0x38')]:_0x415254['model'];if(_0x5bdf4f[_0xd3ca('0x33')][_0xd3ca('0x43')]){_0x1f7a83[_0xd3ca('0x44')]=[{'all':!![]}];}_0x1f7a83=_[_0xd3ca('0x40')]({},_0x1f7a83,_0x5bdf4f[_0xd3ca('0x42')]);return db[_0xd3ca('0x2e')][_0xd3ca('0x49')](_0x1f7a83)['then'](handleEntityNotFound(_0x1ff119,null))['then'](respondWithResult(_0x1ff119,null))[_0xd3ca('0x4a')](handleError(_0x1ff119,null));};exports[_0xd3ca('0x4b')]=function(_0x3a7890,_0x237fd1){return db['SquareOdbc'][_0xd3ca('0x4b')](_0x3a7890[_0xd3ca('0x4c')],{})[_0xd3ca('0x24')](function(_0x58b892){var _0x2feb87=_0x3a7890[_0xd3ca('0x4d')]['get']({'plain':!![]});if(!_0x2feb87)throw new Error(_0xd3ca('0x4e'));if(_0x2feb87[_0xd3ca('0x4f')]===_0xd3ca('0x4d')){var _0x4c75e2=_0x58b892[_0xd3ca('0x25')]({'plain':!![]});var _0xf110ae=_0xd3ca('0x26');return db[_0xd3ca('0x50')][_0xd3ca('0x49')]({'where':{'name':_0xf110ae,'userProfileId':_0x2feb87['userProfileId']},'raw':!![]})[_0xd3ca('0x24')](function(_0x4c53c5){if(_0x4c53c5&&_0x4c53c5[_0xd3ca('0x51')]===0x0){return db[_0xd3ca('0x27')][_0xd3ca('0x4b')]({'name':_0x4c75e2['name'],'resourceId':_0x4c75e2['id'],'type':_0x4c53c5[_0xd3ca('0x2a')],'sectionId':_0x4c53c5['id']},{})[_0xd3ca('0x24')](function(){return _0x58b892;});}else{return _0x58b892;}})[_0xd3ca('0x4a')](function(_0xd0d2d1){logger[_0xd3ca('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xd0d2d1);throw _0xd0d2d1;});}return _0x58b892;})['then'](respondWithResult(_0x237fd1,0xc9))[_0xd3ca('0x4a')](handleError(_0x237fd1,null));};exports[_0xd3ca('0x23')]=function(_0x2320a1,_0x12af5e){if(_0x2320a1[_0xd3ca('0x4c')]['id']){delete _0x2320a1['body']['id'];}return db[_0xd3ca('0x2e')][_0xd3ca('0x49')]({'where':{'id':_0x2320a1[_0xd3ca('0x52')]['id']}})[_0xd3ca('0x24')](handleEntityNotFound(_0x12af5e,null))[_0xd3ca('0x24')](saveUpdates(_0x2320a1[_0xd3ca('0x4c')],null))[_0xd3ca('0x24')](respondWithResult(_0x12af5e,null))[_0xd3ca('0x4a')](handleError(_0x12af5e,null));};exports[_0xd3ca('0x28')]=function(_0x3b6127,_0x221e0b){return db['SquareOdbc'][_0xd3ca('0x49')]({'where':{'id':_0x3b6127[_0xd3ca('0x52')]['id']}})['then'](handleEntityNotFound(_0x221e0b,null))['then'](removeEntity(_0x221e0b,null))[_0xd3ca('0x4a')](handleError(_0x221e0b,null));};exports[_0xd3ca('0x53')]=function(_0x5a4c64,_0x28f806,_0x2c2b68){var _0x430c10;return db[_0xd3ca('0x2e')]['find']({'where':{'id':_0x5a4c64['params']['id']},'attributes':['id',_0xd3ca('0x54')]})[_0xd3ca('0x24')](handleEntityNotFound(_0x28f806,null))['then'](function(_0x3f42c7){if(_0x3f42c7){var _0x21cfc3=require(_0xd3ca('0x55'))();_0x21cfc3[_0xd3ca('0x56')](_0x3f42c7[_0xd3ca('0x54')]);_0x21cfc3[_0xd3ca('0x57')]();return _0x3f42c7;}})['then'](respondWithResult(_0x28f806,null))[_0xd3ca('0x4a')](handleError(_0x28f806,null));}; \ No newline at end of file +var _0x146d=['filters','find','catch','create','body','get','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','test','dsn','odbc','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','save','update','then','ODBC','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params'];(function(_0x2003ca,_0x327d9b){var _0xeaa6c9=function(_0x707dd5){while(--_0x707dd5){_0x2003ca['push'](_0x2003ca['shift']());}};_0xeaa6c9(++_0x327d9b);}(_0x146d,0x161));var _0xd146=function(_0x185fbf,_0x3d147f){_0x185fbf=_0x185fbf-0x0;var _0x169eef=_0x146d[_0x185fbf];return _0x169eef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd146('0x0'));var zipdir=require(_0xd146('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd146('0x2'));var moment=require('moment');var BPromise=require(_0xd146('0x3'));var Mustache=require('mustache');var util=require(_0xd146('0x4'));var path=require(_0xd146('0x5'));var sox=require(_0xd146('0x6'));var csv=require(_0xd146('0x7'));var ejs=require(_0xd146('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xd146('0x9'));var jsforce=require(_0xd146('0xa'));var deskjs=require(_0xd146('0xb'));var toCsv=require(_0xd146('0x7'));var querystring=require(_0xd146('0xc'));var Papa=require(_0xd146('0xd'));var Redis=require(_0xd146('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd146('0xf'));var as=require(_0xd146('0x10'));var hardwareService=require(_0xd146('0x11'));var logger=require(_0xd146('0x12'))(_0xd146('0x13'));var utils=require(_0xd146('0x14'));var config=require(_0xd146('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd146('0x16'))['db'];function respondWithStatusCode(_0x24b991,_0x4c613b){_0x4c613b=_0x4c613b||0xcc;return function(_0x240ec2){if(_0x240ec2){return _0x24b991[_0xd146('0x17')](_0x4c613b);}return _0x24b991['status'](_0x4c613b)[_0xd146('0x18')]();};}function respondWithResult(_0x212f83,_0x12662b){_0x12662b=_0x12662b||0xc8;return function(_0xf65136){if(_0xf65136){return _0x212f83[_0xd146('0x19')](_0x12662b)[_0xd146('0x1a')](_0xf65136);}};}function respondWithFilteredResult(_0x155ec3,_0x3a7935){return function(_0x559273){if(_0x559273){var _0x761ea=typeof _0x3a7935[_0xd146('0x1b')]==='undefined'&&typeof _0x3a7935[_0xd146('0x1c')]===_0xd146('0x1d');var _0x482754=_0x559273[_0xd146('0x1e')];var _0x3ab30d=_0x761ea?0x0:_0x3a7935[_0xd146('0x1b')];var _0x41d32e=_0x761ea?_0x559273[_0xd146('0x1e')]:_0x3a7935[_0xd146('0x1b')]+_0x3a7935[_0xd146('0x1c')];var _0x11cd15;if(_0x41d32e>=_0x482754){_0x41d32e=_0x482754;_0x11cd15=0xc8;}else{_0x11cd15=0xce;}_0x155ec3[_0xd146('0x19')](_0x11cd15);return _0x155ec3[_0xd146('0x1f')]('Content-Range',_0x3ab30d+'-'+_0x41d32e+'/'+_0x482754)[_0xd146('0x1a')](_0x559273);}return null;};}function patchUpdates(_0x43f402){return function(_0x496c9a){try{jsonpatch[_0xd146('0x20')](_0x496c9a,_0x43f402,!![]);}catch(_0x5023fb){return BPromise['reject'](_0x5023fb);}return _0x496c9a[_0xd146('0x21')]();};}function saveUpdates(_0x4111b3,_0x3fa953){return function(_0x1f4211){if(_0x1f4211){return _0x1f4211[_0xd146('0x22')](_0x4111b3)[_0xd146('0x23')](function(_0x3d51af){return _0x3d51af;});}return null;};}function removeEntity(_0x2d7cc2,_0xdbe122){return function(_0x2bc774){if(_0x2bc774){return _0x2bc774['destroy']()[_0xd146('0x23')](function(){var _0x5aeeff=_0x2bc774['get']({'plain':!![]});var _0x5b57d2=_0xd146('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x5b57d2,'resourceId':_0x5aeeff['id']}})[_0xd146('0x23')](function(){return _0x2bc774;});})[_0xd146('0x23')](function(){_0x2d7cc2[_0xd146('0x19')](0xcc)[_0xd146('0x18')]();});}};}function handleEntityNotFound(_0x25fe02,_0x720d96){return function(_0x39d8b0){if(!_0x39d8b0){_0x25fe02['sendStatus'](0x194);}return _0x39d8b0;};}function handleError(_0x348c60,_0xb09b31){_0xb09b31=_0xb09b31||0x1f4;return function(_0x1ee95b){logger['error'](_0x1ee95b[_0xd146('0x25')]);if(_0x1ee95b[_0xd146('0x26')]){delete _0x1ee95b[_0xd146('0x26')];}_0x348c60[_0xd146('0x19')](_0xb09b31)[_0xd146('0x27')](_0x1ee95b);};}exports[_0xd146('0x28')]=function(_0x1c8152,_0x720e6c){var _0x2d14fd={},_0x17fcc7={},_0x5b7ccd={'count':0x0,'rows':[]};var _0x11657f=_[_0xd146('0x29')](db[_0xd146('0x2a')][_0xd146('0x2b')],function(_0xdae14a){return{'name':_0xdae14a[_0xd146('0x2c')],'type':_0xdae14a[_0xd146('0x2d')]['key']};});_0x17fcc7[_0xd146('0x2e')]=_[_0xd146('0x29')](_0x11657f,'name');_0x17fcc7[_0xd146('0x2f')]=_[_0xd146('0x30')](_0x1c8152[_0xd146('0x2f')]);_0x17fcc7['filters']=_[_0xd146('0x31')](_0x17fcc7['model'],_0x17fcc7[_0xd146('0x2f')]);_0x2d14fd[_0xd146('0x32')]=_['intersection'](_0x17fcc7[_0xd146('0x2e')],qs[_0xd146('0x33')](_0x1c8152[_0xd146('0x2f')][_0xd146('0x33')]));_0x2d14fd['attributes']=_0x2d14fd[_0xd146('0x32')][_0xd146('0x34')]?_0x2d14fd[_0xd146('0x32')]:_0x17fcc7['model'];if(!_0x1c8152['query'][_0xd146('0x35')](_0xd146('0x36'))){_0x2d14fd[_0xd146('0x1c')]=qs[_0xd146('0x1c')](_0x1c8152[_0xd146('0x2f')][_0xd146('0x1c')]);_0x2d14fd[_0xd146('0x1b')]=qs[_0xd146('0x1b')](_0x1c8152['query'][_0xd146('0x1b')]);}_0x2d14fd['order']=qs[_0xd146('0x37')](_0x1c8152[_0xd146('0x2f')][_0xd146('0x37')]);_0x2d14fd[_0xd146('0x38')]=qs['filters'](_[_0xd146('0x39')](_0x1c8152['query'],_0x17fcc7['filters']),_0x11657f);if(_0x1c8152['query'][_0xd146('0x3a')]){_0x2d14fd[_0xd146('0x38')]=_[_0xd146('0x3b')](_0x2d14fd[_0xd146('0x38')],{'$or':_['map'](_0x11657f,function(_0x59b63e){if(_0x59b63e[_0xd146('0x2d')]!=='VIRTUAL'){var _0x524d7c={};_0x524d7c[_0x59b63e[_0xd146('0x26')]]={'$like':'%'+_0x1c8152[_0xd146('0x2f')]['filter']+'%'};return _0x524d7c;}})});}_0x2d14fd=_['merge']({},_0x2d14fd,_0x1c8152[_0xd146('0x3c')]);var _0x44d3b2={'where':_0x2d14fd[_0xd146('0x38')]};return db[_0xd146('0x2a')]['count'](_0x44d3b2)[_0xd146('0x23')](function(_0x543005){_0x5b7ccd[_0xd146('0x1e')]=_0x543005;if(_0x1c8152[_0xd146('0x2f')][_0xd146('0x3d')]){_0x2d14fd[_0xd146('0x3e')]=[{'all':!![]}];}return db[_0xd146('0x2a')][_0xd146('0x3f')](_0x2d14fd);})[_0xd146('0x23')](function(_0x4a3888){_0x5b7ccd[_0xd146('0x40')]=_0x4a3888;return _0x5b7ccd;})[_0xd146('0x23')](respondWithFilteredResult(_0x720e6c,_0x2d14fd))['catch'](handleError(_0x720e6c,null));};exports[_0xd146('0x41')]=function(_0x2328cc,_0x5cfdbe){var _0x8995e4={'raw':!![],'where':{'id':_0x2328cc[_0xd146('0x42')]['id']}},_0x43df5b={};_0x43df5b[_0xd146('0x2e')]=_['keys'](db[_0xd146('0x2a')][_0xd146('0x2b')]);_0x43df5b[_0xd146('0x2f')]=_[_0xd146('0x30')](_0x2328cc['query']);_0x43df5b[_0xd146('0x43')]=_[_0xd146('0x31')](_0x43df5b[_0xd146('0x2e')],_0x43df5b[_0xd146('0x2f')]);_0x8995e4[_0xd146('0x32')]=_[_0xd146('0x31')](_0x43df5b[_0xd146('0x2e')],qs['fields'](_0x2328cc[_0xd146('0x2f')][_0xd146('0x33')]));_0x8995e4[_0xd146('0x32')]=_0x8995e4[_0xd146('0x32')][_0xd146('0x34')]?_0x8995e4[_0xd146('0x32')]:_0x43df5b[_0xd146('0x2e')];if(_0x2328cc[_0xd146('0x2f')]['includeAll']){_0x8995e4['include']=[{'all':!![]}];}_0x8995e4=_[_0xd146('0x3b')]({},_0x8995e4,_0x2328cc['options']);return db['SquareOdbc'][_0xd146('0x44')](_0x8995e4)[_0xd146('0x23')](handleEntityNotFound(_0x5cfdbe,null))[_0xd146('0x23')](respondWithResult(_0x5cfdbe,null))[_0xd146('0x45')](handleError(_0x5cfdbe,null));};exports[_0xd146('0x46')]=function(_0x3de400,_0x5cd6e2){return db[_0xd146('0x2a')][_0xd146('0x46')](_0x3de400[_0xd146('0x47')],{})[_0xd146('0x23')](function(_0x52a4d6){var _0x4512a7=_0x3de400['user'][_0xd146('0x48')]({'plain':!![]});if(!_0x4512a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4512a7[_0xd146('0x49')]==='user'){var _0x32ff59=_0x52a4d6[_0xd146('0x48')]({'plain':!![]});var _0x4d745c='ODBC';return db[_0xd146('0x4a')][_0xd146('0x44')]({'where':{'name':_0x4d745c,'userProfileId':_0x4512a7[_0xd146('0x4b')]},'raw':!![]})[_0xd146('0x23')](function(_0x306fb2){if(_0x306fb2&&_0x306fb2[_0xd146('0x4c')]===0x0){return db[_0xd146('0x4d')][_0xd146('0x46')]({'name':_0x32ff59[_0xd146('0x26')],'resourceId':_0x32ff59['id'],'type':_0x306fb2[_0xd146('0x26')],'sectionId':_0x306fb2['id']},{})[_0xd146('0x23')](function(){return _0x52a4d6;});}else{return _0x52a4d6;}})[_0xd146('0x45')](function(_0x3c32c2){logger[_0xd146('0x4e')](_0xd146('0x4f'),_0x3c32c2);throw _0x3c32c2;});}return _0x52a4d6;})[_0xd146('0x23')](respondWithResult(_0x5cd6e2,0xc9))[_0xd146('0x45')](handleError(_0x5cd6e2,null));};exports[_0xd146('0x22')]=function(_0x58f0e1,_0x34a5a2){if(_0x58f0e1['body']['id']){delete _0x58f0e1[_0xd146('0x47')]['id'];}return db[_0xd146('0x2a')][_0xd146('0x44')]({'where':{'id':_0x58f0e1[_0xd146('0x42')]['id']}})[_0xd146('0x23')](handleEntityNotFound(_0x34a5a2,null))[_0xd146('0x23')](saveUpdates(_0x58f0e1['body'],null))['then'](respondWithResult(_0x34a5a2,null))[_0xd146('0x45')](handleError(_0x34a5a2,null));};exports[_0xd146('0x50')]=function(_0x2f3671,_0x1aed5b){return db['SquareOdbc']['find']({'where':{'id':_0x2f3671[_0xd146('0x42')]['id']}})[_0xd146('0x23')](handleEntityNotFound(_0x1aed5b,null))['then'](removeEntity(_0x1aed5b,null))[_0xd146('0x45')](handleError(_0x1aed5b,null));};exports[_0xd146('0x51')]=function(_0x2ee26f,_0x458e6c,_0x1197d9){var _0x441cac;return db['SquareOdbc'][_0xd146('0x44')]({'where':{'id':_0x2ee26f[_0xd146('0x42')]['id']},'attributes':['id',_0xd146('0x52')]})[_0xd146('0x23')](handleEntityNotFound(_0x458e6c,null))[_0xd146('0x23')](function(_0x5bb496){if(_0x5bb496){var _0xfdd520=require(_0xd146('0x53'))();_0xfdd520['openSync'](_0x5bb496['dsn']);_0xfdd520['closeSync']();return _0x5bb496;}})[_0xd146('0x23')](respondWithResult(_0x458e6c,null))['catch'](handleError(_0x458e6c,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 2ff79be..f290e5d 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 _0xfa43=['api','moment','bluebird','request-promise','./squareOdbc.attributes','exports','define','square_odbc','lodash','util'];(function(_0x598db4,_0x3affb7){var _0x411c7d=function(_0x3e57c2){while(--_0x3e57c2){_0x598db4['push'](_0x598db4['shift']());}};_0x411c7d(++_0x3affb7);}(_0xfa43,0x1e8));var _0x3fa4=function(_0xe7971f,_0x5d52ab){_0xe7971f=_0xe7971f-0x0;var _0x6200b9=_0xfa43[_0xe7971f];return _0x6200b9;};'use strict';var _=require(_0x3fa4('0x0'));var util=require(_0x3fa4('0x1'));var logger=require('../../config/logger')(_0x3fa4('0x2'));var moment=require(_0x3fa4('0x3'));var BPromise=require(_0x3fa4('0x4'));var rp=require(_0x3fa4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3fa4('0x6'));module[_0x3fa4('0x7')]=function(_0x232541,_0x49d108){return _0x232541[_0x3fa4('0x8')]('SquareOdbc',attributes,{'tableName':_0x3fa4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa093=['rimraf','../../config/environment','./squareOdbc.attributes','define','square_odbc','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x41aead,_0x18bdb5){var _0x926d67=function(_0x2d31e8){while(--_0x2d31e8){_0x41aead['push'](_0x41aead['shift']());}};_0x926d67(++_0x18bdb5);}(_0xa093,0xc0));var _0x3a09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa093[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3a09('0x0'));var util=require('util');var logger=require(_0x3a09('0x1'))('api');var moment=require(_0x3a09('0x2'));var BPromise=require(_0x3a09('0x3'));var rp=require(_0x3a09('0x4'));var fs=require('fs');var path=require(_0x3a09('0x5'));var rimraf=require(_0x3a09('0x6'));var config=require(_0x3a09('0x7'));var attributes=require(_0x3a09('0x8'));module['exports']=function(_0x4c3594,_0x1f2c11){return _0x4c3594[_0x3a09('0x9')]('SquareOdbc',attributes,{'tableName':_0x3a09('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index dab0184..999a4b2 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 _0xaa3e=['debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','map','attributes','include','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0xaa3e,0xde));var _0xeaa3=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0xaa3e[_0x193e28];return _0x20ef59;};'use strict';var _=require(_0xeaa3('0x0'));var util=require(_0xeaa3('0x1'));var moment=require(_0xeaa3('0x2'));var BPromise=require(_0xeaa3('0x3'));var rs=require(_0xeaa3('0x4'));var fs=require('fs');var Redis=require(_0xeaa3('0x5'));var db=require(_0xeaa3('0x6'))['db'];var utils=require(_0xeaa3('0x7'));var logger=require(_0xeaa3('0x8'))('rpc');var config=require(_0xeaa3('0x9'));var jayson=require(_0xeaa3('0xa'));var client=jayson[_0xeaa3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x520973,_0x1b1d0e,_0x86e54c){return new BPromise(function(_0x27a33d,_0x2fcca6){return client[_0xeaa3('0xc')](_0x520973,_0x86e54c)[_0xeaa3('0xd')](function(_0x31e1e4){logger['info'](_0xeaa3('0xe'),_0x1b1d0e,_0xeaa3('0xf'));logger[_0xeaa3('0x10')](_0xeaa3('0x11'),_0x1b1d0e,_0xeaa3('0xf'),JSON['stringify'](_0x31e1e4));if(_0x31e1e4['error']){if(_0x31e1e4[_0xeaa3('0x12')][_0xeaa3('0x13')]===0x1f4){logger[_0xeaa3('0x12')](_0xeaa3('0xe'),_0x1b1d0e,_0x31e1e4['error'][_0xeaa3('0x14')]);return _0x2fcca6(_0x31e1e4['error'][_0xeaa3('0x14')]);}logger[_0xeaa3('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x1b1d0e,_0x31e1e4[_0xeaa3('0x12')]['message']);return _0x27a33d(_0x31e1e4['error']['message']);}else{logger['info'](_0xeaa3('0xe'),_0x1b1d0e,_0xeaa3('0xf'));_0x27a33d(_0x31e1e4[_0xeaa3('0x15')]['message']);}})[_0xeaa3('0x16')](function(_0x4abadc){logger[_0xeaa3('0x12')](_0xeaa3('0xe'),_0x1b1d0e,_0x4abadc);_0x2fcca6(_0x4abadc);});});}exports[_0xeaa3('0x17')]=function(_0x351951){var _0x151666=this;return new Promise(function(_0x17a585,_0x368d44){return db[_0xeaa3('0x18')][_0xeaa3('0x19')]({'raw':_0x351951[_0xeaa3('0x1a')]?_0x351951['options'][_0xeaa3('0x1b')]===undefined?!![]:![]:!![],'where':_0x351951[_0xeaa3('0x1a')]?_0x351951[_0xeaa3('0x1a')][_0xeaa3('0x1c')]||null:null,'attributes':_0x351951[_0xeaa3('0x1a')]?_0x351951[_0xeaa3('0x1a')]['attributes']||null:null,'include':_0x351951[_0xeaa3('0x1a')]?_0x351951['options']['include']?_[_0xeaa3('0x1d')](_0x351951[_0xeaa3('0x1a')]['include'],function(_0x3e8fe8){return{'model':db[_0x3e8fe8['model']],'as':_0x3e8fe8['as'],'attributes':_0x3e8fe8[_0xeaa3('0x1e')],'include':_0x3e8fe8['include']?_[_0xeaa3('0x1d')](_0x3e8fe8[_0xeaa3('0x1f')],function(_0x1e7d13){return{'model':db[_0x1e7d13[_0xeaa3('0x20')]],'as':_0x1e7d13['as'],'attributes':_0x1e7d13['attributes'],'include':_0x1e7d13['include']?_[_0xeaa3('0x1d')](_0x1e7d13[_0xeaa3('0x1f')],function(_0x258b9c){return{'model':db[_0x258b9c[_0xeaa3('0x20')]],'as':_0x258b9c['as'],'attributes':_0x258b9c[_0xeaa3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xeaa3('0xd')](function(_0x40606a){logger['info'](_0xeaa3('0x17'),_0x351951);logger[_0xeaa3('0x10')](_0xeaa3('0x17'),_0x351951,JSON[_0xeaa3('0x21')](_0x40606a));_0x17a585(_0x40606a);})[_0xeaa3('0x16')](function(_0x252cad){logger[_0xeaa3('0x12')](_0xeaa3('0x17'),_0x252cad[_0xeaa3('0x14')],_0x351951);_0x368d44(_0x151666[_0xeaa3('0x12')](0x1f4,_0x252cad['message']));});});}; \ No newline at end of file +var _0x60b4=['code','message','result','SquareOdbc','find','options','raw','where','attributes','map','include','model','ShowSquareOdbc','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x50f09d,_0x49934b){var _0x4cd6e8=function(_0xf1f968){while(--_0xf1f968){_0x50f09d['push'](_0x50f09d['shift']());}};_0x4cd6e8(++_0x49934b);}(_0x60b4,0x1a4));var _0x460b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x60b4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x460b('0x0'));var util=require(_0x460b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x460b('0x2'));var fs=require('fs');var Redis=require(_0x460b('0x3'));var db=require(_0x460b('0x4'))['db'];var utils=require(_0x460b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x460b('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x460b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x50ef95,_0x2d6702,_0x3b6779){return new BPromise(function(_0x247c42,_0x43fd50){return client[_0x460b('0x8')](_0x50ef95,_0x3b6779)['then'](function(_0x1fff22){logger[_0x460b('0x9')](_0x460b('0xa'),_0x2d6702,_0x460b('0xb'));logger['debug'](_0x460b('0xc'),_0x2d6702,_0x460b('0xb'),JSON[_0x460b('0xd')](_0x1fff22));if(_0x1fff22[_0x460b('0xe')]){if(_0x1fff22[_0x460b('0xe')][_0x460b('0xf')]===0x1f4){logger[_0x460b('0xe')](_0x460b('0xa'),_0x2d6702,_0x1fff22[_0x460b('0xe')]['message']);return _0x43fd50(_0x1fff22[_0x460b('0xe')]['message']);}logger[_0x460b('0xe')](_0x460b('0xa'),_0x2d6702,_0x1fff22[_0x460b('0xe')][_0x460b('0x10')]);return _0x247c42(_0x1fff22['error'][_0x460b('0x10')]);}else{logger[_0x460b('0x9')]('SquareOdbc,\x20%s,\x20%s',_0x2d6702,'request\x20sent');_0x247c42(_0x1fff22[_0x460b('0x11')][_0x460b('0x10')]);}})['catch'](function(_0x2b5e36){logger[_0x460b('0xe')](_0x460b('0xa'),_0x2d6702,_0x2b5e36);_0x43fd50(_0x2b5e36);});});}exports['ShowSquareOdbc']=function(_0x5b5300){var _0x70c082=this;return new Promise(function(_0x21cd66,_0x4199b9){return db[_0x460b('0x12')][_0x460b('0x13')]({'raw':_0x5b5300[_0x460b('0x14')]?_0x5b5300['options'][_0x460b('0x15')]===undefined?!![]:![]:!![],'where':_0x5b5300[_0x460b('0x14')]?_0x5b5300[_0x460b('0x14')][_0x460b('0x16')]||null:null,'attributes':_0x5b5300[_0x460b('0x14')]?_0x5b5300[_0x460b('0x14')][_0x460b('0x17')]||null:null,'include':_0x5b5300[_0x460b('0x14')]?_0x5b5300[_0x460b('0x14')]['include']?_[_0x460b('0x18')](_0x5b5300['options'][_0x460b('0x19')],function(_0x4fa824){return{'model':db[_0x4fa824[_0x460b('0x1a')]],'as':_0x4fa824['as'],'attributes':_0x4fa824['attributes'],'include':_0x4fa824['include']?_['map'](_0x4fa824[_0x460b('0x19')],function(_0x5969e7){return{'model':db[_0x5969e7[_0x460b('0x1a')]],'as':_0x5969e7['as'],'attributes':_0x5969e7[_0x460b('0x17')],'include':_0x5969e7['include']?_[_0x460b('0x18')](_0x5969e7[_0x460b('0x19')],function(_0x48e9e7){return{'model':db[_0x48e9e7[_0x460b('0x1a')]],'as':_0x48e9e7['as'],'attributes':_0x48e9e7[_0x460b('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d03c4){logger[_0x460b('0x9')](_0x460b('0x1b'),_0x5b5300);logger[_0x460b('0x1c')](_0x460b('0x1b'),_0x5b5300,JSON[_0x460b('0xd')](_0x3d03c4));_0x21cd66(_0x3d03c4);})['catch'](function(_0x2734eb){logger[_0x460b('0xe')](_0x460b('0x1b'),_0x2734eb[_0x460b('0x10')],_0x5b5300);_0x4199b9(_0x70c082['error'](0x1f4,_0x2734eb[_0x460b('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 748df6c..86d0fe2 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 _0xa057=['index','get','/:id','show','/:id/users','getUsers','post','isAuthenticated','create','addUsers','put','update','delete','removeUsers','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareProject.controller'];(function(_0x2e7b53,_0x26fe75){var _0x3b28d4=function(_0x55001d){while(--_0x55001d){_0x2e7b53['push'](_0x2e7b53['shift']());}};_0x3b28d4(++_0x26fe75);}(_0xa057,0x123));var _0x7a05=function(_0x236d76,_0x2535fc){_0x236d76=_0x236d76-0x0;var _0x644170=_0xa057[_0x236d76];return _0x644170;};'use strict';var multer=require(_0x7a05('0x0'));var util=require(_0x7a05('0x1'));var path=require('path');var timeout=require(_0x7a05('0x2'));var express=require(_0x7a05('0x3'));var router=express[_0x7a05('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7a05('0x5'));var interaction=require(_0x7a05('0x6'));var config=require('../../config/environment');var controller=require(_0x7a05('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7a05('0x8')]);router[_0x7a05('0x9')](_0x7a05('0xa'),auth['isAuthenticated'](),controller[_0x7a05('0xb')]);router[_0x7a05('0x9')](_0x7a05('0xc'),auth['isAuthenticated'](),controller[_0x7a05('0xd')]);router[_0x7a05('0xe')]('/',auth[_0x7a05('0xf')](),controller[_0x7a05('0x10')]);router[_0x7a05('0xe')](_0x7a05('0xc'),auth['isAuthenticated'](),controller[_0x7a05('0x11')]);router[_0x7a05('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7a05('0x13')]);router[_0x7a05('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x7a05('0x14')](_0x7a05('0xc'),auth[_0x7a05('0xf')](),controller[_0x7a05('0x15')]);module[_0x7a05('0x16')]=router; \ No newline at end of file +var _0x041d=['./squareProject.controller','isAuthenticated','index','get','/:id','show','/:id/users','getUsers','post','put','update','delete','destroy','removeUsers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x54808c,_0x36e290){var _0xe9459=function(_0x55df21){while(--_0x55df21){_0x54808c['push'](_0x54808c['shift']());}};_0xe9459(++_0x36e290);}(_0x041d,0x185));var _0xd041=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x041d[_0xc4001c];return _0x49f7bc;};'use strict';var multer=require(_0xd041('0x0'));var util=require(_0xd041('0x1'));var path=require(_0xd041('0x2'));var timeout=require(_0xd041('0x3'));var express=require(_0xd041('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd041('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd041('0x6'));var controller=require(_0xd041('0x7'));router['get']('/',auth[_0xd041('0x8')](),controller[_0xd041('0x9')]);router[_0xd041('0xa')](_0xd041('0xb'),auth[_0xd041('0x8')](),controller[_0xd041('0xc')]);router['get'](_0xd041('0xd'),auth[_0xd041('0x8')](),controller[_0xd041('0xe')]);router[_0xd041('0xf')]('/',auth[_0xd041('0x8')](),controller['create']);router[_0xd041('0xf')](_0xd041('0xd'),auth[_0xd041('0x8')](),controller['addUsers']);router[_0xd041('0x10')]('/:id',auth[_0xd041('0x8')](),controller[_0xd041('0x11')]);router[_0xd041('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xd041('0x13')]);router['delete'](_0xd041('0xd'),auth[_0xd041('0x8')](),controller[_0xd041('0x14')]);module[_0xd041('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index fc826ee..f43ad37 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 _0xda72=['TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production','DATE','sequelize','STRING','name'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xda72,0x135));var _0x2da7=function(_0x520021,_0x41c4de){_0x520021=_0x520021-0x0;var _0x203dc5=_0xda72[_0x520021];return _0x203dc5;};'use strict';var Sequelize=require(_0x2da7('0x0'));module['exports']={'name':{'type':Sequelize[_0x2da7('0x1')],'unique':_0x2da7('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x2da7('0x1')]},'notes':{'type':Sequelize[_0x2da7('0x3')]},'preproduction':{'type':Sequelize[_0x2da7('0x4')]('long'),'get':function(){if(this[_0x2da7('0x5')](_0x2da7('0x6'))){return this[_0x2da7('0x5')]('preproduction')[_0x2da7('0x7')](_0x2da7('0x8'));}}},'production':{'type':Sequelize[_0x2da7('0x4')](_0x2da7('0x9')),'get':function(){if(this['getDataValue'](_0x2da7('0xa'))){return this['getDataValue'](_0x2da7('0xa'))[_0x2da7('0x7')](_0x2da7('0x8'));}}},'savedAt':{'type':Sequelize[_0x2da7('0xb')]},'publishedAt':{'type':Sequelize[_0x2da7('0xb')]}}; \ No newline at end of file +var _0xd4bd=['getDataValue','preproduction','toString','utf8','production','DATE','sequelize','STRING','name','BLOB','long'];(function(_0x9818c8,_0x361868){var _0x12743f=function(_0x395e47){while(--_0x395e47){_0x9818c8['push'](_0x9818c8['shift']());}};_0x12743f(++_0x361868);}(_0xd4bd,0x19d));var _0xdd4b=function(_0x29471c,_0x5d446f){_0x29471c=_0x29471c-0x0;var _0xa83112=_0xd4bd[_0x29471c];return _0xa83112;};'use strict';var Sequelize=require(_0xdd4b('0x0'));module['exports']={'name':{'type':Sequelize[_0xdd4b('0x1')],'unique':_0xdd4b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xdd4b('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0xdd4b('0x3')](_0xdd4b('0x4')),'get':function(){if(this[_0xdd4b('0x5')](_0xdd4b('0x6'))){return this[_0xdd4b('0x5')]('preproduction')[_0xdd4b('0x7')](_0xdd4b('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0xdd4b('0x4')),'get':function(){if(this['getDataValue'](_0xdd4b('0x9'))){return this['getDataValue'](_0xdd4b('0x9'))[_0xdd4b('0x7')]('utf8');}}},'savedAt':{'type':Sequelize[_0xdd4b('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 0ea5a50..06f6c0f 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 _0xa659=['where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','redis','./squareProject.socket','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','SquareProjects','UserProfileResource','then','end','sendStatus','stack','name','index','map','SquareProject','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x5e4d2f,_0x4274a2){var _0x22a960=function(_0x346024){while(--_0x346024){_0x5e4d2f['push'](_0x5e4d2f['shift']());}};_0x22a960(++_0x4274a2);}(_0xa659,0x142));var _0x9a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa659[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9a65('0x0'));var rimraf=require(_0x9a65('0x1'));var zipdir=require(_0x9a65('0x2'));var jsonpatch=require(_0x9a65('0x3'));var rp=require('request-promise');var moment=require(_0x9a65('0x4'));var BPromise=require(_0x9a65('0x5'));var Mustache=require(_0x9a65('0x6'));var util=require(_0x9a65('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9a65('0x8'));var fs=require('fs');var fs_extra=require(_0x9a65('0x9'));var _=require(_0x9a65('0xa'));var squel=require(_0x9a65('0xb'));var crypto=require('crypto');var jsforce=require(_0x9a65('0xc'));var deskjs=require(_0x9a65('0xd'));var toCsv=require('to-csv');var querystring=require(_0x9a65('0xe'));var Papa=require('papaparse');var Redis=require(_0x9a65('0xf'));var authService=require(_0x9a65('0x10'));var qs=require(_0x9a65('0x11'));var as=require(_0x9a65('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9a65('0x13'));var utils=require(_0x9a65('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9a65('0x15'));var db=require(_0x9a65('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a65('0x17')]));require(_0x9a65('0x18'))['register'](socket);function respondWithStatusCode(_0x4061a9,_0x5dbe4a){_0x5dbe4a=_0x5dbe4a||0xcc;return function(_0x2c1b42){if(_0x2c1b42){return _0x4061a9['sendStatus'](_0x5dbe4a);}return _0x4061a9[_0x9a65('0x19')](_0x5dbe4a)['end']();};}function respondWithResult(_0x27c7aa,_0x147881){_0x147881=_0x147881||0xc8;return function(_0x270929){if(_0x270929){return _0x27c7aa[_0x9a65('0x19')](_0x147881)['json'](_0x270929);}};}function respondWithFilteredResult(_0x474a10,_0x17b486){return function(_0xa2df29){if(_0xa2df29){var _0x3c44b6=typeof _0x17b486[_0x9a65('0x1a')]===_0x9a65('0x1b')&&typeof _0x17b486[_0x9a65('0x1c')]==='undefined';var _0x5240c1=_0xa2df29[_0x9a65('0x1d')];var _0x2d50b0=_0x3c44b6?0x0:_0x17b486[_0x9a65('0x1a')];var _0x1f29e7=_0x3c44b6?_0xa2df29[_0x9a65('0x1d')]:_0x17b486[_0x9a65('0x1a')]+_0x17b486[_0x9a65('0x1c')];var _0x319a48;if(_0x1f29e7>=_0x5240c1){_0x1f29e7=_0x5240c1;_0x319a48=0xc8;}else{_0x319a48=0xce;}_0x474a10[_0x9a65('0x19')](_0x319a48);return _0x474a10[_0x9a65('0x1e')](_0x9a65('0x1f'),_0x2d50b0+'-'+_0x1f29e7+'/'+_0x5240c1)['json'](_0xa2df29);}return null;};}function patchUpdates(_0x844e54){return function(_0x4b52ee){try{jsonpatch[_0x9a65('0x20')](_0x4b52ee,_0x844e54,!![]);}catch(_0x46e23e){return BPromise[_0x9a65('0x21')](_0x46e23e);}return _0x4b52ee[_0x9a65('0x22')]();};}function saveUpdates(_0x569b2c,_0x43afc0){return function(_0x2230a5){if(_0x2230a5){return _0x2230a5[_0x9a65('0x23')](_0x569b2c)['then'](function(_0x49bdca){return _0x49bdca;});}return null;};}function removeEntity(_0x39caea,_0x244976){return function(_0xedc429){if(_0xedc429){return _0xedc429[_0x9a65('0x24')]()['then'](function(){var _0x1cc64c=_0xedc429[_0x9a65('0x25')]({'plain':!![]});var _0x210ed5=_0x9a65('0x26');return db[_0x9a65('0x27')][_0x9a65('0x24')]({'where':{'type':_0x210ed5,'resourceId':_0x1cc64c['id']}})[_0x9a65('0x28')](function(){return _0xedc429;});})[_0x9a65('0x28')](function(){_0x39caea[_0x9a65('0x19')](0xcc)[_0x9a65('0x29')]();});}};}function handleEntityNotFound(_0x2f148a,_0xa458bc){return function(_0x1111e3){if(!_0x1111e3){_0x2f148a[_0x9a65('0x2a')](0x194);}return _0x1111e3;};}function handleError(_0x22d5f7,_0x3c1e88){_0x3c1e88=_0x3c1e88||0x1f4;return function(_0x155fcf){logger['error'](_0x155fcf[_0x9a65('0x2b')]);if(_0x155fcf[_0x9a65('0x2c')]){delete _0x155fcf['name'];}_0x22d5f7[_0x9a65('0x19')](_0x3c1e88)['send'](_0x155fcf);};}exports[_0x9a65('0x2d')]=function(_0x3d2fc5,_0x3c7a0e){var _0x20dc1a={},_0xa0c6d0={},_0x42c4ed={'count':0x0,'rows':[]};var _0xfbe4b8=_[_0x9a65('0x2e')](db[_0x9a65('0x2f')]['rawAttributes'],function(_0x33a3fb){return{'name':_0x33a3fb[_0x9a65('0x30')],'type':_0x33a3fb[_0x9a65('0x31')][_0x9a65('0x32')]};});_0xa0c6d0['model']=_[_0x9a65('0x2e')](_0xfbe4b8,_0x9a65('0x2c'));_0xa0c6d0[_0x9a65('0x33')]=_[_0x9a65('0x34')](_0x3d2fc5[_0x9a65('0x33')]);_0xa0c6d0['filters']=_[_0x9a65('0x35')](_0xa0c6d0[_0x9a65('0x36')],_0xa0c6d0[_0x9a65('0x33')]);_0x20dc1a[_0x9a65('0x37')]=_['intersection'](_0xa0c6d0[_0x9a65('0x36')],qs[_0x9a65('0x38')](_0x3d2fc5[_0x9a65('0x33')][_0x9a65('0x38')]));_0x20dc1a[_0x9a65('0x37')]=_0x20dc1a[_0x9a65('0x37')][_0x9a65('0x39')]?_0x20dc1a[_0x9a65('0x37')]:_0xa0c6d0[_0x9a65('0x36')];if(!_0x3d2fc5[_0x9a65('0x33')][_0x9a65('0x3a')](_0x9a65('0x3b'))){_0x20dc1a['limit']=qs['limit'](_0x3d2fc5[_0x9a65('0x33')][_0x9a65('0x1c')]);_0x20dc1a[_0x9a65('0x1a')]=qs[_0x9a65('0x1a')](_0x3d2fc5[_0x9a65('0x33')][_0x9a65('0x1a')]);}_0x20dc1a[_0x9a65('0x3c')]=qs['sort'](_0x3d2fc5[_0x9a65('0x33')][_0x9a65('0x3d')]);_0x20dc1a[_0x9a65('0x3e')]=qs[_0x9a65('0x3f')](_[_0x9a65('0x40')](_0x3d2fc5[_0x9a65('0x33')],_0xa0c6d0[_0x9a65('0x3f')]),_0xfbe4b8);if(_0x3d2fc5[_0x9a65('0x33')][_0x9a65('0x41')]){_0x20dc1a[_0x9a65('0x3e')]=_[_0x9a65('0x42')](_0x20dc1a[_0x9a65('0x3e')],{'$or':_[_0x9a65('0x2e')](_0xfbe4b8,function(_0x107411){if(_0x107411[_0x9a65('0x31')]!==_0x9a65('0x43')){var _0x52f73e={};_0x52f73e[_0x107411['name']]={'$like':'%'+_0x3d2fc5[_0x9a65('0x33')][_0x9a65('0x41')]+'%'};return _0x52f73e;}})});}_0x20dc1a=_[_0x9a65('0x42')]({},_0x20dc1a,_0x3d2fc5[_0x9a65('0x44')]);var _0x4f1558={'where':_0x20dc1a[_0x9a65('0x3e')]};return db[_0x9a65('0x2f')][_0x9a65('0x1d')](_0x4f1558)[_0x9a65('0x28')](function(_0x44457c){_0x42c4ed[_0x9a65('0x1d')]=_0x44457c;if(_0x3d2fc5[_0x9a65('0x33')][_0x9a65('0x45')]){_0x20dc1a[_0x9a65('0x46')]=[{'all':!![]}];}return db[_0x9a65('0x2f')][_0x9a65('0x47')](_0x20dc1a);})['then'](function(_0x5a0974){_0x42c4ed[_0x9a65('0x48')]=_0x5a0974;return _0x42c4ed;})['then'](respondWithFilteredResult(_0x3c7a0e,_0x20dc1a))[_0x9a65('0x49')](handleError(_0x3c7a0e,null));};exports[_0x9a65('0x4a')]=function(_0xae340,_0x1b9e6a){var _0x5250e8={'raw':![],'where':{'id':_0xae340['params']['id']}},_0xd1603b={};_0xd1603b[_0x9a65('0x36')]=_['keys'](db[_0x9a65('0x2f')][_0x9a65('0x4b')]);_0xd1603b[_0x9a65('0x33')]=_[_0x9a65('0x34')](_0xae340['query']);_0xd1603b[_0x9a65('0x3f')]=_['intersection'](_0xd1603b[_0x9a65('0x36')],_0xd1603b[_0x9a65('0x33')]);_0x5250e8[_0x9a65('0x37')]=_['intersection'](_0xd1603b[_0x9a65('0x36')],qs[_0x9a65('0x38')](_0xae340[_0x9a65('0x33')][_0x9a65('0x38')]));_0x5250e8[_0x9a65('0x37')]=_0x5250e8[_0x9a65('0x37')][_0x9a65('0x39')]?_0x5250e8['attributes']:_0xd1603b['model'];if(_0xae340[_0x9a65('0x33')][_0x9a65('0x45')]){_0x5250e8[_0x9a65('0x46')]=[{'all':!![]}];}_0x5250e8=_[_0x9a65('0x42')]({},_0x5250e8,_0xae340[_0x9a65('0x44')]);return db[_0x9a65('0x2f')][_0x9a65('0x4c')](_0x5250e8)[_0x9a65('0x28')](handleEntityNotFound(_0x1b9e6a,null))[_0x9a65('0x28')](respondWithResult(_0x1b9e6a,null))['catch'](handleError(_0x1b9e6a,null));};exports[_0x9a65('0x4d')]=function(_0x54049b,_0x58f605){return db[_0x9a65('0x2f')][_0x9a65('0x4d')](_0x54049b[_0x9a65('0x4e')],{})[_0x9a65('0x28')](function(_0x157fa5){var _0xfbd27c=_0x54049b[_0x9a65('0x4f')][_0x9a65('0x25')]({'plain':!![]});if(!_0xfbd27c)throw new Error(_0x9a65('0x50'));if(_0xfbd27c['role']===_0x9a65('0x4f')){var _0x4c91e4=_0x157fa5[_0x9a65('0x25')]({'plain':!![]});var _0x19bc9d=_0x9a65('0x26');return db[_0x9a65('0x51')][_0x9a65('0x4c')]({'where':{'name':_0x19bc9d,'userProfileId':_0xfbd27c[_0x9a65('0x52')]},'raw':!![]})[_0x9a65('0x28')](function(_0x5108c3){if(_0x5108c3&&_0x5108c3[_0x9a65('0x53')]===0x0){return db['UserProfileResource'][_0x9a65('0x4d')]({'name':_0x4c91e4[_0x9a65('0x2c')],'resourceId':_0x4c91e4['id'],'type':_0x5108c3[_0x9a65('0x2c')],'sectionId':_0x5108c3['id']},{})['then'](function(){return _0x157fa5;});}else{return _0x157fa5;}})['catch'](function(_0x1f2258){logger[_0x9a65('0x54')](_0x9a65('0x55'),_0x1f2258);throw _0x1f2258;});}return _0x157fa5;})[_0x9a65('0x28')](respondWithResult(_0x58f605,0xc9))['catch'](handleError(_0x58f605,null));};exports['update']=function(_0x58f8a2,_0x47425c){if(_0x58f8a2[_0x9a65('0x4e')]['id']){delete _0x58f8a2[_0x9a65('0x4e')]['id'];}return db[_0x9a65('0x2f')][_0x9a65('0x4c')]({'where':{'id':_0x58f8a2['params']['id']}})[_0x9a65('0x28')](handleEntityNotFound(_0x47425c,null))['then'](saveUpdates(_0x58f8a2['body'],null))['then'](respondWithResult(_0x47425c,null))['catch'](handleError(_0x47425c,null));};exports[_0x9a65('0x24')]=function(_0x94c6f4,_0x5153db){return db[_0x9a65('0x2f')][_0x9a65('0x4c')]({'where':{'id':_0x94c6f4[_0x9a65('0x56')]['id']}})[_0x9a65('0x28')](handleEntityNotFound(_0x5153db,null))[_0x9a65('0x28')](removeEntity(_0x5153db,null))[_0x9a65('0x49')](handleError(_0x5153db,null));};exports[_0x9a65('0x57')]=function(_0x332bf5,_0x50ac15,_0x399336){return db[_0x9a65('0x2f')]['find']({'where':{'id':_0x332bf5[_0x9a65('0x56')]['id']}})[_0x9a65('0x28')](handleEntityNotFound(_0x50ac15,null))[_0x9a65('0x28')](function(_0x5472a9){if(_0x5472a9){return _0x5472a9[_0x9a65('0x57')](_0x332bf5[_0x9a65('0x4e')][_0x9a65('0x58')],_['omit'](_0x332bf5[_0x9a65('0x4e')],[_0x9a65('0x58'),'id'])||{});}})[_0x9a65('0x28')](respondWithResult(_0x50ac15,null))[_0x9a65('0x49')](handleError(_0x50ac15,null));};exports[_0x9a65('0x59')]=function(_0x35cc78,_0x2c730a,_0x17c92a){return db['SquareProject'][_0x9a65('0x4c')]({'where':{'id':_0x35cc78[_0x9a65('0x56')]['id']}})[_0x9a65('0x28')](handleEntityNotFound(_0x2c730a,null))[_0x9a65('0x28')](function(_0x47914b){if(_0x47914b){return _0x47914b['removeUsers'](_0x35cc78[_0x9a65('0x33')][_0x9a65('0x58')])[_0x9a65('0x28')](function(){if(_[_0x9a65('0x5a')](_0x35cc78[_0x9a65('0x33')]['ids'])){for(var _0x3cf7d6=0x0;_0x3cf7d6<_0x35cc78['query'][_0x9a65('0x58')][_0x9a65('0x39')];_0x3cf7d6+=0x1){socket[_0x9a65('0x5b')](_0x9a65('0x5c'),{'UserId':Number(_0x35cc78['query'][_0x9a65('0x58')][_0x3cf7d6]),'SquareProjectId':Number(_0x35cc78[_0x9a65('0x56')]['id'])});}}else{socket['emit'](_0x9a65('0x5c'),{'UserId':Number(_0x35cc78[_0x9a65('0x33')][_0x9a65('0x58')]),'SquareProjectId':Number(_0x35cc78[_0x9a65('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x2c730a,null))['catch'](handleError(_0x2c730a,null));};exports[_0x9a65('0x5d')]=function(_0x4b12b8,_0x4f3f42,_0x38e928){var _0x54c137={};var _0x1b9042={};var _0x11cdcb;var _0x17876e;return db[_0x9a65('0x2f')][_0x9a65('0x5e')]({'where':{'id':_0x4b12b8[_0x9a65('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f3f42,null))[_0x9a65('0x28')](function(_0x303fa3){if(_0x303fa3){_0x11cdcb=_0x303fa3;_0x1b9042[_0x9a65('0x36')]=_[_0x9a65('0x34')](db[_0x9a65('0x5f')][_0x9a65('0x4b')]);_0x1b9042['query']=_[_0x9a65('0x34')](_0x4b12b8[_0x9a65('0x33')]);_0x1b9042['filters']=_['intersection'](_0x1b9042[_0x9a65('0x36')],_0x1b9042[_0x9a65('0x33')]);_0x54c137[_0x9a65('0x37')]=_[_0x9a65('0x35')](_0x1b9042['model'],qs[_0x9a65('0x38')](_0x4b12b8[_0x9a65('0x33')]['fields']));_0x54c137[_0x9a65('0x37')]=_0x54c137[_0x9a65('0x37')][_0x9a65('0x39')]?_0x54c137[_0x9a65('0x37')]:_0x1b9042[_0x9a65('0x36')];_0x54c137[_0x9a65('0x3c')]=qs['sort'](_0x4b12b8[_0x9a65('0x33')][_0x9a65('0x3d')]);_0x54c137[_0x9a65('0x3e')]=qs[_0x9a65('0x3f')](_[_0x9a65('0x40')](_0x4b12b8['query'],_0x1b9042[_0x9a65('0x3f')]));if(_0x4b12b8[_0x9a65('0x33')][_0x9a65('0x41')]){_0x54c137[_0x9a65('0x3e')]=_[_0x9a65('0x42')](_0x54c137[_0x9a65('0x3e')],{'$or':_[_0x9a65('0x2e')](_0x54c137[_0x9a65('0x37')],function(_0x1d99a4){var _0x20b8cd={};_0x20b8cd[_0x1d99a4]={'$like':'%'+_0x4b12b8[_0x9a65('0x33')][_0x9a65('0x41')]+'%'};return _0x20b8cd;})});}_0x54c137=_['merge']({},_0x54c137,_0x4b12b8[_0x9a65('0x44')]);return _0x11cdcb[_0x9a65('0x5d')](_0x54c137);}})['then'](function(_0x25228e){if(_0x25228e){_0x17876e=_0x25228e[_0x9a65('0x39')];if(!_0x4b12b8[_0x9a65('0x33')][_0x9a65('0x3a')](_0x9a65('0x3b'))){_0x54c137['limit']=qs['limit'](_0x4b12b8['query'][_0x9a65('0x1c')]);_0x54c137['offset']=qs['offset'](_0x4b12b8['query'][_0x9a65('0x1a')]);}return _0x11cdcb['getUsers'](_0x54c137);}})[_0x9a65('0x28')](function(_0x1f573b){if(_0x1f573b){return _0x1f573b?{'count':_0x17876e,'rows':_0x1f573b}:null;}})['then'](respondWithResult(_0x4f3f42,null))[_0x9a65('0x49')](handleError(_0x4f3f42,null));}; \ No newline at end of file +var _0x6f56=['where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','SquareProjects','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','omit','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','hasOwnProperty','eml-format','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./squareProject.socket','register','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','SquareProject','fieldName','type','model','map','query','keys','filters','fields','attributes','length','nolimit','order','sort'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x6f56,0xe8));var _0x66f5=function(_0x5cb8cb,_0x45975f){_0x5cb8cb=_0x5cb8cb-0x0;var _0x3476c9=_0x6f56[_0x5cb8cb];return _0x3476c9;};'use strict';var emlformat=require(_0x66f5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x66f5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x66f5('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x66f5('0x3'));var util=require(_0x66f5('0x4'));var path=require(_0x66f5('0x5'));var sox=require(_0x66f5('0x6'));var csv=require(_0x66f5('0x7'));var ejs=require(_0x66f5('0x8'));var fs=require('fs');var fs_extra=require(_0x66f5('0x9'));var _=require(_0x66f5('0xa'));var squel=require(_0x66f5('0xb'));var crypto=require(_0x66f5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x66f5('0xd'));var toCsv=require(_0x66f5('0x7'));var querystring=require(_0x66f5('0xe'));var Papa=require(_0x66f5('0xf'));var Redis=require(_0x66f5('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x66f5('0x11'));var hardwareService=require(_0x66f5('0x12'));var logger=require(_0x66f5('0x13'))(_0x66f5('0x14'));var utils=require('../../config/utils');var config=require(_0x66f5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x66f5('0x16'))['db'];config[_0x66f5('0x17')]=_[_0x66f5('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x66f5('0x17')]));require(_0x66f5('0x19'))[_0x66f5('0x1a')](socket);function respondWithStatusCode(_0x37f458,_0x1570d7){_0x1570d7=_0x1570d7||0xcc;return function(_0x2031e4){if(_0x2031e4){return _0x37f458['sendStatus'](_0x1570d7);}return _0x37f458[_0x66f5('0x1b')](_0x1570d7)[_0x66f5('0x1c')]();};}function respondWithResult(_0x4f8326,_0xa82b4d){_0xa82b4d=_0xa82b4d||0xc8;return function(_0xeab5a3){if(_0xeab5a3){return _0x4f8326[_0x66f5('0x1b')](_0xa82b4d)[_0x66f5('0x1d')](_0xeab5a3);}};}function respondWithFilteredResult(_0x229a2c,_0x4074bb){return function(_0x44c1ed){if(_0x44c1ed){var _0x49b340=typeof _0x4074bb['offset']===_0x66f5('0x1e')&&typeof _0x4074bb['limit']===_0x66f5('0x1e');var _0x22acff=_0x44c1ed['count'];var _0x88e907=_0x49b340?0x0:_0x4074bb[_0x66f5('0x1f')];var _0x21f03e=_0x49b340?_0x44c1ed[_0x66f5('0x20')]:_0x4074bb[_0x66f5('0x1f')]+_0x4074bb[_0x66f5('0x21')];var _0x2bc0c6;if(_0x21f03e>=_0x22acff){_0x21f03e=_0x22acff;_0x2bc0c6=0xc8;}else{_0x2bc0c6=0xce;}_0x229a2c[_0x66f5('0x1b')](_0x2bc0c6);return _0x229a2c[_0x66f5('0x22')](_0x66f5('0x23'),_0x88e907+'-'+_0x21f03e+'/'+_0x22acff)[_0x66f5('0x1d')](_0x44c1ed);}return null;};}function patchUpdates(_0x222e2e){return function(_0x48452f){try{jsonpatch[_0x66f5('0x24')](_0x48452f,_0x222e2e,!![]);}catch(_0x5315e0){return BPromise[_0x66f5('0x25')](_0x5315e0);}return _0x48452f['save']();};}function saveUpdates(_0x5324de,_0x31984b){return function(_0x321226){if(_0x321226){return _0x321226[_0x66f5('0x26')](_0x5324de)[_0x66f5('0x27')](function(_0x307573){return _0x307573;});}return null;};}function removeEntity(_0x35e6a3,_0x3415c0){return function(_0x1f721b){if(_0x1f721b){return _0x1f721b[_0x66f5('0x28')]()[_0x66f5('0x27')](function(){var _0x40d7b8=_0x1f721b['get']({'plain':!![]});var _0x6a0219='SquareProjects';return db[_0x66f5('0x29')][_0x66f5('0x28')]({'where':{'type':_0x6a0219,'resourceId':_0x40d7b8['id']}})['then'](function(){return _0x1f721b;});})[_0x66f5('0x27')](function(){_0x35e6a3[_0x66f5('0x1b')](0xcc)[_0x66f5('0x1c')]();});}};}function handleEntityNotFound(_0x1b87e0,_0x344460){return function(_0x48c298){if(!_0x48c298){_0x1b87e0[_0x66f5('0x2a')](0x194);}return _0x48c298;};}function handleError(_0x9c7f31,_0x290ad6){_0x290ad6=_0x290ad6||0x1f4;return function(_0x5f2199){logger[_0x66f5('0x2b')](_0x5f2199[_0x66f5('0x2c')]);if(_0x5f2199[_0x66f5('0x2d')]){delete _0x5f2199[_0x66f5('0x2d')];}_0x9c7f31[_0x66f5('0x1b')](_0x290ad6)[_0x66f5('0x2e')](_0x5f2199);};}exports[_0x66f5('0x2f')]=function(_0x7908ce,_0x449e8f){var _0xd54c13={},_0x188e3b={},_0x1c3d43={'count':0x0,'rows':[]};var _0x20916f=_['map'](db[_0x66f5('0x30')]['rawAttributes'],function(_0x16722c){return{'name':_0x16722c[_0x66f5('0x31')],'type':_0x16722c[_0x66f5('0x32')]['key']};});_0x188e3b[_0x66f5('0x33')]=_[_0x66f5('0x34')](_0x20916f,_0x66f5('0x2d'));_0x188e3b[_0x66f5('0x35')]=_[_0x66f5('0x36')](_0x7908ce[_0x66f5('0x35')]);_0x188e3b[_0x66f5('0x37')]=_['intersection'](_0x188e3b[_0x66f5('0x33')],_0x188e3b[_0x66f5('0x35')]);_0xd54c13['attributes']=_['intersection'](_0x188e3b[_0x66f5('0x33')],qs[_0x66f5('0x38')](_0x7908ce[_0x66f5('0x35')][_0x66f5('0x38')]));_0xd54c13[_0x66f5('0x39')]=_0xd54c13[_0x66f5('0x39')][_0x66f5('0x3a')]?_0xd54c13['attributes']:_0x188e3b[_0x66f5('0x33')];if(!_0x7908ce[_0x66f5('0x35')]['hasOwnProperty'](_0x66f5('0x3b'))){_0xd54c13['limit']=qs[_0x66f5('0x21')](_0x7908ce[_0x66f5('0x35')][_0x66f5('0x21')]);_0xd54c13[_0x66f5('0x1f')]=qs['offset'](_0x7908ce['query'][_0x66f5('0x1f')]);}_0xd54c13[_0x66f5('0x3c')]=qs[_0x66f5('0x3d')](_0x7908ce['query'][_0x66f5('0x3d')]);_0xd54c13[_0x66f5('0x3e')]=qs[_0x66f5('0x37')](_[_0x66f5('0x3f')](_0x7908ce[_0x66f5('0x35')],_0x188e3b[_0x66f5('0x37')]),_0x20916f);if(_0x7908ce['query'][_0x66f5('0x40')]){_0xd54c13[_0x66f5('0x3e')]=_[_0x66f5('0x41')](_0xd54c13[_0x66f5('0x3e')],{'$or':_[_0x66f5('0x34')](_0x20916f,function(_0x11a2bd){if(_0x11a2bd['type']!==_0x66f5('0x42')){var _0xfd3f9f={};_0xfd3f9f[_0x11a2bd[_0x66f5('0x2d')]]={'$like':'%'+_0x7908ce[_0x66f5('0x35')]['filter']+'%'};return _0xfd3f9f;}})});}_0xd54c13=_['merge']({},_0xd54c13,_0x7908ce[_0x66f5('0x43')]);var _0x377edc={'where':_0xd54c13[_0x66f5('0x3e')]};return db[_0x66f5('0x30')][_0x66f5('0x20')](_0x377edc)[_0x66f5('0x27')](function(_0x4f99f9){_0x1c3d43['count']=_0x4f99f9;if(_0x7908ce[_0x66f5('0x35')]['includeAll']){_0xd54c13[_0x66f5('0x44')]=[{'all':!![]}];}return db[_0x66f5('0x30')][_0x66f5('0x45')](_0xd54c13);})[_0x66f5('0x27')](function(_0x51575d){_0x1c3d43[_0x66f5('0x46')]=_0x51575d;return _0x1c3d43;})['then'](respondWithFilteredResult(_0x449e8f,_0xd54c13))[_0x66f5('0x47')](handleError(_0x449e8f,null));};exports[_0x66f5('0x48')]=function(_0x45c0d6,_0x361e2d){var _0x3c9e35={'raw':![],'where':{'id':_0x45c0d6[_0x66f5('0x49')]['id']}},_0x1bc221={};_0x1bc221[_0x66f5('0x33')]=_[_0x66f5('0x36')](db[_0x66f5('0x30')][_0x66f5('0x4a')]);_0x1bc221['query']=_[_0x66f5('0x36')](_0x45c0d6[_0x66f5('0x35')]);_0x1bc221[_0x66f5('0x37')]=_[_0x66f5('0x4b')](_0x1bc221['model'],_0x1bc221[_0x66f5('0x35')]);_0x3c9e35[_0x66f5('0x39')]=_[_0x66f5('0x4b')](_0x1bc221['model'],qs[_0x66f5('0x38')](_0x45c0d6[_0x66f5('0x35')]['fields']));_0x3c9e35[_0x66f5('0x39')]=_0x3c9e35[_0x66f5('0x39')][_0x66f5('0x3a')]?_0x3c9e35[_0x66f5('0x39')]:_0x1bc221[_0x66f5('0x33')];if(_0x45c0d6[_0x66f5('0x35')][_0x66f5('0x4c')]){_0x3c9e35['include']=[{'all':!![]}];}_0x3c9e35=_[_0x66f5('0x41')]({},_0x3c9e35,_0x45c0d6['options']);return db['SquareProject'][_0x66f5('0x4d')](_0x3c9e35)[_0x66f5('0x27')](handleEntityNotFound(_0x361e2d,null))['then'](respondWithResult(_0x361e2d,null))['catch'](handleError(_0x361e2d,null));};exports['create']=function(_0x219b5f,_0x4e2201){return db[_0x66f5('0x30')][_0x66f5('0x4e')](_0x219b5f[_0x66f5('0x4f')],{})[_0x66f5('0x27')](function(_0x39e65c){var _0x2bc14e=_0x219b5f[_0x66f5('0x50')]['get']({'plain':!![]});if(!_0x2bc14e)throw new Error(_0x66f5('0x51'));if(_0x2bc14e[_0x66f5('0x52')]===_0x66f5('0x50')){var _0x205406=_0x39e65c[_0x66f5('0x53')]({'plain':!![]});var _0xb2a6ed=_0x66f5('0x54');return db[_0x66f5('0x55')][_0x66f5('0x4d')]({'where':{'name':_0xb2a6ed,'userProfileId':_0x2bc14e[_0x66f5('0x56')]},'raw':!![]})['then'](function(_0x2af50e){if(_0x2af50e&&_0x2af50e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x205406[_0x66f5('0x2d')],'resourceId':_0x205406['id'],'type':_0x2af50e[_0x66f5('0x2d')],'sectionId':_0x2af50e['id']},{})['then'](function(){return _0x39e65c;});}else{return _0x39e65c;}})[_0x66f5('0x47')](function(_0x210b81){logger[_0x66f5('0x2b')](_0x66f5('0x57'),_0x210b81);throw _0x210b81;});}return _0x39e65c;})[_0x66f5('0x27')](respondWithResult(_0x4e2201,0xc9))[_0x66f5('0x47')](handleError(_0x4e2201,null));};exports[_0x66f5('0x26')]=function(_0x5c3c82,_0x12b2c0){if(_0x5c3c82['body']['id']){delete _0x5c3c82['body']['id'];}return db[_0x66f5('0x30')][_0x66f5('0x4d')]({'where':{'id':_0x5c3c82[_0x66f5('0x49')]['id']}})[_0x66f5('0x27')](handleEntityNotFound(_0x12b2c0,null))[_0x66f5('0x27')](saveUpdates(_0x5c3c82[_0x66f5('0x4f')],null))[_0x66f5('0x27')](respondWithResult(_0x12b2c0,null))[_0x66f5('0x47')](handleError(_0x12b2c0,null));};exports['destroy']=function(_0x5e0f8d,_0x401a88){return db[_0x66f5('0x30')]['find']({'where':{'id':_0x5e0f8d[_0x66f5('0x49')]['id']}})[_0x66f5('0x27')](handleEntityNotFound(_0x401a88,null))['then'](removeEntity(_0x401a88,null))[_0x66f5('0x47')](handleError(_0x401a88,null));};exports[_0x66f5('0x58')]=function(_0x28e064,_0x4219c9,_0x2cd7a7){return db[_0x66f5('0x30')][_0x66f5('0x4d')]({'where':{'id':_0x28e064[_0x66f5('0x49')]['id']}})[_0x66f5('0x27')](handleEntityNotFound(_0x4219c9,null))[_0x66f5('0x27')](function(_0x163726){if(_0x163726){return _0x163726['addUsers'](_0x28e064[_0x66f5('0x4f')]['ids'],_[_0x66f5('0x59')](_0x28e064[_0x66f5('0x4f')],[_0x66f5('0x5a'),'id'])||{});}})[_0x66f5('0x27')](respondWithResult(_0x4219c9,null))[_0x66f5('0x47')](handleError(_0x4219c9,null));};exports[_0x66f5('0x5b')]=function(_0x3fce83,_0xf99bd4,_0x36425e){return db[_0x66f5('0x30')][_0x66f5('0x4d')]({'where':{'id':_0x3fce83[_0x66f5('0x49')]['id']}})[_0x66f5('0x27')](handleEntityNotFound(_0xf99bd4,null))[_0x66f5('0x27')](function(_0x57aa4f){if(_0x57aa4f){return _0x57aa4f[_0x66f5('0x5b')](_0x3fce83[_0x66f5('0x35')][_0x66f5('0x5a')])['then'](function(){if(_[_0x66f5('0x5c')](_0x3fce83['query']['ids'])){for(var _0x50d3b5=0x0;_0x50d3b5<_0x3fce83[_0x66f5('0x35')]['ids'][_0x66f5('0x3a')];_0x50d3b5+=0x1){socket[_0x66f5('0x5d')](_0x66f5('0x5e'),{'UserId':Number(_0x3fce83[_0x66f5('0x35')][_0x66f5('0x5a')][_0x50d3b5]),'SquareProjectId':Number(_0x3fce83[_0x66f5('0x49')]['id'])});}}else{socket[_0x66f5('0x5d')](_0x66f5('0x5e'),{'UserId':Number(_0x3fce83['query']['ids']),'SquareProjectId':Number(_0x3fce83['params']['id'])});}});}})['then'](respondWithStatusCode(_0xf99bd4,null))['catch'](handleError(_0xf99bd4,null));};exports[_0x66f5('0x5f')]=function(_0x30fd14,_0x1ee262,_0xb601cd){var _0x3bf1ed={};var _0x4576df={};var _0x390846;var _0x1c4ab;return db[_0x66f5('0x30')][_0x66f5('0x60')]({'where':{'id':_0x30fd14[_0x66f5('0x49')]['id']}})['then'](handleEntityNotFound(_0x1ee262,null))[_0x66f5('0x27')](function(_0xde8939){if(_0xde8939){_0x390846=_0xde8939;_0x4576df['model']=_[_0x66f5('0x36')](db['User'][_0x66f5('0x4a')]);_0x4576df[_0x66f5('0x35')]=_[_0x66f5('0x36')](_0x30fd14[_0x66f5('0x35')]);_0x4576df[_0x66f5('0x37')]=_[_0x66f5('0x4b')](_0x4576df[_0x66f5('0x33')],_0x4576df[_0x66f5('0x35')]);_0x3bf1ed[_0x66f5('0x39')]=_[_0x66f5('0x4b')](_0x4576df['model'],qs['fields'](_0x30fd14[_0x66f5('0x35')][_0x66f5('0x38')]));_0x3bf1ed[_0x66f5('0x39')]=_0x3bf1ed['attributes']['length']?_0x3bf1ed['attributes']:_0x4576df[_0x66f5('0x33')];_0x3bf1ed['order']=qs[_0x66f5('0x3d')](_0x30fd14[_0x66f5('0x35')][_0x66f5('0x3d')]);_0x3bf1ed[_0x66f5('0x3e')]=qs[_0x66f5('0x37')](_[_0x66f5('0x3f')](_0x30fd14[_0x66f5('0x35')],_0x4576df[_0x66f5('0x37')]));if(_0x30fd14[_0x66f5('0x35')][_0x66f5('0x40')]){_0x3bf1ed['where']=_[_0x66f5('0x41')](_0x3bf1ed[_0x66f5('0x3e')],{'$or':_[_0x66f5('0x34')](_0x3bf1ed['attributes'],function(_0x1385f9){var _0x5b7d21={};_0x5b7d21[_0x1385f9]={'$like':'%'+_0x30fd14[_0x66f5('0x35')][_0x66f5('0x40')]+'%'};return _0x5b7d21;})});}_0x3bf1ed=_[_0x66f5('0x41')]({},_0x3bf1ed,_0x30fd14['options']);return _0x390846[_0x66f5('0x5f')](_0x3bf1ed);}})[_0x66f5('0x27')](function(_0x82bf7a){if(_0x82bf7a){_0x1c4ab=_0x82bf7a[_0x66f5('0x3a')];if(!_0x30fd14[_0x66f5('0x35')][_0x66f5('0x61')]('nolimit')){_0x3bf1ed['limit']=qs['limit'](_0x30fd14[_0x66f5('0x35')][_0x66f5('0x21')]);_0x3bf1ed[_0x66f5('0x1f')]=qs[_0x66f5('0x1f')](_0x30fd14[_0x66f5('0x35')]['offset']);}return _0x390846[_0x66f5('0x5f')](_0x3bf1ed);}})[_0x66f5('0x27')](function(_0x402ab3){if(_0x402ab3){return _0x402ab3?{'count':_0x1c4ab,'rows':_0x402ab3}:null;}})[_0x66f5('0x27')](respondWithResult(_0x1ee262,null))[_0x66f5('0x47')](handleError(_0x1ee262,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 1bef456..caad31d 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 _0x67bb=['../../mysqldb','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x2c385b,_0x5f3197){var _0x15dc28=function(_0x26bf99){while(--_0x26bf99){_0x2c385b['push'](_0x2c385b['shift']());}};_0x15dc28(++_0x5f3197);}(_0x67bb,0x1ef));var _0xb67b=function(_0x8133ca,_0x3b2efc){_0x8133ca=_0x8133ca-0x0;var _0x225e17=_0x67bb[_0x8133ca];return _0x225e17;};'use strict';var EventEmitter=require(_0xb67b('0x0'));var SquareProject=require(_0xb67b('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb67b('0x2')](0x0);var events={'afterCreate':_0xb67b('0x3'),'afterUpdate':'update','afterDestroy':_0xb67b('0x4')};function emitEvent(_0x531ca1){return function(_0x10e2cd,_0x38044c,_0x253e4c){SquareProjectEvents['emit'](_0x531ca1+':'+_0x10e2cd['id'],_0x10e2cd);SquareProjectEvents[_0xb67b('0x5')](_0x531ca1,_0x10e2cd);_0x253e4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xb67b('0x6')](e,emitEvent(event));}}module[_0xb67b('0x7')]=SquareProjectEvents; \ No newline at end of file +var _0xce97=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x3c21f2,_0x346ffe){var _0xfcaca9=function(_0x15fbee){while(--_0x15fbee){_0x3c21f2['push'](_0x3c21f2['shift']());}};_0xfcaca9(++_0x346ffe);}(_0xce97,0x70));var _0x7ce9=function(_0x5c2e53,_0x2f26a7){_0x5c2e53=_0x5c2e53-0x0;var _0x3d9efb=_0xce97[_0x5c2e53];return _0x3d9efb;};'use strict';var EventEmitter=require(_0x7ce9('0x0'));var SquareProject=require(_0x7ce9('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7ce9('0x2'),'afterUpdate':_0x7ce9('0x3'),'afterDestroy':_0x7ce9('0x4')};function emitEvent(_0x5c3dfd){return function(_0x343d86,_0x17f073,_0x3d30){SquareProjectEvents[_0x7ce9('0x5')](_0x5c3dfd+':'+_0x343d86['id'],_0x343d86);SquareProjectEvents['emit'](_0x5c3dfd,_0x343d86);_0x3d30(null);};}for(var e in events){if(events[_0x7ce9('0x6')](e)){var event=events[e];SquareProject[_0x7ce9('0x7')](e,emitEvent(event));}}module[_0x7ce9('0x8')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 6f11e5e..a87b93d 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 _0x5c3e=['rimraf','../../config/environment','./squareProject.attributes','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x478948,_0x313472){var _0x3a62de=function(_0xee28e1){while(--_0xee28e1){_0x478948['push'](_0x478948['shift']());}};_0x3a62de(++_0x313472);}(_0x5c3e,0x175));var _0xe5c3=function(_0x751475,_0x20e339){_0x751475=_0x751475-0x0;var _0x25b801=_0x5c3e[_0x751475];return _0x25b801;};'use strict';var _=require(_0xe5c3('0x0'));var util=require('util');var logger=require(_0xe5c3('0x1'))(_0xe5c3('0x2'));var moment=require(_0xe5c3('0x3'));var BPromise=require(_0xe5c3('0x4'));var rp=require(_0xe5c3('0x5'));var fs=require('fs');var path=require(_0xe5c3('0x6'));var rimraf=require(_0xe5c3('0x7'));var config=require(_0xe5c3('0x8'));var attributes=require(_0xe5c3('0x9'));module['exports']=function(_0x53847e,_0x477b9d){return _0x53847e['define'](_0xe5c3('0xa'),attributes,{'tableName':_0xe5c3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8f8183,_0x200c2e,_0x5d75b3){if(_0x8f8183[_0xe5c3('0xc')](_0xe5c3('0xd'))){_0x8f8183[_0xe5c3('0xe')]=moment()[_0xe5c3('0xf')](_0xe5c3('0x10'));}if(_0x8f8183[_0xe5c3('0xc')](_0xe5c3('0x11'))){_0x8f8183[_0xe5c3('0x12')]=moment()[_0xe5c3('0xf')](_0xe5c3('0x10'));}_0x5d75b3(null,_0x8f8183);}}});}; \ No newline at end of file +var _0x062b=['rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','preproduction','YYYY-MM-DD\x20HH:mm:ss','production','format','../../config/logger','moment'];(function(_0x48db93,_0x42c34b){var _0x2907bd=function(_0x2a4da2){while(--_0x2a4da2){_0x48db93['push'](_0x48db93['shift']());}};_0x2907bd(++_0x42c34b);}(_0x062b,0x13d));var _0xb062=function(_0x32f574,_0x151623){_0x32f574=_0x32f574-0x0;var _0x16662f=_0x062b[_0x32f574];return _0x16662f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb062('0x0'))('api');var moment=require(_0xb062('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb062('0x2'));var config=require(_0xb062('0x3'));var attributes=require(_0xb062('0x4'));module[_0xb062('0x5')]=function(_0x37298e,_0xd772af){return _0x37298e['define'](_0xb062('0x6'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2be452,_0x2afba4,_0xfef870){if(_0x2be452['changed'](_0xb062('0x7'))){_0x2be452['savedAt']=moment()['format'](_0xb062('0x8'));}if(_0x2be452['changed'](_0xb062('0x9'))){_0x2be452['publishedAt']=moment()[_0xb062('0xa')](_0xb062('0x8'));}_0xfef870(null,_0x2be452);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7a73beb..8308645 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 _0x29b2=['defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','info','SquareProject,\x20%s,\x20%s','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','include','map','model','attributes','then','lodash','moment','bluebird','randomstring','rpc','redis'];(function(_0x2344d7,_0x1fe3c6){var _0x3e738c=function(_0x2c00fe){while(--_0x2c00fe){_0x2344d7['push'](_0x2344d7['shift']());}};_0x3e738c(++_0x1fe3c6);}(_0x29b2,0x1e9));var _0x229b=function(_0x141d7c,_0x5cd1c4){_0x141d7c=_0x141d7c-0x0;var _0x55ccb8=_0x29b2[_0x141d7c];return _0x55ccb8;};'use strict';var _=require(_0x229b('0x0'));var util=require('util');var moment=require(_0x229b('0x1'));var BPromise=require(_0x229b('0x2'));var rs=require(_0x229b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x229b('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x229b('0x5')]=_[_0x229b('0x6')](config['redis'],{'host':_0x229b('0x7'),'port':0x18eb});var socket=require(_0x229b('0x8'))(new Redis(config['redis']));require(_0x229b('0x9'))[_0x229b('0xa')](socket);function respondWithRpcPromise(_0x24be60,_0x516e54,_0x2a54c9){return new BPromise(function(_0x2f9a42,_0xcd347e){return client[_0x229b('0xb')](_0x24be60,_0x2a54c9)['then'](function(_0x61f215){logger[_0x229b('0xc')](_0x229b('0xd'),_0x516e54,_0x229b('0xe'));logger['debug'](_0x229b('0xf'),_0x516e54,_0x229b('0xe'),JSON[_0x229b('0x10')](_0x61f215));if(_0x61f215['error']){if(_0x61f215[_0x229b('0x11')][_0x229b('0x12')]===0x1f4){logger[_0x229b('0x11')](_0x229b('0xd'),_0x516e54,_0x61f215[_0x229b('0x11')][_0x229b('0x13')]);return _0xcd347e(_0x61f215[_0x229b('0x11')][_0x229b('0x13')]);}logger[_0x229b('0x11')](_0x229b('0xd'),_0x516e54,_0x61f215[_0x229b('0x11')][_0x229b('0x13')]);return _0x2f9a42(_0x61f215[_0x229b('0x11')][_0x229b('0x13')]);}else{logger[_0x229b('0xc')](_0x229b('0xd'),_0x516e54,_0x229b('0xe'));_0x2f9a42(_0x61f215[_0x229b('0x14')][_0x229b('0x13')]);}})[_0x229b('0x15')](function(_0x31878d){logger[_0x229b('0x11')]('SquareProject,\x20%s,\x20%s',_0x516e54,_0x31878d);_0xcd347e(_0x31878d);});});}exports[_0x229b('0x16')]=function(_0xda309){var _0x162e14=this;return new Promise(function(_0x4d3486,_0x816df7){return db[_0x229b('0x17')][_0x229b('0x18')]({'raw':_0xda309[_0x229b('0x19')]?_0xda309[_0x229b('0x19')][_0x229b('0x1a')]===undefined?!![]:![]:!![],'where':_0xda309[_0x229b('0x19')]?_0xda309[_0x229b('0x19')][_0x229b('0x1b')]||null:null,'attributes':_0xda309[_0x229b('0x19')]?_0xda309['options']['attributes']||null:null,'include':_0xda309['options']?_0xda309[_0x229b('0x19')][_0x229b('0x1c')]?_[_0x229b('0x1d')](_0xda309['options'][_0x229b('0x1c')],function(_0x54ba68){return{'model':db[_0x54ba68[_0x229b('0x1e')]],'as':_0x54ba68['as'],'attributes':_0x54ba68[_0x229b('0x1f')],'include':_0x54ba68['include']?_['map'](_0x54ba68[_0x229b('0x1c')],function(_0x559bc4){return{'model':db[_0x559bc4[_0x229b('0x1e')]],'as':_0x559bc4['as'],'attributes':_0x559bc4['attributes'],'include':_0x559bc4[_0x229b('0x1c')]?_[_0x229b('0x1d')](_0x559bc4[_0x229b('0x1c')],function(_0x12b45b){return{'model':db[_0x12b45b[_0x229b('0x1e')]],'as':_0x12b45b['as'],'attributes':_0x12b45b[_0x229b('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x229b('0x20')](function(_0x19360d){logger[_0x229b('0xc')](_0x229b('0x16'),_0xda309);logger['debug'](_0x229b('0x16'),_0xda309,JSON[_0x229b('0x10')](_0x19360d));_0x4d3486(_0x19360d);})[_0x229b('0x15')](function(_0x57a10a){logger['error'](_0x229b('0x16'),_0x57a10a[_0x229b('0x13')],_0xda309);_0x816df7(_0x162e14[_0x229b('0x11')](0x1f4,_0x57a10a[_0x229b('0x13')]));});});}; \ No newline at end of file +var _0xd6d3=['SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSquareProject','SquareProject','find','options','raw','include','model','attributes','map','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','localhost','redis','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent'];(function(_0x375800,_0x55e55f){var _0x36d0ea=function(_0x456c7c){while(--_0x456c7c){_0x375800['push'](_0x375800['shift']());}};_0x36d0ea(++_0x55e55f);}(_0xd6d3,0x163));var _0x3d6d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd6d3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x3d6d('0x0'));var util=require(_0x3d6d('0x1'));var moment=require('moment');var BPromise=require(_0x3d6d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d6d('0x3'));var db=require(_0x3d6d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3d6d('0x5'));var config=require(_0x3d6d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3d6d('0x7')][_0x3d6d('0x8')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x3d6d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3d6d('0xa')]));require('./squareProject.socket')[_0x3d6d('0xb')](socket);function respondWithRpcPromise(_0x18917a,_0x3c2889,_0x43941f){return new BPromise(function(_0x5b3972,_0xb682d8){return client[_0x3d6d('0xc')](_0x18917a,_0x43941f)[_0x3d6d('0xd')](function(_0x29b779){logger[_0x3d6d('0xe')](_0x3d6d('0xf'),_0x3c2889,_0x3d6d('0x10'));logger['debug'](_0x3d6d('0x11'),_0x3c2889,_0x3d6d('0x10'),JSON[_0x3d6d('0x12')](_0x29b779));if(_0x29b779[_0x3d6d('0x13')]){if(_0x29b779[_0x3d6d('0x13')]['code']===0x1f4){logger[_0x3d6d('0x13')](_0x3d6d('0xf'),_0x3c2889,_0x29b779[_0x3d6d('0x13')][_0x3d6d('0x14')]);return _0xb682d8(_0x29b779[_0x3d6d('0x13')][_0x3d6d('0x14')]);}logger[_0x3d6d('0x13')]('SquareProject,\x20%s,\x20%s',_0x3c2889,_0x29b779[_0x3d6d('0x13')]['message']);return _0x5b3972(_0x29b779[_0x3d6d('0x13')][_0x3d6d('0x14')]);}else{logger[_0x3d6d('0xe')](_0x3d6d('0xf'),_0x3c2889,_0x3d6d('0x10'));_0x5b3972(_0x29b779['result'][_0x3d6d('0x14')]);}})[_0x3d6d('0x15')](function(_0x28e319){logger[_0x3d6d('0x13')]('SquareProject,\x20%s,\x20%s',_0x3c2889,_0x28e319);_0xb682d8(_0x28e319);});});}exports[_0x3d6d('0x16')]=function(_0x374e1c){var _0xf0bcb3=this;return new Promise(function(_0x3a3ba6,_0x409d98){return db[_0x3d6d('0x17')][_0x3d6d('0x18')]({'raw':_0x374e1c[_0x3d6d('0x19')]?_0x374e1c[_0x3d6d('0x19')][_0x3d6d('0x1a')]===undefined?!![]:![]:!![],'where':_0x374e1c[_0x3d6d('0x19')]?_0x374e1c[_0x3d6d('0x19')]['where']||null:null,'attributes':_0x374e1c[_0x3d6d('0x19')]?_0x374e1c['options']['attributes']||null:null,'include':_0x374e1c[_0x3d6d('0x19')]?_0x374e1c['options'][_0x3d6d('0x1b')]?_['map'](_0x374e1c[_0x3d6d('0x19')]['include'],function(_0x4bd7b9){return{'model':db[_0x4bd7b9[_0x3d6d('0x1c')]],'as':_0x4bd7b9['as'],'attributes':_0x4bd7b9[_0x3d6d('0x1d')],'include':_0x4bd7b9[_0x3d6d('0x1b')]?_[_0x3d6d('0x1e')](_0x4bd7b9['include'],function(_0x217de4){return{'model':db[_0x217de4[_0x3d6d('0x1c')]],'as':_0x217de4['as'],'attributes':_0x217de4[_0x3d6d('0x1d')],'include':_0x217de4['include']?_[_0x3d6d('0x1e')](_0x217de4[_0x3d6d('0x1b')],function(_0x2777ff){return{'model':db[_0x2777ff[_0x3d6d('0x1c')]],'as':_0x2777ff['as'],'attributes':_0x2777ff[_0x3d6d('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26aab6){logger[_0x3d6d('0xe')](_0x3d6d('0x16'),_0x374e1c);logger['debug'](_0x3d6d('0x16'),_0x374e1c,JSON['stringify'](_0x26aab6));_0x3a3ba6(_0x26aab6);})[_0x3d6d('0x15')](function(_0x4dc79c){logger[_0x3d6d('0x13')](_0x3d6d('0x16'),_0x4dc79c[_0x3d6d('0x14')],_0x374e1c);_0x409d98(_0xf0bcb3[_0x3d6d('0x13')](0x1f4,_0x4dc79c[_0x3d6d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 4169008..0c70c9d 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 _0x103d=['register','length','./squareProject.events','remove','update','emit'];(function(_0x31038b,_0x3ac1c9){var _0x1c9d3c=function(_0xe00e97){while(--_0xe00e97){_0x31038b['push'](_0x31038b['shift']());}};_0x1c9d3c(++_0x3ac1c9);}(_0x103d,0x1ee));var _0xd103=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x103d[_0x278e3c];return _0x3e2d9b;};'use strict';var SquareProjectEvents=require(_0xd103('0x0'));var events=['save',_0xd103('0x1'),_0xd103('0x2')];function createListener(_0x2dba69,_0x234318){return function(_0xb96009){_0x234318[_0xd103('0x3')](_0x2dba69,_0xb96009);};}function removeListener(_0x3928fe,_0x427746){return function(){SquareProjectEvents['removeListener'](_0x3928fe,_0x427746);};}exports[_0xd103('0x4')]=function(_0x3ee5f0){for(var _0x5c36dc=0x0,_0x38e6cc=events[_0xd103('0x5')];_0x5c36dc<_0x38e6cc;_0x5c36dc++){var _0x113aa4=events[_0x5c36dc];var _0x40722d=createListener('squareProject:'+_0x113aa4,_0x3ee5f0);SquareProjectEvents['on'](_0x113aa4,_0x40722d);}}; \ No newline at end of file +var _0x085f=['register','length','squareProject:','./squareProject.events','remove','update','emit'];(function(_0x5d26cd,_0x5dd655){var _0x20c253=function(_0x2d3d7d){while(--_0x2d3d7d){_0x5d26cd['push'](_0x5d26cd['shift']());}};_0x20c253(++_0x5dd655);}(_0x085f,0x7a));var _0xf085=function(_0x832bbc,_0x1e3e13){_0x832bbc=_0x832bbc-0x0;var _0x5d92f3=_0x085f[_0x832bbc];return _0x5d92f3;};'use strict';var SquareProjectEvents=require(_0xf085('0x0'));var events=['save',_0xf085('0x1'),_0xf085('0x2')];function createListener(_0x48a7c2,_0x212937){return function(_0x239170){_0x212937[_0xf085('0x3')](_0x48a7c2,_0x239170);};}function removeListener(_0x3812f1,_0x4a9a98){return function(){SquareProjectEvents['removeListener'](_0x3812f1,_0x4a9a98);};}exports[_0xf085('0x4')]=function(_0x3e8770){for(var _0x427528=0x0,_0x455480=events[_0xf085('0x5')];_0x427528<_0x455480;_0x427528++){var _0x40130a=events[_0x427528];var _0x31a1db=createListener(_0xf085('0x6')+_0x40130a,_0x3e8770);SquareProjectEvents['on'](_0x40130a,_0x31a1db);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 7d43dff..5973b19 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 _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x346863,_0xe74a03){var _0x24cfa3=function(_0x4cc2ea){while(--_0x4cc2ea){_0x346863['push'](_0x346863['shift']());}};_0x24cfa3(++_0xe74a03);}(_0x5fc3,0xa8));var _0x35fc=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x5fc3[_0x40bffc];return _0x3007e9;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x3741d2,_0x223f55){var _0x5b1c7b=function(_0x44311c){while(--_0x44311c){_0x3741d2['push'](_0x3741d2['shift']());}};_0x5b1c7b(++_0x223f55);}(_0x7a54,0x106));var _0x47a5=function(_0x135c13,_0x1a0f80){_0x135c13=_0x135c13-0x0;var _0x31a43f=_0x7a54[_0x135c13];return _0x31a43f;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 1e30e7d..e066bc9 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 _0xee14=['VIRTUAL','getDataValue','savePath','substring','STRING'];(function(_0x505e73,_0x28ece3){var _0x44e489=function(_0x3520bd){while(--_0x3520bd){_0x505e73['push'](_0x505e73['shift']());}};_0x44e489(++_0x28ece3);}(_0xee14,0x13a));var _0x4ee1=function(_0x380aab,_0x1f31db){_0x380aab=_0x380aab-0x0;var _0x504d0b=_0xee14[_0x380aab];return _0x504d0b;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x4ee1('0x0')]},'callerid':{'type':Sequelize[_0x4ee1('0x0')]},'calleridname':{'type':Sequelize[_0x4ee1('0x0')]},'context':{'type':Sequelize[_0x4ee1('0x0')]},'extension':{'type':Sequelize[_0x4ee1('0x0')]},'priority':{'type':Sequelize[_0x4ee1('0x0')]},'accountcode':{'type':Sequelize[_0x4ee1('0x0')]},'dnid':{'type':Sequelize[_0x4ee1('0x0')]},'projectName':{'type':Sequelize[_0x4ee1('0x0')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x4ee1('0x0')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x4ee1('0x1')],'get':function(){var _0x3a45a3='';var _0x187656=this[_0x4ee1('0x2')](_0x4ee1('0x3'));if(_0x187656){_0x3a45a3=_0x187656[_0x4ee1('0x4')](_0x187656['lastIndexOf']('.'));}return _0x3a45a3;}}}; \ No newline at end of file +var _0xdc97=['savePath','substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0xdc97,0x13b));var _0x7dc9=function(_0x2e5209,_0x4f1971){_0x2e5209=_0x2e5209-0x0;var _0x1b1560=_0xdc97[_0x2e5209];return _0x1b1560;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'uniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7dc9('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7dc9('0x2')]},'priority':{'type':Sequelize[_0x7dc9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7dc9('0x2')]},'projectName':{'type':Sequelize[_0x7dc9('0x2')]},'saveName':{'type':Sequelize[_0x7dc9('0x2')]},'filename':{'type':Sequelize[_0x7dc9('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7dc9('0x3')],'get':function(){var _0x4f91c7='';var _0x4b3229=this[_0x7dc9('0x4')](_0x7dc9('0x5'));if(_0x4b3229){_0x4f91c7=_0x4b3229[_0x7dc9('0x6')](_0x4b3229[_0x7dc9('0x7')]('.'));}return _0x4f91c7;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index cda701b..6bada1c 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 _0x925f=['fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','error','name','send','fieldName','type','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','SquareRecording','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','ValidationError','download','message','SquareRecording\x20not\x20found','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format'];(function(_0x2c3623,_0x59adff){var _0x16a154=function(_0x19e1ae){while(--_0x19e1ae){_0x2c3623['push'](_0x2c3623['shift']());}};_0x16a154(++_0x59adff);}(_0x925f,0x10d));var _0xf925=function(_0x318054,_0x516efd){_0x318054=_0x318054-0x0;var _0x19a6ae=_0x925f[_0x318054];return _0x19a6ae;};'use strict';var emlformat=require(_0xf925('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf925('0x1'));var rp=require('request-promise');var moment=require(_0xf925('0x2'));var BPromise=require(_0xf925('0x3'));var Mustache=require(_0xf925('0x4'));var util=require(_0xf925('0x5'));var path=require('path');var sox=require(_0xf925('0x6'));var csv=require('to-csv');var ejs=require(_0xf925('0x7'));var fs=require('fs');var fs_extra=require(_0xf925('0x8'));var _=require(_0xf925('0x9'));var squel=require(_0xf925('0xa'));var crypto=require(_0xf925('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xf925('0xc'));var toCsv=require(_0xf925('0xd'));var querystring=require('querystring');var Papa=require(_0xf925('0xe'));var Redis=require(_0xf925('0xf'));var authService=require(_0xf925('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf925('0x11'));var hardwareService=require(_0xf925('0x12'));var logger=require(_0xf925('0x13'))('api');var utils=require(_0xf925('0x14'));var config=require(_0xf925('0x15'));var licenseUtil=require(_0xf925('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47b754,_0x4667f4){_0x4667f4=_0x4667f4||0xcc;return function(_0x49abea){if(_0x49abea){return _0x47b754[_0xf925('0x17')](_0x4667f4);}return _0x47b754[_0xf925('0x18')](_0x4667f4)['end']();};}function respondWithResult(_0x89e61a,_0xa9faa4){_0xa9faa4=_0xa9faa4||0xc8;return function(_0x4ce90c){if(_0x4ce90c){return _0x89e61a['status'](_0xa9faa4)[_0xf925('0x19')](_0x4ce90c);}};}function respondWithFilteredResult(_0x554433,_0x426178){return function(_0x15b609){if(_0x15b609){var _0x3906d3=typeof _0x426178[_0xf925('0x1a')]===_0xf925('0x1b')&&typeof _0x426178[_0xf925('0x1c')]===_0xf925('0x1b');var _0x5d7316=_0x15b609[_0xf925('0x1d')];var _0xe333a9=_0x3906d3?0x0:_0x426178[_0xf925('0x1a')];var _0x40f699=_0x3906d3?_0x15b609[_0xf925('0x1d')]:_0x426178[_0xf925('0x1a')]+_0x426178[_0xf925('0x1c')];var _0x465bd4;if(_0x40f699>=_0x5d7316){_0x40f699=_0x5d7316;_0x465bd4=0xc8;}else{_0x465bd4=0xce;}_0x554433[_0xf925('0x18')](_0x465bd4);return _0x554433['set'](_0xf925('0x1e'),_0xe333a9+'-'+_0x40f699+'/'+_0x5d7316)[_0xf925('0x19')](_0x15b609);}return null;};}function patchUpdates(_0x26db2a){return function(_0x55d81c){try{jsonpatch['apply'](_0x55d81c,_0x26db2a,!![]);}catch(_0x1b4cef){return BPromise['reject'](_0x1b4cef);}return _0x55d81c[_0xf925('0x1f')]();};}function saveUpdates(_0x42b0d2,_0xf8d748){return function(_0xce331d){if(_0xce331d){return _0xce331d[_0xf925('0x20')](_0x42b0d2)[_0xf925('0x21')](function(_0x1d236){return _0x1d236;});}return null;};}function removeEntity(_0x5c4ab5,_0x515588){return function(_0x72864c){if(_0x72864c){return _0x72864c[_0xf925('0x22')]()['then'](function(){_0x5c4ab5[_0xf925('0x18')](0xcc)[_0xf925('0x23')]();});}};}function handleEntityNotFound(_0x40d5e9,_0x558a5e){return function(_0x1d8e59){if(!_0x1d8e59){_0x40d5e9[_0xf925('0x17')](0x194);}return _0x1d8e59;};}function handleError(_0xbb9cd5,_0x16e1ab){_0x16e1ab=_0x16e1ab||0x1f4;return function(_0x459fab){logger[_0xf925('0x24')](_0x459fab['stack']);if(_0x459fab[_0xf925('0x25')]){delete _0x459fab[_0xf925('0x25')];}_0xbb9cd5['status'](_0x16e1ab)[_0xf925('0x26')](_0x459fab);};}exports['index']=function(_0x3e908e,_0x24d722){var _0x5ddaa0={},_0x4e2335={},_0x13f109={'count':0x0,'rows':[]};var _0x1f5cb2=_['map'](db['SquareRecording']['rawAttributes'],function(_0x5d2494){return{'name':_0x5d2494[_0xf925('0x27')],'type':_0x5d2494[_0xf925('0x28')]['key']};});_0x4e2335[_0xf925('0x29')]=_[_0xf925('0x2a')](_0x1f5cb2,_0xf925('0x25'));_0x4e2335[_0xf925('0x2b')]=_[_0xf925('0x2c')](_0x3e908e[_0xf925('0x2b')]);_0x4e2335['filters']=_[_0xf925('0x2d')](_0x4e2335[_0xf925('0x29')],_0x4e2335[_0xf925('0x2b')]);_0x5ddaa0['attributes']=_[_0xf925('0x2d')](_0x4e2335[_0xf925('0x29')],qs[_0xf925('0x2e')](_0x3e908e[_0xf925('0x2b')]['fields']));_0x5ddaa0[_0xf925('0x2f')]=_0x5ddaa0['attributes'][_0xf925('0x30')]?_0x5ddaa0[_0xf925('0x2f')]:_0x4e2335[_0xf925('0x29')];if(!_0x3e908e['query'][_0xf925('0x31')](_0xf925('0x32'))){_0x5ddaa0[_0xf925('0x1c')]=qs['limit'](_0x3e908e[_0xf925('0x2b')][_0xf925('0x1c')]);_0x5ddaa0[_0xf925('0x1a')]=qs[_0xf925('0x1a')](_0x3e908e[_0xf925('0x2b')][_0xf925('0x1a')]);}_0x5ddaa0[_0xf925('0x33')]=qs[_0xf925('0x34')](_0x3e908e['query'][_0xf925('0x34')]);_0x5ddaa0[_0xf925('0x35')]=qs[_0xf925('0x36')](_[_0xf925('0x37')](_0x3e908e[_0xf925('0x2b')],_0x4e2335[_0xf925('0x36')]),_0x1f5cb2);if(_0x3e908e['query']['filter']){_0x5ddaa0[_0xf925('0x35')]=_[_0xf925('0x38')](_0x5ddaa0[_0xf925('0x35')],{'$or':_['map'](_0x1f5cb2,function(_0x185887){if(_0x185887[_0xf925('0x28')]!==_0xf925('0x39')){var _0x3cffd4={};_0x3cffd4[_0x185887[_0xf925('0x25')]]={'$like':'%'+_0x3e908e[_0xf925('0x2b')][_0xf925('0x3a')]+'%'};return _0x3cffd4;}})});}_0x5ddaa0=_[_0xf925('0x38')]({},_0x5ddaa0,_0x3e908e['options']);var _0x23a08b={'where':_0x5ddaa0['where']};return db[_0xf925('0x3b')][_0xf925('0x1d')](_0x23a08b)[_0xf925('0x21')](function(_0x54e5b9){_0x13f109[_0xf925('0x1d')]=_0x54e5b9;if(_0x3e908e[_0xf925('0x2b')]['includeAll']){_0x5ddaa0[_0xf925('0x3c')]=[{'all':!![]}];}return db[_0xf925('0x3b')][_0xf925('0x3d')](_0x5ddaa0);})['then'](function(_0x38a9d1){_0x13f109[_0xf925('0x3e')]=_0x38a9d1;return _0x13f109;})[_0xf925('0x21')](respondWithFilteredResult(_0x24d722,_0x5ddaa0))[_0xf925('0x3f')](handleError(_0x24d722,null));};exports[_0xf925('0x40')]=function(_0xb5053b,_0x30a2df){var _0x12ce9c={'raw':!![],'where':{'id':_0xb5053b[_0xf925('0x41')]['id']}},_0xe727c1={};_0xe727c1[_0xf925('0x29')]=_[_0xf925('0x2c')](db[_0xf925('0x3b')]['rawAttributes']);_0xe727c1[_0xf925('0x2b')]=_[_0xf925('0x2c')](_0xb5053b['query']);_0xe727c1[_0xf925('0x36')]=_['intersection'](_0xe727c1[_0xf925('0x29')],_0xe727c1[_0xf925('0x2b')]);_0x12ce9c[_0xf925('0x2f')]=_[_0xf925('0x2d')](_0xe727c1[_0xf925('0x29')],qs[_0xf925('0x2e')](_0xb5053b[_0xf925('0x2b')][_0xf925('0x2e')]));_0x12ce9c['attributes']=_0x12ce9c['attributes']['length']?_0x12ce9c[_0xf925('0x2f')]:_0xe727c1[_0xf925('0x29')];if(_0xb5053b[_0xf925('0x2b')][_0xf925('0x42')]){_0x12ce9c[_0xf925('0x3c')]=[{'all':!![]}];}_0x12ce9c=_[_0xf925('0x38')]({},_0x12ce9c,_0xb5053b[_0xf925('0x43')]);return db[_0xf925('0x3b')][_0xf925('0x44')](_0x12ce9c)[_0xf925('0x21')](handleEntityNotFound(_0x30a2df,null))['then'](respondWithResult(_0x30a2df,null))[_0xf925('0x3f')](handleError(_0x30a2df,null));};exports[_0xf925('0x45')]=function(_0x3d2505,_0xd43ae2){return db[_0xf925('0x3b')][_0xf925('0x45')](_0x3d2505[_0xf925('0x46')],{})['then'](respondWithResult(_0xd43ae2,0xc9))['catch'](handleError(_0xd43ae2,null));};exports[_0xf925('0x20')]=function(_0x2e50ed,_0x49401c){if(_0x2e50ed['body']['id']){delete _0x2e50ed[_0xf925('0x46')]['id'];}return db[_0xf925('0x3b')][_0xf925('0x44')]({'where':{'id':_0x2e50ed['params']['id']}})[_0xf925('0x21')](handleEntityNotFound(_0x49401c,null))['then'](saveUpdates(_0x2e50ed['body'],null))[_0xf925('0x21')](respondWithResult(_0x49401c,null))['catch'](handleError(_0x49401c,null));};exports['download']=function(_0x284a04,_0x138fcd,_0x3ff2bc){var _0x3c5b06=require(_0xf925('0x47'));var _0x2c0996=![];var _0x45958c={};if(_0x284a04['query'][_0xf925('0x28')]&&_0x284a04[_0xf925('0x2b')]['type']==='uniqueid'){_0x45958c[_0xf925('0x48')]=_0x284a04[_0xf925('0x41')]['id'];}else{_0x45958c['id']=_0x284a04['params']['id'];}return db[_0xf925('0x3b')][_0xf925('0x44')]({'where':_0x45958c,'attributes':['id',_0xf925('0x49'),_0xf925('0x4a')],'raw':!![]})[_0xf925('0x21')](handleEntityNotFound(_0x138fcd,null))[_0xf925('0x21')](function(_0x52824f){if(_0x52824f){var _0x5b0e51=_0x52824f[_0xf925('0x49')];var _0x4eaf86=util[_0xf925('0x4b')](_0xf925('0x4c'),_0x5b0e51);if(fs[_0xf925('0x4d')](_0x4eaf86)){_0x2c0996=!![];return _0x3c5b06[_0xf925('0x4e')](_0x4eaf86,_0x5b0e51,config['secrets']['recording'])[_0xf925('0x21')](function(){return _0x52824f;});}return _0x52824f;}})[_0xf925('0x21')](function(_0x14cbbc){if(_0x14cbbc){var _0x404908=_0x14cbbc['savePath'];if(!fs['existsSync'](_0x404908)){throw new db['Sequelize'][(_0xf925('0x4f'))]('SquareRecording\x20not\x20found');}if(_0x14cbbc[_0xf925('0x4a')]){return _0x138fcd[_0xf925('0x50')](_0x404908,_0x14cbbc[_0xf925('0x4a')]+path['extname'](_0x404908),function(){if(_0x2c0996){fs['unlink'](_0x404908);}});}else{return _0x138fcd[_0xf925('0x50')](_0x404908,function(_0x400b14){if(_0x2c0996){fs['unlink'](_0x404908);}});}}})[_0xf925('0x3f')](function(_0x129a5d){if(_0x129a5d[_0xf925('0x51')]===_0xf925('0x52')){_0x138fcd[_0xf925('0x18')](0x194)['send'](_0xf925('0x53'));}else{return handleError(_0x138fcd,null);}});};exports['destroy']=function(_0x17e6bf,_0x1a7b19){return db['SquareRecording'][_0xf925('0x44')]({'where':{'id':_0x17e6bf['params']['id']}})[_0xf925('0x21')](function(_0x17c85d){if(_[_0xf925('0x54')](_0x17c85d)){throw new ReferenceError('Entity\x20not\x20found');}return _0x17c85d;})[_0xf925('0x21')](function(_0x525179){var _0x573102=_0x525179[_0xf925('0x49')];logger[_0xf925('0x55')](_0xf925('0x56'),_0x573102);if(!_[_0xf925('0x54')](_0x525179['savePath'])&&fs[_0xf925('0x4d')](_0x573102)){logger[_0xf925('0x55')](_0xf925('0x57')+_0x573102+_0xf925('0x58'));fs['unlinkSync'](_0x573102);}_0x573102=_0x573102+_0xf925('0x59');if(!_[_0xf925('0x54')](_0x525179[_0xf925('0x49')])&&fs[_0xf925('0x4d')](_0x573102)){logger[_0xf925('0x55')](_0xf925('0x57')+_0x573102+_0xf925('0x58'));fs['unlinkSync'](_0x573102);}return _0x525179;})['then'](function(_0x55170d){if(!_0x55170d)throw new InternalError();return _0x55170d['destroy']();})[_0xf925('0x21')](function(){_0x1a7b19[_0xf925('0x18')](0xcc)[_0xf925('0x23')]();})[_0xf925('0x3f')](handleError(_0x1a7b19,null));}; \ No newline at end of file +var _0x40ff=['unlinkSync','.cypher','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','SquareRecording','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','update','body','download','type','uniqueid','savePath','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x1e6ffa,_0x1bdbdf){var _0x42ac38=function(_0x2cee45){while(--_0x2cee45){_0x1e6ffa['push'](_0x1e6ffa['shift']());}};_0x42ac38(++_0x1bdbdf);}(_0x40ff,0xc8));var _0xf40f=function(_0xbafd40,_0x84ce0f){_0xbafd40=_0xbafd40-0x0;var _0x41e50c=_0x40ff[_0xbafd40];return _0x41e50c;};'use strict';var emlformat=require(_0xf40f('0x0'));var rimraf=require(_0xf40f('0x1'));var zipdir=require(_0xf40f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf40f('0x3'));var moment=require(_0xf40f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf40f('0x5'));var path=require('path');var sox=require(_0xf40f('0x6'));var csv=require(_0xf40f('0x7'));var ejs=require(_0xf40f('0x8'));var fs=require('fs');var fs_extra=require(_0xf40f('0x9'));var _=require(_0xf40f('0xa'));var squel=require(_0xf40f('0xb'));var crypto=require(_0xf40f('0xc'));var jsforce=require(_0xf40f('0xd'));var deskjs=require(_0xf40f('0xe'));var toCsv=require(_0xf40f('0x7'));var querystring=require(_0xf40f('0xf'));var Papa=require('papaparse');var Redis=require(_0xf40f('0x10'));var authService=require(_0xf40f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf40f('0x12'));var hardwareService=require(_0xf40f('0x13'));var logger=require('../../config/logger')(_0xf40f('0x14'));var utils=require(_0xf40f('0x15'));var config=require(_0xf40f('0x16'));var licenseUtil=require(_0xf40f('0x17'));var db=require(_0xf40f('0x18'))['db'];function respondWithStatusCode(_0x46ea3c,_0x39bac7){_0x39bac7=_0x39bac7||0xcc;return function(_0x3ca9bc){if(_0x3ca9bc){return _0x46ea3c[_0xf40f('0x19')](_0x39bac7);}return _0x46ea3c[_0xf40f('0x1a')](_0x39bac7)[_0xf40f('0x1b')]();};}function respondWithResult(_0x1cea01,_0x4f01c6){_0x4f01c6=_0x4f01c6||0xc8;return function(_0x5b5f80){if(_0x5b5f80){return _0x1cea01[_0xf40f('0x1a')](_0x4f01c6)[_0xf40f('0x1c')](_0x5b5f80);}};}function respondWithFilteredResult(_0xd3f7a7,_0x1614e9){return function(_0x3bbbec){if(_0x3bbbec){var _0x240d0e=typeof _0x1614e9[_0xf40f('0x1d')]===_0xf40f('0x1e')&&typeof _0x1614e9[_0xf40f('0x1f')]==='undefined';var _0x2c14e0=_0x3bbbec['count'];var _0x5e443d=_0x240d0e?0x0:_0x1614e9['offset'];var _0x3c2859=_0x240d0e?_0x3bbbec[_0xf40f('0x20')]:_0x1614e9[_0xf40f('0x1d')]+_0x1614e9['limit'];var _0xcc0769;if(_0x3c2859>=_0x2c14e0){_0x3c2859=_0x2c14e0;_0xcc0769=0xc8;}else{_0xcc0769=0xce;}_0xd3f7a7[_0xf40f('0x1a')](_0xcc0769);return _0xd3f7a7[_0xf40f('0x21')](_0xf40f('0x22'),_0x5e443d+'-'+_0x3c2859+'/'+_0x2c14e0)['json'](_0x3bbbec);}return null;};}function patchUpdates(_0x5bcf19){return function(_0x1335f2){try{jsonpatch[_0xf40f('0x23')](_0x1335f2,_0x5bcf19,!![]);}catch(_0x3cf8b3){return BPromise[_0xf40f('0x24')](_0x3cf8b3);}return _0x1335f2[_0xf40f('0x25')]();};}function saveUpdates(_0x3eff25,_0x59b9ce){return function(_0x377f1f){if(_0x377f1f){return _0x377f1f['update'](_0x3eff25)[_0xf40f('0x26')](function(_0x32ed48){return _0x32ed48;});}return null;};}function removeEntity(_0xaf836a,_0x6b86ba){return function(_0x3b909f){if(_0x3b909f){return _0x3b909f[_0xf40f('0x27')]()[_0xf40f('0x26')](function(){_0xaf836a[_0xf40f('0x1a')](0xcc)[_0xf40f('0x1b')]();});}};}function handleEntityNotFound(_0x17f231,_0x4dcc66){return function(_0x145a6b){if(!_0x145a6b){_0x17f231[_0xf40f('0x19')](0x194);}return _0x145a6b;};}function handleError(_0x441afb,_0x43a6f7){_0x43a6f7=_0x43a6f7||0x1f4;return function(_0x2f4f17){logger[_0xf40f('0x28')](_0x2f4f17[_0xf40f('0x29')]);if(_0x2f4f17[_0xf40f('0x2a')]){delete _0x2f4f17['name'];}_0x441afb[_0xf40f('0x1a')](_0x43a6f7)[_0xf40f('0x2b')](_0x2f4f17);};}exports['index']=function(_0x448f88,_0x3d3d64){var _0x439b7d={},_0x1635b9={},_0x4bc19f={'count':0x0,'rows':[]};var _0x362dd=_[_0xf40f('0x2c')](db[_0xf40f('0x2d')][_0xf40f('0x2e')],function(_0x56faa1){return{'name':_0x56faa1[_0xf40f('0x2f')],'type':_0x56faa1['type'][_0xf40f('0x30')]};});_0x1635b9[_0xf40f('0x31')]=_['map'](_0x362dd,_0xf40f('0x2a'));_0x1635b9['query']=_['keys'](_0x448f88[_0xf40f('0x32')]);_0x1635b9['filters']=_[_0xf40f('0x33')](_0x1635b9[_0xf40f('0x31')],_0x1635b9[_0xf40f('0x32')]);_0x439b7d[_0xf40f('0x34')]=_[_0xf40f('0x33')](_0x1635b9[_0xf40f('0x31')],qs[_0xf40f('0x35')](_0x448f88[_0xf40f('0x32')]['fields']));_0x439b7d[_0xf40f('0x34')]=_0x439b7d['attributes'][_0xf40f('0x36')]?_0x439b7d['attributes']:_0x1635b9['model'];if(!_0x448f88[_0xf40f('0x32')][_0xf40f('0x37')]('nolimit')){_0x439b7d['limit']=qs[_0xf40f('0x1f')](_0x448f88[_0xf40f('0x32')][_0xf40f('0x1f')]);_0x439b7d[_0xf40f('0x1d')]=qs[_0xf40f('0x1d')](_0x448f88[_0xf40f('0x32')][_0xf40f('0x1d')]);}_0x439b7d[_0xf40f('0x38')]=qs[_0xf40f('0x39')](_0x448f88[_0xf40f('0x32')][_0xf40f('0x39')]);_0x439b7d[_0xf40f('0x3a')]=qs[_0xf40f('0x3b')](_[_0xf40f('0x3c')](_0x448f88[_0xf40f('0x32')],_0x1635b9['filters']),_0x362dd);if(_0x448f88[_0xf40f('0x32')][_0xf40f('0x3d')]){_0x439b7d[_0xf40f('0x3a')]=_['merge'](_0x439b7d[_0xf40f('0x3a')],{'$or':_[_0xf40f('0x2c')](_0x362dd,function(_0xed7b20){if(_0xed7b20['type']!==_0xf40f('0x3e')){var _0x592507={};_0x592507[_0xed7b20['name']]={'$like':'%'+_0x448f88[_0xf40f('0x32')]['filter']+'%'};return _0x592507;}})});}_0x439b7d=_[_0xf40f('0x3f')]({},_0x439b7d,_0x448f88[_0xf40f('0x40')]);var _0x2eaa75={'where':_0x439b7d[_0xf40f('0x3a')]};return db[_0xf40f('0x2d')][_0xf40f('0x20')](_0x2eaa75)[_0xf40f('0x26')](function(_0x51cc8a){_0x4bc19f[_0xf40f('0x20')]=_0x51cc8a;if(_0x448f88['query'][_0xf40f('0x41')]){_0x439b7d[_0xf40f('0x42')]=[{'all':!![]}];}return db['SquareRecording'][_0xf40f('0x43')](_0x439b7d);})[_0xf40f('0x26')](function(_0x2289ea){_0x4bc19f[_0xf40f('0x44')]=_0x2289ea;return _0x4bc19f;})[_0xf40f('0x26')](respondWithFilteredResult(_0x3d3d64,_0x439b7d))[_0xf40f('0x45')](handleError(_0x3d3d64,null));};exports[_0xf40f('0x46')]=function(_0x12f09d,_0x335b40){var _0x3f1ffe={'raw':!![],'where':{'id':_0x12f09d[_0xf40f('0x47')]['id']}},_0x521e23={};_0x521e23[_0xf40f('0x31')]=_['keys'](db[_0xf40f('0x2d')][_0xf40f('0x2e')]);_0x521e23[_0xf40f('0x32')]=_[_0xf40f('0x48')](_0x12f09d[_0xf40f('0x32')]);_0x521e23[_0xf40f('0x3b')]=_[_0xf40f('0x33')](_0x521e23[_0xf40f('0x31')],_0x521e23[_0xf40f('0x32')]);_0x3f1ffe['attributes']=_[_0xf40f('0x33')](_0x521e23[_0xf40f('0x31')],qs[_0xf40f('0x35')](_0x12f09d[_0xf40f('0x32')][_0xf40f('0x35')]));_0x3f1ffe[_0xf40f('0x34')]=_0x3f1ffe[_0xf40f('0x34')][_0xf40f('0x36')]?_0x3f1ffe[_0xf40f('0x34')]:_0x521e23[_0xf40f('0x31')];if(_0x12f09d[_0xf40f('0x32')][_0xf40f('0x41')]){_0x3f1ffe['include']=[{'all':!![]}];}_0x3f1ffe=_[_0xf40f('0x3f')]({},_0x3f1ffe,_0x12f09d[_0xf40f('0x40')]);return db['SquareRecording'][_0xf40f('0x49')](_0x3f1ffe)[_0xf40f('0x26')](handleEntityNotFound(_0x335b40,null))[_0xf40f('0x26')](respondWithResult(_0x335b40,null))[_0xf40f('0x45')](handleError(_0x335b40,null));};exports[_0xf40f('0x4a')]=function(_0x3161d7,_0x23597e){return db[_0xf40f('0x2d')]['create'](_0x3161d7['body'],{})[_0xf40f('0x26')](respondWithResult(_0x23597e,0xc9))[_0xf40f('0x45')](handleError(_0x23597e,null));};exports[_0xf40f('0x4b')]=function(_0x306b6b,_0x52c3ac){if(_0x306b6b['body']['id']){delete _0x306b6b[_0xf40f('0x4c')]['id'];}return db[_0xf40f('0x2d')]['find']({'where':{'id':_0x306b6b['params']['id']}})[_0xf40f('0x26')](handleEntityNotFound(_0x52c3ac,null))[_0xf40f('0x26')](saveUpdates(_0x306b6b[_0xf40f('0x4c')],null))['then'](respondWithResult(_0x52c3ac,null))[_0xf40f('0x45')](handleError(_0x52c3ac,null));};exports[_0xf40f('0x4d')]=function(_0x219a41,_0x453681,_0xd0fd0c){var _0x199750=require('../../components/encryptor');var _0x1979bd=![];var _0x423a40={};if(_0x219a41[_0xf40f('0x32')][_0xf40f('0x4e')]&&_0x219a41['query'][_0xf40f('0x4e')]===_0xf40f('0x4f')){_0x423a40[_0xf40f('0x4f')]=_0x219a41[_0xf40f('0x47')]['id'];}else{_0x423a40['id']=_0x219a41['params']['id'];}return db[_0xf40f('0x2d')][_0xf40f('0x49')]({'where':_0x423a40,'attributes':['id',_0xf40f('0x50'),'filename'],'raw':!![]})['then'](handleEntityNotFound(_0x453681,null))['then'](function(_0x4c878e){if(_0x4c878e){var _0xf6049a=_0x4c878e['savePath'];var _0x1ef6f4=util['format']('%s.cypher',_0xf6049a);if(fs[_0xf40f('0x51')](_0x1ef6f4)){_0x1979bd=!![];return _0x199750[_0xf40f('0x52')](_0x1ef6f4,_0xf6049a,config[_0xf40f('0x53')][_0xf40f('0x54')])[_0xf40f('0x26')](function(){return _0x4c878e;});}return _0x4c878e;}})[_0xf40f('0x26')](function(_0x5406f2){if(_0x5406f2){var _0x4e90fc=_0x5406f2['savePath'];if(!fs[_0xf40f('0x51')](_0x4e90fc)){throw new db[(_0xf40f('0x55'))][(_0xf40f('0x56'))]('SquareRecording\x20not\x20found');}if(_0x5406f2[_0xf40f('0x57')]){return _0x453681['download'](_0x4e90fc,_0x5406f2[_0xf40f('0x57')]+path[_0xf40f('0x58')](_0x4e90fc),function(){if(_0x1979bd){fs['unlink'](_0x4e90fc);}});}else{return _0x453681[_0xf40f('0x4d')](_0x4e90fc,function(_0x3a394b){if(_0x1979bd){fs[_0xf40f('0x59')](_0x4e90fc);}});}}})[_0xf40f('0x45')](function(_0x548b39){if(_0x548b39[_0xf40f('0x5a')]==='SquareRecording\x20not\x20found'){_0x453681[_0xf40f('0x1a')](0x194)[_0xf40f('0x2b')](_0xf40f('0x5b'));}else{return handleError(_0x453681,null);}});};exports[_0xf40f('0x27')]=function(_0x290a6b,_0x1ae0d1){return db[_0xf40f('0x2d')][_0xf40f('0x49')]({'where':{'id':_0x290a6b[_0xf40f('0x47')]['id']}})[_0xf40f('0x26')](function(_0x1d8453){if(_[_0xf40f('0x5c')](_0x1d8453)){throw new ReferenceError(_0xf40f('0x5d'));}return _0x1d8453;})[_0xf40f('0x26')](function(_0x37be76){var _0x1806ba=_0x37be76[_0xf40f('0x50')];logger[_0xf40f('0x5e')]('cancellazione\x20fisica\x20documento\x20%s',_0x1806ba);if(!_[_0xf40f('0x5c')](_0x37be76['savePath'])&&fs['existsSync'](_0x1806ba)){logger[_0xf40f('0x5e')](_0xf40f('0x5f')+_0x1806ba+_0xf40f('0x60'));fs[_0xf40f('0x61')](_0x1806ba);}_0x1806ba=_0x1806ba+_0xf40f('0x62');if(!_[_0xf40f('0x5c')](_0x37be76[_0xf40f('0x50')])&&fs[_0xf40f('0x51')](_0x1806ba)){logger[_0xf40f('0x5e')]('File:\x20\x22'+_0x1806ba+_0xf40f('0x60'));fs['unlinkSync'](_0x1806ba);}return _0x37be76;})[_0xf40f('0x26')](function(_0x132875){if(!_0x132875)throw new InternalError();return _0x132875['destroy']();})[_0xf40f('0x26')](function(){_0x1ae0d1[_0xf40f('0x1a')](0xcc)[_0xf40f('0x1b')]();})[_0xf40f('0x45')](handleError(_0x1ae0d1,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 4000f5b..938c895 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 _0xb5f3=['exports','define','SquareRecording','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./squareRecording.attributes'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0xb5f3,0x137));var _0x3b5f=function(_0x33c603,_0x6d0ce4){_0x33c603=_0x33c603-0x0;var _0xae96f4=_0xb5f3[_0x33c603];return _0xae96f4;};'use strict';var _=require(_0x3b5f('0x0'));var util=require(_0x3b5f('0x1'));var logger=require(_0x3b5f('0x2'))('api');var moment=require(_0x3b5f('0x3'));var BPromise=require(_0x3b5f('0x4'));var rp=require(_0x3b5f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3b5f('0x6'));var attributes=require(_0x3b5f('0x7'));module[_0x3b5f('0x8')]=function(_0x42d102,_0x55c7b4){return _0x42d102[_0x3b5f('0x9')](_0x3b5f('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacc6=['moment','request-promise','path','rimraf','./squareRecording.attributes','SquareRecording','lodash','util','../../config/logger','api'];(function(_0x22dc3f,_0x1dec7b){var _0x5ad774=function(_0x59b4b0){while(--_0x59b4b0){_0x22dc3f['push'](_0x22dc3f['shift']());}};_0x5ad774(++_0x1dec7b);}(_0xacc6,0x150));var _0x6acc=function(_0x3a7634,_0x2db384){_0x3a7634=_0x3a7634-0x0;var _0x23bbe9=_0xacc6[_0x3a7634];return _0x23bbe9;};'use strict';var _=require(_0x6acc('0x0'));var util=require(_0x6acc('0x1'));var logger=require(_0x6acc('0x2'))(_0x6acc('0x3'));var moment=require(_0x6acc('0x4'));var BPromise=require('bluebird');var rp=require(_0x6acc('0x5'));var fs=require('fs');var path=require(_0x6acc('0x6'));var rimraf=require(_0x6acc('0x7'));var config=require('../../config/environment');var attributes=require(_0x6acc('0x8'));module['exports']=function(_0xae1fa2,_0x1b97f1){return _0xae1fa2['define'](_0x6acc('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 cb6d103..9307cc5 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 _0x30a4=['catch','CreateSquareRecording','SquareRecording','create','body','raw','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x27a0a9,_0x1e7dd1){var _0x11cb3b=function(_0x5a9aa3){while(--_0x5a9aa3){_0x27a0a9['push'](_0x27a0a9['shift']());}};_0x11cb3b(++_0x1e7dd1);}(_0x30a4,0x8d));var _0x430a=function(_0x6c0123,_0x4c8d3b){_0x6c0123=_0x6c0123-0x0;var _0x5a87d2=_0x30a4[_0x6c0123];return _0x5a87d2;};'use strict';var _=require(_0x430a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x430a('0x1'));var rs=require(_0x430a('0x2'));var fs=require('fs');var Redis=require(_0x430a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x430a('0x4'));var logger=require(_0x430a('0x5'))(_0x430a('0x6'));var config=require(_0x430a('0x7'));var jayson=require(_0x430a('0x8'));var client=jayson[_0x430a('0x9')][_0x430a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x436e07,_0x56577d,_0x52f741){return new BPromise(function(_0x2dd418,_0x545f6a){return client['request'](_0x436e07,_0x52f741)[_0x430a('0xb')](function(_0x31ea87){logger[_0x430a('0xc')](_0x430a('0xd'),_0x56577d,_0x430a('0xe'));logger[_0x430a('0xf')](_0x430a('0x10'),_0x56577d,_0x430a('0xe'),JSON[_0x430a('0x11')](_0x31ea87));if(_0x31ea87[_0x430a('0x12')]){if(_0x31ea87['error'][_0x430a('0x13')]===0x1f4){logger['error'](_0x430a('0xd'),_0x56577d,_0x31ea87['error'][_0x430a('0x14')]);return _0x545f6a(_0x31ea87[_0x430a('0x12')]['message']);}logger[_0x430a('0x12')](_0x430a('0xd'),_0x56577d,_0x31ea87[_0x430a('0x12')]['message']);return _0x2dd418(_0x31ea87[_0x430a('0x12')][_0x430a('0x14')]);}else{logger[_0x430a('0xc')](_0x430a('0xd'),_0x56577d,_0x430a('0xe'));_0x2dd418(_0x31ea87['result'][_0x430a('0x14')]);}})[_0x430a('0x15')](function(_0x25d8d0){logger[_0x430a('0x12')](_0x430a('0xd'),_0x56577d,_0x25d8d0);_0x545f6a(_0x25d8d0);});});}exports[_0x430a('0x16')]=function(_0x317089){var _0xcf1353=this;return new Promise(function(_0x4f389d,_0x243449){return db[_0x430a('0x17')][_0x430a('0x18')](_0x317089[_0x430a('0x19')],{'raw':_0x317089['options']?_0x317089['options'][_0x430a('0x1a')]===undefined?!![]:![]:!![]})[_0x430a('0xb')](function(_0x46f40c){logger[_0x430a('0xc')](_0x430a('0x16'),_0x317089);logger['debug']('CreateSquareRecording',_0x317089,JSON[_0x430a('0x11')](_0x46f40c));_0x4f389d(_0x46f40c);})['catch'](function(_0x5f1ee5){logger[_0x430a('0x12')]('CreateSquareRecording',_0x5f1ee5[_0x430a('0x14')],_0x317089);_0x243449(_0xcf1353[_0x430a('0x12')](0x1f4,_0x5f1ee5['message']));});});}; \ No newline at end of file +var _0xccf3=['request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','CreateSquareRecording','create','body','options','raw','then','stringify','lodash','util','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','SquareRecording,\x20%s,\x20%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xccf3,0x147));var _0x3ccf=function(_0x453fbc,_0x21029e){_0x453fbc=_0x453fbc-0x0;var _0x57f6d6=_0xccf3[_0x453fbc];return _0x57f6d6;};'use strict';var _=require(_0x3ccf('0x0'));var util=require(_0x3ccf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ccf('0x2'));var db=require(_0x3ccf('0x3'))['db'];var utils=require(_0x3ccf('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3ccf('0x5'));var client=jayson[_0x3ccf('0x6')][_0x3ccf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5ae9e5,_0x20ca8a,_0x5596e9){return new BPromise(function(_0x50f49b,_0x56378a){return client['request'](_0x5ae9e5,_0x5596e9)['then'](function(_0x5102e1){logger['info'](_0x3ccf('0x8'),_0x20ca8a,_0x3ccf('0x9'));logger[_0x3ccf('0xa')](_0x3ccf('0xb'),_0x20ca8a,_0x3ccf('0x9'),JSON['stringify'](_0x5102e1));if(_0x5102e1[_0x3ccf('0xc')]){if(_0x5102e1['error'][_0x3ccf('0xd')]===0x1f4){logger[_0x3ccf('0xc')](_0x3ccf('0x8'),_0x20ca8a,_0x5102e1[_0x3ccf('0xc')]['message']);return _0x56378a(_0x5102e1[_0x3ccf('0xc')][_0x3ccf('0xe')]);}logger[_0x3ccf('0xc')]('SquareRecording,\x20%s,\x20%s',_0x20ca8a,_0x5102e1[_0x3ccf('0xc')][_0x3ccf('0xe')]);return _0x50f49b(_0x5102e1[_0x3ccf('0xc')][_0x3ccf('0xe')]);}else{logger[_0x3ccf('0xf')](_0x3ccf('0x8'),_0x20ca8a,_0x3ccf('0x9'));_0x50f49b(_0x5102e1['result'][_0x3ccf('0xe')]);}})[_0x3ccf('0x10')](function(_0x719f2c){logger['error']('SquareRecording,\x20%s,\x20%s',_0x20ca8a,_0x719f2c);_0x56378a(_0x719f2c);});});}exports[_0x3ccf('0x11')]=function(_0x262b67){var _0x8daa70=this;return new Promise(function(_0x2afbbb,_0x5c4835){return db['SquareRecording'][_0x3ccf('0x12')](_0x262b67[_0x3ccf('0x13')],{'raw':_0x262b67[_0x3ccf('0x14')]?_0x262b67[_0x3ccf('0x14')][_0x3ccf('0x15')]===undefined?!![]:![]:!![]})[_0x3ccf('0x16')](function(_0x47d800){logger[_0x3ccf('0xf')](_0x3ccf('0x11'),_0x262b67);logger[_0x3ccf('0xa')](_0x3ccf('0x11'),_0x262b67,JSON[_0x3ccf('0x17')](_0x47d800));_0x2afbbb(_0x47d800);})[_0x3ccf('0x10')](function(_0xe1234b){logger[_0x3ccf('0xc')](_0x3ccf('0x11'),_0xe1234b[_0x3ccf('0xe')],_0x262b67);_0x5c4835(_0x8daa70[_0x3ccf('0xc')](0x1f4,_0xe1234b[_0x3ccf('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index c64674b..a87689d 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(_0x593027,_0x1acbf6){var _0x2aa0be=function(_0x2f7215){while(--_0x2f7215){_0x593027['push'](_0x593027['shift']());}};_0x2aa0be(++_0x1acbf6);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x4b1d19,_0x3f29b7){var _0x2219a5=function(_0x3306d2){while(--_0x3306d2){_0x4b1d19['push'](_0x4b1d19['shift']());}};_0x2219a5(++_0x3f29b7);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index aa97c17..0f4bba1 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 _0x7074=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x7074,0xc4));var _0x4707=function(_0x482764,_0x5f2990){_0x482764=_0x482764-0x0;var _0xeb4850=_0x7074[_0x482764];return _0xeb4850;};'use strict';var Sequelize=require(_0x4707('0x0'));module[_0x4707('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x4707('0x2')]},'request':{'type':Sequelize[_0x4707('0x2')]},'channel':{'type':Sequelize[_0x4707('0x2')]},'language':{'type':Sequelize[_0x4707('0x2')]},'type':{'type':Sequelize[_0x4707('0x2')]},'uniqueid':{'type':Sequelize[_0x4707('0x2')]},'version':{'type':Sequelize[_0x4707('0x2')]},'callerid':{'type':Sequelize[_0x4707('0x2')]},'calleridname':{'type':Sequelize[_0x4707('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x4707('0x2')]},'callington':{'type':Sequelize[_0x4707('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x4707('0x2')]},'context':{'type':Sequelize[_0x4707('0x2')]},'extension':{'type':Sequelize[_0x4707('0x2')]},'priority':{'type':Sequelize[_0x4707('0x2')]},'enhanced':{'type':Sequelize[_0x4707('0x2')]},'accountcode':{'type':Sequelize[_0x4707('0x2')]},'threadid':{'type':Sequelize[_0x4707('0x2')]},'project_name':{'type':Sequelize[_0x4707('0x2')]},'joinAt':{'type':Sequelize[_0x4707('0x3')]},'leaveAt':{'type':Sequelize[_0x4707('0x3')]},'bot':{'type':Sequelize[_0x4707('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x7f1d=['sequelize','STRING','DATE','BOOLEAN'];(function(_0x9b06e8,_0x4aef8e){var _0x3447ba=function(_0x54b2d7){while(--_0x54b2d7){_0x9b06e8['push'](_0x9b06e8['shift']());}};_0x3447ba(++_0x4aef8e);}(_0x7f1d,0xe8));var _0xd7f1=function(_0x5ed54b,_0x3a2827){_0x5ed54b=_0x5ed54b-0x0;var _0x4b58c7=_0x7f1d[_0x5ed54b];return _0x4b58c7;};'use strict';var Sequelize=require(_0xd7f1('0x0'));module['exports']={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xd7f1('0x1')]},'request':{'type':Sequelize[_0xd7f1('0x1')]},'channel':{'type':Sequelize[_0xd7f1('0x1')]},'language':{'type':Sequelize[_0xd7f1('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd7f1('0x1')]},'version':{'type':Sequelize[_0xd7f1('0x1')]},'callerid':{'type':Sequelize[_0xd7f1('0x1')]},'calleridname':{'type':Sequelize[_0xd7f1('0x1')]},'callingpres':{'type':Sequelize[_0xd7f1('0x1')]},'callingani2':{'type':Sequelize[_0xd7f1('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xd7f1('0x1')]},'dnid':{'type':Sequelize[_0xd7f1('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd7f1('0x1')]},'extension':{'type':Sequelize[_0xd7f1('0x1')]},'priority':{'type':Sequelize[_0xd7f1('0x1')]},'enhanced':{'type':Sequelize[_0xd7f1('0x1')]},'accountcode':{'type':Sequelize[_0xd7f1('0x1')]},'threadid':{'type':Sequelize[_0xd7f1('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd7f1('0x2')]},'leaveAt':{'type':Sequelize[_0xd7f1('0x2')]},'bot':{'type':Sequelize[_0xd7f1('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 9830bb3..f4c1422 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 _0xc2b8=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','destroy','describe','rimraf','zip-dir','request-promise'];(function(_0x472261,_0x59123c){var _0x458209=function(_0x325dff){while(--_0x325dff){_0x472261['push'](_0x472261['shift']());}};_0x458209(++_0x59123c);}(_0xc2b8,0x1b9));var _0x8c2b=function(_0x4692a1,_0x41f54f){_0x4692a1=_0x4692a1-0x0;var _0x128700=_0xc2b8[_0x4692a1];return _0x128700;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c2b('0x0'));var zipdir=require(_0x8c2b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c2b('0x2'));var moment=require(_0x8c2b('0x3'));var BPromise=require(_0x8c2b('0x4'));var Mustache=require(_0x8c2b('0x5'));var util=require('util');var path=require(_0x8c2b('0x6'));var sox=require(_0x8c2b('0x7'));var csv=require('to-csv');var ejs=require(_0x8c2b('0x8'));var fs=require('fs');var fs_extra=require(_0x8c2b('0x9'));var _=require(_0x8c2b('0xa'));var squel=require(_0x8c2b('0xb'));var crypto=require(_0x8c2b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8c2b('0xd'));var querystring=require('querystring');var Papa=require(_0x8c2b('0xe'));var Redis=require('ioredis');var authService=require(_0x8c2b('0xf'));var qs=require(_0x8c2b('0x10'));var as=require(_0x8c2b('0x11'));var hardwareService=require(_0x8c2b('0x12'));var logger=require(_0x8c2b('0x13'))('api');var utils=require(_0x8c2b('0x14'));var config=require(_0x8c2b('0x15'));var licenseUtil=require(_0x8c2b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38c8f9,_0xe25935){_0xe25935=_0xe25935||0xcc;return function(_0x56f21b){if(_0x56f21b){return _0x38c8f9[_0x8c2b('0x17')](_0xe25935);}return _0x38c8f9[_0x8c2b('0x18')](_0xe25935)[_0x8c2b('0x19')]();};}function respondWithResult(_0x55fa90,_0x378d96){_0x378d96=_0x378d96||0xc8;return function(_0x4eebd4){if(_0x4eebd4){return _0x55fa90[_0x8c2b('0x18')](_0x378d96)[_0x8c2b('0x1a')](_0x4eebd4);}};}function respondWithFilteredResult(_0x28e56a,_0x5268b7){return function(_0x17f7dd){if(_0x17f7dd){var _0x14f44a=typeof _0x5268b7[_0x8c2b('0x1b')]===_0x8c2b('0x1c')&&typeof _0x5268b7[_0x8c2b('0x1d')]===_0x8c2b('0x1c');var _0xe7934c=_0x17f7dd[_0x8c2b('0x1e')];var _0x2762f4=_0x14f44a?0x0:_0x5268b7[_0x8c2b('0x1b')];var _0x25ef6a=_0x14f44a?_0x17f7dd['count']:_0x5268b7[_0x8c2b('0x1b')]+_0x5268b7[_0x8c2b('0x1d')];var _0x548d57;if(_0x25ef6a>=_0xe7934c){_0x25ef6a=_0xe7934c;_0x548d57=0xc8;}else{_0x548d57=0xce;}_0x28e56a[_0x8c2b('0x18')](_0x548d57);return _0x28e56a[_0x8c2b('0x1f')]('Content-Range',_0x2762f4+'-'+_0x25ef6a+'/'+_0xe7934c)[_0x8c2b('0x1a')](_0x17f7dd);}return null;};}function patchUpdates(_0x5306ee){return function(_0x449ac5){try{jsonpatch[_0x8c2b('0x20')](_0x449ac5,_0x5306ee,!![]);}catch(_0x3e21fa){return BPromise['reject'](_0x3e21fa);}return _0x449ac5[_0x8c2b('0x21')]();};}function saveUpdates(_0x37a151,_0x3193e4){return function(_0x3e95ab){if(_0x3e95ab){return _0x3e95ab['update'](_0x37a151)[_0x8c2b('0x22')](function(_0x1d20e3){return _0x1d20e3;});}return null;};}function removeEntity(_0xc67136,_0x4e4b1a){return function(_0x6d5c61){if(_0x6d5c61){return _0x6d5c61['destroy']()[_0x8c2b('0x22')](function(){_0xc67136[_0x8c2b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d8c6c,_0x8f6950){return function(_0x423d96){if(!_0x423d96){_0x4d8c6c[_0x8c2b('0x17')](0x194);}return _0x423d96;};}function handleError(_0x37d9dc,_0x8ae94c){_0x8ae94c=_0x8ae94c||0x1f4;return function(_0x5a1662){logger[_0x8c2b('0x23')](_0x5a1662[_0x8c2b('0x24')]);if(_0x5a1662[_0x8c2b('0x25')]){delete _0x5a1662[_0x8c2b('0x25')];}_0x37d9dc[_0x8c2b('0x18')](_0x8ae94c)[_0x8c2b('0x26')](_0x5a1662);};}exports[_0x8c2b('0x27')]=function(_0x355d97,_0x23d893){var _0x336619={},_0x585ada={},_0x3e6451={'count':0x0,'rows':[]};var _0x306a7a=_[_0x8c2b('0x28')](db[_0x8c2b('0x29')][_0x8c2b('0x2a')],function(_0x7e9b84){return{'name':_0x7e9b84[_0x8c2b('0x2b')],'type':_0x7e9b84['type']['key']};});_0x585ada[_0x8c2b('0x2c')]=_[_0x8c2b('0x28')](_0x306a7a,'name');_0x585ada[_0x8c2b('0x2d')]=_[_0x8c2b('0x2e')](_0x355d97[_0x8c2b('0x2d')]);_0x585ada[_0x8c2b('0x2f')]=_[_0x8c2b('0x30')](_0x585ada[_0x8c2b('0x2c')],_0x585ada[_0x8c2b('0x2d')]);_0x336619[_0x8c2b('0x31')]=_[_0x8c2b('0x30')](_0x585ada[_0x8c2b('0x2c')],qs[_0x8c2b('0x32')](_0x355d97['query']['fields']));_0x336619['attributes']=_0x336619['attributes'][_0x8c2b('0x33')]?_0x336619['attributes']:_0x585ada[_0x8c2b('0x2c')];if(!_0x355d97[_0x8c2b('0x2d')][_0x8c2b('0x34')](_0x8c2b('0x35'))){_0x336619[_0x8c2b('0x1d')]=qs[_0x8c2b('0x1d')](_0x355d97['query'][_0x8c2b('0x1d')]);_0x336619[_0x8c2b('0x1b')]=qs['offset'](_0x355d97[_0x8c2b('0x2d')][_0x8c2b('0x1b')]);}_0x336619[_0x8c2b('0x36')]=qs['sort'](_0x355d97['query']['sort']);_0x336619[_0x8c2b('0x37')]=qs[_0x8c2b('0x2f')](_[_0x8c2b('0x38')](_0x355d97[_0x8c2b('0x2d')],_0x585ada[_0x8c2b('0x2f')]),_0x306a7a);if(_0x355d97[_0x8c2b('0x2d')][_0x8c2b('0x39')]){_0x336619['where']=_['merge'](_0x336619['where'],{'$or':_[_0x8c2b('0x28')](_0x306a7a,function(_0x469976){if(_0x469976[_0x8c2b('0x3a')]!==_0x8c2b('0x3b')){var _0x29e84e={};_0x29e84e[_0x469976[_0x8c2b('0x25')]]={'$like':'%'+_0x355d97[_0x8c2b('0x2d')]['filter']+'%'};return _0x29e84e;}})});}_0x336619=_[_0x8c2b('0x3c')]({},_0x336619,_0x355d97[_0x8c2b('0x3d')]);var _0x411c04={'where':_0x336619[_0x8c2b('0x37')]};return db[_0x8c2b('0x29')][_0x8c2b('0x1e')](_0x411c04)['then'](function(_0x4d23a4){_0x3e6451[_0x8c2b('0x1e')]=_0x4d23a4;if(_0x355d97[_0x8c2b('0x2d')][_0x8c2b('0x3e')]){_0x336619[_0x8c2b('0x3f')]=[{'all':!![]}];}return db[_0x8c2b('0x29')][_0x8c2b('0x40')](_0x336619);})[_0x8c2b('0x22')](function(_0x39b7ea){_0x3e6451['rows']=_0x39b7ea;return _0x3e6451;})[_0x8c2b('0x22')](respondWithFilteredResult(_0x23d893,_0x336619))[_0x8c2b('0x41')](handleError(_0x23d893,null));};exports[_0x8c2b('0x42')]=function(_0x49d2c9,_0x6c6e2a){var _0x5a3573={'raw':!![],'where':{'id':_0x49d2c9['params']['id']}},_0x1ee70a={};_0x1ee70a[_0x8c2b('0x2c')]=_[_0x8c2b('0x2e')](db[_0x8c2b('0x29')]['rawAttributes']);_0x1ee70a[_0x8c2b('0x2d')]=_[_0x8c2b('0x2e')](_0x49d2c9[_0x8c2b('0x2d')]);_0x1ee70a[_0x8c2b('0x2f')]=_[_0x8c2b('0x30')](_0x1ee70a[_0x8c2b('0x2c')],_0x1ee70a[_0x8c2b('0x2d')]);_0x5a3573['attributes']=_['intersection'](_0x1ee70a['model'],qs[_0x8c2b('0x32')](_0x49d2c9[_0x8c2b('0x2d')]['fields']));_0x5a3573[_0x8c2b('0x31')]=_0x5a3573['attributes'][_0x8c2b('0x33')]?_0x5a3573['attributes']:_0x1ee70a[_0x8c2b('0x2c')];if(_0x49d2c9['query'][_0x8c2b('0x3e')]){_0x5a3573[_0x8c2b('0x3f')]=[{'all':!![]}];}_0x5a3573=_['merge']({},_0x5a3573,_0x49d2c9['options']);return db[_0x8c2b('0x29')][_0x8c2b('0x43')](_0x5a3573)[_0x8c2b('0x22')](handleEntityNotFound(_0x6c6e2a,null))[_0x8c2b('0x22')](respondWithResult(_0x6c6e2a,null))[_0x8c2b('0x41')](handleError(_0x6c6e2a,null));};exports[_0x8c2b('0x44')]=function(_0x75c1,_0x4c0f01){return db[_0x8c2b('0x29')][_0x8c2b('0x44')](_0x75c1['body'],{})['then'](respondWithResult(_0x4c0f01,0xc9))[_0x8c2b('0x41')](handleError(_0x4c0f01,null));};exports[_0x8c2b('0x45')]=function(_0x5a73de,_0x1edc39){if(_0x5a73de[_0x8c2b('0x46')]['id']){delete _0x5a73de['body']['id'];}return db[_0x8c2b('0x29')][_0x8c2b('0x43')]({'where':{'id':_0x5a73de[_0x8c2b('0x47')]['id']}})[_0x8c2b('0x22')](handleEntityNotFound(_0x1edc39,null))[_0x8c2b('0x22')](saveUpdates(_0x5a73de[_0x8c2b('0x46')],null))[_0x8c2b('0x22')](respondWithResult(_0x1edc39,null))['catch'](handleError(_0x1edc39,null));};exports[_0x8c2b('0x48')]=function(_0x2d137a,_0x50af17){return db[_0x8c2b('0x29')]['find']({'where':{'id':_0x2d137a[_0x8c2b('0x47')]['id']}})[_0x8c2b('0x22')](handleEntityNotFound(_0x50af17,null))[_0x8c2b('0x22')](removeEntity(_0x50af17,null))[_0x8c2b('0x41')](handleError(_0x50af17,null));};exports['describe']=function(_0x43c27a,_0x153d1f){return db[_0x8c2b('0x29')][_0x8c2b('0x49')]()['then'](respondWithResult(_0x153d1f,null))[_0x8c2b('0x41')](handleError(_0x153d1f,null));}; \ No newline at end of file +var _0x33d2=['undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x33d2,0x155));var _0x233d=function(_0xeef94c,_0x1db3f7){_0xeef94c=_0xeef94c-0x0;var _0x447522=_0x33d2[_0xeef94c];return _0x447522;};'use strict';var emlformat=require(_0x233d('0x0'));var rimraf=require(_0x233d('0x1'));var zipdir=require(_0x233d('0x2'));var jsonpatch=require(_0x233d('0x3'));var rp=require('request-promise');var moment=require(_0x233d('0x4'));var BPromise=require(_0x233d('0x5'));var Mustache=require(_0x233d('0x6'));var util=require(_0x233d('0x7'));var path=require(_0x233d('0x8'));var sox=require('sox');var csv=require(_0x233d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x233d('0xa'));var crypto=require(_0x233d('0xb'));var jsforce=require(_0x233d('0xc'));var deskjs=require(_0x233d('0xd'));var toCsv=require(_0x233d('0x9'));var querystring=require(_0x233d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x233d('0xf'));var qs=require(_0x233d('0x10'));var as=require(_0x233d('0x11'));var hardwareService=require(_0x233d('0x12'));var logger=require(_0x233d('0x13'))('api');var utils=require(_0x233d('0x14'));var config=require(_0x233d('0x15'));var licenseUtil=require(_0x233d('0x16'));var db=require(_0x233d('0x17'))['db'];function respondWithStatusCode(_0x52ea87,_0x3a4f5d){_0x3a4f5d=_0x3a4f5d||0xcc;return function(_0x18691f){if(_0x18691f){return _0x52ea87[_0x233d('0x18')](_0x3a4f5d);}return _0x52ea87['status'](_0x3a4f5d)[_0x233d('0x19')]();};}function respondWithResult(_0x4f0ace,_0x55eeef){_0x55eeef=_0x55eeef||0xc8;return function(_0x211d7a){if(_0x211d7a){return _0x4f0ace[_0x233d('0x1a')](_0x55eeef)[_0x233d('0x1b')](_0x211d7a);}};}function respondWithFilteredResult(_0x377438,_0x1dc50e){return function(_0x5be9c7){if(_0x5be9c7){var _0x3c5eae=typeof _0x1dc50e[_0x233d('0x1c')]===_0x233d('0x1d')&&typeof _0x1dc50e[_0x233d('0x1e')]===_0x233d('0x1d');var _0x35fc4a=_0x5be9c7[_0x233d('0x1f')];var _0x5d5f30=_0x3c5eae?0x0:_0x1dc50e[_0x233d('0x1c')];var _0x9ac97d=_0x3c5eae?_0x5be9c7['count']:_0x1dc50e[_0x233d('0x1c')]+_0x1dc50e[_0x233d('0x1e')];var _0x115e26;if(_0x9ac97d>=_0x35fc4a){_0x9ac97d=_0x35fc4a;_0x115e26=0xc8;}else{_0x115e26=0xce;}_0x377438[_0x233d('0x1a')](_0x115e26);return _0x377438['set'](_0x233d('0x20'),_0x5d5f30+'-'+_0x9ac97d+'/'+_0x35fc4a)['json'](_0x5be9c7);}return null;};}function patchUpdates(_0x2f71a4){return function(_0x242271){try{jsonpatch['apply'](_0x242271,_0x2f71a4,!![]);}catch(_0x172071){return BPromise['reject'](_0x172071);}return _0x242271[_0x233d('0x21')]();};}function saveUpdates(_0xc5984a,_0x3e13b7){return function(_0x16dc6b){if(_0x16dc6b){return _0x16dc6b[_0x233d('0x22')](_0xc5984a)[_0x233d('0x23')](function(_0x52bbf1){return _0x52bbf1;});}return null;};}function removeEntity(_0x3726ff,_0x4c8ea3){return function(_0x15a67b){if(_0x15a67b){return _0x15a67b[_0x233d('0x24')]()[_0x233d('0x23')](function(){_0x3726ff[_0x233d('0x1a')](0xcc)[_0x233d('0x19')]();});}};}function handleEntityNotFound(_0x50e35b,_0xe0ba9d){return function(_0x3d9434){if(!_0x3d9434){_0x50e35b[_0x233d('0x18')](0x194);}return _0x3d9434;};}function handleError(_0x173211,_0xafc8d3){_0xafc8d3=_0xafc8d3||0x1f4;return function(_0x13cedf){logger[_0x233d('0x25')](_0x13cedf[_0x233d('0x26')]);if(_0x13cedf[_0x233d('0x27')]){delete _0x13cedf[_0x233d('0x27')];}_0x173211['status'](_0xafc8d3)['send'](_0x13cedf);};}exports[_0x233d('0x28')]=function(_0x2bba3d,_0x435b59){var _0xea000={},_0x577aac={},_0x42dcdc={'count':0x0,'rows':[]};var _0x395be3=_[_0x233d('0x29')](db[_0x233d('0x2a')][_0x233d('0x2b')],function(_0x3c5776){return{'name':_0x3c5776[_0x233d('0x2c')],'type':_0x3c5776[_0x233d('0x2d')]['key']};});_0x577aac['model']=_[_0x233d('0x29')](_0x395be3,_0x233d('0x27'));_0x577aac[_0x233d('0x2e')]=_[_0x233d('0x2f')](_0x2bba3d[_0x233d('0x2e')]);_0x577aac[_0x233d('0x30')]=_[_0x233d('0x31')](_0x577aac[_0x233d('0x32')],_0x577aac[_0x233d('0x2e')]);_0xea000[_0x233d('0x33')]=_['intersection'](_0x577aac['model'],qs[_0x233d('0x34')](_0x2bba3d[_0x233d('0x2e')][_0x233d('0x34')]));_0xea000[_0x233d('0x33')]=_0xea000[_0x233d('0x33')][_0x233d('0x35')]?_0xea000[_0x233d('0x33')]:_0x577aac[_0x233d('0x32')];if(!_0x2bba3d[_0x233d('0x2e')][_0x233d('0x36')](_0x233d('0x37'))){_0xea000['limit']=qs[_0x233d('0x1e')](_0x2bba3d[_0x233d('0x2e')]['limit']);_0xea000[_0x233d('0x1c')]=qs['offset'](_0x2bba3d[_0x233d('0x2e')][_0x233d('0x1c')]);}_0xea000[_0x233d('0x38')]=qs[_0x233d('0x39')](_0x2bba3d[_0x233d('0x2e')][_0x233d('0x39')]);_0xea000[_0x233d('0x3a')]=qs[_0x233d('0x30')](_[_0x233d('0x3b')](_0x2bba3d[_0x233d('0x2e')],_0x577aac['filters']),_0x395be3);if(_0x2bba3d['query'][_0x233d('0x3c')]){_0xea000[_0x233d('0x3a')]=_[_0x233d('0x3d')](_0xea000[_0x233d('0x3a')],{'$or':_['map'](_0x395be3,function(_0x2d4241){if(_0x2d4241['type']!==_0x233d('0x3e')){var _0x5aa3d9={};_0x5aa3d9[_0x2d4241[_0x233d('0x27')]]={'$like':'%'+_0x2bba3d[_0x233d('0x2e')]['filter']+'%'};return _0x5aa3d9;}})});}_0xea000=_[_0x233d('0x3d')]({},_0xea000,_0x2bba3d[_0x233d('0x3f')]);var _0x251e7d={'where':_0xea000[_0x233d('0x3a')]};return db[_0x233d('0x2a')]['count'](_0x251e7d)['then'](function(_0x5b7499){_0x42dcdc[_0x233d('0x1f')]=_0x5b7499;if(_0x2bba3d['query']['includeAll']){_0xea000[_0x233d('0x40')]=[{'all':!![]}];}return db[_0x233d('0x2a')][_0x233d('0x41')](_0xea000);})[_0x233d('0x23')](function(_0x87791e){_0x42dcdc[_0x233d('0x42')]=_0x87791e;return _0x42dcdc;})[_0x233d('0x23')](respondWithFilteredResult(_0x435b59,_0xea000))['catch'](handleError(_0x435b59,null));};exports['show']=function(_0x260d13,_0x212627){var _0x5dbc24={'raw':!![],'where':{'id':_0x260d13[_0x233d('0x43')]['id']}},_0xee6ea1={};_0xee6ea1[_0x233d('0x32')]=_['keys'](db['SquareReport'][_0x233d('0x2b')]);_0xee6ea1[_0x233d('0x2e')]=_[_0x233d('0x2f')](_0x260d13['query']);_0xee6ea1['filters']=_['intersection'](_0xee6ea1[_0x233d('0x32')],_0xee6ea1['query']);_0x5dbc24[_0x233d('0x33')]=_['intersection'](_0xee6ea1[_0x233d('0x32')],qs[_0x233d('0x34')](_0x260d13[_0x233d('0x2e')][_0x233d('0x34')]));_0x5dbc24['attributes']=_0x5dbc24[_0x233d('0x33')]['length']?_0x5dbc24[_0x233d('0x33')]:_0xee6ea1[_0x233d('0x32')];if(_0x260d13[_0x233d('0x2e')][_0x233d('0x44')]){_0x5dbc24[_0x233d('0x40')]=[{'all':!![]}];}_0x5dbc24=_[_0x233d('0x3d')]({},_0x5dbc24,_0x260d13['options']);return db[_0x233d('0x2a')][_0x233d('0x45')](_0x5dbc24)['then'](handleEntityNotFound(_0x212627,null))[_0x233d('0x23')](respondWithResult(_0x212627,null))[_0x233d('0x46')](handleError(_0x212627,null));};exports['create']=function(_0x575566,_0x397455){return db[_0x233d('0x2a')][_0x233d('0x47')](_0x575566[_0x233d('0x48')],{})['then'](respondWithResult(_0x397455,0xc9))['catch'](handleError(_0x397455,null));};exports[_0x233d('0x22')]=function(_0x5e9ccc,_0x2b524b){if(_0x5e9ccc['body']['id']){delete _0x5e9ccc[_0x233d('0x48')]['id'];}return db[_0x233d('0x2a')][_0x233d('0x45')]({'where':{'id':_0x5e9ccc[_0x233d('0x43')]['id']}})[_0x233d('0x23')](handleEntityNotFound(_0x2b524b,null))['then'](saveUpdates(_0x5e9ccc[_0x233d('0x48')],null))[_0x233d('0x23')](respondWithResult(_0x2b524b,null))[_0x233d('0x46')](handleError(_0x2b524b,null));};exports[_0x233d('0x24')]=function(_0x494254,_0x5caf14){return db[_0x233d('0x2a')]['find']({'where':{'id':_0x494254['params']['id']}})['then'](handleEntityNotFound(_0x5caf14,null))[_0x233d('0x23')](removeEntity(_0x5caf14,null))['catch'](handleError(_0x5caf14,null));};exports['describe']=function(_0x966577,_0x23694b){return db[_0x233d('0x2a')][_0x233d('0x49')]()[_0x233d('0x23')](respondWithResult(_0x23694b,null))[_0x233d('0x46')](handleError(_0x23694b,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 7084e9b..51ae1cd 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 _0x78c1=['rimraf','../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','project_name','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x33fbca,_0x28c388){var _0x457e8e=function(_0x45eb8f){while(--_0x45eb8f){_0x33fbca['push'](_0x33fbca['shift']());}};_0x457e8e(++_0x28c388);}(_0x78c1,0x125));var _0x178c=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x78c1[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x178c('0x0'));var util=require(_0x178c('0x1'));var logger=require(_0x178c('0x2'))(_0x178c('0x3'));var moment=require(_0x178c('0x4'));var BPromise=require(_0x178c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x178c('0x6'));var rimraf=require(_0x178c('0x7'));var config=require(_0x178c('0x8'));var attributes=require(_0x178c('0x9'));module[_0x178c('0xa')]=function(_0x7cb4b8,_0x589196){return _0x7cb4b8[_0x178c('0xb')]('SquareReport',attributes,{'tableName':_0x178c('0xc'),'paranoid':![],'indexes':[{'name':_0x178c('0xd'),'fields':['uniqueid',_0x178c('0xe')]},{'name':'leaveAt','fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8e33=['uid_pname','uniqueid','leaveAt','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport'];(function(_0x4da407,_0x4ec60a){var _0x4ed463=function(_0x476d7c){while(--_0x476d7c){_0x4da407['push'](_0x4da407['shift']());}};_0x4ed463(++_0x4ec60a);}(_0x8e33,0xb7));var _0x38e3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x8e33[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x38e3('0x0'))(_0x38e3('0x1'));var moment=require(_0x38e3('0x2'));var BPromise=require(_0x38e3('0x3'));var rp=require(_0x38e3('0x4'));var fs=require('fs');var path=require(_0x38e3('0x5'));var rimraf=require(_0x38e3('0x6'));var config=require(_0x38e3('0x7'));var attributes=require(_0x38e3('0x8'));module[_0x38e3('0x9')]=function(_0x434e47,_0x373ca0){return _0x434e47[_0x38e3('0xa')](_0x38e3('0xb'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x38e3('0xc'),'fields':[_0x38e3('0xd'),'project_name']},{'name':_0x38e3('0xe'),'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 0823cc9..e4ea272 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 _0x4f33=['code','SquareReport,\x20%s,\x20%s','message','info','catch','body','options','raw','CreateSquareReport','stringify','UpdateSquareReport','SquareReport','update','where','attributes','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','error'];(function(_0xfcbcb8,_0x35bf6b){var _0x1b1f97=function(_0x51e11d){while(--_0x51e11d){_0xfcbcb8['push'](_0xfcbcb8['shift']());}};_0x1b1f97(++_0x35bf6b);}(_0x4f33,0x6c));var _0x34f3=function(_0x2a0738,_0x3c0bc5){_0x2a0738=_0x2a0738-0x0;var _0x159679=_0x4f33[_0x2a0738];return _0x159679;};'use strict';var _=require(_0x34f3('0x0'));var util=require(_0x34f3('0x1'));var moment=require(_0x34f3('0x2'));var BPromise=require('bluebird');var rs=require(_0x34f3('0x3'));var fs=require('fs');var Redis=require(_0x34f3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34f3('0x5'));var logger=require(_0x34f3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x34f3('0x7'));var client=jayson[_0x34f3('0x8')][_0x34f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40c13b,_0x23c1cc,_0x302317){return new BPromise(function(_0x49fcba,_0x4ddff0){return client[_0x34f3('0xa')](_0x40c13b,_0x302317)[_0x34f3('0xb')](function(_0x529ab9){logger['info']('SquareReport,\x20%s,\x20%s',_0x23c1cc,_0x34f3('0xc'));logger[_0x34f3('0xd')](_0x34f3('0xe'),_0x23c1cc,_0x34f3('0xc'),JSON['stringify'](_0x529ab9));if(_0x529ab9[_0x34f3('0xf')]){if(_0x529ab9[_0x34f3('0xf')][_0x34f3('0x10')]===0x1f4){logger[_0x34f3('0xf')](_0x34f3('0x11'),_0x23c1cc,_0x529ab9[_0x34f3('0xf')][_0x34f3('0x12')]);return _0x4ddff0(_0x529ab9[_0x34f3('0xf')]['message']);}logger[_0x34f3('0xf')]('SquareReport,\x20%s,\x20%s',_0x23c1cc,_0x529ab9[_0x34f3('0xf')][_0x34f3('0x12')]);return _0x49fcba(_0x529ab9[_0x34f3('0xf')][_0x34f3('0x12')]);}else{logger[_0x34f3('0x13')](_0x34f3('0x11'),_0x23c1cc,_0x34f3('0xc'));_0x49fcba(_0x529ab9['result'][_0x34f3('0x12')]);}})[_0x34f3('0x14')](function(_0x25026d){logger['error'](_0x34f3('0x11'),_0x23c1cc,_0x25026d);_0x4ddff0(_0x25026d);});});}exports['CreateSquareReport']=function(_0x2d550d){var _0x4e0610=this;return new Promise(function(_0xb9e947,_0x27e1ec){return db['SquareReport']['create'](_0x2d550d[_0x34f3('0x15')],{'raw':_0x2d550d[_0x34f3('0x16')]?_0x2d550d[_0x34f3('0x16')][_0x34f3('0x17')]===undefined?!![]:![]:!![]})[_0x34f3('0xb')](function(_0xcef7a8){logger[_0x34f3('0x13')](_0x34f3('0x18'),_0x2d550d);logger[_0x34f3('0xd')]('CreateSquareReport',_0x2d550d,JSON[_0x34f3('0x19')](_0xcef7a8));_0xb9e947(_0xcef7a8);})[_0x34f3('0x14')](function(_0x14c3f0){logger[_0x34f3('0xf')](_0x34f3('0x18'),_0x14c3f0[_0x34f3('0x12')],_0x2d550d);_0x27e1ec(_0x4e0610[_0x34f3('0xf')](0x1f4,_0x14c3f0['message']));});});};exports[_0x34f3('0x1a')]=function(_0x2c64d2){var _0x88bb83=this;return new Promise(function(_0x20fbf5,_0xefea84){return db[_0x34f3('0x1b')][_0x34f3('0x1c')](_0x2c64d2['body'],{'raw':_0x2c64d2[_0x34f3('0x16')]?_0x2c64d2['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c64d2[_0x34f3('0x16')]?_0x2c64d2[_0x34f3('0x16')][_0x34f3('0x1d')]||null:null,'attributes':_0x2c64d2[_0x34f3('0x16')]?_0x2c64d2[_0x34f3('0x16')][_0x34f3('0x1e')]||null:null,'limit':_0x2c64d2['options']?_0x2c64d2['options']['limit']||null:null})['then'](function(_0x4cc216){logger[_0x34f3('0x13')](_0x34f3('0x1a'),_0x2c64d2);logger['debug']('UpdateSquareReport',_0x2c64d2,JSON[_0x34f3('0x19')](_0x4cc216));_0x20fbf5(_0x4cc216);})[_0x34f3('0x14')](function(_0x15e28d){logger['error'](_0x34f3('0x1a'),_0x15e28d[_0x34f3('0x12')],_0x2c64d2);_0xefea84(_0x88bb83['error'](0x1f4,_0x15e28d['message']));});});}; \ No newline at end of file +var _0x0bed=['catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','update','where','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x389ca2,_0x29e579){var _0x45de57=function(_0x2f8d83){while(--_0x2f8d83){_0x389ca2['push'](_0x389ca2['shift']());}};_0x45de57(++_0x29e579);}(_0x0bed,0x16a));var _0xd0be=function(_0x3348b6,_0x3d52bb){_0x3348b6=_0x3348b6-0x0;var _0x167547=_0x0bed[_0x3348b6];return _0x167547;};'use strict';var _=require(_0xd0be('0x0'));var util=require('util');var moment=require(_0xd0be('0x1'));var BPromise=require('bluebird');var rs=require(_0xd0be('0x2'));var fs=require('fs');var Redis=require(_0xd0be('0x3'));var db=require(_0xd0be('0x4'))['db'];var utils=require(_0xd0be('0x5'));var logger=require(_0xd0be('0x6'))(_0xd0be('0x7'));var config=require(_0xd0be('0x8'));var jayson=require(_0xd0be('0x9'));var client=jayson[_0xd0be('0xa')][_0xd0be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13163d,_0x5deccb,_0x5655a6){return new BPromise(function(_0x5c165a,_0x5cbf3a){return client[_0xd0be('0xc')](_0x13163d,_0x5655a6)[_0xd0be('0xd')](function(_0x478fb5){logger[_0xd0be('0xe')](_0xd0be('0xf'),_0x5deccb,_0xd0be('0x10'));logger[_0xd0be('0x11')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x5deccb,_0xd0be('0x10'),JSON[_0xd0be('0x12')](_0x478fb5));if(_0x478fb5['error']){if(_0x478fb5[_0xd0be('0x13')][_0xd0be('0x14')]===0x1f4){logger[_0xd0be('0x13')]('SquareReport,\x20%s,\x20%s',_0x5deccb,_0x478fb5[_0xd0be('0x13')][_0xd0be('0x15')]);return _0x5cbf3a(_0x478fb5[_0xd0be('0x13')][_0xd0be('0x15')]);}logger['error'](_0xd0be('0xf'),_0x5deccb,_0x478fb5[_0xd0be('0x13')]['message']);return _0x5c165a(_0x478fb5['error'][_0xd0be('0x15')]);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x5deccb,_0xd0be('0x10'));_0x5c165a(_0x478fb5['result'][_0xd0be('0x15')]);}})[_0xd0be('0x16')](function(_0x517e14){logger[_0xd0be('0x13')]('SquareReport,\x20%s,\x20%s',_0x5deccb,_0x517e14);_0x5cbf3a(_0x517e14);});});}exports[_0xd0be('0x17')]=function(_0x21b630){var _0x14fad1=this;return new Promise(function(_0xd73cb0,_0x5ea1ba){return db['SquareReport'][_0xd0be('0x18')](_0x21b630[_0xd0be('0x19')],{'raw':_0x21b630[_0xd0be('0x1a')]?_0x21b630['options'][_0xd0be('0x1b')]===undefined?!![]:![]:!![]})[_0xd0be('0xd')](function(_0x1ee8af){logger[_0xd0be('0xe')](_0xd0be('0x17'),_0x21b630);logger[_0xd0be('0x11')]('CreateSquareReport',_0x21b630,JSON[_0xd0be('0x12')](_0x1ee8af));_0xd73cb0(_0x1ee8af);})[_0xd0be('0x16')](function(_0xe5a450){logger[_0xd0be('0x13')](_0xd0be('0x17'),_0xe5a450[_0xd0be('0x15')],_0x21b630);_0x5ea1ba(_0x14fad1[_0xd0be('0x13')](0x1f4,_0xe5a450[_0xd0be('0x15')]));});});};exports[_0xd0be('0x1c')]=function(_0x1f5d11){var _0x244ff1=this;return new Promise(function(_0x1433d3,_0x1a82a8){return db['SquareReport'][_0xd0be('0x1d')](_0x1f5d11[_0xd0be('0x19')],{'raw':_0x1f5d11[_0xd0be('0x1a')]?_0x1f5d11['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f5d11[_0xd0be('0x1a')]?_0x1f5d11[_0xd0be('0x1a')][_0xd0be('0x1e')]||null:null,'attributes':_0x1f5d11[_0xd0be('0x1a')]?_0x1f5d11[_0xd0be('0x1a')]['attributes']||null:null,'limit':_0x1f5d11[_0xd0be('0x1a')]?_0x1f5d11['options'][_0xd0be('0x1f')]||null:null})['then'](function(_0x11cfdf){logger['info']('UpdateSquareReport',_0x1f5d11);logger['debug'](_0xd0be('0x1c'),_0x1f5d11,JSON[_0xd0be('0x12')](_0x11cfdf));_0x1433d3(_0x11cfdf);})['catch'](function(_0x45c1ae){logger[_0xd0be('0x13')](_0xd0be('0x1c'),_0x45c1ae[_0xd0be('0x15')],_0x1f5d11);_0x1a82a8(_0x244ff1['error'](0x1f4,_0x45c1ae[_0xd0be('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index e029cbb..6f7888e 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 _0x54a9=['/:id','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','show','create','put','update','delete'];(function(_0x294d96,_0x2a7812){var _0x5ceb37=function(_0x420697){while(--_0x420697){_0x294d96['push'](_0x294d96['shift']());}};_0x5ceb37(++_0x2a7812);}(_0x54a9,0x9d));var _0x954a=function(_0x18dbdc,_0x24ca3a){_0x18dbdc=_0x18dbdc-0x0;var _0x2799d2=_0x54a9[_0x18dbdc];return _0x2799d2;};'use strict';var multer=require(_0x954a('0x0'));var util=require('util');var path=require(_0x954a('0x1'));var timeout=require('connect-timeout');var express=require(_0x954a('0x2'));var router=express[_0x954a('0x3')]();var fs_extra=require(_0x954a('0x4'));var auth=require(_0x954a('0x5'));var interaction=require(_0x954a('0x6'));var config=require(_0x954a('0x7'));var controller=require(_0x954a('0x8'));router[_0x954a('0x9')]('/',auth[_0x954a('0xa')](),controller[_0x954a('0xb')]);router['get'](_0x954a('0xc'),auth[_0x954a('0xa')](),controller[_0x954a('0xd')]);router[_0x954a('0x9')]('/:id',auth[_0x954a('0xa')](),controller[_0x954a('0xe')]);router['post']('/',auth[_0x954a('0xa')](),controller[_0x954a('0xf')]);router[_0x954a('0x10')]('/:id',auth[_0x954a('0xa')](),controller[_0x954a('0x11')]);router[_0x954a('0x12')](_0x954a('0x13'),auth[_0x954a('0xa')](),controller[_0x954a('0x14')]);module[_0x954a('0x15')]=router; \ No newline at end of file +var _0x3346=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareReportDetail.controller','get','index','isAuthenticated','describe','/:id','show','post','put','update','delete'];(function(_0xafca9f,_0x18165b){var _0x172220=function(_0x5b1360){while(--_0x5b1360){_0xafca9f['push'](_0xafca9f['shift']());}};_0x172220(++_0x18165b);}(_0x3346,0x1a6));var _0x6334=function(_0x33b620,_0x2856ed){_0x33b620=_0x33b620-0x0;var _0x5302d2=_0x3346[_0x33b620];return _0x5302d2;};'use strict';var multer=require(_0x6334('0x0'));var util=require(_0x6334('0x1'));var path=require(_0x6334('0x2'));var timeout=require(_0x6334('0x3'));var express=require(_0x6334('0x4'));var router=express[_0x6334('0x5')]();var fs_extra=require(_0x6334('0x6'));var auth=require(_0x6334('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6334('0x8'));router[_0x6334('0x9')]('/',auth['isAuthenticated'](),controller[_0x6334('0xa')]);router['get']('/describe',auth[_0x6334('0xb')](),controller[_0x6334('0xc')]);router[_0x6334('0x9')](_0x6334('0xd'),auth[_0x6334('0xb')](),controller[_0x6334('0xe')]);router[_0x6334('0xf')]('/',auth[_0x6334('0xb')](),controller['create']);router[_0x6334('0x10')](_0x6334('0xd'),auth[_0x6334('0xb')](),controller[_0x6334('0x11')]);router[_0x6334('0x12')](_0x6334('0xd'),auth[_0x6334('0xb')](),controller[_0x6334('0x13')]);module[_0x6334('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 60c4112..015d169 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 _0x2401=['TEXT','sequelize','exports','STRING'];(function(_0x20834a,_0x471f90){var _0x33da2d=function(_0x22a346){while(--_0x22a346){_0x20834a['push'](_0x20834a['shift']());}};_0x33da2d(++_0x471f90);}(_0x2401,0x85));var _0x1240=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2401[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x1240('0x0'));module[_0x1240('0x1')]={'uniqueid':{'type':Sequelize[_0x1240('0x2')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize[_0x1240('0x2')]},'data':{'type':Sequelize[_0x1240('0x3')]},'project_name':{'type':Sequelize[_0x1240('0x2')]},'callerid':{'type':Sequelize[_0x1240('0x2')]}}; \ No newline at end of file +var _0x7211=['STRING','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7211,0x123));var _0x1721=function(_0x227f71,_0x4b8a7d){_0x227f71=_0x227f71-0x0;var _0x2aeb82=_0x7211[_0x227f71];return _0x2aeb82;};'use strict';var Sequelize=require('sequelize');module[_0x1721('0x0')]={'uniqueid':{'type':Sequelize[_0x1721('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x1721('0x1')]},'callerid':{'type':Sequelize[_0x1721('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a13759c..678497d 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 _0x2e87=['../../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','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','fields','length','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0x246987,_0x46fcbb){var _0x1e1142=function(_0x54aba1){while(--_0x54aba1){_0x246987['push'](_0x246987['shift']());}};_0x1e1142(++_0x46fcbb);}(_0x2e87,0x171));var _0x72e8=function(_0x36b400,_0x277ec5){_0x36b400=_0x36b400-0x0;var _0x4d47bf=_0x2e87[_0x36b400];return _0x4d47bf;};'use strict';var emlformat=require(_0x72e8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72e8('0x1'));var jsonpatch=require(_0x72e8('0x2'));var rp=require(_0x72e8('0x3'));var moment=require(_0x72e8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x72e8('0x5'));var path=require(_0x72e8('0x6'));var sox=require('sox');var csv=require(_0x72e8('0x7'));var ejs=require(_0x72e8('0x8'));var fs=require('fs');var fs_extra=require(_0x72e8('0x9'));var _=require('lodash');var squel=require(_0x72e8('0xa'));var crypto=require('crypto');var jsforce=require(_0x72e8('0xb'));var deskjs=require(_0x72e8('0xc'));var toCsv=require(_0x72e8('0x7'));var querystring=require(_0x72e8('0xd'));var Papa=require('papaparse');var Redis=require(_0x72e8('0xe'));var authService=require(_0x72e8('0xf'));var qs=require(_0x72e8('0x10'));var as=require(_0x72e8('0x11'));var hardwareService=require(_0x72e8('0x12'));var logger=require(_0x72e8('0x13'))(_0x72e8('0x14'));var utils=require(_0x72e8('0x15'));var config=require(_0x72e8('0x16'));var licenseUtil=require(_0x72e8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x34393e,_0x13bda6){_0x13bda6=_0x13bda6||0xcc;return function(_0x5c1901){if(_0x5c1901){return _0x34393e[_0x72e8('0x18')](_0x13bda6);}return _0x34393e[_0x72e8('0x19')](_0x13bda6)[_0x72e8('0x1a')]();};}function respondWithResult(_0x10aa0d,_0x47d975){_0x47d975=_0x47d975||0xc8;return function(_0x136062){if(_0x136062){return _0x10aa0d[_0x72e8('0x19')](_0x47d975)[_0x72e8('0x1b')](_0x136062);}};}function respondWithFilteredResult(_0x502f11,_0x3e3b35){return function(_0x4cb4ac){if(_0x4cb4ac){var _0x1b3914=typeof _0x3e3b35[_0x72e8('0x1c')]===_0x72e8('0x1d')&&typeof _0x3e3b35['limit']===_0x72e8('0x1d');var _0x42680c=_0x4cb4ac[_0x72e8('0x1e')];var _0x40ddb7=_0x1b3914?0x0:_0x3e3b35[_0x72e8('0x1c')];var _0x3d3c3d=_0x1b3914?_0x4cb4ac[_0x72e8('0x1e')]:_0x3e3b35[_0x72e8('0x1c')]+_0x3e3b35[_0x72e8('0x1f')];var _0x2db50d;if(_0x3d3c3d>=_0x42680c){_0x3d3c3d=_0x42680c;_0x2db50d=0xc8;}else{_0x2db50d=0xce;}_0x502f11[_0x72e8('0x19')](_0x2db50d);return _0x502f11[_0x72e8('0x20')](_0x72e8('0x21'),_0x40ddb7+'-'+_0x3d3c3d+'/'+_0x42680c)[_0x72e8('0x1b')](_0x4cb4ac);}return null;};}function patchUpdates(_0x1e7045){return function(_0x35422e){try{jsonpatch[_0x72e8('0x22')](_0x35422e,_0x1e7045,!![]);}catch(_0x19d6b7){return BPromise[_0x72e8('0x23')](_0x19d6b7);}return _0x35422e['save']();};}function saveUpdates(_0x52f8b6,_0x4c910f){return function(_0x19a9ba){if(_0x19a9ba){return _0x19a9ba[_0x72e8('0x24')](_0x52f8b6)[_0x72e8('0x25')](function(_0x2170bc){return _0x2170bc;});}return null;};}function removeEntity(_0x299aba,_0x314625){return function(_0x3f5ff8){if(_0x3f5ff8){return _0x3f5ff8[_0x72e8('0x26')]()[_0x72e8('0x25')](function(){_0x299aba['status'](0xcc)[_0x72e8('0x1a')]();});}};}function handleEntityNotFound(_0x1006b4,_0x3c1bd3){return function(_0x3b82ce){if(!_0x3b82ce){_0x1006b4[_0x72e8('0x18')](0x194);}return _0x3b82ce;};}function handleError(_0x563ed7,_0x373da1){_0x373da1=_0x373da1||0x1f4;return function(_0x49a2d2){logger[_0x72e8('0x27')](_0x49a2d2['stack']);if(_0x49a2d2[_0x72e8('0x28')]){delete _0x49a2d2[_0x72e8('0x28')];}_0x563ed7[_0x72e8('0x19')](_0x373da1)[_0x72e8('0x29')](_0x49a2d2);};}exports[_0x72e8('0x2a')]=function(_0x29013c,_0x1f2cd0){var _0x473477={},_0x3950f4={},_0xf41831={'count':0x0,'rows':[]};var _0x4f7e9d=_['map'](db[_0x72e8('0x2b')][_0x72e8('0x2c')],function(_0x22a64f){return{'name':_0x22a64f[_0x72e8('0x2d')],'type':_0x22a64f[_0x72e8('0x2e')][_0x72e8('0x2f')]};});_0x3950f4[_0x72e8('0x30')]=_[_0x72e8('0x31')](_0x4f7e9d,_0x72e8('0x28'));_0x3950f4[_0x72e8('0x32')]=_[_0x72e8('0x33')](_0x29013c[_0x72e8('0x32')]);_0x3950f4[_0x72e8('0x34')]=_[_0x72e8('0x35')](_0x3950f4[_0x72e8('0x30')],_0x3950f4[_0x72e8('0x32')]);_0x473477['attributes']=_[_0x72e8('0x35')](_0x3950f4[_0x72e8('0x30')],qs['fields'](_0x29013c[_0x72e8('0x32')]['fields']));_0x473477[_0x72e8('0x36')]=_0x473477[_0x72e8('0x36')]['length']?_0x473477[_0x72e8('0x36')]:_0x3950f4[_0x72e8('0x30')];if(!_0x29013c[_0x72e8('0x32')][_0x72e8('0x37')](_0x72e8('0x38'))){_0x473477[_0x72e8('0x1f')]=qs['limit'](_0x29013c[_0x72e8('0x32')][_0x72e8('0x1f')]);_0x473477[_0x72e8('0x1c')]=qs[_0x72e8('0x1c')](_0x29013c['query']['offset']);}_0x473477[_0x72e8('0x39')]=qs[_0x72e8('0x3a')](_0x29013c[_0x72e8('0x32')][_0x72e8('0x3a')]);_0x473477[_0x72e8('0x3b')]=qs['filters'](_[_0x72e8('0x3c')](_0x29013c[_0x72e8('0x32')],_0x3950f4[_0x72e8('0x34')]),_0x4f7e9d);if(_0x29013c[_0x72e8('0x32')][_0x72e8('0x3d')]){_0x473477[_0x72e8('0x3b')]=_[_0x72e8('0x3e')](_0x473477[_0x72e8('0x3b')],{'$or':_[_0x72e8('0x31')](_0x4f7e9d,function(_0x3cb063){if(_0x3cb063[_0x72e8('0x2e')]!=='VIRTUAL'){var _0x1621bb={};_0x1621bb[_0x3cb063[_0x72e8('0x28')]]={'$like':'%'+_0x29013c[_0x72e8('0x32')][_0x72e8('0x3d')]+'%'};return _0x1621bb;}})});}_0x473477=_[_0x72e8('0x3e')]({},_0x473477,_0x29013c[_0x72e8('0x3f')]);var _0x227c81={'where':_0x473477[_0x72e8('0x3b')]};return db[_0x72e8('0x2b')][_0x72e8('0x1e')](_0x227c81)[_0x72e8('0x25')](function(_0x3e0692){_0xf41831['count']=_0x3e0692;if(_0x29013c[_0x72e8('0x32')][_0x72e8('0x40')]){_0x473477[_0x72e8('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x72e8('0x42')](_0x473477);})[_0x72e8('0x25')](function(_0x3defbe){_0xf41831[_0x72e8('0x43')]=_0x3defbe;return _0xf41831;})[_0x72e8('0x25')](respondWithFilteredResult(_0x1f2cd0,_0x473477))[_0x72e8('0x44')](handleError(_0x1f2cd0,null));};exports[_0x72e8('0x45')]=function(_0x18441c,_0x1bd5a2){var _0x3cbd33={'raw':!![],'where':{'id':_0x18441c['params']['id']}},_0x4c19fc={};_0x4c19fc[_0x72e8('0x30')]=_[_0x72e8('0x33')](db[_0x72e8('0x2b')][_0x72e8('0x2c')]);_0x4c19fc[_0x72e8('0x32')]=_[_0x72e8('0x33')](_0x18441c[_0x72e8('0x32')]);_0x4c19fc['filters']=_[_0x72e8('0x35')](_0x4c19fc['model'],_0x4c19fc[_0x72e8('0x32')]);_0x3cbd33[_0x72e8('0x36')]=_[_0x72e8('0x35')](_0x4c19fc[_0x72e8('0x30')],qs['fields'](_0x18441c[_0x72e8('0x32')][_0x72e8('0x46')]));_0x3cbd33['attributes']=_0x3cbd33[_0x72e8('0x36')][_0x72e8('0x47')]?_0x3cbd33[_0x72e8('0x36')]:_0x4c19fc[_0x72e8('0x30')];if(_0x18441c['query'][_0x72e8('0x40')]){_0x3cbd33[_0x72e8('0x41')]=[{'all':!![]}];}_0x3cbd33=_['merge']({},_0x3cbd33,_0x18441c[_0x72e8('0x3f')]);return db[_0x72e8('0x2b')][_0x72e8('0x48')](_0x3cbd33)['then'](handleEntityNotFound(_0x1bd5a2,null))[_0x72e8('0x25')](respondWithResult(_0x1bd5a2,null))[_0x72e8('0x44')](handleError(_0x1bd5a2,null));};exports[_0x72e8('0x49')]=function(_0xb0e39a,_0x2462c5){return db[_0x72e8('0x2b')]['create'](_0xb0e39a[_0x72e8('0x4a')],{})[_0x72e8('0x25')](respondWithResult(_0x2462c5,0xc9))['catch'](handleError(_0x2462c5,null));};exports['update']=function(_0x6e3724,_0x193332){if(_0x6e3724['body']['id']){delete _0x6e3724['body']['id'];}return db['SquareDetailsReport'][_0x72e8('0x48')]({'where':{'id':_0x6e3724[_0x72e8('0x4b')]['id']}})[_0x72e8('0x25')](handleEntityNotFound(_0x193332,null))['then'](saveUpdates(_0x6e3724['body'],null))['then'](respondWithResult(_0x193332,null))['catch'](handleError(_0x193332,null));};exports['destroy']=function(_0x37ad79,_0x25b694){return db[_0x72e8('0x2b')][_0x72e8('0x48')]({'where':{'id':_0x37ad79[_0x72e8('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25b694,null))['then'](removeEntity(_0x25b694,null))[_0x72e8('0x44')](handleError(_0x25b694,null));};exports[_0x72e8('0x4c')]=function(_0x3ba093,_0x4a2e81){return db[_0x72e8('0x2b')][_0x72e8('0x4c')]()[_0x72e8('0x25')](respondWithResult(_0x4a2e81,null))['catch'](handleError(_0x4a2e81,null));}; \ No newline at end of file +var _0x7f6e=['path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','options','SquareDetailsReport','includeAll','include','rows','catch','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x582a91,_0x17bf51){var _0x1a5a21=function(_0xd5c4e3){while(--_0xd5c4e3){_0x582a91['push'](_0x582a91['shift']());}};_0x1a5a21(++_0x17bf51);}(_0x7f6e,0x1ae));var _0xe7f6=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x7f6e[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0xe7f6('0x0'));var rimraf=require(_0xe7f6('0x1'));var zipdir=require(_0xe7f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7f6('0x3'));var moment=require(_0xe7f6('0x4'));var BPromise=require(_0xe7f6('0x5'));var Mustache=require(_0xe7f6('0x6'));var util=require(_0xe7f6('0x7'));var path=require(_0xe7f6('0x8'));var sox=require(_0xe7f6('0x9'));var csv=require(_0xe7f6('0xa'));var ejs=require(_0xe7f6('0xb'));var fs=require('fs');var fs_extra=require(_0xe7f6('0xc'));var _=require('lodash');var squel=require(_0xe7f6('0xd'));var crypto=require(_0xe7f6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe7f6('0xf'));var toCsv=require(_0xe7f6('0xa'));var querystring=require(_0xe7f6('0x10'));var Papa=require('papaparse');var Redis=require(_0xe7f6('0x11'));var authService=require(_0xe7f6('0x12'));var qs=require(_0xe7f6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe7f6('0x14'));var logger=require(_0xe7f6('0x15'))(_0xe7f6('0x16'));var utils=require('../../config/utils');var config=require(_0xe7f6('0x17'));var licenseUtil=require(_0xe7f6('0x18'));var db=require(_0xe7f6('0x19'))['db'];function respondWithStatusCode(_0x455c81,_0x17468b){_0x17468b=_0x17468b||0xcc;return function(_0x2d4156){if(_0x2d4156){return _0x455c81[_0xe7f6('0x1a')](_0x17468b);}return _0x455c81[_0xe7f6('0x1b')](_0x17468b)['end']();};}function respondWithResult(_0x3c0f63,_0x4e7f16){_0x4e7f16=_0x4e7f16||0xc8;return function(_0x50686a){if(_0x50686a){return _0x3c0f63[_0xe7f6('0x1b')](_0x4e7f16)[_0xe7f6('0x1c')](_0x50686a);}};}function respondWithFilteredResult(_0x5248bc,_0x4ec51a){return function(_0x3cce6a){if(_0x3cce6a){var _0x2c41ae=typeof _0x4ec51a[_0xe7f6('0x1d')]===_0xe7f6('0x1e')&&typeof _0x4ec51a[_0xe7f6('0x1f')]===_0xe7f6('0x1e');var _0x2c7e4b=_0x3cce6a[_0xe7f6('0x20')];var _0x51b549=_0x2c41ae?0x0:_0x4ec51a[_0xe7f6('0x1d')];var _0x6076b0=_0x2c41ae?_0x3cce6a['count']:_0x4ec51a[_0xe7f6('0x1d')]+_0x4ec51a['limit'];var _0x18f265;if(_0x6076b0>=_0x2c7e4b){_0x6076b0=_0x2c7e4b;_0x18f265=0xc8;}else{_0x18f265=0xce;}_0x5248bc[_0xe7f6('0x1b')](_0x18f265);return _0x5248bc['set'](_0xe7f6('0x21'),_0x51b549+'-'+_0x6076b0+'/'+_0x2c7e4b)['json'](_0x3cce6a);}return null;};}function patchUpdates(_0x39c78e){return function(_0xf1e046){try{jsonpatch['apply'](_0xf1e046,_0x39c78e,!![]);}catch(_0x3b1283){return BPromise[_0xe7f6('0x22')](_0x3b1283);}return _0xf1e046[_0xe7f6('0x23')]();};}function saveUpdates(_0x2db6ed,_0x2c5bd4){return function(_0x17df6d){if(_0x17df6d){return _0x17df6d['update'](_0x2db6ed)[_0xe7f6('0x24')](function(_0x3581e6){return _0x3581e6;});}return null;};}function removeEntity(_0xe4c04e,_0x236ed4){return function(_0x137874){if(_0x137874){return _0x137874[_0xe7f6('0x25')]()[_0xe7f6('0x24')](function(){_0xe4c04e[_0xe7f6('0x1b')](0xcc)[_0xe7f6('0x26')]();});}};}function handleEntityNotFound(_0x653e10,_0x3e3ff8){return function(_0x48bbae){if(!_0x48bbae){_0x653e10[_0xe7f6('0x1a')](0x194);}return _0x48bbae;};}function handleError(_0x1dfcf9,_0x3f9f21){_0x3f9f21=_0x3f9f21||0x1f4;return function(_0x52e6db){logger[_0xe7f6('0x27')](_0x52e6db[_0xe7f6('0x28')]);if(_0x52e6db[_0xe7f6('0x29')]){delete _0x52e6db[_0xe7f6('0x29')];}_0x1dfcf9['status'](_0x3f9f21)[_0xe7f6('0x2a')](_0x52e6db);};}exports[_0xe7f6('0x2b')]=function(_0x1faa9d,_0x1041b3){var _0xa1ac46={},_0x560758={},_0x1c2718={'count':0x0,'rows':[]};var _0x435bd8=_[_0xe7f6('0x2c')](db['SquareDetailsReport'][_0xe7f6('0x2d')],function(_0x5351a9){return{'name':_0x5351a9['fieldName'],'type':_0x5351a9['type']['key']};});_0x560758[_0xe7f6('0x2e')]=_[_0xe7f6('0x2c')](_0x435bd8,'name');_0x560758[_0xe7f6('0x2f')]=_[_0xe7f6('0x30')](_0x1faa9d['query']);_0x560758[_0xe7f6('0x31')]=_[_0xe7f6('0x32')](_0x560758[_0xe7f6('0x2e')],_0x560758[_0xe7f6('0x2f')]);_0xa1ac46[_0xe7f6('0x33')]=_['intersection'](_0x560758[_0xe7f6('0x2e')],qs['fields'](_0x1faa9d[_0xe7f6('0x2f')][_0xe7f6('0x34')]));_0xa1ac46['attributes']=_0xa1ac46[_0xe7f6('0x33')][_0xe7f6('0x35')]?_0xa1ac46[_0xe7f6('0x33')]:_0x560758['model'];if(!_0x1faa9d['query'][_0xe7f6('0x36')]('nolimit')){_0xa1ac46[_0xe7f6('0x1f')]=qs[_0xe7f6('0x1f')](_0x1faa9d[_0xe7f6('0x2f')]['limit']);_0xa1ac46[_0xe7f6('0x1d')]=qs['offset'](_0x1faa9d[_0xe7f6('0x2f')][_0xe7f6('0x1d')]);}_0xa1ac46[_0xe7f6('0x37')]=qs[_0xe7f6('0x38')](_0x1faa9d[_0xe7f6('0x2f')][_0xe7f6('0x38')]);_0xa1ac46[_0xe7f6('0x39')]=qs[_0xe7f6('0x31')](_['pick'](_0x1faa9d[_0xe7f6('0x2f')],_0x560758[_0xe7f6('0x31')]),_0x435bd8);if(_0x1faa9d[_0xe7f6('0x2f')][_0xe7f6('0x3a')]){_0xa1ac46[_0xe7f6('0x39')]=_[_0xe7f6('0x3b')](_0xa1ac46[_0xe7f6('0x39')],{'$or':_['map'](_0x435bd8,function(_0x3c1e3f){if(_0x3c1e3f[_0xe7f6('0x3c')]!=='VIRTUAL'){var _0x1b39ff={};_0x1b39ff[_0x3c1e3f[_0xe7f6('0x29')]]={'$like':'%'+_0x1faa9d[_0xe7f6('0x2f')][_0xe7f6('0x3a')]+'%'};return _0x1b39ff;}})});}_0xa1ac46=_[_0xe7f6('0x3b')]({},_0xa1ac46,_0x1faa9d[_0xe7f6('0x3d')]);var _0x5b760c={'where':_0xa1ac46[_0xe7f6('0x39')]};return db[_0xe7f6('0x3e')][_0xe7f6('0x20')](_0x5b760c)[_0xe7f6('0x24')](function(_0x224242){_0x1c2718['count']=_0x224242;if(_0x1faa9d['query'][_0xe7f6('0x3f')]){_0xa1ac46[_0xe7f6('0x40')]=[{'all':!![]}];}return db[_0xe7f6('0x3e')]['findAll'](_0xa1ac46);})[_0xe7f6('0x24')](function(_0x1cd0d4){_0x1c2718[_0xe7f6('0x41')]=_0x1cd0d4;return _0x1c2718;})['then'](respondWithFilteredResult(_0x1041b3,_0xa1ac46))[_0xe7f6('0x42')](handleError(_0x1041b3,null));};exports['show']=function(_0x828db6,_0x4f0942){var _0xe0630e={'raw':!![],'where':{'id':_0x828db6['params']['id']}},_0x61f46e={};_0x61f46e[_0xe7f6('0x2e')]=_[_0xe7f6('0x30')](db[_0xe7f6('0x3e')][_0xe7f6('0x2d')]);_0x61f46e[_0xe7f6('0x2f')]=_[_0xe7f6('0x30')](_0x828db6[_0xe7f6('0x2f')]);_0x61f46e[_0xe7f6('0x31')]=_[_0xe7f6('0x32')](_0x61f46e['model'],_0x61f46e[_0xe7f6('0x2f')]);_0xe0630e['attributes']=_['intersection'](_0x61f46e[_0xe7f6('0x2e')],qs[_0xe7f6('0x34')](_0x828db6[_0xe7f6('0x2f')][_0xe7f6('0x34')]));_0xe0630e[_0xe7f6('0x33')]=_0xe0630e[_0xe7f6('0x33')][_0xe7f6('0x35')]?_0xe0630e[_0xe7f6('0x33')]:_0x61f46e[_0xe7f6('0x2e')];if(_0x828db6[_0xe7f6('0x2f')][_0xe7f6('0x3f')]){_0xe0630e[_0xe7f6('0x40')]=[{'all':!![]}];}_0xe0630e=_[_0xe7f6('0x3b')]({},_0xe0630e,_0x828db6[_0xe7f6('0x3d')]);return db[_0xe7f6('0x3e')][_0xe7f6('0x43')](_0xe0630e)[_0xe7f6('0x24')](handleEntityNotFound(_0x4f0942,null))[_0xe7f6('0x24')](respondWithResult(_0x4f0942,null))[_0xe7f6('0x42')](handleError(_0x4f0942,null));};exports[_0xe7f6('0x44')]=function(_0x4f755e,_0x2b865b){return db['SquareDetailsReport'][_0xe7f6('0x44')](_0x4f755e[_0xe7f6('0x45')],{})[_0xe7f6('0x24')](respondWithResult(_0x2b865b,0xc9))[_0xe7f6('0x42')](handleError(_0x2b865b,null));};exports[_0xe7f6('0x46')]=function(_0x3fab68,_0x4405a8){if(_0x3fab68[_0xe7f6('0x45')]['id']){delete _0x3fab68[_0xe7f6('0x45')]['id'];}return db[_0xe7f6('0x3e')][_0xe7f6('0x43')]({'where':{'id':_0x3fab68['params']['id']}})[_0xe7f6('0x24')](handleEntityNotFound(_0x4405a8,null))[_0xe7f6('0x24')](saveUpdates(_0x3fab68[_0xe7f6('0x45')],null))[_0xe7f6('0x24')](respondWithResult(_0x4405a8,null))[_0xe7f6('0x42')](handleError(_0x4405a8,null));};exports['destroy']=function(_0x27b52b,_0x191238){return db['SquareDetailsReport'][_0xe7f6('0x43')]({'where':{'id':_0x27b52b[_0xe7f6('0x47')]['id']}})[_0xe7f6('0x24')](handleEntityNotFound(_0x191238,null))[_0xe7f6('0x24')](removeEntity(_0x191238,null))[_0xe7f6('0x42')](handleError(_0x191238,null));};exports['describe']=function(_0x3a4dc7,_0x1d91d8){return db[_0xe7f6('0x3e')][_0xe7f6('0x48')]()['then'](respondWithResult(_0x1d91d8,null))[_0xe7f6('0x42')](handleError(_0x1d91d8,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index de1f0cf..3eeee3b 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 _0x5e88=['rimraf','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util','api','bluebird','path'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0x5e88,0x171));var _0x85e8=function(_0x36c9b2,_0x370655){_0x36c9b2=_0x36c9b2-0x0;var _0x204668=_0x5e88[_0x36c9b2];return _0x204668;};'use strict';var _=require(_0x85e8('0x0'));var util=require(_0x85e8('0x1'));var logger=require('../../config/logger')(_0x85e8('0x2'));var moment=require('moment');var BPromise=require(_0x85e8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x85e8('0x4'));var rimraf=require(_0x85e8('0x5'));var config=require('../../config/environment');var attributes=require(_0x85e8('0x6'));module[_0x85e8('0x7')]=function(_0x1e80b6,_0xf628fa){return _0x1e80b6[_0x85e8('0x8')](_0x85e8('0x9'),attributes,{'tableName':_0x85e8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf06=['moment','request-promise','path','rimraf','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api'];(function(_0x56878b,_0x21aa20){var _0x101e9a=function(_0x45965f){while(--_0x45965f){_0x56878b['push'](_0x56878b['shift']());}};_0x101e9a(++_0x21aa20);}(_0xcf06,0xd8));var _0x6cf0=function(_0x33e0d7,_0x5ca955){_0x33e0d7=_0x33e0d7-0x0;var _0x3b1170=_0xcf06[_0x33e0d7];return _0x3b1170;};'use strict';var _=require(_0x6cf0('0x0'));var util=require(_0x6cf0('0x1'));var logger=require(_0x6cf0('0x2'))(_0x6cf0('0x3'));var moment=require(_0x6cf0('0x4'));var BPromise=require('bluebird');var rp=require(_0x6cf0('0x5'));var fs=require('fs');var path=require(_0x6cf0('0x6'));var rimraf=require(_0x6cf0('0x7'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x55d1d7,_0x1aecba){return _0x55d1d7[_0x6cf0('0x8')](_0x6cf0('0x9'),attributes,{'tableName':_0x6cf0('0xa'),'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 704b164..476d11a 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 _0xda3f=['options','raw','util','moment','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body'];(function(_0x4816a8,_0x330b12){var _0x54a418=function(_0x3d4f9b){while(--_0x3d4f9b){_0x4816a8['push'](_0x4816a8['shift']());}};_0x54a418(++_0x330b12);}(_0xda3f,0xec));var _0xfda3=function(_0x48821a,_0x4e1f20){_0x48821a=_0x48821a-0x0;var _0x166d71=_0xda3f[_0x48821a];return _0x166d71;};'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')]('SquareDetailsReport,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});}exports[_0xfda3('0x14')]=function(_0x4680bf){var _0xc62ae6=this;return new Promise(function(_0x54a7c6,_0x15ddb9){return db[_0xfda3('0x15')][_0xfda3('0x16')](_0x4680bf[_0xfda3('0x17')],{'raw':_0x4680bf['options']?_0x4680bf[_0xfda3('0x18')][_0xfda3('0x19')]===undefined?!![]:![]:!![]})[_0xfda3('0x8')](function(_0x51e731){logger['info'](_0xfda3('0x14'),_0x4680bf);logger[_0xfda3('0xc')](_0xfda3('0x14'),_0x4680bf,JSON['stringify'](_0x51e731));_0x54a7c6(_0x51e731);})[_0xfda3('0x13')](function(_0xef2535){logger[_0xfda3('0xf')](_0xfda3('0x14'),_0xef2535[_0xfda3('0x11')],_0x4680bf);_0x15ddb9(_0xc62ae6[_0xfda3('0xf')](0x1f4,_0xef2535[_0xfda3('0x11')]));});});}; \ No newline at end of file +var _0x32b6=['request','then','debug','request\x20sent','stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','info','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x32b6,0x1d1));var _0x632b=function(_0x136695,_0x360839){_0x136695=_0x136695-0x0;var _0x246080=_0x32b6[_0x136695];return _0x246080;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var moment=require('moment');var BPromise=require(_0x632b('0x2'));var rs=require(_0x632b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x632b('0x4'));var logger=require(_0x632b('0x5'))(_0x632b('0x6'));var config=require(_0x632b('0x7'));var jayson=require(_0x632b('0x8'));var client=jayson[_0x632b('0x9')][_0x632b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10458a,_0x3bbf43,_0x43d6c7){return new BPromise(function(_0x5128f5,_0x33d711){return client[_0x632b('0xb')](_0x10458a,_0x43d6c7)[_0x632b('0xc')](function(_0x174201){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x3bbf43,'request\x20sent');logger[_0x632b('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x3bbf43,_0x632b('0xe'),JSON[_0x632b('0xf')](_0x174201));if(_0x174201[_0x632b('0x10')]){if(_0x174201[_0x632b('0x10')][_0x632b('0x11')]===0x1f4){logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201[_0x632b('0x10')][_0x632b('0x13')]);return _0x33d711(_0x174201['error'][_0x632b('0x13')]);}logger[_0x632b('0x10')](_0x632b('0x12'),_0x3bbf43,_0x174201['error'][_0x632b('0x13')]);return _0x5128f5(_0x174201[_0x632b('0x10')][_0x632b('0x13')]);}else{logger[_0x632b('0x14')](_0x632b('0x12'),_0x3bbf43,_0x632b('0xe'));_0x5128f5(_0x174201['result'][_0x632b('0x13')]);}})['catch'](function(_0x4fdef2){logger[_0x632b('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x3bbf43,_0x4fdef2);_0x33d711(_0x4fdef2);});});}exports[_0x632b('0x15')]=function(_0x3bb27f){var _0x28c472=this;return new Promise(function(_0x51c894,_0x2f3e88){return db[_0x632b('0x16')][_0x632b('0x17')](_0x3bb27f[_0x632b('0x18')],{'raw':_0x3bb27f['options']?_0x3bb27f[_0x632b('0x19')][_0x632b('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x116f62){logger['info']('CreateSquareDetailsReport',_0x3bb27f);logger[_0x632b('0xd')]('CreateSquareDetailsReport',_0x3bb27f,JSON[_0x632b('0xf')](_0x116f62));_0x51c894(_0x116f62);})[_0x632b('0x1b')](function(_0x2a6833){logger['error'](_0x632b('0x15'),_0x2a6833[_0x632b('0x13')],_0x3bb27f);_0x2f3e88(_0x28c472['error'](0x1f4,_0x2a6833[_0x632b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 26cb409..27e44a3 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 _0x4611=['/process/:pid/kill','killProcess','express','./system.controller','get','isAuthenticated'];(function(_0x453144,_0x3709bb){var _0x512f25=function(_0xde57be){while(--_0xde57be){_0x453144['push'](_0x453144['shift']());}};_0x512f25(++_0x3709bb);}(_0x4611,0x17c));var _0x1461=function(_0x365439,_0x562ef8){_0x365439=_0x365439-0x0;var _0x3215b4=_0x4611[_0x365439];return _0x3215b4;};'use strict';var express=require(_0x1461('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0x1461('0x1'));router[_0x1461('0x2')]('/',auth[_0x1461('0x3')](),controller['index']);router['get'](_0x1461('0x4'),auth['isAuthenticated'](),controller[_0x1461('0x5')]);module['exports']=router; \ No newline at end of file +var _0x3e55=['../../components/auth/service','get','isAuthenticated','index','/process/:pid/kill','killProcess','exports','express'];(function(_0x4295bc,_0x55b581){var _0x2f0298=function(_0x3015e2){while(--_0x3015e2){_0x4295bc['push'](_0x4295bc['shift']());}};_0x2f0298(++_0x55b581);}(_0x3e55,0x127));var _0x53e5=function(_0x1bc35b,_0x2b9a41){_0x1bc35b=_0x1bc35b-0x0;var _0x2400d7=_0x3e55[_0x1bc35b];return _0x2400d7;};'use strict';var express=require(_0x53e5('0x0'));var router=express['Router']();var auth=require(_0x53e5('0x1'));var controller=require('./system.controller');router[_0x53e5('0x2')]('/',auth[_0x53e5('0x3')](),controller[_0x53e5('0x4')]);router[_0x53e5('0x2')](_0x53e5('0x5'),auth['isAuthenticated'](),controller[_0x53e5('0x6')]);module[_0x53e5('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 975f221..f675a99 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 _0xea0a=['params','pid','split','Process\x20with\x20pid\x20%s\x20not\x20found!','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','index','getAllData','then','status','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0xea0a,0xce));var _0xaea0=function(_0x1b8ffe,_0x1e4707){_0x1b8ffe=_0x1b8ffe-0x0;var _0x2c38a5=_0xea0a[_0x1b8ffe];return _0x2c38a5;};'use strict';var info=require(_0xaea0('0x0'));var exec=require(_0xaea0('0x1'))[_0xaea0('0x2')];var logger=require(_0xaea0('0x3'))(_0xaea0('0x4'));var util=require(_0xaea0('0x5'));var BPromise=require(_0xaea0('0x6'));var _=require(_0xaea0('0x7'));function handleError(_0x56818a,_0x16bcfc,_0x1442ee){_0x16bcfc=_0x16bcfc||0x1f4;return function(_0x15332e){logger[_0xaea0('0x8')](_0xaea0('0x9'),_0x1442ee,_0x16bcfc,util['inspect'](_0x15332e,{'showHidden':![],'depth':null}));delete _0x15332e['name'];_0x56818a['status'](_0x16bcfc)['send'](_0x15332e);};}exports[_0xaea0('0xa')]=function(_0x4ee804,_0x31853e){return info[_0xaea0('0xb')]()[_0xaea0('0xc')](function(_0x317fcc){return _0x31853e[_0xaea0('0xd')](0xc8)[_0xaea0('0xe')](_0x317fcc);})['catch'](function(_0x210b82){return _0x31853e[_0xaea0('0xd')](0x1f4)[_0xaea0('0xe')](_0x210b82);});};exports[_0xaea0('0xf')]=function(_0x58ef29,_0x522b00){var _0x7de645=[_0xaea0('0x10')];return new BPromise(function(_0x11a71d,_0x5d1589){return exec(util[_0xaea0('0x11')](_0xaea0('0x12'),_0x58ef29[_0xaea0('0x13')][_0xaea0('0x14')]),function(_0x56e640,_0x3d00a8,_0xa6e3c4){if(_0x56e640){return _0x5d1589(_0x56e640);}return _0x11a71d(_0x3d00a8);});})[_0xaea0('0xc')](function(_0x4087ae){var _0x520f47=![];var _0x32eb16=_0x4087ae[_0xaea0('0x15')](/\n/);for(var _0x361292=0x0,_0x4e730e=_0x7de645['length'];_0x361292<_0x4e730e,_0x520f47===![];_0x361292+=0x1){if(_0x4087ae['indexOf'](_0x7de645[_0x361292])>=0x0){_0x520f47=!![];}}if(!_0x520f47){throw new Error(util[_0xaea0('0x11')](_0xaea0('0x16'),_0x58ef29['params'][_0xaea0('0x14')]));}process['kill'](_0x58ef29[_0xaea0('0x13')][_0xaea0('0x14')],'SIGINT');return _0x522b00['status'](0xc8)[_0xaea0('0xe')]({'message':util[_0xaea0('0x11')](_0xaea0('0x17'),_0x58ef29[_0xaea0('0x13')][_0xaea0('0x14')])});})[_0xaea0('0x18')](handleError(_0x522b00,null,_0xaea0('0xf')));}; \ No newline at end of file +var _0x90f0=['<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','index','getAllData','then','json','catch','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','child_process','exec','../../config/logger','util','bluebird','error'];(function(_0xfefea4,_0x1203bb){var _0x37f94d=function(_0x4c9ccb){while(--_0x4c9ccb){_0xfefea4['push'](_0xfefea4['shift']());}};_0x37f94d(++_0x1203bb);}(_0x90f0,0xda));var _0x090f=function(_0x3789c7,_0x3a156d){_0x3789c7=_0x3789c7-0x0;var _0x3b58ca=_0x90f0[_0x3789c7];return _0x3b58ca;};'use strict';var info=require('systeminformation');var exec=require(_0x090f('0x0'))[_0x090f('0x1')];var logger=require(_0x090f('0x2'))('api');var util=require(_0x090f('0x3'));var BPromise=require(_0x090f('0x4'));var _=require('lodash');function handleError(_0x336c23,_0x30fade,_0x49734f){_0x30fade=_0x30fade||0x1f4;return function(_0x3df2c4){logger[_0x090f('0x5')](_0x090f('0x6'),_0x49734f,_0x30fade,util[_0x090f('0x7')](_0x3df2c4,{'showHidden':![],'depth':null}));delete _0x3df2c4[_0x090f('0x8')];_0x336c23[_0x090f('0x9')](_0x30fade)[_0x090f('0xa')](_0x3df2c4);};}exports[_0x090f('0xb')]=function(_0x301335,_0x504855){return info[_0x090f('0xc')]()[_0x090f('0xd')](function(_0x391e5a){return _0x504855[_0x090f('0x9')](0xc8)[_0x090f('0xe')](_0x391e5a);})[_0x090f('0xf')](function(_0x4c837d){return _0x504855['status'](0x1f4)[_0x090f('0xe')](_0x4c837d);});};exports['killProcess']=function(_0x56b87f,_0x21c75a){var _0x149d5c=[_0x090f('0x10')];return new BPromise(function(_0x178091,_0x10bf8b){return exec(util['format'](_0x090f('0x11'),_0x56b87f[_0x090f('0x12')][_0x090f('0x13')]),function(_0x420fb8,_0x3ff5fb,_0x32c57c){if(_0x420fb8){return _0x10bf8b(_0x420fb8);}return _0x178091(_0x3ff5fb);});})['then'](function(_0x1d4234){var _0x406aac=![];var _0xd261eb=_0x1d4234[_0x090f('0x14')](/\n/);for(var _0x402b2c=0x0,_0x4aaad4=_0x149d5c[_0x090f('0x15')];_0x402b2c<_0x4aaad4,_0x406aac===![];_0x402b2c+=0x1){if(_0x1d4234[_0x090f('0x16')](_0x149d5c[_0x402b2c])>=0x0){_0x406aac=!![];}}if(!_0x406aac){throw new Error(util[_0x090f('0x17')](_0x090f('0x18'),_0x56b87f[_0x090f('0x12')]['pid']));}process[_0x090f('0x19')](_0x56b87f['params'][_0x090f('0x13')],'SIGINT');return _0x21c75a[_0x090f('0x9')](0xc8)[_0x090f('0xe')]({'message':util[_0x090f('0x17')](_0x090f('0x1a'),_0x56b87f[_0x090f('0x12')][_0x090f('0x13')])});})[_0x090f('0xf')](handleError(_0x21c75a,null,_0x090f('0x1b')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index d9fde6f..8434290 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 _0x571a=['show','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x28666a,_0x3dc25d){var _0x19d752=function(_0x551e47){while(--_0x551e47){_0x28666a['push'](_0x28666a['shift']());}};_0x19d752(++_0x3dc25d);}(_0x571a,0xf6));var _0xa571=function(_0x765c9b,_0x5ac359){_0x765c9b=_0x765c9b-0x0;var _0x5dedb6=_0x571a[_0x765c9b];return _0x5dedb6;};'use strict';var multer=require(_0xa571('0x0'));var util=require(_0xa571('0x1'));var path=require(_0xa571('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa571('0x3')]();var fs_extra=require(_0xa571('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa571('0x5'));var config=require(_0xa571('0x6'));var controller=require('./tag.controller');router[_0xa571('0x7')]('/',auth[_0xa571('0x8')](),controller['index']);router['get'](_0xa571('0x9'),auth[_0xa571('0x8')](),controller[_0xa571('0xa')]);router['post']('/',auth[_0xa571('0x8')](),controller['create']);router[_0xa571('0xb')](_0xa571('0x9'),auth[_0xa571('0x8')](),controller[_0xa571('0xc')]);router[_0xa571('0xd')](_0xa571('0x9'),auth['isAuthenticated'](),controller[_0xa571('0xe')]);module[_0xa571('0xf')]=router; \ No newline at end of file +var _0xa372=['/:id','isAuthenticated','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','index'];(function(_0x55783b,_0xc8bacf){var _0x152da5=function(_0x2382c3){while(--_0x2382c3){_0x55783b['push'](_0x55783b['shift']());}};_0x152da5(++_0xc8bacf);}(_0xa372,0xe4));var _0x2a37=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xa372[_0x44bcb0];return _0xfaf881;};'use strict';var multer=require(_0x2a37('0x0'));var util=require(_0x2a37('0x1'));var path=require(_0x2a37('0x2'));var timeout=require(_0x2a37('0x3'));var express=require('express');var router=express[_0x2a37('0x4')]();var fs_extra=require(_0x2a37('0x5'));var auth=require(_0x2a37('0x6'));var interaction=require(_0x2a37('0x7'));var config=require(_0x2a37('0x8'));var controller=require(_0x2a37('0x9'));router[_0x2a37('0xa')]('/',auth['isAuthenticated'](),controller[_0x2a37('0xb')]);router[_0x2a37('0xa')](_0x2a37('0xc'),auth[_0x2a37('0xd')](),controller['show']);router[_0x2a37('0xe')]('/',auth[_0x2a37('0xd')](),controller[_0x2a37('0xf')]);router[_0x2a37('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2a37('0x11')]);router[_0x2a37('0x12')](_0x2a37('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x2a37('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 2ef4c46..3165466 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 _0x608a=['exports','STRING','#0091EA'];(function(_0x97bf1b,_0x8c9ea8){var _0x587365=function(_0x488a7b){while(--_0x488a7b){_0x97bf1b['push'](_0x97bf1b['shift']());}};_0x587365(++_0x8c9ea8);}(_0x608a,0xff));var _0xa608=function(_0x1d6795,_0x5c3d86){_0x1d6795=_0x1d6795-0x0;var _0x2fb69d=_0x608a[_0x1d6795];return _0x2fb69d;};'use strict';var Sequelize=require('sequelize');module[_0xa608('0x0')]={'name':{'type':Sequelize[_0xa608('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xa608('0x1')],'defaultValue':_0xa608('0x2')},'description':{'type':Sequelize[_0xa608('0x1')]}}; \ No newline at end of file +var _0x3e22=['exports','name','STRING','#0091EA'];(function(_0x389f98,_0x107c8e){var _0x2aa7ee=function(_0x2d40c5){while(--_0x2d40c5){_0x389f98['push'](_0x389f98['shift']());}};_0x2aa7ee(++_0x107c8e);}(_0x3e22,0xa8));var _0x23e2=function(_0x509042,_0x541f21){_0x509042=_0x509042-0x0;var _0x1ac556=_0x3e22[_0x509042];return _0x1ac556;};'use strict';var Sequelize=require('sequelize');module[_0x23e2('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x23e2('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x23e2('0x2')],'defaultValue':_0x23e2('0x3')},'description':{'type':Sequelize[_0x23e2('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 076b2af..48306b9 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 _0x5178=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x379e9,_0x56e9c2){var _0x33b555=function(_0x8b7a70){while(--_0x8b7a70){_0x379e9['push'](_0x379e9['shift']());}};_0x33b555(++_0x56e9c2);}(_0x5178,0x171));var _0x8517=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5178[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8517('0x0'));var zipdir=require(_0x8517('0x1'));var jsonpatch=require(_0x8517('0x2'));var rp=require(_0x8517('0x3'));var moment=require(_0x8517('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8517('0x5'));var path=require(_0x8517('0x6'));var sox=require('sox');var csv=require(_0x8517('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8517('0x8'));var _=require(_0x8517('0x9'));var squel=require(_0x8517('0xa'));var crypto=require(_0x8517('0xb'));var jsforce=require(_0x8517('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x8517('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8517('0xd'));var authService=require(_0x8517('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8517('0xf'));var hardwareService=require(_0x8517('0x10'));var logger=require(_0x8517('0x11'))(_0x8517('0x12'));var utils=require(_0x8517('0x13'));var config=require(_0x8517('0x14'));var licenseUtil=require(_0x8517('0x15'));var db=require(_0x8517('0x16'))['db'];function respondWithStatusCode(_0x4b9768,_0x9c57de){_0x9c57de=_0x9c57de||0xcc;return function(_0x7f429a){if(_0x7f429a){return _0x4b9768[_0x8517('0x17')](_0x9c57de);}return _0x4b9768[_0x8517('0x18')](_0x9c57de)[_0x8517('0x19')]();};}function respondWithResult(_0x49eba7,_0x385219){_0x385219=_0x385219||0xc8;return function(_0x19dd9d){if(_0x19dd9d){return _0x49eba7[_0x8517('0x18')](_0x385219)[_0x8517('0x1a')](_0x19dd9d);}};}function respondWithFilteredResult(_0x411d29,_0x18a984){return function(_0x260a15){if(_0x260a15){var _0x30cea1=typeof _0x18a984[_0x8517('0x1b')]===_0x8517('0x1c')&&typeof _0x18a984[_0x8517('0x1d')]===_0x8517('0x1c');var _0x50e2de=_0x260a15[_0x8517('0x1e')];var _0x100b76=_0x30cea1?0x0:_0x18a984[_0x8517('0x1b')];var _0xf1b53b=_0x30cea1?_0x260a15[_0x8517('0x1e')]:_0x18a984[_0x8517('0x1b')]+_0x18a984[_0x8517('0x1d')];var _0x5b5408;if(_0xf1b53b>=_0x50e2de){_0xf1b53b=_0x50e2de;_0x5b5408=0xc8;}else{_0x5b5408=0xce;}_0x411d29[_0x8517('0x18')](_0x5b5408);return _0x411d29['set']('Content-Range',_0x100b76+'-'+_0xf1b53b+'/'+_0x50e2de)[_0x8517('0x1a')](_0x260a15);}return null;};}function patchUpdates(_0x157bea){return function(_0xf35d95){try{jsonpatch[_0x8517('0x1f')](_0xf35d95,_0x157bea,!![]);}catch(_0x238d75){return BPromise[_0x8517('0x20')](_0x238d75);}return _0xf35d95['save']();};}function saveUpdates(_0x4b145f,_0x2dd1df){return function(_0x37861d){if(_0x37861d){return _0x37861d[_0x8517('0x21')](_0x4b145f)[_0x8517('0x22')](function(_0x3a5f0b){return _0x3a5f0b;});}return null;};}function removeEntity(_0x2e6e47,_0x5f02ee){return function(_0x181500){if(_0x181500){return _0x181500[_0x8517('0x23')]()['then'](function(){var _0x7f4cf8=_0x181500[_0x8517('0x24')]({'plain':!![]});var _0x42c779='Tags';return db[_0x8517('0x25')]['destroy']({'where':{'type':_0x42c779,'resourceId':_0x7f4cf8['id']}})[_0x8517('0x22')](function(){return _0x181500;});})[_0x8517('0x22')](function(){_0x2e6e47[_0x8517('0x18')](0xcc)[_0x8517('0x19')]();});}};}function handleEntityNotFound(_0x238f2c,_0x300e3f){return function(_0x481ceb){if(!_0x481ceb){_0x238f2c[_0x8517('0x17')](0x194);}return _0x481ceb;};}function handleError(_0x51d516,_0x197aaf){_0x197aaf=_0x197aaf||0x1f4;return function(_0x70ee9d){logger[_0x8517('0x26')](_0x70ee9d[_0x8517('0x27')]);if(_0x70ee9d[_0x8517('0x28')]){delete _0x70ee9d[_0x8517('0x28')];}_0x51d516['status'](_0x197aaf)[_0x8517('0x29')](_0x70ee9d);};}exports['index']=function(_0x3b1928,_0x4b9983){var _0x1dd9fb={},_0x2d360c={},_0x3cf945={'count':0x0,'rows':[]};var _0x14eb04=_[_0x8517('0x2a')](db[_0x8517('0x2b')][_0x8517('0x2c')],function(_0x559707){return{'name':_0x559707[_0x8517('0x2d')],'type':_0x559707[_0x8517('0x2e')][_0x8517('0x2f')]};});_0x2d360c['model']=_['map'](_0x14eb04,'name');_0x2d360c[_0x8517('0x30')]=_[_0x8517('0x31')](_0x3b1928[_0x8517('0x30')]);_0x2d360c[_0x8517('0x32')]=_[_0x8517('0x33')](_0x2d360c[_0x8517('0x34')],_0x2d360c['query']);_0x1dd9fb[_0x8517('0x35')]=_[_0x8517('0x33')](_0x2d360c[_0x8517('0x34')],qs['fields'](_0x3b1928[_0x8517('0x30')]['fields']));_0x1dd9fb[_0x8517('0x35')]=_0x1dd9fb[_0x8517('0x35')]['length']?_0x1dd9fb['attributes']:_0x2d360c[_0x8517('0x34')];if(!_0x3b1928[_0x8517('0x30')][_0x8517('0x36')](_0x8517('0x37'))){_0x1dd9fb['limit']=qs['limit'](_0x3b1928[_0x8517('0x30')][_0x8517('0x1d')]);_0x1dd9fb[_0x8517('0x1b')]=qs['offset'](_0x3b1928[_0x8517('0x30')][_0x8517('0x1b')]);}_0x1dd9fb['order']=qs[_0x8517('0x38')](_0x3b1928[_0x8517('0x30')][_0x8517('0x38')]);_0x1dd9fb[_0x8517('0x39')]=qs['filters'](_[_0x8517('0x3a')](_0x3b1928[_0x8517('0x30')],_0x2d360c[_0x8517('0x32')]),_0x14eb04);if(_0x3b1928[_0x8517('0x30')][_0x8517('0x3b')]){_0x1dd9fb[_0x8517('0x39')]=_[_0x8517('0x3c')](_0x1dd9fb[_0x8517('0x39')],{'$or':_[_0x8517('0x2a')](_0x14eb04,function(_0x183310){if(_0x183310[_0x8517('0x2e')]!==_0x8517('0x3d')){var _0x232e49={};_0x232e49[_0x183310['name']]={'$like':'%'+_0x3b1928['query'][_0x8517('0x3b')]+'%'};return _0x232e49;}})});}_0x1dd9fb=_[_0x8517('0x3c')]({},_0x1dd9fb,_0x3b1928[_0x8517('0x3e')]);var _0x30942f={'where':_0x1dd9fb[_0x8517('0x39')]};return db['Tag'][_0x8517('0x1e')](_0x30942f)[_0x8517('0x22')](function(_0x531ca7){_0x3cf945[_0x8517('0x1e')]=_0x531ca7;if(_0x3b1928[_0x8517('0x30')][_0x8517('0x3f')]){_0x1dd9fb[_0x8517('0x40')]=[{'all':!![]}];}return db['Tag'][_0x8517('0x41')](_0x1dd9fb);})[_0x8517('0x22')](function(_0x5c342c){_0x3cf945[_0x8517('0x42')]=_0x5c342c;return _0x3cf945;})[_0x8517('0x22')](respondWithFilteredResult(_0x4b9983,_0x1dd9fb))[_0x8517('0x43')](handleError(_0x4b9983,null));};exports['show']=function(_0x368bb8,_0x31c0b9){var _0x35adf2={'raw':!![],'where':{'id':_0x368bb8[_0x8517('0x44')]['id']}},_0x404a40={};_0x404a40[_0x8517('0x34')]=_[_0x8517('0x31')](db['Tag'][_0x8517('0x2c')]);_0x404a40[_0x8517('0x30')]=_['keys'](_0x368bb8[_0x8517('0x30')]);_0x404a40[_0x8517('0x32')]=_[_0x8517('0x33')](_0x404a40[_0x8517('0x34')],_0x404a40[_0x8517('0x30')]);_0x35adf2[_0x8517('0x35')]=_['intersection'](_0x404a40[_0x8517('0x34')],qs[_0x8517('0x45')](_0x368bb8[_0x8517('0x30')]['fields']));_0x35adf2[_0x8517('0x35')]=_0x35adf2[_0x8517('0x35')]['length']?_0x35adf2[_0x8517('0x35')]:_0x404a40[_0x8517('0x34')];if(_0x368bb8['query']['includeAll']){_0x35adf2['include']=[{'all':!![]}];}_0x35adf2=_[_0x8517('0x3c')]({},_0x35adf2,_0x368bb8[_0x8517('0x3e')]);return db['Tag'][_0x8517('0x46')](_0x35adf2)['then'](handleEntityNotFound(_0x31c0b9,null))['then'](respondWithResult(_0x31c0b9,null))[_0x8517('0x43')](handleError(_0x31c0b9,null));};exports[_0x8517('0x47')]=function(_0x3c8ecb,_0x6c2607){return db['Tag'][_0x8517('0x47')](_0x3c8ecb[_0x8517('0x48')],{})[_0x8517('0x22')](function(_0x5a6812){var _0x15102f=_0x3c8ecb[_0x8517('0x49')][_0x8517('0x24')]({'plain':!![]});if(!_0x15102f)throw new Error(_0x8517('0x4a'));if(_0x15102f[_0x8517('0x4b')]===_0x8517('0x49')){var _0x3cccd9=_0x5a6812['get']({'plain':!![]});var _0x3a5adb='Tags';return db['UserProfileSection'][_0x8517('0x46')]({'where':{'name':_0x3a5adb,'userProfileId':_0x15102f[_0x8517('0x4c')]},'raw':!![]})[_0x8517('0x22')](function(_0x2d604f){if(_0x2d604f&&_0x2d604f['autoAssociation']===0x0){return db[_0x8517('0x25')][_0x8517('0x47')]({'name':_0x3cccd9['name'],'resourceId':_0x3cccd9['id'],'type':_0x2d604f['name'],'sectionId':_0x2d604f['id']},{})[_0x8517('0x22')](function(){return _0x5a6812;});}else{return _0x5a6812;}})[_0x8517('0x43')](function(_0x28c1fb){logger['error'](_0x8517('0x4d'),_0x28c1fb);throw _0x28c1fb;});}return _0x5a6812;})['then'](respondWithResult(_0x6c2607,0xc9))[_0x8517('0x43')](handleError(_0x6c2607,null));};exports[_0x8517('0x21')]=function(_0x1ba2f,_0x58c98b){if(_0x1ba2f[_0x8517('0x48')]['id']){delete _0x1ba2f[_0x8517('0x48')]['id'];}return db[_0x8517('0x2b')][_0x8517('0x46')]({'where':{'id':_0x1ba2f[_0x8517('0x44')]['id']}})['then'](handleEntityNotFound(_0x58c98b,null))['then'](saveUpdates(_0x1ba2f[_0x8517('0x48')],null))[_0x8517('0x22')](respondWithResult(_0x58c98b,null))[_0x8517('0x43')](handleError(_0x58c98b,null));};exports['destroy']=function(_0x4dcf7b,_0x1ce476){return db[_0x8517('0x2b')]['find']({'where':{'id':_0x4dcf7b['params']['id']}})[_0x8517('0x22')](handleEntityNotFound(_0x1ce476,null))[_0x8517('0x22')](removeEntity(_0x1ce476,null))[_0x8517('0x43')](handleError(_0x1ce476,null));}; \ No newline at end of file +var _0x0a12=['name','send','index','map','Tag','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','options','then','includeAll','include','rawAttributes','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','destroy','error','stack'];(function(_0x6e4f7,_0x966b73){var _0x411429=function(_0x3cb416){while(--_0x3cb416){_0x6e4f7['push'](_0x6e4f7['shift']());}};_0x411429(++_0x966b73);}(_0x0a12,0xb8));var _0x20a1=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x0a12[_0x1c8c28];return _0x1f59b4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x20a1('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x20a1('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x20a1('0x2'));var util=require(_0x20a1('0x3'));var path=require(_0x20a1('0x4'));var sox=require(_0x20a1('0x5'));var csv=require(_0x20a1('0x6'));var ejs=require(_0x20a1('0x7'));var fs=require('fs');var fs_extra=require(_0x20a1('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x20a1('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x20a1('0x6'));var querystring=require(_0x20a1('0xa'));var Papa=require(_0x20a1('0xb'));var Redis=require(_0x20a1('0xc'));var authService=require(_0x20a1('0xd'));var qs=require(_0x20a1('0xe'));var as=require(_0x20a1('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x20a1('0x10'))(_0x20a1('0x11'));var utils=require(_0x20a1('0x12'));var config=require(_0x20a1('0x13'));var licenseUtil=require(_0x20a1('0x14'));var db=require(_0x20a1('0x15'))['db'];function respondWithStatusCode(_0x53a689,_0x77a193){_0x77a193=_0x77a193||0xcc;return function(_0xfe130a){if(_0xfe130a){return _0x53a689[_0x20a1('0x16')](_0x77a193);}return _0x53a689[_0x20a1('0x17')](_0x77a193)[_0x20a1('0x18')]();};}function respondWithResult(_0x32f1f9,_0x3c2c9f){_0x3c2c9f=_0x3c2c9f||0xc8;return function(_0x55feb0){if(_0x55feb0){return _0x32f1f9[_0x20a1('0x17')](_0x3c2c9f)[_0x20a1('0x19')](_0x55feb0);}};}function respondWithFilteredResult(_0xb736e9,_0x401178){return function(_0x1e6ae6){if(_0x1e6ae6){var _0xec799b=typeof _0x401178['offset']==='undefined'&&typeof _0x401178['limit']==='undefined';var _0x5925d4=_0x1e6ae6['count'];var _0x5c00a6=_0xec799b?0x0:_0x401178['offset'];var _0x4a68c5=_0xec799b?_0x1e6ae6[_0x20a1('0x1a')]:_0x401178[_0x20a1('0x1b')]+_0x401178[_0x20a1('0x1c')];var _0xf5d655;if(_0x4a68c5>=_0x5925d4){_0x4a68c5=_0x5925d4;_0xf5d655=0xc8;}else{_0xf5d655=0xce;}_0xb736e9[_0x20a1('0x17')](_0xf5d655);return _0xb736e9[_0x20a1('0x1d')]('Content-Range',_0x5c00a6+'-'+_0x4a68c5+'/'+_0x5925d4)['json'](_0x1e6ae6);}return null;};}function patchUpdates(_0x463968){return function(_0xce4fc4){try{jsonpatch[_0x20a1('0x1e')](_0xce4fc4,_0x463968,!![]);}catch(_0x4f7590){return BPromise['reject'](_0x4f7590);}return _0xce4fc4[_0x20a1('0x1f')]();};}function saveUpdates(_0x2969cd,_0x9089cc){return function(_0x16605d){if(_0x16605d){return _0x16605d['update'](_0x2969cd)['then'](function(_0x4e0100){return _0x4e0100;});}return null;};}function removeEntity(_0x48eb5d,_0x67313c){return function(_0x2f81a8){if(_0x2f81a8){return _0x2f81a8[_0x20a1('0x20')]()['then'](function(){var _0x10a600=_0x2f81a8['get']({'plain':!![]});var _0x11b83c='Tags';return db['UserProfileResource']['destroy']({'where':{'type':_0x11b83c,'resourceId':_0x10a600['id']}})['then'](function(){return _0x2f81a8;});})['then'](function(){_0x48eb5d[_0x20a1('0x17')](0xcc)[_0x20a1('0x18')]();});}};}function handleEntityNotFound(_0x24d1e2,_0xee9dd8){return function(_0x3927b2){if(!_0x3927b2){_0x24d1e2[_0x20a1('0x16')](0x194);}return _0x3927b2;};}function handleError(_0x5a1352,_0x3697f8){_0x3697f8=_0x3697f8||0x1f4;return function(_0x47877f){logger[_0x20a1('0x21')](_0x47877f[_0x20a1('0x22')]);if(_0x47877f['name']){delete _0x47877f[_0x20a1('0x23')];}_0x5a1352['status'](_0x3697f8)[_0x20a1('0x24')](_0x47877f);};}exports[_0x20a1('0x25')]=function(_0x184a3d,_0x1cdc2c){var _0xe8e6d1={},_0x22627a={},_0x13d9ea={'count':0x0,'rows':[]};var _0x2f6dd0=_[_0x20a1('0x26')](db[_0x20a1('0x27')]['rawAttributes'],function(_0x1e6b14){return{'name':_0x1e6b14['fieldName'],'type':_0x1e6b14['type'][_0x20a1('0x28')]};});_0x22627a[_0x20a1('0x29')]=_[_0x20a1('0x26')](_0x2f6dd0,_0x20a1('0x23'));_0x22627a['query']=_[_0x20a1('0x2a')](_0x184a3d[_0x20a1('0x2b')]);_0x22627a[_0x20a1('0x2c')]=_[_0x20a1('0x2d')](_0x22627a['model'],_0x22627a[_0x20a1('0x2b')]);_0xe8e6d1['attributes']=_['intersection'](_0x22627a[_0x20a1('0x29')],qs[_0x20a1('0x2e')](_0x184a3d[_0x20a1('0x2b')][_0x20a1('0x2e')]));_0xe8e6d1['attributes']=_0xe8e6d1[_0x20a1('0x2f')][_0x20a1('0x30')]?_0xe8e6d1['attributes']:_0x22627a[_0x20a1('0x29')];if(!_0x184a3d[_0x20a1('0x2b')][_0x20a1('0x31')]('nolimit')){_0xe8e6d1['limit']=qs[_0x20a1('0x1c')](_0x184a3d[_0x20a1('0x2b')][_0x20a1('0x1c')]);_0xe8e6d1[_0x20a1('0x1b')]=qs[_0x20a1('0x1b')](_0x184a3d[_0x20a1('0x2b')][_0x20a1('0x1b')]);}_0xe8e6d1[_0x20a1('0x32')]=qs['sort'](_0x184a3d[_0x20a1('0x2b')][_0x20a1('0x33')]);_0xe8e6d1[_0x20a1('0x34')]=qs[_0x20a1('0x2c')](_[_0x20a1('0x35')](_0x184a3d['query'],_0x22627a[_0x20a1('0x2c')]),_0x2f6dd0);if(_0x184a3d['query'][_0x20a1('0x36')]){_0xe8e6d1[_0x20a1('0x34')]=_['merge'](_0xe8e6d1[_0x20a1('0x34')],{'$or':_['map'](_0x2f6dd0,function(_0x12a6ed){if(_0x12a6ed['type']!=='VIRTUAL'){var _0xe1b39b={};_0xe1b39b[_0x12a6ed[_0x20a1('0x23')]]={'$like':'%'+_0x184a3d[_0x20a1('0x2b')][_0x20a1('0x36')]+'%'};return _0xe1b39b;}})});}_0xe8e6d1=_['merge']({},_0xe8e6d1,_0x184a3d[_0x20a1('0x37')]);var _0x1d2aab={'where':_0xe8e6d1['where']};return db[_0x20a1('0x27')][_0x20a1('0x1a')](_0x1d2aab)[_0x20a1('0x38')](function(_0x2c2f12){_0x13d9ea[_0x20a1('0x1a')]=_0x2c2f12;if(_0x184a3d['query'][_0x20a1('0x39')]){_0xe8e6d1[_0x20a1('0x3a')]=[{'all':!![]}];}return db[_0x20a1('0x27')]['findAll'](_0xe8e6d1);})[_0x20a1('0x38')](function(_0x40b931){_0x13d9ea['rows']=_0x40b931;return _0x13d9ea;})[_0x20a1('0x38')](respondWithFilteredResult(_0x1cdc2c,_0xe8e6d1))['catch'](handleError(_0x1cdc2c,null));};exports['show']=function(_0x55133c,_0x4cc2d6){var _0x26c023={'raw':!![],'where':{'id':_0x55133c['params']['id']}},_0x29968a={};_0x29968a['model']=_['keys'](db[_0x20a1('0x27')][_0x20a1('0x3b')]);_0x29968a[_0x20a1('0x2b')]=_['keys'](_0x55133c[_0x20a1('0x2b')]);_0x29968a[_0x20a1('0x2c')]=_[_0x20a1('0x2d')](_0x29968a[_0x20a1('0x29')],_0x29968a[_0x20a1('0x2b')]);_0x26c023['attributes']=_['intersection'](_0x29968a['model'],qs[_0x20a1('0x2e')](_0x55133c[_0x20a1('0x2b')]['fields']));_0x26c023[_0x20a1('0x2f')]=_0x26c023[_0x20a1('0x2f')][_0x20a1('0x30')]?_0x26c023['attributes']:_0x29968a[_0x20a1('0x29')];if(_0x55133c['query'][_0x20a1('0x39')]){_0x26c023[_0x20a1('0x3a')]=[{'all':!![]}];}_0x26c023=_['merge']({},_0x26c023,_0x55133c[_0x20a1('0x37')]);return db[_0x20a1('0x27')]['find'](_0x26c023)[_0x20a1('0x38')](handleEntityNotFound(_0x4cc2d6,null))[_0x20a1('0x38')](respondWithResult(_0x4cc2d6,null))['catch'](handleError(_0x4cc2d6,null));};exports[_0x20a1('0x3c')]=function(_0x85cbfd,_0xa74b57){return db['Tag'][_0x20a1('0x3c')](_0x85cbfd[_0x20a1('0x3d')],{})[_0x20a1('0x38')](function(_0x543408){var _0x1d605c=_0x85cbfd['user'][_0x20a1('0x3e')]({'plain':!![]});if(!_0x1d605c)throw new Error(_0x20a1('0x3f'));if(_0x1d605c[_0x20a1('0x40')]===_0x20a1('0x41')){var _0x19bb8d=_0x543408[_0x20a1('0x3e')]({'plain':!![]});var _0x3008ff='Tags';return db[_0x20a1('0x42')][_0x20a1('0x43')]({'where':{'name':_0x3008ff,'userProfileId':_0x1d605c['userProfileId']},'raw':!![]})[_0x20a1('0x38')](function(_0x4abddc){if(_0x4abddc&&_0x4abddc[_0x20a1('0x44')]===0x0){return db[_0x20a1('0x45')]['create']({'name':_0x19bb8d[_0x20a1('0x23')],'resourceId':_0x19bb8d['id'],'type':_0x4abddc[_0x20a1('0x23')],'sectionId':_0x4abddc['id']},{})[_0x20a1('0x38')](function(){return _0x543408;});}else{return _0x543408;}})[_0x20a1('0x46')](function(_0x4003d5){logger[_0x20a1('0x21')](_0x20a1('0x47'),_0x4003d5);throw _0x4003d5;});}return _0x543408;})[_0x20a1('0x38')](respondWithResult(_0xa74b57,0xc9))[_0x20a1('0x46')](handleError(_0xa74b57,null));};exports['update']=function(_0xd4cd57,_0x24c197){if(_0xd4cd57[_0x20a1('0x3d')]['id']){delete _0xd4cd57[_0x20a1('0x3d')]['id'];}return db['Tag'][_0x20a1('0x43')]({'where':{'id':_0xd4cd57[_0x20a1('0x48')]['id']}})['then'](handleEntityNotFound(_0x24c197,null))[_0x20a1('0x38')](saveUpdates(_0xd4cd57['body'],null))[_0x20a1('0x38')](respondWithResult(_0x24c197,null))[_0x20a1('0x46')](handleError(_0x24c197,null));};exports[_0x20a1('0x20')]=function(_0x2cfd78,_0x12c17c){return db[_0x20a1('0x27')][_0x20a1('0x43')]({'where':{'id':_0x2cfd78[_0x20a1('0x48')]['id']}})[_0x20a1('0x38')](handleEntityNotFound(_0x12c17c,null))[_0x20a1('0x38')](removeEntity(_0x12c17c,null))[_0x20a1('0x46')](handleError(_0x12c17c,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 2453220..595a079 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 _0xd5a5=['../../config/environment','./tag.attributes','exports','Tag','tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2e6006,_0x314c29){var _0x701665=function(_0x219014){while(--_0x219014){_0x2e6006['push'](_0x2e6006['shift']());}};_0x701665(++_0x314c29);}(_0xd5a5,0x89));var _0x5d5a=function(_0xcde43f,_0x303e64){_0xcde43f=_0xcde43f-0x0;var _0x2aa821=_0xd5a5[_0xcde43f];return _0x2aa821;};'use strict';var _=require(_0x5d5a('0x0'));var util=require('util');var logger=require(_0x5d5a('0x1'))(_0x5d5a('0x2'));var moment=require(_0x5d5a('0x3'));var BPromise=require(_0x5d5a('0x4'));var rp=require(_0x5d5a('0x5'));var fs=require('fs');var path=require(_0x5d5a('0x6'));var rimraf=require('rimraf');var config=require(_0x5d5a('0x7'));var attributes=require(_0x5d5a('0x8'));module[_0x5d5a('0x9')]=function(_0x48c96c,_0x28b7db){return _0x48c96c['define'](_0x5d5a('0xa'),attributes,{'tableName':_0x5d5a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x302c=['tools_tags','lodash','util','api','moment','bluebird','path','rimraf','exports','define','Tag'];(function(_0x5c6781,_0x51e500){var _0x261cbd=function(_0x1a10a0){while(--_0x1a10a0){_0x5c6781['push'](_0x5c6781['shift']());}};_0x261cbd(++_0x51e500);}(_0x302c,0x140));var _0xc302=function(_0x784fec,_0x3f7922){_0x784fec=_0x784fec-0x0;var _0x33975e=_0x302c[_0x784fec];return _0x33975e;};'use strict';var _=require(_0xc302('0x0'));var util=require(_0xc302('0x1'));var logger=require('../../config/logger')(_0xc302('0x2'));var moment=require(_0xc302('0x3'));var BPromise=require(_0xc302('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc302('0x5'));var rimraf=require(_0xc302('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0xc302('0x7')]=function(_0xaac829,_0x181a18){return _0xaac829[_0xc302('0x8')](_0xc302('0x9'),attributes,{'tableName':_0xc302('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 2371d3b..2d3fb83 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 _0x0e9f=['debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','util','randomstring','../../config/utils','../../config/environment','jayson/promise','http','then','info','request\x20sent'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0x0e9f,0x116));var _0xf0e9=function(_0x37cece,_0x11b4fb){_0x37cece=_0x37cece-0x0;var _0x1ff647=_0x0e9f[_0x37cece];return _0x1ff647;};'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')]('Tag,\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')]('Tag,\x20%s,\x20%s',_0x3f9792,_0x3d0b4d);_0x58edfe(_0x3d0b4d);});});} \ No newline at end of file +var _0x919e=['client','http','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','Tag,\x20%s,\x20%s','message','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ffd7b,_0x53d9dc){var _0x20056b=function(_0x5382af){while(--_0x5382af){_0x1ffd7b['push'](_0x1ffd7b['shift']());}};_0x20056b(++_0x53d9dc);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe919('0x0'));var util=require(_0xe919('0x1'));var moment=require(_0xe919('0x2'));var BPromise=require('bluebird');var rs=require(_0xe919('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe919('0x4'));var logger=require(_0xe919('0x5'))(_0xe919('0x6'));var config=require(_0xe919('0x7'));var jayson=require(_0xe919('0x8'));var client=jayson[_0xe919('0x9')][_0xe919('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x493b47,_0x7c1fa4,_0x2ceb41){return new BPromise(function(_0x57c3fe,_0x44d418){return client['request'](_0x493b47,_0x2ceb41)[_0xe919('0xb')](function(_0x22ea65){logger[_0xe919('0xc')]('Tag,\x20%s,\x20%s',_0x7c1fa4,_0xe919('0xd'));logger[_0xe919('0xe')](_0xe919('0xf'),_0x7c1fa4,'request\x20sent',JSON[_0xe919('0x10')](_0x22ea65));if(_0x22ea65['error']){if(_0x22ea65['error']['code']===0x1f4){logger[_0xe919('0x11')](_0xe919('0x12'),_0x7c1fa4,_0x22ea65[_0xe919('0x11')]['message']);return _0x44d418(_0x22ea65['error'][_0xe919('0x13')]);}logger[_0xe919('0x11')]('Tag,\x20%s,\x20%s',_0x7c1fa4,_0x22ea65[_0xe919('0x11')][_0xe919('0x13')]);return _0x57c3fe(_0x22ea65[_0xe919('0x11')][_0xe919('0x13')]);}else{logger[_0xe919('0xc')](_0xe919('0x12'),_0x7c1fa4,_0xe919('0xd'));_0x57c3fe(_0x22ea65['result'][_0xe919('0x13')]);}})['catch'](function(_0x5ba7ad){logger[_0xe919('0x11')](_0xe919('0x12'),_0x7c1fa4,_0x5ba7ad);_0x44d418(_0x5ba7ad);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 9c26f7e..323d6f4 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 9d56c82..b2fbc8b 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(_0x1bc47c,_0x4b9444){var _0x45dfce=function(_0xd0b04a){while(--_0xd0b04a){_0x1bc47c['push'](_0x1bc47c['shift']());}};_0x45dfce(++_0x4b9444);}(_0x757a,0xde));var _0xa757=function(_0x33655c,_0x14bbb8){_0x33655c=_0x33655c-0x0;var _0x460824=_0x757a[_0x33655c];return _0x460824;};'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 _0x2032=['name','exports','STRING'];(function(_0x21c835,_0x3ee747){var _0x39bb44=function(_0x2f36be){while(--_0x2f36be){_0x21c835['push'](_0x21c835['shift']());}};_0x39bb44(++_0x3ee747);}(_0x2032,0xd9));var _0x2203=function(_0x10ddd1,_0x1bb94d){_0x10ddd1=_0x10ddd1-0x0;var _0x53b8d5=_0x2032[_0x10ddd1];return _0x53b8d5;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index a034243..43ad893 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 _0xe2e1=['penalty','QueueId','emit','Queue:save','User','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','spread','removeAgents','Whatsapp','parse','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','Teams','UserProfileResource','sendStatus','error','stack','name','send','index','map','Team','key','model','query','keys','filters','attributes','fields','length','order','sort','where','filter','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','rawAttributes','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','merge','addQueues','findOne','Sequelize','add','ids','removeQueues','remove','Queues','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','sequelize','transaction','through'];(function(_0x5b1782,_0x273ed7){var _0x4a07cc=function(_0x1d1b3d){while(--_0x1d1b3d){_0x5b1782['push'](_0x5b1782['shift']());}};_0x4a07cc(++_0x273ed7);}(_0xe2e1,0x9e));var _0x1e2e=function(_0x1df644,_0x513cd7){_0x1df644=_0x1df644-0x0;var _0x236bdb=_0xe2e1[_0x1df644];return _0x236bdb;};'use strict';var emlformat=require(_0x1e2e('0x0'));var rimraf=require(_0x1e2e('0x1'));var zipdir=require(_0x1e2e('0x2'));var jsonpatch=require(_0x1e2e('0x3'));var rp=require('request-promise');var moment=require(_0x1e2e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1e2e('0x5'));var util=require(_0x1e2e('0x6'));var path=require(_0x1e2e('0x7'));var sox=require(_0x1e2e('0x8'));var csv=require('to-csv');var ejs=require(_0x1e2e('0x9'));var fs=require('fs');var fs_extra=require(_0x1e2e('0xa'));var _=require(_0x1e2e('0xb'));var squel=require(_0x1e2e('0xc'));var crypto=require(_0x1e2e('0xd'));var jsforce=require(_0x1e2e('0xe'));var deskjs=require(_0x1e2e('0xf'));var toCsv=require(_0x1e2e('0x10'));var querystring=require(_0x1e2e('0x11'));var Papa=require(_0x1e2e('0x12'));var Redis=require(_0x1e2e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x1e2e('0x14'));var as=require(_0x1e2e('0x15'));var hardwareService=require(_0x1e2e('0x16'));var logger=require('../../config/logger')(_0x1e2e('0x17'));var utils=require(_0x1e2e('0x18'));var config=require(_0x1e2e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1e2e('0x1a'))['db'];config[_0x1e2e('0x1b')]=_[_0x1e2e('0x1c')](config['redis'],{'host':_0x1e2e('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1e2e('0x1b')]));require('./team.socket')[_0x1e2e('0x1e')](socket);function respondWithStatusCode(_0x14ad0f,_0x5bd3ce){_0x5bd3ce=_0x5bd3ce||0xcc;return function(_0x3c8ec5){if(_0x3c8ec5){return _0x14ad0f['sendStatus'](_0x5bd3ce);}return _0x14ad0f['status'](_0x5bd3ce)[_0x1e2e('0x1f')]();};}function respondWithResult(_0x2672e0,_0x422f8a){_0x422f8a=_0x422f8a||0xc8;return function(_0x29f0cc){if(_0x29f0cc){return _0x2672e0[_0x1e2e('0x20')](_0x422f8a)[_0x1e2e('0x21')](_0x29f0cc);}};}function respondWithFilteredResult(_0xe8eab3,_0x464e8a){return function(_0x2f4fa3){if(_0x2f4fa3){var _0x133cb3=typeof _0x464e8a[_0x1e2e('0x22')]===_0x1e2e('0x23')&&typeof _0x464e8a[_0x1e2e('0x24')]==='undefined';var _0x3e86a0=_0x2f4fa3['count'];var _0x32787b=_0x133cb3?0x0:_0x464e8a['offset'];var _0xf7b5ef=_0x133cb3?_0x2f4fa3['count']:_0x464e8a[_0x1e2e('0x22')]+_0x464e8a['limit'];var _0x595b00;if(_0xf7b5ef>=_0x3e86a0){_0xf7b5ef=_0x3e86a0;_0x595b00=0xc8;}else{_0x595b00=0xce;}_0xe8eab3[_0x1e2e('0x20')](_0x595b00);return _0xe8eab3[_0x1e2e('0x25')](_0x1e2e('0x26'),_0x32787b+'-'+_0xf7b5ef+'/'+_0x3e86a0)['json'](_0x2f4fa3);}return null;};}function patchUpdates(_0x40cd90){return function(_0x3ca632){try{jsonpatch[_0x1e2e('0x27')](_0x3ca632,_0x40cd90,!![]);}catch(_0x4095eb){return BPromise[_0x1e2e('0x28')](_0x4095eb);}return _0x3ca632[_0x1e2e('0x29')]();};}function saveUpdates(_0x56bc9e,_0x117ab8){return function(_0x3caef6){if(_0x3caef6){return _0x3caef6['update'](_0x56bc9e)[_0x1e2e('0x2a')](function(_0x17ad17){return _0x17ad17;});}return null;};}function removeEntity(_0x50c9a1,_0xa46936){return function(_0x49b31b){if(_0x49b31b){return _0x49b31b[_0x1e2e('0x2b')]()['then'](function(){var _0x44e50d=_0x49b31b[_0x1e2e('0x2c')]({'plain':!![]});var _0x5934fc=_0x1e2e('0x2d');return db[_0x1e2e('0x2e')][_0x1e2e('0x2b')]({'where':{'type':_0x5934fc,'resourceId':_0x44e50d['id']}})[_0x1e2e('0x2a')](function(){return _0x49b31b;});})[_0x1e2e('0x2a')](function(){_0x50c9a1['status'](0xcc)[_0x1e2e('0x1f')]();});}};}function handleEntityNotFound(_0x31fc56,_0x1ac955){return function(_0x13b197){if(!_0x13b197){_0x31fc56[_0x1e2e('0x2f')](0x194);}return _0x13b197;};}function handleError(_0x478148,_0x3e812a){_0x3e812a=_0x3e812a||0x1f4;return function(_0x355ff6){logger[_0x1e2e('0x30')](_0x355ff6[_0x1e2e('0x31')]);if(_0x355ff6[_0x1e2e('0x32')]){delete _0x355ff6[_0x1e2e('0x32')];}_0x478148[_0x1e2e('0x20')](_0x3e812a)[_0x1e2e('0x33')](_0x355ff6);};}exports[_0x1e2e('0x34')]=function(_0x15462a,_0x45d9ef){var _0x258496={},_0x1212f8={},_0x29ac6d={'count':0x0,'rows':[]};var _0x335821=_[_0x1e2e('0x35')](db[_0x1e2e('0x36')]['rawAttributes'],function(_0x3b21ce){return{'name':_0x3b21ce['fieldName'],'type':_0x3b21ce['type'][_0x1e2e('0x37')]};});_0x1212f8[_0x1e2e('0x38')]=_[_0x1e2e('0x35')](_0x335821,_0x1e2e('0x32'));_0x1212f8[_0x1e2e('0x39')]=_[_0x1e2e('0x3a')](_0x15462a[_0x1e2e('0x39')]);_0x1212f8[_0x1e2e('0x3b')]=_['intersection'](_0x1212f8[_0x1e2e('0x38')],_0x1212f8[_0x1e2e('0x39')]);_0x258496[_0x1e2e('0x3c')]=_['intersection'](_0x1212f8[_0x1e2e('0x38')],qs['fields'](_0x15462a[_0x1e2e('0x39')][_0x1e2e('0x3d')]));_0x258496[_0x1e2e('0x3c')]=_0x258496[_0x1e2e('0x3c')][_0x1e2e('0x3e')]?_0x258496[_0x1e2e('0x3c')]:_0x1212f8[_0x1e2e('0x38')];if(!_0x15462a[_0x1e2e('0x39')]['hasOwnProperty']('nolimit')){_0x258496['limit']=qs[_0x1e2e('0x24')](_0x15462a[_0x1e2e('0x39')][_0x1e2e('0x24')]);_0x258496[_0x1e2e('0x22')]=qs['offset'](_0x15462a[_0x1e2e('0x39')][_0x1e2e('0x22')]);}_0x258496[_0x1e2e('0x3f')]=qs[_0x1e2e('0x40')](_0x15462a[_0x1e2e('0x39')][_0x1e2e('0x40')]);_0x258496[_0x1e2e('0x41')]=qs[_0x1e2e('0x3b')](_['pick'](_0x15462a[_0x1e2e('0x39')],_0x1212f8['filters']),_0x335821);if(_0x15462a[_0x1e2e('0x39')][_0x1e2e('0x42')]){_0x258496[_0x1e2e('0x41')]=_['merge'](_0x258496[_0x1e2e('0x41')],{'$or':_['map'](_0x335821,function(_0x3774ef){if(_0x3774ef[_0x1e2e('0x43')]!==_0x1e2e('0x44')){var _0x402aad={};_0x402aad[_0x3774ef[_0x1e2e('0x32')]]={'$like':'%'+_0x15462a[_0x1e2e('0x39')][_0x1e2e('0x42')]+'%'};return _0x402aad;}})});}_0x258496=_['merge']({},_0x258496,_0x15462a[_0x1e2e('0x45')]);var _0x1b87f5={'where':_0x258496[_0x1e2e('0x41')]};return db[_0x1e2e('0x36')][_0x1e2e('0x46')](_0x1b87f5)[_0x1e2e('0x2a')](function(_0x4e209b){_0x29ac6d[_0x1e2e('0x46')]=_0x4e209b;if(_0x15462a[_0x1e2e('0x39')][_0x1e2e('0x47')]){_0x258496[_0x1e2e('0x48')]=[{'all':!![]}];}return db['Team'][_0x1e2e('0x49')](_0x258496);})['then'](function(_0x141b56){_0x29ac6d[_0x1e2e('0x4a')]=_0x141b56;return _0x29ac6d;})[_0x1e2e('0x2a')](respondWithFilteredResult(_0x45d9ef,_0x258496))[_0x1e2e('0x4b')](handleError(_0x45d9ef,null));};exports['show']=function(_0x53dc47,_0x391dc7){var _0x18841c={'raw':![],'where':{'id':_0x53dc47[_0x1e2e('0x4c')]['id']}},_0x4ca050={};_0x4ca050['model']=_['keys'](db[_0x1e2e('0x36')][_0x1e2e('0x4d')]);_0x4ca050[_0x1e2e('0x39')]=_[_0x1e2e('0x3a')](_0x53dc47[_0x1e2e('0x39')]);_0x4ca050['filters']=_[_0x1e2e('0x4e')](_0x4ca050[_0x1e2e('0x38')],_0x4ca050['query']);_0x18841c[_0x1e2e('0x3c')]=_['intersection'](_0x4ca050[_0x1e2e('0x38')],qs['fields'](_0x53dc47[_0x1e2e('0x39')][_0x1e2e('0x3d')]));_0x18841c['attributes']=_0x18841c[_0x1e2e('0x3c')][_0x1e2e('0x3e')]?_0x18841c[_0x1e2e('0x3c')]:_0x4ca050[_0x1e2e('0x38')];if(_0x53dc47[_0x1e2e('0x39')][_0x1e2e('0x47')]){_0x18841c[_0x1e2e('0x48')]=[{'all':!![]}];}_0x18841c=_['merge']({},_0x18841c,_0x53dc47[_0x1e2e('0x45')]);return db['Team'][_0x1e2e('0x4f')](_0x18841c)[_0x1e2e('0x2a')](handleEntityNotFound(_0x391dc7,null))[_0x1e2e('0x2a')](respondWithResult(_0x391dc7,null))[_0x1e2e('0x4b')](handleError(_0x391dc7,null));};exports[_0x1e2e('0x50')]=function(_0x49605c,_0x3680f0){return db[_0x1e2e('0x36')][_0x1e2e('0x50')](_0x49605c[_0x1e2e('0x51')],{})['then'](function(_0xdf12cd){var _0x3ed17e=_0x49605c[_0x1e2e('0x52')]['get']({'plain':!![]});if(!_0x3ed17e)throw new Error(_0x1e2e('0x53'));if(_0x3ed17e[_0x1e2e('0x54')]==='user'){var _0x1ef38b=_0xdf12cd[_0x1e2e('0x2c')]({'plain':!![]});var _0x639977=_0x1e2e('0x2d');return db[_0x1e2e('0x55')][_0x1e2e('0x4f')]({'where':{'name':_0x639977,'userProfileId':_0x3ed17e[_0x1e2e('0x56')]},'raw':!![]})['then'](function(_0x10af4f){if(_0x10af4f&&_0x10af4f['autoAssociation']===0x0){return db[_0x1e2e('0x2e')][_0x1e2e('0x50')]({'name':_0x1ef38b[_0x1e2e('0x32')],'resourceId':_0x1ef38b['id'],'type':_0x10af4f[_0x1e2e('0x32')],'sectionId':_0x10af4f['id']},{})['then'](function(){return _0xdf12cd;});}else{return _0xdf12cd;}})[_0x1e2e('0x4b')](function(_0xbd6e4e){logger['error'](_0x1e2e('0x57'),_0xbd6e4e);throw _0xbd6e4e;});}return _0xdf12cd;})[_0x1e2e('0x2a')](respondWithResult(_0x3680f0,0xc9))['catch'](handleError(_0x3680f0,null));};exports['update']=function(_0x35cae6,_0x2cb9a4){if(_0x35cae6[_0x1e2e('0x51')]['id']){delete _0x35cae6[_0x1e2e('0x51')]['id'];}return db['Team'][_0x1e2e('0x4f')]({'where':{'id':_0x35cae6[_0x1e2e('0x4c')]['id']}})[_0x1e2e('0x2a')](handleEntityNotFound(_0x2cb9a4,null))[_0x1e2e('0x2a')](saveUpdates(_0x35cae6[_0x1e2e('0x51')],null))[_0x1e2e('0x2a')](respondWithResult(_0x2cb9a4,null))[_0x1e2e('0x4b')](handleError(_0x2cb9a4,null));};exports[_0x1e2e('0x2b')]=function(_0x3f9d59,_0x5c076a){return db['Team'][_0x1e2e('0x4f')]({'where':{'id':_0x3f9d59[_0x1e2e('0x4c')]['id']}})[_0x1e2e('0x2a')](handleEntityNotFound(_0x5c076a,null))[_0x1e2e('0x2a')](removeEntity(_0x5c076a,null))['catch'](handleError(_0x5c076a,null));};exports[_0x1e2e('0x58')]=function(_0x66def5,_0x2c8718,_0x32cffc){return db[_0x1e2e('0x36')]['findOne']({'where':{'id':_0x66def5[_0x1e2e('0x4c')]['id']}})[_0x1e2e('0x2a')](handleEntityNotFound(_0x2c8718,null))[_0x1e2e('0x2a')](function(_0x19b61d){if(!_0x66def5[_0x1e2e('0x39')]['channel']||!utils[_0x1e2e('0x59')](_0x66def5[_0x1e2e('0x39')][_0x1e2e('0x5a')])){throw new db['Sequelize'][(_0x1e2e('0x5b'))](_0x1e2e('0x5c'));}var _0x2258d3={};var _0x21b946={};_0x21b946[_0x1e2e('0x38')]=_[_0x1e2e('0x3a')](db[_[_0x1e2e('0x5d')](_0x66def5[_0x1e2e('0x39')][_0x1e2e('0x5a')][_0x1e2e('0x5e')]())+_0x1e2e('0x5f')][_0x1e2e('0x4d')]);_0x21b946['query']=_[_0x1e2e('0x3a')](_0x66def5[_0x1e2e('0x39')]);_0x21b946[_0x1e2e('0x3b')]=_[_0x1e2e('0x4e')](_0x21b946['model'],_0x21b946['query']);_0x2258d3[_0x1e2e('0x3c')]=_[_0x1e2e('0x4e')](_0x21b946['model'],qs[_0x1e2e('0x3d')](_0x66def5[_0x1e2e('0x39')][_0x1e2e('0x3d')]));_0x2258d3['attributes']=_0x2258d3[_0x1e2e('0x3c')][_0x1e2e('0x3e')]?_0x2258d3[_0x1e2e('0x3c')]:_0x21b946[_0x1e2e('0x38')];_0x2258d3[_0x1e2e('0x24')]=qs[_0x1e2e('0x24')](_0x66def5[_0x1e2e('0x39')]['limit']);_0x2258d3[_0x1e2e('0x22')]=qs['offset'](_0x66def5[_0x1e2e('0x39')]['offset']);_0x2258d3['order']=qs[_0x1e2e('0x40')](_0x66def5[_0x1e2e('0x39')][_0x1e2e('0x40')]);_0x2258d3[_0x1e2e('0x41')]=qs[_0x1e2e('0x3b')](_[_0x1e2e('0x60')](_0x66def5[_0x1e2e('0x39')],_0x21b946[_0x1e2e('0x3b')]));_0x2258d3=_[_0x1e2e('0x61')]({},_0x2258d3,_0x66def5[_0x1e2e('0x45')]);return _0x19b61d[_0x1e2e('0x2c')+_['capitalize'](_0x66def5[_0x1e2e('0x39')][_0x1e2e('0x5a')][_0x1e2e('0x5e')]())+'Queues'](_0x2258d3);})['then'](respondWithResult(_0x2c8718,null))[_0x1e2e('0x4b')](handleError(_0x2c8718,null));};exports[_0x1e2e('0x62')]=function(_0xf929f7,_0x469c74,_0x30e114){return db[_0x1e2e('0x36')][_0x1e2e('0x63')]({'where':{'id':_0xf929f7[_0x1e2e('0x4c')]['id']}})[_0x1e2e('0x2a')](function(_0x5c95be){if(_0x5c95be){if(!_0xf929f7[_0x1e2e('0x51')][_0x1e2e('0x5a')]||!utils[_0x1e2e('0x59')](_0xf929f7[_0x1e2e('0x51')][_0x1e2e('0x5a')])){throw new db[(_0x1e2e('0x64'))][(_0x1e2e('0x5b'))](_0x1e2e('0x5c'));}return _0x5c95be[_0x1e2e('0x65')+_[_0x1e2e('0x5d')](_0xf929f7[_0x1e2e('0x51')][_0x1e2e('0x5a')][_0x1e2e('0x5e')]())+'Queues'](_0xf929f7[_0x1e2e('0x51')][_0x1e2e('0x66')]);}return null;})[_0x1e2e('0x2a')](handleEntityNotFound(_0x469c74,null))[_0x1e2e('0x2a')](respondWithStatusCode(_0x469c74,null))[_0x1e2e('0x4b')](handleError(_0x469c74,null));};exports[_0x1e2e('0x67')]=function(_0x39a074,_0x240cd9,_0x3d53d4){return db[_0x1e2e('0x36')]['findOne']({'where':{'id':_0x39a074['params']['id']}})['then'](function(_0x177132){if(_0x177132){if(!_0x39a074['query'][_0x1e2e('0x5a')]||!utils[_0x1e2e('0x59')](_0x39a074[_0x1e2e('0x39')][_0x1e2e('0x5a')])){throw new db[(_0x1e2e('0x64'))][(_0x1e2e('0x5b'))](_0x1e2e('0x5c'));}return _0x177132[_0x1e2e('0x68')+_[_0x1e2e('0x5d')](_0x39a074['query'][_0x1e2e('0x5a')]['toLowerCase']())+_0x1e2e('0x69')](_0x39a074['query'][_0x1e2e('0x66')]);}return null;})[_0x1e2e('0x2a')](handleEntityNotFound(_0x240cd9,null))[_0x1e2e('0x2a')](respondWithStatusCode(_0x240cd9,null))[_0x1e2e('0x4b')](handleError(_0x240cd9,null));};exports[_0x1e2e('0x6a')]=function(_0x4470ae,_0x183993){return db[_0x1e2e('0x36')][_0x1e2e('0x4f')]({'where':{'id':_0x4470ae[_0x1e2e('0x4c')]['id']}})[_0x1e2e('0x2a')](handleEntityNotFound(_0x183993,null))[_0x1e2e('0x2a')](function(_0xb62583){if(_0xb62583){var _0x2e3d4a=[_0x1e2e('0x6b'),_0x1e2e('0x6c'),_0x1e2e('0x6d'),_0x1e2e('0x6e'),_0x1e2e('0x6f'),_0x1e2e('0x70'),'Whatsapp'];return db[_0x1e2e('0x71')][_0x1e2e('0x72')](function(_0x3146be){var _0x55eb4f=_[_0x1e2e('0x35')](_0x2e3d4a,function(_0x448a90){var _0x5559e9={'attributes':['id',_0x1e2e('0x32')]};if(_0x448a90===_0x1e2e('0x6b')){_0x5559e9[_0x1e2e('0x73')]={'attributes':[_0x1e2e('0x74')]};}return _0xb62583[_0x1e2e('0x2c')+_0x448a90+'Queues'](_0x5559e9)[_0x1e2e('0x2a')](function(_0x549696){var _0x30543a=_[_0x1e2e('0x35')](_0x549696,function(_0x2b6692){var _0x27b7b5=_[_0x1e2e('0x35')](_0x4470ae[_0x1e2e('0x51')][_0x1e2e('0x66')],function(_0x200127){var _0x4ef99d={'where':{'UserId':_0x200127,[_0x448a90+_0x1e2e('0x75')]:_0x2b6692['id']},'transaction':_0x3146be};if(_0x448a90==='Voice'){_0x4ef99d[_0x1e2e('0x1c')]={'penalty':_0x2b6692['TeamVoiceQueue'][_0x1e2e('0x74')]};}return db['User'+_0x448a90+_0x1e2e('0x5f')]['findOrCreate'](_0x4ef99d)[_0x1e2e('0x2a')](function(){socket[_0x1e2e('0x76')](_0x1e2e('0x52')+_0x448a90+_0x1e2e('0x77'),{'UserId':_0x200127,[_0x448a90+'QueueId']:_0x2b6692['id']});if(_0x448a90!==_0x1e2e('0x6b'))return;return db[_0x1e2e('0x78')][_0x1e2e('0x49')]({'where':{'id':_0x4470ae[_0x1e2e('0x51')]['ids'],'online':0x1},'attributes':['id',_0x1e2e('0x32'),'online',_0x1e2e('0x79'),_0x1e2e('0x7a')],'raw':!![]})['then'](function(_0x4dba45){var _0xba9e5e=_[_0x1e2e('0x35')](_0x4dba45,function(_0x5a2bdc){return db[_0x1e2e('0x7b')][_0x1e2e('0x7c')]({'membername':_0x5a2bdc[_0x1e2e('0x32')],'UserId':_0x5a2bdc['id'],'queue_name':_0x2b6692[_0x1e2e('0x32')],'VoiceQueueId':_0x2b6692['id'],'interface':_[_0x1e2e('0x7d')](_0x5a2bdc[_0x1e2e('0x7a')])?util[_0x1e2e('0x7e')](_0x1e2e('0x7f'),_0x5a2bdc[_0x1e2e('0x32')]):_0x5a2bdc[_0x1e2e('0x7a')],'paused':_0x5a2bdc[_0x1e2e('0x79')]||![],'penalty':_0x2b6692[_0x1e2e('0x80')][_0x1e2e('0x74')]},{'transaction':_0x3146be});});return Promise[_0x1e2e('0x81')](_0xba9e5e);});});});return Promise[_0x1e2e('0x81')](_0x27b7b5);});return Promise[_0x1e2e('0x81')](_0x30543a);});});return Promise['all'](_0x55eb4f)[_0x1e2e('0x2a')](function(){return _0xb62583[_0x1e2e('0x6a')](_0x4470ae['body'][_0x1e2e('0x66')],{'transaction':_0x3146be})[_0x1e2e('0x82')](function(_0x184ece){return _0x184ece;});});});}})[_0x1e2e('0x2a')](respondWithResult(_0x183993,null))[_0x1e2e('0x4b')](handleError(_0x183993,null));};exports[_0x1e2e('0x83')]=function(_0x3dcd0f,_0x1509ab){return db[_0x1e2e('0x36')][_0x1e2e('0x4f')]({'where':{'id':_0x3dcd0f[_0x1e2e('0x4c')]['id']}})[_0x1e2e('0x2a')](handleEntityNotFound(_0x1509ab,null))[_0x1e2e('0x2a')](function(_0x4055f9){if(_0x4055f9){var _0x1e95c3=[_0x1e2e('0x6b'),_0x1e2e('0x6c'),_0x1e2e('0x6d'),_0x1e2e('0x6e'),_0x1e2e('0x6f'),_0x1e2e('0x70'),_0x1e2e('0x84')];return db['sequelize'][_0x1e2e('0x72')](function(_0x4fd5b5){var _0x7fa2cd=_[_0x1e2e('0x35')](_0x1e95c3,function(_0x2cd2c5){var _0x2d73db={'attributes':['id',_0x1e2e('0x32')]};return _0x4055f9[_0x1e2e('0x2c')+_0x2cd2c5+_0x1e2e('0x69')](_0x2d73db)[_0x1e2e('0x2a')](function(_0x594751){var _0x21fc3f=_[_0x1e2e('0x35')](_0x594751,function(_0x1fdc60){return _0x1fdc60[_0x1e2e('0x83')](_0x3dcd0f[_0x1e2e('0x39')]['ids'],{'transaction':_0x4fd5b5})[_0x1e2e('0x2a')](function(){var _0x1a2489=JSON[_0x1e2e('0x85')]('['+_0x3dcd0f['query'][_0x1e2e('0x66')]+']');var _0x131897=_[_0x1e2e('0x35')](_0x1a2489,function(_0x955122){socket['emit'](_0x1e2e('0x52')+_0x2cd2c5+'Queue:remove',{'UserId':Number(_0x955122),[_0x2cd2c5+_0x1e2e('0x75')]:_0x1fdc60['id']});if(_0x2cd2c5!==_0x1e2e('0x6b'))return;return db['UserVoiceQueueRt'][_0x1e2e('0x2b')]({'where':{'VoiceQueueId':_0x1fdc60['id'],'UserId':_0x955122},'transaction':_0x4fd5b5});});return Promise[_0x1e2e('0x81')](_0x131897);});});return Promise[_0x1e2e('0x81')](_0x21fc3f);});});return Promise[_0x1e2e('0x81')](_0x7fa2cd)[_0x1e2e('0x2a')](function(){return _0x4055f9[_0x1e2e('0x83')](_0x3dcd0f[_0x1e2e('0x39')][_0x1e2e('0x66')],{'transaction':_0x4fd5b5});});});}})['then'](respondWithStatusCode(_0x1509ab,null))[_0x1e2e('0x4b')](handleError(_0x1509ab,null));};exports['getAgents']=function(_0x50e5c4,_0x29c77a,_0x299bda){var _0x4ce1a5={};var _0x1b872e={};var _0x4f8480;var _0xcba2;return db[_0x1e2e('0x36')][_0x1e2e('0x63')]({'where':{'id':_0x50e5c4[_0x1e2e('0x4c')]['id']}})[_0x1e2e('0x2a')](handleEntityNotFound(_0x29c77a,null))['then'](function(_0x26076c){if(_0x26076c){_0x4f8480=_0x26076c;_0x1b872e[_0x1e2e('0x38')]=_[_0x1e2e('0x3a')](db['User']['rawAttributes']);_0x1b872e[_0x1e2e('0x39')]=_[_0x1e2e('0x3a')](_0x50e5c4[_0x1e2e('0x39')]);_0x1b872e[_0x1e2e('0x3b')]=_[_0x1e2e('0x4e')](_0x1b872e[_0x1e2e('0x38')],_0x1b872e[_0x1e2e('0x39')]);_0x4ce1a5['attributes']=_[_0x1e2e('0x4e')](_0x1b872e[_0x1e2e('0x38')],qs[_0x1e2e('0x3d')](_0x50e5c4[_0x1e2e('0x39')][_0x1e2e('0x3d')]));_0x4ce1a5[_0x1e2e('0x3c')]=_0x4ce1a5['attributes'][_0x1e2e('0x3e')]?_0x4ce1a5[_0x1e2e('0x3c')]:_0x1b872e['model'];_0x4ce1a5[_0x1e2e('0x3f')]=qs['sort'](_0x50e5c4[_0x1e2e('0x39')][_0x1e2e('0x40')]);_0x4ce1a5['where']=qs[_0x1e2e('0x3b')](_[_0x1e2e('0x60')](_0x50e5c4[_0x1e2e('0x39')],_0x1b872e[_0x1e2e('0x3b')]));if(_0x50e5c4[_0x1e2e('0x39')]['filter']){_0x4ce1a5[_0x1e2e('0x41')]=_['merge'](_0x4ce1a5['where'],{'$or':_[_0x1e2e('0x35')](_0x4ce1a5[_0x1e2e('0x3c')],function(_0x1e8d61){var _0x15b632={};_0x15b632[_0x1e8d61]={'$like':'%'+_0x50e5c4[_0x1e2e('0x39')][_0x1e2e('0x42')]+'%'};return _0x15b632;})});}_0x4ce1a5=_[_0x1e2e('0x61')]({},_0x4ce1a5,_0x50e5c4[_0x1e2e('0x45')]);return _0x4f8480[_0x1e2e('0x86')](_0x4ce1a5);}})[_0x1e2e('0x2a')](function(_0x254936){if(_0x254936){_0xcba2=_0x254936[_0x1e2e('0x3e')];if(!_0x50e5c4[_0x1e2e('0x39')][_0x1e2e('0x87')](_0x1e2e('0x88'))){_0x4ce1a5[_0x1e2e('0x24')]=qs['limit'](_0x50e5c4[_0x1e2e('0x39')][_0x1e2e('0x24')]);_0x4ce1a5['offset']=qs[_0x1e2e('0x22')](_0x50e5c4[_0x1e2e('0x39')][_0x1e2e('0x22')]);}return _0x4f8480[_0x1e2e('0x86')](_0x4ce1a5);}})[_0x1e2e('0x2a')](function(_0x1e7049){if(_0x1e7049){return _0x1e7049?{'count':_0xcba2,'rows':_0x1e7049}:null;}})[_0x1e2e('0x2a')](respondWithResult(_0x29c77a,null))[_0x1e2e('0x4b')](handleError(_0x29c77a,null));}; \ No newline at end of file +var _0xd201=['api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','Team','includeAll','include','findAll','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','find','userProfileId','autoAssociation','getQueues','findOne','channel','Sequelize','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','ValidationError','add','ids','removeQueues','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','penalty','QueueId','TeamVoiceQueue','findOrCreate','emit','User','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','voicePause','all','removeAgents','parse','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x219d87,_0x1cb6f7){var _0x22823d=function(_0x5357bf){while(--_0x5357bf){_0x219d87['push'](_0x219d87['shift']());}};_0x22823d(++_0x1cb6f7);}(_0xd201,0x17a));var _0x1d20=function(_0x110c54,_0xa3cfcb){_0x110c54=_0x110c54-0x0;var _0x58a348=_0xd201[_0x110c54];return _0x58a348;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1d20('0x0'));var zipdir=require(_0x1d20('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d20('0x2'));var moment=require(_0x1d20('0x3'));var BPromise=require(_0x1d20('0x4'));var Mustache=require(_0x1d20('0x5'));var util=require(_0x1d20('0x6'));var path=require(_0x1d20('0x7'));var sox=require(_0x1d20('0x8'));var csv=require(_0x1d20('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d20('0xa'));var _=require(_0x1d20('0xb'));var squel=require(_0x1d20('0xc'));var crypto=require(_0x1d20('0xd'));var jsforce=require(_0x1d20('0xe'));var deskjs=require(_0x1d20('0xf'));var toCsv=require(_0x1d20('0x9'));var querystring=require(_0x1d20('0x10'));var Papa=require(_0x1d20('0x11'));var Redis=require(_0x1d20('0x12'));var authService=require(_0x1d20('0x13'));var qs=require(_0x1d20('0x14'));var as=require(_0x1d20('0x15'));var hardwareService=require(_0x1d20('0x16'));var logger=require(_0x1d20('0x17'))(_0x1d20('0x18'));var utils=require(_0x1d20('0x19'));var config=require(_0x1d20('0x1a'));var licenseUtil=require(_0x1d20('0x1b'));var db=require('../../mysqldb')['db'];config[_0x1d20('0x1c')]=_[_0x1d20('0x1d')](config[_0x1d20('0x1c')],{'host':_0x1d20('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d20('0x1c')]));require('./team.socket')[_0x1d20('0x1f')](socket);function respondWithStatusCode(_0x294f64,_0x55c10a){_0x55c10a=_0x55c10a||0xcc;return function(_0x126caa){if(_0x126caa){return _0x294f64[_0x1d20('0x20')](_0x55c10a);}return _0x294f64['status'](_0x55c10a)[_0x1d20('0x21')]();};}function respondWithResult(_0x3ad07f,_0x3a4033){_0x3a4033=_0x3a4033||0xc8;return function(_0x206e91){if(_0x206e91){return _0x3ad07f[_0x1d20('0x22')](_0x3a4033)[_0x1d20('0x23')](_0x206e91);}};}function respondWithFilteredResult(_0x4d938a,_0x52805b){return function(_0x4df244){if(_0x4df244){var _0x3d91d4=typeof _0x52805b[_0x1d20('0x24')]===_0x1d20('0x25')&&typeof _0x52805b[_0x1d20('0x26')]===_0x1d20('0x25');var _0x59baf2=_0x4df244[_0x1d20('0x27')];var _0x109d5f=_0x3d91d4?0x0:_0x52805b[_0x1d20('0x24')];var _0x537a30=_0x3d91d4?_0x4df244[_0x1d20('0x27')]:_0x52805b[_0x1d20('0x24')]+_0x52805b[_0x1d20('0x26')];var _0x72758;if(_0x537a30>=_0x59baf2){_0x537a30=_0x59baf2;_0x72758=0xc8;}else{_0x72758=0xce;}_0x4d938a[_0x1d20('0x22')](_0x72758);return _0x4d938a[_0x1d20('0x28')](_0x1d20('0x29'),_0x109d5f+'-'+_0x537a30+'/'+_0x59baf2)[_0x1d20('0x23')](_0x4df244);}return null;};}function patchUpdates(_0xa870){return function(_0x2efc4b){try{jsonpatch[_0x1d20('0x2a')](_0x2efc4b,_0xa870,!![]);}catch(_0x386a64){return BPromise[_0x1d20('0x2b')](_0x386a64);}return _0x2efc4b[_0x1d20('0x2c')]();};}function saveUpdates(_0x24316e,_0xf8074d){return function(_0x518f07){if(_0x518f07){return _0x518f07[_0x1d20('0x2d')](_0x24316e)[_0x1d20('0x2e')](function(_0x413fb2){return _0x413fb2;});}return null;};}function removeEntity(_0x2567e6,_0x1075bd){return function(_0x251629){if(_0x251629){return _0x251629['destroy']()[_0x1d20('0x2e')](function(){var _0x4aa4a8=_0x251629[_0x1d20('0x2f')]({'plain':!![]});var _0x54d3ba='Teams';return db[_0x1d20('0x30')][_0x1d20('0x31')]({'where':{'type':_0x54d3ba,'resourceId':_0x4aa4a8['id']}})[_0x1d20('0x2e')](function(){return _0x251629;});})[_0x1d20('0x2e')](function(){_0x2567e6[_0x1d20('0x22')](0xcc)[_0x1d20('0x21')]();});}};}function handleEntityNotFound(_0x3dcaab,_0x3f5b37){return function(_0x2249e3){if(!_0x2249e3){_0x3dcaab[_0x1d20('0x20')](0x194);}return _0x2249e3;};}function handleError(_0x299bb6,_0x17b42e){_0x17b42e=_0x17b42e||0x1f4;return function(_0x4768f8){logger[_0x1d20('0x32')](_0x4768f8[_0x1d20('0x33')]);if(_0x4768f8[_0x1d20('0x34')]){delete _0x4768f8['name'];}_0x299bb6[_0x1d20('0x22')](_0x17b42e)[_0x1d20('0x35')](_0x4768f8);};}exports[_0x1d20('0x36')]=function(_0x29acdb,_0x305bdc){var _0x57d578={},_0x2a55ec={},_0x5865e8={'count':0x0,'rows':[]};var _0x57cf53=_[_0x1d20('0x37')](db['Team'][_0x1d20('0x38')],function(_0x5560a8){return{'name':_0x5560a8[_0x1d20('0x39')],'type':_0x5560a8[_0x1d20('0x3a')][_0x1d20('0x3b')]};});_0x2a55ec[_0x1d20('0x3c')]=_['map'](_0x57cf53,'name');_0x2a55ec[_0x1d20('0x3d')]=_['keys'](_0x29acdb[_0x1d20('0x3d')]);_0x2a55ec[_0x1d20('0x3e')]=_['intersection'](_0x2a55ec['model'],_0x2a55ec[_0x1d20('0x3d')]);_0x57d578[_0x1d20('0x3f')]=_[_0x1d20('0x40')](_0x2a55ec[_0x1d20('0x3c')],qs[_0x1d20('0x41')](_0x29acdb[_0x1d20('0x3d')][_0x1d20('0x41')]));_0x57d578[_0x1d20('0x3f')]=_0x57d578[_0x1d20('0x3f')][_0x1d20('0x42')]?_0x57d578[_0x1d20('0x3f')]:_0x2a55ec['model'];if(!_0x29acdb[_0x1d20('0x3d')][_0x1d20('0x43')](_0x1d20('0x44'))){_0x57d578[_0x1d20('0x26')]=qs[_0x1d20('0x26')](_0x29acdb[_0x1d20('0x3d')][_0x1d20('0x26')]);_0x57d578['offset']=qs[_0x1d20('0x24')](_0x29acdb[_0x1d20('0x3d')][_0x1d20('0x24')]);}_0x57d578[_0x1d20('0x45')]=qs[_0x1d20('0x46')](_0x29acdb['query'][_0x1d20('0x46')]);_0x57d578[_0x1d20('0x47')]=qs[_0x1d20('0x3e')](_[_0x1d20('0x48')](_0x29acdb['query'],_0x2a55ec[_0x1d20('0x3e')]),_0x57cf53);if(_0x29acdb[_0x1d20('0x3d')]['filter']){_0x57d578['where']=_[_0x1d20('0x49')](_0x57d578[_0x1d20('0x47')],{'$or':_[_0x1d20('0x37')](_0x57cf53,function(_0x2e3f24){if(_0x2e3f24[_0x1d20('0x3a')]!==_0x1d20('0x4a')){var _0x35fbe4={};_0x35fbe4[_0x2e3f24[_0x1d20('0x34')]]={'$like':'%'+_0x29acdb[_0x1d20('0x3d')][_0x1d20('0x4b')]+'%'};return _0x35fbe4;}})});}_0x57d578=_['merge']({},_0x57d578,_0x29acdb[_0x1d20('0x4c')]);var _0x5ab35a={'where':_0x57d578['where']};return db[_0x1d20('0x4d')][_0x1d20('0x27')](_0x5ab35a)[_0x1d20('0x2e')](function(_0x1546e4){_0x5865e8[_0x1d20('0x27')]=_0x1546e4;if(_0x29acdb[_0x1d20('0x3d')][_0x1d20('0x4e')]){_0x57d578[_0x1d20('0x4f')]=[{'all':!![]}];}return db['Team'][_0x1d20('0x50')](_0x57d578);})[_0x1d20('0x2e')](function(_0x479389){_0x5865e8['rows']=_0x479389;return _0x5865e8;})['then'](respondWithFilteredResult(_0x305bdc,_0x57d578))[_0x1d20('0x51')](handleError(_0x305bdc,null));};exports[_0x1d20('0x52')]=function(_0x3df936,_0x44729e){var _0x115fec={'raw':![],'where':{'id':_0x3df936[_0x1d20('0x53')]['id']}},_0xe4b962={};_0xe4b962['model']=_[_0x1d20('0x54')](db[_0x1d20('0x4d')][_0x1d20('0x38')]);_0xe4b962['query']=_['keys'](_0x3df936[_0x1d20('0x3d')]);_0xe4b962[_0x1d20('0x3e')]=_['intersection'](_0xe4b962[_0x1d20('0x3c')],_0xe4b962[_0x1d20('0x3d')]);_0x115fec[_0x1d20('0x3f')]=_[_0x1d20('0x40')](_0xe4b962[_0x1d20('0x3c')],qs[_0x1d20('0x41')](_0x3df936[_0x1d20('0x3d')][_0x1d20('0x41')]));_0x115fec[_0x1d20('0x3f')]=_0x115fec['attributes'][_0x1d20('0x42')]?_0x115fec['attributes']:_0xe4b962[_0x1d20('0x3c')];if(_0x3df936['query'][_0x1d20('0x4e')]){_0x115fec[_0x1d20('0x4f')]=[{'all':!![]}];}_0x115fec=_[_0x1d20('0x49')]({},_0x115fec,_0x3df936[_0x1d20('0x4c')]);return db['Team']['find'](_0x115fec)['then'](handleEntityNotFound(_0x44729e,null))[_0x1d20('0x2e')](respondWithResult(_0x44729e,null))[_0x1d20('0x51')](handleError(_0x44729e,null));};exports[_0x1d20('0x55')]=function(_0x25a7f7,_0x2c4287){return db[_0x1d20('0x4d')]['create'](_0x25a7f7[_0x1d20('0x56')],{})[_0x1d20('0x2e')](function(_0x2b7f28){var _0x47e289=_0x25a7f7[_0x1d20('0x57')]['get']({'plain':!![]});if(!_0x47e289)throw new Error(_0x1d20('0x58'));if(_0x47e289['role']===_0x1d20('0x57')){var _0x3f9353=_0x2b7f28[_0x1d20('0x2f')]({'plain':!![]});var _0x287e7b=_0x1d20('0x59');return db['UserProfileSection'][_0x1d20('0x5a')]({'where':{'name':_0x287e7b,'userProfileId':_0x47e289[_0x1d20('0x5b')]},'raw':!![]})['then'](function(_0x45d542){if(_0x45d542&&_0x45d542[_0x1d20('0x5c')]===0x0){return db[_0x1d20('0x30')][_0x1d20('0x55')]({'name':_0x3f9353['name'],'resourceId':_0x3f9353['id'],'type':_0x45d542[_0x1d20('0x34')],'sectionId':_0x45d542['id']},{})['then'](function(){return _0x2b7f28;});}else{return _0x2b7f28;}})[_0x1d20('0x51')](function(_0xfe04e3){logger[_0x1d20('0x32')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfe04e3);throw _0xfe04e3;});}return _0x2b7f28;})[_0x1d20('0x2e')](respondWithResult(_0x2c4287,0xc9))[_0x1d20('0x51')](handleError(_0x2c4287,null));};exports[_0x1d20('0x2d')]=function(_0x52a80e,_0x39b5ca){if(_0x52a80e[_0x1d20('0x56')]['id']){delete _0x52a80e[_0x1d20('0x56')]['id'];}return db[_0x1d20('0x4d')][_0x1d20('0x5a')]({'where':{'id':_0x52a80e[_0x1d20('0x53')]['id']}})[_0x1d20('0x2e')](handleEntityNotFound(_0x39b5ca,null))['then'](saveUpdates(_0x52a80e['body'],null))[_0x1d20('0x2e')](respondWithResult(_0x39b5ca,null))['catch'](handleError(_0x39b5ca,null));};exports[_0x1d20('0x31')]=function(_0x375f70,_0x36277b){return db[_0x1d20('0x4d')][_0x1d20('0x5a')]({'where':{'id':_0x375f70['params']['id']}})['then'](handleEntityNotFound(_0x36277b,null))[_0x1d20('0x2e')](removeEntity(_0x36277b,null))[_0x1d20('0x51')](handleError(_0x36277b,null));};exports[_0x1d20('0x5d')]=function(_0x56d813,_0x5fa302,_0xd459bb){return db[_0x1d20('0x4d')][_0x1d20('0x5e')]({'where':{'id':_0x56d813[_0x1d20('0x53')]['id']}})['then'](handleEntityNotFound(_0x5fa302,null))[_0x1d20('0x2e')](function(_0x493d58){if(!_0x56d813[_0x1d20('0x3d')]['channel']||!utils['isValidChannel'](_0x56d813[_0x1d20('0x3d')][_0x1d20('0x5f')])){throw new db[(_0x1d20('0x60'))]['ValidationError'](_0x1d20('0x61'));}var _0x2a19d7={};var _0x4fffbe={};_0x4fffbe[_0x1d20('0x3c')]=_['keys'](db[_[_0x1d20('0x62')](_0x56d813[_0x1d20('0x3d')][_0x1d20('0x5f')][_0x1d20('0x63')]())+_0x1d20('0x64')][_0x1d20('0x38')]);_0x4fffbe[_0x1d20('0x3d')]=_['keys'](_0x56d813[_0x1d20('0x3d')]);_0x4fffbe[_0x1d20('0x3e')]=_[_0x1d20('0x40')](_0x4fffbe[_0x1d20('0x3c')],_0x4fffbe[_0x1d20('0x3d')]);_0x2a19d7['attributes']=_[_0x1d20('0x40')](_0x4fffbe[_0x1d20('0x3c')],qs[_0x1d20('0x41')](_0x56d813[_0x1d20('0x3d')][_0x1d20('0x41')]));_0x2a19d7['attributes']=_0x2a19d7[_0x1d20('0x3f')][_0x1d20('0x42')]?_0x2a19d7[_0x1d20('0x3f')]:_0x4fffbe['model'];_0x2a19d7['limit']=qs[_0x1d20('0x26')](_0x56d813[_0x1d20('0x3d')][_0x1d20('0x26')]);_0x2a19d7[_0x1d20('0x24')]=qs[_0x1d20('0x24')](_0x56d813['query']['offset']);_0x2a19d7['order']=qs['sort'](_0x56d813[_0x1d20('0x3d')][_0x1d20('0x46')]);_0x2a19d7[_0x1d20('0x47')]=qs[_0x1d20('0x3e')](_[_0x1d20('0x48')](_0x56d813[_0x1d20('0x3d')],_0x4fffbe[_0x1d20('0x3e')]));_0x2a19d7=_[_0x1d20('0x49')]({},_0x2a19d7,_0x56d813['options']);return _0x493d58[_0x1d20('0x2f')+_[_0x1d20('0x62')](_0x56d813['query']['channel'][_0x1d20('0x63')]())+_0x1d20('0x65')](_0x2a19d7);})[_0x1d20('0x2e')](respondWithResult(_0x5fa302,null))['catch'](handleError(_0x5fa302,null));};exports[_0x1d20('0x66')]=function(_0x41ac04,_0x5817a1,_0x46e74c){return db[_0x1d20('0x4d')][_0x1d20('0x5e')]({'where':{'id':_0x41ac04[_0x1d20('0x53')]['id']}})[_0x1d20('0x2e')](function(_0x15fac3){if(_0x15fac3){if(!_0x41ac04[_0x1d20('0x56')][_0x1d20('0x5f')]||!utils[_0x1d20('0x67')](_0x41ac04['body'][_0x1d20('0x5f')])){throw new db[(_0x1d20('0x60'))][(_0x1d20('0x68'))]('Unknown\x20channel');}return _0x15fac3[_0x1d20('0x69')+_['capitalize'](_0x41ac04[_0x1d20('0x56')][_0x1d20('0x5f')][_0x1d20('0x63')]())+_0x1d20('0x65')](_0x41ac04['body'][_0x1d20('0x6a')]);}return null;})['then'](handleEntityNotFound(_0x5817a1,null))[_0x1d20('0x2e')](respondWithStatusCode(_0x5817a1,null))[_0x1d20('0x51')](handleError(_0x5817a1,null));};exports[_0x1d20('0x6b')]=function(_0x4709ab,_0x4a4e3f,_0x515de0){return db[_0x1d20('0x4d')][_0x1d20('0x5e')]({'where':{'id':_0x4709ab[_0x1d20('0x53')]['id']}})[_0x1d20('0x2e')](function(_0xfe66c5){if(_0xfe66c5){if(!_0x4709ab[_0x1d20('0x3d')]['channel']||!utils[_0x1d20('0x67')](_0x4709ab[_0x1d20('0x3d')][_0x1d20('0x5f')])){throw new db[(_0x1d20('0x60'))][(_0x1d20('0x68'))](_0x1d20('0x61'));}return _0xfe66c5['remove'+_['capitalize'](_0x4709ab[_0x1d20('0x3d')]['channel']['toLowerCase']())+_0x1d20('0x65')](_0x4709ab['query']['ids']);}return null;})[_0x1d20('0x2e')](handleEntityNotFound(_0x4a4e3f,null))[_0x1d20('0x2e')](respondWithStatusCode(_0x4a4e3f,null))['catch'](handleError(_0x4a4e3f,null));};exports[_0x1d20('0x6c')]=function(_0x41be66,_0x29a9f7){return db['Team'][_0x1d20('0x5a')]({'where':{'id':_0x41be66[_0x1d20('0x53')]['id']}})[_0x1d20('0x2e')](handleEntityNotFound(_0x29a9f7,null))[_0x1d20('0x2e')](function(_0x31d887){if(_0x31d887){var _0x4c1ad9=[_0x1d20('0x6d'),_0x1d20('0x6e'),_0x1d20('0x6f'),_0x1d20('0x70'),_0x1d20('0x71'),_0x1d20('0x72'),_0x1d20('0x73')];return db[_0x1d20('0x74')][_0x1d20('0x75')](function(_0x49ab1f){var _0x5e99a7=_[_0x1d20('0x37')](_0x4c1ad9,function(_0x23ae66){var _0x1443a6={'attributes':['id',_0x1d20('0x34')]};if(_0x23ae66===_0x1d20('0x6d')){_0x1443a6['through']={'attributes':[_0x1d20('0x76')]};}return _0x31d887['get'+_0x23ae66+_0x1d20('0x65')](_0x1443a6)['then'](function(_0x448181){var _0x19d0d6=_[_0x1d20('0x37')](_0x448181,function(_0x5bb677){var _0x5adfc1=_['map'](_0x41be66[_0x1d20('0x56')][_0x1d20('0x6a')],function(_0xacb90b){var _0x52c59f={'where':{'UserId':_0xacb90b,[_0x23ae66+_0x1d20('0x77')]:_0x5bb677['id']},'transaction':_0x49ab1f};if(_0x23ae66===_0x1d20('0x6d')){_0x52c59f[_0x1d20('0x1d')]={'penalty':_0x5bb677[_0x1d20('0x78')]['penalty']};}return db['User'+_0x23ae66+_0x1d20('0x64')][_0x1d20('0x79')](_0x52c59f)[_0x1d20('0x2e')](function(){socket[_0x1d20('0x7a')](_0x1d20('0x57')+_0x23ae66+'Queue:save',{'UserId':_0xacb90b,[_0x23ae66+_0x1d20('0x77')]:_0x5bb677['id']});if(_0x23ae66!==_0x1d20('0x6d'))return;return db[_0x1d20('0x7b')][_0x1d20('0x50')]({'where':{'id':_0x41be66[_0x1d20('0x56')][_0x1d20('0x6a')],'online':0x1},'attributes':['id',_0x1d20('0x34'),'online','voicePause','interface'],'raw':!![]})[_0x1d20('0x2e')](function(_0x944c52){var _0x96484f=_['map'](_0x944c52,function(_0x579766){return db[_0x1d20('0x7c')][_0x1d20('0x7d')]({'membername':_0x579766[_0x1d20('0x34')],'UserId':_0x579766['id'],'queue_name':_0x5bb677[_0x1d20('0x34')],'VoiceQueueId':_0x5bb677['id'],'interface':_[_0x1d20('0x7e')](_0x579766[_0x1d20('0x7f')])?util['format'](_0x1d20('0x80'),_0x579766[_0x1d20('0x34')]):_0x579766['interface'],'paused':_0x579766[_0x1d20('0x81')]||![],'penalty':_0x5bb677['TeamVoiceQueue'][_0x1d20('0x76')]},{'transaction':_0x49ab1f});});return Promise[_0x1d20('0x82')](_0x96484f);});});});return Promise[_0x1d20('0x82')](_0x5adfc1);});return Promise[_0x1d20('0x82')](_0x19d0d6);});});return Promise[_0x1d20('0x82')](_0x5e99a7)[_0x1d20('0x2e')](function(){return _0x31d887[_0x1d20('0x6c')](_0x41be66[_0x1d20('0x56')][_0x1d20('0x6a')],{'transaction':_0x49ab1f})['spread'](function(_0x34ad36){return _0x34ad36;});});});}})[_0x1d20('0x2e')](respondWithResult(_0x29a9f7,null))[_0x1d20('0x51')](handleError(_0x29a9f7,null));};exports[_0x1d20('0x83')]=function(_0x1b0ba4,_0x4d2777){return db[_0x1d20('0x4d')]['find']({'where':{'id':_0x1b0ba4['params']['id']}})[_0x1d20('0x2e')](handleEntityNotFound(_0x4d2777,null))[_0x1d20('0x2e')](function(_0x2f5453){if(_0x2f5453){var _0x1b83ae=[_0x1d20('0x6d'),_0x1d20('0x6e'),_0x1d20('0x6f'),'Sms',_0x1d20('0x71'),_0x1d20('0x72'),_0x1d20('0x73')];return db[_0x1d20('0x74')][_0x1d20('0x75')](function(_0x127e57){var _0x53e00c=_['map'](_0x1b83ae,function(_0x10510a){var _0x41adc2={'attributes':['id',_0x1d20('0x34')]};return _0x2f5453[_0x1d20('0x2f')+_0x10510a+_0x1d20('0x65')](_0x41adc2)[_0x1d20('0x2e')](function(_0x3fe765){var _0x4b9415=_[_0x1d20('0x37')](_0x3fe765,function(_0x529ae5){return _0x529ae5[_0x1d20('0x83')](_0x1b0ba4[_0x1d20('0x3d')][_0x1d20('0x6a')],{'transaction':_0x127e57})[_0x1d20('0x2e')](function(){var _0x5de383=JSON[_0x1d20('0x84')]('['+_0x1b0ba4[_0x1d20('0x3d')][_0x1d20('0x6a')]+']');var _0x5526fe=_[_0x1d20('0x37')](_0x5de383,function(_0x568dc6){socket['emit'](_0x1d20('0x57')+_0x10510a+'Queue:remove',{'UserId':Number(_0x568dc6),[_0x10510a+'QueueId']:_0x529ae5['id']});if(_0x10510a!==_0x1d20('0x6d'))return;return db[_0x1d20('0x7c')][_0x1d20('0x31')]({'where':{'VoiceQueueId':_0x529ae5['id'],'UserId':_0x568dc6},'transaction':_0x127e57});});return Promise[_0x1d20('0x82')](_0x5526fe);});});return Promise[_0x1d20('0x82')](_0x4b9415);});});return Promise[_0x1d20('0x82')](_0x53e00c)[_0x1d20('0x2e')](function(){return _0x2f5453['removeAgents'](_0x1b0ba4[_0x1d20('0x3d')][_0x1d20('0x6a')],{'transaction':_0x127e57});});});}})[_0x1d20('0x2e')](respondWithStatusCode(_0x4d2777,null))[_0x1d20('0x51')](handleError(_0x4d2777,null));};exports[_0x1d20('0x85')]=function(_0x4c9a45,_0x18ec02,_0x549f43){var _0x5f178e={};var _0x5cf789={};var _0x4360db;var _0xd771fc;return db[_0x1d20('0x4d')][_0x1d20('0x5e')]({'where':{'id':_0x4c9a45['params']['id']}})[_0x1d20('0x2e')](handleEntityNotFound(_0x18ec02,null))[_0x1d20('0x2e')](function(_0x5dc800){if(_0x5dc800){_0x4360db=_0x5dc800;_0x5cf789[_0x1d20('0x3c')]=_['keys'](db[_0x1d20('0x7b')][_0x1d20('0x38')]);_0x5cf789[_0x1d20('0x3d')]=_[_0x1d20('0x54')](_0x4c9a45['query']);_0x5cf789[_0x1d20('0x3e')]=_[_0x1d20('0x40')](_0x5cf789['model'],_0x5cf789[_0x1d20('0x3d')]);_0x5f178e[_0x1d20('0x3f')]=_[_0x1d20('0x40')](_0x5cf789[_0x1d20('0x3c')],qs['fields'](_0x4c9a45['query']['fields']));_0x5f178e[_0x1d20('0x3f')]=_0x5f178e[_0x1d20('0x3f')][_0x1d20('0x42')]?_0x5f178e[_0x1d20('0x3f')]:_0x5cf789[_0x1d20('0x3c')];_0x5f178e['order']=qs[_0x1d20('0x46')](_0x4c9a45['query'][_0x1d20('0x46')]);_0x5f178e['where']=qs[_0x1d20('0x3e')](_[_0x1d20('0x48')](_0x4c9a45[_0x1d20('0x3d')],_0x5cf789[_0x1d20('0x3e')]));if(_0x4c9a45[_0x1d20('0x3d')][_0x1d20('0x4b')]){_0x5f178e[_0x1d20('0x47')]=_[_0x1d20('0x49')](_0x5f178e['where'],{'$or':_[_0x1d20('0x37')](_0x5f178e[_0x1d20('0x3f')],function(_0x280cb4){var _0x1726db={};_0x1726db[_0x280cb4]={'$like':'%'+_0x4c9a45[_0x1d20('0x3d')]['filter']+'%'};return _0x1726db;})});}_0x5f178e=_['merge']({},_0x5f178e,_0x4c9a45['options']);return _0x4360db[_0x1d20('0x85')](_0x5f178e);}})[_0x1d20('0x2e')](function(_0x481dc1){if(_0x481dc1){_0xd771fc=_0x481dc1['length'];if(!_0x4c9a45[_0x1d20('0x3d')]['hasOwnProperty']('nolimit')){_0x5f178e['limit']=qs['limit'](_0x4c9a45[_0x1d20('0x3d')]['limit']);_0x5f178e[_0x1d20('0x24')]=qs[_0x1d20('0x24')](_0x4c9a45[_0x1d20('0x3d')][_0x1d20('0x24')]);}return _0x4360db[_0x1d20('0x85')](_0x5f178e);}})[_0x1d20('0x2e')](function(_0x1459b9){if(_0x1459b9){return _0x1459b9?{'count':_0xd771fc,'rows':_0x1459b9}:null;}})[_0x1d20('0x2e')](respondWithResult(_0x18ec02,null))['catch'](handleError(_0x18ec02,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index ca8e7fb..e7dafab 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 _0x9e02=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x399db9,_0x110e6b){var _0x3c983e=function(_0x4e6eb6){while(--_0x4e6eb6){_0x399db9['push'](_0x399db9['shift']());}};_0x3c983e(++_0x110e6b);}(_0x9e02,0x1db));var _0x29e0=function(_0x332bea,_0x3b8df6){_0x332bea=_0x332bea-0x0;var _0x1ee02d=_0x9e02[_0x332bea];return _0x1ee02d;};'use strict';var EventEmitter=require(_0x29e0('0x0'));var Team=require(_0x29e0('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x29e0('0x2')](0x0);var events={'afterCreate':_0x29e0('0x3'),'afterUpdate':'update','afterDestroy':_0x29e0('0x4')};function emitEvent(_0x47176){return function(_0x5dbd66,_0x3362b6,_0x48c687){TeamEvents[_0x29e0('0x5')](_0x47176+':'+_0x5dbd66['id'],_0x5dbd66);TeamEvents[_0x29e0('0x5')](_0x47176,_0x5dbd66);_0x48c687(null);};}for(var e in events){if(events[_0x29e0('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x29e0('0x7')]=TeamEvents; \ No newline at end of file +var _0x0f4d=['exports','Team','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0xd1e8a5,_0xbc9afd){var _0x5b251c=function(_0x4242b7){while(--_0x4242b7){_0xd1e8a5['push'](_0xd1e8a5['shift']());}};_0x5b251c(++_0xbc9afd);}(_0x0f4d,0x131));var _0xd0f4=function(_0x20ca18,_0x13721d){_0x20ca18=_0x20ca18-0x0;var _0x157156=_0x0f4d[_0x20ca18];return _0x157156;};'use strict';var EventEmitter=require('events');var Team=require('../../mysqldb')['db'][_0xd0f4('0x0')];var TeamEvents=new EventEmitter();TeamEvents[_0xd0f4('0x1')](0x0);var events={'afterCreate':_0xd0f4('0x2'),'afterUpdate':_0xd0f4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3099d3){return function(_0x10469a,_0x59a6bf,_0x2ca74d){TeamEvents['emit'](_0x3099d3+':'+_0x10469a['id'],_0x10469a);TeamEvents[_0xd0f4('0x4')](_0x3099d3,_0x10469a);_0x2ca74d(null);};}for(var e in events){if(events[_0xd0f4('0x5')](e)){var event=events[e];Team[_0xd0f4('0x6')](e,emitEvent(event));}}module[_0xd0f4('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index dd52b7a..28b905a 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 _0xd800=['Team','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xd800,0x199));var _0x0d80=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xd800[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x0d80('0x0'));var util=require('util');var logger=require(_0x0d80('0x1'))(_0x0d80('0x2'));var moment=require(_0x0d80('0x3'));var BPromise=require(_0x0d80('0x4'));var rp=require(_0x0d80('0x5'));var fs=require('fs');var path=require(_0x0d80('0x6'));var rimraf=require(_0x0d80('0x7'));var config=require(_0x0d80('0x8'));var attributes=require('./team.attributes');module[_0x0d80('0x9')]=function(_0x2f1d37,_0xd0a023){return _0x2f1d37[_0x0d80('0xa')](_0x0d80('0xb'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7cb8=['define','teams','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x7cb8,0x1d0));var _0x87cb=function(_0x16cdb5,_0xd822df){_0x16cdb5=_0x16cdb5-0x0;var _0x4bf967=_0x7cb8[_0x16cdb5];return _0x4bf967;};'use strict';var _=require('lodash');var util=require(_0x87cb('0x0'));var logger=require(_0x87cb('0x1'))(_0x87cb('0x2'));var moment=require(_0x87cb('0x3'));var BPromise=require('bluebird');var rp=require(_0x87cb('0x4'));var fs=require('fs');var path=require(_0x87cb('0x5'));var rimraf=require(_0x87cb('0x6'));var config=require(_0x87cb('0x7'));var attributes=require('./team.attributes');module[_0x87cb('0x8')]=function(_0x5295ec,_0x1f282c){return _0x5295ec[_0x87cb('0x9')]('Team',attributes,{'tableName':_0x87cb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 2b6b2e5..0708804 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 _0xf39e=['stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xf39e,0xf6));var _0xef39=function(_0x1fd36b,_0x2cb131){_0x1fd36b=_0x1fd36b-0x0;var _0x528939=_0xf39e[_0x1fd36b];return _0x528939;};'use strict';var _=require(_0xef39('0x0'));var util=require(_0xef39('0x1'));var moment=require(_0xef39('0x2'));var BPromise=require(_0xef39('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef39('0x4'));var db=require(_0xef39('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xef39('0x6'));var client=jayson[_0xef39('0x7')][_0xef39('0x8')]({'port':0x232a});config[_0xef39('0x9')]=_[_0xef39('0xa')](config[_0xef39('0x9')],{'host':_0xef39('0xb'),'port':0x18eb});var socket=require(_0xef39('0xc'))(new Redis(config[_0xef39('0x9')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x1e33dd,_0x412677,_0x4c272a){return new BPromise(function(_0x395158,_0x361426){return client['request'](_0x1e33dd,_0x4c272a)[_0xef39('0xd')](function(_0xbfb84d){logger['info'](_0xef39('0xe'),_0x412677,_0xef39('0xf'));logger[_0xef39('0x10')](_0xef39('0x11'),_0x412677,_0xef39('0xf'),JSON[_0xef39('0x12')](_0xbfb84d));if(_0xbfb84d[_0xef39('0x13')]){if(_0xbfb84d[_0xef39('0x13')]['code']===0x1f4){logger[_0xef39('0x13')](_0xef39('0xe'),_0x412677,_0xbfb84d[_0xef39('0x13')]['message']);return _0x361426(_0xbfb84d[_0xef39('0x13')]['message']);}logger['error'](_0xef39('0xe'),_0x412677,_0xbfb84d[_0xef39('0x13')][_0xef39('0x14')]);return _0x395158(_0xbfb84d[_0xef39('0x13')][_0xef39('0x14')]);}else{logger['info'](_0xef39('0xe'),_0x412677,_0xef39('0xf'));_0x395158(_0xbfb84d[_0xef39('0x15')][_0xef39('0x14')]);}})['catch'](function(_0x3a49da){logger[_0xef39('0x13')](_0xef39('0xe'),_0x412677,_0x3a49da);_0x361426(_0x3a49da);});});} \ No newline at end of file +var _0xd500=['message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x242f49,_0x29b7b7){var _0x278e55=function(_0x4c330a){while(--_0x4c330a){_0x242f49['push'](_0x242f49['shift']());}};_0x278e55(++_0x29b7b7);}(_0xd500,0xa6));var _0x0d50=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xd500[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x0d50('0x0'));var util=require(_0x0d50('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0d50('0x2'));var fs=require('fs');var Redis=require(_0x0d50('0x3'));var db=require(_0x0d50('0x4'))['db'];var utils=require(_0x0d50('0x5'));var logger=require(_0x0d50('0x6'))(_0x0d50('0x7'));var config=require('../../config/environment');var jayson=require(_0x0d50('0x8'));var client=jayson['client'][_0x0d50('0x9')]({'port':0x232a});config[_0x0d50('0xa')]=_[_0x0d50('0xb')](config[_0x0d50('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x0d50('0xc'))(new Redis(config['redis']));require(_0x0d50('0xd'))[_0x0d50('0xe')](socket);function respondWithRpcPromise(_0x513d6a,_0x578eca,_0x4d4a1b){return new BPromise(function(_0x1ad1fb,_0x2fc0bc){return client[_0x0d50('0xf')](_0x513d6a,_0x4d4a1b)[_0x0d50('0x10')](function(_0x291083){logger['info'](_0x0d50('0x11'),_0x578eca,_0x0d50('0x12'));logger[_0x0d50('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x578eca,_0x0d50('0x12'),JSON[_0x0d50('0x14')](_0x291083));if(_0x291083[_0x0d50('0x15')]){if(_0x291083[_0x0d50('0x15')][_0x0d50('0x16')]===0x1f4){logger[_0x0d50('0x15')](_0x0d50('0x11'),_0x578eca,_0x291083[_0x0d50('0x15')][_0x0d50('0x17')]);return _0x2fc0bc(_0x291083['error'][_0x0d50('0x17')]);}logger[_0x0d50('0x15')](_0x0d50('0x11'),_0x578eca,_0x291083['error']['message']);return _0x1ad1fb(_0x291083[_0x0d50('0x15')][_0x0d50('0x17')]);}else{logger[_0x0d50('0x18')]('Team,\x20%s,\x20%s',_0x578eca,_0x0d50('0x12'));_0x1ad1fb(_0x291083[_0x0d50('0x19')]['message']);}})[_0x0d50('0x1a')](function(_0x1379fd){logger['error']('Team,\x20%s,\x20%s',_0x578eca,_0x1379fd);_0x2fc0bc(_0x1379fd);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 221b991..a2d1c3d 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 _0xe330=['removeListener','length','team:','save','remove','update','emit'];(function(_0x2376c2,_0x39445d){var _0x17a2b5=function(_0x4d96e4){while(--_0x4d96e4){_0x2376c2['push'](_0x2376c2['shift']());}};_0x17a2b5(++_0x39445d);}(_0xe330,0x96));var _0x0e33=function(_0x4a892c,_0x5bbf49){_0x4a892c=_0x4a892c-0x0;var _0x3271c9=_0xe330[_0x4a892c];return _0x3271c9;};'use strict';var TeamEvents=require('./team.events');var events=[_0x0e33('0x0'),_0x0e33('0x1'),_0x0e33('0x2')];function createListener(_0x51c28e,_0x54985c){return function(_0x745ed5){_0x54985c[_0x0e33('0x3')](_0x51c28e,_0x745ed5);};}function removeListener(_0x4d5e1b,_0x32dd5d){return function(){TeamEvents[_0x0e33('0x4')](_0x4d5e1b,_0x32dd5d);};}exports['register']=function(_0x1fd0d9){for(var _0x166019=0x0,_0x2db301=events[_0x0e33('0x5')];_0x166019<_0x2db301;_0x166019++){var _0x21553b=events[_0x166019];var _0x3e4028=createListener(_0x0e33('0x6')+_0x21553b,_0x1fd0d9);TeamEvents['on'](_0x21553b,_0x3e4028);}}; \ No newline at end of file +var _0xe3f6=['register','team:','./team.events','save','remove','emit'];(function(_0x49d9af,_0x372210){var _0x59475f=function(_0x1f58be){while(--_0x1f58be){_0x49d9af['push'](_0x49d9af['shift']());}};_0x59475f(++_0x372210);}(_0xe3f6,0x92));var _0x6e3f=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xe3f6[_0x5f309e];return _0x487b5e;};'use strict';var TeamEvents=require(_0x6e3f('0x0'));var events=[_0x6e3f('0x1'),_0x6e3f('0x2'),'update'];function createListener(_0x2f6230,_0x4eab97){return function(_0x1ead6f){_0x4eab97[_0x6e3f('0x3')](_0x2f6230,_0x1ead6f);};}function removeListener(_0x5d4727,_0x20c31b){return function(){TeamEvents['removeListener'](_0x5d4727,_0x20c31b);};}exports[_0x6e3f('0x4')]=function(_0x5ff9b4){for(var _0xbeed8=0x0,_0x232a4d=events['length'];_0xbeed8<_0x232a4d;_0xbeed8++){var _0x372b50=events[_0xbeed8];var _0x562d58=createListener(_0x6e3f('0x5')+_0x372b50,_0x5ff9b4);TeamEvents['on'](_0x372b50,_0x562d58);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 40724cf..bed4517 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x15a99d,_0x4486ea){var _0x2cb908=function(_0x1243c1){while(--_0x1243c1){_0x15a99d['push'](_0x15a99d['shift']());}};_0x2cb908(++_0x4486ea);}(_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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x20fcda,_0x55688a){var _0x2b2a4a=function(_0x2ccbbd){while(--_0x2ccbbd){_0x20fcda['push'](_0x20fcda['shift']());}};_0x2b2a4a(++_0x55688a);}(_0xedd9,0xfc));var _0x9edd=function(_0x51baa9,_0x5da872){_0x51baa9=_0x51baa9-0x0;var _0x2434c5=_0xedd9[_0x51baa9];return _0x2434c5;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 4475aae..7181379 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 _0x8f37=['exports','INTEGER','sequelize'];(function(_0x1ba61a,_0x278b79){var _0x487bf5=function(_0x2b1547){while(--_0x2b1547){_0x1ba61a['push'](_0x1ba61a['shift']());}};_0x487bf5(++_0x278b79);}(_0x8f37,0x1e5));var _0x78f3=function(_0x5246fd,_0x46fceb){_0x5246fd=_0x5246fd-0x0;var _0x588bfc=_0x8f37[_0x5246fd];return _0x588bfc;};'use strict';var Sequelize=require(_0x78f3('0x0'));module[_0x78f3('0x1')]={'penalty':{'type':Sequelize[_0x78f3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8802=['sequelize','INTEGER'];(function(_0xac3328,_0x23745a){var _0x33aec4=function(_0x476d1a){while(--_0x476d1a){_0xac3328['push'](_0xac3328['shift']());}};_0x33aec4(++_0x23745a);}(_0x8802,0x7e));var _0x2880=function(_0x4ec13d,_0x358a8f){_0x4ec13d=_0x4ec13d-0x0;var _0x3c3fa7=_0x8802[_0x4ec13d];return _0x3c3fa7;};'use strict';var Sequelize=require(_0x2880('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2880('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 54cf35c..6efecbd 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 _0xf7f3=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','define','lodash','util'];(function(_0x101237,_0x448f24){var _0x50ede4=function(_0x4d858d){while(--_0x4d858d){_0x101237['push'](_0x101237['shift']());}};_0x50ede4(++_0x448f24);}(_0xf7f3,0x12a));var _0x3f7f=function(_0x27a362,_0x182196){_0x27a362=_0x27a362-0x0;var _0x444c89=_0xf7f3[_0x27a362];return _0x444c89;};'use strict';var _=require(_0x3f7f('0x0'));var util=require(_0x3f7f('0x1'));var logger=require(_0x3f7f('0x2'))(_0x3f7f('0x3'));var moment=require(_0x3f7f('0x4'));var BPromise=require(_0x3f7f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3f7f('0x6'));var config=require(_0x3f7f('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0x3f7f('0x8')]=function(_0x4876e8,_0x2198f7){return _0x4876e8[_0x3f7f('0x9')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ff4=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','api','moment','bluebird','request-promise'];(function(_0x4494fb,_0x527d1c){var _0x59deab=function(_0x53c3fb){while(--_0x53c3fb){_0x4494fb['push'](_0x4494fb['shift']());}};_0x59deab(++_0x527d1c);}(_0x9ff4,0x196));var _0x49ff=function(_0x4424fd,_0x4921fe){_0x4424fd=_0x4424fd-0x0;var _0x13b18b=_0x9ff4[_0x4424fd];return _0x13b18b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x49ff('0x0'));var moment=require(_0x49ff('0x1'));var BPromise=require(_0x49ff('0x2'));var rp=require(_0x49ff('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x49ff('0x4'));var config=require(_0x49ff('0x5'));var attributes=require(_0x49ff('0x6'));module[_0x49ff('0x7')]=function(_0x153755,_0x22febd){return _0x153755[_0x49ff('0x8')](_0x49ff('0x9'),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 6476240..94a7528 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 _0x245e=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x2c6ca7,_0x58d9fe){var _0x37e6d5=function(_0x57cef3){while(--_0x57cef3){_0x2c6ca7['push'](_0x2c6ca7['shift']());}};_0x37e6d5(++_0x58d9fe);}(_0x245e,0x11d));var _0xe245=function(_0x419122,_0xdb0c0f){_0x419122=_0x419122-0x0;var _0x58cfd0=_0x245e[_0x419122];return _0x58cfd0;};'use strict';var _=require(_0xe245('0x0'));var util=require(_0xe245('0x1'));var moment=require(_0xe245('0x2'));var BPromise=require('bluebird');var rs=require(_0xe245('0x3'));var fs=require('fs');var Redis=require(_0xe245('0x4'));var db=require(_0xe245('0x5'))['db'];var utils=require(_0xe245('0x6'));var logger=require('../../config/logger')(_0xe245('0x7'));var config=require(_0xe245('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe245('0x9')][_0xe245('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b2436,_0x3ca3f1,_0x122375){return new BPromise(function(_0x4e4201,_0xe4bace){return client[_0xe245('0xb')](_0x1b2436,_0x122375)[_0xe245('0xc')](function(_0x483e76){logger[_0xe245('0xd')](_0xe245('0xe'),_0x3ca3f1,_0xe245('0xf'));logger[_0xe245('0x10')](_0xe245('0x11'),_0x3ca3f1,_0xe245('0xf'),JSON[_0xe245('0x12')](_0x483e76));if(_0x483e76['error']){if(_0x483e76[_0xe245('0x13')][_0xe245('0x14')]===0x1f4){logger[_0xe245('0x13')](_0xe245('0xe'),_0x3ca3f1,_0x483e76[_0xe245('0x13')]['message']);return _0xe4bace(_0x483e76[_0xe245('0x13')][_0xe245('0x15')]);}logger[_0xe245('0x13')](_0xe245('0xe'),_0x3ca3f1,_0x483e76['error'][_0xe245('0x15')]);return _0x4e4201(_0x483e76['error']['message']);}else{logger[_0xe245('0xd')](_0xe245('0xe'),_0x3ca3f1,_0xe245('0xf'));_0x4e4201(_0x483e76[_0xe245('0x16')]['message']);}})[_0xe245('0x17')](function(_0x398bda){logger['error'](_0xe245('0xe'),_0x3ca3f1,_0x398bda);_0xe4bace(_0x398bda);});});} \ No newline at end of file +var _0xea1a=['info','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','TeamVoiceQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x33e402,_0x4933ce){var _0x23f98f=function(_0x2009f0){while(--_0x2009f0){_0x33e402['push'](_0x33e402['shift']());}};_0x23f98f(++_0x4933ce);}(_0xea1a,0x158));var _0xaea1=function(_0x547bbc,_0xbd0069){_0x547bbc=_0x547bbc-0x0;var _0x4d5157=_0xea1a[_0x547bbc];return _0x4d5157;};'use strict';var _=require(_0xaea1('0x0'));var util=require(_0xaea1('0x1'));var moment=require(_0xaea1('0x2'));var BPromise=require(_0xaea1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaea1('0x4'));var db=require(_0xaea1('0x5'))['db'];var utils=require(_0xaea1('0x6'));var logger=require(_0xaea1('0x7'))(_0xaea1('0x8'));var config=require(_0xaea1('0x9'));var jayson=require(_0xaea1('0xa'));var client=jayson[_0xaea1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x884233,_0x8883ab,_0x3359a9){return new BPromise(function(_0x51ca63,_0x1b5adf){return client['request'](_0x884233,_0x3359a9)[_0xaea1('0xc')](function(_0x4892e0){logger[_0xaea1('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x8883ab,'request\x20sent');logger['debug'](_0xaea1('0xe'),_0x8883ab,'request\x20sent',JSON['stringify'](_0x4892e0));if(_0x4892e0[_0xaea1('0xf')]){if(_0x4892e0[_0xaea1('0xf')]['code']===0x1f4){logger[_0xaea1('0xf')](_0xaea1('0x10'),_0x8883ab,_0x4892e0[_0xaea1('0xf')][_0xaea1('0x11')]);return _0x1b5adf(_0x4892e0[_0xaea1('0xf')][_0xaea1('0x11')]);}logger[_0xaea1('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x8883ab,_0x4892e0[_0xaea1('0xf')][_0xaea1('0x11')]);return _0x51ca63(_0x4892e0[_0xaea1('0xf')][_0xaea1('0x11')]);}else{logger[_0xaea1('0xd')](_0xaea1('0x10'),_0x8883ab,_0xaea1('0x12'));_0x51ca63(_0x4892e0[_0xaea1('0x13')][_0xaea1('0x11')]);}})[_0xaea1('0x14')](function(_0x2920f7){logger[_0xaea1('0xf')](_0xaea1('0x10'),_0x8883ab,_0x2920f7);_0x1b5adf(_0x2920f7);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index bbc692b..cfba50c 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 _0x58e6=['./template.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x58e6,0x1c2));var _0x658e=function(_0x76e8c5,_0x31e2e8){_0x76e8c5=_0x76e8c5-0x0;var _0x5ed35e=_0x58e6[_0x76e8c5];return _0x5ed35e;};'use strict';var multer=require(_0x658e('0x0'));var util=require(_0x658e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x658e('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x658e('0x3'));var interaction=require(_0x658e('0x4'));var config=require(_0x658e('0x5'));var controller=require(_0x658e('0x6'));router[_0x658e('0x7')]('/',auth[_0x658e('0x8')](),controller[_0x658e('0x9')]);router['get']('/:id',auth[_0x658e('0x8')](),controller[_0x658e('0xa')]);router[_0x658e('0xb')]('/',auth['isAuthenticated'](),controller[_0x658e('0xc')]);router[_0x658e('0xd')](_0x658e('0xe'),auth[_0x658e('0x8')](),controller[_0x658e('0xf')]);router[_0x658e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x658e('0x11')]);module[_0x658e('0x12')]=router; \ No newline at end of file +var _0x19e1=['../../components/auth/service','../../config/environment','./template.controller','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0xbc9b18,_0x4b8e42){var _0x432f8a=function(_0x44ab81){while(--_0x44ab81){_0xbc9b18['push'](_0xbc9b18['shift']());}};_0x432f8a(++_0x4b8e42);}(_0x19e1,0x163));var _0x119e=function(_0x2c6810,_0x23c079){_0x2c6810=_0x2c6810-0x0;var _0x213881=_0x19e1[_0x2c6810];return _0x213881;};'use strict';var multer=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var path=require(_0x119e('0x2'));var timeout=require(_0x119e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x119e('0x4'));var auth=require(_0x119e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x119e('0x6'));var controller=require(_0x119e('0x7'));router['get']('/',auth[_0x119e('0x8')](),controller['index']);router[_0x119e('0x9')](_0x119e('0xa'),auth[_0x119e('0x8')](),controller[_0x119e('0xb')]);router['post']('/',auth[_0x119e('0x8')](),controller[_0x119e('0xc')]);router[_0x119e('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x119e('0xe')]);router[_0x119e('0xf')](_0x119e('0xa'),auth[_0x119e('0x8')](),controller[_0x119e('0x10')]);module[_0x119e('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index b443a5f..35622f1 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 _0xb396=['TEXT','sequelize','exports','STRING'];(function(_0x1cbec5,_0x22f400){var _0x37d083=function(_0x3e06e4){while(--_0x3e06e4){_0x1cbec5['push'](_0x1cbec5['shift']());}};_0x37d083(++_0x22f400);}(_0xb396,0x6d));var _0x6b39=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb396[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x6b39('0x0'));module[_0x6b39('0x1')]={'name':{'type':Sequelize[_0x6b39('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x6b39('0x3')]}}; \ No newline at end of file +var _0x32fb=['TEXT','sequelize','exports','STRING'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x32fb,0x75));var _0xb32f=function(_0x1b4182,_0x2ba6c7){_0x1b4182=_0x1b4182-0x0;var _0x36a2ac=_0x32fb[_0x1b4182];return _0x36a2ac;};'use strict';var Sequelize=require(_0xb32f('0x0'));module[_0xb32f('0x1')]={'name':{'type':Sequelize[_0xb32f('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xb32f('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index d3e2853..24f1aef 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 _0xfeb1=['querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','get','Templates','UserProfileResource','error','stack','name','index','map','Template','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','merge','VIRTUAL','options','include','rows','catch','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js'];(function(_0x5da68b,_0x16711d){var _0x5e7393=function(_0x3ddacf){while(--_0x3ddacf){_0x5da68b['push'](_0x5da68b['shift']());}};_0x5e7393(++_0x16711d);}(_0xfeb1,0x131));var _0x1feb=function(_0x2aaa29,_0x4f017c){_0x2aaa29=_0x2aaa29-0x0;var _0x41c7b4=_0xfeb1[_0x2aaa29];return _0x41c7b4;};'use strict';var emlformat=require(_0x1feb('0x0'));var rimraf=require(_0x1feb('0x1'));var zipdir=require(_0x1feb('0x2'));var jsonpatch=require(_0x1feb('0x3'));var rp=require(_0x1feb('0x4'));var moment=require('moment');var BPromise=require(_0x1feb('0x5'));var Mustache=require(_0x1feb('0x6'));var util=require(_0x1feb('0x7'));var path=require('path');var sox=require(_0x1feb('0x8'));var csv=require(_0x1feb('0x9'));var ejs=require(_0x1feb('0xa'));var fs=require('fs');var fs_extra=require(_0x1feb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1feb('0xc'));var jsforce=require(_0x1feb('0xd'));var deskjs=require(_0x1feb('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1feb('0xf'));var Papa=require('papaparse');var Redis=require(_0x1feb('0x10'));var authService=require(_0x1feb('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1feb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1feb('0x13'))(_0x1feb('0x14'));var utils=require('../../config/utils');var config=require(_0x1feb('0x15'));var licenseUtil=require(_0x1feb('0x16'));var db=require(_0x1feb('0x17'))['db'];function respondWithStatusCode(_0xb86184,_0xf33e2a){_0xf33e2a=_0xf33e2a||0xcc;return function(_0x2b42f8){if(_0x2b42f8){return _0xb86184[_0x1feb('0x18')](_0xf33e2a);}return _0xb86184[_0x1feb('0x19')](_0xf33e2a)[_0x1feb('0x1a')]();};}function respondWithResult(_0x2b5b61,_0x198434){_0x198434=_0x198434||0xc8;return function(_0xc1dab8){if(_0xc1dab8){return _0x2b5b61[_0x1feb('0x19')](_0x198434)[_0x1feb('0x1b')](_0xc1dab8);}};}function respondWithFilteredResult(_0x5442d8,_0x378f11){return function(_0x200e09){if(_0x200e09){var _0x4ffd0a=typeof _0x378f11[_0x1feb('0x1c')]===_0x1feb('0x1d')&&typeof _0x378f11['limit']===_0x1feb('0x1d');var _0x1fac3f=_0x200e09[_0x1feb('0x1e')];var _0x1a1cbc=_0x4ffd0a?0x0:_0x378f11[_0x1feb('0x1c')];var _0x1aba32=_0x4ffd0a?_0x200e09[_0x1feb('0x1e')]:_0x378f11[_0x1feb('0x1c')]+_0x378f11[_0x1feb('0x1f')];var _0x2eb558;if(_0x1aba32>=_0x1fac3f){_0x1aba32=_0x1fac3f;_0x2eb558=0xc8;}else{_0x2eb558=0xce;}_0x5442d8[_0x1feb('0x19')](_0x2eb558);return _0x5442d8[_0x1feb('0x20')](_0x1feb('0x21'),_0x1a1cbc+'-'+_0x1aba32+'/'+_0x1fac3f)[_0x1feb('0x1b')](_0x200e09);}return null;};}function patchUpdates(_0xce2aad){return function(_0x518e81){try{jsonpatch[_0x1feb('0x22')](_0x518e81,_0xce2aad,!![]);}catch(_0x59433c){return BPromise[_0x1feb('0x23')](_0x59433c);}return _0x518e81[_0x1feb('0x24')]();};}function saveUpdates(_0xb0ee75,_0x16e0af){return function(_0x2316d5){if(_0x2316d5){return _0x2316d5[_0x1feb('0x25')](_0xb0ee75)['then'](function(_0x4a6407){return _0x4a6407;});}return null;};}function removeEntity(_0x57d501,_0x1282d3){return function(_0x57d9f2){if(_0x57d9f2){return _0x57d9f2[_0x1feb('0x26')]()[_0x1feb('0x27')](function(){var _0x17a123=_0x57d9f2[_0x1feb('0x28')]({'plain':!![]});var _0x38ab0f=_0x1feb('0x29');return db[_0x1feb('0x2a')][_0x1feb('0x26')]({'where':{'type':_0x38ab0f,'resourceId':_0x17a123['id']}})[_0x1feb('0x27')](function(){return _0x57d9f2;});})[_0x1feb('0x27')](function(){_0x57d501['status'](0xcc)[_0x1feb('0x1a')]();});}};}function handleEntityNotFound(_0x529655,_0x42bfba){return function(_0x3977be){if(!_0x3977be){_0x529655[_0x1feb('0x18')](0x194);}return _0x3977be;};}function handleError(_0x14071e,_0x55b01e){_0x55b01e=_0x55b01e||0x1f4;return function(_0x16c2bf){logger[_0x1feb('0x2b')](_0x16c2bf[_0x1feb('0x2c')]);if(_0x16c2bf[_0x1feb('0x2d')]){delete _0x16c2bf[_0x1feb('0x2d')];}_0x14071e[_0x1feb('0x19')](_0x55b01e)['send'](_0x16c2bf);};}exports[_0x1feb('0x2e')]=function(_0x249b3b,_0x364905){var _0x51ca2f={},_0x6d5277={},_0x491dfd={'count':0x0,'rows':[]};var _0x37a383=_[_0x1feb('0x2f')](db[_0x1feb('0x30')][_0x1feb('0x31')],function(_0x13a879){return{'name':_0x13a879['fieldName'],'type':_0x13a879[_0x1feb('0x32')][_0x1feb('0x33')]};});_0x6d5277[_0x1feb('0x34')]=_[_0x1feb('0x2f')](_0x37a383,_0x1feb('0x2d'));_0x6d5277[_0x1feb('0x35')]=_[_0x1feb('0x36')](_0x249b3b[_0x1feb('0x35')]);_0x6d5277[_0x1feb('0x37')]=_[_0x1feb('0x38')](_0x6d5277[_0x1feb('0x34')],_0x6d5277['query']);_0x51ca2f[_0x1feb('0x39')]=_['intersection'](_0x6d5277[_0x1feb('0x34')],qs[_0x1feb('0x3a')](_0x249b3b['query'][_0x1feb('0x3a')]));_0x51ca2f[_0x1feb('0x39')]=_0x51ca2f[_0x1feb('0x39')][_0x1feb('0x3b')]?_0x51ca2f[_0x1feb('0x39')]:_0x6d5277[_0x1feb('0x34')];if(!_0x249b3b[_0x1feb('0x35')][_0x1feb('0x3c')]('nolimit')){_0x51ca2f['limit']=qs['limit'](_0x249b3b[_0x1feb('0x35')]['limit']);_0x51ca2f[_0x1feb('0x1c')]=qs[_0x1feb('0x1c')](_0x249b3b[_0x1feb('0x35')][_0x1feb('0x1c')]);}_0x51ca2f[_0x1feb('0x3d')]=qs['sort'](_0x249b3b[_0x1feb('0x35')]['sort']);_0x51ca2f[_0x1feb('0x3e')]=qs[_0x1feb('0x37')](_[_0x1feb('0x3f')](_0x249b3b['query'],_0x6d5277[_0x1feb('0x37')]),_0x37a383);if(_0x249b3b['query']['filter']){_0x51ca2f[_0x1feb('0x3e')]=_[_0x1feb('0x40')](_0x51ca2f[_0x1feb('0x3e')],{'$or':_[_0x1feb('0x2f')](_0x37a383,function(_0x5c9523){if(_0x5c9523[_0x1feb('0x32')]!==_0x1feb('0x41')){var _0x5d045d={};_0x5d045d[_0x5c9523[_0x1feb('0x2d')]]={'$like':'%'+_0x249b3b['query']['filter']+'%'};return _0x5d045d;}})});}_0x51ca2f=_['merge']({},_0x51ca2f,_0x249b3b[_0x1feb('0x42')]);var _0x4301c6={'where':_0x51ca2f[_0x1feb('0x3e')]};return db[_0x1feb('0x30')][_0x1feb('0x1e')](_0x4301c6)[_0x1feb('0x27')](function(_0x7d5cfb){_0x491dfd['count']=_0x7d5cfb;if(_0x249b3b[_0x1feb('0x35')]['includeAll']){_0x51ca2f[_0x1feb('0x43')]=[{'all':!![]}];}return db[_0x1feb('0x30')]['findAll'](_0x51ca2f);})[_0x1feb('0x27')](function(_0x4517d1){_0x491dfd[_0x1feb('0x44')]=_0x4517d1;return _0x491dfd;})[_0x1feb('0x27')](respondWithFilteredResult(_0x364905,_0x51ca2f))[_0x1feb('0x45')](handleError(_0x364905,null));};exports['show']=function(_0x410483,_0x22de44){var _0xb15e00={'raw':!![],'where':{'id':_0x410483[_0x1feb('0x46')]['id']}},_0x5287bc={};_0x5287bc[_0x1feb('0x34')]=_[_0x1feb('0x36')](db[_0x1feb('0x30')][_0x1feb('0x31')]);_0x5287bc[_0x1feb('0x35')]=_[_0x1feb('0x36')](_0x410483['query']);_0x5287bc[_0x1feb('0x37')]=_[_0x1feb('0x38')](_0x5287bc['model'],_0x5287bc['query']);_0xb15e00[_0x1feb('0x39')]=_[_0x1feb('0x38')](_0x5287bc[_0x1feb('0x34')],qs[_0x1feb('0x3a')](_0x410483[_0x1feb('0x35')][_0x1feb('0x3a')]));_0xb15e00[_0x1feb('0x39')]=_0xb15e00[_0x1feb('0x39')][_0x1feb('0x3b')]?_0xb15e00[_0x1feb('0x39')]:_0x5287bc[_0x1feb('0x34')];if(_0x410483['query'][_0x1feb('0x47')]){_0xb15e00[_0x1feb('0x43')]=[{'all':!![]}];}_0xb15e00=_['merge']({},_0xb15e00,_0x410483[_0x1feb('0x42')]);return db['Template']['find'](_0xb15e00)[_0x1feb('0x27')](handleEntityNotFound(_0x22de44,null))['then'](respondWithResult(_0x22de44,null))[_0x1feb('0x45')](handleError(_0x22de44,null));};exports[_0x1feb('0x48')]=function(_0x522dca,_0x3d4feb){return db[_0x1feb('0x30')][_0x1feb('0x48')](_0x522dca[_0x1feb('0x49')],{})[_0x1feb('0x27')](function(_0x9e2e20){var _0x512f4f=_0x522dca['user'][_0x1feb('0x28')]({'plain':!![]});if(!_0x512f4f)throw new Error(_0x1feb('0x4a'));if(_0x512f4f[_0x1feb('0x4b')]==='user'){var _0x1de9a5=_0x9e2e20[_0x1feb('0x28')]({'plain':!![]});var _0x3dc074='Templates';return db[_0x1feb('0x4c')][_0x1feb('0x4d')]({'where':{'name':_0x3dc074,'userProfileId':_0x512f4f['userProfileId']},'raw':!![]})[_0x1feb('0x27')](function(_0x2d1c29){if(_0x2d1c29&&_0x2d1c29[_0x1feb('0x4e')]===0x0){return db[_0x1feb('0x2a')][_0x1feb('0x48')]({'name':_0x1de9a5[_0x1feb('0x2d')],'resourceId':_0x1de9a5['id'],'type':_0x2d1c29['name'],'sectionId':_0x2d1c29['id']},{})[_0x1feb('0x27')](function(){return _0x9e2e20;});}else{return _0x9e2e20;}})['catch'](function(_0x1d3d4e){logger[_0x1feb('0x2b')](_0x1feb('0x4f'),_0x1d3d4e);throw _0x1d3d4e;});}return _0x9e2e20;})['then'](respondWithResult(_0x3d4feb,0xc9))[_0x1feb('0x45')](handleError(_0x3d4feb,null));};exports[_0x1feb('0x25')]=function(_0x16d913,_0xa8c59e){if(_0x16d913[_0x1feb('0x49')]['id']){delete _0x16d913[_0x1feb('0x49')]['id'];}return db[_0x1feb('0x30')][_0x1feb('0x4d')]({'where':{'id':_0x16d913['params']['id']}})['then'](handleEntityNotFound(_0xa8c59e,null))[_0x1feb('0x27')](saveUpdates(_0x16d913[_0x1feb('0x49')],null))[_0x1feb('0x27')](respondWithResult(_0xa8c59e,null))[_0x1feb('0x45')](handleError(_0xa8c59e,null));};exports['destroy']=function(_0x485fa8,_0x29ecfd){return db[_0x1feb('0x30')]['find']({'where':{'id':_0x485fa8[_0x1feb('0x46')]['id']}})['then'](handleEntityNotFound(_0x29ecfd,null))[_0x1feb('0x27')](removeEntity(_0x29ecfd,null))[_0x1feb('0x45')](handleError(_0x29ecfd,null));}; \ No newline at end of file +var _0x0431=['merge','Template','count','catch','show','params','keys','include','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','get','Templates','UserProfileResource','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0x0431,0x1ad));var _0x1043=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x0431[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require(_0x1043('0x0'));var rimraf=require(_0x1043('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1043('0x2'));var rp=require('request-promise');var moment=require(_0x1043('0x3'));var BPromise=require(_0x1043('0x4'));var Mustache=require('mustache');var util=require(_0x1043('0x5'));var path=require(_0x1043('0x6'));var sox=require(_0x1043('0x7'));var csv=require(_0x1043('0x8'));var ejs=require(_0x1043('0x9'));var fs=require('fs');var fs_extra=require(_0x1043('0xa'));var _=require(_0x1043('0xb'));var squel=require(_0x1043('0xc'));var crypto=require(_0x1043('0xd'));var jsforce=require(_0x1043('0xe'));var deskjs=require(_0x1043('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1043('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1043('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1043('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1043('0x13'));var utils=require(_0x1043('0x14'));var config=require(_0x1043('0x15'));var licenseUtil=require(_0x1043('0x16'));var db=require(_0x1043('0x17'))['db'];function respondWithStatusCode(_0x9e7600,_0x4b7b93){_0x4b7b93=_0x4b7b93||0xcc;return function(_0x3320e9){if(_0x3320e9){return _0x9e7600['sendStatus'](_0x4b7b93);}return _0x9e7600[_0x1043('0x18')](_0x4b7b93)['end']();};}function respondWithResult(_0x454572,_0x375442){_0x375442=_0x375442||0xc8;return function(_0xdac290){if(_0xdac290){return _0x454572[_0x1043('0x18')](_0x375442)[_0x1043('0x19')](_0xdac290);}};}function respondWithFilteredResult(_0xcf0cf4,_0x584608){return function(_0x1a5a64){if(_0x1a5a64){var _0x32d14d=typeof _0x584608[_0x1043('0x1a')]===_0x1043('0x1b')&&typeof _0x584608['limit']==='undefined';var _0x14a72f=_0x1a5a64['count'];var _0x5440db=_0x32d14d?0x0:_0x584608['offset'];var _0x4eefa2=_0x32d14d?_0x1a5a64['count']:_0x584608[_0x1043('0x1a')]+_0x584608[_0x1043('0x1c')];var _0x1c9b9f;if(_0x4eefa2>=_0x14a72f){_0x4eefa2=_0x14a72f;_0x1c9b9f=0xc8;}else{_0x1c9b9f=0xce;}_0xcf0cf4['status'](_0x1c9b9f);return _0xcf0cf4[_0x1043('0x1d')](_0x1043('0x1e'),_0x5440db+'-'+_0x4eefa2+'/'+_0x14a72f)[_0x1043('0x19')](_0x1a5a64);}return null;};}function patchUpdates(_0x598256){return function(_0x61344b){try{jsonpatch[_0x1043('0x1f')](_0x61344b,_0x598256,!![]);}catch(_0x1de731){return BPromise[_0x1043('0x20')](_0x1de731);}return _0x61344b[_0x1043('0x21')]();};}function saveUpdates(_0x383f60,_0x5b38aa){return function(_0xed759f){if(_0xed759f){return _0xed759f[_0x1043('0x22')](_0x383f60)[_0x1043('0x23')](function(_0x4a6dff){return _0x4a6dff;});}return null;};}function removeEntity(_0x1182eb,_0x273e20){return function(_0x38de8b){if(_0x38de8b){return _0x38de8b['destroy']()[_0x1043('0x23')](function(){var _0x271380=_0x38de8b[_0x1043('0x24')]({'plain':!![]});var _0x2a3419=_0x1043('0x25');return db[_0x1043('0x26')]['destroy']({'where':{'type':_0x2a3419,'resourceId':_0x271380['id']}})[_0x1043('0x23')](function(){return _0x38de8b;});})[_0x1043('0x23')](function(){_0x1182eb[_0x1043('0x18')](0xcc)[_0x1043('0x27')]();});}};}function handleEntityNotFound(_0x2da62d,_0x4f44ed){return function(_0x361e49){if(!_0x361e49){_0x2da62d[_0x1043('0x28')](0x194);}return _0x361e49;};}function handleError(_0x47f513,_0x407cce){_0x407cce=_0x407cce||0x1f4;return function(_0x79809a){logger[_0x1043('0x29')](_0x79809a[_0x1043('0x2a')]);if(_0x79809a['name']){delete _0x79809a[_0x1043('0x2b')];}_0x47f513[_0x1043('0x18')](_0x407cce)[_0x1043('0x2c')](_0x79809a);};}exports[_0x1043('0x2d')]=function(_0x1e1a9c,_0x17d8c6){var _0x39c1cc={},_0x384d6e={},_0x3e9e27={'count':0x0,'rows':[]};var _0x36d9c3=_['map'](db['Template'][_0x1043('0x2e')],function(_0x49b736){return{'name':_0x49b736[_0x1043('0x2f')],'type':_0x49b736[_0x1043('0x30')][_0x1043('0x31')]};});_0x384d6e[_0x1043('0x32')]=_[_0x1043('0x33')](_0x36d9c3,_0x1043('0x2b'));_0x384d6e['query']=_['keys'](_0x1e1a9c[_0x1043('0x34')]);_0x384d6e[_0x1043('0x35')]=_[_0x1043('0x36')](_0x384d6e['model'],_0x384d6e[_0x1043('0x34')]);_0x39c1cc['attributes']=_[_0x1043('0x36')](_0x384d6e[_0x1043('0x32')],qs['fields'](_0x1e1a9c[_0x1043('0x34')][_0x1043('0x37')]));_0x39c1cc[_0x1043('0x38')]=_0x39c1cc[_0x1043('0x38')][_0x1043('0x39')]?_0x39c1cc['attributes']:_0x384d6e['model'];if(!_0x1e1a9c['query'][_0x1043('0x3a')]('nolimit')){_0x39c1cc['limit']=qs['limit'](_0x1e1a9c[_0x1043('0x34')]['limit']);_0x39c1cc[_0x1043('0x1a')]=qs[_0x1043('0x1a')](_0x1e1a9c[_0x1043('0x34')][_0x1043('0x1a')]);}_0x39c1cc[_0x1043('0x3b')]=qs[_0x1043('0x3c')](_0x1e1a9c[_0x1043('0x34')]['sort']);_0x39c1cc[_0x1043('0x3d')]=qs[_0x1043('0x35')](_['pick'](_0x1e1a9c[_0x1043('0x34')],_0x384d6e[_0x1043('0x35')]),_0x36d9c3);if(_0x1e1a9c[_0x1043('0x34')][_0x1043('0x3e')]){_0x39c1cc['where']=_[_0x1043('0x3f')](_0x39c1cc[_0x1043('0x3d')],{'$or':_[_0x1043('0x33')](_0x36d9c3,function(_0x59245e){if(_0x59245e[_0x1043('0x30')]!=='VIRTUAL'){var _0x286650={};_0x286650[_0x59245e[_0x1043('0x2b')]]={'$like':'%'+_0x1e1a9c[_0x1043('0x34')][_0x1043('0x3e')]+'%'};return _0x286650;}})});}_0x39c1cc=_[_0x1043('0x3f')]({},_0x39c1cc,_0x1e1a9c['options']);var _0x18ed90={'where':_0x39c1cc[_0x1043('0x3d')]};return db[_0x1043('0x40')][_0x1043('0x41')](_0x18ed90)[_0x1043('0x23')](function(_0x40d392){_0x3e9e27[_0x1043('0x41')]=_0x40d392;if(_0x1e1a9c[_0x1043('0x34')]['includeAll']){_0x39c1cc['include']=[{'all':!![]}];}return db[_0x1043('0x40')]['findAll'](_0x39c1cc);})[_0x1043('0x23')](function(_0x8df6ce){_0x3e9e27['rows']=_0x8df6ce;return _0x3e9e27;})['then'](respondWithFilteredResult(_0x17d8c6,_0x39c1cc))[_0x1043('0x42')](handleError(_0x17d8c6,null));};exports[_0x1043('0x43')]=function(_0x3397e5,_0x46b256){var _0x52a66e={'raw':!![],'where':{'id':_0x3397e5[_0x1043('0x44')]['id']}},_0x41f211={};_0x41f211[_0x1043('0x32')]=_[_0x1043('0x45')](db[_0x1043('0x40')][_0x1043('0x2e')]);_0x41f211['query']=_[_0x1043('0x45')](_0x3397e5[_0x1043('0x34')]);_0x41f211[_0x1043('0x35')]=_[_0x1043('0x36')](_0x41f211[_0x1043('0x32')],_0x41f211[_0x1043('0x34')]);_0x52a66e[_0x1043('0x38')]=_['intersection'](_0x41f211['model'],qs['fields'](_0x3397e5['query']['fields']));_0x52a66e['attributes']=_0x52a66e[_0x1043('0x38')][_0x1043('0x39')]?_0x52a66e['attributes']:_0x41f211[_0x1043('0x32')];if(_0x3397e5[_0x1043('0x34')]['includeAll']){_0x52a66e[_0x1043('0x46')]=[{'all':!![]}];}_0x52a66e=_[_0x1043('0x3f')]({},_0x52a66e,_0x3397e5[_0x1043('0x47')]);return db[_0x1043('0x40')][_0x1043('0x48')](_0x52a66e)[_0x1043('0x23')](handleEntityNotFound(_0x46b256,null))[_0x1043('0x23')](respondWithResult(_0x46b256,null))[_0x1043('0x42')](handleError(_0x46b256,null));};exports[_0x1043('0x49')]=function(_0x3604d7,_0x3d95fa){return db[_0x1043('0x40')][_0x1043('0x49')](_0x3604d7[_0x1043('0x4a')],{})[_0x1043('0x23')](function(_0x4710be){var _0x162653=_0x3604d7['user'][_0x1043('0x24')]({'plain':!![]});if(!_0x162653)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x162653[_0x1043('0x4b')]===_0x1043('0x4c')){var _0x561703=_0x4710be[_0x1043('0x24')]({'plain':!![]});var _0x5b5239='Templates';return db[_0x1043('0x4d')]['find']({'where':{'name':_0x5b5239,'userProfileId':_0x162653[_0x1043('0x4e')]},'raw':!![]})[_0x1043('0x23')](function(_0x141012){if(_0x141012&&_0x141012[_0x1043('0x4f')]===0x0){return db[_0x1043('0x26')][_0x1043('0x49')]({'name':_0x561703[_0x1043('0x2b')],'resourceId':_0x561703['id'],'type':_0x141012[_0x1043('0x2b')],'sectionId':_0x141012['id']},{})[_0x1043('0x23')](function(){return _0x4710be;});}else{return _0x4710be;}})[_0x1043('0x42')](function(_0x311e91){logger[_0x1043('0x29')](_0x1043('0x50'),_0x311e91);throw _0x311e91;});}return _0x4710be;})[_0x1043('0x23')](respondWithResult(_0x3d95fa,0xc9))[_0x1043('0x42')](handleError(_0x3d95fa,null));};exports[_0x1043('0x22')]=function(_0x623f99,_0x50097f){if(_0x623f99[_0x1043('0x4a')]['id']){delete _0x623f99[_0x1043('0x4a')]['id'];}return db['Template'][_0x1043('0x48')]({'where':{'id':_0x623f99['params']['id']}})[_0x1043('0x23')](handleEntityNotFound(_0x50097f,null))['then'](saveUpdates(_0x623f99['body'],null))[_0x1043('0x23')](respondWithResult(_0x50097f,null))[_0x1043('0x42')](handleError(_0x50097f,null));};exports[_0x1043('0x51')]=function(_0x108e1f,_0x2802f7){return db['Template'][_0x1043('0x48')]({'where':{'id':_0x108e1f['params']['id']}})[_0x1043('0x23')](handleEntityNotFound(_0x2802f7,null))[_0x1043('0x23')](removeEntity(_0x2802f7,null))[_0x1043('0x42')](handleError(_0x2802f7,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 60878f6..5083125 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 _0xa344=['define','Template','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./template.attributes'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0xa344,0x1ba));var _0x4a34=function(_0x5072a2,_0x2e6260){_0x5072a2=_0x5072a2-0x0;var _0x40d5e8=_0xa344[_0x5072a2];return _0x40d5e8;};'use strict';var _=require(_0x4a34('0x0'));var util=require(_0x4a34('0x1'));var logger=require(_0x4a34('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4a34('0x3'));var rp=require(_0x4a34('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a34('0x5'));var config=require(_0x4a34('0x6'));var attributes=require(_0x4a34('0x7'));module['exports']=function(_0x16c04d,_0x17ae97){return _0x16c04d[_0x4a34('0x8')](_0x4a34('0x9'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d91=['api','moment','bluebird','rimraf','../../config/environment','./template.attributes','exports','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d91,0x75));var _0x13d9=function(_0x891c55,_0x233fe8){_0x891c55=_0x891c55-0x0;var _0x260823=_0x3d91[_0x891c55];return _0x260823;};'use strict';var _=require(_0x13d9('0x0'));var util=require(_0x13d9('0x1'));var logger=require(_0x13d9('0x2'))(_0x13d9('0x3'));var moment=require(_0x13d9('0x4'));var BPromise=require(_0x13d9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x13d9('0x6'));var config=require(_0x13d9('0x7'));var attributes=require(_0x13d9('0x8'));module[_0x13d9('0x9')]=function(_0x123850,_0x3720ad){return _0x123850['define'](_0x13d9('0xa'),attributes,{'tableName':_0x13d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 7697bfd..5dab44f 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 _0x8665=['Template,\x20%s,\x20%s','message','info','catch','GetTemplate','Template','findAll','options','where','include','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0x8665,0xd6));var _0x5866=function(_0x119940,_0x265a3f){_0x119940=_0x119940-0x0;var _0x59af49=_0x8665[_0x119940];return _0x59af49;};'use strict';var _=require(_0x5866('0x0'));var util=require(_0x5866('0x1'));var moment=require(_0x5866('0x2'));var BPromise=require(_0x5866('0x3'));var rs=require(_0x5866('0x4'));var fs=require('fs');var Redis=require(_0x5866('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5866('0x6'));var logger=require(_0x5866('0x7'))(_0x5866('0x8'));var config=require('../../config/environment');var jayson=require(_0x5866('0x9'));var client=jayson[_0x5866('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39be0d,_0x1ea274,_0x4f212b){return new BPromise(function(_0x57b478,_0x37203c){return client['request'](_0x39be0d,_0x4f212b)[_0x5866('0xb')](function(_0x5e1ad5){logger['info']('Template,\x20%s,\x20%s',_0x1ea274,_0x5866('0xc'));logger[_0x5866('0xd')](_0x5866('0xe'),_0x1ea274,_0x5866('0xc'),JSON[_0x5866('0xf')](_0x5e1ad5));if(_0x5e1ad5[_0x5866('0x10')]){if(_0x5e1ad5[_0x5866('0x10')][_0x5866('0x11')]===0x1f4){logger['error']('Template,\x20%s,\x20%s',_0x1ea274,_0x5e1ad5[_0x5866('0x10')]['message']);return _0x37203c(_0x5e1ad5['error']['message']);}logger['error'](_0x5866('0x12'),_0x1ea274,_0x5e1ad5[_0x5866('0x10')]['message']);return _0x57b478(_0x5e1ad5['error'][_0x5866('0x13')]);}else{logger[_0x5866('0x14')]('Template,\x20%s,\x20%s',_0x1ea274,'request\x20sent');_0x57b478(_0x5e1ad5['result']['message']);}})[_0x5866('0x15')](function(_0x214434){logger[_0x5866('0x10')](_0x5866('0x12'),_0x1ea274,_0x214434);_0x37203c(_0x214434);});});}exports[_0x5866('0x16')]=function(_0x3a3260){var _0x333d27=this;return new Promise(function(_0x519a05,_0x5451bb){return db[_0x5866('0x17')][_0x5866('0x18')]({'raw':_0x3a3260[_0x5866('0x19')]?_0x3a3260[_0x5866('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3a3260[_0x5866('0x19')]?_0x3a3260[_0x5866('0x19')][_0x5866('0x1a')]||null:null,'attributes':_0x3a3260[_0x5866('0x19')]?_0x3a3260[_0x5866('0x19')]['attributes']||null:null,'limit':_0x3a3260['options']?_0x3a3260[_0x5866('0x19')]['limit']||null:null,'include':_0x3a3260['options']?_0x3a3260[_0x5866('0x19')][_0x5866('0x1b')]?_['map'](_0x3a3260[_0x5866('0x19')][_0x5866('0x1b')],function(_0x2f2f20){return{'model':db[_0x2f2f20['model']],'as':_0x2f2f20['as'],'attributes':_0x2f2f20[_0x5866('0x1c')],'include':_0x2f2f20['include']?_['map'](_0x2f2f20['include'],function(_0x1bdba8){return{'model':db[_0x1bdba8['model']],'as':_0x1bdba8['as'],'attributes':_0x1bdba8[_0x5866('0x1c')],'include':_0x1bdba8[_0x5866('0x1b')]?_['map'](_0x1bdba8['include'],function(_0x511cd5){return{'model':db[_0x511cd5['model']],'as':_0x511cd5['as'],'attributes':_0x511cd5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x25e288){logger[_0x5866('0x14')](_0x5866('0x16'),_0x3a3260);logger[_0x5866('0xd')](_0x5866('0x16'),_0x3a3260,JSON['stringify'](_0x25e288));_0x519a05(_0x25e288);})['catch'](function(_0xda0ec4){logger[_0x5866('0x10')](_0x5866('0x16'),_0xda0ec4[_0x5866('0x13')],_0x3a3260);_0x5451bb(_0x333d27[_0x5866('0x10')](0x1f4,_0xda0ec4[_0x5866('0x13')]));});});}; \ No newline at end of file +var _0xf93f=['model','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','stringify','error','code','Template,\x20%s,\x20%s','message','result','catch','GetTemplate','findAll','options','where','attributes','limit','include','map'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xf93f,0x97));var _0xff93=function(_0x257406,_0x38767e){_0x257406=_0x257406-0x0;var _0xa4f033=_0xf93f[_0x257406];return _0xa4f033;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xff93('0x0'));var BPromise=require(_0xff93('0x1'));var rs=require(_0xff93('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xff93('0x3'));var logger=require(_0xff93('0x4'))(_0xff93('0x5'));var config=require(_0xff93('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xff93('0x7')][_0xff93('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47a369,_0x208a71,_0x5ddf42){return new BPromise(function(_0x403f24,_0x330ff6){return client[_0xff93('0x9')](_0x47a369,_0x5ddf42)[_0xff93('0xa')](function(_0x1bdfdf){logger[_0xff93('0xb')]('Template,\x20%s,\x20%s',_0x208a71,_0xff93('0xc'));logger[_0xff93('0xd')]('Template,\x20%s,\x20%s,\x20%s',_0x208a71,_0xff93('0xc'),JSON[_0xff93('0xe')](_0x1bdfdf));if(_0x1bdfdf['error']){if(_0x1bdfdf[_0xff93('0xf')][_0xff93('0x10')]===0x1f4){logger['error'](_0xff93('0x11'),_0x208a71,_0x1bdfdf[_0xff93('0xf')][_0xff93('0x12')]);return _0x330ff6(_0x1bdfdf[_0xff93('0xf')]['message']);}logger[_0xff93('0xf')](_0xff93('0x11'),_0x208a71,_0x1bdfdf[_0xff93('0xf')][_0xff93('0x12')]);return _0x403f24(_0x1bdfdf['error'][_0xff93('0x12')]);}else{logger[_0xff93('0xb')](_0xff93('0x11'),_0x208a71,_0xff93('0xc'));_0x403f24(_0x1bdfdf[_0xff93('0x13')][_0xff93('0x12')]);}})[_0xff93('0x14')](function(_0x58a8c3){logger[_0xff93('0xf')](_0xff93('0x11'),_0x208a71,_0x58a8c3);_0x330ff6(_0x58a8c3);});});}exports[_0xff93('0x15')]=function(_0x1ea35b){var _0x41a631=this;return new Promise(function(_0x4d36da,_0x4294a6){return db['Template'][_0xff93('0x16')]({'raw':_0x1ea35b[_0xff93('0x17')]?_0x1ea35b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1ea35b[_0xff93('0x17')]?_0x1ea35b[_0xff93('0x17')][_0xff93('0x18')]||null:null,'attributes':_0x1ea35b[_0xff93('0x17')]?_0x1ea35b[_0xff93('0x17')][_0xff93('0x19')]||null:null,'limit':_0x1ea35b[_0xff93('0x17')]?_0x1ea35b[_0xff93('0x17')][_0xff93('0x1a')]||null:null,'include':_0x1ea35b['options']?_0x1ea35b[_0xff93('0x17')][_0xff93('0x1b')]?_['map'](_0x1ea35b[_0xff93('0x17')][_0xff93('0x1b')],function(_0x4adb9b){return{'model':db[_0x4adb9b['model']],'as':_0x4adb9b['as'],'attributes':_0x4adb9b[_0xff93('0x19')],'include':_0x4adb9b[_0xff93('0x1b')]?_[_0xff93('0x1c')](_0x4adb9b[_0xff93('0x1b')],function(_0x599e44){return{'model':db[_0x599e44[_0xff93('0x1d')]],'as':_0x599e44['as'],'attributes':_0x599e44[_0xff93('0x19')],'include':_0x599e44['include']?_[_0xff93('0x1c')](_0x599e44[_0xff93('0x1b')],function(_0x1aea40){return{'model':db[_0x1aea40[_0xff93('0x1d')]],'as':_0x1aea40['as'],'attributes':_0x1aea40['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e7c6d){logger['info'](_0xff93('0x15'),_0x1ea35b);logger[_0xff93('0xd')](_0xff93('0x15'),_0x1ea35b,JSON[_0xff93('0xe')](_0x2e7c6d));_0x4d36da(_0x2e7c6d);})[_0xff93('0x14')](function(_0x37abeb){logger[_0xff93('0xf')](_0xff93('0x15'),_0x37abeb['message'],_0x1ea35b);_0x4294a6(_0x41a631[_0xff93('0xf')](0x1f4,_0x37abeb[_0xff93('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index e7feb63..0585967 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 _0xeb00=['express','Router','fs-extra','../../config/environment','./trigger.controller','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAnyCondition','addAction','update','destroy','exports','multer','path','connect-timeout'];(function(_0x1ee050,_0x270265){var _0x17da86=function(_0xcdadfd){while(--_0xcdadfd){_0x1ee050['push'](_0x1ee050['shift']());}};_0x17da86(++_0x270265);}(_0xeb00,0x129));var _0x0eb0=function(_0x236091,_0x227dcf){_0x236091=_0x236091-0x0;var _0x586dd7=_0xeb00[_0x236091];return _0x586dd7;};'use strict';var multer=require(_0x0eb0('0x0'));var util=require('util');var path=require(_0x0eb0('0x1'));var timeout=require(_0x0eb0('0x2'));var express=require(_0x0eb0('0x3'));var router=express[_0x0eb0('0x4')]();var fs_extra=require(_0x0eb0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0eb0('0x6'));var controller=require(_0x0eb0('0x7'));router[_0x0eb0('0x8')]('/',auth[_0x0eb0('0x9')](),controller['index']);router[_0x0eb0('0x8')](_0x0eb0('0xa'),auth[_0x0eb0('0x9')](),controller[_0x0eb0('0xb')]);router[_0x0eb0('0x8')](_0x0eb0('0xc'),auth[_0x0eb0('0x9')](),controller[_0x0eb0('0xd')]);router[_0x0eb0('0x8')](_0x0eb0('0xe'),auth['isAuthenticated'](),controller[_0x0eb0('0xf')]);router[_0x0eb0('0x8')](_0x0eb0('0x10'),auth[_0x0eb0('0x9')](),controller['getActions']);router[_0x0eb0('0x11')]('/',auth[_0x0eb0('0x9')](),controller[_0x0eb0('0x12')]);router['post']('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x0eb0('0x13')]);router['post']('/:id/any_conditions',auth[_0x0eb0('0x9')](),controller[_0x0eb0('0x14')]);router['post'](_0x0eb0('0x10'),auth[_0x0eb0('0x9')](),controller[_0x0eb0('0x15')]);router['put']('/:id',auth[_0x0eb0('0x9')](),controller[_0x0eb0('0x16')]);router['delete'](_0x0eb0('0xa'),auth[_0x0eb0('0x9')](),controller[_0x0eb0('0x17')]);module[_0x0eb0('0x18')]=router; \ No newline at end of file +var _0x7a85=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','getActions','create','post','put','update','delete','exports','multer','path'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x7a85,0x16e));var _0x57a8=function(_0x5bd9e3,_0x5032c7){_0x5bd9e3=_0x5bd9e3-0x0;var _0x3ea89e=_0x7a85[_0x5bd9e3];return _0x3ea89e;};'use strict';var multer=require(_0x57a8('0x0'));var util=require('util');var path=require(_0x57a8('0x1'));var timeout=require('connect-timeout');var express=require(_0x57a8('0x2'));var router=express[_0x57a8('0x3')]();var fs_extra=require(_0x57a8('0x4'));var auth=require(_0x57a8('0x5'));var interaction=require(_0x57a8('0x6'));var config=require(_0x57a8('0x7'));var controller=require('./trigger.controller');router[_0x57a8('0x8')]('/',auth[_0x57a8('0x9')](),controller['index']);router[_0x57a8('0x8')](_0x57a8('0xa'),auth['isAuthenticated'](),controller[_0x57a8('0xb')]);router['get'](_0x57a8('0xc'),auth[_0x57a8('0x9')](),controller[_0x57a8('0xd')]);router['get'](_0x57a8('0xe'),auth[_0x57a8('0x9')](),controller['getAnyConditions']);router[_0x57a8('0x8')](_0x57a8('0xf'),auth['isAuthenticated'](),controller[_0x57a8('0x10')]);router['post']('/',auth[_0x57a8('0x9')](),controller[_0x57a8('0x11')]);router[_0x57a8('0x12')](_0x57a8('0xc'),auth[_0x57a8('0x9')](),controller['addAllCondition']);router[_0x57a8('0x12')]('/:id/any_conditions',auth[_0x57a8('0x9')](),controller['addAnyCondition']);router[_0x57a8('0x12')](_0x57a8('0xf'),auth[_0x57a8('0x9')](),controller['addAction']);router[_0x57a8('0x13')](_0x57a8('0xa'),auth[_0x57a8('0x9')](),controller[_0x57a8('0x14')]);router[_0x57a8('0x15')]('/:id',auth[_0x57a8('0x9')](),controller['destroy']);module[_0x57a8('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index f223b9a..8f4b38c 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 _0x4cdc=['exports','STRING','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4cdc,0x1eb));var _0xc4cd=function(_0x2c417e,_0x5a3eae){_0x2c417e=_0x2c417e-0x0;var _0x378313=_0x4cdc[_0x2c417e];return _0x378313;};'use strict';var Sequelize=require(_0xc4cd('0x0'));module[_0xc4cd('0x1')]={'name':{'type':Sequelize[_0xc4cd('0x2')]},'channel':{'type':Sequelize[_0xc4cd('0x2')]},'description':{'type':Sequelize[_0xc4cd('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0f50=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f50,0x74));var _0x00f5=function(_0x55938e,_0x50bcd0){_0x55938e=_0x55938e-0x0;var _0x1788a4=_0x0f50[_0x55938e];return _0x1788a4;};'use strict';var Sequelize=require(_0x00f5('0x0'));module[_0x00f5('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x00f5('0x2')]},'description':{'type':Sequelize[_0x00f5('0x2')]},'status':{'type':Sequelize[_0x00f5('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 e2f67fc..232b79a 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 _0xca6a=['order','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','limit','count','offset','set','apply','then','destroy','get','Triggers','UserProfileResource','end','error','stack','name','send','Trigger','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','rawAttributes'];(function(_0x4d1766,_0x204262){var _0x102e5f=function(_0x36a02c){while(--_0x36a02c){_0x4d1766['push'](_0x4d1766['shift']());}};_0x102e5f(++_0x204262);}(_0xca6a,0xbc));var _0xaca6=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0xca6a[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaca6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaca6('0x1'));var rp=require(_0xaca6('0x2'));var moment=require(_0xaca6('0x3'));var BPromise=require(_0xaca6('0x4'));var Mustache=require(_0xaca6('0x5'));var util=require(_0xaca6('0x6'));var path=require(_0xaca6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaca6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaca6('0x9'));var squel=require(_0xaca6('0xa'));var crypto=require(_0xaca6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xaca6('0xc'));var toCsv=require(_0xaca6('0xd'));var querystring=require(_0xaca6('0xe'));var Papa=require(_0xaca6('0xf'));var Redis=require(_0xaca6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xaca6('0x11'));var as=require(_0xaca6('0x12'));var hardwareService=require(_0xaca6('0x13'));var logger=require('../../config/logger')(_0xaca6('0x14'));var utils=require(_0xaca6('0x15'));var config=require(_0xaca6('0x16'));var licenseUtil=require(_0xaca6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x263617,_0x1111b8){_0x1111b8=_0x1111b8||0xcc;return function(_0x413dae){if(_0x413dae){return _0x263617[_0xaca6('0x18')](_0x1111b8);}return _0x263617[_0xaca6('0x19')](_0x1111b8)['end']();};}function respondWithResult(_0x335f93,_0x496767){_0x496767=_0x496767||0xc8;return function(_0x4cd64f){if(_0x4cd64f){return _0x335f93[_0xaca6('0x19')](_0x496767)['json'](_0x4cd64f);}};}function respondWithFilteredResult(_0x4da352,_0x586bf1){return function(_0x19167d){if(_0x19167d){var _0x33f930=typeof _0x586bf1['offset']===_0xaca6('0x1a')&&typeof _0x586bf1[_0xaca6('0x1b')]===_0xaca6('0x1a');var _0x200769=_0x19167d[_0xaca6('0x1c')];var _0x21c175=_0x33f930?0x0:_0x586bf1[_0xaca6('0x1d')];var _0xd1544b=_0x33f930?_0x19167d[_0xaca6('0x1c')]:_0x586bf1[_0xaca6('0x1d')]+_0x586bf1[_0xaca6('0x1b')];var _0x278388;if(_0xd1544b>=_0x200769){_0xd1544b=_0x200769;_0x278388=0xc8;}else{_0x278388=0xce;}_0x4da352[_0xaca6('0x19')](_0x278388);return _0x4da352[_0xaca6('0x1e')]('Content-Range',_0x21c175+'-'+_0xd1544b+'/'+_0x200769)['json'](_0x19167d);}return null;};}function patchUpdates(_0x477d72){return function(_0x2ca695){try{jsonpatch[_0xaca6('0x1f')](_0x2ca695,_0x477d72,!![]);}catch(_0x1e3307){return BPromise['reject'](_0x1e3307);}return _0x2ca695['save']();};}function saveUpdates(_0xf91d0e,_0x11f33c){return function(_0x506fad){if(_0x506fad){return _0x506fad['update'](_0xf91d0e)[_0xaca6('0x20')](function(_0x5e2f12){return _0x5e2f12;});}return null;};}function removeEntity(_0x1519c8,_0x26d977){return function(_0x343502){if(_0x343502){return _0x343502[_0xaca6('0x21')]()[_0xaca6('0x20')](function(){var _0x41fbc6=_0x343502[_0xaca6('0x22')]({'plain':!![]});var _0x1f8bd6=_0xaca6('0x23');return db[_0xaca6('0x24')]['destroy']({'where':{'type':_0x1f8bd6,'resourceId':_0x41fbc6['id']}})[_0xaca6('0x20')](function(){return _0x343502;});})[_0xaca6('0x20')](function(){_0x1519c8['status'](0xcc)[_0xaca6('0x25')]();});}};}function handleEntityNotFound(_0x55b758,_0x97906f){return function(_0x1adf9b){if(!_0x1adf9b){_0x55b758[_0xaca6('0x18')](0x194);}return _0x1adf9b;};}function handleError(_0x38e5ce,_0x1779a4){_0x1779a4=_0x1779a4||0x1f4;return function(_0x2ffa9d){logger[_0xaca6('0x26')](_0x2ffa9d[_0xaca6('0x27')]);if(_0x2ffa9d[_0xaca6('0x28')]){delete _0x2ffa9d['name'];}_0x38e5ce[_0xaca6('0x19')](_0x1779a4)[_0xaca6('0x29')](_0x2ffa9d);};}exports['index']=function(_0x3e13f3,_0x3cc4ba){var _0x22d789={},_0x25ce8b={},_0x2e7e9d={'count':0x0,'rows':[]};var _0x3bb770=_['map'](db[_0xaca6('0x2a')]['rawAttributes'],function(_0x2651b1){return{'name':_0x2651b1['fieldName'],'type':_0x2651b1[_0xaca6('0x2b')][_0xaca6('0x2c')]};});_0x25ce8b[_0xaca6('0x2d')]=_['map'](_0x3bb770,_0xaca6('0x28'));_0x25ce8b[_0xaca6('0x2e')]=_[_0xaca6('0x2f')](_0x3e13f3[_0xaca6('0x2e')]);_0x25ce8b[_0xaca6('0x30')]=_['intersection'](_0x25ce8b[_0xaca6('0x2d')],_0x25ce8b['query']);_0x22d789['attributes']=_[_0xaca6('0x31')](_0x25ce8b[_0xaca6('0x2d')],qs[_0xaca6('0x32')](_0x3e13f3[_0xaca6('0x2e')]['fields']));_0x22d789['attributes']=_0x22d789[_0xaca6('0x33')][_0xaca6('0x34')]?_0x22d789[_0xaca6('0x33')]:_0x25ce8b[_0xaca6('0x2d')];if(!_0x3e13f3['query'][_0xaca6('0x35')](_0xaca6('0x36'))){_0x22d789[_0xaca6('0x1b')]=qs[_0xaca6('0x1b')](_0x3e13f3[_0xaca6('0x2e')]['limit']);_0x22d789[_0xaca6('0x1d')]=qs['offset'](_0x3e13f3[_0xaca6('0x2e')][_0xaca6('0x1d')]);}_0x22d789['order']=qs[_0xaca6('0x37')](_0x3e13f3[_0xaca6('0x2e')][_0xaca6('0x37')]);_0x22d789['where']=qs[_0xaca6('0x30')](_[_0xaca6('0x38')](_0x3e13f3[_0xaca6('0x2e')],_0x25ce8b['filters']),_0x3bb770);if(_0x3e13f3[_0xaca6('0x2e')][_0xaca6('0x39')]){_0x22d789[_0xaca6('0x3a')]=_['merge'](_0x22d789['where'],{'$or':_[_0xaca6('0x3b')](_0x3bb770,function(_0xaf82b6){if(_0xaf82b6['type']!==_0xaca6('0x3c')){var _0x2b94af={};_0x2b94af[_0xaf82b6['name']]={'$like':'%'+_0x3e13f3[_0xaca6('0x2e')]['filter']+'%'};return _0x2b94af;}})});}_0x22d789=_[_0xaca6('0x3d')]({},_0x22d789,_0x3e13f3[_0xaca6('0x3e')]);var _0x434336={'where':_0x22d789[_0xaca6('0x3a')]};return db['Trigger'][_0xaca6('0x1c')](_0x434336)[_0xaca6('0x20')](function(_0x58a87b){_0x2e7e9d[_0xaca6('0x1c')]=_0x58a87b;if(_0x3e13f3[_0xaca6('0x2e')]['includeAll']){_0x22d789[_0xaca6('0x3f')]=[{'all':!![]}];}return db[_0xaca6('0x2a')][_0xaca6('0x40')](_0x22d789);})[_0xaca6('0x20')](function(_0x2bf073){_0x2e7e9d[_0xaca6('0x41')]=_0x2bf073;return _0x2e7e9d;})[_0xaca6('0x20')](respondWithFilteredResult(_0x3cc4ba,_0x22d789))[_0xaca6('0x42')](handleError(_0x3cc4ba,null));};exports[_0xaca6('0x43')]=function(_0x1df310,_0x1f5e59){var _0x1d0e5e={'raw':![],'where':{'id':_0x1df310[_0xaca6('0x44')]['id']}},_0x38c894={};_0x38c894['model']=_[_0xaca6('0x2f')](db[_0xaca6('0x2a')]['rawAttributes']);_0x38c894[_0xaca6('0x2e')]=_['keys'](_0x1df310[_0xaca6('0x2e')]);_0x38c894['filters']=_[_0xaca6('0x31')](_0x38c894[_0xaca6('0x2d')],_0x38c894[_0xaca6('0x2e')]);_0x1d0e5e[_0xaca6('0x33')]=_['intersection'](_0x38c894[_0xaca6('0x2d')],qs[_0xaca6('0x32')](_0x1df310[_0xaca6('0x2e')][_0xaca6('0x32')]));_0x1d0e5e[_0xaca6('0x33')]=_0x1d0e5e[_0xaca6('0x33')][_0xaca6('0x34')]?_0x1d0e5e['attributes']:_0x38c894[_0xaca6('0x2d')];if(_0x1df310[_0xaca6('0x2e')][_0xaca6('0x45')]){_0x1d0e5e['include']=[{'all':!![]}];}_0x1d0e5e=_[_0xaca6('0x3d')]({},_0x1d0e5e,_0x1df310[_0xaca6('0x3e')]);return db[_0xaca6('0x2a')][_0xaca6('0x46')](_0x1d0e5e)[_0xaca6('0x20')](handleEntityNotFound(_0x1f5e59,null))[_0xaca6('0x20')](respondWithResult(_0x1f5e59,null))[_0xaca6('0x42')](handleError(_0x1f5e59,null));};exports[_0xaca6('0x47')]=function(_0x2d5f6d,_0x1b631a){return db[_0xaca6('0x2a')][_0xaca6('0x47')](_0x2d5f6d['body'],{})[_0xaca6('0x20')](function(_0x55dc9d){var _0x235e28=_0x2d5f6d[_0xaca6('0x48')][_0xaca6('0x22')]({'plain':!![]});if(!_0x235e28)throw new Error(_0xaca6('0x49'));if(_0x235e28[_0xaca6('0x4a')]===_0xaca6('0x48')){var _0x5c65be=_0x55dc9d[_0xaca6('0x22')]({'plain':!![]});var _0x34c90c=_0xaca6('0x23');return db[_0xaca6('0x4b')][_0xaca6('0x46')]({'where':{'name':_0x34c90c,'userProfileId':_0x235e28['userProfileId']},'raw':!![]})[_0xaca6('0x20')](function(_0x123202){if(_0x123202&&_0x123202[_0xaca6('0x4c')]===0x0){return db['UserProfileResource']['create']({'name':_0x5c65be[_0xaca6('0x28')],'resourceId':_0x5c65be['id'],'type':_0x123202[_0xaca6('0x28')],'sectionId':_0x123202['id']},{})[_0xaca6('0x20')](function(){return _0x55dc9d;});}else{return _0x55dc9d;}})[_0xaca6('0x42')](function(_0x457434){logger[_0xaca6('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x457434);throw _0x457434;});}return _0x55dc9d;})[_0xaca6('0x20')](respondWithResult(_0x1b631a,0xc9))[_0xaca6('0x42')](handleError(_0x1b631a,null));};exports['update']=function(_0x3d8a65,_0x1987d4){if(_0x3d8a65[_0xaca6('0x4d')]['id']){delete _0x3d8a65['body']['id'];}return db[_0xaca6('0x2a')][_0xaca6('0x46')]({'where':{'id':_0x3d8a65[_0xaca6('0x44')]['id']}})['then'](handleEntityNotFound(_0x1987d4,null))['then'](saveUpdates(_0x3d8a65[_0xaca6('0x4d')],null))['then'](respondWithResult(_0x1987d4,null))['catch'](handleError(_0x1987d4,null));};exports[_0xaca6('0x21')]=function(_0x461589,_0x4b9cf3){return db[_0xaca6('0x2a')][_0xaca6('0x46')]({'where':{'id':_0x461589[_0xaca6('0x44')]['id']}})[_0xaca6('0x20')](handleEntityNotFound(_0x4b9cf3,null))[_0xaca6('0x20')](removeEntity(_0x4b9cf3,null))[_0xaca6('0x42')](handleError(_0x4b9cf3,null));};exports['addAllCondition']=function(_0x737e77,_0xa9cec5,_0x16b1b3){if(_0x737e77['body']['id']){delete _0x737e77[_0xaca6('0x4d')]['id'];}return db[_0xaca6('0x2a')]['find']({'where':{'id':_0x737e77[_0xaca6('0x44')]['id']}})[_0xaca6('0x20')](handleEntityNotFound(_0xa9cec5,null))[_0xaca6('0x20')](function(_0x2c16d4){if(_0x2c16d4){_0x737e77[_0xaca6('0x4d')][_0xaca6('0x4e')]=_0x2c16d4['id'];return db[_0xaca6('0x4f')][_0xaca6('0x47')](_0x737e77[_0xaca6('0x4d')]);}})[_0xaca6('0x20')](respondWithResult(_0xa9cec5,null))[_0xaca6('0x42')](handleError(_0xa9cec5,null));};exports[_0xaca6('0x50')]=function(_0x51de45,_0x342f2f,_0x14b9be){if(_0x51de45[_0xaca6('0x4d')]['id']){delete _0x51de45[_0xaca6('0x4d')]['id'];}return db[_0xaca6('0x2a')][_0xaca6('0x46')]({'where':{'id':_0x51de45[_0xaca6('0x44')]['id']}})[_0xaca6('0x20')](handleEntityNotFound(_0x342f2f,null))['then'](function(_0x365c81){if(_0x365c81){_0x51de45['body'][_0xaca6('0x51')]=_0x365c81['id'];return db['Condition']['create'](_0x51de45['body']);}})[_0xaca6('0x20')](respondWithResult(_0x342f2f,null))[_0xaca6('0x42')](handleError(_0x342f2f,null));};exports[_0xaca6('0x52')]=function(_0x244e39,_0x285c2f,_0x499201){var _0x1db039={};var _0x377260={};var _0x5e9bfb;var _0x3c1593;return db[_0xaca6('0x2a')][_0xaca6('0x53')]({'where':{'id':_0x244e39['params']['id']}})[_0xaca6('0x20')](handleEntityNotFound(_0x285c2f,null))[_0xaca6('0x20')](function(_0x1ce18b){if(_0x1ce18b){_0x5e9bfb=_0x1ce18b;_0x377260['model']=_[_0xaca6('0x2f')](db[_0xaca6('0x4f')][_0xaca6('0x54')]);_0x377260['query']=_[_0xaca6('0x2f')](_0x244e39[_0xaca6('0x2e')]);_0x377260[_0xaca6('0x30')]=_[_0xaca6('0x31')](_0x377260['model'],_0x377260['query']);_0x1db039['attributes']=_[_0xaca6('0x31')](_0x377260[_0xaca6('0x2d')],qs[_0xaca6('0x32')](_0x244e39[_0xaca6('0x2e')]['fields']));_0x1db039[_0xaca6('0x33')]=_0x1db039[_0xaca6('0x33')][_0xaca6('0x34')]?_0x1db039[_0xaca6('0x33')]:_0x377260[_0xaca6('0x2d')];_0x1db039[_0xaca6('0x55')]=qs[_0xaca6('0x37')](_0x244e39[_0xaca6('0x2e')]['sort']);_0x1db039[_0xaca6('0x3a')]=qs[_0xaca6('0x30')](_['pick'](_0x244e39[_0xaca6('0x2e')],_0x377260[_0xaca6('0x30')]));if(_0x244e39['query'][_0xaca6('0x39')]){_0x1db039[_0xaca6('0x3a')]=_[_0xaca6('0x3d')](_0x1db039['where'],{'$or':_['map'](_0x1db039['attributes'],function(_0x15073f){var _0x2c4220={};_0x2c4220[_0x15073f]={'$like':'%'+_0x244e39[_0xaca6('0x2e')][_0xaca6('0x39')]+'%'};return _0x2c4220;})});}_0x1db039=_[_0xaca6('0x3d')]({},_0x1db039,_0x244e39[_0xaca6('0x3e')]);return _0x5e9bfb['getAllConditions'](_0x1db039);}})['then'](function(_0x2babbc){if(_0x2babbc){_0x3c1593=_0x2babbc[_0xaca6('0x34')];if(!_0x244e39[_0xaca6('0x2e')]['hasOwnProperty'](_0xaca6('0x36'))){_0x1db039[_0xaca6('0x1b')]=qs[_0xaca6('0x1b')](_0x244e39['query']['limit']);_0x1db039[_0xaca6('0x1d')]=qs['offset'](_0x244e39['query'][_0xaca6('0x1d')]);}return _0x5e9bfb[_0xaca6('0x52')](_0x1db039);}})['then'](function(_0x1a6dce){if(_0x1a6dce){return _0x1a6dce?{'count':_0x3c1593,'rows':_0x1a6dce}:null;}})['then'](respondWithResult(_0x285c2f,null))[_0xaca6('0x42')](handleError(_0x285c2f,null));};exports['getAnyConditions']=function(_0x2e817b,_0x13682e,_0x1516a6){var _0x27b688={};var _0x895e67={};var _0x38eed6;var _0x7f5294;return db[_0xaca6('0x2a')]['findOne']({'where':{'id':_0x2e817b[_0xaca6('0x44')]['id']}})[_0xaca6('0x20')](handleEntityNotFound(_0x13682e,null))[_0xaca6('0x20')](function(_0x22e2ad){if(_0x22e2ad){_0x38eed6=_0x22e2ad;_0x895e67[_0xaca6('0x2d')]=_[_0xaca6('0x2f')](db[_0xaca6('0x4f')][_0xaca6('0x54')]);_0x895e67[_0xaca6('0x2e')]=_[_0xaca6('0x2f')](_0x2e817b[_0xaca6('0x2e')]);_0x895e67[_0xaca6('0x30')]=_[_0xaca6('0x31')](_0x895e67[_0xaca6('0x2d')],_0x895e67[_0xaca6('0x2e')]);_0x27b688[_0xaca6('0x33')]=_[_0xaca6('0x31')](_0x895e67['model'],qs[_0xaca6('0x32')](_0x2e817b[_0xaca6('0x2e')]['fields']));_0x27b688[_0xaca6('0x33')]=_0x27b688[_0xaca6('0x33')][_0xaca6('0x34')]?_0x27b688[_0xaca6('0x33')]:_0x895e67['model'];_0x27b688['order']=qs[_0xaca6('0x37')](_0x2e817b['query']['sort']);_0x27b688[_0xaca6('0x3a')]=qs['filters'](_[_0xaca6('0x38')](_0x2e817b[_0xaca6('0x2e')],_0x895e67[_0xaca6('0x30')]));if(_0x2e817b['query']['filter']){_0x27b688[_0xaca6('0x3a')]=_[_0xaca6('0x3d')](_0x27b688[_0xaca6('0x3a')],{'$or':_['map'](_0x27b688[_0xaca6('0x33')],function(_0x8963ba){var _0xa884dd={};_0xa884dd[_0x8963ba]={'$like':'%'+_0x2e817b[_0xaca6('0x2e')]['filter']+'%'};return _0xa884dd;})});}_0x27b688=_['merge']({},_0x27b688,_0x2e817b['options']);return _0x38eed6['getAnyConditions'](_0x27b688);}})[_0xaca6('0x20')](function(_0x57b5b8){if(_0x57b5b8){_0x7f5294=_0x57b5b8[_0xaca6('0x34')];if(!_0x2e817b['query'][_0xaca6('0x35')](_0xaca6('0x36'))){_0x27b688[_0xaca6('0x1b')]=qs['limit'](_0x2e817b['query'][_0xaca6('0x1b')]);_0x27b688[_0xaca6('0x1d')]=qs[_0xaca6('0x1d')](_0x2e817b['query'][_0xaca6('0x1d')]);}return _0x38eed6[_0xaca6('0x56')](_0x27b688);}})[_0xaca6('0x20')](function(_0x21f8e3){if(_0x21f8e3){return _0x21f8e3?{'count':_0x7f5294,'rows':_0x21f8e3}:null;}})[_0xaca6('0x20')](respondWithResult(_0x13682e,null))[_0xaca6('0x42')](handleError(_0x13682e,null));};exports[_0xaca6('0x57')]=function(_0x542270,_0x2f8400,_0x2078c5){if(_0x542270[_0xaca6('0x4d')]['id']){delete _0x542270[_0xaca6('0x4d')]['id'];}return db[_0xaca6('0x2a')][_0xaca6('0x46')]({'where':{'id':_0x542270[_0xaca6('0x44')]['id']}})[_0xaca6('0x20')](handleEntityNotFound(_0x2f8400,null))[_0xaca6('0x20')](function(_0x31b700){if(_0x31b700){_0x542270['body'][_0xaca6('0x58')]=_0x31b700['id'];return db[_0xaca6('0x59')][_0xaca6('0x47')](_0x542270[_0xaca6('0x4d')]);}})[_0xaca6('0x20')](respondWithResult(_0x2f8400,null))['catch'](handleError(_0x2f8400,null));};exports[_0xaca6('0x5a')]=function(_0x28275a,_0x113aca,_0x4c1e2e){var _0x4f0336={};var _0x3ce512={};var _0x1b8369;var _0x5438dc;return db[_0xaca6('0x2a')][_0xaca6('0x53')]({'where':{'id':_0x28275a['params']['id']}})['then'](handleEntityNotFound(_0x113aca,null))['then'](function(_0xfb574f){if(_0xfb574f){_0x1b8369=_0xfb574f;_0x3ce512[_0xaca6('0x2d')]=_[_0xaca6('0x2f')](db[_0xaca6('0x59')]['rawAttributes']);_0x3ce512[_0xaca6('0x2e')]=_[_0xaca6('0x2f')](_0x28275a[_0xaca6('0x2e')]);_0x3ce512[_0xaca6('0x30')]=_[_0xaca6('0x31')](_0x3ce512[_0xaca6('0x2d')],_0x3ce512[_0xaca6('0x2e')]);_0x4f0336['attributes']=_[_0xaca6('0x31')](_0x3ce512[_0xaca6('0x2d')],qs[_0xaca6('0x32')](_0x28275a[_0xaca6('0x2e')][_0xaca6('0x32')]));_0x4f0336['attributes']=_0x4f0336[_0xaca6('0x33')][_0xaca6('0x34')]?_0x4f0336[_0xaca6('0x33')]:_0x3ce512[_0xaca6('0x2d')];_0x4f0336[_0xaca6('0x55')]=qs['sort'](_0x28275a[_0xaca6('0x2e')]['sort']);_0x4f0336[_0xaca6('0x3a')]=qs[_0xaca6('0x30')](_['pick'](_0x28275a[_0xaca6('0x2e')],_0x3ce512[_0xaca6('0x30')]));if(_0x28275a[_0xaca6('0x2e')][_0xaca6('0x39')]){_0x4f0336[_0xaca6('0x3a')]=_[_0xaca6('0x3d')](_0x4f0336[_0xaca6('0x3a')],{'$or':_[_0xaca6('0x3b')](_0x4f0336['attributes'],function(_0x121911){var _0x4a8823={};_0x4a8823[_0x121911]={'$like':'%'+_0x28275a[_0xaca6('0x2e')][_0xaca6('0x39')]+'%'};return _0x4a8823;})});}_0x4f0336=_[_0xaca6('0x3d')]({},_0x4f0336,_0x28275a[_0xaca6('0x3e')]);return _0x1b8369[_0xaca6('0x5a')](_0x4f0336);}})[_0xaca6('0x20')](function(_0x4c6c63){if(_0x4c6c63){_0x5438dc=_0x4c6c63[_0xaca6('0x34')];if(!_0x28275a[_0xaca6('0x2e')]['hasOwnProperty']('nolimit')){_0x4f0336[_0xaca6('0x1b')]=qs[_0xaca6('0x1b')](_0x28275a['query']['limit']);_0x4f0336[_0xaca6('0x1d')]=qs[_0xaca6('0x1d')](_0x28275a[_0xaca6('0x2e')]['offset']);}return _0x1b8369[_0xaca6('0x5a')](_0x4f0336);}})[_0xaca6('0x20')](function(_0x233b55){if(_0x233b55){return _0x233b55?{'count':_0x5438dc,'rows':_0x233b55}:null;}})[_0xaca6('0x20')](respondWithResult(_0x113aca,null))[_0xaca6('0x42')](handleError(_0x113aca,null));}; \ No newline at end of file +var _0xd38e=['create','body','user','get','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','findOne','getAllConditions','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','destroy','then','UserProfileResource','name','send','index','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','findAll','rows','catch','include','merge','find'];(function(_0x35462f,_0x2ad8aa){var _0x3775c2=function(_0xedfd3){while(--_0xedfd3){_0x35462f['push'](_0x35462f['shift']());}};_0x3775c2(++_0x2ad8aa);}(_0xd38e,0xcd));var _0xed38=function(_0x228cb8,_0x44b316){_0x228cb8=_0x228cb8-0x0;var _0x339157=_0xd38e[_0x228cb8];return _0x339157;};'use strict';var emlformat=require(_0xed38('0x0'));var rimraf=require(_0xed38('0x1'));var zipdir=require(_0xed38('0x2'));var jsonpatch=require(_0xed38('0x3'));var rp=require(_0xed38('0x4'));var moment=require(_0xed38('0x5'));var BPromise=require(_0xed38('0x6'));var Mustache=require(_0xed38('0x7'));var util=require('util');var path=require(_0xed38('0x8'));var sox=require(_0xed38('0x9'));var csv=require(_0xed38('0xa'));var ejs=require(_0xed38('0xb'));var fs=require('fs');var fs_extra=require(_0xed38('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xed38('0xd'));var jsforce=require(_0xed38('0xe'));var deskjs=require(_0xed38('0xf'));var toCsv=require(_0xed38('0xa'));var querystring=require(_0xed38('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xed38('0x11'));var qs=require(_0xed38('0x12'));var as=require(_0xed38('0x13'));var hardwareService=require(_0xed38('0x14'));var logger=require(_0xed38('0x15'))('api');var utils=require(_0xed38('0x16'));var config=require(_0xed38('0x17'));var licenseUtil=require(_0xed38('0x18'));var db=require(_0xed38('0x19'))['db'];function respondWithStatusCode(_0x1394a4,_0x4d8b20){_0x4d8b20=_0x4d8b20||0xcc;return function(_0x729417){if(_0x729417){return _0x1394a4[_0xed38('0x1a')](_0x4d8b20);}return _0x1394a4[_0xed38('0x1b')](_0x4d8b20)[_0xed38('0x1c')]();};}function respondWithResult(_0x3da285,_0x5107d0){_0x5107d0=_0x5107d0||0xc8;return function(_0x41d286){if(_0x41d286){return _0x3da285[_0xed38('0x1b')](_0x5107d0)[_0xed38('0x1d')](_0x41d286);}};}function respondWithFilteredResult(_0x4dc1db,_0x29a1e0){return function(_0x2beb60){if(_0x2beb60){var _0x56b5bb=typeof _0x29a1e0['offset']===_0xed38('0x1e')&&typeof _0x29a1e0[_0xed38('0x1f')]===_0xed38('0x1e');var _0x27868d=_0x2beb60[_0xed38('0x20')];var _0xadf4b2=_0x56b5bb?0x0:_0x29a1e0[_0xed38('0x21')];var _0x4f6416=_0x56b5bb?_0x2beb60[_0xed38('0x20')]:_0x29a1e0['offset']+_0x29a1e0[_0xed38('0x1f')];var _0x40e90d;if(_0x4f6416>=_0x27868d){_0x4f6416=_0x27868d;_0x40e90d=0xc8;}else{_0x40e90d=0xce;}_0x4dc1db[_0xed38('0x1b')](_0x40e90d);return _0x4dc1db['set'](_0xed38('0x22'),_0xadf4b2+'-'+_0x4f6416+'/'+_0x27868d)[_0xed38('0x1d')](_0x2beb60);}return null;};}function patchUpdates(_0x392ddb){return function(_0xbf53a9){try{jsonpatch[_0xed38('0x23')](_0xbf53a9,_0x392ddb,!![]);}catch(_0x687eb1){return BPromise['reject'](_0x687eb1);}return _0xbf53a9[_0xed38('0x24')]();};}function saveUpdates(_0x2e4ef8,_0x1e5a7e){return function(_0x4ac84d){if(_0x4ac84d){return _0x4ac84d['update'](_0x2e4ef8)['then'](function(_0xe097fa){return _0xe097fa;});}return null;};}function removeEntity(_0x4b1f94,_0x498d26){return function(_0x5bd5e4){if(_0x5bd5e4){return _0x5bd5e4[_0xed38('0x25')]()[_0xed38('0x26')](function(){var _0x287519=_0x5bd5e4['get']({'plain':!![]});var _0x687dfb='Triggers';return db[_0xed38('0x27')][_0xed38('0x25')]({'where':{'type':_0x687dfb,'resourceId':_0x287519['id']}})[_0xed38('0x26')](function(){return _0x5bd5e4;});})[_0xed38('0x26')](function(){_0x4b1f94[_0xed38('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e74a5,_0x45de91){return function(_0x49b8a9){if(!_0x49b8a9){_0x3e74a5['sendStatus'](0x194);}return _0x49b8a9;};}function handleError(_0x12af54,_0x3fdbbf){_0x3fdbbf=_0x3fdbbf||0x1f4;return function(_0x5c14d4){logger['error'](_0x5c14d4['stack']);if(_0x5c14d4['name']){delete _0x5c14d4[_0xed38('0x28')];}_0x12af54[_0xed38('0x1b')](_0x3fdbbf)[_0xed38('0x29')](_0x5c14d4);};}exports[_0xed38('0x2a')]=function(_0x24b52c,_0x21d9b5){var _0x48d4c5={},_0x114a35={},_0x15c944={'count':0x0,'rows':[]};var _0x304825=_[_0xed38('0x2b')](db[_0xed38('0x2c')][_0xed38('0x2d')],function(_0x59a27f){return{'name':_0x59a27f[_0xed38('0x2e')],'type':_0x59a27f[_0xed38('0x2f')]['key']};});_0x114a35[_0xed38('0x30')]=_['map'](_0x304825,_0xed38('0x28'));_0x114a35[_0xed38('0x31')]=_[_0xed38('0x32')](_0x24b52c['query']);_0x114a35[_0xed38('0x33')]=_[_0xed38('0x34')](_0x114a35['model'],_0x114a35['query']);_0x48d4c5['attributes']=_[_0xed38('0x34')](_0x114a35['model'],qs[_0xed38('0x35')](_0x24b52c['query'][_0xed38('0x35')]));_0x48d4c5[_0xed38('0x36')]=_0x48d4c5[_0xed38('0x36')][_0xed38('0x37')]?_0x48d4c5[_0xed38('0x36')]:_0x114a35[_0xed38('0x30')];if(!_0x24b52c['query'][_0xed38('0x38')](_0xed38('0x39'))){_0x48d4c5[_0xed38('0x1f')]=qs[_0xed38('0x1f')](_0x24b52c['query'][_0xed38('0x1f')]);_0x48d4c5[_0xed38('0x21')]=qs[_0xed38('0x21')](_0x24b52c[_0xed38('0x31')]['offset']);}_0x48d4c5[_0xed38('0x3a')]=qs[_0xed38('0x3b')](_0x24b52c[_0xed38('0x31')]['sort']);_0x48d4c5[_0xed38('0x3c')]=qs[_0xed38('0x33')](_[_0xed38('0x3d')](_0x24b52c[_0xed38('0x31')],_0x114a35[_0xed38('0x33')]),_0x304825);if(_0x24b52c[_0xed38('0x31')][_0xed38('0x3e')]){_0x48d4c5[_0xed38('0x3c')]=_['merge'](_0x48d4c5[_0xed38('0x3c')],{'$or':_[_0xed38('0x2b')](_0x304825,function(_0x18eb97){if(_0x18eb97[_0xed38('0x2f')]!=='VIRTUAL'){var _0x2de139={};_0x2de139[_0x18eb97[_0xed38('0x28')]]={'$like':'%'+_0x24b52c[_0xed38('0x31')]['filter']+'%'};return _0x2de139;}})});}_0x48d4c5=_['merge']({},_0x48d4c5,_0x24b52c[_0xed38('0x3f')]);var _0x56ed28={'where':_0x48d4c5['where']};return db['Trigger'][_0xed38('0x20')](_0x56ed28)[_0xed38('0x26')](function(_0x27966b){_0x15c944[_0xed38('0x20')]=_0x27966b;if(_0x24b52c[_0xed38('0x31')][_0xed38('0x40')]){_0x48d4c5['include']=[{'all':!![]}];}return db['Trigger'][_0xed38('0x41')](_0x48d4c5);})['then'](function(_0x1a4241){_0x15c944[_0xed38('0x42')]=_0x1a4241;return _0x15c944;})[_0xed38('0x26')](respondWithFilteredResult(_0x21d9b5,_0x48d4c5))[_0xed38('0x43')](handleError(_0x21d9b5,null));};exports['show']=function(_0x38dd8c,_0x6bd201){var _0xb1e630={'raw':![],'where':{'id':_0x38dd8c['params']['id']}},_0x281ab1={};_0x281ab1[_0xed38('0x30')]=_[_0xed38('0x32')](db[_0xed38('0x2c')][_0xed38('0x2d')]);_0x281ab1[_0xed38('0x31')]=_[_0xed38('0x32')](_0x38dd8c[_0xed38('0x31')]);_0x281ab1['filters']=_['intersection'](_0x281ab1[_0xed38('0x30')],_0x281ab1[_0xed38('0x31')]);_0xb1e630[_0xed38('0x36')]=_['intersection'](_0x281ab1[_0xed38('0x30')],qs[_0xed38('0x35')](_0x38dd8c[_0xed38('0x31')][_0xed38('0x35')]));_0xb1e630[_0xed38('0x36')]=_0xb1e630['attributes']['length']?_0xb1e630['attributes']:_0x281ab1[_0xed38('0x30')];if(_0x38dd8c[_0xed38('0x31')][_0xed38('0x40')]){_0xb1e630[_0xed38('0x44')]=[{'all':!![]}];}_0xb1e630=_[_0xed38('0x45')]({},_0xb1e630,_0x38dd8c['options']);return db['Trigger'][_0xed38('0x46')](_0xb1e630)[_0xed38('0x26')](handleEntityNotFound(_0x6bd201,null))[_0xed38('0x26')](respondWithResult(_0x6bd201,null))[_0xed38('0x43')](handleError(_0x6bd201,null));};exports['create']=function(_0x4e2bc5,_0x192b22){return db[_0xed38('0x2c')][_0xed38('0x47')](_0x4e2bc5[_0xed38('0x48')],{})[_0xed38('0x26')](function(_0x108cd3){var _0x230c6c=_0x4e2bc5[_0xed38('0x49')][_0xed38('0x4a')]({'plain':!![]});if(!_0x230c6c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x230c6c[_0xed38('0x4b')]==='user'){var _0x176c32=_0x108cd3[_0xed38('0x4a')]({'plain':!![]});var _0x4f5e6a='Triggers';return db['UserProfileSection']['find']({'where':{'name':_0x4f5e6a,'userProfileId':_0x230c6c[_0xed38('0x4c')]},'raw':!![]})['then'](function(_0x11475b){if(_0x11475b&&_0x11475b['autoAssociation']===0x0){return db[_0xed38('0x27')][_0xed38('0x47')]({'name':_0x176c32[_0xed38('0x28')],'resourceId':_0x176c32['id'],'type':_0x11475b[_0xed38('0x28')],'sectionId':_0x11475b['id']},{})['then'](function(){return _0x108cd3;});}else{return _0x108cd3;}})[_0xed38('0x43')](function(_0x7b4083){logger[_0xed38('0x4d')](_0xed38('0x4e'),_0x7b4083);throw _0x7b4083;});}return _0x108cd3;})['then'](respondWithResult(_0x192b22,0xc9))[_0xed38('0x43')](handleError(_0x192b22,null));};exports[_0xed38('0x4f')]=function(_0xb94131,_0xf83dff){if(_0xb94131['body']['id']){delete _0xb94131[_0xed38('0x48')]['id'];}return db[_0xed38('0x2c')][_0xed38('0x46')]({'where':{'id':_0xb94131[_0xed38('0x50')]['id']}})['then'](handleEntityNotFound(_0xf83dff,null))[_0xed38('0x26')](saveUpdates(_0xb94131['body'],null))[_0xed38('0x26')](respondWithResult(_0xf83dff,null))[_0xed38('0x43')](handleError(_0xf83dff,null));};exports[_0xed38('0x25')]=function(_0x56ecdc,_0x4475a7){return db[_0xed38('0x2c')][_0xed38('0x46')]({'where':{'id':_0x56ecdc['params']['id']}})[_0xed38('0x26')](handleEntityNotFound(_0x4475a7,null))[_0xed38('0x26')](removeEntity(_0x4475a7,null))[_0xed38('0x43')](handleError(_0x4475a7,null));};exports[_0xed38('0x51')]=function(_0x58152e,_0x3711fa,_0x174d12){if(_0x58152e[_0xed38('0x48')]['id']){delete _0x58152e[_0xed38('0x48')]['id'];}return db[_0xed38('0x2c')][_0xed38('0x46')]({'where':{'id':_0x58152e[_0xed38('0x50')]['id']}})[_0xed38('0x26')](handleEntityNotFound(_0x3711fa,null))[_0xed38('0x26')](function(_0x49c220){if(_0x49c220){_0x58152e[_0xed38('0x48')][_0xed38('0x52')]=_0x49c220['id'];return db[_0xed38('0x53')][_0xed38('0x47')](_0x58152e[_0xed38('0x48')]);}})[_0xed38('0x26')](respondWithResult(_0x3711fa,null))[_0xed38('0x43')](handleError(_0x3711fa,null));};exports[_0xed38('0x54')]=function(_0x38a6fb,_0x365862,_0x37bfd7){if(_0x38a6fb[_0xed38('0x48')]['id']){delete _0x38a6fb[_0xed38('0x48')]['id'];}return db[_0xed38('0x2c')][_0xed38('0x46')]({'where':{'id':_0x38a6fb['params']['id']}})[_0xed38('0x26')](handleEntityNotFound(_0x365862,null))[_0xed38('0x26')](function(_0x2eb406){if(_0x2eb406){_0x38a6fb[_0xed38('0x48')][_0xed38('0x55')]=_0x2eb406['id'];return db[_0xed38('0x53')][_0xed38('0x47')](_0x38a6fb[_0xed38('0x48')]);}})[_0xed38('0x26')](respondWithResult(_0x365862,null))[_0xed38('0x43')](handleError(_0x365862,null));};exports['getAllConditions']=function(_0x4b678f,_0x55494c,_0x74cf75){var _0x144679={};var _0x239877={};var _0x20e540;var _0xe2745b;return db[_0xed38('0x2c')][_0xed38('0x56')]({'where':{'id':_0x4b678f['params']['id']}})['then'](handleEntityNotFound(_0x55494c,null))[_0xed38('0x26')](function(_0x50ea4a){if(_0x50ea4a){_0x20e540=_0x50ea4a;_0x239877[_0xed38('0x30')]=_['keys'](db['Condition']['rawAttributes']);_0x239877['query']=_['keys'](_0x4b678f[_0xed38('0x31')]);_0x239877[_0xed38('0x33')]=_['intersection'](_0x239877[_0xed38('0x30')],_0x239877['query']);_0x144679['attributes']=_[_0xed38('0x34')](_0x239877[_0xed38('0x30')],qs[_0xed38('0x35')](_0x4b678f[_0xed38('0x31')][_0xed38('0x35')]));_0x144679['attributes']=_0x144679[_0xed38('0x36')]['length']?_0x144679[_0xed38('0x36')]:_0x239877[_0xed38('0x30')];_0x144679[_0xed38('0x3a')]=qs['sort'](_0x4b678f[_0xed38('0x31')][_0xed38('0x3b')]);_0x144679[_0xed38('0x3c')]=qs['filters'](_[_0xed38('0x3d')](_0x4b678f['query'],_0x239877[_0xed38('0x33')]));if(_0x4b678f[_0xed38('0x31')][_0xed38('0x3e')]){_0x144679[_0xed38('0x3c')]=_['merge'](_0x144679[_0xed38('0x3c')],{'$or':_[_0xed38('0x2b')](_0x144679['attributes'],function(_0x513753){var _0xaf50f1={};_0xaf50f1[_0x513753]={'$like':'%'+_0x4b678f[_0xed38('0x31')][_0xed38('0x3e')]+'%'};return _0xaf50f1;})});}_0x144679=_[_0xed38('0x45')]({},_0x144679,_0x4b678f[_0xed38('0x3f')]);return _0x20e540['getAllConditions'](_0x144679);}})[_0xed38('0x26')](function(_0x37e1bd){if(_0x37e1bd){_0xe2745b=_0x37e1bd[_0xed38('0x37')];if(!_0x4b678f['query'][_0xed38('0x38')]('nolimit')){_0x144679[_0xed38('0x1f')]=qs[_0xed38('0x1f')](_0x4b678f[_0xed38('0x31')][_0xed38('0x1f')]);_0x144679[_0xed38('0x21')]=qs[_0xed38('0x21')](_0x4b678f[_0xed38('0x31')][_0xed38('0x21')]);}return _0x20e540[_0xed38('0x57')](_0x144679);}})[_0xed38('0x26')](function(_0x297b69){if(_0x297b69){return _0x297b69?{'count':_0xe2745b,'rows':_0x297b69}:null;}})[_0xed38('0x26')](respondWithResult(_0x55494c,null))[_0xed38('0x43')](handleError(_0x55494c,null));};exports[_0xed38('0x58')]=function(_0x57b120,_0x223b43,_0x38f985){var _0x4a3937={};var _0x21a7d3={};var _0x239731;var _0x5b8e5c;return db[_0xed38('0x2c')]['findOne']({'where':{'id':_0x57b120[_0xed38('0x50')]['id']}})[_0xed38('0x26')](handleEntityNotFound(_0x223b43,null))[_0xed38('0x26')](function(_0x32d8f9){if(_0x32d8f9){_0x239731=_0x32d8f9;_0x21a7d3['model']=_['keys'](db[_0xed38('0x53')][_0xed38('0x2d')]);_0x21a7d3['query']=_[_0xed38('0x32')](_0x57b120[_0xed38('0x31')]);_0x21a7d3[_0xed38('0x33')]=_['intersection'](_0x21a7d3[_0xed38('0x30')],_0x21a7d3[_0xed38('0x31')]);_0x4a3937['attributes']=_['intersection'](_0x21a7d3['model'],qs[_0xed38('0x35')](_0x57b120[_0xed38('0x31')][_0xed38('0x35')]));_0x4a3937[_0xed38('0x36')]=_0x4a3937[_0xed38('0x36')]['length']?_0x4a3937[_0xed38('0x36')]:_0x21a7d3[_0xed38('0x30')];_0x4a3937[_0xed38('0x3a')]=qs[_0xed38('0x3b')](_0x57b120[_0xed38('0x31')][_0xed38('0x3b')]);_0x4a3937[_0xed38('0x3c')]=qs[_0xed38('0x33')](_['pick'](_0x57b120[_0xed38('0x31')],_0x21a7d3[_0xed38('0x33')]));if(_0x57b120[_0xed38('0x31')][_0xed38('0x3e')]){_0x4a3937[_0xed38('0x3c')]=_['merge'](_0x4a3937['where'],{'$or':_['map'](_0x4a3937['attributes'],function(_0x579cae){var _0x4d16d6={};_0x4d16d6[_0x579cae]={'$like':'%'+_0x57b120[_0xed38('0x31')]['filter']+'%'};return _0x4d16d6;})});}_0x4a3937=_[_0xed38('0x45')]({},_0x4a3937,_0x57b120[_0xed38('0x3f')]);return _0x239731[_0xed38('0x58')](_0x4a3937);}})[_0xed38('0x26')](function(_0x38b949){if(_0x38b949){_0x5b8e5c=_0x38b949[_0xed38('0x37')];if(!_0x57b120[_0xed38('0x31')][_0xed38('0x38')](_0xed38('0x39'))){_0x4a3937[_0xed38('0x1f')]=qs[_0xed38('0x1f')](_0x57b120[_0xed38('0x31')][_0xed38('0x1f')]);_0x4a3937[_0xed38('0x21')]=qs[_0xed38('0x21')](_0x57b120[_0xed38('0x31')][_0xed38('0x21')]);}return _0x239731[_0xed38('0x58')](_0x4a3937);}})[_0xed38('0x26')](function(_0xc5a696){if(_0xc5a696){return _0xc5a696?{'count':_0x5b8e5c,'rows':_0xc5a696}:null;}})['then'](respondWithResult(_0x223b43,null))[_0xed38('0x43')](handleError(_0x223b43,null));};exports[_0xed38('0x59')]=function(_0x286d9a,_0x28d7d0,_0x22c7cc){if(_0x286d9a['body']['id']){delete _0x286d9a[_0xed38('0x48')]['id'];}return db['Trigger']['find']({'where':{'id':_0x286d9a[_0xed38('0x50')]['id']}})[_0xed38('0x26')](handleEntityNotFound(_0x28d7d0,null))[_0xed38('0x26')](function(_0x609c4a){if(_0x609c4a){_0x286d9a[_0xed38('0x48')]['TriggerId']=_0x609c4a['id'];return db[_0xed38('0x5a')][_0xed38('0x47')](_0x286d9a[_0xed38('0x48')]);}})['then'](respondWithResult(_0x28d7d0,null))[_0xed38('0x43')](handleError(_0x28d7d0,null));};exports[_0xed38('0x5b')]=function(_0x39a832,_0x2201bc,_0x2fc935){var _0x4fbc39={};var _0x4dc9f0={};var _0x4f71e4;var _0x34fdda;return db[_0xed38('0x2c')][_0xed38('0x56')]({'where':{'id':_0x39a832[_0xed38('0x50')]['id']}})[_0xed38('0x26')](handleEntityNotFound(_0x2201bc,null))['then'](function(_0x4ee9fd){if(_0x4ee9fd){_0x4f71e4=_0x4ee9fd;_0x4dc9f0[_0xed38('0x30')]=_[_0xed38('0x32')](db[_0xed38('0x5a')][_0xed38('0x2d')]);_0x4dc9f0[_0xed38('0x31')]=_[_0xed38('0x32')](_0x39a832[_0xed38('0x31')]);_0x4dc9f0[_0xed38('0x33')]=_['intersection'](_0x4dc9f0[_0xed38('0x30')],_0x4dc9f0[_0xed38('0x31')]);_0x4fbc39[_0xed38('0x36')]=_['intersection'](_0x4dc9f0[_0xed38('0x30')],qs[_0xed38('0x35')](_0x39a832[_0xed38('0x31')][_0xed38('0x35')]));_0x4fbc39[_0xed38('0x36')]=_0x4fbc39[_0xed38('0x36')][_0xed38('0x37')]?_0x4fbc39['attributes']:_0x4dc9f0[_0xed38('0x30')];_0x4fbc39['order']=qs[_0xed38('0x3b')](_0x39a832[_0xed38('0x31')][_0xed38('0x3b')]);_0x4fbc39[_0xed38('0x3c')]=qs[_0xed38('0x33')](_[_0xed38('0x3d')](_0x39a832['query'],_0x4dc9f0['filters']));if(_0x39a832['query']['filter']){_0x4fbc39['where']=_[_0xed38('0x45')](_0x4fbc39[_0xed38('0x3c')],{'$or':_['map'](_0x4fbc39['attributes'],function(_0x2ae6d7){var _0x6d78da={};_0x6d78da[_0x2ae6d7]={'$like':'%'+_0x39a832[_0xed38('0x31')][_0xed38('0x3e')]+'%'};return _0x6d78da;})});}_0x4fbc39=_[_0xed38('0x45')]({},_0x4fbc39,_0x39a832['options']);return _0x4f71e4[_0xed38('0x5b')](_0x4fbc39);}})[_0xed38('0x26')](function(_0x554e12){if(_0x554e12){_0x34fdda=_0x554e12[_0xed38('0x37')];if(!_0x39a832[_0xed38('0x31')][_0xed38('0x38')]('nolimit')){_0x4fbc39[_0xed38('0x1f')]=qs[_0xed38('0x1f')](_0x39a832['query'][_0xed38('0x1f')]);_0x4fbc39['offset']=qs[_0xed38('0x21')](_0x39a832[_0xed38('0x31')][_0xed38('0x21')]);}return _0x4f71e4[_0xed38('0x5b')](_0x4fbc39);}})[_0xed38('0x26')](function(_0x3509cd){if(_0x3509cd){return _0x3509cd?{'count':_0x34fdda,'rows':_0x3509cd}:null;}})[_0xed38('0x26')](respondWithResult(_0x2201bc,null))[_0xed38('0x43')](handleError(_0x2201bc,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 15a6b6d..f485cc7 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 _0x3e25=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash'];(function(_0xf61586,_0x56b0c4){var _0x2b6eb3=function(_0x47e12b){while(--_0x47e12b){_0xf61586['push'](_0xf61586['shift']());}};_0x2b6eb3(++_0x56b0c4);}(_0x3e25,0x14f));var _0x53e2=function(_0x229955,_0x4b6eb6){_0x229955=_0x229955-0x0;var _0x194a20=_0x3e25[_0x229955];return _0x194a20;};'use strict';var _=require(_0x53e2('0x0'));var util=require(_0x53e2('0x1'));var logger=require(_0x53e2('0x2'))('api');var moment=require(_0x53e2('0x3'));var BPromise=require('bluebird');var rp=require(_0x53e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53e2('0x5'));var config=require(_0x53e2('0x6'));var attributes=require(_0x53e2('0x7'));module[_0x53e2('0x8')]=function(_0x11ad7a,_0x14b22c){return _0x11ad7a[_0x53e2('0x9')](_0x53e2('0xa'),attributes,{'tableName':_0x53e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7e9=['lodash','util','api','moment','bluebird','path','rimraf','exports','define','Trigger','tools_triggers'];(function(_0x5e6f73,_0x3f27d8){var _0x432614=function(_0x56e42d){while(--_0x56e42d){_0x5e6f73['push'](_0x5e6f73['shift']());}};_0x432614(++_0x3f27d8);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7e9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9c7e('0x0'));var util=require(_0x9c7e('0x1'));var logger=require('../../config/logger')(_0x9c7e('0x2'));var moment=require(_0x9c7e('0x3'));var BPromise=require(_0x9c7e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9c7e('0x5'));var rimraf=require(_0x9c7e('0x6'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x9c7e('0x7')]=function(_0x4e4ccc,_0x1e5135){return _0x4e4ccc[_0x9c7e('0x8')](_0x9c7e('0x9'),attributes,{'tableName':_0x9c7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 09e6c4d..1b6a9f3 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 _0xa1e2=['request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowTrigger','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','Trigger,\x20%s,\x20%s'];(function(_0x1f5c3a,_0x216b5c){var _0x33538f=function(_0x36bcae){while(--_0x36bcae){_0x1f5c3a['push'](_0x1f5c3a['shift']());}};_0x33538f(++_0x216b5c);}(_0xa1e2,0x1cf));var _0x2a1e=function(_0x264a7d,_0x250f28){_0x264a7d=_0x264a7d-0x0;var _0x598394=_0xa1e2[_0x264a7d];return _0x598394;};'use strict';var _=require('lodash');var util=require(_0x2a1e('0x0'));var moment=require(_0x2a1e('0x1'));var BPromise=require(_0x2a1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a1e('0x3'));var db=require(_0x2a1e('0x4'))['db'];var utils=require(_0x2a1e('0x5'));var logger=require('../../config/logger')(_0x2a1e('0x6'));var config=require(_0x2a1e('0x7'));var jayson=require(_0x2a1e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x598a4a,_0x59e716,_0x5c8ed8){return new BPromise(function(_0x2839c7,_0x14c30a){return client[_0x2a1e('0x9')](_0x598a4a,_0x5c8ed8)[_0x2a1e('0xa')](function(_0x38d114){logger[_0x2a1e('0xb')](_0x2a1e('0xc'),_0x59e716,_0x2a1e('0xd'));logger['debug'](_0x2a1e('0xe'),_0x59e716,_0x2a1e('0xd'),JSON[_0x2a1e('0xf')](_0x38d114));if(_0x38d114[_0x2a1e('0x10')]){if(_0x38d114['error']['code']===0x1f4){logger[_0x2a1e('0x10')](_0x2a1e('0xc'),_0x59e716,_0x38d114[_0x2a1e('0x10')][_0x2a1e('0x11')]);return _0x14c30a(_0x38d114[_0x2a1e('0x10')][_0x2a1e('0x11')]);}logger[_0x2a1e('0x10')](_0x2a1e('0xc'),_0x59e716,_0x38d114['error'][_0x2a1e('0x11')]);return _0x2839c7(_0x38d114['error'][_0x2a1e('0x11')]);}else{logger[_0x2a1e('0xb')](_0x2a1e('0xc'),_0x59e716,_0x2a1e('0xd'));_0x2839c7(_0x38d114[_0x2a1e('0x12')][_0x2a1e('0x11')]);}})[_0x2a1e('0x13')](function(_0x2f09ab){logger['error'](_0x2a1e('0xc'),_0x59e716,_0x2f09ab);_0x14c30a(_0x2f09ab);});});}exports[_0x2a1e('0x14')]=function(_0x292c7f){var _0x560518=this;return new Promise(function(_0x59b866,_0x588c50){return db[_0x2a1e('0x15')][_0x2a1e('0x16')]({'raw':_0x292c7f[_0x2a1e('0x17')]?_0x292c7f[_0x2a1e('0x17')][_0x2a1e('0x18')]===undefined?!![]:![]:!![],'where':_0x292c7f[_0x2a1e('0x17')]?_0x292c7f['options'][_0x2a1e('0x19')]||null:null,'attributes':_0x292c7f[_0x2a1e('0x17')]?_0x292c7f[_0x2a1e('0x17')][_0x2a1e('0x1a')]||null:null,'limit':_0x292c7f[_0x2a1e('0x17')]?_0x292c7f[_0x2a1e('0x17')][_0x2a1e('0x1b')]||null:null,'include':_0x292c7f[_0x2a1e('0x17')]?_0x292c7f[_0x2a1e('0x17')][_0x2a1e('0x1c')]?_[_0x2a1e('0x1d')](_0x292c7f['options'][_0x2a1e('0x1c')],function(_0x14a571){return{'model':db[_0x14a571[_0x2a1e('0x1e')]],'as':_0x14a571['as'],'attributes':_0x14a571[_0x2a1e('0x1a')],'include':_0x14a571[_0x2a1e('0x1c')]?_[_0x2a1e('0x1d')](_0x14a571[_0x2a1e('0x1c')],function(_0x590fda){return{'model':db[_0x590fda[_0x2a1e('0x1e')]],'as':_0x590fda['as'],'attributes':_0x590fda[_0x2a1e('0x1a')],'include':_0x590fda['include']?_['map'](_0x590fda[_0x2a1e('0x1c')],function(_0x553df9){return{'model':db[_0x553df9[_0x2a1e('0x1e')]],'as':_0x553df9['as'],'attributes':_0x553df9[_0x2a1e('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2a1e('0xa')](function(_0x593525){logger[_0x2a1e('0xb')]('GetTrigger',_0x292c7f);logger[_0x2a1e('0x1f')]('GetTrigger',_0x292c7f,JSON[_0x2a1e('0xf')](_0x593525));_0x59b866(_0x593525);})[_0x2a1e('0x13')](function(_0x4f5fa4){logger[_0x2a1e('0x10')](_0x2a1e('0x14'),_0x4f5fa4[_0x2a1e('0x11')],_0x292c7f);_0x588c50(_0x560518[_0x2a1e('0x10')](0x1f4,_0x4f5fa4[_0x2a1e('0x11')]));});});};exports[_0x2a1e('0x20')]=function(_0x1b7f8e){var _0x343185=this;return new Promise(function(_0x320342,_0x2d596c){return db[_0x2a1e('0x15')][_0x2a1e('0x21')]({'raw':_0x1b7f8e[_0x2a1e('0x17')]?_0x1b7f8e[_0x2a1e('0x17')][_0x2a1e('0x18')]===undefined?!![]:![]:!![],'where':_0x1b7f8e[_0x2a1e('0x17')]?_0x1b7f8e[_0x2a1e('0x17')]['where']||null:null,'attributes':_0x1b7f8e['options']?_0x1b7f8e[_0x2a1e('0x17')][_0x2a1e('0x1a')]||null:null,'include':_0x1b7f8e['options']?_0x1b7f8e['options']['include']?_['map'](_0x1b7f8e[_0x2a1e('0x17')][_0x2a1e('0x1c')],function(_0x2d654d){return{'model':db[_0x2d654d[_0x2a1e('0x1e')]],'as':_0x2d654d['as'],'attributes':_0x2d654d['attributes'],'include':_0x2d654d[_0x2a1e('0x1c')]?_['map'](_0x2d654d[_0x2a1e('0x1c')],function(_0x5cb43a){return{'model':db[_0x5cb43a[_0x2a1e('0x1e')]],'as':_0x5cb43a['as'],'attributes':_0x5cb43a[_0x2a1e('0x1a')],'include':_0x5cb43a[_0x2a1e('0x1c')]?_[_0x2a1e('0x1d')](_0x5cb43a[_0x2a1e('0x1c')],function(_0x14a532){return{'model':db[_0x14a532[_0x2a1e('0x1e')]],'as':_0x14a532['as'],'attributes':_0x14a532['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x467f12){logger['info']('ShowTrigger',_0x1b7f8e);logger[_0x2a1e('0x1f')](_0x2a1e('0x20'),_0x1b7f8e,JSON[_0x2a1e('0xf')](_0x467f12));_0x320342(_0x467f12);})['catch'](function(_0x5f02b6){logger[_0x2a1e('0x10')](_0x2a1e('0x20'),_0x5f02b6['message'],_0x1b7f8e);_0x2d596c(_0x343185[_0x2a1e('0x10')](0x1f4,_0x5f02b6[_0x2a1e('0x11')]));});});}; \ No newline at end of file +var _0xef0f=['raw','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','Trigger','findAll','options','where','attributes','limit','include','map','model','GetTrigger','debug','ShowTrigger','find'];(function(_0x56844b,_0x4f0a52){var _0x567d29=function(_0x486d7d){while(--_0x486d7d){_0x56844b['push'](_0x56844b['shift']());}};_0x567d29(++_0x4f0a52);}(_0xef0f,0x85));var _0xfef0=function(_0x1743d0,_0xae0649){_0x1743d0=_0x1743d0-0x0;var _0x58da54=_0xef0f[_0x1743d0];return _0x58da54;};'use strict';var _=require(_0xfef0('0x0'));var util=require(_0xfef0('0x1'));var moment=require(_0xfef0('0x2'));var BPromise=require('bluebird');var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfef0('0x4'))(_0xfef0('0x5'));var config=require(_0xfef0('0x6'));var jayson=require(_0xfef0('0x7'));var client=jayson[_0xfef0('0x8')][_0xfef0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x15fd57,_0x3b965b,_0x308921){return new BPromise(function(_0x12a942,_0x3f3ace){return client['request'](_0x15fd57,_0x308921)[_0xfef0('0xa')](function(_0x2de19c){logger[_0xfef0('0xb')](_0xfef0('0xc'),_0x3b965b,_0xfef0('0xd'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x3b965b,_0xfef0('0xd'),JSON[_0xfef0('0xe')](_0x2de19c));if(_0x2de19c[_0xfef0('0xf')]){if(_0x2de19c[_0xfef0('0xf')]['code']===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x3b965b,_0x2de19c[_0xfef0('0xf')][_0xfef0('0x10')]);return _0x3f3ace(_0x2de19c[_0xfef0('0xf')][_0xfef0('0x10')]);}logger[_0xfef0('0xf')]('Trigger,\x20%s,\x20%s',_0x3b965b,_0x2de19c[_0xfef0('0xf')][_0xfef0('0x10')]);return _0x12a942(_0x2de19c['error'][_0xfef0('0x10')]);}else{logger['info'](_0xfef0('0xc'),_0x3b965b,_0xfef0('0xd'));_0x12a942(_0x2de19c[_0xfef0('0x11')][_0xfef0('0x10')]);}})[_0xfef0('0x12')](function(_0x2a9521){logger[_0xfef0('0xf')](_0xfef0('0xc'),_0x3b965b,_0x2a9521);_0x3f3ace(_0x2a9521);});});}exports['GetTrigger']=function(_0x3ebed2){var _0x564a64=this;return new Promise(function(_0x35e21d,_0x586774){return db[_0xfef0('0x13')][_0xfef0('0x14')]({'raw':_0x3ebed2[_0xfef0('0x15')]?_0x3ebed2[_0xfef0('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3ebed2['options']?_0x3ebed2[_0xfef0('0x15')][_0xfef0('0x16')]||null:null,'attributes':_0x3ebed2[_0xfef0('0x15')]?_0x3ebed2[_0xfef0('0x15')][_0xfef0('0x17')]||null:null,'limit':_0x3ebed2['options']?_0x3ebed2['options'][_0xfef0('0x18')]||null:null,'include':_0x3ebed2[_0xfef0('0x15')]?_0x3ebed2[_0xfef0('0x15')][_0xfef0('0x19')]?_[_0xfef0('0x1a')](_0x3ebed2[_0xfef0('0x15')][_0xfef0('0x19')],function(_0x508f79){return{'model':db[_0x508f79['model']],'as':_0x508f79['as'],'attributes':_0x508f79[_0xfef0('0x17')],'include':_0x508f79[_0xfef0('0x19')]?_[_0xfef0('0x1a')](_0x508f79[_0xfef0('0x19')],function(_0x41e0a9){return{'model':db[_0x41e0a9[_0xfef0('0x1b')]],'as':_0x41e0a9['as'],'attributes':_0x41e0a9[_0xfef0('0x17')],'include':_0x41e0a9[_0xfef0('0x19')]?_[_0xfef0('0x1a')](_0x41e0a9[_0xfef0('0x19')],function(_0x1d73d3){return{'model':db[_0x1d73d3['model']],'as':_0x1d73d3['as'],'attributes':_0x1d73d3['attributes']};}):[]};}):[]};}):[]:[]})[_0xfef0('0xa')](function(_0x822556){logger[_0xfef0('0xb')](_0xfef0('0x1c'),_0x3ebed2);logger[_0xfef0('0x1d')](_0xfef0('0x1c'),_0x3ebed2,JSON['stringify'](_0x822556));_0x35e21d(_0x822556);})[_0xfef0('0x12')](function(_0x549c21){logger[_0xfef0('0xf')]('GetTrigger',_0x549c21[_0xfef0('0x10')],_0x3ebed2);_0x586774(_0x564a64[_0xfef0('0xf')](0x1f4,_0x549c21[_0xfef0('0x10')]));});});};exports[_0xfef0('0x1e')]=function(_0x418371){var _0x29ed74=this;return new Promise(function(_0x3117a4,_0x34e5fb){return db['Trigger'][_0xfef0('0x1f')]({'raw':_0x418371['options']?_0x418371[_0xfef0('0x15')][_0xfef0('0x20')]===undefined?!![]:![]:!![],'where':_0x418371[_0xfef0('0x15')]?_0x418371[_0xfef0('0x15')][_0xfef0('0x16')]||null:null,'attributes':_0x418371[_0xfef0('0x15')]?_0x418371[_0xfef0('0x15')][_0xfef0('0x17')]||null:null,'include':_0x418371[_0xfef0('0x15')]?_0x418371[_0xfef0('0x15')][_0xfef0('0x19')]?_[_0xfef0('0x1a')](_0x418371[_0xfef0('0x15')][_0xfef0('0x19')],function(_0x677697){return{'model':db[_0x677697[_0xfef0('0x1b')]],'as':_0x677697['as'],'attributes':_0x677697[_0xfef0('0x17')],'include':_0x677697['include']?_[_0xfef0('0x1a')](_0x677697[_0xfef0('0x19')],function(_0x36c580){return{'model':db[_0x36c580['model']],'as':_0x36c580['as'],'attributes':_0x36c580[_0xfef0('0x17')],'include':_0x36c580[_0xfef0('0x19')]?_[_0xfef0('0x1a')](_0x36c580['include'],function(_0x35547f){return{'model':db[_0x35547f[_0xfef0('0x1b')]],'as':_0x35547f['as'],'attributes':_0x35547f[_0xfef0('0x17')]};}):[]};}):[]};}):[]:[]})[_0xfef0('0xa')](function(_0x2a630d){logger['info'](_0xfef0('0x1e'),_0x418371);logger[_0xfef0('0x1d')](_0xfef0('0x1e'),_0x418371,JSON[_0xfef0('0xe')](_0x2a630d));_0x3117a4(_0x2a630d);})['catch'](function(_0x3cc9c5){logger[_0xfef0('0xf')](_0xfef0('0x1e'),_0x3cc9c5[_0xfef0('0x10')],_0x418371);_0x34e5fb(_0x29ed74[_0xfef0('0xf')](0x1f4,_0x3cc9c5[_0xfef0('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index a4abbf7..3cd08c0 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 _0x60c6=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','post','clone','put','/:id','update','delete','exports','multer'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x60c6,0x1da));var _0x660c=function(_0x3ff2f9,_0x544ba1){_0x3ff2f9=_0x3ff2f9-0x0;var _0x3b0913=_0x60c6[_0x3ff2f9];return _0x3b0913;};'use strict';var multer=require(_0x660c('0x0'));var util=require(_0x660c('0x1'));var path=require(_0x660c('0x2'));var timeout=require(_0x660c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x660c('0x4'));var auth=require(_0x660c('0x5'));var interaction=require(_0x660c('0x6'));var config=require(_0x660c('0x7'));var controller=require('./trunk.controller');router[_0x660c('0x8')]('/',auth['isAuthenticated'](),controller[_0x660c('0x9')]);router[_0x660c('0x8')]('/:id',auth[_0x660c('0xa')](),controller[_0x660c('0xb')]);router[_0x660c('0xc')]('/:id/clone',auth[_0x660c('0xa')](),controller[_0x660c('0xd')]);router['post']('/',auth[_0x660c('0xa')](),controller['create']);router[_0x660c('0xe')](_0x660c('0xf'),auth['isAuthenticated'](),controller[_0x660c('0x10')]);router[_0x660c('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x660c('0x12')]=router; \ No newline at end of file +var _0x0dcf=['/:id/clone','clone','create','/:id','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post'];(function(_0x360d9a,_0x3dccad){var _0x2d2e68=function(_0x3cbfc1){while(--_0x3cbfc1){_0x360d9a['push'](_0x360d9a['shift']());}};_0x2d2e68(++_0x3dccad);}(_0x0dcf,0xc6));var _0xf0dc=function(_0x2f38de,_0x18671a){_0x2f38de=_0x2f38de-0x0;var _0x32b341=_0x0dcf[_0x2f38de];return _0x32b341;};'use strict';var multer=require(_0xf0dc('0x0'));var util=require(_0xf0dc('0x1'));var path=require(_0xf0dc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf0dc('0x3')]();var fs_extra=require(_0xf0dc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf0dc('0x5'));var config=require(_0xf0dc('0x6'));var controller=require('./trunk.controller');router[_0xf0dc('0x7')]('/',auth[_0xf0dc('0x8')](),controller['index']);router[_0xf0dc('0x7')]('/:id',auth[_0xf0dc('0x8')](),controller[_0xf0dc('0x9')]);router[_0xf0dc('0xa')](_0xf0dc('0xb'),auth[_0xf0dc('0x8')](),controller[_0xf0dc('0xc')]);router[_0xf0dc('0xa')]('/',auth['isAuthenticated'](),controller[_0xf0dc('0xd')]);router['put'](_0xf0dc('0xe'),auth['isAuthenticated'](),controller[_0xf0dc('0xf')]);router[_0xf0dc('0x10')](_0xf0dc('0xe'),auth['isAuthenticated'](),controller[_0xf0dc('0x11')]);module[_0xf0dc('0x12')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 6bb5c50..a0f97d9 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 _0x5273=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','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','pai','fingerprint','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','join','getDataValue','transport'];(function(_0x1c7dcf,_0x25723c){var _0x1ede61=function(_0x41f909){while(--_0x41f909){_0x1c7dcf['push'](_0x1c7dcf['shift']());}};_0x1ede61(++_0x25723c);}(_0x5273,0xc6));var _0x3527=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5273[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x3527('0x0'));module[_0x3527('0x1')]={'name':{'type':Sequelize[_0x3527('0x2')],'allowNull':![],'unique':_0x3527('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x5'),_0x3527('0x6'),_0x3527('0x7')),'allowNull':![],'defaultValue':_0x3527('0x5')},'context':{'type':Sequelize[_0x3527('0x2')],'allowNull':![],'defaultValue':_0x3527('0x8')},'callingpres':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x9'),_0x3527('0xa'),_0x3527('0xb'),_0x3527('0xc'),_0x3527('0xd'),_0x3527('0xe'),_0x3527('0xf'),_0x3527('0x10'))},'deny':{'type':Sequelize[_0x3527('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x3527('0x2')]},'md5secret':{'type':Sequelize[_0x3527('0x2')]},'remotesecret':{'type':Sequelize[_0x3527('0x2')]},'transport':{'type':Sequelize[_0x3527('0x2')],'defaultValue':_0x3527('0x11'),'set':function(_0x337572){this[_0x3527('0x12')]('transport',_0x337572?_0x337572[_0x3527('0x13')](','):null);},'get':function(){return this[_0x3527('0x14')](_0x3527('0x15'))?this['getDataValue'](_0x3527('0x15'))[_0x3527('0x16')](','):null;},'comment':_0x3527('0x17')},'dtmfmode':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x18'),_0x3527('0x19'),_0x3527('0x1a'),'inband',_0x3527('0x1b')),'defaultValue':_0x3527('0x18')},'directmedia':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x1c'),'no',_0x3527('0x1d'),_0x3527('0x1e'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x3527('0x2')]},'nat':{'type':Sequelize[_0x3527('0x2')],'defaultValue':_0x3527('0x1f'),'set':function(_0x44674c){this[_0x3527('0x12')](_0x3527('0x20'),_0x44674c?_0x44674c['join'](','):null);},'get':function(){return this[_0x3527('0x14')](_0x3527('0x20'))?this[_0x3527('0x14')](_0x3527('0x20'))[_0x3527('0x16')](','):null;},'comment':_0x3527('0x21')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x3527('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x3527('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3527('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3527('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0x3527('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xa6e5ec){this[_0x3527('0x12')]('allow',_0xa6e5ec?_0xa6e5ec[_0x3527('0x13')](';'):_0x3527('0x22'));},'get':function(){return this[_0x3527('0x14')](_0x3527('0x23'))?this[_0x3527('0x14')](_0x3527('0x23'))[_0x3527('0x16')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x3527('0x4')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x3527('0x24'),'set':function(_0x5b1601){this['setDataValue']('insecure',_0x5b1601?_0x5b1601[_0x3527('0x13')](','):null);},'get':function(){return this[_0x3527('0x14')](_0x3527('0x25'))?this[_0x3527('0x14')](_0x3527('0x25'))[_0x3527('0x16')](','):null;},'comment':_0x3527('0x26')},'trustrpid':{'type':Sequelize[_0x3527('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3527('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x1c'),'no',_0x3527('0x27'))},'promiscredir':{'type':Sequelize['ENUM'](_0x3527('0x1c'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0x3527('0x1c'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x3527('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x3527('0x28')},'amaflags':{'type':Sequelize[_0x3527('0x2')]},'callcounter':{'type':Sequelize[_0x3527('0x4')]('yes','no'),'defaultValue':_0x3527('0x1c')},'busylevel':{'type':Sequelize[_0x3527('0x29')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x3527('0x1c'),'no')},'allowsubscribe':{'type':Sequelize[_0x3527('0x4')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x1c'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3527('0x4')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x3527('0x2')]},'videosupport':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x1c'),'no',_0x3527('0x2a')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3527('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3527('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0x3527('0x2')]},'session_timers':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x2b'),_0x3527('0x2c'),_0x3527('0x2d'))},'session_expires':{'type':Sequelize[_0x3527('0x29')](0xb)},'session_minse':{'type':Sequelize[_0x3527('0x29')](0xb)},'session_refresher':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x2e'),_0x3527('0x2f')),'defaultValue':_0x3527('0x2f')},'t38pt_usertpsource':{'type':Sequelize[_0x3527('0x2')]},'regexten':{'type':Sequelize[_0x3527('0x2')]},'fromdomain':{'type':Sequelize[_0x3527('0x2')]},'fromuser':{'type':Sequelize[_0x3527('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x3527('0x1c'),'no'),'defaultValue':_0x3527('0x1c')},'keepalive':{'type':Sequelize[_0x3527('0x29')](0xb)},'defaultip':{'type':Sequelize[_0x3527('0x2')]},'defaultuser':{'type':Sequelize[_0x3527('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3527('0x29')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x3527('0x1c'),'no',_0x3527('0x30')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3527('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x3527('0x29')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x3527('0x29')](0xb)},'contactpermit':{'type':Sequelize[_0x3527('0x2')]},'contactdeny':{'type':Sequelize[_0x3527('0x2')]},'contactacl':{'type':Sequelize[_0x3527('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x3527('0x2')]},'use_q850_reason':{'type':Sequelize[_0x3527('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x3527('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x3527('0x1c'),'no')},'force_avp':{'type':Sequelize[_0x3527('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x1c'),'no')},'dtlsenable':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x1c'),'no')},'dtlsverify':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x1c'),'no',_0x3527('0x31'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x3527('0x29')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3527('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x3527('0x2')]},'dtlscipher':{'type':Sequelize[_0x3527('0x2')]},'dtlscafile':{'type':Sequelize[_0x3527('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x3527('0x4')]('active',_0x3527('0x32'),_0x3527('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3527('0x2')]},'usereqphone':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x1c'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3527('0x2')]},'recordofffeature':{'type':Sequelize[_0x3527('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x1c'),'no')},'subscribemwi':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x1c'),'no')},'vmexten':{'type':Sequelize[_0x3527('0x2')]},'mohinterpret':{'type':Sequelize[_0x3527('0x2')]},'mohsuggest':{'type':Sequelize[_0x3527('0x2')]},'parkinglot':{'type':Sequelize[_0x3527('0x2')]},'description':{'type':Sequelize[_0x3527('0x2')]},'host':{'type':Sequelize[_0x3527('0x2')],'defaultValue':_0x3527('0x34')},'canreinvite':{'type':Sequelize[_0x3527('0x4')](_0x3527('0x1c'),'no','nonat',_0x3527('0x1e'),_0x3527('0x35')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x3527('0x36')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x3527('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x4467=['nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','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','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','dynamic','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','auto','nonat','update','outgoing','yes','force_rport,comedia'];(function(_0x4ee386,_0x1a9032){var _0x42450c=function(_0x51d08c){while(--_0x51d08c){_0x4ee386['push'](_0x4ee386['shift']());}};_0x42450c(++_0x1a9032);}(_0x4467,0x117));var _0x7446=function(_0x5f4efc,_0x517f9e){_0x5f4efc=_0x5f4efc-0x0;var _0x9e8d63=_0x4467[_0x5f4efc];return _0x9e8d63;};'use strict';var Sequelize=require(_0x7446('0x0'));module['exports']={'name':{'type':Sequelize[_0x7446('0x1')],'allowNull':![],'unique':_0x7446('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x4'),_0x7446('0x5'),_0x7446('0x6')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7446('0x1')],'allowNull':![],'defaultValue':_0x7446('0x7')},'callingpres':{'type':Sequelize[_0x7446('0x3')]('ALLOWED_NOT_SCREENED',_0x7446('0x8'),_0x7446('0x9'),_0x7446('0xa'),_0x7446('0xb'),_0x7446('0xc'),_0x7446('0xd'),_0x7446('0xe'))},'deny':{'type':Sequelize[_0x7446('0x1')]},'permit':{'type':Sequelize[_0x7446('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x7446('0x1')]},'remotesecret':{'type':Sequelize[_0x7446('0x1')]},'transport':{'type':Sequelize[_0x7446('0x1')],'defaultValue':_0x7446('0xf'),'set':function(_0x228d1e){this[_0x7446('0x10')](_0x7446('0x11'),_0x228d1e?_0x228d1e['join'](','):null);},'get':function(){return this[_0x7446('0x12')](_0x7446('0x11'))?this['getDataValue']('transport')['split'](','):null;},'comment':_0x7446('0x13')},'dtmfmode':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x14'),'info','shortinfo','inband',_0x7446('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x7446('0x3')]('yes','no',_0x7446('0x16'),_0x7446('0x17'),_0x7446('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x7446('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7446('0x1')]},'directmediadeny':{'type':Sequelize[_0x7446('0x1')]},'nat':{'type':Sequelize[_0x7446('0x1')],'defaultValue':_0x7446('0x1a'),'set':function(_0x33202f){this['setDataValue'](_0x7446('0x1b'),_0x33202f?_0x33202f['join'](','):null);},'get':function(){return this[_0x7446('0x12')]('nat')?this[_0x7446('0x12')](_0x7446('0x1b'))[_0x7446('0x1c')](','):null;},'comment':_0x7446('0x1d')},'callgroup':{'type':Sequelize[_0x7446('0x1')]},'namedcallgroup':{'type':Sequelize[_0x7446('0x1')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7446('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7446('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7446('0x1')],'defaultValue':_0x7446('0x1e')},'allow':{'type':Sequelize[_0x7446('0x1')],'allowNull':![],'defaultValue':_0x7446('0x1f'),'set':function(_0x3944c5){this[_0x7446('0x10')](_0x7446('0x20'),_0x3944c5?_0x3944c5[_0x7446('0x21')](';'):_0x7446('0x1f'));},'get':function(){return this['getDataValue']('allow')?this[_0x7446('0x12')](_0x7446('0x20'))[_0x7446('0x1c')](';'):null;},'comment':_0x7446('0x22')},'autoframing':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x19'),'no')},'insecure':{'type':Sequelize[_0x7446('0x1')],'defaultValue':_0x7446('0x23'),'set':function(_0x8c053b){this[_0x7446('0x10')](_0x7446('0x24'),_0x8c053b?_0x8c053b[_0x7446('0x21')](','):null);},'get':function(){return this[_0x7446('0x12')](_0x7446('0x24'))?this['getDataValue'](_0x7446('0x24'))[_0x7446('0x1c')](','):null;},'comment':_0x7446('0x25')},'trustrpid':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7446('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x7446('0x26'))},'promiscredir':{'type':Sequelize[_0x7446('0x3')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x7446('0x19'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x7446('0x1')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0x7446('0x27')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x7446('0x3')]('yes','no'),'defaultValue':_0x7446('0x19')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x7446('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x7446('0x1')]},'videosupport':{'type':Sequelize[_0x7446('0x3')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7446('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7446('0x19'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x7446('0x3')]('accept',_0x7446('0x29'),_0x7446('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x7446('0x28')](0xb)},'session_refresher':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x2b'),_0x7446('0x2c')),'defaultValue':_0x7446('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x7446('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x7446('0x1')]},'fromuser':{'type':Sequelize[_0x7446('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x19'),'no'),'defaultValue':_0x7446('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x7446('0x1')]},'defaultuser':{'type':Sequelize[_0x7446('0x1')]},'rtptimeout':{'type':Sequelize[_0x7446('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7446('0x28')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7446('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7446('0x1')]},'callbackextension':{'type':Sequelize[_0x7446('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x7446('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7446('0x28')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x7446('0x1')]},'use_q850_reason':{'type':Sequelize[_0x7446('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x7446('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x7446('0x19'),'no')},'force_avp':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x19'),'no')},'icesupport':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x7446('0x3')]('yes','no',_0x7446('0x2d'),_0x7446('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x7446('0x28')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x7446('0x1')]},'dtlscipher':{'type':Sequelize[_0x7446('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x7446('0x1')]},'dtlssetup':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x2f'),'passive',_0x7446('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7446('0x1')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x7446('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x7446('0x3')]('yes','no')},'vmexten':{'type':Sequelize[_0x7446('0x1')]},'mohinterpret':{'type':Sequelize[_0x7446('0x1')]},'mohsuggest':{'type':Sequelize[_0x7446('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7446('0x1')]},'host':{'type':Sequelize[_0x7446('0x1')],'defaultValue':_0x7446('0x31')},'canreinvite':{'type':Sequelize[_0x7446('0x3')](_0x7446('0x19'),'no',_0x7446('0x16'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7446('0x1')]},'otherFields':{'type':Sequelize[_0x7446('0x1')]},'active':{'type':Sequelize[_0x7446('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7446('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 794e91b..f84dbf6 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 _0x8ef6=['userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','utf8','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Reload','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','options','Trunk','includeAll','include','findAll','rows','show','params','rawAttributes','merge','find','catch','clone','omit','createdAt','updatedAt','create','body','get','role','UserProfileSection'];(function(_0x1b995b,_0x3d20b7){var _0x127993=function(_0x1399a4){while(--_0x1399a4){_0x1b995b['push'](_0x1b995b['shift']());}};_0x127993(++_0x3d20b7);}(_0x8ef6,0xf2));var _0x68ef=function(_0xd1cf86,_0x20a883){_0xd1cf86=_0xd1cf86-0x0;var _0x1a81b6=_0x8ef6[_0xd1cf86];return _0x1a81b6;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];var jayson=require(_0x68ef('0x1b'));var client=jayson[_0x68ef('0x1c')][_0x68ef('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x288cc9,_0x508671,_0x3b48dd,_0xc50cce){return new BPromise(function(_0x2657c5,_0x47fbb5){var _0x22fe96=_0xc50cce||client;return _0x22fe96[_0x68ef('0x1e')](_0x288cc9,_0x3b48dd)[_0x68ef('0x1f')](function(_0x5005ba){logger[_0x68ef('0x20')](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));logger[_0x68ef('0x23')]('Trunk,\x20%s,\x20%s,\x20%s',_0x508671,_0x68ef('0x22'),JSON['stringify'](_0x5005ba));if(_0x5005ba['error']){if(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x25')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x508671,_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);return _0x47fbb5(_0x5005ba[_0x68ef('0x24')]['message']);}logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x5005ba[_0x68ef('0x24')]['message']);return _0x2657c5(_0x5005ba[_0x68ef('0x24')][_0x68ef('0x26')]);}else{logger['info'](_0x68ef('0x21'),_0x508671,_0x68ef('0x22'));_0x2657c5(_0x5005ba[_0x68ef('0x27')]['message']);}})['catch'](function(_0x59bebc){logger[_0x68ef('0x24')](_0x68ef('0x21'),_0x508671,_0x59bebc);_0x47fbb5(_0x59bebc);});});}function respondWithStatusCode(_0x312cc9,_0x2e6e39){_0x2e6e39=_0x2e6e39||0xcc;return function(_0x438b4c){if(_0x438b4c){return _0x312cc9[_0x68ef('0x28')](_0x2e6e39);}return _0x312cc9[_0x68ef('0x29')](_0x2e6e39)[_0x68ef('0x2a')]();};}function respondWithResult(_0x65fd09,_0x13280b){_0x13280b=_0x13280b||0xc8;return function(_0x5e4dbe){if(_0x5e4dbe){return _0x65fd09[_0x68ef('0x29')](_0x13280b)['json'](_0x5e4dbe);}};}function respondWithFilteredResult(_0x599243,_0x55d8b0){return function(_0x1a7ce1){if(_0x1a7ce1){var _0x268f32=typeof _0x55d8b0[_0x68ef('0x2b')]===_0x68ef('0x2c')&&typeof _0x55d8b0['limit']==='undefined';var _0x1cbe4f=_0x1a7ce1[_0x68ef('0x2d')];var _0x7bf96=_0x268f32?0x0:_0x55d8b0[_0x68ef('0x2b')];var _0x22ef25=_0x268f32?_0x1a7ce1[_0x68ef('0x2d')]:_0x55d8b0[_0x68ef('0x2b')]+_0x55d8b0[_0x68ef('0x2e')];var _0x5a6dfd;if(_0x22ef25>=_0x1cbe4f){_0x22ef25=_0x1cbe4f;_0x5a6dfd=0xc8;}else{_0x5a6dfd=0xce;}_0x599243[_0x68ef('0x29')](_0x5a6dfd);return _0x599243[_0x68ef('0x2f')](_0x68ef('0x30'),_0x7bf96+'-'+_0x22ef25+'/'+_0x1cbe4f)['json'](_0x1a7ce1);}return null;};}function patchUpdates(_0x370a8f){return function(_0x523120){try{jsonpatch[_0x68ef('0x31')](_0x523120,_0x370a8f,!![]);}catch(_0x17588a){return BPromise['reject'](_0x17588a);}return _0x523120['save']();};}function saveUpdates(_0x159395,_0x5fa72a){return function(_0x4b8fc8){if(_0x4b8fc8){return _0x4b8fc8[_0x68ef('0x32')](_0x159395)[_0x68ef('0x1f')](function(_0x2d67be){return _0x2d67be;});}return null;};}function removeEntity(_0x2d1e9f,_0x59e9fb){return function(_0x2c8bd0){if(_0x2c8bd0){return _0x2c8bd0[_0x68ef('0x33')]()['then'](function(){var _0x2f8de2=_0x2c8bd0['get']({'plain':!![]});var _0x14581d=_0x68ef('0x34');return db['UserProfileResource'][_0x68ef('0x33')]({'where':{'type':_0x14581d,'resourceId':_0x2f8de2['id']}})['then'](function(){return _0x2c8bd0;});})[_0x68ef('0x1f')](function(){_0x2d1e9f['status'](0xcc)[_0x68ef('0x2a')]();});}};}function handleEntityNotFound(_0x1444e0,_0x798276){return function(_0x569949){if(!_0x569949){_0x1444e0[_0x68ef('0x28')](0x194);}return _0x569949;};}function handleError(_0x485dc3,_0x476938){_0x476938=_0x476938||0x1f4;return function(_0x4c9506){logger[_0x68ef('0x24')](_0x4c9506[_0x68ef('0x35')]);if(_0x4c9506[_0x68ef('0x36')]){delete _0x4c9506[_0x68ef('0x36')];}_0x485dc3[_0x68ef('0x29')](_0x476938)[_0x68ef('0x37')](_0x4c9506);};}exports['index']=function(_0x294fba,_0x15a6ab){var _0x32074a={},_0x52a8b9={},_0x32eddd={'count':0x0,'rows':[]};var _0x3c5de6=_[_0x68ef('0x38')](db['Trunk']['rawAttributes'],function(_0x14f0fc){return{'name':_0x14f0fc[_0x68ef('0x39')],'type':_0x14f0fc[_0x68ef('0x3a')][_0x68ef('0x3b')]};});_0x52a8b9[_0x68ef('0x3c')]=_[_0x68ef('0x38')](_0x3c5de6,_0x68ef('0x36'));_0x52a8b9['query']=_[_0x68ef('0x3d')](_0x294fba[_0x68ef('0x3e')]);_0x52a8b9[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x52a8b9['model'],_0x52a8b9[_0x68ef('0x3e')]);_0x32074a[_0x68ef('0x41')]=_[_0x68ef('0x40')](_0x52a8b9[_0x68ef('0x3c')],qs[_0x68ef('0x42')](_0x294fba[_0x68ef('0x3e')]['fields']));_0x32074a[_0x68ef('0x41')]=_0x32074a[_0x68ef('0x41')][_0x68ef('0x43')]?_0x32074a[_0x68ef('0x41')]:_0x52a8b9[_0x68ef('0x3c')];if(!_0x294fba[_0x68ef('0x3e')][_0x68ef('0x44')](_0x68ef('0x45'))){_0x32074a[_0x68ef('0x2e')]=qs['limit'](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2e')]);_0x32074a[_0x68ef('0x2b')]=qs[_0x68ef('0x2b')](_0x294fba[_0x68ef('0x3e')][_0x68ef('0x2b')]);}_0x32074a[_0x68ef('0x46')]=qs['sort'](_0x294fba[_0x68ef('0x3e')]['sort']);_0x32074a[_0x68ef('0x47')]=qs[_0x68ef('0x3f')](_[_0x68ef('0x48')](_0x294fba[_0x68ef('0x3e')],_0x52a8b9['filters']),_0x3c5de6);if(_0x294fba[_0x68ef('0x3e')]['filter']){_0x32074a[_0x68ef('0x47')]=_['merge'](_0x32074a[_0x68ef('0x47')],{'$or':_[_0x68ef('0x38')](_0x3c5de6,function(_0x105e8c){if(_0x105e8c['type']!=='VIRTUAL'){var _0x4044d5={};_0x4044d5[_0x105e8c[_0x68ef('0x36')]]={'$like':'%'+_0x294fba['query']['filter']+'%'};return _0x4044d5;}})});}_0x32074a=_['merge']({},_0x32074a,_0x294fba[_0x68ef('0x49')]);var _0x15c753={'where':_0x32074a[_0x68ef('0x47')]};return db[_0x68ef('0x4a')][_0x68ef('0x2d')](_0x15c753)['then'](function(_0x55f385){_0x32eddd[_0x68ef('0x2d')]=_0x55f385;if(_0x294fba[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0x32074a[_0x68ef('0x4c')]=[{'all':!![]}];}return db['Trunk'][_0x68ef('0x4d')](_0x32074a);})[_0x68ef('0x1f')](function(_0x1c9b6f){_0x32eddd[_0x68ef('0x4e')]=_0x1c9b6f;return _0x32eddd;})['then'](respondWithFilteredResult(_0x15a6ab,_0x32074a))['catch'](handleError(_0x15a6ab,null));};exports[_0x68ef('0x4f')]=function(_0x3c3074,_0x566e7c){var _0xfc7a74={'raw':![],'where':{'id':_0x3c3074[_0x68ef('0x50')]['id']}},_0x12fff3={};_0x12fff3[_0x68ef('0x3c')]=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x12fff3[_0x68ef('0x3e')]=_[_0x68ef('0x3d')](_0x3c3074['query']);_0x12fff3[_0x68ef('0x3f')]=_[_0x68ef('0x40')](_0x12fff3[_0x68ef('0x3c')],_0x12fff3['query']);_0xfc7a74[_0x68ef('0x41')]=_['intersection'](_0x12fff3['model'],qs[_0x68ef('0x42')](_0x3c3074['query'][_0x68ef('0x42')]));_0xfc7a74[_0x68ef('0x41')]=_0xfc7a74[_0x68ef('0x41')][_0x68ef('0x43')]?_0xfc7a74[_0x68ef('0x41')]:_0x12fff3[_0x68ef('0x3c')];if(_0x3c3074[_0x68ef('0x3e')][_0x68ef('0x4b')]){_0xfc7a74[_0x68ef('0x4c')]=[{'all':!![]}];}_0xfc7a74=_[_0x68ef('0x52')]({},_0xfc7a74,_0x3c3074['options']);return db['Trunk'][_0x68ef('0x53')](_0xfc7a74)[_0x68ef('0x1f')](handleEntityNotFound(_0x566e7c,null))[_0x68ef('0x1f')](respondWithResult(_0x566e7c,null))[_0x68ef('0x54')](handleError(_0x566e7c,null));};exports[_0x68ef('0x55')]=function(_0x1d11d7,_0x15400c){var _0x300a64={'where':{'id':_0x1d11d7['params']['id']}},_0x40c784={};_0x40c784['model']=_[_0x68ef('0x3d')](db['Trunk'][_0x68ef('0x51')]);_0x300a64['attributes']=_[_0x68ef('0x40')](_0x40c784[_0x68ef('0x3c')],qs['fields'](_0x1d11d7[_0x68ef('0x3e')]['fields']));_0x300a64[_0x68ef('0x41')]=_0x300a64[_0x68ef('0x41')][_0x68ef('0x43')]?_0x300a64[_0x68ef('0x41')]:_0x40c784[_0x68ef('0x3c')];if(_0x1d11d7[_0x68ef('0x3e')]['includeAll']){_0x300a64[_0x68ef('0x4c')]=[{'all':!![]}];}_0x300a64=_[_0x68ef('0x52')]({},_0x300a64,_0x1d11d7[_0x68ef('0x49')]);return db[_0x68ef('0x4a')][_0x68ef('0x53')](_0x300a64)[_0x68ef('0x1f')](handleEntityNotFound(_0x15400c,null))['then'](function(_0x9a978f){if(_0x9a978f){var _0x42d2a3=_0x9a978f['get']({'plain':!![]});_0x42d2a3=qs[_0x68ef('0x56')](_0x42d2a3,['id',_0x68ef('0x57'),_0x68ef('0x58')]);_0x1d11d7['body']=_[_0x68ef('0x56')](_0x1d11d7['body'],['id','createdAt',_0x68ef('0x58')]);return db['Trunk'][_0x68ef('0x59')](_['merge'](_0x42d2a3,_0x1d11d7[_0x68ef('0x5a')]),{'include':_0x1d11d7[_0x68ef('0x3e')][_0x68ef('0x4b')]?[{'all':!![]}]:undefined})[_0x68ef('0x1f')](function(_0x19ce17){var _0x19a9c4=_0x1d11d7['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x19a9c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19a9c4[_0x68ef('0x5c')]==='user'){var _0x2f97c5=_0x19ce17[_0x68ef('0x5b')]({'plain':!![]});var _0x212ec4=_0x68ef('0x34');return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x212ec4,'userProfileId':_0x19a9c4[_0x68ef('0x5e')]},'raw':!![]})['then'](function(_0x3ea4e7){if(_0x3ea4e7&&_0x3ea4e7[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x2f97c5[_0x68ef('0x36')],'resourceId':_0x2f97c5['id'],'type':_0x3ea4e7['name'],'sectionId':_0x3ea4e7['id']},{})[_0x68ef('0x1f')](function(){return _0x19ce17;});}else{return _0x19ce17;}})['catch'](function(_0x1ed172){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed172);throw _0x1ed172;});}return _0x19ce17;});}})[_0x68ef('0x1f')](respondWithResult(_0x15400c,0xc9))[_0x68ef('0x54')](handleError(_0x15400c,null));};exports[_0x68ef('0x59')]=function(_0x21b2ce,_0x51f905,_0x124b49){var _0x570e0c;return db[_0x68ef('0x4a')][_0x68ef('0x59')](_0x21b2ce[_0x68ef('0x5a')],{'raw':!![]})['then'](function(_0x541e35){_0x570e0c=_0x541e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});})[_0x68ef('0x1f')](function(_0x454c6f){var _0x5b41e1=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),'utf8');var _0x3f56a7=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0xed16d1=ejs['render'](_0x5b41e1,{'trunks':_0x454c6f||[]});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0xed16d1);if(_0x570e0c[_0x68ef('0x69')]){var _0x595e79=ejs[_0x68ef('0x6a')](_0x3f56a7,{'trunks':_0x454c6f||[]});fs['writeFileSync'](_0x68ef('0x6b'),_0x595e79);}})['then'](function(){return respondWithRpcPromise('Reload',_0x68ef('0x59'),{'module':_0x68ef('0x6c')});})[_0x68ef('0x1f')](function(){var _0x405971=_0x21b2ce['user'][_0x68ef('0x5b')]({'plain':!![]});if(!_0x405971)throw new Error(_0x68ef('0x6d'));if(_0x405971[_0x68ef('0x5c')]==='user'){var _0x3e14a4=_0x570e0c[_0x68ef('0x5b')]({'plain':!![]});return db[_0x68ef('0x5d')][_0x68ef('0x53')]({'where':{'name':_0x68ef('0x34'),'userProfileId':_0x405971[_0x68ef('0x5e')]},'raw':!![]})[_0x68ef('0x1f')](function(_0xfe72dc){if(_0xfe72dc&&_0xfe72dc[_0x68ef('0x5f')]===0x0){return db[_0x68ef('0x60')][_0x68ef('0x59')]({'name':_0x3e14a4[_0x68ef('0x36')],'resourceId':_0x3e14a4['id'],'type':_0xfe72dc['name'],'sectionId':_0xfe72dc['id']},{})[_0x68ef('0x1f')](function(){return _0x570e0c;});}else{return _0x570e0c;}})[_0x68ef('0x54')](function(_0x5db443){logger['error'](_0x68ef('0x6e'),_0x5db443);throw _0x5db443;});}return _0x570e0c;})['then'](respondWithResult(_0x51f905,0xc9))[_0x68ef('0x54')](handleError(_0x51f905,null));};exports[_0x68ef('0x32')]=function(_0x5f1b12,_0x4e0874,_0x31a336){var _0x5c500c;return db[_0x68ef('0x4a')]['find']({'where':{'id':_0x5f1b12[_0x68ef('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e0874,null))[_0x68ef('0x1f')](saveUpdates(_0x5f1b12[_0x68ef('0x5a')],null))['then'](function(_0x3c5e35){if(_0x3c5e35){_0x5c500c=_0x3c5e35;return db[_0x68ef('0x4a')][_0x68ef('0x4d')]({'raw':!![]});}})[_0x68ef('0x1f')](function(_0x50c308){if(_0x50c308){var _0x2bebdc=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4de1d1=fs[_0x68ef('0x61')](path['join'](config[_0x68ef('0x63')],_0x68ef('0x65')),'utf8');var _0x4b0fb4=ejs['render'](_0x2bebdc,{'trunks':_0x50c308||[]});fs['writeFileSync'](_0x68ef('0x68'),_0x4b0fb4);var _0x28ad22=ejs[_0x68ef('0x6a')](_0x4de1d1,{'trunks':_0x50c308||[]});fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x28ad22);return respondWithRpcPromise(_0x68ef('0x6f'),_0x68ef('0x32'),{'module':_0x68ef('0x6c')});}return null;})[_0x68ef('0x1f')](function(_0x3ae3e9){if(_0x3ae3e9){return _0x5c500c;}})[_0x68ef('0x1f')](respondWithResult(_0x4e0874,null))[_0x68ef('0x54')](handleError(_0x4e0874,null));};exports[_0x68ef('0x33')]=function(_0x4bd5c3,_0x2b20dc,_0x556dfc){var _0x791181;return db['Trunk']['find']({'where':{'id':_0x4bd5c3[_0x68ef('0x50')]['id']}})[_0x68ef('0x1f')](handleEntityNotFound(_0x2b20dc,null))[_0x68ef('0x1f')](removeEntity(_0x2b20dc,null))[_0x68ef('0x1f')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x68ef('0x1f')](function(_0x308997){var _0x1f1dfd=fs['readFileSync'](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x64')),_0x68ef('0x66'));var _0x4dc885=fs[_0x68ef('0x61')](path[_0x68ef('0x62')](config[_0x68ef('0x63')],_0x68ef('0x65')),_0x68ef('0x66'));var _0x346049=ejs['render'](_0x1f1dfd,{'trunks':_0x308997});var _0x2a72e8=ejs['render'](_0x4dc885,{'trunks':_0x308997});fs[_0x68ef('0x67')](_0x68ef('0x68'),_0x346049);fs[_0x68ef('0x67')](_0x68ef('0x6b'),_0x2a72e8);return respondWithRpcPromise('Reload',_0x68ef('0x33'),{'module':'chan_sip.so'});})[_0x68ef('0x54')](handleError(_0x2b20dc,null));}; \ No newline at end of file +var _0x9c44=['key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','clone','find','omit','createdAt','body','updatedAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','params','/etc/asterisk/sip_xcally_registers.conf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','get','Trunks','destroy','stack','name','send','index','Trunk','rawAttributes','fieldName','type'];(function(_0x3ac31a,_0x18f1b9){var _0x4caa11=function(_0x2d2211){while(--_0x2d2211){_0x3ac31a['push'](_0x3ac31a['shift']());}};_0x4caa11(++_0x18f1b9);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x16')][_0x49c4('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x5f2fd9,_0x1909fe,_0x280996,_0x21f15a){return new BPromise(function(_0x2decee,_0x12777c){var _0x18211c=_0x21f15a||client;return _0x18211c[_0x49c4('0x18')](_0x5f2fd9,_0x280996)[_0x49c4('0x19')](function(_0x58d177){logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));logger[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x1909fe,'request\x20sent',JSON[_0x49c4('0x1f')](_0x58d177));if(_0x58d177[_0x49c4('0x20')]){if(_0x58d177['error']['code']===0x1f4){logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')]['message']);return _0x12777c(_0x58d177[_0x49c4('0x20')]['message']);}logger[_0x49c4('0x20')](_0x49c4('0x1b'),_0x1909fe,_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);return _0x2decee(_0x58d177[_0x49c4('0x20')][_0x49c4('0x21')]);}else{logger[_0x49c4('0x1a')](_0x49c4('0x1b'),_0x1909fe,_0x49c4('0x1c'));_0x2decee(_0x58d177['result']['message']);}})['catch'](function(_0x1c99b1){logger['error']('Trunk,\x20%s,\x20%s',_0x1909fe,_0x1c99b1);_0x12777c(_0x1c99b1);});});}function respondWithStatusCode(_0x2263ae,_0x15581b){_0x15581b=_0x15581b||0xcc;return function(_0x26c640){if(_0x26c640){return _0x2263ae[_0x49c4('0x22')](_0x15581b);}return _0x2263ae['status'](_0x15581b)['end']();};}function respondWithResult(_0x180276,_0x9cb797){_0x9cb797=_0x9cb797||0xc8;return function(_0x565423){if(_0x565423){return _0x180276[_0x49c4('0x23')](_0x9cb797)[_0x49c4('0x24')](_0x565423);}};}function respondWithFilteredResult(_0x210159,_0xa7a826){return function(_0x531d92){if(_0x531d92){var _0x543ea2=typeof _0xa7a826[_0x49c4('0x25')]==='undefined'&&typeof _0xa7a826[_0x49c4('0x26')]===_0x49c4('0x27');var _0x3f1708=_0x531d92[_0x49c4('0x28')];var _0x5987ae=_0x543ea2?0x0:_0xa7a826[_0x49c4('0x25')];var _0x2b2793=_0x543ea2?_0x531d92[_0x49c4('0x28')]:_0xa7a826[_0x49c4('0x25')]+_0xa7a826[_0x49c4('0x26')];var _0x29f835;if(_0x2b2793>=_0x3f1708){_0x2b2793=_0x3f1708;_0x29f835=0xc8;}else{_0x29f835=0xce;}_0x210159[_0x49c4('0x23')](_0x29f835);return _0x210159[_0x49c4('0x29')](_0x49c4('0x2a'),_0x5987ae+'-'+_0x2b2793+'/'+_0x3f1708)[_0x49c4('0x24')](_0x531d92);}return null;};}function patchUpdates(_0x46f7ea){return function(_0x4ea6ea){try{jsonpatch['apply'](_0x4ea6ea,_0x46f7ea,!![]);}catch(_0x59eb84){return BPromise[_0x49c4('0x2b')](_0x59eb84);}return _0x4ea6ea[_0x49c4('0x2c')]();};}function saveUpdates(_0x1eb035,_0x27e467){return function(_0x28eb47){if(_0x28eb47){return _0x28eb47['update'](_0x1eb035)[_0x49c4('0x19')](function(_0x116eb4){return _0x116eb4;});}return null;};}function removeEntity(_0x2e7a69,_0x24bba9){return function(_0x58e252){if(_0x58e252){return _0x58e252['destroy']()[_0x49c4('0x19')](function(){var _0x9a1bed=_0x58e252[_0x49c4('0x2d')]({'plain':!![]});var _0x13b3b4=_0x49c4('0x2e');return db['UserProfileResource'][_0x49c4('0x2f')]({'where':{'type':_0x13b3b4,'resourceId':_0x9a1bed['id']}})[_0x49c4('0x19')](function(){return _0x58e252;});})[_0x49c4('0x19')](function(){_0x2e7a69['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x85dce2,_0x1991e9){return function(_0x3bec0a){if(!_0x3bec0a){_0x85dce2[_0x49c4('0x22')](0x194);}return _0x3bec0a;};}function handleError(_0x2b45a1,_0x2cf897){_0x2cf897=_0x2cf897||0x1f4;return function(_0x1d1557){logger[_0x49c4('0x20')](_0x1d1557[_0x49c4('0x30')]);if(_0x1d1557['name']){delete _0x1d1557[_0x49c4('0x31')];}_0x2b45a1['status'](_0x2cf897)[_0x49c4('0x32')](_0x1d1557);};}exports[_0x49c4('0x33')]=function(_0x2625a6,_0x1c2830){var _0x4ed4f8={},_0x335f0c={},_0x31f3ff={'count':0x0,'rows':[]};var _0x1c910a=_['map'](db[_0x49c4('0x34')][_0x49c4('0x35')],function(_0x178987){return{'name':_0x178987[_0x49c4('0x36')],'type':_0x178987[_0x49c4('0x37')][_0x49c4('0x38')]};});_0x335f0c[_0x49c4('0x39')]=_[_0x49c4('0x3a')](_0x1c910a,_0x49c4('0x31'));_0x335f0c[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2625a6['query']);_0x335f0c[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],_0x335f0c[_0x49c4('0x3b')]);_0x4ed4f8[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x335f0c[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x4ed4f8[_0x49c4('0x3f')]=_0x4ed4f8[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x4ed4f8['attributes']:_0x335f0c[_0x49c4('0x39')];if(!_0x2625a6['query'][_0x49c4('0x42')](_0x49c4('0x43'))){_0x4ed4f8[_0x49c4('0x26')]=qs[_0x49c4('0x26')](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x26')]);_0x4ed4f8['offset']=qs['offset'](_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x25')]);}_0x4ed4f8[_0x49c4('0x44')]=qs[_0x49c4('0x45')](_0x2625a6['query'][_0x49c4('0x45')]);_0x4ed4f8[_0x49c4('0x46')]=qs[_0x49c4('0x3d')](_[_0x49c4('0x47')](_0x2625a6[_0x49c4('0x3b')],_0x335f0c[_0x49c4('0x3d')]),_0x1c910a);if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x48')]){_0x4ed4f8[_0x49c4('0x46')]=_['merge'](_0x4ed4f8[_0x49c4('0x46')],{'$or':_['map'](_0x1c910a,function(_0x33696e){if(_0x33696e[_0x49c4('0x37')]!==_0x49c4('0x49')){var _0x258abe={};_0x258abe[_0x33696e[_0x49c4('0x31')]]={'$like':'%'+_0x2625a6['query'][_0x49c4('0x48')]+'%'};return _0x258abe;}})});}_0x4ed4f8=_[_0x49c4('0x4a')]({},_0x4ed4f8,_0x2625a6[_0x49c4('0x4b')]);var _0x254d07={'where':_0x4ed4f8[_0x49c4('0x46')]};return db[_0x49c4('0x34')][_0x49c4('0x28')](_0x254d07)['then'](function(_0x3bac1b){_0x31f3ff['count']=_0x3bac1b;if(_0x2625a6[_0x49c4('0x3b')][_0x49c4('0x4c')]){_0x4ed4f8[_0x49c4('0x4d')]=[{'all':!![]}];}return db[_0x49c4('0x34')][_0x49c4('0x4e')](_0x4ed4f8);})[_0x49c4('0x19')](function(_0x2c6be1){_0x31f3ff['rows']=_0x2c6be1;return _0x31f3ff;})[_0x49c4('0x19')](respondWithFilteredResult(_0x1c2830,_0x4ed4f8))[_0x49c4('0x4f')](handleError(_0x1c2830,null));};exports['show']=function(_0x1e1ac4,_0xaece5f){var _0xfbe179={'raw':![],'where':{'id':_0x1e1ac4['params']['id']}},_0x242afc={};_0x242afc['model']=_[_0x49c4('0x3c')](db['Trunk'][_0x49c4('0x35')]);_0x242afc[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x1e1ac4[_0x49c4('0x3b')]);_0x242afc[_0x49c4('0x3d')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],_0x242afc['query']);_0xfbe179[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x242afc[_0x49c4('0x39')],qs[_0x49c4('0x40')](_0x1e1ac4[_0x49c4('0x3b')][_0x49c4('0x40')]));_0xfbe179[_0x49c4('0x3f')]=_0xfbe179[_0x49c4('0x3f')][_0x49c4('0x41')]?_0xfbe179[_0x49c4('0x3f')]:_0x242afc['model'];if(_0x1e1ac4['query'][_0x49c4('0x4c')]){_0xfbe179[_0x49c4('0x4d')]=[{'all':!![]}];}_0xfbe179=_['merge']({},_0xfbe179,_0x1e1ac4['options']);return db[_0x49c4('0x34')]['find'](_0xfbe179)['then'](handleEntityNotFound(_0xaece5f,null))[_0x49c4('0x19')](respondWithResult(_0xaece5f,null))[_0x49c4('0x4f')](handleError(_0xaece5f,null));};exports[_0x49c4('0x50')]=function(_0x38c480,_0x2884ca){var _0x16949a={'where':{'id':_0x38c480['params']['id']}},_0x35724e={};_0x35724e[_0x49c4('0x39')]=_[_0x49c4('0x3c')](db[_0x49c4('0x34')][_0x49c4('0x35')]);_0x16949a[_0x49c4('0x3f')]=_[_0x49c4('0x3e')](_0x35724e['model'],qs['fields'](_0x38c480[_0x49c4('0x3b')][_0x49c4('0x40')]));_0x16949a[_0x49c4('0x3f')]=_0x16949a[_0x49c4('0x3f')][_0x49c4('0x41')]?_0x16949a[_0x49c4('0x3f')]:_0x35724e[_0x49c4('0x39')];if(_0x38c480['query'][_0x49c4('0x4c')]){_0x16949a[_0x49c4('0x4d')]=[{'all':!![]}];}_0x16949a=_['merge']({},_0x16949a,_0x38c480[_0x49c4('0x4b')]);return db['Trunk'][_0x49c4('0x51')](_0x16949a)[_0x49c4('0x19')](handleEntityNotFound(_0x2884ca,null))[_0x49c4('0x19')](function(_0x2fe89a){if(_0x2fe89a){var _0x845f7e=_0x2fe89a[_0x49c4('0x2d')]({'plain':!![]});_0x845f7e=qs[_0x49c4('0x52')](_0x845f7e,['id',_0x49c4('0x53'),'updatedAt']);_0x38c480[_0x49c4('0x54')]=_[_0x49c4('0x52')](_0x38c480['body'],['id',_0x49c4('0x53'),_0x49c4('0x55')]);return db['Trunk'][_0x49c4('0x56')](_[_0x49c4('0x4a')](_0x845f7e,_0x38c480['body']),{'include':_0x38c480['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0xc43386){var _0x54947d=_0x38c480[_0x49c4('0x57')][_0x49c4('0x2d')]({'plain':!![]});if(!_0x54947d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x54947d[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x5ac9f0=_0xc43386[_0x49c4('0x2d')]({'plain':!![]});var _0x3dcf4c=_0x49c4('0x2e');return db[_0x49c4('0x59')]['find']({'where':{'name':_0x3dcf4c,'userProfileId':_0x54947d[_0x49c4('0x5a')]},'raw':!![]})[_0x49c4('0x19')](function(_0x3cc604){if(_0x3cc604&&_0x3cc604[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x5ac9f0['name'],'resourceId':_0x5ac9f0['id'],'type':_0x3cc604['name'],'sectionId':_0x3cc604['id']},{})['then'](function(){return _0xc43386;});}else{return _0xc43386;}})['catch'](function(_0x302251){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x302251);throw _0x302251;});}return _0xc43386;});}})[_0x49c4('0x19')](respondWithResult(_0x2884ca,0xc9))['catch'](handleError(_0x2884ca,null));};exports['create']=function(_0x340523,_0x109b81,_0x342326){var _0x295ad0;return db[_0x49c4('0x34')][_0x49c4('0x56')](_0x340523[_0x49c4('0x54')],{'raw':!![]})[_0x49c4('0x19')](function(_0x4d49e0){_0x295ad0=_0x4d49e0;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x264902){var _0x1a5d4c=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x13d951=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x2d5f63=ejs[_0x49c4('0x63')](_0x1a5d4c,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x2d5f63);if(_0x295ad0['registry']){var _0x5ec201=ejs[_0x49c4('0x63')](_0x13d951,{'trunks':_0x264902||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x5ec201);}})[_0x49c4('0x19')](function(){return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x56'),{'module':_0x49c4('0x67')});})['then'](function(){var _0x5a14a5=_0x340523['user'][_0x49c4('0x2d')]({'plain':!![]});if(!_0x5a14a5)throw new Error(_0x49c4('0x68'));if(_0x5a14a5[_0x49c4('0x58')]===_0x49c4('0x57')){var _0x118fc4=_0x295ad0[_0x49c4('0x2d')]({'plain':!![]});return db[_0x49c4('0x59')][_0x49c4('0x51')]({'where':{'name':_0x49c4('0x2e'),'userProfileId':_0x5a14a5['userProfileId']},'raw':!![]})[_0x49c4('0x19')](function(_0x10fb84){if(_0x10fb84&&_0x10fb84[_0x49c4('0x5b')]===0x0){return db['UserProfileResource'][_0x49c4('0x56')]({'name':_0x118fc4[_0x49c4('0x31')],'resourceId':_0x118fc4['id'],'type':_0x10fb84[_0x49c4('0x31')],'sectionId':_0x10fb84['id']},{})[_0x49c4('0x19')](function(){return _0x295ad0;});}else{return _0x295ad0;}})[_0x49c4('0x4f')](function(_0x2fd749){logger[_0x49c4('0x20')](_0x49c4('0x5c'),_0x2fd749);throw _0x2fd749;});}return _0x295ad0;})['then'](respondWithResult(_0x109b81,0xc9))[_0x49c4('0x4f')](handleError(_0x109b81,null));};exports[_0x49c4('0x69')]=function(_0x85540f,_0x18e82b,_0x1e948a){var _0x4a204d;return db['Trunk'][_0x49c4('0x51')]({'where':{'id':_0x85540f['params']['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x18e82b,null))['then'](saveUpdates(_0x85540f[_0x49c4('0x54')],null))[_0x49c4('0x19')](function(_0x3b03dd){if(_0x3b03dd){_0x4a204d=_0x3b03dd;return db[_0x49c4('0x34')]['findAll']({'raw':!![]});}})[_0x49c4('0x19')](function(_0x38d7d3){if(_0x38d7d3){var _0x2ceada=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x60')),_0x49c4('0x61'));var _0x46477f=fs[_0x49c4('0x5d')](path['join'](config[_0x49c4('0x5f')],_0x49c4('0x62')),'utf8');var _0x15bee0=ejs['render'](_0x2ceada,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')](_0x49c4('0x65'),_0x15bee0);var _0x1f14a6=ejs[_0x49c4('0x63')](_0x46477f,{'trunks':_0x38d7d3||[]});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_registers.conf',_0x1f14a6);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x69'),{'module':'chan_sip.so'});}return null;})[_0x49c4('0x19')](function(_0x167e41){if(_0x167e41){return _0x4a204d;}})['then'](respondWithResult(_0x18e82b,null))[_0x49c4('0x4f')](handleError(_0x18e82b,null));};exports[_0x49c4('0x2f')]=function(_0x57b137,_0x37fef1,_0x993d00){var _0x25989a;return db[_0x49c4('0x34')]['find']({'where':{'id':_0x57b137[_0x49c4('0x6a')]['id']}})[_0x49c4('0x19')](handleEntityNotFound(_0x37fef1,null))['then'](removeEntity(_0x37fef1,null))[_0x49c4('0x19')](function(){return db['Trunk']['findAll']({'raw':!![]});})[_0x49c4('0x19')](function(_0x507078){var _0x50fd24=fs[_0x49c4('0x5d')](path[_0x49c4('0x5e')](config['root'],_0x49c4('0x60')),'utf8');var _0x578f4b=fs['readFileSync'](path[_0x49c4('0x5e')](config[_0x49c4('0x5f')],_0x49c4('0x62')),_0x49c4('0x61'));var _0x4a5f0b=ejs['render'](_0x50fd24,{'trunks':_0x507078});var _0x348693=ejs['render'](_0x578f4b,{'trunks':_0x507078});fs[_0x49c4('0x64')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4a5f0b);fs[_0x49c4('0x64')](_0x49c4('0x6b'),_0x348693);return respondWithRpcPromise(_0x49c4('0x66'),_0x49c4('0x2f'),{'module':_0x49c4('0x67')});})[_0x49c4('0x4f')](handleError(_0x37fef1,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 566fa52..9ca0372 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 _0x3720=['request-promise','rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','moment','bluebird'];(function(_0x506453,_0x2a31cc){var _0x274aa8=function(_0x30dab5){while(--_0x30dab5){_0x506453['push'](_0x506453['shift']());}};_0x274aa8(++_0x2a31cc);}(_0x3720,0xaf));var _0x0372=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x3720[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x0372('0x0'));var util=require(_0x0372('0x1'));var logger=require(_0x0372('0x2'))('api');var moment=require(_0x0372('0x3'));var BPromise=require(_0x0372('0x4'));var rp=require(_0x0372('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0372('0x6'));var config=require('../../config/environment');var attributes=require(_0x0372('0x7'));module[_0x0372('0x8')]=function(_0x5e41a6,_0xf56d39){return _0x5e41a6[_0x0372('0x9')](_0x0372('0xa'),attributes,{'tableName':_0x0372('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8449=['define','tools_trunks','lodash','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./trunk.attributes','exports'];(function(_0x5e58b2,_0x1b7ed4){var _0x4facd0=function(_0x58d136){while(--_0x58d136){_0x5e58b2['push'](_0x5e58b2['shift']());}};_0x4facd0(++_0x1b7ed4);}(_0x8449,0x199));var _0x9844=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x8449[_0x2aa0e7];return _0x1472c0;};'use strict';var _=require(_0x9844('0x0'));var util=require('util');var logger=require(_0x9844('0x1'))('api');var moment=require(_0x9844('0x2'));var BPromise=require(_0x9844('0x3'));var rp=require(_0x9844('0x4'));var fs=require('fs');var path=require(_0x9844('0x5'));var rimraf=require('rimraf');var config=require(_0x9844('0x6'));var attributes=require(_0x9844('0x7'));module[_0x9844('0x8')]=function(_0x5d955,_0x2376a2){return _0x5d955[_0x9844('0x9')]('Trunk',attributes,{'tableName':_0x9844('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index ec3df0e..1578190 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 _0x5145=['raw','where','attributes','limit','map','include','model','GetTrunk','debug','catch','ShowTrunk','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk','findAll','options'];(function(_0xc838b8,_0x2f4309){var _0x18c0be=function(_0x2d81cd){while(--_0x2d81cd){_0xc838b8['push'](_0xc838b8['shift']());}};_0x18c0be(++_0x2f4309);}(_0x5145,0x93));var _0x5514=function(_0x2ec545,_0x4d250c){_0x2ec545=_0x2ec545-0x0;var _0x524307=_0x5145[_0x2ec545];return _0x524307;};'use strict';var _=require(_0x5514('0x0'));var util=require(_0x5514('0x1'));var moment=require(_0x5514('0x2'));var BPromise=require('bluebird');var rs=require(_0x5514('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5514('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5514('0x5'))(_0x5514('0x6'));var config=require(_0x5514('0x7'));var jayson=require(_0x5514('0x8'));var client=jayson[_0x5514('0x9')][_0x5514('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c848c,_0x2c1da6,_0x2e1554){return new BPromise(function(_0x104855,_0x4ec184){return client[_0x5514('0xb')](_0x1c848c,_0x2e1554)['then'](function(_0x42967e){logger[_0x5514('0xc')](_0x5514('0xd'),_0x2c1da6,_0x5514('0xe'));logger['debug'](_0x5514('0xf'),_0x2c1da6,_0x5514('0xe'),JSON[_0x5514('0x10')](_0x42967e));if(_0x42967e[_0x5514('0x11')]){if(_0x42967e[_0x5514('0x11')][_0x5514('0x12')]===0x1f4){logger['error'](_0x5514('0xd'),_0x2c1da6,_0x42967e[_0x5514('0x11')][_0x5514('0x13')]);return _0x4ec184(_0x42967e[_0x5514('0x11')]['message']);}logger['error'](_0x5514('0xd'),_0x2c1da6,_0x42967e[_0x5514('0x11')][_0x5514('0x13')]);return _0x104855(_0x42967e[_0x5514('0x11')]['message']);}else{logger['info'](_0x5514('0xd'),_0x2c1da6,_0x5514('0xe'));_0x104855(_0x42967e['result'][_0x5514('0x13')]);}})['catch'](function(_0x469e02){logger[_0x5514('0x11')](_0x5514('0xd'),_0x2c1da6,_0x469e02);_0x4ec184(_0x469e02);});});}exports['GetTrunk']=function(_0x1abfcc){var _0x2e1621=this;return new Promise(function(_0x4845ec,_0x270c3c){return db[_0x5514('0x14')][_0x5514('0x15')]({'raw':_0x1abfcc[_0x5514('0x16')]?_0x1abfcc[_0x5514('0x16')][_0x5514('0x17')]===undefined?!![]:![]:!![],'where':_0x1abfcc['options']?_0x1abfcc[_0x5514('0x16')][_0x5514('0x18')]||null:null,'attributes':_0x1abfcc[_0x5514('0x16')]?_0x1abfcc[_0x5514('0x16')][_0x5514('0x19')]||null:null,'limit':_0x1abfcc[_0x5514('0x16')]?_0x1abfcc['options'][_0x5514('0x1a')]||null:null,'include':_0x1abfcc[_0x5514('0x16')]?_0x1abfcc[_0x5514('0x16')]['include']?_[_0x5514('0x1b')](_0x1abfcc[_0x5514('0x16')][_0x5514('0x1c')],function(_0x1f7e26){return{'model':db[_0x1f7e26[_0x5514('0x1d')]],'as':_0x1f7e26['as'],'attributes':_0x1f7e26[_0x5514('0x19')],'include':_0x1f7e26[_0x5514('0x1c')]?_[_0x5514('0x1b')](_0x1f7e26[_0x5514('0x1c')],function(_0x236e38){return{'model':db[_0x236e38[_0x5514('0x1d')]],'as':_0x236e38['as'],'attributes':_0x236e38['attributes'],'include':_0x236e38[_0x5514('0x1c')]?_['map'](_0x236e38[_0x5514('0x1c')],function(_0x3e6684){return{'model':db[_0x3e6684[_0x5514('0x1d')]],'as':_0x3e6684['as'],'attributes':_0x3e6684['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x530fd2){logger[_0x5514('0xc')](_0x5514('0x1e'),_0x1abfcc);logger[_0x5514('0x1f')](_0x5514('0x1e'),_0x1abfcc,JSON[_0x5514('0x10')](_0x530fd2));_0x4845ec(_0x530fd2);})[_0x5514('0x20')](function(_0x4064c5){logger[_0x5514('0x11')]('GetTrunk',_0x4064c5[_0x5514('0x13')],_0x1abfcc);_0x270c3c(_0x2e1621[_0x5514('0x11')](0x1f4,_0x4064c5[_0x5514('0x13')]));});});};exports[_0x5514('0x21')]=function(_0x380086){var _0xfadb4e=this;return new Promise(function(_0x2140e2,_0x444237){return db[_0x5514('0x14')]['find']({'raw':_0x380086[_0x5514('0x16')]?_0x380086[_0x5514('0x16')][_0x5514('0x17')]===undefined?!![]:![]:!![],'where':_0x380086[_0x5514('0x16')]?_0x380086['options'][_0x5514('0x18')]||null:null,'attributes':_0x380086[_0x5514('0x16')]?_0x380086[_0x5514('0x16')]['attributes']||null:null,'include':_0x380086[_0x5514('0x16')]?_0x380086[_0x5514('0x16')][_0x5514('0x1c')]?_[_0x5514('0x1b')](_0x380086[_0x5514('0x16')]['include'],function(_0x4354dc){return{'model':db[_0x4354dc[_0x5514('0x1d')]],'as':_0x4354dc['as'],'attributes':_0x4354dc[_0x5514('0x19')],'include':_0x4354dc[_0x5514('0x1c')]?_[_0x5514('0x1b')](_0x4354dc['include'],function(_0x26cbcf){return{'model':db[_0x26cbcf['model']],'as':_0x26cbcf['as'],'attributes':_0x26cbcf['attributes'],'include':_0x26cbcf['include']?_[_0x5514('0x1b')](_0x26cbcf[_0x5514('0x1c')],function(_0x49b5cc){return{'model':db[_0x49b5cc[_0x5514('0x1d')]],'as':_0x49b5cc['as'],'attributes':_0x49b5cc[_0x5514('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17827f){logger[_0x5514('0xc')](_0x5514('0x21'),_0x380086);logger[_0x5514('0x1f')](_0x5514('0x21'),_0x380086,JSON[_0x5514('0x10')](_0x17827f));_0x2140e2(_0x17827f);})[_0x5514('0x20')](function(_0x3a8c89){logger['error'](_0x5514('0x21'),_0x3a8c89[_0x5514('0x13')],_0x380086);_0x444237(_0xfadb4e['error'](0x1f4,_0x3a8c89[_0x5514('0x13')]));});});}; \ No newline at end of file +var _0x5736=['then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','Trunk','findAll','options','raw','where','limit','include','map','model','catch','GetTrunk','ShowTrunk','attributes','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x5c341a,_0x4bd2bc){var _0x380d68=function(_0x2ff082){while(--_0x2ff082){_0x5c341a['push'](_0x5c341a['shift']());}};_0x380d68(++_0x4bd2bc);}(_0x5736,0x18d));var _0x6573=function(_0x5e2b1e,_0x4a8664){_0x5e2b1e=_0x5e2b1e-0x0;var _0x1aaa32=_0x5736[_0x5e2b1e];return _0x1aaa32;};'use strict';var _=require(_0x6573('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6573('0x1'));var rs=require(_0x6573('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6573('0x3'))['db'];var utils=require(_0x6573('0x4'));var logger=require(_0x6573('0x5'))(_0x6573('0x6'));var config=require(_0x6573('0x7'));var jayson=require(_0x6573('0x8'));var client=jayson[_0x6573('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x95af8,_0x3ff78,_0x33850d){return new BPromise(function(_0x4196ed,_0x17deac){return client[_0x6573('0xa')](_0x95af8,_0x33850d)[_0x6573('0xb')](function(_0x546582){logger[_0x6573('0xc')](_0x6573('0xd'),_0x3ff78,_0x6573('0xe'));logger[_0x6573('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x3ff78,_0x6573('0xe'),JSON[_0x6573('0x10')](_0x546582));if(_0x546582[_0x6573('0x11')]){if(_0x546582[_0x6573('0x11')][_0x6573('0x12')]===0x1f4){logger['error'](_0x6573('0xd'),_0x3ff78,_0x546582['error'][_0x6573('0x13')]);return _0x17deac(_0x546582['error'][_0x6573('0x13')]);}logger['error'](_0x6573('0xd'),_0x3ff78,_0x546582['error'][_0x6573('0x13')]);return _0x4196ed(_0x546582[_0x6573('0x11')][_0x6573('0x13')]);}else{logger[_0x6573('0xc')]('Trunk,\x20%s,\x20%s',_0x3ff78,_0x6573('0xe'));_0x4196ed(_0x546582[_0x6573('0x14')][_0x6573('0x13')]);}})['catch'](function(_0x54fba2){logger[_0x6573('0x11')](_0x6573('0xd'),_0x3ff78,_0x54fba2);_0x17deac(_0x54fba2);});});}exports['GetTrunk']=function(_0x49790c){var _0x231228=this;return new Promise(function(_0x45d65a,_0x1c15d4){return db[_0x6573('0x15')][_0x6573('0x16')]({'raw':_0x49790c['options']?_0x49790c[_0x6573('0x17')][_0x6573('0x18')]===undefined?!![]:![]:!![],'where':_0x49790c[_0x6573('0x17')]?_0x49790c['options'][_0x6573('0x19')]||null:null,'attributes':_0x49790c[_0x6573('0x17')]?_0x49790c[_0x6573('0x17')]['attributes']||null:null,'limit':_0x49790c[_0x6573('0x17')]?_0x49790c['options'][_0x6573('0x1a')]||null:null,'include':_0x49790c['options']?_0x49790c['options'][_0x6573('0x1b')]?_[_0x6573('0x1c')](_0x49790c['options'][_0x6573('0x1b')],function(_0x578018){return{'model':db[_0x578018[_0x6573('0x1d')]],'as':_0x578018['as'],'attributes':_0x578018['attributes'],'include':_0x578018[_0x6573('0x1b')]?_[_0x6573('0x1c')](_0x578018[_0x6573('0x1b')],function(_0x38bdaf){return{'model':db[_0x38bdaf[_0x6573('0x1d')]],'as':_0x38bdaf['as'],'attributes':_0x38bdaf['attributes'],'include':_0x38bdaf[_0x6573('0x1b')]?_[_0x6573('0x1c')](_0x38bdaf[_0x6573('0x1b')],function(_0x17ed27){return{'model':db[_0x17ed27['model']],'as':_0x17ed27['as'],'attributes':_0x17ed27['attributes']};}):[]};}):[]};}):[]:[]})[_0x6573('0xb')](function(_0x129c88){logger[_0x6573('0xc')]('GetTrunk',_0x49790c);logger['debug']('GetTrunk',_0x49790c,JSON['stringify'](_0x129c88));_0x45d65a(_0x129c88);})[_0x6573('0x1e')](function(_0x38a79e){logger['error'](_0x6573('0x1f'),_0x38a79e[_0x6573('0x13')],_0x49790c);_0x1c15d4(_0x231228[_0x6573('0x11')](0x1f4,_0x38a79e[_0x6573('0x13')]));});});};exports[_0x6573('0x20')]=function(_0x6e0133){var _0x1bb3bf=this;return new Promise(function(_0x476827,_0x2c5bd6){return db[_0x6573('0x15')]['find']({'raw':_0x6e0133['options']?_0x6e0133[_0x6573('0x17')][_0x6573('0x18')]===undefined?!![]:![]:!![],'where':_0x6e0133['options']?_0x6e0133['options'][_0x6573('0x19')]||null:null,'attributes':_0x6e0133[_0x6573('0x17')]?_0x6e0133[_0x6573('0x17')][_0x6573('0x21')]||null:null,'include':_0x6e0133[_0x6573('0x17')]?_0x6e0133[_0x6573('0x17')][_0x6573('0x1b')]?_[_0x6573('0x1c')](_0x6e0133['options'][_0x6573('0x1b')],function(_0x368ad4){return{'model':db[_0x368ad4[_0x6573('0x1d')]],'as':_0x368ad4['as'],'attributes':_0x368ad4['attributes'],'include':_0x368ad4['include']?_[_0x6573('0x1c')](_0x368ad4['include'],function(_0x1fd802){return{'model':db[_0x1fd802[_0x6573('0x1d')]],'as':_0x1fd802['as'],'attributes':_0x1fd802[_0x6573('0x21')],'include':_0x1fd802[_0x6573('0x1b')]?_['map'](_0x1fd802['include'],function(_0x2f2db2){return{'model':db[_0x2f2db2['model']],'as':_0x2f2db2['as'],'attributes':_0x2f2db2[_0x6573('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6573('0xb')](function(_0x1547bd){logger['info'](_0x6573('0x20'),_0x6e0133);logger[_0x6573('0xf')](_0x6573('0x20'),_0x6e0133,JSON[_0x6573('0x10')](_0x1547bd));_0x476827(_0x1547bd);})[_0x6573('0x1e')](function(_0x47f0b5){logger[_0x6573('0x11')](_0x6573('0x20'),_0x47f0b5[_0x6573('0x13')],_0x6e0133);_0x2c5bd6(_0x1bb3bf[_0x6573('0x11')](0x1f4,_0x47f0b5[_0x6573('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index a50c633..9cc4f15 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 _0xca13=['/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getAgents','/:id/prefixes','/:id/fax_accounts','getFaxAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','addQueues','diskStorage','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','createApiKey','put','update','delete','removeQueues','removeTeams','/:id/chat_interactions','removeMailInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions'];(function(_0x39284a,_0x21002e){var _0x131688=function(_0xf9e956){while(--_0xf9e956){_0x39284a['push'](_0x39284a['shift']());}};_0x131688(++_0x21002e);}(_0xca13,0x148));var _0x3ca1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca13[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x3ca1('0x0'));var util=require('util');var path=require(_0x3ca1('0x1'));var timeout=require('connect-timeout');var express=require(_0x3ca1('0x2'));var router=express[_0x3ca1('0x3')]();var fs_extra=require(_0x3ca1('0x4'));var auth=require(_0x3ca1('0x5'));var interaction=require(_0x3ca1('0x6'));var config=require(_0x3ca1('0x7'));var controller=require(_0x3ca1('0x8'));router[_0x3ca1('0x9')]('/',auth[_0x3ca1('0xa')](),controller[_0x3ca1('0xb')]);router[_0x3ca1('0x9')]('/describe',auth[_0x3ca1('0xa')](),controller['describe']);router[_0x3ca1('0x9')](_0x3ca1('0xc'),auth['isAuthenticated'](),controller[_0x3ca1('0xd')]);router[_0x3ca1('0x9')](_0x3ca1('0xe'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0xf')]);router[_0x3ca1('0x9')](_0x3ca1('0x10'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x11')]);router[_0x3ca1('0x9')](_0x3ca1('0x12'),controller['getAvatar']);router[_0x3ca1('0x9')](_0x3ca1('0x13'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x14')]);router['get'](_0x3ca1('0x15'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x16')]);router[_0x3ca1('0x9')](_0x3ca1('0x17'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x18')]);router['get'](_0x3ca1('0x19'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x1a')]);router[_0x3ca1('0x9')](_0x3ca1('0x1b'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x1c')]);router[_0x3ca1('0x9')](_0x3ca1('0x1d'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x1e')]);router['get'](_0x3ca1('0x1f'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x20')]);router[_0x3ca1('0x9')](_0x3ca1('0x21'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x22')]);router[_0x3ca1('0x9')](_0x3ca1('0x23'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x24')]);router[_0x3ca1('0x9')](_0x3ca1('0x25'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x26')]);router[_0x3ca1('0x9')](_0x3ca1('0x27'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x28')]);router[_0x3ca1('0x9')](_0x3ca1('0x29'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x2a')]);router[_0x3ca1('0x9')](_0x3ca1('0x2b'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x2c')]);router['get'](_0x3ca1('0x2d'),auth['isAuthenticated'](),controller[_0x3ca1('0x2e')]);router[_0x3ca1('0x9')](_0x3ca1('0x2f'),auth[_0x3ca1('0xa')](),controller['getLists']);router[_0x3ca1('0x9')]('/:id/agents',auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x30')]);router[_0x3ca1('0x9')](_0x3ca1('0x31'),auth[_0x3ca1('0xa')](),controller['getVoicePrefixes']);router[_0x3ca1('0x9')](_0x3ca1('0x32'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x33')]);router['get']('/:id/mail_accounts',auth[_0x3ca1('0xa')](),controller['getMailAccounts']);router[_0x3ca1('0x9')]('/:id/openchannel_accounts',auth[_0x3ca1('0xa')](),controller['getOpenchannelAccounts']);router['get']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x3ca1('0x34')]);router[_0x3ca1('0x9')](_0x3ca1('0x35'),auth['isAuthenticated'](),controller[_0x3ca1('0x36')]);router[_0x3ca1('0x9')](_0x3ca1('0x37'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x38')]);router[_0x3ca1('0x9')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x3ca1('0x39')]);router[_0x3ca1('0x9')](_0x3ca1('0x3a'),auth[_0x3ca1('0xa')](),controller['getScheduledCalls']);router[_0x3ca1('0x9')](_0x3ca1('0x3b'),auth['isAuthenticated'](),controller[_0x3ca1('0x3c')]);router[_0x3ca1('0x3d')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x3ca1('0x3e')]);router[_0x3ca1('0x3d')]('/',auth['isAuthenticated'](),controller[_0x3ca1('0x3f')]);router['post']('/create_many',auth['isAuthenticated'](),controller[_0x3ca1('0x40')]);router[_0x3ca1('0x3d')](_0x3ca1('0x17'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x41')]);var upload=multer({'storage':multer[_0x3ca1('0x42')]({'destination':function(_0x230f5d,_0x3d4773,_0x227266){_0x227266(null,path['join'](config[_0x3ca1('0x43')],_0x3ca1('0x44')));},'filename':function(_0x58b0e5,_0x373c0e,_0x1d67eb){_0x1d67eb(null,util[_0x3ca1('0x45')]('%s-%s',Date[_0x3ca1('0x46')](),_0x373c0e[_0x3ca1('0x47')]));}})});router['post'](_0x3ca1('0x12'),upload[_0x3ca1('0x48')](_0x3ca1('0x49')),controller[_0x3ca1('0x4a')]);router[_0x3ca1('0x3d')](_0x3ca1('0x4b'),auth['isAuthenticated'](),controller['login']);router[_0x3ca1('0x3d')](_0x3ca1('0x4c'),auth['isAuthenticated'](),controller[_0x3ca1('0x4d')]);router[_0x3ca1('0x3d')](_0x3ca1('0x4e'),auth['isAuthenticated'](),controller[_0x3ca1('0x4f')]);router[_0x3ca1('0x3d')](_0x3ca1('0x50'),auth[_0x3ca1('0xa')](),controller['unpause']);router[_0x3ca1('0x3d')]('/:id/teams',auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x51')]);router[_0x3ca1('0x3d')]('/:id/chat_interactions',auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x52')]);router[_0x3ca1('0x3d')](_0x3ca1('0x53'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x54')]);router[_0x3ca1('0x3d')]('/:id/fax_interactions',auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x55')]);router['post'](_0x3ca1('0x56'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x57')]);router[_0x3ca1('0x3d')](_0x3ca1('0x58'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x59')]);router[_0x3ca1('0x3d')](_0x3ca1('0x5a'),auth['isAuthenticated'](),controller[_0x3ca1('0x5b')]);router[_0x3ca1('0x3d')]('/:id/fax_accounts',auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x5c')]);router[_0x3ca1('0x3d')](_0x3ca1('0x5d'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x5e')]);router[_0x3ca1('0x3d')](_0x3ca1('0x5f'),auth[_0x3ca1('0xa')](),controller['addOpenchannelAccounts']);router['post'](_0x3ca1('0x60'),auth['isAuthenticated'](),controller[_0x3ca1('0x61')]);router['post'](_0x3ca1('0x35'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x62')]);router[_0x3ca1('0x3d')](_0x3ca1('0x37'),auth['isAuthenticated'](),controller[_0x3ca1('0x63')]);router['post'](_0x3ca1('0x64'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0x3ca1('0x3d')]('/:id/api_key',auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x65')]);router[_0x3ca1('0x66')](_0x3ca1('0x10'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x67')]);router[_0x3ca1('0x66')]('/:id/password',auth[_0x3ca1('0xa')](),controller['changePassword']);router[_0x3ca1('0x68')](_0x3ca1('0x17'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x69')]);router[_0x3ca1('0x68')]('/:id/teams',auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x6a')]);router[_0x3ca1('0x68')]('/:id',auth[_0x3ca1('0xa')](),controller['destroy']);router[_0x3ca1('0x68')](_0x3ca1('0x6b'),auth[_0x3ca1('0xa')](),controller['removeChatInteractions']);router['delete'](_0x3ca1('0x53'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x6c')]);router[_0x3ca1('0x68')](_0x3ca1('0x6d'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x6e')]);router[_0x3ca1('0x68')](_0x3ca1('0x56'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x6f')]);router['delete'](_0x3ca1('0x58'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x70')]);router[_0x3ca1('0x68')](_0x3ca1('0x5a'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x71')]);router[_0x3ca1('0x68')](_0x3ca1('0x32'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x72')]);router[_0x3ca1('0x68')](_0x3ca1('0x5d'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x73')]);router[_0x3ca1('0x68')](_0x3ca1('0x5f'),auth[_0x3ca1('0xa')](),controller['removeOpenchannelAccounts']);router[_0x3ca1('0x68')](_0x3ca1('0x60'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x74')]);router[_0x3ca1('0x68')](_0x3ca1('0x35'),auth[_0x3ca1('0xa')](),controller['removeChatWebsites']);router[_0x3ca1('0x68')](_0x3ca1('0x37'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x75')]);router[_0x3ca1('0x68')](_0x3ca1('0x64'),auth[_0x3ca1('0xa')](),controller[_0x3ca1('0x76')]);router[_0x3ca1('0x68')](_0x3ca1('0x3b'),auth['isAuthenticated'](),controller[_0x3ca1('0x77')]);module[_0x3ca1('0x78')]=router; \ No newline at end of file +var _0xbf7b=['/:id/pause','pause','unpause','/:id/chat_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/square_projects','createApiKey','put','update','changePassword','delete','removeQueues','/:id','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','/:id/fax_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','/:id/whatsapp_accounts','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','index','describe','/whoami','isAuthenticated','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout'];(function(_0x1a58b3,_0x2e191e){var _0xc153b3=function(_0x2fd92e){while(--_0x2fd92e){_0x1a58b3['push'](_0x1a58b3['shift']());}};_0xc153b3(++_0x2e191e);}(_0xbf7b,0x1f1));var _0xbbf7=function(_0x2b8473,_0x3bc93c){_0x2b8473=_0x2b8473-0x0;var _0x302c7c=_0xbf7b[_0x2b8473];return _0x302c7c;};'use strict';var multer=require(_0xbbf7('0x0'));var util=require(_0xbbf7('0x1'));var path=require(_0xbbf7('0x2'));var timeout=require(_0xbbf7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbbf7('0x4'));var auth=require(_0xbbf7('0x5'));var interaction=require(_0xbbf7('0x6'));var config=require('../../config/environment');var controller=require(_0xbbf7('0x7'));router[_0xbbf7('0x8')]('/',auth['isAuthenticated'](),controller[_0xbbf7('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xbbf7('0xa')]);router[_0xbbf7('0x8')](_0xbbf7('0xb'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0xd')]);router[_0xbbf7('0x8')](_0xbbf7('0xe'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0xf')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xbbf7('0x10')]);router[_0xbbf7('0x8')](_0xbbf7('0x11'),controller[_0xbbf7('0x12')]);router[_0xbbf7('0x8')]('/:id/open_tabs',auth[_0xbbf7('0xc')](),controller['getOpenTabs']);router['get'](_0xbbf7('0x13'),auth[_0xbbf7('0xc')](),controller['getContacts']);router[_0xbbf7('0x8')](_0xbbf7('0x14'),auth[_0xbbf7('0xc')](),controller['getQueues']);router[_0xbbf7('0x8')](_0xbbf7('0x15'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x16')]);router[_0xbbf7('0x8')](_0xbbf7('0x17'),auth['isAuthenticated'](),controller[_0xbbf7('0x18')]);router['get'](_0xbbf7('0x19'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x1a')]);router[_0xbbf7('0x8')](_0xbbf7('0x1b'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x1c')]);router['get'](_0xbbf7('0x1d'),auth[_0xbbf7('0xc')](),controller['getChatInteractions']);router[_0xbbf7('0x8')](_0xbbf7('0x1e'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x1f')]);router[_0xbbf7('0x8')](_0xbbf7('0x20'),auth['isAuthenticated'](),controller[_0xbbf7('0x21')]);router[_0xbbf7('0x8')](_0xbbf7('0x22'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x23')]);router[_0xbbf7('0x8')](_0xbbf7('0x24'),auth[_0xbbf7('0xc')](),controller['getFaxInteractions']);router['get'](_0xbbf7('0x25'),auth[_0xbbf7('0xc')](),controller['getWhatsappInteractions']);router['get'](_0xbbf7('0x26'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x27')]);router['get'](_0xbbf7('0x28'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x29')]);router['get'](_0xbbf7('0x2a'),auth[_0xbbf7('0xc')](),controller['getAgents']);router[_0xbbf7('0x8')](_0xbbf7('0x2b'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x2c')]);router[_0xbbf7('0x8')](_0xbbf7('0x2d'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x2e')]);router[_0xbbf7('0x8')]('/:id/mail_accounts',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x2f')]);router[_0xbbf7('0x8')](_0xbbf7('0x30'),auth[_0xbbf7('0xc')](),controller['getOpenchannelAccounts']);router[_0xbbf7('0x8')](_0xbbf7('0x31'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0xbbf7('0x8')](_0xbbf7('0x32'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x33')]);router[_0xbbf7('0x8')]('/:id/whatsapp_accounts',auth[_0xbbf7('0xc')](),controller['getWhatsappAccounts']);router[_0xbbf7('0x8')]('/:id/square_projects',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x34')]);router['get'](_0xbbf7('0x35'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x36')]);router[_0xbbf7('0x8')](_0xbbf7('0x37'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x38')]);router[_0xbbf7('0x39')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xbbf7('0x3a')]);router[_0xbbf7('0x39')]('/',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x3b')]);router[_0xbbf7('0x39')](_0xbbf7('0x3c'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x3d')]);router['post']('/:id/queues',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x3e')]);var upload=multer({'storage':multer[_0xbbf7('0x3f')]({'destination':function(_0x8ee238,_0x1e040c,_0x4abdd9){_0x4abdd9(null,path[_0xbbf7('0x40')](config[_0xbbf7('0x41')],_0xbbf7('0x42')));},'filename':function(_0x3703bd,_0x5af1ed,_0x28891a){_0x28891a(null,util[_0xbbf7('0x43')](_0xbbf7('0x44'),Date[_0xbbf7('0x45')](),_0x5af1ed[_0xbbf7('0x46')]));}})});router[_0xbbf7('0x39')]('/:id/avatar',upload[_0xbbf7('0x47')](_0xbbf7('0x48')),controller[_0xbbf7('0x49')]);router[_0xbbf7('0x39')](_0xbbf7('0x4a'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x4b')]);router[_0xbbf7('0x39')](_0xbbf7('0x4c'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x4d')]);router[_0xbbf7('0x39')](_0xbbf7('0x4e'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x4f')]);router[_0xbbf7('0x39')]('/:id/unpause',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x50')]);router['post']('/:id/teams',auth[_0xbbf7('0xc')](),controller['addTeams']);router[_0xbbf7('0x39')](_0xbbf7('0x51'),auth['isAuthenticated'](),controller['addChatInteractions']);router['post']('/:id/mail_interactions',auth[_0xbbf7('0xc')](),controller['addMailInteractions']);router[_0xbbf7('0x39')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xbbf7('0x52')]);router['post'](_0xbbf7('0x53'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x54')]);router[_0xbbf7('0x39')]('/:id/openchannel_interactions',auth[_0xbbf7('0xc')](),controller['addOpenchannelInteractions']);router[_0xbbf7('0x39')]('/:id/whatsapp_interactions',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x55')]);router[_0xbbf7('0x39')]('/:id/fax_accounts',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x56')]);router[_0xbbf7('0x39')](_0xbbf7('0x57'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0xbbf7('0x39')](_0xbbf7('0x30'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x58')]);router['post']('/:id/sms_accounts',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x59')]);router['post'](_0xbbf7('0x32'),auth['isAuthenticated'](),controller[_0xbbf7('0x5a')]);router['post']('/:id/whatsapp_accounts',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x5b')]);router[_0xbbf7('0x39')](_0xbbf7('0x5c'),auth['isAuthenticated'](),controller['addSquareProjects']);router[_0xbbf7('0x39')](_0xbbf7('0x37'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x5d')]);router[_0xbbf7('0x5e')]('/:id',auth['isAuthenticated'](),controller[_0xbbf7('0x5f')]);router[_0xbbf7('0x5e')]('/:id/password',auth['isAuthenticated'](),controller[_0xbbf7('0x60')]);router[_0xbbf7('0x61')](_0xbbf7('0x14'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x62')]);router[_0xbbf7('0x61')]('/:id/teams',auth[_0xbbf7('0xc')](),controller['removeTeams']);router[_0xbbf7('0x61')](_0xbbf7('0x63'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x64')]);router['delete']('/:id/chat_interactions',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x65')]);router[_0xbbf7('0x61')](_0xbbf7('0x66'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x67')]);router[_0xbbf7('0x61')](_0xbbf7('0x68'),auth[_0xbbf7('0xc')](),controller['removeFaxInteractions']);router['delete'](_0xbbf7('0x53'),auth[_0xbbf7('0xc')](),controller['removeSmsInteractions']);router[_0xbbf7('0x61')]('/:id/openchannel_interactions',auth[_0xbbf7('0xc')](),controller['removeOpenchannelInteractions']);router['delete']('/:id/whatsapp_interactions',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x69')]);router[_0xbbf7('0x61')](_0xbbf7('0x2d'),auth['isAuthenticated'](),controller[_0xbbf7('0x6a')]);router[_0xbbf7('0x61')](_0xbbf7('0x57'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x6b')]);router[_0xbbf7('0x61')]('/:id/openchannel_accounts',auth[_0xbbf7('0xc')](),controller['removeOpenchannelAccounts']);router[_0xbbf7('0x61')](_0xbbf7('0x31'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x6c')]);router['delete']('/:id/chat_websites',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x6d')]);router[_0xbbf7('0x61')](_0xbbf7('0x6e'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x6f')]);router[_0xbbf7('0x61')]('/:id/square_projects',auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x70')]);router[_0xbbf7('0x61')](_0xbbf7('0x37'),auth[_0xbbf7('0xc')](),controller[_0xbbf7('0x71')]);module[_0xbbf7('0x72')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 3def105..2a0cef7 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 _0x0f9f=['name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','admin','user','agent','telephone','local','accountcode','callerid','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','ENUM','friend','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','update','outgoing','yes','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','always','accept','refuse','originate','uac','uas','fingerprint','certificate','active','passive','nonat','TEXT','showWebBar','get','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','dtlscertfile','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','UNSIGNED','sequelize','moment','util','lodash','exports','STRING'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0x0f9f,0xae));var _0xf0f9=function(_0x5e33f6,_0x2e18e6){_0x5e33f6=_0x5e33f6-0x0;var _0x20cb0f=_0x0f9f[_0x5e33f6];return _0x20cb0f;};'use strict';var Sequelize=require(_0xf0f9('0x0'));var moment=require(_0xf0f9('0x1'));var util=require(_0xf0f9('0x2'));var _=require(_0xf0f9('0x3'));module[_0xf0f9('0x4')]={'name':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':![],'unique':_0xf0f9('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x672fab){this[_0xf0f9('0x7')](_0xf0f9('0x6'),_0x672fab);this[_0xf0f9('0x7')]('defaultuser',_0x672fab);},'comment':_0xf0f9('0x8')},'fullname':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':![],'set':function(_0x53d1e7){this[_0xf0f9('0x7')](_0xf0f9('0x9'),_0x53d1e7);this[_0xf0f9('0x7')]('callerid',util[_0xf0f9('0xa')](_0xf0f9('0xb'),_0x53d1e7,this['getDataValue'](_0xf0f9('0xc'))));}},'alias':{'type':Sequelize[_0xf0f9('0x5')]},'email':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':![],'unique':_0xf0f9('0xd'),'validate':{'isEmail':!![]},'set':function(_0x2f446e){if(_0x2f446e){this[_0xf0f9('0x7')](_0xf0f9('0xd'),_0x2f446e[_0xf0f9('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0xf0f9('0xf'),_0xf0f9('0x10'),_0xf0f9('0x11'),_0xf0f9('0x12')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xf0f9('0x5')],'defaultValue':_0xf0f9('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xf0f9('0xc'),'set':function(_0x519adf){this['setDataValue'](_0xf0f9('0xc'),_0x519adf);this['setDataValue'](_0xf0f9('0x14'),_0x519adf);this['setDataValue'](_0xf0f9('0x15'),util[_0xf0f9('0xa')](_0xf0f9('0xb'),this[_0xf0f9('0x16')](_0xf0f9('0x9')),_0x519adf));}},'salt':{'type':Sequelize[_0xf0f9('0x5')]},'phone':{'type':Sequelize[_0xf0f9('0x5')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xf0f9('0x5')]},'zipcode':{'type':Sequelize[_0xf0f9('0x5')]},'userpic':{'type':Sequelize[_0xf0f9('0x5')]},'city':{'type':Sequelize[_0xf0f9('0x5')]},'country':{'type':Sequelize[_0xf0f9('0x5')]},'online':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xf0f9('0x18')]},'voicePause':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xf0f9('0x5')],'defaultValue':_0xf0f9('0x19')},'lastPauseAt':{'type':Sequelize[_0xf0f9('0x18')]},'chatCapacity':{'type':Sequelize[_0xf0f9('0x1a')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xf0f9('0x1a')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xf0f9('0x1a')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xf0f9('0x1a')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xf0f9('0x1a')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xf0f9('0x1a')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xf0f9('0x1a')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xf0f9('0x1a')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x1c'),_0xf0f9('0x10'),'peer'),'allowNull':!![],'defaultValue':_0xf0f9('0x1c')},'context':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xf0f9('0x1b')]('ALLOWED_NOT_SCREENED',_0xf0f9('0x1d'),_0xf0f9('0x1e'),_0xf0f9('0x1f'),_0xf0f9('0x20'),_0xf0f9('0x21'),_0xf0f9('0x22'),_0xf0f9('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x4a0953){this[_0xf0f9('0x7')](_0xf0f9('0x24'),_0x4a0953?_0x4a0953[_0xf0f9('0x25')](','):null);},'get':function(){return this[_0xf0f9('0x16')](_0xf0f9('0x24'))?this[_0xf0f9('0x16')](_0xf0f9('0x24'))['split'](','):null;},'comment':_0xf0f9('0x26')},'dtmfmode':{'type':Sequelize['ENUM'](_0xf0f9('0x27'),_0xf0f9('0x28'),_0xf0f9('0x29'),'inband',_0xf0f9('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xf0f9('0x1b')]('yes','no','nonat',_0xf0f9('0x2b'),_0xf0f9('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x305e67){this[_0xf0f9('0x7')](_0xf0f9('0x2e'),_0x305e67?_0x305e67['join'](','):null);},'get':function(){return this['getDataValue'](_0xf0f9('0x2e'))?this['getDataValue'](_0xf0f9('0x2e'))[_0xf0f9('0x2f')](','):null;},'comment':_0xf0f9('0x30')},'callgroup':{'type':Sequelize[_0xf0f9('0x5')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xf0f9('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xf0f9('0x5')]},'language':{'type':Sequelize[_0xf0f9('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf0f9('0x5')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf0f9('0x31'),'set':function(_0x458810){this[_0xf0f9('0x7')](_0xf0f9('0x32'),_0x458810?_0x458810[_0xf0f9('0x25')](';'):_0xf0f9('0x31'));},'get':function(){return this[_0xf0f9('0x16')]('allow')?this[_0xf0f9('0x16')](_0xf0f9('0x32'))[_0xf0f9('0x2f')](';'):null;},'comment':_0xf0f9('0x33')},'autoframing':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x2a2745){this['setDataValue'](_0xf0f9('0x34'),_0x2a2745?_0x2a2745[_0xf0f9('0x25')](','):null);},'get':function(){return this[_0xf0f9('0x16')](_0xf0f9('0x34'))?this[_0xf0f9('0x16')]('insecure')[_0xf0f9('0x2f')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xf0f9('0x1b')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xf0f9('0x1a')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xf0f9('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no',_0xf0f9('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x36'),_0xf0f9('0x37'),_0xf0f9('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xf0f9('0x1a')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xf0f9('0x1a')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x39'),_0xf0f9('0x3a')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xf0f9('0x2d')},'keepalive':{'type':Sequelize[_0xf0f9('0x1a')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xf0f9('0x1a')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xf0f9('0x1a')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xf0f9('0x1a')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xf0f9('0x1a')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xf0f9('0x1a')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xf0f9('0x1a')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xf0f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no',_0xf0f9('0x3b'),_0xf0f9('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xf0f9('0x1a')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x3d'),_0xf0f9('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xf0f9('0x1b')](_0xf0f9('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xf0f9('0x2d'),'no',_0xf0f9('0x3f'),_0xf0f9('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xf0f9('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xf0f9('0x18')]},'passwordResetAt':{'type':Sequelize[_0xf0f9('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xf0f9('0x40')]},'showWebBar':{'type':Sequelize[_0xf0f9('0x1a')],'defaultValue':0x0,'set':function(_0x257969){this[_0xf0f9('0x7')](_0xf0f9('0x41'),_0x257969);var _0x256ca7=this[_0xf0f9('0x42')]({'plain':!![]});switch(_0x257969){case 0x0:case 0x1:var _0x4532f1=_0x256ca7[_0xf0f9('0x24')]?_[_0xf0f9('0x43')](_0x256ca7[_0xf0f9('0x24')])?_0x256ca7[_0xf0f9('0x24')]['join']():_0x256ca7['transport']:_0xf0f9('0x44');if(_0x4532f1===_0xf0f9('0x45')){_0x4532f1='udp';}this['setDataValue'](_0xf0f9('0x24'),_0x4532f1);this['setDataValue'](_0xf0f9('0x46'),'no');this[_0xf0f9('0x7')](_0xf0f9('0x47'),null);this['setDataValue'](_0xf0f9('0x48'),null);this[_0xf0f9('0x7')](_0xf0f9('0x49'),null);this[_0xf0f9('0x7')](_0xf0f9('0x4a'),null);this[_0xf0f9('0x7')](_0xf0f9('0x4b'),null);this['setDataValue'](_0xf0f9('0x4c'),null);this['setDataValue']('dtlscertfile',null);this[_0xf0f9('0x7')](_0xf0f9('0x4d'),null);this[_0xf0f9('0x7')]('rtcp_mux','no');break;case 0x2:this[_0xf0f9('0x7')]('transport',_0xf0f9('0x45'));this[_0xf0f9('0x7')](_0xf0f9('0x46'),_0xf0f9('0x2d'));this['setDataValue'](_0xf0f9('0x47'),_0xf0f9('0x2d'));this[_0xf0f9('0x7')](_0xf0f9('0x48'),_0xf0f9('0x2d'));this[_0xf0f9('0x7')](_0xf0f9('0x49'),_0xf0f9('0x2d'));this[_0xf0f9('0x7')]('dtlsenable','yes');this[_0xf0f9('0x7')](_0xf0f9('0x4b'),'no');this['setDataValue']('dtlssetup','actpass');this[_0xf0f9('0x7')](_0xf0f9('0x4e'),_0x256ca7['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0xf0f9('0x7')](_0xf0f9('0x4d'),_0x256ca7[_0xf0f9('0x4d')]||_0xf0f9('0x4f'));this[_0xf0f9('0x7')](_0xf0f9('0x50'),_0xf0f9('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0xf0f9('0x40')],'set':function(_0x54211d){this[_0xf0f9('0x7')]('permissions',_0x54211d?_0x54211d[_0xf0f9('0x25')](','):[]);},'get':function(){return this[_0xf0f9('0x16')](_0xf0f9('0x51'))?_['map'](this[_0xf0f9('0x16')](_0xf0f9('0x51'))[_0xf0f9('0x2f')](','),function(_0x265b36){return parseInt(_0x265b36,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xf0f9('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xf0f9('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xf0f9('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xf0f9('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xf0f9('0x1b')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xf0f9('0x5')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xf0f9('0x52')],'get':function(){return this['getDataValue'](_0xf0f9('0x53'))?this[_0xf0f9('0x16')](_0xf0f9('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xf0f9('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xf0f9('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x54fe01){if(typeof _0x54fe01===_0xf0f9('0x54')){var _0x3c7879=_0x54fe01==='1'?!![]:_0x54fe01==='0'?![]:_0x54fe01===_0xf0f9('0x55')?!![]:_0x54fe01===_0xf0f9('0x56')?![]:![];this[_0xf0f9('0x7')](_0xf0f9('0x57'),_0x3c7879);}else{this[_0xf0f9('0x7')]('screenrecording',_0x54fe01);}}},'blocked':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':![],'set':function(_0x2c8ca7){this['setDataValue'](_0xf0f9('0x58'),_0x2c8ca7);if(_0x2c8ca7===!![]){this[_0xf0f9('0x7')]('blockedAt',moment());this[_0xf0f9('0x7')]('loginAttempts',0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xf0f9('0x1a')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xf0f9('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf0f9('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xb073=['isArray','encryption','avpf','force_avp','dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','icesupport','dtlssetup','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED','moment','lodash','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','getDataValue','internal','email','toLowerCase','ENUM','admin','telephone','INTEGER','accountcode','format','\x22%s\x22\x20<%s>','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','active','passive','actpass','update','update,nonat','showWebBar','get'];(function(_0x5837d1,_0x4661e0){var _0x43b3b7=function(_0x22c638){while(--_0x22c638){_0x5837d1['push'](_0x5837d1['shift']());}};_0x43b3b7(++_0x4661e0);}(_0xb073,0x187));var _0x3b07=function(_0x2f96a1,_0x42cc63){_0x2f96a1=_0x2f96a1-0x0;var _0x330a43=_0xb073[_0x2f96a1];return _0x330a43;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x3b07('0x0'));var util=require('util');var _=require(_0x3b07('0x1'));module[_0x3b07('0x2')]={'name':{'type':Sequelize[_0x3b07('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3d1733){this[_0x3b07('0x4')](_0x3b07('0x5'),_0x3d1733);this['setDataValue'](_0x3b07('0x6'),_0x3d1733);},'comment':_0x3b07('0x7')},'fullname':{'type':Sequelize[_0x3b07('0x3')],'allowNull':![],'set':function(_0x2c1ac2){this[_0x3b07('0x4')](_0x3b07('0x8'),_0x2c1ac2);this[_0x3b07('0x4')](_0x3b07('0x9'),util['format']('\x22%s\x22\x20<%s>',_0x2c1ac2,this[_0x3b07('0xa')](_0x3b07('0xb'))));}},'alias':{'type':Sequelize[_0x3b07('0x3')]},'email':{'type':Sequelize[_0x3b07('0x3')],'allowNull':![],'unique':_0x3b07('0xc'),'validate':{'isEmail':!![]},'set':function(_0x1ba4b9){if(_0x1ba4b9){this[_0x3b07('0x4')](_0x3b07('0xc'),_0x1ba4b9[_0x3b07('0xd')]());}}},'role':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0xf'),'user','agent',_0x3b07('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0x3b07('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3b07('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x3b07('0x11')](0xb),'allowNull':![],'unique':'internal','set':function(_0x16c296){this[_0x3b07('0x4')](_0x3b07('0xb'),_0x16c296);this[_0x3b07('0x4')](_0x3b07('0x12'),_0x16c296);this[_0x3b07('0x4')](_0x3b07('0x9'),util[_0x3b07('0x13')](_0x3b07('0x14'),this[_0x3b07('0xa')]('fullname'),_0x16c296));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x3b07('0x3')]},'address':{'type':Sequelize[_0x3b07('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x3b07('0x3')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3b07('0x15')]},'voicePause':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x3b07('0x3')],'defaultValue':_0x3b07('0x17')},'lastPauseAt':{'type':Sequelize[_0x3b07('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x3b07('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x3b07('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3b07('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3b07('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x3b07('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3b07('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![],'defaultValue':_0x3b07('0x18')},'ipaddr':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x3b07('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3b07('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x3b07('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x19'),_0x3b07('0x1a'),_0x3b07('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0x3b07('0x1c'),_0x3b07('0x1d'),_0x3b07('0x1e'),_0x3b07('0x1f'),_0x3b07('0x20'),_0x3b07('0x21'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![],'defaultValue':_0x3b07('0x22'),'set':function(_0x2b99ba){this['setDataValue'](_0x3b07('0x23'),_0x2b99ba?_0x2b99ba[_0x3b07('0x24')](','):null);},'get':function(){return this[_0x3b07('0xa')](_0x3b07('0x23'))?this['getDataValue'](_0x3b07('0x23'))[_0x3b07('0x25')](','):null;},'comment':_0x3b07('0x26')},'dtmfmode':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x27'),_0x3b07('0x28'),_0x3b07('0x29'),_0x3b07('0x2a'),_0x3b07('0x2b')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no',_0x3b07('0x2d'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3b07('0x2e'),'set':function(_0x1c47b7){this[_0x3b07('0x4')]('nat',_0x1c47b7?_0x1c47b7[_0x3b07('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x3b07('0x2f'))?this[_0x3b07('0xa')](_0x3b07('0x2f'))[_0x3b07('0x25')](','):null;},'comment':_0x3b07('0x30')},'callgroup':{'type':Sequelize[_0x3b07('0x3')]},'namedcallgroup':{'type':Sequelize[_0x3b07('0x3')]},'pickupgroup':{'type':Sequelize[_0x3b07('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3b07('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3b07('0x3')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3b07('0x31')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x447ec7){this[_0x3b07('0x4')]('allow',_0x447ec7?_0x447ec7[_0x3b07('0x24')](';'):_0x3b07('0x32'));},'get':function(){return this[_0x3b07('0xa')](_0x3b07('0x33'))?this[_0x3b07('0xa')](_0x3b07('0x33'))[_0x3b07('0x25')](';'):null;},'comment':_0x3b07('0x34')},'autoframing':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x528c6e){this[_0x3b07('0x4')](_0x3b07('0x35'),_0x528c6e?_0x528c6e[_0x3b07('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x3b07('0x35'))?this[_0x3b07('0xa')](_0x3b07('0x35'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0x3b07('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no',_0x3b07('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3b07('0xe')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3b07('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![],'defaultValue':_0x3b07('0x37')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x3b07('0x2c')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3b07('0xe')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x3b07('0x2c'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x3b07('0xe')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no',_0x3b07('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x3b07('0xe')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x39'),_0x3b07('0x3a'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3b07('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x3b07('0x3b'),'uas'),'allowNull':!![],'defaultValue':_0x3b07('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![],'defaultValue':_0x3b07('0x2c')},'keepalive':{'type':Sequelize[_0x3b07('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3b07('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3b07('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3b07('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3b07('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3b07('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no',_0x3b07('0x3d'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3b07('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x3b07('0x3e'),_0x3b07('0x3f'),_0x3b07('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no','nonat',_0x3b07('0x41'),_0x3b07('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x3b07('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x3b07('0x15')]},'passwordResetAt':{'type':Sequelize[_0x3b07('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x3b07('0x11')],'defaultValue':0x0,'set':function(_0x5d18ef){this[_0x3b07('0x4')](_0x3b07('0x43'),_0x5d18ef);var _0x4d12e1=this[_0x3b07('0x44')]({'plain':!![]});switch(_0x5d18ef){case 0x0:case 0x1:var _0x2cb01f=_0x4d12e1[_0x3b07('0x23')]?_[_0x3b07('0x45')](_0x4d12e1['transport'])?_0x4d12e1['transport']['join']():_0x4d12e1[_0x3b07('0x23')]:_0x3b07('0x22');if(_0x2cb01f==='wss'){_0x2cb01f=_0x3b07('0x22');}this[_0x3b07('0x4')](_0x3b07('0x23'),_0x2cb01f);this[_0x3b07('0x4')](_0x3b07('0x46'),'no');this[_0x3b07('0x4')](_0x3b07('0x47'),null);this['setDataValue'](_0x3b07('0x48'),null);this[_0x3b07('0x4')]('icesupport',null);this[_0x3b07('0x4')](_0x3b07('0x49'),null);this[_0x3b07('0x4')](_0x3b07('0x4a'),null);this[_0x3b07('0x4')]('dtlssetup',null);this[_0x3b07('0x4')](_0x3b07('0x4b'),null);this['setDataValue'](_0x3b07('0x4c'),null);this[_0x3b07('0x4')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x3b07('0x23'),'wss');this[_0x3b07('0x4')](_0x3b07('0x46'),_0x3b07('0x2c'));this[_0x3b07('0x4')](_0x3b07('0x47'),_0x3b07('0x2c'));this['setDataValue']('force_avp',_0x3b07('0x2c'));this['setDataValue'](_0x3b07('0x4d'),_0x3b07('0x2c'));this[_0x3b07('0x4')]('dtlsenable','yes');this[_0x3b07('0x4')](_0x3b07('0x4a'),'no');this[_0x3b07('0x4')](_0x3b07('0x4e'),'actpass');this[_0x3b07('0x4')](_0x3b07('0x4b'),_0x4d12e1['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0x3b07('0x4')](_0x3b07('0x4c'),_0x4d12e1['dtlsprivatekey']||_0x3b07('0x4f'));this[_0x3b07('0x4')]('rtcp_mux',_0x3b07('0x2c'));break;default:}}},'permissions':{'type':Sequelize[_0x3b07('0x50')],'set':function(_0x45726a){this[_0x3b07('0x4')](_0x3b07('0x51'),_0x45726a?_0x45726a[_0x3b07('0x24')](','):[]);},'get':function(){return this['getDataValue'](_0x3b07('0x51'))?_[_0x3b07('0x52')](this[_0x3b07('0xa')](_0x3b07('0x51'))['split'](','),function(_0x3e8f0e){return parseInt(_0x3e8f0e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3b07('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3b07('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x3b07('0x3')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3b07('0xe')](_0x3b07('0x2c'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3b07('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3b07('0x53')],'get':function(){return this[_0x3b07('0xa')](_0x3b07('0x54'))?this[_0x3b07('0xa')](_0x3b07('0x54')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x3b07('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x3b07('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![],'set':function(_0x12b572){if(typeof _0x12b572===_0x3b07('0x55')){var _0x59e622=_0x12b572==='1'?!![]:_0x12b572==='0'?![]:_0x12b572===_0x3b07('0x56')?!![]:_0x12b572===_0x3b07('0x57')?![]:![];this[_0x3b07('0x4')]('screenrecording',_0x59e622);}else{this[_0x3b07('0x4')](_0x3b07('0x58'),_0x12b572);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5db046){this[_0x3b07('0x4')](_0x3b07('0x59'),_0x5db046);if(_0x5db046===!![]){this[_0x3b07('0x4')](_0x3b07('0x5a'),moment());this['setDataValue']('loginAttempts',0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x3b07('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x3b07('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x3b07('0x11')](0x5)[_0x3b07('0x5b')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3b07('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 9e1f487..7ac270b 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 _0xe605=['updateAttributes','DEFAULT\x20PAUSE','mailPause','faxPause','openchannelPause','smsPause','whatsapppause','pauseType','unpause','manual','set','%s%s','getTeams','addTeams','getVoiceQueues','setDataValue','Voice','Chat','getMailQueues','Mail','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','removeTeams','Team','getChatQueues','getFaxQueues','removeAgent','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$or','$gt','$gte','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','queues','lower','col','toString','asc','desc','substring','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','idle','unavailable','ringing','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','moment','bluebird','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','socket.io-emitter','redis','defaults','localhost','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','destroy','get','admin','user','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','find','name','stack','index','User','rawAttributes','fieldName','type','key','password','query','includeAll','attributes','push','findAll','rows','true','length','chat','sms','dataValues','mail','whatsapp','all','show','params','model','differenceBy','keys','salt','intersection','fields','include','merge','openTabs','openchannel','update','body','role','describe','addContacts','ids','omit','Setting','findById','securePassword','validatePasswordPattern','max','isNil','internal','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','permissions','101','102','103','113','104','105','107','108','100','111','114','115','create','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','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','each','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','capitalize','QueueId','Queue:save','VoiceQueue','voice','format','SIP/%s','UserVoiceQueueRt','upsert','isValidChannel','remove','isArray','emit','Queue:remove','addAvatar','userpic','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','fax','ChatOpenTabs','createdAt','FaxOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','CmContact','filters','sort','where','pick','getContacts','hasOwnProperty','CmList','List','Tag','color','tag','nolimit','getQueues','Queue','order','Unknown\x20role','getVoiceQueuesRt','ChatGroup','options','getGroups','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','SmsInteraction','getSmsInteractions','FaxInteraction','getFaxInteractions','getWhatsappInteractions','WhatsappInteraction','login','phone','mobile','intrf','user:%s','user:forcelogout','connection','remoteAddress','socket','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','LOGININPAUSE','concat','isMiddleware','resolve','logout','pause','QueuePause'];(function(_0x31d6c2,_0x422dcd){var _0x295dd0=function(_0x2b5dd1){while(--_0x2b5dd1){_0x31d6c2['push'](_0x31d6c2['shift']());}};_0x295dd0(++_0x422dcd);}(_0xe605,0x92));var _0x5e60=function(_0x5034c7,_0x48aea8){_0x5034c7=_0x5034c7-0x0;var _0x26b1a=_0xe605[_0x5034c7];return _0x26b1a;};'use strict';var moment=require(_0x5e60('0x0'));var BPromise=require(_0x5e60('0x1'));var util=require('util');var path=require(_0x5e60('0x2'));var fs=require('fs');var _=require(_0x5e60('0x3'));var squel=require(_0x5e60('0x4'));var jayson=require(_0x5e60('0x5'));var Redis=require(_0x5e60('0x6'));var authService=require(_0x5e60('0x7'));var qs=require(_0x5e60('0x8'));var logger=require(_0x5e60('0x9'))(_0x5e60('0xa'));var utils=require(_0x5e60('0xb'));var config=require(_0x5e60('0xc'));var licenseUtil=require(_0x5e60('0xd'));var db=require('../../mysqldb')['db'];var socket=require(_0x5e60('0xe'))(new Redis(config['redis']));require('./user.socket')['register'](socket);config[_0x5e60('0xf')]=_[_0x5e60('0x10')](config[_0x5e60('0xf')],{'host':_0x5e60('0x11'),'port':0x18eb});var client=jayson[_0x5e60('0x12')][_0x5e60('0x13')]({'port':0x232a});var values;function respondWithRpcPromise(_0x56f05a,_0x6ab0ce,_0x527f7b,_0x1d2558){return new BPromise(function(_0x15035f,_0xcf1188){var _0x51e7f6=_0x1d2558||client;return _0x51e7f6[_0x5e60('0x14')](_0x56f05a,_0x527f7b)[_0x5e60('0x15')](function(_0x1f4e14){logger[_0x5e60('0x16')](_0x5e60('0x17'),_0x6ab0ce,_0x5e60('0x18'));logger['debug'](_0x5e60('0x19'),_0x6ab0ce,_0x5e60('0x18'),JSON[_0x5e60('0x1a')](_0x1f4e14));if(_0x1f4e14[_0x5e60('0x1b')]){if(_0x1f4e14['error'][_0x5e60('0x1c')]===0x1f4){logger['error'](_0x5e60('0x17'),_0x6ab0ce,_0x1f4e14[_0x5e60('0x1b')]['message']);return _0xcf1188(_0x1f4e14[_0x5e60('0x1b')][_0x5e60('0x1d')]);}logger[_0x5e60('0x1b')](_0x5e60('0x17'),_0x6ab0ce,_0x1f4e14['error'][_0x5e60('0x1d')]);return _0x15035f(_0x1f4e14[_0x5e60('0x1b')]['message']);}else{logger[_0x5e60('0x16')](_0x5e60('0x17'),_0x6ab0ce,_0x5e60('0x18'));_0x15035f(_0x1f4e14[_0x5e60('0x1e')][_0x5e60('0x1d')]);}})[_0x5e60('0x1f')](function(_0x41294f){logger[_0x5e60('0x1b')](_0x5e60('0x17'),_0x6ab0ce,_0x41294f);_0xcf1188(_0x41294f);});});}function respondWithStatusCode(_0x45f1a6,_0x228f13){_0x228f13=_0x228f13||0xcc;return function(_0x578437){if(_0x578437){return _0x45f1a6[_0x5e60('0x20')](_0x228f13);}return _0x45f1a6['status'](_0x228f13)[_0x5e60('0x21')]();};}function respondWithResult(_0x1a44e5,_0x2b0bae){_0x2b0bae=_0x2b0bae||0xc8;return function(_0x144808){if(_0x144808){return _0x1a44e5[_0x5e60('0x22')](_0x2b0bae)[_0x5e60('0x23')](_0x144808);}};}function respondWithFilteredResult(_0x2636f1,_0x5d2c03){return function(_0x18d527){if(_0x18d527){var _0x7dbdb7=typeof _0x5d2c03[_0x5e60('0x24')]==='undefined'&&typeof _0x5d2c03[_0x5e60('0x25')]===_0x5e60('0x26');var _0x2d8aac=_0x18d527[_0x5e60('0x27')];var _0x4a0dbc=_0x7dbdb7?0x0:_0x5d2c03[_0x5e60('0x24')];var _0x5712f7=_0x7dbdb7?_0x18d527[_0x5e60('0x27')]:_0x5d2c03[_0x5e60('0x24')]+_0x5d2c03['limit'];var _0x46691f;if(_0x5712f7>=_0x2d8aac){_0x5712f7=_0x2d8aac;_0x46691f=0xc8;}else{_0x46691f=0xce;}_0x2636f1[_0x5e60('0x22')](_0x46691f);return _0x2636f1['set'](_0x5e60('0x28'),_0x4a0dbc+'-'+_0x5712f7+'/'+_0x2d8aac)[_0x5e60('0x23')](_0x18d527);}return null;};}function saveUpdates(_0x52c97c){return function(_0x5431a8){if(_0x5431a8){return _0x5431a8['update'](_0x52c97c)[_0x5e60('0x15')](function(_0x235cc7){return _0x235cc7;});}return null;};}function removeEntity(_0x2e8e9e){return function(_0xf661e1){if(_0xf661e1){return _0xf661e1[_0x5e60('0x29')]()['then'](function(){var _0x168ce6=_0xf661e1[_0x5e60('0x2a')]({'plain':!![]});if(_0x168ce6['role']===_0x5e60('0x2b'))return;var _0x48369c=[{'name':'Users','value':_0x5e60('0x2c'),'ignore':!![]},{'name':_0x5e60('0x2d'),'value':_0x5e60('0x2e'),'ignore':![]},{'name':_0x5e60('0x2f'),'value':_0x5e60('0x30'),'ignore':![]}];var _0xbf5b7a=_(_0x48369c)[_0x5e60('0x31')](_0x5e60('0x32'))[_0x5e60('0x33')](_0x5e60('0x34'))['value']();if(_[_0x5e60('0x35')](_0xbf5b7a,_0x168ce6['role'])){return;}var _0x52802c=_[_0x5e60('0x36')](_0x48369c,[_0x5e60('0x34'),_0x168ce6['role']])[_0x5e60('0x37')];return db['UserProfileResource'][_0x5e60('0x29')]({'where':{'type':_0x52802c,'resourceId':_0x168ce6['id']}})[_0x5e60('0x15')](function(){return _0xf661e1;});})[_0x5e60('0x15')](function(){_0x2e8e9e[_0x5e60('0x22')](0xcc)[_0x5e60('0x21')]();});}};}function handleEntityNotFound(_0x23498b){return function(_0x2eaaef){if(!_0x2eaaef){_0x23498b[_0x5e60('0x20')](0x194);}return _0x2eaaef;};}function handleError(_0x5b3aa5,_0x18922f){_0x18922f=_0x18922f||0x1f4;return function(_0x3f744d){logger[_0x5e60('0x1b')](_0x3f744d[_0x5e60('0x38')]);if(_0x3f744d[_0x5e60('0x37')]){delete _0x3f744d[_0x5e60('0x37')];}_0x5b3aa5[_0x5e60('0x22')](_0x18922f)['send'](_0x3f744d);};}exports[_0x5e60('0x39')]=function(_0x18f187,_0x4cba18){var _0x532ab2={},_0x41001c={'count':0x0,'rows':[]};var _0xd67757=_(db[_0x5e60('0x3a')][_0x5e60('0x3b')])[_0x5e60('0x33')](function(_0x4d2cd0){return{'name':_0x4d2cd0[_0x5e60('0x3c')],'type':_0x4d2cd0[_0x5e60('0x3d')][_0x5e60('0x3e')]};})[_0x5e60('0x31')](function(_0x2f4b3e){return!_[_0x5e60('0x35')]([_0x5e60('0x3f'),'salt'],_0x2f4b3e[_0x5e60('0x37')]);})[_0x5e60('0x34')]();_0x532ab2=qs['getOptions'](_0xd67757,_0x18f187);var _0x511cce={'where':_0x532ab2['where']};return db[_0x5e60('0x3a')][_0x5e60('0x27')](_0x511cce)[_0x5e60('0x15')](function(_0x30040a){_0x41001c['count']=_0x30040a;if(_0x18f187[_0x5e60('0x40')][_0x5e60('0x41')]){_0x532ab2['include']=[{'all':!![]}];}if(!_['includes'](_0x532ab2[_0x5e60('0x42')],'id')){_0x532ab2[_0x5e60('0x42')][_0x5e60('0x43')]('id');}return db[_0x5e60('0x3a')][_0x5e60('0x44')](_0x532ab2);})[_0x5e60('0x15')](function(_0x2522d2){_0x41001c[_0x5e60('0x45')]=_0x2522d2;if(_0x18f187[_0x5e60('0x40')]['openTabs']===_0x5e60('0x46')){var _0x2bb154=[];for(var _0x59a2eb=0x0;_0x59a2eb<_0x41001c[_0x5e60('0x45')][_0x5e60('0x47')];_0x59a2eb++){_0x2bb154[_0x5e60('0x43')](get_open_tabs(_0x5e60('0x48'),_0x41001c[_0x5e60('0x45')][_0x59a2eb]['dataValues']));_0x2bb154[_0x5e60('0x43')](get_open_tabs(_0x5e60('0x49'),_0x41001c[_0x5e60('0x45')][_0x59a2eb][_0x5e60('0x4a')]));_0x2bb154['push'](get_open_tabs('fax',_0x41001c['rows'][_0x59a2eb][_0x5e60('0x4a')]));_0x2bb154[_0x5e60('0x43')](get_open_tabs(_0x5e60('0x4b'),_0x41001c[_0x5e60('0x45')][_0x59a2eb][_0x5e60('0x4a')]));_0x2bb154[_0x5e60('0x43')](get_open_tabs('openchannel',_0x41001c[_0x5e60('0x45')][_0x59a2eb][_0x5e60('0x4a')]));_0x2bb154[_0x5e60('0x43')](get_open_tabs(_0x5e60('0x4c'),_0x41001c[_0x5e60('0x45')][_0x59a2eb][_0x5e60('0x4a')]));}return BPromise[_0x5e60('0x4d')](_0x2bb154)['then'](function(_0x24c757){return _0x41001c;});}else{return _0x41001c;}})[_0x5e60('0x15')](respondWithFilteredResult(_0x4cba18,_0x532ab2))[_0x5e60('0x1f')](handleError(_0x4cba18,null));};exports[_0x5e60('0x4e')]=function(_0x4721c8,_0x2d4ced){var _0x2a9353={'raw':![],'where':{'id':_0x4721c8[_0x5e60('0x4f')]['id']}},_0x4470bd={};_0x4470bd[_0x5e60('0x50')]=_[_0x5e60('0x51')](_[_0x5e60('0x52')](db[_0x5e60('0x3a')][_0x5e60('0x3b')]),[_0x5e60('0x3f'),_0x5e60('0x53')]);_0x4470bd[_0x5e60('0x40')]=_[_0x5e60('0x52')](_0x4721c8['query']);_0x4470bd['filters']=_[_0x5e60('0x54')](_0x4470bd['model'],_0x4470bd[_0x5e60('0x40')]);_0x2a9353[_0x5e60('0x42')]=_[_0x5e60('0x54')](_0x4470bd[_0x5e60('0x50')],qs[_0x5e60('0x55')](_0x4721c8[_0x5e60('0x40')]['fields']));_0x2a9353['attributes']=_0x2a9353[_0x5e60('0x42')][_0x5e60('0x47')]?_0x2a9353[_0x5e60('0x42')]:_0x4470bd['model'];if(_0x4721c8['query'][_0x5e60('0x41')]){_0x2a9353[_0x5e60('0x56')]=[{'all':!![]}];}_0x2a9353=_[_0x5e60('0x57')]({},_0x2a9353,_0x4721c8['options']);if(!_[_0x5e60('0x35')](_0x2a9353[_0x5e60('0x42')],'id')){_0x2a9353[_0x5e60('0x42')][_0x5e60('0x43')]('id');}return db[_0x5e60('0x3a')][_0x5e60('0x36')](_0x2a9353)['then'](handleEntityNotFound(_0x2d4ced,null))[_0x5e60('0x15')](function(_0x1cb33b){var _0x4acbe8=[];values=_0x1cb33b;if(_0x4721c8[_0x5e60('0x40')][_0x5e60('0x58')]===_0x5e60('0x46')){_0x4acbe8['push'](get_open_tabs(_0x5e60('0x48'),_0x1cb33b[_0x5e60('0x4a')]));_0x4acbe8['push'](get_open_tabs(_0x5e60('0x49'),_0x1cb33b[_0x5e60('0x4a')]));_0x4acbe8[_0x5e60('0x43')](get_open_tabs(_0x5e60('0x59'),_0x1cb33b['dataValues']));_0x4acbe8[_0x5e60('0x43')](get_open_tabs(_0x5e60('0x4c'),_0x1cb33b['dataValues']));_0x4acbe8[_0x5e60('0x43')](get_open_tabs('fax',_0x1cb33b[_0x5e60('0x4a')]));_0x4acbe8['push'](get_open_tabs(_0x5e60('0x4b'),_0x1cb33b[_0x5e60('0x4a')]));return BPromise['all'](_0x4acbe8);}else{return values;}})[_0x5e60('0x15')](function(_0x4b52d1){return values;})[_0x5e60('0x15')](respondWithResult(_0x2d4ced,null))['catch'](handleError(_0x2d4ced,null));};exports[_0x5e60('0x5a')]=function(_0x5b4daa,_0x1481d0){if(_0x5b4daa[_0x5e60('0x5b')]['id']){delete _0x5b4daa[_0x5e60('0x5b')]['id'];}delete _0x5b4daa[_0x5e60('0x5b')][_0x5e60('0x5c')];return db[_0x5e60('0x3a')][_0x5e60('0x36')]({'where':{'id':_0x5b4daa['params']['id']}})[_0x5e60('0x15')](handleEntityNotFound(_0x1481d0,null))[_0x5e60('0x15')](saveUpdates(_0x5b4daa[_0x5e60('0x5b')],null))[_0x5e60('0x15')](respondWithResult(_0x1481d0,null))[_0x5e60('0x1f')](handleError(_0x1481d0,null));};exports[_0x5e60('0x5d')]=function(_0x4a59bd,_0x5d4717){return db['User'][_0x5e60('0x5d')]()[_0x5e60('0x15')](respondWithResult(_0x5d4717,null))['catch'](handleError(_0x5d4717,null));};exports[_0x5e60('0x5e')]=function(_0x369659,_0x557f74){return db[_0x5e60('0x3a')][_0x5e60('0x36')]({'where':{'id':_0x369659[_0x5e60('0x4f')]['id']}})[_0x5e60('0x15')](handleEntityNotFound(_0x557f74,null))[_0x5e60('0x15')](function(_0xcd2232){if(_0xcd2232){return _0xcd2232[_0x5e60('0x5e')](_0x369659[_0x5e60('0x5b')][_0x5e60('0x5f')],_[_0x5e60('0x60')](_0x369659[_0x5e60('0x5b')],[_0x5e60('0x5f'),'id'])||{});}})[_0x5e60('0x15')](respondWithResult(_0x557f74,null))[_0x5e60('0x1f')](handleError(_0x557f74,null));};function validateUser(_0x3c7eb5){return new BPromise(function(_0x811d78,_0xda4b15){if(_0x3c7eb5['internal'])return _0x811d78(_0x3c7eb5);return db[_0x5e60('0x61')][_0x5e60('0x62')](0x1)[_0x5e60('0x15')](function(_0x56ddd9){if(_0x56ddd9[_0x5e60('0x63')])authService[_0x5e60('0x64')](_0x3c7eb5['password']);db[_0x5e60('0x3a')][_0x5e60('0x65')]('internal')[_0x5e60('0x15')](function(_0x23c80){if(_[_0x5e60('0x66')](_0x23c80)){_0x3c7eb5[_0x5e60('0x67')]=_0x56ddd9[_0x5e60('0x68')]||0x1;return;}if(_[_0x5e60('0x66')](_0x56ddd9[_0x5e60('0x68')])||_0x56ddd9[_0x5e60('0x68')]===_0x23c80){_0x3c7eb5[_0x5e60('0x67')]=_0x23c80+0x1;return;}if(_0x56ddd9['min_internal']>_0x23c80){_0x3c7eb5[_0x5e60('0x67')]=_0x56ddd9[_0x5e60('0x68')];return;}return db[_0x5e60('0x69')]['query'](_0x5e60('0x6a'),{'type':db[_0x5e60('0x69')][_0x5e60('0x6b')][_0x5e60('0x6c')]})[_0x5e60('0x15')](function(_0x559f8c){if(_0x559f8c&&_0x559f8c[_0x5e60('0x47')]){for(var _0x213c7e=0x0,_0x3463a7=_0x559f8c['length'];_0x213c7e<_0x3463a7&&_['isNil'](_0x3c7eb5[_0x5e60('0x67')]);_0x213c7e++){if(_0x56ddd9[_0x5e60('0x68')]<=_0x559f8c[_0x213c7e][_0x5e60('0x6d')]){_0x3c7eb5[_0x5e60('0x67')]=_0x559f8c[_0x213c7e][_0x5e60('0x6d')];}else if(_0x56ddd9[_0x5e60('0x68')]>_0x559f8c[_0x213c7e][_0x5e60('0x6d')]&&_0x56ddd9['min_internal']<=_0x559f8c[_0x213c7e]['to']){_0x3c7eb5[_0x5e60('0x67')]=_0x56ddd9[_0x5e60('0x68')];}}}if(_[_0x5e60('0x66')](_0x3c7eb5['internal'])){_0x3c7eb5['internal']=_0x23c80+0x1;}return _0x811d78(_0x3c7eb5);});});})[_0x5e60('0x1f')](function(_0xc7e47c){_0xda4b15(_0xc7e47c);});});}function updateUser(_0x3e8e56){return new BPromise(function(_0x574f2b,_0x4aa61e){try{if(_0x3e8e56[_0x5e60('0x6e')]){_0x3e8e56[_0x5e60('0x6f')]=_0x3e8e56[_0x5e60('0x67')];_0x3e8e56[_0x5e60('0x70')]={'mailbox':_0x3e8e56[_0x5e60('0x67')],'password':_0x3e8e56[_0x5e60('0x3f')],'fullname':_0x3e8e56['fullname'],'email':_0x3e8e56[_0x5e60('0x71')]};}if(_0x3e8e56[_0x5e60('0x5c')]===_0x5e60('0x2e')){if(!_0x3e8e56[_0x5e60('0x72')])_0x3e8e56[_0x5e60('0x72')]=[_0x5e60('0x73'),_0x5e60('0x74'),_0x5e60('0x75'),_0x5e60('0x76'),'110',_0x5e60('0x77'),_0x5e60('0x78'),'106',_0x5e60('0x79'),_0x5e60('0x7a'),'109',_0x5e60('0x7b'),_0x5e60('0x7c'),_0x5e60('0x7d'),_0x5e60('0x7e')];}_0x574f2b(_0x3e8e56);}catch(_0x2889f3){_0x4aa61e(_0x2889f3);}});}exports[_0x5e60('0x7f')]=function(_0x5d9784,_0x2dde78){if(_0x5d9784[_0x5e60('0x2c')][_0x5e60('0x5c')]===_0x5e60('0x2e'))throw new Error(_0x5e60('0x80'));if(_0x5d9784[_0x5e60('0x5b')][_0x5e60('0x5c')]===_0x5e60('0x2c')&&_0x5d9784[_0x5e60('0x2c')]['role']!==_0x5e60('0x2b')){throw new Error(_0x5e60('0x81'));}if(_0x5d9784[_0x5e60('0x5b')][_0x5e60('0x5c')]===_0x5e60('0x2b')&&_0x5d9784[_0x5e60('0x2c')][_0x5e60('0x5c')]!==_0x5e60('0x2b')){throw new Error(_0x5e60('0x82'));}return licenseUtil[_0x5e60('0x83')]([_0x5d9784['body']])['then'](function(){return validateUser(_0x5d9784['body']);})[_0x5e60('0x15')](function(_0x43fadd){return updateUser(_0x43fadd)[_0x5e60('0x15')](function(_0x1a911a){if(_0x1a911a[_0x5e60('0x5c')]===_0x5e60('0x2b')){_0x1a911a[_0x5e60('0x84')]=_0x5d9784[_0x5e60('0x2c')][_0x5e60('0x84')];delete _0x1a911a['userProfileId'];}return _0x1a911a;});})[_0x5e60('0x15')](function(_0x42ac7c){return db[_0x5e60('0x3a')]['create'](_0x42ac7c,{'include':[{'model':db[_0x5e60('0x70')],'as':'VoiceMail'}]});})['then'](function(_0x5c1aa2){if(_0x5d9784[_0x5e60('0x5b')][_0x5e60('0x5c')]===_0x5e60('0x2c'))return _0x5c1aa2;if(_0x5d9784[_0x5e60('0x2c')][_0x5e60('0x5c')]!==_0x5e60('0x2c'))return _0x5c1aa2;return db[_0x5e60('0x85')][_0x5e60('0x36')]({'where':{'name':_0x5c1aa2[_0x5e60('0x5c')]==='agent'?_0x5e60('0x2d'):_0x5e60('0x2f'),'userProfileId':_0x5d9784[_0x5e60('0x2c')][_0x5e60('0x86')]},'raw':!![]})[_0x5e60('0x15')](function(_0x1b4a17){if(!_0x1b4a17||_0x1b4a17[_0x5e60('0x87')]!=0x0)return _0x5c1aa2;return db[_0x5e60('0x88')][_0x5e60('0x7f')]({'name':_0x5c1aa2[_0x5e60('0x37')],'resourceId':_0x5c1aa2['id'],'type':_0x1b4a17[_0x5e60('0x37')],'sectionId':_0x1b4a17['id']},{})[_0x5e60('0x15')](function(){return _0x5c1aa2;});})['catch'](function(_0x1b39c7){logger[_0x5e60('0x1b')](_0x5e60('0x89'),_0x1b39c7);throw _0x1b39c7;});})[_0x5e60('0x15')](respondWithResult(_0x2dde78,0xc9))[_0x5e60('0x1f')](handleError(_0x2dde78,null));};exports[_0x5e60('0x8a')]=function(_0x329409,_0x3b0062){var _0xcea76e=_0x329409[_0x5e60('0x5b')];var _0x44fe9e=[];if(_0x329409[_0x5e60('0x2c')][_0x5e60('0x5c')]===_0x5e60('0x2e'))throw new Error(_0x5e60('0x80'));if(_[_0x5e60('0x8b')](_0xcea76e,[_0x5e60('0x5c'),_0x5e60('0x2c')])&&_0x329409[_0x5e60('0x2c')][_0x5e60('0x5c')]!=='admin'){throw new Error(_0x5e60('0x81'));}if(_[_0x5e60('0x8b')](_0xcea76e,[_0x5e60('0x5c'),'admin'])&&_0x329409['user'][_0x5e60('0x5c')]!==_0x5e60('0x2b')){throw new Error(_0x5e60('0x8c'));}return licenseUtil[_0x5e60('0x83')](_0xcea76e)[_0x5e60('0x15')](function(){return validateUser(_0xcea76e[0x0]);})[_0x5e60('0x15')](function(){for(var _0x2d1b73=0x1;_0x2d1b73<_0xcea76e[_0x5e60('0x47')];_0x2d1b73++){var _0x3d08ac=_0xcea76e[_0x2d1b73-0x1][_0x5e60('0x67')];if(!_0xcea76e[_0x2d1b73][_0x5e60('0x67')])_0xcea76e[_0x2d1b73][_0x5e60('0x67')]=_0x3d08ac+0x1;_0x44fe9e[_0x5e60('0x43')](validateUser(_0xcea76e[_0x2d1b73]));}return BPromise[_0x5e60('0x4d')](_0x44fe9e);})[_0x5e60('0x15')](function(){_0x44fe9e=[];for(var _0x23036a=0x0;_0x23036a<_0xcea76e[_0x5e60('0x47')];_0x23036a++){_0x44fe9e['push'](updateUser(_0xcea76e[_0x23036a]));}return BPromise[_0x5e60('0x4d')](_0x44fe9e);})[_0x5e60('0x15')](function(){return BPromise[_0x5e60('0x8d')](_0xcea76e,function(_0x2ba733){return db['User'][_0x5e60('0x7f')](_0x2ba733,{'include':[{'model':db[_0x5e60('0x70')],'as':_0x5e60('0x70')}]})['then'](function(_0x502793){_0x2ba733['id']=_0x502793['id'];return _0x2ba733;});});})[_0x5e60('0x15')](function(_0x2960a2){if(_0x329409[_0x5e60('0x5b')][_0x5e60('0x5c')]==='user')return _0x2960a2;if(_0x329409[_0x5e60('0x2c')][_0x5e60('0x5c')]!=='user')return _0x2960a2;var _0x47d623=_[_0x5e60('0x8b')](_0x2960a2,function(_0x1265fb){return _0x1265fb[_0x5e60('0x5c')]==='agent'||_0x1265fb['role']==='telephone';});if(!_0x47d623)return _0x2960a2;return db[_0x5e60('0x85')][_0x5e60('0x44')]({'where':{'name':{'$or':[_0x5e60('0x2d'),_0x5e60('0x2f')]},'userProfileId':_0x329409['user'][_0x5e60('0x86')]},'raw':!![]})[_0x5e60('0x15')](function(_0xd0cb3f){if(_[_0x5e60('0x8e')](_0xd0cb3f)||!_[_0x5e60('0x8b')](_0xd0cb3f,[_0x5e60('0x87'),0x0]))return _0x2960a2;_0x44fe9e=[];var _0x558707=_(_0xd0cb3f)[_0x5e60('0x33')](function(_0x514dcd){if(_0x514dcd[_0x5e60('0x87')]===0x1)return;return _0x514dcd['name']===_0x5e60('0x2d')?'agent':_0x5e60('0x30');})[_0x5e60('0x8f')]()[_0x5e60('0x34')]();for(var _0x4176bc=0x0;_0x4176bc<_0x2960a2[_0x5e60('0x47')];_0x4176bc++){if(!_[_0x5e60('0x35')](_0x558707,_0x2960a2[_0x4176bc][_0x5e60('0x5c')]))return;var _0x297981=_0x2960a2[_0x4176bc][_0x5e60('0x5c')]===_0x5e60('0x2e')?'Agents':_0x5e60('0x2f');_0x44fe9e['push'](db[_0x5e60('0x88')][_0x5e60('0x7f')]({'name':_0x2960a2[_0x4176bc]['name'],'resourceId':_0x2960a2[_0x4176bc]['id'],'type':_0x297981,'sectionId':_['find'](_0xd0cb3f,[_0x5e60('0x37'),_0x297981])['id']},{}));}return BPromise[_0x5e60('0x4d')](_0x44fe9e);});})[_0x5e60('0x15')](respondWithResult(_0x3b0062,0xc9))['catch'](handleError(_0x3b0062,null));};exports[_0x5e60('0x90')]=function(_0x44e210,_0x36d9ed){if(_0x44e210[_0x5e60('0x5b')]['id']){delete _0x44e210[_0x5e60('0x5b')]['id'];}return db[_0x5e60('0x3a')][_0x5e60('0x36')]({'where':{'id':_0x44e210[_0x5e60('0x4f')]['id']}})[_0x5e60('0x15')](function(_0x2a7f29){if(!_0x2a7f29)return null;if(_0x2a7f29['id']===_0x44e210['user']['id']){if(!_0x44e210[_0x5e60('0x5b')][_0x5e60('0x91')]||!_0x44e210[_0x5e60('0x5b')][_0x5e60('0x92')]){throw new db[(_0x5e60('0x93'))][(_0x5e60('0x94'))](_0x5e60('0x95'));}if(!_0x2a7f29[_0x5e60('0x96')](_0x44e210[_0x5e60('0x5b')][_0x5e60('0x91')])){throw new db['Sequelize'][(_0x5e60('0x94'))]('Wrong\x20credentials');}if(_0x44e210['body'][_0x5e60('0x91')]===_0x44e210['body'][_0x5e60('0x92')]){throw new db[(_0x5e60('0x93'))][(_0x5e60('0x94'))](_0x5e60('0x97'));}}else if(_0x44e210[_0x5e60('0x2c')][_0x5e60('0x5c')]===_0x5e60('0x2b')){if(!_0x44e210[_0x5e60('0x5b')][_0x5e60('0x92')]){throw new db['Sequelize'][(_0x5e60('0x94'))](_0x5e60('0x98'));}}else if(_0x44e210[_0x5e60('0x2c')]['role']===_0x5e60('0x2c')){if(!_0x44e210['body']['newPassword']){throw new db[(_0x5e60('0x93'))][(_0x5e60('0x94'))](_0x5e60('0x98'));}if(_0x2a7f29[_0x5e60('0x5c')]!==_0x5e60('0x2e')){throw new db[(_0x5e60('0x93'))]['ValidationError'](_0x5e60('0x80'));}}else{throw new db[(_0x5e60('0x93'))][(_0x5e60('0x94'))](_0x5e60('0x80'));}return _0x2a7f29;})[_0x5e60('0x15')](handleEntityNotFound(_0x36d9ed,null))['then'](function(_0x24cb27){return db[_0x5e60('0x61')][_0x5e60('0x99')]({'attributes':['id','securePassword',_0x5e60('0x9a'),_0x5e60('0x9b')]})[_0x5e60('0x15')](function(_0xd6e730){if(_0xd6e730[_0x5e60('0x63')])authService['validatePasswordPattern'](_0x44e210[_0x5e60('0x5b')]['newPassword']);if(!_0xd6e730['enforcePasswordHistory']||!_0x24cb27[_0x5e60('0x9c')])return _0x24cb27;authService[_0x5e60('0x9d')](_0x44e210['body'][_0x5e60('0x92')],_0x24cb27[_0x5e60('0x9c')],_0xd6e730[_0x5e60('0x9b')]);return _0x24cb27;})[_0x5e60('0x15')](saveUpdates({'password':_0x44e210[_0x5e60('0x5b')][_0x5e60('0x92')],'passwordResetAt':_0x44e210[_0x5e60('0x2c')]['id']==_0x44e210['params']['id']?moment():null,'previousPasswords':authService[_0x5e60('0x9e')](_0x44e210['body'][_0x5e60('0x92')],_0x24cb27[_0x5e60('0x9c')])},null));})[_0x5e60('0x15')](respondWithResult(_0x36d9ed,null))[_0x5e60('0x1f')](handleError(_0x36d9ed,null));};exports[_0x5e60('0x9f')]=function(_0x4952cb,_0xa8be65){var _0x3eace8=_0x4952cb[_0x5e60('0x5b')][_0x5e60('0xa0')];return db[_0x5e60('0x3a')][_0x5e60('0x36')]({'where':{'id':_0x4952cb[_0x5e60('0x4f')]['id']},'attributes':['id',_0x5e60('0x37'),_0x5e60('0x5c'),_0x5e60('0xa1'),_0x5e60('0xa2'),_0x5e60('0xa3'),_0x5e60('0xa4')]})[_0x5e60('0x15')](handleEntityNotFound(_0xa8be65,null))[_0x5e60('0x15')](function(_0x55e763){if(_0x55e763){if(!utils['isValidChannel'](_0x3eace8)){throw new db[(_0x5e60('0x93'))][(_0x5e60('0x94'))](_0x5e60('0xa5'));}return _0x55e763[_0x5e60('0xa6')+_['capitalize'](_0x3eace8[_0x5e60('0xa7')]())+_0x5e60('0xa8')](_0x4952cb['body']['ids'],{'penalty':_0x4952cb[_0x5e60('0x5b')][_0x5e60('0xa9')]||0x0})[_0x5e60('0xaa')](function(_0x57d4e2){for(var _0x1176eb=0x0;_0x1176eb<_0x4952cb[_0x5e60('0x5b')][_0x5e60('0x5f')]['length'];_0x1176eb+=0x1){var _0x30d913={'UserId':Number(_0x4952cb['params']['id'])};_0x30d913[_[_0x5e60('0xab')](_0x3eace8[_0x5e60('0xa7')]())+_0x5e60('0xac')]=Number(_0x4952cb['body'][_0x5e60('0x5f')][_0x1176eb]);socket['emit'](_0x5e60('0x2c')+_[_0x5e60('0xab')](_0x3eace8[_0x5e60('0xa7')]())+_0x5e60('0xad'),_0x30d913);}return _0x57d4e2;})[_0x5e60('0x15')](function(){if(_0x3eace8==='voice'){return db[_0x5e60('0xae')]['findAll']({'where':{'id':_0x4952cb[_0x5e60('0x5b')][_0x5e60('0x5f')]||[]},'raw':!![],'attributes':['id',_0x5e60('0x37')]});}})['then'](function(_0x3f8b6f){var _0xe35636=_0x55e763[_0x5e60('0x2a')]({'plain':!![]});var _0x3647d9=[];if(_0x3eace8===_0x5e60('0xaf')&&_0xe35636[_0x5e60('0x5c')]==='agent'&&_0xe35636[_0x5e60('0xa1')]){for(var _0x1d10a3=0x0;_0x1d10a3<_0x3f8b6f['length'];_0x1d10a3+=0x1){_0x3647d9[_0x5e60('0x43')]({'membername':_0xe35636['name'],'UserId':_0xe35636['id'],'queue_name':_0x3f8b6f[_0x1d10a3]['name'],'VoiceQueueId':_0x3f8b6f[_0x1d10a3]['id'],'interface':_[_0x5e60('0x66')](_0xe35636[_0x5e60('0xa4')])?util[_0x5e60('0xb0')](_0x5e60('0xb1'),_0xe35636[_0x5e60('0x37')]):_0xe35636[_0x5e60('0xa4')],'paused':_0xe35636[_0x5e60('0xa3')]||![],'penalty':_0x4952cb[_0x5e60('0x5b')][_0x5e60('0xa9')]||0x0});}return BPromise[_0x5e60('0x8d')](_0x3647d9,function(_0x2a2f0e){return db[_0x5e60('0xb2')][_0x5e60('0xb3')](_0x2a2f0e);});}return _0x55e763;});}})[_0x5e60('0x15')](respondWithStatusCode(_0xa8be65,null))[_0x5e60('0x1f')](handleError(_0xa8be65,null));};exports['removeQueues']=function(_0x4a287c,_0x16f478){var _0x499dc0;return db[_0x5e60('0x3a')][_0x5e60('0x36')]({'where':{'id':_0x4a287c[_0x5e60('0x4f')]['id']},'attributes':['id',_0x5e60('0x37'),_0x5e60('0x5c')]})[_0x5e60('0x15')](handleEntityNotFound(_0x16f478,null))['then'](function(_0x680e7){if(_0x680e7){_0x499dc0=_0x680e7;if(!_0x4a287c[_0x5e60('0x40')][_0x5e60('0xa0')]||!utils[_0x5e60('0xb4')](_0x4a287c[_0x5e60('0x40')][_0x5e60('0xa0')])){throw new db['Sequelize']['ValidationError'](_0x5e60('0xa5'));}return _0x680e7[_0x5e60('0xb5')+_['capitalize'](_0x4a287c[_0x5e60('0x40')][_0x5e60('0xa0')][_0x5e60('0xa7')]())+'Queues'](_0x4a287c[_0x5e60('0x40')][_0x5e60('0x5f')]);}})[_0x5e60('0x15')](function(_0x890d37){if(_[_0x5e60('0xb6')](_0x4a287c[_0x5e60('0x40')][_0x5e60('0x5f')])){for(var _0x13f833=0x0;_0x13f833<_0x4a287c[_0x5e60('0x40')][_0x5e60('0x5f')]['length'];_0x13f833+=0x1){var _0x2261d2={'UserId':Number(_0x4a287c[_0x5e60('0x4f')]['id'])};_0x2261d2[_[_0x5e60('0xab')](_0x4a287c['query'][_0x5e60('0xa0')][_0x5e60('0xa7')]())+'QueueId']=Number(_0x4a287c[_0x5e60('0x40')][_0x5e60('0x5f')][_0x13f833]);socket[_0x5e60('0xb7')](_0x5e60('0x2c')+_[_0x5e60('0xab')](_0x4a287c['query']['channel'][_0x5e60('0xa7')]())+_0x5e60('0xb8'),_0x2261d2);}}else{var _0x2261d2={'UserId':Number(_0x4a287c['params']['id'])};_0x2261d2[_[_0x5e60('0xab')](_0x4a287c[_0x5e60('0x40')][_0x5e60('0xa0')]['toLowerCase']())+_0x5e60('0xac')]=Number(_0x4a287c[_0x5e60('0x40')][_0x5e60('0x5f')]);socket[_0x5e60('0xb7')](_0x5e60('0x2c')+_[_0x5e60('0xab')](_0x4a287c[_0x5e60('0x40')][_0x5e60('0xa0')][_0x5e60('0xa7')]())+'Queue:remove',_0x2261d2);}return _0x890d37;})[_0x5e60('0x15')](function(){if(_0x4a287c[_0x5e60('0x40')][_0x5e60('0xa0')]==='voice'){return db[_0x5e60('0xb2')]['destroy']({'where':{'UserId':_0x4a287c[_0x5e60('0x4f')]['id'],'VoiceQueueId':_0x4a287c[_0x5e60('0x40')]['ids']},'individualHooks':!![]})[_0x5e60('0x15')](function(){return _0x499dc0;});}return _0x499dc0;})[_0x5e60('0x15')](respondWithStatusCode(_0x16f478,null))[_0x5e60('0x1f')](handleError(_0x16f478,null));};exports[_0x5e60('0xb9')]=function(_0x557d9e,_0x10208a){_0x557d9e['body'][_0x5e60('0xba')]=_0x557d9e['file']['filename'];return db[_0x5e60('0x3a')]['find']({'where':{'id':_0x557d9e[_0x5e60('0x4f')]['id']}})[_0x5e60('0x15')](handleEntityNotFound(_0x10208a,null))['then'](saveUpdates(_0x557d9e[_0x5e60('0x5b')],null))[_0x5e60('0x15')](respondWithResult(_0x10208a,null))[_0x5e60('0x1f')](handleError(_0x10208a,null));};exports[_0x5e60('0xbb')]=function(_0x420d1a,_0x66e546){var _0x52832d=path[_0x5e60('0xbc')](config[_0x5e60('0xbd')],_0x5e60('0xbe'));return db[_0x5e60('0x3a')][_0x5e60('0x36')]({'where':{'id':_0x420d1a[_0x5e60('0x4f')]['id']},'attributes':['id',_0x5e60('0xba')],'raw':!![]})[_0x5e60('0x15')](handleEntityNotFound(_0x66e546,null))[_0x5e60('0x15')](function(_0x14b269){if(_0x14b269){if(_['isNil'](_0x14b269['userpic'])){return _0x66e546[_0x5e60('0xbf')](_0x52832d);}else{if(!fs[_0x5e60('0xc0')](path[_0x5e60('0xbc')](config[_0x5e60('0xbd')],_0x5e60('0xc1'),_0x14b269[_0x5e60('0xba')]))){return _0x66e546['download'](_0x52832d);}return _0x66e546[_0x5e60('0xbf')](path[_0x5e60('0xbc')](config['root'],_0x5e60('0xc1'),_0x14b269[_0x5e60('0xba')]));}}})['catch'](handleError(_0x66e546,null));};exports[_0x5e60('0xc2')]=function(_0x207b3e,_0x2acac9){return db['User']['find']({'where':{'id':_0x207b3e['params']['id']},'attributes':['id']})[_0x5e60('0x15')](handleEntityNotFound(_0x2acac9,null))['then'](function(_0x52f5f5){var _0x56baa2=[];values=_0x52f5f5[_0x5e60('0x4a')];_0x56baa2['push'](get_open_tabs(_0x5e60('0x48'),_0x52f5f5[_0x5e60('0x4a')]));_0x56baa2[_0x5e60('0x43')](get_open_tabs('sms',_0x52f5f5[_0x5e60('0x4a')]));_0x56baa2[_0x5e60('0x43')](get_open_tabs('openchannel',_0x52f5f5['dataValues']));_0x56baa2['push'](get_open_tabs(_0x5e60('0x4c'),_0x52f5f5[_0x5e60('0x4a')]));_0x56baa2['push'](get_open_tabs(_0x5e60('0xc3'),_0x52f5f5[_0x5e60('0x4a')]));_0x56baa2['push'](get_open_tabs(_0x5e60('0x4b'),_0x52f5f5[_0x5e60('0x4a')]));return BPromise[_0x5e60('0x4d')](_0x56baa2);})[_0x5e60('0x15')](function(_0x52161c){var _0x2a8af7=[];if(_0x52161c){for(var _0x455f3d=0x0;_0x455f3d=_0x5590ec){_0x448e43=_0x5590ec;_0x53aaa2=0xc8;}else{_0x53aaa2=0xce;}_0x173524['status'](_0x53aaa2);return _0x173524[_0x8b68('0x25')]('Content-Range',_0x4fe8f6+'-'+_0x448e43+'/'+_0x5590ec)[_0x8b68('0x20')](_0x1a6fe8);}return null;};}function saveUpdates(_0x3ac356){return function(_0x48e2c8){if(_0x48e2c8){return _0x48e2c8['update'](_0x3ac356)[_0x8b68('0x15')](function(_0x1cd230){return _0x1cd230;});}return null;};}function removeEntity(_0x1e7c06){return function(_0xfb4f06){if(_0xfb4f06){return _0xfb4f06[_0x8b68('0x26')]()[_0x8b68('0x15')](function(){var _0x460c37=_0xfb4f06['get']({'plain':!![]});if(_0x460c37[_0x8b68('0x27')]==='admin')return;var _0x1d8693=[{'name':_0x8b68('0x28'),'value':'user','ignore':!![]},{'name':_0x8b68('0x29'),'value':_0x8b68('0x2a'),'ignore':![]},{'name':_0x8b68('0x2b'),'value':'telephone','ignore':![]}];var _0x51f169=_(_0x1d8693)[_0x8b68('0x2c')](_0x8b68('0x2d'))[_0x8b68('0x2e')](_0x8b68('0x2f'))[_0x8b68('0x2f')]();if(_[_0x8b68('0x30')](_0x51f169,_0x460c37[_0x8b68('0x27')])){return;}var _0x3e646e=_[_0x8b68('0x31')](_0x1d8693,[_0x8b68('0x2f'),_0x460c37[_0x8b68('0x27')]])[_0x8b68('0x32')];return db[_0x8b68('0x33')][_0x8b68('0x26')]({'where':{'type':_0x3e646e,'resourceId':_0x460c37['id']}})[_0x8b68('0x15')](function(){return _0xfb4f06;});})[_0x8b68('0x15')](function(){_0x1e7c06[_0x8b68('0x1f')](0xcc)[_0x8b68('0x34')]();});}};}function handleEntityNotFound(_0x120b34){return function(_0x18dfae){if(!_0x18dfae){_0x120b34[_0x8b68('0x35')](0x194);}return _0x18dfae;};}function handleError(_0x43b971,_0x48abb7){_0x48abb7=_0x48abb7||0x1f4;return function(_0x5c158b){logger[_0x8b68('0x1a')](_0x5c158b[_0x8b68('0x36')]);if(_0x5c158b[_0x8b68('0x32')]){delete _0x5c158b[_0x8b68('0x32')];}_0x43b971[_0x8b68('0x1f')](_0x48abb7)[_0x8b68('0x37')](_0x5c158b);};}exports[_0x8b68('0x38')]=function(_0x43feb3,_0x5b628e){var _0x14cda1={},_0x2c94d0={'count':0x0,'rows':[]};var _0x1011b7=_(db[_0x8b68('0x39')][_0x8b68('0x3a')])[_0x8b68('0x2e')](function(_0xff4080){return{'name':_0xff4080[_0x8b68('0x3b')],'type':_0xff4080['type'][_0x8b68('0x3c')]};})[_0x8b68('0x2c')](function(_0x1aa5c2){return!_[_0x8b68('0x30')]([_0x8b68('0x3d'),_0x8b68('0x3e')],_0x1aa5c2[_0x8b68('0x32')]);})['value']();_0x14cda1=qs[_0x8b68('0x3f')](_0x1011b7,_0x43feb3);var _0x2fc3a9={'where':_0x14cda1['where']};return db[_0x8b68('0x39')][_0x8b68('0x24')](_0x2fc3a9)['then'](function(_0x4e627f){_0x2c94d0['count']=_0x4e627f;if(_0x43feb3['query'][_0x8b68('0x40')]){_0x14cda1[_0x8b68('0x41')]=[{'all':!![]}];}if(!_['includes'](_0x14cda1[_0x8b68('0x42')],'id')){_0x14cda1['attributes'][_0x8b68('0x43')]('id');}return db[_0x8b68('0x39')]['findAll'](_0x14cda1);})[_0x8b68('0x15')](function(_0x5ae345){_0x2c94d0['rows']=_0x5ae345;if(_0x43feb3['query'][_0x8b68('0x44')]===_0x8b68('0x45')){var _0x3ba80e=[];for(var _0xa70f60=0x0;_0xa70f60<_0x2c94d0['rows'][_0x8b68('0x46')];_0xa70f60++){_0x3ba80e['push'](get_open_tabs(_0x8b68('0x47'),_0x2c94d0[_0x8b68('0x48')][_0xa70f60]['dataValues']));_0x3ba80e[_0x8b68('0x43')](get_open_tabs(_0x8b68('0x49'),_0x2c94d0[_0x8b68('0x48')][_0xa70f60][_0x8b68('0x4a')]));_0x3ba80e['push'](get_open_tabs(_0x8b68('0x4b'),_0x2c94d0[_0x8b68('0x48')][_0xa70f60][_0x8b68('0x4a')]));_0x3ba80e[_0x8b68('0x43')](get_open_tabs(_0x8b68('0x4c'),_0x2c94d0[_0x8b68('0x48')][_0xa70f60][_0x8b68('0x4a')]));_0x3ba80e[_0x8b68('0x43')](get_open_tabs(_0x8b68('0x4d'),_0x2c94d0[_0x8b68('0x48')][_0xa70f60][_0x8b68('0x4a')]));_0x3ba80e[_0x8b68('0x43')](get_open_tabs(_0x8b68('0x4e'),_0x2c94d0[_0x8b68('0x48')][_0xa70f60][_0x8b68('0x4a')]));}return BPromise[_0x8b68('0x4f')](_0x3ba80e)['then'](function(_0x3b7b06){return _0x2c94d0;});}else{return _0x2c94d0;}})[_0x8b68('0x15')](respondWithFilteredResult(_0x5b628e,_0x14cda1))['catch'](handleError(_0x5b628e,null));};exports[_0x8b68('0x50')]=function(_0x4cd28a,_0x58cf66){var _0x59a4a6={'raw':![],'where':{'id':_0x4cd28a[_0x8b68('0x51')]['id']}},_0x1c8a3e={};_0x1c8a3e[_0x8b68('0x52')]=_[_0x8b68('0x53')](_['keys'](db['User'][_0x8b68('0x3a')]),[_0x8b68('0x3d'),_0x8b68('0x3e')]);_0x1c8a3e['query']=_[_0x8b68('0x54')](_0x4cd28a[_0x8b68('0x55')]);_0x1c8a3e['filters']=_[_0x8b68('0x56')](_0x1c8a3e[_0x8b68('0x52')],_0x1c8a3e['query']);_0x59a4a6[_0x8b68('0x42')]=_[_0x8b68('0x56')](_0x1c8a3e['model'],qs[_0x8b68('0x57')](_0x4cd28a[_0x8b68('0x55')]['fields']));_0x59a4a6['attributes']=_0x59a4a6['attributes'][_0x8b68('0x46')]?_0x59a4a6[_0x8b68('0x42')]:_0x1c8a3e[_0x8b68('0x52')];if(_0x4cd28a[_0x8b68('0x55')]['includeAll']){_0x59a4a6['include']=[{'all':!![]}];}_0x59a4a6=_[_0x8b68('0x58')]({},_0x59a4a6,_0x4cd28a[_0x8b68('0x59')]);if(!_[_0x8b68('0x30')](_0x59a4a6['attributes'],'id')){_0x59a4a6[_0x8b68('0x42')][_0x8b68('0x43')]('id');}return db[_0x8b68('0x39')]['find'](_0x59a4a6)[_0x8b68('0x15')](handleEntityNotFound(_0x58cf66,null))['then'](function(_0x2b1fd8){var _0x3efb0e=[];values=_0x2b1fd8;if(_0x4cd28a['query'][_0x8b68('0x44')]===_0x8b68('0x45')){_0x3efb0e[_0x8b68('0x43')](get_open_tabs(_0x8b68('0x47'),_0x2b1fd8[_0x8b68('0x4a')]));_0x3efb0e['push'](get_open_tabs(_0x8b68('0x49'),_0x2b1fd8[_0x8b68('0x4a')]));_0x3efb0e[_0x8b68('0x43')](get_open_tabs(_0x8b68('0x4d'),_0x2b1fd8[_0x8b68('0x4a')]));_0x3efb0e[_0x8b68('0x43')](get_open_tabs(_0x8b68('0x4e'),_0x2b1fd8[_0x8b68('0x4a')]));_0x3efb0e['push'](get_open_tabs(_0x8b68('0x4b'),_0x2b1fd8[_0x8b68('0x4a')]));_0x3efb0e[_0x8b68('0x43')](get_open_tabs(_0x8b68('0x4c'),_0x2b1fd8[_0x8b68('0x4a')]));return BPromise[_0x8b68('0x4f')](_0x3efb0e);}else{return values;}})[_0x8b68('0x15')](function(_0x37c4cb){return values;})[_0x8b68('0x15')](respondWithResult(_0x58cf66,null))[_0x8b68('0x1e')](handleError(_0x58cf66,null));};exports[_0x8b68('0x5a')]=function(_0x42871e,_0x1019cb){if(_0x42871e[_0x8b68('0x5b')]['id']){delete _0x42871e[_0x8b68('0x5b')]['id'];}delete _0x42871e[_0x8b68('0x5b')][_0x8b68('0x27')];return db[_0x8b68('0x39')][_0x8b68('0x31')]({'where':{'id':_0x42871e[_0x8b68('0x51')]['id']}})['then'](handleEntityNotFound(_0x1019cb,null))[_0x8b68('0x15')](saveUpdates(_0x42871e['body'],null))['then'](respondWithResult(_0x1019cb,null))[_0x8b68('0x1e')](handleError(_0x1019cb,null));};exports['describe']=function(_0x43f826,_0x61dac8){return db[_0x8b68('0x39')]['describe']()[_0x8b68('0x15')](respondWithResult(_0x61dac8,null))[_0x8b68('0x1e')](handleError(_0x61dac8,null));};exports[_0x8b68('0x5c')]=function(_0x1e0095,_0x401c20){return db[_0x8b68('0x39')][_0x8b68('0x31')]({'where':{'id':_0x1e0095['params']['id']}})['then'](handleEntityNotFound(_0x401c20,null))[_0x8b68('0x15')](function(_0x4224f5){if(_0x4224f5){return _0x4224f5[_0x8b68('0x5c')](_0x1e0095[_0x8b68('0x5b')][_0x8b68('0x5d')],_[_0x8b68('0x5e')](_0x1e0095[_0x8b68('0x5b')],[_0x8b68('0x5d'),'id'])||{});}})[_0x8b68('0x15')](respondWithResult(_0x401c20,null))[_0x8b68('0x1e')](handleError(_0x401c20,null));};function validateUser(_0x141f41){return new BPromise(function(_0x2379d4,_0x316652){if(_0x141f41[_0x8b68('0x5f')])return _0x2379d4(_0x141f41);return db[_0x8b68('0x60')][_0x8b68('0x61')](0x1)[_0x8b68('0x15')](function(_0x10e8b7){if(_0x10e8b7['securePassword'])authService['validatePasswordPattern'](_0x141f41[_0x8b68('0x3d')]);db[_0x8b68('0x39')]['max']('internal')['then'](function(_0x39a04e){if(_[_0x8b68('0x62')](_0x39a04e)){_0x141f41[_0x8b68('0x5f')]=_0x10e8b7[_0x8b68('0x63')]||0x1;return;}if(_[_0x8b68('0x62')](_0x10e8b7['min_internal'])||_0x10e8b7[_0x8b68('0x63')]===_0x39a04e){_0x141f41[_0x8b68('0x5f')]=_0x39a04e+0x1;return;}if(_0x10e8b7['min_internal']>_0x39a04e){_0x141f41[_0x8b68('0x5f')]=_0x10e8b7['min_internal'];return;}return db['sequelize']['query'](_0x8b68('0x64'),{'type':db[_0x8b68('0x65')][_0x8b68('0x66')][_0x8b68('0x67')]})[_0x8b68('0x15')](function(_0x1fc24c){if(_0x1fc24c&&_0x1fc24c[_0x8b68('0x46')]){for(var _0x34456d=0x0,_0x427752=_0x1fc24c[_0x8b68('0x46')];_0x34456d<_0x427752&&_['isNil'](_0x141f41[_0x8b68('0x5f')]);_0x34456d++){if(_0x10e8b7[_0x8b68('0x63')]<=_0x1fc24c[_0x34456d][_0x8b68('0x68')]){_0x141f41['internal']=_0x1fc24c[_0x34456d]['from'];}else if(_0x10e8b7[_0x8b68('0x63')]>_0x1fc24c[_0x34456d][_0x8b68('0x68')]&&_0x10e8b7['min_internal']<=_0x1fc24c[_0x34456d]['to']){_0x141f41[_0x8b68('0x5f')]=_0x10e8b7[_0x8b68('0x63')];}}}if(_[_0x8b68('0x62')](_0x141f41[_0x8b68('0x5f')])){_0x141f41['internal']=_0x39a04e+0x1;}return _0x2379d4(_0x141f41);});});})[_0x8b68('0x1e')](function(_0x4925a4){_0x316652(_0x4925a4);});});}function updateUser(_0x51dc80){return new BPromise(function(_0x1cd7e5,_0x51fb5b){try{if(_0x51dc80[_0x8b68('0x69')]){_0x51dc80[_0x8b68('0x6a')]=_0x51dc80['internal'];_0x51dc80[_0x8b68('0x6b')]={'mailbox':_0x51dc80[_0x8b68('0x5f')],'password':_0x51dc80[_0x8b68('0x3d')],'fullname':_0x51dc80[_0x8b68('0x6c')],'email':_0x51dc80[_0x8b68('0x6d')]};}if(_0x51dc80['role']===_0x8b68('0x2a')){if(!_0x51dc80[_0x8b68('0x6e')])_0x51dc80[_0x8b68('0x6e')]=[_0x8b68('0x6f'),_0x8b68('0x70'),'103','113',_0x8b68('0x71'),'104',_0x8b68('0x72'),_0x8b68('0x73'),_0x8b68('0x74'),_0x8b68('0x75'),_0x8b68('0x76'),_0x8b68('0x77'),_0x8b68('0x78'),'114',_0x8b68('0x79')];}_0x1cd7e5(_0x51dc80);}catch(_0x4c0cc4){_0x51fb5b(_0x4c0cc4);}});}exports[_0x8b68('0x7a')]=function(_0x2caa28,_0xc8c3c){if(_0x2caa28['user'][_0x8b68('0x27')]==='agent')throw new Error(_0x8b68('0x7b'));if(_0x2caa28['body'][_0x8b68('0x27')]===_0x8b68('0x7c')&&_0x2caa28[_0x8b68('0x7c')]['role']!==_0x8b68('0x7d')){throw new Error(_0x8b68('0x7e'));}if(_0x2caa28[_0x8b68('0x5b')][_0x8b68('0x27')]===_0x8b68('0x7d')&&_0x2caa28[_0x8b68('0x7c')][_0x8b68('0x27')]!==_0x8b68('0x7d')){throw new Error(_0x8b68('0x7f'));}return licenseUtil['checkUserLimits']([_0x2caa28[_0x8b68('0x5b')]])[_0x8b68('0x15')](function(){return validateUser(_0x2caa28[_0x8b68('0x5b')]);})[_0x8b68('0x15')](function(_0x71095b){return updateUser(_0x71095b)['then'](function(_0x3dfd43){if(_0x3dfd43['role']===_0x8b68('0x7d')){_0x3dfd43[_0x8b68('0x80')]=_0x2caa28['user'][_0x8b68('0x80')];delete _0x3dfd43[_0x8b68('0x81')];}return _0x3dfd43;});})[_0x8b68('0x15')](function(_0x4c9e0f){return db[_0x8b68('0x39')][_0x8b68('0x7a')](_0x4c9e0f,{'include':[{'model':db[_0x8b68('0x6b')],'as':_0x8b68('0x6b')}]});})[_0x8b68('0x15')](function(_0x42464c){if(_0x2caa28['body'][_0x8b68('0x27')]===_0x8b68('0x7c'))return _0x42464c;if(_0x2caa28[_0x8b68('0x7c')]['role']!==_0x8b68('0x7c'))return _0x42464c;return db[_0x8b68('0x82')][_0x8b68('0x31')]({'where':{'name':_0x42464c[_0x8b68('0x27')]===_0x8b68('0x2a')?_0x8b68('0x29'):_0x8b68('0x2b'),'userProfileId':_0x2caa28[_0x8b68('0x7c')][_0x8b68('0x81')]},'raw':!![]})[_0x8b68('0x15')](function(_0x44bb3a){if(!_0x44bb3a||_0x44bb3a['autoAssociation']!=0x0)return _0x42464c;return db['UserProfileResource'][_0x8b68('0x7a')]({'name':_0x42464c[_0x8b68('0x32')],'resourceId':_0x42464c['id'],'type':_0x44bb3a[_0x8b68('0x32')],'sectionId':_0x44bb3a['id']},{})[_0x8b68('0x15')](function(){return _0x42464c;});})[_0x8b68('0x1e')](function(_0x5e6c85){logger[_0x8b68('0x1a')](_0x8b68('0x83'),_0x5e6c85);throw _0x5e6c85;});})[_0x8b68('0x15')](respondWithResult(_0xc8c3c,0xc9))[_0x8b68('0x1e')](handleError(_0xc8c3c,null));};exports['bulkCreate']=function(_0x52aa06,_0x417bc0){var _0x42a69b=_0x52aa06[_0x8b68('0x5b')];var _0x1bf8cd=[];if(_0x52aa06[_0x8b68('0x7c')][_0x8b68('0x27')]===_0x8b68('0x2a'))throw new Error(_0x8b68('0x7b'));if(_['some'](_0x42a69b,[_0x8b68('0x27'),_0x8b68('0x7c')])&&_0x52aa06[_0x8b68('0x7c')][_0x8b68('0x27')]!==_0x8b68('0x7d')){throw new Error(_0x8b68('0x7e'));}if(_['some'](_0x42a69b,[_0x8b68('0x27'),_0x8b68('0x7d')])&&_0x52aa06[_0x8b68('0x7c')]['role']!==_0x8b68('0x7d')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x8b68('0x84')](_0x42a69b)['then'](function(){return validateUser(_0x42a69b[0x0]);})[_0x8b68('0x15')](function(){for(var _0x382d99=0x1;_0x382d99<_0x42a69b[_0x8b68('0x46')];_0x382d99++){var _0xf5a5fc=_0x42a69b[_0x382d99-0x1][_0x8b68('0x5f')];if(!_0x42a69b[_0x382d99][_0x8b68('0x5f')])_0x42a69b[_0x382d99]['internal']=_0xf5a5fc+0x1;_0x1bf8cd['push'](validateUser(_0x42a69b[_0x382d99]));}return BPromise['all'](_0x1bf8cd);})[_0x8b68('0x15')](function(){_0x1bf8cd=[];for(var _0x216c0e=0x0;_0x216c0e<_0x42a69b[_0x8b68('0x46')];_0x216c0e++){_0x1bf8cd[_0x8b68('0x43')](updateUser(_0x42a69b[_0x216c0e]));}return BPromise[_0x8b68('0x4f')](_0x1bf8cd);})[_0x8b68('0x15')](function(){return BPromise[_0x8b68('0x85')](_0x42a69b,function(_0x3b1644){return db[_0x8b68('0x39')][_0x8b68('0x7a')](_0x3b1644,{'include':[{'model':db[_0x8b68('0x6b')],'as':_0x8b68('0x6b')}]})[_0x8b68('0x15')](function(_0x1c5a71){_0x3b1644['id']=_0x1c5a71['id'];return _0x3b1644;});});})[_0x8b68('0x15')](function(_0x5e76ac){if(_0x52aa06['body']['role']===_0x8b68('0x7c'))return _0x5e76ac;if(_0x52aa06[_0x8b68('0x7c')][_0x8b68('0x27')]!==_0x8b68('0x7c'))return _0x5e76ac;var _0xb43aa0=_['some'](_0x5e76ac,function(_0x620256){return _0x620256['role']===_0x8b68('0x2a')||_0x620256['role']===_0x8b68('0x86');});if(!_0xb43aa0)return _0x5e76ac;return db['UserProfileSection'][_0x8b68('0x87')]({'where':{'name':{'$or':['Agents',_0x8b68('0x2b')]},'userProfileId':_0x52aa06[_0x8b68('0x7c')]['userProfileId']},'raw':!![]})[_0x8b68('0x15')](function(_0x4520af){if(_['isEmpty'](_0x4520af)||!_[_0x8b68('0x88')](_0x4520af,['autoAssociation',0x0]))return _0x5e76ac;_0x1bf8cd=[];var _0x93e030=_(_0x4520af)['map'](function(_0x1141da){if(_0x1141da[_0x8b68('0x89')]===0x1)return;return _0x1141da[_0x8b68('0x32')]===_0x8b68('0x29')?_0x8b68('0x2a'):_0x8b68('0x86');})[_0x8b68('0x8a')]()['value']();for(var _0x19d947=0x0;_0x19d947<_0x5e76ac[_0x8b68('0x46')];_0x19d947++){if(!_[_0x8b68('0x30')](_0x93e030,_0x5e76ac[_0x19d947][_0x8b68('0x27')]))return;var _0x333f4f=_0x5e76ac[_0x19d947][_0x8b68('0x27')]===_0x8b68('0x2a')?_0x8b68('0x29'):_0x8b68('0x2b');_0x1bf8cd[_0x8b68('0x43')](db[_0x8b68('0x33')][_0x8b68('0x7a')]({'name':_0x5e76ac[_0x19d947][_0x8b68('0x32')],'resourceId':_0x5e76ac[_0x19d947]['id'],'type':_0x333f4f,'sectionId':_[_0x8b68('0x31')](_0x4520af,['name',_0x333f4f])['id']},{}));}return BPromise[_0x8b68('0x4f')](_0x1bf8cd);});})[_0x8b68('0x15')](respondWithResult(_0x417bc0,0xc9))[_0x8b68('0x1e')](handleError(_0x417bc0,null));};exports[_0x8b68('0x8b')]=function(_0x475bf7,_0x3bae8f){if(_0x475bf7['body']['id']){delete _0x475bf7[_0x8b68('0x5b')]['id'];}return db[_0x8b68('0x39')][_0x8b68('0x31')]({'where':{'id':_0x475bf7[_0x8b68('0x51')]['id']}})[_0x8b68('0x15')](function(_0x5e2270){if(!_0x5e2270)return null;if(_0x5e2270['id']===_0x475bf7[_0x8b68('0x7c')]['id']){if(!_0x475bf7[_0x8b68('0x5b')][_0x8b68('0x8c')]||!_0x475bf7['body'][_0x8b68('0x8d')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x5e2270[_0x8b68('0x8e')](_0x475bf7[_0x8b68('0x5b')]['oldPassword'])){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x90'))](_0x8b68('0x91'));}if(_0x475bf7[_0x8b68('0x5b')][_0x8b68('0x8c')]===_0x475bf7[_0x8b68('0x5b')][_0x8b68('0x8d')]){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x90'))](_0x8b68('0x92'));}}else if(_0x475bf7['user'][_0x8b68('0x27')]===_0x8b68('0x7d')){if(!_0x475bf7['body'][_0x8b68('0x8d')]){throw new db[(_0x8b68('0x8f'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x475bf7[_0x8b68('0x7c')][_0x8b68('0x27')]===_0x8b68('0x7c')){if(!_0x475bf7[_0x8b68('0x5b')][_0x8b68('0x8d')]){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x90'))](_0x8b68('0x93'));}if(_0x5e2270['role']!==_0x8b68('0x2a')){throw new db['Sequelize']['ValidationError'](_0x8b68('0x7b'));}}else{throw new db[(_0x8b68('0x8f'))]['ValidationError'](_0x8b68('0x7b'));}return _0x5e2270;})['then'](handleEntityNotFound(_0x3bae8f,null))[_0x8b68('0x15')](function(_0x29e328){return db[_0x8b68('0x60')]['findOne']({'attributes':['id',_0x8b68('0x94'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x8b68('0x15')](function(_0xe9810c){if(_0xe9810c[_0x8b68('0x94')])authService[_0x8b68('0x95')](_0x475bf7[_0x8b68('0x5b')][_0x8b68('0x8d')]);if(!_0xe9810c[_0x8b68('0x96')]||!_0x29e328['previousPasswords'])return _0x29e328;authService[_0x8b68('0x97')](_0x475bf7[_0x8b68('0x5b')][_0x8b68('0x8d')],_0x29e328[_0x8b68('0x98')],_0xe9810c[_0x8b68('0x99')]);return _0x29e328;})[_0x8b68('0x15')](saveUpdates({'password':_0x475bf7[_0x8b68('0x5b')]['newPassword'],'passwordResetAt':_0x475bf7[_0x8b68('0x7c')]['id']==_0x475bf7[_0x8b68('0x51')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x475bf7['body'][_0x8b68('0x8d')],_0x29e328[_0x8b68('0x98')])},null));})['then'](respondWithResult(_0x3bae8f,null))[_0x8b68('0x1e')](handleError(_0x3bae8f,null));};exports[_0x8b68('0x9a')]=function(_0x101da1,_0x23f7ec){var _0x167588=_0x101da1[_0x8b68('0x5b')][_0x8b68('0x9b')];return db['User'][_0x8b68('0x31')]({'where':{'id':_0x101da1[_0x8b68('0x51')]['id']},'attributes':['id',_0x8b68('0x32'),'role','online',_0x8b68('0x9c'),_0x8b68('0x9d'),_0x8b68('0x9e')]})['then'](handleEntityNotFound(_0x23f7ec,null))['then'](function(_0x5fbaa7){if(_0x5fbaa7){if(!utils[_0x8b68('0x9f')](_0x167588)){throw new db[(_0x8b68('0x8f'))]['ValidationError']('Unknown\x20channel');}return _0x5fbaa7['add'+_[_0x8b68('0xa0')](_0x167588[_0x8b68('0xa1')]())+_0x8b68('0xa2')](_0x101da1[_0x8b68('0x5b')][_0x8b68('0x5d')],{'penalty':_0x101da1['body']['penalty']||0x0})[_0x8b68('0xa3')](function(_0x4d06a9){for(var _0x5a1823=0x0;_0x5a1823<_0x101da1['body'][_0x8b68('0x5d')][_0x8b68('0x46')];_0x5a1823+=0x1){var _0x40171d={'UserId':Number(_0x101da1['params']['id'])};_0x40171d[_[_0x8b68('0xa0')](_0x167588['toLowerCase']())+_0x8b68('0xa4')]=Number(_0x101da1[_0x8b68('0x5b')][_0x8b68('0x5d')][_0x5a1823]);socket[_0x8b68('0xa5')](_0x8b68('0x7c')+_[_0x8b68('0xa0')](_0x167588[_0x8b68('0xa1')]())+_0x8b68('0xa6'),_0x40171d);}return _0x4d06a9;})[_0x8b68('0x15')](function(){if(_0x167588===_0x8b68('0xa7')){return db[_0x8b68('0xa8')][_0x8b68('0x87')]({'where':{'id':_0x101da1[_0x8b68('0x5b')][_0x8b68('0x5d')]||[]},'raw':!![],'attributes':['id',_0x8b68('0x32')]});}})[_0x8b68('0x15')](function(_0xc9eba4){var _0x12d4c0=_0x5fbaa7[_0x8b68('0xa9')]({'plain':!![]});var _0x4af96b=[];if(_0x167588===_0x8b68('0xa7')&&_0x12d4c0['role']===_0x8b68('0x2a')&&_0x12d4c0[_0x8b68('0xaa')]){for(var _0x295773=0x0;_0x295773<_0xc9eba4[_0x8b68('0x46')];_0x295773+=0x1){_0x4af96b[_0x8b68('0x43')]({'membername':_0x12d4c0[_0x8b68('0x32')],'UserId':_0x12d4c0['id'],'queue_name':_0xc9eba4[_0x295773][_0x8b68('0x32')],'VoiceQueueId':_0xc9eba4[_0x295773]['id'],'interface':_[_0x8b68('0x62')](_0x12d4c0[_0x8b68('0x9e')])?util[_0x8b68('0xab')](_0x8b68('0xac'),_0x12d4c0[_0x8b68('0x32')]):_0x12d4c0['interface'],'paused':_0x12d4c0[_0x8b68('0x9d')]||![],'penalty':_0x101da1[_0x8b68('0x5b')][_0x8b68('0xad')]||0x0});}return BPromise[_0x8b68('0x85')](_0x4af96b,function(_0x39e25d){return db[_0x8b68('0xae')][_0x8b68('0xaf')](_0x39e25d);});}return _0x5fbaa7;});}})[_0x8b68('0x15')](respondWithStatusCode(_0x23f7ec,null))[_0x8b68('0x1e')](handleError(_0x23f7ec,null));};exports[_0x8b68('0xb0')]=function(_0x2ba260,_0x499eb1){var _0x1825f1;return db[_0x8b68('0x39')][_0x8b68('0x31')]({'where':{'id':_0x2ba260[_0x8b68('0x51')]['id']},'attributes':['id',_0x8b68('0x32'),'role']})[_0x8b68('0x15')](handleEntityNotFound(_0x499eb1,null))[_0x8b68('0x15')](function(_0x50b1fd){if(_0x50b1fd){_0x1825f1=_0x50b1fd;if(!_0x2ba260[_0x8b68('0x55')][_0x8b68('0x9b')]||!utils['isValidChannel'](_0x2ba260['query'][_0x8b68('0x9b')])){throw new db[(_0x8b68('0x8f'))][(_0x8b68('0x90'))](_0x8b68('0xb1'));}return _0x50b1fd[_0x8b68('0xb2')+_[_0x8b68('0xa0')](_0x2ba260[_0x8b68('0x55')][_0x8b68('0x9b')]['toLowerCase']())+_0x8b68('0xa2')](_0x2ba260[_0x8b68('0x55')][_0x8b68('0x5d')]);}})[_0x8b68('0x15')](function(_0x5124b2){if(_[_0x8b68('0xb3')](_0x2ba260['query'][_0x8b68('0x5d')])){for(var _0x29d8da=0x0;_0x29d8da<_0x2ba260[_0x8b68('0x55')][_0x8b68('0x5d')][_0x8b68('0x46')];_0x29d8da+=0x1){var _0x5b0b9c={'UserId':Number(_0x2ba260['params']['id'])};_0x5b0b9c[_['capitalize'](_0x2ba260['query']['channel']['toLowerCase']())+_0x8b68('0xa4')]=Number(_0x2ba260[_0x8b68('0x55')]['ids'][_0x29d8da]);socket['emit'](_0x8b68('0x7c')+_[_0x8b68('0xa0')](_0x2ba260['query'][_0x8b68('0x9b')][_0x8b68('0xa1')]())+'Queue:remove',_0x5b0b9c);}}else{var _0x5b0b9c={'UserId':Number(_0x2ba260[_0x8b68('0x51')]['id'])};_0x5b0b9c[_[_0x8b68('0xa0')](_0x2ba260[_0x8b68('0x55')][_0x8b68('0x9b')][_0x8b68('0xa1')]())+_0x8b68('0xa4')]=Number(_0x2ba260[_0x8b68('0x55')][_0x8b68('0x5d')]);socket['emit'](_0x8b68('0x7c')+_[_0x8b68('0xa0')](_0x2ba260[_0x8b68('0x55')][_0x8b68('0x9b')][_0x8b68('0xa1')]())+'Queue:remove',_0x5b0b9c);}return _0x5124b2;})[_0x8b68('0x15')](function(){if(_0x2ba260['query'][_0x8b68('0x9b')]==='voice'){return db[_0x8b68('0xae')][_0x8b68('0x26')]({'where':{'UserId':_0x2ba260[_0x8b68('0x51')]['id'],'VoiceQueueId':_0x2ba260['query'][_0x8b68('0x5d')]},'individualHooks':!![]})['then'](function(){return _0x1825f1;});}return _0x1825f1;})[_0x8b68('0x15')](respondWithStatusCode(_0x499eb1,null))[_0x8b68('0x1e')](handleError(_0x499eb1,null));};exports[_0x8b68('0xb4')]=function(_0x3fdfe0,_0x5a25d1){_0x3fdfe0[_0x8b68('0x5b')][_0x8b68('0xb5')]=_0x3fdfe0[_0x8b68('0xb6')][_0x8b68('0xb7')];return db[_0x8b68('0x39')][_0x8b68('0x31')]({'where':{'id':_0x3fdfe0[_0x8b68('0x51')]['id']}})[_0x8b68('0x15')](handleEntityNotFound(_0x5a25d1,null))[_0x8b68('0x15')](saveUpdates(_0x3fdfe0[_0x8b68('0x5b')],null))[_0x8b68('0x15')](respondWithResult(_0x5a25d1,null))[_0x8b68('0x1e')](handleError(_0x5a25d1,null));};exports[_0x8b68('0xb8')]=function(_0xd8dd51,_0x118f5e){var _0x1702f8=path['join'](config[_0x8b68('0xb9')],'server/files/images/logos/default_profile.png');return db[_0x8b68('0x39')][_0x8b68('0x31')]({'where':{'id':_0xd8dd51[_0x8b68('0x51')]['id']},'attributes':['id',_0x8b68('0xb5')],'raw':!![]})[_0x8b68('0x15')](handleEntityNotFound(_0x118f5e,null))[_0x8b68('0x15')](function(_0x4fc2a2){if(_0x4fc2a2){if(_['isNil'](_0x4fc2a2['userpic'])){return _0x118f5e[_0x8b68('0xba')](_0x1702f8);}else{if(!fs[_0x8b68('0xbb')](path[_0x8b68('0xbc')](config[_0x8b68('0xb9')],_0x8b68('0xbd'),_0x4fc2a2[_0x8b68('0xb5')]))){return _0x118f5e[_0x8b68('0xba')](_0x1702f8);}return _0x118f5e[_0x8b68('0xba')](path[_0x8b68('0xbc')](config[_0x8b68('0xb9')],'server/files/images/',_0x4fc2a2['userpic']));}}})[_0x8b68('0x1e')](handleError(_0x118f5e,null));};exports['getOpenTabs']=function(_0xe6bcf1,_0x25f2db){return db[_0x8b68('0x39')][_0x8b68('0x31')]({'where':{'id':_0xe6bcf1[_0x8b68('0x51')]['id']},'attributes':['id']})[_0x8b68('0x15')](handleEntityNotFound(_0x25f2db,null))[_0x8b68('0x15')](function(_0x514ab6){var _0x52dd5b=[];values=_0x514ab6[_0x8b68('0x4a')];_0x52dd5b[_0x8b68('0x43')](get_open_tabs(_0x8b68('0x47'),_0x514ab6[_0x8b68('0x4a')]));_0x52dd5b[_0x8b68('0x43')](get_open_tabs('sms',_0x514ab6[_0x8b68('0x4a')]));_0x52dd5b[_0x8b68('0x43')](get_open_tabs(_0x8b68('0x4d'),_0x514ab6[_0x8b68('0x4a')]));_0x52dd5b[_0x8b68('0x43')](get_open_tabs('whatsapp',_0x514ab6[_0x8b68('0x4a')]));_0x52dd5b[_0x8b68('0x43')](get_open_tabs(_0x8b68('0x4b'),_0x514ab6[_0x8b68('0x4a')]));_0x52dd5b[_0x8b68('0x43')](get_open_tabs('mail',_0x514ab6[_0x8b68('0x4a')]));return BPromise['all'](_0x52dd5b);})[_0x8b68('0x15')](function(_0x726461){var _0x55f08d=[];if(_0x726461){for(var _0x3e8d28=0x0;_0x3e8d28=_0x4d2f02[_0xe2e9('0x52')]){throw new Error(_0xe2e9('0x53'));}})[_0xe2e9('0xd')](function(){if(_0x1c56b9){return db[_0xe2e9('0x43')][_0xe2e9('0x48')]({'where':{'membername':_0x1c56b9[_0xe2e9('0x24')]},'individualHooks':!![]});}})[_0xe2e9('0xd')](function(){if(_0x1c56b9){return _0x1c56b9[_0xe2e9('0x54')]({'raw':!![]});}})['then'](function(_0x7653fa){if(_0x1c56b9){if(_0x7653fa){var _0x4cf985=[];_0x565d36=_0x7653fa;if(_0x565d36['length']){for(var _0x30fe66=0x0;_0x30fe66<_0x565d36['length'];_0x30fe66++){_0x4cf985[_0xe2e9('0x49')](db[_0xe2e9('0x43')][_0xe2e9('0x55')]({'membername':_0x1c56b9[_0xe2e9('0x24')],'UserId':_0x1c56b9['id'],'queue_name':_0x565d36[_0x30fe66][_0xe2e9('0x24')],'VoiceQueueId':_0x565d36[_0x30fe66]['id'],'interface':_0x5097fb,'paused':_0x1c56b9['loginInPause']||![],'penalty':_0x565d36[_0x30fe66][_0xe2e9('0x56')]||0x0}));}return BPromise[_0xe2e9('0x45')](_0x4cf985);}}}})['then'](function(){if(_0x1c56b9){return db[_0xe2e9('0x29')][_0xe2e9('0x44')]({'where':{'membername':_0x1c56b9[_0xe2e9('0x24')],'exitAt':null}});}})[_0xe2e9('0xd')](function(_0x3483d7){if(_0x1c56b9){if(_0x3483d7&&_0x3483d7[_0xe2e9('0x2b')]){var _0x15292c=[];_0x3483d7[_0xe2e9('0x2f')](function(_0x69dec9){_0x15292c[_0xe2e9('0x49')](_0x69dec9[_0xe2e9('0x28')]({'exitAt':moment()['format'](_0xe2e9('0x2d'))}));});return BPromise['all'](_0x15292c);}}})[_0xe2e9('0xd')](function(_0x4c62a5){if(_0x1c56b9){var _0xfb6ffa=[];var _0x4420ec=[];var _0x5b9a6c=utils['getChannels']();var _0xa3c0ce={'membername':_0x1c56b9[_0xe2e9('0x24')],'interface':_0x5097fb,'enterAt':moment()['format'](_0xe2e9('0x2d')),'role':_0x1c56b9['role'],'internal':_0x1c56b9[_0xe2e9('0x26')]};_0x5b9a6c['forEach'](function(_0x4e1c59){_0xfb6ffa['push'](_[_0xe2e9('0x57')]({'channel':_0x4e1c59,'type':'LOGIN','data1':_0xe2e9('0x58'),'data2':_0x5097fb},_0xa3c0ce));if(_0x1c56b9[_0xe2e9('0x4d')]){_0x4420ec[_0xe2e9('0x49')](_[_0xe2e9('0x57')]({'channel':_0x4e1c59,'type':_0xe2e9('0x2a'),'data1':_0xe2e9('0x59')},_0xa3c0ce));}});return db[_0xe2e9('0x29')][_0xe2e9('0x36')](_0xfb6ffa['concat'](_0x4420ec),{'individualHooks':!![]});}})['then'](function(){if(_0x1c56b9){return _0x1c56b9[_0xe2e9('0x28')]({'online':!![],'lastLoginAt':moment()[_0xe2e9('0x2c')](_0xe2e9('0x2d')),'voicePause':_0x1c56b9['loginInPause']||![],'mailPause':_0x1c56b9['loginInPause']||![],'chatPause':_0x1c56b9['loginInPause']||![],'faxPause':_0x1c56b9[_0xe2e9('0x4d')]||![],'smsPause':_0x1c56b9[_0xe2e9('0x4d')]||![],'openchannelPause':_0x1c56b9['loginInPause']||![],'pauseType':_0x1c56b9[_0xe2e9('0x4d')]?_0xe2e9('0x59'):null,'lastPauseAt':moment()[_0xe2e9('0x2c')](_0xe2e9('0x2d')),'interface':_0x5097fb});}})[_0xe2e9('0xd')](function(_0x5da9bc){_0x4ed365(_0x5da9bc);})['catch'](function(_0x47ba30){_0x33ca7b(_0x58c61b[_0xe2e9('0x11')](0x1f4,_0x47ba30[_0xe2e9('0x14')]));});});}; \ No newline at end of file +var _0x74e0=['set','UserVoiceQueueRt','push','all','LogoutUser','LoginUser','mobile','phone','SIP/%s','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','loginInPause','getChannels','internal','merge','LOGIN','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetUser','User','findAll','options','limit','include','map','attributes','ShowUser','find','raw','where','model','name','role','interface','update','MemberReport','length','format','YYYY-MM-DD\x20HH:mm:ss','forEach','isNil','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','findOne','channel','Unknown\x20channel','voice','system','mail','chat','fax','sms','openchannel','PAUSE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74e0,0x184));var _0x074e=function(_0x15bb8a,_0x1d2a47){_0x15bb8a=_0x15bb8a-0x0;var _0x40c745=_0x74e0[_0x15bb8a];return _0x40c745;};'use strict';var _=require(_0x074e('0x0'));var util=require(_0x074e('0x1'));var moment=require(_0x074e('0x2'));var BPromise=require(_0x074e('0x3'));var rs=require(_0x074e('0x4'));var fs=require('fs');var Redis=require(_0x074e('0x5'));var db=require(_0x074e('0x6'))['db'];var utils=require(_0x074e('0x7'));var logger=require(_0x074e('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x074e('0x9'));var client=jayson[_0x074e('0xa')]['http']({'port':0x232a});config['redis']=_[_0x074e('0xb')](config[_0x074e('0xc')],{'host':_0x074e('0xd'),'port':0x18eb});var socket=require(_0x074e('0xe'))(new Redis(config[_0x074e('0xc')]));require('./user.socket')['register'](socket);function respondWithRpcPromise(_0xb974b0,_0x35ac94,_0x49aa85){return new BPromise(function(_0x25693f,_0x298409){return client[_0x074e('0xf')](_0xb974b0,_0x49aa85)[_0x074e('0x10')](function(_0x2eaca3){logger[_0x074e('0x11')](_0x074e('0x12'),_0x35ac94,_0x074e('0x13'));logger[_0x074e('0x14')](_0x074e('0x15'),_0x35ac94,'request\x20sent',JSON[_0x074e('0x16')](_0x2eaca3));if(_0x2eaca3[_0x074e('0x17')]){if(_0x2eaca3['error'][_0x074e('0x18')]===0x1f4){logger[_0x074e('0x17')](_0x074e('0x12'),_0x35ac94,_0x2eaca3['error']['message']);return _0x298409(_0x2eaca3[_0x074e('0x17')]['message']);}logger[_0x074e('0x17')]('User,\x20%s,\x20%s',_0x35ac94,_0x2eaca3['error']['message']);return _0x25693f(_0x2eaca3['error'][_0x074e('0x19')]);}else{logger['info'](_0x074e('0x12'),_0x35ac94,_0x074e('0x13'));_0x25693f(_0x2eaca3[_0x074e('0x1a')]['message']);}})[_0x074e('0x1b')](function(_0x1c60dc){logger[_0x074e('0x17')]('User,\x20%s,\x20%s',_0x35ac94,_0x1c60dc);_0x298409(_0x1c60dc);});});}exports[_0x074e('0x1c')]=function(_0x43180c){var _0x138ee3=this;return new Promise(function(_0x30c2c3,_0x5f221e){return db[_0x074e('0x1d')][_0x074e('0x1e')]({'raw':_0x43180c[_0x074e('0x1f')]?_0x43180c[_0x074e('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x43180c['options']?_0x43180c[_0x074e('0x1f')]['where']||null:null,'attributes':_0x43180c['options']?_0x43180c[_0x074e('0x1f')]['attributes']||null:null,'limit':_0x43180c[_0x074e('0x1f')]?_0x43180c[_0x074e('0x1f')][_0x074e('0x20')]||null:null,'include':_0x43180c['options']?_0x43180c['options'][_0x074e('0x21')]?_[_0x074e('0x22')](_0x43180c[_0x074e('0x1f')][_0x074e('0x21')],function(_0x1d0ac2){return{'model':db[_0x1d0ac2['model']],'as':_0x1d0ac2['as'],'attributes':_0x1d0ac2[_0x074e('0x23')],'include':_0x1d0ac2[_0x074e('0x21')]?_['map'](_0x1d0ac2[_0x074e('0x21')],function(_0x11e1ee){return{'model':db[_0x11e1ee['model']],'as':_0x11e1ee['as'],'attributes':_0x11e1ee[_0x074e('0x23')],'include':_0x11e1ee[_0x074e('0x21')]?_[_0x074e('0x22')](_0x11e1ee['include'],function(_0xa0b83b){return{'model':db[_0xa0b83b['model']],'as':_0xa0b83b['as'],'attributes':_0xa0b83b[_0x074e('0x23')]};}):[]};}):[]};}):[]:[]})[_0x074e('0x10')](function(_0x24ddcc){logger['info']('GetUser',_0x43180c);logger[_0x074e('0x14')](_0x074e('0x1c'),_0x43180c,JSON[_0x074e('0x16')](_0x24ddcc));_0x30c2c3(_0x24ddcc);})['catch'](function(_0x75fcc){logger[_0x074e('0x17')]('GetUser',_0x75fcc[_0x074e('0x19')],_0x43180c);_0x5f221e(_0x138ee3[_0x074e('0x17')](0x1f4,_0x75fcc['message']));});});};exports[_0x074e('0x24')]=function(_0x58f020){var _0x44bfea=this;return new Promise(function(_0x3137dc,_0x398e1e){return db[_0x074e('0x1d')][_0x074e('0x25')]({'raw':_0x58f020[_0x074e('0x1f')]?_0x58f020['options'][_0x074e('0x26')]===undefined?!![]:![]:!![],'where':_0x58f020[_0x074e('0x1f')]?_0x58f020[_0x074e('0x1f')][_0x074e('0x27')]||null:null,'attributes':_0x58f020[_0x074e('0x1f')]?_0x58f020[_0x074e('0x1f')][_0x074e('0x23')]||null:null,'include':_0x58f020[_0x074e('0x1f')]?_0x58f020['options'][_0x074e('0x21')]?_[_0x074e('0x22')](_0x58f020['options'][_0x074e('0x21')],function(_0x40027c){return{'model':db[_0x40027c['model']],'as':_0x40027c['as'],'attributes':_0x40027c[_0x074e('0x23')],'include':_0x40027c[_0x074e('0x21')]?_[_0x074e('0x22')](_0x40027c[_0x074e('0x21')],function(_0x55f06e){return{'model':db[_0x55f06e[_0x074e('0x28')]],'as':_0x55f06e['as'],'attributes':_0x55f06e[_0x074e('0x23')],'include':_0x55f06e[_0x074e('0x21')]?_[_0x074e('0x22')](_0x55f06e[_0x074e('0x21')],function(_0x7ed2){return{'model':db[_0x7ed2[_0x074e('0x28')]],'as':_0x7ed2['as'],'attributes':_0x7ed2[_0x074e('0x23')]};}):[]};}):[]};}):[]:[]})[_0x074e('0x10')](function(_0x45672d){logger['info'](_0x074e('0x24'),_0x58f020);logger[_0x074e('0x14')](_0x074e('0x24'),_0x58f020,JSON[_0x074e('0x16')](_0x45672d));_0x3137dc(_0x45672d);})['catch'](function(_0x98da2e){logger[_0x074e('0x17')](_0x074e('0x24'),_0x98da2e[_0x074e('0x19')],_0x58f020);_0x398e1e(_0x44bfea[_0x074e('0x17')](0x1f4,_0x98da2e[_0x074e('0x19')]));});});};exports['PauseUser']=function(_0x4eb917){var _0x441136=this;return new Promise(function(_0x13fc16,_0x491faa){var _0x3a8ad2;return db[_0x074e('0x1d')]['find']({'where':_0x4eb917[_0x074e('0x1f')][_0x074e('0x27')]||{},'attributes':['id',_0x074e('0x29'),_0x074e('0x2a'),'internal',_0x074e('0x2b')]})[_0x074e('0x10')](function(_0x2d1e07){if(_0x2d1e07){_0x3a8ad2=_0x2d1e07;return db['UserVoiceQueueRt'][_0x074e('0x2c')]({'paused':0x1},{'where':{'UserId':_0x3a8ad2['id']},'individualHooks':!![]});}})['then'](function(){if(_0x3a8ad2){return db[_0x074e('0x2d')]['findAll']({'where':{'membername':_0x3a8ad2[_0x074e('0x29')],'type':'PAUSE','exitAt':null}});}})[_0x074e('0x10')](function(_0x32592f){if(_0x3a8ad2){if(_0x32592f&&_0x32592f[_0x074e('0x2e')]){var _0x2ce7ab=moment()[_0x074e('0x2f')](_0x074e('0x30'));for(var _0x3f0c79=0x0,_0x1e1441=_0x32592f['length'];_0x3f0c79<_0x1e1441;_0x3f0c79++){_0x32592f[_0x3f0c79]['updateAttributes']({'exitAt':_0x2ce7ab});}}}})[_0x074e('0x10')](function(){if(_0x3a8ad2){var _0x3b607d=[];var _0x5d53cb=utils['getChannels']();_0x5d53cb[_0x074e('0x31')](function(_0x2b717c){_0x3b607d['push']({'channel':_0x2b717c,'membername':_0x3a8ad2['name'],'interface':_[_0x074e('0x32')](_0x3a8ad2['interface'])?util[_0x074e('0x2f')]('SIP/%s',_0x3a8ad2[_0x074e('0x29')]):_0x3a8ad2['interface'],'type':'PAUSE','enterAt':moment()[_0x074e('0x2f')](_0x074e('0x30')),'data1':_0x4eb917[_0x074e('0x33')][_0x074e('0x34')]||_0x074e('0x35'),'role':_0x3a8ad2['role'],'internal':_0x3a8ad2['internal'],'uniqueid':_0x4eb917['body'][_0x074e('0x36')]||null});});return db[_0x074e('0x2d')][_0x074e('0x37')](_0x3b607d,{'individualHooks':!![]});}})[_0x074e('0x10')](function(){if(_0x3a8ad2){return _0x3a8ad2[_0x074e('0x2c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x4eb917[_0x074e('0x33')][_0x074e('0x34')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x074e('0x2f')](_0x074e('0x30'))});}})['then'](function(_0x524a9b){_0x13fc16(_0x524a9b);})[_0x074e('0x1b')](function(_0x1db0b6){_0x491faa(_0x441136[_0x074e('0x17')](0x1f4,_0x1db0b6[_0x074e('0x19')]));});});};exports['UnpauseUser']=function(_0x2e6a18){var _0x2dc2c2=this;return new Promise(function(_0x5739a7,_0x3ddfaf){var _0x598398;return db[_0x074e('0x1d')][_0x074e('0x38')]({'where':_0x2e6a18[_0x074e('0x1f')][_0x074e('0x27')]||{},'attributes':['id',_0x074e('0x29')]})[_0x074e('0x10')](function(_0x3e955d){if(_0x3e955d){_0x598398=_0x3e955d;if(_0x2e6a18[_0x074e('0x33')][_0x074e('0x39')]&&!utils['isValidChannel'](_0x2e6a18['body'][_0x074e('0x39')])){throw new Error(_0x074e('0x3a'));}switch(_0x2e6a18[_0x074e('0x33')][_0x074e('0x39')]){case _0x074e('0x3b'):return db['UserVoiceQueueRt'][_0x074e('0x2c')]({'paused':0x0},{'where':{'UserId':_0x598398['id']}})[_0x074e('0x10')](function(){return db[_0x074e('0x2d')][_0x074e('0x25')]({'where':{'channel':_0x2e6a18[_0x074e('0x33')][_0x074e('0x39')],'membername':_0x598398[_0x074e('0x29')],'type':'PAUSE','exitAt':null}});})[_0x074e('0x10')](function(_0x373269){if(_0x373269){return _0x373269[_0x074e('0x2c')]({'exitAt':moment()[_0x074e('0x2f')](_0x074e('0x30')),'data2':_0x074e('0x3c')},{'individualHooks':!![]});}return null;})[_0x074e('0x10')](function(){return _0x598398[_0x074e('0x2c')]({'voicePause':![]});});case _0x074e('0x3d'):case _0x074e('0x3e'):case _0x074e('0x3f'):case _0x074e('0x40'):case _0x074e('0x41'):case'whatsapp':return db[_0x074e('0x2d')][_0x074e('0x25')]({'where':{'channel':_0x2e6a18[_0x074e('0x33')][_0x074e('0x39')],'membername':_0x598398[_0x074e('0x29')],'type':_0x074e('0x42'),'exitAt':null}})[_0x074e('0x10')](function(_0x430a9c){return _0x430a9c['update']({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0x074e('0x3c')},{'individualHooks':!![]});})[_0x074e('0x10')](function(){var _0x90a161={};_[_0x074e('0x43')](_0x90a161,util[_0x074e('0x2f')]('%s%s',_0x2e6a18[_0x074e('0x33')][_0x074e('0x39')],'Pause'),![]);return _0x598398[_0x074e('0x2c')](_0x90a161);});default:return db[_0x074e('0x44')]['update']({'paused':0x0},{'where':{'UserId':_0x598398['id']}})[_0x074e('0x10')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x598398['name'],'type':_0x074e('0x42'),'exitAt':null}});})[_0x074e('0x10')](function(_0x3cc9bb){var _0x2318f9=[];_0x3cc9bb[_0x074e('0x31')](function(_0x40d264){_0x2318f9[_0x074e('0x45')](_0x40d264[_0x074e('0x2c')]({'exitAt':moment()[_0x074e('0x2f')](_0x074e('0x30')),'data2':'system'}));});return BPromise[_0x074e('0x46')](_0x2318f9);})[_0x074e('0x10')](function(){return _0x598398[_0x074e('0x2c')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0x074e('0x10')](function(_0x49afdd){_0x5739a7(_0x49afdd);})['catch'](function(_0x54e2e9){_0x3ddfaf(_0x2dc2c2[_0x074e('0x17')](0x1f4,_0x54e2e9[_0x074e('0x19')]));});});};exports[_0x074e('0x47')]=function(_0x381924){var _0x135258=this;return new Promise(function(_0x731c99,_0x34814a){var _0x430e8a;return db[_0x074e('0x1d')]['findOne']({'where':_0x381924[_0x074e('0x1f')][_0x074e('0x27')]||{},'attributes':['id','name']})[_0x074e('0x10')](function(_0x566a3d){if(_0x566a3d){_0x430e8a=_0x566a3d;return db[_0x074e('0x44')]['destroy']({'where':{'membername':_0x430e8a[_0x074e('0x29')]},'individualHooks':!![]});}})['then'](function(){if(_0x430e8a){return db[_0x074e('0x2d')][_0x074e('0x1e')]({'where':{'membername':_0x430e8a['name'],'exitAt':null}});}})[_0x074e('0x10')](function(_0x1e498d){if(_0x430e8a){if(_0x1e498d&&_0x1e498d[_0x074e('0x2e')]){var _0x3baea7=[];_0x1e498d[_0x074e('0x31')](function(_0x1a2102){_0x3baea7[_0x074e('0x45')](_0x1a2102[_0x074e('0x2c')]({'exitAt':moment()['format'](_0x074e('0x30'))}));});return BPromise[_0x074e('0x46')](_0x3baea7);}}})['then'](function(){if(_0x430e8a){return _0x430e8a[_0x074e('0x2c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x074e('0x10')](function(_0x5975ef){_0x731c99(_0x5975ef);})[_0x074e('0x1b')](function(_0x1dc02b){_0x34814a(_0x135258[_0x074e('0x17')](0x1f4,_0x1dc02b[_0x074e('0x19')]));});});};exports[_0x074e('0x48')]=function(_0x2472e3){var _0x26e511=this;return new Promise(function(_0x479aa8,_0xfe2db3){var _0x222d80;var _0x3f4f29;var _0x55eab3;var _0x17d6ae;return db[_0x074e('0x1d')][_0x074e('0x38')]({'where':_0x2472e3[_0x074e('0x1f')][_0x074e('0x27')]||{},'attributes':['id',_0x074e('0x29'),_0x074e('0x2a'),_0x074e('0x49'),_0x074e('0x4a'),'internal','loginInPause',_0x074e('0x2b')]})[_0x074e('0x10')](function(_0x5a0524){if(_0x5a0524){_0x222d80=_0x5a0524;_0x17d6ae=_0x2472e3[_0x074e('0x33')][_0x074e('0x2b')]?_0x2472e3['body']['interface']:util[_0x074e('0x2f')](_0x074e('0x4b'),_0x222d80[_0x074e('0x29')]);return db[_0x074e('0x1d')][_0x074e('0x4c')]({'where':{'role':_0x074e('0x4d'),'online':!![],'id':{'$ne':_0x222d80['id']}}});}})['then'](function(_0x3b6791){if(_0x3b6791){_0x55eab3=_0x3b6791;return require(_0x074e('0x4e'))['getLicense']();}})[_0x074e('0x10')](function(_0x1e4240){if(_0x1e4240&&_0x1e4240[_0x074e('0x4f')]&&_0x55eab3>=_0x1e4240[_0x074e('0x4f')]){throw new Error(_0x074e('0x50'));}})[_0x074e('0x10')](function(){if(_0x222d80){return db[_0x074e('0x44')][_0x074e('0x51')]({'where':{'membername':_0x222d80[_0x074e('0x29')]},'individualHooks':!![]});}})['then'](function(){if(_0x222d80){return _0x222d80[_0x074e('0x52')]({'raw':!![]});}})['then'](function(_0x4739d6){if(_0x222d80){if(_0x4739d6){var _0x13be88=[];_0x3f4f29=_0x4739d6;if(_0x3f4f29[_0x074e('0x2e')]){for(var _0xd0f73c=0x0;_0xd0f73c<_0x3f4f29[_0x074e('0x2e')];_0xd0f73c++){_0x13be88['push'](db['UserVoiceQueueRt'][_0x074e('0x53')]({'membername':_0x222d80[_0x074e('0x29')],'UserId':_0x222d80['id'],'queue_name':_0x3f4f29[_0xd0f73c][_0x074e('0x29')],'VoiceQueueId':_0x3f4f29[_0xd0f73c]['id'],'interface':_0x17d6ae,'paused':_0x222d80[_0x074e('0x54')]||![],'penalty':_0x3f4f29[_0xd0f73c]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x074e('0x46')](_0x13be88);}}}})[_0x074e('0x10')](function(){if(_0x222d80){return db[_0x074e('0x2d')][_0x074e('0x1e')]({'where':{'membername':_0x222d80['name'],'exitAt':null}});}})[_0x074e('0x10')](function(_0xef6d00){if(_0x222d80){if(_0xef6d00&&_0xef6d00[_0x074e('0x2e')]){var _0xb08c83=[];_0xef6d00[_0x074e('0x31')](function(_0x2b4aed){_0xb08c83[_0x074e('0x45')](_0x2b4aed[_0x074e('0x2c')]({'exitAt':moment()[_0x074e('0x2f')](_0x074e('0x30'))}));});return BPromise['all'](_0xb08c83);}}})[_0x074e('0x10')](function(_0x61dd04){if(_0x222d80){var _0xafd6fa=[];var _0x9ccee4=[];var _0x59e72b=utils[_0x074e('0x55')]();var _0x33c7c5={'membername':_0x222d80[_0x074e('0x29')],'interface':_0x17d6ae,'enterAt':moment()[_0x074e('0x2f')](_0x074e('0x30')),'role':_0x222d80[_0x074e('0x2a')],'internal':_0x222d80[_0x074e('0x56')]};_0x59e72b[_0x074e('0x31')](function(_0x1d022e){_0xafd6fa[_0x074e('0x45')](_[_0x074e('0x57')]({'channel':_0x1d022e,'type':_0x074e('0x58'),'data1':'callysquare','data2':_0x17d6ae},_0x33c7c5));if(_0x222d80['loginInPause']){_0x9ccee4[_0x074e('0x45')](_['merge']({'channel':_0x1d022e,'type':_0x074e('0x42'),'data1':_0x074e('0x59')},_0x33c7c5));}});return db[_0x074e('0x2d')][_0x074e('0x37')](_0xafd6fa[_0x074e('0x5a')](_0x9ccee4),{'individualHooks':!![]});}})[_0x074e('0x10')](function(){if(_0x222d80){return _0x222d80['update']({'online':!![],'lastLoginAt':moment()[_0x074e('0x2f')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x222d80[_0x074e('0x54')]||![],'mailPause':_0x222d80[_0x074e('0x54')]||![],'chatPause':_0x222d80[_0x074e('0x54')]||![],'faxPause':_0x222d80[_0x074e('0x54')]||![],'smsPause':_0x222d80[_0x074e('0x54')]||![],'openchannelPause':_0x222d80[_0x074e('0x54')]||![],'pauseType':_0x222d80[_0x074e('0x54')]?_0x074e('0x59'):null,'lastPauseAt':moment()['format'](_0x074e('0x30')),'interface':_0x17d6ae});}})['then'](function(_0x1515ee){_0x479aa8(_0x1515ee);})[_0x074e('0x1b')](function(_0x2ae4e8){_0xfe2db3(_0x26e511[_0x074e('0x17')](0x1f4,_0x2ae4e8[_0x074e('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index ce024c6..6a20283 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 _0x6b55=['emit','removeListener','register','length','./user.events','save','remove','update'];(function(_0x2baba9,_0x87068){var _0x533293=function(_0x232f92){while(--_0x232f92){_0x2baba9['push'](_0x2baba9['shift']());}};_0x533293(++_0x87068);}(_0x6b55,0x15c));var _0x56b5=function(_0x15052f,_0x775fc9){_0x15052f=_0x15052f-0x0;var _0xc53798=_0x6b55[_0x15052f];return _0xc53798;};'use strict';var UserEvents=require(_0x56b5('0x0'));var events=[_0x56b5('0x1'),_0x56b5('0x2'),_0x56b5('0x3')];function createListener(_0x1bd298,_0x31dc4e){return function(_0x4e9ea9){_0x31dc4e[_0x56b5('0x4')](_0x1bd298,_0x4e9ea9);};}function removeListener(_0x8473ec,_0xfc436f){return function(){UserEvents[_0x56b5('0x5')](_0x8473ec,_0xfc436f);};}exports[_0x56b5('0x6')]=function(_0x6a89e9){for(var _0x43369c=0x0,_0x6cbbc8=events[_0x56b5('0x7')];_0x43369c<_0x6cbbc8;_0x43369c++){var _0x50b2da=events[_0x43369c];var _0x360050=createListener('user:'+_0x50b2da,_0x6a89e9);UserEvents['on'](_0x50b2da,_0x360050);}}; \ No newline at end of file +var _0xfd3f=['remove','update','removeListener','length','./user.events','save'];(function(_0x2d5742,_0x4b360e){var _0x6b075a=function(_0x274bf0){while(--_0x274bf0){_0x2d5742['push'](_0x2d5742['shift']());}};_0x6b075a(++_0x4b360e);}(_0xfd3f,0x190));var _0xffd3=function(_0x4fa291,_0x56e289){_0x4fa291=_0x4fa291-0x0;var _0x506d9b=_0xfd3f[_0x4fa291];return _0x506d9b;};'use strict';var UserEvents=require(_0xffd3('0x0'));var events=[_0xffd3('0x1'),_0xffd3('0x2'),_0xffd3('0x3')];function createListener(_0x6ed067,_0x3f28a3){return function(_0x410237){_0x3f28a3['emit'](_0x6ed067,_0x410237);};}function removeListener(_0x3687a3,_0x4c0dc2){return function(){UserEvents[_0xffd3('0x4')](_0x3687a3,_0x4c0dc2);};}exports['register']=function(_0xea55a1){for(var _0x242557=0x0,_0x58e982=events[_0xffd3('0x5')];_0x242557<_0x58e982;_0x242557++){var _0x1ac3db=events[_0x242557];var _0x48e8e7=createListener('user:'+_0x1ac3db,_0xea55a1);UserEvents['on'](_0x1ac3db,_0x48e8e7);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index e70f016..61873e6 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2ab560,_0xf7b1db){var _0x387331=function(_0x4f62ba){while(--_0x4f62ba){_0x2ab560['push'](_0x2ab560['shift']());}};_0x387331(++_0xf7b1db);}(_0xe706,0xa3));var _0x6e70=function(_0x2ed4c9,_0x243771){_0x2ed4c9=_0x2ed4c9-0x0;var _0x237f0a=_0xe706[_0x2ed4c9];return _0x237f0a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x35ad5c,_0x58ccf7){var _0x2bd8aa=function(_0x426bdf){while(--_0x426bdf){_0x35ad5c['push'](_0x35ad5c['shift']());}};_0x2bd8aa(++_0x58ccf7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index cc853b0..4e4a1a8 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 _0xaf3e=['exports','sequelize'];(function(_0x310f14,_0x474a56){var _0x115e6f=function(_0x4504c2){while(--_0x4504c2){_0x310f14['push'](_0x310f14['shift']());}};_0x115e6f(++_0x474a56);}(_0xaf3e,0xcf));var _0xeaf3=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0xaf3e[_0x412342];return _0x3e62cb;};'use strict';var Sequelize=require(_0xeaf3('0x0'));module[_0xeaf3('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xd846=['sequelize','exports','INTEGER'];(function(_0x4e9bb6,_0x361adc){var _0x35e627=function(_0x119089){while(--_0x119089){_0x4e9bb6['push'](_0x4e9bb6['shift']());}};_0x35e627(++_0x361adc);}(_0xd846,0x195));var _0x6d84=function(_0x1f520c,_0x2d18c6){_0x1f520c=_0x1f520c-0x0;var _0x1a535f=_0xd846[_0x1f520c];return _0x1a535f;};'use strict';var Sequelize=require(_0x6d84('0x0'));module[_0x6d84('0x1')]={'penalty':{'type':Sequelize[_0x6d84('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 587df9a..b669c23 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 _0x36a4=['lodash','util','../../config/logger','api','request-promise','path','rimraf','exports','define','user_has_chat_queues'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x36a4,0x118));var _0x436a=function(_0x57e189,_0x3a664e){_0x57e189=_0x57e189-0x0;var _0xfa761b=_0x36a4[_0x57e189];return _0xfa761b;};'use strict';var _=require(_0x436a('0x0'));var util=require(_0x436a('0x1'));var logger=require(_0x436a('0x2'))(_0x436a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x436a('0x4'));var fs=require('fs');var path=require(_0x436a('0x5'));var rimraf=require(_0x436a('0x6'));var config=require('../../config/environment');var attributes=require('./userChatQueue.attributes');module[_0x436a('0x7')]=function(_0x2270b0,_0x3cca9f){return _0x2270b0[_0x436a('0x8')]('UserChatQueue',attributes,{'tableName':_0x436a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x039b=['api','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','define','user_has_chat_queues','util','../../config/logger'];(function(_0x1d21b7,_0x1ce2b3){var _0x23f71b=function(_0x398f66){while(--_0x398f66){_0x1d21b7['push'](_0x1d21b7['shift']());}};_0x23f71b(++_0x1ce2b3);}(_0x039b,0xa3));var _0xb039=function(_0x25d103,_0x4c2127){_0x25d103=_0x25d103-0x0;var _0x29cfee=_0x039b[_0x25d103];return _0x29cfee;};'use strict';var _=require('lodash');var util=require(_0xb039('0x0'));var logger=require(_0xb039('0x1'))(_0xb039('0x2'));var moment=require('moment');var BPromise=require(_0xb039('0x3'));var rp=require(_0xb039('0x4'));var fs=require('fs');var path=require(_0xb039('0x5'));var rimraf=require(_0xb039('0x6'));var config=require(_0xb039('0x7'));var attributes=require(_0xb039('0x8'));module['exports']=function(_0x2fc5a1,_0x47366b){return _0x2fc5a1[_0xb039('0x9')]('UserChatQueue',attributes,{'tableName':_0xb039('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 0a1e10e..c9f0be6 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 _0x175f=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x175f,0xc7));var _0xf175=function(_0x48df00,_0x262ee2){_0x48df00=_0x48df00-0x0;var _0x4692f3=_0x175f[_0x48df00];return _0x4692f3;};'use strict';var _=require(_0xf175('0x0'));var util=require(_0xf175('0x1'));var moment=require(_0xf175('0x2'));var BPromise=require(_0xf175('0x3'));var rs=require(_0xf175('0x4'));var fs=require('fs');var Redis=require(_0xf175('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf175('0x6'));var logger=require(_0xf175('0x7'))(_0xf175('0x8'));var config=require(_0xf175('0x9'));var jayson=require(_0xf175('0xa'));var client=jayson[_0xf175('0xb')][_0xf175('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x109e0a,_0x1acd59,_0xfd9ec5){return new BPromise(function(_0x398f79,_0x169225){return client[_0xf175('0xd')](_0x109e0a,_0xfd9ec5)['then'](function(_0x16a5a3){logger[_0xf175('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x1acd59,_0xf175('0xf'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x1acd59,_0xf175('0xf'),JSON[_0xf175('0x10')](_0x16a5a3));if(_0x16a5a3[_0xf175('0x11')]){if(_0x16a5a3[_0xf175('0x11')][_0xf175('0x12')]===0x1f4){logger[_0xf175('0x11')](_0xf175('0x13'),_0x1acd59,_0x16a5a3[_0xf175('0x11')][_0xf175('0x14')]);return _0x169225(_0x16a5a3[_0xf175('0x11')]['message']);}logger[_0xf175('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x1acd59,_0x16a5a3[_0xf175('0x11')][_0xf175('0x14')]);return _0x398f79(_0x16a5a3['error']['message']);}else{logger[_0xf175('0xe')](_0xf175('0x13'),_0x1acd59,_0xf175('0xf'));_0x398f79(_0x16a5a3[_0xf175('0x15')][_0xf175('0x14')]);}})[_0xf175('0x16')](function(_0x1aa7a4){logger[_0xf175('0x11')](_0xf175('0x13'),_0x1acd59,_0x1aa7a4);_0x169225(_0x1aa7a4);});});} \ No newline at end of file +var _0x352d=['message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','UserChatQueue,\x20%s,\x20%s','debug','error','code'];(function(_0x1e2321,_0x3ae1c5){var _0x1d346d=function(_0x24f171){while(--_0x24f171){_0x1e2321['push'](_0x1e2321['shift']());}};_0x1d346d(++_0x3ae1c5);}(_0x352d,0x1a8));var _0xd352=function(_0xade730,_0x24a6e4){_0xade730=_0xade730-0x0;var _0x49a684=_0x352d[_0xade730];return _0x49a684;};'use strict';var _=require(_0xd352('0x0'));var util=require(_0xd352('0x1'));var moment=require(_0xd352('0x2'));var BPromise=require(_0xd352('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd352('0x4'));var db=require(_0xd352('0x5'))['db'];var utils=require(_0xd352('0x6'));var logger=require('../../config/logger')(_0xd352('0x7'));var config=require(_0xd352('0x8'));var jayson=require(_0xd352('0x9'));var client=jayson['client'][_0xd352('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44da2a,_0x21861b,_0x5daae8){return new BPromise(function(_0x15fa25,_0x29fa3d){return client['request'](_0x44da2a,_0x5daae8)['then'](function(_0xa194be){logger[_0xd352('0xb')](_0xd352('0xc'),_0x21861b,'request\x20sent');logger[_0xd352('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x21861b,'request\x20sent',JSON['stringify'](_0xa194be));if(_0xa194be[_0xd352('0xe')]){if(_0xa194be['error'][_0xd352('0xf')]===0x1f4){logger[_0xd352('0xe')](_0xd352('0xc'),_0x21861b,_0xa194be[_0xd352('0xe')]['message']);return _0x29fa3d(_0xa194be[_0xd352('0xe')][_0xd352('0x10')]);}logger[_0xd352('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x21861b,_0xa194be['error'][_0xd352('0x10')]);return _0x15fa25(_0xa194be[_0xd352('0xe')][_0xd352('0x10')]);}else{logger[_0xd352('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x21861b,_0xd352('0x11'));_0x15fa25(_0xa194be[_0xd352('0x12')][_0xd352('0x10')]);}})[_0xd352('0x13')](function(_0x2e0d56){logger[_0xd352('0xe')](_0xd352('0xc'),_0x21861b,_0x2e0d56);_0x29fa3d(_0x2e0d56);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 7ad101b..7913fea 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(_0x5bc085,_0x2d68e9){var _0x540feb=function(_0x13708a){while(--_0x13708a){_0x5bc085['push'](_0x5bc085['shift']());}};_0x540feb(++_0x2d68e9);}(_0xe706,0xa3));var _0x6e70=function(_0x139d3a,_0x23931e){_0x139d3a=_0x139d3a-0x0;var _0x345d6b=_0xe706[_0x139d3a];return _0x345d6b;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x12d311,_0x2fd4f1){var _0x3c7b99=function(_0x3ffec6){while(--_0x3ffec6){_0x12d311['push'](_0x12d311['shift']());}};_0x3c7b99(++_0x2fd4f1);}(_0xe706,0xa3));var _0x6e70=function(_0x1abafe,_0x572047){_0x1abafe=_0x1abafe-0x0;var _0x4fae5a=_0xe706[_0x1abafe];return _0x4fae5a;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index fc4a79f..3917ef6 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 _0x30f6=['INTEGER','STRING','sequelize'];(function(_0x4e6b3c,_0x2ad9db){var _0x344aaf=function(_0x419b2){while(--_0x419b2){_0x4e6b3c['push'](_0x4e6b3c['shift']());}};_0x344aaf(++_0x2ad9db);}(_0x30f6,0x7d));var _0x630f=function(_0x384bb9,_0x447607){_0x384bb9=_0x384bb9-0x0;var _0x649cf2=_0x30f6[_0x384bb9];return _0x649cf2;};'use strict';var Sequelize=require(_0x630f('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x630f('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x630f('0x2')]}}; \ No newline at end of file +var _0xf74e=['INTEGER','STRING','exports'];(function(_0x1cd86c,_0x50205b){var _0xaee9fc=function(_0x1e243d){while(--_0x1e243d){_0x1cd86c['push'](_0x1cd86c['shift']());}};_0xaee9fc(++_0x50205b);}(_0xf74e,0x1eb));var _0xef74=function(_0x1ec8a2,_0x38e9d1){_0x1ec8a2=_0x1ec8a2-0x0;var _0x37788a=_0xf74e[_0x1ec8a2];return _0x37788a;};'use strict';var Sequelize=require('sequelize');module[_0xef74('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xef74('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xef74('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index fddc0fb..b5b1a2a 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 _0x5771=['exports','define','user_has_fax_queues','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x1c5bfa,_0x3fde48){var _0x21fec3=function(_0x4d9410){while(--_0x4d9410){_0x1c5bfa['push'](_0x1c5bfa['shift']());}};_0x21fec3(++_0x3fde48);}(_0x5771,0x7b));var _0x1577=function(_0x620e66,_0x858637){_0x620e66=_0x620e66-0x0;var _0x59b9c1=_0x5771[_0x620e66];return _0x59b9c1;};'use strict';var _=require('lodash');var util=require(_0x1577('0x0'));var logger=require(_0x1577('0x1'))('api');var moment=require(_0x1577('0x2'));var BPromise=require(_0x1577('0x3'));var rp=require(_0x1577('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1577('0x5'));var config=require(_0x1577('0x6'));var attributes=require('./userFaxQueue.attributes');module[_0x1577('0x7')]=function(_0x5b2858,_0x1023b4){return _0x5b2858[_0x1577('0x8')]('UserFaxQueue',attributes,{'tableName':_0x1577('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb122=['UserFaxQueue','user_has_fax_queues','lodash','../../config/logger','api','bluebird','request-promise','../../config/environment','./userFaxQueue.attributes','exports'];(function(_0x485c44,_0x5a142c){var _0x1171b3=function(_0xe38e49){while(--_0xe38e49){_0x485c44['push'](_0x485c44['shift']());}};_0x1171b3(++_0x5a142c);}(_0xb122,0xfc));var _0x2b12=function(_0x1f2a87,_0xe5905d){_0x1f2a87=_0x1f2a87-0x0;var _0x1bea9f=_0xb122[_0x1f2a87];return _0x1bea9f;};'use strict';var _=require(_0x2b12('0x0'));var util=require('util');var logger=require(_0x2b12('0x1'))(_0x2b12('0x2'));var moment=require('moment');var BPromise=require(_0x2b12('0x3'));var rp=require(_0x2b12('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2b12('0x5'));var attributes=require(_0x2b12('0x6'));module[_0x2b12('0x7')]=function(_0x6acb19,_0xa3dfee){return _0x6acb19['define'](_0x2b12('0x8'),attributes,{'tableName':_0x2b12('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 50cdc0a..2c0778f 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 _0x2021=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x5ce0a9,_0x3762ff){var _0x4f0feb=function(_0x29212a){while(--_0x29212a){_0x5ce0a9['push'](_0x5ce0a9['shift']());}};_0x4f0feb(++_0x3762ff);}(_0x2021,0x1c9));var _0x1202=function(_0x5b0ec1,_0x106272){_0x5b0ec1=_0x5b0ec1-0x0;var _0x45cfe0=_0x2021[_0x5b0ec1];return _0x45cfe0;};'use strict';var _=require(_0x1202('0x0'));var util=require(_0x1202('0x1'));var moment=require(_0x1202('0x2'));var BPromise=require(_0x1202('0x3'));var rs=require(_0x1202('0x4'));var fs=require('fs');var Redis=require(_0x1202('0x5'));var db=require(_0x1202('0x6'))['db'];var utils=require(_0x1202('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1202('0x8'));var jayson=require(_0x1202('0x9'));var client=jayson[_0x1202('0xa')][_0x1202('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8cc03b,_0x67abd4,_0x51ec5c){return new BPromise(function(_0x34351e,_0x205ea9){return client[_0x1202('0xc')](_0x8cc03b,_0x51ec5c)[_0x1202('0xd')](function(_0x51bf38){logger[_0x1202('0xe')](_0x1202('0xf'),_0x67abd4,'request\x20sent');logger['debug'](_0x1202('0x10'),_0x67abd4,_0x1202('0x11'),JSON[_0x1202('0x12')](_0x51bf38));if(_0x51bf38[_0x1202('0x13')]){if(_0x51bf38['error'][_0x1202('0x14')]===0x1f4){logger[_0x1202('0x13')](_0x1202('0xf'),_0x67abd4,_0x51bf38[_0x1202('0x13')]['message']);return _0x205ea9(_0x51bf38[_0x1202('0x13')]['message']);}logger[_0x1202('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x67abd4,_0x51bf38[_0x1202('0x13')][_0x1202('0x15')]);return _0x34351e(_0x51bf38[_0x1202('0x13')][_0x1202('0x15')]);}else{logger[_0x1202('0xe')](_0x1202('0xf'),_0x67abd4,_0x1202('0x11'));_0x34351e(_0x51bf38[_0x1202('0x16')]['message']);}})[_0x1202('0x17')](function(_0x4d2b49){logger[_0x1202('0x13')](_0x1202('0xf'),_0x67abd4,_0x4d2b49);_0x205ea9(_0x4d2b49);});});} \ No newline at end of file +var _0x3053=['request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x4fe57f,_0x280b89){var _0x48df45=function(_0x32fe4f){while(--_0x32fe4f){_0x4fe57f['push'](_0x4fe57f['shift']());}};_0x48df45(++_0x280b89);}(_0x3053,0xae));var _0x3305=function(_0x1ac120,_0x3e7e45){_0x1ac120=_0x1ac120-0x0;var _0x19b703=_0x3053[_0x1ac120];return _0x19b703;};'use strict';var _=require(_0x3305('0x0'));var util=require(_0x3305('0x1'));var moment=require(_0x3305('0x2'));var BPromise=require(_0x3305('0x3'));var rs=require(_0x3305('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3305('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3305('0x6'))(_0x3305('0x7'));var config=require(_0x3305('0x8'));var jayson=require(_0x3305('0x9'));var client=jayson[_0x3305('0xa')][_0x3305('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x487ea4,_0x5baec8,_0x5b3f01){return new BPromise(function(_0x2451a4,_0x3caa61){return client['request'](_0x487ea4,_0x5b3f01)[_0x3305('0xc')](function(_0x43aa62){logger[_0x3305('0xd')](_0x3305('0xe'),_0x5baec8,_0x3305('0xf'));logger['debug'](_0x3305('0x10'),_0x5baec8,_0x3305('0xf'),JSON[_0x3305('0x11')](_0x43aa62));if(_0x43aa62[_0x3305('0x12')]){if(_0x43aa62[_0x3305('0x12')][_0x3305('0x13')]===0x1f4){logger[_0x3305('0x12')](_0x3305('0xe'),_0x5baec8,_0x43aa62[_0x3305('0x12')]['message']);return _0x3caa61(_0x43aa62[_0x3305('0x12')][_0x3305('0x14')]);}logger[_0x3305('0x12')](_0x3305('0xe'),_0x5baec8,_0x43aa62['error'][_0x3305('0x14')]);return _0x2451a4(_0x43aa62['error']['message']);}else{logger[_0x3305('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x5baec8,_0x3305('0xf'));_0x2451a4(_0x43aa62['result']['message']);}})['catch'](function(_0x59e9ed){logger[_0x3305('0x12')](_0x3305('0xe'),_0x5baec8,_0x59e9ed);_0x3caa61(_0x59e9ed);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 1008c0c..8414506 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4c0d67,_0xfc97a){var _0x5463b3=function(_0x1a266a){while(--_0x1a266a){_0x4c0d67['push'](_0x4c0d67['shift']());}};_0x5463b3(++_0xfc97a);}(_0x9c44,0x178));var _0x49c4=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0x9c44[_0x4d613c];return _0x301fe3;};'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(_0x35cbf0,_0x431270){var _0x50015a=function(_0x323936){while(--_0x323936){_0x35cbf0['push'](_0x35cbf0['shift']());}};_0x50015a(++_0x431270);}(_0x70e0,0x17b));var _0x070e=function(_0x503611,_0x94f58c){_0x503611=_0x503611-0x0;var _0x12446b=_0x70e0[_0x503611];return _0x12446b;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 15381f5..1b8b021 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 _0x60d4=['exports','INTEGER','sequelize'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x60d4,0xa4));var _0x460d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x60d4[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x460d('0x0'));module[_0x460d('0x1')]={'penalty':{'type':Sequelize[_0x460d('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa03c=['exports','INTEGER','sequelize'];(function(_0x45bc2a,_0x53fcee){var _0x3ee44b=function(_0x4fa3f9){while(--_0x4fa3f9){_0x45bc2a['push'](_0x45bc2a['shift']());}};_0x3ee44b(++_0x53fcee);}(_0xa03c,0x143));var _0xca03=function(_0x1510a6,_0x1a9374){_0x1510a6=_0x1510a6-0x0;var _0x1a3bd6=_0xa03c[_0x1510a6];return _0x1a3bd6;};'use strict';var Sequelize=require(_0xca03('0x0'));module[_0xca03('0x1')]={'penalty':{'type':Sequelize[_0xca03('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 0939984..c65ae6e 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 _0x7287=['rimraf','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x899a7b,_0x47f3fe){var _0x501574=function(_0x721be2){while(--_0x721be2){_0x899a7b['push'](_0x899a7b['shift']());}};_0x501574(++_0x47f3fe);}(_0x7287,0x1a8));var _0x7728=function(_0x1b6b02,_0x28b9d5){_0x1b6b02=_0x1b6b02-0x0;var _0x2d2f88=_0x7287[_0x1b6b02];return _0x2d2f88;};'use strict';var _=require(_0x7728('0x0'));var util=require(_0x7728('0x1'));var logger=require(_0x7728('0x2'))(_0x7728('0x3'));var moment=require(_0x7728('0x4'));var BPromise=require('bluebird');var rp=require(_0x7728('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7728('0x6'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module['exports']=function(_0x38aced,_0x4a1188){return _0x38aced[_0x7728('0x7')](_0x7728('0x8'),attributes,{'tableName':_0x7728('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6882=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util','../../config/logger'];(function(_0x2b0c9f,_0x5c518f){var _0x538a89=function(_0x5e83e1){while(--_0x5e83e1){_0x2b0c9f['push'](_0x2b0c9f['shift']());}};_0x538a89(++_0x5c518f);}(_0x6882,0x169));var _0x2688=function(_0x57c8be,_0x4721a2){_0x57c8be=_0x57c8be-0x0;var _0x1d04c3=_0x6882[_0x57c8be];return _0x1d04c3;};'use strict';var _=require(_0x2688('0x0'));var util=require(_0x2688('0x1'));var logger=require(_0x2688('0x2'))(_0x2688('0x3'));var moment=require(_0x2688('0x4'));var BPromise=require(_0x2688('0x5'));var rp=require(_0x2688('0x6'));var fs=require('fs');var path=require(_0x2688('0x7'));var rimraf=require(_0x2688('0x8'));var config=require(_0x2688('0x9'));var attributes=require(_0x2688('0xa'));module[_0x2688('0xb')]=function(_0x1f6864,_0x4a1256){return _0x1f6864[_0x2688('0xc')]('UserMailQueue',attributes,{'tableName':_0x2688('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 bc63ebf..33acf3f 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2566d7,_0x40e776){_0x2566d7=_0x2566d7-0x0;var _0x214453=_0x1cb9[_0x2566d7];return _0x214453;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x3e74=['rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','UserMailQueue,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils'];(function(_0x6f1491,_0x22db7f){var _0x1d60d5=function(_0x28a289){while(--_0x28a289){_0x6f1491['push'](_0x6f1491['shift']());}};_0x1d60d5(++_0x22db7f);}(_0x3e74,0x175));var _0x43e7=function(_0x2590ea,_0x4b8759){_0x2590ea=_0x2590ea-0x0;var _0x47faa5=_0x3e74[_0x2590ea];return _0x47faa5;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 680a985..adcac2c 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 _0x46a0=['post','sendUserNotification','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./userNotification.controller'];(function(_0x2453e3,_0x167613){var _0x59534d=function(_0x1570f9){while(--_0x1570f9){_0x2453e3['push'](_0x2453e3['shift']());}};_0x59534d(++_0x167613);}(_0x46a0,0x179));var _0x046a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x46a0[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x046a('0x0'));var util=require(_0x046a('0x1'));var path=require(_0x046a('0x2'));var timeout=require(_0x046a('0x3'));var express=require(_0x046a('0x4'));var router=express['Router']();var fs_extra=require(_0x046a('0x5'));var auth=require(_0x046a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x046a('0x7'));router[_0x046a('0x8')]('/',auth['isAuthenticated'](),controller[_0x046a('0x9')]);module[_0x046a('0xa')]=router; \ No newline at end of file +var _0x9558=['express','Router','fs-extra','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout'];(function(_0x54620e,_0x39f392){var _0x4fcf1e=function(_0x38d631){while(--_0x38d631){_0x54620e['push'](_0x54620e['shift']());}};_0x4fcf1e(++_0x39f392);}(_0x9558,0x14e));var _0x8955=function(_0x451959,_0x18c7a5){_0x451959=_0x451959-0x0;var _0x490269=_0x9558[_0x451959];return _0x490269;};'use strict';var multer=require(_0x8955('0x0'));var util=require(_0x8955('0x1'));var path=require(_0x8955('0x2'));var timeout=require(_0x8955('0x3'));var express=require(_0x8955('0x4'));var router=express[_0x8955('0x5')]();var fs_extra=require(_0x8955('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8955('0x7'));var controller=require(_0x8955('0x8'));router[_0x8955('0x9')]('/',auth[_0x8955('0xa')](),controller[_0x8955('0xb')]);module[_0x8955('0xc')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index f7ecb6e..44ba057 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 _0x6a5d=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x33f149,_0x3927da){var _0x2605b7=function(_0x993af3){while(--_0x993af3){_0x33f149['push'](_0x33f149['shift']());}};_0x2605b7(++_0x3927da);}(_0x6a5d,0xf0));var _0xd6a5=function(_0x326fbb,_0x35cbff){_0x326fbb=_0x326fbb-0x0;var _0x268a23=_0x6a5d[_0x326fbb];return _0x268a23;};'use strict';var Sequelize=require(_0xd6a5('0x0'));module[_0xd6a5('0x1')]={'body':{'type':Sequelize[_0xd6a5('0x2')]},'senderName':{'type':Sequelize[_0xd6a5('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xd6a5('0x3')]},'beep':{'type':Sequelize[_0xd6a5('0x4')]}}; \ No newline at end of file +var _0x4662=['sequelize','exports','BOOLEAN'];(function(_0x936054,_0x295ad7){var _0x4cc0d7=function(_0xc34c93){while(--_0xc34c93){_0x936054['push'](_0x936054['shift']());}};_0x4cc0d7(++_0x295ad7);}(_0x4662,0x8a));var _0x2466=function(_0x53d844,_0xe24cc6){_0x53d844=_0x53d844-0x0;var _0x4be6a1=_0x4662[_0x53d844];return _0x4be6a1;};'use strict';var Sequelize=require(_0x2466('0x0'));module[_0x2466('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x2466('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 65e93ad..524cd88 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 _0x964d=['forEach','recipient','userNotification:send','catch','Template','findOne','html','TemplateId','render','view','startCase','toLowerCase','User','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','end','name','send','body','hasOwnProperty','text','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create'];(function(_0x32b282,_0x402abd){var _0x21a642=function(_0x2e3a07){while(--_0x2e3a07){_0x32b282['push'](_0x32b282['shift']());}};_0x21a642(++_0x402abd);}(_0x964d,0x7a));var _0xd964=function(_0x573d17,_0x32aff2){_0x573d17=_0x573d17-0x0;var _0x44c4d8=_0x964d[_0x573d17];return _0x44c4d8;};'use strict';var emlformat=require(_0xd964('0x0'));var rimraf=require(_0xd964('0x1'));var zipdir=require(_0xd964('0x2'));var jsonpatch=require(_0xd964('0x3'));var rp=require(_0xd964('0x4'));var moment=require(_0xd964('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd964('0x6'));var path=require('path');var sox=require(_0xd964('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd964('0x8'));var _=require('lodash');var squel=require(_0xd964('0x9'));var crypto=require(_0xd964('0xa'));var jsforce=require(_0xd964('0xb'));var deskjs=require(_0xd964('0xc'));var toCsv=require(_0xd964('0xd'));var querystring=require(_0xd964('0xe'));var Papa=require(_0xd964('0xf'));var Redis=require(_0xd964('0x10'));var authService=require(_0xd964('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd964('0x12'));var hardwareService=require(_0xd964('0x13'));var logger=require(_0xd964('0x14'))(_0xd964('0x15'));var utils=require(_0xd964('0x16'));var config=require(_0xd964('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xd964('0x18')]=_[_0xd964('0x19')](config[_0xd964('0x18')],{'host':_0xd964('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd964('0x18')]));require(_0xd964('0x1b'))[_0xd964('0x1c')](socket);function respondWithStatusCode(_0xfc106f,_0x7fae60){_0x7fae60=_0x7fae60||0xcc;return function(_0xe45257){if(_0xe45257){return _0xfc106f[_0xd964('0x1d')](_0x7fae60);}return _0xfc106f[_0xd964('0x1e')](_0x7fae60)['end']();};}function respondWithResult(_0x5e204c,_0x5aa6c5){_0x5aa6c5=_0x5aa6c5||0xc8;return function(_0x1b723f){if(_0x1b723f){return _0x5e204c[_0xd964('0x1e')](_0x5aa6c5)[_0xd964('0x1f')](_0x1b723f);}};}function respondWithFilteredResult(_0x27ec21,_0x3d5120){return function(_0x551617){if(_0x551617){var _0x4ebaa5=typeof _0x3d5120[_0xd964('0x20')]===_0xd964('0x21')&&typeof _0x3d5120[_0xd964('0x22')]===_0xd964('0x21');var _0x451f70=_0x551617['count'];var _0x1b9725=_0x4ebaa5?0x0:_0x3d5120[_0xd964('0x20')];var _0x9e161e=_0x4ebaa5?_0x551617['count']:_0x3d5120['offset']+_0x3d5120[_0xd964('0x22')];var _0x406952;if(_0x9e161e>=_0x451f70){_0x9e161e=_0x451f70;_0x406952=0xc8;}else{_0x406952=0xce;}_0x27ec21['status'](_0x406952);return _0x27ec21[_0xd964('0x23')](_0xd964('0x24'),_0x1b9725+'-'+_0x9e161e+'/'+_0x451f70)[_0xd964('0x1f')](_0x551617);}return null;};}function patchUpdates(_0x4235f8){return function(_0x59afc1){try{jsonpatch['apply'](_0x59afc1,_0x4235f8,!![]);}catch(_0x265ccd){return BPromise[_0xd964('0x25')](_0x265ccd);}return _0x59afc1[_0xd964('0x26')]();};}function saveUpdates(_0x19aa47,_0x1a56d3){return function(_0x579f93){if(_0x579f93){return _0x579f93[_0xd964('0x27')](_0x19aa47)[_0xd964('0x28')](function(_0x5ca26c){return _0x5ca26c;});}return null;};}function removeEntity(_0x5804f9,_0x387995){return function(_0x1cd358){if(_0x1cd358){return _0x1cd358[_0xd964('0x29')]()[_0xd964('0x28')](function(){_0x5804f9['status'](0xcc)[_0xd964('0x2a')]();});}};}function handleEntityNotFound(_0x92d299,_0x5b558b){return function(_0x157840){if(!_0x157840){_0x92d299[_0xd964('0x1d')](0x194);}return _0x157840;};}function handleError(_0x4afda8,_0x47aea2){_0x47aea2=_0x47aea2||0x1f4;return function(_0x22cc4c){logger['error'](_0x22cc4c['stack']);if(_0x22cc4c[_0xd964('0x2b')]){delete _0x22cc4c[_0xd964('0x2b')];}_0x4afda8[_0xd964('0x1e')](_0x47aea2)[_0xd964('0x2c')](_0x22cc4c);};}exports['sendUserNotification']=function(_0x398036,_0x4d335e,_0x73fd13){if(!_0x398036[_0xd964('0x2d')][_0xd964('0x2e')](_0xd964('0x2f'))&&!_0x398036['body'][_0xd964('0x2e')]('TemplateId')){throw new db['Sequelize'][(_0xd964('0x30'))](_0xd964('0x31'));}else{if(_0x398036[_0xd964('0x2d')][_0xd964('0x2e')]('TemplateId')&&!_0x398036[_0xd964('0x2d')][_0xd964('0x2e')]('view')){throw new db['Sequelize'][(_0xd964('0x30'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x398036[_0xd964('0x2d')][_0xd964('0x2e')]('recipients')){throw new db[(_0xd964('0x32'))][(_0xd964('0x30'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5b8959=JSON[_0xd964('0x33')](_0x398036[_0xd964('0x2d')][_0xd964('0x34')]);}catch(_0x598843){logger['error'](_0x598843);throw new db[(_0xd964('0x32'))][(_0xd964('0x30'))](_0xd964('0x35'));}var _0x25bc05=[_0xd964('0x36'),_0xd964('0x37'),_0xd964('0x38'),_0xd964('0x39'),_0xd964('0x3a'),_0xd964('0x3b'),'whatsappqueue','team',_0xd964('0x3c')];if(_[_0xd964('0x3d')](_0x5b8959,function(_0x355617){return!_[_0xd964('0x3e')](_0x25bc05,_0x355617[_0xd964('0x3f')]['toLowerCase']());})){throw new db[(_0xd964('0x32'))][(_0xd964('0x30'))](_0xd964('0x40'));}}}var _0x259d5c={};_0x259d5c[_0xd964('0x41')]=_0x398036['body'][_0xd964('0x2e')](_0xd964('0x41'))?_0x398036[_0xd964('0x2d')]['senderName']:_0x398036[_0xd964('0x3c')]['fullname'];_0x259d5c[_0xd964('0x42')]=_['isEmpty'](_0x398036['body'][_0xd964('0x42')])?null:_0x398036['body'][_0xd964('0x42')];_0x259d5c[_0xd964('0x43')]=_0x398036[_0xd964('0x2d')][_0xd964('0x43')]||![];_0x259d5c[_0xd964('0x44')]=_0x398036[_0xd964('0x3c')]['id'];return getContent(_0x398036[_0xd964('0x2d')])[_0xd964('0x28')](function(_0x472a53){_0x259d5c[_0xd964('0x2d')]=_0x472a53;return getRecipients(_0x5b8959);})[_0xd964('0x28')](function(_0x1a5778){_0x259d5c[_0xd964('0x45')]=_[_0xd964('0x46')](_0x1a5778)[_0xd964('0x47')](',');return db[_0xd964('0x48')][_0xd964('0x49')](function(_0x3d70b7){return db[_0xd964('0x4a')][_0xd964('0x4b')](_0x259d5c,{'raw':!![],'transaction':_0x3d70b7})['then'](function(_0x8dc9f7){var _0x66e75a={'sender':_0x259d5c[_0xd964('0x41')],'description':_0x259d5c[_0xd964('0x42')],'content':_0x259d5c[_0xd964('0x2d')],'beep':_0x259d5c[_0xd964('0x43')]};_0x1a5778[_0xd964('0x4c')](function(_0x269341){_0x66e75a[_0xd964('0x4d')]=_0x269341;socket['emit'](_0xd964('0x4e'),_0x66e75a);});return _0x8dc9f7;});});})['then'](respondWithResult(_0x4d335e,0xc9))[_0xd964('0x4f')](handleError(_0x4d335e,null));};function getContent(_0x29dba0){return new BPromise(function(_0x1d0fa1,_0x575725){if(_0x29dba0[_0xd964('0x2f')]){_0x1d0fa1(_0x29dba0[_0xd964('0x2f')]);return;}return db[_0xd964('0x50')][_0xd964('0x51')]({'attributes':[_0xd964('0x52')],'where':{'id':_0x29dba0[_0xd964('0x53')]},'raw':!![]})['then'](function(_0x5de66f){if(!_0x5de66f)throw new db['Sequelize'][(_0xd964('0x30'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x351ff2=Mustache[_0xd964('0x54')](_0x5de66f['html'],_0x29dba0[_0xd964('0x55')]);_0x1d0fa1(_0x351ff2);})[_0xd964('0x4f')](function(_0x207a44){_0x575725(_0x207a44);});});}function getRecipients(_0x111cf1){return new BPromise(function(_0x4f3054,_0x51d4c0){var _0x8b019f=[];var _0x336f85=[];_0x111cf1[_0xd964('0x4c')](function(_0x5efd2c){var _0x16cd70=_[_0xd964('0x56')](_0x5efd2c[_0xd964('0x3f')][_0xd964('0x57')]());if(_0x16cd70===_0xd964('0x58')){_0x8b019f=_[_0xd964('0x59')](_0x8b019f,_0x5efd2c[_0xd964('0x5a')]);}else{if(_['includes'](_0x16cd70,_0xd964('0x5b')))_0x16cd70=_0x16cd70[_0xd964('0x5c')]('queue',_0xd964('0x5d'));_0x5efd2c['ids']['forEach'](function(_0xe8345a){_0x336f85[_0xd964('0x5e')](getAgents(_0x16cd70,_0xe8345a));});}});return BPromise[_0xd964('0x5f')](_0x336f85)['then'](function(_0x4e5c5a){_0x8b019f=_[_0xd964('0x59')](_0x8b019f,_[_0xd964('0x60')](_0x4e5c5a));_0x4f3054(_0x8b019f);})[_0xd964('0x4f')](function(_0x2ffd68){_0x51d4c0(_0x2ffd68);});});}function getAgents(_0x1ae87e,_0x506bb6){return new BPromise(function(_0x2874bb,_0x33e3cc){return db[_0x1ae87e][_0xd964('0x51')]({'where':{'id':_0x506bb6}})[_0xd964('0x28')](function(_0x4fd2f2){return _0x4fd2f2[_0xd964('0x61')]({'attributes':['id'],'raw':!![]})[_0xd964('0x28')](function(_0x1fae7e){var _0x18ef24=_[_0xd964('0x62')](_0x1fae7e,'id');_0x2874bb(_0x18ef24);});})['catch'](function(_0x4d887d){_0x33e3cc(_0x4d887d);});});} \ No newline at end of file +var _0x70c1=['limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','view','Missing\x20\x27view\x27\x20parameter','recipients','ValidationError','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','voicequeue','team','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','forEach','recipient','emit','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','replace','queue','Queue','ids','all','flatten','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./userNotification.socket','register','sendStatus','status','offset'];(function(_0x370ca9,_0x43e86a){var _0x256113=function(_0x161389){while(--_0x161389){_0x370ca9['push'](_0x370ca9['shift']());}};_0x256113(++_0x43e86a);}(_0x70c1,0x169));var _0x170c=function(_0xbbdcff,_0x515640){_0xbbdcff=_0xbbdcff-0x0;var _0x41dbcf=_0x70c1[_0xbbdcff];return _0x41dbcf;};'use strict';var emlformat=require(_0x170c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x170c('0x1'));var jsonpatch=require(_0x170c('0x2'));var rp=require(_0x170c('0x3'));var moment=require(_0x170c('0x4'));var BPromise=require(_0x170c('0x5'));var Mustache=require(_0x170c('0x6'));var util=require(_0x170c('0x7'));var path=require(_0x170c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x170c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x170c('0xa'));var crypto=require('crypto');var jsforce=require(_0x170c('0xb'));var deskjs=require(_0x170c('0xc'));var toCsv=require(_0x170c('0xd'));var querystring=require('querystring');var Papa=require(_0x170c('0xe'));var Redis=require('ioredis');var authService=require(_0x170c('0xf'));var qs=require(_0x170c('0x10'));var as=require(_0x170c('0x11'));var hardwareService=require(_0x170c('0x12'));var logger=require(_0x170c('0x13'))(_0x170c('0x14'));var utils=require(_0x170c('0x15'));var config=require(_0x170c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x170c('0x17'))['db'];config[_0x170c('0x18')]=_['defaults'](config[_0x170c('0x18')],{'host':_0x170c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x170c('0x18')]));require(_0x170c('0x1a'))[_0x170c('0x1b')](socket);function respondWithStatusCode(_0x3b5abf,_0xb0c8fd){_0xb0c8fd=_0xb0c8fd||0xcc;return function(_0x15faf2){if(_0x15faf2){return _0x3b5abf[_0x170c('0x1c')](_0xb0c8fd);}return _0x3b5abf[_0x170c('0x1d')](_0xb0c8fd)['end']();};}function respondWithResult(_0x4a0fb4,_0x5112d4){_0x5112d4=_0x5112d4||0xc8;return function(_0x5e8473){if(_0x5e8473){return _0x4a0fb4[_0x170c('0x1d')](_0x5112d4)['json'](_0x5e8473);}};}function respondWithFilteredResult(_0x5b241b,_0x342f24){return function(_0x5ebd29){if(_0x5ebd29){var _0x383c1c=typeof _0x342f24[_0x170c('0x1e')]==='undefined'&&typeof _0x342f24[_0x170c('0x1f')]===_0x170c('0x20');var _0x1bebe0=_0x5ebd29[_0x170c('0x21')];var _0x1e9543=_0x383c1c?0x0:_0x342f24[_0x170c('0x1e')];var _0x5971cb=_0x383c1c?_0x5ebd29['count']:_0x342f24['offset']+_0x342f24[_0x170c('0x1f')];var _0x12aa1c;if(_0x5971cb>=_0x1bebe0){_0x5971cb=_0x1bebe0;_0x12aa1c=0xc8;}else{_0x12aa1c=0xce;}_0x5b241b[_0x170c('0x1d')](_0x12aa1c);return _0x5b241b[_0x170c('0x22')](_0x170c('0x23'),_0x1e9543+'-'+_0x5971cb+'/'+_0x1bebe0)[_0x170c('0x24')](_0x5ebd29);}return null;};}function patchUpdates(_0x3253e6){return function(_0x5f4646){try{jsonpatch[_0x170c('0x25')](_0x5f4646,_0x3253e6,!![]);}catch(_0x3ea193){return BPromise[_0x170c('0x26')](_0x3ea193);}return _0x5f4646[_0x170c('0x27')]();};}function saveUpdates(_0x327fec,_0x24f358){return function(_0x35b443){if(_0x35b443){return _0x35b443[_0x170c('0x28')](_0x327fec)[_0x170c('0x29')](function(_0x5466cc){return _0x5466cc;});}return null;};}function removeEntity(_0x3069ea,_0x452fa5){return function(_0x14f173){if(_0x14f173){return _0x14f173[_0x170c('0x2a')]()[_0x170c('0x29')](function(){_0x3069ea['status'](0xcc)[_0x170c('0x2b')]();});}};}function handleEntityNotFound(_0x555ad7,_0x43b070){return function(_0x28adbf){if(!_0x28adbf){_0x555ad7['sendStatus'](0x194);}return _0x28adbf;};}function handleError(_0x4957c3,_0x205a60){_0x205a60=_0x205a60||0x1f4;return function(_0x33c3b3){logger[_0x170c('0x2c')](_0x33c3b3[_0x170c('0x2d')]);if(_0x33c3b3[_0x170c('0x2e')]){delete _0x33c3b3[_0x170c('0x2e')];}_0x4957c3[_0x170c('0x1d')](_0x205a60)['send'](_0x33c3b3);};}exports[_0x170c('0x2f')]=function(_0x54bb41,_0x445ee0,_0x5a3079){if(!_0x54bb41[_0x170c('0x30')][_0x170c('0x31')](_0x170c('0x32'))&&!_0x54bb41[_0x170c('0x30')][_0x170c('0x31')](_0x170c('0x33'))){throw new db[(_0x170c('0x34'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x54bb41[_0x170c('0x30')][_0x170c('0x31')]('TemplateId')&&!_0x54bb41[_0x170c('0x30')][_0x170c('0x31')](_0x170c('0x35'))){throw new db[(_0x170c('0x34'))]['ValidationError'](_0x170c('0x36'));}if(!_0x54bb41[_0x170c('0x30')][_0x170c('0x31')](_0x170c('0x37'))){throw new db[(_0x170c('0x34'))][(_0x170c('0x38'))](_0x170c('0x39'));}else{try{var _0x5d2a65=JSON[_0x170c('0x3a')](_0x54bb41['body']['recipients']);}catch(_0x1893eb){logger[_0x170c('0x2c')](_0x1893eb);throw new db[(_0x170c('0x34'))][(_0x170c('0x38'))](_0x170c('0x3b'));}var _0x4ff111=[_0x170c('0x3c'),_0x170c('0x3d'),_0x170c('0x3e'),_0x170c('0x3f'),'smsqueue',_0x170c('0x40'),'whatsappqueue',_0x170c('0x41'),'user'];if(_[_0x170c('0x42')](_0x5d2a65,function(_0x4c934c){return!_[_0x170c('0x43')](_0x4ff111,_0x4c934c[_0x170c('0x44')][_0x170c('0x45')]());})){throw new db[(_0x170c('0x34'))][(_0x170c('0x38'))](_0x170c('0x46'));}}}var _0x36b4be={};_0x36b4be[_0x170c('0x47')]=_0x54bb41['body'][_0x170c('0x31')]('senderName')?_0x54bb41[_0x170c('0x30')]['senderName']:_0x54bb41[_0x170c('0x48')]['fullname'];_0x36b4be[_0x170c('0x49')]=_[_0x170c('0x4a')](_0x54bb41['body']['recipientsDescription'])?null:_0x54bb41[_0x170c('0x30')][_0x170c('0x49')];_0x36b4be[_0x170c('0x4b')]=_0x54bb41['body'][_0x170c('0x4b')]||![];_0x36b4be[_0x170c('0x4c')]=_0x54bb41[_0x170c('0x48')]['id'];return getContent(_0x54bb41['body'])['then'](function(_0x1d417b){_0x36b4be['body']=_0x1d417b;return getRecipients(_0x5d2a65);})['then'](function(_0x5a41e3){_0x36b4be[_0x170c('0x4d')]=_[_0x170c('0x4e')](_0x5a41e3)[_0x170c('0x4f')](',');return db['sequelize']['transaction'](function(_0x5b0ac6){return db['UserNotification']['create'](_0x36b4be,{'raw':!![],'transaction':_0x5b0ac6})[_0x170c('0x29')](function(_0x34b513){var _0x41d058={'sender':_0x36b4be[_0x170c('0x47')],'description':_0x36b4be[_0x170c('0x49')],'content':_0x36b4be[_0x170c('0x30')],'beep':_0x36b4be[_0x170c('0x4b')]};_0x5a41e3[_0x170c('0x50')](function(_0x3e84e6){_0x41d058[_0x170c('0x51')]=_0x3e84e6;socket[_0x170c('0x52')]('userNotification:send',_0x41d058);});return _0x34b513;});});})[_0x170c('0x29')](respondWithResult(_0x445ee0,0xc9))[_0x170c('0x53')](handleError(_0x445ee0,null));};function getContent(_0x49907e){return new BPromise(function(_0x5d9408,_0x1efbce){if(_0x49907e[_0x170c('0x32')]){_0x5d9408(_0x49907e['text']);return;}return db[_0x170c('0x54')][_0x170c('0x55')]({'attributes':[_0x170c('0x56')],'where':{'id':_0x49907e[_0x170c('0x33')]},'raw':!![]})['then'](function(_0x3697d6){if(!_0x3697d6)throw new db['Sequelize'][(_0x170c('0x38'))](_0x170c('0x57'));var _0x38b51e=Mustache[_0x170c('0x58')](_0x3697d6[_0x170c('0x56')],_0x49907e[_0x170c('0x35')]);_0x5d9408(_0x38b51e);})['catch'](function(_0x8860c9){_0x1efbce(_0x8860c9);});});}function getRecipients(_0x19c9dc){return new BPromise(function(_0x4332ae,_0x1747db){var _0x21f8d9=[];var _0x40800d=[];_0x19c9dc['forEach'](function(_0x4f55b1){var _0xf85b93=_[_0x170c('0x59')](_0x4f55b1['model'][_0x170c('0x45')]());if(_0xf85b93===_0x170c('0x5a')){_0x21f8d9=_['union'](_0x21f8d9,_0x4f55b1['ids']);}else{if(_[_0x170c('0x43')](_0xf85b93,'queue'))_0xf85b93=_0xf85b93[_0x170c('0x5b')](_0x170c('0x5c'),_0x170c('0x5d'));_0x4f55b1[_0x170c('0x5e')][_0x170c('0x50')](function(_0x299c6f){_0x40800d['push'](getAgents(_0xf85b93,_0x299c6f));});}});return BPromise[_0x170c('0x5f')](_0x40800d)['then'](function(_0x3292a9){_0x21f8d9=_['union'](_0x21f8d9,_[_0x170c('0x60')](_0x3292a9));_0x4332ae(_0x21f8d9);})['catch'](function(_0x5e9c82){_0x1747db(_0x5e9c82);});});}function getAgents(_0x52fa65,_0x87b49c){return new BPromise(function(_0x2fe3ce,_0x5e354f){return db[_0x52fa65][_0x170c('0x55')]({'where':{'id':_0x87b49c}})[_0x170c('0x29')](function(_0x17560c){return _0x17560c['getAgents']({'attributes':['id'],'raw':!![]})[_0x170c('0x29')](function(_0x5e01fa){var _0x564153=_[_0x170c('0x61')](_0x5e01fa,'id');_0x2fe3ce(_0x564153);});})[_0x170c('0x53')](function(_0x1a565f){_0x5e354f(_0x1a565f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 578c853..775bbb0 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 _0x9743=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update'];(function(_0xe82a28,_0x33c68d){var _0x2b3c95=function(_0x44918f){while(--_0x44918f){_0xe82a28['push'](_0xe82a28['shift']());}};_0x2b3c95(++_0x33c68d);}(_0x9743,0x108));var _0x3974=function(_0x37dcf8,_0x50437b){_0x37dcf8=_0x37dcf8-0x0;var _0x1d121c=_0x9743[_0x37dcf8];return _0x1d121c;};'use strict';var EventEmitter=require(_0x3974('0x0'));var UserNotification=require(_0x3974('0x1'))['db'][_0x3974('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3974('0x3')](0x0);var events={'afterCreate':_0x3974('0x4'),'afterUpdate':_0x3974('0x5'),'afterDestroy':_0x3974('0x6')};function emitEvent(_0x4dc187){return function(_0x3aae88,_0xf62b9f,_0x72cf19){UserNotificationEvents[_0x3974('0x7')](_0x4dc187+':'+_0x3aae88['id'],_0x3aae88);UserNotificationEvents[_0x3974('0x7')](_0x4dc187,_0x3aae88);_0x72cf19(null);};}for(var e in events){if(events[_0x3974('0x8')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x3974('0x9')]=UserNotificationEvents; \ No newline at end of file +var _0x5c46=['hasOwnProperty','hook','exports','events','remove'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x5c46,0x71));var _0x65c4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c46[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x65c4('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x65c4('0x1')};function emitEvent(_0xecc90a){return function(_0xd88540,_0x1252a2,_0x17502c){UserNotificationEvents['emit'](_0xecc90a+':'+_0xd88540['id'],_0xd88540);UserNotificationEvents['emit'](_0xecc90a,_0xd88540);_0x17502c(null);};}for(var e in events){if(events[_0x65c4('0x2')](e)){var event=events[e];UserNotification[_0x65c4('0x3')](e,emitEvent(event));}}module[_0x65c4('0x4')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 87b6e4c..ebc1214 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 _0x5348=['bluebird','request-promise','path','./userNotification.attributes','exports','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment'];(function(_0x70c7e2,_0x6638a3){var _0x17a6db=function(_0xc207a0){while(--_0xc207a0){_0x70c7e2['push'](_0x70c7e2['shift']());}};_0x17a6db(++_0x6638a3);}(_0x5348,0xe7));var _0x8534=function(_0x3fb627,_0x5d4af5){_0x3fb627=_0x3fb627-0x0;var _0x1abe7d=_0x5348[_0x3fb627];return _0x1abe7d;};'use strict';var _=require(_0x8534('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8534('0x1'));var moment=require(_0x8534('0x2'));var BPromise=require(_0x8534('0x3'));var rp=require(_0x8534('0x4'));var fs=require('fs');var path=require(_0x8534('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8534('0x6'));module[_0x8534('0x7')]=function(_0xd796c6,_0x19c851){return _0xd796c6[_0x8534('0x8')](_0x8534('0x9'),attributes,{'tableName':_0x8534('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8534('0xb'),'collate':_0x8534('0xc')});}; \ No newline at end of file +var _0xc007=['userNotifications','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','define','UserNotification'];(function(_0x2c6c27,_0x583885){var _0x4bf010=function(_0x254c61){while(--_0x254c61){_0x2c6c27['push'](_0x2c6c27['shift']());}};_0x4bf010(++_0x583885);}(_0xc007,0x183));var _0x7c00=function(_0x2d0228,_0x4e43bb){_0x2d0228=_0x2d0228-0x0;var _0x1d5cab=_0xc007[_0x2d0228];return _0x1d5cab;};'use strict';var _=require(_0x7c00('0x0'));var util=require('util');var logger=require(_0x7c00('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7c00('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7c00('0x3'));var rimraf=require(_0x7c00('0x4'));var config=require(_0x7c00('0x5'));var attributes=require(_0x7c00('0x6'));module['exports']=function(_0x2d463f,_0xba600d){return _0x2d463f[_0x7c00('0x7')](_0x7c00('0x8'),attributes,{'tableName':_0x7c00('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7c00('0xa')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index c751a74..6d0053e 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 _0x5e27=['result','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x36daf7,_0x2c4117){var _0x3e07d9=function(_0x11929a){while(--_0x11929a){_0x36daf7['push'](_0x36daf7['shift']());}};_0x3e07d9(++_0x2c4117);}(_0x5e27,0x160));var _0x75e2=function(_0xc8c1d8,_0x45ae43){_0xc8c1d8=_0xc8c1d8-0x0;var _0x11976d=_0x5e27[_0xc8c1d8];return _0x11976d;};'use strict';var _=require(_0x75e2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x75e2('0x1'));var rs=require(_0x75e2('0x2'));var fs=require('fs');var Redis=require(_0x75e2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x75e2('0x4'));var logger=require(_0x75e2('0x5'))('rpc');var config=require(_0x75e2('0x6'));var jayson=require(_0x75e2('0x7'));var client=jayson[_0x75e2('0x8')][_0x75e2('0x9')]({'port':0x232a});config['redis']=_[_0x75e2('0xa')](config[_0x75e2('0xb')],{'host':_0x75e2('0xc'),'port':0x18eb});var socket=require(_0x75e2('0xd'))(new Redis(config[_0x75e2('0xb')]));require(_0x75e2('0xe'))[_0x75e2('0xf')](socket);function respondWithRpcPromise(_0x24f988,_0x97066a,_0x34b7aa){return new BPromise(function(_0x5ed462,_0x1c4306){return client[_0x75e2('0x10')](_0x24f988,_0x34b7aa)['then'](function(_0x23883c){logger[_0x75e2('0x11')](_0x75e2('0x12'),_0x97066a,_0x75e2('0x13'));logger[_0x75e2('0x14')](_0x75e2('0x15'),_0x97066a,_0x75e2('0x13'),JSON[_0x75e2('0x16')](_0x23883c));if(_0x23883c['error']){if(_0x23883c[_0x75e2('0x17')][_0x75e2('0x18')]===0x1f4){logger[_0x75e2('0x17')](_0x75e2('0x12'),_0x97066a,_0x23883c['error'][_0x75e2('0x19')]);return _0x1c4306(_0x23883c['error']['message']);}logger['error'](_0x75e2('0x12'),_0x97066a,_0x23883c[_0x75e2('0x17')][_0x75e2('0x19')]);return _0x5ed462(_0x23883c[_0x75e2('0x17')][_0x75e2('0x19')]);}else{logger[_0x75e2('0x11')](_0x75e2('0x12'),_0x97066a,'request\x20sent');_0x5ed462(_0x23883c[_0x75e2('0x1a')][_0x75e2('0x19')]);}})['catch'](function(_0x7847f9){logger['error'](_0x75e2('0x12'),_0x97066a,_0x7847f9);_0x1c4306(_0x7847f9);});});} \ No newline at end of file +var _0xc88e=['code','message','info','UserNotification,\x20%s,\x20%s','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','request','then','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error'];(function(_0xa25919,_0x1c7421){var _0x8c2136=function(_0x101cae){while(--_0x101cae){_0xa25919['push'](_0xa25919['shift']());}};_0x8c2136(++_0x1c7421);}(_0xc88e,0x164));var _0xec88=function(_0x5dba00,_0x26c930){_0x5dba00=_0x5dba00-0x0;var _0x19b031=_0xc88e[_0x5dba00];return _0x19b031;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xec88('0x0'));var BPromise=require('bluebird');var rs=require(_0xec88('0x1'));var fs=require('fs');var Redis=require(_0xec88('0x2'));var db=require(_0xec88('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xec88('0x4'))('rpc');var config=require(_0xec88('0x5'));var jayson=require(_0xec88('0x6'));var client=jayson[_0xec88('0x7')][_0xec88('0x8')]({'port':0x232a});config[_0xec88('0x9')]=_[_0xec88('0xa')](config[_0xec88('0x9')],{'host':_0xec88('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec88('0x9')]));require(_0xec88('0xc'))[_0xec88('0xd')](socket);function respondWithRpcPromise(_0x1f506f,_0x5851f8,_0x45bad5){return new BPromise(function(_0x3c76d2,_0x2edc21){return client[_0xec88('0xe')](_0x1f506f,_0x45bad5)[_0xec88('0xf')](function(_0x4591f9){logger['info']('UserNotification,\x20%s,\x20%s',_0x5851f8,_0xec88('0x10'));logger['debug'](_0xec88('0x11'),_0x5851f8,_0xec88('0x10'),JSON['stringify'](_0x4591f9));if(_0x4591f9[_0xec88('0x12')]){if(_0x4591f9['error'][_0xec88('0x13')]===0x1f4){logger[_0xec88('0x12')]('UserNotification,\x20%s,\x20%s',_0x5851f8,_0x4591f9[_0xec88('0x12')][_0xec88('0x14')]);return _0x2edc21(_0x4591f9[_0xec88('0x12')][_0xec88('0x14')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x5851f8,_0x4591f9[_0xec88('0x12')][_0xec88('0x14')]);return _0x3c76d2(_0x4591f9[_0xec88('0x12')][_0xec88('0x14')]);}else{logger[_0xec88('0x15')](_0xec88('0x16'),_0x5851f8,'request\x20sent');_0x3c76d2(_0x4591f9[_0xec88('0x17')][_0xec88('0x14')]);}})[_0xec88('0x18')](function(_0x3aff05){logger[_0xec88('0x12')]('UserNotification,\x20%s,\x20%s',_0x5851f8,_0x3aff05);_0x2edc21(_0x3aff05);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 7cec359..4282b3d 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 _0xf93b=['length','./userNotification.events','remove','emit','removeListener'];(function(_0x3a6907,_0x29a7e0){var _0x434a9a=function(_0x439d8c){while(--_0x439d8c){_0x3a6907['push'](_0x3a6907['shift']());}};_0x434a9a(++_0x29a7e0);}(_0xf93b,0x1af));var _0xbf93=function(_0x5caf7e,_0x52e1bc){_0x5caf7e=_0x5caf7e-0x0;var _0x5c3435=_0xf93b[_0x5caf7e];return _0x5c3435;};'use strict';var UserNotificationEvents=require(_0xbf93('0x0'));var events=['save',_0xbf93('0x1'),'update'];function createListener(_0x1d8a4a,_0x37b93d){return function(_0x2d4a17){_0x37b93d[_0xbf93('0x2')](_0x1d8a4a,_0x2d4a17);};}function removeListener(_0x3d90c6,_0x25ba6e){return function(){UserNotificationEvents[_0xbf93('0x3')](_0x3d90c6,_0x25ba6e);};}exports['register']=function(_0x127e7c){for(var _0x378aee=0x0,_0x4a5eca=events[_0xbf93('0x4')];_0x378aee<_0x4a5eca;_0x378aee++){var _0x35f1ff=events[_0x378aee];var _0x341b08=createListener('userNotification:'+_0x35f1ff,_0x127e7c);UserNotificationEvents['on'](_0x35f1ff,_0x341b08);}}; \ No newline at end of file +var _0x0a16=['save','remove','update','emit','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x25efdf,_0x521462){var _0x22c495=function(_0x184469){while(--_0x184469){_0x25efdf['push'](_0x25efdf['shift']());}};_0x22c495(++_0x521462);}(_0x0a16,0x15e));var _0x60a1=function(_0x56789e,_0x3a0d9d){_0x56789e=_0x56789e-0x0;var _0x49a3fd=_0x0a16[_0x56789e];return _0x49a3fd;};'use strict';var UserNotificationEvents=require(_0x60a1('0x0'));var events=[_0x60a1('0x1'),_0x60a1('0x2'),_0x60a1('0x3')];function createListener(_0x464562,_0x1f43f2){return function(_0x1007c9){_0x1f43f2[_0x60a1('0x4')](_0x464562,_0x1007c9);};}function removeListener(_0x16cbbe,_0x55f2bb){return function(){UserNotificationEvents[_0x60a1('0x5')](_0x16cbbe,_0x55f2bb);};}exports[_0x60a1('0x6')]=function(_0x5d7bca){for(var _0x241305=0x0,_0x17f175=events[_0x60a1('0x7')];_0x241305<_0x17f175;_0x241305++){var _0x18f937=events[_0x241305];var _0x21e970=createListener(_0x60a1('0x8')+_0x18f937,_0x5d7bca);UserNotificationEvents['on'](_0x18f937,_0x21e970);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 268e6a1..3324c0a 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4bb5de,_0x1806d9){var _0x5bb0ff=function(_0x5e4676){while(--_0x5e4676){_0x4bb5de['push'](_0x4bb5de['shift']());}};_0x5bb0ff(++_0x1806d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2914e9,_0x14d484){var _0x2aa212=function(_0x656fa){while(--_0x656fa){_0x2914e9['push'](_0x2914e9['shift']());}};_0x2aa212(++_0x14d484);}(_0x70e0,0x17b));var _0x070e=function(_0x119021,_0x497337){_0x119021=_0x119021-0x0;var _0x2b514a=_0x70e0[_0x119021];return _0x2b514a;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 099d70a..e4aa02e 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 _0x0cb4=['INTEGER','exports'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x0cb4,0x171));var _0x40cb=function(_0xbbc163,_0x202519){_0xbbc163=_0xbbc163-0x0;var _0x33a016=_0x0cb4[_0xbbc163];return _0x33a016;};'use strict';var Sequelize=require('sequelize');module[_0x40cb('0x0')]={'penalty':{'type':Sequelize[_0x40cb('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfac9=['exports','INTEGER','sequelize'];(function(_0x2edb85,_0x31804b){var _0x549966=function(_0x3cdc86){while(--_0x3cdc86){_0x2edb85['push'](_0x2edb85['shift']());}};_0x549966(++_0x31804b);}(_0xfac9,0x149));var _0x9fac=function(_0xe24dda,_0x17eefe){_0xe24dda=_0xe24dda-0x0;var _0xfb451=_0xfac9[_0xe24dda];return _0xfb451;};'use strict';var Sequelize=require(_0x9fac('0x0'));module[_0x9fac('0x1')]={'penalty':{'type':Sequelize[_0x9fac('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index a25b9be..fa7840f 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 _0xbddd=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger'];(function(_0x1b7e86,_0x5b6118){var _0x5a0575=function(_0x46345e){while(--_0x46345e){_0x1b7e86['push'](_0x1b7e86['shift']());}};_0x5a0575(++_0x5b6118);}(_0xbddd,0x8f));var _0xdbdd=function(_0xd57f51,_0xb175e0){_0xd57f51=_0xd57f51-0x0;var _0x17d9d5=_0xbddd[_0xd57f51];return _0x17d9d5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdbdd('0x0'))(_0xdbdd('0x1'));var moment=require(_0xdbdd('0x2'));var BPromise=require(_0xdbdd('0x3'));var rp=require(_0xdbdd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdbdd('0x5'));var config=require(_0xdbdd('0x6'));var attributes=require(_0xdbdd('0x7'));module[_0xdbdd('0x8')]=function(_0x25a955,_0x4e4908){return _0x25a955[_0xdbdd('0x9')](_0xdbdd('0xa'),attributes,{'tableName':_0xdbdd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1b1=['bluebird','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','util','../../config/logger','api','moment'];(function(_0x2490ad,_0x33836e){var _0x38262d=function(_0x159a42){while(--_0x159a42){_0x2490ad['push'](_0x2490ad['shift']());}};_0x38262d(++_0x33836e);}(_0xe1b1,0x92));var _0x1e1b=function(_0x581033,_0x46d2ec){_0x581033=_0x581033-0x0;var _0x470632=_0xe1b1[_0x581033];return _0x470632;};'use strict';var _=require('lodash');var util=require(_0x1e1b('0x0'));var logger=require(_0x1e1b('0x1'))(_0x1e1b('0x2'));var moment=require(_0x1e1b('0x3'));var BPromise=require(_0x1e1b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e1b('0x5'));var rimraf=require(_0x1e1b('0x6'));var config=require(_0x1e1b('0x7'));var attributes=require(_0x1e1b('0x8'));module['exports']=function(_0x55ff17,_0x519c1b){return _0x55ff17[_0x1e1b('0x9')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 4d8e8b7..07c4712 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 _0x567d=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5b5af1,_0x1db01b){var _0x45ab7b=function(_0x1e353a){while(--_0x1e353a){_0x5b5af1['push'](_0x5b5af1['shift']());}};_0x45ab7b(++_0x1db01b);}(_0x567d,0xc4));var _0xd567=function(_0x59bd5a,_0x1f28cb){_0x59bd5a=_0x59bd5a-0x0;var _0x5f3fb6=_0x567d[_0x59bd5a];return _0x5f3fb6;};'use strict';var _=require(_0xd567('0x0'));var util=require(_0xd567('0x1'));var moment=require('moment');var BPromise=require(_0xd567('0x2'));var rs=require(_0xd567('0x3'));var fs=require('fs');var Redis=require(_0xd567('0x4'));var db=require(_0xd567('0x5'))['db'];var utils=require(_0xd567('0x6'));var logger=require(_0xd567('0x7'))(_0xd567('0x8'));var config=require(_0xd567('0x9'));var jayson=require(_0xd567('0xa'));var client=jayson[_0xd567('0xb')][_0xd567('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5d6a8e,_0x5c34e2,_0x15df95){return new BPromise(function(_0x3a66b3,_0x9982c7){return client[_0xd567('0xd')](_0x5d6a8e,_0x15df95)['then'](function(_0x44a963){logger[_0xd567('0xe')](_0xd567('0xf'),_0x5c34e2,_0xd567('0x10'));logger[_0xd567('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5c34e2,'request\x20sent',JSON[_0xd567('0x12')](_0x44a963));if(_0x44a963[_0xd567('0x13')]){if(_0x44a963[_0xd567('0x13')][_0xd567('0x14')]===0x1f4){logger['error'](_0xd567('0xf'),_0x5c34e2,_0x44a963[_0xd567('0x13')]['message']);return _0x9982c7(_0x44a963[_0xd567('0x13')][_0xd567('0x15')]);}logger[_0xd567('0x13')](_0xd567('0xf'),_0x5c34e2,_0x44a963[_0xd567('0x13')]['message']);return _0x3a66b3(_0x44a963[_0xd567('0x13')][_0xd567('0x15')]);}else{logger[_0xd567('0xe')](_0xd567('0xf'),_0x5c34e2,_0xd567('0x10'));_0x3a66b3(_0x44a963[_0xd567('0x16')]['message']);}})[_0xd567('0x17')](function(_0x29d623){logger[_0xd567('0x13')](_0xd567('0xf'),_0x5c34e2,_0x29d623);_0x9982c7(_0x29d623);});});} \ No newline at end of file +var _0xe372=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x3fae21,_0x29a263){var _0x32df51=function(_0x1235d9){while(--_0x1235d9){_0x3fae21['push'](_0x3fae21['shift']());}};_0x32df51(++_0x29a263);}(_0xe372,0x1e3));var _0x2e37=function(_0x40aaca,_0x4803f4){_0x40aaca=_0x40aaca-0x0;var _0x1252f7=_0xe372[_0x40aaca];return _0x1252f7;};'use strict';var _=require(_0x2e37('0x0'));var util=require(_0x2e37('0x1'));var moment=require(_0x2e37('0x2'));var BPromise=require(_0x2e37('0x3'));var rs=require(_0x2e37('0x4'));var fs=require('fs');var Redis=require(_0x2e37('0x5'));var db=require(_0x2e37('0x6'))['db'];var utils=require(_0x2e37('0x7'));var logger=require('../../config/logger')(_0x2e37('0x8'));var config=require(_0x2e37('0x9'));var jayson=require(_0x2e37('0xa'));var client=jayson['client'][_0x2e37('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53e293,_0x48e1d6,_0x5bbe7f){return new BPromise(function(_0x470aec,_0x530a4a){return client[_0x2e37('0xc')](_0x53e293,_0x5bbe7f)[_0x2e37('0xd')](function(_0x454d1b){logger[_0x2e37('0xe')](_0x2e37('0xf'),_0x48e1d6,'request\x20sent');logger[_0x2e37('0x10')](_0x2e37('0x11'),_0x48e1d6,_0x2e37('0x12'),JSON['stringify'](_0x454d1b));if(_0x454d1b['error']){if(_0x454d1b['error']['code']===0x1f4){logger[_0x2e37('0x13')](_0x2e37('0xf'),_0x48e1d6,_0x454d1b[_0x2e37('0x13')][_0x2e37('0x14')]);return _0x530a4a(_0x454d1b[_0x2e37('0x13')][_0x2e37('0x14')]);}logger[_0x2e37('0x13')](_0x2e37('0xf'),_0x48e1d6,_0x454d1b[_0x2e37('0x13')][_0x2e37('0x14')]);return _0x470aec(_0x454d1b['error'][_0x2e37('0x14')]);}else{logger[_0x2e37('0xe')](_0x2e37('0xf'),_0x48e1d6,_0x2e37('0x12'));_0x470aec(_0x454d1b[_0x2e37('0x15')][_0x2e37('0x14')]);}})[_0x2e37('0x16')](function(_0x4a59e8){logger[_0x2e37('0x13')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x48e1d6,_0x4a59e8);_0x530a4a(_0x4a59e8);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 22e4847..9239255 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 _0xf611=['update','delete','destroy','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','/:id/sections'];(function(_0x2dca9f,_0xcff123){var _0x462c50=function(_0x9294e1){while(--_0x9294e1){_0x2dca9f['push'](_0x2dca9f['shift']());}};_0x462c50(++_0xcff123);}(_0xf611,0x183));var _0x1f61=function(_0x34365b,_0x418c5a){_0x34365b=_0x34365b-0x0;var _0x12d73a=_0xf611[_0x34365b];return _0x12d73a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f61('0x0'));var timeout=require(_0x1f61('0x1'));var express=require(_0x1f61('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1f61('0x3'));var interaction=require(_0x1f61('0x4'));var config=require(_0x1f61('0x5'));var controller=require(_0x1f61('0x6'));router[_0x1f61('0x7')]('/',auth[_0x1f61('0x8')](),controller[_0x1f61('0x9')]);router['get'](_0x1f61('0xa'),auth[_0x1f61('0x8')](),controller[_0x1f61('0xb')]);router[_0x1f61('0x7')](_0x1f61('0xc'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/sections',auth[_0x1f61('0x8')](),controller[_0x1f61('0xd')]);router[_0x1f61('0x7')](_0x1f61('0xe'),auth[_0x1f61('0x8')](),controller[_0x1f61('0xf')]);router[_0x1f61('0x10')]('/',auth[_0x1f61('0x8')](),controller[_0x1f61('0x11')]);router[_0x1f61('0x10')](_0x1f61('0x12'),auth[_0x1f61('0x8')](),controller[_0x1f61('0x13')]);router[_0x1f61('0x10')](_0x1f61('0x14'),auth[_0x1f61('0x8')](),controller['addSections']);router[_0x1f61('0x10')](_0x1f61('0xe'),auth[_0x1f61('0x8')](),controller['addResources']);router['put'](_0x1f61('0xc'),auth[_0x1f61('0x8')](),controller[_0x1f61('0x15')]);router[_0x1f61('0x16')]('/:id',auth[_0x1f61('0x8')](),controller[_0x1f61('0x17')]);router[_0x1f61('0x16')](_0x1f61('0x14'),auth[_0x1f61('0x8')](),controller['removeSections']);router[_0x1f61('0x16')](_0x1f61('0xe'),auth['isAuthenticated'](),controller['removeResources']);module['exports']=router; \ No newline at end of file +var _0xb471=['Router','../../components/auth/service','../../config/environment','./userProfile.controller','index','get','/describe','isAuthenticated','show','/:id/sections','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources','/:id','update','delete','destroy','removeSections','exports','multer','util','path'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0xb471,0x1ad));var _0x1b47=function(_0x2d60b9,_0x8ffc89){_0x2d60b9=_0x2d60b9-0x0;var _0x2cce26=_0xb471[_0x2d60b9];return _0x2cce26;};'use strict';var multer=require(_0x1b47('0x0'));var util=require(_0x1b47('0x1'));var path=require(_0x1b47('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b47('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1b47('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1b47('0x5'));var controller=require(_0x1b47('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1b47('0x7')]);router[_0x1b47('0x8')](_0x1b47('0x9'),auth[_0x1b47('0xa')](),controller['describe']);router[_0x1b47('0x8')]('/:id',auth[_0x1b47('0xa')](),controller[_0x1b47('0xb')]);router[_0x1b47('0x8')](_0x1b47('0xc'),auth[_0x1b47('0xa')](),controller[_0x1b47('0xd')]);router[_0x1b47('0x8')](_0x1b47('0xe'),auth[_0x1b47('0xa')](),controller[_0x1b47('0xf')]);router[_0x1b47('0x10')]('/',auth[_0x1b47('0xa')](),controller[_0x1b47('0x11')]);router[_0x1b47('0x10')]('/:id/clone',auth[_0x1b47('0xa')](),controller[_0x1b47('0x12')]);router['post'](_0x1b47('0xc'),auth[_0x1b47('0xa')](),controller[_0x1b47('0x13')]);router[_0x1b47('0x10')](_0x1b47('0xe'),auth[_0x1b47('0xa')](),controller[_0x1b47('0x14')]);router['put'](_0x1b47('0x15'),auth[_0x1b47('0xa')](),controller[_0x1b47('0x16')]);router[_0x1b47('0x17')](_0x1b47('0x15'),auth[_0x1b47('0xa')](),controller[_0x1b47('0x18')]);router[_0x1b47('0x17')](_0x1b47('0xc'),auth['isAuthenticated'](),controller[_0x1b47('0x19')]);router[_0x1b47('0x17')]('/:id/resources',auth[_0x1b47('0xa')](),controller['removeResources']);module[_0x1b47('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 3690809..533cbec 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 _0x60dd=['split','BOOLEAN','sequelize','exports','STRING','name','join','crudPermissions','getDataValue'];(function(_0x4cbe01,_0x5e7499){var _0x45d28f=function(_0x12c4cb){while(--_0x12c4cb){_0x4cbe01['push'](_0x4cbe01['shift']());}};_0x45d28f(++_0x5e7499);}(_0x60dd,0x134));var _0xd60d=function(_0x2b0139,_0x5ec5f9){_0x2b0139=_0x2b0139-0x0;var _0x5ca444=_0x60dd[_0x2b0139];return _0x5ca444;};'use strict';var Sequelize=require(_0xd60d('0x0'));module[_0xd60d('0x1')]={'name':{'type':Sequelize[_0xd60d('0x2')],'allowNull':![],'unique':_0xd60d('0x3')},'crudPermissions':{'type':Sequelize[_0xd60d('0x2')],'set':function(_0x593e54){this['setDataValue']('crudPermissions',_0x593e54?_0x593e54[_0xd60d('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0xd60d('0x5'))?this[_0xd60d('0x6')](_0xd60d('0x5'))[_0xd60d('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xd60d('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xd60d('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xd60d('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xbaa2=['sequelize','exports','name','STRING','crudPermissions','join','getDataValue','BOOLEAN'];(function(_0x4883f8,_0x2a9c3e){var _0x5e325a=function(_0x5ba2a0){while(--_0x5ba2a0){_0x4883f8['push'](_0x4883f8['shift']());}};_0x5e325a(++_0x2a9c3e);}(_0xbaa2,0xb0));var _0x2baa=function(_0x13534a,_0x21ac5e){_0x13534a=_0x13534a-0x0;var _0x31b4ce=_0xbaa2[_0x13534a];return _0x31b4ce;};'use strict';var Sequelize=require(_0x2baa('0x0'));module[_0x2baa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2baa('0x2')},'crudPermissions':{'type':Sequelize[_0x2baa('0x3')],'set':function(_0x2d5705){this['setDataValue'](_0x2baa('0x4'),_0x2d5705?_0x2d5705[_0x2baa('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x2baa('0x4'))?this[_0x2baa('0x6')](_0x2baa('0x4'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x2baa('0x3')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x2baa('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x2baa('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x2baa('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x2baa('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x2baa('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x2baa('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x2baa('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index c7a98da..ac71fb9 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 _0x8ff9=['send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','include','findAll','rows','show','params','find','catch','create','body','clone','includeAll','options','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','UserProfileSection','destroy','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','push','findOne','Dashboard','resourceId','forEach','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','redis','defaults','socket.io-emitter','./userProfile.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','stack','name'];(function(_0x18f8ff,_0x257e95){var _0x18de97=function(_0xc8eb68){while(--_0xc8eb68){_0x18f8ff['push'](_0x18f8ff['shift']());}};_0x18de97(++_0x257e95);}(_0x8ff9,0x1a6));var _0x98ff=function(_0x4d7b5e,_0x3e9708){_0x4d7b5e=_0x4d7b5e-0x0;var _0x42f67b=_0x8ff9[_0x4d7b5e];return _0x42f67b;};'use strict';var emlformat=require(_0x98ff('0x0'));var rimraf=require(_0x98ff('0x1'));var zipdir=require(_0x98ff('0x2'));var jsonpatch=require(_0x98ff('0x3'));var rp=require(_0x98ff('0x4'));var moment=require(_0x98ff('0x5'));var BPromise=require(_0x98ff('0x6'));var Mustache=require(_0x98ff('0x7'));var util=require(_0x98ff('0x8'));var path=require(_0x98ff('0x9'));var sox=require(_0x98ff('0xa'));var csv=require('to-csv');var ejs=require(_0x98ff('0xb'));var fs=require('fs');var fs_extra=require(_0x98ff('0xc'));var _=require(_0x98ff('0xd'));var squel=require(_0x98ff('0xe'));var crypto=require(_0x98ff('0xf'));var jsforce=require(_0x98ff('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x98ff('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x98ff('0x12'));var authService=require(_0x98ff('0x13'));var qs=require(_0x98ff('0x14'));var as=require(_0x98ff('0x15'));var hardwareService=require(_0x98ff('0x16'));var logger=require('../../config/logger')(_0x98ff('0x17'));var utils=require('../../config/utils');var config=require(_0x98ff('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x98ff('0x19')]=_[_0x98ff('0x1a')](config[_0x98ff('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x98ff('0x1b'))(new Redis(config['redis']));require(_0x98ff('0x1c'))[_0x98ff('0x1d')](socket);function respondWithStatusCode(_0x2c4e4d,_0x3a7e21){_0x3a7e21=_0x3a7e21||0xcc;return function(_0x2aae4d){if(_0x2aae4d){return _0x2c4e4d[_0x98ff('0x1e')](_0x3a7e21);}return _0x2c4e4d['status'](_0x3a7e21)[_0x98ff('0x1f')]();};}function respondWithResult(_0x196f27,_0xb48c72){_0xb48c72=_0xb48c72||0xc8;return function(_0x5af32){if(_0x5af32){return _0x196f27[_0x98ff('0x20')](_0xb48c72)[_0x98ff('0x21')](_0x5af32);}};}function respondWithFilteredResult(_0x1f3044,_0x33023e){return function(_0x268121){if(_0x268121){var _0x3c04d4=typeof _0x33023e[_0x98ff('0x22')]===_0x98ff('0x23')&&typeof _0x33023e[_0x98ff('0x24')]===_0x98ff('0x23');var _0x4c235b=_0x268121[_0x98ff('0x25')];var _0x31f525=_0x3c04d4?0x0:_0x33023e[_0x98ff('0x22')];var _0x43fb4f=_0x3c04d4?_0x268121[_0x98ff('0x25')]:_0x33023e[_0x98ff('0x22')]+_0x33023e[_0x98ff('0x24')];var _0x3a6c52;if(_0x43fb4f>=_0x4c235b){_0x43fb4f=_0x4c235b;_0x3a6c52=0xc8;}else{_0x3a6c52=0xce;}_0x1f3044[_0x98ff('0x20')](_0x3a6c52);return _0x1f3044[_0x98ff('0x26')](_0x98ff('0x27'),_0x31f525+'-'+_0x43fb4f+'/'+_0x4c235b)[_0x98ff('0x21')](_0x268121);}return null;};}function patchUpdates(_0x2fdbc2){return function(_0x4ea518){try{jsonpatch['apply'](_0x4ea518,_0x2fdbc2,!![]);}catch(_0x4c6ddc){return BPromise[_0x98ff('0x28')](_0x4c6ddc);}return _0x4ea518[_0x98ff('0x29')]();};}function saveUpdates(_0x547fab,_0xd0293e){return function(_0x58b281){if(_0x58b281){return _0x58b281[_0x98ff('0x2a')](_0x547fab)[_0x98ff('0x2b')](function(_0x308efd){return _0x308efd;});}return null;};}function removeEntity(_0x2b3ee9,_0x4003de){return function(_0x5c1c0c){if(_0x5c1c0c){return _0x5c1c0c['destroy']()[_0x98ff('0x2b')](function(){_0x2b3ee9[_0x98ff('0x20')](0xcc)[_0x98ff('0x1f')]();});}};}function handleEntityNotFound(_0x6ccf21,_0x8b7939){return function(_0x231e00){if(!_0x231e00){_0x6ccf21[_0x98ff('0x1e')](0x194);}return _0x231e00;};}function handleError(_0x28e0a0,_0xda7649){_0xda7649=_0xda7649||0x1f4;return function(_0x25a658){logger['error'](_0x25a658[_0x98ff('0x2c')]);if(_0x25a658[_0x98ff('0x2d')]){delete _0x25a658[_0x98ff('0x2d')];}_0x28e0a0[_0x98ff('0x20')](_0xda7649)[_0x98ff('0x2e')](_0x25a658);};}exports[_0x98ff('0x2f')]=function(_0x17975c,_0x41c093){var _0x42213a={},_0x205d85={},_0x3fa70c={'count':0x0,'rows':[]};var _0x1472cb=_[_0x98ff('0x30')](db[_0x98ff('0x31')][_0x98ff('0x32')],function(_0x81e918){return{'name':_0x81e918[_0x98ff('0x33')],'type':_0x81e918[_0x98ff('0x34')][_0x98ff('0x35')]};});_0x205d85[_0x98ff('0x36')]=_[_0x98ff('0x30')](_0x1472cb,'name');_0x205d85[_0x98ff('0x37')]=_[_0x98ff('0x38')](_0x17975c[_0x98ff('0x37')]);_0x205d85[_0x98ff('0x39')]=_[_0x98ff('0x3a')](_0x205d85['model'],_0x205d85[_0x98ff('0x37')]);_0x42213a['attributes']=_[_0x98ff('0x3a')](_0x205d85[_0x98ff('0x36')],qs[_0x98ff('0x3b')](_0x17975c[_0x98ff('0x37')][_0x98ff('0x3b')]));_0x42213a[_0x98ff('0x3c')]=_0x42213a[_0x98ff('0x3c')][_0x98ff('0x3d')]?_0x42213a[_0x98ff('0x3c')]:_0x205d85[_0x98ff('0x36')];if(!_0x17975c['query'][_0x98ff('0x3e')](_0x98ff('0x3f'))){_0x42213a[_0x98ff('0x24')]=qs[_0x98ff('0x24')](_0x17975c[_0x98ff('0x37')][_0x98ff('0x24')]);_0x42213a[_0x98ff('0x22')]=qs[_0x98ff('0x22')](_0x17975c['query'][_0x98ff('0x22')]);}_0x42213a['order']=qs[_0x98ff('0x40')](_0x17975c[_0x98ff('0x37')][_0x98ff('0x40')]);_0x42213a[_0x98ff('0x41')]=qs[_0x98ff('0x39')](_['pick'](_0x17975c['query'],_0x205d85[_0x98ff('0x39')]),_0x1472cb);if(_0x17975c[_0x98ff('0x37')][_0x98ff('0x42')]){_0x42213a[_0x98ff('0x41')]=_[_0x98ff('0x43')](_0x42213a[_0x98ff('0x41')],{'$or':_[_0x98ff('0x30')](_0x1472cb,function(_0x55286f){if(_0x55286f[_0x98ff('0x34')]!==_0x98ff('0x44')){var _0x2ef081={};_0x2ef081[_0x55286f[_0x98ff('0x2d')]]={'$like':'%'+_0x17975c[_0x98ff('0x37')][_0x98ff('0x42')]+'%'};return _0x2ef081;}})});}_0x42213a=_[_0x98ff('0x43')]({},_0x42213a,_0x17975c['options']);var _0x2c6ea8={'where':_0x42213a[_0x98ff('0x41')]};return db[_0x98ff('0x31')][_0x98ff('0x25')](_0x2c6ea8)[_0x98ff('0x2b')](function(_0x5d8c45){_0x3fa70c['count']=_0x5d8c45;if(_0x17975c[_0x98ff('0x37')]['includeAll']){_0x42213a[_0x98ff('0x45')]=[{'all':!![]}];}return db[_0x98ff('0x31')][_0x98ff('0x46')](_0x42213a);})[_0x98ff('0x2b')](function(_0x4208f5){_0x3fa70c[_0x98ff('0x47')]=_0x4208f5;return _0x3fa70c;})['then'](respondWithFilteredResult(_0x41c093,_0x42213a))['catch'](handleError(_0x41c093,null));};exports[_0x98ff('0x48')]=function(_0x4f2be4,_0x1507d1){var _0x61d31d={'raw':![],'where':{'id':_0x4f2be4[_0x98ff('0x49')]['id']}},_0xd3c5b0={};_0xd3c5b0[_0x98ff('0x36')]=_[_0x98ff('0x38')](db['UserProfile'][_0x98ff('0x32')]);_0xd3c5b0[_0x98ff('0x37')]=_[_0x98ff('0x38')](_0x4f2be4['query']);_0xd3c5b0[_0x98ff('0x39')]=_[_0x98ff('0x3a')](_0xd3c5b0[_0x98ff('0x36')],_0xd3c5b0[_0x98ff('0x37')]);_0x61d31d[_0x98ff('0x3c')]=_[_0x98ff('0x3a')](_0xd3c5b0[_0x98ff('0x36')],qs[_0x98ff('0x3b')](_0x4f2be4[_0x98ff('0x37')][_0x98ff('0x3b')]));_0x61d31d[_0x98ff('0x3c')]=_0x61d31d[_0x98ff('0x3c')][_0x98ff('0x3d')]?_0x61d31d[_0x98ff('0x3c')]:_0xd3c5b0[_0x98ff('0x36')];if(_0x4f2be4[_0x98ff('0x37')]['includeAll']){_0x61d31d['include']=[{'all':!![]}];}_0x61d31d=_[_0x98ff('0x43')]({},_0x61d31d,_0x4f2be4['options']);return db[_0x98ff('0x31')][_0x98ff('0x4a')](_0x61d31d)[_0x98ff('0x2b')](handleEntityNotFound(_0x1507d1,null))[_0x98ff('0x2b')](respondWithResult(_0x1507d1,null))[_0x98ff('0x4b')](handleError(_0x1507d1,null));};exports[_0x98ff('0x4c')]=function(_0x4596f5,_0x3eb900){return db[_0x98ff('0x31')]['create'](_0x4596f5[_0x98ff('0x4d')],{})['then'](respondWithResult(_0x3eb900,0xc9))[_0x98ff('0x4b')](handleError(_0x3eb900,null));};exports[_0x98ff('0x4e')]=function(_0x5e3283,_0x1e62ec){var _0x35cda7={'where':{'id':_0x5e3283[_0x98ff('0x49')]['id']}},_0x55c04f={};_0x55c04f[_0x98ff('0x36')]=_['keys'](db[_0x98ff('0x31')][_0x98ff('0x32')]);_0x35cda7[_0x98ff('0x3c')]=_[_0x98ff('0x3a')](_0x55c04f[_0x98ff('0x36')],qs[_0x98ff('0x3b')](_0x5e3283['query'][_0x98ff('0x3b')]));_0x35cda7[_0x98ff('0x3c')]=_0x35cda7[_0x98ff('0x3c')][_0x98ff('0x3d')]?_0x35cda7[_0x98ff('0x3c')]:_0x55c04f[_0x98ff('0x36')];if(_0x5e3283[_0x98ff('0x37')][_0x98ff('0x4f')]){_0x35cda7[_0x98ff('0x45')]=[{'all':!![]}];}_0x35cda7=_[_0x98ff('0x43')]({},_0x35cda7,_0x5e3283[_0x98ff('0x50')]);return db['UserProfile']['find'](_0x35cda7)[_0x98ff('0x2b')](handleEntityNotFound(_0x1e62ec,null))[_0x98ff('0x2b')](function(_0x3fe60f){if(_0x3fe60f){var _0x2b9789=_0x3fe60f[_0x98ff('0x51')]({'plain':!![]});_0x2b9789=qs[_0x98ff('0x52')](_0x2b9789,['id',_0x98ff('0x53'),_0x98ff('0x54'),_0x98ff('0x55')]);_0x5e3283['body']=_[_0x98ff('0x52')](_0x5e3283[_0x98ff('0x4d')],['id',_0x98ff('0x53'),_0x98ff('0x54')]);return db[_0x98ff('0x56')][_0x98ff('0x57')](function(_0x407fc8){return db[_0x98ff('0x31')][_0x98ff('0x4c')](_[_0x98ff('0x43')](_0x2b9789,_0x5e3283['body']),{'include':_0x5e3283['query'][_0x98ff('0x4f')]?[{'all':!![]}]:undefined,'transaction':_0x407fc8})[_0x98ff('0x2b')](function(_0x56b10a){var _0x302e7c=_0x56b10a['get']({'plain':!![]});return db['UserProfileSection'][_0x98ff('0x46')]({'where':{'userProfileId':_0x5e3283[_0x98ff('0x49')]['id']},'raw':!![]})['then'](function(_0x4f97c9){if(_0x4f97c9){return BPromise[_0x98ff('0x58')](_0x4f97c9,function(_0x3bb079){return new BPromise(function(_0x3a4ee2,_0x38fc80){if(_0x3bb079[_0x98ff('0x59')]===null||_0x3bb079['autoAssociation']===0x1)_0x3a4ee2(null);return db[_0x98ff('0x5a')][_0x98ff('0x46')]({'where':{'sectionId':_0x3bb079['id']},'raw':!![]})[_0x98ff('0x2b')](function(_0xa794c4){var _0x23479a=_[_0x98ff('0x30')](_0xa794c4,function(_0x595e5a){return qs['omit'](_0x595e5a,['id',_0x98ff('0x53'),_0x98ff('0x54'),_0x98ff('0x5b')]);});_0x3a4ee2(_0x23479a);})['catch'](function(_0x3abd71){_0x38fc80(_0x3abd71);});})[_0x98ff('0x2b')](function(_0x717195){var _0xc88fee=qs[_0x98ff('0x52')](_0x3bb079,['id',_0x98ff('0x53'),_0x98ff('0x54')]);_0xc88fee[_0x98ff('0x5c')]=_0x302e7c['id'];if(_0x717195)_0xc88fee['Resources']=_0x717195;return _0xc88fee;})[_0x98ff('0x2b')](function(_0x1d3bf6){return db['UserProfileSection'][_0x98ff('0x4c')](_0x1d3bf6,{'include':[{'model':db[_0x98ff('0x5a')],'as':_0x98ff('0x5d')}],'raw':!![],'transaction':_0x407fc8});});})[_0x98ff('0x2b')](function(){return _0x302e7c;});}});});});}})['then'](respondWithResult(_0x1e62ec,0xc9))[_0x98ff('0x4b')](handleError(_0x1e62ec,null));};exports['update']=function(_0x488d84,_0x1d28d7){if(_0x488d84[_0x98ff('0x4d')]['id']){delete _0x488d84[_0x98ff('0x4d')]['id'];}return db[_0x98ff('0x31')][_0x98ff('0x4a')]({'where':{'id':_0x488d84[_0x98ff('0x49')]['id']}})[_0x98ff('0x2b')](handleEntityNotFound(_0x1d28d7,null))[_0x98ff('0x2b')](saveUpdates(_0x488d84['body'],null))[_0x98ff('0x2b')](respondWithResult(_0x1d28d7,null))[_0x98ff('0x4b')](handleError(_0x1d28d7,null));};exports['destroy']=function(_0x47dde5,_0x54ed73){return db[_0x98ff('0x31')]['find']({'where':{'id':_0x47dde5[_0x98ff('0x49')]['id']}})[_0x98ff('0x2b')](handleEntityNotFound(_0x54ed73,null))[_0x98ff('0x2b')](removeEntity(_0x54ed73,null))[_0x98ff('0x4b')](handleError(_0x54ed73,null));};exports[_0x98ff('0x5e')]=function(_0x3960e2,_0x1e5937){return db[_0x98ff('0x31')][_0x98ff('0x5e')]()[_0x98ff('0x2b')](respondWithResult(_0x1e5937,null))[_0x98ff('0x4b')](handleError(_0x1e5937,null));};exports[_0x98ff('0x5f')]=function(_0x46dfad,_0x4f27ed){var _0x1fe438=_0x46dfad['body'];return db[_0x98ff('0x31')]['find']({'where':{'id':_0x46dfad[_0x98ff('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f27ed,null))[_0x98ff('0x2b')](function(_0x41e465){if(_0x41e465){return db[_0x98ff('0x56')][_0x98ff('0x57')](function(_0x580d9a){return db[_0x98ff('0x60')][_0x98ff('0x61')]({'where':{'userProfileId':_0x46dfad[_0x98ff('0x49')]['id'],'sectionId':_[_0x98ff('0x30')](_0x1fe438,function(_0x531a4d){return _0x531a4d['sectionId'];})},'transaction':_0x580d9a})['then'](function(){var _0x200064=_[_0x98ff('0x30')](_0x1fe438,function(_0x13e386){_0x13e386[_0x98ff('0x5c')]=_0x46dfad[_0x98ff('0x49')]['id'];return _0x13e386;});var _0x4bc79f=[];return BPromise[_0x98ff('0x58')](_0x200064,function(_0x426979){return db[_0x98ff('0x60')][_0x98ff('0x4c')](_0x426979,{'include':[{'model':db[_0x98ff('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x580d9a})[_0x98ff('0x2b')](function(_0x5c887c){_0x4bc79f['push'](_0x5c887c[_0x98ff('0x51')]({'plain':!![]}));});})[_0x98ff('0x2b')](function(){return _0x4bc79f;});});});}})[_0x98ff('0x2b')](function(_0x3e5572){return _0x3e5572;})[_0x98ff('0x2b')](respondWithResult(_0x4f27ed,null))['catch'](handleError(_0x4f27ed,null));};exports[_0x98ff('0x62')]=function(_0x5f197d,_0x5302ac){var _0x321f61;return db[_0x98ff('0x31')][_0x98ff('0x4a')]({'where':{'id':_0x5f197d['params']['id']},'attributes':['id',_0x98ff('0x2d')]})[_0x98ff('0x2b')](handleEntityNotFound(_0x5302ac,null))[_0x98ff('0x2b')](function(_0x3f78a7){if(_0x3f78a7){_0x321f61=_0x3f78a7;return db[_0x98ff('0x60')][_0x98ff('0x61')]({'where':{'userProfileId':_0x5f197d[_0x98ff('0x49')]['id'],'sectionId':_0x5f197d['query'][_0x98ff('0x63')]}});}})['then'](function(){return _0x321f61;})['then'](respondWithStatusCode(_0x5302ac,null))[_0x98ff('0x4b')](handleError(_0x5302ac,null));};exports[_0x98ff('0x64')]=function(_0x460bed,_0x1af88c){var _0x1ccae4=[];var _0x3d9333=[];return db[_0x98ff('0x60')][_0x98ff('0x46')]({'where':{'userProfileId':_0x460bed[_0x98ff('0x49')]['id']},'raw':!![]})[_0x98ff('0x2b')](function(_0x5efbdc){_0x1ccae4=_[_0x98ff('0x42')](_0x5efbdc,function(_0xf01703){return _0xf01703[_0x98ff('0x65')]===0x1||_['includes']([0x3eb,0x709],_0xf01703[_0x98ff('0x5b')]);});if(!_[_0x98ff('0x66')](_0x1ccae4)){return _[_0x98ff('0x30')](_0x1ccae4,function(_0x5b9d87){return _0x5b9d87[_0x98ff('0x5b')];});}else{return;}})[_0x98ff('0x2b')](function(_0x41ca49){if(_0x41ca49)_0x3d9333=_0x41ca49;if(_[_0x98ff('0x67')](_0x3d9333,0x64)){var _0x184005=_[_0x98ff('0x4a')](_0x1ccae4,{'sectionId':0x64});return hasDefaultDashboard(_0x184005)[_0x98ff('0x2b')](function(_0x93ea98){return _['map'](_0x1ccae4,function(_0xee17ca){if(_0xee17ca[_0x98ff('0x5b')]===0x64){_0xee17ca[_0x98ff('0x68')]=_0x93ea98;}return _0xee17ca;});});}else{return;}})['then'](function(_0x5c388c){if(_0x5c388c)_0x1ccae4=_0x5c388c;if(_['includes'](_0x3d9333,0x3eb)){var _0x48dcb5=_['find'](_0x1ccae4,{'sectionId':0x3eb});return getCustomDashboards(_0x48dcb5)[_0x98ff('0x2b')](function(_0x34bf7d){return _[_0x98ff('0x30')](_0x1ccae4,function(_0x7f7a01){if(_0x48dcb5[_0x98ff('0x65')]){if(_0x7f7a01[_0x98ff('0x5b')]===0x3eb){_0x7f7a01['subsections']=_0x34bf7d;}}else{if(_0x7f7a01[_0x98ff('0x5b')]===0x64){_0x7f7a01[_0x98ff('0x68')]=_0x34bf7d;}}return _0x7f7a01;});});}else{return;}})[_0x98ff('0x2b')](function(_0x5e90f7){if(_0x5e90f7)_0x1ccae4=_0x5e90f7;if(_['includes'](_0x3d9333,0x709)){var _0x591239=_[_0x98ff('0x4a')](_0x1ccae4,{'sectionId':0x709});return getPlugins(_0x591239)['then'](function(_0xa5f58a){if(_0x591239[_0x98ff('0x65')]){return _[_0x98ff('0x30')](_0x1ccae4,function(_0x46ebbf){if(_0x46ebbf['sectionId']===0x709){_0x46ebbf['subsections']=_0xa5f58a;}return _0x46ebbf;});}else{var _0x4b7100={'sectionId':0x76c,'enabled':0x1,'subsections':_0xa5f58a};var _0x538497=_[_0x98ff('0x30')](_0x1ccae4);_0x538497[_0x98ff('0x69')](_0x4b7100);return _0x538497;}});}else{return;}})[_0x98ff('0x2b')](function(_0x8a790a){if(_0x8a790a)_0x1ccae4=_0x8a790a;return _[_0x98ff('0x42')](_0x1ccae4,[_0x98ff('0x65'),0x1]);})[_0x98ff('0x2b')](respondWithResult(_0x1af88c,null))['catch'](handleError(_0x1af88c,null));};function hasDefaultDashboard(_0x348833){var _0x4ba137=[0x65];return new BPromise(function(_0x3a0faa,_0x50fda4){try{if(_0x348833[_0x98ff('0x59')]){_0x3a0faa(_0x4ba137);}else{return db['UserProfileResource'][_0x98ff('0x6a')]({'where':{'sectionId':_0x348833['id']},'raw':!![]})[_0x98ff('0x2b')](function(_0x4c3c62){_0x4c3c62?_0x3a0faa(_0x4ba137):_0x3a0faa();});}}catch(_0x528cb3){_0x50fda4(_0x528cb3);}});}function getCustomDashboards(_0x39fab1){var _0x527d68=[];return new BPromise(function(_0x2bc84f,_0x358fb6){try{if(_0x39fab1[_0x98ff('0x59')]){return db[_0x98ff('0x6b')][_0x98ff('0x46')]({'raw':!![]})[_0x98ff('0x2b')](function(_0x5cd834){_0x5cd834['forEach'](function(_0x61dcdf){_0x527d68[_0x98ff('0x69')](_0x61dcdf['id']+0x1869f);});_0x2bc84f(_0x527d68);});}else{return db[_0x98ff('0x5a')][_0x98ff('0x46')]({'where':{'sectionId':_0x39fab1['id']},'raw':!![]})[_0x98ff('0x2b')](function(_0x10da98){_0x10da98['forEach'](function(_0x4c8899){_0x527d68[_0x98ff('0x69')](_0x4c8899[_0x98ff('0x6c')]+0x1869f);});_0x2bc84f(_0x527d68);});}}catch(_0x8b1ee1){_0x358fb6(_0x8b1ee1);}});}function getPlugins(_0x7be72c){var _0x468157=[];return new BPromise(function(_0x30de9b,_0x1f7537){try{if(_0x7be72c[_0x98ff('0x59')]){return db['Plugin'][_0x98ff('0x46')]({'raw':!![]})['then'](function(_0x2bd7a7){_0x2bd7a7[_0x98ff('0x6d')](function(_0x58532b){_0x468157[_0x98ff('0x69')](_0x58532b['id']+0x15b38);});_0x30de9b(_0x468157);});}else{return db[_0x98ff('0x5a')][_0x98ff('0x46')]({'where':{'sectionId':_0x7be72c['id']},'raw':!![]})[_0x98ff('0x2b')](function(_0x45890c){_0x45890c[_0x98ff('0x6d')](function(_0x1f3345){_0x468157[_0x98ff('0x69')](_0x1f3345[_0x98ff('0x6c')]+0x15b38);});_0x30de9b(_0x468157);});}}catch(_0x106f0b){_0x1f7537(_0x106f0b);}});}exports[_0x98ff('0x6e')]=function(_0x541994,_0x4eeeea){return db[_0x98ff('0x31')][_0x98ff('0x4a')]({'where':{'id':_0x541994['params']['id']}})['then'](handleEntityNotFound(_0x4eeeea,null))['then'](function(_0x553df4){if(_0x553df4){return db[_0x98ff('0x56')][_0x98ff('0x57')](function(_0x3a337b){return db[_0x98ff('0x60')][_0x98ff('0x46')]({'where':{'userProfileId':_0x541994[_0x98ff('0x49')]['id']},'attributes':['id'],'raw':!![]})[_0x98ff('0x2b')](function(_0x436859){if(_0x436859){return db[_0x98ff('0x60')][_0x98ff('0x61')]({'where':{'userProfileId':_0x541994['params']['id'],'id':_[_0x98ff('0x30')](_0x436859,function(_0x3a51b2){return _0x3a51b2['id'];})},'transaction':_0x3a337b});}})[_0x98ff('0x2b')](function(_0x19be95){var _0x5eaeb8=_[_0x98ff('0x30')](_0x541994[_0x98ff('0x4d')],function(_0x5b3aa0){_0x5b3aa0[_0x98ff('0x5c')]=_0x541994[_0x98ff('0x49')]['id'];return _0x5b3aa0;});return db['UserProfileSection'][_0x98ff('0x6f')](_0x5eaeb8,{'raw':!![],'transaction':_0x3a337b});})[_0x98ff('0x2b')](function(_0x150b27){var _0x2e12c6=_[_0x98ff('0x42')](_[_0x98ff('0x30')](_0x150b27,function(_0x552d36){return _0x552d36[_0x98ff('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x2e12c6){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x541994[_0x98ff('0x49')]['id'],'sectionId':_[_0x98ff('0x30')](_0x2e12c6,function(_0x8d939c){return _0x8d939c['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x98ff('0x2b')](function(_0x306f88){var _0xfbf24f=_[_0x98ff('0x30')](_0x541994[_0x98ff('0x4d')],function(_0x435b95){_0x435b95[_0x98ff('0x5c')]=_0x541994[_0x98ff('0x49')]['id'];return _0x435b95;});return db[_0x98ff('0x5a')]['bulkCreate'](_0xfbf24f,{'raw':!![],'transaction':_0x3a337b});});}})['catch'](handleError(_0x4eeeea,null));});}})['then'](function(_0x222765){var _0x16b43c=_[_0x98ff('0x30')](_0x222765,function(_0x2b631d){return _0x2b631d[_0x98ff('0x51')]({'plain':!![]});});})[_0x98ff('0x2b')](respondWithResult(_0x4eeeea,null))[_0x98ff('0x4b')](handleError(_0x4eeeea,null));};exports['removeResources']=function(_0x80d1e8,_0x2f7370,_0x4fb094){return db['UserProfile'][_0x98ff('0x4a')]({'where':{'id':_0x80d1e8['params']['id']}})['then'](handleEntityNotFound(_0x2f7370,null))[_0x98ff('0x2b')](function(_0xac0688){if(_0xac0688){return _0xac0688[_0x98ff('0x70')](_0x80d1e8['query'][_0x98ff('0x63')]);}})[_0x98ff('0x2b')](respondWithStatusCode(_0x2f7370,null))[_0x98ff('0x4b')](handleError(_0x2f7370,null));};exports[_0x98ff('0x71')]=function(_0x4931aa,_0x5b0d37){var _0x33db1d={};if(!_0x4931aa['query'][_0x98ff('0x72')])throw new Error(_0x98ff('0x73'));if(!_0x4931aa['query'][_0x98ff('0x3e')](_0x98ff('0x3f'))){_0x33db1d[_0x98ff('0x24')]=qs['limit'](_0x4931aa[_0x98ff('0x37')][_0x98ff('0x24')]);_0x33db1d['offset']=qs[_0x98ff('0x22')](_0x4931aa[_0x98ff('0x37')][_0x98ff('0x22')]);}return db[_0x98ff('0x31')][_0x98ff('0x4a')]({'where':{'id':_0x4931aa[_0x98ff('0x49')]['id']}})[_0x98ff('0x2b')](function(_0x40d35d){if(!_0x40d35d)throw new Error(_0x98ff('0x74')+_0x4931aa[_0x98ff('0x49')]['id']);return db[_0x98ff('0x31')][_0x98ff('0x71')](_0x4931aa);})[_0x98ff('0x2b')](respondWithFilteredResult(_0x5b0d37,_0x33db1d))['catch'](handleError(_0x5b0d37,null));}; \ No newline at end of file +var _0xb90a=['apply','reject','save','update','destroy','then','error','stack','name','send','index','map','UserProfile','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','rows','catch','show','create','body','clone','params','include','find','get','omit','createdAt','updatedAt','sequelize','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','describe','addSections','Resources','push','removeSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','eml-format','rimraf','fast-json-patch','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range'];(function(_0x130719,_0x2a7018){var _0x159865=function(_0x3a4d06){while(--_0x3a4d06){_0x130719['push'](_0x130719['shift']());}};_0x159865(++_0x2a7018);}(_0xb90a,0x12a));var _0xab90=function(_0x51854f,_0x576349){_0x51854f=_0x51854f-0x0;var _0xf40778=_0xb90a[_0x51854f];return _0xf40778;};'use strict';var emlformat=require(_0xab90('0x0'));var rimraf=require(_0xab90('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xab90('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xab90('0x3'));var sox=require(_0xab90('0x4'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab90('0x5'));var _=require(_0xab90('0x6'));var squel=require(_0xab90('0x7'));var crypto=require('crypto');var jsforce=require(_0xab90('0x8'));var deskjs=require(_0xab90('0x9'));var toCsv=require(_0xab90('0xa'));var querystring=require(_0xab90('0xb'));var Papa=require(_0xab90('0xc'));var Redis=require(_0xab90('0xd'));var authService=require(_0xab90('0xe'));var qs=require(_0xab90('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab90('0x10'));var logger=require(_0xab90('0x11'))(_0xab90('0x12'));var utils=require(_0xab90('0x13'));var config=require(_0xab90('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xab90('0x15'))['db'];config[_0xab90('0x16')]=_[_0xab90('0x17')](config[_0xab90('0x16')],{'host':_0xab90('0x18'),'port':0x18eb});var socket=require(_0xab90('0x19'))(new Redis(config[_0xab90('0x16')]));require(_0xab90('0x1a'))[_0xab90('0x1b')](socket);function respondWithStatusCode(_0x3dc022,_0x9abf7c){_0x9abf7c=_0x9abf7c||0xcc;return function(_0x29f352){if(_0x29f352){return _0x3dc022[_0xab90('0x1c')](_0x9abf7c);}return _0x3dc022['status'](_0x9abf7c)[_0xab90('0x1d')]();};}function respondWithResult(_0x5b68bd,_0x78ce5a){_0x78ce5a=_0x78ce5a||0xc8;return function(_0x138508){if(_0x138508){return _0x5b68bd['status'](_0x78ce5a)[_0xab90('0x1e')](_0x138508);}};}function respondWithFilteredResult(_0x2e0cf0,_0x2eef86){return function(_0x58cc79){if(_0x58cc79){var _0x2ab85c=typeof _0x2eef86[_0xab90('0x1f')]===_0xab90('0x20')&&typeof _0x2eef86[_0xab90('0x21')]==='undefined';var _0x2f6904=_0x58cc79['count'];var _0x30d6b3=_0x2ab85c?0x0:_0x2eef86['offset'];var _0x12b19a=_0x2ab85c?_0x58cc79[_0xab90('0x22')]:_0x2eef86[_0xab90('0x1f')]+_0x2eef86[_0xab90('0x21')];var _0x5d5c1c;if(_0x12b19a>=_0x2f6904){_0x12b19a=_0x2f6904;_0x5d5c1c=0xc8;}else{_0x5d5c1c=0xce;}_0x2e0cf0[_0xab90('0x23')](_0x5d5c1c);return _0x2e0cf0[_0xab90('0x24')](_0xab90('0x25'),_0x30d6b3+'-'+_0x12b19a+'/'+_0x2f6904)[_0xab90('0x1e')](_0x58cc79);}return null;};}function patchUpdates(_0x2195cc){return function(_0x17419e){try{jsonpatch[_0xab90('0x26')](_0x17419e,_0x2195cc,!![]);}catch(_0x210b5e){return BPromise[_0xab90('0x27')](_0x210b5e);}return _0x17419e[_0xab90('0x28')]();};}function saveUpdates(_0x4757ba,_0x23c089){return function(_0x1c680c){if(_0x1c680c){return _0x1c680c[_0xab90('0x29')](_0x4757ba)['then'](function(_0x7e141c){return _0x7e141c;});}return null;};}function removeEntity(_0x39e8a5,_0x167f84){return function(_0x22cf1a){if(_0x22cf1a){return _0x22cf1a[_0xab90('0x2a')]()[_0xab90('0x2b')](function(){_0x39e8a5[_0xab90('0x23')](0xcc)[_0xab90('0x1d')]();});}};}function handleEntityNotFound(_0x1a79d0,_0x52acf0){return function(_0x38b3ae){if(!_0x38b3ae){_0x1a79d0[_0xab90('0x1c')](0x194);}return _0x38b3ae;};}function handleError(_0x4e52d5,_0x3bbfb6){_0x3bbfb6=_0x3bbfb6||0x1f4;return function(_0x16be33){logger[_0xab90('0x2c')](_0x16be33[_0xab90('0x2d')]);if(_0x16be33[_0xab90('0x2e')]){delete _0x16be33[_0xab90('0x2e')];}_0x4e52d5[_0xab90('0x23')](_0x3bbfb6)[_0xab90('0x2f')](_0x16be33);};}exports[_0xab90('0x30')]=function(_0x2eec36,_0x581cc6){var _0x59ed30={},_0x5671c2={},_0x215c4b={'count':0x0,'rows':[]};var _0x5f1359=_[_0xab90('0x31')](db[_0xab90('0x32')][_0xab90('0x33')],function(_0x3116ad){return{'name':_0x3116ad['fieldName'],'type':_0x3116ad[_0xab90('0x34')][_0xab90('0x35')]};});_0x5671c2[_0xab90('0x36')]=_['map'](_0x5f1359,'name');_0x5671c2[_0xab90('0x37')]=_[_0xab90('0x38')](_0x2eec36[_0xab90('0x37')]);_0x5671c2[_0xab90('0x39')]=_[_0xab90('0x3a')](_0x5671c2[_0xab90('0x36')],_0x5671c2[_0xab90('0x37')]);_0x59ed30[_0xab90('0x3b')]=_[_0xab90('0x3a')](_0x5671c2[_0xab90('0x36')],qs[_0xab90('0x3c')](_0x2eec36['query'][_0xab90('0x3c')]));_0x59ed30[_0xab90('0x3b')]=_0x59ed30[_0xab90('0x3b')][_0xab90('0x3d')]?_0x59ed30[_0xab90('0x3b')]:_0x5671c2['model'];if(!_0x2eec36[_0xab90('0x37')][_0xab90('0x3e')](_0xab90('0x3f'))){_0x59ed30['limit']=qs[_0xab90('0x21')](_0x2eec36[_0xab90('0x37')][_0xab90('0x21')]);_0x59ed30[_0xab90('0x1f')]=qs[_0xab90('0x1f')](_0x2eec36[_0xab90('0x37')]['offset']);}_0x59ed30[_0xab90('0x40')]=qs['sort'](_0x2eec36[_0xab90('0x37')][_0xab90('0x41')]);_0x59ed30['where']=qs[_0xab90('0x39')](_['pick'](_0x2eec36[_0xab90('0x37')],_0x5671c2[_0xab90('0x39')]),_0x5f1359);if(_0x2eec36[_0xab90('0x37')][_0xab90('0x42')]){_0x59ed30[_0xab90('0x43')]=_['merge'](_0x59ed30[_0xab90('0x43')],{'$or':_['map'](_0x5f1359,function(_0xb24757){if(_0xb24757[_0xab90('0x34')]!=='VIRTUAL'){var _0x14165e={};_0x14165e[_0xb24757[_0xab90('0x2e')]]={'$like':'%'+_0x2eec36[_0xab90('0x37')]['filter']+'%'};return _0x14165e;}})});}_0x59ed30=_[_0xab90('0x44')]({},_0x59ed30,_0x2eec36[_0xab90('0x45')]);var _0x4e0bc7={'where':_0x59ed30['where']};return db[_0xab90('0x32')][_0xab90('0x22')](_0x4e0bc7)[_0xab90('0x2b')](function(_0x1c3328){_0x215c4b[_0xab90('0x22')]=_0x1c3328;if(_0x2eec36[_0xab90('0x37')][_0xab90('0x46')]){_0x59ed30['include']=[{'all':!![]}];}return db[_0xab90('0x32')]['findAll'](_0x59ed30);})[_0xab90('0x2b')](function(_0x5f0491){_0x215c4b[_0xab90('0x47')]=_0x5f0491;return _0x215c4b;})[_0xab90('0x2b')](respondWithFilteredResult(_0x581cc6,_0x59ed30))[_0xab90('0x48')](handleError(_0x581cc6,null));};exports[_0xab90('0x49')]=function(_0x3fb469,_0x28213d){var _0xda9abf={'raw':![],'where':{'id':_0x3fb469['params']['id']}},_0x71e440={};_0x71e440['model']=_['keys'](db['UserProfile'][_0xab90('0x33')]);_0x71e440['query']=_[_0xab90('0x38')](_0x3fb469[_0xab90('0x37')]);_0x71e440[_0xab90('0x39')]=_[_0xab90('0x3a')](_0x71e440[_0xab90('0x36')],_0x71e440['query']);_0xda9abf[_0xab90('0x3b')]=_['intersection'](_0x71e440[_0xab90('0x36')],qs[_0xab90('0x3c')](_0x3fb469['query'][_0xab90('0x3c')]));_0xda9abf[_0xab90('0x3b')]=_0xda9abf[_0xab90('0x3b')][_0xab90('0x3d')]?_0xda9abf[_0xab90('0x3b')]:_0x71e440[_0xab90('0x36')];if(_0x3fb469['query'][_0xab90('0x46')]){_0xda9abf['include']=[{'all':!![]}];}_0xda9abf=_[_0xab90('0x44')]({},_0xda9abf,_0x3fb469['options']);return db[_0xab90('0x32')]['find'](_0xda9abf)[_0xab90('0x2b')](handleEntityNotFound(_0x28213d,null))['then'](respondWithResult(_0x28213d,null))['catch'](handleError(_0x28213d,null));};exports['create']=function(_0x1bd4bd,_0x1bb19f){return db[_0xab90('0x32')][_0xab90('0x4a')](_0x1bd4bd[_0xab90('0x4b')],{})[_0xab90('0x2b')](respondWithResult(_0x1bb19f,0xc9))[_0xab90('0x48')](handleError(_0x1bb19f,null));};exports[_0xab90('0x4c')]=function(_0xce10c4,_0x4c416d){var _0x2a8860={'where':{'id':_0xce10c4[_0xab90('0x4d')]['id']}},_0x2953dc={};_0x2953dc['model']=_['keys'](db[_0xab90('0x32')][_0xab90('0x33')]);_0x2a8860[_0xab90('0x3b')]=_['intersection'](_0x2953dc[_0xab90('0x36')],qs[_0xab90('0x3c')](_0xce10c4[_0xab90('0x37')][_0xab90('0x3c')]));_0x2a8860[_0xab90('0x3b')]=_0x2a8860[_0xab90('0x3b')][_0xab90('0x3d')]?_0x2a8860['attributes']:_0x2953dc[_0xab90('0x36')];if(_0xce10c4[_0xab90('0x37')][_0xab90('0x46')]){_0x2a8860[_0xab90('0x4e')]=[{'all':!![]}];}_0x2a8860=_[_0xab90('0x44')]({},_0x2a8860,_0xce10c4['options']);return db[_0xab90('0x32')][_0xab90('0x4f')](_0x2a8860)[_0xab90('0x2b')](handleEntityNotFound(_0x4c416d,null))[_0xab90('0x2b')](function(_0x2cc9c0){if(_0x2cc9c0){var _0x1cb7c7=_0x2cc9c0[_0xab90('0x50')]({'plain':!![]});_0x1cb7c7=qs[_0xab90('0x51')](_0x1cb7c7,['id',_0xab90('0x52'),_0xab90('0x53'),'crudPermissions']);_0xce10c4[_0xab90('0x4b')]=_[_0xab90('0x51')](_0xce10c4[_0xab90('0x4b')],['id','createdAt',_0xab90('0x53')]);return db[_0xab90('0x54')][_0xab90('0x55')](function(_0x314624){return db[_0xab90('0x32')][_0xab90('0x4a')](_['merge'](_0x1cb7c7,_0xce10c4[_0xab90('0x4b')]),{'include':_0xce10c4[_0xab90('0x37')][_0xab90('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x314624})[_0xab90('0x2b')](function(_0x3f4b11){var _0x3f4fe0=_0x3f4b11[_0xab90('0x50')]({'plain':!![]});return db[_0xab90('0x56')][_0xab90('0x57')]({'where':{'userProfileId':_0xce10c4[_0xab90('0x4d')]['id']},'raw':!![]})[_0xab90('0x2b')](function(_0x1a5124){if(_0x1a5124){return BPromise[_0xab90('0x58')](_0x1a5124,function(_0x3cd4eb){return new BPromise(function(_0x3fc329,_0x21436e){if(_0x3cd4eb[_0xab90('0x59')]===null||_0x3cd4eb[_0xab90('0x59')]===0x1)_0x3fc329(null);return db[_0xab90('0x5a')][_0xab90('0x57')]({'where':{'sectionId':_0x3cd4eb['id']},'raw':!![]})[_0xab90('0x2b')](function(_0x3e605c){var _0x5840ee=_[_0xab90('0x31')](_0x3e605c,function(_0x4f34d7){return qs[_0xab90('0x51')](_0x4f34d7,['id',_0xab90('0x52'),'updatedAt',_0xab90('0x5b')]);});_0x3fc329(_0x5840ee);})[_0xab90('0x48')](function(_0x3ce4b2){_0x21436e(_0x3ce4b2);});})[_0xab90('0x2b')](function(_0x2390e0){var _0x53c7fb=qs[_0xab90('0x51')](_0x3cd4eb,['id',_0xab90('0x52'),_0xab90('0x53')]);_0x53c7fb[_0xab90('0x5c')]=_0x3f4fe0['id'];if(_0x2390e0)_0x53c7fb['Resources']=_0x2390e0;return _0x53c7fb;})[_0xab90('0x2b')](function(_0x8005c3){return db[_0xab90('0x56')][_0xab90('0x4a')](_0x8005c3,{'include':[{'model':db[_0xab90('0x5a')],'as':'Resources'}],'raw':!![],'transaction':_0x314624});});})[_0xab90('0x2b')](function(){return _0x3f4fe0;});}});});});}})[_0xab90('0x2b')](respondWithResult(_0x4c416d,0xc9))[_0xab90('0x48')](handleError(_0x4c416d,null));};exports['update']=function(_0x5ca541,_0x5b7230){if(_0x5ca541[_0xab90('0x4b')]['id']){delete _0x5ca541[_0xab90('0x4b')]['id'];}return db[_0xab90('0x32')][_0xab90('0x4f')]({'where':{'id':_0x5ca541[_0xab90('0x4d')]['id']}})[_0xab90('0x2b')](handleEntityNotFound(_0x5b7230,null))[_0xab90('0x2b')](saveUpdates(_0x5ca541[_0xab90('0x4b')],null))[_0xab90('0x2b')](respondWithResult(_0x5b7230,null))[_0xab90('0x48')](handleError(_0x5b7230,null));};exports[_0xab90('0x2a')]=function(_0x37dace,_0x4fc9b7){return db[_0xab90('0x32')][_0xab90('0x4f')]({'where':{'id':_0x37dace[_0xab90('0x4d')]['id']}})[_0xab90('0x2b')](handleEntityNotFound(_0x4fc9b7,null))['then'](removeEntity(_0x4fc9b7,null))[_0xab90('0x48')](handleError(_0x4fc9b7,null));};exports['describe']=function(_0x40a7d3,_0x15fda2){return db[_0xab90('0x32')][_0xab90('0x5d')]()[_0xab90('0x2b')](respondWithResult(_0x15fda2,null))[_0xab90('0x48')](handleError(_0x15fda2,null));};exports[_0xab90('0x5e')]=function(_0x3c121d,_0x27fa8){var _0x4e5099=_0x3c121d[_0xab90('0x4b')];return db[_0xab90('0x32')][_0xab90('0x4f')]({'where':{'id':_0x3c121d['params']['id']}})[_0xab90('0x2b')](handleEntityNotFound(_0x27fa8,null))[_0xab90('0x2b')](function(_0x1298cf){if(_0x1298cf){return db['sequelize'][_0xab90('0x55')](function(_0x299c96){return db['UserProfileSection'][_0xab90('0x2a')]({'where':{'userProfileId':_0x3c121d['params']['id'],'sectionId':_[_0xab90('0x31')](_0x4e5099,function(_0x367e18){return _0x367e18[_0xab90('0x5b')];})},'transaction':_0x299c96})[_0xab90('0x2b')](function(){var _0x5b28e6=_['map'](_0x4e5099,function(_0x8b4948){_0x8b4948[_0xab90('0x5c')]=_0x3c121d['params']['id'];return _0x8b4948;});var _0x477321=[];return BPromise[_0xab90('0x58')](_0x5b28e6,function(_0x257554){return db['UserProfileSection'][_0xab90('0x4a')](_0x257554,{'include':[{'model':db[_0xab90('0x5a')],'as':_0xab90('0x5f')}],'raw':!![],'transaction':_0x299c96})['then'](function(_0x576302){_0x477321[_0xab90('0x60')](_0x576302[_0xab90('0x50')]({'plain':!![]}));});})['then'](function(){return _0x477321;});});});}})[_0xab90('0x2b')](function(_0x468e02){return _0x468e02;})[_0xab90('0x2b')](respondWithResult(_0x27fa8,null))[_0xab90('0x48')](handleError(_0x27fa8,null));};exports[_0xab90('0x61')]=function(_0x568777,_0x2a07ab){var _0x50bf5a;return db[_0xab90('0x32')][_0xab90('0x4f')]({'where':{'id':_0x568777['params']['id']},'attributes':['id','name']})[_0xab90('0x2b')](handleEntityNotFound(_0x2a07ab,null))[_0xab90('0x2b')](function(_0x427614){if(_0x427614){_0x50bf5a=_0x427614;return db[_0xab90('0x56')][_0xab90('0x2a')]({'where':{'userProfileId':_0x568777['params']['id'],'sectionId':_0x568777[_0xab90('0x37')]['ids']}});}})['then'](function(){return _0x50bf5a;})[_0xab90('0x2b')](respondWithStatusCode(_0x2a07ab,null))[_0xab90('0x48')](handleError(_0x2a07ab,null));};exports['getSections']=function(_0x97ae25,_0x11cab8){var _0x50bfcc=[];var _0x56027e=[];return db[_0xab90('0x56')][_0xab90('0x57')]({'where':{'userProfileId':_0x97ae25[_0xab90('0x4d')]['id']},'raw':!![]})['then'](function(_0xf48571){_0x50bfcc=_['filter'](_0xf48571,function(_0x286d82){return _0x286d82[_0xab90('0x62')]===0x1||_[_0xab90('0x63')]([0x3eb,0x709],_0x286d82[_0xab90('0x5b')]);});if(!_[_0xab90('0x64')](_0x50bfcc)){return _[_0xab90('0x31')](_0x50bfcc,function(_0x4c154f){return _0x4c154f[_0xab90('0x5b')];});}else{return;}})[_0xab90('0x2b')](function(_0xa630c0){if(_0xa630c0)_0x56027e=_0xa630c0;if(_['includes'](_0x56027e,0x64)){var _0x1b8d15=_[_0xab90('0x4f')](_0x50bfcc,{'sectionId':0x64});return hasDefaultDashboard(_0x1b8d15)[_0xab90('0x2b')](function(_0x22e319){return _[_0xab90('0x31')](_0x50bfcc,function(_0x27e745){if(_0x27e745[_0xab90('0x5b')]===0x64){_0x27e745[_0xab90('0x65')]=_0x22e319;}return _0x27e745;});});}else{return;}})['then'](function(_0x3a31fc){if(_0x3a31fc)_0x50bfcc=_0x3a31fc;if(_['includes'](_0x56027e,0x3eb)){var _0x591acb=_[_0xab90('0x4f')](_0x50bfcc,{'sectionId':0x3eb});return getCustomDashboards(_0x591acb)[_0xab90('0x2b')](function(_0x4ec8ee){return _[_0xab90('0x31')](_0x50bfcc,function(_0x2d51f8){if(_0x591acb[_0xab90('0x62')]){if(_0x2d51f8['sectionId']===0x3eb){_0x2d51f8['subsections']=_0x4ec8ee;}}else{if(_0x2d51f8[_0xab90('0x5b')]===0x64){_0x2d51f8[_0xab90('0x65')]=_0x4ec8ee;}}return _0x2d51f8;});});}else{return;}})[_0xab90('0x2b')](function(_0xea9ac){if(_0xea9ac)_0x50bfcc=_0xea9ac;if(_[_0xab90('0x63')](_0x56027e,0x709)){var _0x2e1fd7=_[_0xab90('0x4f')](_0x50bfcc,{'sectionId':0x709});return getPlugins(_0x2e1fd7)[_0xab90('0x2b')](function(_0x3f2d6a){if(_0x2e1fd7[_0xab90('0x62')]){return _[_0xab90('0x31')](_0x50bfcc,function(_0x13f596){if(_0x13f596[_0xab90('0x5b')]===0x709){_0x13f596[_0xab90('0x65')]=_0x3f2d6a;}return _0x13f596;});}else{var _0x58c765={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3f2d6a};var _0x7db904=_[_0xab90('0x31')](_0x50bfcc);_0x7db904['push'](_0x58c765);return _0x7db904;}});}else{return;}})['then'](function(_0xb68729){if(_0xb68729)_0x50bfcc=_0xb68729;return _[_0xab90('0x42')](_0x50bfcc,[_0xab90('0x62'),0x1]);})[_0xab90('0x2b')](respondWithResult(_0x11cab8,null))[_0xab90('0x48')](handleError(_0x11cab8,null));};function hasDefaultDashboard(_0x59172b){var _0x296e00=[0x65];return new BPromise(function(_0x4e53d7,_0x51e8d7){try{if(_0x59172b[_0xab90('0x59')]){_0x4e53d7(_0x296e00);}else{return db[_0xab90('0x5a')][_0xab90('0x66')]({'where':{'sectionId':_0x59172b['id']},'raw':!![]})[_0xab90('0x2b')](function(_0x48c012){_0x48c012?_0x4e53d7(_0x296e00):_0x4e53d7();});}}catch(_0xe0db61){_0x51e8d7(_0xe0db61);}});}function getCustomDashboards(_0x50a03d){var _0x7ebc2c=[];return new BPromise(function(_0x166f11,_0x4ab9ef){try{if(_0x50a03d[_0xab90('0x59')]){return db[_0xab90('0x67')][_0xab90('0x57')]({'raw':!![]})[_0xab90('0x2b')](function(_0x421f0b){_0x421f0b['forEach'](function(_0x3184c2){_0x7ebc2c[_0xab90('0x60')](_0x3184c2['id']+0x1869f);});_0x166f11(_0x7ebc2c);});}else{return db[_0xab90('0x5a')]['findAll']({'where':{'sectionId':_0x50a03d['id']},'raw':!![]})[_0xab90('0x2b')](function(_0x4aef90){_0x4aef90[_0xab90('0x68')](function(_0x384197){_0x7ebc2c[_0xab90('0x60')](_0x384197[_0xab90('0x69')]+0x1869f);});_0x166f11(_0x7ebc2c);});}}catch(_0x41bf5c){_0x4ab9ef(_0x41bf5c);}});}function getPlugins(_0x333e87){var _0x150f5b=[];return new BPromise(function(_0x4e664c,_0x31a069){try{if(_0x333e87['autoAssociation']){return db['Plugin'][_0xab90('0x57')]({'raw':!![]})[_0xab90('0x2b')](function(_0x450828){_0x450828[_0xab90('0x68')](function(_0xe79335){_0x150f5b[_0xab90('0x60')](_0xe79335['id']+0x15b38);});_0x4e664c(_0x150f5b);});}else{return db[_0xab90('0x5a')][_0xab90('0x57')]({'where':{'sectionId':_0x333e87['id']},'raw':!![]})['then'](function(_0x7f0254){_0x7f0254[_0xab90('0x68')](function(_0x22c06f){_0x150f5b['push'](_0x22c06f[_0xab90('0x69')]+0x15b38);});_0x4e664c(_0x150f5b);});}}catch(_0x41ba31){_0x31a069(_0x41ba31);}});}exports['addResources']=function(_0x3da655,_0x13b781){return db[_0xab90('0x32')][_0xab90('0x4f')]({'where':{'id':_0x3da655['params']['id']}})['then'](handleEntityNotFound(_0x13b781,null))['then'](function(_0x1c9dff){if(_0x1c9dff){return db['sequelize'][_0xab90('0x55')](function(_0x364df5){return db[_0xab90('0x56')][_0xab90('0x57')]({'where':{'userProfileId':_0x3da655[_0xab90('0x4d')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x29b631){if(_0x29b631){return db[_0xab90('0x56')]['destroy']({'where':{'userProfileId':_0x3da655[_0xab90('0x4d')]['id'],'id':_[_0xab90('0x31')](_0x29b631,function(_0x5eeb2d){return _0x5eeb2d['id'];})},'transaction':_0x364df5});}})[_0xab90('0x2b')](function(_0x438e57){var _0x188188=_[_0xab90('0x31')](_0x3da655[_0xab90('0x4b')],function(_0xb3393d){_0xb3393d[_0xab90('0x5c')]=_0x3da655['params']['id'];return _0xb3393d;});return db[_0xab90('0x56')][_0xab90('0x6a')](_0x188188,{'raw':!![],'transaction':_0x364df5});})['then'](function(_0x38e466){var _0x2ccbdb=_[_0xab90('0x42')](_['map'](_0x38e466,function(_0x226c1b){return _0x226c1b[_0xab90('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x2ccbdb){return db[_0xab90('0x56')][_0xab90('0x57')]({'where':{'userProfileId':_0x3da655['params']['id'],'sectionId':_['map'](_0x2ccbdb,function(_0x599b95){return _0x599b95[_0xab90('0x5b')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xab90('0x2b')](function(_0x22bd9b){var _0x545476=_[_0xab90('0x31')](_0x3da655['body'],function(_0x175c6c){_0x175c6c[_0xab90('0x5c')]=_0x3da655[_0xab90('0x4d')]['id'];return _0x175c6c;});return db[_0xab90('0x5a')][_0xab90('0x6a')](_0x545476,{'raw':!![],'transaction':_0x364df5});});}})['catch'](handleError(_0x13b781,null));});}})[_0xab90('0x2b')](function(_0x4603fa){var _0x58d33d=_['map'](_0x4603fa,function(_0x8c8a1e){return _0x8c8a1e[_0xab90('0x50')]({'plain':!![]});});})[_0xab90('0x2b')](respondWithResult(_0x13b781,null))[_0xab90('0x48')](handleError(_0x13b781,null));};exports[_0xab90('0x6b')]=function(_0x47ca16,_0x3315f9,_0x572a6d){return db[_0xab90('0x32')][_0xab90('0x4f')]({'where':{'id':_0x47ca16['params']['id']}})[_0xab90('0x2b')](handleEntityNotFound(_0x3315f9,null))[_0xab90('0x2b')](function(_0x26f7ed){if(_0x26f7ed){return _0x26f7ed[_0xab90('0x6b')](_0x47ca16['query'][_0xab90('0x6c')]);}})[_0xab90('0x2b')](respondWithStatusCode(_0x3315f9,null))[_0xab90('0x48')](handleError(_0x3315f9,null));};exports[_0xab90('0x6d')]=function(_0x3ea6aa,_0x5c106c){var _0x1bc5a1={};if(!_0x3ea6aa[_0xab90('0x37')][_0xab90('0x6e')])throw new Error(_0xab90('0x6f'));if(!_0x3ea6aa[_0xab90('0x37')][_0xab90('0x3e')](_0xab90('0x3f'))){_0x1bc5a1['limit']=qs['limit'](_0x3ea6aa[_0xab90('0x37')][_0xab90('0x21')]);_0x1bc5a1['offset']=qs[_0xab90('0x1f')](_0x3ea6aa['query']['offset']);}return db[_0xab90('0x32')]['find']({'where':{'id':_0x3ea6aa[_0xab90('0x4d')]['id']}})[_0xab90('0x2b')](function(_0x5a1cc5){if(!_0x5a1cc5)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x3ea6aa[_0xab90('0x4d')]['id']);return db[_0xab90('0x32')][_0xab90('0x6d')](_0x3ea6aa);})[_0xab90('0x2b')](respondWithFilteredResult(_0x5c106c,_0x1bc5a1))[_0xab90('0x48')](handleError(_0x5c106c,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 6455619..3f65d2d 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 _0x6db4=['emit','hasOwnProperty','hook','../../mysqldb','UserProfile','setMaxListeners','save','update','remove'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x6db4,0x111));var _0x46db=function(_0x3b0506,_0x4e1cd0){_0x3b0506=_0x3b0506-0x0;var _0x2ee494=_0x6db4[_0x3b0506];return _0x2ee494;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x46db('0x0'))['db'][_0x46db('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x46db('0x2')](0x0);var events={'afterCreate':_0x46db('0x3'),'afterUpdate':_0x46db('0x4'),'afterDestroy':_0x46db('0x5')};function emitEvent(_0x5a9b9c){return function(_0x476ef3,_0x8e4cd8,_0x2a762b){UserProfileEvents[_0x46db('0x6')](_0x5a9b9c+':'+_0x476ef3['id'],_0x476ef3);UserProfileEvents[_0x46db('0x6')](_0x5a9b9c,_0x476ef3);_0x2a762b(null);};}for(var e in events){if(events[_0x46db('0x7')](e)){var event=events[e];UserProfile[_0x46db('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x9e2e=['save','emit','hasOwnProperty','exports','events','../../mysqldb','UserProfile'];(function(_0x5a78c1,_0x50e2ff){var _0x564cc4=function(_0x42ae83){while(--_0x42ae83){_0x5a78c1['push'](_0x5a78c1['shift']());}};_0x564cc4(++_0x50e2ff);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x3286e2,_0x5edabd){_0x3286e2=_0x3286e2-0x0;var _0x351546=_0x9e2e[_0x3286e2];return _0x351546;};'use strict';var EventEmitter=require(_0xe9e2('0x0'));var UserProfile=require(_0xe9e2('0x1'))['db'][_0xe9e2('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe9e2('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2d34ef){return function(_0x11a0e5,_0x3bfa90,_0x212d98){UserProfileEvents[_0xe9e2('0x4')](_0x2d34ef+':'+_0x11a0e5['id'],_0x11a0e5);UserProfileEvents[_0xe9e2('0x4')](_0x2d34ef,_0x11a0e5);_0x212d98(null);};}for(var e in events){if(events[_0xe9e2('0x5')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xe9e2('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index d6efd4d..85250fc 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 _0x3fb1=['VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelAccount','SmsAccount','WhatsappAccount','teams','Team','queuecampaigns','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','CannedAnswer','dispositions','Disposition','Dashboard','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','metrics','whatsappaccounts','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','ui.createdAt','_interactions','where','sequelize','query','toString','OpenTabs','catch','define','UserProfile','section','isEmpty','length','find','ignore','union','autoAssociation','push','all','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','foreignKey','options','include','forEach','reportType','default','type','DefaultReports','custom','CustomReports','rows','includeAll','Tags','ThroughTags','color','tag','openTabs','true','sms','dataValues','fax','mail','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','value','findAll','associatedResources','map','model','name','UserProfileResource','then','field','AnalyticExtractedReport','resourceId','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','projectName','contacts','CmContact','Lists','ListId','lists','CmList','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','VoiceRecording','membername','role','agent','Telephones','User'];(function(_0x2a1e29,_0x2362f7){var _0x58b595=function(_0x242f63){while(--_0x242f63){_0x2a1e29['push'](_0x2a1e29['shift']());}};_0x58b595(++_0x2362f7);}(_0x3fb1,0x80));var _0x13fb=function(_0x3ec74e,_0x2f6536){_0x3ec74e=_0x3ec74e-0x0;var _0x5a53f9=_0x3fb1[_0x3ec74e];return _0x5a53f9;};'use strict';var _=require(_0x13fb('0x0'));var attributes=require(_0x13fb('0x1'));var qs=require(_0x13fb('0x2'));module[_0x13fb('0x3')]=function(_0xab20d8){var _0x13a8e1=_0xab20d8[_0x13fb('0x4')];function _0x4b70f5(_0x1fb1b8,_0x5e3711){return new Promise(function(_0x5eb8eb,_0x176b70){if(!_0x5e3711)return _0x5eb8eb(null);var _0x539062=_0x5e3711[_0x13fb('0x5')]?{[_0x5e3711[_0x13fb('0x5')]['field']]:_0x5e3711[_0x13fb('0x5')][_0x13fb('0x6')]}:undefined;return _0x13a8e1[_0x1fb1b8][_0x13fb('0x7')]({'where':_0x539062,'raw':!![]})['then'](function(_0x360028){_0x5e3711[_0x13fb('0x8')]=_[_0x13fb('0x9')](_0x360028,'id');_0x5eb8eb(_0x5e3711);})['catch'](function(_0x5b6f8c){_0x176b70(_0x5b6f8c);});});}function _0x21aca4(_0x10bc03,_0x4ed4bb){return new Promise(function(_0x3fabf3,_0x186112){var _0x6936fb=_0x10bc03[_0x13fb('0x5')]?{[_0x10bc03[_0x13fb('0x5')]['field']]:_0x10bc03[_0x13fb('0x5')][_0x13fb('0x6')]}:undefined;return _0x13a8e1[_0x10bc03[_0x13fb('0xa')]]['findAll']({'where':_0x6936fb,'raw':!![]})['then'](function(_0x10df01){_0x4ed4bb[_0x13fb('0x8')]=_[_0x13fb('0x9')](_0x10df01,function(_0x198340){return _0x198340[_0x13fb('0xb')];});_0x3fabf3(_0x4ed4bb);})['catch'](function(_0x375524){_0x186112(_0x375524);});});}function _0x5a964b(_0x409ce1,_0x262a06,_0x93f620){if(!_0x262a06)return resolve(null);return new Promise(function(_0x55fe24,_0x4c311b){return _0x13a8e1[_0x13fb('0xc')]['findAll']({'where':{'sectionId':_0x262a06['id']},'raw':!![]})[_0x13fb('0xd')](function(_0x421812){if(_0x409ce1[_0x13fb('0xe')]&&_0x409ce1['field']!=='id'){_0x262a06[_0x13fb('0x8')]=_[_0x13fb('0x9')](_0x421812,function(_0x3588db){return _0x3588db[_0x409ce1[_0x13fb('0xe')]];});}else{if(_0x93f620===_0x13fb('0xf')){_0x262a06[_0x13fb('0x8')]=_[_0x13fb('0x9')](_0x421812,function(_0x1a3e00){return{'id':_0x1a3e00[_0x13fb('0x10')],'type':_0x1a3e00['type']};});}else{_0x262a06[_0x13fb('0x8')]=_[_0x13fb('0x9')](_0x421812,function(_0x3d80df){return _0x3d80df['resourceId'];});}}_0x55fe24(_0x262a06);})['catch'](function(_0x4eb8e0){_0x4c311b(_0x4eb8e0);});});}function _0x341c04(_0x549271,_0x12a7c0){var _0x8e6a31={'parentSections':[]};switch(_0x549271['toLowerCase']()){case'squareprojects':_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x12');break;case'odbc':_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x13');break;case _0x13fb('0x14'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x15');_0x8e6a31[_0x13fb('0x16')]=[{'name':'SquareProjects','field':_0x13fb('0xb'),'foreignKey':_0x13fb('0x17')}];break;case'projects':_0x8e6a31[_0x13fb('0x11')]='JscriptyProject';break;case _0x13fb('0x18'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x19');_0x8e6a31[_0x13fb('0x16')]=[{'name':_0x13fb('0x1a'),'field':'id','foreignKey':_0x13fb('0x1b')}];break;case _0x13fb('0x1c'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x1d');break;case'companies':_0x8e6a31[_0x13fb('0x11')]='CmCompany';break;case _0x13fb('0x1e'):_0x8e6a31[_0x13fb('0x11')]='CmCustomField';break;case _0x13fb('0x1f'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x20');break;case _0x13fb('0x21'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x22');break;case'faxqueues':_0x8e6a31[_0x13fb('0x11')]='FaxQueue';break;case _0x13fb('0x23'):_0x8e6a31[_0x13fb('0x11')]='FaxAccount';break;case _0x13fb('0x24'):case'internalroutes':case _0x13fb('0x25'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x26');break;case _0x13fb('0x27'):_0x8e6a31[_0x13fb('0x11')]='VoiceContext';break;case'voicemails':_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x28');break;case _0x13fb('0x29'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x2a');_0x8e6a31[_0x13fb('0x16')]=[{'name':'Agents','field':'name','foreignKey':_0x13fb('0x2b'),'model':'User','filter':{'field':_0x13fb('0x2c'),'value':[_0x13fb('0x2d')]}},{'name':_0x13fb('0x2e'),'field':_0x13fb('0xb'),'foreignKey':_0x13fb('0x2b'),'model':_0x13fb('0x2f'),'filter':{'field':_0x13fb('0x2c'),'value':['telephone']}},{'name':_0x13fb('0x30'),'field':_0x13fb('0xb'),'foreignKey':'queue','model':_0x13fb('0x31'),'filter':{'field':'type','value':[_0x13fb('0x32')]}},{'name':_0x13fb('0x33'),'field':_0x13fb('0xb'),'foreignKey':_0x13fb('0x34'),'model':_0x13fb('0x31'),'filter':{'field':'type','value':['outbound']}}];break;case _0x13fb('0x35'):_0x8e6a31[_0x13fb('0x11')]='VoiceMusicOnHold';break;case _0x13fb('0x36'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x37');break;case _0x13fb('0x38'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x39');break;case _0x13fb('0x3a'):_0x8e6a31[_0x13fb('0x11')]='Campaign';break;case _0x13fb('0x3b'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x3c');break;case _0x13fb('0x3d'):_0x8e6a31['childModel']=_0x13fb('0x3e');break;case _0x13fb('0x3f'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x40');break;case _0x13fb('0x41'):_0x8e6a31[_0x13fb('0x11')]='OpenchannelQueue';break;case'openchannelaccounts':_0x8e6a31['childModel']=_0x13fb('0x42');break;case'smsqueues':_0x8e6a31[_0x13fb('0x11')]='SmsQueue';break;case'smsaccounts':_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x43');break;case'whatsappqueues':_0x8e6a31[_0x13fb('0x11')]='WhatsappQueue';break;case'whatsappaccounts':_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x44');break;case _0x13fb('0x45'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x46');break;case'voicequeues':case _0x13fb('0x47'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x31');if(_0x12a7c0){_0x8e6a31[_0x13fb('0x16')]=[{'name':_0x13fb('0x30')},{'name':_0x13fb('0x33')}];}break;case'users':case'agents':case _0x13fb('0x48'):_0x8e6a31[_0x13fb('0x11')]='User';if(_0x12a7c0){_0x8e6a31[_0x13fb('0x16')]=[{'name':_0x13fb('0x49'),'filter':{'field':_0x13fb('0x2c'),'value':[_0x13fb('0x4a'),_0x13fb('0x4b')]},'ignore':!![]},{'name':_0x13fb('0x4c')},{'name':_0x13fb('0x2e')}];}break;case _0x13fb('0x4d'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x4e');break;case _0x13fb('0x4f'):_0x8e6a31['childModel']=_0x13fb('0x50');break;case _0x13fb('0x51'):_0x8e6a31['childModel']='FreshdeskAccount';break;case _0x13fb('0x52'):_0x8e6a31['childModel']=_0x13fb('0x53');break;case _0x13fb('0x54'):_0x8e6a31['childModel']=_0x13fb('0x55');break;case _0x13fb('0x56'):_0x8e6a31[_0x13fb('0x11')]='ZohoAccount';break;case _0x13fb('0x57'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x2f');break;case'cannedanswers':_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x58');break;case _0x13fb('0x59'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x5a');break;case'customdashboards':_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x5b');break;case'intervals':_0x8e6a31['childModel']=_0x13fb('0x5c');break;case _0x13fb('0x5d'):_0x8e6a31[_0x13fb('0x11')]='Pause';break;case _0x13fb('0x5e'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x5f');break;case _0x13fb('0x60'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x61');break;case _0x13fb('0x62'):_0x8e6a31['childModel']=_0x13fb('0x63');break;case _0x13fb('0x64'):_0x8e6a31[_0x13fb('0x11')]='Template';break;case _0x13fb('0x65'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x66');break;case'trunks':_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x67');break;case _0x13fb('0x68'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x69');break;case _0x13fb('0x6a'):_0x8e6a31[_0x13fb('0x11')]=_0x13fb('0x6b');break;case _0x13fb('0x6c'):_0x8e6a31[_0x13fb('0x11')]='AnalyticExtractedReport';_0x8e6a31[_0x13fb('0x16')]=[{'name':'Reports','field':'id','foreignKey':_0x13fb('0x6d')}];break;case _0x13fb('0x6e'):_0x8e6a31[_0x13fb('0x11')]='AnalyticMetric';break;case _0x13fb('0x6f'):_0x8e6a31['childModel']=_0x13fb('0x44');break;}return _0x8e6a31;}function _0x4f8ff0(_0xa96faf,_0x20fa34){var _0x19b502=_0xa96faf[_0x13fb('0x70')](0x0)[_0x13fb('0x71')]()+_0xa96faf[_0x13fb('0x72')](0x1);var _0x51b064={'type':_0x13a8e1['Sequelize'][_0x13fb('0x73')][_0x13fb('0x74')],'raw':!![]};return new BPromise(function(_0x29e855,_0x4e12ab){var _0x59797c=squel[_0x13fb('0x75')]()[_0x13fb('0xe')](_0x13fb('0x76')+_0x19b502+'InteractionId','id')[_0x13fb('0xe')](_0x13fb('0x77'))['from']('user_has_'+_0xa96faf+_0x13fb('0x78'),'ui')[_0x13fb('0x79')]('ui.UserId\x20=\x20?',_0x20fa34['id']);return _0x13a8e1[_0x13fb('0x7a')][_0x13fb('0x7b')](_0x59797c[_0x13fb('0x7c')](),_0x51b064)['then'](function(_0x3c4b85){_0x20fa34[_0x19b502+_0x13fb('0x7d')]=_0x3c4b85;_0x29e855(_0x3c4b85);})[_0x13fb('0x7e')](function(_0x2d6211){_0x4e12ab(_0x2d6211);});});}return _0xab20d8[_0x13fb('0x7f')](_0x13fb('0x80'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2adafe){var _0xddea69={'raw':![],'where':{}};var _0x35f9d2={};var _0x40d09f={'count':0x0,'rows':[]};var _0x9f5288=_0x2adafe['query'][_0x13fb('0x81')];var _0x55d6e7=_0x2adafe['query']['mergeResources']||![];var _0xe7c588=_0x341c04(_0x9f5288,_0x55d6e7);if(!_0xe7c588[_0x13fb('0x11')])throw new Error('Invalid\x20section\x20\x27'+_0x9f5288+'\x27');var _0x16c1cd=[{'name':_0x9f5288}];if(!_[_0x13fb('0x82')](_0xe7c588[_0x13fb('0x16')]))_0x16c1cd=_0xe7c588[_0x13fb('0x16')];var _0x4d5935=[];for(var _0x5cf061=0x0;_0x5cf061<_0x16c1cd[_0x13fb('0x83')];_0x5cf061++){_0x4d5935['push'](_0x13a8e1['UserProfileSection'][_0x13fb('0x84')]({'where':{'userProfileId':_0x2adafe['params']['id'],'name':_0x16c1cd[_0x5cf061][_0x13fb('0xb')]},'raw':!![]}));}return Promise['all'](_0x4d5935)[_0x13fb('0xd')](function(_0x1f4aba){var _0x130d50=_[_0x13fb('0x5')](_0x1f4aba,function(_0x531f7e){return _0x531f7e?_0x531f7e:undefined;});var _0x48ede6=_[_0x13fb('0x5')](_0x16c1cd,[_0x13fb('0x85'),!![]]);var _0x2883a5=_[_0x13fb('0x82')](_0x130d50)&&_[_0x13fb('0x82')](_0x48ede6)?null:_[_0x13fb('0x86')](_0x48ede6,_0x130d50);if(!_0x2883a5)return null;var _0x4eac25=[];for(var _0x390206=0x0;_0x390206<_0x2883a5[_0x13fb('0x83')];_0x390206++){var _0x29388a=_[_0x13fb('0x84')](_0x16c1cd,function(_0x40bf4c){return _0x2883a5[_0x390206]?_0x40bf4c[_0x13fb('0xb')]===_0x2883a5[_0x390206][_0x13fb('0xb')]:null;});if(_0x29388a){if(_0x2883a5[_0x390206][_0x13fb('0x85')]){_0x4eac25['push'](_0x4b70f5(_0xe7c588['childModel'],_0x2883a5[_0x390206]));}else{if(!_0x2883a5[_0x390206][_0x13fb('0x87')]){_0x4eac25['push'](_0x5a964b(_0x29388a,_0x2883a5[_0x390206],_0xe7c588[_0x13fb('0x11')]));}else{if(_0x29388a['model']){_0x4eac25[_0x13fb('0x88')](_0x21aca4(_0x29388a,_0x2883a5[_0x390206]));}}}}}return Promise[_0x13fb('0x89')](_0x4eac25);})[_0x13fb('0xd')](function(_0x234f49){var _0x1bb552=_0x234f49;var _0x20c836=null;if(_0x1bb552){_0x20c836=_0x1bb552[_0x13fb('0x83')]===0x1?_0x1bb552[0x0]:null;}if(!_0x20c836&&!_0x1bb552)return _0x40d09f;var _0x5389ef=_0x13a8e1[_0xe7c588['childModel']][_0x13fb('0x8a')];_0x35f9d2[_0x13fb('0xa')]=_[_0x13fb('0x8b')](_0x5389ef);_0x35f9d2[_0x13fb('0x7b')]=_[_0x13fb('0x8b')](_0x2adafe[_0x13fb('0x7b')]);_0x35f9d2[_0x13fb('0x8c')]=_[_0x13fb('0x8d')](_0x35f9d2[_0x13fb('0xa')],_0x35f9d2[_0x13fb('0x7b')]);_0xddea69[_0x13fb('0x8e')]=_[_0x13fb('0x8d')](_0x35f9d2[_0x13fb('0xa')],qs[_0x13fb('0x8f')](_0x2adafe['query']['fields']));_0xddea69['attributes']=_0xddea69[_0x13fb('0x8e')]['length']?_0xddea69[_0x13fb('0x8e')]:_0x35f9d2['model'];if(!_0x2adafe['query'][_0x13fb('0x90')](_0x13fb('0x91'))){_0xddea69['limit']=qs[_0x13fb('0x92')](_0x2adafe[_0x13fb('0x7b')]['limit']);_0xddea69['offset']=qs[_0x13fb('0x93')](_0x2adafe[_0x13fb('0x7b')]['offset']);}_0xddea69[_0x13fb('0x94')]=qs[_0x13fb('0x95')](_0x2adafe[_0x13fb('0x7b')][_0x13fb('0x95')]);_0xddea69[_0x13fb('0x79')]=qs['filters'](_[_0x13fb('0x96')](_0x2adafe[_0x13fb('0x7b')],_0x35f9d2['filters']));if(_0x2adafe[_0x13fb('0x7b')][_0x13fb('0x5')]){_0xddea69[_0x13fb('0x79')]=_[_0x13fb('0x97')](_0xddea69[_0x13fb('0x79')],{'$or':_[_0x13fb('0x9')](_0x5389ef,function(_0x1cfa63){if(_0x1cfa63['type'][_0x13fb('0x98')]!==_0x13fb('0x99')){var _0x96fc43={};_0x96fc43[_0x1cfa63[_0x13fb('0xe')]]={'$like':'%'+_0x2adafe['query'][_0x13fb('0x5')]+'%'};return _0x96fc43;}})});}var _0x1d65ca=[];if(_0x20c836){var _0x90c597=_[_0x13fb('0x84')](_0x16c1cd,[_0x13fb('0xb'),_0x20c836['name']]);if(_0x90c597[_0x13fb('0xe')]){var _0x389e31={};if(_0xe7c588[_0x13fb('0x11')]===_0x13fb('0xf')){_0x389e31[_0x90c597[_0x13fb('0x9a')]]=_['map'](_0x20c836[_0x13fb('0x8')],'id');}else{_0x389e31[_0x90c597[_0x13fb('0x9a')]]=_0x20c836['associatedResources'];}_0x1d65ca[_0x13fb('0x88')](_0x389e31);}else{_0xddea69['where']['id']=_0x20c836['associatedResources'];}}else{for(var _0xed06dd=0x0;_0xed06dd<_0x1bb552[_0x13fb('0x83')];_0xed06dd++){var _0x90c597=_[_0x13fb('0x84')](_0x16c1cd,[_0x13fb('0xb'),_0x1bb552[_0xed06dd][_0x13fb('0xb')]]);if(_0x90c597[_0x13fb('0xe')]){var _0x389e31={};_0x389e31[_0x90c597[_0x13fb('0x9a')]]=_0x1bb552[_0xed06dd]['associatedResources'];_0x1d65ca[_0x13fb('0x88')](_0x389e31);}else{if(!_0xddea69[_0x13fb('0x79')]['id'])_0xddea69[_0x13fb('0x79')]['id']=[];_0x1bb552[_0xed06dd]['associatedResources']['forEach'](function(_0x11ba47){_0xddea69[_0x13fb('0x79')]['id'][_0x13fb('0x88')](_0x11ba47);});}}}if(!_[_0x13fb('0x82')](_0x1d65ca)){_0xddea69[_0x13fb('0x79')]=_['merge'](_0xddea69[_0x13fb('0x79')],{'$and':{'$or':_0x1d65ca}});}_0xddea69=_['merge']({},_0xddea69,_0x2adafe[_0x13fb('0x9b')]);if(_0x20c836&&!_0x20c836['autoAssociation']&&_0xe7c588[_0x13fb('0x11')]==='AnalyticExtractedReport'){if(_0x2adafe['query']['includeAll']){_0xddea69[_0x13fb('0x9c')]=[{'all':!![]}];}return _0x13a8e1[_0xe7c588[_0x13fb('0x11')]]['findAll'](_0xddea69)['then'](function(_0x34d00a){var _0x1b137a=[];_0x34d00a[_0x13fb('0x9d')](function(_0x29e9fb){var _0x3189a1;switch(_0x29e9fb[_0x13fb('0x9e')]){case _0x13fb('0x9f'):_0x3189a1=_[_0x13fb('0x84')](_0x20c836[_0x13fb('0x8')],function(_0xd50f32){return _0xd50f32['id']===_0x29e9fb[_0x13fb('0x6d')]&&_0xd50f32[_0x13fb('0xa0')]===_0x13fb('0xa1');});break;case _0x13fb('0xa2'):_0x3189a1=_[_0x13fb('0x84')](_0x20c836[_0x13fb('0x8')],function(_0x10d857){return _0x10d857['id']===_0x29e9fb[_0x13fb('0x6d')]&&_0x10d857[_0x13fb('0xa0')]===_0x13fb('0xa3');});break;}if(_0x3189a1)_0x1b137a[_0x13fb('0x88')](_0x29e9fb);});_0x40d09f['count']=_0x1b137a[_0x13fb('0x83')];_0x40d09f[_0x13fb('0xa4')]=_0x1b137a;return _0x40d09f;});}else{return _0x13a8e1[_0xe7c588[_0x13fb('0x11')]]['count']({'where':_0xddea69[_0x13fb('0x79')]})[_0x13fb('0xd')](function(_0x8a327b){_0x40d09f['count']=_0x8a327b;if(_0x2adafe[_0x13fb('0x7b')][_0x13fb('0xa5')]){if(_0xe7c588[_0x13fb('0x11')]==='CmContact'){_0xddea69[_0x13fb('0x9c')]=[{'model':_0x13a8e1[_0x13fb('0x63')],'as':_0x13fb('0xa6'),'attributes':['id','name','color'],'required':_0x2adafe[_0x13fb('0x7b')]['tag']?!![]:![]},{'model':_0x13a8e1['Tag'],'as':_0x13fb('0xa7'),'attributes':['id','name',_0x13fb('0xa8')],'through':_0x2adafe[_0x13fb('0x7b')][_0x13fb('0xa9')]?{'attributes':[],'where':{'TagId':_0x2adafe[_0x13fb('0x7b')][_0x13fb('0xa9')]||undefined}}:{},'required':_0x2adafe[_0x13fb('0x7b')][_0x13fb('0xa9')]?!![]:![]}];}else{_0xddea69[_0x13fb('0x9c')]=[{'all':!![]}];}}return _0x13a8e1[_0xe7c588[_0x13fb('0x11')]][_0x13fb('0x7')](_0xddea69);})[_0x13fb('0xd')](function(_0x822bc6){_0x40d09f[_0x13fb('0xa4')]=_0x822bc6;if(_0x9f5288==='Agents'&&_0x2adafe['query'][_0x13fb('0xaa')]===_0x13fb('0xab')){var _0x4a231f=[];for(var _0x3e7d33=0x0;_0x3e7d33<_0x40d09f['rows'][_0x13fb('0x83')];_0x3e7d33++){_0x4a231f[_0x13fb('0x88')](_0x4f8ff0('chat',_0x40d09f['rows'][_0x3e7d33]['dataValues']));_0x4a231f['push'](_0x4f8ff0(_0x13fb('0xac'),_0x40d09f[_0x13fb('0xa4')][_0x3e7d33][_0x13fb('0xad')]));_0x4a231f['push'](_0x4f8ff0(_0x13fb('0xae'),_0x40d09f[_0x13fb('0xa4')][_0x3e7d33][_0x13fb('0xad')]));_0x4a231f[_0x13fb('0x88')](_0x4f8ff0(_0x13fb('0xaf'),_0x40d09f[_0x13fb('0xa4')][_0x3e7d33][_0x13fb('0xad')]));_0x4a231f[_0x13fb('0x88')](_0x4f8ff0('openchannel',_0x40d09f[_0x13fb('0xa4')][_0x3e7d33][_0x13fb('0xad')]));_0x4a231f[_0x13fb('0x88')](_0x4f8ff0('whatsapp',_0x40d09f[_0x13fb('0xa4')][_0x3e7d33][_0x13fb('0xad')]));}return Promise[_0x13fb('0x89')](_0x4a231f)[_0x13fb('0xd')](function(){return _0x40d09f;});}return _0x40d09f;});}});}}});}; \ No newline at end of file +var _0xeaa2=['ZohoAccount','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','pauses','scheduler','sounds','Sound','tags','Tag','Template','triggers','Trigger','Trunk','variables','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','ui.','InteractionId','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','all','ignore','union','find','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','tag','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','findAll','then','associatedResources','map','model','name','catch','UserProfileResource','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','CmList','CmCompany','globalcustomfields','chatqueues','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','role','agent','Telephones','User','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','WhatsappQueue','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','users','agents','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts'];(function(_0x112a07,_0x47cdef){var _0x40ee5a=function(_0x481154){while(--_0x481154){_0x112a07['push'](_0x112a07['shift']());}};_0x40ee5a(++_0x47cdef);}(_0xeaa2,0x115));var _0x2eaa=function(_0x303064,_0x12f0c2){_0x303064=_0x303064-0x0;var _0x5a1d3d=_0xeaa2[_0x303064];return _0x5a1d3d;};'use strict';var _=require(_0x2eaa('0x0'));var attributes=require(_0x2eaa('0x1'));var qs=require(_0x2eaa('0x2'));module[_0x2eaa('0x3')]=function(_0x2b024f){var _0x2765de=_0x2b024f[_0x2eaa('0x4')];function _0x46b428(_0x1d2f39,_0x5e6331){return new Promise(function(_0x496f14,_0x5e1e95){if(!_0x5e6331)return _0x496f14(null);var _0x4f4004=_0x5e6331[_0x2eaa('0x5')]?{[_0x5e6331[_0x2eaa('0x5')][_0x2eaa('0x6')]]:_0x5e6331[_0x2eaa('0x5')][_0x2eaa('0x7')]}:undefined;return _0x2765de[_0x1d2f39][_0x2eaa('0x8')]({'where':_0x4f4004,'raw':!![]})[_0x2eaa('0x9')](function(_0xf4ae60){_0x5e6331[_0x2eaa('0xa')]=_[_0x2eaa('0xb')](_0xf4ae60,'id');_0x496f14(_0x5e6331);})['catch'](function(_0x1db493){_0x5e1e95(_0x1db493);});});}function _0x2f144e(_0x5db7be,_0x3bb800){return new Promise(function(_0x4a8010,_0x1a6576){var _0x43ba2a=_0x5db7be[_0x2eaa('0x5')]?{[_0x5db7be['filter'][_0x2eaa('0x6')]]:_0x5db7be[_0x2eaa('0x5')][_0x2eaa('0x7')]}:undefined;return _0x2765de[_0x5db7be[_0x2eaa('0xc')]][_0x2eaa('0x8')]({'where':_0x43ba2a,'raw':!![]})[_0x2eaa('0x9')](function(_0x13faca){_0x3bb800[_0x2eaa('0xa')]=_[_0x2eaa('0xb')](_0x13faca,function(_0x7dc4f2){return _0x7dc4f2[_0x2eaa('0xd')];});_0x4a8010(_0x3bb800);})[_0x2eaa('0xe')](function(_0x8cf07){_0x1a6576(_0x8cf07);});});}function _0x4191a8(_0x595c54,_0x8f67e7,_0x100adc){if(!_0x8f67e7)return resolve(null);return new Promise(function(_0x475b2f,_0x2c081f){return _0x2765de[_0x2eaa('0xf')][_0x2eaa('0x8')]({'where':{'sectionId':_0x8f67e7['id']},'raw':!![]})[_0x2eaa('0x9')](function(_0x58eb77){if(_0x595c54[_0x2eaa('0x6')]&&_0x595c54[_0x2eaa('0x6')]!=='id'){_0x8f67e7['associatedResources']=_[_0x2eaa('0xb')](_0x58eb77,function(_0x5b3a59){return _0x5b3a59[_0x595c54['field']];});}else{if(_0x100adc===_0x2eaa('0x10')){_0x8f67e7[_0x2eaa('0xa')]=_['map'](_0x58eb77,function(_0x3323a8){return{'id':_0x3323a8['resourceId'],'type':_0x3323a8[_0x2eaa('0x11')]};});}else{_0x8f67e7[_0x2eaa('0xa')]=_[_0x2eaa('0xb')](_0x58eb77,function(_0x4df638){return _0x4df638[_0x2eaa('0x12')];});}}_0x475b2f(_0x8f67e7);})[_0x2eaa('0xe')](function(_0x2e2e34){_0x2c081f(_0x2e2e34);});});}function _0x240c38(_0x25f616,_0x3e4cf0){var _0x3d96bd={'parentSections':[]};switch(_0x25f616[_0x2eaa('0x13')]()){case _0x2eaa('0x14'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x16');break;case _0x2eaa('0x17'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x18');break;case _0x2eaa('0x19'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x1a');_0x3d96bd[_0x2eaa('0x1b')]=[{'name':_0x2eaa('0x1c'),'field':_0x2eaa('0xd'),'foreignKey':_0x2eaa('0x1d')}];break;case'projects':_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x1e');break;case _0x2eaa('0x1f'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x20');_0x3d96bd[_0x2eaa('0x1b')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case'lists':_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x21');break;case'companies':_0x3d96bd['childModel']=_0x2eaa('0x22');break;case _0x2eaa('0x23'):_0x3d96bd[_0x2eaa('0x15')]='CmCustomField';break;case _0x2eaa('0x24'):_0x3d96bd['childModel']='ChatQueue';break;case'chatwebsites':_0x3d96bd[_0x2eaa('0x15')]='ChatWebsite';break;case _0x2eaa('0x25'):_0x3d96bd['childModel']=_0x2eaa('0x26');break;case _0x2eaa('0x27'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x28');break;case _0x2eaa('0x29'):case _0x2eaa('0x2a'):case _0x2eaa('0x2b'):_0x3d96bd['childModel']=_0x2eaa('0x2c');break;case'contexts':_0x3d96bd['childModel']=_0x2eaa('0x2d');break;case'voicemails':_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x2e');break;case _0x2eaa('0x2f'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x30');_0x3d96bd[_0x2eaa('0x1b')]=[{'name':_0x2eaa('0x31'),'field':_0x2eaa('0xd'),'foreignKey':_0x2eaa('0x32'),'model':'User','filter':{'field':_0x2eaa('0x33'),'value':[_0x2eaa('0x34')]}},{'name':_0x2eaa('0x35'),'field':'name','foreignKey':_0x2eaa('0x32'),'model':_0x2eaa('0x36'),'filter':{'field':_0x2eaa('0x33'),'value':[_0x2eaa('0x37')]}},{'name':_0x2eaa('0x38'),'field':_0x2eaa('0xd'),'foreignKey':'queue','model':_0x2eaa('0x39'),'filter':{'field':_0x2eaa('0x11'),'value':[_0x2eaa('0x3a')]}},{'name':_0x2eaa('0x3b'),'field':'name','foreignKey':_0x2eaa('0x3c'),'model':_0x2eaa('0x39'),'filter':{'field':_0x2eaa('0x11'),'value':['outbound']}}];break;case _0x2eaa('0x3d'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x3e');break;case _0x2eaa('0x3f'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x40');break;case _0x2eaa('0x41'):_0x3d96bd['childModel']=_0x2eaa('0x42');break;case _0x2eaa('0x43'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x44');break;case _0x2eaa('0x45'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x46');break;case _0x2eaa('0x47'):_0x3d96bd['childModel']=_0x2eaa('0x48');break;case _0x2eaa('0x49'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x4a');break;case'openchannelqueues':_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x4b');break;case'openchannelaccounts':_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x4c');break;case _0x2eaa('0x4d'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x4e');break;case'smsaccounts':_0x3d96bd[_0x2eaa('0x15')]='SmsAccount';break;case'whatsappqueues':_0x3d96bd['childModel']=_0x2eaa('0x4f');break;case _0x2eaa('0x50'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x51');break;case'teams':_0x3d96bd['childModel']='Team';break;case _0x2eaa('0x52'):case _0x2eaa('0x53'):_0x3d96bd['childModel']=_0x2eaa('0x39');if(_0x3e4cf0){_0x3d96bd[_0x2eaa('0x1b')]=[{'name':'VoiceQueues'},{'name':_0x2eaa('0x3b')}];}break;case _0x2eaa('0x54'):case _0x2eaa('0x55'):case'telephones':_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x36');if(_0x3e4cf0){_0x3d96bd[_0x2eaa('0x1b')]=[{'name':_0x2eaa('0x56'),'filter':{'field':'role','value':[_0x2eaa('0x57'),_0x2eaa('0x58')]},'ignore':!![]},{'name':'Agents'},{'name':_0x2eaa('0x35')}];}break;case _0x2eaa('0x59'):_0x3d96bd['childModel']=_0x2eaa('0x5a');break;case _0x2eaa('0x5b'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x5c');break;case _0x2eaa('0x5d'):_0x3d96bd['childModel']=_0x2eaa('0x5e');break;case'sugarcrmaccounts':_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x5f');break;case _0x2eaa('0x60'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x61');break;case _0x2eaa('0x62'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x63');break;case'vtigeraccounts':_0x3d96bd['childModel']=_0x2eaa('0x36');break;case _0x2eaa('0x64'):_0x3d96bd['childModel']=_0x2eaa('0x65');break;case _0x2eaa('0x66'):_0x3d96bd[_0x2eaa('0x15')]='Disposition';break;case _0x2eaa('0x67'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x68');break;case'intervals':_0x3d96bd[_0x2eaa('0x15')]='Interval';break;case _0x2eaa('0x69'):_0x3d96bd['childModel']='Pause';break;case _0x2eaa('0x6a'):_0x3d96bd[_0x2eaa('0x15')]='Schedule';break;case _0x2eaa('0x6b'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x6c');break;case _0x2eaa('0x6d'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x6e');break;case'templates':_0x3d96bd['childModel']=_0x2eaa('0x6f');break;case _0x2eaa('0x70'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x71');break;case'trunks':_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x72');break;case _0x2eaa('0x73'):_0x3d96bd[_0x2eaa('0x15')]='Variable';break;case _0x2eaa('0x74'):_0x3d96bd[_0x2eaa('0x15')]=_0x2eaa('0x75');break;case'extractedreports':_0x3d96bd['childModel']=_0x2eaa('0x10');_0x3d96bd[_0x2eaa('0x1b')]=[{'name':_0x2eaa('0x76'),'field':'id','foreignKey':_0x2eaa('0x77')}];break;case _0x2eaa('0x78'):_0x3d96bd['childModel']=_0x2eaa('0x79');break;case _0x2eaa('0x50'):_0x3d96bd[_0x2eaa('0x15')]='WhatsappAccount';break;}return _0x3d96bd;}function _0x9acd7d(_0x3e516a,_0x5a4109){var _0x4ab861=_0x3e516a[_0x2eaa('0x7a')](0x0)[_0x2eaa('0x7b')]()+_0x3e516a['slice'](0x1);var _0x5ca1e9={'type':_0x2765de[_0x2eaa('0x7c')][_0x2eaa('0x7d')][_0x2eaa('0x7e')],'raw':!![]};return new BPromise(function(_0x45ee5f,_0x386b71){var _0x4209b9=squel['select']()[_0x2eaa('0x6')](_0x2eaa('0x7f')+_0x4ab861+_0x2eaa('0x80'),'id')['field']('ui.createdAt')['from'](_0x2eaa('0x81')+_0x3e516a+_0x2eaa('0x82'),'ui')[_0x2eaa('0x83')]('ui.UserId\x20=\x20?',_0x5a4109['id']);return _0x2765de[_0x2eaa('0x84')][_0x2eaa('0x85')](_0x4209b9[_0x2eaa('0x86')](),_0x5ca1e9)[_0x2eaa('0x9')](function(_0x530b70){_0x5a4109[_0x4ab861+_0x2eaa('0x87')]=_0x530b70;_0x45ee5f(_0x530b70);})[_0x2eaa('0xe')](function(_0x1f2f9a){_0x386b71(_0x1f2f9a);});});}return _0x2b024f[_0x2eaa('0x88')](_0x2eaa('0x89'),attributes,{'tableName':_0x2eaa('0x8a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x281a35){var _0x3bd282={'raw':![],'where':{}};var _0x2142b5={};var _0x5847b5={'count':0x0,'rows':[]};var _0x291a36=_0x281a35['query'][_0x2eaa('0x8b')];var _0x2a1df4=_0x281a35[_0x2eaa('0x85')][_0x2eaa('0x8c')]||![];var _0x335667=_0x240c38(_0x291a36,_0x2a1df4);if(!_0x335667['childModel'])throw new Error(_0x2eaa('0x8d')+_0x291a36+'\x27');var _0x362dec=[{'name':_0x291a36}];if(!_[_0x2eaa('0x8e')](_0x335667[_0x2eaa('0x1b')]))_0x362dec=_0x335667[_0x2eaa('0x1b')];var _0x348fb9=[];for(var _0x578478=0x0;_0x578478<_0x362dec[_0x2eaa('0x8f')];_0x578478++){_0x348fb9[_0x2eaa('0x90')](_0x2765de[_0x2eaa('0x91')]['find']({'where':{'userProfileId':_0x281a35[_0x2eaa('0x92')]['id'],'name':_0x362dec[_0x578478][_0x2eaa('0xd')]},'raw':!![]}));}return Promise[_0x2eaa('0x93')](_0x348fb9)[_0x2eaa('0x9')](function(_0x1d4bcb){var _0x28c255=_[_0x2eaa('0x5')](_0x1d4bcb,function(_0x195744){return _0x195744?_0x195744:undefined;});var _0x331020=_[_0x2eaa('0x5')](_0x362dec,[_0x2eaa('0x94'),!![]]);var _0x114e9f=_[_0x2eaa('0x8e')](_0x28c255)&&_['isEmpty'](_0x331020)?null:_[_0x2eaa('0x95')](_0x331020,_0x28c255);if(!_0x114e9f)return null;var _0x1754d3=[];for(var _0x5a60f9=0x0;_0x5a60f9<_0x114e9f[_0x2eaa('0x8f')];_0x5a60f9++){var _0x2a489b=_[_0x2eaa('0x96')](_0x362dec,function(_0x130e27){return _0x114e9f[_0x5a60f9]?_0x130e27[_0x2eaa('0xd')]===_0x114e9f[_0x5a60f9][_0x2eaa('0xd')]:null;});if(_0x2a489b){if(_0x114e9f[_0x5a60f9][_0x2eaa('0x94')]){_0x1754d3[_0x2eaa('0x90')](_0x46b428(_0x335667[_0x2eaa('0x15')],_0x114e9f[_0x5a60f9]));}else{if(!_0x114e9f[_0x5a60f9][_0x2eaa('0x97')]){_0x1754d3[_0x2eaa('0x90')](_0x4191a8(_0x2a489b,_0x114e9f[_0x5a60f9],_0x335667[_0x2eaa('0x15')]));}else{if(_0x2a489b[_0x2eaa('0xc')]){_0x1754d3[_0x2eaa('0x90')](_0x2f144e(_0x2a489b,_0x114e9f[_0x5a60f9]));}}}}}return Promise['all'](_0x1754d3);})['then'](function(_0x4f4667){var _0xfe8364=_0x4f4667;var _0x1deba1=null;if(_0xfe8364){_0x1deba1=_0xfe8364[_0x2eaa('0x8f')]===0x1?_0xfe8364[0x0]:null;}if(!_0x1deba1&&!_0xfe8364)return _0x5847b5;var _0x4991a9=_0x2765de[_0x335667['childModel']][_0x2eaa('0x98')];_0x2142b5[_0x2eaa('0xc')]=_[_0x2eaa('0x99')](_0x4991a9);_0x2142b5['query']=_['keys'](_0x281a35[_0x2eaa('0x85')]);_0x2142b5[_0x2eaa('0x9a')]=_[_0x2eaa('0x9b')](_0x2142b5[_0x2eaa('0xc')],_0x2142b5[_0x2eaa('0x85')]);_0x3bd282[_0x2eaa('0x9c')]=_[_0x2eaa('0x9b')](_0x2142b5[_0x2eaa('0xc')],qs[_0x2eaa('0x9d')](_0x281a35[_0x2eaa('0x85')][_0x2eaa('0x9d')]));_0x3bd282[_0x2eaa('0x9c')]=_0x3bd282['attributes']['length']?_0x3bd282[_0x2eaa('0x9c')]:_0x2142b5[_0x2eaa('0xc')];if(!_0x281a35[_0x2eaa('0x85')][_0x2eaa('0x9e')](_0x2eaa('0x9f'))){_0x3bd282[_0x2eaa('0xa0')]=qs[_0x2eaa('0xa0')](_0x281a35['query'][_0x2eaa('0xa0')]);_0x3bd282['offset']=qs[_0x2eaa('0xa1')](_0x281a35[_0x2eaa('0x85')][_0x2eaa('0xa1')]);}_0x3bd282['order']=qs['sort'](_0x281a35[_0x2eaa('0x85')][_0x2eaa('0xa2')]);_0x3bd282['where']=qs[_0x2eaa('0x9a')](_[_0x2eaa('0xa3')](_0x281a35[_0x2eaa('0x85')],_0x2142b5[_0x2eaa('0x9a')]));if(_0x281a35[_0x2eaa('0x85')][_0x2eaa('0x5')]){_0x3bd282[_0x2eaa('0x83')]=_[_0x2eaa('0xa4')](_0x3bd282['where'],{'$or':_['map'](_0x4991a9,function(_0x41db2a){if(_0x41db2a['type'][_0x2eaa('0xa5')]!==_0x2eaa('0xa6')){var _0x56b72c={};_0x56b72c[_0x41db2a[_0x2eaa('0x6')]]={'$like':'%'+_0x281a35['query'][_0x2eaa('0x5')]+'%'};return _0x56b72c;}})});}var _0x557ff7=[];if(_0x1deba1){var _0x4d280a=_[_0x2eaa('0x96')](_0x362dec,[_0x2eaa('0xd'),_0x1deba1[_0x2eaa('0xd')]]);if(_0x4d280a[_0x2eaa('0x6')]){var _0x5d2122={};if(_0x335667[_0x2eaa('0x15')]==='AnalyticExtractedReport'){_0x5d2122[_0x4d280a[_0x2eaa('0xa7')]]=_['map'](_0x1deba1[_0x2eaa('0xa')],'id');}else{_0x5d2122[_0x4d280a['foreignKey']]=_0x1deba1[_0x2eaa('0xa')];}_0x557ff7['push'](_0x5d2122);}else{_0x3bd282['where']['id']=_0x1deba1['associatedResources'];}}else{for(var _0x610fad=0x0;_0x610fad<_0xfe8364[_0x2eaa('0x8f')];_0x610fad++){var _0x4d280a=_[_0x2eaa('0x96')](_0x362dec,[_0x2eaa('0xd'),_0xfe8364[_0x610fad][_0x2eaa('0xd')]]);if(_0x4d280a[_0x2eaa('0x6')]){var _0x5d2122={};_0x5d2122[_0x4d280a[_0x2eaa('0xa7')]]=_0xfe8364[_0x610fad][_0x2eaa('0xa')];_0x557ff7[_0x2eaa('0x90')](_0x5d2122);}else{if(!_0x3bd282[_0x2eaa('0x83')]['id'])_0x3bd282['where']['id']=[];_0xfe8364[_0x610fad][_0x2eaa('0xa')][_0x2eaa('0xa8')](function(_0x222013){_0x3bd282['where']['id']['push'](_0x222013);});}}}if(!_[_0x2eaa('0x8e')](_0x557ff7)){_0x3bd282[_0x2eaa('0x83')]=_['merge'](_0x3bd282[_0x2eaa('0x83')],{'$and':{'$or':_0x557ff7}});}_0x3bd282=_[_0x2eaa('0xa4')]({},_0x3bd282,_0x281a35[_0x2eaa('0xa9')]);if(_0x1deba1&&!_0x1deba1[_0x2eaa('0x97')]&&_0x335667[_0x2eaa('0x15')]===_0x2eaa('0x10')){if(_0x281a35[_0x2eaa('0x85')][_0x2eaa('0xaa')]){_0x3bd282[_0x2eaa('0xab')]=[{'all':!![]}];}return _0x2765de[_0x335667[_0x2eaa('0x15')]][_0x2eaa('0x8')](_0x3bd282)[_0x2eaa('0x9')](function(_0x51aad5){var _0x2ef1e2=[];_0x51aad5[_0x2eaa('0xa8')](function(_0x3773bb){var _0x36bcb0;switch(_0x3773bb[_0x2eaa('0xac')]){case _0x2eaa('0xad'):_0x36bcb0=_[_0x2eaa('0x96')](_0x1deba1[_0x2eaa('0xa')],function(_0x399ffc){return _0x399ffc['id']===_0x3773bb['reportId']&&_0x399ffc[_0x2eaa('0x11')]===_0x2eaa('0xae');});break;case _0x2eaa('0xaf'):_0x36bcb0=_[_0x2eaa('0x96')](_0x1deba1['associatedResources'],function(_0x1bc546){return _0x1bc546['id']===_0x3773bb[_0x2eaa('0x77')]&&_0x1bc546['type']===_0x2eaa('0xb0');});break;}if(_0x36bcb0)_0x2ef1e2[_0x2eaa('0x90')](_0x3773bb);});_0x5847b5[_0x2eaa('0xb1')]=_0x2ef1e2['length'];_0x5847b5[_0x2eaa('0xb2')]=_0x2ef1e2;return _0x5847b5;});}else{return _0x2765de[_0x335667[_0x2eaa('0x15')]][_0x2eaa('0xb1')]({'where':_0x3bd282[_0x2eaa('0x83')]})[_0x2eaa('0x9')](function(_0x20c044){_0x5847b5['count']=_0x20c044;if(_0x281a35[_0x2eaa('0x85')][_0x2eaa('0xaa')]){if(_0x335667['childModel']===_0x2eaa('0x20')){_0x3bd282[_0x2eaa('0xab')]=[{'model':_0x2765de[_0x2eaa('0x6e')],'as':'Tags','attributes':['id',_0x2eaa('0xd'),'color'],'required':_0x281a35['query']['tag']?!![]:![]},{'model':_0x2765de[_0x2eaa('0x6e')],'as':'ThroughTags','attributes':['id',_0x2eaa('0xd'),'color'],'through':_0x281a35['query']['tag']?{'attributes':[],'where':{'TagId':_0x281a35[_0x2eaa('0x85')]['tag']||undefined}}:{},'required':_0x281a35[_0x2eaa('0x85')][_0x2eaa('0xb3')]?!![]:![]}];}else{_0x3bd282[_0x2eaa('0xab')]=[{'all':!![]}];}}return _0x2765de[_0x335667[_0x2eaa('0x15')]][_0x2eaa('0x8')](_0x3bd282);})['then'](function(_0x1098fd){_0x5847b5[_0x2eaa('0xb2')]=_0x1098fd;if(_0x291a36===_0x2eaa('0x31')&&_0x281a35[_0x2eaa('0x85')][_0x2eaa('0xb4')]===_0x2eaa('0xb5')){var _0x2fe435=[];for(var _0x1ce5ff=0x0;_0x1ce5ff<_0x5847b5[_0x2eaa('0xb2')][_0x2eaa('0x8f')];_0x1ce5ff++){_0x2fe435['push'](_0x9acd7d(_0x2eaa('0xb6'),_0x5847b5[_0x2eaa('0xb2')][_0x1ce5ff][_0x2eaa('0xb7')]));_0x2fe435['push'](_0x9acd7d(_0x2eaa('0xb8'),_0x5847b5['rows'][_0x1ce5ff][_0x2eaa('0xb7')]));_0x2fe435[_0x2eaa('0x90')](_0x9acd7d('fax',_0x5847b5[_0x2eaa('0xb2')][_0x1ce5ff][_0x2eaa('0xb7')]));_0x2fe435['push'](_0x9acd7d(_0x2eaa('0xb9'),_0x5847b5[_0x2eaa('0xb2')][_0x1ce5ff][_0x2eaa('0xb7')]));_0x2fe435[_0x2eaa('0x90')](_0x9acd7d(_0x2eaa('0xba'),_0x5847b5[_0x2eaa('0xb2')][_0x1ce5ff][_0x2eaa('0xb7')]));_0x2fe435[_0x2eaa('0x90')](_0x9acd7d(_0x2eaa('0xbb'),_0x5847b5['rows'][_0x1ce5ff][_0x2eaa('0xb7')]));}return Promise[_0x2eaa('0x93')](_0x2fe435)['then'](function(){return _0x5847b5;});}return _0x5847b5;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 6d767b8..225da0c 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 _0x94ff=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','localhost','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','randomstring','ioredis'];(function(_0x35def0,_0x1943e0){var _0x13106d=function(_0x361fd2){while(--_0x361fd2){_0x35def0['push'](_0x35def0['shift']());}};_0x13106d(++_0x1943e0);}(_0x94ff,0xc3));var _0xf94f=function(_0x24ddda,_0x2f6121){_0x24ddda=_0x24ddda-0x0;var _0xc80ce8=_0x94ff[_0x24ddda];return _0xc80ce8;};'use strict';var _=require(_0xf94f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf94f('0x1'));var fs=require('fs');var Redis=require(_0xf94f('0x2'));var db=require(_0xf94f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf94f('0x4'))(_0xf94f('0x5'));var config=require('../../config/environment');var jayson=require(_0xf94f('0x6'));var client=jayson[_0xf94f('0x7')]['http']({'port':0x232a});config[_0xf94f('0x8')]=_['defaults'](config[_0xf94f('0x8')],{'host':_0xf94f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf94f('0x8')]));require(_0xf94f('0xa'))[_0xf94f('0xb')](socket);function respondWithRpcPromise(_0x57b900,_0x5c518f,_0x510972){return new BPromise(function(_0x2d3ea6,_0x234f34){return client[_0xf94f('0xc')](_0x57b900,_0x510972)[_0xf94f('0xd')](function(_0x18a8a6){logger[_0xf94f('0xe')](_0xf94f('0xf'),_0x5c518f,_0xf94f('0x10'));logger['debug'](_0xf94f('0x11'),_0x5c518f,_0xf94f('0x10'),JSON[_0xf94f('0x12')](_0x18a8a6));if(_0x18a8a6[_0xf94f('0x13')]){if(_0x18a8a6['error'][_0xf94f('0x14')]===0x1f4){logger[_0xf94f('0x13')](_0xf94f('0xf'),_0x5c518f,_0x18a8a6[_0xf94f('0x13')][_0xf94f('0x15')]);return _0x234f34(_0x18a8a6[_0xf94f('0x13')]['message']);}logger[_0xf94f('0x13')]('UserProfile,\x20%s,\x20%s',_0x5c518f,_0x18a8a6[_0xf94f('0x13')][_0xf94f('0x15')]);return _0x2d3ea6(_0x18a8a6['error']['message']);}else{logger['info'](_0xf94f('0xf'),_0x5c518f,'request\x20sent');_0x2d3ea6(_0x18a8a6['result'][_0xf94f('0x15')]);}})['catch'](function(_0x33defc){logger['error'](_0xf94f('0xf'),_0x5c518f,_0x33defc);_0x234f34(_0x33defc);});});} \ No newline at end of file +var _0xb0e5=['bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','then','info','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x5b8fd1,_0x2d730c){var _0xb6d424=function(_0x179681){while(--_0x179681){_0x5b8fd1['push'](_0x5b8fd1['shift']());}};_0xb6d424(++_0x2d730c);}(_0xb0e5,0x1ad));var _0x5b0e=function(_0x3a58aa,_0x583fcb){_0x3a58aa=_0x3a58aa-0x0;var _0x4d102b=_0xb0e5[_0x3a58aa];return _0x4d102b;};'use strict';var _=require(_0x5b0e('0x0'));var util=require(_0x5b0e('0x1'));var moment=require(_0x5b0e('0x2'));var BPromise=require(_0x5b0e('0x3'));var rs=require(_0x5b0e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b0e('0x5'));var logger=require('../../config/logger')(_0x5b0e('0x6'));var config=require('../../config/environment');var jayson=require(_0x5b0e('0x7'));var client=jayson[_0x5b0e('0x8')]['http']({'port':0x232a});config['redis']=_[_0x5b0e('0x9')](config[_0x5b0e('0xa')],{'host':_0x5b0e('0xb'),'port':0x18eb});var socket=require(_0x5b0e('0xc'))(new Redis(config[_0x5b0e('0xa')]));require(_0x5b0e('0xd'))[_0x5b0e('0xe')](socket);function respondWithRpcPromise(_0x49b223,_0x72d6c1,_0x4fcc26){return new BPromise(function(_0x178987,_0x5cc90d){return client['request'](_0x49b223,_0x4fcc26)[_0x5b0e('0xf')](function(_0x7bd16){logger[_0x5b0e('0x10')]('UserProfile,\x20%s,\x20%s',_0x72d6c1,_0x5b0e('0x11'));logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x72d6c1,_0x5b0e('0x11'),JSON[_0x5b0e('0x12')](_0x7bd16));if(_0x7bd16[_0x5b0e('0x13')]){if(_0x7bd16[_0x5b0e('0x13')][_0x5b0e('0x14')]===0x1f4){logger[_0x5b0e('0x13')](_0x5b0e('0x15'),_0x72d6c1,_0x7bd16[_0x5b0e('0x13')][_0x5b0e('0x16')]);return _0x5cc90d(_0x7bd16[_0x5b0e('0x13')][_0x5b0e('0x16')]);}logger[_0x5b0e('0x13')](_0x5b0e('0x15'),_0x72d6c1,_0x7bd16[_0x5b0e('0x13')][_0x5b0e('0x16')]);return _0x178987(_0x7bd16[_0x5b0e('0x13')][_0x5b0e('0x16')]);}else{logger[_0x5b0e('0x10')](_0x5b0e('0x15'),_0x72d6c1,_0x5b0e('0x11'));_0x178987(_0x7bd16[_0x5b0e('0x17')][_0x5b0e('0x16')]);}})['catch'](function(_0x4e2964){logger[_0x5b0e('0x13')](_0x5b0e('0x15'),_0x72d6c1,_0x4e2964);_0x5cc90d(_0x4e2964);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 1adf622..555e577 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 _0xa2fe=['./userProfile.events','save','remove','emit','removeListener','register','length','userProfile:'];(function(_0x15c6ef,_0x131df0){var _0x1198ad=function(_0x5a8e4d){while(--_0x5a8e4d){_0x15c6ef['push'](_0x15c6ef['shift']());}};_0x1198ad(++_0x131df0);}(_0xa2fe,0x1f0));var _0xea2f=function(_0x537c37,_0x536e74){_0x537c37=_0x537c37-0x0;var _0x241f84=_0xa2fe[_0x537c37];return _0x241f84;};'use strict';var UserProfileEvents=require(_0xea2f('0x0'));var events=[_0xea2f('0x1'),_0xea2f('0x2'),'update'];function createListener(_0x1c70c9,_0x10a05f){return function(_0x112211){_0x10a05f[_0xea2f('0x3')](_0x1c70c9,_0x112211);};}function removeListener(_0x3f5b57,_0x219694){return function(){UserProfileEvents[_0xea2f('0x4')](_0x3f5b57,_0x219694);};}exports[_0xea2f('0x5')]=function(_0x3b4c26){for(var _0x31c547=0x0,_0x16864e=events[_0xea2f('0x6')];_0x31c547<_0x16864e;_0x31c547++){var _0x2d9b58=events[_0x31c547];var _0x10a6c2=createListener(_0xea2f('0x7')+_0x2d9b58,_0x3b4c26);UserProfileEvents['on'](_0x2d9b58,_0x10a6c2);}}; \ No newline at end of file +var _0xaec9=['userProfile:','./userProfile.events','save','update','emit','removeListener'];(function(_0x202e4c,_0x58bb11){var _0x3fd843=function(_0x306f55){while(--_0x306f55){_0x202e4c['push'](_0x202e4c['shift']());}};_0x3fd843(++_0x58bb11);}(_0xaec9,0x1e1));var _0x9aec=function(_0x1d4449,_0x495153){_0x1d4449=_0x1d4449-0x0;var _0x4dcde3=_0xaec9[_0x1d4449];return _0x4dcde3;};'use strict';var UserProfileEvents=require(_0x9aec('0x0'));var events=[_0x9aec('0x1'),'remove',_0x9aec('0x2')];function createListener(_0x3b98e2,_0x258daf){return function(_0x120422){_0x258daf[_0x9aec('0x3')](_0x3b98e2,_0x120422);};}function removeListener(_0x4b9ef4,_0x531013){return function(){UserProfileEvents[_0x9aec('0x4')](_0x4b9ef4,_0x531013);};}exports['register']=function(_0x440b62){for(var _0x2d338f=0x0,_0x3a9970=events['length'];_0x2d338f<_0x3a9970;_0x2d338f++){var _0x142f63=events[_0x2d338f];var _0x2a6f39=createListener(_0x9aec('0x5')+_0x142f63,_0x440b62);UserProfileEvents['on'](_0x142f63,_0x2a6f39);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 471c0ad..adba5c5 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 _0x1140=['util','express','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x1140,0x1f3));var _0x0114=function(_0x3260e1,_0x18484e){_0x3260e1=_0x3260e1-0x0;var _0x12f591=_0x1140[_0x3260e1];return _0x12f591;};'use strict';var multer=require(_0x0114('0x0'));var util=require(_0x0114('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0114('0x2'));var router=express['Router']();var fs_extra=require(_0x0114('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0114('0x4'));var config=require(_0x0114('0x5'));var controller=require(_0x0114('0x6'));router[_0x0114('0x7')]('/',auth[_0x0114('0x8')](),controller[_0x0114('0x9')]);router['get'](_0x0114('0xa'),auth['isAuthenticated'](),controller[_0x0114('0xb')]);router[_0x0114('0x7')]('/:id',auth[_0x0114('0x8')](),controller[_0x0114('0xc')]);router[_0x0114('0xd')]('/',auth['isAuthenticated'](),controller[_0x0114('0xe')]);router[_0x0114('0xf')](_0x0114('0x10'),auth[_0x0114('0x8')](),controller['update']);router[_0x0114('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0114('0x12')]);module[_0x0114('0x13')]=router; \ No newline at end of file +var _0xecfe=['show','create','delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x202fef,_0x5022b9){var _0x5b7480=function(_0x915a1d){while(--_0x915a1d){_0x202fef['push'](_0x202fef['shift']());}};_0x5b7480(++_0x5022b9);}(_0xecfe,0x75));var _0xeecf=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0xecfe[_0x4aa4e6];return _0x322588;};'use strict';var multer=require(_0xeecf('0x0'));var util=require('util');var path=require(_0xeecf('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xeecf('0x2'));var auth=require(_0xeecf('0x3'));var interaction=require(_0xeecf('0x4'));var config=require('../../config/environment');var controller=require(_0xeecf('0x5'));router[_0xeecf('0x6')]('/',auth[_0xeecf('0x7')](),controller[_0xeecf('0x8')]);router[_0xeecf('0x6')](_0xeecf('0x9'),auth[_0xeecf('0x7')](),controller['describe']);router[_0xeecf('0x6')](_0xeecf('0xa'),auth[_0xeecf('0x7')](),controller[_0xeecf('0xb')]);router['post']('/',auth[_0xeecf('0x7')](),controller[_0xeecf('0xc')]);router['put'](_0xeecf('0xa'),auth[_0xeecf('0x7')](),controller['update']);router[_0xeecf('0xd')]('/:id',auth[_0xeecf('0x7')](),controller[_0xeecf('0xe')]);module[_0xeecf('0xf')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 7551f38..3500328 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 _0x873a=['sequelize','exports','INTEGER','STRING'];(function(_0x20f0c1,_0x331ef0){var _0xed0056=function(_0x47bc9a){while(--_0x47bc9a){_0x20f0c1['push'](_0x20f0c1['shift']());}};_0xed0056(++_0x331ef0);}(_0x873a,0xf8));var _0xa873=function(_0x678ce6,_0x12fd18){_0x678ce6=_0x678ce6-0x0;var _0x491cb2=_0x873a[_0x678ce6];return _0x491cb2;};'use strict';var Sequelize=require(_0xa873('0x0'));module[_0xa873('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa873('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa873('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x19a3=['sequelize','exports','STRING'];(function(_0x3fec05,_0x39c6a3){var _0x3ae591=function(_0x3a3fee){while(--_0x3a3fee){_0x3fec05['push'](_0x3fec05['shift']());}};_0x3ae591(++_0x39c6a3);}(_0x19a3,0x96));var _0x319a=function(_0x180be1,_0x24f158){_0x180be1=_0x180be1-0x0;var _0x323cb8=_0x19a3[_0x180be1];return _0x323cb8;};'use strict';var Sequelize=require(_0x319a('0x0'));module[_0x319a('0x1')]={'name':{'type':Sequelize[_0x319a('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 344c7b1..4019860 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 _0xf61e=['where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','UserProfileResource','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x3010fe,_0x14a238){var _0x76a5da=function(_0x1f98b0){while(--_0x1f98b0){_0x3010fe['push'](_0x3010fe['shift']());}};_0x76a5da(++_0x14a238);}(_0xf61e,0x191));var _0xef61=function(_0x1b1d6d,_0x295e53){_0x1b1d6d=_0x1b1d6d-0x0;var _0x2d9099=_0xf61e[_0x1b1d6d];return _0x2d9099;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['UserProfileResource']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['UserProfileResource'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));};exports[_0xef61('0x4c')]=function(_0x1ce127,_0x504389){return db[_0xef61('0x30')]['describe']()[_0xef61('0x28')](respondWithResult(_0x504389,null))[_0xef61('0x45')](handleError(_0x504389,null));}; \ No newline at end of file +var _0x1a37=['index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x1a37[_0xd09668];return _0x68726;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));};exports[_0x71a3('0x49')]=function(_0x11391d,_0x3952c0){return db[_0x71a3('0x2c')]['describe']()[_0x71a3('0x24')](respondWithResult(_0x3952c0,null))['catch'](handleError(_0x3952c0,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index f4f84e7..14a1900 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 _0x003e=['request-promise','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','lodash','../../config/logger','api','bluebird'];(function(_0x178833,_0x4d51f7){var _0x4fc4e2=function(_0x2ca2ff){while(--_0x2ca2ff){_0x178833['push'](_0x178833['shift']());}};_0x4fc4e2(++_0x4d51f7);}(_0x003e,0x1c4));var _0xe003=function(_0x2b31a8,_0x28b862){_0x2b31a8=_0x2b31a8-0x0;var _0x1175a5=_0x003e[_0x2b31a8];return _0x1175a5;};'use strict';var _=require(_0xe003('0x0'));var util=require('util');var logger=require(_0xe003('0x1'))(_0xe003('0x2'));var moment=require('moment');var BPromise=require(_0xe003('0x3'));var rp=require(_0xe003('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe003('0x5'));var attributes=require(_0xe003('0x6'));module[_0xe003('0x7')]=function(_0x4a6886,_0x372d7c){return _0x4a6886[_0xe003('0x8')](_0xe003('0x9'),attributes,{'tableName':_0xe003('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xe003('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b94=['moment','bluebird','request-promise','path','../../config/environment','./userProfileResource.attributes','exports','define','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api'];(function(_0x281e8f,_0x4b2d96){var _0x55e602=function(_0x24bfa9){while(--_0x24bfa9){_0x281e8f['push'](_0x281e8f['shift']());}};_0x55e602(++_0x4b2d96);}(_0x0b94,0x74));var _0x40b9=function(_0x56c67c,_0x322166){_0x56c67c=_0x56c67c-0x0;var _0x406838=_0x0b94[_0x56c67c];return _0x406838;};'use strict';var _=require(_0x40b9('0x0'));var util=require(_0x40b9('0x1'));var logger=require(_0x40b9('0x2'))(_0x40b9('0x3'));var moment=require(_0x40b9('0x4'));var BPromise=require(_0x40b9('0x5'));var rp=require(_0x40b9('0x6'));var fs=require('fs');var path=require(_0x40b9('0x7'));var rimraf=require('rimraf');var config=require(_0x40b9('0x8'));var attributes=require(_0x40b9('0x9'));module[_0x40b9('0xa')]=function(_0x3ec8b1,_0x4d7af7){return _0x3ec8b1[_0x40b9('0xb')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x40b9('0xc'),'fields':[_0x40b9('0xd'),_0x40b9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 705e7c7..4aaa305 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 _0xe11d=['error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1daa45,_0x202d8c){var _0x2a8170=function(_0x31068a){while(--_0x31068a){_0x1daa45['push'](_0x1daa45['shift']());}};_0x2a8170(++_0x202d8c);}(_0xe11d,0x175));var _0xde11=function(_0x1680a2,_0x23a72c){_0x1680a2=_0x1680a2-0x0;var _0x94601b=_0xe11d[_0x1680a2];return _0x94601b;};'use strict';var _=require('lodash');var util=require(_0xde11('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xde11('0x1'));var fs=require('fs');var Redis=require(_0xde11('0x2'));var db=require(_0xde11('0x3'))['db'];var utils=require(_0xde11('0x4'));var logger=require(_0xde11('0x5'))(_0xde11('0x6'));var config=require(_0xde11('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xde11('0x8')][_0xde11('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x79e6d2,_0x1f219d,_0x3089f7){return new BPromise(function(_0x4d8921,_0x1a2306){return client[_0xde11('0xa')](_0x79e6d2,_0x3089f7)[_0xde11('0xb')](function(_0x429009){logger[_0xde11('0xc')](_0xde11('0xd'),_0x1f219d,_0xde11('0xe'));logger[_0xde11('0xf')](_0xde11('0x10'),_0x1f219d,_0xde11('0xe'),JSON[_0xde11('0x11')](_0x429009));if(_0x429009[_0xde11('0x12')]){if(_0x429009['error'][_0xde11('0x13')]===0x1f4){logger[_0xde11('0x12')](_0xde11('0xd'),_0x1f219d,_0x429009[_0xde11('0x12')]['message']);return _0x1a2306(_0x429009[_0xde11('0x12')][_0xde11('0x14')]);}logger[_0xde11('0x12')](_0xde11('0xd'),_0x1f219d,_0x429009[_0xde11('0x12')]['message']);return _0x4d8921(_0x429009['error']['message']);}else{logger[_0xde11('0xc')](_0xde11('0xd'),_0x1f219d,'request\x20sent');_0x4d8921(_0x429009[_0xde11('0x15')][_0xde11('0x14')]);}})[_0xde11('0x16')](function(_0x33ab99){logger['error'](_0xde11('0xd'),_0x1f219d,_0x33ab99);_0x1a2306(_0x33ab99);});});} \ No newline at end of file +var _0xf89c=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0xf89c,0x1e2));var _0xcf89=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf89c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xcf89('0x0'));var util=require(_0xcf89('0x1'));var moment=require(_0xcf89('0x2'));var BPromise=require(_0xcf89('0x3'));var rs=require(_0xcf89('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf89('0x5'))['db'];var utils=require(_0xcf89('0x6'));var logger=require(_0xcf89('0x7'))('rpc');var config=require(_0xcf89('0x8'));var jayson=require(_0xcf89('0x9'));var client=jayson[_0xcf89('0xa')][_0xcf89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dbdbc,_0x213f24,_0x3d03ff){return new BPromise(function(_0x4aa230,_0x5ddadd){return client[_0xcf89('0xc')](_0x5dbdbc,_0x3d03ff)[_0xcf89('0xd')](function(_0x33a8f4){logger[_0xcf89('0xe')](_0xcf89('0xf'),_0x213f24,_0xcf89('0x10'));logger[_0xcf89('0x11')](_0xcf89('0x12'),_0x213f24,'request\x20sent',JSON['stringify'](_0x33a8f4));if(_0x33a8f4[_0xcf89('0x13')]){if(_0x33a8f4[_0xcf89('0x13')][_0xcf89('0x14')]===0x1f4){logger[_0xcf89('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x213f24,_0x33a8f4['error'][_0xcf89('0x15')]);return _0x5ddadd(_0x33a8f4[_0xcf89('0x13')][_0xcf89('0x15')]);}logger[_0xcf89('0x13')](_0xcf89('0xf'),_0x213f24,_0x33a8f4[_0xcf89('0x13')]['message']);return _0x4aa230(_0x33a8f4['error']['message']);}else{logger[_0xcf89('0xe')](_0xcf89('0xf'),_0x213f24,_0xcf89('0x10'));_0x4aa230(_0x33a8f4[_0xcf89('0x16')][_0xcf89('0x15')]);}})['catch'](function(_0x1d77bd){logger['error'](_0xcf89('0xf'),_0x213f24,_0x1d77bd);_0x5ddadd(_0x1d77bd);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 315508b..c7fd07f 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 _0x6e18=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','post','create','/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x38ef55,_0x305ddf){var _0x4e1935=function(_0x13441d){while(--_0x13441d){_0x38ef55['push'](_0x38ef55['shift']());}};_0x4e1935(++_0x305ddf);}(_0x6e18,0xa1));var _0x86e1=function(_0xd2b53,_0x486023){_0xd2b53=_0xd2b53-0x0;var _0x1bb4b4=_0x6e18[_0xd2b53];return _0x1bb4b4;};'use strict';var multer=require(_0x86e1('0x0'));var util=require(_0x86e1('0x1'));var path=require('path');var timeout=require(_0x86e1('0x2'));var express=require(_0x86e1('0x3'));var router=express[_0x86e1('0x4')]();var fs_extra=require(_0x86e1('0x5'));var auth=require(_0x86e1('0x6'));var interaction=require(_0x86e1('0x7'));var config=require(_0x86e1('0x8'));var controller=require('./userProfileSection.controller');router[_0x86e1('0x9')]('/',auth['isAuthenticated'](),controller[_0x86e1('0xa')]);router[_0x86e1('0x9')](_0x86e1('0xb'),auth[_0x86e1('0xc')](),controller[_0x86e1('0xd')]);router[_0x86e1('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x86e1('0xe')]);router[_0x86e1('0xf')]('/',auth[_0x86e1('0xc')](),controller[_0x86e1('0x10')]);router['put'](_0x86e1('0x11'),auth[_0x86e1('0xc')](),controller[_0x86e1('0x12')]);router[_0x86e1('0x13')](_0x86e1('0x11'),auth['isAuthenticated'](),controller[_0x86e1('0x14')]);module['exports']=router; \ No newline at end of file +var _0x61e1=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','show','post','create','/:id','update'];(function(_0x5900f2,_0x211c71){var _0x3befe0=function(_0x2c143f){while(--_0x2c143f){_0x5900f2['push'](_0x5900f2['shift']());}};_0x3befe0(++_0x211c71);}(_0x61e1,0x1e5));var _0x161e=function(_0x4f90a0,_0x5715c4){_0x4f90a0=_0x4f90a0-0x0;var _0x4ab42f=_0x61e1[_0x4f90a0];return _0x4ab42f;};'use strict';var multer=require(_0x161e('0x0'));var util=require(_0x161e('0x1'));var path=require('path');var timeout=require(_0x161e('0x2'));var express=require(_0x161e('0x3'));var router=express[_0x161e('0x4')]();var fs_extra=require(_0x161e('0x5'));var auth=require(_0x161e('0x6'));var interaction=require(_0x161e('0x7'));var config=require(_0x161e('0x8'));var controller=require(_0x161e('0x9'));router[_0x161e('0xa')]('/',auth[_0x161e('0xb')](),controller[_0x161e('0xc')]);router['get'](_0x161e('0xd'),auth[_0x161e('0xb')](),controller['describe']);router[_0x161e('0xa')]('/:id',auth[_0x161e('0xb')](),controller[_0x161e('0xe')]);router[_0x161e('0xf')]('/',auth[_0x161e('0xb')](),controller[_0x161e('0x10')]);router['put'](_0x161e('0x11'),auth[_0x161e('0xb')](),controller[_0x161e('0x12')]);router['delete'](_0x161e('0x11'),auth['isAuthenticated'](),controller[_0x161e('0x13')]);module[_0x161e('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 9efad83..a68012c 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 _0x955f=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue','crudPermissions'];(function(_0x467d4b,_0x2e849b){var _0x2c977f=function(_0x397d0d){while(--_0x397d0d){_0x467d4b['push'](_0x467d4b['shift']());}};_0x2c977f(++_0x2e849b);}(_0x955f,0x1eb));var _0xf955=function(_0x56b64c,_0x396fa1){_0x56b64c=_0x56b64c-0x0;var _0x5d54db=_0x955f[_0x56b64c];return _0x5d54db;};'use strict';var Sequelize=require(_0xf955('0x0'));module[_0xf955('0x1')]={'name':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xf955('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xf955('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf955('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x5d0c95){this[_0xf955('0x5')]('crudPermissions',_0x5d0c95?_0x5d0c95[_0xf955('0x6')](''):[]);},'get':function(){return this[_0xf955('0x7')](_0xf955('0x8'))?this['getDataValue'](_0xf955('0x8'))[_0xf955('0x9')](''):[];}}}; \ No newline at end of file +var _0x065e=['crudPermissions','getDataValue','split','sequelize','INTEGER','BOOLEAN','setDataValue'];(function(_0xd99b71,_0x5460e3){var _0x2a98ea=function(_0x5db616){while(--_0x5db616){_0xd99b71['push'](_0xd99b71['shift']());}};_0x2a98ea(++_0x5460e3);}(_0x065e,0x1a7));var _0xe065=function(_0x882253,_0x744f2c){_0x882253=_0x882253-0x0;var _0x442e1e=_0x065e[_0x882253];return _0x442e1e;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0xe065('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0xe065('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xe065('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4964fa){this[_0xe065('0x3')](_0xe065('0x4'),_0x4964fa?_0x4964fa['join'](''):[]);},'get':function(){return this[_0xe065('0x5')](_0xe065('0x4'))?this[_0xe065('0x5')]('crudPermissions')[_0xe065('0x6')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b7d4ea1..56ea8bd 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 _0x7278=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index','UserProfileSection','rawAttributes','type','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','show','params','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1e5017,_0x652070){var _0x56e3bd=function(_0xb0637c){while(--_0xb0637c){_0x1e5017['push'](_0x1e5017['shift']());}};_0x56e3bd(++_0x652070);}(_0x7278,0x83));var _0x8727=function(_0x2285b6,_0x30e841){_0x2285b6=_0x2285b6-0x0;var _0x1c23af=_0x7278[_0x2285b6];return _0x1c23af;};'use strict';var emlformat=require(_0x8727('0x0'));var rimraf=require(_0x8727('0x1'));var zipdir=require(_0x8727('0x2'));var jsonpatch=require(_0x8727('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8727('0x4'));var Mustache=require(_0x8727('0x5'));var util=require(_0x8727('0x6'));var path=require(_0x8727('0x7'));var sox=require(_0x8727('0x8'));var csv=require(_0x8727('0x9'));var ejs=require(_0x8727('0xa'));var fs=require('fs');var fs_extra=require(_0x8727('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8727('0xc'));var jsforce=require(_0x8727('0xd'));var deskjs=require(_0x8727('0xe'));var toCsv=require(_0x8727('0x9'));var querystring=require('querystring');var Papa=require(_0x8727('0xf'));var Redis=require(_0x8727('0x10'));var authService=require(_0x8727('0x11'));var qs=require(_0x8727('0x12'));var as=require(_0x8727('0x13'));var hardwareService=require(_0x8727('0x14'));var logger=require(_0x8727('0x15'))(_0x8727('0x16'));var utils=require(_0x8727('0x17'));var config=require(_0x8727('0x18'));var licenseUtil=require(_0x8727('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xda693f,_0x8bf080){_0x8bf080=_0x8bf080||0xcc;return function(_0x4649b6){if(_0x4649b6){return _0xda693f['sendStatus'](_0x8bf080);}return _0xda693f[_0x8727('0x1a')](_0x8bf080)[_0x8727('0x1b')]();};}function respondWithResult(_0x56f0d4,_0x4a3d4c){_0x4a3d4c=_0x4a3d4c||0xc8;return function(_0x1427d9){if(_0x1427d9){return _0x56f0d4['status'](_0x4a3d4c)[_0x8727('0x1c')](_0x1427d9);}};}function respondWithFilteredResult(_0x3dc485,_0x3d174a){return function(_0x4e1869){if(_0x4e1869){var _0x3e3f11=typeof _0x3d174a[_0x8727('0x1d')]===_0x8727('0x1e')&&typeof _0x3d174a[_0x8727('0x1f')]===_0x8727('0x1e');var _0x55a19e=_0x4e1869['count'];var _0x5cbc58=_0x3e3f11?0x0:_0x3d174a[_0x8727('0x1d')];var _0x5030e8=_0x3e3f11?_0x4e1869[_0x8727('0x20')]:_0x3d174a[_0x8727('0x1d')]+_0x3d174a[_0x8727('0x1f')];var _0x486069;if(_0x5030e8>=_0x55a19e){_0x5030e8=_0x55a19e;_0x486069=0xc8;}else{_0x486069=0xce;}_0x3dc485[_0x8727('0x1a')](_0x486069);return _0x3dc485['set'](_0x8727('0x21'),_0x5cbc58+'-'+_0x5030e8+'/'+_0x55a19e)[_0x8727('0x1c')](_0x4e1869);}return null;};}function patchUpdates(_0xbbe6c4){return function(_0x59eb33){try{jsonpatch[_0x8727('0x22')](_0x59eb33,_0xbbe6c4,!![]);}catch(_0x392390){return BPromise[_0x8727('0x23')](_0x392390);}return _0x59eb33['save']();};}function saveUpdates(_0x3ec678,_0xae4aff){return function(_0xa3fd4b){if(_0xa3fd4b){return _0xa3fd4b[_0x8727('0x24')](_0x3ec678)[_0x8727('0x25')](function(_0x4e0fef){return _0x4e0fef;});}return null;};}function removeEntity(_0x51c244,_0x38a2f6){return function(_0x43eb3e){if(_0x43eb3e){return _0x43eb3e['destroy']()['then'](function(){_0x51c244[_0x8727('0x1a')](0xcc)[_0x8727('0x1b')]();});}};}function handleEntityNotFound(_0x1e9da6,_0x38db2f){return function(_0x4b39a7){if(!_0x4b39a7){_0x1e9da6[_0x8727('0x26')](0x194);}return _0x4b39a7;};}function handleError(_0x177a54,_0x5e5324){_0x5e5324=_0x5e5324||0x1f4;return function(_0x2d28d6){logger[_0x8727('0x27')](_0x2d28d6[_0x8727('0x28')]);if(_0x2d28d6[_0x8727('0x29')]){delete _0x2d28d6[_0x8727('0x29')];}_0x177a54[_0x8727('0x1a')](_0x5e5324)[_0x8727('0x2a')](_0x2d28d6);};}exports[_0x8727('0x2b')]=function(_0x567251,_0x4fdfbc){var _0x135d6b={},_0x40663f={},_0x23c1f7={'count':0x0,'rows':[]};var _0x30164c=_['map'](db[_0x8727('0x2c')][_0x8727('0x2d')],function(_0x4a108d){return{'name':_0x4a108d['fieldName'],'type':_0x4a108d[_0x8727('0x2e')]['key']};});_0x40663f['model']=_[_0x8727('0x2f')](_0x30164c,'name');_0x40663f[_0x8727('0x30')]=_[_0x8727('0x31')](_0x567251[_0x8727('0x30')]);_0x40663f['filters']=_[_0x8727('0x32')](_0x40663f[_0x8727('0x33')],_0x40663f[_0x8727('0x30')]);_0x135d6b[_0x8727('0x34')]=_[_0x8727('0x32')](_0x40663f[_0x8727('0x33')],qs[_0x8727('0x35')](_0x567251[_0x8727('0x30')][_0x8727('0x35')]));_0x135d6b[_0x8727('0x34')]=_0x135d6b[_0x8727('0x34')][_0x8727('0x36')]?_0x135d6b[_0x8727('0x34')]:_0x40663f[_0x8727('0x33')];if(!_0x567251[_0x8727('0x30')][_0x8727('0x37')](_0x8727('0x38'))){_0x135d6b[_0x8727('0x1f')]=qs[_0x8727('0x1f')](_0x567251[_0x8727('0x30')][_0x8727('0x1f')]);_0x135d6b[_0x8727('0x1d')]=qs[_0x8727('0x1d')](_0x567251['query']['offset']);}_0x135d6b[_0x8727('0x39')]=qs[_0x8727('0x3a')](_0x567251[_0x8727('0x30')][_0x8727('0x3a')]);_0x135d6b[_0x8727('0x3b')]=qs['filters'](_[_0x8727('0x3c')](_0x567251[_0x8727('0x30')],_0x40663f[_0x8727('0x3d')]),_0x30164c);if(_0x567251[_0x8727('0x30')][_0x8727('0x3e')]){_0x135d6b[_0x8727('0x3b')]=_[_0x8727('0x3f')](_0x135d6b['where'],{'$or':_[_0x8727('0x2f')](_0x30164c,function(_0x3d73e5){if(_0x3d73e5['type']!==_0x8727('0x40')){var _0x4bbdc0={};_0x4bbdc0[_0x3d73e5[_0x8727('0x29')]]={'$like':'%'+_0x567251[_0x8727('0x30')][_0x8727('0x3e')]+'%'};return _0x4bbdc0;}})});}_0x135d6b=_['merge']({},_0x135d6b,_0x567251[_0x8727('0x41')]);var _0x4a7511={'where':_0x135d6b[_0x8727('0x3b')]};return db[_0x8727('0x2c')][_0x8727('0x20')](_0x4a7511)['then'](function(_0x2dd4ae){_0x23c1f7[_0x8727('0x20')]=_0x2dd4ae;if(_0x567251[_0x8727('0x30')][_0x8727('0x42')]){_0x135d6b[_0x8727('0x43')]=[{'all':!![]}];}return db[_0x8727('0x2c')]['findAll'](_0x135d6b);})['then'](function(_0x54f70c){_0x23c1f7['rows']=_0x54f70c;return _0x23c1f7;})[_0x8727('0x25')](respondWithFilteredResult(_0x4fdfbc,_0x135d6b))['catch'](handleError(_0x4fdfbc,null));};exports[_0x8727('0x44')]=function(_0x2ecf18,_0x2d7fb4){var _0x42dc7d={'raw':![],'where':{'id':_0x2ecf18[_0x8727('0x45')]['id']}},_0x103548={};_0x103548[_0x8727('0x33')]=_[_0x8727('0x31')](db[_0x8727('0x2c')][_0x8727('0x2d')]);_0x103548[_0x8727('0x30')]=_[_0x8727('0x31')](_0x2ecf18[_0x8727('0x30')]);_0x103548['filters']=_['intersection'](_0x103548[_0x8727('0x33')],_0x103548[_0x8727('0x30')]);_0x42dc7d['attributes']=_['intersection'](_0x103548[_0x8727('0x33')],qs[_0x8727('0x35')](_0x2ecf18[_0x8727('0x30')][_0x8727('0x35')]));_0x42dc7d[_0x8727('0x34')]=_0x42dc7d['attributes'][_0x8727('0x36')]?_0x42dc7d[_0x8727('0x34')]:_0x103548[_0x8727('0x33')];if(_0x2ecf18[_0x8727('0x30')][_0x8727('0x42')]){_0x42dc7d[_0x8727('0x43')]=[{'all':!![]}];}_0x42dc7d=_[_0x8727('0x3f')]({},_0x42dc7d,_0x2ecf18['options']);return db['UserProfileSection'][_0x8727('0x46')](_0x42dc7d)[_0x8727('0x25')](handleEntityNotFound(_0x2d7fb4,null))[_0x8727('0x25')](respondWithResult(_0x2d7fb4,null))[_0x8727('0x47')](handleError(_0x2d7fb4,null));};exports['create']=function(_0x310e33,_0x152863){return db['UserProfileSection'][_0x8727('0x48')](_0x310e33['body'],{})['then'](respondWithResult(_0x152863,0xc9))['catch'](handleError(_0x152863,null));};exports[_0x8727('0x24')]=function(_0x2c7e78,_0x10aff6){if(_0x2c7e78[_0x8727('0x49')]['id']){delete _0x2c7e78['body']['id'];}return db['UserProfileSection'][_0x8727('0x46')]({'where':{'id':_0x2c7e78[_0x8727('0x45')]['id']}})[_0x8727('0x25')](handleEntityNotFound(_0x10aff6,null))['then'](saveUpdates(_0x2c7e78[_0x8727('0x49')],null))[_0x8727('0x25')](respondWithResult(_0x10aff6,null))[_0x8727('0x47')](handleError(_0x10aff6,null));};exports[_0x8727('0x4a')]=function(_0x422610,_0xc72bba){return db['UserProfileSection'][_0x8727('0x46')]({'where':{'id':_0x422610[_0x8727('0x45')]['id']}})['then'](handleEntityNotFound(_0xc72bba,null))[_0x8727('0x25')](removeEntity(_0xc72bba,null))[_0x8727('0x47')](handleError(_0xc72bba,null));};exports['describe']=function(_0x46693e,_0x16c0f5){return db['UserProfileSection'][_0x8727('0x4b')]()['then'](respondWithResult(_0x16c0f5,null))[_0x8727('0x47')](handleError(_0x16c0f5,null));}; \ No newline at end of file +var _0x11b6=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','keys','includeAll','find','create','body','catch','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','end','stack','name','send','index','UserProfileSection','rawAttributes','fieldName','map','query','filters','attributes','intersection','model','fields','length'];(function(_0x20bdf0,_0x204f1b){var _0x3cf650=function(_0x389cea){while(--_0x389cea){_0x20bdf0['push'](_0x20bdf0['shift']());}};_0x3cf650(++_0x204f1b);}(_0x11b6,0xaf));var _0x611b=function(_0x5d1429,_0xe5b09d){_0x5d1429=_0x5d1429-0x0;var _0x5a8f23=_0x11b6[_0x5d1429];return _0x5a8f23;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x611b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x611b('0x1'));var rp=require(_0x611b('0x2'));var moment=require(_0x611b('0x3'));var BPromise=require(_0x611b('0x4'));var Mustache=require(_0x611b('0x5'));var util=require(_0x611b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x611b('0x7'));var ejs=require(_0x611b('0x8'));var fs=require('fs');var fs_extra=require(_0x611b('0x9'));var _=require(_0x611b('0xa'));var squel=require('squel');var crypto=require(_0x611b('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x611b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x611b('0xd'));var Papa=require(_0x611b('0xe'));var Redis=require(_0x611b('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x611b('0x10'));var logger=require('../../config/logger')(_0x611b('0x11'));var utils=require(_0x611b('0x12'));var config=require(_0x611b('0x13'));var licenseUtil=require(_0x611b('0x14'));var db=require(_0x611b('0x15'))['db'];function respondWithStatusCode(_0x4764a5,_0x31fa37){_0x31fa37=_0x31fa37||0xcc;return function(_0x5401b3){if(_0x5401b3){return _0x4764a5[_0x611b('0x16')](_0x31fa37);}return _0x4764a5['status'](_0x31fa37)['end']();};}function respondWithResult(_0x1a0b76,_0x49011b){_0x49011b=_0x49011b||0xc8;return function(_0x21484c){if(_0x21484c){return _0x1a0b76[_0x611b('0x17')](_0x49011b)['json'](_0x21484c);}};}function respondWithFilteredResult(_0x434ff0,_0x4f0f22){return function(_0x470d2a){if(_0x470d2a){var _0x2b8315=typeof _0x4f0f22[_0x611b('0x18')]===_0x611b('0x19')&&typeof _0x4f0f22[_0x611b('0x1a')]===_0x611b('0x19');var _0x27441b=_0x470d2a[_0x611b('0x1b')];var _0x2474e6=_0x2b8315?0x0:_0x4f0f22[_0x611b('0x18')];var _0x502031=_0x2b8315?_0x470d2a[_0x611b('0x1b')]:_0x4f0f22[_0x611b('0x18')]+_0x4f0f22[_0x611b('0x1a')];var _0x3dd58b;if(_0x502031>=_0x27441b){_0x502031=_0x27441b;_0x3dd58b=0xc8;}else{_0x3dd58b=0xce;}_0x434ff0[_0x611b('0x17')](_0x3dd58b);return _0x434ff0[_0x611b('0x1c')](_0x611b('0x1d'),_0x2474e6+'-'+_0x502031+'/'+_0x27441b)[_0x611b('0x1e')](_0x470d2a);}return null;};}function patchUpdates(_0x8e952e){return function(_0x1a30a8){try{jsonpatch[_0x611b('0x1f')](_0x1a30a8,_0x8e952e,!![]);}catch(_0x5054ac){return BPromise[_0x611b('0x20')](_0x5054ac);}return _0x1a30a8[_0x611b('0x21')]();};}function saveUpdates(_0x1c9d3e,_0x24a999){return function(_0x2009f0){if(_0x2009f0){return _0x2009f0[_0x611b('0x22')](_0x1c9d3e)['then'](function(_0x380859){return _0x380859;});}return null;};}function removeEntity(_0x49af5c,_0x512e38){return function(_0x5a0968){if(_0x5a0968){return _0x5a0968[_0x611b('0x23')]()[_0x611b('0x24')](function(){_0x49af5c[_0x611b('0x17')](0xcc)[_0x611b('0x25')]();});}};}function handleEntityNotFound(_0x3d626d,_0x26bae0){return function(_0x56d05c){if(!_0x56d05c){_0x3d626d[_0x611b('0x16')](0x194);}return _0x56d05c;};}function handleError(_0x32fc45,_0x4fa14c){_0x4fa14c=_0x4fa14c||0x1f4;return function(_0x4aa34f){logger['error'](_0x4aa34f[_0x611b('0x26')]);if(_0x4aa34f[_0x611b('0x27')]){delete _0x4aa34f[_0x611b('0x27')];}_0x32fc45['status'](_0x4fa14c)[_0x611b('0x28')](_0x4aa34f);};}exports[_0x611b('0x29')]=function(_0x3a03a0,_0x1268f0){var _0x98356c={},_0x4e9ec4={},_0x3e6329={'count':0x0,'rows':[]};var _0x4d3121=_['map'](db[_0x611b('0x2a')][_0x611b('0x2b')],function(_0x5dd695){return{'name':_0x5dd695[_0x611b('0x2c')],'type':_0x5dd695['type']['key']};});_0x4e9ec4['model']=_[_0x611b('0x2d')](_0x4d3121,_0x611b('0x27'));_0x4e9ec4[_0x611b('0x2e')]=_['keys'](_0x3a03a0[_0x611b('0x2e')]);_0x4e9ec4[_0x611b('0x2f')]=_['intersection'](_0x4e9ec4['model'],_0x4e9ec4[_0x611b('0x2e')]);_0x98356c[_0x611b('0x30')]=_[_0x611b('0x31')](_0x4e9ec4[_0x611b('0x32')],qs['fields'](_0x3a03a0[_0x611b('0x2e')][_0x611b('0x33')]));_0x98356c[_0x611b('0x30')]=_0x98356c['attributes'][_0x611b('0x34')]?_0x98356c['attributes']:_0x4e9ec4['model'];if(!_0x3a03a0[_0x611b('0x2e')][_0x611b('0x35')](_0x611b('0x36'))){_0x98356c[_0x611b('0x1a')]=qs[_0x611b('0x1a')](_0x3a03a0[_0x611b('0x2e')][_0x611b('0x1a')]);_0x98356c[_0x611b('0x18')]=qs['offset'](_0x3a03a0['query'][_0x611b('0x18')]);}_0x98356c[_0x611b('0x37')]=qs[_0x611b('0x38')](_0x3a03a0[_0x611b('0x2e')][_0x611b('0x38')]);_0x98356c[_0x611b('0x39')]=qs[_0x611b('0x2f')](_[_0x611b('0x3a')](_0x3a03a0[_0x611b('0x2e')],_0x4e9ec4[_0x611b('0x2f')]),_0x4d3121);if(_0x3a03a0[_0x611b('0x2e')][_0x611b('0x3b')]){_0x98356c[_0x611b('0x39')]=_[_0x611b('0x3c')](_0x98356c[_0x611b('0x39')],{'$or':_['map'](_0x4d3121,function(_0x12c209){if(_0x12c209[_0x611b('0x3d')]!==_0x611b('0x3e')){var _0x8f3b9={};_0x8f3b9[_0x12c209[_0x611b('0x27')]]={'$like':'%'+_0x3a03a0[_0x611b('0x2e')]['filter']+'%'};return _0x8f3b9;}})});}_0x98356c=_[_0x611b('0x3c')]({},_0x98356c,_0x3a03a0[_0x611b('0x3f')]);var _0x365977={'where':_0x98356c[_0x611b('0x39')]};return db[_0x611b('0x2a')]['count'](_0x365977)[_0x611b('0x24')](function(_0x4c3031){_0x3e6329['count']=_0x4c3031;if(_0x3a03a0[_0x611b('0x2e')]['includeAll']){_0x98356c[_0x611b('0x40')]=[{'all':!![]}];}return db['UserProfileSection'][_0x611b('0x41')](_0x98356c);})[_0x611b('0x24')](function(_0x18985c){_0x3e6329[_0x611b('0x42')]=_0x18985c;return _0x3e6329;})[_0x611b('0x24')](respondWithFilteredResult(_0x1268f0,_0x98356c))['catch'](handleError(_0x1268f0,null));};exports[_0x611b('0x43')]=function(_0x42cf45,_0x4a0f57){var _0x583176={'raw':![],'where':{'id':_0x42cf45['params']['id']}},_0x158a48={};_0x158a48[_0x611b('0x32')]=_['keys'](db[_0x611b('0x2a')][_0x611b('0x2b')]);_0x158a48[_0x611b('0x2e')]=_[_0x611b('0x44')](_0x42cf45[_0x611b('0x2e')]);_0x158a48[_0x611b('0x2f')]=_['intersection'](_0x158a48[_0x611b('0x32')],_0x158a48[_0x611b('0x2e')]);_0x583176[_0x611b('0x30')]=_[_0x611b('0x31')](_0x158a48['model'],qs[_0x611b('0x33')](_0x42cf45[_0x611b('0x2e')]['fields']));_0x583176['attributes']=_0x583176[_0x611b('0x30')]['length']?_0x583176[_0x611b('0x30')]:_0x158a48[_0x611b('0x32')];if(_0x42cf45[_0x611b('0x2e')][_0x611b('0x45')]){_0x583176['include']=[{'all':!![]}];}_0x583176=_[_0x611b('0x3c')]({},_0x583176,_0x42cf45[_0x611b('0x3f')]);return db[_0x611b('0x2a')][_0x611b('0x46')](_0x583176)[_0x611b('0x24')](handleEntityNotFound(_0x4a0f57,null))[_0x611b('0x24')](respondWithResult(_0x4a0f57,null))['catch'](handleError(_0x4a0f57,null));};exports[_0x611b('0x47')]=function(_0x278a85,_0x1abc15){return db[_0x611b('0x2a')][_0x611b('0x47')](_0x278a85[_0x611b('0x48')],{})[_0x611b('0x24')](respondWithResult(_0x1abc15,0xc9))[_0x611b('0x49')](handleError(_0x1abc15,null));};exports[_0x611b('0x22')]=function(_0x14aeab,_0x5c8331){if(_0x14aeab[_0x611b('0x48')]['id']){delete _0x14aeab[_0x611b('0x48')]['id'];}return db[_0x611b('0x2a')]['find']({'where':{'id':_0x14aeab[_0x611b('0x4a')]['id']}})[_0x611b('0x24')](handleEntityNotFound(_0x5c8331,null))['then'](saveUpdates(_0x14aeab[_0x611b('0x48')],null))[_0x611b('0x24')](respondWithResult(_0x5c8331,null))[_0x611b('0x49')](handleError(_0x5c8331,null));};exports[_0x611b('0x23')]=function(_0x4b20bf,_0x453f66){return db[_0x611b('0x2a')]['find']({'where':{'id':_0x4b20bf[_0x611b('0x4a')]['id']}})[_0x611b('0x24')](handleEntityNotFound(_0x453f66,null))['then'](removeEntity(_0x453f66,null))['catch'](handleError(_0x453f66,null));};exports[_0x611b('0x4b')]=function(_0x3e359b,_0x5beb0c){return db['UserProfileSection'][_0x611b('0x4b')]()[_0x611b('0x24')](respondWithResult(_0x5beb0c,null))[_0x611b('0x49')](handleError(_0x5beb0c,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a5f629f..24780fd 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 _0x6b5c=['../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','sectionId','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x44f333,_0x2ef3a3){var _0x3d1fe2=function(_0x402996){while(--_0x402996){_0x44f333['push'](_0x44f333['shift']());}};_0x3d1fe2(++_0x2ef3a3);}(_0x6b5c,0xc9));var _0xc6b5=function(_0x487f15,_0x1cf5fb){_0x487f15=_0x487f15-0x0;var _0x32c8a1=_0x6b5c[_0x487f15];return _0x32c8a1;};'use strict';var _=require(_0xc6b5('0x0'));var util=require('util');var logger=require(_0xc6b5('0x1'))(_0xc6b5('0x2'));var moment=require(_0xc6b5('0x3'));var BPromise=require(_0xc6b5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6b5('0x5'));var rimraf=require(_0xc6b5('0x6'));var config=require(_0xc6b5('0x7'));var attributes=require(_0xc6b5('0x8'));module[_0xc6b5('0x9')]=function(_0x14a406,_0x1948d9){return _0x14a406[_0xc6b5('0xa')](_0xc6b5('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xc6b5('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x577a=['rimraf','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','api','moment','bluebird','request-promise','path'];(function(_0x11fe23,_0xaab54d){var _0x3a3051=function(_0x56b836){while(--_0x56b836){_0x11fe23['push'](_0x11fe23['shift']());}};_0x3a3051(++_0xaab54d);}(_0x577a,0x104));var _0xa577=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0x577a[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0xa577('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa577('0x1'));var moment=require(_0xa577('0x2'));var BPromise=require(_0xa577('0x3'));var rp=require(_0xa577('0x4'));var fs=require('fs');var path=require(_0xa577('0x5'));var rimraf=require(_0xa577('0x6'));var config=require('../../config/environment');var attributes=require(_0xa577('0x7'));module[_0xa577('0x8')]=function(_0x2db0f0,_0x4991ed){return _0x2db0f0[_0xa577('0x9')]('UserProfileSection',attributes,{'tableName':_0xa577('0xa'),'paranoid':![],'indexes':[{'name':_0xa577('0xb'),'fields':[_0xa577('0xc'),_0xa577('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index c139eff..de0f875 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 _0x3aff=['request','then','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x1123cb,_0x4f1908){var _0x10e0f7=function(_0x42913e){while(--_0x42913e){_0x1123cb['push'](_0x1123cb['shift']());}};_0x10e0f7(++_0x4f1908);}(_0x3aff,0x148));var _0xf3af=function(_0x22f254,_0x198468){_0x22f254=_0x22f254-0x0;var _0x90cb85=_0x3aff[_0x22f254];return _0x90cb85;};'use strict';var _=require(_0xf3af('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf3af('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf3af('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf3af('0x3'))('rpc');var config=require(_0xf3af('0x4'));var jayson=require(_0xf3af('0x5'));var client=jayson[_0xf3af('0x6')][_0xf3af('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xb051e5,_0x5aae23,_0x14c51b){return new BPromise(function(_0x4a3c8a,_0x315cc3){return client[_0xf3af('0x8')](_0xb051e5,_0x14c51b)[_0xf3af('0x9')](function(_0xd4deda){logger['info'](_0xf3af('0xa'),_0x5aae23,'request\x20sent');logger[_0xf3af('0xb')](_0xf3af('0xc'),_0x5aae23,_0xf3af('0xd'),JSON[_0xf3af('0xe')](_0xd4deda));if(_0xd4deda['error']){if(_0xd4deda[_0xf3af('0xf')][_0xf3af('0x10')]===0x1f4){logger[_0xf3af('0xf')](_0xf3af('0xa'),_0x5aae23,_0xd4deda[_0xf3af('0xf')][_0xf3af('0x11')]);return _0x315cc3(_0xd4deda[_0xf3af('0xf')][_0xf3af('0x11')]);}logger[_0xf3af('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x5aae23,_0xd4deda['error']['message']);return _0x4a3c8a(_0xd4deda['error'][_0xf3af('0x11')]);}else{logger[_0xf3af('0x12')](_0xf3af('0xa'),_0x5aae23,'request\x20sent');_0x4a3c8a(_0xd4deda[_0xf3af('0x13')][_0xf3af('0x11')]);}})[_0xf3af('0x14')](function(_0x278642){logger['error'](_0xf3af('0xa'),_0x5aae23,_0x278642);_0x315cc3(_0x278642);});});} \ No newline at end of file +var _0x5f6b=['message','result','catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x5f6b,0x81));var _0xb5f6=function(_0x29f465,_0x349975){_0x29f465=_0x29f465-0x0;var _0x79272a=_0x5f6b[_0x29f465];return _0x79272a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb5f6('0x0'));var BPromise=require(_0xb5f6('0x1'));var rs=require(_0xb5f6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb5f6('0x3'));var logger=require(_0xb5f6('0x4'))('rpc');var config=require(_0xb5f6('0x5'));var jayson=require(_0xb5f6('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x336add,_0xf054d,_0x462d1e){return new BPromise(function(_0x419b52,_0x9b2748){return client['request'](_0x336add,_0x462d1e)[_0xb5f6('0x7')](function(_0x301026){logger[_0xb5f6('0x8')](_0xb5f6('0x9'),_0xf054d,_0xb5f6('0xa'));logger['debug'](_0xb5f6('0xb'),_0xf054d,_0xb5f6('0xa'),JSON[_0xb5f6('0xc')](_0x301026));if(_0x301026['error']){if(_0x301026[_0xb5f6('0xd')][_0xb5f6('0xe')]===0x1f4){logger[_0xb5f6('0xd')](_0xb5f6('0x9'),_0xf054d,_0x301026[_0xb5f6('0xd')][_0xb5f6('0xf')]);return _0x9b2748(_0x301026[_0xb5f6('0xd')][_0xb5f6('0xf')]);}logger[_0xb5f6('0xd')]('UserProfileSection,\x20%s,\x20%s',_0xf054d,_0x301026[_0xb5f6('0xd')][_0xb5f6('0xf')]);return _0x419b52(_0x301026['error'][_0xb5f6('0xf')]);}else{logger[_0xb5f6('0x8')]('UserProfileSection,\x20%s,\x20%s',_0xf054d,'request\x20sent');_0x419b52(_0x301026[_0xb5f6('0x10')][_0xb5f6('0xf')]);}})[_0xb5f6('0x11')](function(_0x2776c2){logger[_0xb5f6('0xd')](_0xb5f6('0x9'),_0xf054d,_0x2776c2);_0x9b2748(_0x2776c2);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 08710c8..d61a675 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(_0x2d6023,_0x414aad){var _0x556221=function(_0x3ef91c){while(--_0x3ef91c){_0x2d6023['push'](_0x2d6023['shift']());}};_0x556221(++_0x414aad);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3c4e4c,_0x36ff70){_0x3c4e4c=_0x3c4e4c-0x0;var _0x144a87=_0xcb91[_0x3c4e4c];return _0x144a87;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x14a828,_0x544491){var _0x1d4621=function(_0x8704e9){while(--_0x8704e9){_0x14a828['push'](_0x14a828['shift']());}};_0x1d4621(++_0x544491);}(_0x70e0,0x17b));var _0x070e=function(_0x571e95,_0x426b7f){_0x571e95=_0x571e95-0x0;var _0x59ce87=_0x70e0[_0x571e95];return _0x59ce87;};'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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 6f7632f..54d75f8 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 _0x24ca=['sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24ca,0x8c));var _0xa24c=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0x24ca[_0x58c851];return _0x534d8a;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xf88b=['exports','INTEGER','sequelize'];(function(_0x5275c3,_0x10a381){var _0xc47266=function(_0x1789f4){while(--_0x1789f4){_0x5275c3['push'](_0x5275c3['shift']());}};_0xc47266(++_0x10a381);}(_0xf88b,0x1a6));var _0xbf88=function(_0xe68309,_0x3ce8a0){_0xe68309=_0xe68309-0x0;var _0x373dd2=_0xf88b[_0xe68309];return _0x373dd2;};'use strict';var Sequelize=require(_0xbf88('0x0'));module[_0xbf88('0x1')]={'penalty':{'type':Sequelize[_0xbf88('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 a038982..959061b 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 _0xffd6=['path','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0xffd6,0x97));var _0x6ffd=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0xffd6[_0x3e32a8];return _0x2997b0;};'use strict';var _=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var logger=require(_0x6ffd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x6ffd('0x3'));var rp=require(_0x6ffd('0x4'));var fs=require('fs');var path=require(_0x6ffd('0x5'));var rimraf=require('rimraf');var config=require(_0x6ffd('0x6'));var attributes=require(_0x6ffd('0x7'));module[_0x6ffd('0x8')]=function(_0x2949a4,_0x561055){return _0x2949a4[_0x6ffd('0x9')](_0x6ffd('0xa'),attributes,{'tableName':_0x6ffd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','define','user_has_sms_queues'];(function(_0x310f99,_0x12c02b){var _0x15b0a4=function(_0x2ca0ce){while(--_0x2ca0ce){_0x310f99['push'](_0x310f99['shift']());}};_0x15b0a4(++_0x12c02b);}(_0x1261,0x144));var _0x1126=function(_0x59d32c,_0x306b7a){_0x59d32c=_0x59d32c-0x0;var _0x26e818=_0x1261[_0x59d32c];return _0x26e818;};'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')]('UserSmsQueue',attributes,{'tableName':_0x1126('0xb'),'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 1d43243..23829be 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 _0x901f=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x901f,0x149));var _0xf901=function(_0x4b69f2,_0x1627a5){_0x4b69f2=_0x4b69f2-0x0;var _0x16e701=_0x901f[_0x4b69f2];return _0x16e701;};'use strict';var _=require(_0xf901('0x0'));var util=require(_0xf901('0x1'));var moment=require('moment');var BPromise=require(_0xf901('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf901('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf901('0x4'))('rpc');var config=require(_0xf901('0x5'));var jayson=require(_0xf901('0x6'));var client=jayson[_0xf901('0x7')][_0xf901('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x32b69e,_0x21aa88,_0x352d06){return new BPromise(function(_0x1f8286,_0x3fd38f){return client['request'](_0x32b69e,_0x352d06)[_0xf901('0x9')](function(_0x6465fd){logger[_0xf901('0xa')](_0xf901('0xb'),_0x21aa88,_0xf901('0xc'));logger['debug'](_0xf901('0xd'),_0x21aa88,_0xf901('0xc'),JSON[_0xf901('0xe')](_0x6465fd));if(_0x6465fd[_0xf901('0xf')]){if(_0x6465fd[_0xf901('0xf')][_0xf901('0x10')]===0x1f4){logger[_0xf901('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x21aa88,_0x6465fd[_0xf901('0xf')][_0xf901('0x11')]);return _0x3fd38f(_0x6465fd['error']['message']);}logger[_0xf901('0xf')](_0xf901('0xb'),_0x21aa88,_0x6465fd['error'][_0xf901('0x11')]);return _0x1f8286(_0x6465fd[_0xf901('0xf')][_0xf901('0x11')]);}else{logger[_0xf901('0xa')](_0xf901('0xb'),_0x21aa88,'request\x20sent');_0x1f8286(_0x6465fd[_0xf901('0x12')]['message']);}})[_0xf901('0x13')](function(_0x4bee15){logger[_0xf901('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x21aa88,_0x4bee15);_0x3fd38f(_0x4bee15);});});} \ No newline at end of file +var _0xfc7d=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','bluebird','randomstring'];(function(_0x10edeb,_0x1b93b8){var _0x1c5fea=function(_0x16a1c5){while(--_0x16a1c5){_0x10edeb['push'](_0x10edeb['shift']());}};_0x1c5fea(++_0x1b93b8);}(_0xfc7d,0x19e));var _0xdfc7=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xfc7d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xdfc7('0x0'));var util=require(_0xdfc7('0x1'));var moment=require('moment');var BPromise=require(_0xdfc7('0x2'));var rs=require(_0xdfc7('0x3'));var fs=require('fs');var Redis=require(_0xdfc7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdfc7('0x5'));var logger=require('../../config/logger')(_0xdfc7('0x6'));var config=require(_0xdfc7('0x7'));var jayson=require(_0xdfc7('0x8'));var client=jayson[_0xdfc7('0x9')][_0xdfc7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38b0a2,_0x3392b6,_0x1af75c){return new BPromise(function(_0x151236,_0x3a71e4){return client[_0xdfc7('0xb')](_0x38b0a2,_0x1af75c)[_0xdfc7('0xc')](function(_0x179f16){logger[_0xdfc7('0xd')](_0xdfc7('0xe'),_0x3392b6,_0xdfc7('0xf'));logger[_0xdfc7('0x10')](_0xdfc7('0x11'),_0x3392b6,_0xdfc7('0xf'),JSON[_0xdfc7('0x12')](_0x179f16));if(_0x179f16[_0xdfc7('0x13')]){if(_0x179f16[_0xdfc7('0x13')]['code']===0x1f4){logger['error'](_0xdfc7('0xe'),_0x3392b6,_0x179f16[_0xdfc7('0x13')]['message']);return _0x3a71e4(_0x179f16['error'][_0xdfc7('0x14')]);}logger['error'](_0xdfc7('0xe'),_0x3392b6,_0x179f16[_0xdfc7('0x13')]['message']);return _0x151236(_0x179f16['error'][_0xdfc7('0x14')]);}else{logger['info'](_0xdfc7('0xe'),_0x3392b6,_0xdfc7('0xf'));_0x151236(_0x179f16['result'][_0xdfc7('0x14')]);}})[_0xdfc7('0x15')](function(_0x330fc9){logger[_0xdfc7('0x13')]('UserSmsQueue,\x20%s,\x20%s',_0x3392b6,_0x330fc9);_0x3a71e4(_0x330fc9);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 773b553..bfda041 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x36255c,_0x4ce75c){var _0x2988e5=function(_0x25f984){while(--_0x25f984){_0x36255c['push'](_0x36255c['shift']());}};_0x2988e5(++_0x4ce75c);}(_0x70e0,0x17b));var _0x070e=function(_0x325961,_0x16e12f){_0x325961=_0x325961-0x0;var _0x104ff7=_0x70e0[_0x325961];return _0x104ff7;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xfe5403,_0x1628b1){var _0x2d1e48=function(_0x71342){while(--_0x71342){_0xfe5403['push'](_0xfe5403['shift']());}};_0x2d1e48(++_0x1628b1);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 600a26c..5df165e 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 _0xe6e7=['INTEGER','sequelize'];(function(_0x2ce4bc,_0x107a0f){var _0x140b06=function(_0x181521){while(--_0x181521){_0x2ce4bc['push'](_0x2ce4bc['shift']());}};_0x140b06(++_0x107a0f);}(_0xe6e7,0xe1));var _0x7e6e=function(_0x10f05a,_0x58c201){_0x10f05a=_0x10f05a-0x0;var _0x540568=_0xe6e7[_0x10f05a];return _0x540568;};'use strict';var Sequelize=require(_0x7e6e('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7e6e('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6c41=['exports','INTEGER','sequelize'];(function(_0x182593,_0x2b7efc){var _0x38eeaf=function(_0x1c8e08){while(--_0x1c8e08){_0x182593['push'](_0x182593['shift']());}};_0x38eeaf(++_0x2b7efc);}(_0x6c41,0x98));var _0x16c4=function(_0x40d8d7,_0x30dd5e){_0x40d8d7=_0x40d8d7-0x0;var _0x3454cc=_0x6c41[_0x40d8d7];return _0x3454cc;};'use strict';var Sequelize=require(_0x16c4('0x0'));module[_0x16c4('0x1')]={'penalty':{'type':Sequelize[_0x16c4('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 1a15275..5e45923 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 _0x96f9=['bluebird','rimraf','./userVoiceQueue.attributes','UserVoiceQueue','user_has_voice_queues','util','../../config/logger','api','moment'];(function(_0x27a353,_0x4240b5){var _0x54e78b=function(_0x1265bf){while(--_0x1265bf){_0x27a353['push'](_0x27a353['shift']());}};_0x54e78b(++_0x4240b5);}(_0x96f9,0x83));var _0x996f=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x96f9[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0x996f('0x0'));var logger=require(_0x996f('0x1'))(_0x996f('0x2'));var moment=require(_0x996f('0x3'));var BPromise=require(_0x996f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x996f('0x5'));var config=require('../../config/environment');var attributes=require(_0x996f('0x6'));module['exports']=function(_0x313efd,_0xcb7c0){return _0x313efd['define'](_0x996f('0x7'),attributes,{'tableName':_0x996f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98cc=['exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger','api','request-promise','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x98cc,0x84));var _0xc98c=function(_0x5a7cbc,_0x573d85){_0x5a7cbc=_0x5a7cbc-0x0;var _0x44d2cc=_0x98cc[_0x5a7cbc];return _0x44d2cc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc98c('0x0'))(_0xc98c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc98c('0x2'));var fs=require('fs');var path=require(_0xc98c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0xc98c('0x4')]=function(_0xd7b61c,_0x25ec01){return _0xd7b61c[_0xc98c('0x5')](_0xc98c('0x6'),attributes,{'tableName':_0xc98c('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 6eed4a8..79d576c 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 _0x8d76=['client','http','then','info','request\x20sent','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x39c29b,_0x5e2149){var _0x25c65f=function(_0x4756ac){while(--_0x4756ac){_0x39c29b['push'](_0x39c29b['shift']());}};_0x25c65f(++_0x5e2149);}(_0x8d76,0x6f));var _0x68d7=function(_0x131b3b,_0x2deb83){_0x131b3b=_0x131b3b-0x0;var _0x1c1439=_0x8d76[_0x131b3b];return _0x1c1439;};'use strict';var _=require('lodash');var util=require(_0x68d7('0x0'));var moment=require(_0x68d7('0x1'));var BPromise=require(_0x68d7('0x2'));var rs=require(_0x68d7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x68d7('0x4'))['db'];var utils=require(_0x68d7('0x5'));var logger=require(_0x68d7('0x6'))(_0x68d7('0x7'));var config=require('../../config/environment');var jayson=require(_0x68d7('0x8'));var client=jayson[_0x68d7('0x9')][_0x68d7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x166962,_0x24631a,_0x72ae9c){return new BPromise(function(_0x579f6e,_0x1ce0a3){return client['request'](_0x166962,_0x72ae9c)[_0x68d7('0xb')](function(_0x29a77c){logger[_0x68d7('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x24631a,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x24631a,_0x68d7('0xd'),JSON[_0x68d7('0xe')](_0x29a77c));if(_0x29a77c[_0x68d7('0xf')]){if(_0x29a77c[_0x68d7('0xf')][_0x68d7('0x10')]===0x1f4){logger['error'](_0x68d7('0x11'),_0x24631a,_0x29a77c[_0x68d7('0xf')][_0x68d7('0x12')]);return _0x1ce0a3(_0x29a77c['error']['message']);}logger[_0x68d7('0xf')](_0x68d7('0x11'),_0x24631a,_0x29a77c[_0x68d7('0xf')]['message']);return _0x579f6e(_0x29a77c['error'][_0x68d7('0x12')]);}else{logger[_0x68d7('0xc')](_0x68d7('0x11'),_0x24631a,'request\x20sent');_0x579f6e(_0x29a77c[_0x68d7('0x13')][_0x68d7('0x12')]);}})['catch'](function(_0x5ba873){logger[_0x68d7('0xf')](_0x68d7('0x11'),_0x24631a,_0x5ba873);_0x1ce0a3(_0x5ba873);});});} \ No newline at end of file +var _0x7660=['../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','message','UserVoiceQueue,\x20%s,\x20%s','result','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x10ecc9,_0x3e0f55){var _0x244ac9=function(_0x56bcdf){while(--_0x56bcdf){_0x10ecc9['push'](_0x10ecc9['shift']());}};_0x244ac9(++_0x3e0f55);}(_0x7660,0x105));var _0x0766=function(_0x1927d7,_0x4a9be6){_0x1927d7=_0x1927d7-0x0;var _0x2a73f5=_0x7660[_0x1927d7];return _0x2a73f5;};'use strict';var _=require(_0x0766('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0766('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0766('0x2'));var db=require(_0x0766('0x3'))['db'];var utils=require(_0x0766('0x4'));var logger=require(_0x0766('0x5'))(_0x0766('0x6'));var config=require('../../config/environment');var jayson=require(_0x0766('0x7'));var client=jayson[_0x0766('0x8')][_0x0766('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x395f2b,_0x15c4ed,_0x37634c){return new BPromise(function(_0x13ac31,_0x53dba3){return client[_0x0766('0xa')](_0x395f2b,_0x37634c)['then'](function(_0x38a69b){logger[_0x0766('0xb')]('UserVoiceQueue,\x20%s,\x20%s',_0x15c4ed,_0x0766('0xc'));logger['debug'](_0x0766('0xd'),_0x15c4ed,_0x0766('0xc'),JSON['stringify'](_0x38a69b));if(_0x38a69b[_0x0766('0xe')]){if(_0x38a69b[_0x0766('0xe')]['code']===0x1f4){logger[_0x0766('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x15c4ed,_0x38a69b[_0x0766('0xe')]['message']);return _0x53dba3(_0x38a69b[_0x0766('0xe')][_0x0766('0xf')]);}logger[_0x0766('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x15c4ed,_0x38a69b['error']['message']);return _0x13ac31(_0x38a69b[_0x0766('0xe')][_0x0766('0xf')]);}else{logger['info'](_0x0766('0x10'),_0x15c4ed,'request\x20sent');_0x13ac31(_0x38a69b[_0x0766('0x11')]['message']);}})[_0x0766('0x12')](function(_0x228a0a){logger[_0x0766('0xe')](_0x0766('0x10'),_0x15c4ed,_0x228a0a);_0x53dba3(_0x228a0a);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 89b375d..508f2a2 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x263402,_0x4661f4){var _0x17136c=function(_0x35bbad){while(--_0x35bbad){_0x263402['push'](_0x263402['shift']());}};_0x17136c(++_0x4661f4);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x34bd12,_0x5d62e9){var _0xb50065=function(_0x2ac514){while(--_0x2ac514){_0x34bd12['push'](_0x34bd12['shift']());}};_0xb50065(++_0x5d62e9);}(_0xedd9,0xfc));var _0x9edd=function(_0x1760ad,_0x9729b1){_0x1760ad=_0x1760ad-0x0;var _0x8fc3ec=_0xedd9[_0x1760ad];return _0x8fc3ec;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 611e56d..eabff7a 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 _0x20e9=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x20e9,0x86));var _0x920e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x20e9[_0x4b7b62];return _0x2280df;};'use strict';var Sequelize=require(_0x920e('0x0'));module[_0x920e('0x1')]={'uniqueid':{'type':Sequelize[_0x920e('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x920e('0x3')},'membername':{'type':Sequelize[_0x920e('0x4')],'allowNull':![],'comment':_0x920e('0x3')},'UserId':{'type':Sequelize[_0x920e('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x920e('0x4')],'allowNull':![],'unique':_0x920e('0x5'),'comment':_0x920e('0x3')},'VoiceQueueId':{'type':Sequelize[_0x920e('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x920e('0x4')],'allowNull':![],'unique':_0x920e('0x5'),'comment':_0x920e('0x3')},'penalty':{'type':Sequelize[_0x920e('0x2')](0xb),'defaultValue':0x0,'comment':_0x920e('0x3')},'paused':{'type':Sequelize[_0x920e('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x08b6=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','INTEGER'];(function(_0x74892f,_0x1e981b){var _0x10ee61=function(_0x3c480a){while(--_0x3c480a){_0x74892f['push'](_0x74892f['shift']());}};_0x10ee61(++_0x1e981b);}(_0x08b6,0x1c0));var _0x608b=function(_0x1fe7db,_0x45658b){_0x1fe7db=_0x1fe7db-0x0;var _0x4c0702=_0x08b6[_0x1fe7db];return _0x4c0702;};'use strict';var Sequelize=require(_0x608b('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x608b('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x608b('0x2')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x608b('0x2')},'UserId':{'type':Sequelize[_0x608b('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x608b('0x3')],'allowNull':![],'unique':_0x608b('0x4'),'comment':_0x608b('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x608b('0x3')],'allowNull':![],'unique':_0x608b('0x4'),'comment':_0x608b('0x2')},'penalty':{'type':Sequelize[_0x608b('0x1')](0xb),'defaultValue':0x0,'comment':_0x608b('0x2')},'paused':{'type':Sequelize[_0x608b('0x1')](0xb),'defaultValue':0x0,'comment':_0x608b('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index fe28e0c..bade73c 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 _0x87af=['exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','update','remove','emit','hook'];(function(_0x9db5d3,_0x4eea5e){var _0x477a81=function(_0x28e774){while(--_0x28e774){_0x9db5d3['push'](_0x9db5d3['shift']());}};_0x477a81(++_0x4eea5e);}(_0x87af,0x160));var _0xf87a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x87af[_0xbd08b4];return _0x314f1e;};'use strict';var EventEmitter=require(_0xf87a('0x0'));var UserVoiceQueueRt=require(_0xf87a('0x1'))['db'][_0xf87a('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xf87a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf87a('0x4'),'afterDestroy':_0xf87a('0x5')};function emitEvent(_0x2a2b6b){return function(_0x47cee1,_0x45698c,_0x55a6d3){UserVoiceQueueRtEvents[_0xf87a('0x6')](_0x2a2b6b+':'+_0x47cee1['id'],_0x47cee1);UserVoiceQueueRtEvents[_0xf87a('0x6')](_0x2a2b6b,_0x47cee1);_0x55a6d3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xf87a('0x7')](e,emitEvent(event));}}module[_0xf87a('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x2ded=['hasOwnProperty','hook','exports','events','UserVoiceQueueRt','setMaxListeners','remove','emit'];(function(_0x41486a,_0x38a637){var _0x4bf6d8=function(_0x2a237e){while(--_0x2a237e){_0x41486a['push'](_0x41486a['shift']());}};_0x4bf6d8(++_0x38a637);}(_0x2ded,0x11b));var _0xd2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ded[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd2de('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xd2de('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xd2de('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd2de('0x3')};function emitEvent(_0x5be16e){return function(_0x2e7559,_0x1fbe36,_0x2702b1){UserVoiceQueueRtEvents[_0xd2de('0x4')](_0x5be16e+':'+_0x2e7559['id'],_0x2e7559);UserVoiceQueueRtEvents[_0xd2de('0x4')](_0x5be16e,_0x2e7559);_0x2702b1(null);};}for(var e in events){if(events[_0xd2de('0x5')](e)){var event=events[e];UserVoiceQueueRt[_0xd2de('0x6')](e,emitEvent(event));}}module[_0xd2de('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 139fce4..7ece5c4 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 _0x8cbb=['exports','define','lodash','util','../../config/logger','api','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes'];(function(_0x3b0bb1,_0x4a818d){var _0x3c926c=function(_0xedef38){while(--_0xedef38){_0x3b0bb1['push'](_0x3b0bb1['shift']());}};_0x3c926c(++_0x4a818d);}(_0x8cbb,0x16a));var _0xb8cb=function(_0x5f5848,_0x1fac72){_0x5f5848=_0x5f5848-0x0;var _0x4c756d=_0x8cbb[_0x5f5848];return _0x4c756d;};'use strict';var _=require(_0xb8cb('0x0'));var util=require(_0xb8cb('0x1'));var logger=require(_0xb8cb('0x2'))(_0xb8cb('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb8cb('0x4'));var rimraf=require(_0xb8cb('0x5'));var config=require(_0xb8cb('0x6'));var attributes=require(_0xb8cb('0x7'));module[_0xb8cb('0x8')]=function(_0x170392,_0x444c77){return _0x170392[_0xb8cb('0x9')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x05a6=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x109f62,_0x2a1093){var _0x2ac0cc=function(_0x2cf0da){while(--_0x2cf0da){_0x109f62['push'](_0x109f62['shift']());}};_0x2ac0cc(++_0x2a1093);}(_0x05a6,0x1b8));var _0x605a=function(_0x313c96,_0x3cee6e){_0x313c96=_0x313c96-0x0;var _0x522f53=_0x05a6[_0x313c96];return _0x522f53;};'use strict';var _=require(_0x605a('0x0'));var util=require(_0x605a('0x1'));var logger=require('../../config/logger')(_0x605a('0x2'));var moment=require(_0x605a('0x3'));var BPromise=require(_0x605a('0x4'));var rp=require(_0x605a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x605a('0x6'));var config=require(_0x605a('0x7'));var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x55b5a9,_0x192299){return _0x55b5a9['define'](_0x605a('0x8'),attributes,{'tableName':_0x605a('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 37bd7d3..e34d289 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 _0xcc25=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./userVoiceQueueRt.socket','register','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','info','lodash','moment','bluebird','randomstring'];(function(_0x5b2809,_0x48b226){var _0x572dee=function(_0x4b3e82){while(--_0x4b3e82){_0x5b2809['push'](_0x5b2809['shift']());}};_0x572dee(++_0x48b226);}(_0xcc25,0x17d));var _0x5cc2=function(_0x135991,_0x23a35e){_0x135991=_0x135991-0x0;var _0x238b21=_0xcc25[_0x135991];return _0x238b21;};'use strict';var _=require(_0x5cc2('0x0'));var util=require('util');var moment=require(_0x5cc2('0x1'));var BPromise=require(_0x5cc2('0x2'));var rs=require(_0x5cc2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5cc2('0x4'))['db'];var utils=require(_0x5cc2('0x5'));var logger=require(_0x5cc2('0x6'))(_0x5cc2('0x7'));var config=require(_0x5cc2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5cc2('0x9')][_0x5cc2('0xa')]({'port':0x232a});config[_0x5cc2('0xb')]=_[_0x5cc2('0xc')](config[_0x5cc2('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5cc2('0xb')]));require(_0x5cc2('0xd'))[_0x5cc2('0xe')](socket);function respondWithRpcPromise(_0x372af6,_0x17d3c1,_0x2dca49){return new BPromise(function(_0x3add81,_0xaf478a){return client['request'](_0x372af6,_0x2dca49)[_0x5cc2('0xf')](function(_0x544592){logger['info'](_0x5cc2('0x10'),_0x17d3c1,_0x5cc2('0x11'));logger[_0x5cc2('0x12')](_0x5cc2('0x13'),_0x17d3c1,'request\x20sent',JSON[_0x5cc2('0x14')](_0x544592));if(_0x544592[_0x5cc2('0x15')]){if(_0x544592[_0x5cc2('0x15')][_0x5cc2('0x16')]===0x1f4){logger[_0x5cc2('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x17d3c1,_0x544592[_0x5cc2('0x15')][_0x5cc2('0x17')]);return _0xaf478a(_0x544592['error'][_0x5cc2('0x17')]);}logger[_0x5cc2('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x17d3c1,_0x544592[_0x5cc2('0x15')][_0x5cc2('0x17')]);return _0x3add81(_0x544592[_0x5cc2('0x15')][_0x5cc2('0x17')]);}else{logger['info'](_0x5cc2('0x10'),_0x17d3c1,'request\x20sent');_0x3add81(_0x544592[_0x5cc2('0x18')][_0x5cc2('0x17')]);}})['catch'](function(_0x16caa3){logger['error'](_0x5cc2('0x10'),_0x17d3c1,_0x16caa3);_0xaf478a(_0x16caa3);});});}exports[_0x5cc2('0x19')]=function(_0x42e877){var _0x17ee91=this;return new Promise(function(_0x482619,_0x1f1e1c){return db[_0x5cc2('0x1a')][_0x5cc2('0x1b')]({'raw':_0x42e877[_0x5cc2('0x1c')]?_0x42e877[_0x5cc2('0x1c')][_0x5cc2('0x1d')]===undefined?!![]:![]:!![],'where':_0x42e877[_0x5cc2('0x1c')]?_0x42e877[_0x5cc2('0x1c')][_0x5cc2('0x1e')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x5cc2('0x1f')]['fn']('IF',db[_0x5cc2('0x1f')][_0x5cc2('0x20')](_0x5cc2('0x21')))),'outboundQueuePauses']]})[_0x5cc2('0xf')](function(_0x3b682d){logger[_0x5cc2('0x22')]('GetVoiceQueueRtPauses',_0x42e877);logger[_0x5cc2('0x12')](_0x5cc2('0x19'),_0x42e877,JSON['stringify'](_0x3b682d));_0x482619(_0x3b682d);})['catch'](function(_0x37c2d2){logger['error'](_0x5cc2('0x19'),_0x37c2d2[_0x5cc2('0x17')],_0x42e877);_0x1f1e1c(_0x17ee91[_0x5cc2('0x15')](0x1f4,_0x37c2d2['message']));});});}; \ No newline at end of file +var _0x277b=['error','code','message','result','UserVoiceQueueRt','options','raw','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x277b,0x12d));var _0xb277=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x277b[_0x11005e];return _0x29338f;};'use strict';var _=require(_0xb277('0x0'));var util=require(_0xb277('0x1'));var moment=require(_0xb277('0x2'));var BPromise=require(_0xb277('0x3'));var rs=require(_0xb277('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb277('0x5'));var logger=require(_0xb277('0x6'))(_0xb277('0x7'));var config=require(_0xb277('0x8'));var jayson=require(_0xb277('0x9'));var client=jayson[_0xb277('0xa')][_0xb277('0xb')]({'port':0x232a});config[_0xb277('0xc')]=_[_0xb277('0xd')](config[_0xb277('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb277('0xe'))(new Redis(config[_0xb277('0xc')]));require(_0xb277('0xf'))[_0xb277('0x10')](socket);function respondWithRpcPromise(_0x3bfb44,_0x26ef7e,_0x1cc7e7){return new BPromise(function(_0x25efa3,_0x12b14b){return client['request'](_0x3bfb44,_0x1cc7e7)[_0xb277('0x11')](function(_0x359667){logger[_0xb277('0x12')](_0xb277('0x13'),_0x26ef7e,_0xb277('0x14'));logger['debug'](_0xb277('0x15'),_0x26ef7e,_0xb277('0x14'),JSON[_0xb277('0x16')](_0x359667));if(_0x359667[_0xb277('0x17')]){if(_0x359667[_0xb277('0x17')][_0xb277('0x18')]===0x1f4){logger['error'](_0xb277('0x13'),_0x26ef7e,_0x359667[_0xb277('0x17')][_0xb277('0x19')]);return _0x12b14b(_0x359667[_0xb277('0x17')]['message']);}logger[_0xb277('0x17')](_0xb277('0x13'),_0x26ef7e,_0x359667[_0xb277('0x17')][_0xb277('0x19')]);return _0x25efa3(_0x359667[_0xb277('0x17')][_0xb277('0x19')]);}else{logger[_0xb277('0x12')](_0xb277('0x13'),_0x26ef7e,_0xb277('0x14'));_0x25efa3(_0x359667[_0xb277('0x1a')][_0xb277('0x19')]);}})['catch'](function(_0x137470){logger[_0xb277('0x17')](_0xb277('0x13'),_0x26ef7e,_0x137470);_0x12b14b(_0x137470);});});}exports['GetVoiceQueueRtPauses']=function(_0x36698a){var _0x4c28e1=this;return new Promise(function(_0x389265,_0x1f5609){return db[_0xb277('0x1b')]['findAll']({'raw':_0x36698a[_0xb277('0x1c')]?_0x36698a['options'][_0xb277('0x1d')]===undefined?!![]:![]:!![],'where':_0x36698a[_0xb277('0x1c')]?_0x36698a['options']['where']||null:null,'attributes':[[db[_0xb277('0x1e')]['fn']('COUNT',db[_0xb277('0x1e')]['fn']('IF',db[_0xb277('0x1e')][_0xb277('0x1f')](_0xb277('0x20')))),_0xb277('0x21')]]})[_0xb277('0x11')](function(_0x5b5ada){logger['info'](_0xb277('0x22'),_0x36698a);logger['debug'](_0xb277('0x22'),_0x36698a,JSON[_0xb277('0x16')](_0x5b5ada));_0x389265(_0x5b5ada);})[_0xb277('0x23')](function(_0x49c8ec){logger['error'](_0xb277('0x22'),_0x49c8ec['message'],_0x36698a);_0x1f5609(_0x4c28e1['error'](0x1f4,_0x49c8ec[_0xb277('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 687f22b..43864fa 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 _0x0f89=['./userVoiceQueueRt.events','save','remove','emit','removeListener','length','userVoiceQueueRt:'];(function(_0x1be34d,_0x552ed8){var _0x5a2cc0=function(_0x513db2){while(--_0x513db2){_0x1be34d['push'](_0x1be34d['shift']());}};_0x5a2cc0(++_0x552ed8);}(_0x0f89,0x111));var _0x90f8=function(_0x293164,_0x463cfd){_0x293164=_0x293164-0x0;var _0x128b0a=_0x0f89[_0x293164];return _0x128b0a;};'use strict';var UserVoiceQueueRtEvents=require(_0x90f8('0x0'));var events=[_0x90f8('0x1'),_0x90f8('0x2'),'update'];function createListener(_0x30231a,_0x344939){return function(_0x19774b){_0x344939[_0x90f8('0x3')](_0x30231a,_0x19774b);};}function removeListener(_0x518478,_0x7211af){return function(){UserVoiceQueueRtEvents[_0x90f8('0x4')](_0x518478,_0x7211af);};}exports['register']=function(_0x7b8d25){for(var _0x4439a9=0x0,_0x4457fb=events[_0x90f8('0x5')];_0x4439a9<_0x4457fb;_0x4439a9++){var _0x240086=events[_0x4439a9];var _0x4424d1=createListener(_0x90f8('0x6')+_0x240086,_0x7b8d25);UserVoiceQueueRtEvents['on'](_0x240086,_0x4424d1);}}; \ No newline at end of file +var _0x0619=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','length'];(function(_0x4fe77d,_0xaad1f1){var _0x296a48=function(_0x444659){while(--_0x444659){_0x4fe77d['push'](_0x4fe77d['shift']());}};_0x296a48(++_0xaad1f1);}(_0x0619,0x90));var _0x9061=function(_0x559cfc,_0x269649){_0x559cfc=_0x559cfc-0x0;var _0x219933=_0x0619[_0x559cfc];return _0x219933;};'use strict';var UserVoiceQueueRtEvents=require(_0x9061('0x0'));var events=[_0x9061('0x1'),_0x9061('0x2'),_0x9061('0x3')];function createListener(_0x4f2ab6,_0x3a207b){return function(_0x69e4c){_0x3a207b[_0x9061('0x4')](_0x4f2ab6,_0x69e4c);};}function removeListener(_0x1384a7,_0x1bc8ce){return function(){UserVoiceQueueRtEvents[_0x9061('0x5')](_0x1384a7,_0x1bc8ce);};}exports[_0x9061('0x6')]=function(_0x3a79a8){for(var _0xac2b69=0x0,_0x259fbd=events[_0x9061('0x7')];_0xac2b69<_0x259fbd;_0xac2b69++){var _0x5a950f=events[_0xac2b69];var _0x3ab87c=createListener('userVoiceQueueRt:'+_0x5a950f,_0x3a79a8);UserVoiceQueueRtEvents['on'](_0x5a950f,_0x3ab87c);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 9096467..773cbed 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x529bde,_0x32d640){var _0xb7109c=function(_0xc5c3b1){while(--_0xc5c3b1){_0x529bde['push'](_0x529bde['shift']());}};_0xb7109c(++_0x32d640);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x18e58f,_0xe7beb3){var _0x273290=function(_0xc7a3c6){while(--_0xc7a3c6){_0x18e58f['push'](_0x18e58f['shift']());}};_0x273290(++_0xe7beb3);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index ed1cfb9..d804bbb 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 _0x2e35=['INTEGER','sequelize'];(function(_0x8bf471,_0x2e9da0){var _0x3d93d7=function(_0x14b46f){while(--_0x14b46f){_0x8bf471['push'](_0x8bf471['shift']());}};_0x3d93d7(++_0x2e9da0);}(_0x2e35,0x101));var _0x52e3=function(_0x28b9fa,_0x26d48a){_0x28b9fa=_0x28b9fa-0x0;var _0xc8f85d=_0x2e35[_0x28b9fa];return _0xc8f85d;};'use strict';var Sequelize=require(_0x52e3('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x52e3('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3353=['exports','sequelize'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3353,0xbf));var _0x3335=function(_0x592f75,_0x56ab70){_0x592f75=_0x592f75-0x0;var _0x17164d=_0x3353[_0x592f75];return _0x17164d;};'use strict';var Sequelize=require(_0x3335('0x0'));module[_0x3335('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 0da7923..7823f9a 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 _0x5c8c=['request-promise','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','api','moment','bluebird'];(function(_0x383533,_0x19d33d){var _0x52ceb9=function(_0x573033){while(--_0x573033){_0x383533['push'](_0x383533['shift']());}};_0x52ceb9(++_0x19d33d);}(_0x5c8c,0x1b5));var _0xc5c8=function(_0x129d7e,_0x5d1e28){_0x129d7e=_0x129d7e-0x0;var _0x6ea217=_0x5c8c[_0x129d7e];return _0x6ea217;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc5c8('0x0'));var moment=require(_0xc5c8('0x1'));var BPromise=require(_0xc5c8('0x2'));var rp=require(_0xc5c8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5c8('0x4'));var config=require(_0xc5c8('0x5'));var attributes=require(_0xc5c8('0x6'));module[_0xc5c8('0x7')]=function(_0x5a071e,_0x300352){return _0x5a071e[_0xc5c8('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0xc5c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7823=['bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','lodash','util','../../config/logger','api'];(function(_0xbc25e1,_0x27007d){var _0xaf0a85=function(_0x52acb3){while(--_0x52acb3){_0xbc25e1['push'](_0xbc25e1['shift']());}};_0xaf0a85(++_0x27007d);}(_0x7823,0x8b));var _0x3782=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x7823[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x3782('0x0'));var util=require(_0x3782('0x1'));var logger=require(_0x3782('0x2'))(_0x3782('0x3'));var moment=require('moment');var BPromise=require(_0x3782('0x4'));var rp=require(_0x3782('0x5'));var fs=require('fs');var path=require(_0x3782('0x6'));var rimraf=require(_0x3782('0x7'));var config=require(_0x3782('0x8'));var attributes=require(_0x3782('0x9'));module[_0x3782('0xa')]=function(_0x24536f,_0x195fbd){return _0x24536f[_0x3782('0xb')](_0x3782('0xc'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index ea5df92..e118fef 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 _0x5e14=['UserWhatsappQueue,\x20%s,\x20%s','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x274a3c,_0x452f75){var _0x3d7071=function(_0x3a6bd2){while(--_0x3a6bd2){_0x274a3c['push'](_0x274a3c['shift']());}};_0x3d7071(++_0x452f75);}(_0x5e14,0x1eb));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x45e1('0x0'));var util=require('util');var moment=require(_0x45e1('0x1'));var BPromise=require(_0x45e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x45e1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x45e1('0x4'));var logger=require(_0x45e1('0x5'))('rpc');var config=require(_0x45e1('0x6'));var jayson=require(_0x45e1('0x7'));var client=jayson[_0x45e1('0x8')][_0x45e1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c6e0b,_0x14bedd,_0x460c4c){return new BPromise(function(_0x34871c,_0x123d70){return client[_0x45e1('0xa')](_0x4c6e0b,_0x460c4c)[_0x45e1('0xb')](function(_0x344d96){logger[_0x45e1('0xc')](_0x45e1('0xd'),_0x14bedd,'request\x20sent');logger['debug'](_0x45e1('0xe'),_0x14bedd,_0x45e1('0xf'),JSON[_0x45e1('0x10')](_0x344d96));if(_0x344d96[_0x45e1('0x11')]){if(_0x344d96[_0x45e1('0x11')][_0x45e1('0x12')]===0x1f4){logger[_0x45e1('0x11')](_0x45e1('0xd'),_0x14bedd,_0x344d96[_0x45e1('0x11')][_0x45e1('0x13')]);return _0x123d70(_0x344d96[_0x45e1('0x11')][_0x45e1('0x13')]);}logger[_0x45e1('0x11')](_0x45e1('0xd'),_0x14bedd,_0x344d96['error']['message']);return _0x34871c(_0x344d96[_0x45e1('0x11')]['message']);}else{logger[_0x45e1('0xc')](_0x45e1('0xd'),_0x14bedd,_0x45e1('0xf'));_0x34871c(_0x344d96['result'][_0x45e1('0x13')]);}})[_0x45e1('0x14')](function(_0x24a10b){logger[_0x45e1('0x11')](_0x45e1('0xd'),_0x14bedd,_0x24a10b);_0x123d70(_0x24a10b);});});} \ No newline at end of file +var _0xc188=['../../config/environment','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2e1207,_0x2620c8){var _0x164111=function(_0x7e761b){while(--_0x7e761b){_0x2e1207['push'](_0x2e1207['shift']());}};_0x164111(++_0x2620c8);}(_0xc188,0x186));var _0x8c18=function(_0x104651,_0xc9839d){_0x104651=_0x104651-0x0;var _0x387659=_0xc188[_0x104651];return _0x387659;};'use strict';var _=require(_0x8c18('0x0'));var util=require(_0x8c18('0x1'));var moment=require(_0x8c18('0x2'));var BPromise=require(_0x8c18('0x3'));var rs=require(_0x8c18('0x4'));var fs=require('fs');var Redis=require(_0x8c18('0x5'));var db=require(_0x8c18('0x6'))['db'];var utils=require(_0x8c18('0x7'));var logger=require(_0x8c18('0x8'))(_0x8c18('0x9'));var config=require(_0x8c18('0xa'));var jayson=require(_0x8c18('0xb'));var client=jayson['client'][_0x8c18('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x491366,_0x1ff041,_0x2ac849){return new BPromise(function(_0x415ecf,_0x29dea9){return client[_0x8c18('0xd')](_0x491366,_0x2ac849)[_0x8c18('0xe')](function(_0x36f507){logger[_0x8c18('0xf')](_0x8c18('0x10'),_0x1ff041,'request\x20sent');logger['debug'](_0x8c18('0x11'),_0x1ff041,_0x8c18('0x12'),JSON[_0x8c18('0x13')](_0x36f507));if(_0x36f507[_0x8c18('0x14')]){if(_0x36f507[_0x8c18('0x14')][_0x8c18('0x15')]===0x1f4){logger[_0x8c18('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x1ff041,_0x36f507[_0x8c18('0x14')]['message']);return _0x29dea9(_0x36f507[_0x8c18('0x14')][_0x8c18('0x16')]);}logger[_0x8c18('0x14')](_0x8c18('0x10'),_0x1ff041,_0x36f507[_0x8c18('0x14')]['message']);return _0x415ecf(_0x36f507[_0x8c18('0x14')]['message']);}else{logger['info'](_0x8c18('0x10'),_0x1ff041,_0x8c18('0x12'));_0x415ecf(_0x36f507[_0x8c18('0x17')][_0x8c18('0x16')]);}})[_0x8c18('0x18')](function(_0x204259){logger['error'](_0x8c18('0x10'),_0x1ff041,_0x204259);_0x29dea9(_0x204259);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 460cee9..3d88261 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 _0xf6fb=['isAuthenticated','index','/:id','show','create','put','destroy','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./variable.controller','get'];(function(_0x38d4f3,_0x37ff24){var _0x37897e=function(_0x84fa21){while(--_0x84fa21){_0x38d4f3['push'](_0x38d4f3['shift']());}};_0x37897e(++_0x37ff24);}(_0xf6fb,0x111));var _0xbf6f=function(_0x342a3e,_0x82ee7b){_0x342a3e=_0x342a3e-0x0;var _0x2d8605=_0xf6fb[_0x342a3e];return _0x2d8605;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbf6f('0x0'));var timeout=require(_0xbf6f('0x1'));var express=require('express');var router=express[_0xbf6f('0x2')]();var fs_extra=require(_0xbf6f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbf6f('0x4'));var config=require('../../config/environment');var controller=require(_0xbf6f('0x5'));router[_0xbf6f('0x6')]('/',auth[_0xbf6f('0x7')](),controller[_0xbf6f('0x8')]);router[_0xbf6f('0x6')](_0xbf6f('0x9'),auth[_0xbf6f('0x7')](),controller[_0xbf6f('0xa')]);router['post']('/',auth[_0xbf6f('0x7')](),controller[_0xbf6f('0xb')]);router[_0xbf6f('0xc')](_0xbf6f('0x9'),auth[_0xbf6f('0x7')](),controller['update']);router['delete'](_0xbf6f('0x9'),auth[_0xbf6f('0x7')](),controller[_0xbf6f('0xd')]);module['exports']=router; \ No newline at end of file +var _0x0624=['delete','destroy','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','update'];(function(_0x86efff,_0x4983ec){var _0x18ecdf=function(_0x4fd740){while(--_0x4fd740){_0x86efff['push'](_0x86efff['shift']());}};_0x18ecdf(++_0x4983ec);}(_0x0624,0x132));var _0x4062=function(_0x4d15fe,_0x264d18){_0x4d15fe=_0x4d15fe-0x0;var _0x46bb18=_0x0624[_0x4d15fe];return _0x46bb18;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4062('0x0'));var router=express[_0x4062('0x1')]();var fs_extra=require(_0x4062('0x2'));var auth=require(_0x4062('0x3'));var interaction=require(_0x4062('0x4'));var config=require(_0x4062('0x5'));var controller=require('./variable.controller');router['get']('/',auth[_0x4062('0x6')](),controller[_0x4062('0x7')]);router[_0x4062('0x8')](_0x4062('0x9'),auth[_0x4062('0x6')](),controller['show']);router[_0x4062('0xa')]('/',auth['isAuthenticated'](),controller[_0x4062('0xb')]);router[_0x4062('0xc')](_0x4062('0x9'),auth[_0x4062('0x6')](),controller[_0x4062('0xd')]);router[_0x4062('0xe')](_0x4062('0x9'),auth['isAuthenticated'](),controller[_0x4062('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 9b7ca88..ba5f7f3 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 _0x2763=['exports','name','sequelize'];(function(_0x2bcd1f,_0x4f1972){var _0x2381ca=function(_0x51f935){while(--_0x51f935){_0x2bcd1f['push'](_0x2bcd1f['shift']());}};_0x2381ca(++_0x4f1972);}(_0x2763,0x98));var _0x3276=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2763[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x3276('0x0'));module[_0x3276('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x3276('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc665=['exports','STRING'];(function(_0xd0b0ec,_0x1fc627){var _0x155ccc=function(_0x4b79a4){while(--_0x4b79a4){_0xd0b0ec['push'](_0xd0b0ec['shift']());}};_0x155ccc(++_0x1fc627);}(_0xc665,0x1ac));var _0x5c66=function(_0x5142f5,_0x382614){_0x5142f5=_0x5142f5-0x0;var _0x460bf2=_0xc665[_0x5142f5];return _0x460bf2;};'use strict';var Sequelize=require('sequelize');module[_0x5c66('0x0')]={'name':{'type':Sequelize[_0x5c66('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5c66('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index f2343f1..3840fd3 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 _0x2baa=['where','pick','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','get','Variables','UserProfileResource','sendStatus','error','stack','name','send','index','Variable','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x2baa,0x165));var _0xa2ba=function(_0x2a8161,_0x1779b1){_0x2a8161=_0x2a8161-0x0;var _0x20de3f=_0x2baa[_0x2a8161];return _0x20de3f;};'use strict';var emlformat=require(_0xa2ba('0x0'));var rimraf=require(_0xa2ba('0x1'));var zipdir=require(_0xa2ba('0x2'));var jsonpatch=require(_0xa2ba('0x3'));var rp=require(_0xa2ba('0x4'));var moment=require(_0xa2ba('0x5'));var BPromise=require(_0xa2ba('0x6'));var Mustache=require('mustache');var util=require(_0xa2ba('0x7'));var path=require(_0xa2ba('0x8'));var sox=require(_0xa2ba('0x9'));var csv=require(_0xa2ba('0xa'));var ejs=require(_0xa2ba('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2ba('0xc'));var squel=require(_0xa2ba('0xd'));var crypto=require(_0xa2ba('0xe'));var jsforce=require(_0xa2ba('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa2ba('0xa'));var querystring=require(_0xa2ba('0x10'));var Papa=require('papaparse');var Redis=require(_0xa2ba('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa2ba('0x12'));var hardwareService=require(_0xa2ba('0x13'));var logger=require('../../config/logger')(_0xa2ba('0x14'));var utils=require(_0xa2ba('0x15'));var config=require(_0xa2ba('0x16'));var licenseUtil=require(_0xa2ba('0x17'));var db=require(_0xa2ba('0x18'))['db'];function respondWithStatusCode(_0x3f34e0,_0x19611e){_0x19611e=_0x19611e||0xcc;return function(_0x1a75c2){if(_0x1a75c2){return _0x3f34e0['sendStatus'](_0x19611e);}return _0x3f34e0[_0xa2ba('0x19')](_0x19611e)[_0xa2ba('0x1a')]();};}function respondWithResult(_0x1be793,_0x181a62){_0x181a62=_0x181a62||0xc8;return function(_0x2b2060){if(_0x2b2060){return _0x1be793[_0xa2ba('0x19')](_0x181a62)['json'](_0x2b2060);}};}function respondWithFilteredResult(_0x1860f3,_0x2122e6){return function(_0x1b31b2){if(_0x1b31b2){var _0x3ae7aa=typeof _0x2122e6[_0xa2ba('0x1b')]===_0xa2ba('0x1c')&&typeof _0x2122e6[_0xa2ba('0x1d')]===_0xa2ba('0x1c');var _0xfe00bb=_0x1b31b2[_0xa2ba('0x1e')];var _0x184cff=_0x3ae7aa?0x0:_0x2122e6[_0xa2ba('0x1b')];var _0x37fe07=_0x3ae7aa?_0x1b31b2['count']:_0x2122e6[_0xa2ba('0x1b')]+_0x2122e6[_0xa2ba('0x1d')];var _0xc33be1;if(_0x37fe07>=_0xfe00bb){_0x37fe07=_0xfe00bb;_0xc33be1=0xc8;}else{_0xc33be1=0xce;}_0x1860f3[_0xa2ba('0x19')](_0xc33be1);return _0x1860f3[_0xa2ba('0x1f')](_0xa2ba('0x20'),_0x184cff+'-'+_0x37fe07+'/'+_0xfe00bb)[_0xa2ba('0x21')](_0x1b31b2);}return null;};}function patchUpdates(_0x4e74dd){return function(_0x13cf1c){try{jsonpatch['apply'](_0x13cf1c,_0x4e74dd,!![]);}catch(_0x26ada7){return BPromise[_0xa2ba('0x22')](_0x26ada7);}return _0x13cf1c[_0xa2ba('0x23')]();};}function saveUpdates(_0x59e623,_0x161363){return function(_0x1ebb27){if(_0x1ebb27){return _0x1ebb27['update'](_0x59e623)[_0xa2ba('0x24')](function(_0x38c524){return _0x38c524;});}return null;};}function removeEntity(_0x19d697,_0x32f8e5){return function(_0x2b5f6f){if(_0x2b5f6f){return _0x2b5f6f[_0xa2ba('0x25')]()[_0xa2ba('0x24')](function(){var _0x7d779a=_0x2b5f6f[_0xa2ba('0x26')]({'plain':!![]});var _0x545972=_0xa2ba('0x27');return db[_0xa2ba('0x28')][_0xa2ba('0x25')]({'where':{'type':_0x545972,'resourceId':_0x7d779a['id']}})[_0xa2ba('0x24')](function(){return _0x2b5f6f;});})[_0xa2ba('0x24')](function(){_0x19d697[_0xa2ba('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c88dd,_0x12cec0){return function(_0x59d8d6){if(!_0x59d8d6){_0x5c88dd[_0xa2ba('0x29')](0x194);}return _0x59d8d6;};}function handleError(_0x3f92c0,_0x2e2791){_0x2e2791=_0x2e2791||0x1f4;return function(_0x174cee){logger[_0xa2ba('0x2a')](_0x174cee[_0xa2ba('0x2b')]);if(_0x174cee[_0xa2ba('0x2c')]){delete _0x174cee[_0xa2ba('0x2c')];}_0x3f92c0[_0xa2ba('0x19')](_0x2e2791)[_0xa2ba('0x2d')](_0x174cee);};}exports[_0xa2ba('0x2e')]=function(_0x21ecaa,_0x73d36a){var _0x2760ea={},_0x50a09={},_0x16babe={'count':0x0,'rows':[]};var _0x1de6a1=_['map'](db[_0xa2ba('0x2f')][_0xa2ba('0x30')],function(_0x4ff113){return{'name':_0x4ff113[_0xa2ba('0x31')],'type':_0x4ff113['type'][_0xa2ba('0x32')]};});_0x50a09[_0xa2ba('0x33')]=_[_0xa2ba('0x34')](_0x1de6a1,_0xa2ba('0x2c'));_0x50a09[_0xa2ba('0x35')]=_[_0xa2ba('0x36')](_0x21ecaa[_0xa2ba('0x35')]);_0x50a09[_0xa2ba('0x37')]=_['intersection'](_0x50a09[_0xa2ba('0x33')],_0x50a09[_0xa2ba('0x35')]);_0x2760ea[_0xa2ba('0x38')]=_['intersection'](_0x50a09[_0xa2ba('0x33')],qs[_0xa2ba('0x39')](_0x21ecaa[_0xa2ba('0x35')][_0xa2ba('0x39')]));_0x2760ea['attributes']=_0x2760ea['attributes'][_0xa2ba('0x3a')]?_0x2760ea[_0xa2ba('0x38')]:_0x50a09[_0xa2ba('0x33')];if(!_0x21ecaa['query'][_0xa2ba('0x3b')](_0xa2ba('0x3c'))){_0x2760ea[_0xa2ba('0x1d')]=qs[_0xa2ba('0x1d')](_0x21ecaa[_0xa2ba('0x35')][_0xa2ba('0x1d')]);_0x2760ea[_0xa2ba('0x1b')]=qs[_0xa2ba('0x1b')](_0x21ecaa[_0xa2ba('0x35')][_0xa2ba('0x1b')]);}_0x2760ea[_0xa2ba('0x3d')]=qs['sort'](_0x21ecaa[_0xa2ba('0x35')][_0xa2ba('0x3e')]);_0x2760ea[_0xa2ba('0x3f')]=qs[_0xa2ba('0x37')](_[_0xa2ba('0x40')](_0x21ecaa[_0xa2ba('0x35')],_0x50a09[_0xa2ba('0x37')]),_0x1de6a1);if(_0x21ecaa[_0xa2ba('0x35')]['filter']){_0x2760ea[_0xa2ba('0x3f')]=_[_0xa2ba('0x41')](_0x2760ea[_0xa2ba('0x3f')],{'$or':_[_0xa2ba('0x34')](_0x1de6a1,function(_0x1ea7af){if(_0x1ea7af['type']!==_0xa2ba('0x42')){var _0x2c92c2={};_0x2c92c2[_0x1ea7af['name']]={'$like':'%'+_0x21ecaa[_0xa2ba('0x35')]['filter']+'%'};return _0x2c92c2;}})});}_0x2760ea=_[_0xa2ba('0x41')]({},_0x2760ea,_0x21ecaa['options']);var _0x39b5a5={'where':_0x2760ea['where']};return db[_0xa2ba('0x2f')][_0xa2ba('0x1e')](_0x39b5a5)[_0xa2ba('0x24')](function(_0x262a0c){_0x16babe[_0xa2ba('0x1e')]=_0x262a0c;if(_0x21ecaa[_0xa2ba('0x35')]['includeAll']){_0x2760ea[_0xa2ba('0x43')]=[{'all':!![]}];}return db['Variable'][_0xa2ba('0x44')](_0x2760ea);})[_0xa2ba('0x24')](function(_0x1f2d3e){_0x16babe['rows']=_0x1f2d3e;return _0x16babe;})['then'](respondWithFilteredResult(_0x73d36a,_0x2760ea))[_0xa2ba('0x45')](handleError(_0x73d36a,null));};exports[_0xa2ba('0x46')]=function(_0x1c1b20,_0x3c817e){var _0x18cc06={'raw':!![],'where':{'id':_0x1c1b20[_0xa2ba('0x47')]['id']}},_0x5d4167={};_0x5d4167[_0xa2ba('0x33')]=_[_0xa2ba('0x36')](db['Variable'][_0xa2ba('0x30')]);_0x5d4167[_0xa2ba('0x35')]=_['keys'](_0x1c1b20[_0xa2ba('0x35')]);_0x5d4167[_0xa2ba('0x37')]=_['intersection'](_0x5d4167[_0xa2ba('0x33')],_0x5d4167[_0xa2ba('0x35')]);_0x18cc06['attributes']=_['intersection'](_0x5d4167[_0xa2ba('0x33')],qs[_0xa2ba('0x39')](_0x1c1b20[_0xa2ba('0x35')][_0xa2ba('0x39')]));_0x18cc06['attributes']=_0x18cc06[_0xa2ba('0x38')]['length']?_0x18cc06[_0xa2ba('0x38')]:_0x5d4167['model'];if(_0x1c1b20['query'][_0xa2ba('0x48')]){_0x18cc06[_0xa2ba('0x43')]=[{'all':!![]}];}_0x18cc06=_[_0xa2ba('0x41')]({},_0x18cc06,_0x1c1b20[_0xa2ba('0x49')]);return db['Variable'][_0xa2ba('0x4a')](_0x18cc06)['then'](handleEntityNotFound(_0x3c817e,null))[_0xa2ba('0x24')](respondWithResult(_0x3c817e,null))[_0xa2ba('0x45')](handleError(_0x3c817e,null));};exports[_0xa2ba('0x4b')]=function(_0x2efdcb,_0x237030){return db[_0xa2ba('0x2f')]['create'](_0x2efdcb[_0xa2ba('0x4c')],{})[_0xa2ba('0x24')](function(_0x4661c9){var _0xe146ec=_0x2efdcb[_0xa2ba('0x4d')]['get']({'plain':!![]});if(!_0xe146ec)throw new Error(_0xa2ba('0x4e'));if(_0xe146ec[_0xa2ba('0x4f')]==='user'){var _0x4ab14b=_0x4661c9['get']({'plain':!![]});var _0x45ecd0='Variables';return db[_0xa2ba('0x50')]['find']({'where':{'name':_0x45ecd0,'userProfileId':_0xe146ec['userProfileId']},'raw':!![]})[_0xa2ba('0x24')](function(_0x4cffc5){if(_0x4cffc5&&_0x4cffc5[_0xa2ba('0x51')]===0x0){return db[_0xa2ba('0x28')][_0xa2ba('0x4b')]({'name':_0x4ab14b[_0xa2ba('0x2c')],'resourceId':_0x4ab14b['id'],'type':_0x4cffc5[_0xa2ba('0x2c')],'sectionId':_0x4cffc5['id']},{})['then'](function(){return _0x4661c9;});}else{return _0x4661c9;}})[_0xa2ba('0x45')](function(_0x5be39d){logger['error'](_0xa2ba('0x52'),_0x5be39d);throw _0x5be39d;});}return _0x4661c9;})[_0xa2ba('0x24')](respondWithResult(_0x237030,0xc9))[_0xa2ba('0x45')](handleError(_0x237030,null));};exports[_0xa2ba('0x53')]=function(_0x3fc867,_0x1bb3a4){if(_0x3fc867[_0xa2ba('0x4c')]['id']){delete _0x3fc867[_0xa2ba('0x4c')]['id'];}return db[_0xa2ba('0x2f')][_0xa2ba('0x4a')]({'where':{'id':_0x3fc867[_0xa2ba('0x47')]['id']}})[_0xa2ba('0x24')](handleEntityNotFound(_0x1bb3a4,null))[_0xa2ba('0x24')](saveUpdates(_0x3fc867[_0xa2ba('0x4c')],null))[_0xa2ba('0x24')](respondWithResult(_0x1bb3a4,null))[_0xa2ba('0x45')](handleError(_0x1bb3a4,null));};exports['destroy']=function(_0x2eac26,_0x1a933f){return db[_0xa2ba('0x2f')]['find']({'where':{'id':_0x2eac26[_0xa2ba('0x47')]['id']}})[_0xa2ba('0x24')](handleEntityNotFound(_0x1a933f,null))[_0xa2ba('0x24')](removeEntity(_0x1a933f,null))[_0xa2ba('0x45')](handleError(_0x1a933f,null));}; \ No newline at end of file +var _0x2047=['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','count','limit','set','Content-Range','apply','save','update','destroy','Variables','then','end','stack','name','send','map','rawAttributes','fieldName','type','key','model','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','Variable','includeAll','include','findAll','rows','catch','params','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2047,0x13d));var _0x7204=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x2047[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7204('0x0'));var jsonpatch=require(_0x7204('0x1'));var rp=require(_0x7204('0x2'));var moment=require(_0x7204('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7204('0x4'));var util=require(_0x7204('0x5'));var path=require('path');var sox=require(_0x7204('0x6'));var csv=require('to-csv');var ejs=require(_0x7204('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7204('0x8'));var squel=require(_0x7204('0x9'));var crypto=require(_0x7204('0xa'));var jsforce=require(_0x7204('0xb'));var deskjs=require(_0x7204('0xc'));var toCsv=require(_0x7204('0xd'));var querystring=require(_0x7204('0xe'));var Papa=require('papaparse');var Redis=require(_0x7204('0xf'));var authService=require(_0x7204('0x10'));var qs=require(_0x7204('0x11'));var as=require(_0x7204('0x12'));var hardwareService=require(_0x7204('0x13'));var logger=require(_0x7204('0x14'))(_0x7204('0x15'));var utils=require(_0x7204('0x16'));var config=require(_0x7204('0x17'));var licenseUtil=require(_0x7204('0x18'));var db=require(_0x7204('0x19'))['db'];function respondWithStatusCode(_0x269419,_0x5556a2){_0x5556a2=_0x5556a2||0xcc;return function(_0x28551c){if(_0x28551c){return _0x269419[_0x7204('0x1a')](_0x5556a2);}return _0x269419[_0x7204('0x1b')](_0x5556a2)['end']();};}function respondWithResult(_0x1e32c9,_0x42037f){_0x42037f=_0x42037f||0xc8;return function(_0x59108e){if(_0x59108e){return _0x1e32c9[_0x7204('0x1b')](_0x42037f)[_0x7204('0x1c')](_0x59108e);}};}function respondWithFilteredResult(_0x5021b4,_0x29b254){return function(_0x955c8b){if(_0x955c8b){var _0x5e7519=typeof _0x29b254[_0x7204('0x1d')]===_0x7204('0x1e')&&typeof _0x29b254['limit']===_0x7204('0x1e');var _0x2ceb27=_0x955c8b[_0x7204('0x1f')];var _0x360884=_0x5e7519?0x0:_0x29b254[_0x7204('0x1d')];var _0xbd7872=_0x5e7519?_0x955c8b[_0x7204('0x1f')]:_0x29b254[_0x7204('0x1d')]+_0x29b254[_0x7204('0x20')];var _0x398c74;if(_0xbd7872>=_0x2ceb27){_0xbd7872=_0x2ceb27;_0x398c74=0xc8;}else{_0x398c74=0xce;}_0x5021b4[_0x7204('0x1b')](_0x398c74);return _0x5021b4[_0x7204('0x21')](_0x7204('0x22'),_0x360884+'-'+_0xbd7872+'/'+_0x2ceb27)['json'](_0x955c8b);}return null;};}function patchUpdates(_0x19ab88){return function(_0x2ceae3){try{jsonpatch[_0x7204('0x23')](_0x2ceae3,_0x19ab88,!![]);}catch(_0x59d8af){return BPromise['reject'](_0x59d8af);}return _0x2ceae3[_0x7204('0x24')]();};}function saveUpdates(_0x55bfcb,_0x216f22){return function(_0x4f3918){if(_0x4f3918){return _0x4f3918[_0x7204('0x25')](_0x55bfcb)['then'](function(_0x27867c){return _0x27867c;});}return null;};}function removeEntity(_0x519017,_0x3cbdd8){return function(_0x2f23e5){if(_0x2f23e5){return _0x2f23e5[_0x7204('0x26')]()['then'](function(){var _0xc7263a=_0x2f23e5['get']({'plain':!![]});var _0x40df3d=_0x7204('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x40df3d,'resourceId':_0xc7263a['id']}})[_0x7204('0x28')](function(){return _0x2f23e5;});})['then'](function(){_0x519017[_0x7204('0x1b')](0xcc)[_0x7204('0x29')]();});}};}function handleEntityNotFound(_0x5310d9,_0x4802df){return function(_0xa6c0b){if(!_0xa6c0b){_0x5310d9[_0x7204('0x1a')](0x194);}return _0xa6c0b;};}function handleError(_0x175fdc,_0x5b8e32){_0x5b8e32=_0x5b8e32||0x1f4;return function(_0x1ab00e){logger['error'](_0x1ab00e[_0x7204('0x2a')]);if(_0x1ab00e[_0x7204('0x2b')]){delete _0x1ab00e[_0x7204('0x2b')];}_0x175fdc[_0x7204('0x1b')](_0x5b8e32)[_0x7204('0x2c')](_0x1ab00e);};}exports['index']=function(_0x40038c,_0x5c7c9a){var _0x4c46de={},_0x3b8043={},_0x4a76f3={'count':0x0,'rows':[]};var _0x26b3aa=_[_0x7204('0x2d')](db['Variable'][_0x7204('0x2e')],function(_0x50b0e7){return{'name':_0x50b0e7[_0x7204('0x2f')],'type':_0x50b0e7[_0x7204('0x30')][_0x7204('0x31')]};});_0x3b8043[_0x7204('0x32')]=_[_0x7204('0x2d')](_0x26b3aa,_0x7204('0x2b'));_0x3b8043['query']=_['keys'](_0x40038c['query']);_0x3b8043['filters']=_[_0x7204('0x33')](_0x3b8043[_0x7204('0x32')],_0x3b8043[_0x7204('0x34')]);_0x4c46de[_0x7204('0x35')]=_[_0x7204('0x33')](_0x3b8043['model'],qs[_0x7204('0x36')](_0x40038c[_0x7204('0x34')]['fields']));_0x4c46de[_0x7204('0x35')]=_0x4c46de['attributes'][_0x7204('0x37')]?_0x4c46de[_0x7204('0x35')]:_0x3b8043['model'];if(!_0x40038c['query'][_0x7204('0x38')](_0x7204('0x39'))){_0x4c46de['limit']=qs[_0x7204('0x20')](_0x40038c[_0x7204('0x34')][_0x7204('0x20')]);_0x4c46de[_0x7204('0x1d')]=qs[_0x7204('0x1d')](_0x40038c[_0x7204('0x34')][_0x7204('0x1d')]);}_0x4c46de[_0x7204('0x3a')]=qs[_0x7204('0x3b')](_0x40038c[_0x7204('0x34')]['sort']);_0x4c46de[_0x7204('0x3c')]=qs[_0x7204('0x3d')](_['pick'](_0x40038c['query'],_0x3b8043[_0x7204('0x3d')]),_0x26b3aa);if(_0x40038c[_0x7204('0x34')]['filter']){_0x4c46de['where']=_[_0x7204('0x3e')](_0x4c46de[_0x7204('0x3c')],{'$or':_['map'](_0x26b3aa,function(_0xb10770){if(_0xb10770[_0x7204('0x30')]!=='VIRTUAL'){var _0x3f1f0c={};_0x3f1f0c[_0xb10770[_0x7204('0x2b')]]={'$like':'%'+_0x40038c[_0x7204('0x34')][_0x7204('0x3f')]+'%'};return _0x3f1f0c;}})});}_0x4c46de=_['merge']({},_0x4c46de,_0x40038c['options']);var _0x2d6cfc={'where':_0x4c46de[_0x7204('0x3c')]};return db[_0x7204('0x40')][_0x7204('0x1f')](_0x2d6cfc)['then'](function(_0x370b8c){_0x4a76f3[_0x7204('0x1f')]=_0x370b8c;if(_0x40038c[_0x7204('0x34')][_0x7204('0x41')]){_0x4c46de[_0x7204('0x42')]=[{'all':!![]}];}return db[_0x7204('0x40')][_0x7204('0x43')](_0x4c46de);})[_0x7204('0x28')](function(_0x4716d){_0x4a76f3[_0x7204('0x44')]=_0x4716d;return _0x4a76f3;})[_0x7204('0x28')](respondWithFilteredResult(_0x5c7c9a,_0x4c46de))[_0x7204('0x45')](handleError(_0x5c7c9a,null));};exports['show']=function(_0x56a853,_0x259dcb){var _0x51e945={'raw':!![],'where':{'id':_0x56a853[_0x7204('0x46')]['id']}},_0x1fa189={};_0x1fa189[_0x7204('0x32')]=_['keys'](db[_0x7204('0x40')]['rawAttributes']);_0x1fa189[_0x7204('0x34')]=_['keys'](_0x56a853['query']);_0x1fa189[_0x7204('0x3d')]=_['intersection'](_0x1fa189['model'],_0x1fa189[_0x7204('0x34')]);_0x51e945['attributes']=_[_0x7204('0x33')](_0x1fa189[_0x7204('0x32')],qs[_0x7204('0x36')](_0x56a853[_0x7204('0x34')][_0x7204('0x36')]));_0x51e945[_0x7204('0x35')]=_0x51e945['attributes'][_0x7204('0x37')]?_0x51e945[_0x7204('0x35')]:_0x1fa189['model'];if(_0x56a853[_0x7204('0x34')][_0x7204('0x41')]){_0x51e945[_0x7204('0x42')]=[{'all':!![]}];}_0x51e945=_[_0x7204('0x3e')]({},_0x51e945,_0x56a853[_0x7204('0x47')]);return db[_0x7204('0x40')][_0x7204('0x48')](_0x51e945)[_0x7204('0x28')](handleEntityNotFound(_0x259dcb,null))[_0x7204('0x28')](respondWithResult(_0x259dcb,null))[_0x7204('0x45')](handleError(_0x259dcb,null));};exports[_0x7204('0x49')]=function(_0x54f518,_0x1b722e){return db[_0x7204('0x40')][_0x7204('0x49')](_0x54f518['body'],{})['then'](function(_0x2dcf38){var _0x3e7664=_0x54f518[_0x7204('0x4a')][_0x7204('0x4b')]({'plain':!![]});if(!_0x3e7664)throw new Error(_0x7204('0x4c'));if(_0x3e7664[_0x7204('0x4d')]===_0x7204('0x4a')){var _0x4517ee=_0x2dcf38[_0x7204('0x4b')]({'plain':!![]});var _0x12def4='Variables';return db[_0x7204('0x4e')][_0x7204('0x48')]({'where':{'name':_0x12def4,'userProfileId':_0x3e7664[_0x7204('0x4f')]},'raw':!![]})[_0x7204('0x28')](function(_0x5bf0e8){if(_0x5bf0e8&&_0x5bf0e8[_0x7204('0x50')]===0x0){return db[_0x7204('0x51')]['create']({'name':_0x4517ee[_0x7204('0x2b')],'resourceId':_0x4517ee['id'],'type':_0x5bf0e8[_0x7204('0x2b')],'sectionId':_0x5bf0e8['id']},{})[_0x7204('0x28')](function(){return _0x2dcf38;});}else{return _0x2dcf38;}})[_0x7204('0x45')](function(_0x104c0d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x104c0d);throw _0x104c0d;});}return _0x2dcf38;})['then'](respondWithResult(_0x1b722e,0xc9))[_0x7204('0x45')](handleError(_0x1b722e,null));};exports[_0x7204('0x25')]=function(_0x330106,_0x48d2f5){if(_0x330106[_0x7204('0x52')]['id']){delete _0x330106[_0x7204('0x52')]['id'];}return db[_0x7204('0x40')]['find']({'where':{'id':_0x330106['params']['id']}})[_0x7204('0x28')](handleEntityNotFound(_0x48d2f5,null))[_0x7204('0x28')](saveUpdates(_0x330106[_0x7204('0x52')],null))[_0x7204('0x28')](respondWithResult(_0x48d2f5,null))[_0x7204('0x45')](handleError(_0x48d2f5,null));};exports[_0x7204('0x26')]=function(_0x34999d,_0x31f7d0){return db[_0x7204('0x40')][_0x7204('0x48')]({'where':{'id':_0x34999d[_0x7204('0x46')]['id']}})[_0x7204('0x28')](handleEntityNotFound(_0x31f7d0,null))['then'](removeEntity(_0x31f7d0,null))[_0x7204('0x45')](handleError(_0x31f7d0,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 98b8fdb..1160cb3 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 _0xc223=['request-promise','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','util','../../config/logger','api','moment','bluebird'];(function(_0x75813d,_0x13a7b5){var _0x2dd591=function(_0x227000){while(--_0x227000){_0x75813d['push'](_0x75813d['shift']());}};_0x2dd591(++_0x13a7b5);}(_0xc223,0xd8));var _0x3c22=function(_0x30a2e0,_0x4523c3){_0x30a2e0=_0x30a2e0-0x0;var _0x380648=_0xc223[_0x30a2e0];return _0x380648;};'use strict';var _=require('lodash');var util=require(_0x3c22('0x0'));var logger=require(_0x3c22('0x1'))(_0x3c22('0x2'));var moment=require(_0x3c22('0x3'));var BPromise=require(_0x3c22('0x4'));var rp=require(_0x3c22('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c22('0x6'));var config=require(_0x3c22('0x7'));var attributes=require(_0x3c22('0x8'));module[_0x3c22('0x9')]=function(_0x31a21b,_0x5ba1e7){return _0x31a21b[_0x3c22('0xa')](_0x3c22('0xb'),attributes,{'tableName':_0x3c22('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x398d=['./variable.attributes','define','Variable','tools_variables','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x398d,0x148));var _0xd398=function(_0x247ca4,_0x1e7ec5){_0x247ca4=_0x247ca4-0x0;var _0x432c92=_0x398d[_0x247ca4];return _0x432c92;};'use strict';var _=require(_0xd398('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd398('0x1'));var moment=require(_0xd398('0x2'));var BPromise=require(_0xd398('0x3'));var rp=require(_0xd398('0x4'));var fs=require('fs');var path=require(_0xd398('0x5'));var rimraf=require(_0xd398('0x6'));var config=require(_0xd398('0x7'));var attributes=require(_0xd398('0x8'));module['exports']=function(_0x1fae43,_0x2f07c1){return _0x1fae43[_0xd398('0x9')](_0xd398('0xa'),attributes,{'tableName':_0xd398('0xb'),'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 d400b0c..1e82223 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 _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x52ecef,_0xd1f716){var _0x352b04=function(_0x55ec80){while(--_0x55ec80){_0x52ecef['push'](_0x52ecef['shift']());}};_0x352b04(++_0xd1f716);}(_0xf494,0x1c6));var _0x4f49=function(_0x336de0,_0x50b920){_0x336de0=_0x336de0-0x0;var _0x4872f7=_0xf494[_0x336de0];return _0x4872f7;};'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);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file +var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x25981f,_0x392e24){var _0x2aacbf=function(_0x81d4d5){while(--_0x81d4d5){_0x25981f['push'](_0x25981f['shift']());}};_0x2aacbf(++_0x392e24);}(_0x1cb9,0x14e));var _0x91cb=function(_0x16f030,_0x3d1b51){_0x16f030=_0x16f030-0x0;var _0x296452=_0x1cb9[_0x16f030];return _0x296452;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 95466fb..083adc9 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 _0x685e=['reset','pull','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','isAuthenticated','canUpdate','fetch','/reset'];(function(_0x112bc0,_0x1dc182){var _0x580244=function(_0x93c9d2){while(--_0x93c9d2){_0x112bc0['push'](_0x112bc0['shift']());}};_0x580244(++_0x1dc182);}(_0x685e,0x18b));var _0xe685=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x685e[_0x4cbf20];return _0x582ae4;};'use strict';var express=require(_0xe685('0x0'));var router=express[_0xe685('0x1')]();var auth=require(_0xe685('0x2'));var controller=require(_0xe685('0x3'));router[_0xe685('0x4')]('/',controller[_0xe685('0x5')]);router[_0xe685('0x4')]('/fetch',auth[_0xe685('0x6')](),auth[_0xe685('0x7')](),controller[_0xe685('0x8')]);router[_0xe685('0x4')](_0xe685('0x9'),auth[_0xe685('0x6')](),auth['canUpdate'](),controller[_0xe685('0xa')]);router[_0xe685('0x4')]('/pull',auth[_0xe685('0x6')](),auth[_0xe685('0x7')](),controller[_0xe685('0xb')]);router['get']('/restart',auth[_0xe685('0x6')](),controller[_0xe685('0xc')]);router['get']('/migrations',controller[_0xe685('0xd')]);module[_0xe685('0xe')]=router; \ No newline at end of file +var _0xae3a=['migrations','express','Router','../../components/auth/service','./version.controller','index','get','/fetch','isAuthenticated','canUpdate','fetch','reset','/pull','pull','/restart','restart','/migrations'];(function(_0x1e91eb,_0x5829a3){var _0x2af75a=function(_0x1815d1){while(--_0x1815d1){_0x1e91eb['push'](_0x1e91eb['shift']());}};_0x2af75a(++_0x5829a3);}(_0xae3a,0x133));var _0xaae3=function(_0x4fdc26,_0x5765b4){_0x4fdc26=_0x4fdc26-0x0;var _0x3df58f=_0xae3a[_0x4fdc26];return _0x3df58f;};'use strict';var express=require(_0xaae3('0x0'));var router=express[_0xaae3('0x1')]();var auth=require(_0xaae3('0x2'));var controller=require(_0xaae3('0x3'));router['get']('/',controller[_0xaae3('0x4')]);router[_0xaae3('0x5')](_0xaae3('0x6'),auth[_0xaae3('0x7')](),auth[_0xaae3('0x8')](),controller[_0xaae3('0x9')]);router[_0xaae3('0x5')]('/reset',auth[_0xaae3('0x7')](),auth[_0xaae3('0x8')](),controller[_0xaae3('0xa')]);router['get'](_0xaae3('0xb'),auth['isAuthenticated'](),auth[_0xaae3('0x8')](),controller[_0xaae3('0xc')]);router[_0xaae3('0x5')](_0xaae3('0xd'),auth[_0xaae3('0x7')](),controller[_0xaae3('0xe')]);router[_0xaae3('0x5')](_0xaae3('0xf'),controller[_0xaae3('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 3103d60..ce14eae 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 _0xc8e3=['catch','migrations','readdirSync','join','server','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','constructor','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','query','tags','latest','exports','2.0.0','json','status','fetch','origin','error','git\x20fetch\x20origin\x20master','reset','--hard','info','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully'];(function(_0x3339a9,_0x23a3da){var _0x4ab9d5=function(_0x2aebca){while(--_0x2aebca){_0x3339a9['push'](_0x3339a9['shift']());}};_0x4ab9d5(++_0x23a3da);}(_0xc8e3,0x157));var _0x3c8e=function(_0x40419b,_0x5cbb00){_0x40419b=_0x40419b-0x0;var _0x1b5fa1=_0xc8e3[_0x40419b];return _0x1b5fa1;};'use strict';var Umzug=require(_0x3c8e('0x0'));var path=require(_0x3c8e('0x1'));var fs=require('fs');var _=require(_0x3c8e('0x2'));var pkginfo=require(_0x3c8e('0x3'))(module,_0x3c8e('0x4'));var compareVersions=require(_0x3c8e('0x5'));var exec=require(_0x3c8e('0x6'))[_0x3c8e('0x7')];var db=require(_0x3c8e('0x8'))['db'];var config=require(_0x3c8e('0x9'));var pm2=require(_0x3c8e('0xa'));var logger=require(_0x3c8e('0xb'))('update');var git=require(_0x3c8e('0xc'))(config[_0x3c8e('0xd')]);exports[_0x3c8e('0xe')]=function(_0x47e8bc,_0x319d88){var _0x3d3fa4={'current':module['exports'][_0x3c8e('0x4')],'phonebar':0x2};if(_0x47e8bc[_0x3c8e('0xf')]&&_0x47e8bc[_0x3c8e('0xf')]['latest']){return git['fetch']()[_0x3c8e('0x10')](function(_0x595f11,_0x367a32){_0x3d3fa4[_0x3c8e('0x11')]=(_0x595f11?module[_0x3c8e('0x12')]['version']:_0x367a32[_0x3c8e('0x11')])||_0x3c8e('0x13');return _0x319d88['status'](0xc8)[_0x3c8e('0x14')](_0x3d3fa4);});}else{return _0x319d88[_0x3c8e('0x15')](0xc8)[_0x3c8e('0x14')](_0x3d3fa4);}};exports['fetch']=function(_0x300c0b,_0x41c928){return git[_0x3c8e('0x16')]([_0x3c8e('0x17'),'master'],function(_0x860ee5){if(_0x860ee5){logger[_0x3c8e('0x18')](_0x860ee5);return _0x41c928['status'](0x1f4)[_0x3c8e('0x14')](_0x860ee5);}logger['info']('git\x20fetch');return _0x41c928['status'](0xc8)['json']({'output':_0x3c8e('0x19')});});};exports['reset']=function(_0x28ae3f,_0x1ea74b){return git[_0x3c8e('0x1a')]([_0x3c8e('0x1b'),'FETCH_HEAD'],function(_0x44a1e2){if(_0x44a1e2){logger['error'](_0x44a1e2);return _0x1ea74b[_0x3c8e('0x15')](0x1f4)['json'](_0x44a1e2);}logger[_0x3c8e('0x1c')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x1ea74b[_0x3c8e('0x15')](0xc8)[_0x3c8e('0x14')]({'output':_0x3c8e('0x1d')});});};exports['pull']=function(_0x59c750,_0x3dc0d9){exec(_0x3c8e('0x1e'),function(_0x5727af,_0x584a24,_0x1b753c){logger['info'](_0x584a24);logger[_0x3c8e('0x1c')](_0x1b753c);if(_0x5727af){logger[_0x3c8e('0x18')](_0x5727af);return _0x3dc0d9[_0x3c8e('0x15')](0x1f4)[_0x3c8e('0x14')](_0x5727af);}return _0x3dc0d9[_0x3c8e('0x15')](0xc8)[_0x3c8e('0x14')]({'output':_0x584a24});});};exports[_0x3c8e('0x1f')]=function(_0x5d41ca,_0x5cefc4){return pm2[_0x3c8e('0x1f')](_0x3c8e('0x20'))[_0x3c8e('0x21')](function(_0x7fb541){logger[_0x3c8e('0x1c')]('pm2\x20restart\x20motion\x20%s',_0x7fb541);return _0x5cefc4[_0x3c8e('0x15')](0xc8)[_0x3c8e('0x14')]({'output':_0x3c8e('0x22')});})[_0x3c8e('0x23')](function(_0x158f5e){logger[_0x3c8e('0x18')](_0x158f5e);return _0x5cefc4[_0x3c8e('0x15')](0x1f4)[_0x3c8e('0x14')](_0x158f5e);});};exports[_0x3c8e('0x24')]=function(_0x4054a9,_0xe218f0){var _0x38d7ca=fs[_0x3c8e('0x25')](path[_0x3c8e('0x26')](config[_0x3c8e('0xd')],_0x3c8e('0x27'),_0x3c8e('0x24')));var _0x3b8d0b=[];for(var _0x5a3ac1=0x0;_0x5a3ac1<_0x38d7ca['length'];_0x5a3ac1++){var _0x540687=_0x38d7ca[_0x5a3ac1][_0x3c8e('0x28')](_0x3c8e('0x29'),'');if(compareVersions(module[_0x3c8e('0x12')][_0x3c8e('0x4')],_0x540687)===-0x1){_0x3b8d0b[_0x3c8e('0x2a')](_0x540687);}}if(_0x3b8d0b[_0x3c8e('0x2b')]){var _0x1ed072=_0x3b8d0b[_0x3c8e('0x2c')](compareVersions);var _0x1fe48f=new Umzug({'storage':_0x3c8e('0x2d'),'storageOptions':{'model':db['Migration'],'modelName':_0x3c8e('0x2e'),'columnName':_0x3c8e('0x4')},'migrations':{'params':[db['sequelize'][_0x3c8e('0x2f')](),db['sequelize'][_0x3c8e('0x30')],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[_0x3c8e('0x26')](config[_0x3c8e('0xd')],'server',_0x3c8e('0x24')),'pattern':/\.js$/}});_0x1fe48f['up']({'migrations':_['map'](_0x1ed072,function(_0x214d2f){return _0x214d2f+_0x3c8e('0x29');})})[_0x3c8e('0x21')](function(){return _0xe218f0[_0x3c8e('0x15')](0xc8)[_0x3c8e('0x14')]({'output':_0x3c8e('0x31')+module[_0x3c8e('0x12')]['version']+_0x3c8e('0x32')+_[_0x3c8e('0x33')](_0x1ed072),'migrations':_['join'](_0x1ed072)});})[_0x3c8e('0x23')](function(_0xf59e36){if(_0xf59e36 instanceof db[_0x3c8e('0x2d')][_0x3c8e('0x34')]){return _0xe218f0[_0x3c8e('0x15')](0xc8)[_0x3c8e('0x14')]({'output':_0x3c8e('0x35')});}else{return _0xe218f0['status'](0x1f4)[_0x3c8e('0x14')](_0xf59e36);}});}else{return _0xe218f0[_0x3c8e('0x15')](0xc8)[_0x3c8e('0x14')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x522b=['git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','server','length','replace','push','sort','sequelize','Migration','constructor','map','then','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','update','root','index','exports','query','latest','fetch','tags','2.0.0','json','status','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD'];(function(_0x21cbaa,_0x5d585b){var _0x19180f=function(_0x70cd7e){while(--_0x70cd7e){_0x21cbaa['push'](_0x21cbaa['shift']());}};_0x19180f(++_0x5d585b);}(_0x522b,0x1d2));var _0xb522=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0x522b[_0x14476b];return _0x24e2e8;};'use strict';var Umzug=require(_0xb522('0x0'));var path=require(_0xb522('0x1'));var fs=require('fs');var _=require(_0xb522('0x2'));var pkginfo=require(_0xb522('0x3'))(module,_0xb522('0x4'));var compareVersions=require(_0xb522('0x5'));var exec=require(_0xb522('0x6'))[_0xb522('0x7')];var db=require(_0xb522('0x8'))['db'];var config=require(_0xb522('0x9'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xb522('0xa'));var git=require('simple-git')(config[_0xb522('0xb')]);exports[_0xb522('0xc')]=function(_0x44d229,_0x3612b9){var _0x106d7e={'current':module[_0xb522('0xd')][_0xb522('0x4')],'phonebar':0x2};if(_0x44d229[_0xb522('0xe')]&&_0x44d229['query'][_0xb522('0xf')]){return git[_0xb522('0x10')]()[_0xb522('0x11')](function(_0x1fa927,_0x2e60b6){_0x106d7e['latest']=(_0x1fa927?module[_0xb522('0xd')][_0xb522('0x4')]:_0x2e60b6[_0xb522('0xf')])||_0xb522('0x12');return _0x3612b9['status'](0xc8)[_0xb522('0x13')](_0x106d7e);});}else{return _0x3612b9[_0xb522('0x14')](0xc8)[_0xb522('0x13')](_0x106d7e);}};exports['fetch']=function(_0x3803da,_0xfa3b99){return git[_0xb522('0x10')]([_0xb522('0x15'),_0xb522('0x16')],function(_0x5e0b10){if(_0x5e0b10){logger[_0xb522('0x17')](_0x5e0b10);return _0xfa3b99[_0xb522('0x14')](0x1f4)[_0xb522('0x13')](_0x5e0b10);}logger[_0xb522('0x18')](_0xb522('0x19'));return _0xfa3b99[_0xb522('0x14')](0xc8)[_0xb522('0x13')]({'output':_0xb522('0x1a')});});};exports[_0xb522('0x1b')]=function(_0x3e15b2,_0x2bf77d){return git[_0xb522('0x1b')](['--hard',_0xb522('0x1c')],function(_0x452a71){if(_0x452a71){logger[_0xb522('0x17')](_0x452a71);return _0x2bf77d[_0xb522('0x14')](0x1f4)[_0xb522('0x13')](_0x452a71);}logger['info'](_0xb522('0x1d'));return _0x2bf77d[_0xb522('0x14')](0xc8)[_0xb522('0x13')]({'output':_0xb522('0x1e')});});};exports[_0xb522('0x1f')]=function(_0x70f66d,_0x3dbf9e){exec('npm\x20install\x20--production',function(_0x21cd74,_0x2d30ec,_0x1bf9a9){logger[_0xb522('0x18')](_0x2d30ec);logger[_0xb522('0x18')](_0x1bf9a9);if(_0x21cd74){logger['error'](_0x21cd74);return _0x3dbf9e[_0xb522('0x14')](0x1f4)[_0xb522('0x13')](_0x21cd74);}return _0x3dbf9e[_0xb522('0x14')](0xc8)[_0xb522('0x13')]({'output':_0x2d30ec});});};exports[_0xb522('0x20')]=function(_0x57ddb6,_0x151558){return pm2[_0xb522('0x20')](_0xb522('0x21'))['then'](function(_0xf4887c){logger[_0xb522('0x18')](_0xb522('0x22'),_0xf4887c);return _0x151558[_0xb522('0x14')](0xc8)[_0xb522('0x13')]({'output':_0xb522('0x23')});})[_0xb522('0x24')](function(_0x32872a){logger['error'](_0x32872a);return _0x151558['status'](0x1f4)[_0xb522('0x13')](_0x32872a);});};exports[_0xb522('0x25')]=function(_0x277862,_0x1e8e95){var _0x3c8c7c=fs[_0xb522('0x26')](path[_0xb522('0x27')](config[_0xb522('0xb')],_0xb522('0x28'),_0xb522('0x25')));var _0x4cd76e=[];for(var _0x142e44=0x0;_0x142e44<_0x3c8c7c[_0xb522('0x29')];_0x142e44++){var _0x4f8049=_0x3c8c7c[_0x142e44][_0xb522('0x2a')]('.js','');if(compareVersions(module[_0xb522('0xd')][_0xb522('0x4')],_0x4f8049)===-0x1){_0x4cd76e[_0xb522('0x2b')](_0x4f8049);}}if(_0x4cd76e['length']){var _0x44e733=_0x4cd76e[_0xb522('0x2c')](compareVersions);var _0x5929ba=new Umzug({'storage':_0xb522('0x2d'),'storageOptions':{'model':db[_0xb522('0x2e')],'modelName':'Migration','columnName':_0xb522('0x4')},'migrations':{'params':[db[_0xb522('0x2d')]['getQueryInterface'](),db[_0xb522('0x2d')][_0xb522('0x2f')],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[_0xb522('0x27')](config[_0xb522('0xb')],'server',_0xb522('0x25')),'pattern':/\.js$/}});_0x5929ba['up']({'migrations':_[_0xb522('0x30')](_0x44e733,function(_0x387615){return _0x387615+'.js';})})[_0xb522('0x31')](function(){return _0x1e8e95['status'](0xc8)['json']({'output':_0xb522('0x32')+module[_0xb522('0xd')]['version']+_0xb522('0x33')+_[_0xb522('0x34')](_0x44e733),'migrations':_['join'](_0x44e733)});})[_0xb522('0x24')](function(_0x3aa14a){if(_0x3aa14a instanceof db[_0xb522('0x2d')][_0xb522('0x35')]){return _0x1e8e95[_0xb522('0x14')](0xc8)[_0xb522('0x13')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x1e8e95[_0xb522('0x14')](0x1f4)['json'](_0x3aa14a);}});}else{return _0x1e8e95[_0xb522('0x14')](0xc8)['json']({'output':_0xb522('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index afedeb8..3d6eb87 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 _0x70b4=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x26de67,_0x3f455e){var _0x1e8078=function(_0x4759dc){while(--_0x4759dc){_0x26de67['push'](_0x26de67['shift']());}};_0x1e8078(++_0x3f455e);}(_0x70b4,0x146));var _0x470b=function(_0xd5f3ac,_0x5a575a){_0xd5f3ac=_0xd5f3ac-0x0;var _0x38aed8=_0x70b4[_0xd5f3ac];return _0x38aed8;};'use strict';var multer=require(_0x470b('0x0'));var util=require(_0x470b('0x1'));var path=require(_0x470b('0x2'));var timeout=require(_0x470b('0x3'));var express=require(_0x470b('0x4'));var router=express[_0x470b('0x5')]();var fs_extra=require(_0x470b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x470b('0x7'));var config=require(_0x470b('0x8'));var controller=require(_0x470b('0x9'));router[_0x470b('0xa')]('/',auth[_0x470b('0xb')](),controller['index']);router[_0x470b('0xa')](_0x470b('0xc'),auth[_0x470b('0xb')](),controller[_0x470b('0xd')]);router[_0x470b('0xa')]('/:id',auth[_0x470b('0xb')](),controller[_0x470b('0xe')]);router[_0x470b('0xf')]('/',auth[_0x470b('0xb')](),controller['create']);router[_0x470b('0x10')](_0x470b('0x11'),auth[_0x470b('0xb')](),controller[_0x470b('0x12')]);router[_0x470b('0x13')]('/:id',auth[_0x470b('0xb')](),controller[_0x470b('0x14')]);module[_0x470b('0x15')]=router; \ No newline at end of file +var _0x311a=['/describe','describe','/:id','show','put','update','delete','exports','multer','connect-timeout','fs-extra','../../components/interaction/service','./voiceAgentReport.controller','get','isAuthenticated'];(function(_0x2212d1,_0x483fc8){var _0x15eec5=function(_0x15e6ac){while(--_0x15e6ac){_0x2212d1['push'](_0x2212d1['shift']());}};_0x15eec5(++_0x483fc8);}(_0x311a,0x116));var _0xa311=function(_0x5b95ab,_0x4e9fba){_0x5b95ab=_0x5b95ab-0x0;var _0x28033f=_0x311a[_0x5b95ab];return _0x28033f;};'use strict';var multer=require(_0xa311('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa311('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa311('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xa311('0x3'));var config=require('../../config/environment');var controller=require(_0xa311('0x4'));router[_0xa311('0x5')]('/',auth[_0xa311('0x6')](),controller['index']);router[_0xa311('0x5')](_0xa311('0x7'),auth[_0xa311('0x6')](),controller[_0xa311('0x8')]);router[_0xa311('0x5')](_0xa311('0x9'),auth['isAuthenticated'](),controller[_0xa311('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa311('0xb')]('/:id',auth[_0xa311('0x6')](),controller[_0xa311('0xc')]);router[_0xa311('0xd')]('/:id',auth[_0xa311('0x6')](),controller['destroy']);module[_0xa311('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 19a65aa..edd440f 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 _0x1131=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','exports'];(function(_0x5b6ff9,_0x1205d1){var _0x4b034a=function(_0x47012d){while(--_0x47012d){_0x5b6ff9['push'](_0x5b6ff9['shift']());}};_0x4b034a(++_0x1205d1);}(_0x1131,0x71));var _0x1113=function(_0x1cd18e,_0x4d3c57){_0x1cd18e=_0x1cd18e-0x0;var _0x347dc6=_0x1131[_0x1cd18e];return _0x347dc6;};'use strict';var Sequelize=require('sequelize');module[_0x1113('0x0')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x1113('0x1')]},'queue':{'type':Sequelize[_0x1113('0x1')]},'interface':{'type':Sequelize[_0x1113('0x1')]},'membername':{'type':Sequelize[_0x1113('0x1')]},'agentcalledAt':{'type':Sequelize[_0x1113('0x2')]},'agentconnectAt':{'type':Sequelize[_0x1113('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x1113('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x1113('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x1113('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x1113('0x3')]},'agentacw':{'type':Sequelize[_0x1113('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x1113('0x3')]},'reason':{'type':Sequelize[_0x1113('0x1')]},'lastevent':{'type':Sequelize[_0x1113('0x1')]},'channel':{'type':Sequelize[_0x1113('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1113('0x1')]},'connectedlinename':{'type':Sequelize[_0x1113('0x1')]},'language':{'type':Sequelize[_0x1113('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x1113('0x1')]},'exten':{'type':Sequelize[_0x1113('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x1113('0x1')]},'destchannelstate':{'type':Sequelize[_0x1113('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x1113('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1113('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x1113('0x1')]},'destcontext':{'type':Sequelize[_0x1113('0x1')]},'destexten':{'type':Sequelize[_0x1113('0x1')]},'destpriority':{'type':Sequelize[_0x1113('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x1113('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x1113('0x1')]},'transfer':{'type':Sequelize[_0x1113('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x1113('0x1')],'comment':_0x1113('0x5')},'transferexten':{'type':Sequelize[_0x1113('0x1')]},'transferuniqueid':{'type':Sequelize[_0x1113('0x1')]},'agententerreason':{'type':Sequelize[_0x1113('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x02ce=['INTEGER','BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x7e3bb8,_0x27c048){var _0x44c887=function(_0x55d7c6){while(--_0x55d7c6){_0x7e3bb8['push'](_0x7e3bb8['shift']());}};_0x44c887(++_0x27c048);}(_0x02ce,0x1ac));var _0xe02c=function(_0x5d005c,_0x4bfadf){_0x5d005c=_0x5d005c-0x0;var _0xbee243=_0x02ce[_0x5d005c];return _0xbee243;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'type':{'type':Sequelize[_0xe02c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe02c('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xe02c('0x2')]},'interface':{'type':Sequelize[_0xe02c('0x2')]},'membername':{'type':Sequelize[_0xe02c('0x2')]},'agentcalledAt':{'type':Sequelize[_0xe02c('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe02c('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xe02c('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xe02c('0x3')]},'agentdumpAt':{'type':Sequelize[_0xe02c('0x3')]},'holdtime':{'type':Sequelize[_0xe02c('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xe02c('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xe02c('0x4')]},'agentacw':{'type':Sequelize[_0xe02c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xe02c('0x4')]},'reason':{'type':Sequelize[_0xe02c('0x2')]},'lastevent':{'type':Sequelize[_0xe02c('0x2')]},'channel':{'type':Sequelize[_0xe02c('0x2')]},'channelstate':{'type':Sequelize[_0xe02c('0x4')]},'channelstatedesc':{'type':Sequelize[_0xe02c('0x2')]},'connectedlinenum':{'type':Sequelize[_0xe02c('0x2')]},'connectedlinename':{'type':Sequelize[_0xe02c('0x2')]},'language':{'type':Sequelize[_0xe02c('0x2')]},'accountcode':{'type':Sequelize[_0xe02c('0x2')]},'context':{'type':Sequelize[_0xe02c('0x2')]},'exten':{'type':Sequelize[_0xe02c('0x2')]},'priority':{'type':Sequelize[_0xe02c('0x2')]},'destchannel':{'type':Sequelize[_0xe02c('0x2')]},'destchannelstate':{'type':Sequelize[_0xe02c('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xe02c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xe02c('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xe02c('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xe02c('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xe02c('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xe02c('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xe02c('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xe02c('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xe02c('0x2')]},'transferuniqueid':{'type':Sequelize[_0xe02c('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 1312d39..a4fa6be 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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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 417c93b..3aadfdc 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 _0xf767=['destuniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent'];(function(_0xe0e3d0,_0x3eabd9){var _0x4a7f63=function(_0x15754d){while(--_0x15754d){_0xe0e3d0['push'](_0xe0e3d0['shift']());}};_0x4a7f63(++_0x3eabd9);}(_0xf767,0x76));var _0x7f76=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0xf767[_0x50e40b];return _0x2608b7;};'use strict';var _=require('lodash');var util=require(_0x7f76('0x0'));var logger=require(_0x7f76('0x1'))(_0x7f76('0x2'));var moment=require(_0x7f76('0x3'));var BPromise=require(_0x7f76('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7f76('0x5'));var rimraf=require(_0x7f76('0x6'));var config=require(_0x7f76('0x7'));var attributes=require(_0x7f76('0x8'));module['exports']=function(_0x23c243,_0x2f2588){return _0x23c243[_0x7f76('0x9')](_0x7f76('0xa'),attributes,{'tableName':_0x7f76('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x7f76('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e17=['path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3155a6,_0x12d4b2){var _0x1640cd=function(_0x209f42){while(--_0x209f42){_0x3155a6['push'](_0x3155a6['shift']());}};_0x1640cd(++_0x12d4b2);}(_0x0e17,0xd6));var _0x70e1=function(_0x1259fb,_0x2d808e){_0x1259fb=_0x1259fb-0x0;var _0x36d772=_0x0e17[_0x1259fb];return _0x36d772;};'use strict';var _=require(_0x70e1('0x0'));var util=require(_0x70e1('0x1'));var logger=require(_0x70e1('0x2'))(_0x70e1('0x3'));var moment=require(_0x70e1('0x4'));var BPromise=require(_0x70e1('0x5'));var rp=require(_0x70e1('0x6'));var fs=require('fs');var path=require(_0x70e1('0x7'));var rimraf=require(_0x70e1('0x8'));var config=require(_0x70e1('0x9'));var attributes=require(_0x70e1('0xa'));module[_0x70e1('0xb')]=function(_0x4cb0b1,_0xc64213){return _0x4cb0b1[_0x70e1('0xc')](_0x70e1('0xd'),attributes,{'tableName':_0x70e1('0xe'),'paranoid':![],'indexes':[{'fields':[_0x70e1('0xf'),_0x70e1('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index c01a4b5..c239caf 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 _0x5fc8=['error','code','message','info','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','limit','then','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xcb8bc9,_0x1614a0){var _0x82e5cb=function(_0x58eb52){while(--_0x58eb52){_0xcb8bc9['push'](_0xcb8bc9['shift']());}};_0x82e5cb(++_0x1614a0);}(_0x5fc8,0x129));var _0x85fc=function(_0x10a31f,_0x4510f2){_0x10a31f=_0x10a31f-0x0;var _0x2487db=_0x5fc8[_0x10a31f];return _0x2487db;};'use strict';var _=require(_0x85fc('0x0'));var util=require('util');var moment=require(_0x85fc('0x1'));var BPromise=require(_0x85fc('0x2'));var rs=require(_0x85fc('0x3'));var fs=require('fs');var Redis=require(_0x85fc('0x4'));var db=require(_0x85fc('0x5'))['db'];var utils=require(_0x85fc('0x6'));var logger=require('../../config/logger')(_0x85fc('0x7'));var config=require(_0x85fc('0x8'));var jayson=require(_0x85fc('0x9'));var client=jayson[_0x85fc('0xa')][_0x85fc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45f6da,_0x43a5da,_0x188ed9){return new BPromise(function(_0x287b66,_0x54de10){return client[_0x85fc('0xc')](_0x45f6da,_0x188ed9)['then'](function(_0x532b25){logger['info'](_0x85fc('0xd'),_0x43a5da,_0x85fc('0xe'));logger[_0x85fc('0xf')](_0x85fc('0x10'),_0x43a5da,_0x85fc('0xe'),JSON[_0x85fc('0x11')](_0x532b25));if(_0x532b25[_0x85fc('0x12')]){if(_0x532b25['error'][_0x85fc('0x13')]===0x1f4){logger[_0x85fc('0x12')](_0x85fc('0xd'),_0x43a5da,_0x532b25[_0x85fc('0x12')]['message']);return _0x54de10(_0x532b25[_0x85fc('0x12')]['message']);}logger[_0x85fc('0x12')](_0x85fc('0xd'),_0x43a5da,_0x532b25['error'][_0x85fc('0x14')]);return _0x287b66(_0x532b25[_0x85fc('0x12')][_0x85fc('0x14')]);}else{logger[_0x85fc('0x15')]('VoiceAgentReport,\x20%s,\x20%s',_0x43a5da,_0x85fc('0xe'));_0x287b66(_0x532b25[_0x85fc('0x16')]['message']);}})['catch'](function(_0x33ff2e){logger['error'](_0x85fc('0xd'),_0x43a5da,_0x33ff2e);_0x54de10(_0x33ff2e);});});}exports[_0x85fc('0x17')]=function(_0x387e06){var _0x2bc126=this;return new Promise(function(_0x442275,_0x24eb60){return db[_0x85fc('0x18')][_0x85fc('0x19')](_0x387e06[_0x85fc('0x1a')],{'raw':_0x387e06[_0x85fc('0x1b')]?_0x387e06[_0x85fc('0x1b')][_0x85fc('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4fd4d0){logger[_0x85fc('0x15')](_0x85fc('0x17'),_0x387e06);logger[_0x85fc('0xf')]('CreateVoiceAgentReport',_0x387e06,JSON[_0x85fc('0x11')](_0x4fd4d0));_0x442275(_0x4fd4d0);})['catch'](function(_0x3025bb){logger[_0x85fc('0x12')]('CreateVoiceAgentReport',_0x3025bb[_0x85fc('0x14')],_0x387e06);_0x24eb60(_0x2bc126[_0x85fc('0x12')](0x1f4,_0x3025bb[_0x85fc('0x14')]));});});};exports[_0x85fc('0x1d')]=function(_0x226859){var _0x5e81c2=this;return new Promise(function(_0x46a781,_0x5d2689){return db[_0x85fc('0x18')][_0x85fc('0x1e')](_0x226859[_0x85fc('0x1a')],{'raw':_0x226859[_0x85fc('0x1b')]?_0x226859[_0x85fc('0x1b')][_0x85fc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x226859['options']?_0x226859[_0x85fc('0x1b')][_0x85fc('0x1f')]||null:null,'attributes':_0x226859[_0x85fc('0x1b')]?_0x226859[_0x85fc('0x1b')]['attributes']||null:null,'limit':_0x226859[_0x85fc('0x1b')]?_0x226859[_0x85fc('0x1b')][_0x85fc('0x20')]||null:null})[_0x85fc('0x21')](function(_0x2cff8b){logger[_0x85fc('0x15')](_0x85fc('0x1d'),_0x226859);logger['debug']('UpdateVoiceAgentReport',_0x226859,JSON[_0x85fc('0x11')](_0x2cff8b));_0x46a781(_0x2cff8b);})[_0x85fc('0x22')](function(_0x441d24){logger[_0x85fc('0x12')](_0x85fc('0x1d'),_0x441d24[_0x85fc('0x14')],_0x226859);_0x5d2689(_0x5e81c2[_0x85fc('0x12')](0x1f4,_0x441d24['message']));});});}; \ No newline at end of file +var _0x4859=['where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','UpdateVoiceAgentReport','update','raw'];(function(_0x190417,_0x54dc0d){var _0x110e9c=function(_0x517b86){while(--_0x517b86){_0x190417['push'](_0x190417['shift']());}};_0x110e9c(++_0x54dc0d);}(_0x4859,0x184));var _0x9485=function(_0x1f924d,_0xbb3d1b){_0x1f924d=_0x1f924d-0x0;var _0x3cf44f=_0x4859[_0x1f924d];return _0x3cf44f;};'use strict';var _=require(_0x9485('0x0'));var util=require('util');var moment=require(_0x9485('0x1'));var BPromise=require(_0x9485('0x2'));var rs=require(_0x9485('0x3'));var fs=require('fs');var Redis=require(_0x9485('0x4'));var db=require(_0x9485('0x5'))['db'];var utils=require(_0x9485('0x6'));var logger=require(_0x9485('0x7'))('rpc');var config=require(_0x9485('0x8'));var jayson=require(_0x9485('0x9'));var client=jayson[_0x9485('0xa')][_0x9485('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41a9d2,_0x369bf5,_0x27fea9){return new BPromise(function(_0x49380e,_0x31954f){return client['request'](_0x41a9d2,_0x27fea9)[_0x9485('0xc')](function(_0x2dd450){logger['info'](_0x9485('0xd'),_0x369bf5,_0x9485('0xe'));logger[_0x9485('0xf')](_0x9485('0x10'),_0x369bf5,'request\x20sent',JSON[_0x9485('0x11')](_0x2dd450));if(_0x2dd450[_0x9485('0x12')]){if(_0x2dd450[_0x9485('0x12')][_0x9485('0x13')]===0x1f4){logger[_0x9485('0x12')](_0x9485('0xd'),_0x369bf5,_0x2dd450[_0x9485('0x12')][_0x9485('0x14')]);return _0x31954f(_0x2dd450[_0x9485('0x12')][_0x9485('0x14')]);}logger[_0x9485('0x12')](_0x9485('0xd'),_0x369bf5,_0x2dd450['error']['message']);return _0x49380e(_0x2dd450[_0x9485('0x12')][_0x9485('0x14')]);}else{logger[_0x9485('0x15')]('VoiceAgentReport,\x20%s,\x20%s',_0x369bf5,'request\x20sent');_0x49380e(_0x2dd450[_0x9485('0x16')][_0x9485('0x14')]);}})[_0x9485('0x17')](function(_0xc9c9b2){logger[_0x9485('0x12')](_0x9485('0xd'),_0x369bf5,_0xc9c9b2);_0x31954f(_0xc9c9b2);});});}exports[_0x9485('0x18')]=function(_0x58ff97){var _0x4f1cec=this;return new Promise(function(_0x2c9fc1,_0x39ea66){return db[_0x9485('0x19')][_0x9485('0x1a')](_0x58ff97[_0x9485('0x1b')],{'raw':_0x58ff97[_0x9485('0x1c')]?_0x58ff97['options']['raw']===undefined?!![]:![]:!![]})[_0x9485('0xc')](function(_0x59c8ac){logger['info'](_0x9485('0x18'),_0x58ff97);logger[_0x9485('0xf')](_0x9485('0x18'),_0x58ff97,JSON[_0x9485('0x11')](_0x59c8ac));_0x2c9fc1(_0x59c8ac);})[_0x9485('0x17')](function(_0x52bd37){logger['error'](_0x9485('0x18'),_0x52bd37[_0x9485('0x14')],_0x58ff97);_0x39ea66(_0x4f1cec['error'](0x1f4,_0x52bd37[_0x9485('0x14')]));});});};exports[_0x9485('0x1d')]=function(_0x32fc12){var _0x48c049=this;return new Promise(function(_0x380beb,_0x215a1c){return db['VoiceAgentReport'][_0x9485('0x1e')](_0x32fc12[_0x9485('0x1b')],{'raw':_0x32fc12['options']?_0x32fc12[_0x9485('0x1c')][_0x9485('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32fc12[_0x9485('0x1c')]?_0x32fc12[_0x9485('0x1c')][_0x9485('0x20')]||null:null,'attributes':_0x32fc12[_0x9485('0x1c')]?_0x32fc12[_0x9485('0x1c')][_0x9485('0x21')]||null:null,'limit':_0x32fc12[_0x9485('0x1c')]?_0x32fc12[_0x9485('0x1c')][_0x9485('0x22')]||null:null})[_0x9485('0xc')](function(_0x5e43a6){logger[_0x9485('0x15')](_0x9485('0x1d'),_0x32fc12);logger[_0x9485('0xf')](_0x9485('0x1d'),_0x32fc12,JSON['stringify'](_0x5e43a6));_0x380beb(_0x5e43a6);})[_0x9485('0x17')](function(_0x54af85){logger['error'](_0x9485('0x1d'),_0x54af85['message'],_0x32fc12);_0x215a1c(_0x48c049[_0x9485('0x12')](0x1f4,_0x54af85[_0x9485('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index fb092d8..13b42ce 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 _0xa630=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe'];(function(_0x910e6b,_0x3001af){var _0x2a5295=function(_0x196adf){while(--_0x196adf){_0x910e6b['push'](_0x910e6b['shift']());}};_0x2a5295(++_0x3001af);}(_0xa630,0xbe));var _0x0a63=function(_0x520c47,_0x5ad538){_0x520c47=_0x520c47-0x0;var _0x25f113=_0xa630[_0x520c47];return _0x25f113;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')]('/',auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0x12')]);module[_0x0a63('0x13')]=router; \ No newline at end of file +var _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xbd50,0x196));var _0x0bd5=function(_0x53bf73,_0x1ed39d){_0x53bf73=_0x53bf73-0x0;var _0x5b5e1a=_0xbd50[_0x53bf73];return _0x5b5e1a;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 6473831..994977c 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 _0xc234=['inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','exports','STRING','inbound','internal','outbound'];(function(_0x5b5c16,_0x511200){var _0x272eb2=function(_0x4553f5){while(--_0x4553f5){_0x5b5c16['push'](_0x5b5c16['shift']());}};_0x272eb2(++_0x511200);}(_0xc234,0x7f));var _0x4c23=function(_0xc44b8b,_0x38854d){_0xc44b8b=_0xc44b8b-0x0;var _0x35f6d8=_0xc234[_0xc44b8b];return _0x35f6d8;};'use strict';var Sequelize=require('sequelize');module[_0x4c23('0x0')]={'uniqueid':{'type':Sequelize[_0x4c23('0x1')]},'type':{'type':Sequelize['ENUM'](_0x4c23('0x2'),_0x4c23('0x3'),_0x4c23('0x4'),_0x4c23('0x5'),_0x4c23('0x6'),_0x4c23('0x7'))},'tag':{'type':Sequelize[_0x4c23('0x1')]},'accountcode':{'type':Sequelize[_0x4c23('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x4c23('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4c23('0x1')]},'channel':{'type':Sequelize[_0x4c23('0x1')]},'destinationchannel':{'type':Sequelize[_0x4c23('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x4c23('0x8')]},'starttime':{'type':Sequelize[_0x4c23('0x9')]},'systemanswertime':{'type':Sequelize[_0x4c23('0x9')]},'answertime':{'type':Sequelize[_0x4c23('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x4c23('0xa')]},'billableseconds':{'type':Sequelize[_0x4c23('0xa')]},'mohtime':{'type':Sequelize[_0x4c23('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x4c23('0x1')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x4c23('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x4c23('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x4c23('0x1')]},'note':{'type':Sequelize[_0x4c23('0x1')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x4c23('0xa')]},'sipcallid':{'type':Sequelize[_0x4c23('0x1')]}}; \ No newline at end of file +var _0x96cf=['dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax'];(function(_0x1387eb,_0x5475e3){var _0x3265eb=function(_0x182b89){while(--_0x182b89){_0x1387eb['push'](_0x1387eb['shift']());}};_0x3265eb(++_0x5475e3);}(_0x96cf,0x7a));var _0xf96c=function(_0x2abe62,_0x284360){_0x2abe62=_0x2abe62-0x0;var _0x35ba4c=_0x96cf[_0x2abe62];return _0x35ba4c;};'use strict';var Sequelize=require(_0xf96c('0x0'));module[_0xf96c('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf96c('0x2')](_0xf96c('0x3'),_0xf96c('0x4'),_0xf96c('0x5'),_0xf96c('0x6'),_0xf96c('0x7'),_0xf96c('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xf96c('0x9')]},'destination':{'type':Sequelize[_0xf96c('0x9')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xf96c('0x9')]},'channel':{'type':Sequelize[_0xf96c('0x9')]},'destinationchannel':{'type':Sequelize[_0xf96c('0x9')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xf96c('0xa')]},'starttime':{'type':Sequelize[_0xf96c('0xb')]},'systemanswertime':{'type':Sequelize[_0xf96c('0xb')]},'answertime':{'type':Sequelize[_0xf96c('0xb')]},'endtime':{'type':Sequelize[_0xf96c('0xb')]},'duration':{'type':Sequelize[_0xf96c('0xc')]},'billableseconds':{'type':Sequelize[_0xf96c('0xc')]},'mohtime':{'type':Sequelize[_0xf96c('0xc')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf96c('0x9')]},'amaflags':{'type':Sequelize[_0xf96c('0x9')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xf96c('0x9')]},'userSecondDisposition':{'type':Sequelize[_0xf96c('0x9')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf96c('0x9')]},'prefix':{'type':Sequelize[_0xf96c('0x9')]},'routeid':{'type':Sequelize[_0xf96c('0xc')]},'sipcallid':{'type':Sequelize[_0xf96c('0x9')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 58fb8ae..3b729fb 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 _0x5f66=['../../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','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','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'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'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')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x432668,_0x42dc82){_0x432668=_0x432668-0x0;var _0x45e99b=_0x2032[_0x432668];return _0x45e99b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 3deb14d..a0cd11f 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 _0x85c2=['uniqueid','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','define','VoiceCallReport'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x85c2,0x1f0));var _0x285c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x85c2[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x285c('0x0'));var util=require('util');var logger=require(_0x285c('0x1'))('api');var moment=require(_0x285c('0x2'));var BPromise=require('bluebird');var rp=require(_0x285c('0x3'));var fs=require('fs');var path=require(_0x285c('0x4'));var rimraf=require(_0x285c('0x5'));var config=require(_0x285c('0x6'));var attributes=require(_0x285c('0x7'));module['exports']=function(_0x315849,_0x2e0c74){return _0x315849[_0x285c('0x8')](_0x285c('0x9'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x285c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee3=['VoiceCallReport','report_call','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x14e0d1,_0x15dd5a){var _0x453de6=function(_0x49717b){while(--_0x49717b){_0x14e0d1['push'](_0x14e0d1['shift']());}};_0x453de6(++_0x15dd5a);}(_0x7ee3,0xf3));var _0x37ee=function(_0x3fa1e1,_0x4e39f0){_0x3fa1e1=_0x3fa1e1-0x0;var _0x1cc2ad=_0x7ee3[_0x3fa1e1];return _0x1cc2ad;};'use strict';var _=require('lodash');var util=require(_0x37ee('0x0'));var logger=require(_0x37ee('0x1'))(_0x37ee('0x2'));var moment=require(_0x37ee('0x3'));var BPromise=require(_0x37ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37ee('0x5'));var rimraf=require(_0x37ee('0x6'));var config=require(_0x37ee('0x7'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x51f200,_0x5383d4){return _0x51f200[_0x37ee('0x8')](_0x37ee('0x9'),attributes,{'tableName':_0x37ee('0xa'),'paranoid':![],'indexes':[{'fields':[_0x37ee('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index a46e7c4..b8d0297 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 _0x7f6c=['attributes','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','VoiceCallReport','update','where','limit','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','result','catch','findAll','options','raw','include','model'];(function(_0x4a7458,_0x5e0843){var _0x35226d=function(_0x13f47a){while(--_0x13f47a){_0x4a7458['push'](_0x4a7458['shift']());}};_0x35226d(++_0x5e0843);}(_0x7f6c,0x10d));var _0xc7f6=function(_0x274ec0,_0x1d3615){_0x274ec0=_0x274ec0-0x0;var _0x1af112=_0x7f6c[_0x274ec0];return _0x1af112;};'use strict';var _=require(_0xc7f6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc7f6('0x1'));var rs=require(_0xc7f6('0x2'));var fs=require('fs');var Redis=require(_0xc7f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7f6('0x4'));var logger=require(_0xc7f6('0x5'))(_0xc7f6('0x6'));var config=require(_0xc7f6('0x7'));var jayson=require(_0xc7f6('0x8'));var client=jayson['client'][_0xc7f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ace99,_0x20dcab,_0x39f48e){return new BPromise(function(_0x3ce9c7,_0x358e4a){return client['request'](_0x2ace99,_0x39f48e)[_0xc7f6('0xa')](function(_0x4e8a9f){logger[_0xc7f6('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x20dcab,_0xc7f6('0xc'));logger[_0xc7f6('0xd')](_0xc7f6('0xe'),_0x20dcab,'request\x20sent',JSON[_0xc7f6('0xf')](_0x4e8a9f));if(_0x4e8a9f[_0xc7f6('0x10')]){if(_0x4e8a9f[_0xc7f6('0x10')][_0xc7f6('0x11')]===0x1f4){logger[_0xc7f6('0x10')](_0xc7f6('0x12'),_0x20dcab,_0x4e8a9f[_0xc7f6('0x10')][_0xc7f6('0x13')]);return _0x358e4a(_0x4e8a9f['error'][_0xc7f6('0x13')]);}logger[_0xc7f6('0x10')](_0xc7f6('0x12'),_0x20dcab,_0x4e8a9f[_0xc7f6('0x10')][_0xc7f6('0x13')]);return _0x3ce9c7(_0x4e8a9f[_0xc7f6('0x10')]['message']);}else{logger[_0xc7f6('0xb')](_0xc7f6('0x12'),_0x20dcab,'request\x20sent');_0x3ce9c7(_0x4e8a9f[_0xc7f6('0x14')][_0xc7f6('0x13')]);}})[_0xc7f6('0x15')](function(_0x1271f4){logger[_0xc7f6('0x10')](_0xc7f6('0x12'),_0x20dcab,_0x1271f4);_0x358e4a(_0x1271f4);});});}exports['GetVoiceCallReport']=function(_0x3d82f5){var _0x1ccdd1=this;return new Promise(function(_0x519da3,_0x54ac2f){return db['VoiceCallReport'][_0xc7f6('0x16')]({'raw':_0x3d82f5[_0xc7f6('0x17')]?_0x3d82f5[_0xc7f6('0x17')][_0xc7f6('0x18')]===undefined?!![]:![]:!![],'where':_0x3d82f5[_0xc7f6('0x17')]?_0x3d82f5[_0xc7f6('0x17')]['where']||null:null,'attributes':_0x3d82f5['options']?_0x3d82f5[_0xc7f6('0x17')]['attributes']||null:null,'limit':_0x3d82f5[_0xc7f6('0x17')]?_0x3d82f5['options']['limit']||null:null,'include':_0x3d82f5[_0xc7f6('0x17')]?_0x3d82f5[_0xc7f6('0x17')][_0xc7f6('0x19')]?_['map'](_0x3d82f5[_0xc7f6('0x17')][_0xc7f6('0x19')],function(_0x63e728){return{'model':db[_0x63e728[_0xc7f6('0x1a')]],'as':_0x63e728['as'],'attributes':_0x63e728[_0xc7f6('0x1b')],'include':_0x63e728[_0xc7f6('0x19')]?_['map'](_0x63e728['include'],function(_0x3b72cb){return{'model':db[_0x3b72cb[_0xc7f6('0x1a')]],'as':_0x3b72cb['as'],'attributes':_0x3b72cb['attributes'],'include':_0x3b72cb[_0xc7f6('0x19')]?_['map'](_0x3b72cb[_0xc7f6('0x19')],function(_0x4f0f39){return{'model':db[_0x4f0f39[_0xc7f6('0x1a')]],'as':_0x4f0f39['as'],'attributes':_0x4f0f39[_0xc7f6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc7f6('0xa')](function(_0x3b3db){logger['info'](_0xc7f6('0x1c'),_0x3d82f5);logger[_0xc7f6('0xd')](_0xc7f6('0x1c'),_0x3d82f5,JSON['stringify'](_0x3b3db));_0x519da3(_0x3b3db);})[_0xc7f6('0x15')](function(_0x480309){logger[_0xc7f6('0x10')](_0xc7f6('0x1c'),_0x480309[_0xc7f6('0x13')],_0x3d82f5);_0x54ac2f(_0x1ccdd1['error'](0x1f4,_0x480309[_0xc7f6('0x13')]));});});};exports[_0xc7f6('0x1d')]=function(_0x66457c){var _0x5a7426=this;return new Promise(function(_0x172610,_0x435aff){return db['VoiceCallReport'][_0xc7f6('0x1e')](_0x66457c[_0xc7f6('0x1f')],{'raw':_0x66457c['options']?_0x66457c[_0xc7f6('0x17')][_0xc7f6('0x18')]===undefined?!![]:![]:!![]})[_0xc7f6('0xa')](function(_0x22862a){logger[_0xc7f6('0xb')](_0xc7f6('0x1d'),_0x66457c);logger[_0xc7f6('0xd')](_0xc7f6('0x1d'),_0x66457c,JSON[_0xc7f6('0xf')](_0x22862a));_0x172610(_0x22862a);})['catch'](function(_0x1c83eb){logger[_0xc7f6('0x10')](_0xc7f6('0x1d'),_0x1c83eb[_0xc7f6('0x13')],_0x66457c);_0x435aff(_0x5a7426[_0xc7f6('0x10')](0x1f4,_0x1c83eb['message']));});});};exports[_0xc7f6('0x20')]=function(_0x4e661d){var _0x18211c=this;return new Promise(function(_0xdd939e,_0x2b6b29){return db[_0xc7f6('0x21')][_0xc7f6('0x22')](_0x4e661d['body'],{'raw':_0x4e661d[_0xc7f6('0x17')]?_0x4e661d[_0xc7f6('0x17')][_0xc7f6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e661d[_0xc7f6('0x17')]?_0x4e661d[_0xc7f6('0x17')][_0xc7f6('0x23')]||null:null,'attributes':_0x4e661d['options']?_0x4e661d[_0xc7f6('0x17')][_0xc7f6('0x1b')]||null:null,'limit':_0x4e661d['options']?_0x4e661d['options'][_0xc7f6('0x24')]||null:null})['then'](function(_0x369d0e){logger[_0xc7f6('0xb')](_0xc7f6('0x20'),_0x4e661d);logger[_0xc7f6('0xd')]('UpdateVoiceCallReport',_0x4e661d,JSON[_0xc7f6('0xf')](_0x369d0e));_0xdd939e(_0x369d0e);})['catch'](function(_0x8924c4){logger['error']('UpdateVoiceCallReport',_0x8924c4[_0xc7f6('0x13')],_0x4e661d);_0x2b6b29(_0x18211c[_0xc7f6('0x10')](0x1f4,_0x8924c4['message']));});});}; \ No newline at end of file +var _0xa371=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetVoiceCallReport','VoiceCallReport','options','raw','attributes','include','map','model','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa371,0x19b));var _0x1a37=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa371[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x1a37('0x0'));var util=require('util');var moment=require(_0x1a37('0x1'));var BPromise=require(_0x1a37('0x2'));var rs=require(_0x1a37('0x3'));var fs=require('fs');var Redis=require(_0x1a37('0x4'));var db=require(_0x1a37('0x5'))['db'];var utils=require(_0x1a37('0x6'));var logger=require('../../config/logger')(_0x1a37('0x7'));var config=require(_0x1a37('0x8'));var jayson=require(_0x1a37('0x9'));var client=jayson[_0x1a37('0xa')][_0x1a37('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e359f,_0x5701c6,_0x434a85){return new BPromise(function(_0x41dd69,_0x391194){return client[_0x1a37('0xc')](_0x5e359f,_0x434a85)[_0x1a37('0xd')](function(_0x5d6d23){logger[_0x1a37('0xe')](_0x1a37('0xf'),_0x5701c6,_0x1a37('0x10'));logger[_0x1a37('0x11')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5701c6,_0x1a37('0x10'),JSON[_0x1a37('0x12')](_0x5d6d23));if(_0x5d6d23[_0x1a37('0x13')]){if(_0x5d6d23['error']['code']===0x1f4){logger[_0x1a37('0x13')](_0x1a37('0xf'),_0x5701c6,_0x5d6d23[_0x1a37('0x13')]['message']);return _0x391194(_0x5d6d23[_0x1a37('0x13')][_0x1a37('0x14')]);}logger[_0x1a37('0x13')](_0x1a37('0xf'),_0x5701c6,_0x5d6d23[_0x1a37('0x13')]['message']);return _0x41dd69(_0x5d6d23[_0x1a37('0x13')]['message']);}else{logger[_0x1a37('0xe')](_0x1a37('0xf'),_0x5701c6,_0x1a37('0x10'));_0x41dd69(_0x5d6d23[_0x1a37('0x15')][_0x1a37('0x14')]);}})['catch'](function(_0x61422a){logger['error'](_0x1a37('0xf'),_0x5701c6,_0x61422a);_0x391194(_0x61422a);});});}exports[_0x1a37('0x16')]=function(_0x10283c){var _0x3fcb91=this;return new Promise(function(_0x3e3636,_0x54bd42){return db[_0x1a37('0x17')]['findAll']({'raw':_0x10283c[_0x1a37('0x18')]?_0x10283c['options'][_0x1a37('0x19')]===undefined?!![]:![]:!![],'where':_0x10283c[_0x1a37('0x18')]?_0x10283c['options']['where']||null:null,'attributes':_0x10283c[_0x1a37('0x18')]?_0x10283c[_0x1a37('0x18')][_0x1a37('0x1a')]||null:null,'limit':_0x10283c['options']?_0x10283c[_0x1a37('0x18')]['limit']||null:null,'include':_0x10283c[_0x1a37('0x18')]?_0x10283c[_0x1a37('0x18')][_0x1a37('0x1b')]?_[_0x1a37('0x1c')](_0x10283c['options'][_0x1a37('0x1b')],function(_0x368bf1){return{'model':db[_0x368bf1['model']],'as':_0x368bf1['as'],'attributes':_0x368bf1['attributes'],'include':_0x368bf1[_0x1a37('0x1b')]?_[_0x1a37('0x1c')](_0x368bf1[_0x1a37('0x1b')],function(_0x1d1aa7){return{'model':db[_0x1d1aa7[_0x1a37('0x1d')]],'as':_0x1d1aa7['as'],'attributes':_0x1d1aa7[_0x1a37('0x1a')],'include':_0x1d1aa7[_0x1a37('0x1b')]?_['map'](_0x1d1aa7[_0x1a37('0x1b')],function(_0x393e84){return{'model':db[_0x393e84[_0x1a37('0x1d')]],'as':_0x393e84['as'],'attributes':_0x393e84['attributes']};}):[]};}):[]};}):[]:[]})[_0x1a37('0xd')](function(_0x538e06){logger['info']('GetVoiceCallReport',_0x10283c);logger[_0x1a37('0x11')]('GetVoiceCallReport',_0x10283c,JSON[_0x1a37('0x12')](_0x538e06));_0x3e3636(_0x538e06);})[_0x1a37('0x1e')](function(_0x4fc449){logger['error']('GetVoiceCallReport',_0x4fc449[_0x1a37('0x14')],_0x10283c);_0x54bd42(_0x3fcb91[_0x1a37('0x13')](0x1f4,_0x4fc449[_0x1a37('0x14')]));});});};exports[_0x1a37('0x1f')]=function(_0x338d54){var _0x4a80b1=this;return new Promise(function(_0x3a040a,_0x175e2e){return db['VoiceCallReport'][_0x1a37('0x20')](_0x338d54[_0x1a37('0x21')],{'raw':_0x338d54[_0x1a37('0x18')]?_0x338d54[_0x1a37('0x18')][_0x1a37('0x19')]===undefined?!![]:![]:!![]})[_0x1a37('0xd')](function(_0x735153){logger['info'](_0x1a37('0x1f'),_0x338d54);logger[_0x1a37('0x11')]('CreateVoiceCallReport',_0x338d54,JSON['stringify'](_0x735153));_0x3a040a(_0x735153);})[_0x1a37('0x1e')](function(_0x44b7ad){logger[_0x1a37('0x13')]('CreateVoiceCallReport',_0x44b7ad[_0x1a37('0x14')],_0x338d54);_0x175e2e(_0x4a80b1[_0x1a37('0x13')](0x1f4,_0x44b7ad['message']));});});};exports[_0x1a37('0x22')]=function(_0x2e95f6){var _0x1c74da=this;return new Promise(function(_0x5ce356,_0x2e8fa7){return db[_0x1a37('0x17')][_0x1a37('0x23')](_0x2e95f6[_0x1a37('0x21')],{'raw':_0x2e95f6[_0x1a37('0x18')]?_0x2e95f6[_0x1a37('0x18')][_0x1a37('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e95f6['options']?_0x2e95f6[_0x1a37('0x18')][_0x1a37('0x24')]||null:null,'attributes':_0x2e95f6[_0x1a37('0x18')]?_0x2e95f6[_0x1a37('0x18')]['attributes']||null:null,'limit':_0x2e95f6[_0x1a37('0x18')]?_0x2e95f6[_0x1a37('0x18')][_0x1a37('0x25')]||null:null})['then'](function(_0x302266){logger[_0x1a37('0xe')]('UpdateVoiceCallReport',_0x2e95f6);logger['debug']('UpdateVoiceCallReport',_0x2e95f6,JSON['stringify'](_0x302266));_0x5ce356(_0x302266);})[_0x1a37('0x1e')](function(_0x398c37){logger[_0x1a37('0x13')]('UpdateVoiceCallReport',_0x398c37['message'],_0x2e95f6);_0x2e8fa7(_0x1c74da[_0x1a37('0x13')](0x1f4,_0x398c37['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index db65d6a..02b4c9a 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 _0xbd1c=['util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0xbd1c,0x187));var _0xcbd1=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xbd1c[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require(_0xcbd1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcbd1('0x1'));var router=express[_0xcbd1('0x2')]();var fs_extra=require(_0xcbd1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcbd1('0x4'));var config=require(_0xcbd1('0x5'));var controller=require('./voiceChanSpy.controller');router[_0xcbd1('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xcbd1('0x6')]('/:id',auth[_0xcbd1('0x7')](),controller[_0xcbd1('0x8')]);router[_0xcbd1('0x9')]('/',auth[_0xcbd1('0x7')](),controller[_0xcbd1('0xa')]);router[_0xcbd1('0xb')]('/:id',auth[_0xcbd1('0x7')](),controller[_0xcbd1('0xc')]);router[_0xcbd1('0xd')](_0xcbd1('0xe'),auth[_0xcbd1('0x7')](),controller[_0xcbd1('0xf')]);module[_0xcbd1('0x10')]=router; \ No newline at end of file +var _0x7ed4=['Router','../../components/auth/service','../../components/interaction/service','index','get','/:id','isAuthenticated','post','create','put','destroy','exports','util','path','connect-timeout','express'];(function(_0x39dd35,_0xdd745a){var _0x22d37e=function(_0x208769){while(--_0x208769){_0x39dd35['push'](_0x39dd35['shift']());}};_0x22d37e(++_0xdd745a);}(_0x7ed4,0xcc));var _0x47ed=function(_0x1806d4,_0x47cc68){_0x1806d4=_0x1806d4-0x0;var _0x392c2c=_0x7ed4[_0x1806d4];return _0x392c2c;};'use strict';var multer=require('multer');var util=require(_0x47ed('0x0'));var path=require(_0x47ed('0x1'));var timeout=require(_0x47ed('0x2'));var express=require(_0x47ed('0x3'));var router=express[_0x47ed('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47ed('0x5'));var interaction=require(_0x47ed('0x6'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x47ed('0x7')]);router[_0x47ed('0x8')](_0x47ed('0x9'),auth[_0x47ed('0xa')](),controller['show']);router[_0x47ed('0xb')]('/',auth[_0x47ed('0xa')](),controller[_0x47ed('0xc')]);router[_0x47ed('0xd')](_0x47ed('0x9'),auth[_0x47ed('0xa')](),controller['update']);router['delete'](_0x47ed('0x9'),auth[_0x47ed('0xa')](),controller[_0x47ed('0xe')]);module[_0x47ed('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1c5eeff..6e42981 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 _0x8915=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','join','getDataValue','options'];(function(_0x189afb,_0x529081){var _0x5fc21=function(_0x59d776){while(--_0x59d776){_0x189afb['push'](_0x189afb['shift']());}};_0x5fc21(++_0x529081);}(_0x8915,0xe8));var _0x5891=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0x8915[_0xd09668];return _0x68726;};'use strict';var Sequelize=require(_0x5891('0x0'));module[_0x5891('0x1')]={'name':{'type':Sequelize[_0x5891('0x2')]},'prefix':{'type':Sequelize[_0x5891('0x2')],'unique':_0x5891('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x5891('0x2')],'set':function(_0x405c97){this[_0x5891('0x4')]('options',_0x405c97?_0x405c97[_0x5891('0x5')](''):[]);},'get':function(){return this[_0x5891('0x6')](_0x5891('0x7'))?this[_0x5891('0x6')](_0x5891('0x7'))[_0x5891('0x8')](''):[];}},'auth':{'type':Sequelize[_0x5891('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x5891('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x5891('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x94b8=['getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','join'];(function(_0x5061a1,_0x27d844){var _0x132aa7=function(_0x3044d4){while(--_0x3044d4){_0x5061a1['push'](_0x5061a1['shift']());}};_0x132aa7(++_0x27d844);}(_0x94b8,0xb4));var _0x894b=function(_0x5dc362,_0x4c656c){_0x5dc362=_0x5dc362-0x0;var _0x19690b=_0x94b8[_0x5dc362];return _0x19690b;};'use strict';var Sequelize=require(_0x894b('0x0'));module[_0x894b('0x1')]={'name':{'type':Sequelize[_0x894b('0x2')]},'prefix':{'type':Sequelize[_0x894b('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x32d30f){this['setDataValue']('options',_0x32d30f?_0x32d30f[_0x894b('0x3')](''):[]);},'get':function(){return this[_0x894b('0x4')](_0x894b('0x5'))?this[_0x894b('0x4')]('options')[_0x894b('0x6')](''):[];}},'auth':{'type':Sequelize[_0x894b('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x894b('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x894b('0x2')]},'description':{'type':Sequelize[_0x894b('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index e23960a..3cd75a5 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 _0xbc9d=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','destroy','then','get','UserProfileResource','stack','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','name','options','include','VoiceChanSpy','findAll','rows','params','fields','includeAll','find'];(function(_0x5740d5,_0x14ffd3){var _0x169b33=function(_0x46bd4d){while(--_0x46bd4d){_0x5740d5['push'](_0x5740d5['shift']());}};_0x169b33(++_0x14ffd3);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x264a5f,_0x1b7068){_0x264a5f=_0x264a5f-0x0;var _0x157cc4=_0xbc9d[_0x264a5f];return _0x157cc4;};'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'];function respondWithStatusCode(_0x103d54,_0x48bc83){_0x48bc83=_0x48bc83||0xcc;return function(_0x567e71){if(_0x567e71){return _0x103d54[_0xdbc9('0x19')](_0x48bc83);}return _0x103d54[_0xdbc9('0x1a')](_0x48bc83)[_0xdbc9('0x1b')]();};}function respondWithResult(_0x436e50,_0x53495d){_0x53495d=_0x53495d||0xc8;return function(_0x4a9dcb){if(_0x4a9dcb){return _0x436e50[_0xdbc9('0x1a')](_0x53495d)[_0xdbc9('0x1c')](_0x4a9dcb);}};}function respondWithFilteredResult(_0x3a8a7b,_0x4c7b4f){return function(_0x1b4616){if(_0x1b4616){var _0x1abee8=typeof _0x4c7b4f['offset']===_0xdbc9('0x1d')&&typeof _0x4c7b4f[_0xdbc9('0x1e')]===_0xdbc9('0x1d');var _0x14e655=_0x1b4616[_0xdbc9('0x1f')];var _0x33f1bd=_0x1abee8?0x0:_0x4c7b4f[_0xdbc9('0x20')];var _0xc2ddd2=_0x1abee8?_0x1b4616[_0xdbc9('0x1f')]:_0x4c7b4f[_0xdbc9('0x20')]+_0x4c7b4f['limit'];var _0x1ca5fd;if(_0xc2ddd2>=_0x14e655){_0xc2ddd2=_0x14e655;_0x1ca5fd=0xc8;}else{_0x1ca5fd=0xce;}_0x3a8a7b['status'](_0x1ca5fd);return _0x3a8a7b[_0xdbc9('0x21')](_0xdbc9('0x22'),_0x33f1bd+'-'+_0xc2ddd2+'/'+_0x14e655)['json'](_0x1b4616);}return null;};}function patchUpdates(_0x4408e9){return function(_0x5367dc){try{jsonpatch['apply'](_0x5367dc,_0x4408e9,!![]);}catch(_0x4ab00d){return BPromise['reject'](_0x4ab00d);}return _0x5367dc[_0xdbc9('0x23')]();};}function saveUpdates(_0x2011a2,_0x570ad9){return function(_0x16dcf7){if(_0x16dcf7){return _0x16dcf7[_0xdbc9('0x24')](_0x2011a2)['then'](function(_0x1bc073){return _0x1bc073;});}return null;};}function removeEntity(_0x6b788,_0x1b1c0d){return function(_0x119230){if(_0x119230){return _0x119230[_0xdbc9('0x25')]()[_0xdbc9('0x26')](function(){var _0x32822f=_0x119230[_0xdbc9('0x27')]({'plain':!![]});var _0x3c8c1d='ChanSpies';return db[_0xdbc9('0x28')][_0xdbc9('0x25')]({'where':{'type':_0x3c8c1d,'resourceId':_0x32822f['id']}})[_0xdbc9('0x26')](function(){return _0x119230;});})[_0xdbc9('0x26')](function(){_0x6b788[_0xdbc9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf121e9,_0x2ee00a){return function(_0x5300bd){if(!_0x5300bd){_0xf121e9['sendStatus'](0x194);}return _0x5300bd;};}function handleError(_0x45aebe,_0x278db2){_0x278db2=_0x278db2||0x1f4;return function(_0x473430){logger['error'](_0x473430[_0xdbc9('0x29')]);if(_0x473430['name']){delete _0x473430['name'];}_0x45aebe[_0xdbc9('0x1a')](_0x278db2)['send'](_0x473430);};}exports['index']=function(_0x417b17,_0x20eb4f){var _0x1cb557={},_0x4db824={},_0x35eaf8={'count':0x0,'rows':[]};var _0x22f8aa=_['map'](db['VoiceChanSpy'][_0xdbc9('0x2a')],function(_0x245496){return{'name':_0x245496[_0xdbc9('0x2b')],'type':_0x245496[_0xdbc9('0x2c')][_0xdbc9('0x2d')]};});_0x4db824[_0xdbc9('0x2e')]=_[_0xdbc9('0x2f')](_0x22f8aa,'name');_0x4db824[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x417b17[_0xdbc9('0x30')]);_0x4db824[_0xdbc9('0x32')]=_[_0xdbc9('0x33')](_0x4db824[_0xdbc9('0x2e')],_0x4db824['query']);_0x1cb557[_0xdbc9('0x34')]=_['intersection'](_0x4db824['model'],qs['fields'](_0x417b17['query']['fields']));_0x1cb557[_0xdbc9('0x34')]=_0x1cb557[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0x1cb557['attributes']:_0x4db824[_0xdbc9('0x2e')];if(!_0x417b17[_0xdbc9('0x30')][_0xdbc9('0x36')](_0xdbc9('0x37'))){_0x1cb557[_0xdbc9('0x1e')]=qs[_0xdbc9('0x1e')](_0x417b17['query'][_0xdbc9('0x1e')]);_0x1cb557[_0xdbc9('0x20')]=qs[_0xdbc9('0x20')](_0x417b17['query'][_0xdbc9('0x20')]);}_0x1cb557[_0xdbc9('0x38')]=qs[_0xdbc9('0x39')](_0x417b17[_0xdbc9('0x30')]['sort']);_0x1cb557['where']=qs[_0xdbc9('0x32')](_[_0xdbc9('0x3a')](_0x417b17[_0xdbc9('0x30')],_0x4db824[_0xdbc9('0x32')]),_0x22f8aa);if(_0x417b17['query'][_0xdbc9('0x3b')]){_0x1cb557[_0xdbc9('0x3c')]=_[_0xdbc9('0x3d')](_0x1cb557['where'],{'$or':_[_0xdbc9('0x2f')](_0x22f8aa,function(_0x38a2a7){if(_0x38a2a7[_0xdbc9('0x2c')]!=='VIRTUAL'){var _0xa11bc8={};_0xa11bc8[_0x38a2a7[_0xdbc9('0x3e')]]={'$like':'%'+_0x417b17['query']['filter']+'%'};return _0xa11bc8;}})});}_0x1cb557=_[_0xdbc9('0x3d')]({},_0x1cb557,_0x417b17[_0xdbc9('0x3f')]);var _0x387b57={'where':_0x1cb557[_0xdbc9('0x3c')]};return db['VoiceChanSpy'][_0xdbc9('0x1f')](_0x387b57)[_0xdbc9('0x26')](function(_0x577725){_0x35eaf8[_0xdbc9('0x1f')]=_0x577725;if(_0x417b17[_0xdbc9('0x30')]['includeAll']){_0x1cb557[_0xdbc9('0x40')]=[{'all':!![]}];}return db[_0xdbc9('0x41')][_0xdbc9('0x42')](_0x1cb557);})[_0xdbc9('0x26')](function(_0x3ed4de){_0x35eaf8[_0xdbc9('0x43')]=_0x3ed4de;return _0x35eaf8;})[_0xdbc9('0x26')](respondWithFilteredResult(_0x20eb4f,_0x1cb557))['catch'](handleError(_0x20eb4f,null));};exports['show']=function(_0x768856,_0x3b8437){var _0xc77676={'raw':![],'where':{'id':_0x768856[_0xdbc9('0x44')]['id']}},_0x41f56a={};_0x41f56a[_0xdbc9('0x2e')]=_[_0xdbc9('0x31')](db[_0xdbc9('0x41')][_0xdbc9('0x2a')]);_0x41f56a[_0xdbc9('0x30')]=_[_0xdbc9('0x31')](_0x768856['query']);_0x41f56a['filters']=_[_0xdbc9('0x33')](_0x41f56a[_0xdbc9('0x2e')],_0x41f56a[_0xdbc9('0x30')]);_0xc77676[_0xdbc9('0x34')]=_[_0xdbc9('0x33')](_0x41f56a[_0xdbc9('0x2e')],qs[_0xdbc9('0x45')](_0x768856[_0xdbc9('0x30')]['fields']));_0xc77676['attributes']=_0xc77676[_0xdbc9('0x34')][_0xdbc9('0x35')]?_0xc77676[_0xdbc9('0x34')]:_0x41f56a[_0xdbc9('0x2e')];if(_0x768856[_0xdbc9('0x30')][_0xdbc9('0x46')]){_0xc77676[_0xdbc9('0x40')]=[{'all':!![]}];}_0xc77676=_[_0xdbc9('0x3d')]({},_0xc77676,_0x768856[_0xdbc9('0x3f')]);return db['VoiceChanSpy'][_0xdbc9('0x47')](_0xc77676)[_0xdbc9('0x26')](handleEntityNotFound(_0x3b8437,null))['then'](respondWithResult(_0x3b8437,null))['catch'](handleError(_0x3b8437,null));};exports[_0xdbc9('0x48')]=function(_0xc3db3c,_0x133a13){return db['VoiceChanSpy'][_0xdbc9('0x48')](_0xc3db3c[_0xdbc9('0x49')],{})[_0xdbc9('0x26')](function(_0x274607){var _0x5aee83=_0xc3db3c[_0xdbc9('0x4a')][_0xdbc9('0x27')]({'plain':!![]});if(!_0x5aee83)throw new Error(_0xdbc9('0x4b'));if(_0x5aee83[_0xdbc9('0x4c')]==='user'){var _0x3e89f5=_0x274607[_0xdbc9('0x27')]({'plain':!![]});var _0x3f49b7=_0xdbc9('0x4d');return db[_0xdbc9('0x4e')][_0xdbc9('0x47')]({'where':{'name':_0x3f49b7,'userProfileId':_0x5aee83[_0xdbc9('0x4f')]},'raw':!![]})[_0xdbc9('0x26')](function(_0x4b34dd){if(_0x4b34dd&&_0x4b34dd[_0xdbc9('0x50')]===0x0){return db['UserProfileResource'][_0xdbc9('0x48')]({'name':_0x3e89f5[_0xdbc9('0x3e')],'resourceId':_0x3e89f5['id'],'type':_0x4b34dd['name'],'sectionId':_0x4b34dd['id']},{})['then'](function(){return _0x274607;});}else{return _0x274607;}})[_0xdbc9('0x51')](function(_0x4b55df){logger[_0xdbc9('0x52')](_0xdbc9('0x53'),_0x4b55df);throw _0x4b55df;});}return _0x274607;})[_0xdbc9('0x26')](respondWithResult(_0x133a13,0xc9))['catch'](handleError(_0x133a13,null));};exports[_0xdbc9('0x24')]=function(_0x1c52e6,_0x3d8b01){if(_0x1c52e6[_0xdbc9('0x49')]['id']){delete _0x1c52e6[_0xdbc9('0x49')]['id'];}return db[_0xdbc9('0x41')][_0xdbc9('0x47')]({'where':{'id':_0x1c52e6[_0xdbc9('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d8b01,null))['then'](saveUpdates(_0x1c52e6['body'],null))[_0xdbc9('0x26')](respondWithResult(_0x3d8b01,null))[_0xdbc9('0x51')](handleError(_0x3d8b01,null));};exports[_0xdbc9('0x25')]=function(_0x55d8ba,_0x519ac9){return db[_0xdbc9('0x41')][_0xdbc9('0x47')]({'where':{'id':_0x55d8ba['params']['id']}})['then'](handleEntityNotFound(_0x519ac9,null))[_0xdbc9('0x26')](removeEntity(_0x519ac9,null))[_0xdbc9('0x51')](handleError(_0x519ac9,null));}; \ No newline at end of file +var _0x9755=['papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','ChanSpies','then','end','error','name','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring'];(function(_0x34646f,_0x55a313){var _0x490624=function(_0x327c4f){while(--_0x327c4f){_0x34646f['push'](_0x34646f['shift']());}};_0x490624(++_0x55a313);}(_0x9755,0x1c6));var _0x5975=function(_0x4471ff,_0x4bb7de){_0x4471ff=_0x4471ff-0x0;var _0xe723ca=_0x9755[_0x4471ff];return _0xe723ca;};'use strict';var emlformat=require(_0x5975('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5975('0x1'));var jsonpatch=require(_0x5975('0x2'));var rp=require(_0x5975('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5975('0x4'));var path=require(_0x5975('0x5'));var sox=require(_0x5975('0x6'));var csv=require(_0x5975('0x7'));var ejs=require(_0x5975('0x8'));var fs=require('fs');var fs_extra=require(_0x5975('0x9'));var _=require(_0x5975('0xa'));var squel=require('squel');var crypto=require(_0x5975('0xb'));var jsforce=require(_0x5975('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5975('0x7'));var querystring=require(_0x5975('0xd'));var Papa=require(_0x5975('0xe'));var Redis=require('ioredis');var authService=require(_0x5975('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5975('0x10'));var logger=require(_0x5975('0x11'))(_0x5975('0x12'));var utils=require('../../config/utils');var config=require(_0x5975('0x13'));var licenseUtil=require(_0x5975('0x14'));var db=require(_0x5975('0x15'))['db'];function respondWithStatusCode(_0x52bdaa,_0x119571){_0x119571=_0x119571||0xcc;return function(_0x2ad3ed){if(_0x2ad3ed){return _0x52bdaa[_0x5975('0x16')](_0x119571);}return _0x52bdaa[_0x5975('0x17')](_0x119571)['end']();};}function respondWithResult(_0x5e355a,_0x331385){_0x331385=_0x331385||0xc8;return function(_0x1543c5){if(_0x1543c5){return _0x5e355a[_0x5975('0x17')](_0x331385)['json'](_0x1543c5);}};}function respondWithFilteredResult(_0x1a3299,_0x4de825){return function(_0x145f39){if(_0x145f39){var _0x58da02=typeof _0x4de825[_0x5975('0x18')]===_0x5975('0x19')&&typeof _0x4de825[_0x5975('0x1a')]===_0x5975('0x19');var _0x25f2a0=_0x145f39[_0x5975('0x1b')];var _0x203829=_0x58da02?0x0:_0x4de825['offset'];var _0x4e6806=_0x58da02?_0x145f39['count']:_0x4de825['offset']+_0x4de825['limit'];var _0x296185;if(_0x4e6806>=_0x25f2a0){_0x4e6806=_0x25f2a0;_0x296185=0xc8;}else{_0x296185=0xce;}_0x1a3299['status'](_0x296185);return _0x1a3299[_0x5975('0x1c')](_0x5975('0x1d'),_0x203829+'-'+_0x4e6806+'/'+_0x25f2a0)[_0x5975('0x1e')](_0x145f39);}return null;};}function patchUpdates(_0x1977bb){return function(_0x5a9df3){try{jsonpatch[_0x5975('0x1f')](_0x5a9df3,_0x1977bb,!![]);}catch(_0x133e32){return BPromise[_0x5975('0x20')](_0x133e32);}return _0x5a9df3['save']();};}function saveUpdates(_0x34b195,_0xc916a8){return function(_0x1689e2){if(_0x1689e2){return _0x1689e2[_0x5975('0x21')](_0x34b195)['then'](function(_0x48d708){return _0x48d708;});}return null;};}function removeEntity(_0x1cef80,_0x2da6c8){return function(_0x504892){if(_0x504892){return _0x504892[_0x5975('0x22')]()['then'](function(){var _0x43e097=_0x504892['get']({'plain':!![]});var _0x5e8b5a=_0x5975('0x23');return db['UserProfileResource'][_0x5975('0x22')]({'where':{'type':_0x5e8b5a,'resourceId':_0x43e097['id']}})[_0x5975('0x24')](function(){return _0x504892;});})['then'](function(){_0x1cef80['status'](0xcc)[_0x5975('0x25')]();});}};}function handleEntityNotFound(_0x1c1551,_0x2932c1){return function(_0x154e1a){if(!_0x154e1a){_0x1c1551[_0x5975('0x16')](0x194);}return _0x154e1a;};}function handleError(_0x23e5d1,_0x161fe2){_0x161fe2=_0x161fe2||0x1f4;return function(_0x24ee17){logger[_0x5975('0x26')](_0x24ee17['stack']);if(_0x24ee17[_0x5975('0x27')]){delete _0x24ee17[_0x5975('0x27')];}_0x23e5d1[_0x5975('0x17')](_0x161fe2)['send'](_0x24ee17);};}exports[_0x5975('0x28')]=function(_0x5778f7,_0x4bfd10){var _0x2df91e={},_0x191376={},_0x3c6476={'count':0x0,'rows':[]};var _0x344e42=_[_0x5975('0x29')](db['VoiceChanSpy'][_0x5975('0x2a')],function(_0x57de92){return{'name':_0x57de92['fieldName'],'type':_0x57de92['type']['key']};});_0x191376[_0x5975('0x2b')]=_[_0x5975('0x29')](_0x344e42,_0x5975('0x27'));_0x191376[_0x5975('0x2c')]=_[_0x5975('0x2d')](_0x5778f7[_0x5975('0x2c')]);_0x191376[_0x5975('0x2e')]=_[_0x5975('0x2f')](_0x191376[_0x5975('0x2b')],_0x191376[_0x5975('0x2c')]);_0x2df91e[_0x5975('0x30')]=_[_0x5975('0x2f')](_0x191376[_0x5975('0x2b')],qs[_0x5975('0x31')](_0x5778f7[_0x5975('0x2c')][_0x5975('0x31')]));_0x2df91e[_0x5975('0x30')]=_0x2df91e[_0x5975('0x30')][_0x5975('0x32')]?_0x2df91e[_0x5975('0x30')]:_0x191376['model'];if(!_0x5778f7[_0x5975('0x2c')][_0x5975('0x33')]('nolimit')){_0x2df91e[_0x5975('0x1a')]=qs[_0x5975('0x1a')](_0x5778f7[_0x5975('0x2c')]['limit']);_0x2df91e[_0x5975('0x18')]=qs[_0x5975('0x18')](_0x5778f7[_0x5975('0x2c')]['offset']);}_0x2df91e[_0x5975('0x34')]=qs[_0x5975('0x35')](_0x5778f7[_0x5975('0x2c')]['sort']);_0x2df91e['where']=qs[_0x5975('0x2e')](_[_0x5975('0x36')](_0x5778f7['query'],_0x191376['filters']),_0x344e42);if(_0x5778f7['query'][_0x5975('0x37')]){_0x2df91e[_0x5975('0x38')]=_[_0x5975('0x39')](_0x2df91e[_0x5975('0x38')],{'$or':_[_0x5975('0x29')](_0x344e42,function(_0x55850b){if(_0x55850b[_0x5975('0x3a')]!==_0x5975('0x3b')){var _0x16c5c0={};_0x16c5c0[_0x55850b[_0x5975('0x27')]]={'$like':'%'+_0x5778f7[_0x5975('0x2c')]['filter']+'%'};return _0x16c5c0;}})});}_0x2df91e=_['merge']({},_0x2df91e,_0x5778f7['options']);var _0xa8d266={'where':_0x2df91e[_0x5975('0x38')]};return db[_0x5975('0x3c')]['count'](_0xa8d266)[_0x5975('0x24')](function(_0x1cff9f){_0x3c6476[_0x5975('0x1b')]=_0x1cff9f;if(_0x5778f7['query'][_0x5975('0x3d')]){_0x2df91e[_0x5975('0x3e')]=[{'all':!![]}];}return db[_0x5975('0x3c')][_0x5975('0x3f')](_0x2df91e);})['then'](function(_0x3cfb3a){_0x3c6476[_0x5975('0x40')]=_0x3cfb3a;return _0x3c6476;})[_0x5975('0x24')](respondWithFilteredResult(_0x4bfd10,_0x2df91e))[_0x5975('0x41')](handleError(_0x4bfd10,null));};exports[_0x5975('0x42')]=function(_0x468097,_0x2c309e){var _0x50485c={'raw':![],'where':{'id':_0x468097[_0x5975('0x43')]['id']}},_0xaa7afe={};_0xaa7afe['model']=_['keys'](db[_0x5975('0x3c')][_0x5975('0x2a')]);_0xaa7afe[_0x5975('0x2c')]=_['keys'](_0x468097[_0x5975('0x2c')]);_0xaa7afe['filters']=_[_0x5975('0x2f')](_0xaa7afe[_0x5975('0x2b')],_0xaa7afe[_0x5975('0x2c')]);_0x50485c[_0x5975('0x30')]=_[_0x5975('0x2f')](_0xaa7afe[_0x5975('0x2b')],qs[_0x5975('0x31')](_0x468097[_0x5975('0x2c')][_0x5975('0x31')]));_0x50485c[_0x5975('0x30')]=_0x50485c[_0x5975('0x30')][_0x5975('0x32')]?_0x50485c[_0x5975('0x30')]:_0xaa7afe['model'];if(_0x468097[_0x5975('0x2c')][_0x5975('0x3d')]){_0x50485c[_0x5975('0x3e')]=[{'all':!![]}];}_0x50485c=_[_0x5975('0x39')]({},_0x50485c,_0x468097[_0x5975('0x44')]);return db['VoiceChanSpy'][_0x5975('0x45')](_0x50485c)[_0x5975('0x24')](handleEntityNotFound(_0x2c309e,null))['then'](respondWithResult(_0x2c309e,null))[_0x5975('0x41')](handleError(_0x2c309e,null));};exports[_0x5975('0x46')]=function(_0x5045b1,_0x4214e8){return db['VoiceChanSpy'][_0x5975('0x46')](_0x5045b1[_0x5975('0x47')],{})[_0x5975('0x24')](function(_0xcb2f4a){var _0x581105=_0x5045b1[_0x5975('0x48')]['get']({'plain':!![]});if(!_0x581105)throw new Error(_0x5975('0x49'));if(_0x581105['role']===_0x5975('0x48')){var _0x135060=_0xcb2f4a['get']({'plain':!![]});var _0x66c009=_0x5975('0x23');return db[_0x5975('0x4a')][_0x5975('0x45')]({'where':{'name':_0x66c009,'userProfileId':_0x581105[_0x5975('0x4b')]},'raw':!![]})['then'](function(_0x131156){if(_0x131156&&_0x131156['autoAssociation']===0x0){return db[_0x5975('0x4c')]['create']({'name':_0x135060[_0x5975('0x27')],'resourceId':_0x135060['id'],'type':_0x131156['name'],'sectionId':_0x131156['id']},{})[_0x5975('0x24')](function(){return _0xcb2f4a;});}else{return _0xcb2f4a;}})[_0x5975('0x41')](function(_0x5972cc){logger[_0x5975('0x26')](_0x5975('0x4d'),_0x5972cc);throw _0x5972cc;});}return _0xcb2f4a;})[_0x5975('0x24')](respondWithResult(_0x4214e8,0xc9))[_0x5975('0x41')](handleError(_0x4214e8,null));};exports[_0x5975('0x21')]=function(_0x59548e,_0x1ab342){if(_0x59548e[_0x5975('0x47')]['id']){delete _0x59548e[_0x5975('0x47')]['id'];}return db[_0x5975('0x3c')][_0x5975('0x45')]({'where':{'id':_0x59548e[_0x5975('0x43')]['id']}})[_0x5975('0x24')](handleEntityNotFound(_0x1ab342,null))[_0x5975('0x24')](saveUpdates(_0x59548e[_0x5975('0x47')],null))['then'](respondWithResult(_0x1ab342,null))[_0x5975('0x41')](handleError(_0x1ab342,null));};exports['destroy']=function(_0x308853,_0x19fe1c){return db[_0x5975('0x3c')][_0x5975('0x45')]({'where':{'id':_0x308853[_0x5975('0x43')]['id']}})['then'](handleEntityNotFound(_0x19fe1c,null))[_0x5975('0x24')](removeEntity(_0x19fe1c,null))[_0x5975('0x41')](handleError(_0x19fe1c,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index e83505d..3624c08 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 _0x1dba=['agent','then','exports','models','VoiceChanSpy','voice_chanspy','bulkCreate','catch','VoiceExtension','destroy','lodash','./voiceChanSpy.attributes','from-sip','prefix','system','merge','Set','format','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','push','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll'];(function(_0x2a76fa,_0x1cee7d){var _0x2d2442=function(_0x2f5e81){while(--_0x2f5e81){_0x2a76fa['push'](_0x2a76fa['shift']());}};_0x2d2442(++_0x1cee7d);}(_0x1dba,0xc8));var _0xa1db=function(_0x1d02d3,_0xf1ee03){_0x1d02d3=_0x1d02d3-0x0;var _0x550d57=_0x1dba[_0x1d02d3];return _0x550d57;};'use strict';var _=require(_0xa1db('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xa1db('0x1'));var getUserApplications=function(_0x13a12e,_0x457989,_0xccea52){var _0x1afad0=0x1;var _0x1d207b=[];var _0x1ba85f={'context':_0x457989['context']||_0xa1db('0x2'),'exten':util['format']('%s%s',_0x13a12e[_0xa1db('0x3')],_0xccea52),'type':_0xa1db('0x4'),'isApp':![],'ChanSpyId':_0x13a12e['id'],'UserId':_0x457989['id']};_0x1d207b['push'](_[_0xa1db('0x5')]({'app':_0xa1db('0x6'),'appdata':util[_0xa1db('0x7')](_0xa1db('0x8'),_0xa1db('0x9')),'priority':_0x1afad0++},_0x1ba85f));if(_0x13a12e[_0xa1db('0xa')]){_0x1d207b['push'](_[_0xa1db('0x5')]({'app':'MixMonitor','appdata':util['format'](_0xa1db('0xb'),_0x13a12e[_0xa1db('0xc')]),'priority':_0x1afad0++},_0x1ba85f));}if(_0x13a12e[_0xa1db('0xd')]){_0x1d207b[_0xa1db('0xe')](_[_0xa1db('0x5')]({'app':_0xa1db('0xf'),'appdata':_0x13a12e[_0xa1db('0x10')],'priority':_0x1afad0++},_0x1ba85f));}_0x1d207b[_0xa1db('0xe')](_['merge']({'app':_0xa1db('0x11'),'appdata':util[_0xa1db('0x7')](_0xa1db('0x12'),_0x457989[_0xa1db('0x13')],_0x13a12e['options']?_0x13a12e[_0xa1db('0x14')][_0xa1db('0x15')](''):''),'priority':_0x1afad0++},_0x1ba85f));if(_0x13a12e[_0xa1db('0xa')]){_0x1d207b['push'](_[_0xa1db('0x5')]({'app':_0xa1db('0x16'),'priority':_0x1afad0++},_0x1ba85f));}return _0x1d207b;};var getChanSpyApplications=function(_0x376386,_0x25e34a){var _0x15b49f=[];for(var _0x4d201e=0x0,_0x15bcc5=0x1;_0x4d201e<_0x25e34a[_0xa1db('0x17')];_0x4d201e++,_0x15bcc5=0x1){_0x15b49f=_0x15b49f[_0xa1db('0x18')](getUserApplications(_0x376386,_0x25e34a[_0x4d201e],_0x25e34a[_0x4d201e]['internal']));if(_0x25e34a[_0x4d201e][_0xa1db('0x19')]!=_0x25e34a[_0x4d201e]['name']){_0x15b49f=_0x15b49f['concat'](getUserApplications(_0x376386,_0x25e34a[_0x4d201e],_0x25e34a[_0x4d201e]['name']));}}return _0x15b49f;};var getChanSpyPromise=function(_0x2c7438,_0xb18d53){return new BPromise(function(_0x58fae9,_0x2fca29){return _0x2c7438[_0xa1db('0x1a')][_0xa1db('0x1b')]({'attributes':['id','name',_0xa1db('0x19')],'where':{'role':_0xa1db('0x1c'),'chanspy':!![]},'raw':!![]})[_0xa1db('0x1d')](function(_0x189979){if(_0x189979){return _0x58fae9(getChanSpyApplications(_0xb18d53,_0x189979));}return _0x58fae9([]);})['catch'](function(_0x366c9c){_0x2fca29(_0x366c9c);});});};module[_0xa1db('0x1e')]=function(_0x30b195,_0xc5dc20){var _0x650dc4=_0x30b195[_0xa1db('0x1f')];return _0x30b195['define'](_0xa1db('0x20'),attributes,{'tableName':_0xa1db('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x423b38,_0x2cf51f,_0x5316f0){return getChanSpyPromise(_0x650dc4,_0x423b38)[_0xa1db('0x1d')](function(_0x130c8b){if(_0x130c8b&&_0x130c8b[_0xa1db('0x17')]){return _0x650dc4['VoiceExtension'][_0xa1db('0x22')](_0x130c8b);}})[_0xa1db('0x1d')](function(){_0x5316f0();})[_0xa1db('0x23')](function(_0xc773e){_0x5316f0(_0xc773e);});},'afterUpdate':function(_0x1efd13,_0x40895b,_0x100e9d){return _0x650dc4[_0xa1db('0x24')][_0xa1db('0x25')]({'where':{'ChanSpyId':_0x1efd13['id']}})['then'](function(){return getChanSpyPromise(_0x650dc4,_0x1efd13);})[_0xa1db('0x1d')](function(_0x158d7e){if(_0x158d7e&&_0x158d7e['length']){return _0x650dc4[_0xa1db('0x24')][_0xa1db('0x22')](_0x158d7e);}})[_0xa1db('0x1d')](function(){_0x100e9d();})['catch'](function(_0xa8131f){_0x100e9d(_0xa8131f);});},'afterDestroy':function(_0x1c661a,_0x15e25e,_0x31d820){return _0x650dc4[_0xa1db('0x24')]['destroy']({'where':{'ChanSpyId':_0x1c661a['id']}})[_0xa1db('0x1d')](function(){_0x31d820();})[_0xa1db('0x23')](function(_0x553d14){_0x31d820(_0x553d14);});}}});}; \ No newline at end of file +var _0xefda=['models','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','format','prefix','push','merge','CDR(type)=%s','record','${UNIQUEID}.%s,a','recordingFormat','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','length','concat','internal','User','findAll','agent','then'];(function(_0x478212,_0x2b86d2){var _0x49f310=function(_0x809c7c){while(--_0x809c7c){_0x478212['push'](_0x478212['shift']());}};_0x49f310(++_0x2b86d2);}(_0xefda,0x130));var _0xaefd=function(_0x192937,_0x445940){_0x192937=_0x192937-0x0;var _0x289d0d=_0xefda[_0x192937];return _0x289d0d;};'use strict';var _=require(_0xaefd('0x0'));var util=require(_0xaefd('0x1'));var BPromise=require(_0xaefd('0x2'));var attributes=require(_0xaefd('0x3'));var getUserApplications=function(_0x78e1e0,_0x2fa461,_0x3ddcca){var _0x36bc00=0x1;var _0x438622=[];var _0xaa731c={'context':_0x2fa461[_0xaefd('0x4')]||'from-sip','exten':util[_0xaefd('0x5')]('%s%s',_0x78e1e0[_0xaefd('0x6')],_0x3ddcca),'type':'system','isApp':![],'ChanSpyId':_0x78e1e0['id'],'UserId':_0x2fa461['id']};_0x438622[_0xaefd('0x7')](_[_0xaefd('0x8')]({'app':'Set','appdata':util['format'](_0xaefd('0x9'),'chanspy'),'priority':_0x36bc00++},_0xaa731c));if(_0x78e1e0[_0xaefd('0xa')]){_0x438622[_0xaefd('0x7')](_[_0xaefd('0x8')]({'app':'MixMonitor','appdata':util['format'](_0xaefd('0xb'),_0x78e1e0[_0xaefd('0xc')]),'priority':_0x36bc00++},_0xaa731c));}if(_0x78e1e0['auth']){_0x438622['push'](_[_0xaefd('0x8')]({'app':_0xaefd('0xd'),'appdata':_0x78e1e0['password'],'priority':_0x36bc00++},_0xaa731c));}_0x438622[_0xaefd('0x7')](_[_0xaefd('0x8')]({'app':_0xaefd('0xe'),'appdata':util[_0xaefd('0x5')](_0xaefd('0xf'),_0x2fa461[_0xaefd('0x10')],_0x78e1e0[_0xaefd('0x11')]?_0x78e1e0['options'][_0xaefd('0x12')](''):''),'priority':_0x36bc00++},_0xaa731c));if(_0x78e1e0[_0xaefd('0xa')]){_0x438622[_0xaefd('0x7')](_[_0xaefd('0x8')]({'app':'StopMixMonitor','priority':_0x36bc00++},_0xaa731c));}return _0x438622;};var getChanSpyApplications=function(_0x415fbf,_0x54a50b){var _0x378887=[];for(var _0x307dd=0x0,_0x258153=0x1;_0x307dd<_0x54a50b[_0xaefd('0x13')];_0x307dd++,_0x258153=0x1){_0x378887=_0x378887[_0xaefd('0x14')](getUserApplications(_0x415fbf,_0x54a50b[_0x307dd],_0x54a50b[_0x307dd]['internal']));if(_0x54a50b[_0x307dd][_0xaefd('0x15')]!=_0x54a50b[_0x307dd]['name']){_0x378887=_0x378887[_0xaefd('0x14')](getUserApplications(_0x415fbf,_0x54a50b[_0x307dd],_0x54a50b[_0x307dd][_0xaefd('0x10')]));}}return _0x378887;};var getChanSpyPromise=function(_0x1e3189,_0x31137f){return new BPromise(function(_0x32eb84,_0x52f824){return _0x1e3189[_0xaefd('0x16')][_0xaefd('0x17')]({'attributes':['id',_0xaefd('0x10'),_0xaefd('0x15')],'where':{'role':_0xaefd('0x18'),'chanspy':!![]},'raw':!![]})[_0xaefd('0x19')](function(_0x4d5b06){if(_0x4d5b06){return _0x32eb84(getChanSpyApplications(_0x31137f,_0x4d5b06));}return _0x32eb84([]);})['catch'](function(_0x349d65){_0x52f824(_0x349d65);});});};module['exports']=function(_0x204f35,_0x457efa){var _0x2295fd=_0x204f35[_0xaefd('0x1a')];return _0x204f35['define'](_0xaefd('0x1b'),attributes,{'tableName':_0xaefd('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a36cf,_0x46672f,_0x48e84c){return getChanSpyPromise(_0x2295fd,_0x3a36cf)[_0xaefd('0x19')](function(_0x31296c){if(_0x31296c&&_0x31296c['length']){return _0x2295fd[_0xaefd('0x1d')][_0xaefd('0x1e')](_0x31296c);}})['then'](function(){_0x48e84c();})[_0xaefd('0x1f')](function(_0x41707c){_0x48e84c(_0x41707c);});},'afterUpdate':function(_0xe58f14,_0x5f125e,_0x25e677){return _0x2295fd[_0xaefd('0x1d')][_0xaefd('0x20')]({'where':{'ChanSpyId':_0xe58f14['id']}})[_0xaefd('0x19')](function(){return getChanSpyPromise(_0x2295fd,_0xe58f14);})[_0xaefd('0x19')](function(_0x2c9631){if(_0x2c9631&&_0x2c9631[_0xaefd('0x13')]){return _0x2295fd[_0xaefd('0x1d')][_0xaefd('0x1e')](_0x2c9631);}})[_0xaefd('0x19')](function(){_0x25e677();})[_0xaefd('0x1f')](function(_0x3f107c){_0x25e677(_0x3f107c);});},'afterDestroy':function(_0x2016a6,_0x38ef98,_0x2159aa){return _0x2295fd[_0xaefd('0x1d')][_0xaefd('0x20')]({'where':{'ChanSpyId':_0x2016a6['id']}})['then'](function(){_0x2159aa();})[_0xaefd('0x1f')](function(_0xd2451d){_0x2159aa(_0xd2451d);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e8a4ef7..5d949d0 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 _0xb4e6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a367f,_0x4e05f2){var _0x2bedd5=function(_0x5b5e70){while(--_0x5b5e70){_0x4a367f['push'](_0x4a367f['shift']());}};_0x2bedd5(++_0x4e05f2);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0xb4e6[_0x30f5bb];return _0x1cfc00;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var moment=require(_0x6b4e('0x1'));var BPromise=require(_0x6b4e('0x2'));var rs=require(_0x6b4e('0x3'));var fs=require('fs');var Redis=require(_0x6b4e('0x4'));var db=require(_0x6b4e('0x5'))['db'];var utils=require(_0x6b4e('0x6'));var logger=require(_0x6b4e('0x7'))('rpc');var config=require(_0x6b4e('0x8'));var jayson=require(_0x6b4e('0x9'));var client=jayson[_0x6b4e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd3138f,_0x570346,_0x4f00be){return new BPromise(function(_0x2311d9,_0x48c870){return client['request'](_0xd3138f,_0x4f00be)[_0x6b4e('0xb')](function(_0x2bd576){logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));logger[_0x6b4e('0xf')](_0x6b4e('0x10'),_0x570346,'request\x20sent',JSON[_0x6b4e('0x11')](_0x2bd576));if(_0x2bd576[_0x6b4e('0x12')]){if(_0x2bd576['error'][_0x6b4e('0x13')]===0x1f4){logger[_0x6b4e('0x12')](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);return _0x48c870(_0x2bd576[_0x6b4e('0x12')][_0x6b4e('0x14')]);}logger['error'](_0x6b4e('0xd'),_0x570346,_0x2bd576[_0x6b4e('0x12')]['message']);return _0x2311d9(_0x2bd576[_0x6b4e('0x12')]['message']);}else{logger[_0x6b4e('0xc')](_0x6b4e('0xd'),_0x570346,_0x6b4e('0xe'));_0x2311d9(_0x2bd576[_0x6b4e('0x15')][_0x6b4e('0x14')]);}})[_0x6b4e('0x16')](function(_0x53a934){logger['error'](_0x6b4e('0xd'),_0x570346,_0x53a934);_0x48c870(_0x53a934);});});} \ No newline at end of file +var _0xa902=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0xa902,0x8d));var _0x2a90=function(_0x5474d1,_0x1f2d57){_0x5474d1=_0x5474d1-0x0;var _0x3e18b1=_0xa902[_0x5474d1];return _0x3e18b1;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 9b51697..f4366b7 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 _0x4044=['../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','destroy','exports','util','path','fs-extra','../../components/auth/service'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0x4044,0x1cd));var _0x4404=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x4044[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require('multer');var util=require(_0x4404('0x0'));var path=require(_0x4404('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4404('0x2'));var auth=require(_0x4404('0x3'));var interaction=require(_0x4404('0x4'));var config=require(_0x4404('0x5'));var controller=require(_0x4404('0x6'));router[_0x4404('0x7')]('/',auth[_0x4404('0x8')](),controller['index']);router['get'](_0x4404('0x9'),auth[_0x4404('0x8')](),controller[_0x4404('0xa')]);router[_0x4404('0xb')]('/',auth['isAuthenticated'](),controller[_0x4404('0xc')]);router['put'](_0x4404('0x9'),auth[_0x4404('0x8')](),controller['update']);router['delete'](_0x4404('0x9'),auth[_0x4404('0x8')](),controller[_0x4404('0xd')]);module[_0x4404('0xe')]=router; \ No newline at end of file +var _0x7196=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceContext.controller','get','/:id','show','post','create','isAuthenticated','update'];(function(_0x15b0ec,_0x31bcc0){var _0x2d575b=function(_0x55dc03){while(--_0x55dc03){_0x15b0ec['push'](_0x15b0ec['shift']());}};_0x2d575b(++_0x31bcc0);}(_0x7196,0x71));var _0x6719=function(_0x2a4711,_0x5a9154){_0x2a4711=_0x2a4711-0x0;var _0xa7a0db=_0x7196[_0x2a4711];return _0xa7a0db;};'use strict';var multer=require(_0x6719('0x0'));var util=require('util');var path=require(_0x6719('0x1'));var timeout=require(_0x6719('0x2'));var express=require(_0x6719('0x3'));var router=express[_0x6719('0x4')]();var fs_extra=require(_0x6719('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6719('0x6'));var config=require('../../config/environment');var controller=require(_0x6719('0x7'));router[_0x6719('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6719('0x8')](_0x6719('0x9'),auth['isAuthenticated'](),controller[_0x6719('0xa')]);router[_0x6719('0xb')]('/',auth['isAuthenticated'](),controller[_0x6719('0xc')]);router['put'](_0x6719('0x9'),auth[_0x6719('0xd')](),controller[_0x6719('0xe')]);router['delete'](_0x6719('0x9'),auth[_0x6719('0xd')](),controller[_0x6719('0xf')]);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 5b115b2..a897f78 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 _0x2db5=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2db5,0x187));var _0x52db=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0x2db5[_0x3b19ea];return _0x40ece9;};'use strict';var Sequelize=require(_0x52db('0x0'));module[_0x52db('0x1')]={'name':{'type':Sequelize[_0x52db('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x0e80=['STRING','sequelize','exports','name'];(function(_0xa483e4,_0x24b223){var _0x2bc1b2=function(_0x128044){while(--_0x128044){_0xa483e4['push'](_0xa483e4['shift']());}};_0x2bc1b2(++_0x24b223);}(_0x0e80,0x1ad));var _0x00e8=function(_0x4c6539,_0x2993e6){_0x4c6539=_0x4c6539-0x0;var _0x35d491=_0x0e80[_0x4c6539];return _0x35d491;};'use strict';var Sequelize=require(_0x00e8('0x0'));module[_0x00e8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x00e8('0x2')},'description':{'type':Sequelize[_0x00e8('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 9c0886b..7803a61 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 _0x9adb=['get','Contexts','UserProfileResource','sendStatus','send','index','map','VoiceContext','rawAttributes','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','utf8','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','desk.js','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','client','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','save','destroy'];(function(_0x38ae4f,_0x469241){var _0x487f13=function(_0xc3c47b){while(--_0xc3c47b){_0x38ae4f['push'](_0x38ae4f['shift']());}};_0x487f13(++_0x469241);}(_0x9adb,0x1b8));var _0xb9ad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9adb[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xb9ad('0x0'));var rimraf=require(_0xb9ad('0x1'));var zipdir=require(_0xb9ad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9ad('0x3'));var moment=require(_0xb9ad('0x4'));var BPromise=require(_0xb9ad('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb9ad('0x6'));var sox=require(_0xb9ad('0x7'));var csv=require(_0xb9ad('0x8'));var ejs=require(_0xb9ad('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb9ad('0xa'));var crypto=require(_0xb9ad('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb9ad('0xc'));var toCsv=require(_0xb9ad('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb9ad('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9ad('0xe'));var logger=require('../../config/logger')(_0xb9ad('0xf'));var utils=require('../../config/utils');var config=require(_0xb9ad('0x10'));var licenseUtil=require(_0xb9ad('0x11'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xb9ad('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a94b1,_0x3eebfa,_0x53fc05,_0x738351){return new BPromise(function(_0x5d8b30,_0x1e2383){var _0x42363a=_0x738351||client;return _0x42363a['request'](_0x2a94b1,_0x53fc05)[_0xb9ad('0x13')](function(_0x390541){logger[_0xb9ad('0x14')](_0xb9ad('0x15'),_0x3eebfa,_0xb9ad('0x16'));logger['debug'](_0xb9ad('0x17'),_0x3eebfa,_0xb9ad('0x16'),JSON[_0xb9ad('0x18')](_0x390541));if(_0x390541['error']){if(_0x390541[_0xb9ad('0x19')][_0xb9ad('0x1a')]===0x1f4){logger[_0xb9ad('0x19')](_0xb9ad('0x15'),_0x3eebfa,_0x390541[_0xb9ad('0x19')]['message']);return _0x1e2383(_0x390541[_0xb9ad('0x19')][_0xb9ad('0x1b')]);}logger[_0xb9ad('0x19')](_0xb9ad('0x15'),_0x3eebfa,_0x390541[_0xb9ad('0x19')][_0xb9ad('0x1b')]);return _0x5d8b30(_0x390541[_0xb9ad('0x19')][_0xb9ad('0x1b')]);}else{logger['info'](_0xb9ad('0x15'),_0x3eebfa,_0xb9ad('0x16'));_0x5d8b30(_0x390541['result'][_0xb9ad('0x1b')]);}})['catch'](function(_0x3e00a9){logger[_0xb9ad('0x19')](_0xb9ad('0x15'),_0x3eebfa,_0x3e00a9);_0x1e2383(_0x3e00a9);});});}function respondWithStatusCode(_0x13de0c,_0xad3e5a){_0xad3e5a=_0xad3e5a||0xcc;return function(_0x530af5){if(_0x530af5){return _0x13de0c['sendStatus'](_0xad3e5a);}return _0x13de0c['status'](_0xad3e5a)[_0xb9ad('0x1c')]();};}function respondWithResult(_0x5d252f,_0x10401b){_0x10401b=_0x10401b||0xc8;return function(_0x183a03){if(_0x183a03){return _0x5d252f[_0xb9ad('0x1d')](_0x10401b)['json'](_0x183a03);}};}function respondWithFilteredResult(_0x21d208,_0x3b586f){return function(_0x56baef){if(_0x56baef){var _0x3b8653=typeof _0x3b586f[_0xb9ad('0x1e')]===_0xb9ad('0x1f')&&typeof _0x3b586f['limit']===_0xb9ad('0x1f');var _0x5c336f=_0x56baef[_0xb9ad('0x20')];var _0x197db1=_0x3b8653?0x0:_0x3b586f['offset'];var _0x55d213=_0x3b8653?_0x56baef[_0xb9ad('0x20')]:_0x3b586f['offset']+_0x3b586f[_0xb9ad('0x21')];var _0x192018;if(_0x55d213>=_0x5c336f){_0x55d213=_0x5c336f;_0x192018=0xc8;}else{_0x192018=0xce;}_0x21d208[_0xb9ad('0x1d')](_0x192018);return _0x21d208[_0xb9ad('0x22')](_0xb9ad('0x23'),_0x197db1+'-'+_0x55d213+'/'+_0x5c336f)[_0xb9ad('0x24')](_0x56baef);}return null;};}function patchUpdates(_0x243eee){return function(_0x56553d){try{jsonpatch[_0xb9ad('0x25')](_0x56553d,_0x243eee,!![]);}catch(_0x4e06af){return BPromise['reject'](_0x4e06af);}return _0x56553d[_0xb9ad('0x26')]();};}function saveUpdates(_0x7c533d,_0x5117cd){return function(_0x21c375){if(_0x21c375){return _0x21c375['update'](_0x7c533d)[_0xb9ad('0x13')](function(_0x124fa4){return _0x124fa4;});}return null;};}function removeEntity(_0x3cc50,_0x19e4df){return function(_0x28fcab){if(_0x28fcab){return _0x28fcab[_0xb9ad('0x27')]()[_0xb9ad('0x13')](function(){var _0x23fed0=_0x28fcab[_0xb9ad('0x28')]({'plain':!![]});var _0x3ce975=_0xb9ad('0x29');return db[_0xb9ad('0x2a')]['destroy']({'where':{'type':_0x3ce975,'resourceId':_0x23fed0['id']}})[_0xb9ad('0x13')](function(){return _0x28fcab;});})[_0xb9ad('0x13')](function(){_0x3cc50[_0xb9ad('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x67ea58,_0x259dc8){return function(_0x41280d){if(!_0x41280d){_0x67ea58[_0xb9ad('0x2b')](0x194);}return _0x41280d;};}function handleError(_0x38d6e0,_0x90c2ff){_0x90c2ff=_0x90c2ff||0x1f4;return function(_0x3da8d7){logger[_0xb9ad('0x19')](_0x3da8d7['stack']);if(_0x3da8d7['name']){delete _0x3da8d7['name'];}_0x38d6e0[_0xb9ad('0x1d')](_0x90c2ff)[_0xb9ad('0x2c')](_0x3da8d7);};}exports[_0xb9ad('0x2d')]=function(_0x1744fb,_0x44f7ce){var _0x4a2e1f={},_0x185cb6={},_0x15629e={'count':0x0,'rows':[]};var _0xff954d=_[_0xb9ad('0x2e')](db[_0xb9ad('0x2f')][_0xb9ad('0x30')],function(_0x913f55){return{'name':_0x913f55['fieldName'],'type':_0x913f55['type'][_0xb9ad('0x31')]};});_0x185cb6[_0xb9ad('0x32')]=_[_0xb9ad('0x2e')](_0xff954d,'name');_0x185cb6[_0xb9ad('0x33')]=_['keys'](_0x1744fb['query']);_0x185cb6['filters']=_[_0xb9ad('0x34')](_0x185cb6[_0xb9ad('0x32')],_0x185cb6['query']);_0x4a2e1f[_0xb9ad('0x35')]=_[_0xb9ad('0x34')](_0x185cb6['model'],qs[_0xb9ad('0x36')](_0x1744fb[_0xb9ad('0x33')][_0xb9ad('0x36')]));_0x4a2e1f[_0xb9ad('0x35')]=_0x4a2e1f[_0xb9ad('0x35')][_0xb9ad('0x37')]?_0x4a2e1f['attributes']:_0x185cb6[_0xb9ad('0x32')];if(!_0x1744fb[_0xb9ad('0x33')]['hasOwnProperty'](_0xb9ad('0x38'))){_0x4a2e1f['limit']=qs[_0xb9ad('0x21')](_0x1744fb[_0xb9ad('0x33')]['limit']);_0x4a2e1f['offset']=qs['offset'](_0x1744fb[_0xb9ad('0x33')][_0xb9ad('0x1e')]);}_0x4a2e1f[_0xb9ad('0x39')]=qs[_0xb9ad('0x3a')](_0x1744fb[_0xb9ad('0x33')][_0xb9ad('0x3a')]);_0x4a2e1f[_0xb9ad('0x3b')]=qs[_0xb9ad('0x3c')](_[_0xb9ad('0x3d')](_0x1744fb['query'],_0x185cb6['filters']),_0xff954d);if(_0x1744fb[_0xb9ad('0x33')][_0xb9ad('0x3e')]){_0x4a2e1f[_0xb9ad('0x3b')]=_[_0xb9ad('0x3f')](_0x4a2e1f[_0xb9ad('0x3b')],{'$or':_['map'](_0xff954d,function(_0x2b0ca3){if(_0x2b0ca3[_0xb9ad('0x40')]!==_0xb9ad('0x41')){var _0x56587a={};_0x56587a[_0x2b0ca3[_0xb9ad('0x42')]]={'$like':'%'+_0x1744fb['query'][_0xb9ad('0x3e')]+'%'};return _0x56587a;}})});}_0x4a2e1f=_['merge']({},_0x4a2e1f,_0x1744fb[_0xb9ad('0x43')]);var _0xdefd7a={'where':_0x4a2e1f[_0xb9ad('0x3b')]};return db[_0xb9ad('0x2f')][_0xb9ad('0x20')](_0xdefd7a)[_0xb9ad('0x13')](function(_0x3de3be){_0x15629e[_0xb9ad('0x20')]=_0x3de3be;if(_0x1744fb[_0xb9ad('0x33')][_0xb9ad('0x44')]){_0x4a2e1f[_0xb9ad('0x45')]=[{'all':!![]}];}return db[_0xb9ad('0x2f')][_0xb9ad('0x46')](_0x4a2e1f);})[_0xb9ad('0x13')](function(_0x4349e8){_0x15629e[_0xb9ad('0x47')]=_0x4349e8;return _0x15629e;})['then'](respondWithFilteredResult(_0x44f7ce,_0x4a2e1f))[_0xb9ad('0x48')](handleError(_0x44f7ce,null));};exports['show']=function(_0x5dbae9,_0x2c64e5){var _0x1dfe19={'raw':![],'where':{'id':_0x5dbae9[_0xb9ad('0x49')]['id']}},_0x303d2d={};_0x303d2d[_0xb9ad('0x32')]=_[_0xb9ad('0x4a')](db[_0xb9ad('0x2f')]['rawAttributes']);_0x303d2d[_0xb9ad('0x33')]=_[_0xb9ad('0x4a')](_0x5dbae9[_0xb9ad('0x33')]);_0x303d2d[_0xb9ad('0x3c')]=_[_0xb9ad('0x34')](_0x303d2d[_0xb9ad('0x32')],_0x303d2d[_0xb9ad('0x33')]);_0x1dfe19['attributes']=_[_0xb9ad('0x34')](_0x303d2d[_0xb9ad('0x32')],qs['fields'](_0x5dbae9[_0xb9ad('0x33')][_0xb9ad('0x36')]));_0x1dfe19[_0xb9ad('0x35')]=_0x1dfe19[_0xb9ad('0x35')][_0xb9ad('0x37')]?_0x1dfe19['attributes']:_0x303d2d[_0xb9ad('0x32')];if(_0x5dbae9[_0xb9ad('0x33')][_0xb9ad('0x44')]){_0x1dfe19[_0xb9ad('0x45')]=[{'all':!![]}];}_0x1dfe19=_[_0xb9ad('0x3f')]({},_0x1dfe19,_0x5dbae9[_0xb9ad('0x43')]);return db[_0xb9ad('0x2f')][_0xb9ad('0x4b')](_0x1dfe19)[_0xb9ad('0x13')](handleEntityNotFound(_0x2c64e5,null))[_0xb9ad('0x13')](respondWithResult(_0x2c64e5,null))[_0xb9ad('0x48')](handleError(_0x2c64e5,null));};exports[_0xb9ad('0x4c')]=function(_0x9966fe,_0x6dc19b,_0x40c9a2){var _0x19e0ec;return db['VoiceContext'][_0xb9ad('0x4c')](_0x9966fe[_0xb9ad('0x4d')],{'raw':!![]})[_0xb9ad('0x13')](function(_0x2a13df){_0x19e0ec=_0x2a13df;return db[_0xb9ad('0x2f')][_0xb9ad('0x46')]({'raw':!![]});})[_0xb9ad('0x13')](function(_0x2cf90f){var _0x5f013f=fs[_0xb9ad('0x4e')](path[_0xb9ad('0x4f')](config[_0xb9ad('0x50')],_0xb9ad('0x51')),'utf8');var _0x480a61=ejs[_0xb9ad('0x52')](_0x5f013f,{'contexts':_0x2cf90f||[]});fs[_0xb9ad('0x53')](_0xb9ad('0x54'),_0x480a61);})[_0xb9ad('0x13')](function(){return respondWithRpcPromise(_0xb9ad('0x55'),_0xb9ad('0x4c'),{'module':'chan_sip.so'});})[_0xb9ad('0x13')](function(){var _0x1e3099=_0x9966fe[_0xb9ad('0x56')][_0xb9ad('0x28')]({'plain':!![]});if(!_0x1e3099)throw new Error(_0xb9ad('0x57'));if(_0x1e3099[_0xb9ad('0x58')]===_0xb9ad('0x56')){var _0x3156ed=_0x19e0ec[_0xb9ad('0x28')]({'plain':!![]});return db[_0xb9ad('0x59')][_0xb9ad('0x4b')]({'where':{'name':_0xb9ad('0x29'),'userProfileId':_0x1e3099[_0xb9ad('0x5a')]},'raw':!![]})[_0xb9ad('0x13')](function(_0x2680f2){if(_0x2680f2&&_0x2680f2[_0xb9ad('0x5b')]===0x0){return db[_0xb9ad('0x2a')][_0xb9ad('0x4c')]({'name':_0x3156ed[_0xb9ad('0x42')],'resourceId':_0x3156ed['id'],'type':_0x2680f2[_0xb9ad('0x42')],'sectionId':_0x2680f2['id']},{})[_0xb9ad('0x13')](function(){return _0x19e0ec;});}else{return _0x19e0ec;}})[_0xb9ad('0x48')](function(_0x264c75){logger[_0xb9ad('0x19')](_0xb9ad('0x5c'),_0x264c75);throw _0x264c75;});}return _0x19e0ec;})[_0xb9ad('0x13')](respondWithResult(_0x6dc19b,0xc9))['catch'](handleError(_0x6dc19b,null));};exports[_0xb9ad('0x5d')]=function(_0x3390aa,_0x59cb5d,_0x53ce6a){var _0x52e5b7;return db['VoiceContext'][_0xb9ad('0x4b')]({'where':{'id':_0x3390aa[_0xb9ad('0x49')]['id']}})[_0xb9ad('0x13')](handleEntityNotFound(_0x59cb5d,null))[_0xb9ad('0x13')](saveUpdates(_0x3390aa[_0xb9ad('0x4d')],null))[_0xb9ad('0x13')](function(_0x3b02df){if(_0x3b02df){_0x52e5b7=_0x3b02df;return db[_0xb9ad('0x2f')][_0xb9ad('0x46')]({'raw':!![]});}})[_0xb9ad('0x13')](function(_0x413bf7){var _0x50d6b5=fs['readFileSync'](path[_0xb9ad('0x4f')](config[_0xb9ad('0x50')],_0xb9ad('0x51')),_0xb9ad('0x5e'));var _0x20004f=ejs[_0xb9ad('0x52')](_0x50d6b5,{'contexts':_0x413bf7||[]});fs[_0xb9ad('0x53')](_0xb9ad('0x54'),_0x20004f);})[_0xb9ad('0x13')](function(){return respondWithRpcPromise(_0xb9ad('0x55'),_0xb9ad('0x5d'),{'module':_0xb9ad('0x5f')});})[_0xb9ad('0x13')](function(){return _0x52e5b7;})[_0xb9ad('0x13')](respondWithResult(_0x59cb5d,null))[_0xb9ad('0x48')](handleError(_0x59cb5d,null));};exports['destroy']=function(_0x493f5f,_0x1ea651,_0x55e210){var _0x3b5571;return db['VoiceContext'][_0xb9ad('0x4b')]({'where':{'id':_0x493f5f[_0xb9ad('0x49')]['id']}})[_0xb9ad('0x13')](handleEntityNotFound(_0x1ea651,null))[_0xb9ad('0x13')](removeEntity(_0x1ea651,null))[_0xb9ad('0x13')](function(){return db[_0xb9ad('0x2f')][_0xb9ad('0x46')]({'raw':!![]});})['then'](function(_0x4e13a9){var _0x5c82ec=fs[_0xb9ad('0x4e')](path[_0xb9ad('0x4f')](config[_0xb9ad('0x50')],_0xb9ad('0x51')),'utf8');var _0x194c4b=ejs[_0xb9ad('0x52')](_0x5c82ec,{'contexts':_0x4e13a9});fs[_0xb9ad('0x53')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x194c4b);return respondWithRpcPromise(_0xb9ad('0x55'),'destroy',{'module':_0xb9ad('0x5f')});})['catch'](handleError(_0x1ea651,null));}; \ No newline at end of file +var _0x8f1a=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','writeFileSync','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','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','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','end','stack','name','send','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','nolimit','sort','where','pick','filter','merge','count','includeAll','include','findAll','show','fields','options','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','role','find','Contexts','userProfileId'];(function(_0x4d63db,_0x90dc10){var _0x2378fd=function(_0x164d91){while(--_0x164d91){_0x4d63db['push'](_0x4d63db['shift']());}};_0x2378fd(++_0x90dc10);}(_0x8f1a,0xd4));var _0xa8f1=function(_0xa8cbd6,_0x167435){_0xa8cbd6=_0xa8cbd6-0x0;var _0x1d2f49=_0x8f1a[_0xa8cbd6];return _0x1d2f49;};'use strict';var emlformat=require(_0xa8f1('0x0'));var rimraf=require(_0xa8f1('0x1'));var zipdir=require(_0xa8f1('0x2'));var jsonpatch=require(_0xa8f1('0x3'));var rp=require('request-promise');var moment=require(_0xa8f1('0x4'));var BPromise=require(_0xa8f1('0x5'));var Mustache=require(_0xa8f1('0x6'));var util=require('util');var path=require(_0xa8f1('0x7'));var sox=require('sox');var csv=require(_0xa8f1('0x8'));var ejs=require(_0xa8f1('0x9'));var fs=require('fs');var fs_extra=require(_0xa8f1('0xa'));var _=require(_0xa8f1('0xb'));var squel=require(_0xa8f1('0xc'));var crypto=require(_0xa8f1('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa8f1('0xe'));var Papa=require('papaparse');var Redis=require(_0xa8f1('0xf'));var authService=require(_0xa8f1('0x10'));var qs=require(_0xa8f1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa8f1('0x12'));var logger=require(_0xa8f1('0x13'))(_0xa8f1('0x14'));var utils=require(_0xa8f1('0x15'));var config=require(_0xa8f1('0x16'));var licenseUtil=require(_0xa8f1('0x17'));var db=require(_0xa8f1('0x18'))['db'];var jayson=require(_0xa8f1('0x19'));var client=jayson[_0xa8f1('0x1a')][_0xa8f1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x38227d,_0x3e9f05,_0x58d23a,_0x3051de){return new BPromise(function(_0x17784f,_0x2c58b5){var _0x32e3ca=_0x3051de||client;return _0x32e3ca[_0xa8f1('0x1c')](_0x38227d,_0x58d23a)[_0xa8f1('0x1d')](function(_0x17c925){logger[_0xa8f1('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x3e9f05,_0xa8f1('0x1f'));logger[_0xa8f1('0x20')](_0xa8f1('0x21'),_0x3e9f05,_0xa8f1('0x1f'),JSON[_0xa8f1('0x22')](_0x17c925));if(_0x17c925[_0xa8f1('0x23')]){if(_0x17c925[_0xa8f1('0x23')][_0xa8f1('0x24')]===0x1f4){logger[_0xa8f1('0x23')](_0xa8f1('0x25'),_0x3e9f05,_0x17c925['error'][_0xa8f1('0x26')]);return _0x2c58b5(_0x17c925[_0xa8f1('0x23')][_0xa8f1('0x26')]);}logger[_0xa8f1('0x23')](_0xa8f1('0x25'),_0x3e9f05,_0x17c925[_0xa8f1('0x23')]['message']);return _0x17784f(_0x17c925['error'][_0xa8f1('0x26')]);}else{logger[_0xa8f1('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x3e9f05,_0xa8f1('0x1f'));_0x17784f(_0x17c925[_0xa8f1('0x27')]['message']);}})[_0xa8f1('0x28')](function(_0x1a3a12){logger[_0xa8f1('0x23')](_0xa8f1('0x25'),_0x3e9f05,_0x1a3a12);_0x2c58b5(_0x1a3a12);});});}function respondWithStatusCode(_0x167019,_0x531a3a){_0x531a3a=_0x531a3a||0xcc;return function(_0x2d0596){if(_0x2d0596){return _0x167019[_0xa8f1('0x29')](_0x531a3a);}return _0x167019[_0xa8f1('0x2a')](_0x531a3a)['end']();};}function respondWithResult(_0x3bf9e4,_0x222877){_0x222877=_0x222877||0xc8;return function(_0xfacffc){if(_0xfacffc){return _0x3bf9e4['status'](_0x222877)[_0xa8f1('0x2b')](_0xfacffc);}};}function respondWithFilteredResult(_0x4a63e0,_0x2f1228){return function(_0x126da4){if(_0x126da4){var _0x136b44=typeof _0x2f1228[_0xa8f1('0x2c')]===_0xa8f1('0x2d')&&typeof _0x2f1228[_0xa8f1('0x2e')]===_0xa8f1('0x2d');var _0xae745d=_0x126da4['count'];var _0x298552=_0x136b44?0x0:_0x2f1228[_0xa8f1('0x2c')];var _0x262f86=_0x136b44?_0x126da4['count']:_0x2f1228[_0xa8f1('0x2c')]+_0x2f1228[_0xa8f1('0x2e')];var _0x25fc2b;if(_0x262f86>=_0xae745d){_0x262f86=_0xae745d;_0x25fc2b=0xc8;}else{_0x25fc2b=0xce;}_0x4a63e0['status'](_0x25fc2b);return _0x4a63e0['set'](_0xa8f1('0x2f'),_0x298552+'-'+_0x262f86+'/'+_0xae745d)[_0xa8f1('0x2b')](_0x126da4);}return null;};}function patchUpdates(_0x3f23c5){return function(_0x19d753){try{jsonpatch[_0xa8f1('0x30')](_0x19d753,_0x3f23c5,!![]);}catch(_0x40b966){return BPromise[_0xa8f1('0x31')](_0x40b966);}return _0x19d753[_0xa8f1('0x32')]();};}function saveUpdates(_0xedd200,_0x1bdd92){return function(_0x2952fa){if(_0x2952fa){return _0x2952fa[_0xa8f1('0x33')](_0xedd200)['then'](function(_0x12d7ca){return _0x12d7ca;});}return null;};}function removeEntity(_0x46a558,_0x18e815){return function(_0x499f9f){if(_0x499f9f){return _0x499f9f[_0xa8f1('0x34')]()['then'](function(){var _0x4ccc7c=_0x499f9f[_0xa8f1('0x35')]({'plain':!![]});var _0xb7215f='Contexts';return db[_0xa8f1('0x36')]['destroy']({'where':{'type':_0xb7215f,'resourceId':_0x4ccc7c['id']}})['then'](function(){return _0x499f9f;});})['then'](function(){_0x46a558['status'](0xcc)[_0xa8f1('0x37')]();});}};}function handleEntityNotFound(_0x52a1f1,_0x4699db){return function(_0x54fd2a){if(!_0x54fd2a){_0x52a1f1[_0xa8f1('0x29')](0x194);}return _0x54fd2a;};}function handleError(_0x162ac3,_0x5a287f){_0x5a287f=_0x5a287f||0x1f4;return function(_0x237092){logger['error'](_0x237092[_0xa8f1('0x38')]);if(_0x237092[_0xa8f1('0x39')]){delete _0x237092[_0xa8f1('0x39')];}_0x162ac3[_0xa8f1('0x2a')](_0x5a287f)[_0xa8f1('0x3a')](_0x237092);};}exports['index']=function(_0x354e93,_0x334d50){var _0x3048d2={},_0x41ccac={},_0x1f052b={'count':0x0,'rows':[]};var _0x2fe44d=_['map'](db[_0xa8f1('0x3b')][_0xa8f1('0x3c')],function(_0x13b02e){return{'name':_0x13b02e[_0xa8f1('0x3d')],'type':_0x13b02e[_0xa8f1('0x3e')][_0xa8f1('0x3f')]};});_0x41ccac[_0xa8f1('0x40')]=_[_0xa8f1('0x41')](_0x2fe44d,_0xa8f1('0x39'));_0x41ccac[_0xa8f1('0x42')]=_[_0xa8f1('0x43')](_0x354e93[_0xa8f1('0x42')]);_0x41ccac[_0xa8f1('0x44')]=_[_0xa8f1('0x45')](_0x41ccac['model'],_0x41ccac['query']);_0x3048d2[_0xa8f1('0x46')]=_[_0xa8f1('0x45')](_0x41ccac[_0xa8f1('0x40')],qs['fields'](_0x354e93[_0xa8f1('0x42')]['fields']));_0x3048d2['attributes']=_0x3048d2[_0xa8f1('0x46')]['length']?_0x3048d2[_0xa8f1('0x46')]:_0x41ccac[_0xa8f1('0x40')];if(!_0x354e93['query']['hasOwnProperty'](_0xa8f1('0x47'))){_0x3048d2[_0xa8f1('0x2e')]=qs[_0xa8f1('0x2e')](_0x354e93['query'][_0xa8f1('0x2e')]);_0x3048d2[_0xa8f1('0x2c')]=qs[_0xa8f1('0x2c')](_0x354e93[_0xa8f1('0x42')][_0xa8f1('0x2c')]);}_0x3048d2['order']=qs[_0xa8f1('0x48')](_0x354e93['query'][_0xa8f1('0x48')]);_0x3048d2[_0xa8f1('0x49')]=qs[_0xa8f1('0x44')](_[_0xa8f1('0x4a')](_0x354e93[_0xa8f1('0x42')],_0x41ccac[_0xa8f1('0x44')]),_0x2fe44d);if(_0x354e93['query'][_0xa8f1('0x4b')]){_0x3048d2['where']=_[_0xa8f1('0x4c')](_0x3048d2[_0xa8f1('0x49')],{'$or':_[_0xa8f1('0x41')](_0x2fe44d,function(_0x1c386c){if(_0x1c386c[_0xa8f1('0x3e')]!=='VIRTUAL'){var _0x5ba66b={};_0x5ba66b[_0x1c386c['name']]={'$like':'%'+_0x354e93[_0xa8f1('0x42')]['filter']+'%'};return _0x5ba66b;}})});}_0x3048d2=_[_0xa8f1('0x4c')]({},_0x3048d2,_0x354e93['options']);var _0x540cab={'where':_0x3048d2['where']};return db[_0xa8f1('0x3b')][_0xa8f1('0x4d')](_0x540cab)[_0xa8f1('0x1d')](function(_0x411f3a){_0x1f052b[_0xa8f1('0x4d')]=_0x411f3a;if(_0x354e93[_0xa8f1('0x42')][_0xa8f1('0x4e')]){_0x3048d2[_0xa8f1('0x4f')]=[{'all':!![]}];}return db[_0xa8f1('0x3b')][_0xa8f1('0x50')](_0x3048d2);})[_0xa8f1('0x1d')](function(_0x1b47c9){_0x1f052b['rows']=_0x1b47c9;return _0x1f052b;})[_0xa8f1('0x1d')](respondWithFilteredResult(_0x334d50,_0x3048d2))[_0xa8f1('0x28')](handleError(_0x334d50,null));};exports[_0xa8f1('0x51')]=function(_0x1729b1,_0x117c61){var _0xbf73e9={'raw':![],'where':{'id':_0x1729b1['params']['id']}},_0x372226={};_0x372226['model']=_[_0xa8f1('0x43')](db[_0xa8f1('0x3b')][_0xa8f1('0x3c')]);_0x372226[_0xa8f1('0x42')]=_[_0xa8f1('0x43')](_0x1729b1[_0xa8f1('0x42')]);_0x372226[_0xa8f1('0x44')]=_[_0xa8f1('0x45')](_0x372226[_0xa8f1('0x40')],_0x372226['query']);_0xbf73e9['attributes']=_['intersection'](_0x372226['model'],qs[_0xa8f1('0x52')](_0x1729b1[_0xa8f1('0x42')][_0xa8f1('0x52')]));_0xbf73e9[_0xa8f1('0x46')]=_0xbf73e9[_0xa8f1('0x46')]['length']?_0xbf73e9[_0xa8f1('0x46')]:_0x372226['model'];if(_0x1729b1[_0xa8f1('0x42')][_0xa8f1('0x4e')]){_0xbf73e9[_0xa8f1('0x4f')]=[{'all':!![]}];}_0xbf73e9=_['merge']({},_0xbf73e9,_0x1729b1[_0xa8f1('0x53')]);return db[_0xa8f1('0x3b')]['find'](_0xbf73e9)[_0xa8f1('0x1d')](handleEntityNotFound(_0x117c61,null))[_0xa8f1('0x1d')](respondWithResult(_0x117c61,null))[_0xa8f1('0x28')](handleError(_0x117c61,null));};exports[_0xa8f1('0x54')]=function(_0x47ecfa,_0x3cc074,_0x2b03a1){var _0x402efe;return db[_0xa8f1('0x3b')][_0xa8f1('0x54')](_0x47ecfa[_0xa8f1('0x55')],{'raw':!![]})[_0xa8f1('0x1d')](function(_0x54cb60){_0x402efe=_0x54cb60;return db[_0xa8f1('0x3b')]['findAll']({'raw':!![]});})[_0xa8f1('0x1d')](function(_0x1f3867){var _0x113f01=fs[_0xa8f1('0x56')](path[_0xa8f1('0x57')](config[_0xa8f1('0x58')],_0xa8f1('0x59')),_0xa8f1('0x5a'));var _0xa10c1e=ejs[_0xa8f1('0x5b')](_0x113f01,{'contexts':_0x1f3867||[]});fs['writeFileSync'](_0xa8f1('0x5c'),_0xa10c1e);})[_0xa8f1('0x1d')](function(){return respondWithRpcPromise(_0xa8f1('0x5d'),_0xa8f1('0x54'),{'module':_0xa8f1('0x5e')});})[_0xa8f1('0x1d')](function(){var _0x88b2d3=_0x47ecfa[_0xa8f1('0x5f')][_0xa8f1('0x35')]({'plain':!![]});if(!_0x88b2d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x88b2d3[_0xa8f1('0x60')]===_0xa8f1('0x5f')){var _0x43c041=_0x402efe[_0xa8f1('0x35')]({'plain':!![]});return db['UserProfileSection'][_0xa8f1('0x61')]({'where':{'name':_0xa8f1('0x62'),'userProfileId':_0x88b2d3[_0xa8f1('0x63')]},'raw':!![]})['then'](function(_0xd160b3){if(_0xd160b3&&_0xd160b3[_0xa8f1('0x64')]===0x0){return db[_0xa8f1('0x36')][_0xa8f1('0x54')]({'name':_0x43c041[_0xa8f1('0x39')],'resourceId':_0x43c041['id'],'type':_0xd160b3['name'],'sectionId':_0xd160b3['id']},{})[_0xa8f1('0x1d')](function(){return _0x402efe;});}else{return _0x402efe;}})[_0xa8f1('0x28')](function(_0x3aaae6){logger[_0xa8f1('0x23')](_0xa8f1('0x65'),_0x3aaae6);throw _0x3aaae6;});}return _0x402efe;})['then'](respondWithResult(_0x3cc074,0xc9))[_0xa8f1('0x28')](handleError(_0x3cc074,null));};exports[_0xa8f1('0x33')]=function(_0x15a51c,_0x36f2ec,_0x390b57){var _0x555d54;return db[_0xa8f1('0x3b')]['find']({'where':{'id':_0x15a51c['params']['id']}})['then'](handleEntityNotFound(_0x36f2ec,null))[_0xa8f1('0x1d')](saveUpdates(_0x15a51c[_0xa8f1('0x55')],null))['then'](function(_0x40c2cf){if(_0x40c2cf){_0x555d54=_0x40c2cf;return db['VoiceContext'][_0xa8f1('0x50')]({'raw':!![]});}})['then'](function(_0x187388){var _0x345af2=fs[_0xa8f1('0x56')](path[_0xa8f1('0x57')](config[_0xa8f1('0x58')],_0xa8f1('0x59')),_0xa8f1('0x5a'));var _0x15b33c=ejs['render'](_0x345af2,{'contexts':_0x187388||[]});fs[_0xa8f1('0x66')](_0xa8f1('0x5c'),_0x15b33c);})[_0xa8f1('0x1d')](function(){return respondWithRpcPromise(_0xa8f1('0x5d'),_0xa8f1('0x33'),{'module':_0xa8f1('0x5e')});})[_0xa8f1('0x1d')](function(){return _0x555d54;})[_0xa8f1('0x1d')](respondWithResult(_0x36f2ec,null))[_0xa8f1('0x28')](handleError(_0x36f2ec,null));};exports[_0xa8f1('0x34')]=function(_0x1e4961,_0x3913a3,_0x4a3b2d){var _0x3db8dd;return db[_0xa8f1('0x3b')][_0xa8f1('0x61')]({'where':{'id':_0x1e4961[_0xa8f1('0x67')]['id']}})[_0xa8f1('0x1d')](handleEntityNotFound(_0x3913a3,null))[_0xa8f1('0x1d')](removeEntity(_0x3913a3,null))[_0xa8f1('0x1d')](function(){return db['VoiceContext'][_0xa8f1('0x50')]({'raw':!![]});})[_0xa8f1('0x1d')](function(_0x35a7b5){var _0x21875d=fs[_0xa8f1('0x56')](path[_0xa8f1('0x57')](config['root'],_0xa8f1('0x59')),_0xa8f1('0x5a'));var _0x278df8=ejs['render'](_0x21875d,{'contexts':_0x35a7b5});fs['writeFileSync'](_0xa8f1('0x5c'),_0x278df8);return respondWithRpcPromise(_0xa8f1('0x5d'),'destroy',{'module':'chan_sip.so'});})[_0xa8f1('0x28')](handleError(_0x3913a3,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 70142d2..ae3f4ef 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 _0x27f7=['VoiceContext','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceContext.attributes','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x27f7,0x177));var _0x727f=function(_0x32953d,_0x46dc68){_0x32953d=_0x32953d-0x0;var _0x26ff99=_0x27f7[_0x32953d];return _0x26ff99;};'use strict';var _=require(_0x727f('0x0'));var util=require(_0x727f('0x1'));var logger=require(_0x727f('0x2'))(_0x727f('0x3'));var moment=require(_0x727f('0x4'));var BPromise=require(_0x727f('0x5'));var rp=require(_0x727f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x727f('0x7'));var config=require('../../config/environment');var attributes=require(_0x727f('0x8'));module['exports']=function(_0x567428,_0x216ea3){return _0x567428[_0x727f('0x9')](_0x727f('0xa'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfae2=['api','bluebird','path','../../config/environment','define','VoiceContext','voice_contexts','lodash','util','../../config/logger'];(function(_0x5a962d,_0x3c6121){var _0x4b4407=function(_0x4e241d){while(--_0x4e241d){_0x5a962d['push'](_0x5a962d['shift']());}};_0x4b4407(++_0x3c6121);}(_0xfae2,0x16f));var _0x2fae=function(_0x4d2abc,_0x29b228){_0x4d2abc=_0x4d2abc-0x0;var _0x5c4540=_0xfae2[_0x4d2abc];return _0x5c4540;};'use strict';var _=require(_0x2fae('0x0'));var util=require(_0x2fae('0x1'));var logger=require(_0x2fae('0x2'))(_0x2fae('0x3'));var moment=require('moment');var BPromise=require(_0x2fae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2fae('0x5'));var rimraf=require('rimraf');var config=require(_0x2fae('0x6'));var attributes=require('./voiceContext.attributes');module['exports']=function(_0x2e8d05,_0x4a51ed){return _0x2e8d05[_0x2fae('0x7')](_0x2fae('0x8'),attributes,{'tableName':_0x2fae('0x9'),'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 b7bb212..0ad0667 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 _0x6a47=['http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x301ff0,_0x284af6){var _0x2bb3a1=function(_0x4ab920){while(--_0x4ab920){_0x301ff0['push'](_0x301ff0['shift']());}};_0x2bb3a1(++_0x284af6);}(_0x6a47,0x84));var _0x76a4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6a47[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x76a4('0x0'));var util=require(_0x76a4('0x1'));var moment=require(_0x76a4('0x2'));var BPromise=require(_0x76a4('0x3'));var rs=require(_0x76a4('0x4'));var fs=require('fs');var Redis=require(_0x76a4('0x5'));var db=require(_0x76a4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x76a4('0x7'))(_0x76a4('0x8'));var config=require(_0x76a4('0x9'));var jayson=require(_0x76a4('0xa'));var client=jayson[_0x76a4('0xb')][_0x76a4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x481862,_0x1b5cf6,_0x46c86b){return new BPromise(function(_0x5a7cda,_0x3ced93){return client['request'](_0x481862,_0x46c86b)[_0x76a4('0xd')](function(_0x2475c5){logger[_0x76a4('0xe')](_0x76a4('0xf'),_0x1b5cf6,_0x76a4('0x10'));logger['debug'](_0x76a4('0x11'),_0x1b5cf6,_0x76a4('0x10'),JSON[_0x76a4('0x12')](_0x2475c5));if(_0x2475c5[_0x76a4('0x13')]){if(_0x2475c5[_0x76a4('0x13')][_0x76a4('0x14')]===0x1f4){logger[_0x76a4('0x13')](_0x76a4('0xf'),_0x1b5cf6,_0x2475c5[_0x76a4('0x13')]['message']);return _0x3ced93(_0x2475c5[_0x76a4('0x13')][_0x76a4('0x15')]);}logger[_0x76a4('0x13')](_0x76a4('0xf'),_0x1b5cf6,_0x2475c5['error'][_0x76a4('0x15')]);return _0x5a7cda(_0x2475c5[_0x76a4('0x13')][_0x76a4('0x15')]);}else{logger[_0x76a4('0xe')](_0x76a4('0xf'),_0x1b5cf6,_0x76a4('0x10'));_0x5a7cda(_0x2475c5[_0x76a4('0x16')][_0x76a4('0x15')]);}})[_0x76a4('0x17')](function(_0xa964aa){logger[_0x76a4('0x13')](_0x76a4('0xf'),_0x1b5cf6,_0xa964aa);_0x3ced93(_0xa964aa);});});} \ No newline at end of file +var _0x6a47=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x43eb09,_0x3c08b8){var _0x57dd37=function(_0x2fed57){while(--_0x2fed57){_0x43eb09['push'](_0x43eb09['shift']());}};_0x57dd37(++_0x3c08b8);}(_0x6a47,0x112));var _0x76a4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x6a47[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x76a4('0x0'));var util=require(_0x76a4('0x1'));var moment=require(_0x76a4('0x2'));var BPromise=require(_0x76a4('0x3'));var rs=require(_0x76a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76a4('0x5'))['db'];var utils=require(_0x76a4('0x6'));var logger=require('../../config/logger')(_0x76a4('0x7'));var config=require(_0x76a4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x76a4('0x9')][_0x76a4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x51b5c5,_0x364fe8,_0xb1de4d){return new BPromise(function(_0x53d422,_0x24a5fd){return client[_0x76a4('0xb')](_0x51b5c5,_0xb1de4d)[_0x76a4('0xc')](function(_0x557fa7){logger[_0x76a4('0xd')](_0x76a4('0xe'),_0x364fe8,_0x76a4('0xf'));logger[_0x76a4('0x10')](_0x76a4('0x11'),_0x364fe8,_0x76a4('0xf'),JSON[_0x76a4('0x12')](_0x557fa7));if(_0x557fa7[_0x76a4('0x13')]){if(_0x557fa7[_0x76a4('0x13')]['code']===0x1f4){logger[_0x76a4('0x13')](_0x76a4('0xe'),_0x364fe8,_0x557fa7[_0x76a4('0x13')]['message']);return _0x24a5fd(_0x557fa7[_0x76a4('0x13')][_0x76a4('0x14')]);}logger['error'](_0x76a4('0xe'),_0x364fe8,_0x557fa7[_0x76a4('0x13')]['message']);return _0x53d422(_0x557fa7['error'][_0x76a4('0x14')]);}else{logger[_0x76a4('0xd')]('VoiceContext,\x20%s,\x20%s',_0x364fe8,_0x76a4('0xf'));_0x53d422(_0x557fa7[_0x76a4('0x15')][_0x76a4('0x14')]);}})[_0x76a4('0x16')](function(_0x2c73f0){logger[_0x76a4('0x13')](_0x76a4('0xe'),_0x364fe8,_0x2c73f0);_0x24a5fd(_0x2c73f0);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 1b0ca41..4b25d4a 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 _0xb646=['post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x3d725f,_0x4168b9){var _0x4c9735=function(_0x2440c7){while(--_0x2440c7){_0x3d725f['push'](_0x3d725f['shift']());}};_0x4c9735(++_0x4168b9);}(_0xb646,0xae));var _0x6b64=function(_0x4c1ecb,_0x1b5c2b){_0x4c1ecb=_0x4c1ecb-0x0;var _0x5759e4=_0xb646[_0x4c1ecb];return _0x5759e4;};'use strict';var multer=require(_0x6b64('0x0'));var util=require(_0x6b64('0x1'));var path=require('path');var timeout=require(_0x6b64('0x2'));var express=require(_0x6b64('0x3'));var router=express[_0x6b64('0x4')]();var fs_extra=require(_0x6b64('0x5'));var auth=require(_0x6b64('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6b64('0x7'));router[_0x6b64('0x8')]('/',auth[_0x6b64('0x9')](),controller[_0x6b64('0xa')]);router[_0x6b64('0x8')](_0x6b64('0xb'),auth[_0x6b64('0x9')](),controller[_0x6b64('0xc')]);router[_0x6b64('0x8')](_0x6b64('0xd'),auth[_0x6b64('0x9')](),controller[_0x6b64('0xe')]);router[_0x6b64('0xf')]('/',auth[_0x6b64('0x9')](),controller[_0x6b64('0x10')]);router[_0x6b64('0x11')](_0x6b64('0xd'),auth[_0x6b64('0x9')](),controller['update']);router[_0x6b64('0x12')](_0x6b64('0xd'),auth[_0x6b64('0x9')](),controller[_0x6b64('0x13')]);module[_0x6b64('0x14')]=router; \ No newline at end of file +var _0x5eca=['update','delete','destroy','multer','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put'];(function(_0x159a79,_0x28860d){var _0x395f11=function(_0x4c65e2){while(--_0x4c65e2){_0x159a79['push'](_0x159a79['shift']());}};_0x395f11(++_0x28860d);}(_0x5eca,0x157));var _0xa5ec=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5eca[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xa5ec('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa5ec('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa5ec('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xa5ec('0x3'));var config=require(_0xa5ec('0x4'));var controller=require(_0xa5ec('0x5'));router['get']('/',auth[_0xa5ec('0x6')](),controller[_0xa5ec('0x7')]);router[_0xa5ec('0x8')](_0xa5ec('0x9'),auth[_0xa5ec('0x6')](),controller[_0xa5ec('0xa')]);router[_0xa5ec('0x8')](_0xa5ec('0xb'),auth[_0xa5ec('0x6')](),controller[_0xa5ec('0xc')]);router['post']('/',auth[_0xa5ec('0x6')](),controller['create']);router[_0xa5ec('0xd')](_0xa5ec('0xb'),auth[_0xa5ec('0x6')](),controller[_0xa5ec('0xe')]);router[_0xa5ec('0xf')](_0xa5ec('0xb'),auth[_0xa5ec('0x6')](),controller[_0xa5ec('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 8b199d8..9e23d3c 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 _0xb821=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x54f6a6,_0xde810f){var _0x37a293=function(_0x3dad2c){while(--_0x3dad2c){_0x54f6a6['push'](_0x54f6a6['shift']());}};_0x37a293(++_0xde810f);}(_0xb821,0xa7));var _0x1b82=function(_0x469144,_0x5b882f){_0x469144=_0x469144-0x0;var _0x5ee603=_0xb821[_0x469144];return _0x5ee603;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'privilege':{'type':Sequelize[_0x1b82('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1b82('0x1')]},'connectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'language':{'type':Sequelize[_0x1b82('0x1')]},'accountcode':{'type':Sequelize[_0x1b82('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1b82('0x1')]},'priority':{'type':Sequelize[_0x1b82('0x2')]},'uniqueid':{'type':Sequelize[_0x1b82('0x1')]},'linkedid':{'type':Sequelize[_0x1b82('0x1')]},'destchannel':{'type':Sequelize[_0x1b82('0x1')]},'destchannelstate':{'type':Sequelize[_0x1b82('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridname':{'type':Sequelize[_0x1b82('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'destlanguage':{'type':Sequelize[_0x1b82('0x1')]},'destaccountcode':{'type':Sequelize[_0x1b82('0x1')]},'destcontext':{'type':Sequelize[_0x1b82('0x1')]},'destexten':{'type':Sequelize[_0x1b82('0x1')]},'destpriority':{'type':Sequelize[_0x1b82('0x2')]},'destuniqueid':{'type':Sequelize[_0x1b82('0x1')]},'destlinkedid':{'type':Sequelize[_0x1b82('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x1b82('0x1')]},'starttime':{'type':Sequelize[_0x1b82('0x3')]},'answertime':{'type':Sequelize[_0x1b82('0x3')]},'endtime':{'type':Sequelize[_0x1b82('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x1b82('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x1b82('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ 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(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'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 165104d..a68e52f 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 _0x6ce2=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','save','update','then','destroy','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','map','type','VIRTUAL','options','count','includeAll','include','rows','catch','params','merge','find','create','body','describe','eml-format'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x6ce2,0xda));var _0x26ce=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x6ce2[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0x26ce('0x0'));var rimraf=require(_0x26ce('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x26ce('0x2'));var rp=require(_0x26ce('0x3'));var moment=require(_0x26ce('0x4'));var BPromise=require(_0x26ce('0x5'));var Mustache=require(_0x26ce('0x6'));var util=require(_0x26ce('0x7'));var path=require(_0x26ce('0x8'));var sox=require(_0x26ce('0x9'));var csv=require(_0x26ce('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26ce('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x26ce('0xc'));var jsforce=require(_0x26ce('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x26ce('0xe'));var Redis=require(_0x26ce('0xf'));var authService=require(_0x26ce('0x10'));var qs=require(_0x26ce('0x11'));var as=require(_0x26ce('0x12'));var hardwareService=require(_0x26ce('0x13'));var logger=require(_0x26ce('0x14'))(_0x26ce('0x15'));var utils=require(_0x26ce('0x16'));var config=require(_0x26ce('0x17'));var licenseUtil=require(_0x26ce('0x18'));var db=require(_0x26ce('0x19'))['db'];function respondWithStatusCode(_0xb68b82,_0x1677ef){_0x1677ef=_0x1677ef||0xcc;return function(_0x98111a){if(_0x98111a){return _0xb68b82[_0x26ce('0x1a')](_0x1677ef);}return _0xb68b82[_0x26ce('0x1b')](_0x1677ef)[_0x26ce('0x1c')]();};}function respondWithResult(_0x55b465,_0x234307){_0x234307=_0x234307||0xc8;return function(_0x410f97){if(_0x410f97){return _0x55b465[_0x26ce('0x1b')](_0x234307)[_0x26ce('0x1d')](_0x410f97);}};}function respondWithFilteredResult(_0x901be7,_0xbfabd3){return function(_0x537390){if(_0x537390){var _0x43e3c8=typeof _0xbfabd3[_0x26ce('0x1e')]===_0x26ce('0x1f')&&typeof _0xbfabd3[_0x26ce('0x20')]===_0x26ce('0x1f');var _0x353634=_0x537390['count'];var _0x267140=_0x43e3c8?0x0:_0xbfabd3['offset'];var _0x848f8c=_0x43e3c8?_0x537390['count']:_0xbfabd3[_0x26ce('0x1e')]+_0xbfabd3[_0x26ce('0x20')];var _0x1d54e1;if(_0x848f8c>=_0x353634){_0x848f8c=_0x353634;_0x1d54e1=0xc8;}else{_0x1d54e1=0xce;}_0x901be7[_0x26ce('0x1b')](_0x1d54e1);return _0x901be7['set'](_0x26ce('0x21'),_0x267140+'-'+_0x848f8c+'/'+_0x353634)[_0x26ce('0x1d')](_0x537390);}return null;};}function patchUpdates(_0x29e6b7){return function(_0x49fe37){try{jsonpatch['apply'](_0x49fe37,_0x29e6b7,!![]);}catch(_0x5845be){return BPromise['reject'](_0x5845be);}return _0x49fe37[_0x26ce('0x22')]();};}function saveUpdates(_0x45770d,_0x4957fb){return function(_0x24fb10){if(_0x24fb10){return _0x24fb10[_0x26ce('0x23')](_0x45770d)[_0x26ce('0x24')](function(_0x4a189d){return _0x4a189d;});}return null;};}function removeEntity(_0x2452e3,_0x325df3){return function(_0x2b9ec7){if(_0x2b9ec7){return _0x2b9ec7[_0x26ce('0x25')]()[_0x26ce('0x24')](function(){_0x2452e3[_0x26ce('0x1b')](0xcc)[_0x26ce('0x1c')]();});}};}function handleEntityNotFound(_0x1121a5,_0x2b1c96){return function(_0x10362f){if(!_0x10362f){_0x1121a5[_0x26ce('0x1a')](0x194);}return _0x10362f;};}function handleError(_0x1dcf0c,_0x3cf2e6){_0x3cf2e6=_0x3cf2e6||0x1f4;return function(_0x4ab5b8){logger[_0x26ce('0x26')](_0x4ab5b8[_0x26ce('0x27')]);if(_0x4ab5b8['name']){delete _0x4ab5b8[_0x26ce('0x28')];}_0x1dcf0c[_0x26ce('0x1b')](_0x3cf2e6)[_0x26ce('0x29')](_0x4ab5b8);};}exports[_0x26ce('0x2a')]=function(_0x629da8,_0x2965c0){var _0x5db69c={},_0x25d9d6={},_0x1c06ff={'count':0x0,'rows':[]};var _0x35db3f=_['map'](db[_0x26ce('0x2b')][_0x26ce('0x2c')],function(_0xe2ae5d){return{'name':_0xe2ae5d[_0x26ce('0x2d')],'type':_0xe2ae5d['type'][_0x26ce('0x2e')]};});_0x25d9d6[_0x26ce('0x2f')]=_['map'](_0x35db3f,'name');_0x25d9d6[_0x26ce('0x30')]=_[_0x26ce('0x31')](_0x629da8['query']);_0x25d9d6[_0x26ce('0x32')]=_['intersection'](_0x25d9d6[_0x26ce('0x2f')],_0x25d9d6[_0x26ce('0x30')]);_0x5db69c[_0x26ce('0x33')]=_[_0x26ce('0x34')](_0x25d9d6[_0x26ce('0x2f')],qs[_0x26ce('0x35')](_0x629da8[_0x26ce('0x30')]['fields']));_0x5db69c['attributes']=_0x5db69c[_0x26ce('0x33')][_0x26ce('0x36')]?_0x5db69c[_0x26ce('0x33')]:_0x25d9d6[_0x26ce('0x2f')];if(!_0x629da8['query'][_0x26ce('0x37')]('nolimit')){_0x5db69c['limit']=qs[_0x26ce('0x20')](_0x629da8[_0x26ce('0x30')][_0x26ce('0x20')]);_0x5db69c['offset']=qs[_0x26ce('0x1e')](_0x629da8[_0x26ce('0x30')][_0x26ce('0x1e')]);}_0x5db69c['order']=qs[_0x26ce('0x38')](_0x629da8[_0x26ce('0x30')][_0x26ce('0x38')]);_0x5db69c[_0x26ce('0x39')]=qs[_0x26ce('0x32')](_['pick'](_0x629da8[_0x26ce('0x30')],_0x25d9d6[_0x26ce('0x32')]),_0x35db3f);if(_0x629da8[_0x26ce('0x30')]['filter']){_0x5db69c['where']=_['merge'](_0x5db69c['where'],{'$or':_[_0x26ce('0x3a')](_0x35db3f,function(_0x12d240){if(_0x12d240[_0x26ce('0x3b')]!==_0x26ce('0x3c')){var _0xf4192e={};_0xf4192e[_0x12d240[_0x26ce('0x28')]]={'$like':'%'+_0x629da8[_0x26ce('0x30')]['filter']+'%'};return _0xf4192e;}})});}_0x5db69c=_['merge']({},_0x5db69c,_0x629da8[_0x26ce('0x3d')]);var _0x286a7d={'where':_0x5db69c[_0x26ce('0x39')]};return db[_0x26ce('0x2b')]['count'](_0x286a7d)[_0x26ce('0x24')](function(_0x1eccec){_0x1c06ff[_0x26ce('0x3e')]=_0x1eccec;if(_0x629da8['query'][_0x26ce('0x3f')]){_0x5db69c[_0x26ce('0x40')]=[{'all':!![]}];}return db[_0x26ce('0x2b')]['findAll'](_0x5db69c);})[_0x26ce('0x24')](function(_0x484f8d){_0x1c06ff[_0x26ce('0x41')]=_0x484f8d;return _0x1c06ff;})[_0x26ce('0x24')](respondWithFilteredResult(_0x2965c0,_0x5db69c))[_0x26ce('0x42')](handleError(_0x2965c0,null));};exports['show']=function(_0x21536c,_0x5a9b3d){var _0x4b752f={'raw':!![],'where':{'id':_0x21536c[_0x26ce('0x43')]['id']}},_0x18e795={};_0x18e795[_0x26ce('0x2f')]=_[_0x26ce('0x31')](db[_0x26ce('0x2b')][_0x26ce('0x2c')]);_0x18e795[_0x26ce('0x30')]=_[_0x26ce('0x31')](_0x21536c[_0x26ce('0x30')]);_0x18e795[_0x26ce('0x32')]=_['intersection'](_0x18e795['model'],_0x18e795['query']);_0x4b752f[_0x26ce('0x33')]=_[_0x26ce('0x34')](_0x18e795[_0x26ce('0x2f')],qs[_0x26ce('0x35')](_0x21536c[_0x26ce('0x30')][_0x26ce('0x35')]));_0x4b752f[_0x26ce('0x33')]=_0x4b752f[_0x26ce('0x33')][_0x26ce('0x36')]?_0x4b752f[_0x26ce('0x33')]:_0x18e795[_0x26ce('0x2f')];if(_0x21536c[_0x26ce('0x30')]['includeAll']){_0x4b752f[_0x26ce('0x40')]=[{'all':!![]}];}_0x4b752f=_[_0x26ce('0x44')]({},_0x4b752f,_0x21536c['options']);return db['VoiceDialReport'][_0x26ce('0x45')](_0x4b752f)[_0x26ce('0x24')](handleEntityNotFound(_0x5a9b3d,null))['then'](respondWithResult(_0x5a9b3d,null))['catch'](handleError(_0x5a9b3d,null));};exports[_0x26ce('0x46')]=function(_0x529443,_0x1e6385){return db[_0x26ce('0x2b')][_0x26ce('0x46')](_0x529443[_0x26ce('0x47')],{})[_0x26ce('0x24')](respondWithResult(_0x1e6385,0xc9))['catch'](handleError(_0x1e6385,null));};exports['update']=function(_0x233f29,_0x1317dd){if(_0x233f29[_0x26ce('0x47')]['id']){delete _0x233f29['body']['id'];}return db[_0x26ce('0x2b')][_0x26ce('0x45')]({'where':{'id':_0x233f29[_0x26ce('0x43')]['id']}})[_0x26ce('0x24')](handleEntityNotFound(_0x1317dd,null))[_0x26ce('0x24')](saveUpdates(_0x233f29['body'],null))[_0x26ce('0x24')](respondWithResult(_0x1317dd,null))[_0x26ce('0x42')](handleError(_0x1317dd,null));};exports['destroy']=function(_0x3492bf,_0x54c7c9){return db[_0x26ce('0x2b')]['find']({'where':{'id':_0x3492bf[_0x26ce('0x43')]['id']}})['then'](handleEntityNotFound(_0x54c7c9,null))[_0x26ce('0x24')](removeEntity(_0x54c7c9,null))[_0x26ce('0x42')](handleError(_0x54c7c9,null));};exports['describe']=function(_0x1e0ac6,_0xef995){return db[_0x26ce('0x2b')][_0x26ce('0x48')]()[_0x26ce('0x24')](respondWithResult(_0xef995,null))['catch'](handleError(_0xef995,null));}; \ No newline at end of file +var _0xf5cb=['stack','name','send','index','map','VoiceDialReport','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error'];(function(_0x2a9912,_0x2d26ab){var _0x487882=function(_0x54e15d){while(--_0x54e15d){_0x2a9912['push'](_0x2a9912['shift']());}};_0x487882(++_0x2d26ab);}(_0xf5cb,0x1a0));var _0xbf5c=function(_0x237217,_0x4a4418){_0x237217=_0x237217-0x0;var _0x31fbd4=_0xf5cb[_0x237217];return _0x31fbd4;};'use strict';var emlformat=require(_0xbf5c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf5c('0x1'));var jsonpatch=require(_0xbf5c('0x2'));var rp=require('request-promise');var moment=require(_0xbf5c('0x3'));var BPromise=require(_0xbf5c('0x4'));var Mustache=require(_0xbf5c('0x5'));var util=require(_0xbf5c('0x6'));var path=require(_0xbf5c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbf5c('0x8'));var _=require(_0xbf5c('0x9'));var squel=require(_0xbf5c('0xa'));var crypto=require(_0xbf5c('0xb'));var jsforce=require(_0xbf5c('0xc'));var deskjs=require(_0xbf5c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbf5c('0xe'));var Papa=require(_0xbf5c('0xf'));var Redis=require(_0xbf5c('0x10'));var authService=require(_0xbf5c('0x11'));var qs=require(_0xbf5c('0x12'));var as=require(_0xbf5c('0x13'));var hardwareService=require(_0xbf5c('0x14'));var logger=require(_0xbf5c('0x15'))('api');var utils=require(_0xbf5c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbf5c('0x17'));var db=require(_0xbf5c('0x18'))['db'];function respondWithStatusCode(_0x513e49,_0x39709c){_0x39709c=_0x39709c||0xcc;return function(_0x16081c){if(_0x16081c){return _0x513e49['sendStatus'](_0x39709c);}return _0x513e49[_0xbf5c('0x19')](_0x39709c)[_0xbf5c('0x1a')]();};}function respondWithResult(_0x3230c5,_0x286fe8){_0x286fe8=_0x286fe8||0xc8;return function(_0x1a7389){if(_0x1a7389){return _0x3230c5[_0xbf5c('0x19')](_0x286fe8)[_0xbf5c('0x1b')](_0x1a7389);}};}function respondWithFilteredResult(_0x154dbb,_0xaef521){return function(_0x37c708){if(_0x37c708){var _0x56c0fb=typeof _0xaef521[_0xbf5c('0x1c')]===_0xbf5c('0x1d')&&typeof _0xaef521[_0xbf5c('0x1e')]==='undefined';var _0x2af2f6=_0x37c708['count'];var _0x31af11=_0x56c0fb?0x0:_0xaef521[_0xbf5c('0x1c')];var _0xf8400a=_0x56c0fb?_0x37c708[_0xbf5c('0x1f')]:_0xaef521[_0xbf5c('0x1c')]+_0xaef521['limit'];var _0x435555;if(_0xf8400a>=_0x2af2f6){_0xf8400a=_0x2af2f6;_0x435555=0xc8;}else{_0x435555=0xce;}_0x154dbb[_0xbf5c('0x19')](_0x435555);return _0x154dbb[_0xbf5c('0x20')](_0xbf5c('0x21'),_0x31af11+'-'+_0xf8400a+'/'+_0x2af2f6)[_0xbf5c('0x1b')](_0x37c708);}return null;};}function patchUpdates(_0x202b54){return function(_0x18d858){try{jsonpatch[_0xbf5c('0x22')](_0x18d858,_0x202b54,!![]);}catch(_0xa5196c){return BPromise[_0xbf5c('0x23')](_0xa5196c);}return _0x18d858['save']();};}function saveUpdates(_0x4277cc,_0x22e176){return function(_0x2ae576){if(_0x2ae576){return _0x2ae576['update'](_0x4277cc)['then'](function(_0x54902f){return _0x54902f;});}return null;};}function removeEntity(_0x4fbbbe,_0x5c242e){return function(_0x37ed28){if(_0x37ed28){return _0x37ed28[_0xbf5c('0x24')]()[_0xbf5c('0x25')](function(){_0x4fbbbe[_0xbf5c('0x19')](0xcc)[_0xbf5c('0x1a')]();});}};}function handleEntityNotFound(_0x1488cc,_0x455a3d){return function(_0x11cd81){if(!_0x11cd81){_0x1488cc[_0xbf5c('0x26')](0x194);}return _0x11cd81;};}function handleError(_0x56ceff,_0x4944f3){_0x4944f3=_0x4944f3||0x1f4;return function(_0x38dd71){logger[_0xbf5c('0x27')](_0x38dd71[_0xbf5c('0x28')]);if(_0x38dd71['name']){delete _0x38dd71[_0xbf5c('0x29')];}_0x56ceff[_0xbf5c('0x19')](_0x4944f3)[_0xbf5c('0x2a')](_0x38dd71);};}exports[_0xbf5c('0x2b')]=function(_0x16c905,_0x2b0d3e){var _0x81cb0a={},_0x3735b0={},_0x3e7e25={'count':0x0,'rows':[]};var _0x3ccca2=_[_0xbf5c('0x2c')](db[_0xbf5c('0x2d')][_0xbf5c('0x2e')],function(_0x414c44){return{'name':_0x414c44['fieldName'],'type':_0x414c44[_0xbf5c('0x2f')]['key']};});_0x3735b0[_0xbf5c('0x30')]=_[_0xbf5c('0x2c')](_0x3ccca2,_0xbf5c('0x29'));_0x3735b0[_0xbf5c('0x31')]=_[_0xbf5c('0x32')](_0x16c905[_0xbf5c('0x31')]);_0x3735b0['filters']=_['intersection'](_0x3735b0[_0xbf5c('0x30')],_0x3735b0['query']);_0x81cb0a[_0xbf5c('0x33')]=_[_0xbf5c('0x34')](_0x3735b0[_0xbf5c('0x30')],qs[_0xbf5c('0x35')](_0x16c905[_0xbf5c('0x31')][_0xbf5c('0x35')]));_0x81cb0a[_0xbf5c('0x33')]=_0x81cb0a['attributes'][_0xbf5c('0x36')]?_0x81cb0a[_0xbf5c('0x33')]:_0x3735b0[_0xbf5c('0x30')];if(!_0x16c905['query'][_0xbf5c('0x37')]('nolimit')){_0x81cb0a['limit']=qs['limit'](_0x16c905[_0xbf5c('0x31')][_0xbf5c('0x1e')]);_0x81cb0a['offset']=qs[_0xbf5c('0x1c')](_0x16c905[_0xbf5c('0x31')][_0xbf5c('0x1c')]);}_0x81cb0a[_0xbf5c('0x38')]=qs['sort'](_0x16c905['query'][_0xbf5c('0x39')]);_0x81cb0a['where']=qs['filters'](_[_0xbf5c('0x3a')](_0x16c905[_0xbf5c('0x31')],_0x3735b0[_0xbf5c('0x3b')]),_0x3ccca2);if(_0x16c905['query']['filter']){_0x81cb0a[_0xbf5c('0x3c')]=_[_0xbf5c('0x3d')](_0x81cb0a[_0xbf5c('0x3c')],{'$or':_['map'](_0x3ccca2,function(_0x565a3b){if(_0x565a3b['type']!==_0xbf5c('0x3e')){var _0x225495={};_0x225495[_0x565a3b[_0xbf5c('0x29')]]={'$like':'%'+_0x16c905[_0xbf5c('0x31')][_0xbf5c('0x3f')]+'%'};return _0x225495;}})});}_0x81cb0a=_[_0xbf5c('0x3d')]({},_0x81cb0a,_0x16c905[_0xbf5c('0x40')]);var _0x53976f={'where':_0x81cb0a[_0xbf5c('0x3c')]};return db[_0xbf5c('0x2d')]['count'](_0x53976f)['then'](function(_0x318614){_0x3e7e25['count']=_0x318614;if(_0x16c905[_0xbf5c('0x31')]['includeAll']){_0x81cb0a[_0xbf5c('0x41')]=[{'all':!![]}];}return db[_0xbf5c('0x2d')]['findAll'](_0x81cb0a);})['then'](function(_0x3f334f){_0x3e7e25[_0xbf5c('0x42')]=_0x3f334f;return _0x3e7e25;})['then'](respondWithFilteredResult(_0x2b0d3e,_0x81cb0a))[_0xbf5c('0x43')](handleError(_0x2b0d3e,null));};exports[_0xbf5c('0x44')]=function(_0x15eece,_0x4ba6ae){var _0x2142f2={'raw':!![],'where':{'id':_0x15eece[_0xbf5c('0x45')]['id']}},_0x242fe7={};_0x242fe7[_0xbf5c('0x30')]=_[_0xbf5c('0x32')](db[_0xbf5c('0x2d')]['rawAttributes']);_0x242fe7[_0xbf5c('0x31')]=_[_0xbf5c('0x32')](_0x15eece['query']);_0x242fe7['filters']=_[_0xbf5c('0x34')](_0x242fe7[_0xbf5c('0x30')],_0x242fe7[_0xbf5c('0x31')]);_0x2142f2[_0xbf5c('0x33')]=_[_0xbf5c('0x34')](_0x242fe7[_0xbf5c('0x30')],qs[_0xbf5c('0x35')](_0x15eece[_0xbf5c('0x31')][_0xbf5c('0x35')]));_0x2142f2['attributes']=_0x2142f2[_0xbf5c('0x33')][_0xbf5c('0x36')]?_0x2142f2[_0xbf5c('0x33')]:_0x242fe7[_0xbf5c('0x30')];if(_0x15eece[_0xbf5c('0x31')][_0xbf5c('0x46')]){_0x2142f2[_0xbf5c('0x41')]=[{'all':!![]}];}_0x2142f2=_[_0xbf5c('0x3d')]({},_0x2142f2,_0x15eece[_0xbf5c('0x40')]);return db[_0xbf5c('0x2d')][_0xbf5c('0x47')](_0x2142f2)['then'](handleEntityNotFound(_0x4ba6ae,null))[_0xbf5c('0x25')](respondWithResult(_0x4ba6ae,null))[_0xbf5c('0x43')](handleError(_0x4ba6ae,null));};exports['create']=function(_0x259613,_0x1ff809){return db[_0xbf5c('0x2d')][_0xbf5c('0x48')](_0x259613[_0xbf5c('0x49')],{})[_0xbf5c('0x25')](respondWithResult(_0x1ff809,0xc9))[_0xbf5c('0x43')](handleError(_0x1ff809,null));};exports[_0xbf5c('0x4a')]=function(_0x4269f4,_0x13a9d7){if(_0x4269f4['body']['id']){delete _0x4269f4['body']['id'];}return db['VoiceDialReport'][_0xbf5c('0x47')]({'where':{'id':_0x4269f4[_0xbf5c('0x45')]['id']}})[_0xbf5c('0x25')](handleEntityNotFound(_0x13a9d7,null))[_0xbf5c('0x25')](saveUpdates(_0x4269f4['body'],null))[_0xbf5c('0x25')](respondWithResult(_0x13a9d7,null))[_0xbf5c('0x43')](handleError(_0x13a9d7,null));};exports[_0xbf5c('0x24')]=function(_0x3298e8,_0x49deaa){return db['VoiceDialReport']['find']({'where':{'id':_0x3298e8['params']['id']}})[_0xbf5c('0x25')](handleEntityNotFound(_0x49deaa,null))[_0xbf5c('0x25')](removeEntity(_0x49deaa,null))[_0xbf5c('0x43')](handleError(_0x49deaa,null));};exports[_0xbf5c('0x4b')]=function(_0x1c8c3a,_0x8fdc86){return db[_0xbf5c('0x2d')][_0xbf5c('0x4b')]()[_0xbf5c('0x25')](respondWithResult(_0x8fdc86,null))[_0xbf5c('0x43')](handleError(_0x8fdc86,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9f87c04..bb8b4d3 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 _0x4927=['report_dial','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport'];(function(_0x3b06cf,_0x5a59c2){var _0x155d3a=function(_0x2136b8){while(--_0x2136b8){_0x3b06cf['push'](_0x3b06cf['shift']());}};_0x155d3a(++_0x5a59c2);}(_0x4927,0x122));var _0x7492=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4927[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7492('0x0'));var util=require(_0x7492('0x1'));var logger=require(_0x7492('0x2'))(_0x7492('0x3'));var moment=require(_0x7492('0x4'));var BPromise=require(_0x7492('0x5'));var rp=require(_0x7492('0x6'));var fs=require('fs');var path=require(_0x7492('0x7'));var rimraf=require(_0x7492('0x8'));var config=require(_0x7492('0x9'));var attributes=require(_0x7492('0xa'));module[_0x7492('0xb')]=function(_0x110eca,_0x276317){return _0x110eca[_0x7492('0xc')](_0x7492('0xd'),attributes,{'tableName':_0x7492('0xe'),'paranoid':![],'indexes':[{'fields':[_0x7492('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f16=['lodash','../../config/logger','api','bluebird','rimraf','exports','VoiceDialReport','uniqueid'];(function(_0x400fda,_0xb22ff5){var _0x371574=function(_0x1f629f){while(--_0x1f629f){_0x400fda['push'](_0x400fda['shift']());}};_0x371574(++_0xb22ff5);}(_0x1f16,0x190));var _0x61f1=function(_0xf9c2ad,_0x160fa5){_0xf9c2ad=_0xf9c2ad-0x0;var _0x49cf8b=_0x1f16[_0xf9c2ad];return _0x49cf8b;};'use strict';var _=require(_0x61f1('0x0'));var util=require('util');var logger=require(_0x61f1('0x1'))(_0x61f1('0x2'));var moment=require('moment');var BPromise=require(_0x61f1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x61f1('0x4'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module[_0x61f1('0x5')]=function(_0x31ccf6,_0x16b91d){return _0x31ccf6['define'](_0x61f1('0x6'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x61f1('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 04c1f74..90ce4f2 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 _0x617f=['client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','UpdateVoiceDialReport','update','where','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4b4638,_0xe99cda){var _0x59e92b=function(_0x2817ea){while(--_0x2817ea){_0x4b4638['push'](_0x4b4638['shift']());}};_0x59e92b(++_0xe99cda);}(_0x617f,0xc8));var _0xf617=function(_0x3f410b,_0xea90e7){_0x3f410b=_0x3f410b-0x0;var _0x47f61a=_0x617f[_0x3f410b];return _0x47f61a;};'use strict';var _=require(_0xf617('0x0'));var util=require('util');var moment=require(_0xf617('0x1'));var BPromise=require(_0xf617('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf617('0x3'));var db=require(_0xf617('0x4'))['db'];var utils=require(_0xf617('0x5'));var logger=require(_0xf617('0x6'))(_0xf617('0x7'));var config=require(_0xf617('0x8'));var jayson=require(_0xf617('0x9'));var client=jayson[_0xf617('0xa')][_0xf617('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15985c,_0x2327c2,_0x195c31){return new BPromise(function(_0x12fe2e,_0x4fd327){return client['request'](_0x15985c,_0x195c31)[_0xf617('0xc')](function(_0x1a3120){logger[_0xf617('0xd')](_0xf617('0xe'),_0x2327c2,_0xf617('0xf'));logger['debug'](_0xf617('0x10'),_0x2327c2,'request\x20sent',JSON[_0xf617('0x11')](_0x1a3120));if(_0x1a3120[_0xf617('0x12')]){if(_0x1a3120['error']['code']===0x1f4){logger[_0xf617('0x12')](_0xf617('0xe'),_0x2327c2,_0x1a3120['error'][_0xf617('0x13')]);return _0x4fd327(_0x1a3120[_0xf617('0x12')][_0xf617('0x13')]);}logger[_0xf617('0x12')](_0xf617('0xe'),_0x2327c2,_0x1a3120[_0xf617('0x12')][_0xf617('0x13')]);return _0x12fe2e(_0x1a3120[_0xf617('0x12')]['message']);}else{logger[_0xf617('0xd')](_0xf617('0xe'),_0x2327c2,_0xf617('0xf'));_0x12fe2e(_0x1a3120['result']['message']);}})[_0xf617('0x14')](function(_0x549309){logger[_0xf617('0x12')](_0xf617('0xe'),_0x2327c2,_0x549309);_0x4fd327(_0x549309);});});}exports[_0xf617('0x15')]=function(_0x396542){var _0x5b1c35=this;return new Promise(function(_0x2841f2,_0x2ff0e8){return db[_0xf617('0x16')]['create'](_0x396542[_0xf617('0x17')],{'raw':_0x396542[_0xf617('0x18')]?_0x396542[_0xf617('0x18')][_0xf617('0x19')]===undefined?!![]:![]:!![]})[_0xf617('0xc')](function(_0x1bd55f){logger[_0xf617('0xd')](_0xf617('0x15'),_0x396542);logger['debug'](_0xf617('0x15'),_0x396542,JSON[_0xf617('0x11')](_0x1bd55f));_0x2841f2(_0x1bd55f);})[_0xf617('0x14')](function(_0x1e9b03){logger[_0xf617('0x12')](_0xf617('0x15'),_0x1e9b03[_0xf617('0x13')],_0x396542);_0x2ff0e8(_0x5b1c35[_0xf617('0x12')](0x1f4,_0x1e9b03[_0xf617('0x13')]));});});};exports[_0xf617('0x1a')]=function(_0xb423c2){var _0x2bae2f=this;return new Promise(function(_0x58e846,_0x256abe){return db[_0xf617('0x16')][_0xf617('0x1b')](_0xb423c2[_0xf617('0x17')],{'raw':_0xb423c2['options']?_0xb423c2['options'][_0xf617('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb423c2['options']?_0xb423c2[_0xf617('0x18')][_0xf617('0x1c')]||null:null,'attributes':_0xb423c2[_0xf617('0x18')]?_0xb423c2[_0xf617('0x18')]['attributes']||null:null,'limit':_0xb423c2[_0xf617('0x18')]?_0xb423c2[_0xf617('0x18')]['limit']||null:null})['then'](function(_0x1e9c06){logger[_0xf617('0xd')](_0xf617('0x1a'),_0xb423c2);logger[_0xf617('0x1d')]('UpdateVoiceDialReport',_0xb423c2,JSON[_0xf617('0x11')](_0x1e9c06));_0x58e846(_0x1e9c06);})[_0xf617('0x14')](function(_0x35e1c0){logger[_0xf617('0x12')](_0xf617('0x1a'),_0x35e1c0[_0xf617('0x13')],_0xb423c2);_0x256abe(_0x2bae2f[_0xf617('0x12')](0x1f4,_0x35e1c0[_0xf617('0x13')]));});});}; \ No newline at end of file +var _0xdebd=['raw','UpdateVoiceDialReport','where','attributes','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','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','catch','CreateVoiceDialReport','VoiceDialReport','body','options'];(function(_0x469290,_0x3a7679){var _0x37c9f5=function(_0x389c4a){while(--_0x389c4a){_0x469290['push'](_0x469290['shift']());}};_0x37c9f5(++_0x3a7679);}(_0xdebd,0x10d));var _0xddeb=function(_0x23af29,_0x55a275){_0x23af29=_0x23af29-0x0;var _0x4aefea=_0xdebd[_0x23af29];return _0x4aefea;};'use strict';var _=require(_0xddeb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xddeb('0x1'));var rs=require(_0xddeb('0x2'));var fs=require('fs');var Redis=require(_0xddeb('0x3'));var db=require(_0xddeb('0x4'))['db'];var utils=require(_0xddeb('0x5'));var logger=require('../../config/logger')(_0xddeb('0x6'));var config=require(_0xddeb('0x7'));var jayson=require(_0xddeb('0x8'));var client=jayson[_0xddeb('0x9')][_0xddeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x157811,_0x48fba6,_0x3b205a){return new BPromise(function(_0xef91c2,_0x18e29b){return client[_0xddeb('0xb')](_0x157811,_0x3b205a)[_0xddeb('0xc')](function(_0x5c6f0b){logger[_0xddeb('0xd')](_0xddeb('0xe'),_0x48fba6,_0xddeb('0xf'));logger[_0xddeb('0x10')](_0xddeb('0x11'),_0x48fba6,_0xddeb('0xf'),JSON[_0xddeb('0x12')](_0x5c6f0b));if(_0x5c6f0b[_0xddeb('0x13')]){if(_0x5c6f0b[_0xddeb('0x13')][_0xddeb('0x14')]===0x1f4){logger[_0xddeb('0x13')](_0xddeb('0xe'),_0x48fba6,_0x5c6f0b[_0xddeb('0x13')]['message']);return _0x18e29b(_0x5c6f0b['error'][_0xddeb('0x15')]);}logger['error'](_0xddeb('0xe'),_0x48fba6,_0x5c6f0b[_0xddeb('0x13')][_0xddeb('0x15')]);return _0xef91c2(_0x5c6f0b[_0xddeb('0x13')][_0xddeb('0x15')]);}else{logger[_0xddeb('0xd')](_0xddeb('0xe'),_0x48fba6,_0xddeb('0xf'));_0xef91c2(_0x5c6f0b[_0xddeb('0x16')]['message']);}})[_0xddeb('0x17')](function(_0x107134){logger[_0xddeb('0x13')](_0xddeb('0xe'),_0x48fba6,_0x107134);_0x18e29b(_0x107134);});});}exports[_0xddeb('0x18')]=function(_0x833d7f){var _0x48d09a=this;return new Promise(function(_0x489725,_0x35a3a7){return db[_0xddeb('0x19')]['create'](_0x833d7f[_0xddeb('0x1a')],{'raw':_0x833d7f[_0xddeb('0x1b')]?_0x833d7f[_0xddeb('0x1b')][_0xddeb('0x1c')]===undefined?!![]:![]:!![]})[_0xddeb('0xc')](function(_0x35fbcd){logger[_0xddeb('0xd')]('CreateVoiceDialReport',_0x833d7f);logger['debug']('CreateVoiceDialReport',_0x833d7f,JSON[_0xddeb('0x12')](_0x35fbcd));_0x489725(_0x35fbcd);})[_0xddeb('0x17')](function(_0x176b70){logger[_0xddeb('0x13')](_0xddeb('0x18'),_0x176b70[_0xddeb('0x15')],_0x833d7f);_0x35a3a7(_0x48d09a[_0xddeb('0x13')](0x1f4,_0x176b70[_0xddeb('0x15')]));});});};exports[_0xddeb('0x1d')]=function(_0x1a21f2){var _0x49b162=this;return new Promise(function(_0x1556aa,_0xa31df9){return db[_0xddeb('0x19')]['update'](_0x1a21f2[_0xddeb('0x1a')],{'raw':_0x1a21f2[_0xddeb('0x1b')]?_0x1a21f2[_0xddeb('0x1b')][_0xddeb('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a21f2['options']?_0x1a21f2['options'][_0xddeb('0x1e')]||null:null,'attributes':_0x1a21f2[_0xddeb('0x1b')]?_0x1a21f2[_0xddeb('0x1b')][_0xddeb('0x1f')]||null:null,'limit':_0x1a21f2[_0xddeb('0x1b')]?_0x1a21f2[_0xddeb('0x1b')][_0xddeb('0x20')]||null:null})[_0xddeb('0xc')](function(_0x3245c6){logger[_0xddeb('0xd')](_0xddeb('0x1d'),_0x1a21f2);logger[_0xddeb('0x10')](_0xddeb('0x1d'),_0x1a21f2,JSON['stringify'](_0x3245c6));_0x1556aa(_0x3245c6);})['catch'](function(_0x21997c){logger['error']('UpdateVoiceDialReport',_0x21997c[_0xddeb('0x15')],_0x1a21f2);_0xa31df9(_0x49b162['error'](0x1f4,_0x21997c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index e7d9e1a..879ec70 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 _0x7730=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','/:id/applications','addApplications','delete','/:id','destroy'];(function(_0x34c17c,_0x41b739){var _0x392059=function(_0xcf14df){while(--_0xcf14df){_0x34c17c['push'](_0x34c17c['shift']());}};_0x392059(++_0x41b739);}(_0x7730,0x166));var _0x0773=function(_0x42ebba,_0x4cbf87){_0x42ebba=_0x42ebba-0x0;var _0x3fd2af=_0x7730[_0x42ebba];return _0x3fd2af;};'use strict';var multer=require(_0x0773('0x0'));var util=require(_0x0773('0x1'));var path=require('path');var timeout=require(_0x0773('0x2'));var express=require(_0x0773('0x3'));var router=express[_0x0773('0x4')]();var fs_extra=require(_0x0773('0x5'));var auth=require(_0x0773('0x6'));var interaction=require(_0x0773('0x7'));var config=require(_0x0773('0x8'));var controller=require(_0x0773('0x9'));router[_0x0773('0xa')]('/',auth[_0x0773('0xb')](),controller[_0x0773('0xc')]);router[_0x0773('0xa')]('/:id',auth[_0x0773('0xb')](),controller[_0x0773('0xd')]);router[_0x0773('0xe')]('/',auth[_0x0773('0xb')](),controller['create']);router[_0x0773('0xe')](_0x0773('0xf'),auth[_0x0773('0xb')](),controller[_0x0773('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0773('0x11')](_0x0773('0x12'),auth[_0x0773('0xb')](),controller[_0x0773('0x13')]);module[_0x0773('0x14')]=router; \ No newline at end of file +var _0x2f44=['../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','/:id/applications','addApplications','put','delete','exports','path','connect-timeout','express'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x2f44,0x12d));var _0x42f4=function(_0x4d7765,_0x2ec4bd){_0x4d7765=_0x4d7765-0x0;var _0x146c1a=_0x2f44[_0x4d7765];return _0x146c1a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x42f4('0x0'));var timeout=require(_0x42f4('0x1'));var express=require(_0x42f4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x42f4('0x3'));var interaction=require(_0x42f4('0x4'));var config=require('../../config/environment');var controller=require(_0x42f4('0x5'));router[_0x42f4('0x6')]('/',auth[_0x42f4('0x7')](),controller['index']);router[_0x42f4('0x6')](_0x42f4('0x8'),auth['isAuthenticated'](),controller[_0x42f4('0x9')]);router['post']('/',auth[_0x42f4('0x7')](),controller['create']);router[_0x42f4('0xa')](_0x42f4('0xb'),auth[_0x42f4('0x7')](),controller[_0x42f4('0xc')]);router[_0x42f4('0xd')](_0x42f4('0x8'),auth[_0x42f4('0x7')](),controller['update']);router[_0x42f4('0xe')](_0x42f4('0x8'),auth[_0x42f4('0x7')](),controller['destroy']);module[_0x42f4('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index cc13213..c390ba3 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 _0x282d=['ENUM','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','STRING','compositeIndex','NoOp'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x282d,0x1e2));var _0xd282=function(_0x48fbc5,_0x27a2ef){_0x48fbc5=_0x48fbc5-0x0;var _0x1076a7=_0x282d[_0x48fbc5];return _0x1076a7;};'use strict';var Sequelize=require(_0xd282('0x0'));module['exports']={'context':{'type':Sequelize[_0xd282('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd282('0x1')],'allowNull':![],'unique':_0xd282('0x2')},'priority':{'type':Sequelize[_0xd282('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0xd282('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xd282('0x1')],'allowNull':![],'defaultValue':_0xd282('0x3')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd282('0x4')]('inbound',_0xd282('0x5'),_0xd282('0x6'),_0xd282('0x7'),_0xd282('0x8'),_0xd282('0x9'),_0xd282('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0xd282('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd282('0xb')},'IntervalId':{'type':Sequelize[_0xd282('0xc')]},'isApp':{'type':Sequelize[_0xd282('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd282('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xd282('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xd282('0xc')]},'recordingFormat':{'type':Sequelize[_0xd282('0x1')],'defaultValue':_0xd282('0xe')},'answer':{'type':Sequelize[_0xd282('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0xd282('0xf')],'get':function(_0x1a4706){return this[_0xd282('0x10')](_0xd282('0x11'));}},'alias':{'type':Sequelize[_0xd282('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x37e0=['sequelize','STRING','compositeIndex','NoOp','outbound','internal','*,*,*,*','BOOLEAN','INTEGER','wav','getDataValue','exten'];(function(_0x7c10a8,_0x1fdc2d){var _0x2c0ef5=function(_0x22a6ae){while(--_0x22a6ae){_0x7c10a8['push'](_0x7c10a8['shift']());}};_0x2c0ef5(++_0x1fdc2d);}(_0x37e0,0x138));var _0x037e=function(_0x1315ab,_0x7a5eb){_0x1315ab=_0x1315ab-0x0;var _0xf75ff5=_0x37e0[_0x1315ab];return _0xf75ff5;};'use strict';var Sequelize=require(_0x037e('0x0'));module['exports']={'context':{'type':Sequelize[_0x037e('0x1')],'allowNull':![],'unique':_0x037e('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x037e('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x037e('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x037e('0x1')],'allowNull':![],'defaultValue':_0x037e('0x3')},'appdata':{'type':Sequelize[_0x037e('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM']('inbound',_0x037e('0x4'),_0x037e('0x5'),'inbound-fax','outbound-fax','system','any'),'allowNull':![]},'description':{'type':Sequelize[_0x037e('0x1')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x037e('0x6')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x037e('0x7')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x037e('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x037e('0x7')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x037e('0x8')]},'recordingFormat':{'type':Sequelize[_0x037e('0x1')],'defaultValue':_0x037e('0x9')},'answer':{'type':Sequelize[_0x037e('0x7')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2f9f0f){return this[_0x037e('0xa')](_0x037e('0xb'));}},'alias':{'type':Sequelize[_0x037e('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 8df41f6..3efc6a8 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 _0x3c9d=['./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','InboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','find','stack','name','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','startsWith','exten','concat','user','get','role','inbound','OutboundRoutes','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','findOne','sequelize','transaction','VoiceExtensionId','isApp','rewriteDial','toLowerCase','true','bulkCreate','findAndCountAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x12a890,_0x4f3cb5){var _0x1a79ef=function(_0x5723f4){while(--_0x5723f4){_0x12a890['push'](_0x12a890['shift']());}};_0x1a79ef(++_0x4f3cb5);}(_0x3c9d,0x13c));var _0xd3c9=function(_0x26e312,_0x4c0fed){_0x26e312=_0x26e312-0x0;var _0x3d73ce=_0x3c9d[_0x26e312];return _0x3d73ce;};'use strict';var emlformat=require(_0xd3c9('0x0'));var rimraf=require(_0xd3c9('0x1'));var zipdir=require(_0xd3c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd3c9('0x3'));var moment=require(_0xd3c9('0x4'));var BPromise=require(_0xd3c9('0x5'));var Mustache=require(_0xd3c9('0x6'));var util=require(_0xd3c9('0x7'));var path=require(_0xd3c9('0x8'));var sox=require(_0xd3c9('0x9'));var csv=require(_0xd3c9('0xa'));var ejs=require(_0xd3c9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3c9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd3c9('0xd'));var deskjs=require(_0xd3c9('0xe'));var toCsv=require(_0xd3c9('0xa'));var querystring=require(_0xd3c9('0xf'));var Papa=require('papaparse');var Redis=require(_0xd3c9('0x10'));var authService=require(_0xd3c9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd3c9('0x12'));var hardwareService=require(_0xd3c9('0x13'));var logger=require(_0xd3c9('0x14'))(_0xd3c9('0x15'));var utils=require('../../config/utils');var config=require(_0xd3c9('0x16'));var licenseUtil=require(_0xd3c9('0x17'));var db=require(_0xd3c9('0x18'))['db'];config[_0xd3c9('0x19')]=_[_0xd3c9('0x1a')](config[_0xd3c9('0x19')],{'host':_0xd3c9('0x1b'),'port':0x18eb});var socket=require(_0xd3c9('0x1c'))(new Redis(config[_0xd3c9('0x19')]));require(_0xd3c9('0x1d'))[_0xd3c9('0x1e')](socket);function respondWithStatusCode(_0x378ce5,_0x3e231e){_0x3e231e=_0x3e231e||0xcc;return function(_0x147fba){if(_0x147fba){return _0x378ce5[_0xd3c9('0x1f')](_0x3e231e);}return _0x378ce5[_0xd3c9('0x20')](_0x3e231e)[_0xd3c9('0x21')]();};}function respondWithResult(_0x25d50e,_0x123bb0){_0x123bb0=_0x123bb0||0xc8;return function(_0xe00be7){if(_0xe00be7){return _0x25d50e[_0xd3c9('0x20')](_0x123bb0)[_0xd3c9('0x22')](_0xe00be7);}};}function respondWithFilteredResult(_0x20324a,_0x1eb540){return function(_0x40efe9){if(_0x40efe9){var _0x571307=typeof _0x1eb540[_0xd3c9('0x23')]===_0xd3c9('0x24')&&typeof _0x1eb540['limit']==='undefined';var _0x44c123=_0x40efe9[_0xd3c9('0x25')];var _0x2dd457=_0x571307?0x0:_0x1eb540['offset'];var _0x514953=_0x571307?_0x40efe9['count']:_0x1eb540['offset']+_0x1eb540[_0xd3c9('0x26')];var _0x1813cd;if(_0x514953>=_0x44c123){_0x514953=_0x44c123;_0x1813cd=0xc8;}else{_0x1813cd=0xce;}_0x20324a[_0xd3c9('0x20')](_0x1813cd);return _0x20324a[_0xd3c9('0x27')](_0xd3c9('0x28'),_0x2dd457+'-'+_0x514953+'/'+_0x44c123)['json'](_0x40efe9);}return null;};}function patchUpdates(_0x27eddf){return function(_0x3de62f){try{jsonpatch[_0xd3c9('0x29')](_0x3de62f,_0x27eddf,!![]);}catch(_0x10e418){return BPromise[_0xd3c9('0x2a')](_0x10e418);}return _0x3de62f['save']();};}function saveUpdates(_0x51ea23,_0x1057c9){return function(_0x1e693){if(_0x1e693){return _0x1e693['update'](_0x51ea23)[_0xd3c9('0x2b')](function(_0x137e46){return _0x137e46;});}return null;};}function removeEntity(_0x40d005,_0x26f424){return function(_0x1cdbf7){if(_0x1cdbf7){return _0x1cdbf7[_0xd3c9('0x2c')]()[_0xd3c9('0x2b')](function(){var _0x39f924=_0x1cdbf7['get']({'plain':!![]});var _0x4fb413=[{'name':_0xd3c9('0x2d'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0xd3c9('0x2e'),'ignore':![]},{'name':_0xd3c9('0x2f'),'value':_0xd3c9('0x30'),'ignore':![]}];var _0x1859b0=_(_0x4fb413)[_0xd3c9('0x31')]('ignore')[_0xd3c9('0x32')]('value')[_0xd3c9('0x33')]();if(_[_0xd3c9('0x34')](_0x1859b0,_0x39f924[_0xd3c9('0x35')])){return;}var _0x3f262f=_[_0xd3c9('0x36')](_0x4fb413,['value',_0x39f924['type']])['name'];return db['UserProfileResource'][_0xd3c9('0x2c')]({'where':{'type':_0x3f262f,'resourceId':_0x39f924['id']}})[_0xd3c9('0x2b')](function(){return _0x1cdbf7;});})[_0xd3c9('0x2b')](function(){_0x40d005['status'](0xcc)[_0xd3c9('0x21')]();});}};}function handleEntityNotFound(_0x431ce8,_0x17f584){return function(_0x486604){if(!_0x486604){_0x431ce8[_0xd3c9('0x1f')](0x194);}return _0x486604;};}function handleError(_0x21acc7,_0x4e7fc1){_0x4e7fc1=_0x4e7fc1||0x1f4;return function(_0x23986d){logger['error'](_0x23986d[_0xd3c9('0x37')]);if(_0x23986d[_0xd3c9('0x38')]){delete _0x23986d[_0xd3c9('0x38')];}_0x21acc7[_0xd3c9('0x20')](_0x4e7fc1)['send'](_0x23986d);};}exports[_0xd3c9('0x39')]=function(_0x2867be,_0x3ee891){var _0x5473bd={},_0x3e06ef={},_0x118472={'count':0x0,'rows':[]};var _0x5daf47=_['map'](db[_0xd3c9('0x3a')][_0xd3c9('0x3b')],function(_0x1ddacd){return{'name':_0x1ddacd[_0xd3c9('0x3c')],'type':_0x1ddacd[_0xd3c9('0x35')][_0xd3c9('0x3d')]};});_0x3e06ef[_0xd3c9('0x3e')]=_['map'](_0x5daf47,'name');_0x3e06ef[_0xd3c9('0x3f')]=_[_0xd3c9('0x40')](_0x2867be[_0xd3c9('0x3f')]);_0x3e06ef[_0xd3c9('0x41')]=_[_0xd3c9('0x42')](_0x3e06ef[_0xd3c9('0x3e')],_0x3e06ef['query']);_0x5473bd[_0xd3c9('0x43')]=_[_0xd3c9('0x42')](_0x3e06ef[_0xd3c9('0x3e')],qs[_0xd3c9('0x44')](_0x2867be[_0xd3c9('0x3f')]['fields']));_0x5473bd[_0xd3c9('0x43')]=_0x5473bd[_0xd3c9('0x43')][_0xd3c9('0x45')]?_0x5473bd[_0xd3c9('0x43')]:_0x3e06ef['model'];if(!_0x2867be[_0xd3c9('0x3f')]['hasOwnProperty'](_0xd3c9('0x46'))){_0x5473bd[_0xd3c9('0x26')]=qs['limit'](_0x2867be[_0xd3c9('0x3f')][_0xd3c9('0x26')]);_0x5473bd[_0xd3c9('0x23')]=qs[_0xd3c9('0x23')](_0x2867be[_0xd3c9('0x3f')]['offset']);}_0x5473bd[_0xd3c9('0x47')]=qs[_0xd3c9('0x48')](_0x2867be[_0xd3c9('0x3f')]['sort']);_0x5473bd[_0xd3c9('0x49')]=qs[_0xd3c9('0x41')](_[_0xd3c9('0x4a')](_0x2867be[_0xd3c9('0x3f')],_0x3e06ef[_0xd3c9('0x41')]),_0x5daf47);if(_0x2867be[_0xd3c9('0x3f')][_0xd3c9('0x31')]){_0x5473bd['where']=_[_0xd3c9('0x4b')](_0x5473bd[_0xd3c9('0x49')],{'$or':_[_0xd3c9('0x32')](_0x5daf47,function(_0xf7be34){if(_0xf7be34['type']!==_0xd3c9('0x4c')){var _0x29888c={};_0x29888c[_0xf7be34['name']]={'$like':'%'+_0x2867be['query']['filter']+'%'};return _0x29888c;}})});}_0x5473bd=_[_0xd3c9('0x4b')]({},_0x5473bd,_0x2867be[_0xd3c9('0x4d')]);var _0x427769={'where':_0x5473bd[_0xd3c9('0x49')]};return db['VoiceExtension']['count'](_0x427769)[_0xd3c9('0x2b')](function(_0x5f09a8){_0x118472[_0xd3c9('0x25')]=_0x5f09a8;if(_0x2867be[_0xd3c9('0x3f')][_0xd3c9('0x4e')]){_0x5473bd[_0xd3c9('0x4f')]=[{'all':!![]}];}return db['VoiceExtension'][_0xd3c9('0x50')](_0x5473bd);})[_0xd3c9('0x2b')](function(_0x2af26f){_0x118472[_0xd3c9('0x51')]=_0x2af26f;return _0x118472;})[_0xd3c9('0x2b')](respondWithFilteredResult(_0x3ee891,_0x5473bd))[_0xd3c9('0x52')](handleError(_0x3ee891,null));};exports[_0xd3c9('0x53')]=function(_0x2b5d77,_0x3b52a6){var _0x2cbdd4={'raw':![],'where':{'id':_0x2b5d77[_0xd3c9('0x54')]['id']}},_0x252770={};_0x252770[_0xd3c9('0x3e')]=_[_0xd3c9('0x40')](db[_0xd3c9('0x3a')][_0xd3c9('0x3b')]);_0x252770[_0xd3c9('0x3f')]=_[_0xd3c9('0x40')](_0x2b5d77[_0xd3c9('0x3f')]);_0x252770['filters']=_[_0xd3c9('0x42')](_0x252770[_0xd3c9('0x3e')],_0x252770[_0xd3c9('0x3f')]);_0x2cbdd4['attributes']=_[_0xd3c9('0x42')](_0x252770[_0xd3c9('0x3e')],qs['fields'](_0x2b5d77[_0xd3c9('0x3f')][_0xd3c9('0x44')]));_0x2cbdd4[_0xd3c9('0x43')]=_0x2cbdd4[_0xd3c9('0x43')][_0xd3c9('0x45')]?_0x2cbdd4[_0xd3c9('0x43')]:_0x252770[_0xd3c9('0x3e')];if(_0x2b5d77[_0xd3c9('0x3f')][_0xd3c9('0x4e')]){_0x2cbdd4[_0xd3c9('0x4f')]=[{'all':!![]}];}_0x2cbdd4=_['merge']({},_0x2cbdd4,_0x2b5d77['options']);return db[_0xd3c9('0x3a')][_0xd3c9('0x36')](_0x2cbdd4)[_0xd3c9('0x2b')](handleEntityNotFound(_0x3b52a6,null))['then'](respondWithResult(_0x3b52a6,null))[_0xd3c9('0x52')](handleError(_0x3b52a6,null));};exports[_0xd3c9('0x2c')]=function(_0x27a6f9,_0x5b344f){return db[_0xd3c9('0x3a')][_0xd3c9('0x36')]({'where':{'id':_0x27a6f9[_0xd3c9('0x54')]['id']}})[_0xd3c9('0x2b')](handleEntityNotFound(_0x5b344f,null))[_0xd3c9('0x2b')](removeEntity(_0x5b344f,null))['catch'](handleError(_0x5b344f,null));};exports[_0xd3c9('0x55')]=function(_0x13ecb4,_0x403449){if(_0x13ecb4[_0xd3c9('0x56')][_0xd3c9('0x35')]===_0xd3c9('0x2e')&&!_[_0xd3c9('0x57')](_0x13ecb4[_0xd3c9('0x56')]['exten'],'_')){_0x13ecb4[_0xd3c9('0x56')][_0xd3c9('0x58')]='_'[_0xd3c9('0x59')](_0x13ecb4['body']['exten']);}return db['VoiceExtension'][_0xd3c9('0x55')](_0x13ecb4[_0xd3c9('0x56')],{'raw':![]})[_0xd3c9('0x2b')](function(_0x964e15){var _0x826aa6=_0x13ecb4[_0xd3c9('0x5a')][_0xd3c9('0x5b')]({'plain':!![]});if(!_0x826aa6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x826aa6[_0xd3c9('0x5c')]===_0xd3c9('0x5a')){var _0x32ff6c=_0x964e15[_0xd3c9('0x5b')]({'plain':!![]});var _0x338ab8=[{'name':_0xd3c9('0x2d'),'value':_0xd3c9('0x5d')},{'name':_0xd3c9('0x5e'),'value':_0xd3c9('0x2e')},{'name':_0xd3c9('0x2f'),'value':'internal'}];var _0x576365=_[_0xd3c9('0x36')](_0x338ab8,[_0xd3c9('0x33'),_0x32ff6c[_0xd3c9('0x35')]])[_0xd3c9('0x38')];return db[_0xd3c9('0x5f')]['find']({'where':{'name':_0x576365,'userProfileId':_0x826aa6[_0xd3c9('0x60')]},'raw':!![]})['then'](function(_0x40b711){if(_0x40b711&&_0x40b711['autoAssociation']===0x0){return db[_0xd3c9('0x61')][_0xd3c9('0x55')]({'name':_0x32ff6c['name'],'resourceId':_0x32ff6c['id'],'type':_0x40b711[_0xd3c9('0x38')],'sectionId':_0x40b711['id']},{})['then'](function(){return _0x964e15;});}else{return _0x964e15;}})[_0xd3c9('0x52')](function(_0x1927f7){logger[_0xd3c9('0x62')](_0xd3c9('0x63'),_0x1927f7);throw _0x1927f7;});}return _0x964e15;})[_0xd3c9('0x2b')](respondWithResult(_0x403449,0xc9))[_0xd3c9('0x52')](handleError(_0x403449,null));};exports[_0xd3c9('0x64')]=function(_0x4360a4,_0x44b1e7){if(_0x4360a4[_0xd3c9('0x56')]['id']){delete _0x4360a4[_0xd3c9('0x56')]['id'];}return db[_0xd3c9('0x3a')][_0xd3c9('0x36')]({'where':{'id':_0x4360a4[_0xd3c9('0x54')]['id']}})[_0xd3c9('0x2b')](handleEntityNotFound(_0x44b1e7,null))[_0xd3c9('0x2b')](function(_0xa1060b){if(_0xa1060b){return db[_0xd3c9('0x3a')][_0xd3c9('0x64')](_[_0xd3c9('0x4a')](_0x4360a4[_0xd3c9('0x56')],[_0xd3c9('0x58'),_0xd3c9('0x65'),_0xd3c9('0x66'),_0xd3c9('0x67'),'cutdigits',_0xd3c9('0x68'),'alias']),{'where':{'context':_0xa1060b['context'],'exten':_0xa1060b[_0xd3c9('0x58')]},'individualHooks':!![]})[_0xd3c9('0x2b')](function(_0x3eedc9){return _0x3eedc9;});}return null;})['then'](respondWithStatusCode(_0x44b1e7,null))['catch'](handleError(_0x44b1e7,null));};exports['addApplications']=function(_0x38e157,_0x2bfdd7){return db[_0xd3c9('0x3a')][_0xd3c9('0x69')]({'where':{'id':_0x38e157[_0xd3c9('0x54')]['id']}})[_0xd3c9('0x2b')](function(_0x1e8788){if(_0x1e8788){return db[_0xd3c9('0x6a')][_0xd3c9('0x6b')](function(_0x5893d4){return db[_0xd3c9('0x3a')]['destroy']({'where':{'VoiceExtensionId':_0x38e157[_0xd3c9('0x54')]['id']},'transaction':_0x5893d4})[_0xd3c9('0x2b')](function(){var _0x428333=_[_0xd3c9('0x32')](_0x38e157[_0xd3c9('0x56')],function(_0x5c1e04){_0x5c1e04[_0xd3c9('0x6c')]=_0x38e157[_0xd3c9('0x54')]['id'];_0x5c1e04[_0xd3c9('0x6d')]=!![];return _0x5c1e04;});var _0x274fa8=_0x38e157['query'][_0xd3c9('0x6e')]&&_0x38e157[_0xd3c9('0x3f')][_0xd3c9('0x6e')][_0xd3c9('0x6f')]()===_0xd3c9('0x70')?!![]:![];return _0x1e8788['createRouting'](_0x428333,_0x274fa8);})['then'](function(_0x2f8109){return db[_0xd3c9('0x3a')][_0xd3c9('0x71')](_0x2f8109,{'transaction':_0x5893d4});});})[_0xd3c9('0x2b')](function(){return db[_0xd3c9('0x3a')][_0xd3c9('0x72')]({'where':{'isApp':!![],'VoiceExtensionId':_0x38e157[_0xd3c9('0x54')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x2bfdd7,null))[_0xd3c9('0x52')](handleError(_0x2bfdd7,null));}; \ No newline at end of file +var _0x264e=['fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OutboundRoutes','InternalRoutes','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','sequelize','isApp','rewriteDial','toLowerCase','true','createRouting','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','get','InboundRoutes','inbound','outbound','ignore','map','value','includes','type','UserProfileResource','stack','name','VoiceExtension','rawAttributes'];(function(_0xb3159a,_0x155c83){var _0x33469b=function(_0x4fd3b9){while(--_0x4fd3b9){_0xb3159a['push'](_0xb3159a['shift']());}};_0x33469b(++_0x155c83);}(_0x264e,0x17d));var _0xe264=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x264e[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xe264('0x0'));var rimraf=require(_0xe264('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe264('0x2'));var rp=require(_0xe264('0x3'));var moment=require(_0xe264('0x4'));var BPromise=require(_0xe264('0x5'));var Mustache=require(_0xe264('0x6'));var util=require(_0xe264('0x7'));var path=require(_0xe264('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe264('0x9'));var fs=require('fs');var fs_extra=require(_0xe264('0xa'));var _=require(_0xe264('0xb'));var squel=require('squel');var crypto=require(_0xe264('0xc'));var jsforce=require(_0xe264('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe264('0xe'));var querystring=require(_0xe264('0xf'));var Papa=require(_0xe264('0x10'));var Redis=require(_0xe264('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe264('0x12'));var as=require(_0xe264('0x13'));var hardwareService=require(_0xe264('0x14'));var logger=require('../../config/logger')(_0xe264('0x15'));var utils=require('../../config/utils');var config=require(_0xe264('0x16'));var licenseUtil=require(_0xe264('0x17'));var db=require(_0xe264('0x18'))['db'];config[_0xe264('0x19')]=_[_0xe264('0x1a')](config[_0xe264('0x19')],{'host':_0xe264('0x1b'),'port':0x18eb});var socket=require(_0xe264('0x1c'))(new Redis(config[_0xe264('0x19')]));require(_0xe264('0x1d'))[_0xe264('0x1e')](socket);function respondWithStatusCode(_0x2d2be4,_0x56f348){_0x56f348=_0x56f348||0xcc;return function(_0x2124c5){if(_0x2124c5){return _0x2d2be4[_0xe264('0x1f')](_0x56f348);}return _0x2d2be4[_0xe264('0x20')](_0x56f348)[_0xe264('0x21')]();};}function respondWithResult(_0x57954d,_0xb67b03){_0xb67b03=_0xb67b03||0xc8;return function(_0x42293b){if(_0x42293b){return _0x57954d[_0xe264('0x20')](_0xb67b03)[_0xe264('0x22')](_0x42293b);}};}function respondWithFilteredResult(_0x2c6e53,_0x17cf5f){return function(_0x49d8fc){if(_0x49d8fc){var _0x579a2e=typeof _0x17cf5f['offset']===_0xe264('0x23')&&typeof _0x17cf5f[_0xe264('0x24')]===_0xe264('0x23');var _0x26edb0=_0x49d8fc[_0xe264('0x25')];var _0x19b622=_0x579a2e?0x0:_0x17cf5f[_0xe264('0x26')];var _0x3baa43=_0x579a2e?_0x49d8fc[_0xe264('0x25')]:_0x17cf5f[_0xe264('0x26')]+_0x17cf5f[_0xe264('0x24')];var _0x19ccc8;if(_0x3baa43>=_0x26edb0){_0x3baa43=_0x26edb0;_0x19ccc8=0xc8;}else{_0x19ccc8=0xce;}_0x2c6e53['status'](_0x19ccc8);return _0x2c6e53[_0xe264('0x27')]('Content-Range',_0x19b622+'-'+_0x3baa43+'/'+_0x26edb0)[_0xe264('0x22')](_0x49d8fc);}return null;};}function patchUpdates(_0xd4e2ed){return function(_0xe4edaf){try{jsonpatch[_0xe264('0x28')](_0xe4edaf,_0xd4e2ed,!![]);}catch(_0x111811){return BPromise[_0xe264('0x29')](_0x111811);}return _0xe4edaf['save']();};}function saveUpdates(_0x2db5c0,_0x14f911){return function(_0x370890){if(_0x370890){return _0x370890[_0xe264('0x2a')](_0x2db5c0)[_0xe264('0x2b')](function(_0x20e77){return _0x20e77;});}return null;};}function removeEntity(_0x1959b4,_0x53dc15){return function(_0x13cfa9){if(_0x13cfa9){return _0x13cfa9[_0xe264('0x2c')]()[_0xe264('0x2b')](function(){var _0x4c0e3a=_0x13cfa9[_0xe264('0x2d')]({'plain':!![]});var _0x5cd2a7=[{'name':_0xe264('0x2e'),'value':_0xe264('0x2f'),'ignore':![]},{'name':'OutboundRoutes','value':_0xe264('0x30'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x249dcf=_(_0x5cd2a7)['filter'](_0xe264('0x31'))[_0xe264('0x32')](_0xe264('0x33'))[_0xe264('0x33')]();if(_[_0xe264('0x34')](_0x249dcf,_0x4c0e3a[_0xe264('0x35')])){return;}var _0x63d844=_['find'](_0x5cd2a7,[_0xe264('0x33'),_0x4c0e3a['type']])['name'];return db[_0xe264('0x36')][_0xe264('0x2c')]({'where':{'type':_0x63d844,'resourceId':_0x4c0e3a['id']}})['then'](function(){return _0x13cfa9;});})[_0xe264('0x2b')](function(){_0x1959b4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x567362,_0x5522f9){return function(_0x5aae25){if(!_0x5aae25){_0x567362['sendStatus'](0x194);}return _0x5aae25;};}function handleError(_0x213bfc,_0x3f39da){_0x3f39da=_0x3f39da||0x1f4;return function(_0xbc580a){logger['error'](_0xbc580a[_0xe264('0x37')]);if(_0xbc580a[_0xe264('0x38')]){delete _0xbc580a[_0xe264('0x38')];}_0x213bfc[_0xe264('0x20')](_0x3f39da)['send'](_0xbc580a);};}exports['index']=function(_0x4c8e02,_0x4e2481){var _0x4d6461={},_0x224223={},_0x348e28={'count':0x0,'rows':[]};var _0xa16998=_[_0xe264('0x32')](db[_0xe264('0x39')][_0xe264('0x3a')],function(_0x34899f){return{'name':_0x34899f[_0xe264('0x3b')],'type':_0x34899f[_0xe264('0x35')][_0xe264('0x3c')]};});_0x224223[_0xe264('0x3d')]=_[_0xe264('0x32')](_0xa16998,_0xe264('0x38'));_0x224223[_0xe264('0x3e')]=_['keys'](_0x4c8e02[_0xe264('0x3e')]);_0x224223[_0xe264('0x3f')]=_['intersection'](_0x224223[_0xe264('0x3d')],_0x224223['query']);_0x4d6461['attributes']=_[_0xe264('0x40')](_0x224223[_0xe264('0x3d')],qs[_0xe264('0x41')](_0x4c8e02[_0xe264('0x3e')][_0xe264('0x41')]));_0x4d6461['attributes']=_0x4d6461[_0xe264('0x42')][_0xe264('0x43')]?_0x4d6461[_0xe264('0x42')]:_0x224223['model'];if(!_0x4c8e02[_0xe264('0x3e')]['hasOwnProperty'](_0xe264('0x44'))){_0x4d6461[_0xe264('0x24')]=qs[_0xe264('0x24')](_0x4c8e02[_0xe264('0x3e')]['limit']);_0x4d6461['offset']=qs['offset'](_0x4c8e02['query'][_0xe264('0x26')]);}_0x4d6461['order']=qs[_0xe264('0x45')](_0x4c8e02[_0xe264('0x3e')][_0xe264('0x45')]);_0x4d6461[_0xe264('0x46')]=qs[_0xe264('0x3f')](_[_0xe264('0x47')](_0x4c8e02[_0xe264('0x3e')],_0x224223['filters']),_0xa16998);if(_0x4c8e02['query'][_0xe264('0x48')]){_0x4d6461[_0xe264('0x46')]=_[_0xe264('0x49')](_0x4d6461[_0xe264('0x46')],{'$or':_[_0xe264('0x32')](_0xa16998,function(_0x48605e){if(_0x48605e[_0xe264('0x35')]!==_0xe264('0x4a')){var _0x180880={};_0x180880[_0x48605e[_0xe264('0x38')]]={'$like':'%'+_0x4c8e02[_0xe264('0x3e')][_0xe264('0x48')]+'%'};return _0x180880;}})});}_0x4d6461=_[_0xe264('0x49')]({},_0x4d6461,_0x4c8e02[_0xe264('0x4b')]);var _0x56ae03={'where':_0x4d6461[_0xe264('0x46')]};return db[_0xe264('0x39')][_0xe264('0x25')](_0x56ae03)['then'](function(_0x4bb88b){_0x348e28[_0xe264('0x25')]=_0x4bb88b;if(_0x4c8e02[_0xe264('0x3e')][_0xe264('0x4c')]){_0x4d6461[_0xe264('0x4d')]=[{'all':!![]}];}return db[_0xe264('0x39')][_0xe264('0x4e')](_0x4d6461);})['then'](function(_0x14e84b){_0x348e28[_0xe264('0x4f')]=_0x14e84b;return _0x348e28;})[_0xe264('0x2b')](respondWithFilteredResult(_0x4e2481,_0x4d6461))[_0xe264('0x50')](handleError(_0x4e2481,null));};exports[_0xe264('0x51')]=function(_0x8cb4de,_0x2acdd5){var _0x5d8701={'raw':![],'where':{'id':_0x8cb4de[_0xe264('0x52')]['id']}},_0x55ba67={};_0x55ba67['model']=_['keys'](db[_0xe264('0x39')][_0xe264('0x3a')]);_0x55ba67[_0xe264('0x3e')]=_[_0xe264('0x53')](_0x8cb4de['query']);_0x55ba67[_0xe264('0x3f')]=_[_0xe264('0x40')](_0x55ba67['model'],_0x55ba67[_0xe264('0x3e')]);_0x5d8701[_0xe264('0x42')]=_['intersection'](_0x55ba67[_0xe264('0x3d')],qs[_0xe264('0x41')](_0x8cb4de[_0xe264('0x3e')]['fields']));_0x5d8701[_0xe264('0x42')]=_0x5d8701['attributes']['length']?_0x5d8701[_0xe264('0x42')]:_0x55ba67[_0xe264('0x3d')];if(_0x8cb4de[_0xe264('0x3e')][_0xe264('0x4c')]){_0x5d8701[_0xe264('0x4d')]=[{'all':!![]}];}_0x5d8701=_['merge']({},_0x5d8701,_0x8cb4de['options']);return db[_0xe264('0x39')][_0xe264('0x54')](_0x5d8701)[_0xe264('0x2b')](handleEntityNotFound(_0x2acdd5,null))[_0xe264('0x2b')](respondWithResult(_0x2acdd5,null))[_0xe264('0x50')](handleError(_0x2acdd5,null));};exports[_0xe264('0x2c')]=function(_0x5dfd6b,_0x488bdc){return db[_0xe264('0x39')][_0xe264('0x54')]({'where':{'id':_0x5dfd6b['params']['id']}})[_0xe264('0x2b')](handleEntityNotFound(_0x488bdc,null))['then'](removeEntity(_0x488bdc,null))[_0xe264('0x50')](handleError(_0x488bdc,null));};exports[_0xe264('0x55')]=function(_0x282a4c,_0x21bbde){if(_0x282a4c['body'][_0xe264('0x35')]===_0xe264('0x30')&&!_[_0xe264('0x56')](_0x282a4c[_0xe264('0x57')][_0xe264('0x58')],'_')){_0x282a4c[_0xe264('0x57')]['exten']='_'[_0xe264('0x59')](_0x282a4c[_0xe264('0x57')]['exten']);}return db[_0xe264('0x39')]['create'](_0x282a4c['body'],{'raw':![]})[_0xe264('0x2b')](function(_0x453629){var _0x426c42=_0x282a4c[_0xe264('0x5a')]['get']({'plain':!![]});if(!_0x426c42)throw new Error(_0xe264('0x5b'));if(_0x426c42[_0xe264('0x5c')]===_0xe264('0x5a')){var _0x3a3d24=_0x453629[_0xe264('0x2d')]({'plain':!![]});var _0x4cac3a=[{'name':_0xe264('0x2e'),'value':_0xe264('0x2f')},{'name':_0xe264('0x5d'),'value':'outbound'},{'name':_0xe264('0x5e'),'value':'internal'}];var _0x7b8856=_[_0xe264('0x54')](_0x4cac3a,[_0xe264('0x33'),_0x3a3d24[_0xe264('0x35')]])['name'];return db[_0xe264('0x5f')][_0xe264('0x54')]({'where':{'name':_0x7b8856,'userProfileId':_0x426c42['userProfileId']},'raw':!![]})[_0xe264('0x2b')](function(_0x43f3d9){if(_0x43f3d9&&_0x43f3d9[_0xe264('0x60')]===0x0){return db[_0xe264('0x36')]['create']({'name':_0x3a3d24[_0xe264('0x38')],'resourceId':_0x3a3d24['id'],'type':_0x43f3d9[_0xe264('0x38')],'sectionId':_0x43f3d9['id']},{})[_0xe264('0x2b')](function(){return _0x453629;});}else{return _0x453629;}})[_0xe264('0x50')](function(_0x569174){logger[_0xe264('0x61')](_0xe264('0x62'),_0x569174);throw _0x569174;});}return _0x453629;})[_0xe264('0x2b')](respondWithResult(_0x21bbde,0xc9))[_0xe264('0x50')](handleError(_0x21bbde,null));};exports[_0xe264('0x2a')]=function(_0x4e4ead,_0x16d867){if(_0x4e4ead[_0xe264('0x57')]['id']){delete _0x4e4ead['body']['id'];}return db[_0xe264('0x39')][_0xe264('0x54')]({'where':{'id':_0x4e4ead[_0xe264('0x52')]['id']}})['then'](handleEntityNotFound(_0x16d867,null))[_0xe264('0x2b')](function(_0x2c6439){if(_0x2c6439){return db['VoiceExtension']['update'](_[_0xe264('0x47')](_0x4e4ead['body'],[_0xe264('0x58'),_0xe264('0x63'),_0xe264('0x64'),_0xe264('0x65'),_0xe264('0x66'),'mandatoryDisposition','alias']),{'where':{'context':_0x2c6439[_0xe264('0x63')],'exten':_0x2c6439['exten']},'individualHooks':!![]})['then'](function(_0x1d1647){return _0x1d1647;});}return null;})[_0xe264('0x2b')](respondWithStatusCode(_0x16d867,null))['catch'](handleError(_0x16d867,null));};exports['addApplications']=function(_0x15fc3b,_0x4d1cf1){return db[_0xe264('0x39')]['findOne']({'where':{'id':_0x15fc3b[_0xe264('0x52')]['id']}})['then'](function(_0x4f3898){if(_0x4f3898){return db[_0xe264('0x67')]['transaction'](function(_0x37d4b3){return db['VoiceExtension'][_0xe264('0x2c')]({'where':{'VoiceExtensionId':_0x15fc3b[_0xe264('0x52')]['id']},'transaction':_0x37d4b3})[_0xe264('0x2b')](function(){var _0x7c3a4=_[_0xe264('0x32')](_0x15fc3b[_0xe264('0x57')],function(_0x3e849f){_0x3e849f['VoiceExtensionId']=_0x15fc3b[_0xe264('0x52')]['id'];_0x3e849f[_0xe264('0x68')]=!![];return _0x3e849f;});var _0x547687=_0x15fc3b[_0xe264('0x3e')][_0xe264('0x69')]&&_0x15fc3b[_0xe264('0x3e')][_0xe264('0x69')][_0xe264('0x6a')]()===_0xe264('0x6b')?!![]:![];return _0x4f3898[_0xe264('0x6c')](_0x7c3a4,_0x547687);})[_0xe264('0x2b')](function(_0x5a4a06){return db['VoiceExtension']['bulkCreate'](_0x5a4a06,{'transaction':_0x37d4b3});});})[_0xe264('0x2b')](function(){return db[_0xe264('0x39')][_0xe264('0x6d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x15fc3b[_0xe264('0x52')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xe264('0x2b')](respondWithResult(_0x4d1cf1,null))[_0xe264('0x50')](handleError(_0x4d1cf1,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 2b367a3..48a9eda 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 _0x6edd=['hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x53f3ee,_0x2e86b1){var _0x3746f5=function(_0x32f51d){while(--_0x32f51d){_0x53f3ee['push'](_0x53f3ee['shift']());}};_0x3746f5(++_0x2e86b1);}(_0x6edd,0x106));var _0xd6ed=function(_0xea9a87,_0x308bee){_0xea9a87=_0xea9a87-0x0;var _0x4b69aa=_0x6edd[_0xea9a87];return _0x4b69aa;};'use strict';var EventEmitter=require(_0xd6ed('0x0'));var VoiceExtension=require(_0xd6ed('0x1'))['db'][_0xd6ed('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xd6ed('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd6ed('0x4'),'afterDestroy':_0xd6ed('0x5')};function emitEvent(_0xf13457){return function(_0x5f289e,_0xee9284,_0x291f8b){VoiceExtensionEvents[_0xd6ed('0x6')](_0xf13457+':'+_0x5f289e['id'],_0x5f289e);VoiceExtensionEvents['emit'](_0xf13457,_0x5f289e);_0x291f8b(null);};}for(var e in events){if(events[_0xd6ed('0x7')](e)){var event=events[e];VoiceExtension[_0xd6ed('0x8')](e,emitEvent(event));}}module[_0xd6ed('0x9')]=VoiceExtensionEvents; \ No newline at end of file +var _0xc85a=['VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x51b1af,_0x5ef6f4){var _0x2c4024=function(_0x4f5c2e){while(--_0x4f5c2e){_0x51b1af['push'](_0x51b1af['shift']());}};_0x2c4024(++_0x5ef6f4);}(_0xc85a,0x152));var _0xac85=function(_0x51849e,_0x472d56){_0x51849e=_0x51849e-0x0;var _0x41b935=_0xc85a[_0x51849e];return _0x41b935;};'use strict';var EventEmitter=require(_0xac85('0x0'));var VoiceExtension=require(_0xac85('0x1'))['db'][_0xac85('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xac85('0x3')](0x0);var events={'afterCreate':_0xac85('0x4'),'afterUpdate':_0xac85('0x5'),'afterDestroy':_0xac85('0x6')};function emitEvent(_0x5514e1){return function(_0x44e500,_0x19362a,_0x5d1d60){VoiceExtensionEvents[_0xac85('0x7')](_0x5514e1+':'+_0x44e500['id'],_0x44e500);VoiceExtensionEvents[_0xac85('0x7')](_0x5514e1,_0x44e500);_0x5d1d60(null);};}for(var e in events){if(events[_0xac85('0x8')](e)){var event=events[e];VoiceExtension[_0xac85('0x9')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 6f7bbb9..9e8fa25 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 _0x918d=['No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','none','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','url','split','length','name','trunk','phone','param','prefix','${EXTEN:','${EXTEN}','SIP','options','recordingFormat','indexOf','U(xcally-mixmonitor-context)','replace','join','Interval','findAll','then','interval','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','callerID','NoOp(No\x20number\x20available)','queue','includes','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','Hangup','util','lodash','./voiceExtension.attributes','models','Set','type','context','exten','alias','CDR(routeAlias)='];(function(_0x53c81a,_0xfe65a1){var _0x29ad48=function(_0x578805){while(--_0x578805){_0x53c81a['push'](_0x53c81a['shift']());}};_0x29ad48(++_0xfe65a1);}(_0x918d,0xe0));var _0xd918=function(_0x425bb1,_0x3c2dcc){_0x425bb1=_0x425bb1-0x0;var _0x2bbc48=_0x918d[_0x425bb1];return _0x2bbc48;};'use strict';var util=require(_0xd918('0x0'));var _=require(_0xd918('0x1'));var attributes=require(_0xd918('0x2'));module['exports']=function(_0x15e585){var _0x5b2f3e=_0x15e585[_0xd918('0x3')];function _0x87483e(_0x3023ad){var _0x36d0db=0x2;var _0xb59a2=[{'type':_0x3023ad['type'],'app':_0xd918('0x4'),'appdata':'CDR(type)='+_0x3023ad[_0xd918('0x5')],'context':_0x3023ad[_0xd918('0x6')],'exten':_0x3023ad[_0xd918('0x7')],'priority':_0x36d0db++,'VoiceExtensionId':_0x3023ad['id']},{'type':_0x3023ad['type'],'app':_0x3023ad[_0xd918('0x8')]?'Set':'NoOp','appdata':_0x3023ad['alias']?_0xd918('0x9')+_0x3023ad[_0xd918('0x8')]:_0xd918('0xa'),'context':_0x3023ad['context'],'exten':_0x3023ad[_0xd918('0x7')],'priority':_0x36d0db++,'VoiceExtensionId':_0x3023ad['id']}];if(_0x3023ad[_0xd918('0x5')]===_0xd918('0xb')){_0xb59a2[_0xd918('0xc')]({'type':'inbound','app':_0xd918('0x4'),'appdata':_0xd918('0xd')+_0x3023ad['id'],'context':_0x3023ad['context'],'exten':_0x3023ad[_0xd918('0x7')],'priority':_0x36d0db++,'VoiceExtensionId':_0x3023ad['id']});}_0xb59a2[_0xd918('0xc')]({'type':_0x3023ad['type'],'app':_0xd918('0x4'),'appdata':_0xd918('0xe'),'context':_0x3023ad[_0xd918('0x6')],'exten':_0x3023ad[_0xd918('0x7')],'priority':_0x36d0db++,'VoiceExtensionId':_0x3023ad['id']},{'type':_0x3023ad['type'],'app':_0xd918('0x4'),'appdata':_0xd918('0xf'),'context':_0x3023ad[_0xd918('0x6')],'exten':_0x3023ad['exten'],'priority':_0x36d0db++,'VoiceExtensionId':_0x3023ad['id']},{'type':_0x3023ad[_0xd918('0x5')],'app':'Set','appdata':_0xd918('0x10'),'context':_0x3023ad[_0xd918('0x6')],'exten':_0x3023ad[_0xd918('0x7')],'priority':_0x36d0db++,'VoiceExtensionId':_0x3023ad['id']});return _0xb59a2;}function _0x37a4b8(_0x1dcae3){var _0x336951=0x2;var _0xfb212d=[{'type':_0xd918('0x11'),'app':_0xd918('0x4'),'appdata':_0xd918('0x12'),'context':_0x1dcae3['context'],'exten':_0x1dcae3[_0xd918('0x7')],'priority':_0x336951++,'VoiceExtensionId':_0x1dcae3['id']},{'type':_0xd918('0x11'),'app':_0x1dcae3[_0xd918('0x8')]?_0xd918('0x4'):'NoOp','appdata':_0x1dcae3[_0xd918('0x8')]?_0xd918('0x9')+_0x1dcae3[_0xd918('0x8')]:_0xd918('0xa'),'context':_0x1dcae3[_0xd918('0x6')],'exten':_0x1dcae3[_0xd918('0x7')],'priority':_0x336951++,'VoiceExtensionId':_0x1dcae3['id']},{'type':'outbound','app':_0xd918('0x4'),'appdata':_0xd918('0x13')+(_0x1dcae3[_0xd918('0x14')]?'${EXTEN:'+_0x1dcae3[_0xd918('0x14')]+'}':'${EXTEN}'),'context':_0x1dcae3['context'],'exten':_0x1dcae3[_0xd918('0x7')],'priority':_0x336951++,'VoiceExtensionId':_0x1dcae3['id']},{'type':_0xd918('0x11'),'app':'Set','appdata':_0xd918('0xd')+_0x1dcae3['id'],'context':_0x1dcae3['context'],'exten':_0x1dcae3['exten'],'priority':_0x336951++,'VoiceExtensionId':_0x1dcae3['id']},{'type':_0xd918('0x11'),'app':_0xd918('0x15'),'appdata':_0xd918('0x16')+(_0x336951+0x2)+_0xd918('0x17')+(_0x336951+0x1)+')','context':_0x1dcae3['context'],'exten':_0x1dcae3[_0xd918('0x7')],'priority':_0x336951++,'VoiceExtensionId':_0x1dcae3['id']},{'type':'outbound','app':_0xd918('0x4'),'appdata':_0x1dcae3[_0xd918('0x14')]?_0xd918('0x18')+_0x1dcae3[_0xd918('0x14')]+'}':_0xd918('0x19'),'context':_0x1dcae3[_0xd918('0x6')],'exten':_0x1dcae3[_0xd918('0x7')],'priority':_0x336951++,'VoiceExtensionId':_0x1dcae3['id']},{'type':_0xd918('0x11'),'app':_0xd918('0x4'),'appdata':_0xd918('0xe'),'context':_0x1dcae3[_0xd918('0x6')],'exten':_0x1dcae3['exten'],'priority':_0x336951++,'VoiceExtensionId':_0x1dcae3['id']},{'type':_0xd918('0x11'),'app':'Set','appdata':_0xd918('0xf'),'context':_0x1dcae3[_0xd918('0x6')],'exten':_0x1dcae3[_0xd918('0x7')],'priority':_0x336951++,'VoiceExtensionId':_0x1dcae3['id']},{'type':_0xd918('0x11'),'app':'Set','appdata':_0xd918('0x10'),'context':_0x1dcae3[_0xd918('0x6')],'exten':_0x1dcae3['exten'],'priority':_0x336951++,'VoiceExtensionId':_0x1dcae3['id']},{'type':_0xd918('0x11'),'app':'Set','appdata':'outboundrouteid='+_0x1dcae3['id'],'context':_0x1dcae3[_0xd918('0x6')],'exten':_0x1dcae3['exten'],'priority':_0x336951++,'VoiceExtensionId':_0x1dcae3['id']}];if(_0x1dcae3[_0xd918('0x1a')]('recordingFormat')&&_0x1dcae3['recordingFormat']!==_0xd918('0x1b')){_0xfb212d[_0xd918('0xc')]({'type':_0xd918('0x11'),'app':_0xd918('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x1dcae3[_0xd918('0x6')],'exten':_0x1dcae3[_0xd918('0x7')],'priority':_0x336951++,'VoiceExtensionId':_0x1dcae3['id']},{'type':'outbound','app':_0xd918('0x4'),'appdata':_0xd918('0x1c')+_0x1dcae3['recordingFormat']||_0xd918('0x1d'),'context':_0x1dcae3['context'],'exten':_0x1dcae3[_0xd918('0x7')],'priority':_0x336951++,'VoiceExtensionId':_0x1dcae3['id']});}return _0xfb212d;}function _0x9b0a20(_0x1a2247){var _0x56c79a=[{'name':'trunk','param':0x0},{'name':_0xd918('0x1e'),'param':0x1},{'name':'options','param':0x2},{'name':_0xd918('0x1f'),'param':0x3}];var _0x90ad7a={};var _0x584e6e=_0x1a2247[_0xd918('0x20')](',');var _0x19e1e2=[];for(var _0x543a2a=0x0;_0x543a2a<_0x56c79a[_0xd918('0x21')];_0x543a2a++){switch(_0x56c79a[_0x543a2a][_0xd918('0x22')]){case _0xd918('0x23'):_0x90ad7a[_0xd918('0x23')]=_0x584e6e[_0x56c79a[_0x543a2a]['param']][_0xd918('0x20')]('/')[0x1];_0x90ad7a[_0xd918('0x24')]=_0x584e6e[_0x56c79a[_0x543a2a][_0xd918('0x25')]][_0xd918('0x20')]('/')[0x2];_0x90ad7a[_0xd918('0x26')]=_0x90ad7a['phone']?_0x90ad7a[_0xd918('0x24')][_0xd918('0x20')]('$')[0x0]:undefined;_0x90ad7a[_0xd918('0x24')]=route['cutdigits']?(_0x90ad7a[_0xd918('0x26')]||'')+_0xd918('0x27')+route[_0xd918('0x14')]+'}':(_0x90ad7a['prefix']||'')+_0xd918('0x28');_0x19e1e2[_0x56c79a[_0x543a2a][_0xd918('0x25')]]=[_0xd918('0x29'),_0x90ad7a['trunk'],_0x90ad7a[_0xd918('0x24')]]['join']('/');break;case _0xd918('0x2a'):_0x90ad7a[_0xd918('0x2a')]=_0x584e6e[_0x56c79a[_0x543a2a][_0xd918('0x25')]];if(route[_0xd918('0x2b')]!=='none'){if(_0x90ad7a[_0xd918('0x2a')][_0xd918('0x2c')](_0xd918('0x2d'))<0x0){_0x90ad7a[_0xd918('0x2a')]+=_0xd918('0x2d');}}else{_0x90ad7a[_0xd918('0x2a')]=_0x90ad7a[_0xd918('0x2a')][_0xd918('0x2e')](_0xd918('0x2d'),'');}_0x19e1e2[_0x56c79a[_0x543a2a][_0xd918('0x25')]]=_0x90ad7a[_0xd918('0x2a')];break;default:_0x19e1e2[_0x56c79a[_0x543a2a][_0xd918('0x25')]]=_0x584e6e[_0x56c79a[_0x543a2a][_0xd918('0x25')]];}}return _0x19e1e2[_0xd918('0x2f')](',');}function _0x1c8deb(_0x26c477,_0x9e0bd9,_0x1b81ba,_0x39e05f){return new Promise(function(_0x3f5469,_0x2be2b8){var _0xd73ca9=[];if(_['isEmpty'](_0x9e0bd9))return _0x3f5469(_0xd73ca9);_0x5b2f3e[_0xd918('0x30')][_0xd918('0x31')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xd918('0x32')](function(_0x634115){for(var _0x305edd=0x0,_0x13ec9d=0x0;_0x305edd<_0x9e0bd9[_0xd918('0x21')];_0x305edd++,_0x13ec9d=0x0){var _0x35cfd5=_0x9e0bd9[_0x305edd];var _0x57b2e9=[];var _0x438039=[];if(_0x35cfd5[_0xd918('0x33')]!=='*,*,*,*'){_0x35cfd5[_0xd918('0x34')]=[_0x35cfd5[_0xd918('0x33')]];}else{_0x35cfd5[_0xd918('0x34')]=_0x35cfd5[_0xd918('0x35')]?_[_0xd918('0x36')](_[_0xd918('0x37')](_0x634115,{'IntervalId':_0x35cfd5[_0xd918('0x35')]}),_0xd918('0x33')):[];}_0x35cfd5[_0xd918('0x6')]=_0x26c477[_0xd918('0x6')];_0x35cfd5[_0xd918('0x7')]=_0x26c477[_0xd918('0x7')];if(_0x35cfd5[_0xd918('0x5')])_0x35cfd5[_0xd918('0x5')]=_0x35cfd5['type'][_0xd918('0x38')]();if(_0x26c477[_0xd918('0x5')]==='outbound'){if(_0x35cfd5['hasOwnProperty'](_0xd918('0x39'))&&_0x35cfd5[_0xd918('0x39')]&&_0x35cfd5['tag']!=='--'){_0x57b2e9[_0xd918('0xc')]({'type':_0x35cfd5[_0xd918('0x5')][_0xd918('0x38')](),'app':_0xd918('0x4'),'appdata':_0xd918('0x3a')+_0x35cfd5[_0xd918('0x39')],'context':_0x26c477['context'],'exten':_0x26c477['exten'],'priority':_0x35cfd5['intervals'][_0xd918('0x21')]+_0x1b81ba+_0x13ec9d++,'VoiceExtensionId':_0x26c477['id']});}_0x57b2e9[_0xd918('0xc')]({'type':_0x35cfd5['type']['toLowerCase'](),'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x35cfd5[_0xd918('0x3b')]?'Set(CALLERID(all)='+_0x35cfd5[_0xd918('0x3b')]+')':_0xd918('0x3c')),'context':_0x26c477[_0xd918('0x6')],'exten':_0x26c477['exten'],'priority':_0x35cfd5[_0xd918('0x34')][_0xd918('0x21')]+_0x1b81ba+_0x13ec9d++,'VoiceExtensionId':_0x26c477['id']});}else{if(_0x35cfd5[_0xd918('0x1a')]('answer')){if([_0xd918('0x3d'),'playback'][_0xd918('0x3e')](_0x35cfd5['app'][_0xd918('0x38')]())&&_0x35cfd5[_0xd918('0x3f')]!==_0xd918('0x40')){if(_0x35cfd5[_0xd918('0x41')]){_0x57b2e9[_0xd918('0xc')]({'type':_0x35cfd5[_0xd918('0x5')][_0xd918('0x38')](),'app':_0xd918('0x15'),'appdata':_0xd918('0x42'),'context':_0x26c477['context'],'exten':_0x26c477['exten'],'priority':_0x35cfd5['intervals'][_0xd918('0x21')]+_0x1b81ba+_0x13ec9d++,'VoiceExtensionId':_0x26c477['id']});_0x57b2e9[_0xd918('0xc')]({'type':_0x35cfd5['type'][_0xd918('0x38')](),'app':_0xd918('0x4'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x26c477[_0xd918('0x6')],'exten':_0x26c477[_0xd918('0x7')],'priority':_0x35cfd5['intervals'][_0xd918('0x21')]+_0x1b81ba+_0x13ec9d++,'VoiceExtensionId':_0x26c477['id']});}else{_0x57b2e9[_0xd918('0xc')]({'type':_0x35cfd5['type']['toLowerCase'](),'app':_0xd918('0x15'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x26c477[_0xd918('0x6')],'exten':_0x26c477['exten'],'priority':_0x35cfd5[_0xd918('0x34')][_0xd918('0x21')]+_0x1b81ba+_0x13ec9d++,'VoiceExtensionId':_0x26c477['id']});_0x57b2e9[_0xd918('0xc')]({'type':_0x35cfd5[_0xd918('0x5')][_0xd918('0x38')](),'app':_0xd918('0x4'),'appdata':_0xd918('0x43'),'context':_0x26c477['context'],'exten':_0x26c477[_0xd918('0x7')],'priority':_0x35cfd5['intervals'][_0xd918('0x21')]+_0x1b81ba+_0x13ec9d++,'VoiceExtensionId':_0x26c477['id']});}}}}for(var _0x29b69f=0x0;_0x29b69f<_0x35cfd5[_0xd918('0x34')][_0xd918('0x21')];_0x29b69f++){var _0x21b71c=_0x1b81ba+_0x35cfd5[_0xd918('0x34')][_0xd918('0x21')];var _0x451a2e=_0x29b69f===_0x35cfd5[_0xd918('0x34')][_0xd918('0x21')]-0x1?_0x1b81ba+_0x57b2e9[_0xd918('0x21')]+_0x438039[_0xd918('0x21')]+0x2:_0x1b81ba+_0x29b69f+0x1;_0x57b2e9['splice'](_0x29b69f,0x0,{'type':_0x26c477[_0xd918('0x5')],'app':_0xd918('0x44'),'appdata':_0x35cfd5[_0xd918('0x34')][_0x29b69f]+'?'+_0x26c477[_0xd918('0x6')]+_0xd918('0x45')+_0x21b71c+':'+_0x26c477[_0xd918('0x6')]+_0xd918('0x45')+_0x451a2e,'exten':_0x26c477['exten'],'context':_0x26c477[_0xd918('0x6')],'priority':_0x1b81ba+_0x29b69f,'VoiceExtensionId':_0x26c477['id']});}if(_0x39e05f&&_0x35cfd5['appType']===_0xd918('0x46'))_0x35cfd5[_0xd918('0x47')]=_0x9b0a20(_0x35cfd5[_0xd918('0x47')]);_0x35cfd5[_0xd918('0x48')]=_0x57b2e9['length']?_[_0xd918('0x49')](_0x57b2e9)[_0xd918('0x48')]+0x1:_0x1b81ba;_0xd73ca9=_[_0xd918('0x4a')](_0xd73ca9,_0x57b2e9,[_0x35cfd5],_0x438039);_0x1b81ba=_[_0xd918('0x49')](_0xd73ca9)[_0xd918('0x48')]+0x1;}return _0x3f5469(_0xd73ca9);})[_0xd918('0x4b')](function(_0x3c5270){_0x2be2b8(_0x3c5270);});});}return _0x15e585[_0xd918('0x4c')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2e15b0,_0xe00336){var _0x500fd3=this;var _0x42b039=_0x500fd3['type']===_0xd918('0x11')?_0x37a4b8(_0x500fd3):_0x87483e(_0x500fd3);return _0x1c8deb(_0x500fd3,_0x2e15b0,_['last'](_0x42b039)['priority']+0x1,_0xe00336)[_0xd918('0x32')](function(_0x336abe){var _0x107e28=_[_0xd918('0x4a')](_0x42b039,_0x336abe);_0x107e28[_0xd918('0xc')]({'type':_0x500fd3[_0xd918('0x5')],'app':_0xd918('0x4d'),'exten':_0x500fd3[_0xd918('0x7')],'context':_0x500fd3[_0xd918('0x6')],'priority':_[_0xd918('0x49')](_0x107e28)[_0xd918('0x48')]+0x1,'VoiceExtensionId':_0x500fd3['id']});return _0x107e28;});}}});}; \ No newline at end of file +var _0xdfcb=['U(xcally-mixmonitor-context)','isEmpty','Interval','interval','then','*,*,*,*','intervals','IntervalId','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','includes','app','custom','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','concat','last','catch','define','VoiceExtension','voice_extensions','Hangup','util','lodash','models','type','Set','CDR(type)=','context','exten','alias','No\x20alias\x20set','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','NoOp','CDR(routeAlias)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','split','length','name','trunk','param','phone','prefix','SIP','join','indexOf'];(function(_0x11dc39,_0x491115){var _0x457277=function(_0x1d77cd){while(--_0x1d77cd){_0x11dc39['push'](_0x11dc39['shift']());}};_0x457277(++_0x491115);}(_0xdfcb,0xce));var _0xbdfc=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xdfcb[_0x725a4c];return _0x37b2cc;};'use strict';var util=require(_0xbdfc('0x0'));var _=require(_0xbdfc('0x1'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x158509){var _0x196c83=_0x158509[_0xbdfc('0x2')];function _0x41b3ca(_0x2602d7){var _0x1fc9dc=0x2;var _0x242104=[{'type':_0x2602d7[_0xbdfc('0x3')],'app':_0xbdfc('0x4'),'appdata':_0xbdfc('0x5')+_0x2602d7[_0xbdfc('0x3')],'context':_0x2602d7[_0xbdfc('0x6')],'exten':_0x2602d7[_0xbdfc('0x7')],'priority':_0x1fc9dc++,'VoiceExtensionId':_0x2602d7['id']},{'type':_0x2602d7[_0xbdfc('0x3')],'app':_0x2602d7['alias']?_0xbdfc('0x4'):'NoOp','appdata':_0x2602d7[_0xbdfc('0x8')]?'CDR(routeAlias)='+_0x2602d7[_0xbdfc('0x8')]:_0xbdfc('0x9'),'context':_0x2602d7['context'],'exten':_0x2602d7[_0xbdfc('0x7')],'priority':_0x1fc9dc++,'VoiceExtensionId':_0x2602d7['id']}];if(_0x2602d7[_0xbdfc('0x3')]===_0xbdfc('0xa')){_0x242104[_0xbdfc('0xb')]({'type':_0xbdfc('0xa'),'app':_0xbdfc('0x4'),'appdata':_0xbdfc('0xc')+_0x2602d7['id'],'context':_0x2602d7[_0xbdfc('0x6')],'exten':_0x2602d7[_0xbdfc('0x7')],'priority':_0x1fc9dc++,'VoiceExtensionId':_0x2602d7['id']});}_0x242104[_0xbdfc('0xb')]({'type':_0x2602d7[_0xbdfc('0x3')],'app':_0xbdfc('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2602d7[_0xbdfc('0x6')],'exten':_0x2602d7['exten'],'priority':_0x1fc9dc++,'VoiceExtensionId':_0x2602d7['id']},{'type':_0x2602d7[_0xbdfc('0x3')],'app':_0xbdfc('0x4'),'appdata':_0xbdfc('0xd'),'context':_0x2602d7['context'],'exten':_0x2602d7[_0xbdfc('0x7')],'priority':_0x1fc9dc++,'VoiceExtensionId':_0x2602d7['id']},{'type':_0x2602d7[_0xbdfc('0x3')],'app':_0xbdfc('0x4'),'appdata':_0xbdfc('0xe'),'context':_0x2602d7[_0xbdfc('0x6')],'exten':_0x2602d7['exten'],'priority':_0x1fc9dc++,'VoiceExtensionId':_0x2602d7['id']});return _0x242104;}function _0x24d1c5(_0x1d2380){var _0x52526c=0x2;var _0x7681f2=[{'type':'outbound','app':_0xbdfc('0x4'),'appdata':_0xbdfc('0xf'),'context':_0x1d2380['context'],'exten':_0x1d2380[_0xbdfc('0x7')],'priority':_0x52526c++,'VoiceExtensionId':_0x1d2380['id']},{'type':_0xbdfc('0x10'),'app':_0x1d2380[_0xbdfc('0x8')]?_0xbdfc('0x4'):_0xbdfc('0x11'),'appdata':_0x1d2380[_0xbdfc('0x8')]?_0xbdfc('0x12')+_0x1d2380['alias']:_0xbdfc('0x9'),'context':_0x1d2380['context'],'exten':_0x1d2380[_0xbdfc('0x7')],'priority':_0x52526c++,'VoiceExtensionId':_0x1d2380['id']},{'type':'outbound','app':_0xbdfc('0x4'),'appdata':'CDR(destination)='+(_0x1d2380[_0xbdfc('0x13')]?_0xbdfc('0x14')+_0x1d2380[_0xbdfc('0x13')]+'}':_0xbdfc('0x15')),'context':_0x1d2380[_0xbdfc('0x6')],'exten':_0x1d2380[_0xbdfc('0x7')],'priority':_0x52526c++,'VoiceExtensionId':_0x1d2380['id']},{'type':_0xbdfc('0x10'),'app':_0xbdfc('0x4'),'appdata':_0xbdfc('0xc')+_0x1d2380['id'],'context':_0x1d2380[_0xbdfc('0x6')],'exten':_0x1d2380[_0xbdfc('0x7')],'priority':_0x52526c++,'VoiceExtensionId':_0x1d2380['id']},{'type':'outbound','app':_0xbdfc('0x16'),'appdata':_0xbdfc('0x17')+(_0x52526c+0x2)+_0xbdfc('0x18')+(_0x52526c+0x1)+')','context':_0x1d2380['context'],'exten':_0x1d2380[_0xbdfc('0x7')],'priority':_0x52526c++,'VoiceExtensionId':_0x1d2380['id']},{'type':_0xbdfc('0x10'),'app':_0xbdfc('0x4'),'appdata':_0x1d2380['cutdigits']?_0xbdfc('0x19')+_0x1d2380['cutdigits']+'}':_0xbdfc('0x1a'),'context':_0x1d2380[_0xbdfc('0x6')],'exten':_0x1d2380[_0xbdfc('0x7')],'priority':_0x52526c++,'VoiceExtensionId':_0x1d2380['id']},{'type':_0xbdfc('0x10'),'app':_0xbdfc('0x4'),'appdata':_0xbdfc('0x1b'),'context':_0x1d2380[_0xbdfc('0x6')],'exten':_0x1d2380[_0xbdfc('0x7')],'priority':_0x52526c++,'VoiceExtensionId':_0x1d2380['id']},{'type':_0xbdfc('0x10'),'app':_0xbdfc('0x4'),'appdata':_0xbdfc('0xd'),'context':_0x1d2380[_0xbdfc('0x6')],'exten':_0x1d2380[_0xbdfc('0x7')],'priority':_0x52526c++,'VoiceExtensionId':_0x1d2380['id']},{'type':_0xbdfc('0x10'),'app':_0xbdfc('0x4'),'appdata':_0xbdfc('0xe'),'context':_0x1d2380[_0xbdfc('0x6')],'exten':_0x1d2380['exten'],'priority':_0x52526c++,'VoiceExtensionId':_0x1d2380['id']},{'type':_0xbdfc('0x10'),'app':'Set','appdata':_0xbdfc('0x1c')+_0x1d2380['id'],'context':_0x1d2380[_0xbdfc('0x6')],'exten':_0x1d2380[_0xbdfc('0x7')],'priority':_0x52526c++,'VoiceExtensionId':_0x1d2380['id']}];if(_0x1d2380[_0xbdfc('0x1d')](_0xbdfc('0x1e'))&&_0x1d2380['recordingFormat']!==_0xbdfc('0x1f')){_0x7681f2[_0xbdfc('0xb')]({'type':'outbound','app':_0xbdfc('0x4'),'appdata':_0xbdfc('0x20'),'context':_0x1d2380[_0xbdfc('0x6')],'exten':_0x1d2380[_0xbdfc('0x7')],'priority':_0x52526c++,'VoiceExtensionId':_0x1d2380['id']},{'type':_0xbdfc('0x10'),'app':_0xbdfc('0x4'),'appdata':_0xbdfc('0x21')+_0x1d2380['recordingFormat']||'wav','context':_0x1d2380[_0xbdfc('0x6')],'exten':_0x1d2380[_0xbdfc('0x7')],'priority':_0x52526c++,'VoiceExtensionId':_0x1d2380['id']});}return _0x7681f2;}function _0xb6e697(_0x5c7333){var _0x47835a=[{'name':'trunk','param':0x0},{'name':_0xbdfc('0x22'),'param':0x1},{'name':_0xbdfc('0x23'),'param':0x2},{'name':'url','param':0x3}];var _0x274244={};var _0x11fd2d=_0x5c7333[_0xbdfc('0x24')](',');var _0x3ded44=[];for(var _0x23fbfc=0x0;_0x23fbfc<_0x47835a[_0xbdfc('0x25')];_0x23fbfc++){switch(_0x47835a[_0x23fbfc][_0xbdfc('0x26')]){case _0xbdfc('0x27'):_0x274244[_0xbdfc('0x27')]=_0x11fd2d[_0x47835a[_0x23fbfc][_0xbdfc('0x28')]]['split']('/')[0x1];_0x274244[_0xbdfc('0x29')]=_0x11fd2d[_0x47835a[_0x23fbfc]['param']]['split']('/')[0x2];_0x274244[_0xbdfc('0x2a')]=_0x274244[_0xbdfc('0x29')]?_0x274244[_0xbdfc('0x29')][_0xbdfc('0x24')]('$')[0x0]:undefined;_0x274244[_0xbdfc('0x29')]=route[_0xbdfc('0x13')]?(_0x274244[_0xbdfc('0x2a')]||'')+_0xbdfc('0x14')+route['cutdigits']+'}':(_0x274244[_0xbdfc('0x2a')]||'')+_0xbdfc('0x15');_0x3ded44[_0x47835a[_0x23fbfc][_0xbdfc('0x28')]]=[_0xbdfc('0x2b'),_0x274244[_0xbdfc('0x27')],_0x274244[_0xbdfc('0x29')]][_0xbdfc('0x2c')]('/');break;case _0xbdfc('0x23'):_0x274244[_0xbdfc('0x23')]=_0x11fd2d[_0x47835a[_0x23fbfc][_0xbdfc('0x28')]];if(route['recordingFormat']!==_0xbdfc('0x1f')){if(_0x274244[_0xbdfc('0x23')][_0xbdfc('0x2d')](_0xbdfc('0x2e'))<0x0){_0x274244[_0xbdfc('0x23')]+=_0xbdfc('0x2e');}}else{_0x274244[_0xbdfc('0x23')]=_0x274244[_0xbdfc('0x23')]['replace'](_0xbdfc('0x2e'),'');}_0x3ded44[_0x47835a[_0x23fbfc][_0xbdfc('0x28')]]=_0x274244['options'];break;default:_0x3ded44[_0x47835a[_0x23fbfc]['param']]=_0x11fd2d[_0x47835a[_0x23fbfc][_0xbdfc('0x28')]];}}return _0x3ded44['join'](',');}function _0x323c32(_0x484d76,_0x90cd37,_0x1d4b0b,_0x10de2b){return new Promise(function(_0x3bb441,_0x4c708b){var _0x4e1d6c=[];if(_[_0xbdfc('0x2f')](_0x90cd37))return _0x3bb441(_0x4e1d6c);_0x196c83[_0xbdfc('0x30')]['findAll']({'attributes':['id',_0xbdfc('0x31'),'IntervalId'],'raw':!![]})[_0xbdfc('0x32')](function(_0x507b2d){for(var _0x21d567=0x0,_0x39dbd4=0x0;_0x21d567<_0x90cd37[_0xbdfc('0x25')];_0x21d567++,_0x39dbd4=0x0){var _0x258e40=_0x90cd37[_0x21d567];var _0x541015=[];var _0x46f5cf=[];if(_0x258e40[_0xbdfc('0x31')]!==_0xbdfc('0x33')){_0x258e40[_0xbdfc('0x34')]=[_0x258e40[_0xbdfc('0x31')]];}else{_0x258e40[_0xbdfc('0x34')]=_0x258e40[_0xbdfc('0x35')]?_[_0xbdfc('0x36')](_[_0xbdfc('0x37')](_0x507b2d,{'IntervalId':_0x258e40[_0xbdfc('0x35')]}),'interval'):[];}_0x258e40[_0xbdfc('0x6')]=_0x484d76[_0xbdfc('0x6')];_0x258e40[_0xbdfc('0x7')]=_0x484d76[_0xbdfc('0x7')];if(_0x258e40[_0xbdfc('0x3')])_0x258e40['type']=_0x258e40[_0xbdfc('0x3')][_0xbdfc('0x38')]();if(_0x484d76[_0xbdfc('0x3')]===_0xbdfc('0x10')){if(_0x258e40['hasOwnProperty'](_0xbdfc('0x39'))&&_0x258e40[_0xbdfc('0x39')]&&_0x258e40[_0xbdfc('0x39')]!=='--'){_0x541015[_0xbdfc('0xb')]({'type':_0x258e40[_0xbdfc('0x3')]['toLowerCase'](),'app':_0xbdfc('0x4'),'appdata':_0xbdfc('0x3a')+_0x258e40[_0xbdfc('0x39')],'context':_0x484d76[_0xbdfc('0x6')],'exten':_0x484d76[_0xbdfc('0x7')],'priority':_0x258e40[_0xbdfc('0x34')][_0xbdfc('0x25')]+_0x1d4b0b+_0x39dbd4++,'VoiceExtensionId':_0x484d76['id']});}_0x541015[_0xbdfc('0xb')]({'type':_0x258e40['type']['toLowerCase'](),'app':_0xbdfc('0x16'),'appdata':_0xbdfc('0x3b')+(_0x258e40[_0xbdfc('0x3c')]?_0xbdfc('0x3d')+_0x258e40['callerID']+')':_0xbdfc('0x3e')),'context':_0x484d76[_0xbdfc('0x6')],'exten':_0x484d76[_0xbdfc('0x7')],'priority':_0x258e40['intervals'][_0xbdfc('0x25')]+_0x1d4b0b+_0x39dbd4++,'VoiceExtensionId':_0x484d76['id']});}else{if(_0x258e40['hasOwnProperty'](_0xbdfc('0x3f'))){if([_0xbdfc('0x40'),'playback'][_0xbdfc('0x41')](_0x258e40[_0xbdfc('0x42')][_0xbdfc('0x38')]())&&_0x258e40['appType']!==_0xbdfc('0x43')){if(_0x258e40[_0xbdfc('0x3f')]){_0x541015[_0xbdfc('0xb')]({'type':_0x258e40[_0xbdfc('0x3')]['toLowerCase'](),'app':_0xbdfc('0x16'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x484d76[_0xbdfc('0x6')],'exten':_0x484d76[_0xbdfc('0x7')],'priority':_0x258e40[_0xbdfc('0x34')][_0xbdfc('0x25')]+_0x1d4b0b+_0x39dbd4++,'VoiceExtensionId':_0x484d76['id']});_0x541015[_0xbdfc('0xb')]({'type':_0x258e40[_0xbdfc('0x3')][_0xbdfc('0x38')](),'app':_0xbdfc('0x4'),'appdata':_0xbdfc('0x44'),'context':_0x484d76['context'],'exten':_0x484d76[_0xbdfc('0x7')],'priority':_0x258e40['intervals'][_0xbdfc('0x25')]+_0x1d4b0b+_0x39dbd4++,'VoiceExtensionId':_0x484d76['id']});}else{_0x541015['push']({'type':_0x258e40[_0xbdfc('0x3')][_0xbdfc('0x38')](),'app':_0xbdfc('0x16'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x484d76[_0xbdfc('0x6')],'exten':_0x484d76[_0xbdfc('0x7')],'priority':_0x258e40[_0xbdfc('0x34')]['length']+_0x1d4b0b+_0x39dbd4++,'VoiceExtensionId':_0x484d76['id']});_0x541015['push']({'type':_0x258e40['type'][_0xbdfc('0x38')](),'app':_0xbdfc('0x4'),'appdata':_0xbdfc('0x45'),'context':_0x484d76[_0xbdfc('0x6')],'exten':_0x484d76['exten'],'priority':_0x258e40[_0xbdfc('0x34')][_0xbdfc('0x25')]+_0x1d4b0b+_0x39dbd4++,'VoiceExtensionId':_0x484d76['id']});}}}}for(var _0xb739db=0x0;_0xb739db<_0x258e40['intervals'][_0xbdfc('0x25')];_0xb739db++){var _0x195fdc=_0x1d4b0b+_0x258e40[_0xbdfc('0x34')][_0xbdfc('0x25')];var _0x359de8=_0xb739db===_0x258e40[_0xbdfc('0x34')]['length']-0x1?_0x1d4b0b+_0x541015['length']+_0x46f5cf['length']+0x2:_0x1d4b0b+_0xb739db+0x1;_0x541015[_0xbdfc('0x46')](_0xb739db,0x0,{'type':_0x484d76[_0xbdfc('0x3')],'app':_0xbdfc('0x47'),'appdata':_0x258e40['intervals'][_0xb739db]+'?'+_0x484d76[_0xbdfc('0x6')]+_0xbdfc('0x48')+_0x195fdc+':'+_0x484d76[_0xbdfc('0x6')]+_0xbdfc('0x48')+_0x359de8,'exten':_0x484d76[_0xbdfc('0x7')],'context':_0x484d76[_0xbdfc('0x6')],'priority':_0x1d4b0b+_0xb739db,'VoiceExtensionId':_0x484d76['id']});}if(_0x10de2b&&_0x258e40[_0xbdfc('0x49')]===_0xbdfc('0x4a'))_0x258e40[_0xbdfc('0x4b')]=_0xb6e697(_0x258e40[_0xbdfc('0x4b')]);_0x258e40[_0xbdfc('0x4c')]=_0x541015['length']?_['last'](_0x541015)[_0xbdfc('0x4c')]+0x1:_0x1d4b0b;_0x4e1d6c=_[_0xbdfc('0x4d')](_0x4e1d6c,_0x541015,[_0x258e40],_0x46f5cf);_0x1d4b0b=_[_0xbdfc('0x4e')](_0x4e1d6c)[_0xbdfc('0x4c')]+0x1;}return _0x3bb441(_0x4e1d6c);})[_0xbdfc('0x4f')](function(_0x1554e4){_0x4c708b(_0x1554e4);});});}return _0x158509[_0xbdfc('0x50')](_0xbdfc('0x51'),attributes,{'tableName':_0xbdfc('0x52'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x2ded7a,_0x3cf40d){var _0x8f6a24=this;var _0xe638c8=_0x8f6a24[_0xbdfc('0x3')]===_0xbdfc('0x10')?_0x24d1c5(_0x8f6a24):_0x41b3ca(_0x8f6a24);return _0x323c32(_0x8f6a24,_0x2ded7a,_['last'](_0xe638c8)[_0xbdfc('0x4c')]+0x1,_0x3cf40d)['then'](function(_0x313f44){var _0x79d4b0=_[_0xbdfc('0x4d')](_0xe638c8,_0x313f44);_0x79d4b0[_0xbdfc('0xb')]({'type':_0x8f6a24[_0xbdfc('0x3')],'app':_0xbdfc('0x53'),'exten':_0x8f6a24[_0xbdfc('0x7')],'context':_0x8f6a24[_0xbdfc('0x6')],'priority':_[_0xbdfc('0x4e')](_0x79d4b0)[_0xbdfc('0x4c')]+0x1,'VoiceExtensionId':_0x8f6a24['id']});return _0x79d4b0;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index fbd2a96..736e3b5 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 _0x29eb=['where','limit','include','map','model','attributes','GetVoiceExtension','debug','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','VoiceExtension','options','raw'];(function(_0x49f6d3,_0x20cb6c){var _0x8b457b=function(_0xf55e){while(--_0xf55e){_0x49f6d3['push'](_0x49f6d3['shift']());}};_0x8b457b(++_0x20cb6c);}(_0x29eb,0x1c5));var _0xb29e=function(_0x58346f,_0x3f5397){_0x58346f=_0x58346f-0x0;var _0x47893b=_0x29eb[_0x58346f];return _0x47893b;};'use strict';var _=require(_0xb29e('0x0'));var util=require(_0xb29e('0x1'));var moment=require(_0xb29e('0x2'));var BPromise=require('bluebird');var rs=require(_0xb29e('0x3'));var fs=require('fs');var Redis=require(_0xb29e('0x4'));var db=require(_0xb29e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb29e('0x6'))('rpc');var config=require(_0xb29e('0x7'));var jayson=require(_0xb29e('0x8'));var client=jayson[_0xb29e('0x9')][_0xb29e('0xa')]({'port':0x232a});config[_0xb29e('0xb')]=_[_0xb29e('0xc')](config['redis'],{'host':_0xb29e('0xd'),'port':0x18eb});var socket=require(_0xb29e('0xe'))(new Redis(config[_0xb29e('0xb')]));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x12eebb,_0x521d07,_0x57d868){return new BPromise(function(_0x3844ef,_0x449db2){return client['request'](_0x12eebb,_0x57d868)[_0xb29e('0xf')](function(_0x2dc3d7){logger[_0xb29e('0x10')](_0xb29e('0x11'),_0x521d07,_0xb29e('0x12'));logger['debug'](_0xb29e('0x13'),_0x521d07,'request\x20sent',JSON['stringify'](_0x2dc3d7));if(_0x2dc3d7['error']){if(_0x2dc3d7[_0xb29e('0x14')][_0xb29e('0x15')]===0x1f4){logger[_0xb29e('0x14')](_0xb29e('0x11'),_0x521d07,_0x2dc3d7[_0xb29e('0x14')][_0xb29e('0x16')]);return _0x449db2(_0x2dc3d7['error'][_0xb29e('0x16')]);}logger[_0xb29e('0x14')](_0xb29e('0x11'),_0x521d07,_0x2dc3d7[_0xb29e('0x14')]['message']);return _0x3844ef(_0x2dc3d7['error'][_0xb29e('0x16')]);}else{logger[_0xb29e('0x10')](_0xb29e('0x11'),_0x521d07,_0xb29e('0x12'));_0x3844ef(_0x2dc3d7[_0xb29e('0x17')][_0xb29e('0x16')]);}})[_0xb29e('0x18')](function(_0x33f51f){logger[_0xb29e('0x14')](_0xb29e('0x11'),_0x521d07,_0x33f51f);_0x449db2(_0x33f51f);});});}exports['GetVoiceExtension']=function(_0x112e4f){var _0x4652d3=this;return new Promise(function(_0x467923,_0x53d71f){return db[_0xb29e('0x19')]['findAll']({'raw':_0x112e4f[_0xb29e('0x1a')]?_0x112e4f[_0xb29e('0x1a')][_0xb29e('0x1b')]===undefined?!![]:![]:!![],'where':_0x112e4f[_0xb29e('0x1a')]?_0x112e4f[_0xb29e('0x1a')][_0xb29e('0x1c')]||null:null,'attributes':_0x112e4f[_0xb29e('0x1a')]?_0x112e4f['options']['attributes']||null:null,'limit':_0x112e4f[_0xb29e('0x1a')]?_0x112e4f[_0xb29e('0x1a')][_0xb29e('0x1d')]||null:null,'include':_0x112e4f[_0xb29e('0x1a')]?_0x112e4f[_0xb29e('0x1a')][_0xb29e('0x1e')]?_[_0xb29e('0x1f')](_0x112e4f['options']['include'],function(_0xedd5b3){return{'model':db[_0xedd5b3[_0xb29e('0x20')]],'as':_0xedd5b3['as'],'attributes':_0xedd5b3[_0xb29e('0x21')],'include':_0xedd5b3['include']?_['map'](_0xedd5b3['include'],function(_0x9840cc){return{'model':db[_0x9840cc[_0xb29e('0x20')]],'as':_0x9840cc['as'],'attributes':_0x9840cc[_0xb29e('0x21')],'include':_0x9840cc[_0xb29e('0x1e')]?_[_0xb29e('0x1f')](_0x9840cc[_0xb29e('0x1e')],function(_0x375abe){return{'model':db[_0x375abe[_0xb29e('0x20')]],'as':_0x375abe['as'],'attributes':_0x375abe[_0xb29e('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb29e('0xf')](function(_0x525a54){logger[_0xb29e('0x10')](_0xb29e('0x22'),_0x112e4f);logger[_0xb29e('0x23')]('GetVoiceExtension',_0x112e4f,JSON[_0xb29e('0x24')](_0x525a54));_0x467923(_0x525a54);})[_0xb29e('0x18')](function(_0xc0d1f){logger[_0xb29e('0x14')]('GetVoiceExtension',_0xc0d1f[_0xb29e('0x16')],_0x112e4f);_0x53d71f(_0x4652d3[_0xb29e('0x14')](0x1f4,_0xc0d1f[_0xb29e('0x16')]));});});}; \ No newline at end of file +var _0x1c88=['options','where','attributes','limit','include','map','model','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceExtension,\x20%s,\x20%s','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','raw'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x1c88,0x1a9));var _0x81c8=function(_0xc55c68,_0x292a8b){_0xc55c68=_0xc55c68-0x0;var _0x148523=_0x1c88[_0xc55c68];return _0x148523;};'use strict';var _=require(_0x81c8('0x0'));var util=require('util');var moment=require(_0x81c8('0x1'));var BPromise=require(_0x81c8('0x2'));var rs=require(_0x81c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x81c8('0x4'));var logger=require(_0x81c8('0x5'))(_0x81c8('0x6'));var config=require(_0x81c8('0x7'));var jayson=require(_0x81c8('0x8'));var client=jayson[_0x81c8('0x9')][_0x81c8('0xa')]({'port':0x232a});config[_0x81c8('0xb')]=_[_0x81c8('0xc')](config[_0x81c8('0xb')],{'host':_0x81c8('0xd'),'port':0x18eb});var socket=require(_0x81c8('0xe'))(new Redis(config[_0x81c8('0xb')]));require('./voiceExtension.socket')[_0x81c8('0xf')](socket);function respondWithRpcPromise(_0x3b326c,_0xed3907,_0x5c7dde){return new BPromise(function(_0x4cc5b3,_0x2495a6){return client[_0x81c8('0x10')](_0x3b326c,_0x5c7dde)[_0x81c8('0x11')](function(_0x47b6f6){logger[_0x81c8('0x12')](_0x81c8('0x13'),_0xed3907,'request\x20sent');logger[_0x81c8('0x14')](_0x81c8('0x15'),_0xed3907,_0x81c8('0x16'),JSON[_0x81c8('0x17')](_0x47b6f6));if(_0x47b6f6['error']){if(_0x47b6f6[_0x81c8('0x18')][_0x81c8('0x19')]===0x1f4){logger[_0x81c8('0x18')]('VoiceExtension,\x20%s,\x20%s',_0xed3907,_0x47b6f6[_0x81c8('0x18')][_0x81c8('0x1a')]);return _0x2495a6(_0x47b6f6[_0x81c8('0x18')]['message']);}logger[_0x81c8('0x18')](_0x81c8('0x13'),_0xed3907,_0x47b6f6[_0x81c8('0x18')][_0x81c8('0x1a')]);return _0x4cc5b3(_0x47b6f6[_0x81c8('0x18')]['message']);}else{logger[_0x81c8('0x12')](_0x81c8('0x13'),_0xed3907,'request\x20sent');_0x4cc5b3(_0x47b6f6[_0x81c8('0x1b')][_0x81c8('0x1a')]);}})[_0x81c8('0x1c')](function(_0x2f8d75){logger[_0x81c8('0x18')](_0x81c8('0x13'),_0xed3907,_0x2f8d75);_0x2495a6(_0x2f8d75);});});}exports[_0x81c8('0x1d')]=function(_0x325e90){var _0x336ebf=this;return new Promise(function(_0x47a6bb,_0x2af7b6){return db['VoiceExtension']['findAll']({'raw':_0x325e90['options']?_0x325e90['options'][_0x81c8('0x1e')]===undefined?!![]:![]:!![],'where':_0x325e90['options']?_0x325e90[_0x81c8('0x1f')][_0x81c8('0x20')]||null:null,'attributes':_0x325e90[_0x81c8('0x1f')]?_0x325e90[_0x81c8('0x1f')][_0x81c8('0x21')]||null:null,'limit':_0x325e90[_0x81c8('0x1f')]?_0x325e90[_0x81c8('0x1f')][_0x81c8('0x22')]||null:null,'include':_0x325e90[_0x81c8('0x1f')]?_0x325e90[_0x81c8('0x1f')][_0x81c8('0x23')]?_[_0x81c8('0x24')](_0x325e90[_0x81c8('0x1f')]['include'],function(_0xb71afc){return{'model':db[_0xb71afc[_0x81c8('0x25')]],'as':_0xb71afc['as'],'attributes':_0xb71afc[_0x81c8('0x21')],'include':_0xb71afc[_0x81c8('0x23')]?_['map'](_0xb71afc[_0x81c8('0x23')],function(_0x4c10e5){return{'model':db[_0x4c10e5[_0x81c8('0x25')]],'as':_0x4c10e5['as'],'attributes':_0x4c10e5[_0x81c8('0x21')],'include':_0x4c10e5[_0x81c8('0x23')]?_[_0x81c8('0x24')](_0x4c10e5[_0x81c8('0x23')],function(_0x3ac0e4){return{'model':db[_0x3ac0e4[_0x81c8('0x25')]],'as':_0x3ac0e4['as'],'attributes':_0x3ac0e4[_0x81c8('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x363724){logger['info'](_0x81c8('0x1d'),_0x325e90);logger[_0x81c8('0x14')](_0x81c8('0x1d'),_0x325e90,JSON[_0x81c8('0x17')](_0x363724));_0x47a6bb(_0x363724);})[_0x81c8('0x1c')](function(_0x1d580f){logger[_0x81c8('0x18')]('GetVoiceExtension',_0x1d580f[_0x81c8('0x1a')],_0x325e90);_0x2af7b6(_0x336ebf['error'](0x1f4,_0x1d580f[_0x81c8('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 33c1fda..e2831ce 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 _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x1bb386,_0x2381d6){var _0x5c0e2e=function(_0x4f3104){while(--_0x4f3104){_0x1bb386['push'](_0x1bb386['shift']());}};_0x5c0e2e(++_0x2381d6);}(_0x0295,0x1f0));var _0x5029=function(_0x2fc5db,_0x2253b1){_0x2fc5db=_0x2fc5db-0x0;var _0x1ef11b=_0x0295[_0x2fc5db];return _0x1ef11b;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file +var _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x413c1d,_0x1b4af8){var _0x41fe6c=function(_0x508d28){while(--_0x508d28){_0x413c1d['push'](_0x413c1d['shift']());}};_0x41fe6c(++_0x1b4af8);}(_0x53ec,0x192));var _0xc53e=function(_0x51f812,_0x36212c){_0x51f812=_0x51f812-0x0;var _0x1ad290=_0x53ec[_0x51f812];return _0x1ad290;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 05b9a7b..11845f0 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 _0x5496=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get','isAuthenticated','show','getMessages','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x3d707a,_0x1a7695){var _0x5e88fa=function(_0x514660){while(--_0x514660){_0x3d707a['push'](_0x3d707a['shift']());}};_0x5e88fa(++_0x1a7695);}(_0x5496,0x175));var _0x6549=function(_0x284548,_0x4babeb){_0x284548=_0x284548-0x0;var _0x4ebe07=_0x5496[_0x284548];return _0x4ebe07;};'use strict';var multer=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var path=require(_0x6549('0x2'));var timeout=require(_0x6549('0x3'));var express=require(_0x6549('0x4'));var router=express['Router']();var fs_extra=require(_0x6549('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var controller=require(_0x6549('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6549('0x9')]);router[_0x6549('0xa')]('/:id',auth[_0x6549('0xb')](),controller[_0x6549('0xc')]);router[_0x6549('0xa')]('/:id/messages',auth[_0x6549('0xb')](),controller[_0x6549('0xd')]);router[_0x6549('0xe')]('/',auth[_0x6549('0xb')](),controller[_0x6549('0xf')]);router[_0x6549('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x6549('0x11')]);router[_0x6549('0x12')](_0x6549('0x13'),auth[_0x6549('0xb')](),controller[_0x6549('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8ace=['isAuthenticated','index','/:id','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get'];(function(_0x1558ab,_0x39d1de){var _0x53b64a=function(_0x4771ed){while(--_0x4771ed){_0x1558ab['push'](_0x1558ab['shift']());}};_0x53b64a(++_0x39d1de);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x332985,_0x216420){_0x332985=_0x332985-0x0;var _0x1a77c1=_0x8ace[_0x332985];return _0x1a77c1;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var fs_extra=require(_0xe8ac('0x6'));var auth=require(_0xe8ac('0x7'));var interaction=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var controller=require(_0xe8ac('0xa'));router[_0xe8ac('0xb')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0xd')]);router['get'](_0xe8ac('0xe'),auth[_0xe8ac('0xc')](),controller['show']);router['get'](_0xe8ac('0xf'),auth['isAuthenticated'](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0x11')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x12')]);router[_0xe8ac('0x13')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x14')]);router[_0xe8ac('0x15')](_0xe8ac('0xe'),auth['isAuthenticated'](),controller[_0xe8ac('0x16')]);module[_0xe8ac('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index de9aef7..e179737 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 _0xa751=['sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xa751,0xea));var _0x1a75=function(_0x3fbabf,_0x4b8655){_0x3fbabf=_0x3fbabf-0x0;var _0x508f20=_0xa751[_0x3fbabf];return _0x508f20;};'use strict';var Sequelize=require(_0x1a75('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x1a75('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x1a75('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x1a75('0x1')],'defaultValue':'','allowNull':![],'unique':_0x1a75('0x3')},'password':{'type':Sequelize[_0x1a75('0x1')]},'fullname':{'type':Sequelize[_0x1a75('0x1')]},'email':{'type':Sequelize[_0x1a75('0x1')],'validate':{'isEmail':!![]},'set':function(_0xce4b50){this[_0x1a75('0x4')](_0x1a75('0x5'),typeof _0xce4b50===_0x1a75('0x6')&&_0xce4b50[_0x1a75('0x7')]()?_0xce4b50[_0x1a75('0x7')]():null);}},'pager':{'type':Sequelize[_0x1a75('0x1')]},'tz':{'type':Sequelize[_0x1a75('0x1')],'defaultValue':_0x1a75('0x8')},'attach':{'type':Sequelize[_0x1a75('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x1a75('0x9')]('yes','no'),'defaultValue':_0x1a75('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x1a75('0x1')]},'callback':{'type':Sequelize[_0x1a75('0x1')]},'review':{'type':Sequelize[_0x1a75('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x1a75('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x1a75('0x9')](_0x1a75('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1a75('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1a75('0x9')](_0x1a75('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x1a75('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1a75('0x9')]('yes','no'),'defaultValue':_0x1a75('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x1a75('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1a75('0x9')](_0x1a75('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1a75('0x9')](_0x1a75('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x1a75('0xc')},'emailsubject':{'type':Sequelize[_0x1a75('0x1')]},'emailbody':{'type':Sequelize[_0x1a75('0x1')]},'maxsecs':{'type':Sequelize[_0x1a75('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1a75('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1a75('0xe')],'get':function(){return this[_0x1a75('0xf')](_0x1a75('0x10'))+_0x1a75('0x11')+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0x81df=['ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes'];(function(_0x2529d2,_0x1e767e){var _0x420bdc=function(_0x219658){while(--_0x219658){_0x2529d2['push'](_0x2529d2['shift']());}};_0x420bdc(++_0x1e767e);}(_0x81df,0x15e));var _0xf81d=function(_0x2d65f1,_0x230b1d){_0x2d65f1=_0x2d65f1-0x0;var _0x30d646=_0x81df[_0x2d65f1];return _0x30d646;};'use strict';var Sequelize=require(_0xf81d('0x0'));module[_0xf81d('0x1')]={'customer_id':{'type':Sequelize[_0xf81d('0x2')]},'context':{'type':Sequelize[_0xf81d('0x2')],'defaultValue':_0xf81d('0x3'),'unique':_0xf81d('0x4')},'mailbox':{'type':Sequelize[_0xf81d('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xf81d('0x2')]},'email':{'type':Sequelize[_0xf81d('0x2')],'validate':{'isEmail':!![]},'set':function(_0x5fae92){this[_0xf81d('0x5')](_0xf81d('0x6'),typeof _0x5fae92===_0xf81d('0x7')&&_0x5fae92[_0xf81d('0x8')]()?_0x5fae92[_0xf81d('0x8')]():null);}},'pager':{'type':Sequelize[_0xf81d('0x2')]},'tz':{'type':Sequelize[_0xf81d('0x2')],'defaultValue':_0xf81d('0x9')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xf81d('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xf81d('0xa'),'no'),'defaultValue':_0xf81d('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xf81d('0x2')]},'callback':{'type':Sequelize[_0xf81d('0x2')]},'review':{'type':Sequelize['ENUM'](_0xf81d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xf81d('0xb')](_0xf81d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xf81d('0xb')](_0xf81d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xf81d('0xb')](_0xf81d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xf81d('0xc'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xf81d('0xb')](_0xf81d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0xf81d('0xa'),'no'),'defaultValue':_0xf81d('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xf81d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xf81d('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xf81d('0xb')](_0xf81d('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xf81d('0xd')},'emailsubject':{'type':Sequelize[_0xf81d('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xf81d('0xe')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xf81d('0xe')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xf81d('0xf')],'get':function(){return this[_0xf81d('0x10')]('fullname')+_0xf81d('0x11')+this[_0xf81d('0x10')](_0xf81d('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 3c02fc6..db012d0 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 _0xc900=['body','params','findOne','VoiceMailMessage','findAndCountAll','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','Voicemails','UserProfileResource','error','name','send','index','map','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceMail','includeAll','include','findAll','catch','show','rawAttributes','keys','find','user','get','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xc900,0xb3));var _0x0c90=function(_0x2bcdfb,_0x319e52){_0x2bcdfb=_0x2bcdfb-0x0;var _0x47d177=_0xc900[_0x2bcdfb];return _0x47d177;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0c90('0x0'));var jsonpatch=require(_0x0c90('0x1'));var rp=require(_0x0c90('0x2'));var moment=require('moment');var BPromise=require(_0x0c90('0x3'));var Mustache=require(_0x0c90('0x4'));var util=require('util');var path=require(_0x0c90('0x5'));var sox=require(_0x0c90('0x6'));var csv=require(_0x0c90('0x7'));var ejs=require(_0x0c90('0x8'));var fs=require('fs');var fs_extra=require(_0x0c90('0x9'));var _=require(_0x0c90('0xa'));var squel=require('squel');var crypto=require(_0x0c90('0xb'));var jsforce=require(_0x0c90('0xc'));var deskjs=require(_0x0c90('0xd'));var toCsv=require(_0x0c90('0x7'));var querystring=require(_0x0c90('0xe'));var Papa=require(_0x0c90('0xf'));var Redis=require(_0x0c90('0x10'));var authService=require(_0x0c90('0x11'));var qs=require(_0x0c90('0x12'));var as=require(_0x0c90('0x13'));var hardwareService=require(_0x0c90('0x14'));var logger=require(_0x0c90('0x15'))(_0x0c90('0x16'));var utils=require('../../config/utils');var config=require(_0x0c90('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0c90('0x18'))['db'];function respondWithStatusCode(_0x50e7db,_0x459cdb){_0x459cdb=_0x459cdb||0xcc;return function(_0x26fc46){if(_0x26fc46){return _0x50e7db[_0x0c90('0x19')](_0x459cdb);}return _0x50e7db[_0x0c90('0x1a')](_0x459cdb)[_0x0c90('0x1b')]();};}function respondWithResult(_0x59ea8e,_0x467b32){_0x467b32=_0x467b32||0xc8;return function(_0x4451e0){if(_0x4451e0){return _0x59ea8e['status'](_0x467b32)[_0x0c90('0x1c')](_0x4451e0);}};}function respondWithFilteredResult(_0x3a492d,_0x3bd5e8){return function(_0x5bef7d){if(_0x5bef7d){var _0x5daeb7=typeof _0x3bd5e8[_0x0c90('0x1d')]===_0x0c90('0x1e')&&typeof _0x3bd5e8[_0x0c90('0x1f')]===_0x0c90('0x1e');var _0x276b92=_0x5bef7d[_0x0c90('0x20')];var _0x42321a=_0x5daeb7?0x0:_0x3bd5e8['offset'];var _0xc3bb47=_0x5daeb7?_0x5bef7d[_0x0c90('0x20')]:_0x3bd5e8[_0x0c90('0x1d')]+_0x3bd5e8[_0x0c90('0x1f')];var _0x594267;if(_0xc3bb47>=_0x276b92){_0xc3bb47=_0x276b92;_0x594267=0xc8;}else{_0x594267=0xce;}_0x3a492d[_0x0c90('0x1a')](_0x594267);return _0x3a492d[_0x0c90('0x21')](_0x0c90('0x22'),_0x42321a+'-'+_0xc3bb47+'/'+_0x276b92)[_0x0c90('0x1c')](_0x5bef7d);}return null;};}function patchUpdates(_0x315932){return function(_0xc08f54){try{jsonpatch['apply'](_0xc08f54,_0x315932,!![]);}catch(_0x365a42){return BPromise['reject'](_0x365a42);}return _0xc08f54[_0x0c90('0x23')]();};}function saveUpdates(_0x1a021e,_0x47b13c){return function(_0x2a053a){if(_0x2a053a){return _0x2a053a[_0x0c90('0x24')](_0x1a021e)[_0x0c90('0x25')](function(_0x86dee){return _0x86dee;});}return null;};}function removeEntity(_0x212164,_0x3b287c){return function(_0x4dfbc3){if(_0x4dfbc3){return _0x4dfbc3[_0x0c90('0x26')]()[_0x0c90('0x25')](function(){var _0x5695a2=_0x4dfbc3['get']({'plain':!![]});var _0x28d005=_0x0c90('0x27');return db[_0x0c90('0x28')][_0x0c90('0x26')]({'where':{'type':_0x28d005,'resourceId':_0x5695a2['id']}})['then'](function(){return _0x4dfbc3;});})[_0x0c90('0x25')](function(){_0x212164[_0x0c90('0x1a')](0xcc)[_0x0c90('0x1b')]();});}};}function handleEntityNotFound(_0x277d4a,_0x427c2b){return function(_0x114589){if(!_0x114589){_0x277d4a['sendStatus'](0x194);}return _0x114589;};}function handleError(_0x15de68,_0x22a47d){_0x22a47d=_0x22a47d||0x1f4;return function(_0x39f1b2){logger[_0x0c90('0x29')](_0x39f1b2['stack']);if(_0x39f1b2['name']){delete _0x39f1b2[_0x0c90('0x2a')];}_0x15de68[_0x0c90('0x1a')](_0x22a47d)[_0x0c90('0x2b')](_0x39f1b2);};}exports[_0x0c90('0x2c')]=function(_0x119e09,_0x562664){var _0x120136={},_0x50b156={},_0x478002={'count':0x0,'rows':[]};var _0x47a935=_[_0x0c90('0x2d')](db['VoiceMail']['rawAttributes'],function(_0x886634){return{'name':_0x886634[_0x0c90('0x2e')],'type':_0x886634[_0x0c90('0x2f')][_0x0c90('0x30')]};});_0x50b156['model']=_[_0x0c90('0x2d')](_0x47a935,'name');_0x50b156[_0x0c90('0x31')]=_['keys'](_0x119e09[_0x0c90('0x31')]);_0x50b156[_0x0c90('0x32')]=_['intersection'](_0x50b156[_0x0c90('0x33')],_0x50b156[_0x0c90('0x31')]);_0x120136[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x50b156[_0x0c90('0x33')],qs[_0x0c90('0x36')](_0x119e09[_0x0c90('0x31')][_0x0c90('0x36')]));_0x120136['attributes']=_0x120136[_0x0c90('0x34')][_0x0c90('0x37')]?_0x120136[_0x0c90('0x34')]:_0x50b156[_0x0c90('0x33')];if(!_0x119e09['query'][_0x0c90('0x38')](_0x0c90('0x39'))){_0x120136[_0x0c90('0x1f')]=qs[_0x0c90('0x1f')](_0x119e09[_0x0c90('0x31')][_0x0c90('0x1f')]);_0x120136[_0x0c90('0x1d')]=qs[_0x0c90('0x1d')](_0x119e09['query'][_0x0c90('0x1d')]);}_0x120136[_0x0c90('0x3a')]=qs['sort'](_0x119e09[_0x0c90('0x31')][_0x0c90('0x3b')]);_0x120136[_0x0c90('0x3c')]=qs[_0x0c90('0x32')](_[_0x0c90('0x3d')](_0x119e09['query'],_0x50b156[_0x0c90('0x32')]),_0x47a935);if(_0x119e09[_0x0c90('0x31')][_0x0c90('0x3e')]){_0x120136[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x120136[_0x0c90('0x3c')],{'$or':_[_0x0c90('0x2d')](_0x47a935,function(_0x1695dd){if(_0x1695dd[_0x0c90('0x2f')]!=='VIRTUAL'){var _0x2cd2c2={};_0x2cd2c2[_0x1695dd['name']]={'$like':'%'+_0x119e09[_0x0c90('0x31')]['filter']+'%'};return _0x2cd2c2;}})});}_0x120136=_[_0x0c90('0x3f')]({},_0x120136,_0x119e09[_0x0c90('0x40')]);var _0x49f8b4={'where':_0x120136['where']};return db[_0x0c90('0x41')]['count'](_0x49f8b4)[_0x0c90('0x25')](function(_0x4545bb){_0x478002[_0x0c90('0x20')]=_0x4545bb;if(_0x119e09['query'][_0x0c90('0x42')]){_0x120136[_0x0c90('0x43')]=[{'all':!![]}];}return db[_0x0c90('0x41')][_0x0c90('0x44')](_0x120136);})[_0x0c90('0x25')](function(_0x1184c4){_0x478002['rows']=_0x1184c4;return _0x478002;})[_0x0c90('0x25')](respondWithFilteredResult(_0x562664,_0x120136))[_0x0c90('0x45')](handleError(_0x562664,null));};exports[_0x0c90('0x46')]=function(_0x399115,_0x3c47c9){var _0x15d040={'raw':!![],'where':{'id':_0x399115['params']['id']}},_0x30b9df={};_0x30b9df[_0x0c90('0x33')]=_['keys'](db[_0x0c90('0x41')][_0x0c90('0x47')]);_0x30b9df[_0x0c90('0x31')]=_[_0x0c90('0x48')](_0x399115[_0x0c90('0x31')]);_0x30b9df[_0x0c90('0x32')]=_[_0x0c90('0x35')](_0x30b9df[_0x0c90('0x33')],_0x30b9df[_0x0c90('0x31')]);_0x15d040[_0x0c90('0x34')]=_[_0x0c90('0x35')](_0x30b9df[_0x0c90('0x33')],qs[_0x0c90('0x36')](_0x399115[_0x0c90('0x31')][_0x0c90('0x36')]));_0x15d040['attributes']=_0x15d040[_0x0c90('0x34')][_0x0c90('0x37')]?_0x15d040[_0x0c90('0x34')]:_0x30b9df[_0x0c90('0x33')];if(_0x399115[_0x0c90('0x31')][_0x0c90('0x42')]){_0x15d040[_0x0c90('0x43')]=[{'all':!![]}];}_0x15d040=_[_0x0c90('0x3f')]({},_0x15d040,_0x399115[_0x0c90('0x40')]);return db[_0x0c90('0x41')][_0x0c90('0x49')](_0x15d040)[_0x0c90('0x25')](handleEntityNotFound(_0x3c47c9,null))[_0x0c90('0x25')](respondWithResult(_0x3c47c9,null))[_0x0c90('0x45')](handleError(_0x3c47c9,null));};exports['create']=function(_0x1b4aac,_0x38f492){return db['VoiceMail']['create'](_0x1b4aac['body'],{})[_0x0c90('0x25')](function(_0x1205d0){var _0x460cf9=_0x1b4aac[_0x0c90('0x4a')][_0x0c90('0x4b')]({'plain':!![]});if(!_0x460cf9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x460cf9[_0x0c90('0x4c')]===_0x0c90('0x4a')){var _0x2b756d=_0x1205d0['get']({'plain':!![]});var _0x119776=_0x0c90('0x27');return db[_0x0c90('0x4d')][_0x0c90('0x49')]({'where':{'name':_0x119776,'userProfileId':_0x460cf9[_0x0c90('0x4e')]},'raw':!![]})[_0x0c90('0x25')](function(_0x42c121){if(_0x42c121&&_0x42c121[_0x0c90('0x4f')]===0x0){return db[_0x0c90('0x28')][_0x0c90('0x50')]({'name':_0x2b756d['name'],'resourceId':_0x2b756d['id'],'type':_0x42c121[_0x0c90('0x2a')],'sectionId':_0x42c121['id']},{})['then'](function(){return _0x1205d0;});}else{return _0x1205d0;}})[_0x0c90('0x45')](function(_0x67539d){logger[_0x0c90('0x29')](_0x0c90('0x51'),_0x67539d);throw _0x67539d;});}return _0x1205d0;})[_0x0c90('0x25')](respondWithResult(_0x38f492,0xc9))[_0x0c90('0x45')](handleError(_0x38f492,null));};exports['update']=function(_0x4930fc,_0x5382d9){if(_0x4930fc['body']['id']){delete _0x4930fc[_0x0c90('0x52')]['id'];}return db[_0x0c90('0x41')][_0x0c90('0x49')]({'where':{'id':_0x4930fc['params']['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x5382d9,null))[_0x0c90('0x25')](saveUpdates(_0x4930fc['body'],null))[_0x0c90('0x25')](respondWithResult(_0x5382d9,null))['catch'](handleError(_0x5382d9,null));};exports[_0x0c90('0x26')]=function(_0x8951f2,_0x42398b){return db[_0x0c90('0x41')]['find']({'where':{'id':_0x8951f2[_0x0c90('0x53')]['id']}})['then'](handleEntityNotFound(_0x42398b,null))[_0x0c90('0x25')](removeEntity(_0x42398b,null))[_0x0c90('0x45')](handleError(_0x42398b,null));};exports['getMessages']=function(_0x52b437,_0x51c356,_0x221fba){return db[_0x0c90('0x41')][_0x0c90('0x54')]({'where':{'id':_0x52b437[_0x0c90('0x53')]['id']}})[_0x0c90('0x25')](handleEntityNotFound(_0x51c356,null))['then'](function(_0x3bfd01){var _0x25ab13;var _0x5ee971={},_0x3eb725={};_0x3eb725['model']=_[_0x0c90('0x48')](db[_0x0c90('0x55')]['rawAttributes']);_0x3eb725[_0x0c90('0x31')]=_['keys'](_0x52b437['query']);_0x3eb725['filters']=_[_0x0c90('0x35')](_0x3eb725[_0x0c90('0x33')],_0x3eb725[_0x0c90('0x31')]);_0x5ee971[_0x0c90('0x34')]=_['intersection'](_0x3eb725['model'],qs[_0x0c90('0x36')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x36')]));_0x5ee971['attributes']=_0x5ee971[_0x0c90('0x34')][_0x0c90('0x37')]?_0x5ee971[_0x0c90('0x34')]:_0x3eb725['model'];if(!_0x52b437[_0x0c90('0x31')][_0x0c90('0x38')](_0x0c90('0x39'))){_0x5ee971['limit']=qs[_0x0c90('0x1f')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x1f')]);_0x5ee971[_0x0c90('0x1d')]=qs[_0x0c90('0x1d')](_0x52b437[_0x0c90('0x31')][_0x0c90('0x1d')]);}_0x5ee971[_0x0c90('0x3a')]=qs[_0x0c90('0x3b')](_0x52b437['query']['sort']);_0x5ee971[_0x0c90('0x3c')]=qs[_0x0c90('0x32')](_[_0x0c90('0x3d')](_0x52b437[_0x0c90('0x31')],_0x3eb725[_0x0c90('0x32')]));if(_0x52b437[_0x0c90('0x31')][_0x0c90('0x3e')]){_0x5ee971[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x5ee971[_0x0c90('0x3c')],{'$or':_[_0x0c90('0x2d')](_0x5ee971[_0x0c90('0x34')],function(_0x309152){var _0x164d4d={};_0x164d4d[_0x309152]={'$like':'%'+_0x52b437[_0x0c90('0x31')]['filter']+'%'};return _0x164d4d;})});}_0x5ee971[_0x0c90('0x3c')]=_[_0x0c90('0x3f')](_0x5ee971[_0x0c90('0x3c')],{'mailboxuser':_0x3bfd01['mailbox']});_0x5ee971=_['merge']({},_0x5ee971,_0x52b437[_0x0c90('0x40')]);return db['VoiceMailMessage'][_0x0c90('0x56')](_0x5ee971)[_0x0c90('0x25')](respondWithFilteredResult(_0x51c356,_0x5ee971));})['catch'](handleError(_0x51c356,null));}; \ No newline at end of file +var _0x16d2=['sort','pick','filter','where','merge','options','findAll','rows','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Voicemails','UserProfileSection','userProfileId','UserProfileResource','catch','update','destroy','params','getMessages','findOne','VoiceMailMessage','nolimit','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','get','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order'];(function(_0x3ab3d3,_0x41028e){var _0x1259d8=function(_0x30f404){while(--_0x30f404){_0x3ab3d3['push'](_0x3ab3d3['shift']());}};_0x1259d8(++_0x41028e);}(_0x16d2,0x123));var _0x216d=function(_0x378068,_0x49640b){_0x378068=_0x378068-0x0;var _0x373cf0=_0x16d2[_0x378068];return _0x373cf0;};'use strict';var emlformat=require(_0x216d('0x0'));var rimraf=require(_0x216d('0x1'));var zipdir=require(_0x216d('0x2'));var jsonpatch=require(_0x216d('0x3'));var rp=require(_0x216d('0x4'));var moment=require(_0x216d('0x5'));var BPromise=require(_0x216d('0x6'));var Mustache=require(_0x216d('0x7'));var util=require(_0x216d('0x8'));var path=require('path');var sox=require(_0x216d('0x9'));var csv=require(_0x216d('0xa'));var ejs=require(_0x216d('0xb'));var fs=require('fs');var fs_extra=require(_0x216d('0xc'));var _=require(_0x216d('0xd'));var squel=require(_0x216d('0xe'));var crypto=require(_0x216d('0xf'));var jsforce=require(_0x216d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x216d('0xa'));var querystring=require(_0x216d('0x11'));var Papa=require(_0x216d('0x12'));var Redis=require(_0x216d('0x13'));var authService=require(_0x216d('0x14'));var qs=require(_0x216d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x216d('0x16'));var logger=require('../../config/logger')(_0x216d('0x17'));var utils=require(_0x216d('0x18'));var config=require(_0x216d('0x19'));var licenseUtil=require(_0x216d('0x1a'));var db=require(_0x216d('0x1b'))['db'];function respondWithStatusCode(_0x23ecf9,_0x4c92d9){_0x4c92d9=_0x4c92d9||0xcc;return function(_0xb36a43){if(_0xb36a43){return _0x23ecf9['sendStatus'](_0x4c92d9);}return _0x23ecf9[_0x216d('0x1c')](_0x4c92d9)[_0x216d('0x1d')]();};}function respondWithResult(_0x4dc2a2,_0x165c19){_0x165c19=_0x165c19||0xc8;return function(_0x322e4b){if(_0x322e4b){return _0x4dc2a2['status'](_0x165c19)[_0x216d('0x1e')](_0x322e4b);}};}function respondWithFilteredResult(_0x494e92,_0x448c0d){return function(_0xf571a4){if(_0xf571a4){var _0x4631b0=typeof _0x448c0d[_0x216d('0x1f')]===_0x216d('0x20')&&typeof _0x448c0d[_0x216d('0x21')]===_0x216d('0x20');var _0x1496fe=_0xf571a4[_0x216d('0x22')];var _0x53d464=_0x4631b0?0x0:_0x448c0d[_0x216d('0x1f')];var _0x5124ab=_0x4631b0?_0xf571a4['count']:_0x448c0d[_0x216d('0x1f')]+_0x448c0d[_0x216d('0x21')];var _0x574758;if(_0x5124ab>=_0x1496fe){_0x5124ab=_0x1496fe;_0x574758=0xc8;}else{_0x574758=0xce;}_0x494e92[_0x216d('0x1c')](_0x574758);return _0x494e92[_0x216d('0x23')]('Content-Range',_0x53d464+'-'+_0x5124ab+'/'+_0x1496fe)[_0x216d('0x1e')](_0xf571a4);}return null;};}function patchUpdates(_0x13b8e0){return function(_0x430e81){try{jsonpatch[_0x216d('0x24')](_0x430e81,_0x13b8e0,!![]);}catch(_0x5c3e03){return BPromise[_0x216d('0x25')](_0x5c3e03);}return _0x430e81[_0x216d('0x26')]();};}function saveUpdates(_0x10f299,_0x438981){return function(_0x206782){if(_0x206782){return _0x206782['update'](_0x10f299)[_0x216d('0x27')](function(_0x1bd4db){return _0x1bd4db;});}return null;};}function removeEntity(_0x188494,_0x2880c6){return function(_0x6fa4b3){if(_0x6fa4b3){return _0x6fa4b3['destroy']()[_0x216d('0x27')](function(){var _0xab672=_0x6fa4b3[_0x216d('0x28')]({'plain':!![]});var _0x5998a1='Voicemails';return db['UserProfileResource']['destroy']({'where':{'type':_0x5998a1,'resourceId':_0xab672['id']}})['then'](function(){return _0x6fa4b3;});})[_0x216d('0x27')](function(){_0x188494[_0x216d('0x1c')](0xcc)[_0x216d('0x1d')]();});}};}function handleEntityNotFound(_0x73b509,_0x46d0ef){return function(_0x47fa6d){if(!_0x47fa6d){_0x73b509['sendStatus'](0x194);}return _0x47fa6d;};}function handleError(_0xa7624a,_0x51b2bd){_0x51b2bd=_0x51b2bd||0x1f4;return function(_0x23d1c3){logger[_0x216d('0x29')](_0x23d1c3[_0x216d('0x2a')]);if(_0x23d1c3[_0x216d('0x2b')]){delete _0x23d1c3[_0x216d('0x2b')];}_0xa7624a[_0x216d('0x1c')](_0x51b2bd)[_0x216d('0x2c')](_0x23d1c3);};}exports[_0x216d('0x2d')]=function(_0x169cfa,_0x28f56a){var _0x11be90={},_0x260134={},_0x4537fd={'count':0x0,'rows':[]};var _0x483324=_[_0x216d('0x2e')](db[_0x216d('0x2f')][_0x216d('0x30')],function(_0x510ad9){return{'name':_0x510ad9[_0x216d('0x31')],'type':_0x510ad9[_0x216d('0x32')][_0x216d('0x33')]};});_0x260134[_0x216d('0x34')]=_['map'](_0x483324,_0x216d('0x2b'));_0x260134[_0x216d('0x35')]=_[_0x216d('0x36')](_0x169cfa[_0x216d('0x35')]);_0x260134[_0x216d('0x37')]=_[_0x216d('0x38')](_0x260134[_0x216d('0x34')],_0x260134[_0x216d('0x35')]);_0x11be90[_0x216d('0x39')]=_[_0x216d('0x38')](_0x260134[_0x216d('0x34')],qs['fields'](_0x169cfa[_0x216d('0x35')][_0x216d('0x3a')]));_0x11be90[_0x216d('0x39')]=_0x11be90['attributes'][_0x216d('0x3b')]?_0x11be90[_0x216d('0x39')]:_0x260134['model'];if(!_0x169cfa[_0x216d('0x35')]['hasOwnProperty']('nolimit')){_0x11be90[_0x216d('0x21')]=qs[_0x216d('0x21')](_0x169cfa[_0x216d('0x35')][_0x216d('0x21')]);_0x11be90['offset']=qs['offset'](_0x169cfa['query'][_0x216d('0x1f')]);}_0x11be90[_0x216d('0x3c')]=qs['sort'](_0x169cfa[_0x216d('0x35')][_0x216d('0x3d')]);_0x11be90['where']=qs[_0x216d('0x37')](_[_0x216d('0x3e')](_0x169cfa[_0x216d('0x35')],_0x260134[_0x216d('0x37')]),_0x483324);if(_0x169cfa[_0x216d('0x35')][_0x216d('0x3f')]){_0x11be90[_0x216d('0x40')]=_[_0x216d('0x41')](_0x11be90['where'],{'$or':_['map'](_0x483324,function(_0x281a88){if(_0x281a88[_0x216d('0x32')]!=='VIRTUAL'){var _0xf33f9c={};_0xf33f9c[_0x281a88[_0x216d('0x2b')]]={'$like':'%'+_0x169cfa[_0x216d('0x35')]['filter']+'%'};return _0xf33f9c;}})});}_0x11be90=_[_0x216d('0x41')]({},_0x11be90,_0x169cfa[_0x216d('0x42')]);var _0x13d787={'where':_0x11be90[_0x216d('0x40')]};return db['VoiceMail'][_0x216d('0x22')](_0x13d787)[_0x216d('0x27')](function(_0x5665d7){_0x4537fd[_0x216d('0x22')]=_0x5665d7;if(_0x169cfa[_0x216d('0x35')]['includeAll']){_0x11be90['include']=[{'all':!![]}];}return db[_0x216d('0x2f')][_0x216d('0x43')](_0x11be90);})[_0x216d('0x27')](function(_0x498efe){_0x4537fd[_0x216d('0x44')]=_0x498efe;return _0x4537fd;})['then'](respondWithFilteredResult(_0x28f56a,_0x11be90))['catch'](handleError(_0x28f56a,null));};exports[_0x216d('0x45')]=function(_0x43336e,_0xac81f){var _0x5ddaeb={'raw':!![],'where':{'id':_0x43336e['params']['id']}},_0xaccf45={};_0xaccf45[_0x216d('0x34')]=_[_0x216d('0x36')](db[_0x216d('0x2f')]['rawAttributes']);_0xaccf45[_0x216d('0x35')]=_[_0x216d('0x36')](_0x43336e[_0x216d('0x35')]);_0xaccf45[_0x216d('0x37')]=_['intersection'](_0xaccf45['model'],_0xaccf45['query']);_0x5ddaeb[_0x216d('0x39')]=_[_0x216d('0x38')](_0xaccf45[_0x216d('0x34')],qs[_0x216d('0x3a')](_0x43336e[_0x216d('0x35')][_0x216d('0x3a')]));_0x5ddaeb[_0x216d('0x39')]=_0x5ddaeb[_0x216d('0x39')]['length']?_0x5ddaeb[_0x216d('0x39')]:_0xaccf45[_0x216d('0x34')];if(_0x43336e[_0x216d('0x35')][_0x216d('0x46')]){_0x5ddaeb['include']=[{'all':!![]}];}_0x5ddaeb=_[_0x216d('0x41')]({},_0x5ddaeb,_0x43336e['options']);return db[_0x216d('0x2f')][_0x216d('0x47')](_0x5ddaeb)[_0x216d('0x27')](handleEntityNotFound(_0xac81f,null))['then'](respondWithResult(_0xac81f,null))['catch'](handleError(_0xac81f,null));};exports[_0x216d('0x48')]=function(_0x32d499,_0x3932a3){return db[_0x216d('0x2f')][_0x216d('0x48')](_0x32d499[_0x216d('0x49')],{})['then'](function(_0x4f9274){var _0x26209c=_0x32d499['user'][_0x216d('0x28')]({'plain':!![]});if(!_0x26209c)throw new Error(_0x216d('0x4a'));if(_0x26209c['role']==='user'){var _0x5f37e3=_0x4f9274['get']({'plain':!![]});var _0x1ae9b7=_0x216d('0x4b');return db[_0x216d('0x4c')][_0x216d('0x47')]({'where':{'name':_0x1ae9b7,'userProfileId':_0x26209c[_0x216d('0x4d')]},'raw':!![]})[_0x216d('0x27')](function(_0x29efa8){if(_0x29efa8&&_0x29efa8['autoAssociation']===0x0){return db[_0x216d('0x4e')][_0x216d('0x48')]({'name':_0x5f37e3[_0x216d('0x2b')],'resourceId':_0x5f37e3['id'],'type':_0x29efa8['name'],'sectionId':_0x29efa8['id']},{})[_0x216d('0x27')](function(){return _0x4f9274;});}else{return _0x4f9274;}})[_0x216d('0x4f')](function(_0x2c7c67){logger[_0x216d('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c7c67);throw _0x2c7c67;});}return _0x4f9274;})[_0x216d('0x27')](respondWithResult(_0x3932a3,0xc9))[_0x216d('0x4f')](handleError(_0x3932a3,null));};exports[_0x216d('0x50')]=function(_0x1a4761,_0x4d7705){if(_0x1a4761[_0x216d('0x49')]['id']){delete _0x1a4761[_0x216d('0x49')]['id'];}return db['VoiceMail'][_0x216d('0x47')]({'where':{'id':_0x1a4761['params']['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x4d7705,null))[_0x216d('0x27')](saveUpdates(_0x1a4761[_0x216d('0x49')],null))[_0x216d('0x27')](respondWithResult(_0x4d7705,null))[_0x216d('0x4f')](handleError(_0x4d7705,null));};exports[_0x216d('0x51')]=function(_0x24297f,_0x2c6cb6){return db[_0x216d('0x2f')]['find']({'where':{'id':_0x24297f[_0x216d('0x52')]['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x2c6cb6,null))['then'](removeEntity(_0x2c6cb6,null))[_0x216d('0x4f')](handleError(_0x2c6cb6,null));};exports[_0x216d('0x53')]=function(_0x59fa28,_0x4edf77,_0x3a0ee7){return db['VoiceMail'][_0x216d('0x54')]({'where':{'id':_0x59fa28[_0x216d('0x52')]['id']}})[_0x216d('0x27')](handleEntityNotFound(_0x4edf77,null))['then'](function(_0x3acd4b){var _0x5112ea;var _0x5d96b3={},_0x462225={};_0x462225[_0x216d('0x34')]=_['keys'](db[_0x216d('0x55')][_0x216d('0x30')]);_0x462225[_0x216d('0x35')]=_[_0x216d('0x36')](_0x59fa28[_0x216d('0x35')]);_0x462225[_0x216d('0x37')]=_['intersection'](_0x462225['model'],_0x462225[_0x216d('0x35')]);_0x5d96b3[_0x216d('0x39')]=_[_0x216d('0x38')](_0x462225[_0x216d('0x34')],qs[_0x216d('0x3a')](_0x59fa28[_0x216d('0x35')][_0x216d('0x3a')]));_0x5d96b3[_0x216d('0x39')]=_0x5d96b3[_0x216d('0x39')][_0x216d('0x3b')]?_0x5d96b3[_0x216d('0x39')]:_0x462225[_0x216d('0x34')];if(!_0x59fa28['query']['hasOwnProperty'](_0x216d('0x56'))){_0x5d96b3[_0x216d('0x21')]=qs['limit'](_0x59fa28[_0x216d('0x35')]['limit']);_0x5d96b3['offset']=qs[_0x216d('0x1f')](_0x59fa28[_0x216d('0x35')][_0x216d('0x1f')]);}_0x5d96b3[_0x216d('0x3c')]=qs[_0x216d('0x3d')](_0x59fa28[_0x216d('0x35')][_0x216d('0x3d')]);_0x5d96b3[_0x216d('0x40')]=qs[_0x216d('0x37')](_[_0x216d('0x3e')](_0x59fa28[_0x216d('0x35')],_0x462225[_0x216d('0x37')]));if(_0x59fa28[_0x216d('0x35')][_0x216d('0x3f')]){_0x5d96b3[_0x216d('0x40')]=_[_0x216d('0x41')](_0x5d96b3[_0x216d('0x40')],{'$or':_[_0x216d('0x2e')](_0x5d96b3[_0x216d('0x39')],function(_0x34540e){var _0xb9302={};_0xb9302[_0x34540e]={'$like':'%'+_0x59fa28[_0x216d('0x35')]['filter']+'%'};return _0xb9302;})});}_0x5d96b3[_0x216d('0x40')]=_['merge'](_0x5d96b3[_0x216d('0x40')],{'mailboxuser':_0x3acd4b['mailbox']});_0x5d96b3=_[_0x216d('0x41')]({},_0x5d96b3,_0x59fa28[_0x216d('0x42')]);return db['VoiceMailMessage'][_0x216d('0x57')](_0x5d96b3)[_0x216d('0x27')](respondWithFilteredResult(_0x4edf77,_0x5d96b3));})[_0x216d('0x4f')](handleError(_0x4edf77,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 2f7325a..56d2b26 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 _0x93ee=['voice_voicemail','mailbox_context','mailbox','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','VoiceMail'];(function(_0x513119,_0x425e6f){var _0x587511=function(_0x42d4f2){while(--_0x42d4f2){_0x513119['push'](_0x513119['shift']());}};_0x587511(++_0x425e6f);}(_0x93ee,0xe0));var _0xe93e=function(_0x29e2af,_0x15e2b1){_0x29e2af=_0x29e2af-0x0;var _0x1ea06a=_0x93ee[_0x29e2af];return _0x1ea06a;};'use strict';var _=require(_0xe93e('0x0'));var util=require(_0xe93e('0x1'));var logger=require('../../config/logger')(_0xe93e('0x2'));var moment=require(_0xe93e('0x3'));var BPromise=require(_0xe93e('0x4'));var rp=require(_0xe93e('0x5'));var fs=require('fs');var path=require(_0xe93e('0x6'));var rimraf=require('rimraf');var config=require(_0xe93e('0x7'));var attributes=require('./voiceMail.attributes');module[_0xe93e('0x8')]=function(_0x1dee3b,_0x2d4dda){return _0x1dee3b['define'](_0xe93e('0x9'),attributes,{'tableName':_0xe93e('0xa'),'paranoid':![],'indexes':[{'name':_0xe93e('0xb'),'fields':[_0xe93e('0xc'),'context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0ae4=['context','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./voiceMail.attributes','exports','VoiceMail','mailbox'];(function(_0x686c8d,_0x3942d6){var _0x2684f6=function(_0x20e136){while(--_0x20e136){_0x686c8d['push'](_0x686c8d['shift']());}};_0x2684f6(++_0x3942d6);}(_0x0ae4,0x199));var _0x40ae=function(_0x3525a8,_0x293833){_0x3525a8=_0x3525a8-0x0;var _0x5742b4=_0x0ae4[_0x3525a8];return _0x5742b4;};'use strict';var _=require(_0x40ae('0x0'));var util=require(_0x40ae('0x1'));var logger=require(_0x40ae('0x2'))('api');var moment=require(_0x40ae('0x3'));var BPromise=require(_0x40ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x40ae('0x5'));var rimraf=require(_0x40ae('0x6'));var config=require('../../config/environment');var attributes=require(_0x40ae('0x7'));module[_0x40ae('0x8')]=function(_0x21b74b,_0x203132){return _0x21b74b['define'](_0x40ae('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x40ae('0xa'),_0x40ae('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index e4a1277..142050c 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 _0x829f=['client','http','info','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','VoiceMail,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4c3003,_0x55a768){var _0x3b401d=function(_0x59f822){while(--_0x59f822){_0x4c3003['push'](_0x4c3003['shift']());}};_0x3b401d(++_0x55a768);}(_0x829f,0x186));var _0xf829=function(_0x426c38,_0x56b57a){_0x426c38=_0x426c38-0x0;var _0x2a38cd=_0x829f[_0x426c38];return _0x2a38cd;};'use strict';var _=require(_0xf829('0x0'));var util=require('util');var moment=require(_0xf829('0x1'));var BPromise=require('bluebird');var rs=require(_0xf829('0x2'));var fs=require('fs');var Redis=require(_0xf829('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf829('0x4'));var logger=require(_0xf829('0x5'))(_0xf829('0x6'));var config=require(_0xf829('0x7'));var jayson=require(_0xf829('0x8'));var client=jayson[_0xf829('0x9')][_0xf829('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1de44f,_0x18db46,_0x44a25e){return new BPromise(function(_0x576fe7,_0x10acd3){return client['request'](_0x1de44f,_0x44a25e)['then'](function(_0x55c123){logger[_0xf829('0xb')]('VoiceMail,\x20%s,\x20%s',_0x18db46,'request\x20sent');logger[_0xf829('0xc')](_0xf829('0xd'),_0x18db46,_0xf829('0xe'),JSON['stringify'](_0x55c123));if(_0x55c123[_0xf829('0xf')]){if(_0x55c123[_0xf829('0xf')][_0xf829('0x10')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x18db46,_0x55c123[_0xf829('0xf')][_0xf829('0x11')]);return _0x10acd3(_0x55c123['error'][_0xf829('0x11')]);}logger[_0xf829('0xf')](_0xf829('0x12'),_0x18db46,_0x55c123[_0xf829('0xf')][_0xf829('0x11')]);return _0x576fe7(_0x55c123[_0xf829('0xf')][_0xf829('0x11')]);}else{logger[_0xf829('0xb')]('VoiceMail,\x20%s,\x20%s',_0x18db46,_0xf829('0xe'));_0x576fe7(_0x55c123[_0xf829('0x13')][_0xf829('0x11')]);}})[_0xf829('0x14')](function(_0x4a16a6){logger[_0xf829('0xf')](_0xf829('0x12'),_0x18db46,_0x4a16a6);_0x10acd3(_0x4a16a6);});});} \ No newline at end of file +var _0x14f1=['util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5cf1df,_0x465598){var _0x4bbac4=function(_0x3d358c){while(--_0x3d358c){_0x5cf1df['push'](_0x5cf1df['shift']());}};_0x4bbac4(++_0x465598);}(_0x14f1,0xa8));var _0x114f=function(_0x66459d,_0x196ad3){_0x66459d=_0x66459d-0x0;var _0x3c5207=_0x14f1[_0x66459d];return _0x3c5207;};'use strict';var _=require('lodash');var util=require(_0x114f('0x0'));var moment=require('moment');var BPromise=require(_0x114f('0x1'));var rs=require(_0x114f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x114f('0x3'));var logger=require(_0x114f('0x4'))(_0x114f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x114f('0x6')][_0x114f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1e3695,_0x2b3d53,_0x4c929f){return new BPromise(function(_0xefead5,_0x4dbd87){return client[_0x114f('0x8')](_0x1e3695,_0x4c929f)[_0x114f('0x9')](function(_0x3f0803){logger[_0x114f('0xa')](_0x114f('0xb'),_0x2b3d53,_0x114f('0xc'));logger[_0x114f('0xd')](_0x114f('0xe'),_0x2b3d53,_0x114f('0xc'),JSON[_0x114f('0xf')](_0x3f0803));if(_0x3f0803[_0x114f('0x10')]){if(_0x3f0803[_0x114f('0x10')][_0x114f('0x11')]===0x1f4){logger['error'](_0x114f('0xb'),_0x2b3d53,_0x3f0803[_0x114f('0x10')][_0x114f('0x12')]);return _0x4dbd87(_0x3f0803[_0x114f('0x10')]['message']);}logger[_0x114f('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2b3d53,_0x3f0803[_0x114f('0x10')][_0x114f('0x12')]);return _0xefead5(_0x3f0803[_0x114f('0x10')][_0x114f('0x12')]);}else{logger[_0x114f('0xa')](_0x114f('0xb'),_0x2b3d53,_0x114f('0xc'));_0xefead5(_0x3f0803[_0x114f('0x13')][_0x114f('0x12')]);}})[_0x114f('0x14')](function(_0x3f2370){logger[_0x114f('0x10')]('VoiceMail,\x20%s,\x20%s',_0x2b3d53,_0x3f2370);_0x4dbd87(_0x3f2370);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 3310eca..78831cc 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 _0x9553=['download','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x5aae6e,_0x59efdf){var _0x10037e=function(_0xefcde7){while(--_0xefcde7){_0x5aae6e['push'](_0x5aae6e['shift']());}};_0x10037e(++_0x59efdf);}(_0x9553,0x7a));var _0x3955=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x9553[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0x3955('0x0'));var util=require(_0x3955('0x1'));var path=require(_0x3955('0x2'));var timeout=require(_0x3955('0x3'));var express=require('express');var router=express[_0x3955('0x4')]();var fs_extra=require(_0x3955('0x5'));var auth=require(_0x3955('0x6'));var interaction=require(_0x3955('0x7'));var config=require(_0x3955('0x8'));var controller=require(_0x3955('0x9'));router[_0x3955('0xa')]('/',auth[_0x3955('0xb')](),controller[_0x3955('0xc')]);router['get'](_0x3955('0xd'),auth[_0x3955('0xb')](),controller[_0x3955('0xe')]);router[_0x3955('0xa')](_0x3955('0xf'),auth[_0x3955('0xb')](),controller[_0x3955('0x10')]);router[_0x3955('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3955('0x12')](_0x3955('0xd'),auth[_0x3955('0xb')](),controller[_0x3955('0x13')]);router[_0x3955('0x14')]('/:id',auth[_0x3955('0xb')](),controller[_0x3955('0x15')]);module[_0x3955('0x16')]=router; \ No newline at end of file +var _0xee6f=['download','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','index','/:id','show','isAuthenticated'];(function(_0x51eb91,_0x4799d5){var _0x1c4fc4=function(_0x1fd807){while(--_0x1fd807){_0x51eb91['push'](_0x51eb91['shift']());}};_0x1c4fc4(++_0x4799d5);}(_0xee6f,0xcf));var _0xfee6=function(_0x4a4563,_0x2771c3){_0x4a4563=_0x4a4563-0x0;var _0x201be1=_0xee6f[_0x4a4563];return _0x201be1;};'use strict';var multer=require(_0xfee6('0x0'));var util=require(_0xfee6('0x1'));var path=require(_0xfee6('0x2'));var timeout=require('connect-timeout');var express=require(_0xfee6('0x3'));var router=express[_0xfee6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfee6('0x5'));var interaction=require(_0xfee6('0x6'));var config=require('../../config/environment');var controller=require(_0xfee6('0x7'));router[_0xfee6('0x8')]('/',auth['isAuthenticated'](),controller[_0xfee6('0x9')]);router[_0xfee6('0x8')](_0xfee6('0xa'),auth['isAuthenticated'](),controller[_0xfee6('0xb')]);router[_0xfee6('0x8')]('/:id/download',auth[_0xfee6('0xc')](),controller[_0xfee6('0xd')]);router['post']('/',auth[_0xfee6('0xc')](),controller[_0xfee6('0xe')]);router[_0xfee6('0xf')](_0xfee6('0xa'),auth[_0xfee6('0xc')](),controller[_0xfee6('0x10')]);router[_0xfee6('0x11')](_0xfee6('0xa'),auth[_0xfee6('0xc')](),controller[_0xfee6('0x12')]);module[_0xfee6('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index c286271..8d6c216 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 _0x7df2=['exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x37f053,_0x4b2ad0){var _0x78f6a0=function(_0x84b926){while(--_0x84b926){_0x37f053['push'](_0x37f053['shift']());}};_0x78f6a0(++_0x4b2ad0);}(_0x7df2,0x135));var _0x27df=function(_0x2a385c,_0x48043e){_0x2a385c=_0x2a385c-0x0;var _0x2afc37=_0x7df2[_0x2a385c];return _0x2afc37;};'use strict';var Sequelize=require(_0x27df('0x0'));module[_0x27df('0x1')]={'name':{'type':Sequelize[_0x27df('0x2')],'get':function(_0x5b24e6){return this[_0x27df('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x27df('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x27df('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x27df('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x27df('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x27df('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x27df('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0x27df('0x6')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x27df('0x5')],'defaultValue':''},'stamp':{'type':_0x27df('0x7'),'defaultValue':Sequelize[_0x27df('0x8')](_0x27df('0x9'))}}; \ No newline at end of file +var _0x71c3=['BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','INTEGER','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x71c3,0x1d9));var _0x371c=function(_0x58f517,_0x5c1d4e){_0x58f517=_0x58f517-0x0;var _0x288997=_0x71c3[_0x58f517];return _0x288997;};'use strict';var Sequelize=require('sequelize');module[_0x371c('0x0')]={'name':{'type':Sequelize[_0x371c('0x1')],'get':function(_0x21e18e){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x371c('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x371c('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x371c('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x371c('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x371c('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x371c('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x371c('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x371c('0x4')](_0x371c('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x371c('0x3')],'defaultValue':''},'stamp':{'type':_0x371c('0x6'),'defaultValue':Sequelize[_0x371c('0x7')](_0x371c('0x8'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index c92c309..bf91436 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 _0x86bc=['name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','filters','fields','attributes','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','find','create','body','params','download','recording','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack'];(function(_0x275f96,_0x1e3415){var _0x55dd8b=function(_0x398e5f){while(--_0x398e5f){_0x275f96['push'](_0x275f96['shift']());}};_0x55dd8b(++_0x1e3415);}(_0x86bc,0xd8));var _0xc86b=function(_0x4c3a6f,_0x31d6f2){_0x4c3a6f=_0x4c3a6f-0x0;var _0x379e12=_0x86bc[_0x4c3a6f];return _0x379e12;};'use strict';var emlformat=require(_0xc86b('0x0'));var rimraf=require(_0xc86b('0x1'));var zipdir=require(_0xc86b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc86b('0x3'));var moment=require(_0xc86b('0x4'));var BPromise=require(_0xc86b('0x5'));var Mustache=require(_0xc86b('0x6'));var util=require(_0xc86b('0x7'));var path=require(_0xc86b('0x8'));var sox=require(_0xc86b('0x9'));var csv=require(_0xc86b('0xa'));var ejs=require(_0xc86b('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc86b('0xc'));var squel=require(_0xc86b('0xd'));var crypto=require(_0xc86b('0xe'));var jsforce=require(_0xc86b('0xf'));var deskjs=require(_0xc86b('0x10'));var toCsv=require(_0xc86b('0xa'));var querystring=require(_0xc86b('0x11'));var Papa=require(_0xc86b('0x12'));var Redis=require(_0xc86b('0x13'));var authService=require(_0xc86b('0x14'));var qs=require(_0xc86b('0x15'));var as=require(_0xc86b('0x16'));var hardwareService=require(_0xc86b('0x17'));var logger=require(_0xc86b('0x18'))(_0xc86b('0x19'));var utils=require(_0xc86b('0x1a'));var config=require(_0xc86b('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xc86b('0x1c'))['db'];function respondWithStatusCode(_0x1d2fe1,_0x41632c){_0x41632c=_0x41632c||0xcc;return function(_0x12b477){if(_0x12b477){return _0x1d2fe1[_0xc86b('0x1d')](_0x41632c);}return _0x1d2fe1[_0xc86b('0x1e')](_0x41632c)[_0xc86b('0x1f')]();};}function respondWithResult(_0x27b8eb,_0x1623fc){_0x1623fc=_0x1623fc||0xc8;return function(_0x393c7c){if(_0x393c7c){return _0x27b8eb[_0xc86b('0x1e')](_0x1623fc)[_0xc86b('0x20')](_0x393c7c);}};}function respondWithFilteredResult(_0x225d49,_0x1a4517){return function(_0x432458){if(_0x432458){var _0x124e89=typeof _0x1a4517[_0xc86b('0x21')]===_0xc86b('0x22')&&typeof _0x1a4517[_0xc86b('0x23')]==='undefined';var _0x1328cd=_0x432458[_0xc86b('0x24')];var _0x1d7c03=_0x124e89?0x0:_0x1a4517[_0xc86b('0x21')];var _0x4f88ab=_0x124e89?_0x432458['count']:_0x1a4517['offset']+_0x1a4517[_0xc86b('0x23')];var _0x1e5c48;if(_0x4f88ab>=_0x1328cd){_0x4f88ab=_0x1328cd;_0x1e5c48=0xc8;}else{_0x1e5c48=0xce;}_0x225d49[_0xc86b('0x1e')](_0x1e5c48);return _0x225d49[_0xc86b('0x25')](_0xc86b('0x26'),_0x1d7c03+'-'+_0x4f88ab+'/'+_0x1328cd)[_0xc86b('0x20')](_0x432458);}return null;};}function patchUpdates(_0xf7058f){return function(_0x1429d4){try{jsonpatch['apply'](_0x1429d4,_0xf7058f,!![]);}catch(_0x45a591){return BPromise[_0xc86b('0x27')](_0x45a591);}return _0x1429d4[_0xc86b('0x28')]();};}function saveUpdates(_0x157a62,_0x2ce92e){return function(_0x4a404c){if(_0x4a404c){return _0x4a404c[_0xc86b('0x29')](_0x157a62)['then'](function(_0x44c86d){return _0x44c86d;});}return null;};}function removeEntity(_0x51708b,_0x3502c1){return function(_0x1c68cd){if(_0x1c68cd){return _0x1c68cd[_0xc86b('0x2a')]()[_0xc86b('0x2b')](function(){_0x51708b[_0xc86b('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x438dce,_0x368365){return function(_0x5349e0){if(!_0x5349e0){_0x438dce['sendStatus'](0x194);}return _0x5349e0;};}function handleError(_0xf77e9b,_0x565519){_0x565519=_0x565519||0x1f4;return function(_0x39112d){logger['error'](_0x39112d[_0xc86b('0x2c')]);if(_0x39112d[_0xc86b('0x2d')]){delete _0x39112d[_0xc86b('0x2d')];}_0xf77e9b[_0xc86b('0x1e')](_0x565519)[_0xc86b('0x2e')](_0x39112d);};}exports['index']=function(_0xd44dba,_0x1e49c0){var _0x2a3e9e={},_0x3964f2={},_0x527c17={'count':0x0,'rows':[]};var _0x2acf81=_[_0xc86b('0x2f')](db[_0xc86b('0x30')][_0xc86b('0x31')],function(_0x355c05){return{'name':_0x355c05[_0xc86b('0x32')],'type':_0x355c05[_0xc86b('0x33')][_0xc86b('0x34')]};});_0x3964f2[_0xc86b('0x35')]=_[_0xc86b('0x36')](_['map'](_0x2acf81,_0xc86b('0x2d')),['name']);_0x3964f2[_0xc86b('0x37')]=_['keys'](_0xd44dba[_0xc86b('0x37')]);_0x3964f2[_0xc86b('0x38')]=_['intersection'](_0x3964f2[_0xc86b('0x35')],_0x3964f2[_0xc86b('0x37')]);_0x2a3e9e['attributes']=_['intersection'](_0x3964f2[_0xc86b('0x35')],qs[_0xc86b('0x39')](_0xd44dba[_0xc86b('0x37')][_0xc86b('0x39')]));_0x2a3e9e['attributes']=_0x2a3e9e[_0xc86b('0x3a')]['length']?_0x2a3e9e[_0xc86b('0x3a')]:_0x3964f2['model'];if(!_0xd44dba[_0xc86b('0x37')][_0xc86b('0x3b')]('nolimit')){_0x2a3e9e[_0xc86b('0x23')]=qs[_0xc86b('0x23')](_0xd44dba[_0xc86b('0x37')]['limit']);_0x2a3e9e[_0xc86b('0x21')]=qs[_0xc86b('0x21')](_0xd44dba['query'][_0xc86b('0x21')]);}_0x2a3e9e['order']=qs[_0xc86b('0x3c')](_0xd44dba[_0xc86b('0x37')]['sort']);_0x2a3e9e[_0xc86b('0x3d')]=qs[_0xc86b('0x38')](_[_0xc86b('0x3e')](_0xd44dba['query'],_0x3964f2['filters']),_0x2acf81);if(_0xd44dba['query'][_0xc86b('0x3f')]){_0x2a3e9e[_0xc86b('0x3d')]=_[_0xc86b('0x40')](_0x2a3e9e[_0xc86b('0x3d')],{'$or':_[_0xc86b('0x2f')](_0x2acf81,function(_0xf1b137){if(_0xf1b137['type']!==_0xc86b('0x41')){var _0x44d2a8={};_0x44d2a8[_0xf1b137[_0xc86b('0x2d')]]={'$like':'%'+_0xd44dba[_0xc86b('0x37')][_0xc86b('0x3f')]+'%'};return _0x44d2a8;}})});}_0x2a3e9e=_[_0xc86b('0x40')]({},_0x2a3e9e,_0xd44dba[_0xc86b('0x42')]);var _0x1bc6fa={'where':_0x2a3e9e[_0xc86b('0x3d')]};return db[_0xc86b('0x30')][_0xc86b('0x24')](_0x1bc6fa)[_0xc86b('0x2b')](function(_0x8fe91){_0x527c17['count']=_0x8fe91;if(_0xd44dba[_0xc86b('0x37')][_0xc86b('0x43')]){_0x2a3e9e[_0xc86b('0x44')]=[{'all':!![]}];}return db[_0xc86b('0x30')][_0xc86b('0x45')](_0x2a3e9e);})['then'](function(_0x3a4864){_0x527c17[_0xc86b('0x46')]=_0x3a4864;return _0x527c17;})[_0xc86b('0x2b')](respondWithFilteredResult(_0x1e49c0,_0x2a3e9e))[_0xc86b('0x47')](handleError(_0x1e49c0,null));};exports[_0xc86b('0x48')]=function(_0x50fd07,_0x187693){var _0x3bfe80={'raw':!![],'where':{'id':_0x50fd07['params']['id']}},_0x131c0a={};_0x131c0a[_0xc86b('0x35')]=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x131c0a['query']=_['keys'](_0x50fd07[_0xc86b('0x37')]);_0x131c0a[_0xc86b('0x38')]=_[_0xc86b('0x49')](_0x131c0a[_0xc86b('0x35')],_0x131c0a[_0xc86b('0x37')]);_0x3bfe80[_0xc86b('0x3a')]=_[_0xc86b('0x49')](_0x131c0a[_0xc86b('0x35')],qs[_0xc86b('0x39')](_0x50fd07[_0xc86b('0x37')][_0xc86b('0x39')]));_0x3bfe80[_0xc86b('0x3a')]=_0x3bfe80[_0xc86b('0x3a')]['length']?_0x3bfe80['attributes']:_0x131c0a[_0xc86b('0x35')];if(_0x50fd07['query'][_0xc86b('0x43')]){_0x3bfe80[_0xc86b('0x44')]=[{'all':!![]}];}_0x3bfe80=_[_0xc86b('0x40')]({},_0x3bfe80,_0x50fd07['options']);return db[_0xc86b('0x30')][_0xc86b('0x4a')](_0x3bfe80)[_0xc86b('0x2b')](handleEntityNotFound(_0x187693,null))[_0xc86b('0x2b')](respondWithResult(_0x187693,null))[_0xc86b('0x47')](handleError(_0x187693,null));};exports['create']=function(_0x33e488,_0xb48456){return db['VoiceMailMessage'][_0xc86b('0x4b')](_0x33e488['body'],{})[_0xc86b('0x2b')](respondWithResult(_0xb48456,0xc9))[_0xc86b('0x47')](handleError(_0xb48456,null));};exports['update']=function(_0x1c9604,_0x44202c){if(_0x1c9604[_0xc86b('0x4c')]['id']){delete _0x1c9604['body']['id'];}return db[_0xc86b('0x30')][_0xc86b('0x4a')]({'where':{'id':_0x1c9604['params']['id']}})[_0xc86b('0x2b')](handleEntityNotFound(_0x44202c,null))[_0xc86b('0x2b')](saveUpdates(_0x1c9604[_0xc86b('0x4c')],null))['then'](respondWithResult(_0x44202c,null))[_0xc86b('0x47')](handleError(_0x44202c,null));};exports['destroy']=function(_0x3609bb,_0x56f643){return db[_0xc86b('0x30')]['find']({'where':{'id':_0x3609bb[_0xc86b('0x4d')]['id']}})[_0xc86b('0x2b')](handleEntityNotFound(_0x56f643,null))['then'](removeEntity(_0x56f643,null))[_0xc86b('0x47')](handleError(_0x56f643,null));};exports[_0xc86b('0x4e')]=function(_0x191e07,_0x10d27d,_0x5b8656){return db[_0xc86b('0x30')][_0xc86b('0x4a')]({'where':{'id':_0x191e07[_0xc86b('0x4d')]['id']},'attributes':['id',_0xc86b('0x4f'),'msg_id']})[_0xc86b('0x2b')](handleEntityNotFound(_0x10d27d,null))['then'](function(_0xa15e0e){if(_0xa15e0e){if(!_0xa15e0e[_0xc86b('0x4f')]){throw new db['Sequelize']['ValidationError'](_0xc86b('0x50'));}var _0x130cf3={'Content-Type':_0xc86b('0x51'),'Content-Disposition':_0xc86b('0x52')};if(_0xa15e0e[_0xc86b('0x53')]){_0x130cf3[_0xc86b('0x54')]=_0xc86b('0x55')+_0xa15e0e['msg_id']+_0xc86b('0x56');}_0x10d27d[_0xc86b('0x25')](_0x130cf3);return _0x10d27d[_0xc86b('0x2e')](new Buffer(_0xa15e0e[_0xc86b('0x4f')]));}})[_0xc86b('0x47')](handleError(_0x10d27d,null));}; \ No newline at end of file +var _0x04a2=['show','params','intersection','length','catch','body','find','recording','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x04a2,0x153));var _0x204a=function(_0x51acd0,_0x3970bb){_0x51acd0=_0x51acd0-0x0;var _0x5a4a8b=_0x04a2[_0x51acd0];return _0x5a4a8b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x204a('0x0'));var zipdir=require(_0x204a('0x1'));var jsonpatch=require(_0x204a('0x2'));var rp=require(_0x204a('0x3'));var moment=require(_0x204a('0x4'));var BPromise=require(_0x204a('0x5'));var Mustache=require('mustache');var util=require(_0x204a('0x6'));var path=require(_0x204a('0x7'));var sox=require(_0x204a('0x8'));var csv=require(_0x204a('0x9'));var ejs=require(_0x204a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x204a('0xb'));var squel=require(_0x204a('0xc'));var crypto=require(_0x204a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x204a('0xe'));var toCsv=require(_0x204a('0x9'));var querystring=require(_0x204a('0xf'));var Papa=require(_0x204a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x204a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x204a('0x12'))('api');var utils=require(_0x204a('0x13'));var config=require(_0x204a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x204a('0x15'))['db'];function respondWithStatusCode(_0x2b5182,_0x35fdb6){_0x35fdb6=_0x35fdb6||0xcc;return function(_0x26b915){if(_0x26b915){return _0x2b5182[_0x204a('0x16')](_0x35fdb6);}return _0x2b5182[_0x204a('0x17')](_0x35fdb6)[_0x204a('0x18')]();};}function respondWithResult(_0x536c3c,_0x5bcfec){_0x5bcfec=_0x5bcfec||0xc8;return function(_0x392399){if(_0x392399){return _0x536c3c[_0x204a('0x17')](_0x5bcfec)[_0x204a('0x19')](_0x392399);}};}function respondWithFilteredResult(_0x545265,_0x4f29db){return function(_0x1d0829){if(_0x1d0829){var _0x153232=typeof _0x4f29db[_0x204a('0x1a')]===_0x204a('0x1b')&&typeof _0x4f29db['limit']===_0x204a('0x1b');var _0x16f9c6=_0x1d0829[_0x204a('0x1c')];var _0x14f4d6=_0x153232?0x0:_0x4f29db[_0x204a('0x1a')];var _0x48e86f=_0x153232?_0x1d0829[_0x204a('0x1c')]:_0x4f29db[_0x204a('0x1a')]+_0x4f29db[_0x204a('0x1d')];var _0x5b6c90;if(_0x48e86f>=_0x16f9c6){_0x48e86f=_0x16f9c6;_0x5b6c90=0xc8;}else{_0x5b6c90=0xce;}_0x545265[_0x204a('0x17')](_0x5b6c90);return _0x545265['set'](_0x204a('0x1e'),_0x14f4d6+'-'+_0x48e86f+'/'+_0x16f9c6)[_0x204a('0x19')](_0x1d0829);}return null;};}function patchUpdates(_0x752187){return function(_0x408b81){try{jsonpatch[_0x204a('0x1f')](_0x408b81,_0x752187,!![]);}catch(_0x4d3810){return BPromise[_0x204a('0x20')](_0x4d3810);}return _0x408b81[_0x204a('0x21')]();};}function saveUpdates(_0x2eadb4,_0x1ea858){return function(_0x355108){if(_0x355108){return _0x355108[_0x204a('0x22')](_0x2eadb4)[_0x204a('0x23')](function(_0x5070e4){return _0x5070e4;});}return null;};}function removeEntity(_0x434eff,_0x5b0a49){return function(_0xe80f10){if(_0xe80f10){return _0xe80f10[_0x204a('0x24')]()[_0x204a('0x23')](function(){_0x434eff[_0x204a('0x17')](0xcc)[_0x204a('0x18')]();});}};}function handleEntityNotFound(_0x13d7d1,_0xeaa157){return function(_0x2e2522){if(!_0x2e2522){_0x13d7d1[_0x204a('0x16')](0x194);}return _0x2e2522;};}function handleError(_0x66587d,_0x171cae){_0x171cae=_0x171cae||0x1f4;return function(_0x150a3e){logger[_0x204a('0x25')](_0x150a3e['stack']);if(_0x150a3e[_0x204a('0x26')]){delete _0x150a3e[_0x204a('0x26')];}_0x66587d[_0x204a('0x17')](_0x171cae)[_0x204a('0x27')](_0x150a3e);};}exports[_0x204a('0x28')]=function(_0x86eeff,_0x36e56a){var _0x442c46={},_0x3c0c9f={},_0x428d0d={'count':0x0,'rows':[]};var _0x4f495b=_[_0x204a('0x29')](db[_0x204a('0x2a')][_0x204a('0x2b')],function(_0x52c16d){return{'name':_0x52c16d[_0x204a('0x2c')],'type':_0x52c16d[_0x204a('0x2d')][_0x204a('0x2e')]};});_0x3c0c9f[_0x204a('0x2f')]=_[_0x204a('0x30')](_[_0x204a('0x29')](_0x4f495b,_0x204a('0x26')),[_0x204a('0x26')]);_0x3c0c9f[_0x204a('0x31')]=_[_0x204a('0x32')](_0x86eeff['query']);_0x3c0c9f[_0x204a('0x33')]=_['intersection'](_0x3c0c9f[_0x204a('0x2f')],_0x3c0c9f[_0x204a('0x31')]);_0x442c46['attributes']=_['intersection'](_0x3c0c9f[_0x204a('0x2f')],qs[_0x204a('0x34')](_0x86eeff['query']['fields']));_0x442c46[_0x204a('0x35')]=_0x442c46['attributes']['length']?_0x442c46['attributes']:_0x3c0c9f['model'];if(!_0x86eeff[_0x204a('0x31')][_0x204a('0x36')]('nolimit')){_0x442c46['limit']=qs['limit'](_0x86eeff['query'][_0x204a('0x1d')]);_0x442c46[_0x204a('0x1a')]=qs['offset'](_0x86eeff[_0x204a('0x31')][_0x204a('0x1a')]);}_0x442c46[_0x204a('0x37')]=qs[_0x204a('0x38')](_0x86eeff['query'][_0x204a('0x38')]);_0x442c46['where']=qs[_0x204a('0x33')](_[_0x204a('0x39')](_0x86eeff[_0x204a('0x31')],_0x3c0c9f[_0x204a('0x33')]),_0x4f495b);if(_0x86eeff['query'][_0x204a('0x3a')]){_0x442c46[_0x204a('0x3b')]=_[_0x204a('0x3c')](_0x442c46['where'],{'$or':_[_0x204a('0x29')](_0x4f495b,function(_0x52eccf){if(_0x52eccf[_0x204a('0x2d')]!==_0x204a('0x3d')){var _0x140de9={};_0x140de9[_0x52eccf[_0x204a('0x26')]]={'$like':'%'+_0x86eeff['query'][_0x204a('0x3a')]+'%'};return _0x140de9;}})});}_0x442c46=_[_0x204a('0x3c')]({},_0x442c46,_0x86eeff[_0x204a('0x3e')]);var _0x27c180={'where':_0x442c46['where']};return db[_0x204a('0x2a')][_0x204a('0x1c')](_0x27c180)[_0x204a('0x23')](function(_0x176b06){_0x428d0d['count']=_0x176b06;if(_0x86eeff[_0x204a('0x31')][_0x204a('0x3f')]){_0x442c46[_0x204a('0x40')]=[{'all':!![]}];}return db[_0x204a('0x2a')]['findAll'](_0x442c46);})[_0x204a('0x23')](function(_0x4d1bf9){_0x428d0d[_0x204a('0x41')]=_0x4d1bf9;return _0x428d0d;})[_0x204a('0x23')](respondWithFilteredResult(_0x36e56a,_0x442c46))['catch'](handleError(_0x36e56a,null));};exports[_0x204a('0x42')]=function(_0x1e9378,_0x19c98e){var _0x121786={'raw':!![],'where':{'id':_0x1e9378[_0x204a('0x43')]['id']}},_0x233e08={};_0x233e08[_0x204a('0x2f')]=_[_0x204a('0x32')](db[_0x204a('0x2a')][_0x204a('0x2b')]);_0x233e08['query']=_[_0x204a('0x32')](_0x1e9378[_0x204a('0x31')]);_0x233e08[_0x204a('0x33')]=_[_0x204a('0x44')](_0x233e08[_0x204a('0x2f')],_0x233e08[_0x204a('0x31')]);_0x121786[_0x204a('0x35')]=_[_0x204a('0x44')](_0x233e08[_0x204a('0x2f')],qs[_0x204a('0x34')](_0x1e9378[_0x204a('0x31')][_0x204a('0x34')]));_0x121786[_0x204a('0x35')]=_0x121786[_0x204a('0x35')][_0x204a('0x45')]?_0x121786[_0x204a('0x35')]:_0x233e08[_0x204a('0x2f')];if(_0x1e9378['query'][_0x204a('0x3f')]){_0x121786[_0x204a('0x40')]=[{'all':!![]}];}_0x121786=_[_0x204a('0x3c')]({},_0x121786,_0x1e9378['options']);return db[_0x204a('0x2a')]['find'](_0x121786)['then'](handleEntityNotFound(_0x19c98e,null))[_0x204a('0x23')](respondWithResult(_0x19c98e,null))[_0x204a('0x46')](handleError(_0x19c98e,null));};exports['create']=function(_0x4fc72b,_0x3c5be8){return db['VoiceMailMessage']['create'](_0x4fc72b[_0x204a('0x47')],{})[_0x204a('0x23')](respondWithResult(_0x3c5be8,0xc9))[_0x204a('0x46')](handleError(_0x3c5be8,null));};exports[_0x204a('0x22')]=function(_0x420564,_0x5551ab){if(_0x420564[_0x204a('0x47')]['id']){delete _0x420564['body']['id'];}return db[_0x204a('0x2a')][_0x204a('0x48')]({'where':{'id':_0x420564['params']['id']}})[_0x204a('0x23')](handleEntityNotFound(_0x5551ab,null))[_0x204a('0x23')](saveUpdates(_0x420564['body'],null))[_0x204a('0x23')](respondWithResult(_0x5551ab,null))[_0x204a('0x46')](handleError(_0x5551ab,null));};exports[_0x204a('0x24')]=function(_0x42d539,_0x424c59){return db[_0x204a('0x2a')][_0x204a('0x48')]({'where':{'id':_0x42d539[_0x204a('0x43')]['id']}})['then'](handleEntityNotFound(_0x424c59,null))[_0x204a('0x23')](removeEntity(_0x424c59,null))[_0x204a('0x46')](handleError(_0x424c59,null));};exports['download']=function(_0x4e8caf,_0x2935c6,_0xc16274){return db['VoiceMailMessage']['find']({'where':{'id':_0x4e8caf[_0x204a('0x43')]['id']},'attributes':['id',_0x204a('0x49'),'msg_id']})[_0x204a('0x23')](handleEntityNotFound(_0x2935c6,null))['then'](function(_0x1a0156){if(_0x1a0156){if(!_0x1a0156['recording']){throw new db['Sequelize'][(_0x204a('0x4a'))](_0x204a('0x4b'));}var _0x4642cd={'Content-Type':_0x204a('0x4c'),'Content-Disposition':'attachment'};if(_0x1a0156[_0x204a('0x4d')]){_0x4642cd[_0x204a('0x4e')]=_0x204a('0x4f')+_0x1a0156[_0x204a('0x4d')]+_0x204a('0x50');}_0x2935c6['set'](_0x4642cd);return _0x2935c6[_0x204a('0x27')](new Buffer(_0x1a0156[_0x204a('0x49')]));}})[_0x204a('0x46')](handleError(_0x2935c6,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 9cc7838..4378b6b 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 _0x0c81=['exports','VoiceMailMessage','dir','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0x34ca54,_0x1ca73a){var _0x57fa61=function(_0x1f6ff5){while(--_0x1f6ff5){_0x34ca54['push'](_0x34ca54['shift']());}};_0x57fa61(++_0x1ca73a);}(_0x0c81,0x9f));var _0x10c8=function(_0x3ae1a9,_0x3f6243){_0x3ae1a9=_0x3ae1a9-0x0;var _0x36b7e4=_0x0c81[_0x3ae1a9];return _0x36b7e4;};'use strict';var _=require(_0x10c8('0x0'));var util=require(_0x10c8('0x1'));var logger=require(_0x10c8('0x2'))(_0x10c8('0x3'));var moment=require('moment');var BPromise=require(_0x10c8('0x4'));var rp=require(_0x10c8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10c8('0x6'));var config=require(_0x10c8('0x7'));var attributes=require(_0x10c8('0x8'));module[_0x10c8('0x9')]=function(_0x143139,_0x5a7df6){return _0x143139['define'](_0x10c8('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x10c8('0xb'),'fields':[_0x10c8('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0xc73d=['bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','api'];(function(_0x36c56b,_0x583298){var _0x13c4f1=function(_0x1b074e){while(--_0x1b074e){_0x36c56b['push'](_0x36c56b['shift']());}};_0x13c4f1(++_0x583298);}(_0xc73d,0x1ea));var _0xdc73=function(_0x520255,_0x4aa3e8){_0x520255=_0x520255-0x0;var _0x1020cb=_0xc73d[_0x520255];return _0x1020cb;};'use strict';var _=require(_0xdc73('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdc73('0x1'));var moment=require('moment');var BPromise=require(_0xdc73('0x2'));var rp=require(_0xdc73('0x3'));var fs=require('fs');var path=require(_0xdc73('0x4'));var rimraf=require('rimraf');var config=require(_0xdc73('0x5'));var attributes=require(_0xdc73('0x6'));module[_0xdc73('0x7')]=function(_0xe06d48,_0x2ce10f){return _0xe06d48[_0xdc73('0x8')](_0xdc73('0x9'),attributes,{'tableName':_0xdc73('0xa'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xdc73('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 26fbdae..0c32a67 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 _0xe758=['VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x352b49,_0x16a4ee){var _0x2e314a=function(_0x339d73){while(--_0x339d73){_0x352b49['push'](_0x352b49['shift']());}};_0x2e314a(++_0x16a4ee);}(_0xe758,0x14f));var _0x8e75=function(_0x1288c5,_0x1e71fc){_0x1288c5=_0x1288c5-0x0;var _0x385997=_0xe758[_0x1288c5];return _0x385997;};'use strict';var _=require(_0x8e75('0x0'));var util=require(_0x8e75('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8e75('0x2'));var fs=require('fs');var Redis=require(_0x8e75('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e75('0x4'));var logger=require(_0x8e75('0x5'))(_0x8e75('0x6'));var config=require(_0x8e75('0x7'));var jayson=require(_0x8e75('0x8'));var client=jayson[_0x8e75('0x9')][_0x8e75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x212ff2,_0x33a674,_0x552507){return new BPromise(function(_0x3601fc,_0x5a8505){return client[_0x8e75('0xb')](_0x212ff2,_0x552507)[_0x8e75('0xc')](function(_0x588427){logger[_0x8e75('0xd')](_0x8e75('0xe'),_0x33a674,_0x8e75('0xf'));logger[_0x8e75('0x10')](_0x8e75('0x11'),_0x33a674,'request\x20sent',JSON[_0x8e75('0x12')](_0x588427));if(_0x588427['error']){if(_0x588427[_0x8e75('0x13')]['code']===0x1f4){logger[_0x8e75('0x13')](_0x8e75('0xe'),_0x33a674,_0x588427[_0x8e75('0x13')][_0x8e75('0x14')]);return _0x5a8505(_0x588427['error']['message']);}logger['error'](_0x8e75('0xe'),_0x33a674,_0x588427[_0x8e75('0x13')][_0x8e75('0x14')]);return _0x3601fc(_0x588427[_0x8e75('0x13')][_0x8e75('0x14')]);}else{logger['info'](_0x8e75('0xe'),_0x33a674,'request\x20sent');_0x3601fc(_0x588427[_0x8e75('0x15')][_0x8e75('0x14')]);}})['catch'](function(_0x544c2d){logger[_0x8e75('0x13')](_0x8e75('0xe'),_0x33a674,_0x544c2d);_0x5a8505(_0x544c2d);});});} \ No newline at end of file +var _0x5b43=['code','message','info','result','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x7e1a94,_0x23e715){var _0x569427=function(_0x1302cd){while(--_0x1302cd){_0x7e1a94['push'](_0x7e1a94['shift']());}};_0x569427(++_0x23e715);}(_0x5b43,0x1d2));var _0x35b4=function(_0x4a632b,_0x42efb8){_0x4a632b=_0x4a632b-0x0;var _0x1f3690=_0x5b43[_0x4a632b];return _0x1f3690;};'use strict';var _=require(_0x35b4('0x0'));var util=require(_0x35b4('0x1'));var moment=require(_0x35b4('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35b4('0x3'));var db=require(_0x35b4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x35b4('0x5'));var config=require(_0x35b4('0x6'));var jayson=require(_0x35b4('0x7'));var client=jayson[_0x35b4('0x8')][_0x35b4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bdeec,_0x495642,_0x3140ed){return new BPromise(function(_0x11ebde,_0x3be9cb){return client[_0x35b4('0xa')](_0x2bdeec,_0x3140ed)[_0x35b4('0xb')](function(_0x31b67d){logger['info'](_0x35b4('0xc'),_0x495642,_0x35b4('0xd'));logger[_0x35b4('0xe')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x495642,_0x35b4('0xd'),JSON[_0x35b4('0xf')](_0x31b67d));if(_0x31b67d['error']){if(_0x31b67d[_0x35b4('0x10')][_0x35b4('0x11')]===0x1f4){logger[_0x35b4('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x495642,_0x31b67d[_0x35b4('0x10')][_0x35b4('0x12')]);return _0x3be9cb(_0x31b67d[_0x35b4('0x10')]['message']);}logger[_0x35b4('0x10')](_0x35b4('0xc'),_0x495642,_0x31b67d[_0x35b4('0x10')][_0x35b4('0x12')]);return _0x11ebde(_0x31b67d['error'][_0x35b4('0x12')]);}else{logger[_0x35b4('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x495642,'request\x20sent');_0x11ebde(_0x31b67d[_0x35b4('0x14')][_0x35b4('0x12')]);}})['catch'](function(_0x30b578){logger[_0x35b4('0x10')](_0x35b4('0xc'),_0x495642,_0x30b578);_0x3be9cb(_0x30b578);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index da42b33..de12d51 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 _0x7058=['get','isAuthenticated','index','show','getSounds','post','create','/:id/sounds','addSound','put','/:id','update','delete','destroy','removeSound','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x2f2680,_0x2f7bd7){var _0x3fc197=function(_0x28d79c){while(--_0x28d79c){_0x2f2680['push'](_0x2f2680['shift']());}};_0x3fc197(++_0x2f7bd7);}(_0x7058,0x13b));var _0x8705=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x7058[_0xc67528];return _0x38e26d;};'use strict';var multer=require(_0x8705('0x0'));var util=require(_0x8705('0x1'));var path=require(_0x8705('0x2'));var timeout=require(_0x8705('0x3'));var express=require(_0x8705('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8705('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8705('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x8705('0x7')]('/',auth[_0x8705('0x8')](),controller[_0x8705('0x9')]);router['get']('/:id',auth[_0x8705('0x8')](),controller[_0x8705('0xa')]);router[_0x8705('0x7')]('/:id/sounds',auth['isAuthenticated'](),controller[_0x8705('0xb')]);router[_0x8705('0xc')]('/',auth['isAuthenticated'](),controller[_0x8705('0xd')]);router[_0x8705('0xc')](_0x8705('0xe'),auth[_0x8705('0x8')](),controller[_0x8705('0xf')]);router[_0x8705('0x10')](_0x8705('0x11'),auth[_0x8705('0x8')](),controller[_0x8705('0x12')]);router[_0x8705('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x8705('0x14')]);router[_0x8705('0x13')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x8705('0x15')]);module[_0x8705('0x16')]=router; \ No newline at end of file +var _0x08b8=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','delete','removeSound','exports','multer','util','path','express'];(function(_0x9ff8c8,_0x40581b){var _0x58861d=function(_0x5b388e){while(--_0x5b388e){_0x9ff8c8['push'](_0x9ff8c8['shift']());}};_0x58861d(++_0x40581b);}(_0x08b8,0xec));var _0x808b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x08b8[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x808b('0x0'));var util=require(_0x808b('0x1'));var path=require(_0x808b('0x2'));var timeout=require('connect-timeout');var express=require(_0x808b('0x3'));var router=express[_0x808b('0x4')]();var fs_extra=require(_0x808b('0x5'));var auth=require(_0x808b('0x6'));var interaction=require(_0x808b('0x7'));var config=require(_0x808b('0x8'));var controller=require(_0x808b('0x9'));router[_0x808b('0xa')]('/',auth[_0x808b('0xb')](),controller[_0x808b('0xc')]);router['get'](_0x808b('0xd'),auth[_0x808b('0xb')](),controller[_0x808b('0xe')]);router['get'](_0x808b('0xf'),auth[_0x808b('0xb')](),controller[_0x808b('0x10')]);router[_0x808b('0x11')]('/',auth[_0x808b('0xb')](),controller[_0x808b('0x12')]);router[_0x808b('0x11')](_0x808b('0xf'),auth['isAuthenticated'](),controller[_0x808b('0x13')]);router[_0x808b('0x14')](_0x808b('0xd'),auth[_0x808b('0xb')](),controller['update']);router['delete']('/:id',auth[_0x808b('0xb')](),controller['destroy']);router[_0x808b('0x15')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x808b('0x16')]);module[_0x808b('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 82fbb4a..6da9fb3 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 _0x8bda=['files','mp3nb','quietmp3nb','mp3','alpha','BOOLEAN','exports','STRING','custom'];(function(_0x1c2759,_0x58d02c){var _0x20ee10=function(_0x1e00ff){while(--_0x1e00ff){_0x1c2759['push'](_0x1c2759['shift']());}};_0x20ee10(++_0x58d02c);}(_0x8bda,0x9f));var _0xa8bd=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x8bda[_0x425716];return _0x2d39af;};'use strict';var Sequelize=require('sequelize');module[_0xa8bd('0x0')]={'name':{'type':Sequelize[_0xa8bd('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM'](_0xa8bd('0x2'),_0xa8bd('0x3'),_0xa8bd('0x4'),_0xa8bd('0x5'),'quietmp3',_0xa8bd('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xa8bd('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xa8bd('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa8bd('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa8bd('0x1')],'allowNull':!![],'defaultValue':_0xa8bd('0x7')},'format':{'type':Sequelize[_0xa8bd('0x1')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xa8bd('0x8')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfe13=['TIMESTAMP','BOOLEAN','sequelize','STRING','files','mp3nb','quietmp3','alpha'];(function(_0x255b94,_0x352b45){var _0xc5806b=function(_0x530e79){while(--_0x530e79){_0x255b94['push'](_0x255b94['shift']());}};_0xc5806b(++_0x352b45);}(_0xfe13,0xea));var _0x3fe1=function(_0x5bc5fe,_0x2afaef){_0x5bc5fe=_0x5bc5fe-0x0;var _0x298ea7=_0xfe13[_0x5bc5fe];return _0x298ea7;};'use strict';var Sequelize=require(_0x3fe1('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fe1('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize['ENUM']('custom',_0x3fe1('0x2'),_0x3fe1('0x3'),'quietmp3nb',_0x3fe1('0x4'),'mp3'),'allowNull':!![],'defaultValue':_0x3fe1('0x2')},'directory':{'type':Sequelize[_0x3fe1('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0x3fe1('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0x3fe1('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x3fe1('0x1')],'allowNull':!![],'defaultValue':_0x3fe1('0x5')},'format':{'type':Sequelize[_0x3fe1('0x1')],'allowNull':!![]},'stamp':{'type':_0x3fe1('0x6')},'defaultEntry':{'type':Sequelize[_0x3fe1('0x7')],'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 edfeed5..3115098 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 _0x2e26=['attributes','fields','length','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','update','body','find','create','transaction','files','directory','root','server/files/moh','mode','mkdirSync','0777','userProfileId','autoAssociation','error','readdirSync','rmdirSync','Sequelize','ValidationError','sequelize','Sound','findOne','save_name','join','server/files/sounds/converted','format','extname','converted_format','%s.%s','symlinkSync','message','removeSound','id2','createdAt','unlinkSync','filter','getSounds','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','map','VoiceMusicOnHold','fieldName','type','key','keys','query','intersection','model'];(function(_0x4d45a0,_0x3e9956){var _0x34d080=function(_0x4df78c){while(--_0x4df78c){_0x4d45a0['push'](_0x4d45a0['shift']());}};_0x34d080(++_0x3e9956);}(_0x2e26,0x186));var _0x62e2=function(_0x50fe9e,_0x196514){_0x50fe9e=_0x50fe9e-0x0;var _0x2d5230=_0x2e26[_0x50fe9e];return _0x2d5230;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62e2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x62e2('0x1'));var rp=require('request-promise');var moment=require(_0x62e2('0x2'));var BPromise=require(_0x62e2('0x3'));var Mustache=require(_0x62e2('0x4'));var util=require(_0x62e2('0x5'));var path=require(_0x62e2('0x6'));var sox=require(_0x62e2('0x7'));var csv=require(_0x62e2('0x8'));var ejs=require(_0x62e2('0x9'));var fs=require('fs');var fs_extra=require(_0x62e2('0xa'));var _=require(_0x62e2('0xb'));var squel=require(_0x62e2('0xc'));var crypto=require('crypto');var jsforce=require(_0x62e2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x62e2('0x8'));var querystring=require(_0x62e2('0xe'));var Papa=require(_0x62e2('0xf'));var Redis=require(_0x62e2('0x10'));var authService=require(_0x62e2('0x11'));var qs=require(_0x62e2('0x12'));var as=require(_0x62e2('0x13'));var hardwareService=require(_0x62e2('0x14'));var logger=require('../../config/logger')(_0x62e2('0x15'));var utils=require('../../config/utils');var config=require(_0x62e2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x62e2('0x17'))['db'];function respondWithStatusCode(_0x52fb07,_0x228e23){_0x228e23=_0x228e23||0xcc;return function(_0x11c7d6){if(_0x11c7d6){return _0x52fb07[_0x62e2('0x18')](_0x228e23);}return _0x52fb07[_0x62e2('0x19')](_0x228e23)[_0x62e2('0x1a')]();};}function respondWithResult(_0x31ae6a,_0x2a21f5){_0x2a21f5=_0x2a21f5||0xc8;return function(_0x239875){if(_0x239875){return _0x31ae6a[_0x62e2('0x19')](_0x2a21f5)[_0x62e2('0x1b')](_0x239875);}};}function respondWithFilteredResult(_0x23bc63,_0x40d367){return function(_0x35bcb0){if(_0x35bcb0){var _0x260843=typeof _0x40d367['offset']===_0x62e2('0x1c')&&typeof _0x40d367[_0x62e2('0x1d')]===_0x62e2('0x1c');var _0x428786=_0x35bcb0[_0x62e2('0x1e')];var _0x17bcb0=_0x260843?0x0:_0x40d367[_0x62e2('0x1f')];var _0x25c4f7=_0x260843?_0x35bcb0[_0x62e2('0x1e')]:_0x40d367['offset']+_0x40d367[_0x62e2('0x1d')];var _0x940fd7;if(_0x25c4f7>=_0x428786){_0x25c4f7=_0x428786;_0x940fd7=0xc8;}else{_0x940fd7=0xce;}_0x23bc63['status'](_0x940fd7);return _0x23bc63[_0x62e2('0x20')](_0x62e2('0x21'),_0x17bcb0+'-'+_0x25c4f7+'/'+_0x428786)[_0x62e2('0x1b')](_0x35bcb0);}return null;};}function patchUpdates(_0x26d226){return function(_0x5ae5b3){try{jsonpatch[_0x62e2('0x22')](_0x5ae5b3,_0x26d226,!![]);}catch(_0x10f2d4){return BPromise[_0x62e2('0x23')](_0x10f2d4);}return _0x5ae5b3[_0x62e2('0x24')]();};}function saveUpdates(_0x2b3f08,_0x193889){return function(_0x31085b){if(_0x31085b){return _0x31085b['update'](_0x2b3f08)[_0x62e2('0x25')](function(_0x143237){return _0x143237;});}return null;};}function removeEntity(_0x431088,_0xfa8a27){return function(_0x844235){if(_0x844235){return _0x844235[_0x62e2('0x26')]()[_0x62e2('0x25')](function(){var _0x56ad3b=_0x844235[_0x62e2('0x27')]({'plain':!![]});var _0x6f323f=_0x62e2('0x28');return db[_0x62e2('0x29')]['destroy']({'where':{'type':_0x6f323f,'resourceId':_0x56ad3b['id']}})[_0x62e2('0x25')](function(){return _0x844235;});})['then'](function(){_0x431088[_0x62e2('0x19')](0xcc)[_0x62e2('0x1a')]();});}};}function handleEntityNotFound(_0xe303e7,_0x14c6ef){return function(_0x536388){if(!_0x536388){_0xe303e7[_0x62e2('0x18')](0x194);}return _0x536388;};}function handleError(_0x257c58,_0x3ef7a4){_0x3ef7a4=_0x3ef7a4||0x1f4;return function(_0x282e5d){logger['error'](_0x282e5d[_0x62e2('0x2a')]);if(_0x282e5d[_0x62e2('0x2b')]){delete _0x282e5d[_0x62e2('0x2b')];}_0x257c58[_0x62e2('0x19')](_0x3ef7a4)[_0x62e2('0x2c')](_0x282e5d);};}exports['index']=function(_0x57801d,_0x3db219){var _0x26a311={},_0xbf03d9={},_0x2dddd5={'count':0x0,'rows':[]};var _0x2e3140=_[_0x62e2('0x2d')](db[_0x62e2('0x2e')]['rawAttributes'],function(_0x1c30a4){return{'name':_0x1c30a4[_0x62e2('0x2f')],'type':_0x1c30a4[_0x62e2('0x30')][_0x62e2('0x31')]};});_0xbf03d9['model']=_[_0x62e2('0x2d')](_0x2e3140,'name');_0xbf03d9['query']=_[_0x62e2('0x32')](_0x57801d[_0x62e2('0x33')]);_0xbf03d9['filters']=_[_0x62e2('0x34')](_0xbf03d9[_0x62e2('0x35')],_0xbf03d9[_0x62e2('0x33')]);_0x26a311[_0x62e2('0x36')]=_['intersection'](_0xbf03d9['model'],qs['fields'](_0x57801d['query'][_0x62e2('0x37')]));_0x26a311[_0x62e2('0x36')]=_0x26a311[_0x62e2('0x36')][_0x62e2('0x38')]?_0x26a311[_0x62e2('0x36')]:_0xbf03d9[_0x62e2('0x35')];if(!_0x57801d[_0x62e2('0x33')]['hasOwnProperty'](_0x62e2('0x39'))){_0x26a311[_0x62e2('0x1d')]=qs[_0x62e2('0x1d')](_0x57801d[_0x62e2('0x33')][_0x62e2('0x1d')]);_0x26a311['offset']=qs[_0x62e2('0x1f')](_0x57801d[_0x62e2('0x33')][_0x62e2('0x1f')]);}_0x26a311[_0x62e2('0x3a')]=qs[_0x62e2('0x3b')](_0x57801d['query'][_0x62e2('0x3b')]);delete _0x57801d[_0x62e2('0x33')][_0x62e2('0x3b')];_0x26a311['where']=qs[_0x62e2('0x3c')](_[_0x62e2('0x3d')](_0x57801d['query'],_0xbf03d9[_0x62e2('0x3c')]),_0x2e3140);if(_0x57801d[_0x62e2('0x33')]['filter']){_0x26a311[_0x62e2('0x3e')]=_[_0x62e2('0x3f')](_0x26a311[_0x62e2('0x3e')],{'$or':_[_0x62e2('0x2d')](_0x2e3140,function(_0xff0ff1){if(_0xff0ff1[_0x62e2('0x30')]!==_0x62e2('0x40')){var _0x16c7dd={};_0x16c7dd[_0xff0ff1[_0x62e2('0x2b')]]={'$like':'%'+_0x57801d[_0x62e2('0x33')]['filter']+'%'};return _0x16c7dd;}})});}_0x26a311=_['merge']({},_0x26a311,_0x57801d[_0x62e2('0x41')]);var _0x46f168={'where':_0x26a311[_0x62e2('0x3e')]};return db[_0x62e2('0x2e')][_0x62e2('0x1e')](_0x46f168)[_0x62e2('0x25')](function(_0x49075d){_0x2dddd5[_0x62e2('0x1e')]=_0x49075d;if(_0x57801d['query'][_0x62e2('0x42')]){_0x26a311[_0x62e2('0x43')]=[{'all':!![]}];}return db[_0x62e2('0x2e')][_0x62e2('0x44')](_0x26a311);})[_0x62e2('0x25')](function(_0x482145){_0x2dddd5[_0x62e2('0x45')]=_0x482145;return _0x2dddd5;})[_0x62e2('0x25')](respondWithFilteredResult(_0x3db219,_0x26a311))[_0x62e2('0x46')](handleError(_0x3db219,null));};exports[_0x62e2('0x47')]=function(_0x21a806,_0x15b0a9){var _0xe237cd={'raw':![],'where':{'id':_0x21a806[_0x62e2('0x48')]['id']}},_0x583ddd={};_0x583ddd[_0x62e2('0x35')]=_['keys'](db['VoiceMusicOnHold'][_0x62e2('0x49')]);_0x583ddd[_0x62e2('0x33')]=_[_0x62e2('0x32')](_0x21a806[_0x62e2('0x33')]);_0x583ddd[_0x62e2('0x3c')]=_[_0x62e2('0x34')](_0x583ddd[_0x62e2('0x35')],_0x583ddd[_0x62e2('0x33')]);_0xe237cd[_0x62e2('0x36')]=_['intersection'](_0x583ddd['model'],qs[_0x62e2('0x37')](_0x21a806[_0x62e2('0x33')][_0x62e2('0x37')]));_0xe237cd[_0x62e2('0x36')]=_0xe237cd['attributes'][_0x62e2('0x38')]?_0xe237cd[_0x62e2('0x36')]:_0x583ddd['model'];if(_0x21a806[_0x62e2('0x33')]['includeAll']){_0xe237cd[_0x62e2('0x43')]=[{'all':!![]}];}_0xe237cd=_['merge']({},_0xe237cd,_0x21a806[_0x62e2('0x41')]);return db['VoiceMusicOnHold']['find'](_0xe237cd)[_0x62e2('0x25')](handleEntityNotFound(_0x15b0a9,null))[_0x62e2('0x25')](respondWithResult(_0x15b0a9,null))['catch'](handleError(_0x15b0a9,null));};exports[_0x62e2('0x4a')]=function(_0x5095b2,_0x18cbd9){if(_0x5095b2['body']['id']){delete _0x5095b2[_0x62e2('0x4b')]['id'];}return db[_0x62e2('0x2e')][_0x62e2('0x4c')]({'where':{'id':_0x5095b2['params']['id']}})['then'](handleEntityNotFound(_0x18cbd9,null))[_0x62e2('0x25')](saveUpdates(_0x5095b2[_0x62e2('0x4b')],null))[_0x62e2('0x25')](respondWithResult(_0x18cbd9,null))[_0x62e2('0x46')](handleError(_0x18cbd9,null));};exports[_0x62e2('0x4d')]=function(_0x5c93b8,_0x488a12,_0xd9c632){return db['sequelize'][_0x62e2('0x4e')](function(_0x334322){if(_0x5c93b8[_0x62e2('0x4b')]['mode']===_0x62e2('0x4f')){_0x5c93b8[_0x62e2('0x4b')][_0x62e2('0x50')]=path['join'](config[_0x62e2('0x51')],_0x62e2('0x52'),_0x5c93b8[_0x62e2('0x4b')][_0x62e2('0x2b')]);}return db[_0x62e2('0x2e')]['create'](_0x5c93b8[_0x62e2('0x4b')],{'transaction':_0x334322})[_0x62e2('0x25')](function(_0x1877ed){if(_0x5c93b8['body'][_0x62e2('0x53')]===_0x62e2('0x4f')){fs[_0x62e2('0x54')](_0x1877ed[_0x62e2('0x50')],parseInt(_0x62e2('0x55'),0x8));}var _0x2a3463=_0x5c93b8['user'][_0x62e2('0x27')]({'plain':!![]});if(!_0x2a3463)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a3463['role']==='user'){var _0x4e90a1=_0x1877ed[_0x62e2('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x62e2('0x4c')]({'where':{'name':_0x62e2('0x28'),'userProfileId':_0x2a3463[_0x62e2('0x56')]},'raw':!![]})[_0x62e2('0x25')](function(_0x337ab5){if(_0x337ab5&&_0x337ab5[_0x62e2('0x57')]===0x0){return db[_0x62e2('0x29')]['create']({'name':_0x4e90a1[_0x62e2('0x2b')],'resourceId':_0x4e90a1['id'],'type':_0x337ab5[_0x62e2('0x2b')],'sectionId':_0x337ab5['id']},{})[_0x62e2('0x25')](function(){return _0x1877ed;});}else{return _0x1877ed;}})['catch'](function(_0x5284ee){logger[_0x62e2('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5284ee);});}return _0x1877ed;});})['then'](respondWithResult(_0x488a12,0xc9))[_0x62e2('0x46')](handleError(_0x488a12,null));};exports[_0x62e2('0x26')]=function(_0x106216,_0x650c49,_0x27898d){var _0x1973ca;return db['VoiceMusicOnHold'][_0x62e2('0x4c')]({'where':{'id':_0x106216[_0x62e2('0x48')]['id']}})[_0x62e2('0x25')](function(_0x5b36b4){if(_0x5b36b4){return db['sequelize'][_0x62e2('0x4e')](function(_0x44f589){return _0x5b36b4[_0x62e2('0x26')]({'transaction':_0x44f589,'raw':!![]})['then'](function(_0x9e8d9b){if(_0x9e8d9b[_0x62e2('0x50')]){fs[_0x62e2('0x59')](_0x9e8d9b[_0x62e2('0x50')])['forEach'](function(_0x2a95d4){fs['unlinkSync'](path['join'](_0x9e8d9b[_0x62e2('0x50')],_0x2a95d4));});fs[_0x62e2('0x5a')](_0x9e8d9b[_0x62e2('0x50')]);}return _0x9e8d9b;});})[_0x62e2('0x46')](function(_0x32b4d6){throw new db[(_0x62e2('0x5b'))][(_0x62e2('0x5c'))](_0x32b4d6['message']);});}})[_0x62e2('0x25')](handleEntityNotFound(_0x650c49,null))[_0x62e2('0x25')](removeEntity(_0x650c49,null))[_0x62e2('0x46')](handleError(_0x650c49,null));};exports['addSound']=function(_0x45118c,_0x5306cd,_0x4ee976){return db[_0x62e2('0x5d')][_0x62e2('0x4e')](function(_0x7735de){var _0x3402dd;return db[_0x62e2('0x2e')][_0x62e2('0x4c')]({'where':{'id':_0x45118c[_0x62e2('0x48')]['id']}})['then'](function(_0x60b086){if(_0x60b086){_0x3402dd=_0x60b086;return _0x60b086['addSound'](_0x45118c['body']['id'],{'transaction':_0x7735de});}})[_0x62e2('0x25')](function(_0x2f9cd4){if(_0x2f9cd4){return db[_0x62e2('0x5e')][_0x62e2('0x5f')]({'where':{'id':_0x45118c['body']['id']},'attributes':['id',_0x62e2('0x2b'),_0x62e2('0x60'),'converted_format','createdAt'],'raw':!![]});}})[_0x62e2('0x25')](function(_0x52d356){if(_0x52d356){var _0xf9c9aa=path[_0x62e2('0x61')](config[_0x62e2('0x51')],_0x62e2('0x62'),util[_0x62e2('0x63')]('%s.%s',path['basename'](_0x52d356[_0x62e2('0x60')],path[_0x62e2('0x64')](_0x52d356['save_name'])),_0x52d356[_0x62e2('0x65')]));var _0x5b3e00=path[_0x62e2('0x61')](config['root'],_0x62e2('0x52'),_0x3402dd[_0x62e2('0x2b')],util[_0x62e2('0x63')](_0x62e2('0x66'),_0x52d356[_0x62e2('0x2b')],_0x52d356[_0x62e2('0x65')]));fs[_0x62e2('0x67')](_0xf9c9aa,_0x5b3e00);return _0x52d356;}})[_0x62e2('0x46')](function(_0x4e0c72){throw new db[(_0x62e2('0x5b'))][(_0x62e2('0x5c'))](_0x4e0c72[_0x62e2('0x68')]);});})[_0x62e2('0x25')](handleEntityNotFound(_0x5306cd,null))['then'](respondWithResult(_0x5306cd,0xc9))[_0x62e2('0x46')](handleError(_0x5306cd,null));};exports[_0x62e2('0x69')]=function(_0x424a0e,_0xade23b,_0x328d34){return db[_0x62e2('0x5d')][_0x62e2('0x4e')](function(_0x367e01){var _0x5a091f;return db['VoiceMusicOnHold'][_0x62e2('0x5f')]({'where':{'id':_0x424a0e['params']['id']}})[_0x62e2('0x25')](handleEntityNotFound(_0xade23b,null))['then'](function(_0x3c819b){if(_0x3c819b){_0x5a091f=_0x3c819b;return _0x3c819b[_0x62e2('0x69')](_0x424a0e[_0x62e2('0x48')][_0x62e2('0x6a')]);}})[_0x62e2('0x25')](function(_0x4c5cb9){if(_0x4c5cb9){return db[_0x62e2('0x5e')][_0x62e2('0x5f')]({'where':{'id':_0x424a0e[_0x62e2('0x48')]['id2']},'attributes':['id','name',_0x62e2('0x60'),'converted_format',_0x62e2('0x6b')],'raw':!![]});}})[_0x62e2('0x25')](function(_0x182175){if(_0x182175){fs[_0x62e2('0x6c')](path[_0x62e2('0x61')](_0x5a091f[_0x62e2('0x50')],util[_0x62e2('0x63')](_0x62e2('0x66'),_0x182175[_0x62e2('0x2b')],_0x182175[_0x62e2('0x65')])));return _0x182175;}})[_0x62e2('0x46')](function(_0x16214d){throw new db['Sequelize'][(_0x62e2('0x5c'))](_0x16214d[_0x62e2('0x68')]);});})['then'](handleEntityNotFound(_0xade23b,null))[_0x62e2('0x25')](respondWithStatusCode(_0xade23b,0xcc))[_0x62e2('0x46')](handleError(_0xade23b,null));};exports['getSounds']=function(_0x2c4bc0,_0x51847f,_0x5693e8){var _0x4dacfb={};var _0x1061c1={};var _0xdff402;var _0x1c0e8d;return db[_0x62e2('0x2e')][_0x62e2('0x5f')]({'where':{'id':_0x2c4bc0[_0x62e2('0x48')]['id']}})[_0x62e2('0x25')](handleEntityNotFound(_0x51847f,null))[_0x62e2('0x25')](function(_0x2da583){if(_0x2da583){_0xdff402=_0x2da583;_0x1061c1['model']=_[_0x62e2('0x32')](db[_0x62e2('0x5e')][_0x62e2('0x49')]);_0x1061c1[_0x62e2('0x33')]=_[_0x62e2('0x32')](_0x2c4bc0[_0x62e2('0x33')]);_0x1061c1[_0x62e2('0x3c')]=_[_0x62e2('0x34')](_0x1061c1['model'],_0x1061c1[_0x62e2('0x33')]);_0x4dacfb[_0x62e2('0x36')]=_[_0x62e2('0x34')](_0x1061c1['model'],qs['fields'](_0x2c4bc0[_0x62e2('0x33')]['fields']));_0x4dacfb[_0x62e2('0x36')]=_0x4dacfb[_0x62e2('0x36')][_0x62e2('0x38')]?_0x4dacfb[_0x62e2('0x36')]:_0x1061c1[_0x62e2('0x35')];_0x4dacfb[_0x62e2('0x3a')]=qs[_0x62e2('0x3b')](_0x2c4bc0[_0x62e2('0x33')][_0x62e2('0x3b')]);_0x4dacfb[_0x62e2('0x3e')]=qs[_0x62e2('0x3c')](_[_0x62e2('0x3d')](_0x2c4bc0['query'],_0x1061c1['filters']));if(_0x2c4bc0['query'][_0x62e2('0x6d')]){_0x4dacfb[_0x62e2('0x3e')]=_['merge'](_0x4dacfb[_0x62e2('0x3e')],{'$or':_[_0x62e2('0x2d')](_0x4dacfb[_0x62e2('0x36')],function(_0x41e47e){var _0x49a6a1={};_0x49a6a1[_0x41e47e]={'$like':'%'+_0x2c4bc0[_0x62e2('0x33')]['filter']+'%'};return _0x49a6a1;})});}_0x4dacfb=_[_0x62e2('0x3f')]({},_0x4dacfb,_0x2c4bc0['options']);return _0xdff402[_0x62e2('0x6e')](_0x4dacfb);}})[_0x62e2('0x25')](function(_0x1f4a4b){if(_0x1f4a4b){_0x1c0e8d=_0x1f4a4b[_0x62e2('0x38')];if(!_0x2c4bc0[_0x62e2('0x33')]['hasOwnProperty'](_0x62e2('0x39'))){_0x4dacfb[_0x62e2('0x1d')]=qs[_0x62e2('0x1d')](_0x2c4bc0[_0x62e2('0x33')][_0x62e2('0x1d')]);_0x4dacfb['offset']=qs[_0x62e2('0x1f')](_0x2c4bc0[_0x62e2('0x33')][_0x62e2('0x1f')]);}return _0xdff402[_0x62e2('0x6e')](_0x4dacfb);}})['then'](function(_0x326369){if(_0x326369){return _0x326369?{'count':_0x1c0e8d,'rows':_0x326369}:null;}})[_0x62e2('0x25')](respondWithResult(_0x51847f,null))[_0x62e2('0x46')](handleError(_0x51847f,null));}; \ No newline at end of file +var _0x5e62=['catch','params','keys','length','find','update','body','create','transaction','mode','files','root','mkdirSync','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','directory','readdirSync','unlinkSync','join','ValidationError','message','addSound','sequelize','Sound','findOne','save_name','createdAt','server/files/sounds/converted','format','server/files/moh','%s.%s','converted_format','symlinkSync','Sequelize','removeSound','id2','getSounds','hasOwnProperty','nolimit','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','apply','reject','save','then','MusicOnHolds','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x5ccc2b,_0x5852ad){var _0x5f4255=function(_0x34eeb6){while(--_0x34eeb6){_0x5ccc2b['push'](_0x5ccc2b['shift']());}};_0x5f4255(++_0x5852ad);}(_0x5e62,0x101));var _0x25e6=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x5e62[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x25e6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x25e6('0x1'));var moment=require(_0x25e6('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x25e6('0x3'));var util=require(_0x25e6('0x4'));var path=require(_0x25e6('0x5'));var sox=require(_0x25e6('0x6'));var csv=require(_0x25e6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x25e6('0x8'));var _=require(_0x25e6('0x9'));var squel=require(_0x25e6('0xa'));var crypto=require(_0x25e6('0xb'));var jsforce=require(_0x25e6('0xc'));var deskjs=require(_0x25e6('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x25e6('0xe'));var Redis=require(_0x25e6('0xf'));var authService=require(_0x25e6('0x10'));var qs=require(_0x25e6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25e6('0x12'));var logger=require('../../config/logger')(_0x25e6('0x13'));var utils=require(_0x25e6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x25e6('0x15'));var db=require(_0x25e6('0x16'))['db'];function respondWithStatusCode(_0x21474d,_0x1546a6){_0x1546a6=_0x1546a6||0xcc;return function(_0x4d684b){if(_0x4d684b){return _0x21474d[_0x25e6('0x17')](_0x1546a6);}return _0x21474d['status'](_0x1546a6)[_0x25e6('0x18')]();};}function respondWithResult(_0x469f21,_0x4edd79){_0x4edd79=_0x4edd79||0xc8;return function(_0x13f757){if(_0x13f757){return _0x469f21[_0x25e6('0x19')](_0x4edd79)[_0x25e6('0x1a')](_0x13f757);}};}function respondWithFilteredResult(_0x1512f3,_0x25094e){return function(_0x8b5bc9){if(_0x8b5bc9){var _0x77eada=typeof _0x25094e['offset']===_0x25e6('0x1b')&&typeof _0x25094e[_0x25e6('0x1c')]==='undefined';var _0xdcc3c6=_0x8b5bc9['count'];var _0x3a0199=_0x77eada?0x0:_0x25094e[_0x25e6('0x1d')];var _0x2c912f=_0x77eada?_0x8b5bc9[_0x25e6('0x1e')]:_0x25094e['offset']+_0x25094e['limit'];var _0x119902;if(_0x2c912f>=_0xdcc3c6){_0x2c912f=_0xdcc3c6;_0x119902=0xc8;}else{_0x119902=0xce;}_0x1512f3[_0x25e6('0x19')](_0x119902);return _0x1512f3[_0x25e6('0x1f')]('Content-Range',_0x3a0199+'-'+_0x2c912f+'/'+_0xdcc3c6)[_0x25e6('0x1a')](_0x8b5bc9);}return null;};}function patchUpdates(_0x4bfe90){return function(_0x52a7ad){try{jsonpatch[_0x25e6('0x20')](_0x52a7ad,_0x4bfe90,!![]);}catch(_0x988b97){return BPromise[_0x25e6('0x21')](_0x988b97);}return _0x52a7ad[_0x25e6('0x22')]();};}function saveUpdates(_0x4f0178,_0x34e913){return function(_0x5eb25f){if(_0x5eb25f){return _0x5eb25f['update'](_0x4f0178)['then'](function(_0x51942e){return _0x51942e;});}return null;};}function removeEntity(_0x46abc2,_0x417476){return function(_0x2b4b51){if(_0x2b4b51){return _0x2b4b51['destroy']()[_0x25e6('0x23')](function(){var _0x2101aa=_0x2b4b51['get']({'plain':!![]});var _0x582a24=_0x25e6('0x24');return db[_0x25e6('0x25')][_0x25e6('0x26')]({'where':{'type':_0x582a24,'resourceId':_0x2101aa['id']}})[_0x25e6('0x23')](function(){return _0x2b4b51;});})[_0x25e6('0x23')](function(){_0x46abc2[_0x25e6('0x19')](0xcc)[_0x25e6('0x18')]();});}};}function handleEntityNotFound(_0x1c06ef,_0x32eced){return function(_0x529cd7){if(!_0x529cd7){_0x1c06ef[_0x25e6('0x17')](0x194);}return _0x529cd7;};}function handleError(_0x135c0a,_0x465481){_0x465481=_0x465481||0x1f4;return function(_0x102460){logger[_0x25e6('0x27')](_0x102460[_0x25e6('0x28')]);if(_0x102460[_0x25e6('0x29')]){delete _0x102460[_0x25e6('0x29')];}_0x135c0a['status'](_0x465481)[_0x25e6('0x2a')](_0x102460);};}exports[_0x25e6('0x2b')]=function(_0x126c2d,_0x3f74cd){var _0x12e0e7={},_0x307b74={},_0xa01727={'count':0x0,'rows':[]};var _0x111699=_[_0x25e6('0x2c')](db[_0x25e6('0x2d')][_0x25e6('0x2e')],function(_0x1df3e1){return{'name':_0x1df3e1[_0x25e6('0x2f')],'type':_0x1df3e1[_0x25e6('0x30')][_0x25e6('0x31')]};});_0x307b74[_0x25e6('0x32')]=_[_0x25e6('0x2c')](_0x111699,_0x25e6('0x29'));_0x307b74[_0x25e6('0x33')]=_['keys'](_0x126c2d['query']);_0x307b74[_0x25e6('0x34')]=_[_0x25e6('0x35')](_0x307b74[_0x25e6('0x32')],_0x307b74['query']);_0x12e0e7[_0x25e6('0x36')]=_[_0x25e6('0x35')](_0x307b74[_0x25e6('0x32')],qs[_0x25e6('0x37')](_0x126c2d[_0x25e6('0x33')]['fields']));_0x12e0e7['attributes']=_0x12e0e7[_0x25e6('0x36')]['length']?_0x12e0e7['attributes']:_0x307b74[_0x25e6('0x32')];if(!_0x126c2d[_0x25e6('0x33')]['hasOwnProperty']('nolimit')){_0x12e0e7['limit']=qs['limit'](_0x126c2d[_0x25e6('0x33')][_0x25e6('0x1c')]);_0x12e0e7[_0x25e6('0x1d')]=qs['offset'](_0x126c2d[_0x25e6('0x33')][_0x25e6('0x1d')]);}_0x12e0e7[_0x25e6('0x38')]=qs[_0x25e6('0x39')](_0x126c2d[_0x25e6('0x33')]['sort']);delete _0x126c2d[_0x25e6('0x33')][_0x25e6('0x39')];_0x12e0e7[_0x25e6('0x3a')]=qs['filters'](_[_0x25e6('0x3b')](_0x126c2d['query'],_0x307b74[_0x25e6('0x34')]),_0x111699);if(_0x126c2d[_0x25e6('0x33')][_0x25e6('0x3c')]){_0x12e0e7[_0x25e6('0x3a')]=_[_0x25e6('0x3d')](_0x12e0e7[_0x25e6('0x3a')],{'$or':_['map'](_0x111699,function(_0x3c4ab8){if(_0x3c4ab8['type']!==_0x25e6('0x3e')){var _0x28f814={};_0x28f814[_0x3c4ab8['name']]={'$like':'%'+_0x126c2d['query'][_0x25e6('0x3c')]+'%'};return _0x28f814;}})});}_0x12e0e7=_[_0x25e6('0x3d')]({},_0x12e0e7,_0x126c2d[_0x25e6('0x3f')]);var _0x57e93c={'where':_0x12e0e7['where']};return db[_0x25e6('0x2d')][_0x25e6('0x1e')](_0x57e93c)['then'](function(_0x3182b0){_0xa01727[_0x25e6('0x1e')]=_0x3182b0;if(_0x126c2d[_0x25e6('0x33')][_0x25e6('0x40')]){_0x12e0e7[_0x25e6('0x41')]=[{'all':!![]}];}return db[_0x25e6('0x2d')]['findAll'](_0x12e0e7);})['then'](function(_0x15062b){_0xa01727[_0x25e6('0x42')]=_0x15062b;return _0xa01727;})[_0x25e6('0x23')](respondWithFilteredResult(_0x3f74cd,_0x12e0e7))[_0x25e6('0x43')](handleError(_0x3f74cd,null));};exports['show']=function(_0x9f5ed5,_0x5b5f06){var _0x173a08={'raw':![],'where':{'id':_0x9f5ed5[_0x25e6('0x44')]['id']}},_0x57eb8a={};_0x57eb8a[_0x25e6('0x32')]=_[_0x25e6('0x45')](db[_0x25e6('0x2d')][_0x25e6('0x2e')]);_0x57eb8a[_0x25e6('0x33')]=_[_0x25e6('0x45')](_0x9f5ed5[_0x25e6('0x33')]);_0x57eb8a[_0x25e6('0x34')]=_[_0x25e6('0x35')](_0x57eb8a['model'],_0x57eb8a[_0x25e6('0x33')]);_0x173a08[_0x25e6('0x36')]=_[_0x25e6('0x35')](_0x57eb8a[_0x25e6('0x32')],qs[_0x25e6('0x37')](_0x9f5ed5[_0x25e6('0x33')][_0x25e6('0x37')]));_0x173a08['attributes']=_0x173a08[_0x25e6('0x36')][_0x25e6('0x46')]?_0x173a08[_0x25e6('0x36')]:_0x57eb8a[_0x25e6('0x32')];if(_0x9f5ed5[_0x25e6('0x33')][_0x25e6('0x40')]){_0x173a08['include']=[{'all':!![]}];}_0x173a08=_[_0x25e6('0x3d')]({},_0x173a08,_0x9f5ed5['options']);return db[_0x25e6('0x2d')][_0x25e6('0x47')](_0x173a08)[_0x25e6('0x23')](handleEntityNotFound(_0x5b5f06,null))['then'](respondWithResult(_0x5b5f06,null))[_0x25e6('0x43')](handleError(_0x5b5f06,null));};exports[_0x25e6('0x48')]=function(_0x50f3be,_0x7f0447){if(_0x50f3be['body']['id']){delete _0x50f3be[_0x25e6('0x49')]['id'];}return db['VoiceMusicOnHold'][_0x25e6('0x47')]({'where':{'id':_0x50f3be[_0x25e6('0x44')]['id']}})[_0x25e6('0x23')](handleEntityNotFound(_0x7f0447,null))[_0x25e6('0x23')](saveUpdates(_0x50f3be[_0x25e6('0x49')],null))[_0x25e6('0x23')](respondWithResult(_0x7f0447,null))['catch'](handleError(_0x7f0447,null));};exports[_0x25e6('0x4a')]=function(_0x29bf63,_0x35e49a,_0x3276d5){return db['sequelize'][_0x25e6('0x4b')](function(_0x1ae461){if(_0x29bf63[_0x25e6('0x49')][_0x25e6('0x4c')]===_0x25e6('0x4d')){_0x29bf63[_0x25e6('0x49')]['directory']=path['join'](config[_0x25e6('0x4e')],'server/files/moh',_0x29bf63[_0x25e6('0x49')][_0x25e6('0x29')]);}return db[_0x25e6('0x2d')]['create'](_0x29bf63[_0x25e6('0x49')],{'transaction':_0x1ae461})[_0x25e6('0x23')](function(_0x39975a){if(_0x29bf63[_0x25e6('0x49')][_0x25e6('0x4c')]===_0x25e6('0x4d')){fs[_0x25e6('0x4f')](_0x39975a['directory'],parseInt('0777',0x8));}var _0xc70cea=_0x29bf63['user'][_0x25e6('0x50')]({'plain':!![]});if(!_0xc70cea)throw new Error(_0x25e6('0x51'));if(_0xc70cea[_0x25e6('0x52')]==='user'){var _0x3d7628=_0x39975a[_0x25e6('0x50')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x25e6('0x24'),'userProfileId':_0xc70cea['userProfileId']},'raw':!![]})[_0x25e6('0x23')](function(_0x3bdf10){if(_0x3bdf10&&_0x3bdf10['autoAssociation']===0x0){return db[_0x25e6('0x25')][_0x25e6('0x4a')]({'name':_0x3d7628['name'],'resourceId':_0x3d7628['id'],'type':_0x3bdf10[_0x25e6('0x29')],'sectionId':_0x3bdf10['id']},{})[_0x25e6('0x23')](function(){return _0x39975a;});}else{return _0x39975a;}})[_0x25e6('0x43')](function(_0x3c1f30){logger[_0x25e6('0x27')](_0x25e6('0x53'),_0x3c1f30);});}return _0x39975a;});})['then'](respondWithResult(_0x35e49a,0xc9))[_0x25e6('0x43')](handleError(_0x35e49a,null));};exports[_0x25e6('0x26')]=function(_0x45f6be,_0x1d2930,_0x92d43f){var _0xc3eeed;return db[_0x25e6('0x2d')][_0x25e6('0x47')]({'where':{'id':_0x45f6be['params']['id']}})[_0x25e6('0x23')](function(_0x11253a){if(_0x11253a){return db['sequelize'][_0x25e6('0x4b')](function(_0x5bf275){return _0x11253a[_0x25e6('0x26')]({'transaction':_0x5bf275,'raw':!![]})[_0x25e6('0x23')](function(_0x4febcb){if(_0x4febcb[_0x25e6('0x54')]){fs[_0x25e6('0x55')](_0x4febcb['directory'])['forEach'](function(_0x504545){fs[_0x25e6('0x56')](path[_0x25e6('0x57')](_0x4febcb[_0x25e6('0x54')],_0x504545));});fs['rmdirSync'](_0x4febcb['directory']);}return _0x4febcb;});})[_0x25e6('0x43')](function(_0x19f757){throw new db['Sequelize'][(_0x25e6('0x58'))](_0x19f757[_0x25e6('0x59')]);});}})['then'](handleEntityNotFound(_0x1d2930,null))[_0x25e6('0x23')](removeEntity(_0x1d2930,null))[_0x25e6('0x43')](handleError(_0x1d2930,null));};exports[_0x25e6('0x5a')]=function(_0x2edd83,_0x4ff9a1,_0x3b8f9f){return db[_0x25e6('0x5b')][_0x25e6('0x4b')](function(_0x5d3646){var _0x5ed836;return db[_0x25e6('0x2d')][_0x25e6('0x47')]({'where':{'id':_0x2edd83[_0x25e6('0x44')]['id']}})[_0x25e6('0x23')](function(_0x376dd9){if(_0x376dd9){_0x5ed836=_0x376dd9;return _0x376dd9[_0x25e6('0x5a')](_0x2edd83['body']['id'],{'transaction':_0x5d3646});}})[_0x25e6('0x23')](function(_0x4ffee0){if(_0x4ffee0){return db[_0x25e6('0x5c')][_0x25e6('0x5d')]({'where':{'id':_0x2edd83[_0x25e6('0x49')]['id']},'attributes':['id',_0x25e6('0x29'),_0x25e6('0x5e'),'converted_format',_0x25e6('0x5f')],'raw':!![]});}})['then'](function(_0x4ffec6){if(_0x4ffec6){var _0x76267f=path[_0x25e6('0x57')](config[_0x25e6('0x4e')],_0x25e6('0x60'),util[_0x25e6('0x61')]('%s.%s',path['basename'](_0x4ffec6[_0x25e6('0x5e')],path['extname'](_0x4ffec6[_0x25e6('0x5e')])),_0x4ffec6['converted_format']));var _0x557d0c=path[_0x25e6('0x57')](config[_0x25e6('0x4e')],_0x25e6('0x62'),_0x5ed836[_0x25e6('0x29')],util[_0x25e6('0x61')](_0x25e6('0x63'),_0x4ffec6[_0x25e6('0x29')],_0x4ffec6[_0x25e6('0x64')]));fs[_0x25e6('0x65')](_0x76267f,_0x557d0c);return _0x4ffec6;}})['catch'](function(_0x5470ab){throw new db[(_0x25e6('0x66'))]['ValidationError'](_0x5470ab[_0x25e6('0x59')]);});})[_0x25e6('0x23')](handleEntityNotFound(_0x4ff9a1,null))[_0x25e6('0x23')](respondWithResult(_0x4ff9a1,0xc9))['catch'](handleError(_0x4ff9a1,null));};exports[_0x25e6('0x67')]=function(_0x48caf8,_0x1caa03,_0x33b002){return db[_0x25e6('0x5b')][_0x25e6('0x4b')](function(_0x37e1ba){var _0x111893;return db[_0x25e6('0x2d')][_0x25e6('0x5d')]({'where':{'id':_0x48caf8[_0x25e6('0x44')]['id']}})['then'](handleEntityNotFound(_0x1caa03,null))[_0x25e6('0x23')](function(_0x5b416d){if(_0x5b416d){_0x111893=_0x5b416d;return _0x5b416d[_0x25e6('0x67')](_0x48caf8[_0x25e6('0x44')][_0x25e6('0x68')]);}})[_0x25e6('0x23')](function(_0x266de8){if(_0x266de8){return db['Sound'][_0x25e6('0x5d')]({'where':{'id':_0x48caf8[_0x25e6('0x44')][_0x25e6('0x68')]},'attributes':['id',_0x25e6('0x29'),_0x25e6('0x5e'),_0x25e6('0x64'),_0x25e6('0x5f')],'raw':!![]});}})[_0x25e6('0x23')](function(_0x1314e4){if(_0x1314e4){fs[_0x25e6('0x56')](path['join'](_0x111893[_0x25e6('0x54')],util[_0x25e6('0x61')](_0x25e6('0x63'),_0x1314e4[_0x25e6('0x29')],_0x1314e4[_0x25e6('0x64')])));return _0x1314e4;}})[_0x25e6('0x43')](function(_0x455f9a){throw new db[(_0x25e6('0x66'))][(_0x25e6('0x58'))](_0x455f9a['message']);});})[_0x25e6('0x23')](handleEntityNotFound(_0x1caa03,null))[_0x25e6('0x23')](respondWithStatusCode(_0x1caa03,0xcc))[_0x25e6('0x43')](handleError(_0x1caa03,null));};exports['getSounds']=function(_0x462f5d,_0x304256,_0x290962){var _0x1e9073={};var _0x2e3801={};var _0x44b7de;var _0x23677c;return db[_0x25e6('0x2d')][_0x25e6('0x5d')]({'where':{'id':_0x462f5d['params']['id']}})[_0x25e6('0x23')](handleEntityNotFound(_0x304256,null))['then'](function(_0x14d304){if(_0x14d304){_0x44b7de=_0x14d304;_0x2e3801[_0x25e6('0x32')]=_['keys'](db[_0x25e6('0x5c')][_0x25e6('0x2e')]);_0x2e3801[_0x25e6('0x33')]=_['keys'](_0x462f5d[_0x25e6('0x33')]);_0x2e3801[_0x25e6('0x34')]=_['intersection'](_0x2e3801[_0x25e6('0x32')],_0x2e3801['query']);_0x1e9073[_0x25e6('0x36')]=_[_0x25e6('0x35')](_0x2e3801[_0x25e6('0x32')],qs[_0x25e6('0x37')](_0x462f5d[_0x25e6('0x33')][_0x25e6('0x37')]));_0x1e9073[_0x25e6('0x36')]=_0x1e9073[_0x25e6('0x36')][_0x25e6('0x46')]?_0x1e9073[_0x25e6('0x36')]:_0x2e3801[_0x25e6('0x32')];_0x1e9073[_0x25e6('0x38')]=qs[_0x25e6('0x39')](_0x462f5d[_0x25e6('0x33')][_0x25e6('0x39')]);_0x1e9073[_0x25e6('0x3a')]=qs[_0x25e6('0x34')](_[_0x25e6('0x3b')](_0x462f5d[_0x25e6('0x33')],_0x2e3801[_0x25e6('0x34')]));if(_0x462f5d[_0x25e6('0x33')][_0x25e6('0x3c')]){_0x1e9073[_0x25e6('0x3a')]=_['merge'](_0x1e9073[_0x25e6('0x3a')],{'$or':_['map'](_0x1e9073[_0x25e6('0x36')],function(_0x17384f){var _0x248c45={};_0x248c45[_0x17384f]={'$like':'%'+_0x462f5d[_0x25e6('0x33')]['filter']+'%'};return _0x248c45;})});}_0x1e9073=_[_0x25e6('0x3d')]({},_0x1e9073,_0x462f5d[_0x25e6('0x3f')]);return _0x44b7de[_0x25e6('0x69')](_0x1e9073);}})[_0x25e6('0x23')](function(_0x32b3b5){if(_0x32b3b5){_0x23677c=_0x32b3b5['length'];if(!_0x462f5d[_0x25e6('0x33')][_0x25e6('0x6a')](_0x25e6('0x6b'))){_0x1e9073[_0x25e6('0x1c')]=qs['limit'](_0x462f5d['query'][_0x25e6('0x1c')]);_0x1e9073[_0x25e6('0x1d')]=qs['offset'](_0x462f5d[_0x25e6('0x33')][_0x25e6('0x1d')]);}return _0x44b7de[_0x25e6('0x69')](_0x1e9073);}})[_0x25e6('0x23')](function(_0x43361b){if(_0x43361b){return _0x43361b?{'count':_0x23677c,'rows':_0x43361b}:null;}})[_0x25e6('0x23')](respondWithResult(_0x304256,null))[_0x25e6('0x43')](handleError(_0x304256,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index be4206a..c82b2f9 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 _0x1c8d=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','VoiceMusicOnHold','voice_musiconhold','util','../../config/logger'];(function(_0x14d97b,_0x3a212f){var _0x3e3a2d=function(_0x4089d5){while(--_0x4089d5){_0x14d97b['push'](_0x14d97b['shift']());}};_0x3e3a2d(++_0x3a212f);}(_0x1c8d,0x196));var _0xd1c8=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1c8d[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xd1c8('0x0'));var logger=require(_0xd1c8('0x1'))(_0xd1c8('0x2'));var moment=require(_0xd1c8('0x3'));var BPromise=require(_0xd1c8('0x4'));var rp=require(_0xd1c8('0x5'));var fs=require('fs');var path=require(_0xd1c8('0x6'));var rimraf=require('rimraf');var config=require(_0xd1c8('0x7'));var attributes=require('./voiceMusicOnHold.attributes');module[_0xd1c8('0x8')]=function(_0x51eccf,_0x20ddd2){return _0x51eccf[_0xd1c8('0x9')](_0xd1c8('0xa'),attributes,{'tableName':_0xd1c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc97c=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','voice_musiconhold'];(function(_0x149bf0,_0x50654c){var _0x5c3302=function(_0x3a270f){while(--_0x3a270f){_0x149bf0['push'](_0x149bf0['shift']());}};_0x5c3302(++_0x50654c);}(_0xc97c,0x96));var _0xcc97=function(_0x1fdf9e,_0x3da833){_0x1fdf9e=_0x1fdf9e-0x0;var _0x5140ab=_0xc97c[_0x1fdf9e];return _0x5140ab;};'use strict';var _=require('lodash');var util=require(_0xcc97('0x0'));var logger=require(_0xcc97('0x1'))(_0xcc97('0x2'));var moment=require('moment');var BPromise=require(_0xcc97('0x3'));var rp=require(_0xcc97('0x4'));var fs=require('fs');var path=require(_0xcc97('0x5'));var rimraf=require(_0xcc97('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0xcc97('0x7')]=function(_0x1da645,_0x4f9bf3){return _0x1da645[_0xcc97('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0xcc97('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index f969c90..e874eb4 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x5d76c8,_0x432c5e){var _0xe18213=function(_0x49e888){while(--_0x49e888){_0x5d76c8['push'](_0x5d76c8['shift']());}};_0xe18213(++_0x432c5e);}(_0xedd9,0xfc));var _0x9edd=function(_0x25da9d,_0x357693){_0x25da9d=_0x25da9d-0x0;var _0x1307be=_0xedd9[_0x25da9d];return _0x1307be;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +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(_0x3f66dd,_0x4f5cb5){var _0x459b7a=function(_0x544442){while(--_0x544442){_0x3f66dd['push'](_0x3f66dd['shift']());}};_0x459b7a(++_0x4f5cb5);}(_0xe706,0xa3));var _0x6e70=function(_0x3a3afe,_0x15da25){_0x3a3afe=_0x3a3afe-0x0;var _0x262dab=_0xe706[_0x3a3afe];return _0x262dab;};'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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index b34b21c..db21b87 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 _0x6a75=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','/:id','show','addAgents','put','update','delete','destroy','/:id/users','multer','util','path','connect-timeout'];(function(_0x2698b6,_0x1f3854){var _0x25bf6b=function(_0x4cbf52){while(--_0x4cbf52){_0x2698b6['push'](_0x2698b6['shift']());}};_0x25bf6b(++_0x1f3854);}(_0x6a75,0x110));var _0x56a7=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x6a75[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0x56a7('0x0'));var util=require(_0x56a7('0x1'));var path=require(_0x56a7('0x2'));var timeout=require(_0x56a7('0x3'));var express=require(_0x56a7('0x4'));var router=express[_0x56a7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x56a7('0x6'));var interaction=require(_0x56a7('0x7'));var config=require(_0x56a7('0x8'));var controller=require(_0x56a7('0x9'));router[_0x56a7('0xa')]('/',auth['isAuthenticated'](),controller[_0x56a7('0xb')]);router[_0x56a7('0xa')](_0x56a7('0xc'),auth[_0x56a7('0xd')](),controller[_0x56a7('0xe')]);router[_0x56a7('0xa')](_0x56a7('0xf'),auth['isAuthenticated'](),controller[_0x56a7('0x10')]);router[_0x56a7('0xa')]('/:id/users',auth[_0x56a7('0xd')](),controller['getAgents']);router['post']('/',auth[_0x56a7('0xd')](),controller['create']);router['post']('/:id/users',auth[_0x56a7('0xd')](),controller[_0x56a7('0x11')]);router[_0x56a7('0x12')]('/:id',auth[_0x56a7('0xd')](),controller[_0x56a7('0x13')]);router[_0x56a7('0x14')](_0x56a7('0xf'),auth[_0x56a7('0xd')](),controller[_0x56a7('0x15')]);router[_0x56a7('0x14')](_0x56a7('0x16'),auth[_0x56a7('0xd')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x67cb=['isAuthenticated','index','get','/describe','describe','/:id/users','addAgents','put','/:id','delete','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2c3e3a,_0x1777ba){var _0x1b77a1=function(_0x183762){while(--_0x183762){_0x2c3e3a['push'](_0x2c3e3a['shift']());}};_0x1b77a1(++_0x1777ba);}(_0x67cb,0x84));var _0xb67c=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0x67cb[_0x4b4f24];return _0x1c13d4;};'use strict';var multer=require(_0xb67c('0x0'));var util=require(_0xb67c('0x1'));var path=require(_0xb67c('0x2'));var timeout=require(_0xb67c('0x3'));var express=require(_0xb67c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb67c('0x5'));var interaction=require(_0xb67c('0x6'));var config=require(_0xb67c('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0xb67c('0x8')](),controller[_0xb67c('0x9')]);router[_0xb67c('0xa')](_0xb67c('0xb'),auth['isAuthenticated'](),controller[_0xb67c('0xc')]);router[_0xb67c('0xa')]('/:id',auth[_0xb67c('0x8')](),controller['show']);router[_0xb67c('0xa')](_0xb67c('0xd'),auth[_0xb67c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xb67c('0x8')](),controller['create']);router['post'](_0xb67c('0xd'),auth[_0xb67c('0x8')](),controller[_0xb67c('0xe')]);router[_0xb67c('0xf')](_0xb67c('0x10'),auth[_0xb67c('0x8')](),controller['update']);router[_0xb67c('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);router['delete'](_0xb67c('0xd'),auth[_0xb67c('0x8')](),controller[_0xb67c('0x12')]);module[_0xb67c('0x13')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index fd58419..10a3aee 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 _0xd4a3=['exports','STRING','name','VIRTUAL','system-','INTEGER','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4a3,0x110));var _0x3d4a=function(_0x1cf0a4,_0x1c6fdb){_0x1cf0a4=_0x1cf0a4-0x0;var _0x586cac=_0xd4a3[_0x1cf0a4];return _0x586cac;};'use strict';var Sequelize=require(_0x3d4a('0x0'));module[_0x3d4a('0x1')]={'name':{'type':Sequelize[_0x3d4a('0x2')],'allowNull':![],'unique':_0x3d4a('0x3')},'prefix':{'type':Sequelize[_0x3d4a('0x4')],'get':function(_0x4a998f){return _0x3d4a('0x5')+this['getDataValue'](_0x3d4a('0x3'))+'-';}},'description':{'type':Sequelize[_0x3d4a('0x2')]},'callerIdAll':{'type':Sequelize[_0x3d4a('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x3d4a('0x6')]}}; \ No newline at end of file +var _0x0a59=['system-','getDataValue','STRING','INTEGER','sequelize','exports','name','VIRTUAL'];(function(_0x2edfae,_0x723cc0){var _0x37d6b9=function(_0x4519ea){while(--_0x4519ea){_0x2edfae['push'](_0x2edfae['shift']());}};_0x37d6b9(++_0x723cc0);}(_0x0a59,0x6c));var _0x90a5=function(_0x55e2d7,_0x327be8){_0x55e2d7=_0x55e2d7-0x0;var _0xdacfd4=_0x0a59[_0x55e2d7];return _0xdacfd4;};'use strict';var Sequelize=require(_0x90a5('0x0'));module[_0x90a5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x90a5('0x2')},'prefix':{'type':Sequelize[_0x90a5('0x3')],'get':function(_0x21afd0){return _0x90a5('0x4')+this[_0x90a5('0x5')](_0x90a5('0x2'))+'-';}},'description':{'type':Sequelize[_0x90a5('0x6')]},'callerIdAll':{'type':Sequelize[_0x90a5('0x6')]},'VoiceExtensionId':{'type':Sequelize[_0x90a5('0x7')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index f58b11f..232ed8c 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 _0xa7b5=['stack','name','send','map','VoicePrefix','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','describe','create','sequelize','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','type','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','CDR(prefix)=','callerIdAll','push','Set','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','body','system-','VoiceExtensionId','findById','addAgents','omit','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','pick','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','error'];(function(_0x441b81,_0xadd916){var _0x5dfc35=function(_0x5d47b5){while(--_0x5d47b5){_0x441b81['push'](_0x441b81['shift']());}};_0x5dfc35(++_0xadd916);}(_0xa7b5,0x15a));var _0x5a7b=function(_0x449468,_0x54a04e){_0x449468=_0x449468-0x0;var _0x4f70a1=_0xa7b5[_0x449468];return _0x4f70a1;};'use strict';var emlformat=require(_0x5a7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a7b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5a7b('0x2'));var moment=require(_0x5a7b('0x3'));var BPromise=require(_0x5a7b('0x4'));var Mustache=require(_0x5a7b('0x5'));var util=require(_0x5a7b('0x6'));var path=require(_0x5a7b('0x7'));var sox=require(_0x5a7b('0x8'));var csv=require(_0x5a7b('0x9'));var ejs=require(_0x5a7b('0xa'));var fs=require('fs');var fs_extra=require(_0x5a7b('0xb'));var _=require(_0x5a7b('0xc'));var squel=require(_0x5a7b('0xd'));var crypto=require(_0x5a7b('0xe'));var jsforce=require(_0x5a7b('0xf'));var deskjs=require(_0x5a7b('0x10'));var toCsv=require(_0x5a7b('0x9'));var querystring=require(_0x5a7b('0x11'));var Papa=require(_0x5a7b('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5a7b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a7b('0x14'));var logger=require(_0x5a7b('0x15'))(_0x5a7b('0x16'));var utils=require(_0x5a7b('0x17'));var config=require(_0x5a7b('0x18'));var licenseUtil=require(_0x5a7b('0x19'));var db=require(_0x5a7b('0x1a'))['db'];config[_0x5a7b('0x1b')]=_[_0x5a7b('0x1c')](config[_0x5a7b('0x1b')],{'host':_0x5a7b('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5a7b('0x1b')]));require(_0x5a7b('0x1e'))[_0x5a7b('0x1f')](socket);function respondWithStatusCode(_0x292a44,_0x540026){_0x540026=_0x540026||0xcc;return function(_0x1c6760){if(_0x1c6760){return _0x292a44[_0x5a7b('0x20')](_0x540026);}return _0x292a44['status'](_0x540026)[_0x5a7b('0x21')]();};}function respondWithResult(_0x4d2e57,_0x3d3239){_0x3d3239=_0x3d3239||0xc8;return function(_0x4b85e0){if(_0x4b85e0){return _0x4d2e57[_0x5a7b('0x22')](_0x3d3239)[_0x5a7b('0x23')](_0x4b85e0);}};}function respondWithFilteredResult(_0x2fc1fa,_0x5a3a89){return function(_0x33b996){if(_0x33b996){var _0x490d82=typeof _0x5a3a89[_0x5a7b('0x24')]===_0x5a7b('0x25')&&typeof _0x5a3a89[_0x5a7b('0x26')]===_0x5a7b('0x25');var _0x550b9a=_0x33b996[_0x5a7b('0x27')];var _0x15d8fb=_0x490d82?0x0:_0x5a3a89[_0x5a7b('0x24')];var _0x4dd310=_0x490d82?_0x33b996[_0x5a7b('0x27')]:_0x5a3a89[_0x5a7b('0x24')]+_0x5a3a89['limit'];var _0x49a892;if(_0x4dd310>=_0x550b9a){_0x4dd310=_0x550b9a;_0x49a892=0xc8;}else{_0x49a892=0xce;}_0x2fc1fa[_0x5a7b('0x22')](_0x49a892);return _0x2fc1fa[_0x5a7b('0x28')](_0x5a7b('0x29'),_0x15d8fb+'-'+_0x4dd310+'/'+_0x550b9a)[_0x5a7b('0x23')](_0x33b996);}return null;};}function patchUpdates(_0x285369){return function(_0x5d1063){try{jsonpatch['apply'](_0x5d1063,_0x285369,!![]);}catch(_0x1ad9cc){return BPromise[_0x5a7b('0x2a')](_0x1ad9cc);}return _0x5d1063[_0x5a7b('0x2b')]();};}function saveUpdates(_0x2a0550,_0x4b1c7f){return function(_0x4f4a3d){if(_0x4f4a3d){return _0x4f4a3d['update'](_0x2a0550)[_0x5a7b('0x2c')](function(_0x3fbff6){return _0x3fbff6;});}return null;};}function removeEntity(_0x11223d,_0x3e572a){return function(_0x26b4f3){if(_0x26b4f3){return _0x26b4f3['destroy']()[_0x5a7b('0x2c')](function(){var _0x55724d=_0x26b4f3[_0x5a7b('0x2d')]({'plain':!![]});var _0x547e82=_0x5a7b('0x2e');return db[_0x5a7b('0x2f')][_0x5a7b('0x30')]({'where':{'type':_0x547e82,'resourceId':_0x55724d['id']}})['then'](function(){return _0x26b4f3;});})[_0x5a7b('0x2c')](function(){_0x11223d[_0x5a7b('0x22')](0xcc)[_0x5a7b('0x21')]();});}};}function handleEntityNotFound(_0x54f1c6,_0x36b90e){return function(_0x3172a8){if(!_0x3172a8){_0x54f1c6[_0x5a7b('0x20')](0x194);}return _0x3172a8;};}function handleError(_0x3cb473,_0x426aa6){_0x426aa6=_0x426aa6||0x1f4;return function(_0x55a0ec){logger[_0x5a7b('0x31')](_0x55a0ec[_0x5a7b('0x32')]);if(_0x55a0ec[_0x5a7b('0x33')]){delete _0x55a0ec[_0x5a7b('0x33')];}_0x3cb473[_0x5a7b('0x22')](_0x426aa6)[_0x5a7b('0x34')](_0x55a0ec);};}exports['index']=function(_0x34f7a8,_0x550eec){var _0x453f49={},_0x54ea9d={},_0xe7f83a={'count':0x0,'rows':[]};var _0x2d49c6=_[_0x5a7b('0x35')](db[_0x5a7b('0x36')][_0x5a7b('0x37')],function(_0x2a09a2){return{'name':_0x2a09a2[_0x5a7b('0x38')],'type':_0x2a09a2['type'][_0x5a7b('0x39')]};});_0x54ea9d['model']=_[_0x5a7b('0x35')](_0x2d49c6,_0x5a7b('0x33'));_0x54ea9d[_0x5a7b('0x3a')]=_[_0x5a7b('0x3b')](_0x34f7a8['query']);_0x54ea9d[_0x5a7b('0x3c')]=_[_0x5a7b('0x3d')](_0x54ea9d[_0x5a7b('0x3e')],_0x54ea9d[_0x5a7b('0x3a')]);_0x453f49['attributes']=_[_0x5a7b('0x3d')](_0x54ea9d[_0x5a7b('0x3e')],qs[_0x5a7b('0x3f')](_0x34f7a8['query'][_0x5a7b('0x3f')]));_0x453f49[_0x5a7b('0x40')]=_0x453f49[_0x5a7b('0x40')][_0x5a7b('0x41')]?_0x453f49['attributes']:_0x54ea9d[_0x5a7b('0x3e')];if(!_0x34f7a8['query'][_0x5a7b('0x42')](_0x5a7b('0x43'))){_0x453f49[_0x5a7b('0x26')]=qs['limit'](_0x34f7a8[_0x5a7b('0x3a')][_0x5a7b('0x26')]);_0x453f49[_0x5a7b('0x24')]=qs[_0x5a7b('0x24')](_0x34f7a8[_0x5a7b('0x3a')][_0x5a7b('0x24')]);}_0x453f49[_0x5a7b('0x44')]=qs[_0x5a7b('0x45')](_0x34f7a8[_0x5a7b('0x3a')][_0x5a7b('0x45')]);_0x453f49['where']=qs['filters'](_['pick'](_0x34f7a8[_0x5a7b('0x3a')],_0x54ea9d['filters']),_0x2d49c6);if(_0x34f7a8[_0x5a7b('0x3a')]['filter']){_0x453f49[_0x5a7b('0x46')]=_[_0x5a7b('0x47')](_0x453f49[_0x5a7b('0x46')],{'$or':_[_0x5a7b('0x35')](_0x2d49c6,function(_0x142cc0){if(_0x142cc0['type']!==_0x5a7b('0x48')){var _0x3c51a6={};_0x3c51a6[_0x142cc0[_0x5a7b('0x33')]]={'$like':'%'+_0x34f7a8['query'][_0x5a7b('0x49')]+'%'};return _0x3c51a6;}})});}_0x453f49=_[_0x5a7b('0x47')]({},_0x453f49,_0x34f7a8[_0x5a7b('0x4a')]);var _0x476213={'where':_0x453f49[_0x5a7b('0x46')]};return db[_0x5a7b('0x36')]['count'](_0x476213)[_0x5a7b('0x2c')](function(_0x56aeca){_0xe7f83a[_0x5a7b('0x27')]=_0x56aeca;if(_0x34f7a8['query'][_0x5a7b('0x4b')]){_0x453f49['include']=[{'all':!![]}];}return db[_0x5a7b('0x36')][_0x5a7b('0x4c')](_0x453f49);})['then'](function(_0x5dcc35){_0xe7f83a[_0x5a7b('0x4d')]=_0x5dcc35;return _0xe7f83a;})['then'](respondWithFilteredResult(_0x550eec,_0x453f49))[_0x5a7b('0x4e')](handleError(_0x550eec,null));};exports['show']=function(_0x4cc88f,_0x479c6f){var _0x33ec3c={'raw':![],'where':{'id':_0x4cc88f[_0x5a7b('0x4f')]['id']}},_0x167a69={};_0x167a69['model']=_[_0x5a7b('0x3b')](db[_0x5a7b('0x36')]['rawAttributes']);_0x167a69[_0x5a7b('0x3a')]=_['keys'](_0x4cc88f[_0x5a7b('0x3a')]);_0x167a69['filters']=_['intersection'](_0x167a69[_0x5a7b('0x3e')],_0x167a69[_0x5a7b('0x3a')]);_0x33ec3c[_0x5a7b('0x40')]=_[_0x5a7b('0x3d')](_0x167a69[_0x5a7b('0x3e')],qs['fields'](_0x4cc88f[_0x5a7b('0x3a')][_0x5a7b('0x3f')]));_0x33ec3c[_0x5a7b('0x40')]=_0x33ec3c[_0x5a7b('0x40')]['length']?_0x33ec3c['attributes']:_0x167a69[_0x5a7b('0x3e')];if(_0x4cc88f['query'][_0x5a7b('0x4b')]){_0x33ec3c[_0x5a7b('0x50')]=[{'all':!![]}];}_0x33ec3c=_[_0x5a7b('0x47')]({},_0x33ec3c,_0x4cc88f[_0x5a7b('0x4a')]);return db['VoicePrefix'][_0x5a7b('0x51')](_0x33ec3c)['then'](handleEntityNotFound(_0x479c6f,null))['then'](respondWithResult(_0x479c6f,null))[_0x5a7b('0x4e')](handleError(_0x479c6f,null));};exports[_0x5a7b('0x30')]=function(_0x5eb7bf,_0x4f981e){return db['VoicePrefix'][_0x5a7b('0x51')]({'where':{'id':_0x5eb7bf[_0x5a7b('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4f981e,null))[_0x5a7b('0x2c')](removeEntity(_0x4f981e,null))[_0x5a7b('0x4e')](handleError(_0x4f981e,null));};exports['describe']=function(_0x28be64,_0x5a4557){return db[_0x5a7b('0x36')][_0x5a7b('0x52')]()[_0x5a7b('0x2c')](respondWithResult(_0x5a4557,null))[_0x5a7b('0x4e')](handleError(_0x5a4557,null));};exports[_0x5a7b('0x53')]=function(_0x4865fb,_0x3a9262){var _0x39538d;return db[_0x5a7b('0x54')]['transaction'](function(_0x2576dc){return db[_0x5a7b('0x36')][_0x5a7b('0x53')](_0x4865fb['body'],{'transaction':_0x2576dc})[_0x5a7b('0x2c')](function(_0x1775da){_0x39538d=_0x1775da['get']({'plain':!![]});return db[_0x5a7b('0x55')][_0x5a7b('0x51')]({'where':{'id':_0x39538d['VoiceExtensionId']},'raw':!![]})[_0x5a7b('0x2c')](function(_0x33690b){return createVoicePrefixExtensions(_0x39538d,_0x33690b,_0x2576dc);});});})['then'](function(){var _0x248a8a=_0x4865fb[_0x5a7b('0x56')][_0x5a7b('0x2d')]({'plain':!![]});if(!_0x248a8a)throw new Error(_0x5a7b('0x57'));if(_0x248a8a['role']===_0x5a7b('0x56')){var _0x4182df=_0x39538d;return db[_0x5a7b('0x58')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x248a8a[_0x5a7b('0x59')]},'raw':!![]})['then'](function(_0x3360f2){if(_0x3360f2&&_0x3360f2[_0x5a7b('0x5a')]===0x0){return db[_0x5a7b('0x2f')]['create']({'name':_0x4182df[_0x5a7b('0x33')],'resourceId':_0x4182df['id'],'type':_0x3360f2[_0x5a7b('0x33')],'sectionId':_0x3360f2['id']},{})[_0x5a7b('0x2c')](function(){return _0x39538d;});}else{return _0x39538d;}})[_0x5a7b('0x4e')](function(_0x459f9d){logger['error'](_0x5a7b('0x5b'),_0x459f9d);throw _0x459f9d;});}return _0x39538d;})[_0x5a7b('0x2c')](respondWithResult(_0x3a9262,null))['catch'](handleError(_0x3a9262,null));};function Extension(_0x205b64,_0x309e43,_0x20dd32,_0x3fa663){this['context']=_0x5a7b('0x5c');this[_0x5a7b('0x5d')]=_0x205b64;this[_0x5a7b('0x5e')]=_0x20dd32;this[_0x5a7b('0x5f')]=_0x5a7b('0x60');this[_0x5a7b('0x61')]=_0x5a7b('0x62');this[_0x5a7b('0x63')]=_0x309e43;this[_0x5a7b('0x64')]=_0x3fa663;}function createVoicePrefixExtensions(_0xa878fe,_0x25817e,_0x578f42){return new BPromise(function(_0x55795e,_0x5a1923){var _0x1e9d0a=new Extension(formatPrefixName(_0xa878fe[_0x5a7b('0x65')]),0x1,'NoOp',_0x5a7b('0x66'));_0x1e9d0a[_0x5a7b('0x67')]=_0xa878fe['id'];return db[_0x5a7b('0x55')][_0x5a7b('0x53')](_0x1e9d0a,{'transaction':_0x578f42})[_0x5a7b('0x2c')](function(_0x23ef20){var _0x15b8be=_0x23ef20[_0x5a7b('0x2d')]({'plain':!![]});var _0x38b48a=_[_0x5a7b('0x35')](addVoicePrefixExtensions(_0xa878fe,_0x25817e),function(_0x299dfc){_0x299dfc['VoiceExtensionId']=_0x15b8be['id'];_0x299dfc[_0x5a7b('0x67')]=_0xa878fe['id'];return _0x299dfc;});return db['VoiceExtension'][_0x5a7b('0x68')](_0x38b48a,{'transaction':_0x578f42})['then'](function(_0x118c4d){if(!_0x118c4d){return _0x5a1923(_0x5a7b('0x69'));}else{return _0x55795e(_0x118c4d);}})[_0x5a7b('0x4e')](function(_0x4437f0){return _0x5a1923(_0x4437f0);});});;});};function addVoicePrefixExtensions(_0x6369d2,_0x50c16a){var _0x3d95e2=[];var _0x28de29=formatPrefixName(_0x6369d2[_0x5a7b('0x65')]);_0x3d95e2['push'](new Extension(_0x28de29,0x2,'Set',_0x5a7b('0x6a')+_0x6369d2[_0x5a7b('0x33')]));if(_0x6369d2[_0x5a7b('0x6b')]){_0x3d95e2[_0x5a7b('0x6c')](new Extension(_0x28de29,0x3,_0x5a7b('0x6d'),'PREFIX-CALLERIDALL='+_0x6369d2[_0x5a7b('0x6b')]));}else{_0x3d95e2[_0x5a7b('0x6c')](new Extension(_0x28de29,0x3,_0x5a7b('0x6e'),_0x5a7b('0x6f')));}_0x3d95e2[_0x5a7b('0x6c')](new Extension(_0x28de29,0x4,_0x5a7b('0x70'),_0x50c16a['context']+','+_0x5a7b('0x71')+(0x8+_0x6369d2[_0x5a7b('0x33')][_0x5a7b('0x41')])+'}'+','+0x1));return _0x3d95e2;}function formatPrefixName(_0x2fd48e){var _0x598e46='_';for(var _0x56dffe=0x0;_0x56dffe<_0x2fd48e[_0x5a7b('0x41')];_0x56dffe++){if(_0x2fd48e[_0x5a7b('0x72')](_0x56dffe)=='-'){_0x598e46+=_0x2fd48e[_0x5a7b('0x72')](_0x56dffe);}else{_0x598e46+='['+_0x2fd48e[_0x5a7b('0x72')](_0x56dffe)+']';}}_0x598e46+='.';return _0x598e46;}exports[_0x5a7b('0x73')]=function(_0x235be6,_0x1fd33f,_0x161900){var _0x3ef293=_0x235be6[_0x5a7b('0x74')];_0x3ef293[_0x5a7b('0x65')]=_0x5a7b('0x75')+_0x3ef293['name']+'-';return db[_0x5a7b('0x54')]['transaction'](function(_0x4dfa46){return db[_0x5a7b('0x36')][_0x5a7b('0x73')](_0x3ef293,{'where':{'id':_0x3ef293['id']},'transaction':_0x4dfa46})[_0x5a7b('0x2c')](function(){return db[_0x5a7b('0x55')][_0x5a7b('0x30')]({'where':{'VoicePrefixId':_0x3ef293['id']},'transaction':_0x4dfa46})['then'](function(){return db[_0x5a7b('0x55')][_0x5a7b('0x51')]({'where':{'id':_0x3ef293[_0x5a7b('0x76')]},'raw':!![]})['then'](function(_0x21d157){return createVoicePrefixExtensions(_0x3ef293,_0x21d157,_0x4dfa46);});});});})[_0x5a7b('0x2c')](function(){return db[_0x5a7b('0x36')][_0x5a7b('0x77')](_0x3ef293['id']);})['then'](respondWithResult(_0x1fd33f,null))[_0x5a7b('0x4e')](handleError(_0x1fd33f,null));};exports[_0x5a7b('0x78')]=function(_0x20bd85,_0xa9bfa8,_0x4594e3){return db[_0x5a7b('0x36')][_0x5a7b('0x51')]({'where':{'id':_0x20bd85['params']['id']}})[_0x5a7b('0x2c')](handleEntityNotFound(_0xa9bfa8,null))['then'](function(_0x3bee74){if(_0x3bee74){return _0x3bee74[_0x5a7b('0x78')](_0x20bd85['body']['ids'],_[_0x5a7b('0x79')](_0x20bd85[_0x5a7b('0x74')],[_0x5a7b('0x7a'),'id'])||{})[_0x5a7b('0x7b')](function(_0x45ebe1){for(var _0x434b4a=0x0;_0x434b4a<_0x20bd85[_0x5a7b('0x74')][_0x5a7b('0x7a')]['length'];_0x434b4a+=0x1){socket[_0x5a7b('0x7c')](_0x5a7b('0x7d'),{'UserId':Number(_0x20bd85['body'][_0x5a7b('0x7a')][_0x434b4a]),'VoicePrefixId':Number(_0x20bd85[_0x5a7b('0x4f')]['id'])});}return _0x45ebe1;});}})[_0x5a7b('0x2c')](respondWithResult(_0xa9bfa8,null))[_0x5a7b('0x4e')](handleError(_0xa9bfa8,null));};exports[_0x5a7b('0x7e')]=function(_0x396c47,_0x2dc609,_0x43b284){return db[_0x5a7b('0x36')][_0x5a7b('0x51')]({'where':{'id':_0x396c47['params']['id']}})[_0x5a7b('0x2c')](handleEntityNotFound(_0x2dc609,null))[_0x5a7b('0x2c')](function(_0x3029e2){if(_0x3029e2){return _0x3029e2['removeAgents'](_0x396c47[_0x5a7b('0x3a')][_0x5a7b('0x7a')])[_0x5a7b('0x2c')](function(){if(_[_0x5a7b('0x7f')](_0x396c47[_0x5a7b('0x3a')]['ids'])){for(var _0x209f01=0x0;_0x209f01<_0x396c47['query'][_0x5a7b('0x7a')]['length'];_0x209f01+=0x1){socket[_0x5a7b('0x7c')](_0x5a7b('0x80'),{'UserId':Number(_0x396c47[_0x5a7b('0x3a')][_0x5a7b('0x7a')][_0x209f01]),'VoicePrefixId':Number(_0x396c47[_0x5a7b('0x4f')]['id'])});}}else{socket[_0x5a7b('0x7c')](_0x5a7b('0x80'),{'UserId':Number(_0x396c47[_0x5a7b('0x3a')][_0x5a7b('0x7a')]),'VoicePrefixId':Number(_0x396c47[_0x5a7b('0x4f')]['id'])});}});}})[_0x5a7b('0x2c')](respondWithStatusCode(_0x2dc609,null))[_0x5a7b('0x4e')](handleError(_0x2dc609,null));};exports['getAgents']=function(_0x3181bb,_0x36426f,_0x4bd312){var _0x3af2d1={};var _0x525e83={};var _0x1916c7;var _0x2935d5;return db['VoicePrefix'][_0x5a7b('0x81')]({'where':{'id':_0x3181bb[_0x5a7b('0x4f')]['id']}})[_0x5a7b('0x2c')](handleEntityNotFound(_0x36426f,null))[_0x5a7b('0x2c')](function(_0xc131a1){if(_0xc131a1){_0x1916c7=_0xc131a1;_0x525e83[_0x5a7b('0x3e')]=_[_0x5a7b('0x3b')](db['User']['rawAttributes']);_0x525e83[_0x5a7b('0x3a')]=_[_0x5a7b('0x3b')](_0x3181bb[_0x5a7b('0x3a')]);_0x525e83[_0x5a7b('0x3c')]=_[_0x5a7b('0x3d')](_0x525e83[_0x5a7b('0x3e')],_0x525e83[_0x5a7b('0x3a')]);_0x3af2d1[_0x5a7b('0x40')]=_[_0x5a7b('0x3d')](_0x525e83[_0x5a7b('0x3e')],qs[_0x5a7b('0x3f')](_0x3181bb['query'][_0x5a7b('0x3f')]));_0x3af2d1[_0x5a7b('0x40')]=_0x3af2d1[_0x5a7b('0x40')][_0x5a7b('0x41')]?_0x3af2d1[_0x5a7b('0x40')]:_0x525e83[_0x5a7b('0x3e')];_0x3af2d1[_0x5a7b('0x44')]=qs[_0x5a7b('0x45')](_0x3181bb['query'][_0x5a7b('0x45')]);_0x3af2d1[_0x5a7b('0x46')]=qs['filters'](_[_0x5a7b('0x82')](_0x3181bb[_0x5a7b('0x3a')],_0x525e83[_0x5a7b('0x3c')]));if(_0x3181bb[_0x5a7b('0x3a')][_0x5a7b('0x49')]){_0x3af2d1[_0x5a7b('0x46')]=_[_0x5a7b('0x47')](_0x3af2d1[_0x5a7b('0x46')],{'$or':_[_0x5a7b('0x35')](_0x3af2d1[_0x5a7b('0x40')],function(_0x3aeafc){var _0x539547={};_0x539547[_0x3aeafc]={'$like':'%'+_0x3181bb['query']['filter']+'%'};return _0x539547;})});}_0x3af2d1=_[_0x5a7b('0x47')]({},_0x3af2d1,_0x3181bb[_0x5a7b('0x4a')]);return _0x1916c7['getAgents'](_0x3af2d1);}})[_0x5a7b('0x2c')](function(_0x35d4bb){if(_0x35d4bb){_0x2935d5=_0x35d4bb[_0x5a7b('0x41')];if(!_0x3181bb['query'][_0x5a7b('0x42')](_0x5a7b('0x43'))){_0x3af2d1['limit']=qs[_0x5a7b('0x26')](_0x3181bb[_0x5a7b('0x3a')][_0x5a7b('0x26')]);_0x3af2d1[_0x5a7b('0x24')]=qs[_0x5a7b('0x24')](_0x3181bb[_0x5a7b('0x3a')][_0x5a7b('0x24')]);}return _0x1916c7[_0x5a7b('0x83')](_0x3af2d1);}})[_0x5a7b('0x2c')](function(_0x20b288){if(_0x20b288){return _0x20b288?{'count':_0x2935d5,'rows':_0x20b288}:null;}})[_0x5a7b('0x2c')](respondWithResult(_0x36426f,null))[_0x5a7b('0x4e')](handleError(_0x36426f,null));}; \ No newline at end of file +var _0x6f24=['squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','VoicePrefixes','error','stack','name','send','index','map','VoicePrefix','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','length','find','describe','create','sequelize','transaction','body','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','sort','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra'];(function(_0x204228,_0x7e2c08){var _0x2d4343=function(_0x25c373){while(--_0x25c373){_0x204228['push'](_0x204228['shift']());}};_0x2d4343(++_0x7e2c08);}(_0x6f24,0x76));var _0x46f2=function(_0x45ce08,_0x59dcc7){_0x45ce08=_0x45ce08-0x0;var _0x23dff2=_0x6f24[_0x45ce08];return _0x23dff2;};'use strict';var emlformat=require(_0x46f2('0x0'));var rimraf=require(_0x46f2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46f2('0x2'));var rp=require(_0x46f2('0x3'));var moment=require(_0x46f2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x46f2('0x5'));var util=require('util');var path=require(_0x46f2('0x6'));var sox=require(_0x46f2('0x7'));var csv=require(_0x46f2('0x8'));var ejs=require(_0x46f2('0x9'));var fs=require('fs');var fs_extra=require(_0x46f2('0xa'));var _=require('lodash');var squel=require(_0x46f2('0xb'));var crypto=require(_0x46f2('0xc'));var jsforce=require(_0x46f2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x46f2('0x8'));var querystring=require(_0x46f2('0xe'));var Papa=require(_0x46f2('0xf'));var Redis=require(_0x46f2('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x46f2('0x11'));var hardwareService=require(_0x46f2('0x12'));var logger=require(_0x46f2('0x13'))(_0x46f2('0x14'));var utils=require('../../config/utils');var config=require(_0x46f2('0x15'));var licenseUtil=require(_0x46f2('0x16'));var db=require(_0x46f2('0x17'))['db'];config[_0x46f2('0x18')]=_['defaults'](config[_0x46f2('0x18')],{'host':_0x46f2('0x19'),'port':0x18eb});var socket=require(_0x46f2('0x1a'))(new Redis(config[_0x46f2('0x18')]));require(_0x46f2('0x1b'))[_0x46f2('0x1c')](socket);function respondWithStatusCode(_0x43544d,_0x3134bd){_0x3134bd=_0x3134bd||0xcc;return function(_0x44acf7){if(_0x44acf7){return _0x43544d[_0x46f2('0x1d')](_0x3134bd);}return _0x43544d[_0x46f2('0x1e')](_0x3134bd)[_0x46f2('0x1f')]();};}function respondWithResult(_0x11ae0e,_0x5c885d){_0x5c885d=_0x5c885d||0xc8;return function(_0x29a312){if(_0x29a312){return _0x11ae0e[_0x46f2('0x1e')](_0x5c885d)[_0x46f2('0x20')](_0x29a312);}};}function respondWithFilteredResult(_0x3361ea,_0x29d51a){return function(_0x2f3f17){if(_0x2f3f17){var _0x32ea6c=typeof _0x29d51a['offset']===_0x46f2('0x21')&&typeof _0x29d51a['limit']===_0x46f2('0x21');var _0x9587e2=_0x2f3f17['count'];var _0x5970a1=_0x32ea6c?0x0:_0x29d51a[_0x46f2('0x22')];var _0x1fac0d=_0x32ea6c?_0x2f3f17[_0x46f2('0x23')]:_0x29d51a[_0x46f2('0x22')]+_0x29d51a[_0x46f2('0x24')];var _0x2c2f24;if(_0x1fac0d>=_0x9587e2){_0x1fac0d=_0x9587e2;_0x2c2f24=0xc8;}else{_0x2c2f24=0xce;}_0x3361ea['status'](_0x2c2f24);return _0x3361ea[_0x46f2('0x25')]('Content-Range',_0x5970a1+'-'+_0x1fac0d+'/'+_0x9587e2)[_0x46f2('0x20')](_0x2f3f17);}return null;};}function patchUpdates(_0x593c6f){return function(_0x2317e7){try{jsonpatch[_0x46f2('0x26')](_0x2317e7,_0x593c6f,!![]);}catch(_0x2790f6){return BPromise[_0x46f2('0x27')](_0x2790f6);}return _0x2317e7[_0x46f2('0x28')]();};}function saveUpdates(_0x8f9939,_0x4d2d7c){return function(_0x3a2667){if(_0x3a2667){return _0x3a2667[_0x46f2('0x29')](_0x8f9939)[_0x46f2('0x2a')](function(_0x111e29){return _0x111e29;});}return null;};}function removeEntity(_0x519d27,_0x3017c9){return function(_0x35335c){if(_0x35335c){return _0x35335c[_0x46f2('0x2b')]()['then'](function(){var _0x3f8cfc=_0x35335c['get']({'plain':!![]});var _0x5807d9=_0x46f2('0x2c');return db['UserProfileResource'][_0x46f2('0x2b')]({'where':{'type':_0x5807d9,'resourceId':_0x3f8cfc['id']}})[_0x46f2('0x2a')](function(){return _0x35335c;});})['then'](function(){_0x519d27['status'](0xcc)[_0x46f2('0x1f')]();});}};}function handleEntityNotFound(_0x1d6f31,_0xcf2258){return function(_0x4b42c2){if(!_0x4b42c2){_0x1d6f31[_0x46f2('0x1d')](0x194);}return _0x4b42c2;};}function handleError(_0x5b542b,_0x2e2910){_0x2e2910=_0x2e2910||0x1f4;return function(_0x58a95b){logger[_0x46f2('0x2d')](_0x58a95b[_0x46f2('0x2e')]);if(_0x58a95b[_0x46f2('0x2f')]){delete _0x58a95b[_0x46f2('0x2f')];}_0x5b542b[_0x46f2('0x1e')](_0x2e2910)[_0x46f2('0x30')](_0x58a95b);};}exports[_0x46f2('0x31')]=function(_0x14fcc7,_0xf1b6ec){var _0x5ef16f={},_0x4ad380={},_0x1971a5={'count':0x0,'rows':[]};var _0x434ba2=_[_0x46f2('0x32')](db[_0x46f2('0x33')]['rawAttributes'],function(_0x441977){return{'name':_0x441977[_0x46f2('0x34')],'type':_0x441977[_0x46f2('0x35')]['key']};});_0x4ad380[_0x46f2('0x36')]=_[_0x46f2('0x32')](_0x434ba2,'name');_0x4ad380[_0x46f2('0x37')]=_[_0x46f2('0x38')](_0x14fcc7[_0x46f2('0x37')]);_0x4ad380[_0x46f2('0x39')]=_['intersection'](_0x4ad380[_0x46f2('0x36')],_0x4ad380[_0x46f2('0x37')]);_0x5ef16f[_0x46f2('0x3a')]=_[_0x46f2('0x3b')](_0x4ad380[_0x46f2('0x36')],qs[_0x46f2('0x3c')](_0x14fcc7['query']['fields']));_0x5ef16f[_0x46f2('0x3a')]=_0x5ef16f['attributes']['length']?_0x5ef16f[_0x46f2('0x3a')]:_0x4ad380[_0x46f2('0x36')];if(!_0x14fcc7['query'][_0x46f2('0x3d')](_0x46f2('0x3e'))){_0x5ef16f['limit']=qs[_0x46f2('0x24')](_0x14fcc7['query'][_0x46f2('0x24')]);_0x5ef16f[_0x46f2('0x22')]=qs[_0x46f2('0x22')](_0x14fcc7[_0x46f2('0x37')][_0x46f2('0x22')]);}_0x5ef16f[_0x46f2('0x3f')]=qs['sort'](_0x14fcc7['query']['sort']);_0x5ef16f[_0x46f2('0x40')]=qs[_0x46f2('0x39')](_[_0x46f2('0x41')](_0x14fcc7[_0x46f2('0x37')],_0x4ad380['filters']),_0x434ba2);if(_0x14fcc7[_0x46f2('0x37')][_0x46f2('0x42')]){_0x5ef16f[_0x46f2('0x40')]=_[_0x46f2('0x43')](_0x5ef16f['where'],{'$or':_['map'](_0x434ba2,function(_0x2b160f){if(_0x2b160f[_0x46f2('0x35')]!==_0x46f2('0x44')){var _0x1589ed={};_0x1589ed[_0x2b160f[_0x46f2('0x2f')]]={'$like':'%'+_0x14fcc7[_0x46f2('0x37')][_0x46f2('0x42')]+'%'};return _0x1589ed;}})});}_0x5ef16f=_[_0x46f2('0x43')]({},_0x5ef16f,_0x14fcc7[_0x46f2('0x45')]);var _0x2b0768={'where':_0x5ef16f[_0x46f2('0x40')]};return db[_0x46f2('0x33')][_0x46f2('0x23')](_0x2b0768)['then'](function(_0x2340fc){_0x1971a5[_0x46f2('0x23')]=_0x2340fc;if(_0x14fcc7[_0x46f2('0x37')]['includeAll']){_0x5ef16f[_0x46f2('0x46')]=[{'all':!![]}];}return db[_0x46f2('0x33')][_0x46f2('0x47')](_0x5ef16f);})[_0x46f2('0x2a')](function(_0x3705ac){_0x1971a5['rows']=_0x3705ac;return _0x1971a5;})['then'](respondWithFilteredResult(_0xf1b6ec,_0x5ef16f))[_0x46f2('0x48')](handleError(_0xf1b6ec,null));};exports[_0x46f2('0x49')]=function(_0x643669,_0x45ec17){var _0x2bc3b8={'raw':![],'where':{'id':_0x643669[_0x46f2('0x4a')]['id']}},_0x1d90f1={};_0x1d90f1[_0x46f2('0x36')]=_[_0x46f2('0x38')](db[_0x46f2('0x33')][_0x46f2('0x4b')]);_0x1d90f1[_0x46f2('0x37')]=_[_0x46f2('0x38')](_0x643669[_0x46f2('0x37')]);_0x1d90f1[_0x46f2('0x39')]=_['intersection'](_0x1d90f1[_0x46f2('0x36')],_0x1d90f1[_0x46f2('0x37')]);_0x2bc3b8[_0x46f2('0x3a')]=_[_0x46f2('0x3b')](_0x1d90f1['model'],qs[_0x46f2('0x3c')](_0x643669['query'][_0x46f2('0x3c')]));_0x2bc3b8[_0x46f2('0x3a')]=_0x2bc3b8[_0x46f2('0x3a')][_0x46f2('0x4c')]?_0x2bc3b8[_0x46f2('0x3a')]:_0x1d90f1[_0x46f2('0x36')];if(_0x643669[_0x46f2('0x37')]['includeAll']){_0x2bc3b8[_0x46f2('0x46')]=[{'all':!![]}];}_0x2bc3b8=_['merge']({},_0x2bc3b8,_0x643669[_0x46f2('0x45')]);return db[_0x46f2('0x33')][_0x46f2('0x4d')](_0x2bc3b8)[_0x46f2('0x2a')](handleEntityNotFound(_0x45ec17,null))['then'](respondWithResult(_0x45ec17,null))['catch'](handleError(_0x45ec17,null));};exports[_0x46f2('0x2b')]=function(_0x5cbe41,_0x515e31){return db[_0x46f2('0x33')][_0x46f2('0x4d')]({'where':{'id':_0x5cbe41[_0x46f2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x515e31,null))[_0x46f2('0x2a')](removeEntity(_0x515e31,null))[_0x46f2('0x48')](handleError(_0x515e31,null));};exports[_0x46f2('0x4e')]=function(_0x14839d,_0x237283){return db[_0x46f2('0x33')][_0x46f2('0x4e')]()[_0x46f2('0x2a')](respondWithResult(_0x237283,null))[_0x46f2('0x48')](handleError(_0x237283,null));};exports[_0x46f2('0x4f')]=function(_0x386f95,_0x1008ea){var _0x5d7542;return db[_0x46f2('0x50')][_0x46f2('0x51')](function(_0x4a813d){return db['VoicePrefix'][_0x46f2('0x4f')](_0x386f95[_0x46f2('0x52')],{'transaction':_0x4a813d})['then'](function(_0xfa6475){_0x5d7542=_0xfa6475[_0x46f2('0x53')]({'plain':!![]});return db[_0x46f2('0x54')][_0x46f2('0x4d')]({'where':{'id':_0x5d7542[_0x46f2('0x55')]},'raw':!![]})['then'](function(_0x46e052){return createVoicePrefixExtensions(_0x5d7542,_0x46e052,_0x4a813d);});});})[_0x46f2('0x2a')](function(){var _0x42141b=_0x386f95[_0x46f2('0x56')][_0x46f2('0x53')]({'plain':!![]});if(!_0x42141b)throw new Error(_0x46f2('0x57'));if(_0x42141b['role']==='user'){var _0x3c8fe7=_0x5d7542;return db[_0x46f2('0x58')]['find']({'where':{'name':_0x46f2('0x2c'),'userProfileId':_0x42141b['userProfileId']},'raw':!![]})[_0x46f2('0x2a')](function(_0x2549de){if(_0x2549de&&_0x2549de[_0x46f2('0x59')]===0x0){return db[_0x46f2('0x5a')][_0x46f2('0x4f')]({'name':_0x3c8fe7[_0x46f2('0x2f')],'resourceId':_0x3c8fe7['id'],'type':_0x2549de['name'],'sectionId':_0x2549de['id']},{})[_0x46f2('0x2a')](function(){return _0x5d7542;});}else{return _0x5d7542;}})['catch'](function(_0x28fb8d){logger[_0x46f2('0x2d')](_0x46f2('0x5b'),_0x28fb8d);throw _0x28fb8d;});}return _0x5d7542;})[_0x46f2('0x2a')](respondWithResult(_0x1008ea,null))[_0x46f2('0x48')](handleError(_0x1008ea,null));};function Extension(_0x46c2b4,_0x46aa80,_0x47f405,_0x57e367){this[_0x46f2('0x5c')]=_0x46f2('0x5d');this['exten']=_0x46c2b4;this[_0x46f2('0x5e')]=_0x47f405;this[_0x46f2('0x35')]=_0x46f2('0x5f');this[_0x46f2('0x60')]=_0x46f2('0x61');this[_0x46f2('0x62')]=_0x46aa80;this[_0x46f2('0x63')]=_0x57e367;}function createVoicePrefixExtensions(_0x55c105,_0x59d752,_0x1f8f56){return new BPromise(function(_0x190b7d,_0x520ab7){var _0x307e06=new Extension(formatPrefixName(_0x55c105['prefix']),0x1,_0x46f2('0x64'),_0x46f2('0x65'));_0x307e06['VoicePrefixId']=_0x55c105['id'];return db[_0x46f2('0x54')][_0x46f2('0x4f')](_0x307e06,{'transaction':_0x1f8f56})[_0x46f2('0x2a')](function(_0x27a3b2){var _0x3562fb=_0x27a3b2[_0x46f2('0x53')]({'plain':!![]});var _0xbb9e5b=_['map'](addVoicePrefixExtensions(_0x55c105,_0x59d752),function(_0x179b71){_0x179b71[_0x46f2('0x55')]=_0x3562fb['id'];_0x179b71[_0x46f2('0x66')]=_0x55c105['id'];return _0x179b71;});return db[_0x46f2('0x54')][_0x46f2('0x67')](_0xbb9e5b,{'transaction':_0x1f8f56})[_0x46f2('0x2a')](function(_0x9ab912){if(!_0x9ab912){return _0x520ab7(_0x46f2('0x68'));}else{return _0x190b7d(_0x9ab912);}})['catch'](function(_0x5d52ab){return _0x520ab7(_0x5d52ab);});});;});};function addVoicePrefixExtensions(_0x3ab15b,_0x3a2129){var _0x577188=[];var _0x11e10b=formatPrefixName(_0x3ab15b[_0x46f2('0x69')]);_0x577188['push'](new Extension(_0x11e10b,0x2,_0x46f2('0x6a'),_0x46f2('0x6b')+_0x3ab15b['name']));if(_0x3ab15b[_0x46f2('0x6c')]){_0x577188[_0x46f2('0x6d')](new Extension(_0x11e10b,0x3,_0x46f2('0x6a'),_0x46f2('0x6e')+_0x3ab15b[_0x46f2('0x6c')]));}else{_0x577188[_0x46f2('0x6d')](new Extension(_0x11e10b,0x3,_0x46f2('0x64'),_0x46f2('0x6f')));}_0x577188[_0x46f2('0x6d')](new Extension(_0x11e10b,0x4,_0x46f2('0x70'),_0x3a2129['context']+','+_0x46f2('0x71')+(0x8+_0x3ab15b[_0x46f2('0x2f')][_0x46f2('0x4c')])+'}'+','+0x1));return _0x577188;}function formatPrefixName(_0x4dd52f){var _0x478cfe='_';for(var _0x340185=0x0;_0x340185<_0x4dd52f['length'];_0x340185++){if(_0x4dd52f[_0x46f2('0x72')](_0x340185)=='-'){_0x478cfe+=_0x4dd52f['charAt'](_0x340185);}else{_0x478cfe+='['+_0x4dd52f[_0x46f2('0x72')](_0x340185)+']';}}_0x478cfe+='.';return _0x478cfe;}exports[_0x46f2('0x29')]=function(_0x94d2bb,_0x52bda1,_0xa1a6f5){var _0x3dcad4=_0x94d2bb[_0x46f2('0x52')];_0x3dcad4['prefix']=_0x46f2('0x73')+_0x3dcad4[_0x46f2('0x2f')]+'-';return db[_0x46f2('0x50')][_0x46f2('0x51')](function(_0x158e69){return db[_0x46f2('0x33')][_0x46f2('0x29')](_0x3dcad4,{'where':{'id':_0x3dcad4['id']},'transaction':_0x158e69})[_0x46f2('0x2a')](function(){return db[_0x46f2('0x54')][_0x46f2('0x2b')]({'where':{'VoicePrefixId':_0x3dcad4['id']},'transaction':_0x158e69})['then'](function(){return db[_0x46f2('0x54')]['find']({'where':{'id':_0x3dcad4[_0x46f2('0x55')]},'raw':!![]})[_0x46f2('0x2a')](function(_0x3640d5){return createVoicePrefixExtensions(_0x3dcad4,_0x3640d5,_0x158e69);});});});})['then'](function(){return db['VoicePrefix'][_0x46f2('0x74')](_0x3dcad4['id']);})['then'](respondWithResult(_0x52bda1,null))['catch'](handleError(_0x52bda1,null));};exports[_0x46f2('0x75')]=function(_0x1a26bd,_0x51c389,_0xb14ca6){return db[_0x46f2('0x33')]['find']({'where':{'id':_0x1a26bd[_0x46f2('0x4a')]['id']}})[_0x46f2('0x2a')](handleEntityNotFound(_0x51c389,null))[_0x46f2('0x2a')](function(_0x476da5){if(_0x476da5){return _0x476da5['addAgents'](_0x1a26bd[_0x46f2('0x52')][_0x46f2('0x76')],_[_0x46f2('0x77')](_0x1a26bd['body'],[_0x46f2('0x76'),'id'])||{})[_0x46f2('0x78')](function(_0x2a7d45){for(var _0x479da9=0x0;_0x479da9<_0x1a26bd[_0x46f2('0x52')][_0x46f2('0x76')][_0x46f2('0x4c')];_0x479da9+=0x1){socket[_0x46f2('0x79')](_0x46f2('0x7a'),{'UserId':Number(_0x1a26bd[_0x46f2('0x52')][_0x46f2('0x76')][_0x479da9]),'VoicePrefixId':Number(_0x1a26bd[_0x46f2('0x4a')]['id'])});}return _0x2a7d45;});}})[_0x46f2('0x2a')](respondWithResult(_0x51c389,null))[_0x46f2('0x48')](handleError(_0x51c389,null));};exports[_0x46f2('0x7b')]=function(_0x3071ce,_0x4ee954,_0x25f2e9){return db[_0x46f2('0x33')][_0x46f2('0x4d')]({'where':{'id':_0x3071ce['params']['id']}})[_0x46f2('0x2a')](handleEntityNotFound(_0x4ee954,null))[_0x46f2('0x2a')](function(_0x1757bc){if(_0x1757bc){return _0x1757bc[_0x46f2('0x7b')](_0x3071ce[_0x46f2('0x37')][_0x46f2('0x76')])['then'](function(){if(_[_0x46f2('0x7c')](_0x3071ce[_0x46f2('0x37')]['ids'])){for(var _0x1accf0=0x0;_0x1accf0<_0x3071ce[_0x46f2('0x37')][_0x46f2('0x76')][_0x46f2('0x4c')];_0x1accf0+=0x1){socket['emit'](_0x46f2('0x7d'),{'UserId':Number(_0x3071ce[_0x46f2('0x37')][_0x46f2('0x76')][_0x1accf0]),'VoicePrefixId':Number(_0x3071ce['params']['id'])});}}else{socket[_0x46f2('0x79')](_0x46f2('0x7d'),{'UserId':Number(_0x3071ce[_0x46f2('0x37')][_0x46f2('0x76')]),'VoicePrefixId':Number(_0x3071ce[_0x46f2('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x4ee954,null))['catch'](handleError(_0x4ee954,null));};exports[_0x46f2('0x7e')]=function(_0x541f5e,_0x290df3,_0x28d30f){var _0x4114de={};var _0x564869={};var _0x575618;var _0x4f453f;return db['VoicePrefix']['findOne']({'where':{'id':_0x541f5e[_0x46f2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x290df3,null))['then'](function(_0x3c2ca4){if(_0x3c2ca4){_0x575618=_0x3c2ca4;_0x564869['model']=_[_0x46f2('0x38')](db[_0x46f2('0x7f')][_0x46f2('0x4b')]);_0x564869[_0x46f2('0x37')]=_['keys'](_0x541f5e[_0x46f2('0x37')]);_0x564869[_0x46f2('0x39')]=_['intersection'](_0x564869['model'],_0x564869[_0x46f2('0x37')]);_0x4114de[_0x46f2('0x3a')]=_[_0x46f2('0x3b')](_0x564869[_0x46f2('0x36')],qs[_0x46f2('0x3c')](_0x541f5e[_0x46f2('0x37')]['fields']));_0x4114de['attributes']=_0x4114de[_0x46f2('0x3a')]['length']?_0x4114de[_0x46f2('0x3a')]:_0x564869[_0x46f2('0x36')];_0x4114de[_0x46f2('0x3f')]=qs[_0x46f2('0x80')](_0x541f5e[_0x46f2('0x37')][_0x46f2('0x80')]);_0x4114de['where']=qs[_0x46f2('0x39')](_[_0x46f2('0x41')](_0x541f5e[_0x46f2('0x37')],_0x564869[_0x46f2('0x39')]));if(_0x541f5e[_0x46f2('0x37')]['filter']){_0x4114de[_0x46f2('0x40')]=_['merge'](_0x4114de[_0x46f2('0x40')],{'$or':_[_0x46f2('0x32')](_0x4114de['attributes'],function(_0x2f17dd){var _0x3463ae={};_0x3463ae[_0x2f17dd]={'$like':'%'+_0x541f5e[_0x46f2('0x37')][_0x46f2('0x42')]+'%'};return _0x3463ae;})});}_0x4114de=_[_0x46f2('0x43')]({},_0x4114de,_0x541f5e['options']);return _0x575618[_0x46f2('0x7e')](_0x4114de);}})['then'](function(_0x1b5aba){if(_0x1b5aba){_0x4f453f=_0x1b5aba[_0x46f2('0x4c')];if(!_0x541f5e[_0x46f2('0x37')][_0x46f2('0x3d')](_0x46f2('0x3e'))){_0x4114de[_0x46f2('0x24')]=qs[_0x46f2('0x24')](_0x541f5e[_0x46f2('0x37')]['limit']);_0x4114de[_0x46f2('0x22')]=qs[_0x46f2('0x22')](_0x541f5e['query']['offset']);}return _0x575618[_0x46f2('0x7e')](_0x4114de);}})[_0x46f2('0x2a')](function(_0x1fc921){if(_0x1fc921){return _0x1fc921?{'count':_0x4f453f,'rows':_0x1fc921}:null;}})[_0x46f2('0x2a')](respondWithResult(_0x290df3,null))[_0x46f2('0x48')](handleError(_0x290df3,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index d26a96f..a61c630 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 _0x95d9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','save','remove'];(function(_0x557a32,_0x3a52bf){var _0x1b9d38=function(_0x1e705f){while(--_0x1e705f){_0x557a32['push'](_0x557a32['shift']());}};_0x1b9d38(++_0x3a52bf);}(_0x95d9,0x1ab));var _0x995d=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x95d9[_0x174ef5];return _0x1cc379;};'use strict';var EventEmitter=require(_0x995d('0x0'));var VoicePrefix=require(_0x995d('0x1'))['db'][_0x995d('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x995d('0x3'),'afterUpdate':'update','afterDestroy':_0x995d('0x4')};function emitEvent(_0x1c587a){return function(_0x40ba25,_0xf7b8f4,_0x3b8415){VoicePrefixEvents['emit'](_0x1c587a+':'+_0x40ba25['id'],_0x40ba25);VoicePrefixEvents[_0x995d('0x5')](_0x1c587a,_0x40ba25);_0x3b8415(null);};}for(var e in events){if(events[_0x995d('0x6')](e)){var event=events[e];VoicePrefix[_0x995d('0x7')](e,emitEvent(event));}}module[_0x995d('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x4256=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','emit'];(function(_0x4927dc,_0x54b3f6){var _0x45e1c3=function(_0x45f4f7){while(--_0x45f4f7){_0x4927dc['push'](_0x4927dc['shift']());}};_0x45e1c3(++_0x54b3f6);}(_0x4256,0x189));var _0x6425=function(_0x395bfe,_0x4db521){_0x395bfe=_0x395bfe-0x0;var _0x35c81c=_0x4256[_0x395bfe];return _0x35c81c;};'use strict';var EventEmitter=require(_0x6425('0x0'));var VoicePrefix=require(_0x6425('0x1'))['db'][_0x6425('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x6425('0x3')](0x0);var events={'afterCreate':_0x6425('0x4'),'afterUpdate':_0x6425('0x5'),'afterDestroy':'remove'};function emitEvent(_0x52ef49){return function(_0x30b0a0,_0x5c5afe,_0x3fa18b){VoicePrefixEvents[_0x6425('0x6')](_0x52ef49+':'+_0x30b0a0['id'],_0x30b0a0);VoicePrefixEvents['emit'](_0x52ef49,_0x30b0a0);_0x3fa18b(null);};}for(var e in events){if(events[_0x6425('0x7')](e)){var event=events[e];VoicePrefix[_0x6425('0x8')](e,emitEvent(event));}}module[_0x6425('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 90f437d..fad274e 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 _0x8848=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VoicePrefix','voice_prefixes','util','../../config/logger','api'];(function(_0x21782f,_0xb28b63){var _0x663994=function(_0x33d421){while(--_0x33d421){_0x21782f['push'](_0x21782f['shift']());}};_0x663994(++_0xb28b63);}(_0x8848,0x72));var _0x8884=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x8848[_0x368fb9];return _0x4892fb;};'use strict';var _=require('lodash');var util=require(_0x8884('0x0'));var logger=require(_0x8884('0x1'))(_0x8884('0x2'));var moment=require(_0x8884('0x3'));var BPromise=require(_0x8884('0x4'));var rp=require(_0x8884('0x5'));var fs=require('fs');var path=require(_0x8884('0x6'));var rimraf=require(_0x8884('0x7'));var config=require(_0x8884('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x8884('0x9')]=function(_0x472c46,_0x14b909){return _0x472c46[_0x8884('0xa')](_0x8884('0xb'),attributes,{'tableName':_0x8884('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18e0=['../../config/environment','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x26da06,_0x44caa0){var _0x30d5a0=function(_0x4f4cf0){while(--_0x4f4cf0){_0x26da06['push'](_0x26da06['shift']());}};_0x30d5a0(++_0x44caa0);}(_0x18e0,0x7a));var _0x018e=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x18e0[_0x45b034];return _0x509cb0;};'use strict';var _=require(_0x018e('0x0'));var util=require(_0x018e('0x1'));var logger=require(_0x018e('0x2'))(_0x018e('0x3'));var moment=require(_0x018e('0x4'));var BPromise=require(_0x018e('0x5'));var rp=require(_0x018e('0x6'));var fs=require('fs');var path=require(_0x018e('0x7'));var rimraf=require('rimraf');var config=require(_0x018e('0x8'));var attributes=require('./voicePrefix.attributes');module[_0x018e('0x9')]=function(_0xee80e5,_0x3e2544){return _0xee80e5[_0x018e('0xa')](_0x018e('0xb'),attributes,{'tableName':_0x018e('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 81cffc0..01a4eaa 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 _0x1267=['debug','stringify','error','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent'];(function(_0x33295f,_0x26ea8e){var _0x508129=function(_0x30a965){while(--_0x30a965){_0x33295f['push'](_0x33295f['shift']());}};_0x508129(++_0x26ea8e);}(_0x1267,0xb5));var _0x7126=function(_0x3655f3,_0x3aac0a){_0x3655f3=_0x3655f3-0x0;var _0x304626=_0x1267[_0x3655f3];return _0x304626;};'use strict';var _=require(_0x7126('0x0'));var util=require(_0x7126('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7126('0x2'));var fs=require('fs');var Redis=require(_0x7126('0x3'));var db=require(_0x7126('0x4'))['db'];var utils=require(_0x7126('0x5'));var logger=require(_0x7126('0x6'))(_0x7126('0x7'));var config=require(_0x7126('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7126('0x9')][_0x7126('0xa')]({'port':0x232a});config[_0x7126('0xb')]=_[_0x7126('0xc')](config['redis'],{'host':_0x7126('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7126('0xb')]));require('./voicePrefix.socket')[_0x7126('0xe')](socket);function respondWithRpcPromise(_0x20106f,_0xe8b480,_0x3c9cd8){return new BPromise(function(_0x8391bb,_0x4c6810){return client['request'](_0x20106f,_0x3c9cd8)[_0x7126('0xf')](function(_0x397339){logger[_0x7126('0x10')](_0x7126('0x11'),_0xe8b480,_0x7126('0x12'));logger[_0x7126('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0xe8b480,'request\x20sent',JSON[_0x7126('0x14')](_0x397339));if(_0x397339[_0x7126('0x15')]){if(_0x397339['error']['code']===0x1f4){logger[_0x7126('0x15')](_0x7126('0x11'),_0xe8b480,_0x397339['error'][_0x7126('0x16')]);return _0x4c6810(_0x397339['error'][_0x7126('0x16')]);}logger[_0x7126('0x15')]('VoicePrefix,\x20%s,\x20%s',_0xe8b480,_0x397339['error'][_0x7126('0x16')]);return _0x8391bb(_0x397339['error'][_0x7126('0x16')]);}else{logger[_0x7126('0x10')](_0x7126('0x11'),_0xe8b480,_0x7126('0x12'));_0x8391bb(_0x397339[_0x7126('0x17')][_0x7126('0x16')]);}})[_0x7126('0x18')](function(_0x4cf825){logger[_0x7126('0x15')](_0x7126('0x11'),_0xe8b480,_0x4cf825);_0x4c6810(_0x4cf825);});});} \ No newline at end of file +var _0x2542=['register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket'];(function(_0x4dae90,_0x310097){var _0x211ef6=function(_0x3c59ce){while(--_0x3c59ce){_0x4dae90['push'](_0x4dae90['shift']());}};_0x211ef6(++_0x310097);}(_0x2542,0x169));var _0x2254=function(_0x18d38c,_0xc5c2d3){_0x18d38c=_0x18d38c-0x0;var _0x474ba7=_0x2542[_0x18d38c];return _0x474ba7;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});config[_0x2254('0xb')]=_[_0x2254('0xc')](config[_0x2254('0xb')],{'host':_0x2254('0xd'),'port':0x18eb});var socket=require(_0x2254('0xe'))(new Redis(config[_0x2254('0xb')]));require(_0x2254('0xf'))[_0x2254('0x10')](socket);function respondWithRpcPromise(_0x1ae415,_0x38fb2b,_0x5b1ab9){return new BPromise(function(_0x336e14,_0x2655ea){return client[_0x2254('0x11')](_0x1ae415,_0x5b1ab9)[_0x2254('0x12')](function(_0x575d58){logger['info'](_0x2254('0x13'),_0x38fb2b,_0x2254('0x14'));logger[_0x2254('0x15')](_0x2254('0x16'),_0x38fb2b,_0x2254('0x14'),JSON[_0x2254('0x17')](_0x575d58));if(_0x575d58['error']){if(_0x575d58[_0x2254('0x18')][_0x2254('0x19')]===0x1f4){logger['error'](_0x2254('0x13'),_0x38fb2b,_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);return _0x2655ea(_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);}logger[_0x2254('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x38fb2b,_0x575d58[_0x2254('0x18')]['message']);return _0x336e14(_0x575d58[_0x2254('0x18')][_0x2254('0x1a')]);}else{logger[_0x2254('0x1b')](_0x2254('0x13'),_0x38fb2b,_0x2254('0x14'));_0x336e14(_0x575d58[_0x2254('0x1c')]['message']);}})['catch'](function(_0x5ec98d){logger[_0x2254('0x18')](_0x2254('0x13'),_0x38fb2b,_0x5ec98d);_0x2655ea(_0x5ec98d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 04c4573..61c1a68 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 _0x1c8a=['removeListener','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c8a,0x140));var _0xa1c8=function(_0x476a0b,_0x23de02){_0x476a0b=_0x476a0b-0x0;var _0x5bc7e3=_0x1c8a[_0x476a0b];return _0x5bc7e3;};'use strict';var VoicePrefixEvents=require(_0xa1c8('0x0'));var events=[_0xa1c8('0x1'),_0xa1c8('0x2'),_0xa1c8('0x3')];function createListener(_0x2eb128,_0x50af02){return function(_0x250aa9){_0x50af02['emit'](_0x2eb128,_0x250aa9);};}function removeListener(_0x122813,_0x1cdee0){return function(){VoicePrefixEvents[_0xa1c8('0x4')](_0x122813,_0x1cdee0);};}exports['register']=function(_0x331282){for(var _0x14b85c=0x0,_0x14d2f0=events['length'];_0x14b85c<_0x14d2f0;_0x14b85c++){var _0x32993e=events[_0x14b85c];var _0xf93962=createListener(_0xa1c8('0x5')+_0x32993e,_0x331282);VoicePrefixEvents['on'](_0x32993e,_0xf93962);}}; \ No newline at end of file +var _0x6f0d=['update','emit','removeListener','length','save','remove'];(function(_0x5e5658,_0x5ceb37){var _0x501ff8=function(_0x359ef1){while(--_0x359ef1){_0x5e5658['push'](_0x5e5658['shift']());}};_0x501ff8(++_0x5ceb37);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x521ecc,_0x24cb72){_0x521ecc=_0x521ecc-0x0;var _0x4309f5=_0x6f0d[_0x521ecc];return _0x4309f5;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xd6f0('0x0'),_0xd6f0('0x1'),_0xd6f0('0x2')];function createListener(_0x107a8c,_0x573473){return function(_0x275230){_0x573473[_0xd6f0('0x3')](_0x107a8c,_0x275230);};}function removeListener(_0x2f78fb,_0x25344b){return function(){VoicePrefixEvents[_0xd6f0('0x4')](_0x2f78fb,_0x25344b);};}exports['register']=function(_0x2d2ce6){for(var _0x4a8b0c=0x0,_0xe21ac4=events[_0xd6f0('0x5')];_0x4a8b0c<_0xe21ac4;_0x4a8b0c++){var _0x8b89a9=events[_0x4a8b0c];var _0x1a48a0=createListener('voicePrefix:'+_0x8b89a9,_0x2d2ce6);VoicePrefixEvents['on'](_0x8b89a9,_0x1a48a0);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 7c418ef..7958257 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 _0x8263=['addAgents','update','delete','removeBlackLists','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id','/:id/hoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/teams','getAgents','/:id/members','getMembers','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','/:id/clone','/:id/users'];(function(_0x472d2d,_0xdfc075){var _0x297d09=function(_0xbcf14b){while(--_0xbcf14b){_0x472d2d['push'](_0x472d2d['shift']());}};_0x297d09(++_0xdfc075);}(_0x8263,0xf2));var _0x3826=function(_0x308828,_0x6823a9){_0x308828=_0x308828-0x0;var _0x54ab7e=_0x8263[_0x308828];return _0x54ab7e;};'use strict';var multer=require(_0x3826('0x0'));var util=require(_0x3826('0x1'));var path=require(_0x3826('0x2'));var timeout=require(_0x3826('0x3'));var express=require(_0x3826('0x4'));var router=express['Router']();var fs_extra=require(_0x3826('0x5'));var auth=require(_0x3826('0x6'));var interaction=require(_0x3826('0x7'));var config=require('../../config/environment');var controller=require(_0x3826('0x8'));router[_0x3826('0x9')]('/',auth[_0x3826('0xa')](),controller[_0x3826('0xb')]);router[_0x3826('0x9')](_0x3826('0xc'),auth[_0x3826('0xa')](),controller['show']);router[_0x3826('0x9')](_0x3826('0xd'),auth[_0x3826('0xa')](),controller['getHoppers']);router['get'](_0x3826('0xe'),auth[_0x3826('0xa')](),controller[_0x3826('0xf')]);router[_0x3826('0x9')](_0x3826('0x10'),auth['isAuthenticated'](),controller['getHopperFinals']);router[_0x3826('0x9')](_0x3826('0x11'),auth[_0x3826('0xa')](),controller[_0x3826('0x12')]);router[_0x3826('0x9')](_0x3826('0x13'),auth[_0x3826('0xa')](),controller['getTeams']);router[_0x3826('0x9')]('/:id/users',auth[_0x3826('0xa')](),controller[_0x3826('0x14')]);router[_0x3826('0x9')](_0x3826('0x15'),auth[_0x3826('0xa')](),controller[_0x3826('0x16')]);router['get'](_0x3826('0x17'),auth[_0x3826('0xa')](),controller[_0x3826('0x18')]);router[_0x3826('0x9')](_0x3826('0x19'),auth['isAuthenticated'](),controller[_0x3826('0x1a')]);router[_0x3826('0x1b')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3826('0x1b')](_0x3826('0x1c'),auth[_0x3826('0xa')](),controller['clone']);router[_0x3826('0x1b')](_0x3826('0x13'),auth[_0x3826('0xa')](),controller['addTeams']);router[_0x3826('0x1b')](_0x3826('0x1d'),auth[_0x3826('0xa')](),controller[_0x3826('0x1e')]);router[_0x3826('0x1b')]('/:id/lists',auth[_0x3826('0xa')](),controller['addLists']);router[_0x3826('0x1b')](_0x3826('0x19'),auth['isAuthenticated'](),controller['addBlackLists']);router['put']('/:id',auth[_0x3826('0xa')](),controller[_0x3826('0x1f')]);router[_0x3826('0x20')](_0x3826('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x3826('0x20')](_0x3826('0x13'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x3826('0x20')](_0x3826('0x1d'),auth[_0x3826('0xa')](),controller['removeAgents']);router['delete'](_0x3826('0x17'),auth[_0x3826('0xa')](),controller['removeLists']);router[_0x3826('0x20')](_0x3826('0x19'),auth[_0x3826('0xa')](),controller[_0x3826('0x21')]);module['exports']=router; \ No newline at end of file +var _0x371c=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','addAgents','addLists','addBlackLists','put','update','delete','removeLists','exports'];(function(_0x4147e6,_0x57174e){var _0x3305ba=function(_0x30199e){while(--_0x30199e){_0x4147e6['push'](_0x4147e6['shift']());}};_0x3305ba(++_0x57174e);}(_0x371c,0x69));var _0xc371=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x371c[_0x1d24eb];return _0x1dc576;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc371('0x0'));var timeout=require(_0xc371('0x1'));var express=require('express');var router=express[_0xc371('0x2')]();var fs_extra=require(_0xc371('0x3'));var auth=require(_0xc371('0x4'));var interaction=require(_0xc371('0x5'));var config=require('../../config/environment');var controller=require(_0xc371('0x6'));router[_0xc371('0x7')]('/',auth['isAuthenticated'](),controller[_0xc371('0x8')]);router['get'](_0xc371('0x9'),auth[_0xc371('0xa')](),controller[_0xc371('0xb')]);router[_0xc371('0x7')](_0xc371('0xc'),auth['isAuthenticated'](),controller[_0xc371('0xd')]);router[_0xc371('0x7')](_0xc371('0xe'),auth['isAuthenticated'](),controller[_0xc371('0xf')]);router[_0xc371('0x7')]('/:id/hopper_finals',auth[_0xc371('0xa')](),controller[_0xc371('0x10')]);router['get'](_0xc371('0x11'),auth[_0xc371('0xa')](),controller[_0xc371('0x12')]);router['get'](_0xc371('0x13'),auth['isAuthenticated'](),controller['getTeams']);router[_0xc371('0x7')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xc371('0x7')](_0xc371('0x14'),auth[_0xc371('0xa')](),controller[_0xc371('0x15')]);router['get'](_0xc371('0x16'),auth['isAuthenticated'](),controller['getLists']);router[_0xc371('0x7')](_0xc371('0x17'),auth[_0xc371('0xa')](),controller[_0xc371('0x18')]);router[_0xc371('0x19')]('/',auth[_0xc371('0xa')](),controller['create']);router[_0xc371('0x19')](_0xc371('0x1a'),auth[_0xc371('0xa')](),controller['clone']);router[_0xc371('0x19')](_0xc371('0x13'),auth[_0xc371('0xa')](),controller['addTeams']);router[_0xc371('0x19')]('/:id/users',auth[_0xc371('0xa')](),controller[_0xc371('0x1b')]);router[_0xc371('0x19')]('/:id/lists',auth[_0xc371('0xa')](),controller[_0xc371('0x1c')]);router[_0xc371('0x19')](_0xc371('0x17'),auth[_0xc371('0xa')](),controller[_0xc371('0x1d')]);router[_0xc371('0x1e')](_0xc371('0x9'),auth[_0xc371('0xa')](),controller[_0xc371('0x1f')]);router['delete'](_0xc371('0x9'),auth[_0xc371('0xa')](),controller['destroy']);router[_0xc371('0x20')]('/:id/teams',auth['isAuthenticated'](),controller['removeTeams']);router['delete']('/:id/users',auth[_0xc371('0xa')](),controller['removeAgents']);router[_0xc371('0x20')](_0xc371('0x16'),auth[_0xc371('0xa')](),controller[_0xc371('0x21')]);router[_0xc371('0x20')](_0xc371('0x17'),auth[_0xc371('0xa')](),controller['removeBlackLists']);module[_0xc371('0x22')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index beb3507..5430ab3 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 _0x3214=['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.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','ASC','DESC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','rrordered','setDataValue','strategy','type','dialMethod','getDataValue','booked','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','preview'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x3214,0xc9));var _0x4321=function(_0x31c480,_0x13f64a){_0x31c480=_0x31c480-0x0;var _0x3687ce=_0x3214[_0x31c480];return _0x3687ce;};'use strict';var Sequelize=require(_0x4321('0x0'));module[_0x4321('0x1')]={'name':{'type':Sequelize[_0x4321('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4321('0x3')](_0x4321('0x4'),_0x4321('0x5')),'allowNull':![],'defaultValue':_0x4321('0x4')},'musiconhold':{'type':Sequelize[_0x4321('0x2')],'defaultValue':_0x4321('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x4321('0x3')]('rr',_0x4321('0x7'),_0x4321('0x8'),_0x4321('0x9'),_0x4321('0xa'),_0x4321('0xb'),'linear','wrandom',_0x4321('0xc')),'allowNull':![],'defaultValue':_0x4321('0x7'),'set':function(_0x1e4a99){this[_0x4321('0xd')](_0x4321('0xe'),_0x1e4a99?_0x1e4a99:_0x4321('0xb'));},'get':function(){var _0x4ec086=this['getDataValue'](_0x4321('0xf'));var _0x1db73a=this['getDataValue'](_0x4321('0x10'));var _0xc24424=this[_0x4321('0x11')](_0x4321('0xe'));if(_0x4ec086===_0x4321('0x4')){return _0xc24424;}if(_0x1db73a===_0x4321('0x12')&&_0xc24424==='rrmemory'||_0x1db73a===_0x4321('0x12')&&_0xc24424==='roundrobin'){return _0xc24424;}if(_0x1db73a===_0x4321('0x13')||_0x1db73a===_0x4321('0x14')||_0x1db73a===_0x4321('0x15')){return _0xc24424;}return null;}},'servicelevel':{'type':Sequelize[_0x4321('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x4321('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x4321('0x16')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x4321('0x2')]},'weight':{'type':Sequelize[_0x4321('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x4321('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4321('0x3')](_0x4321('0x17'),'no'),'defaultValue':_0x4321('0x17')},'autopause':{'type':Sequelize[_0x4321('0x3')]('yes','no',_0x4321('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x4321('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x4321('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x4321('0x3')](_0x4321('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x4321('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x4321('0x3')](_0x4321('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x4321('0x3')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x4321('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x4321('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x4321('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x4321('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x4321('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x4321('0x3')](_0x4321('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x4321('0x17'),'no'),'defaultValue':_0x4321('0x17')},'announce_holdtime':{'type':Sequelize[_0x4321('0x3')](_0x4321('0x17'),'no',_0x4321('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x4321('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize[_0x4321('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x4321('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x4321('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x4321('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x4321('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x4321('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4321('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4321('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x4321('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x4321('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x4321('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x4321('0x2')]},'queue_quantity1':{'type':Sequelize[_0x4321('0x2')]},'queue_quantity2':{'type':Sequelize[_0x4321('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x4321('0x2')]},'queue_less_than':{'type':Sequelize[_0x4321('0x2')]},'periodic_announce':{'type':Sequelize[_0x4321('0x1a')],'set':function(_0x26555d){this['setDataValue'](_0x4321('0x1b'),_0x26555d?_0x26555d[_0x4321('0x1c')](','):[]);},'get':function(){return this['getDataValue'](_0x4321('0x1b'))?this['getDataValue']('periodic_announce')[_0x4321('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x4321('0x2')],'defaultValue':_0x4321('0x17'),'set':function(_0x1b6198){this[_0x4321('0xd')]('joinempty',_0x1b6198?_0x1b6198[_0x4321('0x1c')](','):undefined);},'get':function(){return this[_0x4321('0x11')](_0x4321('0x1e'))?this['getDataValue'](_0x4321('0x1e'))[_0x4321('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x4321('0x2')],'defaultValue':'no','set':function(_0x1fd91c){this[_0x4321('0xd')](_0x4321('0x1f'),_0x1fd91c?_0x1fd91c[_0x4321('0x1c')](','):undefined);},'get':function(){return this[_0x4321('0x11')](_0x4321('0x1f'))?this[_0x4321('0x11')](_0x4321('0x1f'))[_0x4321('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x4321('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4321('0x3')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x4321('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x4321('0x2')]},'description':{'type':Sequelize[_0x4321('0x2')]},'acw':{'type':Sequelize[_0x4321('0x20')],'defaultValue':0x0,'set':function(_0x615413){this[_0x4321('0xd')](_0x4321('0x21'),_0x615413);if(_0x615413){if(this[_0x4321('0x11')](_0x4321('0x22'))<0x2){this[_0x4321('0xd')](_0x4321('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x4321('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x4321('0x23'),'progressive','power',_0x4321('0x14'),_0x4321('0x12')),'defaultValue':_0x4321('0x13'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x4321('0x16')](0x4)[_0x4321('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4321('0x25')},'dialLimitQueue':{'type':Sequelize[_0x4321('0x16')](0x4)[_0x4321('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4321('0x26')},'dialPowerLevel':{'type':Sequelize[_0x4321('0x27')](0x2)[_0x4321('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x4321('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x4321('0x3')](_0x4321('0x29'),_0x4321('0x2a')),'defaultValue':_0x4321('0x2a'),'comment':_0x4321('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x4321('0x27')](0x2)[_0x4321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x4321('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x4321('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4321('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4321('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4321('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x4321('0x2')],'defaultValue':'tTxX','comment':_0x4321('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x4321('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x4321('0x2')],'comment':_0x4321('0x2f')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4321('0x16')](0x3)[_0x4321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4321('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4321('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4321('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x4321('0x16')](0x3)[_0x4321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4321('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4321('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4321('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x4321('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4321('0x16')](0x5)[_0x4321('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x4321('0x16')](0x3)[_0x4321('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4321('0x35')},'dialTimezone':{'type':Sequelize[_0x4321('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4321('0x2')],'defaultValue':_0x4321('0x36')},'dialPrefix':{'type':Sequelize[_0x4321('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x4321('0x37'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x4321('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4321('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4321('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x4321('0x16')](0x9)[_0x4321('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4321('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4321('0x16')](0x9)[_0x4321('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4321('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4321('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x4321('0x16')](0x9)[_0x4321('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4321('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4321('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4321('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4321('0x16')](0x9)[_0x4321('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4321('0x3e')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4321('0x16')](0x5)[_0x4321('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4321('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4321('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4321('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x4321('0x16')](0x5)[_0x4321('0x24')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x4321('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x4321('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x4321('0x3')]('DESC',_0x4321('0x42')),'defaultValue':_0x4321('0x43')},'dialQueueProject2':{'type':Sequelize[_0x4321('0x2')],'comment':_0x4321('0x2f')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x4321('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x4321('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4321('0x16')](0x3)[_0x4321('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4321('0x16')](0x3)[_0x4321('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4321('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4321('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4321('0x16')](0x5)[_0x4321('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4321('0x45')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4321('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0x4321('0x16')](0x5)[_0x4321('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4321('0x16')](0x3)[_0x4321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4321('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4321('0x16')](0x5)[_0x4321('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4321('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0x4321('0x16')](0x3)[_0x4321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4321('0x49')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4321('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4321('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4321('0x16')](0x5)[_0x4321('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4321('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4321('0x16')],'allowNull':!![],'comment':_0x4321('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0x4321('0x20')],'defaultValue':![],'comment':_0x4321('0x4c'),'set':function(_0x377130){if(!_0x377130)this['setDataValue'](_0x4321('0x4d'),null);this[_0x4321('0xd')](_0x4321('0x4e'),_0x377130);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x4321('0x16')](0x3)[_0x4321('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4321('0x16')](0x3)[_0x4321('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x4321('0x16')](0x3)[_0x4321('0x24')],'defaultValue':0x4}}; \ No newline at end of file +var _0x1794=['#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','ASC','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','ENUM','inbound','outbound','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','booked','roundrobin','progressive','power','INTEGER','yes','once','TEXT','joinempty','join','split','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'];(function(_0x4d8a8f,_0x2afd4c){var _0xfc4adc=function(_0xb89886){while(--_0xb89886){_0x4d8a8f['push'](_0x4d8a8f['shift']());}};_0xfc4adc(++_0x2afd4c);}(_0x1794,0x180));var _0x4179=function(_0x327e61,_0x514f46){_0x327e61=_0x327e61-0x0;var _0x1406a6=_0x1794[_0x327e61];return _0x1406a6;};'use strict';var Sequelize=require(_0x4179('0x0'));module['exports']={'name':{'type':Sequelize[_0x4179('0x1')],'allowNull':![],'unique':_0x4179('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4179('0x3')](_0x4179('0x4'),_0x4179('0x5')),'allowNull':![],'defaultValue':_0x4179('0x4')},'musiconhold':{'type':Sequelize[_0x4179('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x4179('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x4179('0x3')]('rr','ringall',_0x4179('0x6'),_0x4179('0x7'),'random',_0x4179('0x8'),'linear',_0x4179('0x9'),_0x4179('0xa')),'allowNull':![],'defaultValue':_0x4179('0xb'),'set':function(_0x5d9efb){this[_0x4179('0xc')](_0x4179('0xd'),_0x5d9efb?_0x5d9efb:_0x4179('0x8'));},'get':function(){var _0x5e745a=this[_0x4179('0xe')](_0x4179('0xf'));var _0x1f0860=this['getDataValue']('dialMethod');var _0x5f2680=this[_0x4179('0xe')](_0x4179('0xd'));if(_0x5e745a==='inbound'){return _0x5f2680;}if(_0x1f0860===_0x4179('0x10')&&_0x5f2680===_0x4179('0x8')||_0x1f0860===_0x4179('0x10')&&_0x5f2680===_0x4179('0x11')){return _0x5f2680;}if(_0x1f0860===_0x4179('0x12')||_0x1f0860==='predictive'||_0x1f0860===_0x4179('0x13')){return _0x5f2680;}return null;}},'servicelevel':{'type':Sequelize[_0x4179('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x4179('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x4179('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x4179('0x1')]},'weight':{'type':Sequelize[_0x4179('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x4179('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4179('0x3')]('yes','no'),'defaultValue':_0x4179('0x15')},'autopause':{'type':Sequelize[_0x4179('0x3')](_0x4179('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x4179('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x4179('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x4179('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x4179('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x4179('0x3')](_0x4179('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x4179('0x3')](_0x4179('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x4179('0x3')](_0x4179('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x4179('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x4179('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x4179('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x4179('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x4179('0x3')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x4179('0x3')](_0x4179('0x15'),'no'),'defaultValue':_0x4179('0x15')},'announce_holdtime':{'type':Sequelize[_0x4179('0x3')](_0x4179('0x15'),'no',_0x4179('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x4179('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x4179('0x3')](_0x4179('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x4179('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x4179('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x4179('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x4179('0x1')]},'queue_youarenext':{'type':Sequelize[_0x4179('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x4179('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x4179('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4179('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4179('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x4179('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x4179('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x4179('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x4179('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x4179('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x4179('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x4179('0x17')],'set':function(_0x12e7b2){this[_0x4179('0xc')]('periodic_announce',_0x12e7b2?_0x12e7b2['join'](','):[]);},'get':function(){return this[_0x4179('0xe')]('periodic_announce')?this[_0x4179('0xe')]('periodic_announce')['split'](','):[];}},'joinempty':{'type':Sequelize[_0x4179('0x1')],'defaultValue':'yes','set':function(_0x1b8d93){this['setDataValue'](_0x4179('0x18'),_0x1b8d93?_0x1b8d93[_0x4179('0x19')](','):undefined);},'get':function(){return this[_0x4179('0xe')]('joinempty')?this[_0x4179('0xe')](_0x4179('0x18'))[_0x4179('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x4179('0x1')],'defaultValue':'no','set':function(_0x3fcf0d){this[_0x4179('0xc')](_0x4179('0x1b'),_0x3fcf0d?_0x3fcf0d['join'](','):undefined);},'get':function(){return this[_0x4179('0xe')](_0x4179('0x1b'))?this[_0x4179('0xe')](_0x4179('0x1b'))[_0x4179('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x4179('0x3')](_0x4179('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4179('0x3')](_0x4179('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x4179('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x4179('0x3')](_0x4179('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4179('0x1')]},'acw':{'type':Sequelize[_0x4179('0x1c')],'defaultValue':0x0,'set':function(_0x569eba){this[_0x4179('0xc')]('acw',_0x569eba);if(_0x569eba){if(this['getDataValue'](_0x4179('0x1d'))<0x2){this[_0x4179('0xc')](_0x4179('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x4179('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x4179('0x1c')],'defaultValue':0x0,'comment':_0x4179('0x1e')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x4179('0x12'),_0x4179('0x13'),_0x4179('0x1f'),'booked'),'defaultValue':_0x4179('0x12'),'comment':_0x4179('0x20')},'dialLimitChannel':{'type':Sequelize[_0x4179('0x14')](0x4)[_0x4179('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4179('0x22')},'dialLimitQueue':{'type':Sequelize[_0x4179('0x14')](0x4)[_0x4179('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4179('0x23')},'dialPowerLevel':{'type':Sequelize[_0x4179('0x24')](0x2)[_0x4179('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x4179('0x25'),_0x4179('0x26')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x4179('0x24')](0x2)[_0x4179('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x4179('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0x4179('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x4179('0x28')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4179('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x4179('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4179('0x29')},'dialQueueOptions':{'type':Sequelize[_0x4179('0x1')],'defaultValue':_0x4179('0x2a'),'comment':_0x4179('0x2b')},'dialQueueTimeout':{'type':Sequelize[_0x4179('0x14')](0x3)[_0x4179('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x4179('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4179('0x14')](0x3)[_0x4179('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4179('0x14')](0x5)[_0x4179('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x4179('0x14')](0x3)[_0x4179('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4179('0x2d')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4179('0x14')](0x5)[_0x4179('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4179('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4179('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x4179('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4179('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4179('0x30')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4179('0x14')](0x3)[_0x4179('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4179('0x31')},'dialTimezone':{'type':Sequelize[_0x4179('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4179('0x1')],'defaultValue':_0x4179('0x32')},'dialPrefix':{'type':Sequelize[_0x4179('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x4179('0x3')](_0x4179('0x33'),'never',_0x4179('0x34')),'defaultValue':_0x4179('0x33')},'dialAMDActive':{'type':Sequelize[_0x4179('0x1c')],'defaultValue':0x0,'comment':_0x4179('0x35')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4179('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4179('0x36')},'dialAMDGreeting':{'type':Sequelize[_0x4179('0x14')](0x9)[_0x4179('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4179('0x37')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4179('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x4179('0x38')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4179('0x14')](0x9)[_0x4179('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4179('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x4179('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4179('0x14')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4179('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4179('0x3a')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4179('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4179('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4179('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x4179('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x4179('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4179('0x3')]('DESC',_0x4179('0x3e')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x4179('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4179('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4179('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4179('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4179('0x3f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4179('0x14')](0x5)[_0x4179('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4179('0x40')},'dialDropMaxRetry':{'type':Sequelize[_0x4179('0x14')](0x3)[_0x4179('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4179('0x41')},'dialDropRetryFrequency':{'type':Sequelize[_0x4179('0x14')](0x5)[_0x4179('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4179('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4179('0x14')](0x3)[_0x4179('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4179('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4179('0x14')](0x5)[_0x4179('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x4179('0x14')](0x3)[_0x4179('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4179('0x44')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4179('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4179('0x45')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4179('0x14')](0x3)[_0x4179('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4179('0x46')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4179('0x14')](0x5)[_0x4179('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4179('0x47')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x4179('0x1c')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x4a0317){if(!_0x4a0317)this[_0x4179('0xc')](_0x4179('0x48'),null);this[_0x4179('0xc')](_0x4179('0x49'),_0x4a0317);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x4179('0x14')](0x3)[_0x4179('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4179('0x14')](0x3)[_0x4179('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x4179('0x14')](0x3)[_0x4179('0x21')],'defaultValue':0x4}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 4e545ee..e7025d6 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 _0xe14b=['VoiceQueues','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','stack','index','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','options','include','VoiceQueue','findAll','catch','show','params','rawAttributes','includeAll','merge','user','role','inbound','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','findOne','CmHopper','rows','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','teams','Team','User','Agents','online','interface','flatMap','forEach','penalty','transaction','each','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','voicePause','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','VoiceQueueId\x20=\x20?','toString','QueryTypes','every','TeamId','all','ids','removeAgents','userVoiceQueue:remove','addAgents','spread','push','format','SIP/%s','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ListId','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','onlyIfOpen','ContactId','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','sequelize','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.OrderBy','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','phone\x20IS\x20NOT\x20NULL','removeBlackLists','eml-format','rimraf','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','reject','then','destroy','get'];(function(_0xec524b,_0x6345ec){var _0x164431=function(_0x40f6de){while(--_0x40f6de){_0xec524b['push'](_0xec524b['shift']());}};_0x164431(++_0x6345ec);}(_0xe14b,0x93));var _0xbe14=function(_0x35a226,_0x739057){_0x35a226=_0x35a226-0x0;var _0x3c00dd=_0xe14b[_0x35a226];return _0x3c00dd;};'use strict';var emlformat=require(_0xbe14('0x0'));var rimraf=require(_0xbe14('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe14('0x2'));var moment=require(_0xbe14('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbe14('0x4'));var util=require('util');var path=require('path');var sox=require(_0xbe14('0x5'));var csv=require(_0xbe14('0x6'));var ejs=require(_0xbe14('0x7'));var fs=require('fs');var fs_extra=require(_0xbe14('0x8'));var _=require(_0xbe14('0x9'));var squel=require(_0xbe14('0xa'));var crypto=require(_0xbe14('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbe14('0xc'));var Papa=require(_0xbe14('0xd'));var Redis=require(_0xbe14('0xe'));var authService=require(_0xbe14('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe14('0x10'));var logger=require(_0xbe14('0x11'))('api');var utils=require(_0xbe14('0x12'));var config=require(_0xbe14('0x13'));var licenseUtil=require(_0xbe14('0x14'));var db=require(_0xbe14('0x15'))['db'];config[_0xbe14('0x16')]=_[_0xbe14('0x17')](config[_0xbe14('0x16')],{'host':_0xbe14('0x18'),'port':0x18eb});var socket=require(_0xbe14('0x19'))(new Redis(config[_0xbe14('0x16')]));require(_0xbe14('0x1a'))[_0xbe14('0x1b')](socket);function respondWithStatusCode(_0x813399,_0x530538){_0x530538=_0x530538||0xcc;return function(_0x55b3a7){if(_0x55b3a7){return _0x813399[_0xbe14('0x1c')](_0x530538);}return _0x813399[_0xbe14('0x1d')](_0x530538)[_0xbe14('0x1e')]();};}function respondWithResult(_0x37ce4e,_0x4e8f34){_0x4e8f34=_0x4e8f34||0xc8;return function(_0x21c789){if(_0x21c789){return _0x37ce4e[_0xbe14('0x1d')](_0x4e8f34)[_0xbe14('0x1f')](_0x21c789);}};}function respondWithFilteredResult(_0x123ede,_0x38f1ea){return function(_0x29ab73){if(_0x29ab73){var _0x17ae86=typeof _0x38f1ea['offset']===_0xbe14('0x20')&&typeof _0x38f1ea[_0xbe14('0x21')]===_0xbe14('0x20');var _0x433459=_0x29ab73[_0xbe14('0x22')];var _0x37e4c1=_0x17ae86?0x0:_0x38f1ea['offset'];var _0x24f820=_0x17ae86?_0x29ab73[_0xbe14('0x22')]:_0x38f1ea[_0xbe14('0x23')]+_0x38f1ea[_0xbe14('0x21')];var _0x188ec4;if(_0x24f820>=_0x433459){_0x24f820=_0x433459;_0x188ec4=0xc8;}else{_0x188ec4=0xce;}_0x123ede['status'](_0x188ec4);return _0x123ede[_0xbe14('0x24')]('Content-Range',_0x37e4c1+'-'+_0x24f820+'/'+_0x433459)[_0xbe14('0x1f')](_0x29ab73);}return null;};}function patchUpdates(_0x56e80c){return function(_0x32e8eb){try{jsonpatch['apply'](_0x32e8eb,_0x56e80c,!![]);}catch(_0x274018){return BPromise[_0xbe14('0x25')](_0x274018);}return _0x32e8eb['save']();};}function saveUpdates(_0x2da350,_0x4d4190){return function(_0x4587a8){if(_0x4587a8){return _0x4587a8['update'](_0x2da350)[_0xbe14('0x26')](function(_0x5fa043){return _0x5fa043;});}return null;};}function removeEntity(_0x1ee9c1,_0x39cc81){return function(_0x15ef02){if(_0x15ef02){return _0x15ef02[_0xbe14('0x27')]()['then'](function(){var _0x1822e0=_0x15ef02[_0xbe14('0x28')]({'plain':!![]});var _0x391556=[{'name':_0xbe14('0x29'),'value':'inbound','ignore':![]},{'name':_0xbe14('0x2a'),'value':_0xbe14('0x2b'),'ignore':![]}];var _0x59bf34=_(_0x391556)[_0xbe14('0x2c')](_0xbe14('0x2d'))[_0xbe14('0x2e')](_0xbe14('0x2f'))[_0xbe14('0x2f')]();if(_[_0xbe14('0x30')](_0x59bf34,_0x1822e0[_0xbe14('0x31')])){return;}var _0x2b05cb=_[_0xbe14('0x32')](_0x391556,[_0xbe14('0x2f'),_0x1822e0[_0xbe14('0x31')]])[_0xbe14('0x33')];return db[_0xbe14('0x34')][_0xbe14('0x27')]({'where':{'type':_0x2b05cb,'resourceId':_0x1822e0['id']}})[_0xbe14('0x26')](function(){return _0x15ef02;});})[_0xbe14('0x26')](function(){_0x1ee9c1[_0xbe14('0x1d')](0xcc)[_0xbe14('0x1e')]();});}};}function handleEntityNotFound(_0x29e76a,_0x14e7c4){return function(_0x581e86){if(!_0x581e86){_0x29e76a[_0xbe14('0x1c')](0x194);}return _0x581e86;};}function handleError(_0x499793,_0x58f8de){_0x58f8de=_0x58f8de||0x1f4;return function(_0x46c2d1){logger['error'](_0x46c2d1[_0xbe14('0x35')]);if(_0x46c2d1[_0xbe14('0x33')]){delete _0x46c2d1['name'];}_0x499793['status'](_0x58f8de)['send'](_0x46c2d1);};}exports[_0xbe14('0x36')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={},_0x1faf3e={},_0x452635={'count':0x0,'rows':[]};var _0x1aa849=_[_0xbe14('0x2e')](db['VoiceQueue']['rawAttributes'],function(_0x15a997){return{'name':_0x15a997['fieldName'],'type':_0x15a997['type']['key']};});_0x1faf3e[_0xbe14('0x37')]=_[_0xbe14('0x2e')](_0x1aa849,_0xbe14('0x33'));_0x1faf3e[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0xa3d24[_0xbe14('0x38')]);_0x1faf3e[_0xbe14('0x3a')]=_[_0xbe14('0x3b')](_0x1faf3e[_0xbe14('0x37')],_0x1faf3e[_0xbe14('0x38')]);_0x46c570[_0xbe14('0x3c')]=_[_0xbe14('0x3b')](_0x1faf3e['model'],qs['fields'](_0xa3d24[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x46c570[_0xbe14('0x3c')]=_0x46c570['attributes'][_0xbe14('0x3e')]?_0x46c570[_0xbe14('0x3c')]:_0x1faf3e[_0xbe14('0x37')];if(!_0xa3d24[_0xbe14('0x38')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x46c570[_0xbe14('0x21')]=qs[_0xbe14('0x21')](_0xa3d24[_0xbe14('0x38')]['limit']);_0x46c570[_0xbe14('0x23')]=qs[_0xbe14('0x23')](_0xa3d24[_0xbe14('0x38')][_0xbe14('0x23')]);}_0x46c570[_0xbe14('0x41')]=qs[_0xbe14('0x42')](_0xa3d24['query'][_0xbe14('0x42')]);_0x46c570[_0xbe14('0x43')]=qs[_0xbe14('0x3a')](_[_0xbe14('0x44')](_0xa3d24['query'],_0x1faf3e['filters']),_0x1aa849);if(_0xa3d24[_0xbe14('0x38')][_0xbe14('0x2c')]){_0x46c570[_0xbe14('0x43')]=_['merge'](_0x46c570['where'],{'$or':_[_0xbe14('0x2e')](_0x1aa849,function(_0x59ae4d){if(_0x59ae4d['type']!==_0xbe14('0x45')){var _0x1f0355={};_0x1f0355[_0x59ae4d[_0xbe14('0x33')]]={'$like':'%'+_0xa3d24['query']['filter']+'%'};return _0x1f0355;}})});}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x46')]);var _0x1eccf7={'where':_0x46c570[_0xbe14('0x43')]};return db['VoiceQueue'][_0xbe14('0x22')](_0x1eccf7)[_0xbe14('0x26')](function(_0x32f22e){_0x452635[_0xbe14('0x22')]=_0x32f22e;if(_0xa3d24['query']['includeAll']){_0x46c570[_0xbe14('0x47')]=[{'all':!![]}];}return db[_0xbe14('0x48')][_0xbe14('0x49')](_0x46c570);})[_0xbe14('0x26')](function(_0x2550dc){_0x452635['rows']=_0x2550dc;return _0x452635;})['then'](respondWithFilteredResult(_0x5f27b6,_0x46c570))[_0xbe14('0x4a')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x4b')]=function(_0x238c60,_0x2a3b35){var _0x4e65d2={'raw':![],'where':{'id':_0x238c60[_0xbe14('0x4c')]['id']}},_0x28b6e3={};_0x28b6e3['model']=_[_0xbe14('0x39')](db[_0xbe14('0x48')][_0xbe14('0x4d')]);_0x28b6e3[_0xbe14('0x38')]=_['keys'](_0x238c60['query']);_0x28b6e3[_0xbe14('0x3a')]=_[_0xbe14('0x3b')](_0x28b6e3['model'],_0x28b6e3['query']);_0x4e65d2[_0xbe14('0x3c')]=_[_0xbe14('0x3b')](_0x28b6e3[_0xbe14('0x37')],qs[_0xbe14('0x3d')](_0x238c60[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x4e65d2[_0xbe14('0x3c')]=_0x4e65d2['attributes'][_0xbe14('0x3e')]?_0x4e65d2[_0xbe14('0x3c')]:_0x28b6e3[_0xbe14('0x37')];if(_0x238c60[_0xbe14('0x38')][_0xbe14('0x4e')]){_0x4e65d2['include']=[{'all':!![]}];}_0x4e65d2=_[_0xbe14('0x4f')]({},_0x4e65d2,_0x238c60[_0xbe14('0x46')]);return db[_0xbe14('0x48')][_0xbe14('0x32')](_0x4e65d2)[_0xbe14('0x26')](handleEntityNotFound(_0x2a3b35,null))[_0xbe14('0x26')](respondWithResult(_0x2a3b35,null))['catch'](handleError(_0x2a3b35,null));};exports['create']=function(_0x3a49f7,_0x2bde72){return db[_0xbe14('0x48')]['create'](_0x3a49f7['body'],{})[_0xbe14('0x26')](function(_0x134878){var _0x50d78f=_0x3a49f7[_0xbe14('0x50')][_0xbe14('0x28')]({'plain':!![]});if(!_0x50d78f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50d78f[_0xbe14('0x51')]==='user'){var _0x41ba58=_0x134878[_0xbe14('0x28')]({'plain':!![]});var _0x12a9de=[{'name':'VoiceQueues','value':_0xbe14('0x52')},{'name':_0xbe14('0x2a'),'value':'outbound'}];var _0x27f24b=_[_0xbe14('0x32')](_0x12a9de,[_0xbe14('0x2f'),_0x41ba58[_0xbe14('0x31')]])[_0xbe14('0x33')];return db['UserProfileSection'][_0xbe14('0x32')]({'where':{'name':_0x27f24b,'userProfileId':_0x50d78f[_0xbe14('0x53')]},'raw':!![]})[_0xbe14('0x26')](function(_0x243b9e){if(_0x243b9e&&_0x243b9e[_0xbe14('0x54')]===0x0){return db[_0xbe14('0x34')][_0xbe14('0x55')]({'name':_0x41ba58['name'],'resourceId':_0x41ba58['id'],'type':_0x243b9e[_0xbe14('0x33')],'sectionId':_0x243b9e['id']},{})[_0xbe14('0x26')](function(){return _0x134878;});}else{return _0x134878;}})[_0xbe14('0x4a')](function(_0x1201e2){logger[_0xbe14('0x56')](_0xbe14('0x57'),_0x1201e2);throw _0x1201e2;});}return _0x134878;})[_0xbe14('0x26')](respondWithResult(_0x2bde72,0xc9))[_0xbe14('0x4a')](handleError(_0x2bde72,null));};exports[_0xbe14('0x58')]=function(_0xc61103,_0x358950){var _0x4bccfc={'where':{'id':_0xc61103['params']['id']}},_0x56bcd3={};_0x56bcd3[_0xbe14('0x37')]=_[_0xbe14('0x39')](db[_0xbe14('0x48')][_0xbe14('0x4d')]);_0x4bccfc[_0xbe14('0x3c')]=_[_0xbe14('0x3b')](_0x56bcd3[_0xbe14('0x37')],qs[_0xbe14('0x3d')](_0xc61103[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x4bccfc[_0xbe14('0x3c')]=_0x4bccfc[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x4bccfc[_0xbe14('0x3c')]:_0x56bcd3[_0xbe14('0x37')];if(_0xc61103[_0xbe14('0x38')][_0xbe14('0x4e')]){_0x4bccfc[_0xbe14('0x47')]=[{'all':!![]}];}_0x4bccfc=_[_0xbe14('0x4f')]({},_0x4bccfc,_0xc61103[_0xbe14('0x46')]);return db['VoiceQueue'][_0xbe14('0x32')](_0x4bccfc)[_0xbe14('0x26')](handleEntityNotFound(_0x358950,null))[_0xbe14('0x26')](function(_0x46b49c){if(_0x46b49c){var _0x3ee6b7=_0x46b49c[_0xbe14('0x28')]({'plain':!![]});_0x3ee6b7=qs[_0xbe14('0x59')](_0x3ee6b7,['id',_0xbe14('0x5a'),_0xbe14('0x5b')]);_0xc61103[_0xbe14('0x5c')]=_['omit'](_0xc61103[_0xbe14('0x5c')],['id',_0xbe14('0x5a'),_0xbe14('0x5b')]);return db[_0xbe14('0x48')][_0xbe14('0x55')](_['merge'](_0x3ee6b7,_0xc61103[_0xbe14('0x5c')]),{'include':_0xc61103[_0xbe14('0x38')][_0xbe14('0x4e')]?[{'all':!![]}]:undefined})[_0xbe14('0x26')](function(_0x46ac9c){var _0x5ed9b3=_0xc61103[_0xbe14('0x50')][_0xbe14('0x28')]({'plain':!![]});if(!_0x5ed9b3)throw new Error(_0xbe14('0x5d'));if(_0x5ed9b3[_0xbe14('0x51')]===_0xbe14('0x50')){var _0x289c4d=_0x46ac9c[_0xbe14('0x28')]({'plain':!![]});var _0x2c1f2f=[{'name':'VoiceQueues','value':_0xbe14('0x52')},{'name':_0xbe14('0x2a'),'value':_0xbe14('0x2b')}];var _0x20b12e=_[_0xbe14('0x32')](_0x2c1f2f,[_0xbe14('0x2f'),_0x289c4d[_0xbe14('0x31')]])['name'];return db['UserProfileSection'][_0xbe14('0x32')]({'where':{'name':_0x20b12e,'userProfileId':_0x5ed9b3[_0xbe14('0x53')]},'raw':!![]})[_0xbe14('0x26')](function(_0x2510a0){if(_0x2510a0&&_0x2510a0[_0xbe14('0x54')]===0x0){return db[_0xbe14('0x34')][_0xbe14('0x55')]({'name':_0x289c4d[_0xbe14('0x33')],'resourceId':_0x289c4d['id'],'type':_0x2510a0['name'],'sectionId':_0x2510a0['id']},{})['then'](function(){return _0x46ac9c;});}else{return _0x46ac9c;}})[_0xbe14('0x4a')](function(_0x1c18b6){logger[_0xbe14('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c18b6);throw _0x1c18b6;});}return _0x46ac9c;});}})[_0xbe14('0x26')](respondWithResult(_0x358950,0xc9))[_0xbe14('0x4a')](handleError(_0x358950,null));};exports[_0xbe14('0x5e')]=function(_0x1797dd,_0x468e9f){if(_0x1797dd[_0xbe14('0x5c')]['id']){delete _0x1797dd[_0xbe14('0x5c')]['id'];}return db['VoiceQueue'][_0xbe14('0x32')]({'where':{'id':_0x1797dd[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x468e9f,null))[_0xbe14('0x26')](saveUpdates(_0x1797dd[_0xbe14('0x5c')],null))[_0xbe14('0x26')](respondWithResult(_0x468e9f,null))[_0xbe14('0x4a')](handleError(_0x468e9f,null));};exports['destroy']=function(_0x3952c7,_0x16b046){return db[_0xbe14('0x48')][_0xbe14('0x32')]({'where':{'id':_0x3952c7[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x16b046,null))[_0xbe14('0x26')](removeEntity(_0x16b046,null))[_0xbe14('0x4a')](handleError(_0x16b046,null));};exports['getHoppers']=function(_0x1e5ce1,_0x401968,_0x362999){var _0xb40587={'raw':![],'where':{}};var _0x2e0155={};var _0x17576b={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xbe14('0x5f')]({'where':{'id':_0x1e5ce1[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x401968,null))[_0xbe14('0x26')](function(_0x508455){if(_0x508455){_0x2e0155[_0xbe14('0x37')]=_[_0xbe14('0x39')](db[_0xbe14('0x60')][_0xbe14('0x4d')]);_0x2e0155[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0x1e5ce1[_0xbe14('0x38')]);_0x2e0155['filters']=_[_0xbe14('0x3b')](_0x2e0155['model'],_0x2e0155[_0xbe14('0x38')]);_0xb40587['attributes']=_[_0xbe14('0x3b')](_0x2e0155[_0xbe14('0x37')],qs[_0xbe14('0x3d')](_0x1e5ce1['query'][_0xbe14('0x3d')]));_0xb40587[_0xbe14('0x3c')]=_0xb40587[_0xbe14('0x3c')]['length']?_0xb40587[_0xbe14('0x3c')]:_0x2e0155[_0xbe14('0x37')];if(!_0x1e5ce1[_0xbe14('0x38')][_0xbe14('0x3f')]('nolimit')){_0xb40587[_0xbe14('0x21')]=qs[_0xbe14('0x21')](_0x1e5ce1[_0xbe14('0x38')][_0xbe14('0x21')]);_0xb40587[_0xbe14('0x23')]=qs[_0xbe14('0x23')](_0x1e5ce1[_0xbe14('0x38')]['offset']);}_0xb40587[_0xbe14('0x41')]=qs[_0xbe14('0x42')](_0x1e5ce1[_0xbe14('0x38')]['sort']);_0xb40587[_0xbe14('0x43')]=qs[_0xbe14('0x3a')](_[_0xbe14('0x44')](_0x1e5ce1['query'],_0x2e0155[_0xbe14('0x3a')]));_0xb40587[_0xbe14('0x43')]['VoiceQueueId']=_0x508455['id'];if(_0x1e5ce1[_0xbe14('0x38')]['filter']){_0xb40587[_0xbe14('0x43')]=_[_0xbe14('0x4f')](_0xb40587['where'],{'$or':_['map'](_0xb40587[_0xbe14('0x3c')],function(_0x3db955){var _0x29287a={};_0x29287a[_0x3db955]={'$like':'%'+_0x1e5ce1['query'][_0xbe14('0x2c')]+'%'};return _0x29287a;})});}_0xb40587=_[_0xbe14('0x4f')]({},_0xb40587,_0x1e5ce1[_0xbe14('0x46')]);return db[_0xbe14('0x60')]['count']({'where':_0xb40587['where']})[_0xbe14('0x26')](function(_0x6f7a6f){_0x17576b[_0xbe14('0x22')]=_0x6f7a6f;if(_0x1e5ce1[_0xbe14('0x38')][_0xbe14('0x4e')]){_0xb40587[_0xbe14('0x47')]=[{'all':!![]}];}return db[_0xbe14('0x60')]['findAll'](_0xb40587);})[_0xbe14('0x26')](function(_0x512f3a){_0x17576b[_0xbe14('0x61')]=_0x512f3a;return _0x17576b;});}})[_0xbe14('0x26')](respondWithFilteredResult(_0x401968,_0xb40587))[_0xbe14('0x4a')](handleError(_0x401968,null));};exports[_0xbe14('0x62')]=function(_0x55a3ae,_0x1e160b,_0xa8dd0c){var _0xdfbd5b={'raw':!![],'where':{}};var _0x5b8b20={};var _0x2beb45={'count':0x0,'rows':[]};return db[_0xbe14('0x48')][_0xbe14('0x5f')]({'where':{'id':_0x55a3ae[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x1e160b,null))[_0xbe14('0x26')](function(_0x232a33){if(_0x232a33){_0x5b8b20[_0xbe14('0x37')]=_[_0xbe14('0x39')](db[_0xbe14('0x63')][_0xbe14('0x4d')]);_0x5b8b20[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0x55a3ae[_0xbe14('0x38')]);_0x5b8b20[_0xbe14('0x3a')]=_[_0xbe14('0x3b')](_0x5b8b20[_0xbe14('0x37')],_0x5b8b20[_0xbe14('0x38')]);_0xdfbd5b[_0xbe14('0x3c')]=_[_0xbe14('0x3b')](_0x5b8b20['model'],qs[_0xbe14('0x3d')](_0x55a3ae['query'][_0xbe14('0x3d')]));_0xdfbd5b[_0xbe14('0x3c')]=_0xdfbd5b[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0xdfbd5b[_0xbe14('0x3c')]:_0x5b8b20['model'];if(!_0x55a3ae['query'][_0xbe14('0x3f')](_0xbe14('0x40'))){_0xdfbd5b[_0xbe14('0x21')]=qs[_0xbe14('0x21')](_0x55a3ae['query'][_0xbe14('0x21')]);_0xdfbd5b[_0xbe14('0x23')]=qs['offset'](_0x55a3ae[_0xbe14('0x38')][_0xbe14('0x23')]);}_0xdfbd5b[_0xbe14('0x41')]=qs[_0xbe14('0x42')](_0x55a3ae['query'][_0xbe14('0x42')]);_0xdfbd5b['where']=qs['filters'](_[_0xbe14('0x44')](_0x55a3ae[_0xbe14('0x38')],_0x5b8b20[_0xbe14('0x3a')]));_0xdfbd5b[_0xbe14('0x43')][_0xbe14('0x64')]=_0x232a33['id'];if(_0x55a3ae['query'][_0xbe14('0x2c')]){_0xdfbd5b[_0xbe14('0x43')]=_['merge'](_0xdfbd5b['where'],{'$or':_[_0xbe14('0x2e')](_0xdfbd5b[_0xbe14('0x3c')],function(_0x4f5e74){var _0xddbc1c={};_0xddbc1c[_0x4f5e74]={'$like':'%'+_0x55a3ae['query'][_0xbe14('0x2c')]+'%'};return _0xddbc1c;})});}_0xdfbd5b=_['merge']({},_0xdfbd5b,_0x55a3ae[_0xbe14('0x46')]);return db['CmHopperHistory'][_0xbe14('0x22')]({'where':_0xdfbd5b['where']})[_0xbe14('0x26')](function(_0xaad91d){_0x2beb45['count']=_0xaad91d;if(_0x55a3ae['query'][_0xbe14('0x4e')]){_0xdfbd5b['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xbe14('0x49')](_0xdfbd5b);})[_0xbe14('0x26')](function(_0x24c198){_0x2beb45[_0xbe14('0x61')]=_0x24c198;return _0x2beb45;});}})[_0xbe14('0x26')](respondWithFilteredResult(_0x1e160b,_0xdfbd5b))[_0xbe14('0x4a')](handleError(_0x1e160b,null));};exports[_0xbe14('0x65')]=function(_0x57ad22,_0x1ee918,_0x3aa921){var _0x4c2c49={'raw':!![],'where':{}};var _0x1445ce={};var _0x59779a={'count':0x0,'rows':[]};return db[_0xbe14('0x48')][_0xbe14('0x5f')]({'where':{'id':_0x57ad22[_0xbe14('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1ee918,null))[_0xbe14('0x26')](function(_0x38819a){if(_0x38819a){_0x1445ce['model']=_[_0xbe14('0x39')](db['CmHopperFinal'][_0xbe14('0x4d')]);_0x1445ce[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0x57ad22['query']);_0x1445ce[_0xbe14('0x3a')]=_['intersection'](_0x1445ce[_0xbe14('0x37')],_0x1445ce['query']);_0x4c2c49['attributes']=_[_0xbe14('0x3b')](_0x1445ce['model'],qs[_0xbe14('0x3d')](_0x57ad22['query'][_0xbe14('0x3d')]));_0x4c2c49[_0xbe14('0x3c')]=_0x4c2c49[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x4c2c49[_0xbe14('0x3c')]:_0x1445ce[_0xbe14('0x37')];if(!_0x57ad22[_0xbe14('0x38')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x4c2c49[_0xbe14('0x21')]=qs[_0xbe14('0x21')](_0x57ad22[_0xbe14('0x38')][_0xbe14('0x21')]);_0x4c2c49['offset']=qs[_0xbe14('0x23')](_0x57ad22[_0xbe14('0x38')][_0xbe14('0x23')]);}_0x4c2c49[_0xbe14('0x41')]=qs[_0xbe14('0x42')](_0x57ad22['query']['sort']);_0x4c2c49[_0xbe14('0x43')]=qs[_0xbe14('0x3a')](_[_0xbe14('0x44')](_0x57ad22[_0xbe14('0x38')],_0x1445ce[_0xbe14('0x3a')]));_0x4c2c49[_0xbe14('0x43')][_0xbe14('0x64')]=_0x38819a['id'];if(_0x57ad22[_0xbe14('0x38')][_0xbe14('0x2c')]){_0x4c2c49[_0xbe14('0x43')]=_[_0xbe14('0x4f')](_0x4c2c49[_0xbe14('0x43')],{'$or':_[_0xbe14('0x2e')](_0x4c2c49[_0xbe14('0x3c')],function(_0x894313){var _0x2c2dce={};_0x2c2dce[_0x894313]={'$like':'%'+_0x57ad22[_0xbe14('0x38')][_0xbe14('0x2c')]+'%'};return _0x2c2dce;})});}_0x4c2c49=_[_0xbe14('0x4f')]({},_0x4c2c49,_0x57ad22[_0xbe14('0x46')]);return db[_0xbe14('0x66')][_0xbe14('0x22')]({'where':_0x4c2c49[_0xbe14('0x43')]})[_0xbe14('0x26')](function(_0x151680){_0x59779a['count']=_0x151680;if(_0x57ad22[_0xbe14('0x38')][_0xbe14('0x4e')]){_0x4c2c49[_0xbe14('0x47')]=[{'all':!![]}];}return db[_0xbe14('0x66')][_0xbe14('0x49')](_0x4c2c49);})[_0xbe14('0x26')](function(_0x52b75d){_0x59779a['rows']=_0x52b75d;return _0x59779a;});}})[_0xbe14('0x26')](respondWithFilteredResult(_0x1ee918,_0x4c2c49))['catch'](handleError(_0x1ee918,null));};exports[_0xbe14('0x67')]=function(_0x4babba,_0x2408c6,_0x59000b){var _0x11aa49={'raw':!![],'where':{}};var _0x2d3727={};var _0x278184={'count':0x0,'rows':[]};return db[_0xbe14('0x48')][_0xbe14('0x5f')]({'where':{'id':_0x4babba[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x2408c6,null))[_0xbe14('0x26')](function(_0xf66372){if(_0xf66372){_0x2d3727['model']=_[_0xbe14('0x39')](db[_0xbe14('0x68')][_0xbe14('0x4d')]);_0x2d3727[_0xbe14('0x38')]=_['keys'](_0x4babba[_0xbe14('0x38')]);_0x2d3727['filters']=_[_0xbe14('0x3b')](_0x2d3727['model'],_0x2d3727[_0xbe14('0x38')]);_0x11aa49[_0xbe14('0x3c')]=_[_0xbe14('0x3b')](_0x2d3727['model'],qs[_0xbe14('0x3d')](_0x4babba['query'][_0xbe14('0x3d')]));_0x11aa49[_0xbe14('0x3c')]=_0x11aa49[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x11aa49[_0xbe14('0x3c')]:_0x2d3727[_0xbe14('0x37')];if(!_0x4babba[_0xbe14('0x38')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x11aa49['limit']=qs[_0xbe14('0x21')](_0x4babba['query'][_0xbe14('0x21')]);_0x11aa49[_0xbe14('0x23')]=qs[_0xbe14('0x23')](_0x4babba['query'][_0xbe14('0x23')]);}_0x11aa49[_0xbe14('0x41')]=qs[_0xbe14('0x42')](_0x4babba[_0xbe14('0x38')][_0xbe14('0x42')]);_0x11aa49['where']=qs['filters'](_[_0xbe14('0x44')](_0x4babba['query'],_0x2d3727[_0xbe14('0x3a')]));_0x11aa49[_0xbe14('0x43')][_0xbe14('0x64')]=_0xf66372['id'];if(_0x4babba[_0xbe14('0x38')]['filter']){_0x11aa49[_0xbe14('0x43')]=_[_0xbe14('0x4f')](_0x11aa49['where'],{'$or':_[_0xbe14('0x2e')](_0x11aa49[_0xbe14('0x3c')],function(_0x54cee8){var _0xc9ab28={};_0xc9ab28[_0x54cee8]={'$like':'%'+_0x4babba['query'][_0xbe14('0x2c')]+'%'};return _0xc9ab28;})});}_0x11aa49=_[_0xbe14('0x4f')]({},_0x11aa49,_0x4babba[_0xbe14('0x46')]);return db[_0xbe14('0x68')][_0xbe14('0x22')]({'where':_0x11aa49[_0xbe14('0x43')]})[_0xbe14('0x26')](function(_0x310d42){_0x278184[_0xbe14('0x22')]=_0x310d42;if(_0x4babba[_0xbe14('0x38')]['includeAll']){_0x11aa49[_0xbe14('0x47')]=[{'all':!![]}];}return db[_0xbe14('0x68')][_0xbe14('0x49')](_0x11aa49);})[_0xbe14('0x26')](function(_0x4d1155){_0x278184[_0xbe14('0x61')]=_0x4d1155;return _0x278184;});}})[_0xbe14('0x26')](respondWithFilteredResult(_0x2408c6,_0x11aa49))[_0xbe14('0x4a')](handleError(_0x2408c6,null));};exports['getTeams']=function(_0x431602,_0x3778e0,_0x1ec868){var _0x1a7321={};var _0x3d328c={};var _0x2306f6;var _0x426189;return db['VoiceQueue'][_0xbe14('0x5f')]({'where':{'id':_0x431602['params']['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x3778e0,null))[_0xbe14('0x26')](function(_0x1aa366){if(_0x1aa366){_0x2306f6=_0x1aa366;_0x3d328c[_0xbe14('0x37')]=_[_0xbe14('0x39')](db['Team']['rawAttributes']);_0x3d328c[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0x431602[_0xbe14('0x38')]);_0x3d328c[_0xbe14('0x3a')]=_['intersection'](_0x3d328c[_0xbe14('0x37')],_0x3d328c[_0xbe14('0x38')]);_0x1a7321[_0xbe14('0x3c')]=_['intersection'](_0x3d328c[_0xbe14('0x37')],qs['fields'](_0x431602['query'][_0xbe14('0x3d')]));_0x1a7321[_0xbe14('0x3c')]=_0x1a7321[_0xbe14('0x3c')]['length']?_0x1a7321[_0xbe14('0x3c')]:_0x3d328c[_0xbe14('0x37')];_0x1a7321['order']=qs[_0xbe14('0x42')](_0x431602[_0xbe14('0x38')][_0xbe14('0x42')]);_0x1a7321['where']=qs[_0xbe14('0x3a')](_[_0xbe14('0x44')](_0x431602[_0xbe14('0x38')],_0x3d328c[_0xbe14('0x3a')]));if(_0x431602[_0xbe14('0x38')]['filter']){_0x1a7321[_0xbe14('0x43')]=_[_0xbe14('0x4f')](_0x1a7321[_0xbe14('0x43')],{'$or':_['map'](_0x1a7321[_0xbe14('0x3c')],function(_0x23bf46){var _0x2d93d1={};_0x2d93d1[_0x23bf46]={'$like':'%'+_0x431602[_0xbe14('0x38')][_0xbe14('0x2c')]+'%'};return _0x2d93d1;})});}_0x1a7321=_[_0xbe14('0x4f')]({},_0x1a7321,_0x431602[_0xbe14('0x46')]);return _0x2306f6[_0xbe14('0x69')](_0x1a7321);}})[_0xbe14('0x26')](function(_0x1ca463){if(_0x1ca463){_0x426189=_0x1ca463[_0xbe14('0x3e')];if(!_0x431602['query'][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x1a7321[_0xbe14('0x21')]=qs['limit'](_0x431602[_0xbe14('0x38')][_0xbe14('0x21')]);_0x1a7321[_0xbe14('0x23')]=qs['offset'](_0x431602[_0xbe14('0x38')]['offset']);}return _0x2306f6[_0xbe14('0x69')](_0x1a7321);}})[_0xbe14('0x26')](function(_0x501daa){if(_0x501daa){return _0x501daa?{'count':_0x426189,'rows':_0x501daa}:null;}})[_0xbe14('0x26')](respondWithResult(_0x3778e0,null))[_0xbe14('0x4a')](handleError(_0x3778e0,null));};exports['addTeams']=function(_0x193cf7,_0x1e1540,_0x133ae9){var _0x27c892=_0x193cf7[_0xbe14('0x5c')][_0xbe14('0x6a')];var _0x5bcd4a=_['map'](_0x27c892,'id');return db[_0xbe14('0x6b')][_0xbe14('0x49')]({'where':{'id':_0x5bcd4a},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6c')],'as':_0xbe14('0x6d'),'attributes':['id','name',_0xbe14('0x6e'),'voicePause',_0xbe14('0x6f')],'raw':!![]}]})[_0xbe14('0x26')](function(_0x5270b2){if(_0x5270b2){var _0x141449=_[_0xbe14('0x70')](_0x5270b2,function(_0x255c18){var _0x1f06ec=_0x255c18[_0xbe14('0x28')]({'plain':!![]});_0x1f06ec[_0xbe14('0x6d')][_0xbe14('0x71')](function(_0x8625bb){_0x8625bb[_0xbe14('0x72')]=_[_0xbe14('0x32')](_0x27c892,{'id':_0x1f06ec['id']})[_0xbe14('0x72')];});return _0x1f06ec[_0xbe14('0x6d')];});return db['VoiceQueue'][_0xbe14('0x32')]({'where':{'id':_0x193cf7[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](function(_0x4087b6){return db['sequelize'][_0xbe14('0x73')](function(_0xede1c1){return _0x4087b6['addTeams'](_0x5bcd4a,{'transaction':_0xede1c1})[_0xbe14('0x26')](function(){return BPromise[_0xbe14('0x74')](_0x27c892,function(_0x11085c){return db['TeamVoiceQueue'][_0xbe14('0x75')]({'TeamId':_0x11085c['id'],'VoiceQueueId':_0x193cf7[_0xbe14('0x4c')]['id'],'penalty':_0x11085c[_0xbe14('0x72')]},{'transaction':_0xede1c1});});})[_0xbe14('0x26')](function(){return BPromise[_0xbe14('0x74')](_0x141449,function(_0x4bffab){return db[_0xbe14('0x76')][_0xbe14('0x77')]({'where':{'UserId':_0x4bffab['id'],'VoiceQueueId':_0x193cf7[_0xbe14('0x4c')]['id']},'defaults':{'penalty':_0x4bffab[_0xbe14('0x72')]},'transaction':_0xede1c1});});})[_0xbe14('0x26')](function(){return BPromise['each'](_[_0xbe14('0x2c')](_0x141449,{'online':!![]}),function(_0x653bf1){return db[_0xbe14('0x78')][_0xbe14('0x75')]({'membername':_0x653bf1[_0xbe14('0x33')],'UserId':_0x653bf1['id'],'queue_name':_0x4087b6[_0xbe14('0x33')],'VoiceQueueId':_0x4087b6['id'],'interface':_[_0xbe14('0x79')](_0x653bf1[_0xbe14('0x6f')])?util['format']('SIP/%s',_0x653bf1[_0xbe14('0x33')]):_0x653bf1[_0xbe14('0x6f')],'paused':_0x653bf1[_0xbe14('0x7a')]||![],'penalty':_0x653bf1[_0xbe14('0x72')]},{'transaction':_0xede1c1});});})[_0xbe14('0x26')](function(){_0x141449['forEach'](function(_0x15c93c){socket[_0xbe14('0x7b')](_0xbe14('0x7c'),{'UserId':_0x15c93c['id'],'VoiceQueueId':_0x4087b6['id']});});});});});}})[_0xbe14('0x26')](respondWithStatusCode(_0x1e1540,null))[_0xbe14('0x4a')](handleError(_0x1e1540,null));};exports[_0xbe14('0x7d')]=function(_0x29611c,_0x472395,_0x54e160){return db[_0xbe14('0x6b')][_0xbe14('0x49')]({'where':{'id':_0x29611c['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x26')](handleEntityNotFound(_0x472395,null))[_0xbe14('0x26')](function(_0x776e93){var _0x3f5ca3=_[_0xbe14('0x2e')](_0x776e93,'id');var _0x4fac13=[];var _0x1f7d96=[];var _0x8e6e79=squel[_0xbe14('0x7e')]();_0x8e6e79[_0xbe14('0x7f')](_0xbe14('0x80'))[_0xbe14('0x81')]('team_has_voice_queues','tq')['join'](_0xbe14('0x82'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x43')](_0xbe14('0x83'),_0x29611c[_0xbe14('0x4c')]['id']);for(var _0x5edd44=0x0;_0x5edd44<_0x776e93[_0xbe14('0x3e')];_0x5edd44+=0x1){let _0x2a090=_0x776e93[_0x5edd44];for(var _0x294a04=0x0;_0x294a04<_0x2a090[_0xbe14('0x6d')][_0xbe14('0x3e')];_0x294a04+=0x1){let _0x2e5106=_0x2a090[_0xbe14('0x6d')][_0x294a04];var _0x513b6f=_0x8e6e79[_0xbe14('0x58')]();_0x513b6f['where']('ut.UserId\x20=\x20?',_0x2e5106['id']);_0x1f7d96['push'](db['sequelize'][_0xbe14('0x38')](_0x513b6f[_0xbe14('0x84')](),{'type':db['sequelize'][_0xbe14('0x85')]['SELECT']})[_0xbe14('0x26')](function(_0x5b0fc7){if(_0x5b0fc7[_0xbe14('0x3e')]===0x1){return _0x2e5106['id'];}else{var _0x1c1e32=_[_0xbe14('0x86')](_[_0xbe14('0x2e')](_0x5b0fc7,_0xbe14('0x87')),function(_0x5b3cfc){return _[_0xbe14('0x30')](_0x3f5ca3,_0x5b3cfc);});if(_0x1c1e32){return _0x2e5106['id'];}}}));}}return BPromise[_0xbe14('0x88')](_0x1f7d96)[_0xbe14('0x26')](function(_0x413893){_0x4fac13=_(_0x4fac13)['union'](_0x413893)['compact']()['value']();return db[_0xbe14('0x48')][_0xbe14('0x32')]({'where':{'id':_0x29611c[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](function(_0x241701){return db['sequelize']['transaction'](function(_0x295c4f){return _0x241701[_0xbe14('0x7d')](_0x29611c[_0xbe14('0x38')][_0xbe14('0x89')],{'transaction':_0x295c4f})[_0xbe14('0x26')](function(){if(!_['isEmpty'](_0x4fac13)){return _0x241701[_0xbe14('0x8a')](_0x4fac13,{'transaction':_0x295c4f})['then'](function(){return db[_0xbe14('0x78')][_0xbe14('0x27')]({'where':{'VoiceQueueId':_0x29611c[_0xbe14('0x4c')]['id'],'UserId':_0x4fac13},'transaction':_0x295c4f});});}})[_0xbe14('0x26')](function(){_0x4fac13['forEach'](function(_0x3eefa0){socket[_0xbe14('0x7b')](_0xbe14('0x8b'),{'UserId':_0x3eefa0,'VoiceQueueId':_0x241701['id']});});});});});});})[_0xbe14('0x26')](respondWithStatusCode(_0x472395,null))['catch'](handleError(_0x472395,null));};exports[_0xbe14('0x8c')]=function(_0x244e38,_0x1707c1,_0x4e682e){var _0x4e3898,_0x2ff5b6;return db[_0xbe14('0x48')][_0xbe14('0x32')]({'where':{'id':_0x244e38['params']['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x1707c1,null))[_0xbe14('0x26')](function(_0x180e61){if(_0x180e61){_0x2ff5b6=_0x180e61;return _0x180e61[_0xbe14('0x8c')](_0x244e38[_0xbe14('0x5c')][_0xbe14('0x89')],_['omit'](_0x244e38[_0xbe14('0x5c')],[_0xbe14('0x89'),'id'])||{})[_0xbe14('0x8d')](function(_0x240d4f){for(var _0x38ea63=0x0;_0x38ea63<_0x244e38['body']['ids'][_0xbe14('0x3e')];_0x38ea63+=0x1){socket['emit'](_0xbe14('0x7c'),{'UserId':Number(_0x244e38['body'][_0xbe14('0x89')][_0x38ea63]),'VoiceQueueId':Number(_0x244e38[_0xbe14('0x4c')]['id'])});}return _0x240d4f;});}})[_0xbe14('0x26')](function(_0x4f3d43){_0x4e3898=_0x4f3d43||[];if(_0x2ff5b6){return db[_0xbe14('0x6c')][_0xbe14('0x49')]({'where':{'id':_0x244e38[_0xbe14('0x5c')][_0xbe14('0x89')]},'attributes':['id',_0xbe14('0x33'),_0xbe14('0x6e'),_0xbe14('0x7a'),_0xbe14('0x6f')],'raw':!![]});}})[_0xbe14('0x26')](function(_0x1ab39b){if(!_['isEmpty'](_0x1ab39b)){var _0x1f1fb9=[];for(var _0x306bbc=0x0;_0x306bbc<_0x1ab39b[_0xbe14('0x3e')];_0x306bbc++){if(_0x1ab39b[_0x306bbc][_0xbe14('0x6e')]){_0x1f1fb9[_0xbe14('0x8e')](db[_0xbe14('0x78')][_0xbe14('0x75')]({'membername':_0x1ab39b[_0x306bbc][_0xbe14('0x33')],'UserId':_0x1ab39b[_0x306bbc]['id'],'queue_name':_0x2ff5b6['name'],'VoiceQueueId':_0x2ff5b6['id'],'interface':_[_0xbe14('0x79')](_0x1ab39b[_0x306bbc][_0xbe14('0x6f')])?util[_0xbe14('0x8f')](_0xbe14('0x90'),_0x1ab39b[_0x306bbc][_0xbe14('0x33')]):_0x1ab39b[_0x306bbc][_0xbe14('0x6f')],'paused':_0x1ab39b[_0x306bbc]['voicePause']||![],'penalty':_0x244e38['body']['penalty']||0x0}));}}return BPromise['all'](_0x1f1fb9);}})[_0xbe14('0x26')](function(){return _0x4e3898;})[_0xbe14('0x26')](respondWithResult(_0x1707c1,null))['catch'](handleError(_0x1707c1,null));};exports[_0xbe14('0x8a')]=function(_0x4868ae,_0x22da6c,_0x399b28){return db[_0xbe14('0x48')][_0xbe14('0x32')]({'where':{'id':_0x4868ae[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x22da6c,null))['then'](function(_0x3d87ba){if(_0x3d87ba){return _0x3d87ba[_0xbe14('0x8a')](_0x4868ae[_0xbe14('0x38')][_0xbe14('0x89')])[_0xbe14('0x26')](function(){if(_[_0xbe14('0x91')](_0x4868ae[_0xbe14('0x38')][_0xbe14('0x89')])){for(var _0x3046de=0x0;_0x3046de<_0x4868ae['query'][_0xbe14('0x89')]['length'];_0x3046de+=0x1){socket[_0xbe14('0x7b')]('userVoiceQueue:remove',{'UserId':Number(_0x4868ae['query'][_0xbe14('0x89')][_0x3046de]),'VoiceQueueId':Number(_0x4868ae[_0xbe14('0x4c')]['id'])});}}else{socket[_0xbe14('0x7b')]('userVoiceQueue:remove',{'UserId':Number(_0x4868ae[_0xbe14('0x38')]['ids']),'VoiceQueueId':Number(_0x4868ae[_0xbe14('0x4c')]['id'])});}});}})['then'](function(_0x25feeb){return db[_0xbe14('0x78')][_0xbe14('0x27')]({'where':{'VoiceQueueId':_0x4868ae[_0xbe14('0x4c')]['id'],'UserId':_0x4868ae[_0xbe14('0x38')][_0xbe14('0x89')]}})['then'](function(){return _0x25feeb;});})[_0xbe14('0x26')](respondWithStatusCode(_0x22da6c,null))[_0xbe14('0x4a')](handleError(_0x22da6c,null));};exports['getAgents']=function(_0x52cdfd,_0x542990,_0x36aa68){var _0x40ef0a={};var _0x457f84={};var _0x3e3aba;var _0x1a8997;return db[_0xbe14('0x48')][_0xbe14('0x5f')]({'where':{'id':_0x52cdfd['params']['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x542990,null))[_0xbe14('0x26')](function(_0xa44e38){if(_0xa44e38){_0x3e3aba=_0xa44e38;_0x457f84['model']=_[_0xbe14('0x39')](db[_0xbe14('0x6c')][_0xbe14('0x4d')]);_0x457f84['query']=_['keys'](_0x52cdfd[_0xbe14('0x38')]);_0x457f84['filters']=_[_0xbe14('0x3b')](_0x457f84[_0xbe14('0x37')],_0x457f84[_0xbe14('0x38')]);_0x40ef0a[_0xbe14('0x3c')]=_[_0xbe14('0x3b')](_0x457f84[_0xbe14('0x37')],qs['fields'](_0x52cdfd[_0xbe14('0x38')]['fields']));_0x40ef0a[_0xbe14('0x3c')]=_0x40ef0a[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x40ef0a['attributes']:_0x457f84[_0xbe14('0x37')];_0x40ef0a[_0xbe14('0x41')]=qs['sort'](_0x52cdfd['query'][_0xbe14('0x42')]);_0x40ef0a[_0xbe14('0x43')]=qs[_0xbe14('0x3a')](_['pick'](_0x52cdfd[_0xbe14('0x38')],_0x457f84[_0xbe14('0x3a')]));if(_0x52cdfd['query']['filter']){_0x40ef0a['where']=_['merge'](_0x40ef0a[_0xbe14('0x43')],{'$or':_[_0xbe14('0x2e')](_0x40ef0a['attributes'],function(_0x53be9d){var _0x19c2be={};_0x19c2be[_0x53be9d]={'$like':'%'+_0x52cdfd[_0xbe14('0x38')][_0xbe14('0x2c')]+'%'};return _0x19c2be;})});}_0x40ef0a=_['merge']({},_0x40ef0a,_0x52cdfd[_0xbe14('0x46')]);return _0x3e3aba[_0xbe14('0x92')](_0x40ef0a);}})[_0xbe14('0x26')](function(_0x416c65){if(_0x416c65){_0x1a8997=_0x416c65['length'];if(!_0x52cdfd[_0xbe14('0x38')][_0xbe14('0x3f')]('nolimit')){_0x40ef0a[_0xbe14('0x21')]=qs[_0xbe14('0x21')](_0x52cdfd[_0xbe14('0x38')][_0xbe14('0x21')]);_0x40ef0a[_0xbe14('0x23')]=qs['offset'](_0x52cdfd['query'][_0xbe14('0x23')]);}return _0x3e3aba[_0xbe14('0x92')](_0x40ef0a);}})[_0xbe14('0x26')](function(_0x351a86){if(_0x351a86){return _0x351a86?{'count':_0x1a8997,'rows':_0x351a86}:null;}})['then'](respondWithResult(_0x542990,null))[_0xbe14('0x4a')](handleError(_0x542990,null));};exports[_0xbe14('0x93')]=function(_0x56739b,_0x3305a0,_0x528534){var _0xbb8c98={};var _0x307f09={};var _0x55a5f1;var _0x2167bc;return db[_0xbe14('0x48')][_0xbe14('0x5f')]({'where':{'id':_0x56739b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x3305a0,null))[_0xbe14('0x26')](function(_0x738a20){if(_0x738a20){_0x55a5f1=_0x738a20;_0x307f09[_0xbe14('0x37')]=_['keys'](db[_0xbe14('0x78')][_0xbe14('0x4d')]);_0x307f09[_0xbe14('0x38')]=_['keys'](_0x56739b['query']);_0x307f09['filters']=_[_0xbe14('0x3b')](_0x307f09[_0xbe14('0x37')],_0x307f09[_0xbe14('0x38')]);_0xbb8c98['attributes']=_['intersection'](_0x307f09[_0xbe14('0x37')],qs[_0xbe14('0x3d')](_0x56739b[_0xbe14('0x38')][_0xbe14('0x3d')]));_0xbb8c98[_0xbe14('0x3c')]=_0xbb8c98[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0xbb8c98[_0xbe14('0x3c')]:_0x307f09[_0xbe14('0x37')];_0xbb8c98['order']=qs[_0xbe14('0x42')](_0x56739b[_0xbe14('0x38')][_0xbe14('0x42')]);_0xbb8c98[_0xbe14('0x43')]=qs[_0xbe14('0x3a')](_['pick'](_0x56739b[_0xbe14('0x38')],_0x307f09['filters']));if(_0x56739b['query'][_0xbe14('0x2c')]){_0xbb8c98[_0xbe14('0x43')]=_['merge'](_0xbb8c98['where'],{'$or':_[_0xbe14('0x2e')](_0xbb8c98[_0xbe14('0x3c')],function(_0x3421d1){var _0x407edd={};_0x407edd[_0x3421d1]={'$like':'%'+_0x56739b[_0xbe14('0x38')]['filter']+'%'};return _0x407edd;})});}_0xbb8c98=_['merge']({},_0xbb8c98,_0x56739b[_0xbe14('0x46')]);return _0x55a5f1['getMembers'](_0xbb8c98);}})[_0xbe14('0x26')](function(_0x3f687f){if(_0x3f687f){_0x2167bc=_0x3f687f['length'];if(!_0x56739b['query']['hasOwnProperty'](_0xbe14('0x40'))){_0xbb8c98['limit']=qs[_0xbe14('0x21')](_0x56739b[_0xbe14('0x38')]['limit']);_0xbb8c98[_0xbe14('0x23')]=qs[_0xbe14('0x23')](_0x56739b[_0xbe14('0x38')][_0xbe14('0x23')]);}return _0x55a5f1[_0xbe14('0x93')](_0xbb8c98);}})['then'](function(_0x1ad65c){return _0x1ad65c?{'count':_0x2167bc,'rows':_0x1ad65c}:null;})[_0xbe14('0x26')](respondWithResult(_0x3305a0,null))[_0xbe14('0x4a')](handleError(_0x3305a0,null));};exports[_0xbe14('0x94')]=function(_0x15082b,_0x5d15c7,_0x66b6a7){var _0x2b8f47={};var _0x4dfe2c={};var _0x2b7f3a;var _0x527530;return db[_0xbe14('0x48')][_0xbe14('0x5f')]({'where':{'id':_0x15082b[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x5d15c7,null))[_0xbe14('0x26')](function(_0xccd68a){if(_0xccd68a){_0x2b7f3a=_0xccd68a;_0x4dfe2c['model']=_[_0xbe14('0x39')](db[_0xbe14('0x95')][_0xbe14('0x4d')]);_0x4dfe2c[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0x15082b[_0xbe14('0x38')]);_0x4dfe2c[_0xbe14('0x3a')]=_[_0xbe14('0x3b')](_0x4dfe2c[_0xbe14('0x37')],_0x4dfe2c[_0xbe14('0x38')]);_0x2b8f47['attributes']=_[_0xbe14('0x3b')](_0x4dfe2c[_0xbe14('0x37')],qs['fields'](_0x15082b[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x2b8f47[_0xbe14('0x3c')]=_0x2b8f47[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x2b8f47[_0xbe14('0x3c')]:_0x4dfe2c[_0xbe14('0x37')];_0x2b8f47[_0xbe14('0x41')]=qs['sort'](_0x15082b[_0xbe14('0x38')]['sort']);_0x2b8f47[_0xbe14('0x43')]=qs[_0xbe14('0x3a')](_[_0xbe14('0x44')](_0x15082b[_0xbe14('0x38')],_0x4dfe2c[_0xbe14('0x3a')]));if(_0x15082b[_0xbe14('0x38')][_0xbe14('0x2c')]){_0x2b8f47['where']=_['merge'](_0x2b8f47['where'],{'$or':_[_0xbe14('0x2e')](_0x2b8f47[_0xbe14('0x3c')],function(_0x5ec56b){var _0x39444d={};_0x39444d[_0x5ec56b]={'$like':'%'+_0x15082b[_0xbe14('0x38')][_0xbe14('0x2c')]+'%'};return _0x39444d;})});}_0x2b8f47=_[_0xbe14('0x4f')]({},_0x2b8f47,_0x15082b[_0xbe14('0x46')]);return _0x2b7f3a[_0xbe14('0x94')](_0x2b8f47);}})[_0xbe14('0x26')](function(_0x1d59d5){if(_0x1d59d5){_0x527530=_0x1d59d5[_0xbe14('0x3e')];if(!_0x15082b[_0xbe14('0x38')][_0xbe14('0x3f')]('nolimit')){_0x2b8f47[_0xbe14('0x21')]=qs['limit'](_0x15082b[_0xbe14('0x38')][_0xbe14('0x21')]);_0x2b8f47[_0xbe14('0x23')]=qs['offset'](_0x15082b[_0xbe14('0x38')][_0xbe14('0x23')]);}return _0x2b7f3a['getLists'](_0x2b8f47);}})[_0xbe14('0x26')](function(_0x226d20){if(_0x226d20){return _0x226d20?{'count':_0x527530,'rows':_0x226d20}:null;}})[_0xbe14('0x26')](respondWithResult(_0x5d15c7,null))['catch'](handleError(_0x5d15c7,null));};exports[_0xbe14('0x96')]=function(_0x25e6e0,_0x55a52f,_0x3ef39a){var _0x514cf6=moment()[_0xbe14('0x8f')](_0xbe14('0x97'));var _0x471fbf,_0x1ec37d;return db['VoiceQueue']['find']({'where':{'id':_0x25e6e0[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x55a52f,null))['then'](function(_0x5138e2){if(_0x5138e2){_0x1ec37d=_0x5138e2;return _0x5138e2[_0xbe14('0x96')](_0x25e6e0['body'][_0xbe14('0x89')],_[_0xbe14('0x59')](_0x25e6e0[_0xbe14('0x5c')],[_0xbe14('0x89'),'id'])||{});}return null;})[_0xbe14('0x8d')](function(_0x32d16e){var _0x43b937;_0x471fbf=_0x32d16e||[];var _0x1be7dc=[];if(_0x32d16e){for(var _0x339611=0x0;_0x339611<_0x32d16e[_0xbe14('0x3e')];_0x339611+=0x1){var _0x4958a4=_0x32d16e[_0x339611]['get']({'plain':!![]});_0x1ec37d['dialCheckDuplicateType']=_0x25e6e0[_0xbe14('0x5c')][_0xbe14('0x98')]?_0x25e6e0[_0xbe14('0x5c')][_0xbe14('0x98')]:_0x1ec37d[_0xbe14('0x98')];switch(_0x1ec37d[_0xbe14('0x98')]){case _0xbe14('0x99'):_0x43b937=squel[_0xbe14('0x9a')]()[_0xbe14('0x9b')]('cm_hopper')[_0xbe14('0x9c')]([_0xbe14('0x9d'),_0xbe14('0x9e'),'ContactId',_0xbe14('0x9f'),_0xbe14('0x64'),_0xbe14('0x5a'),_0xbe14('0x5b')],squel[_0xbe14('0x7e')]()[_0xbe14('0x7f')](_0xbe14('0x9d'),'phone')[_0xbe14('0x7f')]('\x27'+_0x514cf6+'\x27',_0xbe14('0x9e'))['field']('id','ContactId')[_0xbe14('0x7f')](_0x4958a4[_0xbe14('0xa0')][_0xbe14('0x84')](),'ListId')[_0xbe14('0x7f')](_0x25e6e0[_0xbe14('0x4c')]['id'][_0xbe14('0x84')](),_0xbe14('0x64'))[_0xbe14('0x7f')]('\x27'+_0x514cf6+'\x27',_0xbe14('0x5a'))['field']('\x27'+_0x514cf6+'\x27',_0xbe14('0x5b'))['from'](_0xbe14('0xa1'))[_0xbe14('0x43')](_0xbe14('0xa2'))['where'](_0xbe14('0xa3'),_0x4958a4[_0xbe14('0xa0')]['toString']())[_0xbe14('0x43')]('phone\x20IS\x20NOT\x20NULL')[_0xbe14('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbe14('0x7e')]()['field'](_0xbe14('0xa4'))[_0xbe14('0x81')](_0xbe14('0xa5'))[_0xbe14('0x43')](_0xbe14('0x83'),_0x25e6e0['params']['id'][_0xbe14('0x84')]()))[_0xbe14('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0xbe14('0x7e')]()[_0xbe14('0x7f')]('COALESCE(phone,\x27\x27)')[_0xbe14('0x81')](_0xbe14('0xa6'))[_0xbe14('0x43')]('VoiceQueueId\x20=\x20?',_0x25e6e0[_0xbe14('0x4c')]['id'][_0xbe14('0x84')]())))[_0xbe14('0x84')]();break;case _0xbe14('0xa7'):_0x43b937=squel['insert']()[_0xbe14('0x9b')](_0xbe14('0xa6'))[_0xbe14('0x9c')]([_0xbe14('0x9d'),_0xbe14('0x9e'),_0xbe14('0xa8'),_0xbe14('0x9f'),_0xbe14('0x64'),_0xbe14('0x5a'),'updatedAt'],squel[_0xbe14('0x7e')]()['field']('phone',_0xbe14('0x9d'))[_0xbe14('0x7f')]('\x27'+_0x514cf6+'\x27','scheduledAt')[_0xbe14('0x7f')]('id',_0xbe14('0xa8'))['field'](_0x4958a4[_0xbe14('0xa0')][_0xbe14('0x84')](),_0xbe14('0x9f'))[_0xbe14('0x7f')](_0x25e6e0[_0xbe14('0x4c')]['id'][_0xbe14('0x84')](),'VoiceQueueId')['field']('\x27'+_0x514cf6+'\x27',_0xbe14('0x5a'))['field']('\x27'+_0x514cf6+'\x27',_0xbe14('0x5b'))[_0xbe14('0x81')]('cm_contacts')[_0xbe14('0x43')](_0xbe14('0xa2'))[_0xbe14('0x43')](_0xbe14('0xa3'),_0x4958a4[_0xbe14('0xa0')][_0xbe14('0x84')]())[_0xbe14('0x43')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xbe14('0xa9'),squel[_0xbe14('0x7e')]()[_0xbe14('0x7f')](_0xbe14('0xaa'))[_0xbe14('0x81')](_0xbe14('0xa6'))[_0xbe14('0x43')](_0xbe14('0x83'),_0x25e6e0['params']['id'][_0xbe14('0x84')]())))[_0xbe14('0x84')]();break;default:_0x43b937=squel[_0xbe14('0x9a')]()['into'](_0xbe14('0xa6'))[_0xbe14('0x9c')]([_0xbe14('0x9d'),_0xbe14('0x9e'),_0xbe14('0xa8'),'ListId',_0xbe14('0x64'),_0xbe14('0x5a'),'updatedAt'],squel[_0xbe14('0x7e')]()[_0xbe14('0x7f')](_0xbe14('0x9d'),'phone')[_0xbe14('0x7f')]('\x27'+_0x514cf6+'\x27',_0xbe14('0x9e'))[_0xbe14('0x7f')]('id','ContactId')[_0xbe14('0x7f')](_0x4958a4[_0xbe14('0xa0')]['toString'](),_0xbe14('0x9f'))[_0xbe14('0x7f')](_0x25e6e0[_0xbe14('0x4c')]['id']['toString'](),_0xbe14('0x64'))[_0xbe14('0x7f')]('\x27'+_0x514cf6+'\x27',_0xbe14('0x5a'))[_0xbe14('0x7f')]('\x27'+_0x514cf6+'\x27',_0xbe14('0x5b'))[_0xbe14('0x81')](_0xbe14('0xa1'))[_0xbe14('0x43')]('deletedAt\x20IS\x20NULL')[_0xbe14('0x43')](_0xbe14('0xa3'),_0x4958a4[_0xbe14('0xa0')][_0xbe14('0x84')]())[_0xbe14('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0xbe14('0x84')]();}_0x1be7dc[_0xbe14('0x8e')](db[_0xbe14('0xab')][_0xbe14('0x38')](_0x43b937));}return BPromise[_0xbe14('0x88')](_0x1be7dc);}})[_0xbe14('0x26')](function(){var _0x5f3b6a=[];var _0x4f4944=squel['insert']()[_0xbe14('0x9b')](_0xbe14('0xac'))['fromQuery']([_0xbe14('0xad'),_0xbe14('0x9d'),_0xbe14('0xae'),_0xbe14('0x5a'),'updatedAt'],squel[_0xbe14('0x7e')]()[_0xbe14('0x7f')]('h.id')[_0xbe14('0x7f')]('ci.item')['field'](_0xbe14('0xaf'))[_0xbe14('0x7f')]('\x27'+_0x514cf6+'\x27',_0xbe14('0x5a'))[_0xbe14('0x7f')]('\x27'+_0x514cf6+'\x27','updatedAt')[_0xbe14('0x81')](_0xbe14('0xb0'),'ci')[_0xbe14('0xb1')](_0xbe14('0xa6'),'h','h.ContactId=ci.CmContactId')[_0xbe14('0x43')](_0xbe14('0xb2'),_0x514cf6)[_0xbe14('0x43')](_0xbe14('0xb3'),_0xbe14('0xb4')))[_0xbe14('0x84')]();_0x5f3b6a[_0xbe14('0x8e')](db[_0xbe14('0xab')]['query'](_0x4f4944));return BPromise[_0xbe14('0x88')](_0x5f3b6a);})[_0xbe14('0x26')](function(){return _0x471fbf;})['then'](respondWithResult(_0x55a52f,null))['catch'](handleError(_0x55a52f,null));};exports[_0xbe14('0xb5')]=function(_0x3d04b9,_0x21f793,_0x1c4d28){return db[_0xbe14('0x48')][_0xbe14('0x32')]({'where':{'id':_0x3d04b9['params']['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x21f793,null))[_0xbe14('0x26')](function(_0x4f4cea){if(_0x4f4cea){return _0x4f4cea[_0xbe14('0xb5')](_0x3d04b9[_0xbe14('0x38')][_0xbe14('0x89')]);}})[_0xbe14('0x26')](function(_0xf83660){if(_0xf83660){return db[_0xbe14('0x60')][_0xbe14('0x27')]({'where':{'ListId':_0x3d04b9['query'][_0xbe14('0x89')],'VoiceQueueId':_0x3d04b9[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](function(){return _0xf83660;});}})[_0xbe14('0x26')](respondWithStatusCode(_0x21f793,null))[_0xbe14('0x4a')](handleError(_0x21f793,null));};exports[_0xbe14('0xb6')]=function(_0x34aad6,_0x3ca4ac,_0x5eaaf4){var _0x1bf69c={};var _0x43c96d={};var _0x21a273;var _0x4c7833;return db[_0xbe14('0x48')][_0xbe14('0x5f')]({'where':{'id':_0x34aad6[_0xbe14('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3ca4ac,null))[_0xbe14('0x26')](function(_0x592d71){if(_0x592d71){_0x21a273=_0x592d71;_0x43c96d[_0xbe14('0x37')]=_[_0xbe14('0x39')](db[_0xbe14('0x95')][_0xbe14('0x4d')]);_0x43c96d[_0xbe14('0x38')]=_[_0xbe14('0x39')](_0x34aad6[_0xbe14('0x38')]);_0x43c96d['filters']=_[_0xbe14('0x3b')](_0x43c96d[_0xbe14('0x37')],_0x43c96d[_0xbe14('0x38')]);_0x1bf69c[_0xbe14('0x3c')]=_[_0xbe14('0x3b')](_0x43c96d[_0xbe14('0x37')],qs[_0xbe14('0x3d')](_0x34aad6['query'][_0xbe14('0x3d')]));_0x1bf69c[_0xbe14('0x3c')]=_0x1bf69c[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x1bf69c[_0xbe14('0x3c')]:_0x43c96d[_0xbe14('0x37')];_0x1bf69c[_0xbe14('0x41')]=qs[_0xbe14('0x42')](_0x34aad6[_0xbe14('0x38')][_0xbe14('0x42')]);_0x1bf69c[_0xbe14('0x43')]=qs[_0xbe14('0x3a')](_['pick'](_0x34aad6[_0xbe14('0x38')],_0x43c96d[_0xbe14('0x3a')]));if(_0x34aad6['query']['filter']){_0x1bf69c[_0xbe14('0x43')]=_[_0xbe14('0x4f')](_0x1bf69c[_0xbe14('0x43')],{'$or':_[_0xbe14('0x2e')](_0x1bf69c[_0xbe14('0x3c')],function(_0x294285){var _0x29f2cd={};_0x29f2cd[_0x294285]={'$like':'%'+_0x34aad6[_0xbe14('0x38')]['filter']+'%'};return _0x29f2cd;})});}_0x1bf69c=_[_0xbe14('0x4f')]({},_0x1bf69c,_0x34aad6['options']);return _0x21a273[_0xbe14('0xb6')](_0x1bf69c);}})[_0xbe14('0x26')](function(_0x2940d2){if(_0x2940d2){_0x4c7833=_0x2940d2[_0xbe14('0x3e')];if(!_0x34aad6[_0xbe14('0x38')][_0xbe14('0x3f')]('nolimit')){_0x1bf69c['limit']=qs['limit'](_0x34aad6['query']['limit']);_0x1bf69c[_0xbe14('0x23')]=qs[_0xbe14('0x23')](_0x34aad6['query']['offset']);}return _0x21a273[_0xbe14('0xb6')](_0x1bf69c);}})[_0xbe14('0x26')](function(_0x3e12d5){if(_0x3e12d5){return _0x3e12d5?{'count':_0x4c7833,'rows':_0x3e12d5}:null;}})[_0xbe14('0x26')](respondWithResult(_0x3ca4ac,null))[_0xbe14('0x4a')](handleError(_0x3ca4ac,null));};exports[_0xbe14('0xb7')]=function(_0x3c7ccd,_0x25eadb,_0x59a5d3){var _0x298907,_0x4b249c;return db[_0xbe14('0x48')][_0xbe14('0x32')]({'where':{'id':_0x3c7ccd[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x25eadb,null))[_0xbe14('0x26')](function(_0x6965ae){if(_0x6965ae){_0x4b249c=_0x6965ae;return _0x6965ae[_0xbe14('0xb7')](_0x3c7ccd[_0xbe14('0x5c')][_0xbe14('0x89')],_[_0xbe14('0x59')](_0x3c7ccd[_0xbe14('0x5c')],['ids','id'])||{});}return null;})[_0xbe14('0x8d')](function(_0x371610){var _0x44f08d;_0x298907=_0x371610||[];var _0x9e896=[];if(_0x371610){for(var _0x241ee1=0x0;_0x241ee1<_0x371610['length'];_0x241ee1+=0x1){var _0x5c0b89=_0x371610[_0x241ee1][_0xbe14('0x28')]({'plain':!![]});_0x44f08d=squel['insert']()['into'](_0xbe14('0xb8'))['fromQuery']([_0xbe14('0x9d'),_0xbe14('0xa8'),'ListId',_0xbe14('0x64'),'createdAt',_0xbe14('0x5b')],squel['select']()[_0xbe14('0x7f')](_0xbe14('0x9d'),_0xbe14('0x9d'))[_0xbe14('0x7f')]('id',_0xbe14('0xa8'))[_0xbe14('0x7f')](_0x5c0b89['CmListId']['toString'](),_0xbe14('0x9f'))[_0xbe14('0x7f')](_0x3c7ccd[_0xbe14('0x4c')]['id'][_0xbe14('0x84')](),_0xbe14('0x64'))[_0xbe14('0x7f')](_0xbe14('0xb9'),_0xbe14('0x5a'))[_0xbe14('0x7f')](_0xbe14('0xb9'),_0xbe14('0x5b'))['from'](_0xbe14('0xa1'))[_0xbe14('0x43')](_0xbe14('0xa2'))[_0xbe14('0x43')](_0xbe14('0xa3'),_0x5c0b89[_0xbe14('0xa0')][_0xbe14('0x84')]())[_0xbe14('0x43')](_0xbe14('0xba')))[_0xbe14('0x84')]();_0x9e896[_0xbe14('0x8e')](db[_0xbe14('0xab')]['query'](_0x44f08d));}return BPromise['all'](_0x9e896);}})['then'](function(){return _0x298907;})[_0xbe14('0x26')](respondWithResult(_0x25eadb,null))[_0xbe14('0x4a')](handleError(_0x25eadb,null));};exports['removeBlackLists']=function(_0x76ede5,_0x18959b,_0x4440dc){return db['VoiceQueue']['find']({'where':{'id':_0x76ede5[_0xbe14('0x4c')]['id']}})[_0xbe14('0x26')](handleEntityNotFound(_0x18959b,null))[_0xbe14('0x26')](function(_0x129f12){if(_0x129f12){return _0x129f12[_0xbe14('0xbb')](_0x76ede5[_0xbe14('0x38')][_0xbe14('0x89')]);}})[_0xbe14('0x26')](function(_0xbaba3e){if(_0xbaba3e){return db['CmHopperBlack'][_0xbe14('0x27')]({'where':{'ListId':_0x76ede5['query'][_0xbe14('0x89')],'VoiceQueueId':_0x76ede5[_0xbe14('0x4c')]['id']}})['then'](function(){return _0xbaba3e;});}})[_0xbe14('0x26')](respondWithStatusCode(_0x18959b,null))[_0xbe14('0x4a')](handleError(_0x18959b,null));}; \ No newline at end of file +var _0xabce=['voicePause','forEach','emit','removeTeams','ids','select','field','from','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','push','sequelize','toString','QueryTypes','SELECT','TeamId','all','union','transaction','removeAgents','userVoiceQueue:remove','addAgents','userVoiceQueue:save','User','online','isEmpty','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','spread','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper','phone\x20IS\x20NOT\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','cm_contact_has_items','h.scheduledat=?','PHONE','removeLists','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','offset','undefined','limit','count','set','json','reject','save','then','destroy','get','inbound','outbound','ignore','map','value','includes','type','find','name','error','stack','send','index','rawAttributes','fieldName','key','query','keys','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','VoiceQueue','includeAll','include','findAll','catch','show','params','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','QueueCampaigns','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','VoiceQueues','update','getHoppers','findOne','CmHopper','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','interface','flatMap','Agents','penalty','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s'];(function(_0x3c0104,_0x1118c2){var _0x59c796=function(_0x4c20a7){while(--_0x4c20a7){_0x3c0104['push'](_0x3c0104['shift']());}};_0x59c796(++_0x1118c2);}(_0xabce,0x103));var _0xeabc=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xabce[_0x5e3b04];return _0x1fc44d;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];config[_0xeabc('0x1a')]=_[_0xeabc('0x1b')](config[_0xeabc('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xeabc('0x1c'))(new Redis(config[_0xeabc('0x1a')]));require(_0xeabc('0x1d'))['register'](socket);function respondWithStatusCode(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xcc;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1e')](_0x3170ea);}return _0x5f4ee8['status'](_0x3170ea)[_0xeabc('0x1f')]();};}function respondWithResult(_0x638976,_0x49f2d8){_0x49f2d8=_0x49f2d8||0xc8;return function(_0x53fe28){if(_0x53fe28){return _0x638976[_0xeabc('0x20')](_0x49f2d8)['json'](_0x53fe28);}};}function respondWithFilteredResult(_0x3d0e21,_0x1b64b9){return function(_0x58a3c0){if(_0x58a3c0){var _0x16f08b=typeof _0x1b64b9[_0xeabc('0x21')]===_0xeabc('0x22')&&typeof _0x1b64b9[_0xeabc('0x23')]===_0xeabc('0x22');var _0x5d92e5=_0x58a3c0[_0xeabc('0x24')];var _0x4d68ea=_0x16f08b?0x0:_0x1b64b9[_0xeabc('0x21')];var _0x16530c=_0x16f08b?_0x58a3c0['count']:_0x1b64b9[_0xeabc('0x21')]+_0x1b64b9[_0xeabc('0x23')];var _0x254590;if(_0x16530c>=_0x5d92e5){_0x16530c=_0x5d92e5;_0x254590=0xc8;}else{_0x254590=0xce;}_0x3d0e21[_0xeabc('0x20')](_0x254590);return _0x3d0e21[_0xeabc('0x25')]('Content-Range',_0x4d68ea+'-'+_0x16530c+'/'+_0x5d92e5)[_0xeabc('0x26')](_0x58a3c0);}return null;};}function patchUpdates(_0x10c675){return function(_0x91ab00){try{jsonpatch['apply'](_0x91ab00,_0x10c675,!![]);}catch(_0x457f27){return BPromise[_0xeabc('0x27')](_0x457f27);}return _0x91ab00[_0xeabc('0x28')]();};}function saveUpdates(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['update'](_0x319119)[_0xeabc('0x29')](function(_0x4d4e29){return _0x4d4e29;});}return null;};}function removeEntity(_0x811f0d,_0x12acbd){return function(_0x269621){if(_0x269621){return _0x269621[_0xeabc('0x2a')]()[_0xeabc('0x29')](function(){var _0x137293=_0x269621[_0xeabc('0x2b')]({'plain':!![]});var _0x4c2693=[{'name':'VoiceQueues','value':_0xeabc('0x2c'),'ignore':![]},{'name':'QueueCampaigns','value':_0xeabc('0x2d'),'ignore':![]}];var _0x2b342c=_(_0x4c2693)['filter'](_0xeabc('0x2e'))[_0xeabc('0x2f')](_0xeabc('0x30'))[_0xeabc('0x30')]();if(_[_0xeabc('0x31')](_0x2b342c,_0x137293[_0xeabc('0x32')])){return;}var _0x2c62fe=_[_0xeabc('0x33')](_0x4c2693,[_0xeabc('0x30'),_0x137293['type']])[_0xeabc('0x34')];return db['UserProfileResource'][_0xeabc('0x2a')]({'where':{'type':_0x2c62fe,'resourceId':_0x137293['id']}})[_0xeabc('0x29')](function(){return _0x269621;});})[_0xeabc('0x29')](function(){_0x811f0d[_0xeabc('0x20')](0xcc)[_0xeabc('0x1f')]();});}};}function handleEntityNotFound(_0x368b8a,_0x61c0af){return function(_0x545d7f){if(!_0x545d7f){_0x368b8a[_0xeabc('0x1e')](0x194);}return _0x545d7f;};}function handleError(_0x2df9e6,_0x3bc45e){_0x3bc45e=_0x3bc45e||0x1f4;return function(_0x4918e2){logger[_0xeabc('0x35')](_0x4918e2[_0xeabc('0x36')]);if(_0x4918e2[_0xeabc('0x34')]){delete _0x4918e2['name'];}_0x2df9e6[_0xeabc('0x20')](_0x3bc45e)[_0xeabc('0x37')](_0x4918e2);};}exports[_0xeabc('0x38')]=function(_0x521091,_0xf98c7c){var _0x286203={},_0x5d9acf={},_0x50cca2={'count':0x0,'rows':[]};var _0x254568=_[_0xeabc('0x2f')](db['VoiceQueue'][_0xeabc('0x39')],function(_0x81976d){return{'name':_0x81976d[_0xeabc('0x3a')],'type':_0x81976d[_0xeabc('0x32')][_0xeabc('0x3b')]};});_0x5d9acf['model']=_[_0xeabc('0x2f')](_0x254568,'name');_0x5d9acf[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x521091[_0xeabc('0x3c')]);_0x5d9acf['filters']=_['intersection'](_0x5d9acf[_0xeabc('0x3e')],_0x5d9acf['query']);_0x286203[_0xeabc('0x3f')]=_['intersection'](_0x5d9acf['model'],qs['fields'](_0x521091['query'][_0xeabc('0x40')]));_0x286203['attributes']=_0x286203[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x286203['attributes']:_0x5d9acf[_0xeabc('0x3e')];if(!_0x521091['query'][_0xeabc('0x42')]('nolimit')){_0x286203[_0xeabc('0x23')]=qs[_0xeabc('0x23')](_0x521091[_0xeabc('0x3c')]['limit']);_0x286203['offset']=qs['offset'](_0x521091[_0xeabc('0x3c')][_0xeabc('0x21')]);}_0x286203[_0xeabc('0x43')]=qs['sort'](_0x521091['query'][_0xeabc('0x44')]);_0x286203[_0xeabc('0x45')]=qs['filters'](_[_0xeabc('0x46')](_0x521091['query'],_0x5d9acf[_0xeabc('0x47')]),_0x254568);if(_0x521091['query']['filter']){_0x286203['where']=_[_0xeabc('0x48')](_0x286203[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x254568,function(_0x3eeeb5){if(_0x3eeeb5['type']!==_0xeabc('0x49')){var _0x555d26={};_0x555d26[_0x3eeeb5[_0xeabc('0x34')]]={'$like':'%'+_0x521091[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x555d26;}})});}_0x286203=_[_0xeabc('0x48')]({},_0x286203,_0x521091[_0xeabc('0x4b')]);var _0x48b988={'where':_0x286203['where']};return db[_0xeabc('0x4c')]['count'](_0x48b988)[_0xeabc('0x29')](function(_0x2cdf59){_0x50cca2['count']=_0x2cdf59;if(_0x521091[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0x286203[_0xeabc('0x4e')]=[{'all':!![]}];}return db[_0xeabc('0x4c')][_0xeabc('0x4f')](_0x286203);})[_0xeabc('0x29')](function(_0x2003a7){_0x50cca2['rows']=_0x2003a7;return _0x50cca2;})[_0xeabc('0x29')](respondWithFilteredResult(_0xf98c7c,_0x286203))[_0xeabc('0x50')](handleError(_0xf98c7c,null));};exports[_0xeabc('0x51')]=function(_0x1b41c8,_0x271f8c){var _0x3fbc97={'raw':![],'where':{'id':_0x1b41c8[_0xeabc('0x52')]['id']}},_0x2107d5={};_0x2107d5[_0xeabc('0x3e')]=_[_0xeabc('0x3d')](db['VoiceQueue'][_0xeabc('0x39')]);_0x2107d5[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x1b41c8[_0xeabc('0x3c')]);_0x2107d5[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x2107d5[_0xeabc('0x3e')],_0x2107d5['query']);_0x3fbc97[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0x2107d5[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x1b41c8[_0xeabc('0x3c')]['fields']));_0x3fbc97[_0xeabc('0x3f')]=_0x3fbc97[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x3fbc97[_0xeabc('0x3f')]:_0x2107d5['model'];if(_0x1b41c8[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0x3fbc97['include']=[{'all':!![]}];}_0x3fbc97=_[_0xeabc('0x48')]({},_0x3fbc97,_0x1b41c8['options']);return db[_0xeabc('0x4c')]['find'](_0x3fbc97)[_0xeabc('0x29')](handleEntityNotFound(_0x271f8c,null))[_0xeabc('0x29')](respondWithResult(_0x271f8c,null))[_0xeabc('0x50')](handleError(_0x271f8c,null));};exports[_0xeabc('0x54')]=function(_0x1ee837,_0x15ba95){return db[_0xeabc('0x4c')][_0xeabc('0x54')](_0x1ee837[_0xeabc('0x55')],{})[_0xeabc('0x29')](function(_0x48a13f){var _0x180a14=_0x1ee837[_0xeabc('0x56')][_0xeabc('0x2b')]({'plain':!![]});if(!_0x180a14)throw new Error(_0xeabc('0x57'));if(_0x180a14['role']===_0xeabc('0x56')){var _0x392913=_0x48a13f[_0xeabc('0x2b')]({'plain':!![]});var _0x21f972=[{'name':'VoiceQueues','value':_0xeabc('0x2c')},{'name':_0xeabc('0x58'),'value':_0xeabc('0x2d')}];var _0xa55cce=_[_0xeabc('0x33')](_0x21f972,[_0xeabc('0x30'),_0x392913[_0xeabc('0x32')]])[_0xeabc('0x34')];return db[_0xeabc('0x59')]['find']({'where':{'name':_0xa55cce,'userProfileId':_0x180a14[_0xeabc('0x5a')]},'raw':!![]})['then'](function(_0x5e09fc){if(_0x5e09fc&&_0x5e09fc['autoAssociation']===0x0){return db[_0xeabc('0x5b')][_0xeabc('0x54')]({'name':_0x392913[_0xeabc('0x34')],'resourceId':_0x392913['id'],'type':_0x5e09fc[_0xeabc('0x34')],'sectionId':_0x5e09fc['id']},{})[_0xeabc('0x29')](function(){return _0x48a13f;});}else{return _0x48a13f;}})[_0xeabc('0x50')](function(_0x4a2ad6){logger[_0xeabc('0x35')](_0xeabc('0x5c'),_0x4a2ad6);throw _0x4a2ad6;});}return _0x48a13f;})[_0xeabc('0x29')](respondWithResult(_0x15ba95,0xc9))[_0xeabc('0x50')](handleError(_0x15ba95,null));};exports[_0xeabc('0x5d')]=function(_0x2c7b4e,_0x1750e9){var _0x25c728={'where':{'id':_0x2c7b4e['params']['id']}},_0x5820ca={};_0x5820ca[_0xeabc('0x3e')]=_[_0xeabc('0x3d')](db[_0xeabc('0x4c')]['rawAttributes']);_0x25c728[_0xeabc('0x3f')]=_['intersection'](_0x5820ca['model'],qs[_0xeabc('0x40')](_0x2c7b4e[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x25c728[_0xeabc('0x3f')]=_0x25c728[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x25c728['attributes']:_0x5820ca[_0xeabc('0x3e')];if(_0x2c7b4e[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0x25c728[_0xeabc('0x4e')]=[{'all':!![]}];}_0x25c728=_[_0xeabc('0x48')]({},_0x25c728,_0x2c7b4e[_0xeabc('0x4b')]);return db['VoiceQueue'][_0xeabc('0x33')](_0x25c728)[_0xeabc('0x29')](handleEntityNotFound(_0x1750e9,null))[_0xeabc('0x29')](function(_0x165899){if(_0x165899){var _0x1b61a8=_0x165899[_0xeabc('0x2b')]({'plain':!![]});_0x1b61a8=qs[_0xeabc('0x5e')](_0x1b61a8,['id',_0xeabc('0x5f'),_0xeabc('0x60')]);_0x2c7b4e['body']=_[_0xeabc('0x5e')](_0x2c7b4e['body'],['id',_0xeabc('0x5f'),_0xeabc('0x60')]);return db[_0xeabc('0x4c')][_0xeabc('0x54')](_[_0xeabc('0x48')](_0x1b61a8,_0x2c7b4e[_0xeabc('0x55')]),{'include':_0x2c7b4e[_0xeabc('0x3c')][_0xeabc('0x4d')]?[{'all':!![]}]:undefined})[_0xeabc('0x29')](function(_0x24d0e5){var _0x5702cb=_0x2c7b4e[_0xeabc('0x56')][_0xeabc('0x2b')]({'plain':!![]});if(!_0x5702cb)throw new Error(_0xeabc('0x57'));if(_0x5702cb[_0xeabc('0x61')]==='user'){var _0x12fd48=_0x24d0e5['get']({'plain':!![]});var _0x54e7d6=[{'name':_0xeabc('0x62'),'value':_0xeabc('0x2c')},{'name':_0xeabc('0x58'),'value':_0xeabc('0x2d')}];var _0x4b7730=_['find'](_0x54e7d6,[_0xeabc('0x30'),_0x12fd48['type']])['name'];return db[_0xeabc('0x59')]['find']({'where':{'name':_0x4b7730,'userProfileId':_0x5702cb['userProfileId']},'raw':!![]})[_0xeabc('0x29')](function(_0x1c84b5){if(_0x1c84b5&&_0x1c84b5['autoAssociation']===0x0){return db['UserProfileResource'][_0xeabc('0x54')]({'name':_0x12fd48['name'],'resourceId':_0x12fd48['id'],'type':_0x1c84b5[_0xeabc('0x34')],'sectionId':_0x1c84b5['id']},{})[_0xeabc('0x29')](function(){return _0x24d0e5;});}else{return _0x24d0e5;}})['catch'](function(_0x5d6477){logger[_0xeabc('0x35')](_0xeabc('0x5c'),_0x5d6477);throw _0x5d6477;});}return _0x24d0e5;});}})[_0xeabc('0x29')](respondWithResult(_0x1750e9,0xc9))[_0xeabc('0x50')](handleError(_0x1750e9,null));};exports[_0xeabc('0x63')]=function(_0x511b33,_0x53f578){if(_0x511b33[_0xeabc('0x55')]['id']){delete _0x511b33['body']['id'];}return db[_0xeabc('0x4c')]['find']({'where':{'id':_0x511b33[_0xeabc('0x52')]['id']}})['then'](handleEntityNotFound(_0x53f578,null))[_0xeabc('0x29')](saveUpdates(_0x511b33['body'],null))[_0xeabc('0x29')](respondWithResult(_0x53f578,null))[_0xeabc('0x50')](handleError(_0x53f578,null));};exports[_0xeabc('0x2a')]=function(_0x36cc41,_0x5e121c){return db[_0xeabc('0x4c')]['find']({'where':{'id':_0x36cc41[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x5e121c,null))[_0xeabc('0x29')](removeEntity(_0x5e121c,null))[_0xeabc('0x50')](handleError(_0x5e121c,null));};exports[_0xeabc('0x64')]=function(_0x5c1ab2,_0x239350,_0x329d8b){var _0x4b9614={'raw':![],'where':{}};var _0x2509a4={};var _0x5427c8={'count':0x0,'rows':[]};return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x5c1ab2[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x239350,null))['then'](function(_0xb9b460){if(_0xb9b460){_0x2509a4[_0xeabc('0x3e')]=_[_0xeabc('0x3d')](db[_0xeabc('0x66')]['rawAttributes']);_0x2509a4['query']=_[_0xeabc('0x3d')](_0x5c1ab2['query']);_0x2509a4['filters']=_[_0xeabc('0x53')](_0x2509a4[_0xeabc('0x3e')],_0x2509a4[_0xeabc('0x3c')]);_0x4b9614['attributes']=_[_0xeabc('0x53')](_0x2509a4[_0xeabc('0x3e')],qs['fields'](_0x5c1ab2[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x4b9614[_0xeabc('0x3f')]=_0x4b9614[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x4b9614['attributes']:_0x2509a4[_0xeabc('0x3e')];if(!_0x5c1ab2['query']['hasOwnProperty']('nolimit')){_0x4b9614[_0xeabc('0x23')]=qs[_0xeabc('0x23')](_0x5c1ab2[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x4b9614[_0xeabc('0x21')]=qs['offset'](_0x5c1ab2[_0xeabc('0x3c')]['offset']);}_0x4b9614[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x5c1ab2['query'][_0xeabc('0x44')]);_0x4b9614['where']=qs['filters'](_[_0xeabc('0x46')](_0x5c1ab2[_0xeabc('0x3c')],_0x2509a4[_0xeabc('0x47')]));_0x4b9614[_0xeabc('0x45')][_0xeabc('0x67')]=_0xb9b460['id'];if(_0x5c1ab2['query'][_0xeabc('0x4a')]){_0x4b9614[_0xeabc('0x45')]=_[_0xeabc('0x48')](_0x4b9614[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x4b9614[_0xeabc('0x3f')],function(_0x2d05b4){var _0x419fc6={};_0x419fc6[_0x2d05b4]={'$like':'%'+_0x5c1ab2[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x419fc6;})});}_0x4b9614=_['merge']({},_0x4b9614,_0x5c1ab2[_0xeabc('0x4b')]);return db[_0xeabc('0x66')][_0xeabc('0x24')]({'where':_0x4b9614['where']})['then'](function(_0x1506bd){_0x5427c8[_0xeabc('0x24')]=_0x1506bd;if(_0x5c1ab2[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0x4b9614[_0xeabc('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0xeabc('0x4f')](_0x4b9614);})['then'](function(_0x5f39ef){_0x5427c8[_0xeabc('0x68')]=_0x5f39ef;return _0x5427c8;});}})[_0xeabc('0x29')](respondWithFilteredResult(_0x239350,_0x4b9614))['catch'](handleError(_0x239350,null));};exports[_0xeabc('0x69')]=function(_0x45c9c7,_0x49a70a,_0x5963f7){var _0xfaef39={'raw':!![],'where':{}};var _0xb04677={};var _0x135a79={'count':0x0,'rows':[]};return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x45c9c7[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x49a70a,null))['then'](function(_0xb54c35){if(_0xb54c35){_0xb04677['model']=_[_0xeabc('0x3d')](db[_0xeabc('0x6a')][_0xeabc('0x39')]);_0xb04677[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x45c9c7[_0xeabc('0x3c')]);_0xb04677[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0xb04677[_0xeabc('0x3e')],_0xb04677[_0xeabc('0x3c')]);_0xfaef39[_0xeabc('0x3f')]=_['intersection'](_0xb04677[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x40')]));_0xfaef39['attributes']=_0xfaef39[_0xeabc('0x3f')][_0xeabc('0x41')]?_0xfaef39['attributes']:_0xb04677[_0xeabc('0x3e')];if(!_0x45c9c7[_0xeabc('0x3c')]['hasOwnProperty']('nolimit')){_0xfaef39['limit']=qs['limit'](_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x23')]);_0xfaef39[_0xeabc('0x21')]=qs[_0xeabc('0x21')](_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x21')]);}_0xfaef39[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x44')]);_0xfaef39['where']=qs[_0xeabc('0x47')](_[_0xeabc('0x46')](_0x45c9c7['query'],_0xb04677[_0xeabc('0x47')]));_0xfaef39[_0xeabc('0x45')][_0xeabc('0x67')]=_0xb54c35['id'];if(_0x45c9c7['query'][_0xeabc('0x4a')]){_0xfaef39['where']=_[_0xeabc('0x48')](_0xfaef39[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0xfaef39[_0xeabc('0x3f')],function(_0x1c52f7){var _0x5e7e00={};_0x5e7e00[_0x1c52f7]={'$like':'%'+_0x45c9c7['query']['filter']+'%'};return _0x5e7e00;})});}_0xfaef39=_['merge']({},_0xfaef39,_0x45c9c7[_0xeabc('0x4b')]);return db[_0xeabc('0x6a')][_0xeabc('0x24')]({'where':_0xfaef39['where']})[_0xeabc('0x29')](function(_0x19536d){_0x135a79[_0xeabc('0x24')]=_0x19536d;if(_0x45c9c7[_0xeabc('0x3c')][_0xeabc('0x4d')]){_0xfaef39[_0xeabc('0x4e')]=[{'all':!![]}];}return db[_0xeabc('0x6a')][_0xeabc('0x4f')](_0xfaef39);})[_0xeabc('0x29')](function(_0x391e67){_0x135a79[_0xeabc('0x68')]=_0x391e67;return _0x135a79;});}})[_0xeabc('0x29')](respondWithFilteredResult(_0x49a70a,_0xfaef39))['catch'](handleError(_0x49a70a,null));};exports['getHopperFinals']=function(_0x3286a2,_0x50a5d5,_0x20c4d7){var _0x18ee16={'raw':!![],'where':{}};var _0x102591={};var _0x56f622={'count':0x0,'rows':[]};return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x3286a2[_0xeabc('0x52')]['id']}})['then'](handleEntityNotFound(_0x50a5d5,null))['then'](function(_0x3557f2){if(_0x3557f2){_0x102591[_0xeabc('0x3e')]=_[_0xeabc('0x3d')](db[_0xeabc('0x6b')][_0xeabc('0x39')]);_0x102591[_0xeabc('0x3c')]=_['keys'](_0x3286a2['query']);_0x102591[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x102591[_0xeabc('0x3e')],_0x102591[_0xeabc('0x3c')]);_0x18ee16['attributes']=_['intersection'](_0x102591['model'],qs[_0xeabc('0x40')](_0x3286a2['query'][_0xeabc('0x40')]));_0x18ee16['attributes']=_0x18ee16[_0xeabc('0x3f')]['length']?_0x18ee16[_0xeabc('0x3f')]:_0x102591[_0xeabc('0x3e')];if(!_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x18ee16['limit']=qs[_0xeabc('0x23')](_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x18ee16['offset']=qs[_0xeabc('0x21')](_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x21')]);}_0x18ee16[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x3286a2['query'][_0xeabc('0x44')]);_0x18ee16[_0xeabc('0x45')]=qs['filters'](_[_0xeabc('0x46')](_0x3286a2[_0xeabc('0x3c')],_0x102591['filters']));_0x18ee16[_0xeabc('0x45')][_0xeabc('0x67')]=_0x3557f2['id'];if(_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x4a')]){_0x18ee16[_0xeabc('0x45')]=_[_0xeabc('0x48')](_0x18ee16[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x18ee16[_0xeabc('0x3f')],function(_0x11a185){var _0x223cd6={};_0x223cd6[_0x11a185]={'$like':'%'+_0x3286a2[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x223cd6;})});}_0x18ee16=_['merge']({},_0x18ee16,_0x3286a2['options']);return db[_0xeabc('0x6b')][_0xeabc('0x24')]({'where':_0x18ee16[_0xeabc('0x45')]})[_0xeabc('0x29')](function(_0x5805c9){_0x56f622[_0xeabc('0x24')]=_0x5805c9;if(_0x3286a2['query']['includeAll']){_0x18ee16['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x18ee16);})['then'](function(_0x72dd0e){_0x56f622[_0xeabc('0x68')]=_0x72dd0e;return _0x56f622;});}})[_0xeabc('0x29')](respondWithFilteredResult(_0x50a5d5,_0x18ee16))[_0xeabc('0x50')](handleError(_0x50a5d5,null));};exports[_0xeabc('0x6d')]=function(_0xe27492,_0x152d99,_0x3eaedf){var _0x44dc85={'raw':!![],'where':{}};var _0x550273={};var _0x3b1f77={'count':0x0,'rows':[]};return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0xe27492[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x152d99,null))[_0xeabc('0x29')](function(_0x2a29d7){if(_0x2a29d7){_0x550273['model']=_[_0xeabc('0x3d')](db['CmHopperBlack'][_0xeabc('0x39')]);_0x550273[_0xeabc('0x3c')]=_['keys'](_0xe27492[_0xeabc('0x3c')]);_0x550273['filters']=_[_0xeabc('0x53')](_0x550273[_0xeabc('0x3e')],_0x550273[_0xeabc('0x3c')]);_0x44dc85[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0x550273[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0xe27492[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x44dc85['attributes']=_0x44dc85['attributes'][_0xeabc('0x41')]?_0x44dc85[_0xeabc('0x3f')]:_0x550273['model'];if(!_0xe27492[_0xeabc('0x3c')]['hasOwnProperty'](_0xeabc('0x6c'))){_0x44dc85[_0xeabc('0x23')]=qs[_0xeabc('0x23')](_0xe27492[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x44dc85[_0xeabc('0x21')]=qs['offset'](_0xe27492[_0xeabc('0x3c')]['offset']);}_0x44dc85[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0xe27492[_0xeabc('0x3c')][_0xeabc('0x44')]);_0x44dc85['where']=qs[_0xeabc('0x47')](_[_0xeabc('0x46')](_0xe27492[_0xeabc('0x3c')],_0x550273['filters']));_0x44dc85[_0xeabc('0x45')][_0xeabc('0x67')]=_0x2a29d7['id'];if(_0xe27492[_0xeabc('0x3c')]['filter']){_0x44dc85['where']=_['merge'](_0x44dc85['where'],{'$or':_[_0xeabc('0x2f')](_0x44dc85[_0xeabc('0x3f')],function(_0x52e84f){var _0x12f024={};_0x12f024[_0x52e84f]={'$like':'%'+_0xe27492[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x12f024;})});}_0x44dc85=_[_0xeabc('0x48')]({},_0x44dc85,_0xe27492[_0xeabc('0x4b')]);return db[_0xeabc('0x6e')][_0xeabc('0x24')]({'where':_0x44dc85[_0xeabc('0x45')]})[_0xeabc('0x29')](function(_0x4df674){_0x3b1f77[_0xeabc('0x24')]=_0x4df674;if(_0xe27492['query'][_0xeabc('0x4d')]){_0x44dc85[_0xeabc('0x4e')]=[{'all':!![]}];}return db[_0xeabc('0x6e')][_0xeabc('0x4f')](_0x44dc85);})[_0xeabc('0x29')](function(_0x3a43ad){_0x3b1f77[_0xeabc('0x68')]=_0x3a43ad;return _0x3b1f77;});}})['then'](respondWithFilteredResult(_0x152d99,_0x44dc85))[_0xeabc('0x50')](handleError(_0x152d99,null));};exports['getTeams']=function(_0x475160,_0x4d8953,_0x10d66b){var _0x12a042={};var _0x266b53={};var _0x1aee85;var _0x507037;return db['VoiceQueue'][_0xeabc('0x65')]({'where':{'id':_0x475160[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x4d8953,null))[_0xeabc('0x29')](function(_0x3339ce){if(_0x3339ce){_0x1aee85=_0x3339ce;_0x266b53['model']=_[_0xeabc('0x3d')](db[_0xeabc('0x6f')][_0xeabc('0x39')]);_0x266b53[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x475160['query']);_0x266b53[_0xeabc('0x47')]=_['intersection'](_0x266b53[_0xeabc('0x3e')],_0x266b53[_0xeabc('0x3c')]);_0x12a042[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0x266b53[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x475160[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x12a042[_0xeabc('0x3f')]=_0x12a042[_0xeabc('0x3f')]['length']?_0x12a042[_0xeabc('0x3f')]:_0x266b53[_0xeabc('0x3e')];_0x12a042[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x475160['query'][_0xeabc('0x44')]);_0x12a042['where']=qs['filters'](_[_0xeabc('0x46')](_0x475160[_0xeabc('0x3c')],_0x266b53[_0xeabc('0x47')]));if(_0x475160['query'][_0xeabc('0x4a')]){_0x12a042[_0xeabc('0x45')]=_[_0xeabc('0x48')](_0x12a042[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x12a042['attributes'],function(_0x1dc0fc){var _0x316e15={};_0x316e15[_0x1dc0fc]={'$like':'%'+_0x475160['query']['filter']+'%'};return _0x316e15;})});}_0x12a042=_[_0xeabc('0x48')]({},_0x12a042,_0x475160[_0xeabc('0x4b')]);return _0x1aee85[_0xeabc('0x70')](_0x12a042);}})[_0xeabc('0x29')](function(_0x2a0075){if(_0x2a0075){_0x507037=_0x2a0075[_0xeabc('0x41')];if(!_0x475160[_0xeabc('0x3c')][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x12a042['limit']=qs[_0xeabc('0x23')](_0x475160['query'][_0xeabc('0x23')]);_0x12a042['offset']=qs[_0xeabc('0x21')](_0x475160[_0xeabc('0x3c')][_0xeabc('0x21')]);}return _0x1aee85[_0xeabc('0x70')](_0x12a042);}})[_0xeabc('0x29')](function(_0x227f00){if(_0x227f00){return _0x227f00?{'count':_0x507037,'rows':_0x227f00}:null;}})[_0xeabc('0x29')](respondWithResult(_0x4d8953,null))[_0xeabc('0x50')](handleError(_0x4d8953,null));};exports[_0xeabc('0x71')]=function(_0x31f1bf,_0x5c83e5,_0x5629db){var _0x1ad48f=_0x31f1bf['body'][_0xeabc('0x72')];var _0x283d40=_['map'](_0x1ad48f,'id');return db['Team'][_0xeabc('0x4f')]({'where':{'id':_0x283d40},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xeabc('0x34'),'online','voicePause',_0xeabc('0x73')],'raw':!![]}]})[_0xeabc('0x29')](function(_0x4a2b27){if(_0x4a2b27){var _0x480bbd=_[_0xeabc('0x74')](_0x4a2b27,function(_0x2465f9){var _0x4b6717=_0x2465f9[_0xeabc('0x2b')]({'plain':!![]});_0x4b6717[_0xeabc('0x75')]['forEach'](function(_0x578fdc){_0x578fdc[_0xeabc('0x76')]=_[_0xeabc('0x33')](_0x1ad48f,{'id':_0x4b6717['id']})[_0xeabc('0x76')];});return _0x4b6717['Agents'];});return db[_0xeabc('0x4c')]['find']({'where':{'id':_0x31f1bf[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](function(_0x2055d8){return db['sequelize']['transaction'](function(_0x6dff2a){return _0x2055d8[_0xeabc('0x71')](_0x283d40,{'transaction':_0x6dff2a})[_0xeabc('0x29')](function(){return BPromise[_0xeabc('0x77')](_0x1ad48f,function(_0x40658b){return db[_0xeabc('0x78')][_0xeabc('0x79')]({'TeamId':_0x40658b['id'],'VoiceQueueId':_0x31f1bf[_0xeabc('0x52')]['id'],'penalty':_0x40658b['penalty']},{'transaction':_0x6dff2a});});})['then'](function(){return BPromise[_0xeabc('0x77')](_0x480bbd,function(_0x55e41e){return db[_0xeabc('0x7a')]['findOrCreate']({'where':{'UserId':_0x55e41e['id'],'VoiceQueueId':_0x31f1bf[_0xeabc('0x52')]['id']},'defaults':{'penalty':_0x55e41e[_0xeabc('0x76')]},'transaction':_0x6dff2a});});})[_0xeabc('0x29')](function(){return BPromise[_0xeabc('0x77')](_[_0xeabc('0x4a')](_0x480bbd,{'online':!![]}),function(_0x75f13b){return db[_0xeabc('0x7b')][_0xeabc('0x79')]({'membername':_0x75f13b['name'],'UserId':_0x75f13b['id'],'queue_name':_0x2055d8[_0xeabc('0x34')],'VoiceQueueId':_0x2055d8['id'],'interface':_[_0xeabc('0x7c')](_0x75f13b[_0xeabc('0x73')])?util[_0xeabc('0x7d')](_0xeabc('0x7e'),_0x75f13b[_0xeabc('0x34')]):_0x75f13b[_0xeabc('0x73')],'paused':_0x75f13b[_0xeabc('0x7f')]||![],'penalty':_0x75f13b[_0xeabc('0x76')]},{'transaction':_0x6dff2a});});})[_0xeabc('0x29')](function(){_0x480bbd[_0xeabc('0x80')](function(_0x1ba153){socket[_0xeabc('0x81')]('userVoiceQueue:save',{'UserId':_0x1ba153['id'],'VoiceQueueId':_0x2055d8['id']});});});});});}})[_0xeabc('0x29')](respondWithStatusCode(_0x5c83e5,null))[_0xeabc('0x50')](handleError(_0x5c83e5,null));};exports[_0xeabc('0x82')]=function(_0x2a0793,_0x198641,_0x34738e){return db[_0xeabc('0x6f')][_0xeabc('0x4f')]({'where':{'id':_0x2a0793[_0xeabc('0x3c')][_0xeabc('0x83')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xeabc('0x75'),'attributes':['id'],'raw':!![]}]})[_0xeabc('0x29')](handleEntityNotFound(_0x198641,null))['then'](function(_0x598105){var _0x5fc21a=_[_0xeabc('0x2f')](_0x598105,'id');var _0x201539=[];var _0x597bd0=[];var _0xba66a2=squel[_0xeabc('0x84')]();_0xba66a2[_0xeabc('0x85')]('tq.TeamId')[_0xeabc('0x86')](_0xeabc('0x87'),'tq')[_0xeabc('0x88')]('user_has_teams','ut',_0xeabc('0x89'))[_0xeabc('0x45')]('VoiceQueueId\x20=\x20?',_0x2a0793[_0xeabc('0x52')]['id']);for(var _0x50371d=0x0;_0x50371d<_0x598105[_0xeabc('0x41')];_0x50371d+=0x1){let _0x39916c=_0x598105[_0x50371d];for(var _0x5cc6d0=0x0;_0x5cc6d0<_0x39916c['Agents']['length'];_0x5cc6d0+=0x1){let _0x122f23=_0x39916c[_0xeabc('0x75')][_0x5cc6d0];var _0x3571c6=_0xba66a2['clone']();_0x3571c6['where']('ut.UserId\x20=\x20?',_0x122f23['id']);_0x597bd0[_0xeabc('0x8a')](db[_0xeabc('0x8b')]['query'](_0x3571c6[_0xeabc('0x8c')](),{'type':db[_0xeabc('0x8b')][_0xeabc('0x8d')][_0xeabc('0x8e')]})[_0xeabc('0x29')](function(_0x1ca3da){if(_0x1ca3da[_0xeabc('0x41')]===0x1){return _0x122f23['id'];}else{var _0x4a5555=_['every'](_['map'](_0x1ca3da,_0xeabc('0x8f')),function(_0x24cf0a){return _[_0xeabc('0x31')](_0x5fc21a,_0x24cf0a);});if(_0x4a5555){return _0x122f23['id'];}}}));}}return BPromise[_0xeabc('0x90')](_0x597bd0)[_0xeabc('0x29')](function(_0x564ebd){_0x201539=_(_0x201539)[_0xeabc('0x91')](_0x564ebd)['compact']()[_0xeabc('0x30')]();return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0x2a0793[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](function(_0x94fb8e){return db[_0xeabc('0x8b')][_0xeabc('0x92')](function(_0x4287e3){return _0x94fb8e[_0xeabc('0x82')](_0x2a0793['query'][_0xeabc('0x83')],{'transaction':_0x4287e3})[_0xeabc('0x29')](function(){if(!_['isEmpty'](_0x201539)){return _0x94fb8e[_0xeabc('0x93')](_0x201539,{'transaction':_0x4287e3})['then'](function(){return db[_0xeabc('0x7b')][_0xeabc('0x2a')]({'where':{'VoiceQueueId':_0x2a0793[_0xeabc('0x52')]['id'],'UserId':_0x201539},'transaction':_0x4287e3});});}})[_0xeabc('0x29')](function(){_0x201539['forEach'](function(_0x40156a){socket[_0xeabc('0x81')](_0xeabc('0x94'),{'UserId':_0x40156a,'VoiceQueueId':_0x94fb8e['id']});});});});});});})[_0xeabc('0x29')](respondWithStatusCode(_0x198641,null))[_0xeabc('0x50')](handleError(_0x198641,null));};exports['addAgents']=function(_0x34fc2b,_0x43fa37,_0x4913cf){var _0x584b2b,_0xb28be5;return db[_0xeabc('0x4c')]['find']({'where':{'id':_0x34fc2b[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x43fa37,null))['then'](function(_0x4d9ebd){if(_0x4d9ebd){_0xb28be5=_0x4d9ebd;return _0x4d9ebd[_0xeabc('0x95')](_0x34fc2b['body'][_0xeabc('0x83')],_[_0xeabc('0x5e')](_0x34fc2b[_0xeabc('0x55')],['ids','id'])||{})['spread'](function(_0x245991){for(var _0x3abe64=0x0;_0x3abe64<_0x34fc2b[_0xeabc('0x55')][_0xeabc('0x83')][_0xeabc('0x41')];_0x3abe64+=0x1){socket[_0xeabc('0x81')](_0xeabc('0x96'),{'UserId':Number(_0x34fc2b[_0xeabc('0x55')][_0xeabc('0x83')][_0x3abe64]),'VoiceQueueId':Number(_0x34fc2b['params']['id'])});}return _0x245991;});}})['then'](function(_0x1f0a8e){_0x584b2b=_0x1f0a8e||[];if(_0xb28be5){return db[_0xeabc('0x97')][_0xeabc('0x4f')]({'where':{'id':_0x34fc2b['body'][_0xeabc('0x83')]},'attributes':['id',_0xeabc('0x34'),_0xeabc('0x98'),_0xeabc('0x7f'),_0xeabc('0x73')],'raw':!![]});}})[_0xeabc('0x29')](function(_0x2f5ab8){if(!_[_0xeabc('0x99')](_0x2f5ab8)){var _0x1c77a0=[];for(var _0x10f354=0x0;_0x10f354<_0x2f5ab8[_0xeabc('0x41')];_0x10f354++){if(_0x2f5ab8[_0x10f354][_0xeabc('0x98')]){_0x1c77a0['push'](db[_0xeabc('0x7b')][_0xeabc('0x79')]({'membername':_0x2f5ab8[_0x10f354][_0xeabc('0x34')],'UserId':_0x2f5ab8[_0x10f354]['id'],'queue_name':_0xb28be5['name'],'VoiceQueueId':_0xb28be5['id'],'interface':_[_0xeabc('0x7c')](_0x2f5ab8[_0x10f354][_0xeabc('0x73')])?util['format'](_0xeabc('0x7e'),_0x2f5ab8[_0x10f354]['name']):_0x2f5ab8[_0x10f354][_0xeabc('0x73')],'paused':_0x2f5ab8[_0x10f354][_0xeabc('0x7f')]||![],'penalty':_0x34fc2b[_0xeabc('0x55')][_0xeabc('0x76')]||0x0}));}}return BPromise[_0xeabc('0x90')](_0x1c77a0);}})[_0xeabc('0x29')](function(){return _0x584b2b;})[_0xeabc('0x29')](respondWithResult(_0x43fa37,null))[_0xeabc('0x50')](handleError(_0x43fa37,null));};exports[_0xeabc('0x93')]=function(_0x4946af,_0x17a858,_0x4d3ead){return db['VoiceQueue'][_0xeabc('0x33')]({'where':{'id':_0x4946af[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x17a858,null))[_0xeabc('0x29')](function(_0x224a0e){if(_0x224a0e){return _0x224a0e[_0xeabc('0x93')](_0x4946af[_0xeabc('0x3c')][_0xeabc('0x83')])[_0xeabc('0x29')](function(){if(_[_0xeabc('0x9a')](_0x4946af[_0xeabc('0x3c')]['ids'])){for(var _0x57cf40=0x0;_0x57cf40<_0x4946af[_0xeabc('0x3c')][_0xeabc('0x83')]['length'];_0x57cf40+=0x1){socket[_0xeabc('0x81')](_0xeabc('0x94'),{'UserId':Number(_0x4946af['query']['ids'][_0x57cf40]),'VoiceQueueId':Number(_0x4946af[_0xeabc('0x52')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x4946af['query'][_0xeabc('0x83')]),'VoiceQueueId':Number(_0x4946af[_0xeabc('0x52')]['id'])});}});}})['then'](function(_0x58982a){return db[_0xeabc('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x4946af[_0xeabc('0x52')]['id'],'UserId':_0x4946af['query']['ids']}})[_0xeabc('0x29')](function(){return _0x58982a;});})[_0xeabc('0x29')](respondWithStatusCode(_0x17a858,null))[_0xeabc('0x50')](handleError(_0x17a858,null));};exports[_0xeabc('0x9b')]=function(_0x2e23da,_0x1bf9a2,_0x29153b){var _0x114ffc={};var _0x235270={};var _0x23fab7;var _0x29b175;return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x2e23da['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x1bf9a2,null))['then'](function(_0x42ceb1){if(_0x42ceb1){_0x23fab7=_0x42ceb1;_0x235270['model']=_[_0xeabc('0x3d')](db[_0xeabc('0x97')][_0xeabc('0x39')]);_0x235270['query']=_[_0xeabc('0x3d')](_0x2e23da['query']);_0x235270[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x235270[_0xeabc('0x3e')],_0x235270[_0xeabc('0x3c')]);_0x114ffc[_0xeabc('0x3f')]=_['intersection'](_0x235270[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x114ffc[_0xeabc('0x3f')]=_0x114ffc[_0xeabc('0x3f')][_0xeabc('0x41')]?_0x114ffc[_0xeabc('0x3f')]:_0x235270[_0xeabc('0x3e')];_0x114ffc['order']=qs['sort'](_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x44')]);_0x114ffc[_0xeabc('0x45')]=qs[_0xeabc('0x47')](_['pick'](_0x2e23da[_0xeabc('0x3c')],_0x235270[_0xeabc('0x47')]));if(_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x4a')]){_0x114ffc['where']=_[_0xeabc('0x48')](_0x114ffc[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x114ffc['attributes'],function(_0x497ee4){var _0x43e541={};_0x43e541[_0x497ee4]={'$like':'%'+_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x43e541;})});}_0x114ffc=_[_0xeabc('0x48')]({},_0x114ffc,_0x2e23da[_0xeabc('0x4b')]);return _0x23fab7[_0xeabc('0x9b')](_0x114ffc);}})[_0xeabc('0x29')](function(_0x4124c6){if(_0x4124c6){_0x29b175=_0x4124c6['length'];if(!_0x2e23da['query'][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x114ffc[_0xeabc('0x23')]=qs['limit'](_0x2e23da[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x114ffc[_0xeabc('0x21')]=qs[_0xeabc('0x21')](_0x2e23da[_0xeabc('0x3c')]['offset']);}return _0x23fab7[_0xeabc('0x9b')](_0x114ffc);}})[_0xeabc('0x29')](function(_0x207932){if(_0x207932){return _0x207932?{'count':_0x29b175,'rows':_0x207932}:null;}})[_0xeabc('0x29')](respondWithResult(_0x1bf9a2,null))[_0xeabc('0x50')](handleError(_0x1bf9a2,null));};exports[_0xeabc('0x9c')]=function(_0x35ed8a,_0x977d14,_0x141dbb){var _0x318be6={};var _0xf97e59={};var _0x1293ab;var _0x55c261;return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0x35ed8a[_0xeabc('0x52')]['id']}})['then'](handleEntityNotFound(_0x977d14,null))[_0xeabc('0x29')](function(_0x26e38b){if(_0x26e38b){_0x1293ab=_0x26e38b;_0xf97e59['model']=_[_0xeabc('0x3d')](db[_0xeabc('0x7b')]['rawAttributes']);_0xf97e59['query']=_[_0xeabc('0x3d')](_0x35ed8a[_0xeabc('0x3c')]);_0xf97e59[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0xf97e59[_0xeabc('0x3e')],_0xf97e59[_0xeabc('0x3c')]);_0x318be6[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0xf97e59['model'],qs['fields'](_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x40')]));_0x318be6[_0xeabc('0x3f')]=_0x318be6[_0xeabc('0x3f')]['length']?_0x318be6['attributes']:_0xf97e59[_0xeabc('0x3e')];_0x318be6[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x44')]);_0x318be6[_0xeabc('0x45')]=qs[_0xeabc('0x47')](_['pick'](_0x35ed8a[_0xeabc('0x3c')],_0xf97e59[_0xeabc('0x47')]));if(_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x4a')]){_0x318be6['where']=_['merge'](_0x318be6[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x318be6[_0xeabc('0x3f')],function(_0xb9df16){var _0x432709={};_0x432709[_0xb9df16]={'$like':'%'+_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0x432709;})});}_0x318be6=_[_0xeabc('0x48')]({},_0x318be6,_0x35ed8a[_0xeabc('0x4b')]);return _0x1293ab[_0xeabc('0x9c')](_0x318be6);}})[_0xeabc('0x29')](function(_0x2a3a5c){if(_0x2a3a5c){_0x55c261=_0x2a3a5c[_0xeabc('0x41')];if(!_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x318be6[_0xeabc('0x23')]=qs['limit'](_0x35ed8a['query']['limit']);_0x318be6['offset']=qs['offset'](_0x35ed8a[_0xeabc('0x3c')][_0xeabc('0x21')]);}return _0x1293ab['getMembers'](_0x318be6);}})[_0xeabc('0x29')](function(_0xdfb37a){return _0xdfb37a?{'count':_0x55c261,'rows':_0xdfb37a}:null;})[_0xeabc('0x29')](respondWithResult(_0x977d14,null))[_0xeabc('0x50')](handleError(_0x977d14,null));};exports[_0xeabc('0x9d')]=function(_0x366034,_0x5d16cb,_0x52c973){var _0x1f90b6={};var _0x1c0703={};var _0x5ad17f;var _0x3f6255;return db['VoiceQueue'][_0xeabc('0x65')]({'where':{'id':_0x366034['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x5d16cb,null))[_0xeabc('0x29')](function(_0x31df33){if(_0x31df33){_0x5ad17f=_0x31df33;_0x1c0703[_0xeabc('0x3e')]=_['keys'](db[_0xeabc('0x9e')][_0xeabc('0x39')]);_0x1c0703[_0xeabc('0x3c')]=_[_0xeabc('0x3d')](_0x366034[_0xeabc('0x3c')]);_0x1c0703[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x1c0703[_0xeabc('0x3e')],_0x1c0703['query']);_0x1f90b6[_0xeabc('0x3f')]=_['intersection'](_0x1c0703[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0x366034[_0xeabc('0x3c')]['fields']));_0x1f90b6[_0xeabc('0x3f')]=_0x1f90b6['attributes']['length']?_0x1f90b6[_0xeabc('0x3f')]:_0x1c0703['model'];_0x1f90b6[_0xeabc('0x43')]=qs[_0xeabc('0x44')](_0x366034[_0xeabc('0x3c')]['sort']);_0x1f90b6[_0xeabc('0x45')]=qs['filters'](_['pick'](_0x366034[_0xeabc('0x3c')],_0x1c0703[_0xeabc('0x47')]));if(_0x366034['query']['filter']){_0x1f90b6[_0xeabc('0x45')]=_[_0xeabc('0x48')](_0x1f90b6[_0xeabc('0x45')],{'$or':_[_0xeabc('0x2f')](_0x1f90b6[_0xeabc('0x3f')],function(_0x274693){var _0x73de81={};_0x73de81[_0x274693]={'$like':'%'+_0x366034['query'][_0xeabc('0x4a')]+'%'};return _0x73de81;})});}_0x1f90b6=_['merge']({},_0x1f90b6,_0x366034[_0xeabc('0x4b')]);return _0x5ad17f[_0xeabc('0x9d')](_0x1f90b6);}})[_0xeabc('0x29')](function(_0x197261){if(_0x197261){_0x3f6255=_0x197261['length'];if(!_0x366034['query'][_0xeabc('0x42')](_0xeabc('0x6c'))){_0x1f90b6[_0xeabc('0x23')]=qs[_0xeabc('0x23')](_0x366034[_0xeabc('0x3c')][_0xeabc('0x23')]);_0x1f90b6[_0xeabc('0x21')]=qs[_0xeabc('0x21')](_0x366034[_0xeabc('0x3c')]['offset']);}return _0x5ad17f[_0xeabc('0x9d')](_0x1f90b6);}})[_0xeabc('0x29')](function(_0x16d3c1){if(_0x16d3c1){return _0x16d3c1?{'count':_0x3f6255,'rows':_0x16d3c1}:null;}})['then'](respondWithResult(_0x5d16cb,null))[_0xeabc('0x50')](handleError(_0x5d16cb,null));};exports[_0xeabc('0x9f')]=function(_0x5cf0e6,_0x4f8763,_0x534147){var _0x1708ec=moment()[_0xeabc('0x7d')](_0xeabc('0xa0'));var _0x394082,_0xc1fb57;return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0x5cf0e6['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x4f8763,null))['then'](function(_0x3939a5){if(_0x3939a5){_0xc1fb57=_0x3939a5;return _0x3939a5[_0xeabc('0x9f')](_0x5cf0e6[_0xeabc('0x55')][_0xeabc('0x83')],_[_0xeabc('0x5e')](_0x5cf0e6['body'],[_0xeabc('0x83'),'id'])||{});}return null;})[_0xeabc('0xa1')](function(_0x5a92db){var _0xceed5f;_0x394082=_0x5a92db||[];var _0x44ac6f=[];if(_0x5a92db){for(var _0x3b807d=0x0;_0x3b807d<_0x5a92db[_0xeabc('0x41')];_0x3b807d+=0x1){var _0x11128b=_0x5a92db[_0x3b807d][_0xeabc('0x2b')]({'plain':!![]});_0xc1fb57[_0xeabc('0xa2')]=_0x5cf0e6[_0xeabc('0x55')]['dialCheckDuplicateType']?_0x5cf0e6[_0xeabc('0x55')][_0xeabc('0xa2')]:_0xc1fb57[_0xeabc('0xa2')];switch(_0xc1fb57['dialCheckDuplicateType']){case _0xeabc('0xa3'):_0xceed5f=squel[_0xeabc('0xa4')]()[_0xeabc('0xa5')]('cm_hopper')[_0xeabc('0xa6')](['phone',_0xeabc('0xa7'),_0xeabc('0xa8'),_0xeabc('0xa9'),_0xeabc('0x67'),'createdAt',_0xeabc('0x60')],squel[_0xeabc('0x84')]()['field'](_0xeabc('0xaa'),'phone')[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0xa7'))[_0xeabc('0x85')]('id',_0xeabc('0xa8'))['field'](_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')](),_0xeabc('0xa9'))[_0xeabc('0x85')](_0x5cf0e6['params']['id']['toString'](),_0xeabc('0x67'))['field']('\x27'+_0x1708ec+'\x27','createdAt')['field']('\x27'+_0x1708ec+'\x27','updatedAt')[_0xeabc('0x86')](_0xeabc('0xac'))['where'](_0xeabc('0xad'))[_0xeabc('0x45')](_0xeabc('0xae'),_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')]())[_0xeabc('0x45')]('phone\x20IS\x20NOT\x20NULL')[_0xeabc('0x45')](_0xeabc('0xaf'),squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xb0'))[_0xeabc('0x86')](_0xeabc('0xb1'))[_0xeabc('0x45')](_0xeabc('0xb2'),_0x5cf0e6[_0xeabc('0x52')]['id'][_0xeabc('0x8c')]()))[_0xeabc('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xb3'))[_0xeabc('0x86')]('cm_hopper')[_0xeabc('0x45')](_0xeabc('0xb2'),_0x5cf0e6['params']['id']['toString']())))[_0xeabc('0x8c')]();break;case _0xeabc('0xb4'):_0xceed5f=squel[_0xeabc('0xa4')]()[_0xeabc('0xa5')](_0xeabc('0xb5'))['fromQuery']([_0xeabc('0xaa'),_0xeabc('0xa7'),_0xeabc('0xa8'),_0xeabc('0xa9'),_0xeabc('0x67'),_0xeabc('0x5f'),'updatedAt'],squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xaa'),_0xeabc('0xaa'))[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0xa7'))['field']('id',_0xeabc('0xa8'))[_0xeabc('0x85')](_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')](),'ListId')[_0xeabc('0x85')](_0x5cf0e6[_0xeabc('0x52')]['id']['toString'](),_0xeabc('0x67'))[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0x5f'))[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0x60'))[_0xeabc('0x86')](_0xeabc('0xac'))[_0xeabc('0x45')](_0xeabc('0xad'))[_0xeabc('0x45')](_0xeabc('0xae'),_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')]())['where']('phone\x20IS\x20NOT\x20NULL')['where'](_0xeabc('0xaf'),squel[_0xeabc('0x84')]()['field'](_0xeabc('0xb3'))[_0xeabc('0x86')](_0xeabc('0xb5'))['where'](_0xeabc('0xb2'),_0x5cf0e6[_0xeabc('0x52')]['id'][_0xeabc('0x8c')]())))[_0xeabc('0x8c')]();break;default:_0xceed5f=squel[_0xeabc('0xa4')]()[_0xeabc('0xa5')](_0xeabc('0xb5'))[_0xeabc('0xa6')](['phone','scheduledAt','ContactId',_0xeabc('0xa9'),_0xeabc('0x67'),'createdAt','updatedAt'],squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xaa'),_0xeabc('0xaa'))['field']('\x27'+_0x1708ec+'\x27',_0xeabc('0xa7'))[_0xeabc('0x85')]('id',_0xeabc('0xa8'))[_0xeabc('0x85')](_0x11128b[_0xeabc('0xab')][_0xeabc('0x8c')](),'ListId')[_0xeabc('0x85')](_0x5cf0e6[_0xeabc('0x52')]['id']['toString'](),'VoiceQueueId')[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0x5f'))['field']('\x27'+_0x1708ec+'\x27',_0xeabc('0x60'))[_0xeabc('0x86')]('cm_contacts')[_0xeabc('0x45')]('deletedAt\x20IS\x20NULL')[_0xeabc('0x45')](_0xeabc('0xae'),_0x11128b[_0xeabc('0xab')]['toString']())[_0xeabc('0x45')](_0xeabc('0xb6')))['toString']();}_0x44ac6f[_0xeabc('0x8a')](db[_0xeabc('0x8b')][_0xeabc('0x3c')](_0xceed5f));}return BPromise[_0xeabc('0x90')](_0x44ac6f);}})['then'](function(){var _0x390d90=[];var _0x414fc3=squel[_0xeabc('0xa4')]()[_0xeabc('0xa5')](_0xeabc('0xb7'))[_0xeabc('0xa6')]([_0xeabc('0xb8'),_0xeabc('0xaa'),_0xeabc('0xb9'),'createdAt',_0xeabc('0x60')],squel[_0xeabc('0x84')]()[_0xeabc('0x85')](_0xeabc('0xba'))[_0xeabc('0x85')]('ci.item')[_0xeabc('0x85')]('ci.OrderBy')[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27',_0xeabc('0x5f'))[_0xeabc('0x85')]('\x27'+_0x1708ec+'\x27','updatedAt')['from'](_0xeabc('0xbb'),'ci')[_0xeabc('0x88')](_0xeabc('0xb5'),'h','h.ContactId=ci.CmContactId')[_0xeabc('0x45')](_0xeabc('0xbc'),_0x1708ec)[_0xeabc('0x45')]('ci.ItemClass=?',_0xeabc('0xbd')))['toString']();_0x390d90[_0xeabc('0x8a')](db['sequelize'][_0xeabc('0x3c')](_0x414fc3));return BPromise[_0xeabc('0x90')](_0x390d90);})[_0xeabc('0x29')](function(){return _0x394082;})[_0xeabc('0x29')](respondWithResult(_0x4f8763,null))[_0xeabc('0x50')](handleError(_0x4f8763,null));};exports[_0xeabc('0xbe')]=function(_0x1216cf,_0x198c42,_0x21a0df){return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0x1216cf['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x198c42,null))[_0xeabc('0x29')](function(_0x42c8c9){if(_0x42c8c9){return _0x42c8c9[_0xeabc('0xbe')](_0x1216cf[_0xeabc('0x3c')][_0xeabc('0x83')]);}})['then'](function(_0x67df66){if(_0x67df66){return db[_0xeabc('0x66')][_0xeabc('0x2a')]({'where':{'ListId':_0x1216cf[_0xeabc('0x3c')][_0xeabc('0x83')],'VoiceQueueId':_0x1216cf[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](function(){return _0x67df66;});}})[_0xeabc('0x29')](respondWithStatusCode(_0x198c42,null))[_0xeabc('0x50')](handleError(_0x198c42,null));};exports['getBlackLists']=function(_0xaf0794,_0x47da72,_0x30b6a2){var _0xcc42a7={};var _0x13be21={};var _0x28a4cb;var _0x5ee7bb;return db[_0xeabc('0x4c')][_0xeabc('0x65')]({'where':{'id':_0xaf0794['params']['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x47da72,null))['then'](function(_0x22c237){if(_0x22c237){_0x28a4cb=_0x22c237;_0x13be21[_0xeabc('0x3e')]=_['keys'](db[_0xeabc('0x9e')]['rawAttributes']);_0x13be21['query']=_['keys'](_0xaf0794[_0xeabc('0x3c')]);_0x13be21[_0xeabc('0x47')]=_[_0xeabc('0x53')](_0x13be21[_0xeabc('0x3e')],_0x13be21[_0xeabc('0x3c')]);_0xcc42a7[_0xeabc('0x3f')]=_[_0xeabc('0x53')](_0x13be21[_0xeabc('0x3e')],qs[_0xeabc('0x40')](_0xaf0794[_0xeabc('0x3c')]['fields']));_0xcc42a7[_0xeabc('0x3f')]=_0xcc42a7['attributes'][_0xeabc('0x41')]?_0xcc42a7[_0xeabc('0x3f')]:_0x13be21[_0xeabc('0x3e')];_0xcc42a7['order']=qs[_0xeabc('0x44')](_0xaf0794['query']['sort']);_0xcc42a7[_0xeabc('0x45')]=qs['filters'](_[_0xeabc('0x46')](_0xaf0794[_0xeabc('0x3c')],_0x13be21['filters']));if(_0xaf0794[_0xeabc('0x3c')]['filter']){_0xcc42a7[_0xeabc('0x45')]=_['merge'](_0xcc42a7[_0xeabc('0x45')],{'$or':_['map'](_0xcc42a7[_0xeabc('0x3f')],function(_0x559792){var _0xb959bf={};_0xb959bf[_0x559792]={'$like':'%'+_0xaf0794[_0xeabc('0x3c')][_0xeabc('0x4a')]+'%'};return _0xb959bf;})});}_0xcc42a7=_[_0xeabc('0x48')]({},_0xcc42a7,_0xaf0794['options']);return _0x28a4cb['getBlackLists'](_0xcc42a7);}})['then'](function(_0x51f91d){if(_0x51f91d){_0x5ee7bb=_0x51f91d[_0xeabc('0x41')];if(!_0xaf0794[_0xeabc('0x3c')][_0xeabc('0x42')]('nolimit')){_0xcc42a7[_0xeabc('0x23')]=qs['limit'](_0xaf0794[_0xeabc('0x3c')][_0xeabc('0x23')]);_0xcc42a7[_0xeabc('0x21')]=qs[_0xeabc('0x21')](_0xaf0794['query']['offset']);}return _0x28a4cb['getBlackLists'](_0xcc42a7);}})[_0xeabc('0x29')](function(_0x457d82){if(_0x457d82){return _0x457d82?{'count':_0x5ee7bb,'rows':_0x457d82}:null;}})[_0xeabc('0x29')](respondWithResult(_0x47da72,null))[_0xeabc('0x50')](handleError(_0x47da72,null));};exports['addBlackLists']=function(_0x3d9f54,_0x440501,_0x11a8af){var _0x268aff,_0x1fbd9b;return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0x3d9f54[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x440501,null))[_0xeabc('0x29')](function(_0x5643f6){if(_0x5643f6){_0x1fbd9b=_0x5643f6;return _0x5643f6['addBlackLists'](_0x3d9f54['body'][_0xeabc('0x83')],_[_0xeabc('0x5e')](_0x3d9f54[_0xeabc('0x55')],[_0xeabc('0x83'),'id'])||{});}return null;})[_0xeabc('0xa1')](function(_0x18157e){var _0x404839;_0x268aff=_0x18157e||[];var _0x30eb6f=[];if(_0x18157e){for(var _0xba3953=0x0;_0xba3953<_0x18157e[_0xeabc('0x41')];_0xba3953+=0x1){var _0xa1613b=_0x18157e[_0xba3953][_0xeabc('0x2b')]({'plain':!![]});_0x404839=squel[_0xeabc('0xa4')]()['into']('cm_hopper_black')[_0xeabc('0xa6')](['phone',_0xeabc('0xa8'),'ListId',_0xeabc('0x67'),_0xeabc('0x5f'),'updatedAt'],squel['select']()[_0xeabc('0x85')](_0xeabc('0xaa'),_0xeabc('0xaa'))['field']('id',_0xeabc('0xa8'))[_0xeabc('0x85')](_0xa1613b[_0xeabc('0xab')][_0xeabc('0x8c')](),'ListId')[_0xeabc('0x85')](_0x3d9f54[_0xeabc('0x52')]['id'][_0xeabc('0x8c')](),_0xeabc('0x67'))[_0xeabc('0x85')](_0xeabc('0xbf'),_0xeabc('0x5f'))[_0xeabc('0x85')](_0xeabc('0xbf'),_0xeabc('0x60'))[_0xeabc('0x86')](_0xeabc('0xac'))[_0xeabc('0x45')](_0xeabc('0xad'))[_0xeabc('0x45')](_0xeabc('0xae'),_0xa1613b[_0xeabc('0xab')][_0xeabc('0x8c')]())[_0xeabc('0x45')]('phone\x20IS\x20NOT\x20NULL'))[_0xeabc('0x8c')]();_0x30eb6f[_0xeabc('0x8a')](db[_0xeabc('0x8b')][_0xeabc('0x3c')](_0x404839));}return BPromise[_0xeabc('0x90')](_0x30eb6f);}})[_0xeabc('0x29')](function(){return _0x268aff;})[_0xeabc('0x29')](respondWithResult(_0x440501,null))['catch'](handleError(_0x440501,null));};exports[_0xeabc('0xc0')]=function(_0xb22c9f,_0x24bc07,_0x52bc60){return db[_0xeabc('0x4c')][_0xeabc('0x33')]({'where':{'id':_0xb22c9f[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](handleEntityNotFound(_0x24bc07,null))['then'](function(_0x3a3d98){if(_0x3a3d98){return _0x3a3d98[_0xeabc('0xc0')](_0xb22c9f[_0xeabc('0x3c')][_0xeabc('0x83')]);}})[_0xeabc('0x29')](function(_0x14cf92){if(_0x14cf92){return db[_0xeabc('0x6e')][_0xeabc('0x2a')]({'where':{'ListId':_0xb22c9f[_0xeabc('0x3c')][_0xeabc('0x83')],'VoiceQueueId':_0xb22c9f[_0xeabc('0x52')]['id']}})[_0xeabc('0x29')](function(){return _0x14cf92;});}})[_0xeabc('0x29')](respondWithStatusCode(_0x24bc07,null))[_0xeabc('0x50')](handleError(_0x24bc07,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2a447a4..ba55fce 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 _0x5507=['remove','emit','hasOwnProperty','exports','events','save','update'];(function(_0x5e244f,_0x114f5b){var _0x49b731=function(_0x278dfd){while(--_0x278dfd){_0x5e244f['push'](_0x5e244f['shift']());}};_0x49b731(++_0x114f5b);}(_0x5507,0x154));var _0x7550=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0x5507[_0x5c2a2b];return _0x19921f;};'use strict';var EventEmitter=require(_0x7550('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7550('0x1'),'afterUpdate':_0x7550('0x2'),'afterDestroy':_0x7550('0x3')};function emitEvent(_0x1ebf3f){return function(_0x30d3e5,_0x534bc6,_0x2e1200){VoiceQueueEvents[_0x7550('0x4')](_0x1ebf3f+':'+_0x30d3e5['id'],_0x30d3e5);VoiceQueueEvents[_0x7550('0x4')](_0x1ebf3f,_0x30d3e5);_0x2e1200(null);};}for(var e in events){if(events[_0x7550('0x5')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x7550('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0xf999=['emit','hasOwnProperty','exports','events','setMaxListeners','save','update','remove'];(function(_0x15623d,_0x182c94){var _0x52eaa1=function(_0x3c218c){while(--_0x3c218c){_0x15623d['push'](_0x15623d['shift']());}};_0x52eaa1(++_0x182c94);}(_0xf999,0xc3));var _0x9f99=function(_0x5a5ae6,_0x430cde){_0x5a5ae6=_0x5a5ae6-0x0;var _0x28067a=_0xf999[_0x5a5ae6];return _0x28067a;};'use strict';var EventEmitter=require(_0x9f99('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x9f99('0x1')](0x0);var events={'afterCreate':_0x9f99('0x2'),'afterUpdate':_0x9f99('0x3'),'afterDestroy':_0x9f99('0x4')};function emitEvent(_0x29a57d){return function(_0x13a29e,_0x536aa7,_0x25d209){VoiceQueueEvents[_0x9f99('0x5')](_0x29a57d+':'+_0x13a29e['id'],_0x13a29e);VoiceQueueEvents[_0x9f99('0x5')](_0x29a57d,_0x13a29e);_0x25d209(null);};}for(var e in events){if(events[_0x9f99('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x9f99('0x7')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 2676523..52dbd90 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 _0x9c44=['request-promise','path','./voiceQueue.attributes','define','VoiceQueue','voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x247350,_0x41a29e){var _0x260807=function(_0x43fc8e){while(--_0x43fc8e){_0x247350['push'](_0x247350['shift']());}};_0x260807(++_0x41a29e);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var moment=require(_0x49c4('0x2'));var BPromise=require(_0x49c4('0x3'));var rp=require(_0x49c4('0x4'));var fs=require('fs');var path=require(_0x49c4('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x49c4('0x6'));module['exports']=function(_0xc1278f,_0x6030ae){return _0xc1278f[_0x49c4('0x7')](_0x49c4('0x8'),attributes,{'tableName':_0x49c4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x1ea3e9,_0x582d8b){var _0x4c3d8e=function(_0x3fa580){while(--_0x3fa580){_0x1ea3e9['push'](_0x1ea3e9['shift']());}};_0x4c3d8e(++_0x582d8b);}(_0x34e8,0x12c));var _0x834e=function(_0x56390e,_0x3f1ccd){_0x56390e=_0x56390e-0x0;var _0xa00c12=_0x34e8[_0x56390e];return _0xa00c12;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'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 2c550aa..87e8348 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 _0x3167=['include','model','ShowVoiceQueue','find','where','map','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./voiceQueue.socket','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueue,\x20%s,\x20%s','message','catch','GetVoiceQueue','VoiceQueue','options','raw','attributes','limit'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x3167,0x165));var _0x7316=function(_0x55d893,_0x325ebe){_0x55d893=_0x55d893-0x0;var _0x52d152=_0x3167[_0x55d893];return _0x52d152;};'use strict';var _=require(_0x7316('0x0'));var util=require(_0x7316('0x1'));var moment=require(_0x7316('0x2'));var BPromise=require(_0x7316('0x3'));var rs=require(_0x7316('0x4'));var fs=require('fs');var Redis=require(_0x7316('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7316('0x6'));var logger=require(_0x7316('0x7'))(_0x7316('0x8'));var config=require(_0x7316('0x9'));var jayson=require(_0x7316('0xa'));var client=jayson[_0x7316('0xb')]['http']({'port':0x232a});config[_0x7316('0xc')]=_['defaults'](config['redis'],{'host':_0x7316('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7316('0xc')]));require(_0x7316('0xe'))['register'](socket);function respondWithRpcPromise(_0x47bc44,_0x2bad9b,_0x46419a){return new BPromise(function(_0x225151,_0x20ace5){return client[_0x7316('0xf')](_0x47bc44,_0x46419a)[_0x7316('0x10')](function(_0x3ba530){logger[_0x7316('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x2bad9b,_0x7316('0x12'));logger[_0x7316('0x13')](_0x7316('0x14'),_0x2bad9b,_0x7316('0x12'),JSON[_0x7316('0x15')](_0x3ba530));if(_0x3ba530[_0x7316('0x16')]){if(_0x3ba530[_0x7316('0x16')][_0x7316('0x17')]===0x1f4){logger[_0x7316('0x16')](_0x7316('0x18'),_0x2bad9b,_0x3ba530[_0x7316('0x16')]['message']);return _0x20ace5(_0x3ba530['error'][_0x7316('0x19')]);}logger[_0x7316('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x2bad9b,_0x3ba530[_0x7316('0x16')][_0x7316('0x19')]);return _0x225151(_0x3ba530[_0x7316('0x16')]['message']);}else{logger[_0x7316('0x11')]('VoiceQueue,\x20%s,\x20%s',_0x2bad9b,'request\x20sent');_0x225151(_0x3ba530['result']['message']);}})[_0x7316('0x1a')](function(_0x3badb6){logger[_0x7316('0x16')](_0x7316('0x18'),_0x2bad9b,_0x3badb6);_0x20ace5(_0x3badb6);});});}exports[_0x7316('0x1b')]=function(_0x232ec1){var _0x334415=this;return new Promise(function(_0x530575,_0x24cebc){return db[_0x7316('0x1c')]['findAll']({'raw':_0x232ec1[_0x7316('0x1d')]?_0x232ec1['options'][_0x7316('0x1e')]===undefined?!![]:![]:!![],'where':_0x232ec1[_0x7316('0x1d')]?_0x232ec1[_0x7316('0x1d')]['where']||null:null,'attributes':_0x232ec1['options']?_0x232ec1[_0x7316('0x1d')][_0x7316('0x1f')]||null:null,'limit':_0x232ec1[_0x7316('0x1d')]?_0x232ec1[_0x7316('0x1d')][_0x7316('0x20')]||null:null,'include':_0x232ec1[_0x7316('0x1d')]?_0x232ec1[_0x7316('0x1d')]['include']?_['map'](_0x232ec1[_0x7316('0x1d')][_0x7316('0x21')],function(_0x1b557a){return{'model':db[_0x1b557a['model']],'as':_0x1b557a['as'],'attributes':_0x1b557a[_0x7316('0x1f')],'include':_0x1b557a['include']?_['map'](_0x1b557a[_0x7316('0x21')],function(_0x3027b5){return{'model':db[_0x3027b5['model']],'as':_0x3027b5['as'],'attributes':_0x3027b5[_0x7316('0x1f')],'include':_0x3027b5[_0x7316('0x21')]?_['map'](_0x3027b5[_0x7316('0x21')],function(_0x4800f8){return{'model':db[_0x4800f8[_0x7316('0x22')]],'as':_0x4800f8['as'],'attributes':_0x4800f8[_0x7316('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7316('0x10')](function(_0x264253){logger[_0x7316('0x11')](_0x7316('0x1b'),_0x232ec1);logger['debug'](_0x7316('0x1b'),_0x232ec1,JSON[_0x7316('0x15')](_0x264253));_0x530575(_0x264253);})['catch'](function(_0x152e78){logger[_0x7316('0x16')](_0x7316('0x1b'),_0x152e78[_0x7316('0x19')],_0x232ec1);_0x24cebc(_0x334415['error'](0x1f4,_0x152e78[_0x7316('0x19')]));});});};exports[_0x7316('0x23')]=function(_0x2271ee){var _0x849940=this;return new Promise(function(_0x247ddf,_0x3405b9){return db[_0x7316('0x1c')][_0x7316('0x24')]({'raw':_0x2271ee[_0x7316('0x1d')]?_0x2271ee[_0x7316('0x1d')][_0x7316('0x1e')]===undefined?!![]:![]:!![],'where':_0x2271ee[_0x7316('0x1d')]?_0x2271ee[_0x7316('0x1d')][_0x7316('0x25')]||null:null,'attributes':_0x2271ee[_0x7316('0x1d')]?_0x2271ee[_0x7316('0x1d')][_0x7316('0x1f')]||null:null,'include':_0x2271ee[_0x7316('0x1d')]?_0x2271ee[_0x7316('0x1d')][_0x7316('0x21')]?_[_0x7316('0x26')](_0x2271ee[_0x7316('0x1d')][_0x7316('0x21')],function(_0x5320f7){return{'model':db[_0x5320f7[_0x7316('0x22')]],'as':_0x5320f7['as'],'attributes':_0x5320f7[_0x7316('0x1f')],'include':_0x5320f7[_0x7316('0x21')]?_['map'](_0x5320f7[_0x7316('0x21')],function(_0x294ddf){return{'model':db[_0x294ddf[_0x7316('0x22')]],'as':_0x294ddf['as'],'attributes':_0x294ddf[_0x7316('0x1f')],'include':_0x294ddf['include']?_['map'](_0x294ddf[_0x7316('0x21')],function(_0xa0e734){return{'model':db[_0xa0e734[_0x7316('0x22')]],'as':_0xa0e734['as'],'attributes':_0xa0e734[_0x7316('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4437e7){logger[_0x7316('0x11')](_0x7316('0x23'),_0x2271ee);logger['debug'](_0x7316('0x23'),_0x2271ee,JSON[_0x7316('0x15')](_0x4437e7));_0x247ddf(_0x4437e7);})['catch'](function(_0x25ab3f){logger[_0x7316('0x16')](_0x7316('0x23'),_0x25ab3f[_0x7316('0x19')],_0x2271ee);_0x3405b9(_0x849940[_0x7316('0x16')](0x1f4,_0x25ab3f[_0x7316('0x19')]));});});}; \ No newline at end of file +var _0x867b=['map','model','stringify','ShowVoiceQueue','lodash','util','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x2c6ea3,_0x5c2967){var _0x48cc4c=function(_0x32700f){while(--_0x32700f){_0x2c6ea3['push'](_0x2c6ea3['shift']());}};_0x48cc4c(++_0x5c2967);}(_0x867b,0x76));var _0xb867=function(_0x31eacc,_0x54a934){_0x31eacc=_0x31eacc-0x0;var _0x1316bb=_0x867b[_0x31eacc];return _0x1316bb;};'use strict';var _=require(_0xb867('0x0'));var util=require(_0xb867('0x1'));var moment=require('moment');var BPromise=require(_0xb867('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb867('0x3'))(_0xb867('0x4'));var config=require(_0xb867('0x5'));var jayson=require(_0xb867('0x6'));var client=jayson[_0xb867('0x7')]['http']({'port':0x232a});config[_0xb867('0x8')]=_[_0xb867('0x9')](config[_0xb867('0x8')],{'host':_0xb867('0xa'),'port':0x18eb});var socket=require(_0xb867('0xb'))(new Redis(config[_0xb867('0x8')]));require(_0xb867('0xc'))[_0xb867('0xd')](socket);function respondWithRpcPromise(_0x2d3c9a,_0x4ab3f1,_0x289202){return new BPromise(function(_0x3951e8,_0x301e8d){return client[_0xb867('0xe')](_0x2d3c9a,_0x289202)[_0xb867('0xf')](function(_0x5e43e1){logger[_0xb867('0x10')](_0xb867('0x11'),_0x4ab3f1,'request\x20sent');logger[_0xb867('0x12')](_0xb867('0x13'),_0x4ab3f1,'request\x20sent',JSON['stringify'](_0x5e43e1));if(_0x5e43e1[_0xb867('0x14')]){if(_0x5e43e1[_0xb867('0x14')][_0xb867('0x15')]===0x1f4){logger[_0xb867('0x14')](_0xb867('0x11'),_0x4ab3f1,_0x5e43e1['error'][_0xb867('0x16')]);return _0x301e8d(_0x5e43e1['error']['message']);}logger[_0xb867('0x14')](_0xb867('0x11'),_0x4ab3f1,_0x5e43e1[_0xb867('0x14')][_0xb867('0x16')]);return _0x3951e8(_0x5e43e1[_0xb867('0x14')][_0xb867('0x16')]);}else{logger[_0xb867('0x10')](_0xb867('0x11'),_0x4ab3f1,_0xb867('0x17'));_0x3951e8(_0x5e43e1['result'][_0xb867('0x16')]);}})[_0xb867('0x18')](function(_0x4b4563){logger[_0xb867('0x14')](_0xb867('0x11'),_0x4ab3f1,_0x4b4563);_0x301e8d(_0x4b4563);});});}exports[_0xb867('0x19')]=function(_0x5c2dea){var _0x42745f=this;return new Promise(function(_0x218199,_0x49ba4f){return db[_0xb867('0x1a')][_0xb867('0x1b')]({'raw':_0x5c2dea[_0xb867('0x1c')]?_0x5c2dea[_0xb867('0x1c')][_0xb867('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c2dea[_0xb867('0x1c')]?_0x5c2dea['options'][_0xb867('0x1e')]||null:null,'attributes':_0x5c2dea[_0xb867('0x1c')]?_0x5c2dea[_0xb867('0x1c')][_0xb867('0x1f')]||null:null,'limit':_0x5c2dea['options']?_0x5c2dea[_0xb867('0x1c')][_0xb867('0x20')]||null:null,'include':_0x5c2dea[_0xb867('0x1c')]?_0x5c2dea[_0xb867('0x1c')][_0xb867('0x21')]?_[_0xb867('0x22')](_0x5c2dea[_0xb867('0x1c')][_0xb867('0x21')],function(_0x4997d3){return{'model':db[_0x4997d3[_0xb867('0x23')]],'as':_0x4997d3['as'],'attributes':_0x4997d3['attributes'],'include':_0x4997d3['include']?_[_0xb867('0x22')](_0x4997d3[_0xb867('0x21')],function(_0x1a94cb){return{'model':db[_0x1a94cb[_0xb867('0x23')]],'as':_0x1a94cb['as'],'attributes':_0x1a94cb[_0xb867('0x1f')],'include':_0x1a94cb[_0xb867('0x21')]?_[_0xb867('0x22')](_0x1a94cb[_0xb867('0x21')],function(_0x20066c){return{'model':db[_0x20066c[_0xb867('0x23')]],'as':_0x20066c['as'],'attributes':_0x20066c[_0xb867('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1563ca){logger[_0xb867('0x10')](_0xb867('0x19'),_0x5c2dea);logger[_0xb867('0x12')](_0xb867('0x19'),_0x5c2dea,JSON[_0xb867('0x24')](_0x1563ca));_0x218199(_0x1563ca);})[_0xb867('0x18')](function(_0x4585c6){logger[_0xb867('0x14')](_0xb867('0x19'),_0x4585c6[_0xb867('0x16')],_0x5c2dea);_0x49ba4f(_0x42745f[_0xb867('0x14')](0x1f4,_0x4585c6[_0xb867('0x16')]));});});};exports['ShowVoiceQueue']=function(_0x1766ca){var _0x5c794a=this;return new Promise(function(_0x158737,_0x54a2f7){return db[_0xb867('0x1a')]['find']({'raw':_0x1766ca[_0xb867('0x1c')]?_0x1766ca[_0xb867('0x1c')][_0xb867('0x1d')]===undefined?!![]:![]:!![],'where':_0x1766ca[_0xb867('0x1c')]?_0x1766ca[_0xb867('0x1c')][_0xb867('0x1e')]||null:null,'attributes':_0x1766ca[_0xb867('0x1c')]?_0x1766ca[_0xb867('0x1c')][_0xb867('0x1f')]||null:null,'include':_0x1766ca[_0xb867('0x1c')]?_0x1766ca[_0xb867('0x1c')][_0xb867('0x21')]?_[_0xb867('0x22')](_0x1766ca[_0xb867('0x1c')]['include'],function(_0x1cb542){return{'model':db[_0x1cb542[_0xb867('0x23')]],'as':_0x1cb542['as'],'attributes':_0x1cb542[_0xb867('0x1f')],'include':_0x1cb542['include']?_['map'](_0x1cb542['include'],function(_0x27f279){return{'model':db[_0x27f279[_0xb867('0x23')]],'as':_0x27f279['as'],'attributes':_0x27f279[_0xb867('0x1f')],'include':_0x27f279[_0xb867('0x21')]?_[_0xb867('0x22')](_0x27f279[_0xb867('0x21')],function(_0xc63b51){return{'model':db[_0xc63b51[_0xb867('0x23')]],'as':_0xc63b51['as'],'attributes':_0xc63b51[_0xb867('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb867('0xf')](function(_0x58af54){logger[_0xb867('0x10')](_0xb867('0x25'),_0x1766ca);logger['debug'](_0xb867('0x25'),_0x1766ca,JSON[_0xb867('0x24')](_0x58af54));_0x158737(_0x58af54);})['catch'](function(_0x516ee9){logger[_0xb867('0x14')](_0xb867('0x25'),_0x516ee9['message'],_0x1766ca);_0x54a2f7(_0x5c794a[_0xb867('0x14')](0x1f4,_0x516ee9[_0xb867('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 02732e6..e6b2fe5 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 _0x7282=['voiceQueue:','./voiceQueue.events','save','update','emit','register','length'];(function(_0x186bf3,_0x561e6f){var _0xb0335d=function(_0x31dd58){while(--_0x31dd58){_0x186bf3['push'](_0x186bf3['shift']());}};_0xb0335d(++_0x561e6f);}(_0x7282,0x1a5));var _0x2728=function(_0x58a4b5,_0x182439){_0x58a4b5=_0x58a4b5-0x0;var _0x51821d=_0x7282[_0x58a4b5];return _0x51821d;};'use strict';var VoiceQueueEvents=require(_0x2728('0x0'));var events=[_0x2728('0x1'),'remove',_0x2728('0x2')];function createListener(_0x2248f6,_0x434dfc){return function(_0x2faee3){_0x434dfc[_0x2728('0x3')](_0x2248f6,_0x2faee3);};}function removeListener(_0x5963e3,_0x30b40b){return function(){VoiceQueueEvents['removeListener'](_0x5963e3,_0x30b40b);};}exports[_0x2728('0x4')]=function(_0x571287){for(var _0x5d21eb=0x0,_0x250d35=events[_0x2728('0x5')];_0x5d21eb<_0x250d35;_0x5d21eb++){var _0x8472e=events[_0x5d21eb];var _0x4cf9a6=createListener(_0x2728('0x6')+_0x8472e,_0x571287);VoiceQueueEvents['on'](_0x8472e,_0x4cf9a6);}}; \ No newline at end of file +var _0xed82=['update','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x10b182,_0x4bbdd2){var _0x30a865=function(_0x45c856){while(--_0x45c856){_0x10b182['push'](_0x10b182['shift']());}};_0x30a865(++_0x4bbdd2);}(_0xed82,0x1a6));var _0x2ed8=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xed82[_0x4b369d];return _0x571a98;};'use strict';var VoiceQueueEvents=require(_0x2ed8('0x0'));var events=[_0x2ed8('0x1'),'remove',_0x2ed8('0x2')];function createListener(_0xc19548,_0x59ea81){return function(_0x8b4b1f){_0x59ea81[_0x2ed8('0x3')](_0xc19548,_0x8b4b1f);};}function removeListener(_0x7e44e2,_0x6153c6){return function(){VoiceQueueEvents[_0x2ed8('0x4')](_0x7e44e2,_0x6153c6);};}exports[_0x2ed8('0x5')]=function(_0x15c8cb){for(var _0x17dfbc=0x0,_0x42fb31=events[_0x2ed8('0x6')];_0x17dfbc<_0x42fb31;_0x17dfbc++){var _0x1fcb8e=events[_0x17dfbc];var _0x2dbd5b=createListener(_0x2ed8('0x7')+_0x1fcb8e,_0x15c8cb);VoiceQueueEvents['on'](_0x1fcb8e,_0x2dbd5b);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 7f7c205..ba6851c 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 _0x5ad1=['./voiceQueueReport.controller','get','isAuthenticated','index','/describe','/index','show','post','put','/:id','update','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x487496,_0x249683){var _0x539dc8=function(_0x2c38e1){while(--_0x2c38e1){_0x487496['push'](_0x487496['shift']());}};_0x539dc8(++_0x249683);}(_0x5ad1,0x12c));var _0x15ad=function(_0x5279eb,_0x3fd7ed){_0x5279eb=_0x5279eb-0x0;var _0x2ee4d2=_0x5ad1[_0x5279eb];return _0x2ee4d2;};'use strict';var multer=require(_0x15ad('0x0'));var util=require(_0x15ad('0x1'));var path=require('path');var timeout=require(_0x15ad('0x2'));var express=require('express');var router=express[_0x15ad('0x3')]();var fs_extra=require(_0x15ad('0x4'));var auth=require(_0x15ad('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x15ad('0x6'));router[_0x15ad('0x7')]('/',auth[_0x15ad('0x8')](),controller[_0x15ad('0x9')]);router[_0x15ad('0x7')](_0x15ad('0xa'),auth[_0x15ad('0x8')](),controller['describe']);router[_0x15ad('0x7')](_0x15ad('0xb'),auth[_0x15ad('0x8')](),controller['getVoiceQueuesReport']);router[_0x15ad('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x15ad('0xc')]);router[_0x15ad('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x15ad('0xe')](_0x15ad('0xf'),auth[_0x15ad('0x8')](),controller[_0x15ad('0x10')]);router['delete'](_0x15ad('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x15ad('0x11')]=router; \ No newline at end of file +var _0xa65a=['describe','/index','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xa65a,0xe3));var _0xaa65=function(_0x45f7b0,_0x50c334){_0x45f7b0=_0x45f7b0-0x0;var _0x58289f=_0xa65a[_0x45f7b0];return _0x58289f;};'use strict';var multer=require(_0xaa65('0x0'));var util=require(_0xaa65('0x1'));var path=require(_0xaa65('0x2'));var timeout=require(_0xaa65('0x3'));var express=require(_0xaa65('0x4'));var router=express[_0xaa65('0x5')]();var fs_extra=require(_0xaa65('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xaa65('0x7'));var config=require(_0xaa65('0x8'));var controller=require(_0xaa65('0x9'));router[_0xaa65('0xa')]('/',auth[_0xaa65('0xb')](),controller[_0xaa65('0xc')]);router[_0xaa65('0xa')]('/describe',auth[_0xaa65('0xb')](),controller[_0xaa65('0xd')]);router[_0xaa65('0xa')](_0xaa65('0xe'),auth[_0xaa65('0xb')](),controller[_0xaa65('0xf')]);router[_0xaa65('0xa')](_0xaa65('0x10'),auth[_0xaa65('0xb')](),controller[_0xaa65('0x11')]);router[_0xaa65('0x12')]('/',auth[_0xaa65('0xb')](),controller[_0xaa65('0x13')]);router[_0xaa65('0x14')](_0xaa65('0x10'),auth[_0xaa65('0xb')](),controller[_0xaa65('0x15')]);router[_0xaa65('0x16')](_0xaa65('0x10'),auth[_0xaa65('0xb')](),controller[_0xaa65('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 4a6fe53..0e13b25 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 _0x4a5b=['sequelize','moment','exports','STRING','DATE','getDataValue','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x1f63d2,_0x417963){var _0xe7496c=function(_0x105fe6){while(--_0x105fe6){_0x1f63d2['push'](_0x1f63d2['shift']());}};_0xe7496c(++_0x417963);}(_0x4a5b,0x142));var _0xb4a5=function(_0x19def0,_0x1e4a3b){_0x19def0=_0x19def0-0x0;var _0x50e7e8=_0x4a5b[_0x19def0];return _0x50e7e8;};'use strict';var Sequelize=require(_0xb4a5('0x0'));var moment=require(_0xb4a5('0x1'));module[_0xb4a5('0x2')]={'type':{'type':Sequelize[_0xb4a5('0x3')]},'uniqueid':{'type':Sequelize[_0xb4a5('0x3')]},'calleridnum':{'type':Sequelize[_0xb4a5('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xb4a5('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xb4a5('0x4')],'set':function(_0x2cc6d4){var _0x256754=moment(_0x2cc6d4);var _0x3e20da=moment(this[_0xb4a5('0x5')]('queuecallerjoinAt'))[_0xb4a5('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x14f78a=_0x256754[_0xb4a5('0x7')](_0x3e20da,_0xb4a5('0x8'));this[_0xb4a5('0x9')](_0xb4a5('0xa'),_0x2cc6d4);this[_0xb4a5('0x9')](_0xb4a5('0xb'),_0x14f78a||null);}},'position':{'type':Sequelize[_0xb4a5('0xc')]},'count':{'type':Sequelize[_0xb4a5('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xb4a5('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xb4a5('0x4')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xb4a5('0x4')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb4a5('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0xb4a5('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xb4a5('0xc')]},'channel':{'type':Sequelize[_0xb4a5('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb4a5('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb4a5('0x3')]},'exten':{'type':Sequelize[_0xb4a5('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xb4a5('0xc')]},'mohtime':{'type':Sequelize[_0xb4a5('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb4a5('0x3')]},'transfer':{'type':Sequelize[_0xb4a5('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xb4a5('0x3')]},'transferuniqueid':{'type':Sequelize[_0xb4a5('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xb4a5('0x3')]},'thirdDisposition':{'type':Sequelize[_0xb4a5('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xb4a5('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2dd7=['BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','queuecallerleaveAt','holdtime','INTEGER'];(function(_0x5097b,_0x337d8a){var _0x5306c7=function(_0x35ed1f){while(--_0x35ed1f){_0x5097b['push'](_0x5097b['shift']());}};_0x5306c7(++_0x337d8a);}(_0x2dd7,0x120));var _0x72dd=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x2dd7[_0x4b73a2];return _0x383c66;};'use strict';var Sequelize=require(_0x72dd('0x0'));var moment=require(_0x72dd('0x1'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x72dd('0x2')]},'calleridnum':{'type':Sequelize[_0x72dd('0x2')]},'calleridname':{'type':Sequelize[_0x72dd('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x72dd('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x72dd('0x3')],'set':function(_0x155c05){var _0x5691ff=moment(_0x155c05);var _0x41dec8=moment(this[_0x72dd('0x4')](_0x72dd('0x5')))[_0x72dd('0x6')](_0x72dd('0x7'));var _0xfec918=_0x5691ff['diff'](_0x41dec8,'seconds');this[_0x72dd('0x8')](_0x72dd('0x9'),_0x155c05);this[_0x72dd('0x8')](_0x72dd('0xa'),_0xfec918||null);}},'position':{'type':Sequelize[_0x72dd('0xb')]},'count':{'type':Sequelize[_0x72dd('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x72dd('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x72dd('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x72dd('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x72dd('0x3')]},'queuecallerexit':{'type':Sequelize[_0x72dd('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x72dd('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x72dd('0x2')],'comment':_0x72dd('0xd')},'originalposition':{'type':Sequelize[_0x72dd('0xb')]},'channel':{'type':Sequelize[_0x72dd('0x2')]},'connectedlinenum':{'type':Sequelize[_0x72dd('0x2')]},'connectedlinename':{'type':Sequelize[_0x72dd('0x2')]},'accountcode':{'type':Sequelize[_0x72dd('0x2')]},'context':{'type':Sequelize[_0x72dd('0x2')]},'exten':{'type':Sequelize[_0x72dd('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x72dd('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x72dd('0x2')]},'transfer':{'type':Sequelize[_0x72dd('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x72dd('0x2')],'comment':_0x72dd('0xe')},'transferexten':{'type':Sequelize[_0x72dd('0x2')]},'transferuniqueid':{'type':Sequelize[_0x72dd('0x2')]},'disposition':{'type':Sequelize[_0x72dd('0x2')]},'secondDisposition':{'type':Sequelize[_0x72dd('0x2')]},'thirdDisposition':{'type':Sequelize[_0x72dd('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'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 117ec2e..fa63a57 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 _0xc9cb=['merge','VIRTUAL','include','findAll','rows','catch','params','includeAll','create','body','update','find','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','save','then','destroy','end','error','stack','send','index','map','VoiceQueueReport','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x25a139,_0x4452c0){var _0x5d62df=function(_0x7a46a0){while(--_0x7a46a0){_0x25a139['push'](_0x25a139['shift']());}};_0x5d62df(++_0x4452c0);}(_0xc9cb,0x146));var _0xbc9c=function(_0x3ab924,_0x509b75){_0x3ab924=_0x3ab924-0x0;var _0x36c64d=_0xc9cb[_0x3ab924];return _0x36c64d;};'use strict';var emlformat=require(_0xbc9c('0x0'));var rimraf=require(_0xbc9c('0x1'));var zipdir=require(_0xbc9c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc9c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbc9c('0x4'));var util=require(_0xbc9c('0x5'));var path=require('path');var sox=require(_0xbc9c('0x6'));var csv=require(_0xbc9c('0x7'));var ejs=require(_0xbc9c('0x8'));var fs=require('fs');var fs_extra=require(_0xbc9c('0x9'));var _=require(_0xbc9c('0xa'));var squel=require(_0xbc9c('0xb'));var crypto=require('crypto');var jsforce=require(_0xbc9c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbc9c('0x7'));var querystring=require('querystring');var Papa=require(_0xbc9c('0xd'));var Redis=require(_0xbc9c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xbc9c('0xf'));var as=require(_0xbc9c('0x10'));var hardwareService=require(_0xbc9c('0x11'));var logger=require(_0xbc9c('0x12'))(_0xbc9c('0x13'));var utils=require(_0xbc9c('0x14'));var config=require(_0xbc9c('0x15'));var licenseUtil=require(_0xbc9c('0x16'));var db=require(_0xbc9c('0x17'))['db'];config[_0xbc9c('0x18')]=_['defaults'](config[_0xbc9c('0x18')],{'host':_0xbc9c('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbc9c('0x18')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x37ae37,_0x49964f){_0x49964f=_0x49964f||0xcc;return function(_0x292634){if(_0x292634){return _0x37ae37[_0xbc9c('0x1a')](_0x49964f);}return _0x37ae37[_0xbc9c('0x1b')](_0x49964f)['end']();};}function respondWithResult(_0x14ffe6,_0x47b8d9){_0x47b8d9=_0x47b8d9||0xc8;return function(_0xa3c680){if(_0xa3c680){return _0x14ffe6['status'](_0x47b8d9)[_0xbc9c('0x1c')](_0xa3c680);}};}function respondWithFilteredResult(_0x229621,_0x2d8450){return function(_0x4f32b0){if(_0x4f32b0){var _0xc4464f=typeof _0x2d8450[_0xbc9c('0x1d')]===_0xbc9c('0x1e')&&typeof _0x2d8450['limit']===_0xbc9c('0x1e');var _0x2e8054=_0x4f32b0[_0xbc9c('0x1f')];var _0x46dc8a=_0xc4464f?0x0:_0x2d8450[_0xbc9c('0x1d')];var _0x3f1c94=_0xc4464f?_0x4f32b0[_0xbc9c('0x1f')]:_0x2d8450['offset']+_0x2d8450[_0xbc9c('0x20')];var _0x2ff449;if(_0x3f1c94>=_0x2e8054){_0x3f1c94=_0x2e8054;_0x2ff449=0xc8;}else{_0x2ff449=0xce;}_0x229621[_0xbc9c('0x1b')](_0x2ff449);return _0x229621[_0xbc9c('0x21')](_0xbc9c('0x22'),_0x46dc8a+'-'+_0x3f1c94+'/'+_0x2e8054)[_0xbc9c('0x1c')](_0x4f32b0);}return null;};}function patchUpdates(_0x55d15e){return function(_0x3ea187){try{jsonpatch['apply'](_0x3ea187,_0x55d15e,!![]);}catch(_0x5265ee){return BPromise['reject'](_0x5265ee);}return _0x3ea187[_0xbc9c('0x23')]();};}function saveUpdates(_0xee7043,_0x49f3c9){return function(_0x200614){if(_0x200614){return _0x200614['update'](_0xee7043)[_0xbc9c('0x24')](function(_0x32e68b){return _0x32e68b;});}return null;};}function removeEntity(_0x10fbf2,_0x52a256){return function(_0x13506b){if(_0x13506b){return _0x13506b[_0xbc9c('0x25')]()['then'](function(){_0x10fbf2[_0xbc9c('0x1b')](0xcc)[_0xbc9c('0x26')]();});}};}function handleEntityNotFound(_0x276159,_0x1a7d65){return function(_0x4d0354){if(!_0x4d0354){_0x276159['sendStatus'](0x194);}return _0x4d0354;};}function handleError(_0x443956,_0x10af6f){_0x10af6f=_0x10af6f||0x1f4;return function(_0x3c57a7){logger[_0xbc9c('0x27')](_0x3c57a7[_0xbc9c('0x28')]);if(_0x3c57a7['name']){delete _0x3c57a7['name'];}_0x443956['status'](_0x10af6f)[_0xbc9c('0x29')](_0x3c57a7);};}exports[_0xbc9c('0x2a')]=function(_0x547438,_0x5b0714){var _0x1bb2b2={},_0xea26={},_0x2b37e1={'count':0x0,'rows':[]};var _0x4232c3=_[_0xbc9c('0x2b')](db[_0xbc9c('0x2c')][_0xbc9c('0x2d')],function(_0x1cd5ee){return{'name':_0x1cd5ee['fieldName'],'type':_0x1cd5ee[_0xbc9c('0x2e')][_0xbc9c('0x2f')]};});_0xea26[_0xbc9c('0x30')]=_[_0xbc9c('0x2b')](_0x4232c3,_0xbc9c('0x31'));_0xea26[_0xbc9c('0x32')]=_[_0xbc9c('0x33')](_0x547438[_0xbc9c('0x32')]);_0xea26[_0xbc9c('0x34')]=_[_0xbc9c('0x35')](_0xea26[_0xbc9c('0x30')],_0xea26[_0xbc9c('0x32')]);_0x1bb2b2[_0xbc9c('0x36')]=_[_0xbc9c('0x35')](_0xea26[_0xbc9c('0x30')],qs['fields'](_0x547438[_0xbc9c('0x32')][_0xbc9c('0x37')]));_0x1bb2b2['attributes']=_0x1bb2b2[_0xbc9c('0x36')][_0xbc9c('0x38')]?_0x1bb2b2['attributes']:_0xea26['model'];if(!_0x547438['query'][_0xbc9c('0x39')](_0xbc9c('0x3a'))){_0x1bb2b2[_0xbc9c('0x20')]=qs[_0xbc9c('0x20')](_0x547438[_0xbc9c('0x32')]['limit']);_0x1bb2b2[_0xbc9c('0x1d')]=qs['offset'](_0x547438[_0xbc9c('0x32')][_0xbc9c('0x1d')]);}_0x1bb2b2[_0xbc9c('0x3b')]=qs[_0xbc9c('0x3c')](_0x547438['query']['sort']);_0x1bb2b2[_0xbc9c('0x3d')]=qs[_0xbc9c('0x34')](_[_0xbc9c('0x3e')](_0x547438[_0xbc9c('0x32')],_0xea26[_0xbc9c('0x34')]),_0x4232c3);if(_0x547438[_0xbc9c('0x32')][_0xbc9c('0x3f')]){_0x1bb2b2['where']=_[_0xbc9c('0x40')](_0x1bb2b2['where'],{'$or':_[_0xbc9c('0x2b')](_0x4232c3,function(_0x525d9e){if(_0x525d9e[_0xbc9c('0x2e')]!==_0xbc9c('0x41')){var _0x5ef95e={};_0x5ef95e[_0x525d9e[_0xbc9c('0x31')]]={'$like':'%'+_0x547438[_0xbc9c('0x32')][_0xbc9c('0x3f')]+'%'};return _0x5ef95e;}})});}_0x1bb2b2=_['merge']({},_0x1bb2b2,_0x547438['options']);var _0x25332e={'where':_0x1bb2b2[_0xbc9c('0x3d')]};return db[_0xbc9c('0x2c')][_0xbc9c('0x1f')](_0x25332e)[_0xbc9c('0x24')](function(_0x2976e6){_0x2b37e1[_0xbc9c('0x1f')]=_0x2976e6;if(_0x547438[_0xbc9c('0x32')]['includeAll']){_0x1bb2b2[_0xbc9c('0x42')]=[{'all':!![]}];}return db[_0xbc9c('0x2c')][_0xbc9c('0x43')](_0x1bb2b2);})[_0xbc9c('0x24')](function(_0x553162){_0x2b37e1[_0xbc9c('0x44')]=_0x553162;return _0x2b37e1;})[_0xbc9c('0x24')](respondWithFilteredResult(_0x5b0714,_0x1bb2b2))[_0xbc9c('0x45')](handleError(_0x5b0714,null));};exports['show']=function(_0x4a4d29,_0x3e845c){var _0x5b2f78={'raw':![],'where':{'id':_0x4a4d29[_0xbc9c('0x46')]['id']}},_0x3a2984={};_0x3a2984[_0xbc9c('0x30')]=_['keys'](db['VoiceQueueReport'][_0xbc9c('0x2d')]);_0x3a2984['query']=_['keys'](_0x4a4d29[_0xbc9c('0x32')]);_0x3a2984[_0xbc9c('0x34')]=_[_0xbc9c('0x35')](_0x3a2984[_0xbc9c('0x30')],_0x3a2984[_0xbc9c('0x32')]);_0x5b2f78[_0xbc9c('0x36')]=_['intersection'](_0x3a2984[_0xbc9c('0x30')],qs['fields'](_0x4a4d29[_0xbc9c('0x32')][_0xbc9c('0x37')]));_0x5b2f78[_0xbc9c('0x36')]=_0x5b2f78['attributes']['length']?_0x5b2f78['attributes']:_0x3a2984[_0xbc9c('0x30')];if(_0x4a4d29[_0xbc9c('0x32')][_0xbc9c('0x47')]){_0x5b2f78[_0xbc9c('0x42')]=[{'all':!![]}];}_0x5b2f78=_['merge']({},_0x5b2f78,_0x4a4d29['options']);return db['VoiceQueueReport']['find'](_0x5b2f78)[_0xbc9c('0x24')](handleEntityNotFound(_0x3e845c,null))['then'](respondWithResult(_0x3e845c,null))[_0xbc9c('0x45')](handleError(_0x3e845c,null));};exports[_0xbc9c('0x48')]=function(_0x300fa2,_0x586fb2){return db[_0xbc9c('0x2c')][_0xbc9c('0x48')](_0x300fa2[_0xbc9c('0x49')],{})[_0xbc9c('0x24')](respondWithResult(_0x586fb2,0xc9))['catch'](handleError(_0x586fb2,null));};exports[_0xbc9c('0x4a')]=function(_0x3849e4,_0x46b216){if(_0x3849e4[_0xbc9c('0x49')]['id']){delete _0x3849e4[_0xbc9c('0x49')]['id'];}return db['VoiceQueueReport'][_0xbc9c('0x4b')]({'where':{'id':_0x3849e4[_0xbc9c('0x46')]['id']}})[_0xbc9c('0x24')](handleEntityNotFound(_0x46b216,null))[_0xbc9c('0x24')](saveUpdates(_0x3849e4[_0xbc9c('0x49')],null))[_0xbc9c('0x24')](respondWithResult(_0x46b216,null))['catch'](handleError(_0x46b216,null));};exports[_0xbc9c('0x25')]=function(_0x1b1fb0,_0x50d2f5){return db[_0xbc9c('0x2c')][_0xbc9c('0x4b')]({'where':{'id':_0x1b1fb0[_0xbc9c('0x46')]['id']}})[_0xbc9c('0x24')](handleEntityNotFound(_0x50d2f5,null))[_0xbc9c('0x24')](removeEntity(_0x50d2f5,null))['catch'](handleError(_0x50d2f5,null));};exports[_0xbc9c('0x4c')]=function(_0x14a881,_0x2fe7e4){return db[_0xbc9c('0x2c')][_0xbc9c('0x4c')]()[_0xbc9c('0x24')](respondWithResult(_0x2fe7e4,null))[_0xbc9c('0x45')](handleError(_0x2fe7e4,null));};exports[_0xbc9c('0x4d')]=function(_0x558f8f,_0x2f25bf){var _0x143e92={},_0x343a32={},_0x48c93b={'count':0x0,'rows':[]};_0x343a32[_0xbc9c('0x30')]=_[_0xbc9c('0x33')](db[_0xbc9c('0x2c')]['rawAttributes']);_0x343a32['query']=_['keys'](_0x558f8f['query']);_0x343a32['filters']=_[_0xbc9c('0x35')](_0x343a32[_0xbc9c('0x30')],_0x343a32['query']);_0x143e92[_0xbc9c('0x36')]=_[_0xbc9c('0x35')](_0x343a32[_0xbc9c('0x30')],qs[_0xbc9c('0x37')](_0x558f8f[_0xbc9c('0x32')][_0xbc9c('0x37')]));_0x143e92[_0xbc9c('0x36')]=_0x143e92[_0xbc9c('0x36')][_0xbc9c('0x38')]?_0x143e92[_0xbc9c('0x36')]:_0x343a32[_0xbc9c('0x30')];if(!_0x558f8f['query'][_0xbc9c('0x39')](_0xbc9c('0x3a'))){_0x143e92[_0xbc9c('0x20')]=qs[_0xbc9c('0x20')](_0x558f8f[_0xbc9c('0x32')][_0xbc9c('0x20')]);_0x143e92['offset']=qs[_0xbc9c('0x1d')](_0x558f8f['query'][_0xbc9c('0x1d')]);}_0x143e92['order']=qs[_0xbc9c('0x3c')](_0x558f8f[_0xbc9c('0x32')][_0xbc9c('0x3c')]);_0x143e92['where']=qs[_0xbc9c('0x34')](_[_0xbc9c('0x3e')](_0x558f8f[_0xbc9c('0x32')],_0x343a32[_0xbc9c('0x34')]));if(_0x558f8f[_0xbc9c('0x32')]['filter']){_0x143e92['where']=_['merge'](_0x143e92[_0xbc9c('0x3d')],{'$or':_['map'](_0x143e92[_0xbc9c('0x36')],function(_0x2ae081){var _0x38209c={};_0x38209c[_0x2ae081]={'$like':'%'+_0x558f8f['query']['filter']+'%'};return _0x38209c;})});}_0x143e92=_['merge']({},_0x143e92,_0x558f8f['options']);var _0xecdaa9={'where':_0x143e92[_0xbc9c('0x3d')]};return db[_0xbc9c('0x2c')][_0xbc9c('0x1f')](_0xecdaa9)[_0xbc9c('0x24')](function(_0x2730cc){_0x48c93b[_0xbc9c('0x1f')]=_0x2730cc;if(_0x558f8f[_0xbc9c('0x32')]['includeAll']){_0x143e92[_0xbc9c('0x42')]=[{'all':!![]}];}return db[_0xbc9c('0x2c')][_0xbc9c('0x43')](_0x143e92);})[_0xbc9c('0x24')](function(_0x214752){_0x48c93b[_0xbc9c('0x44')]=_0x214752;return _0x48c93b;})['then'](respondWithFilteredResult(_0x2f25bf,_0x143e92,_0xbc9c('0x4d')))[_0xbc9c('0x45')](handleError(_0x2f25bf,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x9486=['findAll','catch','show','params','length','find','create','body','describe','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include'];(function(_0x254b13,_0x38c4a3){var _0x1de3cc=function(_0x27de8b){while(--_0x27de8b){_0x254b13['push'](_0x254b13['shift']());}};_0x1de3cc(++_0x38c4a3);}(_0x9486,0xfa));var _0x6948=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9486[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0x6948('0x0'));var rimraf=require(_0x6948('0x1'));var zipdir=require(_0x6948('0x2'));var jsonpatch=require(_0x6948('0x3'));var rp=require(_0x6948('0x4'));var moment=require(_0x6948('0x5'));var BPromise=require(_0x6948('0x6'));var Mustache=require(_0x6948('0x7'));var util=require(_0x6948('0x8'));var path=require(_0x6948('0x9'));var sox=require(_0x6948('0xa'));var csv=require(_0x6948('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6948('0xc'));var _=require(_0x6948('0xd'));var squel=require(_0x6948('0xe'));var crypto=require(_0x6948('0xf'));var jsforce=require(_0x6948('0x10'));var deskjs=require(_0x6948('0x11'));var toCsv=require('to-csv');var querystring=require(_0x6948('0x12'));var Papa=require(_0x6948('0x13'));var Redis=require(_0x6948('0x14'));var authService=require(_0x6948('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6948('0x16'))(_0x6948('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6948('0x18'))['db'];config[_0x6948('0x19')]=_['defaults'](config['redis'],{'host':_0x6948('0x1a'),'port':0x18eb});var socket=require(_0x6948('0x1b'))(new Redis(config[_0x6948('0x19')]));require(_0x6948('0x1c'))[_0x6948('0x1d')](socket);function respondWithStatusCode(_0x11b055,_0x5d3e64){_0x5d3e64=_0x5d3e64||0xcc;return function(_0x54958d){if(_0x54958d){return _0x11b055[_0x6948('0x1e')](_0x5d3e64);}return _0x11b055[_0x6948('0x1f')](_0x5d3e64)[_0x6948('0x20')]();};}function respondWithResult(_0x26089b,_0x5cd943){_0x5cd943=_0x5cd943||0xc8;return function(_0x35f317){if(_0x35f317){return _0x26089b['status'](_0x5cd943)[_0x6948('0x21')](_0x35f317);}};}function respondWithFilteredResult(_0x5b736d,_0x14bd5e){return function(_0x4a743c){if(_0x4a743c){var _0x94c170=typeof _0x14bd5e[_0x6948('0x22')]==='undefined'&&typeof _0x14bd5e[_0x6948('0x23')]===_0x6948('0x24');var _0x269a23=_0x4a743c['count'];var _0x98c6c1=_0x94c170?0x0:_0x14bd5e[_0x6948('0x22')];var _0x3f9ec8=_0x94c170?_0x4a743c[_0x6948('0x25')]:_0x14bd5e[_0x6948('0x22')]+_0x14bd5e[_0x6948('0x23')];var _0x2c21f0;if(_0x3f9ec8>=_0x269a23){_0x3f9ec8=_0x269a23;_0x2c21f0=0xc8;}else{_0x2c21f0=0xce;}_0x5b736d[_0x6948('0x1f')](_0x2c21f0);return _0x5b736d[_0x6948('0x26')]('Content-Range',_0x98c6c1+'-'+_0x3f9ec8+'/'+_0x269a23)[_0x6948('0x21')](_0x4a743c);}return null;};}function patchUpdates(_0x415027){return function(_0x402463){try{jsonpatch[_0x6948('0x27')](_0x402463,_0x415027,!![]);}catch(_0x2478ca){return BPromise[_0x6948('0x28')](_0x2478ca);}return _0x402463[_0x6948('0x29')]();};}function saveUpdates(_0x5aa7f8,_0x564c65){return function(_0x4d0173){if(_0x4d0173){return _0x4d0173[_0x6948('0x2a')](_0x5aa7f8)['then'](function(_0x39b724){return _0x39b724;});}return null;};}function removeEntity(_0x1f5b6d,_0x23d9e9){return function(_0x1f51b5){if(_0x1f51b5){return _0x1f51b5['destroy']()[_0x6948('0x2b')](function(){_0x1f5b6d[_0x6948('0x1f')](0xcc)[_0x6948('0x20')]();});}};}function handleEntityNotFound(_0x98d7da,_0x534e7e){return function(_0x180501){if(!_0x180501){_0x98d7da[_0x6948('0x1e')](0x194);}return _0x180501;};}function handleError(_0x6235cc,_0x102fbb){_0x102fbb=_0x102fbb||0x1f4;return function(_0x715327){logger['error'](_0x715327['stack']);if(_0x715327[_0x6948('0x2c')]){delete _0x715327['name'];}_0x6235cc[_0x6948('0x1f')](_0x102fbb)[_0x6948('0x2d')](_0x715327);};}exports[_0x6948('0x2e')]=function(_0x2e8b75,_0x2e2266){var _0x4f4ef5={},_0x523c04={},_0x5249c1={'count':0x0,'rows':[]};var _0x29cf11=_['map'](db[_0x6948('0x2f')][_0x6948('0x30')],function(_0x168e50){return{'name':_0x168e50[_0x6948('0x31')],'type':_0x168e50[_0x6948('0x32')]['key']};});_0x523c04['model']=_[_0x6948('0x33')](_0x29cf11,_0x6948('0x2c'));_0x523c04[_0x6948('0x34')]=_[_0x6948('0x35')](_0x2e8b75[_0x6948('0x34')]);_0x523c04[_0x6948('0x36')]=_[_0x6948('0x37')](_0x523c04[_0x6948('0x38')],_0x523c04['query']);_0x4f4ef5[_0x6948('0x39')]=_[_0x6948('0x37')](_0x523c04[_0x6948('0x38')],qs[_0x6948('0x3a')](_0x2e8b75[_0x6948('0x34')]['fields']));_0x4f4ef5[_0x6948('0x39')]=_0x4f4ef5[_0x6948('0x39')]['length']?_0x4f4ef5[_0x6948('0x39')]:_0x523c04[_0x6948('0x38')];if(!_0x2e8b75[_0x6948('0x34')][_0x6948('0x3b')](_0x6948('0x3c'))){_0x4f4ef5['limit']=qs['limit'](_0x2e8b75['query'][_0x6948('0x23')]);_0x4f4ef5[_0x6948('0x22')]=qs[_0x6948('0x22')](_0x2e8b75['query'][_0x6948('0x22')]);}_0x4f4ef5[_0x6948('0x3d')]=qs[_0x6948('0x3e')](_0x2e8b75['query']['sort']);_0x4f4ef5['where']=qs['filters'](_['pick'](_0x2e8b75['query'],_0x523c04[_0x6948('0x36')]),_0x29cf11);if(_0x2e8b75[_0x6948('0x34')][_0x6948('0x3f')]){_0x4f4ef5[_0x6948('0x40')]=_[_0x6948('0x41')](_0x4f4ef5[_0x6948('0x40')],{'$or':_[_0x6948('0x33')](_0x29cf11,function(_0x268bc4){if(_0x268bc4[_0x6948('0x32')]!==_0x6948('0x42')){var _0x4fda07={};_0x4fda07[_0x268bc4[_0x6948('0x2c')]]={'$like':'%'+_0x2e8b75[_0x6948('0x34')][_0x6948('0x3f')]+'%'};return _0x4fda07;}})});}_0x4f4ef5=_[_0x6948('0x41')]({},_0x4f4ef5,_0x2e8b75[_0x6948('0x43')]);var _0x52122f={'where':_0x4f4ef5[_0x6948('0x40')]};return db['VoiceQueueReport'][_0x6948('0x25')](_0x52122f)['then'](function(_0x11d6f9){_0x5249c1[_0x6948('0x25')]=_0x11d6f9;if(_0x2e8b75[_0x6948('0x34')][_0x6948('0x44')]){_0x4f4ef5[_0x6948('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6948('0x46')](_0x4f4ef5);})[_0x6948('0x2b')](function(_0x5ceca2){_0x5249c1['rows']=_0x5ceca2;return _0x5249c1;})[_0x6948('0x2b')](respondWithFilteredResult(_0x2e2266,_0x4f4ef5))[_0x6948('0x47')](handleError(_0x2e2266,null));};exports[_0x6948('0x48')]=function(_0x868742,_0x14f95b){var _0xdc64c5={'raw':![],'where':{'id':_0x868742[_0x6948('0x49')]['id']}},_0x2f76ba={};_0x2f76ba['model']=_['keys'](db[_0x6948('0x2f')][_0x6948('0x30')]);_0x2f76ba[_0x6948('0x34')]=_[_0x6948('0x35')](_0x868742['query']);_0x2f76ba[_0x6948('0x36')]=_[_0x6948('0x37')](_0x2f76ba[_0x6948('0x38')],_0x2f76ba[_0x6948('0x34')]);_0xdc64c5[_0x6948('0x39')]=_[_0x6948('0x37')](_0x2f76ba[_0x6948('0x38')],qs[_0x6948('0x3a')](_0x868742[_0x6948('0x34')]['fields']));_0xdc64c5['attributes']=_0xdc64c5[_0x6948('0x39')][_0x6948('0x4a')]?_0xdc64c5[_0x6948('0x39')]:_0x2f76ba[_0x6948('0x38')];if(_0x868742[_0x6948('0x34')]['includeAll']){_0xdc64c5[_0x6948('0x45')]=[{'all':!![]}];}_0xdc64c5=_[_0x6948('0x41')]({},_0xdc64c5,_0x868742[_0x6948('0x43')]);return db[_0x6948('0x2f')][_0x6948('0x4b')](_0xdc64c5)[_0x6948('0x2b')](handleEntityNotFound(_0x14f95b,null))['then'](respondWithResult(_0x14f95b,null))[_0x6948('0x47')](handleError(_0x14f95b,null));};exports[_0x6948('0x4c')]=function(_0x50198b,_0x425b56){return db[_0x6948('0x2f')][_0x6948('0x4c')](_0x50198b[_0x6948('0x4d')],{})[_0x6948('0x2b')](respondWithResult(_0x425b56,0xc9))[_0x6948('0x47')](handleError(_0x425b56,null));};exports['update']=function(_0x52efbc,_0x2b667b){if(_0x52efbc[_0x6948('0x4d')]['id']){delete _0x52efbc[_0x6948('0x4d')]['id'];}return db[_0x6948('0x2f')][_0x6948('0x4b')]({'where':{'id':_0x52efbc['params']['id']}})['then'](handleEntityNotFound(_0x2b667b,null))[_0x6948('0x2b')](saveUpdates(_0x52efbc[_0x6948('0x4d')],null))[_0x6948('0x2b')](respondWithResult(_0x2b667b,null))['catch'](handleError(_0x2b667b,null));};exports['destroy']=function(_0x29adc2,_0xef2660){return db['VoiceQueueReport'][_0x6948('0x4b')]({'where':{'id':_0x29adc2['params']['id']}})[_0x6948('0x2b')](handleEntityNotFound(_0xef2660,null))[_0x6948('0x2b')](removeEntity(_0xef2660,null))[_0x6948('0x47')](handleError(_0xef2660,null));};exports['describe']=function(_0x3f26d4,_0x12712b){return db[_0x6948('0x2f')][_0x6948('0x4e')]()['then'](respondWithResult(_0x12712b,null))[_0x6948('0x47')](handleError(_0x12712b,null));};exports['getVoiceQueuesReport']=function(_0x27fa52,_0x46167e){var _0x10a31c={},_0x5d2112={},_0x4a8854={'count':0x0,'rows':[]};_0x5d2112['model']=_[_0x6948('0x35')](db[_0x6948('0x2f')][_0x6948('0x30')]);_0x5d2112[_0x6948('0x34')]=_[_0x6948('0x35')](_0x27fa52['query']);_0x5d2112[_0x6948('0x36')]=_['intersection'](_0x5d2112[_0x6948('0x38')],_0x5d2112['query']);_0x10a31c['attributes']=_[_0x6948('0x37')](_0x5d2112[_0x6948('0x38')],qs[_0x6948('0x3a')](_0x27fa52[_0x6948('0x34')][_0x6948('0x3a')]));_0x10a31c[_0x6948('0x39')]=_0x10a31c['attributes']['length']?_0x10a31c['attributes']:_0x5d2112[_0x6948('0x38')];if(!_0x27fa52[_0x6948('0x34')]['hasOwnProperty'](_0x6948('0x3c'))){_0x10a31c['limit']=qs[_0x6948('0x23')](_0x27fa52[_0x6948('0x34')]['limit']);_0x10a31c[_0x6948('0x22')]=qs[_0x6948('0x22')](_0x27fa52['query'][_0x6948('0x22')]);}_0x10a31c[_0x6948('0x3d')]=qs[_0x6948('0x3e')](_0x27fa52[_0x6948('0x34')][_0x6948('0x3e')]);_0x10a31c['where']=qs['filters'](_['pick'](_0x27fa52['query'],_0x5d2112[_0x6948('0x36')]));if(_0x27fa52['query']['filter']){_0x10a31c[_0x6948('0x40')]=_['merge'](_0x10a31c['where'],{'$or':_[_0x6948('0x33')](_0x10a31c[_0x6948('0x39')],function(_0xcc0070){var _0x2a6525={};_0x2a6525[_0xcc0070]={'$like':'%'+_0x27fa52['query']['filter']+'%'};return _0x2a6525;})});}_0x10a31c=_[_0x6948('0x41')]({},_0x10a31c,_0x27fa52[_0x6948('0x43')]);var _0x490328={'where':_0x10a31c[_0x6948('0x40')]};return db[_0x6948('0x2f')][_0x6948('0x25')](_0x490328)[_0x6948('0x2b')](function(_0x1bb211){_0x4a8854[_0x6948('0x25')]=_0x1bb211;if(_0x27fa52['query'][_0x6948('0x44')]){_0x10a31c['include']=[{'all':!![]}];}return db[_0x6948('0x2f')][_0x6948('0x46')](_0x10a31c);})['then'](function(_0x515112){_0x4a8854[_0x6948('0x4f')]=_0x515112;return _0x4a8854;})['then'](respondWithFilteredResult(_0x46167e,_0x10a31c,'getVoiceQueuesReport'))[_0x6948('0x47')](handleError(_0x46167e,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index e8c5a10..f835951 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 _0xefcb=['events','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x1a8e9d,_0x34808a){var _0x5a9810=function(_0x5d6717){while(--_0x5d6717){_0x1a8e9d['push'](_0x1a8e9d['shift']());}};_0x5a9810(++_0x34808a);}(_0xefcb,0x17c));var _0xbefc=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xefcb[_0x1694f5];return _0x5b4321;};'use strict';var EventEmitter=require(_0xbefc('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xbefc('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xbefc('0x2')](0x0);var events={'afterCreate':_0xbefc('0x3'),'afterUpdate':_0xbefc('0x4'),'afterDestroy':_0xbefc('0x5')};function emitEvent(_0x8e34b9){return function(_0x2202b6,_0x1423fd,_0x316b0d){VoiceQueueReportEvents[_0xbefc('0x6')](_0x8e34b9+':'+_0x2202b6['id'],_0x2202b6);VoiceQueueReportEvents['emit'](_0x8e34b9,_0x2202b6);_0x316b0d(null);};}for(var e in events){if(events[_0xbefc('0x7')](e)){var event=events[e];VoiceQueueReport[_0xbefc('0x8')](e,emitEvent(event));}}module[_0xbefc('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x371a=['update','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x1e762b,_0x222f1a){var _0x113404=function(_0x39bc03){while(--_0x39bc03){_0x1e762b['push'](_0x1e762b['shift']());}};_0x113404(++_0x222f1a);}(_0x371a,0x1f4));var _0xa371=function(_0x3f75bb,_0x2f9cb9){_0x3f75bb=_0x3f75bb-0x0;var _0x3bbcdf=_0x371a[_0x3f75bb];return _0x3bbcdf;};'use strict';var EventEmitter=require(_0xa371('0x0'));var VoiceQueueReport=require(_0xa371('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xa371('0x2')](0x0);var events={'afterCreate':_0xa371('0x3'),'afterUpdate':_0xa371('0x4'),'afterDestroy':'remove'};function emitEvent(_0x56d9b8){return function(_0x5051cc,_0x46d354,_0x2b168a){VoiceQueueReportEvents[_0xa371('0x5')](_0x56d9b8+':'+_0x5051cc['id'],_0x5051cc);VoiceQueueReportEvents[_0xa371('0x5')](_0x56d9b8,_0x5051cc);_0x2b168a(null);};}for(var e in events){if(events[_0xa371('0x6')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xa371('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 24e8a89..7d517cd 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 _0x9cde=['moment','bluebird','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','uniqueid','calleridnum','lodash','util','api'];(function(_0x1814fa,_0x5b2c26){var _0x18e64c=function(_0x190ecd){while(--_0x190ecd){_0x1814fa['push'](_0x1814fa['shift']());}};_0x18e64c(++_0x5b2c26);}(_0x9cde,0x101));var _0xe9cd=function(_0x18ee80,_0x2adf1c){_0x18ee80=_0x18ee80-0x0;var _0x2f60c2=_0x9cde[_0x18ee80];return _0x2f60c2;};'use strict';var _=require(_0xe9cd('0x0'));var util=require(_0xe9cd('0x1'));var logger=require('../../config/logger')(_0xe9cd('0x2'));var moment=require(_0xe9cd('0x3'));var BPromise=require(_0xe9cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe9cd('0x5'));var config=require(_0xe9cd('0x6'));var attributes=require(_0xe9cd('0x7'));module[_0xe9cd('0x8')]=function(_0x18e573,_0x3dac84){return _0x18e573[_0xe9cd('0x9')](_0xe9cd('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xe9cd('0xb')]},{'fields':[_0xe9cd('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x96a5=['rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4bba2a,_0x118cd5){var _0x1feeb0=function(_0x57026b){while(--_0x57026b){_0x4bba2a['push'](_0x4bba2a['shift']());}};_0x1feeb0(++_0x118cd5);}(_0x96a5,0x17f));var _0x596a=function(_0x3642e7,_0x16358e){_0x3642e7=_0x3642e7-0x0;var _0x31e3dd=_0x96a5[_0x3642e7];return _0x31e3dd;};'use strict';var _=require(_0x596a('0x0'));var util=require(_0x596a('0x1'));var logger=require(_0x596a('0x2'))(_0x596a('0x3'));var moment=require(_0x596a('0x4'));var BPromise=require(_0x596a('0x5'));var rp=require(_0x596a('0x6'));var fs=require('fs');var path=require(_0x596a('0x7'));var rimraf=require(_0x596a('0x8'));var config=require(_0x596a('0x9'));var attributes=require(_0x596a('0xa'));module[_0x596a('0xb')]=function(_0x3d7f33,_0x276f2d){return _0x3d7f33[_0x596a('0xc')](_0x596a('0xd'),attributes,{'tableName':_0x596a('0xe'),'paranoid':![],'indexes':[{'fields':[_0x596a('0xf')]},{'fields':[_0x596a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 82260f6..f035860 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 _0xd906=['ioredis','rpc','jayson/promise','client','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','include','model','map','info','stringify','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','where','limit','lodash','moment','bluebird'];(function(_0x501118,_0x4b88fb){var _0x3b30d3=function(_0xfe2179){while(--_0xfe2179){_0x501118['push'](_0x501118['shift']());}};_0x3b30d3(++_0x4b88fb);}(_0xd906,0xed));var _0x6d90=function(_0x3fb256,_0xa066af){_0x3fb256=_0x3fb256-0x0;var _0x1ca90f=_0xd906[_0x3fb256];return _0x1ca90f;};'use strict';var _=require(_0x6d90('0x0'));var util=require('util');var moment=require(_0x6d90('0x1'));var BPromise=require(_0x6d90('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d90('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6d90('0x4'));var config=require('../../config/environment');var jayson=require(_0x6d90('0x5'));var client=jayson[_0x6d90('0x6')]['http']({'port':0x232a});config[_0x6d90('0x7')]=_[_0x6d90('0x8')](config[_0x6d90('0x7')],{'host':_0x6d90('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d90('0x7')]));require(_0x6d90('0xa'))[_0x6d90('0xb')](socket);function respondWithRpcPromise(_0x5d1b7a,_0x1b0b02,_0x34145d){return new BPromise(function(_0x5d748e,_0x3f5378){return client[_0x6d90('0xc')](_0x5d1b7a,_0x34145d)[_0x6d90('0xd')](function(_0x391739){logger['info'](_0x6d90('0xe'),_0x1b0b02,_0x6d90('0xf'));logger[_0x6d90('0x10')](_0x6d90('0x11'),_0x1b0b02,_0x6d90('0xf'),JSON['stringify'](_0x391739));if(_0x391739[_0x6d90('0x12')]){if(_0x391739[_0x6d90('0x12')]['code']===0x1f4){logger['error'](_0x6d90('0xe'),_0x1b0b02,_0x391739[_0x6d90('0x12')][_0x6d90('0x13')]);return _0x3f5378(_0x391739['error'][_0x6d90('0x13')]);}logger[_0x6d90('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1b0b02,_0x391739[_0x6d90('0x12')]['message']);return _0x5d748e(_0x391739[_0x6d90('0x12')][_0x6d90('0x13')]);}else{logger['info'](_0x6d90('0xe'),_0x1b0b02,_0x6d90('0xf'));_0x5d748e(_0x391739[_0x6d90('0x14')]['message']);}})[_0x6d90('0x15')](function(_0x3c41fd){logger[_0x6d90('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1b0b02,_0x3c41fd);_0x3f5378(_0x3c41fd);});});}exports[_0x6d90('0x16')]=function(_0x20f107){var _0x3e5256=this;return new Promise(function(_0x30027f,_0x359dff){return db[_0x6d90('0x17')][_0x6d90('0x18')]({'raw':_0x20f107['options']?_0x20f107[_0x6d90('0x19')][_0x6d90('0x1a')]===undefined?!![]:![]:!![],'where':_0x20f107[_0x6d90('0x19')]?_0x20f107['options']['where']||null:null,'attributes':_0x20f107['options']?_0x20f107[_0x6d90('0x19')][_0x6d90('0x1b')]||null:null,'limit':_0x20f107['options']?_0x20f107[_0x6d90('0x19')]['limit']||null:null,'include':_0x20f107['options']?_0x20f107[_0x6d90('0x19')][_0x6d90('0x1c')]?_['map'](_0x20f107['options'][_0x6d90('0x1c')],function(_0x2410a3){return{'model':db[_0x2410a3[_0x6d90('0x1d')]],'as':_0x2410a3['as'],'attributes':_0x2410a3[_0x6d90('0x1b')],'include':_0x2410a3[_0x6d90('0x1c')]?_['map'](_0x2410a3[_0x6d90('0x1c')],function(_0x16b7cc){return{'model':db[_0x16b7cc[_0x6d90('0x1d')]],'as':_0x16b7cc['as'],'attributes':_0x16b7cc[_0x6d90('0x1b')],'include':_0x16b7cc[_0x6d90('0x1c')]?_[_0x6d90('0x1e')](_0x16b7cc['include'],function(_0x27fd54){return{'model':db[_0x27fd54[_0x6d90('0x1d')]],'as':_0x27fd54['as'],'attributes':_0x27fd54['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27850e){logger[_0x6d90('0x1f')]('GetVoiceQueueReport',_0x20f107);logger[_0x6d90('0x10')](_0x6d90('0x16'),_0x20f107,JSON[_0x6d90('0x20')](_0x27850e));_0x30027f(_0x27850e);})[_0x6d90('0x15')](function(_0x3d914d){logger[_0x6d90('0x12')](_0x6d90('0x16'),_0x3d914d[_0x6d90('0x13')],_0x20f107);_0x359dff(_0x3e5256[_0x6d90('0x12')](0x1f4,_0x3d914d['message']));});});};exports[_0x6d90('0x21')]=function(_0x18ef5d){var _0x45ce81=this;return new Promise(function(_0xe999fe,_0x23b415){return db['VoiceQueueReport'][_0x6d90('0x22')](_0x18ef5d[_0x6d90('0x23')],{'raw':_0x18ef5d[_0x6d90('0x19')]?_0x18ef5d[_0x6d90('0x19')][_0x6d90('0x1a')]===undefined?!![]:![]:!![]})[_0x6d90('0xd')](function(_0xbfafb3){logger[_0x6d90('0x1f')](_0x6d90('0x21'),_0x18ef5d);logger[_0x6d90('0x10')](_0x6d90('0x21'),_0x18ef5d,JSON[_0x6d90('0x20')](_0xbfafb3));_0xe999fe(_0xbfafb3);})[_0x6d90('0x15')](function(_0x15dab7){logger[_0x6d90('0x12')](_0x6d90('0x21'),_0x15dab7[_0x6d90('0x13')],_0x18ef5d);_0x23b415(_0x45ce81['error'](0x1f4,_0x15dab7[_0x6d90('0x13')]));});});};exports[_0x6d90('0x24')]=function(_0x2797d1){var _0x5b109e=this;return new Promise(function(_0x2cfcdd,_0x14f023){return db['VoiceQueueReport'][_0x6d90('0x25')](_0x2797d1[_0x6d90('0x23')],{'raw':_0x2797d1[_0x6d90('0x19')]?_0x2797d1[_0x6d90('0x19')][_0x6d90('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2797d1[_0x6d90('0x19')]?_0x2797d1['options'][_0x6d90('0x26')]||null:null,'attributes':_0x2797d1[_0x6d90('0x19')]?_0x2797d1['options'][_0x6d90('0x1b')]||null:null,'limit':_0x2797d1[_0x6d90('0x19')]?_0x2797d1[_0x6d90('0x19')][_0x6d90('0x27')]||null:null})[_0x6d90('0xd')](function(_0x51ac5a){logger['info'](_0x6d90('0x24'),_0x2797d1);logger[_0x6d90('0x10')](_0x6d90('0x24'),_0x2797d1,JSON['stringify'](_0x51ac5a));_0x2cfcdd(_0x51ac5a);})[_0x6d90('0x15')](function(_0x45da70){logger[_0x6d90('0x12')](_0x6d90('0x24'),_0x45da70['message'],_0x2797d1);_0x14f023(_0x5b109e['error'](0x1f4,_0x45da70[_0x6d90('0x13')]));});});}; \ No newline at end of file +var _0xf37a=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','map','include','model','then','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','lodash','util','moment'];(function(_0x4e97b9,_0x42e9fb){var _0x5df7b8=function(_0xaaac2c){while(--_0xaaac2c){_0x4e97b9['push'](_0x4e97b9['shift']());}};_0x5df7b8(++_0x42e9fb);}(_0xf37a,0x16e));var _0xaf37=function(_0x306822,_0x553dea){_0x306822=_0x306822-0x0;var _0x22914a=_0xf37a[_0x306822];return _0x22914a;};'use strict';var _=require(_0xaf37('0x0'));var util=require(_0xaf37('0x1'));var moment=require(_0xaf37('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf37('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf37('0x4'))['db'];var utils=require(_0xaf37('0x5'));var logger=require(_0xaf37('0x6'))(_0xaf37('0x7'));var config=require(_0xaf37('0x8'));var jayson=require(_0xaf37('0x9'));var client=jayson[_0xaf37('0xa')]['http']({'port':0x232a});config[_0xaf37('0xb')]=_[_0xaf37('0xc')](config[_0xaf37('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf37('0xd'))(new Redis(config[_0xaf37('0xb')]));require('./voiceQueueReport.socket')[_0xaf37('0xe')](socket);function respondWithRpcPromise(_0x16954f,_0x1be845,_0x24913b){return new BPromise(function(_0x4b4fa1,_0x240811){return client['request'](_0x16954f,_0x24913b)['then'](function(_0x1ee56a){logger[_0xaf37('0xf')](_0xaf37('0x10'),_0x1be845,_0xaf37('0x11'));logger[_0xaf37('0x12')](_0xaf37('0x13'),_0x1be845,_0xaf37('0x11'),JSON[_0xaf37('0x14')](_0x1ee56a));if(_0x1ee56a['error']){if(_0x1ee56a[_0xaf37('0x15')][_0xaf37('0x16')]===0x1f4){logger['error'](_0xaf37('0x10'),_0x1be845,_0x1ee56a[_0xaf37('0x15')][_0xaf37('0x17')]);return _0x240811(_0x1ee56a['error'][_0xaf37('0x17')]);}logger[_0xaf37('0x15')](_0xaf37('0x10'),_0x1be845,_0x1ee56a['error'][_0xaf37('0x17')]);return _0x4b4fa1(_0x1ee56a['error'][_0xaf37('0x17')]);}else{logger[_0xaf37('0xf')](_0xaf37('0x10'),_0x1be845,'request\x20sent');_0x4b4fa1(_0x1ee56a[_0xaf37('0x18')][_0xaf37('0x17')]);}})[_0xaf37('0x19')](function(_0x363c26){logger[_0xaf37('0x15')](_0xaf37('0x10'),_0x1be845,_0x363c26);_0x240811(_0x363c26);});});}exports[_0xaf37('0x1a')]=function(_0x301750){var _0x364107=this;return new Promise(function(_0x5e71f6,_0x38a6e3){return db[_0xaf37('0x1b')]['findAll']({'raw':_0x301750[_0xaf37('0x1c')]?_0x301750['options'][_0xaf37('0x1d')]===undefined?!![]:![]:!![],'where':_0x301750['options']?_0x301750[_0xaf37('0x1c')][_0xaf37('0x1e')]||null:null,'attributes':_0x301750[_0xaf37('0x1c')]?_0x301750[_0xaf37('0x1c')][_0xaf37('0x1f')]||null:null,'limit':_0x301750['options']?_0x301750['options'][_0xaf37('0x20')]||null:null,'include':_0x301750['options']?_0x301750['options']['include']?_[_0xaf37('0x21')](_0x301750[_0xaf37('0x1c')]['include'],function(_0xde594b){return{'model':db[_0xde594b['model']],'as':_0xde594b['as'],'attributes':_0xde594b[_0xaf37('0x1f')],'include':_0xde594b[_0xaf37('0x22')]?_[_0xaf37('0x21')](_0xde594b['include'],function(_0x57eda4){return{'model':db[_0x57eda4[_0xaf37('0x23')]],'as':_0x57eda4['as'],'attributes':_0x57eda4['attributes'],'include':_0x57eda4[_0xaf37('0x22')]?_[_0xaf37('0x21')](_0x57eda4['include'],function(_0x2b896a){return{'model':db[_0x2b896a[_0xaf37('0x23')]],'as':_0x2b896a['as'],'attributes':_0x2b896a[_0xaf37('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xaf37('0x24')](function(_0x222bcc){logger['info']('GetVoiceQueueReport',_0x301750);logger['debug'](_0xaf37('0x1a'),_0x301750,JSON['stringify'](_0x222bcc));_0x5e71f6(_0x222bcc);})[_0xaf37('0x19')](function(_0x4c6b5a){logger[_0xaf37('0x15')]('GetVoiceQueueReport',_0x4c6b5a['message'],_0x301750);_0x38a6e3(_0x364107['error'](0x1f4,_0x4c6b5a['message']));});});};exports[_0xaf37('0x25')]=function(_0x2d1078){var _0x5a5a7f=this;return new Promise(function(_0x11d591,_0x182be5){return db['VoiceQueueReport']['create'](_0x2d1078['body'],{'raw':_0x2d1078['options']?_0x2d1078[_0xaf37('0x1c')][_0xaf37('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5a2a4a){logger['info'](_0xaf37('0x25'),_0x2d1078);logger[_0xaf37('0x12')]('CreateVoiceQueueReport',_0x2d1078,JSON['stringify'](_0x5a2a4a));_0x11d591(_0x5a2a4a);})[_0xaf37('0x19')](function(_0x4c7736){logger['error']('CreateVoiceQueueReport',_0x4c7736[_0xaf37('0x17')],_0x2d1078);_0x182be5(_0x5a5a7f[_0xaf37('0x15')](0x1f4,_0x4c7736[_0xaf37('0x17')]));});});};exports[_0xaf37('0x26')]=function(_0x101136){var _0x18e1f4=this;return new Promise(function(_0x2f986f,_0x1dc921){return db['VoiceQueueReport'][_0xaf37('0x27')](_0x101136[_0xaf37('0x28')],{'raw':_0x101136[_0xaf37('0x1c')]?_0x101136['options'][_0xaf37('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x101136[_0xaf37('0x1c')]?_0x101136['options']['where']||null:null,'attributes':_0x101136['options']?_0x101136['options'][_0xaf37('0x1f')]||null:null,'limit':_0x101136[_0xaf37('0x1c')]?_0x101136[_0xaf37('0x1c')][_0xaf37('0x20')]||null:null})[_0xaf37('0x24')](function(_0x506506){logger[_0xaf37('0xf')](_0xaf37('0x26'),_0x101136);logger[_0xaf37('0x12')](_0xaf37('0x26'),_0x101136,JSON[_0xaf37('0x14')](_0x506506));_0x2f986f(_0x506506);})[_0xaf37('0x19')](function(_0x1b1c9d){logger[_0xaf37('0x15')]('UpdateVoiceQueueReport',_0x1b1c9d['message'],_0x101136);_0x1dc921(_0x18e1f4[_0xaf37('0x15')](0x1f4,_0x1b1c9d[_0xaf37('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 6d1311b..7622248 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 _0xc9b9=['remove','update','length'];(function(_0x7577b9,_0x4fe21c){var _0x2660c8=function(_0x3f94ae){while(--_0x3f94ae){_0x7577b9['push'](_0x7577b9['shift']());}};_0x2660c8(++_0x4fe21c);}(_0xc9b9,0x18f));var _0x9c9b=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0xc9b9[_0x37a9d7];return _0x1343d3;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x9c9b('0x0'),_0x9c9b('0x1')];function createListener(_0x3418ab,_0x4e2e8d){return function(_0x5ee8f8){_0x4e2e8d['emit'](_0x3418ab,_0x5ee8f8);};}function removeListener(_0x497d53,_0x38a64b){return function(){VoiceQueueReportEvents['removeListener'](_0x497d53,_0x38a64b);};}exports['register']=function(_0x51abae){for(var _0x1f29f3=0x0,_0x15d94b=events[_0x9c9b('0x2')];_0x1f29f3<_0x15d94b;_0x1f29f3++){var _0x193305=events[_0x1f29f3];var _0xbbd998=createListener('voiceQueueReport:'+_0x193305,_0x51abae);VoiceQueueReportEvents['on'](_0x193305,_0xbbd998);}}; \ No newline at end of file +var _0x3204=['remove','update','emit','register','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x5213d3,_0x457833){var _0x3eb033=function(_0x32b684){while(--_0x32b684){_0x5213d3['push'](_0x5213d3['shift']());}};_0x3eb033(++_0x457833);}(_0x3204,0x12e));var _0x4320=function(_0x5c2a2b,_0x13630c){_0x5c2a2b=_0x5c2a2b-0x0;var _0xf029c=_0x3204[_0x5c2a2b];return _0xf029c;};'use strict';var VoiceQueueReportEvents=require(_0x4320('0x0'));var events=[_0x4320('0x1'),_0x4320('0x2'),_0x4320('0x3')];function createListener(_0xd35512,_0x127479){return function(_0x345d92){_0x127479[_0x4320('0x4')](_0xd35512,_0x345d92);};}function removeListener(_0x71f580,_0x5c51e0){return function(){VoiceQueueReportEvents['removeListener'](_0x71f580,_0x5c51e0);};}exports[_0x4320('0x5')]=function(_0x7ce01d){for(var _0xbda169=0x0,_0xc55c94=events[_0x4320('0x6')];_0xbda169<_0xc55c94;_0xbda169++){var _0x36ea0f=events[_0xbda169];var _0xe2dbaf=createListener(_0x4320('0x7')+_0x36ea0f,_0x7ce01d);VoiceQueueReportEvents['on'](_0x36ea0f,_0xe2dbaf);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index dba2e06..035f1db 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 _0xafcc=['create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','show','post','isAuthenticated'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xafcc,0x154));var _0xcafc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xafcc[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xcafc('0x0'));var util=require('util');var path=require(_0xcafc('0x1'));var timeout=require(_0xcafc('0x2'));var express=require(_0xcafc('0x3'));var router=express['Router']();var fs_extra=require(_0xcafc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcafc('0x5'));var config=require(_0xcafc('0x6'));var controller=require(_0xcafc('0x7'));router[_0xcafc('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xcafc('0x9')]);router[_0xcafc('0xa')]('/',auth[_0xcafc('0xb')](),controller[_0xcafc('0xc')]);router[_0xcafc('0xd')]('/:id',auth[_0xcafc('0xb')](),controller['update']);router['delete'](_0xcafc('0xe'),auth[_0xcafc('0xb')](),controller[_0xcafc('0xf')]);module['exports']=router; \ No newline at end of file +var _0x73b6=['show','post','create','update','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x179bf4,_0x2c4097){var _0x4331cc=function(_0x18a946){while(--_0x18a946){_0x179bf4['push'](_0x179bf4['shift']());}};_0x4331cc(++_0x2c4097);}(_0x73b6,0xe6));var _0x673b=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x73b6[_0x433a86];return _0x23000c;};'use strict';var multer=require('multer');var util=require(_0x673b('0x0'));var path=require(_0x673b('0x1'));var timeout=require(_0x673b('0x2'));var express=require(_0x673b('0x3'));var router=express[_0x673b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x673b('0x5'));var config=require(_0x673b('0x6'));var controller=require('./voiceQueuesLog.controller');router[_0x673b('0x7')]('/',auth[_0x673b('0x8')](),controller['index']);router[_0x673b('0x7')](_0x673b('0x9'),auth[_0x673b('0x8')](),controller[_0x673b('0xa')]);router[_0x673b('0xb')]('/',auth['isAuthenticated'](),controller[_0x673b('0xc')]);router['put']('/:id',auth[_0x673b('0x8')](),controller[_0x673b('0xd')]);router['delete'](_0x673b('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x673b('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 b199f04..14f2ce1 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 _0x2ce9=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING'];(function(_0x447d15,_0x4473a9){var _0x4f2114=function(_0x1cdec5){while(--_0x1cdec5){_0x447d15['push'](_0x447d15['shift']());}};_0x4f2114(++_0x4473a9);}(_0x2ce9,0x86));var _0x92ce=function(_0x202d24,_0x5e8641){_0x202d24=_0x202d24-0x0;var _0x2b3a8e=_0x2ce9[_0x202d24];return _0x2b3a8e;};'use strict';var Sequelize=require(_0x92ce('0x0'));var moment=require(_0x92ce('0x1'));module[_0x92ce('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x92ce('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x92ce('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x92ce('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x92ce('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x92ce('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x92ce('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x92ce('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x92ce('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x92ce('0x4')](_0x92ce('0x5'))}}; \ No newline at end of file +var _0x8bcc=['STRING','DATE','moment','exports'];(function(_0x1a6acb,_0xa7099e){var _0x279242=function(_0x1aca76){while(--_0x1aca76){_0x1a6acb['push'](_0x1a6acb['shift']());}};_0x279242(++_0xa7099e);}(_0x8bcc,0x82));var _0xc8bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bcc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc8bc('0x0'));module[_0xc8bc('0x1')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xc8bc('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xc8bc('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc8bc('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc8bc('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc8bc('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xc8bc('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc8bc('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xc8bc('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xc8bc('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc8bc('0x3')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 8ddcfb0..0dd7b7c 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 _0x7d14=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','map','query','filters','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','intersection','find','create','body','update','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x5fa528,_0x5b9547){var _0x55e208=function(_0x1f6072){while(--_0x1f6072){_0x5fa528['push'](_0x5fa528['shift']());}};_0x55e208(++_0x5b9547);}(_0x7d14,0xd7));var _0x47d1=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x7d14[_0x2e4e19];return _0x9ba20b;};'use strict';var emlformat=require(_0x47d1('0x0'));var rimraf=require(_0x47d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x47d1('0x2'));var moment=require(_0x47d1('0x3'));var BPromise=require(_0x47d1('0x4'));var Mustache=require(_0x47d1('0x5'));var util=require(_0x47d1('0x6'));var path=require('path');var sox=require(_0x47d1('0x7'));var csv=require(_0x47d1('0x8'));var ejs=require(_0x47d1('0x9'));var fs=require('fs');var fs_extra=require(_0x47d1('0xa'));var _=require('lodash');var squel=require(_0x47d1('0xb'));var crypto=require(_0x47d1('0xc'));var jsforce=require(_0x47d1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x47d1('0x8'));var querystring=require(_0x47d1('0xe'));var Papa=require(_0x47d1('0xf'));var Redis=require(_0x47d1('0x10'));var authService=require(_0x47d1('0x11'));var qs=require(_0x47d1('0x12'));var as=require(_0x47d1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47d1('0x14'))(_0x47d1('0x15'));var utils=require(_0x47d1('0x16'));var config=require(_0x47d1('0x17'));var licenseUtil=require(_0x47d1('0x18'));var db=require(_0x47d1('0x19'))['db'];function respondWithStatusCode(_0x4e3a5d,_0xde209b){_0xde209b=_0xde209b||0xcc;return function(_0x19d365){if(_0x19d365){return _0x4e3a5d[_0x47d1('0x1a')](_0xde209b);}return _0x4e3a5d[_0x47d1('0x1b')](_0xde209b)[_0x47d1('0x1c')]();};}function respondWithResult(_0x4dd23b,_0x31ede6){_0x31ede6=_0x31ede6||0xc8;return function(_0x50284c){if(_0x50284c){return _0x4dd23b[_0x47d1('0x1b')](_0x31ede6)[_0x47d1('0x1d')](_0x50284c);}};}function respondWithFilteredResult(_0x36ce47,_0x1a8658){return function(_0x24709f){if(_0x24709f){var _0x2b4dab=typeof _0x1a8658[_0x47d1('0x1e')]===_0x47d1('0x1f')&&typeof _0x1a8658['limit']===_0x47d1('0x1f');var _0x1429dc=_0x24709f['count'];var _0x354441=_0x2b4dab?0x0:_0x1a8658[_0x47d1('0x1e')];var _0x3a8212=_0x2b4dab?_0x24709f[_0x47d1('0x20')]:_0x1a8658[_0x47d1('0x1e')]+_0x1a8658[_0x47d1('0x21')];var _0x5b6a60;if(_0x3a8212>=_0x1429dc){_0x3a8212=_0x1429dc;_0x5b6a60=0xc8;}else{_0x5b6a60=0xce;}_0x36ce47[_0x47d1('0x1b')](_0x5b6a60);return _0x36ce47[_0x47d1('0x22')](_0x47d1('0x23'),_0x354441+'-'+_0x3a8212+'/'+_0x1429dc)[_0x47d1('0x1d')](_0x24709f);}return null;};}function patchUpdates(_0x52d440){return function(_0x5d7795){try{jsonpatch[_0x47d1('0x24')](_0x5d7795,_0x52d440,!![]);}catch(_0x28f002){return BPromise[_0x47d1('0x25')](_0x28f002);}return _0x5d7795[_0x47d1('0x26')]();};}function saveUpdates(_0x224a26,_0x2ae9af){return function(_0x513e5d){if(_0x513e5d){return _0x513e5d['update'](_0x224a26)[_0x47d1('0x27')](function(_0x44e90c){return _0x44e90c;});}return null;};}function removeEntity(_0x2e7f64,_0x2416fd){return function(_0x1eb454){if(_0x1eb454){return _0x1eb454[_0x47d1('0x28')]()[_0x47d1('0x27')](function(){_0x2e7f64['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e7757,_0x4c79fc){return function(_0x47d0f1){if(!_0x47d0f1){_0x4e7757[_0x47d1('0x1a')](0x194);}return _0x47d0f1;};}function handleError(_0x490208,_0xce842b){_0xce842b=_0xce842b||0x1f4;return function(_0x4cd722){logger[_0x47d1('0x29')](_0x4cd722[_0x47d1('0x2a')]);if(_0x4cd722[_0x47d1('0x2b')]){delete _0x4cd722[_0x47d1('0x2b')];}_0x490208['status'](_0xce842b)['send'](_0x4cd722);};}exports[_0x47d1('0x2c')]=function(_0x5e0c49,_0xbb206e){var _0x2bd04b={},_0x1cb30c={},_0x21c810={'count':0x0,'rows':[]};var _0xd2e606=_['map'](db[_0x47d1('0x2d')][_0x47d1('0x2e')],function(_0x6e14c7){return{'name':_0x6e14c7[_0x47d1('0x2f')],'type':_0x6e14c7[_0x47d1('0x30')][_0x47d1('0x31')]};});_0x1cb30c[_0x47d1('0x32')]=_[_0x47d1('0x33')](_0xd2e606,'name');_0x1cb30c['query']=_['keys'](_0x5e0c49[_0x47d1('0x34')]);_0x1cb30c[_0x47d1('0x35')]=_['intersection'](_0x1cb30c[_0x47d1('0x32')],_0x1cb30c['query']);_0x2bd04b['attributes']=_['intersection'](_0x1cb30c['model'],qs['fields'](_0x5e0c49[_0x47d1('0x34')][_0x47d1('0x36')]));_0x2bd04b[_0x47d1('0x37')]=_0x2bd04b[_0x47d1('0x37')][_0x47d1('0x38')]?_0x2bd04b[_0x47d1('0x37')]:_0x1cb30c[_0x47d1('0x32')];if(!_0x5e0c49[_0x47d1('0x34')][_0x47d1('0x39')]('nolimit')){_0x2bd04b[_0x47d1('0x21')]=qs['limit'](_0x5e0c49[_0x47d1('0x34')]['limit']);_0x2bd04b[_0x47d1('0x1e')]=qs['offset'](_0x5e0c49[_0x47d1('0x34')][_0x47d1('0x1e')]);}_0x2bd04b[_0x47d1('0x3a')]=qs[_0x47d1('0x3b')](_0x5e0c49[_0x47d1('0x34')]['sort']);_0x2bd04b['where']=qs['filters'](_[_0x47d1('0x3c')](_0x5e0c49[_0x47d1('0x34')],_0x1cb30c[_0x47d1('0x35')]),_0xd2e606);if(_0x5e0c49[_0x47d1('0x34')][_0x47d1('0x3d')]){_0x2bd04b['where']=_[_0x47d1('0x3e')](_0x2bd04b[_0x47d1('0x3f')],{'$or':_[_0x47d1('0x33')](_0xd2e606,function(_0xa24251){if(_0xa24251[_0x47d1('0x30')]!==_0x47d1('0x40')){var _0x24bbd8={};_0x24bbd8[_0xa24251['name']]={'$like':'%'+_0x5e0c49[_0x47d1('0x34')][_0x47d1('0x3d')]+'%'};return _0x24bbd8;}})});}_0x2bd04b=_[_0x47d1('0x3e')]({},_0x2bd04b,_0x5e0c49[_0x47d1('0x41')]);var _0x17e821={'where':_0x2bd04b[_0x47d1('0x3f')]};return db[_0x47d1('0x2d')]['count'](_0x17e821)[_0x47d1('0x27')](function(_0x25e17f){_0x21c810[_0x47d1('0x20')]=_0x25e17f;if(_0x5e0c49[_0x47d1('0x34')][_0x47d1('0x42')]){_0x2bd04b[_0x47d1('0x43')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x47d1('0x44')](_0x2bd04b);})[_0x47d1('0x27')](function(_0x19d3e3){_0x21c810[_0x47d1('0x45')]=_0x19d3e3;return _0x21c810;})[_0x47d1('0x27')](respondWithFilteredResult(_0xbb206e,_0x2bd04b))[_0x47d1('0x46')](handleError(_0xbb206e,null));};exports[_0x47d1('0x47')]=function(_0x307652,_0xebcc0){var _0xb9208={'raw':!![],'where':{'id':_0x307652['params']['id']}},_0x49e095={};_0x49e095[_0x47d1('0x32')]=_[_0x47d1('0x48')](db[_0x47d1('0x2d')][_0x47d1('0x2e')]);_0x49e095[_0x47d1('0x34')]=_['keys'](_0x307652['query']);_0x49e095[_0x47d1('0x35')]=_[_0x47d1('0x49')](_0x49e095['model'],_0x49e095[_0x47d1('0x34')]);_0xb9208['attributes']=_[_0x47d1('0x49')](_0x49e095[_0x47d1('0x32')],qs['fields'](_0x307652[_0x47d1('0x34')][_0x47d1('0x36')]));_0xb9208[_0x47d1('0x37')]=_0xb9208[_0x47d1('0x37')]['length']?_0xb9208[_0x47d1('0x37')]:_0x49e095[_0x47d1('0x32')];if(_0x307652[_0x47d1('0x34')][_0x47d1('0x42')]){_0xb9208[_0x47d1('0x43')]=[{'all':!![]}];}_0xb9208=_[_0x47d1('0x3e')]({},_0xb9208,_0x307652[_0x47d1('0x41')]);return db[_0x47d1('0x2d')][_0x47d1('0x4a')](_0xb9208)[_0x47d1('0x27')](handleEntityNotFound(_0xebcc0,null))['then'](respondWithResult(_0xebcc0,null))[_0x47d1('0x46')](handleError(_0xebcc0,null));};exports[_0x47d1('0x4b')]=function(_0x31c945,_0xb74435){return db[_0x47d1('0x2d')][_0x47d1('0x4b')](_0x31c945[_0x47d1('0x4c')],{})['then'](respondWithResult(_0xb74435,0xc9))[_0x47d1('0x46')](handleError(_0xb74435,null));};exports[_0x47d1('0x4d')]=function(_0x21fddd,_0xa8f61a){if(_0x21fddd[_0x47d1('0x4c')]['id']){delete _0x21fddd[_0x47d1('0x4c')]['id'];}return db[_0x47d1('0x2d')][_0x47d1('0x4a')]({'where':{'id':_0x21fddd[_0x47d1('0x4e')]['id']}})[_0x47d1('0x27')](handleEntityNotFound(_0xa8f61a,null))[_0x47d1('0x27')](saveUpdates(_0x21fddd[_0x47d1('0x4c')],null))[_0x47d1('0x27')](respondWithResult(_0xa8f61a,null))[_0x47d1('0x46')](handleError(_0xa8f61a,null));};exports[_0x47d1('0x28')]=function(_0xfc3beb,_0x3a2255){return db['VoiceQueuesLog'][_0x47d1('0x4a')]({'where':{'id':_0xfc3beb[_0x47d1('0x4e')]['id']}})[_0x47d1('0x27')](handleEntityNotFound(_0x3a2255,null))['then'](removeEntity(_0x3a2255,null))[_0x47d1('0x46')](handleError(_0x3a2255,null));}; \ No newline at end of file +var _0x3256=['filter','include','findAll','rows','catch','show','params','includeAll','merge','options','find','create','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x112cb1,_0x466498){var _0x48a632=function(_0x21dcc8){while(--_0x21dcc8){_0x112cb1['push'](_0x112cb1['shift']());}};_0x48a632(++_0x466498);}(_0x3256,0x166));var _0x6325=function(_0x222309,_0xdf2424){_0x222309=_0x222309-0x0;var _0x63f445=_0x3256[_0x222309];return _0x63f445;};'use strict';var emlformat=require(_0x6325('0x0'));var rimraf=require(_0x6325('0x1'));var zipdir=require(_0x6325('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6325('0x3'));var BPromise=require(_0x6325('0x4'));var Mustache=require(_0x6325('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6325('0x6'));var csv=require(_0x6325('0x7'));var ejs=require(_0x6325('0x8'));var fs=require('fs');var fs_extra=require(_0x6325('0x9'));var _=require(_0x6325('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6325('0xb'));var deskjs=require(_0x6325('0xc'));var toCsv=require(_0x6325('0x7'));var querystring=require(_0x6325('0xd'));var Papa=require('papaparse');var Redis=require(_0x6325('0xe'));var authService=require(_0x6325('0xf'));var qs=require(_0x6325('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6325('0x11'));var logger=require(_0x6325('0x12'))(_0x6325('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f4763,_0x3bd49d){_0x3bd49d=_0x3bd49d||0xcc;return function(_0x40f9ec){if(_0x40f9ec){return _0x4f4763[_0x6325('0x14')](_0x3bd49d);}return _0x4f4763[_0x6325('0x15')](_0x3bd49d)[_0x6325('0x16')]();};}function respondWithResult(_0x1e7583,_0x4fda99){_0x4fda99=_0x4fda99||0xc8;return function(_0x429596){if(_0x429596){return _0x1e7583['status'](_0x4fda99)[_0x6325('0x17')](_0x429596);}};}function respondWithFilteredResult(_0x2062e4,_0x2314ee){return function(_0x5a2bdd){if(_0x5a2bdd){var _0xbfa0dd=typeof _0x2314ee[_0x6325('0x18')]===_0x6325('0x19')&&typeof _0x2314ee['limit']===_0x6325('0x19');var _0x15a7ad=_0x5a2bdd[_0x6325('0x1a')];var _0x445f39=_0xbfa0dd?0x0:_0x2314ee[_0x6325('0x18')];var _0x3cfd74=_0xbfa0dd?_0x5a2bdd[_0x6325('0x1a')]:_0x2314ee['offset']+_0x2314ee[_0x6325('0x1b')];var _0x5dec1d;if(_0x3cfd74>=_0x15a7ad){_0x3cfd74=_0x15a7ad;_0x5dec1d=0xc8;}else{_0x5dec1d=0xce;}_0x2062e4[_0x6325('0x15')](_0x5dec1d);return _0x2062e4['set'](_0x6325('0x1c'),_0x445f39+'-'+_0x3cfd74+'/'+_0x15a7ad)[_0x6325('0x17')](_0x5a2bdd);}return null;};}function patchUpdates(_0x1c03c2){return function(_0x3c5898){try{jsonpatch[_0x6325('0x1d')](_0x3c5898,_0x1c03c2,!![]);}catch(_0x572478){return BPromise['reject'](_0x572478);}return _0x3c5898['save']();};}function saveUpdates(_0x17c47c,_0x1a0b3a){return function(_0x1c5b2a){if(_0x1c5b2a){return _0x1c5b2a[_0x6325('0x1e')](_0x17c47c)[_0x6325('0x1f')](function(_0x315ab8){return _0x315ab8;});}return null;};}function removeEntity(_0x46697a,_0x13efa8){return function(_0x38c8b5){if(_0x38c8b5){return _0x38c8b5[_0x6325('0x20')]()[_0x6325('0x1f')](function(){_0x46697a['status'](0xcc)[_0x6325('0x16')]();});}};}function handleEntityNotFound(_0x2a3e26,_0x3ec106){return function(_0x47c1bc){if(!_0x47c1bc){_0x2a3e26[_0x6325('0x14')](0x194);}return _0x47c1bc;};}function handleError(_0x96cfb8,_0x1512e1){_0x1512e1=_0x1512e1||0x1f4;return function(_0x2aa974){logger[_0x6325('0x21')](_0x2aa974[_0x6325('0x22')]);if(_0x2aa974[_0x6325('0x23')]){delete _0x2aa974['name'];}_0x96cfb8[_0x6325('0x15')](_0x1512e1)[_0x6325('0x24')](_0x2aa974);};}exports[_0x6325('0x25')]=function(_0x48f0fe,_0x2335da){var _0x36c180={},_0x458115={},_0x4186a={'count':0x0,'rows':[]};var _0x5b3423=_['map'](db[_0x6325('0x26')][_0x6325('0x27')],function(_0x471ecf){return{'name':_0x471ecf[_0x6325('0x28')],'type':_0x471ecf[_0x6325('0x29')][_0x6325('0x2a')]};});_0x458115[_0x6325('0x2b')]=_['map'](_0x5b3423,'name');_0x458115['query']=_[_0x6325('0x2c')](_0x48f0fe[_0x6325('0x2d')]);_0x458115[_0x6325('0x2e')]=_['intersection'](_0x458115[_0x6325('0x2b')],_0x458115[_0x6325('0x2d')]);_0x36c180[_0x6325('0x2f')]=_[_0x6325('0x30')](_0x458115[_0x6325('0x2b')],qs['fields'](_0x48f0fe['query'][_0x6325('0x31')]));_0x36c180[_0x6325('0x2f')]=_0x36c180[_0x6325('0x2f')][_0x6325('0x32')]?_0x36c180[_0x6325('0x2f')]:_0x458115[_0x6325('0x2b')];if(!_0x48f0fe[_0x6325('0x2d')][_0x6325('0x33')](_0x6325('0x34'))){_0x36c180[_0x6325('0x1b')]=qs[_0x6325('0x1b')](_0x48f0fe['query'][_0x6325('0x1b')]);_0x36c180[_0x6325('0x18')]=qs[_0x6325('0x18')](_0x48f0fe[_0x6325('0x2d')][_0x6325('0x18')]);}_0x36c180[_0x6325('0x35')]=qs[_0x6325('0x36')](_0x48f0fe['query'][_0x6325('0x36')]);_0x36c180[_0x6325('0x37')]=qs[_0x6325('0x2e')](_['pick'](_0x48f0fe[_0x6325('0x2d')],_0x458115[_0x6325('0x2e')]),_0x5b3423);if(_0x48f0fe[_0x6325('0x2d')][_0x6325('0x38')]){_0x36c180[_0x6325('0x37')]=_['merge'](_0x36c180[_0x6325('0x37')],{'$or':_['map'](_0x5b3423,function(_0x28a5fc){if(_0x28a5fc[_0x6325('0x29')]!=='VIRTUAL'){var _0x2cc45f={};_0x2cc45f[_0x28a5fc[_0x6325('0x23')]]={'$like':'%'+_0x48f0fe[_0x6325('0x2d')][_0x6325('0x38')]+'%'};return _0x2cc45f;}})});}_0x36c180=_['merge']({},_0x36c180,_0x48f0fe['options']);var _0x128c92={'where':_0x36c180[_0x6325('0x37')]};return db[_0x6325('0x26')][_0x6325('0x1a')](_0x128c92)[_0x6325('0x1f')](function(_0x484c40){_0x4186a[_0x6325('0x1a')]=_0x484c40;if(_0x48f0fe[_0x6325('0x2d')]['includeAll']){_0x36c180[_0x6325('0x39')]=[{'all':!![]}];}return db[_0x6325('0x26')][_0x6325('0x3a')](_0x36c180);})[_0x6325('0x1f')](function(_0x4fc48f){_0x4186a[_0x6325('0x3b')]=_0x4fc48f;return _0x4186a;})['then'](respondWithFilteredResult(_0x2335da,_0x36c180))[_0x6325('0x3c')](handleError(_0x2335da,null));};exports[_0x6325('0x3d')]=function(_0x519466,_0x4fb230){var _0x5d9039={'raw':!![],'where':{'id':_0x519466[_0x6325('0x3e')]['id']}},_0x23b9d1={};_0x23b9d1[_0x6325('0x2b')]=_[_0x6325('0x2c')](db[_0x6325('0x26')][_0x6325('0x27')]);_0x23b9d1[_0x6325('0x2d')]=_[_0x6325('0x2c')](_0x519466['query']);_0x23b9d1[_0x6325('0x2e')]=_[_0x6325('0x30')](_0x23b9d1[_0x6325('0x2b')],_0x23b9d1[_0x6325('0x2d')]);_0x5d9039['attributes']=_['intersection'](_0x23b9d1[_0x6325('0x2b')],qs[_0x6325('0x31')](_0x519466[_0x6325('0x2d')][_0x6325('0x31')]));_0x5d9039['attributes']=_0x5d9039['attributes'][_0x6325('0x32')]?_0x5d9039[_0x6325('0x2f')]:_0x23b9d1[_0x6325('0x2b')];if(_0x519466[_0x6325('0x2d')][_0x6325('0x3f')]){_0x5d9039['include']=[{'all':!![]}];}_0x5d9039=_[_0x6325('0x40')]({},_0x5d9039,_0x519466[_0x6325('0x41')]);return db[_0x6325('0x26')][_0x6325('0x42')](_0x5d9039)[_0x6325('0x1f')](handleEntityNotFound(_0x4fb230,null))[_0x6325('0x1f')](respondWithResult(_0x4fb230,null))[_0x6325('0x3c')](handleError(_0x4fb230,null));};exports[_0x6325('0x43')]=function(_0xbf9fda,_0x2308e4){return db[_0x6325('0x26')][_0x6325('0x43')](_0xbf9fda[_0x6325('0x44')],{})[_0x6325('0x1f')](respondWithResult(_0x2308e4,0xc9))[_0x6325('0x3c')](handleError(_0x2308e4,null));};exports['update']=function(_0x48792f,_0x415cac){if(_0x48792f['body']['id']){delete _0x48792f[_0x6325('0x44')]['id'];}return db[_0x6325('0x26')]['find']({'where':{'id':_0x48792f[_0x6325('0x3e')]['id']}})[_0x6325('0x1f')](handleEntityNotFound(_0x415cac,null))[_0x6325('0x1f')](saveUpdates(_0x48792f[_0x6325('0x44')],null))['then'](respondWithResult(_0x415cac,null))['catch'](handleError(_0x415cac,null));};exports[_0x6325('0x20')]=function(_0x12f8f2,_0x269ae0){return db[_0x6325('0x26')][_0x6325('0x42')]({'where':{'id':_0x12f8f2['params']['id']}})[_0x6325('0x1f')](handleEntityNotFound(_0x269ae0,null))[_0x6325('0x1f')](removeEntity(_0x269ae0,null))[_0x6325('0x3c')](handleError(_0x269ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 08e8c0e..e399bb1 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 _0x5e93=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','event_dtm','dtm','lodash','util','../../config/logger'];(function(_0x12413f,_0x39113b){var _0x244616=function(_0x482445){while(--_0x482445){_0x12413f['push'](_0x12413f['shift']());}};_0x244616(++_0x39113b);}(_0x5e93,0x174));var _0x35e9=function(_0x25b609,_0x84ded9){_0x25b609=_0x25b609-0x0;var _0xd9218d=_0x5e93[_0x25b609];return _0xd9218d;};'use strict';var _=require(_0x35e9('0x0'));var util=require(_0x35e9('0x1'));var logger=require(_0x35e9('0x2'))(_0x35e9('0x3'));var moment=require(_0x35e9('0x4'));var BPromise=require(_0x35e9('0x5'));var rp=require(_0x35e9('0x6'));var fs=require('fs');var path=require(_0x35e9('0x7'));var rimraf=require(_0x35e9('0x8'));var config=require(_0x35e9('0x9'));var attributes=require(_0x35e9('0xa'));module[_0x35e9('0xb')]=function(_0x47d2a8,_0x115d4c){return _0x47d2a8[_0x35e9('0xc')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x35e9('0xd'),'fields':['event',_0x35e9('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf2dd=['lodash','util','moment','bluebird','path','../../config/environment','exports','define','voice_queues_log','event_dtm','event','dtm'];(function(_0x38d36d,_0x95a320){var _0x39dbbd=function(_0x59dfa9){while(--_0x59dfa9){_0x38d36d['push'](_0x38d36d['shift']());}};_0x39dbbd(++_0x95a320);}(_0xf2dd,0x84));var _0xdf2d=function(_0x277721,_0x46971e){_0x277721=_0x277721-0x0;var _0x286051=_0xf2dd[_0x277721];return _0x286051;};'use strict';var _=require(_0xdf2d('0x0'));var util=require(_0xdf2d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdf2d('0x2'));var BPromise=require(_0xdf2d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf2d('0x4'));var rimraf=require('rimraf');var config=require(_0xdf2d('0x5'));var attributes=require('./voiceQueuesLog.attributes');module[_0xdf2d('0x6')]=function(_0x523d8f,_0x1289f1){return _0x523d8f[_0xdf2d('0x7')]('VoiceQueuesLog',attributes,{'tableName':_0xdf2d('0x8'),'paranoid':![],'indexes':[{'name':_0xdf2d('0x9'),'fields':[_0xdf2d('0xa'),_0xdf2d('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 47f46a4..806bb06 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 _0xe148=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x15b580,_0x343baf){var _0x47cd5e=function(_0x51993a){while(--_0x51993a){_0x15b580['push'](_0x15b580['shift']());}};_0x47cd5e(++_0x343baf);}(_0xe148,0x109));var _0x8e14=function(_0x466e57,_0x21b819){_0x466e57=_0x466e57-0x0;var _0x34df42=_0xe148[_0x466e57];return _0x34df42;};'use strict';var _=require(_0x8e14('0x0'));var util=require(_0x8e14('0x1'));var moment=require(_0x8e14('0x2'));var BPromise=require(_0x8e14('0x3'));var rs=require(_0x8e14('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8e14('0x5'));var logger=require(_0x8e14('0x6'))(_0x8e14('0x7'));var config=require(_0x8e14('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd4a812,_0x1c4b4c,_0x4f595d){return new BPromise(function(_0x4bb4f0,_0x13599a){return client['request'](_0xd4a812,_0x4f595d)[_0x8e14('0x9')](function(_0x1d454c){logger[_0x8e14('0xa')](_0x8e14('0xb'),_0x1c4b4c,_0x8e14('0xc'));logger[_0x8e14('0xd')](_0x8e14('0xe'),_0x1c4b4c,_0x8e14('0xc'),JSON['stringify'](_0x1d454c));if(_0x1d454c[_0x8e14('0xf')]){if(_0x1d454c['error'][_0x8e14('0x10')]===0x1f4){logger[_0x8e14('0xf')](_0x8e14('0xb'),_0x1c4b4c,_0x1d454c[_0x8e14('0xf')][_0x8e14('0x11')]);return _0x13599a(_0x1d454c['error'][_0x8e14('0x11')]);}logger[_0x8e14('0xf')](_0x8e14('0xb'),_0x1c4b4c,_0x1d454c[_0x8e14('0xf')]['message']);return _0x4bb4f0(_0x1d454c[_0x8e14('0xf')]['message']);}else{logger[_0x8e14('0xa')](_0x8e14('0xb'),_0x1c4b4c,_0x8e14('0xc'));_0x4bb4f0(_0x1d454c[_0x8e14('0x12')][_0x8e14('0x11')]);}})['catch'](function(_0x4af728){logger[_0x8e14('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1c4b4c,_0x4af728);_0x13599a(_0x4af728);});});} \ No newline at end of file +var _0x74a7=['lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','request','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch'];(function(_0x5a5f47,_0x42ea38){var _0xb679af=function(_0x136ff4){while(--_0x136ff4){_0x5a5f47['push'](_0x5a5f47['shift']());}};_0xb679af(++_0x42ea38);}(_0x74a7,0x130));var _0x774a=function(_0x513fdd,_0x37da83){_0x513fdd=_0x513fdd-0x0;var _0x105247=_0x74a7[_0x513fdd];return _0x105247;};'use strict';var _=require(_0x774a('0x0'));var util=require('util');var moment=require(_0x774a('0x1'));var BPromise=require(_0x774a('0x2'));var rs=require(_0x774a('0x3'));var fs=require('fs');var Redis=require(_0x774a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x774a('0x5'))(_0x774a('0x6'));var config=require(_0x774a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x774a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x154a28,_0xe260ca,_0x1c9b5c){return new BPromise(function(_0x450104,_0x18c106){return client[_0x774a('0x9')](_0x154a28,_0x1c9b5c)['then'](function(_0x1e5d95){logger['info'](_0x774a('0xa'),_0xe260ca,_0x774a('0xb'));logger[_0x774a('0xc')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0xe260ca,_0x774a('0xb'),JSON[_0x774a('0xd')](_0x1e5d95));if(_0x1e5d95[_0x774a('0xe')]){if(_0x1e5d95[_0x774a('0xe')]['code']===0x1f4){logger[_0x774a('0xe')](_0x774a('0xa'),_0xe260ca,_0x1e5d95['error']['message']);return _0x18c106(_0x1e5d95['error']['message']);}logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0xe260ca,_0x1e5d95[_0x774a('0xe')][_0x774a('0xf')]);return _0x450104(_0x1e5d95[_0x774a('0xe')][_0x774a('0xf')]);}else{logger[_0x774a('0x10')](_0x774a('0xa'),_0xe260ca,'request\x20sent');_0x450104(_0x1e5d95[_0x774a('0x11')][_0x774a('0xf')]);}})[_0x774a('0x12')](function(_0x20d910){logger[_0x774a('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0xe260ca,_0x20d910);_0x18c106(_0x20d910);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 0ff2c55..9bbffe3 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 _0xe576=['isAuthenticated','index','/:id','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe576,0x1a0));var _0x6e57=function(_0x1b0c66,_0x721990){_0x1b0c66=_0x1b0c66-0x0;var _0x185648=_0xe576[_0x1b0c66];return _0x185648;};'use strict';var multer=require(_0x6e57('0x0'));var util=require(_0x6e57('0x1'));var path=require('path');var timeout=require(_0x6e57('0x2'));var express=require(_0x6e57('0x3'));var router=express[_0x6e57('0x4')]();var fs_extra=require(_0x6e57('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6e57('0x6'));var config=require(_0x6e57('0x7'));var controller=require('./voiceRecording.controller');router[_0x6e57('0x8')]('/',auth[_0x6e57('0x9')](),controller[_0x6e57('0xa')]);router[_0x6e57('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x6e57('0x8')](_0x6e57('0xb'),auth[_0x6e57('0x9')](),controller[_0x6e57('0xc')]);router[_0x6e57('0x8')](_0x6e57('0xd'),auth[_0x6e57('0x9')](),controller[_0x6e57('0xe')]);router[_0x6e57('0x8')](_0x6e57('0xf'),controller[_0x6e57('0x10')]);router[_0x6e57('0x8')](_0x6e57('0x11'),auth[_0x6e57('0x9')](),controller[_0x6e57('0x12')]);router[_0x6e57('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6e57('0x13')](_0x6e57('0x11'),auth[_0x6e57('0x9')](),controller[_0x6e57('0x14')]);router[_0x6e57('0x15')](_0x6e57('0xb'),auth['isAuthenticated'](),controller[_0x6e57('0x16')]);router[_0x6e57('0x17')](_0x6e57('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e57('0x18')]=router; \ No newline at end of file +var _0xfdcc=['/:id/transcribe','runTranscribe','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','create','post'];(function(_0xe3bb84,_0xb36db4){var _0x3936de=function(_0x524f09){while(--_0x524f09){_0xe3bb84['push'](_0xe3bb84['shift']());}};_0x3936de(++_0xb36db4);}(_0xfdcc,0xde));var _0xcfdc=function(_0x2e41e2,_0x4e7250){_0x2e41e2=_0x2e41e2-0x0;var _0x2844d6=_0xfdcc[_0x2e41e2];return _0x2844d6;};'use strict';var multer=require(_0xcfdc('0x0'));var util=require(_0xcfdc('0x1'));var path=require('path');var timeout=require(_0xcfdc('0x2'));var express=require(_0xcfdc('0x3'));var router=express['Router']();var fs_extra=require(_0xcfdc('0x4'));var auth=require(_0xcfdc('0x5'));var interaction=require(_0xcfdc('0x6'));var config=require('../../config/environment');var controller=require(_0xcfdc('0x7'));router['get']('/',auth[_0xcfdc('0x8')](),controller['index']);router[_0xcfdc('0x9')](_0xcfdc('0xa'),auth['isAuthenticated'](),controller[_0xcfdc('0xb')]);router['get'](_0xcfdc('0xc'),auth['isAuthenticated'](),controller[_0xcfdc('0xd')]);router[_0xcfdc('0x9')](_0xcfdc('0xe'),auth[_0xcfdc('0x8')](),controller[_0xcfdc('0xf')]);router[_0xcfdc('0x9')](_0xcfdc('0x10'),controller[_0xcfdc('0x11')]);router[_0xcfdc('0x9')]('/:id/transcribe',auth[_0xcfdc('0x8')](),controller[_0xcfdc('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcfdc('0x13')]);router[_0xcfdc('0x14')](_0xcfdc('0x15'),auth[_0xcfdc('0x8')](),controller[_0xcfdc('0x16')]);router[_0xcfdc('0x17')](_0xcfdc('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xcfdc('0x18')](_0xcfdc('0xc'),auth[_0xcfdc('0x8')](),controller[_0xcfdc('0x19')]);module[_0xcfdc('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 1c6daf6..8bfb340 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(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 eced077..7431c06 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 _0x61d4=['basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','query','attributes','fields','length','nolimit','order','filters','pick','where','filter','options','VoiceRecording','include','rows','intersection','includeAll','merge','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','params','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','token','$and','push','recording','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s'];(function(_0x581af1,_0x4f02c5){var _0x54c22e=function(_0x5a7a5a){while(--_0x5a7a5a){_0x581af1['push'](_0x581af1['shift']());}};_0x54c22e(++_0x4f02c5);}(_0x61d4,0x1ef));var _0x461d=function(_0x3eb450,_0x592b0a){_0x3eb450=_0x3eb450-0x0;var _0x2c4cfd=_0x61d4[_0x3eb450];return _0x2c4cfd;};'use strict';var emlformat=require(_0x461d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x461d('0x1'));var jsonpatch=require(_0x461d('0x2'));var rp=require(_0x461d('0x3'));var moment=require(_0x461d('0x4'));var BPromise=require(_0x461d('0x5'));var Mustache=require(_0x461d('0x6'));var util=require(_0x461d('0x7'));var path=require(_0x461d('0x8'));var sox=require(_0x461d('0x9'));var csv=require(_0x461d('0xa'));var ejs=require(_0x461d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x461d('0xc'));var squel=require(_0x461d('0xd'));var crypto=require('crypto');var jsforce=require(_0x461d('0xe'));var deskjs=require(_0x461d('0xf'));var toCsv=require(_0x461d('0xa'));var querystring=require(_0x461d('0x10'));var Papa=require(_0x461d('0x11'));var AWS=require(_0x461d('0x12'));var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require(_0x461d('0x13'));var qs=require(_0x461d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x461d('0x15'))(_0x461d('0x16'));var utils=require(_0x461d('0x17'));var config=require(_0x461d('0x18'));var licenseUtil=require(_0x461d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d40f6,_0x5d3a63){_0x5d3a63=_0x5d3a63||0xcc;return function(_0x10b85){if(_0x10b85){return _0x4d40f6[_0x461d('0x1a')](_0x5d3a63);}return _0x4d40f6[_0x461d('0x1b')](_0x5d3a63)[_0x461d('0x1c')]();};}function respondWithResult(_0x39effb,_0x2921b8){_0x2921b8=_0x2921b8||0xc8;return function(_0x1ea730){if(_0x1ea730){return _0x39effb[_0x461d('0x1b')](_0x2921b8)[_0x461d('0x1d')](_0x1ea730);}};}function respondWithFilteredResult(_0x11cebb,_0xe48c31){return function(_0xec9096){if(_0xec9096){var _0x4e26fe=typeof _0xe48c31[_0x461d('0x1e')]===_0x461d('0x1f')&&typeof _0xe48c31[_0x461d('0x20')]===_0x461d('0x1f');var _0x264aaa=_0xec9096[_0x461d('0x21')];var _0x123d80=_0x4e26fe?0x0:_0xe48c31[_0x461d('0x1e')];var _0x401fbd=_0x4e26fe?_0xec9096[_0x461d('0x21')]:_0xe48c31[_0x461d('0x1e')]+_0xe48c31[_0x461d('0x20')];var _0x529fc0;if(_0x401fbd>=_0x264aaa){_0x401fbd=_0x264aaa;_0x529fc0=0xc8;}else{_0x529fc0=0xce;}_0x11cebb[_0x461d('0x1b')](_0x529fc0);return _0x11cebb[_0x461d('0x22')](_0x461d('0x23'),_0x123d80+'-'+_0x401fbd+'/'+_0x264aaa)[_0x461d('0x1d')](_0xec9096);}return null;};}function patchUpdates(_0x5b5ab0){return function(_0x527e6a){try{jsonpatch[_0x461d('0x24')](_0x527e6a,_0x5b5ab0,!![]);}catch(_0x9e12a6){return BPromise['reject'](_0x9e12a6);}return _0x527e6a[_0x461d('0x25')]();};}function saveUpdates(_0x356408,_0x38f83f){return function(_0x20d1e2){if(_0x20d1e2){return _0x20d1e2[_0x461d('0x26')](_0x356408)[_0x461d('0x27')](function(_0x4732e9){return _0x4732e9;});}return null;};}function removeEntity(_0x5a7340,_0x51b713){return function(_0x25d892){if(_0x25d892){return _0x25d892[_0x461d('0x28')]()[_0x461d('0x27')](function(){_0x5a7340[_0x461d('0x1b')](0xcc)[_0x461d('0x1c')]();});}};}function handleEntityNotFound(_0x37008b,_0x26a09a){return function(_0x4d6088){if(!_0x4d6088){_0x37008b['sendStatus'](0x194);}return _0x4d6088;};}function handleError(_0x53c971,_0x482627){_0x482627=_0x482627||0x1f4;return function(_0x3c9cc4){logger['error'](_0x3c9cc4[_0x461d('0x29')]);if(_0x3c9cc4[_0x461d('0x2a')]){delete _0x3c9cc4[_0x461d('0x2a')];}_0x53c971[_0x461d('0x1b')](_0x482627)[_0x461d('0x2b')](_0x3c9cc4);};}exports[_0x461d('0x2c')]=function(_0x1603e9,_0xa6c413){var _0x2073be={},_0x325035={},_0x4a8282={'count':0x0,'rows':[]};var _0x3153a1=_[_0x461d('0x2d')](db['VoiceRecording'][_0x461d('0x2e')],function(_0x3a0948){return{'name':_0x3a0948[_0x461d('0x2f')],'type':_0x3a0948[_0x461d('0x30')][_0x461d('0x31')]};});_0x325035[_0x461d('0x32')]=_[_0x461d('0x33')](_[_0x461d('0x2d')](_0x3153a1,_0x461d('0x2a')),[_0x461d('0x34')]);_0x325035['query']=_[_0x461d('0x35')](_0x1603e9[_0x461d('0x36')]);_0x325035['filters']=_['intersection'](_0x325035[_0x461d('0x32')],_0x325035[_0x461d('0x36')]);_0x2073be[_0x461d('0x37')]=_['intersection'](_0x325035[_0x461d('0x32')],qs[_0x461d('0x38')](_0x1603e9['query'][_0x461d('0x38')]));_0x2073be['attributes']=_0x2073be['attributes'][_0x461d('0x39')]?_0x2073be[_0x461d('0x37')]:_0x325035['model'];if(!_0x1603e9[_0x461d('0x36')]['hasOwnProperty'](_0x461d('0x3a'))){_0x2073be[_0x461d('0x20')]=qs['limit'](_0x1603e9[_0x461d('0x36')]['limit']);_0x2073be[_0x461d('0x1e')]=qs['offset'](_0x1603e9[_0x461d('0x36')]['offset']);}_0x2073be[_0x461d('0x3b')]=qs['sort'](_0x1603e9[_0x461d('0x36')]['sort']);_0x2073be['where']=qs[_0x461d('0x3c')](_[_0x461d('0x3d')](_0x1603e9[_0x461d('0x36')],_0x325035['filters']),_0x3153a1);if(_0x1603e9[_0x461d('0x36')]['filter']){_0x2073be['where']=_['merge'](_0x2073be[_0x461d('0x3e')],{'$or':_[_0x461d('0x2d')](_0x3153a1,function(_0x1a9916){if(_0x1a9916[_0x461d('0x30')]!=='VIRTUAL'){var _0x8e9a3a={};_0x8e9a3a[_0x1a9916[_0x461d('0x2a')]]={'$like':'%'+_0x1603e9[_0x461d('0x36')][_0x461d('0x3f')]+'%'};return _0x8e9a3a;}})});}_0x2073be=_['merge']({},_0x2073be,_0x1603e9[_0x461d('0x40')]);var _0x311bd3={'where':_0x2073be[_0x461d('0x3e')]};return db[_0x461d('0x41')]['count'](_0x311bd3)[_0x461d('0x27')](function(_0x4e4909){_0x4a8282[_0x461d('0x21')]=_0x4e4909;if(_0x1603e9[_0x461d('0x36')]['includeAll']){_0x2073be[_0x461d('0x42')]=[{'all':!![]}];}return db[_0x461d('0x41')]['findAll'](_0x2073be);})[_0x461d('0x27')](function(_0x2bfb61){_0x4a8282[_0x461d('0x43')]=_0x2bfb61;return _0x4a8282;})[_0x461d('0x27')](respondWithFilteredResult(_0xa6c413,_0x2073be))['catch'](handleError(_0xa6c413,null));};exports['show']=function(_0x3e0476,_0x58873d){var _0x33354a={'raw':![],'where':{'id':_0x3e0476['params']['id']}},_0x4e1696={};_0x4e1696[_0x461d('0x32')]=_['keys'](db[_0x461d('0x41')][_0x461d('0x2e')]);_0x4e1696['query']=_['keys'](_0x3e0476[_0x461d('0x36')]);_0x4e1696[_0x461d('0x3c')]=_[_0x461d('0x44')](_0x4e1696[_0x461d('0x32')],_0x4e1696['query']);_0x33354a[_0x461d('0x37')]=_[_0x461d('0x44')](_0x4e1696[_0x461d('0x32')],qs[_0x461d('0x38')](_0x3e0476[_0x461d('0x36')][_0x461d('0x38')]));_0x33354a[_0x461d('0x37')]=_0x33354a[_0x461d('0x37')][_0x461d('0x39')]?_0x33354a[_0x461d('0x37')]:_0x4e1696['model'];if(_0x3e0476['query'][_0x461d('0x45')]){_0x33354a[_0x461d('0x42')]=[{'all':!![]}];}_0x33354a=_[_0x461d('0x46')]({},_0x33354a,_0x3e0476[_0x461d('0x40')]);return db[_0x461d('0x41')][_0x461d('0x47')](_0x33354a)[_0x461d('0x27')](handleEntityNotFound(_0x58873d,null))[_0x461d('0x27')](respondWithResult(_0x58873d,null))[_0x461d('0x48')](handleError(_0x58873d,null));};exports[_0x461d('0x49')]=function(_0x186230,_0x575c0f){return db[_0x461d('0x41')][_0x461d('0x49')](_0x186230['body'],{})[_0x461d('0x27')](respondWithResult(_0x575c0f,0xc9))[_0x461d('0x48')](handleError(_0x575c0f,null));};exports['update']=function(_0x54e060,_0xdb6113){if(_0x54e060[_0x461d('0x4a')]['id']){delete _0x54e060[_0x461d('0x4a')]['id'];}return db['VoiceRecording'][_0x461d('0x47')]({'where':{'id':_0x54e060['params']['id']}})[_0x461d('0x27')](handleEntityNotFound(_0xdb6113,null))[_0x461d('0x27')](saveUpdates(_0x54e060['body'],null))['then'](respondWithResult(_0xdb6113,null))[_0x461d('0x48')](handleError(_0xdb6113,null));};exports[_0x461d('0x4b')]=function(_0x191065,_0x3a8d24){return db[_0x461d('0x41')][_0x461d('0x4b')]()[_0x461d('0x27')](respondWithResult(_0x3a8d24,null))[_0x461d('0x48')](handleError(_0x3a8d24,null));};exports[_0x461d('0x4c')]=function(_0x2d0383,_0x959418,_0x4bd8ae){var _0x6efdbc=require(_0x461d('0x4d'));var _0x4acd07=![];var _0x248124={};if(_0x2d0383[_0x461d('0x36')][_0x461d('0x30')]&&_0x2d0383[_0x461d('0x36')][_0x461d('0x30')]==='uniqueid'){_0x248124[_0x461d('0x4e')]=_0x2d0383[_0x461d('0x4f')]['id'];}else{_0x248124['id']=_0x2d0383[_0x461d('0x4f')]['id'];}return db[_0x461d('0x41')]['find']({'where':_0x248124,'attributes':['id','value'],'raw':!![]})[_0x461d('0x27')](handleEntityNotFound(_0x959418,null))[_0x461d('0x27')](function(_0x1b4015){if(_0x1b4015){var _0x4e0ced=_0x1b4015[_0x461d('0x50')];var _0x2b47a1=util[_0x461d('0x34')](_0x461d('0x51'),_0x4e0ced);if(fs[_0x461d('0x52')](_0x2b47a1)){_0x4acd07=!![];return _0x6efdbc[_0x461d('0x53')](_0x2b47a1,_0x4e0ced,config[_0x461d('0x54')]['recording'])[_0x461d('0x27')](function(){return _0x1b4015;});}return _0x1b4015;}})[_0x461d('0x27')](function(_0x255346){if(_0x255346){var _0x243e8c=_0x255346['value'];if(!fs[_0x461d('0x52')](_0x243e8c)){throw new db[(_0x461d('0x55'))][(_0x461d('0x56'))](_0x461d('0x57'));}if(_0x255346[_0x461d('0x58')]){return _0x959418[_0x461d('0x4c')](_0x243e8c,_0x255346[_0x461d('0x58')]+path['extname'](_0x243e8c),function(){if(_0x4acd07){fs[_0x461d('0x59')](_0x243e8c);}});}else{return _0x959418[_0x461d('0x4c')](_0x243e8c,function(_0x3eb53c){if(_0x4acd07){fs[_0x461d('0x59')](_0x243e8c);}});}}})[_0x461d('0x48')](function(_0x3ccbcf){if(_0x3ccbcf[_0x461d('0x5a')]===_0x461d('0x57')){_0x959418['status'](0x194)[_0x461d('0x2b')](_0x461d('0x5b'));}else{return handleError(_0x959418,null);}});};exports[_0x461d('0x5c')]=function(_0x26025b,_0x1527c5,_0x487a61){var _0x105610=require(_0x461d('0x4d'));var _0x371681=![];var _0x18dfe9={'$and':[db[_0x461d('0x5d')][_0x461d('0x3e')](db[_0x461d('0x5d')]['fn'](_0x461d('0x5e'),db[_0x461d('0x5d')]['col']('uniqueid')),_0x26025b['query'][_0x461d('0x5f')])]};if(_0x26025b[_0x461d('0x36')]['type']&&_0x26025b['query'][_0x461d('0x30')]===_0x461d('0x4e')){_0x18dfe9[_0x461d('0x60')]['push']({'uniqueid':_0x26025b['params']['id']});}else{_0x18dfe9['$and'][_0x461d('0x61')]({'id':_0x26025b[_0x461d('0x4f')]['id']});}return db[_0x461d('0x41')]['find']({'where':_0x18dfe9,'attributes':['id',_0x461d('0x50')],'raw':!![]})[_0x461d('0x27')](handleEntityNotFound(_0x1527c5,null))['then'](function(_0x31cd0a){if(_0x31cd0a){var _0x3be5ea=util[_0x461d('0x34')](_0x461d('0x51'),_0x31cd0a[_0x461d('0x50')]);if(fs[_0x461d('0x52')](_0x3be5ea)){_0x371681=!![];return _0x105610['decryptFile'](_0x3be5ea,_0x31cd0a[_0x461d('0x50')],config[_0x461d('0x54')][_0x461d('0x62')])[_0x461d('0x27')](function(){return _0x31cd0a;});}return _0x31cd0a;}})[_0x461d('0x27')](function(_0x23c018){if(_0x23c018){if(!fs[_0x461d('0x52')](_0x23c018[_0x461d('0x50')])){throw new db[(_0x461d('0x55'))][(_0x461d('0x56'))](_0x461d('0x57'));}if(_0x23c018['filename']){return _0x1527c5[_0x461d('0x4c')](_0x23c018['value'],_0x23c018[_0x461d('0x58')]+path['extname'](_0x23c018[_0x461d('0x50')]),function(){if(_0x371681){fs[_0x461d('0x59')](_0x23c018[_0x461d('0x50')]);}});}else{return _0x1527c5[_0x461d('0x4c')](_0x23c018['value'],function(_0x3ececc){if(_0x371681){fs['unlink'](_0x23c018[_0x461d('0x50')]);}});}}})[_0x461d('0x48')](handleError(_0x1527c5,null));};exports[_0x461d('0x28')]=function(_0x13df21,_0x1b388c){return db['VoiceRecording'][_0x461d('0x47')]({'where':{'id':_0x13df21[_0x461d('0x4f')]['id']}})[_0x461d('0x27')](function(_0x855184){if(_[_0x461d('0x63')](_0x855184)){throw new ReferenceError(_0x461d('0x64'));}return _0x855184;})['then'](function(_0x10a094){var _0x3484e1=_0x10a094['value'];logger[_0x461d('0x65')](_0x461d('0x66'),_0x3484e1);if(!_[_0x461d('0x63')](_0x10a094[_0x461d('0x50')])&&fs[_0x461d('0x52')](_0x3484e1)){logger[_0x461d('0x65')](_0x461d('0x67')+_0x3484e1+_0x461d('0x68'));fs[_0x461d('0x69')](_0x3484e1);}_0x3484e1=_0x3484e1+_0x461d('0x6a');if(!_['isNil'](_0x10a094['value'])&&fs[_0x461d('0x52')](_0x3484e1)){logger[_0x461d('0x65')](_0x461d('0x67')+_0x3484e1+_0x461d('0x68'));fs[_0x461d('0x69')](_0x3484e1);}return _0x10a094;})[_0x461d('0x27')](function(_0x4f8c55){if(!_0x4f8c55)throw new InternalError();return _0x4f8c55['destroy']();})['then'](function(){_0x1b388c['status'](0xcc)['end']();})[_0x461d('0x48')](handleError(_0x1b388c,null));};function getBucketslist(_0x4401c1,_0x54b069,_0x480ab3){return new Promise(function(_0x87100e,_0x4a67a0){var _0x300d5e=new AWS['S3']({'accessKeyId':_0x54b069,'secretAccessKey':_0x4401c1,'region':_0x480ab3});_0x300d5e[_0x461d('0x6b')]({},function(_0x2029ed,_0x39045d){if(_0x2029ed){return _0x4a67a0(_0x2029ed);}else{return _0x87100e(_0x39045d);}});});}function createBucket(_0x21b33e,_0xd709e8,_0x15fc55,_0x3af7df){return new Promise(function(_0x573881,_0x4e4cc4){var _0x107cb9=new AWS['S3']({'accessKeyId':_0xd709e8,'secretAccessKey':_0x21b33e,'region':_0x15fc55});_0x107cb9[_0x461d('0x6c')]({'Bucket':_0x3af7df},function(_0x3aa2d4,_0x14795d){if(_0x3aa2d4){return _0x4e4cc4(_0x3aa2d4);}else{return _0x573881(_0x14795d);}});});}function uploadFile(_0x57338e,_0x25b5f5,_0x544c0b,_0x379eb2,_0x30f0f4,_0xe758b3){return new Promise(function(_0x7fd51e,_0x56347e){var _0x1b66d6=new AWS['S3']({'accessKeyId':_0x25b5f5,'secretAccessKey':_0x57338e,'region':_0x544c0b});_0x1b66d6[_0x461d('0x6d')]({'Bucket':_0x379eb2,'Key':_0x30f0f4,'Body':_0xe758b3},function(_0x2ab082,_0x1bc4ed){if(_0x2ab082){return _0x56347e(_0x2ab082);}else{return _0x7fd51e(_0x1bc4ed);}});});}function startTranscribe(_0x136445,_0x3f0c57,_0x494379,_0x1dc1f9,_0x3a235d,_0x136ed1){return new Promise(function(_0x4609dd,_0x33eee4){var _0x385edc=new AWS[(_0x461d('0x6e'))]({'accessKeyId':_0x3f0c57,'secretAccessKey':_0x136445,'region':_0x494379});_0x385edc[_0x461d('0x6f')]({'TranscriptionJobName':_0x1dc1f9,'LanguageCode':_0x3a235d,'Media':{'MediaFileUri':_0x136ed1}},function(_0x1fe796,_0x22e8fd){if(_0x1fe796){return _0x33eee4(_0x1fe796);}else{return _0x4609dd(_0x22e8fd);}});});}function transcribe(_0x2dedfe,_0x150be3,_0x4fb45f,_0x3a27f2,_0x3a6e50,_0xa23b45,_0x156f0f){return new Promise(function(_0x1c7163,_0x16f266){var _0x139af8={};logger['info'](util[_0x461d('0x34')](_0x461d('0x70'),_0x2dedfe,_0x3a6e50));return uploadFile(_0x150be3,_0x4fb45f,_0x3a27f2,_0x3a6e50,path[_0x461d('0x71')](_0xa23b45),fs[_0x461d('0x72')](_0xa23b45))[_0x461d('0x27')](function(_0x4db83f){logger['info'](util[_0x461d('0x34')](_0x461d('0x73'),_0x2dedfe,_0x3a6e50,_0x4db83f['Location']));_0x139af8[_0x461d('0x74')]=_0x4db83f[_0x461d('0x75')];_0x139af8[_0x461d('0x76')]=_0x4db83f['Location'];logger[_0x461d('0x65')](util[_0x461d('0x34')](_0x461d('0x77'),_0x2dedfe));return startTranscribe(_0x150be3,_0x4fb45f,_0x3a27f2,uuidv4(),_0x156f0f,_0x4db83f[_0x461d('0x78')]);})[_0x461d('0x27')](function(_0x4ff12b){logger[_0x461d('0x65')](util[_0x461d('0x34')](_0x461d('0x79'),_0x2dedfe,_0x4ff12b[_0x461d('0x7a')]['TranscriptionJobName']));_0x139af8['transcribeName']=_0x4ff12b[_0x461d('0x7a')][_0x461d('0x7b')];_0x139af8[_0x461d('0x7c')]=_0x4ff12b['TranscriptionJob'][_0x461d('0x7d')];return _0x1c7163(_0x139af8);})[_0x461d('0x48')](function(_0x4df187){return _0x16f266(_0x4df187);});});}exports['runTranscribe']=function(_0x5637a9,_0x32ce1e,_0x268038){var _0x52ee4d;var _0x385487;var _0x150505;var _0x16e151=require(_0x461d('0x4d'));return db[_0x461d('0x41')][_0x461d('0x7e')]({'where':{'id':_0x5637a9[_0x461d('0x4f')]['id']}})['then'](function(_0x14f23f){if(_0x14f23f){var _0x52cd63=util[_0x461d('0x34')](_0x461d('0x51'),_0x14f23f[_0x461d('0x50')]);if(fs[_0x461d('0x52')](_0x52cd63)){cypher=!![];return _0x16e151[_0x461d('0x53')](_0x52cd63,_0x14f23f[_0x461d('0x50')],config[_0x461d('0x54')][_0x461d('0x62')])[_0x461d('0x27')](function(){return _0x14f23f;});}return _0x14f23f;}})[_0x461d('0x27')](function(_0x462370){if(!_0x462370){throw new db[(_0x461d('0x55'))][(_0x461d('0x56'))](_0x461d('0x7f'));}_0x385487=_0x462370;return db[_0x461d('0x80')]['findOne']({'where':{'id':0x1}});})[_0x461d('0x27')](handleEntityNotFound(_0x32ce1e,null))[_0x461d('0x27')](function(_0x4f3542){if(_0x4f3542){_0x52ee4d=_0x4f3542;if(!_0x52ee4d['transcribe']||!_0x52ee4d['transcribeAccountId']||!_0x52ee4d['transcribeRegion']||!_0x52ee4d['language']||!_0x52ee4d[_0x461d('0x74')]){throw new db[(_0x461d('0x55'))][(_0x461d('0x56'))](_0x461d('0x81'));}if(_0x5637a9[_0x461d('0x4a')][_0x461d('0x82')]&&(!_0x52ee4d['sentiment']||!_0x52ee4d[_0x461d('0x83')]||!_0x52ee4d[_0x461d('0x84')]||!_0x52ee4d['language']||!_0x52ee4d[_0x461d('0x74')])){throw new db[(_0x461d('0x55'))][(_0x461d('0x56'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0x461d('0x7e')]({'where':{'id':_0x52ee4d[_0x461d('0x85')]}});}})['then'](function(_0xed56ec){if(!_0xed56ec){throw new db[(_0x461d('0x55'))][(_0x461d('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0xed56ec[_0x461d('0x86')]||!_0xed56ec[_0x461d('0x87')]){throw new db[(_0x461d('0x55'))]['ValidationError'](_0x461d('0x88'));}_0x150505=_0xed56ec;return getBucketslist(_0x150505[_0x461d('0x86')],_0x150505['data2'],_0x52ee4d[_0x461d('0x89')]);})['then'](function(_0xed15){if(_0xed15&&_0xed15['Buckets']){var _0x3ff2b8=_[_0x461d('0x47')](_0xed15[_0x461d('0x8a')],function(_0x4f2764){return _0x4f2764['Name']===_0x52ee4d[_0x461d('0x74')];});if(!_0x3ff2b8){logger[_0x461d('0x65')](util['format'](_0x461d('0x8b'),_0x5637a9['params']['id'],_0x52ee4d[_0x461d('0x74')]));return createBucket(_0x150505[_0x461d('0x86')],_0x150505[_0x461d('0x87')],_0x52ee4d[_0x461d('0x89')],_0x52ee4d['bucket']);}logger[_0x461d('0x65')](util['format'](_0x461d('0x8c'),_0x5637a9[_0x461d('0x4f')]['id'],_0x52ee4d['bucket']));return;}})[_0x461d('0x27')](function(_0x330054){if(_0x385487[_0x461d('0x7c')]===_0x461d('0x8d')){return transcribe(_0x5637a9[_0x461d('0x4f')]['id'],_0x150505[_0x461d('0x86')],_0x150505[_0x461d('0x87')],_0x52ee4d[_0x461d('0x89')],_0x52ee4d['bucket'],_0x385487['value'],_0x52ee4d['language']);}else{logger[_0x461d('0x65')](util[_0x461d('0x34')](_0x461d('0x8e'),_0x5637a9['params']['id']));return{'transcribeStatus':_0x461d('0x8f')};}})[_0x461d('0x27')](function(_0x28d655){if(_0x28d655){_0x28d655[_0x461d('0x90')]=_0x5637a9['body'][_0x461d('0x82')];return _0x385487[_0x461d('0x91')](_0x28d655);}})[_0x461d('0x27')](respondWithResult(_0x32ce1e,null))[_0x461d('0x48')](handleError(_0x32ce1e,null));};function writeFile(_0x177b26,_0x503d53){return new Promise(function(_0x53d873,_0x4e6627){fs[_0x461d('0x92')](_0x503d53,_0x177b26,function(_0x26c81c,_0x428a46){if(_0x26c81c){return _0x4e6627(_0x26c81c);}else{return _0x53d873(_0x428a46);}});});}exports[_0x461d('0x93')]=function(_0x444d42,_0x173dee,_0x110842){return db[_0x461d('0x41')][_0x461d('0x7e')]({'where':{'id':_0x444d42[_0x461d('0x4f')]['id']}})[_0x461d('0x27')](handleEntityNotFound(_0x173dee))[_0x461d('0x27')](function(_0x303ee7){if(_0x303ee7&&_0x303ee7['fileText']){var _0x3a965a=_0x303ee7[_0x461d('0x94')];var _0x2a6df8=config[_0x461d('0x95')]+_0x461d('0x96')+_0x303ee7['id']+'.txt';if(fs[_0x461d('0x52')](_0x2a6df8)){return _0x2a6df8;}return writeFile(_0x3a965a,_0x2a6df8)[_0x461d('0x27')](function(){return _0x2a6df8;});}else{throw new db[(_0x461d('0x55'))]['ValidationError'](_0x461d('0x97'));}})[_0x461d('0x27')](function(_0x3dd842){return _0x173dee[_0x461d('0x4c')](_0x3dd842);})[_0x461d('0x48')](handleError(_0x173dee));}; \ No newline at end of file +var _0x876b=['body','params','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','token','$and','push','%s.cypher','Sequelize','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','File:\x20\x22','unlinkSync','end','listBuckets','createBucket','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','Setting','findOne','transcribe','Transcribe\x20not\x20configured','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','then','destroy','error','stack','name','send','index','map','VoiceRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','update'];(function(_0x1ee99d,_0x25aba5){var _0x2cee6b=function(_0x44ac00){while(--_0x44ac00){_0x1ee99d['push'](_0x1ee99d['shift']());}};_0x2cee6b(++_0x25aba5);}(_0x876b,0x185));var _0xb876=function(_0x23cfd4,_0x3b80ad){_0x23cfd4=_0x23cfd4-0x0;var _0x37aae8=_0x876b[_0x23cfd4];return _0x37aae8;};'use strict';var emlformat=require(_0xb876('0x0'));var rimraf=require(_0xb876('0x1'));var zipdir=require(_0xb876('0x2'));var jsonpatch=require(_0xb876('0x3'));var rp=require('request-promise');var moment=require(_0xb876('0x4'));var BPromise=require(_0xb876('0x5'));var Mustache=require(_0xb876('0x6'));var util=require(_0xb876('0x7'));var path=require('path');var sox=require(_0xb876('0x8'));var csv=require(_0xb876('0x9'));var ejs=require(_0xb876('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb876('0xb'));var squel=require(_0xb876('0xc'));var crypto=require('crypto');var jsforce=require(_0xb876('0xd'));var deskjs=require(_0xb876('0xe'));var toCsv=require(_0xb876('0x9'));var querystring=require(_0xb876('0xf'));var Papa=require('papaparse');var AWS=require(_0xb876('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0xb876('0x11'));var authService=require(_0xb876('0x12'));var qs=require(_0xb876('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb876('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xb876('0x15'));var licenseUtil=require(_0xb876('0x16'));var db=require(_0xb876('0x17'))['db'];function respondWithStatusCode(_0x3056a0,_0x41bc05){_0x41bc05=_0x41bc05||0xcc;return function(_0x44a484){if(_0x44a484){return _0x3056a0[_0xb876('0x18')](_0x41bc05);}return _0x3056a0['status'](_0x41bc05)['end']();};}function respondWithResult(_0x4bd211,_0x4b8dfd){_0x4b8dfd=_0x4b8dfd||0xc8;return function(_0x3a7ee8){if(_0x3a7ee8){return _0x4bd211[_0xb876('0x19')](_0x4b8dfd)[_0xb876('0x1a')](_0x3a7ee8);}};}function respondWithFilteredResult(_0x3b0548,_0xbdc5b){return function(_0x2f7fab){if(_0x2f7fab){var _0xe5d68b=typeof _0xbdc5b['offset']===_0xb876('0x1b')&&typeof _0xbdc5b['limit']===_0xb876('0x1b');var _0x560b6b=_0x2f7fab[_0xb876('0x1c')];var _0x272b87=_0xe5d68b?0x0:_0xbdc5b[_0xb876('0x1d')];var _0x25af7c=_0xe5d68b?_0x2f7fab[_0xb876('0x1c')]:_0xbdc5b[_0xb876('0x1d')]+_0xbdc5b[_0xb876('0x1e')];var _0x545792;if(_0x25af7c>=_0x560b6b){_0x25af7c=_0x560b6b;_0x545792=0xc8;}else{_0x545792=0xce;}_0x3b0548[_0xb876('0x19')](_0x545792);return _0x3b0548[_0xb876('0x1f')]('Content-Range',_0x272b87+'-'+_0x25af7c+'/'+_0x560b6b)[_0xb876('0x1a')](_0x2f7fab);}return null;};}function patchUpdates(_0x5292b0){return function(_0x24ccb2){try{jsonpatch[_0xb876('0x20')](_0x24ccb2,_0x5292b0,!![]);}catch(_0x5a3a37){return BPromise[_0xb876('0x21')](_0x5a3a37);}return _0x24ccb2['save']();};}function saveUpdates(_0x424a86,_0x45afd5){return function(_0x49b5e5){if(_0x49b5e5){return _0x49b5e5['update'](_0x424a86)[_0xb876('0x22')](function(_0x2ec4b1){return _0x2ec4b1;});}return null;};}function removeEntity(_0xab7131,_0x4d97cb){return function(_0x5f1236){if(_0x5f1236){return _0x5f1236[_0xb876('0x23')]()[_0xb876('0x22')](function(){_0xab7131['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x966b57,_0x2bbe6f){return function(_0xdf1bcb){if(!_0xdf1bcb){_0x966b57['sendStatus'](0x194);}return _0xdf1bcb;};}function handleError(_0x3c5065,_0x266fc6){_0x266fc6=_0x266fc6||0x1f4;return function(_0xc4f15b){logger[_0xb876('0x24')](_0xc4f15b[_0xb876('0x25')]);if(_0xc4f15b['name']){delete _0xc4f15b[_0xb876('0x26')];}_0x3c5065[_0xb876('0x19')](_0x266fc6)[_0xb876('0x27')](_0xc4f15b);};}exports[_0xb876('0x28')]=function(_0x1d885b,_0x506853){var _0x40b111={},_0x543b68={},_0x5a1f5c={'count':0x0,'rows':[]};var _0x4af8e7=_[_0xb876('0x29')](db[_0xb876('0x2a')]['rawAttributes'],function(_0x32fe0d){return{'name':_0x32fe0d['fieldName'],'type':_0x32fe0d[_0xb876('0x2b')][_0xb876('0x2c')]};});_0x543b68[_0xb876('0x2d')]=_[_0xb876('0x2e')](_[_0xb876('0x29')](_0x4af8e7,_0xb876('0x26')),[_0xb876('0x2f')]);_0x543b68[_0xb876('0x30')]=_[_0xb876('0x31')](_0x1d885b['query']);_0x543b68[_0xb876('0x32')]=_[_0xb876('0x33')](_0x543b68[_0xb876('0x2d')],_0x543b68[_0xb876('0x30')]);_0x40b111['attributes']=_['intersection'](_0x543b68[_0xb876('0x2d')],qs[_0xb876('0x34')](_0x1d885b[_0xb876('0x30')][_0xb876('0x34')]));_0x40b111[_0xb876('0x35')]=_0x40b111[_0xb876('0x35')][_0xb876('0x36')]?_0x40b111[_0xb876('0x35')]:_0x543b68['model'];if(!_0x1d885b['query'][_0xb876('0x37')](_0xb876('0x38'))){_0x40b111[_0xb876('0x1e')]=qs[_0xb876('0x1e')](_0x1d885b[_0xb876('0x30')][_0xb876('0x1e')]);_0x40b111[_0xb876('0x1d')]=qs[_0xb876('0x1d')](_0x1d885b['query'][_0xb876('0x1d')]);}_0x40b111[_0xb876('0x39')]=qs[_0xb876('0x3a')](_0x1d885b[_0xb876('0x30')][_0xb876('0x3a')]);_0x40b111[_0xb876('0x3b')]=qs[_0xb876('0x32')](_[_0xb876('0x3c')](_0x1d885b['query'],_0x543b68[_0xb876('0x32')]),_0x4af8e7);if(_0x1d885b['query'][_0xb876('0x3d')]){_0x40b111['where']=_[_0xb876('0x3e')](_0x40b111['where'],{'$or':_[_0xb876('0x29')](_0x4af8e7,function(_0x2452d6){if(_0x2452d6[_0xb876('0x2b')]!==_0xb876('0x3f')){var _0x3cd88a={};_0x3cd88a[_0x2452d6['name']]={'$like':'%'+_0x1d885b['query'][_0xb876('0x3d')]+'%'};return _0x3cd88a;}})});}_0x40b111=_[_0xb876('0x3e')]({},_0x40b111,_0x1d885b[_0xb876('0x40')]);var _0x1ce110={'where':_0x40b111[_0xb876('0x3b')]};return db[_0xb876('0x2a')][_0xb876('0x1c')](_0x1ce110)[_0xb876('0x22')](function(_0x34d4fe){_0x5a1f5c[_0xb876('0x1c')]=_0x34d4fe;if(_0x1d885b[_0xb876('0x30')][_0xb876('0x41')]){_0x40b111[_0xb876('0x42')]=[{'all':!![]}];}return db[_0xb876('0x2a')][_0xb876('0x43')](_0x40b111);})[_0xb876('0x22')](function(_0x556699){_0x5a1f5c[_0xb876('0x44')]=_0x556699;return _0x5a1f5c;})[_0xb876('0x22')](respondWithFilteredResult(_0x506853,_0x40b111))[_0xb876('0x45')](handleError(_0x506853,null));};exports['show']=function(_0x3b6073,_0x37771f){var _0x429fbc={'raw':![],'where':{'id':_0x3b6073['params']['id']}},_0x3125f6={};_0x3125f6[_0xb876('0x2d')]=_[_0xb876('0x31')](db[_0xb876('0x2a')]['rawAttributes']);_0x3125f6[_0xb876('0x30')]=_[_0xb876('0x31')](_0x3b6073[_0xb876('0x30')]);_0x3125f6['filters']=_['intersection'](_0x3125f6['model'],_0x3125f6[_0xb876('0x30')]);_0x429fbc['attributes']=_[_0xb876('0x33')](_0x3125f6[_0xb876('0x2d')],qs[_0xb876('0x34')](_0x3b6073[_0xb876('0x30')][_0xb876('0x34')]));_0x429fbc[_0xb876('0x35')]=_0x429fbc['attributes'][_0xb876('0x36')]?_0x429fbc['attributes']:_0x3125f6[_0xb876('0x2d')];if(_0x3b6073['query'][_0xb876('0x41')]){_0x429fbc[_0xb876('0x42')]=[{'all':!![]}];}_0x429fbc=_[_0xb876('0x3e')]({},_0x429fbc,_0x3b6073['options']);return db[_0xb876('0x2a')][_0xb876('0x46')](_0x429fbc)[_0xb876('0x22')](handleEntityNotFound(_0x37771f,null))[_0xb876('0x22')](respondWithResult(_0x37771f,null))[_0xb876('0x45')](handleError(_0x37771f,null));};exports[_0xb876('0x47')]=function(_0x2e5756,_0x3ecebe){return db[_0xb876('0x2a')][_0xb876('0x47')](_0x2e5756['body'],{})['then'](respondWithResult(_0x3ecebe,0xc9))['catch'](handleError(_0x3ecebe,null));};exports[_0xb876('0x48')]=function(_0x184df8,_0x1e7329){if(_0x184df8[_0xb876('0x49')]['id']){delete _0x184df8[_0xb876('0x49')]['id'];}return db[_0xb876('0x2a')][_0xb876('0x46')]({'where':{'id':_0x184df8[_0xb876('0x4a')]['id']}})[_0xb876('0x22')](handleEntityNotFound(_0x1e7329,null))[_0xb876('0x22')](saveUpdates(_0x184df8['body'],null))[_0xb876('0x22')](respondWithResult(_0x1e7329,null))[_0xb876('0x45')](handleError(_0x1e7329,null));};exports['describe']=function(_0x3aff77,_0x593c7c){return db[_0xb876('0x2a')][_0xb876('0x4b')]()['then'](respondWithResult(_0x593c7c,null))[_0xb876('0x45')](handleError(_0x593c7c,null));};exports[_0xb876('0x4c')]=function(_0x6e9dfb,_0x10d148,_0x343d4c){var _0x3744af=require(_0xb876('0x4d'));var _0x2cb446=![];var _0x2873cd={};if(_0x6e9dfb['query']['type']&&_0x6e9dfb['query']['type']==='uniqueid'){_0x2873cd[_0xb876('0x4e')]=_0x6e9dfb[_0xb876('0x4a')]['id'];}else{_0x2873cd['id']=_0x6e9dfb['params']['id'];}return db[_0xb876('0x2a')][_0xb876('0x46')]({'where':_0x2873cd,'attributes':['id',_0xb876('0x4f')],'raw':!![]})[_0xb876('0x22')](handleEntityNotFound(_0x10d148,null))[_0xb876('0x22')](function(_0x4ecf19){if(_0x4ecf19){var _0x366b3d=_0x4ecf19[_0xb876('0x4f')];var _0x115b57=util[_0xb876('0x2f')]('%s.cypher',_0x366b3d);if(fs[_0xb876('0x50')](_0x115b57)){_0x2cb446=!![];return _0x3744af[_0xb876('0x51')](_0x115b57,_0x366b3d,config[_0xb876('0x52')][_0xb876('0x53')])['then'](function(){return _0x4ecf19;});}return _0x4ecf19;}})[_0xb876('0x22')](function(_0x5e333f){if(_0x5e333f){var _0x5c2e21=_0x5e333f[_0xb876('0x4f')];if(!fs[_0xb876('0x50')](_0x5c2e21)){throw new db['Sequelize'][(_0xb876('0x54'))](_0xb876('0x55'));}if(_0x5e333f['filename']){return _0x10d148[_0xb876('0x4c')](_0x5c2e21,_0x5e333f[_0xb876('0x56')]+path[_0xb876('0x57')](_0x5c2e21),function(){if(_0x2cb446){fs[_0xb876('0x58')](_0x5c2e21);}});}else{return _0x10d148[_0xb876('0x4c')](_0x5c2e21,function(_0x168315){if(_0x2cb446){fs[_0xb876('0x58')](_0x5c2e21);}});}}})[_0xb876('0x45')](function(_0x5ac800){if(_0x5ac800[_0xb876('0x59')]==='VoiceRecording\x20not\x20found'){_0x10d148['status'](0x194)[_0xb876('0x27')](_0xb876('0x5a'));}else{return handleError(_0x10d148,null);}});};exports[_0xb876('0x5b')]=function(_0x41d673,_0xc26161,_0x340511){var _0x35b153=require('../../components/encryptor');var _0x28ed9a=![];var _0x44d181={'$and':[db[_0xb876('0x5c')]['where'](db[_0xb876('0x5c')]['fn'](_0xb876('0x5d'),db['sequelize']['col'](_0xb876('0x4e'))),_0x41d673[_0xb876('0x30')][_0xb876('0x5e')])]};if(_0x41d673[_0xb876('0x30')][_0xb876('0x2b')]&&_0x41d673[_0xb876('0x30')]['type']===_0xb876('0x4e')){_0x44d181['$and']['push']({'uniqueid':_0x41d673[_0xb876('0x4a')]['id']});}else{_0x44d181[_0xb876('0x5f')][_0xb876('0x60')]({'id':_0x41d673[_0xb876('0x4a')]['id']});}return db[_0xb876('0x2a')][_0xb876('0x46')]({'where':_0x44d181,'attributes':['id',_0xb876('0x4f')],'raw':!![]})[_0xb876('0x22')](handleEntityNotFound(_0xc26161,null))['then'](function(_0x5cd94d){if(_0x5cd94d){var _0x377d44=util[_0xb876('0x2f')](_0xb876('0x61'),_0x5cd94d[_0xb876('0x4f')]);if(fs[_0xb876('0x50')](_0x377d44)){_0x28ed9a=!![];return _0x35b153[_0xb876('0x51')](_0x377d44,_0x5cd94d[_0xb876('0x4f')],config[_0xb876('0x52')][_0xb876('0x53')])[_0xb876('0x22')](function(){return _0x5cd94d;});}return _0x5cd94d;}})['then'](function(_0x12332a){if(_0x12332a){if(!fs[_0xb876('0x50')](_0x12332a['value'])){throw new db[(_0xb876('0x62'))][(_0xb876('0x54'))](_0xb876('0x55'));}if(_0x12332a['filename']){return _0xc26161[_0xb876('0x4c')](_0x12332a[_0xb876('0x4f')],_0x12332a['filename']+path[_0xb876('0x57')](_0x12332a['value']),function(){if(_0x28ed9a){fs[_0xb876('0x58')](_0x12332a[_0xb876('0x4f')]);}});}else{return _0xc26161[_0xb876('0x4c')](_0x12332a[_0xb876('0x4f')],function(_0x312e55){if(_0x28ed9a){fs[_0xb876('0x58')](_0x12332a['value']);}});}}})['catch'](handleError(_0xc26161,null));};exports[_0xb876('0x23')]=function(_0x5eb4c6,_0x577ad5){return db[_0xb876('0x2a')]['find']({'where':{'id':_0x5eb4c6[_0xb876('0x4a')]['id']}})[_0xb876('0x22')](function(_0x49a43d){if(_[_0xb876('0x63')](_0x49a43d)){throw new ReferenceError('Entity\x20not\x20found');}return _0x49a43d;})['then'](function(_0x38ab74){var _0x412aee=_0x38ab74[_0xb876('0x4f')];logger[_0xb876('0x64')](_0xb876('0x65'),_0x412aee);if(!_[_0xb876('0x63')](_0x38ab74[_0xb876('0x4f')])&&fs[_0xb876('0x50')](_0x412aee)){logger[_0xb876('0x64')]('File:\x20\x22'+_0x412aee+_0xb876('0x66'));fs['unlinkSync'](_0x412aee);}_0x412aee=_0x412aee+_0xb876('0x67');if(!_[_0xb876('0x63')](_0x38ab74[_0xb876('0x4f')])&&fs[_0xb876('0x50')](_0x412aee)){logger[_0xb876('0x64')](_0xb876('0x68')+_0x412aee+_0xb876('0x66'));fs[_0xb876('0x69')](_0x412aee);}return _0x38ab74;})[_0xb876('0x22')](function(_0x3a0171){if(!_0x3a0171)throw new InternalError();return _0x3a0171[_0xb876('0x23')]();})[_0xb876('0x22')](function(){_0x577ad5['status'](0xcc)[_0xb876('0x6a')]();})[_0xb876('0x45')](handleError(_0x577ad5,null));};function getBucketslist(_0x23737e,_0x3c460a,_0x4d028f){return new Promise(function(_0xbb76a0,_0x23db39){var _0x105390=new AWS['S3']({'accessKeyId':_0x3c460a,'secretAccessKey':_0x23737e,'region':_0x4d028f});_0x105390[_0xb876('0x6b')]({},function(_0x29f7d1,_0x3437a9){if(_0x29f7d1){return _0x23db39(_0x29f7d1);}else{return _0xbb76a0(_0x3437a9);}});});}function createBucket(_0x28b41c,_0x17769a,_0x943864,_0x354f6f){return new Promise(function(_0x2cc3d8,_0x49102c){var _0x4baec3=new AWS['S3']({'accessKeyId':_0x17769a,'secretAccessKey':_0x28b41c,'region':_0x943864});_0x4baec3[_0xb876('0x6c')]({'Bucket':_0x354f6f},function(_0x27658f,_0x159801){if(_0x27658f){return _0x49102c(_0x27658f);}else{return _0x2cc3d8(_0x159801);}});});}function uploadFile(_0x27702f,_0x64d59d,_0x49bd03,_0x544437,_0x4b6dc2,_0x3d6bcd){return new Promise(function(_0x50e7c2,_0xb22923){var _0x153e1a=new AWS['S3']({'accessKeyId':_0x64d59d,'secretAccessKey':_0x27702f,'region':_0x49bd03});_0x153e1a['upload']({'Bucket':_0x544437,'Key':_0x4b6dc2,'Body':_0x3d6bcd},function(_0x29b008,_0x3cc685){if(_0x29b008){return _0xb22923(_0x29b008);}else{return _0x50e7c2(_0x3cc685);}});});}function startTranscribe(_0x145240,_0x1f7849,_0x38ffb3,_0x1d3e17,_0x5a3b72,_0x5d4a56){return new Promise(function(_0x77743,_0x1f6f4c){var _0x452b2c=new AWS['TranscribeService']({'accessKeyId':_0x1f7849,'secretAccessKey':_0x145240,'region':_0x38ffb3});_0x452b2c[_0xb876('0x6d')]({'TranscriptionJobName':_0x1d3e17,'LanguageCode':_0x5a3b72,'Media':{'MediaFileUri':_0x5d4a56}},function(_0x538871,_0xd2d8c9){if(_0x538871){return _0x1f6f4c(_0x538871);}else{return _0x77743(_0xd2d8c9);}});});}function transcribe(_0x4691fd,_0x4cf207,_0x14ccd3,_0x2d1bb5,_0x2a44f5,_0x2eb9a1,_0x242772){return new Promise(function(_0x238dd0,_0x521cc3){var _0xcd4aad={};logger['info'](util[_0xb876('0x2f')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x4691fd,_0x2a44f5));return uploadFile(_0x4cf207,_0x14ccd3,_0x2d1bb5,_0x2a44f5,path[_0xb876('0x6e')](_0x2eb9a1),fs[_0xb876('0x6f')](_0x2eb9a1))[_0xb876('0x22')](function(_0x18c201){logger[_0xb876('0x64')](util['format'](_0xb876('0x70'),_0x4691fd,_0x2a44f5,_0x18c201[_0xb876('0x71')]));_0xcd4aad[_0xb876('0x72')]=_0x18c201[_0xb876('0x73')];_0xcd4aad['location']=_0x18c201[_0xb876('0x71')];logger[_0xb876('0x64')](util[_0xb876('0x2f')](_0xb876('0x74'),_0x4691fd));return startTranscribe(_0x4cf207,_0x14ccd3,_0x2d1bb5,uuidv4(),_0x242772,_0x18c201[_0xb876('0x71')]);})[_0xb876('0x22')](function(_0x1e0aec){logger['info'](util[_0xb876('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x4691fd,_0x1e0aec[_0xb876('0x75')][_0xb876('0x76')]));_0xcd4aad[_0xb876('0x77')]=_0x1e0aec[_0xb876('0x75')][_0xb876('0x76')];_0xcd4aad[_0xb876('0x78')]=_0x1e0aec[_0xb876('0x75')][_0xb876('0x79')];return _0x238dd0(_0xcd4aad);})[_0xb876('0x45')](function(_0x12b568){return _0x521cc3(_0x12b568);});});}exports[_0xb876('0x7a')]=function(_0x148cf7,_0x46f20b,_0x451b1b){var _0x2f4786;var _0x2cf725;var _0x435bf3;var _0x139599=require('../../components/encryptor');return db[_0xb876('0x2a')]['findOne']({'where':{'id':_0x148cf7[_0xb876('0x4a')]['id']}})[_0xb876('0x22')](function(_0x373951){if(_0x373951){var _0x140f84=util[_0xb876('0x2f')](_0xb876('0x61'),_0x373951[_0xb876('0x4f')]);if(fs['existsSync'](_0x140f84)){cypher=!![];return _0x139599[_0xb876('0x51')](_0x140f84,_0x373951[_0xb876('0x4f')],config[_0xb876('0x52')][_0xb876('0x53')])['then'](function(){return _0x373951;});}return _0x373951;}})[_0xb876('0x22')](function(_0x4df5de){if(!_0x4df5de){throw new db['Sequelize'][(_0xb876('0x54'))]('Voice\x20Recording\x20not\x20found');}_0x2cf725=_0x4df5de;return db[_0xb876('0x7b')][_0xb876('0x7c')]({'where':{'id':0x1}});})[_0xb876('0x22')](handleEntityNotFound(_0x46f20b,null))[_0xb876('0x22')](function(_0x54be7e){if(_0x54be7e){_0x2f4786=_0x54be7e;if(!_0x2f4786[_0xb876('0x7d')]||!_0x2f4786['transcribeAccountId']||!_0x2f4786['transcribeRegion']||!_0x2f4786['language']||!_0x2f4786[_0xb876('0x72')]){throw new db[(_0xb876('0x62'))][(_0xb876('0x54'))](_0xb876('0x7e'));}if(_0x148cf7[_0xb876('0x49')]['runSentiment']&&(!_0x2f4786[_0xb876('0x7f')]||!_0x2f4786['sentimentAccountId']||!_0x2f4786[_0xb876('0x80')]||!_0x2f4786[_0xb876('0x81')]||!_0x2f4786[_0xb876('0x72')])){throw new db[(_0xb876('0x62'))][(_0xb876('0x54'))](_0xb876('0x82'));}return db[_0xb876('0x83')][_0xb876('0x7c')]({'where':{'id':_0x2f4786[_0xb876('0x84')]}});}})[_0xb876('0x22')](function(_0x719756){if(!_0x719756){throw new db['Sequelize'][(_0xb876('0x54'))](_0xb876('0x85'));}if(!_0x719756[_0xb876('0x86')]||!_0x719756[_0xb876('0x87')]){throw new db[(_0xb876('0x62'))][(_0xb876('0x54'))](_0xb876('0x88'));}_0x435bf3=_0x719756;return getBucketslist(_0x435bf3[_0xb876('0x86')],_0x435bf3[_0xb876('0x87')],_0x2f4786['transcribeRegion']);})[_0xb876('0x22')](function(_0x41a45b){if(_0x41a45b&&_0x41a45b['Buckets']){var _0x430e56=_[_0xb876('0x46')](_0x41a45b[_0xb876('0x89')],function(_0x9efebc){return _0x9efebc[_0xb876('0x8a')]===_0x2f4786[_0xb876('0x72')];});if(!_0x430e56){logger[_0xb876('0x64')](util[_0xb876('0x2f')](_0xb876('0x8b'),_0x148cf7[_0xb876('0x4a')]['id'],_0x2f4786[_0xb876('0x72')]));return createBucket(_0x435bf3[_0xb876('0x86')],_0x435bf3[_0xb876('0x87')],_0x2f4786[_0xb876('0x8c')],_0x2f4786[_0xb876('0x72')]);}logger['info'](util['format'](_0xb876('0x8d'),_0x148cf7['params']['id'],_0x2f4786['bucket']));return;}})['then'](function(_0x134198){if(_0x2cf725[_0xb876('0x78')]===_0xb876('0x8e')){return transcribe(_0x148cf7[_0xb876('0x4a')]['id'],_0x435bf3[_0xb876('0x86')],_0x435bf3[_0xb876('0x87')],_0x2f4786['transcribeRegion'],_0x2f4786[_0xb876('0x72')],_0x2cf725['value'],_0x2f4786['language']);}else{logger['info'](util[_0xb876('0x2f')](_0xb876('0x8f'),_0x148cf7[_0xb876('0x4a')]['id']));return{'transcribeStatus':_0xb876('0x90')};}})[_0xb876('0x22')](function(_0x328790){if(_0x328790){_0x328790[_0xb876('0x91')]=_0x148cf7[_0xb876('0x49')][_0xb876('0x92')];return _0x2cf725[_0xb876('0x93')](_0x328790);}})[_0xb876('0x22')](respondWithResult(_0x46f20b,null))[_0xb876('0x45')](handleError(_0x46f20b,null));};function writeFile(_0xbb72df,_0x21b8fb){return new Promise(function(_0x482b29,_0x511618){fs['writeFile'](_0x21b8fb,_0xbb72df,function(_0x3f0e06,_0x50148e){if(_0x3f0e06){return _0x511618(_0x3f0e06);}else{return _0x482b29(_0x50148e);}});});}exports[_0xb876('0x94')]=function(_0x436bd9,_0x36528d,_0x1e416a){return db['VoiceRecording']['findOne']({'where':{'id':_0x436bd9['params']['id']}})[_0xb876('0x22')](handleEntityNotFound(_0x36528d))[_0xb876('0x22')](function(_0x1c84c4){if(_0x1c84c4&&_0x1c84c4[_0xb876('0x95')]){var _0x1540a4=_0x1c84c4[_0xb876('0x95')];var _0x49b9b5=config[_0xb876('0x96')]+_0xb876('0x97')+_0x1c84c4['id']+_0xb876('0x98');if(fs[_0xb876('0x50')](_0x49b9b5)){return _0x49b9b5;}return writeFile(_0x1540a4,_0x49b9b5)['then'](function(){return _0x49b9b5;});}else{throw new db[(_0xb876('0x62'))]['ValidationError'](_0xb876('0x99'));}})[_0xb876('0x22')](function(_0x436dbf){return _0x36528d[_0xb876('0x4c')](_0x436dbf);})[_0xb876('0x45')](handleError(_0x36528d));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 04a3726..4541cd7 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 _0x347d=['uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','voice_recordings'];(function(_0x32894c,_0x44704e){var _0x4b38e7=function(_0x367e89){while(--_0x367e89){_0x32894c['push'](_0x32894c['shift']());}};_0x4b38e7(++_0x44704e);}(_0x347d,0x17a));var _0xd347=function(_0x4d0b12,_0x3e5cc3){_0x4d0b12=_0x4d0b12-0x0;var _0x399589=_0x347d[_0x4d0b12];return _0x399589;};'use strict';var _=require(_0xd347('0x0'));var util=require(_0xd347('0x1'));var logger=require(_0xd347('0x2'))(_0xd347('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd347('0x4'));var fs=require('fs');var path=require(_0xd347('0x5'));var rimraf=require(_0xd347('0x6'));var config=require(_0xd347('0x7'));var attributes=require(_0xd347('0x8'));module[_0xd347('0x9')]=function(_0x55305f,_0x512511){return _0x55305f[_0xd347('0xa')]('VoiceRecording',attributes,{'tableName':_0xd347('0xb'),'paranoid':![],'indexes':[{'name':_0xd347('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x093f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceRecording','voice_recordings','uniqueid'];(function(_0xdfdaf8,_0x16165f){var _0xfa0dc5=function(_0x1dd786){while(--_0x1dd786){_0xdfdaf8['push'](_0xdfdaf8['shift']());}};_0xfa0dc5(++_0x16165f);}(_0x093f,0xd2));var _0xf093=function(_0x19e5fe,_0x25a33a){_0x19e5fe=_0x19e5fe-0x0;var _0x33d1a3=_0x093f[_0x19e5fe];return _0x33d1a3;};'use strict';var _=require(_0xf093('0x0'));var util=require(_0xf093('0x1'));var logger=require(_0xf093('0x2'))(_0xf093('0x3'));var moment=require(_0xf093('0x4'));var BPromise=require(_0xf093('0x5'));var rp=require(_0xf093('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf093('0x7'));var config=require(_0xf093('0x8'));var attributes=require('./voiceRecording.attributes');module[_0xf093('0x9')]=function(_0x265810,_0x10dc05){return _0x265810[_0xf093('0xa')](_0xf093('0xb'),attributes,{'tableName':_0xf093('0xc'),'paranoid':![],'indexes':[{'name':_0xf093('0xd'),'fields':[_0xf093('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index b548d50..1532383 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 _0xd117=['create','callRecordingEncryption','value','format','encryptFile','recording','unlink','CreateVoiceRecording','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','catch','VoiceRecording','body','options','raw','where','attributes','UpdateVoiceRecording','Setting','findOne','then'];(function(_0x82c7eb,_0x17a57e){var _0x2419ff=function(_0x134bd3){while(--_0x134bd3){_0x82c7eb['push'](_0x82c7eb['shift']());}};_0x2419ff(++_0x17a57e);}(_0xd117,0x182));var _0x7d11=function(_0x27380a,_0x11b4db){_0x27380a=_0x27380a-0x0;var _0x49557d=_0xd117[_0x27380a];return _0x49557d;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var moment=require(_0x7d11('0x2'));var BPromise=require(_0x7d11('0x3'));var rs=require(_0x7d11('0x4'));var fs=require('fs');var Redis=require(_0x7d11('0x5'));var db=require(_0x7d11('0x6'))['db'];var utils=require(_0x7d11('0x7'));var logger=require(_0x7d11('0x8'))(_0x7d11('0x9'));var config=require(_0x7d11('0xa'));var jayson=require(_0x7d11('0xb'));var client=jayson[_0x7d11('0xc')][_0x7d11('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x345602,_0x3c8d66,_0x47b5e6){return new BPromise(function(_0x3803b5,_0xffd020){return client[_0x7d11('0xe')](_0x345602,_0x47b5e6)['then'](function(_0x305eef){logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,'request\x20sent');logger[_0x7d11('0x11')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x3c8d66,'request\x20sent',JSON[_0x7d11('0x12')](_0x305eef));if(_0x305eef['error']){if(_0x305eef['error'][_0x7d11('0x13')]===0x1f4){logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')]['message']);return _0xffd020(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}logger['error'](_0x7d11('0x10'),_0x3c8d66,_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);return _0x3803b5(_0x305eef[_0x7d11('0x14')][_0x7d11('0x15')]);}else{logger[_0x7d11('0xf')](_0x7d11('0x10'),_0x3c8d66,_0x7d11('0x16'));_0x3803b5(_0x305eef['result'][_0x7d11('0x15')]);}})[_0x7d11('0x17')](function(_0x169733){logger[_0x7d11('0x14')](_0x7d11('0x10'),_0x3c8d66,_0x169733);_0xffd020(_0x169733);});});}exports['UpdateVoiceRecording']=function(_0x456cb9){var _0x49a34b=this;return new Promise(function(_0x4d1306,_0x5459df){return db[_0x7d11('0x18')]['update'](_0x456cb9[_0x7d11('0x19')],{'raw':_0x456cb9['options']?_0x456cb9[_0x7d11('0x1a')][_0x7d11('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x456cb9[_0x7d11('0x1a')]?_0x456cb9[_0x7d11('0x1a')][_0x7d11('0x1c')]||null:null,'attributes':_0x456cb9[_0x7d11('0x1a')]?_0x456cb9[_0x7d11('0x1a')][_0x7d11('0x1d')]||null:null,'limit':_0x456cb9['options']?_0x456cb9[_0x7d11('0x1a')]['limit']||null:null})['then'](function(_0x5c3898){logger[_0x7d11('0xf')](_0x7d11('0x1e'),_0x456cb9);logger[_0x7d11('0x11')](_0x7d11('0x1e'),_0x456cb9,JSON[_0x7d11('0x12')](_0x5c3898));_0x4d1306(_0x5c3898);})[_0x7d11('0x17')](function(_0x282e5c){logger[_0x7d11('0x14')]('UpdateVoiceRecording',_0x282e5c[_0x7d11('0x15')],_0x456cb9);_0x5459df(_0x49a34b['error'](0x1f4,_0x282e5c['message']));});});};exports['CreateVoiceRecording']=function(_0x3ba092){var _0x59cdba=this;return new Promise(function(_0x180e1e,_0x30e4c6){var _0x328ab7=require('../../components/encryptor');var _0x46f76a;return db[_0x7d11('0x1f')][_0x7d11('0x20')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x7d11('0x21')](function(_0x35a789){_0x46f76a=_0x35a789;return db[_0x7d11('0x18')][_0x7d11('0x22')](_0x3ba092['body']);})[_0x7d11('0x21')](function(_0x512f7f){if(_0x46f76a[_0x7d11('0x23')]&&fs['existsSync'](_0x512f7f[_0x7d11('0x24')])){var _0xba4e80=util[_0x7d11('0x25')]('%s.cypher',_0x512f7f['value']);return _0x328ab7[_0x7d11('0x26')](_0x512f7f[_0x7d11('0x24')],_0xba4e80,config['secrets'][_0x7d11('0x27')])[_0x7d11('0x21')](function(){fs[_0x7d11('0x28')](_0x512f7f['value']);logger[_0x7d11('0xf')]('CreateVoiceRecording\x20file\x20encrypted');return _0x512f7f;});}return _0x512f7f;})['then'](function(_0x3a88c9){logger['info'](_0x7d11('0x29'),_0x3ba092);logger[_0x7d11('0x11')](_0x7d11('0x29'),_0x3ba092,JSON[_0x7d11('0x12')](_0x3a88c9));_0x180e1e(_0x3a88c9);})['catch'](function(_0x11d9e2){logger[_0x7d11('0x14')]('CreateVoiceRecording',_0x11d9e2['message'],_0x3ba092);_0x30e4c6(_0x59cdba[_0x7d11('0x14')](0x1f4,_0x11d9e2[_0x7d11('0x15')]));});});}; \ No newline at end of file +var _0x4975=['catch','VoiceRecording','update','body','options','raw','where','limit','then','UpdateVoiceRecording','CreateVoiceRecording','create','value','format','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x81fe53,_0x5b8f05){var _0x56f7a7=function(_0x1e7846){while(--_0x1e7846){_0x81fe53['push'](_0x81fe53['shift']());}};_0x56f7a7(++_0x5b8f05);}(_0x4975,0x86));var _0x5497=function(_0x2e11a8,_0x4d8d31){_0x2e11a8=_0x2e11a8-0x0;var _0x523116=_0x4975[_0x2e11a8];return _0x523116;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('VoiceRecording,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['UpdateVoiceRecording']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')](_0x3f4d20[_0x5497('0x19')],{'raw':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')][_0x5497('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')][_0x5497('0x1c')]||null:null,'attributes':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20[_0x5497('0x1a')]['attributes']||null:null,'limit':_0x3f4d20[_0x5497('0x1a')]?_0x3f4d20['options'][_0x5497('0x1d')]||null:null})[_0x5497('0x1e')](function(_0x44265c){logger[_0x5497('0xd')](_0x5497('0x1f'),_0x3f4d20);logger[_0x5497('0x10')]('UpdateVoiceRecording',_0x3f4d20,JSON['stringify'](_0x44265c));_0x3a47fd(_0x44265c);})[_0x5497('0x16')](function(_0x34b97f){logger[_0x5497('0x13')](_0x5497('0x1f'),_0x34b97f['message'],_0x3f4d20);_0x5d9e24(_0x1bf442[_0x5497('0x13')](0x1f4,_0x34b97f['message']));});});};exports[_0x5497('0x20')]=function(_0x16a2b4){var _0x429d36=this;return new Promise(function(_0x34a1a5,_0x163a30){var _0x31cd01=require('../../components/encryptor');var _0x4af5f4;return db['Setting']['findOne']({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0x5497('0x1e')](function(_0x48d146){_0x4af5f4=_0x48d146;return db['VoiceRecording'][_0x5497('0x21')](_0x16a2b4[_0x5497('0x19')]);})[_0x5497('0x1e')](function(_0x4c442a){if(_0x4af5f4['callRecordingEncryption']&&fs['existsSync'](_0x4c442a[_0x5497('0x22')])){var _0x471e0b=util[_0x5497('0x23')]('%s.cypher',_0x4c442a['value']);return _0x31cd01['encryptFile'](_0x4c442a[_0x5497('0x22')],_0x471e0b,config['secrets'][_0x5497('0x24')])[_0x5497('0x1e')](function(){fs[_0x5497('0x25')](_0x4c442a['value']);logger[_0x5497('0xd')](_0x5497('0x26'));return _0x4c442a;});}return _0x4c442a;})['then'](function(_0xce7cb2){logger[_0x5497('0xd')](_0x5497('0x20'),_0x16a2b4);logger['debug'](_0x5497('0x20'),_0x16a2b4,JSON[_0x5497('0x12')](_0xce7cb2));_0x34a1a5(_0xce7cb2);})[_0x5497('0x16')](function(_0x362b96){logger[_0x5497('0x13')]('CreateVoiceRecording',_0x362b96[_0x5497('0x14')],_0x16a2b4);_0x163a30(_0x429d36[_0x5497('0x13')](0x1f4,_0x362b96['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index e4acca1..9aca0ea 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 _0x9977=['index','/describe','describe','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get'];(function(_0x540500,_0x3a0fc6){var _0x550a2f=function(_0x52e137){while(--_0x52e137){_0x540500['push'](_0x540500['shift']());}};_0x550a2f(++_0x3a0fc6);}(_0x9977,0x1ee));var _0x7997=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0x9977[_0x1b6c6d];return _0x290d9d;};'use strict';var multer=require(_0x7997('0x0'));var util=require(_0x7997('0x1'));var path=require(_0x7997('0x2'));var timeout=require(_0x7997('0x3'));var express=require(_0x7997('0x4'));var router=express[_0x7997('0x5')]();var fs_extra=require(_0x7997('0x6'));var auth=require(_0x7997('0x7'));var interaction=require(_0x7997('0x8'));var config=require(_0x7997('0x9'));var controller=require(_0x7997('0xa'));router[_0x7997('0xb')]('/',auth['isAuthenticated'](),controller[_0x7997('0xc')]);router[_0x7997('0xb')](_0x7997('0xd'),auth['isAuthenticated'](),controller[_0x7997('0xe')]);router[_0x7997('0xb')](_0x7997('0xf'),auth[_0x7997('0x10')](),controller[_0x7997('0x11')]);router['post']('/',auth[_0x7997('0x10')](),controller['create']);router[_0x7997('0x12')]('/:id',auth[_0x7997('0x10')](),controller[_0x7997('0x13')]);router[_0x7997('0x14')](_0x7997('0xf'),auth[_0x7997('0x10')](),controller[_0x7997('0x15')]);module[_0x7997('0x16')]=router; \ No newline at end of file +var _0x6219=['../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','describe','create','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x5f3575,_0x443623){var _0x45730f=function(_0x5d66ec){while(--_0x5d66ec){_0x5f3575['push'](_0x5f3575['shift']());}};_0x45730f(++_0x443623);}(_0x6219,0xb7));var _0x9621=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0x6219[_0x120123];return _0x3bec4c;};'use strict';var multer=require(_0x9621('0x0'));var util=require(_0x9621('0x1'));var path=require(_0x9621('0x2'));var timeout=require(_0x9621('0x3'));var express=require(_0x9621('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9621('0x5'));var interaction=require(_0x9621('0x6'));var config=require(_0x9621('0x7'));var controller=require(_0x9621('0x8'));router[_0x9621('0x9')]('/',auth[_0x9621('0xa')](),controller[_0x9621('0xb')]);router[_0x9621('0x9')](_0x9621('0xc'),auth['isAuthenticated'](),controller[_0x9621('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x9621('0xe')]);router['put'](_0x9621('0xf'),auth[_0x9621('0xa')](),controller[_0x9621('0x10')]);router[_0x9621('0x11')]('/:id',auth[_0x9621('0xa')](),controller['destroy']);module[_0x9621('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index d85bc37..dcd2bd2 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 _0xf700=['sequelize','moment','exports','blind','attended','STRING'];(function(_0x47c342,_0x2dfa4b){var _0x33fe42=function(_0x4643b8){while(--_0x4643b8){_0x47c342['push'](_0x47c342['shift']());}};_0x33fe42(++_0x2dfa4b);}(_0xf700,0x90));var _0x0f70=function(_0x162a65,_0x2ca206){_0x162a65=_0x162a65-0x0;var _0x67d27a=_0xf700[_0x162a65];return _0x67d27a;};'use strict';var Sequelize=require(_0x0f70('0x0'));var moment=require(_0x0f70('0x1'));module[_0x0f70('0x2')]={'type':{'type':Sequelize['ENUM'](_0x0f70('0x3'),_0x0f70('0x4'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x0f70('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x0f70('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x0f70('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x0f70('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x0f70('0x5')]},'transferercontext':{'type':Sequelize[_0x0f70('0x5')]},'transfererexten':{'type':Sequelize[_0x0f70('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x0f70('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x0f70('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x0f70('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x0f70('0x5')]},'transfereeexten':{'type':Sequelize[_0x0f70('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x0f70('0x5')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize[_0x0f70('0x5')]},'extension':{'type':Sequelize[_0x0f70('0x5')]}}; \ No newline at end of file +var _0x481f=['sequelize','moment','exports','blind','attended','STRING','ENUM','Yes'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x481f,0x1a0));var _0xf481=function(_0x204720,_0x5da77a){_0x204720=_0x204720-0x0;var _0x4bd59d=_0x481f[_0x204720];return _0x4bd59d;};'use strict';var Sequelize=require(_0xf481('0x0'));var moment=require(_0xf481('0x1'));module[_0xf481('0x2')]={'type':{'type':Sequelize['ENUM'](_0xf481('0x3'),_0xf481('0x4'))},'result':{'type':Sequelize[_0xf481('0x5')]},'transfererchannel':{'type':Sequelize[_0xf481('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xf481('0x5')]},'transferercalleridname':{'type':Sequelize[_0xf481('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xf481('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xf481('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xf481('0x5')]},'transferercontext':{'type':Sequelize[_0xf481('0x5')]},'transfererexten':{'type':Sequelize[_0xf481('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xf481('0x5')]},'transfereechannel':{'type':Sequelize[_0xf481('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xf481('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xf481('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xf481('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xf481('0x5')]},'transfereecontext':{'type':Sequelize[_0xf481('0x5')]},'transfereeexten':{'type':Sequelize[_0xf481('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xf481('0x5')]},'isexternal':{'type':Sequelize[_0xf481('0x6')](_0xf481('0x7'),'No')},'context':{'type':Sequelize[_0xf481('0x5')]},'extension':{'type':Sequelize[_0xf481('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index ba1d52b..44e09f6 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 _0x0f65=['ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','hasOwnProperty','sort','filters','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','VoiceTransferReport','find','catch','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x5e26b1,_0x1de91e){var _0x5e151e=function(_0x33df8c){while(--_0x33df8c){_0x5e26b1['push'](_0x5e26b1['shift']());}};_0x5e151e(++_0x1de91e);}(_0x0f65,0x15c));var _0x50f6=function(_0x1aad88,_0x551794){_0x1aad88=_0x1aad88-0x0;var _0x1bbfe9=_0x0f65[_0x1aad88];return _0x1bbfe9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x50f6('0x0'));var jsonpatch=require(_0x50f6('0x1'));var rp=require(_0x50f6('0x2'));var moment=require('moment');var BPromise=require(_0x50f6('0x3'));var Mustache=require(_0x50f6('0x4'));var util=require(_0x50f6('0x5'));var path=require(_0x50f6('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x50f6('0x7'));var fs=require('fs');var fs_extra=require(_0x50f6('0x8'));var _=require(_0x50f6('0x9'));var squel=require(_0x50f6('0xa'));var crypto=require(_0x50f6('0xb'));var jsforce=require(_0x50f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x50f6('0xd'));var Redis=require(_0x50f6('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x50f6('0xf'));var as=require(_0x50f6('0x10'));var hardwareService=require(_0x50f6('0x11'));var logger=require(_0x50f6('0x12'))(_0x50f6('0x13'));var utils=require(_0x50f6('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x50f6('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29118e,_0x5f3611){_0x5f3611=_0x5f3611||0xcc;return function(_0x29ba24){if(_0x29ba24){return _0x29118e['sendStatus'](_0x5f3611);}return _0x29118e['status'](_0x5f3611)[_0x50f6('0x16')]();};}function respondWithResult(_0x3855b8,_0x295dc3){_0x295dc3=_0x295dc3||0xc8;return function(_0x20da84){if(_0x20da84){return _0x3855b8[_0x50f6('0x17')](_0x295dc3)[_0x50f6('0x18')](_0x20da84);}};}function respondWithFilteredResult(_0x4d018a,_0x1ed915){return function(_0x43750c){if(_0x43750c){var _0x5da3ca=typeof _0x1ed915[_0x50f6('0x19')]===_0x50f6('0x1a')&&typeof _0x1ed915[_0x50f6('0x1b')]===_0x50f6('0x1a');var _0x2dd9ce=_0x43750c['count'];var _0x340da2=_0x5da3ca?0x0:_0x1ed915['offset'];var _0x3df0bf=_0x5da3ca?_0x43750c[_0x50f6('0x1c')]:_0x1ed915[_0x50f6('0x19')]+_0x1ed915[_0x50f6('0x1b')];var _0x468540;if(_0x3df0bf>=_0x2dd9ce){_0x3df0bf=_0x2dd9ce;_0x468540=0xc8;}else{_0x468540=0xce;}_0x4d018a['status'](_0x468540);return _0x4d018a[_0x50f6('0x1d')]('Content-Range',_0x340da2+'-'+_0x3df0bf+'/'+_0x2dd9ce)[_0x50f6('0x18')](_0x43750c);}return null;};}function patchUpdates(_0x21c88b){return function(_0x260603){try{jsonpatch[_0x50f6('0x1e')](_0x260603,_0x21c88b,!![]);}catch(_0x818863){return BPromise[_0x50f6('0x1f')](_0x818863);}return _0x260603[_0x50f6('0x20')]();};}function saveUpdates(_0x2253c3,_0xd435f0){return function(_0x3f6838){if(_0x3f6838){return _0x3f6838[_0x50f6('0x21')](_0x2253c3)[_0x50f6('0x22')](function(_0x3affac){return _0x3affac;});}return null;};}function removeEntity(_0x303b45,_0x5a75bf){return function(_0xbfaaf2){if(_0xbfaaf2){return _0xbfaaf2[_0x50f6('0x23')]()['then'](function(){_0x303b45[_0x50f6('0x17')](0xcc)[_0x50f6('0x16')]();});}};}function handleEntityNotFound(_0x202120,_0x3c9558){return function(_0x47c4b8){if(!_0x47c4b8){_0x202120[_0x50f6('0x24')](0x194);}return _0x47c4b8;};}function handleError(_0x4b1922,_0x2f8336){_0x2f8336=_0x2f8336||0x1f4;return function(_0x47e2df){logger['error'](_0x47e2df['stack']);if(_0x47e2df[_0x50f6('0x25')]){delete _0x47e2df[_0x50f6('0x25')];}_0x4b1922[_0x50f6('0x17')](_0x2f8336)[_0x50f6('0x26')](_0x47e2df);};}exports[_0x50f6('0x27')]=function(_0x42b008,_0x229568){var _0x3ff693={},_0x2ba600={},_0x5862ed={'count':0x0,'rows':[]};var _0x473c72=_['map'](db['VoiceTransferReport'][_0x50f6('0x28')],function(_0x417ea1){return{'name':_0x417ea1[_0x50f6('0x29')],'type':_0x417ea1[_0x50f6('0x2a')][_0x50f6('0x2b')]};});_0x2ba600['model']=_[_0x50f6('0x2c')](_0x473c72,_0x50f6('0x25'));_0x2ba600[_0x50f6('0x2d')]=_[_0x50f6('0x2e')](_0x42b008[_0x50f6('0x2d')]);_0x2ba600['filters']=_[_0x50f6('0x2f')](_0x2ba600[_0x50f6('0x30')],_0x2ba600[_0x50f6('0x2d')]);_0x3ff693[_0x50f6('0x31')]=_[_0x50f6('0x2f')](_0x2ba600[_0x50f6('0x30')],qs['fields'](_0x42b008['query'][_0x50f6('0x32')]));_0x3ff693[_0x50f6('0x31')]=_0x3ff693[_0x50f6('0x31')]['length']?_0x3ff693['attributes']:_0x2ba600[_0x50f6('0x30')];if(!_0x42b008[_0x50f6('0x2d')][_0x50f6('0x33')]('nolimit')){_0x3ff693[_0x50f6('0x1b')]=qs[_0x50f6('0x1b')](_0x42b008['query']['limit']);_0x3ff693['offset']=qs[_0x50f6('0x19')](_0x42b008[_0x50f6('0x2d')][_0x50f6('0x19')]);}_0x3ff693['order']=qs[_0x50f6('0x34')](_0x42b008['query'][_0x50f6('0x34')]);_0x3ff693['where']=qs[_0x50f6('0x35')](_[_0x50f6('0x36')](_0x42b008['query'],_0x2ba600[_0x50f6('0x35')]),_0x473c72);if(_0x42b008[_0x50f6('0x2d')][_0x50f6('0x37')]){_0x3ff693[_0x50f6('0x38')]=_[_0x50f6('0x39')](_0x3ff693['where'],{'$or':_[_0x50f6('0x2c')](_0x473c72,function(_0x47d502){if(_0x47d502['type']!==_0x50f6('0x3a')){var _0x367079={};_0x367079[_0x47d502[_0x50f6('0x25')]]={'$like':'%'+_0x42b008[_0x50f6('0x2d')][_0x50f6('0x37')]+'%'};return _0x367079;}})});}_0x3ff693=_['merge']({},_0x3ff693,_0x42b008[_0x50f6('0x3b')]);var _0x3c91bb={'where':_0x3ff693['where']};return db['VoiceTransferReport'][_0x50f6('0x1c')](_0x3c91bb)[_0x50f6('0x22')](function(_0x1acaee){_0x5862ed['count']=_0x1acaee;if(_0x42b008[_0x50f6('0x2d')]['includeAll']){_0x3ff693[_0x50f6('0x3c')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x50f6('0x3d')](_0x3ff693);})[_0x50f6('0x22')](function(_0x44b9b2){_0x5862ed[_0x50f6('0x3e')]=_0x44b9b2;return _0x5862ed;})[_0x50f6('0x22')](respondWithFilteredResult(_0x229568,_0x3ff693))['catch'](handleError(_0x229568,null));};exports[_0x50f6('0x3f')]=function(_0x43de15,_0x209598){var _0x968c11={'raw':!![],'where':{'id':_0x43de15[_0x50f6('0x40')]['id']}},_0x34b718={};_0x34b718[_0x50f6('0x30')]=_[_0x50f6('0x2e')](db[_0x50f6('0x41')][_0x50f6('0x28')]);_0x34b718['query']=_[_0x50f6('0x2e')](_0x43de15[_0x50f6('0x2d')]);_0x34b718[_0x50f6('0x35')]=_['intersection'](_0x34b718[_0x50f6('0x30')],_0x34b718[_0x50f6('0x2d')]);_0x968c11[_0x50f6('0x31')]=_[_0x50f6('0x2f')](_0x34b718[_0x50f6('0x30')],qs[_0x50f6('0x32')](_0x43de15[_0x50f6('0x2d')]['fields']));_0x968c11[_0x50f6('0x31')]=_0x968c11[_0x50f6('0x31')]['length']?_0x968c11[_0x50f6('0x31')]:_0x34b718['model'];if(_0x43de15['query']['includeAll']){_0x968c11[_0x50f6('0x3c')]=[{'all':!![]}];}_0x968c11=_[_0x50f6('0x39')]({},_0x968c11,_0x43de15[_0x50f6('0x3b')]);return db[_0x50f6('0x41')][_0x50f6('0x42')](_0x968c11)[_0x50f6('0x22')](handleEntityNotFound(_0x209598,null))[_0x50f6('0x22')](respondWithResult(_0x209598,null))[_0x50f6('0x43')](handleError(_0x209598,null));};exports[_0x50f6('0x44')]=function(_0x1a17b7,_0x319d3c){return db[_0x50f6('0x41')][_0x50f6('0x44')](_0x1a17b7[_0x50f6('0x45')],{})[_0x50f6('0x22')](respondWithResult(_0x319d3c,0xc9))[_0x50f6('0x43')](handleError(_0x319d3c,null));};exports[_0x50f6('0x21')]=function(_0xeac8ca,_0xa1f7fa){if(_0xeac8ca[_0x50f6('0x45')]['id']){delete _0xeac8ca[_0x50f6('0x45')]['id'];}return db['VoiceTransferReport'][_0x50f6('0x42')]({'where':{'id':_0xeac8ca[_0x50f6('0x40')]['id']}})[_0x50f6('0x22')](handleEntityNotFound(_0xa1f7fa,null))['then'](saveUpdates(_0xeac8ca['body'],null))['then'](respondWithResult(_0xa1f7fa,null))[_0x50f6('0x43')](handleError(_0xa1f7fa,null));};exports[_0x50f6('0x23')]=function(_0x5539a5,_0x209e23){return db[_0x50f6('0x41')][_0x50f6('0x42')]({'where':{'id':_0x5539a5[_0x50f6('0x40')]['id']}})[_0x50f6('0x22')](handleEntityNotFound(_0x209e23,null))[_0x50f6('0x22')](removeEntity(_0x209e23,null))[_0x50f6('0x43')](handleError(_0x209e23,null));};exports[_0x50f6('0x46')]=function(_0x2df3a7,_0x2c121d){return db[_0x50f6('0x41')][_0x50f6('0x46')]()[_0x50f6('0x22')](respondWithResult(_0x2c121d,null))[_0x50f6('0x43')](handleError(_0x2c121d,null));}; \ No newline at end of file +var _0x4b59=['filters','pick','filter','merge','VIRTUAL','options','VoiceTransferReport','then','includeAll','include','findAll','rows','catch','show','length','create','body','find','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','hasOwnProperty','order','sort','where'];(function(_0x5af59e,_0x3771c1){var _0x4240df=function(_0x2267fd){while(--_0x2267fd){_0x5af59e['push'](_0x5af59e['shift']());}};_0x4240df(++_0x3771c1);}(_0x4b59,0x160));var _0x94b5=function(_0x5465e6,_0x2a8809){_0x5465e6=_0x5465e6-0x0;var _0x10044e=_0x4b59[_0x5465e6];return _0x10044e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94b5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x94b5('0x1'));var rp=require(_0x94b5('0x2'));var moment=require(_0x94b5('0x3'));var BPromise=require(_0x94b5('0x4'));var Mustache=require(_0x94b5('0x5'));var util=require(_0x94b5('0x6'));var path=require(_0x94b5('0x7'));var sox=require(_0x94b5('0x8'));var csv=require('to-csv');var ejs=require(_0x94b5('0x9'));var fs=require('fs');var fs_extra=require(_0x94b5('0xa'));var _=require(_0x94b5('0xb'));var squel=require(_0x94b5('0xc'));var crypto=require(_0x94b5('0xd'));var jsforce=require(_0x94b5('0xe'));var deskjs=require(_0x94b5('0xf'));var toCsv=require(_0x94b5('0x10'));var querystring=require(_0x94b5('0x11'));var Papa=require(_0x94b5('0x12'));var Redis=require('ioredis');var authService=require(_0x94b5('0x13'));var qs=require(_0x94b5('0x14'));var as=require(_0x94b5('0x15'));var hardwareService=require(_0x94b5('0x16'));var logger=require(_0x94b5('0x17'))('api');var utils=require(_0x94b5('0x18'));var config=require(_0x94b5('0x19'));var licenseUtil=require(_0x94b5('0x1a'));var db=require(_0x94b5('0x1b'))['db'];function respondWithStatusCode(_0x27e4f8,_0x430fd4){_0x430fd4=_0x430fd4||0xcc;return function(_0x30f464){if(_0x30f464){return _0x27e4f8['sendStatus'](_0x430fd4);}return _0x27e4f8[_0x94b5('0x1c')](_0x430fd4)[_0x94b5('0x1d')]();};}function respondWithResult(_0x78ac8a,_0x16000b){_0x16000b=_0x16000b||0xc8;return function(_0xc9b39f){if(_0xc9b39f){return _0x78ac8a[_0x94b5('0x1c')](_0x16000b)[_0x94b5('0x1e')](_0xc9b39f);}};}function respondWithFilteredResult(_0x7849f7,_0x275f13){return function(_0x2b36f5){if(_0x2b36f5){var _0x173bc4=typeof _0x275f13[_0x94b5('0x1f')]===_0x94b5('0x20')&&typeof _0x275f13['limit']===_0x94b5('0x20');var _0x1403a6=_0x2b36f5[_0x94b5('0x21')];var _0x1716ac=_0x173bc4?0x0:_0x275f13['offset'];var _0x397580=_0x173bc4?_0x2b36f5[_0x94b5('0x21')]:_0x275f13[_0x94b5('0x1f')]+_0x275f13[_0x94b5('0x22')];var _0x599c1b;if(_0x397580>=_0x1403a6){_0x397580=_0x1403a6;_0x599c1b=0xc8;}else{_0x599c1b=0xce;}_0x7849f7['status'](_0x599c1b);return _0x7849f7[_0x94b5('0x23')](_0x94b5('0x24'),_0x1716ac+'-'+_0x397580+'/'+_0x1403a6)[_0x94b5('0x1e')](_0x2b36f5);}return null;};}function patchUpdates(_0x580206){return function(_0x2b52d8){try{jsonpatch[_0x94b5('0x25')](_0x2b52d8,_0x580206,!![]);}catch(_0x27e4a0){return BPromise[_0x94b5('0x26')](_0x27e4a0);}return _0x2b52d8[_0x94b5('0x27')]();};}function saveUpdates(_0x141a4b,_0x1eb8ab){return function(_0x2a80e6){if(_0x2a80e6){return _0x2a80e6[_0x94b5('0x28')](_0x141a4b)['then'](function(_0xe341e4){return _0xe341e4;});}return null;};}function removeEntity(_0x3e5660,_0x2ca4a3){return function(_0x37406a){if(_0x37406a){return _0x37406a[_0x94b5('0x29')]()['then'](function(){_0x3e5660['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xdd0768,_0x4a4fda){return function(_0x437bc2){if(!_0x437bc2){_0xdd0768[_0x94b5('0x2a')](0x194);}return _0x437bc2;};}function handleError(_0x39e0be,_0x34cb9d){_0x34cb9d=_0x34cb9d||0x1f4;return function(_0x3645f1){logger[_0x94b5('0x2b')](_0x3645f1[_0x94b5('0x2c')]);if(_0x3645f1[_0x94b5('0x2d')]){delete _0x3645f1[_0x94b5('0x2d')];}_0x39e0be[_0x94b5('0x1c')](_0x34cb9d)[_0x94b5('0x2e')](_0x3645f1);};}exports[_0x94b5('0x2f')]=function(_0x1fe5ee,_0x238138){var _0x2bf755={},_0x4c425b={},_0x5668e1={'count':0x0,'rows':[]};var _0x1209ad=_['map'](db['VoiceTransferReport'][_0x94b5('0x30')],function(_0x198d32){return{'name':_0x198d32[_0x94b5('0x31')],'type':_0x198d32[_0x94b5('0x32')][_0x94b5('0x33')]};});_0x4c425b['model']=_[_0x94b5('0x34')](_0x1209ad,_0x94b5('0x2d'));_0x4c425b[_0x94b5('0x35')]=_[_0x94b5('0x36')](_0x1fe5ee[_0x94b5('0x35')]);_0x4c425b['filters']=_[_0x94b5('0x37')](_0x4c425b[_0x94b5('0x38')],_0x4c425b['query']);_0x2bf755['attributes']=_['intersection'](_0x4c425b['model'],qs['fields'](_0x1fe5ee[_0x94b5('0x35')][_0x94b5('0x39')]));_0x2bf755[_0x94b5('0x3a')]=_0x2bf755['attributes']['length']?_0x2bf755['attributes']:_0x4c425b[_0x94b5('0x38')];if(!_0x1fe5ee[_0x94b5('0x35')][_0x94b5('0x3b')]('nolimit')){_0x2bf755[_0x94b5('0x22')]=qs['limit'](_0x1fe5ee[_0x94b5('0x35')][_0x94b5('0x22')]);_0x2bf755[_0x94b5('0x1f')]=qs['offset'](_0x1fe5ee[_0x94b5('0x35')]['offset']);}_0x2bf755[_0x94b5('0x3c')]=qs[_0x94b5('0x3d')](_0x1fe5ee[_0x94b5('0x35')][_0x94b5('0x3d')]);_0x2bf755[_0x94b5('0x3e')]=qs[_0x94b5('0x3f')](_[_0x94b5('0x40')](_0x1fe5ee[_0x94b5('0x35')],_0x4c425b[_0x94b5('0x3f')]),_0x1209ad);if(_0x1fe5ee[_0x94b5('0x35')][_0x94b5('0x41')]){_0x2bf755['where']=_[_0x94b5('0x42')](_0x2bf755[_0x94b5('0x3e')],{'$or':_['map'](_0x1209ad,function(_0x5d4879){if(_0x5d4879['type']!==_0x94b5('0x43')){var _0x3b4247={};_0x3b4247[_0x5d4879[_0x94b5('0x2d')]]={'$like':'%'+_0x1fe5ee[_0x94b5('0x35')][_0x94b5('0x41')]+'%'};return _0x3b4247;}})});}_0x2bf755=_[_0x94b5('0x42')]({},_0x2bf755,_0x1fe5ee[_0x94b5('0x44')]);var _0x2e6353={'where':_0x2bf755[_0x94b5('0x3e')]};return db[_0x94b5('0x45')][_0x94b5('0x21')](_0x2e6353)[_0x94b5('0x46')](function(_0x2f37b7){_0x5668e1[_0x94b5('0x21')]=_0x2f37b7;if(_0x1fe5ee[_0x94b5('0x35')][_0x94b5('0x47')]){_0x2bf755[_0x94b5('0x48')]=[{'all':!![]}];}return db[_0x94b5('0x45')][_0x94b5('0x49')](_0x2bf755);})[_0x94b5('0x46')](function(_0x2ba3e1){_0x5668e1[_0x94b5('0x4a')]=_0x2ba3e1;return _0x5668e1;})[_0x94b5('0x46')](respondWithFilteredResult(_0x238138,_0x2bf755))[_0x94b5('0x4b')](handleError(_0x238138,null));};exports[_0x94b5('0x4c')]=function(_0x573a99,_0x2c38a7){var _0x2d7b66={'raw':!![],'where':{'id':_0x573a99['params']['id']}},_0x1e0e7c={};_0x1e0e7c[_0x94b5('0x38')]=_['keys'](db[_0x94b5('0x45')][_0x94b5('0x30')]);_0x1e0e7c[_0x94b5('0x35')]=_[_0x94b5('0x36')](_0x573a99['query']);_0x1e0e7c[_0x94b5('0x3f')]=_[_0x94b5('0x37')](_0x1e0e7c[_0x94b5('0x38')],_0x1e0e7c[_0x94b5('0x35')]);_0x2d7b66[_0x94b5('0x3a')]=_[_0x94b5('0x37')](_0x1e0e7c[_0x94b5('0x38')],qs['fields'](_0x573a99['query'][_0x94b5('0x39')]));_0x2d7b66[_0x94b5('0x3a')]=_0x2d7b66['attributes'][_0x94b5('0x4d')]?_0x2d7b66[_0x94b5('0x3a')]:_0x1e0e7c[_0x94b5('0x38')];if(_0x573a99[_0x94b5('0x35')][_0x94b5('0x47')]){_0x2d7b66[_0x94b5('0x48')]=[{'all':!![]}];}_0x2d7b66=_[_0x94b5('0x42')]({},_0x2d7b66,_0x573a99[_0x94b5('0x44')]);return db[_0x94b5('0x45')]['find'](_0x2d7b66)[_0x94b5('0x46')](handleEntityNotFound(_0x2c38a7,null))['then'](respondWithResult(_0x2c38a7,null))[_0x94b5('0x4b')](handleError(_0x2c38a7,null));};exports[_0x94b5('0x4e')]=function(_0x118778,_0x492764){return db['VoiceTransferReport'][_0x94b5('0x4e')](_0x118778[_0x94b5('0x4f')],{})['then'](respondWithResult(_0x492764,0xc9))[_0x94b5('0x4b')](handleError(_0x492764,null));};exports[_0x94b5('0x28')]=function(_0x29bd4a,_0x379c48){if(_0x29bd4a[_0x94b5('0x4f')]['id']){delete _0x29bd4a['body']['id'];}return db['VoiceTransferReport'][_0x94b5('0x50')]({'where':{'id':_0x29bd4a[_0x94b5('0x51')]['id']}})[_0x94b5('0x46')](handleEntityNotFound(_0x379c48,null))['then'](saveUpdates(_0x29bd4a['body'],null))['then'](respondWithResult(_0x379c48,null))['catch'](handleError(_0x379c48,null));};exports['destroy']=function(_0x29d35a,_0x412a38){return db[_0x94b5('0x45')][_0x94b5('0x50')]({'where':{'id':_0x29d35a['params']['id']}})[_0x94b5('0x46')](handleEntityNotFound(_0x412a38,null))[_0x94b5('0x46')](removeEntity(_0x412a38,null))['catch'](handleError(_0x412a38,null));};exports[_0x94b5('0x52')]=function(_0xc7116b,_0x77a1b2){return db[_0x94b5('0x45')][_0x94b5('0x52')]()['then'](respondWithResult(_0x77a1b2,null))['catch'](handleError(_0x77a1b2,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index a876907..1838dfd 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 _0xaf66=['VoiceTransferReport','report_call_transfer','util','../../config/logger','api','path','rimraf','./voiceTransferReport.attributes','exports','define'];(function(_0x163c01,_0x1187f4){var _0x4da329=function(_0x2b5881){while(--_0x2b5881){_0x163c01['push'](_0x163c01['shift']());}};_0x4da329(++_0x1187f4);}(_0xaf66,0xf2));var _0x6af6=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0xaf66[_0x4cfc1d];return _0x1c01a0;};'use strict';var _=require('lodash');var util=require(_0x6af6('0x0'));var logger=require(_0x6af6('0x1'))(_0x6af6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6af6('0x3'));var rimraf=require(_0x6af6('0x4'));var config=require('../../config/environment');var attributes=require(_0x6af6('0x5'));module[_0x6af6('0x6')]=function(_0x2fc6a9,_0xfd02ef){return _0x2fc6a9[_0x6af6('0x7')](_0x6af6('0x8'),attributes,{'tableName':_0x6af6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e0c=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x2e0c,0x14f));var _0xc2e0=function(_0x18aadc,_0x3029bc){_0x18aadc=_0x18aadc-0x0;var _0x51ed4c=_0x2e0c[_0x18aadc];return _0x51ed4c;};'use strict';var _=require(_0xc2e0('0x0'));var util=require(_0xc2e0('0x1'));var logger=require(_0xc2e0('0x2'))(_0xc2e0('0x3'));var moment=require(_0xc2e0('0x4'));var BPromise=require(_0xc2e0('0x5'));var rp=require(_0xc2e0('0x6'));var fs=require('fs');var path=require(_0xc2e0('0x7'));var rimraf=require(_0xc2e0('0x8'));var config=require(_0xc2e0('0x9'));var attributes=require(_0xc2e0('0xa'));module[_0xc2e0('0xb')]=function(_0x2d6741,_0x2a3086){return _0x2d6741[_0xc2e0('0xc')](_0xc2e0('0xd'),attributes,{'tableName':_0xc2e0('0xe'),'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 de08dc0..b3c7312 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 _0x6891=['rpc','../../config/environment','client','http','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','create','body','options','then','CreateVoiceTransferReport','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x17de3a,_0x160af1){var _0x24198f=function(_0x33068f){while(--_0x33068f){_0x17de3a['push'](_0x17de3a['shift']());}};_0x24198f(++_0x160af1);}(_0x6891,0x1c7));var _0x1689=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x6891[_0x1e3671];return _0x48d5f5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1689('0x0'));var BPromise=require(_0x1689('0x1'));var rs=require(_0x1689('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1689('0x3'))['db'];var utils=require(_0x1689('0x4'));var logger=require('../../config/logger')(_0x1689('0x5'));var config=require(_0x1689('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1689('0x7')][_0x1689('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36b850,_0x19b7b1,_0x2d5ac0){return new BPromise(function(_0x529e4e,_0x45f390){return client['request'](_0x36b850,_0x2d5ac0)['then'](function(_0x58fa8e){logger['info'](_0x1689('0x9'),_0x19b7b1,_0x1689('0xa'));logger['debug'](_0x1689('0xb'),_0x19b7b1,_0x1689('0xa'),JSON[_0x1689('0xc')](_0x58fa8e));if(_0x58fa8e[_0x1689('0xd')]){if(_0x58fa8e[_0x1689('0xd')]['code']===0x1f4){logger[_0x1689('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x19b7b1,_0x58fa8e[_0x1689('0xd')][_0x1689('0xe')]);return _0x45f390(_0x58fa8e[_0x1689('0xd')][_0x1689('0xe')]);}logger[_0x1689('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x19b7b1,_0x58fa8e[_0x1689('0xd')][_0x1689('0xe')]);return _0x529e4e(_0x58fa8e[_0x1689('0xd')]['message']);}else{logger[_0x1689('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x19b7b1,'request\x20sent');_0x529e4e(_0x58fa8e[_0x1689('0x10')][_0x1689('0xe')]);}})[_0x1689('0x11')](function(_0x2c3b5e){logger[_0x1689('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x19b7b1,_0x2c3b5e);_0x45f390(_0x2c3b5e);});});}exports['CreateVoiceTransferReport']=function(_0x2dc3f4){var _0x41109a=this;return new Promise(function(_0x137fd4,_0x4311b2){return db['VoiceTransferReport'][_0x1689('0x12')](_0x2dc3f4[_0x1689('0x13')],{'raw':_0x2dc3f4[_0x1689('0x14')]?_0x2dc3f4[_0x1689('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x1689('0x15')](function(_0x205e8c){logger[_0x1689('0xf')](_0x1689('0x16'),_0x2dc3f4);logger['debug'](_0x1689('0x16'),_0x2dc3f4,JSON[_0x1689('0xc')](_0x205e8c));_0x137fd4(_0x205e8c);})[_0x1689('0x11')](function(_0x2e8e6e){logger[_0x1689('0xd')](_0x1689('0x16'),_0x2e8e6e[_0x1689('0xe')],_0x2dc3f4);_0x4311b2(_0x41109a[_0x1689('0xd')](0x1f4,_0x2e8e6e[_0x1689('0xe')]));});});}; \ No newline at end of file +var _0x9270=['jayson/promise','client','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','options','raw','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x2ab3d9,_0x50e716){var _0x210a54=function(_0x24c479){while(--_0x24c479){_0x2ab3d9['push'](_0x2ab3d9['shift']());}};_0x210a54(++_0x50e716);}(_0x9270,0xc8));var _0x0927=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0x9270[_0x264545];return _0x114d10;};'use strict';var _=require(_0x0927('0x0'));var util=require(_0x0927('0x1'));var moment=require(_0x0927('0x2'));var BPromise=require(_0x0927('0x3'));var rs=require(_0x0927('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0927('0x5'));var logger=require(_0x0927('0x6'))(_0x0927('0x7'));var config=require('../../config/environment');var jayson=require(_0x0927('0x8'));var client=jayson[_0x0927('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f2d2e,_0x3f9ccb,_0x4c4ca8){return new BPromise(function(_0x2e8fdf,_0x2fe4bc){return client['request'](_0x3f2d2e,_0x4c4ca8)[_0x0927('0xa')](function(_0x24b7a1){logger[_0x0927('0xb')](_0x0927('0xc'),_0x3f9ccb,_0x0927('0xd'));logger[_0x0927('0xe')](_0x0927('0xf'),_0x3f9ccb,_0x0927('0xd'),JSON[_0x0927('0x10')](_0x24b7a1));if(_0x24b7a1['error']){if(_0x24b7a1[_0x0927('0x11')][_0x0927('0x12')]===0x1f4){logger[_0x0927('0x11')](_0x0927('0xc'),_0x3f9ccb,_0x24b7a1[_0x0927('0x11')][_0x0927('0x13')]);return _0x2fe4bc(_0x24b7a1['error']['message']);}logger['error'](_0x0927('0xc'),_0x3f9ccb,_0x24b7a1[_0x0927('0x11')][_0x0927('0x13')]);return _0x2e8fdf(_0x24b7a1['error']['message']);}else{logger[_0x0927('0xb')](_0x0927('0xc'),_0x3f9ccb,_0x0927('0xd'));_0x2e8fdf(_0x24b7a1[_0x0927('0x14')][_0x0927('0x13')]);}})['catch'](function(_0x15adb8){logger['error'](_0x0927('0xc'),_0x3f9ccb,_0x15adb8);_0x2fe4bc(_0x15adb8);});});}exports[_0x0927('0x15')]=function(_0x519532){var _0x155ca0=this;return new Promise(function(_0x23a4bf,_0x352665){return db[_0x0927('0x16')]['create'](_0x519532['body'],{'raw':_0x519532[_0x0927('0x17')]?_0x519532[_0x0927('0x17')][_0x0927('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5f15f7){logger[_0x0927('0xb')](_0x0927('0x15'),_0x519532);logger[_0x0927('0xe')](_0x0927('0x15'),_0x519532,JSON[_0x0927('0x10')](_0x5f15f7));_0x23a4bf(_0x5f15f7);})[_0x0927('0x19')](function(_0x4b617a){logger[_0x0927('0x11')](_0x0927('0x15'),_0x4b617a[_0x0927('0x13')],_0x519532);_0x352665(_0x155ca0[_0x0927('0x11')](0x1f4,_0x4b617a[_0x0927('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 83f4652..951592e 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 _0x6839=['isAuthenticated','canUpdate','post','/hangup','hangup','answer','/hold','/unhold','/calls','calls','/transfer','transfer','Router','../../components/auth/service','./webbar.controller','/originate'];(function(_0x4593ef,_0x5b9ab7){var _0x1c88a4=function(_0x36b3f8){while(--_0x36b3f8){_0x4593ef['push'](_0x4593ef['shift']());}};_0x1c88a4(++_0x5b9ab7);}(_0x6839,0xcc));var _0x9683=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x6839[_0x355ce8];return _0x1db8b8;};'use strict';var express=require('express');var router=express[_0x9683('0x0')]();var auth=require(_0x9683('0x1'));var controller=require(_0x9683('0x2'));router['post'](_0x9683('0x3'),auth[_0x9683('0x4')](),auth[_0x9683('0x5')](),controller['originate']);router[_0x9683('0x6')](_0x9683('0x7'),auth[_0x9683('0x4')](),auth[_0x9683('0x5')](),controller[_0x9683('0x8')]);router[_0x9683('0x6')]('/answer',auth[_0x9683('0x4')](),auth['canUpdate'](),controller[_0x9683('0x9')]);router[_0x9683('0x6')](_0x9683('0xa'),auth[_0x9683('0x4')](),auth['canUpdate'](),controller['hold']);router[_0x9683('0x6')](_0x9683('0xb'),auth['isAuthenticated'](),auth[_0x9683('0x5')](),controller['unhold']);router['post'](_0x9683('0xc'),auth[_0x9683('0x4')](),auth['canUpdate'](),controller[_0x9683('0xd')]);router['post'](_0x9683('0xe'),auth[_0x9683('0x4')](),auth[_0x9683('0x5')](),controller[_0x9683('0xf')]);module['exports']=router; \ No newline at end of file +var _0x7002=['/hangup','canUpdate','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','originate'];(function(_0x6fd744,_0x2e98ba){var _0x38eeda=function(_0x372864){while(--_0x372864){_0x6fd744['push'](_0x6fd744['shift']());}};_0x38eeda(++_0x2e98ba);}(_0x7002,0x1c6));var _0x2700=function(_0x5eef05,_0x1be989){_0x5eef05=_0x5eef05-0x0;var _0x56d4b8=_0x7002[_0x5eef05];return _0x56d4b8;};'use strict';var express=require(_0x2700('0x0'));var router=express[_0x2700('0x1')]();var auth=require(_0x2700('0x2'));var controller=require(_0x2700('0x3'));router[_0x2700('0x4')](_0x2700('0x5'),auth[_0x2700('0x6')](),auth['canUpdate'](),controller[_0x2700('0x7')]);router[_0x2700('0x4')](_0x2700('0x8'),auth[_0x2700('0x6')](),auth[_0x2700('0x9')](),controller[_0x2700('0xa')]);router['post'](_0x2700('0xb'),auth[_0x2700('0x6')](),auth[_0x2700('0x9')](),controller[_0x2700('0xc')]);router[_0x2700('0x4')](_0x2700('0xd'),auth[_0x2700('0x6')](),auth[_0x2700('0x9')](),controller['hold']);router[_0x2700('0x4')](_0x2700('0xe'),auth[_0x2700('0x6')](),auth[_0x2700('0x9')](),controller[_0x2700('0xf')]);router['post'](_0x2700('0x10'),auth[_0x2700('0x6')](),auth['canUpdate'](),controller[_0x2700('0x11')]);router[_0x2700('0x4')](_0x2700('0x12'),auth[_0x2700('0x6')](),auth[_0x2700('0x9')](),controller[_0x2700('0x13')]);module[_0x2700('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 43e0fdf..d6cf92d 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 _0xa74f=['user:%s','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','calls','calls\x20fired:','VoiceChannels','filter','rows','conference\x20fired:','webbar:conference','transfer','transferNumber','transfer\x20executed!','../../mysqldb','bluebird','jayson/promise','client','http','webbarapi','defaults','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','emit','handleError:','error','stack','name','status','send','message','catch','User','agent','then','all','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callerId','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','entityFound:','format','webbar:hangup','hangup\x20executed!','answer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa74f,0x9a));var _0xfa74=function(_0x2fee96,_0x2f735d){_0x2fee96=_0x2fee96-0x0;var _0x2e6ad1=_0xa74f[_0x2fee96];return _0x2e6ad1;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0xfa74('0x0'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0xfa74('0x1'));var jayson=require(_0xfa74('0x2'));var amiClient=jayson[_0xfa74('0x3')][_0xfa74('0x4')]({'port':0x232a});var logger=require('../../config/logger')(_0xfa74('0x5'));var Redis=require('ioredis');config['redis']=_[_0xfa74('0x6')](config[_0xfa74('0x7')],{'host':_0xfa74('0x8'),'port':0x18eb});var io=require(_0xfa74('0x9'))(new Redis(config[_0xfa74('0x7')]));var Schema=require(_0xfa74('0xa'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfa74('0xb')]},'callNumber':{'type':_0xfa74('0xc'),'required':[!![],_0xfa74('0xd')]},'callerId':{'type':_0xfa74('0xc')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]},'sessionId':{'type':_0xfa74('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xfa74('0xc'),'required':[!![],_0xfa74('0xf')]},'transferNumber':{'type':_0xfa74('0xc'),'required':[!![],_0xfa74('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfa74('0xb')]},'sessionId':{'type':_0xfa74('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]},'sessionId':{'type':_0xfa74('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfa74('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0xfa74('0xe'),'required':[!![],_0xfa74('0xb')]}});function emit(_0x1f1de0,_0x3867f8,_0x40af70){logger[_0xfa74('0x11')](_0x1f1de0,_0x3867f8,JSON['stringify'](_0x40af70));io['to'](_0x1f1de0)[_0xfa74('0x12')](_0x3867f8,_0x40af70);}function handleError(_0xe0e33d){return function(_0x51dda1){console['log'](_0xfa74('0x13'),_0x51dda1,_0x51dda1 instanceof RangeError);logger[_0xfa74('0x14')](_0x51dda1[_0xfa74('0x15')]);if(_0x51dda1 instanceof RangeError){if(_0x51dda1['name']){delete _0x51dda1[_0xfa74('0x16')];}_0xe0e33d[_0xfa74('0x17')](0x194)[_0xfa74('0x18')](_0x51dda1);}else{if(_0x51dda1['name']){delete _0x51dda1[_0xfa74('0x16')];}_0xe0e33d[_0xfa74('0x17')](0x1f4)[_0xfa74('0x18')](_0x51dda1);}};}function checkError(){return function(_0x4a5ee4){if(!_0x4a5ee4){throw new RangeError('NotFound');}return _0x4a5ee4;};}function respondWithRpcPromise(_0x100851,_0x2257a0){return new BPromise(function(_0x9932db,_0xeaaa19){var _0x1a453d=amiClient;return _0x1a453d['request'](_0x100851,_0x2257a0)['then'](function(_0x3721bf){if(_0x3721bf['error']){if(_0x3721bf['error']['code']===0x1f4){return _0xeaaa19(_0x3721bf[_0xfa74('0x14')][_0xfa74('0x19')]);}return _0x9932db(_0x3721bf[_0xfa74('0x14')]['message']);}else{_0x9932db(_0x3721bf['result']);}})[_0xfa74('0x1a')](function(_0xeb6c11){_0xeaaa19(_0xeb6c11);});});}function getAgent(_0x5ed1c8){return db[_0xfa74('0x1b')]['findOne']({'where':{'id':_0x5ed1c8,'role':_0xfa74('0x1c')}})[_0xfa74('0x1d')](checkError());}function getAgentCheckSession(_0x55d8e4,_0x298388){return new BPromise(function(_0x1130de,_0x122415){var _0x218c86=respondWithRpcPromise('VoiceChannels');var _0xd9c55d=getAgent(_0x55d8e4);Promise[_0xfa74('0x1e')]([_0x218c86,_0xd9c55d])[_0xfa74('0x1d')](function(_0x57d90e){var _0x4d4bed=_0x57d90e[0x0];var _0x1322a4=_0x57d90e[0x1];var _0x8b706e=_['filter'](_0x4d4bed['rows'],function(_0x343466){return _0x343466['UserId']==_0x1322a4['id']&&_0x343466[_0xfa74('0x1f')]==_0x298388;});if(_0x8b706e['length']==0x1){_0x1130de(_0x1322a4);}else{_0x122415(new RangeError(_0xfa74('0x20')+_0x298388+_0xfa74('0x21')));}});});}exports[_0xfa74('0x22')]=function(_0xdd93e5,_0x4c506f){logger[_0xfa74('0x11')](_0xfa74('0x23'),_0xdd93e5[_0xfa74('0x24')]);var _0x16f9dc=originateValidation[_0xfa74('0xa')](_0xdd93e5[_0xfa74('0x24')]);if(_0x16f9dc[_0xfa74('0x25')]>0x0){return _0x4c506f['status'](0x190)[_0xfa74('0x26')](_0x16f9dc);}var _0x5a9f43=_0xdd93e5[_0xfa74('0x24')][_0xfa74('0x27')];var _0xcc5e32=_0xdd93e5[_0xfa74('0x24')]['callNumber'];var _0x5055d3=_0xdd93e5[_0xfa74('0x24')][_0xfa74('0x28')];var _0x44b725=_0xdd93e5[_0xfa74('0x24')]['callbackUrl'];return getAgent(_0x5a9f43)[_0xfa74('0x1d')](function(_0x231698){logger['info']('entityFound:',_0x231698['name']);emit(util['format']('user:%s',_0x231698[_0xfa74('0x16')]),_0xfa74('0x29'),{'callNumber':_0xcc5e32,'callerId':_0x5055d3,'callbackUrl':_0x44b725});return _0x4c506f[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x2a')});})[_0xfa74('0x1a')](handleError(_0x4c506f));};exports[_0xfa74('0x2b')]=function(_0x13475a,_0x1a2d52){logger['info'](_0xfa74('0x2c'),_0x13475a[_0xfa74('0x24')]);var _0x430339=hangupValidation[_0xfa74('0xa')](_0x13475a[_0xfa74('0x24')]);if(_0x430339[_0xfa74('0x25')]>0x0){return _0x1a2d52['status'](0x190)[_0xfa74('0x26')](_0x430339);}var _0x1f0806=_0x13475a[_0xfa74('0x24')][_0xfa74('0x27')];var _0x5853d4=_0x13475a[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x1f0806)[_0xfa74('0x1d')](function(_0x35f252){logger['info'](_0xfa74('0x2d'),_0x35f252[_0xfa74('0x16')]);emit(util[_0xfa74('0x2e')]('user:%s',_0x35f252['name']),_0xfa74('0x2f'),{'sessionId':_0x5853d4});return _0x1a2d52[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x30')});})['catch'](handleError(_0x1a2d52));};exports[_0xfa74('0x31')]=function(_0x171923,_0x54e66d){logger['info']('answer\x20fired:',_0x171923['body']);var _0x95c891=answerValidation[_0xfa74('0xa')](_0x171923[_0xfa74('0x24')]);if(_0x95c891[_0xfa74('0x25')]>0x0){return _0x54e66d[_0xfa74('0x17')](0x190)[_0xfa74('0x26')](_0x95c891);}var _0x7735c5=_0x171923['body'][_0xfa74('0x27')];var _0x3938c1=_0x171923[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x7735c5)[_0xfa74('0x1d')](function(_0x4af7d4){logger[_0xfa74('0x11')](_0xfa74('0x2d'),_0x4af7d4[_0xfa74('0x16')]);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x4af7d4[_0xfa74('0x16')]),_0xfa74('0x33'),{'sessionId':_0x3938c1});return _0x54e66d[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x34')});})['catch'](handleError(_0x54e66d));};exports[_0xfa74('0x35')]=function(_0x4ebb67,_0xb7db3){logger[_0xfa74('0x11')](_0xfa74('0x36'),_0x4ebb67[_0xfa74('0x24')]);var _0x4911a5=holdValidation[_0xfa74('0xa')](_0x4ebb67[_0xfa74('0x24')]);if(_0x4911a5['length']>0x0){return _0xb7db3[_0xfa74('0x17')](0x190)[_0xfa74('0x26')](_0x4911a5);}var _0x5cbb70=_0x4ebb67[_0xfa74('0x24')][_0xfa74('0x27')];var _0x26d239=_0x4ebb67[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x5cbb70)['then'](function(_0x54e06c){logger[_0xfa74('0x11')](_0xfa74('0x2d'),_0x54e06c['name']);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x54e06c[_0xfa74('0x16')]),'webbar:hold',{'sessionId':_0x26d239});return _0xb7db3['status'](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x37')});})[_0xfa74('0x1a')](handleError(_0xb7db3));};exports[_0xfa74('0x38')]=function(_0x36508a,_0x3cb23d){logger[_0xfa74('0x11')](_0xfa74('0x39'),_0x36508a['body']);var _0x214994=unholdValidation[_0xfa74('0xa')](_0x36508a[_0xfa74('0x24')]);if(_0x214994[_0xfa74('0x25')]>0x0){return _0x3cb23d['status'](0x190)['json'](_0x214994);}var _0x3146de=_0x36508a['body'][_0xfa74('0x27')];var _0x221dc7=_0x36508a[_0xfa74('0x24')][_0xfa74('0x1f')];return getAgent(_0x3146de)[_0xfa74('0x1d')](function(_0x144c80){logger[_0xfa74('0x11')]('entityFound:',_0x144c80[_0xfa74('0x16')]);emit(util['format'](_0xfa74('0x32'),_0x144c80['name']),'webbar:unhold',{'sessionId':_0x221dc7});return _0x3cb23d[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':'unhold\x20executed!'});})['catch'](handleError(_0x3cb23d));};exports[_0xfa74('0x3a')]=function(_0x1ab715,_0x8afe72){logger[_0xfa74('0x11')](_0xfa74('0x3b'),_0x8afe72[_0xfa74('0x24')]);var _0x1198f3=callsValidation[_0xfa74('0xa')](_0x1ab715[_0xfa74('0x24')]);if(_0x1198f3[_0xfa74('0x25')]>0x0){return _0x8afe72['status'](0x190)[_0xfa74('0x26')](_0x1198f3);}var _0xc89005=_0x1ab715['body']['userId'];var _0x3d88dc=respondWithRpcPromise(_0xfa74('0x3c'));var _0x99f568=getAgent(_0xc89005);return Promise[_0xfa74('0x1e')]([_0x3d88dc,_0x99f568])[_0xfa74('0x1d')](function(_0x5475f1){var _0x36cfc6=_0x5475f1[0x0];var _0x4d6235=_0x5475f1[0x1];var _0x26b398=_[_0xfa74('0x3d')](_0x36cfc6[_0xfa74('0x3e')],function(_0x480295){return _0x480295['UserId']==_0x4d6235['id'];});return _0x8afe72[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'count':_0x26b398[_0xfa74('0x25')],'rows':_0x26b398});})[_0xfa74('0x1a')](handleError(_0x8afe72));};exports['conference']=function(_0xe87727,_0x2f5c31){logger['info'](_0xfa74('0x3f'),_0xe87727[_0xfa74('0x24')]);var _0x1861af=conferenceValidation[_0xfa74('0xa')](_0xe87727['body']);if(_0x1861af[_0xfa74('0x25')]>0x0){return _0x2f5c31['status'](0x190)[_0xfa74('0x26')](_0x1861af);}var _0x3ceb9d=_0xe87727[_0xfa74('0x24')][_0xfa74('0x27')];return getAgent(_0x3ceb9d)[_0xfa74('0x1d')](function(_0x6a3790){logger[_0xfa74('0x11')](_0xfa74('0x2d'),_0x6a3790[_0xfa74('0x16')]);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x6a3790[_0xfa74('0x16')]),_0xfa74('0x40'));return _0x2f5c31[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':'conference\x20executed!'});})[_0xfa74('0x1a')](handleError(_0x2f5c31));};exports[_0xfa74('0x41')]=function(_0x5035dd,_0x57a923){logger[_0xfa74('0x11')]('transfer\x20fired:',_0x5035dd[_0xfa74('0x24')]);var _0x2e8174=transferValidation[_0xfa74('0xa')](_0x5035dd['body']);if(_0x2e8174[_0xfa74('0x25')]>0x0){return _0x57a923['status'](0x190)['json'](_0x2e8174);}var _0x1856ea=_0x5035dd[_0xfa74('0x24')][_0xfa74('0x27')];var _0x414e31=_0x5035dd[_0xfa74('0x24')][_0xfa74('0x1f')];var _0x70120d=_0x5035dd[_0xfa74('0x24')][_0xfa74('0x42')];return getAgent(_0x1856ea)[_0xfa74('0x1d')](function(_0x2588bb){logger['info'](_0xfa74('0x2d'),_0x2588bb['name']);emit(util[_0xfa74('0x2e')](_0xfa74('0x32'),_0x2588bb[_0xfa74('0x16')]),'webbar:transfer',{'sessionId':_0x414e31,'transferNumber':_0x70120d});return _0x57a923[_0xfa74('0x17')](0xc8)[_0xfa74('0x26')]({'error':![],'message':_0xfa74('0x43')});})['catch'](handleError(_0x57a923));}; \ No newline at end of file +var _0x4876=['send','NotFound','request','then','message','result','catch','User','agent','VoiceChannels','all','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','json','body','callNumber','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','userId','format','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','filter','conference','conference\x20fired:','webbar:conference','transfer','transferNumber','webbar:transfer','transfer\x20executed!','../../mysqldb','bluebird','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','status'];(function(_0x1e4cb1,_0x316ad2){var _0x34e30f=function(_0x27642a){while(--_0x27642a){_0x1e4cb1['push'](_0x1e4cb1['shift']());}};_0x34e30f(++_0x316ad2);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var path=require('path');var fs=require('fs');var _=require('lodash');var db=require(_0x6487('0x0'))['db'];var config=require('../../config/environment');var util=require('util');var BPromise=require(_0x6487('0x1'));var jayson=require('jayson/promise');var amiClient=jayson[_0x6487('0x2')][_0x6487('0x3')]({'port':0x232a});var logger=require(_0x6487('0x4'))(_0x6487('0x5'));var Redis=require('ioredis');config[_0x6487('0x6')]=_[_0x6487('0x7')](config['redis'],{'host':_0x6487('0x8'),'port':0x18eb});var io=require(_0x6487('0x9'))(new Redis(config[_0x6487('0x6')]));var Schema=require(_0x6487('0xa'));var originateValidation=new Schema({'userId':{'type':_0x6487('0xb'),'required':[!![],_0x6487('0xc')]},'callNumber':{'type':_0x6487('0xd'),'required':[!![],_0x6487('0xe')]},'callerId':{'type':_0x6487('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x6487('0xb'),'required':[!![],_0x6487('0xc')]},'sessionId':{'type':_0x6487('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6487('0xb'),'required':[!![],_0x6487('0xc')]},'sessionId':{'type':_0x6487('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x6487('0xb'),'required':[!![],_0x6487('0xc')]},'sessionId':{'type':'string','required':[!![],_0x6487('0xf')]},'transferNumber':{'type':_0x6487('0xd'),'required':[!![],_0x6487('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x6487('0xb'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6487('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x6487('0xb'),'required':[!![],_0x6487('0xc')]},'sessionId':{'type':_0x6487('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x6487('0xb'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x2fdfc3,_0x583f04,_0x1bd934){logger[_0x6487('0x11')](_0x2fdfc3,_0x583f04,JSON[_0x6487('0x12')](_0x1bd934));io['to'](_0x2fdfc3)[_0x6487('0x13')](_0x583f04,_0x1bd934);}function handleError(_0x18c6cf){return function(_0x59514e){console['log']('handleError:',_0x59514e,_0x59514e instanceof RangeError);logger[_0x6487('0x14')](_0x59514e[_0x6487('0x15')]);if(_0x59514e instanceof RangeError){if(_0x59514e[_0x6487('0x16')]){delete _0x59514e[_0x6487('0x16')];}_0x18c6cf[_0x6487('0x17')](0x194)[_0x6487('0x18')](_0x59514e);}else{if(_0x59514e[_0x6487('0x16')]){delete _0x59514e[_0x6487('0x16')];}_0x18c6cf[_0x6487('0x17')](0x1f4)[_0x6487('0x18')](_0x59514e);}};}function checkError(){return function(_0xee261d){if(!_0xee261d){throw new RangeError(_0x6487('0x19'));}return _0xee261d;};}function respondWithRpcPromise(_0x3efa5e,_0x8cdc62){return new BPromise(function(_0x21b8e8,_0x21050d){var _0x3affe7=amiClient;return _0x3affe7[_0x6487('0x1a')](_0x3efa5e,_0x8cdc62)[_0x6487('0x1b')](function(_0x4d06b2){if(_0x4d06b2['error']){if(_0x4d06b2[_0x6487('0x14')]['code']===0x1f4){return _0x21050d(_0x4d06b2['error'][_0x6487('0x1c')]);}return _0x21b8e8(_0x4d06b2[_0x6487('0x14')]['message']);}else{_0x21b8e8(_0x4d06b2[_0x6487('0x1d')]);}})[_0x6487('0x1e')](function(_0x2f4190){_0x21050d(_0x2f4190);});});}function getAgent(_0x3afdc6){return db[_0x6487('0x1f')]['findOne']({'where':{'id':_0x3afdc6,'role':_0x6487('0x20')}})['then'](checkError());}function getAgentCheckSession(_0x335bd8,_0x5a29f9){return new BPromise(function(_0x5a9ef0,_0x412056){var _0x31ede3=respondWithRpcPromise(_0x6487('0x21'));var _0x4c424a=getAgent(_0x335bd8);Promise[_0x6487('0x22')]([_0x31ede3,_0x4c424a])[_0x6487('0x1b')](function(_0x33085b){var _0x63ddc7=_0x33085b[0x0];var _0x35b089=_0x33085b[0x1];var _0x8b42e5=_['filter'](_0x63ddc7[_0x6487('0x23')],function(_0x270e6e){return _0x270e6e['UserId']==_0x35b089['id']&&_0x270e6e[_0x6487('0x24')]==_0x5a29f9;});if(_0x8b42e5[_0x6487('0x25')]==0x1){_0x5a9ef0(_0x35b089);}else{_0x412056(new RangeError(_0x6487('0x26')+_0x5a29f9+_0x6487('0x27')));}});});}exports[_0x6487('0x28')]=function(_0x809bb8,_0x21aff9){logger['info'](_0x6487('0x29'),_0x809bb8['body']);var _0x2d320c=originateValidation['validate'](_0x809bb8['body']);if(_0x2d320c['length']>0x0){return _0x21aff9['status'](0x190)[_0x6487('0x2a')](_0x2d320c);}var _0x36c78e=_0x809bb8[_0x6487('0x2b')]['userId'];var _0x1c9393=_0x809bb8['body'][_0x6487('0x2c')];var _0x3685ff=_0x809bb8[_0x6487('0x2b')][_0x6487('0x2d')];var _0x1bbe0b=_0x809bb8['body'][_0x6487('0x2e')];return getAgent(_0x36c78e)['then'](function(_0x32dbf5){logger[_0x6487('0x11')](_0x6487('0x2f'),_0x32dbf5[_0x6487('0x16')]);emit(util['format'](_0x6487('0x30'),_0x32dbf5[_0x6487('0x16')]),_0x6487('0x31'),{'callNumber':_0x1c9393,'callerId':_0x3685ff,'callbackUrl':_0x1bbe0b});return _0x21aff9['status'](0xc8)['json']({'error':![],'message':_0x6487('0x32')});})['catch'](handleError(_0x21aff9));};exports[_0x6487('0x33')]=function(_0x175a9c,_0xff0c42){logger['info'](_0x6487('0x34'),_0x175a9c[_0x6487('0x2b')]);var _0xd9235c=hangupValidation[_0x6487('0xa')](_0x175a9c[_0x6487('0x2b')]);if(_0xd9235c[_0x6487('0x25')]>0x0){return _0xff0c42[_0x6487('0x17')](0x190)['json'](_0xd9235c);}var _0xa2a8dc=_0x175a9c[_0x6487('0x2b')][_0x6487('0x35')];var _0x5f4720=_0x175a9c[_0x6487('0x2b')]['sessionId'];return getAgent(_0xa2a8dc)[_0x6487('0x1b')](function(_0x499b8a){logger[_0x6487('0x11')]('entityFound:',_0x499b8a[_0x6487('0x16')]);emit(util[_0x6487('0x36')](_0x6487('0x30'),_0x499b8a[_0x6487('0x16')]),_0x6487('0x37'),{'sessionId':_0x5f4720});return _0xff0c42[_0x6487('0x17')](0xc8)[_0x6487('0x2a')]({'error':![],'message':_0x6487('0x38')});})['catch'](handleError(_0xff0c42));};exports[_0x6487('0x39')]=function(_0x33feca,_0x746f40){logger[_0x6487('0x11')](_0x6487('0x3a'),_0x33feca[_0x6487('0x2b')]);var _0x594b42=answerValidation[_0x6487('0xa')](_0x33feca[_0x6487('0x2b')]);if(_0x594b42['length']>0x0){return _0x746f40[_0x6487('0x17')](0x190)[_0x6487('0x2a')](_0x594b42);}var _0x26f2da=_0x33feca[_0x6487('0x2b')][_0x6487('0x35')];var _0x1168c9=_0x33feca[_0x6487('0x2b')][_0x6487('0x24')];return getAgent(_0x26f2da)[_0x6487('0x1b')](function(_0x5a3f2b){logger[_0x6487('0x11')](_0x6487('0x2f'),_0x5a3f2b[_0x6487('0x16')]);emit(util['format']('user:%s',_0x5a3f2b[_0x6487('0x16')]),_0x6487('0x3b'),{'sessionId':_0x1168c9});return _0x746f40[_0x6487('0x17')](0xc8)[_0x6487('0x2a')]({'error':![],'message':_0x6487('0x3c')});})[_0x6487('0x1e')](handleError(_0x746f40));};exports['hold']=function(_0xc43296,_0x480fb5){logger[_0x6487('0x11')](_0x6487('0x3d'),_0xc43296[_0x6487('0x2b')]);var _0x223fe0=holdValidation[_0x6487('0xa')](_0xc43296[_0x6487('0x2b')]);if(_0x223fe0[_0x6487('0x25')]>0x0){return _0x480fb5[_0x6487('0x17')](0x190)[_0x6487('0x2a')](_0x223fe0);}var _0x1e8ae7=_0xc43296[_0x6487('0x2b')][_0x6487('0x35')];var _0x552ed6=_0xc43296[_0x6487('0x2b')]['sessionId'];return getAgent(_0x1e8ae7)[_0x6487('0x1b')](function(_0x2c4272){logger[_0x6487('0x11')](_0x6487('0x2f'),_0x2c4272[_0x6487('0x16')]);emit(util[_0x6487('0x36')](_0x6487('0x30'),_0x2c4272[_0x6487('0x16')]),_0x6487('0x3e'),{'sessionId':_0x552ed6});return _0x480fb5[_0x6487('0x17')](0xc8)[_0x6487('0x2a')]({'error':![],'message':_0x6487('0x3f')});})[_0x6487('0x1e')](handleError(_0x480fb5));};exports[_0x6487('0x40')]=function(_0x2a7715,_0x2dde3c){logger[_0x6487('0x11')](_0x6487('0x41'),_0x2a7715[_0x6487('0x2b')]);var _0x56aa08=unholdValidation[_0x6487('0xa')](_0x2a7715[_0x6487('0x2b')]);if(_0x56aa08['length']>0x0){return _0x2dde3c[_0x6487('0x17')](0x190)[_0x6487('0x2a')](_0x56aa08);}var _0x128700=_0x2a7715[_0x6487('0x2b')]['userId'];var _0x3506fc=_0x2a7715[_0x6487('0x2b')][_0x6487('0x24')];return getAgent(_0x128700)[_0x6487('0x1b')](function(_0x2deb3c){logger[_0x6487('0x11')](_0x6487('0x2f'),_0x2deb3c['name']);emit(util[_0x6487('0x36')](_0x6487('0x30'),_0x2deb3c[_0x6487('0x16')]),_0x6487('0x42'),{'sessionId':_0x3506fc});return _0x2dde3c[_0x6487('0x17')](0xc8)[_0x6487('0x2a')]({'error':![],'message':_0x6487('0x43')});})[_0x6487('0x1e')](handleError(_0x2dde3c));};exports[_0x6487('0x44')]=function(_0xe0858c,_0x301400){logger['info'](_0x6487('0x45'),_0x301400['body']);var _0xe1f349=callsValidation[_0x6487('0xa')](_0xe0858c[_0x6487('0x2b')]);if(_0xe1f349[_0x6487('0x25')]>0x0){return _0x301400[_0x6487('0x17')](0x190)[_0x6487('0x2a')](_0xe1f349);}var _0x2fb140=_0xe0858c[_0x6487('0x2b')]['userId'];var _0x4d7a8a=respondWithRpcPromise(_0x6487('0x21'));var _0x1c0ab6=getAgent(_0x2fb140);return Promise['all']([_0x4d7a8a,_0x1c0ab6])[_0x6487('0x1b')](function(_0x3fd845){var _0x382ce1=_0x3fd845[0x0];var _0x7b0612=_0x3fd845[0x1];var _0x1c7a3f=_[_0x6487('0x46')](_0x382ce1[_0x6487('0x23')],function(_0x5296dd){return _0x5296dd['UserId']==_0x7b0612['id'];});return _0x301400['status'](0xc8)['json']({'count':_0x1c7a3f['length'],'rows':_0x1c7a3f});})[_0x6487('0x1e')](handleError(_0x301400));};exports[_0x6487('0x47')]=function(_0xfed030,_0xec93d9){logger[_0x6487('0x11')](_0x6487('0x48'),_0xfed030[_0x6487('0x2b')]);var _0x27e7a5=conferenceValidation['validate'](_0xfed030['body']);if(_0x27e7a5[_0x6487('0x25')]>0x0){return _0xec93d9[_0x6487('0x17')](0x190)[_0x6487('0x2a')](_0x27e7a5);}var _0x1585ae=_0xfed030[_0x6487('0x2b')][_0x6487('0x35')];return getAgent(_0x1585ae)[_0x6487('0x1b')](function(_0xce3a79){logger['info'](_0x6487('0x2f'),_0xce3a79[_0x6487('0x16')]);emit(util[_0x6487('0x36')](_0x6487('0x30'),_0xce3a79[_0x6487('0x16')]),_0x6487('0x49'));return _0xec93d9[_0x6487('0x17')](0xc8)[_0x6487('0x2a')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0xec93d9));};exports[_0x6487('0x4a')]=function(_0x3d4a23,_0x3ea745){logger[_0x6487('0x11')]('transfer\x20fired:',_0x3d4a23['body']);var _0xe432f4=transferValidation[_0x6487('0xa')](_0x3d4a23[_0x6487('0x2b')]);if(_0xe432f4[_0x6487('0x25')]>0x0){return _0x3ea745[_0x6487('0x17')](0x190)[_0x6487('0x2a')](_0xe432f4);}var _0x3a7a85=_0x3d4a23[_0x6487('0x2b')][_0x6487('0x35')];var _0x1eeecb=_0x3d4a23['body'][_0x6487('0x24')];var _0x283454=_0x3d4a23[_0x6487('0x2b')][_0x6487('0x4b')];return getAgent(_0x3a7a85)[_0x6487('0x1b')](function(_0x1d3eae){logger[_0x6487('0x11')](_0x6487('0x2f'),_0x1d3eae['name']);emit(util[_0x6487('0x36')]('user:%s',_0x1d3eae[_0x6487('0x16')]),_0x6487('0x4c'),{'sessionId':_0x1eeecb,'transferNumber':_0x283454});return _0x3ea745[_0x6487('0x17')](0xc8)[_0x6487('0x2a')]({'error':![],'message':_0x6487('0x4d')});})['catch'](handleError(_0x3ea745));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 526519c..635c4dc 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 _0xf61e=['getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','notify','send','put','/:id','update','delete','destroy','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','isAuthenticated','describe','show','/:id/dispositions'];(function(_0x24f5b4,_0x3b3bea){var _0x342a22=function(_0x15f13e){while(--_0x15f13e){_0x24f5b4['push'](_0x24f5b4['shift']());}};_0x342a22(++_0x3b3bea);}(_0xf61e,0x191));var _0xef61=function(_0x1accc5,_0x4c52e5){_0x1accc5=_0x1accc5-0x0;var _0x562043=_0xf61e[_0x1accc5];return _0x562043;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require(_0xef61('0x3'));var express=require(_0xef61('0x4'));var router=express[_0xef61('0x5')]();var fs_extra=require(_0xef61('0x6'));var auth=require(_0xef61('0x7'));var interaction=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var controller=require(_0xef61('0xa'));router[_0xef61('0xb')]('/',auth['isAuthenticated'](),controller[_0xef61('0xc')]);router[_0xef61('0xb')]('/describe',auth[_0xef61('0xd')](),controller[_0xef61('0xe')]);router[_0xef61('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xef61('0xf')]);router[_0xef61('0xb')](_0xef61('0x10'),auth[_0xef61('0xd')](),controller[_0xef61('0x11')]);router[_0xef61('0xb')](_0xef61('0x12'),auth[_0xef61('0xd')](),controller[_0xef61('0x13')]);router[_0xef61('0xb')](_0xef61('0x14'),auth[_0xef61('0xd')](),controller[_0xef61('0x15')]);router[_0xef61('0xb')]('/:id/applications',auth[_0xef61('0xd')](),controller['getApplications']);router[_0xef61('0x16')]('/',auth[_0xef61('0xd')](),controller[_0xef61('0x17')]);router[_0xef61('0x16')]('/:id/dispositions',auth[_0xef61('0xd')](),controller[_0xef61('0x18')]);router[_0xef61('0x16')](_0xef61('0x12'),auth['isAuthenticated'](),controller[_0xef61('0x19')]);router[_0xef61('0x16')]('/:id/users',auth[_0xef61('0xd')](),controller[_0xef61('0x1a')]);router[_0xef61('0x16')](_0xef61('0x1b'),auth[_0xef61('0xd')](),controller[_0xef61('0x1c')]);router[_0xef61('0x16')]('/:id/notify',controller[_0xef61('0x1d')]);router[_0xef61('0x16')]('/:id/send',auth[_0xef61('0xd')](),controller[_0xef61('0x1e')]);router[_0xef61('0x1f')](_0xef61('0x20'),auth[_0xef61('0xd')](),controller[_0xef61('0x21')]);router[_0xef61('0x22')]('/:id',auth['isAuthenticated'](),controller[_0xef61('0x23')]);router['delete'](_0xef61('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xef61('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xef61('0x24')]);router[_0xef61('0x22')](_0xef61('0x14'),auth[_0xef61('0xd')](),controller['removeAgents']);module[_0xef61('0x25')]=router; \ No newline at end of file +var _0xf4f4=['../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1ab6c7,_0x2e0073){var _0x57d998=function(_0x1552b4){while(--_0x1552b4){_0x1ab6c7['push'](_0x1ab6c7['shift']());}};_0x57d998(++_0x2e0073);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x5ab7c6,_0x26c956){_0x5ab7c6=_0x5ab7c6-0x0;var _0xf45077=_0xf4f4[_0x5ab7c6];return _0xf45077;};'use strict';var multer=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var path=require('path');var timeout=require(_0x4f4f('0x2'));var express=require(_0x4f4f('0x3'));var router=express[_0x4f4f('0x4')]();var fs_extra=require(_0x4f4f('0x5'));var auth=require(_0x4f4f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4f4f('0x7'));var controller=require('./whatsappAccount.controller');router[_0x4f4f('0x8')]('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xa')]);router[_0x4f4f('0x8')](_0x4f4f('0xb'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xc')]);router[_0x4f4f('0x8')]('/:id',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xd')]);router[_0x4f4f('0x8')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0xf')]);router[_0x4f4f('0x8')](_0x4f4f('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4f4f('0x8')](_0x4f4f('0x11'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x12')]);router[_0x4f4f('0x8')](_0x4f4f('0x13'),auth['isAuthenticated'](),controller[_0x4f4f('0x14')]);router['post']('/',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x15')]);router[_0x4f4f('0x16')](_0x4f4f('0xe'),auth['isAuthenticated'](),controller[_0x4f4f('0x17')]);router['post']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x4f4f('0x18')]);router[_0x4f4f('0x16')](_0x4f4f('0x11'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x19')]);router[_0x4f4f('0x16')](_0x4f4f('0x13'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x1a')]);router[_0x4f4f('0x16')](_0x4f4f('0x1b'),controller[_0x4f4f('0x1c')]);router['post'](_0x4f4f('0x1d'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x1e')]);router[_0x4f4f('0x1f')](_0x4f4f('0x20'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x21')]);router[_0x4f4f('0x22')](_0x4f4f('0x20'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x23')]);router[_0x4f4f('0x22')](_0x4f4f('0xe'),auth[_0x4f4f('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x24')]);router['delete'](_0x4f4f('0x11'),auth[_0x4f4f('0x9')](),controller[_0x4f4f('0x25')]);module[_0x4f4f('0x26')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index f136b36..26e84a1 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 _0x531a=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x2c6a4b,_0xd3ce43){var _0x33a22d=function(_0x5a920d){while(--_0x5a920d){_0x2c6a4b['push'](_0x2c6a4b['shift']());}};_0x33a22d(++_0xd3ce43);}(_0x531a,0x1a7));var _0xa531=function(_0x1b4f2e,_0xaf2b8f){_0x1b4f2e=_0x1b4f2e-0x0;var _0x3a483d=_0x531a[_0x1b4f2e];return _0x3a483d;};'use strict';var Sequelize=require(_0xa531('0x0'));var rs=require(_0xa531('0x1'));module[_0xa531('0x2')]={'name':{'type':Sequelize[_0xa531('0x3')],'unique':_0xa531('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xa531('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xa531('0x3')],'defaultValue':function(){return rs[_0xa531('0x5')]();}},'phone':{'type':Sequelize[_0xa531('0x3')]},'type':{'type':Sequelize[_0xa531('0x6')](_0xa531('0x7'))},'accountSid':{'type':Sequelize[_0xa531('0x3')]},'authToken':{'type':Sequelize[_0xa531('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa531('0x8')],'defaultValue':function(){return _0xa531('0x9');}},'notificationSound':{'type':Sequelize[_0xa531('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa531('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa531('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa531('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa531('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa531('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa531('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa531('0xb')],'comment':_0xa531('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xa531('0xa')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x189d64){if(!_0x189d64){this[_0xa531('0xd')]('mandatoryDispositionPauseId',null);}this['setDataValue'](_0xa531('0xe'),_0x189d64);}},'description':{'type':Sequelize[_0xa531('0x3')]}}; \ No newline at end of file +var _0xb401=['sequelize','randomstring','exports','STRING','name','twilio','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(_0x5bf031,_0xb5a232){var _0x11d780=function(_0xe7afc2){while(--_0xe7afc2){_0x5bf031['push'](_0x5bf031['shift']());}};_0x11d780(++_0xb5a232);}(_0xb401,0x174));var _0x1b40=function(_0x1c389c,_0x20d10b){_0x1c389c=_0x1c389c-0x0;var _0x3621d2=_0xb401[_0x1c389c];return _0x3621d2;};'use strict';var Sequelize=require(_0x1b40('0x0'));var rs=require(_0x1b40('0x1'));module[_0x1b40('0x2')]={'name':{'type':Sequelize[_0x1b40('0x3')],'unique':_0x1b40('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x1b40('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x1b40('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x1b40('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x1b40('0x3')]},'type':{'type':Sequelize['ENUM'](_0x1b40('0x5'))},'accountSid':{'type':Sequelize[_0x1b40('0x3')]},'authToken':{'type':Sequelize[_0x1b40('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1b40('0x6');}},'notificationSound':{'type':Sequelize[_0x1b40('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1b40('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1b40('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1b40('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1b40('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1b40('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1b40('0x7')],'defaultValue':![],'comment':_0x1b40('0x9'),'set':function(_0x4bfe23){if(!_0x4bfe23){this[_0x1b40('0xa')](_0x1b40('0xb'),null);}this[_0x1b40('0xa')]('mandatoryDisposition',_0x4bfe23);}},'description':{'type':Sequelize[_0x1b40('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index bf6eb1e..520cf0e 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 _0xe3b7=['CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','isNil','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','contact','WhatsappInteraction','interaction','created','autoclose','applications','push','close','unmanaged','WhatsappMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','set','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','dataValues','Messages','eml-format','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','crypto','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','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','reject','save','destroy','get','UserProfileResource','stack','name','send','index','Pause','WhatsappAccount','rawAttributes','fieldName','type','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','rows','show','params','mandatoryDispositionPause','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','WhatsappAccountId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','addAnswer','getAnswers','CannedAnswer','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','WhatsappApplication','findAndCountAll','priority','getApplications','notify','account','Applications','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','updatedAt'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xe3b7,0xe4));var _0x7e3b=function(_0x485b5a,_0x2b289b){_0x485b5a=_0x485b5a-0x0;var _0xd2b34d=_0xe3b7[_0x485b5a];return _0xd2b34d;};'use strict';var emlformat=require(_0x7e3b('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7e3b('0x1'));var moment=require(_0x7e3b('0x2'));var BPromise=require(_0x7e3b('0x3'));var Mustache=require(_0x7e3b('0x4'));var util=require('util');var path=require(_0x7e3b('0x5'));var sox=require(_0x7e3b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7e3b('0x7'));var _=require(_0x7e3b('0x8'));var squel=require('squel');var crypto=require(_0x7e3b('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7e3b('0xa'));var querystring=require(_0x7e3b('0xb'));var Papa=require(_0x7e3b('0xc'));var Redis=require(_0x7e3b('0xd'));var authService=require(_0x7e3b('0xe'));var qs=require(_0x7e3b('0xf'));var as=require(_0x7e3b('0x10'));var hardwareService=require(_0x7e3b('0x11'));var logger=require(_0x7e3b('0x12'))(_0x7e3b('0x13'));var utils=require(_0x7e3b('0x14'));var config=require(_0x7e3b('0x15'));var licenseUtil=require(_0x7e3b('0x16'));var db=require(_0x7e3b('0x17'))['db'];config[_0x7e3b('0x18')]=_[_0x7e3b('0x19')](config[_0x7e3b('0x18')],{'host':_0x7e3b('0x1a'),'port':0x18eb});var socket=require(_0x7e3b('0x1b'))(new Redis(config[_0x7e3b('0x18')]));require('./whatsappAccount.socket')[_0x7e3b('0x1c')](socket);var jayson=require(_0x7e3b('0x1d'));var client=jayson[_0x7e3b('0x1e')][_0x7e3b('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x1ed772,_0x411884,_0x4b1cdd,_0x3b6308){return new BPromise(function(_0x1836d0,_0x4de764){var _0x53b7f2=_0x3b6308||client;return _0x53b7f2[_0x7e3b('0x20')](_0x1ed772,_0x4b1cdd)[_0x7e3b('0x21')](function(_0x444dda){logger[_0x7e3b('0x22')](_0x7e3b('0x23'),_0x411884,'request\x20sent');logger[_0x7e3b('0x24')](_0x7e3b('0x25'),_0x411884,_0x7e3b('0x26'),JSON[_0x7e3b('0x27')](_0x444dda));if(_0x444dda['error']){if(_0x444dda[_0x7e3b('0x28')]['code']===0x1f4){logger['error'](_0x7e3b('0x23'),_0x411884,_0x444dda['error']['message']);return _0x4de764(_0x444dda[_0x7e3b('0x28')][_0x7e3b('0x29')]);}logger[_0x7e3b('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x411884,_0x444dda[_0x7e3b('0x28')][_0x7e3b('0x29')]);return _0x1836d0(_0x444dda[_0x7e3b('0x28')][_0x7e3b('0x29')]);}else{logger[_0x7e3b('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x411884,_0x7e3b('0x26'));_0x1836d0(_0x444dda[_0x7e3b('0x2a')][_0x7e3b('0x29')]);}})[_0x7e3b('0x2b')](function(_0x40fa59){logger[_0x7e3b('0x28')](_0x7e3b('0x23'),_0x411884,_0x40fa59);_0x4de764(_0x40fa59);});});}function respondWithStatusCode(_0x332c47,_0xd2c91b){_0xd2c91b=_0xd2c91b||0xcc;return function(_0x2c198a){if(_0x2c198a){return _0x332c47[_0x7e3b('0x2c')](_0xd2c91b);}return _0x332c47['status'](_0xd2c91b)[_0x7e3b('0x2d')]();};}function respondWithResult(_0x4cc1a1,_0x3c580d){_0x3c580d=_0x3c580d||0xc8;return function(_0x2dba8b){if(_0x2dba8b){return _0x4cc1a1[_0x7e3b('0x2e')](_0x3c580d)[_0x7e3b('0x2f')](_0x2dba8b);}};}function respondWithFilteredResult(_0x15c1b0,_0x410ca7){return function(_0x298c4e){if(_0x298c4e){var _0x4072fb=typeof _0x410ca7[_0x7e3b('0x30')]===_0x7e3b('0x31')&&typeof _0x410ca7['limit']==='undefined';var _0x4fb657=_0x298c4e[_0x7e3b('0x32')];var _0x50c6ff=_0x4072fb?0x0:_0x410ca7[_0x7e3b('0x30')];var _0x25fe3f=_0x4072fb?_0x298c4e[_0x7e3b('0x32')]:_0x410ca7[_0x7e3b('0x30')]+_0x410ca7[_0x7e3b('0x33')];var _0x5497eb;if(_0x25fe3f>=_0x4fb657){_0x25fe3f=_0x4fb657;_0x5497eb=0xc8;}else{_0x5497eb=0xce;}_0x15c1b0['status'](_0x5497eb);return _0x15c1b0['set']('Content-Range',_0x50c6ff+'-'+_0x25fe3f+'/'+_0x4fb657)['json'](_0x298c4e);}return null;};}function patchUpdates(_0x947c02){return function(_0xe183d9){try{jsonpatch['apply'](_0xe183d9,_0x947c02,!![]);}catch(_0x32ae16){return BPromise[_0x7e3b('0x34')](_0x32ae16);}return _0xe183d9[_0x7e3b('0x35')]();};}function saveUpdates(_0x5397cc,_0x3f97c7){return function(_0x46161d){if(_0x46161d){return _0x46161d['update'](_0x5397cc)[_0x7e3b('0x21')](function(_0x1aaf4b){return _0x1aaf4b;});}return null;};}function removeEntity(_0x2c4cfb,_0x2559a6){return function(_0xb81b72){if(_0xb81b72){return _0xb81b72[_0x7e3b('0x36')]()[_0x7e3b('0x21')](function(){var _0x53489f=_0xb81b72[_0x7e3b('0x37')]({'plain':!![]});var _0x216cf1='WhatsappAccounts';return db[_0x7e3b('0x38')][_0x7e3b('0x36')]({'where':{'type':_0x216cf1,'resourceId':_0x53489f['id']}})['then'](function(){return _0xb81b72;});})[_0x7e3b('0x21')](function(){_0x2c4cfb[_0x7e3b('0x2e')](0xcc)[_0x7e3b('0x2d')]();});}};}function handleEntityNotFound(_0x1180f5,_0x48d58d){return function(_0x355ce1){if(!_0x355ce1){_0x1180f5['sendStatus'](0x194);}return _0x355ce1;};}function handleError(_0x518702,_0x16a763){_0x16a763=_0x16a763||0x1f4;return function(_0x5fe2e7){logger['error'](_0x5fe2e7[_0x7e3b('0x39')]);if(_0x5fe2e7['name']){delete _0x5fe2e7[_0x7e3b('0x3a')];}_0x518702[_0x7e3b('0x2e')](_0x16a763)[_0x7e3b('0x3b')](_0x5fe2e7);};}exports[_0x7e3b('0x3c')]=function(_0x55fed7,_0x404143){var _0x5da920={'include':[{'model':db[_0x7e3b('0x3d')],'as':'mandatoryDispositionPause'}]},_0x365baa={},_0x5d1162={'count':0x0,'rows':[]};var _0x208d66=_['map'](db[_0x7e3b('0x3e')][_0x7e3b('0x3f')],function(_0x3cafaf){return{'name':_0x3cafaf[_0x7e3b('0x40')],'type':_0x3cafaf[_0x7e3b('0x41')]['key']};});_0x365baa['model']=_['map'](_0x208d66,_0x7e3b('0x3a'));_0x365baa[_0x7e3b('0x42')]=_['keys'](_0x55fed7['query']);_0x365baa[_0x7e3b('0x43')]=_['intersection'](_0x365baa['model'],_0x365baa[_0x7e3b('0x42')]);_0x5da920[_0x7e3b('0x44')]=_[_0x7e3b('0x45')](_0x365baa[_0x7e3b('0x46')],qs[_0x7e3b('0x47')](_0x55fed7[_0x7e3b('0x42')]['fields']));_0x5da920['attributes']=_0x5da920['attributes'][_0x7e3b('0x48')]?_0x5da920[_0x7e3b('0x44')]:_0x365baa[_0x7e3b('0x46')];if(!_0x55fed7[_0x7e3b('0x42')][_0x7e3b('0x49')](_0x7e3b('0x4a'))){_0x5da920['limit']=qs[_0x7e3b('0x33')](_0x55fed7[_0x7e3b('0x42')][_0x7e3b('0x33')]);_0x5da920[_0x7e3b('0x30')]=qs[_0x7e3b('0x30')](_0x55fed7[_0x7e3b('0x42')][_0x7e3b('0x30')]);}_0x5da920['order']=qs[_0x7e3b('0x4b')](_0x55fed7['query']['sort']);_0x5da920[_0x7e3b('0x4c')]=qs[_0x7e3b('0x43')](_[_0x7e3b('0x4d')](_0x55fed7[_0x7e3b('0x42')],_0x365baa['filters']),_0x208d66);if(_0x55fed7[_0x7e3b('0x42')][_0x7e3b('0x4e')]){_0x5da920[_0x7e3b('0x4c')]=_['merge'](_0x5da920[_0x7e3b('0x4c')],{'$or':_[_0x7e3b('0x4f')](_0x208d66,function(_0x321eb5){if(_0x321eb5[_0x7e3b('0x41')]!==_0x7e3b('0x50')){var _0x5bb5d1={};_0x5bb5d1[_0x321eb5['name']]={'$like':'%'+_0x55fed7[_0x7e3b('0x42')][_0x7e3b('0x4e')]+'%'};return _0x5bb5d1;}})});}_0x5da920=_[_0x7e3b('0x51')]({},_0x5da920,_0x55fed7[_0x7e3b('0x52')]);var _0x1bfaac={'where':_0x5da920[_0x7e3b('0x4c')]};return db[_0x7e3b('0x3e')]['count'](_0x1bfaac)['then'](function(_0x53757c){_0x5d1162[_0x7e3b('0x32')]=_0x53757c;if(_0x55fed7[_0x7e3b('0x42')][_0x7e3b('0x53')]){_0x5da920[_0x7e3b('0x54')]=[{'all':!![]}];}return db[_0x7e3b('0x3e')]['findAll'](_0x5da920);})['then'](function(_0xbec9d1){_0x5d1162[_0x7e3b('0x55')]=_0xbec9d1;return _0x5d1162;})[_0x7e3b('0x21')](respondWithFilteredResult(_0x404143,_0x5da920))[_0x7e3b('0x2b')](handleError(_0x404143,null));};exports[_0x7e3b('0x56')]=function(_0x43aaa8,_0x313740){var _0x37cab6={'raw':![],'where':{'id':_0x43aaa8[_0x7e3b('0x57')]['id']},'include':[{'model':db[_0x7e3b('0x3d')],'as':_0x7e3b('0x58')}]},_0x2196dd={};_0x2196dd['model']=_[_0x7e3b('0x59')](db[_0x7e3b('0x3e')][_0x7e3b('0x3f')]);_0x2196dd[_0x7e3b('0x42')]=_[_0x7e3b('0x59')](_0x43aaa8[_0x7e3b('0x42')]);_0x2196dd['filters']=_['intersection'](_0x2196dd[_0x7e3b('0x46')],_0x2196dd[_0x7e3b('0x42')]);_0x37cab6[_0x7e3b('0x44')]=_[_0x7e3b('0x45')](_0x2196dd[_0x7e3b('0x46')],qs[_0x7e3b('0x47')](_0x43aaa8[_0x7e3b('0x42')][_0x7e3b('0x47')]));_0x37cab6['attributes']=_0x37cab6[_0x7e3b('0x44')][_0x7e3b('0x48')]?_0x37cab6['attributes']:_0x2196dd[_0x7e3b('0x46')];if(_0x43aaa8['query'][_0x7e3b('0x53')]){_0x37cab6[_0x7e3b('0x54')]=[{'all':!![]}];}_0x37cab6=_[_0x7e3b('0x51')]({},_0x37cab6,_0x43aaa8[_0x7e3b('0x52')]);return db[_0x7e3b('0x3e')][_0x7e3b('0x5a')](_0x37cab6)[_0x7e3b('0x21')](handleEntityNotFound(_0x313740,null))['then'](respondWithResult(_0x313740,null))['catch'](handleError(_0x313740,null));};exports[_0x7e3b('0x5b')]=function(_0x481124,_0x847c96){return db[_0x7e3b('0x3e')][_0x7e3b('0x5b')](_0x481124['body'],{})[_0x7e3b('0x21')](function(_0x262092){var _0x1d6c31=_0x481124[_0x7e3b('0x5c')][_0x7e3b('0x37')]({'plain':!![]});if(!_0x1d6c31)throw new Error(_0x7e3b('0x5d'));if(_0x1d6c31[_0x7e3b('0x5e')]==='user'){var _0x5bd889=_0x262092['get']({'plain':!![]});var _0x3adc38=_0x7e3b('0x5f');return db['UserProfileSection'][_0x7e3b('0x5a')]({'where':{'name':_0x3adc38,'userProfileId':_0x1d6c31[_0x7e3b('0x60')]},'raw':!![]})[_0x7e3b('0x21')](function(_0x179812){if(_0x179812&&_0x179812['autoAssociation']===0x0){return db[_0x7e3b('0x38')][_0x7e3b('0x5b')]({'name':_0x5bd889['name'],'resourceId':_0x5bd889['id'],'type':_0x179812[_0x7e3b('0x3a')],'sectionId':_0x179812['id']},{})[_0x7e3b('0x21')](function(){return _0x262092;});}else{return _0x262092;}})[_0x7e3b('0x2b')](function(_0x2f3e92){logger[_0x7e3b('0x28')](_0x7e3b('0x61'),_0x2f3e92);throw _0x2f3e92;});}return _0x262092;})[_0x7e3b('0x21')](respondWithResult(_0x847c96,0xc9))[_0x7e3b('0x2b')](handleError(_0x847c96,null));};exports[_0x7e3b('0x62')]=function(_0x2214fd,_0x228140){if(_0x2214fd[_0x7e3b('0x63')]['id']){delete _0x2214fd[_0x7e3b('0x63')]['id'];}return db[_0x7e3b('0x3e')]['find']({'where':{'id':_0x2214fd[_0x7e3b('0x57')]['id']},'include':[{'model':db[_0x7e3b('0x3d')],'as':'mandatoryDispositionPause'}]})[_0x7e3b('0x21')](handleEntityNotFound(_0x228140,null))[_0x7e3b('0x21')](saveUpdates(_0x2214fd['body'],null))[_0x7e3b('0x21')](respondWithResult(_0x228140,null))['catch'](handleError(_0x228140,null));};exports[_0x7e3b('0x36')]=function(_0x23aba8,_0x66d7d){return db['WhatsappAccount'][_0x7e3b('0x5a')]({'where':{'id':_0x23aba8[_0x7e3b('0x57')]['id']}})[_0x7e3b('0x21')](handleEntityNotFound(_0x66d7d,null))[_0x7e3b('0x21')](removeEntity(_0x66d7d,null))[_0x7e3b('0x2b')](handleError(_0x66d7d,null));};exports[_0x7e3b('0x64')]=function(_0x5aff15,_0x2903e5){return db[_0x7e3b('0x3e')]['describe']()[_0x7e3b('0x21')](respondWithResult(_0x2903e5,null))[_0x7e3b('0x2b')](handleError(_0x2903e5,null));};exports['addDisposition']=function(_0x178cb9,_0x54dffd,_0x511f28){if(_0x178cb9[_0x7e3b('0x63')]['id']){delete _0x178cb9[_0x7e3b('0x63')]['id'];}return db[_0x7e3b('0x3e')][_0x7e3b('0x5a')]({'where':{'id':_0x178cb9['params']['id']}})[_0x7e3b('0x21')](handleEntityNotFound(_0x54dffd,null))['then'](function(_0x46be95){if(_0x46be95){_0x178cb9[_0x7e3b('0x63')][_0x7e3b('0x65')]=_0x46be95['id'];return db[_0x7e3b('0x66')][_0x7e3b('0x5b')](_0x178cb9[_0x7e3b('0x63')]);}})[_0x7e3b('0x21')](respondWithResult(_0x54dffd,null))[_0x7e3b('0x2b')](handleError(_0x54dffd,null));};exports[_0x7e3b('0x67')]=function(_0x18d1d7,_0xbb324e,_0x399404){var _0x443f26={'raw':![],'where':{}};var _0x56dd8a={};var _0x27afe8={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x7e3b('0x68')]({'where':{'id':_0x18d1d7['params']['id']}})['then'](handleEntityNotFound(_0xbb324e,null))['then'](function(_0x20be05){if(_0x20be05){_0x56dd8a[_0x7e3b('0x46')]=_[_0x7e3b('0x59')](db['Disposition'][_0x7e3b('0x3f')]);_0x56dd8a[_0x7e3b('0x42')]=_['keys'](_0x18d1d7['query']);_0x56dd8a[_0x7e3b('0x43')]=_[_0x7e3b('0x45')](_0x56dd8a[_0x7e3b('0x46')],_0x56dd8a[_0x7e3b('0x42')]);_0x443f26[_0x7e3b('0x44')]=_[_0x7e3b('0x45')](_0x56dd8a[_0x7e3b('0x46')],qs[_0x7e3b('0x47')](_0x18d1d7['query']['fields']));_0x443f26[_0x7e3b('0x44')]=_0x443f26[_0x7e3b('0x44')]['length']?_0x443f26['attributes']:_0x56dd8a[_0x7e3b('0x46')];if(!_0x18d1d7[_0x7e3b('0x42')][_0x7e3b('0x49')](_0x7e3b('0x4a'))){_0x443f26[_0x7e3b('0x33')]=qs['limit'](_0x18d1d7[_0x7e3b('0x42')][_0x7e3b('0x33')]);_0x443f26[_0x7e3b('0x30')]=qs[_0x7e3b('0x30')](_0x18d1d7[_0x7e3b('0x42')][_0x7e3b('0x30')]);}_0x443f26[_0x7e3b('0x69')]=qs[_0x7e3b('0x4b')](_0x18d1d7[_0x7e3b('0x42')][_0x7e3b('0x4b')]);_0x443f26[_0x7e3b('0x4c')]=qs[_0x7e3b('0x43')](_[_0x7e3b('0x4d')](_0x18d1d7[_0x7e3b('0x42')],_0x56dd8a[_0x7e3b('0x43')]));_0x443f26['where'][_0x7e3b('0x65')]=_0x20be05['id'];if(_0x18d1d7[_0x7e3b('0x42')][_0x7e3b('0x4e')]){_0x443f26[_0x7e3b('0x4c')]=_[_0x7e3b('0x51')](_0x443f26[_0x7e3b('0x4c')],{'$or':_['map'](_0x443f26[_0x7e3b('0x44')],function(_0x7adf82){var _0x5261fc={};_0x5261fc[_0x7adf82]={'$like':'%'+_0x18d1d7[_0x7e3b('0x42')][_0x7e3b('0x4e')]+'%'};return _0x5261fc;})});}_0x443f26=_['merge']({},_0x443f26,_0x18d1d7[_0x7e3b('0x52')]);return db['Disposition'][_0x7e3b('0x32')]({'where':_0x443f26[_0x7e3b('0x4c')]})[_0x7e3b('0x21')](function(_0x415fe8){_0x27afe8[_0x7e3b('0x32')]=_0x415fe8;if(_0x18d1d7['query'][_0x7e3b('0x53')]){_0x443f26[_0x7e3b('0x54')]=[{'all':!![]}];}return db[_0x7e3b('0x66')][_0x7e3b('0x6a')](_0x443f26);})[_0x7e3b('0x21')](function(_0x2b72d2){_0x27afe8[_0x7e3b('0x55')]=_0x2b72d2;return _0x27afe8;});}})[_0x7e3b('0x21')](respondWithFilteredResult(_0xbb324e,_0x443f26))[_0x7e3b('0x2b')](handleError(_0xbb324e,null));};exports[_0x7e3b('0x6b')]=function(_0x4a87b7,_0x645114,_0x59d338){return db[_0x7e3b('0x3e')][_0x7e3b('0x5a')]({'where':{'id':_0x4a87b7[_0x7e3b('0x57')]['id']}})['then'](handleEntityNotFound(_0x645114,null))[_0x7e3b('0x21')](function(_0x3cd48f){if(_0x3cd48f){return _0x3cd48f[_0x7e3b('0x6b')](_0x4a87b7[_0x7e3b('0x42')]['ids']);}})['then'](respondWithStatusCode(_0x645114,null))[_0x7e3b('0x2b')](handleError(_0x645114,null));};exports[_0x7e3b('0x6c')]=function(_0x484ebc,_0x4dc638,_0x1e6eda){if(_0x484ebc[_0x7e3b('0x63')]['id']){delete _0x484ebc[_0x7e3b('0x63')]['id'];}return db[_0x7e3b('0x3e')]['find']({'where':{'id':_0x484ebc[_0x7e3b('0x57')]['id']}})[_0x7e3b('0x21')](handleEntityNotFound(_0x4dc638,null))[_0x7e3b('0x21')](function(_0x2faaf5){if(_0x2faaf5){_0x484ebc[_0x7e3b('0x63')][_0x7e3b('0x65')]=_0x2faaf5['id'];return db['CannedAnswer'][_0x7e3b('0x5b')](_0x484ebc[_0x7e3b('0x63')]);}})[_0x7e3b('0x21')](respondWithResult(_0x4dc638,null))[_0x7e3b('0x2b')](handleError(_0x4dc638,null));};exports[_0x7e3b('0x6d')]=function(_0x48496b,_0x50346a,_0x2dae7f){var _0x289612={'raw':![],'where':{}};var _0x387f49={};var _0x200b77={'count':0x0,'rows':[]};return db[_0x7e3b('0x3e')][_0x7e3b('0x68')]({'where':{'id':_0x48496b[_0x7e3b('0x57')]['id']}})['then'](handleEntityNotFound(_0x50346a,null))['then'](function(_0x1ab5e2){if(_0x1ab5e2){_0x387f49['model']=_[_0x7e3b('0x59')](db['CannedAnswer']['rawAttributes']);_0x387f49[_0x7e3b('0x42')]=_[_0x7e3b('0x59')](_0x48496b[_0x7e3b('0x42')]);_0x387f49[_0x7e3b('0x43')]=_[_0x7e3b('0x45')](_0x387f49[_0x7e3b('0x46')],_0x387f49['query']);_0x289612[_0x7e3b('0x44')]=_['intersection'](_0x387f49[_0x7e3b('0x46')],qs['fields'](_0x48496b[_0x7e3b('0x42')][_0x7e3b('0x47')]));_0x289612[_0x7e3b('0x44')]=_0x289612[_0x7e3b('0x44')][_0x7e3b('0x48')]?_0x289612[_0x7e3b('0x44')]:_0x387f49[_0x7e3b('0x46')];if(!_0x48496b[_0x7e3b('0x42')][_0x7e3b('0x49')]('nolimit')){_0x289612[_0x7e3b('0x33')]=qs['limit'](_0x48496b[_0x7e3b('0x42')][_0x7e3b('0x33')]);_0x289612[_0x7e3b('0x30')]=qs[_0x7e3b('0x30')](_0x48496b['query']['offset']);}_0x289612[_0x7e3b('0x69')]=qs['sort'](_0x48496b['query'][_0x7e3b('0x4b')]);_0x289612['where']=qs[_0x7e3b('0x43')](_[_0x7e3b('0x4d')](_0x48496b['query'],_0x387f49[_0x7e3b('0x43')]));_0x289612[_0x7e3b('0x4c')][_0x7e3b('0x65')]=_0x1ab5e2['id'];if(_0x48496b[_0x7e3b('0x42')][_0x7e3b('0x4e')]){_0x289612['where']=_[_0x7e3b('0x51')](_0x289612[_0x7e3b('0x4c')],{'$or':_['map'](_0x289612[_0x7e3b('0x44')],function(_0x4447f3){var _0x38992e={};_0x38992e[_0x4447f3]={'$like':'%'+_0x48496b[_0x7e3b('0x42')][_0x7e3b('0x4e')]+'%'};return _0x38992e;})});}_0x289612=_[_0x7e3b('0x51')]({},_0x289612,_0x48496b[_0x7e3b('0x52')]);return db[_0x7e3b('0x6e')][_0x7e3b('0x32')]({'where':_0x289612[_0x7e3b('0x4c')]})[_0x7e3b('0x21')](function(_0x240d6f){_0x200b77['count']=_0x240d6f;if(_0x48496b['query']['includeAll']){_0x289612[_0x7e3b('0x54')]=[{'all':!![]}];}return db[_0x7e3b('0x6e')][_0x7e3b('0x6a')](_0x289612);})['then'](function(_0x29ec67){_0x200b77[_0x7e3b('0x55')]=_0x29ec67;return _0x200b77;});}})['then'](respondWithFilteredResult(_0x50346a,_0x289612))[_0x7e3b('0x2b')](handleError(_0x50346a,null));};exports[_0x7e3b('0x6f')]=function(_0x5981ad,_0x351602,_0x437349){return db[_0x7e3b('0x3e')]['find']({'where':{'id':_0x5981ad[_0x7e3b('0x57')]['id']}})['then'](handleEntityNotFound(_0x351602,null))[_0x7e3b('0x21')](function(_0x43d9eb){if(_0x43d9eb){return _0x43d9eb[_0x7e3b('0x6f')](_0x5981ad[_0x7e3b('0x42')][_0x7e3b('0x70')]);}})['then'](respondWithStatusCode(_0x351602,null))[_0x7e3b('0x2b')](handleError(_0x351602,null));};exports[_0x7e3b('0x71')]=function(_0x5ad1b4,_0x511dd6,_0x511bc8){return db[_0x7e3b('0x3e')][_0x7e3b('0x5a')]({'where':{'id':_0x5ad1b4[_0x7e3b('0x57')]['id']}})['then'](handleEntityNotFound(_0x511dd6,null))[_0x7e3b('0x21')](function(_0x2351f1){if(_0x2351f1){return _0x2351f1['addAgents'](_0x5ad1b4[_0x7e3b('0x63')][_0x7e3b('0x70')],_[_0x7e3b('0x72')](_0x5ad1b4['body'],[_0x7e3b('0x70'),'id'])||{})[_0x7e3b('0x73')](function(_0x33c1cf){for(var _0x1da487=0x0;_0x1da487<_0x5ad1b4[_0x7e3b('0x63')]['ids'][_0x7e3b('0x48')];_0x1da487+=0x1){socket[_0x7e3b('0x74')](_0x7e3b('0x75'),{'UserId':Number(_0x5ad1b4['body'][_0x7e3b('0x70')][_0x1da487]),'WhatsappAccountId':Number(_0x5ad1b4['params']['id'])});}return _0x33c1cf;});}})[_0x7e3b('0x21')](respondWithResult(_0x511dd6,null))[_0x7e3b('0x2b')](handleError(_0x511dd6,null));};exports[_0x7e3b('0x76')]=function(_0x47c5fb,_0x5242d2,_0x3b84e6){return db[_0x7e3b('0x3e')][_0x7e3b('0x5a')]({'where':{'id':_0x47c5fb['params']['id']}})['then'](handleEntityNotFound(_0x5242d2,null))[_0x7e3b('0x21')](function(_0x43f059){if(_0x43f059){return _0x43f059[_0x7e3b('0x76')](_0x47c5fb[_0x7e3b('0x42')][_0x7e3b('0x70')])['then'](function(){if(_[_0x7e3b('0x77')](_0x47c5fb['query']['ids'])){for(var _0x4574dd=0x0;_0x4574dd<_0x47c5fb[_0x7e3b('0x42')][_0x7e3b('0x70')][_0x7e3b('0x48')];_0x4574dd+=0x1){socket[_0x7e3b('0x74')](_0x7e3b('0x78'),{'UserId':Number(_0x47c5fb['query'][_0x7e3b('0x70')][_0x4574dd]),'WhatsappAccountId':Number(_0x47c5fb[_0x7e3b('0x57')]['id'])});}}else{socket[_0x7e3b('0x74')](_0x7e3b('0x78'),{'UserId':Number(_0x47c5fb[_0x7e3b('0x42')][_0x7e3b('0x70')]),'WhatsappAccountId':Number(_0x47c5fb['params']['id'])});}});}})[_0x7e3b('0x21')](respondWithStatusCode(_0x5242d2,null))[_0x7e3b('0x2b')](handleError(_0x5242d2,null));};exports[_0x7e3b('0x79')]=function(_0xcb96c,_0x2b79cb,_0x2ca4b0){var _0xb32d1e={};var _0x544b92={};var _0x14dc6b;var _0x2640d7;return db[_0x7e3b('0x3e')][_0x7e3b('0x68')]({'where':{'id':_0xcb96c['params']['id']}})[_0x7e3b('0x21')](handleEntityNotFound(_0x2b79cb,null))[_0x7e3b('0x21')](function(_0x100c52){if(_0x100c52){_0x14dc6b=_0x100c52;_0x544b92['model']=_[_0x7e3b('0x59')](db[_0x7e3b('0x7a')][_0x7e3b('0x3f')]);_0x544b92['query']=_['keys'](_0xcb96c[_0x7e3b('0x42')]);_0x544b92[_0x7e3b('0x43')]=_['intersection'](_0x544b92[_0x7e3b('0x46')],_0x544b92[_0x7e3b('0x42')]);_0xb32d1e[_0x7e3b('0x44')]=_[_0x7e3b('0x45')](_0x544b92[_0x7e3b('0x46')],qs[_0x7e3b('0x47')](_0xcb96c[_0x7e3b('0x42')][_0x7e3b('0x47')]));_0xb32d1e[_0x7e3b('0x44')]=_0xb32d1e[_0x7e3b('0x44')]['length']?_0xb32d1e[_0x7e3b('0x44')]:_0x544b92['model'];_0xb32d1e[_0x7e3b('0x69')]=qs[_0x7e3b('0x4b')](_0xcb96c[_0x7e3b('0x42')]['sort']);_0xb32d1e[_0x7e3b('0x4c')]=qs['filters'](_[_0x7e3b('0x4d')](_0xcb96c[_0x7e3b('0x42')],_0x544b92['filters']));if(_0xcb96c[_0x7e3b('0x42')]['filter']){_0xb32d1e['where']=_['merge'](_0xb32d1e[_0x7e3b('0x4c')],{'$or':_[_0x7e3b('0x4f')](_0xb32d1e['attributes'],function(_0x9b7c0e){var _0x3283ab={};_0x3283ab[_0x9b7c0e]={'$like':'%'+_0xcb96c[_0x7e3b('0x42')][_0x7e3b('0x4e')]+'%'};return _0x3283ab;})});}_0xb32d1e=_[_0x7e3b('0x51')]({},_0xb32d1e,_0xcb96c[_0x7e3b('0x52')]);return _0x14dc6b[_0x7e3b('0x79')](_0xb32d1e);}})[_0x7e3b('0x21')](function(_0x5dc09b){if(_0x5dc09b){_0x2640d7=_0x5dc09b['length'];if(!_0xcb96c[_0x7e3b('0x42')][_0x7e3b('0x49')](_0x7e3b('0x4a'))){_0xb32d1e[_0x7e3b('0x33')]=qs['limit'](_0xcb96c['query']['limit']);_0xb32d1e['offset']=qs['offset'](_0xcb96c[_0x7e3b('0x42')][_0x7e3b('0x30')]);}return _0x14dc6b[_0x7e3b('0x79')](_0xb32d1e);}})['then'](function(_0x1637aa){if(_0x1637aa){return _0x1637aa?{'count':_0x2640d7,'rows':_0x1637aa}:null;}})[_0x7e3b('0x21')](respondWithResult(_0x2b79cb,null))['catch'](handleError(_0x2b79cb,null));};exports['addApplications']=function(_0x257554,_0x1b83a5,_0x21d591){return db[_0x7e3b('0x3e')][_0x7e3b('0x68')]({'where':{'id':_0x257554[_0x7e3b('0x57')]['id']}})[_0x7e3b('0x21')](handleEntityNotFound(_0x1b83a5,null))[_0x7e3b('0x21')](function(_0x3aeae0){if(_0x3aeae0){return db[_0x7e3b('0x7b')][_0x7e3b('0x7c')](function(_0x57624a){return db[_0x7e3b('0x7d')][_0x7e3b('0x36')]({'where':{'WhatsappAccountId':_0x257554['params']['id']},'transaction':_0x57624a})[_0x7e3b('0x21')](function(_0x2e93d0){var _0x5cbdf7=_[_0x7e3b('0x4f')](_0x257554['body'],function(_0x44b31b){_0x44b31b['WhatsappAccountId']=_0x257554[_0x7e3b('0x57')]['id'];return _0x44b31b;});return db[_0x7e3b('0x7d')]['bulkCreate'](_0x5cbdf7,{'transaction':_0x57624a});});})[_0x7e3b('0x21')](function(){return db[_0x7e3b('0x7d')][_0x7e3b('0x7e')]({'where':{'WhatsappAccountId':_0x257554['params']['id']},'order':_0x7e3b('0x7f')});});}})['then'](respondWithResult(_0x1b83a5,null))[_0x7e3b('0x2b')](handleError(_0x1b83a5,null));};exports['getApplications']=function(_0x523dbd,_0xfca596,_0x39ee0d){var _0x1e0c31={};var _0x455b07={};var _0x25acc9;var _0x659d65;return db['WhatsappAccount'][_0x7e3b('0x68')]({'where':{'id':_0x523dbd[_0x7e3b('0x57')]['id']}})[_0x7e3b('0x21')](handleEntityNotFound(_0xfca596,null))[_0x7e3b('0x21')](function(_0x42b788){if(_0x42b788){_0x25acc9=_0x42b788;_0x455b07[_0x7e3b('0x46')]=_[_0x7e3b('0x59')](db['WhatsappApplication'][_0x7e3b('0x3f')]);_0x455b07[_0x7e3b('0x42')]=_['keys'](_0x523dbd[_0x7e3b('0x42')]);_0x455b07['filters']=_[_0x7e3b('0x45')](_0x455b07['model'],_0x455b07[_0x7e3b('0x42')]);_0x1e0c31['attributes']=_['intersection'](_0x455b07[_0x7e3b('0x46')],qs[_0x7e3b('0x47')](_0x523dbd['query'][_0x7e3b('0x47')]));_0x1e0c31[_0x7e3b('0x44')]=_0x1e0c31[_0x7e3b('0x44')]['length']?_0x1e0c31[_0x7e3b('0x44')]:_0x455b07[_0x7e3b('0x46')];_0x1e0c31['order']=qs[_0x7e3b('0x4b')](_0x523dbd[_0x7e3b('0x42')][_0x7e3b('0x4b')]);_0x1e0c31[_0x7e3b('0x4c')]=qs[_0x7e3b('0x43')](_[_0x7e3b('0x4d')](_0x523dbd[_0x7e3b('0x42')],_0x455b07[_0x7e3b('0x43')]));if(_0x523dbd[_0x7e3b('0x42')][_0x7e3b('0x4e')]){_0x1e0c31[_0x7e3b('0x4c')]=_['merge'](_0x1e0c31[_0x7e3b('0x4c')],{'$or':_[_0x7e3b('0x4f')](_0x1e0c31[_0x7e3b('0x44')],function(_0x12747b){var _0x25be3d={};_0x25be3d[_0x12747b]={'$like':'%'+_0x523dbd[_0x7e3b('0x42')][_0x7e3b('0x4e')]+'%'};return _0x25be3d;})});}_0x1e0c31=_[_0x7e3b('0x51')]({},_0x1e0c31,_0x523dbd[_0x7e3b('0x52')]);return _0x25acc9[_0x7e3b('0x80')](_0x1e0c31);}})[_0x7e3b('0x21')](function(_0xedfd11){if(_0xedfd11){_0x659d65=_0xedfd11[_0x7e3b('0x48')];if(!_0x523dbd[_0x7e3b('0x42')]['hasOwnProperty']('nolimit')){_0x1e0c31[_0x7e3b('0x33')]=qs[_0x7e3b('0x33')](_0x523dbd[_0x7e3b('0x42')]['limit']);_0x1e0c31[_0x7e3b('0x30')]=qs[_0x7e3b('0x30')](_0x523dbd['query'][_0x7e3b('0x30')]);}return _0x25acc9['getApplications'](_0x1e0c31);}})['then'](function(_0x56d360){if(_0x56d360){return _0x56d360?{'count':_0x659d65,'rows':_0x56d360}:null;}})[_0x7e3b('0x21')](respondWithResult(_0xfca596,null))['catch'](handleError(_0xfca596,null));};exports[_0x7e3b('0x81')]=function(_0x1abb57,_0x2a956,_0x2abd73){var _0x44ba57={'channel':'whatsapp'};var _0x48ebf0=[];var _0x30b92b=[];var _0x50e718={};return db[_0x7e3b('0x3e')][_0x7e3b('0x5a')]({'where':{'id':_0x1abb57['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':'Applications'}]})[_0x7e3b('0x21')](handleEntityNotFound(_0x2a956,null))[_0x7e3b('0x21')](function(_0x66e0f3){_0x44ba57[_0x7e3b('0x82')]=_0x66e0f3;_0x44ba57['applications']=_['orderBy'](_0x66e0f3[_0x7e3b('0x83')],[_0x7e3b('0x7f')],['asc']);if(_0x44ba57[_0x7e3b('0x82')]['Applications']){delete _0x44ba57[_0x7e3b('0x82')][_0x7e3b('0x83')];}return db[_0x7e3b('0x84')][_0x7e3b('0x64')]();})[_0x7e3b('0x21')](function(_0xf4a243){if(!_0xf4a243){throw new db[(_0x7e3b('0x85'))][(_0x7e3b('0x86'))](_0x7e3b('0x87'));}_0x48ebf0=_['difference'](_[_0x7e3b('0x59')](_0xf4a243),[_0x7e3b('0x88'),_0x7e3b('0x89')]);_0x30b92b=_['difference'](_[_0x7e3b('0x59')](_0xf4a243),[_0x7e3b('0x88'),'updatedAt',_0x7e3b('0x8a'),_0x7e3b('0x8b')]);_0x44ba57[_0x7e3b('0x63')]={'mapKey':_0x7e3b('0x8c')};if(_0x44ba57[_0x7e3b('0x82')]['type']&&_0x44ba57[_0x7e3b('0x82')][_0x7e3b('0x41')]===_0x7e3b('0x8d')){_0x44ba57[_0x7e3b('0x63')][_0x7e3b('0x8e')]=_0x1abb57[_0x7e3b('0x63')]['From'][_0x7e3b('0x8f')](_0x7e3b('0x90'),'');_0x44ba57[_0x7e3b('0x63')][_0x7e3b('0x63')]=_0x1abb57[_0x7e3b('0x63')][_0x7e3b('0x91')];_0x44ba57[_0x7e3b('0x63')][_0x7e3b('0x92')]=_0x1abb57[_0x7e3b('0x63')][_0x7e3b('0x93')];}if(_0x44ba57[_0x7e3b('0x63')]['id']){delete _0x44ba57[_0x7e3b('0x63')]['id'];}if(_['isNil'](_0x44ba57[_0x7e3b('0x63')][_0x7e3b('0x8e')])){throw new db['Sequelize'][(_0x7e3b('0x86'))]('from\x20is\x20mandatory');}if(_[_0x7e3b('0x94')](_0x44ba57['body'][_0x7e3b('0x63')])||_0x44ba57['body']['body']===''){throw new db[(_0x7e3b('0x85'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7e3b('0x94')](_0x44ba57[_0x7e3b('0x63')][_0x7e3b('0x95')])){throw new db[(_0x7e3b('0x85'))][(_0x7e3b('0x86'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x30b92b);}if(!_['includes'](_0x30b92b,_0x44ba57[_0x7e3b('0x63')][_0x7e3b('0x95')])){throw new db['Sequelize'][(_0x7e3b('0x86'))](_0x7e3b('0x96')+_0x30b92b);}_0x50e718[_0x44ba57[_0x7e3b('0x63')]['mapKey']]=_0x44ba57[_0x7e3b('0x63')]['from'];return db[_0x7e3b('0x97')][_0x7e3b('0x5a')]({'where':{'id':_0x44ba57[_0x7e3b('0x82')][_0x7e3b('0x8b')]},'include':[{'model':db[_0x7e3b('0x84')],'as':_0x7e3b('0x98'),'where':_0x50e718,'limit':0x1,'order':[[_0x7e3b('0x89'),_0x7e3b('0x99')]]}]});})[_0x7e3b('0x21')](handleEntityNotFound(_0x2a956,null))['then'](function(_0x1913b0){if(_0x1913b0){_0x44ba57[_0x7e3b('0x9a')]=_[_0x7e3b('0x72')](_0x1913b0,[_0x7e3b('0x98')]);if(_0x1913b0[_0x7e3b('0x98')][_0x7e3b('0x48')]){return _0x1913b0[_0x7e3b('0x98')][0x0];}var _0x15ebf3=_[_0x7e3b('0x19')](_0x44ba57[_0x7e3b('0x63')],{'firstName':_0x44ba57[_0x7e3b('0x63')][_0x7e3b('0x8e')],'ListId':_0x1913b0['id']});_0x15ebf3[_0x44ba57[_0x7e3b('0x63')][_0x7e3b('0x95')]]=_0x44ba57[_0x7e3b('0x63')]['from'];return db['CmContact']['create'](_0x15ebf3,{'fields':_0x48ebf0,'raw':!![]});}})[_0x7e3b('0x21')](handleEntityNotFound(_0x2a956,null))[_0x7e3b('0x21')](function(_0x11d173){if(_0x11d173){_0x44ba57[_0x7e3b('0x9b')]=_0x11d173;var _0x75eb00={'ContactId':_0x11d173['id'],'phone':_0x44ba57[_0x7e3b('0x63')]['from'],'WhatsappAccountId':_0x1abb57[_0x7e3b('0x57')]['id']};var _0x2c9317={'ContactId':_0x11d173['id'],'WhatsappAccountId':_0x1abb57[_0x7e3b('0x57')]['id'],'closed':![]};return db[_0x7e3b('0x9c')][_0x7e3b('0x5a')]({'where':_0x2c9317})[_0x7e3b('0x21')](function(_0x178667){if(_0x178667){return[_0x178667,![]];}return db[_0x7e3b('0x9c')][_0x7e3b('0x5b')](_0x75eb00)[_0x7e3b('0x21')](function(_0x1bb698){return[_0x1bb698,!![]];});});}})[_0x7e3b('0x73')](function(_0x2c29ac,_0x53fd85){_0x44ba57[_0x7e3b('0x9d')]=_0x2c29ac['get']({'plain':!![]});_0x44ba57[_0x7e3b('0x9d')][_0x7e3b('0x9e')]=![];if(_0x53fd85){if(_0x44ba57[_0x7e3b('0x82')][_0x7e3b('0x9f')]){_0x44ba57[_0x7e3b('0xa0')][_0x7e3b('0xa1')]({'id':0x0,'priority':_0x44ba57[_0x7e3b('0xa0')][_0x7e3b('0x48')]+0x1,'app':_0x7e3b('0xa2'),'appdata':_0x7e3b('0xa3'),'interval':'*,*,*,*'});}_0x44ba57[_0x7e3b('0x9d')][_0x7e3b('0x9e')]=!![];}return db[_0x7e3b('0xa4')]['create']({'phone':_0x44ba57[_0x7e3b('0x63')][_0x7e3b('0x8e')],'messageId':_0x44ba57[_0x7e3b('0x63')][_0x7e3b('0x92')],'body':_0x44ba57[_0x7e3b('0x63')][_0x7e3b('0x63')],'WhatsappAccountId':_0x1abb57[_0x7e3b('0x57')]['id'],'WhatsappInteractionId':_0x2c29ac['id'],'direction':'in','ContactId':_0x2c29ac['ContactId'],'AttachmentId':_0x44ba57[_0x7e3b('0x63')][_0x7e3b('0xa5')]});})[_0x7e3b('0x21')](function(_0x3592ae){_0x44ba57[_0x7e3b('0x29')]=_0x3592ae;if(_0x44ba57[_0x7e3b('0x9d')]['UserId']){return db['User']['find']({'attributes':['id',_0x7e3b('0x3a')],'where':{'id':_0x44ba57[_0x7e3b('0x9d')][_0x7e3b('0xa6')]}})[_0x7e3b('0x21')](function(_0x4d069f){if(_0x4d069f){_0x44ba57[_0x7e3b('0xa0')][_0x7e3b('0xa7')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4d069f['name']+','+(_0x44ba57['account'][_0x7e3b('0xa8')]||0xa),'interval':_0x7e3b('0xa9')});}return respondWithRpcPromise(_0x7e3b('0xaa'),_0x7e3b('0xab'),_0x44ba57);});}return respondWithRpcPromise(_0x7e3b('0xaa'),_0x7e3b('0xab'),_0x44ba57);})[_0x7e3b('0x21')](function(_0x4d1361){if(_0x4d1361){var _0x3de5c6=0xc8;var _0x3c7c45='receiveMessage';logger[_0x7e3b('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x3c7c45,_0x3de5c6,'entity\x20found');logger['debug'](_0x7e3b('0xac'),_0x3c7c45,_0x3de5c6,_0x7e3b('0xad'),JSON[_0x7e3b('0x27')](_0x4d1361));if(_0x44ba57[_0x7e3b('0x82')][_0x7e3b('0x41')]==='twilio'){return _0x2a956[_0x7e3b('0x2e')](_0x3de5c6)[_0x7e3b('0xae')](_0x7e3b('0xaf'),_0x7e3b('0xb0'))[_0x7e3b('0x3b')](_0x7e3b('0xb1'));}else{return _0x2a956[_0x7e3b('0x2e')](_0x3de5c6)[_0x7e3b('0x2f')](_0x4d1361);}}})[_0x7e3b('0x2b')](handleError(_0x2a956,null));};exports['send']=function(_0x1a778c,_0x266900,_0x6dbdbb){var _0x9505b0,_0x2869f5,_0x18a26a;if(_[_0x7e3b('0x94')](_0x1a778c[_0x7e3b('0x63')][_0x7e3b('0x63')])||_0x1a778c[_0x7e3b('0x63')][_0x7e3b('0x63')]===''){throw new db[(_0x7e3b('0x85'))][(_0x7e3b('0x86'))](_0x7e3b('0xb2'));}if(_['isNil'](_0x1a778c[_0x7e3b('0x63')]['to'])){throw new db[(_0x7e3b('0x85'))][(_0x7e3b('0x86'))]('to\x20is\x20mandatory');}_0x9505b0=_0x1a778c[_0x7e3b('0x63')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x1a778c[_0x7e3b('0x57')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7e3b('0x84')],'as':'Contacts','where':{'mobile':_0x9505b0},'limit':0x1,'order':[[_0x7e3b('0x89'),_0x7e3b('0x99')]]}]}]})[_0x7e3b('0x21')](handleEntityNotFound(_0x266900,null))[_0x7e3b('0x21')](function(_0x12c094){if(_0x12c094&&_0x12c094[_0x7e3b('0xb3')]){_0x2869f5=_0x12c094[_0x7e3b('0x37')]({'plain':!![]});if(_0x2869f5['List']&&_0x2869f5[_0x7e3b('0xb3')][_0x7e3b('0x98')]['length']){return _0x2869f5['List'][_0x7e3b('0x98')][0x0];}return db['CmContact'][_0x7e3b('0x5b')](_[_0x7e3b('0x19')](_0x1a778c['body'],{'firstName':_0x9505b0,'mobile':_0x9505b0,'phone':_0x9505b0,'ListId':_0x2869f5[_0x7e3b('0x8b')]}));}})[_0x7e3b('0x21')](handleEntityNotFound(_0x266900,null))[_0x7e3b('0x21')](function(_0x6f15d2){if(_0x6f15d2){_0x18a26a=_0x6f15d2;return db[_0x7e3b('0x9c')][_0x7e3b('0x5a')]({'where':{'ContactId':_0x18a26a['id'],'closed':![],'WhatsappAccountId':_0x2869f5['id']}})[_0x7e3b('0x21')](function(_0x1da6d5){if(_0x1da6d5){return[_0x1da6d5,![]];}return db[_0x7e3b('0x9c')][_0x7e3b('0x5b')]({'UserId':_0x1a778c[_0x7e3b('0x5c')]['id'],'ContactId':_0x18a26a['id'],'WhatsappAccountId':_0x2869f5['id'],'phone':_0x9505b0,'firstMsgDirection':_0x7e3b('0xb4'),'Messages':[_[_0x7e3b('0x51')](_0x1a778c[_0x7e3b('0x63')],{'read':![],'body':_0x1a778c[_0x7e3b('0x63')]['body'],'phone':_0x9505b0,'WhatsappAccountId':_0x2869f5['id'],'UserId':_0x1a778c[_0x7e3b('0x5c')]['id'],'ContactId':_0x18a26a['id']})]},{'include':[{'model':db[_0x7e3b('0xa4')],'as':'Messages'}]})['then'](function(_0x26183f){return[_0x26183f,!![]];});});}})[_0x7e3b('0x73')](function(_0x35022d,_0x49d126){if(_0x49d126){return _0x35022d;}return db[_0x7e3b('0xa4')][_0x7e3b('0x5b')](_[_0x7e3b('0x51')](_0x1a778c[_0x7e3b('0x63')],{'read':![],'body':_0x1a778c[_0x7e3b('0x63')][_0x7e3b('0x63')],'phone':_0x9505b0,'WhatsappAccountId':_0x2869f5['id'],'WhatsappInteractionId':_0x35022d['id'],'UserId':_0x1a778c['user']['id'],'ContactId':_0x18a26a['id']}))[_0x7e3b('0x21')](function(_0x2d5ff0){_0x35022d[_0x7e3b('0xb5')][_0x7e3b('0xb6')]=[];_0x35022d[_0x7e3b('0xb5')][_0x7e3b('0xb6')][_0x7e3b('0xa1')](_0x2d5ff0[_0x7e3b('0xb5')]);return _0x35022d;});})[_0x7e3b('0x21')](respondWithResult(_0x266900,null))[_0x7e3b('0x2b')](handleError(_0x266900,null));}; \ No newline at end of file +var _0x71a0=['query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','filters','filter','where','merge','includeAll','findAll','rows','catch','show','params','Pause','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','WhatsappApplication','bulkCreate','priority','getApplications','whatsapp','account','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','from','From','replace','messageId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','defaults','contact','WhatsappInteraction','created','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','interaction','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','DESC','ListId','out','Messages','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappAccount,\x20%s,\x20%s','info','result','sendStatus','end','status','json','undefined','limit','count','set','apply','save','update','then','get','WhatsappAccounts','UserProfileResource','destroy','stack','name','send','index','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','model','map'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x71a0,0x74));var _0x071a=function(_0x3afd6a,_0x184a89){_0x3afd6a=_0x3afd6a-0x0;var _0x25ee28=_0x71a0[_0x3afd6a];return _0x25ee28;};'use strict';var emlformat=require(_0x071a('0x0'));var rimraf=require(_0x071a('0x1'));var zipdir=require(_0x071a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x071a('0x3'));var moment=require(_0x071a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x071a('0x5'));var util=require(_0x071a('0x6'));var path=require(_0x071a('0x7'));var sox=require(_0x071a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x071a('0x9'));var _=require(_0x071a('0xa'));var squel=require(_0x071a('0xb'));var crypto=require(_0x071a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x071a('0xd'));var toCsv=require(_0x071a('0xe'));var querystring=require(_0x071a('0xf'));var Papa=require(_0x071a('0x10'));var Redis=require(_0x071a('0x11'));var authService=require(_0x071a('0x12'));var qs=require(_0x071a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x071a('0x14'));var logger=require(_0x071a('0x15'))('api');var utils=require(_0x071a('0x16'));var config=require(_0x071a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x071a('0x18'))['db'];config['redis']=_['defaults'](config[_0x071a('0x19')],{'host':_0x071a('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x071a('0x19')]));require(_0x071a('0x1b'))[_0x071a('0x1c')](socket);var jayson=require(_0x071a('0x1d'));var client=jayson[_0x071a('0x1e')][_0x071a('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x1e0cec,_0x9ecb2b,_0x1ca15a,_0x2c16b0){return new BPromise(function(_0x29ccfd,_0x546138){var _0x21bad3=_0x2c16b0||client;return _0x21bad3['request'](_0x1e0cec,_0x1ca15a)['then'](function(_0x2ff830){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x9ecb2b,_0x071a('0x20'));logger[_0x071a('0x21')](_0x071a('0x22'),_0x9ecb2b,'request\x20sent',JSON[_0x071a('0x23')](_0x2ff830));if(_0x2ff830['error']){if(_0x2ff830[_0x071a('0x24')]['code']===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x9ecb2b,_0x2ff830['error'][_0x071a('0x25')]);return _0x546138(_0x2ff830[_0x071a('0x24')][_0x071a('0x25')]);}logger[_0x071a('0x24')](_0x071a('0x26'),_0x9ecb2b,_0x2ff830[_0x071a('0x24')][_0x071a('0x25')]);return _0x29ccfd(_0x2ff830['error'][_0x071a('0x25')]);}else{logger[_0x071a('0x27')](_0x071a('0x26'),_0x9ecb2b,'request\x20sent');_0x29ccfd(_0x2ff830[_0x071a('0x28')][_0x071a('0x25')]);}})['catch'](function(_0x1fc100){logger['error'](_0x071a('0x26'),_0x9ecb2b,_0x1fc100);_0x546138(_0x1fc100);});});}function respondWithStatusCode(_0x5bfacd,_0x987234){_0x987234=_0x987234||0xcc;return function(_0x1b0a77){if(_0x1b0a77){return _0x5bfacd[_0x071a('0x29')](_0x987234);}return _0x5bfacd['status'](_0x987234)[_0x071a('0x2a')]();};}function respondWithResult(_0xa34c8c,_0x385785){_0x385785=_0x385785||0xc8;return function(_0x15d411){if(_0x15d411){return _0xa34c8c[_0x071a('0x2b')](_0x385785)[_0x071a('0x2c')](_0x15d411);}};}function respondWithFilteredResult(_0x4137a6,_0x297b69){return function(_0x112cd5){if(_0x112cd5){var _0x41492d=typeof _0x297b69['offset']===_0x071a('0x2d')&&typeof _0x297b69[_0x071a('0x2e')]===_0x071a('0x2d');var _0x15e841=_0x112cd5[_0x071a('0x2f')];var _0x2b725d=_0x41492d?0x0:_0x297b69['offset'];var _0x48e1c8=_0x41492d?_0x112cd5['count']:_0x297b69['offset']+_0x297b69[_0x071a('0x2e')];var _0xbc6445;if(_0x48e1c8>=_0x15e841){_0x48e1c8=_0x15e841;_0xbc6445=0xc8;}else{_0xbc6445=0xce;}_0x4137a6[_0x071a('0x2b')](_0xbc6445);return _0x4137a6[_0x071a('0x30')]('Content-Range',_0x2b725d+'-'+_0x48e1c8+'/'+_0x15e841)[_0x071a('0x2c')](_0x112cd5);}return null;};}function patchUpdates(_0x775fb4){return function(_0x534d98){try{jsonpatch[_0x071a('0x31')](_0x534d98,_0x775fb4,!![]);}catch(_0x2efadb){return BPromise['reject'](_0x2efadb);}return _0x534d98[_0x071a('0x32')]();};}function saveUpdates(_0x35fecd,_0x58086a){return function(_0x5641e0){if(_0x5641e0){return _0x5641e0[_0x071a('0x33')](_0x35fecd)[_0x071a('0x34')](function(_0xed5c2c){return _0xed5c2c;});}return null;};}function removeEntity(_0xa5bd91,_0x2a9164){return function(_0xce3dc9){if(_0xce3dc9){return _0xce3dc9['destroy']()['then'](function(){var _0x2b135f=_0xce3dc9[_0x071a('0x35')]({'plain':!![]});var _0x4f56c0=_0x071a('0x36');return db[_0x071a('0x37')][_0x071a('0x38')]({'where':{'type':_0x4f56c0,'resourceId':_0x2b135f['id']}})[_0x071a('0x34')](function(){return _0xce3dc9;});})[_0x071a('0x34')](function(){_0xa5bd91['status'](0xcc)[_0x071a('0x2a')]();});}};}function handleEntityNotFound(_0x4fd639,_0x50f050){return function(_0x4f6ade){if(!_0x4f6ade){_0x4fd639[_0x071a('0x29')](0x194);}return _0x4f6ade;};}function handleError(_0xdb5e57,_0x1e2e98){_0x1e2e98=_0x1e2e98||0x1f4;return function(_0x4f22b3){logger['error'](_0x4f22b3[_0x071a('0x39')]);if(_0x4f22b3['name']){delete _0x4f22b3[_0x071a('0x3a')];}_0xdb5e57[_0x071a('0x2b')](_0x1e2e98)[_0x071a('0x3b')](_0x4f22b3);};}exports[_0x071a('0x3c')]=function(_0x4ff453,_0x36d37d){var _0x175cd8={'include':[{'model':db['Pause'],'as':_0x071a('0x3d')}]},_0x401c74={},_0xade50f={'count':0x0,'rows':[]};var _0x384b8e=_['map'](db[_0x071a('0x3e')][_0x071a('0x3f')],function(_0x5c8a4f){return{'name':_0x5c8a4f[_0x071a('0x40')],'type':_0x5c8a4f[_0x071a('0x41')]['key']};});_0x401c74[_0x071a('0x42')]=_[_0x071a('0x43')](_0x384b8e,'name');_0x401c74[_0x071a('0x44')]=_[_0x071a('0x45')](_0x4ff453[_0x071a('0x44')]);_0x401c74['filters']=_[_0x071a('0x46')](_0x401c74['model'],_0x401c74['query']);_0x175cd8[_0x071a('0x47')]=_['intersection'](_0x401c74[_0x071a('0x42')],qs['fields'](_0x4ff453['query'][_0x071a('0x48')]));_0x175cd8[_0x071a('0x47')]=_0x175cd8[_0x071a('0x47')]['length']?_0x175cd8[_0x071a('0x47')]:_0x401c74[_0x071a('0x42')];if(!_0x4ff453[_0x071a('0x44')][_0x071a('0x49')](_0x071a('0x4a'))){_0x175cd8[_0x071a('0x2e')]=qs['limit'](_0x4ff453[_0x071a('0x44')]['limit']);_0x175cd8[_0x071a('0x4b')]=qs[_0x071a('0x4b')](_0x4ff453['query'][_0x071a('0x4b')]);}_0x175cd8['order']=qs[_0x071a('0x4c')](_0x4ff453[_0x071a('0x44')][_0x071a('0x4c')]);_0x175cd8['where']=qs[_0x071a('0x4d')](_['pick'](_0x4ff453[_0x071a('0x44')],_0x401c74['filters']),_0x384b8e);if(_0x4ff453[_0x071a('0x44')][_0x071a('0x4e')]){_0x175cd8[_0x071a('0x4f')]=_[_0x071a('0x50')](_0x175cd8[_0x071a('0x4f')],{'$or':_[_0x071a('0x43')](_0x384b8e,function(_0x106614){if(_0x106614[_0x071a('0x41')]!=='VIRTUAL'){var _0x12115d={};_0x12115d[_0x106614[_0x071a('0x3a')]]={'$like':'%'+_0x4ff453[_0x071a('0x44')][_0x071a('0x4e')]+'%'};return _0x12115d;}})});}_0x175cd8=_[_0x071a('0x50')]({},_0x175cd8,_0x4ff453['options']);var _0x456350={'where':_0x175cd8[_0x071a('0x4f')]};return db[_0x071a('0x3e')]['count'](_0x456350)['then'](function(_0x289a60){_0xade50f['count']=_0x289a60;if(_0x4ff453[_0x071a('0x44')][_0x071a('0x51')]){_0x175cd8['include']=[{'all':!![]}];}return db[_0x071a('0x3e')][_0x071a('0x52')](_0x175cd8);})[_0x071a('0x34')](function(_0x5510fc){_0xade50f[_0x071a('0x53')]=_0x5510fc;return _0xade50f;})[_0x071a('0x34')](respondWithFilteredResult(_0x36d37d,_0x175cd8))[_0x071a('0x54')](handleError(_0x36d37d,null));};exports[_0x071a('0x55')]=function(_0x41cdc5,_0x2968c5){var _0x45dd9a={'raw':![],'where':{'id':_0x41cdc5[_0x071a('0x56')]['id']},'include':[{'model':db[_0x071a('0x57')],'as':'mandatoryDispositionPause'}]},_0x583aca={};_0x583aca[_0x071a('0x42')]=_[_0x071a('0x45')](db[_0x071a('0x3e')][_0x071a('0x3f')]);_0x583aca['query']=_[_0x071a('0x45')](_0x41cdc5[_0x071a('0x44')]);_0x583aca[_0x071a('0x4d')]=_[_0x071a('0x46')](_0x583aca[_0x071a('0x42')],_0x583aca[_0x071a('0x44')]);_0x45dd9a[_0x071a('0x47')]=_[_0x071a('0x46')](_0x583aca['model'],qs[_0x071a('0x48')](_0x41cdc5[_0x071a('0x44')][_0x071a('0x48')]));_0x45dd9a[_0x071a('0x47')]=_0x45dd9a['attributes'][_0x071a('0x58')]?_0x45dd9a[_0x071a('0x47')]:_0x583aca['model'];if(_0x41cdc5[_0x071a('0x44')]['includeAll']){_0x45dd9a[_0x071a('0x59')]=[{'all':!![]}];}_0x45dd9a=_[_0x071a('0x50')]({},_0x45dd9a,_0x41cdc5[_0x071a('0x5a')]);return db['WhatsappAccount'][_0x071a('0x5b')](_0x45dd9a)[_0x071a('0x34')](handleEntityNotFound(_0x2968c5,null))[_0x071a('0x34')](respondWithResult(_0x2968c5,null))['catch'](handleError(_0x2968c5,null));};exports[_0x071a('0x5c')]=function(_0xaad712,_0x496deb){return db[_0x071a('0x3e')][_0x071a('0x5c')](_0xaad712[_0x071a('0x5d')],{})[_0x071a('0x34')](function(_0x5a2900){var _0x288eb1=_0xaad712[_0x071a('0x5e')][_0x071a('0x35')]({'plain':!![]});if(!_0x288eb1)throw new Error(_0x071a('0x5f'));if(_0x288eb1['role']===_0x071a('0x5e')){var _0x2f357e=_0x5a2900['get']({'plain':!![]});var _0x126f33=_0x071a('0x36');return db[_0x071a('0x60')]['find']({'where':{'name':_0x126f33,'userProfileId':_0x288eb1[_0x071a('0x61')]},'raw':!![]})[_0x071a('0x34')](function(_0x55a6c4){if(_0x55a6c4&&_0x55a6c4[_0x071a('0x62')]===0x0){return db[_0x071a('0x37')][_0x071a('0x5c')]({'name':_0x2f357e['name'],'resourceId':_0x2f357e['id'],'type':_0x55a6c4['name'],'sectionId':_0x55a6c4['id']},{})[_0x071a('0x34')](function(){return _0x5a2900;});}else{return _0x5a2900;}})['catch'](function(_0x10cf4f){logger[_0x071a('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10cf4f);throw _0x10cf4f;});}return _0x5a2900;})[_0x071a('0x34')](respondWithResult(_0x496deb,0xc9))[_0x071a('0x54')](handleError(_0x496deb,null));};exports[_0x071a('0x33')]=function(_0x46180d,_0x439ed7){if(_0x46180d['body']['id']){delete _0x46180d[_0x071a('0x5d')]['id'];}return db[_0x071a('0x3e')][_0x071a('0x5b')]({'where':{'id':_0x46180d['params']['id']},'include':[{'model':db[_0x071a('0x57')],'as':_0x071a('0x3d')}]})[_0x071a('0x34')](handleEntityNotFound(_0x439ed7,null))[_0x071a('0x34')](saveUpdates(_0x46180d[_0x071a('0x5d')],null))[_0x071a('0x34')](respondWithResult(_0x439ed7,null))[_0x071a('0x54')](handleError(_0x439ed7,null));};exports[_0x071a('0x38')]=function(_0x271ceb,_0x5bc2a7){return db[_0x071a('0x3e')][_0x071a('0x5b')]({'where':{'id':_0x271ceb['params']['id']}})[_0x071a('0x34')](handleEntityNotFound(_0x5bc2a7,null))['then'](removeEntity(_0x5bc2a7,null))['catch'](handleError(_0x5bc2a7,null));};exports[_0x071a('0x63')]=function(_0x2d134d,_0x5ed21e){return db[_0x071a('0x3e')][_0x071a('0x63')]()[_0x071a('0x34')](respondWithResult(_0x5ed21e,null))['catch'](handleError(_0x5ed21e,null));};exports[_0x071a('0x64')]=function(_0x32e3af,_0x39c2d0,_0x318f8d){if(_0x32e3af['body']['id']){delete _0x32e3af[_0x071a('0x5d')]['id'];}return db[_0x071a('0x3e')][_0x071a('0x5b')]({'where':{'id':_0x32e3af[_0x071a('0x56')]['id']}})[_0x071a('0x34')](handleEntityNotFound(_0x39c2d0,null))['then'](function(_0x3a60c7){if(_0x3a60c7){_0x32e3af['body'][_0x071a('0x65')]=_0x3a60c7['id'];return db['Disposition'][_0x071a('0x5c')](_0x32e3af[_0x071a('0x5d')]);}})[_0x071a('0x34')](respondWithResult(_0x39c2d0,null))[_0x071a('0x54')](handleError(_0x39c2d0,null));};exports[_0x071a('0x66')]=function(_0x313a26,_0x11628e,_0x33ddac){var _0x32e127={'raw':![],'where':{}};var _0x252450={};var _0x2e6520={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x071a('0x67')]({'where':{'id':_0x313a26[_0x071a('0x56')]['id']}})[_0x071a('0x34')](handleEntityNotFound(_0x11628e,null))['then'](function(_0x50cae5){if(_0x50cae5){_0x252450[_0x071a('0x42')]=_[_0x071a('0x45')](db[_0x071a('0x68')][_0x071a('0x3f')]);_0x252450[_0x071a('0x44')]=_[_0x071a('0x45')](_0x313a26[_0x071a('0x44')]);_0x252450[_0x071a('0x4d')]=_['intersection'](_0x252450['model'],_0x252450[_0x071a('0x44')]);_0x32e127[_0x071a('0x47')]=_[_0x071a('0x46')](_0x252450[_0x071a('0x42')],qs[_0x071a('0x48')](_0x313a26[_0x071a('0x44')][_0x071a('0x48')]));_0x32e127[_0x071a('0x47')]=_0x32e127[_0x071a('0x47')][_0x071a('0x58')]?_0x32e127['attributes']:_0x252450[_0x071a('0x42')];if(!_0x313a26[_0x071a('0x44')]['hasOwnProperty'](_0x071a('0x4a'))){_0x32e127[_0x071a('0x2e')]=qs['limit'](_0x313a26['query'][_0x071a('0x2e')]);_0x32e127['offset']=qs[_0x071a('0x4b')](_0x313a26[_0x071a('0x44')][_0x071a('0x4b')]);}_0x32e127[_0x071a('0x69')]=qs[_0x071a('0x4c')](_0x313a26[_0x071a('0x44')]['sort']);_0x32e127['where']=qs[_0x071a('0x4d')](_[_0x071a('0x6a')](_0x313a26['query'],_0x252450[_0x071a('0x4d')]));_0x32e127[_0x071a('0x4f')][_0x071a('0x65')]=_0x50cae5['id'];if(_0x313a26[_0x071a('0x44')][_0x071a('0x4e')]){_0x32e127[_0x071a('0x4f')]=_[_0x071a('0x50')](_0x32e127[_0x071a('0x4f')],{'$or':_[_0x071a('0x43')](_0x32e127[_0x071a('0x47')],function(_0x173f74){var _0x12d9e1={};_0x12d9e1[_0x173f74]={'$like':'%'+_0x313a26['query'][_0x071a('0x4e')]+'%'};return _0x12d9e1;})});}_0x32e127=_['merge']({},_0x32e127,_0x313a26[_0x071a('0x5a')]);return db[_0x071a('0x68')]['count']({'where':_0x32e127[_0x071a('0x4f')]})['then'](function(_0x3a9f0d){_0x2e6520[_0x071a('0x2f')]=_0x3a9f0d;if(_0x313a26['query'][_0x071a('0x51')]){_0x32e127[_0x071a('0x59')]=[{'all':!![]}];}return db[_0x071a('0x68')][_0x071a('0x52')](_0x32e127);})[_0x071a('0x34')](function(_0x2ae786){_0x2e6520['rows']=_0x2ae786;return _0x2e6520;});}})[_0x071a('0x34')](respondWithFilteredResult(_0x11628e,_0x32e127))[_0x071a('0x54')](handleError(_0x11628e,null));};exports[_0x071a('0x6b')]=function(_0x52b842,_0x3a9478,_0x545e83){return db['WhatsappAccount'][_0x071a('0x5b')]({'where':{'id':_0x52b842[_0x071a('0x56')]['id']}})['then'](handleEntityNotFound(_0x3a9478,null))[_0x071a('0x34')](function(_0x30c9a7){if(_0x30c9a7){return _0x30c9a7['removeDispositions'](_0x52b842[_0x071a('0x44')][_0x071a('0x6c')]);}})[_0x071a('0x34')](respondWithStatusCode(_0x3a9478,null))[_0x071a('0x54')](handleError(_0x3a9478,null));};exports[_0x071a('0x6d')]=function(_0x506425,_0x4387b0,_0x1d61d3){if(_0x506425[_0x071a('0x5d')]['id']){delete _0x506425[_0x071a('0x5d')]['id'];}return db[_0x071a('0x3e')]['find']({'where':{'id':_0x506425[_0x071a('0x56')]['id']}})['then'](handleEntityNotFound(_0x4387b0,null))['then'](function(_0x315db7){if(_0x315db7){_0x506425[_0x071a('0x5d')]['WhatsappAccountId']=_0x315db7['id'];return db[_0x071a('0x6e')][_0x071a('0x5c')](_0x506425[_0x071a('0x5d')]);}})[_0x071a('0x34')](respondWithResult(_0x4387b0,null))['catch'](handleError(_0x4387b0,null));};exports['getAnswers']=function(_0x3dd9e9,_0x1acf2c,_0x298fc8){var _0x473be1={'raw':![],'where':{}};var _0x5ce939={};var _0x188c70={'count':0x0,'rows':[]};return db[_0x071a('0x3e')][_0x071a('0x67')]({'where':{'id':_0x3dd9e9[_0x071a('0x56')]['id']}})[_0x071a('0x34')](handleEntityNotFound(_0x1acf2c,null))[_0x071a('0x34')](function(_0x4de295){if(_0x4de295){_0x5ce939[_0x071a('0x42')]=_[_0x071a('0x45')](db[_0x071a('0x6e')][_0x071a('0x3f')]);_0x5ce939[_0x071a('0x44')]=_[_0x071a('0x45')](_0x3dd9e9[_0x071a('0x44')]);_0x5ce939[_0x071a('0x4d')]=_[_0x071a('0x46')](_0x5ce939[_0x071a('0x42')],_0x5ce939[_0x071a('0x44')]);_0x473be1[_0x071a('0x47')]=_[_0x071a('0x46')](_0x5ce939[_0x071a('0x42')],qs[_0x071a('0x48')](_0x3dd9e9[_0x071a('0x44')][_0x071a('0x48')]));_0x473be1[_0x071a('0x47')]=_0x473be1['attributes']['length']?_0x473be1[_0x071a('0x47')]:_0x5ce939['model'];if(!_0x3dd9e9[_0x071a('0x44')][_0x071a('0x49')](_0x071a('0x4a'))){_0x473be1[_0x071a('0x2e')]=qs[_0x071a('0x2e')](_0x3dd9e9[_0x071a('0x44')][_0x071a('0x2e')]);_0x473be1[_0x071a('0x4b')]=qs[_0x071a('0x4b')](_0x3dd9e9[_0x071a('0x44')][_0x071a('0x4b')]);}_0x473be1[_0x071a('0x69')]=qs[_0x071a('0x4c')](_0x3dd9e9[_0x071a('0x44')][_0x071a('0x4c')]);_0x473be1[_0x071a('0x4f')]=qs['filters'](_[_0x071a('0x6a')](_0x3dd9e9[_0x071a('0x44')],_0x5ce939[_0x071a('0x4d')]));_0x473be1['where'][_0x071a('0x65')]=_0x4de295['id'];if(_0x3dd9e9[_0x071a('0x44')][_0x071a('0x4e')]){_0x473be1['where']=_[_0x071a('0x50')](_0x473be1[_0x071a('0x4f')],{'$or':_[_0x071a('0x43')](_0x473be1[_0x071a('0x47')],function(_0xd5d55f){var _0x5d3711={};_0x5d3711[_0xd5d55f]={'$like':'%'+_0x3dd9e9[_0x071a('0x44')][_0x071a('0x4e')]+'%'};return _0x5d3711;})});}_0x473be1=_[_0x071a('0x50')]({},_0x473be1,_0x3dd9e9[_0x071a('0x5a')]);return db[_0x071a('0x6e')][_0x071a('0x2f')]({'where':_0x473be1['where']})[_0x071a('0x34')](function(_0x1c39c7){_0x188c70[_0x071a('0x2f')]=_0x1c39c7;if(_0x3dd9e9[_0x071a('0x44')][_0x071a('0x51')]){_0x473be1['include']=[{'all':!![]}];}return db[_0x071a('0x6e')][_0x071a('0x52')](_0x473be1);})['then'](function(_0x76e17a){_0x188c70[_0x071a('0x53')]=_0x76e17a;return _0x188c70;});}})['then'](respondWithFilteredResult(_0x1acf2c,_0x473be1))[_0x071a('0x54')](handleError(_0x1acf2c,null));};exports[_0x071a('0x6f')]=function(_0x410a49,_0x42ad04,_0x2c4b69){return db[_0x071a('0x3e')]['find']({'where':{'id':_0x410a49[_0x071a('0x56')]['id']}})[_0x071a('0x34')](handleEntityNotFound(_0x42ad04,null))[_0x071a('0x34')](function(_0x121b4a){if(_0x121b4a){return _0x121b4a['removeAnswers'](_0x410a49[_0x071a('0x44')][_0x071a('0x6c')]);}})[_0x071a('0x34')](respondWithStatusCode(_0x42ad04,null))[_0x071a('0x54')](handleError(_0x42ad04,null));};exports[_0x071a('0x70')]=function(_0x2d3619,_0x307b40,_0x878738){return db[_0x071a('0x3e')][_0x071a('0x5b')]({'where':{'id':_0x2d3619['params']['id']}})[_0x071a('0x34')](handleEntityNotFound(_0x307b40,null))['then'](function(_0x1a91ac){if(_0x1a91ac){return _0x1a91ac[_0x071a('0x70')](_0x2d3619[_0x071a('0x5d')][_0x071a('0x6c')],_[_0x071a('0x71')](_0x2d3619[_0x071a('0x5d')],[_0x071a('0x6c'),'id'])||{})[_0x071a('0x72')](function(_0x49b364){for(var _0x417147=0x0;_0x417147<_0x2d3619['body'][_0x071a('0x6c')][_0x071a('0x58')];_0x417147+=0x1){socket[_0x071a('0x73')]('userWhatsappAccount:save',{'UserId':Number(_0x2d3619[_0x071a('0x5d')]['ids'][_0x417147]),'WhatsappAccountId':Number(_0x2d3619[_0x071a('0x56')]['id'])});}return _0x49b364;});}})[_0x071a('0x34')](respondWithResult(_0x307b40,null))['catch'](handleError(_0x307b40,null));};exports['removeAgents']=function(_0x56b24e,_0x31cda7,_0x43f1a3){return db['WhatsappAccount'][_0x071a('0x5b')]({'where':{'id':_0x56b24e['params']['id']}})[_0x071a('0x34')](handleEntityNotFound(_0x31cda7,null))['then'](function(_0x4e7184){if(_0x4e7184){return _0x4e7184[_0x071a('0x74')](_0x56b24e[_0x071a('0x44')][_0x071a('0x6c')])[_0x071a('0x34')](function(){if(_[_0x071a('0x75')](_0x56b24e[_0x071a('0x44')][_0x071a('0x6c')])){for(var _0x5eb26a=0x0;_0x5eb26a<_0x56b24e[_0x071a('0x44')][_0x071a('0x6c')][_0x071a('0x58')];_0x5eb26a+=0x1){socket[_0x071a('0x73')](_0x071a('0x76'),{'UserId':Number(_0x56b24e[_0x071a('0x44')][_0x071a('0x6c')][_0x5eb26a]),'WhatsappAccountId':Number(_0x56b24e[_0x071a('0x56')]['id'])});}}else{socket[_0x071a('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x56b24e[_0x071a('0x44')][_0x071a('0x6c')]),'WhatsappAccountId':Number(_0x56b24e[_0x071a('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x31cda7,null))[_0x071a('0x54')](handleError(_0x31cda7,null));};exports[_0x071a('0x77')]=function(_0x23edef,_0x37e3b1,_0x422fae){var _0x3be529={};var _0x867d87={};var _0x1f5abb;var _0x22ff10;return db['WhatsappAccount'][_0x071a('0x67')]({'where':{'id':_0x23edef[_0x071a('0x56')]['id']}})[_0x071a('0x34')](handleEntityNotFound(_0x37e3b1,null))[_0x071a('0x34')](function(_0x4edc02){if(_0x4edc02){_0x1f5abb=_0x4edc02;_0x867d87[_0x071a('0x42')]=_[_0x071a('0x45')](db[_0x071a('0x78')][_0x071a('0x3f')]);_0x867d87[_0x071a('0x44')]=_['keys'](_0x23edef['query']);_0x867d87[_0x071a('0x4d')]=_['intersection'](_0x867d87['model'],_0x867d87[_0x071a('0x44')]);_0x3be529[_0x071a('0x47')]=_[_0x071a('0x46')](_0x867d87[_0x071a('0x42')],qs[_0x071a('0x48')](_0x23edef[_0x071a('0x44')]['fields']));_0x3be529[_0x071a('0x47')]=_0x3be529[_0x071a('0x47')][_0x071a('0x58')]?_0x3be529[_0x071a('0x47')]:_0x867d87['model'];_0x3be529['order']=qs[_0x071a('0x4c')](_0x23edef[_0x071a('0x44')][_0x071a('0x4c')]);_0x3be529['where']=qs[_0x071a('0x4d')](_[_0x071a('0x6a')](_0x23edef['query'],_0x867d87[_0x071a('0x4d')]));if(_0x23edef[_0x071a('0x44')][_0x071a('0x4e')]){_0x3be529[_0x071a('0x4f')]=_[_0x071a('0x50')](_0x3be529[_0x071a('0x4f')],{'$or':_['map'](_0x3be529[_0x071a('0x47')],function(_0xfcca1b){var _0x2bfaad={};_0x2bfaad[_0xfcca1b]={'$like':'%'+_0x23edef[_0x071a('0x44')][_0x071a('0x4e')]+'%'};return _0x2bfaad;})});}_0x3be529=_[_0x071a('0x50')]({},_0x3be529,_0x23edef[_0x071a('0x5a')]);return _0x1f5abb[_0x071a('0x77')](_0x3be529);}})[_0x071a('0x34')](function(_0x1b6dc8){if(_0x1b6dc8){_0x22ff10=_0x1b6dc8[_0x071a('0x58')];if(!_0x23edef['query'][_0x071a('0x49')](_0x071a('0x4a'))){_0x3be529[_0x071a('0x2e')]=qs[_0x071a('0x2e')](_0x23edef[_0x071a('0x44')][_0x071a('0x2e')]);_0x3be529[_0x071a('0x4b')]=qs[_0x071a('0x4b')](_0x23edef[_0x071a('0x44')]['offset']);}return _0x1f5abb['getAgents'](_0x3be529);}})[_0x071a('0x34')](function(_0x28f295){if(_0x28f295){return _0x28f295?{'count':_0x22ff10,'rows':_0x28f295}:null;}})[_0x071a('0x34')](respondWithResult(_0x37e3b1,null))[_0x071a('0x54')](handleError(_0x37e3b1,null));};exports[_0x071a('0x79')]=function(_0x275ee7,_0x29cc30,_0x45ce87){return db[_0x071a('0x3e')][_0x071a('0x67')]({'where':{'id':_0x275ee7[_0x071a('0x56')]['id']}})[_0x071a('0x34')](handleEntityNotFound(_0x29cc30,null))[_0x071a('0x34')](function(_0x3481fe){if(_0x3481fe){return db[_0x071a('0x7a')]['transaction'](function(_0x420e44){return db[_0x071a('0x7b')][_0x071a('0x38')]({'where':{'WhatsappAccountId':_0x275ee7[_0x071a('0x56')]['id']},'transaction':_0x420e44})[_0x071a('0x34')](function(_0x4549f7){var _0x47ab74=_[_0x071a('0x43')](_0x275ee7[_0x071a('0x5d')],function(_0x50f3f9){_0x50f3f9[_0x071a('0x65')]=_0x275ee7[_0x071a('0x56')]['id'];return _0x50f3f9;});return db[_0x071a('0x7b')][_0x071a('0x7c')](_0x47ab74,{'transaction':_0x420e44});});})[_0x071a('0x34')](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x275ee7[_0x071a('0x56')]['id']},'order':_0x071a('0x7d')});});}})[_0x071a('0x34')](respondWithResult(_0x29cc30,null))[_0x071a('0x54')](handleError(_0x29cc30,null));};exports['getApplications']=function(_0x196517,_0x5190d2,_0x241153){var _0x5b6931={};var _0x4964c9={};var _0x49821e;var _0x79c33a;return db[_0x071a('0x3e')]['findOne']({'where':{'id':_0x196517[_0x071a('0x56')]['id']}})['then'](handleEntityNotFound(_0x5190d2,null))[_0x071a('0x34')](function(_0x20c60f){if(_0x20c60f){_0x49821e=_0x20c60f;_0x4964c9['model']=_[_0x071a('0x45')](db['WhatsappApplication']['rawAttributes']);_0x4964c9['query']=_[_0x071a('0x45')](_0x196517[_0x071a('0x44')]);_0x4964c9[_0x071a('0x4d')]=_['intersection'](_0x4964c9[_0x071a('0x42')],_0x4964c9[_0x071a('0x44')]);_0x5b6931[_0x071a('0x47')]=_[_0x071a('0x46')](_0x4964c9[_0x071a('0x42')],qs[_0x071a('0x48')](_0x196517[_0x071a('0x44')][_0x071a('0x48')]));_0x5b6931['attributes']=_0x5b6931[_0x071a('0x47')][_0x071a('0x58')]?_0x5b6931[_0x071a('0x47')]:_0x4964c9[_0x071a('0x42')];_0x5b6931['order']=qs[_0x071a('0x4c')](_0x196517['query'][_0x071a('0x4c')]);_0x5b6931[_0x071a('0x4f')]=qs[_0x071a('0x4d')](_[_0x071a('0x6a')](_0x196517['query'],_0x4964c9[_0x071a('0x4d')]));if(_0x196517[_0x071a('0x44')]['filter']){_0x5b6931['where']=_['merge'](_0x5b6931['where'],{'$or':_['map'](_0x5b6931[_0x071a('0x47')],function(_0x122528){var _0x4b9172={};_0x4b9172[_0x122528]={'$like':'%'+_0x196517['query']['filter']+'%'};return _0x4b9172;})});}_0x5b6931=_['merge']({},_0x5b6931,_0x196517[_0x071a('0x5a')]);return _0x49821e[_0x071a('0x7e')](_0x5b6931);}})['then'](function(_0x250087){if(_0x250087){_0x79c33a=_0x250087[_0x071a('0x58')];if(!_0x196517['query'][_0x071a('0x49')](_0x071a('0x4a'))){_0x5b6931[_0x071a('0x2e')]=qs[_0x071a('0x2e')](_0x196517['query'][_0x071a('0x2e')]);_0x5b6931[_0x071a('0x4b')]=qs['offset'](_0x196517['query'][_0x071a('0x4b')]);}return _0x49821e[_0x071a('0x7e')](_0x5b6931);}})[_0x071a('0x34')](function(_0x555f32){if(_0x555f32){return _0x555f32?{'count':_0x79c33a,'rows':_0x555f32}:null;}})[_0x071a('0x34')](respondWithResult(_0x5190d2,null))['catch'](handleError(_0x5190d2,null));};exports['notify']=function(_0x3a66b7,_0x269220,_0xfed515){var _0x2f8949={'channel':_0x071a('0x7f')};var _0x5b2ba7=[];var _0x449e47=[];var _0x50be0c={};return db[_0x071a('0x3e')][_0x071a('0x5b')]({'where':{'id':_0x3a66b7[_0x071a('0x56')]['id']},'include':[{'model':db[_0x071a('0x7b')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x269220,null))[_0x071a('0x34')](function(_0x2b28f1){_0x2f8949[_0x071a('0x80')]=_0x2b28f1;_0x2f8949[_0x071a('0x81')]=_[_0x071a('0x82')](_0x2b28f1[_0x071a('0x83')],['priority'],[_0x071a('0x84')]);if(_0x2f8949[_0x071a('0x80')]['Applications']){delete _0x2f8949[_0x071a('0x80')]['Applications'];}return db[_0x071a('0x85')][_0x071a('0x63')]();})['then'](function(_0x47e2b5){if(!_0x47e2b5){throw new db[(_0x071a('0x86'))][(_0x071a('0x87'))](_0x071a('0x88'));}_0x5b2ba7=_[_0x071a('0x89')](_[_0x071a('0x45')](_0x47e2b5),[_0x071a('0x8a'),'updatedAt']);_0x449e47=_[_0x071a('0x89')](_[_0x071a('0x45')](_0x47e2b5),['createdAt',_0x071a('0x8b'),'CompanyId','ListId']);_0x2f8949['body']={'mapKey':_0x071a('0x8c')};if(_0x2f8949[_0x071a('0x80')][_0x071a('0x41')]&&_0x2f8949['account'][_0x071a('0x41')]===_0x071a('0x8d')){_0x2f8949[_0x071a('0x5d')][_0x071a('0x8e')]=_0x3a66b7[_0x071a('0x5d')][_0x071a('0x8f')][_0x071a('0x90')]('whatsapp:','');_0x2f8949['body']['body']=_0x3a66b7[_0x071a('0x5d')]['Body'];_0x2f8949[_0x071a('0x5d')][_0x071a('0x91')]=_0x3a66b7[_0x071a('0x5d')]['MessageSid'];}if(_0x2f8949['body']['id']){delete _0x2f8949[_0x071a('0x5d')]['id'];}if(_[_0x071a('0x92')](_0x2f8949[_0x071a('0x5d')]['from'])){throw new db[(_0x071a('0x86'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x071a('0x92')](_0x2f8949[_0x071a('0x5d')][_0x071a('0x5d')])||_0x2f8949[_0x071a('0x5d')]['body']===''){throw new db['Sequelize'][(_0x071a('0x87'))](_0x071a('0x93'));}if(_[_0x071a('0x92')](_0x2f8949[_0x071a('0x5d')][_0x071a('0x94')])){throw new db[(_0x071a('0x86'))][(_0x071a('0x87'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x449e47);}if(!_[_0x071a('0x95')](_0x449e47,_0x2f8949[_0x071a('0x5d')][_0x071a('0x94')])){throw new db['Sequelize'][(_0x071a('0x87'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x449e47);}_0x50be0c[_0x2f8949[_0x071a('0x5d')][_0x071a('0x94')]]=_0x2f8949[_0x071a('0x5d')][_0x071a('0x8e')];return db[_0x071a('0x96')][_0x071a('0x5b')]({'where':{'id':_0x2f8949[_0x071a('0x80')]['ListId']},'include':[{'model':db[_0x071a('0x85')],'as':'Contacts','where':_0x50be0c,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x071a('0x34')](handleEntityNotFound(_0x269220,null))['then'](function(_0x4659c8){if(_0x4659c8){_0x2f8949['list']=_[_0x071a('0x71')](_0x4659c8,[_0x071a('0x97')]);if(_0x4659c8['Contacts'][_0x071a('0x58')]){return _0x4659c8[_0x071a('0x97')][0x0];}var _0x5d6ab1=_[_0x071a('0x98')](_0x2f8949[_0x071a('0x5d')],{'firstName':_0x2f8949[_0x071a('0x5d')][_0x071a('0x8e')],'ListId':_0x4659c8['id']});_0x5d6ab1[_0x2f8949[_0x071a('0x5d')][_0x071a('0x94')]]=_0x2f8949['body'][_0x071a('0x8e')];return db['CmContact'][_0x071a('0x5c')](_0x5d6ab1,{'fields':_0x5b2ba7,'raw':!![]});}})['then'](handleEntityNotFound(_0x269220,null))[_0x071a('0x34')](function(_0x200ec1){if(_0x200ec1){_0x2f8949[_0x071a('0x99')]=_0x200ec1;var _0x3eaf59={'ContactId':_0x200ec1['id'],'phone':_0x2f8949['body']['from'],'WhatsappAccountId':_0x3a66b7[_0x071a('0x56')]['id']};var _0x24687d={'ContactId':_0x200ec1['id'],'WhatsappAccountId':_0x3a66b7[_0x071a('0x56')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x071a('0x5b')]({'where':_0x24687d})[_0x071a('0x34')](function(_0x1011d2){if(_0x1011d2){return[_0x1011d2,![]];}return db[_0x071a('0x9a')]['create'](_0x3eaf59)['then'](function(_0x268391){return[_0x268391,!![]];});});}})['spread'](function(_0x1e76a5,_0x4d7166){_0x2f8949['interaction']=_0x1e76a5[_0x071a('0x35')]({'plain':!![]});_0x2f8949['interaction'][_0x071a('0x9b')]=![];if(_0x4d7166){if(_0x2f8949[_0x071a('0x80')][_0x071a('0x9c')]){_0x2f8949[_0x071a('0x81')][_0x071a('0x9d')]({'id':0x0,'priority':_0x2f8949[_0x071a('0x81')][_0x071a('0x58')]+0x1,'app':_0x071a('0x9e'),'appdata':_0x071a('0x9f'),'interval':_0x071a('0xa0')});}_0x2f8949['interaction'][_0x071a('0x9b')]=!![];}return db[_0x071a('0xa1')]['create']({'phone':_0x2f8949[_0x071a('0x5d')][_0x071a('0x8e')],'messageId':_0x2f8949[_0x071a('0x5d')]['messageId'],'body':_0x2f8949[_0x071a('0x5d')]['body'],'WhatsappAccountId':_0x3a66b7[_0x071a('0x56')]['id'],'WhatsappInteractionId':_0x1e76a5['id'],'direction':'in','ContactId':_0x1e76a5[_0x071a('0xa2')],'AttachmentId':_0x2f8949[_0x071a('0x5d')][_0x071a('0xa3')]});})[_0x071a('0x34')](function(_0x108aab){_0x2f8949[_0x071a('0x25')]=_0x108aab;if(_0x2f8949[_0x071a('0xa4')][_0x071a('0xa5')]){return db['User'][_0x071a('0x5b')]({'attributes':['id',_0x071a('0x3a')],'where':{'id':_0x2f8949[_0x071a('0xa4')]['UserId']}})[_0x071a('0x34')](function(_0x42453d){if(_0x42453d){_0x2f8949['applications'][_0x071a('0xa6')]({'id':0x0,'priority':0x0,'app':_0x071a('0xa7'),'appdata':_0x42453d['name']+','+(_0x2f8949[_0x071a('0x80')][_0x071a('0xa8')]||0xa),'interval':_0x071a('0xa0')});}return respondWithRpcPromise(_0x071a('0xa9'),_0x071a('0xaa'),_0x2f8949);});}return respondWithRpcPromise(_0x071a('0xa9'),_0x071a('0xaa'),_0x2f8949);})[_0x071a('0x34')](function(_0x395653){if(_0x395653){var _0xf2eae8=0xc8;var _0x294e3a=_0x071a('0xab');logger[_0x071a('0x27')](_0x071a('0x22'),_0x294e3a,_0xf2eae8,'entity\x20found');logger[_0x071a('0x21')](_0x071a('0xac'),_0x294e3a,_0xf2eae8,_0x071a('0xad'),JSON['stringify'](_0x395653));if(_0x2f8949[_0x071a('0x80')][_0x071a('0x41')]==='twilio'){return _0x269220[_0x071a('0x2b')](_0xf2eae8)[_0x071a('0x30')](_0x071a('0xae'),_0x071a('0xaf'))[_0x071a('0x3b')](_0x071a('0xb0'));}else{return _0x269220[_0x071a('0x2b')](_0xf2eae8)[_0x071a('0x2c')](_0x395653);}}})[_0x071a('0x54')](handleError(_0x269220,null));};exports[_0x071a('0x3b')]=function(_0x167644,_0x21442e,_0x2ce9d7){var _0x43ff44,_0x6ef985,_0x41fafc;if(_[_0x071a('0x92')](_0x167644[_0x071a('0x5d')][_0x071a('0x5d')])||_0x167644['body'][_0x071a('0x5d')]===''){throw new db['Sequelize'][(_0x071a('0x87'))](_0x071a('0x93'));}if(_[_0x071a('0x92')](_0x167644[_0x071a('0x5d')]['to'])){throw new db['Sequelize'][(_0x071a('0x87'))](_0x071a('0xb1'));}_0x43ff44=_0x167644[_0x071a('0x5d')]['to'];return db[_0x071a('0x3e')][_0x071a('0x5b')]({'where':{'id':_0x167644[_0x071a('0x56')]['id']},'include':[{'model':db['CmList'],'as':_0x071a('0xb2'),'include':[{'model':db[_0x071a('0x85')],'as':_0x071a('0x97'),'where':{'mobile':_0x43ff44},'limit':0x1,'order':[[_0x071a('0x8b'),_0x071a('0xb3')]]}]}]})['then'](handleEntityNotFound(_0x21442e,null))[_0x071a('0x34')](function(_0x5039ac){if(_0x5039ac&&_0x5039ac[_0x071a('0xb2')]){_0x6ef985=_0x5039ac[_0x071a('0x35')]({'plain':!![]});if(_0x6ef985['List']&&_0x6ef985[_0x071a('0xb2')][_0x071a('0x97')][_0x071a('0x58')]){return _0x6ef985['List'][_0x071a('0x97')][0x0];}return db[_0x071a('0x85')][_0x071a('0x5c')](_[_0x071a('0x98')](_0x167644[_0x071a('0x5d')],{'firstName':_0x43ff44,'mobile':_0x43ff44,'phone':_0x43ff44,'ListId':_0x6ef985[_0x071a('0xb4')]}));}})[_0x071a('0x34')](handleEntityNotFound(_0x21442e,null))[_0x071a('0x34')](function(_0x34e8ad){if(_0x34e8ad){_0x41fafc=_0x34e8ad;return db[_0x071a('0x9a')]['find']({'where':{'ContactId':_0x41fafc['id'],'closed':![],'WhatsappAccountId':_0x6ef985['id']}})[_0x071a('0x34')](function(_0x5eced3){if(_0x5eced3){return[_0x5eced3,![]];}return db['WhatsappInteraction']['create']({'UserId':_0x167644[_0x071a('0x5e')]['id'],'ContactId':_0x41fafc['id'],'WhatsappAccountId':_0x6ef985['id'],'phone':_0x43ff44,'firstMsgDirection':_0x071a('0xb5'),'Messages':[_['merge'](_0x167644[_0x071a('0x5d')],{'read':![],'body':_0x167644['body']['body'],'phone':_0x43ff44,'WhatsappAccountId':_0x6ef985['id'],'UserId':_0x167644['user']['id'],'ContactId':_0x41fafc['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x071a('0x34')](function(_0x10cf07){return[_0x10cf07,!![]];});});}})['spread'](function(_0x4c9ee1,_0x11fa91){if(_0x11fa91){return _0x4c9ee1;}return db[_0x071a('0xa1')][_0x071a('0x5c')](_[_0x071a('0x50')](_0x167644[_0x071a('0x5d')],{'read':![],'body':_0x167644[_0x071a('0x5d')][_0x071a('0x5d')],'phone':_0x43ff44,'WhatsappAccountId':_0x6ef985['id'],'WhatsappInteractionId':_0x4c9ee1['id'],'UserId':_0x167644['user']['id'],'ContactId':_0x41fafc['id']}))['then'](function(_0x9c263c){_0x4c9ee1['dataValues'][_0x071a('0xb6')]=[];_0x4c9ee1['dataValues']['Messages']['push'](_0x9c263c[_0x071a('0xb7')]);return _0x4c9ee1;});})[_0x071a('0x34')](respondWithResult(_0x21442e,null))[_0x071a('0x54')](handleError(_0x21442e,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 75405da..de27e65 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 _0xd57d=['hasOwnProperty','hook','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit'];(function(_0x43455e,_0x46eb8b){var _0x2801cc=function(_0x1f6d4a){while(--_0x1f6d4a){_0x43455e['push'](_0x43455e['shift']());}};_0x2801cc(++_0x46eb8b);}(_0xd57d,0x1b0));var _0xdd57=function(_0x5704c4,_0x49407d){_0x5704c4=_0x5704c4-0x0;var _0x120d8d=_0xd57d[_0x5704c4];return _0x120d8d;};'use strict';var EventEmitter=require(_0xdd57('0x0'));var WhatsappAccount=require(_0xdd57('0x1'))['db'][_0xdd57('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xdd57('0x3')](0x0);var events={'afterCreate':_0xdd57('0x4'),'afterUpdate':_0xdd57('0x5'),'afterDestroy':_0xdd57('0x6')};function emitEvent(_0x1fbde7){return function(_0xd0d1b4,_0x39b1d6,_0x47075d){WhatsappAccountEvents[_0xdd57('0x7')](_0x1fbde7+':'+_0xd0d1b4['id'],_0xd0d1b4);WhatsappAccountEvents[_0xdd57('0x7')](_0x1fbde7,_0xd0d1b4);_0x47075d(null);};}for(var e in events){if(events[_0xdd57('0x8')](e)){var event=events[e];WhatsappAccount[_0xdd57('0x9')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0x89d9=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x89d9,0x188));var _0x989d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x89d9[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x989d('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x989d('0x1')](0x0);var events={'afterCreate':_0x989d('0x2'),'afterUpdate':_0x989d('0x3'),'afterDestroy':_0x989d('0x4')};function emitEvent(_0x250920){return function(_0x73e1fd,_0x3a2720,_0x28f5ff){WhatsappAccountEvents[_0x989d('0x5')](_0x250920+':'+_0x73e1fd['id'],_0x73e1fd);WhatsappAccountEvents['emit'](_0x250920,_0x73e1fd);_0x28f5ff(null);};}for(var e in events){if(events[_0x989d('0x6')](e)){var event=events[e];WhatsappAccount[_0x989d('0x7')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 5ccc0b2..3b7d69c 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 _0xdb13=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x23eb8c,_0x5618e8){var _0x4978ba=function(_0x1512ed){while(--_0x1512ed){_0x23eb8c['push'](_0x23eb8c['shift']());}};_0x4978ba(++_0x5618e8);}(_0xdb13,0x93));var _0x3db1=function(_0x242c9f,_0x50d446){_0x242c9f=_0x242c9f-0x0;var _0x18914e=_0xdb13[_0x242c9f];return _0x18914e;};'use strict';var _=require(_0x3db1('0x0'));var util=require(_0x3db1('0x1'));var logger=require(_0x3db1('0x2'))(_0x3db1('0x3'));var moment=require(_0x3db1('0x4'));var BPromise=require(_0x3db1('0x5'));var rp=require(_0x3db1('0x6'));var fs=require('fs');var path=require(_0x3db1('0x7'));var rimraf=require(_0x3db1('0x8'));var config=require(_0x3db1('0x9'));var attributes=require(_0x3db1('0xa'));module[_0x3db1('0xb')]=function(_0x57ba07,_0x201ea9){return _0x57ba07[_0x3db1('0xc')](_0x3db1('0xd'),attributes,{'tableName':_0x3db1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6da6=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x18c89b,_0x10b2c4){var _0x46c8bb=function(_0x28d7ca){while(--_0x28d7ca){_0x18c89b['push'](_0x18c89b['shift']());}};_0x46c8bb(++_0x10b2c4);}(_0x6da6,0x1a4));var _0x66da=function(_0x1e574e,_0x15c156){_0x1e574e=_0x1e574e-0x0;var _0x523b60=_0x6da6[_0x1e574e];return _0x523b60;};'use strict';var _=require(_0x66da('0x0'));var util=require(_0x66da('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x66da('0x2'));var BPromise=require(_0x66da('0x3'));var rp=require(_0x66da('0x4'));var fs=require('fs');var path=require(_0x66da('0x5'));var rimraf=require(_0x66da('0x6'));var config=require(_0x66da('0x7'));var attributes=require(_0x66da('0x8'));module[_0x66da('0x9')]=function(_0x276cb2,_0x455146){return _0x276cb2[_0x66da('0xa')](_0x66da('0xb'),attributes,{'tableName':_0x66da('0xc'),'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 c9c1db9..28198dc 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 _0xb7ad=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','WhatsappAccount','find','options','where','attributes','include','map','model','ShowWhatsappAccount','stringify','lodash','moment','bluebird'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0xb7ad,0x11d));var _0xdb7a=function(_0x1af120,_0x387021){_0x1af120=_0x1af120-0x0;var _0x581a20=_0xb7ad[_0x1af120];return _0x581a20;};'use strict';var _=require(_0xdb7a('0x0'));var util=require('util');var moment=require(_0xdb7a('0x1'));var BPromise=require(_0xdb7a('0x2'));var rs=require(_0xdb7a('0x3'));var fs=require('fs');var Redis=require(_0xdb7a('0x4'));var db=require(_0xdb7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb7a('0x6'))(_0xdb7a('0x7'));var config=require('../../config/environment');var jayson=require(_0xdb7a('0x8'));var client=jayson[_0xdb7a('0x9')][_0xdb7a('0xa')]({'port':0x232a});config[_0xdb7a('0xb')]=_['defaults'](config[_0xdb7a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb7a('0xc'))(new Redis(config[_0xdb7a('0xb')]));require('./whatsappAccount.socket')[_0xdb7a('0xd')](socket);function respondWithRpcPromise(_0x448fd2,_0x850a4c,_0x482c6f){return new BPromise(function(_0x4378fa,_0x1c5689){return client[_0xdb7a('0xe')](_0x448fd2,_0x482c6f)[_0xdb7a('0xf')](function(_0xa7c12){logger[_0xdb7a('0x10')](_0xdb7a('0x11'),_0x850a4c,_0xdb7a('0x12'));logger[_0xdb7a('0x13')](_0xdb7a('0x14'),_0x850a4c,_0xdb7a('0x12'),JSON['stringify'](_0xa7c12));if(_0xa7c12['error']){if(_0xa7c12[_0xdb7a('0x15')][_0xdb7a('0x16')]===0x1f4){logger[_0xdb7a('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x850a4c,_0xa7c12[_0xdb7a('0x15')][_0xdb7a('0x17')]);return _0x1c5689(_0xa7c12['error'][_0xdb7a('0x17')]);}logger[_0xdb7a('0x15')](_0xdb7a('0x11'),_0x850a4c,_0xa7c12[_0xdb7a('0x15')][_0xdb7a('0x17')]);return _0x4378fa(_0xa7c12['error']['message']);}else{logger[_0xdb7a('0x10')](_0xdb7a('0x11'),_0x850a4c,'request\x20sent');_0x4378fa(_0xa7c12[_0xdb7a('0x18')][_0xdb7a('0x17')]);}})[_0xdb7a('0x19')](function(_0x30c449){logger['error'](_0xdb7a('0x11'),_0x850a4c,_0x30c449);_0x1c5689(_0x30c449);});});}exports['ShowWhatsappAccount']=function(_0x2f922c){var _0x434ed8=this;return new Promise(function(_0x21b431,_0x57ff5a){return db[_0xdb7a('0x1a')][_0xdb7a('0x1b')]({'raw':_0x2f922c[_0xdb7a('0x1c')]?_0x2f922c[_0xdb7a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2f922c[_0xdb7a('0x1c')]?_0x2f922c[_0xdb7a('0x1c')][_0xdb7a('0x1d')]||null:null,'attributes':_0x2f922c[_0xdb7a('0x1c')]?_0x2f922c[_0xdb7a('0x1c')][_0xdb7a('0x1e')]||null:null,'include':_0x2f922c[_0xdb7a('0x1c')]?_0x2f922c[_0xdb7a('0x1c')][_0xdb7a('0x1f')]?_[_0xdb7a('0x20')](_0x2f922c[_0xdb7a('0x1c')]['include'],function(_0x1eda4d){return{'model':db[_0x1eda4d[_0xdb7a('0x21')]],'as':_0x1eda4d['as'],'attributes':_0x1eda4d[_0xdb7a('0x1e')],'include':_0x1eda4d[_0xdb7a('0x1f')]?_[_0xdb7a('0x20')](_0x1eda4d[_0xdb7a('0x1f')],function(_0x55b7b7){return{'model':db[_0x55b7b7[_0xdb7a('0x21')]],'as':_0x55b7b7['as'],'attributes':_0x55b7b7[_0xdb7a('0x1e')],'include':_0x55b7b7['include']?_[_0xdb7a('0x20')](_0x55b7b7[_0xdb7a('0x1f')],function(_0x4e83fb){return{'model':db[_0x4e83fb['model']],'as':_0x4e83fb['as'],'attributes':_0x4e83fb['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xc3b1a4){logger['info'](_0xdb7a('0x22'),_0x2f922c);logger[_0xdb7a('0x13')]('ShowWhatsappAccount',_0x2f922c,JSON[_0xdb7a('0x23')](_0xc3b1a4));_0x21b431(_0xc3b1a4);})['catch'](function(_0x56c71d){logger['error'](_0xdb7a('0x22'),_0x56c71d[_0xdb7a('0x17')],_0x2f922c);_0x57ff5a(_0x434ed8[_0xdb7a('0x15')](0x1f4,_0x56c71d['message']));});});}; \ No newline at end of file +var _0xdf5d=['register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowWhatsappAccount','find','options','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket'];(function(_0x445101,_0x2414bf){var _0x3c3d04=function(_0x249067){while(--_0x249067){_0x445101['push'](_0x445101['shift']());}};_0x3c3d04(++_0x2414bf);}(_0xdf5d,0x126));var _0xddf5=function(_0x2e2d30,_0x3ee772){_0x2e2d30=_0x2e2d30-0x0;var _0x34ebbf=_0xdf5d[_0x2e2d30];return _0x34ebbf;};'use strict';var _=require(_0xddf5('0x0'));var util=require(_0xddf5('0x1'));var moment=require(_0xddf5('0x2'));var BPromise=require(_0xddf5('0x3'));var rs=require(_0xddf5('0x4'));var fs=require('fs');var Redis=require(_0xddf5('0x5'));var db=require(_0xddf5('0x6'))['db'];var utils=require(_0xddf5('0x7'));var logger=require('../../config/logger')(_0xddf5('0x8'));var config=require(_0xddf5('0x9'));var jayson=require(_0xddf5('0xa'));var client=jayson[_0xddf5('0xb')][_0xddf5('0xc')]({'port':0x232a});config[_0xddf5('0xd')]=_[_0xddf5('0xe')](config[_0xddf5('0xd')],{'host':_0xddf5('0xf'),'port':0x18eb});var socket=require(_0xddf5('0x10'))(new Redis(config[_0xddf5('0xd')]));require(_0xddf5('0x11'))[_0xddf5('0x12')](socket);function respondWithRpcPromise(_0x3e50f2,_0x10191b,_0x3e675b){return new BPromise(function(_0x5a4f45,_0x161973){return client[_0xddf5('0x13')](_0x3e50f2,_0x3e675b)[_0xddf5('0x14')](function(_0x10245f){logger[_0xddf5('0x15')](_0xddf5('0x16'),_0x10191b,_0xddf5('0x17'));logger[_0xddf5('0x18')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x10191b,'request\x20sent',JSON[_0xddf5('0x19')](_0x10245f));if(_0x10245f[_0xddf5('0x1a')]){if(_0x10245f[_0xddf5('0x1a')][_0xddf5('0x1b')]===0x1f4){logger[_0xddf5('0x1a')](_0xddf5('0x16'),_0x10191b,_0x10245f[_0xddf5('0x1a')][_0xddf5('0x1c')]);return _0x161973(_0x10245f['error'][_0xddf5('0x1c')]);}logger[_0xddf5('0x1a')](_0xddf5('0x16'),_0x10191b,_0x10245f[_0xddf5('0x1a')][_0xddf5('0x1c')]);return _0x5a4f45(_0x10245f['error'][_0xddf5('0x1c')]);}else{logger['info'](_0xddf5('0x16'),_0x10191b,'request\x20sent');_0x5a4f45(_0x10245f[_0xddf5('0x1d')][_0xddf5('0x1c')]);}})[_0xddf5('0x1e')](function(_0x1cd984){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x10191b,_0x1cd984);_0x161973(_0x1cd984);});});}exports[_0xddf5('0x1f')]=function(_0x5bc606){var _0x175a5c=this;return new Promise(function(_0x1abfb2,_0x5e5537){return db['WhatsappAccount'][_0xddf5('0x20')]({'raw':_0x5bc606[_0xddf5('0x21')]?_0x5bc606[_0xddf5('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x5bc606[_0xddf5('0x21')]?_0x5bc606[_0xddf5('0x21')][_0xddf5('0x22')]||null:null,'attributes':_0x5bc606[_0xddf5('0x21')]?_0x5bc606['options'][_0xddf5('0x23')]||null:null,'include':_0x5bc606[_0xddf5('0x21')]?_0x5bc606['options'][_0xddf5('0x24')]?_[_0xddf5('0x25')](_0x5bc606[_0xddf5('0x21')][_0xddf5('0x24')],function(_0x49c381){return{'model':db[_0x49c381[_0xddf5('0x26')]],'as':_0x49c381['as'],'attributes':_0x49c381[_0xddf5('0x23')],'include':_0x49c381[_0xddf5('0x24')]?_[_0xddf5('0x25')](_0x49c381[_0xddf5('0x24')],function(_0x4caa12){return{'model':db[_0x4caa12[_0xddf5('0x26')]],'as':_0x4caa12['as'],'attributes':_0x4caa12[_0xddf5('0x23')],'include':_0x4caa12['include']?_['map'](_0x4caa12[_0xddf5('0x24')],function(_0x45a53f){return{'model':db[_0x45a53f[_0xddf5('0x26')]],'as':_0x45a53f['as'],'attributes':_0x45a53f[_0xddf5('0x23')]};}):[]};}):[]};}):[]:[]})[_0xddf5('0x14')](function(_0x1a476d){logger['info'](_0xddf5('0x1f'),_0x5bc606);logger[_0xddf5('0x18')]('ShowWhatsappAccount',_0x5bc606,JSON[_0xddf5('0x19')](_0x1a476d));_0x1abfb2(_0x1a476d);})[_0xddf5('0x1e')](function(_0x281307){logger['error']('ShowWhatsappAccount',_0x281307['message'],_0x5bc606);_0x5e5537(_0x175a5c[_0xddf5('0x1a')](0x1f4,_0x281307[_0xddf5('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 9f9af5e..2172cdc 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 _0xd86e=['length','whatsappAccount:','save','remove','emit','removeListener'];(function(_0x64e207,_0x5c529b){var _0x50175f=function(_0x5a9172){while(--_0x5a9172){_0x64e207['push'](_0x64e207['shift']());}};_0x50175f(++_0x5c529b);}(_0xd86e,0x1ca));var _0xed86=function(_0x4f7f65,_0x25f4f6){_0x4f7f65=_0x4f7f65-0x0;var _0xd0556f=_0xd86e[_0x4f7f65];return _0xd0556f;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0xed86('0x0'),_0xed86('0x1'),'update'];function createListener(_0x405123,_0x57066e){return function(_0x2d174f){_0x57066e[_0xed86('0x2')](_0x405123,_0x2d174f);};}function removeListener(_0x585ded,_0x2d9773){return function(){WhatsappAccountEvents[_0xed86('0x3')](_0x585ded,_0x2d9773);};}exports['register']=function(_0x11f859){for(var _0x12ded4=0x0,_0x24fc7c=events[_0xed86('0x4')];_0x12ded4<_0x24fc7c;_0x12ded4++){var _0x451342=events[_0x12ded4];var _0x4d1b39=createListener(_0xed86('0x5')+_0x451342,_0x11f859);WhatsappAccountEvents['on'](_0x451342,_0x4d1b39);}}; \ No newline at end of file +var _0x4a58=['./whatsappAccount.events','save','remove','length','whatsappAccount:'];(function(_0x203d86,_0x4fbf88){var _0x3082bf=function(_0x25892f){while(--_0x25892f){_0x203d86['push'](_0x203d86['shift']());}};_0x3082bf(++_0x4fbf88);}(_0x4a58,0x168));var _0x84a5=function(_0x428d55,_0x4e5e47){_0x428d55=_0x428d55-0x0;var _0x4ba5fc=_0x4a58[_0x428d55];return _0x4ba5fc;};'use strict';var WhatsappAccountEvents=require(_0x84a5('0x0'));var events=[_0x84a5('0x1'),_0x84a5('0x2'),'update'];function createListener(_0x387365,_0x54203d){return function(_0x10f01c){_0x54203d['emit'](_0x387365,_0x10f01c);};}function removeListener(_0x42f03e,_0x292c5f){return function(){WhatsappAccountEvents['removeListener'](_0x42f03e,_0x292c5f);};}exports['register']=function(_0x587ac3){for(var _0x3f8d4b=0x0,_0x118ac4=events[_0x84a5('0x3')];_0x3f8d4b<_0x118ac4;_0x3f8d4b++){var _0x391506=events[_0x3f8d4b];var _0x46c7fe=createListener(_0x84a5('0x4')+_0x391506,_0x587ac3);WhatsappAccountEvents['on'](_0x391506,_0x46c7fe);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 99da934..f330463 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 _0x4b2e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x91abdd,_0x4e7e7d){var _0x3779ad=function(_0x2b7321){while(--_0x2b7321){_0x91abdd['push'](_0x91abdd['shift']());}};_0x3779ad(++_0x4e7e7d);}(_0x4b2e,0x74));var _0xe4b2=function(_0x388da5,_0x4acd4c){_0x388da5=_0x388da5-0x0;var _0x345a4f=_0x4b2e[_0x388da5];return _0x345a4f;};'use strict';var multer=require(_0xe4b2('0x0'));var util=require(_0xe4b2('0x1'));var path=require(_0xe4b2('0x2'));var timeout=require(_0xe4b2('0x3'));var express=require(_0xe4b2('0x4'));var router=express[_0xe4b2('0x5')]();var fs_extra=require(_0xe4b2('0x6'));var auth=require(_0xe4b2('0x7'));var interaction=require(_0xe4b2('0x8'));var config=require(_0xe4b2('0x9'));var controller=require('./whatsappApplication.controller');router[_0xe4b2('0xa')]('/',auth[_0xe4b2('0xb')](),controller[_0xe4b2('0xc')]);router['get'](_0xe4b2('0xd'),auth[_0xe4b2('0xb')](),controller[_0xe4b2('0xe')]);router[_0xe4b2('0xf')]('/',auth['isAuthenticated'](),controller[_0xe4b2('0x10')]);router[_0xe4b2('0x11')](_0xe4b2('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xe4b2('0x12')](_0xe4b2('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xe4b2('0x13')]=router; \ No newline at end of file +var _0x3d64=['post','isAuthenticated','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','/:id','show'];(function(_0x2423f5,_0x467b43){var _0xa6366a=function(_0x4ee90b){while(--_0x4ee90b){_0x2423f5['push'](_0x2423f5['shift']());}};_0xa6366a(++_0x467b43);}(_0x3d64,0x1a8));var _0x43d6=function(_0x435d0c,_0x36e154){_0x435d0c=_0x435d0c-0x0;var _0x9839e4=_0x3d64[_0x435d0c];return _0x9839e4;};'use strict';var multer=require(_0x43d6('0x0'));var util=require(_0x43d6('0x1'));var path=require('path');var timeout=require(_0x43d6('0x2'));var express=require(_0x43d6('0x3'));var router=express[_0x43d6('0x4')]();var fs_extra=require(_0x43d6('0x5'));var auth=require(_0x43d6('0x6'));var interaction=require(_0x43d6('0x7'));var config=require(_0x43d6('0x8'));var controller=require(_0x43d6('0x9'));router[_0x43d6('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x43d6('0xa')](_0x43d6('0xb'),auth['isAuthenticated'](),controller[_0x43d6('0xc')]);router[_0x43d6('0xd')]('/',auth[_0x43d6('0xe')](),controller['create']);router[_0x43d6('0xf')](_0x43d6('0xb'),auth[_0x43d6('0xe')](),controller[_0x43d6('0x10')]);router[_0x43d6('0x11')](_0x43d6('0xb'),auth[_0x43d6('0xe')](),controller['destroy']);module[_0x43d6('0x12')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 7439225..eba2317 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 _0xcd22=['noop','TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x5d26b7,_0x3ff698){var _0x572be7=function(_0x2ebd40){while(--_0x2ebd40){_0x5d26b7['push'](_0x5d26b7['shift']());}};_0x572be7(++_0x3ff698);}(_0xcd22,0xa5));var _0x2cd2=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0xcd22[_0x1034ca];return _0x1a023a;};'use strict';var Sequelize=require(_0x2cd2('0x0'));module[_0x2cd2('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2cd2('0x2')],'allowNull':![],'defaultValue':_0x2cd2('0x3')},'appdata':{'type':Sequelize[_0x2cd2('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x2cd2('0x5')}}; \ No newline at end of file +var _0xecf9=['exports','INTEGER','noop','STRING','*,*,*,*','sequelize'];(function(_0x2d59fb,_0x54517e){var _0x22b53d=function(_0x298568){while(--_0x298568){_0x2d59fb['push'](_0x2d59fb['shift']());}};_0x22b53d(++_0x54517e);}(_0xecf9,0x173));var _0x9ecf=function(_0x1072c3,_0x119dbf){_0x1072c3=_0x1072c3-0x0;var _0x56f5aa=_0xecf9[_0x1072c3];return _0x56f5aa;};'use strict';var Sequelize=require(_0x9ecf('0x0'));module[_0x9ecf('0x1')]={'priority':{'type':Sequelize[_0x9ecf('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9ecf('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x9ecf('0x4')]},'interval':{'type':Sequelize[_0x9ecf('0x4')],'defaultValue':_0x9ecf('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 7befb80..fa327d4 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 _0x543b=['create','body','eml-format','rimraf','zip-dir','request-promise','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','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','WhatsappApplication','includeAll','findAll','rows','catch','show','params','include','find'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x543b,0x18d));var _0xb543=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x543b[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xb543('0x0'));var rimraf=require(_0xb543('0x1'));var zipdir=require(_0xb543('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb543('0x3'));var moment=require(_0xb543('0x4'));var BPromise=require(_0xb543('0x5'));var Mustache=require('mustache');var util=require(_0xb543('0x6'));var path=require(_0xb543('0x7'));var sox=require(_0xb543('0x8'));var csv=require(_0xb543('0x9'));var ejs=require(_0xb543('0xa'));var fs=require('fs');var fs_extra=require(_0xb543('0xb'));var _=require(_0xb543('0xc'));var squel=require(_0xb543('0xd'));var crypto=require(_0xb543('0xe'));var jsforce=require(_0xb543('0xf'));var deskjs=require(_0xb543('0x10'));var toCsv=require(_0xb543('0x9'));var querystring=require('querystring');var Papa=require(_0xb543('0x11'));var Redis=require('ioredis');var authService=require(_0xb543('0x12'));var qs=require(_0xb543('0x13'));var as=require(_0xb543('0x14'));var hardwareService=require(_0xb543('0x15'));var logger=require(_0xb543('0x16'))(_0xb543('0x17'));var utils=require('../../config/utils');var config=require(_0xb543('0x18'));var licenseUtil=require(_0xb543('0x19'));var db=require(_0xb543('0x1a'))['db'];function respondWithStatusCode(_0x517c19,_0x2dfe5f){_0x2dfe5f=_0x2dfe5f||0xcc;return function(_0x32f6a7){if(_0x32f6a7){return _0x517c19[_0xb543('0x1b')](_0x2dfe5f);}return _0x517c19['status'](_0x2dfe5f)['end']();};}function respondWithResult(_0x175499,_0x3f6875){_0x3f6875=_0x3f6875||0xc8;return function(_0x2151d4){if(_0x2151d4){return _0x175499[_0xb543('0x1c')](_0x3f6875)['json'](_0x2151d4);}};}function respondWithFilteredResult(_0x1c3496,_0x399b28){return function(_0x44da22){if(_0x44da22){var _0xfb3a4b=typeof _0x399b28['offset']===_0xb543('0x1d')&&typeof _0x399b28['limit']===_0xb543('0x1d');var _0xc9b966=_0x44da22[_0xb543('0x1e')];var _0x13e268=_0xfb3a4b?0x0:_0x399b28['offset'];var _0x399ce8=_0xfb3a4b?_0x44da22[_0xb543('0x1e')]:_0x399b28[_0xb543('0x1f')]+_0x399b28['limit'];var _0x5738bd;if(_0x399ce8>=_0xc9b966){_0x399ce8=_0xc9b966;_0x5738bd=0xc8;}else{_0x5738bd=0xce;}_0x1c3496[_0xb543('0x1c')](_0x5738bd);return _0x1c3496[_0xb543('0x20')](_0xb543('0x21'),_0x13e268+'-'+_0x399ce8+'/'+_0xc9b966)[_0xb543('0x22')](_0x44da22);}return null;};}function patchUpdates(_0x1296bc){return function(_0x42fbed){try{jsonpatch[_0xb543('0x23')](_0x42fbed,_0x1296bc,!![]);}catch(_0x1a4b73){return BPromise['reject'](_0x1a4b73);}return _0x42fbed[_0xb543('0x24')]();};}function saveUpdates(_0x18bcc8,_0xd97ba9){return function(_0xb097ad){if(_0xb097ad){return _0xb097ad[_0xb543('0x25')](_0x18bcc8)[_0xb543('0x26')](function(_0x54e603){return _0x54e603;});}return null;};}function removeEntity(_0x5e763c,_0x5d4ac2){return function(_0x4b932e){if(_0x4b932e){return _0x4b932e[_0xb543('0x27')]()[_0xb543('0x26')](function(){_0x5e763c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x426969,_0x3464b8){return function(_0xed5899){if(!_0xed5899){_0x426969['sendStatus'](0x194);}return _0xed5899;};}function handleError(_0x11a806,_0x5312f7){_0x5312f7=_0x5312f7||0x1f4;return function(_0x2ee119){logger[_0xb543('0x28')](_0x2ee119[_0xb543('0x29')]);if(_0x2ee119[_0xb543('0x2a')]){delete _0x2ee119[_0xb543('0x2a')];}_0x11a806['status'](_0x5312f7)[_0xb543('0x2b')](_0x2ee119);};}exports['index']=function(_0x4e6590,_0x185ffc){var _0x141f7a={},_0x3cb2ed={},_0x87cec0={'count':0x0,'rows':[]};var _0x1d1d2c=_[_0xb543('0x2c')](db['WhatsappApplication'][_0xb543('0x2d')],function(_0x4a6a87){return{'name':_0x4a6a87[_0xb543('0x2e')],'type':_0x4a6a87[_0xb543('0x2f')][_0xb543('0x30')]};});_0x3cb2ed[_0xb543('0x31')]=_['map'](_0x1d1d2c,_0xb543('0x2a'));_0x3cb2ed['query']=_[_0xb543('0x32')](_0x4e6590[_0xb543('0x33')]);_0x3cb2ed[_0xb543('0x34')]=_[_0xb543('0x35')](_0x3cb2ed['model'],_0x3cb2ed[_0xb543('0x33')]);_0x141f7a[_0xb543('0x36')]=_[_0xb543('0x35')](_0x3cb2ed[_0xb543('0x31')],qs[_0xb543('0x37')](_0x4e6590[_0xb543('0x33')]['fields']));_0x141f7a[_0xb543('0x36')]=_0x141f7a[_0xb543('0x36')][_0xb543('0x38')]?_0x141f7a['attributes']:_0x3cb2ed['model'];if(!_0x4e6590[_0xb543('0x33')][_0xb543('0x39')](_0xb543('0x3a'))){_0x141f7a[_0xb543('0x3b')]=qs[_0xb543('0x3b')](_0x4e6590[_0xb543('0x33')][_0xb543('0x3b')]);_0x141f7a[_0xb543('0x1f')]=qs[_0xb543('0x1f')](_0x4e6590['query'][_0xb543('0x1f')]);}_0x141f7a[_0xb543('0x3c')]=qs['sort'](_0x4e6590[_0xb543('0x33')][_0xb543('0x3d')]);_0x141f7a[_0xb543('0x3e')]=qs['filters'](_[_0xb543('0x3f')](_0x4e6590[_0xb543('0x33')],_0x3cb2ed['filters']),_0x1d1d2c);if(_0x4e6590[_0xb543('0x33')][_0xb543('0x40')]){_0x141f7a[_0xb543('0x3e')]=_['merge'](_0x141f7a['where'],{'$or':_[_0xb543('0x2c')](_0x1d1d2c,function(_0x854184){if(_0x854184[_0xb543('0x2f')]!==_0xb543('0x41')){var _0x52076f={};_0x52076f[_0x854184['name']]={'$like':'%'+_0x4e6590['query']['filter']+'%'};return _0x52076f;}})});}_0x141f7a=_[_0xb543('0x42')]({},_0x141f7a,_0x4e6590[_0xb543('0x43')]);var _0x424133={'where':_0x141f7a[_0xb543('0x3e')]};return db[_0xb543('0x44')][_0xb543('0x1e')](_0x424133)['then'](function(_0x3618cf){_0x87cec0[_0xb543('0x1e')]=_0x3618cf;if(_0x4e6590[_0xb543('0x33')][_0xb543('0x45')]){_0x141f7a['include']=[{'all':!![]}];}return db[_0xb543('0x44')][_0xb543('0x46')](_0x141f7a);})[_0xb543('0x26')](function(_0x262a03){_0x87cec0[_0xb543('0x47')]=_0x262a03;return _0x87cec0;})[_0xb543('0x26')](respondWithFilteredResult(_0x185ffc,_0x141f7a))[_0xb543('0x48')](handleError(_0x185ffc,null));};exports[_0xb543('0x49')]=function(_0x3283a0,_0x5a856a){var _0x258d2f={'raw':!![],'where':{'id':_0x3283a0[_0xb543('0x4a')]['id']}},_0x3837b7={};_0x3837b7['model']=_[_0xb543('0x32')](db[_0xb543('0x44')][_0xb543('0x2d')]);_0x3837b7[_0xb543('0x33')]=_[_0xb543('0x32')](_0x3283a0[_0xb543('0x33')]);_0x3837b7['filters']=_[_0xb543('0x35')](_0x3837b7[_0xb543('0x31')],_0x3837b7[_0xb543('0x33')]);_0x258d2f[_0xb543('0x36')]=_['intersection'](_0x3837b7['model'],qs[_0xb543('0x37')](_0x3283a0[_0xb543('0x33')][_0xb543('0x37')]));_0x258d2f[_0xb543('0x36')]=_0x258d2f['attributes'][_0xb543('0x38')]?_0x258d2f[_0xb543('0x36')]:_0x3837b7[_0xb543('0x31')];if(_0x3283a0[_0xb543('0x33')][_0xb543('0x45')]){_0x258d2f[_0xb543('0x4b')]=[{'all':!![]}];}_0x258d2f=_['merge']({},_0x258d2f,_0x3283a0['options']);return db[_0xb543('0x44')][_0xb543('0x4c')](_0x258d2f)['then'](handleEntityNotFound(_0x5a856a,null))['then'](respondWithResult(_0x5a856a,null))[_0xb543('0x48')](handleError(_0x5a856a,null));};exports[_0xb543('0x4d')]=function(_0x493516,_0x2536a6){return db[_0xb543('0x44')][_0xb543('0x4d')](_0x493516[_0xb543('0x4e')],{})['then'](respondWithResult(_0x2536a6,0xc9))[_0xb543('0x48')](handleError(_0x2536a6,null));};exports[_0xb543('0x25')]=function(_0x531e55,_0x3f6c72){if(_0x531e55['body']['id']){delete _0x531e55['body']['id'];}return db[_0xb543('0x44')]['find']({'where':{'id':_0x531e55[_0xb543('0x4a')]['id']}})[_0xb543('0x26')](handleEntityNotFound(_0x3f6c72,null))[_0xb543('0x26')](saveUpdates(_0x531e55[_0xb543('0x4e')],null))['then'](respondWithResult(_0x3f6c72,null))[_0xb543('0x48')](handleError(_0x3f6c72,null));};exports[_0xb543('0x27')]=function(_0x2ef286,_0x2df882){return db[_0xb543('0x44')][_0xb543('0x4c')]({'where':{'id':_0x2ef286[_0xb543('0x4a')]['id']}})[_0xb543('0x26')](handleEntityNotFound(_0x2df882,null))[_0xb543('0x26')](removeEntity(_0x2df882,null))[_0xb543('0x48')](handleError(_0x2df882,null));}; \ No newline at end of file +var _0x56b9=['intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','include','catch','show','params','includeAll','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56b9,0x196));var _0x956b=function(_0x10e107,_0x46144f){_0x10e107=_0x10e107-0x0;var _0x2722eb=_0x56b9[_0x10e107];return _0x2722eb;};'use strict';var emlformat=require(_0x956b('0x0'));var rimraf=require(_0x956b('0x1'));var zipdir=require(_0x956b('0x2'));var jsonpatch=require(_0x956b('0x3'));var rp=require(_0x956b('0x4'));var moment=require(_0x956b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x956b('0x6'));var util=require('util');var path=require(_0x956b('0x7'));var sox=require(_0x956b('0x8'));var csv=require(_0x956b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x956b('0xa'));var _=require(_0x956b('0xb'));var squel=require(_0x956b('0xc'));var crypto=require(_0x956b('0xd'));var jsforce=require(_0x956b('0xe'));var deskjs=require(_0x956b('0xf'));var toCsv=require(_0x956b('0x9'));var querystring=require(_0x956b('0x10'));var Papa=require('papaparse');var Redis=require(_0x956b('0x11'));var authService=require(_0x956b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x956b('0x13'));var hardwareService=require(_0x956b('0x14'));var logger=require(_0x956b('0x15'))(_0x956b('0x16'));var utils=require(_0x956b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x956b('0x18'));var db=require(_0x956b('0x19'))['db'];function respondWithStatusCode(_0x2bc65c,_0x2fcd69){_0x2fcd69=_0x2fcd69||0xcc;return function(_0x3683bc){if(_0x3683bc){return _0x2bc65c[_0x956b('0x1a')](_0x2fcd69);}return _0x2bc65c[_0x956b('0x1b')](_0x2fcd69)[_0x956b('0x1c')]();};}function respondWithResult(_0x4338ce,_0x2346bd){_0x2346bd=_0x2346bd||0xc8;return function(_0x389c3b){if(_0x389c3b){return _0x4338ce['status'](_0x2346bd)[_0x956b('0x1d')](_0x389c3b);}};}function respondWithFilteredResult(_0x32a806,_0xe68d03){return function(_0x4e4029){if(_0x4e4029){var _0x96ea9d=typeof _0xe68d03[_0x956b('0x1e')]===_0x956b('0x1f')&&typeof _0xe68d03[_0x956b('0x20')]===_0x956b('0x1f');var _0x2bece3=_0x4e4029[_0x956b('0x21')];var _0x57dff2=_0x96ea9d?0x0:_0xe68d03[_0x956b('0x1e')];var _0xc4cdb3=_0x96ea9d?_0x4e4029[_0x956b('0x21')]:_0xe68d03['offset']+_0xe68d03[_0x956b('0x20')];var _0x45211c;if(_0xc4cdb3>=_0x2bece3){_0xc4cdb3=_0x2bece3;_0x45211c=0xc8;}else{_0x45211c=0xce;}_0x32a806['status'](_0x45211c);return _0x32a806['set'](_0x956b('0x22'),_0x57dff2+'-'+_0xc4cdb3+'/'+_0x2bece3)[_0x956b('0x1d')](_0x4e4029);}return null;};}function patchUpdates(_0x21fee6){return function(_0x53cb2d){try{jsonpatch[_0x956b('0x23')](_0x53cb2d,_0x21fee6,!![]);}catch(_0x2a4cb5){return BPromise[_0x956b('0x24')](_0x2a4cb5);}return _0x53cb2d[_0x956b('0x25')]();};}function saveUpdates(_0x33edf1,_0x840935){return function(_0x4ad9bb){if(_0x4ad9bb){return _0x4ad9bb[_0x956b('0x26')](_0x33edf1)[_0x956b('0x27')](function(_0x1f9ff6){return _0x1f9ff6;});}return null;};}function removeEntity(_0x3605cd,_0x2b315d){return function(_0x1ecd0a){if(_0x1ecd0a){return _0x1ecd0a[_0x956b('0x28')]()[_0x956b('0x27')](function(){_0x3605cd[_0x956b('0x1b')](0xcc)[_0x956b('0x1c')]();});}};}function handleEntityNotFound(_0x32f727,_0x512a68){return function(_0x502875){if(!_0x502875){_0x32f727[_0x956b('0x1a')](0x194);}return _0x502875;};}function handleError(_0x2606bf,_0x3af7fd){_0x3af7fd=_0x3af7fd||0x1f4;return function(_0x21ab02){logger[_0x956b('0x29')](_0x21ab02[_0x956b('0x2a')]);if(_0x21ab02[_0x956b('0x2b')]){delete _0x21ab02['name'];}_0x2606bf[_0x956b('0x1b')](_0x3af7fd)[_0x956b('0x2c')](_0x21ab02);};}exports[_0x956b('0x2d')]=function(_0x3d33ad,_0x3d17a0){var _0x33fb5e={},_0x1f692e={},_0x9c0e2e={'count':0x0,'rows':[]};var _0x15c32e=_[_0x956b('0x2e')](db[_0x956b('0x2f')][_0x956b('0x30')],function(_0x1c5f3d){return{'name':_0x1c5f3d[_0x956b('0x31')],'type':_0x1c5f3d[_0x956b('0x32')][_0x956b('0x33')]};});_0x1f692e[_0x956b('0x34')]=_[_0x956b('0x2e')](_0x15c32e,_0x956b('0x2b'));_0x1f692e[_0x956b('0x35')]=_[_0x956b('0x36')](_0x3d33ad['query']);_0x1f692e[_0x956b('0x37')]=_[_0x956b('0x38')](_0x1f692e[_0x956b('0x34')],_0x1f692e[_0x956b('0x35')]);_0x33fb5e[_0x956b('0x39')]=_[_0x956b('0x38')](_0x1f692e[_0x956b('0x34')],qs[_0x956b('0x3a')](_0x3d33ad['query']['fields']));_0x33fb5e[_0x956b('0x39')]=_0x33fb5e[_0x956b('0x39')][_0x956b('0x3b')]?_0x33fb5e[_0x956b('0x39')]:_0x1f692e[_0x956b('0x34')];if(!_0x3d33ad[_0x956b('0x35')][_0x956b('0x3c')]('nolimit')){_0x33fb5e[_0x956b('0x20')]=qs['limit'](_0x3d33ad['query'][_0x956b('0x20')]);_0x33fb5e[_0x956b('0x1e')]=qs[_0x956b('0x1e')](_0x3d33ad[_0x956b('0x35')][_0x956b('0x1e')]);}_0x33fb5e[_0x956b('0x3d')]=qs[_0x956b('0x3e')](_0x3d33ad['query'][_0x956b('0x3e')]);_0x33fb5e[_0x956b('0x3f')]=qs['filters'](_[_0x956b('0x40')](_0x3d33ad[_0x956b('0x35')],_0x1f692e['filters']),_0x15c32e);if(_0x3d33ad[_0x956b('0x35')]['filter']){_0x33fb5e[_0x956b('0x3f')]=_[_0x956b('0x41')](_0x33fb5e[_0x956b('0x3f')],{'$or':_[_0x956b('0x2e')](_0x15c32e,function(_0x5c8326){if(_0x5c8326['type']!==_0x956b('0x42')){var _0x328c5e={};_0x328c5e[_0x5c8326[_0x956b('0x2b')]]={'$like':'%'+_0x3d33ad[_0x956b('0x35')][_0x956b('0x43')]+'%'};return _0x328c5e;}})});}_0x33fb5e=_[_0x956b('0x41')]({},_0x33fb5e,_0x3d33ad['options']);var _0x3548cf={'where':_0x33fb5e[_0x956b('0x3f')]};return db['WhatsappApplication'][_0x956b('0x21')](_0x3548cf)['then'](function(_0x5b84f9){_0x9c0e2e[_0x956b('0x21')]=_0x5b84f9;if(_0x3d33ad[_0x956b('0x35')]['includeAll']){_0x33fb5e[_0x956b('0x44')]=[{'all':!![]}];}return db[_0x956b('0x2f')]['findAll'](_0x33fb5e);})[_0x956b('0x27')](function(_0x591823){_0x9c0e2e['rows']=_0x591823;return _0x9c0e2e;})[_0x956b('0x27')](respondWithFilteredResult(_0x3d17a0,_0x33fb5e))[_0x956b('0x45')](handleError(_0x3d17a0,null));};exports[_0x956b('0x46')]=function(_0x55f7dd,_0x41657f){var _0x1b8197={'raw':!![],'where':{'id':_0x55f7dd[_0x956b('0x47')]['id']}},_0x3b3fe6={};_0x3b3fe6[_0x956b('0x34')]=_[_0x956b('0x36')](db[_0x956b('0x2f')][_0x956b('0x30')]);_0x3b3fe6[_0x956b('0x35')]=_[_0x956b('0x36')](_0x55f7dd[_0x956b('0x35')]);_0x3b3fe6['filters']=_[_0x956b('0x38')](_0x3b3fe6[_0x956b('0x34')],_0x3b3fe6[_0x956b('0x35')]);_0x1b8197['attributes']=_[_0x956b('0x38')](_0x3b3fe6[_0x956b('0x34')],qs['fields'](_0x55f7dd['query']['fields']));_0x1b8197[_0x956b('0x39')]=_0x1b8197[_0x956b('0x39')][_0x956b('0x3b')]?_0x1b8197[_0x956b('0x39')]:_0x3b3fe6[_0x956b('0x34')];if(_0x55f7dd[_0x956b('0x35')][_0x956b('0x48')]){_0x1b8197[_0x956b('0x44')]=[{'all':!![]}];}_0x1b8197=_[_0x956b('0x41')]({},_0x1b8197,_0x55f7dd[_0x956b('0x49')]);return db['WhatsappApplication']['find'](_0x1b8197)['then'](handleEntityNotFound(_0x41657f,null))['then'](respondWithResult(_0x41657f,null))['catch'](handleError(_0x41657f,null));};exports[_0x956b('0x4a')]=function(_0x280efc,_0x32621b){return db[_0x956b('0x2f')][_0x956b('0x4a')](_0x280efc['body'],{})[_0x956b('0x27')](respondWithResult(_0x32621b,0xc9))[_0x956b('0x45')](handleError(_0x32621b,null));};exports[_0x956b('0x26')]=function(_0x4f1cfd,_0x49f331){if(_0x4f1cfd[_0x956b('0x4b')]['id']){delete _0x4f1cfd[_0x956b('0x4b')]['id'];}return db['WhatsappApplication'][_0x956b('0x4c')]({'where':{'id':_0x4f1cfd[_0x956b('0x47')]['id']}})[_0x956b('0x27')](handleEntityNotFound(_0x49f331,null))['then'](saveUpdates(_0x4f1cfd[_0x956b('0x4b')],null))['then'](respondWithResult(_0x49f331,null))[_0x956b('0x45')](handleError(_0x49f331,null));};exports[_0x956b('0x28')]=function(_0x343f7e,_0x1a35fd){return db[_0x956b('0x2f')][_0x956b('0x4c')]({'where':{'id':_0x343f7e[_0x956b('0x47')]['id']}})[_0x956b('0x27')](handleEntityNotFound(_0x1a35fd,null))[_0x956b('0x27')](removeEntity(_0x1a35fd,null))[_0x956b('0x45')](handleError(_0x1a35fd,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index ba88e35..ab44be7 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 _0x4b84=['rimraf','../../config/environment','WhatsappApplication','utf8mb4','lodash','util','moment','path'];(function(_0x5f24d8,_0x4d8e75){var _0x1d193c=function(_0x27fcf8){while(--_0x27fcf8){_0x5f24d8['push'](_0x5f24d8['shift']());}};_0x1d193c(++_0x4d8e75);}(_0x4b84,0x1cc));var _0x44b8=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x4b84[_0x92c450];return _0x2a9599;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x44b8('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb2b5=['utf8mb4_unicode_ci','moment','bluebird','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','utf8mb4'];(function(_0xe78202,_0x200dd0){var _0xd44ff5=function(_0x33936b){while(--_0x33936b){_0xe78202['push'](_0xe78202['shift']());}};_0xd44ff5(++_0x200dd0);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xb2b5[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b2b('0x0'));var BPromise=require(_0x5b2b('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5b2b('0x2'));var config=require(_0x5b2b('0x3'));var attributes=require(_0x5b2b('0x4'));module[_0x5b2b('0x5')]=function(_0x49d9f6,_0x30c3e2){return _0x49d9f6[_0x5b2b('0x6')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5b2b('0x7'),'collate':_0x5b2b('0x8')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 642bca7..b8cf872 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 _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x55e0,0xdc));var _0x055e=function(_0x7bec53,_0x201e06){_0x7bec53=_0x7bec53-0x0;var _0xff91aa=_0x55e0[_0x7bec53];return _0xff91aa;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file +var _0xa8a8=['stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug'];(function(_0x3adeb3,_0x4fdd75){var _0x5ea99e=function(_0x1a7c3f){while(--_0x1a7c3f){_0x3adeb3['push'](_0x3adeb3['shift']());}};_0x5ea99e(++_0x4fdd75);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2eb772,_0x52f1b5){_0x2eb772=_0x2eb772-0x0;var _0x4478d0=_0xa8a8[_0x2eb772];return _0x4478d0;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x315fe9,_0x1d7121,_0x8e7aa0){return new BPromise(function(_0x4225b9,_0xecaa6f){return client[_0x8a8a('0xd')](_0x315fe9,_0x8e7aa0)['then'](function(_0x576ef9){logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));logger[_0x8a8a('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'),JSON[_0x8a8a('0x11')](_0x576ef9));if(_0x576ef9[_0x8a8a('0x12')]){if(_0x576ef9['error'][_0x8a8a('0x13')]===0x1f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')]['message']);return _0xecaa6f(_0x576ef9[_0x8a8a('0x12')]['message']);}logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);return _0x4225b9(_0x576ef9[_0x8a8a('0x12')][_0x8a8a('0x15')]);}else{logger[_0x8a8a('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0x1d7121,_0x8a8a('0xf'));_0x4225b9(_0x576ef9['result'][_0x8a8a('0x15')]);}})[_0x8a8a('0x16')](function(_0x46a4f4){logger[_0x8a8a('0x12')](_0x8a8a('0x14'),_0x1d7121,_0x46a4f4);_0xecaa6f(_0x46a4f4);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 7275053..0808f55 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 _0x0f4d=['isAuthenticated','/describe','describe','show','/:id/messages','getMessages','download','post','create','addMessage','whatsapp','addTags','tracked','whatsappinteraction:update','update','delete','/:id','destroy','/:id/tags','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get'];(function(_0x25faa0,_0x19df21){var _0x3d3f26=function(_0xcd0be5){while(--_0xcd0be5){_0x25faa0['push'](_0x25faa0['shift']());}};_0x3d3f26(++_0x19df21);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x224d71,_0xb1d8ca){_0x224d71=_0x224d71-0x0;var _0x5a8f09=_0x0f4d[_0x224d71];return _0x5a8f09;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var fs_extra=require(_0xd0f4('0x2'));var auth=require(_0xd0f4('0x3'));var interaction=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var controller=require(_0xd0f4('0x6'));router[_0xd0f4('0x7')]('/',auth[_0xd0f4('0x8')](),controller['index']);router[_0xd0f4('0x7')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller[_0xd0f4('0xa')]);router[_0xd0f4('0x7')]('/:id',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xb')]);router['get'](_0xd0f4('0xc'),auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xd')]);router['get']('/:id/download',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xe')]);router[_0xd0f4('0xf')]('/',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0x10')]);router[_0xd0f4('0xf')](_0xd0f4('0xc'),auth['isAuthenticated'](),controller[_0xd0f4('0x11')]);router[_0xd0f4('0xf')]('/:id/tags',auth[_0xd0f4('0x8')](),interaction['tracked'](_0xd0f4('0x12'),'whatsappinteraction:addtags'),controller[_0xd0f4('0x13')]);router['put']('/:id',auth['isAuthenticated'](),interaction[_0xd0f4('0x14')](_0xd0f4('0x12'),_0xd0f4('0x15')),controller[_0xd0f4('0x16')]);router[_0xd0f4('0x17')](_0xd0f4('0x18'),auth[_0xd0f4('0x8')](),interaction[_0xd0f4('0x14')](_0xd0f4('0x12'),'whatsappinteraction:destroy'),controller[_0xd0f4('0x19')]);router[_0xd0f4('0x17')](_0xd0f4('0x1a'),auth[_0xd0f4('0x8')](),controller['removeTags']);module[_0xd0f4('0x1b')]=router; \ No newline at end of file +var _0xa23f=['/:id/messages','/:id/tags','tracked','whatsapp','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','getMessages','/:id/download','download','post'];(function(_0x26b883,_0x49cb1e){var _0x505980=function(_0x55534f){while(--_0x55534f){_0x26b883['push'](_0x26b883['shift']());}};_0x505980(++_0x49cb1e);}(_0xa23f,0x7c));var _0xfa23=function(_0x23f2f0,_0x58e5b2){_0x23f2f0=_0x23f2f0-0x0;var _0x49cca3=_0xa23f[_0x23f2f0];return _0x49cca3;};'use strict';var multer=require(_0xfa23('0x0'));var util=require(_0xfa23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa23('0x2'));var router=express[_0xfa23('0x3')]();var fs_extra=require(_0xfa23('0x4'));var auth=require(_0xfa23('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfa23('0x6'));var controller=require('./whatsappInteraction.controller');router[_0xfa23('0x7')]('/',auth[_0xfa23('0x8')](),controller[_0xfa23('0x9')]);router[_0xfa23('0x7')]('/describe',auth[_0xfa23('0x8')](),controller['describe']);router[_0xfa23('0x7')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),controller[_0xfa23('0xb')]);router[_0xfa23('0x7')]('/:id/messages',auth['isAuthenticated'](),controller[_0xfa23('0xc')]);router['get'](_0xfa23('0xd'),auth['isAuthenticated'](),controller[_0xfa23('0xe')]);router[_0xfa23('0xf')]('/',auth[_0xfa23('0x8')](),controller['create']);router[_0xfa23('0xf')](_0xfa23('0x10'),auth[_0xfa23('0x8')](),controller['addMessage']);router['post'](_0xfa23('0x11'),auth[_0xfa23('0x8')](),interaction[_0xfa23('0x12')](_0xfa23('0x13'),'whatsappinteraction:addtags'),controller[_0xfa23('0x14')]);router[_0xfa23('0x15')](_0xfa23('0xa'),auth[_0xfa23('0x8')](),interaction['tracked'](_0xfa23('0x13'),_0xfa23('0x16')),controller[_0xfa23('0x17')]);router[_0xfa23('0x18')](_0xfa23('0xa'),auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0xfa23('0x19')),controller[_0xfa23('0x1a')]);router['delete'](_0xfa23('0x11'),auth[_0xfa23('0x8')](),controller[_0xfa23('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 61b83f1..d228b79 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 _0x3714=['moment','BOOLEAN','DATE','STRING','ENUM','sequelize'];(function(_0x27ee50,_0x2b17fe){var _0x4f3b7e=function(_0x1de332){while(--_0x1de332){_0x27ee50['push'](_0x27ee50['shift']());}};_0x4f3b7e(++_0x2b17fe);}(_0x3714,0x95));var _0x4371=function(_0x183a05,_0x2053c8){_0x183a05=_0x183a05-0x0;var _0x47a8e7=_0x3714[_0x183a05];return _0x47a8e7;};'use strict';var Sequelize=require(_0x4371('0x0'));var moment=require(_0x4371('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4371('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4371('0x3')]},'disposition':{'type':Sequelize[_0x4371('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x4371('0x4')]},'note':{'type':Sequelize[_0x4371('0x4')]},'phone':{'type':Sequelize[_0x4371('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x4371('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x4371('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x4371('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4371('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xd206=['moment','BOOLEAN','DATE','STRING','out','sequelize'];(function(_0x2dbce7,_0x57cb8d){var _0x3a3ed0=function(_0x28c8c6){while(--_0x28c8c6){_0x2dbce7['push'](_0x2dbce7['shift']());}};_0x3a3ed0(++_0x57cb8d);}(_0xd206,0x107));var _0x6d20=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xd206[_0x565ed7];return _0x183ad7;};'use strict';var Sequelize=require(_0x6d20('0x0'));var moment=require(_0x6d20('0x1'));module['exports']={'closed':{'type':Sequelize[_0x6d20('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6d20('0x3')]},'disposition':{'type':Sequelize[_0x6d20('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6d20('0x4')]},'note':{'type':Sequelize[_0x6d20('0x4')]},'phone':{'type':Sequelize[_0x6d20('0x4')]},'read1stAt':{'type':Sequelize[_0x6d20('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x6d20('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6d20('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6d20('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 01cf8d2..4c89014 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 _0x53bb=['start','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','text','body','some','compact','isEmpty','concat','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','user','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','agent','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','Owner.internal','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','params','includeAll','include','options','create','destroy','describe','addMessage','WhatsappMessage','ids','omit','getMessages','pick','format','findAll','rows','addTags','spread','color','emit','removeTags','download','unix','join','root','server','tmp','files','attachments','CmContact','firstName','lastName','Attachment','Messages','direction','secret','Account','Owner','mkdirSync','Whatsapp','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','System','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','undefined','count','limit','apply','update','then','error','stack','name','map','fullname','TagIds','Tags','forEach','push','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','select','field','from','tools_tags','u.id','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','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','ContactId'];(function(_0x8f944c,_0x2d3479){var _0x14921d=function(_0x18111a){while(--_0x18111a){_0x8f944c['push'](_0x8f944c['shift']());}};_0x14921d(++_0x2d3479);}(_0x53bb,0x168));var _0xb53b=function(_0x367c7a,_0x5a0501){_0x367c7a=_0x367c7a-0x0;var _0x301055=_0x53bb[_0x367c7a];return _0x301055;};'use strict';var emlformat=require(_0xb53b('0x0'));var rimraf=require(_0xb53b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb53b('0x2'));var rp=require(_0xb53b('0x3'));var moment=require(_0xb53b('0x4'));var BPromise=require(_0xb53b('0x5'));var Mustache=require(_0xb53b('0x6'));var util=require('util');var path=require('path');var sox=require(_0xb53b('0x7'));var csv=require(_0xb53b('0x8'));var ejs=require(_0xb53b('0x9'));var fs=require('fs');var fs_extra=require(_0xb53b('0xa'));var _=require(_0xb53b('0xb'));var squel=require(_0xb53b('0xc'));var crypto=require(_0xb53b('0xd'));var jsforce=require(_0xb53b('0xe'));var deskjs=require(_0xb53b('0xf'));var toCsv=require(_0xb53b('0x8'));var querystring=require(_0xb53b('0x10'));var Papa=require(_0xb53b('0x11'));var Redis=require(_0xb53b('0x12'));var authService=require(_0xb53b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb53b('0x14'));var pdf=require(_0xb53b('0x15'));var hardwareService=require(_0xb53b('0x16'));var logger=require(_0xb53b('0x17'))(_0xb53b('0x18'));var utils=require(_0xb53b('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb53b('0x1a'))['db'];config[_0xb53b('0x1b')]=_[_0xb53b('0x1c')](config[_0xb53b('0x1b')],{'host':_0xb53b('0x1d'),'port':0x18eb});var socket=require(_0xb53b('0x1e'))(new Redis(config[_0xb53b('0x1b')]));require(_0xb53b('0x1f'))[_0xb53b('0x20')](socket);function respondWithStatusCode(_0x1bbf7e,_0x241360){_0x241360=_0x241360||0xcc;return function(_0x5c13d6){if(_0x5c13d6){return _0x1bbf7e[_0xb53b('0x21')](_0x241360);}return _0x1bbf7e[_0xb53b('0x22')](_0x241360)[_0xb53b('0x23')]();};}function respondWithResult(_0x57c6ca,_0x131c72){_0x131c72=_0x131c72||0xc8;return function(_0x2c2a29){if(_0x2c2a29){return _0x57c6ca[_0xb53b('0x22')](_0x131c72)[_0xb53b('0x24')](_0x2c2a29);}};}function respondWithFilteredResult(_0x5c2113,_0x24c7be){return function(_0x2e795f){if(_0x2e795f){var _0x427d85=typeof _0x24c7be['offset']===_0xb53b('0x25')&&typeof _0x24c7be['limit']===_0xb53b('0x25');var _0x524ec6=_0x2e795f[_0xb53b('0x26')];var _0x3bc8e4=_0x427d85?0x0:_0x24c7be['offset'];var _0x1a5352=_0x427d85?_0x2e795f[_0xb53b('0x26')]:_0x24c7be['offset']+_0x24c7be[_0xb53b('0x27')];var _0x5e62b0;if(_0x1a5352>=_0x524ec6){_0x1a5352=_0x524ec6;_0x5e62b0=0xc8;}else{_0x5e62b0=0xce;}_0x5c2113[_0xb53b('0x22')](_0x5e62b0);return _0x5c2113['set']('Content-Range',_0x3bc8e4+'-'+_0x1a5352+'/'+_0x524ec6)[_0xb53b('0x24')](_0x2e795f);}return null;};}function patchUpdates(_0x2d026d){return function(_0x3d5d95){try{jsonpatch[_0xb53b('0x28')](_0x3d5d95,_0x2d026d,!![]);}catch(_0xb08c49){return BPromise['reject'](_0xb08c49);}return _0x3d5d95['save']();};}function saveUpdates(_0x1f7765,_0x68ca7a){return function(_0x3a0670){if(_0x3a0670){return _0x3a0670[_0xb53b('0x29')](_0x1f7765)['then'](function(_0x3e12ff){return _0x3e12ff;});}return null;};}function removeEntity(_0x1e0341,_0x23c59c){return function(_0x1e26dd){if(_0x1e26dd){return _0x1e26dd['destroy']()[_0xb53b('0x2a')](function(){_0x1e0341[_0xb53b('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c850e,_0x570ddf){return function(_0x388c57){if(!_0x388c57){_0x3c850e[_0xb53b('0x21')](0x194);}return _0x388c57;};}function handleError(_0x31b87f,_0x244f13){_0x244f13=_0x244f13||0x1f4;return function(_0x5b89c1){logger[_0xb53b('0x2b')](_0x5b89c1[_0xb53b('0x2c')]);if(_0x5b89c1[_0xb53b('0x2d')]){delete _0x5b89c1[_0xb53b('0x2d')];}_0x31b87f[_0xb53b('0x22')](_0x244f13)['send'](_0x5b89c1);};}function getInteractionUsers(_0x2ce29b,_0x83fec6){return new BPromise(function(_0x61f89d,_0x502bda){try{if(_0x83fec6[_0x2ce29b['id']]){_0x2ce29b['Users']=_[_0xb53b('0x2e')](_0x83fec6[_0x2ce29b['id']],function(_0x2bc0b6){return{'id':_0x2bc0b6['id'],'fullname':_0x2bc0b6[_0xb53b('0x2f')]};});}}catch(_0x3e855b){_0x502bda(_0x3e855b);}_0x61f89d(_0x2ce29b);});}function getInteractionTags(_0x462d56,_0x146a36){return new BPromise(function(_0x1e6ec3,_0x3e5376){try{if(_0x462d56[_0xb53b('0x30')]){_0x462d56[_0xb53b('0x31')]=[];_0x462d56[_0xb53b('0x30')]['split'](',')[_0xb53b('0x32')](function(_0x28af98){_0x462d56[_0xb53b('0x31')][_0xb53b('0x33')](_0x146a36[_0x28af98]);});}delete _0x462d56[_0xb53b('0x30')];}catch(_0xa61113){_0x3e5376(_0xa61113);}_0x1e6ec3(_0x462d56);});}function updateWhatsappInteraction(_0x11d124,_0x248306,_0x3730cd){return new BPromise(function(_0xcbcb08,_0x47f922){return getInteractionUsers(_0x11d124,_0x3730cd)[_0xb53b('0x2a')](function(_0x481aa2){return getInteractionTags(_0x481aa2,_0x248306);})['then'](function(_0x36cfae){_0xcbcb08(_0x36cfae);})[_0xb53b('0x34')](function(_0x2fb789){_0x47f922(_0x2fb789);});});}exports[_0xb53b('0x35')]=function(_0x31f7e7,_0x17c433){var _0x340a22={},_0x449ba2={},_0x2eb76d={'count':0x0,'rows':[]};var _0x594db0=_[_0xb53b('0x2e')](db[_0xb53b('0x36')][_0xb53b('0x37')],function(_0x681475){return{'name':_0x681475[_0xb53b('0x38')],'type':_0x681475[_0xb53b('0x39')]['key']};});_0x449ba2[_0xb53b('0x3a')]=_[_0xb53b('0x2e')](_0x594db0,_0xb53b('0x2d'));_0x449ba2[_0xb53b('0x3b')]=_[_0xb53b('0x3c')](_0x31f7e7[_0xb53b('0x3b')]);_0x449ba2[_0xb53b('0x3d')]=_['intersection'](_0x449ba2[_0xb53b('0x3a')],_0x449ba2['query']);_0x340a22['attributes']=_[_0xb53b('0x3e')](_0x449ba2[_0xb53b('0x3a')],qs[_0xb53b('0x3f')](_0x31f7e7['query'][_0xb53b('0x3f')]));_0x340a22[_0xb53b('0x40')]=_0x340a22['attributes'][_0xb53b('0x41')]?_0x340a22[_0xb53b('0x40')]:_0x449ba2[_0xb53b('0x3a')];if(!_0x31f7e7['query'][_0xb53b('0x42')](_0xb53b('0x43'))){_0x340a22[_0xb53b('0x27')]=qs[_0xb53b('0x27')](_0x31f7e7[_0xb53b('0x3b')][_0xb53b('0x27')]);_0x340a22[_0xb53b('0x44')]=qs[_0xb53b('0x44')](_0x31f7e7[_0xb53b('0x3b')][_0xb53b('0x44')]);}_0x340a22[_0xb53b('0x45')]=qs[_0xb53b('0x46')](_0x31f7e7[_0xb53b('0x3b')]['sort']);_0x340a22[_0xb53b('0x47')]=qs[_0xb53b('0x3d')](_['pick'](_0x31f7e7['query'],_0x449ba2['filters']),_0x594db0);var _0x54eb0e=[];var _0x4cd25=squel[_0xb53b('0x48')]()['field']('id')[_0xb53b('0x49')]('name')[_0xb53b('0x49')]('color')[_0xb53b('0x4a')](_0xb53b('0x4b'));var _0x46c372=squel[_0xb53b('0x48')]()['field'](_0xb53b('0x4c'))[_0xb53b('0x49')](_0xb53b('0x4d'))['field']('ui.WhatsappInteractionId')[_0xb53b('0x4a')]('user_has_whatsapp_interactions','ui')[_0xb53b('0x4e')](_0xb53b('0x4f'),'u',_0xb53b('0x50'));var _0xbb26b2=squel[_0xb53b('0x48')]()[_0xb53b('0x4a')](_0xb53b('0x51'),'i')[_0xb53b('0x4e')](_0xb53b('0x52'),'c',_0xb53b('0x53'))[_0xb53b('0x4e')](_0xb53b('0x4f'),'o','o.id\x20=\x20i.UserId')[_0xb53b('0x4e')](_0xb53b('0x54'),'a',_0xb53b('0x55'))['left_join']('whatsapp_messages','me',_0xb53b('0x56'))[_0xb53b('0x4e')](_0xb53b('0x57'),'it',_0xb53b('0x58'))[_0xb53b('0x4e')](_0xb53b('0x4b'),'t',_0xb53b('0x59'));var _0x4b81c1=squel[_0xb53b('0x5a')]();var _0x17c633=[];var _0x299dd2=squel[_0xb53b('0x5a')]();var _0x29963a;if(_0x31f7e7[_0xb53b('0x3b')][_0xb53b('0x5b')]){_0x29963a=as['parseSearch'](_0x31f7e7[_0xb53b('0x3b')][_0xb53b('0x5b')]);var _0x401aff=_0x29963a[_0xb53b('0x5c')];for(var _0xe7b410=0x0;_0xe7b410<_0x29963a[_0xb53b('0x5d')][_0xb53b('0x41')];_0xe7b410++){var _0x1aa37b=_0x29963a[_0xb53b('0x5d')][_0xe7b410];var _0x40489c='i';var _0x4b19bf=_['find'](_0x594db0,[_0xb53b('0x2d'),_0x1aa37b['field']]);if(!_0x4b19bf){switch(_0x1aa37b[_0xb53b('0x49')]){case _0xb53b('0x5e'):if(_0x1aa37b[_0xb53b('0x5f')]==0x1){_0xbb26b2[_0xb53b('0x60')]('`'+_0x1aa37b[_0xb53b('0x49')]+_0xb53b('0x61'));}else{_0xbb26b2[_0xb53b('0x60')]('`'+_0x1aa37b[_0xb53b('0x49')]+_0xb53b('0x62'));}break;case _0xb53b('0x63'):if(_0x1aa37b[_0xb53b('0x64')]===_0xb53b('0x65')){if(_0x1aa37b[_0xb53b('0x5f')][_0xb53b('0x66')]('\x20')[_0xb53b('0x41')]>0x1){_0x4b81c1[_0x401aff](_0xb53b('0x67'),qs[_0xb53b('0x68')](_0x1aa37b[_0xb53b('0x5f')]),null);}else{var _0x4b1723='%'+_0x1aa37b[_0xb53b('0x5f')]+'%';_0x4b81c1[_0x401aff]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4b1723,_0x4b1723,_0x4b1723);}}else{_0x4b19bf=_['find'](_0x594db0,['name',_0xb53b('0x69')]);_0x1aa37b['field']='ContactId';_0x8a1b75=as['buildExpression'](_0x40489c,_0x4b19bf[_0xb53b('0x39')],_0x1aa37b);_0x4b81c1[_0x401aff](_0x8a1b75['text'],_0x8a1b75[_0xb53b('0x5f')][_0xb53b('0x6a')],_0x8a1b75[_0xb53b('0x5f')][_0xb53b('0x23')]);}break;case'Tag':var _0x870b40=_0x1aa37b[_0xb53b('0x5f')][_0xb53b('0x66')](',')[_0xb53b('0x2e')](function(_0x51ef76){return Number(_0x51ef76);});_0x870b40[_0xb53b('0x32')](function(_0x49a71c){_0x299dd2['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x49a71c+',%');});_0x17c633=_[_0xb53b('0x6b')](_0x17c633,_0x870b40);break;case _0xb53b('0x6c'):if(_0x1aa37b[_0xb53b('0x64')]===_0xb53b('0x65')){_0x4b81c1[_0x401aff](_0xb53b('0x6d'),'%'+_0x1aa37b[_0xb53b('0x5f')]+'%',null);}else{_0x4b19bf=_[_0xb53b('0x6e')](_0x594db0,[_0xb53b('0x2d'),_0xb53b('0x6f')]);_0x1aa37b[_0xb53b('0x49')]=_0xb53b('0x6f');_0x8a1b75=as[_0xb53b('0x70')](_0x40489c,_0x4b19bf[_0xb53b('0x39')],_0x1aa37b);_0x4b81c1[_0x401aff](_0x8a1b75[_0xb53b('0x71')],_0x8a1b75[_0xb53b('0x5f')][_0xb53b('0x6a')],_0x8a1b75['value'][_0xb53b('0x23')]);}break;case _0xb53b('0x72'):_0x8a1b75=as[_0xb53b('0x70')]('me',null,_0x1aa37b);_0x4b81c1[_0x401aff](_0x8a1b75['text'],_0x8a1b75[_0xb53b('0x5f')][_0xb53b('0x6a')],_0x8a1b75['value'][_0xb53b('0x23')]);break;}}else{var _0x8a1b75=as[_0xb53b('0x70')](_0x40489c,_0x4b19bf[_0xb53b('0x39')],_0x1aa37b);_0x4b81c1[_0x401aff](_0x8a1b75[_0xb53b('0x71')],_0x8a1b75[_0xb53b('0x5f')][_0xb53b('0x6a')],_0x8a1b75['value'][_0xb53b('0x23')]);}}}else{var _0x4c1ccd=_(_0x31f7e7[_0xb53b('0x3b')])[_0xb53b('0x3c')]()[_0xb53b('0x2e')](function(_0x14fbfe){return _[_0xb53b('0x73')](_0x594db0,[_0xb53b('0x2d'),_0x14fbfe])?_0x14fbfe:undefined;})[_0xb53b('0x74')]()[_0xb53b('0x5f')]();if(!_[_0xb53b('0x75')](_0x4c1ccd)){_0x4c1ccd[_0xb53b('0x32')](function(_0x3e6bdf){if(_0x3e6bdf==='WhatsappAccountId'){_0xbb26b2['where']('i.WhatsappAccountId\x20IN\x20?',[][_0xb53b('0x76')](_0x31f7e7[_0xb53b('0x3b')][_0x3e6bdf]));}else if(_0x3e6bdf==='createdAt'){var _0x5a4a48=JSON[_0xb53b('0x77')](_0x31f7e7[_0xb53b('0x3b')][_0x3e6bdf])[_0xb53b('0x78')];var _0x24fc4a=JSON[_0xb53b('0x77')](_0x31f7e7['query'][_0x3e6bdf])['$lte'];_0xbb26b2['where'](_0xb53b('0x79'),_0x5a4a48,_0x24fc4a);}else{if(_0x31f7e7[_0xb53b('0x3b')][_0x3e6bdf]==='null'){_0xbb26b2['where']('i.'+_0x3e6bdf+_0xb53b('0x7a'));}else{_0xbb26b2[_0xb53b('0x47')]('i.'+_0x3e6bdf+_0xb53b('0x7b'),_0x31f7e7[_0xb53b('0x3b')][_0x3e6bdf]);}}});}if(_0x31f7e7[_0xb53b('0x3b')][_0xb53b('0x7c')]){if(_0x31f7e7[_0xb53b('0x3b')][_0xb53b('0x7c')]==0x1){_0xbb26b2[_0xb53b('0x60')]('`unreadMessages`\x20=\x200');}else{_0xbb26b2[_0xb53b('0x60')](_0xb53b('0x7d'));}}if(_0x31f7e7[_0xb53b('0x3b')][_0xb53b('0x7e')]){_0x17c633=_[_0xb53b('0x7f')](_0x31f7e7[_0xb53b('0x3b')][_0xb53b('0x7e')])?_0x31f7e7[_0xb53b('0x3b')]['tag']:new Array(_0x31f7e7['query'][_0xb53b('0x7e')]);_0x17c633['forEach'](function(_0x4c6c1a){_0x299dd2['or'](_0xb53b('0x80'),'%,'+_0x4c6c1a+',%');});}if(_0x31f7e7['query'][_0xb53b('0x81')]){var _0x2fc333=_0x31f7e7['query'][_0xb53b('0x81')][_0xb53b('0x82')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2fc333)){_0x4b81c1['or'](_0xb53b('0x83'),_0x2fc333+'%')['or'](_0xb53b('0x84'),_0x2fc333+'%');}else{_0x4b81c1['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xb53b('0x68')](_0x2fc333))['or'](_0xb53b('0x85'),_0x2fc333+'%');}}}_0xbb26b2[_0xb53b('0x47')](_0x4b81c1);_0xbb26b2[_0xb53b('0x86')](_0xb53b('0x87'));var _0x3508bb={'type':db[_0xb53b('0x88')][_0xb53b('0x89')]['SELECT'],'raw':!![]};var _0x3256c2=_0xbb26b2[_0xb53b('0x8a')]();_0x3256c2['field'](_0xb53b('0x87'));_0x3256c2[_0xb53b('0x49')](_0xb53b('0x8b'),_0xb53b('0x5e'));if(_0x340a22[_0xb53b('0x45')]){_0x340a22[_0xb53b('0x45')]['forEach'](function(_0x11dbba){var _0x94ef67=_0x11dbba[0x0]==='contactName'?_0x11dbba[0x0]:'i.'+_0x11dbba[0x0];_0xbb26b2[_0xb53b('0x45')](_0x94ef67,_0x11dbba[0x1]===_0xb53b('0x8c')?![]:!![]);});}if(!_[_0xb53b('0x75')](_0x17c633)){_0xbb26b2[_0xb53b('0x60')](_0x299dd2);_0x3256c2[_0xb53b('0x47')](_0xb53b('0x8d'),_0x17c633);}BPromise[_0xb53b('0x8e')]()['then'](function(){if(!_0x29963a){if(_0x31f7e7[_0xb53b('0x3b')][_0xb53b('0x8f')])return;_0x3256c2[_0xb53b('0x47')](_0xb53b('0x90'));_0xbb26b2[_0xb53b('0x47')](_0xb53b('0x90'));return;}if(_0x31f7e7['user'][_0xb53b('0x91')]!=='agent')return;return _0x31f7e7[_0xb53b('0x92')][_0xb53b('0x93')]({'attributes':['id'],'raw':!![]})[_0xb53b('0x2a')](function(_0x2a1cd9){if(_['isEmpty'](_0x2a1cd9)){_0x3256c2[_0xb53b('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');_0xbb26b2[_0xb53b('0x47')](_0xb53b('0x94'));}else{_0x3256c2['where'](_0xb53b('0x95'),_[_0xb53b('0x2e')](_0x2a1cd9,'id'));_0xbb26b2['where'](_0xb53b('0x95'),_['map'](_0x2a1cd9,'id'));}});})[_0xb53b('0x2a')](function(){if(_0x31f7e7[_0xb53b('0x92')][_0xb53b('0x91')]===_0xb53b('0x96')&&!_0x29963a&&!_0x31f7e7[_0xb53b('0x3b')][_0xb53b('0x8f')])return[];return db[_0xb53b('0x97')]['query'](_0x3256c2[_0xb53b('0x98')](),_0x3508bb);})['then'](function(_0x36931e){_0x2eb76d[_0xb53b('0x26')]=_0x36931e['length'];if(_0x2eb76d[_0xb53b('0x26')]===0x0)return[];return db['sequelize'][_0xb53b('0x3b')](_0x4cd25[_0xb53b('0x98')](),_0x3508bb)[_0xb53b('0x2a')](function(_0x5af6f1){_0x54eb0e=_['keyBy'](_0x5af6f1,'id');_0x3508bb=_[_0xb53b('0x99')](_0x3508bb,{'model':db[_0xb53b('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x31f7e7[_0xb53b('0x3b')][_0xb53b('0x3f')]){_0x340a22[_0xb53b('0x40')][_0xb53b('0x32')](function(_0x12ca60){_0xbb26b2[_0xb53b('0x49')]('i.'+_0x12ca60);});}else{_0xbb26b2[_0xb53b('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb53b('0x5e'));_0xbb26b2['field'](_0xb53b('0x9a'),_0xb53b('0x9b'));_0xbb26b2[_0xb53b('0x49')](_0xb53b('0x9c'),_0xb53b('0x9d'));_0xbb26b2[_0xb53b('0x49')]('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');_0xbb26b2[_0xb53b('0x49')]('i.*');_0xbb26b2[_0xb53b('0x49')]('c.firstName',_0xb53b('0x9e'));_0xbb26b2[_0xb53b('0x49')](_0xb53b('0x9f'),_0xb53b('0xa0'));_0xbb26b2['field']('c.email',_0xb53b('0xa1'));_0xbb26b2[_0xb53b('0x49')](_0xb53b('0xa2'),'Contact.phone');_0xbb26b2[_0xb53b('0x49')](_0xb53b('0xa3'),_0xb53b('0xa4'));_0xbb26b2[_0xb53b('0x49')]('c.fax','Contact.fax');_0xbb26b2[_0xb53b('0x49')](_0xb53b('0xa5'),_0xb53b('0xa6'));_0xbb26b2[_0xb53b('0x49')](_0xb53b('0xa7'),_0xb53b('0xa8'));_0xbb26b2[_0xb53b('0x49')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x340a22[_0xb53b('0x27')])_0xbb26b2['limit'](_0x340a22['limit']);if(_0x340a22['offset'])_0xbb26b2['offset'](_0x340a22[_0xb53b('0x44')]);return db[_0xb53b('0x97')][_0xb53b('0x3b')](_0xbb26b2[_0xb53b('0x98')](),_0x3508bb);})[_0xb53b('0x2a')](function(_0x5e8309){if(_0x5e8309[_0xb53b('0x41')]>0x0)_0x46c372[_0xb53b('0x47')](_0xb53b('0xa9'),_[_0xb53b('0x2e')](_0x5e8309,'id'));return db['sequelize'][_0xb53b('0x3b')](_0x46c372[_0xb53b('0x98')](),_0x3508bb)['then'](function(_0x270256){var _0x3e985b=_[_0xb53b('0xaa')](_0x270256,_0xb53b('0xab'));var _0x1bea9c=[];_0x5e8309[_0xb53b('0x32')](function(_0x46b42d){_0x1bea9c[_0xb53b('0x33')](updateWhatsappInteraction(_0x46b42d,_0x54eb0e,_0x3e985b));});return BPromise[_0xb53b('0xac')](_0x1bea9c);});});})[_0xb53b('0x2a')](function(_0x21c3fd){_0x2eb76d['rows']=_0x21c3fd;return _0x2eb76d;})[_0xb53b('0x2a')](respondWithFilteredResult(_0x17c433,_0x340a22))[_0xb53b('0x34')](handleError(_0x17c433,null));};exports['show']=function(_0x52f750,_0x3836fb){var _0x3212d6={'raw':![],'where':{'id':_0x52f750[_0xb53b('0xad')]['id']}},_0x4a6db3={};_0x4a6db3[_0xb53b('0x3a')]=_['keys'](db['WhatsappInteraction'][_0xb53b('0x37')]);_0x4a6db3[_0xb53b('0x3b')]=_[_0xb53b('0x3c')](_0x52f750[_0xb53b('0x3b')]);_0x4a6db3['filters']=_[_0xb53b('0x3e')](_0x4a6db3[_0xb53b('0x3a')],_0x4a6db3[_0xb53b('0x3b')]);_0x3212d6[_0xb53b('0x40')]=_[_0xb53b('0x3e')](_0x4a6db3[_0xb53b('0x3a')],qs[_0xb53b('0x3f')](_0x52f750[_0xb53b('0x3b')][_0xb53b('0x3f')]));_0x3212d6[_0xb53b('0x40')]=_0x3212d6[_0xb53b('0x40')]['length']?_0x3212d6[_0xb53b('0x40')]:_0x4a6db3[_0xb53b('0x3a')];if(_0x52f750[_0xb53b('0x3b')][_0xb53b('0xae')]){_0x3212d6[_0xb53b('0xaf')]=[{'all':!![]}];}_0x3212d6=_[_0xb53b('0x99')]({},_0x3212d6,_0x52f750[_0xb53b('0xb0')]);return db[_0xb53b('0x36')][_0xb53b('0x6e')](_0x3212d6)[_0xb53b('0x2a')](handleEntityNotFound(_0x3836fb,null))[_0xb53b('0x2a')](respondWithResult(_0x3836fb,null))['catch'](handleError(_0x3836fb,null));};exports[_0xb53b('0xb1')]=function(_0x227d25,_0xa49c83){return db[_0xb53b('0x36')][_0xb53b('0xb1')](_0x227d25['body'],{})['then'](respondWithResult(_0xa49c83,0xc9))[_0xb53b('0x34')](handleError(_0xa49c83,null));};exports[_0xb53b('0x29')]=function(_0x41e719,_0x26c5aa){if(_0x41e719[_0xb53b('0x72')]['id']){delete _0x41e719['body']['id'];}return db['WhatsappInteraction']['find']({'where':{'id':_0x41e719[_0xb53b('0xad')]['id']}})[_0xb53b('0x2a')](handleEntityNotFound(_0x26c5aa,null))[_0xb53b('0x2a')](saveUpdates(_0x41e719[_0xb53b('0x72')],null))[_0xb53b('0x2a')](respondWithResult(_0x26c5aa,null))['catch'](handleError(_0x26c5aa,null));};exports[_0xb53b('0xb2')]=function(_0x5a14db,_0x49c399){return db[_0xb53b('0x36')][_0xb53b('0x6e')]({'where':{'id':_0x5a14db[_0xb53b('0xad')]['id']}})['then'](handleEntityNotFound(_0x49c399,null))[_0xb53b('0x2a')](removeEntity(_0x49c399,null))['catch'](handleError(_0x49c399,null));};exports['describe']=function(_0x2a2579,_0x2311b2){return db[_0xb53b('0x36')][_0xb53b('0xb3')]()[_0xb53b('0x2a')](respondWithResult(_0x2311b2,null))['catch'](handleError(_0x2311b2,null));};exports[_0xb53b('0xb4')]=function(_0x144928,_0x1d4c12,_0x29afe7){return db[_0xb53b('0xb5')][_0xb53b('0x6e')]({'where':{'id':_0x144928['params']['id']}})[_0xb53b('0x2a')](handleEntityNotFound(_0x1d4c12,null))[_0xb53b('0x2a')](function(_0x16cede){if(_0x16cede){return _0x16cede['addMessage'](_0x144928[_0xb53b('0x72')][_0xb53b('0xb6')],_[_0xb53b('0xb7')](_0x144928[_0xb53b('0x72')],[_0xb53b('0xb6'),'id'])||{});}})[_0xb53b('0x2a')](respondWithResult(_0x1d4c12,null))[_0xb53b('0x34')](handleError(_0x1d4c12,null));};exports[_0xb53b('0xb8')]=function(_0x3c7abc,_0x506b85,_0x164628){var _0x4ea046={'raw':![],'where':{}};var _0x45bedb={};var _0xec075d={'count':0x0,'rows':[]};return db[_0xb53b('0x36')]['findOne']({'where':{'id':_0x3c7abc[_0xb53b('0xad')]['id']}})['then'](handleEntityNotFound(_0x506b85,null))['then'](function(_0x1d9cbe){if(_0x1d9cbe){_0x45bedb[_0xb53b('0x3a')]=_[_0xb53b('0x3c')](db[_0xb53b('0xb5')][_0xb53b('0x37')]);_0x45bedb[_0xb53b('0x3b')]=_[_0xb53b('0x3c')](_0x3c7abc[_0xb53b('0x3b')]);_0x45bedb['filters']=_[_0xb53b('0x3e')](_0x45bedb[_0xb53b('0x3a')],_0x45bedb[_0xb53b('0x3b')]);_0x4ea046['attributes']=_[_0xb53b('0x3e')](_0x45bedb[_0xb53b('0x3a')],qs[_0xb53b('0x3f')](_0x3c7abc[_0xb53b('0x3b')][_0xb53b('0x3f')]));_0x4ea046[_0xb53b('0x40')]=_0x4ea046[_0xb53b('0x40')][_0xb53b('0x41')]?_0x4ea046[_0xb53b('0x40')]:_0x45bedb[_0xb53b('0x3a')];if(!_0x3c7abc[_0xb53b('0x3b')][_0xb53b('0x42')]('nolimit')){_0x4ea046['limit']=qs[_0xb53b('0x27')](_0x3c7abc[_0xb53b('0x3b')][_0xb53b('0x27')]);_0x4ea046['offset']=qs[_0xb53b('0x44')](_0x3c7abc[_0xb53b('0x3b')][_0xb53b('0x44')]);}_0x4ea046[_0xb53b('0x45')]=qs[_0xb53b('0x46')](_0x3c7abc['query']['sort']);_0x4ea046[_0xb53b('0x47')]=qs[_0xb53b('0x3d')](_[_0xb53b('0xb9')](_0x3c7abc['query'],_0x45bedb[_0xb53b('0x3d')]));_0x4ea046[_0xb53b('0x47')]['WhatsappInteractionId']=_0x1d9cbe['id'];if(_0x3c7abc['query']['filter']){_0x4ea046[_0xb53b('0x47')]=_[_0xb53b('0x99')](_0x4ea046[_0xb53b('0x47')],{'$or':_[_0xb53b('0x2e')](_0x4ea046[_0xb53b('0x40')],function(_0x4fb164){var _0x136298={};_0x136298[_0x4fb164]={'$like':'%'+_0x3c7abc[_0xb53b('0x3b')][_0xb53b('0x81')]+'%'};return _0x136298;})});}if(_0x3c7abc[_0xb53b('0x3b')][_0xb53b('0x78')]){var _0x8af68e=_0x3c7abc[_0xb53b('0x3b')][_0xb53b('0x78')]['split'](',');var _0x246294={};_0x246294[_0x8af68e[0x0]]={'$gte':moment(_0x8af68e[0x1])[_0xb53b('0xba')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4ea046[_0xb53b('0x47')]=_[_0xb53b('0x99')](_0x4ea046['where'],_0x246294);}_0x4ea046=_[_0xb53b('0x99')]({},_0x4ea046,_0x3c7abc[_0xb53b('0xb0')]);return db[_0xb53b('0xb5')][_0xb53b('0x26')]({'where':_0x4ea046[_0xb53b('0x47')]})[_0xb53b('0x2a')](function(_0xa2c9c4){_0xec075d[_0xb53b('0x26')]=_0xa2c9c4;if(_0x3c7abc[_0xb53b('0x3b')][_0xb53b('0xae')]){_0x4ea046[_0xb53b('0xaf')]=[{'all':!![]}];}return db[_0xb53b('0xb5')][_0xb53b('0xbb')](_0x4ea046);})[_0xb53b('0x2a')](function(_0x5e9470){_0xec075d[_0xb53b('0xbc')]=_0x5e9470;return _0xec075d;});}})['then'](respondWithFilteredResult(_0x506b85,_0x4ea046))[_0xb53b('0x34')](handleError(_0x506b85,null));};exports[_0xb53b('0xbd')]=function(_0x48e094,_0x295c75,_0x1cc68d){return db[_0xb53b('0x36')][_0xb53b('0x6e')]({'where':{'id':_0x48e094[_0xb53b('0xad')]['id']}})[_0xb53b('0x2a')](handleEntityNotFound(_0x295c75,null))[_0xb53b('0x2a')](function(_0x275ef4){if(_0x275ef4){return _0x275ef4['setTags'](_0x48e094[_0xb53b('0x72')][_0xb53b('0xb6')],_[_0xb53b('0xb7')](_0x48e094[_0xb53b('0x72')],[_0xb53b('0xb6'),'id'])||{})[_0xb53b('0xbe')](function(){return db['Tag'][_0xb53b('0xbb')]({'attributes':['id','name',_0xb53b('0xbf')],'where':{'id':_0x48e094[_0xb53b('0x72')][_0xb53b('0xb6')]}});})['then'](function(_0x12f712){socket[_0xb53b('0xc0')]('whatsappInteractionTags:save',{'id':Number(_0x48e094[_0xb53b('0xad')]['id']),'tags':_0x12f712||[]});return{'id':Number(_0x48e094['params']['id']),'tags':_0x12f712||[]};});}})[_0xb53b('0x2a')](respondWithResult(_0x295c75,null))[_0xb53b('0x34')](handleError(_0x295c75,null));};exports[_0xb53b('0xc1')]=function(_0x3be20e,_0x4fd317,_0x452e32){return db[_0xb53b('0x36')][_0xb53b('0x6e')]({'where':{'id':_0x3be20e[_0xb53b('0xad')]['id']}})['then'](handleEntityNotFound(_0x4fd317,null))[_0xb53b('0x2a')](function(_0x16326e){if(_0x16326e){return _0x16326e[_0xb53b('0xc1')](_0x3be20e[_0xb53b('0x3b')][_0xb53b('0xb6')]);}})[_0xb53b('0x2a')](respondWithStatusCode(_0x4fd317,null))['catch'](handleError(_0x4fd317,null));};exports[_0xb53b('0xc2')]=function(_0x786215,_0x3723d5){var _0x18ad48=moment()[_0xb53b('0xc3')]()[_0xb53b('0x98')]();var _0x518ea1=path[_0xb53b('0xc4')](config[_0xb53b('0xc5')],_0xb53b('0xc6'),'files',_0xb53b('0xc7'));var _0x28a51c=path['join'](config[_0xb53b('0xc5')],_0xb53b('0xc6'),_0xb53b('0xc8'),_0xb53b('0xc9'));var _0x308dba=path[_0xb53b('0xc4')](_0x518ea1,_0x18ad48);var _0x151679=util[_0xb53b('0xba')]('transcript-%d-%s.zip',_0x786215[_0xb53b('0xad')]['id'],_0x18ad48);var _0x165490=path[_0xb53b('0xc4')](_0x518ea1,_0x151679);var _0x118ab9=[];_0x118ab9[_0xb53b('0x33')]({'model':db[_0xb53b('0x6c')],'as':_0xb53b('0x6c'),'attributes':['id',_0xb53b('0x2f')],'raw':!![]});_0x118ab9[_0xb53b('0x33')]({'model':db[_0xb53b('0xca')],'as':_0xb53b('0x63'),'attributes':['id',_0xb53b('0xcb'),_0xb53b('0xcc')],'raw':!![]});if(_0x786215[_0xb53b('0x3b')][_0xb53b('0xc9')]){_0x118ab9[_0xb53b('0x33')]({'model':db['Attachment'],'as':_0xb53b('0xcd'),'raw':!![]});}var _0x4ef0d5=[{'model':db['WhatsappMessage'],'as':_0xb53b('0xce'),'attributes':['id','body','createdAt',_0xb53b('0xcf'),_0xb53b('0xd0'),_0xb53b('0x7c')],'include':_0x118ab9}];_0x4ef0d5[_0xb53b('0x33')]({'model':db['WhatsappAccount'],'as':_0xb53b('0xd1'),'attributes':['id',_0xb53b('0x2d')]});_0x4ef0d5[_0xb53b('0x33')]({'model':db[_0xb53b('0x6c')],'as':_0xb53b('0xd2'),'attributes':['id',_0xb53b('0x2f')]});return db[_0xb53b('0x36')][_0xb53b('0x6e')]({'where':{'id':_0x786215[_0xb53b('0xad')]['id']},'include':_0x4ef0d5})[_0xb53b('0x2a')](handleEntityNotFound(_0x3723d5,null))[_0xb53b('0x2a')](function(_0x579368){if(_0x579368){var _0x3bc9c2=_0x579368['get']({'plain':!![]});fs[_0xb53b('0xd3')](_0x308dba);var _0x28f58d={'channel':_0xb53b('0xd4'),'account':_0x3bc9c2[_0xb53b('0xd1')][_0xb53b('0x2d')],'agent':_0x3bc9c2[_0xb53b('0xd2')]?_0x3bc9c2[_0xb53b('0xd2')][_0xb53b('0x2f')]:_0xb53b('0xd5'),'createdAt':moment(_0x3bc9c2[_0xb53b('0xd6')])[_0xb53b('0xba')](_0xb53b('0xd7'))[_0xb53b('0x98')](),'closedAt':_0x3bc9c2[_0xb53b('0xd8')]?moment(_0x3bc9c2[_0xb53b('0xd9')])[_0xb53b('0xba')](_0xb53b('0xd7'))[_0xb53b('0x98')]():'','disposition':_0x3bc9c2[_0xb53b('0xda')],'messages':_(_0x3bc9c2[_0xb53b('0xce')])[_0xb53b('0x81')]({'secret':![]})['map'](function(_0xa97bc8){if(_0xa97bc8[_0xb53b('0xcd')]){var _0x2f9f8d=path[_0xb53b('0xc4')](_0x28a51c,_0xa97bc8[_0xb53b('0xcd')][_0xb53b('0xdb')]);if(fs[_0xb53b('0xdc')](_0x2f9f8d)){fs[_0xb53b('0xdd')](_0x2f9f8d)[_0xb53b('0xde')](fs['createWriteStream'](path[_0xb53b('0xc4')](_0x308dba,_0xa97bc8[_0xb53b('0xcd')][_0xb53b('0xdb')])));}}return{'date':moment(_0xa97bc8['createdAt'])[_0xb53b('0xba')](_0xb53b('0xd7'))[_0xb53b('0x98')](),'sender':_0xa97bc8[_0xb53b('0xcf')]==='out'?_0xa97bc8[_0xb53b('0x6c')]?_0xa97bc8[_0xb53b('0x6c')][_0xb53b('0x2f')]:_0xb53b('0xdf'):_0xa97bc8[_0xb53b('0x63')][_0xb53b('0xcb')]+(_0xa97bc8[_0xb53b('0x63')][_0xb53b('0xcc')]?'\x20'+_0xa97bc8[_0xb53b('0x63')][_0xb53b('0xcc')]:''),'body':_0xa97bc8[_0xb53b('0xcd')]?_0xa97bc8[_0xb53b('0xcd')][_0xb53b('0xdb')]:_0xa97bc8[_0xb53b('0x72')],'direction':_0xa97bc8[_0xb53b('0xcf')]===_0xb53b('0xe0')?'A':'C','secret':_0xa97bc8['secret'],'read':_0xa97bc8[_0xb53b('0x7c')],'attachment':_0xa97bc8['Attachment']};})['value']()};return ejs[_0xb53b('0xe1')](path[_0xb53b('0xc4')](config['root'],_0xb53b('0xc6'),_0xb53b('0xe2'),_0xb53b('0xe3')),{'interaction':_0x28f58d})[_0xb53b('0x2a')](function(_0x3cc23e){var _0x5a7895=path[_0xb53b('0xc4')](_0x308dba,_0xb53b('0xe4')+_0x3bc9c2['id']+'-'+_0x18ad48+_0xb53b('0xe5'));var _0x1925ed={'path':_0x5a7895,'channel':_0xb53b('0xd4'),'interactionId':_0x3bc9c2['id']};return pdf['createPdfFromHTML'](_0x3cc23e,_0x1925ed);})[_0xb53b('0x2a')](function(){return new BPromise(function(_0x393b0c,_0x1b2016){zipdir(_0x308dba,{'saveTo':_0x165490},function(_0x5645f1,_0x2b11fa){if(_0x5645f1)return _0x1b2016(_0x5645f1);return _0x393b0c(_0x2b11fa);});})['then'](function(){return new BPromise(function(_0x25831d,_0x48a795){rimraf(_0x308dba,function(_0x2cf616){if(_0x2cf616)_0x48a795(_0x2cf616);return _0x25831d();});});})[_0xb53b('0x2a')](function(){return _0x3723d5[_0xb53b('0xc2')](_0x165490,_0x151679,function(_0xcd87ee){if(_0xcd87ee){console[_0xb53b('0xe6')](_0xb53b('0xe7'),_0xcd87ee);}else{fs[_0xb53b('0xe8')](_0x165490);}});});});}else{return _0x3723d5[_0xb53b('0x21')](0xc8);}})['catch'](handleError(_0x3723d5,null));}; \ No newline at end of file +var _0xd634=['order','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','getWhatsappAccounts','user','sequelize','toString','keyBy','merge','WhatsappInteraction','a.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.*','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','show','params','includeAll','include','options','create','body','update','describe','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','format','WhatsappMessage','rows','setTags','spread','findAll','emit','removeTags','download','unix','join','root','server','tmp','files','attachments','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','basename','existsSync','createReadStream','createWriteStream','System','firstName','out','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','end','status','json','offset','limit','count','set','Content-Range','reject','destroy','error','name','send','map','fullname','TagIds','Tags','split','forEach','push','then','catch','index','rawAttributes','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','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','expr','parseSearch','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages'];(function(_0x5eb31d,_0x5f17f8){var _0x7ead52=function(_0x5148eb){while(--_0x5148eb){_0x5eb31d['push'](_0x5eb31d['shift']());}};_0x7ead52(++_0x5f17f8);}(_0xd634,0x151));var _0x4d63=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0xd634[_0x10f68e];return _0x4c8372;};'use strict';var emlformat=require(_0x4d63('0x0'));var rimraf=require(_0x4d63('0x1'));var zipdir=require(_0x4d63('0x2'));var jsonpatch=require(_0x4d63('0x3'));var rp=require(_0x4d63('0x4'));var moment=require(_0x4d63('0x5'));var BPromise=require(_0x4d63('0x6'));var Mustache=require(_0x4d63('0x7'));var util=require(_0x4d63('0x8'));var path=require(_0x4d63('0x9'));var sox=require('sox');var csv=require(_0x4d63('0xa'));var ejs=require(_0x4d63('0xb'));var fs=require('fs');var fs_extra=require(_0x4d63('0xc'));var _=require(_0x4d63('0xd'));var squel=require(_0x4d63('0xe'));var crypto=require(_0x4d63('0xf'));var jsforce=require(_0x4d63('0x10'));var deskjs=require(_0x4d63('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4d63('0x12'));var Redis=require('ioredis');var authService=require(_0x4d63('0x13'));var qs=require(_0x4d63('0x14'));var as=require(_0x4d63('0x15'));var pdf=require(_0x4d63('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d63('0x17'))('api');var utils=require(_0x4d63('0x18'));var config=require(_0x4d63('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4d63('0x1a'))['db'];config[_0x4d63('0x1b')]=_[_0x4d63('0x1c')](config[_0x4d63('0x1b')],{'host':_0x4d63('0x1d'),'port':0x18eb});var socket=require(_0x4d63('0x1e'))(new Redis(config[_0x4d63('0x1b')]));require(_0x4d63('0x1f'))[_0x4d63('0x20')](socket);function respondWithStatusCode(_0x8798f4,_0xe4e28f){_0xe4e28f=_0xe4e28f||0xcc;return function(_0x2454cc){if(_0x2454cc){return _0x8798f4[_0x4d63('0x21')](_0xe4e28f);}return _0x8798f4['status'](_0xe4e28f)[_0x4d63('0x22')]();};}function respondWithResult(_0x3ab719,_0x6c70){_0x6c70=_0x6c70||0xc8;return function(_0x3ed512){if(_0x3ed512){return _0x3ab719[_0x4d63('0x23')](_0x6c70)[_0x4d63('0x24')](_0x3ed512);}};}function respondWithFilteredResult(_0x71bd5d,_0x20f810){return function(_0x413050){if(_0x413050){var _0x603dc3=typeof _0x20f810[_0x4d63('0x25')]==='undefined'&&typeof _0x20f810[_0x4d63('0x26')]==='undefined';var _0x4eb889=_0x413050[_0x4d63('0x27')];var _0x56e31d=_0x603dc3?0x0:_0x20f810[_0x4d63('0x25')];var _0x230af4=_0x603dc3?_0x413050[_0x4d63('0x27')]:_0x20f810[_0x4d63('0x25')]+_0x20f810['limit'];var _0x40a7a8;if(_0x230af4>=_0x4eb889){_0x230af4=_0x4eb889;_0x40a7a8=0xc8;}else{_0x40a7a8=0xce;}_0x71bd5d[_0x4d63('0x23')](_0x40a7a8);return _0x71bd5d[_0x4d63('0x28')](_0x4d63('0x29'),_0x56e31d+'-'+_0x230af4+'/'+_0x4eb889)[_0x4d63('0x24')](_0x413050);}return null;};}function patchUpdates(_0x45382e){return function(_0x3e0309){try{jsonpatch['apply'](_0x3e0309,_0x45382e,!![]);}catch(_0x16b914){return BPromise[_0x4d63('0x2a')](_0x16b914);}return _0x3e0309['save']();};}function saveUpdates(_0x1fd6e3,_0x1b2414){return function(_0x671dcf){if(_0x671dcf){return _0x671dcf['update'](_0x1fd6e3)['then'](function(_0x3171df){return _0x3171df;});}return null;};}function removeEntity(_0xd0cf52,_0x5f3aef){return function(_0x246148){if(_0x246148){return _0x246148[_0x4d63('0x2b')]()['then'](function(){_0xd0cf52[_0x4d63('0x23')](0xcc)[_0x4d63('0x22')]();});}};}function handleEntityNotFound(_0x8065f2,_0x40e76b){return function(_0x43daaf){if(!_0x43daaf){_0x8065f2[_0x4d63('0x21')](0x194);}return _0x43daaf;};}function handleError(_0x422b46,_0x26e66f){_0x26e66f=_0x26e66f||0x1f4;return function(_0x27d639){logger[_0x4d63('0x2c')](_0x27d639['stack']);if(_0x27d639[_0x4d63('0x2d')]){delete _0x27d639[_0x4d63('0x2d')];}_0x422b46[_0x4d63('0x23')](_0x26e66f)[_0x4d63('0x2e')](_0x27d639);};}function getInteractionUsers(_0x357af3,_0x3593b5){return new BPromise(function(_0x4ee7a5,_0x2b0711){try{if(_0x3593b5[_0x357af3['id']]){_0x357af3['Users']=_[_0x4d63('0x2f')](_0x3593b5[_0x357af3['id']],function(_0x2b6836){return{'id':_0x2b6836['id'],'fullname':_0x2b6836[_0x4d63('0x30')]};});}}catch(_0x5091b5){_0x2b0711(_0x5091b5);}_0x4ee7a5(_0x357af3);});}function getInteractionTags(_0x450097,_0x59a405){return new BPromise(function(_0x205f75,_0x1178a7){try{if(_0x450097[_0x4d63('0x31')]){_0x450097[_0x4d63('0x32')]=[];_0x450097['TagIds'][_0x4d63('0x33')](',')[_0x4d63('0x34')](function(_0x3480ce){_0x450097['Tags'][_0x4d63('0x35')](_0x59a405[_0x3480ce]);});}delete _0x450097['TagIds'];}catch(_0x53b6e1){_0x1178a7(_0x53b6e1);}_0x205f75(_0x450097);});}function updateWhatsappInteraction(_0x10fa6b,_0xe4ae35,_0x4f2f1e){return new BPromise(function(_0x372230,_0x117c44){return getInteractionUsers(_0x10fa6b,_0x4f2f1e)[_0x4d63('0x36')](function(_0x346b1b){return getInteractionTags(_0x346b1b,_0xe4ae35);})[_0x4d63('0x36')](function(_0x4ada4e){_0x372230(_0x4ada4e);})[_0x4d63('0x37')](function(_0x4292e9){_0x117c44(_0x4292e9);});});}exports[_0x4d63('0x38')]=function(_0x553f56,_0x2dba14){var _0x2a73bd={},_0x5a56bd={},_0x2495e5={'count':0x0,'rows':[]};var _0x197a3d=_[_0x4d63('0x2f')](db['WhatsappInteraction'][_0x4d63('0x39')],function(_0x2b01be){return{'name':_0x2b01be[_0x4d63('0x3a')],'type':_0x2b01be[_0x4d63('0x3b')]['key']};});_0x5a56bd[_0x4d63('0x3c')]=_[_0x4d63('0x2f')](_0x197a3d,'name');_0x5a56bd['query']=_[_0x4d63('0x3d')](_0x553f56['query']);_0x5a56bd[_0x4d63('0x3e')]=_['intersection'](_0x5a56bd['model'],_0x5a56bd[_0x4d63('0x3f')]);_0x2a73bd[_0x4d63('0x40')]=_[_0x4d63('0x41')](_0x5a56bd[_0x4d63('0x3c')],qs[_0x4d63('0x42')](_0x553f56[_0x4d63('0x3f')][_0x4d63('0x42')]));_0x2a73bd['attributes']=_0x2a73bd[_0x4d63('0x40')][_0x4d63('0x43')]?_0x2a73bd[_0x4d63('0x40')]:_0x5a56bd['model'];if(!_0x553f56['query']['hasOwnProperty'](_0x4d63('0x44'))){_0x2a73bd[_0x4d63('0x26')]=qs[_0x4d63('0x26')](_0x553f56[_0x4d63('0x3f')]['limit']);_0x2a73bd[_0x4d63('0x25')]=qs[_0x4d63('0x25')](_0x553f56[_0x4d63('0x3f')][_0x4d63('0x25')]);}_0x2a73bd['order']=qs[_0x4d63('0x45')](_0x553f56[_0x4d63('0x3f')][_0x4d63('0x45')]);_0x2a73bd[_0x4d63('0x46')]=qs['filters'](_[_0x4d63('0x47')](_0x553f56[_0x4d63('0x3f')],_0x5a56bd[_0x4d63('0x3e')]),_0x197a3d);var _0x9126c=[];var _0x4f474a=squel[_0x4d63('0x48')]()[_0x4d63('0x49')]('id')[_0x4d63('0x49')](_0x4d63('0x2d'))[_0x4d63('0x49')](_0x4d63('0x4a'))[_0x4d63('0x4b')](_0x4d63('0x4c'));var _0x21cc0b=squel[_0x4d63('0x48')]()[_0x4d63('0x49')](_0x4d63('0x4d'))[_0x4d63('0x49')](_0x4d63('0x4e'))['field'](_0x4d63('0x4f'))[_0x4d63('0x4b')](_0x4d63('0x50'),'ui')[_0x4d63('0x51')](_0x4d63('0x52'),'u',_0x4d63('0x53'));var _0x35f860=squel[_0x4d63('0x48')]()[_0x4d63('0x4b')](_0x4d63('0x54'),'i')[_0x4d63('0x51')](_0x4d63('0x55'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4d63('0x51')](_0x4d63('0x52'),'o',_0x4d63('0x56'))[_0x4d63('0x51')](_0x4d63('0x57'),'a',_0x4d63('0x58'))[_0x4d63('0x51')](_0x4d63('0x59'),'me',_0x4d63('0x5a'))[_0x4d63('0x51')](_0x4d63('0x5b'),'it',_0x4d63('0x5c'))[_0x4d63('0x51')]('tools_tags','t','t.id\x20=\x20it.TagId');var _0x1a44d6=squel[_0x4d63('0x5d')]();var _0x3e476b=[];var _0x3f82d3=squel[_0x4d63('0x5d')]();var _0x133d00;if(_0x553f56[_0x4d63('0x3f')]['search']){_0x133d00=as[_0x4d63('0x5e')](_0x553f56[_0x4d63('0x3f')]['search']);var _0x355024=_0x133d00[_0x4d63('0x5f')];for(var _0x18061e=0x0;_0x18061e<_0x133d00[_0x4d63('0x60')][_0x4d63('0x43')];_0x18061e++){var _0xdaa4f5=_0x133d00['conditions'][_0x18061e];var _0x14bbcc='i';var _0x267956=_[_0x4d63('0x61')](_0x197a3d,['name',_0xdaa4f5[_0x4d63('0x49')]]);if(!_0x267956){switch(_0xdaa4f5['field']){case'unreadMessages':if(_0xdaa4f5[_0x4d63('0x62')]==0x1){_0x35f860[_0x4d63('0x63')]('`'+_0xdaa4f5[_0x4d63('0x49')]+_0x4d63('0x64'));}else{_0x35f860[_0x4d63('0x63')]('`'+_0xdaa4f5[_0x4d63('0x49')]+_0x4d63('0x65'));}break;case _0x4d63('0x66'):if(_0xdaa4f5[_0x4d63('0x67')]===_0x4d63('0x68')){if(_0xdaa4f5[_0x4d63('0x62')][_0x4d63('0x33')]('\x20')[_0x4d63('0x43')]>0x1){_0x1a44d6[_0x355024](_0x4d63('0x69'),qs[_0x4d63('0x6a')](_0xdaa4f5[_0x4d63('0x62')]),null);}else{var _0x172d55='%'+_0xdaa4f5[_0x4d63('0x62')]+'%';_0x1a44d6[_0x355024](_0x4d63('0x6b'),_0x172d55,_0x172d55,_0x172d55);}}else{_0x267956=_[_0x4d63('0x61')](_0x197a3d,['name',_0x4d63('0x6c')]);_0xdaa4f5[_0x4d63('0x49')]=_0x4d63('0x6c');_0x4a5c97=as[_0x4d63('0x6d')](_0x14bbcc,_0x267956[_0x4d63('0x3b')],_0xdaa4f5);_0x1a44d6[_0x355024](_0x4a5c97[_0x4d63('0x6e')],_0x4a5c97['value']['start'],_0x4a5c97['value'][_0x4d63('0x22')]);}break;case'Tag':var _0x52cd1c=_0xdaa4f5[_0x4d63('0x62')][_0x4d63('0x33')](',')[_0x4d63('0x2f')](function(_0x5067dc){return Number(_0x5067dc);});_0x52cd1c[_0x4d63('0x34')](function(_0x2455b5){_0x3f82d3['or'](_0x4d63('0x6f'),'%,'+_0x2455b5+',%');});_0x3e476b=_[_0x4d63('0x70')](_0x3e476b,_0x52cd1c);break;case _0x4d63('0x71'):if(_0xdaa4f5['operator']===_0x4d63('0x68')){_0x1a44d6[_0x355024](_0x4d63('0x72'),'%'+_0xdaa4f5[_0x4d63('0x62')]+'%',null);}else{_0x267956=_[_0x4d63('0x61')](_0x197a3d,[_0x4d63('0x2d'),'UserId']);_0xdaa4f5['field']=_0x4d63('0x73');_0x4a5c97=as[_0x4d63('0x6d')](_0x14bbcc,_0x267956[_0x4d63('0x3b')],_0xdaa4f5);_0x1a44d6[_0x355024](_0x4a5c97[_0x4d63('0x6e')],_0x4a5c97[_0x4d63('0x62')][_0x4d63('0x74')],_0x4a5c97['value']['end']);}break;case'body':_0x4a5c97=as[_0x4d63('0x6d')]('me',null,_0xdaa4f5);_0x1a44d6[_0x355024](_0x4a5c97[_0x4d63('0x6e')],_0x4a5c97[_0x4d63('0x62')]['start'],_0x4a5c97[_0x4d63('0x62')][_0x4d63('0x22')]);break;}}else{var _0x4a5c97=as[_0x4d63('0x6d')](_0x14bbcc,_0x267956['type'],_0xdaa4f5);_0x1a44d6[_0x355024](_0x4a5c97['text'],_0x4a5c97[_0x4d63('0x62')][_0x4d63('0x74')],_0x4a5c97[_0x4d63('0x62')]['end']);}}}else{var _0x42b369=_(_0x553f56[_0x4d63('0x3f')])['keys']()[_0x4d63('0x2f')](function(_0x5bd128){return _[_0x4d63('0x75')](_0x197a3d,['name',_0x5bd128])?_0x5bd128:undefined;})[_0x4d63('0x76')]()[_0x4d63('0x62')]();if(!_[_0x4d63('0x77')](_0x42b369)){_0x42b369[_0x4d63('0x34')](function(_0x18ac06){if(_0x18ac06===_0x4d63('0x78')){_0x35f860[_0x4d63('0x46')](_0x4d63('0x79'),[][_0x4d63('0x7a')](_0x553f56[_0x4d63('0x3f')][_0x18ac06]));}else if(_0x18ac06===_0x4d63('0x7b')){var _0x1f0e65=JSON[_0x4d63('0x7c')](_0x553f56[_0x4d63('0x3f')][_0x18ac06])[_0x4d63('0x7d')];var _0x395186=JSON[_0x4d63('0x7c')](_0x553f56[_0x4d63('0x3f')][_0x18ac06])[_0x4d63('0x7e')];_0x35f860[_0x4d63('0x46')](_0x4d63('0x7f'),_0x1f0e65,_0x395186);}else{if(_0x553f56['query'][_0x18ac06]===_0x4d63('0x80')){_0x35f860[_0x4d63('0x46')]('i.'+_0x18ac06+'\x20IS\x20NULL');}else{_0x35f860['where']('i.'+_0x18ac06+_0x4d63('0x81'),_0x553f56[_0x4d63('0x3f')][_0x18ac06]);}}});}if(_0x553f56[_0x4d63('0x3f')]['read']){if(_0x553f56[_0x4d63('0x3f')][_0x4d63('0x82')]==0x1){_0x35f860[_0x4d63('0x63')](_0x4d63('0x83'));}else{_0x35f860[_0x4d63('0x63')](_0x4d63('0x84'));}}if(_0x553f56[_0x4d63('0x3f')][_0x4d63('0x85')]){_0x3e476b=_[_0x4d63('0x86')](_0x553f56[_0x4d63('0x3f')][_0x4d63('0x85')])?_0x553f56['query']['tag']:new Array(_0x553f56[_0x4d63('0x3f')]['tag']);_0x3e476b[_0x4d63('0x34')](function(_0x5c9f5a){_0x3f82d3['or'](_0x4d63('0x6f'),'%,'+_0x5c9f5a+',%');});}if(_0x553f56[_0x4d63('0x3f')][_0x4d63('0x87')]){var _0x288a77=_0x553f56['query']['filter'][_0x4d63('0x88')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x4d63('0x89')](_0x288a77)){_0x1a44d6['or'](_0x4d63('0x8a'),_0x288a77+'%')['or'](_0x4d63('0x8b'),_0x288a77+'%');}else{_0x1a44d6['or'](_0x4d63('0x8c'),qs[_0x4d63('0x6a')](_0x288a77))['or'](_0x4d63('0x8d'),_0x288a77+'%');}}}_0x35f860['where'](_0x1a44d6);_0x35f860[_0x4d63('0x8e')](_0x4d63('0x8f'));var _0x392e29={'type':db['Sequelize'][_0x4d63('0x90')][_0x4d63('0x91')],'raw':!![]};var _0x3a26e9=_0x35f860[_0x4d63('0x92')]();_0x3a26e9[_0x4d63('0x49')]('i.id');_0x3a26e9['field'](_0x4d63('0x93'),_0x4d63('0x94'));if(_0x2a73bd[_0x4d63('0x95')]){_0x2a73bd[_0x4d63('0x95')]['forEach'](function(_0x3e311d){var _0x30a139=_0x3e311d[0x0]===_0x4d63('0x96')?_0x3e311d[0x0]:'i.'+_0x3e311d[0x0];_0x35f860[_0x4d63('0x95')](_0x30a139,_0x3e311d[0x1]===_0x4d63('0x97')?![]:!![]);});}if(!_[_0x4d63('0x77')](_0x3e476b)){_0x35f860[_0x4d63('0x63')](_0x3f82d3);_0x3a26e9[_0x4d63('0x46')](_0x4d63('0x98'),_0x3e476b);}BPromise[_0x4d63('0x99')]()[_0x4d63('0x36')](function(){if(!_0x133d00){if(_0x553f56['query']['WhatsappAccountId'])return;_0x3a26e9[_0x4d63('0x46')](_0x4d63('0x9a'));_0x35f860[_0x4d63('0x46')](_0x4d63('0x9a'));return;}if(_0x553f56['user'][_0x4d63('0x9b')]!==_0x4d63('0x9c'))return;return _0x553f56['user'][_0x4d63('0x9d')]({'attributes':['id'],'raw':!![]})[_0x4d63('0x36')](function(_0xc5842f){if(_[_0x4d63('0x77')](_0xc5842f)){_0x3a26e9['where']('i.WhatsappAccountId\x20IS\x20NULL');_0x35f860[_0x4d63('0x46')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x3a26e9[_0x4d63('0x46')](_0x4d63('0x79'),_[_0x4d63('0x2f')](_0xc5842f,'id'));_0x35f860[_0x4d63('0x46')](_0x4d63('0x79'),_[_0x4d63('0x2f')](_0xc5842f,'id'));}});})['then'](function(){if(_0x553f56[_0x4d63('0x9e')]['role']===_0x4d63('0x9c')&&!_0x133d00&&!_0x553f56['query'][_0x4d63('0x78')])return[];return db[_0x4d63('0x9f')][_0x4d63('0x3f')](_0x3a26e9[_0x4d63('0xa0')](),_0x392e29);})[_0x4d63('0x36')](function(_0x4dd07e){_0x2495e5[_0x4d63('0x27')]=_0x4dd07e[_0x4d63('0x43')];if(_0x2495e5[_0x4d63('0x27')]===0x0)return[];return db[_0x4d63('0x9f')][_0x4d63('0x3f')](_0x4f474a[_0x4d63('0xa0')](),_0x392e29)['then'](function(_0x4c741c){_0x9126c=_[_0x4d63('0xa1')](_0x4c741c,'id');_0x392e29=_[_0x4d63('0xa2')](_0x392e29,{'model':db[_0x4d63('0xa3')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x553f56[_0x4d63('0x3f')][_0x4d63('0x42')]){_0x2a73bd[_0x4d63('0x40')][_0x4d63('0x34')](function(_0x409145){_0x35f860['field']('i.'+_0x409145);});}else{_0x35f860[_0x4d63('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4d63('0x94'));_0x35f860[_0x4d63('0x49')](_0x4d63('0xa4'),'Account.key');_0x35f860[_0x4d63('0x49')](_0x4d63('0xa5'),'Account.mandatoryDisposition');_0x35f860[_0x4d63('0x49')](_0x4d63('0xa6'),_0x4d63('0x96'));_0x35f860[_0x4d63('0x49')](_0x4d63('0xa7'));_0x35f860['field']('c.firstName',_0x4d63('0xa8'));_0x35f860[_0x4d63('0x49')]('c.lastName',_0x4d63('0xa9'));_0x35f860[_0x4d63('0x49')](_0x4d63('0xaa'),_0x4d63('0xab'));_0x35f860[_0x4d63('0x49')](_0x4d63('0xac'),_0x4d63('0xad'));_0x35f860[_0x4d63('0x49')]('c.mobile','Contact.mobile');_0x35f860[_0x4d63('0x49')](_0x4d63('0xae'),_0x4d63('0xaf'));_0x35f860[_0x4d63('0x49')](_0x4d63('0xb0'),_0x4d63('0xb1'));_0x35f860[_0x4d63('0x49')](_0x4d63('0xb2'),_0x4d63('0xb3'));_0x35f860[_0x4d63('0x49')](_0x4d63('0xb4'),_0x4d63('0x31'));}if(_0x2a73bd['limit'])_0x35f860[_0x4d63('0x26')](_0x2a73bd[_0x4d63('0x26')]);if(_0x2a73bd[_0x4d63('0x25')])_0x35f860['offset'](_0x2a73bd[_0x4d63('0x25')]);return db[_0x4d63('0x9f')]['query'](_0x35f860[_0x4d63('0xa0')](),_0x392e29);})[_0x4d63('0x36')](function(_0x342615){if(_0x342615[_0x4d63('0x43')]>0x0)_0x21cc0b[_0x4d63('0x46')](_0x4d63('0xb5'),_[_0x4d63('0x2f')](_0x342615,'id'));return db[_0x4d63('0x9f')][_0x4d63('0x3f')](_0x21cc0b['toString'](),_0x392e29)['then'](function(_0x17cf9b){var _0xf16c44=_[_0x4d63('0xb6')](_0x17cf9b,_0x4d63('0xb7'));var _0x422503=[];_0x342615['forEach'](function(_0x4c6d58){_0x422503[_0x4d63('0x35')](updateWhatsappInteraction(_0x4c6d58,_0x9126c,_0xf16c44));});return BPromise[_0x4d63('0xb8')](_0x422503);});});})[_0x4d63('0x36')](function(_0x3886d7){_0x2495e5['rows']=_0x3886d7;return _0x2495e5;})[_0x4d63('0x36')](respondWithFilteredResult(_0x2dba14,_0x2a73bd))[_0x4d63('0x37')](handleError(_0x2dba14,null));};exports[_0x4d63('0xb9')]=function(_0xcd7b80,_0x263b96){var _0x817b7b={'raw':![],'where':{'id':_0xcd7b80[_0x4d63('0xba')]['id']}},_0x83b6f8={};_0x83b6f8[_0x4d63('0x3c')]=_[_0x4d63('0x3d')](db['WhatsappInteraction'][_0x4d63('0x39')]);_0x83b6f8['query']=_[_0x4d63('0x3d')](_0xcd7b80['query']);_0x83b6f8[_0x4d63('0x3e')]=_[_0x4d63('0x41')](_0x83b6f8[_0x4d63('0x3c')],_0x83b6f8[_0x4d63('0x3f')]);_0x817b7b[_0x4d63('0x40')]=_[_0x4d63('0x41')](_0x83b6f8['model'],qs['fields'](_0xcd7b80[_0x4d63('0x3f')][_0x4d63('0x42')]));_0x817b7b[_0x4d63('0x40')]=_0x817b7b[_0x4d63('0x40')][_0x4d63('0x43')]?_0x817b7b[_0x4d63('0x40')]:_0x83b6f8['model'];if(_0xcd7b80[_0x4d63('0x3f')][_0x4d63('0xbb')]){_0x817b7b[_0x4d63('0xbc')]=[{'all':!![]}];}_0x817b7b=_[_0x4d63('0xa2')]({},_0x817b7b,_0xcd7b80[_0x4d63('0xbd')]);return db[_0x4d63('0xa3')]['find'](_0x817b7b)[_0x4d63('0x36')](handleEntityNotFound(_0x263b96,null))[_0x4d63('0x36')](respondWithResult(_0x263b96,null))[_0x4d63('0x37')](handleError(_0x263b96,null));};exports[_0x4d63('0xbe')]=function(_0x5bda54,_0x13ede7){return db[_0x4d63('0xa3')][_0x4d63('0xbe')](_0x5bda54[_0x4d63('0xbf')],{})[_0x4d63('0x36')](respondWithResult(_0x13ede7,0xc9))[_0x4d63('0x37')](handleError(_0x13ede7,null));};exports[_0x4d63('0xc0')]=function(_0x4c58af,_0xc9adb8){if(_0x4c58af[_0x4d63('0xbf')]['id']){delete _0x4c58af['body']['id'];}return db[_0x4d63('0xa3')][_0x4d63('0x61')]({'where':{'id':_0x4c58af[_0x4d63('0xba')]['id']}})[_0x4d63('0x36')](handleEntityNotFound(_0xc9adb8,null))[_0x4d63('0x36')](saveUpdates(_0x4c58af['body'],null))['then'](respondWithResult(_0xc9adb8,null))['catch'](handleError(_0xc9adb8,null));};exports[_0x4d63('0x2b')]=function(_0x2636ee,_0x82700){return db[_0x4d63('0xa3')][_0x4d63('0x61')]({'where':{'id':_0x2636ee[_0x4d63('0xba')]['id']}})['then'](handleEntityNotFound(_0x82700,null))['then'](removeEntity(_0x82700,null))[_0x4d63('0x37')](handleError(_0x82700,null));};exports[_0x4d63('0xc1')]=function(_0x310504,_0x416cdf){return db[_0x4d63('0xa3')][_0x4d63('0xc1')]()[_0x4d63('0x36')](respondWithResult(_0x416cdf,null))[_0x4d63('0x37')](handleError(_0x416cdf,null));};exports[_0x4d63('0xc2')]=function(_0x455c41,_0x203b1c,_0x4d2d4e){return db['WhatsappMessage'][_0x4d63('0x61')]({'where':{'id':_0x455c41['params']['id']}})[_0x4d63('0x36')](handleEntityNotFound(_0x203b1c,null))[_0x4d63('0x36')](function(_0x264912){if(_0x264912){return _0x264912['addMessage'](_0x455c41[_0x4d63('0xbf')][_0x4d63('0xc3')],_[_0x4d63('0xc4')](_0x455c41[_0x4d63('0xbf')],[_0x4d63('0xc3'),'id'])||{});}})['then'](respondWithResult(_0x203b1c,null))[_0x4d63('0x37')](handleError(_0x203b1c,null));};exports[_0x4d63('0xc5')]=function(_0x354180,_0x253f25,_0x58161a){var _0x3c340e={'raw':![],'where':{}};var _0x421e17={};var _0x2fb0d4={'count':0x0,'rows':[]};return db[_0x4d63('0xa3')][_0x4d63('0xc6')]({'where':{'id':_0x354180[_0x4d63('0xba')]['id']}})['then'](handleEntityNotFound(_0x253f25,null))[_0x4d63('0x36')](function(_0x484add){if(_0x484add){_0x421e17[_0x4d63('0x3c')]=_[_0x4d63('0x3d')](db['WhatsappMessage'][_0x4d63('0x39')]);_0x421e17[_0x4d63('0x3f')]=_[_0x4d63('0x3d')](_0x354180[_0x4d63('0x3f')]);_0x421e17[_0x4d63('0x3e')]=_[_0x4d63('0x41')](_0x421e17[_0x4d63('0x3c')],_0x421e17[_0x4d63('0x3f')]);_0x3c340e['attributes']=_['intersection'](_0x421e17[_0x4d63('0x3c')],qs['fields'](_0x354180[_0x4d63('0x3f')][_0x4d63('0x42')]));_0x3c340e[_0x4d63('0x40')]=_0x3c340e['attributes']['length']?_0x3c340e[_0x4d63('0x40')]:_0x421e17[_0x4d63('0x3c')];if(!_0x354180['query'][_0x4d63('0xc7')](_0x4d63('0x44'))){_0x3c340e[_0x4d63('0x26')]=qs[_0x4d63('0x26')](_0x354180[_0x4d63('0x3f')][_0x4d63('0x26')]);_0x3c340e[_0x4d63('0x25')]=qs[_0x4d63('0x25')](_0x354180[_0x4d63('0x3f')][_0x4d63('0x25')]);}_0x3c340e['order']=qs['sort'](_0x354180[_0x4d63('0x3f')]['sort']);_0x3c340e['where']=qs['filters'](_[_0x4d63('0x47')](_0x354180[_0x4d63('0x3f')],_0x421e17[_0x4d63('0x3e')]));_0x3c340e[_0x4d63('0x46')][_0x4d63('0xb7')]=_0x484add['id'];if(_0x354180['query'][_0x4d63('0x87')]){_0x3c340e[_0x4d63('0x46')]=_[_0x4d63('0xa2')](_0x3c340e[_0x4d63('0x46')],{'$or':_[_0x4d63('0x2f')](_0x3c340e['attributes'],function(_0x4deef1){var _0x5de9d7={};_0x5de9d7[_0x4deef1]={'$like':'%'+_0x354180[_0x4d63('0x3f')]['filter']+'%'};return _0x5de9d7;})});}if(_0x354180[_0x4d63('0x3f')][_0x4d63('0x7d')]){var _0x26f07f=_0x354180[_0x4d63('0x3f')][_0x4d63('0x7d')][_0x4d63('0x33')](',');var _0x1fa96b={};_0x1fa96b[_0x26f07f[0x0]]={'$gte':moment(_0x26f07f[0x1])[_0x4d63('0xc8')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3c340e['where']=_[_0x4d63('0xa2')](_0x3c340e['where'],_0x1fa96b);}_0x3c340e=_[_0x4d63('0xa2')]({},_0x3c340e,_0x354180[_0x4d63('0xbd')]);return db['WhatsappMessage'][_0x4d63('0x27')]({'where':_0x3c340e[_0x4d63('0x46')]})[_0x4d63('0x36')](function(_0x5b35f1){_0x2fb0d4[_0x4d63('0x27')]=_0x5b35f1;if(_0x354180['query'][_0x4d63('0xbb')]){_0x3c340e[_0x4d63('0xbc')]=[{'all':!![]}];}return db[_0x4d63('0xc9')]['findAll'](_0x3c340e);})['then'](function(_0x19c3ce){_0x2fb0d4[_0x4d63('0xca')]=_0x19c3ce;return _0x2fb0d4;});}})['then'](respondWithFilteredResult(_0x253f25,_0x3c340e))[_0x4d63('0x37')](handleError(_0x253f25,null));};exports['addTags']=function(_0x477250,_0x1899e0,_0x4844d3){return db[_0x4d63('0xa3')][_0x4d63('0x61')]({'where':{'id':_0x477250[_0x4d63('0xba')]['id']}})[_0x4d63('0x36')](handleEntityNotFound(_0x1899e0,null))[_0x4d63('0x36')](function(_0x1fa958){if(_0x1fa958){return _0x1fa958[_0x4d63('0xcb')](_0x477250[_0x4d63('0xbf')]['ids'],_[_0x4d63('0xc4')](_0x477250[_0x4d63('0xbf')],[_0x4d63('0xc3'),'id'])||{})[_0x4d63('0xcc')](function(){return db['Tag'][_0x4d63('0xcd')]({'attributes':['id',_0x4d63('0x2d'),_0x4d63('0x4a')],'where':{'id':_0x477250[_0x4d63('0xbf')]['ids']}});})[_0x4d63('0x36')](function(_0x3fabbd){socket[_0x4d63('0xce')]('whatsappInteractionTags:save',{'id':Number(_0x477250['params']['id']),'tags':_0x3fabbd||[]});return{'id':Number(_0x477250[_0x4d63('0xba')]['id']),'tags':_0x3fabbd||[]};});}})[_0x4d63('0x36')](respondWithResult(_0x1899e0,null))['catch'](handleError(_0x1899e0,null));};exports[_0x4d63('0xcf')]=function(_0x48084d,_0x2a67c5,_0x1b698d){return db[_0x4d63('0xa3')][_0x4d63('0x61')]({'where':{'id':_0x48084d[_0x4d63('0xba')]['id']}})['then'](handleEntityNotFound(_0x2a67c5,null))[_0x4d63('0x36')](function(_0x10e610){if(_0x10e610){return _0x10e610[_0x4d63('0xcf')](_0x48084d[_0x4d63('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x2a67c5,null))['catch'](handleError(_0x2a67c5,null));};exports[_0x4d63('0xd0')]=function(_0x300118,_0x76a31f){var _0x44166f=moment()[_0x4d63('0xd1')]()[_0x4d63('0xa0')]();var _0x3348b9=path[_0x4d63('0xd2')](config[_0x4d63('0xd3')],_0x4d63('0xd4'),'files',_0x4d63('0xd5'));var _0xe23689=path['join'](config[_0x4d63('0xd3')],_0x4d63('0xd4'),_0x4d63('0xd6'),_0x4d63('0xd7'));var _0xa55eae=path[_0x4d63('0xd2')](_0x3348b9,_0x44166f);var _0x20f5fa=util[_0x4d63('0xc8')]('transcript-%d-%s.zip',_0x300118[_0x4d63('0xba')]['id'],_0x44166f);var _0x599a0b=path[_0x4d63('0xd2')](_0x3348b9,_0x20f5fa);var _0x24b404=[];_0x24b404[_0x4d63('0x35')]({'model':db[_0x4d63('0x71')],'as':_0x4d63('0x71'),'attributes':['id',_0x4d63('0x30')],'raw':!![]});_0x24b404[_0x4d63('0x35')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0x4d63('0xd8')],'raw':!![]});if(_0x300118[_0x4d63('0x3f')][_0x4d63('0xd7')]){_0x24b404[_0x4d63('0x35')]({'model':db[_0x4d63('0xd9')],'as':_0x4d63('0xd9'),'raw':!![]});}var _0x39d41c=[{'model':db[_0x4d63('0xc9')],'as':_0x4d63('0xda'),'attributes':['id',_0x4d63('0xbf'),_0x4d63('0x7b'),_0x4d63('0xdb'),_0x4d63('0xdc'),'read'],'include':_0x24b404}];_0x39d41c[_0x4d63('0x35')]({'model':db[_0x4d63('0xdd')],'as':_0x4d63('0xde'),'attributes':['id',_0x4d63('0x2d')]});_0x39d41c[_0x4d63('0x35')]({'model':db[_0x4d63('0x71')],'as':_0x4d63('0xdf'),'attributes':['id',_0x4d63('0x30')]});return db[_0x4d63('0xa3')][_0x4d63('0x61')]({'where':{'id':_0x300118['params']['id']},'include':_0x39d41c})[_0x4d63('0x36')](handleEntityNotFound(_0x76a31f,null))['then'](function(_0x453f1f){if(_0x453f1f){var _0x5acc75=_0x453f1f['get']({'plain':!![]});fs[_0x4d63('0xe0')](_0xa55eae);var _0xe0a942={'channel':_0x4d63('0xe1'),'account':_0x5acc75[_0x4d63('0xde')]['name'],'agent':_0x5acc75[_0x4d63('0xdf')]?_0x5acc75['Owner'][_0x4d63('0x30')]:_0x4d63('0xe2'),'createdAt':moment(_0x5acc75[_0x4d63('0x7b')])['format'](_0x4d63('0xe3'))[_0x4d63('0xa0')](),'closedAt':_0x5acc75[_0x4d63('0xe4')]?moment(_0x5acc75['closedAt'])[_0x4d63('0xc8')](_0x4d63('0xe3'))['toString']():'','disposition':_0x5acc75[_0x4d63('0xe5')],'messages':_(_0x5acc75[_0x4d63('0xda')])['filter']({'secret':![]})[_0x4d63('0x2f')](function(_0x4bbb75){if(_0x4bbb75[_0x4d63('0xd9')]){var _0x31c5f1=path[_0x4d63('0xd2')](_0xe23689,_0x4bbb75[_0x4d63('0xd9')][_0x4d63('0xe6')]);if(fs[_0x4d63('0xe7')](_0x31c5f1)){fs[_0x4d63('0xe8')](_0x31c5f1)['pipe'](fs[_0x4d63('0xe9')](path[_0x4d63('0xd2')](_0xa55eae,_0x4bbb75[_0x4d63('0xd9')][_0x4d63('0xe6')])));}}return{'date':moment(_0x4bbb75[_0x4d63('0x7b')])[_0x4d63('0xc8')](_0x4d63('0xe3'))[_0x4d63('0xa0')](),'sender':_0x4bbb75[_0x4d63('0xdb')]==='out'?_0x4bbb75[_0x4d63('0x71')]?_0x4bbb75['User']['fullname']:_0x4d63('0xea'):_0x4bbb75[_0x4d63('0x66')][_0x4d63('0xeb')]+(_0x4bbb75[_0x4d63('0x66')][_0x4d63('0xd8')]?'\x20'+_0x4bbb75[_0x4d63('0x66')]['lastName']:''),'body':_0x4bbb75[_0x4d63('0xd9')]?_0x4bbb75['Attachment']['basename']:_0x4bbb75[_0x4d63('0xbf')],'direction':_0x4bbb75[_0x4d63('0xdb')]===_0x4d63('0xec')?'A':'C','secret':_0x4bbb75[_0x4d63('0xdc')],'read':_0x4bbb75[_0x4d63('0x82')],'attachment':_0x4bbb75[_0x4d63('0xd9')]};})[_0x4d63('0x62')]()};return ejs['renderFile'](path[_0x4d63('0xd2')](config[_0x4d63('0xd3')],_0x4d63('0xd4'),_0x4d63('0xed'),_0x4d63('0xee')),{'interaction':_0xe0a942})[_0x4d63('0x36')](function(_0x2892b1){var _0x24761f=path[_0x4d63('0xd2')](_0xa55eae,'transcript-'+_0x5acc75['id']+'-'+_0x44166f+'.pdf');var _0x40cb76={'path':_0x24761f,'channel':_0x4d63('0xe1'),'interactionId':_0x5acc75['id']};return pdf[_0x4d63('0xef')](_0x2892b1,_0x40cb76);})[_0x4d63('0x36')](function(){return new BPromise(function(_0x3cdb12,_0x2f891c){zipdir(_0xa55eae,{'saveTo':_0x599a0b},function(_0x31e28d,_0x52d3d3){if(_0x31e28d)return _0x2f891c(_0x31e28d);return _0x3cdb12(_0x52d3d3);});})['then'](function(){return new BPromise(function(_0x227fca,_0x2f043b){rimraf(_0xa55eae,function(_0x8b4197){if(_0x8b4197)_0x2f043b(_0x8b4197);return _0x227fca();});});})[_0x4d63('0x36')](function(){return _0x76a31f['download'](_0x599a0b,_0x20f5fa,function(_0x41ff9e){if(_0x41ff9e){console[_0x4d63('0xf0')](_0x4d63('0xf1'),_0x41ff9e);}else{fs[_0x4d63('0xf2')](_0x599a0b);}});});});}else{return _0x76a31f[_0x4d63('0x21')](0xc8);}})['catch'](handleError(_0x76a31f,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index a720cbb..e53abe1 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 _0x85b5=['remove','then','setDataValue','Users','map','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1a0cf0,_0x523a08){var _0x32eba6=function(_0x3e2432){while(--_0x3e2432){_0x1a0cf0['push'](_0x1a0cf0['shift']());}};_0x32eba6(++_0x523a08);}(_0x85b5,0x7f));var _0x585b=function(_0x29c1d2,_0x28bdc1){_0x29c1d2=_0x29c1d2-0x0;var _0x4faa82=_0x85b5[_0x29c1d2];return _0x4faa82;};'use strict';var EventEmitter=require(_0x585b('0x0'));var WhatsappInteraction=require(_0x585b('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x585b('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x585b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x585b('0x3')};function emitEvent(_0x4f37a9){return function(_0x3c7651,_0x26ccfb,_0x9ccfca){_0x3c7651['getUsers']({'attributes':['id'],'raw':!![]})[_0x585b('0x4')](function(_0x55ffb3){_0x3c7651[_0x585b('0x5')](_0x585b('0x6'),_0x55ffb3[_0x585b('0x7')](function(_0x2d1220){return{'id':_0x2d1220['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x3c7651['id'],'direction':'in','read':![]},'raw':!![]});})[_0x585b('0x4')](function(_0x7974e6){_0x3c7651[_0x585b('0x5')](_0x585b('0x8'),_0x7974e6[_0x585b('0x9')]);WhatsappInteractionEvents[_0x585b('0xa')](_0x4f37a9+':'+_0x3c7651['id'],_0x3c7651);WhatsappInteractionEvents[_0x585b('0xa')](_0x4f37a9,_0x3c7651);_0x9ccfca(null);})['catch'](_0x9ccfca(null));};}for(var e in events){if(events[_0x585b('0xb')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x585b('0xc')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x5a8c=['getUsers','then','setDataValue','Users','map','findAll','length','emit','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','remove'];(function(_0x46880f,_0x5dca8d){var _0x48eec7=function(_0x40c903){while(--_0x40c903){_0x46880f['push'](_0x46880f['shift']());}};_0x48eec7(++_0x5dca8d);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x3af68e,_0x384315){_0x3af68e=_0x3af68e-0x0;var _0x3e6d5b=_0x5a8c[_0x3af68e];return _0x3e6d5b;};'use strict';var EventEmitter=require(_0xc5a8('0x0'));var WhatsappInteraction=require(_0xc5a8('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xc5a8('0x1'))['db'][_0xc5a8('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xc5a8('0x3')](0x0);var events={'afterCreate':_0xc5a8('0x4'),'afterUpdate':'update','afterDestroy':_0xc5a8('0x5')};function emitEvent(_0x4310e4){return function(_0x5855dc,_0x16474d,_0x3c8f1e){_0x5855dc[_0xc5a8('0x6')]({'attributes':['id'],'raw':!![]})[_0xc5a8('0x7')](function(_0x1be8e7){_0x5855dc[_0xc5a8('0x8')](_0xc5a8('0x9'),_0x1be8e7[_0xc5a8('0xa')](function(_0x36e265){return{'id':_0x36e265['id']};}));return WhatsappMessage[_0xc5a8('0xb')]({'where':{'WhatsappInteractionId':_0x5855dc['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc5a8('0x7')](function(_0x4e0029){_0x5855dc[_0xc5a8('0x8')]('unreadMessages',_0x4e0029[_0xc5a8('0xc')]);WhatsappInteractionEvents[_0xc5a8('0xd')](_0x4310e4+':'+_0x5855dc['id'],_0x5855dc);WhatsappInteractionEvents[_0xc5a8('0xd')](_0x4310e4,_0x5855dc);_0x3c8f1e(null);})['catch'](_0x3c8f1e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0xc5a8('0xe')](e,emitEvent(event));}}module[_0xc5a8('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 808d680..abf3cc1 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 _0xf78b=['whatsapp_interactions','changed','closed','closedAt','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x432382,_0x19f1b1){var _0x5ac146=function(_0x2e5a86){while(--_0x2e5a86){_0x432382['push'](_0x432382['shift']());}};_0x5ac146(++_0x19f1b1);}(_0xf78b,0x6d));var _0xbf78=function(_0x34e336,_0x32a120){_0x34e336=_0x34e336-0x0;var _0x5d364e=_0xf78b[_0x34e336];return _0x5d364e;};'use strict';var _=require(_0xbf78('0x0'));var util=require(_0xbf78('0x1'));var logger=require(_0xbf78('0x2'))('api');var moment=require(_0xbf78('0x3'));var BPromise=require(_0xbf78('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf78('0x5'));var rimraf=require(_0xbf78('0x6'));var config=require('../../config/environment');var attributes=require(_0xbf78('0x7'));module[_0xbf78('0x8')]=function(_0xaceaeb,_0x1217e4){return _0xaceaeb[_0xbf78('0x9')](_0xbf78('0xa'),attributes,{'tableName':_0xbf78('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2f8dfd,_0x413626,_0x588262){if(_0x2f8dfd[_0xbf78('0xc')](_0xbf78('0xd'))){_0x2f8dfd[_0xbf78('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x588262(null,_0x2f8dfd);}}});}; \ No newline at end of file +var _0xc0ac=['api','moment','bluebird','rimraf','./whatsappInteraction.attributes','define','WhatsappInteraction','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x209e93,_0x345fa3){var _0x3da805=function(_0x380291){while(--_0x380291){_0x209e93['push'](_0x209e93['shift']());}};_0x3da805(++_0x345fa3);}(_0xc0ac,0x65));var _0xcc0a=function(_0x5d8171,_0xb8d202){_0x5d8171=_0x5d8171-0x0;var _0x3d8b9a=_0xc0ac[_0x5d8171];return _0x3d8b9a;};'use strict';var _=require(_0xcc0a('0x0'));var util=require(_0xcc0a('0x1'));var logger=require(_0xcc0a('0x2'))(_0xcc0a('0x3'));var moment=require(_0xcc0a('0x4'));var BPromise=require(_0xcc0a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcc0a('0x6'));var config=require('../../config/environment');var attributes=require(_0xcc0a('0x7'));module['exports']=function(_0x237b66,_0x2859d1){return _0x237b66[_0xcc0a('0x8')](_0xcc0a('0x9'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xbc7653,_0x5195c2,_0x520486){if(_0xbc7653['changed'](_0xcc0a('0xa'))){_0xbc7653['closedAt']=moment()[_0xcc0a('0xb')](_0xcc0a('0xc'));}_0x520486(null,_0xbc7653);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index f491f7b..799ed01 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 _0x1d44=['body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis','socket.io-emitter','register','request','WhatsappInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','then','info','catch','AddTagsToWhatsappInteraction','find','addTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d44,0x73));var _0x41d4=function(_0x468a77,_0x1382be){_0x468a77=_0x468a77-0x0;var _0x2d1c33=_0x1d44[_0x468a77];return _0x2d1c33;};'use strict';var _=require(_0x41d4('0x0'));var util=require(_0x41d4('0x1'));var moment=require(_0x41d4('0x2'));var BPromise=require(_0x41d4('0x3'));var rs=require(_0x41d4('0x4'));var fs=require('fs');var Redis=require(_0x41d4('0x5'));var db=require(_0x41d4('0x6'))['db'];var utils=require(_0x41d4('0x7'));var logger=require(_0x41d4('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x41d4('0x9'));var client=jayson[_0x41d4('0xa')]['http']({'port':0x232a});config[_0x41d4('0xb')]=_['defaults'](config[_0x41d4('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x41d4('0xc'))(new Redis(config[_0x41d4('0xb')]));require('./whatsappInteraction.socket')[_0x41d4('0xd')](socket);function respondWithRpcPromise(_0x3c55bf,_0x106e70,_0x336590){return new BPromise(function(_0x4c3f0a,_0x3b6960){return client[_0x41d4('0xe')](_0x3c55bf,_0x336590)['then'](function(_0x3250cf){logger['info'](_0x41d4('0xf'),_0x106e70,'request\x20sent');logger[_0x41d4('0x10')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x106e70,_0x41d4('0x11'),JSON[_0x41d4('0x12')](_0x3250cf));if(_0x3250cf[_0x41d4('0x13')]){if(_0x3250cf[_0x41d4('0x13')]['code']===0x1f4){logger['error'](_0x41d4('0xf'),_0x106e70,_0x3250cf[_0x41d4('0x13')][_0x41d4('0x14')]);return _0x3b6960(_0x3250cf['error'][_0x41d4('0x14')]);}logger['error'](_0x41d4('0xf'),_0x106e70,_0x3250cf[_0x41d4('0x13')]['message']);return _0x4c3f0a(_0x3250cf[_0x41d4('0x13')][_0x41d4('0x14')]);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x106e70,_0x41d4('0x11'));_0x4c3f0a(_0x3250cf[_0x41d4('0x15')][_0x41d4('0x14')]);}})['catch'](function(_0x330097){logger[_0x41d4('0x13')]('WhatsappInteraction,\x20%s,\x20%s',_0x106e70,_0x330097);_0x3b6960(_0x330097);});});}exports[_0x41d4('0x16')]=function(_0x4f5546){var _0x58595d=this;return new Promise(function(_0x281d2b,_0x30a3c5){return db[_0x41d4('0x17')][_0x41d4('0x18')](_0x4f5546['body'],{'raw':_0x4f5546[_0x41d4('0x19')]?_0x4f5546[_0x41d4('0x19')][_0x41d4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f5546[_0x41d4('0x19')]?_0x4f5546['options']['where']||null:null,'attributes':_0x4f5546['options']?_0x4f5546[_0x41d4('0x19')]['attributes']||null:null,'limit':_0x4f5546['options']?_0x4f5546[_0x41d4('0x19')]['limit']||null:null})[_0x41d4('0x1b')](function(_0x5e59a4){logger[_0x41d4('0x1c')]('UpdateWhatsappInteraction',_0x4f5546);logger[_0x41d4('0x10')](_0x41d4('0x16'),_0x4f5546,JSON[_0x41d4('0x12')](_0x5e59a4));_0x281d2b(_0x5e59a4);})[_0x41d4('0x1d')](function(_0x1a1e91){logger['error'](_0x41d4('0x16'),_0x1a1e91['message'],_0x4f5546);_0x30a3c5(_0x58595d['error'](0x1f4,_0x1a1e91[_0x41d4('0x14')]));});});};exports[_0x41d4('0x1e')]=function(_0x1baedf){return new Promise(function(_0x4e8fdc,_0x2077fc){return db['WhatsappInteraction'][_0x41d4('0x1f')]({'where':_0x1baedf['options']?_0x1baedf[_0x41d4('0x19')]['where']||null:null})[_0x41d4('0x1b')](function(_0x3d15a4){if(_0x3d15a4){return _0x3d15a4[_0x41d4('0x20')](_0x1baedf[_0x41d4('0x21')][_0x41d4('0x22')],_['omit'](_0x1baedf[_0x41d4('0x21')],[_0x41d4('0x22'),'id'])||{});}})[_0x41d4('0x23')](function(_0x4574e0){logger[_0x41d4('0x1c')](_0x41d4('0x24'),_0x1baedf);logger[_0x41d4('0x10')]('AddTags',_0x1baedf,JSON[_0x41d4('0x12')](_0x4574e0));_0x4e8fdc(_0x4574e0);})['catch'](function(_0x579515){logger[_0x41d4('0x13')]('AddTags',_0x579515[_0x41d4('0x14')],_0x1baedf);_0x2077fc(_this['error'](0x1f4,_0x579515[_0x41d4('0x14')]));});});}; \ No newline at end of file +var _0xeb44=['where','attributes','limit','AddTagsToWhatsappInteraction','find','ids','omit','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options'];(function(_0x2b92d8,_0x1cec6f){var _0x3a0f3c=function(_0x1ec466){while(--_0x1ec466){_0x2b92d8['push'](_0x2b92d8['shift']());}};_0x3a0f3c(++_0x1cec6f);}(_0xeb44,0x138));var _0x4eb4=function(_0x3f50a9,_0x5e0587){_0x3f50a9=_0x3f50a9-0x0;var _0x2ae3a8=_0xeb44[_0x3f50a9];return _0x2ae3a8;};'use strict';var _=require(_0x4eb4('0x0'));var util=require('util');var moment=require(_0x4eb4('0x1'));var BPromise=require(_0x4eb4('0x2'));var rs=require(_0x4eb4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4eb4('0x4'))['db'];var utils=require(_0x4eb4('0x5'));var logger=require(_0x4eb4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x4eb4('0x7')]=_[_0x4eb4('0x8')](config[_0x4eb4('0x7')],{'host':_0x4eb4('0x9'),'port':0x18eb});var socket=require(_0x4eb4('0xa'))(new Redis(config['redis']));require(_0x4eb4('0xb'))['register'](socket);function respondWithRpcPromise(_0x169429,_0x5e4efb,_0x225e51){return new BPromise(function(_0x44eb6c,_0x2a6fde){return client[_0x4eb4('0xc')](_0x169429,_0x225e51)[_0x4eb4('0xd')](function(_0x49f72b){logger[_0x4eb4('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x5e4efb,_0x4eb4('0xf'));logger[_0x4eb4('0x10')](_0x4eb4('0x11'),_0x5e4efb,_0x4eb4('0xf'),JSON[_0x4eb4('0x12')](_0x49f72b));if(_0x49f72b['error']){if(_0x49f72b[_0x4eb4('0x13')][_0x4eb4('0x14')]===0x1f4){logger[_0x4eb4('0x13')](_0x4eb4('0x15'),_0x5e4efb,_0x49f72b[_0x4eb4('0x13')]['message']);return _0x2a6fde(_0x49f72b[_0x4eb4('0x13')]['message']);}logger[_0x4eb4('0x13')](_0x4eb4('0x15'),_0x5e4efb,_0x49f72b[_0x4eb4('0x13')]['message']);return _0x44eb6c(_0x49f72b[_0x4eb4('0x13')][_0x4eb4('0x16')]);}else{logger['info'](_0x4eb4('0x15'),_0x5e4efb,'request\x20sent');_0x44eb6c(_0x49f72b[_0x4eb4('0x17')][_0x4eb4('0x16')]);}})[_0x4eb4('0x18')](function(_0x5bd73f){logger[_0x4eb4('0x13')](_0x4eb4('0x15'),_0x5e4efb,_0x5bd73f);_0x2a6fde(_0x5bd73f);});});}exports[_0x4eb4('0x19')]=function(_0x25bcf9){var _0x623478=this;return new Promise(function(_0x52df84,_0x53d7d1){return db[_0x4eb4('0x1a')][_0x4eb4('0x1b')](_0x25bcf9[_0x4eb4('0x1c')],{'raw':_0x25bcf9[_0x4eb4('0x1d')]?_0x25bcf9[_0x4eb4('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25bcf9[_0x4eb4('0x1d')]?_0x25bcf9[_0x4eb4('0x1d')][_0x4eb4('0x1e')]||null:null,'attributes':_0x25bcf9['options']?_0x25bcf9[_0x4eb4('0x1d')][_0x4eb4('0x1f')]||null:null,'limit':_0x25bcf9[_0x4eb4('0x1d')]?_0x25bcf9['options'][_0x4eb4('0x20')]||null:null})[_0x4eb4('0xd')](function(_0x58e09a){logger[_0x4eb4('0xe')](_0x4eb4('0x19'),_0x25bcf9);logger[_0x4eb4('0x10')]('UpdateWhatsappInteraction',_0x25bcf9,JSON[_0x4eb4('0x12')](_0x58e09a));_0x52df84(_0x58e09a);})[_0x4eb4('0x18')](function(_0x2fb9c6){logger[_0x4eb4('0x13')](_0x4eb4('0x19'),_0x2fb9c6['message'],_0x25bcf9);_0x53d7d1(_0x623478[_0x4eb4('0x13')](0x1f4,_0x2fb9c6['message']));});});};exports[_0x4eb4('0x21')]=function(_0x3b58ff){return new Promise(function(_0x4c633d,_0x34dc12){return db[_0x4eb4('0x1a')][_0x4eb4('0x22')]({'where':_0x3b58ff[_0x4eb4('0x1d')]?_0x3b58ff['options'][_0x4eb4('0x1e')]||null:null})[_0x4eb4('0xd')](function(_0x3d7add){if(_0x3d7add){return _0x3d7add['addTags'](_0x3b58ff[_0x4eb4('0x1c')][_0x4eb4('0x23')],_[_0x4eb4('0x24')](_0x3b58ff[_0x4eb4('0x1c')],[_0x4eb4('0x23'),'id'])||{});}})['spread'](function(_0x3c9549){logger[_0x4eb4('0xe')](_0x4eb4('0x25'),_0x3b58ff);logger[_0x4eb4('0x10')](_0x4eb4('0x25'),_0x3b58ff,JSON[_0x4eb4('0x12')](_0x3c9549));_0x4c633d(_0x3c9549);})[_0x4eb4('0x18')](function(_0x4a6907){logger[_0x4eb4('0x13')](_0x4eb4('0x25'),_0x4a6907['message'],_0x3b58ff);_0x34dc12(_this[_0x4eb4('0x13')](0x1f4,_0x4a6907[_0x4eb4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d5e2ceb..1bf7846 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 _0x400d=['emit','removeListener','register','./whatsappInteraction.events','save','remove','update'];(function(_0x57928b,_0x29a111){var _0x49aad6=function(_0x34a268){while(--_0x34a268){_0x57928b['push'](_0x57928b['shift']());}};_0x49aad6(++_0x29a111);}(_0x400d,0xc7));var _0xd400=function(_0x2512ce,_0x525ffe){_0x2512ce=_0x2512ce-0x0;var _0x4c5923=_0x400d[_0x2512ce];return _0x4c5923;};'use strict';var WhatsappInteractionEvents=require(_0xd400('0x0'));var events=[_0xd400('0x1'),_0xd400('0x2'),_0xd400('0x3')];function createListener(_0x5e644e,_0x3409a6){return function(_0xc32c2d){_0x3409a6[_0xd400('0x4')](_0x5e644e,_0xc32c2d);};}function removeListener(_0x25ef48,_0x20e3d){return function(){WhatsappInteractionEvents[_0xd400('0x5')](_0x25ef48,_0x20e3d);};}exports[_0xd400('0x6')]=function(_0x4abfcb){for(var _0x4f8a90=0x0,_0x788eb7=events['length'];_0x4f8a90<_0x788eb7;_0x4f8a90++){var _0x2f7925=events[_0x4f8a90];var _0x24c99c=createListener('whatsappInteraction:'+_0x2f7925,_0x4abfcb);WhatsappInteractionEvents['on'](_0x2f7925,_0x24c99c);}}; \ No newline at end of file +var _0x037b=['whatsappInteraction:','./whatsappInteraction.events','save','removeListener','length'];(function(_0x2c91d3,_0x3bba19){var _0x4fd43e=function(_0x1f0224){while(--_0x1f0224){_0x2c91d3['push'](_0x2c91d3['shift']());}};_0x4fd43e(++_0x3bba19);}(_0x037b,0x1d2));var _0xb037=function(_0x256892,_0x23f3ce){_0x256892=_0x256892-0x0;var _0x3fb713=_0x037b[_0x256892];return _0x3fb713;};'use strict';var WhatsappInteractionEvents=require(_0xb037('0x0'));var events=[_0xb037('0x1'),'remove','update'];function createListener(_0x4bd38e,_0x1369a5){return function(_0x1fa06d){_0x1369a5['emit'](_0x4bd38e,_0x1fa06d);};}function removeListener(_0x4ff938,_0x2d7e7a){return function(){WhatsappInteractionEvents[_0xb037('0x2')](_0x4ff938,_0x2d7e7a);};}exports['register']=function(_0x263355){for(var _0xdc7627=0x0,_0x3fcfee=events[_0xb037('0x3')];_0xdc7627<_0x3fcfee;_0xdc7627++){var _0x4e17fc=events[_0xdc7627];var _0x1bfa35=createListener(_0xb037('0x4')+_0x4e17fc,_0x263355);WhatsappInteractionEvents['on'](_0x4e17fc,_0x1bfa35);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 01b38f0..a650fde 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 _0xc498=['fs-extra','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x53c96a,_0x4f9268){var _0x2f5d70=function(_0x530ff2){while(--_0x530ff2){_0x53c96a['push'](_0x53c96a['shift']());}};_0x2f5d70(++_0x4f9268);}(_0xc498,0x1c5));var _0x8c49=function(_0x18ca16,_0x55acb3){_0x18ca16=_0x18ca16-0x0;var _0x316738=_0xc498[_0x18ca16];return _0x316738;};'use strict';var multer=require(_0x8c49('0x0'));var util=require(_0x8c49('0x1'));var path=require(_0x8c49('0x2'));var timeout=require(_0x8c49('0x3'));var express=require(_0x8c49('0x4'));var router=express[_0x8c49('0x5')]();var fs_extra=require(_0x8c49('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c49('0x7'));var controller=require(_0x8c49('0x8'));router[_0x8c49('0x9')]('/',auth[_0x8c49('0xa')](),controller['index']);router['get']('/describe',auth[_0x8c49('0xa')](),controller[_0x8c49('0xb')]);router['get'](_0x8c49('0xc'),auth['isAuthenticated'](),controller[_0x8c49('0xd')]);router[_0x8c49('0xe')]('/',auth[_0x8c49('0xa')](),interaction[_0x8c49('0xf')](_0x8c49('0x10'),_0x8c49('0x11')),controller['create']);router['post'](_0x8c49('0x12'),controller[_0x8c49('0x13')]);router['put']('/:id',auth[_0x8c49('0xa')](),controller[_0x8c49('0x14')]);router[_0x8c49('0x15')](_0x8c49('0x16'),auth[_0x8c49('0xa')](),controller[_0x8c49('0x17')]);router[_0x8c49('0x15')](_0x8c49('0x18'),auth[_0x8c49('0xa')](),controller['reject']);router[_0x8c49('0x19')](_0x8c49('0xc'),auth[_0x8c49('0xa')](),controller['destroy']);module[_0x8c49('0x1a')]=router; \ No newline at end of file +var _0x47f2=['update','accept','/:id/reject','reject','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','tracked','whatsapp','create','/:id/status','status','put'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0x47f2,0x199));var _0x247f=function(_0x5c6eeb,_0x368787){_0x5c6eeb=_0x5c6eeb-0x0;var _0x33b59e=_0x47f2[_0x5c6eeb];return _0x33b59e;};'use strict';var multer=require(_0x247f('0x0'));var util=require('util');var path=require(_0x247f('0x1'));var timeout=require(_0x247f('0x2'));var express=require(_0x247f('0x3'));var router=express[_0x247f('0x4')]();var fs_extra=require(_0x247f('0x5'));var auth=require(_0x247f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x247f('0x7'));var controller=require(_0x247f('0x8'));router[_0x247f('0x9')]('/',auth['isAuthenticated'](),controller[_0x247f('0xa')]);router[_0x247f('0x9')](_0x247f('0xb'),auth[_0x247f('0xc')](),controller[_0x247f('0xd')]);router[_0x247f('0x9')](_0x247f('0xe'),auth[_0x247f('0xc')](),controller[_0x247f('0xf')]);router[_0x247f('0x10')]('/',auth[_0x247f('0xc')](),interaction[_0x247f('0x11')](_0x247f('0x12'),'whatsappmessage:create'),controller[_0x247f('0x13')]);router['post'](_0x247f('0x14'),controller[_0x247f('0x15')]);router[_0x247f('0x16')](_0x247f('0xe'),auth[_0x247f('0xc')](),controller[_0x247f('0x17')]);router[_0x247f('0x16')]('/:id/accept',auth['isAuthenticated'](),controller[_0x247f('0x18')]);router['put'](_0x247f('0x19'),auth[_0x247f('0xc')](),controller[_0x247f('0x1a')]);router['delete'](_0x247f('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 26425d3..eaef919 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 _0xfb7e=['STRING','DATE','BOOLEAN','TEXT','medium','ENUM','out'];(function(_0x19844b,_0x57bd24){var _0x9d47e6=function(_0x2a5036){while(--_0x2a5036){_0x19844b['push'](_0x19844b['shift']());}};_0x9d47e6(++_0x57bd24);}(_0xfb7e,0x145));var _0xefb7=function(_0x5657d8,_0x1d21d6){_0x5657d8=_0x5657d8-0x0;var _0x1b7d63=_0xfb7e[_0x5657d8];return _0x1b7d63;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xefb7('0x0')](_0xefb7('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xefb7('0x2')]('in',_0xefb7('0x3')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xefb7('0x4')]},'readAt':{'type':Sequelize[_0xefb7('0x5')]},'secret':{'type':Sequelize[_0xefb7('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x19d0=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x461676,_0x533a5b){var _0x420b09=function(_0x3fe367){while(--_0x3fe367){_0x461676['push'](_0x461676['shift']());}};_0x420b09(++_0x533a5b);}(_0x19d0,0xd9));var _0x019d=function(_0x2ff948,_0x1c8ee3){_0x2ff948=_0x2ff948-0x0;var _0x5b0d71=_0x19d0[_0x2ff948];return _0x5b0d71;};'use strict';var Sequelize=require(_0x019d('0x0'));module[_0x019d('0x1')]={'body':{'type':Sequelize[_0x019d('0x2')](_0x019d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x019d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x019d('0x5')]('in','out'),'defaultValue':_0x019d('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x019d('0x7')](0xbe)},'phone':{'type':Sequelize[_0x019d('0x7')]},'readAt':{'type':Sequelize[_0x019d('0x8')]},'secret':{'type':Sequelize[_0x019d('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x019d('0x7')]},'providerResponse':{'type':Sequelize[_0x019d('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index af5481b..c8d06e8 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 _0x08f5=['./whatsappMessage.socket','register','jayson/promise','http','client','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','WhatsappMessage,\x20%s,\x20%s','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','reject','save','update','destroy','name','map','WhatsappMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','whatsapp-interactions','read','readAt','format','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','event','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','channel','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost'];(function(_0x31922d,_0x35f27b){var _0x255700=function(_0x131746){while(--_0x131746){_0x31922d['push'](_0x31922d['shift']());}};_0x255700(++_0x35f27b);}(_0x08f5,0x172));var _0x508f=function(_0x3e8930,_0x154364){_0x3e8930=_0x3e8930-0x0;var _0x15b38f=_0x08f5[_0x3e8930];return _0x15b38f;};'use strict';var emlformat=require(_0x508f('0x0'));var rimraf=require(_0x508f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x508f('0x2'));var moment=require(_0x508f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x508f('0x4'));var path=require('path');var sox=require(_0x508f('0x5'));var csv=require(_0x508f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x508f('0x7'));var _=require(_0x508f('0x8'));var squel=require(_0x508f('0x9'));var crypto=require(_0x508f('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x508f('0x6'));var querystring=require(_0x508f('0xb'));var Papa=require('papaparse');var Redis=require(_0x508f('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x508f('0xd'));var as=require(_0x508f('0xe'));var hardwareService=require(_0x508f('0xf'));var logger=require(_0x508f('0x10'))(_0x508f('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x508f('0x12'));var db=require(_0x508f('0x13'))['db'];config['redis']=_[_0x508f('0x14')](config[_0x508f('0x15')],{'host':_0x508f('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x508f('0x17'))[_0x508f('0x18')](socket);var jayson=require(_0x508f('0x19'));var client=jayson['client'][_0x508f('0x1a')]({'port':0x232c});var client9002=jayson[_0x508f('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3528da,_0x85eaec,_0x25c9a0,_0x237d72){return new BPromise(function(_0x24f8f9,_0x3171f9){var _0x213b8e=_0x237d72||client;return _0x213b8e['request'](_0x3528da,_0x25c9a0)[_0x508f('0x1c')](function(_0x4268ff){logger[_0x508f('0x1d')]('WhatsappMessage,\x20%s,\x20%s',_0x85eaec,'request\x20sent');logger[_0x508f('0x1e')](_0x508f('0x1f'),_0x85eaec,_0x508f('0x20'),JSON['stringify'](_0x4268ff));if(_0x4268ff['error']){if(_0x4268ff[_0x508f('0x21')][_0x508f('0x22')]===0x1f4){logger[_0x508f('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x85eaec,_0x4268ff[_0x508f('0x21')][_0x508f('0x23')]);return _0x3171f9(_0x4268ff[_0x508f('0x21')][_0x508f('0x23')]);}logger['error'](_0x508f('0x24'),_0x85eaec,_0x4268ff[_0x508f('0x21')][_0x508f('0x23')]);return _0x24f8f9(_0x4268ff[_0x508f('0x21')][_0x508f('0x23')]);}else{logger[_0x508f('0x1d')](_0x508f('0x24'),_0x85eaec,_0x508f('0x20'));_0x24f8f9(_0x4268ff[_0x508f('0x25')][_0x508f('0x23')]);}})[_0x508f('0x26')](function(_0x48939f){logger['error'](_0x508f('0x24'),_0x85eaec,_0x48939f);_0x3171f9(_0x48939f);});});}function respondWithStatusCode(_0x1a455a,_0x469747){_0x469747=_0x469747||0xcc;return function(_0x28c1c8){if(_0x28c1c8){return _0x1a455a[_0x508f('0x27')](_0x469747);}return _0x1a455a['status'](_0x469747)[_0x508f('0x28')]();};}function respondWithResult(_0x230479,_0x3df705){_0x3df705=_0x3df705||0xc8;return function(_0x3bad20){if(_0x3bad20){return _0x230479['status'](_0x3df705)[_0x508f('0x29')](_0x3bad20);}};}function respondWithFilteredResult(_0x2a8a95,_0x278f56){return function(_0x56fdae){if(_0x56fdae){var _0x3683c3=typeof _0x278f56[_0x508f('0x2a')]===_0x508f('0x2b')&&typeof _0x278f56[_0x508f('0x2c')]===_0x508f('0x2b');var _0x5df3a3=_0x56fdae[_0x508f('0x2d')];var _0x38490a=_0x3683c3?0x0:_0x278f56[_0x508f('0x2a')];var _0x1fc611=_0x3683c3?_0x56fdae[_0x508f('0x2d')]:_0x278f56[_0x508f('0x2a')]+_0x278f56[_0x508f('0x2c')];var _0x1b95a7;if(_0x1fc611>=_0x5df3a3){_0x1fc611=_0x5df3a3;_0x1b95a7=0xc8;}else{_0x1b95a7=0xce;}_0x2a8a95[_0x508f('0x2e')](_0x1b95a7);return _0x2a8a95['set']('Content-Range',_0x38490a+'-'+_0x1fc611+'/'+_0x5df3a3)['json'](_0x56fdae);}return null;};}function patchUpdates(_0x3039ae){return function(_0x3c8095){try{jsonpatch['apply'](_0x3c8095,_0x3039ae,!![]);}catch(_0xefea93){return BPromise[_0x508f('0x2f')](_0xefea93);}return _0x3c8095[_0x508f('0x30')]();};}function saveUpdates(_0x46fb3f,_0x1bb397){return function(_0x55c467){if(_0x55c467){return _0x55c467[_0x508f('0x31')](_0x46fb3f)[_0x508f('0x1c')](function(_0x154714){return _0x154714;});}return null;};}function removeEntity(_0x4d1ffc,_0x325872){return function(_0x459a0f){if(_0x459a0f){return _0x459a0f[_0x508f('0x32')]()[_0x508f('0x1c')](function(){_0x4d1ffc[_0x508f('0x2e')](0xcc)[_0x508f('0x28')]();});}};}function handleEntityNotFound(_0xcc716a,_0x4fe064){return function(_0x1b0f52){if(!_0x1b0f52){_0xcc716a[_0x508f('0x27')](0x194);}return _0x1b0f52;};}function handleError(_0x116932,_0x451ceb){_0x451ceb=_0x451ceb||0x1f4;return function(_0x47fa3a){logger['error'](_0x47fa3a['stack']);if(_0x47fa3a[_0x508f('0x33')]){delete _0x47fa3a[_0x508f('0x33')];}_0x116932[_0x508f('0x2e')](_0x451ceb)['send'](_0x47fa3a);};}exports['index']=function(_0x24c0c9,_0x5bf77e){var _0x187675={},_0x267041={},_0x3e9ca5={'count':0x0,'rows':[]};var _0x5a28cb=_[_0x508f('0x34')](db[_0x508f('0x35')][_0x508f('0x36')],function(_0x5913fc){return{'name':_0x5913fc['fieldName'],'type':_0x5913fc[_0x508f('0x37')][_0x508f('0x38')]};});_0x267041[_0x508f('0x39')]=_['map'](_0x5a28cb,_0x508f('0x33'));_0x267041[_0x508f('0x3a')]=_[_0x508f('0x3b')](_0x24c0c9[_0x508f('0x3a')]);_0x267041[_0x508f('0x3c')]=_[_0x508f('0x3d')](_0x267041['model'],_0x267041['query']);_0x187675[_0x508f('0x3e')]=_[_0x508f('0x3d')](_0x267041[_0x508f('0x39')],qs[_0x508f('0x3f')](_0x24c0c9[_0x508f('0x3a')][_0x508f('0x3f')]));_0x187675[_0x508f('0x3e')]=_0x187675[_0x508f('0x3e')][_0x508f('0x40')]?_0x187675['attributes']:_0x267041['model'];if(!_0x24c0c9[_0x508f('0x3a')][_0x508f('0x41')](_0x508f('0x42'))){_0x187675[_0x508f('0x2c')]=qs['limit'](_0x24c0c9[_0x508f('0x3a')][_0x508f('0x2c')]);_0x187675[_0x508f('0x2a')]=qs['offset'](_0x24c0c9[_0x508f('0x3a')][_0x508f('0x2a')]);}_0x187675['order']=qs[_0x508f('0x43')](_0x24c0c9[_0x508f('0x3a')][_0x508f('0x43')]);_0x187675[_0x508f('0x44')]=qs[_0x508f('0x3c')](_['pick'](_0x24c0c9[_0x508f('0x3a')],_0x267041[_0x508f('0x3c')]),_0x5a28cb);if(_0x24c0c9['query'][_0x508f('0x45')]){_0x187675[_0x508f('0x44')]=_[_0x508f('0x46')](_0x187675['where'],{'$or':_[_0x508f('0x34')](_0x5a28cb,function(_0x2a8af1){if(_0x2a8af1[_0x508f('0x37')]!==_0x508f('0x47')){var _0x2ebe80={};_0x2ebe80[_0x2a8af1[_0x508f('0x33')]]={'$like':'%'+_0x24c0c9[_0x508f('0x3a')][_0x508f('0x45')]+'%'};return _0x2ebe80;}})});}_0x187675=_['merge']({},_0x187675,_0x24c0c9[_0x508f('0x48')]);var _0x5269c2={'where':_0x187675['where']};return db[_0x508f('0x35')][_0x508f('0x2d')](_0x5269c2)[_0x508f('0x1c')](function(_0x2eb275){_0x3e9ca5['count']=_0x2eb275;if(_0x24c0c9[_0x508f('0x3a')][_0x508f('0x49')]){_0x187675[_0x508f('0x4a')]=[{'all':!![]}];}return db[_0x508f('0x35')][_0x508f('0x4b')](_0x187675);})[_0x508f('0x1c')](function(_0x5cfb34){_0x3e9ca5[_0x508f('0x4c')]=_0x5cfb34;return _0x3e9ca5;})[_0x508f('0x1c')](respondWithFilteredResult(_0x5bf77e,_0x187675))['catch'](handleError(_0x5bf77e,null));};exports[_0x508f('0x4d')]=function(_0x6440c4,_0x4c1423){var _0x2dc00e={'raw':!![],'where':{'id':_0x6440c4[_0x508f('0x4e')]['id']}},_0x59038e={};_0x59038e['model']=_[_0x508f('0x3b')](db[_0x508f('0x35')]['rawAttributes']);_0x59038e[_0x508f('0x3a')]=_['keys'](_0x6440c4['query']);_0x59038e[_0x508f('0x3c')]=_[_0x508f('0x3d')](_0x59038e[_0x508f('0x39')],_0x59038e[_0x508f('0x3a')]);_0x2dc00e[_0x508f('0x3e')]=_['intersection'](_0x59038e['model'],qs[_0x508f('0x3f')](_0x6440c4[_0x508f('0x3a')][_0x508f('0x3f')]));_0x2dc00e['attributes']=_0x2dc00e[_0x508f('0x3e')][_0x508f('0x40')]?_0x2dc00e[_0x508f('0x3e')]:_0x59038e['model'];if(_0x6440c4[_0x508f('0x3a')][_0x508f('0x49')]){_0x2dc00e[_0x508f('0x4a')]=[{'all':!![]}];}_0x2dc00e=_[_0x508f('0x46')]({},_0x2dc00e,_0x6440c4[_0x508f('0x48')]);return db[_0x508f('0x35')][_0x508f('0x4f')](_0x2dc00e)['then'](handleEntityNotFound(_0x4c1423,null))[_0x508f('0x1c')](respondWithResult(_0x4c1423,null))[_0x508f('0x26')](handleError(_0x4c1423,null));};exports[_0x508f('0x50')]=function(_0xc9439a,_0x8b237d){return db['WhatsappMessage'][_0x508f('0x50')](_0xc9439a['body'],{})[_0x508f('0x1c')](respondWithResult(_0x8b237d,0xc9))['catch'](handleError(_0x8b237d,null));};exports[_0x508f('0x31')]=function(_0xb1cb2c,_0x3df761){if(_0xb1cb2c['body']['id']){delete _0xb1cb2c[_0x508f('0x51')]['id'];}return db[_0x508f('0x35')][_0x508f('0x4f')]({'where':{'id':_0xb1cb2c[_0x508f('0x4e')]['id']}})[_0x508f('0x1c')](handleEntityNotFound(_0x3df761,null))[_0x508f('0x1c')](saveUpdates(_0xb1cb2c[_0x508f('0x51')],null))[_0x508f('0x1c')](respondWithResult(_0x3df761,null))[_0x508f('0x26')](handleError(_0x3df761,null));};exports[_0x508f('0x32')]=function(_0x4ad203,_0x128a31){return db[_0x508f('0x35')][_0x508f('0x4f')]({'where':{'id':_0x4ad203[_0x508f('0x4e')]['id']}})[_0x508f('0x1c')](handleEntityNotFound(_0x128a31,null))[_0x508f('0x1c')](removeEntity(_0x128a31,null))['catch'](handleError(_0x128a31,null));};exports[_0x508f('0x52')]=function(_0x110d57,_0x401f4c){return db[_0x508f('0x35')]['describe']()[_0x508f('0x1c')](respondWithResult(_0x401f4c,null))['catch'](handleError(_0x401f4c,null));};var interaction_log=require(_0x508f('0x10'))(_0x508f('0x53'));exports['accept']=function(_0x28275d,_0xdada78,_0x2f0e60){var _0x7b105d={'agent':{},'channel':'whatsapp'};if(_0x28275d[_0x508f('0x51')]['id']){delete _0x28275d[_0x508f('0x51')]['id'];}_0x28275d[_0x508f('0x51')][_0x508f('0x54')]=!![];_0x28275d[_0x508f('0x51')][_0x508f('0x55')]=moment()[_0x508f('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x28275d['body']['UserId']=_0x28275d['body'][_0x508f('0x57')]||_0x28275d[_0x508f('0x58')]['id'];_0x7b105d['agent']['id']=_0x28275d[_0x508f('0x51')][_0x508f('0x57')];return db[_0x508f('0x35')][_0x508f('0x4f')]({'where':{'id':_0x28275d['params']['id'],'UserId':null}})[_0x508f('0x1c')](handleEntityNotFound(_0xdada78,null))[_0x508f('0x1c')](saveUpdates(_0x28275d[_0x508f('0x51')],null))[_0x508f('0x1c')](function(_0x21890f){if(_0x21890f){_0x7b105d[_0x508f('0x23')]=_0x21890f[_0x508f('0x59')]({'plain':!![]});return db['WhatsappInteraction'][_0x508f('0x4f')]({'where':{'id':_0x21890f[_0x508f('0x5a')]}});}return null;})[_0x508f('0x1c')](handleEntityNotFound(_0xdada78,null))[_0x508f('0x1c')](function(_0x2dc89c){if(_0x2dc89c){return _0x2dc89c[_0x508f('0x31')]({'UserId':_0x28275d[_0x508f('0x51')][_0x508f('0x57')],'read1stAt':_[_0x508f('0x5b')](_0x2dc89c[_0x508f('0x5c')])?moment()[_0x508f('0x56')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x508f('0x1c')](function(_0x50dbbd){if(_0x50dbbd){_0x7b105d['interaction']=_0x50dbbd['get']({'plain':!![]});interaction_log[_0x508f('0x1d')](_0x508f('0x5d'),_0x28275d['user']['id'],_0x28275d[_0x508f('0x58')][_0x508f('0x33')],_0x28275d[_0x508f('0x58')][_0x508f('0x5e')],_0x7b105d[_0x508f('0x5f')]['id'],_0x28275d['body']?JSON[_0x508f('0x60')](_0x28275d['body']):_0x508f('0x61'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x7b105d);}return null;})[_0x508f('0x1c')](function(_0x297c41){var _0x4fd745=_0x508f('0x62')+_0x297c41[_0x508f('0x23')][_0x508f('0x63')];return db[_0x508f('0x64')][_0x508f('0x3a')](_0x4fd745,{'type':db[_0x508f('0x65')][_0x508f('0x66')][_0x508f('0x67')],'raw':!![]})[_0x508f('0x1c')](function(_0x2846d7){return _0x2846d7;});})[_0x508f('0x1c')](function(_0x5a74c7){if(_0x5a74c7){_0x7b105d[_0x508f('0x23')][_0x508f('0x68')]=_0x5a74c7[0x0];if(!_0x28275d[_0x508f('0x51')][_0x508f('0x57')])return;return db[_0x508f('0x69')][_0x508f('0x4f')]({'where':{'id':_0x28275d[_0x508f('0x51')][_0x508f('0x57')],'role':_0x508f('0x6a')},'attributes':['id',_0x508f('0x33'),_0x508f('0x6b'),_0x508f('0x6c'),_0x508f('0x6d')],'raw':!![]});}return null;})[_0x508f('0x1c')](function(_0xed55b){if(!_0xed55b)return null;_0x7b105d['message'][_0x508f('0x6a')]=_0xed55b;return _0x7b105d;})['then'](function(_0x40e67b){if(_0x40e67b){if(_0x28275d['body'][_0x508f('0x6e')]){_0x7b105d['message'][_0x508f('0x6f')]=util[_0x508f('0x56')](_0x508f('0x70'),_0x28275d[_0x508f('0x58')][_0x508f('0x33')]);_0x7b105d[_0x508f('0x23')]['channel']=_0x7b105d['channel'];_0x7b105d[_0x508f('0x23')][_0x508f('0x71')]='accept';return respondWithRpcPromise('EventManager',_0x508f('0x72'),{'event':_0x508f('0x73'),'message':_0x7b105d[_0x508f('0x23')]},client9002)[_0x508f('0x1c')](function(){return _0x7b105d;});}return _0x7b105d;}return null;})[_0x508f('0x1c')](respondWithResult(_0xdada78,null))['catch'](handleError(_0xdada78,null));};var interaction_log=require(_0x508f('0x10'))(_0x508f('0x53'));exports['reject']=function(_0x3dfb3b,_0x4e1df1,_0x5c1cd0){var _0x3c4286={'agent':{},'channel':_0x508f('0x74')};if(_0x3dfb3b[_0x508f('0x51')]['id']){delete _0x3dfb3b['body']['id'];}_0x3dfb3b[_0x508f('0x51')][_0x508f('0x57')]=_0x3dfb3b[_0x508f('0x51')]['UserId']||_0x3dfb3b[_0x508f('0x58')]['id'];_0x3c4286['agent']['id']=_0x3dfb3b[_0x508f('0x51')]['UserId'];return db['WhatsappMessage']['find']({'where':{'id':_0x3dfb3b['params']['id'],'UserId':null}})[_0x508f('0x1c')](handleEntityNotFound(_0x4e1df1,null))['then'](function(_0x3fc07f){if(_0x3fc07f){_0x3c4286[_0x508f('0x23')]=_0x3fc07f['get']({'plain':!![]});return db['WhatsappInteraction'][_0x508f('0x4f')]({'where':{'id':_0x3fc07f[_0x508f('0x5a')]}});}return null;})['then'](handleEntityNotFound(_0x4e1df1,null))['then'](function(_0x70e356){if(_0x70e356){_0x3c4286[_0x508f('0x5f')]=_0x70e356['get']({'plain':!![]});interaction_log[_0x508f('0x1d')](_0x508f('0x75'),_0x3dfb3b['user']['id'],_0x3dfb3b['user'][_0x508f('0x33')],_0x3dfb3b[_0x508f('0x58')][_0x508f('0x5e')],_0x3c4286[_0x508f('0x5f')]['id'],_0x3dfb3b['body']?JSON[_0x508f('0x60')](_0x3dfb3b['body']):'null');return respondWithRpcPromise(_0x508f('0x76'),_0x508f('0x77'),_0x3c4286);}return null;})['then'](function(_0x2e9df2){var _0x12d5bd=_0x508f('0x62')+_0x2e9df2['message']['ContactId'];return db['sequelize'][_0x508f('0x3a')](_0x12d5bd,{'type':db[_0x508f('0x65')]['QueryTypes'][_0x508f('0x67')],'raw':!![]})[_0x508f('0x1c')](function(_0x4c309e){return _0x4c309e;});})[_0x508f('0x1c')](function(_0xf5b5ad){if(_0xf5b5ad){_0x3c4286[_0x508f('0x23')][_0x508f('0x68')]=_0xf5b5ad[0x0];if(!_0x3dfb3b[_0x508f('0x51')][_0x508f('0x57')])return;return db[_0x508f('0x69')][_0x508f('0x4f')]({'where':{'id':_0x3dfb3b['body'][_0x508f('0x57')],'role':_0x508f('0x6a')},'attributes':['id',_0x508f('0x33'),'fullname',_0x508f('0x6c'),_0x508f('0x6d')],'raw':!![]});}return null;})[_0x508f('0x1c')](function(_0x2c9859){if(!_0x2c9859)return null;_0x3c4286['message'][_0x508f('0x6a')]=_0x2c9859;return _0x3c4286;})[_0x508f('0x1c')](function(_0x5973e0){if(_0x5973e0){_0x5973e0[_0x508f('0x23')][_0x508f('0x6f')]=util[_0x508f('0x56')](_0x508f('0x70'),_0x3dfb3b[_0x508f('0x58')][_0x508f('0x33')]);_0x5973e0[_0x508f('0x23')][_0x508f('0x78')]=_0x3c4286[_0x508f('0x78')];_0x5973e0[_0x508f('0x23')]['event']=_0x508f('0x2f');respondWithRpcPromise('EventManager','EventManager',{'event':_0x508f('0x79'),'message':_0x5973e0[_0x508f('0x23')]},client9002);return _0x3c4286;}return null;})[_0x508f('0x1c')](respondWithResult(_0x4e1df1,null))['catch'](handleError(_0x4e1df1,null));};exports[_0x508f('0x2e')]=function(_0x4f9186,_0x1b403b,_0x294f70){if(_0x4f9186[_0x508f('0x51')]['id']){delete _0x4f9186[_0x508f('0x51')]['id'];}var _0x54e825;return db[_0x508f('0x35')]['find']({'where':{'id':_0x4f9186[_0x508f('0x4e')]['id']}})[_0x508f('0x1c')](handleEntityNotFound(_0x1b403b,null))[_0x508f('0x1c')](function(_0x24cc68){if(_0x24cc68){_0x54e825=_0x24cc68;return db[_0x508f('0x7a')][_0x508f('0x4f')]({'where':{'id':_0x24cc68[_0x508f('0x7b')]}});}})[_0x508f('0x1c')](handleEntityNotFound(_0x1b403b,null))[_0x508f('0x1c')](function(_0x1d9f47){if(_0x1d9f47){logger[_0x508f('0x1e')](_0x508f('0x7c'),_0x508f('0x2e'),_0x508f('0x7d'),_0x1d9f47['type'],util[_0x508f('0x7e')](_0x4f9186['body'],{'showHidden':![],'depth':null}));switch(_0x1d9f47[_0x508f('0x37')]){case'twilio':if(_0x4f9186[_0x508f('0x51')][_0x508f('0x7f')]&&_0x4f9186[_0x508f('0x51')][_0x508f('0x7f')]===_0x54e825['messageId']&&_0x4f9186[_0x508f('0x51')][_0x508f('0x80')]&&_0x4f9186[_0x508f('0x51')][_0x508f('0x80')]===_0x508f('0x54')){return _0x54e825[_0x508f('0x31')]({'read':!![]});}else{logger[_0x508f('0x21')](_0x508f('0x81'),_0x508f('0x2e'),_0x508f('0x82'),util[_0x508f('0x7e')](_0x4f9186[_0x508f('0x51')],{'showHidden':![],'depth':null}));}break;}return _0x54e825;}})[_0x508f('0x1c')](respondWithResult(_0x1b403b,null))[_0x508f('0x26')](handleError(_0x1b403b,null));}; \ No newline at end of file +var _0xee6d=['Sequelize','QueryTypes','SELECT','fullname','email','internal','channel','event','reject','WhatsappInteraction','RejectMessage','contact','User','interface','SIP/%s','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','read','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','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','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','WhatsappMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','status','stack','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','WhatsappMessage','include','findAll','rows','params','keys','includeAll','create','body','find','describe','accept','whatsapp','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteractionId','read1stAt','format','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize'];(function(_0x25238d,_0x5494d6){var _0x4582e1=function(_0x177c81){while(--_0x177c81){_0x25238d['push'](_0x25238d['shift']());}};_0x4582e1(++_0x5494d6);}(_0xee6d,0xa1));var _0xdee6=function(_0x209fcd,_0x2638e7){_0x209fcd=_0x209fcd-0x0;var _0x48da20=_0xee6d[_0x209fcd];return _0x48da20;};'use strict';var emlformat=require(_0xdee6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdee6('0x1'));var rp=require(_0xdee6('0x2'));var moment=require('moment');var BPromise=require(_0xdee6('0x3'));var Mustache=require(_0xdee6('0x4'));var util=require(_0xdee6('0x5'));var path=require('path');var sox=require(_0xdee6('0x6'));var csv=require(_0xdee6('0x7'));var ejs=require(_0xdee6('0x8'));var fs=require('fs');var fs_extra=require(_0xdee6('0x9'));var _=require(_0xdee6('0xa'));var squel=require(_0xdee6('0xb'));var crypto=require(_0xdee6('0xc'));var jsforce=require(_0xdee6('0xd'));var deskjs=require(_0xdee6('0xe'));var toCsv=require(_0xdee6('0x7'));var querystring=require(_0xdee6('0xf'));var Papa=require(_0xdee6('0x10'));var Redis=require(_0xdee6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xdee6('0x12'));var as=require(_0xdee6('0x13'));var hardwareService=require(_0xdee6('0x14'));var logger=require(_0xdee6('0x15'))(_0xdee6('0x16'));var utils=require(_0xdee6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xdee6('0x18'));var db=require(_0xdee6('0x19'))['db'];config['redis']=_[_0xdee6('0x1a')](config[_0xdee6('0x1b')],{'host':_0xdee6('0x1c'),'port':0x18eb});var socket=require(_0xdee6('0x1d'))(new Redis(config['redis']));require(_0xdee6('0x1e'))[_0xdee6('0x1f')](socket);var jayson=require(_0xdee6('0x20'));var client=jayson[_0xdee6('0x21')][_0xdee6('0x22')]({'port':0x232c});var client9002=jayson[_0xdee6('0x21')][_0xdee6('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x11a4d0,_0x322856,_0x451144,_0x1aac99){return new BPromise(function(_0x32a0dd,_0x5b2032){var _0x2598ce=_0x1aac99||client;return _0x2598ce[_0xdee6('0x23')](_0x11a4d0,_0x451144)[_0xdee6('0x24')](function(_0x3cf58a){logger['info'](_0xdee6('0x25'),_0x322856,'request\x20sent');logger[_0xdee6('0x26')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x322856,_0xdee6('0x27'),JSON[_0xdee6('0x28')](_0x3cf58a));if(_0x3cf58a[_0xdee6('0x29')]){if(_0x3cf58a[_0xdee6('0x29')][_0xdee6('0x2a')]===0x1f4){logger[_0xdee6('0x29')](_0xdee6('0x25'),_0x322856,_0x3cf58a[_0xdee6('0x29')][_0xdee6('0x2b')]);return _0x5b2032(_0x3cf58a[_0xdee6('0x29')][_0xdee6('0x2b')]);}logger[_0xdee6('0x29')]('WhatsappMessage,\x20%s,\x20%s',_0x322856,_0x3cf58a[_0xdee6('0x29')]['message']);return _0x32a0dd(_0x3cf58a[_0xdee6('0x29')]['message']);}else{logger[_0xdee6('0x2c')](_0xdee6('0x25'),_0x322856,_0xdee6('0x27'));_0x32a0dd(_0x3cf58a[_0xdee6('0x2d')]['message']);}})[_0xdee6('0x2e')](function(_0x22c525){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x322856,_0x22c525);_0x5b2032(_0x22c525);});});}function respondWithStatusCode(_0x288f7c,_0xa8d15a){_0xa8d15a=_0xa8d15a||0xcc;return function(_0x1278ae){if(_0x1278ae){return _0x288f7c[_0xdee6('0x2f')](_0xa8d15a);}return _0x288f7c['status'](_0xa8d15a)['end']();};}function respondWithResult(_0x118287,_0x396ed6){_0x396ed6=_0x396ed6||0xc8;return function(_0x3f9b0c){if(_0x3f9b0c){return _0x118287['status'](_0x396ed6)[_0xdee6('0x30')](_0x3f9b0c);}};}function respondWithFilteredResult(_0x1042d1,_0x55bfa7){return function(_0x1f955d){if(_0x1f955d){var _0x28f537=typeof _0x55bfa7[_0xdee6('0x31')]===_0xdee6('0x32')&&typeof _0x55bfa7[_0xdee6('0x33')]===_0xdee6('0x32');var _0x21083d=_0x1f955d[_0xdee6('0x34')];var _0x789c1e=_0x28f537?0x0:_0x55bfa7[_0xdee6('0x31')];var _0x3e17b6=_0x28f537?_0x1f955d['count']:_0x55bfa7[_0xdee6('0x31')]+_0x55bfa7[_0xdee6('0x33')];var _0x36121e;if(_0x3e17b6>=_0x21083d){_0x3e17b6=_0x21083d;_0x36121e=0xc8;}else{_0x36121e=0xce;}_0x1042d1['status'](_0x36121e);return _0x1042d1[_0xdee6('0x35')](_0xdee6('0x36'),_0x789c1e+'-'+_0x3e17b6+'/'+_0x21083d)['json'](_0x1f955d);}return null;};}function patchUpdates(_0x297780){return function(_0x3c41b8){try{jsonpatch[_0xdee6('0x37')](_0x3c41b8,_0x297780,!![]);}catch(_0x3d6b90){return BPromise['reject'](_0x3d6b90);}return _0x3c41b8[_0xdee6('0x38')]();};}function saveUpdates(_0x3369e0,_0x127304){return function(_0x458946){if(_0x458946){return _0x458946[_0xdee6('0x39')](_0x3369e0)[_0xdee6('0x24')](function(_0x2cfff2){return _0x2cfff2;});}return null;};}function removeEntity(_0x1a4be9,_0x65c9c7){return function(_0x28f4e1){if(_0x28f4e1){return _0x28f4e1[_0xdee6('0x3a')]()[_0xdee6('0x24')](function(){_0x1a4be9[_0xdee6('0x3b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40a6c6,_0x2d9dee){return function(_0x30b3c6){if(!_0x30b3c6){_0x40a6c6[_0xdee6('0x2f')](0x194);}return _0x30b3c6;};}function handleError(_0x52144d,_0x5a930b){_0x5a930b=_0x5a930b||0x1f4;return function(_0x5096d9){logger[_0xdee6('0x29')](_0x5096d9[_0xdee6('0x3c')]);if(_0x5096d9[_0xdee6('0x3d')]){delete _0x5096d9[_0xdee6('0x3d')];}_0x52144d[_0xdee6('0x3b')](_0x5a930b)['send'](_0x5096d9);};}exports[_0xdee6('0x3e')]=function(_0x21d46c,_0x1f3a18){var _0x3796c0={},_0x5de3f0={},_0x4f08e7={'count':0x0,'rows':[]};var _0x33cf72=_[_0xdee6('0x3f')](db['WhatsappMessage']['rawAttributes'],function(_0x17b1aa){return{'name':_0x17b1aa[_0xdee6('0x40')],'type':_0x17b1aa[_0xdee6('0x41')][_0xdee6('0x42')]};});_0x5de3f0[_0xdee6('0x43')]=_[_0xdee6('0x3f')](_0x33cf72,_0xdee6('0x3d'));_0x5de3f0[_0xdee6('0x44')]=_['keys'](_0x21d46c['query']);_0x5de3f0[_0xdee6('0x45')]=_[_0xdee6('0x46')](_0x5de3f0[_0xdee6('0x43')],_0x5de3f0[_0xdee6('0x44')]);_0x3796c0[_0xdee6('0x47')]=_[_0xdee6('0x46')](_0x5de3f0['model'],qs[_0xdee6('0x48')](_0x21d46c[_0xdee6('0x44')]['fields']));_0x3796c0[_0xdee6('0x47')]=_0x3796c0[_0xdee6('0x47')][_0xdee6('0x49')]?_0x3796c0[_0xdee6('0x47')]:_0x5de3f0[_0xdee6('0x43')];if(!_0x21d46c[_0xdee6('0x44')][_0xdee6('0x4a')](_0xdee6('0x4b'))){_0x3796c0[_0xdee6('0x33')]=qs['limit'](_0x21d46c[_0xdee6('0x44')][_0xdee6('0x33')]);_0x3796c0['offset']=qs['offset'](_0x21d46c[_0xdee6('0x44')][_0xdee6('0x31')]);}_0x3796c0[_0xdee6('0x4c')]=qs['sort'](_0x21d46c[_0xdee6('0x44')][_0xdee6('0x4d')]);_0x3796c0[_0xdee6('0x4e')]=qs['filters'](_['pick'](_0x21d46c[_0xdee6('0x44')],_0x5de3f0[_0xdee6('0x45')]),_0x33cf72);if(_0x21d46c['query']['filter']){_0x3796c0['where']=_[_0xdee6('0x4f')](_0x3796c0[_0xdee6('0x4e')],{'$or':_[_0xdee6('0x3f')](_0x33cf72,function(_0x6a9220){if(_0x6a9220['type']!==_0xdee6('0x50')){var _0x5701f9={};_0x5701f9[_0x6a9220[_0xdee6('0x3d')]]={'$like':'%'+_0x21d46c[_0xdee6('0x44')][_0xdee6('0x51')]+'%'};return _0x5701f9;}})});}_0x3796c0=_[_0xdee6('0x4f')]({},_0x3796c0,_0x21d46c[_0xdee6('0x52')]);var _0x48444b={'where':_0x3796c0[_0xdee6('0x4e')]};return db[_0xdee6('0x53')][_0xdee6('0x34')](_0x48444b)['then'](function(_0x70fd0f){_0x4f08e7[_0xdee6('0x34')]=_0x70fd0f;if(_0x21d46c[_0xdee6('0x44')]['includeAll']){_0x3796c0[_0xdee6('0x54')]=[{'all':!![]}];}return db[_0xdee6('0x53')][_0xdee6('0x55')](_0x3796c0);})[_0xdee6('0x24')](function(_0x44798c){_0x4f08e7[_0xdee6('0x56')]=_0x44798c;return _0x4f08e7;})['then'](respondWithFilteredResult(_0x1f3a18,_0x3796c0))['catch'](handleError(_0x1f3a18,null));};exports['show']=function(_0x1c3251,_0x4ae671){var _0x29ab1f={'raw':!![],'where':{'id':_0x1c3251[_0xdee6('0x57')]['id']}},_0x1c39c8={};_0x1c39c8['model']=_['keys'](db[_0xdee6('0x53')]['rawAttributes']);_0x1c39c8['query']=_[_0xdee6('0x58')](_0x1c3251['query']);_0x1c39c8[_0xdee6('0x45')]=_[_0xdee6('0x46')](_0x1c39c8['model'],_0x1c39c8[_0xdee6('0x44')]);_0x29ab1f[_0xdee6('0x47')]=_[_0xdee6('0x46')](_0x1c39c8['model'],qs[_0xdee6('0x48')](_0x1c3251[_0xdee6('0x44')][_0xdee6('0x48')]));_0x29ab1f['attributes']=_0x29ab1f[_0xdee6('0x47')][_0xdee6('0x49')]?_0x29ab1f['attributes']:_0x1c39c8[_0xdee6('0x43')];if(_0x1c3251['query'][_0xdee6('0x59')]){_0x29ab1f[_0xdee6('0x54')]=[{'all':!![]}];}_0x29ab1f=_[_0xdee6('0x4f')]({},_0x29ab1f,_0x1c3251[_0xdee6('0x52')]);return db[_0xdee6('0x53')]['find'](_0x29ab1f)[_0xdee6('0x24')](handleEntityNotFound(_0x4ae671,null))[_0xdee6('0x24')](respondWithResult(_0x4ae671,null))[_0xdee6('0x2e')](handleError(_0x4ae671,null));};exports[_0xdee6('0x5a')]=function(_0x4cd489,_0x4e455a){return db[_0xdee6('0x53')][_0xdee6('0x5a')](_0x4cd489[_0xdee6('0x5b')],{})['then'](respondWithResult(_0x4e455a,0xc9))[_0xdee6('0x2e')](handleError(_0x4e455a,null));};exports[_0xdee6('0x39')]=function(_0xf56a96,_0x4c834e){if(_0xf56a96[_0xdee6('0x5b')]['id']){delete _0xf56a96['body']['id'];}return db[_0xdee6('0x53')]['find']({'where':{'id':_0xf56a96['params']['id']}})['then'](handleEntityNotFound(_0x4c834e,null))[_0xdee6('0x24')](saveUpdates(_0xf56a96[_0xdee6('0x5b')],null))['then'](respondWithResult(_0x4c834e,null))[_0xdee6('0x2e')](handleError(_0x4c834e,null));};exports['destroy']=function(_0x508ace,_0x360e15){return db[_0xdee6('0x53')][_0xdee6('0x5c')]({'where':{'id':_0x508ace[_0xdee6('0x57')]['id']}})[_0xdee6('0x24')](handleEntityNotFound(_0x360e15,null))['then'](removeEntity(_0x360e15,null))['catch'](handleError(_0x360e15,null));};exports[_0xdee6('0x5d')]=function(_0x249e77,_0x170aa1){return db[_0xdee6('0x53')]['describe']()[_0xdee6('0x24')](respondWithResult(_0x170aa1,null))[_0xdee6('0x2e')](handleError(_0x170aa1,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xdee6('0x5e')]=function(_0x12ca98,_0x18ed74,_0x39ed06){var _0x9f0964={'agent':{},'channel':_0xdee6('0x5f')};if(_0x12ca98[_0xdee6('0x5b')]['id']){delete _0x12ca98[_0xdee6('0x5b')]['id'];}_0x12ca98[_0xdee6('0x5b')]['read']=!![];_0x12ca98[_0xdee6('0x5b')][_0xdee6('0x60')]=moment()['format'](_0xdee6('0x61'));_0x12ca98[_0xdee6('0x5b')][_0xdee6('0x62')]=_0x12ca98['body'][_0xdee6('0x62')]||_0x12ca98[_0xdee6('0x63')]['id'];_0x9f0964[_0xdee6('0x64')]['id']=_0x12ca98['body'][_0xdee6('0x62')];return db[_0xdee6('0x53')][_0xdee6('0x5c')]({'where':{'id':_0x12ca98[_0xdee6('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x18ed74,null))[_0xdee6('0x24')](saveUpdates(_0x12ca98['body'],null))[_0xdee6('0x24')](function(_0x4a6bc5){if(_0x4a6bc5){_0x9f0964[_0xdee6('0x2b')]=_0x4a6bc5[_0xdee6('0x65')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x4a6bc5[_0xdee6('0x66')]}});}return null;})[_0xdee6('0x24')](handleEntityNotFound(_0x18ed74,null))[_0xdee6('0x24')](function(_0x58c2b6){if(_0x58c2b6){return _0x58c2b6[_0xdee6('0x39')]({'UserId':_0x12ca98['body'][_0xdee6('0x62')],'read1stAt':_['isNil'](_0x58c2b6[_0xdee6('0x67')])?moment()[_0xdee6('0x68')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xdee6('0x24')](function(_0x1f1b52){if(_0x1f1b52){_0x9f0964['interaction']=_0x1f1b52[_0xdee6('0x65')]({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x12ca98['user']['id'],_0x12ca98[_0xdee6('0x63')][_0xdee6('0x3d')],_0x12ca98['user'][_0xdee6('0x69')],_0x9f0964[_0xdee6('0x6a')]['id'],_0x12ca98[_0xdee6('0x5b')]?JSON[_0xdee6('0x28')](_0x12ca98['body']):_0xdee6('0x6b'));return respondWithRpcPromise(_0xdee6('0x6c'),_0xdee6('0x6d'),_0x9f0964);}return null;})[_0xdee6('0x24')](function(_0x531ca2){var _0x44262c=_0xdee6('0x6e')+_0x531ca2['message'][_0xdee6('0x6f')];return db[_0xdee6('0x70')][_0xdee6('0x44')](_0x44262c,{'type':db[_0xdee6('0x71')][_0xdee6('0x72')][_0xdee6('0x73')],'raw':!![]})[_0xdee6('0x24')](function(_0x3cc240){return _0x3cc240;});})[_0xdee6('0x24')](function(_0x476803){if(_0x476803){_0x9f0964[_0xdee6('0x2b')]['contact']=_0x476803[0x0];if(!_0x12ca98[_0xdee6('0x5b')][_0xdee6('0x62')])return;return db['User'][_0xdee6('0x5c')]({'where':{'id':_0x12ca98['body'][_0xdee6('0x62')],'role':_0xdee6('0x64')},'attributes':['id',_0xdee6('0x3d'),_0xdee6('0x74'),_0xdee6('0x75'),_0xdee6('0x76')],'raw':!![]});}return null;})[_0xdee6('0x24')](function(_0x40cb27){if(!_0x40cb27)return null;_0x9f0964[_0xdee6('0x2b')][_0xdee6('0x64')]=_0x40cb27;return _0x9f0964;})[_0xdee6('0x24')](function(_0x942e89){if(_0x942e89){if(_0x12ca98[_0xdee6('0x5b')]['manual']){_0x9f0964['message']['interface']=util[_0xdee6('0x68')]('SIP/%s',_0x12ca98[_0xdee6('0x63')][_0xdee6('0x3d')]);_0x9f0964[_0xdee6('0x2b')]['channel']=_0x9f0964[_0xdee6('0x77')];_0x9f0964['message'][_0xdee6('0x78')]=_0xdee6('0x5e');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x9f0964[_0xdee6('0x2b')]},client9002)[_0xdee6('0x24')](function(){return _0x9f0964;});}return _0x9f0964;}return null;})['then'](respondWithResult(_0x18ed74,null))[_0xdee6('0x2e')](handleError(_0x18ed74,null));};var interaction_log=require(_0xdee6('0x15'))('whatsapp-interactions');exports[_0xdee6('0x79')]=function(_0x5c886d,_0x24edd4,_0x3578ce){var _0x2f630d={'agent':{},'channel':_0xdee6('0x5f')};if(_0x5c886d[_0xdee6('0x5b')]['id']){delete _0x5c886d[_0xdee6('0x5b')]['id'];}_0x5c886d[_0xdee6('0x5b')][_0xdee6('0x62')]=_0x5c886d[_0xdee6('0x5b')][_0xdee6('0x62')]||_0x5c886d[_0xdee6('0x63')]['id'];_0x2f630d['agent']['id']=_0x5c886d['body']['UserId'];return db[_0xdee6('0x53')][_0xdee6('0x5c')]({'where':{'id':_0x5c886d[_0xdee6('0x57')]['id'],'UserId':null}})[_0xdee6('0x24')](handleEntityNotFound(_0x24edd4,null))[_0xdee6('0x24')](function(_0xd0754c){if(_0xd0754c){_0x2f630d[_0xdee6('0x2b')]=_0xd0754c[_0xdee6('0x65')]({'plain':!![]});return db[_0xdee6('0x7a')]['find']({'where':{'id':_0xd0754c[_0xdee6('0x66')]}});}return null;})[_0xdee6('0x24')](handleEntityNotFound(_0x24edd4,null))[_0xdee6('0x24')](function(_0x5e2add){if(_0x5e2add){_0x2f630d[_0xdee6('0x6a')]=_0x5e2add['get']({'plain':!![]});interaction_log[_0xdee6('0x2c')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5c886d[_0xdee6('0x63')]['id'],_0x5c886d[_0xdee6('0x63')][_0xdee6('0x3d')],_0x5c886d[_0xdee6('0x63')][_0xdee6('0x69')],_0x2f630d[_0xdee6('0x6a')]['id'],_0x5c886d['body']?JSON['stringify'](_0x5c886d['body']):_0xdee6('0x6b'));return respondWithRpcPromise(_0xdee6('0x7b'),'rejectMessage',_0x2f630d);}return null;})[_0xdee6('0x24')](function(_0x5aab06){var _0xe6fed=_0xdee6('0x6e')+_0x5aab06[_0xdee6('0x2b')][_0xdee6('0x6f')];return db[_0xdee6('0x70')][_0xdee6('0x44')](_0xe6fed,{'type':db['Sequelize'][_0xdee6('0x72')][_0xdee6('0x73')],'raw':!![]})[_0xdee6('0x24')](function(_0x260382){return _0x260382;});})[_0xdee6('0x24')](function(_0x547072){if(_0x547072){_0x2f630d[_0xdee6('0x2b')][_0xdee6('0x7c')]=_0x547072[0x0];if(!_0x5c886d['body'][_0xdee6('0x62')])return;return db[_0xdee6('0x7d')][_0xdee6('0x5c')]({'where':{'id':_0x5c886d[_0xdee6('0x5b')][_0xdee6('0x62')],'role':'agent'},'attributes':['id',_0xdee6('0x3d'),_0xdee6('0x74'),_0xdee6('0x75'),_0xdee6('0x76')],'raw':!![]});}return null;})[_0xdee6('0x24')](function(_0x467662){if(!_0x467662)return null;_0x2f630d[_0xdee6('0x2b')][_0xdee6('0x64')]=_0x467662;return _0x2f630d;})[_0xdee6('0x24')](function(_0xcd3958){if(_0xcd3958){_0xcd3958['message'][_0xdee6('0x7e')]=util[_0xdee6('0x68')](_0xdee6('0x7f'),_0x5c886d[_0xdee6('0x63')][_0xdee6('0x3d')]);_0xcd3958[_0xdee6('0x2b')][_0xdee6('0x77')]=_0x2f630d[_0xdee6('0x77')];_0xcd3958[_0xdee6('0x2b')][_0xdee6('0x78')]=_0xdee6('0x79');respondWithRpcPromise('EventManager','EventManager',{'event':_0xdee6('0x80'),'message':_0xcd3958['message']},client9002);return _0x2f630d;}return null;})[_0xdee6('0x24')](respondWithResult(_0x24edd4,null))[_0xdee6('0x2e')](handleError(_0x24edd4,null));};exports[_0xdee6('0x3b')]=function(_0x18af63,_0x3d00fa,_0x505fc6){if(_0x18af63[_0xdee6('0x5b')]['id']){delete _0x18af63[_0xdee6('0x5b')]['id'];}var _0x22829f;return db[_0xdee6('0x53')][_0xdee6('0x5c')]({'where':{'id':_0x18af63['params']['id']}})[_0xdee6('0x24')](handleEntityNotFound(_0x3d00fa,null))['then'](function(_0x168702){if(_0x168702){_0x22829f=_0x168702;return db['WhatsappAccount'][_0xdee6('0x5c')]({'where':{'id':_0x168702[_0xdee6('0x81')]}});}})[_0xdee6('0x24')](handleEntityNotFound(_0x3d00fa,null))[_0xdee6('0x24')](function(_0x42b3d8){if(_0x42b3d8){logger[_0xdee6('0x26')]('WhatsppMessage,\x20%s,\x20%s,\x20%s','status',_0xdee6('0x82'),_0x42b3d8['type'],util[_0xdee6('0x83')](_0x18af63[_0xdee6('0x5b')],{'showHidden':![],'depth':null}));switch(_0x42b3d8[_0xdee6('0x41')]){case _0xdee6('0x84'):if(_0x18af63[_0xdee6('0x5b')][_0xdee6('0x85')]&&_0x18af63['body'][_0xdee6('0x85')]===_0x22829f[_0xdee6('0x86')]&&_0x18af63[_0xdee6('0x5b')]['MessageStatus']&&_0x18af63[_0xdee6('0x5b')][_0xdee6('0x87')]===_0xdee6('0x88')){return _0x22829f[_0xdee6('0x39')]({'read':!![]});}else{logger[_0xdee6('0x29')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xdee6('0x3b'),'twilio',util[_0xdee6('0x83')](_0x18af63[_0xdee6('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x22829f;}})['then'](respondWithResult(_0x3d00fa,null))[_0xdee6('0x2e')](handleError(_0x3d00fa,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 26cc006..a1b68d1 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 _0xd757=['setMaxListeners','remove','emit','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x266ec6,_0x44e3ca){var _0x5f1f59=function(_0x432cc5){while(--_0x432cc5){_0x266ec6['push'](_0x266ec6['shift']());}};_0x5f1f59(++_0x44e3ca);}(_0xd757,0x1e5));var _0x7d75=function(_0x209263,_0x4d5995){_0x209263=_0x209263-0x0;var _0x4d2880=_0xd757[_0x209263];return _0x4d2880;};'use strict';var EventEmitter=require(_0x7d75('0x0'));var WhatsappMessage=require(_0x7d75('0x1'))['db'][_0x7d75('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7d75('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7d75('0x4')};function emitEvent(_0x2772a3){return function(_0x5e4a4c,_0xa7df66,_0x10d11a){WhatsappMessageEvents[_0x7d75('0x5')](_0x2772a3+':'+_0x5e4a4c['id'],_0x5e4a4c);WhatsappMessageEvents['emit'](_0x2772a3,_0x5e4a4c);_0x10d11a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x7d75('0x6')](e,emitEvent(event));}}module[_0x7d75('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xb248=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','WhatsappMessage'];(function(_0x4c2144,_0xe4c0b7){var _0x42d4ba=function(_0x1278ff){while(--_0x1278ff){_0x4c2144['push'](_0x4c2144['shift']());}};_0x42d4ba(++_0xe4c0b7);}(_0xb248,0xc6));var _0x8b24=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb248[_0x3bf83f];return _0x22c4a9;};'use strict';var EventEmitter=require(_0x8b24('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x8b24('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x8b24('0x2')](0x0);var events={'afterCreate':_0x8b24('0x3'),'afterUpdate':_0x8b24('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1ea760){return function(_0x4438f7,_0x5d4103,_0x253441){WhatsappMessageEvents[_0x8b24('0x5')](_0x1ea760+':'+_0x4438f7['id'],_0x4438f7);WhatsappMessageEvents['emit'](_0x1ea760,_0x4438f7);_0x253441(null);};}for(var e in events){if(events[_0x8b24('0x6')](e)){var event=events[e];WhatsappMessage[_0x8b24('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 0ea8999..b591b98 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 _0x688a=['messages','create','body','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','update','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./whatsappMessage.attributes','exports','define','messageId','fti_whatsapp_messages','models','get','direction','toLowerCase','secret','isNil','WhatsappInteraction','WhatsappInteractionId','then','createdAt','error','out','WhatsappAccountId','type','twilio','phone','accountSid','authToken'];(function(_0x19ac0c,_0x4d794c){var _0xe90175=function(_0x4645b8){while(--_0x4645b8){_0x19ac0c['push'](_0x19ac0c['shift']());}};_0xe90175(++_0x4d794c);}(_0x688a,0x124));var _0xa688=function(_0x41c930,_0x99243a){_0x41c930=_0x41c930-0x0;var _0x383116=_0x688a[_0x41c930];return _0x383116;};'use strict';var _=require(_0xa688('0x0'));var util=require(_0xa688('0x1'));var logger=require(_0xa688('0x2'))('api');var moment=require(_0xa688('0x3'));var BPromise=require('bluebird');var rp=require(_0xa688('0x4'));var fs=require('fs');var path=require(_0xa688('0x5'));var rimraf=require('rimraf');var config=require(_0xa688('0x6'));var attributes=require(_0xa688('0x7'));module[_0xa688('0x8')]=function(_0x45b3ca,_0x211d2b){return _0x45b3ca[_0xa688('0x9')]('WhatsappMessage',attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xa688('0xa'),'fields':[_0xa688('0xa')]},{'name':_0xa688('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x42b94e,_0x5ce966,_0x4bf4ee){var _0x442638=_0x45b3ca[_0xa688('0xc')];var _0x2d66d9=_0x42b94e[_0xa688('0xd')]({'plain':!![]});if(_0x2d66d9[_0xa688('0xe')][_0xa688('0xf')]()==='in'||_0x2d66d9['direction']['toLowerCase']()==='out'&&!_0x2d66d9[_0xa688('0x10')]&&!_[_0xa688('0x11')](_0x2d66d9['UserId'])){_0x442638[_0xa688('0x12')]['findOne']({'where':{'id':_0x2d66d9[_0xa688('0x13')]}})[_0xa688('0x14')](function(_0x506fca){if(_0x506fca){_0x506fca['update']({'lastMsgAt':_0x2d66d9[_0xa688('0x15')],'lastMsgDirection':_0x2d66d9['direction'][_0xa688('0xf')]()});}})['catch'](function(_0xe776d6){console[_0xa688('0x16')](_0xe776d6);});}if(_0x2d66d9[_0xa688('0xe')]===_0xa688('0x17')&&!_0x2d66d9[_0xa688('0x10')]){var _0x10fc2d;_0x442638['WhatsappAccount']['find']({'where':{'id':_0x2d66d9[_0xa688('0x18')]},'raw':!![]})[_0xa688('0x14')](function(_0x5dc07f){_0x10fc2d=_0x5dc07f;if(_0x10fc2d&&_0x10fc2d['type']){switch(_0x10fc2d[_0xa688('0x19')]){case _0xa688('0x1a'):var _0x545c52=require(_0xa688('0x1a'));if(_0x10fc2d['accountSid']&&_0x10fc2d['authToken']&&_0x10fc2d[_0xa688('0x1b')]){var _0x466ae3=new _0x545c52(_0x10fc2d[_0xa688('0x1c')],_0x10fc2d[_0xa688('0x1d')]);_0x466ae3[_0xa688('0x1e')][_0xa688('0x1f')]({'body':_0x2d66d9[_0xa688('0x20')],'to':_0xa688('0x21')+_0x2d66d9[_0xa688('0x1b')],'from':_0xa688('0x21')+_0x10fc2d[_0xa688('0x1b')],'statusCallback':_0x10fc2d[_0xa688('0x22')]+_0xa688('0x23')+_0x2d66d9['id']+_0xa688('0x24')+_0x10fc2d['token']})[_0xa688('0x14')](function(_0x32a682){if(_0x32a682['sid']){return _0x42b94e[_0xa688('0x25')]({'messageId':_0x32a682[_0xa688('0x26')]});}})['catch'](function(_0x2898cb){logger[_0xa688('0x16')](_0xa688('0x27'),_0xa688('0x28'),_0xa688('0x1a'),util[_0xa688('0x29')](_0x2898cb,{'showHidden':![],'depth':null}));});}else{logger[_0xa688('0x16')](_0xa688('0x27'),_0xa688('0x28'),_0xa688('0x1a'),_0xa688('0x2a'));}break;}}})[_0xa688('0x2b')](function(){_0x4bf4ee();});}else{_0x4bf4ee();}}},'charset':_0xa688('0x2c'),'collate':_0xa688('0x2d')});}; \ No newline at end of file +var _0x944e=['request-promise','path','exports','define','WhatsappMessage','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','secret','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/api/whatsapp/messages/','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1f0c9e,_0x5e0ed0){var _0x5d41d7=function(_0x3d2d66){while(--_0x3d2d66){_0x1f0c9e['push'](_0x1f0c9e['shift']());}};_0x5d41d7(++_0x5e0ed0);}(_0x944e,0xba));var _0xe944=function(_0x3502c6,_0x52a513){_0x3502c6=_0x3502c6-0x0;var _0x3fa967=_0x944e[_0x3502c6];return _0x3fa967;};'use strict';var _=require(_0xe944('0x0'));var util=require(_0xe944('0x1'));var logger=require(_0xe944('0x2'))(_0xe944('0x3'));var moment=require(_0xe944('0x4'));var BPromise=require(_0xe944('0x5'));var rp=require(_0xe944('0x6'));var fs=require('fs');var path=require(_0xe944('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0xe944('0x8')]=function(_0xf96687,_0x4bceaf){return _0xf96687[_0xe944('0x9')](_0xe944('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xe944('0xb'),'fields':[_0xe944('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2cc658,_0x1b8497,_0x1e2fee){var _0x3f9226=_0xf96687[_0xe944('0xd')];var _0x20c896=_0x2cc658[_0xe944('0xe')]({'plain':!![]});if(_0x20c896[_0xe944('0xf')]['toLowerCase']()==='in'||_0x20c896[_0xe944('0xf')][_0xe944('0x10')]()===_0xe944('0x11')&&!_0x20c896[_0xe944('0x12')]&&!_['isNil'](_0x20c896[_0xe944('0x13')])){_0x3f9226[_0xe944('0x14')][_0xe944('0x15')]({'where':{'id':_0x20c896['WhatsappInteractionId']}})[_0xe944('0x16')](function(_0x297e71){if(_0x297e71){_0x297e71[_0xe944('0x17')]({'lastMsgAt':_0x20c896[_0xe944('0x18')],'lastMsgDirection':_0x20c896[_0xe944('0xf')][_0xe944('0x10')]()});}})[_0xe944('0x19')](function(_0x116e4c){console['error'](_0x116e4c);});}if(_0x20c896[_0xe944('0xf')]===_0xe944('0x11')&&!_0x20c896[_0xe944('0x12')]){var _0x4acef3;_0x3f9226[_0xe944('0x1a')][_0xe944('0x1b')]({'where':{'id':_0x20c896[_0xe944('0x1c')]},'raw':!![]})['then'](function(_0x2ffc57){_0x4acef3=_0x2ffc57;if(_0x4acef3&&_0x4acef3[_0xe944('0x1d')]){switch(_0x4acef3[_0xe944('0x1d')]){case _0xe944('0x1e'):var _0x2000ef=require(_0xe944('0x1e'));if(_0x4acef3['accountSid']&&_0x4acef3[_0xe944('0x1f')]&&_0x4acef3[_0xe944('0x20')]){var _0x564da9=new _0x2000ef(_0x4acef3[_0xe944('0x21')],_0x4acef3[_0xe944('0x1f')]);_0x564da9[_0xe944('0x22')][_0xe944('0x23')]({'body':_0x20c896[_0xe944('0xc')],'to':_0xe944('0x24')+_0x20c896[_0xe944('0x20')],'from':_0xe944('0x24')+_0x4acef3['phone'],'statusCallback':_0x4acef3[_0xe944('0x25')]+_0xe944('0x26')+_0x20c896['id']+'/status?token='+_0x4acef3[_0xe944('0x27')]})[_0xe944('0x16')](function(_0x1ab4b6){if(_0x1ab4b6[_0xe944('0x28')]){return _0x2cc658[_0xe944('0x17')]({'messageId':_0x1ab4b6['sid']});}})[_0xe944('0x19')](function(_0x20c2ae){logger[_0xe944('0x29')](_0xe944('0x2a'),_0xe944('0x2b'),_0xe944('0x1e'),util['inspect'](_0x20c2ae,{'showHidden':![],'depth':null}));});}else{logger[_0xe944('0x29')](_0xe944('0x2a'),_0xe944('0x2b'),'twilio',_0xe944('0x2c'));}break;}}})[_0xe944('0x2d')](function(){_0x1e2fee();});}else{_0x1e2fee();}}},'charset':_0xe944('0x2e'),'collate':_0xe944('0x2f')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 7d972be..f724af1 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 _0xbc59=['catch','CreateWhatsappMessage','create','body','options','raw','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1ae66a,_0x45d3b7){var _0x250417=function(_0x343a72){while(--_0x343a72){_0x1ae66a['push'](_0x1ae66a['shift']());}};_0x250417(++_0x45d3b7);}(_0xbc59,0x147));var _0x9bc5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbc59[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x9bc5('0x0'));var moment=require(_0x9bc5('0x1'));var BPromise=require('bluebird');var rs=require(_0x9bc5('0x2'));var fs=require('fs');var Redis=require(_0x9bc5('0x3'));var db=require(_0x9bc5('0x4'))['db'];var utils=require(_0x9bc5('0x5'));var logger=require(_0x9bc5('0x6'))(_0x9bc5('0x7'));var config=require('../../config/environment');var jayson=require(_0x9bc5('0x8'));var client=jayson[_0x9bc5('0x9')][_0x9bc5('0xa')]({'port':0x232a});config[_0x9bc5('0xb')]=_[_0x9bc5('0xc')](config[_0x9bc5('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9bc5('0xb')]));require(_0x9bc5('0xd'))[_0x9bc5('0xe')](socket);function respondWithRpcPromise(_0x1ef9d0,_0x396b81,_0xb760c4){return new BPromise(function(_0x5aef9b,_0x5d09ea){return client[_0x9bc5('0xf')](_0x1ef9d0,_0xb760c4)['then'](function(_0x48df7f){logger[_0x9bc5('0x10')](_0x9bc5('0x11'),_0x396b81,_0x9bc5('0x12'));logger[_0x9bc5('0x13')](_0x9bc5('0x14'),_0x396b81,_0x9bc5('0x12'),JSON['stringify'](_0x48df7f));if(_0x48df7f[_0x9bc5('0x15')]){if(_0x48df7f[_0x9bc5('0x15')][_0x9bc5('0x16')]===0x1f4){logger[_0x9bc5('0x15')](_0x9bc5('0x11'),_0x396b81,_0x48df7f[_0x9bc5('0x15')][_0x9bc5('0x17')]);return _0x5d09ea(_0x48df7f[_0x9bc5('0x15')][_0x9bc5('0x17')]);}logger[_0x9bc5('0x15')](_0x9bc5('0x11'),_0x396b81,_0x48df7f[_0x9bc5('0x15')]['message']);return _0x5aef9b(_0x48df7f['error']['message']);}else{logger['info'](_0x9bc5('0x11'),_0x396b81,_0x9bc5('0x12'));_0x5aef9b(_0x48df7f[_0x9bc5('0x18')]['message']);}})[_0x9bc5('0x19')](function(_0x260a83){logger['error'](_0x9bc5('0x11'),_0x396b81,_0x260a83);_0x5d09ea(_0x260a83);});});}exports[_0x9bc5('0x1a')]=function(_0x7ffa4f){var _0x490bb5=this;return new Promise(function(_0x546f4c,_0x31ce59){return db['WhatsappMessage'][_0x9bc5('0x1b')](_0x7ffa4f[_0x9bc5('0x1c')],{'raw':_0x7ffa4f[_0x9bc5('0x1d')]?_0x7ffa4f[_0x9bc5('0x1d')][_0x9bc5('0x1e')]===undefined?!![]:![]:!![]})[_0x9bc5('0x1f')](function(_0x1b057e){logger[_0x9bc5('0x10')](_0x9bc5('0x1a'),_0x7ffa4f);logger['debug'](_0x9bc5('0x1a'),_0x7ffa4f,JSON['stringify'](_0x1b057e));_0x546f4c(_0x1b057e);})[_0x9bc5('0x19')](function(_0x975da5){logger[_0x9bc5('0x15')](_0x9bc5('0x1a'),_0x975da5[_0x9bc5('0x17')],_0x7ffa4f);_0x31ce59(_0x490bb5['error'](0x1f4,_0x975da5['message']));});});}; \ No newline at end of file +var _0xaf59=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappMessage,\x20%s,\x20%s','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xaf59,0x15a));var _0x9af5=function(_0x5976f8,_0x1265b7){_0x5976f8=_0x5976f8-0x0;var _0x179715=_0xaf59[_0x5976f8];return _0x179715;};'use strict';var _=require(_0x9af5('0x0'));var util=require(_0x9af5('0x1'));var moment=require(_0x9af5('0x2'));var BPromise=require(_0x9af5('0x3'));var rs=require(_0x9af5('0x4'));var fs=require('fs');var Redis=require(_0x9af5('0x5'));var db=require(_0x9af5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9af5('0x7'))(_0x9af5('0x8'));var config=require('../../config/environment');var jayson=require(_0x9af5('0x9'));var client=jayson[_0x9af5('0xa')][_0x9af5('0xb')]({'port':0x232a});config[_0x9af5('0xc')]=_[_0x9af5('0xd')](config[_0x9af5('0xc')],{'host':_0x9af5('0xe'),'port':0x18eb});var socket=require(_0x9af5('0xf'))(new Redis(config[_0x9af5('0xc')]));require('./whatsappMessage.socket')[_0x9af5('0x10')](socket);function respondWithRpcPromise(_0x43d46e,_0x353556,_0x4c0851){return new BPromise(function(_0x2a603a,_0x58a20f){return client[_0x9af5('0x11')](_0x43d46e,_0x4c0851)['then'](function(_0x125017){logger[_0x9af5('0x12')]('WhatsappMessage,\x20%s,\x20%s',_0x353556,_0x9af5('0x13'));logger[_0x9af5('0x14')](_0x9af5('0x15'),_0x353556,'request\x20sent',JSON[_0x9af5('0x16')](_0x125017));if(_0x125017[_0x9af5('0x17')]){if(_0x125017[_0x9af5('0x17')]['code']===0x1f4){logger[_0x9af5('0x17')]('WhatsappMessage,\x20%s,\x20%s',_0x353556,_0x125017['error'][_0x9af5('0x18')]);return _0x58a20f(_0x125017[_0x9af5('0x17')][_0x9af5('0x18')]);}logger[_0x9af5('0x17')](_0x9af5('0x19'),_0x353556,_0x125017[_0x9af5('0x17')][_0x9af5('0x18')]);return _0x2a603a(_0x125017[_0x9af5('0x17')][_0x9af5('0x18')]);}else{logger[_0x9af5('0x12')](_0x9af5('0x19'),_0x353556,_0x9af5('0x13'));_0x2a603a(_0x125017[_0x9af5('0x1a')][_0x9af5('0x18')]);}})[_0x9af5('0x1b')](function(_0x4bbaa6){logger['error'](_0x9af5('0x19'),_0x353556,_0x4bbaa6);_0x58a20f(_0x4bbaa6);});});}exports[_0x9af5('0x1c')]=function(_0x27b031){var _0x5b3055=this;return new Promise(function(_0x1e79c7,_0x27d719){return db[_0x9af5('0x1d')][_0x9af5('0x1e')](_0x27b031['body'],{'raw':_0x27b031['options']?_0x27b031[_0x9af5('0x1f')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x158503){logger['info'](_0x9af5('0x1c'),_0x27b031);logger[_0x9af5('0x14')](_0x9af5('0x1c'),_0x27b031,JSON[_0x9af5('0x16')](_0x158503));_0x1e79c7(_0x158503);})[_0x9af5('0x1b')](function(_0x3b939b){logger[_0x9af5('0x17')](_0x9af5('0x1c'),_0x3b939b[_0x9af5('0x18')],_0x27b031);_0x27d719(_0x5b3055[_0x9af5('0x17')](0x1f4,_0x3b939b['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3c6d1a4..24b3bd3 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 _0x4131=['register','./whatsappMessage.events','save','remove','removeListener'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4131,0x74));var _0x1413=function(_0x5a5395,_0x5361f6){_0x5a5395=_0x5a5395-0x0;var _0x4da43d=_0x4131[_0x5a5395];return _0x4da43d;};'use strict';var WhatsappMessageEvents=require(_0x1413('0x0'));var events=[_0x1413('0x1'),_0x1413('0x2'),'update'];function createListener(_0x2acad4,_0x4c6b56){return function(_0x590cae){_0x4c6b56['emit'](_0x2acad4,_0x590cae);};}function removeListener(_0x194e33,_0x767f93){return function(){WhatsappMessageEvents[_0x1413('0x3')](_0x194e33,_0x767f93);};}exports[_0x1413('0x4')]=function(_0x1dcbc9){for(var _0x4eedf7=0x0,_0x39c7dd=events['length'];_0x4eedf7<_0x39c7dd;_0x4eedf7++){var _0x2ebc06=events[_0x4eedf7];var _0x370346=createListener('whatsappMessage:'+_0x2ebc06,_0x1dcbc9);WhatsappMessageEvents['on'](_0x2ebc06,_0x370346);}}; \ No newline at end of file +var _0xfe0b=['./whatsappMessage.events','save','remove','update','whatsappMessage:'];(function(_0x1bff67,_0x357008){var _0x9eb25e=function(_0x443089){while(--_0x443089){_0x1bff67['push'](_0x1bff67['shift']());}};_0x9eb25e(++_0x357008);}(_0xfe0b,0x136));var _0xbfe0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfe0b[_0x17d9e3];return _0x14192d;};'use strict';var WhatsappMessageEvents=require(_0xbfe0('0x0'));var events=[_0xbfe0('0x1'),_0xbfe0('0x2'),_0xbfe0('0x3')];function createListener(_0x4c959f,_0x9cb704){return function(_0x856275){_0x9cb704['emit'](_0x4c959f,_0x856275);};}function removeListener(_0x14433a,_0x33ddec){return function(){WhatsappMessageEvents['removeListener'](_0x14433a,_0x33ddec);};}exports['register']=function(_0x2a027d){for(var _0x3bc41f=0x0,_0x55dd5b=events['length'];_0x3bc41f<_0x55dd5b;_0x3bc41f++){var _0x3a92e4=events[_0x3bc41f];var _0x5d9280=createListener(_0xbfe0('0x4')+_0x3a92e4,_0x2a027d);WhatsappMessageEvents['on'](_0x3a92e4,_0x5d9280);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 568f4ad..0796e93 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 _0x3961=['addTeams','put','update','delete','removeTeams','removeAgents','util','path','express','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','/:id/users','post'];(function(_0x3b0a72,_0x3c3493){var _0x4056ec=function(_0x21c8fb){while(--_0x21c8fb){_0x3b0a72['push'](_0x3b0a72['shift']());}};_0x4056ec(++_0x3c3493);}(_0x3961,0x10e));var _0x1396=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0x3961[_0x318dda];return _0x3f97ca;};'use strict';var multer=require('multer');var util=require(_0x1396('0x0'));var path=require(_0x1396('0x1'));var timeout=require('connect-timeout');var express=require(_0x1396('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1396('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1396('0x4'));var controller=require(_0x1396('0x5'));router[_0x1396('0x6')]('/',auth[_0x1396('0x7')](),controller[_0x1396('0x8')]);router[_0x1396('0x6')]('/describe',auth[_0x1396('0x7')](),controller[_0x1396('0x9')]);router['get'](_0x1396('0xa'),auth[_0x1396('0x7')](),controller[_0x1396('0xb')]);router[_0x1396('0x6')](_0x1396('0xc'),auth['isAuthenticated'](),controller['getMembers']);router[_0x1396('0x6')](_0x1396('0xd'),auth[_0x1396('0x7')](),controller['getTeams']);router[_0x1396('0x6')](_0x1396('0xe'),auth[_0x1396('0x7')](),controller['getAgents']);router[_0x1396('0xf')]('/',auth[_0x1396('0x7')](),controller['create']);router[_0x1396('0xf')](_0x1396('0xd'),auth[_0x1396('0x7')](),controller[_0x1396('0x10')]);router[_0x1396('0xf')]('/:id/users',auth[_0x1396('0x7')](),controller['addAgents']);router[_0x1396('0x11')](_0x1396('0xa'),auth[_0x1396('0x7')](),controller[_0x1396('0x12')]);router[_0x1396('0x13')]('/:id',auth[_0x1396('0x7')](),controller['destroy']);router['delete'](_0x1396('0xd'),auth[_0x1396('0x7')](),controller[_0x1396('0x14')]);router[_0x1396('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0x1396('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9faf=['create','addAgents','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','show','/:id/members','getMembers','/:id/teams','/:id/users','post'];(function(_0x95c12a,_0x10612f){var _0x246c9b=function(_0x2c9983){while(--_0x2c9983){_0x95c12a['push'](_0x95c12a['shift']());}};_0x246c9b(++_0x10612f);}(_0x9faf,0x10d));var _0xf9fa=function(_0x590921,_0x5452f8){_0x590921=_0x590921-0x0;var _0x236b9c=_0x9faf[_0x590921];return _0x236b9c;};'use strict';var multer=require('multer');var util=require(_0xf9fa('0x0'));var path=require(_0xf9fa('0x1'));var timeout=require(_0xf9fa('0x2'));var express=require(_0xf9fa('0x3'));var router=express[_0xf9fa('0x4')]();var fs_extra=require(_0xf9fa('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf9fa('0x6'));var controller=require(_0xf9fa('0x7'));router[_0xf9fa('0x8')]('/',auth[_0xf9fa('0x9')](),controller[_0xf9fa('0xa')]);router[_0xf9fa('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xf9fa('0x9')](),controller[_0xf9fa('0xb')]);router[_0xf9fa('0x8')](_0xf9fa('0xc'),auth[_0xf9fa('0x9')](),controller[_0xf9fa('0xd')]);router[_0xf9fa('0x8')](_0xf9fa('0xe'),auth[_0xf9fa('0x9')](),controller['getTeams']);router[_0xf9fa('0x8')](_0xf9fa('0xf'),auth[_0xf9fa('0x9')](),controller['getAgents']);router[_0xf9fa('0x10')]('/',auth[_0xf9fa('0x9')](),controller[_0xf9fa('0x11')]);router['post']('/:id/teams',auth[_0xf9fa('0x9')](),controller['addTeams']);router[_0xf9fa('0x10')](_0xf9fa('0xf'),auth[_0xf9fa('0x9')](),controller[_0xf9fa('0x12')]);router[_0xf9fa('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf9fa('0x9')](),controller['destroy']);router[_0xf9fa('0x14')](_0xf9fa('0xe'),auth[_0xf9fa('0x9')](),controller['removeTeams']);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0xf9fa('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 61cebbe..d957e4d 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 _0x0a12=['ENUM','beepall','roundrobin','STRING','exports'];(function(_0x18b5fd,_0x5ea562){var _0x1adb88=function(_0x4c1349){while(--_0x4c1349){_0x18b5fd['push'](_0x18b5fd['shift']());}};_0x1adb88(++_0x5ea562);}(_0x0a12,0xb8));var _0x20a1=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x0a12[_0x4b2436];return _0x4f5ab2;};'use strict';var Sequelize=require('sequelize');module[_0x20a1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x20a1('0x1')]('rrmemory',_0x20a1('0x2'),_0x20a1('0x3'))},'description':{'type':Sequelize[_0x20a1('0x4')]}}; \ No newline at end of file +var _0x833b=['name','ENUM','beepall','roundrobin','STRING','exports'];(function(_0x245594,_0x3b9773){var _0x5c7073=function(_0x152ab3){while(--_0x152ab3){_0x245594['push'](_0x245594['shift']());}};_0x5c7073(++_0x3b9773);}(_0x833b,0x131));var _0xb833=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x833b[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0xb833('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb833('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb833('0x2')]('rrmemory',_0xb833('0x3'),_0xb833('0x4'))},'description':{'type':Sequelize[_0xb833('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 29cc0f0..b7aaa5f 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 _0x70e3=['removeAgents','userWhatsappQueue:remove','addAgents','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','end','status','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','sendStatus','error','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','nolimit','offset','order','sort','where','filters','pick','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','online','interface','flatMap','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','sequelize','transaction','isEmpty'];(function(_0x2717d7,_0x178f76){var _0x5ced44=function(_0x5d2de8){while(--_0x5d2de8){_0x2717d7['push'](_0x2717d7['shift']());}};_0x5ced44(++_0x178f76);}(_0x70e3,0x123));var _0x370e=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0x70e3[_0x4e4f0e];return _0x1a7219;};'use strict';var emlformat=require(_0x370e('0x0'));var rimraf=require(_0x370e('0x1'));var zipdir=require(_0x370e('0x2'));var jsonpatch=require(_0x370e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x370e('0x4'));var Mustache=require(_0x370e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x370e('0x6'));var csv=require(_0x370e('0x7'));var ejs=require(_0x370e('0x8'));var fs=require('fs');var fs_extra=require(_0x370e('0x9'));var _=require(_0x370e('0xa'));var squel=require('squel');var crypto=require(_0x370e('0xb'));var jsforce=require(_0x370e('0xc'));var deskjs=require(_0x370e('0xd'));var toCsv=require(_0x370e('0x7'));var querystring=require('querystring');var Papa=require(_0x370e('0xe'));var Redis=require(_0x370e('0xf'));var authService=require(_0x370e('0x10'));var qs=require(_0x370e('0x11'));var as=require(_0x370e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x370e('0x13'))(_0x370e('0x14'));var utils=require('../../config/utils');var config=require(_0x370e('0x15'));var licenseUtil=require(_0x370e('0x16'));var db=require(_0x370e('0x17'))['db'];config[_0x370e('0x18')]=_['defaults'](config['redis'],{'host':_0x370e('0x19'),'port':0x18eb});var socket=require(_0x370e('0x1a'))(new Redis(config[_0x370e('0x18')]));require(_0x370e('0x1b'))[_0x370e('0x1c')](socket);function respondWithStatusCode(_0x42ce39,_0x967abf){_0x967abf=_0x967abf||0xcc;return function(_0x9ab6cf){if(_0x9ab6cf){return _0x42ce39['sendStatus'](_0x967abf);}return _0x42ce39['status'](_0x967abf)[_0x370e('0x1d')]();};}function respondWithResult(_0x3c6ba7,_0x4d6f5a){_0x4d6f5a=_0x4d6f5a||0xc8;return function(_0xac9b4e){if(_0xac9b4e){return _0x3c6ba7[_0x370e('0x1e')](_0x4d6f5a)['json'](_0xac9b4e);}};}function respondWithFilteredResult(_0x51dd64,_0x599f2b){return function(_0x44bb11){if(_0x44bb11){var _0x2f2bf3=typeof _0x599f2b['offset']===_0x370e('0x1f')&&typeof _0x599f2b[_0x370e('0x20')]==='undefined';var _0x574c88=_0x44bb11[_0x370e('0x21')];var _0x143375=_0x2f2bf3?0x0:_0x599f2b['offset'];var _0xec4e00=_0x2f2bf3?_0x44bb11[_0x370e('0x21')]:_0x599f2b['offset']+_0x599f2b[_0x370e('0x20')];var _0x23820a;if(_0xec4e00>=_0x574c88){_0xec4e00=_0x574c88;_0x23820a=0xc8;}else{_0x23820a=0xce;}_0x51dd64[_0x370e('0x1e')](_0x23820a);return _0x51dd64[_0x370e('0x22')](_0x370e('0x23'),_0x143375+'-'+_0xec4e00+'/'+_0x574c88)['json'](_0x44bb11);}return null;};}function patchUpdates(_0x5c5107){return function(_0x25b62d){try{jsonpatch[_0x370e('0x24')](_0x25b62d,_0x5c5107,!![]);}catch(_0x2f0da5){return BPromise['reject'](_0x2f0da5);}return _0x25b62d[_0x370e('0x25')]();};}function saveUpdates(_0x3be576,_0x54db34){return function(_0x26ceea){if(_0x26ceea){return _0x26ceea[_0x370e('0x26')](_0x3be576)[_0x370e('0x27')](function(_0x1cf42b){return _0x1cf42b;});}return null;};}function removeEntity(_0x5c7d03,_0x482f72){return function(_0x2b29a6){if(_0x2b29a6){return _0x2b29a6[_0x370e('0x28')]()[_0x370e('0x27')](function(){var _0x54adb2=_0x2b29a6[_0x370e('0x29')]({'plain':!![]});var _0x436539=_0x370e('0x2a');return db['UserProfileResource'][_0x370e('0x28')]({'where':{'type':_0x436539,'resourceId':_0x54adb2['id']}})[_0x370e('0x27')](function(){return _0x2b29a6;});})[_0x370e('0x27')](function(){_0x5c7d03[_0x370e('0x1e')](0xcc)[_0x370e('0x1d')]();});}};}function handleEntityNotFound(_0x3f1979,_0x554600){return function(_0x515bb7){if(!_0x515bb7){_0x3f1979[_0x370e('0x2b')](0x194);}return _0x515bb7;};}function handleError(_0x342ebb,_0xc47eaa){_0xc47eaa=_0xc47eaa||0x1f4;return function(_0x3546cc){logger[_0x370e('0x2c')](_0x3546cc[_0x370e('0x2d')]);if(_0x3546cc[_0x370e('0x2e')]){delete _0x3546cc[_0x370e('0x2e')];}_0x342ebb[_0x370e('0x1e')](_0xc47eaa)[_0x370e('0x2f')](_0x3546cc);};}exports[_0x370e('0x30')]=function(_0x477fee,_0x1b1717){var _0xd6ce0f={},_0x5b464e={},_0x17ad87={'count':0x0,'rows':[]};var _0x196b1a=_['map'](db[_0x370e('0x31')][_0x370e('0x32')],function(_0x4db32a){return{'name':_0x4db32a[_0x370e('0x33')],'type':_0x4db32a['type'][_0x370e('0x34')]};});_0x5b464e[_0x370e('0x35')]=_[_0x370e('0x36')](_0x196b1a,'name');_0x5b464e['query']=_[_0x370e('0x37')](_0x477fee[_0x370e('0x38')]);_0x5b464e['filters']=_[_0x370e('0x39')](_0x5b464e[_0x370e('0x35')],_0x5b464e[_0x370e('0x38')]);_0xd6ce0f[_0x370e('0x3a')]=_[_0x370e('0x39')](_0x5b464e[_0x370e('0x35')],qs[_0x370e('0x3b')](_0x477fee[_0x370e('0x38')][_0x370e('0x3b')]));_0xd6ce0f[_0x370e('0x3a')]=_0xd6ce0f['attributes']['length']?_0xd6ce0f['attributes']:_0x5b464e[_0x370e('0x35')];if(!_0x477fee[_0x370e('0x38')]['hasOwnProperty'](_0x370e('0x3c'))){_0xd6ce0f[_0x370e('0x20')]=qs[_0x370e('0x20')](_0x477fee[_0x370e('0x38')]['limit']);_0xd6ce0f[_0x370e('0x3d')]=qs[_0x370e('0x3d')](_0x477fee[_0x370e('0x38')]['offset']);}_0xd6ce0f[_0x370e('0x3e')]=qs[_0x370e('0x3f')](_0x477fee['query'][_0x370e('0x3f')]);_0xd6ce0f[_0x370e('0x40')]=qs[_0x370e('0x41')](_[_0x370e('0x42')](_0x477fee[_0x370e('0x38')],_0x5b464e[_0x370e('0x41')]),_0x196b1a);if(_0x477fee['query']['filter']){_0xd6ce0f[_0x370e('0x40')]=_[_0x370e('0x43')](_0xd6ce0f[_0x370e('0x40')],{'$or':_[_0x370e('0x36')](_0x196b1a,function(_0x559200){if(_0x559200[_0x370e('0x44')]!=='VIRTUAL'){var _0x31fe05={};_0x31fe05[_0x559200['name']]={'$like':'%'+_0x477fee[_0x370e('0x38')][_0x370e('0x45')]+'%'};return _0x31fe05;}})});}_0xd6ce0f=_[_0x370e('0x43')]({},_0xd6ce0f,_0x477fee[_0x370e('0x46')]);var _0x2cddbc={'where':_0xd6ce0f[_0x370e('0x40')]};return db[_0x370e('0x31')][_0x370e('0x21')](_0x2cddbc)['then'](function(_0x2d10a6){_0x17ad87[_0x370e('0x21')]=_0x2d10a6;if(_0x477fee[_0x370e('0x38')][_0x370e('0x47')]){_0xd6ce0f[_0x370e('0x48')]=[{'all':!![]}];}return db['WhatsappQueue'][_0x370e('0x49')](_0xd6ce0f);})['then'](function(_0x179c80){_0x17ad87[_0x370e('0x4a')]=_0x179c80;return _0x17ad87;})[_0x370e('0x27')](respondWithFilteredResult(_0x1b1717,_0xd6ce0f))[_0x370e('0x4b')](handleError(_0x1b1717,null));};exports[_0x370e('0x4c')]=function(_0x5e1053,_0xa731a2){var _0x146105={'raw':!![],'where':{'id':_0x5e1053[_0x370e('0x4d')]['id']}},_0x4dfae6={};_0x4dfae6[_0x370e('0x35')]=_[_0x370e('0x37')](db[_0x370e('0x31')][_0x370e('0x32')]);_0x4dfae6[_0x370e('0x38')]=_['keys'](_0x5e1053[_0x370e('0x38')]);_0x4dfae6['filters']=_[_0x370e('0x39')](_0x4dfae6['model'],_0x4dfae6[_0x370e('0x38')]);_0x146105[_0x370e('0x3a')]=_['intersection'](_0x4dfae6[_0x370e('0x35')],qs['fields'](_0x5e1053['query'][_0x370e('0x3b')]));_0x146105[_0x370e('0x3a')]=_0x146105['attributes'][_0x370e('0x4e')]?_0x146105['attributes']:_0x4dfae6[_0x370e('0x35')];if(_0x5e1053[_0x370e('0x38')][_0x370e('0x47')]){_0x146105[_0x370e('0x48')]=[{'all':!![]}];}_0x146105=_[_0x370e('0x43')]({},_0x146105,_0x5e1053[_0x370e('0x46')]);return db[_0x370e('0x31')]['find'](_0x146105)[_0x370e('0x27')](handleEntityNotFound(_0xa731a2,null))['then'](respondWithResult(_0xa731a2,null))[_0x370e('0x4b')](handleError(_0xa731a2,null));};exports[_0x370e('0x4f')]=function(_0x16407c,_0x401f23){return db['WhatsappQueue'][_0x370e('0x4f')](_0x16407c[_0x370e('0x50')],{})[_0x370e('0x27')](function(_0x320874){var _0x4c6e8f=_0x16407c['user'][_0x370e('0x29')]({'plain':!![]});if(!_0x4c6e8f)throw new Error(_0x370e('0x51'));if(_0x4c6e8f['role']===_0x370e('0x52')){var _0x40e909=_0x320874[_0x370e('0x29')]({'plain':!![]});var _0x5c192d=_0x370e('0x2a');return db[_0x370e('0x53')][_0x370e('0x54')]({'where':{'name':_0x5c192d,'userProfileId':_0x4c6e8f[_0x370e('0x55')]},'raw':!![]})[_0x370e('0x27')](function(_0x2ca5c8){if(_0x2ca5c8&&_0x2ca5c8[_0x370e('0x56')]===0x0){return db[_0x370e('0x57')]['create']({'name':_0x40e909[_0x370e('0x2e')],'resourceId':_0x40e909['id'],'type':_0x2ca5c8[_0x370e('0x2e')],'sectionId':_0x2ca5c8['id']},{})['then'](function(){return _0x320874;});}else{return _0x320874;}})['catch'](function(_0x3602e7){logger[_0x370e('0x2c')](_0x370e('0x58'),_0x3602e7);throw _0x3602e7;});}return _0x320874;})[_0x370e('0x27')](respondWithResult(_0x401f23,0xc9))[_0x370e('0x4b')](handleError(_0x401f23,null));};exports[_0x370e('0x26')]=function(_0x1e5282,_0xb99023){if(_0x1e5282[_0x370e('0x50')]['id']){delete _0x1e5282['body']['id'];}return db['WhatsappQueue'][_0x370e('0x54')]({'where':{'id':_0x1e5282[_0x370e('0x4d')]['id']}})[_0x370e('0x27')](handleEntityNotFound(_0xb99023,null))[_0x370e('0x27')](saveUpdates(_0x1e5282[_0x370e('0x50')],null))[_0x370e('0x27')](respondWithResult(_0xb99023,null))['catch'](handleError(_0xb99023,null));};exports[_0x370e('0x28')]=function(_0x3833b5,_0x2cdf07){return db[_0x370e('0x31')]['find']({'where':{'id':_0x3833b5[_0x370e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2cdf07,null))[_0x370e('0x27')](removeEntity(_0x2cdf07,null))[_0x370e('0x4b')](handleError(_0x2cdf07,null));};exports[_0x370e('0x59')]=function(_0x9ac499,_0x21494f){return db[_0x370e('0x31')]['describe']()[_0x370e('0x27')](respondWithResult(_0x21494f,null))[_0x370e('0x4b')](handleError(_0x21494f,null));};exports[_0x370e('0x5a')]=function(_0xdfff98,_0x4af82b,_0x1bcdce){var _0x36108e={'raw':!![],'where':{}},_0x7f9df9={},_0x5e82c3;return db[_0x370e('0x31')][_0x370e('0x5b')]({'where':{'id':_0xdfff98[_0x370e('0x4d')]['id']}})[_0x370e('0x27')](handleEntityNotFound(_0x4af82b,null))[_0x370e('0x27')](function(_0x506fef){if(_0x506fef){_0x5e82c3=_0x506fef['get']({'plain':!![]});_0x7f9df9[_0x370e('0x35')]=_[_0x370e('0x37')](db['UserWhatsappQueue'][_0x370e('0x32')]);_0x7f9df9[_0x370e('0x38')]=_['keys'](_0xdfff98[_0x370e('0x38')]);_0x7f9df9[_0x370e('0x41')]=_[_0x370e('0x39')](_0x7f9df9[_0x370e('0x35')],_0x7f9df9[_0x370e('0x38')]);_0x36108e[_0x370e('0x3a')]=_[_0x370e('0x39')](_0x7f9df9[_0x370e('0x35')],qs['fields'](_0xdfff98['query'][_0x370e('0x3b')]));_0x36108e[_0x370e('0x3a')]=_0x36108e['attributes'][_0x370e('0x4e')]?_0x36108e['attributes']:_0x7f9df9[_0x370e('0x35')];if(!_0xdfff98[_0x370e('0x38')][_0x370e('0x5c')](_0x370e('0x3c'))){_0x36108e[_0x370e('0x20')]=qs[_0x370e('0x20')](_0xdfff98['query'][_0x370e('0x20')]);_0x36108e['offset']=qs[_0x370e('0x3d')](_0xdfff98[_0x370e('0x38')][_0x370e('0x3d')]);}_0x36108e['order']=qs[_0x370e('0x3f')](_0xdfff98[_0x370e('0x38')][_0x370e('0x3f')]);_0x36108e[_0x370e('0x40')]=qs['filters'](_[_0x370e('0x42')](_0xdfff98[_0x370e('0x38')],_0x7f9df9['filters']));_0x36108e['where'][_0x370e('0x5d')]=_0x506fef['id'];if(_0xdfff98[_0x370e('0x38')]['filter']){_0x36108e['where']=_[_0x370e('0x43')](_0x36108e['where'],{'$or':_[_0x370e('0x36')](_0x36108e['attributes'],function(_0xbabfa5){var _0xdf8d7d={};_0xdf8d7d[_0xbabfa5]={'$like':'%'+_0xdfff98[_0x370e('0x38')]['filter']+'%'};return _0xdf8d7d;})});}_0x36108e=_[_0x370e('0x43')]({},_0x36108e,_0xdfff98[_0x370e('0x46')]);return db[_0x370e('0x5e')]['findAll'](_0x36108e);}})[_0x370e('0x27')](function(_0x1b34ce){if(_0x1b34ce){return db[_0x370e('0x5f')][_0x370e('0x60')]({'where':{'id':_[_0x370e('0x36')](_0x1b34ce,_0x370e('0x61')),'role':_0x370e('0x62')},'attributes':['id',_0x370e('0x2e'),_0x370e('0x63'),_0x370e('0x64'),_0x370e('0x65')]});}})['then'](function(_0x3c4fa2){if(_0x3c4fa2){return{'count':_0x3c4fa2[_0x370e('0x21')],'rows':_['map'](_0x3c4fa2[_0x370e('0x4a')],function(_0x3e4435){return{'membername':_0x3e4435['name'],'UserId':_0x3e4435['id'],'queue_name':_0x5e82c3[_0x370e('0x2e')],'WhatsappQueueId':_0x5e82c3['id'],'interface':util[_0x370e('0x66')](_0x370e('0x67'),_0x370e('0x68'),_0x3e4435[_0x370e('0x2e')]),'penalty':0x0,'paused':_0x3e4435['whatsappPause'],'createdAt':_0x3e4435['createdAt'],'updatedAt':_0x3e4435[_0x370e('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4af82b,_0x36108e))['catch'](handleError(_0x4af82b,null));};exports['getTeams']=function(_0x306eb0,_0x295e5e,_0x492a38){var _0x4dfecb={};var _0x3d668f={};var _0x28eb56;var _0x449a6e;return db['WhatsappQueue'][_0x370e('0x5b')]({'where':{'id':_0x306eb0['params']['id']}})['then'](handleEntityNotFound(_0x295e5e,null))[_0x370e('0x27')](function(_0x147629){if(_0x147629){_0x28eb56=_0x147629;_0x3d668f['model']=_[_0x370e('0x37')](db[_0x370e('0x69')][_0x370e('0x32')]);_0x3d668f[_0x370e('0x38')]=_['keys'](_0x306eb0['query']);_0x3d668f[_0x370e('0x41')]=_['intersection'](_0x3d668f[_0x370e('0x35')],_0x3d668f[_0x370e('0x38')]);_0x4dfecb[_0x370e('0x3a')]=_[_0x370e('0x39')](_0x3d668f[_0x370e('0x35')],qs[_0x370e('0x3b')](_0x306eb0['query']['fields']));_0x4dfecb[_0x370e('0x3a')]=_0x4dfecb[_0x370e('0x3a')]['length']?_0x4dfecb[_0x370e('0x3a')]:_0x3d668f[_0x370e('0x35')];_0x4dfecb[_0x370e('0x3e')]=qs['sort'](_0x306eb0[_0x370e('0x38')]['sort']);_0x4dfecb['where']=qs['filters'](_['pick'](_0x306eb0['query'],_0x3d668f['filters']));if(_0x306eb0[_0x370e('0x38')]['filter']){_0x4dfecb['where']=_['merge'](_0x4dfecb['where'],{'$or':_[_0x370e('0x36')](_0x4dfecb['attributes'],function(_0x124bd7){var _0x415bf0={};_0x415bf0[_0x124bd7]={'$like':'%'+_0x306eb0[_0x370e('0x38')][_0x370e('0x45')]+'%'};return _0x415bf0;})});}_0x4dfecb=_['merge']({},_0x4dfecb,_0x306eb0['options']);return _0x28eb56['getTeams'](_0x4dfecb);}})['then'](function(_0x102ef6){if(_0x102ef6){_0x449a6e=_0x102ef6[_0x370e('0x4e')];if(!_0x306eb0[_0x370e('0x38')][_0x370e('0x5c')](_0x370e('0x3c'))){_0x4dfecb[_0x370e('0x20')]=qs[_0x370e('0x20')](_0x306eb0[_0x370e('0x38')][_0x370e('0x20')]);_0x4dfecb[_0x370e('0x3d')]=qs[_0x370e('0x3d')](_0x306eb0['query'][_0x370e('0x3d')]);}return _0x28eb56[_0x370e('0x6a')](_0x4dfecb);}})[_0x370e('0x27')](function(_0x3bdbce){if(_0x3bdbce){return _0x3bdbce?{'count':_0x449a6e,'rows':_0x3bdbce}:null;}})[_0x370e('0x27')](respondWithResult(_0x295e5e,null))[_0x370e('0x4b')](handleError(_0x295e5e,null));};exports[_0x370e('0x6b')]=function(_0x44f28e,_0x19147c,_0x55ca3b){var _0x5c1efc=_0x44f28e[_0x370e('0x50')][_0x370e('0x6c')];return db[_0x370e('0x69')][_0x370e('0x49')]({'where':{'id':_0x5c1efc},'attributes':['id'],'include':[{'model':db['User'],'as':_0x370e('0x6d'),'attributes':['id',_0x370e('0x2e'),_0x370e('0x6e'),'voicePause',_0x370e('0x6f')],'raw':!![]}]})[_0x370e('0x27')](function(_0x9e0ced){if(_0x9e0ced){var _0x4d8225=_[_0x370e('0x70')](_0x9e0ced,function(_0x35cb91){var _0x1e15e7=_0x35cb91[_0x370e('0x29')]({'plain':!![]});return _0x1e15e7[_0x370e('0x6d')];});return db[_0x370e('0x31')][_0x370e('0x54')]({'where':{'id':_0x44f28e[_0x370e('0x4d')]['id']}})[_0x370e('0x27')](function(_0xd719fe){return db['sequelize']['transaction'](function(_0x5a167a){return _0xd719fe['addTeams'](_0x5c1efc,{'transaction':_0x5a167a})[_0x370e('0x27')](function(){return BPromise[_0x370e('0x71')](_0x4d8225,function(_0x4ea5e4){return db['UserWhatsappQueue'][_0x370e('0x72')]({'where':{'UserId':_0x4ea5e4['id'],'WhatsappQueueId':_0x44f28e[_0x370e('0x4d')]['id']},'transaction':_0x5a167a});});})[_0x370e('0x27')](function(){_0x4d8225[_0x370e('0x73')](function(_0x3024c6){socket[_0x370e('0x74')](_0x370e('0x75'),{'UserId':_0x3024c6['id'],'WhatsappQueueId':_0xd719fe['id']});});});});});}})[_0x370e('0x27')](respondWithStatusCode(_0x19147c,null))[_0x370e('0x4b')](handleError(_0x19147c,null));};exports[_0x370e('0x76')]=function(_0x522856,_0x4732e9,_0x4af9f5){return db['Team'][_0x370e('0x49')]({'where':{'id':_0x522856['query'][_0x370e('0x6c')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x370e('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x370e('0x27')](handleEntityNotFound(_0x4732e9,null))[_0x370e('0x27')](function(_0x4d9ac1){var _0x291ab4=_[_0x370e('0x36')](_0x4d9ac1,'id');var _0x5a3b26=[];var _0x412cd6=[];var _0x45dff8=squel['select']();_0x45dff8[_0x370e('0x77')]('tq.TeamId')[_0x370e('0x78')]('team_has_whatsapp_queues','tq')[_0x370e('0x79')](_0x370e('0x7a'),'ut',_0x370e('0x7b'))[_0x370e('0x40')](_0x370e('0x7c'),_0x522856['params']['id']);for(var _0x5afe89=0x0;_0x5afe89<_0x4d9ac1[_0x370e('0x4e')];_0x5afe89+=0x1){let _0x212e01=_0x4d9ac1[_0x5afe89];for(var _0x11de29=0x0;_0x11de29<_0x212e01[_0x370e('0x6d')][_0x370e('0x4e')];_0x11de29+=0x1){let _0x237ec4=_0x212e01[_0x370e('0x6d')][_0x11de29];var _0x1e3676=_0x45dff8[_0x370e('0x7d')]();_0x1e3676[_0x370e('0x40')](_0x370e('0x7e'),_0x237ec4['id']);_0x412cd6['push'](db['sequelize'][_0x370e('0x38')](_0x1e3676['toString'](),{'type':db['sequelize'][_0x370e('0x7f')][_0x370e('0x80')]})[_0x370e('0x27')](function(_0x2b44ca){if(_0x2b44ca[_0x370e('0x4e')]===0x1){return _0x237ec4['id'];}else{var _0x1f5563=_[_0x370e('0x81')](_[_0x370e('0x36')](_0x2b44ca,_0x370e('0x82')),function(_0x5e945e){return _[_0x370e('0x83')](_0x291ab4,_0x5e945e);});if(_0x1f5563){return _0x237ec4['id'];}}}));}}return BPromise[_0x370e('0x84')](_0x412cd6)[_0x370e('0x27')](function(_0x390348){_0x5a3b26=_(_0x5a3b26)['union'](_0x390348)[_0x370e('0x85')]()[_0x370e('0x86')]();return db[_0x370e('0x31')]['find']({'where':{'id':_0x522856['params']['id']}})[_0x370e('0x27')](function(_0x431634){return db[_0x370e('0x87')][_0x370e('0x88')](function(_0x550b6){return _0x431634['removeTeams'](_0x522856[_0x370e('0x38')]['ids'],{'transaction':_0x550b6})[_0x370e('0x27')](function(){if(!_[_0x370e('0x89')](_0x5a3b26)){return _0x431634[_0x370e('0x8a')](_0x5a3b26,{'transaction':_0x550b6});}})[_0x370e('0x27')](function(){_0x5a3b26['forEach'](function(_0x544b6e){socket['emit'](_0x370e('0x8b'),{'UserId':_0x544b6e,'WhatsappQueueId':_0x431634['id']});});});});});});})['then'](respondWithStatusCode(_0x4732e9,null))[_0x370e('0x4b')](handleError(_0x4732e9,null));};exports[_0x370e('0x8c')]=function(_0x2160cd,_0x37bba1,_0x12b2f2){return db[_0x370e('0x31')][_0x370e('0x54')]({'where':{'id':_0x2160cd['params']['id']}})[_0x370e('0x27')](handleEntityNotFound(_0x37bba1,null))[_0x370e('0x27')](function(_0x4c9db1){if(_0x4c9db1){return _0x4c9db1[_0x370e('0x8c')](_0x2160cd[_0x370e('0x50')]['ids'],_['omit'](_0x2160cd[_0x370e('0x50')],[_0x370e('0x6c'),'id'])||{})[_0x370e('0x8d')](function(_0x449d90){for(var _0x3cca8c=0x0;_0x3cca8c<_0x2160cd[_0x370e('0x50')]['ids'][_0x370e('0x4e')];_0x3cca8c+=0x1){socket[_0x370e('0x74')](_0x370e('0x75'),{'UserId':Number(_0x2160cd[_0x370e('0x50')]['ids'][_0x3cca8c]),'WhatsappQueueId':Number(_0x2160cd[_0x370e('0x4d')]['id'])});}return _0x449d90;});}})[_0x370e('0x27')](respondWithResult(_0x37bba1,null))['catch'](handleError(_0x37bba1,null));};exports[_0x370e('0x8a')]=function(_0x4d8ae9,_0x524b89,_0x5d1f96){return db[_0x370e('0x31')][_0x370e('0x54')]({'where':{'id':_0x4d8ae9[_0x370e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x524b89,null))[_0x370e('0x27')](function(_0x1d866d){if(_0x1d866d){return _0x1d866d[_0x370e('0x8a')](_0x4d8ae9[_0x370e('0x38')][_0x370e('0x6c')])['then'](function(){if(_['isArray'](_0x4d8ae9[_0x370e('0x38')][_0x370e('0x6c')])){for(var _0x4092ae=0x0;_0x4092ae<_0x4d8ae9[_0x370e('0x38')][_0x370e('0x6c')]['length'];_0x4092ae+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x4d8ae9[_0x370e('0x38')][_0x370e('0x6c')][_0x4092ae]),'WhatsappQueueId':Number(_0x4d8ae9[_0x370e('0x4d')]['id'])});}}else{socket[_0x370e('0x74')](_0x370e('0x8b'),{'UserId':Number(_0x4d8ae9[_0x370e('0x38')]['ids']),'WhatsappQueueId':Number(_0x4d8ae9['params']['id'])});}});}})[_0x370e('0x27')](respondWithStatusCode(_0x524b89,null))[_0x370e('0x4b')](handleError(_0x524b89,null));};exports[_0x370e('0x8e')]=function(_0x51c0bf,_0x3da3e5,_0x46b8f5){var _0x3d7414={};var _0x21d0a2={};var _0x4f57cd;var _0x1e8a05;return db[_0x370e('0x31')][_0x370e('0x5b')]({'where':{'id':_0x51c0bf['params']['id']}})['then'](handleEntityNotFound(_0x3da3e5,null))['then'](function(_0x44624f){if(_0x44624f){_0x4f57cd=_0x44624f;_0x21d0a2[_0x370e('0x35')]=_['keys'](db[_0x370e('0x5f')]['rawAttributes']);_0x21d0a2[_0x370e('0x38')]=_['keys'](_0x51c0bf[_0x370e('0x38')]);_0x21d0a2[_0x370e('0x41')]=_[_0x370e('0x39')](_0x21d0a2[_0x370e('0x35')],_0x21d0a2[_0x370e('0x38')]);_0x3d7414[_0x370e('0x3a')]=_[_0x370e('0x39')](_0x21d0a2[_0x370e('0x35')],qs['fields'](_0x51c0bf[_0x370e('0x38')]['fields']));_0x3d7414[_0x370e('0x3a')]=_0x3d7414[_0x370e('0x3a')]['length']?_0x3d7414[_0x370e('0x3a')]:_0x21d0a2['model'];_0x3d7414[_0x370e('0x3e')]=qs[_0x370e('0x3f')](_0x51c0bf[_0x370e('0x38')][_0x370e('0x3f')]);_0x3d7414[_0x370e('0x40')]=qs[_0x370e('0x41')](_[_0x370e('0x42')](_0x51c0bf[_0x370e('0x38')],_0x21d0a2[_0x370e('0x41')]));if(_0x51c0bf[_0x370e('0x38')][_0x370e('0x45')]){_0x3d7414['where']=_['merge'](_0x3d7414[_0x370e('0x40')],{'$or':_[_0x370e('0x36')](_0x3d7414[_0x370e('0x3a')],function(_0x4d1867){var _0x6bbe17={};_0x6bbe17[_0x4d1867]={'$like':'%'+_0x51c0bf['query'][_0x370e('0x45')]+'%'};return _0x6bbe17;})});}_0x3d7414=_[_0x370e('0x43')]({},_0x3d7414,_0x51c0bf[_0x370e('0x46')]);return _0x4f57cd[_0x370e('0x8e')](_0x3d7414);}})[_0x370e('0x27')](function(_0x2e4895){if(_0x2e4895){_0x1e8a05=_0x2e4895[_0x370e('0x4e')];if(!_0x51c0bf[_0x370e('0x38')][_0x370e('0x5c')](_0x370e('0x3c'))){_0x3d7414['limit']=qs[_0x370e('0x20')](_0x51c0bf[_0x370e('0x38')][_0x370e('0x20')]);_0x3d7414['offset']=qs['offset'](_0x51c0bf[_0x370e('0x38')][_0x370e('0x3d')]);}return _0x4f57cd[_0x370e('0x8e')](_0x3d7414);}})[_0x370e('0x27')](function(_0x3d4409){if(_0x3d4409){return _0x3d4409?{'count':_0x1e8a05,'rows':_0x3d4409}:null;}})[_0x370e('0x27')](respondWithResult(_0x3da3e5,null))['catch'](handleError(_0x3da3e5,null));}; \ No newline at end of file +var _0x9d5f=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappQueue','includeAll','findAll','rows','params','length','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','catch','describe','getMembers','UserWhatsappQueue','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','ids','select','from','team_has_whatsapp_queues','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','push','toString','SELECT','every','all','union','compact','value','isEmpty','forEach','userWhatsappQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x245d61,_0xba5581){var _0x400372=function(_0x462739){while(--_0x462739){_0x245d61['push'](_0x245d61['shift']());}};_0x400372(++_0xba5581);}(_0x9d5f,0x7c));var _0xf9d5=function(_0x5e40be,_0x512411){_0x5e40be=_0x5e40be-0x0;var _0xbcdeb1=_0x9d5f[_0x5e40be];return _0xbcdeb1;};'use strict';var emlformat=require(_0xf9d5('0x0'));var rimraf=require(_0xf9d5('0x1'));var zipdir=require(_0xf9d5('0x2'));var jsonpatch=require(_0xf9d5('0x3'));var rp=require(_0xf9d5('0x4'));var moment=require('moment');var BPromise=require(_0xf9d5('0x5'));var Mustache=require('mustache');var util=require(_0xf9d5('0x6'));var path=require(_0xf9d5('0x7'));var sox=require('sox');var csv=require(_0xf9d5('0x8'));var ejs=require(_0xf9d5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf9d5('0xa'));var squel=require(_0xf9d5('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf9d5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xf9d5('0xd'));var Papa=require(_0xf9d5('0xe'));var Redis=require(_0xf9d5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf9d5('0x10'));var as=require(_0xf9d5('0x11'));var hardwareService=require(_0xf9d5('0x12'));var logger=require(_0xf9d5('0x13'))(_0xf9d5('0x14'));var utils=require(_0xf9d5('0x15'));var config=require(_0xf9d5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9d5('0x17'))['db'];config[_0xf9d5('0x18')]=_[_0xf9d5('0x19')](config[_0xf9d5('0x18')],{'host':_0xf9d5('0x1a'),'port':0x18eb});var socket=require(_0xf9d5('0x1b'))(new Redis(config[_0xf9d5('0x18')]));require(_0xf9d5('0x1c'))[_0xf9d5('0x1d')](socket);function respondWithStatusCode(_0x53d88a,_0x5794e0){_0x5794e0=_0x5794e0||0xcc;return function(_0x524c07){if(_0x524c07){return _0x53d88a['sendStatus'](_0x5794e0);}return _0x53d88a[_0xf9d5('0x1e')](_0x5794e0)['end']();};}function respondWithResult(_0x13c25f,_0x5956b1){_0x5956b1=_0x5956b1||0xc8;return function(_0x125bb0){if(_0x125bb0){return _0x13c25f[_0xf9d5('0x1e')](_0x5956b1)[_0xf9d5('0x1f')](_0x125bb0);}};}function respondWithFilteredResult(_0x3f840b,_0x28dea1){return function(_0x2256df){if(_0x2256df){var _0x336b22=typeof _0x28dea1[_0xf9d5('0x20')]===_0xf9d5('0x21')&&typeof _0x28dea1[_0xf9d5('0x22')]===_0xf9d5('0x21');var _0xe25618=_0x2256df[_0xf9d5('0x23')];var _0x3f724c=_0x336b22?0x0:_0x28dea1['offset'];var _0x1652b6=_0x336b22?_0x2256df[_0xf9d5('0x23')]:_0x28dea1[_0xf9d5('0x20')]+_0x28dea1[_0xf9d5('0x22')];var _0x24f73a;if(_0x1652b6>=_0xe25618){_0x1652b6=_0xe25618;_0x24f73a=0xc8;}else{_0x24f73a=0xce;}_0x3f840b['status'](_0x24f73a);return _0x3f840b[_0xf9d5('0x24')](_0xf9d5('0x25'),_0x3f724c+'-'+_0x1652b6+'/'+_0xe25618)['json'](_0x2256df);}return null;};}function patchUpdates(_0x807e57){return function(_0x46ff60){try{jsonpatch[_0xf9d5('0x26')](_0x46ff60,_0x807e57,!![]);}catch(_0xfe3db5){return BPromise[_0xf9d5('0x27')](_0xfe3db5);}return _0x46ff60[_0xf9d5('0x28')]();};}function saveUpdates(_0x129932,_0x90e68c){return function(_0x3a135f){if(_0x3a135f){return _0x3a135f[_0xf9d5('0x29')](_0x129932)[_0xf9d5('0x2a')](function(_0x21f836){return _0x21f836;});}return null;};}function removeEntity(_0x40c34e,_0x399fc8){return function(_0xdcc44e){if(_0xdcc44e){return _0xdcc44e[_0xf9d5('0x2b')]()[_0xf9d5('0x2a')](function(){var _0x13dc31=_0xdcc44e[_0xf9d5('0x2c')]({'plain':!![]});var _0x4d0fea=_0xf9d5('0x2d');return db[_0xf9d5('0x2e')][_0xf9d5('0x2b')]({'where':{'type':_0x4d0fea,'resourceId':_0x13dc31['id']}})[_0xf9d5('0x2a')](function(){return _0xdcc44e;});})[_0xf9d5('0x2a')](function(){_0x40c34e[_0xf9d5('0x1e')](0xcc)[_0xf9d5('0x2f')]();});}};}function handleEntityNotFound(_0x2db3eb,_0x37ff65){return function(_0x219b00){if(!_0x219b00){_0x2db3eb['sendStatus'](0x194);}return _0x219b00;};}function handleError(_0x37b51e,_0x45b861){_0x45b861=_0x45b861||0x1f4;return function(_0x2cab45){logger[_0xf9d5('0x30')](_0x2cab45[_0xf9d5('0x31')]);if(_0x2cab45['name']){delete _0x2cab45[_0xf9d5('0x32')];}_0x37b51e[_0xf9d5('0x1e')](_0x45b861)[_0xf9d5('0x33')](_0x2cab45);};}exports[_0xf9d5('0x34')]=function(_0x10bf36,_0x369995){var _0x5006c9={},_0x5f1ae9={},_0x41acb5={'count':0x0,'rows':[]};var _0xf13c3=_[_0xf9d5('0x35')](db['WhatsappQueue'][_0xf9d5('0x36')],function(_0x3e0f6d){return{'name':_0x3e0f6d[_0xf9d5('0x37')],'type':_0x3e0f6d[_0xf9d5('0x38')][_0xf9d5('0x39')]};});_0x5f1ae9[_0xf9d5('0x3a')]=_[_0xf9d5('0x35')](_0xf13c3,_0xf9d5('0x32'));_0x5f1ae9['query']=_[_0xf9d5('0x3b')](_0x10bf36[_0xf9d5('0x3c')]);_0x5f1ae9[_0xf9d5('0x3d')]=_[_0xf9d5('0x3e')](_0x5f1ae9[_0xf9d5('0x3a')],_0x5f1ae9['query']);_0x5006c9[_0xf9d5('0x3f')]=_[_0xf9d5('0x3e')](_0x5f1ae9['model'],qs[_0xf9d5('0x40')](_0x10bf36[_0xf9d5('0x3c')]['fields']));_0x5006c9[_0xf9d5('0x3f')]=_0x5006c9['attributes']['length']?_0x5006c9[_0xf9d5('0x3f')]:_0x5f1ae9[_0xf9d5('0x3a')];if(!_0x10bf36[_0xf9d5('0x3c')][_0xf9d5('0x41')](_0xf9d5('0x42'))){_0x5006c9['limit']=qs[_0xf9d5('0x22')](_0x10bf36[_0xf9d5('0x3c')][_0xf9d5('0x22')]);_0x5006c9[_0xf9d5('0x20')]=qs[_0xf9d5('0x20')](_0x10bf36['query'][_0xf9d5('0x20')]);}_0x5006c9[_0xf9d5('0x43')]=qs[_0xf9d5('0x44')](_0x10bf36[_0xf9d5('0x3c')][_0xf9d5('0x44')]);_0x5006c9[_0xf9d5('0x45')]=qs[_0xf9d5('0x3d')](_[_0xf9d5('0x46')](_0x10bf36[_0xf9d5('0x3c')],_0x5f1ae9['filters']),_0xf13c3);if(_0x10bf36[_0xf9d5('0x3c')][_0xf9d5('0x47')]){_0x5006c9['where']=_[_0xf9d5('0x48')](_0x5006c9[_0xf9d5('0x45')],{'$or':_[_0xf9d5('0x35')](_0xf13c3,function(_0x2a3022){if(_0x2a3022[_0xf9d5('0x38')]!==_0xf9d5('0x49')){var _0x18d84c={};_0x18d84c[_0x2a3022[_0xf9d5('0x32')]]={'$like':'%'+_0x10bf36[_0xf9d5('0x3c')][_0xf9d5('0x47')]+'%'};return _0x18d84c;}})});}_0x5006c9=_[_0xf9d5('0x48')]({},_0x5006c9,_0x10bf36[_0xf9d5('0x4a')]);var _0x19a572={'where':_0x5006c9[_0xf9d5('0x45')]};return db[_0xf9d5('0x4b')][_0xf9d5('0x23')](_0x19a572)['then'](function(_0x17ac13){_0x41acb5[_0xf9d5('0x23')]=_0x17ac13;if(_0x10bf36[_0xf9d5('0x3c')][_0xf9d5('0x4c')]){_0x5006c9['include']=[{'all':!![]}];}return db[_0xf9d5('0x4b')][_0xf9d5('0x4d')](_0x5006c9);})['then'](function(_0x465ee2){_0x41acb5[_0xf9d5('0x4e')]=_0x465ee2;return _0x41acb5;})[_0xf9d5('0x2a')](respondWithFilteredResult(_0x369995,_0x5006c9))['catch'](handleError(_0x369995,null));};exports['show']=function(_0x5c4598,_0x16d106){var _0x26be38={'raw':!![],'where':{'id':_0x5c4598[_0xf9d5('0x4f')]['id']}},_0x34f66b={};_0x34f66b[_0xf9d5('0x3a')]=_[_0xf9d5('0x3b')](db[_0xf9d5('0x4b')]['rawAttributes']);_0x34f66b[_0xf9d5('0x3c')]=_[_0xf9d5('0x3b')](_0x5c4598[_0xf9d5('0x3c')]);_0x34f66b['filters']=_['intersection'](_0x34f66b[_0xf9d5('0x3a')],_0x34f66b[_0xf9d5('0x3c')]);_0x26be38[_0xf9d5('0x3f')]=_['intersection'](_0x34f66b[_0xf9d5('0x3a')],qs['fields'](_0x5c4598[_0xf9d5('0x3c')][_0xf9d5('0x40')]));_0x26be38['attributes']=_0x26be38[_0xf9d5('0x3f')][_0xf9d5('0x50')]?_0x26be38[_0xf9d5('0x3f')]:_0x34f66b[_0xf9d5('0x3a')];if(_0x5c4598['query'][_0xf9d5('0x4c')]){_0x26be38[_0xf9d5('0x51')]=[{'all':!![]}];}_0x26be38=_[_0xf9d5('0x48')]({},_0x26be38,_0x5c4598[_0xf9d5('0x4a')]);return db['WhatsappQueue'][_0xf9d5('0x52')](_0x26be38)['then'](handleEntityNotFound(_0x16d106,null))['then'](respondWithResult(_0x16d106,null))['catch'](handleError(_0x16d106,null));};exports[_0xf9d5('0x53')]=function(_0x5817be,_0x19e956){return db[_0xf9d5('0x4b')]['create'](_0x5817be[_0xf9d5('0x54')],{})['then'](function(_0x3544bc){var _0x1cc2f6=_0x5817be['user'][_0xf9d5('0x2c')]({'plain':!![]});if(!_0x1cc2f6)throw new Error(_0xf9d5('0x55'));if(_0x1cc2f6[_0xf9d5('0x56')]===_0xf9d5('0x57')){var _0x569e98=_0x3544bc[_0xf9d5('0x2c')]({'plain':!![]});var _0x240de2='WhatsappQueues';return db[_0xf9d5('0x58')][_0xf9d5('0x52')]({'where':{'name':_0x240de2,'userProfileId':_0x1cc2f6['userProfileId']},'raw':!![]})['then'](function(_0x18e4b6){if(_0x18e4b6&&_0x18e4b6[_0xf9d5('0x59')]===0x0){return db['UserProfileResource'][_0xf9d5('0x53')]({'name':_0x569e98[_0xf9d5('0x32')],'resourceId':_0x569e98['id'],'type':_0x18e4b6[_0xf9d5('0x32')],'sectionId':_0x18e4b6['id']},{})[_0xf9d5('0x2a')](function(){return _0x3544bc;});}else{return _0x3544bc;}})[_0xf9d5('0x5a')](function(_0x483a80){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x483a80);throw _0x483a80;});}return _0x3544bc;})['then'](respondWithResult(_0x19e956,0xc9))['catch'](handleError(_0x19e956,null));};exports[_0xf9d5('0x29')]=function(_0x4a7e4d,_0x4ac180){if(_0x4a7e4d[_0xf9d5('0x54')]['id']){delete _0x4a7e4d[_0xf9d5('0x54')]['id'];}return db[_0xf9d5('0x4b')]['find']({'where':{'id':_0x4a7e4d[_0xf9d5('0x4f')]['id']}})[_0xf9d5('0x2a')](handleEntityNotFound(_0x4ac180,null))[_0xf9d5('0x2a')](saveUpdates(_0x4a7e4d[_0xf9d5('0x54')],null))[_0xf9d5('0x2a')](respondWithResult(_0x4ac180,null))[_0xf9d5('0x5a')](handleError(_0x4ac180,null));};exports[_0xf9d5('0x2b')]=function(_0x356b99,_0x1d4b2d){return db[_0xf9d5('0x4b')][_0xf9d5('0x52')]({'where':{'id':_0x356b99[_0xf9d5('0x4f')]['id']}})[_0xf9d5('0x2a')](handleEntityNotFound(_0x1d4b2d,null))['then'](removeEntity(_0x1d4b2d,null))[_0xf9d5('0x5a')](handleError(_0x1d4b2d,null));};exports['describe']=function(_0x4de297,_0x280a6d){return db[_0xf9d5('0x4b')][_0xf9d5('0x5b')]()[_0xf9d5('0x2a')](respondWithResult(_0x280a6d,null))[_0xf9d5('0x5a')](handleError(_0x280a6d,null));};exports[_0xf9d5('0x5c')]=function(_0x289763,_0x244fb1,_0x4d8112){var _0x519919={'raw':!![],'where':{}},_0x59558b={},_0x24f7b6;return db['WhatsappQueue']['findOne']({'where':{'id':_0x289763[_0xf9d5('0x4f')]['id']}})[_0xf9d5('0x2a')](handleEntityNotFound(_0x244fb1,null))[_0xf9d5('0x2a')](function(_0x3178f6){if(_0x3178f6){_0x24f7b6=_0x3178f6[_0xf9d5('0x2c')]({'plain':!![]});_0x59558b[_0xf9d5('0x3a')]=_[_0xf9d5('0x3b')](db[_0xf9d5('0x5d')]['rawAttributes']);_0x59558b[_0xf9d5('0x3c')]=_['keys'](_0x289763['query']);_0x59558b['filters']=_[_0xf9d5('0x3e')](_0x59558b[_0xf9d5('0x3a')],_0x59558b['query']);_0x519919[_0xf9d5('0x3f')]=_[_0xf9d5('0x3e')](_0x59558b[_0xf9d5('0x3a')],qs[_0xf9d5('0x40')](_0x289763[_0xf9d5('0x3c')]['fields']));_0x519919[_0xf9d5('0x3f')]=_0x519919[_0xf9d5('0x3f')][_0xf9d5('0x50')]?_0x519919[_0xf9d5('0x3f')]:_0x59558b[_0xf9d5('0x3a')];if(!_0x289763[_0xf9d5('0x3c')][_0xf9d5('0x41')]('nolimit')){_0x519919['limit']=qs[_0xf9d5('0x22')](_0x289763[_0xf9d5('0x3c')][_0xf9d5('0x22')]);_0x519919[_0xf9d5('0x20')]=qs[_0xf9d5('0x20')](_0x289763[_0xf9d5('0x3c')][_0xf9d5('0x20')]);}_0x519919[_0xf9d5('0x43')]=qs['sort'](_0x289763[_0xf9d5('0x3c')][_0xf9d5('0x44')]);_0x519919[_0xf9d5('0x45')]=qs['filters'](_['pick'](_0x289763[_0xf9d5('0x3c')],_0x59558b[_0xf9d5('0x3d')]));_0x519919['where'][_0xf9d5('0x5e')]=_0x3178f6['id'];if(_0x289763[_0xf9d5('0x3c')][_0xf9d5('0x47')]){_0x519919[_0xf9d5('0x45')]=_[_0xf9d5('0x48')](_0x519919[_0xf9d5('0x45')],{'$or':_[_0xf9d5('0x35')](_0x519919['attributes'],function(_0x41690b){var _0x2ae3ba={};_0x2ae3ba[_0x41690b]={'$like':'%'+_0x289763[_0xf9d5('0x3c')][_0xf9d5('0x47')]+'%'};return _0x2ae3ba;})});}_0x519919=_[_0xf9d5('0x48')]({},_0x519919,_0x289763['options']);return db[_0xf9d5('0x5d')][_0xf9d5('0x4d')](_0x519919);}})['then'](function(_0x1d8175){if(_0x1d8175){return db['User'][_0xf9d5('0x5f')]({'where':{'id':_[_0xf9d5('0x35')](_0x1d8175,_0xf9d5('0x60')),'role':_0xf9d5('0x61')},'attributes':['id',_0xf9d5('0x32'),_0xf9d5('0x62'),_0xf9d5('0x63'),'createdAt']});}})[_0xf9d5('0x2a')](function(_0x169a41){if(_0x169a41){return{'count':_0x169a41[_0xf9d5('0x23')],'rows':_[_0xf9d5('0x35')](_0x169a41[_0xf9d5('0x4e')],function(_0x45b139){return{'membername':_0x45b139[_0xf9d5('0x32')],'UserId':_0x45b139['id'],'queue_name':_0x24f7b6[_0xf9d5('0x32')],'WhatsappQueueId':_0x24f7b6['id'],'interface':util[_0xf9d5('0x64')](_0xf9d5('0x65'),_0xf9d5('0x66'),_0x45b139[_0xf9d5('0x32')]),'penalty':0x0,'paused':_0x45b139[_0xf9d5('0x62')],'createdAt':_0x45b139['createdAt'],'updatedAt':_0x45b139[_0xf9d5('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf9d5('0x2a')](respondWithFilteredResult(_0x244fb1,_0x519919))[_0xf9d5('0x5a')](handleError(_0x244fb1,null));};exports[_0xf9d5('0x67')]=function(_0x1727e3,_0x277a5d,_0x20b282){var _0x43add5={};var _0x1b9285={};var _0x2d4b51;var _0x4024c7;return db[_0xf9d5('0x4b')][_0xf9d5('0x68')]({'where':{'id':_0x1727e3[_0xf9d5('0x4f')]['id']}})['then'](handleEntityNotFound(_0x277a5d,null))[_0xf9d5('0x2a')](function(_0x15b281){if(_0x15b281){_0x2d4b51=_0x15b281;_0x1b9285[_0xf9d5('0x3a')]=_['keys'](db[_0xf9d5('0x69')][_0xf9d5('0x36')]);_0x1b9285[_0xf9d5('0x3c')]=_[_0xf9d5('0x3b')](_0x1727e3['query']);_0x1b9285[_0xf9d5('0x3d')]=_[_0xf9d5('0x3e')](_0x1b9285[_0xf9d5('0x3a')],_0x1b9285[_0xf9d5('0x3c')]);_0x43add5[_0xf9d5('0x3f')]=_[_0xf9d5('0x3e')](_0x1b9285[_0xf9d5('0x3a')],qs[_0xf9d5('0x40')](_0x1727e3[_0xf9d5('0x3c')][_0xf9d5('0x40')]));_0x43add5['attributes']=_0x43add5[_0xf9d5('0x3f')][_0xf9d5('0x50')]?_0x43add5['attributes']:_0x1b9285[_0xf9d5('0x3a')];_0x43add5[_0xf9d5('0x43')]=qs['sort'](_0x1727e3['query'][_0xf9d5('0x44')]);_0x43add5[_0xf9d5('0x45')]=qs['filters'](_[_0xf9d5('0x46')](_0x1727e3['query'],_0x1b9285[_0xf9d5('0x3d')]));if(_0x1727e3[_0xf9d5('0x3c')][_0xf9d5('0x47')]){_0x43add5[_0xf9d5('0x45')]=_[_0xf9d5('0x48')](_0x43add5['where'],{'$or':_[_0xf9d5('0x35')](_0x43add5[_0xf9d5('0x3f')],function(_0x191c80){var _0x224a90={};_0x224a90[_0x191c80]={'$like':'%'+_0x1727e3['query'][_0xf9d5('0x47')]+'%'};return _0x224a90;})});}_0x43add5=_['merge']({},_0x43add5,_0x1727e3[_0xf9d5('0x4a')]);return _0x2d4b51[_0xf9d5('0x67')](_0x43add5);}})[_0xf9d5('0x2a')](function(_0xfc2d53){if(_0xfc2d53){_0x4024c7=_0xfc2d53[_0xf9d5('0x50')];if(!_0x1727e3[_0xf9d5('0x3c')][_0xf9d5('0x41')]('nolimit')){_0x43add5[_0xf9d5('0x22')]=qs[_0xf9d5('0x22')](_0x1727e3['query'][_0xf9d5('0x22')]);_0x43add5['offset']=qs['offset'](_0x1727e3[_0xf9d5('0x3c')]['offset']);}return _0x2d4b51[_0xf9d5('0x67')](_0x43add5);}})[_0xf9d5('0x2a')](function(_0x5215c9){if(_0x5215c9){return _0x5215c9?{'count':_0x4024c7,'rows':_0x5215c9}:null;}})[_0xf9d5('0x2a')](respondWithResult(_0x277a5d,null))[_0xf9d5('0x5a')](handleError(_0x277a5d,null));};exports[_0xf9d5('0x6a')]=function(_0x1d549f,_0x5b3389,_0x5e4b07){var _0x496f7d=_0x1d549f[_0xf9d5('0x54')]['ids'];return db[_0xf9d5('0x69')][_0xf9d5('0x4d')]({'where':{'id':_0x496f7d},'attributes':['id'],'include':[{'model':db[_0xf9d5('0x6b')],'as':_0xf9d5('0x6c'),'attributes':['id',_0xf9d5('0x32'),_0xf9d5('0x6d'),_0xf9d5('0x6e'),_0xf9d5('0x6f')],'raw':!![]}]})[_0xf9d5('0x2a')](function(_0xfb3518){if(_0xfb3518){var _0x1fc90f=_[_0xf9d5('0x70')](_0xfb3518,function(_0xe6fddc){var _0x381162=_0xe6fddc[_0xf9d5('0x2c')]({'plain':!![]});return _0x381162[_0xf9d5('0x6c')];});return db[_0xf9d5('0x4b')][_0xf9d5('0x52')]({'where':{'id':_0x1d549f['params']['id']}})[_0xf9d5('0x2a')](function(_0x539b48){return db[_0xf9d5('0x71')][_0xf9d5('0x72')](function(_0x3fa062){return _0x539b48['addTeams'](_0x496f7d,{'transaction':_0x3fa062})[_0xf9d5('0x2a')](function(){return BPromise[_0xf9d5('0x73')](_0x1fc90f,function(_0x4f4ef7){return db[_0xf9d5('0x5d')][_0xf9d5('0x74')]({'where':{'UserId':_0x4f4ef7['id'],'WhatsappQueueId':_0x1d549f['params']['id']},'transaction':_0x3fa062});});})[_0xf9d5('0x2a')](function(){_0x1fc90f['forEach'](function(_0x2184ee){socket[_0xf9d5('0x75')](_0xf9d5('0x76'),{'UserId':_0x2184ee['id'],'WhatsappQueueId':_0x539b48['id']});});});});});}})['then'](respondWithStatusCode(_0x5b3389,null))[_0xf9d5('0x5a')](handleError(_0x5b3389,null));};exports[_0xf9d5('0x77')]=function(_0x5bb558,_0x2d88ba,_0x4bb500){return db[_0xf9d5('0x69')][_0xf9d5('0x4d')]({'where':{'id':_0x5bb558[_0xf9d5('0x3c')][_0xf9d5('0x78')]},'attributes':['id'],'include':[{'model':db[_0xf9d5('0x6b')],'as':_0xf9d5('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xf9d5('0x2a')](handleEntityNotFound(_0x2d88ba,null))[_0xf9d5('0x2a')](function(_0x11f0aa){var _0x33d504=_[_0xf9d5('0x35')](_0x11f0aa,'id');var _0x5d0bef=[];var _0x4c6ba9=[];var _0x5359da=squel[_0xf9d5('0x79')]();_0x5359da['field']('tq.TeamId')[_0xf9d5('0x7a')](_0xf9d5('0x7b'),'tq')[_0xf9d5('0x7c')](_0xf9d5('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf9d5('0x45')](_0xf9d5('0x7e'),_0x5bb558['params']['id']);for(var _0x4513d8=0x0;_0x4513d8<_0x11f0aa[_0xf9d5('0x50')];_0x4513d8+=0x1){let _0x5694f5=_0x11f0aa[_0x4513d8];for(var _0x25a573=0x0;_0x25a573<_0x5694f5[_0xf9d5('0x6c')][_0xf9d5('0x50')];_0x25a573+=0x1){let _0x2f4357=_0x5694f5[_0xf9d5('0x6c')][_0x25a573];var _0x3d19f1=_0x5359da[_0xf9d5('0x7f')]();_0x3d19f1[_0xf9d5('0x45')]('ut.UserId\x20=\x20?',_0x2f4357['id']);_0x4c6ba9[_0xf9d5('0x80')](db[_0xf9d5('0x71')][_0xf9d5('0x3c')](_0x3d19f1[_0xf9d5('0x81')](),{'type':db['sequelize']['QueryTypes'][_0xf9d5('0x82')]})[_0xf9d5('0x2a')](function(_0x1f9510){if(_0x1f9510[_0xf9d5('0x50')]===0x1){return _0x2f4357['id'];}else{var _0x238b9a=_[_0xf9d5('0x83')](_[_0xf9d5('0x35')](_0x1f9510,'TeamId'),function(_0x4dc366){return _['includes'](_0x33d504,_0x4dc366);});if(_0x238b9a){return _0x2f4357['id'];}}}));}}return BPromise[_0xf9d5('0x84')](_0x4c6ba9)[_0xf9d5('0x2a')](function(_0x45df43){_0x5d0bef=_(_0x5d0bef)[_0xf9d5('0x85')](_0x45df43)[_0xf9d5('0x86')]()[_0xf9d5('0x87')]();return db[_0xf9d5('0x4b')][_0xf9d5('0x52')]({'where':{'id':_0x5bb558[_0xf9d5('0x4f')]['id']}})[_0xf9d5('0x2a')](function(_0x32beeb){return db[_0xf9d5('0x71')]['transaction'](function(_0x5b679d){return _0x32beeb['removeTeams'](_0x5bb558[_0xf9d5('0x3c')][_0xf9d5('0x78')],{'transaction':_0x5b679d})[_0xf9d5('0x2a')](function(){if(!_[_0xf9d5('0x88')](_0x5d0bef)){return _0x32beeb['removeAgents'](_0x5d0bef,{'transaction':_0x5b679d});}})[_0xf9d5('0x2a')](function(){_0x5d0bef[_0xf9d5('0x89')](function(_0x9000bd){socket['emit'](_0xf9d5('0x8a'),{'UserId':_0x9000bd,'WhatsappQueueId':_0x32beeb['id']});});});});});});})['then'](respondWithStatusCode(_0x2d88ba,null))[_0xf9d5('0x5a')](handleError(_0x2d88ba,null));};exports[_0xf9d5('0x8b')]=function(_0x2996c0,_0xe0909b,_0x51ff71){return db['WhatsappQueue'][_0xf9d5('0x52')]({'where':{'id':_0x2996c0[_0xf9d5('0x4f')]['id']}})[_0xf9d5('0x2a')](handleEntityNotFound(_0xe0909b,null))['then'](function(_0x1ece12){if(_0x1ece12){return _0x1ece12[_0xf9d5('0x8b')](_0x2996c0[_0xf9d5('0x54')][_0xf9d5('0x78')],_[_0xf9d5('0x8c')](_0x2996c0[_0xf9d5('0x54')],[_0xf9d5('0x78'),'id'])||{})['spread'](function(_0x492e0e){for(var _0x41b1cb=0x0;_0x41b1cb<_0x2996c0[_0xf9d5('0x54')][_0xf9d5('0x78')]['length'];_0x41b1cb+=0x1){socket[_0xf9d5('0x75')](_0xf9d5('0x76'),{'UserId':Number(_0x2996c0[_0xf9d5('0x54')][_0xf9d5('0x78')][_0x41b1cb]),'WhatsappQueueId':Number(_0x2996c0['params']['id'])});}return _0x492e0e;});}})[_0xf9d5('0x2a')](respondWithResult(_0xe0909b,null))[_0xf9d5('0x5a')](handleError(_0xe0909b,null));};exports[_0xf9d5('0x8d')]=function(_0x2296f7,_0x4ce415,_0x2c859b){return db[_0xf9d5('0x4b')][_0xf9d5('0x52')]({'where':{'id':_0x2296f7[_0xf9d5('0x4f')]['id']}})[_0xf9d5('0x2a')](handleEntityNotFound(_0x4ce415,null))[_0xf9d5('0x2a')](function(_0x546674){if(_0x546674){return _0x546674[_0xf9d5('0x8d')](_0x2296f7[_0xf9d5('0x3c')][_0xf9d5('0x78')])[_0xf9d5('0x2a')](function(){if(_[_0xf9d5('0x8e')](_0x2296f7[_0xf9d5('0x3c')]['ids'])){for(var _0x314822=0x0;_0x314822<_0x2296f7[_0xf9d5('0x3c')]['ids'][_0xf9d5('0x50')];_0x314822+=0x1){socket[_0xf9d5('0x75')](_0xf9d5('0x8a'),{'UserId':Number(_0x2296f7['query']['ids'][_0x314822]),'WhatsappQueueId':Number(_0x2296f7['params']['id'])});}}else{socket['emit'](_0xf9d5('0x8a'),{'UserId':Number(_0x2296f7[_0xf9d5('0x3c')][_0xf9d5('0x78')]),'WhatsappQueueId':Number(_0x2296f7['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4ce415,null))[_0xf9d5('0x5a')](handleError(_0x4ce415,null));};exports[_0xf9d5('0x8f')]=function(_0x80a785,_0x47493c,_0x2e693e){var _0x19046a={};var _0x4f4421={};var _0x3b9caf;var _0x445c53;return db[_0xf9d5('0x4b')][_0xf9d5('0x68')]({'where':{'id':_0x80a785[_0xf9d5('0x4f')]['id']}})[_0xf9d5('0x2a')](handleEntityNotFound(_0x47493c,null))['then'](function(_0x363f42){if(_0x363f42){_0x3b9caf=_0x363f42;_0x4f4421[_0xf9d5('0x3a')]=_['keys'](db[_0xf9d5('0x6b')][_0xf9d5('0x36')]);_0x4f4421[_0xf9d5('0x3c')]=_[_0xf9d5('0x3b')](_0x80a785['query']);_0x4f4421['filters']=_['intersection'](_0x4f4421[_0xf9d5('0x3a')],_0x4f4421[_0xf9d5('0x3c')]);_0x19046a[_0xf9d5('0x3f')]=_['intersection'](_0x4f4421['model'],qs[_0xf9d5('0x40')](_0x80a785[_0xf9d5('0x3c')][_0xf9d5('0x40')]));_0x19046a[_0xf9d5('0x3f')]=_0x19046a[_0xf9d5('0x3f')][_0xf9d5('0x50')]?_0x19046a['attributes']:_0x4f4421[_0xf9d5('0x3a')];_0x19046a[_0xf9d5('0x43')]=qs[_0xf9d5('0x44')](_0x80a785[_0xf9d5('0x3c')][_0xf9d5('0x44')]);_0x19046a[_0xf9d5('0x45')]=qs[_0xf9d5('0x3d')](_[_0xf9d5('0x46')](_0x80a785[_0xf9d5('0x3c')],_0x4f4421[_0xf9d5('0x3d')]));if(_0x80a785['query'][_0xf9d5('0x47')]){_0x19046a[_0xf9d5('0x45')]=_[_0xf9d5('0x48')](_0x19046a[_0xf9d5('0x45')],{'$or':_[_0xf9d5('0x35')](_0x19046a[_0xf9d5('0x3f')],function(_0x1edda6){var _0x14318f={};_0x14318f[_0x1edda6]={'$like':'%'+_0x80a785['query'][_0xf9d5('0x47')]+'%'};return _0x14318f;})});}_0x19046a=_[_0xf9d5('0x48')]({},_0x19046a,_0x80a785[_0xf9d5('0x4a')]);return _0x3b9caf[_0xf9d5('0x8f')](_0x19046a);}})['then'](function(_0xc9bbf0){if(_0xc9bbf0){_0x445c53=_0xc9bbf0[_0xf9d5('0x50')];if(!_0x80a785['query']['hasOwnProperty'](_0xf9d5('0x42'))){_0x19046a[_0xf9d5('0x22')]=qs['limit'](_0x80a785[_0xf9d5('0x3c')][_0xf9d5('0x22')]);_0x19046a[_0xf9d5('0x20')]=qs[_0xf9d5('0x20')](_0x80a785[_0xf9d5('0x3c')][_0xf9d5('0x20')]);}return _0x3b9caf[_0xf9d5('0x8f')](_0x19046a);}})['then'](function(_0x2b1bab){if(_0x2b1bab){return _0x2b1bab?{'count':_0x445c53,'rows':_0x2b1bab}:null;}})[_0xf9d5('0x2a')](respondWithResult(_0x47493c,null))['catch'](handleError(_0x47493c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 9e46d57..0e45e7d 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 _0x51b9=['hasOwnProperty','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x51b9,0x181));var _0x951b=function(_0x19c8d0,_0x17c993){_0x19c8d0=_0x19c8d0-0x0;var _0x1e70b9=_0x51b9[_0x19c8d0];return _0x1e70b9;};'use strict';var EventEmitter=require(_0x951b('0x0'));var WhatsappQueue=require(_0x951b('0x1'))['db'][_0x951b('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x951b('0x3')](0x0);var events={'afterCreate':_0x951b('0x4'),'afterUpdate':_0x951b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x51f598){return function(_0x4714a1,_0x199d61,_0x2930e8){WhatsappQueueEvents[_0x951b('0x6')](_0x51f598+':'+_0x4714a1['id'],_0x4714a1);WhatsappQueueEvents['emit'](_0x51f598,_0x4714a1);_0x2930e8(null);};}for(var e in events){if(events[_0x951b('0x7')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xa7fa=['save','update','remove','emit','hook','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x4e6c6b,_0x50c1f2){var _0x12d8d9=function(_0x68d410){while(--_0x68d410){_0x4e6c6b['push'](_0x4e6c6b['shift']());}};_0x12d8d9(++_0x50c1f2);}(_0xa7fa,0x188));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xaa7f('0x0'));var WhatsappQueue=require(_0xaa7f('0x1'))['db'][_0xaa7f('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xaa7f('0x3')](0x0);var events={'afterCreate':_0xaa7f('0x4'),'afterUpdate':_0xaa7f('0x5'),'afterDestroy':_0xaa7f('0x6')};function emitEvent(_0x3138b2){return function(_0x5c6ed9,_0x3d95da,_0x4dd47f){WhatsappQueueEvents[_0xaa7f('0x7')](_0x3138b2+':'+_0x5c6ed9['id'],_0x5c6ed9);WhatsappQueueEvents[_0xaa7f('0x7')](_0x3138b2,_0x5c6ed9);_0x4dd47f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xaa7f('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 074b453..8a82395 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 _0x20c6=['../../config/environment','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x22be36,_0x5b85d6){var _0x1786f9=function(_0x175782){while(--_0x175782){_0x22be36['push'](_0x22be36['shift']());}};_0x1786f9(++_0x5b85d6);}(_0x20c6,0x64));var _0x620c=function(_0x2a8255,_0x2ab6cb){_0x2a8255=_0x2a8255-0x0;var _0x20d7a5=_0x20c6[_0x2a8255];return _0x20d7a5;};'use strict';var _=require('lodash');var util=require(_0x620c('0x0'));var logger=require(_0x620c('0x1'))(_0x620c('0x2'));var moment=require(_0x620c('0x3'));var BPromise=require(_0x620c('0x4'));var rp=require(_0x620c('0x5'));var fs=require('fs');var path=require(_0x620c('0x6'));var rimraf=require(_0x620c('0x7'));var config=require(_0x620c('0x8'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x292f0f,_0x36b49a){return _0x292f0f[_0x620c('0x9')](_0x620c('0xa'),attributes,{'tableName':_0x620c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fd6=['../../config/logger','moment','bluebird','path','./whatsappQueue.attributes','exports','WhatsappQueue','whatsapp_queues','lodash'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0x0fd6,0x1b8));var _0x60fd=function(_0xec84d8,_0x31f774){_0xec84d8=_0xec84d8-0x0;var _0x281e56=_0x0fd6[_0xec84d8];return _0x281e56;};'use strict';var _=require(_0x60fd('0x0'));var util=require('util');var logger=require(_0x60fd('0x1'))('api');var moment=require(_0x60fd('0x2'));var BPromise=require(_0x60fd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60fd('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x60fd('0x5'));module[_0x60fd('0x6')]=function(_0x3dc4bb,_0x274a96){return _0x3dc4bb['define'](_0x60fd('0x7'),attributes,{'tableName':_0x60fd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 616001d..f8df04a 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 _0xe37b=['attributes','limit','map','include','model','stringify','find','ShowWhatsappQueue','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetWhatsappQueue','findAll','raw','where','options'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xe37b,0xa4));var _0xbe37=function(_0x102452,_0x2357cd){_0x102452=_0x102452-0x0;var _0x24b2ff=_0xe37b[_0x102452];return _0x24b2ff;};'use strict';var _=require('lodash');var util=require(_0xbe37('0x0'));var moment=require(_0xbe37('0x1'));var BPromise=require(_0xbe37('0x2'));var rs=require(_0xbe37('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbe37('0x4'));var logger=require(_0xbe37('0x5'))(_0xbe37('0x6'));var config=require('../../config/environment');var jayson=require(_0xbe37('0x7'));var client=jayson[_0xbe37('0x8')]['http']({'port':0x232a});config[_0xbe37('0x9')]=_[_0xbe37('0xa')](config['redis'],{'host':_0xbe37('0xb'),'port':0x18eb});var socket=require(_0xbe37('0xc'))(new Redis(config['redis']));require(_0xbe37('0xd'))[_0xbe37('0xe')](socket);function respondWithRpcPromise(_0x433de7,_0x1fd9f4,_0x3e5a53){return new BPromise(function(_0x45d1d5,_0x547495){return client[_0xbe37('0xf')](_0x433de7,_0x3e5a53)[_0xbe37('0x10')](function(_0x1a5d0f){logger[_0xbe37('0x11')](_0xbe37('0x12'),_0x1fd9f4,_0xbe37('0x13'));logger[_0xbe37('0x14')](_0xbe37('0x15'),_0x1fd9f4,_0xbe37('0x13'),JSON['stringify'](_0x1a5d0f));if(_0x1a5d0f[_0xbe37('0x16')]){if(_0x1a5d0f[_0xbe37('0x16')]['code']===0x1f4){logger[_0xbe37('0x16')](_0xbe37('0x12'),_0x1fd9f4,_0x1a5d0f[_0xbe37('0x16')][_0xbe37('0x17')]);return _0x547495(_0x1a5d0f[_0xbe37('0x16')][_0xbe37('0x17')]);}logger[_0xbe37('0x16')](_0xbe37('0x12'),_0x1fd9f4,_0x1a5d0f['error'][_0xbe37('0x17')]);return _0x45d1d5(_0x1a5d0f[_0xbe37('0x16')][_0xbe37('0x17')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x1fd9f4,_0xbe37('0x13'));_0x45d1d5(_0x1a5d0f[_0xbe37('0x18')]['message']);}})[_0xbe37('0x19')](function(_0x8844a1){logger[_0xbe37('0x16')](_0xbe37('0x12'),_0x1fd9f4,_0x8844a1);_0x547495(_0x8844a1);});});}exports[_0xbe37('0x1a')]=function(_0x48766a){var _0x5f3dc7=this;return new Promise(function(_0x47daae,_0x576050){return db['WhatsappQueue'][_0xbe37('0x1b')]({'raw':_0x48766a['options']?_0x48766a['options'][_0xbe37('0x1c')]===undefined?!![]:![]:!![],'where':_0x48766a['options']?_0x48766a['options'][_0xbe37('0x1d')]||null:null,'attributes':_0x48766a[_0xbe37('0x1e')]?_0x48766a[_0xbe37('0x1e')][_0xbe37('0x1f')]||null:null,'limit':_0x48766a[_0xbe37('0x1e')]?_0x48766a[_0xbe37('0x1e')][_0xbe37('0x20')]||null:null,'include':_0x48766a[_0xbe37('0x1e')]?_0x48766a[_0xbe37('0x1e')]['include']?_[_0xbe37('0x21')](_0x48766a[_0xbe37('0x1e')][_0xbe37('0x22')],function(_0x2d60fc){return{'model':db[_0x2d60fc[_0xbe37('0x23')]],'as':_0x2d60fc['as'],'attributes':_0x2d60fc[_0xbe37('0x1f')],'include':_0x2d60fc[_0xbe37('0x22')]?_['map'](_0x2d60fc['include'],function(_0x4ba0b5){return{'model':db[_0x4ba0b5[_0xbe37('0x23')]],'as':_0x4ba0b5['as'],'attributes':_0x4ba0b5['attributes'],'include':_0x4ba0b5[_0xbe37('0x22')]?_[_0xbe37('0x21')](_0x4ba0b5['include'],function(_0x3196fa){return{'model':db[_0x3196fa[_0xbe37('0x23')]],'as':_0x3196fa['as'],'attributes':_0x3196fa[_0xbe37('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xbe37('0x10')](function(_0x3bb691){logger[_0xbe37('0x11')](_0xbe37('0x1a'),_0x48766a);logger[_0xbe37('0x14')]('GetWhatsappQueue',_0x48766a,JSON[_0xbe37('0x24')](_0x3bb691));_0x47daae(_0x3bb691);})['catch'](function(_0x580d23){logger[_0xbe37('0x16')](_0xbe37('0x1a'),_0x580d23['message'],_0x48766a);_0x576050(_0x5f3dc7[_0xbe37('0x16')](0x1f4,_0x580d23['message']));});});};exports['ShowWhatsappQueue']=function(_0x4889ce){var _0x44ef09=this;return new Promise(function(_0x1426ec,_0x5e4fa2){return db['WhatsappQueue'][_0xbe37('0x25')]({'raw':_0x4889ce['options']?_0x4889ce[_0xbe37('0x1e')][_0xbe37('0x1c')]===undefined?!![]:![]:!![],'where':_0x4889ce[_0xbe37('0x1e')]?_0x4889ce[_0xbe37('0x1e')][_0xbe37('0x1d')]||null:null,'attributes':_0x4889ce['options']?_0x4889ce['options'][_0xbe37('0x1f')]||null:null,'include':_0x4889ce[_0xbe37('0x1e')]?_0x4889ce[_0xbe37('0x1e')]['include']?_['map'](_0x4889ce[_0xbe37('0x1e')][_0xbe37('0x22')],function(_0x21bd7d){return{'model':db[_0x21bd7d['model']],'as':_0x21bd7d['as'],'attributes':_0x21bd7d[_0xbe37('0x1f')],'include':_0x21bd7d['include']?_[_0xbe37('0x21')](_0x21bd7d[_0xbe37('0x22')],function(_0x4863d1){return{'model':db[_0x4863d1[_0xbe37('0x23')]],'as':_0x4863d1['as'],'attributes':_0x4863d1['attributes'],'include':_0x4863d1[_0xbe37('0x22')]?_[_0xbe37('0x21')](_0x4863d1['include'],function(_0x1065c1){return{'model':db[_0x1065c1[_0xbe37('0x23')]],'as':_0x1065c1['as'],'attributes':_0x1065c1[_0xbe37('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d368b){logger[_0xbe37('0x11')](_0xbe37('0x26'),_0x4889ce);logger[_0xbe37('0x14')](_0xbe37('0x26'),_0x4889ce,JSON[_0xbe37('0x24')](_0x3d368b));_0x1426ec(_0x3d368b);})['catch'](function(_0x48b853){logger[_0xbe37('0x16')](_0xbe37('0x26'),_0x48b853['message'],_0x4889ce);_0x5e4fa2(_0x44ef09[_0xbe37('0x16')](0x1f4,_0x48b853[_0xbe37('0x17')]));});});}; \ No newline at end of file +var _0x6800=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','findAll','options','raw','where','attributes','map','include','model','then','GetWhatsappQueue','catch','find','ShowWhatsappQueue','moment','bluebird','randomstring','ioredis'];(function(_0x44da11,_0x1e73cc){var _0x4fc812=function(_0x1db72b){while(--_0x1db72b){_0x44da11['push'](_0x44da11['shift']());}};_0x4fc812(++_0x1e73cc);}(_0x6800,0x1ea));var _0x0680=function(_0x47341f,_0x1ed16b){_0x47341f=_0x47341f-0x0;var _0x49698f=_0x6800[_0x47341f];return _0x49698f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0680('0x0'));var BPromise=require(_0x0680('0x1'));var rs=require(_0x0680('0x2'));var fs=require('fs');var Redis=require(_0x0680('0x3'));var db=require(_0x0680('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0680('0x5'))(_0x0680('0x6'));var config=require(_0x0680('0x7'));var jayson=require(_0x0680('0x8'));var client=jayson[_0x0680('0x9')][_0x0680('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0680('0xb')],{'host':_0x0680('0xc'),'port':0x18eb});var socket=require(_0x0680('0xd'))(new Redis(config[_0x0680('0xb')]));require(_0x0680('0xe'))[_0x0680('0xf')](socket);function respondWithRpcPromise(_0x4991c4,_0x79e251,_0xa764c5){return new BPromise(function(_0x52ac97,_0x2f830c){return client['request'](_0x4991c4,_0xa764c5)['then'](function(_0x31bab0){logger['info'](_0x0680('0x10'),_0x79e251,'request\x20sent');logger[_0x0680('0x11')](_0x0680('0x12'),_0x79e251,_0x0680('0x13'),JSON[_0x0680('0x14')](_0x31bab0));if(_0x31bab0[_0x0680('0x15')]){if(_0x31bab0['error']['code']===0x1f4){logger[_0x0680('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x79e251,_0x31bab0[_0x0680('0x15')][_0x0680('0x16')]);return _0x2f830c(_0x31bab0[_0x0680('0x15')][_0x0680('0x16')]);}logger[_0x0680('0x15')](_0x0680('0x10'),_0x79e251,_0x31bab0[_0x0680('0x15')][_0x0680('0x16')]);return _0x52ac97(_0x31bab0[_0x0680('0x15')]['message']);}else{logger[_0x0680('0x17')](_0x0680('0x10'),_0x79e251,_0x0680('0x13'));_0x52ac97(_0x31bab0[_0x0680('0x18')][_0x0680('0x16')]);}})['catch'](function(_0x199199){logger[_0x0680('0x15')](_0x0680('0x10'),_0x79e251,_0x199199);_0x2f830c(_0x199199);});});}exports['GetWhatsappQueue']=function(_0x336cee){var _0x29007a=this;return new Promise(function(_0x15a26f,_0x1538d8){return db['WhatsappQueue'][_0x0680('0x19')]({'raw':_0x336cee[_0x0680('0x1a')]?_0x336cee[_0x0680('0x1a')][_0x0680('0x1b')]===undefined?!![]:![]:!![],'where':_0x336cee[_0x0680('0x1a')]?_0x336cee[_0x0680('0x1a')][_0x0680('0x1c')]||null:null,'attributes':_0x336cee[_0x0680('0x1a')]?_0x336cee['options'][_0x0680('0x1d')]||null:null,'limit':_0x336cee[_0x0680('0x1a')]?_0x336cee[_0x0680('0x1a')]['limit']||null:null,'include':_0x336cee[_0x0680('0x1a')]?_0x336cee['options']['include']?_[_0x0680('0x1e')](_0x336cee['options'][_0x0680('0x1f')],function(_0x98cde9){return{'model':db[_0x98cde9[_0x0680('0x20')]],'as':_0x98cde9['as'],'attributes':_0x98cde9[_0x0680('0x1d')],'include':_0x98cde9['include']?_[_0x0680('0x1e')](_0x98cde9[_0x0680('0x1f')],function(_0x405cf2){return{'model':db[_0x405cf2[_0x0680('0x20')]],'as':_0x405cf2['as'],'attributes':_0x405cf2[_0x0680('0x1d')],'include':_0x405cf2['include']?_[_0x0680('0x1e')](_0x405cf2[_0x0680('0x1f')],function(_0x298221){return{'model':db[_0x298221[_0x0680('0x20')]],'as':_0x298221['as'],'attributes':_0x298221[_0x0680('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0680('0x21')](function(_0x4212d){logger[_0x0680('0x17')](_0x0680('0x22'),_0x336cee);logger[_0x0680('0x11')](_0x0680('0x22'),_0x336cee,JSON[_0x0680('0x14')](_0x4212d));_0x15a26f(_0x4212d);})[_0x0680('0x23')](function(_0x4146b3){logger[_0x0680('0x15')](_0x0680('0x22'),_0x4146b3[_0x0680('0x16')],_0x336cee);_0x1538d8(_0x29007a['error'](0x1f4,_0x4146b3[_0x0680('0x16')]));});});};exports['ShowWhatsappQueue']=function(_0x46504f){var _0x51d197=this;return new Promise(function(_0x305e55,_0x3586db){return db['WhatsappQueue'][_0x0680('0x24')]({'raw':_0x46504f[_0x0680('0x1a')]?_0x46504f[_0x0680('0x1a')][_0x0680('0x1b')]===undefined?!![]:![]:!![],'where':_0x46504f[_0x0680('0x1a')]?_0x46504f['options'][_0x0680('0x1c')]||null:null,'attributes':_0x46504f[_0x0680('0x1a')]?_0x46504f[_0x0680('0x1a')][_0x0680('0x1d')]||null:null,'include':_0x46504f['options']?_0x46504f['options'][_0x0680('0x1f')]?_[_0x0680('0x1e')](_0x46504f['options']['include'],function(_0x24d777){return{'model':db[_0x24d777[_0x0680('0x20')]],'as':_0x24d777['as'],'attributes':_0x24d777['attributes'],'include':_0x24d777[_0x0680('0x1f')]?_['map'](_0x24d777['include'],function(_0x277954){return{'model':db[_0x277954['model']],'as':_0x277954['as'],'attributes':_0x277954[_0x0680('0x1d')],'include':_0x277954[_0x0680('0x1f')]?_[_0x0680('0x1e')](_0x277954[_0x0680('0x1f')],function(_0x580e4d){return{'model':db[_0x580e4d[_0x0680('0x20')]],'as':_0x580e4d['as'],'attributes':_0x580e4d[_0x0680('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0680('0x21')](function(_0x36b6ae){logger['info'](_0x0680('0x25'),_0x46504f);logger[_0x0680('0x11')](_0x0680('0x25'),_0x46504f,JSON['stringify'](_0x36b6ae));_0x305e55(_0x36b6ae);})[_0x0680('0x23')](function(_0x57c9f8){logger[_0x0680('0x15')](_0x0680('0x25'),_0x57c9f8[_0x0680('0x16')],_0x46504f);_0x3586db(_0x51d197['error'](0x1f4,_0x57c9f8[_0x0680('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index fe5d463..0506ba3 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 _0x5752=['length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x2b85b6,_0x7799fc){var _0x348223=function(_0xf87f29){while(--_0xf87f29){_0x2b85b6['push'](_0x2b85b6['shift']());}};_0x348223(++_0x7799fc);}(_0x5752,0x1ea));var _0x2575=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x5752[_0x21549c];return _0x426cbd;};'use strict';var WhatsappQueueEvents=require(_0x2575('0x0'));var events=[_0x2575('0x1'),'remove','update'];function createListener(_0x112bd7,_0x2408f1){return function(_0x1b7bc1){_0x2408f1['emit'](_0x112bd7,_0x1b7bc1);};}function removeListener(_0x45d56a,_0x16fbd5){return function(){WhatsappQueueEvents['removeListener'](_0x45d56a,_0x16fbd5);};}exports['register']=function(_0x27d8da){for(var _0x4ab163=0x0,_0x21442c=events[_0x2575('0x2')];_0x4ab163<_0x21442c;_0x4ab163++){var _0x13ddbb=events[_0x4ab163];var _0x44a644=createListener(_0x2575('0x3')+_0x13ddbb,_0x27d8da);WhatsappQueueEvents['on'](_0x13ddbb,_0x44a644);}}; \ No newline at end of file +var _0x0cbd=['save','remove','update','emit','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0cbd,0x1e7));var _0xd0cb=function(_0x47e9cb,_0x41e8b8){_0x47e9cb=_0x47e9cb-0x0;var _0x20b27e=_0x0cbd[_0x47e9cb];return _0x20b27e;};'use strict';var WhatsappQueueEvents=require(_0xd0cb('0x0'));var events=[_0xd0cb('0x1'),_0xd0cb('0x2'),_0xd0cb('0x3')];function createListener(_0x4f5417,_0x119eaa){return function(_0x49bcdf){_0x119eaa[_0xd0cb('0x4')](_0x4f5417,_0x49bcdf);};}function removeListener(_0x5d5c16,_0x1af25d){return function(){WhatsappQueueEvents['removeListener'](_0x5d5c16,_0x1af25d);};}exports[_0xd0cb('0x5')]=function(_0x4d1cb3){for(var _0x5940d5=0x0,_0x27e76a=events[_0xd0cb('0x6')];_0x5940d5<_0x27e76a;_0x5940d5++){var _0xe3860d=events[_0x5940d5];var _0x462886=createListener(_0xd0cb('0x7')+_0xe3860d,_0x4d1cb3);WhatsappQueueEvents['on'](_0xe3860d,_0x462886);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 9e3ae51..a9b15ad 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 _0x7d53=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','/:id','update','destroy','exports'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x7d53,0x11d));var _0x37d5=function(_0x17ca73,_0x57a929){_0x17ca73=_0x17ca73-0x0;var _0x1381be=_0x7d53[_0x17ca73];return _0x1381be;};'use strict';var multer=require('multer');var util=require(_0x37d5('0x0'));var path=require('path');var timeout=require(_0x37d5('0x1'));var express=require('express');var router=express[_0x37d5('0x2')]();var fs_extra=require(_0x37d5('0x3'));var auth=require(_0x37d5('0x4'));var interaction=require(_0x37d5('0x5'));var config=require('../../config/environment');var controller=require(_0x37d5('0x6'));router[_0x37d5('0x7')]('/',auth[_0x37d5('0x8')](),controller[_0x37d5('0x9')]);router[_0x37d5('0x7')](_0x37d5('0xa'),auth['isAuthenticated'](),controller[_0x37d5('0xb')]);router[_0x37d5('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x37d5('0xc')]);router[_0x37d5('0xd')]('/',auth[_0x37d5('0x8')](),controller[_0x37d5('0xe')]);router['put'](_0x37d5('0xf'),auth['isAuthenticated'](),controller[_0x37d5('0x10')]);router['delete'](_0x37d5('0xf'),auth[_0x37d5('0x8')](),controller[_0x37d5('0x11')]);module[_0x37d5('0x12')]=router; \ No newline at end of file +var _0x1009=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create'];(function(_0x373ba3,_0x265ccc){var _0x151f21=function(_0x35f419){while(--_0x35f419){_0x373ba3['push'](_0x373ba3['shift']());}};_0x151f21(++_0x265ccc);}(_0x1009,0xb4));var _0x9100=function(_0x5cec82,_0xa5bba5){_0x5cec82=_0x5cec82-0x0;var _0x51779d=_0x1009[_0x5cec82];return _0x51779d;};'use strict';var multer=require(_0x9100('0x0'));var util=require(_0x9100('0x1'));var path=require(_0x9100('0x2'));var timeout=require(_0x9100('0x3'));var express=require(_0x9100('0x4'));var router=express['Router']();var fs_extra=require(_0x9100('0x5'));var auth=require(_0x9100('0x6'));var interaction=require(_0x9100('0x7'));var config=require(_0x9100('0x8'));var controller=require(_0x9100('0x9'));router['get']('/',auth[_0x9100('0xa')](),controller['index']);router[_0x9100('0xb')](_0x9100('0xc'),auth[_0x9100('0xa')](),controller[_0x9100('0xd')]);router['get'](_0x9100('0xe'),auth['isAuthenticated'](),controller[_0x9100('0xf')]);router[_0x9100('0x10')]('/',auth[_0x9100('0xa')](),controller[_0x9100('0x11')]);router[_0x9100('0x12')](_0x9100('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x9100('0x13')](_0x9100('0xe'),auth[_0x9100('0xa')](),controller[_0x9100('0x14')]);module[_0x9100('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0c09951..ce51147 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x3d8eae,_0xa39bb4){var _0x1e0882=function(_0x445e0f){while(--_0x445e0f){_0x3d8eae['push'](_0x3d8eae['shift']());}};_0x1e0882(++_0xa39bb4);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x4a898f,_0x215b00){var _0x415d7f=function(_0x45b145){while(--_0x45b145){_0x4a898f['push'](_0x4a898f['shift']());}};_0x415d7f(++_0x215b00);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index ded381f..498d4d5 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 _0x3de3=['eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','end','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','keys','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','destroy','describe'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x3de3,0x1ce));var _0x33de=function(_0x36ca5e,_0x3d47f6){_0x36ca5e=_0x36ca5e-0x0;var _0x2bf9fc=_0x3de3[_0x36ca5e];return _0x2bf9fc;};'use strict';var emlformat=require(_0x33de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x33de('0x1'));var jsonpatch=require(_0x33de('0x2'));var rp=require('request-promise');var moment=require(_0x33de('0x3'));var BPromise=require(_0x33de('0x4'));var Mustache=require(_0x33de('0x5'));var util=require(_0x33de('0x6'));var path=require('path');var sox=require(_0x33de('0x7'));var csv=require(_0x33de('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x33de('0x9'));var _=require('lodash');var squel=require(_0x33de('0xa'));var crypto=require(_0x33de('0xb'));var jsforce=require(_0x33de('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x33de('0x8'));var querystring=require(_0x33de('0xd'));var Papa=require(_0x33de('0xe'));var Redis=require('ioredis');var authService=require(_0x33de('0xf'));var qs=require(_0x33de('0x10'));var as=require(_0x33de('0x11'));var hardwareService=require(_0x33de('0x12'));var logger=require(_0x33de('0x13'))(_0x33de('0x14'));var utils=require(_0x33de('0x15'));var config=require(_0x33de('0x16'));var licenseUtil=require(_0x33de('0x17'));var db=require(_0x33de('0x18'))['db'];function respondWithStatusCode(_0x27d1d8,_0x5170ad){_0x5170ad=_0x5170ad||0xcc;return function(_0x6b1a4c){if(_0x6b1a4c){return _0x27d1d8[_0x33de('0x19')](_0x5170ad);}return _0x27d1d8['status'](_0x5170ad)['end']();};}function respondWithResult(_0x4164ab,_0x22bda8){_0x22bda8=_0x22bda8||0xc8;return function(_0x2b3748){if(_0x2b3748){return _0x4164ab[_0x33de('0x1a')](_0x22bda8)['json'](_0x2b3748);}};}function respondWithFilteredResult(_0x11e6b5,_0x1b1166){return function(_0x522ba0){if(_0x522ba0){var _0x4ff69f=typeof _0x1b1166[_0x33de('0x1b')]===_0x33de('0x1c')&&typeof _0x1b1166[_0x33de('0x1d')]==='undefined';var _0x2db887=_0x522ba0[_0x33de('0x1e')];var _0x52cfa0=_0x4ff69f?0x0:_0x1b1166[_0x33de('0x1b')];var _0x201ff3=_0x4ff69f?_0x522ba0['count']:_0x1b1166['offset']+_0x1b1166[_0x33de('0x1d')];var _0x52d718;if(_0x201ff3>=_0x2db887){_0x201ff3=_0x2db887;_0x52d718=0xc8;}else{_0x52d718=0xce;}_0x11e6b5[_0x33de('0x1a')](_0x52d718);return _0x11e6b5[_0x33de('0x1f')](_0x33de('0x20'),_0x52cfa0+'-'+_0x201ff3+'/'+_0x2db887)[_0x33de('0x21')](_0x522ba0);}return null;};}function patchUpdates(_0xc4f1a4){return function(_0x40a8e6){try{jsonpatch[_0x33de('0x22')](_0x40a8e6,_0xc4f1a4,!![]);}catch(_0x493263){return BPromise['reject'](_0x493263);}return _0x40a8e6[_0x33de('0x23')]();};}function saveUpdates(_0x5af3fa,_0x8acd8d){return function(_0x4cd8db){if(_0x4cd8db){return _0x4cd8db[_0x33de('0x24')](_0x5af3fa)[_0x33de('0x25')](function(_0x575e88){return _0x575e88;});}return null;};}function removeEntity(_0x2dbcf2,_0x5cd77e){return function(_0x67d040){if(_0x67d040){return _0x67d040['destroy']()[_0x33de('0x25')](function(){_0x2dbcf2[_0x33de('0x1a')](0xcc)[_0x33de('0x26')]();});}};}function handleEntityNotFound(_0x5b79d7,_0x3bdba4){return function(_0x2d206b){if(!_0x2d206b){_0x5b79d7[_0x33de('0x19')](0x194);}return _0x2d206b;};}function handleError(_0x5cd31e,_0x34fba3){_0x34fba3=_0x34fba3||0x1f4;return function(_0x5585a2){logger['error'](_0x5585a2[_0x33de('0x27')]);if(_0x5585a2[_0x33de('0x28')]){delete _0x5585a2[_0x33de('0x28')];}_0x5cd31e[_0x33de('0x1a')](_0x34fba3)[_0x33de('0x29')](_0x5585a2);};}exports[_0x33de('0x2a')]=function(_0x3f22fb,_0x1b4703){var _0x59bc3b={},_0x5ae0e8={},_0x2755e6={'count':0x0,'rows':[]};var _0x1420d2=_[_0x33de('0x2b')](db[_0x33de('0x2c')][_0x33de('0x2d')],function(_0x20f393){return{'name':_0x20f393[_0x33de('0x2e')],'type':_0x20f393['type'][_0x33de('0x2f')]};});_0x5ae0e8[_0x33de('0x30')]=_[_0x33de('0x2b')](_0x1420d2,_0x33de('0x28'));_0x5ae0e8['query']=_[_0x33de('0x31')](_0x3f22fb[_0x33de('0x32')]);_0x5ae0e8['filters']=_['intersection'](_0x5ae0e8['model'],_0x5ae0e8[_0x33de('0x32')]);_0x59bc3b[_0x33de('0x33')]=_['intersection'](_0x5ae0e8[_0x33de('0x30')],qs['fields'](_0x3f22fb['query'][_0x33de('0x34')]));_0x59bc3b[_0x33de('0x33')]=_0x59bc3b[_0x33de('0x33')][_0x33de('0x35')]?_0x59bc3b[_0x33de('0x33')]:_0x5ae0e8[_0x33de('0x30')];if(!_0x3f22fb[_0x33de('0x32')][_0x33de('0x36')]('nolimit')){_0x59bc3b[_0x33de('0x1d')]=qs['limit'](_0x3f22fb[_0x33de('0x32')]['limit']);_0x59bc3b['offset']=qs[_0x33de('0x1b')](_0x3f22fb[_0x33de('0x32')][_0x33de('0x1b')]);}_0x59bc3b[_0x33de('0x37')]=qs[_0x33de('0x38')](_0x3f22fb[_0x33de('0x32')]['sort']);_0x59bc3b[_0x33de('0x39')]=qs[_0x33de('0x3a')](_[_0x33de('0x3b')](_0x3f22fb[_0x33de('0x32')],_0x5ae0e8[_0x33de('0x3a')]),_0x1420d2);if(_0x3f22fb[_0x33de('0x32')][_0x33de('0x3c')]){_0x59bc3b['where']=_[_0x33de('0x3d')](_0x59bc3b[_0x33de('0x39')],{'$or':_[_0x33de('0x2b')](_0x1420d2,function(_0x3e11eb){if(_0x3e11eb[_0x33de('0x3e')]!==_0x33de('0x3f')){var _0x1126b6={};_0x1126b6[_0x3e11eb['name']]={'$like':'%'+_0x3f22fb[_0x33de('0x32')][_0x33de('0x3c')]+'%'};return _0x1126b6;}})});}_0x59bc3b=_[_0x33de('0x3d')]({},_0x59bc3b,_0x3f22fb[_0x33de('0x40')]);var _0x23c2c4={'where':_0x59bc3b[_0x33de('0x39')]};return db['WhatsappQueueReport'][_0x33de('0x1e')](_0x23c2c4)['then'](function(_0x13dedd){_0x2755e6[_0x33de('0x1e')]=_0x13dedd;if(_0x3f22fb['query'][_0x33de('0x41')]){_0x59bc3b[_0x33de('0x42')]=[{'all':!![]}];}return db[_0x33de('0x2c')][_0x33de('0x43')](_0x59bc3b);})[_0x33de('0x25')](function(_0x4251e3){_0x2755e6[_0x33de('0x44')]=_0x4251e3;return _0x2755e6;})[_0x33de('0x25')](respondWithFilteredResult(_0x1b4703,_0x59bc3b))[_0x33de('0x45')](handleError(_0x1b4703,null));};exports['show']=function(_0x5101b9,_0x417d9b){var _0x1f75f7={'raw':!![],'where':{'id':_0x5101b9[_0x33de('0x46')]['id']}},_0x20d04f={};_0x20d04f['model']=_[_0x33de('0x31')](db['WhatsappQueueReport']['rawAttributes']);_0x20d04f[_0x33de('0x32')]=_[_0x33de('0x31')](_0x5101b9[_0x33de('0x32')]);_0x20d04f[_0x33de('0x3a')]=_[_0x33de('0x47')](_0x20d04f[_0x33de('0x30')],_0x20d04f[_0x33de('0x32')]);_0x1f75f7['attributes']=_[_0x33de('0x47')](_0x20d04f['model'],qs[_0x33de('0x34')](_0x5101b9['query'][_0x33de('0x34')]));_0x1f75f7[_0x33de('0x33')]=_0x1f75f7['attributes'][_0x33de('0x35')]?_0x1f75f7[_0x33de('0x33')]:_0x20d04f[_0x33de('0x30')];if(_0x5101b9['query']['includeAll']){_0x1f75f7[_0x33de('0x42')]=[{'all':!![]}];}_0x1f75f7=_[_0x33de('0x3d')]({},_0x1f75f7,_0x5101b9['options']);return db['WhatsappQueueReport'][_0x33de('0x48')](_0x1f75f7)['then'](handleEntityNotFound(_0x417d9b,null))['then'](respondWithResult(_0x417d9b,null))['catch'](handleError(_0x417d9b,null));};exports[_0x33de('0x49')]=function(_0x2d6001,_0x9a816c){return db[_0x33de('0x2c')]['create'](_0x2d6001['body'],{})[_0x33de('0x25')](respondWithResult(_0x9a816c,0xc9))[_0x33de('0x45')](handleError(_0x9a816c,null));};exports['update']=function(_0x1d016b,_0xc23633){if(_0x1d016b[_0x33de('0x4a')]['id']){delete _0x1d016b[_0x33de('0x4a')]['id'];}return db[_0x33de('0x2c')]['find']({'where':{'id':_0x1d016b[_0x33de('0x46')]['id']}})[_0x33de('0x25')](handleEntityNotFound(_0xc23633,null))['then'](saveUpdates(_0x1d016b[_0x33de('0x4a')],null))[_0x33de('0x25')](respondWithResult(_0xc23633,null))[_0x33de('0x45')](handleError(_0xc23633,null));};exports[_0x33de('0x4b')]=function(_0xbbb376,_0x40f1b7){return db[_0x33de('0x2c')][_0x33de('0x48')]({'where':{'id':_0xbbb376[_0x33de('0x46')]['id']}})[_0x33de('0x25')](handleEntityNotFound(_0x40f1b7,null))['then'](removeEntity(_0x40f1b7,null))[_0x33de('0x45')](handleError(_0x40f1b7,null));};exports[_0x33de('0x4c')]=function(_0x2e2cd7,_0x464502){return db[_0x33de('0x2c')][_0x33de('0x4c')]()[_0x33de('0x25')](respondWithResult(_0x464502,null))['catch'](handleError(_0x464502,null));}; \ No newline at end of file +var _0xb58b=['save','update','destroy','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject'];(function(_0x5259a9,_0x59547a){var _0x334dc3=function(_0x192d7b){while(--_0x192d7b){_0x5259a9['push'](_0x5259a9['shift']());}};_0x334dc3(++_0x59547a);}(_0xb58b,0x1f1));var _0xbb58=function(_0x594dc0,_0x4b79e4){_0x594dc0=_0x594dc0-0x0;var _0x2ae09f=_0xb58b[_0x594dc0];return _0x2ae09f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe88799,_0x18810f){_0x18810f=_0x18810f||0xcc;return function(_0x4cda21){if(_0x4cda21){return _0xe88799[_0xbb58('0x18')](_0x18810f);}return _0xe88799[_0xbb58('0x19')](_0x18810f)[_0xbb58('0x1a')]();};}function respondWithResult(_0x3b9406,_0x19ceda){_0x19ceda=_0x19ceda||0xc8;return function(_0x58245f){if(_0x58245f){return _0x3b9406[_0xbb58('0x19')](_0x19ceda)[_0xbb58('0x1b')](_0x58245f);}};}function respondWithFilteredResult(_0x5f4751,_0x4ba30e){return function(_0x33c20f){if(_0x33c20f){var _0x445b1f=typeof _0x4ba30e[_0xbb58('0x1c')]==='undefined'&&typeof _0x4ba30e['limit']==='undefined';var _0x55156e=_0x33c20f[_0xbb58('0x1d')];var _0x3134ea=_0x445b1f?0x0:_0x4ba30e['offset'];var _0xbee66=_0x445b1f?_0x33c20f['count']:_0x4ba30e[_0xbb58('0x1c')]+_0x4ba30e[_0xbb58('0x1e')];var _0x3c33d9;if(_0xbee66>=_0x55156e){_0xbee66=_0x55156e;_0x3c33d9=0xc8;}else{_0x3c33d9=0xce;}_0x5f4751[_0xbb58('0x19')](_0x3c33d9);return _0x5f4751[_0xbb58('0x1f')](_0xbb58('0x20'),_0x3134ea+'-'+_0xbee66+'/'+_0x55156e)[_0xbb58('0x1b')](_0x33c20f);}return null;};}function patchUpdates(_0x497fd0){return function(_0x84f34){try{jsonpatch[_0xbb58('0x21')](_0x84f34,_0x497fd0,!![]);}catch(_0x3e64fe){return BPromise[_0xbb58('0x22')](_0x3e64fe);}return _0x84f34[_0xbb58('0x23')]();};}function saveUpdates(_0x5d4a91,_0x49453a){return function(_0x350be7){if(_0x350be7){return _0x350be7[_0xbb58('0x24')](_0x5d4a91)['then'](function(_0x27806d){return _0x27806d;});}return null;};}function removeEntity(_0x53b693,_0x21964d){return function(_0x287822){if(_0x287822){return _0x287822[_0xbb58('0x25')]()[_0xbb58('0x26')](function(){_0x53b693[_0xbb58('0x19')](0xcc)[_0xbb58('0x1a')]();});}};}function handleEntityNotFound(_0x2d556a,_0x15e4c5){return function(_0x4e0303){if(!_0x4e0303){_0x2d556a[_0xbb58('0x18')](0x194);}return _0x4e0303;};}function handleError(_0x3bd550,_0x1be0ae){_0x1be0ae=_0x1be0ae||0x1f4;return function(_0x129094){logger[_0xbb58('0x27')](_0x129094[_0xbb58('0x28')]);if(_0x129094[_0xbb58('0x29')]){delete _0x129094[_0xbb58('0x29')];}_0x3bd550[_0xbb58('0x19')](_0x1be0ae)[_0xbb58('0x2a')](_0x129094);};}exports[_0xbb58('0x2b')]=function(_0x28b3a3,_0x2a0481){var _0x4157c4={},_0x3559b6={},_0x573cca={'count':0x0,'rows':[]};var _0x2b0f73=_[_0xbb58('0x2c')](db[_0xbb58('0x2d')][_0xbb58('0x2e')],function(_0x3304b9){return{'name':_0x3304b9[_0xbb58('0x2f')],'type':_0x3304b9[_0xbb58('0x30')][_0xbb58('0x31')]};});_0x3559b6[_0xbb58('0x32')]=_['map'](_0x2b0f73,_0xbb58('0x29'));_0x3559b6[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x28b3a3[_0xbb58('0x33')]);_0x3559b6[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3559b6[_0xbb58('0x32')],_0x3559b6[_0xbb58('0x33')]);_0x4157c4[_0xbb58('0x37')]=_[_0xbb58('0x36')](_0x3559b6[_0xbb58('0x32')],qs[_0xbb58('0x38')](_0x28b3a3[_0xbb58('0x33')]['fields']));_0x4157c4['attributes']=_0x4157c4['attributes'][_0xbb58('0x39')]?_0x4157c4[_0xbb58('0x37')]:_0x3559b6[_0xbb58('0x32')];if(!_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3a')](_0xbb58('0x3b'))){_0x4157c4[_0xbb58('0x1e')]=qs[_0xbb58('0x1e')](_0x28b3a3['query'][_0xbb58('0x1e')]);_0x4157c4[_0xbb58('0x1c')]=qs['offset'](_0x28b3a3[_0xbb58('0x33')]['offset']);}_0x4157c4[_0xbb58('0x3c')]=qs['sort'](_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3d')]);_0x4157c4['where']=qs[_0xbb58('0x35')](_[_0xbb58('0x3e')](_0x28b3a3[_0xbb58('0x33')],_0x3559b6[_0xbb58('0x35')]),_0x2b0f73);if(_0x28b3a3[_0xbb58('0x33')][_0xbb58('0x3f')]){_0x4157c4[_0xbb58('0x40')]=_[_0xbb58('0x41')](_0x4157c4['where'],{'$or':_[_0xbb58('0x2c')](_0x2b0f73,function(_0x31aa4b){if(_0x31aa4b[_0xbb58('0x30')]!=='VIRTUAL'){var _0x4dbd5e={};_0x4dbd5e[_0x31aa4b[_0xbb58('0x29')]]={'$like':'%'+_0x28b3a3['query'][_0xbb58('0x3f')]+'%'};return _0x4dbd5e;}})});}_0x4157c4=_[_0xbb58('0x41')]({},_0x4157c4,_0x28b3a3[_0xbb58('0x42')]);var _0x560911={'where':_0x4157c4['where']};return db[_0xbb58('0x2d')][_0xbb58('0x1d')](_0x560911)[_0xbb58('0x26')](function(_0x24d82d){_0x573cca[_0xbb58('0x1d')]=_0x24d82d;if(_0x28b3a3[_0xbb58('0x33')]['includeAll']){_0x4157c4[_0xbb58('0x43')]=[{'all':!![]}];}return db[_0xbb58('0x2d')][_0xbb58('0x44')](_0x4157c4);})[_0xbb58('0x26')](function(_0x1185b3){_0x573cca[_0xbb58('0x45')]=_0x1185b3;return _0x573cca;})['then'](respondWithFilteredResult(_0x2a0481,_0x4157c4))[_0xbb58('0x46')](handleError(_0x2a0481,null));};exports['show']=function(_0x22f1c3,_0x285ad4){var _0x29fb1c={'raw':!![],'where':{'id':_0x22f1c3['params']['id']}},_0x45817f={};_0x45817f[_0xbb58('0x32')]=_[_0xbb58('0x34')](db[_0xbb58('0x2d')][_0xbb58('0x2e')]);_0x45817f['query']=_[_0xbb58('0x34')](_0x22f1c3['query']);_0x45817f[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x45817f[_0xbb58('0x32')],_0x45817f[_0xbb58('0x33')]);_0x29fb1c[_0xbb58('0x37')]=_[_0xbb58('0x36')](_0x45817f[_0xbb58('0x32')],qs[_0xbb58('0x38')](_0x22f1c3[_0xbb58('0x33')][_0xbb58('0x38')]));_0x29fb1c[_0xbb58('0x37')]=_0x29fb1c[_0xbb58('0x37')][_0xbb58('0x39')]?_0x29fb1c['attributes']:_0x45817f[_0xbb58('0x32')];if(_0x22f1c3['query']['includeAll']){_0x29fb1c[_0xbb58('0x43')]=[{'all':!![]}];}_0x29fb1c=_[_0xbb58('0x41')]({},_0x29fb1c,_0x22f1c3[_0xbb58('0x42')]);return db[_0xbb58('0x2d')][_0xbb58('0x47')](_0x29fb1c)[_0xbb58('0x26')](handleEntityNotFound(_0x285ad4,null))[_0xbb58('0x26')](respondWithResult(_0x285ad4,null))[_0xbb58('0x46')](handleError(_0x285ad4,null));};exports[_0xbb58('0x48')]=function(_0x39995e,_0x440fb3){return db['WhatsappQueueReport'][_0xbb58('0x48')](_0x39995e[_0xbb58('0x49')],{})['then'](respondWithResult(_0x440fb3,0xc9))[_0xbb58('0x46')](handleError(_0x440fb3,null));};exports[_0xbb58('0x24')]=function(_0xf94897,_0xdb0ff7){if(_0xf94897['body']['id']){delete _0xf94897[_0xbb58('0x49')]['id'];}return db['WhatsappQueueReport'][_0xbb58('0x47')]({'where':{'id':_0xf94897[_0xbb58('0x4a')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0xdb0ff7,null))['then'](saveUpdates(_0xf94897[_0xbb58('0x49')],null))[_0xbb58('0x26')](respondWithResult(_0xdb0ff7,null))['catch'](handleError(_0xdb0ff7,null));};exports[_0xbb58('0x25')]=function(_0x4ca201,_0x28301d){return db[_0xbb58('0x2d')][_0xbb58('0x47')]({'where':{'id':_0x4ca201[_0xbb58('0x4a')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x28301d,null))[_0xbb58('0x26')](removeEntity(_0x28301d,null))[_0xbb58('0x46')](handleError(_0x28301d,null));};exports['describe']=function(_0x449088,_0x1fd892){return db['WhatsappQueueReport'][_0xbb58('0x4b')]()[_0xbb58('0x26')](respondWithResult(_0x1fd892,null))['catch'](handleError(_0x1fd892,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 037b1e1..605d2bc 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 _0x8055=['rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x315861,_0x735b4){var _0x3e2b76=function(_0x436457){while(--_0x436457){_0x315861['push'](_0x315861['shift']());}};_0x3e2b76(++_0x735b4);}(_0x8055,0xda));var _0x5805=function(_0x5f1fed,_0x212dca){_0x5f1fed=_0x5f1fed-0x0;var _0x3f49c7=_0x8055[_0x5f1fed];return _0x3f49c7;};'use strict';var _=require(_0x5805('0x0'));var util=require(_0x5805('0x1'));var logger=require(_0x5805('0x2'))(_0x5805('0x3'));var moment=require(_0x5805('0x4'));var BPromise=require('bluebird');var rp=require(_0x5805('0x5'));var fs=require('fs');var path=require(_0x5805('0x6'));var rimraf=require(_0x5805('0x7'));var config=require(_0x5805('0x8'));var attributes=require(_0x5805('0x9'));module[_0x5805('0xa')]=function(_0x5ed014,_0x348c1f){return _0x5ed014[_0x5805('0xb')](_0x5805('0xc'),attributes,{'tableName':_0x5805('0xd'),'paranoid':![],'indexes':[{'name':_0x5805('0xe'),'fields':[_0x5805('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd3dc=['lodash','util','../../config/logger','bluebird','path','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x25ca44,_0x111633){var _0x4897c1=function(_0xf344b9){while(--_0xf344b9){_0x25ca44['push'](_0x25ca44['shift']());}};_0x4897c1(++_0x111633);}(_0xd3dc,0xdc));var _0xcd3d=function(_0x7e5bc0,_0x52dacc){_0x7e5bc0=_0x7e5bc0-0x0;var _0x440f5d=_0xd3dc[_0x7e5bc0];return _0x440f5d;};'use strict';var _=require(_0xcd3d('0x0'));var util=require(_0xcd3d('0x1'));var logger=require(_0xcd3d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcd3d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcd3d('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0xcd3d('0x5')]=function(_0x2f9da8,_0x5ae894){return _0x2f9da8[_0xcd3d('0x6')](_0xcd3d('0x7'),attributes,{'tableName':_0xcd3d('0x8'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xcd3d('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index f95a2f5..416ced4 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 _0x2ab7=['WhatsappQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappQueueReport','create','options','raw','UpdateWhatsappQueueReport','update','where','attributes','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','request\x20sent','debug','stringify','error','code'];(function(_0x302984,_0x3db64d){var _0x58a598=function(_0x4b196d){while(--_0x4b196d){_0x302984['push'](_0x302984['shift']());}};_0x58a598(++_0x3db64d);}(_0x2ab7,0x187));var _0x72ab=function(_0x4f8a2a,_0x38c0e2){_0x4f8a2a=_0x4f8a2a-0x0;var _0x384c7d=_0x2ab7[_0x4f8a2a];return _0x384c7d;};'use strict';var _=require('lodash');var util=require(_0x72ab('0x0'));var moment=require('moment');var BPromise=require(_0x72ab('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x72ab('0x2'));var db=require(_0x72ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x72ab('0x4'));var config=require(_0x72ab('0x5'));var jayson=require(_0x72ab('0x6'));var client=jayson['client'][_0x72ab('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x393529,_0x397f3e,_0x49586e){return new BPromise(function(_0x4d342d,_0x1eacd7){return client['request'](_0x393529,_0x49586e)[_0x72ab('0x8')](function(_0x9804a){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x397f3e,_0x72ab('0x9'));logger[_0x72ab('0xa')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x397f3e,'request\x20sent',JSON[_0x72ab('0xb')](_0x9804a));if(_0x9804a[_0x72ab('0xc')]){if(_0x9804a[_0x72ab('0xc')][_0x72ab('0xd')]===0x1f4){logger['error'](_0x72ab('0xe'),_0x397f3e,_0x9804a[_0x72ab('0xc')][_0x72ab('0xf')]);return _0x1eacd7(_0x9804a[_0x72ab('0xc')]['message']);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x397f3e,_0x9804a['error'][_0x72ab('0xf')]);return _0x4d342d(_0x9804a['error'][_0x72ab('0xf')]);}else{logger[_0x72ab('0x10')](_0x72ab('0xe'),_0x397f3e,'request\x20sent');_0x4d342d(_0x9804a[_0x72ab('0x11')]['message']);}})[_0x72ab('0x12')](function(_0x13c7f7){logger[_0x72ab('0xc')](_0x72ab('0xe'),_0x397f3e,_0x13c7f7);_0x1eacd7(_0x13c7f7);});});}exports[_0x72ab('0x13')]=function(_0x13e408){var _0x3b5f80=this;return new Promise(function(_0x4b03f1,_0xc3e283){return db['WhatsappQueueReport'][_0x72ab('0x14')](_0x13e408['body'],{'raw':_0x13e408['options']?_0x13e408[_0x72ab('0x15')][_0x72ab('0x16')]===undefined?!![]:![]:!![]})[_0x72ab('0x8')](function(_0x596a9d){logger[_0x72ab('0x10')](_0x72ab('0x13'),_0x13e408);logger[_0x72ab('0xa')](_0x72ab('0x13'),_0x13e408,JSON[_0x72ab('0xb')](_0x596a9d));_0x4b03f1(_0x596a9d);})['catch'](function(_0x716820){logger[_0x72ab('0xc')]('CreateWhatsappQueueReport',_0x716820[_0x72ab('0xf')],_0x13e408);_0xc3e283(_0x3b5f80['error'](0x1f4,_0x716820[_0x72ab('0xf')]));});});};exports[_0x72ab('0x17')]=function(_0xd2e5e3){var _0x130d20=this;return new Promise(function(_0x5ca5de,_0x22c540){return db['WhatsappQueueReport'][_0x72ab('0x18')](_0xd2e5e3['body'],{'raw':_0xd2e5e3[_0x72ab('0x15')]?_0xd2e5e3[_0x72ab('0x15')][_0x72ab('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd2e5e3['options']?_0xd2e5e3[_0x72ab('0x15')][_0x72ab('0x19')]||null:null,'attributes':_0xd2e5e3[_0x72ab('0x15')]?_0xd2e5e3[_0x72ab('0x15')][_0x72ab('0x1a')]||null:null,'limit':_0xd2e5e3[_0x72ab('0x15')]?_0xd2e5e3['options']['limit']||null:null})['then'](function(_0x5390fb){logger[_0x72ab('0x10')]('UpdateWhatsappQueueReport',_0xd2e5e3);logger[_0x72ab('0xa')](_0x72ab('0x17'),_0xd2e5e3,JSON[_0x72ab('0xb')](_0x5390fb));_0x5ca5de(_0x5390fb);})[_0x72ab('0x12')](function(_0xe04ef5){logger['error'](_0x72ab('0x17'),_0xe04ef5[_0x72ab('0xf')],_0xd2e5e3);_0x22c540(_0x130d20['error'](0x1f4,_0xe04ef5[_0x72ab('0xf')]));});});}; \ No newline at end of file +var _0xce11=['http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','WhatsappQueueReport','create','body','options','raw','info','CreateWhatsappQueueReport','catch','UpdateWhatsappQueueReport','update','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x3335ba,_0x4c53d3){var _0x1abd6d=function(_0x1b6c9a){while(--_0x1b6c9a){_0x3335ba['push'](_0x3335ba['shift']());}};_0x1abd6d(++_0x4c53d3);}(_0xce11,0x79));var _0x1ce1=function(_0x7a495a,_0x7aee71){_0x7a495a=_0x7a495a-0x0;var _0x2c18d9=_0xce11[_0x7a495a];return _0x2c18d9;};'use strict';var _=require(_0x1ce1('0x0'));var util=require(_0x1ce1('0x1'));var moment=require(_0x1ce1('0x2'));var BPromise=require(_0x1ce1('0x3'));var rs=require(_0x1ce1('0x4'));var fs=require('fs');var Redis=require(_0x1ce1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ce1('0x6'));var logger=require(_0x1ce1('0x7'))('rpc');var config=require(_0x1ce1('0x8'));var jayson=require(_0x1ce1('0x9'));var client=jayson[_0x1ce1('0xa')][_0x1ce1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38d538,_0x32b3c2,_0x1ba96a){return new BPromise(function(_0x3b2769,_0x1155d4){return client[_0x1ce1('0xc')](_0x38d538,_0x1ba96a)[_0x1ce1('0xd')](function(_0x45dcca){logger['info'](_0x1ce1('0xe'),_0x32b3c2,_0x1ce1('0xf'));logger[_0x1ce1('0x10')](_0x1ce1('0x11'),_0x32b3c2,_0x1ce1('0xf'),JSON[_0x1ce1('0x12')](_0x45dcca));if(_0x45dcca['error']){if(_0x45dcca['error']['code']===0x1f4){logger[_0x1ce1('0x13')](_0x1ce1('0xe'),_0x32b3c2,_0x45dcca['error'][_0x1ce1('0x14')]);return _0x1155d4(_0x45dcca[_0x1ce1('0x13')][_0x1ce1('0x14')]);}logger['error'](_0x1ce1('0xe'),_0x32b3c2,_0x45dcca['error'][_0x1ce1('0x14')]);return _0x3b2769(_0x45dcca['error'][_0x1ce1('0x14')]);}else{logger['info'](_0x1ce1('0xe'),_0x32b3c2,_0x1ce1('0xf'));_0x3b2769(_0x45dcca[_0x1ce1('0x15')]['message']);}})['catch'](function(_0x2307cb){logger[_0x1ce1('0x13')](_0x1ce1('0xe'),_0x32b3c2,_0x2307cb);_0x1155d4(_0x2307cb);});});}exports['CreateWhatsappQueueReport']=function(_0x1e89ba){var _0x5b135a=this;return new Promise(function(_0x3ba2b9,_0x5c8673){return db[_0x1ce1('0x16')][_0x1ce1('0x17')](_0x1e89ba[_0x1ce1('0x18')],{'raw':_0x1e89ba[_0x1ce1('0x19')]?_0x1e89ba[_0x1ce1('0x19')][_0x1ce1('0x1a')]===undefined?!![]:![]:!![]})[_0x1ce1('0xd')](function(_0x4a6c75){logger[_0x1ce1('0x1b')](_0x1ce1('0x1c'),_0x1e89ba);logger[_0x1ce1('0x10')](_0x1ce1('0x1c'),_0x1e89ba,JSON[_0x1ce1('0x12')](_0x4a6c75));_0x3ba2b9(_0x4a6c75);})[_0x1ce1('0x1d')](function(_0x48d70b){logger[_0x1ce1('0x13')](_0x1ce1('0x1c'),_0x48d70b[_0x1ce1('0x14')],_0x1e89ba);_0x5c8673(_0x5b135a[_0x1ce1('0x13')](0x1f4,_0x48d70b[_0x1ce1('0x14')]));});});};exports[_0x1ce1('0x1e')]=function(_0x5aafc4){var _0x24300b=this;return new Promise(function(_0x5443bd,_0x1db72c){return db[_0x1ce1('0x16')][_0x1ce1('0x1f')](_0x5aafc4[_0x1ce1('0x18')],{'raw':_0x5aafc4['options']?_0x5aafc4[_0x1ce1('0x19')][_0x1ce1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aafc4[_0x1ce1('0x19')]?_0x5aafc4[_0x1ce1('0x19')]['where']||null:null,'attributes':_0x5aafc4['options']?_0x5aafc4[_0x1ce1('0x19')][_0x1ce1('0x20')]||null:null,'limit':_0x5aafc4['options']?_0x5aafc4[_0x1ce1('0x19')]['limit']||null:null})[_0x1ce1('0xd')](function(_0x2dc460){logger['info'](_0x1ce1('0x1e'),_0x5aafc4);logger[_0x1ce1('0x10')](_0x1ce1('0x1e'),_0x5aafc4,JSON['stringify'](_0x2dc460));_0x5443bd(_0x2dc460);})[_0x1ce1('0x1d')](function(_0x408fe1){logger['error'](_0x1ce1('0x1e'),_0x408fe1[_0x1ce1('0x14')],_0x5aafc4);_0x1db72c(_0x24300b[_0x1ce1('0x13')](0x1f4,_0x408fe1[_0x1ce1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index f9c7731..9660446 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 _0x9315=['put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','./whatsappTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create'];(function(_0x2f8db7,_0x5a7566){var _0x5c1d7e=function(_0x5910a6){while(--_0x5910a6){_0x2f8db7['push'](_0x2f8db7['shift']());}};_0x5c1d7e(++_0x5a7566);}(_0x9315,0xdb));var _0x5931=function(_0x9126d4,_0x5271d1){_0x9126d4=_0x9126d4-0x0;var _0x2ab6c0=_0x9315[_0x9126d4];return _0x2ab6c0;};'use strict';var multer=require('multer');var util=require(_0x5931('0x0'));var path=require(_0x5931('0x1'));var timeout=require(_0x5931('0x2'));var express=require(_0x5931('0x3'));var router=express[_0x5931('0x4')]();var fs_extra=require(_0x5931('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5931('0x6'));router['get']('/',auth[_0x5931('0x7')](),controller[_0x5931('0x8')]);router[_0x5931('0x9')](_0x5931('0xa'),auth[_0x5931('0x7')](),controller[_0x5931('0xb')]);router[_0x5931('0x9')](_0x5931('0xc'),auth[_0x5931('0x7')](),controller['show']);router[_0x5931('0xd')]('/',auth[_0x5931('0x7')](),controller[_0x5931('0xe')]);router[_0x5931('0xf')](_0x5931('0xc'),auth[_0x5931('0x7')](),controller[_0x5931('0x10')]);router['delete']('/:id',auth[_0x5931('0x7')](),controller[_0x5931('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd0f0=['../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1b4b23,_0x5dd6d6){var _0x2a325b=function(_0x175462){while(--_0x175462){_0x1b4b23['push'](_0x1b4b23['shift']());}};_0x2a325b(++_0x5dd6d6);}(_0xd0f0,0x67));var _0x0d0f=function(_0x2b6b89,_0x172ec0){_0x2b6b89=_0x2b6b89-0x0;var _0x5aa6af=_0xd0f0[_0x2b6b89];return _0x5aa6af;};'use strict';var multer=require('multer');var util=require(_0x0d0f('0x0'));var path=require(_0x0d0f('0x1'));var timeout=require('connect-timeout');var express=require(_0x0d0f('0x2'));var router=express[_0x0d0f('0x3')]();var fs_extra=require(_0x0d0f('0x4'));var auth=require(_0x0d0f('0x5'));var interaction=require(_0x0d0f('0x6'));var config=require(_0x0d0f('0x7'));var controller=require(_0x0d0f('0x8'));router[_0x0d0f('0x9')]('/',auth[_0x0d0f('0xa')](),controller[_0x0d0f('0xb')]);router[_0x0d0f('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x0d0f('0xc')]);router[_0x0d0f('0x9')](_0x0d0f('0xd'),auth[_0x0d0f('0xa')](),controller[_0x0d0f('0xe')]);router[_0x0d0f('0xf')]('/',auth[_0x0d0f('0xa')](),controller[_0x0d0f('0x10')]);router[_0x0d0f('0x11')](_0x0d0f('0xd'),auth[_0x0d0f('0xa')](),controller[_0x0d0f('0x12')]);router[_0x0d0f('0x13')](_0x0d0f('0xd'),auth[_0x0d0f('0xa')](),controller[_0x0d0f('0x14')]);module[_0x0d0f('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 93ee4cb..2690c76 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 _0x6146=['account','agent','queue','DATE','sequelize','STRING','ENUM'];(function(_0x2a7812,_0x1ce83a){var _0x3e1342=function(_0x3ff9fb){while(--_0x3ff9fb){_0x2a7812['push'](_0x2a7812['shift']());}};_0x3e1342(++_0x1ce83a);}(_0x6146,0xba));var _0x6614=function(_0x15cf6b,_0x29e79a){_0x15cf6b=_0x15cf6b-0x0;var _0x192d4c=_0x6146[_0x15cf6b];return _0x192d4c;};'use strict';var Sequelize=require(_0x6614('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x6614('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6614('0x2')](_0x6614('0x3'),_0x6614('0x4'),_0x6614('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6614('0x6')]}}; \ No newline at end of file +var _0x4e2e=['exports','STRING','ENUM','account','agent','queue'];(function(_0x472082,_0xb51e80){var _0x537121=function(_0x4f4d22){while(--_0x4f4d22){_0x472082['push'](_0x472082['shift']());}};_0x537121(++_0xb51e80);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0x470e72,_0x2b2375){_0x470e72=_0x470e72-0x0;var _0x3eae8f=_0x4e2e[_0x470e72];return _0x3eae8f;};'use strict';var Sequelize=require('sequelize');module[_0xe4e2('0x0')]={'uniqueid':{'type':Sequelize[_0xe4e2('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe4e2('0x2')](_0xe4e2('0x3'),_0xe4e2('0x4'),_0xe4e2('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index e462d4d..4e83d67 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 _0x974f=['findAll','rows','keys','merge','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','WhatsappTransferReport'];(function(_0x44a7e5,_0x5deef6){var _0x2c481c=function(_0x412dc0){while(--_0x412dc0){_0x44a7e5['push'](_0x44a7e5['shift']());}};_0x2c481c(++_0x5deef6);}(_0x974f,0x98));var _0xf974=function(_0x5858cf,_0x1645d1){_0x5858cf=_0x5858cf-0x0;var _0xecf2ac=_0x974f[_0x5858cf];return _0xecf2ac;};'use strict';var emlformat=require(_0xf974('0x0'));var rimraf=require(_0xf974('0x1'));var zipdir=require(_0xf974('0x2'));var jsonpatch=require(_0xf974('0x3'));var rp=require(_0xf974('0x4'));var moment=require(_0xf974('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf974('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf974('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf974('0x8'));var squel=require(_0xf974('0x9'));var crypto=require(_0xf974('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf974('0xb'));var toCsv=require(_0xf974('0xc'));var querystring=require(_0xf974('0xd'));var Papa=require('papaparse');var Redis=require(_0xf974('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf974('0xf'));var as=require(_0xf974('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf974('0x11'))(_0xf974('0x12'));var utils=require('../../config/utils');var config=require(_0xf974('0x13'));var licenseUtil=require(_0xf974('0x14'));var db=require(_0xf974('0x15'))['db'];function respondWithStatusCode(_0x194e3a,_0x355970){_0x355970=_0x355970||0xcc;return function(_0x2c1530){if(_0x2c1530){return _0x194e3a[_0xf974('0x16')](_0x355970);}return _0x194e3a[_0xf974('0x17')](_0x355970)[_0xf974('0x18')]();};}function respondWithResult(_0xb4f526,_0x2b223a){_0x2b223a=_0x2b223a||0xc8;return function(_0x44d531){if(_0x44d531){return _0xb4f526[_0xf974('0x17')](_0x2b223a)[_0xf974('0x19')](_0x44d531);}};}function respondWithFilteredResult(_0x5919db,_0x3a763d){return function(_0x45065c){if(_0x45065c){var _0x47db33=typeof _0x3a763d[_0xf974('0x1a')]===_0xf974('0x1b')&&typeof _0x3a763d[_0xf974('0x1c')]===_0xf974('0x1b');var _0x32c061=_0x45065c['count'];var _0x147aa2=_0x47db33?0x0:_0x3a763d[_0xf974('0x1a')];var _0x255e0f=_0x47db33?_0x45065c[_0xf974('0x1d')]:_0x3a763d[_0xf974('0x1a')]+_0x3a763d[_0xf974('0x1c')];var _0x44ee21;if(_0x255e0f>=_0x32c061){_0x255e0f=_0x32c061;_0x44ee21=0xc8;}else{_0x44ee21=0xce;}_0x5919db[_0xf974('0x17')](_0x44ee21);return _0x5919db[_0xf974('0x1e')](_0xf974('0x1f'),_0x147aa2+'-'+_0x255e0f+'/'+_0x32c061)['json'](_0x45065c);}return null;};}function patchUpdates(_0x19a14f){return function(_0x5a4eb9){try{jsonpatch['apply'](_0x5a4eb9,_0x19a14f,!![]);}catch(_0x565a80){return BPromise[_0xf974('0x20')](_0x565a80);}return _0x5a4eb9[_0xf974('0x21')]();};}function saveUpdates(_0x9a31d4,_0x3c666b){return function(_0x25db6d){if(_0x25db6d){return _0x25db6d[_0xf974('0x22')](_0x9a31d4)['then'](function(_0x23cfa0){return _0x23cfa0;});}return null;};}function removeEntity(_0x328a36,_0x558d6a){return function(_0x3464f0){if(_0x3464f0){return _0x3464f0[_0xf974('0x23')]()[_0xf974('0x24')](function(){_0x328a36[_0xf974('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47c35e,_0x36754){return function(_0x4ce3df){if(!_0x4ce3df){_0x47c35e[_0xf974('0x16')](0x194);}return _0x4ce3df;};}function handleError(_0x44bca6,_0x4ab06d){_0x4ab06d=_0x4ab06d||0x1f4;return function(_0x4321de){logger['error'](_0x4321de[_0xf974('0x25')]);if(_0x4321de[_0xf974('0x26')]){delete _0x4321de[_0xf974('0x26')];}_0x44bca6['status'](_0x4ab06d)['send'](_0x4321de);};}exports['index']=function(_0x24ae34,_0x11fb4c){var _0x3d0a3a={},_0x4aef26={},_0x5f1eb7={'count':0x0,'rows':[]};var _0x651aca=_[_0xf974('0x27')](db['WhatsappTransferReport'][_0xf974('0x28')],function(_0x547196){return{'name':_0x547196[_0xf974('0x29')],'type':_0x547196[_0xf974('0x2a')][_0xf974('0x2b')]};});_0x4aef26[_0xf974('0x2c')]=_[_0xf974('0x27')](_0x651aca,_0xf974('0x26'));_0x4aef26[_0xf974('0x2d')]=_['keys'](_0x24ae34['query']);_0x4aef26[_0xf974('0x2e')]=_[_0xf974('0x2f')](_0x4aef26['model'],_0x4aef26['query']);_0x3d0a3a[_0xf974('0x30')]=_[_0xf974('0x2f')](_0x4aef26[_0xf974('0x2c')],qs[_0xf974('0x31')](_0x24ae34['query']['fields']));_0x3d0a3a['attributes']=_0x3d0a3a[_0xf974('0x30')][_0xf974('0x32')]?_0x3d0a3a['attributes']:_0x4aef26[_0xf974('0x2c')];if(!_0x24ae34[_0xf974('0x2d')]['hasOwnProperty'](_0xf974('0x33'))){_0x3d0a3a[_0xf974('0x1c')]=qs[_0xf974('0x1c')](_0x24ae34[_0xf974('0x2d')][_0xf974('0x1c')]);_0x3d0a3a[_0xf974('0x1a')]=qs[_0xf974('0x1a')](_0x24ae34[_0xf974('0x2d')]['offset']);}_0x3d0a3a[_0xf974('0x34')]=qs[_0xf974('0x35')](_0x24ae34[_0xf974('0x2d')][_0xf974('0x35')]);_0x3d0a3a[_0xf974('0x36')]=qs[_0xf974('0x2e')](_[_0xf974('0x37')](_0x24ae34[_0xf974('0x2d')],_0x4aef26[_0xf974('0x2e')]),_0x651aca);if(_0x24ae34['query'][_0xf974('0x38')]){_0x3d0a3a[_0xf974('0x36')]=_['merge'](_0x3d0a3a[_0xf974('0x36')],{'$or':_['map'](_0x651aca,function(_0x1296d6){if(_0x1296d6[_0xf974('0x2a')]!==_0xf974('0x39')){var _0x134d2e={};_0x134d2e[_0x1296d6[_0xf974('0x26')]]={'$like':'%'+_0x24ae34['query'][_0xf974('0x38')]+'%'};return _0x134d2e;}})});}_0x3d0a3a=_['merge']({},_0x3d0a3a,_0x24ae34['options']);var _0x141280={'where':_0x3d0a3a['where']};return db['WhatsappTransferReport'][_0xf974('0x1d')](_0x141280)[_0xf974('0x24')](function(_0x329634){_0x5f1eb7[_0xf974('0x1d')]=_0x329634;if(_0x24ae34[_0xf974('0x2d')][_0xf974('0x3a')]){_0x3d0a3a[_0xf974('0x3b')]=[{'all':!![]}];}return db[_0xf974('0x3c')][_0xf974('0x3d')](_0x3d0a3a);})[_0xf974('0x24')](function(_0x398c1d){_0x5f1eb7[_0xf974('0x3e')]=_0x398c1d;return _0x5f1eb7;})['then'](respondWithFilteredResult(_0x11fb4c,_0x3d0a3a))['catch'](handleError(_0x11fb4c,null));};exports['show']=function(_0x29fe96,_0x4702fc){var _0x3298a5={'raw':!![],'where':{'id':_0x29fe96['params']['id']}},_0x45e2af={};_0x45e2af[_0xf974('0x2c')]=_[_0xf974('0x3f')](db[_0xf974('0x3c')][_0xf974('0x28')]);_0x45e2af[_0xf974('0x2d')]=_[_0xf974('0x3f')](_0x29fe96[_0xf974('0x2d')]);_0x45e2af[_0xf974('0x2e')]=_[_0xf974('0x2f')](_0x45e2af[_0xf974('0x2c')],_0x45e2af[_0xf974('0x2d')]);_0x3298a5[_0xf974('0x30')]=_[_0xf974('0x2f')](_0x45e2af[_0xf974('0x2c')],qs['fields'](_0x29fe96[_0xf974('0x2d')][_0xf974('0x31')]));_0x3298a5[_0xf974('0x30')]=_0x3298a5['attributes']['length']?_0x3298a5[_0xf974('0x30')]:_0x45e2af['model'];if(_0x29fe96[_0xf974('0x2d')]['includeAll']){_0x3298a5[_0xf974('0x3b')]=[{'all':!![]}];}_0x3298a5=_[_0xf974('0x40')]({},_0x3298a5,_0x29fe96['options']);return db[_0xf974('0x3c')][_0xf974('0x41')](_0x3298a5)[_0xf974('0x24')](handleEntityNotFound(_0x4702fc,null))[_0xf974('0x24')](respondWithResult(_0x4702fc,null))[_0xf974('0x42')](handleError(_0x4702fc,null));};exports[_0xf974('0x43')]=function(_0x56cb0c,_0xebbe32){return db[_0xf974('0x3c')][_0xf974('0x43')](_0x56cb0c[_0xf974('0x44')],{})[_0xf974('0x24')](respondWithResult(_0xebbe32,0xc9))[_0xf974('0x42')](handleError(_0xebbe32,null));};exports['update']=function(_0x7f69ae,_0x100e2d){if(_0x7f69ae[_0xf974('0x44')]['id']){delete _0x7f69ae[_0xf974('0x44')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x7f69ae[_0xf974('0x45')]['id']}})[_0xf974('0x24')](handleEntityNotFound(_0x100e2d,null))[_0xf974('0x24')](saveUpdates(_0x7f69ae[_0xf974('0x44')],null))['then'](respondWithResult(_0x100e2d,null))[_0xf974('0x42')](handleError(_0x100e2d,null));};exports[_0xf974('0x23')]=function(_0x5bd6b2,_0x514dc8){return db[_0xf974('0x3c')][_0xf974('0x41')]({'where':{'id':_0x5bd6b2[_0xf974('0x45')]['id']}})['then'](handleEntityNotFound(_0x514dc8,null))[_0xf974('0x24')](removeEntity(_0x514dc8,null))[_0xf974('0x42')](handleError(_0x514dc8,null));};exports[_0xf974('0x46')]=function(_0x11f369,_0x33158b){return db[_0xf974('0x3c')][_0xf974('0x46')]()['then'](respondWithResult(_0x33158b,null))[_0xf974('0x42')](handleError(_0x33158b,null));}; \ No newline at end of file +var _0x156c=['apply','reject','update','then','error','stack','name','send','index','map','WhatsappTransferReport','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','rawAttributes','length','includeAll','options','find','create','body','params','describe','zip-dir','moment','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/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x55c187,_0x2909fd){var _0x2ec7cf=function(_0x5bce7c){while(--_0x5bce7c){_0x55c187['push'](_0x55c187['shift']());}};_0x2ec7cf(++_0x2909fd);}(_0x156c,0x14d));var _0xc156=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0x156c[_0x3de7e0];return _0x11d0b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc156('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc156('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xc156('0x2'));var util=require(_0xc156('0x3'));var path=require(_0xc156('0x4'));var sox=require(_0xc156('0x5'));var csv=require(_0xc156('0x6'));var ejs=require(_0xc156('0x7'));var fs=require('fs');var fs_extra=require(_0xc156('0x8'));var _=require(_0xc156('0x9'));var squel=require('squel');var crypto=require(_0xc156('0xa'));var jsforce=require(_0xc156('0xb'));var deskjs=require(_0xc156('0xc'));var toCsv=require(_0xc156('0x6'));var querystring=require(_0xc156('0xd'));var Papa=require(_0xc156('0xe'));var Redis=require(_0xc156('0xf'));var authService=require(_0xc156('0x10'));var qs=require(_0xc156('0x11'));var as=require(_0xc156('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc156('0x13'))('api');var utils=require(_0xc156('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xc156('0x15'));var db=require(_0xc156('0x16'))['db'];function respondWithStatusCode(_0x264520,_0x28980b){_0x28980b=_0x28980b||0xcc;return function(_0x4289d6){if(_0x4289d6){return _0x264520[_0xc156('0x17')](_0x28980b);}return _0x264520[_0xc156('0x18')](_0x28980b)[_0xc156('0x19')]();};}function respondWithResult(_0x1cf9b9,_0x2e0d61){_0x2e0d61=_0x2e0d61||0xc8;return function(_0xd90903){if(_0xd90903){return _0x1cf9b9[_0xc156('0x18')](_0x2e0d61)[_0xc156('0x1a')](_0xd90903);}};}function respondWithFilteredResult(_0x52e4dc,_0x513f55){return function(_0xe3eaaa){if(_0xe3eaaa){var _0x41acf6=typeof _0x513f55[_0xc156('0x1b')]===_0xc156('0x1c')&&typeof _0x513f55[_0xc156('0x1d')]===_0xc156('0x1c');var _0x6cc6af=_0xe3eaaa['count'];var _0x389857=_0x41acf6?0x0:_0x513f55[_0xc156('0x1b')];var _0x35d20b=_0x41acf6?_0xe3eaaa[_0xc156('0x1e')]:_0x513f55[_0xc156('0x1b')]+_0x513f55['limit'];var _0x4b27ff;if(_0x35d20b>=_0x6cc6af){_0x35d20b=_0x6cc6af;_0x4b27ff=0xc8;}else{_0x4b27ff=0xce;}_0x52e4dc[_0xc156('0x18')](_0x4b27ff);return _0x52e4dc[_0xc156('0x1f')]('Content-Range',_0x389857+'-'+_0x35d20b+'/'+_0x6cc6af)[_0xc156('0x1a')](_0xe3eaaa);}return null;};}function patchUpdates(_0xf982d0){return function(_0x58d228){try{jsonpatch[_0xc156('0x20')](_0x58d228,_0xf982d0,!![]);}catch(_0x487662){return BPromise[_0xc156('0x21')](_0x487662);}return _0x58d228['save']();};}function saveUpdates(_0x43cb4b,_0x5b3d0d){return function(_0x50f431){if(_0x50f431){return _0x50f431[_0xc156('0x22')](_0x43cb4b)[_0xc156('0x23')](function(_0x2d2e62){return _0x2d2e62;});}return null;};}function removeEntity(_0x41856e,_0x16a183){return function(_0x53b1a4){if(_0x53b1a4){return _0x53b1a4['destroy']()[_0xc156('0x23')](function(){_0x41856e[_0xc156('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dfae0,_0x52822b){return function(_0xf03b56){if(!_0xf03b56){_0x4dfae0[_0xc156('0x17')](0x194);}return _0xf03b56;};}function handleError(_0x57ec4e,_0x84070f){_0x84070f=_0x84070f||0x1f4;return function(_0x1f0226){logger[_0xc156('0x24')](_0x1f0226[_0xc156('0x25')]);if(_0x1f0226[_0xc156('0x26')]){delete _0x1f0226[_0xc156('0x26')];}_0x57ec4e[_0xc156('0x18')](_0x84070f)[_0xc156('0x27')](_0x1f0226);};}exports[_0xc156('0x28')]=function(_0x262607,_0x4bcf14){var _0x5b5a80={},_0xe2065c={},_0x601f6b={'count':0x0,'rows':[]};var _0xc3d793=_[_0xc156('0x29')](db[_0xc156('0x2a')]['rawAttributes'],function(_0x483232){return{'name':_0x483232['fieldName'],'type':_0x483232[_0xc156('0x2b')]['key']};});_0xe2065c[_0xc156('0x2c')]=_[_0xc156('0x29')](_0xc3d793,_0xc156('0x26'));_0xe2065c[_0xc156('0x2d')]=_[_0xc156('0x2e')](_0x262607[_0xc156('0x2d')]);_0xe2065c[_0xc156('0x2f')]=_[_0xc156('0x30')](_0xe2065c[_0xc156('0x2c')],_0xe2065c[_0xc156('0x2d')]);_0x5b5a80[_0xc156('0x31')]=_['intersection'](_0xe2065c[_0xc156('0x2c')],qs[_0xc156('0x32')](_0x262607[_0xc156('0x2d')][_0xc156('0x32')]));_0x5b5a80['attributes']=_0x5b5a80[_0xc156('0x31')]['length']?_0x5b5a80[_0xc156('0x31')]:_0xe2065c['model'];if(!_0x262607[_0xc156('0x2d')]['hasOwnProperty'](_0xc156('0x33'))){_0x5b5a80[_0xc156('0x1d')]=qs[_0xc156('0x1d')](_0x262607['query']['limit']);_0x5b5a80[_0xc156('0x1b')]=qs['offset'](_0x262607[_0xc156('0x2d')][_0xc156('0x1b')]);}_0x5b5a80[_0xc156('0x34')]=qs[_0xc156('0x35')](_0x262607[_0xc156('0x2d')][_0xc156('0x35')]);_0x5b5a80[_0xc156('0x36')]=qs[_0xc156('0x2f')](_[_0xc156('0x37')](_0x262607[_0xc156('0x2d')],_0xe2065c[_0xc156('0x2f')]),_0xc3d793);if(_0x262607['query'][_0xc156('0x38')]){_0x5b5a80[_0xc156('0x36')]=_[_0xc156('0x39')](_0x5b5a80[_0xc156('0x36')],{'$or':_[_0xc156('0x29')](_0xc3d793,function(_0x54e75a){if(_0x54e75a[_0xc156('0x2b')]!==_0xc156('0x3a')){var _0x59436f={};_0x59436f[_0x54e75a['name']]={'$like':'%'+_0x262607[_0xc156('0x2d')][_0xc156('0x38')]+'%'};return _0x59436f;}})});}_0x5b5a80=_[_0xc156('0x39')]({},_0x5b5a80,_0x262607['options']);var _0x8df3b1={'where':_0x5b5a80['where']};return db[_0xc156('0x2a')][_0xc156('0x1e')](_0x8df3b1)[_0xc156('0x23')](function(_0x397c17){_0x601f6b[_0xc156('0x1e')]=_0x397c17;if(_0x262607[_0xc156('0x2d')]['includeAll']){_0x5b5a80[_0xc156('0x3b')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xc156('0x3c')](_0x5b5a80);})[_0xc156('0x23')](function(_0x435ecc){_0x601f6b[_0xc156('0x3d')]=_0x435ecc;return _0x601f6b;})[_0xc156('0x23')](respondWithFilteredResult(_0x4bcf14,_0x5b5a80))[_0xc156('0x3e')](handleError(_0x4bcf14,null));};exports[_0xc156('0x3f')]=function(_0x1651c6,_0x1a6875){var _0x322f0b={'raw':!![],'where':{'id':_0x1651c6['params']['id']}},_0x22d121={};_0x22d121[_0xc156('0x2c')]=_[_0xc156('0x2e')](db[_0xc156('0x2a')][_0xc156('0x40')]);_0x22d121[_0xc156('0x2d')]=_[_0xc156('0x2e')](_0x1651c6[_0xc156('0x2d')]);_0x22d121[_0xc156('0x2f')]=_[_0xc156('0x30')](_0x22d121[_0xc156('0x2c')],_0x22d121[_0xc156('0x2d')]);_0x322f0b[_0xc156('0x31')]=_[_0xc156('0x30')](_0x22d121['model'],qs[_0xc156('0x32')](_0x1651c6['query'][_0xc156('0x32')]));_0x322f0b[_0xc156('0x31')]=_0x322f0b[_0xc156('0x31')][_0xc156('0x41')]?_0x322f0b[_0xc156('0x31')]:_0x22d121[_0xc156('0x2c')];if(_0x1651c6[_0xc156('0x2d')][_0xc156('0x42')]){_0x322f0b[_0xc156('0x3b')]=[{'all':!![]}];}_0x322f0b=_[_0xc156('0x39')]({},_0x322f0b,_0x1651c6[_0xc156('0x43')]);return db[_0xc156('0x2a')][_0xc156('0x44')](_0x322f0b)[_0xc156('0x23')](handleEntityNotFound(_0x1a6875,null))['then'](respondWithResult(_0x1a6875,null))['catch'](handleError(_0x1a6875,null));};exports['create']=function(_0x5ba7b0,_0x2e3d68){return db[_0xc156('0x2a')][_0xc156('0x45')](_0x5ba7b0[_0xc156('0x46')],{})[_0xc156('0x23')](respondWithResult(_0x2e3d68,0xc9))[_0xc156('0x3e')](handleError(_0x2e3d68,null));};exports[_0xc156('0x22')]=function(_0x56ecdf,_0x2fd775){if(_0x56ecdf['body']['id']){delete _0x56ecdf[_0xc156('0x46')]['id'];}return db[_0xc156('0x2a')][_0xc156('0x44')]({'where':{'id':_0x56ecdf[_0xc156('0x47')]['id']}})['then'](handleEntityNotFound(_0x2fd775,null))['then'](saveUpdates(_0x56ecdf['body'],null))[_0xc156('0x23')](respondWithResult(_0x2fd775,null))['catch'](handleError(_0x2fd775,null));};exports['destroy']=function(_0xddb467,_0x5e80fa){return db[_0xc156('0x2a')]['find']({'where':{'id':_0xddb467['params']['id']}})[_0xc156('0x23')](handleEntityNotFound(_0x5e80fa,null))[_0xc156('0x23')](removeEntity(_0x5e80fa,null))[_0xc156('0x3e')](handleError(_0x5e80fa,null));};exports[_0xc156('0x48')]=function(_0x34f459,_0x20f514){return db[_0xc156('0x2a')]['describe']()[_0xc156('0x23')](respondWithResult(_0x20f514,null))['catch'](handleError(_0x20f514,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index caa05e5..6470cfe 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 _0x912f=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash'];(function(_0xec625b,_0x31d6f9){var _0x58c103=function(_0x476793){while(--_0x476793){_0xec625b['push'](_0xec625b['shift']());}};_0x58c103(++_0x31d6f9);}(_0x912f,0x6f));var _0xf912=function(_0x16f1ba,_0x299016){_0x16f1ba=_0x16f1ba-0x0;var _0x21227b=_0x912f[_0x16f1ba];return _0x21227b;};'use strict';var _=require(_0xf912('0x0'));var util=require(_0xf912('0x1'));var logger=require(_0xf912('0x2'))(_0xf912('0x3'));var moment=require(_0xf912('0x4'));var BPromise=require('bluebird');var rp=require(_0xf912('0x5'));var fs=require('fs');var path=require(_0xf912('0x6'));var rimraf=require(_0xf912('0x7'));var config=require(_0xf912('0x8'));var attributes=require(_0xf912('0x9'));module[_0xf912('0xa')]=function(_0x26a8b6,_0x568963){return _0x26a8b6['define'](_0xf912('0xb'),attributes,{'tableName':_0xf912('0xc'),'paranoid':![],'indexes':[{'name':_0xf912('0xd'),'fields':[_0xf912('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4ce0=['exports','define','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./whatsappTransferReport.attributes'];(function(_0x4d171c,_0x1163b8){var _0x104420=function(_0x454c19){while(--_0x454c19){_0x4d171c['push'](_0x4d171c['shift']());}};_0x104420(++_0x1163b8);}(_0x4ce0,0x184));var _0x04ce=function(_0x5386fb,_0x4b2e14){_0x5386fb=_0x5386fb-0x0;var _0xea7d70=_0x4ce0[_0x5386fb];return _0xea7d70;};'use strict';var _=require(_0x04ce('0x0'));var util=require(_0x04ce('0x1'));var logger=require(_0x04ce('0x2'))(_0x04ce('0x3'));var moment=require('moment');var BPromise=require(_0x04ce('0x4'));var rp=require(_0x04ce('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x04ce('0x6'));var config=require('../../config/environment');var attributes=require(_0x04ce('0x7'));module[_0x04ce('0x8')]=function(_0x5b9551,_0x1d90b0){return _0x5b9551[_0x04ce('0x9')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x04ce('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index ec120d7..0c783a1 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 _0xbab3=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis'];(function(_0x58cbde,_0x4b0f62){var _0x5799f3=function(_0x326eca){while(--_0x326eca){_0x58cbde['push'](_0x58cbde['shift']());}};_0x5799f3(++_0x4b0f62);}(_0xbab3,0x1f4));var _0x3bab=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xbab3[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x3bab('0x0'));var util=require('util');var moment=require(_0x3bab('0x1'));var BPromise=require(_0x3bab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3bab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3bab('0x4'));var logger=require(_0x3bab('0x5'))(_0x3bab('0x6'));var config=require('../../config/environment');var jayson=require(_0x3bab('0x7'));var client=jayson[_0x3bab('0x8')][_0x3bab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48c888,_0x484b8f,_0x296927){return new BPromise(function(_0x20233e,_0x5ed69c){return client[_0x3bab('0xa')](_0x48c888,_0x296927)['then'](function(_0xf9e01e){logger[_0x3bab('0xb')](_0x3bab('0xc'),_0x484b8f,'request\x20sent');logger[_0x3bab('0xd')](_0x3bab('0xe'),_0x484b8f,_0x3bab('0xf'),JSON[_0x3bab('0x10')](_0xf9e01e));if(_0xf9e01e[_0x3bab('0x11')]){if(_0xf9e01e[_0x3bab('0x11')][_0x3bab('0x12')]===0x1f4){logger[_0x3bab('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x484b8f,_0xf9e01e[_0x3bab('0x11')][_0x3bab('0x13')]);return _0x5ed69c(_0xf9e01e[_0x3bab('0x11')]['message']);}logger[_0x3bab('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x484b8f,_0xf9e01e[_0x3bab('0x11')][_0x3bab('0x13')]);return _0x20233e(_0xf9e01e[_0x3bab('0x11')][_0x3bab('0x13')]);}else{logger[_0x3bab('0xb')](_0x3bab('0xc'),_0x484b8f,_0x3bab('0xf'));_0x20233e(_0xf9e01e['result'][_0x3bab('0x13')]);}})[_0x3bab('0x14')](function(_0x1cc42e){logger[_0x3bab('0x11')](_0x3bab('0xc'),_0x484b8f,_0x1cc42e);_0x5ed69c(_0x1cc42e);});});} \ No newline at end of file +var _0xf7fe=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2cce78,_0xdf16b7){var _0x439e9f=function(_0xe26bb8){while(--_0xe26bb8){_0x2cce78['push'](_0x2cce78['shift']());}};_0x439e9f(++_0xdf16b7);}(_0xf7fe,0x159));var _0xef7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf7fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xef7f('0x0'));var util=require('util');var moment=require(_0xef7f('0x1'));var BPromise=require(_0xef7f('0x2'));var rs=require(_0xef7f('0x3'));var fs=require('fs');var Redis=require(_0xef7f('0x4'));var db=require(_0xef7f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xef7f('0x6'))(_0xef7f('0x7'));var config=require(_0xef7f('0x8'));var jayson=require(_0xef7f('0x9'));var client=jayson[_0xef7f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x482590,_0x1d696b,_0x40c3a2){return new BPromise(function(_0x39b89c,_0x5d4c16){return client[_0xef7f('0xb')](_0x482590,_0x40c3a2)['then'](function(_0x349913){logger[_0xef7f('0xc')](_0xef7f('0xd'),_0x1d696b,_0xef7f('0xe'));logger[_0xef7f('0xf')](_0xef7f('0x10'),_0x1d696b,_0xef7f('0xe'),JSON[_0xef7f('0x11')](_0x349913));if(_0x349913[_0xef7f('0x12')]){if(_0x349913[_0xef7f('0x12')][_0xef7f('0x13')]===0x1f4){logger[_0xef7f('0x12')](_0xef7f('0xd'),_0x1d696b,_0x349913[_0xef7f('0x12')][_0xef7f('0x14')]);return _0x5d4c16(_0x349913['error'][_0xef7f('0x14')]);}logger['error'](_0xef7f('0xd'),_0x1d696b,_0x349913['error'][_0xef7f('0x14')]);return _0x39b89c(_0x349913[_0xef7f('0x12')][_0xef7f('0x14')]);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x1d696b,'request\x20sent');_0x39b89c(_0x349913[_0xef7f('0x15')][_0xef7f('0x14')]);}})[_0xef7f('0x16')](function(_0x49620c){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x1d696b,_0x49620c);_0x5d4c16(_0x49620c);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 8ca8058..283216d 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbab9=['./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','start','Online\x20apps:','filter','online','name','join','map','None','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./rpc','./config/environment','app'];(function(_0x26059b,_0x6ed443){var _0x4c83ef=function(_0x468223){while(--_0x468223){_0x26059b['push'](_0x26059b['shift']());}};_0x4c83ef(++_0x6ed443);}(_0xbab9,0x6b));var _0x9bab=function(_0x117fa8,_0x1fa105){_0x117fa8=_0x117fa8-0x0;var _0x40bb60=_0xbab9[_0x117fa8];return _0x40bb60;};'use strict';var _=require(_0x9bab('0x0'));var mysqldb=require(_0x9bab('0x1'));var rpc=require(_0x9bab('0x2'));var config=require(_0x9bab('0x3'));var logger=require('./config/logger')(_0x9bab('0x4'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x9bab('0x5'));var chat=require(_0x9bab('0x6'));var whatsapp=require(_0x9bab('0x7'));var transcribe=require(_0x9bab('0x8'));function main(){return mysqldb['db'][_0x9bab('0x9')][_0x9bab('0xa')]()[_0x9bab('0xb')](function(){return rpc['listen']();})[_0x9bab('0xb')](function(_0x2de235){logger['info'](_0x2de235);return chat[_0x9bab('0xc')]();})[_0x9bab('0xb')](function(){return whatsapp[_0x9bab('0xc')]();})[_0x9bab('0xb')](function(){return schedule[_0x9bab('0xc')]();})['then'](function(){return transcribe[_0x9bab('0xc')]();})[_0x9bab('0xb')](function(_0x1cff9d){logger['info'](_0x1cff9d);return pm2['start'](pm2Config);})[_0x9bab('0xb')](function(_0x5120ca){logger['info'](_0x9bab('0xd'),_['map'](_[_0x9bab('0xe')](_0x5120ca,{'status':_0x9bab('0xf')}),_0x9bab('0x10'))[_0x9bab('0x11')]());logger['info']('Offline\x20apps:',_[_0x9bab('0x12')](_[_0x9bab('0xe')](_0x5120ca,function(_0x2c9443){return _0x2c9443['status']!==_0x9bab('0xf');}),_0x9bab('0x10'))[_0x9bab('0x11')]()||_0x9bab('0x13'));config[_0x9bab('0x14')]&&require(_0x9bab('0x15'))[_0x9bab('0x16')]();require(_0x9bab('0x17'))[_0x9bab('0x16')]();})[_0x9bab('0x18')](function(_0x2422b6){logger[_0x9bab('0x19')](_0x9bab('0x1a'),_0x2422b6);process[_0x9bab('0x1b')](0x1);});}main(); \ No newline at end of file +var _0xc945=['./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/logger','sync','then','listen','info','start','Online\x20apps:','filter','online','join','Offline\x20apps:','map','status','name','None','seedDB'];(function(_0x2b7ce2,_0x434541){var _0x2080a7=function(_0x13d3e4){while(--_0x13d3e4){_0x2b7ce2['push'](_0x2b7ce2['shift']());}};_0x2080a7(++_0x434541);}(_0xc945,0xd7));var _0x5c94=function(_0x25a5f8,_0x1e9109){_0x25a5f8=_0x25a5f8-0x0;var _0x52881a=_0xc945[_0x25a5f8];return _0x52881a;};'use strict';var _=require('lodash');var mysqldb=require(_0x5c94('0x0'));var rpc=require(_0x5c94('0x1'));var config=require(_0x5c94('0x2'));var logger=require(_0x5c94('0x3'))('app');var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db']['sequelize'][_0x5c94('0x4')]()[_0x5c94('0x5')](function(){return rpc[_0x5c94('0x6')]();})['then'](function(_0x1a7401){logger[_0x5c94('0x7')](_0x1a7401);return chat[_0x5c94('0x8')]();})[_0x5c94('0x5')](function(){return whatsapp[_0x5c94('0x8')]();})[_0x5c94('0x5')](function(){return schedule[_0x5c94('0x8')]();})[_0x5c94('0x5')](function(){return transcribe[_0x5c94('0x8')]();})[_0x5c94('0x5')](function(_0x26b0d7){logger[_0x5c94('0x7')](_0x26b0d7);return pm2['start'](pm2Config);})[_0x5c94('0x5')](function(_0x1586dc){logger[_0x5c94('0x7')](_0x5c94('0x9'),_['map'](_[_0x5c94('0xa')](_0x1586dc,{'status':_0x5c94('0xb')}),'name')[_0x5c94('0xc')]());logger[_0x5c94('0x7')](_0x5c94('0xd'),_[_0x5c94('0xe')](_[_0x5c94('0xa')](_0x1586dc,function(_0x581008){return _0x581008[_0x5c94('0xf')]!==_0x5c94('0xb');}),_0x5c94('0x10'))[_0x5c94('0xc')]()||_0x5c94('0x11'));config[_0x5c94('0x12')]&&require(_0x5c94('0x13'))[_0x5c94('0x14')]();require(_0x5c94('0x15'))[_0x5c94('0x14')]();})[_0x5c94('0x16')](function(_0xe66e60){logger[_0x5c94('0x17')](_0x5c94('0x18'),_0xe66e60);process[_0x5c94('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 5296511..1c0f514 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 _0xb05d=['nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blocked','blockDuration','blockedAt','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isMiddleware','signToken','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','isNil','generateApiKey','regenerateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','unshift','join','promisify','secret','payload','options','verify','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','secrets','session','role','fullname','name','internal','email','userpic','permissions','voicePause','chatPause','mailPause','faxPause','openchannelPause','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','findOne','closed','disposition','then','status','unmanaged','json','Unmanaged.','authorization','startsWith','Basic','User','find','pass','user','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce'];(function(_0xd566cb,_0x445ab3){var _0x229f8d=function(_0x5f5bab){while(--_0x5f5bab){_0xd566cb['push'](_0xd566cb['shift']());}};_0x229f8d(++_0x445ab3);}(_0xb05d,0xa9));var _0xdb05=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0xb05d[_0x38c632];return _0x12737e;};'use strict';var db=require(_0xdb05('0x0'))['db'];var config=require(_0xdb05('0x1'));var hardwareConf=require(_0xdb05('0x2'));var licenseUtil=require(_0xdb05('0x3'));var encryptor=require(_0xdb05('0x4'));var _=require(_0xdb05('0x5'));var jwt=require(_0xdb05('0x6'));var expressJwt=require(_0xdb05('0x7'));var compose=require('composable-middleware');var basicAuth=require(_0xdb05('0x8'));var crypto=require(_0xdb05('0x9'));var BPromise=require(_0xdb05('0xa'));var util=require(_0xdb05('0xb'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xdb05('0xc')][_0xdb05('0xd')]});var userAttributes=['id',_0xdb05('0xe'),_0xdb05('0xf'),_0xdb05('0x10'),_0xdb05('0x11'),_0xdb05('0x12'),_0xdb05('0x13'),_0xdb05('0x14'),'md5secret',_0xdb05('0x15'),_0xdb05('0x16'),_0xdb05('0x17'),_0xdb05('0x18'),'smsPause',_0xdb05('0x19'),'pauseType',_0xdb05('0x1a'),_0xdb05('0x1b'),'lastPauseAt',_0xdb05('0x1c'),_0xdb05('0x1d'),_0xdb05('0x1e'),'alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd',_0xdb05('0x1f'),_0xdb05('0x20'),_0xdb05('0x21'),_0xdb05('0x22'),_0xdb05('0x23'),_0xdb05('0x24'),_0xdb05('0x25'),'hotdesk',_0xdb05('0x26'),_0xdb05('0x27'),_0xdb05('0x28'),_0xdb05('0x29'),_0xdb05('0x2a'),_0xdb05('0x2b'),_0xdb05('0x2c'),_0xdb05('0x2d')];exports[_0xdb05('0x2e')]=function(){return this[_0xdb05('0x2f')](!![])[_0xdb05('0x30')](function(_0xf8bc8d,_0x5251cf,_0x3dc28d){if(_0xf8bc8d['user']){_0x3dc28d();}else{return db['ChatInteraction'][_0xdb05('0x31')]({'where':{'id':_0xf8bc8d['params']['id']},'attributes':['id',_0xdb05('0x32'),_0xdb05('0x33')],'raw':!![]})[_0xdb05('0x34')](function(_0x35db26){if(_0x35db26&&_0x35db26[_0xdb05('0x32')]){return _0x5251cf[_0xdb05('0x35')](_0x35db26['disposition']===_0xdb05('0x36')?0x195:0x193)[_0xdb05('0x37')]({'message':_0x35db26['disposition']==='unmanaged'?_0xdb05('0x38'):'Forbidden.'});}else{_0x3dc28d();}})['catch'](function(_0x315ba8){_0x3dc28d(_0x315ba8);});}});};exports[_0xdb05('0x2f')]=function isAuthenticated(_0x907164){return compose()[_0xdb05('0x30')](function(_0x592b57,_0x265b10,_0x292411){var _0x288569;if(_0x592b57['headers'][_0xdb05('0x39')]){if(_[_0xdb05('0x3a')](_0x592b57['headers'][_0xdb05('0x39')],_0xdb05('0x3b'))){var _0x1fe21d=basicAuth(_0x592b57);db[_0xdb05('0x3c')][_0xdb05('0x3d')]({'where':{'name':_0x1fe21d[_0xdb05('0x10')]}})[_0xdb05('0x34')](function(_0x200440){if(!_0x200440||!_0x200440['authenticate'](_0x1fe21d[_0xdb05('0x3e')])){return _0x265b10[_0xdb05('0x35')](0x191)[_0xdb05('0x37')]({'message':'Wrong\x20credentials.'});}_0x592b57[_0xdb05('0x3f')]={'id':_0x200440['id']};_0x292411();})[_0xdb05('0x40')](function(_0x342559){_0x292411(_0x342559);});}else if(_['startsWith'](_0x592b57['headers']['authorization'],_0xdb05('0x41'))){validateJwt(_0x592b57,_0x265b10,_0x292411);}else{if(_0x907164){_0x292411();}else{return _0x265b10['status'](0x193)['json']({'message':_0xdb05('0x42')});}}}else if(_0x592b57[_0xdb05('0x43')][_0xdb05('0x44')]){try{var _0x2787a3={'audience':hardwareConf[_0xdb05('0x45')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x592b57[_0xdb05('0x43')][_0xdb05('0x44')],_0x2787a3)[_0xdb05('0x34')](function(_0x68429){return db[_0xdb05('0x3c')][_0xdb05('0x3d')]({'where':{'id':_0x68429[_0xdb05('0x46')]}})[_0xdb05('0x34')](function(_0x3512f2){_0x288569=_0x3512f2;return db[_0xdb05('0x47')][_0xdb05('0x31')]({'where':{'id':0x1},'attributes':[_0xdb05('0x48'),'blockDuration'],'raw':!![]});})[_0xdb05('0x34')](function(_0x2a248c){if(!_0x288569||!_[_0xdb05('0x49')](_0x288569[_0xdb05('0x4a')],_0x68429[_0xdb05('0x4b')])){return _0x265b10[_0xdb05('0x35')](0x191)[_0xdb05('0x37')]({'message':_0xdb05('0x4c')});}if(_0x288569[_0xdb05('0x4d')]){return _0x265b10[_0xdb05('0x35')](0x191)[_0xdb05('0x37')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x288569[_0xdb05('0x4e')]){if(_0x2a248c[_0xdb05('0x4f')]>0x0){if(moment(_0x288569[_0xdb05('0x50')])['add'](_0x2a248c[_0xdb05('0x4f')],'minutes')>moment()){return _0x265b10['status'](0x191)[_0xdb05('0x37')]({'message':_0xdb05('0x51')});}}else{return _0x265b10['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x592b57['user']={'id':_0x288569['id']};_0x292411();});})[_0xdb05('0x40')](function(){return _0x265b10[_0xdb05('0x35')](0x191)[_0xdb05('0x37')]({'message':_0xdb05('0x51')});});}catch(_0x2d31a6){_0x292411(_0x2d31a6);}}else if(_0x907164){_0x292411();}else{return _0x265b10[_0xdb05('0x35')](0x193)[_0xdb05('0x37')]({'message':_0xdb05('0x42')});}})[_0xdb05('0x30')](function(_0x268fa5,_0x2084c4,_0x388d54){if(_0x268fa5[_0xdb05('0x3f')]){db[_0xdb05('0x3c')][_0xdb05('0x3d')]({'where':{'id':_0x268fa5[_0xdb05('0x3f')]['id']},'attributes':userAttributes})['then'](function(_0x53b10c){if(!_0x53b10c){return _0x2084c4[_0xdb05('0x35')](0x194)[_0xdb05('0x37')]({'message':_0xdb05('0x52')});}_0x268fa5[_0xdb05('0x3f')]=_0x53b10c;_0x388d54();})[_0xdb05('0x40')](function(_0x2452a6){_0x388d54(_0x2452a6);});}else if(_0x907164){_0x388d54();}else{return _0x2084c4[_0xdb05('0x35')](0x194)[_0xdb05('0x37')]({'message':_0xdb05('0x53')});}});};exports[_0xdb05('0x54')]=function canUpdate(){return compose()['use'](function(_0x300969,_0xe94f0f,_0x3c1edd){return licenseUtil[_0xdb05('0x55')]()[_0xdb05('0x34')](function(_0x2b9e15){if(_0x2b9e15[_0xdb05('0x56')]){_0x3c1edd();}else{return _0xe94f0f[_0xdb05('0x35')](0x193)[_0xdb05('0x37')]({'message':'Forbidden'});}})[_0xdb05('0x40')](function(_0x4d5096){_0x3c1edd(_0x4d5096);});});};exports[_0xdb05('0x57')]=function(_0x4668ff,_0x39015e,_0x28180b){_0x4668ff[_0xdb05('0x57')]=!![];return _0x28180b();};exports[_0xdb05('0x58')]=function signToken(_0x427cb5){return signJwt(_0x427cb5);};exports['setTokenCookie']=function(_0x2081e8,_0x1aadc9){if(!_0x2081e8[_0xdb05('0x3f')]){return _0x1aadc9['status'](0x194)[_0xdb05('0x37')]({'message':_0xdb05('0x59')});}var _0x477ed0={'payload':{'id':_0x2081e8[_0xdb05('0x3f')]['id'],'role':_0x2081e8['user'][_0xdb05('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x477ed0)['then'](function(_0x1ddbe2){_0x1aadc9[_0xdb05('0x5a')](_0xdb05('0x5b'),_0x1ddbe2);_0x1aadc9[_0xdb05('0x5c')](_0xdb05('0x5d'));})['catch'](function(_0x39d0c7){return _0x1aadc9['status'](0x1f4)['send'](_0x39d0c7);});};exports['retrieveApiKey']=function(_0x43292f){if(_[_0xdb05('0x5e')](_0x43292f[_0xdb05('0x4a')])||_[_0xdb05('0x5e')](_0x43292f['apiKeyIat'])){return null;}else{return createJwt(_0x43292f);}};exports[_0xdb05('0x5f')]=function(_0x4ff90e){_0x4ff90e['apiKeyNonce']=generateNonce();_0x4ff90e['apiKeyIat']=generateIssuedAt();return createJwt(_0x4ff90e);};exports[_0xdb05('0x60')]=function(_0x4bea0b,_0x3bc8c3){var _0x4bc0f6=_0x4bea0b[_0xdb05('0x43')][_0xdb05('0x44')];if(_0x4bc0f6){var _0x3496f1={'nonce':_0x3bc8c3[_0xdb05('0x4a')],'iat':_0x3bc8c3[_0xdb05('0x61')],'audience':hardwareConf[_0xdb05('0x45')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x4bc0f6,_0x3496f1)[_0xdb05('0x34')](function(){return generateApiKey(_0x3bc8c3);});}else{throw{'message':_0xdb05('0x62')};}};exports[_0xdb05('0x63')]=function(_0x49a126){var _0x2bfc72=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2bfc72['test'](_0x49a126))throw new db[(_0xdb05('0x64'))][(_0xdb05('0x65'))](_0xdb05('0x66'));return;};exports[_0xdb05('0x67')]=function(_0x2a0e34,_0xe3bd04,_0x444245){var _0x18428d=encryptor[_0xdb05('0x68')](_0xe3bd04)[_0xdb05('0x69')](',');for(var _0x34ec44=0x0;_0x34ec44<_0x444245;_0x34ec44++){if(!_0x18428d[_0x34ec44])break;if(_0x2a0e34[_0xdb05('0x6a')]()===_0x18428d[_0x34ec44][_0xdb05('0x6a')]()){var _0x2592ac=util['format'](_0xdb05('0x6b'),_0x444245);if(_0x444245===0x1){_0x2592ac=_0xdb05('0x6c');}throw new db['Sequelize'][(_0xdb05('0x65'))](_0x2592ac);}}return;};exports[_0xdb05('0x6d')]=function(_0x54d437,_0x5ec8f1){var _0x291632=_0x5ec8f1?encryptor[_0xdb05('0x68')](_0x5ec8f1)[_0xdb05('0x69')](','):[];if(_0x291632['length']===0x5){_0x291632[_0xdb05('0x6e')](-0x1,0x1);}_0x291632[_0xdb05('0x6f')](_0x54d437);return encryptor['encryptString'](_0x291632[_0xdb05('0x70')](','));};function signJwt(_0x474048){var _0xad4025=BPromise[_0xdb05('0x71')](jwt['sign'],{'context':jwt});var _0x700bb2=_0x474048[_0xdb05('0x72')]||config[_0xdb05('0xc')][_0xdb05('0xd')];return new BPromise(function(_0x3eb879,_0x115cc9){_0xad4025(_0x474048[_0xdb05('0x73')],_0x700bb2,_0x474048[_0xdb05('0x74')])[_0xdb05('0x34')](function(_0x5b326d){_0x3eb879(_0x5b326d);})[_0xdb05('0x40')](function(_0x20a601){_0x115cc9(_0x20a601);});});}function verifyJwt(_0x41c02d,_0x17f8c8,_0x30d757){var _0x25fa38=BPromise[_0xdb05('0x71')](jwt[_0xdb05('0x75')],{'context':jwt});var _0x335a83=_0x30d757||config['secrets'][_0xdb05('0xd')];return new BPromise(function(_0x51f0a3,_0x2c664a){_0x25fa38(_0x41c02d,_0x335a83,_0x17f8c8)[_0xdb05('0x34')](function(_0x264255){_0x51f0a3(_0x264255);})[_0xdb05('0x40')](function(_0x23358c){_0x2c664a(_0x23358c);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xdb05('0x76')](_0xdb05('0x77'));}function generateIssuedAt(){return Math[_0xdb05('0x78')](Date['now']()/0x3e8)[_0xdb05('0x76')]();}function createJwt(_0x1073ad){var _0x4c82d0={'payload':{'iat':_0x1073ad['apiKeyIat'],'nonce':_0x1073ad[_0xdb05('0x4a')]},'options':{'algorithm':_0xdb05('0x79'),'subject':_0x1073ad['id'][_0xdb05('0x76')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xdb05('0x45')]()}};return signJwt(_0x4c82d0)[_0xdb05('0x34')](function(_0x3b9b78){return{'iat':_0x1073ad[_0xdb05('0x61')],'nonce':_0x1073ad['apiKeyNonce'],'token':_0x3b9b78};});} \ No newline at end of file +var _0x8668=['floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','isAuthenticated','user','ChatInteraction','disposition','then','closed','status','unmanaged','json','Unmanaged.','Forbidden.','catch','use','headers','authorization','startsWith','Basic','find','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','findOne','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','add','blockDuration','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','send','isNil','generateApiKey','apiKeyIat','regenerateApiKey','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','split','toLowerCase','format','Sequelize','updatePasswordsHistory','decryptString','length','join','sign','secret','promisify','randomBytes','toString','hex'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8668,0x7f));var _0x8866=function(_0x15df00,_0x25f5bd){_0x15df00=_0x15df00-0x0;var _0x7db24b=_0x8668[_0x15df00];return _0x7db24b;};'use strict';var db=require(_0x8866('0x0'))['db'];var config=require(_0x8866('0x1'));var hardwareConf=require(_0x8866('0x2'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x8866('0x3'));var _=require(_0x8866('0x4'));var jwt=require(_0x8866('0x5'));var expressJwt=require(_0x8866('0x6'));var compose=require(_0x8866('0x7'));var basicAuth=require(_0x8866('0x8'));var crypto=require(_0x8866('0x9'));var BPromise=require(_0x8866('0xa'));var util=require(_0x8866('0xb'));var moment=require(_0x8866('0xc'));var validateJwt=expressJwt({'secret':config[_0x8866('0xd')][_0x8866('0xe')]});var userAttributes=['id',_0x8866('0xf'),_0x8866('0x10'),_0x8866('0x11'),_0x8866('0x12'),'email',_0x8866('0x13'),_0x8866('0x14'),_0x8866('0x15'),_0x8866('0x16'),_0x8866('0x17'),_0x8866('0x18'),_0x8866('0x19'),_0x8866('0x1a'),'openchannelPause',_0x8866('0x1b'),_0x8866('0x1c'),_0x8866('0x1d'),_0x8866('0x1e'),_0x8866('0x1f'),'allowmessenger',_0x8866('0x20'),_0x8866('0x21'),_0x8866('0x22'),'phoneBarAutoAnswerDelay',_0x8866('0x23'),_0x8866('0x24'),_0x8866('0x25'),_0x8866('0x26'),_0x8866('0x27'),'phoneBarPrefixRequired',_0x8866('0x28'),_0x8866('0x29'),_0x8866('0x2a'),_0x8866('0x2b'),'userProfileId',_0x8866('0x2c'),_0x8866('0x2d'),_0x8866('0x2e'),_0x8866('0x2f'),_0x8866('0x30'),'downloadAttachments'];exports['isChatInteractionAuthorized']=function(){return this[_0x8866('0x31')](!![])['use'](function(_0x162cf1,_0x36885e,_0xf6bbd6){if(_0x162cf1[_0x8866('0x32')]){_0xf6bbd6();}else{return db[_0x8866('0x33')]['findOne']({'where':{'id':_0x162cf1['params']['id']},'attributes':['id','closed',_0x8866('0x34')],'raw':!![]})[_0x8866('0x35')](function(_0x166365){if(_0x166365&&_0x166365[_0x8866('0x36')]){return _0x36885e[_0x8866('0x37')](_0x166365[_0x8866('0x34')]===_0x8866('0x38')?0x195:0x193)[_0x8866('0x39')]({'message':_0x166365[_0x8866('0x34')]===_0x8866('0x38')?_0x8866('0x3a'):_0x8866('0x3b')});}else{_0xf6bbd6();}})[_0x8866('0x3c')](function(_0x34fca4){_0xf6bbd6(_0x34fca4);});}});};exports[_0x8866('0x31')]=function isAuthenticated(_0x24c2bb){return compose()[_0x8866('0x3d')](function(_0x453c3d,_0x4e23bd,_0x1a03a1){var _0x3c3371;if(_0x453c3d[_0x8866('0x3e')][_0x8866('0x3f')]){if(_[_0x8866('0x40')](_0x453c3d[_0x8866('0x3e')][_0x8866('0x3f')],_0x8866('0x41'))){var _0x132634=basicAuth(_0x453c3d);db['User'][_0x8866('0x42')]({'where':{'name':_0x132634[_0x8866('0x11')]}})[_0x8866('0x35')](function(_0x5bc9ba){if(!_0x5bc9ba||!_0x5bc9ba['authenticate'](_0x132634[_0x8866('0x43')])){return _0x4e23bd[_0x8866('0x37')](0x191)[_0x8866('0x39')]({'message':_0x8866('0x44')});}_0x453c3d[_0x8866('0x32')]={'id':_0x5bc9ba['id']};_0x1a03a1();})[_0x8866('0x3c')](function(_0x11ae74){_0x1a03a1(_0x11ae74);});}else if(_[_0x8866('0x40')](_0x453c3d[_0x8866('0x3e')][_0x8866('0x3f')],_0x8866('0x45'))){validateJwt(_0x453c3d,_0x4e23bd,_0x1a03a1);}else{if(_0x24c2bb){_0x1a03a1();}else{return _0x4e23bd[_0x8866('0x37')](0x193)[_0x8866('0x39')]({'message':_0x8866('0x46')});}}}else if(_0x453c3d[_0x8866('0x47')][_0x8866('0x48')]){try{var _0x2f4221={'audience':hardwareConf[_0x8866('0x49')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x453c3d[_0x8866('0x47')][_0x8866('0x48')],_0x2f4221)[_0x8866('0x35')](function(_0x5e7bf3){return db['User'][_0x8866('0x42')]({'where':{'id':_0x5e7bf3[_0x8866('0x4a')]}})[_0x8866('0x35')](function(_0xcef619){_0x3c3371=_0xcef619;return db[_0x8866('0x4b')][_0x8866('0x4c')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x8866('0x35')](function(_0x49004b){if(!_0x3c3371||!_['isEqual'](_0x3c3371[_0x8866('0x4d')],_0x5e7bf3[_0x8866('0x4e')])){return _0x4e23bd[_0x8866('0x37')](0x191)[_0x8866('0x39')]({'message':_0x8866('0x4f')});}if(_0x3c3371[_0x8866('0x50')]){return _0x4e23bd[_0x8866('0x37')](0x191)[_0x8866('0x39')]({'message':_0x8866('0x51')});}if(_0x3c3371[_0x8866('0x52')]){if(_0x49004b['blockDuration']>0x0){if(moment(_0x3c3371['blockedAt'])[_0x8866('0x53')](_0x49004b[_0x8866('0x54')],_0x8866('0x55'))>moment()){return _0x4e23bd[_0x8866('0x37')](0x191)[_0x8866('0x39')]({'message':_0x8866('0x51')});}}else{return _0x4e23bd['status'](0x191)[_0x8866('0x39')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x453c3d[_0x8866('0x32')]={'id':_0x3c3371['id']};_0x1a03a1();});})[_0x8866('0x3c')](function(){return _0x4e23bd[_0x8866('0x37')](0x191)['json']({'message':_0x8866('0x51')});});}catch(_0x273a57){_0x1a03a1(_0x273a57);}}else if(_0x24c2bb){_0x1a03a1();}else{return _0x4e23bd[_0x8866('0x37')](0x193)[_0x8866('0x39')]({'message':_0x8866('0x46')});}})[_0x8866('0x3d')](function(_0x30c547,_0x18454c,_0x5bfa1d){if(_0x30c547[_0x8866('0x32')]){db['User']['find']({'where':{'id':_0x30c547['user']['id']},'attributes':userAttributes})[_0x8866('0x35')](function(_0x3f42b4){if(!_0x3f42b4){return _0x18454c[_0x8866('0x37')](0x194)[_0x8866('0x39')]({'message':_0x8866('0x56')});}_0x30c547[_0x8866('0x32')]=_0x3f42b4;_0x5bfa1d();})['catch'](function(_0x224042){_0x5bfa1d(_0x224042);});}else if(_0x24c2bb){_0x5bfa1d();}else{return _0x18454c['status'](0x194)[_0x8866('0x39')]({'message':_0x8866('0x57')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x8866('0x3d')](function(_0x150f48,_0xde217b,_0x20db3f){return licenseUtil[_0x8866('0x58')]()[_0x8866('0x35')](function(_0x215ac3){if(_0x215ac3[_0x8866('0x59')]){_0x20db3f();}else{return _0xde217b[_0x8866('0x37')](0x193)['json']({'message':_0x8866('0x5a')});}})[_0x8866('0x3c')](function(_0x30a4bd){_0x20db3f(_0x30a4bd);});});};exports['isMiddleware']=function(_0x35a52d,_0x44d1ae,_0x202d30){_0x35a52d[_0x8866('0x5b')]=!![];return _0x202d30();};exports[_0x8866('0x5c')]=function signToken(_0x588c05){return signJwt(_0x588c05);};exports[_0x8866('0x5d')]=function(_0x2b93a7,_0x3348f1){if(!_0x2b93a7[_0x8866('0x32')]){return _0x3348f1[_0x8866('0x37')](0x194)[_0x8866('0x39')]({'message':_0x8866('0x5e')});}var _0x421f96={'payload':{'id':_0x2b93a7[_0x8866('0x32')]['id'],'role':_0x2b93a7[_0x8866('0x32')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x421f96)[_0x8866('0x35')](function(_0x385112){_0x3348f1[_0x8866('0x5f')](_0x8866('0x60'),_0x385112);_0x3348f1['redirect']('/dashboards/general');})[_0x8866('0x3c')](function(_0x5d3f1b){return _0x3348f1['status'](0x1f4)[_0x8866('0x61')](_0x5d3f1b);});};exports['retrieveApiKey']=function(_0x4d3c3){if(_[_0x8866('0x62')](_0x4d3c3['apiKeyNonce'])||_[_0x8866('0x62')](_0x4d3c3['apiKeyIat'])){return null;}else{return createJwt(_0x4d3c3);}};exports[_0x8866('0x63')]=function(_0x28a363){_0x28a363[_0x8866('0x4d')]=generateNonce();_0x28a363[_0x8866('0x64')]=generateIssuedAt();return createJwt(_0x28a363);};exports[_0x8866('0x65')]=function(_0x4b47ee,_0x4594cc){var _0xf61bf6=_0x4b47ee[_0x8866('0x47')][_0x8866('0x48')];if(_0xf61bf6){var _0xdde251={'nonce':_0x4594cc[_0x8866('0x4d')],'iat':_0x4594cc[_0x8866('0x64')],'audience':hardwareConf[_0x8866('0x49')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xf61bf6,_0xdde251)['then'](function(){return generateApiKey(_0x4594cc);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x8866('0x66')]=function(_0x57cbf0){var _0x2fa28d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2fa28d[_0x8866('0x67')](_0x57cbf0))throw new db['Sequelize'][(_0x8866('0x68'))](_0x8866('0x69'));return;};exports[_0x8866('0x6a')]=function(_0x53cedb,_0x4d6b9b,_0x40665f){var _0x4f364e=encryptor['decryptString'](_0x4d6b9b)[_0x8866('0x6b')](',');for(var _0x49079b=0x0;_0x49079b<_0x40665f;_0x49079b++){if(!_0x4f364e[_0x49079b])break;if(_0x53cedb[_0x8866('0x6c')]()===_0x4f364e[_0x49079b][_0x8866('0x6c')]()){var _0xa1130a=util[_0x8866('0x6d')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x40665f);if(_0x40665f===0x1){_0xa1130a='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x8866('0x6e'))][(_0x8866('0x68'))](_0xa1130a);}}return;};exports[_0x8866('0x6f')]=function(_0x5746a5,_0x518b20){var _0x407245=_0x518b20?encryptor[_0x8866('0x70')](_0x518b20)[_0x8866('0x6b')](','):[];if(_0x407245[_0x8866('0x71')]===0x5){_0x407245['splice'](-0x1,0x1);}_0x407245['unshift'](_0x5746a5);return encryptor['encryptString'](_0x407245[_0x8866('0x72')](','));};function signJwt(_0x58ab8a){var _0x308780=BPromise['promisify'](jwt[_0x8866('0x73')],{'context':jwt});var _0x4b55dc=_0x58ab8a[_0x8866('0x74')]||config[_0x8866('0xd')][_0x8866('0xe')];return new BPromise(function(_0x22755c,_0x2ab954){_0x308780(_0x58ab8a['payload'],_0x4b55dc,_0x58ab8a['options'])[_0x8866('0x35')](function(_0x2a9b8a){_0x22755c(_0x2a9b8a);})[_0x8866('0x3c')](function(_0x141c03){_0x2ab954(_0x141c03);});});}function verifyJwt(_0x244c4d,_0x1fbf5d,_0x3a7ea6){var _0x14ad5f=BPromise[_0x8866('0x75')](jwt['verify'],{'context':jwt});var _0x1745a7=_0x3a7ea6||config[_0x8866('0xd')][_0x8866('0xe')];return new BPromise(function(_0xef7a01,_0x3ac233){_0x14ad5f(_0x244c4d,_0x1745a7,_0x1fbf5d)[_0x8866('0x35')](function(_0x51d50c){_0xef7a01(_0x51d50c);})[_0x8866('0x3c')](function(_0xe63c){_0x3ac233(_0xe63c);});});}function generateNonce(){return crypto[_0x8866('0x76')](0x10)[_0x8866('0x77')](_0x8866('0x78'));}function generateIssuedAt(){return Math[_0x8866('0x79')](Date[_0x8866('0x7a')]()/0x3e8)[_0x8866('0x77')]();}function createJwt(_0x34a7b5){var _0x58852e={'payload':{'iat':_0x34a7b5[_0x8866('0x64')],'nonce':_0x34a7b5[_0x8866('0x4d')]},'options':{'algorithm':_0x8866('0x7b'),'subject':_0x34a7b5['id'][_0x8866('0x77')](),'issuer':hardwareConf[_0x8866('0x49')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x58852e)['then'](function(_0x1134af){return{'iat':_0x34a7b5[_0x8866('0x64')],'nonce':_0x34a7b5[_0x8866('0x4d')],'token':_0x1134af};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index b21a364..cdfd2e7 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 _0xaff4=['session','aes-256-ctr','aes192','encrypt','algorithm','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','update','binary','write','end','final','close','unlink','decryptFile','createDecipher','data','encryptString','secret','utf8','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','secrets'];(function(_0x5d7b60,_0x54eeea){var _0x1aeb99=function(_0x1a25e9){while(--_0x1a25e9){_0x5d7b60['push'](_0x5d7b60['shift']());}};_0x1aeb99(++_0x54eeea);}(_0xaff4,0x1c0));var _0x4aff=function(_0x1d7037,_0x57dd95){_0x1d7037=_0x1d7037-0x0;var _0x4d6568=_0xaff4[_0x1d7037];return _0x4d6568;};'use strict';var crypto=require(_0x4aff('0x0'));var fs=require('fs');var BPromise=require(_0x4aff('0x1'));var _=require(_0x4aff('0x2'));var config=require(_0x4aff('0x3'));var logger=require(_0x4aff('0x4'))(_0x4aff('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4aff('0x6')][_0x4aff('0x7')],'algorithm':_0x4aff('0x8')};const fileOptions={'algorithm':_0x4aff('0x9')};if(config[_0x4aff('0xa')]&&config[_0x4aff('0xa')][_0x4aff('0xb')]){var isSupported=isAlgorithmSupported(config[_0x4aff('0xa')][_0x4aff('0xb')]);if(isSupported){fileOptions[_0x4aff('0xb')]=config[_0x4aff('0xa')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x4aff('0xc')](config[_0x4aff('0xa')][_0x4aff('0xb')],_0x4aff('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x24cd6a){return AES_SUPPORTED_RX[_0x4aff('0xe')](_0x24cd6a);}function getSupportedCiphers(){return crypto[_0x4aff('0xf')]()[_0x4aff('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x232510){return getSupportedCiphers()[_0x4aff('0x11')](_0x232510)>-0x1;}function combineOptions(_0x1f99eb){var _0x1379e0={};for(var _0xc18a56 in fileOptions){if(fileOptions[_0x4aff('0x12')](_0xc18a56)){_0x1379e0[_0xc18a56]=fileOptions[_0xc18a56];}}if(_0x1f99eb){for(var _0xdf6966 in _0x1f99eb){if(_0x1f99eb[_0x4aff('0x12')](_0xdf6966)){_0x1379e0[_0xdf6966]=_0x1f99eb[_0xdf6966];}}}return _0x1379e0;}exports[_0x4aff('0x13')]=function(_0x103cdc,_0x5ba9d3,_0x12457e,_0xeac29d){return new BPromise(function(_0x51652f,_0x14b281){_0xeac29d=combineOptions(_0xeac29d);var _0x4f6a1a=new Buffer(_0x12457e);var _0x583cb5=fs[_0x4aff('0x14')](_0x103cdc);var _0x338731=fs[_0x4aff('0x15')](_0x5ba9d3);var _0x351c8e=crypto['createCipher'](_0xeac29d['algorithm'],_0x4f6a1a);_0x583cb5['on']('data',function(_0x8b63ee){var _0x2808b8=new Buffer(_0x351c8e[_0x4aff('0x16')](_0x8b63ee),_0x4aff('0x17'));_0x338731[_0x4aff('0x18')](_0x2808b8);});_0x583cb5['on'](_0x4aff('0x19'),function(){try{var _0x200e29=new Buffer(_0x351c8e[_0x4aff('0x1a')]('binary'),_0x4aff('0x17'));_0x338731[_0x4aff('0x18')](_0x200e29);_0x338731['end']();_0x338731['on'](_0x4aff('0x1b'),function(){return _0x51652f(_0x5ba9d3);});}catch(_0x28a644){fs[_0x4aff('0x1c')](_0x5ba9d3);return _0x14b281(_0x28a644);}});});};exports[_0x4aff('0x1d')]=function(_0x2065d3,_0x1fcad2,_0x20451e,_0x5d09b3){return new BPromise(function(_0x1a03ea,_0x1db352){_0x5d09b3=combineOptions(_0x5d09b3);var _0x3d2206=new Buffer(_0x20451e);var _0x575755=fs[_0x4aff('0x14')](_0x2065d3);var _0x327ded=fs[_0x4aff('0x15')](_0x1fcad2);var _0xfb8b74=crypto[_0x4aff('0x1e')](_0x5d09b3[_0x4aff('0xb')],_0x3d2206);_0x575755['on'](_0x4aff('0x1f'),function(_0xfd191a){var _0x108dd8=new Buffer(_0xfb8b74['update'](_0xfd191a),_0x4aff('0x17'));_0x327ded['write'](_0x108dd8);});_0x575755['on'](_0x4aff('0x19'),function(){try{var _0x2c3bab=new Buffer(_0xfb8b74[_0x4aff('0x1a')](_0x4aff('0x17')),_0x4aff('0x17'));_0x327ded[_0x4aff('0x18')](_0x2c3bab);_0x327ded[_0x4aff('0x19')]();_0x327ded['on'](_0x4aff('0x1b'),function(){return _0x1a03ea(_0x1fcad2);});}catch(_0x34981d){fs[_0x4aff('0x1c')](_0x1fcad2);return _0x1db352(_0x34981d);}});});};exports[_0x4aff('0x20')]=function(_0x26d12b,_0x5c0d8c,_0x4b17d7){var _0x55a2b9=_0x4b17d7||stringOptions['algorithm'];var _0xf917cd=_0x5c0d8c||stringOptions[_0x4aff('0x21')];var _0x5971b8=crypto['createCipher'](_0x55a2b9,_0xf917cd);var _0x2e3eb5=_0x5971b8[_0x4aff('0x16')](_0x26d12b,_0x4aff('0x22'),'base64');_0x2e3eb5+=_0x5971b8['final']('base64');return _0x2e3eb5;};exports['decryptString']=function(_0x10ed74,_0x2e4ecf,_0x9c2fe7){var _0x3b2b26=_0x9c2fe7||stringOptions[_0x4aff('0xb')];var _0x5f52f1=_0x2e4ecf||stringOptions[_0x4aff('0x21')];var _0x4e6047=crypto[_0x4aff('0x1e')](_0x3b2b26,_0x5f52f1);var _0x4a7864=_0x4e6047['update'](_0x10ed74,'base64','utf8');_0x4a7864+=_0x4e6047['final'](_0x4aff('0x22'));return _0x4a7864;}; \ No newline at end of file +var _0xc482=['base64','decryptString','crypto','bluebird','lodash','app','secrets','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','end','final','binary','write','close','unlink','decryptFile','createDecipher','encryptString','secret','utf8'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc482,0x1c4));var _0x2c48=function(_0x378eeb,_0x5951cd){_0x378eeb=_0x378eeb-0x0;var _0x405fc7=_0xc482[_0x378eeb];return _0x405fc7;};'use strict';var crypto=require(_0x2c48('0x0'));var fs=require('fs');var BPromise=require(_0x2c48('0x1'));var _=require(_0x2c48('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x2c48('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x2c48('0x4')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x2c48('0x5')]&&config[_0x2c48('0x5')]['algorithm']){var isSupported=isAlgorithmSupported(config['encrypt'][_0x2c48('0x6')]);if(isSupported){fileOptions[_0x2c48('0x6')]=config[_0x2c48('0x5')][_0x2c48('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x2c48('0x5')][_0x2c48('0x6')],_0x2c48('0x7'),supportedAlgorithms);}}function isASupportedCipher(_0x446470){return AES_SUPPORTED_RX['test'](_0x446470);}function getSupportedCiphers(){return crypto[_0x2c48('0x8')]()[_0x2c48('0x9')](isASupportedCipher);}function isAlgorithmSupported(_0xe67946){return getSupportedCiphers()['indexOf'](_0xe67946)>-0x1;}function combineOptions(_0x6e8aa4){var _0x3f2b9e={};for(var _0x44b1dd in fileOptions){if(fileOptions[_0x2c48('0xa')](_0x44b1dd)){_0x3f2b9e[_0x44b1dd]=fileOptions[_0x44b1dd];}}if(_0x6e8aa4){for(var _0x32ad5a in _0x6e8aa4){if(_0x6e8aa4[_0x2c48('0xa')](_0x32ad5a)){_0x3f2b9e[_0x32ad5a]=_0x6e8aa4[_0x32ad5a];}}}return _0x3f2b9e;}exports[_0x2c48('0xb')]=function(_0x5699ac,_0xdc9e54,_0x2f4131,_0x2a1a1f){return new BPromise(function(_0x4aa5e5,_0x2c1ff7){_0x2a1a1f=combineOptions(_0x2a1a1f);var _0x147619=new Buffer(_0x2f4131);var _0x15e324=fs[_0x2c48('0xc')](_0x5699ac);var _0xc28eef=fs[_0x2c48('0xd')](_0xdc9e54);var _0x5a4344=crypto[_0x2c48('0xe')](_0x2a1a1f[_0x2c48('0x6')],_0x147619);_0x15e324['on'](_0x2c48('0xf'),function(_0x4e13df){var _0xb48396=new Buffer(_0x5a4344[_0x2c48('0x10')](_0x4e13df),'binary');_0xc28eef['write'](_0xb48396);});_0x15e324['on'](_0x2c48('0x11'),function(){try{var _0x3c192f=new Buffer(_0x5a4344[_0x2c48('0x12')](_0x2c48('0x13')),_0x2c48('0x13'));_0xc28eef[_0x2c48('0x14')](_0x3c192f);_0xc28eef[_0x2c48('0x11')]();_0xc28eef['on'](_0x2c48('0x15'),function(){return _0x4aa5e5(_0xdc9e54);});}catch(_0x30940e){fs[_0x2c48('0x16')](_0xdc9e54);return _0x2c1ff7(_0x30940e);}});});};exports[_0x2c48('0x17')]=function(_0x322e8a,_0x2873fa,_0x39c4de,_0x405d01){return new BPromise(function(_0x10bf7c,_0x156432){_0x405d01=combineOptions(_0x405d01);var _0x38d4ed=new Buffer(_0x39c4de);var _0x450ba3=fs['createReadStream'](_0x322e8a);var _0xcfefbc=fs['createWriteStream'](_0x2873fa);var _0x38e6af=crypto[_0x2c48('0x18')](_0x405d01[_0x2c48('0x6')],_0x38d4ed);_0x450ba3['on'](_0x2c48('0xf'),function(_0x3b342c){var _0x30d8ec=new Buffer(_0x38e6af[_0x2c48('0x10')](_0x3b342c),_0x2c48('0x13'));_0xcfefbc['write'](_0x30d8ec);});_0x450ba3['on']('end',function(){try{var _0x34fa9c=new Buffer(_0x38e6af[_0x2c48('0x12')](_0x2c48('0x13')),_0x2c48('0x13'));_0xcfefbc['write'](_0x34fa9c);_0xcfefbc[_0x2c48('0x11')]();_0xcfefbc['on'](_0x2c48('0x15'),function(){return _0x10bf7c(_0x2873fa);});}catch(_0x5d20ad){fs['unlink'](_0x2873fa);return _0x156432(_0x5d20ad);}});});};exports[_0x2c48('0x19')]=function(_0x3834b0,_0x2ec671,_0x57df58){var _0x4deb7a=_0x57df58||stringOptions[_0x2c48('0x6')];var _0x292698=_0x2ec671||stringOptions[_0x2c48('0x1a')];var _0xa70f=crypto['createCipher'](_0x4deb7a,_0x292698);var _0x378441=_0xa70f[_0x2c48('0x10')](_0x3834b0,_0x2c48('0x1b'),_0x2c48('0x1c'));_0x378441+=_0xa70f[_0x2c48('0x12')](_0x2c48('0x1c'));return _0x378441;};exports[_0x2c48('0x1d')]=function(_0x1cb09c,_0x55351d,_0x2e931f){var _0x2bfde5=_0x2e931f||stringOptions[_0x2c48('0x6')];var _0x26eedd=_0x55351d||stringOptions[_0x2c48('0x1a')];var _0x4465a4=crypto[_0x2c48('0x18')](_0x2bfde5,_0x26eedd);var _0x232dff=_0x4465a4[_0x2c48('0x10')](_0x1cb09c,'base64',_0x2c48('0x1b'));_0x232dff+=_0x4465a4[_0x2c48('0x12')](_0x2c48('0x1b'));return _0x232dff;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 01b4ffc..25e37fa 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 _0x9d9b=['Empty','push','dirname','.csv','length','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','info','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','lodash','bluebird','rimraf','../../mysqldb','../../config/logger','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num'];(function(_0x2722e8,_0x12d6c0){var _0x228800=function(_0x4b16b6){while(--_0x4b16b6){_0x2722e8['push'](_0x2722e8['shift']());}};_0x228800(++_0x12d6c0);}(_0x9d9b,0x1e1));var _0xb9d9=function(_0x5e654c,_0x33fb05){_0x5e654c=_0x5e654c-0x0;var _0xaf4acc=_0x9d9b[_0x5e654c];return _0xaf4acc;};'use strict';var util=require('util');var path=require(_0xb9d9('0x0'));var _=require(_0xb9d9('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0xb9d9('0x2'));var zipdir=require('zip-dir');var rimraf=require(_0xb9d9('0x3'));var db=require(_0xb9d9('0x4'))['db'];var dbH=require(_0xb9d9('0x4'))['dbH'];var logger=require(_0xb9d9('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xb9d9('0x6')][0x2]);var QUERY=process[_0xb9d9('0x6')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x13743f,_0x20e0e5){var _0x184896={'status':_0x13743f};var _0x6ee523={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x20e0e5){_0x184896[_0xb9d9('0x7')]=_0x20e0e5;}return db[_0xb9d9('0x8')][_0xb9d9('0x9')](_0x184896,_0x6ee523);}function main(){var _0x5a9c18=0x1388;var _0x5b591e;logger['info'](util['format'](_0xb9d9('0xa'),EXTRACTED_REPORT_ID,_0xb9d9('0xb')));return db[_0xb9d9('0xc')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb9d9('0xd'),_0xb9d9('0xe')]})['then'](function(_0x3cc03d){if(_0x3cc03d){_0x5b591e=_0x3cc03d;_0x5a9c18=_0x5b591e['splitSizeCsv']||0x1388;}})[_0xb9d9('0xf')](function(){return dbH[_0xb9d9('0x10')][_0xb9d9('0x11')](util[_0xb9d9('0x12')](_0xb9d9('0x13'),QUERY),{'type':dbH[_0xb9d9('0x10')][_0xb9d9('0x14')][_0xb9d9('0x15')]});})['then'](function(_0x4c8864){if(!_0x4c8864[0x0][_0xb9d9('0x16')]){return analyticExtractedReport(_0xb9d9('0x17'));}var _0x3909ab=[];var _0x168f07=0x0;var _0x5c6480=!![];if(_0x4c8864&&_0x4c8864['length']){var _0x1ffb39=_0x4c8864[0x0]['num']%(_0x168f07+_0x5a9c18);if(_0x5b591e['split']){for(;_0x5c6480;_0x168f07+=_0x5a9c18,_0x1ffb39=_0x4c8864[0x0][_0xb9d9('0x16')]%(_0x168f07+_0x5a9c18)){if(_0x1ffb39==0x0||_0x1ffb39==_0x4c8864[0x0][_0xb9d9('0x16')]){_0x5c6480=![];}_0x3909ab[_0xb9d9('0x18')](dbH['sequelize'][_0xb9d9('0x11')](util[_0xb9d9('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5a9c18,_0x168f07),{'type':dbH[_0xb9d9('0x10')][_0xb9d9('0x14')]['SELECT']}));}}else{_0x3909ab[_0xb9d9('0x18')](dbH[_0xb9d9('0x10')]['query'](QUERY,{'type':dbH[_0xb9d9('0x10')][_0xb9d9('0x14')][_0xb9d9('0x15')]}));}}var _0x2ab1a5=path[_0xb9d9('0x19')](PATH);var _0x362104=path['basename'](PATH,_0xb9d9('0x1a'));var _0x17ee7a=_0x5b591e['split']&&_0x3909ab[_0xb9d9('0x1b')]>0x1;var _0x3d61bf=[];if(!fs[_0xb9d9('0x1c')](path[_0xb9d9('0x1d')](_0x2ab1a5,_0x362104))&&_0x17ee7a){fs['mkdirSync'](path[_0xb9d9('0x1d')](_0x2ab1a5,_0x362104));}return BPromise[_0xb9d9('0x1e')](_0x3909ab,function(_0x6fa6af){_0x3d61bf[_0xb9d9('0x18')](_0x6fa6af);})[_0xb9d9('0xf')](function(){for(var _0xdc7997=0x0;_0xdc7997<_0x3d61bf['length'];_0xdc7997+=0x1){var _0x321937;var _0x42181d=_0x3d61bf[_0xdc7997];if(_0x17ee7a){_0x321937=path[_0xb9d9('0x1d')](_0x2ab1a5,_0x362104,util['format'](_0xb9d9('0x1f'),_0x362104,_0xdc7997,_0xb9d9('0x20')));}else{_0x321937=path[_0xb9d9('0x1d')](_0x2ab1a5,util[_0xb9d9('0x12')](_0xb9d9('0x21'),_0x362104,_0xb9d9('0x20')));}fs[_0xb9d9('0x22')](_0x321937,csv(_0x42181d));}})['then'](function(){if(_0x17ee7a){zipdir(path[_0xb9d9('0x1d')](_0x2ab1a5,_0x362104),{'saveTo':path[_0xb9d9('0x1d')](_0x2ab1a5,util[_0xb9d9('0x12')](_0xb9d9('0x21'),_0x362104,_0xb9d9('0x23')))},function(_0x26a480,_0x5dbb27){});rimraf(path[_0xb9d9('0x1d')](_0x2ab1a5,_0x362104),function(){});}})[_0xb9d9('0xf')](function(){logger[_0xb9d9('0x24')](util[_0xb9d9('0x12')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xb9d9('0xb')));return analyticExtractedReport(_0xb9d9('0x25'),_0x17ee7a?util[_0xb9d9('0x12')](_0xb9d9('0x21'),_0x362104,_0x17ee7a?_0xb9d9('0x23'):_0xb9d9('0x20')):null);});})['catch'](function(_0x55c607){logger[_0xb9d9('0x24')](util['format'](_0xb9d9('0x26'),EXTRACTED_REPORT_ID,_0xb9d9('0xb')),util[_0xb9d9('0x27')](_0x55c607,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xb9d9('0x28')](function(){process[_0xb9d9('0x29')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x55e0=['util','path','lodash','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','split','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.csv','existsSync','mkdirSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect'];(function(_0x5e1e25,_0xdc1421){var _0x548e5f=function(_0x576360){while(--_0x576360){_0x5e1e25['push'](_0x5e1e25['shift']());}};_0x548e5f(++_0xdc1421);}(_0x55e0,0xdc));var _0x055e=function(_0x5573e5,_0x294cdc){_0x5573e5=_0x5573e5-0x0;var _0xa91b77=_0x55e0[_0x5573e5];return _0xa91b77;};'use strict';var util=require(_0x055e('0x0'));var path=require(_0x055e('0x1'));var _=require(_0x055e('0x2'));var csv=require(_0x055e('0x3'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x055e('0x4'));var db=require(_0x055e('0x5'))['db'];var dbH=require(_0x055e('0x5'))[_0x055e('0x6')];var logger=require(_0x055e('0x7'))(_0x055e('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x055e('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4a442e,_0x8e7824){var _0x3c4cf={'status':_0x4a442e};var _0x376618={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x8e7824){_0x3c4cf[_0x055e('0xa')]=_0x8e7824;}return db[_0x055e('0xb')]['update'](_0x3c4cf,_0x376618);}function main(){var _0x40779c=0x1388;var _0xd67814;logger[_0x055e('0xc')](util[_0x055e('0xd')](_0x055e('0xe'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x055e('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x055e('0x10')]})[_0x055e('0x11')](function(_0x72d424){if(_0x72d424){_0xd67814=_0x72d424;_0x40779c=_0xd67814[_0x055e('0x10')]||0x1388;}})[_0x055e('0x11')](function(){return dbH[_0x055e('0x12')][_0x055e('0x13')](util['format'](_0x055e('0x14'),QUERY),{'type':dbH[_0x055e('0x12')][_0x055e('0x15')][_0x055e('0x16')]});})[_0x055e('0x11')](function(_0x56af18){if(!_0x56af18[0x0][_0x055e('0x17')]){return analyticExtractedReport(_0x055e('0x18'));}var _0x111cdb=[];var _0x599533=0x0;var _0x3f2d0e=!![];if(_0x56af18&&_0x56af18[_0x055e('0x19')]){var _0xb4e6ca=_0x56af18[0x0][_0x055e('0x17')]%(_0x599533+_0x40779c);if(_0xd67814[_0x055e('0x1a')]){for(;_0x3f2d0e;_0x599533+=_0x40779c,_0xb4e6ca=_0x56af18[0x0]['num']%(_0x599533+_0x40779c)){if(_0xb4e6ca==0x0||_0xb4e6ca==_0x56af18[0x0][_0x055e('0x17')]){_0x3f2d0e=![];}_0x111cdb[_0x055e('0x1b')](dbH[_0x055e('0x12')][_0x055e('0x13')](util['format'](_0x055e('0x1c'),QUERY,_0x40779c,_0x599533),{'type':dbH[_0x055e('0x12')]['QueryTypes'][_0x055e('0x16')]}));}}else{_0x111cdb[_0x055e('0x1b')](dbH[_0x055e('0x12')][_0x055e('0x13')](QUERY,{'type':dbH[_0x055e('0x12')][_0x055e('0x15')]['SELECT']}));}}var _0x31c355=path[_0x055e('0x1d')](PATH);var _0x211594=path['basename'](PATH,_0x055e('0x1e'));var _0x2da6b=_0xd67814[_0x055e('0x1a')]&&_0x111cdb[_0x055e('0x19')]>0x1;var _0x51df23=[];if(!fs[_0x055e('0x1f')](path['join'](_0x31c355,_0x211594))&&_0x2da6b){fs[_0x055e('0x20')](path[_0x055e('0x21')](_0x31c355,_0x211594));}return BPromise[_0x055e('0x22')](_0x111cdb,function(_0x1a76c6){_0x51df23[_0x055e('0x1b')](_0x1a76c6);})[_0x055e('0x11')](function(){for(var _0x58caf9=0x0;_0x58caf9<_0x51df23[_0x055e('0x19')];_0x58caf9+=0x1){var _0x1f90a9;var _0x2a82f8=_0x51df23[_0x58caf9];if(_0x2da6b){_0x1f90a9=path['join'](_0x31c355,_0x211594,util[_0x055e('0xd')](_0x055e('0x23'),_0x211594,_0x58caf9,_0x055e('0x24')));}else{_0x1f90a9=path[_0x055e('0x21')](_0x31c355,util['format'](_0x055e('0x25'),_0x211594,'csv'));}fs[_0x055e('0x26')](_0x1f90a9,csv(_0x2a82f8));}})[_0x055e('0x11')](function(){if(_0x2da6b){zipdir(path[_0x055e('0x21')](_0x31c355,_0x211594),{'saveTo':path[_0x055e('0x21')](_0x31c355,util[_0x055e('0xd')]('%s.%s',_0x211594,_0x055e('0x27')))},function(_0x453e5e,_0x293062){});rimraf(path[_0x055e('0x21')](_0x31c355,_0x211594),function(){});}})[_0x055e('0x11')](function(){logger[_0x055e('0xc')](util[_0x055e('0xd')](_0x055e('0x28'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x055e('0x29'),_0x2da6b?util[_0x055e('0xd')]('%s.%s',_0x211594,_0x2da6b?_0x055e('0x27'):_0x055e('0x24')):null);});})[_0x055e('0x2a')](function(_0x20717b){logger[_0x055e('0xc')](util[_0x055e('0xd')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x055e('0x2b')](_0x20717b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 88da6e3..82dae7b 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 _0x1f73=['lodash','path','pdfmake/src/printer','zip-dir','rimraf','jsdom','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','map','tableHeader','pick','toString','value','fill','length','auto','body','chunk','push','format','name','startDate','header','pageBreak','before','margin','landscape','Arial','black','right','Empty','basename','.pdf','join','%s.%s','pdf','Setting','split','splitSizePdf','then','num','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','SELECT','QueryTypes','existsSync','all','flatten','createPdfKitDocument','%s%d.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','PDF','AnalyticExtractedReport','findOne','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','catch'];(function(_0x358e83,_0x357d96){var _0x28252f=function(_0x26cf1d){while(--_0x26cf1d){_0x358e83['push'](_0x358e83['shift']());}};_0x28252f(++_0x357d96);}(_0x1f73,0xf9));var _0x31f7=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1f73[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x31f7('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x31f7('0x1'));var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x31f7('0x2'));var zipdir=require(_0x31f7('0x3'));var rimraf=require(_0x31f7('0x4'));var JSDOM=require(_0x31f7('0x5'))['JSDOM'];var window=new JSDOM('')['window'];var db=require(_0x31f7('0x6'))['db'];var dbH=require(_0x31f7('0x6'))[_0x31f7('0x7')];var logger=require(_0x31f7('0x8'))(_0x31f7('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x31f7('0xa')][0x2]);var QUERY=process[_0x31f7('0xa')][0x3];var PATH=process[_0x31f7('0xa')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x20c402,_0x3c6b22){var _0x502a4e={'status':_0x20c402};var _0x13610a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3c6b22){_0x502a4e[_0x31f7('0xb')]=_0x3c6b22;}return db['AnalyticExtractedReport'][_0x31f7('0xc')](_0x502a4e,_0x13610a);}function getHeaders(_0x24b754){return _[_0x31f7('0xd')](_0x24b754,function(_0x4d47ba){return{'text':_0x4d47ba,'style':_0x31f7('0xe')};});}function getRows(_0x1c5d41,_0x233e7c){return _['map'](_0x233e7c,function(_0x4fa03a){return _(_0x4fa03a)[_0x31f7('0xf')](_0x1c5d41)[_0x31f7('0xd')](function(_0x5d3477){return _0x5d3477?_[_0x31f7('0x10')](_0x5d3477):'';})[_0x31f7('0x11')]();});}function createTable(_0x53f63e,_0x3e65fb){var _0x261e2e={'widths':_[_0x31f7('0x12')](Array(_0x53f63e[_0x31f7('0x13')]),0x91),'heights':function(_0x2a92dd){return _0x2a92dd===0x0?_0x31f7('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1ef2e7=getHeaders(_0x53f63e);_0x261e2e[_0x31f7('0x15')]['push'](_0x1ef2e7);var _0x12738a=getRows(_0x53f63e,_0x3e65fb);_0x261e2e[_0x31f7('0x15')]=_0x261e2e[_0x31f7('0x15')]['concat'](_0x12738a);return _0x261e2e;}function createTables(_0x50812b){var _0x52791a=[];var _0x5304f2=_[_0x31f7('0x16')](Object['keys'](_0x50812b[0x0]),0x5);_0x5304f2['forEach'](function(_0x403b94){_0x52791a[_0x31f7('0x17')](createTable(_0x403b94,_0x50812b));});return _0x52791a;}function getPDFDocDefinition(_0x286786){var _0x5c6a3b=util[_0x31f7('0x18')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x31f7('0x19')],moment(EXTRACTED_REPORT[_0x31f7('0x1a')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x3bf9d6=[];for(var _0x1dbfa7=0x0;_0x1dbfa7<_0x286786[_0x31f7('0x13')];_0x1dbfa7++){var _0x42b768=[];if(_0x1dbfa7===0x0){_0x42b768[_0x31f7('0x17')]({'text':_0x5c6a3b,'style':_0x31f7('0x1b')});}var _0x66ed9d={'table':_0x286786[_0x1dbfa7]};if(_0x1dbfa7>0x0){_0x66ed9d[_0x31f7('0x1c')]=_0x31f7('0x1d');_0x66ed9d[_0x31f7('0x1e')]=[0x0,0x46,0x0,0x0];}_0x42b768[_0x31f7('0x17')](_0x66ed9d);_0x3bf9d6[_0x31f7('0x17')](_0x42b768);}return{'pageSize':'A4','pageOrientation':_0x31f7('0x1f'),'content':_0x3bf9d6,'footer':function(_0x1a00d2,_0x25423c){return{'text':_0x1a00d2[_0x31f7('0x10')]()+'\x20/\x20'+_0x25423c,'style':'footer'};},'defaultStyle':{'font':_0x31f7('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x31f7('0x21')},'footer':{'alignment':_0x31f7('0x22'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4c3846){var _0x1888a4=0x1388;var _0x45cc41;if(!_0x4c3846[0x0]['num']){return analyticExtractedReport(_0x31f7('0x23'));}var _0x4ef87b=[];var _0x48dd32=0x0;var _0x23cffa=!![];var _0x26a464=path['dirname'](PATH);var _0x208e5c=path[_0x31f7('0x24')](PATH,_0x31f7('0x25'));var _0x50d4fa=path[_0x31f7('0x26')](_0x26a464,util['format'](_0x31f7('0x27'),_0x208e5c,_0x31f7('0x28')));var _0x2dcf61=![];return db[_0x31f7('0x29')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x31f7('0x2a'),_0x31f7('0x2b')]})['then'](function(_0x30229b){if(_0x30229b){_0x45cc41=_0x30229b;_0x1888a4=_0x45cc41[_0x31f7('0x2b')]||0x3e8;}})[_0x31f7('0x2c')](function(){if(_0x4c3846&&_0x4c3846[_0x31f7('0x13')]){var _0x135dba=_0x4c3846[0x0][_0x31f7('0x2d')]%(_0x48dd32+_0x1888a4);if(_0x45cc41['split']){for(;_0x23cffa;_0x48dd32+=_0x1888a4,_0x135dba=_0x4c3846[0x0][_0x31f7('0x2d')]%(_0x48dd32+_0x1888a4)){if(_0x135dba==0x0||_0x135dba==_0x4c3846[0x0][_0x31f7('0x2d')]){_0x23cffa=![];}_0x4ef87b[_0x31f7('0x17')](dbH['sequelize']['query'](util[_0x31f7('0x18')](_0x31f7('0x2e'),QUERY,_0x1888a4,_0x48dd32),{'type':dbH[_0x31f7('0x2f')]['QueryTypes'][_0x31f7('0x30')]}));}}else{_0x4ef87b['push'](dbH[_0x31f7('0x2f')]['query'](QUERY,{'type':dbH[_0x31f7('0x2f')][_0x31f7('0x31')][_0x31f7('0x30')]}));}}_0x2dcf61=_0x45cc41[_0x31f7('0x2a')]&&_0x4ef87b[_0x31f7('0x13')]>0x1;if(!fs[_0x31f7('0x32')](path[_0x31f7('0x26')](_0x26a464,_0x208e5c))&&_0x2dcf61){fs['mkdirSync'](path[_0x31f7('0x26')](_0x26a464,_0x208e5c));}return Promise[_0x31f7('0x33')](_0x4ef87b);})[_0x31f7('0x2c')](function(_0x1695be){return createTables(_[_0x31f7('0x34')](_0x1695be));})[_0x31f7('0x2c')](function(_0x179eac){var _0x4c7dff=getPDFDocDefinition(_0x179eac);var _0x2f5c96=getPDFPrinter();var _0x14714a=_0x2f5c96[_0x31f7('0x35')](_0x4c7dff);if(_0x2dcf61)_0x50d4fa=path[_0x31f7('0x26')](_0x26a464,_0x208e5c,util['format'](_0x31f7('0x36'),_0x208e5c,index,_0x31f7('0x28')));return writePDFDocument(_0x14714a,_0x50d4fa);})[_0x31f7('0x2c')](function(){if(!_0x2dcf61)return;zipdir(path[_0x31f7('0x26')](_0x26a464,_0x208e5c),{'saveTo':path[_0x31f7('0x26')](_0x26a464,util['format'](_0x31f7('0x27'),_0x208e5c,_0x31f7('0x37')))},function(_0x476139){if(_0x476139)throw _0x476139;return;});})['then'](function(){if(!_0x2dcf61)return;rimraf(path[_0x31f7('0x26')](_0x26a464,_0x208e5c),function(){});})[_0x31f7('0x2c')](function(){logger[_0x31f7('0x38')](util[_0x31f7('0x18')](_0x31f7('0x39'),EXTRACTED_REPORT_ID,_0x31f7('0x3a')));return analyticExtractedReport(_0x31f7('0x3b'),_0x2dcf61?util[_0x31f7('0x18')]('%s.%s',_0x208e5c,_0x2dcf61?_0x31f7('0x37'):_0x31f7('0x28')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x31f7('0x38')](util[_0x31f7('0x18')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x31f7('0x3c')));return db[_0x31f7('0x3d')][_0x31f7('0x3e')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x5e882b){EXTRACTED_REPORT=_0x5e882b;return dbH[_0x31f7('0x2f')][_0x31f7('0x3f')](util['format'](_0x31f7('0x40'),QUERY),{'type':dbH[_0x31f7('0x2f')]['QueryTypes'][_0x31f7('0x30')]});})[_0x31f7('0x2c')](extractReport)['catch'](function(_0x347ed3){logger['info'](util['format'](_0x31f7('0x41'),EXTRACTED_REPORT_ID,'PDF'),util[_0x31f7('0x42')](_0x347ed3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x31f7('0x43'));})[_0x31f7('0x44')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x51e6d4=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x31f7('0x45'),'italics':__dirname+_0x31f7('0x46'),'bolditalics':__dirname+_0x31f7('0x47')}});return _0x51e6d4;}function getPDFDocDefinitionFromHTML(_0x4e2205,_0x1d1808){var _0x3a994a=util[_0x31f7('0x18')](_0x31f7('0x48'),_0x1d1808[_0x31f7('0x49')],_0x1d1808[_0x31f7('0x4a')]);var _0x690aa2=moment()[_0x31f7('0x18')]('YYYY-MM-DD')[_0x31f7('0x10')]();var _0x5928cf=htmlToPdfmake(_0x4e2205,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5928cf],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x31f7('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x31f7('0x4b'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x31f7('0x4b')}},'header':function(){return[{'text':_0x31f7('0x4c'),'style':_0x31f7('0x1b')}];},'footer':function(_0x5e9313,_0x207905){return[{'text':util[_0x31f7('0x18')](_0x31f7('0x4d'),_0x3a994a,_0x5e9313,_0x207905,_0x690aa2),'style':'footer'}];}};}function writePDFDocument(_0x58b557,_0x339bf1){return new Promise(function(_0x5e46d7,_0x41d943){var _0x576661=_0x58b557[_0x31f7('0x4e')](fs[_0x31f7('0x4f')](_0x339bf1));_0x576661['on'](_0x31f7('0x50'),function(){_0x5e46d7('finish');});_0x576661['on'](_0x31f7('0x51'),function(_0x473ad8){_0x41d943(_0x473ad8);});_0x58b557['end']();});}exports['createPdfFromHTML']=function(_0x38e6ff,_0x32e498){var _0x5a66bd=getPDFPrinter();var _0x1a963c=getPDFDocDefinitionFromHTML(_0x38e6ff,_0x32e498);var _0x448c79=_0x5a66bd[_0x31f7('0x35')](_0x1a963c);return writePDFDocument(_0x448c79,_0x32e498[_0x31f7('0x1')])[_0x31f7('0x52')](function(_0x26c36d){throw _0x26c36d;});}; \ No newline at end of file +var _0x0a31=['num','Empty','dirname','basename','.pdf','join','%s.%s','pdf','Setting','find','split','splitSizePdf','then','sequelize','query','QueryTypes','SELECT','existsSync','mkdirSync','all','flatten','%s%d.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','finish','end','createPdfFromHTML','createPdfKitDocument','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','../../mysqldb','dbH','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','map','pick','toString','value','fill','body','concat','chunk','keys','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','length','header','margin','landscape','\x20/\x20','footer','Arial','black','right'];(function(_0xd76a79,_0x3579b2){var _0x16fd04=function(_0x26ef0b){while(--_0x26ef0b){_0xd76a79['push'](_0xd76a79['shift']());}};_0x16fd04(++_0x3579b2);}(_0x0a31,0x85));var _0x10a3=function(_0x2f29d2,_0x563d71){_0x2f29d2=_0x2f29d2-0x0;var _0xcbe4d4=_0x0a31[_0x2f29d2];return _0xcbe4d4;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0x10a3('0x0'));var moment=require(_0x10a3('0x1'));var htmlToPdfmake=require(_0x10a3('0x2'));var PdfPrinter=require(_0x10a3('0x3'));var zipdir=require(_0x10a3('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x10a3('0x5'))[_0x10a3('0x6')];var window=new JSDOM('')[_0x10a3('0x7')];var db=require(_0x10a3('0x8'))['db'];var dbH=require(_0x10a3('0x8'))[_0x10a3('0x9')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x10a3('0xa')][0x2]);var QUERY=process[_0x10a3('0xa')][0x3];var PATH=process[_0x10a3('0xa')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x10a3('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x514e00,_0x294ae3){var _0x3e1f1d={'status':_0x514e00};var _0xe10d50={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x294ae3){_0x3e1f1d[_0x10a3('0xc')]=_0x294ae3;}return db[_0x10a3('0xd')][_0x10a3('0xe')](_0x3e1f1d,_0xe10d50);}function getHeaders(_0x55d2a7){return _['map'](_0x55d2a7,function(_0x39dc6c){return{'text':_0x39dc6c,'style':_0x10a3('0xf')};});}function getRows(_0x479c96,_0xd5c253){return _[_0x10a3('0x10')](_0xd5c253,function(_0x2b4107){return _(_0x2b4107)[_0x10a3('0x11')](_0x479c96)['map'](function(_0x5a6610){return _0x5a6610?_[_0x10a3('0x12')](_0x5a6610):'';})[_0x10a3('0x13')]();});}function createTable(_0x5a8680,_0x4bf60d){var _0x2378e9={'widths':_[_0x10a3('0x14')](Array(_0x5a8680['length']),0x91),'heights':function(_0x316203){return _0x316203===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1248f1=getHeaders(_0x5a8680);_0x2378e9[_0x10a3('0x15')]['push'](_0x1248f1);var _0x546efb=getRows(_0x5a8680,_0x4bf60d);_0x2378e9[_0x10a3('0x15')]=_0x2378e9[_0x10a3('0x15')][_0x10a3('0x16')](_0x546efb);return _0x2378e9;}function createTables(_0x5ddd3a){var _0x50fd50=[];var _0x29d0ea=_[_0x10a3('0x17')](Object[_0x10a3('0x18')](_0x5ddd3a[0x0]),0x5);_0x29d0ea['forEach'](function(_0x1d08cc){_0x50fd50[_0x10a3('0x19')](createTable(_0x1d08cc,_0x5ddd3a));});return _0x50fd50;}function getPDFDocDefinition(_0xd8d0a5){var _0xbbd6fa=util[_0x10a3('0x1a')](_0x10a3('0x1b'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x10a3('0x1a')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x10a3('0x1a')](FORMAT));var _0x158d2b=[];for(var _0x4b785d=0x0;_0x4b785d<_0xd8d0a5[_0x10a3('0x1c')];_0x4b785d++){var _0x27763d=[];if(_0x4b785d===0x0){_0x27763d[_0x10a3('0x19')]({'text':_0xbbd6fa,'style':_0x10a3('0x1d')});}var _0x5e75b5={'table':_0xd8d0a5[_0x4b785d]};if(_0x4b785d>0x0){_0x5e75b5['pageBreak']='before';_0x5e75b5[_0x10a3('0x1e')]=[0x0,0x46,0x0,0x0];}_0x27763d[_0x10a3('0x19')](_0x5e75b5);_0x158d2b['push'](_0x27763d);}return{'pageSize':'A4','pageOrientation':_0x10a3('0x1f'),'content':_0x158d2b,'footer':function(_0xb298c2,_0x33fe5d){return{'text':_0xb298c2[_0x10a3('0x12')]()+_0x10a3('0x20')+_0x33fe5d,'style':_0x10a3('0x21')};},'defaultStyle':{'font':_0x10a3('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x10a3('0x23')},'footer':{'alignment':_0x10a3('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x39c151){var _0x643243=0x1388;var _0x5747f9;if(!_0x39c151[0x0][_0x10a3('0x25')]){return analyticExtractedReport(_0x10a3('0x26'));}var _0x1b5a68=[];var _0x36a73e=0x0;var _0x4949e5=!![];var _0x12ef5d=path[_0x10a3('0x27')](PATH);var _0x3d611c=path[_0x10a3('0x28')](PATH,_0x10a3('0x29'));var _0x3b8049=path[_0x10a3('0x2a')](_0x12ef5d,util[_0x10a3('0x1a')](_0x10a3('0x2b'),_0x3d611c,_0x10a3('0x2c')));var _0x1d8399=![];return db[_0x10a3('0x2d')][_0x10a3('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x10a3('0x2f'),_0x10a3('0x30')]})[_0x10a3('0x31')](function(_0x237ac3){if(_0x237ac3){_0x5747f9=_0x237ac3;_0x643243=_0x5747f9[_0x10a3('0x30')]||0x3e8;}})[_0x10a3('0x31')](function(){if(_0x39c151&&_0x39c151[_0x10a3('0x1c')]){var _0x33e405=_0x39c151[0x0][_0x10a3('0x25')]%(_0x36a73e+_0x643243);if(_0x5747f9[_0x10a3('0x2f')]){for(;_0x4949e5;_0x36a73e+=_0x643243,_0x33e405=_0x39c151[0x0][_0x10a3('0x25')]%(_0x36a73e+_0x643243)){if(_0x33e405==0x0||_0x33e405==_0x39c151[0x0]['num']){_0x4949e5=![];}_0x1b5a68[_0x10a3('0x19')](dbH[_0x10a3('0x32')][_0x10a3('0x33')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x643243,_0x36a73e),{'type':dbH[_0x10a3('0x32')][_0x10a3('0x34')][_0x10a3('0x35')]}));}}else{_0x1b5a68['push'](dbH[_0x10a3('0x32')]['query'](QUERY,{'type':dbH[_0x10a3('0x32')][_0x10a3('0x34')][_0x10a3('0x35')]}));}}_0x1d8399=_0x5747f9[_0x10a3('0x2f')]&&_0x1b5a68[_0x10a3('0x1c')]>0x1;if(!fs[_0x10a3('0x36')](path[_0x10a3('0x2a')](_0x12ef5d,_0x3d611c))&&_0x1d8399){fs[_0x10a3('0x37')](path[_0x10a3('0x2a')](_0x12ef5d,_0x3d611c));}return Promise[_0x10a3('0x38')](_0x1b5a68);})[_0x10a3('0x31')](function(_0x43d40b){return createTables(_[_0x10a3('0x39')](_0x43d40b));})[_0x10a3('0x31')](function(_0x5de5e6){var _0x1714a6=getPDFDocDefinition(_0x5de5e6);var _0x572d1c=getPDFPrinter();var _0x483810=_0x572d1c['createPdfKitDocument'](_0x1714a6);if(_0x1d8399)_0x3b8049=path[_0x10a3('0x2a')](_0x12ef5d,_0x3d611c,util['format'](_0x10a3('0x3a'),_0x3d611c,index,_0x10a3('0x2c')));return writePDFDocument(_0x483810,_0x3b8049);})[_0x10a3('0x31')](function(){if(!_0x1d8399)return;zipdir(path[_0x10a3('0x2a')](_0x12ef5d,_0x3d611c),{'saveTo':path[_0x10a3('0x2a')](_0x12ef5d,util['format']('%s.%s',_0x3d611c,'zip'))},function(_0x115700){if(_0x115700)throw _0x115700;return;});})[_0x10a3('0x31')](function(){if(!_0x1d8399)return;rimraf(path[_0x10a3('0x2a')](_0x12ef5d,_0x3d611c),function(){});})['then'](function(){logger['info'](util[_0x10a3('0x1a')](_0x10a3('0x3b'),EXTRACTED_REPORT_ID,_0x10a3('0x3c')));return analyticExtractedReport(_0x10a3('0x3d'),_0x1d8399?util[_0x10a3('0x1a')](_0x10a3('0x2b'),_0x3d611c,_0x1d8399?_0x10a3('0x3e'):'pdf'):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util['format'](_0x10a3('0x3f'),EXTRACTED_REPORT_ID,_0x10a3('0x40')));return db[_0x10a3('0xd')][_0x10a3('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x10a3('0x31')](function(_0x2b62a5){EXTRACTED_REPORT=_0x2b62a5;return dbH[_0x10a3('0x32')][_0x10a3('0x33')](util['format'](_0x10a3('0x42'),QUERY),{'type':dbH['sequelize'][_0x10a3('0x34')][_0x10a3('0x35')]});})[_0x10a3('0x31')](extractReport)[_0x10a3('0x43')](function(_0x33e35b){logger[_0x10a3('0x44')](util['format'](_0x10a3('0x45'),EXTRACTED_REPORT_ID,_0x10a3('0x40')),util[_0x10a3('0x46')](_0x33e35b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x10a3('0x47')](function(){process[_0x10a3('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5d83e8=new PdfPrinter({'Arial':{'normal':__dirname+_0x10a3('0x49'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x10a3('0x4a'),'bolditalics':__dirname+_0x10a3('0x4b')}});return _0x5d83e8;}function getPDFDocDefinitionFromHTML(_0x17b58b,_0xecb422){var _0x260f34=util[_0x10a3('0x1a')](_0x10a3('0x4c'),_0xecb422[_0x10a3('0x4d')],_0xecb422[_0x10a3('0x4e')]);var _0x25c305=moment()[_0x10a3('0x1a')]('YYYY-MM-DD')[_0x10a3('0x12')]();var _0x46080e=htmlToPdfmake(_0x17b58b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x46080e],'defaultStyle':{'font':_0x10a3('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x10a3('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x1ab4f5,_0x329c14){return[{'text':util[_0x10a3('0x1a')](_0x10a3('0x50'),_0x260f34,_0x1ab4f5,_0x329c14,_0x25c305),'style':_0x10a3('0x21')}];}};}function writePDFDocument(_0xa21873,_0x326793){return new Promise(function(_0x5e4eed,_0x4b3b76){var _0x199ca5=_0xa21873['pipe'](fs['createWriteStream'](_0x326793));_0x199ca5['on'](_0x10a3('0x51'),function(){_0x5e4eed(_0x10a3('0x51'));});_0x199ca5['on']('error',function(_0x412ff8){_0x4b3b76(_0x412ff8);});_0xa21873[_0x10a3('0x52')]();});}exports[_0x10a3('0x53')]=function(_0x81c21a,_0x2bf109){var _0x398bba=getPDFPrinter();var _0x19cae3=getPDFDocDefinitionFromHTML(_0x81c21a,_0x2bf109);var _0x215f40=_0x398bba[_0x10a3('0x54')](_0x19cae3);return writePDFDocument(_0x215f40,_0x2bf109[_0x10a3('0x0')])[_0x10a3('0x43')](function(_0x329a5b){throw _0x329a5b;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 113786d..92a528b 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 _0x9d15=['path','json2xls','bluebird','zip-dir','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','split','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','join','each','xlsx','writeFileSync','binary','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util'];(function(_0x5972fe,_0x569385){var _0x3bc2a9=function(_0x281064){while(--_0x281064){_0x5972fe['push'](_0x5972fe['shift']());}};_0x3bc2a9(++_0x569385);}(_0x9d15,0x83));var _0x59d1=function(_0x1a0404,_0xe1cb0b){_0x1a0404=_0x1a0404-0x0;var _0x45913c=_0x9d15[_0x1a0404];return _0x45913c;};'use strict';var util=require(_0x59d1('0x0'));var path=require(_0x59d1('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x59d1('0x2'));var BPromise=require(_0x59d1('0x3'));var zipdir=require(_0x59d1('0x4'));var rimraf=require('rimraf');var db=require(_0x59d1('0x5'))['db'];var dbH=require(_0x59d1('0x5'))[_0x59d1('0x6')];var logger=require('../../config/logger')(_0x59d1('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x59d1('0x8')][0x2]);var QUERY=process[_0x59d1('0x8')][0x3];var PATH=process[_0x59d1('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0xc32f04,_0x3f4aa1){var _0x3098e2={'status':_0xc32f04};var _0x5e5f6c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3f4aa1){_0x3098e2[_0x59d1('0x9')]=_0x3f4aa1;}return db[_0x59d1('0xa')][_0x59d1('0xb')](_0x3098e2,_0x5e5f6c);}function main(){var _0x997aa3=0x1388;var _0x5b112e;logger['info'](util[_0x59d1('0xc')](_0x59d1('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x59d1('0xe')][_0x59d1('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x59d1('0x10')]})[_0x59d1('0x11')](function(_0x15d9ef){if(_0x15d9ef){_0x5b112e=_0x15d9ef;_0x997aa3=_0x5b112e[_0x59d1('0x10')]||0x1388;}})[_0x59d1('0x11')](function(){return dbH[_0x59d1('0x12')][_0x59d1('0x13')](util[_0x59d1('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0x59d1('0x14')][_0x59d1('0x15')]});})['then'](function(_0x28e4db){if(!_0x28e4db[0x0][_0x59d1('0x16')]){return analyticExtractedReport('Empty');}var _0x1c3cb8=[];var _0x1f6edf=0x0;var _0x30e62a=!![];if(_0x5b112e[_0x59d1('0x17')]){if(_0x28e4db&&_0x28e4db[_0x59d1('0x18')]){var _0x2d6fac=_0x28e4db[0x0][_0x59d1('0x16')]%(_0x1f6edf+_0x997aa3);for(;_0x30e62a;_0x1f6edf+=_0x997aa3,_0x2d6fac=_0x28e4db[0x0]['num']%(_0x1f6edf+_0x997aa3)){if(_0x2d6fac==0x0||_0x2d6fac==_0x28e4db[0x0][_0x59d1('0x16')]){_0x30e62a=![];}_0x1c3cb8[_0x59d1('0x19')](dbH[_0x59d1('0x12')][_0x59d1('0x13')](util[_0x59d1('0xc')](_0x59d1('0x1a'),QUERY,_0x997aa3,_0x1f6edf),{'type':dbH[_0x59d1('0x12')][_0x59d1('0x14')][_0x59d1('0x15')]}));}}}else{_0x1c3cb8['push'](dbH[_0x59d1('0x12')][_0x59d1('0x13')](QUERY,{'type':dbH[_0x59d1('0x12')][_0x59d1('0x14')][_0x59d1('0x15')]}));}var _0x435153=path[_0x59d1('0x1b')](PATH);var _0x31730c=path['basename'](PATH,_0x59d1('0x1c'));var _0x16b2b4=_0x5b112e[_0x59d1('0x17')]&&_0x1c3cb8['length']>0x1;var _0x244121=[];if(!fs['existsSync'](path['join'](_0x435153,_0x31730c))&&_0x16b2b4){fs['mkdirSync'](path[_0x59d1('0x1d')](_0x435153,_0x31730c));}return BPromise[_0x59d1('0x1e')](_0x1c3cb8,function(_0x3a1c49){_0x244121[_0x59d1('0x19')](_0x3a1c49);})[_0x59d1('0x11')](function(){for(var _0x200a48=0x0;_0x200a48<_0x244121[_0x59d1('0x18')];_0x200a48+=0x1){var _0xf2e364;var _0x59e0ad=_0x244121[_0x200a48];if(_0x16b2b4){_0xf2e364=path['join'](_0x435153,_0x31730c,util[_0x59d1('0xc')]('%s%d.%s',_0x31730c,_0x200a48,'xlsx'));}else{_0xf2e364=path[_0x59d1('0x1d')](_0x435153,util['format']('%s.%s',_0x31730c,_0x59d1('0x1f')));}fs[_0x59d1('0x20')](_0xf2e364,json2xls(_0x59e0ad),_0x59d1('0x21'));}})[_0x59d1('0x11')](function(){if(_0x16b2b4){zipdir(path[_0x59d1('0x1d')](_0x435153,_0x31730c),{'saveTo':path['join'](_0x435153,util['format'](_0x59d1('0x22'),_0x31730c,_0x59d1('0x23')))},function(_0x28d3b4,_0x1cfe78){});rimraf(path[_0x59d1('0x1d')](_0x435153,_0x31730c),function(){});}})[_0x59d1('0x11')](function(){logger[_0x59d1('0x24')](util[_0x59d1('0xc')](_0x59d1('0x25'),EXTRACTED_REPORT_ID,_0x59d1('0x26')));return analyticExtractedReport('Completed',_0x16b2b4?util[_0x59d1('0xc')](_0x59d1('0x22'),_0x31730c,_0x16b2b4?'zip':_0x59d1('0x1f')):null);});})[_0x59d1('0x27')](function(_0x26f15f){logger[_0x59d1('0x24')](util[_0x59d1('0xc')](_0x59d1('0x28'),EXTRACTED_REPORT_ID,_0x59d1('0x26')),util[_0x59d1('0x29')](_0x26f15f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x59d1('0x2a')](function(){process[_0x59d1('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x226f=['%s%d.%s','xlsx','binary','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','json2xls','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','update','info','format','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','Empty','num','push','QueryTypes','dirname','existsSync','join','mkdirSync','each','length'];(function(_0x31e0ae,_0x4ae9b1){var _0x38dba1=function(_0x3422a5){while(--_0x3422a5){_0x31e0ae['push'](_0x31e0ae['shift']());}};_0x38dba1(++_0x4ae9b1);}(_0x226f,0x6a));var _0xf226=function(_0x552787,_0x222c5c){_0x552787=_0x552787-0x0;var _0x25954f=_0x226f[_0x552787];return _0x25954f;};'use strict';var util=require(_0xf226('0x0'));var path=require(_0xf226('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xf226('0x2'));var BPromise=require('bluebird');var zipdir=require(_0xf226('0x3'));var rimraf=require(_0xf226('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf226('0x5'))[_0xf226('0x6')];var logger=require(_0xf226('0x7'))(_0xf226('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf226('0x9')][0x3];var PATH=process[_0xf226('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x36dc00,_0xc74ff2){var _0x36cb25={'status':_0x36dc00};var _0x175913={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xc74ff2){_0x36cb25['savename']=_0xc74ff2;}return db['AnalyticExtractedReport'][_0xf226('0xa')](_0x36cb25,_0x175913);}function main(){var _0x452a1c=0x1388;var _0x4951a9;logger[_0xf226('0xb')](util[_0xf226('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0xf226('0xd')][_0xf226('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf226('0xf'),'splitSizeXlsx']})['then'](function(_0x5604b7){if(_0x5604b7){_0x4951a9=_0x5604b7;_0x452a1c=_0x4951a9[_0xf226('0x10')]||0x1388;}})[_0xf226('0x11')](function(){return dbH[_0xf226('0x12')][_0xf226('0x13')](util[_0xf226('0xc')](_0xf226('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xf226('0x15')]});})['then'](function(_0x42f19d){if(!_0x42f19d[0x0]['num']){return analyticExtractedReport(_0xf226('0x16'));}var _0x4eb106=[];var _0x5924fa=0x0;var _0x4db672=!![];if(_0x4951a9[_0xf226('0xf')]){if(_0x42f19d&&_0x42f19d['length']){var _0x213902=_0x42f19d[0x0][_0xf226('0x17')]%(_0x5924fa+_0x452a1c);for(;_0x4db672;_0x5924fa+=_0x452a1c,_0x213902=_0x42f19d[0x0][_0xf226('0x17')]%(_0x5924fa+_0x452a1c)){if(_0x213902==0x0||_0x213902==_0x42f19d[0x0]['num']){_0x4db672=![];}_0x4eb106[_0xf226('0x18')](dbH[_0xf226('0x12')]['query'](util[_0xf226('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x452a1c,_0x5924fa),{'type':dbH[_0xf226('0x12')][_0xf226('0x19')][_0xf226('0x15')]}));}}}else{_0x4eb106['push'](dbH[_0xf226('0x12')][_0xf226('0x13')](QUERY,{'type':dbH[_0xf226('0x12')][_0xf226('0x19')][_0xf226('0x15')]}));}var _0x22232f=path[_0xf226('0x1a')](PATH);var _0x3dbc66=path['basename'](PATH,'.xlsx');var _0x141f33=_0x4951a9[_0xf226('0xf')]&&_0x4eb106['length']>0x1;var _0x2bf162=[];if(!fs[_0xf226('0x1b')](path[_0xf226('0x1c')](_0x22232f,_0x3dbc66))&&_0x141f33){fs[_0xf226('0x1d')](path[_0xf226('0x1c')](_0x22232f,_0x3dbc66));}return BPromise[_0xf226('0x1e')](_0x4eb106,function(_0x24d259){_0x2bf162[_0xf226('0x18')](_0x24d259);})[_0xf226('0x11')](function(){for(var _0x56c00b=0x0;_0x56c00b<_0x2bf162[_0xf226('0x1f')];_0x56c00b+=0x1){var _0x3e8a76;var _0x1689f8=_0x2bf162[_0x56c00b];if(_0x141f33){_0x3e8a76=path['join'](_0x22232f,_0x3dbc66,util[_0xf226('0xc')](_0xf226('0x20'),_0x3dbc66,_0x56c00b,_0xf226('0x21')));}else{_0x3e8a76=path[_0xf226('0x1c')](_0x22232f,util[_0xf226('0xc')]('%s.%s',_0x3dbc66,_0xf226('0x21')));}fs['writeFileSync'](_0x3e8a76,json2xls(_0x1689f8),_0xf226('0x22'));}})['then'](function(){if(_0x141f33){zipdir(path[_0xf226('0x1c')](_0x22232f,_0x3dbc66),{'saveTo':path[_0xf226('0x1c')](_0x22232f,util[_0xf226('0xc')](_0xf226('0x23'),_0x3dbc66,_0xf226('0x24')))},function(_0x1fe78c,_0x3372df){});rimraf(path[_0xf226('0x1c')](_0x22232f,_0x3dbc66),function(){});}})['then'](function(){logger['info'](util['format'](_0xf226('0x25'),EXTRACTED_REPORT_ID,_0xf226('0x26')));return analyticExtractedReport(_0xf226('0x27'),_0x141f33?util[_0xf226('0xc')](_0xf226('0x23'),_0x3dbc66,_0x141f33?'zip':'xlsx'):null);});})[_0xf226('0x28')](function(_0x4bf213){logger[_0xf226('0xb')](util[_0xf226('0xc')](_0xf226('0x29'),EXTRACTED_REPORT_ID,_0xf226('0x26')),util[_0xf226('0x2a')](_0x4bf213,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf226('0x2b'));})[_0xf226('0x2c')](function(){process[_0xf226('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 25bd375..e2dda70 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 _0x218f=['exten','filter','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','CDR(routeid)=','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','length','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','error','rewrite','util','models','Interval','findAll','then','intervals','IntervalId','VoiceExtension','uniq'];(function(_0x48941b,_0x3db605){var _0x4d0b4e=function(_0x1db873){while(--_0x1db873){_0x48941b['push'](_0x48941b['shift']());}};_0x4d0b4e(++_0x3db605);}(_0x218f,0x10b));var _0xf218=function(_0x45b07e,_0x1a2eb5){_0x45b07e=_0x45b07e-0x0;var _0x49863c=_0x218f[_0x45b07e];return _0x49863c;};'use strict';var _=require('lodash');var util=require(_0xf218('0x0'));function rewrite(_0x50e73e,_0x23ffc5){var _0x84e9da=this;return _0x50e73e[_0xf218('0x1')][_0xf218('0x2')][_0xf218('0x3')]({'raw':!![]})[_0xf218('0x4')](function(_0x5539c8){_0x84e9da[_0xf218('0x5')]=_0x5539c8;return _0x50e73e[_0xf218('0x1')]['VoiceExtension'][_0xf218('0x3')]({'where':{'IntervalId':_0x23ffc5[_0xf218('0x6')]},'raw':!![]});})[_0xf218('0x4')](function(_0x40950d){return _0x50e73e[_0xf218('0x1')][_0xf218('0x7')]['findAll']({'where':{'exten':{'$in':_[_0xf218('0x8')](_['map'](_0x40950d,_0xf218('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x5af71c){var _0x45954a=_[_0xf218('0xa')](_0x5af71c,{'priority':'1'});var _0x1d15d4=_[_0xf218('0xa')](_0x5af71c,{'isApp':0x1});var _0x19d8b4=_['groupBy'](_0x1d15d4,'exten');var _0x4322fd=[_0xf218('0xb'),_0xf218('0xc')];var _0xc915f8=[];var _0x105fb8=[];for(var _0x37116e in _0x19d8b4){if(_0x19d8b4[_0xf218('0xd')](_0x37116e)){_0x84e9da[_0xf218('0xe')]=0x2;_0x84e9da[_0xf218('0xf')]=[];_0x84e9da[_0xf218('0x10')]=_[_0xf218('0x11')](_0x45954a,{'exten':_0x19d8b4[_0x37116e][0x0][_0xf218('0x9')]});_0x84e9da[_0xf218('0xf')][_0xf218('0x12')]({'type':_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')],'app':_0xf218('0x14'),'appdata':util[_0xf218('0x15')](_0xf218('0x16'),_0x19d8b4[_0x37116e][0x0]['type']),'context':_0x19d8b4[_0x37116e][0x0][_0xf218('0x17')],'exten':_0x19d8b4[_0x37116e][0x0]['exten'],'priority':_0x84e9da[_0xf218('0xe')]++,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0]['VoiceExtensionId']});if(_0x19d8b4[_0x37116e][0x0]['type']==='inbound'){_0x84e9da[_0xf218('0xf')]['push']({'type':_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')],'app':_0xf218('0x14'),'appdata':_0xf218('0x18')+_0x19d8b4[_0x37116e][0x0]['VoiceExtensionId'],'context':_0x19d8b4[_0x37116e][0x0][_0xf218('0x17')],'exten':_0x19d8b4[_0x37116e][0x0][_0xf218('0x9')],'priority':_0x84e9da[_0xf218('0xe')]++,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')]});}else if(_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')]==='outbound'){if(_0x84e9da[_0xf218('0x10')]){_0x84e9da[_0xf218('0xf')][_0xf218('0x12')]({'type':_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')],'app':'Set','appdata':_0xf218('0x1a')+(_0x84e9da['extension'][_0xf218('0x1b')]?_0xf218('0x1c')+_0x84e9da[_0xf218('0x10')][_0xf218('0x1b')]+'}':_0xf218('0x1d')),'context':_0x19d8b4[_0x37116e][0x0][_0xf218('0x17')],'exten':_0x19d8b4[_0x37116e][0x0][_0xf218('0x9')],'priority':_0x84e9da[_0xf218('0xe')]++,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')]});}_0x84e9da[_0xf218('0xf')][_0xf218('0x12')]({'type':_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')],'app':_0xf218('0x14'),'appdata':_0xf218('0x18')+_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')],'context':_0x19d8b4[_0x37116e][0x0]['context'],'exten':_0x19d8b4[_0x37116e][0x0]['exten'],'priority':_0x84e9da[_0xf218('0xe')]++,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')]});var _0x521add=_0x84e9da['priority']++;_0x84e9da['extensions']['push']({'type':_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')],'app':_0xf218('0x1e'),'appdata':_0xf218('0x1f')+(_0x521add+0x2)+_0xf218('0x20')+(_0x521add+0x1)+')','context':_0x19d8b4[_0x37116e][0x0][_0xf218('0x17')],'exten':_0x19d8b4[_0x37116e][0x0][_0xf218('0x9')],'priority':_0x521add,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')]});if(_0x84e9da[_0xf218('0x10')]){_0x84e9da[_0xf218('0xf')][_0xf218('0x12')]({'type':_0x19d8b4[_0x37116e][0x0]['type'],'app':_0xf218('0x14'),'appdata':_0x84e9da[_0xf218('0x10')]['cutdigits']?_0xf218('0x21')+_0x84e9da[_0xf218('0x10')][_0xf218('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x19d8b4[_0x37116e][0x0][_0xf218('0x17')],'exten':_0x19d8b4[_0x37116e][0x0][_0xf218('0x9')],'priority':_0x84e9da['priority']++,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')]});}_0x84e9da['extensions'][_0xf218('0x12')]({'type':_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')],'app':_0xf218('0x14'),'appdata':'outboundrouteid='+_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')],'context':_0x19d8b4[_0x37116e][0x0]['context'],'exten':_0x19d8b4[_0x37116e][0x0]['exten'],'priority':_0x84e9da[_0xf218('0xe')]++,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0]['VoiceExtensionId']});if(_0x84e9da[_0xf218('0x10')]&&_0x84e9da[_0xf218('0x10')][_0xf218('0xd')](_0xf218('0x22'))&&_0x84e9da[_0xf218('0x10')][_0xf218('0x22')]!=='none'){_0x84e9da[_0xf218('0xf')][_0xf218('0x12')]({'type':_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')],'app':_0xf218('0x14'),'appdata':_0xf218('0x23'),'context':_0x19d8b4[_0x37116e][0x0][_0xf218('0x17')],'exten':_0x19d8b4[_0x37116e][0x0][_0xf218('0x9')],'priority':_0x84e9da[_0xf218('0xe')]++,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')]});_0x84e9da[_0xf218('0xf')][_0xf218('0x12')]({'type':_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')],'app':_0xf218('0x14'),'appdata':_0xf218('0x24')+_0x84e9da[_0xf218('0x10')]['recordingFormat']||_0xf218('0x25'),'context':_0x19d8b4[_0x37116e][0x0][_0xf218('0x17')],'exten':_0x19d8b4[_0x37116e][0x0][_0xf218('0x9')],'priority':_0x84e9da[_0xf218('0xe')]++,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')]});}}_0x84e9da[_0xf218('0xf')][_0xf218('0x12')]({'type':_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')],'app':_0xf218('0x14'),'appdata':_0xf218('0x26'),'context':_0x19d8b4[_0x37116e][0x0][_0xf218('0x17')],'exten':_0x19d8b4[_0x37116e][0x0][_0xf218('0x9')],'priority':_0x84e9da[_0xf218('0xe')]++,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')]});_0x84e9da['extensions'][_0xf218('0x12')]({'type':_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')],'app':_0xf218('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x19d8b4[_0x37116e][0x0][_0xf218('0x17')],'exten':_0x19d8b4[_0x37116e][0x0][_0xf218('0x9')],'priority':_0x84e9da['priority']++,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')]});_0x84e9da[_0xf218('0xf')]['push']({'type':_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')],'app':_0xf218('0x14'),'appdata':'MONITOR_OPTIONS=ab','context':_0x19d8b4[_0x37116e][0x0][_0xf218('0x17')],'exten':_0x19d8b4[_0x37116e][0x0][_0xf218('0x9')],'priority':_0x84e9da[_0xf218('0xe')]++,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')]});for(var _0x56c1a7=0x0,_0x451d04=0x0;_0x56c1a7<_0x19d8b4[_0x37116e]['length'];_0x56c1a7+=0x1,_0x451d04=0x0){var _0x4c53cf=_0x19d8b4[_0x37116e][_0x56c1a7];if(_0x4c53cf[_0xf218('0x13')]){_0x4c53cf[_0xf218('0x13')]=_0x4c53cf[_0xf218('0x13')][_0xf218('0x27')]();}var _0x407e55=[];var _0x4a8baa=[];delete _0x4c53cf['id'];delete _0x4c53cf[_0xf218('0x28')];delete _0x4c53cf[_0xf218('0x29')];var _0x21a509=_0x4c53cf[_0xf218('0x2a')]!==_0xf218('0x2b')?[_0x4c53cf[_0xf218('0x2a')]]:_0x4c53cf['IntervalId']?_[_0xf218('0x2c')](_[_0xf218('0xa')](_0x84e9da[_0xf218('0x5')],{'IntervalId':_0x4c53cf[_0xf218('0x6')]}),'interval'):[];if(_0x4c53cf[_0xf218('0xd')](_0xf218('0x2d'))){if(_0x4c53cf['tag']&&_0x4c53cf['tag']!=='--'){_0x407e55[_0xf218('0x12')]({'type':_0x4c53cf[_0xf218('0x13')],'app':'Set','appdata':_0xf218('0x2e')+_0x4c53cf['tag'],'context':_0x4c53cf['context'],'exten':_0x4c53cf[_0xf218('0x9')],'priority':_0x21a509[_0xf218('0x2f')]+_0x84e9da[_0xf218('0xe')]+_0x451d04++,'VoiceExtensionId':_0x4c53cf[_0xf218('0x19')]});}}if(_0x4c53cf[_0xf218('0x13')]===_0xf218('0x30')&&_0x4c53cf['hasOwnProperty'](_0xf218('0x31'))){if(_0x4c53cf[_0xf218('0x31')]){_0x407e55[_0xf218('0x12')]({'type':_0x4c53cf[_0xf218('0x13')],'app':_0xf218('0x1e'),'appdata':_0xf218('0x32')+_0x4c53cf[_0xf218('0x31')]+')','context':_0x4c53cf[_0xf218('0x17')],'exten':_0x4c53cf[_0xf218('0x9')],'priority':_0x21a509['length']+_0x84e9da['priority']+_0x451d04++,'VoiceExtensionId':_0x4c53cf[_0xf218('0x19')]});}else{_0x407e55[_0xf218('0x12')]({'type':_0x4c53cf[_0xf218('0x13')],'app':_0xf218('0x1e'),'appdata':_0xf218('0x33'),'context':_0x4c53cf[_0xf218('0x17')],'exten':_0x4c53cf[_0xf218('0x9')],'priority':_0x21a509['length']+_0x84e9da[_0xf218('0xe')]+_0x451d04++,'VoiceExtensionId':_0x4c53cf[_0xf218('0x19')]});}}if(_0x4c53cf['hasOwnProperty'](_0xf218('0x34'))){if(_0x4322fd[_0xf218('0x35')](_0x4c53cf[_0xf218('0x36')][_0xf218('0x27')]())>=0x0&&_0x4c53cf['appType']!==_0xf218('0x37')){if(_0x4c53cf[_0xf218('0x34')]){_0x407e55[_0xf218('0x12')]({'type':_0x4c53cf[_0xf218('0x13')],'app':'ExecIf','appdata':_0xf218('0x38'),'context':_0x4c53cf[_0xf218('0x17')],'exten':_0x4c53cf[_0xf218('0x9')],'priority':_0x21a509[_0xf218('0x2f')]+_0x84e9da[_0xf218('0xe')]+_0x451d04++,'VoiceExtensionId':_0x4c53cf[_0xf218('0x19')]});_0x407e55['push']({'type':_0x4c53cf[_0xf218('0x13')],'app':_0xf218('0x14'),'appdata':_0xf218('0x39'),'context':_0x4c53cf[_0xf218('0x17')],'exten':_0x4c53cf[_0xf218('0x9')],'priority':_0x21a509['length']+_0x84e9da['priority']+_0x451d04++,'VoiceExtensionId':_0x4c53cf[_0xf218('0x19')]});}else{_0x407e55['push']({'type':_0x4c53cf[_0xf218('0x13')],'app':_0xf218('0x1e'),'appdata':_0xf218('0x3a'),'context':_0x4c53cf[_0xf218('0x17')],'exten':_0x4c53cf[_0xf218('0x9')],'priority':_0x21a509[_0xf218('0x2f')]+_0x84e9da['priority']+_0x451d04++,'VoiceExtensionId':_0x4c53cf[_0xf218('0x19')]});_0x407e55[_0xf218('0x12')]({'type':_0x4c53cf[_0xf218('0x13')],'app':_0xf218('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4c53cf[_0xf218('0x17')],'exten':_0x4c53cf[_0xf218('0x9')],'priority':_0x21a509[_0xf218('0x2f')]+_0x84e9da[_0xf218('0xe')]+_0x451d04++,'VoiceExtensionId':_0x4c53cf[_0xf218('0x19')]});}}}for(var _0x14dfec=0x0;_0x14dfec<_0x21a509[_0xf218('0x2f')];_0x14dfec+=0x1){var _0x4286ff=_0x84e9da['priority']+_0x21a509[_0xf218('0x2f')];var _0x76a795=_0x14dfec===_0x21a509[_0xf218('0x2f')]-0x1?_0x84e9da[_0xf218('0xe')]+_0x407e55[_0xf218('0x2f')]+_0x4a8baa[_0xf218('0x2f')]+0x2:_0x84e9da[_0xf218('0xe')]+_0x14dfec+0x1;_0x407e55[_0xf218('0x3b')](_0x14dfec,0x0,{'type':_0x4c53cf[_0xf218('0x13')],'app':'GotoIfTime','appdata':_0x21a509[_0x14dfec]+'?'+_0x4c53cf['context']+_0xf218('0x3c')+_0x4286ff+':'+_0x4c53cf[_0xf218('0x17')]+_0xf218('0x3c')+_0x76a795,'exten':_0x4c53cf[_0xf218('0x9')],'context':_0x4c53cf[_0xf218('0x17')],'priority':_0x84e9da[_0xf218('0xe')]+_0x14dfec,'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0]['VoiceExtensionId']});}_0x4c53cf[_0xf218('0xe')]=_0x407e55[_0xf218('0x2f')]?_['last'](_0x407e55)['priority']+0x1:_0x84e9da[_0xf218('0xe')];_0x84e9da['priority']=(_0x4a8baa[_0xf218('0x2f')]?_[_0xf218('0x3d')](_0x4a8baa)['priority']:_0x4c53cf['priority'])+0x1;_0x84e9da[_0xf218('0xf')]=_['concat'](_0x84e9da['extensions'],_0x407e55,[_0x4c53cf],_0x4a8baa);}_0x84e9da[_0xf218('0xf')][_0xf218('0x12')]({'type':_0x19d8b4[_0x37116e][0x0][_0xf218('0x13')],'app':_0xf218('0x3e'),'exten':_0x19d8b4[_0x37116e][0x0]['exten'],'context':_0x19d8b4[_0x37116e][0x0]['context'],'priority':_0x84e9da[_0xf218('0xe')],'VoiceExtensionId':_0x19d8b4[_0x37116e][0x0][_0xf218('0x19')]});_0xc915f8[_0xf218('0x12')](_0x19d8b4[_0x37116e][0x0]['VoiceExtensionId']);_0x105fb8=_[_0xf218('0x3f')](_0x105fb8,_0x84e9da['extensions']);}}return _0x50e73e[_0xf218('0x40')](function(_0x245eef){return _0x50e73e[_0xf218('0x1')]['VoiceExtension'][_0xf218('0x41')]({'where':{'VoiceExtensionId':{'$in':_0xc915f8}},'transaction':_0x245eef})['then'](function(_0x3535e0){return _0x50e73e[_0xf218('0x1')]['VoiceExtension'][_0xf218('0x42')](_['sortBy'](_0x105fb8,'priority'),{'transaction':_0x245eef});});});})['catch'](function(_0x1a26d7){console[_0xf218('0x43')](_0x1a26d7);});}exports[_0xf218('0x44')]=rewrite; \ No newline at end of file +var _0x6ae2=['IntervalId','then','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','find','type','Set','format','CDR(type)=%s','context','CDR(routeid)=','VoiceExtensionId','outbound','extension','push','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','bulkCreate','sortBy','catch','rewrite','lodash','util','models','intervals','VoiceExtension','findAll'];(function(_0x2fae3c,_0x5ecd56){var _0x5ad6a5=function(_0x9abc70){while(--_0x9abc70){_0x2fae3c['push'](_0x2fae3c['shift']());}};_0x5ad6a5(++_0x5ecd56);}(_0x6ae2,0x158));var _0x26ae=function(_0x16ad4c,_0x7a1daa){_0x16ad4c=_0x16ad4c-0x0;var _0x2eec11=_0x6ae2[_0x16ad4c];return _0x2eec11;};'use strict';var _=require(_0x26ae('0x0'));var util=require(_0x26ae('0x1'));function rewrite(_0x5125ff,_0x279104){var _0xea480f=this;return _0x5125ff[_0x26ae('0x2')]['Interval']['findAll']({'raw':!![]})['then'](function(_0x4def1f){_0xea480f[_0x26ae('0x3')]=_0x4def1f;return _0x5125ff['models'][_0x26ae('0x4')][_0x26ae('0x5')]({'where':{'IntervalId':_0x279104[_0x26ae('0x6')]},'raw':!![]});})[_0x26ae('0x7')](function(_0x5a27fc){return _0x5125ff[_0x26ae('0x2')]['VoiceExtension']['findAll']({'where':{'exten':{'$in':_[_0x26ae('0x8')](_[_0x26ae('0x9')](_0x5a27fc,_0x26ae('0xa')))}},'order':[{'raw':_0x26ae('0xb')}],'raw':!![]});})[_0x26ae('0x7')](function(_0x40d088){var _0x31de31=_[_0x26ae('0xc')](_0x40d088,{'priority':'1'});var _0x5cb723=_['filter'](_0x40d088,{'isApp':0x1});var _0x686118=_[_0x26ae('0xd')](_0x5cb723,_0x26ae('0xa'));var _0x59b4ad=[_0x26ae('0xe'),_0x26ae('0xf')];var _0x356838=[];var _0x41bd59=[];for(var _0x3337ad in _0x686118){if(_0x686118['hasOwnProperty'](_0x3337ad)){_0xea480f[_0x26ae('0x10')]=0x2;_0xea480f[_0x26ae('0x11')]=[];_0xea480f['extension']=_[_0x26ae('0x12')](_0x31de31,{'exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')]});_0xea480f[_0x26ae('0x11')]['push']({'type':_0x686118[_0x3337ad][0x0][_0x26ae('0x13')],'app':_0x26ae('0x14'),'appdata':util[_0x26ae('0x15')](_0x26ae('0x16'),_0x686118[_0x3337ad][0x0][_0x26ae('0x13')]),'context':_0x686118[_0x3337ad][0x0][_0x26ae('0x17')],'exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')],'priority':_0xea480f['priority']++,'VoiceExtensionId':_0x686118[_0x3337ad][0x0]['VoiceExtensionId']});if(_0x686118[_0x3337ad][0x0]['type']==='inbound'){_0xea480f['extensions']['push']({'type':_0x686118[_0x3337ad][0x0][_0x26ae('0x13')],'app':_0x26ae('0x14'),'appdata':_0x26ae('0x18')+_0x686118[_0x3337ad][0x0][_0x26ae('0x19')],'context':_0x686118[_0x3337ad][0x0]['context'],'exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')],'priority':_0xea480f[_0x26ae('0x10')]++,'VoiceExtensionId':_0x686118[_0x3337ad][0x0][_0x26ae('0x19')]});}else if(_0x686118[_0x3337ad][0x0][_0x26ae('0x13')]===_0x26ae('0x1a')){if(_0xea480f[_0x26ae('0x1b')]){_0xea480f['extensions'][_0x26ae('0x1c')]({'type':_0x686118[_0x3337ad][0x0]['type'],'app':_0x26ae('0x14'),'appdata':'CDR(destination)='+(_0xea480f[_0x26ae('0x1b')][_0x26ae('0x1d')]?_0x26ae('0x1e')+_0xea480f['extension'][_0x26ae('0x1d')]+'}':_0x26ae('0x1f')),'context':_0x686118[_0x3337ad][0x0][_0x26ae('0x17')],'exten':_0x686118[_0x3337ad][0x0]['exten'],'priority':_0xea480f[_0x26ae('0x10')]++,'VoiceExtensionId':_0x686118[_0x3337ad][0x0][_0x26ae('0x19')]});}_0xea480f['extensions'][_0x26ae('0x1c')]({'type':_0x686118[_0x3337ad][0x0]['type'],'app':_0x26ae('0x14'),'appdata':_0x26ae('0x18')+_0x686118[_0x3337ad][0x0][_0x26ae('0x19')],'context':_0x686118[_0x3337ad][0x0]['context'],'exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')],'priority':_0xea480f['priority']++,'VoiceExtensionId':_0x686118[_0x3337ad][0x0][_0x26ae('0x19')]});var _0x5f0b27=_0xea480f[_0x26ae('0x10')]++;_0xea480f[_0x26ae('0x11')]['push']({'type':_0x686118[_0x3337ad][0x0][_0x26ae('0x13')],'app':_0x26ae('0x20'),'appdata':_0x26ae('0x21')+(_0x5f0b27+0x2)+_0x26ae('0x22')+(_0x5f0b27+0x1)+')','context':_0x686118[_0x3337ad][0x0]['context'],'exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')],'priority':_0x5f0b27,'VoiceExtensionId':_0x686118[_0x3337ad][0x0][_0x26ae('0x19')]});if(_0xea480f[_0x26ae('0x1b')]){_0xea480f['extensions'][_0x26ae('0x1c')]({'type':_0x686118[_0x3337ad][0x0][_0x26ae('0x13')],'app':_0x26ae('0x14'),'appdata':_0xea480f[_0x26ae('0x1b')]['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0xea480f[_0x26ae('0x1b')]['cutdigits']+'}':_0x26ae('0x23'),'context':_0x686118[_0x3337ad][0x0][_0x26ae('0x17')],'exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')],'priority':_0xea480f[_0x26ae('0x10')]++,'VoiceExtensionId':_0x686118[_0x3337ad][0x0][_0x26ae('0x19')]});}_0xea480f[_0x26ae('0x11')][_0x26ae('0x1c')]({'type':_0x686118[_0x3337ad][0x0]['type'],'app':_0x26ae('0x14'),'appdata':_0x26ae('0x24')+_0x686118[_0x3337ad][0x0][_0x26ae('0x19')],'context':_0x686118[_0x3337ad][0x0][_0x26ae('0x17')],'exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')],'priority':_0xea480f[_0x26ae('0x10')]++,'VoiceExtensionId':_0x686118[_0x3337ad][0x0][_0x26ae('0x19')]});if(_0xea480f[_0x26ae('0x1b')]&&_0xea480f[_0x26ae('0x1b')][_0x26ae('0x25')](_0x26ae('0x26'))&&_0xea480f['extension']['recordingFormat']!==_0x26ae('0x27')){_0xea480f[_0x26ae('0x11')][_0x26ae('0x1c')]({'type':_0x686118[_0x3337ad][0x0]['type'],'app':_0x26ae('0x14'),'appdata':_0x26ae('0x28'),'context':_0x686118[_0x3337ad][0x0]['context'],'exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')],'priority':_0xea480f[_0x26ae('0x10')]++,'VoiceExtensionId':_0x686118[_0x3337ad][0x0]['VoiceExtensionId']});_0xea480f['extensions'][_0x26ae('0x1c')]({'type':_0x686118[_0x3337ad][0x0][_0x26ae('0x13')],'app':_0x26ae('0x14'),'appdata':_0x26ae('0x29')+_0xea480f[_0x26ae('0x1b')][_0x26ae('0x26')]||'wav','context':_0x686118[_0x3337ad][0x0][_0x26ae('0x17')],'exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')],'priority':_0xea480f[_0x26ae('0x10')]++,'VoiceExtensionId':_0x686118[_0x3337ad][0x0]['VoiceExtensionId']});}}_0xea480f[_0x26ae('0x11')][_0x26ae('0x1c')]({'type':_0x686118[_0x3337ad][0x0][_0x26ae('0x13')],'app':'Set','appdata':_0x26ae('0x2a'),'context':_0x686118[_0x3337ad][0x0][_0x26ae('0x17')],'exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')],'priority':_0xea480f[_0x26ae('0x10')]++,'VoiceExtensionId':_0x686118[_0x3337ad][0x0][_0x26ae('0x19')]});_0xea480f[_0x26ae('0x11')][_0x26ae('0x1c')]({'type':_0x686118[_0x3337ad][0x0]['type'],'app':'Set','appdata':_0x26ae('0x2b'),'context':_0x686118[_0x3337ad][0x0][_0x26ae('0x17')],'exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')],'priority':_0xea480f[_0x26ae('0x10')]++,'VoiceExtensionId':_0x686118[_0x3337ad][0x0]['VoiceExtensionId']});_0xea480f[_0x26ae('0x11')][_0x26ae('0x1c')]({'type':_0x686118[_0x3337ad][0x0]['type'],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x686118[_0x3337ad][0x0]['context'],'exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')],'priority':_0xea480f['priority']++,'VoiceExtensionId':_0x686118[_0x3337ad][0x0][_0x26ae('0x19')]});for(var _0x80b0b0=0x0,_0x529557=0x0;_0x80b0b0<_0x686118[_0x3337ad][_0x26ae('0x2c')];_0x80b0b0+=0x1,_0x529557=0x0){var _0x5a76ca=_0x686118[_0x3337ad][_0x80b0b0];if(_0x5a76ca[_0x26ae('0x13')]){_0x5a76ca[_0x26ae('0x13')]=_0x5a76ca[_0x26ae('0x13')][_0x26ae('0x2d')]();}var _0x34cd2f=[];var _0x2045bd=[];delete _0x5a76ca['id'];delete _0x5a76ca[_0x26ae('0x2e')];delete _0x5a76ca[_0x26ae('0x2f')];var _0x37ab9c=_0x5a76ca[_0x26ae('0x30')]!==_0x26ae('0x31')?[_0x5a76ca['interval']]:_0x5a76ca[_0x26ae('0x6')]?_[_0x26ae('0x9')](_['filter'](_0xea480f['intervals'],{'IntervalId':_0x5a76ca[_0x26ae('0x6')]}),'interval'):[];if(_0x5a76ca['hasOwnProperty'](_0x26ae('0x32'))){if(_0x5a76ca[_0x26ae('0x32')]&&_0x5a76ca['tag']!=='--'){_0x34cd2f[_0x26ae('0x1c')]({'type':_0x5a76ca[_0x26ae('0x13')],'app':_0x26ae('0x14'),'appdata':_0x26ae('0x33')+_0x5a76ca[_0x26ae('0x32')],'context':_0x5a76ca[_0x26ae('0x17')],'exten':_0x5a76ca[_0x26ae('0xa')],'priority':_0x37ab9c[_0x26ae('0x2c')]+_0xea480f['priority']+_0x529557++,'VoiceExtensionId':_0x5a76ca[_0x26ae('0x19')]});}}if(_0x5a76ca['type']===_0x26ae('0x1a')&&_0x5a76ca['hasOwnProperty'](_0x26ae('0x34'))){if(_0x5a76ca[_0x26ae('0x34')]){_0x34cd2f[_0x26ae('0x1c')]({'type':_0x5a76ca[_0x26ae('0x13')],'app':_0x26ae('0x20'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x5a76ca[_0x26ae('0x34')]+')','context':_0x5a76ca[_0x26ae('0x17')],'exten':_0x5a76ca[_0x26ae('0xa')],'priority':_0x37ab9c[_0x26ae('0x2c')]+_0xea480f[_0x26ae('0x10')]+_0x529557++,'VoiceExtensionId':_0x5a76ca[_0x26ae('0x19')]});}else{_0x34cd2f['push']({'type':_0x5a76ca['type'],'app':'ExecIf','appdata':_0x26ae('0x35'),'context':_0x5a76ca[_0x26ae('0x17')],'exten':_0x5a76ca[_0x26ae('0xa')],'priority':_0x37ab9c['length']+_0xea480f[_0x26ae('0x10')]+_0x529557++,'VoiceExtensionId':_0x5a76ca['VoiceExtensionId']});}}if(_0x5a76ca['hasOwnProperty'](_0x26ae('0x36'))){if(_0x59b4ad[_0x26ae('0x37')](_0x5a76ca['app'][_0x26ae('0x2d')]())>=0x0&&_0x5a76ca[_0x26ae('0x38')]!==_0x26ae('0x39')){if(_0x5a76ca[_0x26ae('0x36')]){_0x34cd2f[_0x26ae('0x1c')]({'type':_0x5a76ca['type'],'app':_0x26ae('0x20'),'appdata':_0x26ae('0x3a'),'context':_0x5a76ca[_0x26ae('0x17')],'exten':_0x5a76ca[_0x26ae('0xa')],'priority':_0x37ab9c['length']+_0xea480f[_0x26ae('0x10')]+_0x529557++,'VoiceExtensionId':_0x5a76ca['VoiceExtensionId']});_0x34cd2f[_0x26ae('0x1c')]({'type':_0x5a76ca[_0x26ae('0x13')],'app':_0x26ae('0x14'),'appdata':_0x26ae('0x3b'),'context':_0x5a76ca[_0x26ae('0x17')],'exten':_0x5a76ca[_0x26ae('0xa')],'priority':_0x37ab9c[_0x26ae('0x2c')]+_0xea480f['priority']+_0x529557++,'VoiceExtensionId':_0x5a76ca['VoiceExtensionId']});}else{_0x34cd2f[_0x26ae('0x1c')]({'type':_0x5a76ca[_0x26ae('0x13')],'app':_0x26ae('0x20'),'appdata':_0x26ae('0x3c'),'context':_0x5a76ca[_0x26ae('0x17')],'exten':_0x5a76ca[_0x26ae('0xa')],'priority':_0x37ab9c[_0x26ae('0x2c')]+_0xea480f[_0x26ae('0x10')]+_0x529557++,'VoiceExtensionId':_0x5a76ca[_0x26ae('0x19')]});_0x34cd2f[_0x26ae('0x1c')]({'type':_0x5a76ca[_0x26ae('0x13')],'app':_0x26ae('0x14'),'appdata':_0x26ae('0x3d'),'context':_0x5a76ca[_0x26ae('0x17')],'exten':_0x5a76ca[_0x26ae('0xa')],'priority':_0x37ab9c['length']+_0xea480f[_0x26ae('0x10')]+_0x529557++,'VoiceExtensionId':_0x5a76ca[_0x26ae('0x19')]});}}}for(var _0x21ae13=0x0;_0x21ae13<_0x37ab9c[_0x26ae('0x2c')];_0x21ae13+=0x1){var _0x21d21c=_0xea480f[_0x26ae('0x10')]+_0x37ab9c[_0x26ae('0x2c')];var _0x22c43b=_0x21ae13===_0x37ab9c['length']-0x1?_0xea480f[_0x26ae('0x10')]+_0x34cd2f[_0x26ae('0x2c')]+_0x2045bd[_0x26ae('0x2c')]+0x2:_0xea480f['priority']+_0x21ae13+0x1;_0x34cd2f['splice'](_0x21ae13,0x0,{'type':_0x5a76ca['type'],'app':_0x26ae('0x3e'),'appdata':_0x37ab9c[_0x21ae13]+'?'+_0x5a76ca[_0x26ae('0x17')]+_0x26ae('0x3f')+_0x21d21c+':'+_0x5a76ca[_0x26ae('0x17')]+_0x26ae('0x3f')+_0x22c43b,'exten':_0x5a76ca[_0x26ae('0xa')],'context':_0x5a76ca[_0x26ae('0x17')],'priority':_0xea480f[_0x26ae('0x10')]+_0x21ae13,'VoiceExtensionId':_0x686118[_0x3337ad][0x0]['VoiceExtensionId']});}_0x5a76ca['priority']=_0x34cd2f[_0x26ae('0x2c')]?_[_0x26ae('0x40')](_0x34cd2f)[_0x26ae('0x10')]+0x1:_0xea480f[_0x26ae('0x10')];_0xea480f[_0x26ae('0x10')]=(_0x2045bd[_0x26ae('0x2c')]?_[_0x26ae('0x40')](_0x2045bd)[_0x26ae('0x10')]:_0x5a76ca['priority'])+0x1;_0xea480f['extensions']=_[_0x26ae('0x41')](_0xea480f[_0x26ae('0x11')],_0x34cd2f,[_0x5a76ca],_0x2045bd);}_0xea480f['extensions'][_0x26ae('0x1c')]({'type':_0x686118[_0x3337ad][0x0]['type'],'app':'Hangup','exten':_0x686118[_0x3337ad][0x0][_0x26ae('0xa')],'context':_0x686118[_0x3337ad][0x0][_0x26ae('0x17')],'priority':_0xea480f[_0x26ae('0x10')],'VoiceExtensionId':_0x686118[_0x3337ad][0x0][_0x26ae('0x19')]});_0x356838[_0x26ae('0x1c')](_0x686118[_0x3337ad][0x0]['VoiceExtensionId']);_0x41bd59=_[_0x26ae('0x41')](_0x41bd59,_0xea480f[_0x26ae('0x11')]);}}return _0x5125ff['transaction'](function(_0x20ff14){return _0x5125ff['models'][_0x26ae('0x4')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x356838}},'transaction':_0x20ff14})['then'](function(_0x3e741a){return _0x5125ff[_0x26ae('0x2')]['VoiceExtension'][_0x26ae('0x42')](_[_0x26ae('0x43')](_0x41bd59,_0x26ae('0x10')),{'transaction':_0x20ff14});});});})[_0x26ae('0x44')](function(_0x905d29){console['error'](_0x905d29);});}exports[_0x26ae('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2fa78ad..39ceb26 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 _0x2e67=['map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','Duplicate\x20Contact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper_final','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','sequelize','query','VoiceQueueId','onlyIfOpen','get','all','Campaign','always','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','duplicate','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','lodash','squel','papaparse','../../../mysqldb','../../../config/logger','redis','localhost','register','argv','undefined','Missing\x20filepath\x20parameter!','zipObject','split','Missing\x20ListId\x20parameter!','null','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length'];(function(_0x4636af,_0x2f9e4b){var _0x2c5026=function(_0x1af5e2){while(--_0x1af5e2){_0x4636af['push'](_0x4636af['shift']());}};_0x2c5026(++_0x2f9e4b);}(_0x2e67,0x129));var _0x72e6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2e67[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x72e6('0x0'));var util=require('util');var _=require(_0x72e6('0x1'));var fs=require('fs');var squel=require(_0x72e6('0x2'));var Papa=require(_0x72e6('0x3'));var Redis=require('ioredis');var db=require(_0x72e6('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x72e6('0x5'))('api');config[_0x72e6('0x6')]=_['defaults'](config['redis'],{'host':_0x72e6('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x72e6('0x6')]));require('../../../api/cmContact/cmContact.socket')[_0x72e6('0x8')](socket);try{if(!process[_0x72e6('0x9')][0x2]||process[_0x72e6('0x9')][0x2]===_0x72e6('0xa')||process[_0x72e6('0x9')][0x2]==='null'){throw new Error(_0x72e6('0xb'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process[_0x72e6('0x9')][0x3]==='undefined'||process[_0x72e6('0x9')][0x3]==='null'||!process['argv'][0x4]||process[_0x72e6('0x9')][0x4]===_0x72e6('0xa')||process[_0x72e6('0x9')][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x72e6('0xc')](process[_0x72e6('0x9')][0x3][_0x72e6('0xd')](','),process['argv'][0x4][_0x72e6('0xd')](','));if(!process[_0x72e6('0x9')][0x5]||process['argv'][0x5]===_0x72e6('0xa')||process[_0x72e6('0x9')][0x5]==='null'){throw new Error(_0x72e6('0xe'));}var LISTID=process[_0x72e6('0x9')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x72e6('0x9')][0x6]!==_0x72e6('0xa')&&process[_0x72e6('0x9')][0x6]!==_0x72e6('0xf')?process[_0x72e6('0x9')][0x6]:null;var DUPLICATES=process[_0x72e6('0x9')][0x7]&&process[_0x72e6('0x9')][0x7]!==_0x72e6('0xa')&&process[_0x72e6('0x9')][0x7]!=='null'?process[_0x72e6('0x9')][0x7]:null;if(!process['argv'][0x8]||process[_0x72e6('0x9')][0x8]==='undefined'||process[_0x72e6('0x9')][0x8]===_0x72e6('0xf')){throw new Error(_0x72e6('0x10'));}var SOCKET_TIMESTAMP=process[_0x72e6('0x9')][0x8];}catch(_0x3ff1f3){logger[_0x72e6('0x11')](_0x3ff1f3);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(_0x4aee36,_0x365f69,_0x58ca00,_0x57d671){var _0x2f3d96={'message':_0x365f69};_0x2f3d96[_0x4aee36]=!![];if(_0x58ca00){_0x2f3d96[_0x72e6('0x12')]=_0x58ca00;}if(_0x57d671){_0x2f3d96[_0x72e6('0x13')]=_0x57d671;}return _0x2f3d96;}function isEmail(_0x27cb23){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))*$/[_0x72e6('0x14')](_0x27cb23);}function checkRow(_0x16eb6f,_0x3fdbb7,_0x12604c){return new BPromise(function(_0x18855e,_0x128581){if(_['isNil'](_0x16eb6f)){return _0x128581(handleCheckRowError(_0x72e6('0x11'),_0x72e6('0x15'),null,_0x12604c));}if(_0x16eb6f[_0x72e6('0x16')]&&_0x16eb6f[_0x72e6('0x16')][_0x72e6('0x17')]){var _0x1b8303=_[_0x72e6('0x18')](_0x16eb6f[_0x72e6('0x16')],_0x72e6('0x19'))['join'](';');return _0x128581(handleCheckRowError(_0x72e6('0x11'),_0x1b8303,null,_0x12604c));}var _0x167e11={};for(var _0x520cfc in FIELDS){if(FIELDS[_0x72e6('0x1a')](_0x520cfc)&&FIELDS[_0x520cfc]){_0x167e11[_0x520cfc]=_0x16eb6f[_0x72e6('0x1b')][0x0][FIELDS[_0x520cfc]]||_0x16eb6f[_0x72e6('0x1b')][0x0]['\ufeff'+FIELDS[_0x520cfc]];}}if(!_0x167e11[_0x72e6('0x1c')]){return _0x128581(handleCheckRowError(_0x72e6('0x11'),_0x72e6('0x1d'),null,_0x12604c));}if(!_0x167e11[_0x72e6('0x1e')]){return _0x128581(handleCheckRowError(_0x72e6('0x11'),_0x72e6('0x1f'),null,_0x12604c));}if(_0x167e11['birthDate']){var _0x5af3e3=moment(_0x167e11[_0x72e6('0x20')],'YYYY-MM-DD');if(!_0x5af3e3['isValid']()){return _0x128581(handleCheckRowError(_0x72e6('0x11'),_0x72e6('0x21'),null,_0x12604c));}}if(_0x167e11[_0x72e6('0x22')]){if(!isEmail(_0x167e11[_0x72e6('0x22')])){return _0x128581(handleCheckRowError(_0x72e6('0x11'),_0x72e6('0x23'),null,_0x12604c));}}_0x167e11[_0x72e6('0x24')]=LISTID;_0x167e11['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x72e6('0x17')]&&_0x3fdbb7){var _0x1dfa08={};for(var _0x53e1a9=0x0,_0x491102=DUPLICATES[_0x72e6('0x17')];_0x53e1a9<_0x491102;_0x53e1a9+=0x1){_0x1dfa08[DUPLICATES[_0x53e1a9]]=_0x167e11[DUPLICATES[_0x53e1a9]];}var _0x357160=_[_0x72e6('0x25')](_0x3fdbb7,_0x1dfa08);if(_0x357160){return _0x128581(handleCheckRowError('duplicate',_0x72e6('0x26'),_0x357160,_0x12604c));}}return db['CmContact'][_0x72e6('0x27')](_0x167e11,{'raw':!![],'hooks':![],'fields':_[_0x72e6('0x28')](_0x167e11)})['then'](function(_0xe466db){if(DUPLICATES&&DUPLICATES[_0x72e6('0x17')]&&_0x3fdbb7){_0x3fdbb7[_0x72e6('0x29')](_[_0x72e6('0x2a')](_0x167e11,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xe466db['id'];return _0x18855e();})[_0x72e6('0x2b')](function(_0x5963d){return _0x128581(handleCheckRowError(_0x72e6('0x11'),_0x72e6('0x2c')+(_0x5963d[_0x72e6('0x19')]||JSON[_0x72e6('0x2d')](_0x5963d)),null,_0x12604c));});});}function checkHopper(){function _0x5e4fbf(){return function(_0x4a5987){logger[_0x72e6('0x11')]('cmContact',_0x72e6('0x2e'),util[_0x72e6('0x2f')](_0x4a5987,{'showHidden':![],'depth':null}));};}var _0x567be2=function(_0xd1084f,_0x25ce14){var _0xbdc064=squel[_0x72e6('0x30')]()[_0x72e6('0x31')](_0x72e6('0x32'))[_0x72e6('0x33')]([_0x72e6('0x1e'),_0x72e6('0x34'),_0x72e6('0x35'),_0x72e6('0x24'),_0x25ce14,_0x72e6('0x36'),_0x72e6('0x37')],squel[_0x72e6('0x38')]()[_0x72e6('0x39')](_0x72e6('0x1e'),'phone')[_0x72e6('0x39')](_0x72e6('0x3a'),'scheduledAt')[_0x72e6('0x39')]('id','ContactId')[_0x72e6('0x39')](LISTID['toString'](),_0x72e6('0x24'))[_0x72e6('0x39')](_0xd1084f['id'][_0x72e6('0x3b')](),_0x25ce14)[_0x72e6('0x39')]('NOW()',_0x72e6('0x36'))['field']('NOW()',_0x72e6('0x37'))[_0x72e6('0x3c')](_0x72e6('0x3d'))[_0x72e6('0x3e')](_0x72e6('0x3f'))['where']('ListId\x20=\x20?',LISTID[_0x72e6('0x3b')]())[_0x72e6('0x3e')](_0x72e6('0x40'))[_0x72e6('0x3e')](_0x72e6('0x41'),squel[_0x72e6('0x38')]()['field']('phone')[_0x72e6('0x3c')](_0x72e6('0x32'))[_0x72e6('0x3e')](_0x25ce14+_0x72e6('0x42'),_0xd1084f['id'][_0x72e6('0x3b')]())))['toString']();return _0xbdc064;};var _0x4e7eef=function(_0x1389dd,_0x519449){var _0x39a8e7=squel[_0x72e6('0x30')]()['into']('cm_hopper')[_0x72e6('0x33')]([_0x72e6('0x1e'),'scheduledAt',_0x72e6('0x35'),'ListId',_0x519449,'createdAt','updatedAt'],squel['select']()['field'](_0x72e6('0x1e'),_0x72e6('0x1e'))[_0x72e6('0x39')](_0x72e6('0x3a'),'scheduledAt')[_0x72e6('0x39')]('id',_0x72e6('0x35'))['field'](LISTID['toString'](),'ListId')['field'](_0x1389dd['id'][_0x72e6('0x3b')](),_0x519449)[_0x72e6('0x39')](_0x72e6('0x3a'),_0x72e6('0x36'))[_0x72e6('0x39')]('NOW()','updatedAt')[_0x72e6('0x3c')](_0x72e6('0x3d'))['where'](_0x72e6('0x3f'))['where'](_0x72e6('0x43'),LISTID[_0x72e6('0x3b')]())[_0x72e6('0x3e')](_0x72e6('0x44'),squel[_0x72e6('0x45')](hopperContacts))[_0x72e6('0x3e')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x72e6('0x41'),squel[_0x72e6('0x38')]()[_0x72e6('0x39')](_0x72e6('0x46'))['from'](_0x72e6('0x47'))[_0x72e6('0x3e')](_0x519449+_0x72e6('0x42'),_0x1389dd['id'][_0x72e6('0x3b')]()))[_0x72e6('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x72e6('0x38')]()['field']('phone')[_0x72e6('0x3c')]('cm_hopper')[_0x72e6('0x3e')](_0x519449+_0x72e6('0x42'),_0x1389dd['id']['toString']())))[_0x72e6('0x3b')]();return _0x39a8e7;};function _0x20be7b(_0x150e3e,_0x7077f1){var _0x3122ce=squel[_0x72e6('0x30')]()['into'](_0x72e6('0x32'))['fromQuery']([_0x72e6('0x1e'),'scheduledAt',_0x72e6('0x35'),'ListId',_0x7077f1,_0x72e6('0x36'),_0x72e6('0x37')],squel[_0x72e6('0x38')]()['field'](_0x72e6('0x1e'),'phone')[_0x72e6('0x39')](_0x72e6('0x3a'),_0x72e6('0x34'))['field']('id',_0x72e6('0x35'))[_0x72e6('0x39')](LISTID['toString'](),_0x72e6('0x24'))['field'](_0x150e3e['id'][_0x72e6('0x3b')](),_0x7077f1)['field']('NOW()',_0x72e6('0x36'))['field'](_0x72e6('0x3a'),_0x72e6('0x37'))[_0x72e6('0x3c')]('cm_contacts')[_0x72e6('0x3e')](_0x72e6('0x3f'))[_0x72e6('0x3e')]('ListId\x20=\x20?',LISTID[_0x72e6('0x3b')]())[_0x72e6('0x3e')](_0x72e6('0x44'),squel[_0x72e6('0x45')](hopperContacts))['where'](_0x72e6('0x40')))['toString']();return _0x3122ce;}function _0x4eaf18(_0x4b8e68,_0x552e46){var _0x214304=squel[_0x72e6('0x30')]()[_0x72e6('0x31')]('cm_hopper_black')[_0x72e6('0x33')]([_0x72e6('0x1e'),_0x72e6('0x35'),'ListId',_0x552e46,_0x72e6('0x36'),_0x72e6('0x37')],squel[_0x72e6('0x38')]()[_0x72e6('0x39')]('phone',_0x72e6('0x1e'))['field']('id',_0x72e6('0x35'))[_0x72e6('0x39')](LISTID[_0x72e6('0x3b')](),_0x72e6('0x24'))['field'](_0x4b8e68['id'][_0x72e6('0x3b')](),_0x552e46)[_0x72e6('0x39')]('NOW()',_0x72e6('0x36'))[_0x72e6('0x39')](_0x72e6('0x3a'),_0x72e6('0x37'))[_0x72e6('0x3c')](_0x72e6('0x3d'))[_0x72e6('0x3e')](_0x72e6('0x3f'))[_0x72e6('0x3e')](_0x72e6('0x43'),LISTID['toString']())['where']('id\x20IN\x20?',squel[_0x72e6('0x45')](hopperContacts))[_0x72e6('0x3e')](_0x72e6('0x40')))[_0x72e6('0x3b')]();return _0x214304;}return db[_0x72e6('0x48')][_0x72e6('0x49')]({'where':{'type':_0x72e6('0x4a')},'attributes':['id',_0x72e6('0x4b')],'include':[{'model':db[_0x72e6('0x4c')],'as':_0x72e6('0x4d'),'where':{'id':LISTID}}]})[_0x72e6('0x4e')](function(_0x181c44){var _0x1e58b1=[];if(_0x181c44){var _0x38bebf;for(var _0x2f459b=0x0,_0x502bb2;_0x2f459b<_0x181c44[_0x72e6('0x17')];_0x2f459b+=0x1){_0x502bb2=_0x181c44[_0x2f459b]['get']({'plain':!![]});switch(_0x502bb2[_0x72e6('0x4b')]){case'always':_0x1e58b1[_0x72e6('0x29')](db[_0x72e6('0x4f')][_0x72e6('0x50')](_0x4e7eef(_0x502bb2,_0x72e6('0x51')))[_0x72e6('0x4e')](function(){})[_0x72e6('0x2b')](_0x5e4fbf()));break;case _0x72e6('0x52'):_0x1e58b1['push'](db[_0x72e6('0x4f')][_0x72e6('0x50')](_0x567be2(_0x502bb2,_0x72e6('0x51')))['then'](function(){})[_0x72e6('0x2b')](_0x5e4fbf()));break;default:_0x1e58b1[_0x72e6('0x29')](db['sequelize'][_0x72e6('0x50')](_0x20be7b(_0x502bb2,_0x72e6('0x51')))[_0x72e6('0x4e')](function(){})[_0x72e6('0x2b')](_0x5e4fbf()));}}}return _0x1e58b1;})['all']()[_0x72e6('0x4e')](function(){return db[_0x72e6('0x48')][_0x72e6('0x49')]({'where':{'type':_0x72e6('0x4a')},'attributes':['id'],'include':[{'model':db[_0x72e6('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x72e6('0x4e')](function(_0x56a45f){var _0x53c408=[];if(_0x56a45f){var _0x16f177;for(var _0x2fec98=0x0,_0x116be6;_0x2fec98<_0x56a45f[_0x72e6('0x17')];_0x2fec98+=0x1){_0x116be6=_0x56a45f[_0x2fec98][_0x72e6('0x53')]({'plain':!![]});_0x53c408[_0x72e6('0x29')](db['sequelize'][_0x72e6('0x50')](_0x4eaf18(_0x116be6,_0x72e6('0x51')))[_0x72e6('0x4e')](function(){})[_0x72e6('0x2b')](_0x5e4fbf()));}}return _0x53c408;})[_0x72e6('0x54')]();})[_0x72e6('0x4e')](function(){return db[_0x72e6('0x55')][_0x72e6('0x49')]({'attributes':['id',_0x72e6('0x4b')],'include':[{'model':db[_0x72e6('0x4c')],'as':_0x72e6('0x4d'),'where':{'id':LISTID}}]})[_0x72e6('0x4e')](function(_0x1ba696){var _0x21d79f=[];if(_0x1ba696){for(var _0x234509=0x0,_0x146084;_0x234509<_0x1ba696[_0x72e6('0x17')];_0x234509+=0x1){_0x146084=_0x1ba696[_0x234509]['get']({'plain':!![]});switch(_0x146084[_0x72e6('0x4b')]){case _0x72e6('0x56'):_0x21d79f[_0x72e6('0x29')](db[_0x72e6('0x4f')]['query'](_0x4e7eef(_0x146084,_0x72e6('0x57')))[_0x72e6('0x4e')](function(){})[_0x72e6('0x2b')](_0x5e4fbf()));break;case _0x72e6('0x52'):_0x21d79f[_0x72e6('0x29')](db[_0x72e6('0x4f')]['query'](_0x567be2(_0x146084,_0x72e6('0x57')))[_0x72e6('0x4e')](function(){})[_0x72e6('0x2b')](_0x5e4fbf()));break;default:_0x21d79f[_0x72e6('0x29')](db[_0x72e6('0x4f')]['query'](_0x20be7b(_0x146084,_0x72e6('0x57')))[_0x72e6('0x4e')](function(){})['catch'](_0x5e4fbf()));}}}return _0x21d79f;})['all']();})[_0x72e6('0x4e')](function(){return db[_0x72e6('0x55')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x72e6('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x72e6('0x4e')](function(_0x54e995){var _0x15affe=[];if(_0x54e995){for(var _0x4ee227=0x0,_0x5f108d;_0x4ee227<_0x54e995[_0x72e6('0x17')];_0x4ee227+=0x1){_0x5f108d=_0x54e995[_0x4ee227][_0x72e6('0x53')]({'plain':!![]});_0x15affe[_0x72e6('0x29')](db['sequelize'][_0x72e6('0x50')](_0x4eaf18(_0x5f108d,_0x72e6('0x57')))[_0x72e6('0x4e')](function(){})[_0x72e6('0x2b')](_0x5e4fbf()));}}return _0x15affe;})[_0x72e6('0x54')]();})[_0x72e6('0x2b')](function(_0x486f60){logger['error']('cmContact,\x20%s,\x20%s',_0x72e6('0x58'),_0x486f60[_0x72e6('0x19')]);});}var processPromises=function(_0x1cef43){return BPromise[_0x72e6('0x54')](promises)['then'](function(_0x2d9337){})[_0x72e6('0x2b')](function(_0x2700c9){logger[_0x72e6('0x11')](_0x72e6('0x59'),JSON['stringify'](_0x2700c9));})[_0x72e6('0x5a')](function(){socket[_0x72e6('0x5b')](_0x72e6('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1cef43){return _0x1cef43[_0x72e6('0x5d')]();}});};var endCsv=function(){return BPromise[_0x72e6('0x5e')]()[_0x72e6('0x4e')](function(){if(hopperContacts){return checkHopper();}})[_0x72e6('0x4e')](function(){socket[_0x72e6('0x5b')](_0x72e6('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x72e6('0x5f')](FILEPATH);}catch(_0x56d977){logger[_0x72e6('0x11')](_0x72e6('0x60'),JSON[_0x72e6('0x2d')](_0x56d977));}finally{process[_0x72e6('0x61')](0x0);}});};process['on'](_0x72e6('0x62'),function(){logger[_0x72e6('0x63')](_0x72e6('0x64'));endCsv();});function main(){return BPromise[_0x72e6('0x5e')]()[_0x72e6('0x4e')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x72e6('0xd')](',');return db[_0x72e6('0x65')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x72e6('0x4e')](function(_0x2b494e){var _0x3c3e94=fs[_0x72e6('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x72e6('0x67')](_0x3c3e94,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4d5358,_0x377dd6){total+=0x1;var _0x4b08bb=total;promises[_0x72e6('0x29')](checkRow(_0x4d5358,_0x2b494e,_0x4b08bb)[_0x72e6('0x4e')](function(){success+=0x1;})[_0x72e6('0x2b')](function(_0x5e2d4c){if(_0x5e2d4c[_0x72e6('0x11')]){errors+=0x1;delete _0x5e2d4c[_0x72e6('0x11')];}else if(_0x5e2d4c[_0x72e6('0x68')]){duplicates+=0x1;delete _0x5e2d4c['duplicate'];}rows[_0x72e6('0x29')](_0x5e2d4c);}));if(total%0xc8===0x0){_0x377dd6['pause']();return processPromises(_0x377dd6);}},'complete':function(){return processPromises()[_0x72e6('0x4e')](function(){logger['info'](_0x72e6('0x69'));endCsv();});},'error':function(_0x5ca23f,_0x371383){logger[_0x72e6('0x63')](_0x72e6('0x6a'),JSON[_0x72e6('0x2d')](_0x5ca23f));endCsv();}});})[_0x72e6('0x2b')](function(_0x341ee9){logger[_0x72e6('0x11')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x72e6('0x2d')](_0x341ee9));});}main(); \ No newline at end of file +var _0x9c01=['finally','emit','contact:csv_','resume','resolve','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','split','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','create','then','pick','catch','message','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','createdAt','select','NOW()','field','toString','updatedAt','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','cm_hopper_final','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','push','sequelize','query','onlyIfOpen','VoiceQueueId','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','stringify'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9c01,0x7d));var _0x19c0=function(_0x3c1d33,_0xff95d3){_0x3c1d33=_0x3c1d33-0x0;var _0x422756=_0x9c01[_0x3c1d33];return _0x422756;};'use strict';var BPromise=require(_0x19c0('0x0'));var util=require(_0x19c0('0x1'));var _=require(_0x19c0('0x2'));var fs=require('fs');var squel=require(_0x19c0('0x3'));var Papa=require(_0x19c0('0x4'));var Redis=require(_0x19c0('0x5'));var db=require(_0x19c0('0x6'))['db'];var config=require(_0x19c0('0x7'));var logger=require(_0x19c0('0x8'))(_0x19c0('0x9'));config[_0x19c0('0xa')]=_[_0x19c0('0xb')](config[_0x19c0('0xa')],{'host':_0x19c0('0xc'),'port':0x18eb});var socket=require(_0x19c0('0xd'))(new Redis(config[_0x19c0('0xa')]));require('../../../api/cmContact/cmContact.socket')[_0x19c0('0xe')](socket);try{if(!process[_0x19c0('0xf')][0x2]||process[_0x19c0('0xf')][0x2]===_0x19c0('0x10')||process[_0x19c0('0xf')][0x2]==='null'){throw new Error(_0x19c0('0x11'));}var FILEPATH=process[_0x19c0('0xf')][0x2];if(!process[_0x19c0('0xf')][0x3]||process[_0x19c0('0xf')][0x3]===_0x19c0('0x10')||process[_0x19c0('0xf')][0x3]===_0x19c0('0x12')||!process[_0x19c0('0xf')][0x4]||process[_0x19c0('0xf')][0x4]==='undefined'||process[_0x19c0('0xf')][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process['argv'][0x3]['split'](','),process[_0x19c0('0xf')][0x4]['split'](','));if(!process[_0x19c0('0xf')][0x5]||process[_0x19c0('0xf')][0x5]==='undefined'||process[_0x19c0('0xf')][0x5]===_0x19c0('0x12')){throw new Error(_0x19c0('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x19c0('0xf')][0x6]&&process[_0x19c0('0xf')][0x6]!==_0x19c0('0x10')&&process[_0x19c0('0xf')][0x6]!==_0x19c0('0x12')?process[_0x19c0('0xf')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x19c0('0xf')][0x7]!==_0x19c0('0x10')&&process[_0x19c0('0xf')][0x7]!=='null'?process[_0x19c0('0xf')][0x7]:null;if(!process[_0x19c0('0xf')][0x8]||process[_0x19c0('0xf')][0x8]===_0x19c0('0x10')||process[_0x19c0('0xf')][0x8]===_0x19c0('0x12')){throw new Error(_0x19c0('0x14'));}var SOCKET_TIMESTAMP=process[_0x19c0('0xf')][0x8];}catch(_0x5e2bfa){logger['error'](_0x5e2bfa);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(_0x1b0e3,_0xccbe63,_0x25eca9,_0x206166){var _0x10f9a0={'message':_0xccbe63};_0x10f9a0[_0x1b0e3]=!![];if(_0x25eca9){_0x10f9a0[_0x19c0('0x15')]=_0x25eca9;}if(_0x206166){_0x10f9a0[_0x19c0('0x16')]=_0x206166;}return _0x10f9a0;}function isEmail(_0x5624e5){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))*$/[_0x19c0('0x17')](_0x5624e5);}function checkRow(_0x1cb3dc,_0x187bbb,_0x12364d){return new BPromise(function(_0x5c6541,_0x12e855){if(_[_0x19c0('0x18')](_0x1cb3dc)){return _0x12e855(handleCheckRowError(_0x19c0('0x19'),_0x19c0('0x1a'),null,_0x12364d));}if(_0x1cb3dc['errors']&&_0x1cb3dc[_0x19c0('0x1b')][_0x19c0('0x1c')]){var _0x20f68c=_[_0x19c0('0x1d')](_0x1cb3dc[_0x19c0('0x1b')],'message')[_0x19c0('0x1e')](';');return _0x12e855(handleCheckRowError(_0x19c0('0x19'),_0x20f68c,null,_0x12364d));}var _0x435c77={};for(var _0x566a6d in FIELDS){if(FIELDS[_0x19c0('0x1f')](_0x566a6d)&&FIELDS[_0x566a6d]){_0x435c77[_0x566a6d]=_0x1cb3dc[_0x19c0('0x20')][0x0][FIELDS[_0x566a6d]]||_0x1cb3dc[_0x19c0('0x20')][0x0]['\ufeff'+FIELDS[_0x566a6d]];}}if(!_0x435c77[_0x19c0('0x21')]){return _0x12e855(handleCheckRowError(_0x19c0('0x19'),_0x19c0('0x22'),null,_0x12364d));}if(!_0x435c77['phone']){return _0x12e855(handleCheckRowError(_0x19c0('0x19'),_0x19c0('0x23'),null,_0x12364d));}if(_0x435c77[_0x19c0('0x24')]){var _0x2f7680=moment(_0x435c77['birthDate'],_0x19c0('0x25'));if(!_0x2f7680[_0x19c0('0x26')]()){return _0x12e855(handleCheckRowError(_0x19c0('0x19'),_0x19c0('0x27'),null,_0x12364d));}}if(_0x435c77['email']){if(!isEmail(_0x435c77[_0x19c0('0x28')])){return _0x12e855(handleCheckRowError(_0x19c0('0x19'),_0x19c0('0x29'),null,_0x12364d));}}_0x435c77[_0x19c0('0x2a')]=LISTID;_0x435c77[_0x19c0('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x19c0('0x1c')]&&_0x187bbb){var _0x528799={};for(var _0x274e47=0x0,_0x3769e7=DUPLICATES['length'];_0x274e47<_0x3769e7;_0x274e47+=0x1){_0x528799[DUPLICATES[_0x274e47]]=_0x435c77[DUPLICATES[_0x274e47]];}var _0x5ba54e=_[_0x19c0('0x2c')](_0x187bbb,_0x528799);if(_0x5ba54e){return _0x12e855(handleCheckRowError(_0x19c0('0x2d'),'Duplicate\x20Contact',_0x5ba54e,_0x12364d));}}return db['CmContact'][_0x19c0('0x2e')](_0x435c77,{'raw':!![],'hooks':![],'fields':_['keys'](_0x435c77)})[_0x19c0('0x2f')](function(_0x1127d0){if(DUPLICATES&&DUPLICATES['length']&&_0x187bbb){_0x187bbb['push'](_[_0x19c0('0x30')](_0x435c77,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1127d0['id'];return _0x5c6541();})[_0x19c0('0x31')](function(_0x2f7e79){return _0x12e855(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x2f7e79[_0x19c0('0x32')]||JSON['stringify'](_0x2f7e79)),null,_0x12364d));});});}function checkHopper(){function _0x141281(){return function(_0x3461d1){logger['error']('cmContact','checkHopper',util['inspect'](_0x3461d1,{'showHidden':![],'depth':null}));};}var _0x46b3bf=function(_0x2784ff,_0x4e617d){var _0x16907f=squel[_0x19c0('0x33')]()[_0x19c0('0x34')](_0x19c0('0x35'))[_0x19c0('0x36')]([_0x19c0('0x37'),_0x19c0('0x38'),_0x19c0('0x39'),_0x19c0('0x2a'),_0x4e617d,_0x19c0('0x3a'),'updatedAt'],squel[_0x19c0('0x3b')]()['field'](_0x19c0('0x37'),_0x19c0('0x37'))['field'](_0x19c0('0x3c'),_0x19c0('0x38'))['field']('id',_0x19c0('0x39'))[_0x19c0('0x3d')](LISTID['toString'](),_0x19c0('0x2a'))['field'](_0x2784ff['id'][_0x19c0('0x3e')](),_0x4e617d)[_0x19c0('0x3d')]('NOW()','createdAt')[_0x19c0('0x3d')](_0x19c0('0x3c'),_0x19c0('0x3f'))[_0x19c0('0x40')](_0x19c0('0x41'))['where'](_0x19c0('0x42'))['where'](_0x19c0('0x43'),LISTID[_0x19c0('0x3e')]())[_0x19c0('0x44')](_0x19c0('0x45'))[_0x19c0('0x44')](_0x19c0('0x46'),squel[_0x19c0('0x3b')]()['field'](_0x19c0('0x37'))[_0x19c0('0x40')](_0x19c0('0x35'))[_0x19c0('0x44')](_0x4e617d+_0x19c0('0x47'),_0x2784ff['id']['toString']())))[_0x19c0('0x3e')]();return _0x16907f;};var _0x1a68f9=function(_0x4a4fe2,_0x3f3c56){var _0x59a576=squel['insert']()[_0x19c0('0x34')](_0x19c0('0x35'))[_0x19c0('0x36')]([_0x19c0('0x37'),_0x19c0('0x38'),_0x19c0('0x39'),_0x19c0('0x2a'),_0x3f3c56,_0x19c0('0x3a'),'updatedAt'],squel[_0x19c0('0x3b')]()['field'](_0x19c0('0x37'),_0x19c0('0x37'))[_0x19c0('0x3d')](_0x19c0('0x3c'),_0x19c0('0x38'))[_0x19c0('0x3d')]('id',_0x19c0('0x39'))[_0x19c0('0x3d')](LISTID[_0x19c0('0x3e')](),_0x19c0('0x2a'))[_0x19c0('0x3d')](_0x4a4fe2['id']['toString'](),_0x3f3c56)['field'](_0x19c0('0x3c'),'createdAt')['field']('NOW()',_0x19c0('0x3f'))[_0x19c0('0x40')](_0x19c0('0x41'))[_0x19c0('0x44')](_0x19c0('0x42'))[_0x19c0('0x44')](_0x19c0('0x43'),LISTID[_0x19c0('0x3e')]())[_0x19c0('0x44')](_0x19c0('0x48'),squel[_0x19c0('0x49')](hopperContacts))[_0x19c0('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0x19c0('0x44')](_0x19c0('0x46'),squel[_0x19c0('0x3b')]()[_0x19c0('0x3d')]('calleridnum')[_0x19c0('0x40')](_0x19c0('0x4a'))[_0x19c0('0x44')](_0x3f3c56+_0x19c0('0x47'),_0x4a4fe2['id']['toString']()))[_0x19c0('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x19c0('0x37'))[_0x19c0('0x40')](_0x19c0('0x35'))[_0x19c0('0x44')](_0x3f3c56+_0x19c0('0x47'),_0x4a4fe2['id'][_0x19c0('0x3e')]())))[_0x19c0('0x3e')]();return _0x59a576;};function _0x5c9e6e(_0x5e8640,_0x1ce2b6){var _0x437a5b=squel[_0x19c0('0x33')]()[_0x19c0('0x34')](_0x19c0('0x35'))[_0x19c0('0x36')]([_0x19c0('0x37'),_0x19c0('0x38'),_0x19c0('0x39'),_0x19c0('0x2a'),_0x1ce2b6,'createdAt',_0x19c0('0x3f')],squel[_0x19c0('0x3b')]()[_0x19c0('0x3d')](_0x19c0('0x37'),'phone')[_0x19c0('0x3d')]('NOW()',_0x19c0('0x38'))[_0x19c0('0x3d')]('id',_0x19c0('0x39'))['field'](LISTID[_0x19c0('0x3e')](),_0x19c0('0x2a'))[_0x19c0('0x3d')](_0x5e8640['id'][_0x19c0('0x3e')](),_0x1ce2b6)[_0x19c0('0x3d')](_0x19c0('0x3c'),_0x19c0('0x3a'))['field'](_0x19c0('0x3c'),_0x19c0('0x3f'))[_0x19c0('0x40')](_0x19c0('0x41'))[_0x19c0('0x44')](_0x19c0('0x42'))['where']('ListId\x20=\x20?',LISTID[_0x19c0('0x3e')]())[_0x19c0('0x44')]('id\x20IN\x20?',squel[_0x19c0('0x49')](hopperContacts))[_0x19c0('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x19c0('0x3e')]();return _0x437a5b;}function _0x1a6de7(_0x499abb,_0x596561){var _0x1a2841=squel['insert']()[_0x19c0('0x34')](_0x19c0('0x4b'))['fromQuery']([_0x19c0('0x37'),_0x19c0('0x39'),_0x19c0('0x2a'),_0x596561,'createdAt','updatedAt'],squel[_0x19c0('0x3b')]()[_0x19c0('0x3d')]('phone',_0x19c0('0x37'))[_0x19c0('0x3d')]('id',_0x19c0('0x39'))[_0x19c0('0x3d')](LISTID[_0x19c0('0x3e')](),_0x19c0('0x2a'))['field'](_0x499abb['id'][_0x19c0('0x3e')](),_0x596561)[_0x19c0('0x3d')](_0x19c0('0x3c'),_0x19c0('0x3a'))[_0x19c0('0x3d')](_0x19c0('0x3c'),_0x19c0('0x3f'))['from'](_0x19c0('0x41'))[_0x19c0('0x44')]('deletedAt\x20IS\x20NULL')[_0x19c0('0x44')](_0x19c0('0x43'),LISTID['toString']())[_0x19c0('0x44')](_0x19c0('0x48'),squel['str'](hopperContacts))[_0x19c0('0x44')](_0x19c0('0x45')))[_0x19c0('0x3e')]();return _0x1a2841;}return db['VoiceQueue'][_0x19c0('0x4c')]({'where':{'type':_0x19c0('0x4d')},'attributes':['id',_0x19c0('0x4e')],'include':[{'model':db[_0x19c0('0x4f')],'as':_0x19c0('0x50'),'where':{'id':LISTID}}]})[_0x19c0('0x2f')](function(_0x27046c){var _0x54feca=[];if(_0x27046c){var _0xefe737;for(var _0x4af5aa=0x0,_0x29a799;_0x4af5aa<_0x27046c[_0x19c0('0x1c')];_0x4af5aa+=0x1){_0x29a799=_0x27046c[_0x4af5aa][_0x19c0('0x51')]({'plain':!![]});switch(_0x29a799['dialCheckDuplicateType']){case _0x19c0('0x52'):_0x54feca[_0x19c0('0x53')](db[_0x19c0('0x54')][_0x19c0('0x55')](_0x1a68f9(_0x29a799,'VoiceQueueId'))[_0x19c0('0x2f')](function(){})['catch'](_0x141281()));break;case _0x19c0('0x56'):_0x54feca[_0x19c0('0x53')](db[_0x19c0('0x54')][_0x19c0('0x55')](_0x46b3bf(_0x29a799,'VoiceQueueId'))[_0x19c0('0x2f')](function(){})['catch'](_0x141281()));break;default:_0x54feca[_0x19c0('0x53')](db[_0x19c0('0x54')][_0x19c0('0x55')](_0x5c9e6e(_0x29a799,_0x19c0('0x57')))[_0x19c0('0x2f')](function(){})[_0x19c0('0x31')](_0x141281()));}}}return _0x54feca;})[_0x19c0('0x58')]()[_0x19c0('0x2f')](function(){return db['VoiceQueue'][_0x19c0('0x4c')]({'where':{'type':_0x19c0('0x4d')},'attributes':['id'],'include':[{'model':db[_0x19c0('0x4f')],'as':_0x19c0('0x59'),'where':{'id':LISTID}}]})[_0x19c0('0x2f')](function(_0x29fcbb){var _0x1ab98c=[];if(_0x29fcbb){var _0x1b63e4;for(var _0x2cbf20=0x0,_0x2d3543;_0x2cbf20<_0x29fcbb[_0x19c0('0x1c')];_0x2cbf20+=0x1){_0x2d3543=_0x29fcbb[_0x2cbf20][_0x19c0('0x51')]({'plain':!![]});_0x1ab98c['push'](db[_0x19c0('0x54')][_0x19c0('0x55')](_0x1a6de7(_0x2d3543,_0x19c0('0x57')))[_0x19c0('0x2f')](function(){})['catch'](_0x141281()));}}return _0x1ab98c;})[_0x19c0('0x58')]();})[_0x19c0('0x2f')](function(){return db[_0x19c0('0x5a')][_0x19c0('0x4c')]({'attributes':['id',_0x19c0('0x4e')],'include':[{'model':db['CmList'],'as':_0x19c0('0x50'),'where':{'id':LISTID}}]})[_0x19c0('0x2f')](function(_0x437adf){var _0x22d22e=[];if(_0x437adf){for(var _0x476d01=0x0,_0x4c8acd;_0x476d01<_0x437adf[_0x19c0('0x1c')];_0x476d01+=0x1){_0x4c8acd=_0x437adf[_0x476d01][_0x19c0('0x51')]({'plain':!![]});switch(_0x4c8acd['dialCheckDuplicateType']){case _0x19c0('0x52'):_0x22d22e['push'](db[_0x19c0('0x54')]['query'](_0x1a68f9(_0x4c8acd,_0x19c0('0x5b')))[_0x19c0('0x2f')](function(){})[_0x19c0('0x31')](_0x141281()));break;case _0x19c0('0x56'):_0x22d22e[_0x19c0('0x53')](db[_0x19c0('0x54')][_0x19c0('0x55')](_0x46b3bf(_0x4c8acd,_0x19c0('0x5b')))[_0x19c0('0x2f')](function(){})[_0x19c0('0x31')](_0x141281()));break;default:_0x22d22e[_0x19c0('0x53')](db['sequelize'][_0x19c0('0x55')](_0x5c9e6e(_0x4c8acd,_0x19c0('0x5b')))[_0x19c0('0x2f')](function(){})[_0x19c0('0x31')](_0x141281()));}}}return _0x22d22e;})[_0x19c0('0x58')]();})[_0x19c0('0x2f')](function(){return db[_0x19c0('0x5a')][_0x19c0('0x4c')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x19c0('0x59'),'where':{'id':LISTID}}]})[_0x19c0('0x2f')](function(_0x22c5e3){var _0x3527bd=[];if(_0x22c5e3){for(var _0x331583=0x0,_0x57fba4;_0x331583<_0x22c5e3['length'];_0x331583+=0x1){_0x57fba4=_0x22c5e3[_0x331583][_0x19c0('0x51')]({'plain':!![]});_0x3527bd[_0x19c0('0x53')](db[_0x19c0('0x54')][_0x19c0('0x55')](_0x1a6de7(_0x57fba4,_0x19c0('0x5b')))['then'](function(){})['catch'](_0x141281()));}}return _0x3527bd;})[_0x19c0('0x58')]();})[_0x19c0('0x31')](function(_0x4d9dd7){logger['error'](_0x19c0('0x5c'),'generalCheckHopper',_0x4d9dd7[_0x19c0('0x32')]);});}var processPromises=function(_0x5b5fac){return BPromise['all'](promises)['then'](function(_0x5732a8){})[_0x19c0('0x31')](function(_0x2eb2e9){logger[_0x19c0('0x19')](_0x19c0('0x5d'),JSON[_0x19c0('0x5e')](_0x2eb2e9));})[_0x19c0('0x5f')](function(){socket[_0x19c0('0x60')](_0x19c0('0x61')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5b5fac){return _0x5b5fac[_0x19c0('0x62')]();}});};var endCsv=function(){return BPromise[_0x19c0('0x63')]()[_0x19c0('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0x19c0('0x2f')](function(){socket[_0x19c0('0x60')](_0x19c0('0x61')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x43b0a2){logger[_0x19c0('0x19')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x19c0('0x5e')](_0x43b0a2));}finally{process[_0x19c0('0x64')](0x0);}});};process['on'](_0x19c0('0x65'),function(){logger[_0x19c0('0x66')](_0x19c0('0x67'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x19c0('0x68')](',');return db['CmContact'][_0x19c0('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x4ef7d8){var _0xca12fc=fs[_0x19c0('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x19c0('0x6a')](_0xca12fc,{'header':!![],'skipEmptyLines':!![],'step':function(_0xc9878f,_0x2d78b0){total+=0x1;var _0x1ef2f9=total;promises[_0x19c0('0x53')](checkRow(_0xc9878f,_0x4ef7d8,_0x1ef2f9)[_0x19c0('0x2f')](function(){success+=0x1;})[_0x19c0('0x31')](function(_0x50d35d){if(_0x50d35d[_0x19c0('0x19')]){errors+=0x1;delete _0x50d35d[_0x19c0('0x19')];}else if(_0x50d35d[_0x19c0('0x2d')]){duplicates+=0x1;delete _0x50d35d[_0x19c0('0x2d')];}rows[_0x19c0('0x53')](_0x50d35d);}));if(total%0xc8===0x0){_0x2d78b0[_0x19c0('0x6b')]();return processPromises(_0x2d78b0);}},'complete':function(){return processPromises()[_0x19c0('0x2f')](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x33f59f,_0x38b1aa){logger[_0x19c0('0x66')](_0x19c0('0x6c'),JSON[_0x19c0('0x5e')](_0x33f59f));endCsv();}});})[_0x19c0('0x31')](function(_0x27c026){logger[_0x19c0('0x19')](_0x19c0('0x6d'),JSON['stringify'](_0x27c026));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 32e95f5..ff9716d 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 _0x57ca=['.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','ListId','updatedAt','fields','cm_contacts.createdAt\x20=\x20?','field','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','into','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','MIN(id)','group','info','Received\x20SIGINT','exit','errors','code','message','query','catch','error','main','send','start','binding','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','name','_description','writeFileSync','createReadStream','data','rows','find','isNil','hasOwnProperty','trim','replace','scheduledat','isValid','isNaN','UserId','isNumber','includes','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','emit','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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',',\x20scheduledAt\x20=\x20NOW()','each','all','contactId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','CampaignId','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','parse','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','join','.id\x20=\x20','where','\x20=\x20','CmContact','findAll','AdditionalPhones','then','length','push','split','filter','CmContactHasItem','findOne','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','cm_hopper','fromQuery','ContactId','createdAt','priority','recallme','from','cm_contacts','.CmListId'];(function(_0x51c52b,_0x147712){var _0x581ce3=function(_0x2e61a0){while(--_0x2e61a0){_0x51c52b['push'](_0x51c52b['shift']());}};_0x581ce3(++_0x147712);}(_0x57ca,0x108));var _0xa57c=function(_0x3c26e8,_0x2c3478){_0x3c26e8=_0x3c26e8-0x0;var _0x26d412=_0x57ca[_0x3c26e8];return _0x26d412;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xa57c('0x0'));var Papa=require(_0xa57c('0x1'));var util=require('util');var BPromise=require(_0xa57c('0x2'));var moment=require(_0xa57c('0x3'));var squel=require(_0xa57c('0x4'));var Redis=require(_0xa57c('0x5'));var db=require(_0xa57c('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0xa57c('0x7'))(_0xa57c('0x8'));config[_0xa57c('0x9')]=_[_0xa57c('0xa')](config[_0xa57c('0x9')],{'host':_0xa57c('0xb'),'port':0x18eb});var socket=require(_0xa57c('0xc'))(new Redis(config[_0xa57c('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xa57c('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4b51d8){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))*$/[_0xa57c('0xe')](_0x4b51d8);}function selectNotIn(_0x932dcc,_0x4fa5ed,_0x156bca,_0x51f287,_0x554101){return squel[_0xa57c('0xf')]()['field'](_0xa57c('0x10'))['from'](_0x51f287)[_0xa57c('0x11')](_0x4fa5ed,null,_0x4fa5ed+_0xa57c('0x12')+_0x51f287+'.'+_0x156bca)[_0xa57c('0x13')](_0x51f287+'.'+_0x156bca+_0xa57c('0x14')+_0x932dcc+'.'+_0x156bca)[_0xa57c('0x13')](_0x4fa5ed+'.dialCheckDuplicateType\x20IN\x20('+_0x554101[_0xa57c('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x546cde,_0x30d23d){promisesAdditionalPhones=[];return db[_0xa57c('0x15')][_0xa57c('0x16')]({'raw':!![],'attributes':['id',_0xa57c('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa57c('0x18')](function(_0x37a323){if(_0x37a323!==null){var _0x3f900a=[];for(var _0x4b4bdb=0x0;_0x4b4bdb<_0x37a323[_0xa57c('0x19')];_0x4b4bdb++){var _0xdf7ff6=_0x37a323[_0x4b4bdb];_0x3f900a[_0xa57c('0x1a')](insertAdditionalPhones(_0xdf7ff6));}}Promise['all'](_0x3f900a)[_0xa57c('0x18')](function(){_0x546cde({'val':0x1});});});});}function insertAdditionalPhones(_0x5f33f1){return new Promise(function(_0x3e7afa,_0x3d781d){var _0x93462c=_0x5f33f1[_0xa57c('0x17')];var _0x1fd0d8=_0x93462c[_0xa57c('0x1b')](';');var _0x6f3f89=[];orderBy=0x0;for(var _0x595c7a=0x0;_0x595c7a<_0x1fd0d8['length'];_0x595c7a++){_0x6f3f89[_0xa57c('0x1a')](splitAdditionalPhone(_0x5f33f1['id'],_0x1fd0d8[_0x595c7a]));}Promise['all'](_0x6f3f89)['then'](function(){_0x3e7afa({'val':_0x1fd0d8[_0xa57c('0x19')]});});});}function splitAdditionalPhone(_0xa5b314,_0x3eee75){return new Promise(function(_0x23bec0,_0x49242c){var _0x348211=_0x3eee75[_0xa57c('0x1b')](':');var _0x34d1bc=_0x348211[0x0];var _0x2213b2=_0x348211[0x1];if(_0x2213b2!==''){var _0x3bb969=_0x2213b2[_0xa57c('0x1b')]('|');var _0x1e0192=[];for(var _0x42038e=0x0;_0x42038e<_0x3bb969[_0xa57c('0x19')];_0x42038e++){if(_0x3bb969[_0x42038e]!==''){var _0xdf65dd=_[_0xa57c('0x1c')](promisesAdditionalPhones,{'contactId':_0xa5b314,'phone':_0x3bb969[_0x42038e]});if(_0xdf65dd[_0xa57c('0x19')]==0x0){orderBy++;promisesAdditionalPhones[_0xa57c('0x1a')]({'contactId':_0xa5b314,'contactTypeId':_0x34d1bc,'phone':_0x3bb969[_0x42038e],'orderBy':orderBy});}}}_0x23bec0({'ok':0x1});}else _0x23bec0({'res':0x0});});}function createAdditionalPhone(_0x10a33d,_0x431bec,_0x511a26,_0x2db443){var _0x5226d0='';var _0x27884d='';var _0x5228b9=_0x511a26[_0xa57c('0x1b')]('§');_0x5226d0=_0x5228b9[0x0];if(_0x5228b9[_0xa57c('0x19')]==0x2)_0x27884d=_0x5228b9[0x1];return new Promise(function(_0x8ee1c0,_0xe50fb8){return db[_0xa57c('0x1d')][_0xa57c('0x1e')]({'where':{'CmContactId':_0x10a33d,'item':_0x5226d0}})['then'](function(_0x3b7364){if(_0x3b7364){return db['CmContactHasItem']['update']({'ItemTypeId':_0x431bec,'description':_0x27884d,'OrderBy':_0x2db443},{'where':{'CmContactId':_0x10a33d,'item':_0x5226d0}})[_0xa57c('0x18')](function(_0x7d10ec){_0x8ee1c0({'res':'updated'});});}else{return db[_0xa57c('0x1d')][_0xa57c('0x1f')]({'CmContactId':_0x10a33d,'item':_0x5226d0,'description':_0x27884d,'ItemTypeId':_0x431bec,'OrderBy':_0x2db443,'ItemClass':_0xa57c('0x20')})['then'](function(_0xd779f1){_0x8ee1c0({'res':'inserted'});});}});});}function insertCmHopper(_0xf5f70c,_0x5464f2,_0x2a3bbe,_0x51ad09,_0xd4c5d4){var _0x532164=[_0xa57c('0x21'),_0xa57c('0x22'),_0xa57c('0x23'),_0xa57c('0x24'),_0x5464f2+'.'+_0x51ad09,_0xa57c('0x25'),_0xa57c('0x26'),_0xa57c('0x27'),'cm_contacts.UserId','\x22'+_0xd4c5d4+'\x22'];return squel[_0xa57c('0x28')]()['into'](_0xa57c('0x29'))[_0xa57c('0x2a')]([_0xa57c('0x10'),'scheduledat',_0xa57c('0x2b'),'ListId',_0x51ad09,_0xa57c('0x2c'),'updatedAt',_0xa57c('0x2d'),'UserId',_0xa57c('0x2e')],squel[_0xa57c('0xf')]()['fields'](_0x532164)[_0xa57c('0x2f')](_0x5464f2)['join'](_0xa57c('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x5464f2+_0xa57c('0x31'))[_0xa57c('0x11')](_0x2a3bbe,null,_0x2a3bbe+_0xa57c('0x12')+_0x5464f2+'.'+_0x51ad09)[_0xa57c('0x13')](_0x5464f2+_0xa57c('0x32'),_0xf5f70c)[_0xa57c('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xa57c('0x33'),selectNotIn(_0x5464f2,_0x2a3bbe,_0x51ad09,_0xa57c('0x29'),[_0xa57c('0x34'),'\x22onlyIfOpen\x22']))[_0xa57c('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5464f2,_0x2a3bbe,_0x51ad09,_0xa57c('0x29'),[_0xa57c('0x34')])))['toString']();}function insertCmHopperBlack(_0x558cf7,_0x5104c4,_0x3be888,_0x5d410b){var _0x269a19=[_0xa57c('0x21'),_0xa57c('0x23'),_0xa57c('0x24'),_0x5104c4+'.'+_0x5d410b,'cm_contacts.createdAt',_0xa57c('0x26')];return squel[_0xa57c('0x28')]()['into']('cm_hopper_black')[_0xa57c('0x2a')]([_0xa57c('0x10'),'ContactId',_0xa57c('0x35'),_0x5d410b,_0xa57c('0x2c'),_0xa57c('0x36')],squel[_0xa57c('0xf')]()[_0xa57c('0x37')](_0x269a19)[_0xa57c('0x2f')](_0x5104c4)['join'](_0xa57c('0x30'),null,'cm_contacts.ListId\x20=\x20'+_0x5104c4+'.CmListId')['join'](_0x3be888,null,_0x3be888+'.id\x20=\x20'+_0x5104c4+'.'+_0x5d410b)['where'](_0x5104c4+_0xa57c('0x32'),_0x558cf7)[_0xa57c('0x13')](_0xa57c('0x38'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xa57c('0x39')](_0xa57c('0x10'))[_0xa57c('0x2f')](_0xa57c('0x3a'))[_0xa57c('0x13')](_0xa57c('0x3b'),_0x558cf7)['where'](_0x5d410b+_0xa57c('0x3c'),_0x5104c4+'.'+_0x5d410b)))[_0xa57c('0x3d')]();}function insertCmHopperAdditionalPhones(_0x34e8f2){var _0x3a3a4a=[_0xa57c('0x3e'),_0xa57c('0x3f'),'cm_contact_has_items.OrderBy',_0xa57c('0x40'),_0xa57c('0x41')];return squel[_0xa57c('0x28')]()[_0xa57c('0x42')](_0xa57c('0x43'))['fromQuery']([_0xa57c('0x44'),_0xa57c('0x10'),_0xa57c('0x45'),_0xa57c('0x2c'),_0xa57c('0x36')],squel[_0xa57c('0xf')]()['fields'](_0x3a3a4a)[_0xa57c('0x2f')](_0xa57c('0x29'))[_0xa57c('0x11')](_0xa57c('0x30'),null,_0xa57c('0x46'))[_0xa57c('0x11')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where']('cm_hopper.ListId\x20=\x20?',_0x34e8f2)[_0xa57c('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xa57c('0x3d')]();}function insertCmContact(_0xae87,_0x4c6e43,_0x42daa4,_0x320a5c){var _0x368e87=_[_0xa57c('0x47')](_[_0xa57c('0x48')](_0x320a5c),['ListId',_0xa57c('0x49'),_0xa57c('0x2c'),_0xa57c('0x36')]);return squel[_0xa57c('0x28')]()[_0xa57c('0x42')]('cm_contacts')[_0xa57c('0x2a')](_0x368e87,squel['select']()['fields'](_0x368e87)[_0xa57c('0x2f')](_0x4c6e43)[_0xa57c('0x13')]('('+_0x42daa4[_0xa57c('0x11')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0xa57c('0x37')](_0x42daa4)[_0xa57c('0x2f')](_0xa57c('0x30'))[_0xa57c('0x13')]('ListId\x20=\x20?',_0xae87)[_0xa57c('0x13')](_0xa57c('0x4a')))[_0xa57c('0x13')]('id\x20IN\x20?',squel['select']()[_0xa57c('0x39')](_0xa57c('0x4b'),'min_id')[_0xa57c('0x2f')](_0x4c6e43)[_0xa57c('0x4c')](_0x42daa4[_0xa57c('0x11')](','))))[_0xa57c('0x3d')]();}function handleStop(){logger[_0xa57c('0x4d')](_0xa57c('0x4e'));stopped=!![];}function handleUncaughtException(_0x4fc413){logger['error'](_0x4fc413['message']);process[_0xa57c('0x4f')](0x1);}function handleError(_0x14f3d6,_0x2fd759){stats[_0xa57c('0x50')][_0xa57c('0x1a')]({'name':_0x2fd759[_0xa57c('0x51')],'message':_0x2fd759[_0xa57c('0x52')],'row':_0x14f3d6});}function handleQuery(_0x4519a0){logger['info'](_0x4519a0);return db['sequelize'][_0xa57c('0x53')](_0x4519a0)['spread'](function(_0x1880e6){results[_0xa57c('0x1a')](_0x1880e6);})[_0xa57c('0x54')](function(_0x563da6){logger[_0xa57c('0x55')](_0x563da6['message']);});}function main(_0x21b00a,_0x4b3416,_0x39484d,_0x170187){logger[_0xa57c('0x4d')](_0xa57c('0x56'),_0x21b00a,JSON['stringify'](_0x4b3416));process[_0xa57c('0x57')](_0xa57c('0x58'));var _0x3bd25a=_0x4b3416[_0xa57c('0x59')];var _0x3345d5=_['clone'](_0x3bd25a);var _0x13afd0=_0x4b3416[_0xa57c('0x5a')];var _0x1899ad=path[_0xa57c('0x11')](config[_0xa57c('0x5b')],_0xa57c('0x5c'),_0x13afd0+_0xa57c('0x5d'));logger[_0xa57c('0x4d')](_0xa57c('0x5e'),_0x4b3416);db[_0xa57c('0x5f')]['findAll']({'raw':!![],'attributes':['id',_0xa57c('0x60')]})[_0xa57c('0x18')](function(_0x1bc70b){for(var _0x6b3d0=0x0;_0x6b3d0<_0x1bc70b[_0xa57c('0x19')];_0x6b3d0++){if(_0x1bc70b[_0x6b3d0][_0xa57c('0x60')]in _0x3bd25a){contactItemTypes['push'](_0x1bc70b[_0x6b3d0]);delete _0x3345d5[_0x1bc70b[_0x6b3d0][_0xa57c('0x60')]];hasAdditionalPhones=!![];}for(var _0x15eef4 in _0x3bd25a){if(_0x1bc70b[_0x6b3d0]['name']+_0xa57c('0x61')===_0x15eef4){phoneDescriptions[_0xa57c('0x1a')]({'itemTypeId':_0x1bc70b[_0x6b3d0]['id'],'description':_0x15eef4});delete _0x3345d5[_0x15eef4];}}}if(hasAdditionalPhones)_0x3345d5[_0xa57c('0x17')]='';var _0xa78a75=_[_0xa57c('0x48')](_0x3345d5)[_0xa57c('0x11')]();logger[_0xa57c('0x4d')]('header',_0xa78a75);fs[_0xa57c('0x62')](_0x1899ad,_0xa78a75+'\x0a');Papa['parse'](fs[_0xa57c('0x63')](_0x21b00a),{'header':!![],'skipEmptyLines':!![],'step':function(_0x56ac7e,_0x1a8686){try{for(var _0x5a0e62=0x0,_0x3ef1f1=[];_0x5a0e62<_0x56ac7e[_0xa57c('0x64')]['length'];_0x5a0e62++){stats[_0xa57c('0x65')]+=0x1;if(_0x56ac7e[_0xa57c('0x50')][_0x5a0e62]){handleError(_0x56ac7e[_0xa57c('0x64')][_0x5a0e62],_0x56ac7e[_0xa57c('0x50')][_0x5a0e62]);}else{var _0x54be9c=[];var _0x3a3983=[];var _0x13524b={};for(var _0xa9d180 in _0x3bd25a){let _0x2820f4=contactItemTypes[_0xa57c('0x66')](_0x3d766a=>_0x3d766a[_0xa57c('0x60')]===_0xa9d180);let _0x2a5983=contactItemTypes[_0xa57c('0x66')](_0x428ac0=>_0x428ac0[_0xa57c('0x60')]+_0xa57c('0x61')===_0xa9d180);if(_[_0xa57c('0x67')](_0x2820f4)&&_[_0xa57c('0x67')](_0x2a5983)){if(_0x3bd25a[_0xa57c('0x68')](_0xa9d180)){if(_0x56ac7e[_0xa57c('0x64')][_0x5a0e62][_0x3bd25a[_0xa9d180]]){var _0x1604d6=_[_0xa57c('0x69')](_0x56ac7e['data'][_0x5a0e62][_0x3bd25a[_0xa9d180]][_0xa57c('0x6a')](/"/g,'\x27'));switch(_0xa9d180){case _0xa57c('0x6b'):var _0x245238=moment(_0x1604d6,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x245238[_0xa57c('0x6c')]()){_0x3ef1f1[_0xa57c('0x1a')]('\x22'+_0x1604d6+'\x22');}else{_0x54be9c[_0xa57c('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x20ff5f=parseInt(_0x1604d6);_0x1604d6=_[_0xa57c('0x6d')](_0x20ff5f)||_0x20ff5f<0x0||_0x20ff5f>0x4?_0x170187?0x3:0x2:_0x20ff5f;_0x3ef1f1[_0xa57c('0x1a')]('\x22'+_0x1604d6+'\x22');break;case _0xa57c('0x6e'):var _0x3fd9aa=parseInt(_0x1604d6);if(_[_0xa57c('0x6f')](_0x3fd9aa)&&_[_0xa57c('0x70')](_0x39484d,_0x3fd9aa)){_0x3ef1f1[_0xa57c('0x1a')]('\x22'+_0x3fd9aa+'\x22');}else{_0x54be9c[_0xa57c('0x1a')]('agent\x20not\x20exists');}break;case _0xa57c('0x71'):if(isEmail(_0x1604d6)){_0x3ef1f1[_0xa57c('0x1a')]('\x22'+_0x1604d6+'\x22');}else{_0x54be9c['push'](_0xa57c('0x72'));}break;case _0xa57c('0x73'):var _0x10cead=moment(_0x1604d6,_0xa57c('0x74'),!![]);if(_0x10cead[_0xa57c('0x6c')]()){_0x3ef1f1[_0xa57c('0x1a')]('\x22'+_0x1604d6+'\x22');}else{_0x54be9c[_0xa57c('0x1a')](_0xa57c('0x75'));}break;default:_0x3ef1f1['push']('\x22'+_0x1604d6+'\x22');}}else{switch(_0xa9d180){case _0xa57c('0x76'):case _0xa57c('0x10'):_0x54be9c['push'](_0xa9d180+_0xa57c('0x77'));break;default:_0x3ef1f1[_0xa57c('0x1a')]('\x22\x22');}}}}else{var _0x5454cb='';if(!_['isNil'](_0x2820f4)){if(!_0x13524b[_0xa57c('0x68')](_0x2820f4['id'])){if(!_[_0xa57c('0x67')](_0x56ac7e[_0xa57c('0x64')][_0x5a0e62][_0x3bd25a[_0xa9d180]])){var _0x1604d6=_[_0xa57c('0x69')](_0x56ac7e['data'][_0x5a0e62][_0x3bd25a[_0xa9d180]][_0xa57c('0x6a')](/"/g,'\x27'));var _0x3eb9ba=phoneDescriptions[_0xa57c('0x66')](_0x4cbcd1=>_0x4cbcd1[_0xa57c('0x78')]===_0x2820f4['id']);if(!_['isNil'](_0x3eb9ba)){var _0x1281ec=_[_0xa57c('0x69')](_0x56ac7e[_0xa57c('0x64')][_0x5a0e62][_0x3bd25a[_0x3eb9ba[_0xa57c('0x79')]]]['replace'](/"/g,'\x27'));if(!_[_0xa57c('0x67')](_0x1281ec))_0x1604d6=_0x1604d6+'§'+_0x1281ec;}if(_0x5454cb=='')_0x5454cb=_0x1604d6;else _0x5454cb+='|'+_0x1604d6;}_0x3a3983[_0xa57c('0x1a')](_0x2820f4['id']+':'+_0x5454cb);_0x13524b[_0x2820f4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3ef1f1[_0xa57c('0x1a')]('\x22'+_0x3a3983[_0xa57c('0x11')](';')+'\x22');}if(_0x54be9c['length']){handleError(_0x56ac7e[_0xa57c('0x64')][_0x5a0e62],{'code':_0xa57c('0x7a'),'message':_0x54be9c[_0xa57c('0x11')]()});}else{fs['appendFileSync'](_0x1899ad,_0x3ef1f1[_0xa57c('0x11')]()+'\x0a');}_0x3ef1f1=[];}if(!(stats[_0xa57c('0x65')]%0xc8)){socket[_0xa57c('0x7b')]('contact:import:'+_0x13afd0,stats);stats[_0xa57c('0x50')]=[];}}if(stopped){logger[_0xa57c('0x4d')](_0xa57c('0x7c'));_0x1a8686[_0xa57c('0x7d')]();}}catch(_0x59227d){handleError(_0x56ac7e[_0xa57c('0x64')][_0x5a0e62],{'code':_0xa57c('0x7e'),'message':_0x59227d['message']});logger[_0xa57c('0x55')](_0xa57c('0x7f'),_0x59227d['message']);}},'complete':function(){try{var _0x29a4e0=[];var _0x4d4524=_0xa57c('0x30');if(_0x4b3416[_0xa57c('0x80')]&&_0x4b3416[_0xa57c('0x80')][_0xa57c('0x19')]){_0x4d4524='cm_contacts_'+_0x13afd0;_0x29a4e0[_0xa57c('0x1a')](_0xa57c('0x81')+_0x4d4524+_0xa57c('0x82'));}var _0x2dfd3c=util[_0xa57c('0x83')](_0xa57c('0x84'),_0x1899ad,_0x4d4524,_0xa78a75,_0x4b3416[_0xa57c('0x35')],_0x4b3416[_0xa57c('0x49')]||null,NOW,NOW);if(_[_0xa57c('0x67')](_0x3bd25a[_0xa57c('0x6b')])){_0x2dfd3c+=_0xa57c('0x85');}_0x29a4e0['push'](_0x2dfd3c);if(_0x4b3416['duplicates']&&_0x4b3416['duplicates'][_0xa57c('0x19')]){_0x29a4e0['push'](insertCmContact(_0x4b3416[_0xa57c('0x35')],_0x4d4524,_0x4b3416[_0xa57c('0x80')],_0x3bd25a));_0x29a4e0[_0xa57c('0x1a')]('DROP\x20TABLE\x20'+_0x4d4524+';');}BPromise[_0xa57c('0x86')](_0x29a4e0,handleQuery)[_0xa57c('0x18')](function(_0x2d8f2a){BPromise[_0xa57c('0x87')]([handleAdditionalPhones()])[_0xa57c('0x18')](function(){_0x29a4e0=[];for(var _0x372ca7=0x0;_0x372ca7\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','papaparse','bluebird','moment','squel','ioredis','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','all','split','length','filter','CmContactHasItem','update','updated','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?'];(function(_0x465481,_0x463786){var _0x104975=function(_0x58143e){while(--_0x58143e){_0x465481['push'](_0x465481['shift']());}};_0x104975(++_0x463786);}(_0xafc4,0x69));var _0x4afc=function(_0x464a56,_0x47cd58){_0x464a56=_0x464a56-0x0;var _0x3190a4=_0xafc4[_0x464a56];return _0x3190a4;};'use strict';var fs=require('fs');var path=require(_0x4afc('0x0'));var _=require('lodash');var Papa=require(_0x4afc('0x1'));var util=require('util');var BPromise=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var squel=require(_0x4afc('0x4'));var Redis=require(_0x4afc('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x4afc('0x6'));config[_0x4afc('0x7')]=_[_0x4afc('0x8')](config[_0x4afc('0x7')],{'host':_0x4afc('0x9'),'port':0x18eb});var socket=require(_0x4afc('0xa'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x4afc('0xb')](_0x4afc('0xc'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x134aad){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))*$/[_0x4afc('0xd')](_0x134aad);}function selectNotIn(_0x1b8981,_0x458fde,_0x5542ec,_0x5c523b,_0x7f127f){return squel['select']()[_0x4afc('0xe')](_0x4afc('0xf'))['from'](_0x5c523b)[_0x4afc('0x10')](_0x458fde,null,_0x458fde+_0x4afc('0x11')+_0x5c523b+'.'+_0x5542ec)[_0x4afc('0x12')](_0x5c523b+'.'+_0x5542ec+_0x4afc('0x13')+_0x1b8981+'.'+_0x5542ec)[_0x4afc('0x12')](_0x458fde+_0x4afc('0x14')+_0x7f127f[_0x4afc('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x23b03e,_0x5effb4){promisesAdditionalPhones=[];return db[_0x4afc('0x15')][_0x4afc('0x16')]({'raw':!![],'attributes':['id',_0x4afc('0x17')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x4afc('0x18')](function(_0x5f2dc9){if(_0x5f2dc9!==null){var _0x4e32e8=[];for(var _0x2452ae=0x0;_0x2452ae<_0x5f2dc9['length'];_0x2452ae++){var _0x23ae30=_0x5f2dc9[_0x2452ae];_0x4e32e8[_0x4afc('0x19')](insertAdditionalPhones(_0x23ae30));}}Promise[_0x4afc('0x1a')](_0x4e32e8)[_0x4afc('0x18')](function(){_0x23b03e({'val':0x1});});});});}function insertAdditionalPhones(_0x3a306f){return new Promise(function(_0x3ebdc8,_0x22f809){var _0x3ad418=_0x3a306f[_0x4afc('0x17')];var _0x135349=_0x3ad418[_0x4afc('0x1b')](';');var _0x543f0c=[];orderBy=0x0;for(var _0x1a8f49=0x0;_0x1a8f49<_0x135349[_0x4afc('0x1c')];_0x1a8f49++){_0x543f0c[_0x4afc('0x19')](splitAdditionalPhone(_0x3a306f['id'],_0x135349[_0x1a8f49]));}Promise[_0x4afc('0x1a')](_0x543f0c)['then'](function(){_0x3ebdc8({'val':_0x135349[_0x4afc('0x1c')]});});});}function splitAdditionalPhone(_0x30eda3,_0x2de6e9){return new Promise(function(_0x280587,_0x1559b8){var _0x3add4c=_0x2de6e9[_0x4afc('0x1b')](':');var _0x573a75=_0x3add4c[0x0];var _0x5403e4=_0x3add4c[0x1];if(_0x5403e4!==''){var _0x3ecf2d=_0x5403e4['split']('|');var _0x37debf=[];for(var _0x4e9a48=0x0;_0x4e9a48<_0x3ecf2d[_0x4afc('0x1c')];_0x4e9a48++){if(_0x3ecf2d[_0x4e9a48]!==''){var _0x2a0314=_[_0x4afc('0x1d')](promisesAdditionalPhones,{'contactId':_0x30eda3,'phone':_0x3ecf2d[_0x4e9a48]});if(_0x2a0314[_0x4afc('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x4afc('0x19')]({'contactId':_0x30eda3,'contactTypeId':_0x573a75,'phone':_0x3ecf2d[_0x4e9a48],'orderBy':orderBy});}}}_0x280587({'ok':0x1});}else _0x280587({'res':0x0});});}function createAdditionalPhone(_0x28a86c,_0x40a0db,_0x383a71,_0x2bb837){var _0x100220='';var _0x4e8273='';var _0x359c07=_0x383a71[_0x4afc('0x1b')]('§');_0x100220=_0x359c07[0x0];if(_0x359c07['length']==0x2)_0x4e8273=_0x359c07[0x1];return new Promise(function(_0xc3952e,_0x244f6c){return db[_0x4afc('0x1e')]['findOne']({'where':{'CmContactId':_0x28a86c,'item':_0x100220}})['then'](function(_0x54433f){if(_0x54433f){return db[_0x4afc('0x1e')][_0x4afc('0x1f')]({'ItemTypeId':_0x40a0db,'description':_0x4e8273,'OrderBy':_0x2bb837},{'where':{'CmContactId':_0x28a86c,'item':_0x100220}})['then'](function(_0xd26d2f){_0xc3952e({'res':_0x4afc('0x20')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x28a86c,'item':_0x100220,'description':_0x4e8273,'ItemTypeId':_0x40a0db,'OrderBy':_0x2bb837,'ItemClass':'PHONE'})[_0x4afc('0x18')](function(_0x34434a){_0xc3952e({'res':_0x4afc('0x21')});});}});});}function insertCmHopper(_0x46357b,_0xc1d91,_0x28cd3e,_0x566389,_0x290391){var _0x3d1693=[_0x4afc('0x22'),_0x4afc('0x23'),_0x4afc('0x24'),_0x4afc('0x25'),_0xc1d91+'.'+_0x566389,_0x4afc('0x26'),_0x4afc('0x27'),'cm_contacts.priority',_0x4afc('0x28'),'\x22'+_0x290391+'\x22'];return squel['insert']()['into'](_0x4afc('0x29'))[_0x4afc('0x2a')]([_0x4afc('0xf'),_0x4afc('0x2b'),_0x4afc('0x2c'),_0x4afc('0x2d'),_0x566389,'createdAt',_0x4afc('0x2e'),_0x4afc('0x2f'),_0x4afc('0x30'),_0x4afc('0x31')],squel[_0x4afc('0x32')]()[_0x4afc('0x33')](_0x3d1693)['from'](_0xc1d91)[_0x4afc('0x10')](_0x4afc('0x34'),null,_0x4afc('0x35')+_0xc1d91+_0x4afc('0x36'))['join'](_0x28cd3e,null,_0x28cd3e+'.id\x20=\x20'+_0xc1d91+'.'+_0x566389)[_0x4afc('0x12')](_0xc1d91+_0x4afc('0x37'),_0x46357b)[_0x4afc('0x12')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x4afc('0x38'),selectNotIn(_0xc1d91,_0x28cd3e,_0x566389,'cm_hopper',['\x22always\x22',_0x4afc('0x39')]))[_0x4afc('0x12')](_0x4afc('0x38'),selectNotIn(_0xc1d91,_0x28cd3e,_0x566389,_0x4afc('0x29'),[_0x4afc('0x3a')])))[_0x4afc('0x3b')]();}function insertCmHopperBlack(_0x453e12,_0x29c0df,_0x3ccc5a,_0x38f762){var _0x26e59f=[_0x4afc('0x22'),_0x4afc('0x24'),_0x4afc('0x25'),_0x29c0df+'.'+_0x38f762,_0x4afc('0x26'),'cm_contacts.updatedAt'];return squel[_0x4afc('0x3c')]()[_0x4afc('0x3d')](_0x4afc('0x3e'))[_0x4afc('0x2a')]([_0x4afc('0xf'),_0x4afc('0x2c'),_0x4afc('0x2d'),_0x38f762,'createdAt','updatedAt'],squel['select']()[_0x4afc('0x33')](_0x26e59f)[_0x4afc('0x3f')](_0x29c0df)['join'](_0x4afc('0x34'),null,_0x4afc('0x35')+_0x29c0df+_0x4afc('0x36'))[_0x4afc('0x10')](_0x3ccc5a,null,_0x3ccc5a+'.id\x20=\x20'+_0x29c0df+'.'+_0x38f762)[_0x4afc('0x12')](_0x29c0df+_0x4afc('0x37'),_0x453e12)[_0x4afc('0x12')](_0x4afc('0x40'),NOW)[_0x4afc('0x12')](_0x4afc('0x38'),squel['select']()[_0x4afc('0xe')]('phone')[_0x4afc('0x3f')](_0x4afc('0x3e'))[_0x4afc('0x12')]('ListId\x20=\x20?',_0x453e12)['where'](_0x38f762+_0x4afc('0x41'),_0x29c0df+'.'+_0x38f762)))[_0x4afc('0x3b')]();}function insertCmHopperAdditionalPhones(_0x2cf64e){var _0x12e97d=[_0x4afc('0x42'),_0x4afc('0x43'),_0x4afc('0x44'),_0x4afc('0x45'),'cm_contact_has_items.updatedAt'];return squel[_0x4afc('0x3c')]()[_0x4afc('0x3d')]('cm_hopper_additional_phones')[_0x4afc('0x2a')](['CmHopperId',_0x4afc('0xf'),_0x4afc('0x46'),_0x4afc('0x47'),'updatedAt'],squel[_0x4afc('0x32')]()[_0x4afc('0x33')](_0x12e97d)[_0x4afc('0x3f')](_0x4afc('0x29'))[_0x4afc('0x10')](_0x4afc('0x34'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')['join']('cm_contact_has_items',null,_0x4afc('0x48'))[_0x4afc('0x12')](_0x4afc('0x49'),_0x2cf64e)[_0x4afc('0x12')](_0x4afc('0x40'),NOW))[_0x4afc('0x3b')]();}function insertCmContact(_0x22e8b0,_0x41d690,_0x25347e,_0x464f94){var _0x48dbe3=_[_0x4afc('0x4a')](_['keys'](_0x464f94),['ListId',_0x4afc('0x4b'),'createdAt',_0x4afc('0x2e')]);return squel[_0x4afc('0x3c')]()[_0x4afc('0x3d')](_0x4afc('0x34'))['fromQuery'](_0x48dbe3,squel[_0x4afc('0x32')]()['fields'](_0x48dbe3)[_0x4afc('0x3f')](_0x41d690)[_0x4afc('0x12')]('('+_0x25347e[_0x4afc('0x10')](',')+_0x4afc('0x4c'),squel[_0x4afc('0x32')]()[_0x4afc('0x33')](_0x25347e)[_0x4afc('0x3f')](_0x4afc('0x34'))[_0x4afc('0x12')](_0x4afc('0x4d'),_0x22e8b0)[_0x4afc('0x12')](_0x4afc('0x4e')))['where'](_0x4afc('0x4f'),squel[_0x4afc('0x32')]()[_0x4afc('0xe')](_0x4afc('0x50'),_0x4afc('0x51'))[_0x4afc('0x3f')](_0x41d690)[_0x4afc('0x52')](_0x25347e[_0x4afc('0x10')](','))))[_0x4afc('0x3b')]();}function handleStop(){logger[_0x4afc('0x53')](_0x4afc('0x54'));stopped=!![];}function handleUncaughtException(_0x2aa927){logger[_0x4afc('0x55')](_0x2aa927['message']);process[_0x4afc('0x56')](0x1);}function handleError(_0x549ee4,_0x41ddf1){stats[_0x4afc('0x57')][_0x4afc('0x19')]({'name':_0x41ddf1[_0x4afc('0x58')],'message':_0x41ddf1['message'],'row':_0x549ee4});}function handleQuery(_0x486c23){logger[_0x4afc('0x53')](_0x486c23);return db[_0x4afc('0x59')]['query'](_0x486c23)[_0x4afc('0x5a')](function(_0x3af52c){results[_0x4afc('0x19')](_0x3af52c);})[_0x4afc('0x5b')](function(_0x329550){logger[_0x4afc('0x55')](_0x329550[_0x4afc('0x5c')]);});}function main(_0x13891d,_0x24e1d3,_0x3369a8,_0x4295a5){logger[_0x4afc('0x53')](_0x4afc('0x5d'),_0x13891d,JSON[_0x4afc('0x5e')](_0x24e1d3));process['send'](_0x4afc('0x5f'));var _0x59fb43=_0x24e1d3[_0x4afc('0x60')];var _0x19cb0b=_[_0x4afc('0x61')](_0x59fb43);var _0x41bd77=_0x24e1d3[_0x4afc('0x62')];var _0x4985c6=path[_0x4afc('0x10')](config[_0x4afc('0x63')],'server/files/tmp',_0x41bd77+'.csv');logger[_0x4afc('0x53')](_0x4afc('0x64'),_0x24e1d3);db[_0x4afc('0x65')][_0x4afc('0x16')]({'raw':!![],'attributes':['id',_0x4afc('0x66')]})[_0x4afc('0x18')](function(_0x37cfa6){for(var _0x3c81df=0x0;_0x3c81df<_0x37cfa6[_0x4afc('0x1c')];_0x3c81df++){if(_0x37cfa6[_0x3c81df][_0x4afc('0x66')]in _0x59fb43){contactItemTypes['push'](_0x37cfa6[_0x3c81df]);delete _0x19cb0b[_0x37cfa6[_0x3c81df]['name']];hasAdditionalPhones=!![];}for(var _0x458533 in _0x59fb43){if(_0x37cfa6[_0x3c81df][_0x4afc('0x66')]+'_description'===_0x458533){phoneDescriptions[_0x4afc('0x19')]({'itemTypeId':_0x37cfa6[_0x3c81df]['id'],'description':_0x458533});delete _0x19cb0b[_0x458533];}}}if(hasAdditionalPhones)_0x19cb0b[_0x4afc('0x17')]='';var _0x5be1a7=_['keys'](_0x19cb0b)[_0x4afc('0x10')]();logger[_0x4afc('0x53')](_0x4afc('0x67'),_0x5be1a7);fs['writeFileSync'](_0x4985c6,_0x5be1a7+'\x0a');Papa[_0x4afc('0x68')](fs['createReadStream'](_0x13891d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5a2be2,_0x10e5c6){try{for(var _0x37b5aa=0x0,_0x53f9ca=[];_0x37b5aa<_0x5a2be2[_0x4afc('0x69')][_0x4afc('0x1c')];_0x37b5aa++){stats[_0x4afc('0x6a')]+=0x1;if(_0x5a2be2[_0x4afc('0x57')][_0x37b5aa]){handleError(_0x5a2be2[_0x4afc('0x69')][_0x37b5aa],_0x5a2be2[_0x4afc('0x57')][_0x37b5aa]);}else{var _0x4a616e=[];var _0x25969c=[];var _0x1e8f64={};for(var _0x14e13e in _0x59fb43){let _0x4a014d=contactItemTypes['find'](_0x4a8d2c=>_0x4a8d2c[_0x4afc('0x66')]===_0x14e13e);let _0x135931=contactItemTypes[_0x4afc('0x6b')](_0x559a29=>_0x559a29[_0x4afc('0x66')]+'_description'===_0x14e13e);if(_['isNil'](_0x4a014d)&&_['isNil'](_0x135931)){if(_0x59fb43[_0x4afc('0x6c')](_0x14e13e)){if(_0x5a2be2[_0x4afc('0x69')][_0x37b5aa][_0x59fb43[_0x14e13e]]){var _0x1354f1=_['trim'](_0x5a2be2[_0x4afc('0x69')][_0x37b5aa][_0x59fb43[_0x14e13e]][_0x4afc('0x6d')](/"/g,'\x27'));switch(_0x14e13e){case _0x4afc('0x2b'):var _0x5e3e9b=moment(_0x1354f1,_0x4afc('0xc'),!![]);if(_0x5e3e9b[_0x4afc('0x6e')]()){_0x53f9ca[_0x4afc('0x19')]('\x22'+_0x1354f1+'\x22');}else{_0x4a616e[_0x4afc('0x19')](_0x4afc('0x6f'));}break;case'priority':var _0x549e31=parseInt(_0x1354f1);_0x1354f1=_[_0x4afc('0x70')](_0x549e31)||_0x549e31<0x0||_0x549e31>0x4?_0x4295a5?0x3:0x2:_0x549e31;_0x53f9ca[_0x4afc('0x19')]('\x22'+_0x1354f1+'\x22');break;case _0x4afc('0x30'):var _0x5dd264=parseInt(_0x1354f1);if(_[_0x4afc('0x71')](_0x5dd264)&&_[_0x4afc('0x72')](_0x3369a8,_0x5dd264)){_0x53f9ca[_0x4afc('0x19')]('\x22'+_0x5dd264+'\x22');}else{_0x4a616e[_0x4afc('0x19')](_0x4afc('0x73'));}break;case'email':if(isEmail(_0x1354f1)){_0x53f9ca[_0x4afc('0x19')]('\x22'+_0x1354f1+'\x22');}else{_0x4a616e[_0x4afc('0x19')]('email\x20wrong\x20format');}break;case _0x4afc('0x74'):var _0x3539ff=moment(_0x1354f1,_0x4afc('0x75'),!![]);if(_0x3539ff['isValid']()){_0x53f9ca[_0x4afc('0x19')]('\x22'+_0x1354f1+'\x22');}else{_0x4a616e[_0x4afc('0x19')](_0x4afc('0x76'));}break;default:_0x53f9ca[_0x4afc('0x19')]('\x22'+_0x1354f1+'\x22');}}else{switch(_0x14e13e){case _0x4afc('0x77'):case _0x4afc('0xf'):_0x4a616e[_0x4afc('0x19')](_0x14e13e+_0x4afc('0x78'));break;default:_0x53f9ca['push']('\x22\x22');}}}}else{var _0x457b2c='';if(!_['isNil'](_0x4a014d)){if(!_0x1e8f64['hasOwnProperty'](_0x4a014d['id'])){if(!_[_0x4afc('0x79')](_0x5a2be2[_0x4afc('0x69')][_0x37b5aa][_0x59fb43[_0x14e13e]])){var _0x1354f1=_['trim'](_0x5a2be2['data'][_0x37b5aa][_0x59fb43[_0x14e13e]][_0x4afc('0x6d')](/"/g,'\x27'));var _0x222e68=phoneDescriptions[_0x4afc('0x6b')](_0xb34abf=>_0xb34abf[_0x4afc('0x7a')]===_0x4a014d['id']);if(!_[_0x4afc('0x79')](_0x222e68)){var _0x4701ca=_[_0x4afc('0x7b')](_0x5a2be2[_0x4afc('0x69')][_0x37b5aa][_0x59fb43[_0x222e68[_0x4afc('0x7c')]]][_0x4afc('0x6d')](/"/g,'\x27'));if(!_[_0x4afc('0x79')](_0x4701ca))_0x1354f1=_0x1354f1+'§'+_0x4701ca;}if(_0x457b2c=='')_0x457b2c=_0x1354f1;else _0x457b2c+='|'+_0x1354f1;}_0x25969c[_0x4afc('0x19')](_0x4a014d['id']+':'+_0x457b2c);_0x1e8f64[_0x4a014d['id']]=0x1;}}}}if(hasAdditionalPhones){_0x53f9ca[_0x4afc('0x19')]('\x22'+_0x25969c[_0x4afc('0x10')](';')+'\x22');}if(_0x4a616e[_0x4afc('0x1c')]){handleError(_0x5a2be2['data'][_0x37b5aa],{'code':_0x4afc('0x7d'),'message':_0x4a616e[_0x4afc('0x10')]()});}else{fs[_0x4afc('0x7e')](_0x4985c6,_0x53f9ca[_0x4afc('0x10')]()+'\x0a');}_0x53f9ca=[];}if(!(stats[_0x4afc('0x6a')]%0xc8)){socket[_0x4afc('0x7f')](_0x4afc('0x80')+_0x41bd77,stats);stats[_0x4afc('0x57')]=[];}}if(stopped){logger[_0x4afc('0x53')]('Abort\x20parser');_0x10e5c6[_0x4afc('0x81')]();}}catch(_0x370b10){handleError(_0x5a2be2[_0x4afc('0x69')][_0x37b5aa],{'code':_0x4afc('0x82'),'message':_0x370b10['message']});logger[_0x4afc('0x55')](_0x4afc('0x83'),_0x370b10[_0x4afc('0x5c')]);}},'complete':function(){try{var _0x4956b2=[];var _0x46fe52=_0x4afc('0x34');if(_0x24e1d3[_0x4afc('0x84')]&&_0x24e1d3[_0x4afc('0x84')][_0x4afc('0x1c')]){_0x46fe52=_0x4afc('0x85')+_0x41bd77;_0x4956b2['push'](_0x4afc('0x86')+_0x46fe52+_0x4afc('0x87'));}var _0x561a88=util[_0x4afc('0xb')](_0x4afc('0x88'),_0x4985c6,_0x46fe52,_0x5be1a7,_0x24e1d3[_0x4afc('0x2d')],_0x24e1d3['CompanyId']||null,NOW,NOW);if(_[_0x4afc('0x79')](_0x59fb43[_0x4afc('0x2b')])){_0x561a88+=_0x4afc('0x89');}_0x4956b2[_0x4afc('0x19')](_0x561a88);if(_0x24e1d3['duplicates']&&_0x24e1d3[_0x4afc('0x84')][_0x4afc('0x1c')]){_0x4956b2['push'](insertCmContact(_0x24e1d3[_0x4afc('0x2d')],_0x46fe52,_0x24e1d3[_0x4afc('0x84')],_0x59fb43));_0x4956b2[_0x4afc('0x19')]('DROP\x20TABLE\x20'+_0x46fe52+';');}BPromise['each'](_0x4956b2,handleQuery)[_0x4afc('0x18')](function(_0x41116b){BPromise[_0x4afc('0x1a')]([handleAdditionalPhones()])[_0x4afc('0x18')](function(){_0x4956b2=[];for(var _0x109526=0x0;_0x109526_0x32a155[_0x72d0('0x6b')]===_0x3fac6c);let _0x38d361=contactItemTypes[_0x72d0('0x71')](_0x43ee9a=>_0x43ee9a[_0x72d0('0x6b')]+_0x72d0('0x6c')===_0x3fac6c);if(_[_0x72d0('0x1d')](_0x4c5136)&&_['isNil'](_0x38d361)){if(_0xba569e[_0x72d0('0x72')](_0x3fac6c)){if(_0x43c9fb['data'][_0x5528d2][_0xba569e[_0x3fac6c]]){var _0x53d1ef=_[_0x72d0('0x73')](_0x43c9fb['data'][_0x5528d2][_0xba569e[_0x3fac6c]][_0x72d0('0x74')](/"/g,'\x27'));switch(_0x3fac6c){case'scheduledat':var _0x2decfe=moment(_0x53d1ef,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2decfe[_0x72d0('0x75')]()){_0xac918e[_0x72d0('0x1e')]('\x22'+_0x53d1ef+'\x22');}else{_0xe252e5['push'](_0x72d0('0x76'));}break;case _0x72d0('0x3e'):var _0x59700c=parseInt(_0x53d1ef);_0x53d1ef=_[_0x72d0('0x77')](_0x59700c)||_0x59700c<0x0||_0x59700c>0x4?_0x223827?0x3:0x2:_0x59700c;_0xac918e[_0x72d0('0x1e')]('\x22'+_0x53d1ef+'\x22');break;case _0x72d0('0x78'):var _0x47a49c=parseInt(_0x53d1ef);if(_[_0x72d0('0x79')](_0x47a49c)&&_[_0x72d0('0x7a')](_0x102579,_0x47a49c)){_0xac918e['push']('\x22'+_0x47a49c+'\x22');}else{_0xe252e5[_0x72d0('0x1e')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x53d1ef)){_0xac918e[_0x72d0('0x1e')]('\x22'+_0x53d1ef+'\x22');}else{_0xe252e5[_0x72d0('0x1e')]('email\x20wrong\x20format');}break;case _0x72d0('0x7b'):var _0x21e7dd=moment(_0x53d1ef,_0x72d0('0x7c'),!![]);if(_0x21e7dd['isValid']()){_0xac918e[_0x72d0('0x1e')]('\x22'+_0x53d1ef+'\x22');}else{_0xe252e5[_0x72d0('0x1e')](_0x72d0('0x7d'));}break;default:_0xac918e[_0x72d0('0x1e')]('\x22'+_0x53d1ef+'\x22');}}else{switch(_0x3fac6c){case _0x72d0('0x7e'):case'phone':_0xe252e5[_0x72d0('0x1e')](_0x3fac6c+_0x72d0('0x7f'));break;default:_0xac918e[_0x72d0('0x1e')]('\x22\x22');}}}}else{var _0x50f6fb='';if(!_[_0x72d0('0x1d')](_0x4c5136)){if(!_0xc7b994[_0x72d0('0x72')](_0x4c5136['id'])){for(var _0x5449db=0x0;_0x5449db<_0xba569e[_0x3fac6c][_0x72d0('0x1c')];_0x5449db++){var _0x53d1ef=_['trim'](_0x43c9fb[_0x72d0('0x70')][_0x5528d2][_0xba569e[_0x3fac6c][_0x5449db]][_0x72d0('0x74')](/"/g,'\x27'));var _0x31cb17=phoneDescriptions['find'](_0x2b5e7d=>_0x2b5e7d[_0x72d0('0x80')]===_0x4c5136['id']);if(!_[_0x72d0('0x1d')](_0x31cb17)){var _0x4cf62a=_[_0x72d0('0x73')](_0x43c9fb[_0x72d0('0x70')][_0x5528d2][_0xba569e[_0x31cb17[_0x72d0('0x81')]][0x0]][_0x72d0('0x74')](/"/g,'\x27'));if(!_['isNil'](_0x4cf62a))_0x53d1ef=_0x53d1ef+'§'+_0x4cf62a;}if(_0x50f6fb=='')_0x50f6fb=_0x53d1ef;else _0x50f6fb+='|'+_0x53d1ef;}_0x31f130[_0x72d0('0x1e')](_0x4c5136['id']+':'+_0x50f6fb);_0xc7b994[_0x4c5136['id']]=0x1;}}}}if(hasAdditionalPhones){_0xac918e[_0x72d0('0x1e')]('\x22'+_0x31f130[_0x72d0('0x18')](';')+'\x22');}if(_0xe252e5['length']){handleError(_0x43c9fb['data'][_0x5528d2],{'code':'SystemRow','message':_0xe252e5[_0x72d0('0x18')]()});}else{fs[_0x72d0('0x82')](_0x4b1197,_0xac918e[_0x72d0('0x18')]()+'\x0a');}_0xac918e=[];}if(!(stats[_0x72d0('0x83')]%0xc8)){socket[_0x72d0('0x84')](_0x72d0('0x85')+_0x1cd726,stats);stats[_0x72d0('0x5f')]=[];}}if(stopped){logger[_0x72d0('0x5d')](_0x72d0('0x86'));_0x282781[_0x72d0('0x87')]();}}catch(_0x560b62){handleError(_0x43c9fb['data'][_0x5528d2],{'code':_0x72d0('0x88'),'message':_0x560b62[_0x72d0('0x22')]});logger[_0x72d0('0x61')](_0x72d0('0x89'),_0x560b62[_0x72d0('0x22')]);}},'complete':function(){try{var _0xaf2173=[];var _0xb1ec74=tempTableName;_0xaf2173[_0x72d0('0x1e')](_0x72d0('0x8a')+_0xb1ec74+'\x20LIKE\x20cm_contacts;');logger[_0x72d0('0x5d')](_0x72d0('0x8b'),contactItemTypes['length']);var _0x2269f4=util[_0x72d0('0xd')](_0x72d0('0x8c'),_0x4b1197,_0xb1ec74,_0x5bcea1,_0x5291dd[_0x72d0('0x3c')],_0x5291dd[_0x72d0('0x57')]||null,NOW,NOW);if(_['isNil'](_0xba569e[_0x72d0('0x8d')])){_0x2269f4+=_0x72d0('0x8e');}_0xaf2173['push'](_0x2269f4);BPromise[_0x72d0('0x8f')](_0xaf2173,handleQuery)['then'](function(_0x1c347d){BPromise[_0x72d0('0x1f')]([handleAdditionalPhones()])[_0x72d0('0x20')](function(){_0xaf2173=[];for(var _0x595bca=0x0;_0x595bca\x20\x20');}var _0x198321=path['join'](config[_0x72d0('0x66')],_0x72d0('0x67'),process[_0x72d0('0x9a')][0x2]);if(!fs[_0x72d0('0x9b')](_0x198321)){throw new Error(_0x72d0('0x9c'));}var _0x3e96c1={};try{_0x3e96c1=JSON['parse'](process[_0x72d0('0x9a')][0x3]);if(!_0x3e96c1[_0x72d0('0x64')]){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x1f6ed6=0x0;if(_0x3e96c1[_0x72d0('0x64')][_0x72d0('0x78')]){_0x1f6ed6=0x1;}if(!_0x3e96c1['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x5cfab2){throw new Error(_0x72d0('0x9d'));}var _0x9c7695=[];try{_0x9c7695=_[_0x72d0('0x9e')](JSON['parse'](process[_0x72d0('0x9a')][0x4]),'id');}catch(_0x1681a8){logger[_0x72d0('0x5d')](_0x72d0('0x9f'));}main(_0x198321,_0x3e96c1,_0x9c7695,_0x1f6ed6);}validate();process['on'](_0x72d0('0xa0'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x56c8=['select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','filter','CmContactHasItem','findOne','updated','create','PHONE','inserted','update','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.priority','insert','into','cm_hopper','fromQuery','ContactId','ListId','createdAt','updatedAt','priority','recallme','fields','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.createdAt','cm_contacts.updatedAt','cm_hopper_black','cm_contacts.ListId\x20=\x20','cm_contacts.createdAt\x20=\x20?','field','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contacts','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','min_id','info','exit','code','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','header','writeFileSync','parse','createReadStream','rows','errors','data','find','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','itemTypeId','description','SystemRow','emit','contact:import:','Abort\x20parser','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query'];(function(_0xd2f4ac,_0x5aa8e5){var _0x9757b2=function(_0x442ced){while(--_0x442ced){_0xd2f4ac['push'](_0xd2f4ac['shift']());}};_0x9757b2(++_0x5aa8e5);}(_0x56c8,0x12f));var _0x856c=function(_0x20669b,_0x1468ea){_0x20669b=_0x20669b-0x0;var _0x37d52f=_0x56c8[_0x20669b];return _0x37d52f;};'use strict';var fs=require('fs');var path=require(_0x856c('0x0'));var _=require(_0x856c('0x1'));var Papa=require(_0x856c('0x2'));var util=require(_0x856c('0x3'));var BPromise=require('bluebird');var moment=require(_0x856c('0x4'));var squel=require(_0x856c('0x5'));var Redis=require(_0x856c('0x6'));var db=require(_0x856c('0x7'))['db'];var config=require(_0x856c('0x8'));var logger=require('../../../config/logger')(_0x856c('0x9'));config[_0x856c('0xa')]=_[_0x856c('0xb')](config[_0x856c('0xa')],{'host':_0x856c('0xc'),'port':0x18eb});var socket=require(_0x856c('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format'](_0x856c('0xe'));var tempTableName=_0x856c('0xf')+moment()[_0x856c('0x10')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4b8bbc){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x4b8bbc);}function selectNotIn(_0x619489,_0x36e8ef,_0x3bf8f1,_0x5082f3,_0x134cc9){return squel[_0x856c('0x11')]()['field'](_0x856c('0x12'))[_0x856c('0x13')](_0x5082f3)[_0x856c('0x14')](_0x36e8ef,null,_0x36e8ef+_0x856c('0x15')+_0x5082f3+'.'+_0x3bf8f1)[_0x856c('0x16')](_0x5082f3+'.'+_0x3bf8f1+_0x856c('0x17')+_0x619489+'.'+_0x3bf8f1)[_0x856c('0x16')](_0x36e8ef+_0x856c('0x18')+_0x134cc9['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x45213f,_0x5307b7){promisesAdditionalPhones=[];promisesContact=[];return db[_0x856c('0x19')][_0x856c('0x1a')](_0x856c('0x1b')+tempTableName)[_0x856c('0x1c')](function(_0x6856e5){if(_0x6856e5!==null){var _0x13f1ae=[];for(var _0x26aba6=0x0;_0x26aba6<_0x6856e5[_0x856c('0x1d')];_0x26aba6++){var _0x250996=_0x6856e5[_0x26aba6];if(!_[_0x856c('0x1e')](_0x250996[_0x856c('0x12')])){if(!_[_0x856c('0x1e')](_0x250996[_0x856c('0x1f')]))_0x13f1ae[_0x856c('0x20')](insertAdditionalPhones(_0x250996));promisesContact[_0x856c('0x20')]({'contact':_0x250996});}}}Promise[_0x856c('0x21')](_0x13f1ae)[_0x856c('0x22')](function(){_0x45213f({'val':0x1});});})[_0x856c('0x23')](function(_0x248330){logger[_0x856c('0x24')](_0x248330[_0x856c('0x25')]);});});}function insertAdditionalPhones(_0x1dd835){return new Promise(function(_0x4c42e0,_0x51ce3a){var _0x9b678d=_0x1dd835[_0x856c('0x1f')];if(_[_0x856c('0x1e')](_0x9b678d))_0x51ce3a({'val':0x0});else{var _0x55b2d1=_0x9b678d[_0x856c('0x26')](';');var _0x4be642=[];orderBy=0x0;for(var _0x202357=0x0;_0x202357<_0x55b2d1[_0x856c('0x1d')];_0x202357++){_0x4be642[_0x856c('0x20')](splitAdditionalPhone(_0x1dd835['id'],_0x55b2d1[_0x202357]));}Promise['all'](_0x4be642)[_0x856c('0x22')](function(){_0x4c42e0({'val':_0x55b2d1[_0x856c('0x1d')]});});}});}function splitAdditionalPhone(_0x3984a7,_0x106e38){return new Promise(function(_0x901a0c,_0x3b2f35){var _0x571953=_0x106e38[_0x856c('0x26')](':');var _0x16678d=_0x571953[0x0];var _0x4150ec=_0x571953[0x1];if(_0x4150ec!==''){var _0x47e45c=_0x4150ec[_0x856c('0x26')]('|');var _0x56caca=[];for(var _0x1544d4=0x0;_0x1544d4<_0x47e45c['length'];_0x1544d4++){if(_0x47e45c[_0x1544d4]!==''){var _0x3d38d4=_[_0x856c('0x27')](promisesAdditionalPhones,{'contactId':_0x3984a7,'phone':_0x47e45c[_0x1544d4]});if(_0x3d38d4['length']==0x0){orderBy++;promisesAdditionalPhones[_0x856c('0x20')]({'contactId':_0x3984a7,'contactTypeId':_0x16678d,'phone':_0x47e45c[_0x1544d4],'orderBy':orderBy});}}}_0x901a0c({'ok':0x1});}else _0x901a0c({'res':0x0});});}function createAdditionalPhone(_0x514d6c,_0x1a0a48,_0x384f5f,_0x21db5d){var _0x4f3d41='';var _0x34429e='';var _0x3548ab=_0x384f5f[_0x856c('0x26')]('§');_0x4f3d41=_0x3548ab[0x0];if(_0x3548ab['length']==0x2)_0x34429e=_0x3548ab[0x1];return new Promise(function(_0x4b45c6,_0x3eaced){return db[_0x856c('0x28')][_0x856c('0x29')]({'where':{'CmContactId':_0x514d6c,'item':_0x4f3d41}})[_0x856c('0x22')](function(_0x39ab90){if(_0x39ab90){return db[_0x856c('0x28')]['update']({'ItemTypeId':_0x1a0a48,'description':_0x34429e,'OrderBy':_0x21db5d},{'where':{'CmContactId':_0x514d6c,'item':_0x4f3d41}})[_0x856c('0x22')](function(_0x866950){_0x4b45c6({'res':_0x856c('0x2a')});});}else{return db[_0x856c('0x28')][_0x856c('0x2b')]({'CmContactId':_0x514d6c,'item':_0x4f3d41,'ItemTypeId':_0x1a0a48,'description':_0x34429e,'OrderBy':_0x21db5d,'ItemClass':_0x856c('0x2c')})['then'](function(_0x11299d){_0x4b45c6({'res':_0x856c('0x2d')});});}});});}function updateContact(_0x3df0c6){return new Promise(function(_0x56a441,_0x184415){var _0x32daae=_0x3df0c6['id'];delete _0x3df0c6['id'];return db['CmContact'][_0x856c('0x2e')](_0x3df0c6,{'where':{'id':_0x32daae}})[_0x856c('0x22')](function(_0x661f89){updatedRows+=0x1;return db[_0x856c('0x2f')][_0x856c('0x2e')]({'phone':_0x3df0c6['phone']},{'where':{'ContactId':_0x32daae}})[_0x856c('0x22')](function(_0x943463){_0x56a441({'ret':'OK'});});});});}function insertCmHopper(_0x264cd8,_0x26cd75,_0x19acd5,_0x3292b8,_0x106cb3){var _0x1b81ba=[_0x856c('0x30'),_0x856c('0x31'),_0x856c('0x32'),_0x856c('0x33'),_0x26cd75+'.'+_0x3292b8,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x856c('0x34'),'cm_contacts.UserId','\x22'+_0x106cb3+'\x22'];return squel[_0x856c('0x35')]()[_0x856c('0x36')](_0x856c('0x37'))[_0x856c('0x38')]([_0x856c('0x12'),'scheduledat',_0x856c('0x39'),_0x856c('0x3a'),_0x3292b8,_0x856c('0x3b'),_0x856c('0x3c'),_0x856c('0x3d'),'UserId',_0x856c('0x3e')],squel[_0x856c('0x11')]()[_0x856c('0x3f')](_0x1b81ba)[_0x856c('0x13')](_0x26cd75)[_0x856c('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x26cd75+_0x856c('0x40'))[_0x856c('0x14')](_0x19acd5,null,_0x19acd5+_0x856c('0x15')+_0x26cd75+'.'+_0x3292b8)['where'](_0x26cd75+_0x856c('0x41'),_0x264cd8)[_0x856c('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x856c('0x42'),selectNotIn(_0x26cd75,_0x19acd5,_0x3292b8,_0x856c('0x37'),[_0x856c('0x43'),_0x856c('0x44')]))[_0x856c('0x16')](_0x856c('0x42'),selectNotIn(_0x26cd75,_0x19acd5,_0x3292b8,_0x856c('0x37'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x353d3f,_0x487fb6,_0x10c6d6,_0x29234d){var _0x2821ae=[_0x856c('0x30'),'cm_contacts.id',_0x856c('0x33'),_0x487fb6+'.'+_0x29234d,_0x856c('0x45'),_0x856c('0x46')];return squel[_0x856c('0x35')]()[_0x856c('0x36')](_0x856c('0x47'))[_0x856c('0x38')]([_0x856c('0x12'),'ContactId',_0x856c('0x3a'),_0x29234d,_0x856c('0x3b'),_0x856c('0x3c')],squel['select']()[_0x856c('0x3f')](_0x2821ae)[_0x856c('0x13')](_0x487fb6)[_0x856c('0x14')]('cm_contacts',null,_0x856c('0x48')+_0x487fb6+_0x856c('0x40'))['join'](_0x10c6d6,null,_0x10c6d6+_0x856c('0x15')+_0x487fb6+'.'+_0x29234d)[_0x856c('0x16')](_0x487fb6+_0x856c('0x41'),_0x353d3f)[_0x856c('0x16')](_0x856c('0x49'),NOW)[_0x856c('0x16')](_0x856c('0x42'),squel[_0x856c('0x11')]()[_0x856c('0x4a')](_0x856c('0x12'))[_0x856c('0x13')](_0x856c('0x47'))[_0x856c('0x16')]('ListId\x20=\x20?',_0x353d3f)[_0x856c('0x16')](_0x29234d+_0x856c('0x4b'),_0x487fb6+'.'+_0x29234d)))[_0x856c('0x4c')]();}function insertCmHopperAdditionalPhones(_0x9e9f27){var _0x23d403=[_0x856c('0x4d'),'cm_contact_has_items.item',_0x856c('0x4e'),_0x856c('0x4f'),_0x856c('0x50')];return squel[_0x856c('0x35')]()['into'](_0x856c('0x51'))['fromQuery']([_0x856c('0x52'),_0x856c('0x12'),'OrderBy','createdAt',_0x856c('0x3c')],squel['select']()['fields'](_0x23d403)[_0x856c('0x13')](_0x856c('0x37'))[_0x856c('0x14')](_0x856c('0x53'),null,_0x856c('0x54'))[_0x856c('0x14')](_0x856c('0x55'),null,_0x856c('0x56'))[_0x856c('0x16')](_0x856c('0x57'),_0x9e9f27)['where'](_0x856c('0x49'),NOW))[_0x856c('0x4c')]();}function insertCmContact(_0x4b1955,_0x24b805,_0x4f3fc9,_0xfef2ae){var _0x4bea93=_[_0x856c('0x58')](_[_0x856c('0x59')](_0xfef2ae),[_0x856c('0x3a'),_0x856c('0x5a'),_0x856c('0x3b'),_0x856c('0x3c')]);return squel['insert']()[_0x856c('0x36')](_0x856c('0x53'))[_0x856c('0x38')](_0x4bea93,squel[_0x856c('0x11')]()[_0x856c('0x3f')](_0x4bea93)[_0x856c('0x13')](_0x24b805)[_0x856c('0x16')]('('+_0x4f3fc9[_0x856c('0x14')](',')+_0x856c('0x5b'),squel[_0x856c('0x11')]()[_0x856c('0x3f')](_0x4f3fc9)[_0x856c('0x13')](_0x856c('0x53'))['where'](_0x856c('0x5c'),_0x4b1955))['where'](_0x856c('0x5d'),squel[_0x856c('0x11')]()[_0x856c('0x4a')]('MIN(id)',_0x856c('0x5e'))['from'](_0x24b805)['group'](_0x4f3fc9['join'](','))))[_0x856c('0x4c')]();}function handleStop(){logger[_0x856c('0x5f')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xcbec5b){logger[_0x856c('0x24')](_0xcbec5b[_0x856c('0x25')]);process[_0x856c('0x60')](0x1);}function handleError(_0x1e3978,_0x2ae5cb){stats['errors'][_0x856c('0x20')]({'name':_0x2ae5cb[_0x856c('0x61')],'message':_0x2ae5cb[_0x856c('0x25')],'row':_0x1e3978});}function handleQuery(_0x42ebe9){logger[_0x856c('0x5f')](_0x42ebe9);return db[_0x856c('0x19')][_0x856c('0x1a')](_0x42ebe9)['spread'](function(_0x38f8b1){results['push'](_0x38f8b1);})[_0x856c('0x23')](function(_0x5dda99){logger[_0x856c('0x24')](_0x5dda99[_0x856c('0x25')]);});}function main(_0x5a96da,_0x3b8e15,_0x33b699,_0x2fc1e1){logger[_0x856c('0x5f')](_0x856c('0x62'),_0x5a96da,JSON[_0x856c('0x63')](_0x3b8e15));process[_0x856c('0x64')](_0x856c('0x65'));var _0x5bfec7=_0x3b8e15[_0x856c('0x66')];var _0x45d26f=_[_0x856c('0x67')](_0x5bfec7);var _0x187b13=_0x3b8e15['socket_timestamp'];var _0x2b73ac=path['join'](config[_0x856c('0x68')],_0x856c('0x69'),_0x187b13+_0x856c('0x6a'));logger['info'](_0x856c('0x6b'),_0x3b8e15);db[_0x856c('0x6c')][_0x856c('0x6d')]({'raw':!![],'attributes':['id',_0x856c('0x6e')]})[_0x856c('0x22')](function(_0x30bf83){for(var _0x1698da=0x0;_0x1698da<_0x30bf83[_0x856c('0x1d')];_0x1698da++){if(_0x30bf83[_0x1698da][_0x856c('0x6e')]in _0x5bfec7){contactItemTypes[_0x856c('0x20')](_0x30bf83[_0x1698da]);delete _0x45d26f[_0x30bf83[_0x1698da][_0x856c('0x6e')]];hasAdditionalPhones=!![];}for(var _0x3c4136 in _0x5bfec7){if(_0x30bf83[_0x1698da]['name']+_0x856c('0x6f')===_0x3c4136){phoneDescriptions[_0x856c('0x20')]({'itemTypeId':_0x30bf83[_0x1698da]['id'],'description':_0x3c4136});delete _0x45d26f[_0x3c4136];}}}if(hasAdditionalPhones)_0x45d26f[_0x856c('0x1f')]='';var _0x219a6a=_[_0x856c('0x59')](_0x45d26f)[_0x856c('0x14')]();logger['info'](_0x856c('0x70'),_0x219a6a);fs[_0x856c('0x71')](_0x2b73ac,_0x219a6a+'\x0a');Papa[_0x856c('0x72')](fs[_0x856c('0x73')](_0x5a96da),{'header':!![],'skipEmptyLines':!![],'step':function(_0x40eacb,_0x1b5231){try{for(var _0x3dbbf3=0x0,_0x55646e=[];_0x3dbbf3<_0x40eacb['data'][_0x856c('0x1d')];_0x3dbbf3++){stats[_0x856c('0x74')]+=0x1;if(_0x40eacb[_0x856c('0x75')][_0x3dbbf3]){handleError(_0x40eacb[_0x856c('0x76')][_0x3dbbf3],_0x40eacb[_0x856c('0x75')][_0x3dbbf3]);}else{var _0x4104c0=[];var _0x4c4ca8=[];var _0x57dd5d={};for(var _0xafcbcf in _0x5bfec7){let _0x2dfe54=contactItemTypes['find'](_0x1cee76=>_0x1cee76[_0x856c('0x6e')]===_0xafcbcf);let _0xa2443b=contactItemTypes[_0x856c('0x77')](_0x5e170f=>_0x5e170f[_0x856c('0x6e')]+_0x856c('0x6f')===_0xafcbcf);if(_[_0x856c('0x1e')](_0x2dfe54)&&_[_0x856c('0x1e')](_0xa2443b)){if(_0x5bfec7['hasOwnProperty'](_0xafcbcf)){if(_0x40eacb[_0x856c('0x76')][_0x3dbbf3][_0x5bfec7[_0xafcbcf]]){var _0x476c55=_[_0x856c('0x78')](_0x40eacb[_0x856c('0x76')][_0x3dbbf3][_0x5bfec7[_0xafcbcf]][_0x856c('0x79')](/"/g,'\x27'));switch(_0xafcbcf){case _0x856c('0x7a'):var _0x1f4ff8=moment(_0x476c55,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x1f4ff8[_0x856c('0x7b')]()){_0x55646e['push']('\x22'+_0x476c55+'\x22');}else{_0x4104c0['push'](_0x856c('0x7c'));}break;case _0x856c('0x3d'):var _0x4db91e=parseInt(_0x476c55);_0x476c55=_[_0x856c('0x7d')](_0x4db91e)||_0x4db91e<0x0||_0x4db91e>0x4?_0x2fc1e1?0x3:0x2:_0x4db91e;_0x55646e[_0x856c('0x20')]('\x22'+_0x476c55+'\x22');break;case'UserId':var _0x435225=parseInt(_0x476c55);if(_[_0x856c('0x7e')](_0x435225)&&_[_0x856c('0x7f')](_0x33b699,_0x435225)){_0x55646e[_0x856c('0x20')]('\x22'+_0x435225+'\x22');}else{_0x4104c0[_0x856c('0x20')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x476c55)){_0x55646e[_0x856c('0x20')]('\x22'+_0x476c55+'\x22');}else{_0x4104c0['push'](_0x856c('0x80'));}break;case _0x856c('0x81'):var _0x1cdba2=moment(_0x476c55,'YYYY-MM-DD',!![]);if(_0x1cdba2[_0x856c('0x7b')]()){_0x55646e[_0x856c('0x20')]('\x22'+_0x476c55+'\x22');}else{_0x4104c0[_0x856c('0x20')](_0x856c('0x82'));}break;default:_0x55646e[_0x856c('0x20')]('\x22'+_0x476c55+'\x22');}}else{switch(_0xafcbcf){case _0x856c('0x83'):case _0x856c('0x12'):_0x4104c0['push'](_0xafcbcf+_0x856c('0x84'));break;default:_0x55646e[_0x856c('0x20')]('\x22\x22');}}}}else{var _0xd62bd0='';if(!_[_0x856c('0x1e')](_0x2dfe54)){if(!_0x57dd5d[_0x856c('0x85')](_0x2dfe54['id'])){for(var _0x4fb451=0x0;_0x4fb451<_0x5bfec7[_0xafcbcf][_0x856c('0x1d')];_0x4fb451++){var _0x476c55=_[_0x856c('0x78')](_0x40eacb[_0x856c('0x76')][_0x3dbbf3][_0x5bfec7[_0xafcbcf][_0x4fb451]][_0x856c('0x79')](/"/g,'\x27'));var _0x4ef88c=phoneDescriptions[_0x856c('0x77')](_0x11f8aa=>_0x11f8aa[_0x856c('0x86')]===_0x2dfe54['id']);if(!_[_0x856c('0x1e')](_0x4ef88c)){var _0x1695ef=_[_0x856c('0x78')](_0x40eacb[_0x856c('0x76')][_0x3dbbf3][_0x5bfec7[_0x4ef88c[_0x856c('0x87')]][0x0]][_0x856c('0x79')](/"/g,'\x27'));if(!_['isNil'](_0x1695ef))_0x476c55=_0x476c55+'§'+_0x1695ef;}if(_0xd62bd0=='')_0xd62bd0=_0x476c55;else _0xd62bd0+='|'+_0x476c55;}_0x4c4ca8[_0x856c('0x20')](_0x2dfe54['id']+':'+_0xd62bd0);_0x57dd5d[_0x2dfe54['id']]=0x1;}}}}if(hasAdditionalPhones){_0x55646e[_0x856c('0x20')]('\x22'+_0x4c4ca8['join'](';')+'\x22');}if(_0x4104c0[_0x856c('0x1d')]){handleError(_0x40eacb[_0x856c('0x76')][_0x3dbbf3],{'code':_0x856c('0x88'),'message':_0x4104c0[_0x856c('0x14')]()});}else{fs['appendFileSync'](_0x2b73ac,_0x55646e['join']()+'\x0a');}_0x55646e=[];}if(!(stats[_0x856c('0x74')]%0xc8)){socket[_0x856c('0x89')](_0x856c('0x8a')+_0x187b13,stats);stats[_0x856c('0x75')]=[];}}if(stopped){logger[_0x856c('0x5f')](_0x856c('0x8b'));_0x1b5231['abort']();}}catch(_0x437113){handleError(_0x40eacb[_0x856c('0x76')][_0x3dbbf3],{'code':_0x856c('0x8c'),'message':_0x437113[_0x856c('0x25')]});logger[_0x856c('0x24')](_0x856c('0x8d'),_0x437113[_0x856c('0x25')]);}},'complete':function(){try{var _0x1cd814=[];var _0x3fea4b=tempTableName;_0x1cd814[_0x856c('0x20')](_0x856c('0x8e')+_0x3fea4b+_0x856c('0x8f'));logger[_0x856c('0x5f')](_0x856c('0x90'),contactItemTypes['length']);var _0x53a577=util[_0x856c('0x10')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x2b73ac,_0x3fea4b,_0x219a6a,_0x3b8e15['ListId'],_0x3b8e15[_0x856c('0x5a')]||null,NOW,NOW);if(_[_0x856c('0x1e')](_0x5bfec7[_0x856c('0x7a')])){_0x53a577+=_0x856c('0x91');}_0x1cd814[_0x856c('0x20')](_0x53a577);BPromise[_0x856c('0x92')](_0x1cd814,handleQuery)[_0x856c('0x22')](function(_0x143694){BPromise[_0x856c('0x21')]([handleAdditionalPhones()])[_0x856c('0x22')](function(){_0x1cd814=[];for(var _0x52a64a=0x0;_0x52a64a=_0x32eb6c){return _0x23c18d[_0x2a2c('0x10')](0x193)[_0x2a2c('0x11')]({'message':util[_0x2a2c('0x6')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2201e1)});}_0x55620b();})[_0x2a2c('0x12')](function(_0x52bed6){_0x55620b(_0x52bed6);});});}function isUserLimit(){return isLimit(_0x2a2c('0x13'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x2a2c('0x14')]=isUserLimit; \ No newline at end of file +var _0x9133=['then','count','status','json','User','isUserLimit','crypto','util','../../mysqldb','../../config/environment','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x9133,0x196));var _0x3913=function(_0x5c468f,_0x2e5c25){_0x5c468f=_0x5c468f-0x0;var _0x2136b0=_0x9133[_0x5c468f];return _0x2136b0;};'use strict';var crypto=require(_0x3913('0x0'));var util=require(_0x3913('0x1'));var compose=require('composable-middleware');var db=require(_0x3913('0x2'))['db'];var config=require(_0x3913('0x3'));function getValueFromLicense(_0x4638bc,_0x2423ec){if(_0x4638bc&&_0x2423ec){if(_0x2423ec['data1']&&_0x2423ec[_0x3913('0x4')]){var _0x26d877=_0x2423ec['data1'];var _0x229f44=_0x2423ec[_0x3913('0x4')];var _0x53d3f8=_0x26d877[_0x3913('0x5')]('-')[0x4];var _0x5a3a3a=_0x26d877['split']('-')[0x0];var _0x52ed7f=crypto[_0x3913('0x6')](_0x3913('0x7'),util[_0x3913('0x8')](_0x3913('0x9'),_0x53d3f8,_0x26d877,_0x5a3a3a));var _0x38a27d=_0x52ed7f[_0x3913('0xa')](_0x229f44,_0x3913('0xb'),_0x3913('0xc'));_0x38a27d+=_0x52ed7f[_0x3913('0xd')](_0x3913('0xc'));var _0x73c790=JSON[_0x3913('0xe')](_0x38a27d);return _0x73c790[_0x3913('0xf')](_0x4638bc)?_0x73c790[_0x4638bc]:null;}}return null;}function isLimit(_0x24af23,_0x1fabf4,_0x25d1e6,_0x52f093){var _0x5eb1ed=_0x1fabf4;return compose()[_0x3913('0x10')](function(_0x5526a8,_0x58efd3,_0x50e6f3){return db[_0x3913('0x11')][_0x3913('0x12')]({'where':{'id':0x1},'raw':!![]})[_0x3913('0x13')](function(_0x2320d8){var _0x497889=getValueFromLicense(_0x24af23,_0x2320d8);return _0x497889?_0x497889:_0x5eb1ed;})['then'](function(_0x2f39b2){_0x5eb1ed=_0x2f39b2;return _0x25d1e6[_0x3913('0x14')](_0x52f093);})[_0x3913('0x13')](function(_0x587b3b){if(_0x587b3b>=_0x5eb1ed){return _0x58efd3[_0x3913('0x15')](0x193)[_0x3913('0x16')]({'message':util[_0x3913('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x24af23)});}_0x50e6f3();})['catch'](function(_0x595c66){_0x50e6f3(_0x595c66);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x3913('0x17')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x3913('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 4c7cef5..dd550a7 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 _0xb6e8=['indexOf','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','days','format','castTo','text','$ne','$notIn','\x20OR\x20','field','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','start','pop','utcOffset','minutes','seconds','moment','parseSearch','startsWith','[$or]','and','replace','[$and]','split','forEach','shift','match','filter'];(function(_0x2c18a8,_0x24eaa5){var _0x1e009a=function(_0x5dea3a){while(--_0x5dea3a){_0x2c18a8['push'](_0x2c18a8['shift']());}};_0x1e009a(++_0x24eaa5);}(_0xb6e8,0x126));var _0x8b6e=function(_0x40f4d1,_0x48c5ab){_0x40f4d1=_0x40f4d1-0x0;var _0x157b07=_0xb6e8[_0x40f4d1];return _0x157b07;};'use strict';var _=require('lodash');var moment=require(_0x8b6e('0x0'));exports[_0x8b6e('0x1')]=function(_0x1cc8ab){var _0x104067={'conditions':[]};_0x104067['sqlOperator']=_[_0x8b6e('0x2')](_0x1cc8ab,_0x8b6e('0x3'))?'or':_0x8b6e('0x4');var _0x293803=_0x1cc8ab[_0x8b6e('0x5')](_0x8b6e('0x6'),'')['replace'](_0x8b6e('0x3'),'')[_0x8b6e('0x7')]('||');for(var _0x339fd3=0x0;_0x339fd3<_0x293803['length'];_0x339fd3++){var _0x3505d1=_0x293803[_0x339fd3][_0x8b6e('0x7')](':=');var _0x1a3fc9=_0x3505d1[0x0];var _0x1c60c3=_0x3505d1['slice'](0x1);_0x1c60c3[_0x8b6e('0x8')](function(_0x1fdbbf){var _0x5293c6=_0x1fdbbf[_0x8b6e('0x7')]('[')[_0x8b6e('0x9')]();var _0x6c1496=_0x1fdbbf[_0x8b6e('0xa')](/\[(.*?)\]/g);_0x6c1496['forEach'](function(_0x235f7c){var _0x1e458b=_0x235f7c[_0x8b6e('0x7')]('[')[_0x8b6e('0xb')](function(_0x1de018){return _0x1de018[_0x8b6e('0xc')](']')>-0x1;})['map'](function(_0x3bbd6e){return _0x3bbd6e['split'](']')[0x0];})[0x0];_0x104067['conditions'][_0x8b6e('0xd')]({'field':_0x1a3fc9,'operator':_0x5293c6,'value':_0x1e458b});});});}return _0x104067;};exports[_0x8b6e('0xe')]=function(_0x5c9132,_0x2b4b29,_0x6928a6){var _0x56587e={};if(_0x2b4b29===_0x8b6e('0xf')){if(_0x6928a6['operator']==='$eq'){_0x6928a6[_0x8b6e('0x10')]=_0x8b6e('0x11');_0x6928a6[_0x8b6e('0x12')]+=','+_0x6928a6[_0x8b6e('0x12')];}else if(_[_0x8b6e('0x13')]([_0x8b6e('0x14'),_0x8b6e('0x15')],_0x6928a6[_0x8b6e('0x10')])){_0x6928a6['value']=moment(_0x6928a6[_0x8b6e('0x12')])[_0x8b6e('0x16')](0x1,_0x8b6e('0x17'))[_0x8b6e('0x18')]('YYYY-MM-DD');}}if(_0x6928a6[_0x8b6e('0x19')]){_0x2b4b29=_0x6928a6[_0x8b6e('0x19')];_0x56587e[_0x8b6e('0x1a')]='CAST('+_0x5c9132+'.'+_0x6928a6['field']+'\x20AS\x20'+_0x6928a6[_0x8b6e('0x19')]+')\x20'+parseOperator(_0x6928a6[_0x8b6e('0x10')]);}else{_0x56587e[_0x8b6e('0x1a')]=_0x5c9132+'.'+_0x6928a6['field']+'\x20'+parseOperator(_0x6928a6['operator']);}if(_[_0x8b6e('0x13')]([_0x8b6e('0x1b'),_0x8b6e('0x1c')],_0x6928a6[_0x8b6e('0x10')]))_0x56587e[_0x8b6e('0x1a')]='('+_0x56587e[_0x8b6e('0x1a')]+_0x8b6e('0x1d')+_0x5c9132+'.'+_0x6928a6[_0x8b6e('0x1e')]+'\x20IS\x20NULL)';_0x56587e[_0x8b6e('0x12')]=parseValue(_0x2b4b29,_0x6928a6[_0x8b6e('0x10')],_0x6928a6['value']);return _0x56587e;};function parseOperator(_0x167c1a){var _0x29d130;switch(_0x167c1a){case _0x8b6e('0x1f'):_0x29d130=_0x8b6e('0x20');break;case _0x8b6e('0x1c'):_0x29d130=_0x8b6e('0x21');break;case _0x8b6e('0x22'):_0x29d130=_0x8b6e('0x23');break;case'$ne':_0x29d130=_0x8b6e('0x24');break;case _0x8b6e('0x25'):case _0x8b6e('0x26'):case _0x8b6e('0x27'):_0x29d130=_0x8b6e('0x28');break;case _0x8b6e('0x29'):_0x29d130=_0x8b6e('0x2a');break;case'$gt':_0x29d130=_0x8b6e('0x2b');break;case _0x8b6e('0x15'):_0x29d130=_0x8b6e('0x2c');break;case _0x8b6e('0x2d'):_0x29d130='>=\x20?';break;case _0x8b6e('0x11'):_0x29d130='BETWEEN\x20?\x20AND\x20?';break;}return _0x29d130;}function parseValue(_0x211d20,_0x26f204,_0xf1b487){var _0x3b7e1f={'start':undefined,'end':undefined};switch(_0x26f204){case _0x8b6e('0x1f'):case'$notIn':_0x3b7e1f[_0x8b6e('0x2e')]=_0xf1b487[_0x8b6e('0x7')](',');break;case'$substring':_0x3b7e1f[_0x8b6e('0x2e')]='%'+_0xf1b487+'%';break;case _0x8b6e('0x26'):_0x3b7e1f[_0x8b6e('0x2e')]=_0xf1b487+'%';break;case _0x8b6e('0x27'):_0x3b7e1f[_0x8b6e('0x2e')]='%'+_0xf1b487;break;case'$between':var _0x1488ea=_0xf1b487[_0x8b6e('0x7')](',');var _0xf1b487=_0x1488ea['shift']();var _0x10cd47=_0x1488ea[_0x8b6e('0x2f')]();if(_0x211d20===_0x8b6e('0xf')){_0xf1b487=moment(_0xf1b487)['utcOffset'](0x0,!![])['format']();_0x10cd47=moment(_0x10cd47)[_0x8b6e('0x30')](0x0,!![])[_0x8b6e('0x16')](0x17,'hours')[_0x8b6e('0x16')](0x3b,_0x8b6e('0x31'))['add'](0x3b,_0x8b6e('0x32'))['format']();}_0x3b7e1f={'start':_0xf1b487,'end':_0x10cd47};break;default:_0x3b7e1f[_0x8b6e('0x2e')]=_0xf1b487;break;}return _0x3b7e1f;} \ No newline at end of file +var _0x8519=['$eq','value','includes','$lte','add','days','format','YYYY-MM-DD','text','CAST(','field','castTo','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$startsWith','$endsWith','LIKE\x20?','>\x20?','$gte','$between','BETWEEN\x20?\x20AND\x20?','$notIn','start','$substring','pop','utcOffset','hours','lodash','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','length','split','slice','forEach','shift','filter','map','conditions','push','buildExpression','DATE','operator'];(function(_0x3b56c0,_0xe100d8){var _0x377efe=function(_0x181589){while(--_0x181589){_0x3b56c0['push'](_0x3b56c0['shift']());}};_0x377efe(++_0xe100d8);}(_0x8519,0x11e));var _0x9851=function(_0x1aa12b,_0x3321d5){_0x1aa12b=_0x1aa12b-0x0;var _0x45e3ca=_0x8519[_0x1aa12b];return _0x45e3ca;};'use strict';var _=require(_0x9851('0x0'));var moment=require('moment');exports[_0x9851('0x1')]=function(_0x28a52d){var _0x150454={'conditions':[]};_0x150454[_0x9851('0x2')]=_[_0x9851('0x3')](_0x28a52d,_0x9851('0x4'))?'or':_0x9851('0x5');var _0x29d1d9=_0x28a52d['replace'](_0x9851('0x6'),'')[_0x9851('0x7')](_0x9851('0x4'),'')['split']('||');for(var _0x495e8b=0x0;_0x495e8b<_0x29d1d9[_0x9851('0x8')];_0x495e8b++){var _0x43cc1c=_0x29d1d9[_0x495e8b][_0x9851('0x9')](':=');var _0x185df8=_0x43cc1c[0x0];var _0x2f2a02=_0x43cc1c[_0x9851('0xa')](0x1);_0x2f2a02[_0x9851('0xb')](function(_0x12380f){var _0x569604=_0x12380f[_0x9851('0x9')]('[')[_0x9851('0xc')]();var _0x4f6b61=_0x12380f['match'](/\[(.*?)\]/g);_0x4f6b61[_0x9851('0xb')](function(_0xc18544){var _0x366834=_0xc18544['split']('[')[_0x9851('0xd')](function(_0x262e7f){return _0x262e7f['indexOf'](']')>-0x1;})[_0x9851('0xe')](function(_0x392107){return _0x392107[_0x9851('0x9')](']')[0x0];})[0x0];_0x150454[_0x9851('0xf')][_0x9851('0x10')]({'field':_0x185df8,'operator':_0x569604,'value':_0x366834});});});}return _0x150454;};exports[_0x9851('0x11')]=function(_0x269a73,_0x35e67e,_0x499117){var _0x2f774f={};if(_0x35e67e===_0x9851('0x12')){if(_0x499117[_0x9851('0x13')]===_0x9851('0x14')){_0x499117[_0x9851('0x13')]='$between';_0x499117[_0x9851('0x15')]+=','+_0x499117[_0x9851('0x15')];}else if(_[_0x9851('0x16')](['$gt',_0x9851('0x17')],_0x499117[_0x9851('0x13')])){_0x499117[_0x9851('0x15')]=moment(_0x499117['value'])[_0x9851('0x18')](0x1,_0x9851('0x19'))[_0x9851('0x1a')](_0x9851('0x1b'));}}if(_0x499117['castTo']){_0x35e67e=_0x499117['castTo'];_0x2f774f[_0x9851('0x1c')]=_0x9851('0x1d')+_0x269a73+'.'+_0x499117[_0x9851('0x1e')]+'\x20AS\x20'+_0x499117[_0x9851('0x1f')]+')\x20'+parseOperator(_0x499117[_0x9851('0x13')]);}else{_0x2f774f[_0x9851('0x1c')]=_0x269a73+'.'+_0x499117[_0x9851('0x1e')]+'\x20'+parseOperator(_0x499117[_0x9851('0x13')]);}if(_[_0x9851('0x16')](['$ne','$notIn'],_0x499117[_0x9851('0x13')]))_0x2f774f['text']='('+_0x2f774f[_0x9851('0x1c')]+_0x9851('0x20')+_0x269a73+'.'+_0x499117['field']+'\x20IS\x20NULL)';_0x2f774f[_0x9851('0x15')]=parseValue(_0x35e67e,_0x499117[_0x9851('0x13')],_0x499117['value']);return _0x2f774f;};function parseOperator(_0x34065a){var _0x13e354;switch(_0x34065a){case _0x9851('0x21'):_0x13e354=_0x9851('0x22');break;case'$notIn':_0x13e354=_0x9851('0x23');break;case'$eq':_0x13e354=_0x9851('0x24');break;case'$ne':_0x13e354=_0x9851('0x25');break;case'$substring':case _0x9851('0x26'):case _0x9851('0x27'):_0x13e354=_0x9851('0x28');break;case'$lt':_0x13e354='<\x20?';break;case'$gt':_0x13e354=_0x9851('0x29');break;case'$lte':_0x13e354='<=\x20?';break;case _0x9851('0x2a'):_0x13e354='>=\x20?';break;case _0x9851('0x2b'):_0x13e354=_0x9851('0x2c');break;}return _0x13e354;}function parseValue(_0xd58a88,_0x573e9b,_0xb2232b){var _0x588949={'start':undefined,'end':undefined};switch(_0x573e9b){case _0x9851('0x21'):case _0x9851('0x2d'):_0x588949[_0x9851('0x2e')]=_0xb2232b[_0x9851('0x9')](',');break;case _0x9851('0x2f'):_0x588949[_0x9851('0x2e')]='%'+_0xb2232b+'%';break;case _0x9851('0x26'):_0x588949['start']=_0xb2232b+'%';break;case _0x9851('0x27'):_0x588949['start']='%'+_0xb2232b;break;case _0x9851('0x2b'):var _0x40a487=_0xb2232b[_0x9851('0x9')](',');var _0xb2232b=_0x40a487['shift']();var _0x26fe67=_0x40a487[_0x9851('0x30')]();if(_0xd58a88==='DATE'){_0xb2232b=moment(_0xb2232b)[_0x9851('0x31')](0x0,!![])[_0x9851('0x1a')]();_0x26fe67=moment(_0x26fe67)[_0x9851('0x31')](0x0,!![])[_0x9851('0x18')](0x17,_0x9851('0x32'))[_0x9851('0x18')](0x3b,'minutes')[_0x9851('0x18')](0x3b,'seconds')['format']();}_0x588949={'start':_0xb2232b,'end':_0x26fe67};break;default:_0x588949[_0x9851('0x2e')]=_0xb2232b;break;}return _0x588949;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index bcee62d..382c444 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 _0x853b=['getFullTextValue','forEach','replace','push','join','query','$id','model','attributes','intersection','nolimit','order','sort','where','filter','merge','VIRTUAL','lower','options','lodash','moment','keys','includes','parse','fields','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','isArray','split','limit','offset','map','priority','cast','col','unsigned','substr','omit','isObject','length','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match'];(function(_0x2b71da,_0x1a6441){var _0x314281=function(_0x492f51){while(--_0x492f51){_0x2b71da['push'](_0x2b71da['shift']());}};_0x314281(++_0x1a6441);}(_0x853b,0x169));var _0xb853=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x853b[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xb853('0x0'));var sequelize=require('sequelize');var moment=require(_0xb853('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x46b88e){var _0x2791e3=['ne'];try{var _0x2721ff=JSON['parse'](_0x46b88e);var _0x48caa5=Object[_0xb853('0x2')](_0x2721ff)[0x0];return _0x2791e3[_0xb853('0x3')](_0x48caa5);}catch(_0x395f8f){return![];}}function getOperatorValue(_0xfcb209){var _0xfb8f83=JSON[_0xb853('0x4')](_0xfcb209);var _0x41ffbe=Object['keys'](_0xfb8f83)[0x0];var _0x1b5f73=_0xfb8f83[_0x41ffbe];return{['$'+_0x41ffbe]:_0x1b5f73};}exports[_0xb853('0x5')]=function(_0x5147e5){var _0x126425=null;if(_0x5147e5){_0x126425=_0x5147e5['split'](',');}return _0x126425;};exports[_0xb853('0x6')]=function(_0x346e52,_0x1ee978){var _0x3afa3a={};if(!_[_0xb853('0x7')](_0x346e52)){_[_0xb853('0x8')](_0x346e52,function(_0x530349,_0x1e5d85){try{if(_0x1ee978){var _0x47e867=_[_0xb853('0x9')](_0x1ee978,{'name':_0x1e5d85})||{};if(hasSequelizeOperator(_0x530349)){_0x3afa3a[_0x1e5d85]=getOperatorValue(_0x530349);}else if(_0x47e867[_0xb853('0xa')]==='DATE'&&_[_0xb853('0xb')](_0x530349)){var _0x42fbc9=JSON[_0xb853('0x4')](_0x530349);var _0x37819d={'$gte':moment(moment(_0x42fbc9[_0xb853('0xc')])[_0xb853('0xd')](_0xb853('0xe')))[_0xb853('0xf')]()[_0xb853('0xd')](),'$lte':moment(moment(_0x42fbc9[_0xb853('0x10')])[_0xb853('0xd')](_0xb853('0xe')))[_0xb853('0xf')]()[_0xb853('0x11')](0x1,'s')[_0xb853('0xd')]()};_0x3afa3a[_0x1e5d85]=_0x37819d;}else if(_0x47e867[_0xb853('0x12')]===_0xb853('0x13')){_0x3afa3a[_0x1e5d85]=_0x530349;}else{_0x3afa3a[_0x1e5d85]=_[_0xb853('0x14')](_0x530349)?_0x530349:JSON['parse'](_0x530349);}}else{_0x3afa3a[_0x1e5d85]=_[_0xb853('0x14')](_0x530349)?_0x530349:JSON[_0xb853('0x4')](_0x530349);}}catch(_0x4af07b){_0x3afa3a[_0x1e5d85]=_0x530349[_0xb853('0x15')](',');}});}return _0x3afa3a;};exports[_0xb853('0x16')]=function(_0x4db97d){_0x4db97d=parseInt(_0x4db97d,0xa);if(!_0x4db97d||_0x4db97d<0x0){_0x4db97d=LIMIT_VALUE;}return _0x4db97d;};exports[_0xb853('0x17')]=function(_0x12ac76){_0x12ac76=parseInt(_0x12ac76,0xa);if(!_0x12ac76||_0x12ac76<0x0){_0x12ac76=0x0;}return _0x12ac76;};exports['sort']=function(_0x296a83){var _0x5a08b1,_0x48c342=null;if(_0x296a83){_0x5a08b1=_0x296a83[_0xb853('0x15')](',');_0x48c342=_[_0xb853('0x18')](_0x5a08b1,function(_0x3f16ea){if(_0x3f16ea['indexOf']('-')===0x0){return[_0x3f16ea===_0xb853('0x19')?sequelize[_0xb853('0x1a')](sequelize[_0xb853('0x1b')](_0xb853('0x19')),_0xb853('0x1c')):_0x3f16ea[_0xb853('0x1d')](0x1),'DESC'];}else{return[_0x3f16ea==='priority'?sequelize[_0xb853('0x1a')](sequelize['col'](_0xb853('0x19')),_0xb853('0x1c')):_0x3f16ea,'ASC'];}});}return _0x48c342;};exports[_0xb853('0x1e')]=function(_0x25a823,_0x1c6bc7){if(_['isEmpty'](_0x25a823)){return _0x25a823;}if(_[_0xb853('0x14')](_0x25a823)){for(var _0x9aee41=0x0;_0x9aee41<_0x25a823['length'];_0x9aee41+=0x1){_0x25a823[_0x9aee41]=this[_0xb853('0x1e')](_0x25a823[_0x9aee41],_0x1c6bc7);}return _0x25a823;}if(!_[_0xb853('0x1f')](_0x25a823)){return _0x25a823;}if(_['isString'](_0x1c6bc7)){_0x1c6bc7=[_0x1c6bc7];}if(!_[_0xb853('0x14')](_0x1c6bc7)){return _0x25a823;}for(var _0x356e8f=0x0;_0x356e8f<_0x1c6bc7[_0xb853('0x20')];_0x356e8f+=0x1){_['unset'](_0x25a823,_0x1c6bc7[_0x356e8f]);}for(var _0x5bb53b in _0x25a823){if(_0x25a823[_0xb853('0x21')](_0x5bb53b)){_0x25a823[_0x5bb53b]=this[_0xb853('0x1e')](_0x25a823[_0x5bb53b],_0x1c6bc7);}}return _0x25a823;};exports[_0xb853('0x22')]=function(_0x33d819){return _0x33d819['match'](RegExp(_0xb853('0x23')))?!![]:![];};exports[_0xb853('0x24')]=function(_0x47df20){return _0x47df20[_0xb853('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xb853('0x26')]=function(_0x3af12f){var _0x1c9b2b=[];_0x3af12f[_0xb853('0x15')](/[ ,]+/)[_0xb853('0x27')](function(_0x53bef7){_0x53bef7=_0x53bef7[_0xb853('0x28')](/([^:]")"+/g,'$1');_0x53bef7='+'+_0x53bef7+'*';if(_0x53bef7[_0xb853('0x3')]('@'))_0x53bef7='\x22'+_0x53bef7+'\x22';_0x1c9b2b[_0xb853('0x29')](_0x53bef7);});return _0x1c9b2b[_0xb853('0x2a')]('\x20');};exports['getOptions']=function(_0x13ed61,_0x2ae125,_0x5b9289){var _0x5d0e02={},_0x59842c={};if(_0x2ae125[_0xb853('0x2b')][_0xb853('0x2c')]){_0x2ae125[_0xb853('0x2b')]['id']=_0x2ae125['query'][_0xb853('0x2c')];delete _0x2ae125[_0xb853('0x2b')][_0xb853('0x2c')];}_0x5d0e02[_0xb853('0x2d')]=_[_0xb853('0x18')](_0x13ed61,_0xb853('0x12'));_0x5d0e02[_0xb853('0x2b')]=_['keys'](_0x2ae125[_0xb853('0x2b')]);_0x5d0e02[_0xb853('0x6')]=_['intersection'](_0x5d0e02[_0xb853('0x2d')],_0x5d0e02[_0xb853('0x2b')]);_0x59842c[_0xb853('0x2e')]=_[_0xb853('0x2f')](_0x5d0e02[_0xb853('0x2d')],this[_0xb853('0x5')](_0x2ae125[_0xb853('0x2b')][_0xb853('0x5')]));_0x59842c[_0xb853('0x2e')]=_0x59842c['attributes'][_0xb853('0x20')]?_0x59842c[_0xb853('0x2e')]:_0x5d0e02[_0xb853('0x2d')];if(!_0x2ae125['query'][_0xb853('0x21')](_0xb853('0x30'))){_0x59842c['limit']=this['limit'](_0x2ae125[_0xb853('0x2b')][_0xb853('0x16')]);_0x59842c[_0xb853('0x17')]=this['offset'](_0x2ae125['query'][_0xb853('0x17')]);}_0x59842c[_0xb853('0x31')]=this[_0xb853('0x32')](_0x2ae125[_0xb853('0x2b')]['sort']);_0x59842c[_0xb853('0x33')]=this[_0xb853('0x6')](_['pick'](_0x2ae125[_0xb853('0x2b')],_0x5d0e02[_0xb853('0x6')]),_0x13ed61);if(_0x2ae125['query'][_0xb853('0x34')]){_0x59842c[_0xb853('0x33')]=_[_0xb853('0x35')](_0x59842c[_0xb853('0x33')],{'$or':_['map'](_0x13ed61,function(_0xef3cac){if(_0xef3cac[_0xb853('0xa')]!==_0xb853('0x36')){if(_0x5b9289){return sequelize[_0xb853('0x33')](sequelize['fn']('lower',sequelize[_0xb853('0x1b')](_0xef3cac[_0xb853('0x12')])),{'$like':sequelize['fn'](_0xb853('0x37'),'%'+_0x2ae125[_0xb853('0x2b')]['filter']+'%')});}else{var _0x17651c={};_0x17651c[_0xef3cac['name']]={'$like':'%'+_0x2ae125['query'][_0xb853('0x34')]+'%'};return _0x17651c;}}})});}_0x59842c=_[_0xb853('0x35')]({},_0x59842c,_0x2ae125[_0xb853('0x38')]);return _0x59842c;}; \ No newline at end of file +var _0xf094=['$id','model','name','attributes','intersection','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','lower','options','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','DATE','$gte','YYYY-MM-DD','utc','$lte','format','subtract','uniqueid','isArray','offset','map','indexOf','priority','cast','col','unsigned','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','match','getFullTextValue','forEach','replace','push','join','getOptions','query'];(function(_0x5dad4b,_0x5be60a){var _0x5a682b=function(_0x3ea19c){while(--_0x3ea19c){_0x5dad4b['push'](_0x5dad4b['shift']());}};_0x5a682b(++_0x5be60a);}(_0xf094,0x1e1));var _0x4f09=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0xf094[_0x44268d];return _0x4be92d;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require(_0x4f09('0x0'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xe631b5){var _0x17bede=['ne'];try{var _0x5dc44a=JSON[_0x4f09('0x1')](_0xe631b5);var _0x186974=Object[_0x4f09('0x2')](_0x5dc44a)[0x0];return _0x17bede[_0x4f09('0x3')](_0x186974);}catch(_0x4712ae){return![];}}function getOperatorValue(_0x2b033c){var _0x3de3da=JSON[_0x4f09('0x1')](_0x2b033c);var _0x2b24f2=Object[_0x4f09('0x2')](_0x3de3da)[0x0];var _0xc80c3a=_0x3de3da[_0x2b24f2];return{['$'+_0x2b24f2]:_0xc80c3a};}exports[_0x4f09('0x4')]=function(_0x282219){var _0x36064c=null;if(_0x282219){_0x36064c=_0x282219[_0x4f09('0x5')](',');}return _0x36064c;};exports[_0x4f09('0x6')]=function(_0x8bd71a,_0x203681){var _0x4d0324={};if(!_[_0x4f09('0x7')](_0x8bd71a)){_[_0x4f09('0x8')](_0x8bd71a,function(_0xb00cb0,_0x961280){try{if(_0x203681){var _0x1a883b=_[_0x4f09('0x9')](_0x203681,{'name':_0x961280})||{};if(hasSequelizeOperator(_0xb00cb0)){_0x4d0324[_0x961280]=getOperatorValue(_0xb00cb0);}else if(_0x1a883b['type']===_0x4f09('0xa')&&_['isPlainObject'](_0xb00cb0)){var _0x3d8362=JSON[_0x4f09('0x1')](_0xb00cb0);var _0x17c5aa={'$gte':moment(moment(_0x3d8362[_0x4f09('0xb')])['format'](_0x4f09('0xc')))[_0x4f09('0xd')]()['format'](),'$lte':moment(moment(_0x3d8362[_0x4f09('0xe')])[_0x4f09('0xf')]('YYYY-MM-DD'))[_0x4f09('0xd')]()[_0x4f09('0x10')](0x1,'s')['format']()};_0x4d0324[_0x961280]=_0x17c5aa;}else if(_0x1a883b['name']===_0x4f09('0x11')){_0x4d0324[_0x961280]=_0xb00cb0;}else{_0x4d0324[_0x961280]=_[_0x4f09('0x12')](_0xb00cb0)?_0xb00cb0:JSON[_0x4f09('0x1')](_0xb00cb0);}}else{_0x4d0324[_0x961280]=_['isArray'](_0xb00cb0)?_0xb00cb0:JSON['parse'](_0xb00cb0);}}catch(_0x3925bd){_0x4d0324[_0x961280]=_0xb00cb0[_0x4f09('0x5')](',');}});}return _0x4d0324;};exports['limit']=function(_0x48a11f){_0x48a11f=parseInt(_0x48a11f,0xa);if(!_0x48a11f||_0x48a11f<0x0){_0x48a11f=LIMIT_VALUE;}return _0x48a11f;};exports[_0x4f09('0x13')]=function(_0x23525e){_0x23525e=parseInt(_0x23525e,0xa);if(!_0x23525e||_0x23525e<0x0){_0x23525e=0x0;}return _0x23525e;};exports['sort']=function(_0x351b84){var _0x534fea,_0x579611=null;if(_0x351b84){_0x534fea=_0x351b84[_0x4f09('0x5')](',');_0x579611=_[_0x4f09('0x14')](_0x534fea,function(_0x599fed){if(_0x599fed[_0x4f09('0x15')]('-')===0x0){return[_0x599fed===_0x4f09('0x16')?sequelize[_0x4f09('0x17')](sequelize[_0x4f09('0x18')]('priority'),'unsigned'):_0x599fed['substr'](0x1),'DESC'];}else{return[_0x599fed==='priority'?sequelize[_0x4f09('0x17')](sequelize[_0x4f09('0x18')](_0x4f09('0x16')),_0x4f09('0x19')):_0x599fed,'ASC'];}});}return _0x579611;};exports[_0x4f09('0x1a')]=function(_0x305b13,_0x13a8e5){if(_[_0x4f09('0x7')](_0x305b13)){return _0x305b13;}if(_['isArray'](_0x305b13)){for(var _0x182df3=0x0;_0x182df3<_0x305b13['length'];_0x182df3+=0x1){_0x305b13[_0x182df3]=this[_0x4f09('0x1a')](_0x305b13[_0x182df3],_0x13a8e5);}return _0x305b13;}if(!_[_0x4f09('0x1b')](_0x305b13)){return _0x305b13;}if(_[_0x4f09('0x1c')](_0x13a8e5)){_0x13a8e5=[_0x13a8e5];}if(!_[_0x4f09('0x12')](_0x13a8e5)){return _0x305b13;}for(var _0x4295fb=0x0;_0x4295fb<_0x13a8e5[_0x4f09('0x1d')];_0x4295fb+=0x1){_[_0x4f09('0x1e')](_0x305b13,_0x13a8e5[_0x4295fb]);}for(var _0xf33e08 in _0x305b13){if(_0x305b13[_0x4f09('0x1f')](_0xf33e08)){_0x305b13[_0xf33e08]=this[_0x4f09('0x1a')](_0x305b13[_0xf33e08],_0x13a8e5);}}return _0x305b13;};exports[_0x4f09('0x20')]=function(_0x2b74e7){return _0x2b74e7[_0x4f09('0x21')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0x511548){return _0x511548['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x4f09('0x22')]=function(_0x492026){var _0x524fa7=[];_0x492026['split'](/[ ,]+/)[_0x4f09('0x23')](function(_0x239e90){_0x239e90=_0x239e90[_0x4f09('0x24')](/([^:]")"+/g,'$1');_0x239e90='+'+_0x239e90+'*';if(_0x239e90[_0x4f09('0x3')]('@'))_0x239e90='\x22'+_0x239e90+'\x22';_0x524fa7[_0x4f09('0x25')](_0x239e90);});return _0x524fa7[_0x4f09('0x26')]('\x20');};exports[_0x4f09('0x27')]=function(_0x5abae1,_0x5dca34,_0x4313cc){var _0x3d74a4={},_0x73bbe={};if(_0x5dca34[_0x4f09('0x28')][_0x4f09('0x29')]){_0x5dca34[_0x4f09('0x28')]['id']=_0x5dca34[_0x4f09('0x28')][_0x4f09('0x29')];delete _0x5dca34['query'][_0x4f09('0x29')];}_0x3d74a4[_0x4f09('0x2a')]=_[_0x4f09('0x14')](_0x5abae1,_0x4f09('0x2b'));_0x3d74a4[_0x4f09('0x28')]=_[_0x4f09('0x2')](_0x5dca34[_0x4f09('0x28')]);_0x3d74a4['filters']=_['intersection'](_0x3d74a4[_0x4f09('0x2a')],_0x3d74a4[_0x4f09('0x28')]);_0x73bbe[_0x4f09('0x2c')]=_[_0x4f09('0x2d')](_0x3d74a4['model'],this['fields'](_0x5dca34['query'][_0x4f09('0x4')]));_0x73bbe[_0x4f09('0x2c')]=_0x73bbe[_0x4f09('0x2c')]['length']?_0x73bbe[_0x4f09('0x2c')]:_0x3d74a4[_0x4f09('0x2a')];if(!_0x5dca34[_0x4f09('0x28')][_0x4f09('0x1f')](_0x4f09('0x2e'))){_0x73bbe[_0x4f09('0x2f')]=this[_0x4f09('0x2f')](_0x5dca34[_0x4f09('0x28')]['limit']);_0x73bbe[_0x4f09('0x13')]=this['offset'](_0x5dca34[_0x4f09('0x28')][_0x4f09('0x13')]);}_0x73bbe[_0x4f09('0x30')]=this[_0x4f09('0x31')](_0x5dca34[_0x4f09('0x28')][_0x4f09('0x31')]);_0x73bbe[_0x4f09('0x32')]=this[_0x4f09('0x6')](_[_0x4f09('0x33')](_0x5dca34['query'],_0x3d74a4['filters']),_0x5abae1);if(_0x5dca34[_0x4f09('0x28')][_0x4f09('0x34')]){_0x73bbe[_0x4f09('0x32')]=_[_0x4f09('0x35')](_0x73bbe['where'],{'$or':_['map'](_0x5abae1,function(_0x375e2c){if(_0x375e2c[_0x4f09('0x36')]!==_0x4f09('0x37')){if(_0x4313cc){return sequelize['where'](sequelize['fn'](_0x4f09('0x38'),sequelize['col'](_0x375e2c['name'])),{'$like':sequelize['fn'](_0x4f09('0x38'),'%'+_0x5dca34['query'][_0x4f09('0x34')]+'%')});}else{var _0x444ec0={};_0x444ec0[_0x375e2c[_0x4f09('0x2b')]]={'$like':'%'+_0x5dca34[_0x4f09('0x28')][_0x4f09('0x34')]+'%'};return _0x444ec0;}}})});}_0x73bbe=_[_0x4f09('0x35')]({},_0x73bbe,_0x5dca34[_0x4f09('0x39')]);return _0x73bbe;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 6eb552d..6ff2dd9 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9be7=['test','client','use','json\x20replacer','toISOString','split','static','get','html','ejs','renderFile','50mb','initialize','express','serve-favicon','body-parser','errorhandler','path','../mysqldb','default','env','production','set','appPath','join','root','public'];(function(_0x54c5cf,_0x5b7f00){var _0x1f3b1a=function(_0x201628){while(--_0x201628){_0x54c5cf['push'](_0x54c5cf['shift']());}};_0x1f3b1a(++_0x5b7f00);}(_0x9be7,0xca));var _0x79be=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0x9be7[_0x31bab3];return _0x4fd382;};'use strict';var express=require(_0x79be('0x0'));var favicon=require(_0x79be('0x1'));var bodyParser=require(_0x79be('0x2'));var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0x79be('0x3'));var path=require(_0x79be('0x4'));var passport=require('passport');var cors=require('cors');var moment=require('moment');var config=require('./environment');var db=require(_0x79be('0x5'))['db'];exports[_0x79be('0x6')]=function(_0x3889f6){var _0x4408e9=_0x3889f6['get'](_0x79be('0x7'));if(_0x4408e9===_0x79be('0x8')){_0x3889f6[_0x79be('0x9')](_0x79be('0xa'),path[_0x79be('0xb')](config[_0x79be('0xc')],_0x79be('0xd')));}if(_0x4408e9==='development'||_0x4408e9===_0x79be('0xe')){_0x3889f6[_0x79be('0x9')](_0x79be('0xa'),path['join'](config[_0x79be('0xc')],_0x79be('0xf')));_0x3889f6[_0x79be('0x10')](errorHandler());}_0x3889f6[_0x79be('0x9')](_0x79be('0x11'),function(_0x4a684e,_0x2259f5){if(this[_0x4a684e]instanceof Date){_0x2259f5=this[_0x4a684e][_0x79be('0x12')]()[_0x79be('0x13')]('.')[0x0]+'Z';}return _0x2259f5;});_0x3889f6[_0x79be('0x10')](express[_0x79be('0x14')](_0x3889f6[_0x79be('0x15')](_0x79be('0xa'))));_0x3889f6[_0x79be('0x9')]('views',config[_0x79be('0xc')]+'/server/views');_0x3889f6['engine'](_0x79be('0x16'),require(_0x79be('0x17'))[_0x79be('0x18')]);_0x3889f6[_0x79be('0x9')]('view\x20engine',_0x79be('0x16'));_0x3889f6[_0x79be('0x10')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x3889f6['use'](bodyParser['json']({'limit':_0x79be('0x19')}));_0x3889f6['use'](cors());_0x3889f6[_0x79be('0x10')](methodOverride());_0x3889f6[_0x79be('0x10')](cookieParser());_0x3889f6['use'](passport[_0x79be('0x1a')]());}; \ No newline at end of file +var _0xc778=['use','urlencoded','50mb','json','express','serve-favicon','body-parser','method-override','errorhandler','path','passport','cors','moment','./environment','../mysqldb','default','get','env','production','set','join','root','public','development','test','appPath','toISOString','split','static','views','/server/views','html','view\x20engine'];(function(_0x88ae93,_0x317aa0){var _0x3ae96f=function(_0x35a2c3){while(--_0x35a2c3){_0x88ae93['push'](_0x88ae93['shift']());}};_0x3ae96f(++_0x317aa0);}(_0xc778,0xca));var _0x8c77=function(_0x39e94f,_0xa66d12){_0x39e94f=_0x39e94f-0x0;var _0x59591c=_0xc778[_0x39e94f];return _0x59591c;};'use strict';var express=require(_0x8c77('0x0'));var favicon=require(_0x8c77('0x1'));var bodyParser=require(_0x8c77('0x2'));var methodOverride=require(_0x8c77('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0x8c77('0x4'));var path=require(_0x8c77('0x5'));var passport=require(_0x8c77('0x6'));var cors=require(_0x8c77('0x7'));var moment=require(_0x8c77('0x8'));var config=require(_0x8c77('0x9'));var db=require(_0x8c77('0xa'))['db'];exports[_0x8c77('0xb')]=function(_0x216eea){var _0x418396=_0x216eea[_0x8c77('0xc')](_0x8c77('0xd'));if(_0x418396===_0x8c77('0xe')){_0x216eea[_0x8c77('0xf')]('appPath',path[_0x8c77('0x10')](config[_0x8c77('0x11')],_0x8c77('0x12')));}if(_0x418396===_0x8c77('0x13')||_0x418396===_0x8c77('0x14')){_0x216eea[_0x8c77('0xf')](_0x8c77('0x15'),path[_0x8c77('0x10')](config[_0x8c77('0x11')],'client'));_0x216eea['use'](errorHandler());}_0x216eea[_0x8c77('0xf')]('json\x20replacer',function(_0x46bfe4,_0x501910){if(this[_0x46bfe4]instanceof Date){_0x501910=this[_0x46bfe4][_0x8c77('0x16')]()[_0x8c77('0x17')]('.')[0x0]+'Z';}return _0x501910;});_0x216eea['use'](express[_0x8c77('0x18')](_0x216eea[_0x8c77('0xc')](_0x8c77('0x15'))));_0x216eea[_0x8c77('0xf')](_0x8c77('0x19'),config[_0x8c77('0x11')]+_0x8c77('0x1a'));_0x216eea['engine'](_0x8c77('0x1b'),require('ejs')['renderFile']);_0x216eea['set'](_0x8c77('0x1c'),_0x8c77('0x1b'));_0x216eea[_0x8c77('0x1d')](bodyParser[_0x8c77('0x1e')]({'limit':_0x8c77('0x1f'),'extended':!![]}));_0x216eea['use'](bodyParser[_0x8c77('0x20')]({'limit':'50mb'}));_0x216eea[_0x8c77('0x1d')](cors());_0x216eea['use'](methodOverride());_0x216eea[_0x8c77('0x1d')](cookieParser());_0x216eea['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index d52f03c..96d20d7 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 _0xc9fb=['concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','orderBy','cpus','join','createHash','update','digest','hex','getUuid','platform','licenseToken','test','win32','utf8','replace','hostname','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','length','filter','family','IPv4','internal'];(function(_0x3207aa,_0xe86a72){var _0x51758f=function(_0x9ff790){while(--_0x9ff790){_0x3207aa['push'](_0x3207aa['shift']());}};_0x51758f(++_0xe86a72);}(_0xc9fb,0x1df));var _0xbc9f=function(_0x2e4969,_0x61e98){_0x2e4969=_0x2e4969-0x0;var _0x3fb0fd=_0xc9fb[_0x2e4969];return _0x3fb0fd;};'use strict';var _=require(_0xbc9f('0x0'));var os=require('os');var crypto=require(_0xbc9f('0x1'));var machine=require(_0xbc9f('0x2'));var exec=require(_0xbc9f('0x3'))['execSync'];var config=require(_0xbc9f('0x4'));function getInterfaces(){var _0x1507bc=[];var _0x6a7a7f=os[_0xbc9f('0x5')]();var _0x494b46=_['orderBy'](_['keys'](_0x6a7a7f));for(var _0x322459=0x0;_0x322459<_0x494b46[_0xbc9f('0x6')];_0x322459++){var _0x3e4990=_0x6a7a7f[_0x494b46[_0x322459]][_0xbc9f('0x7')](function(_0x5a78b2){return _0x5a78b2[_0xbc9f('0x8')]===_0xbc9f('0x9')&&_0x5a78b2[_0xbc9f('0xa')]===![];});_0x1507bc=_0x1507bc[_0xbc9f('0xb')](_0x3e4990);}return _0x1507bc;}function getFirstInterface(){var _0x55a2bf=_[_0xbc9f('0xc')](getInterfaces());return{'macAddress':_0x55a2bf&&_0x55a2bf[_0xbc9f('0xd')]?_0x55a2bf[_0xbc9f('0xd')]:_0xbc9f('0xe'),'ipAddress':_0x55a2bf&&_0x55a2bf['address']?_0x55a2bf[_0xbc9f('0xf')]:'127.0.0.1'};}exports[_0xbc9f('0x10')]=getFirstInterface;function getCPUhash(){var _0x1020d8=_[_0xbc9f('0x11')](os[_0xbc9f('0x12')]()['map'](function(_0x1729ea){return _0x1729ea['model'];}))[_0xbc9f('0x13')](':');return crypto[_0xbc9f('0x14')]('md5')[_0xbc9f('0x15')](_0x1020d8)[_0xbc9f('0x16')](_0xbc9f('0x17'));}exports[_0xbc9f('0x18')]=function(){var _0x3026cd=os[_0xbc9f('0x19')]();var _0x4aa8bf=/[0-9a-f-]{36}/;if(config[_0xbc9f('0x1a')]&&_0x4aa8bf[_0xbc9f('0x1b')](config[_0xbc9f('0x1a')])){return config[_0xbc9f('0x1a')];}else if(_0x3026cd===_0xbc9f('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0xbc9f('0x1d')})[_0xbc9f('0x1e')]('\x0d\x0a','');}else{var _0x1d0dda=getFirstInterface();var _0x189901=getCPUhash();var _0x375b06=_0x189901+'|'+os[_0xbc9f('0x1f')]()+'|'+_0x1d0dda['macAddress']+'|'+_0x1d0dda[_0xbc9f('0x20')];var _0x1ca344=crypto[_0xbc9f('0x14')](_0xbc9f('0x21'))[_0xbc9f('0x15')](_0x375b06)[_0xbc9f('0x16')](_0xbc9f('0x17'));return _0x1ca344[_0xbc9f('0x22')](0x0,0x8)+'-'+_0x1ca344['substring'](0x8,0xc)+'-'+_0x1ca344[_0xbc9f('0x22')](0xc,0x10)+'-'+_0x1ca344[_0xbc9f('0x22')](0x10,0x14)+'-'+_0x1ca344[_0xbc9f('0x22')](0x14);}}; \ No newline at end of file +var _0xfbb4=['replace','ipAddress','substring','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','family','IPv4','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0x54fdd8,_0x2e81ae){var _0x4f6f8a=function(_0x2a970c){while(--_0x2a970c){_0x54fdd8['push'](_0x54fdd8['shift']());}};_0x4f6f8a(++_0x2e81ae);}(_0xfbb4,0x177));var _0x4fbb=function(_0x246f03,_0x4da389){_0x246f03=_0x246f03-0x0;var _0x2e49eb=_0xfbb4[_0x246f03];return _0x2e49eb;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x4fbb('0x0'));var exec=require('child_process')[_0x4fbb('0x1')];var config=require(_0x4fbb('0x2'));function getInterfaces(){var _0x1fb987=[];var _0xe160b8=os[_0x4fbb('0x3')]();var _0x412669=_[_0x4fbb('0x4')](_[_0x4fbb('0x5')](_0xe160b8));for(var _0xdde726=0x0;_0xdde726<_0x412669['length'];_0xdde726++){var _0x33a946=_0xe160b8[_0x412669[_0xdde726]]['filter'](function(_0x595203){return _0x595203[_0x4fbb('0x6')]===_0x4fbb('0x7')&&_0x595203['internal']===![];});_0x1fb987=_0x1fb987[_0x4fbb('0x8')](_0x33a946);}return _0x1fb987;}function getFirstInterface(){var _0x2269de=_['head'](getInterfaces());return{'macAddress':_0x2269de&&_0x2269de[_0x4fbb('0x9')]?_0x2269de['mac']:_0x4fbb('0xa'),'ipAddress':_0x2269de&&_0x2269de[_0x4fbb('0xb')]?_0x2269de[_0x4fbb('0xb')]:_0x4fbb('0xc')};}exports[_0x4fbb('0xd')]=getFirstInterface;function getCPUhash(){var _0x5a59d1=_[_0x4fbb('0x4')](os[_0x4fbb('0xe')]()[_0x4fbb('0xf')](function(_0x4b8a79){return _0x4b8a79[_0x4fbb('0x10')];}))['join'](':');return crypto[_0x4fbb('0x11')](_0x4fbb('0x12'))['update'](_0x5a59d1)[_0x4fbb('0x13')](_0x4fbb('0x14'));}exports[_0x4fbb('0x15')]=function(){var _0x1496fd=os[_0x4fbb('0x16')]();var _0x57414a=/[0-9a-f-]{36}/;if(config[_0x4fbb('0x17')]&&_0x57414a[_0x4fbb('0x18')](config[_0x4fbb('0x17')])){return config[_0x4fbb('0x17')];}else if(_0x1496fd===_0x4fbb('0x19')){return exec(_0x4fbb('0x1a'),{'encoding':_0x4fbb('0x1b')})[_0x4fbb('0x1c')]('\x0d\x0a','');}else{var _0x27dc9c=getFirstInterface();var _0xd6748=getCPUhash();var _0x1af3a9=_0xd6748+'|'+os['hostname']()+'|'+_0x27dc9c['macAddress']+'|'+_0x27dc9c[_0x4fbb('0x1d')];var _0x27f708=crypto['createHash'](_0x4fbb('0x12'))['update'](_0x1af3a9)[_0x4fbb('0x13')](_0x4fbb('0x14'));return _0x27f708['substring'](0x0,0x8)+'-'+_0x27f708[_0x4fbb('0x1e')](0x8,0xc)+'-'+_0x27f708[_0x4fbb('0x1e')](0xc,0x10)+'-'+_0x27f708[_0x4fbb('0x1e')](0x10,0x14)+'-'+_0x27f708['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 08b8d06..0689d2f 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 _0xfbf0=['../../components/encryptor','./hardware','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data2','data1','active','license','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','info','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','error','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','bluebird','pkginfo','version','../../mysqldb'];(function(_0x54719e,_0x4cde8b){var _0x5e65fa=function(_0x5056c8){while(--_0x5056c8){_0x54719e['push'](_0x54719e['shift']());}};_0x5e65fa(++_0x4cde8b);}(_0xfbf0,0x72));var _0x0fbf=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xfbf0[_0x256b72];return _0x2183e3;};'use strict';var util=require(_0x0fbf('0x0'));var moment=require(_0x0fbf('0x1'));var rp=require('request-promise');var BPromise=require(_0x0fbf('0x2'));var pkginfo=require(_0x0fbf('0x3'))(module,_0x0fbf('0x4'));var db=require(_0x0fbf('0x5'))['db'];var encryptor=require(_0x0fbf('0x6'));var hardware=require(_0x0fbf('0x7'));var logger=require('../logger')('license');var HOST=_0x0fbf('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x466bda){return new BPromise(function(_0xbab549,_0x457a00){var _0x29e44b=util[_0x0fbf('0x9')](_0x0fbf('0xa'),HOST,_0x466bda,module[_0x0fbf('0xb')][_0x0fbf('0x4')]);if(oldToken){_0x29e44b=util[_0x0fbf('0x9')](_0x0fbf('0xc'),HOST,_0x466bda,module[_0x0fbf('0xb')][_0x0fbf('0x4')],oldToken);}var _0x4a7d12={'uri':_0x29e44b,'method':_0x0fbf('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x4a7d12)[_0x0fbf('0xe')](function(_0x362a17){_0xbab549(_0x362a17);})[_0x0fbf('0xf')](function(_0x30a1a5){_0x457a00(_0x30a1a5);});});}function manageLicense(_0x20a5aa,_0x5eb35e){var _0x181701=_0x5eb35e[_0x0fbf('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x181701['data1']!==_0x20a5aa&&!_0x181701[_0x0fbf('0x11')]){oldToken=_0x181701[_0x0fbf('0x12')];}httpRequest(_0x20a5aa)[_0x0fbf('0xe')](function(_0x2d2535){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2d2535[_0x0fbf('0x13')]){isOldTokenSent=![];if(!_0x181701[_0x0fbf('0x14')]&&_0x181701[_0x0fbf('0x14')]!=_0x2d2535['license']||_0x181701['license']&&_0x181701[_0x0fbf('0x11')]){logger['info'](_0x0fbf('0x15'));}if(_0x181701[_0x0fbf('0x14')]&&!_0x181701[_0x0fbf('0x11')]&&_0x181701['license']!=_0x2d2535[_0x0fbf('0x14')]){logger['info'](_0x0fbf('0x16'));}if(_0x181701[_0x0fbf('0x14')]&&!_0x181701[_0x0fbf('0x11')]&&_0x181701[_0x0fbf('0x14')]==_0x2d2535[_0x0fbf('0x14')]){return _0x5eb35e;}return _0x5eb35e[_0x0fbf('0x17')]({'data1':_0x20a5aa,'data2':null,'license':_0x2d2535[_0x0fbf('0x14')]});}else{if(_0x2d2535[_0x0fbf('0x14')]||_0x181701[_0x0fbf('0x14')]){if(!_0x181701[_0x0fbf('0x11')]){if(_0x181701[_0x0fbf('0x12')]==_0x20a5aa){GRAY_PERIOD_REASON=_0x0fbf('0x18');logger[_0x0fbf('0x19')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x0fbf('0x19')](_0x0fbf('0x1a'),_0x181701[_0x0fbf('0x12')],_0x20a5aa);}logger[_0x0fbf('0x19')](_0x0fbf('0x1b'),GRAY_PERIOD_REASON[_0x0fbf('0x1c')](),moment()[_0x0fbf('0x9')](_0x0fbf('0x1d')));return _0x5eb35e[_0x0fbf('0x17')]({'data2':encryptor[_0x0fbf('0x1e')](moment()[_0x0fbf('0x9')](_0x0fbf('0x1d')))});}else{if(moment()[_0x0fbf('0x1f')](encryptor[_0x0fbf('0x20')](_0x181701[_0x0fbf('0x11')]),_0x0fbf('0x21'))>DAYS){logger[_0x0fbf('0x19')]('DEMO\x20START\x20AT\x20%s',moment()[_0x0fbf('0x9')](_0x0fbf('0x1d')));isOldTokenSent=![];return _0x5eb35e[_0x0fbf('0x17')]({'data1':_0x20a5aa,'data2':null,'license':null});}}}else{if(_0x181701[_0x0fbf('0x12')]!=_0x20a5aa){logger['info'](_0x0fbf('0x1a'),_0x181701[_0x0fbf('0x12')],_0x20a5aa);return _0x5eb35e[_0x0fbf('0x17')]({'data1':_0x20a5aa,'data2':null,'license':null});}}}return _0x5eb35e;})[_0x0fbf('0xe')](function(_0x153fd4){_0x5eb35e=_0x153fd4;})[_0x0fbf('0xf')](function(_0x104394){logger[_0x0fbf('0x22')](_0x104394['message']);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x0fbf('0x23')](),_0x5eb35e);},TIME);});}function defaultLicense(){var _0x2e850c=hardware[_0x0fbf('0x23')]();if(_0x2e850c){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x2e850c}})[_0x0fbf('0x24')](function(_0x4d15e2,_0x505614){logger['info'](_0x0fbf('0x25'),_0x2e850c);manageLicense(_0x2e850c,_0x4d15e2);})[_0x0fbf('0xf')](function(_0x25848d){logger[_0x0fbf('0x22')](_0x25848d[_0x0fbf('0x26')]);});}}exports[_0x0fbf('0x27')]=defaultLicense; \ No newline at end of file +var _0x29fd=['catch','get','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data2','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','then'];(function(_0x50fef5,_0x19f643){var _0x579925=function(_0x3684fb){while(--_0x3684fb){_0x50fef5['push'](_0x50fef5['shift']());}};_0x579925(++_0x19f643);}(_0x29fd,0x9e));var _0xd29f=function(_0x512fdb,_0x3151d8){_0x512fdb=_0x512fdb-0x0;var _0x326b5f=_0x29fd[_0x512fdb];return _0x326b5f;};'use strict';var util=require(_0xd29f('0x0'));var moment=require(_0xd29f('0x1'));var rp=require(_0xd29f('0x2'));var BPromise=require(_0xd29f('0x3'));var pkginfo=require(_0xd29f('0x4'))(module,_0xd29f('0x5'));var db=require(_0xd29f('0x6'))['db'];var encryptor=require(_0xd29f('0x7'));var hardware=require('./hardware');var logger=require(_0xd29f('0x8'))(_0xd29f('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x22e0ae){return new BPromise(function(_0x167233,_0x488f94){var _0x5edbdd=util[_0xd29f('0xa')](_0xd29f('0xb'),HOST,_0x22e0ae,module['exports'][_0xd29f('0x5')]);if(oldToken){_0x5edbdd=util[_0xd29f('0xa')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x22e0ae,module[_0xd29f('0xc')][_0xd29f('0x5')],oldToken);}var _0x369df1={'uri':_0x5edbdd,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x369df1)[_0xd29f('0xd')](function(_0x181afd){_0x167233(_0x181afd);})[_0xd29f('0xe')](function(_0x59d674){_0x488f94(_0x59d674);});});}function manageLicense(_0xc6c6dc,_0x1eebe8){var _0xd85c92=_0x1eebe8[_0xd29f('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0xd85c92[_0xd29f('0x10')]!==_0xc6c6dc&&!_0xd85c92['data2']){oldToken=_0xd85c92[_0xd29f('0x10')];}httpRequest(_0xc6c6dc)[_0xd29f('0xd')](function(_0x1cf2b4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1cf2b4[_0xd29f('0x11')]){isOldTokenSent=![];if(!_0xd85c92[_0xd29f('0x9')]&&_0xd85c92[_0xd29f('0x9')]!=_0x1cf2b4[_0xd29f('0x9')]||_0xd85c92[_0xd29f('0x9')]&&_0xd85c92['data2']){logger[_0xd29f('0x12')](_0xd29f('0x13'));}if(_0xd85c92[_0xd29f('0x9')]&&!_0xd85c92['data2']&&_0xd85c92[_0xd29f('0x9')]!=_0x1cf2b4['license']){logger[_0xd29f('0x12')](_0xd29f('0x14'));}if(_0xd85c92[_0xd29f('0x9')]&&!_0xd85c92[_0xd29f('0x15')]&&_0xd85c92[_0xd29f('0x9')]==_0x1cf2b4[_0xd29f('0x9')]){return _0x1eebe8;}return _0x1eebe8[_0xd29f('0x16')]({'data1':_0xc6c6dc,'data2':null,'license':_0x1cf2b4[_0xd29f('0x9')]});}else{if(_0x1cf2b4[_0xd29f('0x9')]||_0xd85c92[_0xd29f('0x9')]){if(!_0xd85c92['data2']){if(_0xd85c92[_0xd29f('0x10')]==_0xc6c6dc){GRAY_PERIOD_REASON=_0xd29f('0x17');logger[_0xd29f('0x12')](_0xd29f('0x18'));}else{GRAY_PERIOD_REASON=_0xd29f('0x19');logger['info'](_0xd29f('0x1a'),_0xd85c92[_0xd29f('0x10')],_0xc6c6dc);}logger['info'](_0xd29f('0x1b'),GRAY_PERIOD_REASON[_0xd29f('0x1c')](),moment()[_0xd29f('0xa')](_0xd29f('0x1d')));return _0x1eebe8[_0xd29f('0x16')]({'data2':encryptor[_0xd29f('0x1e')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xd29f('0x1f')](encryptor[_0xd29f('0x20')](_0xd85c92['data2']),'days')>DAYS){logger['info'](_0xd29f('0x21'),moment()[_0xd29f('0xa')](_0xd29f('0x1d')));isOldTokenSent=![];return _0x1eebe8[_0xd29f('0x16')]({'data1':_0xc6c6dc,'data2':null,'license':null});}}}else{if(_0xd85c92[_0xd29f('0x10')]!=_0xc6c6dc){logger[_0xd29f('0x12')](_0xd29f('0x1a'),_0xd85c92[_0xd29f('0x10')],_0xc6c6dc);return _0x1eebe8['update']({'data1':_0xc6c6dc,'data2':null,'license':null});}}}return _0x1eebe8;})['then'](function(_0x24ce40){_0x1eebe8=_0x24ce40;})['catch'](function(_0x451ae7){logger[_0xd29f('0x22')](_0x451ae7[_0xd29f('0x23')]);})[_0xd29f('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xd29f('0x25')](),_0x1eebe8);},TIME);});}function defaultLicense(){var _0x2a00de=hardware[_0xd29f('0x25')]();if(_0x2a00de){return db[_0xd29f('0x26')][_0xd29f('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x2a00de}})[_0xd29f('0x28')](function(_0x46fc44,_0x511d07){logger[_0xd29f('0x12')](_0xd29f('0x29'),_0x2a00de);manageLicense(_0x2a00de,_0x46fc44);})[_0xd29f('0xe')](function(_0x5e8e71){logger['error'](_0x5e8e71[_0xd29f('0x23')]);});}}exports[_0xd29f('0x2a')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 88660a0..38fcbc3 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 _0xb69b=['deadline','add','days','grayReason','changed','disabled','message','User','findAll','sequelize','COUNT','col','role','count','admin','user','telephone','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse'];(function(_0x173d7e,_0x3242fd){var _0x2220d6=function(_0x462828){while(--_0x462828){_0x173d7e['push'](_0x173d7e['shift']());}};_0x2220d6(++_0x3242fd);}(_0xb69b,0x9e));var _0xbb69=function(_0x5b097c,_0x4fe69c){_0x5b097c=_0x5b097c-0x0;var _0x593d9b=_0xb69b[_0x5b097c];return _0x593d9b;};'use strict';var util=require(_0xbb69('0x0'));var _=require(_0xbb69('0x1'));var moment=require(_0xbb69('0x2'));var BPromise=require('bluebird');var hardware=require(_0xbb69('0x3'));var encryptor=require(_0xbb69('0x4'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbb69('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xbb69('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xbb69('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xbb69('0x7'),'machineUuid':hardware[_0xbb69('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x200086){return new BPromise(function(_0x2a0d8d,_0x3700ff){return db[_0xbb69('0x9')][_0xbb69('0xa')](_[_0xbb69('0xb')](_0x200086,{'raw':!![],'where':{'id':0x1}}))[_0xbb69('0xc')](function(_0x583d9c){return checkLicense(_0x583d9c,null);})[_0xbb69('0xc')](function(_0xa83202){_0x2a0d8d(_0xa83202);return;})[_0xbb69('0xd')](function(_0x5182ef){_0x3700ff(_0x5182ef);});});}function checkLicense(_0x4c9a01,_0x106057){if(!_0x4c9a01){demoLicense[_0xbb69('0xe')]=_0x4c9a01[_0xbb69('0xf')];return demoLicense;}try{var _0x34a93f=_0x106057||_0x4c9a01['license'];if(_['isEmpty'](_0x34a93f)){throw new Error(_0xbb69('0x10'));}var _0x3dc4c7=_0x4c9a01[_0xbb69('0xf')];var _0x21af26=_0x4c9a01[_0xbb69('0x11')];var _0x1dad32=_0x3dc4c7[_0xbb69('0x12')]('-')[0x4];var _0x25e38e=_0x3dc4c7[_0xbb69('0x12')]('-')[0x0];var _0x2eac82=encryptor[_0xbb69('0x13')](_0x34a93f,util[_0xbb69('0x14')]('%s:%s:%s',_0x1dad32,_0x3dc4c7,_0x25e38e));var _0x4aa95f=JSON[_0xbb69('0x15')](_0x2eac82);_0x4aa95f['demo']=![];_0x4aa95f['uuid']=_0x3dc4c7;_0x4aa95f['machineUuid']=hardware[_0xbb69('0x8')]();if(_0x21af26){var _0x192607=encryptor['decryptString'](_0x21af26);_0x4aa95f['gray']=_0x192607;_0x4aa95f[_0xbb69('0x16')]=moment(_0x192607)[_0xbb69('0x17')](0x7,_0xbb69('0x18'))[_0xbb69('0x14')]();_0x4aa95f[_0xbb69('0x19')]=_0x4aa95f['uuid']!=_0x4aa95f['machineUuid']?_0xbb69('0x1a'):_0xbb69('0x1b');}return _0x4aa95f;}catch(_0x205b1b){breakingLicense[_0xbb69('0xe')]=_0x4c9a01[_0xbb69('0xf')];breakingLicense[_0xbb69('0x1c')]=_0x205b1b[_0xbb69('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x10d9f0,_0x10849f){getLicense()[_0xbb69('0xc')](function(_0xf37f70){return db[_0xbb69('0x1d')][_0xbb69('0x1e')]({'attributes':['role',[db[_0xbb69('0x1f')]['fn'](_0xbb69('0x20'),db[_0xbb69('0x1f')][_0xbb69('0x21')](_0xbb69('0x22'))),_0xbb69('0x23')]],'group':_0xbb69('0x22'),'where':{'role':{'$or':[_0xbb69('0x24'),_0xbb69('0x25'),_0xbb69('0x26')]}},'raw':!![]})[_0xbb69('0xc')](function(_0x4dabce){var _0x440da7={'user':_0xf37f70['users']||0x0,'telephone':_0xf37f70['telephones']||0x0};_0x4dabce[_0xbb69('0x27')](function(_0x166510){var _0x1a863b=_0x166510[_0xbb69('0x22')]===_0xbb69('0x24')?'user':_0x166510[_0xbb69('0x22')];_0x440da7[_0x1a863b]-=_0x166510[_0xbb69('0x23')];if(_0x440da7[_0x1a863b]<0x0)_0x440da7[_0x1a863b]=0x0;});_0x10d9f0(_0x440da7);return;});})['catch'](function(_0xf91bfb){_0x10849f(_0xf91bfb);});});}function checkUserLimits(_0x58bcfa){return new BPromise(function(_0x4bc4bc,_0x6f9db6){getLimits()['then'](function(_0x5974ab){var _0x441f0a=_[_0xbb69('0x28')](_[_0xbb69('0x29')](_0x58bcfa,'role'),[_0xbb69('0x24'),_0xbb69('0x25'),_0xbb69('0x26')]);var _0x8a661e=(_0x441f0a[_0xbb69('0x24')]||0x0)+(_0x441f0a[_0xbb69('0x25')]||0x0);var _0x348e69=_0x441f0a[_0xbb69('0x26')]||0x0;if(_0x8a661e>_0x5974ab[_0xbb69('0x25')])return _0x6f9db6(_0xbb69('0x2a'));if(_0x348e69>_0x5974ab[_0xbb69('0x26')])return _0x6f9db6(_0xbb69('0x2b'));return _0x4bc4bc();})['catch'](function(_0x5cc8ad){_0x6f9db6(_0x5cc8ad);});});}module[_0xbb69('0x2c')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x0ae9=['getUuid','defaults','then','catch','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','uuid','gray','add','days','grayReason','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','admin','user','telephone','users','forEach','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license'];(function(_0x58c662,_0x213a8a){var _0x261a7f=function(_0x57feb5){while(--_0x57feb5){_0x58c662['push'](_0x58c662['shift']());}};_0x261a7f(++_0x213a8a);}(_0x0ae9,0x82));var _0x90ae=function(_0x399245,_0x469f74){_0x399245=_0x399245-0x0;var _0xdbff2c=_0x0ae9[_0x399245];return _0xdbff2c;};'use strict';var util=require(_0x90ae('0x0'));var _=require(_0x90ae('0x1'));var moment=require(_0x90ae('0x2'));var BPromise=require(_0x90ae('0x3'));var hardware=require('./hardware');var encryptor=require('../../components/encryptor');var db=require(_0x90ae('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x90ae('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x90ae('0x6'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x90ae('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x90ae('0x7'),'machineUuid':hardware[_0x90ae('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3ad40b){return new BPromise(function(_0x3cec0e,_0x123f0f){return db['License']['find'](_[_0x90ae('0x9')](_0x3ad40b,{'raw':!![],'where':{'id':0x1}}))[_0x90ae('0xa')](function(_0x414676){return checkLicense(_0x414676,null);})['then'](function(_0x1da052){_0x3cec0e(_0x1da052);return;})[_0x90ae('0xb')](function(_0x347bf9){_0x123f0f(_0x347bf9);});});}function checkLicense(_0x3c488f,_0x151529){if(!_0x3c488f){demoLicense['uuid']=_0x3c488f[_0x90ae('0xc')];return demoLicense;}try{var _0x11a57b=_0x151529||_0x3c488f['license'];if(_[_0x90ae('0xd')](_0x11a57b)){throw new Error(_0x90ae('0xe'));}var _0x38e921=_0x3c488f['data1'];var _0x4c5c2c=_0x3c488f[_0x90ae('0xf')];var _0x220bc3=_0x38e921[_0x90ae('0x10')]('-')[0x4];var _0x56ef06=_0x38e921[_0x90ae('0x10')]('-')[0x0];var _0xfafd=encryptor[_0x90ae('0x11')](_0x11a57b,util[_0x90ae('0x12')](_0x90ae('0x13'),_0x220bc3,_0x38e921,_0x56ef06));var _0x3458a3=JSON[_0x90ae('0x14')](_0xfafd);_0x3458a3[_0x90ae('0x15')]=![];_0x3458a3[_0x90ae('0x16')]=_0x38e921;_0x3458a3['machineUuid']=hardware['getUuid']();if(_0x4c5c2c){var _0x415988=encryptor[_0x90ae('0x11')](_0x4c5c2c);_0x3458a3[_0x90ae('0x17')]=_0x415988;_0x3458a3['deadline']=moment(_0x415988)[_0x90ae('0x18')](0x7,_0x90ae('0x19'))[_0x90ae('0x12')]();_0x3458a3[_0x90ae('0x1a')]=_0x3458a3['uuid']!=_0x3458a3['machineUuid']?_0x90ae('0x1b'):_0x90ae('0x1c');}return _0x3458a3;}catch(_0x4c691a){breakingLicense['uuid']=_0x3c488f[_0x90ae('0xc')];breakingLicense[_0x90ae('0x1d')]=_0x4c691a[_0x90ae('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x22e517,_0x25f190){getLicense()[_0x90ae('0xa')](function(_0x56de9a){return db[_0x90ae('0x1e')][_0x90ae('0x1f')]({'attributes':[_0x90ae('0x20'),[db[_0x90ae('0x21')]['fn'](_0x90ae('0x22'),db[_0x90ae('0x21')][_0x90ae('0x23')]('role')),'count']],'group':_0x90ae('0x20'),'where':{'role':{'$or':[_0x90ae('0x24'),_0x90ae('0x25'),_0x90ae('0x26')]}},'raw':!![]})[_0x90ae('0xa')](function(_0x1a7676){var _0x29a34a={'user':_0x56de9a[_0x90ae('0x27')]||0x0,'telephone':_0x56de9a['telephones']||0x0};_0x1a7676[_0x90ae('0x28')](function(_0x5ae73c){var _0x5409b2=_0x5ae73c[_0x90ae('0x20')]===_0x90ae('0x24')?_0x90ae('0x25'):_0x5ae73c['role'];_0x29a34a[_0x5409b2]-=_0x5ae73c[_0x90ae('0x29')];if(_0x29a34a[_0x5409b2]<0x0)_0x29a34a[_0x5409b2]=0x0;});_0x22e517(_0x29a34a);return;});})[_0x90ae('0xb')](function(_0x19c3b0){_0x25f190(_0x19c3b0);});});}function checkUserLimits(_0x21032a){return new BPromise(function(_0x5b2224,_0x36c84c){getLimits()['then'](function(_0x316932){var _0xfedadd=_[_0x90ae('0x2a')](_[_0x90ae('0x2b')](_0x21032a,_0x90ae('0x20')),[_0x90ae('0x24'),_0x90ae('0x25'),'telephone']);var _0x239ee7=(_0xfedadd[_0x90ae('0x24')]||0x0)+(_0xfedadd[_0x90ae('0x25')]||0x0);var _0x508bc5=_0xfedadd[_0x90ae('0x26')]||0x0;if(_0x239ee7>_0x316932['user'])return _0x36c84c(_0x90ae('0x2c'));if(_0x508bc5>_0x316932[_0x90ae('0x26')])return _0x36c84c('License\x20limit\x20reached\x20for\x20telephones');return _0x5b2224();})[_0x90ae('0xb')](function(_0xab08d0){_0x36c84c(_0xab08d0);});});}module[_0x90ae('0x2d')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index f122555..47f6a1c 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 _0x28f2=['myappanuglar-secret','app-id','secret','exports','http://localhost:9000'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x28f2,0x193));var _0x228f=function(_0x1f5162,_0x139fb2){_0x1f5162=_0x1f5162-0x0;var _0x45e6ad=_0x28f2[_0x1f5162];return _0x45e6ad;};'use strict';module[_0x228f('0x0')]={'DOMAIN':_0x228f('0x1'),'SESSION_SECRET':_0x228f('0x2'),'GOOGLE_ID':_0x228f('0x3'),'GOOGLE_SECRET':_0x228f('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x3266=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x5d2a6b,_0x1ecd68){var _0x5ceb12=function(_0x4ebdcd){while(--_0x4ebdcd){_0x5d2a6b['push'](_0x5d2a6b['shift']());}};_0x5ceb12(++_0x1ecd68);}(_0x3266,0x6a));var _0x6326=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x3266[_0xef8146];return _0x5a6cb0;};'use strict';module[_0x6326('0x0')]={'DOMAIN':_0x6326('0x1'),'SESSION_SECRET':_0x6326('0x2'),'GOOGLE_ID':_0x6326('0x3'),'GOOGLE_SECRET':_0x6326('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3995b8b..b4995ca 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae46=['xcally','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','transports','File','%s-%s','error','info','Console','env','debugLevel','util','path','join','log'];(function(_0xe25921,_0x25cfad){var _0x40802e=function(_0x1bef97){while(--_0x1bef97){_0xe25921['push'](_0xe25921['shift']());}};_0x40802e(++_0x25cfad);}(_0xae46,0x172));var _0x6ae4=function(_0x2d7868,_0x516d8a){_0x2d7868=_0x2d7868-0x0;var _0x140fde=_0xae46[_0x2d7868];return _0x140fde;};'use strict';var moment=require('moment');var winston=require('winston');var util=require(_0x6ae4('0x0'));var path=require(_0x6ae4('0x1'));var debugLevel='INFO';function filename(_0x5af4ff,_0x36c3cb){return path[_0x6ae4('0x2')]('/var',_0x6ae4('0x3'),_0x6ae4('0x4'),util[_0x6ae4('0x5')]('%s-%s.log',_0x5af4ff,_0x36c3cb));}function formatter(_0x212249,_0x4255ab){_0x4255ab[_0x6ae4('0x6')]=_0x4255ab['message'][_0x6ae4('0x7')](/@@{/g,_0x6ae4('0x8'))['replace'](/}@@/g,_0x6ae4('0x9'))['replace'](/@{/g,'{{')[_0x6ae4('0x7')](/}@/g,'}}');return util[_0x6ae4('0x5')](_0x6ae4('0xa'),moment()[_0x6ae4('0x5')](_0x6ae4('0xb')),_0x4255ab['level'][_0x6ae4('0xc')](),_0x212249,_0x4255ab[_0x6ae4('0x6')]);}module[_0x6ae4('0xd')]=function(_0x517f60){return new winston['Logger']({'transports':[new winston[(_0x6ae4('0xe'))][(_0x6ae4('0xf'))]({'name':util[_0x6ae4('0x5')](_0x6ae4('0x10'),_0x517f60,'error'),'filename':filename(_0x517f60,_0x6ae4('0x11')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x137985){return formatter(_0x517f60,_0x137985);}}),new winston['transports']['File']({'name':util[_0x6ae4('0x5')](_0x6ae4('0x10'),_0x517f60,'info'),'filename':filename(_0x517f60,'info'),'level':_0x6ae4('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x571922){return formatter(_0x517f60,_0x571922);}}),new winston['transports'][(_0x6ae4('0x13'))]({'level':process[_0x6ae4('0x14')][_0x6ae4('0x15')]||debugLevel,'json':![],'formatter':function(_0x24b05b){return formatter(_0x517f60,_0x24b05b);}})]});}; \ No newline at end of file +var _0x5884=['message','{{{','replace','}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','INFO','join','log'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5884,0x9c));var _0x4588=function(_0x2a6896,_0x3283f8){_0x2a6896=_0x2a6896-0x0;var _0x594415=_0x5884[_0x2a6896];return _0x594415;};'use strict';var moment=require(_0x4588('0x0'));var winston=require(_0x4588('0x1'));var util=require('util');var path=require('path');var debugLevel=_0x4588('0x2');function filename(_0x4d2f4e,_0x4d4e67){return path[_0x4588('0x3')]('/var',_0x4588('0x4'),'xcally',util['format']('%s-%s.log',_0x4d2f4e,_0x4d4e67));}function formatter(_0x59f1e6,_0x4229c6){_0x4229c6[_0x4588('0x5')]=_0x4229c6[_0x4588('0x5')]['replace'](/@@{/g,_0x4588('0x6'))[_0x4588('0x7')](/}@@/g,_0x4588('0x8'))['replace'](/@{/g,'{{')[_0x4588('0x7')](/}@/g,'}}');return util[_0x4588('0x9')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x4588('0x9')](_0x4588('0xa')),_0x4229c6[_0x4588('0xb')][_0x4588('0xc')](),_0x59f1e6,_0x4229c6['message']);}module[_0x4588('0xd')]=function(_0x1cc6f9){return new winston[(_0x4588('0xe'))]({'transports':[new winston[(_0x4588('0xf'))][(_0x4588('0x10'))]({'name':util['format'](_0x4588('0x11'),_0x1cc6f9,_0x4588('0x12')),'filename':filename(_0x1cc6f9,_0x4588('0x12')),'level':_0x4588('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3970a9){return formatter(_0x1cc6f9,_0x3970a9);}}),new winston[(_0x4588('0xf'))][(_0x4588('0x10'))]({'name':util[_0x4588('0x9')](_0x4588('0x11'),_0x1cc6f9,'info'),'filename':filename(_0x1cc6f9,_0x4588('0x13')),'level':'info','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3f9bb0){return formatter(_0x1cc6f9,_0x3f9bb0);}}),new winston[(_0x4588('0xf'))][(_0x4588('0x14'))]({'level':process[_0x4588('0x15')][_0x4588('0x16')]||debugLevel,'json':![],'formatter':function(_0x18cde5){return formatter(_0x1cc6f9,_0x18cde5);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2c9c684..d270ac2 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 _0xe6e1=['../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','exports','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi'];(function(_0x4f6907,_0x420f6b){var _0x9f1569=function(_0x598e89){while(--_0x598e89){_0x4f6907['push'](_0x4f6907['shift']());}};_0x9f1569(++_0x420f6b);}(_0xe6e1,0x1ce));var _0x1e6e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xe6e1[_0x31e29a];return _0x32d892;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x1e6e('0x0'),'script':path[_0x1e6e('0x1')](__dirname,_0x1e6e('0x2'))},{'name':_0x1e6e('0x3'),'script':path[_0x1e6e('0x1')](__dirname,_0x1e6e('0x4'))},{'name':_0x1e6e('0x5'),'script':path['join'](__dirname,_0x1e6e('0x6'))},{'name':_0x1e6e('0x7'),'script':path[_0x1e6e('0x1')](__dirname,_0x1e6e('0x8'))},{'name':_0x1e6e('0x9'),'script':path['join'](__dirname,_0x1e6e('0xa'))},{'name':_0x1e6e('0xb'),'script':path[_0x1e6e('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0x1e6e('0xc')]=config; \ No newline at end of file +var _0x1c1d=['path','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','join','../../services/email/index.js','routing','xdr','../../services/xdr/index.js'];(function(_0x5f3b27,_0x19c552){var _0x1e0bf0=function(_0x2bc5bc){while(--_0x2bc5bc){_0x5f3b27['push'](_0x5f3b27['shift']());}};_0x1e0bf0(++_0x19c552);}(_0x1c1d,0x129));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var path=require(_0xd1c1('0x0'));var os=require('os');var config={'apps':[{'name':_0xd1c1('0x1'),'script':path['join'](__dirname,_0xd1c1('0x2'))},{'name':_0xd1c1('0x3'),'script':path['join'](__dirname,_0xd1c1('0x4'))},{'name':_0xd1c1('0x5'),'script':path[_0xd1c1('0x6')](__dirname,'../../services/agi/index.js')},{'name':'email','script':path['join'](__dirname,_0xd1c1('0x7'))},{'name':_0xd1c1('0x8'),'script':path[_0xd1c1('0x6')](__dirname,'../../services/routing/index.js')},{'name':_0xd1c1('0x9'),'script':path[_0xd1c1('0x6')](__dirname,_0xd1c1('0xa'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ed21d88..2762885 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 _0xfb0a=['connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect'];(function(_0xb9d2b9,_0x3af253){var _0x4de59b=function(_0x38891c){while(--_0x38891c){_0xb9d2b9['push'](_0xb9d2b9['shift']());}};_0x4de59b(++_0x3af253);}(_0xfb0a,0x173));var _0xafb0=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xfb0a[_0x43d16c];return _0x208cce;};'use strict';var pm2=require(_0xafb0('0x0'));var BPromise=require(_0xafb0('0x1'));var config=require(_0xafb0('0x2'));function connect(){return new BPromise(function(_0x54f0f5,_0x427b62){return pm2[_0xafb0('0x3')](function(_0x5e7554){if(_0x5e7554){return _0x427b62(_0x5e7554);}return _0x54f0f5(_0xafb0('0x4'));});});};exports[_0xafb0('0x5')]=function(_0x2c5c32){return connect()[_0xafb0('0x6')](function(){return new BPromise(function(_0x38c341,_0x3f21da){return pm2['start'](_0x2c5c32,function(_0xa41876,_0x4c620f){if(_0xa41876){return _0x3f21da(_0xa41876);}pm2[_0xafb0('0x7')]();return _0x38c341(_0x4c620f);});});});};exports[_0xafb0('0x8')]=function(_0x2f4d05){return connect()[_0xafb0('0x6')](function(){return new BPromise(function(_0x1b4b02,_0x2cb84f){return pm2[_0xafb0('0x8')](_0x2f4d05,function(_0x30f04b,_0x54e273){if(_0x30f04b){return _0x2cb84f(_0x30f04b);}pm2['disconnect']();return _0x1b4b02(_0x54e273);});});});};exports[_0xafb0('0x9')]=function(_0x52275a){return connect()[_0xafb0('0x6')](function(){return new BPromise(function(_0x367c5a,_0x4968ab){return pm2['restart'](_0x52275a,function(_0x21bd27,_0x219b83){if(_0x21bd27){return _0x4968ab(_0x21bd27);}pm2[_0xafb0('0x7')]();return _0x367c5a(_0x219b83);});});});};exports[_0xafb0('0xa')]=function(){return connect()[_0xafb0('0x6')](function(){return new BPromise(function(_0x3c5d5f,_0x3aecbd){return pm2['list'](function(_0x4df373,_0x4547f4){if(_0x4df373){return _0x3aecbd(_0x4df373);}pm2['disconnect']();return _0x3c5d5f(_0x4547f4);});});});};exports[_0xafb0('0xb')]=function(_0x5df224){return connect()[_0xafb0('0x6')](function(){return new BPromise(function(_0x1fa21c,_0x24b531){return pm2['describe'](_0x5df224,function(_0x118ecc,_0xdf6c23){if(_0x118ecc){return _0x24b531(_0x118ecc);}pm2[_0xafb0('0x7')]();return _0x1fa21c(_0xdf6c23);});});});};exports[_0xafb0('0xc')]=function(_0xc7629e){return connect()[_0xafb0('0x6')](function(){return new BPromise(function(_0x4cf748,_0x1cbed2){return pm2[_0xafb0('0xc')](_0xc7629e,function(_0x544d4a,_0x4646e8){if(_0x544d4a){return _0x1cbed2(_0x544d4a);}pm2[_0xafb0('0x7')]();return _0x4cf748(_0x4646e8);});});});};exports[_0xafb0('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x5e03ac,_0x1e28f1){return pm2[_0xafb0('0xd')](function(_0x2ebae7){if(_0x2ebae7){return _0x1e28f1(_0x2ebae7);}return _0x5e03ac(_0xafb0('0xe'));});});});}; \ No newline at end of file +var _0xbf7e=['connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','./config'];(function(_0x44268d,_0xad8443){var _0x4be92d=function(_0x8a57ff){while(--_0x8a57ff){_0x44268d['push'](_0x44268d['shift']());}};_0x4be92d(++_0xad8443);}(_0xbf7e,0x194));var _0xebf7=function(_0x2dfa1b,_0x4a9bdf){_0x2dfa1b=_0x2dfa1b-0x0;var _0x462ab9=_0xbf7e[_0x2dfa1b];return _0x462ab9;};'use strict';var pm2=require(_0xebf7('0x0'));var BPromise=require('bluebird');var config=require(_0xebf7('0x1'));function connect(){return new BPromise(function(_0x1633fa,_0x24dded){return pm2[_0xebf7('0x2')](function(_0x17696a){if(_0x17696a){return _0x24dded(_0x17696a);}return _0x1633fa(_0xebf7('0x3'));});});};exports[_0xebf7('0x4')]=function(_0x326bca){return connect()[_0xebf7('0x5')](function(){return new BPromise(function(_0x445bd9,_0x148729){return pm2[_0xebf7('0x4')](_0x326bca,function(_0x20c3af,_0x363da2){if(_0x20c3af){return _0x148729(_0x20c3af);}pm2[_0xebf7('0x6')]();return _0x445bd9(_0x363da2);});});});};exports[_0xebf7('0x7')]=function(_0x56c149){return connect()['then'](function(){return new BPromise(function(_0x1d1ebb,_0x13fc54){return pm2['stop'](_0x56c149,function(_0x266722,_0x40c516){if(_0x266722){return _0x13fc54(_0x266722);}pm2[_0xebf7('0x6')]();return _0x1d1ebb(_0x40c516);});});});};exports[_0xebf7('0x8')]=function(_0x5cb17b){return connect()[_0xebf7('0x5')](function(){return new BPromise(function(_0x4b4ba5,_0x6ad6fa){return pm2[_0xebf7('0x8')](_0x5cb17b,function(_0x16029e,_0x219216){if(_0x16029e){return _0x6ad6fa(_0x16029e);}pm2[_0xebf7('0x6')]();return _0x4b4ba5(_0x219216);});});});};exports[_0xebf7('0x9')]=function(){return connect()[_0xebf7('0x5')](function(){return new BPromise(function(_0x92e653,_0x2f464f){return pm2['list'](function(_0x476dbe,_0x3a96bf){if(_0x476dbe){return _0x2f464f(_0x476dbe);}pm2[_0xebf7('0x6')]();return _0x92e653(_0x3a96bf);});});});};exports[_0xebf7('0xa')]=function(_0x5510d2){return connect()[_0xebf7('0x5')](function(){return new BPromise(function(_0x176fae,_0x4164dd){return pm2[_0xebf7('0xa')](_0x5510d2,function(_0x419633,_0x1b4404){if(_0x419633){return _0x4164dd(_0x419633);}pm2[_0xebf7('0x6')]();return _0x176fae(_0x1b4404);});});});};exports[_0xebf7('0xb')]=function(_0xc96bc6){return connect()['then'](function(){return new BPromise(function(_0x39d2a6,_0x1c0095){return pm2['delete'](_0xc96bc6,function(_0x211d55,_0x3134d5){if(_0x211d55){return _0x1c0095(_0x211d55);}pm2[_0xebf7('0x6')]();return _0x39d2a6(_0x3134d5);});});});};exports[_0xebf7('0xc')]=function(){return connect()[_0xebf7('0x5')](function(){return new BPromise(function(_0x450568,_0x2e5034){return pm2[_0xebf7('0xc')](function(_0x3c691c){if(_0x3c691c){return _0x2e5034(_0x3c691c);}return _0x450568(_0xebf7('0xd'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 255d55c..58935d8 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 _0x3f62=['find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','map','info','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','defaults','socket.io-emitter','Setting'];(function(_0x35009a,_0x4c647b){var _0x41ae8a=function(_0x594c04){while(--_0x594c04){_0x35009a['push'](_0x35009a['shift']());}};_0x41ae8a(++_0x4c647b);}(_0x3f62,0x7d));var _0x23f6=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3f62[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x23f6('0x0'));var moment=require(_0x23f6('0x1'));var Redis=require(_0x23f6('0x2'));var util=require(_0x23f6('0x3'));var config=require(_0x23f6('0x4'));var db=require(_0x23f6('0x5'))['db'];var logger=require(_0x23f6('0x6'))('schedule');config[_0x23f6('0x7')]=_[_0x23f6('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x23f6('0x9'))(new Redis(config[_0x23f6('0x7')]));function closeInteractions(){var _0x12241d=0x0;var _0x2565d4=[];return db[_0x23f6('0xa')][_0x23f6('0xb')]({'raw':!![],'attributes':['id',_0x23f6('0xc')],'where':{'id':0x1}})[_0x23f6('0xd')](function(_0x32decf){_0x12241d=_0x32decf[_0x23f6('0xc')];if(_0x12241d){return db[_0x23f6('0xe')][_0x23f6('0xf')]({'raw':!![],'attributes':['id',_0x23f6('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x23f6('0x11')](_0x32decf[_0x23f6('0xc')],'minutes')}}});}else{return[];}})[_0x23f6('0xd')](function(_0x3b274a){if(_0x3b274a&&_0x3b274a['length']){_0x2565d4=_[_0x23f6('0x12')](_0x3b274a||[],'id');logger[_0x23f6('0x13')]('[CHAT]\x20Interactions\x20to\x20close:',_0x2565d4[_0x23f6('0x14')]());return db[_0x23f6('0xe')][_0x23f6('0x15')]({'closeReason':_0x23f6('0x16'),'disposition':_0x23f6('0x17'),'closed':!![],'closedAt':moment()[_0x23f6('0x18')](_0x23f6('0x19'))},{'where':{'id':_0x2565d4}});}})[_0x23f6('0xd')](function(){if(_0x2565d4&&_0x2565d4['length']){logger[_0x23f6('0x13')](_0x23f6('0x1a'),_0x2565d4[_0x23f6('0x14')]());for(var _0x4934a9=0x0;_0x4934a9<_0x2565d4[_0x23f6('0x1b')];_0x4934a9++){io['emit'](_0x23f6('0x1c'),{'id':_0x2565d4[_0x4934a9],'closed':!![]});}}})[_0x23f6('0x1d')](function(_0x5d3605){logger[_0x23f6('0x1e')](_0x23f6('0x1f'),_0x5d3605?util[_0x23f6('0x20')](_0x5d3605,{'showHidden':![],'depth':null}):'');});}exports[_0x23f6('0x21')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe705=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','length','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','lodash','moment','ioredis','util','../../config/environment','../logger','redis','defaults','localhost','Setting','find','then','chatTimeout','ChatInteraction','lastMsgAt','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join'];(function(_0xc2c148,_0x14ded){var _0x5849ff=function(_0x1504b3){while(--_0x1504b3){_0xc2c148['push'](_0xc2c148['shift']());}};_0x5849ff(++_0x14ded);}(_0xe705,0xcc));var _0x5e70=function(_0x3e91a9,_0x53c466){_0x3e91a9=_0x3e91a9-0x0;var _0x25c9ad=_0xe705[_0x3e91a9];return _0x25c9ad;};'use strict';var _=require(_0x5e70('0x0'));var moment=require(_0x5e70('0x1'));var Redis=require(_0x5e70('0x2'));var util=require(_0x5e70('0x3'));var config=require(_0x5e70('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x5e70('0x5'))('schedule');config[_0x5e70('0x6')]=_[_0x5e70('0x7')](config['redis'],{'host':_0x5e70('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5e70('0x6')]));function closeInteractions(){var _0x665fa6=0x0;var _0x33e126=[];return db[_0x5e70('0x9')][_0x5e70('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x5e70('0xb')](function(_0x13d7e7){_0x665fa6=_0x13d7e7[_0x5e70('0xc')];if(_0x665fa6){return db[_0x5e70('0xd')]['findAll']({'raw':!![],'attributes':['id',_0x5e70('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x13d7e7[_0x5e70('0xc')],_0x5e70('0xf'))}}});}else{return[];}})[_0x5e70('0xb')](function(_0x25c8f7){if(_0x25c8f7&&_0x25c8f7['length']){_0x33e126=_[_0x5e70('0x10')](_0x25c8f7||[],'id');logger[_0x5e70('0x11')](_0x5e70('0x12'),_0x33e126[_0x5e70('0x13')]());return db[_0x5e70('0xd')]['update']({'closeReason':'system','disposition':_0x5e70('0x14'),'closed':!![],'closedAt':moment()[_0x5e70('0x15')](_0x5e70('0x16'))},{'where':{'id':_0x33e126}});}})[_0x5e70('0xb')](function(){if(_0x33e126&&_0x33e126['length']){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x33e126[_0x5e70('0x13')]());for(var _0x38b4e5=0x0;_0x38b4e5<_0x33e126[_0x5e70('0x17')];_0x38b4e5++){io[_0x5e70('0x18')](_0x5e70('0x19'),{'id':_0x33e126[_0x38b4e5],'closed':!![]});}}})[_0x5e70('0x1a')](function(_0x519076){logger['error'](_0x5e70('0x1b'),_0x519076?util['inspect'](_0x519076,{'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 58b5c02..597090c 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 _0x4bee=['%s.%s','basename','extname','zip','existsSync','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','stringify','email\x20sent','catch','error\x20mail','data','subtractNumber\x20null\x20or\x20undefined','isNil','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','keys','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','update\x20cron','util','path','lodash','moment','cron-job-manager','jayson/promise','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','email','bcc','subtractNumber','join','../../files/reports','savename'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x4bee,0x146));var _0xe4be=function(_0x9c8b4a,_0x2387ff){_0x9c8b4a=_0x9c8b4a-0x0;var _0x198bef=_0x4bee[_0x9c8b4a];return _0x198bef;};'use strict';var fs=require('fs');var util=require(_0xe4be('0x0'));var path=require(_0xe4be('0x1'));var _=require(_0xe4be('0x2'));var moment=require(_0xe4be('0x3'));var CronJobManager=require(_0xe4be('0x4'));var jayson=require(_0xe4be('0x5'));var BPromise=require('bluebird');var logger=require('../logger')(_0xe4be('0x6'));var db=require(_0xe4be('0x7'))['db'];var analyticCustomReportController=require(_0xe4be('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xe4be('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x28da7f,_0x246a79){return function(){logger[_0xe4be('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x28da7f['email']);var _0xc1d24c=!![];var _0x2ef024={'tls':{'rejectUnauthorized':![]}};if(_0x28da7f[_0xe4be('0xb')][_0xe4be('0xc')][_0xe4be('0xd')]){_0x2ef024['service']=_0x28da7f[_0xe4be('0xb')][_0xe4be('0xc')][_0xe4be('0xd')];}else{_0x2ef024[_0xe4be('0xe')]=_0x28da7f[_0xe4be('0xb')][_0xe4be('0xc')][_0xe4be('0xe')];_0x2ef024[_0xe4be('0xf')]=_0x28da7f[_0xe4be('0xb')][_0xe4be('0xc')][_0xe4be('0xf')];_0x2ef024['secure']=_0x28da7f[_0xe4be('0xb')][_0xe4be('0xc')][_0xe4be('0x10')];}if(_0x28da7f[_0xe4be('0xb')]['Smtp'][_0xe4be('0x11')]){_0x2ef024[_0xe4be('0x12')]={'user':_0x28da7f[_0xe4be('0xb')][_0xe4be('0xc')][_0xe4be('0x13')],'pass':_0x28da7f[_0xe4be('0xb')][_0xe4be('0xc')][_0xe4be('0x14')]};}var _0x230948={'account':_0x2ef024,'message':{'from':util[_0xe4be('0x15')](_0xe4be('0x16'),_0x28da7f[_0xe4be('0xb')][_0xe4be('0x17')],_0x28da7f[_0xe4be('0xb')]['email']||_0x28da7f[_0xe4be('0xb')]['Smtp'][_0xe4be('0x13')]),'to':_0x28da7f[_0xe4be('0x18')],'cc':_0x28da7f['cc'],'bcc':_0x28da7f[_0xe4be('0x19')],'subject':util[_0xe4be('0x15')]('Report\x20%s\x20last\x20%s\x20%s',_0x246a79['name'],_0x28da7f[_0xe4be('0x1a')],_0x28da7f['subtractUnit'])}};var _0x336f98=path[_0xe4be('0x1b')](__dirname,_0xe4be('0x1c'));var _0x5f0617=_0x246a79[_0xe4be('0x1d')];var _0x1ee551=util[_0xe4be('0x15')](_0xe4be('0x1e'),path[_0xe4be('0x1f')](_0x246a79['savename'],path[_0xe4be('0x20')](_0x246a79['savename'])),_0xe4be('0x21'));var _0x449f3d=path[_0xe4be('0x1b')](_0x336f98,_0x5f0617);var _0x133d43=path[_0xe4be('0x1b')](_0x336f98,_0x1ee551);if(fs[_0xe4be('0x22')](_0x449f3d)){_0x246a79['status']=_0xe4be('0x23');_0x230948[_0xe4be('0x24')][_0xe4be('0x25')]=[{'filename':_0x5f0617,'path':_0x449f3d}];_0x230948[_0xe4be('0x24')][_0xe4be('0x26')]=util[_0xe4be('0x15')](_0xe4be('0x27'),JSON['stringify'](_0x246a79,null,0x2));}else if(fs[_0xe4be('0x22')](_0x133d43)){_0x246a79['status']='Sent';_0x230948[_0xe4be('0x24')]['attachments']=[{'filename':_0x1ee551,'path':_0x133d43}];}else{_0x230948['message']['text']='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x28da7f['sendIfEmpty']){_0xc1d24c=![];logger[_0xe4be('0xa')](_0xe4be('0x28'));}}if(_0xc1d24c){return client[_0xe4be('0x29')](_0xe4be('0x2a'),_0x230948)[_0xe4be('0x2b')](function(_0x336053){if(_0x336053[_0xe4be('0x2c')]){return logger[_0xe4be('0x2c')]('error\x20mail',JSON[_0xe4be('0x2d')](_0x336053));}return logger[_0xe4be('0xa')](_0xe4be('0x2e'));})[_0xe4be('0x2f')](function(_0xaa40e1){return logger[_0xe4be('0x2c')](_0xe4be('0x30'),JSON[_0xe4be('0x2d')](_0xaa40e1));});}};}function handleError(){return function(_0x22355){return logger[_0xe4be('0x2c')](JSON['stringify'](_0x22355));};}function handleResult(_0x2b69c3){return function(_0x260144){logger[_0xe4be('0xa')](_0xe4be('0x31'),JSON[_0xe4be('0x2d')](_0x260144));if(_0x2b69c3[_0xe4be('0xb')]&&_0x2b69c3['MailAccount']['Smtp']&&!_['isNil'](_0x2b69c3[_0xe4be('0x18')])){setTimeout(handleSendEmail(_0x2b69c3,_0x260144),0x3c*0x3e8);}};}function handleJob(_0x121e61){return function(){try{if(_['isNil'](_0x121e61[_0xe4be('0x1a')])){return logger[_0xe4be('0xa')](_0xe4be('0x32'));}if(_[_0xe4be('0x33')](_0x121e61[_0xe4be('0x34')])){return logger[_0xe4be('0xa')](_0xe4be('0x35'));}var _0x3b30e6={'startDate':moment()[_0xe4be('0x36')](_0x121e61[_0xe4be('0x1a')],_0x121e61[_0xe4be('0x34')])[_0xe4be('0x15')](_0xe4be('0x37')),'endDate':moment()[_0xe4be('0x15')](_0xe4be('0x37')),'type':_0xe4be('0x38'),'output':_0x121e61[_0xe4be('0x39')],'name':_0x121e61[_0xe4be('0x17')]};if(!_[_0xe4be('0x33')](_0x121e61[_0xe4be('0x3a')])){logger[_0xe4be('0xa')](_0xe4be('0x3b'),_0x121e61[_0xe4be('0x3a')]);return analyticDefaultReportController[_0xe4be('0x3c')]({'id':_0x121e61[_0xe4be('0x3a')]},_0x3b30e6)[_0xe4be('0x2b')](handleResult(_0x121e61))['catch'](handleError());}if(!_['isNil'](_0x121e61['CustomReportId'])){logger['info'](_0xe4be('0x3d'),_0x121e61['CustomReportId']);return analyticCustomReportController[_0xe4be('0x3c')]({'id':_0x121e61['CustomReportId']},_0x3b30e6)[_0xe4be('0x2b')](handleResult(_0x121e61))[_0xe4be('0x2f')](handleError());}}catch(_0x2bd693){logger[_0xe4be('0x2c')](JSON[_0xe4be('0x2d')](_0x2bd693));}return logger[_0xe4be('0xa')](_0xe4be('0x3e'));};}function getJobs(_0x782385){var _0x1cab1c={};if(_0x782385){_0x1cab1c['id']=_0x782385;}return db[_0xe4be('0x3f')][_0xe4be('0x40')]({'where':_0x1cab1c,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0xe4be('0x18')],'include':[{'model':db['MailServerOut'],'as':_0xe4be('0xc')}]}]})['then'](function(_0xf78f4d){var _0x36ac4e=_[_0xe4be('0x41')](manager['jobs']);var _0x8d4f77=_['map'](_0xf78f4d,function(_0x9d98a9){return _0x9d98a9['id'][_0xe4be('0x42')]();});var _0x11dc50=_['keyBy'](_0xf78f4d,function(_0x654280){return _0x654280['id'][_0xe4be('0x42')]();});var _0x24a463=_0x782385?_0x8d4f77:_[_0xe4be('0x43')](_0x8d4f77,_0x36ac4e);var _0x271c2f=_[_0xe4be('0x44')](_0x8d4f77,_0x36ac4e);var _0x1cd197=_[_0xe4be('0x43')](_0x36ac4e,_0x8d4f77);var _0x329fd7;var _0x58ed14;for(_0x329fd7=0x0;_0x329fd7<_0x1cd197[_0xe4be('0x45')]&&!_0x782385;_0x329fd7+=0x1){_0x58ed14=_0x1cd197[_0x329fd7][_0xe4be('0x42')]();if(manager[_0xe4be('0x46')](_0x58ed14)){manager[_0xe4be('0x47')](_0x58ed14);manager[_0xe4be('0x48')](_0x58ed14);logger[_0xe4be('0xa')](_0xe4be('0x49'),_0x58ed14);}}logger['info'](_0xe4be('0x4a'),JSON['stringify'](_0x24a463));for(_0x329fd7=0x0;_0x329fd7<_0x24a463[_0xe4be('0x45')];_0x329fd7+=0x1){_0x58ed14=_0x24a463[_0x329fd7][_0xe4be('0x42')]();logger['info'](_0xe4be('0x4b'),_0x58ed14);if(_0x782385){logger[_0xe4be('0xa')](_0xe4be('0x4c'),_0x782385);logger[_0xe4be('0xa')](JSON[_0xe4be('0x2d')](_0x11dc50[_0x58ed14]));BPromise[_0xe4be('0x4d')]()['then'](handleJob(_0x11dc50[_0x58ed14]));logger['info'](_0xe4be('0x4e'),_0x11dc50[_0x58ed14][_0xe4be('0x17')],_0x11dc50[_0x58ed14]['cron']);}else if(_0x11dc50[_0x58ed14][_0xe4be('0x4f')]&&_0x11dc50[_0x58ed14][_0xe4be('0x50')]&&moment()[_0xe4be('0x51')](_0x11dc50[_0x58ed14][_0xe4be('0x52')],_0x11dc50[_0x58ed14][_0xe4be('0x53')])){manager[_0xe4be('0x54')](_0x58ed14,_0x11dc50[_0x58ed14]['cron'],handleJob(_0x11dc50[_0x58ed14]));manager[_0xe4be('0x55')](_0x58ed14);logger['info'](_0xe4be('0x56'),_0x11dc50[_0x58ed14][_0xe4be('0x17')],_0x11dc50[_0x58ed14][_0xe4be('0x4f')]);}else if(manager['exists'](_0x58ed14)){manager['stop'](_0x58ed14);manager[_0xe4be('0x48')](_0x58ed14);logger[_0xe4be('0xa')](_0xe4be('0x57'),_0x11dc50[_0x58ed14][_0xe4be('0x17')],_0x11dc50[_0x58ed14][_0xe4be('0x4f')]);}}for(_0x329fd7=0x0,_0x58ed14;_0x329fd7<_0x271c2f[_0xe4be('0x45')]&&!_0x782385;_0x329fd7+=0x1){_0x58ed14=_0x271c2f[_0x329fd7][_0xe4be('0x42')]();if(manager[_0xe4be('0x46')](_0x58ed14)){if(_0x11dc50[_0x58ed14][_0xe4be('0x4f')]&&_0x11dc50[_0x58ed14][_0xe4be('0x50')]&&moment()['isBetween'](_0x11dc50[_0x58ed14]['startAt'],_0x11dc50[_0x58ed14][_0xe4be('0x53')])){manager['update'](_0x58ed14,_0x11dc50[_0x58ed14][_0xe4be('0x4f')],handleJob(_0x11dc50[_0x58ed14]));logger['info'](_0xe4be('0x58'),_0x11dc50[_0x58ed14][_0xe4be('0x17')],_0x11dc50[_0x58ed14][_0xe4be('0x4f')]);}else{manager[_0xe4be('0x47')](_0x58ed14);manager['deleteJob'](_0x58ed14);logger[_0xe4be('0xa')](_0xe4be('0x57'),_0x11dc50[_0x58ed14][_0xe4be('0x17')],_0x11dc50[_0x58ed14]['cron']);}}}})[_0xe4be('0x2f')](function(_0x2c11cd){logger['error'](JSON[_0xe4be('0x2d')](_0x2c11cd));});}exports['run']=function(_0x4664e7){return getJobs(_0x4664e7);};exports[_0xe4be('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6ec3=['length','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','add\x20cron','exists','stop\x20cron','endAt','update','update\x20cron','deleteJob','run','start','util','path','lodash','moment','jayson/promise','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','Smtp','service','host','secure','authentication','auth','pass','format','\x22%s\x22\x20<%s>','name','email','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','zip','join','existsSync','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','empty\x20file,\x20email\x20not\x20sent','then','error','stringify','email\x20sent','catch','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','CustomReportId','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','difference','intersection'];(function(_0x220720,_0x10d6b4){var _0x20f9a7=function(_0xfd086c){while(--_0xfd086c){_0x220720['push'](_0x220720['shift']());}};_0x20f9a7(++_0x10d6b4);}(_0x6ec3,0x1d2));var _0x36ec=function(_0x34c765,_0x20a51b){_0x34c765=_0x34c765-0x0;var _0x39901a=_0x6ec3[_0x34c765];return _0x39901a;};'use strict';var fs=require('fs');var util=require(_0x36ec('0x0'));var path=require(_0x36ec('0x1'));var _=require(_0x36ec('0x2'));var moment=require(_0x36ec('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x36ec('0x4'));var BPromise=require('bluebird');var logger=require(_0x36ec('0x5'))('schedule');var db=require(_0x36ec('0x6'))['db'];var analyticCustomReportController=require(_0x36ec('0x7'));var analyticDefaultReportController=require(_0x36ec('0x8'));var client=jayson['client'][_0x36ec('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4f7318,_0x431e29){return function(){logger['info'](_0x36ec('0xa'),_0x4f7318['email']);var _0xeb548f=!![];var _0x8214a3={'tls':{'rejectUnauthorized':![]}};if(_0x4f7318[_0x36ec('0xb')][_0x36ec('0xc')][_0x36ec('0xd')]){_0x8214a3[_0x36ec('0xd')]=_0x4f7318[_0x36ec('0xb')][_0x36ec('0xc')][_0x36ec('0xd')];}else{_0x8214a3['host']=_0x4f7318[_0x36ec('0xb')][_0x36ec('0xc')][_0x36ec('0xe')];_0x8214a3['port']=_0x4f7318['MailAccount'][_0x36ec('0xc')]['port'];_0x8214a3[_0x36ec('0xf')]=_0x4f7318[_0x36ec('0xb')][_0x36ec('0xc')][_0x36ec('0xf')];}if(_0x4f7318[_0x36ec('0xb')][_0x36ec('0xc')][_0x36ec('0x10')]){_0x8214a3[_0x36ec('0x11')]={'user':_0x4f7318[_0x36ec('0xb')][_0x36ec('0xc')]['user'],'pass':_0x4f7318[_0x36ec('0xb')]['Smtp'][_0x36ec('0x12')]};}var _0x44cd82={'account':_0x8214a3,'message':{'from':util[_0x36ec('0x13')](_0x36ec('0x14'),_0x4f7318[_0x36ec('0xb')][_0x36ec('0x15')],_0x4f7318[_0x36ec('0xb')][_0x36ec('0x16')]||_0x4f7318['MailAccount']['Smtp'][_0x36ec('0x17')]),'to':_0x4f7318['email'],'cc':_0x4f7318['cc'],'bcc':_0x4f7318['bcc'],'subject':util[_0x36ec('0x13')](_0x36ec('0x18'),_0x431e29['name'],_0x4f7318[_0x36ec('0x19')],_0x4f7318[_0x36ec('0x1a')])}};var _0x3f53c1=path['join'](__dirname,_0x36ec('0x1b'));var _0x468f42=_0x431e29[_0x36ec('0x1c')];var _0x11cdb6=util['format'](_0x36ec('0x1d'),path[_0x36ec('0x1e')](_0x431e29[_0x36ec('0x1c')],path['extname'](_0x431e29[_0x36ec('0x1c')])),_0x36ec('0x1f'));var _0x219885=path[_0x36ec('0x20')](_0x3f53c1,_0x468f42);var _0x4ec0e7=path['join'](_0x3f53c1,_0x11cdb6);if(fs[_0x36ec('0x21')](_0x219885)){_0x431e29['status']=_0x36ec('0x22');_0x44cd82['message'][_0x36ec('0x23')]=[{'filename':_0x468f42,'path':_0x219885}];_0x44cd82[_0x36ec('0x24')][_0x36ec('0x25')]=util[_0x36ec('0x13')](_0x36ec('0x26'),JSON['stringify'](_0x431e29,null,0x2));}else if(fs['existsSync'](_0x4ec0e7)){_0x431e29[_0x36ec('0x27')]=_0x36ec('0x22');_0x44cd82[_0x36ec('0x24')][_0x36ec('0x23')]=[{'filename':_0x11cdb6,'path':_0x4ec0e7}];}else{_0x44cd82[_0x36ec('0x24')][_0x36ec('0x25')]=_0x36ec('0x28');if(!_0x4f7318['sendIfEmpty']){_0xeb548f=![];logger[_0x36ec('0x29')](_0x36ec('0x2a'));}}if(_0xeb548f){return client['request']('SendMail',_0x44cd82)[_0x36ec('0x2b')](function(_0xeb4c3c){if(_0xeb4c3c[_0x36ec('0x2c')]){return logger[_0x36ec('0x2c')]('error\x20mail',JSON[_0x36ec('0x2d')](_0xeb4c3c));}return logger[_0x36ec('0x29')](_0x36ec('0x2e'));})[_0x36ec('0x2f')](function(_0x55a351){return logger['error']('error\x20mail',JSON[_0x36ec('0x2d')](_0x55a351));});}};}function handleError(){return function(_0x5ecc12){return logger[_0x36ec('0x2c')](JSON[_0x36ec('0x2d')](_0x5ecc12));};}function handleResult(_0x5db0b7){return function(_0x406ce6){logger[_0x36ec('0x29')](_0x36ec('0x30'),JSON['stringify'](_0x406ce6));if(_0x5db0b7[_0x36ec('0xb')]&&_0x5db0b7[_0x36ec('0xb')][_0x36ec('0xc')]&&!_['isNil'](_0x5db0b7[_0x36ec('0x16')])){setTimeout(handleSendEmail(_0x5db0b7,_0x406ce6),0x3c*0x3e8);}};}function handleJob(_0x5710b5){return function(){try{if(_[_0x36ec('0x31')](_0x5710b5[_0x36ec('0x19')])){return logger[_0x36ec('0x29')](_0x36ec('0x32'));}if(_[_0x36ec('0x31')](_0x5710b5[_0x36ec('0x1a')])){return logger[_0x36ec('0x29')](_0x36ec('0x33'));}var _0x10a1d4={'startDate':moment()[_0x36ec('0x34')](_0x5710b5[_0x36ec('0x19')],_0x5710b5[_0x36ec('0x1a')])[_0x36ec('0x13')](_0x36ec('0x35')),'endDate':moment()[_0x36ec('0x13')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x5710b5[_0x36ec('0x36')],'name':_0x5710b5['name']};if(!_[_0x36ec('0x31')](_0x5710b5[_0x36ec('0x37')])){logger[_0x36ec('0x29')]('exec\x20defaul\x20report\x20id:%s',_0x5710b5['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x5710b5[_0x36ec('0x37')]},_0x10a1d4)[_0x36ec('0x2b')](handleResult(_0x5710b5))[_0x36ec('0x2f')](handleError());}if(!_[_0x36ec('0x31')](_0x5710b5[_0x36ec('0x38')])){logger[_0x36ec('0x29')]('exec\x20custom\x20report\x20id:%s',_0x5710b5['CustomReportId']);return analyticCustomReportController[_0x36ec('0x39')]({'id':_0x5710b5[_0x36ec('0x38')]},_0x10a1d4)[_0x36ec('0x2b')](handleResult(_0x5710b5))[_0x36ec('0x2f')](handleError());}}catch(_0x4b156d){logger[_0x36ec('0x2c')](JSON['stringify'](_0x4b156d));}return logger[_0x36ec('0x29')](_0x36ec('0x3a'));};}function getJobs(_0x4cb9fb){var _0x317886={};if(_0x4cb9fb){_0x317886['id']=_0x4cb9fb;}return db[_0x36ec('0x3b')][_0x36ec('0x3c')]({'where':_0x317886,'include':[{'model':db['MailAccount'],'attributes':['id',_0x36ec('0x15'),'email'],'include':[{'model':db[_0x36ec('0x3d')],'as':_0x36ec('0xc')}]}]})['then'](function(_0x3ad34e){var _0x1cfd6f=_['keys'](manager[_0x36ec('0x3e')]);var _0x2827f8=_[_0x36ec('0x3f')](_0x3ad34e,function(_0x14d10c){return _0x14d10c['id'][_0x36ec('0x40')]();});var _0x40ba1f=_[_0x36ec('0x41')](_0x3ad34e,function(_0x538fd9){return _0x538fd9['id'][_0x36ec('0x40')]();});var _0x32db7b=_0x4cb9fb?_0x2827f8:_[_0x36ec('0x42')](_0x2827f8,_0x1cfd6f);var _0x4e40c5=_[_0x36ec('0x43')](_0x2827f8,_0x1cfd6f);var _0xaee3dd=_[_0x36ec('0x42')](_0x1cfd6f,_0x2827f8);var _0x1a0b56;var _0x41d562;for(_0x1a0b56=0x0;_0x1a0b56<_0xaee3dd[_0x36ec('0x44')]&&!_0x4cb9fb;_0x1a0b56+=0x1){_0x41d562=_0xaee3dd[_0x1a0b56][_0x36ec('0x40')]();if(manager['exists'](_0x41d562)){manager[_0x36ec('0x45')](_0x41d562);manager['deleteJob'](_0x41d562);logger[_0x36ec('0x29')](_0x36ec('0x46'),_0x41d562);}}logger['info'](_0x36ec('0x47'),JSON[_0x36ec('0x2d')](_0x32db7b));for(_0x1a0b56=0x0;_0x1a0b56<_0x32db7b[_0x36ec('0x44')];_0x1a0b56+=0x1){_0x41d562=_0x32db7b[_0x1a0b56][_0x36ec('0x40')]();logger['info'](_0x36ec('0x48'),_0x41d562);if(_0x4cb9fb){logger[_0x36ec('0x29')](_0x36ec('0x49'),_0x4cb9fb);logger[_0x36ec('0x29')](JSON[_0x36ec('0x2d')](_0x40ba1f[_0x41d562]));BPromise[_0x36ec('0x4a')]()[_0x36ec('0x2b')](handleJob(_0x40ba1f[_0x41d562]));logger[_0x36ec('0x29')](_0x36ec('0x4b'),_0x40ba1f[_0x41d562][_0x36ec('0x15')],_0x40ba1f[_0x41d562][_0x36ec('0x4c')]);}else if(_0x40ba1f[_0x41d562][_0x36ec('0x4c')]&&_0x40ba1f[_0x41d562][_0x36ec('0x4d')]&&moment()[_0x36ec('0x4e')](_0x40ba1f[_0x41d562][_0x36ec('0x4f')],_0x40ba1f[_0x41d562]['endAt'])){manager['add'](_0x41d562,_0x40ba1f[_0x41d562][_0x36ec('0x4c')],handleJob(_0x40ba1f[_0x41d562]));manager['start'](_0x41d562);logger[_0x36ec('0x29')](_0x36ec('0x50'),_0x40ba1f[_0x41d562][_0x36ec('0x15')],_0x40ba1f[_0x41d562]['cron']);}else if(manager[_0x36ec('0x51')](_0x41d562)){manager[_0x36ec('0x45')](_0x41d562);manager['deleteJob'](_0x41d562);logger['info'](_0x36ec('0x52'),_0x40ba1f[_0x41d562][_0x36ec('0x15')],_0x40ba1f[_0x41d562][_0x36ec('0x4c')]);}}for(_0x1a0b56=0x0,_0x41d562;_0x1a0b56<_0x4e40c5['length']&&!_0x4cb9fb;_0x1a0b56+=0x1){_0x41d562=_0x4e40c5[_0x1a0b56][_0x36ec('0x40')]();if(manager[_0x36ec('0x51')](_0x41d562)){if(_0x40ba1f[_0x41d562][_0x36ec('0x4c')]&&_0x40ba1f[_0x41d562][_0x36ec('0x4d')]&&moment()[_0x36ec('0x4e')](_0x40ba1f[_0x41d562][_0x36ec('0x4f')],_0x40ba1f[_0x41d562][_0x36ec('0x53')])){manager[_0x36ec('0x54')](_0x41d562,_0x40ba1f[_0x41d562]['cron'],handleJob(_0x40ba1f[_0x41d562]));logger[_0x36ec('0x29')](_0x36ec('0x55'),_0x40ba1f[_0x41d562][_0x36ec('0x15')],_0x40ba1f[_0x41d562][_0x36ec('0x4c')]);}else{manager['stop'](_0x41d562);manager[_0x36ec('0x56')](_0x41d562);logger[_0x36ec('0x29')](_0x36ec('0x52'),_0x40ba1f[_0x41d562][_0x36ec('0x15')],_0x40ba1f[_0x41d562]['cron']);}}}})[_0x36ec('0x2f')](function(_0x3c0635){logger['error'](JSON[_0x36ec('0x2d')](_0x3c0635));});}exports[_0x36ec('0x57')]=function(_0x3344d5){return getJobs(_0x3344d5);};exports[_0x36ec('0x58')]=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 b344946..370ec53 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 _0xbd5f=['bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','update','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Sentiment','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','start','lodash','aws-sdk','request-promise','bluebird','../../config/logger','getTranscriptionJob','Comprehend','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','info','results','transcripts','length','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language'];(function(_0x5aa373,_0x54c7f4){var _0x590e8e=function(_0x505e62){while(--_0x505e62){_0x5aa373['push'](_0x5aa373['shift']());}};_0x590e8e(++_0x54c7f4);}(_0xbd5f,0x1c7));var _0xfbd5=function(_0x3d2e03,_0x3b0fdf){_0x3d2e03=_0x3d2e03-0x0;var _0x3eee90=_0xbd5f[_0x3d2e03];return _0x3eee90;};var _=require(_0xfbd5('0x0'));var AWS=require(_0xfbd5('0x1'));var rp=require(_0xfbd5('0x2'));var util=require('util');var BPromise=require(_0xfbd5('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xfbd5('0x4'))('transcribe');function getTranscriptionJob(_0x24d080,_0x408b9e,_0x2aa5a5,_0x7306d4){return new Promise(function(_0x26f5ea,_0x9df06e){var _0x5b78a9=new AWS['TranscribeService']({'accessKeyId':_0x408b9e,'secretAccessKey':_0x24d080,'region':_0x2aa5a5});_0x5b78a9[_0xfbd5('0x5')]({'TranscriptionJobName':_0x7306d4},function(_0x4af37a,_0x5c271e){if(_0x4af37a){return _0x9df06e(_0x4af37a);}else{return _0x26f5ea(_0x5c271e);}});});}function sentiment(_0x44af10,_0x4fcd94,_0x29adab,_0x1cf660,_0x28b8bd){return new Promise(function(_0x541986,_0x5376c7){var _0x4ea0b9=new AWS[(_0xfbd5('0x6'))]({'accessKeyId':_0x4fcd94,'secretAccessKey':_0x44af10,'region':_0x29adab});_0x4ea0b9[_0xfbd5('0x7')]({'Text':_0x1cf660,'LanguageCode':_0x28b8bd[_0xfbd5('0x8')](0x0,0x2)},function(_0x7188f2,_0x42b68a){if(_0x7188f2){return _0x5376c7(_0x7188f2);}else{return _0x541986(_0x42b68a);}});});}function checkTranscribeJob(_0x2004fe,_0x4adb0d,_0x12d472){var _0x5bc15f;return new BPromise(function(_0xaadca0,_0x2867ed){logger['info'](util['format'](_0xfbd5('0x9'),_0x2004fe['id'],_0x2004fe[_0xfbd5('0xa')]));return getTranscriptionJob(_0x12d472[_0xfbd5('0xb')],_0x12d472[_0xfbd5('0xc')],_0x4adb0d[_0xfbd5('0xd')],_0x2004fe[_0xfbd5('0xa')])[_0xfbd5('0xe')](function(_0x288d71){logger['info'](util[_0xfbd5('0xf')](_0xfbd5('0x10'),_0x2004fe['id'],_0x2004fe[_0xfbd5('0xa')],_0x288d71['TranscriptionJob'][_0xfbd5('0x11')]));if(!_0x2004fe[_0xfbd5('0x12')]){switch(_0x288d71['TranscriptionJob'][_0xfbd5('0x11')]){case'COMPLETED':var _0x5b0401={'transcribeStatus':_0x288d71[_0xfbd5('0x13')][_0xfbd5('0x11')],'fileUri':_0x288d71['TranscriptionJob'][_0xfbd5('0x14')][_0xfbd5('0x15')]};logger['info'](util[_0xfbd5('0xf')](_0xfbd5('0x16'),_0x2004fe['id']));return rp({'uri':_0x288d71[_0xfbd5('0x13')][_0xfbd5('0x14')][_0xfbd5('0x15')],'json':!![]})[_0xfbd5('0xe')](function(_0x3a2797){logger[_0xfbd5('0x17')](util[_0xfbd5('0xf')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x2004fe['id']));if(_0x3a2797&&_0x3a2797[_0xfbd5('0x18')]&&_0x3a2797[_0xfbd5('0x18')][_0xfbd5('0x19')]&&_0x3a2797[_0xfbd5('0x18')][_0xfbd5('0x19')][_0xfbd5('0x1a')]){_0x5b0401[_0xfbd5('0x12')]='';for(var _0x298fe1=0x0;_0x298fe1<_0x3a2797['results']['transcripts']['length'];_0x298fe1++){_0x5b0401[_0xfbd5('0x12')]+=_0x3a2797[_0xfbd5('0x18')][_0xfbd5('0x19')][_0x298fe1]['transcript']+'';}}return _0x2004fe['update'](_0x5b0401);})[_0xfbd5('0xe')](function(){logger[_0xfbd5('0x17')](util[_0xfbd5('0xf')](_0xfbd5('0x1b'),_0x2004fe['id']));if(!_0x2004fe[_0xfbd5('0x1c')]){throw new db[(_0xfbd5('0x1d'))][(_0xfbd5('0x1e'))](_0xfbd5('0x1f'));}if(!_0x4adb0d['sentiment']||!_0x4adb0d[_0xfbd5('0x20')]||!_0x4adb0d[_0xfbd5('0x21')]||!_0x4adb0d[_0xfbd5('0x22')]||!_0x4adb0d[_0xfbd5('0x23')]){throw new db['Sequelize'][(_0xfbd5('0x1e'))](_0xfbd5('0x24'));}if(!_0x5b0401[_0xfbd5('0x12')]){throw new Error(_0xfbd5('0x25'));}if(_0x4adb0d[_0xfbd5('0x20')]===_0x12d472['id']){return _0x12d472;}else{return db[_0xfbd5('0x26')][_0xfbd5('0x27')]({'where':{'id':_settings[_0xfbd5('0x20')]}});}})[_0xfbd5('0xe')](function(_0x59c91a){if(!_0x59c91a){throw new db[(_0xfbd5('0x1d'))][(_0xfbd5('0x1e'))](_0xfbd5('0x28'));}if(!_0x59c91a[_0xfbd5('0xb')]||!_0x59c91a[_0xfbd5('0xc')]){throw new db[(_0xfbd5('0x1d'))]['ValidationError'](_0xfbd5('0x29'));}_0x5bc15f=_0x59c91a;logger[_0xfbd5('0x17')](util[_0xfbd5('0xf')](_0xfbd5('0x2a'),_0x2004fe['id']));return sentiment(_0x5bc15f['data1'],_0x5bc15f['data2'],_0x4adb0d['sentimentRegion'],_0x5b0401[_0xfbd5('0x12')],_0x4adb0d[_0xfbd5('0x22')]);})[_0xfbd5('0xe')](function(_0x55ba9e){logger['info'](util[_0xfbd5('0xf')](_0xfbd5('0x2b'),_0x2004fe['id']));return _0x2004fe['update']({'sentiment':_0x55ba9e['Sentiment'],'sPositive':_0x55ba9e[_0xfbd5('0x2c')][_0xfbd5('0x2d')],'sNegative':_0x55ba9e[_0xfbd5('0x2c')][_0xfbd5('0x2e')],'sMixed':_0x55ba9e['SentimentScore'][_0xfbd5('0x2f')],'sNeutral':_0x55ba9e[_0xfbd5('0x2c')][_0xfbd5('0x30')]});})['then'](function(){logger[_0xfbd5('0x17')](util[_0xfbd5('0xf')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2004fe['id']));_0xaadca0();});case _0xfbd5('0x31'):return _0x2004fe[_0xfbd5('0x32')]({'transcribeStatus':_0xfbd5('0x31'),'failureReason':_0x288d71['TranscriptionJob'][_0xfbd5('0x33')]})[_0xfbd5('0xe')](function(){logger[_0xfbd5('0x17')](util[_0xfbd5('0xf')](_0xfbd5('0x1b'),_0x2004fe['id']));_0xaadca0();});default:logger['info'](util[_0xfbd5('0xf')](_0xfbd5('0x34'),_0x2004fe['id']));break;}}else{return BPromise[_0xfbd5('0x35')]()[_0xfbd5('0xe')](function(){if(!_0x2004fe[_0xfbd5('0x1c')]){throw new db['Sequelize'][(_0xfbd5('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4adb0d[_0xfbd5('0x36')]||!_0x4adb0d[_0xfbd5('0x20')]||!_0x4adb0d[_0xfbd5('0x21')]||!_0x4adb0d[_0xfbd5('0x22')]||!_0x4adb0d[_0xfbd5('0x23')]){throw new db['Sequelize'][(_0xfbd5('0x1e'))](_0xfbd5('0x24'));}if(!_0x2004fe[_0xfbd5('0x12')]){throw new Error(_0xfbd5('0x25'));}if(_0x4adb0d[_0xfbd5('0x20')]===_0x12d472['id']){return _0x12d472;}else{return db['CloudProvider'][_0xfbd5('0x27')]({'where':{'id':_settings[_0xfbd5('0x20')]}});}})['then'](function(_0x308327){if(!_0x308327){throw new db['Sequelize'][(_0xfbd5('0x1e'))](_0xfbd5('0x28'));}if(!_0x308327['data1']||!_0x308327[_0xfbd5('0xc')]){throw new db[(_0xfbd5('0x1d'))][(_0xfbd5('0x1e'))](_0xfbd5('0x29'));}_0x5bc15f=_0x308327;logger[_0xfbd5('0x17')](util[_0xfbd5('0xf')](_0xfbd5('0x2a'),_0x2004fe['id']));return sentiment(_0x5bc15f[_0xfbd5('0xb')],_0x5bc15f['data2'],_0x4adb0d['sentimentRegion'],_0x2004fe['fileText'],_0x4adb0d['language']);})[_0xfbd5('0xe')](function(_0x26caa7){logger[_0xfbd5('0x17')](util[_0xfbd5('0xf')](_0xfbd5('0x2b'),_0x2004fe['id']));return _0x2004fe['update']({'sentiment':_0x26caa7[_0xfbd5('0x37')],'sPositive':_0x26caa7[_0xfbd5('0x2c')]['Positive'],'sNegative':_0x26caa7['SentimentScore'][_0xfbd5('0x2e')],'sMixed':_0x26caa7[_0xfbd5('0x2c')][_0xfbd5('0x2f')],'sNeutral':_0x26caa7[_0xfbd5('0x2c')][_0xfbd5('0x30')],'transcribeStatus':_0xfbd5('0x38')});})[_0xfbd5('0xe')](function(){logger[_0xfbd5('0x17')](util[_0xfbd5('0xf')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2004fe['id']));_0xaadca0();});}})[_0xfbd5('0x39')](function(_0xb62870){if(_0xb62870){if(!_0xb62870['name']||_0xb62870[_0xfbd5('0x3a')]!==_0xfbd5('0x3b')){logger[_0xfbd5('0x3c')](util[_0xfbd5('0xf')](_0xfbd5('0x3d'),_0x2004fe['id']),util[_0xfbd5('0x3e')](_0xb62870,{'showHidden':![],'depth':null}));}}_0xaadca0();});});}function checkTranscribe(){var _0x5cc8e8;var _0x1dff46;var _0x28408f;return db['VoiceRecording']['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xfbd5('0xe')](function(_0x51809d){if(!_0x51809d||!_0x51809d[_0xfbd5('0x1a')]){throw new db[(_0xfbd5('0x1d'))][(_0xfbd5('0x1e'))](_0xfbd5('0x3f'));}_0x5cc8e8=_0x51809d;return db['Setting']['findOne']({'where':{'id':0x1}});})['then'](function(_0x31d6de){if(!_0x31d6de){throw new db[(_0xfbd5('0x1d'))][(_0xfbd5('0x1e'))](_0xfbd5('0x40'));}_0x1dff46=_0x31d6de;if(!_0x1dff46['transcribe']||!_0x1dff46[_0xfbd5('0x41')]||!_0x1dff46[_0xfbd5('0xd')]||!_0x1dff46[_0xfbd5('0x22')]||!_0x1dff46[_0xfbd5('0x23')]){throw new db['Sequelize']['ValidationError'](_0xfbd5('0x42'));}return db['CloudProvider']['findOne']({'where':{'id':_0x1dff46[_0xfbd5('0x41')]}});})[_0xfbd5('0xe')](function(_0x2d37bc){if(!_0x2d37bc){throw new db[(_0xfbd5('0x1d'))][(_0xfbd5('0x1e'))](_0xfbd5('0x28'));}if(!_0x2d37bc[_0xfbd5('0xb')]||!_0x2d37bc[_0xfbd5('0xc')]){throw new db[(_0xfbd5('0x1d'))][(_0xfbd5('0x1e'))](_0xfbd5('0x29'));}_0x28408f=_0x2d37bc;var _0x43bbe0=[];_0x5cc8e8[_0xfbd5('0x43')](function(_0x4d65c4){_0x43bbe0[_0xfbd5('0x44')](checkTranscribeJob(_0x4d65c4,_0x1dff46,_0x28408f));});return BPromise['all'](_0x43bbe0);})[_0xfbd5('0x39')](function(_0x512150){if(_0x512150){if(!_0x512150[_0xfbd5('0x3a')]||_0x512150['name']!==_0xfbd5('0x3b')){logger[_0xfbd5('0x3c')](util[_0xfbd5('0x3e')](_0x512150,{'showHidden':![],'depth':null}));}}});}exports[_0xfbd5('0x45')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x570f=['length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','sentiment','sentimentAccountId','sentimentRegion','language','bucket','ValidationError','Sentiment\x20Analysis\x20not\x20configured','findOne','Cloud\x20Provider\x20not\x20configured','SentimentScore','Positive','Neutral','FAILED','FailureReason','resolve','Sentiment\x20Analysis\x20not\x20requested','Transcript\x20not\x20available','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Negative','Mixed','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','CloudProvider','transcribeAccountId','forEach','push','start','lodash','aws-sdk','request-promise','../../mysqldb','../../config/logger','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts'];(function(_0x5b06fb,_0x1190f4){var _0x53a53a=function(_0x52adb4){while(--_0x52adb4){_0x5b06fb['push'](_0x5b06fb['shift']());}};_0x53a53a(++_0x1190f4);}(_0x570f,0x152));var _0xf570=function(_0x34664d,_0x5a9943){_0x34664d=_0x34664d-0x0;var _0x2865cf=_0x570f[_0x34664d];return _0x2865cf;};var _=require(_0xf570('0x0'));var AWS=require(_0xf570('0x1'));var rp=require(_0xf570('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0xf570('0x3'))['db'];var logger=require(_0xf570('0x4'))(_0xf570('0x5'));function getTranscriptionJob(_0x22c270,_0x140bb4,_0x1cb206,_0x5b8c89){return new Promise(function(_0x5ce063,_0x2ec4ba){var _0x47c534=new AWS[(_0xf570('0x6'))]({'accessKeyId':_0x140bb4,'secretAccessKey':_0x22c270,'region':_0x1cb206});_0x47c534['getTranscriptionJob']({'TranscriptionJobName':_0x5b8c89},function(_0x2575c0,_0x5ce08f){if(_0x2575c0){return _0x2ec4ba(_0x2575c0);}else{return _0x5ce063(_0x5ce08f);}});});}function sentiment(_0x350a32,_0x49b42f,_0x19bee1,_0x375e35,_0x30f641){return new Promise(function(_0x1f0ff5,_0x42a0e0){var _0x4ad522=new AWS[(_0xf570('0x7'))]({'accessKeyId':_0x49b42f,'secretAccessKey':_0x350a32,'region':_0x19bee1});_0x4ad522[_0xf570('0x8')]({'Text':_0x375e35,'LanguageCode':_0x30f641[_0xf570('0x9')](0x0,0x2)},function(_0x52d724,_0x12dc76){if(_0x52d724){return _0x42a0e0(_0x52d724);}else{return _0x1f0ff5(_0x12dc76);}});});}function checkTranscribeJob(_0x3c689c,_0x40559e,_0x51cb42){var _0x32e0b0;return new BPromise(function(_0xe2d1a4,_0x29cc8f){logger[_0xf570('0xa')](util['format'](_0xf570('0xb'),_0x3c689c['id'],_0x3c689c[_0xf570('0xc')]));return getTranscriptionJob(_0x51cb42[_0xf570('0xd')],_0x51cb42[_0xf570('0xe')],_0x40559e[_0xf570('0xf')],_0x3c689c[_0xf570('0xc')])[_0xf570('0x10')](function(_0x1065a9){logger[_0xf570('0xa')](util[_0xf570('0x11')](_0xf570('0x12'),_0x3c689c['id'],_0x3c689c['transcribeName'],_0x1065a9[_0xf570('0x13')][_0xf570('0x14')]));if(!_0x3c689c[_0xf570('0x15')]){switch(_0x1065a9[_0xf570('0x13')][_0xf570('0x14')]){case'COMPLETED':var _0x34d96a={'transcribeStatus':_0x1065a9[_0xf570('0x13')][_0xf570('0x14')],'fileUri':_0x1065a9['TranscriptionJob'][_0xf570('0x16')][_0xf570('0x17')]};logger[_0xf570('0xa')](util[_0xf570('0x11')]('[RECORDING:%d]\x20Get\x20transcript',_0x3c689c['id']));return rp({'uri':_0x1065a9[_0xf570('0x13')][_0xf570('0x16')][_0xf570('0x17')],'json':!![]})[_0xf570('0x10')](function(_0x2488bd){logger['info'](util[_0xf570('0x11')](_0xf570('0x18'),_0x3c689c['id']));if(_0x2488bd&&_0x2488bd[_0xf570('0x19')]&&_0x2488bd[_0xf570('0x19')]['transcripts']&&_0x2488bd[_0xf570('0x19')][_0xf570('0x1a')][_0xf570('0x1b')]){_0x34d96a[_0xf570('0x15')]='';for(var _0x45cb29=0x0;_0x45cb29<_0x2488bd[_0xf570('0x19')]['transcripts'][_0xf570('0x1b')];_0x45cb29++){_0x34d96a[_0xf570('0x15')]+=_0x2488bd[_0xf570('0x19')][_0xf570('0x1a')][_0x45cb29][_0xf570('0x1c')]+'';}}return _0x3c689c[_0xf570('0x1d')](_0x34d96a);})[_0xf570('0x10')](function(){logger[_0xf570('0xa')](util[_0xf570('0x11')](_0xf570('0x1e'),_0x3c689c['id']));if(!_0x3c689c[_0xf570('0x1f')]){throw new db[(_0xf570('0x20'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x40559e[_0xf570('0x21')]||!_0x40559e[_0xf570('0x22')]||!_0x40559e[_0xf570('0x23')]||!_0x40559e[_0xf570('0x24')]||!_0x40559e[_0xf570('0x25')]){throw new db[(_0xf570('0x20'))][(_0xf570('0x26'))](_0xf570('0x27'));}if(!_0x34d96a[_0xf570('0x15')]){throw new Error('Transcript\x20not\x20available');}if(_0x40559e[_0xf570('0x22')]===_0x51cb42['id']){return _0x51cb42;}else{return db['CloudProvider'][_0xf570('0x28')]({'where':{'id':_settings[_0xf570('0x22')]}});}})[_0xf570('0x10')](function(_0x596428){if(!_0x596428){throw new db[(_0xf570('0x20'))][(_0xf570('0x26'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x596428[_0xf570('0xd')]||!_0x596428['data2']){throw new db[(_0xf570('0x20'))][(_0xf570('0x26'))](_0xf570('0x29'));}_0x32e0b0=_0x596428;logger[_0xf570('0xa')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3c689c['id']));return sentiment(_0x32e0b0[_0xf570('0xd')],_0x32e0b0[_0xf570('0xe')],_0x40559e[_0xf570('0x23')],_0x34d96a[_0xf570('0x15')],_0x40559e[_0xf570('0x24')]);})['then'](function(_0x1db4fa){logger['info'](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3c689c['id']));return _0x3c689c[_0xf570('0x1d')]({'sentiment':_0x1db4fa['Sentiment'],'sPositive':_0x1db4fa[_0xf570('0x2a')][_0xf570('0x2b')],'sNegative':_0x1db4fa['SentimentScore']['Negative'],'sMixed':_0x1db4fa[_0xf570('0x2a')]['Mixed'],'sNeutral':_0x1db4fa['SentimentScore'][_0xf570('0x2c')]});})['then'](function(){logger['info'](util['format'](_0xf570('0x1e'),_0x3c689c['id']));_0xe2d1a4();});case _0xf570('0x2d'):return _0x3c689c[_0xf570('0x1d')]({'transcribeStatus':_0xf570('0x2d'),'failureReason':_0x1065a9[_0xf570('0x13')][_0xf570('0x2e')]})[_0xf570('0x10')](function(){logger[_0xf570('0xa')](util[_0xf570('0x11')](_0xf570('0x1e'),_0x3c689c['id']));_0xe2d1a4();});default:logger[_0xf570('0xa')](util[_0xf570('0x11')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x3c689c['id']));break;}}else{return BPromise[_0xf570('0x2f')]()[_0xf570('0x10')](function(){if(!_0x3c689c[_0xf570('0x1f')]){throw new db['Sequelize'][(_0xf570('0x26'))](_0xf570('0x30'));}if(!_0x40559e[_0xf570('0x21')]||!_0x40559e[_0xf570('0x22')]||!_0x40559e[_0xf570('0x23')]||!_0x40559e[_0xf570('0x24')]||!_0x40559e[_0xf570('0x25')]){throw new db[(_0xf570('0x20'))][(_0xf570('0x26'))](_0xf570('0x27'));}if(!_0x3c689c[_0xf570('0x15')]){throw new Error(_0xf570('0x31'));}if(_0x40559e[_0xf570('0x22')]===_0x51cb42['id']){return _0x51cb42;}else{return db['CloudProvider'][_0xf570('0x28')]({'where':{'id':_settings[_0xf570('0x22')]}});}})['then'](function(_0x851844){if(!_0x851844){throw new db[(_0xf570('0x20'))][(_0xf570('0x26'))](_0xf570('0x32'));}if(!_0x851844[_0xf570('0xd')]||!_0x851844[_0xf570('0xe')]){throw new db[(_0xf570('0x20'))]['ValidationError'](_0xf570('0x29'));}_0x32e0b0=_0x851844;logger[_0xf570('0xa')](util[_0xf570('0x11')](_0xf570('0x33'),_0x3c689c['id']));return sentiment(_0x32e0b0[_0xf570('0xd')],_0x32e0b0[_0xf570('0xe')],_0x40559e['sentimentRegion'],_0x3c689c['fileText'],_0x40559e[_0xf570('0x24')]);})[_0xf570('0x10')](function(_0x32408a){logger[_0xf570('0xa')](util['format'](_0xf570('0x34'),_0x3c689c['id']));return _0x3c689c[_0xf570('0x1d')]({'sentiment':_0x32408a[_0xf570('0x35')],'sPositive':_0x32408a['SentimentScore'][_0xf570('0x2b')],'sNegative':_0x32408a['SentimentScore'][_0xf570('0x36')],'sMixed':_0x32408a[_0xf570('0x2a')][_0xf570('0x37')],'sNeutral':_0x32408a[_0xf570('0x2a')][_0xf570('0x2c')],'transcribeStatus':_0xf570('0x38')});})[_0xf570('0x10')](function(){logger[_0xf570('0xa')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3c689c['id']));_0xe2d1a4();});}})[_0xf570('0x39')](function(_0x562afd){if(_0x562afd){if(!_0x562afd[_0xf570('0x3a')]||_0x562afd[_0xf570('0x3a')]!==_0xf570('0x3b')){logger[_0xf570('0x3c')](util[_0xf570('0x11')](_0xf570('0x3d'),_0x3c689c['id']),util[_0xf570('0x3e')](_0x562afd,{'showHidden':![],'depth':null}));}}_0xe2d1a4();});});}function checkTranscribe(){var _0x278cd4;var _0x2cb5e3;var _0x4ec02c;return db[_0xf570('0x3f')]['findAll']({'where':{'transcribeStatus':_0xf570('0x40')}})[_0xf570('0x10')](function(_0x3bff45){if(!_0x3bff45||!_0x3bff45['length']){throw new db['Sequelize'][(_0xf570('0x26'))]('No\x20transcribe\x20job\x20to\x20check');}_0x278cd4=_0x3bff45;return db[_0xf570('0x41')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x2d33af){if(!_0x2d33af){throw new db[(_0xf570('0x20'))][(_0xf570('0x26'))](_0xf570('0x42'));}_0x2cb5e3=_0x2d33af;if(!_0x2cb5e3[_0xf570('0x5')]||!_0x2cb5e3['transcribeAccountId']||!_0x2cb5e3[_0xf570('0xf')]||!_0x2cb5e3[_0xf570('0x24')]||!_0x2cb5e3['bucket']){throw new db[(_0xf570('0x20'))]['ValidationError'](_0xf570('0x43'));}return db[_0xf570('0x44')][_0xf570('0x28')]({'where':{'id':_0x2cb5e3[_0xf570('0x45')]}});})[_0xf570('0x10')](function(_0x563e3f){if(!_0x563e3f){throw new db['Sequelize'][(_0xf570('0x26'))](_0xf570('0x32'));}if(!_0x563e3f[_0xf570('0xd')]||!_0x563e3f[_0xf570('0xe')]){throw new db['Sequelize'][(_0xf570('0x26'))]('Cloud\x20Provider\x20not\x20configured');}_0x4ec02c=_0x563e3f;var _0x2831da=[];_0x278cd4[_0xf570('0x46')](function(_0x2bc615){_0x2831da[_0xf570('0x47')](checkTranscribeJob(_0x2bc615,_0x2cb5e3,_0x4ec02c));});return BPromise['all'](_0x2831da);})[_0xf570('0x39')](function(_0x4cfb59){if(_0x4cfb59){if(!_0x4cfb59['name']||_0x4cfb59[_0xf570('0x3a')]!=='SequelizeValidationError'){logger['error'](util[_0xf570('0x3e')](_0x4cfb59,{'showHidden':![],'depth':null}));}}});}exports[_0xf570('0x48')]=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 13e6929..a97bbd3 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 _0xdd03=['YYYY-MM-DD\x20HH:mm:ss','then','emit','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','timeout','format'];(function(_0x203451,_0x36cdd9){var _0x23dc34=function(_0x5d9008){while(--_0x5d9008){_0x203451['push'](_0x203451['shift']());}};_0x23dc34(++_0x36cdd9);}(_0xdd03,0x165));var _0x3dd0=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdd03[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x3dd0('0x0'));var util=require(_0x3dd0('0x1'));var config=require(_0x3dd0('0x2'));var db=require(_0x3dd0('0x3'))['db'];var logger=require('../logger')('schedule');config[_0x3dd0('0x4')]=_[_0x3dd0('0x5')](config[_0x3dd0('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x3dd0('0x6'))(new Redis(config[_0x3dd0('0x4')]));function closeInteractions(){var _0x2a5123=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x3dd0('0x7')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x3dd0('0x8')](0x18,_0x3dd0('0x9'))}}})['then'](function(_0x1d12b9){if(_0x1d12b9&&_0x1d12b9[_0x3dd0('0xa')]){_0x2a5123=_[_0x3dd0('0xb')](_0x1d12b9||[],'id');logger[_0x3dd0('0xc')](_0x3dd0('0xd'),_0x2a5123[_0x3dd0('0xe')]());return db['WhatsappInteraction'][_0x3dd0('0xf')]({'closeReason':'system','disposition':_0x3dd0('0x10'),'closed':!![],'closedAt':moment()[_0x3dd0('0x11')](_0x3dd0('0x12'))},{'where':{'id':_0x2a5123}});}})[_0x3dd0('0x13')](function(){if(_0x2a5123&&_0x2a5123[_0x3dd0('0xa')]){logger[_0x3dd0('0xc')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2a5123[_0x3dd0('0xe')]());for(var _0x40a435=0x0;_0x40a435<_0x2a5123[_0x3dd0('0xa')];_0x40a435++){io[_0x3dd0('0x14')]('whatsappInteraction:update',{'id':_0x2a5123[_0x40a435],'closed':!![]});}}})[_0x3dd0('0x15')](function(_0x42a889){logger['error'](_0x3dd0('0x16'),_0x42a889?util[_0x3dd0('0x17')](_0x42a889,{'showHidden':![],'depth':null}):'');});}exports[_0x3dd0('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf625=['error','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','whatsappInteraction:update','catch'];(function(_0xcfe8cc,_0xb83aeb){var _0x55ac53=function(_0x4067d4){while(--_0x4067d4){_0xcfe8cc['push'](_0xcfe8cc['shift']());}};_0x55ac53(++_0xb83aeb);}(_0xf625,0xac));var _0x5f62=function(_0x5b87ce,_0x20b7f6){_0x5b87ce=_0x5b87ce-0x0;var _0x597aa7=_0xf625[_0x5b87ce];return _0x597aa7;};'use strict';var _=require(_0x5f62('0x0'));var moment=require(_0x5f62('0x1'));var Redis=require(_0x5f62('0x2'));var util=require(_0x5f62('0x3'));var config=require(_0x5f62('0x4'));var db=require(_0x5f62('0x5'))['db'];var logger=require(_0x5f62('0x6'))(_0x5f62('0x7'));config[_0x5f62('0x8')]=_[_0x5f62('0x9')](config[_0x5f62('0x8')],{'host':_0x5f62('0xa'),'port':0x18eb});var io=require(_0x5f62('0xb'))(new Redis(config[_0x5f62('0x8')]));function closeInteractions(){var _0x3e0932=[];return db[_0x5f62('0xc')][_0x5f62('0xd')]({'raw':!![],'attributes':['id',_0x5f62('0xe')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x5f62('0xf')](0x18,_0x5f62('0x10'))}}})['then'](function(_0x13a231){if(_0x13a231&&_0x13a231[_0x5f62('0x11')]){_0x3e0932=_[_0x5f62('0x12')](_0x13a231||[],'id');logger[_0x5f62('0x13')](_0x5f62('0x14'),_0x3e0932['join']());return db['WhatsappInteraction'][_0x5f62('0x15')]({'closeReason':_0x5f62('0x16'),'disposition':_0x5f62('0x17'),'closed':!![],'closedAt':moment()[_0x5f62('0x18')](_0x5f62('0x19'))},{'where':{'id':_0x3e0932}});}})[_0x5f62('0x1a')](function(){if(_0x3e0932&&_0x3e0932[_0x5f62('0x11')]){logger[_0x5f62('0x13')](_0x5f62('0x1b'),_0x3e0932[_0x5f62('0x1c')]());for(var _0x2557d4=0x0;_0x2557d4<_0x3e0932[_0x5f62('0x11')];_0x2557d4++){io[_0x5f62('0x1d')](_0x5f62('0x1e'),{'id':_0x3e0932[_0x2557d4],'closed':!![]});}}})[_0x5f62('0x1f')](function(_0x3915d3){logger[_0x5f62('0x20')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x3915d3?util[_0x5f62('0x21')](_0x3915d3,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 042455c..1c02769 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326d=['finished\x20populating','contacts1','CmHopper','destroy','log','hopper1','hopper2','util','../mysqldb','push','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','bulkCreate'];(function(_0x9f2af9,_0x55141a){var _0x24aa62=function(_0x534fca){while(--_0x534fca){_0x9f2af9['push'](_0x9f2af9['shift']());}};_0x24aa62(++_0x55141a);}(_0x326d,0x1c9));var _0xd326=function(_0x5ca066,_0x43f9cf){_0x5ca066=_0x5ca066-0x0;var _0x501b91=_0x326d[_0x5ca066];return _0x501b91;};'use strict';var util=require(_0xd326('0x0'));var db=require(_0xd326('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xd326('0x2')]({'id':i,'firstName':_0xd326('0x3')+i,'lastName':_0xd326('0x4')+i,'phone':0xf879fb460+i,'email':_0xd326('0x5')+i+_0xd326('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xd326('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xd326('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xd326('0x2')]({'id':i,'firstName':_0xd326('0x3')+i,'lastName':_0xd326('0x4')+i,'phone':0xf879fb460+i,'email':_0xd326('0x5')+i+_0xd326('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd326('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xd326('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd326('0x7')](),'updatedAt':Date[_0xd326('0x7')]()});}db[_0xd326('0x8')]['destroy']({'where':{}})[_0xd326('0x9')](function(){return db['CmContact'][_0xd326('0xa')](contacts);})[_0xd326('0x9')](function(){console['log'](_0xd326('0xb'),_0xd326('0xc'));return db[_0xd326('0xd')][_0xd326('0xe')]({'where':{}});})[_0xd326('0x9')](function(){return db['CmHopper']['bulkCreate'](hopper);})[_0xd326('0x9')](function(){console[_0xd326('0xf')](_0xd326('0xb'),_0xd326('0x10'));return db[_0xd326('0x8')]['bulkCreate'](contacts2);})[_0xd326('0x9')](function(){console[_0xd326('0xf')](_0xd326('0xb'),'contacts2');return db[_0xd326('0xd')][_0xd326('0xa')](hopper2);})[_0xd326('0x9')](function(){console[_0xd326('0xf')](_0xd326('0xb'),_0xd326('0x11'));})['catch'](function(_0x524a44){console[_0xd326('0xf')](_0x524a44);}); \ No newline at end of file +var _0x49cf=['then','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy'];(function(_0x24c39b,_0x2fc9f9){var _0xb808a3=function(_0x2ffb7e){while(--_0x2ffb7e){_0x24c39b['push'](_0x24c39b['shift']());}};_0xb808a3(++_0x2fc9f9);}(_0x49cf,0x122));var _0xf49c=function(_0x2e3efc,_0x2b26c2){_0x2e3efc=_0x2e3efc-0x0;var _0x275be1=_0x49cf[_0x2e3efc];return _0x275be1;};'use strict';var util=require(_0xf49c('0x0'));var db=require(_0xf49c('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf49c('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xf49c('0x3')+i,'phone':0xf879fb460+i,'email':_0xf49c('0x4')+i+_0xf49c('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xf49c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf49c('0x6')](),'updatedAt':Date[_0xf49c('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xf49c('0x7')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xf49c('0x4')+i+_0xf49c('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xf49c('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf49c('0x6')](),'updatedAt':Date[_0xf49c('0x6')]()});}db[_0xf49c('0x8')][_0xf49c('0x9')]({'where':{}})[_0xf49c('0xa')](function(){return db[_0xf49c('0x8')][_0xf49c('0xb')](contacts);})['then'](function(){console[_0xf49c('0xc')]('finished\x20populating',_0xf49c('0xd'));return db[_0xf49c('0xe')][_0xf49c('0x9')]({'where':{}});})[_0xf49c('0xa')](function(){return db['CmHopper'][_0xf49c('0xb')](hopper);})[_0xf49c('0xa')](function(){console[_0xf49c('0xc')](_0xf49c('0xf'),_0xf49c('0x10'));return db[_0xf49c('0x8')]['bulkCreate'](contacts2);})[_0xf49c('0xa')](function(){console[_0xf49c('0xc')](_0xf49c('0xf'),_0xf49c('0x11'));return db[_0xf49c('0xe')][_0xf49c('0xb')](hopper2);})[_0xf49c('0xa')](function(){console['log']('finished\x20populating',_0xf49c('0x12'));})[_0xf49c('0x13')](function(_0x45eb6b){console['log'](_0x45eb6b);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 248ca44..c7dc2af 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37ee=['push','format','%s%s','agent','%s%s@xcally.com','friend','udp','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','add\x20user','catch','log','util','../mysqldb'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x37ee,0x11e));var _0xe37e=function(_0x12614a,_0x52be21){_0x12614a=_0x12614a-0x0;var _0x19bd97=_0x37ee[_0x12614a];return _0x19bd97;};'use strict';var util=require(_0xe37e('0x0'));var db=require(_0xe37e('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe37e('0x2')]({'name':util[_0xe37e('0x3')](_0xe37e('0x4'),_0xe37e('0x5'),i),'fullname':util[_0xe37e('0x3')](_0xe37e('0x4'),_0xe37e('0x5'),i),'email':util[_0xe37e('0x3')](_0xe37e('0x6'),'agent',i),'role':'agent','password':'password','internal':0xfa0+i,'type':_0xe37e('0x7'),'transport':[_0xe37e('0x8'),'ws','wss'],'disallow':[_0xe37e('0x9')],'allow':['ulaw'],'defaultuser':util[_0xe37e('0x3')]('%s%s',_0xe37e('0x5'),i),'encryption':'yes','avpf':_0xe37e('0xa'),'force_avp':'yes','icesupport':_0xe37e('0xa'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xe37e('0xb'),'dtlsprivatekey':_0xe37e('0xc'),'dtlssetup':'actpass','callerid':util[_0xe37e('0x3')](_0xe37e('0xd'),util[_0xe37e('0x3')](_0xe37e('0x4'),'agent',i),0xfa0+i)});}db[_0xe37e('0xe')]['bulkCreate'](users)['then'](function(){console['log'](_0xe37e('0xf'));})[_0xe37e('0x10')](function(_0x2be015){console[_0xe37e('0x11')](_0x2be015);}); \ No newline at end of file +var _0x90c7=['ulaw','yes','/etc/pki/tls/certs/motion.crt','\x22%s\x22\x20<%s>','bulkCreate','then','util','../mysqldb','push','format','agent','%s%s','%s%s@xcally.com','password','friend','wss','all'];(function(_0x12a1bd,_0x4f785f){var _0x2dfb25=function(_0x2a6f90){while(--_0x2a6f90){_0x12a1bd['push'](_0x12a1bd['shift']());}};_0x2dfb25(++_0x4f785f);}(_0x90c7,0x1c0));var _0x790c=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x90c7[_0x33032e];return _0x13316b;};'use strict';var util=require(_0x790c('0x0'));var db=require(_0x790c('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x790c('0x2')]({'name':util[_0x790c('0x3')]('%s%s',_0x790c('0x4'),i),'fullname':util[_0x790c('0x3')](_0x790c('0x5'),_0x790c('0x4'),i),'email':util[_0x790c('0x3')](_0x790c('0x6'),_0x790c('0x4'),i),'role':_0x790c('0x4'),'password':_0x790c('0x7'),'internal':0xfa0+i,'type':_0x790c('0x8'),'transport':['udp','ws',_0x790c('0x9')],'disallow':[_0x790c('0xa')],'allow':[_0x790c('0xb')],'defaultuser':util[_0x790c('0x3')](_0x790c('0x5'),_0x790c('0x4'),i),'encryption':'yes','avpf':_0x790c('0xc'),'force_avp':_0x790c('0xc'),'icesupport':_0x790c('0xc'),'dtlsenable':_0x790c('0xc'),'dtlsverify':'no','dtlscertfile':_0x790c('0xd'),'dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':'actpass','callerid':util['format'](_0x790c('0xe'),util[_0x790c('0x3')]('%s%s',_0x790c('0x4'),i),0xfa0+i)});}db['User'][_0x790c('0xf')](users)[_0x790c('0x10')](function(){console['log']('add\x20user');})['catch'](function(_0x21107e){console['log'](_0x21107e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 5551822..c188004 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fc9=['Telephones','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','voice','chat','fax','openchannel','whatsapp','telephone:%s','campaign:%s:%s','type','user:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','./environment','name','User','role','agent','telephone','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','Campaign','ivr','%s:queue:%s','Agents','length','format','handshake','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','SmsQueues'];(function(_0x266db5,_0x3c7113){var _0x5a33d7=function(_0x2f577b){while(--_0x2f577b){_0x266db5['push'](_0x266db5['shift']());}};_0x5a33d7(++_0x3c7113);}(_0x0fc9,0x15f));var _0x90fc=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0fc9[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x90fc('0x0'));var util=require(_0x90fc('0x1'));var BPromise=require(_0x90fc('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x90fc('0x3'));var queryQueues={'attributes':['id',_0x90fc('0x4')],'include':[{'as':'Agents','model':db[_0x90fc('0x5')],'attributes':['id',_0x90fc('0x4'),_0x90fc('0x6')],'raw':!![],'where':{'role':_0x90fc('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x90fc('0x4')],'where':{'role':_0x90fc('0x8')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x90fc('0x4')],'where':{'role':_0x90fc('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x90fc('0x4'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x5d9750,_0x323a60,_0x2ecf24){return db[_0x90fc('0x9')][_0x90fc('0xa')]({'where':{'name':_0x5d9750,'userProfileId':_0x323a60},'raw':!![]})[_0x90fc('0xb')](function(_0x1e9df3){if(_0x1e9df3){if(_0x1e9df3[_0x90fc('0xc')]){switch(_0x5d9750){case _0x90fc('0xd'):case _0x90fc('0xe'):case _0x90fc('0xf'):case'SmsQueues':case _0x90fc('0x10'):case _0x90fc('0x11'):case _0x90fc('0x12'):return db[_0x2ecf24][_0x90fc('0x13')](queryQueues);case'Telephones':return db[_0x2ecf24]['findAll'](queryTelephones);case _0x90fc('0x14'):return db[_0x2ecf24]['findAll'](queryTrunks);case _0x90fc('0x15'):return db[_0x2ecf24]['findAll'](queryCampaigns);}}else{return db[_0x90fc('0x16')][_0x90fc('0x13')]({'attributes':['resourceId'],'where':{'sectionId':_0x1e9df3['id']},'raw':!![]})[_0x90fc('0xb')](function(_0x4f3ad1){if(_0x4f3ad1){var _0x1d6e69={'where':{'id':_['map'](_0x4f3ad1,_0x90fc('0x17'))},'raw':!![]};switch(_0x2ecf24){case _0x90fc('0x5'):_0x1d6e69[_0x90fc('0x18')][_0x90fc('0x6')]=_0x90fc('0x8');break;case _0x90fc('0x19'):_0x1d6e69[_0x90fc('0x18')]['type']=_0x90fc('0x1a');break;}return db[_0x2ecf24][_0x90fc('0x13')](_0x1d6e69);}else{return[];}});}}else{return[];}})[_0x90fc('0xb')](function(_0x121ee6){return _0x121ee6;});}function joinOrLeaveQueues(_0x3f3d26,_0x1a3705,_0x44e26f,_0x37816a){_0x3f3d26[_0x1a3705](util['format'](_0x90fc('0x1b'),_0x44e26f,_0x37816a[_0x90fc('0x4')]));if(_0x37816a[_0x90fc('0x1c')]){for(var _0x4f90b8=0x0;_0x4f90b8<_0x37816a[_0x90fc('0x1c')][_0x90fc('0x1d')];_0x4f90b8+=0x1){_0x3f3d26[_0x1a3705](util[_0x90fc('0x1e')]('user:%s',_0x37816a['Agents'][_0x4f90b8][_0x90fc('0x4')]));}}}function joinOrLeave(_0x57a210,_0xdb22ba,_0xc840ae){var _0x1b62f5;if(_0x57a210[_0x90fc('0x1f')]['query']['id']){db[_0x90fc('0x5')][_0x90fc('0x20')]({'attributes':['id',_0x90fc('0x4'),_0x90fc('0x6'),_0x90fc('0x21')],'where':{'id':_0x57a210['handshake']['query']['id']},'include':[{'model':db[_0x90fc('0x22')],'as':_0x90fc('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x90fc('0x24')],'as':_0x90fc('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x90fc('0x26')],'as':_0x90fc('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x90fc('0x28')],'as':_0x90fc('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x90fc('0x2a')],'as':_0x90fc('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x90fc('0x2c')],'as':_0x90fc('0x2d'),'attributes':['id'],'raw':!![]}]})[_0x90fc('0xb')](function(_0x708607){if(_0x708607){_0x1b62f5=_0x708607;_0x57a210[_0xdb22ba](util['format']('user:%s',_0x708607[_0x90fc('0x4')]));var _0x288294=[];switch(_0x708607['role']){case _0x90fc('0x2e'):_0x57a210[_0xdb22ba](_0x90fc('0x2f'));_0x57a210[_0xdb22ba](_0x90fc('0x30'));if(queryQueues[_0x90fc('0x31')]('include')){delete queryQueues[_0x90fc('0x32')];}_0x288294[_0x90fc('0x33')](db[_0x90fc('0x34')][_0x90fc('0x13')](queryQueues));_0x288294[_0x90fc('0x33')](db[_0x90fc('0x35')][_0x90fc('0x13')](queryQueues));_0x288294[_0x90fc('0x33')](db[_0x90fc('0x36')][_0x90fc('0x13')](queryQueues));_0x288294[_0x90fc('0x33')](db[_0x90fc('0x37')][_0x90fc('0x13')](queryQueues));_0x288294[_0x90fc('0x33')](db[_0x90fc('0x38')][_0x90fc('0x13')](queryQueues));_0x288294[_0x90fc('0x33')](db[_0x90fc('0x39')][_0x90fc('0x13')](queryQueues));_0x288294[_0x90fc('0x33')](db[_0x90fc('0x3a')][_0x90fc('0x13')](queryQueues));_0x288294['push'](db['User']['findAll'](queryTelephones));_0x288294[_0x90fc('0x33')](db[_0x90fc('0x3b')]['findAll'](queryTrunks));_0x288294['push'](db['Campaign'][_0x90fc('0x13')](queryCampaigns));_0x288294[_0x90fc('0x33')](db[_0x90fc('0x5')][_0x90fc('0x13')](queryAgents));break;case'user':_0x57a210[_0xdb22ba](_0x90fc('0x2f'));_0x57a210[_0xdb22ba](_0x90fc('0x30'));_0x288294[_0x90fc('0x33')](getAssociatedResources(_0x90fc('0xd'),_0x708607[_0x90fc('0x21')],_0x90fc('0x34')));_0x288294[_0x90fc('0x33')](getAssociatedResources(_0x90fc('0xe'),_0x708607['userProfileId'],'ChatQueue'));_0x288294[_0x90fc('0x33')](getAssociatedResources(_0x90fc('0xf'),_0x708607[_0x90fc('0x21')],'FaxQueue'));_0x288294['push'](getAssociatedResources(_0x90fc('0x3c'),_0x708607[_0x90fc('0x21')],'SmsQueue'));_0x288294[_0x90fc('0x33')](getAssociatedResources('MailQueues',_0x708607['userProfileId'],_0x90fc('0x38')));_0x288294[_0x90fc('0x33')](getAssociatedResources('OpenchannelQueues',_0x708607[_0x90fc('0x21')],_0x90fc('0x39')));_0x288294[_0x90fc('0x33')](getAssociatedResources(_0x90fc('0x12'),_0x708607[_0x90fc('0x21')],_0x90fc('0x3a')));_0x288294[_0x90fc('0x33')](getAssociatedResources(_0x90fc('0x3d'),_0x708607[_0x90fc('0x21')],_0x90fc('0x5')));_0x288294[_0x90fc('0x33')](getAssociatedResources(_0x90fc('0x14'),_0x708607[_0x90fc('0x21')],'Trunk'));_0x288294[_0x90fc('0x33')](getAssociatedResources(_0x90fc('0x15'),_0x708607[_0x90fc('0x21')],_0x90fc('0x19')));_0x288294[_0x90fc('0x33')](db[_0x90fc('0x5')][_0x90fc('0x13')](queryAgents));break;case _0x90fc('0x7'):_0x57a210[_0xdb22ba](_0x90fc('0x2f'));_0x57a210[_0xdb22ba](_0x90fc('0x30'));_0x288294[_0x90fc('0x33')](_0x708607[_0x90fc('0x3e')]({'attributes':['id',_0x90fc('0x4')]}));_0x288294['push'](_0x708607[_0x90fc('0x3f')]({'attributes':['id',_0x90fc('0x4')]}));_0x288294[_0x90fc('0x33')](_0x708607[_0x90fc('0x40')]({'attributes':['id','name']}));_0x288294[_0x90fc('0x33')](_0x708607[_0x90fc('0x41')]({'attributes':['id',_0x90fc('0x4')]}));_0x288294[_0x90fc('0x33')](_0x708607[_0x90fc('0x42')]({'attributes':['id',_0x90fc('0x4')]}));_0x288294[_0x90fc('0x33')](_0x708607[_0x90fc('0x43')]({'attributes':['id',_0x90fc('0x4')]}));_0x288294[_0x90fc('0x33')](_0x708607['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x90fc('0x44')](_0x288294);}})['then'](function(_0x233460){if(_0x233460&&_0x233460[_0x90fc('0x1d')]){for(var _0x505f58=0x0;_0x505f58<_0x233460['length'];_0x505f58+=0x1){for(var _0x39eb0e=0x0;_0x39eb0e<_0x233460[_0x505f58][_0x90fc('0x1d')];_0x39eb0e+=0x1){switch(_0x505f58){case 0x0:joinOrLeaveQueues(_0x57a210,_0xdb22ba,_0x90fc('0x45'),_0x233460[_0x505f58][_0x39eb0e]);break;case 0x1:joinOrLeaveQueues(_0x57a210,_0xdb22ba,_0x90fc('0x46'),_0x233460[_0x505f58][_0x39eb0e]);break;case 0x2:joinOrLeaveQueues(_0x57a210,_0xdb22ba,_0x90fc('0x47'),_0x233460[_0x505f58][_0x39eb0e]);break;case 0x3:joinOrLeaveQueues(_0x57a210,_0xdb22ba,'sms',_0x233460[_0x505f58][_0x39eb0e]);break;case 0x4:joinOrLeaveQueues(_0x57a210,_0xdb22ba,'mail',_0x233460[_0x505f58][_0x39eb0e]);break;case 0x5:joinOrLeaveQueues(_0x57a210,_0xdb22ba,_0x90fc('0x48'),_0x233460[_0x505f58][_0x39eb0e]);break;case 0x6:joinOrLeaveQueues(_0x57a210,_0xdb22ba,_0x90fc('0x49'),_0x233460[_0x505f58][_0x39eb0e]);break;case 0x7:if(_0x1b62f5['role']!=='agent')_0x57a210[_0xdb22ba](util['format'](_0x90fc('0x4a'),_0x233460[_0x505f58][_0x39eb0e][_0x90fc('0x4')]));break;case 0x8:if(_0x1b62f5['role']!=='agent')_0x57a210[_0xdb22ba](util[_0x90fc('0x1e')]('trunk:%s',_0x233460[_0x505f58][_0x39eb0e][_0x90fc('0x4')]));break;case 0x9:if(_0x1b62f5['role']!=='agent')_0x57a210[_0xdb22ba](util[_0x90fc('0x1e')](_0x90fc('0x4b'),_0x233460[_0x505f58][_0x39eb0e][_0x90fc('0x4c')],_0x233460[_0x505f58][_0x39eb0e][_0x90fc('0x4')]));break;case 0xa:_0x57a210[_0xdb22ba](util[_0x90fc('0x1e')](_0x90fc('0x4d'),_0x233460[_0x505f58][_0x39eb0e][_0x90fc('0x4')]));break;}}}}})[_0x90fc('0xb')](function(){if(_0xdb22ba===_0x90fc('0x4e')){var _0x45a485=_[_0x90fc('0x4f')](_0x1b62f5[_0x90fc('0x23')],'id');return _0x1b62f5[_0x90fc('0x50')](_0x45a485)[_0x90fc('0xb')](function(){for(var _0x467545=0x0;_0x467545<_0x45a485['length'];_0x467545+=0x1){_0xc840ae[_0x90fc('0x51')](_0x90fc('0x52'),{'ChatInteractionId':Number(_0x45a485[_0x467545]),'UserId':Number(_0x1b62f5['id'])});}});}})[_0x90fc('0xb')](function(){if(_0xdb22ba===_0x90fc('0x4e')){var _0x458242=_[_0x90fc('0x4f')](_0x1b62f5['MailInteractions'],'id');return _0x1b62f5['removeMailInteractions'](_0x458242)['then'](function(){for(var _0x5a3ae7=0x0;_0x5a3ae7<_0x458242[_0x90fc('0x1d')];_0x5a3ae7+=0x1){_0xc840ae[_0x90fc('0x51')](_0x90fc('0x53'),{'MailInteractionId':Number(_0x458242[_0x5a3ae7]),'UserId':Number(_0x1b62f5['id'])});}});}})[_0x90fc('0xb')](function(){if(_0xdb22ba===_0x90fc('0x4e')){var _0x5bf9b1=_[_0x90fc('0x4f')](_0x1b62f5[_0x90fc('0x27')],'id');return _0x1b62f5[_0x90fc('0x54')](_0x5bf9b1)[_0x90fc('0xb')](function(){for(var _0xb97275=0x0;_0xb97275<_0x5bf9b1['length'];_0xb97275+=0x1){_0xc840ae[_0x90fc('0x51')](_0x90fc('0x55'),{'FaxInteractionId':Number(_0x5bf9b1[_0xb97275]),'UserId':Number(_0x1b62f5['id'])});}});}})[_0x90fc('0xb')](function(){if(_0xdb22ba==='leave'){var _0x120ed1=_[_0x90fc('0x4f')](_0x1b62f5['SmsInteractions'],'id');return _0x1b62f5[_0x90fc('0x56')](_0x120ed1)[_0x90fc('0xb')](function(){for(var _0x478c3a=0x0;_0x478c3a<_0x120ed1[_0x90fc('0x1d')];_0x478c3a+=0x1){_0xc840ae[_0x90fc('0x51')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x120ed1[_0x478c3a]),'UserId':Number(_0x1b62f5['id'])});}});}})[_0x90fc('0xb')](function(){if(_0xdb22ba===_0x90fc('0x4e')){var _0x1e4803=_[_0x90fc('0x4f')](_0x1b62f5['OpenchannelInteractions'],'id');return _0x1b62f5[_0x90fc('0x57')](_0x1e4803)['then'](function(){for(var _0x41c9c0=0x0;_0x41c9c0<_0x1e4803[_0x90fc('0x1d')];_0x41c9c0+=0x1){_0xc840ae['emit'](_0x90fc('0x58'),{'OpenchannelInteractionId':Number(_0x1e4803[_0x41c9c0]),'UserId':Number(_0x1b62f5['id'])});}});}})['then'](function(){if(_0xdb22ba===_0x90fc('0x4e')){var _0x3eea47=_[_0x90fc('0x4f')](_0x1b62f5[_0x90fc('0x2d')],'id');return _0x1b62f5['removeWhatsappInteractions'](_0x3eea47)[_0x90fc('0xb')](function(){for(var _0x27d885=0x0;_0x27d885<_0x3eea47[_0x90fc('0x1d')];_0x27d885+=0x1){_0xc840ae['emit'](_0x90fc('0x59'),{'WhatsappInteractionId':Number(_0x3eea47[_0x27d885]),'UserId':Number(_0x1b62f5['id'])});}});}})[_0x90fc('0x5a')](function(_0x525edf){_0x57a210[_0x90fc('0x5b')](_0x525edf);});}}function onDisconnect(_0x512a2e,_0x2cf2f9){joinOrLeave(_0x512a2e,_0x90fc('0x4e'),_0x2cf2f9);}function onConnect(_0x30be98){joinOrLeave(_0x30be98,_0x90fc('0x5c'));}exports[_0x90fc('0x5d')]=function(_0x16b703){_0x16b703['on'](_0x90fc('0x5e'),function(_0x501a4){_0x501a4[_0x90fc('0x5f')](0x0);_0x501a4[_0x90fc('0x60')]=_0x501a4['request']['connection']['remoteAddress']+':'+_0x501a4['request'][_0x90fc('0x5e')][_0x90fc('0x61')];_0x501a4[_0x90fc('0x62')]=new Date();_0x501a4['log']=function(_0x2666a6){console[_0x90fc('0x5b')]('SocketIO\x20'+_0x501a4[_0x90fc('0x63')][_0x90fc('0x4')]+'['+_0x501a4[_0x90fc('0x60')]+']',_0x2666a6);};_0x501a4['on'](_0x90fc('0x64'),function(){onDisconnect(_0x501a4,_0x16b703);_0x501a4['log'](_0x90fc('0x65'));});onConnect(_0x501a4);_0x501a4[_0x90fc('0x5b')](_0x90fc('0x66'));});}; \ No newline at end of file +var _0x3f35=['getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','emit','user_has_chat_interactions:remove','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','address','request','remoteAddress','SocketIO\x20','nsp','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','agent','telephone','type','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','MailQueues','findAll','Trunks','UserProfileResource','resourceId','map','User','role','Campaign','ivr','format','%s:queue:%s','user:%s','handshake','query','find','ChatInteractions','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','voice:inbound','include','ChatQueue','push','FaxQueue','MailQueue','OpenchannelQueue','Trunk','voice:outbound','userProfileId','SmsQueues','SmsQueue','WhatsappQueues','WhatsappQueue','Telephones','IvrCampaigns'];(function(_0x25655c,_0x4817b3){var _0x4907b1=function(_0x27e7b4){while(--_0x27e7b4){_0x25655c['push'](_0x25655c['shift']());}};_0x4907b1(++_0x4817b3);}(_0x3f35,0x1ae));var _0x53f3=function(_0x2bc3f4,_0x470b26){_0x2bc3f4=_0x2bc3f4-0x0;var _0x14ac53=_0x3f35[_0x2bc3f4];return _0x14ac53;};'use strict';var _=require(_0x53f3('0x0'));var util=require(_0x53f3('0x1'));var BPromise=require(_0x53f3('0x2'));var db=require(_0x53f3('0x3'))['db'];var config=require(_0x53f3('0x4'));var queryQueues={'attributes':['id',_0x53f3('0x5')],'include':[{'as':_0x53f3('0x6'),'model':db['User'],'attributes':['id',_0x53f3('0x5'),'role'],'raw':!![],'where':{'role':_0x53f3('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x53f3('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x53f3('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x53f3('0x5')],'where':{'role':_0x53f3('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x53f3('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x4f4671,_0x4f4d45,_0x10a75b){return db[_0x53f3('0xa')][_0x53f3('0xb')]({'where':{'name':_0x4f4671,'userProfileId':_0x4f4d45},'raw':!![]})[_0x53f3('0xc')](function(_0x5ed51a){if(_0x5ed51a){if(_0x5ed51a['autoAssociation']){switch(_0x4f4671){case _0x53f3('0xd'):case _0x53f3('0xe'):case'FaxQueues':case'SmsQueues':case _0x53f3('0xf'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x10a75b][_0x53f3('0x10')](queryQueues);case'Telephones':return db[_0x10a75b]['findAll'](queryTelephones);case _0x53f3('0x11'):return db[_0x10a75b][_0x53f3('0x10')](queryTrunks);case'IvrCampaigns':return db[_0x10a75b]['findAll'](queryCampaigns);}}else{return db[_0x53f3('0x12')]['findAll']({'attributes':[_0x53f3('0x13')],'where':{'sectionId':_0x5ed51a['id']},'raw':!![]})[_0x53f3('0xc')](function(_0x27db9a){if(_0x27db9a){var _0x2319cd={'where':{'id':_[_0x53f3('0x14')](_0x27db9a,_0x53f3('0x13'))},'raw':!![]};switch(_0x10a75b){case _0x53f3('0x15'):_0x2319cd['where'][_0x53f3('0x16')]=_0x53f3('0x8');break;case _0x53f3('0x17'):_0x2319cd['where']['type']=_0x53f3('0x18');break;}return db[_0x10a75b]['findAll'](_0x2319cd);}else{return[];}});}}else{return[];}})[_0x53f3('0xc')](function(_0x276e0c){return _0x276e0c;});}function joinOrLeaveQueues(_0x58c850,_0x317d06,_0x40b26c,_0x5a4ebe){_0x58c850[_0x317d06](util[_0x53f3('0x19')](_0x53f3('0x1a'),_0x40b26c,_0x5a4ebe[_0x53f3('0x5')]));if(_0x5a4ebe[_0x53f3('0x6')]){for(var _0x36e191=0x0;_0x36e191<_0x5a4ebe[_0x53f3('0x6')]['length'];_0x36e191+=0x1){_0x58c850[_0x317d06](util[_0x53f3('0x19')](_0x53f3('0x1b'),_0x5a4ebe[_0x53f3('0x6')][_0x36e191][_0x53f3('0x5')]));}}}function joinOrLeave(_0x3dd4cb,_0x5055ce,_0x1ab104){var _0x41be9b;if(_0x3dd4cb[_0x53f3('0x1c')][_0x53f3('0x1d')]['id']){db[_0x53f3('0x15')][_0x53f3('0x1e')]({'attributes':['id','name',_0x53f3('0x16'),'userProfileId'],'where':{'id':_0x3dd4cb['handshake'][_0x53f3('0x1d')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x53f3('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x53f3('0x20')],'as':_0x53f3('0x21'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x53f3('0x22')],'as':_0x53f3('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x53f3('0x24')],'as':_0x53f3('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x53f3('0x26')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x53f3('0xc')](function(_0x1ccd36){if(_0x1ccd36){_0x41be9b=_0x1ccd36;_0x3dd4cb[_0x5055ce](util[_0x53f3('0x19')](_0x53f3('0x1b'),_0x1ccd36['name']));var _0xdaa8f0=[];switch(_0x1ccd36[_0x53f3('0x16')]){case'admin':_0x3dd4cb[_0x5055ce](_0x53f3('0x27'));_0x3dd4cb[_0x5055ce]('voice:outbound');if(queryQueues['hasOwnProperty'](_0x53f3('0x28'))){delete queryQueues[_0x53f3('0x28')];}_0xdaa8f0['push'](db['VoiceQueue'][_0x53f3('0x10')](queryQueues));_0xdaa8f0['push'](db[_0x53f3('0x29')][_0x53f3('0x10')](queryQueues));_0xdaa8f0[_0x53f3('0x2a')](db[_0x53f3('0x2b')][_0x53f3('0x10')](queryQueues));_0xdaa8f0[_0x53f3('0x2a')](db['SmsQueue']['findAll'](queryQueues));_0xdaa8f0['push'](db[_0x53f3('0x2c')][_0x53f3('0x10')](queryQueues));_0xdaa8f0[_0x53f3('0x2a')](db[_0x53f3('0x2d')]['findAll'](queryQueues));_0xdaa8f0[_0x53f3('0x2a')](db['WhatsappQueue'][_0x53f3('0x10')](queryQueues));_0xdaa8f0[_0x53f3('0x2a')](db[_0x53f3('0x15')][_0x53f3('0x10')](queryTelephones));_0xdaa8f0['push'](db[_0x53f3('0x2e')]['findAll'](queryTrunks));_0xdaa8f0[_0x53f3('0x2a')](db['Campaign']['findAll'](queryCampaigns));_0xdaa8f0['push'](db[_0x53f3('0x15')][_0x53f3('0x10')](queryAgents));break;case'user':_0x3dd4cb[_0x5055ce]('voice:inbound');_0x3dd4cb[_0x5055ce](_0x53f3('0x2f'));_0xdaa8f0['push'](getAssociatedResources(_0x53f3('0xd'),_0x1ccd36['userProfileId'],'VoiceQueue'));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources('ChatQueues',_0x1ccd36[_0x53f3('0x30')],_0x53f3('0x29')));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources('FaxQueues',_0x1ccd36[_0x53f3('0x30')],_0x53f3('0x2b')));_0xdaa8f0['push'](getAssociatedResources(_0x53f3('0x31'),_0x1ccd36['userProfileId'],_0x53f3('0x32')));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources(_0x53f3('0xf'),_0x1ccd36[_0x53f3('0x30')],_0x53f3('0x2c')));_0xdaa8f0['push'](getAssociatedResources('OpenchannelQueues',_0x1ccd36[_0x53f3('0x30')],'OpenchannelQueue'));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources(_0x53f3('0x33'),_0x1ccd36['userProfileId'],_0x53f3('0x34')));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources(_0x53f3('0x35'),_0x1ccd36[_0x53f3('0x30')],_0x53f3('0x15')));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources(_0x53f3('0x11'),_0x1ccd36['userProfileId'],_0x53f3('0x2e')));_0xdaa8f0[_0x53f3('0x2a')](getAssociatedResources(_0x53f3('0x36'),_0x1ccd36[_0x53f3('0x30')],_0x53f3('0x17')));_0xdaa8f0['push'](db[_0x53f3('0x15')][_0x53f3('0x10')](queryAgents));break;case _0x53f3('0x7'):_0x3dd4cb[_0x5055ce]('voice:inbound');_0x3dd4cb[_0x5055ce]('voice:outbound');_0xdaa8f0[_0x53f3('0x2a')](_0x1ccd36[_0x53f3('0x37')]({'attributes':['id','name']}));_0xdaa8f0['push'](_0x1ccd36[_0x53f3('0x38')]({'attributes':['id','name']}));_0xdaa8f0[_0x53f3('0x2a')](_0x1ccd36[_0x53f3('0x39')]({'attributes':['id',_0x53f3('0x5')]}));_0xdaa8f0[_0x53f3('0x2a')](_0x1ccd36[_0x53f3('0x3a')]({'attributes':['id',_0x53f3('0x5')]}));_0xdaa8f0[_0x53f3('0x2a')](_0x1ccd36[_0x53f3('0x3b')]({'attributes':['id',_0x53f3('0x5')]}));_0xdaa8f0[_0x53f3('0x2a')](_0x1ccd36['getOpenchannelQueues']({'attributes':['id',_0x53f3('0x5')]}));_0xdaa8f0[_0x53f3('0x2a')](_0x1ccd36[_0x53f3('0x3c')]({'attributes':['id',_0x53f3('0x5')]}));break;}return BPromise[_0x53f3('0x3d')](_0xdaa8f0);}})[_0x53f3('0xc')](function(_0x5e12aa){if(_0x5e12aa&&_0x5e12aa['length']){for(var _0x5cff13=0x0;_0x5cff13<_0x5e12aa['length'];_0x5cff13+=0x1){for(var _0xce0421=0x0;_0xce0421<_0x5e12aa[_0x5cff13][_0x53f3('0x3e')];_0xce0421+=0x1){switch(_0x5cff13){case 0x0:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x3f'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x1:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x40'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x2:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x41'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x3:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x42'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x4:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x43'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x5:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x44'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x6:joinOrLeaveQueues(_0x3dd4cb,_0x5055ce,_0x53f3('0x45'),_0x5e12aa[_0x5cff13][_0xce0421]);break;case 0x7:if(_0x41be9b[_0x53f3('0x16')]!==_0x53f3('0x7'))_0x3dd4cb[_0x5055ce](util['format']('telephone:%s',_0x5e12aa[_0x5cff13][_0xce0421][_0x53f3('0x5')]));break;case 0x8:if(_0x41be9b[_0x53f3('0x16')]!==_0x53f3('0x7'))_0x3dd4cb[_0x5055ce](util[_0x53f3('0x19')](_0x53f3('0x46'),_0x5e12aa[_0x5cff13][_0xce0421][_0x53f3('0x5')]));break;case 0x9:if(_0x41be9b[_0x53f3('0x16')]!==_0x53f3('0x7'))_0x3dd4cb[_0x5055ce](util[_0x53f3('0x19')](_0x53f3('0x47'),_0x5e12aa[_0x5cff13][_0xce0421][_0x53f3('0x9')],_0x5e12aa[_0x5cff13][_0xce0421][_0x53f3('0x5')]));break;case 0xa:_0x3dd4cb[_0x5055ce](util['format'](_0x53f3('0x1b'),_0x5e12aa[_0x5cff13][_0xce0421][_0x53f3('0x5')]));break;}}}}})[_0x53f3('0xc')](function(){if(_0x5055ce==='leave'){var _0xfc6fa2=_[_0x53f3('0x14')](_0x41be9b[_0x53f3('0x1f')],'id');return _0x41be9b['removeChatInteractions'](_0xfc6fa2)[_0x53f3('0xc')](function(){for(var _0x15f728=0x0;_0x15f728<_0xfc6fa2[_0x53f3('0x3e')];_0x15f728+=0x1){_0x1ab104[_0x53f3('0x48')](_0x53f3('0x49'),{'ChatInteractionId':Number(_0xfc6fa2[_0x15f728]),'UserId':Number(_0x41be9b['id'])});}});}})['then'](function(){if(_0x5055ce===_0x53f3('0x4a')){var _0x492a17=_[_0x53f3('0x14')](_0x41be9b[_0x53f3('0x21')],'id');return _0x41be9b[_0x53f3('0x4b')](_0x492a17)[_0x53f3('0xc')](function(){for(var _0x28427d=0x0;_0x28427d<_0x492a17['length'];_0x28427d+=0x1){_0x1ab104[_0x53f3('0x48')](_0x53f3('0x4c'),{'MailInteractionId':Number(_0x492a17[_0x28427d]),'UserId':Number(_0x41be9b['id'])});}});}})['then'](function(){if(_0x5055ce===_0x53f3('0x4a')){var _0x4112bd=_['map'](_0x41be9b[_0x53f3('0x4d')],'id');return _0x41be9b[_0x53f3('0x4e')](_0x4112bd)[_0x53f3('0xc')](function(){for(var _0x1ff394=0x0;_0x1ff394<_0x4112bd[_0x53f3('0x3e')];_0x1ff394+=0x1){_0x1ab104[_0x53f3('0x48')](_0x53f3('0x4f'),{'FaxInteractionId':Number(_0x4112bd[_0x1ff394]),'UserId':Number(_0x41be9b['id'])});}});}})[_0x53f3('0xc')](function(){if(_0x5055ce==='leave'){var _0x7f773e=_[_0x53f3('0x14')](_0x41be9b[_0x53f3('0x23')],'id');return _0x41be9b[_0x53f3('0x50')](_0x7f773e)[_0x53f3('0xc')](function(){for(var _0x187e56=0x0;_0x187e56<_0x7f773e[_0x53f3('0x3e')];_0x187e56+=0x1){_0x1ab104[_0x53f3('0x48')](_0x53f3('0x51'),{'SmsInteractionId':Number(_0x7f773e[_0x187e56]),'UserId':Number(_0x41be9b['id'])});}});}})[_0x53f3('0xc')](function(){if(_0x5055ce===_0x53f3('0x4a')){var _0xe691f3=_[_0x53f3('0x14')](_0x41be9b[_0x53f3('0x25')],'id');return _0x41be9b[_0x53f3('0x52')](_0xe691f3)[_0x53f3('0xc')](function(){for(var _0x23c362=0x0;_0x23c362<_0xe691f3[_0x53f3('0x3e')];_0x23c362+=0x1){_0x1ab104['emit'](_0x53f3('0x53'),{'OpenchannelInteractionId':Number(_0xe691f3[_0x23c362]),'UserId':Number(_0x41be9b['id'])});}});}})[_0x53f3('0xc')](function(){if(_0x5055ce===_0x53f3('0x4a')){var _0x406dba=_[_0x53f3('0x14')](_0x41be9b[_0x53f3('0x54')],'id');return _0x41be9b[_0x53f3('0x55')](_0x406dba)['then'](function(){for(var _0x22d7f6=0x0;_0x22d7f6<_0x406dba[_0x53f3('0x3e')];_0x22d7f6+=0x1){_0x1ab104['emit'](_0x53f3('0x56'),{'WhatsappInteractionId':Number(_0x406dba[_0x22d7f6]),'UserId':Number(_0x41be9b['id'])});}});}})[_0x53f3('0x57')](function(_0x14909d){_0x3dd4cb[_0x53f3('0x58')](_0x14909d);});}}function onDisconnect(_0x3feb9,_0x26a3f0){joinOrLeave(_0x3feb9,_0x53f3('0x4a'),_0x26a3f0);}function onConnect(_0x532648){joinOrLeave(_0x532648,_0x53f3('0x59'));}exports['default']=function(_0x1802cd){_0x1802cd['on'](_0x53f3('0x5a'),function(_0x32de53){_0x32de53['setMaxListeners'](0x0);_0x32de53[_0x53f3('0x5b')]=_0x32de53[_0x53f3('0x5c')]['connection'][_0x53f3('0x5d')]+':'+_0x32de53[_0x53f3('0x5c')][_0x53f3('0x5a')]['remotePort'];_0x32de53['connectedAt']=new Date();_0x32de53[_0x53f3('0x58')]=function(_0x2e0b07){console[_0x53f3('0x58')](_0x53f3('0x5e')+_0x32de53[_0x53f3('0x5f')][_0x53f3('0x5')]+'['+_0x32de53[_0x53f3('0x5b')]+']',_0x2e0b07);};_0x32de53['on']('disconnect',function(){onDisconnect(_0x32de53,_0x1802cd);_0x32de53['log'](_0x53f3('0x60'));});onConnect(_0x32de53);_0x32de53[_0x53f3('0x58')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 7cf4288..90aa01d 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 _0x2be9=['agent','incomingmessage','outgoingmessage','sequelize','query','closed','fullname','SIP/%s','default','length','hasOwnProperty','model','hook','toLowerCase','condition','util','../../mysqldb','lodash','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','SmsInteraction','Sms','newmessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','Trigger,\x20%s','catch','get','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','UserId','User','find','name','email','internal','interface','format','channel'];(function(_0x492535,_0x46524a){var _0x256620=function(_0x3015f8){while(--_0x3015f8){_0x492535['push'](_0x492535['shift']());}};_0x256620(++_0x46524a);}(_0x2be9,0x19b));var _0x92be=function(_0x47d6c8,_0x4195c5){_0x47d6c8=_0x47d6c8-0x0;var _0x42e495=_0x2be9[_0x47d6c8];return _0x42e495;};'use strict';var util=require(_0x92be('0x0'));var db=require(_0x92be('0x1'))['db'];var jayson=require('jayson/promise');var logger=require('../logger')('triggers');var _=require(_0x92be('0x2'));var client=jayson[_0x92be('0x3')][_0x92be('0x4')]({'port':0x232a});var triggers=[{'channel':_0x92be('0x5'),'model':_0x92be('0x6'),'event':_0x92be('0x7'),'condition':_0x92be('0x8'),'callback':afterCreate},{'channel':_0x92be('0x5'),'model':_0x92be('0x6'),'event':_0x92be('0x9'),'condition':_0x92be('0xa'),'callback':afterUpdate},{'channel':_0x92be('0x5'),'model':'ChatMessage','event':_0x92be('0x7'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Sms','model':_0x92be('0xb'),'event':_0x92be('0x7'),'condition':_0x92be('0x8'),'callback':afterCreate},{'channel':_0x92be('0xc'),'model':_0x92be('0xb'),'event':_0x92be('0x9'),'condition':_0x92be('0xa'),'callback':afterUpdate},{'channel':_0x92be('0xc'),'model':'SmsMessage','event':'afterCreate','condition':_0x92be('0xd'),'callback':afterCreateMessage},{'channel':_0x92be('0xe'),'model':_0x92be('0xf'),'event':_0x92be('0x7'),'condition':_0x92be('0x8'),'callback':afterCreate},{'channel':_0x92be('0xe'),'model':'WhatsappInteraction','event':_0x92be('0x9'),'condition':_0x92be('0xa'),'callback':afterUpdate},{'channel':_0x92be('0xe'),'model':_0x92be('0x10'),'event':_0x92be('0x7'),'condition':_0x92be('0xd'),'callback':afterCreateMessage},{'channel':_0x92be('0x11'),'model':_0x92be('0x12'),'event':_0x92be('0x7'),'condition':_0x92be('0x8'),'callback':afterCreate},{'channel':_0x92be('0x11'),'model':_0x92be('0x12'),'event':_0x92be('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Fax','model':_0x92be('0x13'),'event':'afterCreate','condition':_0x92be('0xd'),'callback':afterCreateMessage},{'channel':'Mail','model':_0x92be('0x14'),'event':'afterCreate','condition':_0x92be('0x8'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0x92be('0x15'),'model':'MailMessage','event':_0x92be('0x7'),'condition':_0x92be('0xd'),'callback':afterCreateMessage},{'channel':_0x92be('0x16'),'model':_0x92be('0x17'),'event':_0x92be('0x7'),'condition':_0x92be('0x8'),'callback':afterCreate},{'channel':_0x92be('0x16'),'model':_0x92be('0x17'),'event':_0x92be('0x9'),'condition':_0x92be('0xa'),'callback':afterUpdate},{'channel':_0x92be('0x16'),'model':_0x92be('0x18'),'event':_0x92be('0x7'),'condition':_0x92be('0xd'),'callback':afterCreateMessage}];function request(_0x45eec0){return client[_0x92be('0x19')](_0x92be('0x1a'),_0x45eec0)[_0x92be('0x1b')](function(_0x3bf85c){logger[_0x92be('0x1c')]('Trigger,\x20%s',_0x92be('0x1a'),_0x3bf85c);if(_0x3bf85c['error']){if(_0x3bf85c[_0x92be('0x1d')][_0x92be('0x1e')]===0x1f4){logger[_0x92be('0x1d')](_0x92be('0x1f'),_0x92be('0x1a'),_0x3bf85c[_0x92be('0x1d')]);}}})[_0x92be('0x20')](function(_0x578447){logger['error'](_0x92be('0x1f'),_0x92be('0x1a'),_0x578447);});}function afterCreateMessage(_0x4b70e6,_0x64172f){return function(_0x12c6f4,_0xb140a0){_0x12c6f4=_0x12c6f4[_0x92be('0x21')]({'plain':!![]});_0x12c6f4['channel']=_0x4b70e6;_0x12c6f4[_0x92be('0x22')]=_0x12c6f4[_0x92be('0x23')];var _0x1d7104=_0x92be('0x24')+_0x12c6f4[_0x92be('0x25')];return db['sequelize']['query'](_0x1d7104,{'type':db[_0x92be('0x26')][_0x92be('0x27')][_0x92be('0x28')],'raw':!![]})[_0x92be('0x1b')](function(_0x4c0b72){return _0x4c0b72;})[_0x92be('0x1b')](function(_0xeb1b17){if(_0xeb1b17){_0x12c6f4[_0x92be('0x29')]=_0xeb1b17[0x0];}if(_0x12c6f4[_0x92be('0x2a')]){return db[_0x92be('0x2b')][_0x92be('0x2c')]({'where':{'id':_0x12c6f4['UserId']},'attributes':['id',_0x92be('0x2d'),'fullname',_0x92be('0x2e'),_0x92be('0x2f')],'raw':!![]})[_0x92be('0x1b')](function(_0x55d99d){_0x12c6f4[_0x92be('0x30')]=util[_0x92be('0x31')]('SIP/%s',_0x55d99d[_0x92be('0x2d')]);_0x12c6f4[_0x92be('0x32')]=_0x4b70e6;_0x12c6f4[_0x92be('0x33')]=_0x55d99d;return request({'event':_0x92be('0x34'),'message':_0x12c6f4});})[_0x92be('0x20')](function(_0x524341){console['error'](_0x524341);});}else{return request({'event':_0x92be('0x35'),'message':_0x12c6f4});}});};}function afterCreate(_0x4f7760,_0x494298){return function(_0x2633b9,_0x11a181){_0x2633b9=_0x2633b9[_0x92be('0x21')]({'plain':!![]});_0x2633b9[_0x92be('0x32')]=_0x4f7760;_0x2633b9['event']='opened';var _0x279847=_0x92be('0x24')+_0x2633b9['ContactId'];return db[_0x92be('0x36')][_0x92be('0x37')](_0x279847,{'type':db['Sequelize'][_0x92be('0x27')][_0x92be('0x28')],'raw':!![]})[_0x92be('0x1b')](function(_0x15de7e){return _0x15de7e;})['then'](function(_0x1743fd){if(_0x1743fd){_0x2633b9['contact']=_0x1743fd[0x0];}return request({'event':_0x494298,'message':_0x2633b9});});};}function afterUpdate(_0x5c496a,_0x16fb64){return function(_0x1ed2a9,_0x3dec42){if(_0x1ed2a9['changed'](_0x92be('0x38'))&&_0x1ed2a9[_0x92be('0x38')]){_0x1ed2a9=_0x1ed2a9[_0x92be('0x21')]({'plain':!![]});_0x1ed2a9[_0x92be('0x32')]=_0x5c496a;_0x1ed2a9['event']='closed';var _0x815e7f=_0x92be('0x24')+_0x1ed2a9[_0x92be('0x25')];return db[_0x92be('0x36')][_0x92be('0x37')](_0x815e7f,{'type':db[_0x92be('0x26')][_0x92be('0x27')][_0x92be('0x28')],'raw':!![]})[_0x92be('0x1b')](function(_0x672a41){return _0x672a41;})[_0x92be('0x1b')](function(_0x153985){if(_0x153985){_0x1ed2a9['contact']=_0x153985[0x0];}if(_0x1ed2a9['UserId']){return db[_0x92be('0x2b')][_0x92be('0x2c')]({'where':{'id':_0x1ed2a9[_0x92be('0x2a')]},'attributes':['id','name',_0x92be('0x39'),_0x92be('0x2e'),_0x92be('0x2f')],'raw':!![]})[_0x92be('0x1b')](function(_0x1325e7){_0x1ed2a9[_0x92be('0x30')]=util[_0x92be('0x31')](_0x92be('0x3a'),_0x1325e7[_0x92be('0x2d')]);_0x1ed2a9[_0x92be('0x33')]=_0x1325e7;return request({'event':_0x16fb64,'message':_0x1ed2a9});})[_0x92be('0x20')](function(_0xc30fad){console[_0x92be('0x1d')](_0xc30fad);});}else{return request({'event':_0x16fb64,'message':_0x1ed2a9});}});}};}exports[_0x92be('0x3b')]=function(){for(var _0x4f319c=0x0;_0x4f319c=_0x546a48[_0xb8a7('0x14')]){throw Error(_0xb8a7('0x15'));}_0x4fb2dd(_0x42dc33);})['catch'](function(_0x4eea62){_0x2acf73(_0x4eea62);});});}; \ No newline at end of file +var _0xaf99=['updateAttributes','getLicense','agent','count','then','catch','lodash','../mysqldb','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','isUndefined','blockedAt'];(function(_0x2f5595,_0x317ad9){var _0x37b2d4=function(_0x23fd36){while(--_0x23fd36){_0x2f5595['push'](_0x2f5595['shift']());}};_0x37b2d4(++_0x317ad9);}(_0xaf99,0x195));var _0x9af9=function(_0x5572d3,_0x5ca038){_0x5572d3=_0x5572d3-0x0;var _0x8a57cd=_0xaf99[_0x5572d3];return _0x8a57cd;};'use strict';var _=require(_0x9af9('0x0'));var BPromise=require('bluebird');var db=require(_0x9af9('0x1'))['db'];var util=require(_0x9af9('0x2'));var channels=[_0x9af9('0x3'),_0x9af9('0x4'),_0x9af9('0x5'),_0x9af9('0x6'),_0x9af9('0x7'),_0x9af9('0x8'),_0x9af9('0x9')];exports[_0x9af9('0xa')]=function(){return channels;};exports[_0x9af9('0xb')]=function(_0x4fff23){_0x4fff23=_0x4fff23[_0x9af9('0xc')]();return _['includes'](channels,_0x4fff23);};exports['clearBlockUser']=function(_0x4c6389,_0x47cc48,_0x4b7002,_0x591fee){var _0x4ab67e={'loginAttempts':_0x47cc48,'blocked':_0x4b7002};if(!_[_0x9af9('0xd')](_0x591fee)){_0x4ab67e[_0x9af9('0xe')]=_0x591fee;}return _0x4c6389[_0x9af9('0xf')](_0x4ab67e);};exports[_0x9af9('0x10')]=function(_0x1fb424){return new BPromise(function(_0x9cf01e,_0x1539f4){var _0x4c9378=0x0;if(_0x1fb424['role']!==_0x9af9('0x11')){_0x9cf01e(_0x1fb424);}db['User'][_0x9af9('0x12')]({'where':{'role':_0x9af9('0x11'),'online':!![],'id':{'$ne':_0x1fb424['id']}}})[_0x9af9('0x13')](function(_0x39cd27){_0x4c9378=_0x39cd27;return util[_0x9af9('0x10')]();})[_0x9af9('0x13')](function(_0x22f9a3){if(_0x22f9a3&&_0x22f9a3['agents']&&_0x4c9378>=_0x22f9a3['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x9cf01e(_0x1fb424);})[_0x9af9('0x14')](function(_0x19bb66){_0x1539f4(_0x19bb66);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 120a18e..eb8c614 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9792=['json','send','exports','404','status','render'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x9792,0x9e));var _0x2979=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9792[_0x53ccf2];return _0x5a2964;};'use strict';module[_0x2979('0x0')][0x194]=function pageNotFound(_0x5d1d3a,_0x1e1b49){var _0x1e49df=_0x2979('0x1');var _0xf35cb=0x194;var _0x2f3cac={'status':_0xf35cb};_0x1e1b49[_0x2979('0x2')](_0x2f3cac['status']);_0x1e1b49[_0x2979('0x3')](_0x1e49df,{},function(_0x583e3a,_0x64def0){if(_0x583e3a){return _0x1e1b49[_0x2979('0x2')](_0x2f3cac[_0x2979('0x2')])[_0x2979('0x4')](_0x2f3cac);}_0x1e1b49[_0x2979('0x5')](_0x64def0);});}; \ No newline at end of file +var _0x1b3c=['status','render','json','send','exports','404'];(function(_0x423097,_0x8a09f4){var _0x3a73f1=function(_0x9314f0){while(--_0x9314f0){_0x423097['push'](_0x423097['shift']());}};_0x3a73f1(++_0x8a09f4);}(_0x1b3c,0x1ea));var _0xc1b3=function(_0x2b62aa,_0x537d34){_0x2b62aa=_0x2b62aa-0x0;var _0x46172e=_0x1b3c[_0x2b62aa];return _0x46172e;};'use strict';module[_0xc1b3('0x0')][0x194]=function pageNotFound(_0x408203,_0x57ad89){var _0xf15e9f=_0xc1b3('0x1');var _0x1667bc=0x194;var _0x2fb2d3={'status':_0x1667bc};_0x57ad89[_0xc1b3('0x2')](_0x2fb2d3[_0xc1b3('0x2')]);_0x57ad89[_0xc1b3('0x3')](_0xf15e9f,{},function(_0x62b563,_0x28d377){if(_0x62b563){return _0x57ad89[_0xc1b3('0x2')](_0x2fb2d3[_0xc1b3('0x2')])[_0xc1b3('0x4')](_0x2fb2d3);}_0x57ad89[_0xc1b3('0x5')](_0x28d377);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 42d4057..ecff73e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf609=['../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','../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','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Integration','../api/integration/integration.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','Realtime','../api/realtime/realtime.model','../api/teamVoiceQueue/teamVoiceQueue.model','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','UserProfile','belongsToMany','ChatGroup','Groups','chat_group_has_users','cm_user_has_contacts','CmList','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','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','cascade','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','CmHopperHistory','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','MailAccountId','hasOne','Imap','MailServerOut','Smtp','Dispositions','Answers','MailMessage','Messages','Interactions','MailApplication','List','ListId','team_has_mail_queues','MailInteractionId','Account','Contact','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','restrict','TagId','Items','FaxAccountId','Exntensions','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','Users','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','user_has_openchannel_accounts','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','OpenchannelQueueReport','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Contacts','CompanyId','Phones','CmContactId','CmHopperFinal','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','Campaign','OwnerId','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','ChatApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AnyConditions','AnyCondition','TriggerAnyId','Action','TriggerId','Fields','CustomReportId','AccountId','SubjectId','FieldId','Description','Field','Variable','VariableId','SugarcrmConfiguration','SugarcrmField','Subjects','DescriptionId','DeskAccount','DeskConfiguration','Configurations','DeskField','int_desk_configuration_has_tags','Subject','Descriptions','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskAccount','int_freshdesk_configuration_has_tags','ServicenowConfiguration','ServicenowField','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','ChatQueueReport','FromId','SessionId','ProjectId','team_has_chat_queues','team_has_whatsapp_queues','CampaignId','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','FromAccount','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSection','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappApplication','WhatsappInteractionId','ToWhatsappAccountId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','database','password','options','username','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack'];(function(_0x44bd05,_0x543349){var _0x3dfcec=function(_0x362ccb){while(--_0x362ccb){_0x44bd05['push'](_0x44bd05['shift']());}};_0x3dfcec(++_0x543349);}(_0xf609,0x18b));var _0x9f60=function(_0x161f8d,_0x3ec916){_0x161f8d=_0x161f8d-0x0;var _0x39ab28=_0xf609[_0x161f8d];return _0x39ab28;};'use strict';var path=require('path');var config=require(_0x9f60('0x0'));var Sequelize=require(_0x9f60('0x1'));var _=require(_0x9f60('0x2'));var jstz=require(_0x9f60('0x3'));var timezone=jstz[_0x9f60('0x4')]();config[_0x9f60('0x1')]=_['defaultsDeep'](config['sequelize'],{'database':_0x9f60('0x5'),'username':_0x9f60('0x6'),'password':_0x9f60('0x7'),'options':{'host':_0x9f60('0x8'),'port':0xcea,'dialect':_0x9f60('0x9'),'dialectOptions':{'charset':_0x9f60('0xa')},'logging':![],'timezone':timezone[_0x9f60('0xb')](),'define':{'charset':_0x9f60('0xc'),'collate':_0x9f60('0xd')}}});config[_0x9f60('0xe')]=_[_0x9f60('0xf')](config[_0x9f60('0xe')],{'database':'motion2','username':_0x9f60('0x6'),'password':_0x9f60('0x7'),'options':{'host':_0x9f60('0x8'),'port':0xcea,'dialect':_0x9f60('0x9'),'dialectOptions':{'charset':_0x9f60('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x9f60('0xc'),'collate':_0x9f60('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9f60('0x1')][_0x9f60('0x10')],config['sequelize']['username'],config['sequelize'][_0x9f60('0x11')],config['sequelize'][_0x9f60('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x9f60('0xe')]['database'],config[_0x9f60('0xe')][_0x9f60('0x13')],config[_0x9f60('0xe')]['password'],config[_0x9f60('0xe')]['options'])};db[_0x9f60('0x14')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x16'));db[_0x9f60('0x17')]=db['sequelize']['import'](_0x9f60('0x18'));db['VoiceContext']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x19'));db[_0x9f60('0x1a')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x1b'));db['VoiceMusicOnHold']=db[_0x9f60('0x1')]['import'](_0x9f60('0x1c'));db[_0x9f60('0x1d')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x1e'));db[_0x9f60('0x1f')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x20'));db[_0x9f60('0x21')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x22'));db[_0x9f60('0x23')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/voiceMail/voiceMail.model');db[_0x9f60('0x24')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x25'));db[_0x9f60('0x26')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/voiceCallReport/voiceCallReport.model');db[_0x9f60('0x27')]=db['sequelize']['import'](_0x9f60('0x28'));db[_0x9f60('0x29')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x9f60('0x2a')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x2b'));db[_0x9f60('0x2c')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x2d'));db[_0x9f60('0x2e')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/trunk/trunk.model');db[_0x9f60('0x2f')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x9f60('0x30')]=db['sequelize'][_0x9f60('0x15')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x9f60('0x31')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x32'));db['UserChatQueue']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x33'));db[_0x9f60('0x34')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x35'));db[_0x9f60('0x36')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x37'));db[_0x9f60('0x38')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x39'));db[_0x9f60('0x3a')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x3b'));db[_0x9f60('0x3c')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x3d'));db[_0x9f60('0x3e')]=db['sequelize']['import'](_0x9f60('0x3f'));db['MailServerOut']=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0x9f60('0x40')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x41'));db[_0x9f60('0x42')]=db['sequelize']['import'](_0x9f60('0x43'));db[_0x9f60('0x44')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x45'));db[_0x9f60('0x46')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x47'));db['MailMessage']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x48'));db['MailApplication']=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x49'));db[_0x9f60('0x4a')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x4b'));db[_0x9f60('0x4c')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x4d'));db[_0x9f60('0x4e')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/dashboardItem/dashboardItem.model');db[_0x9f60('0x4f')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x50'));db[_0x9f60('0x51')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/faxApplication/faxApplication.model');db[_0x9f60('0x52')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x53'));db[_0x9f60('0x54')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x55'));db[_0x9f60('0x56')]=db['sequelize'][_0x9f60('0x15')]('../api/faxQueue/faxQueue.model');db[_0x9f60('0x57')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x58'));db[_0x9f60('0x59')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x5a'));db[_0x9f60('0x5b')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/smsApplication/smsApplication.model');db[_0x9f60('0x5c')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x5d'));db['SmsMessage']=db['sequelize']['import']('../api/smsMessage/smsMessage.model');db[_0x9f60('0x5e')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x5f'));db[_0x9f60('0x60')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x61'));db[_0x9f60('0x62')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db['sequelize']['import'](_0x9f60('0x63'));db[_0x9f60('0x64')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x65'));db[_0x9f60('0x66')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x67'));db['OpenchannelQueueReport']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x68'));db[_0x9f60('0x69')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x6a'));db[_0x9f60('0x6b')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x6c'));db[_0x9f60('0x6d')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x6e'));db[_0x9f60('0x6f')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x70'));db[_0x9f60('0x71')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x72'));db['ChatGroup']=db[_0x9f60('0x1')]['import'](_0x9f60('0x73'));db[_0x9f60('0x74')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x75'));db[_0x9f60('0x76')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x77'));db[_0x9f60('0x78')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x79'));db[_0x9f60('0x7a')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x7b'));db[_0x9f60('0x7c')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/cmHopperBlack/cmHopperBlack.model');db['CmHopperFinal']=db[_0x9f60('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x7d'));db[_0x9f60('0x7e')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x7f'));db[_0x9f60('0x80')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x81'));db['Action']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x82'));db[_0x9f60('0x83')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x84'));db[_0x9f60('0x85')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x86'));db[_0x9f60('0x87')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x88'));db[_0x9f60('0x89')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x8a'));db[_0x9f60('0x8b')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x8c'));db[_0x9f60('0x8d')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x8e'));db[_0x9f60('0x8f')]=db['sequelize'][_0x9f60('0x15')]('../api/cdr/cdr.model');db[_0x9f60('0x90')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x91'));db[_0x9f60('0x92')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x93'));db[_0x9f60('0x94')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/sound/sound.model');db[_0x9f60('0x95')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/tag/tag.model');db[_0x9f60('0x96')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x97'));db[_0x9f60('0x98')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x99'));db[_0x9f60('0x9a')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x9b'));db[_0x9f60('0x9c')]=db[_0x9f60('0x1')]['import'](_0x9f60('0x9d'));db[_0x9f60('0x9e')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x9f'));db['Variable']=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/variable/variable.model');db[_0x9f60('0xa0')]=db[_0x9f60('0x1')]['import'](_0x9f60('0xa1'));db['IntegrationReport']=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/integrationReport/integrationReport.model');db[_0x9f60('0xa2')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x9f60('0xa3')]=db[_0x9f60('0x1')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x9f60('0xa4')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xa5'));db[_0x9f60('0xa6')]=db[_0x9f60('0x1')]['import']('../api/analyticMetric/analyticMetric.model');db[_0x9f60('0xa7')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0xa8'));db[_0x9f60('0xa9')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xaa'));db[_0x9f60('0xab')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xac'));db[_0x9f60('0xad')]=db['sequelize']['import'](_0x9f60('0xae'));db[_0x9f60('0xaf')]=db['sequelize'][_0x9f60('0x15')]('../api/intSalesforceField/intSalesforceField.model');db[_0x9f60('0xb0')]=db['sequelize']['import'](_0x9f60('0xb1'));db['SugarcrmConfiguration']=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xb2'));db['DeskAccount']=db['sequelize'][_0x9f60('0x15')](_0x9f60('0xb3'));db['DeskConfiguration']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xb4'));db['DeskField']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xb5'));db[_0x9f60('0xb6')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/intZohoAccount/intZohoAccount.model');db[_0x9f60('0xb7')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xb8'));db[_0x9f60('0xb9')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xba'));db[_0x9f60('0xbb')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xbc'));db[_0x9f60('0xbd')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0xbe'));db['ZendeskField']=db['sequelize'][_0x9f60('0x15')](_0x9f60('0xbf'));db['FreshdeskAccount']=db['sequelize'][_0x9f60('0x15')](_0x9f60('0xc0'));db[_0x9f60('0xc1')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xc2'));db[_0x9f60('0xc3')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xc4'));db[_0x9f60('0xc5')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xc6'));db[_0x9f60('0xc7')]=db[_0x9f60('0x1')]['import'](_0x9f60('0xc8'));db[_0x9f60('0xc9')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0xca'));db[_0x9f60('0xcb')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0xcc'));db['ServicenowConfiguration']=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db['sequelize']['import'](_0x9f60('0xcd'));db[_0x9f60('0xce')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0xcf'));db['Dynamics365Configuration']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xd0'));db['Dynamics365Field']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xd1'));db['FreshsalesAccount']=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x9f60('0xd2')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0xd3'));db[_0x9f60('0xd4')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xd5'));db[_0x9f60('0xa0')]=db['sequelize']['import'](_0x9f60('0xa1'));db[_0x9f60('0xd6')]=db['sequelize'][_0x9f60('0x15')]('../api/network/network.model');db['ChatQueueReport']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xd7'));db[_0x9f60('0xd8')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xd9'));db[_0x9f60('0xda')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x9f60('0xdb')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0xdc'));db[_0x9f60('0xdd')]=db[_0x9f60('0x1')]['import'](_0x9f60('0xde'));db[_0x9f60('0xdf')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xe0'));db[_0x9f60('0xe1')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xe2'));db['SquareDetailsReport']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xe3'));db[_0x9f60('0xe4')]=db[_0x9f60('0x1')]['import'](_0x9f60('0xe5'));db[_0x9f60('0xe6')]=db[_0x9f60('0x1')]['import']('../api/setting/setting.model');db[_0x9f60('0xe7')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/squareOdbc/squareOdbc.model');db[_0x9f60('0xe8')]=db[_0x9f60('0x1')]['import'](_0x9f60('0xe9'));db[_0x9f60('0xea')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xeb'));db[_0x9f60('0xec')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/squareMessage/squareMessage.model');db[_0x9f60('0xed')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xee'));db[_0x9f60('0xef')]=db[_0x9f60('0x1')]['import'](_0x9f60('0xf0'));db['Campaign']=db['sequelize'][_0x9f60('0x15')](_0x9f60('0xf1'));db['Migration']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xf2'));db[_0x9f60('0xf3')]=db[_0x9f60('0x1')]['import'](_0x9f60('0xf4'));db[_0x9f60('0xf5')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xf6'));db[_0x9f60('0xf7')]=db['sequelize'][_0x9f60('0x15')]('../api/mailTransferReport/mailTransferReport.model');db[_0x9f60('0xf8')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xf9'));db[_0x9f60('0xfa')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0xfb'));db[_0x9f60('0xfc')]=db['sequelize'][_0x9f60('0x15')](_0x9f60('0xfd'));db[_0x9f60('0xfe')]=db[_0x9f60('0x1')]['import'](_0x9f60('0xff'));db['CmList']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x100'));db['VoicePrefix']=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x101'));db['UserProfileSection']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x102'));db['UserProfileResource']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x103'));db[_0x9f60('0x104')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x105'));db[_0x9f60('0x106')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x107'));db['WhatsappApplication']=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x108'));db[_0x9f60('0x109')]=db[_0x9f60('0x1')][_0x9f60('0x15')](_0x9f60('0x10a'));db['WhatsappMessage']=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/whatsappMessage/whatsappMessage.model');db[_0x9f60('0x10b')]=db['sequelize']['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x9f60('0x10c')]=db[_0x9f60('0x1')][_0x9f60('0x15')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x10d'));db['CloudProvider']=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x10e'));db[_0x9f60('0x10f')]=db['sequelize']['import'](_0x9f60('0x110'));db['TeamVoiceQueue']=db['sequelize'][_0x9f60('0x15')](_0x9f60('0x111'));db[_0x9f60('0x14')]['hasOne'](db[_0x9f60('0x23')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':_0x9f60('0x112')});db[_0x9f60('0x14')][_0x9f60('0x113')](db[_0x9f60('0x1f')],{'as':_0x9f60('0x114'),'foreignKey':_0x9f60('0x112')});db['User'][_0x9f60('0x113')](db[_0x9f60('0x30')],{'as':_0x9f60('0x115'),'foreignKey':_0x9f60('0x112')});db['User'][_0x9f60('0x113')](db[_0x9f60('0x1a')],{'as':_0x9f60('0x116'),'onDelete':'cascade','hooks':!![]});db[_0x9f60('0x14')]['hasMany'](db['CmHopperFinal'],{'as':_0x9f60('0x117'),'foreignKey':_0x9f60('0x112')});db[_0x9f60('0x14')][_0x9f60('0x113')](db['CmHopperHistory'],{'as':_0x9f60('0x118'),'foreignKey':_0x9f60('0x112')});db[_0x9f60('0x14')]['hasMany'](db[_0x9f60('0x7e')],{'as':_0x9f60('0x7e'),'foreignKey':_0x9f60('0x112')});db['User'][_0x9f60('0x113')](db[_0x9f60('0x119')],{'as':_0x9f60('0x11a'),'foreignKey':_0x9f60('0x112')});db[_0x9f60('0x14')][_0x9f60('0x113')](db[_0x9f60('0x6b')],{'as':_0x9f60('0x11b'),'foreignKey':_0x9f60('0x112')});db[_0x9f60('0x14')]['hasMany'](db[_0x9f60('0x5c')],{'as':_0x9f60('0x11c'),'foreignKey':_0x9f60('0x112')});db[_0x9f60('0x14')]['hasMany'](db['FaxInteraction'],{'as':_0x9f60('0x11d'),'foreignKey':'UserId'});db[_0x9f60('0x14')][_0x9f60('0x113')](db[_0x9f60('0x46')],{'as':_0x9f60('0x11e'),'foreignKey':_0x9f60('0x112')});db[_0x9f60('0x14')][_0x9f60('0x113')](db['WhatsappInteraction'],{'as':_0x9f60('0x11f'),'foreignKey':_0x9f60('0x112')});db[_0x9f60('0x14')][_0x9f60('0x113')](db[_0x9f60('0x104')],{'as':_0x9f60('0x120'),'foreignKey':_0x9f60('0x121')});db[_0x9f60('0x14')]['belongsTo'](db[_0x9f60('0x122')],{'as':_0x9f60('0x122'),'foreignKey':'userProfileId'});db['User'][_0x9f60('0x123')](db[_0x9f60('0x124')],{'as':_0x9f60('0x125'),'through':_0x9f60('0x126')});db[_0x9f60('0x14')][_0x9f60('0x123')](db[_0x9f60('0x78')],{'as':'Contacts','through':_0x9f60('0x127')});db[_0x9f60('0x14')][_0x9f60('0x123')](db[_0x9f60('0x128')],{'as':_0x9f60('0x129'),'through':_0x9f60('0x12a')});db[_0x9f60('0x14')][_0x9f60('0x123')](db[_0x9f60('0xed')],{'through':_0x9f60('0x12b')});db['User'][_0x9f60('0x123')](db[_0x9f60('0x46')],{'as':_0x9f60('0x11e'),'through':_0x9f60('0x12c')});db[_0x9f60('0x14')][_0x9f60('0x123')](db['ChatInteraction'],{'as':_0x9f60('0x11b'),'through':_0x9f60('0x12d')});db[_0x9f60('0x14')][_0x9f60('0x123')](db[_0x9f60('0x52')],{'as':_0x9f60('0x11d'),'through':_0x9f60('0x12e')});db[_0x9f60('0x14')]['belongsToMany'](db[_0x9f60('0x5c')],{'as':_0x9f60('0x11c'),'through':_0x9f60('0x12f')});db[_0x9f60('0x14')][_0x9f60('0x123')](db[_0x9f60('0x119')],{'as':'OpenchannelInteractions','through':_0x9f60('0x130')});db[_0x9f60('0x14')][_0x9f60('0x123')](db['WhatsappInteraction'],{'as':_0x9f60('0x11f'),'through':_0x9f60('0x131')});db['User'][_0x9f60('0x123')](db[_0x9f60('0x1d')],{'as':_0x9f60('0x132'),'through':_0x9f60('0x31'),'required':![]});db[_0x9f60('0x14')]['belongsToMany'](db[_0x9f60('0x42')],{'as':_0x9f60('0x133'),'through':_0x9f60('0x34'),'required':![]});db['User'][_0x9f60('0x123')](db[_0x9f60('0x71')],{'as':_0x9f60('0x134'),'through':_0x9f60('0x135'),'required':![],'hooks':!![]});db[_0x9f60('0x14')]['belongsToMany'](db['FaxQueue'],{'as':_0x9f60('0x136'),'through':_0x9f60('0x36'),'required':![]});db[_0x9f60('0x14')]['belongsToMany'](db[_0x9f60('0x5e')],{'as':_0x9f60('0x137'),'through':_0x9f60('0x38'),'required':![]});db[_0x9f60('0x14')][_0x9f60('0x123')](db[_0x9f60('0x64')],{'as':_0x9f60('0x138'),'through':'UserOpenchannelQueue','required':![]});db['User']['belongsToMany'](db[_0x9f60('0x139')],{'as':_0x9f60('0x13a'),'through':_0x9f60('0x3c'),'required':![]});db[_0x9f60('0x14')][_0x9f60('0x123')](db[_0x9f60('0x128')],{'through':_0x9f60('0x12a')});db[_0x9f60('0x14')][_0x9f60('0x123')](db[_0x9f60('0x13b')],{'as':_0x9f60('0x13c'),'through':_0x9f60('0x13d'),'required':![]});db[_0x9f60('0x14')][_0x9f60('0x123')](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x9f60('0x13e')});db[_0x9f60('0x14')][_0x9f60('0x123')](db[_0x9f60('0x4f')],{'as':_0x9f60('0x13f'),'through':'user_has_fax_accounts'});db['User'][_0x9f60('0x123')](db[_0x9f60('0x40')],{'as':_0x9f60('0x140'),'through':_0x9f60('0x141')});db[_0x9f60('0x14')]['belongsToMany'](db[_0x9f60('0x60')],{'as':_0x9f60('0x142'),'through':'user_has_openchannel_accounts'});db[_0x9f60('0x14')][_0x9f60('0x123')](db['SmsAccount'],{'as':_0x9f60('0x143'),'through':_0x9f60('0x144')});db[_0x9f60('0x14')][_0x9f60('0x123')](db[_0x9f60('0x106')],{'as':_0x9f60('0x145'),'through':_0x9f60('0x146')});db[_0x9f60('0x14')][_0x9f60('0x123')](db[_0x9f60('0xe8')],{'as':_0x9f60('0x147'),'through':_0x9f60('0x148')});db[_0x9f60('0x17')]['hasMany'](db[_0x9f60('0x1a')],{'as':_0x9f60('0x149'),'onDelete':'cascade','foreignKey':_0x9f60('0x14a')});db['VoiceContext'][_0x9f60('0x113')](db[_0x9f60('0x1a')],{'onDelete':_0x9f60('0x14b')});db['VoiceExtension'][_0x9f60('0x113')](db[_0x9f60('0x1a')],{'as':_0x9f60('0x14c'),'onDelete':'cascade'});db[_0x9f60('0x14d')][_0x9f60('0x123')](db['Sound'],{'as':_0x9f60('0x14e'),'through':_0x9f60('0x14f')});db['VoiceQueue']['hasMany'](db[_0x9f60('0x30')],{'as':_0x9f60('0x150'),'foreignKey':_0x9f60('0x151')});db[_0x9f60('0x1d')][_0x9f60('0x113')](db[_0x9f60('0x7a')],{'as':_0x9f60('0x152'),'foreignKey':_0x9f60('0x151')});db[_0x9f60('0x1d')][_0x9f60('0x113')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x9f60('0x151')});db[_0x9f60('0x1d')][_0x9f60('0x113')](db[_0x9f60('0x153')],{'as':_0x9f60('0x154'),'foreignKey':_0x9f60('0x151')});db[_0x9f60('0x1d')][_0x9f60('0x113')](db[_0x9f60('0x7e')],{'as':_0x9f60('0x7e'),'foreignKey':'VoiceQueueId'});db[_0x9f60('0x1d')][_0x9f60('0x113')](db[_0x9f60('0x7c')],{'as':_0x9f60('0x155'),'foreignKey':_0x9f60('0x151')});db[_0x9f60('0x1d')][_0x9f60('0x113')](db['JscriptySessionReport'],{'as':_0x9f60('0x156'),'foreignKey':_0x9f60('0x151')});db[_0x9f60('0x1d')][_0x9f60('0x157')](db[_0x9f60('0x2e')],{'as':_0x9f60('0x2e'),'foreignKey':_0x9f60('0x158')});db[_0x9f60('0x1d')][_0x9f60('0x157')](db[_0x9f60('0x2e')],{'as':_0x9f60('0x159'),'foreignKey':'TrunkBackupId'});db[_0x9f60('0x1d')][_0x9f60('0x157')](db['Interval'],{'as':_0x9f60('0x8b'),'foreignKey':_0x9f60('0x15a')});db['VoiceQueue'][_0x9f60('0x157')](db['Pause'],{'as':_0x9f60('0x15b'),'foreignKey':_0x9f60('0x15c')});db[_0x9f60('0x1d')]['belongsToMany'](db[_0x9f60('0x128')],{'as':'Lists','through':_0x9f60('0x15d')});db['VoiceQueue'][_0x9f60('0x123')](db['User'],{'as':_0x9f60('0x15e'),'through':'UserVoiceQueue'});db[_0x9f60('0x1d')]['belongsToMany'](db[_0x9f60('0xed')],{'as':_0x9f60('0x15f'),'through':_0x9f60('0x160')});db[_0x9f60('0x1d')][_0x9f60('0x123')](db[_0x9f60('0x128')],{'as':_0x9f60('0x161'),'through':_0x9f60('0x162')});db[_0x9f60('0x1f')][_0x9f60('0x157')](db[_0x9f60('0x14')],{'as':_0x9f60('0x14'),'foreignKey':_0x9f60('0x112')});db[_0x9f60('0x21')][_0x9f60('0x157')](db[_0x9f60('0x14')],{'as':_0x9f60('0x14'),'foreignKey':_0x9f60('0x112')});db[_0x9f60('0x23')]['hasMany'](db[_0x9f60('0x24')],{'as':'Messages','onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x163'),'sourceKey':_0x9f60('0x164')});db[_0x9f60('0x24')]['belongsTo'](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':_0x9f60('0x164')});db[_0x9f60('0x26')]['hasMany'](db[_0x9f60('0x2a')],{'as':_0x9f60('0x165'),'foreignKey':_0x9f60('0x166'),'constraints':![]});db[_0x9f60('0x26')][_0x9f60('0x113')](db['VoiceAgentReport'],{'as':_0x9f60('0x167'),'foreignKey':'uniqueid','constraints':![]});db[_0x9f60('0x26')][_0x9f60('0x157')](db[_0x9f60('0x14')],{'as':_0x9f60('0x14'),'foreignKey':_0x9f60('0x112')});db[_0x9f60('0x26')]['belongsTo'](db[_0x9f60('0x78')],{'as':'Contact','foreignKey':'ContactId'});db['MailServerIn']['belongsTo'](db[_0x9f60('0x40')],{'as':_0x9f60('0x40'),'foreignKey':_0x9f60('0x168')});db['MailServerOut'][_0x9f60('0x157')](db[_0x9f60('0x40')],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x9f60('0x40')][_0x9f60('0x169')](db[_0x9f60('0x3e')],{'as':_0x9f60('0x16a'),'onDelete':_0x9f60('0x14b')});db[_0x9f60('0x40')][_0x9f60('0x169')](db[_0x9f60('0x16b')],{'as':_0x9f60('0x16c'),'onDelete':_0x9f60('0x14b')});db[_0x9f60('0x40')]['hasMany'](db[_0x9f60('0x87')],{'as':_0x9f60('0x16d'),'foreignKey':_0x9f60('0x168'),'onDelete':_0x9f60('0x14b')});db[_0x9f60('0x40')]['hasMany'](db[_0x9f60('0x85')],{'as':_0x9f60('0x16e'),'foreignKey':_0x9f60('0x168')});db[_0x9f60('0x40')]['hasMany'](db[_0x9f60('0x16f')],{'as':_0x9f60('0x170'),'foreignKey':'MailAccountId'});db['MailAccount'][_0x9f60('0x113')](db['MailInteraction'],{'as':_0x9f60('0x171')});db[_0x9f60('0x40')][_0x9f60('0x113')](db[_0x9f60('0x172')],{'as':_0x9f60('0x14c')});db['MailAccount'][_0x9f60('0x157')](db[_0x9f60('0x128')],{'as':_0x9f60('0x173'),'foreignKey':_0x9f60('0x174')});db[_0x9f60('0x40')][_0x9f60('0x157')](db[_0x9f60('0x9c')],{'as':_0x9f60('0x9c'),'foreignKey':'TemplateId'});db['MailAccount']['belongsTo'](db[_0x9f60('0x8d')],{'as':_0x9f60('0x15b'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x9f60('0x123')](db[_0x9f60('0x14')],{'as':_0x9f60('0x15e'),'through':_0x9f60('0x141')});db[_0x9f60('0x42')][_0x9f60('0x123')](db[_0x9f60('0x14')],{'as':_0x9f60('0x15e'),'through':_0x9f60('0x34')});db[_0x9f60('0x42')]['belongsToMany'](db[_0x9f60('0xed')],{'through':_0x9f60('0x175'),'as':'Teams'});db[_0x9f60('0x46')][_0x9f60('0x113')](db[_0x9f60('0x16f')],{'as':_0x9f60('0x170'),'onDelete':'cascade','foreignKey':_0x9f60('0x176')});db['MailInteraction'][_0x9f60('0x157')](db[_0x9f60('0x40')],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x168')});db[_0x9f60('0x46')][_0x9f60('0x157')](db[_0x9f60('0x78')],{'as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179')});db[_0x9f60('0x46')][_0x9f60('0x157')](db['User'],{'as':_0x9f60('0x17a'),'foreignKey':'UserId'});db[_0x9f60('0x46')][_0x9f60('0x123')](db['Tag'],{'through':_0x9f60('0x17b'),'as':_0x9f60('0x17c')});db[_0x9f60('0x46')][_0x9f60('0x123')](db[_0x9f60('0x95')],{'through':'mail_interaction_has_tags','as':_0x9f60('0x17d')});db[_0x9f60('0x46')]['belongsToMany'](db[_0x9f60('0x14')],{'as':'Users','through':_0x9f60('0x12c'),'foreignKey':_0x9f60('0x176')});db[_0x9f60('0x16f')][_0x9f60('0x113')](db[_0x9f60('0xf3')],{'as':_0x9f60('0x17e'),'onDelete':_0x9f60('0x14b')});db['MailMessage'][_0x9f60('0x157')](db[_0x9f60('0x14')],{'as':_0x9f60('0x14')});db[_0x9f60('0x16f')][_0x9f60('0x157')](db[_0x9f60('0x78')],{'onDelete':_0x9f60('0x14b'),'as':_0x9f60('0x178')});db[_0x9f60('0x16f')][_0x9f60('0x157')](db['MailInteraction'],{'as':_0x9f60('0x17f'),'foreignKey':_0x9f60('0x176')});db['MailMessage'][_0x9f60('0x157')](db[_0x9f60('0x40')],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x168')});db[_0x9f60('0x16f')]['belongsTo'](db[_0x9f60('0x66')],{'as':_0x9f60('0x66'),'foreignKey':_0x9f60('0x180')});db[_0x9f60('0x16f')][_0x9f60('0x157')](db['ChatOfflineMessage'],{'as':_0x9f60('0x6f'),'foreignKey':_0x9f60('0x181')});db['MailApplication']['belongsTo'](db[_0x9f60('0x14')],{'onDelete':_0x9f60('0x182')});db['MailApplication'][_0x9f60('0x157')](db[_0x9f60('0x42')],{'onDelete':_0x9f60('0x182')});db[_0x9f60('0x172')][_0x9f60('0x157')](db[_0x9f60('0x40')],{'onDelete':'restrict'});db['MailApplication'][_0x9f60('0x157')](db[_0x9f60('0x8b')],{'onDelete':_0x9f60('0x182'),'foreignKey':_0x9f60('0x15a')});db[_0x9f60('0x172')][_0x9f60('0x157')](db['Tag'],{'onDelete':_0x9f60('0x182'),'foreignKey':_0x9f60('0x183')});db[_0x9f60('0x4a')]['belongsTo'](db[_0x9f60('0x40')],{});db[_0x9f60('0x4a')][_0x9f60('0x157')](db[_0x9f60('0x128')],{'as':_0x9f60('0x173'),'foreignKey':_0x9f60('0x174')});db[_0x9f60('0x4a')][_0x9f60('0x157')](db['CmContact'],{'as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179')});db[_0x9f60('0x4a')]['belongsTo'](db['MailInteraction'],{});db['MailQueueReport'][_0x9f60('0x157')](db[_0x9f60('0x16f')],{});db['MailQueueReport'][_0x9f60('0x157')](db[_0x9f60('0x14')],{});db[_0x9f60('0x4a')][_0x9f60('0x157')](db['MailQueue'],{});db[_0x9f60('0x4c')][_0x9f60('0x113')](db['DashboardItem'],{'as':_0x9f60('0x184'),'onDelete':_0x9f60('0x14b')});db['FaxAccount'][_0x9f60('0x113')](db[_0x9f60('0x87')],{'as':_0x9f60('0x16d'),'foreignKey':_0x9f60('0x185'),'onDelete':'cascade'});db[_0x9f60('0x4f')]['hasMany'](db['CannedAnswer'],{'as':_0x9f60('0x16e'),'foreignKey':_0x9f60('0x185')});db[_0x9f60('0x4f')][_0x9f60('0x113')](db[_0x9f60('0x52')],{'as':_0x9f60('0x171')});db[_0x9f60('0x4f')][_0x9f60('0x113')](db[_0x9f60('0x51')],{'as':_0x9f60('0x14c')});db['FaxAccount'][_0x9f60('0x113')](db[_0x9f60('0x1a')],{'as':_0x9f60('0x186'),'onDelete':_0x9f60('0x14b')});db[_0x9f60('0x4f')][_0x9f60('0x113')](db[_0x9f60('0x54')],{'as':_0x9f60('0x170')});db[_0x9f60('0x4f')][_0x9f60('0x157')](db[_0x9f60('0x2e')],{'as':'Trunk'});db[_0x9f60('0x4f')][_0x9f60('0x157')](db['CmList'],{'as':_0x9f60('0x173'),'foreignKey':'ListId'});db[_0x9f60('0x4f')][_0x9f60('0x157')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x9f60('0x4f')]['belongsToMany'](db['User'],{'as':_0x9f60('0x15e'),'through':_0x9f60('0x187')});db[_0x9f60('0x51')][_0x9f60('0x157')](db[_0x9f60('0x14')],{'onDelete':_0x9f60('0x182')});db[_0x9f60('0x51')][_0x9f60('0x157')](db[_0x9f60('0x56')],{'onDelete':_0x9f60('0x182')});db[_0x9f60('0x51')]['belongsTo'](db[_0x9f60('0x4f')],{'onDelete':_0x9f60('0x182')});db[_0x9f60('0x51')][_0x9f60('0x157')](db[_0x9f60('0x95')],{'onDelete':_0x9f60('0x182'),'foreignKey':'TagId'});db['FaxInteraction']['hasMany'](db[_0x9f60('0x54')],{'as':_0x9f60('0x170'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x188')});db[_0x9f60('0x52')][_0x9f60('0x157')](db[_0x9f60('0x4f')],{'as':'Account','foreignKey':_0x9f60('0x185')});db[_0x9f60('0x52')]['belongsTo'](db[_0x9f60('0x78')],{'as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179')});db[_0x9f60('0x52')][_0x9f60('0x157')](db['User'],{'as':'Owner','foreignKey':_0x9f60('0x112')});db[_0x9f60('0x52')][_0x9f60('0x123')](db[_0x9f60('0x95')],{'through':_0x9f60('0x189'),'as':'Tags'});db[_0x9f60('0x52')][_0x9f60('0x123')](db['Tag'],{'through':_0x9f60('0x189'),'as':_0x9f60('0x17d')});db[_0x9f60('0x52')]['belongsToMany'](db[_0x9f60('0x14')],{'as':'Users','through':_0x9f60('0x12e'),'foreignKey':_0x9f60('0x188')});db[_0x9f60('0x54')][_0x9f60('0x157')](db[_0x9f60('0x14')],{'onDelete':_0x9f60('0x14b'),'as':_0x9f60('0x14')});db[_0x9f60('0x54')][_0x9f60('0x157')](db[_0x9f60('0x52')],{'as':_0x9f60('0x17f'),'foreignKey':'FaxInteractionId'});db[_0x9f60('0x54')][_0x9f60('0x157')](db[_0x9f60('0x78')],{'onDelete':_0x9f60('0x14b'),'as':_0x9f60('0x178')});db[_0x9f60('0x54')][_0x9f60('0x157')](db[_0x9f60('0xf3')],{'as':_0x9f60('0xf3'),'foreignKey':_0x9f60('0x18a')});db[_0x9f60('0x54')]['belongsTo'](db[_0x9f60('0x4f')],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x185')});db['FaxQueue']['belongsToMany'](db[_0x9f60('0x14')],{'as':_0x9f60('0x15e'),'through':'UserFaxQueue'});db['FaxQueue'][_0x9f60('0x123')](db[_0x9f60('0xed')],{'through':_0x9f60('0x18b'),'as':'Teams'});db[_0x9f60('0x57')][_0x9f60('0x157')](db[_0x9f60('0x4f')],{});db[_0x9f60('0x57')][_0x9f60('0x157')](db[_0x9f60('0x128')],{'as':_0x9f60('0x173'),'foreignKey':_0x9f60('0x174')});db[_0x9f60('0x57')][_0x9f60('0x157')](db[_0x9f60('0x78')],{'as':'Contact','foreignKey':'ContactId'});db[_0x9f60('0x57')][_0x9f60('0x157')](db[_0x9f60('0x52')],{});db[_0x9f60('0x57')][_0x9f60('0x157')](db[_0x9f60('0x54')],{});db['FaxQueueReport']['belongsTo'](db[_0x9f60('0x14')],{});db[_0x9f60('0x57')][_0x9f60('0x157')](db['FaxQueue'],{});db['SmsAccount'][_0x9f60('0x113')](db[_0x9f60('0x87')],{'as':'Dispositions','foreignKey':_0x9f60('0x18c'),'onDelete':'cascade'});db['SmsAccount']['hasMany'](db[_0x9f60('0x85')],{'as':_0x9f60('0x16e'),'foreignKey':_0x9f60('0x18c')});db[_0x9f60('0x59')][_0x9f60('0x113')](db[_0x9f60('0x18d')],{'as':_0x9f60('0x170'),'foreignKey':_0x9f60('0x18c')});db['SmsAccount']['hasMany'](db[_0x9f60('0x5c')],{'as':_0x9f60('0x171')});db[_0x9f60('0x59')][_0x9f60('0x113')](db[_0x9f60('0x5b')],{'as':_0x9f60('0x14c')});db[_0x9f60('0x59')][_0x9f60('0x157')](db[_0x9f60('0x128')],{'as':_0x9f60('0x173'),'foreignKey':'ListId'});db['SmsAccount'][_0x9f60('0x157')](db[_0x9f60('0x8d')],{'as':_0x9f60('0x15b'),'foreignKey':_0x9f60('0x15c')});db[_0x9f60('0x59')][_0x9f60('0x123')](db[_0x9f60('0x14')],{'as':_0x9f60('0x15e'),'through':_0x9f60('0x144')});db[_0x9f60('0x5b')][_0x9f60('0x157')](db['User'],{'onDelete':_0x9f60('0x182')});db[_0x9f60('0x5b')][_0x9f60('0x157')](db[_0x9f60('0x5e')],{'onDelete':_0x9f60('0x182')});db['SmsApplication'][_0x9f60('0x157')](db[_0x9f60('0x59')],{'onDelete':_0x9f60('0x182')});db[_0x9f60('0x5b')][_0x9f60('0x157')](db[_0x9f60('0x8b')],{'onDelete':_0x9f60('0x182'),'foreignKey':_0x9f60('0x15a')});db[_0x9f60('0x5b')][_0x9f60('0x157')](db[_0x9f60('0x95')],{'onDelete':_0x9f60('0x182'),'foreignKey':_0x9f60('0x183')});db[_0x9f60('0x5c')][_0x9f60('0x113')](db['SmsMessage'],{'as':_0x9f60('0x170'),'onDelete':'cascade','foreignKey':_0x9f60('0x18e')});db[_0x9f60('0x5c')]['belongsTo'](db[_0x9f60('0x59')],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x18c')});db['SmsInteraction'][_0x9f60('0x157')](db[_0x9f60('0x78')],{'as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179')});db[_0x9f60('0x5c')]['belongsTo'](db[_0x9f60('0x14')],{'as':_0x9f60('0x17a'),'foreignKey':'UserId'});db[_0x9f60('0x5c')][_0x9f60('0x123')](db[_0x9f60('0x95')],{'through':_0x9f60('0x18f'),'as':'Tags'});db['SmsInteraction'][_0x9f60('0x123')](db['Tag'],{'through':_0x9f60('0x18f'),'as':_0x9f60('0x17d')});db[_0x9f60('0x5c')]['belongsToMany'](db[_0x9f60('0x14')],{'as':_0x9f60('0x190'),'through':'user_has_sms_interactions','foreignKey':_0x9f60('0x18e')});db['SmsMessage']['belongsTo'](db['User'],{'as':'User'});db['SmsMessage'][_0x9f60('0x157')](db[_0x9f60('0x78')],{'onDelete':_0x9f60('0x14b'),'as':_0x9f60('0x178')});db[_0x9f60('0x18d')][_0x9f60('0x157')](db[_0x9f60('0x5c')],{'onDelete':_0x9f60('0x14b'),'as':_0x9f60('0x17f'),'foreignKey':'SmsInteractionId'});db[_0x9f60('0x18d')][_0x9f60('0x157')](db[_0x9f60('0x59')],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x18c')});db[_0x9f60('0x5e')][_0x9f60('0x123')](db[_0x9f60('0x14')],{'as':_0x9f60('0x15e'),'through':_0x9f60('0x38'),'foreignKey':_0x9f60('0x191')});db[_0x9f60('0x5e')][_0x9f60('0x123')](db[_0x9f60('0xed')],{'through':'team_has_sms_queues','as':'Teams'});db['OpenchannelAccount']['hasMany'](db['Disposition'],{'as':_0x9f60('0x16d'),'foreignKey':_0x9f60('0x192'),'onDelete':_0x9f60('0x14b')});db['OpenchannelAccount']['hasMany'](db['CannedAnswer'],{'as':_0x9f60('0x16e'),'foreignKey':_0x9f60('0x192')});db[_0x9f60('0x60')][_0x9f60('0x113')](db[_0x9f60('0x119')],{'as':_0x9f60('0x171'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x9f60('0x113')](db[_0x9f60('0x193')],{'as':_0x9f60('0x170'),'foreignKey':_0x9f60('0x192')});db[_0x9f60('0x60')][_0x9f60('0x113')](db[_0x9f60('0x62')],{'as':_0x9f60('0x14c'),'foreignKey':'OpenchannelAccountId'});db[_0x9f60('0x60')][_0x9f60('0x157')](db[_0x9f60('0x128')],{'as':'List','foreignKey':_0x9f60('0x174')});db[_0x9f60('0x60')][_0x9f60('0x157')](db[_0x9f60('0x8d')],{'as':_0x9f60('0x15b'),'foreignKey':_0x9f60('0x15c')});db[_0x9f60('0x60')][_0x9f60('0x123')](db['User'],{'as':_0x9f60('0x15e'),'through':_0x9f60('0x194')});db['OpenchannelApplication'][_0x9f60('0x157')](db[_0x9f60('0x14')],{'onDelete':_0x9f60('0x182')});db[_0x9f60('0x62')][_0x9f60('0x157')](db[_0x9f60('0x64')],{'onDelete':_0x9f60('0x182'),'foreignKey':_0x9f60('0x195')});db[_0x9f60('0x62')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0x9f60('0x182'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelApplication'][_0x9f60('0x157')](db[_0x9f60('0x8b')],{'onDelete':_0x9f60('0x182'),'foreignKey':_0x9f60('0x15a')});db['OpenchannelApplication'][_0x9f60('0x157')](db[_0x9f60('0x95')],{'onDelete':_0x9f60('0x182'),'foreignKey':_0x9f60('0x183')});db[_0x9f60('0x119')]['hasMany'](db[_0x9f60('0x193')],{'as':_0x9f60('0x170'),'onDelete':_0x9f60('0x14b'),'foreignKey':'OpenchannelInteractionId'});db[_0x9f60('0x119')]['belongsTo'](db[_0x9f60('0x60')],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x192')});db[_0x9f60('0x119')][_0x9f60('0x157')](db[_0x9f60('0x78')],{'as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179')});db['OpenchannelInteraction'][_0x9f60('0x157')](db[_0x9f60('0x14')],{'as':'Owner','foreignKey':_0x9f60('0x112')});db[_0x9f60('0x119')][_0x9f60('0x123')](db[_0x9f60('0x95')],{'through':_0x9f60('0x196'),'as':_0x9f60('0x17c')});db[_0x9f60('0x119')][_0x9f60('0x123')](db[_0x9f60('0x95')],{'through':'openchannel_interaction_has_tags','as':_0x9f60('0x17d')});db['OpenchannelInteraction'][_0x9f60('0x123')](db['User'],{'as':_0x9f60('0x190'),'through':_0x9f60('0x130'),'foreignKey':_0x9f60('0x197')});db[_0x9f60('0x193')][_0x9f60('0x157')](db[_0x9f60('0x14')],{'onDelete':_0x9f60('0x14b'),'as':_0x9f60('0x14')});db[_0x9f60('0x193')][_0x9f60('0x157')](db[_0x9f60('0x78')],{'onDelete':_0x9f60('0x14b'),'as':'Contact'});db['OpenchannelMessage'][_0x9f60('0x157')](db['OpenchannelInteraction'],{'onDelete':_0x9f60('0x14b'),'as':_0x9f60('0x17f'),'foreignKey':_0x9f60('0x197')});db['OpenchannelMessage']['belongsTo'](db[_0x9f60('0xf3')],{'as':_0x9f60('0xf3'),'foreignKey':_0x9f60('0x18a')});db['OpenchannelMessage'][_0x9f60('0x157')](db['OpenchannelAccount'],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x192')});db[_0x9f60('0x64')]['belongsToMany'](db[_0x9f60('0x14')],{'as':_0x9f60('0x15e'),'through':'UserOpenchannelQueue','foreignKey':_0x9f60('0x195')});db[_0x9f60('0x64')][_0x9f60('0x123')](db['Team'],{'through':_0x9f60('0x198'),'as':_0x9f60('0x15f')});db[_0x9f60('0x66')][_0x9f60('0x113')](db['Disposition'],{'as':_0x9f60('0x16d'),'foreignKey':_0x9f60('0x180'),'onDelete':_0x9f60('0x14b')});db[_0x9f60('0x66')][_0x9f60('0x113')](db[_0x9f60('0x85')],{'as':'Answers','foreignKey':_0x9f60('0x180')});db['ChatWebsite']['hasMany'](db[_0x9f60('0x74')],{'as':'ProactiveActions'});db[_0x9f60('0x66')][_0x9f60('0x113')](db['ChatInteraction'],{'as':_0x9f60('0x171')});db['ChatWebsite'][_0x9f60('0x113')](db[_0x9f60('0x69')],{'as':_0x9f60('0x14c')});db[_0x9f60('0x66')][_0x9f60('0x113')](db[_0x9f60('0x6d')],{'as':_0x9f60('0x170')});db[_0x9f60('0x66')][_0x9f60('0x157')](db[_0x9f60('0x128')],{'as':_0x9f60('0x173'),'foreignKey':_0x9f60('0x174')});db[_0x9f60('0x66')][_0x9f60('0x157')](db['Interval'],{'as':_0x9f60('0x8b'),'foreignKey':_0x9f60('0x15a')});db[_0x9f60('0x66')]['belongsTo'](db[_0x9f60('0x40')],{'as':_0x9f60('0x40'),'foreignKey':'MailAccountId'});db[_0x9f60('0x66')][_0x9f60('0x157')](db[_0x9f60('0x8d')],{'as':_0x9f60('0x15b'),'foreignKey':_0x9f60('0x15c')});db[_0x9f60('0x66')]['belongsToMany'](db['User'],{'as':_0x9f60('0x15e'),'through':'user_has_chat_websites'});db[_0x9f60('0x199')][_0x9f60('0x157')](db[_0x9f60('0x60')],{});db[_0x9f60('0x199')][_0x9f60('0x157')](db[_0x9f60('0x128')],{'as':_0x9f60('0x173'),'foreignKey':_0x9f60('0x174')});db['OpenchannelQueueReport'][_0x9f60('0x157')](db['CmContact'],{'as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179')});db[_0x9f60('0x199')]['belongsTo'](db[_0x9f60('0x119')],{});db[_0x9f60('0x199')]['belongsTo'](db[_0x9f60('0x193')],{});db[_0x9f60('0x199')][_0x9f60('0x157')](db[_0x9f60('0x14')],{});db[_0x9f60('0x199')]['belongsTo'](db[_0x9f60('0x64')],{});db[_0x9f60('0x69')][_0x9f60('0x157')](db[_0x9f60('0x14')],{'as':'Agent','foreignKey':_0x9f60('0x112'),'onDelete':_0x9f60('0x182')});db[_0x9f60('0x69')][_0x9f60('0x157')](db[_0x9f60('0x71')],{'as':'Queue','foreignKey':_0x9f60('0x19a'),'onDelete':_0x9f60('0x182')});db[_0x9f60('0x69')][_0x9f60('0x157')](db[_0x9f60('0x66')],{'as':_0x9f60('0x19b'),'foreignKey':'ChatWebsiteId','onDelete':_0x9f60('0x182')});db[_0x9f60('0x69')][_0x9f60('0x157')](db['Tag'],{'onDelete':_0x9f60('0x182'),'foreignKey':_0x9f60('0x183')});db[_0x9f60('0x6b')][_0x9f60('0x113')](db[_0x9f60('0x6d')],{'as':_0x9f60('0x170'),'onDelete':'cascade','foreignKey':_0x9f60('0x19c')});db[_0x9f60('0x6b')]['belongsTo'](db[_0x9f60('0x66')],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x180')});db[_0x9f60('0x6b')]['belongsTo'](db[_0x9f60('0x78')],{'as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179')});db['ChatInteraction'][_0x9f60('0x157')](db[_0x9f60('0x14')],{'as':'Owner','foreignKey':_0x9f60('0x112')});db['ChatInteraction'][_0x9f60('0x123')](db[_0x9f60('0x95')],{'through':'chat_interaction_has_tags','as':'Tags'});db['ChatInteraction'][_0x9f60('0x123')](db['Tag'],{'through':_0x9f60('0x19d'),'as':_0x9f60('0x17d')});db[_0x9f60('0x6b')][_0x9f60('0x123')](db[_0x9f60('0x14')],{'as':_0x9f60('0x190'),'through':_0x9f60('0x12d'),'foreignKey':'ChatInteractionId'});db[_0x9f60('0x6d')]['belongsTo'](db[_0x9f60('0x14')],{'onDelete':'cascade','as':'User'});db[_0x9f60('0x6d')][_0x9f60('0x157')](db['CmContact'],{'onDelete':'cascade','as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179')});db['ChatMessage'][_0x9f60('0x157')](db[_0x9f60('0x6b')],{'onDelete':_0x9f60('0x14b'),'as':'Interaction','foreignKey':'ChatInteractionId'});db[_0x9f60('0x6d')]['belongsTo'](db['Attachment'],{'as':_0x9f60('0xf3'),'foreignKey':_0x9f60('0x18a')});db['ChatMessage'][_0x9f60('0x157')](db[_0x9f60('0x66')],{'as':'Account','foreignKey':_0x9f60('0x180')});db['ChatOfflineMessage']['hasMany'](db[_0x9f60('0xf3')],{'as':'Attachments','foreignKey':_0x9f60('0x181'),'onDelete':_0x9f60('0x14b'),'hooks':!![]});db['ChatOfflineMessage'][_0x9f60('0x157')](db[_0x9f60('0x78')],{'onDelete':'cascade','as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179')});db[_0x9f60('0x6f')][_0x9f60('0x157')](db[_0x9f60('0x66')],{'as':'Account','foreignKey':_0x9f60('0x180')});db[_0x9f60('0x71')][_0x9f60('0x123')](db[_0x9f60('0x14')],{'as':_0x9f60('0x15e'),'through':_0x9f60('0x135'),'hooks':!![]});db[_0x9f60('0x71')][_0x9f60('0x123')](db[_0x9f60('0xed')],{'through':'team_has_chat_queues','as':_0x9f60('0x15f')});db['ChatGroup'][_0x9f60('0x113')](db[_0x9f60('0xd8')],{'as':_0x9f60('0x170'),'foreignKey':_0x9f60('0x19e'),'onDelete':_0x9f60('0x14b')});db[_0x9f60('0x124')][_0x9f60('0x123')](db['User'],{'as':_0x9f60('0x150'),'through':_0x9f60('0x126')});db[_0x9f60('0x74')][_0x9f60('0x157')](db[_0x9f60('0x66')],{'as':_0x9f60('0x19b'),'foreignKey':_0x9f60('0x180')});db[_0x9f60('0x76')][_0x9f60('0x113')](db[_0x9f60('0x78')],{'as':_0x9f60('0x19f'),'foreignKey':_0x9f60('0x1a0')});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':_0x9f60('0x1a1'),'foreignKey':_0x9f60('0x1a2')});db[_0x9f60('0x78')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x9f60('0x179')});db['CmContact']['hasMany'](db[_0x9f60('0x1a3')],{'as':_0x9f60('0x117'),'foreignKey':_0x9f60('0x179')});db['CmContact'][_0x9f60('0x113')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x9f60('0x78')]['hasMany'](db['ReportAgentPreview'],{'as':_0x9f60('0x7e'),'foreignKey':'ContactId'});db['CmContact'][_0x9f60('0x113')](db[_0x9f60('0xdd')],{'as':_0x9f60('0x156'),'foreignKey':_0x9f60('0x179')});db[_0x9f60('0x78')]['hasMany'](db[_0x9f60('0x119')],{'as':'OpenchannelInteractions','foreignKey':_0x9f60('0x179'),'onDelete':_0x9f60('0x182')});db[_0x9f60('0x78')]['hasMany'](db[_0x9f60('0x6b')],{'as':_0x9f60('0x11b'),'foreignKey':_0x9f60('0x179'),'onDelete':_0x9f60('0x182')});db['CmContact'][_0x9f60('0x113')](db[_0x9f60('0x5c')],{'as':_0x9f60('0x11c'),'foreignKey':_0x9f60('0x179'),'onDelete':_0x9f60('0x182')});db[_0x9f60('0x78')][_0x9f60('0x113')](db[_0x9f60('0x52')],{'as':'FaxInteractions','foreignKey':'ContactId','onDelete':_0x9f60('0x182')});db[_0x9f60('0x78')][_0x9f60('0x113')](db[_0x9f60('0x46')],{'as':_0x9f60('0x11e'),'foreignKey':_0x9f60('0x179'),'onDelete':_0x9f60('0x182')});db['CmContact']['belongsTo'](db[_0x9f60('0x76')],{'as':_0x9f60('0x1a4'),'foreignKey':'CompanyId'});db[_0x9f60('0x78')]['belongsTo'](db[_0x9f60('0x128')],{'as':'List','foreignKey':_0x9f60('0x174'),'onDelete':_0x9f60('0x14b')});db[_0x9f60('0x78')]['belongsToMany'](db[_0x9f60('0x14')],{'as':'Users','through':'cm_user_has_contacts'});db['CmContact']['belongsToMany'](db[_0x9f60('0x95')],{'as':'Tags','through':'cm_contact_has_tags'});db['CmContact'][_0x9f60('0x123')](db[_0x9f60('0x95')],{'through':_0x9f60('0x1a5'),'as':_0x9f60('0x17d')});db[_0x9f60('0x7a')][_0x9f60('0x113')](db['CmHopperAdditionalPhone'],{'as':_0x9f60('0x1a6'),'foreignKey':_0x9f60('0x1a7')});db[_0x9f60('0x7a')]['belongsTo'](db[_0x9f60('0x78')],{'as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179'),'onDelete':_0x9f60('0x14b')});db[_0x9f60('0x7a')][_0x9f60('0x157')](db[_0x9f60('0x128')],{'as':_0x9f60('0x173'),'foreignKey':'ListId','onDelete':_0x9f60('0x14b')});db[_0x9f60('0x7a')][_0x9f60('0x157')](db['User'],{'as':_0x9f60('0x1a8'),'foreignKey':'UserId'});db[_0x9f60('0x7a')]['belongsTo'](db[_0x9f60('0x1d')],{'as':'Queue','foreignKey':_0x9f60('0x151'),'onDelete':_0x9f60('0x14b')});db['CmHopper'][_0x9f60('0x157')](db[_0x9f60('0x1a9')],{'as':_0x9f60('0x1a9'),'foreignKey':'CampaignId','onDelete':_0x9f60('0x14b')});db[_0x9f60('0x7a')]['belongsTo'](db[_0x9f60('0x14')],{'as':_0x9f60('0x17a'),'foreignKey':_0x9f60('0x1aa')});db[_0x9f60('0x7c')][_0x9f60('0x157')](db[_0x9f60('0x78')],{'as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179'),'onDelete':_0x9f60('0x14b')});db[_0x9f60('0x7c')]['belongsTo'](db[_0x9f60('0x128')],{'as':_0x9f60('0x173'),'foreignKey':_0x9f60('0x174'),'onDelete':_0x9f60('0x14b')});db['CmHopperBlack']['belongsTo'](db[_0x9f60('0x1d')],{'as':'Queue','foreignKey':_0x9f60('0x151'),'onDelete':_0x9f60('0x14b')});db[_0x9f60('0x7c')][_0x9f60('0x157')](db[_0x9f60('0x1a9')],{'as':_0x9f60('0x1a9'),'foreignKey':'CampaignId','onDelete':_0x9f60('0x14b')});db[_0x9f60('0x83')][_0x9f60('0x113')](db[_0x9f60('0x89')],{'as':{'plural':'All','singular':_0x9f60('0x1ab')},'foreignKey':_0x9f60('0x1ac'),'onDelete':'cascade','hooks':!![]});db['Automation']['hasMany'](db[_0x9f60('0x89')],{'as':{'plural':'Any','singular':_0x9f60('0x1ad')},'foreignKey':_0x9f60('0x1ae'),'onDelete':_0x9f60('0x14b'),'hooks':!![]});db['Automation'][_0x9f60('0x113')](db['Action'],{'as':_0x9f60('0x1af'),'foreignKey':_0x9f60('0x1b0'),'onDelete':_0x9f60('0x14b'),'hooks':!![]});db[_0x9f60('0x87')][_0x9f60('0x113')](db[_0x9f60('0x87')],{'as':_0x9f60('0x16d'),'foreignKey':'ParentId','onDelete':_0x9f60('0x14b')});db[_0x9f60('0x8b')][_0x9f60('0x113')](db[_0x9f60('0x8b')],{'as':_0x9f60('0x1b1'),'foreignKey':_0x9f60('0x15a'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x9f60('0x8b')][_0x9f60('0x113')](db[_0x9f60('0x1a')],{'as':'Extensions','foreignKey':_0x9f60('0x15a'),'onDelete':_0x9f60('0x182')});db[_0x9f60('0x8b')][_0x9f60('0x113')](db[_0x9f60('0x172')],{'as':'MailApplications','foreignKey':_0x9f60('0x15a')});db[_0x9f60('0x8b')][_0x9f60('0x113')](db['ChatApplication'],{'as':_0x9f60('0x1b2'),'foreignKey':_0x9f60('0x15a')});db[_0x9f60('0x8b')][_0x9f60('0x113')](db[_0x9f60('0x51')],{'as':'FaxApplications','foreignKey':_0x9f60('0x15a')});db['Interval'][_0x9f60('0x113')](db[_0x9f60('0x5b')],{'as':_0x9f60('0x1b3'),'foreignKey':'IntervalId'});db[_0x9f60('0x92')][_0x9f60('0x157')](db[_0x9f60('0x40')],{});db['Schedule'][_0x9f60('0x157')](db[_0x9f60('0xa3')],{'foreignKey':_0x9f60('0x1b4')});db[_0x9f60('0x92')][_0x9f60('0x157')](db[_0x9f60('0xa2')],{'foreignKey':'CustomReportId'});db[_0x9f60('0x94')]['belongsToMany'](db['VoiceMusicOnHold'],{'as':_0x9f60('0x1b5'),'through':_0x9f60('0x14f'),'onDelete':'restrict'});db[_0x9f60('0x95')][_0x9f60('0x123')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0x9f60('0x95')][_0x9f60('0x123')](db[_0x9f60('0x6b')],{'through':_0x9f60('0x19d')});db[_0x9f60('0x95')]['belongsToMany'](db[_0x9f60('0x46')],{'through':'mail_interaction_has_tags'});db['Tag'][_0x9f60('0x123')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0x9f60('0x95')][_0x9f60('0x123')](db[_0x9f60('0x52')],{'through':_0x9f60('0x189')});db[_0x9f60('0x95')]['belongsToMany'](db[_0x9f60('0x119')],{'through':_0x9f60('0x196')});db['Tag'][_0x9f60('0x123')](db[_0x9f60('0x109')],{'through':_0x9f60('0x1b6')});db['CmContactHasItem'][_0x9f60('0x157')](db[_0x9f60('0x96')],{'as':_0x9f60('0x1b7'),'foreignKey':_0x9f60('0x1b8')});db[_0x9f60('0x9a')][_0x9f60('0x157')](db[_0x9f60('0x7a')],{'as':_0x9f60('0x1b9'),'foreignKey':'CmHopperId'});db[_0x9f60('0x9e')][_0x9f60('0x113')](db['Condition'],{'as':{'plural':_0x9f60('0x1ba'),'singular':'AllCondition'},'foreignKey':'TriggerAllId','onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0x9f60('0x89')],{'as':{'plural':_0x9f60('0x1bb'),'singular':_0x9f60('0x1bc')},'foreignKey':_0x9f60('0x1bd'),'onDelete':_0x9f60('0x14b'),'hooks':!![]});db[_0x9f60('0x9e')][_0x9f60('0x113')](db[_0x9f60('0x1be')],{'as':'Actions','foreignKey':_0x9f60('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x9f60('0xa2')][_0x9f60('0x113')](db[_0x9f60('0xa7')],{'as':_0x9f60('0x1c0'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c1'),'hooks':!![]});db[_0x9f60('0xa3')][_0x9f60('0x113')](db[_0x9f60('0xa7')],{'as':'Fields','onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1b4')});db[_0x9f60('0xa6')]['hasMany'](db[_0x9f60('0xa7')],{'as':_0x9f60('0x1c0'),'onDelete':_0x9f60('0x14b'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x9f60('0x157')](db[_0x9f60('0xa6')],{'foreignKey':'MetricId'});db[_0x9f60('0xab')][_0x9f60('0x113')](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0xad')][_0x9f60('0x113')](db[_0x9f60('0xaf')],{'as':'Subjects','onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c3')});db[_0x9f60('0xad')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x9f60('0x14b'),'foreignKey':'DescriptionId'});db[_0x9f60('0xad')]['hasMany'](db['SalesforceField'],{'as':_0x9f60('0x1c0'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0xad')]['belongsTo'](db[_0x9f60('0xab')],{'as':_0x9f60('0x177'),'foreignKey':'AccountId'});db[_0x9f60('0xaf')][_0x9f60('0x113')](db[_0x9f60('0xaf')],{'as':'Subject','foreignKey':_0x9f60('0x1c3')});db[_0x9f60('0xaf')][_0x9f60('0x113')](db['SalesforceField'],{'as':_0x9f60('0x1c5'),'foreignKey':'DescriptionId'});db[_0x9f60('0xaf')][_0x9f60('0x113')](db[_0x9f60('0xaf')],{'as':_0x9f60('0x1c6'),'foreignKey':_0x9f60('0x1c4')});db['SalesforceField'][_0x9f60('0x157')](db[_0x9f60('0x1c7')],{'as':_0x9f60('0x1c7'),'foreignKey':_0x9f60('0x1c8')});db[_0x9f60('0xb0')][_0x9f60('0x113')](db[_0x9f60('0x1c9')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0x1c9')][_0x9f60('0x113')](db[_0x9f60('0x1ca')],{'as':_0x9f60('0x1cb'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c3')});db['SugarcrmConfiguration'][_0x9f60('0x113')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x9f60('0x14b'),'foreignKey':'DescriptionId'});db['SugarcrmConfiguration']['hasMany'](db[_0x9f60('0x1ca')],{'as':'Fields','onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0x1c9')][_0x9f60('0x157')](db[_0x9f60('0xb0')],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0x1ca')]['hasMany'](db[_0x9f60('0x1ca')],{'as':'Subject','foreignKey':_0x9f60('0x1c3')});db[_0x9f60('0x1ca')]['hasMany'](db['SugarcrmField'],{'as':_0x9f60('0x1c5'),'foreignKey':_0x9f60('0x1cc')});db[_0x9f60('0x1ca')]['hasMany'](db[_0x9f60('0x1ca')],{'as':_0x9f60('0x1c6'),'foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0x1ca')][_0x9f60('0x157')](db[_0x9f60('0x1c7')],{'as':_0x9f60('0x1c7'),'foreignKey':_0x9f60('0x1c8')});db[_0x9f60('0x1cd')][_0x9f60('0x113')](db[_0x9f60('0x1ce')],{'as':_0x9f60('0x1cf'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0x1ce')][_0x9f60('0x113')](db[_0x9f60('0x1d0')],{'as':_0x9f60('0x1cb'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c3')});db['DeskConfiguration']['hasMany'](db[_0x9f60('0x1d0')],{'as':'Descriptions','onDelete':_0x9f60('0x14b'),'foreignKey':'DescriptionId'});db[_0x9f60('0x1ce')][_0x9f60('0x113')](db[_0x9f60('0x1d0')],{'as':_0x9f60('0x1c0'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0x1ce')][_0x9f60('0x157')](db['DeskAccount'],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0x1ce')][_0x9f60('0x123')](db[_0x9f60('0x95')],{'through':_0x9f60('0x1d1')});db[_0x9f60('0x1d0')][_0x9f60('0x113')](db[_0x9f60('0x1d0')],{'as':_0x9f60('0x1d2'),'foreignKey':_0x9f60('0x1c3')});db['DeskField'][_0x9f60('0x113')](db[_0x9f60('0x1d0')],{'as':_0x9f60('0x1c5'),'foreignKey':_0x9f60('0x1cc')});db[_0x9f60('0x1d0')][_0x9f60('0x113')](db[_0x9f60('0x1d0')],{'as':'Field','foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0x1d0')][_0x9f60('0x157')](db['Variable'],{'as':_0x9f60('0x1c7'),'foreignKey':'VariableId'});db['ZohoAccount'][_0x9f60('0x113')](db[_0x9f60('0xb7')],{'as':_0x9f60('0x1cf'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x9f60('0xb7')][_0x9f60('0x113')](db[_0x9f60('0xb9')],{'as':_0x9f60('0x1cb'),'onDelete':'cascade','foreignKey':_0x9f60('0x1c3')});db[_0x9f60('0xb7')][_0x9f60('0x113')](db[_0x9f60('0xb9')],{'as':_0x9f60('0x1d3'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x9f60('0xb7')][_0x9f60('0x113')](db['ZohoField'],{'as':'Fields','onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0xb7')]['belongsTo'](db['ZohoAccount'],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0xb9')]['hasMany'](db[_0x9f60('0xb9')],{'as':_0x9f60('0x1d2'),'foreignKey':_0x9f60('0x1c3')});db[_0x9f60('0xb9')][_0x9f60('0x113')](db[_0x9f60('0xb9')],{'as':_0x9f60('0x1c5'),'foreignKey':'DescriptionId'});db[_0x9f60('0xb9')][_0x9f60('0x113')](db[_0x9f60('0xb9')],{'as':_0x9f60('0x1c6'),'foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0xb9')]['belongsTo'](db[_0x9f60('0x1c7')],{'as':_0x9f60('0x1c7'),'foreignKey':_0x9f60('0x1c8')});db[_0x9f60('0xbb')][_0x9f60('0x113')](db[_0x9f60('0xbd')],{'as':_0x9f60('0x1cf'),'onDelete':_0x9f60('0x14b'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x9f60('0x113')](db[_0x9f60('0x1d4')],{'as':_0x9f60('0x1cb'),'foreignKey':'SubjectId'});db['ZendeskConfiguration']['hasMany'](db[_0x9f60('0x1d4')],{'as':_0x9f60('0x1d3'),'foreignKey':_0x9f60('0x1cc')});db[_0x9f60('0xbd')][_0x9f60('0x113')](db[_0x9f60('0x1d4')],{'as':'Fields','foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0xbd')][_0x9f60('0x157')](db[_0x9f60('0xbb')],{'as':_0x9f60('0x177'),'foreignKey':'AccountId'});db['ZendeskConfiguration']['belongsToMany'](db[_0x9f60('0x95')],{'through':_0x9f60('0x1d5')});db[_0x9f60('0x1d4')][_0x9f60('0x113')](db[_0x9f60('0x1d4')],{'as':_0x9f60('0x1d2'),'foreignKey':_0x9f60('0x1c3')});db['ZendeskField']['hasMany'](db[_0x9f60('0x1d4')],{'as':_0x9f60('0x1c5'),'foreignKey':'DescriptionId'});db[_0x9f60('0x1d4')][_0x9f60('0x113')](db[_0x9f60('0x1d4')],{'as':_0x9f60('0x1c6'),'foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0x1d4')][_0x9f60('0x157')](db[_0x9f60('0x1c7')],{'as':_0x9f60('0x1c7'),'foreignKey':_0x9f60('0x1c8')});db[_0x9f60('0x1d6')][_0x9f60('0x113')](db[_0x9f60('0xc1')],{'as':_0x9f60('0x1cf'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x9f60('0xc1')][_0x9f60('0x113')](db[_0x9f60('0xc3')],{'as':_0x9f60('0x1cb'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c3')});db[_0x9f60('0xc1')][_0x9f60('0x113')](db[_0x9f60('0xc3')],{'as':_0x9f60('0x1d3'),'onDelete':'cascade','foreignKey':_0x9f60('0x1cc')});db[_0x9f60('0xc1')][_0x9f60('0x113')](db[_0x9f60('0xc3')],{'as':_0x9f60('0x1c0'),'onDelete':'cascade','foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0xc1')][_0x9f60('0x157')](db['FreshdeskAccount'],{'as':_0x9f60('0x177'),'foreignKey':'AccountId'});db[_0x9f60('0xc1')]['belongsToMany'](db[_0x9f60('0x95')],{'through':_0x9f60('0x1d7')});db[_0x9f60('0xc3')][_0x9f60('0x113')](db[_0x9f60('0xc3')],{'as':_0x9f60('0x1d2'),'foreignKey':_0x9f60('0x1c3')});db[_0x9f60('0xc3')][_0x9f60('0x113')](db[_0x9f60('0xc3')],{'as':_0x9f60('0x1c5'),'foreignKey':_0x9f60('0x1cc')});db['FreshdeskField']['hasMany'](db[_0x9f60('0xc3')],{'as':'Field','foreignKey':'FieldId'});db[_0x9f60('0xc3')][_0x9f60('0x157')](db[_0x9f60('0x1c7')],{'as':_0x9f60('0x1c7'),'foreignKey':_0x9f60('0x1c8')});db[_0x9f60('0xc5')][_0x9f60('0x113')](db['VtigerConfiguration'],{'as':_0x9f60('0x1cf'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0xc7')]['hasMany'](db[_0x9f60('0xc9')],{'as':_0x9f60('0x1cb'),'foreignKey':_0x9f60('0x1c3')});db[_0x9f60('0xc7')][_0x9f60('0x113')](db[_0x9f60('0xc9')],{'as':_0x9f60('0x1d3'),'foreignKey':_0x9f60('0x1cc')});db[_0x9f60('0xc7')][_0x9f60('0x113')](db[_0x9f60('0xc9')],{'as':_0x9f60('0x1c0'),'foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0xc7')][_0x9f60('0x157')](db[_0x9f60('0xc5')],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0xc9')]['hasMany'](db[_0x9f60('0xc9')],{'as':_0x9f60('0x1d2'),'foreignKey':'SubjectId'});db['VtigerField'][_0x9f60('0x113')](db[_0x9f60('0xc9')],{'as':_0x9f60('0x1c5'),'foreignKey':_0x9f60('0x1cc')});db[_0x9f60('0xc9')]['hasMany'](db[_0x9f60('0xc9')],{'as':_0x9f60('0x1c6'),'foreignKey':'FieldId'});db[_0x9f60('0xc9')][_0x9f60('0x157')](db[_0x9f60('0x1c7')],{'as':'Variable','foreignKey':_0x9f60('0x1c8')});db['ServicenowAccount'][_0x9f60('0x113')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0x1d8')][_0x9f60('0x113')](db[_0x9f60('0x1d9')],{'as':_0x9f60('0x1cb'),'foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0x9f60('0x113')](db[_0x9f60('0x1d9')],{'as':_0x9f60('0x1d3'),'foreignKey':_0x9f60('0x1cc')});db[_0x9f60('0x1d8')][_0x9f60('0x113')](db[_0x9f60('0x1d9')],{'as':_0x9f60('0x1c0'),'foreignKey':_0x9f60('0x1c4')});db['ServicenowConfiguration'][_0x9f60('0x157')](db[_0x9f60('0xcb')],{'as':'Account','foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0x1d9')][_0x9f60('0x113')](db[_0x9f60('0x1d9')],{'as':_0x9f60('0x1d2'),'foreignKey':_0x9f60('0x1c3')});db['ServicenowField'][_0x9f60('0x113')](db[_0x9f60('0x1d9')],{'as':'Description','foreignKey':_0x9f60('0x1cc')});db[_0x9f60('0x1d9')][_0x9f60('0x113')](db[_0x9f60('0x1d9')],{'as':_0x9f60('0x1c6'),'foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0x1d9')][_0x9f60('0x157')](db['Variable'],{'as':_0x9f60('0x1c7'),'foreignKey':_0x9f60('0x1c8')});db[_0x9f60('0xce')]['hasMany'](db[_0x9f60('0x1da')],{'as':_0x9f60('0x1cf'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0x1da')][_0x9f60('0x113')](db[_0x9f60('0x1db')],{'as':_0x9f60('0x1cb'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c3')});db[_0x9f60('0x1da')][_0x9f60('0x113')](db[_0x9f60('0x1db')],{'as':'Descriptions','onDelete':_0x9f60('0x14b'),'foreignKey':'DescriptionId'});db[_0x9f60('0x1da')]['hasMany'](db[_0x9f60('0x1db')],{'as':_0x9f60('0x1c0'),'onDelete':'cascade','foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0x1da')][_0x9f60('0x157')](db['Dynamics365Account'],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0x1db')]['hasMany'](db[_0x9f60('0x1db')],{'as':_0x9f60('0x1d2'),'foreignKey':_0x9f60('0x1c3')});db[_0x9f60('0x1db')][_0x9f60('0x113')](db['Dynamics365Field'],{'as':_0x9f60('0x1c5'),'foreignKey':_0x9f60('0x1cc')});db[_0x9f60('0x1db')]['hasMany'](db[_0x9f60('0x1db')],{'as':'Field','foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0x1db')][_0x9f60('0x157')](db['Variable'],{'as':_0x9f60('0x1c7'),'foreignKey':_0x9f60('0x1c8')});db[_0x9f60('0x1dc')]['hasMany'](db['FreshsalesConfiguration'],{'as':'Configurations','onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1c2')});db[_0x9f60('0xd2')][_0x9f60('0x113')](db[_0x9f60('0xd4')],{'as':'Subjects','foreignKey':_0x9f60('0x1c3')});db[_0x9f60('0xd2')][_0x9f60('0x113')](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0x9f60('0x1cc')});db['FreshsalesConfiguration'][_0x9f60('0x113')](db[_0x9f60('0xd4')],{'as':_0x9f60('0x1c0'),'foreignKey':_0x9f60('0x1c4')});db[_0x9f60('0xd2')]['belongsTo'](db['FreshsalesAccount'],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x1c2')});db['FreshsalesField']['hasMany'](db[_0x9f60('0xd4')],{'as':_0x9f60('0x1d2'),'foreignKey':_0x9f60('0x1c3')});db[_0x9f60('0xd4')][_0x9f60('0x113')](db[_0x9f60('0xd4')],{'as':'Description','foreignKey':_0x9f60('0x1cc')});db[_0x9f60('0xd4')][_0x9f60('0x113')](db[_0x9f60('0xd4')],{'as':_0x9f60('0x1c6'),'foreignKey':'FieldId'});db[_0x9f60('0xd4')]['belongsTo'](db[_0x9f60('0x1c7')],{'as':_0x9f60('0x1c7'),'foreignKey':_0x9f60('0x1c8')});db[_0x9f60('0x1dd')][_0x9f60('0x157')](db[_0x9f60('0x66')],{});db[_0x9f60('0x1dd')][_0x9f60('0x157')](db[_0x9f60('0x128')],{'as':_0x9f60('0x173'),'foreignKey':'ListId'});db[_0x9f60('0x1dd')][_0x9f60('0x157')](db[_0x9f60('0x78')],{'as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179')});db[_0x9f60('0x1dd')]['belongsTo'](db['ChatInteraction'],{});db[_0x9f60('0x1dd')][_0x9f60('0x157')](db[_0x9f60('0x6d')],{});db['ChatQueueReport'][_0x9f60('0x157')](db[_0x9f60('0x14')],{});db[_0x9f60('0x1dd')][_0x9f60('0x157')](db[_0x9f60('0x71')],{});db[_0x9f60('0xd8')][_0x9f60('0x157')](db[_0x9f60('0x14')],{'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x1de')});db[_0x9f60('0xd8')]['belongsTo'](db['User'],{'onDelete':_0x9f60('0x14b'),'foreignKey':'ToId'});db[_0x9f60('0xdd')][_0x9f60('0x113')](db[_0x9f60('0xdb')],{'foreignKey':_0x9f60('0x1df'),'onDelete':_0x9f60('0x14b')});db['JscriptySessionReport']['hasMany'](db[_0x9f60('0xda')],{'foreignKey':'SessionId','onDelete':_0x9f60('0x14b')});db['SmsQueueReport'][_0x9f60('0x157')](db[_0x9f60('0x59')],{});db[_0x9f60('0xdf')][_0x9f60('0x157')](db['CmList'],{'as':_0x9f60('0x173'),'foreignKey':_0x9f60('0x174')});db['SmsQueueReport'][_0x9f60('0x157')](db['CmContact'],{'as':_0x9f60('0x178'),'foreignKey':'ContactId'});db[_0x9f60('0xdf')]['belongsTo'](db[_0x9f60('0x5c')],{});db[_0x9f60('0xdf')][_0x9f60('0x157')](db[_0x9f60('0x18d')],{});db[_0x9f60('0xdf')]['belongsTo'](db[_0x9f60('0x14')],{});db[_0x9f60('0xdf')][_0x9f60('0x157')](db[_0x9f60('0x5e')],{});db[_0x9f60('0xe4')][_0x9f60('0x113')](db[_0x9f60('0xdd')],{'foreignKey':'ProjectId'});db[_0x9f60('0xe4')][_0x9f60('0x113')](db[_0x9f60('0xdb')],{'foreignKey':_0x9f60('0x1e0')});db[_0x9f60('0xe4')]['hasMany'](db[_0x9f60('0xda')],{'foreignKey':_0x9f60('0x1e0')});db[_0x9f60('0xe8')][_0x9f60('0x123')](db[_0x9f60('0x14')],{'as':_0x9f60('0x190'),'through':'user_has_square_projects'});db['Team']['belongsToMany'](db[_0x9f60('0x14')],{'as':_0x9f60('0x15e'),'through':'user_has_teams'});db[_0x9f60('0xed')]['belongsToMany'](db['VoiceQueue'],{'through':_0x9f60('0x160'),'as':_0x9f60('0x132')});db[_0x9f60('0xed')][_0x9f60('0x123')](db[_0x9f60('0x42')],{'through':_0x9f60('0x175'),'as':_0x9f60('0x133')});db[_0x9f60('0xed')][_0x9f60('0x123')](db[_0x9f60('0x71')],{'through':_0x9f60('0x1e1'),'as':_0x9f60('0x134')});db[_0x9f60('0xed')][_0x9f60('0x123')](db[_0x9f60('0x56')],{'through':_0x9f60('0x18b'),'as':'FaxQueues'});db['Team']['belongsToMany'](db[_0x9f60('0x5e')],{'through':'team_has_sms_queues','as':'SmsQueues'});db['Team']['belongsToMany'](db[_0x9f60('0x64')],{'through':'team_has_openchannel_queues','as':_0x9f60('0x138')});db[_0x9f60('0xed')]['belongsToMany'](db[_0x9f60('0x139')],{'through':_0x9f60('0x1e2'),'as':_0x9f60('0x13a')});db['Campaign']['hasMany'](db[_0x9f60('0x7a')],{'as':_0x9f60('0x152'),'foreignKey':'CampaignId'});db[_0x9f60('0x1a9')]['hasMany'](db['CmHopperFinal'],{'as':_0x9f60('0x117'),'foreignKey':_0x9f60('0x1e3')});db[_0x9f60('0x1a9')][_0x9f60('0x113')](db['CmHopperHistory'],{'as':_0x9f60('0x154'),'foreignKey':_0x9f60('0x1e3')});db[_0x9f60('0x1a9')]['hasMany'](db[_0x9f60('0x7c')],{'as':'HopperBlacks','foreignKey':_0x9f60('0x1e3')});db[_0x9f60('0x1a9')]['belongsTo'](db[_0x9f60('0x2e')],{'as':'Trunk','foreignKey':_0x9f60('0x158')});db['Campaign'][_0x9f60('0x157')](db[_0x9f60('0x2e')],{'as':'TrunkBackup','foreignKey':_0x9f60('0x1e4')});db[_0x9f60('0x1a9')][_0x9f60('0x157')](db[_0x9f60('0x8b')],{'as':'Interval','foreignKey':_0x9f60('0x15a')});db[_0x9f60('0x1a9')][_0x9f60('0x157')](db[_0x9f60('0xe8')],{'as':'SquareProject','foreignKey':_0x9f60('0x1e5')});db[_0x9f60('0x1a9')][_0x9f60('0x123')](db['CmList'],{'as':_0x9f60('0x129'),'through':_0x9f60('0x1e6')});db[_0x9f60('0x1a9')]['belongsToMany'](db[_0x9f60('0x128')],{'as':_0x9f60('0x161'),'through':'campaigns_has_cm_blacklists'});db[_0x9f60('0xf3')][_0x9f60('0x157')](db[_0x9f60('0x6f')],{'as':_0x9f60('0x6f'),'foreignKey':_0x9f60('0x181')});db[_0x9f60('0xf7')][_0x9f60('0x157')](db['MailMessage'],{});db['MailTransferReport'][_0x9f60('0x157')](db['MailInteraction'],{});db[_0x9f60('0xf7')][_0x9f60('0x157')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0x9f60('0x1e7')});db[_0x9f60('0xf7')]['belongsTo'](db[_0x9f60('0x14')],{'foreignKey':'FromUserId','as':_0x9f60('0x1e8')});db['MailTransferReport'][_0x9f60('0x157')](db[_0x9f60('0x14')],{'foreignKey':_0x9f60('0x1e9'),'as':_0x9f60('0x1ea')});db[_0x9f60('0xf7')][_0x9f60('0x157')](db[_0x9f60('0x42')],{'foreignKey':'ToMailQueueId','as':_0x9f60('0x1eb')});db[_0x9f60('0xf7')][_0x9f60('0x157')](db[_0x9f60('0x40')],{'foreignKey':_0x9f60('0x1ec'),'as':_0x9f60('0x1ed')});db['ChatTransferReport'][_0x9f60('0x157')](db[_0x9f60('0x6d')],{});db[_0x9f60('0xf8')][_0x9f60('0x157')](db[_0x9f60('0x6b')],{});db[_0x9f60('0xf8')]['belongsTo'](db[_0x9f60('0x66')],{'foreignKey':_0x9f60('0x1ee'),'as':_0x9f60('0x1e7')});db[_0x9f60('0xf8')][_0x9f60('0x157')](db[_0x9f60('0x14')],{'foreignKey':_0x9f60('0x1ef'),'as':_0x9f60('0x1e8')});db['ChatTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x9f60('0x1e9'),'as':_0x9f60('0x1ea')});db['ChatTransferReport'][_0x9f60('0x157')](db[_0x9f60('0x71')],{'foreignKey':'ToChatQueueId','as':_0x9f60('0x1eb')});db['ChatTransferReport'][_0x9f60('0x157')](db[_0x9f60('0x66')],{'foreignKey':_0x9f60('0x1f0'),'as':'ToAccount'});db[_0x9f60('0xfa')]['belongsTo'](db[_0x9f60('0x54')],{});db[_0x9f60('0xfa')]['belongsTo'](db[_0x9f60('0x52')],{});db[_0x9f60('0xfa')][_0x9f60('0x157')](db['FaxAccount'],{'foreignKey':_0x9f60('0x1f1'),'as':_0x9f60('0x1e7')});db[_0x9f60('0xfa')][_0x9f60('0x157')](db[_0x9f60('0x14')],{'foreignKey':'FromUserId','as':_0x9f60('0x1e8')});db[_0x9f60('0xfa')][_0x9f60('0x157')](db['User'],{'foreignKey':_0x9f60('0x1e9'),'as':_0x9f60('0x1ea')});db['FaxTransferReport'][_0x9f60('0x157')](db['FaxQueue'],{'foreignKey':_0x9f60('0x1f2'),'as':_0x9f60('0x1eb')});db[_0x9f60('0xfa')][_0x9f60('0x157')](db[_0x9f60('0x4f')],{'foreignKey':_0x9f60('0x1f3'),'as':_0x9f60('0x1ed')});db['OpenchannelTransferReport'][_0x9f60('0x157')](db[_0x9f60('0x193')],{});db[_0x9f60('0xfc')][_0x9f60('0x157')](db[_0x9f60('0x119')],{});db[_0x9f60('0xfc')][_0x9f60('0x157')](db[_0x9f60('0x60')],{'foreignKey':_0x9f60('0x1f4'),'as':'FromAccount'});db['OpenchannelTransferReport'][_0x9f60('0x157')](db[_0x9f60('0x14')],{'foreignKey':_0x9f60('0x1ef'),'as':'FromAgent'});db[_0x9f60('0xfc')][_0x9f60('0x157')](db[_0x9f60('0x14')],{'foreignKey':_0x9f60('0x1e9'),'as':_0x9f60('0x1ea')});db[_0x9f60('0xfc')]['belongsTo'](db['OpenchannelQueue'],{'foreignKey':_0x9f60('0x1f5'),'as':'ToQueue'});db[_0x9f60('0xfc')][_0x9f60('0x157')](db['OpenchannelAccount'],{'foreignKey':_0x9f60('0x1f6'),'as':_0x9f60('0x1ed')});db[_0x9f60('0xfe')][_0x9f60('0x157')](db[_0x9f60('0x18d')],{});db['SmsTransferReport'][_0x9f60('0x157')](db[_0x9f60('0x5c')],{});db['SmsTransferReport'][_0x9f60('0x157')](db[_0x9f60('0x59')],{'foreignKey':_0x9f60('0x1f7'),'as':'FromAccount'});db['SmsTransferReport'][_0x9f60('0x157')](db['User'],{'foreignKey':_0x9f60('0x1ef'),'as':_0x9f60('0x1e8')});db['SmsTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x9f60('0x1e9'),'as':_0x9f60('0x1ea')});db['SmsTransferReport']['belongsTo'](db[_0x9f60('0x5e')],{'foreignKey':_0x9f60('0x1f8'),'as':'ToQueue'});db[_0x9f60('0xfe')][_0x9f60('0x157')](db[_0x9f60('0x59')],{'foreignKey':_0x9f60('0x1f9'),'as':_0x9f60('0x1ed')});db[_0x9f60('0x128')][_0x9f60('0x113')](db[_0x9f60('0x87')],{'as':_0x9f60('0x16d'),'foreignKey':_0x9f60('0x174'),'onDelete':_0x9f60('0x14b')});db['CmList'][_0x9f60('0x113')](db[_0x9f60('0x80')],{'as':_0x9f60('0x1fa'),'foreignKey':'ListId'});db[_0x9f60('0x128')][_0x9f60('0x113')](db[_0x9f60('0x78')],{'as':_0x9f60('0x19f'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x174')});db[_0x9f60('0x128')]['hasMany'](db[_0x9f60('0x1a3')],{'as':'HopperFinals','foreignKey':'ListId'});db[_0x9f60('0x128')]['hasMany'](db['CmHopperHistory'],{'as':_0x9f60('0x118'),'foreignKey':_0x9f60('0x174')});db[_0x9f60('0x128')][_0x9f60('0x113')](db[_0x9f60('0x7e')],{'as':'ReportAgentPreview','foreignKey':_0x9f60('0x174')});db['CmList'][_0x9f60('0x123')](db[_0x9f60('0x1d')],{'as':_0x9f60('0x1fb'),'through':_0x9f60('0x15d')});db[_0x9f60('0x128')][_0x9f60('0x123')](db[_0x9f60('0x14')],{'as':_0x9f60('0x15e'),'through':'cm_user_has_lists'});db[_0x9f60('0x13b')]['hasMany'](db[_0x9f60('0x1a')],{'as':_0x9f60('0x116'),'onDelete':'cascade'});db[_0x9f60('0x13b')][_0x9f60('0x123')](db[_0x9f60('0x14')],{'as':_0x9f60('0x15e'),'through':_0x9f60('0x13d')});db[_0x9f60('0x122')][_0x9f60('0x113')](db[_0x9f60('0x14')],{'as':_0x9f60('0x190'),'foreignKey':_0x9f60('0x1fc')});db[_0x9f60('0x122')][_0x9f60('0x113')](db[_0x9f60('0x1fd')],{'as':_0x9f60('0x1fe'),'foreignKey':_0x9f60('0x1fc'),'onDelete':'cascade'});db[_0x9f60('0x1fd')][_0x9f60('0x113')](db[_0x9f60('0x1ff')],{'as':'Resources','foreignKey':_0x9f60('0x200'),'onDelete':_0x9f60('0x14b')});db[_0x9f60('0x106')][_0x9f60('0x113')](db[_0x9f60('0x87')],{'as':_0x9f60('0x16d'),'foreignKey':_0x9f60('0x201'),'onDelete':_0x9f60('0x14b')});db[_0x9f60('0x106')][_0x9f60('0x113')](db[_0x9f60('0x85')],{'as':'Answers','foreignKey':_0x9f60('0x201')});db[_0x9f60('0x106')][_0x9f60('0x113')](db[_0x9f60('0x202')],{'as':'Messages','foreignKey':_0x9f60('0x201')});db[_0x9f60('0x106')][_0x9f60('0x113')](db[_0x9f60('0x109')],{'as':_0x9f60('0x171')});db[_0x9f60('0x106')]['hasMany'](db[_0x9f60('0x203')],{'as':'Applications'});db['WhatsappAccount'][_0x9f60('0x157')](db[_0x9f60('0x128')],{'as':_0x9f60('0x173'),'foreignKey':'ListId'});db[_0x9f60('0x106')][_0x9f60('0x157')](db[_0x9f60('0x8d')],{'as':_0x9f60('0x15b'),'foreignKey':'mandatoryDispositionPauseId'});db['WhatsappAccount'][_0x9f60('0x123')](db[_0x9f60('0x14')],{'as':_0x9f60('0x15e'),'through':_0x9f60('0x146')});db[_0x9f60('0x203')]['belongsTo'](db['User'],{'onDelete':_0x9f60('0x182')});db[_0x9f60('0x203')][_0x9f60('0x157')](db[_0x9f60('0x139')],{'onDelete':'restrict'});db[_0x9f60('0x203')][_0x9f60('0x157')](db[_0x9f60('0x106')],{'onDelete':_0x9f60('0x182')});db[_0x9f60('0x203')][_0x9f60('0x157')](db[_0x9f60('0x8b')],{'onDelete':_0x9f60('0x182'),'foreignKey':_0x9f60('0x15a')});db[_0x9f60('0x203')]['belongsTo'](db[_0x9f60('0x95')],{'onDelete':'restrict','foreignKey':_0x9f60('0x183')});db[_0x9f60('0x109')][_0x9f60('0x113')](db[_0x9f60('0x202')],{'as':_0x9f60('0x170'),'onDelete':_0x9f60('0x14b'),'foreignKey':_0x9f60('0x204')});db[_0x9f60('0x109')][_0x9f60('0x157')](db[_0x9f60('0x106')],{'as':_0x9f60('0x177'),'foreignKey':'WhatsappAccountId'});db['WhatsappInteraction'][_0x9f60('0x157')](db[_0x9f60('0x78')],{'as':_0x9f60('0x178'),'foreignKey':'ContactId'});db[_0x9f60('0x109')][_0x9f60('0x157')](db[_0x9f60('0x14')],{'as':_0x9f60('0x17a'),'foreignKey':'UserId'});db[_0x9f60('0x109')]['belongsToMany'](db[_0x9f60('0x95')],{'through':_0x9f60('0x1b6'),'as':'Tags'});db[_0x9f60('0x109')][_0x9f60('0x123')](db[_0x9f60('0x95')],{'through':_0x9f60('0x1b6'),'as':_0x9f60('0x17d')});db[_0x9f60('0x109')][_0x9f60('0x123')](db[_0x9f60('0x14')],{'as':_0x9f60('0x190'),'through':'user_has_whatsapp_interactions','foreignKey':_0x9f60('0x204')});db[_0x9f60('0x202')]['belongsTo'](db[_0x9f60('0x14')],{'as':_0x9f60('0x14')});db[_0x9f60('0x202')][_0x9f60('0x157')](db[_0x9f60('0x78')],{'onDelete':_0x9f60('0x14b'),'as':_0x9f60('0x178')});db['WhatsappMessage'][_0x9f60('0x157')](db[_0x9f60('0x109')],{'onDelete':_0x9f60('0x14b'),'as':_0x9f60('0x17f'),'foreignKey':_0x9f60('0x204')});db[_0x9f60('0x202')]['belongsTo'](db['WhatsappAccount'],{'as':_0x9f60('0x177'),'foreignKey':_0x9f60('0x201')});db['WhatsappQueueReport'][_0x9f60('0x157')](db['WhatsappAccount'],{});db[_0x9f60('0x10b')][_0x9f60('0x157')](db[_0x9f60('0x128')],{'as':_0x9f60('0x173'),'foreignKey':'ListId'});db[_0x9f60('0x10b')][_0x9f60('0x157')](db[_0x9f60('0x78')],{'as':_0x9f60('0x178'),'foreignKey':_0x9f60('0x179')});db[_0x9f60('0x10b')]['belongsTo'](db[_0x9f60('0x109')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x9f60('0x139')],{});db[_0x9f60('0x10b')][_0x9f60('0x157')](db['WhatsappMessage'],{});db[_0x9f60('0x10b')]['belongsTo'](db[_0x9f60('0x14')],{});db[_0x9f60('0x10c')][_0x9f60('0x157')](db[_0x9f60('0x202')],{});db[_0x9f60('0x10c')]['belongsTo'](db[_0x9f60('0x109')],{});db[_0x9f60('0x10c')][_0x9f60('0x157')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x9f60('0x1e7')});db['WhatsappTransferReport'][_0x9f60('0x157')](db[_0x9f60('0x106')],{'foreignKey':_0x9f60('0x205'),'as':_0x9f60('0x1ed')});db[_0x9f60('0x10c')][_0x9f60('0x157')](db[_0x9f60('0x139')],{'foreignKey':'ToQueueId','as':_0x9f60('0x1eb')});db[_0x9f60('0x10c')]['belongsTo'](db['User'],{'foreignKey':_0x9f60('0x1ef'),'as':_0x9f60('0x1e8')});db['WhatsappTransferReport'][_0x9f60('0x157')](db[_0x9f60('0x14')],{'foreignKey':'ToUserId','as':_0x9f60('0x1ea')});db[_0x9f60('0x139')][_0x9f60('0x123')](db['User'],{'as':'Agents','through':_0x9f60('0x3c'),'foreignKey':_0x9f60('0x206')});db['WhatsappQueue'][_0x9f60('0x123')](db[_0x9f60('0xed')],{'through':_0x9f60('0x1e2'),'as':_0x9f60('0x15f')});module[_0x9f60('0x207')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x749a=['OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','Agent','Queue','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatMessage','team_has_chat_queues','CompanyId','Phones','CmContactId','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','OwnerId','CampaignId','All','OneAll','AutomationAllId','Condition','Any','OneAny','AutomationAnyId','AutomationId','ParentId','ChatApplications','FaxApplications','SmsApplications','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','TriggerAnyId','Actions','TriggerId','Fields','DefaultReportId','MetricId','SalesforceConfiguration','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','AccountId','Subject','Description','Field','FieldId','Variable','VariableId','DeskConfiguration','int_desk_configuration_has_tags','ZohoAccount','ZohoField','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowAccount','Dynamics365Configuration','Dynamics365Field','SessionId','JscriptyProject','ProjectId','VoiceQueues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','Lists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','ChatOfflineMessageId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','HopperHistory','Queues','UserProfileSections','UserProfileSection','Resources','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','WhatsappQueueId','exports','path','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','motion2','xC@LL1234','mysql','name','utf8_general_ci','sequelizeHistory','xcall','127.0.0.1','utf8mb4','utf8','database','password','options','username','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','CannedAnswer','../api/disposition/disposition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','../api/team/team.model','Campaign','Migration','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','Realtime','../api/realtime/realtime.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','User','hasOne','VoiceMail','UserId','hasMany','Recordings','VoiceExtension','Extensions','cascade','HopperFinals','OpenchannelInteractions','ChatInteraction','ChatInteractions','FaxInteractions','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','Team','user_has_teams','MailInteractions','user_has_mail_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','WhatsappInteractions','user_has_whatsapp_interactions','MailQueues','UserMailQueue','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','VoicePrefix','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','Applications','Sounds','Hoppers','VoiceQueueId','CmHopperFinal','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceCallReport','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailServerIn','MailAccountId','Imap','Smtp','Disposition','Dispositions','Interactions','List','ListId','Template','TemplateId','mandatoryDispositionPauseId','Agents','MailInteractionId','Owner','mail_interaction_has_tags','ThroughTags','Attachments','Interaction','Account','ChatWebsiteId','restrict','TagId','Answers','FaxAccountId','Exntensions','FaxMessage','user_has_fax_accounts','FaxInteractionId','fax_interaction_has_tags','Tags','Users','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','SmsQueue','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues'];(function(_0x3684b4,_0x3d15f5){var _0x117abd=function(_0x5c8814){while(--_0x5c8814){_0x3684b4['push'](_0x3684b4['shift']());}};_0x117abd(++_0x3d15f5);}(_0x749a,0x73));var _0xa749=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x749a[_0x20a584];return _0x4b41a8;};'use strict';var path=require(_0xa749('0x0'));var config=require(_0xa749('0x1'));var Sequelize=require(_0xa749('0x2'));var _=require(_0xa749('0x3'));var jstz=require(_0xa749('0x4'));var timezone=jstz[_0xa749('0x5')]();config[_0xa749('0x2')]=_[_0xa749('0x6')](config['sequelize'],{'database':_0xa749('0x7'),'username':'xcall','password':_0xa749('0x8'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xa749('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xa749('0xa')](),'define':{'charset':'utf8','collate':_0xa749('0xb')}}});config['sequelizeHistory']=_[_0xa749('0x6')](config[_0xa749('0xc')],{'database':_0xa749('0x7'),'username':_0xa749('0xd'),'password':_0xa749('0x8'),'options':{'host':_0xa749('0xe'),'port':0xcea,'dialect':_0xa749('0x9'),'dialectOptions':{'charset':_0xa749('0xf')},'logging':![],'timezone':timezone[_0xa749('0xa')](),'define':{'charset':_0xa749('0x10'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa749('0x2')][_0xa749('0x11')],config[_0xa749('0x2')]['username'],config[_0xa749('0x2')][_0xa749('0x12')],config[_0xa749('0x2')][_0xa749('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xa749('0xc')][_0xa749('0x11')],config[_0xa749('0xc')][_0xa749('0x14')],config['sequelizeHistory']['password'],config['sequelizeHistory']['options'])};db['User']=db[_0xa749('0x2')][_0xa749('0x15')]('../api/user/user.model');db[_0xa749('0x16')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x17'));db[_0xa749('0x18')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xa749('0x2')][_0xa749('0x15')]('../api/voiceExtension/voiceExtension.model');db[_0xa749('0x19')]=db[_0xa749('0x2')]['import'](_0xa749('0x1a'));db[_0xa749('0x1b')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x1c'));db[_0xa749('0x1d')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x1e'));db[_0xa749('0x1f')]=db[_0xa749('0x2')]['import']('../api/screenRecording/screenRecording.model');db['VoiceMail']=db[_0xa749('0x2')]['import']('../api/voiceMail/voiceMail.model');db[_0xa749('0x20')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x21'));db['VoiceCallReport']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x22'));db[_0xa749('0x23')]=db[_0xa749('0x2')]['import']('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x24'));db[_0xa749('0x25')]=db['sequelize']['import'](_0xa749('0x26'));db['MemberReport']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x27'));db[_0xa749('0x28')]=db[_0xa749('0x2')]['import'](_0xa749('0x29'));db[_0xa749('0x2a')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x2b'));db[_0xa749('0x2c')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x2d'));db[_0xa749('0x2e')]=db[_0xa749('0x2')]['import']('../api/userVoiceQueue/userVoiceQueue.model');db[_0xa749('0x2f')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x30'));db['UserMailQueue']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x31'));db[_0xa749('0x32')]=db['sequelize']['import'](_0xa749('0x33'));db[_0xa749('0x34')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x35'));db[_0xa749('0x36')]=db[_0xa749('0x2')]['import'](_0xa749('0x37'));db[_0xa749('0x38')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x39'));db['MailServerIn']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x3a'));db[_0xa749('0x3b')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/mailServerOut/mailServerOut.model');db[_0xa749('0x3c')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/mailAccount/mailAccount.model');db[_0xa749('0x3d')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x3e'));db[_0xa749('0x3f')]=db['sequelize'][_0xa749('0x15')]('../api/mailSubstatus/mailSubstatus.model');db[_0xa749('0x40')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x41'));db[_0xa749('0x42')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x43'));db[_0xa749('0x44')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x45'));db[_0xa749('0x46')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x47'));db[_0xa749('0x48')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/dashboard/dashboard.model');db[_0xa749('0x49')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/dashboardItem/dashboardItem.model');db[_0xa749('0x4a')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x4b'));db[_0xa749('0x4c')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x4d'));db[_0xa749('0x4e')]=db['sequelize']['import'](_0xa749('0x4f'));db['FaxMessage']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x50'));db[_0xa749('0x51')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x52'));db['FaxQueueReport']=db[_0xa749('0x2')]['import'](_0xa749('0x53'));db[_0xa749('0x54')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x55'));db[_0xa749('0x56')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x57'));db[_0xa749('0x58')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x59'));db['SmsMessage']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x5a'));db['SmsQueue']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x5b'));db[_0xa749('0x5c')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x5d'));db[_0xa749('0x5e')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/openchannelApplication/openchannelApplication.model');db[_0xa749('0x5f')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x60'));db[_0xa749('0x61')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/openchannelMessage/openchannelMessage.model');db[_0xa749('0x62')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x63'));db[_0xa749('0x64')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x65'));db[_0xa749('0x66')]=db['sequelize'][_0xa749('0x15')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xa749('0x67')]=db['sequelize']['import'](_0xa749('0x68'));db['ChatInteraction']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x69'));db['ChatMessage']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x6a'));db[_0xa749('0x6b')]=db[_0xa749('0x2')]['import'](_0xa749('0x6c'));db[_0xa749('0x6d')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x6e'));db[_0xa749('0x6f')]=db[_0xa749('0x2')]['import'](_0xa749('0x70'));db[_0xa749('0x71')]=db['sequelize'][_0xa749('0x15')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0xa749('0x72')]=db['sequelize'][_0xa749('0x15')]('../api/cmCompany/cmCompany.model');db[_0xa749('0x73')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x74'));db[_0xa749('0x75')]=db[_0xa749('0x2')]['import'](_0xa749('0x76'));db[_0xa749('0x77')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x78'));db['CmHopperFinal']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x79'));db[_0xa749('0x7a')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x7b'));db[_0xa749('0x7c')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xa749('0x7d')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x7e'));db[_0xa749('0x7f')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x80'));db[_0xa749('0x81')]=db[_0xa749('0x2')]['import']('../api/automation/automation.model');db[_0xa749('0x82')]=db[_0xa749('0x2')]['import']('../api/cannedAnswer/cannedAnswer.model');db['Disposition']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x83'));db['Condition']=db['sequelize'][_0xa749('0x15')]('../api/condition/condition.model');db[_0xa749('0x84')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x85'));db[_0xa749('0x86')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x87'));db[_0xa749('0x88')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x89'));db[_0xa749('0x8a')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x8b'));db[_0xa749('0x8c')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/schedule/schedule.model');db[_0xa749('0x8d')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x8e'));db[_0xa749('0x8f')]=db['sequelize'][_0xa749('0x15')]('../api/tag/tag.model');db[_0xa749('0x90')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/contactItemType/contactItemType.model');db[_0xa749('0x91')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x92'));db['CmHopperAdditionalPhone']=db['sequelize'][_0xa749('0x15')](_0xa749('0x93'));db['Template']=db[_0xa749('0x2')][_0xa749('0x15')]('../api/template/template.model');db[_0xa749('0x94')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x95'));db['Variable']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x96'));db[_0xa749('0x97')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x98'));db[_0xa749('0x99')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x9a'));db[_0xa749('0x9b')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x9c'));db[_0xa749('0x9d')]=db[_0xa749('0x2')]['import']('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xa749('0x9e')]=db[_0xa749('0x2')]['import'](_0xa749('0x9f'));db[_0xa749('0xa0')]=db[_0xa749('0x2')]['import'](_0xa749('0xa1'));db[_0xa749('0xa2')]=db['sequelize'][_0xa749('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xa749('0xa3')]=db['sequelize']['import'](_0xa749('0xa4'));db[_0xa749('0xa5')]=db[_0xa749('0x2')]['import'](_0xa749('0xa6'));db['SalesforceConfiguration']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xa7'));db[_0xa749('0xa8')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xa9'));db[_0xa749('0xaa')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xab'));db[_0xa749('0xac')]=db['sequelize']['import'](_0xa749('0xad'));db[_0xa749('0xae')]=db['sequelize'][_0xa749('0x15')](_0xa749('0xaf'));db[_0xa749('0xb0')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0xa749('0x2')]['import'](_0xa749('0xb1'));db[_0xa749('0xb2')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db['sequelize'][_0xa749('0x15')](_0xa749('0xb3'));db[_0xa749('0xb4')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xb5'));db['ZohoField']=db['sequelize'][_0xa749('0x15')]('../api/intZohoField/intZohoField.model');db[_0xa749('0xb6')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xb7'));db[_0xa749('0xb8')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xa749('0xb9')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xba'));db[_0xa749('0xbb')]=db['sequelize']['import'](_0xa749('0xbc'));db[_0xa749('0xbd')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xbe'));db[_0xa749('0xbf')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xc0'));db['VtigerAccount']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xc1'));db[_0xa749('0xc2')]=db[_0xa749('0x2')]['import']('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xa749('0xc3')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xc4'));db['ServicenowAccount']=db[_0xa749('0x2')][_0xa749('0x15')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xa749('0xc5')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xc6'));db[_0xa749('0xc7')]=db[_0xa749('0x2')]['import'](_0xa749('0xc8'));db[_0xa749('0xc9')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xca'));db['Dynamics365Configuration']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xcb'));db['Dynamics365Field']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xcc'));db[_0xa749('0xcd')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xce'));db[_0xa749('0xcf')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xd0'));db[_0xa749('0xd1')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xd2'));db[_0xa749('0x97')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x98'));db[_0xa749('0xd3')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/network/network.model');db[_0xa749('0xd4')]=db['sequelize'][_0xa749('0x15')](_0xa749('0xd5'));db[_0xa749('0xd6')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xd7'));db[_0xa749('0xd8')]=db['sequelize'][_0xa749('0x15')](_0xa749('0xd9'));db[_0xa749('0xda')]=db[_0xa749('0x2')]['import'](_0xa749('0xdb'));db[_0xa749('0xdc')]=db[_0xa749('0x2')]['import'](_0xa749('0xdd'));db[_0xa749('0xde')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/smsQueueReport/smsQueueReport.model');db[_0xa749('0xdf')]=db['sequelize'][_0xa749('0x15')]('../api/squareReport/squareReport.model');db[_0xa749('0xe0')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xe1'));db['JscriptyProject']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xe2'));db[_0xa749('0xe3')]=db['sequelize'][_0xa749('0x15')]('../api/setting/setting.model');db[_0xa749('0xe4')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xe5'));db[_0xa749('0xe6')]=db['sequelize'][_0xa749('0x15')]('../api/squareProject/squareProject.model');db[_0xa749('0xe7')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xe8'));db[_0xa749('0xe9')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xea'));db['Team']=db[_0xa749('0x2')]['import'](_0xa749('0xeb'));db['License']=db[_0xa749('0x2')][_0xa749('0x15')]('../api/license/license.model');db[_0xa749('0xec')]=db['sequelize']['import']('../api/campaign/campaign.model');db[_0xa749('0xed')]=db[_0xa749('0x2')]['import']('../api/migration/migration.model');db[_0xa749('0xee')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xef'));db[_0xa749('0xf0')]=db['sequelize'][_0xa749('0x15')](_0xa749('0xf1'));db[_0xa749('0xf2')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xf3'));db[_0xa749('0xf4')]=db['sequelize'][_0xa749('0x15')]('../api/chatTransferReport/chatTransferReport.model');db[_0xa749('0xf5')]=db[_0xa749('0x2')]['import'](_0xa749('0xf6'));db[_0xa749('0xf7')]=db['sequelize']['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db[_0xa749('0x2')]['import']('../api/smsTransferReport/smsTransferReport.model');db[_0xa749('0xf8')]=db['sequelize']['import'](_0xa749('0xf9'));db['VoicePrefix']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xfa'));db[_0xa749('0xfb')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/userProfile/userProfile.model');db['UserProfileSection']=db[_0xa749('0x2')][_0xa749('0x15')]('../api/userProfileSection/userProfileSection.model');db[_0xa749('0xfc')]=db['sequelize']['import'](_0xa749('0xfd'));db[_0xa749('0xfe')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0xff'));db[_0xa749('0x100')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x101'));db[_0xa749('0x102')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/whatsappApplication/whatsappApplication.model');db[_0xa749('0x103')]=db['sequelize'][_0xa749('0x15')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x104'));db[_0xa749('0x105')]=db['sequelize'][_0xa749('0x15')](_0xa749('0x106'));db[_0xa749('0x107')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x108'));db[_0xa749('0x109')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x10a'));db[_0xa749('0x10b')]=db[_0xa749('0x2')][_0xa749('0x15')]('../api/cloudProvider/cloudProvider.model');db[_0xa749('0x10c')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x10d'));db[_0xa749('0x10e')]=db[_0xa749('0x2')][_0xa749('0x15')](_0xa749('0x10f'));db[_0xa749('0x110')][_0xa749('0x111')](db[_0xa749('0x112')],{'as':_0xa749('0x112'),'onDelete':'cascade','foreignKey':_0xa749('0x113')});db[_0xa749('0x110')][_0xa749('0x114')](db[_0xa749('0x1d')],{'as':_0xa749('0x115'),'foreignKey':_0xa749('0x113')});db[_0xa749('0x110')][_0xa749('0x114')](db[_0xa749('0x2c')],{'as':'VoiceQueuesRt','foreignKey':_0xa749('0x113')});db[_0xa749('0x110')][_0xa749('0x114')](db[_0xa749('0x116')],{'as':_0xa749('0x117'),'onDelete':_0xa749('0x118'),'hooks':!![]});db[_0xa749('0x110')][_0xa749('0x114')](db['CmHopperFinal'],{'as':_0xa749('0x119'),'foreignKey':_0xa749('0x113')});db[_0xa749('0x110')][_0xa749('0x114')](db[_0xa749('0x7a')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xa749('0x110')][_0xa749('0x114')](db[_0xa749('0x7c')],{'as':_0xa749('0x7c'),'foreignKey':_0xa749('0x113')});db[_0xa749('0x110')]['hasMany'](db[_0xa749('0x5f')],{'as':_0xa749('0x11a'),'foreignKey':'UserId'});db[_0xa749('0x110')][_0xa749('0x114')](db[_0xa749('0x11b')],{'as':_0xa749('0x11c'),'foreignKey':'UserId'});db[_0xa749('0x110')][_0xa749('0x114')](db[_0xa749('0x58')],{'as':'SmsInteractions','foreignKey':_0xa749('0x113')});db[_0xa749('0x110')][_0xa749('0x114')](db[_0xa749('0x4e')],{'as':_0xa749('0x11d'),'foreignKey':'UserId'});db[_0xa749('0x110')]['hasMany'](db[_0xa749('0x40')],{'as':'MailInteractions','foreignKey':_0xa749('0x113')});db[_0xa749('0x110')][_0xa749('0x114')](db[_0xa749('0x103')],{'as':'WhatsappInteractions','foreignKey':_0xa749('0x113')});db['User'][_0xa749('0x114')](db[_0xa749('0xfe')],{'as':_0xa749('0x11e'),'foreignKey':_0xa749('0x11f')});db[_0xa749('0x110')][_0xa749('0x120')](db[_0xa749('0xfb')],{'as':_0xa749('0xfb'),'foreignKey':_0xa749('0x121')});db[_0xa749('0x110')][_0xa749('0x122')](db[_0xa749('0x6f')],{'as':_0xa749('0x123'),'through':_0xa749('0x124')});db[_0xa749('0x110')]['belongsToMany'](db['CmContact'],{'as':_0xa749('0x125'),'through':_0xa749('0x126')});db['User']['belongsToMany'](db['CmList'],{'as':'Lists','through':'cm_user_has_lists'});db[_0xa749('0x110')][_0xa749('0x122')](db[_0xa749('0x127')],{'through':_0xa749('0x128')});db[_0xa749('0x110')][_0xa749('0x122')](db[_0xa749('0x40')],{'as':_0xa749('0x129'),'through':_0xa749('0x12a')});db[_0xa749('0x110')][_0xa749('0x122')](db['ChatInteraction'],{'as':_0xa749('0x11c'),'through':'user_has_chat_interactions'});db[_0xa749('0x110')]['belongsToMany'](db[_0xa749('0x4e')],{'as':_0xa749('0x11d'),'through':_0xa749('0x12b')});db[_0xa749('0x110')][_0xa749('0x122')](db[_0xa749('0x58')],{'as':_0xa749('0x12c'),'through':_0xa749('0x12d')});db[_0xa749('0x110')][_0xa749('0x122')](db[_0xa749('0x5f')],{'as':_0xa749('0x11a'),'through':'user_has_openchannel_interactions'});db[_0xa749('0x110')][_0xa749('0x122')](db[_0xa749('0x103')],{'as':_0xa749('0x12e'),'through':_0xa749('0x12f')});db[_0xa749('0x110')][_0xa749('0x122')](db[_0xa749('0x1b')],{'as':'VoiceQueues','through':_0xa749('0x2e'),'required':![]});db['User'][_0xa749('0x122')](db[_0xa749('0x3d')],{'as':_0xa749('0x130'),'through':_0xa749('0x131'),'required':![]});db[_0xa749('0x110')]['belongsToMany'](db[_0xa749('0x6d')],{'as':_0xa749('0x132'),'through':_0xa749('0x2f'),'required':![],'hooks':!![]});db[_0xa749('0x110')][_0xa749('0x122')](db['FaxQueue'],{'as':_0xa749('0x133'),'through':_0xa749('0x32'),'required':![]});db[_0xa749('0x110')]['belongsToMany'](db['SmsQueue'],{'as':_0xa749('0x134'),'through':_0xa749('0x34'),'required':![]});db[_0xa749('0x110')][_0xa749('0x122')](db[_0xa749('0x62')],{'as':_0xa749('0x135'),'through':_0xa749('0x36'),'required':![]});db[_0xa749('0x110')][_0xa749('0x122')](db['WhatsappQueue'],{'as':_0xa749('0x136'),'through':_0xa749('0x38'),'required':![]});db[_0xa749('0x110')]['belongsToMany'](db[_0xa749('0xf8')],{'through':_0xa749('0x137')});db[_0xa749('0x110')][_0xa749('0x122')](db[_0xa749('0x138')],{'as':_0xa749('0x139'),'through':_0xa749('0x13a'),'required':![]});db[_0xa749('0x110')]['belongsToMany'](db['ChatWebsite'],{'as':_0xa749('0x13b'),'through':_0xa749('0x13c')});db['User'][_0xa749('0x122')](db[_0xa749('0x4a')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0xa749('0x110')]['belongsToMany'](db[_0xa749('0x3c')],{'as':_0xa749('0x13d'),'through':_0xa749('0x13e')});db['User']['belongsToMany'](db[_0xa749('0x5c')],{'as':'OpenchannelAccounts','through':_0xa749('0x13f')});db[_0xa749('0x110')][_0xa749('0x122')](db['SmsAccount'],{'as':_0xa749('0x140'),'through':'user_has_sms_accounts'});db[_0xa749('0x110')][_0xa749('0x122')](db[_0xa749('0x100')],{'as':_0xa749('0x141'),'through':_0xa749('0x142')});db[_0xa749('0x110')][_0xa749('0x122')](db[_0xa749('0xe6')],{'as':_0xa749('0x143'),'through':_0xa749('0x144')});db[_0xa749('0x16')][_0xa749('0x114')](db[_0xa749('0x116')],{'as':'SpiedAgents','onDelete':_0xa749('0x118'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0xa749('0x114')](db['VoiceExtension'],{'onDelete':_0xa749('0x118')});db['VoiceExtension']['hasMany'](db['VoiceExtension'],{'as':_0xa749('0x145'),'onDelete':_0xa749('0x118')});db[_0xa749('0x19')]['belongsToMany'](db[_0xa749('0x8d')],{'as':_0xa749('0x146'),'through':'moh_has_sounds'});db[_0xa749('0x1b')]['hasMany'](db[_0xa749('0x2c')],{'as':'Members','foreignKey':'VoiceQueueId'});db[_0xa749('0x1b')][_0xa749('0x114')](db[_0xa749('0x75')],{'as':_0xa749('0x147'),'foreignKey':_0xa749('0x148')});db['VoiceQueue'][_0xa749('0x114')](db[_0xa749('0x149')],{'as':'HopperFinals','foreignKey':'VoiceQueueId'});db[_0xa749('0x1b')][_0xa749('0x114')](db[_0xa749('0x7a')],{'as':_0xa749('0x14a'),'foreignKey':_0xa749('0x148')});db[_0xa749('0x1b')][_0xa749('0x114')](db[_0xa749('0x7c')],{'as':'ReportAgentPreview','foreignKey':'VoiceQueueId'});db[_0xa749('0x1b')]['hasMany'](db[_0xa749('0x77')],{'as':_0xa749('0x14b'),'foreignKey':_0xa749('0x148')});db[_0xa749('0x1b')][_0xa749('0x114')](db[_0xa749('0xdc')],{'as':_0xa749('0x14c'),'foreignKey':_0xa749('0x148')});db[_0xa749('0x1b')][_0xa749('0x120')](db[_0xa749('0x28')],{'as':'Trunk','foreignKey':_0xa749('0x14d')});db[_0xa749('0x1b')][_0xa749('0x120')](db['Trunk'],{'as':_0xa749('0x14e'),'foreignKey':'TrunkBackupId'});db[_0xa749('0x1b')][_0xa749('0x120')](db[_0xa749('0x84')],{'as':_0xa749('0x84'),'foreignKey':_0xa749('0x14f')});db[_0xa749('0x1b')][_0xa749('0x120')](db['Pause'],{'as':_0xa749('0x150'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xa749('0x1b')][_0xa749('0x122')](db[_0xa749('0xf8')],{'as':'Lists','through':_0xa749('0x151')});db[_0xa749('0x1b')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':'Agents','through':'UserVoiceQueue'});db[_0xa749('0x1b')][_0xa749('0x122')](db[_0xa749('0x127')],{'as':_0xa749('0x152'),'through':_0xa749('0x10e')});db[_0xa749('0x1b')]['belongsToMany'](db[_0xa749('0xf8')],{'as':_0xa749('0x153'),'through':_0xa749('0x154')});db['VoiceRecording']['belongsTo'](db[_0xa749('0x110')],{'as':'User','foreignKey':'UserId'});db[_0xa749('0x1f')][_0xa749('0x120')](db[_0xa749('0x110')],{'as':_0xa749('0x110'),'foreignKey':'UserId'});db[_0xa749('0x112')][_0xa749('0x114')](db[_0xa749('0x20')],{'as':_0xa749('0x155'),'onDelete':'cascade','foreignKey':_0xa749('0x156'),'sourceKey':'mailbox'});db['VoiceMailMessage'][_0xa749('0x120')](db[_0xa749('0x112')],{'foreignKey':_0xa749('0x156'),'targetKey':_0xa749('0x157')});db[_0xa749('0x158')][_0xa749('0x114')](db[_0xa749('0x25')],{'as':'QueueCalls','foreignKey':_0xa749('0x159'),'constraints':![]});db['VoiceCallReport'][_0xa749('0x114')](db[_0xa749('0x15a')],{'as':_0xa749('0x15b'),'foreignKey':_0xa749('0x159'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0xa749('0x110')],{'as':'User','foreignKey':'UserId'});db[_0xa749('0x158')][_0xa749('0x120')](db['CmContact'],{'as':_0xa749('0x15c'),'foreignKey':_0xa749('0x15d')});db[_0xa749('0x15e')]['belongsTo'](db[_0xa749('0x3c')],{'as':_0xa749('0x3c'),'foreignKey':'MailAccountId'});db[_0xa749('0x3b')]['belongsTo'](db[_0xa749('0x3c')],{'as':_0xa749('0x3c'),'foreignKey':_0xa749('0x15f')});db['MailAccount'][_0xa749('0x111')](db[_0xa749('0x15e')],{'as':_0xa749('0x160'),'onDelete':_0xa749('0x118')});db[_0xa749('0x3c')][_0xa749('0x111')](db['MailServerOut'],{'as':_0xa749('0x161'),'onDelete':_0xa749('0x118')});db[_0xa749('0x3c')][_0xa749('0x114')](db[_0xa749('0x162')],{'as':_0xa749('0x163'),'foreignKey':_0xa749('0x15f'),'onDelete':'cascade'});db[_0xa749('0x3c')]['hasMany'](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xa749('0x15f')});db[_0xa749('0x3c')][_0xa749('0x114')](db[_0xa749('0x42')],{'as':'Messages','foreignKey':_0xa749('0x15f')});db[_0xa749('0x3c')][_0xa749('0x114')](db['MailInteraction'],{'as':_0xa749('0x164')});db[_0xa749('0x3c')][_0xa749('0x114')](db[_0xa749('0x44')],{'as':'Applications'});db[_0xa749('0x3c')][_0xa749('0x120')](db[_0xa749('0xf8')],{'as':_0xa749('0x165'),'foreignKey':_0xa749('0x166')});db[_0xa749('0x3c')]['belongsTo'](db[_0xa749('0x167')],{'as':'Template','foreignKey':_0xa749('0x168')});db['MailAccount']['belongsTo'](db['Pause'],{'as':_0xa749('0x150'),'foreignKey':_0xa749('0x169')});db['MailAccount'][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x16a'),'through':_0xa749('0x13e')});db[_0xa749('0x3d')][_0xa749('0x122')](db['User'],{'as':'Agents','through':_0xa749('0x131')});db[_0xa749('0x3d')][_0xa749('0x122')](db['Team'],{'through':'team_has_mail_queues','as':_0xa749('0x152')});db[_0xa749('0x40')][_0xa749('0x114')](db[_0xa749('0x42')],{'as':_0xa749('0x155'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x16b')});db[_0xa749('0x40')][_0xa749('0x120')](db[_0xa749('0x3c')],{'as':'Account','foreignKey':'MailAccountId'});db[_0xa749('0x40')][_0xa749('0x120')](db[_0xa749('0x73')],{'as':_0xa749('0x15c'),'foreignKey':_0xa749('0x15d')});db['MailInteraction'][_0xa749('0x120')](db[_0xa749('0x110')],{'as':_0xa749('0x16c'),'foreignKey':_0xa749('0x113')});db[_0xa749('0x40')][_0xa749('0x122')](db['Tag'],{'through':_0xa749('0x16d'),'as':'Tags'});db['MailInteraction'][_0xa749('0x122')](db[_0xa749('0x8f')],{'through':_0xa749('0x16d'),'as':_0xa749('0x16e')});db[_0xa749('0x40')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':'Users','through':_0xa749('0x12a'),'foreignKey':_0xa749('0x16b')});db[_0xa749('0x42')][_0xa749('0x114')](db[_0xa749('0xee')],{'as':_0xa749('0x16f'),'onDelete':_0xa749('0x118')});db[_0xa749('0x42')][_0xa749('0x120')](db[_0xa749('0x110')],{'as':_0xa749('0x110')});db['MailMessage'][_0xa749('0x120')](db[_0xa749('0x73')],{'onDelete':_0xa749('0x118'),'as':'Contact'});db[_0xa749('0x42')]['belongsTo'](db[_0xa749('0x40')],{'as':_0xa749('0x170'),'foreignKey':_0xa749('0x16b')});db['MailMessage'][_0xa749('0x120')](db['MailAccount'],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x15f')});db[_0xa749('0x42')][_0xa749('0x120')](db['ChatWebsite'],{'as':_0xa749('0x64'),'foreignKey':_0xa749('0x172')});db[_0xa749('0x42')][_0xa749('0x120')](db[_0xa749('0x6b')],{'as':_0xa749('0x6b'),'foreignKey':'ChatOfflineMessageId'});db['MailApplication'][_0xa749('0x120')](db[_0xa749('0x110')],{'onDelete':_0xa749('0x173')});db[_0xa749('0x44')][_0xa749('0x120')](db[_0xa749('0x3d')],{'onDelete':_0xa749('0x173')});db[_0xa749('0x44')][_0xa749('0x120')](db[_0xa749('0x3c')],{'onDelete':_0xa749('0x173')});db[_0xa749('0x44')][_0xa749('0x120')](db['Interval'],{'onDelete':_0xa749('0x173'),'foreignKey':_0xa749('0x14f')});db[_0xa749('0x44')]['belongsTo'](db['Tag'],{'onDelete':_0xa749('0x173'),'foreignKey':_0xa749('0x174')});db[_0xa749('0x46')]['belongsTo'](db[_0xa749('0x3c')],{});db['MailQueueReport']['belongsTo'](db[_0xa749('0xf8')],{'as':_0xa749('0x165'),'foreignKey':'ListId'});db[_0xa749('0x46')]['belongsTo'](db[_0xa749('0x73')],{'as':'Contact','foreignKey':_0xa749('0x15d')});db[_0xa749('0x46')][_0xa749('0x120')](db[_0xa749('0x40')],{});db['MailQueueReport'][_0xa749('0x120')](db[_0xa749('0x42')],{});db['MailQueueReport'][_0xa749('0x120')](db[_0xa749('0x110')],{});db[_0xa749('0x46')][_0xa749('0x120')](db[_0xa749('0x3d')],{});db[_0xa749('0x48')]['hasMany'](db[_0xa749('0x49')],{'as':'Items','onDelete':_0xa749('0x118')});db[_0xa749('0x4a')]['hasMany'](db[_0xa749('0x162')],{'as':_0xa749('0x163'),'foreignKey':'FaxAccountId','onDelete':_0xa749('0x118')});db[_0xa749('0x4a')][_0xa749('0x114')](db[_0xa749('0x82')],{'as':_0xa749('0x175'),'foreignKey':_0xa749('0x176')});db[_0xa749('0x4a')][_0xa749('0x114')](db[_0xa749('0x4e')],{'as':'Interactions'});db[_0xa749('0x4a')][_0xa749('0x114')](db[_0xa749('0x4c')],{'as':'Applications'});db[_0xa749('0x4a')][_0xa749('0x114')](db[_0xa749('0x116')],{'as':_0xa749('0x177'),'onDelete':_0xa749('0x118')});db[_0xa749('0x4a')][_0xa749('0x114')](db[_0xa749('0x178')],{'as':_0xa749('0x155')});db[_0xa749('0x4a')]['belongsTo'](db[_0xa749('0x28')],{'as':_0xa749('0x28')});db[_0xa749('0x4a')][_0xa749('0x120')](db[_0xa749('0xf8')],{'as':'List','foreignKey':_0xa749('0x166')});db[_0xa749('0x4a')][_0xa749('0x120')](db[_0xa749('0x86')],{'as':_0xa749('0x150'),'foreignKey':_0xa749('0x169')});db[_0xa749('0x4a')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x16a'),'through':_0xa749('0x179')});db[_0xa749('0x4c')][_0xa749('0x120')](db['User'],{'onDelete':_0xa749('0x173')});db[_0xa749('0x4c')][_0xa749('0x120')](db[_0xa749('0x51')],{'onDelete':_0xa749('0x173')});db['FaxApplication'][_0xa749('0x120')](db[_0xa749('0x4a')],{'onDelete':_0xa749('0x173')});db[_0xa749('0x4c')]['belongsTo'](db['Tag'],{'onDelete':_0xa749('0x173'),'foreignKey':_0xa749('0x174')});db[_0xa749('0x4e')][_0xa749('0x114')](db[_0xa749('0x178')],{'as':_0xa749('0x155'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x17a')});db[_0xa749('0x4e')][_0xa749('0x120')](db[_0xa749('0x4a')],{'as':'Account','foreignKey':_0xa749('0x176')});db[_0xa749('0x4e')][_0xa749('0x120')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xa749('0x4e')]['belongsTo'](db[_0xa749('0x110')],{'as':'Owner','foreignKey':'UserId'});db[_0xa749('0x4e')][_0xa749('0x122')](db[_0xa749('0x8f')],{'through':_0xa749('0x17b'),'as':_0xa749('0x17c')});db[_0xa749('0x4e')]['belongsToMany'](db[_0xa749('0x8f')],{'through':_0xa749('0x17b'),'as':_0xa749('0x16e')});db[_0xa749('0x4e')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x17d'),'through':_0xa749('0x12b'),'foreignKey':_0xa749('0x17a')});db['FaxMessage'][_0xa749('0x120')](db[_0xa749('0x110')],{'onDelete':_0xa749('0x118'),'as':_0xa749('0x110')});db[_0xa749('0x178')]['belongsTo'](db[_0xa749('0x4e')],{'as':_0xa749('0x170'),'foreignKey':_0xa749('0x17a')});db['FaxMessage'][_0xa749('0x120')](db[_0xa749('0x73')],{'onDelete':_0xa749('0x118'),'as':_0xa749('0x15c')});db[_0xa749('0x178')][_0xa749('0x120')](db[_0xa749('0xee')],{'as':'Attachment','foreignKey':_0xa749('0x17e')});db[_0xa749('0x178')]['belongsTo'](db[_0xa749('0x4a')],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x176')});db[_0xa749('0x51')][_0xa749('0x122')](db['User'],{'as':_0xa749('0x16a'),'through':_0xa749('0x32')});db[_0xa749('0x51')]['belongsToMany'](db[_0xa749('0x127')],{'through':_0xa749('0x17f'),'as':_0xa749('0x152')});db['FaxQueueReport'][_0xa749('0x120')](db['FaxAccount'],{});db[_0xa749('0x180')][_0xa749('0x120')](db[_0xa749('0xf8')],{'as':_0xa749('0x165'),'foreignKey':_0xa749('0x166')});db[_0xa749('0x180')][_0xa749('0x120')](db[_0xa749('0x73')],{'as':_0xa749('0x15c'),'foreignKey':'ContactId'});db[_0xa749('0x180')][_0xa749('0x120')](db[_0xa749('0x4e')],{});db[_0xa749('0x180')][_0xa749('0x120')](db[_0xa749('0x178')],{});db['FaxQueueReport']['belongsTo'](db['User'],{});db['FaxQueueReport'][_0xa749('0x120')](db[_0xa749('0x51')],{});db['SmsAccount'][_0xa749('0x114')](db[_0xa749('0x162')],{'as':'Dispositions','foreignKey':_0xa749('0x181'),'onDelete':'cascade'});db[_0xa749('0x54')]['hasMany'](db[_0xa749('0x82')],{'as':_0xa749('0x175'),'foreignKey':_0xa749('0x181')});db[_0xa749('0x54')][_0xa749('0x114')](db[_0xa749('0x182')],{'as':_0xa749('0x155'),'foreignKey':_0xa749('0x181')});db[_0xa749('0x54')][_0xa749('0x114')](db[_0xa749('0x58')],{'as':_0xa749('0x164')});db[_0xa749('0x54')][_0xa749('0x114')](db[_0xa749('0x56')],{'as':_0xa749('0x145')});db[_0xa749('0x54')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xa749('0x54')][_0xa749('0x120')](db[_0xa749('0x86')],{'as':_0xa749('0x150'),'foreignKey':_0xa749('0x169')});db[_0xa749('0x54')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x16a'),'through':'user_has_sms_accounts'});db[_0xa749('0x56')][_0xa749('0x120')](db[_0xa749('0x110')],{'onDelete':_0xa749('0x173')});db[_0xa749('0x56')][_0xa749('0x120')](db[_0xa749('0x183')],{'onDelete':_0xa749('0x173')});db[_0xa749('0x56')][_0xa749('0x120')](db[_0xa749('0x54')],{'onDelete':_0xa749('0x173')});db[_0xa749('0x56')][_0xa749('0x120')](db[_0xa749('0x84')],{'onDelete':_0xa749('0x173'),'foreignKey':_0xa749('0x14f')});db[_0xa749('0x56')][_0xa749('0x120')](db[_0xa749('0x8f')],{'onDelete':_0xa749('0x173'),'foreignKey':_0xa749('0x174')});db['SmsInteraction'][_0xa749('0x114')](db[_0xa749('0x182')],{'as':_0xa749('0x155'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x184')});db[_0xa749('0x58')][_0xa749('0x120')](db[_0xa749('0x54')],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x181')});db[_0xa749('0x58')][_0xa749('0x120')](db[_0xa749('0x73')],{'as':_0xa749('0x15c'),'foreignKey':_0xa749('0x15d')});db['SmsInteraction'][_0xa749('0x120')](db[_0xa749('0x110')],{'as':_0xa749('0x16c'),'foreignKey':_0xa749('0x113')});db['SmsInteraction'][_0xa749('0x122')](db[_0xa749('0x8f')],{'through':'sms_interaction_has_tags','as':_0xa749('0x17c')});db[_0xa749('0x58')][_0xa749('0x122')](db[_0xa749('0x8f')],{'through':_0xa749('0x185'),'as':_0xa749('0x16e')});db[_0xa749('0x58')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x17d'),'through':_0xa749('0x12d'),'foreignKey':'SmsInteractionId'});db[_0xa749('0x182')][_0xa749('0x120')](db[_0xa749('0x110')],{'as':_0xa749('0x110')});db[_0xa749('0x182')][_0xa749('0x120')](db[_0xa749('0x73')],{'onDelete':'cascade','as':'Contact'});db[_0xa749('0x182')]['belongsTo'](db[_0xa749('0x58')],{'onDelete':_0xa749('0x118'),'as':_0xa749('0x170'),'foreignKey':_0xa749('0x184')});db[_0xa749('0x182')][_0xa749('0x120')](db['SmsAccount'],{'as':'Account','foreignKey':_0xa749('0x181')});db['SmsQueue'][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x16a'),'through':_0xa749('0x34'),'foreignKey':_0xa749('0x186')});db[_0xa749('0x183')][_0xa749('0x122')](db['Team'],{'through':_0xa749('0x187'),'as':'Teams'});db[_0xa749('0x5c')][_0xa749('0x114')](db[_0xa749('0x162')],{'as':_0xa749('0x163'),'foreignKey':_0xa749('0x188'),'onDelete':_0xa749('0x118')});db[_0xa749('0x5c')][_0xa749('0x114')](db[_0xa749('0x82')],{'as':'Answers','foreignKey':_0xa749('0x188')});db[_0xa749('0x5c')][_0xa749('0x114')](db[_0xa749('0x5f')],{'as':'Interactions','foreignKey':_0xa749('0x188')});db[_0xa749('0x5c')][_0xa749('0x114')](db[_0xa749('0x61')],{'as':_0xa749('0x155'),'foreignKey':_0xa749('0x188')});db[_0xa749('0x5c')][_0xa749('0x114')](db[_0xa749('0x5e')],{'as':_0xa749('0x145'),'foreignKey':_0xa749('0x188')});db['OpenchannelAccount'][_0xa749('0x120')](db[_0xa749('0xf8')],{'as':_0xa749('0x165'),'foreignKey':_0xa749('0x166')});db[_0xa749('0x5c')][_0xa749('0x120')](db[_0xa749('0x86')],{'as':_0xa749('0x150'),'foreignKey':_0xa749('0x169')});db[_0xa749('0x5c')][_0xa749('0x122')](db['User'],{'as':_0xa749('0x16a'),'through':_0xa749('0x13f')});db[_0xa749('0x5e')][_0xa749('0x120')](db['User'],{'onDelete':'restrict'});db[_0xa749('0x5e')][_0xa749('0x120')](db[_0xa749('0x62')],{'onDelete':_0xa749('0x173'),'foreignKey':_0xa749('0x189')});db[_0xa749('0x5e')]['belongsTo'](db[_0xa749('0x5c')],{'onDelete':_0xa749('0x173'),'foreignKey':_0xa749('0x188')});db[_0xa749('0x5e')][_0xa749('0x120')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xa749('0x14f')});db[_0xa749('0x5e')][_0xa749('0x120')](db[_0xa749('0x8f')],{'onDelete':_0xa749('0x173'),'foreignKey':_0xa749('0x174')});db[_0xa749('0x5f')][_0xa749('0x114')](db[_0xa749('0x61')],{'as':'Messages','onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x18a')});db[_0xa749('0x5f')][_0xa749('0x120')](db[_0xa749('0x5c')],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x188')});db[_0xa749('0x5f')][_0xa749('0x120')](db[_0xa749('0x73')],{'as':'Contact','foreignKey':_0xa749('0x15d')});db[_0xa749('0x5f')][_0xa749('0x120')](db[_0xa749('0x110')],{'as':_0xa749('0x16c'),'foreignKey':'UserId'});db[_0xa749('0x5f')][_0xa749('0x122')](db[_0xa749('0x8f')],{'through':_0xa749('0x18b'),'as':_0xa749('0x17c')});db[_0xa749('0x5f')][_0xa749('0x122')](db[_0xa749('0x8f')],{'through':'openchannel_interaction_has_tags','as':_0xa749('0x16e')});db['OpenchannelInteraction'][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x17d'),'through':_0xa749('0x18c'),'foreignKey':_0xa749('0x18a')});db['OpenchannelMessage'][_0xa749('0x120')](db['User'],{'onDelete':_0xa749('0x118'),'as':_0xa749('0x110')});db[_0xa749('0x61')][_0xa749('0x120')](db[_0xa749('0x73')],{'onDelete':'cascade','as':_0xa749('0x15c')});db[_0xa749('0x61')][_0xa749('0x120')](db[_0xa749('0x5f')],{'onDelete':'cascade','as':_0xa749('0x170'),'foreignKey':_0xa749('0x18a')});db[_0xa749('0x61')][_0xa749('0x120')](db[_0xa749('0xee')],{'as':_0xa749('0xee'),'foreignKey':'AttachmentId'});db[_0xa749('0x61')]['belongsTo'](db['OpenchannelAccount'],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x188')});db[_0xa749('0x62')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x16a'),'through':_0xa749('0x36'),'foreignKey':_0xa749('0x189')});db[_0xa749('0x62')]['belongsToMany'](db['Team'],{'through':_0xa749('0x18d'),'as':_0xa749('0x152')});db[_0xa749('0x64')]['hasMany'](db[_0xa749('0x162')],{'as':_0xa749('0x163'),'foreignKey':_0xa749('0x172'),'onDelete':'cascade'});db[_0xa749('0x64')][_0xa749('0x114')](db[_0xa749('0x82')],{'as':_0xa749('0x175'),'foreignKey':_0xa749('0x172')});db[_0xa749('0x64')][_0xa749('0x114')](db[_0xa749('0x71')],{'as':_0xa749('0x18e')});db[_0xa749('0x64')][_0xa749('0x114')](db[_0xa749('0x11b')],{'as':_0xa749('0x164')});db['ChatWebsite'][_0xa749('0x114')](db[_0xa749('0x67')],{'as':_0xa749('0x145')});db[_0xa749('0x64')][_0xa749('0x114')](db['ChatMessage'],{'as':_0xa749('0x155')});db[_0xa749('0x64')][_0xa749('0x120')](db[_0xa749('0xf8')],{'as':_0xa749('0x165'),'foreignKey':'ListId'});db[_0xa749('0x64')][_0xa749('0x120')](db['Interval'],{'as':_0xa749('0x84'),'foreignKey':_0xa749('0x14f')});db[_0xa749('0x64')][_0xa749('0x120')](db[_0xa749('0x3c')],{'as':_0xa749('0x3c'),'foreignKey':'MailAccountId'});db['ChatWebsite'][_0xa749('0x120')](db[_0xa749('0x86')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xa749('0x64')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x16a'),'through':'user_has_chat_websites'});db[_0xa749('0x66')][_0xa749('0x120')](db[_0xa749('0x5c')],{});db[_0xa749('0x66')][_0xa749('0x120')](db[_0xa749('0xf8')],{'as':'List','foreignKey':'ListId'});db[_0xa749('0x66')][_0xa749('0x120')](db[_0xa749('0x73')],{'as':_0xa749('0x15c'),'foreignKey':_0xa749('0x15d')});db[_0xa749('0x66')]['belongsTo'](db[_0xa749('0x5f')],{});db[_0xa749('0x66')][_0xa749('0x120')](db[_0xa749('0x61')],{});db[_0xa749('0x66')][_0xa749('0x120')](db[_0xa749('0x110')],{});db[_0xa749('0x66')][_0xa749('0x120')](db[_0xa749('0x62')],{});db[_0xa749('0x67')][_0xa749('0x120')](db[_0xa749('0x110')],{'as':_0xa749('0x18f'),'foreignKey':_0xa749('0x113'),'onDelete':'restrict'});db[_0xa749('0x67')]['belongsTo'](db[_0xa749('0x6d')],{'as':_0xa749('0x190'),'foreignKey':'ChatQueueId','onDelete':_0xa749('0x173')});db['ChatApplication'][_0xa749('0x120')](db['ChatWebsite'],{'as':_0xa749('0x191'),'foreignKey':_0xa749('0x172'),'onDelete':_0xa749('0x173')});db[_0xa749('0x67')][_0xa749('0x120')](db[_0xa749('0x8f')],{'onDelete':_0xa749('0x173'),'foreignKey':_0xa749('0x174')});db[_0xa749('0x11b')]['hasMany'](db['ChatMessage'],{'as':_0xa749('0x155'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x192')});db[_0xa749('0x11b')][_0xa749('0x120')](db[_0xa749('0x64')],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x172')});db[_0xa749('0x11b')][_0xa749('0x120')](db[_0xa749('0x73')],{'as':_0xa749('0x15c'),'foreignKey':_0xa749('0x15d')});db[_0xa749('0x11b')][_0xa749('0x120')](db[_0xa749('0x110')],{'as':_0xa749('0x16c'),'foreignKey':'UserId'});db[_0xa749('0x11b')][_0xa749('0x122')](db[_0xa749('0x8f')],{'through':_0xa749('0x193'),'as':_0xa749('0x17c')});db['ChatInteraction'][_0xa749('0x122')](db[_0xa749('0x8f')],{'through':'chat_interaction_has_tags','as':_0xa749('0x16e')});db[_0xa749('0x11b')]['belongsToMany'](db[_0xa749('0x110')],{'as':_0xa749('0x17d'),'through':_0xa749('0x194'),'foreignKey':_0xa749('0x192')});db[_0xa749('0x195')][_0xa749('0x120')](db[_0xa749('0x110')],{'onDelete':'cascade','as':_0xa749('0x110')});db['ChatMessage'][_0xa749('0x120')](db[_0xa749('0x73')],{'onDelete':_0xa749('0x118'),'as':_0xa749('0x15c'),'foreignKey':_0xa749('0x15d')});db['ChatMessage'][_0xa749('0x120')](db[_0xa749('0x11b')],{'onDelete':_0xa749('0x118'),'as':_0xa749('0x170'),'foreignKey':_0xa749('0x192')});db[_0xa749('0x195')][_0xa749('0x120')](db[_0xa749('0xee')],{'as':_0xa749('0xee'),'foreignKey':_0xa749('0x17e')});db[_0xa749('0x195')]['belongsTo'](db['ChatWebsite'],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x172')});db['ChatOfflineMessage'][_0xa749('0x114')](db[_0xa749('0xee')],{'as':_0xa749('0x16f'),'foreignKey':'ChatOfflineMessageId','onDelete':'cascade','hooks':!![]});db[_0xa749('0x6b')]['belongsTo'](db[_0xa749('0x73')],{'onDelete':_0xa749('0x118'),'as':_0xa749('0x15c'),'foreignKey':_0xa749('0x15d')});db['ChatOfflineMessage'][_0xa749('0x120')](db[_0xa749('0x64')],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x172')});db['ChatQueue'][_0xa749('0x122')](db['User'],{'as':_0xa749('0x16a'),'through':_0xa749('0x2f'),'hooks':!![]});db['ChatQueue'][_0xa749('0x122')](db[_0xa749('0x127')],{'through':_0xa749('0x196'),'as':_0xa749('0x152')});db[_0xa749('0x6f')][_0xa749('0x114')](db[_0xa749('0xd6')],{'as':_0xa749('0x155'),'foreignKey':'ChatGroupId','onDelete':'cascade'});db[_0xa749('0x6f')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':'Members','through':_0xa749('0x124')});db[_0xa749('0x71')][_0xa749('0x120')](db[_0xa749('0x64')],{'as':_0xa749('0x191'),'foreignKey':_0xa749('0x172')});db[_0xa749('0x72')][_0xa749('0x114')](db[_0xa749('0x73')],{'as':'Contacts','foreignKey':_0xa749('0x197')});db[_0xa749('0x73')][_0xa749('0x114')](db[_0xa749('0x91')],{'as':_0xa749('0x198'),'foreignKey':_0xa749('0x199')});db[_0xa749('0x73')]['hasMany'](db[_0xa749('0x75')],{'as':_0xa749('0x147'),'foreignKey':_0xa749('0x15d')});db['CmContact'][_0xa749('0x114')](db[_0xa749('0x149')],{'as':_0xa749('0x119'),'foreignKey':_0xa749('0x15d')});db[_0xa749('0x73')][_0xa749('0x114')](db[_0xa749('0x7a')],{'as':_0xa749('0x14a'),'foreignKey':_0xa749('0x15d')});db[_0xa749('0x73')]['hasMany'](db[_0xa749('0x7c')],{'as':_0xa749('0x7c'),'foreignKey':_0xa749('0x15d')});db[_0xa749('0x73')][_0xa749('0x114')](db[_0xa749('0xdc')],{'as':_0xa749('0x14c'),'foreignKey':_0xa749('0x15d')});db[_0xa749('0x73')]['hasMany'](db[_0xa749('0x5f')],{'as':_0xa749('0x11a'),'foreignKey':_0xa749('0x15d'),'onDelete':_0xa749('0x173')});db[_0xa749('0x73')][_0xa749('0x114')](db['ChatInteraction'],{'as':_0xa749('0x11c'),'foreignKey':_0xa749('0x15d'),'onDelete':_0xa749('0x173')});db[_0xa749('0x73')][_0xa749('0x114')](db['SmsInteraction'],{'as':_0xa749('0x12c'),'foreignKey':_0xa749('0x15d'),'onDelete':_0xa749('0x173')});db[_0xa749('0x73')][_0xa749('0x114')](db[_0xa749('0x4e')],{'as':_0xa749('0x11d'),'foreignKey':_0xa749('0x15d'),'onDelete':_0xa749('0x173')});db['CmContact'][_0xa749('0x114')](db['MailInteraction'],{'as':'MailInteractions','foreignKey':_0xa749('0x15d'),'onDelete':'restrict'});db[_0xa749('0x73')]['belongsTo'](db[_0xa749('0x72')],{'as':'Company','foreignKey':_0xa749('0x197')});db[_0xa749('0x73')]['belongsTo'](db[_0xa749('0xf8')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmContact'][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x17d'),'through':_0xa749('0x126')});db[_0xa749('0x73')][_0xa749('0x122')](db[_0xa749('0x8f')],{'as':_0xa749('0x17c'),'through':_0xa749('0x19a')});db['CmContact'][_0xa749('0x122')](db['Tag'],{'through':_0xa749('0x19a'),'as':_0xa749('0x16e')});db[_0xa749('0x75')][_0xa749('0x114')](db[_0xa749('0x19b')],{'as':_0xa749('0x19c'),'foreignKey':_0xa749('0x19d')});db[_0xa749('0x75')]['belongsTo'](db['CmContact'],{'as':_0xa749('0x15c'),'foreignKey':_0xa749('0x15d'),'onDelete':_0xa749('0x118')});db[_0xa749('0x75')][_0xa749('0x120')](db[_0xa749('0xf8')],{'as':_0xa749('0x165'),'foreignKey':_0xa749('0x166'),'onDelete':_0xa749('0x118')});db[_0xa749('0x75')][_0xa749('0x120')](db[_0xa749('0x110')],{'as':_0xa749('0x18f'),'foreignKey':_0xa749('0x113')});db[_0xa749('0x75')][_0xa749('0x120')](db[_0xa749('0x1b')],{'as':_0xa749('0x190'),'foreignKey':_0xa749('0x148'),'onDelete':'cascade'});db[_0xa749('0x75')]['belongsTo'](db['Campaign'],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xa749('0x118')});db[_0xa749('0x75')][_0xa749('0x120')](db[_0xa749('0x110')],{'as':_0xa749('0x16c'),'foreignKey':_0xa749('0x19e')});db[_0xa749('0x77')][_0xa749('0x120')](db['CmContact'],{'as':_0xa749('0x15c'),'foreignKey':'ContactId','onDelete':_0xa749('0x118')});db[_0xa749('0x77')]['belongsTo'](db[_0xa749('0xf8')],{'as':'List','foreignKey':_0xa749('0x166'),'onDelete':_0xa749('0x118')});db['CmHopperBlack']['belongsTo'](db[_0xa749('0x1b')],{'as':_0xa749('0x190'),'foreignKey':_0xa749('0x148'),'onDelete':_0xa749('0x118')});db[_0xa749('0x77')]['belongsTo'](db[_0xa749('0xec')],{'as':'Campaign','foreignKey':_0xa749('0x19f'),'onDelete':_0xa749('0x118')});db['Automation'][_0xa749('0x114')](db['Condition'],{'as':{'plural':_0xa749('0x1a0'),'singular':_0xa749('0x1a1')},'foreignKey':_0xa749('0x1a2'),'onDelete':_0xa749('0x118'),'hooks':!![]});db[_0xa749('0x81')][_0xa749('0x114')](db[_0xa749('0x1a3')],{'as':{'plural':_0xa749('0x1a4'),'singular':_0xa749('0x1a5')},'foreignKey':_0xa749('0x1a6'),'onDelete':'cascade','hooks':!![]});db[_0xa749('0x81')][_0xa749('0x114')](db[_0xa749('0x7f')],{'as':'Actions','foreignKey':_0xa749('0x1a7'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0xa749('0x114')](db[_0xa749('0x162')],{'as':_0xa749('0x163'),'foreignKey':_0xa749('0x1a8'),'onDelete':_0xa749('0x118')});db[_0xa749('0x84')][_0xa749('0x114')](db[_0xa749('0x84')],{'as':'Intervals','foreignKey':'IntervalId','onDelete':_0xa749('0x118'),'hooks':!![],'required':![]});db[_0xa749('0x84')][_0xa749('0x114')](db['VoiceExtension'],{'as':_0xa749('0x117'),'foreignKey':_0xa749('0x14f'),'onDelete':_0xa749('0x173')});db[_0xa749('0x84')][_0xa749('0x114')](db[_0xa749('0x44')],{'as':'MailApplications','foreignKey':_0xa749('0x14f')});db['Interval']['hasMany'](db[_0xa749('0x67')],{'as':_0xa749('0x1a9'),'foreignKey':'IntervalId'});db[_0xa749('0x84')][_0xa749('0x114')](db[_0xa749('0x4c')],{'as':_0xa749('0x1aa'),'foreignKey':'IntervalId'});db[_0xa749('0x84')][_0xa749('0x114')](db[_0xa749('0x56')],{'as':_0xa749('0x1ab'),'foreignKey':'IntervalId'});db[_0xa749('0x8c')][_0xa749('0x120')](db[_0xa749('0x3c')],{});db[_0xa749('0x8c')][_0xa749('0x120')](db[_0xa749('0x9d')],{'foreignKey':'DefaultReportId'});db[_0xa749('0x8c')][_0xa749('0x120')](db[_0xa749('0x9b')],{'foreignKey':_0xa749('0x1ac')});db[_0xa749('0x8d')][_0xa749('0x122')](db[_0xa749('0x19')],{'as':_0xa749('0x1ad'),'through':'moh_has_sounds','onDelete':_0xa749('0x173')});db['Tag'][_0xa749('0x122')](db[_0xa749('0x73')],{'through':'cm_contact_has_tags'});db[_0xa749('0x8f')]['belongsToMany'](db[_0xa749('0x11b')],{'through':_0xa749('0x193')});db[_0xa749('0x8f')][_0xa749('0x122')](db['MailInteraction'],{'through':_0xa749('0x16d')});db['Tag']['belongsToMany'](db[_0xa749('0x58')],{'through':_0xa749('0x185')});db[_0xa749('0x8f')][_0xa749('0x122')](db['FaxInteraction'],{'through':_0xa749('0x17b')});db[_0xa749('0x8f')]['belongsToMany'](db[_0xa749('0x5f')],{'through':_0xa749('0x18b')});db['Tag'][_0xa749('0x122')](db['WhatsappInteraction'],{'through':_0xa749('0x1ae')});db[_0xa749('0x91')]['belongsTo'](db[_0xa749('0x90')],{'as':_0xa749('0x1af'),'foreignKey':_0xa749('0x1b0')});db[_0xa749('0x19b')][_0xa749('0x120')](db[_0xa749('0x75')],{'as':_0xa749('0x1b1'),'foreignKey':_0xa749('0x19d')});db['Trigger'][_0xa749('0x114')](db[_0xa749('0x1a3')],{'as':{'plural':_0xa749('0x1b2'),'singular':_0xa749('0x1b3')},'foreignKey':_0xa749('0x1b4'),'onDelete':_0xa749('0x118'),'hooks':!![]});db['Trigger'][_0xa749('0x114')](db['Condition'],{'as':{'plural':_0xa749('0x1b5'),'singular':'AnyCondition'},'foreignKey':_0xa749('0x1b6'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0xa749('0x114')](db[_0xa749('0x7f')],{'as':_0xa749('0x1b7'),'foreignKey':_0xa749('0x1b8'),'onDelete':_0xa749('0x118'),'hooks':!![]});db[_0xa749('0x9b')]['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1ac'),'hooks':!![]});db['AnalyticDefaultReport'][_0xa749('0x114')](db['AnalyticFieldReport'],{'as':_0xa749('0x1b9'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1ba')});db[_0xa749('0xa0')][_0xa749('0x114')](db['AnalyticFieldReport'],{'as':_0xa749('0x1b9'),'onDelete':'cascade','foreignKey':_0xa749('0x1bb')});db['AnalyticFieldReport'][_0xa749('0x120')](db[_0xa749('0xa0')],{'foreignKey':'MetricId'});db[_0xa749('0xa5')][_0xa749('0x114')](db[_0xa749('0x1bc')],{'as':_0xa749('0x1bd'),'onDelete':_0xa749('0x118'),'foreignKey':'AccountId'});db[_0xa749('0x1bc')][_0xa749('0x114')](db[_0xa749('0xa8')],{'as':_0xa749('0x1be'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1bf')});db[_0xa749('0x1bc')]['hasMany'](db[_0xa749('0xa8')],{'as':_0xa749('0x1c0'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1c1')});db[_0xa749('0x1bc')][_0xa749('0x114')](db[_0xa749('0xa8')],{'as':_0xa749('0x1b9'),'onDelete':_0xa749('0x118'),'foreignKey':'FieldId'});db[_0xa749('0x1bc')][_0xa749('0x120')](db[_0xa749('0xa5')],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x1c2')});db['SalesforceField'][_0xa749('0x114')](db[_0xa749('0xa8')],{'as':_0xa749('0x1c3'),'foreignKey':_0xa749('0x1bf')});db['SalesforceField'][_0xa749('0x114')](db[_0xa749('0xa8')],{'as':_0xa749('0x1c4'),'foreignKey':_0xa749('0x1c1')});db['SalesforceField'][_0xa749('0x114')](db[_0xa749('0xa8')],{'as':_0xa749('0x1c5'),'foreignKey':_0xa749('0x1c6')});db[_0xa749('0xa8')]['belongsTo'](db[_0xa749('0x1c7')],{'as':_0xa749('0x1c7'),'foreignKey':_0xa749('0x1c8')});db[_0xa749('0xaa')][_0xa749('0x114')](db[_0xa749('0xac')],{'as':_0xa749('0x1bd'),'onDelete':'cascade','foreignKey':_0xa749('0x1c2')});db[_0xa749('0xac')][_0xa749('0x114')](db[_0xa749('0xae')],{'as':_0xa749('0x1be'),'onDelete':_0xa749('0x118'),'foreignKey':'SubjectId'});db[_0xa749('0xac')][_0xa749('0x114')](db[_0xa749('0xae')],{'as':_0xa749('0x1c0'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1c1')});db['SugarcrmConfiguration'][_0xa749('0x114')](db[_0xa749('0xae')],{'as':_0xa749('0x1b9'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1c6')});db[_0xa749('0xac')][_0xa749('0x120')](db['SugarcrmAccount'],{'as':_0xa749('0x171'),'foreignKey':'AccountId'});db[_0xa749('0xae')]['hasMany'](db[_0xa749('0xae')],{'as':_0xa749('0x1c3'),'foreignKey':_0xa749('0x1bf')});db['SugarcrmField'][_0xa749('0x114')](db['SugarcrmField'],{'as':_0xa749('0x1c4'),'foreignKey':'DescriptionId'});db[_0xa749('0xae')]['hasMany'](db[_0xa749('0xae')],{'as':_0xa749('0x1c5'),'foreignKey':_0xa749('0x1c6')});db[_0xa749('0xae')][_0xa749('0x120')](db[_0xa749('0x1c7')],{'as':'Variable','foreignKey':_0xa749('0x1c8')});db[_0xa749('0xb0')][_0xa749('0x114')](db[_0xa749('0x1c9')],{'as':'Configurations','onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1c2')});db[_0xa749('0x1c9')][_0xa749('0x114')](db['DeskField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xa749('0x1bf')});db[_0xa749('0x1c9')]['hasMany'](db[_0xa749('0xb2')],{'as':_0xa749('0x1c0'),'onDelete':_0xa749('0x118'),'foreignKey':'DescriptionId'});db[_0xa749('0x1c9')][_0xa749('0x114')](db[_0xa749('0xb2')],{'as':_0xa749('0x1b9'),'onDelete':'cascade','foreignKey':_0xa749('0x1c6')});db[_0xa749('0x1c9')]['belongsTo'](db[_0xa749('0xb0')],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x1c2')});db['DeskConfiguration'][_0xa749('0x122')](db['Tag'],{'through':_0xa749('0x1ca')});db[_0xa749('0xb2')][_0xa749('0x114')](db['DeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0xa749('0xb2')][_0xa749('0x114')](db[_0xa749('0xb2')],{'as':'Description','foreignKey':_0xa749('0x1c1')});db[_0xa749('0xb2')][_0xa749('0x114')](db[_0xa749('0xb2')],{'as':_0xa749('0x1c5'),'foreignKey':_0xa749('0x1c6')});db[_0xa749('0xb2')][_0xa749('0x120')](db[_0xa749('0x1c7')],{'as':_0xa749('0x1c7'),'foreignKey':_0xa749('0x1c8')});db[_0xa749('0x1cb')]['hasMany'](db['ZohoConfiguration'],{'as':_0xa749('0x1bd'),'onDelete':_0xa749('0x118'),'foreignKey':'AccountId'});db[_0xa749('0xb4')][_0xa749('0x114')](db[_0xa749('0x1cc')],{'as':_0xa749('0x1be'),'onDelete':_0xa749('0x118'),'foreignKey':'SubjectId'});db[_0xa749('0xb4')]['hasMany'](db['ZohoField'],{'as':_0xa749('0x1c0'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xa749('0xb4')][_0xa749('0x114')](db[_0xa749('0x1cc')],{'as':'Fields','onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1c6')});db['ZohoConfiguration'][_0xa749('0x120')](db[_0xa749('0x1cb')],{'as':'Account','foreignKey':_0xa749('0x1c2')});db[_0xa749('0x1cc')][_0xa749('0x114')](db[_0xa749('0x1cc')],{'as':_0xa749('0x1c3'),'foreignKey':_0xa749('0x1bf')});db['ZohoField'][_0xa749('0x114')](db[_0xa749('0x1cc')],{'as':_0xa749('0x1c4'),'foreignKey':_0xa749('0x1c1')});db[_0xa749('0x1cc')]['hasMany'](db[_0xa749('0x1cc')],{'as':_0xa749('0x1c5'),'foreignKey':_0xa749('0x1c6')});db['ZohoField'][_0xa749('0x120')](db[_0xa749('0x1c7')],{'as':_0xa749('0x1c7'),'foreignKey':'VariableId'});db['ZendeskAccount'][_0xa749('0x114')](db[_0xa749('0xb8')],{'as':_0xa749('0x1bd'),'onDelete':'cascade','foreignKey':'AccountId'});db['ZendeskConfiguration'][_0xa749('0x114')](db[_0xa749('0xb9')],{'as':_0xa749('0x1be'),'foreignKey':_0xa749('0x1bf')});db['ZendeskConfiguration'][_0xa749('0x114')](db[_0xa749('0xb9')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0xa749('0xb8')]['hasMany'](db[_0xa749('0xb9')],{'as':_0xa749('0x1b9'),'foreignKey':'FieldId'});db['ZendeskConfiguration']['belongsTo'](db[_0xa749('0xb6')],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x1c2')});db['ZendeskConfiguration'][_0xa749('0x122')](db[_0xa749('0x8f')],{'through':'int_zendesk_configuration_has_tags'});db['ZendeskField'][_0xa749('0x114')](db[_0xa749('0xb9')],{'as':_0xa749('0x1c3'),'foreignKey':_0xa749('0x1bf')});db['ZendeskField'][_0xa749('0x114')](db['ZendeskField'],{'as':_0xa749('0x1c4'),'foreignKey':_0xa749('0x1c1')});db['ZendeskField']['hasMany'](db[_0xa749('0xb9')],{'as':'Field','foreignKey':_0xa749('0x1c6')});db[_0xa749('0xb9')][_0xa749('0x120')](db[_0xa749('0x1c7')],{'as':_0xa749('0x1c7'),'foreignKey':'VariableId'});db[_0xa749('0xbb')][_0xa749('0x114')](db[_0xa749('0xbd')],{'as':_0xa749('0x1bd'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1c2')});db[_0xa749('0xbd')][_0xa749('0x114')](db[_0xa749('0xbf')],{'as':_0xa749('0x1be'),'onDelete':_0xa749('0x118'),'foreignKey':'SubjectId'});db[_0xa749('0xbd')][_0xa749('0x114')](db['FreshdeskField'],{'as':'Descriptions','onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1c1')});db[_0xa749('0xbd')][_0xa749('0x114')](db['FreshdeskField'],{'as':_0xa749('0x1b9'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1c6')});db[_0xa749('0xbd')]['belongsTo'](db[_0xa749('0xbb')],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x1c2')});db[_0xa749('0xbd')]['belongsToMany'](db[_0xa749('0x8f')],{'through':_0xa749('0x1cd')});db[_0xa749('0xbf')][_0xa749('0x114')](db[_0xa749('0xbf')],{'as':_0xa749('0x1c3'),'foreignKey':'SubjectId'});db[_0xa749('0xbf')]['hasMany'](db[_0xa749('0xbf')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xa749('0xbf')][_0xa749('0x114')](db[_0xa749('0xbf')],{'as':_0xa749('0x1c5'),'foreignKey':_0xa749('0x1c6')});db[_0xa749('0xbf')]['belongsTo'](db[_0xa749('0x1c7')],{'as':_0xa749('0x1c7'),'foreignKey':'VariableId'});db[_0xa749('0x1ce')][_0xa749('0x114')](db[_0xa749('0xc2')],{'as':_0xa749('0x1bd'),'onDelete':_0xa749('0x118'),'foreignKey':'AccountId'});db[_0xa749('0xc2')][_0xa749('0x114')](db[_0xa749('0xc3')],{'as':'Subjects','foreignKey':_0xa749('0x1bf')});db[_0xa749('0xc2')][_0xa749('0x114')](db[_0xa749('0xc3')],{'as':_0xa749('0x1c0'),'foreignKey':_0xa749('0x1c1')});db[_0xa749('0xc2')][_0xa749('0x114')](db[_0xa749('0xc3')],{'as':_0xa749('0x1b9'),'foreignKey':_0xa749('0x1c6')});db[_0xa749('0xc2')]['belongsTo'](db[_0xa749('0x1ce')],{'as':'Account','foreignKey':'AccountId'});db[_0xa749('0xc3')][_0xa749('0x114')](db[_0xa749('0xc3')],{'as':_0xa749('0x1c3'),'foreignKey':_0xa749('0x1bf')});db['VtigerField']['hasMany'](db[_0xa749('0xc3')],{'as':_0xa749('0x1c4'),'foreignKey':'DescriptionId'});db[_0xa749('0xc3')]['hasMany'](db[_0xa749('0xc3')],{'as':_0xa749('0x1c5'),'foreignKey':_0xa749('0x1c6')});db[_0xa749('0xc3')]['belongsTo'](db[_0xa749('0x1c7')],{'as':'Variable','foreignKey':_0xa749('0x1c8')});db[_0xa749('0x1cf')][_0xa749('0x114')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0xa749('0x118'),'foreignKey':'AccountId'});db[_0xa749('0xc5')][_0xa749('0x114')](db[_0xa749('0xc7')],{'as':_0xa749('0x1be'),'foreignKey':'SubjectId'});db[_0xa749('0xc5')][_0xa749('0x114')](db['ServicenowField'],{'as':_0xa749('0x1c0'),'foreignKey':'DescriptionId'});db[_0xa749('0xc5')][_0xa749('0x114')](db[_0xa749('0xc7')],{'as':'Fields','foreignKey':_0xa749('0x1c6')});db[_0xa749('0xc5')][_0xa749('0x120')](db[_0xa749('0x1cf')],{'as':'Account','foreignKey':_0xa749('0x1c2')});db[_0xa749('0xc7')]['hasMany'](db['ServicenowField'],{'as':'Subject','foreignKey':_0xa749('0x1bf')});db['ServicenowField'][_0xa749('0x114')](db['ServicenowField'],{'as':_0xa749('0x1c4'),'foreignKey':_0xa749('0x1c1')});db[_0xa749('0xc7')][_0xa749('0x114')](db[_0xa749('0xc7')],{'as':_0xa749('0x1c5'),'foreignKey':'FieldId'});db[_0xa749('0xc7')][_0xa749('0x120')](db['Variable'],{'as':_0xa749('0x1c7'),'foreignKey':'VariableId'});db['Dynamics365Account'][_0xa749('0x114')](db[_0xa749('0x1d0')],{'as':_0xa749('0x1bd'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1c2')});db[_0xa749('0x1d0')][_0xa749('0x114')](db['Dynamics365Field'],{'as':_0xa749('0x1be'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1bf')});db['Dynamics365Configuration']['hasMany'](db[_0xa749('0x1d1')],{'as':'Descriptions','onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1c1')});db['Dynamics365Configuration']['hasMany'](db[_0xa749('0x1d1')],{'as':_0xa749('0x1b9'),'onDelete':_0xa749('0x118'),'foreignKey':'FieldId'});db[_0xa749('0x1d0')][_0xa749('0x120')](db['Dynamics365Account'],{'as':'Account','foreignKey':_0xa749('0x1c2')});db['Dynamics365Field'][_0xa749('0x114')](db[_0xa749('0x1d1')],{'as':_0xa749('0x1c3'),'foreignKey':'SubjectId'});db[_0xa749('0x1d1')][_0xa749('0x114')](db[_0xa749('0x1d1')],{'as':_0xa749('0x1c4'),'foreignKey':_0xa749('0x1c1')});db[_0xa749('0x1d1')][_0xa749('0x114')](db['Dynamics365Field'],{'as':_0xa749('0x1c5'),'foreignKey':'FieldId'});db['Dynamics365Field'][_0xa749('0x120')](db[_0xa749('0x1c7')],{'as':_0xa749('0x1c7'),'foreignKey':_0xa749('0x1c8')});db[_0xa749('0xcd')][_0xa749('0x114')](db['FreshsalesConfiguration'],{'as':_0xa749('0x1bd'),'onDelete':_0xa749('0x118'),'foreignKey':'AccountId'});db[_0xa749('0xcf')]['hasMany'](db[_0xa749('0xd1')],{'as':_0xa749('0x1be'),'foreignKey':_0xa749('0x1bf')});db['FreshsalesConfiguration'][_0xa749('0x114')](db[_0xa749('0xd1')],{'as':_0xa749('0x1c0'),'foreignKey':'DescriptionId'});db[_0xa749('0xcf')]['hasMany'](db[_0xa749('0xd1')],{'as':_0xa749('0x1b9'),'foreignKey':_0xa749('0x1c6')});db[_0xa749('0xcf')]['belongsTo'](db[_0xa749('0xcd')],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x1c2')});db['FreshsalesField'][_0xa749('0x114')](db[_0xa749('0xd1')],{'as':_0xa749('0x1c3'),'foreignKey':'SubjectId'});db[_0xa749('0xd1')][_0xa749('0x114')](db[_0xa749('0xd1')],{'as':'Description','foreignKey':_0xa749('0x1c1')});db[_0xa749('0xd1')][_0xa749('0x114')](db[_0xa749('0xd1')],{'as':'Field','foreignKey':_0xa749('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0xa749('0x1c7')],{'as':_0xa749('0x1c7'),'foreignKey':_0xa749('0x1c8')});db[_0xa749('0xd4')][_0xa749('0x120')](db[_0xa749('0x64')],{});db[_0xa749('0xd4')][_0xa749('0x120')](db[_0xa749('0xf8')],{'as':_0xa749('0x165'),'foreignKey':_0xa749('0x166')});db['ChatQueueReport'][_0xa749('0x120')](db['CmContact'],{'as':_0xa749('0x15c'),'foreignKey':'ContactId'});db[_0xa749('0xd4')][_0xa749('0x120')](db[_0xa749('0x11b')],{});db[_0xa749('0xd4')][_0xa749('0x120')](db[_0xa749('0x195')],{});db['ChatQueueReport'][_0xa749('0x120')](db[_0xa749('0x110')],{});db[_0xa749('0xd4')][_0xa749('0x120')](db[_0xa749('0x6d')],{});db[_0xa749('0xd6')][_0xa749('0x120')](db[_0xa749('0x110')],{'onDelete':_0xa749('0x118'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0xa749('0x120')](db[_0xa749('0x110')],{'onDelete':_0xa749('0x118'),'foreignKey':'ToId'});db[_0xa749('0xdc')][_0xa749('0x114')](db[_0xa749('0xda')],{'foreignKey':_0xa749('0x1d2'),'onDelete':_0xa749('0x118')});db['JscriptySessionReport']['hasMany'](db[_0xa749('0xd8')],{'foreignKey':_0xa749('0x1d2'),'onDelete':_0xa749('0x118')});db['SmsQueueReport'][_0xa749('0x120')](db[_0xa749('0x54')],{});db[_0xa749('0xde')]['belongsTo'](db[_0xa749('0xf8')],{'as':_0xa749('0x165'),'foreignKey':_0xa749('0x166')});db[_0xa749('0xde')][_0xa749('0x120')](db['CmContact'],{'as':'Contact','foreignKey':_0xa749('0x15d')});db['SmsQueueReport'][_0xa749('0x120')](db[_0xa749('0x58')],{});db[_0xa749('0xde')][_0xa749('0x120')](db[_0xa749('0x182')],{});db[_0xa749('0xde')][_0xa749('0x120')](db['User'],{});db[_0xa749('0xde')][_0xa749('0x120')](db[_0xa749('0x183')],{});db[_0xa749('0x1d3')]['hasMany'](db['JscriptySessionReport'],{'foreignKey':_0xa749('0x1d4')});db[_0xa749('0x1d3')][_0xa749('0x114')](db[_0xa749('0xda')],{'foreignKey':_0xa749('0x1d4')});db[_0xa749('0x1d3')]['hasMany'](db[_0xa749('0xd8')],{'foreignKey':_0xa749('0x1d4')});db[_0xa749('0xe6')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x17d'),'through':_0xa749('0x144')});db['Team']['belongsToMany'](db[_0xa749('0x110')],{'as':_0xa749('0x16a'),'through':'user_has_teams'});db['Team']['belongsToMany'](db['VoiceQueue'],{'through':'TeamVoiceQueue','as':_0xa749('0x1d5')});db[_0xa749('0x127')][_0xa749('0x122')](db[_0xa749('0x3d')],{'through':'team_has_mail_queues','as':_0xa749('0x130')});db[_0xa749('0x127')][_0xa749('0x122')](db[_0xa749('0x6d')],{'through':'team_has_chat_queues','as':'ChatQueues'});db[_0xa749('0x127')][_0xa749('0x122')](db['FaxQueue'],{'through':_0xa749('0x17f'),'as':'FaxQueues'});db['Team'][_0xa749('0x122')](db[_0xa749('0x183')],{'through':'team_has_sms_queues','as':'SmsQueues'});db['Team'][_0xa749('0x122')](db[_0xa749('0x62')],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0xa749('0x127')][_0xa749('0x122')](db[_0xa749('0x109')],{'through':_0xa749('0x1d6'),'as':_0xa749('0x136')});db['Campaign'][_0xa749('0x114')](db[_0xa749('0x75')],{'as':_0xa749('0x147'),'foreignKey':'CampaignId'});db[_0xa749('0xec')]['hasMany'](db[_0xa749('0x149')],{'as':_0xa749('0x119'),'foreignKey':_0xa749('0x19f')});db['Campaign'][_0xa749('0x114')](db[_0xa749('0x7a')],{'as':_0xa749('0x14a'),'foreignKey':_0xa749('0x19f')});db['Campaign']['hasMany'](db['CmHopperBlack'],{'as':_0xa749('0x14b'),'foreignKey':_0xa749('0x19f')});db['Campaign']['belongsTo'](db[_0xa749('0x28')],{'as':_0xa749('0x28'),'foreignKey':_0xa749('0x14d')});db[_0xa749('0xec')][_0xa749('0x120')](db[_0xa749('0x28')],{'as':_0xa749('0x14e'),'foreignKey':_0xa749('0x1d7')});db[_0xa749('0xec')][_0xa749('0x120')](db[_0xa749('0x84')],{'as':'Interval','foreignKey':_0xa749('0x14f')});db[_0xa749('0xec')]['belongsTo'](db[_0xa749('0xe6')],{'as':'SquareProject','foreignKey':_0xa749('0x1d8')});db['Campaign'][_0xa749('0x122')](db['CmList'],{'as':_0xa749('0x1d9'),'through':_0xa749('0x1da')});db[_0xa749('0xec')][_0xa749('0x122')](db['CmList'],{'as':_0xa749('0x153'),'through':_0xa749('0x1db')});db[_0xa749('0xee')]['belongsTo'](db[_0xa749('0x6b')],{'as':_0xa749('0x6b'),'foreignKey':_0xa749('0x1dc')});db[_0xa749('0xf2')][_0xa749('0x120')](db[_0xa749('0x42')],{});db[_0xa749('0xf2')][_0xa749('0x120')](db['MailInteraction'],{});db['MailTransferReport']['belongsTo'](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0xa749('0x1dd')});db[_0xa749('0xf2')]['belongsTo'](db[_0xa749('0x110')],{'foreignKey':_0xa749('0x1de'),'as':_0xa749('0x1df')});db[_0xa749('0xf2')][_0xa749('0x120')](db[_0xa749('0x110')],{'foreignKey':_0xa749('0x1e0'),'as':_0xa749('0x1e1')});db[_0xa749('0xf2')]['belongsTo'](db[_0xa749('0x3d')],{'foreignKey':_0xa749('0x1e2'),'as':_0xa749('0x1e3')});db[_0xa749('0xf2')][_0xa749('0x120')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':'ToAccount'});db[_0xa749('0xf4')][_0xa749('0x120')](db[_0xa749('0x195')],{});db[_0xa749('0xf4')][_0xa749('0x120')](db['ChatInteraction'],{});db['ChatTransferReport'][_0xa749('0x120')](db[_0xa749('0x64')],{'foreignKey':_0xa749('0x1e4'),'as':_0xa749('0x1dd')});db[_0xa749('0xf4')][_0xa749('0x120')](db['User'],{'foreignKey':'FromUserId','as':_0xa749('0x1df')});db[_0xa749('0xf4')][_0xa749('0x120')](db['User'],{'foreignKey':_0xa749('0x1e0'),'as':_0xa749('0x1e1')});db[_0xa749('0xf4')][_0xa749('0x120')](db[_0xa749('0x6d')],{'foreignKey':_0xa749('0x1e5'),'as':_0xa749('0x1e3')});db['ChatTransferReport'][_0xa749('0x120')](db[_0xa749('0x64')],{'foreignKey':_0xa749('0x1e6'),'as':_0xa749('0x1e7')});db[_0xa749('0xf5')][_0xa749('0x120')](db['FaxMessage'],{});db[_0xa749('0xf5')]['belongsTo'](db[_0xa749('0x4e')],{});db[_0xa749('0xf5')]['belongsTo'](db[_0xa749('0x4a')],{'foreignKey':_0xa749('0x1e8'),'as':_0xa749('0x1dd')});db['FaxTransferReport'][_0xa749('0x120')](db[_0xa749('0x110')],{'foreignKey':_0xa749('0x1de'),'as':'FromAgent'});db[_0xa749('0xf5')][_0xa749('0x120')](db[_0xa749('0x110')],{'foreignKey':_0xa749('0x1e0'),'as':_0xa749('0x1e1')});db[_0xa749('0xf5')][_0xa749('0x120')](db[_0xa749('0x51')],{'foreignKey':_0xa749('0x1e9'),'as':_0xa749('0x1e3')});db['FaxTransferReport']['belongsTo'](db[_0xa749('0x4a')],{'foreignKey':_0xa749('0x1ea'),'as':_0xa749('0x1e7')});db[_0xa749('0xf7')][_0xa749('0x120')](db['OpenchannelMessage'],{});db[_0xa749('0xf7')][_0xa749('0x120')](db[_0xa749('0x5f')],{});db[_0xa749('0xf7')][_0xa749('0x120')](db[_0xa749('0x5c')],{'foreignKey':'FromOpenchannelAccountId','as':_0xa749('0x1dd')});db['OpenchannelTransferReport'][_0xa749('0x120')](db['User'],{'foreignKey':_0xa749('0x1de'),'as':_0xa749('0x1df')});db[_0xa749('0xf7')][_0xa749('0x120')](db[_0xa749('0x110')],{'foreignKey':_0xa749('0x1e0'),'as':_0xa749('0x1e1')});db[_0xa749('0xf7')][_0xa749('0x120')](db['OpenchannelQueue'],{'foreignKey':_0xa749('0x1eb'),'as':_0xa749('0x1e3')});db['OpenchannelTransferReport'][_0xa749('0x120')](db[_0xa749('0x5c')],{'foreignKey':_0xa749('0x1ec'),'as':_0xa749('0x1e7')});db['SmsTransferReport']['belongsTo'](db[_0xa749('0x182')],{});db[_0xa749('0x1ed')][_0xa749('0x120')](db[_0xa749('0x58')],{});db[_0xa749('0x1ed')][_0xa749('0x120')](db[_0xa749('0x54')],{'foreignKey':_0xa749('0x1ee'),'as':'FromAccount'});db[_0xa749('0x1ed')]['belongsTo'](db['User'],{'foreignKey':_0xa749('0x1de'),'as':'FromAgent'});db[_0xa749('0x1ed')][_0xa749('0x120')](db[_0xa749('0x110')],{'foreignKey':_0xa749('0x1e0'),'as':_0xa749('0x1e1')});db[_0xa749('0x1ed')][_0xa749('0x120')](db[_0xa749('0x183')],{'foreignKey':'ToSmsQueueId','as':_0xa749('0x1e3')});db[_0xa749('0x1ed')][_0xa749('0x120')](db[_0xa749('0x54')],{'foreignKey':_0xa749('0x1ef'),'as':_0xa749('0x1e7')});db[_0xa749('0xf8')][_0xa749('0x114')](db[_0xa749('0x162')],{'as':_0xa749('0x163'),'foreignKey':_0xa749('0x166'),'onDelete':_0xa749('0x118')});db[_0xa749('0xf8')][_0xa749('0x114')](db[_0xa749('0x7d')],{'as':'CustomFields','foreignKey':_0xa749('0x166')});db[_0xa749('0xf8')][_0xa749('0x114')](db[_0xa749('0x73')],{'as':_0xa749('0x125'),'onDelete':_0xa749('0x118'),'foreignKey':'ListId'});db['CmList'][_0xa749('0x114')](db[_0xa749('0x149')],{'as':_0xa749('0x119'),'foreignKey':'ListId'});db[_0xa749('0xf8')][_0xa749('0x114')](db[_0xa749('0x7a')],{'as':_0xa749('0x1f0'),'foreignKey':_0xa749('0x166')});db[_0xa749('0xf8')][_0xa749('0x114')](db['ReportAgentPreview'],{'as':_0xa749('0x7c'),'foreignKey':_0xa749('0x166')});db[_0xa749('0xf8')][_0xa749('0x122')](db[_0xa749('0x1b')],{'as':_0xa749('0x1f1'),'through':_0xa749('0x151')});db[_0xa749('0xf8')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x16a'),'through':'cm_user_has_lists'});db[_0xa749('0x138')][_0xa749('0x114')](db[_0xa749('0x116')],{'as':'Extensions','onDelete':'cascade'});db[_0xa749('0x138')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x16a'),'through':'user_has_voice_prefixes'});db[_0xa749('0xfb')][_0xa749('0x114')](db[_0xa749('0x110')],{'as':_0xa749('0x17d'),'foreignKey':_0xa749('0x121')});db[_0xa749('0xfb')][_0xa749('0x114')](db['UserProfileSection'],{'as':_0xa749('0x1f2'),'foreignKey':'userProfileId','onDelete':_0xa749('0x118')});db[_0xa749('0x1f3')][_0xa749('0x114')](db[_0xa749('0xfc')],{'as':_0xa749('0x1f4'),'foreignKey':'sectionId','onDelete':_0xa749('0x118')});db[_0xa749('0x100')]['hasMany'](db[_0xa749('0x162')],{'as':_0xa749('0x163'),'foreignKey':'WhatsappAccountId','onDelete':_0xa749('0x118')});db[_0xa749('0x100')]['hasMany'](db['CannedAnswer'],{'as':_0xa749('0x175'),'foreignKey':_0xa749('0x1f5')});db[_0xa749('0x100')][_0xa749('0x114')](db['WhatsappMessage'],{'as':_0xa749('0x155'),'foreignKey':_0xa749('0x1f5')});db[_0xa749('0x100')][_0xa749('0x114')](db[_0xa749('0x103')],{'as':_0xa749('0x164')});db[_0xa749('0x100')][_0xa749('0x114')](db[_0xa749('0x102')],{'as':_0xa749('0x145')});db['WhatsappAccount'][_0xa749('0x120')](db[_0xa749('0xf8')],{'as':_0xa749('0x165'),'foreignKey':_0xa749('0x166')});db[_0xa749('0x100')][_0xa749('0x120')](db[_0xa749('0x86')],{'as':_0xa749('0x150'),'foreignKey':_0xa749('0x169')});db['WhatsappAccount']['belongsToMany'](db[_0xa749('0x110')],{'as':'Agents','through':_0xa749('0x142')});db[_0xa749('0x102')]['belongsTo'](db[_0xa749('0x110')],{'onDelete':_0xa749('0x173')});db['WhatsappApplication'][_0xa749('0x120')](db[_0xa749('0x109')],{'onDelete':_0xa749('0x173')});db[_0xa749('0x102')][_0xa749('0x120')](db[_0xa749('0x100')],{'onDelete':_0xa749('0x173')});db['WhatsappApplication'][_0xa749('0x120')](db[_0xa749('0x84')],{'onDelete':'restrict','foreignKey':_0xa749('0x14f')});db[_0xa749('0x102')][_0xa749('0x120')](db[_0xa749('0x8f')],{'onDelete':_0xa749('0x173'),'foreignKey':_0xa749('0x174')});db[_0xa749('0x103')][_0xa749('0x114')](db[_0xa749('0x1f6')],{'as':_0xa749('0x155'),'onDelete':_0xa749('0x118'),'foreignKey':_0xa749('0x1f7')});db[_0xa749('0x103')][_0xa749('0x120')](db['WhatsappAccount'],{'as':_0xa749('0x171'),'foreignKey':_0xa749('0x1f5')});db['WhatsappInteraction'][_0xa749('0x120')](db[_0xa749('0x73')],{'as':'Contact','foreignKey':_0xa749('0x15d')});db[_0xa749('0x103')]['belongsTo'](db[_0xa749('0x110')],{'as':_0xa749('0x16c'),'foreignKey':_0xa749('0x113')});db['WhatsappInteraction'][_0xa749('0x122')](db[_0xa749('0x8f')],{'through':_0xa749('0x1ae'),'as':_0xa749('0x17c')});db[_0xa749('0x103')][_0xa749('0x122')](db[_0xa749('0x8f')],{'through':_0xa749('0x1ae'),'as':_0xa749('0x16e')});db[_0xa749('0x103')][_0xa749('0x122')](db[_0xa749('0x110')],{'as':_0xa749('0x17d'),'through':_0xa749('0x12f'),'foreignKey':_0xa749('0x1f7')});db[_0xa749('0x1f6')][_0xa749('0x120')](db[_0xa749('0x110')],{'as':'User'});db[_0xa749('0x1f6')][_0xa749('0x120')](db['CmContact'],{'onDelete':'cascade','as':_0xa749('0x15c')});db[_0xa749('0x1f6')][_0xa749('0x120')](db[_0xa749('0x103')],{'onDelete':_0xa749('0x118'),'as':_0xa749('0x170'),'foreignKey':_0xa749('0x1f7')});db[_0xa749('0x1f6')][_0xa749('0x120')](db['WhatsappAccount'],{'as':_0xa749('0x171'),'foreignKey':'WhatsappAccountId'});db[_0xa749('0x105')][_0xa749('0x120')](db[_0xa749('0x100')],{});db[_0xa749('0x105')][_0xa749('0x120')](db[_0xa749('0xf8')],{'as':_0xa749('0x165'),'foreignKey':_0xa749('0x166')});db['WhatsappQueueReport'][_0xa749('0x120')](db[_0xa749('0x73')],{'as':_0xa749('0x15c'),'foreignKey':'ContactId'});db['WhatsappQueueReport'][_0xa749('0x120')](db[_0xa749('0x103')],{});db[_0xa749('0x105')]['belongsTo'](db[_0xa749('0x109')],{});db[_0xa749('0x105')]['belongsTo'](db['WhatsappMessage'],{});db[_0xa749('0x105')][_0xa749('0x120')](db[_0xa749('0x110')],{});db['WhatsappTransferReport'][_0xa749('0x120')](db['WhatsappMessage'],{});db[_0xa749('0x107')][_0xa749('0x120')](db[_0xa749('0x103')],{});db[_0xa749('0x107')][_0xa749('0x120')](db[_0xa749('0x100')],{'foreignKey':_0xa749('0x1f8'),'as':'FromAccount'});db[_0xa749('0x107')][_0xa749('0x120')](db[_0xa749('0x100')],{'foreignKey':'ToWhatsappAccountId','as':_0xa749('0x1e7')});db[_0xa749('0x107')][_0xa749('0x120')](db[_0xa749('0x109')],{'foreignKey':'ToQueueId','as':_0xa749('0x1e3')});db[_0xa749('0x107')][_0xa749('0x120')](db[_0xa749('0x110')],{'foreignKey':_0xa749('0x1de'),'as':_0xa749('0x1df')});db[_0xa749('0x107')]['belongsTo'](db[_0xa749('0x110')],{'foreignKey':_0xa749('0x1e0'),'as':_0xa749('0x1e1')});db['WhatsappQueue']['belongsToMany'](db[_0xa749('0x110')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':_0xa749('0x1f9')});db['WhatsappQueue'][_0xa749('0x122')](db[_0xa749('0x127')],{'through':_0xa749('0x1d6'),'as':'Teams'});module[_0xa749('0x1fa')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 861ba33..b4d029c 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3ab7=['./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','/api/chat/messages','/api/chat/offline_messages','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','/api/realtime','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/rpc','/api/version','/api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','/demo','/snippet','static','snippet','3.0.0','/:url(api|auth|components|app|bower_components|assets)/*','route','sendFile','resolve','appPath','/index.html','username','password','newPassword','firstName','lastName','street','phone','mobile','fax','email','clientId','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','secret','oldPassword','isPlainObject','isArray','length','isString','replace','}@@','includes','lodash','path','express','express-winston','./errors','./config/environment','./config/logger','api','default','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','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','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers'];(function(_0x39d024,_0x5c5797){var _0x311bdd=function(_0x4d644c){while(--_0x4d644c){_0x39d024['push'](_0x39d024['shift']());}};_0x311bdd(++_0x5c5797);}(_0x3ab7,0x114));var _0x73ab=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x3ab7[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0x73ab('0x0'));var path=require(_0x73ab('0x1'));var express=require(_0x73ab('0x2'));var ewinston=require(_0x73ab('0x3'));var util=require('util');var errors=require(_0x73ab('0x4'));var config=require(_0x73ab('0x5'));var logger=require(_0x73ab('0x6'))(_0x73ab('0x7'));var authLogger=require('./config/logger')('auth');exports[_0x73ab('0x8')]=function(_0xd51a70){_0xd51a70[_0x73ab('0x9')](ewinston[_0x73ab('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x4a38b9,_0x1b7ad2){var _0x2cd245=_0x73ab('0xb');if(!_[_0x73ab('0xc')](_0x4a38b9[_0x73ab('0xd')])){_0x2cd245+=_0x73ab('0xe');var _0xbb6731=_0x4a38b9[_0x73ab('0xd')];maskSensitiveData(_0xbb6731);}return util['format'](_0x2cd245,_0x4a38b9[_0x73ab('0xf')],_0x4a38b9[_0x73ab('0x10')][_0x73ab('0x11')]?_0x4a38b9[_0x73ab('0x10')][_0x73ab('0x11')]:_0x4a38b9[_0x73ab('0x12')][_0x73ab('0x13')]||_0x4a38b9['ip'],_0x4a38b9[_0x73ab('0x14')],_0x1b7ad2[_0x73ab('0x15')],_0x1b7ad2[_0x73ab('0x16')],_0x4a38b9[_0x73ab('0x17')]?_0x4a38b9['user']['id']:null,_0x4a38b9[_0x73ab('0x17')]?_0x4a38b9[_0x73ab('0x17')][_0x73ab('0x18')]:null,_0x4a38b9[_0x73ab('0x17')]?_0x4a38b9[_0x73ab('0x17')][_0x73ab('0x19')]:null,_0xbb6731?util[_0x73ab('0x1a')](_0xbb6731,![],null):'');}}));_0xd51a70[_0x73ab('0x9')](ewinston[_0x73ab('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x4d2d68,_0x81fa2e){var _0x4d62c1=_0x73ab('0x1b');if(_0x4d2d68[_0x73ab('0xd')]&&_0x4d2d68[_0x73ab('0xd')][_0x73ab('0x1c')]&&_0x4d2d68[_0x73ab('0xd')]['agent_id']){_0x4d62c1=_0x73ab('0x1d');}return util['format'](_0x4d62c1,_0x4d2d68[_0x73ab('0xf')],_0x4d2d68[_0x73ab('0x10')][_0x73ab('0x11')]?_0x4d2d68[_0x73ab('0x10')][_0x73ab('0x11')]:_0x4d2d68['connection'][_0x73ab('0x13')]||_0x4d2d68['ip'],_0x4d2d68[_0x73ab('0x14')],_0x81fa2e[_0x73ab('0x15')],_0x81fa2e['responseTime'],_0x4d2d68[_0x73ab('0x17')]?_0x4d2d68['user']['id']:null,_0x4d2d68['user']?_0x4d2d68[_0x73ab('0x17')][_0x73ab('0x18')]:null,_0x4d2d68[_0x73ab('0x17')]?_0x4d2d68[_0x73ab('0x17')]['role']:null,_0x4d2d68[_0x73ab('0xd')]&&_0x4d2d68[_0x73ab('0xd')]['device']?_0x4d2d68['body']['device']:_0x73ab('0x1e'),_0x4d2d68[_0x73ab('0xd')]&&_0x4d2d68['body'][_0x73ab('0x1f')]?_0x4d2d68['body'][_0x73ab('0x1f')]:'',_0x4d2d68['body']&&_0x4d2d68['body'][_0x73ab('0x20')]?_0x4d2d68[_0x73ab('0xd')][_0x73ab('0x20')]:'');},'ignoreRoute':function(_0x35075e){var _0x500116=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x500116['test'](_0x35075e[_0x73ab('0x14')]);}}));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x21'),require(_0x73ab('0x22')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x23'),require(_0x73ab('0x24')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x25'),require(_0x73ab('0x26')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x27'),require('./api/voiceExtension'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x28'),require(_0x73ab('0x29')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x2a'),require(_0x73ab('0x2b')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x2c'),require(_0x73ab('0x2d')));_0xd51a70['use'](_0x73ab('0x2e'),require(_0x73ab('0x2f')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x30'),require(_0x73ab('0x31')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x32'),require(_0x73ab('0x33')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x34'),require(_0x73ab('0x35')));_0xd51a70['use']('/api/voice/dials/reports',require(_0x73ab('0x36')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x37'),require('./api/voiceAgentReport'));_0xd51a70[_0x73ab('0x9')]('/api/voice/queues/reports',require(_0x73ab('0x38')));_0xd51a70[_0x73ab('0x9')]('/api/members/reports',require('./api/memberReport'));_0xd51a70[_0x73ab('0x9')]('/api/trunks',require(_0x73ab('0x39')));_0xd51a70['use']('/api/voice/transfers/reports',require(_0x73ab('0x3a')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x3b'),require(_0x73ab('0x3c')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x3d'),require(_0x73ab('0x3e')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x3f'),require(_0x73ab('0x40')));_0xd51a70['use'](_0x73ab('0x41'),require(_0x73ab('0x42')));_0xd51a70[_0x73ab('0x9')]('/api/mail/interactions',require(_0x73ab('0x43')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x44'),require(_0x73ab('0x45')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x46'),require(_0x73ab('0x47')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x48'),require(_0x73ab('0x49')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x4a'),require('./api/dashboard'));_0xd51a70['use']('/api/dashboards/items',require('./api/dashboardItem'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x4b'),require(_0x73ab('0x4c')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x4d'),require('./api/faxApplication'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x4e'),require(_0x73ab('0x4f')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x50'),require(_0x73ab('0x51')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x52'),require(_0x73ab('0x53')));_0xd51a70[_0x73ab('0x9')]('/api/fax/reports/queue',require('./api/faxQueueReport'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x54'),require('./api/smsAccount'));_0xd51a70[_0x73ab('0x9')]('/api/sms/applications',require(_0x73ab('0x55')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x56'),require(_0x73ab('0x57')));_0xd51a70[_0x73ab('0x9')]('/api/sms/messages',require(_0x73ab('0x58')));_0xd51a70[_0x73ab('0x9')]('/api/sms/queues',require(_0x73ab('0x59')));_0xd51a70[_0x73ab('0x9')]('/api/openchannel/accounts',require(_0x73ab('0x5a')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x5b'),require(_0x73ab('0x5c')));_0xd51a70['use']('/api/openchannel/interactions',require(_0x73ab('0x5d')));_0xd51a70[_0x73ab('0x9')]('/api/openchannel/messages',require('./api/openchannelMessage'));_0xd51a70['use'](_0x73ab('0x5e'),require(_0x73ab('0x5f')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x60'),require(_0x73ab('0x61')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x62'),require(_0x73ab('0x63')));_0xd51a70['use'](_0x73ab('0x64'),require(_0x73ab('0x65')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x66'),require('./api/chatInteraction'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x67'),require('./api/chatMessage'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x68'),require('./api/chatOfflineMessage'));_0xd51a70['use']('/api/chat/queues',require(_0x73ab('0x69')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x6a'),require('./api/chatGroup'));_0xd51a70['use'](_0x73ab('0x6b'),require(_0x73ab('0x6c')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x6d'),require('./api/cmCompany'));_0xd51a70['use'](_0x73ab('0x6e'),require(_0x73ab('0x6f')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x70'),require(_0x73ab('0x71')));_0xd51a70[_0x73ab('0x9')]('/api/cm/hopper_black',require(_0x73ab('0x72')));_0xd51a70[_0x73ab('0x9')]('/api/cm/hopper_final',require(_0x73ab('0x73')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x74'),require(_0x73ab('0x75')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x76'),require(_0x73ab('0x77')));_0xd51a70['use'](_0x73ab('0x78'),require('./api/action'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x79'),require(_0x73ab('0x7a')));_0xd51a70[_0x73ab('0x9')]('/api/canned_answers',require(_0x73ab('0x7b')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x7c'),require(_0x73ab('0x7d')));_0xd51a70[_0x73ab('0x9')]('/api/conditions',require(_0x73ab('0x7e')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x7f'),require(_0x73ab('0x80')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x81'),require(_0x73ab('0x82')));_0xd51a70[_0x73ab('0x9')]('/api/cdr',require(_0x73ab('0x83')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x84'),require(_0x73ab('0x85')));_0xd51a70['use'](_0x73ab('0x86'),require(_0x73ab('0x87')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x88'),require(_0x73ab('0x89')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x8a'),require(_0x73ab('0x8b')));_0xd51a70[_0x73ab('0x9')]('/api/contact_item_types',require(_0x73ab('0x8c')));_0xd51a70['use'](_0x73ab('0x8d'),require(_0x73ab('0x8e')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x8f'),require(_0x73ab('0x90')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x91'),require('./api/template'));_0xd51a70[_0x73ab('0x9')]('/api/triggers',require(_0x73ab('0x92')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x93'),require(_0x73ab('0x94')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x95'),require(_0x73ab('0x96')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x97'),require(_0x73ab('0x98')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x99'),require(_0x73ab('0x9a')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x9b'),require('./api/analyticDefaultReport'));_0xd51a70['use'](_0x73ab('0x9c'),require(_0x73ab('0x9d')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x9e'),require(_0x73ab('0x9f')));_0xd51a70[_0x73ab('0x9')]('/api/analytics/field_reports',require(_0x73ab('0xa0')));_0xd51a70[_0x73ab('0x9')]('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xa1'),require('./api/intSalesforceAccount'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xa2'),require(_0x73ab('0xa3')));_0xd51a70['use'](_0x73ab('0xa4'),require(_0x73ab('0xa5')));_0xd51a70[_0x73ab('0x9')]('/api/integrations/sugarcrm/accounts',require(_0x73ab('0xa6')));_0xd51a70['use'](_0x73ab('0xa7'),require(_0x73ab('0xa8')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xa9'),require(_0x73ab('0xaa')));_0xd51a70['use'](_0x73ab('0xab'),require('./api/intDeskAccount'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xac'),require(_0x73ab('0xad')));_0xd51a70['use']('/api/integrations/desk/fields',require(_0x73ab('0xae')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xaf'),require('./api/intZohoAccount'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xb0'),require(_0x73ab('0xb1')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xb2'),require(_0x73ab('0xb3')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xb4'),require('./api/intZendeskAccount'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xb5'),require('./api/intZendeskConfiguration'));_0xd51a70['use'](_0x73ab('0xb6'),require(_0x73ab('0xb7')));_0xd51a70[_0x73ab('0x9')]('/api/integrations/freshdesk/accounts',require(_0x73ab('0xb8')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xb9'),require('./api/intFreshdeskConfiguration'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xba'),require(_0x73ab('0xbb')));_0xd51a70['use'](_0x73ab('0xbc'),require(_0x73ab('0xbd')));_0xd51a70[_0x73ab('0x9')]('/api/integrations/vtiger/configurations',require(_0x73ab('0xbe')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xbf'),require('./api/intVtigerField'));_0xd51a70[_0x73ab('0x9')]('/api/integrations/servicenow/accounts',require(_0x73ab('0xc0')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xc1'),require('./api/intServicenowConfiguration'));_0xd51a70['use']('/api/integrations/servicenow/fields',require(_0x73ab('0xc2')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xc3'),require(_0x73ab('0xc4')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xc5'),require(_0x73ab('0xc6')));_0xd51a70['use']('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xc7'),require(_0x73ab('0xc8')));_0xd51a70['use'](_0x73ab('0xc9'),require(_0x73ab('0xca')));_0xd51a70[_0x73ab('0x9')]('/api/integrations/freshsales/fields',require(_0x73ab('0xcb')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xcc'),require(_0x73ab('0xcd')));_0xd51a70['use'](_0x73ab('0xce'),require(_0x73ab('0xcf')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xd0'),require(_0x73ab('0xd1')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xd2'),require('./api/jscriptyAnswerReport'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xd3'),require(_0x73ab('0xd4')));_0xd51a70[_0x73ab('0x9')]('/api/jscripty/sessions/reports',require(_0x73ab('0xd5')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xd6'),require('./api/smsQueueReport'));_0xd51a70[_0x73ab('0x9')]('/api/square/reports',require(_0x73ab('0xd7')));_0xd51a70['use'](_0x73ab('0xd8'),require(_0x73ab('0xd9')));_0xd51a70['use'](_0x73ab('0xda'),require(_0x73ab('0xdb')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xdc'),require(_0x73ab('0xdd')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xde'),require(_0x73ab('0xdf')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xe0'),require(_0x73ab('0xe1')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xe2'),require(_0x73ab('0xe3')));_0xd51a70['use']('/api/square/messages',require(_0x73ab('0xe4')));_0xd51a70['use'](_0x73ab('0xe5'),require(_0x73ab('0xe6')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xe7'),require(_0x73ab('0xe8')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xe9'),require(_0x73ab('0xea')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xeb'),require(_0x73ab('0xec')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xed'),require(_0x73ab('0xee')));_0xd51a70['use'](_0x73ab('0xef'),require('./api/plugin'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xf0'),require(_0x73ab('0xf1')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xf2'),require('./api/chatTransferReport'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xf3'),require(_0x73ab('0xf4')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xf5'),require(_0x73ab('0xf6')));_0xd51a70['use'](_0x73ab('0xf7'),require(_0x73ab('0xf8')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xf9'),require('./api/cmList'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xfa'),require(_0x73ab('0xfb')));_0xd51a70['use']('/api/userProfiles',require(_0x73ab('0xfc')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xfd'),require(_0x73ab('0xfe')));_0xd51a70[_0x73ab('0x9')]('/api/userProfile/resources',require('./api/userProfileResource'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0xff'),require(_0x73ab('0x100')));_0xd51a70[_0x73ab('0x9')]('/api/whatsapp/accounts',require(_0x73ab('0x101')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x102'),require(_0x73ab('0x103')));_0xd51a70['use'](_0x73ab('0x104'),require(_0x73ab('0x105')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x106'),require(_0x73ab('0x107')));_0xd51a70[_0x73ab('0x9')]('/api/whatsapp/reports/queue',require(_0x73ab('0x108')));_0xd51a70['use'](_0x73ab('0x109'),require('./api/whatsappTransferReport'));_0xd51a70['use'](_0x73ab('0x10a'),require('./api/whatsappQueue'));_0xd51a70['use'](_0x73ab('0x10b'),require('./api/cloudProvider'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x10c'),require(_0x73ab('0x10d')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x10e'),require(_0x73ab('0x10f')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x110'),require(_0x73ab('0x111')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x112'),require('./api/jira'));_0xd51a70[_0x73ab('0x9')]('/api/rpc',require(_0x73ab('0x113')));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x114'),require('./api/version'));_0xd51a70[_0x73ab('0x9')]('/api/system',require('./api/system'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x115'),require('./api/pm2'));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x116'),require(_0x73ab('0x117')));_0xd51a70['use'](_0x73ab('0x118'),express['static'](path[_0x73ab('0x119')](config[_0x73ab('0x11a')],_0x73ab('0x118'))));_0xd51a70['use'](_0x73ab('0x11b'),express['static'](path['join'](config[_0x73ab('0x11a')],_0x73ab('0x11b'))));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x11c'),express['static'](path[_0x73ab('0x119')](config['root'],_0x73ab('0x11c'))));_0xd51a70[_0x73ab('0x9')](_0x73ab('0x11d'),express[_0x73ab('0x11e')](path['join'](config['root'],_0x73ab('0x11f'),_0x73ab('0x120'))));_0xd51a70[_0x73ab('0x9')]('/plugins',express[_0x73ab('0x11e')](path['join'](config[_0x73ab('0x11a')],'/server/files/plugins')));_0xd51a70['route'](_0x73ab('0x121'))['get'](errors[0x194]);_0xd51a70[_0x73ab('0x122')]('/*')['get'](function(_0x59b90c,_0x506ce6){_0x506ce6[_0x73ab('0x123')](path[_0x73ab('0x124')](_0xd51a70['get'](_0x73ab('0x125'))+_0x73ab('0x126')));});};var sensitiveFields=[_0x73ab('0x127'),_0x73ab('0x128'),_0x73ab('0x129'),'apiKey',_0x73ab('0x12a'),_0x73ab('0x12b'),_0x73ab('0x12c'),_0x73ab('0x12d'),_0x73ab('0x12e'),_0x73ab('0x12f'),_0x73ab('0x130'),_0x73ab('0x131'),'clientSecret',_0x73ab('0x132'),_0x73ab('0x133'),_0x73ab('0x134'),_0x73ab('0x135'),'token',_0x73ab('0x136'),'accessToken',_0x73ab('0x137'),_0x73ab('0x138'),'consumerKey',_0x73ab('0x139'),_0x73ab('0x13a'),_0x73ab('0x13b'),_0x73ab('0x13c'),_0x73ab('0x13d'),_0x73ab('0x13e'),_0x73ab('0x13f'),_0x73ab('0x140'),_0x73ab('0x141'),_0x73ab('0x142'),_0x73ab('0x143'),_0x73ab('0x17'),_0x73ab('0x144'),_0x73ab('0x145'),_0x73ab('0x146'),'dsn',_0x73ab('0x147'),'registry',_0x73ab('0x148')];function maskSensitiveData(_0x1b3259){var _0x3c0c17=/(?!^)[\s\S](?!$)/g;if(!_[_0x73ab('0x149')](_0x1b3259))return;for(var _0x1e2b68 in _0x1b3259){if(_[_0x73ab('0x14a')](_0x1b3259[_0x1e2b68])){for(var _0xefbf5f=0x0;_0xefbf5f<_0x1b3259[_0x1e2b68][_0x73ab('0x14b')];_0xefbf5f++){maskSensitiveData(_0x1b3259[_0x1e2b68][_0xefbf5f]);}}else if(_[_0x73ab('0x149')](_0x1b3259[_0x1e2b68])){maskSensitiveData(_0x1b3259[_0x1e2b68]);}else if(_[_0x73ab('0x14c')](_0x1b3259[_0x1e2b68])){_0x1b3259[_0x1e2b68]=_0x1b3259[_0x1e2b68][_0x73ab('0x14d')](/{{{/g,'@@{')[_0x73ab('0x14d')](/}}}/g,_0x73ab('0x14e'))[_0x73ab('0x14d')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x73ab('0x14f')](sensitiveFields,_0x1e2b68)){_0x1b3259[_0x1e2b68]=_0x1b3259[_0x1e2b68]['replace'](_0x3c0c17,'*');}}}} \ No newline at end of file +var _0x2332=['./config/logger','api','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','method','statusCode','other','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceCallReport','/api/voice/dials/reports','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/applications','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','/api/fax/queues','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','/api/license','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','./api/realtime','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','/apidoc','join','root','/www','static','/demo','/snippet','3.0.0','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','apiKey','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum','vidaooApiKey','privateKey','accesskeyid','accountSid','localstationid','dsn','secret','isArray','length','isPlainObject','isString','replace','@@{','}@@','includes','lodash','path','express','express-winston','./errors'];(function(_0x37c8ea,_0x4836d2){var _0x541409=function(_0x32f68f){while(--_0x32f68f){_0x37c8ea['push'](_0x37c8ea['shift']());}};_0x541409(++_0x4836d2);}(_0x2332,0x13e));var _0x2233=function(_0x5238a8,_0x23597f){_0x5238a8=_0x5238a8-0x0;var _0x296b76=_0x2332[_0x5238a8];return _0x296b76;};'use strict';var _=require(_0x2233('0x0'));var path=require(_0x2233('0x1'));var express=require(_0x2233('0x2'));var ewinston=require(_0x2233('0x3'));var util=require('util');var errors=require(_0x2233('0x4'));var config=require('./config/environment');var logger=require(_0x2233('0x5'))(_0x2233('0x6'));var authLogger=require(_0x2233('0x5'))(_0x2233('0x7'));exports['default']=function(_0x4479d0){_0x4479d0[_0x2233('0x8')](ewinston[_0x2233('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x519331,_0x1d5a76){var _0x895d83=_0x2233('0xa');if(!_[_0x2233('0xb')](_0x519331[_0x2233('0xc')])){_0x895d83+='\x20body=%s';var _0x13325e=_0x519331[_0x2233('0xc')];maskSensitiveData(_0x13325e);}return util['format'](_0x895d83,_0x519331['method'],_0x519331[_0x2233('0xd')][_0x2233('0xe')]?_0x519331[_0x2233('0xd')][_0x2233('0xe')]:_0x519331[_0x2233('0xf')][_0x2233('0x10')]||_0x519331['ip'],_0x519331[_0x2233('0x11')],_0x1d5a76['statusCode'],_0x1d5a76[_0x2233('0x12')],_0x519331[_0x2233('0x13')]?_0x519331[_0x2233('0x13')]['id']:null,_0x519331[_0x2233('0x13')]?_0x519331['user'][_0x2233('0x14')]:null,_0x519331[_0x2233('0x13')]?_0x519331[_0x2233('0x13')][_0x2233('0x15')]:null,_0x13325e?util['inspect'](_0x13325e,![],null):'');}}));_0x4479d0['use'](ewinston[_0x2233('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x46641a,_0x37ac7f){var _0x5de81e=_0x2233('0x16');if(_0x46641a['body']&&_0x46641a[_0x2233('0xc')][_0x2233('0x17')]&&_0x46641a[_0x2233('0xc')][_0x2233('0x18')]){_0x5de81e=_0x2233('0x19');}return util[_0x2233('0x1a')](_0x5de81e,_0x46641a[_0x2233('0x1b')],_0x46641a[_0x2233('0xd')][_0x2233('0xe')]?_0x46641a[_0x2233('0xd')][_0x2233('0xe')]:_0x46641a[_0x2233('0xf')][_0x2233('0x10')]||_0x46641a['ip'],_0x46641a[_0x2233('0x11')],_0x37ac7f[_0x2233('0x1c')],_0x37ac7f[_0x2233('0x12')],_0x46641a[_0x2233('0x13')]?_0x46641a[_0x2233('0x13')]['id']:null,_0x46641a[_0x2233('0x13')]?_0x46641a[_0x2233('0x13')][_0x2233('0x14')]:null,_0x46641a[_0x2233('0x13')]?_0x46641a['user'][_0x2233('0x15')]:null,_0x46641a['body']&&_0x46641a[_0x2233('0xc')][_0x2233('0x17')]?_0x46641a['body'][_0x2233('0x17')]:_0x2233('0x1d'),_0x46641a[_0x2233('0xc')]&&_0x46641a['body']['agent_id']?_0x46641a[_0x2233('0xc')][_0x2233('0x18')]:'',_0x46641a[_0x2233('0xc')]&&_0x46641a[_0x2233('0xc')][_0x2233('0x1e')]?_0x46641a[_0x2233('0xc')][_0x2233('0x1e')]:'');},'ignoreRoute':function(_0x448adc){var _0xd3cc54=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xd3cc54[_0x2233('0x1f')](_0x448adc[_0x2233('0x11')]);}}));_0x4479d0[_0x2233('0x8')]('/api/users',require(_0x2233('0x20')));_0x4479d0[_0x2233('0x8')](_0x2233('0x21'),require(_0x2233('0x22')));_0x4479d0[_0x2233('0x8')](_0x2233('0x23'),require(_0x2233('0x24')));_0x4479d0[_0x2233('0x8')](_0x2233('0x25'),require('./api/voiceExtension'));_0x4479d0['use']('/api/voice/mohs',require(_0x2233('0x26')));_0x4479d0[_0x2233('0x8')]('/api/voice/queues',require('./api/voiceQueue'));_0x4479d0['use'](_0x2233('0x27'),require(_0x2233('0x28')));_0x4479d0[_0x2233('0x8')](_0x2233('0x29'),require(_0x2233('0x2a')));_0x4479d0[_0x2233('0x8')](_0x2233('0x2b'),require(_0x2233('0x2c')));_0x4479d0[_0x2233('0x8')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x4479d0[_0x2233('0x8')]('/api/voice/calls/reports',require(_0x2233('0x2d')));_0x4479d0['use'](_0x2233('0x2e'),require('./api/voiceDialReport'));_0x4479d0[_0x2233('0x8')](_0x2233('0x2f'),require(_0x2233('0x30')));_0x4479d0[_0x2233('0x8')](_0x2233('0x31'),require(_0x2233('0x32')));_0x4479d0[_0x2233('0x8')](_0x2233('0x33'),require(_0x2233('0x34')));_0x4479d0['use']('/api/trunks',require(_0x2233('0x35')));_0x4479d0[_0x2233('0x8')](_0x2233('0x36'),require(_0x2233('0x37')));_0x4479d0['use'](_0x2233('0x38'),require(_0x2233('0x39')));_0x4479d0[_0x2233('0x8')](_0x2233('0x3a'),require(_0x2233('0x3b')));_0x4479d0[_0x2233('0x8')](_0x2233('0x3c'),require(_0x2233('0x3d')));_0x4479d0['use'](_0x2233('0x3e'),require(_0x2233('0x3f')));_0x4479d0[_0x2233('0x8')](_0x2233('0x40'),require('./api/mailInteraction'));_0x4479d0[_0x2233('0x8')]('/api/mail/messages',require('./api/mailMessage'));_0x4479d0[_0x2233('0x8')](_0x2233('0x41'),require('./api/mailApplication'));_0x4479d0[_0x2233('0x8')](_0x2233('0x42'),require('./api/mailQueueReport'));_0x4479d0[_0x2233('0x8')]('/api/dashboards',require(_0x2233('0x43')));_0x4479d0[_0x2233('0x8')](_0x2233('0x44'),require(_0x2233('0x45')));_0x4479d0[_0x2233('0x8')](_0x2233('0x46'),require(_0x2233('0x47')));_0x4479d0['use']('/api/fax/applications',require(_0x2233('0x48')));_0x4479d0[_0x2233('0x8')](_0x2233('0x49'),require(_0x2233('0x4a')));_0x4479d0[_0x2233('0x8')](_0x2233('0x4b'),require('./api/faxMessage'));_0x4479d0[_0x2233('0x8')](_0x2233('0x4c'),require('./api/faxQueue'));_0x4479d0[_0x2233('0x8')](_0x2233('0x4d'),require(_0x2233('0x4e')));_0x4479d0['use']('/api/sms/accounts',require(_0x2233('0x4f')));_0x4479d0['use'](_0x2233('0x50'),require(_0x2233('0x51')));_0x4479d0[_0x2233('0x8')](_0x2233('0x52'),require(_0x2233('0x53')));_0x4479d0[_0x2233('0x8')](_0x2233('0x54'),require(_0x2233('0x55')));_0x4479d0['use'](_0x2233('0x56'),require(_0x2233('0x57')));_0x4479d0[_0x2233('0x8')](_0x2233('0x58'),require('./api/openchannelAccount'));_0x4479d0[_0x2233('0x8')](_0x2233('0x59'),require('./api/openchannelApplication'));_0x4479d0[_0x2233('0x8')](_0x2233('0x5a'),require(_0x2233('0x5b')));_0x4479d0[_0x2233('0x8')](_0x2233('0x5c'),require(_0x2233('0x5d')));_0x4479d0[_0x2233('0x8')]('/api/openchannel/queues',require(_0x2233('0x5e')));_0x4479d0[_0x2233('0x8')]('/api/chat/websites',require(_0x2233('0x5f')));_0x4479d0[_0x2233('0x8')]('/api/openchannel/reports/queue',require(_0x2233('0x60')));_0x4479d0['use'](_0x2233('0x61'),require(_0x2233('0x62')));_0x4479d0[_0x2233('0x8')](_0x2233('0x63'),require(_0x2233('0x64')));_0x4479d0['use'](_0x2233('0x65'),require(_0x2233('0x66')));_0x4479d0[_0x2233('0x8')](_0x2233('0x67'),require(_0x2233('0x68')));_0x4479d0[_0x2233('0x8')](_0x2233('0x69'),require(_0x2233('0x6a')));_0x4479d0[_0x2233('0x8')](_0x2233('0x6b'),require(_0x2233('0x6c')));_0x4479d0[_0x2233('0x8')]('/api/chat/proactive_actions',require(_0x2233('0x6d')));_0x4479d0[_0x2233('0x8')](_0x2233('0x6e'),require(_0x2233('0x6f')));_0x4479d0[_0x2233('0x8')](_0x2233('0x70'),require('./api/cmContact'));_0x4479d0[_0x2233('0x8')](_0x2233('0x71'),require(_0x2233('0x72')));_0x4479d0[_0x2233('0x8')](_0x2233('0x73'),require(_0x2233('0x74')));_0x4479d0[_0x2233('0x8')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x4479d0[_0x2233('0x8')](_0x2233('0x75'),require(_0x2233('0x76')));_0x4479d0[_0x2233('0x8')](_0x2233('0x77'),require('./api/cmCustomField'));_0x4479d0[_0x2233('0x8')](_0x2233('0x78'),require(_0x2233('0x79')));_0x4479d0[_0x2233('0x8')](_0x2233('0x7a'),require('./api/automation'));_0x4479d0[_0x2233('0x8')](_0x2233('0x7b'),require(_0x2233('0x7c')));_0x4479d0[_0x2233('0x8')](_0x2233('0x7d'),require(_0x2233('0x7e')));_0x4479d0[_0x2233('0x8')](_0x2233('0x7f'),require(_0x2233('0x80')));_0x4479d0[_0x2233('0x8')]('/api/intervals',require(_0x2233('0x81')));_0x4479d0[_0x2233('0x8')](_0x2233('0x82'),require('./api/pause'));_0x4479d0[_0x2233('0x8')](_0x2233('0x83'),require(_0x2233('0x84')));_0x4479d0[_0x2233('0x8')](_0x2233('0x85'),require(_0x2233('0x86')));_0x4479d0[_0x2233('0x8')](_0x2233('0x87'),require(_0x2233('0x88')));_0x4479d0[_0x2233('0x8')](_0x2233('0x89'),require(_0x2233('0x8a')));_0x4479d0['use']('/api/tags',require(_0x2233('0x8b')));_0x4479d0[_0x2233('0x8')](_0x2233('0x8c'),require(_0x2233('0x8d')));_0x4479d0[_0x2233('0x8')](_0x2233('0x8e'),require('./api/cmContactHasItem'));_0x4479d0['use'](_0x2233('0x8f'),require(_0x2233('0x90')));_0x4479d0['use'](_0x2233('0x91'),require(_0x2233('0x92')));_0x4479d0[_0x2233('0x8')](_0x2233('0x93'),require(_0x2233('0x94')));_0x4479d0[_0x2233('0x8')](_0x2233('0x95'),require(_0x2233('0x96')));_0x4479d0[_0x2233('0x8')](_0x2233('0x97'),require(_0x2233('0x98')));_0x4479d0[_0x2233('0x8')](_0x2233('0x99'),require('./api/integrationReport'));_0x4479d0['use'](_0x2233('0x9a'),require(_0x2233('0x9b')));_0x4479d0[_0x2233('0x8')](_0x2233('0x9c'),require(_0x2233('0x9d')));_0x4479d0[_0x2233('0x8')](_0x2233('0x9e'),require('./api/analyticExtractedReport'));_0x4479d0[_0x2233('0x8')](_0x2233('0x9f'),require(_0x2233('0xa0')));_0x4479d0[_0x2233('0x8')]('/api/analytics/field_reports',require(_0x2233('0xa1')));_0x4479d0[_0x2233('0x8')](_0x2233('0xa2'),require(_0x2233('0xa3')));_0x4479d0[_0x2233('0x8')](_0x2233('0xa4'),require(_0x2233('0xa5')));_0x4479d0[_0x2233('0x8')]('/api/integrations/salesforce/configurations',require('./api/intSalesforceConfiguration'));_0x4479d0[_0x2233('0x8')]('/api/integrations/salesforce/fields',require(_0x2233('0xa6')));_0x4479d0[_0x2233('0x8')](_0x2233('0xa7'),require(_0x2233('0xa8')));_0x4479d0[_0x2233('0x8')](_0x2233('0xa9'),require(_0x2233('0xaa')));_0x4479d0[_0x2233('0x8')](_0x2233('0xab'),require('./api/intSugarcrmField'));_0x4479d0[_0x2233('0x8')](_0x2233('0xac'),require(_0x2233('0xad')));_0x4479d0[_0x2233('0x8')]('/api/integrations/desk/configurations',require(_0x2233('0xae')));_0x4479d0[_0x2233('0x8')](_0x2233('0xaf'),require('./api/intDeskField'));_0x4479d0[_0x2233('0x8')]('/api/integrations/zoho/accounts',require('./api/intZohoAccount'));_0x4479d0[_0x2233('0x8')](_0x2233('0xb0'),require(_0x2233('0xb1')));_0x4479d0[_0x2233('0x8')](_0x2233('0xb2'),require(_0x2233('0xb3')));_0x4479d0['use']('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x4479d0['use']('/api/integrations/zendesk/configurations',require(_0x2233('0xb4')));_0x4479d0[_0x2233('0x8')](_0x2233('0xb5'),require('./api/intZendeskField'));_0x4479d0[_0x2233('0x8')](_0x2233('0xb6'),require('./api/intFreshdeskAccount'));_0x4479d0[_0x2233('0x8')](_0x2233('0xb7'),require(_0x2233('0xb8')));_0x4479d0[_0x2233('0x8')](_0x2233('0xb9'),require(_0x2233('0xba')));_0x4479d0[_0x2233('0x8')]('/api/integrations/vtiger/accounts',require(_0x2233('0xbb')));_0x4479d0[_0x2233('0x8')](_0x2233('0xbc'),require(_0x2233('0xbd')));_0x4479d0['use']('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x4479d0[_0x2233('0x8')](_0x2233('0xbe'),require(_0x2233('0xbf')));_0x4479d0[_0x2233('0x8')](_0x2233('0xc0'),require('./api/intServicenowConfiguration'));_0x4479d0[_0x2233('0x8')](_0x2233('0xc1'),require('./api/intServicenowField'));_0x4479d0['use'](_0x2233('0xc2'),require(_0x2233('0xc3')));_0x4479d0[_0x2233('0x8')]('/api/integrations/dynamics365/configurations',require(_0x2233('0xc4')));_0x4479d0['use'](_0x2233('0xc5'),require(_0x2233('0xc6')));_0x4479d0['use'](_0x2233('0xc7'),require(_0x2233('0xc8')));_0x4479d0[_0x2233('0x8')](_0x2233('0xc9'),require(_0x2233('0xca')));_0x4479d0[_0x2233('0x8')]('/api/integrations/freshsales/fields',require(_0x2233('0xcb')));_0x4479d0[_0x2233('0x8')](_0x2233('0xcc'),require(_0x2233('0xcd')));_0x4479d0[_0x2233('0x8')](_0x2233('0xce'),require(_0x2233('0xcf')));_0x4479d0['use']('/api/chat/internal/messages',require(_0x2233('0xd0')));_0x4479d0[_0x2233('0x8')](_0x2233('0xd1'),require(_0x2233('0xd2')));_0x4479d0[_0x2233('0x8')](_0x2233('0xd3'),require(_0x2233('0xd4')));_0x4479d0['use'](_0x2233('0xd5'),require(_0x2233('0xd6')));_0x4479d0[_0x2233('0x8')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0x4479d0['use'](_0x2233('0xd7'),require('./api/squareReport'));_0x4479d0['use']('/api/square/details/reports',require(_0x2233('0xd8')));_0x4479d0[_0x2233('0x8')]('/api/jscripty/projects',require(_0x2233('0xd9')));_0x4479d0[_0x2233('0x8')](_0x2233('0xda'),require(_0x2233('0xdb')));_0x4479d0[_0x2233('0x8')](_0x2233('0xdc'),require(_0x2233('0xdd')));_0x4479d0[_0x2233('0x8')](_0x2233('0xde'),require('./api/squareProject'));_0x4479d0['use'](_0x2233('0xdf'),require(_0x2233('0xe0')));_0x4479d0['use'](_0x2233('0xe1'),require('./api/squareMessage'));_0x4479d0[_0x2233('0x8')](_0x2233('0xe2'),require('./api/team'));_0x4479d0[_0x2233('0x8')](_0x2233('0xe3'),require('./api/license'));_0x4479d0[_0x2233('0x8')]('/api/campaigns',require(_0x2233('0xe4')));_0x4479d0[_0x2233('0x8')](_0x2233('0xe5'),require('./api/migration'));_0x4479d0['use'](_0x2233('0xe6'),require(_0x2233('0xe7')));_0x4479d0['use'](_0x2233('0xe8'),require('./api/plugin'));_0x4479d0[_0x2233('0x8')]('/api/mail/reports/transfer',require(_0x2233('0xe9')));_0x4479d0[_0x2233('0x8')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x4479d0[_0x2233('0x8')](_0x2233('0xea'),require(_0x2233('0xeb')));_0x4479d0[_0x2233('0x8')](_0x2233('0xec'),require(_0x2233('0xed')));_0x4479d0['use']('/api/sms/reports/transfer',require(_0x2233('0xee')));_0x4479d0[_0x2233('0x8')](_0x2233('0xef'),require(_0x2233('0xf0')));_0x4479d0[_0x2233('0x8')]('/api/voice/prefixes',require(_0x2233('0xf1')));_0x4479d0[_0x2233('0x8')](_0x2233('0xf2'),require(_0x2233('0xf3')));_0x4479d0[_0x2233('0x8')](_0x2233('0xf4'),require(_0x2233('0xf5')));_0x4479d0[_0x2233('0x8')](_0x2233('0xf6'),require(_0x2233('0xf7')));_0x4479d0[_0x2233('0x8')](_0x2233('0xf8'),require('./api/userNotification'));_0x4479d0[_0x2233('0x8')](_0x2233('0xf9'),require(_0x2233('0xfa')));_0x4479d0[_0x2233('0x8')](_0x2233('0xfb'),require(_0x2233('0xfc')));_0x4479d0[_0x2233('0x8')](_0x2233('0xfd'),require('./api/whatsappInteraction'));_0x4479d0['use'](_0x2233('0xfe'),require(_0x2233('0xff')));_0x4479d0[_0x2233('0x8')]('/api/whatsapp/reports/queue',require(_0x2233('0x100')));_0x4479d0[_0x2233('0x8')](_0x2233('0x101'),require(_0x2233('0x102')));_0x4479d0['use'](_0x2233('0x103'),require('./api/whatsappQueue'));_0x4479d0[_0x2233('0x8')](_0x2233('0x104'),require(_0x2233('0x105')));_0x4479d0[_0x2233('0x8')]('/api/realtime',require(_0x2233('0x106')));_0x4479d0[_0x2233('0x8')]('/api/auth/local',require('./api/authLocal'));_0x4479d0[_0x2233('0x8')](_0x2233('0x107'),require(_0x2233('0x108')));_0x4479d0[_0x2233('0x8')](_0x2233('0x109'),require('./api/jira'));_0x4479d0[_0x2233('0x8')](_0x2233('0x10a'),require(_0x2233('0x10b')));_0x4479d0[_0x2233('0x8')](_0x2233('0x10c'),require(_0x2233('0x10d')));_0x4479d0[_0x2233('0x8')]('/api/system',require(_0x2233('0x10e')));_0x4479d0[_0x2233('0x8')](_0x2233('0x10f'),require('./api/pm2'));_0x4479d0['use']('/api/webbar',require('./api/webbar'));_0x4479d0[_0x2233('0x8')](_0x2233('0x110'),express['static'](path[_0x2233('0x111')](config[_0x2233('0x112')],_0x2233('0x110'))));_0x4479d0['use'](_0x2233('0x113'),express[_0x2233('0x114')](path[_0x2233('0x111')](config[_0x2233('0x112')],_0x2233('0x113'))));_0x4479d0['use'](_0x2233('0x115'),express[_0x2233('0x114')](path[_0x2233('0x111')](config['root'],_0x2233('0x115'))));_0x4479d0[_0x2233('0x8')](_0x2233('0x116'),express[_0x2233('0x114')](path['join'](config[_0x2233('0x112')],'snippet',_0x2233('0x117'))));_0x4479d0[_0x2233('0x8')]('/plugins',express[_0x2233('0x114')](path[_0x2233('0x111')](config[_0x2233('0x112')],'/server/files/plugins')));_0x4479d0[_0x2233('0x118')](_0x2233('0x119'))[_0x2233('0x11a')](errors[0x194]);_0x4479d0[_0x2233('0x118')]('/*')[_0x2233('0x11a')](function(_0x592911,_0x47d8b7){_0x47d8b7[_0x2233('0x11b')](path[_0x2233('0x11c')](_0x4479d0[_0x2233('0x11a')](_0x2233('0x11d'))+_0x2233('0x11e')));});};var sensitiveFields=[_0x2233('0x11f'),_0x2233('0x120'),'newPassword',_0x2233('0x121'),'firstName',_0x2233('0x122'),_0x2233('0x123'),_0x2233('0x124'),_0x2233('0x125'),_0x2233('0x126'),_0x2233('0x127'),_0x2233('0x128'),_0x2233('0x129'),_0x2233('0x12a'),_0x2233('0x12b'),_0x2233('0x12c'),_0x2233('0x12d'),'token','channelSecret',_0x2233('0x12e'),_0x2233('0x12f'),_0x2233('0x130'),_0x2233('0x131'),_0x2233('0x132'),'membername','calleridname',_0x2233('0x133'),'exten',_0x2233('0x134'),'clientEmail',_0x2233('0x135'),_0x2233('0x136'),'secretaccesskey','key','user','pass',_0x2233('0x137'),_0x2233('0x138'),_0x2233('0x139'),_0x2233('0x13a'),'registry','oldPassword'];function maskSensitiveData(_0x23d830){var _0x2bbc16=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x23d830))return;for(var _0x451597 in _0x23d830){if(_[_0x2233('0x13b')](_0x23d830[_0x451597])){for(var _0x3c0917=0x0;_0x3c0917<_0x23d830[_0x451597][_0x2233('0x13c')];_0x3c0917++){maskSensitiveData(_0x23d830[_0x451597][_0x3c0917]);}}else if(_[_0x2233('0x13d')](_0x23d830[_0x451597])){maskSensitiveData(_0x23d830[_0x451597]);}else if(_[_0x2233('0x13e')](_0x23d830[_0x451597])){_0x23d830[_0x451597]=_0x23d830[_0x451597][_0x2233('0x13f')](/{{{/g,_0x2233('0x140'))[_0x2233('0x13f')](/}}}/g,_0x2233('0x141'))[_0x2233('0x13f')](/{{/g,'@{')[_0x2233('0x13f')](/}}/g,'}@');if(_[_0x2233('0x142')](sensitiveFields,_0x451597)){_0x23d830[_0x451597]=_0x23d830[_0x451597]['replace'](_0x2bbc16,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 61bb62d..7e519eb 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad36=['lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/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!','default','jayson/promise','bluebird'];(function(_0xf576,_0x34355c){var _0x196daf=function(_0xd22dca){while(--_0xd22dca){_0xf576['push'](_0xf576['shift']());}};_0x196daf(++_0x34355c);}(_0xad36,0x1c6));var _0x6ad3=function(_0x5b6891,_0x1178c9){_0x5b6891=_0x5b6891-0x0;var _0x2e8349=_0xad36[_0x5b6891];return _0x2e8349;};'use strict';var jayson=require(_0x6ad3('0x0'));var BPromise=require(_0x6ad3('0x1'));var _=require(_0x6ad3('0x2'));var config=require(_0x6ad3('0x3'));exports[_0x6ad3('0x4')]=function(){return new BPromise(function(_0x347af6,_0x24a333){var _0xaf75a8={};_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x6')));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0x7')));_0xaf75a8=_['merge'](_0xaf75a8,require('../api/voiceQueue/voiceQueue.rpc'));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x8')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x9')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require('../api/voiceDialReport/voiceDialReport.rpc'));_0xaf75a8=_['merge'](_0xaf75a8,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0xa')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0xb')));_0xaf75a8=_['merge'](_0xaf75a8,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0xc')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0xd')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0xe')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0xf')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x10')));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0x11')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x12')));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0x13')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x14')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x15')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x16')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x17')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x18')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x19')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x1a')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x1b')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x1c')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x1d')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x1e')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0xaf75a8=_['merge'](_0xaf75a8,require('../api/openchannelMessage/openchannelMessage.rpc'));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xaf75a8=_['merge'](_0xaf75a8,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x1f')));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0x20')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x21')));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0x22')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x23')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x24')));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0x25')));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0x26')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x27')));_0xaf75a8=_['merge'](_0xaf75a8,require('../api/interval/interval.rpc'));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x28')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x29')));_0xaf75a8=_['merge'](_0xaf75a8,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x2a')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x2b')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x2c')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x2d')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x2e')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x2f')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x30')));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0x31')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0x32')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x33')));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0x34')));_0xaf75a8=_['merge'](_0xaf75a8,require('../api/smsQueueReport/smsQueueReport.rpc'));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x35')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x36')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x37')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x38')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x39')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x3a')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x3b')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x3c')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x3d')));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0x3e')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x3f')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x40')));_0xaf75a8=_['merge'](_0xaf75a8,require(_0x6ad3('0x41')));_0xaf75a8=_[_0x6ad3('0x5')](_0xaf75a8,require(_0x6ad3('0x42')));var _0x2bb03d=jayson[_0x6ad3('0x43')](_0xaf75a8)[_0x6ad3('0x44')]();var _0x9e9b4a=config[_0x6ad3('0x45')][_0x6ad3('0x46')]||config['port']+0x1;var _0x274469=config['rpc']['ip']||_0x6ad3('0x47');_0x2bb03d['on'](_0x6ad3('0x48'),function(_0x187b89){return _0x24a333(_0x187b89);});_0x2bb03d[_0x6ad3('0x4')](_0x9e9b4a,_0x274469,function(){console[_0x6ad3('0x49')](_0x6ad3('0x4a'),_0x274469,_0x9e9b4a);require('../config/triggers')[_0x6ad3('0x4b')]();return _0x347af6('RPC\x20listening\x20on\x20'+_0x274469+':'+_0x9e9b4a);});});}; \ No newline at end of file +var _0x6607=['../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','bluebird','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/attachment/attachment.rpc'];(function(_0x50a03f,_0x4b30de){var _0x199e40=function(_0x51e169){while(--_0x51e169){_0x50a03f['push'](_0x50a03f['shift']());}};_0x199e40(++_0x4b30de);}(_0x6607,0x1cf));var _0x7660=function(_0x50d199,_0x41a47f){_0x50d199=_0x50d199-0x0;var _0x13cab2=_0x6607[_0x50d199];return _0x13cab2;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x7660('0x0'));var _=require(_0x7660('0x1'));var config=require(_0x7660('0x2'));exports[_0x7660('0x3')]=function(){return new BPromise(function(_0x3bf899,_0x311cb7){var _0x45cc6e={};_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x5')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/voiceExtension/voiceExtension.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x6')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x7')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x8')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x9')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0xa')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0xb')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0xc')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0xd')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0xe')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0xf')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x10')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x11')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x12')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x13')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x14')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x15')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x16')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x17')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/faxInteraction/faxInteraction.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x18')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x19')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x1a')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x1b')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x1c')));_0x45cc6e=_['merge'](_0x45cc6e,require('../api/smsMessage/smsMessage.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x1d')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x1e')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x45cc6e=_['merge'](_0x45cc6e,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x1f')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x20')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x21')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x22')));_0x45cc6e=_['merge'](_0x45cc6e,require('../api/chatQueue/chatQueue.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x23')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x24')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x25')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x26')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x27')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x28')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x29')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x2a')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x2b')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x2c')));_0x45cc6e=_['merge'](_0x45cc6e,require('../api/variable/variable.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x2d')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x2e')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x2f')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x30')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x31')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x32')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x33')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x34')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x35')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x36')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x37')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x38')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x39')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x3a')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x3b')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x3c')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/squareMessage/squareMessage.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/campaign/campaign.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x3d')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/plugin/plugin.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x3e')));_0x45cc6e=_['merge'](_0x45cc6e,require(_0x7660('0x3f')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require(_0x7660('0x40')));_0x45cc6e=_[_0x7660('0x4')](_0x45cc6e,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x528467=jayson[_0x7660('0x41')](_0x45cc6e)[_0x7660('0x42')]();var _0x7e899d=config[_0x7660('0x43')]['port']||config[_0x7660('0x44')]+0x1;var _0x3162de=config[_0x7660('0x43')]['ip']||_0x7660('0x45');_0x528467['on'](_0x7660('0x46'),function(_0x47f7e4){return _0x311cb7(_0x47f7e4);});_0x528467['listen'](_0x7e899d,_0x3162de,function(){console[_0x7660('0x47')](_0x7660('0x48'),_0x3162de,_0x7e899d);require(_0x7660('0x49'))['default']();return _0x3bf899(_0x7660('0x4a')+_0x3162de+':'+_0x7e899d);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 5501aa6..3b23667 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 _0xf9a9=['getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20EXTENSION\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','exec','AGI','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','emit','ready','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','replace','result=','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','inherits','prototype','sendRequest','answer','ANSWER'];(function(_0x201d3c,_0x166714){var _0x513fbd=function(_0x520540){while(--_0x520540){_0x201d3c['push'](_0x201d3c['shift']());}};_0x513fbd(++_0x166714);}(_0xf9a9,0xfe));var _0x9f9a=function(_0x2cae5e,_0xf56439){_0x2cae5e=_0x2cae5e-0x0;var _0x5f2457=_0xf9a9[_0x2cae5e];return _0x5f2457;};'use strict';var util=require(_0x9f9a('0x0'));var _=require(_0x9f9a('0x1'));var EventEmitter=require(_0x9f9a('0x2'))[_0x9f9a('0x3')];var AGIReply=require(_0x9f9a('0x4'));var AGIError=require('./error');function AGIChannel(_0x23ee8e){var _0x1c0144=this,_0xa3e405=new AGIReply(),_0x1245c9=![],_0x9e1b3b={};EventEmitter[_0x9f9a('0x5')](_0x1c0144);_0x23ee8e[_0x9f9a('0x6')](_0x9f9a('0x7'));_0x23ee8e[_0x9f9a('0x8')](0x8*0x3c*0x3c*0x3e8);_0xa3e405['setEncoding'](_0x9f9a('0x7'));_0xa3e405['on']('headers',function(_0x462245){for(var _0x56114b in _0x462245){_0x1c0144[_0x56114b]=_0x462245[_0x56114b];}_0x1c0144[_0x9f9a('0x9')](_0x9f9a('0xa'));});_0xa3e405['on']('line',function(_0x4e9f84){if(_0x4e9f84[_0x9f9a('0xb')]()=='hangup'){_0x1c0144[_0x9f9a('0x9')](_0x9f9a('0xc'));return;}if(_0x4e9f84[_0x9f9a('0xd')](0x0,0xb)==_0x9f9a('0xe')){_0x1245c9=!![];}if(_0x1245c9){_0x9e1b3b['rx']+=_0x4e9f84+'\x0a';if(_0x4e9f84['search'](_0x9f9a('0xf'))!=-0x1){_0x1245c9=![];}}else{_0x9e1b3b['rx']=_0x4e9f84;}if(_0x1245c9){return;}if(typeof _0x9e1b3b['cb']==_0x9f9a('0x10')){var _0x635009=_0x9e1b3b['rx'][_0x9f9a('0xd')](0x0,0x3),_0x1e483b=null,_0x1a4250=null;_0x635009=parseInt(_0x635009);if(isNaN(_0x635009)){_0x9e1b3b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x635009!=0xc8){_0x9e1b3b['cb'](null,{'code':_0x635009,'result':-0x1,'extra':'KO'});return;}_0x1e483b=_0x9e1b3b['rx'][_0x9f9a('0xd')](0x4)[_0x9f9a('0x11')](_0x9f9a('0x12'),'');if(_0x1e483b[_0x9f9a('0x13')]('\x20')!=-0x1){_0x1e483b=_0x1e483b['substr'](0x0,_0x1e483b['indexOf']('\x20'));}if(_[_0x9f9a('0x14')](_0x1e483b,'-1')){_0x1e483b=parseInt(_0x1e483b);}_0x1a4250=_0x9e1b3b['rx'][_0x9f9a('0x15')]('\x20');if(_0x1a4250['length']==0x3){_0x1a4250=_0x1a4250[0x2][_0x9f9a('0xd')](0x1,_0x1a4250[0x2][_0x9f9a('0x16')]-0x1);}else if(_0x1a4250[_0x9f9a('0x16')]>0x3){var _0x4bf43e=/\((.+)\)/;var _0x2d6320=_0x9e1b3b['rx'][_0x9f9a('0x17')](_0x4bf43e);if(_0x2d6320){_0x1a4250=_0x2d6320[0x1];}else{_0x1a4250=null;}}else{_0x1a4250=null;}_0x9e1b3b['cb'](null,{'code':_0x635009,'result':_0x1e483b,'extra':_0x1a4250});}});_0x23ee8e['on'](_0x9f9a('0x18'),function(_0x555ccb){_0x1c0144[_0x9f9a('0x9')]('error',new AGIError(_0x9f9a('0x19'),_0x555ccb[_0x9f9a('0x1a')]));});_0x23ee8e['on'](_0x9f9a('0x1b'),function(){_0x1c0144['emit']('close',new AGIError(_0x9f9a('0x1c')));});_0x23ee8e['on'](_0x9f9a('0x1d'),function(){_0x1c0144[_0x9f9a('0x9')](_0x9f9a('0x1d'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x23ee8e[_0x9f9a('0x1e')]();});_0x23ee8e[_0x9f9a('0x1f')](_0xa3e405);this[_0x9f9a('0x20')]=function(_0x816c1,_0x369b29){var _0x816c1=_0x816c1||'',_0x369b29=typeof _0x369b29==_0x9f9a('0x10')?_0x369b29:new Function();_0x9e1b3b={'tx':_0x816c1,'rx':'','cb':_0x369b29};_0x23ee8e['write'](_0x816c1+'\x0a');},this['close']=function(){_0x23ee8e[_0x9f9a('0x1e')]();};}util[_0x9f9a('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x9f9a('0x22')][_0x9f9a('0x23')]=function(_0x4ed5c8){return this[_0x9f9a('0x20')]['sync'](this,_0x4ed5c8);};AGIChannel[_0x9f9a('0x22')][_0x9f9a('0x24')]=function(){return this[_0x9f9a('0x23')](_0x9f9a('0x25'));};AGIChannel['prototype'][_0x9f9a('0x26')]=function(_0x5f407b,_0x5450d4,_0x3393b6){_0x5f407b=_0x5f407b===undefined?'beep':_0x5f407b;_0x5450d4=_0x5450d4===undefined?'5':_0x5450d4;_0x3393b6=_0x3393b6===undefined?'1':_0x3393b6;return this[_0x9f9a('0x23')](util[_0x9f9a('0x27')](_0x9f9a('0x28'),_0x5f407b,_0x5450d4*0x3e8,_0x3393b6));};AGIChannel['prototype'][_0x9f9a('0x29')]=function(_0x105d64){_0x105d64=_0x105d64||'NO\x20MESSAGE';return this['sendRequest'](util[_0x9f9a('0x27')]('VERBOSE\x20\x22%s\x22',_0x105d64));};AGIChannel['prototype']['exec']=function(_0x51a5e1,_0x5bb2e3){if(_[_0x9f9a('0x2a')](_0x5bb2e3)){return this[_0x9f9a('0x23')](util[_0x9f9a('0x27')](_0x9f9a('0x2b'),_0x51a5e1,_0x5bb2e3[_0x9f9a('0x2c')](',')));}return this['sendRequest'](util[_0x9f9a('0x27')]('EXEC\x20%s\x20%s',_0x51a5e1,_0x5bb2e3));};AGIChannel['prototype'][_0x9f9a('0x2d')]=function(_0x4bc64c){return this[_0x9f9a('0x23')](util[_0x9f9a('0x27')]('SET\x20CONTEXT\x20%s',_0x4bc64c));};AGIChannel[_0x9f9a('0x22')]['setExtension']=function(_0x6f4868){return this[_0x9f9a('0x23')](util['format'](_0x9f9a('0x2e'),_0x6f4868));};AGIChannel[_0x9f9a('0x22')]['setPriority']=function(_0x36dcd0){return this[_0x9f9a('0x23')](util[_0x9f9a('0x27')]('SET\x20PRIORITY\x20%s',_0x36dcd0));};AGIChannel[_0x9f9a('0x22')][_0x9f9a('0xc')]=function(){return this[_0x9f9a('0x23')](_0x9f9a('0x2f'));};AGIChannel['prototype'][_0x9f9a('0x30')]=function(_0x5ea116,_0x4745e8){var _0x3c40a6=_[_0x9f9a('0x31')](_0x4745e8)||_[_0x9f9a('0x32')](_0x4745e8)?_0x4745e8[_0x9f9a('0x33')]():_0x4745e8;return this[_0x9f9a('0x23')](util[_0x9f9a('0x27')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x5ea116,_0x3c40a6?_0x3c40a6[_0x9f9a('0x33')]()[_0x9f9a('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x9f9a('0x22')][_0x9f9a('0x34')]=function(_0x3951f4,_0x54c0fd){return this[_0x9f9a('0x23')](util['format'](_0x9f9a('0x35'),_0x3951f4,_0x54c0fd));};AGIChannel[_0x9f9a('0x22')][_0x9f9a('0x36')]=function(_0x366aa2,_0x364e1e){return this[_0x9f9a('0x23')](util[_0x9f9a('0x27')](_0x9f9a('0x37'),_0x366aa2,_0x364e1e));};AGIChannel[_0x9f9a('0x22')]['sayPhonetic']=function(_0x51d2cd,_0x526163){return this['sendRequest'](util[_0x9f9a('0x27')](_0x9f9a('0x38'),_0x51d2cd,_0x526163));};AGIChannel[_0x9f9a('0x22')][_0x9f9a('0x39')]=function(_0x4af229,_0x45a451,_0xaa5c6c){_0x45a451=_0x45a451||this['extension'];_0xaa5c6c=_0xaa5c6c||0x1;this['setContext'](_0x4af229);this['setExtension'](_0x45a451);this[_0x9f9a('0x3a')](_0xaa5c6c);return this[_0x9f9a('0x29')](util[_0x9f9a('0x27')](_0x9f9a('0x3b'),_0x4af229,_0x45a451,_0xaa5c6c));};AGIChannel['prototype'][_0x9f9a('0x3c')]=function(_0x484fe5){return this[_0x9f9a('0x23')](util[_0x9f9a('0x27')](_0x9f9a('0x3d'),_0x484fe5));};AGIChannel[_0x9f9a('0x22')]['recordFile']=function(_0x3de294,_0x2ca9a5,_0x1e19ac,_0x49ee7a,_0x27cc4e,_0x40e8dd){_0x2ca9a5=_0x2ca9a5||_0x9f9a('0x3e');_0x1e19ac=_0x1e19ac||'';_0x49ee7a=_0x49ee7a===undefined?-0x1:_0x49ee7a==='-1'?-0x1:_0x49ee7a*0x3e8;_0x27cc4e=_0x27cc4e===undefined?'':'s='+_0x27cc4e;_0x40e8dd=_0x40e8dd?_0x9f9a('0x3f'):'';return this[_0x9f9a('0x23')](util[_0x9f9a('0x27')](_0x9f9a('0x40'),_0x3de294,_0x2ca9a5,_0x1e19ac,_0x49ee7a,_0x40e8dd,_0x27cc4e));};AGIChannel[_0x9f9a('0x22')][_0x9f9a('0x41')]=function(_0x420a90,_0x36336c){_0x36336c=_0x36336c||'';return this[_0x9f9a('0x23')](util[_0x9f9a('0x27')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x420a90,_0x36336c));};AGIChannel['prototype'][_0x9f9a('0x42')]=function(_0x1c96a4){return this[_0x9f9a('0x43')](_0x9f9a('0x44'),_0x1c96a4);};AGIChannel[_0x9f9a('0x22')][_0x9f9a('0x45')]=function(_0x1566b5){return this[_0x9f9a('0x43')]('WAIT',_0x1566b5);};AGIChannel[_0x9f9a('0x22')]['error']=function(_0x5e188f,_0x3371d0){this[_0x9f9a('0x29')](util[_0x9f9a('0x27')](_0x9f9a('0x46'),_0x5e188f['id'],_0x5e188f[_0x9f9a('0x47')],_0x3371d0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x9f9a('0x48')]=AGIChannel; \ No newline at end of file +var _0x37c2=['label','util','lodash','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','520\x20End\x20of\x20proper','no\x20code','substring','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','write','inherits','prototype','sendRequest','sync','ANSWER','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','BEEP','streamFile','agi','AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x37c2,0x129));var _0x237c=function(_0x23ca21,_0x44a5ad){_0x23ca21=_0x23ca21-0x0;var _0x1b90d5=_0x37c2[_0x23ca21];return _0x1b90d5;};'use strict';var util=require(_0x237c('0x0'));var _=require(_0x237c('0x1'));var EventEmitter=require(_0x237c('0x2'))[_0x237c('0x3')];var AGIReply=require(_0x237c('0x4'));var AGIError=require('./error');function AGIChannel(_0x74194d){var _0x48ef4e=this,_0x291377=new AGIReply(),_0x2d0b65=![],_0x5bfcbb={};EventEmitter[_0x237c('0x5')](_0x48ef4e);_0x74194d[_0x237c('0x6')](_0x237c('0x7'));_0x74194d[_0x237c('0x8')](0x8*0x3c*0x3c*0x3e8);_0x291377[_0x237c('0x6')](_0x237c('0x7'));_0x291377['on'](_0x237c('0x9'),function(_0x185c58){for(var _0x43c084 in _0x185c58){_0x48ef4e[_0x43c084]=_0x185c58[_0x43c084];}_0x48ef4e[_0x237c('0xa')](_0x237c('0xb'));});_0x291377['on'](_0x237c('0xc'),function(_0x9ba44c){if(_0x9ba44c[_0x237c('0xd')]()==_0x237c('0xe')){_0x48ef4e['emit'](_0x237c('0xe'));return;}if(_0x9ba44c['substring'](0x0,0xb)=='520-Invalid'){_0x2d0b65=!![];}if(_0x2d0b65){_0x5bfcbb['rx']+=_0x9ba44c+'\x0a';if(_0x9ba44c['search'](_0x237c('0xf'))!=-0x1){_0x2d0b65=![];}}else{_0x5bfcbb['rx']=_0x9ba44c;}if(_0x2d0b65){return;}if(typeof _0x5bfcbb['cb']=='function'){var _0x157607=_0x5bfcbb['rx']['substring'](0x0,0x3),_0x2702c7=null,_0x29268f=null;_0x157607=parseInt(_0x157607);if(isNaN(_0x157607)){_0x5bfcbb['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x237c('0x10')});return;}if(_0x157607!=0xc8){_0x5bfcbb['cb'](null,{'code':_0x157607,'result':-0x1,'extra':'KO'});return;}_0x2702c7=_0x5bfcbb['rx'][_0x237c('0x11')](0x4)[_0x237c('0x12')](_0x237c('0x13'),'');if(_0x2702c7[_0x237c('0x14')]('\x20')!=-0x1){_0x2702c7=_0x2702c7[_0x237c('0x15')](0x0,_0x2702c7['indexOf']('\x20'));}if(_[_0x237c('0x16')](_0x2702c7,'-1')){_0x2702c7=parseInt(_0x2702c7);}_0x29268f=_0x5bfcbb['rx'][_0x237c('0x17')]('\x20');if(_0x29268f[_0x237c('0x18')]==0x3){_0x29268f=_0x29268f[0x2]['substring'](0x1,_0x29268f[0x2]['length']-0x1);}else if(_0x29268f['length']>0x3){var _0x46aa6c=/\((.+)\)/;var _0x145916=_0x5bfcbb['rx'][_0x237c('0x19')](_0x46aa6c);if(_0x145916){_0x29268f=_0x145916[0x1];}else{_0x29268f=null;}}else{_0x29268f=null;}_0x5bfcbb['cb'](null,{'code':_0x157607,'result':_0x2702c7,'extra':_0x29268f});}});_0x74194d['on'](_0x237c('0x1a'),function(_0x4c40d0){_0x48ef4e[_0x237c('0xa')](_0x237c('0x1a'),new AGIError(_0x237c('0x1b'),_0x4c40d0['code']));});_0x74194d['on'](_0x237c('0x1c'),function(){_0x48ef4e[_0x237c('0xa')](_0x237c('0x1c'),new AGIError(_0x237c('0x1d')));});_0x74194d['on'](_0x237c('0x1e'),function(){_0x48ef4e[_0x237c('0xa')]('timeout',new AGIError(_0x237c('0x1f')));_0x74194d[_0x237c('0x20')]();});_0x74194d[_0x237c('0x21')](_0x291377);this[_0x237c('0x22')]=function(_0x2090d6,_0x3478c7){var _0x2090d6=_0x2090d6||'',_0x3478c7=typeof _0x3478c7==_0x237c('0x23')?_0x3478c7:new Function();_0x5bfcbb={'tx':_0x2090d6,'rx':'','cb':_0x3478c7};_0x74194d[_0x237c('0x24')](_0x2090d6+'\x0a');},this[_0x237c('0x1c')]=function(){_0x74194d[_0x237c('0x20')]();};}util[_0x237c('0x25')](AGIChannel,EventEmitter);AGIChannel[_0x237c('0x26')][_0x237c('0x27')]=function(_0x46fd43){return this[_0x237c('0x22')][_0x237c('0x28')](this,_0x46fd43);};AGIChannel[_0x237c('0x26')]['answer']=function(){return this[_0x237c('0x27')](_0x237c('0x29'));};AGIChannel[_0x237c('0x26')]['getData']=function(_0x420f20,_0x3d8ea3,_0x2fdf99){_0x420f20=_0x420f20===undefined?_0x237c('0x2a'):_0x420f20;_0x3d8ea3=_0x3d8ea3===undefined?'5':_0x3d8ea3;_0x2fdf99=_0x2fdf99===undefined?'1':_0x2fdf99;return this[_0x237c('0x27')](util[_0x237c('0x2b')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x420f20,_0x3d8ea3*0x3e8,_0x2fdf99));};AGIChannel[_0x237c('0x26')][_0x237c('0x2c')]=function(_0x49edaf){_0x49edaf=_0x49edaf||_0x237c('0x2d');return this[_0x237c('0x27')](util[_0x237c('0x2b')](_0x237c('0x2e'),_0x49edaf));};AGIChannel['prototype'][_0x237c('0x2f')]=function(_0x1eb684,_0xbabec){if(_['isArray'](_0xbabec)){return this[_0x237c('0x27')](util[_0x237c('0x2b')](_0x237c('0x30'),_0x1eb684,_0xbabec[_0x237c('0x31')](',')));}return this[_0x237c('0x27')](util[_0x237c('0x2b')](_0x237c('0x30'),_0x1eb684,_0xbabec));};AGIChannel[_0x237c('0x26')][_0x237c('0x32')]=function(_0x29517e){return this[_0x237c('0x27')](util[_0x237c('0x2b')](_0x237c('0x33'),_0x29517e));};AGIChannel[_0x237c('0x26')][_0x237c('0x34')]=function(_0x401718){return this['sendRequest'](util[_0x237c('0x2b')](_0x237c('0x35'),_0x401718));};AGIChannel[_0x237c('0x26')][_0x237c('0x36')]=function(_0x1f7821){return this['sendRequest'](util[_0x237c('0x2b')]('SET\x20PRIORITY\x20%s',_0x1f7821));};AGIChannel[_0x237c('0x26')][_0x237c('0xe')]=function(){return this[_0x237c('0x27')](_0x237c('0x37'));};AGIChannel['prototype'][_0x237c('0x38')]=function(_0xc3b9d8,_0x51287b){var _0x1c018f=_[_0x237c('0x39')](_0x51287b)||_[_0x237c('0x3a')](_0x51287b)?_0x51287b[_0x237c('0x3b')]():_0x51287b;return this[_0x237c('0x27')](util[_0x237c('0x2b')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0xc3b9d8,_0x1c018f?_0x1c018f[_0x237c('0x3b')]()[_0x237c('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x237c('0x26')][_0x237c('0x3c')]=function(_0x5597db,_0x1b135d){return this[_0x237c('0x27')](util[_0x237c('0x2b')](_0x237c('0x3d'),_0x5597db,_0x1b135d));};AGIChannel[_0x237c('0x26')][_0x237c('0x3e')]=function(_0x1eee1d,_0x2f1c69){return this['sendRequest'](util[_0x237c('0x2b')](_0x237c('0x3f'),_0x1eee1d,_0x2f1c69));};AGIChannel[_0x237c('0x26')][_0x237c('0x40')]=function(_0x2f1420,_0x56c123){return this[_0x237c('0x27')](util['format'](_0x237c('0x41'),_0x2f1420,_0x56c123));};AGIChannel[_0x237c('0x26')]['continueAt']=function(_0x4d0d87,_0x46725f,_0x3bfd8a){_0x46725f=_0x46725f||this['extension'];_0x3bfd8a=_0x3bfd8a||0x1;this[_0x237c('0x32')](_0x4d0d87);this['setExtension'](_0x46725f);this[_0x237c('0x36')](_0x3bfd8a);return this[_0x237c('0x2c')](util['format']('GOTO\x20%s\x20%s\x20%s',_0x4d0d87,_0x46725f,_0x3bfd8a));};AGIChannel[_0x237c('0x26')][_0x237c('0x42')]=function(_0x2cbc31){return this[_0x237c('0x27')](util[_0x237c('0x2b')](_0x237c('0x43'),_0x2cbc31));};AGIChannel[_0x237c('0x26')]['recordFile']=function(_0x1c2239,_0x4c63fa,_0x5adb9b,_0x35a05e,_0x1a7a4a,_0x15005c){_0x4c63fa=_0x4c63fa||'wav';_0x5adb9b=_0x5adb9b||'';_0x35a05e=_0x35a05e===undefined?-0x1:_0x35a05e==='-1'?-0x1:_0x35a05e*0x3e8;_0x1a7a4a=_0x1a7a4a===undefined?'':'s='+_0x1a7a4a;_0x15005c=_0x15005c?_0x237c('0x44'):'';return this[_0x237c('0x27')](util['format']('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1c2239,_0x4c63fa,_0x5adb9b,_0x35a05e,_0x15005c,_0x1a7a4a));};AGIChannel[_0x237c('0x26')][_0x237c('0x45')]=function(_0x19af94,_0x1b88a0){_0x1b88a0=_0x1b88a0||'';return this['sendRequest'](util[_0x237c('0x2b')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x19af94,_0x1b88a0));};AGIChannel[_0x237c('0x26')][_0x237c('0x46')]=function(_0x51a273){return this['exec'](_0x237c('0x47'),_0x51a273);};AGIChannel[_0x237c('0x26')]['wait']=function(_0x536d5b){return this['exec']('WAIT',_0x536d5b);};AGIChannel[_0x237c('0x26')][_0x237c('0x1a')]=function(_0x57c469,_0x5e2dd6){this[_0x237c('0x2c')](util[_0x237c('0x2b')](_0x237c('0x48'),_0x57c469['id'],_0x57c469[_0x237c('0x49')],_0x5e2dd6));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 755c6ac..91298a4 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 _0xc5b2=['Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.'];(function(_0x23eb8c,_0x5618e8){var _0x4978ba=function(_0x1512ed){while(--_0x1512ed){_0x23eb8c['push'](_0x23eb8c['shift']());}};_0x4978ba(++_0x5618e8);}(_0xc5b2,0x13c));var _0x2c5b=function(_0x4920c6,_0x42441b){_0x4920c6=_0x4920c6-0x0;var _0x312967=_0xc5b2[_0x4920c6];return _0x312967;};'use strict';var util=require(_0x2c5b('0x0'));var error={'E_AGI_UNDEFINED':_0x2c5b('0x1'),'E_AGI_ARGUMENT_PORT':_0x2c5b('0x2'),'E_AGI_SERVER_ERROR':_0x2c5b('0x3'),'E_AGI_SERVER_CLOSE':_0x2c5b('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x2c5b('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x2c5b('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x2c5b('0x7'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x2c5b('0x8')};function AGIError(_0x575540){var _0x575540=_0x575540||null,_0xa3378d=_0xa3378d||[],_0x38087d=0x1,_0x46502c='';if(!error[_0x575540]){_0x575540=_0x2c5b('0x9');}_0xa3378d[_0x2c5b('0xa')](error[_0x575540]);while(arguments[_0x38087d]){_0xa3378d[_0x2c5b('0xa')](arguments[_0x38087d]);_0x38087d++;}_0x46502c=util[_0x2c5b('0xb')]['apply'](util,_0xa3378d);this['message']=_0x46502c;this[_0x2c5b('0xc')]=_0x575540;}module[_0x2c5b('0xd')]=AGIError; \ No newline at end of file +var _0x6761=['push','format','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x430290,_0x5901b0){var _0x48d17a=function(_0x4fbdf5){while(--_0x4fbdf5){_0x430290['push'](_0x430290['shift']());}};_0x48d17a(++_0x5901b0);}(_0x6761,0x84));var _0x1676=function(_0x4f1c6c,_0x4e026a){_0x4f1c6c=_0x4f1c6c-0x0;var _0x224fed=_0x6761[_0x4f1c6c];return _0x224fed;};'use strict';var util=require(_0x1676('0x0'));var error={'E_AGI_UNDEFINED':_0x1676('0x1'),'E_AGI_ARGUMENT_PORT':_0x1676('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x1676('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x1676('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x1676('0x5'),'E_AGI_SOCKET_ERROR':_0x1676('0x6'),'E_AGI_SOCKET_CLOSE':_0x1676('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x1676('0x8'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1676('0x9'),'E_AGI_IVR_ENTRY':_0x1676('0xa')};function AGIError(_0x60427e){var _0x60427e=_0x60427e||null,_0x884068=_0x884068||[],_0x502267=0x1,_0x224203='';if(!error[_0x60427e]){_0x60427e=_0x1676('0xb');}_0x884068['push'](error[_0x60427e]);while(arguments[_0x502267]){_0x884068[_0x1676('0xc')](arguments[_0x502267]);_0x502267++;}_0x224203=util[_0x1676('0xd')][_0x1676('0xe')](util,_0x884068);this[_0x1676('0xf')]=_0x224203;this[_0x1676('0x10')]=_0x60427e;}module[_0x1676('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 33972dc..003884c 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 _0xc8a7=['push','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','vswitch','target','agicommand','default\x20on\x20switch\x20not\x20found','condition\x20not\x20found','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','prototype','addVertex'];(function(_0x1e91eb,_0x5829a3){var _0x2af75a=function(_0x1815d1){while(--_0x1815d1){_0x1e91eb['push'](_0x1e91eb['shift']());}};_0x2af75a(++_0x5829a3);}(_0xc8a7,0x81));var _0x7c8a=function(_0x3cf746,_0x45255e){_0x3cf746=_0x3cf746-0x0;var _0x3baac8=_0xc8a7[_0x3cf746];return _0x3baac8;};'use strict';var _=require(_0x7c8a('0x0'));var logger=require(_0x7c8a('0x1'))(_0x7c8a('0x2'));var verticesWithRetry=[_0x7c8a('0x3'),_0x7c8a('0x4'),_0x7c8a('0x5')];var Graph=function(){this[_0x7c8a('0x6')]={};this[_0x7c8a('0x7')]={};this[_0x7c8a('0x8')]=0x0;};Graph[_0x7c8a('0x9')][_0x7c8a('0xa')]=function(_0x147535){this[_0x7c8a('0x6')][_0x147535['id']]=_0x147535;this[_0x7c8a('0x7')][_0x147535['id']]=[];};Graph[_0x7c8a('0x9')]['addEdge']=function(_0x34f05e,_0x1e16f7,_0x966ab6){this[_0x7c8a('0x7')][_0x34f05e][_0x7c8a('0xb')]({'target':_0x1e16f7,'condition':_0x966ab6});this[_0x7c8a('0x8')]+=0x1;};Graph[_0x7c8a('0x9')][_0x7c8a('0xc')]=function(){return _[_0x7c8a('0xc')](this[_0x7c8a('0x6')]);};Graph[_0x7c8a('0x9')][_0x7c8a('0xd')]=function(){return this['numberOfEdges'];};Graph['prototype'][_0x7c8a('0xe')]=function(_0x2b32d0){return this[_0x7c8a('0x6')][_0x2b32d0];};Graph[_0x7c8a('0x9')][_0x7c8a('0xf')]=function(_0x5d74fb,_0x28b8dc){if(!this[_0x7c8a('0x6')][_0x5d74fb]){return logger[_0x7c8a('0x10')](_0x7c8a('0x11'));}var _0x3ab05b=_0x28b8dc(this[_0x7c8a('0x6')][_0x5d74fb]);if(!_0x3ab05b){return logger[_0x7c8a('0x10')](_0x7c8a('0x12'));}if(this[_0x7c8a('0x7')][_0x5d74fb][_0x7c8a('0x13')]===0x0){return logger[_0x7c8a('0x10')](_0x7c8a('0x14'));}for(var _0x4c97d0=0x0,_0x10ed10=[],_0x3030aa=![];_0x4c97d0\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','production','stringify','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','start','clear','vertex','context','extension','priority','response','code','result','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','traverseBFS','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','util','moment','../../config/environment','../../config/logger','agi','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','[%s]\x20%s','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','arg_1','evtHangup','toJson'];(function(_0x49eab5,_0x105c37){var _0xd22e7b=function(_0x85b965){while(--_0x85b965){_0x49eab5['push'](_0x49eab5['shift']());}};_0xd22e7b(++_0x105c37);}(_0x536f,0xe6));var _0xf536=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x536f[_0x20a584];return _0x4b41a8;};'use strict';var parser=require('xml2json');var _=require(_0xf536('0x0'));var syncho=require('syncho');var util=require(_0xf536('0x1'));var moment=require(_0xf536('0x2'));var config=require(_0xf536('0x3'));var logger=require(_0xf536('0x4'))(_0xf536('0x5'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0xf536('0x6'));var Vertices=require(_0xf536('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xf536('0x5')]=_[_0xf536('0x8')](config['agi'],{'ip':_0xf536('0x9'),'port':0x11dd});function connectionHandler(_0x4bff25){process[_0xf536('0xa')](function(){syncho(function(){try{setChannelVariables(_0x4bff25);agiHandler(_0x4bff25);}catch(_0xe44b72){logger[_0xf536('0xb')](_0xe44b72[_0xf536('0xc')]);}});});}function listeningHandler(){console[_0xf536('0xd')](_0xf536('0xe'),config['agi'][_0xf536('0xf')]);logger[_0xf536('0x10')](util[_0xf536('0x11')](_0xf536('0x12'),config[_0xf536('0x5')]['ip'],config[_0xf536('0x5')]['port']));}function errorHandler(_0x538c6d){if(_0x538c6d&&_0x538c6d['name']&&_0x538c6d['message']){logger['error'](util[_0xf536('0x11')](_0xf536('0x13'),_0x538c6d[_0xf536('0x14')],_0x538c6d[_0xf536('0x15')]));}else{logger[_0xf536('0xb')](util['format'](_0xf536('0x16'),_0x538c6d[_0xf536('0xc')]));}}function closeHandler(){logger[_0xf536('0x10')](util[_0xf536('0x11')](_0xf536('0x17'),this['arg_1'],this[_0xf536('0x18')],this[_0xf536('0x19')],this[_0xf536('0x1a')],this[_0xf536('0x1b')]));try{createSquareReport(this);}catch(_0x494a74){logger[_0xf536('0xb')](_0x494a74['stack']);}}function timeoutHandler(){logger[_0xf536('0x10')](util[_0xf536('0x11')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xf536('0x1c')],this['calleridname'],this['callerid'],this[_0xf536('0x1a')],this['uniqueid']));}function hangupHandler(){logger[_0xf536('0x10')](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xf536('0x1c')],this[_0xf536('0x18')],this[_0xf536('0x19')],this[_0xf536('0x1a')],this[_0xf536('0x1b')]));this[_0xf536('0x1d')]=!![];}function getRoot(_0x22ee82){return parser[_0xf536('0x1e')](_0x22ee82,{'object':!![]})[_0xf536('0x1f')][_0xf536('0x20')];}function addVertex(_0x53d635,_0x3b6228,_0x124d4f){_0x3b6228[_0xf536('0x21')]=_0x124d4f;if(_0x3b6228['hasOwnProperty'](_0xf536('0x22'))){_0x3b6228[_0xf536('0x23')]=parseInt(_0x3b6228[_0xf536('0x22')],0xa);}_0x53d635['addVertex'](_[_0xf536('0x24')](_0x3b6228,_0xf536('0x25')));}function initGraph(_0x323d41,_0x35b52a){var _0x198050=new Graph();for(var _0x2d3d3b in _0x323d41){if(_0x323d41[_0xf536('0x26')](_0x2d3d3b)){if(_[_0xf536('0x27')](_0x323d41[_0x2d3d3b])){for(var _0x24f835=0x0;_0x24f835<_0x323d41[_0x2d3d3b][_0xf536('0x28')];_0x24f835+=0x1){addVertex(_0x198050,_0x323d41[_0x2d3d3b][_0x24f835],_0x2d3d3b);}}else{addVertex(_0x198050,_0x323d41[_0x2d3d3b],_0x2d3d3b);}}}for(var _0x4e3fbe=0x0;_0x4e3fbe<_0x35b52a['length'];_0x4e3fbe+=0x1){if(_0x35b52a[_0x4e3fbe][_0xf536('0x29')]&&_0x35b52a[_0x4e3fbe][_0xf536('0x2a')]){_0x198050[_0xf536('0x2b')](_0x35b52a[_0x4e3fbe][_0xf536('0x29')],_0x35b52a[_0x4e3fbe][_0xf536('0x2a')],_0x35b52a[_0x4e3fbe]['value']);}}return _0x198050;}function getSquareProject(_0x1fa814,_0x4e4577){rpc[_0xf536('0x2c')](_0x1fa814)[_0xf536('0x2d')](function(_0x459154){_0x4e4577(null,_0x459154);})[_0xf536('0x2e')](function(_0x557359){_0x4e4577(null,_0x557359);});}function createSquareReport(_0x4b4e7a,_0x4c63bb){rpc[_0xf536('0x2f')](_0x4b4e7a)[_0xf536('0x2d')](function(_0x5d7269){if(_0x4c63bb){_0x4c63bb(null,_0x5d7269);}})[_0xf536('0x2e')](function(_0x100bd7){if(_0x4c63bb){_0x4c63bb(null,_0x100bd7);}});}function setChannelVariables(_0xf812f6){for(var _0x22a584 in _0xf812f6){if(_0xf812f6[_0xf536('0x26')](_0x22a584)){if(_0x22a584[_0xf536('0x30')]('agi_')===0x0){_0xf812f6[_0x22a584['substring'](0x4)]=_0xf812f6[_0x22a584];delete _0xf812f6[_0x22a584];}}}}function getLogFromObject(_0x475abc){return util[_0xf536('0x31')](_0x475abc,{'showHidden':![],'depth':null});}function agiHandler(_0x35c141){var _0x19af6e,_0x309b37,_0x397244,_0x418911,_0x15ed7e;logger[_0xf536('0x32')]('variables',JSON['stringify'](_0x35c141,null,0x2));logger[_0xf536('0x10')](util[_0xf536('0x11')](_0xf536('0x33'),_0x35c141[_0xf536('0x1c')],_0x35c141[_0xf536('0x18')],_0x35c141[_0xf536('0x19')],_0x35c141[_0xf536('0x1a')],_0x35c141[_0xf536('0x1b')]));_0x35c141['on'](_0xf536('0xb'),errorHandler);_0x35c141['on']('close',closeHandler);_0x35c141['on'](_0xf536('0x34'),timeoutHandler);_0x35c141[_0xf536('0x1d')]=![];_0x35c141['on']('hangup',hangupHandler);var _0x36da05=getSquareProject['sync'](null,_0x35c141['arg_1']);if(_0x36da05){if(_0x36da05[_0xf536('0x35')]){_0x19af6e=getRoot(_0x36da05['production']);if(_0x19af6e&&_0x19af6e['start']){logger['debug'](_0xf536('0x20'),JSON[_0xf536('0x36')](_0x19af6e,null,0x2));_0x35c141[_0xf536('0x37')]=moment()[_0xf536('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x309b37=initGraph(_[_0xf536('0x24')](_0x19af6e,_0xf536('0x25')),_0x19af6e['mxCell']);_0x397244=new Vertices(_0x35c141,rpc,mailRpc);logger[_0xf536('0x10')](util['format'](_0xf536('0x38'),_0x35c141[_0xf536('0x1c')],_0x35c141[_0xf536('0x18')],_0x35c141[_0xf536('0x19')],_0x35c141['dnid'],_0x35c141[_0xf536('0x1b')]));_0x309b37['traverseBFS'](_0x19af6e[_0xf536('0x39')]['id'],function(_0xc037b4){try{_0xc037b4=_0x397244[_0xf536('0x3a')](_0xc037b4);logger['debug'](_0xf536('0x3b'),JSON[_0xf536('0x36')](_0xc037b4,null,0x2));if(_0xc037b4[_0xf536('0x21')]==='gotoc'){logger[_0xf536('0x10')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x35c141['context']=_0xc037b4[_0xf536('0x3c')]||_0x35c141[_0xf536('0x3c')];_0x35c141[_0xf536('0x3d')]=_0xc037b4[_0xf536('0x3d')];_0x35c141['priority']=_0xc037b4[_0xf536('0x3e')]?_0xc037b4['priority']-0x1:0x1;return null;}else if(_0xc037b4&&_0x397244[_0xc037b4['agicommand']]){_0x15ed7e=_0x397244[_0xc037b4[_0xf536('0x21')]](_0xc037b4);logger[_0xf536('0x10')](_0xf536('0x3f'),JSON[_0xf536('0x36')](_0x15ed7e,null,0x2));if(_0x15ed7e&&_0x15ed7e[_0xf536('0x40')]===AGI_CODE_SUCCESS&&_0x15ed7e[_0xf536('0x41')]!==AGI_RESULT_ERROR&&!_0x35c141[_0xf536('0x1d')]){logger['debug']('response',getLogFromObject(_0x15ed7e));return _[_0xf536('0x42')](_0x15ed7e[_0xf536('0x41')])?null:_0x15ed7e[_0xf536('0x41')][_0xf536('0x43')]();}else{logger[_0xf536('0xb')](_0xf536('0x3f'),getLogFromObject(_0x15ed7e));return null;}}else{logger[_0xf536('0xb')](_0xf536('0x44'));return null;}}catch(_0x2f9bf4){logger['error'](_0x2f9bf4[_0xf536('0xc')]);return null;}});if(_0x19af6e[_0xf536('0x45')]){logger[_0xf536('0x10')](util[_0xf536('0x11')](_0xf536('0x46'),_0x35c141[_0xf536('0x1c')],_0x35c141[_0xf536('0x18')],_0x35c141['callerid'],_0x35c141[_0xf536('0x1a')],_0x35c141[_0xf536('0x1b')]));_0x309b37[_0xf536('0x47')](_0x19af6e['finally']['id'],function(_0x456ea3){try{_0x456ea3=_0x397244[_0xf536('0x3a')](_0x456ea3);logger['debug']('vertex',JSON[_0xf536('0x36')](_0x456ea3,null,0x2));if(_0x456ea3&&_0x397244[_0x456ea3['agicommand']]){_0x15ed7e=_0x397244[_0x456ea3[_0xf536('0x21')]](_0x456ea3);if(_0x15ed7e){logger[_0xf536('0x32')]('response',getLogFromObject(_0x15ed7e));return _[_0xf536('0x42')](_0x15ed7e[_0xf536('0x41')])?null:_0x15ed7e['result'][_0xf536('0x43')]();}else{logger[_0xf536('0xb')](_0xf536('0x3f'),getLogFromObject(_0x15ed7e));return null;}}else{logger['error'](_0xf536('0x44'));return null;}}catch(_0xddf68){logger[_0xf536('0xb')](_0xddf68[_0xf536('0xc')]);return null;}});}logger['info'](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x35c141[_0xf536('0x1c')],_0x35c141[_0xf536('0x18')],_0x35c141[_0xf536('0x19')],_0x35c141[_0xf536('0x1a')],_0x35c141[_0xf536('0x1b')]));logger[_0xf536('0x10')](util[_0xf536('0x11')](_0xf536('0x48'),_0x35c141['context'],_0x35c141[_0xf536('0x3d')],parseInt(_0x35c141[_0xf536('0x3e')],0xa)+0x1));_0x35c141[_0xf536('0x49')](_0x35c141[_0xf536('0x3c')],_0x35c141[_0xf536('0x3d')],parseInt(_0x35c141[_0xf536('0x3e')],0xa)+0x1);_0x35c141[_0xf536('0x4a')]();}}else{logger[_0xf536('0xb')](util[_0xf536('0x11')](_0xf536('0x4b'),_0x35c141['arg_1']));_0x35c141[_0xf536('0x49')](_0x35c141[_0xf536('0x3c')],_0x35c141[_0xf536('0x3d')],parseInt(_0x35c141[_0xf536('0x3e')],0xa)+0x1);_0x35c141['close']();}}else{logger[_0xf536('0xb')](util[_0xf536('0x11')](_0xf536('0x4c'),_0x35c141[_0xf536('0x1c')]));_0x35c141['continueAt'](_0x35c141[_0xf536('0x3c')],_0x35c141[_0xf536('0x3d')],parseInt(_0x35c141[_0xf536('0x3e')],0xa)+0x1);_0x35c141['close']();}}function main(){var _0xb2fb14;return utilLicense[_0xf536('0x4d')]()[_0xf536('0x2d')](function(_0x5112d9){if(_0x5112d9){if(_0x5112d9[_0xf536('0x4e')]){if(_0x5112d9['callysquare']&&_0x5112d9[_0xf536('0x4f')]>0x0){logger[_0xf536('0x10')](util[_0xf536('0x11')](_0xf536('0x50'),_0x5112d9[_0xf536('0x4f')]));_0xb2fb14=_0x5112d9['callysquare'];}else{logger[_0xf536('0x10')](_0xf536('0x51'));}}else{logger['info'](_0xf536('0x52'));_0xb2fb14=-0x1;}}})[_0xf536('0x2e')](function(_0x54e413){logger[_0xf536('0xb')](_0xf536('0x53'),_0x54e413[_0xf536('0xc')]);})[_0xf536('0x45')](function(){var _0x1bca34=require(_0xf536('0x54'))(config['agi'][_0xf536('0xf')],config['agi']['ip'],_0xb2fb14);_0x1bca34['on'](_0xf536('0xb'),errorHandler);_0x1bca34['on'](_0xf536('0x55'),listeningHandler);_0x1bca34['on'](_0xf536('0x56'),connectionHandler);_0x1bca34['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x3c91=['length','source','addEdge','target','value','catch','createSquareReport','then','indexOf','substring','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','hangup','sync','production','start','stringify','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','agicommand','context','extension','priority','response','code','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','connection','xml2json','lodash','syncho','util','moment','../../config/logger','agi','./rpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty'];(function(_0x31a6d4,_0x1e4034){var _0x2ddfcf=function(_0x55c8d7){while(--_0x55c8d7){_0x31a6d4['push'](_0x31a6d4['shift']());}};_0x2ddfcf(++_0x1e4034);}(_0x3c91,0xe6));var _0x13c9=function(_0xc2c1c6,_0x40e6ca){_0xc2c1c6=_0xc2c1c6-0x0;var _0xef8905=_0x3c91[_0xc2c1c6];return _0xef8905;};'use strict';var parser=require(_0x13c9('0x0'));var _=require(_0x13c9('0x1'));var syncho=require(_0x13c9('0x2'));var util=require(_0x13c9('0x3'));var moment=require(_0x13c9('0x4'));var config=require('../../config/environment');var logger=require(_0x13c9('0x5'))(_0x13c9('0x6'));var utilLicense=require('../../config/license/util');var rpc=require(_0x13c9('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0x13c9('0x8'));var Vertices=require(_0x13c9('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x13c9('0x6')]=_[_0x13c9('0xa')](config[_0x13c9('0x6')],{'ip':_0x13c9('0xb'),'port':0x11dd});function connectionHandler(_0x537e16){process[_0x13c9('0xc')](function(){syncho(function(){try{setChannelVariables(_0x537e16);agiHandler(_0x537e16);}catch(_0x4379c2){logger[_0x13c9('0xd')](_0x4379c2[_0x13c9('0xe')]);}});});}function listeningHandler(){console[_0x13c9('0xf')](_0x13c9('0x10'),config[_0x13c9('0x6')][_0x13c9('0x11')]);logger[_0x13c9('0x12')](util[_0x13c9('0x13')](_0x13c9('0x14'),config[_0x13c9('0x6')]['ip'],config[_0x13c9('0x6')][_0x13c9('0x11')]));}function errorHandler(_0x16c847){if(_0x16c847&&_0x16c847[_0x13c9('0x15')]&&_0x16c847[_0x13c9('0x16')]){logger['error'](util[_0x13c9('0x13')](_0x13c9('0x17'),_0x16c847['name'],_0x16c847[_0x13c9('0x16')]));}else{logger[_0x13c9('0xd')](util[_0x13c9('0x13')](_0x13c9('0x18'),_0x16c847[_0x13c9('0xe')]));}}function closeHandler(){logger[_0x13c9('0x12')](util[_0x13c9('0x13')](_0x13c9('0x19'),this[_0x13c9('0x1a')],this[_0x13c9('0x1b')],this[_0x13c9('0x1c')],this[_0x13c9('0x1d')],this[_0x13c9('0x1e')]));try{createSquareReport(this);}catch(_0x2dab38){logger[_0x13c9('0xd')](_0x2dab38[_0x13c9('0xe')]);}}function timeoutHandler(){logger[_0x13c9('0x12')](util[_0x13c9('0x13')](_0x13c9('0x1f'),this[_0x13c9('0x1a')],this[_0x13c9('0x1b')],this[_0x13c9('0x1c')],this[_0x13c9('0x1d')],this[_0x13c9('0x1e')]));}function hangupHandler(){logger[_0x13c9('0x12')](util[_0x13c9('0x13')](_0x13c9('0x20'),this[_0x13c9('0x1a')],this[_0x13c9('0x1b')],this[_0x13c9('0x1c')],this[_0x13c9('0x1d')],this[_0x13c9('0x1e')]));this[_0x13c9('0x21')]=!![];}function getRoot(_0x2511ff){return parser[_0x13c9('0x22')](_0x2511ff,{'object':!![]})[_0x13c9('0x23')][_0x13c9('0x24')];}function addVertex(_0x5826f9,_0x5b7077,_0x2d6b53){_0x5b7077['agicommand']=_0x2d6b53;if(_0x5b7077['hasOwnProperty'](_0x13c9('0x25'))){_0x5b7077[_0x13c9('0x26')]=parseInt(_0x5b7077['retry'],0xa);}_0x5826f9[_0x13c9('0x27')](_[_0x13c9('0x28')](_0x5b7077,_0x13c9('0x29')));}function initGraph(_0x20ec8d,_0x335a23){var _0x23a184=new Graph();for(var _0x5a3924 in _0x20ec8d){if(_0x20ec8d[_0x13c9('0x2a')](_0x5a3924)){if(_['isArray'](_0x20ec8d[_0x5a3924])){for(var _0x2da6d3=0x0;_0x2da6d3<_0x20ec8d[_0x5a3924][_0x13c9('0x2b')];_0x2da6d3+=0x1){addVertex(_0x23a184,_0x20ec8d[_0x5a3924][_0x2da6d3],_0x5a3924);}}else{addVertex(_0x23a184,_0x20ec8d[_0x5a3924],_0x5a3924);}}}for(var _0x47fed8=0x0;_0x47fed8<_0x335a23[_0x13c9('0x2b')];_0x47fed8+=0x1){if(_0x335a23[_0x47fed8][_0x13c9('0x2c')]&&_0x335a23[_0x47fed8]['target']){_0x23a184[_0x13c9('0x2d')](_0x335a23[_0x47fed8]['source'],_0x335a23[_0x47fed8][_0x13c9('0x2e')],_0x335a23[_0x47fed8][_0x13c9('0x2f')]);}}return _0x23a184;}function getSquareProject(_0x43e371,_0x2e68f1){rpc['getSquareProject'](_0x43e371)['then'](function(_0x2c9bd0){_0x2e68f1(null,_0x2c9bd0);})[_0x13c9('0x30')](function(_0x298cfe){_0x2e68f1(null,_0x298cfe);});}function createSquareReport(_0x5b09cd,_0x3027cd){rpc[_0x13c9('0x31')](_0x5b09cd)[_0x13c9('0x32')](function(_0x1cb3f4){if(_0x3027cd){_0x3027cd(null,_0x1cb3f4);}})[_0x13c9('0x30')](function(_0x3e3953){if(_0x3027cd){_0x3027cd(null,_0x3e3953);}});}function setChannelVariables(_0x406b8f){for(var _0x44b313 in _0x406b8f){if(_0x406b8f[_0x13c9('0x2a')](_0x44b313)){if(_0x44b313[_0x13c9('0x33')]('agi_')===0x0){_0x406b8f[_0x44b313[_0x13c9('0x34')](0x4)]=_0x406b8f[_0x44b313];delete _0x406b8f[_0x44b313];}}}}function getLogFromObject(_0x392e4e){return util['inspect'](_0x392e4e,{'showHidden':![],'depth':null});}function agiHandler(_0x35139c){var _0xee72a2,_0x4f8456,_0x1d9d88,_0x435f53,_0x1c8121;logger[_0x13c9('0x35')]('variables',JSON['stringify'](_0x35139c,null,0x2));logger['info'](util['format'](_0x13c9('0x36'),_0x35139c[_0x13c9('0x1a')],_0x35139c[_0x13c9('0x1b')],_0x35139c[_0x13c9('0x1c')],_0x35139c[_0x13c9('0x1d')],_0x35139c[_0x13c9('0x1e')]));_0x35139c['on'](_0x13c9('0xd'),errorHandler);_0x35139c['on'](_0x13c9('0x37'),closeHandler);_0x35139c['on']('timeout',timeoutHandler);_0x35139c['evtHangup']=![];_0x35139c['on'](_0x13c9('0x38'),hangupHandler);var _0x2d830a=getSquareProject[_0x13c9('0x39')](null,_0x35139c['arg_1']);if(_0x2d830a){if(_0x2d830a[_0x13c9('0x3a')]){_0xee72a2=getRoot(_0x2d830a['production']);if(_0xee72a2&&_0xee72a2[_0x13c9('0x3b')]){logger[_0x13c9('0x35')](_0x13c9('0x24'),JSON[_0x13c9('0x3c')](_0xee72a2,null,0x2));_0x35139c['joinAt']=moment()[_0x13c9('0x13')](_0x13c9('0x3d'));_0x4f8456=initGraph(_[_0x13c9('0x28')](_0xee72a2,_0x13c9('0x29')),_0xee72a2[_0x13c9('0x29')]);_0x1d9d88=new Vertices(_0x35139c,rpc,mailRpc);logger[_0x13c9('0x12')](util[_0x13c9('0x13')](_0x13c9('0x3e'),_0x35139c[_0x13c9('0x1a')],_0x35139c[_0x13c9('0x1b')],_0x35139c[_0x13c9('0x1c')],_0x35139c[_0x13c9('0x1d')],_0x35139c[_0x13c9('0x1e')]));_0x4f8456[_0x13c9('0x3f')](_0xee72a2[_0x13c9('0x3b')]['id'],function(_0x520d22){try{_0x520d22=_0x1d9d88[_0x13c9('0x40')](_0x520d22);logger[_0x13c9('0x35')](_0x13c9('0x41'),JSON['stringify'](_0x520d22,null,0x2));if(_0x520d22[_0x13c9('0x42')]==='gotoc'){logger[_0x13c9('0x12')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x35139c[_0x13c9('0x43')]=_0x520d22['context']||_0x35139c[_0x13c9('0x43')];_0x35139c[_0x13c9('0x44')]=_0x520d22[_0x13c9('0x44')];_0x35139c[_0x13c9('0x45')]=_0x520d22[_0x13c9('0x45')]?_0x520d22['priority']-0x1:0x1;return null;}else if(_0x520d22&&_0x1d9d88[_0x520d22[_0x13c9('0x42')]]){_0x1c8121=_0x1d9d88[_0x520d22[_0x13c9('0x42')]](_0x520d22);logger[_0x13c9('0x12')](_0x13c9('0x46'),JSON[_0x13c9('0x3c')](_0x1c8121,null,0x2));if(_0x1c8121&&_0x1c8121[_0x13c9('0x47')]===AGI_CODE_SUCCESS&&_0x1c8121[_0x13c9('0x48')]!==AGI_RESULT_ERROR&&!_0x35139c[_0x13c9('0x21')]){logger[_0x13c9('0x35')](_0x13c9('0x46'),getLogFromObject(_0x1c8121));return _['isUndefined'](_0x1c8121[_0x13c9('0x48')])?null:_0x1c8121[_0x13c9('0x48')][_0x13c9('0x49')]();}else{logger[_0x13c9('0xd')](_0x13c9('0x46'),getLogFromObject(_0x1c8121));return null;}}else{logger['error'](_0x13c9('0x4a'));return null;}}catch(_0x104a17){logger['error'](_0x104a17[_0x13c9('0xe')]);return null;}});if(_0xee72a2[_0x13c9('0x4b')]){logger['info'](util[_0x13c9('0x13')](_0x13c9('0x4c'),_0x35139c[_0x13c9('0x1a')],_0x35139c[_0x13c9('0x1b')],_0x35139c['callerid'],_0x35139c['dnid'],_0x35139c[_0x13c9('0x1e')]));_0x4f8456['traverseBFS'](_0xee72a2[_0x13c9('0x4b')]['id'],function(_0x1236ca){try{_0x1236ca=_0x1d9d88[_0x13c9('0x40')](_0x1236ca);logger['debug'](_0x13c9('0x41'),JSON[_0x13c9('0x3c')](_0x1236ca,null,0x2));if(_0x1236ca&&_0x1d9d88[_0x1236ca['agicommand']]){_0x1c8121=_0x1d9d88[_0x1236ca[_0x13c9('0x42')]](_0x1236ca);if(_0x1c8121){logger['debug']('response',getLogFromObject(_0x1c8121));return _[_0x13c9('0x4d')](_0x1c8121[_0x13c9('0x48')])?null:_0x1c8121[_0x13c9('0x48')][_0x13c9('0x49')]();}else{logger[_0x13c9('0xd')]('response',getLogFromObject(_0x1c8121));return null;}}else{logger[_0x13c9('0xd')](_0x13c9('0x4a'));return null;}}catch(_0x411cc2){logger['error'](_0x411cc2[_0x13c9('0xe')]);return null;}});}logger[_0x13c9('0x12')](util[_0x13c9('0x13')](_0x13c9('0x4e'),_0x35139c[_0x13c9('0x1a')],_0x35139c[_0x13c9('0x1b')],_0x35139c[_0x13c9('0x1c')],_0x35139c['dnid'],_0x35139c[_0x13c9('0x1e')]));logger[_0x13c9('0x12')](util[_0x13c9('0x13')](_0x13c9('0x4f'),_0x35139c[_0x13c9('0x43')],_0x35139c[_0x13c9('0x44')],parseInt(_0x35139c['priority'],0xa)+0x1));_0x35139c[_0x13c9('0x50')](_0x35139c[_0x13c9('0x43')],_0x35139c['extension'],parseInt(_0x35139c[_0x13c9('0x45')],0xa)+0x1);_0x35139c['close']();}}else{logger[_0x13c9('0xd')](util['format'](_0x13c9('0x51'),_0x35139c[_0x13c9('0x1a')]));_0x35139c['continueAt'](_0x35139c[_0x13c9('0x43')],_0x35139c[_0x13c9('0x44')],parseInt(_0x35139c[_0x13c9('0x45')],0xa)+0x1);_0x35139c[_0x13c9('0x37')]();}}else{logger[_0x13c9('0xd')](util['format'](_0x13c9('0x52'),_0x35139c[_0x13c9('0x1a')]));_0x35139c['continueAt'](_0x35139c[_0x13c9('0x43')],_0x35139c['extension'],parseInt(_0x35139c[_0x13c9('0x45')],0xa)+0x1);_0x35139c['close']();}}function main(){var _0x55fe48;return utilLicense[_0x13c9('0x53')]()[_0x13c9('0x32')](function(_0x69faf){if(_0x69faf){if(_0x69faf[_0x13c9('0x54')]){if(_0x69faf['callysquare']&&_0x69faf['callysquare']>0x0){logger['info'](util[_0x13c9('0x13')](_0x13c9('0x55'),_0x69faf['callysquare']));_0x55fe48=_0x69faf[_0x13c9('0x56')];}else{logger[_0x13c9('0x12')](_0x13c9('0x57'));}}else{logger['info'](_0x13c9('0x58'));_0x55fe48=-0x1;}}})['catch'](function(_0x1a25a0){logger['error'](_0x13c9('0x59'),_0x1a25a0[_0x13c9('0xe')]);})[_0x13c9('0x4b')](function(){var _0x58f660=require('./server')(config[_0x13c9('0x6')][_0x13c9('0x11')],config[_0x13c9('0x6')]['ip'],_0x55fe48);_0x58f660['on'](_0x13c9('0xd'),errorHandler);_0x58f660['on']('listening',listeningHandler);_0x58f660['on'](_0x13c9('0x5a'),connectionHandler);_0x58f660['on'](_0x13c9('0x37'),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 8266195..a215892 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 _0xfbbf=['jayson/promise','client','http','request','then','error','message','catch','sendMailMessage','bluebird'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xfbbf,0x1a3));var _0xffbb=function(_0x51440c,_0x5a25e2){_0x51440c=_0x51440c-0x0;var _0x5228fe=_0xfbbf[_0x51440c];return _0x5228fe;};'use strict';var BPromise=require(_0xffbb('0x0'));var jayson=require(_0xffbb('0x1'));var client=jayson[_0xffbb('0x2')][_0xffbb('0x3')]({'port':0x232b});function request(_0x21b92f,_0x158533){return new BPromise(function(_0x20e7b0,_0x1aa6bb){return client[_0xffbb('0x4')](_0x21b92f,_0x158533)[_0xffbb('0x5')](function(_0x6ede19){if(_0x6ede19[_0xffbb('0x6')]){return _0x1aa6bb(_0x6ede19[_0xffbb('0x6')][_0xffbb('0x7')]);}else{return _0x20e7b0(_0x6ede19['result']);}})[_0xffbb('0x8')](function(_0x448f93){return _0x1aa6bb(_0x448f93);});});}exports[_0xffbb('0x9')]=function(_0x450494,_0x65e2b5){return request('SendMail',{'account':_0x450494,'message':_0x65e2b5});}; \ No newline at end of file +var _0x3206=['error','result','catch','sendMailMessage','SendMail','jayson/promise','client','http','request','then'];(function(_0x119be1,_0x214849){var _0x3b9571=function(_0x103832){while(--_0x103832){_0x119be1['push'](_0x119be1['shift']());}};_0x3b9571(++_0x214849);}(_0x3206,0x14f));var _0x6320=function(_0x4f1789,_0x37fda7){_0x4f1789=_0x4f1789-0x0;var _0x5bb8fe=_0x3206[_0x4f1789];return _0x5bb8fe;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x6320('0x0'));var client=jayson[_0x6320('0x1')][_0x6320('0x2')]({'port':0x232b});function request(_0x5e8ffa,_0x58fc84){return new BPromise(function(_0xe56ec4,_0x1540ea){return client[_0x6320('0x3')](_0x5e8ffa,_0x58fc84)[_0x6320('0x4')](function(_0x10667f){if(_0x10667f['error']){return _0x1540ea(_0x10667f[_0x6320('0x5')]['message']);}else{return _0xe56ec4(_0x10667f[_0x6320('0x6')]);}})[_0x6320('0x7')](function(_0x358014){return _0x1540ea(_0x358014);});});}exports[_0x6320('0x8')]=function(_0x16bdd8,_0x24036e){return request(_0x6320('0x9'),{'account':_0x16bdd8,'message':_0x24036e});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 067ab7f..cc0dfc5 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 _0xb4aa=['Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','slice','trim','length','headers','substring','emit','exports'];(function(_0x25f517,_0x37246a){var _0x248420=function(_0x17bb36){while(--_0x17bb36){_0x25f517['push'](_0x25f517['shift']());}};_0x248420(++_0x37246a);}(_0xb4aa,0xdd));var _0xab4a=function(_0x4e631d,_0x497b39){_0x4e631d=_0x4e631d-0x0;var _0x533a8a=_0xb4aa[_0x4e631d];return _0x533a8a;};'use strict';var util=require('util');var Transform=require('stream')[_0xab4a('0x0')];function AGIReply(_0x1c1bd8){Transform[_0xab4a('0x1')](this,_0x1c1bd8);this[_0xab4a('0x2')]='';this[_0xab4a('0x3')]=![];}util[_0xab4a('0x4')](AGIReply,Transform);AGIReply[_0xab4a('0x5')][_0xab4a('0x6')]=function(_0x15ff9f,_0x49beac,_0x4d67bb){var _0x3a0292='\x0a',_0x12a79d=['\x0a\x0a',_0xab4a('0x7')],_0x42af7b=-0x1,_0x14e836=-0x1,_0x3b564a='',_0x10cd2e=0x0,_0x22861e='',_0x447556='';this['_localBuffer']+=_0x15ff9f[_0xab4a('0x8')]();_0x22861e=this[_0xab4a('0x2')];if(!this[_0xab4a('0x3')]){_0x10cd2e=0x0;while(_0x12a79d[_0x10cd2e]){while((_0x14e836=_0x22861e[_0xab4a('0x9')](_0x12a79d[_0x10cd2e]))!=-0x1){_0x3b564a=_0x12a79d[_0x10cd2e];_0x447556=_0x22861e['substring'](0x0,_0x14e836);_0x22861e=_0x22861e['substring'](_0x14e836+_0x3b564a['length']);var _0x3dbe95=_0x447556['split'](_0x3a0292),_0x326f70=0x0,_0x52bfa6={},_0xc22c69='',_0x2375ee='',_0x2c1d44=-0x1;while(_0x3dbe95[_0x326f70]){_0x2c1d44=_0x3dbe95[_0x326f70]['indexOf'](':');if(_0x2c1d44!=-0x1){_0xc22c69=_0x3dbe95[_0x326f70][_0xab4a('0xa')](0x0,_0x2c1d44)['trim']();_0x2375ee=_0x3dbe95[_0x326f70][_0xab4a('0xa')](_0x2c1d44+0x1)[_0xab4a('0xb')]();if(_0xc22c69[_0xab4a('0xc')]>0x0){_0x52bfa6[_0xc22c69]=_0x2375ee;}}else{}_0x326f70++;}this['emit'](_0xab4a('0xd'),_0x52bfa6);this[_0xab4a('0x3')]=!![];}_0x10cd2e++;}this['_localBuffer']=_0x22861e;}else{while((_0x42af7b=_0x22861e[_0xab4a('0x9')](_0x3a0292))!=-0x1){_0x447556=_0x22861e[_0xab4a('0xe')](0x0,_0x42af7b);this[_0xab4a('0xf')]('line',_0x447556);_0x22861e=_0x22861e[_0xab4a('0xe')](_0x42af7b+_0x3a0292[_0xab4a('0xc')]);}this[_0xab4a('0x2')]=_0x22861e;}_0x4d67bb();};module[_0xab4a('0x10')]=AGIReply; \ No newline at end of file +var _0xb770=['slice','trim','headers','line','length','exports','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','indexOf','substring'];(function(_0x7ee046,_0x248eb5){var _0x512015=function(_0x523480){while(--_0x523480){_0x7ee046['push'](_0x7ee046['shift']());}};_0x512015(++_0x248eb5);}(_0xb770,0x1e2));var _0x0b77=function(_0x5980e4,_0x44ec9c){_0x5980e4=_0x5980e4-0x0;var _0x429716=_0xb770[_0x5980e4];return _0x429716;};'use strict';var util=require('util');var Transform=require(_0x0b77('0x0'))[_0x0b77('0x1')];function AGIReply(_0x15d5c1){Transform[_0x0b77('0x2')](this,_0x15d5c1);this[_0x0b77('0x3')]='';this[_0x0b77('0x4')]=![];}util[_0x0b77('0x5')](AGIReply,Transform);AGIReply[_0x0b77('0x6')][_0x0b77('0x7')]=function(_0x8076e9,_0x46703e,_0xd3465c){var _0x104ab1='\x0a',_0x55e9b6=['\x0a\x0a',_0x0b77('0x8')],_0x176698=-0x1,_0x5bed15=-0x1,_0x1b802a='',_0x32ff80=0x0,_0x548d06='',_0x39f25e='';this['_localBuffer']+=_0x8076e9['toString']();_0x548d06=this[_0x0b77('0x3')];if(!this[_0x0b77('0x4')]){_0x32ff80=0x0;while(_0x55e9b6[_0x32ff80]){while((_0x5bed15=_0x548d06[_0x0b77('0x9')](_0x55e9b6[_0x32ff80]))!=-0x1){_0x1b802a=_0x55e9b6[_0x32ff80];_0x39f25e=_0x548d06[_0x0b77('0xa')](0x0,_0x5bed15);_0x548d06=_0x548d06['substring'](_0x5bed15+_0x1b802a['length']);var _0x563c56=_0x39f25e['split'](_0x104ab1),_0x4e96bc=0x0,_0x2d2fe2={},_0x420085='',_0x42e088='',_0xfae9a6=-0x1;while(_0x563c56[_0x4e96bc]){_0xfae9a6=_0x563c56[_0x4e96bc][_0x0b77('0x9')](':');if(_0xfae9a6!=-0x1){_0x420085=_0x563c56[_0x4e96bc][_0x0b77('0xb')](0x0,_0xfae9a6)[_0x0b77('0xc')]();_0x42e088=_0x563c56[_0x4e96bc][_0x0b77('0xb')](_0xfae9a6+0x1)['trim']();if(_0x420085['length']>0x0){_0x2d2fe2[_0x420085]=_0x42e088;}}else{}_0x4e96bc++;}this['emit'](_0x0b77('0xd'),_0x2d2fe2);this['_inBody']=!![];}_0x32ff80++;}this[_0x0b77('0x3')]=_0x548d06;}else{while((_0x176698=_0x548d06[_0x0b77('0x9')](_0x104ab1))!=-0x1){_0x39f25e=_0x548d06[_0x0b77('0xa')](0x0,_0x176698);this['emit'](_0x0b77('0xe'),_0x39f25e);_0x548d06=_0x548d06[_0x0b77('0xa')](_0x176698+_0x104ab1[_0x0b77('0xf')]);}this[_0x0b77('0x3')]=_0x548d06;}_0xd3465c();};module[_0x0b77('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index d32fd69..5905b65 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 _0x4c8d=['arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','lodash','jayson/promise','client','http','request','then','error','catch','ShowSquareProject','ShowMailAccount','MailServerOut','getSquareProjectById','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','ShowSound','ShowInterval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1'];(function(_0x548db4,_0x177d93){var _0x409710=function(_0x34c253){while(--_0x34c253){_0x548db4['push'](_0x548db4['shift']());}};_0x409710(++_0x177d93);}(_0x4c8d,0x15d));var _0xd4c8=function(_0x4c4a52,_0x342d9b){_0x4c4a52=_0x4c4a52-0x0;var _0x4ac16e=_0x4c8d[_0x4c4a52];return _0x4ac16e;};'use strict';var BPromise=require(_0xd4c8('0x0'));var moment=require(_0xd4c8('0x1'));var _=require(_0xd4c8('0x2'));var util=require('util');var jayson=require(_0xd4c8('0x3'));var client=jayson[_0xd4c8('0x4')][_0xd4c8('0x5')]({'port':0x2329});function request(_0x1b3429,_0x4d57d7){return new BPromise(function(_0x545702,_0x216942){return client[_0xd4c8('0x6')](_0x1b3429,_0x4d57d7)[_0xd4c8('0x7')](function(_0x3c674b){if(_0x3c674b[_0xd4c8('0x8')]){return _0x216942(_0x3c674b['error']['message']);}else{return _0x545702(_0x3c674b['result']);}})[_0xd4c8('0x9')](function(_0x4094a7){return _0x216942(_0x4094a7);});});}exports['getSquareProject']=function(_0x3343a0){return request(_0xd4c8('0xa'),{'options':{'raw':![],'where':{'name':_0x3343a0},'attributes':['production']}});};exports['getMailAccountById']=function(_0x1cefe0){return request(_0xd4c8('0xb'),{'options':{'raw':![],'where':{'id':_0x1cefe0},'include':[{'model':_0xd4c8('0xc'),'as':'Smtp'}],'attributes':['id','name','email']}});};exports[_0xd4c8('0xd')]=function(_0x4e25bc){return request(_0xd4c8('0xa'),{'options':{'where':{'id':_0x4e25bc},'attributes':[_0xd4c8('0xe')]}});};exports[_0xd4c8('0xf')]=function(_0x565134){return request(_0xd4c8('0x10'),{'options':{'where':{'id':_0x565134},'attributes':[_0xd4c8('0xe')]}});};exports[_0xd4c8('0x11')]=function(_0x2e2ae3){return request(_0xd4c8('0x12'),{'options':{'where':{'id':_0x2e2ae3},'attributes':[_0xd4c8('0xe')]}});};exports[_0xd4c8('0x13')]=function(_0x1a5e81){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1a5e81},'attributes':[_0xd4c8('0x14')]}});};exports[_0xd4c8('0x15')]=function(_0x5a49c2){return request(_0xd4c8('0x16'),{'options':{'where':{'id':_0x5a49c2},'attributes':[_0xd4c8('0xe')]}});};exports[_0xd4c8('0x17')]=function(_0x1ca8af){return request(_0xd4c8('0x18'),{'options':{'where':{'id':_0x1ca8af},'attributes':[_0xd4c8('0xe')]}});};exports['getSoundById']=function(_0xa83399){return request(_0xd4c8('0x19'),{'options':{'where':{'id':_0xa83399},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x23f2b8){return request(_0xd4c8('0x1a'),{'options':{'raw':![],'where':{'id':_0x23f2b8},'include':[{'model':'Interval','as':'Intervals'}]}});};exports[_0xd4c8('0x1b')]=function(_0x586de6){return request(_0xd4c8('0x1c'),{'options':{'where':{'id':_0x586de6},'attributes':['id',_0xd4c8('0xe')]}});};exports[_0xd4c8('0x1d')]=function(_0xceb35b){return request(_0xd4c8('0x1e'),{'body':_0xceb35b});};exports['createSquareDetailsReport']=function(_0x5226da){return request(_0xd4c8('0x1f'),{'body':_0x5226da});};exports[_0xd4c8('0x20')]=function(_0x37fbb2){return request(_0xd4c8('0x21'),{'body':_[_0xd4c8('0x22')](_0x37fbb2,{'project_name':_0x37fbb2[_0xd4c8('0x23')],'prev_project_name':_0x37fbb2[_0xd4c8('0x24')]||'','is_subproject':_0x37fbb2[_0xd4c8('0x24')]?!![]:![],'leaveAt':moment()[_0xd4c8('0x25')](_0xd4c8('0x26'))})});};exports[_0xd4c8('0x27')]=function(_0x47da0d){return request(_0xd4c8('0x28'),{'body':_0x47da0d});};exports[_0xd4c8('0x29')]=function(_0x156564){return request(_0xd4c8('0x2a'),{'body':_0x156564});};exports[_0xd4c8('0x2b')]=function(_0x2f06f1){return request(_0xd4c8('0x2c'),{'options':{'raw':![],'where':{'phone':_0x2f06f1['phone'],'ListId':_0x2f06f1[_0xd4c8('0x2d')]}}})[_0xd4c8('0x7')](function(_0x1886cf){if(_0x1886cf){return _0x1886cf;}return request(_0xd4c8('0x2e'),{'body':_0x2f06f1});});};exports[_0xd4c8('0x2f')]=function(_0x1c0584){return request('ShowPause',{'options':{'where':{'id':_0x1c0584},'attributes':[_0xd4c8('0xe')]}});};exports[_0xd4c8('0x30')]=function(_0x2bd3a6,_0x5f4984){return request(_0xd4c8('0x31'),{'body':{'interface':_0x5f4984},'options':{'where':_0x2bd3a6}});};exports[_0xd4c8('0x32')]=function(_0x2284b1,_0x24a4b7,_0x1bb99a){return request('PauseUser',{'body':{'type':_0x24a4b7,'uniqueid':_0x1bb99a},'options':{'where':_0x2284b1}});};exports[_0xd4c8('0x33')]=function(_0xe1a9d5){return request(_0xd4c8('0x34'),{'body':{},'options':{'where':_0xe1a9d5}});};exports[_0xd4c8('0x35')]=function(_0x5672f7){return request(_0xd4c8('0x36'),{'body':{},'options':{'where':_0x5672f7}});}; \ No newline at end of file +var _0x6751=['getTrunkById','getSoundById','ShowSound','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createCmContact','ShowCmHopper','phone','then','CreateCmContact','getPauseById','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','agentLogout','LogoutUser','bluebird','moment','lodash','client','http','error','result','catch','getSquareProject','ShowSquareProject','production','ShowMailAccount','Smtp','name','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x6751,0x15d));var _0x1675=function(_0x2ddd52,_0x4e3b17){_0x2ddd52=_0x2ddd52-0x0;var _0x4bb4ec=_0x6751[_0x2ddd52];return _0x4bb4ec;};'use strict';var BPromise=require(_0x1675('0x0'));var moment=require(_0x1675('0x1'));var _=require(_0x1675('0x2'));var util=require('util');var jayson=require('jayson/promise');var client=jayson[_0x1675('0x3')][_0x1675('0x4')]({'port':0x2329});function request(_0x576c27,_0x55e917){return new BPromise(function(_0x425bcd,_0xd901f4){return client['request'](_0x576c27,_0x55e917)['then'](function(_0x3e8605){if(_0x3e8605[_0x1675('0x5')]){return _0xd901f4(_0x3e8605[_0x1675('0x5')]['message']);}else{return _0x425bcd(_0x3e8605[_0x1675('0x6')]);}})[_0x1675('0x7')](function(_0x1a1d91){return _0xd901f4(_0x1a1d91);});});}exports[_0x1675('0x8')]=function(_0x120ef0){return request(_0x1675('0x9'),{'options':{'raw':![],'where':{'name':_0x120ef0},'attributes':[_0x1675('0xa')]}});};exports['getMailAccountById']=function(_0x244ee2){return request(_0x1675('0xb'),{'options':{'raw':![],'where':{'id':_0x244ee2},'include':[{'model':'MailServerOut','as':_0x1675('0xc')}],'attributes':['id','name','email']}});};exports['getSquareProjectById']=function(_0x34d185){return request(_0x1675('0x9'),{'options':{'where':{'id':_0x34d185},'attributes':[_0x1675('0xd')]}});};exports[_0x1675('0xe')]=function(_0x4e2a64){return request(_0x1675('0xf'),{'options':{'where':{'id':_0x4e2a64},'attributes':[_0x1675('0xd')]}});};exports[_0x1675('0x10')]=function(_0x76bf6e){return request('ShowVariable',{'options':{'where':{'id':_0x76bf6e},'attributes':[_0x1675('0xd')]}});};exports[_0x1675('0x11')]=function(_0x5af1b4){return request(_0x1675('0x12'),{'options':{'where':{'id':_0x5af1b4},'attributes':[_0x1675('0x13')]}});};exports[_0x1675('0x14')]=function(_0x1359e6){return request(_0x1675('0x15'),{'options':{'where':{'id':_0x1359e6},'attributes':[_0x1675('0xd')]}});};exports[_0x1675('0x16')]=function(_0x437f33){return request('ShowTrunk',{'options':{'where':{'id':_0x437f33},'attributes':['name']}});};exports[_0x1675('0x17')]=function(_0x32c63c){return request(_0x1675('0x18'),{'options':{'where':{'id':_0x32c63c},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x45a92d){return request(_0x1675('0x19'),{'options':{'raw':![],'where':{'id':_0x45a92d},'include':[{'model':_0x1675('0x1a'),'as':_0x1675('0x1b')}]}});};exports['getSmsAccountById']=function(_0x531909){return request(_0x1675('0x1c'),{'options':{'where':{'id':_0x531909},'attributes':['id',_0x1675('0xd')]}});};exports[_0x1675('0x1d')]=function(_0x4d17cd){return request(_0x1675('0x1e'),{'body':_0x4d17cd});};exports[_0x1675('0x1f')]=function(_0x3617ed){return request('CreateSquareDetailsReport',{'body':_0x3617ed});};exports[_0x1675('0x20')]=function(_0xcc8455){return request(_0x1675('0x21'),{'body':_[_0x1675('0x22')](_0xcc8455,{'project_name':_0xcc8455[_0x1675('0x23')],'prev_project_name':_0xcc8455[_0x1675('0x24')]||'','is_subproject':_0xcc8455[_0x1675('0x24')]?!![]:![],'leaveAt':moment()['format'](_0x1675('0x25'))})});};exports[_0x1675('0x26')]=function(_0x2beddd){return request(_0x1675('0x27'),{'body':_0x2beddd});};exports['createSquareMessage']=function(_0x34d395){return request('CreateSquareMessage',{'body':_0x34d395});};exports[_0x1675('0x28')]=function(_0x49a475){return request(_0x1675('0x29'),{'options':{'raw':![],'where':{'phone':_0x49a475[_0x1675('0x2a')],'ListId':_0x49a475['ListId']}}})[_0x1675('0x2b')](function(_0x18d8aa){if(_0x18d8aa){return _0x18d8aa;}return request(_0x1675('0x2c'),{'body':_0x49a475});});};exports[_0x1675('0x2d')]=function(_0xec2a0e){return request(_0x1675('0x2e'),{'options':{'where':{'id':_0xec2a0e},'attributes':['name']}});};exports['agentLogin']=function(_0x4bee4d,_0x5531f7){return request(_0x1675('0x2f'),{'body':{'interface':_0x5531f7},'options':{'where':_0x4bee4d}});};exports[_0x1675('0x30')]=function(_0xff3ea0,_0x38632a,_0x3e6c87){return request(_0x1675('0x31'),{'body':{'type':_0x38632a,'uniqueid':_0x3e6c87},'options':{'where':_0xff3ea0}});};exports[_0x1675('0x32')]=function(_0x40a227){return request('UnpauseUser',{'body':{},'options':{'where':_0x40a227}});};exports[_0x1675('0x33')]=function(_0x1c11af){return request(_0x1675('0x34'),{'body':{},'options':{'where':_0x1c11af}});}; \ 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 0cb0ec6..87d21df 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 _0x29eb=['./polly','./lex','exports'];(function(_0x10c30c,_0x4cc5b8){var _0x5c2a05=function(_0x5a116b){while(--_0x5a116b){_0x10c30c['push'](_0x10c30c['shift']());}};_0x5c2a05(++_0x4cc5b8);}(_0x29eb,0x1c5));var _0xb29e=function(_0x5199d1,_0x3069d9){_0x5199d1=_0x5199d1-0x0;var _0x5d93ea=_0x29eb[_0x5199d1];return _0x5d93ea;};var polly=require(_0xb29e('0x0'));var lex=require(_0xb29e('0x1'));module[_0xb29e('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb934=['./lex','exports','./polly'];(function(_0x32ab32,_0x440a44){var _0x527816=function(_0x559392){while(--_0x559392){_0x32ab32['push'](_0x32ab32['shift']());}};_0x527816(++_0x440a44);}(_0xb934,0x92));var _0x4b93=function(_0x5141dc,_0x5f271a){_0x5141dc=_0x5141dc-0x0;var _0x396104=_0xb934[_0x5141dc];return _0x396104;};var polly=require(_0x4b93('0x0'));var lex=require(_0x4b93('0x1'));module[_0x4b93('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index f174e62..7fb3462 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 _0x4ea3=['./lib/api','exports'];(function(_0x1226e5,_0x75a43e){var _0x78037b=function(_0x280c07){while(--_0x280c07){_0x1226e5['push'](_0x1226e5['shift']());}};_0x78037b(++_0x75a43e);}(_0x4ea3,0x70));var _0x34ea=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x4ea3[_0x6c993a];return _0x27f547;};'use strict';var lex=require(_0x34ea('0x0'));module[_0x34ea('0x1')]=function(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c){return lex(_0x324f65,_0x3ab582,_0x588172,_0x374ec1,_0x494b56,_0x269d4c);}; \ No newline at end of file +var _0x6324=['./lib/api','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6324,0x142));var _0x4632=function(_0x3b5587,_0x22a6f4){_0x3b5587=_0x3b5587-0x0;var _0x3fbb62=_0x6324[_0x3b5587];return _0x3fbb62;};'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 diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 60e02e3..60ba5a0 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(_0x1228b4,_0x518ce6){var _0x17215b=function(_0x39f8ba){while(--_0x39f8ba){_0x1228b4['push'](_0x1228b4['shift']());}};_0x17215b(++_0x518ce6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x157157,_0x4ed435){var _0x3d7e21=function(_0x275208){while(--_0x275208){_0x157157['push'](_0x157157['shift']());}};_0x3d7e21(++_0x4ed435);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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 cc47df1..43c47bd 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 _0x04ef=['./lib/api'];(function(_0x4ee74,_0x538e6c){var _0x47788e=function(_0xe63a4a){while(--_0xe63a4a){_0x4ee74['push'](_0x4ee74['shift']());}};_0x47788e(++_0x538e6c);}(_0x04ef,0x175));var _0xf04e=function(_0x11fd73,_0x1cf627){_0x11fd73=_0x11fd73-0x0;var _0x52b5f1=_0x04ef[_0x11fd73];return _0x52b5f1;};'use strict';var polly=require(_0xf04e('0x0'));module['exports']=function(_0x1cfc7f,_0x44f443,_0x149134,_0x1acb0a,_0xcc62a0,_0x68ef1e,_0x25c610){return polly(_0x1cfc7f,_0x44f443,_0x149134,_0x1acb0a,_0xcc62a0,_0x68ef1e,_0x25c610);}; \ No newline at end of file +var _0x9239=['exports','./lib/api'];(function(_0x1f8897,_0x4ceaf9){var _0xc3540f=function(_0x2975c6){while(--_0x2975c6){_0x1f8897['push'](_0x1f8897['shift']());}};_0xc3540f(++_0x4ceaf9);}(_0x9239,0x95));var _0x9923=function(_0x5492db,_0x2996f1){_0x5492db=_0x5492db-0x0;var _0x4d94c7=_0x9239[_0x5492db];return _0x4d94c7;};'use strict';var polly=require(_0x9923('0x0'));module[_0x9923('0x1')]=function(_0xa5cf2,_0x4a5876,_0x2aa15d,_0x4bbab3,_0x5c909e,_0x1e31c4,_0x512bc9){return polly(_0xa5cf2,_0x4a5876,_0x2aa15d,_0x4bbab3,_0x5c909e,_0x1e31c4,_0x512bc9);}; \ 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 b4280e6..b76cffb 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 _0xc3b4=['synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird','randomstring'];(function(_0x16c25c,_0x56e337){var _0x427fc9=function(_0x3d4dd8){while(--_0x3d4dd8){_0x16c25c['push'](_0x16c25c['shift']());}};_0x427fc9(++_0x56e337);}(_0xc3b4,0xa2));var _0x4c3b=function(_0x89bddd,_0x5c50e8){_0x89bddd=_0x89bddd-0x0;var _0x3a10e6=_0xc3b4[_0x89bddd];return _0x3a10e6;};'use strict';var fs=require('fs');var path=require(_0x4c3b('0x0'));var BPromise=require(_0x4c3b('0x1'));var rs=require(_0x4c3b('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x89e33f,_0x35b2d9,_0x37977c){return new BPromise(function(_0x3978e2,_0x3a5799){_0x89e33f[_0x4c3b('0x3')](_0x35b2d9,function(_0x50ae1b,_0x7c4d6c){if(_0x50ae1b){_0x3a5799(_0x50ae1b);}else if(_0x7c4d6c){if(_0x7c4d6c[_0x4c3b('0x4')]instanceof Buffer){fs[_0x4c3b('0x5')](_0x37977c,_0x7c4d6c[_0x4c3b('0x4')],function(_0x486289){if(_0x486289){_0x3a5799(_0x486289);}else{_0x3978e2();}});}else{_0x3a5799(new Error(_0x4c3b('0x6')));}}else{_0x3a5799(new Error(_0x4c3b('0x7')));}});});}module[_0x4c3b('0x8')]=function(_0x2b6fc7,_0x2df4f9,_0x577313,_0xa731da,_0x1bbcaa,_0xd42e26,_0x2403dd){var _0x2166f7=new AWS['Polly']({'accessKeyId':_0x2b6fc7,'secretAccessKey':_0x2df4f9,'region':_0x577313});var _0x30538b={'Text':_0x1bbcaa,'TextType':_0xd42e26||_0x4c3b('0x9'),'OutputFormat':_0x4c3b('0xa'),'VoiceId':_0xa731da};return pollyResult(_0x2166f7,_0x30538b,_0x2403dd);}; \ No newline at end of file +var _0xc25b=['AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','path','bluebird','aws-sdk','synthesizeSpeech'];(function(_0x5a26f5,_0x196300){var _0x2e9ef7=function(_0x593736){while(--_0x593736){_0x5a26f5['push'](_0x5a26f5['shift']());}};_0x2e9ef7(++_0x196300);}(_0xc25b,0x83));var _0xbc25=function(_0x59ceb9,_0x3df195){_0x59ceb9=_0x59ceb9-0x0;var _0x3cf08a=_0xc25b[_0x59ceb9];return _0x3cf08a;};'use strict';var fs=require('fs');var path=require(_0xbc25('0x0'));var BPromise=require(_0xbc25('0x1'));var rs=require('randomstring');var AWS=require(_0xbc25('0x2'));function pollyResult(_0x56286e,_0x20dba2,_0x284bed){return new BPromise(function(_0x91cf24,_0x216430){_0x56286e[_0xbc25('0x3')](_0x20dba2,function(_0x279b14,_0x1060a0){if(_0x279b14){_0x216430(_0x279b14);}else if(_0x1060a0){if(_0x1060a0[_0xbc25('0x4')]instanceof Buffer){fs[_0xbc25('0x5')](_0x284bed,_0x1060a0[_0xbc25('0x4')],function(_0x36b389){if(_0x36b389){_0x216430(_0x36b389);}else{_0x91cf24();}});}else{_0x216430(new Error(_0xbc25('0x6')));}}else{_0x216430(new Error(_0xbc25('0x7')));}});});}module[_0xbc25('0x8')]=function(_0x2bd740,_0x4a05f3,_0x493cb1,_0x210493,_0x428deb,_0x25897f,_0x550751){var _0x237159=new AWS['Polly']({'accessKeyId':_0x2bd740,'secretAccessKey':_0x4a05f3,'region':_0x493cb1});var _0x5a5140={'Text':_0x428deb,'TextType':_0x25897f||'text','OutputFormat':'mp3','VoiceId':_0x210493};return pollyResult(_0x237159,_0x5a5140,_0x550751);}; \ 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 aa60519..40c51b7 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 _0xb225=['exports','./lib/api'];(function(_0x3f226d,_0x48e000){var _0x4d7ec9=function(_0x3fe6eb){while(--_0x3fe6eb){_0x3f226d['push'](_0x3f226d['shift']());}};_0x4d7ec9(++_0x48e000);}(_0xb225,0x153));var _0x5b22=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0xb225[_0xd511d];return _0x3f148e;};'use strict';var asr=require(_0x5b22('0x0'));module[_0x5b22('0x1')]=function(_0x489aed,_0x1cd0b6,_0x2ad002,_0x44b036){return asr(_0x489aed,_0x1cd0b6,_0x2ad002);}; \ No newline at end of file +var _0xdae5=['./lib/api','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xdae5,0x98));var _0x5dae=function(_0x1aed14,_0x16e83f){_0x1aed14=_0x1aed14-0x0;var _0x2848fa=_0xdae5[_0x1aed14];return _0x2848fa;};'use strict';var asr=require(_0x5dae('0x0'));module[_0x5dae('0x1')]=function(_0x3184e8,_0x1f661f,_0x387263,_0x2657b6){return asr(_0x3184e8,_0x1f661f,_0x387263);}; \ 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 04b1de3..4f5563a 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 _0x8cfd=['/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','POST'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x2e8418,_0x58c529){_0x2e8418=_0x2e8418-0x0;var _0x548fe6=_0x8cfd[_0x2e8418];return _0x548fe6;};'use strict';var url=require(_0xd8cf('0x0'));var BPromise=require(_0xd8cf('0x1'));var fs=require('fs');var host=_0xd8cf('0x2');module[_0xd8cf('0x3')]=function(_0x6ea39,_0x30dc05,_0x562c81){return new BPromise(function(_0x458a58,_0x1146ed){var _0x35b295;if(typeof _0x6ea39!==_0xd8cf('0x4')||_0x6ea39[_0xd8cf('0x5')]===0x0){return _0x1146ed(_0xd8cf('0x6'));}if(typeof _0x30dc05!==_0xd8cf('0x4')||_0x30dc05['length']===0x0){return _0x1146ed('key\x20should\x20be\x20a\x20string');}if(typeof _0x562c81!==_0xd8cf('0x7')&&(typeof _0x562c81!==_0xd8cf('0x4')||_0x562c81[_0xd8cf('0x5')]===0x0)){return _0x1146ed(_0xd8cf('0x8'));}try{_0x35b295=fs[_0xd8cf('0x9')](_0x6ea39)[_0xd8cf('0xa')]('base64');}catch(_0x3342fb){return _0x1146ed(_0x3342fb);}return _0x458a58({'method':_0xd8cf('0xb'),'uri':host+_0xd8cf('0xc')+_0x30dc05,'body':{'config':{'encoding':_0xd8cf('0xd'),'sampleRateHertz':_0xd8cf('0xe'),'languageCode':_0x562c81},'audio':{'content':_0x35b295}},'json':!![]});});}; \ No newline at end of file +var _0x8ce3=['url','bluebird','exports','string','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000'];(function(_0xc690a2,_0x28800d){var _0x5735ad=function(_0x4e0ba8){while(--_0x4e0ba8){_0xc690a2['push'](_0xc690a2['shift']());}};_0x5735ad(++_0x28800d);}(_0x8ce3,0xc3));var _0x38ce=function(_0x245e0e,_0xcab6db){_0x245e0e=_0x245e0e-0x0;var _0xafcff4=_0x8ce3[_0x245e0e];return _0xafcff4;};'use strict';var url=require(_0x38ce('0x0'));var BPromise=require(_0x38ce('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x38ce('0x2')]=function(_0x2b99b0,_0xee1d0e,_0x26ec48){return new BPromise(function(_0x1b4dd4,_0x17b96d){var _0x1efae3;if(typeof _0x2b99b0!==_0x38ce('0x3')||_0x2b99b0['length']===0x0){return _0x17b96d(_0x38ce('0x4'));}if(typeof _0xee1d0e!==_0x38ce('0x3')||_0xee1d0e['length']===0x0){return _0x17b96d(_0x38ce('0x5'));}if(typeof _0x26ec48!==_0x38ce('0x6')&&(typeof _0x26ec48!==_0x38ce('0x3')||_0x26ec48['length']===0x0)){return _0x17b96d(_0x38ce('0x7'));}try{_0x1efae3=fs['readFileSync'](_0x2b99b0)[_0x38ce('0x8')]('base64');}catch(_0x133bd5){return _0x17b96d(_0x133bd5);}return _0x1b4dd4({'method':_0x38ce('0x9'),'uri':host+_0x38ce('0xa')+_0xee1d0e,'body':{'config':{'encoding':_0x38ce('0xb'),'sampleRateHertz':_0x38ce('0xc'),'languageCode':_0x26ec48},'audio':{'content':_0x1efae3}},'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 cdb2fee..de9e832 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 _0xb5e5=['./asr'];(function(_0x26a7cd,_0x1ff5f2){var _0x59a02a=function(_0x25c08f){while(--_0x25c08f){_0x26a7cd['push'](_0x26a7cd['shift']());}};_0x59a02a(++_0x1ff5f2);}(_0xb5e5,0xc5));var _0x5b5e=function(_0x49c535,_0x30b241){_0x49c535=_0x49c535-0x0;var _0x383698=_0xb5e5[_0x49c535];return _0x383698;};var asr=require(_0x5b5e('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x3fbf=['./asr'];(function(_0x149ca5,_0x3f9ba8){var _0x2d2fae=function(_0x146d07){while(--_0x146d07){_0x149ca5['push'](_0x149ca5['shift']());}};_0x2d2fae(++_0x3f9ba8);}(_0x3fbf,0x19f));var _0xf3fb=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0x3fbf[_0x33dcf7];return _0x542d4e;};var asr=require(_0xf3fb('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 96cb468..8add9a6 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 _0xc05d=['then','.mp3','from','writeFile','googleCloudTTS\x20path','googleTTS','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','actionIncomplete','fulfillment','speech','score','metadata','replace','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','channelData','CustomActionData','Data','audiofile','dirName','apiai-promise','dialogflow','https','md5','randomstring','sox','parse','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','path','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','statusMessage','request\x20to\x20','finish','info','close','unlink','download\x20error','pipe','end','WHAT_EVER','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0xc05d,0x1c6));var _0xdc05=function(_0x2a51ba,_0x43d65a){_0x2a51ba=_0x2a51ba-0x0;var _0x4e1eb1=_0xc05d[_0x2a51ba];return _0x4e1eb1;};'use strict';var apiai=require(_0xdc05('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xdc05('0x1'));var fs=require('fs');var http=require('http');var https=require(_0xdc05('0x2'));var md5=require(_0xdc05('0x3'));var path=require('path');var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0xdc05('0x4'));var sox=require(_0xdc05('0x5'));var tts=require('google-tts-api');var urlParse=require('url')[_0xdc05('0x6')];var util=require('util');var aws=require(_0xdc05('0x7'));var google=require(_0xdc05('0x8'));var sestek=require(_0xdc05('0x9'));var tilde=require(_0xdc05('0xa'));var logger=require(_0xdc05('0xb'))('agi');var ISPEECH_API=_0xdc05('0xc');function downloadFile(_0x3f4989,_0x497212){return new BPromise(function(_0x231b91,_0x5a3f0f){var _0x5a435b=urlParse(_0x3f4989);var _0x510fd9=_0x5a435b[_0xdc05('0xd')]===_0xdc05('0xe')?https:http;var _0x2fc318={'host':_0x5a435b[_0xdc05('0xf')],'path':_0x5a435b[_0xdc05('0x10')],'headers':{'user-agent':'WHAT_EVER'}};_0x510fd9[_0xdc05('0x11')](_0x2fc318,function(_0xc1b861){if(_0xc1b861[_0xdc05('0x12')]!==0xc8){logger[_0xdc05('0x13')]('request\x20to\x20'+_0x3f4989+_0xdc05('0x14')+_0xc1b861[_0xdc05('0x12')]+'\x20('+_0xc1b861[_0xdc05('0x15')]+')');_0x5a3f0f(new Error(_0xdc05('0x16')+_0x3f4989+_0xdc05('0x14')+_0xc1b861[_0xdc05('0x12')]+'\x20('+_0xc1b861['statusMessage']+')'));return;}var _0x32df1a=fs['createWriteStream'](_0x497212);_0x32df1a['on'](_0xdc05('0x17'),function(){logger[_0xdc05('0x18')]('finish\x20download\x20file');_0x32df1a[_0xdc05('0x19')](_0x231b91);});_0x32df1a['on']('error',function(_0x2d55be){fs[_0xdc05('0x1a')](_0x497212);logger[_0xdc05('0x13')](_0xdc05('0x1b'),_0x2d55be);_0x5a3f0f(_0x2d55be);});_0xc1b861[_0xdc05('0x1c')](_0x32df1a);})['on'](_0xdc05('0x13'),function(_0x3725c2){logger['error'](_0x3725c2);_0x5a3f0f(_0x3725c2);})[_0xdc05('0x1d')]();});}function uploadFile(_0x29a140){return new BPromise(function(_0x48f0c7,_0x53793b){var _0x2cd068=urlParse(_0x29a140);var _0x359b1d=_0x2cd068['protocol']===_0xdc05('0xe')?https:http;var _0x5c7d1b={'host':_0x2cd068[_0xdc05('0xf')],'path':_0x2cd068[_0xdc05('0x10')],'headers':{'user-agent':_0xdc05('0x1e')}};_0x359b1d[_0xdc05('0x11')](_0x5c7d1b,function(_0x2ef445){if(_0x2ef445[_0xdc05('0x12')]!==0xc8){_0x53793b(new Error(_0xdc05('0x16')+_0x29a140+'\x20failed,\x20status\x20code\x20=\x20'+_0x2ef445[_0xdc05('0x12')]+'\x20('+_0x2ef445['statusMessage']+')'));return;}var _0x3e4109='';_0x2ef445['on'](_0xdc05('0x1f'),function(_0x50ab59){_0x3e4109+=_0x50ab59;});_0x2ef445['on'](_0xdc05('0x1d'),function(){_0x48f0c7(_0x3e4109);});})['on']('error',function(_0x30c1cf){_0x53793b(_0x30c1cf);})[_0xdc05('0x1d')]();});}function convertFile(_0x326597,_0x596d54){return new BPromise(function(_0x435291,_0x47ef9b){var _0x2930e6=sox[_0xdc05('0x20')](_0x326597,_0x596d54,{'sampleRate':0x1f40,'format':_0xdc05('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2930e6['on'](_0xdc05('0x13'),function(_0x365e2c){logger['error'](_0xdc05('0x22'),_0x365e2c);_0x47ef9b(_0x365e2c);});_0x2930e6['on']('end',function(){logger[_0xdc05('0x18')](_0xdc05('0x23'));_0x435291();});_0x2930e6[_0xdc05('0x24')]();});}function base64Decode(_0x55cbf2,_0x51da43){var _0x2af517=path[_0xdc05('0x25')](__dirname,_0xdc05('0x26'),rs[_0xdc05('0x27')](0x4)+_0xdc05('0x28'));fs[_0xdc05('0x29')](_0x2af517,_0x55cbf2,_0xdc05('0x2a'));return convertFile(_0x2af517,_0x51da43)['then'](function(){try{fs['unlink'](_0x2af517);fs[_0xdc05('0x2b')](_0x51da43,_0xdc05('0x2c'));}catch(_0x2d6f08){logger[_0xdc05('0x13')](_0x2d6f08);}return _0x51da43[_0xdc05('0x2d')]('.')[0x0];});}function base64Encode(_0x5abd6c){var _0x19a137=fs['readFileSync'](_0x5abd6c);return new Buffer(_0x19a137)['toString'](_0xdc05('0x2a'));}exports['googleCloudTTS']=function(_0x21f882,_0x27e7ec,_0xbf3af6,_0x50cd7b,_0xc095ef,_0x18c1f8){var _0x477dc0,_0x518440;var _0x2caa53=_0xdc05('0x2e');var _0x1e950f=_0xdc05('0x2f')+_0x21f882;var _0x51577e={};if(_0x27e7ec===_0xdc05('0x30')){_0x51577e[_0xdc05('0x31')]={'ssml':_0xbf3af6};}else{_0x51577e[_0xdc05('0x31')]={'text':_0xbf3af6};};_0x51577e[_0xdc05('0x32')]={'languageCode':_0x50cd7b,'ssmlGender':_0xc095ef};_0x51577e[_0xdc05('0x33')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x313b72={'url':_0x2caa53+_0xdc05('0x34')+_0x1e950f,'method':_0xdc05('0x35'),'json':!![],'body':_0x51577e};return rp(_0x313b72)[_0xdc05('0x36')](function(_0x1f0cf8){return new BPromise(function(_0x539e6d,_0x2838f7){_0x477dc0=path['resolve'](__dirname,_0xdc05('0x26'),rs[_0xdc05('0x27')](0x4)+_0xdc05('0x37'));var _0x13bbbf=Buffer[_0xdc05('0x38')](_0x1f0cf8['audioContent'],_0xdc05('0x2a'));return fs[_0xdc05('0x39')](_0x477dc0,_0x13bbbf,function(_0x36d412){_0x2838f7(_0x36d412);},function(_0x44678e){fs[_0xdc05('0x2b')](_0x477dc0,_0xdc05('0x2c'));_0x539e6d(_0x44678e);});});})[_0xdc05('0x36')](function(_0x4c3827){_0x518440=path[_0xdc05('0x25')](__dirname,_0xdc05('0x26'),rs[_0xdc05('0x27')](0x4)+_0xdc05('0x28'));return convertFile(_0x477dc0,_0x518440);})['then'](function(){try{fs[_0xdc05('0x1a')](_0x477dc0);fs[_0xdc05('0x2b')](_0x518440,_0xdc05('0x2c'));}catch(_0x1e62ba){logger[_0xdc05('0x13')](_0x1e62ba);}logger[_0xdc05('0x18')](_0xdc05('0x3a'),_0x518440[_0xdc05('0x2d')]('.')[0x0]);return _0x518440[_0xdc05('0x2d')]('.')[0x0];});};exports[_0xdc05('0x3b')]=function(_0x5ec437,_0x11719f){var _0x2de59b='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x30601f,_0xa6c665;var _0x368722;var _0x18d2eb={'encoding':_0xdc05('0x3c'),'method':_0xdc05('0x35'),'timeout':0x2710,'url':_0x2de59b,'headers':{'Content-Type':_0xdc05('0x3d')},'body':'f.req='+encodeURIComponent(JSON[_0xdc05('0x3e')]([[[_0xdc05('0x3f'),JSON[_0xdc05('0x3e')]([_0x5ec437,_0x11719f||'en',![],_0xdc05('0x40')]),null,_0xdc05('0x41')]]]))};return rp(_0x18d2eb)[_0xdc05('0x36')](function(_0x54d9d3){try{_0x368722=eval(_0x54d9d3[_0xdc05('0x42')](0x5))[0x0][0x2];}catch(_0x230120){throw new Error(_0xdc05('0x43')+_0x54d9d3[_0xdc05('0x1f')]);}if(!_0x368722){if(_0x5ec437[_0xdc05('0x44')]>0xc8){throw new Error(_0xdc05('0x45'));}else{throw new Error('lang\x20\x22'+_0x11719f+_0xdc05('0x46'));}}try{_0x368722=eval(_0x368722)[0x0];}catch(_0x568905){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xdc05('0x1f')]);}const _0x1cbd40=_0x368722;_0x30601f=path[_0xdc05('0x25')](__dirname,'tmp',rs[_0xdc05('0x27')](0x4)+'.mp3');fs[_0xdc05('0x29')](_0x30601f,_0x368722,{'encoding':_0xdc05('0x2a')});_0xa6c665=path[_0xdc05('0x25')](__dirname,_0xdc05('0x26'),rs[_0xdc05('0x27')](0x4)+_0xdc05('0x28'));return convertFile(_0x30601f,_0xa6c665);})[_0xdc05('0x36')](function(){try{fs[_0xdc05('0x1a')](_0x30601f);fs[_0xdc05('0x2b')](_0xa6c665,_0xdc05('0x2c'));}catch(_0x567447){logger[_0xdc05('0x13')](_0x567447);}logger[_0xdc05('0x18')](_0xdc05('0x47'),_0xa6c665['split']('.')[0x0]);return _0xa6c665[_0xdc05('0x2d')]('.')[0x0];});};exports[_0xdc05('0x48')]=function(_0xc6b155,_0x3be409,_0x4abf55){return google[_0xdc05('0x49')](_0xc6b155,_0x3be409,_0x4abf55)[_0xdc05('0x36')](function(_0x258f7b){logger[_0xdc05('0x18')](_0x258f7b['uri']);return rp(_0x258f7b);})[_0xdc05('0x36')](function(_0x9be56b){var _0x6315c7='';var _0x2c14ae=0x0;try{fs[_0xdc05('0x1a')](_0xc6b155);}catch(_0x285bd3){logger[_0xdc05('0x13')](_0x285bd3);}if(_0x9be56b&&_0x9be56b[_0xdc05('0x4a')]){_0x6315c7=_0x9be56b[_0xdc05('0x4a')][_0xdc05('0x4b')](function(_0x1cf697){return _0x1cf697&&_0x1cf697[_0xdc05('0x4c')][0x0]&&_0x1cf697['alternatives'][0x0][_0xdc05('0x4d')]?_0x1cf697[_0xdc05('0x4c')][0x0][_0xdc05('0x4d')]:'';})[_0xdc05('0x4e')]('\x0a');_0x2c14ae=_0x9be56b[_0xdc05('0x4a')][_0xdc05('0x4b')](function(_0x28e8ca){return _0x28e8ca&&_0x28e8ca['alternatives'][0x0]&&_0x28e8ca[_0xdc05('0x4c')][0x0][_0xdc05('0x4f')]?_0x28e8ca['alternatives'][0x0]['confidence']:0x0;})[_0xdc05('0x4e')]('\x0a');}logger[_0xdc05('0x18')](_0xdc05('0x50'),_0x6315c7);logger[_0xdc05('0x18')](_0xdc05('0x51'),_0x2c14ae);return{'transcript':_0x6315c7,'confidence':_0x2c14ae};})[_0xdc05('0x52')](function(_0x203392){logger['error'](_0xdc05('0x53'),_0x203392[_0xdc05('0x12')],_0x203392[_0xdc05('0x54')],_0x203392[_0xdc05('0x55')]);});};exports[_0xdc05('0x56')]=function(_0xb47d8f,_0x5ef983,_0xb89c41,_0x4a6ee7){var _0x224753=apiai(_0x5ef983,{'language':_0x4a6ee7||'en'});return _0x224753[_0xdc05('0x57')](_0xb89c41,{'sessionId':md5(_0xb47d8f)})['then'](function(_0x5af653){logger[_0xdc05('0x18')](JSON[_0xdc05('0x3e')](_0x5af653));return{'source':_0x5af653['result'][_0xdc05('0x58')],'resolvedQuery':_0x5af653['result']['resolvedQuery'],'action':_0x5af653[_0xdc05('0x59')]['action'],'actionIncomplete':_0x5af653[_0xdc05('0x59')][_0xdc05('0x5a')],'speech':_0x5af653['result'][_0xdc05('0x5b')][_0xdc05('0x5c')],'score':_0x5af653[_0xdc05('0x59')][_0xdc05('0x5d')],'statusCode':_0x5af653['status']['code'],'endConversation':_0x5af653[_0xdc05('0x59')][_0xdc05('0x5e')]['endConversation']||![],'isFallbackIntent':_0x5af653[_0xdc05('0x59')]['metadata']['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x45e8ad,_0x84ac34,_0x5806fe,_0x2eb2e4,_0xe60371,_0x30b835){var _0x331fc0=_0x2eb2e4[_0xdc05('0x5f')](/\\n/g,'\x0a');var _0x50c32b={'credentials':{'private_key':_0x331fc0,'client_email':_0x5806fe}};var _0x4fc0c9=new dialogflow['SessionsClient'](_0x50c32b);var _0x157391=_0x4fc0c9[_0xdc05('0x60')](_0x84ac34,md5(_0x45e8ad));var _0x3dc37c={'session':_0x157391,'queryInput':{'text':{'text':_0xe60371,'languageCode':_0x30b835}}};return _0x4fc0c9['detectIntent'](_0x3dc37c)[_0xdc05('0x36')](function(_0x3e62d7){if(_0x3e62d7&&_0x3e62d7[_0xdc05('0x44')]){logger[_0xdc05('0x18')](_0xdc05('0x61'),JSON[_0xdc05('0x3e')](_0x3e62d7));var _0x5be675=_0x3e62d7[0x0];if(_0x5be675){var _0x43b53b={'action':_0x5be675[_0xdc05('0x62')]['action'],'allRequiredParamsPresent':_0x5be675[_0xdc05('0x62')][_0xdc05('0x63')],'endConversation':_0x5be675[_0xdc05('0x62')]['diagnosticInfo']&&_0x5be675[_0xdc05('0x62')][_0xdc05('0x64')]['fields']?_0x5be675[_0xdc05('0x62')][_0xdc05('0x64')][_0xdc05('0x65')][_0xdc05('0x66')]['boolValue']:![],'fulfillmentText':_0x5be675[_0xdc05('0x62')][_0xdc05('0x67')],'intentName':_0x5be675[_0xdc05('0x62')][_0xdc05('0x68')][_0xdc05('0x54')],'intentDisplayName':_0x5be675['queryResult'][_0xdc05('0x68')][_0xdc05('0x69')],'isFallbackIntent':_0x5be675[_0xdc05('0x62')][_0xdc05('0x68')]['isFallback'],'languageCode':_0x5be675['queryResult']['languageCode'],'queryText':_0x5be675[_0xdc05('0x62')][_0xdc05('0x6a')],'responseId':_0x5be675[_0xdc05('0x6b')],'score':_0x5be675[_0xdc05('0x62')][_0xdc05('0x6c')],'speech':_0x5be675[_0xdc05('0x62')][_0xdc05('0x67')],'providerResponse':JSON[_0xdc05('0x3e')](_0x3e62d7)};return _0x43b53b;}}});};exports['tildeASR']=function(_0x4524c0,_0x59c54e,_0x5b1128,_0x4fad46){return tilde[_0xdc05('0x49')](_0x4524c0,_0x59c54e,_0x5b1128,_0x4fad46)[_0xdc05('0x36')](function(_0xa53775){try{fs[_0xdc05('0x1a')](_0x4524c0);}catch(_0x2e2e03){logger[_0xdc05('0x13')](_0x2e2e03);}logger[_0xdc05('0x18')](_0xdc05('0x6d'),_0xa53775[_0xdc05('0x4d')]);logger[_0xdc05('0x18')](_0xdc05('0x6e'),_0xa53775[_0xdc05('0x4f')]);return _0xa53775;});};exports['awsPolly']=function(_0x1ffebb,_0x3dfeda,_0xd0f6b3,_0x30c0aa,_0x5a785d,_0x8a8c90){var _0x5b8c51=path['resolve'](__dirname,_0xdc05('0x26'),rs[_0xdc05('0x27')](0x4)+'.mp3');var _0x42c8f1;return aws[_0xdc05('0x6f')](_0x1ffebb,_0x3dfeda,_0xd0f6b3,_0x30c0aa,_0x5a785d,_0x8a8c90,_0x5b8c51)[_0xdc05('0x36')](function(){_0x42c8f1=path['resolve'](__dirname,_0xdc05('0x26'),rs[_0xdc05('0x27')](0x4)+_0xdc05('0x28'));return convertFile(_0x5b8c51,_0x42c8f1);})['then'](function(){try{fs[_0xdc05('0x1a')](_0x5b8c51);fs[_0xdc05('0x2b')](_0x42c8f1,_0xdc05('0x2c'));}catch(_0x4bd91e){logger[_0xdc05('0x13')](_0x4bd91e);}return _0x42c8f1[_0xdc05('0x2d')]('.')[0x0];});};exports[_0xdc05('0x70')]=function(_0x2de37e,_0x429970,_0x63a26,_0x1e4e22,_0x541f39,_0x3a51b0){return aws[_0xdc05('0x71')](_0x2de37e,_0x429970,_0x63a26,_0x1e4e22,_0x541f39,_0x3a51b0)[_0xdc05('0x36')](function(_0x1df560){logger[_0xdc05('0x18')](JSON[_0xdc05('0x3e')](_0x1df560));return _0x1df560;});};exports[_0xdc05('0x72')]=function(_0x551651,_0x5a5ee0,_0x2b594a,_0x306b5e){var _0x116d78=util[_0xdc05('0x73')](_0xdc05('0x74'),ISPEECH_API,_0x551651,encodeURIComponent(_0x5a5ee0),_0x2b594a,_0x306b5e);var _0x3c92dd=path[_0xdc05('0x25')](__dirname,_0xdc05('0x26'),rs['generate'](0x4)+_0xdc05('0x37'));var _0x37429b;return downloadFile(_0x116d78,_0x3c92dd)[_0xdc05('0x36')](function(){_0x37429b=path['resolve'](__dirname,_0xdc05('0x26'),rs[_0xdc05('0x27')](0x4)+_0xdc05('0x28'));return convertFile(_0x3c92dd,_0x37429b);})[_0xdc05('0x36')](function(){try{fs[_0xdc05('0x1a')](_0x3c92dd);fs[_0xdc05('0x2b')](_0x37429b,'777');}catch(_0x4e5211){logger['error'](_0x4e5211);}return _0x37429b[_0xdc05('0x2d')]('.')[0x0];});};exports[_0xdc05('0x75')]=function(_0x19e349,_0xcc565,_0x1d0af0,_0x1944de){var _0x25ac91=util['format'](_0xdc05('0x76'),ISPEECH_API,_0xcc565,_0x1d0af0,base64Encode(_0x19e349),_0x1944de?util[_0xdc05('0x73')](_0xdc05('0x77'),encodeURIComponent(_0x1944de)):_0xdc05('0x78'));return uploadFile(_0x25ac91)[_0xdc05('0x36')](function(_0x3d9ae0){return querystring[_0xdc05('0x6')](_0x3d9ae0);});};exports['sestekNDA']=function(_0x528291,_0x2fc998){return sestek[_0xdc05('0x79')](_0x528291,_0x2fc998)[_0xdc05('0x36')](function(_0xb8ce59){logger['info'](JSON[_0xdc05('0x3e')](_0xb8ce59));var _0x3195d9={'speech':_0xb8ce59['text'],'action':_0xb8ce59['channelData']?_0xb8ce59[_0xdc05('0x7a')]['CustomAction']:undefined,'actiondata':_0xb8ce59[_0xdc05('0x7a')]?_0xb8ce59['channelData'][_0xdc05('0x7b')]:undefined};if(_0xb8ce59[_0xdc05('0x7a')]&&_0xb8ce59[_0xdc05('0x7a')]['AudioFromTts']){return base64Decode(_0xb8ce59['channelData']['AudioFromTts'][_0xdc05('0x7c')],path[_0xdc05('0x25')](__dirname,_0xdc05('0x26'),rs[_0xdc05('0x27')](0x4)+_0xdc05('0x28')))[_0xdc05('0x36')](function(_0x223176){_0x3195d9[_0xdc05('0x7d')]=_0x223176;return _0x3195d9;});}return _0x3195d9;});};exports[_0xdc05('0x7e')]=function(){return __dirname;}; \ No newline at end of file +var _0x6196=['awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','dirName','bluebird','http','https','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','error','download\x20error','pipe','end','WHAT_EVER','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','generate','writeFileSync','base64','then','chmodSync','777','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','text:synthesize','POST','tmp','.mp3','from','audioContent','.wav','unlink','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','length','text\x20length\x20limit\x20reached','goggleTTS\x20path','googleASR','asr','uri','results','alternatives','transcript','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','result','resolvedQuery','action','fulfillment','speech','score','code','metadata','endConversation','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','name','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly'];(function(_0x5c082a,_0x19ac27){var _0x3b60ac=function(_0x2f37ef){while(--_0x2f37ef){_0x5c082a['push'](_0x5c082a['shift']());}};_0x3b60ac(++_0x19ac27);}(_0x6196,0x9b));var _0x6619=function(_0x48f069,_0x454a2a){_0x48f069=_0x48f069-0x0;var _0x15f774=_0x6196[_0x48f069];return _0x15f774;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x6619('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x6619('0x1'));var https=require(_0x6619('0x2'));var md5=require('md5');var path=require('path');var querystring=require('querystring');var rp=require(_0x6619('0x3'));var rs=require(_0x6619('0x4'));var sox=require(_0x6619('0x5'));var tts=require(_0x6619('0x6'));var urlParse=require('url')[_0x6619('0x7')];var util=require(_0x6619('0x8'));var aws=require(_0x6619('0x9'));var google=require(_0x6619('0xa'));var sestek=require(_0x6619('0xb'));var tilde=require(_0x6619('0xc'));var logger=require('../../../config/logger')(_0x6619('0xd'));var ISPEECH_API=_0x6619('0xe');function downloadFile(_0x3c1bae,_0x3f8e69){return new BPromise(function(_0x46b127,_0x333f7a){var _0x53ec9e=urlParse(_0x3c1bae);var _0x43a18b=_0x53ec9e[_0x6619('0xf')]===_0x6619('0x10')?https:http;var _0x31a298={'host':_0x53ec9e[_0x6619('0x11')],'path':_0x53ec9e['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x43a18b[_0x6619('0x12')](_0x31a298,function(_0x2b279e){if(_0x2b279e[_0x6619('0x13')]!==0xc8){logger['error'](_0x6619('0x14')+_0x3c1bae+_0x6619('0x15')+_0x2b279e['statusCode']+'\x20('+_0x2b279e[_0x6619('0x16')]+')');_0x333f7a(new Error(_0x6619('0x14')+_0x3c1bae+_0x6619('0x15')+_0x2b279e[_0x6619('0x13')]+'\x20('+_0x2b279e[_0x6619('0x16')]+')'));return;}var _0x2a338c=fs[_0x6619('0x17')](_0x3f8e69);_0x2a338c['on'](_0x6619('0x18'),function(){logger[_0x6619('0x19')](_0x6619('0x1a'));_0x2a338c['close'](_0x46b127);});_0x2a338c['on']('error',function(_0x5c6a49){fs['unlink'](_0x3f8e69);logger[_0x6619('0x1b')](_0x6619('0x1c'),_0x5c6a49);_0x333f7a(_0x5c6a49);});_0x2b279e[_0x6619('0x1d')](_0x2a338c);})['on'](_0x6619('0x1b'),function(_0x11dcd3){logger[_0x6619('0x1b')](_0x11dcd3);_0x333f7a(_0x11dcd3);})[_0x6619('0x1e')]();});}function uploadFile(_0x2b431){return new BPromise(function(_0x3b39e3,_0xab17ab){var _0x2ae6c9=urlParse(_0x2b431);var _0x59d0d9=_0x2ae6c9['protocol']===_0x6619('0x10')?https:http;var _0x5114fb={'host':_0x2ae6c9[_0x6619('0x11')],'path':_0x2ae6c9['path'],'headers':{'user-agent':_0x6619('0x1f')}};_0x59d0d9[_0x6619('0x12')](_0x5114fb,function(_0x98c2f2){if(_0x98c2f2['statusCode']!==0xc8){_0xab17ab(new Error(_0x6619('0x14')+_0x2b431+_0x6619('0x15')+_0x98c2f2['statusCode']+'\x20('+_0x98c2f2['statusMessage']+')'));return;}var _0x2dd23f='';_0x98c2f2['on'](_0x6619('0x20'),function(_0x166479){_0x2dd23f+=_0x166479;});_0x98c2f2['on'](_0x6619('0x1e'),function(){_0x3b39e3(_0x2dd23f);});})['on']('error',function(_0x274056){_0xab17ab(_0x274056);})['end']();});}function convertFile(_0xe5fa11,_0x98bc27){return new BPromise(function(_0x317062,_0x360571){var _0x15325f=sox[_0x6619('0x21')](_0xe5fa11,_0x98bc27,{'sampleRate':0x1f40,'format':_0x6619('0x22'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x15325f['on'](_0x6619('0x1b'),function(_0xc4f759){logger[_0x6619('0x1b')](_0x6619('0x23'),_0xc4f759);_0x360571(_0xc4f759);});_0x15325f['on'](_0x6619('0x1e'),function(){logger[_0x6619('0x19')](_0x6619('0x24'));_0x317062();});_0x15325f['start']();});}function base64Decode(_0x2d9019,_0x329f1c){var _0x40c3df=path[_0x6619('0x25')](__dirname,'tmp',rs[_0x6619('0x26')](0x4)+'.wav');fs[_0x6619('0x27')](_0x40c3df,_0x2d9019,_0x6619('0x28'));return convertFile(_0x40c3df,_0x329f1c)[_0x6619('0x29')](function(){try{fs['unlink'](_0x40c3df);fs[_0x6619('0x2a')](_0x329f1c,_0x6619('0x2b'));}catch(_0x3244d4){logger['error'](_0x3244d4);}return _0x329f1c[_0x6619('0x2c')]('.')[0x0];});}function base64Encode(_0x5b298d){var _0xeef8e=fs[_0x6619('0x2d')](_0x5b298d);return new Buffer(_0xeef8e)['toString'](_0x6619('0x28'));}exports['googleCloudTTS']=function(_0xf7300a,_0x3e45c2,_0x4f5b60,_0x5c24c9,_0x380cd6,_0x34f586){var _0x3f1dc8,_0x472925;var _0x4d5393=_0x6619('0x2e');var _0x30a286=_0x6619('0x2f')+_0xf7300a;var _0x4fca42={};if(_0x3e45c2===_0x6619('0x30')){_0x4fca42['input']={'ssml':_0x4f5b60};}else{_0x4fca42[_0x6619('0x31')]={'text':_0x4f5b60};};_0x4fca42['voice']={'languageCode':_0x5c24c9,'ssmlGender':_0x380cd6};_0x4fca42[_0x6619('0x32')]={'audioEncoding':_0x6619('0x33'),'sampleRateHertz':0x1f40};var _0x358ed2={'url':_0x4d5393+_0x6619('0x34')+_0x30a286,'method':_0x6619('0x35'),'json':!![],'body':_0x4fca42};return rp(_0x358ed2)[_0x6619('0x29')](function(_0x47ed17){return new BPromise(function(_0x37c6a4,_0x29edbc){_0x3f1dc8=path['resolve'](__dirname,_0x6619('0x36'),rs[_0x6619('0x26')](0x4)+_0x6619('0x37'));var _0x44386c=Buffer[_0x6619('0x38')](_0x47ed17[_0x6619('0x39')],_0x6619('0x28'));return fs['writeFile'](_0x3f1dc8,_0x44386c,function(_0x5b34a3){_0x29edbc(_0x5b34a3);},function(_0x1d3381){fs[_0x6619('0x2a')](_0x3f1dc8,_0x6619('0x2b'));_0x37c6a4(_0x1d3381);});});})[_0x6619('0x29')](function(_0x27cc79){_0x472925=path['resolve'](__dirname,_0x6619('0x36'),rs[_0x6619('0x26')](0x4)+_0x6619('0x3a'));return convertFile(_0x3f1dc8,_0x472925);})[_0x6619('0x29')](function(){try{fs[_0x6619('0x3b')](_0x3f1dc8);fs[_0x6619('0x2a')](_0x472925,_0x6619('0x2b'));}catch(_0x208298){logger['error'](_0x208298);}logger[_0x6619('0x19')](_0x6619('0x3c'),_0x472925[_0x6619('0x2c')]('.')[0x0]);return _0x472925[_0x6619('0x2c')]('.')[0x0];});};exports[_0x6619('0x3d')]=function(_0x3b41a2,_0x25fade){var _0x452dcc=_0x6619('0x3e');var _0x51983d,_0x4de0fd;var _0x264d80;var _0x5cccb2={'encoding':_0x6619('0x3f'),'method':_0x6619('0x35'),'timeout':0x2710,'url':_0x452dcc,'headers':{'Content-Type':_0x6619('0x40')},'body':_0x6619('0x41')+encodeURIComponent(JSON[_0x6619('0x42')]([[['jQ1olc',JSON[_0x6619('0x42')]([_0x3b41a2,_0x25fade||'en',![],_0x6619('0x43')]),null,_0x6619('0x44')]]]))};return rp(_0x5cccb2)[_0x6619('0x29')](function(_0x273643){try{_0x264d80=eval(_0x273643[_0x6619('0x45')](0x5))[0x0][0x2];}catch(_0x4fd013){throw new Error('parse\x20response\x20failed:\x0a'+_0x273643[_0x6619('0x20')]);}if(!_0x264d80){if(_0x3b41a2[_0x6619('0x46')]>0xc8){throw new Error(_0x6619('0x47'));}else{throw new Error('lang\x20\x22'+_0x25fade+'\x22\x20might\x20not\x20exist');}}try{_0x264d80=eval(_0x264d80)[0x0];}catch(_0x5c2737){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x6619('0x20')]);}const _0x54a79c=_0x264d80;_0x51983d=path['resolve'](__dirname,'tmp',rs[_0x6619('0x26')](0x4)+_0x6619('0x37'));fs[_0x6619('0x27')](_0x51983d,_0x264d80,{'encoding':_0x6619('0x28')});_0x4de0fd=path['resolve'](__dirname,_0x6619('0x36'),rs['generate'](0x4)+'.wav');return convertFile(_0x51983d,_0x4de0fd);})[_0x6619('0x29')](function(){try{fs[_0x6619('0x3b')](_0x51983d);fs[_0x6619('0x2a')](_0x4de0fd,_0x6619('0x2b'));}catch(_0x54c611){logger[_0x6619('0x1b')](_0x54c611);}logger[_0x6619('0x19')](_0x6619('0x48'),_0x4de0fd['split']('.')[0x0]);return _0x4de0fd[_0x6619('0x2c')]('.')[0x0];});};exports[_0x6619('0x49')]=function(_0x78c251,_0x16bdc7,_0x43e31c){return google[_0x6619('0x4a')](_0x78c251,_0x16bdc7,_0x43e31c)[_0x6619('0x29')](function(_0x315d3e){logger[_0x6619('0x19')](_0x315d3e[_0x6619('0x4b')]);return rp(_0x315d3e);})[_0x6619('0x29')](function(_0x4a76a9){var _0x3a59d1='';var _0x1a6958=0x0;try{fs[_0x6619('0x3b')](_0x78c251);}catch(_0x3fba39){logger[_0x6619('0x1b')](_0x3fba39);}if(_0x4a76a9&&_0x4a76a9['results']){_0x3a59d1=_0x4a76a9[_0x6619('0x4c')]['map'](function(_0x30b6b5){return _0x30b6b5&&_0x30b6b5['alternatives'][0x0]&&_0x30b6b5[_0x6619('0x4d')][0x0][_0x6619('0x4e')]?_0x30b6b5[_0x6619('0x4d')][0x0]['transcript']:'';})['join']('\x0a');_0x1a6958=_0x4a76a9['results'][_0x6619('0x4f')](function(_0x1737ba){return _0x1737ba&&_0x1737ba[_0x6619('0x4d')][0x0]&&_0x1737ba[_0x6619('0x4d')][0x0][_0x6619('0x50')]?_0x1737ba[_0x6619('0x4d')][0x0][_0x6619('0x50')]:0x0;})['join']('\x0a');}logger[_0x6619('0x19')](_0x6619('0x51'),_0x3a59d1);logger[_0x6619('0x19')](_0x6619('0x52'),_0x1a6958);return{'transcript':_0x3a59d1,'confidence':_0x1a6958};})[_0x6619('0x53')](function(_0x52f9d8){logger[_0x6619('0x1b')](_0x6619('0x54'),_0x52f9d8[_0x6619('0x13')],_0x52f9d8['name'],_0x52f9d8[_0x6619('0x55')]);});};exports[_0x6619('0x56')]=function(_0x43c558,_0x1c504b,_0x598535,_0x258df1){var _0x5bf10c=apiai(_0x1c504b,{'language':_0x258df1||'en'});return _0x5bf10c[_0x6619('0x57')](_0x598535,{'sessionId':md5(_0x43c558)})['then'](function(_0x47527c){logger[_0x6619('0x19')](JSON[_0x6619('0x42')](_0x47527c));return{'source':_0x47527c[_0x6619('0x58')]['source'],'resolvedQuery':_0x47527c[_0x6619('0x58')][_0x6619('0x59')],'action':_0x47527c[_0x6619('0x58')][_0x6619('0x5a')],'actionIncomplete':_0x47527c['result']['actionIncomplete'],'speech':_0x47527c[_0x6619('0x58')][_0x6619('0x5b')][_0x6619('0x5c')],'score':_0x47527c[_0x6619('0x58')][_0x6619('0x5d')],'statusCode':_0x47527c['status'][_0x6619('0x5e')],'endConversation':_0x47527c[_0x6619('0x58')][_0x6619('0x5f')][_0x6619('0x60')]||![],'isFallbackIntent':_0x47527c[_0x6619('0x58')]['metadata']['isFallbackIntent']};});};exports['googleDialogflowV2']=function(_0x19d8f5,_0x3dd1f1,_0x14e367,_0x369bab,_0x4c6ae0,_0x455852){var _0x4e405f=_0x369bab[_0x6619('0x61')](/\\n/g,'\x0a');var _0xf7f02d={'credentials':{'private_key':_0x4e405f,'client_email':_0x14e367}};var _0x1cd963=new dialogflow[(_0x6619('0x62'))](_0xf7f02d);var _0x1318df=_0x1cd963[_0x6619('0x63')](_0x3dd1f1,md5(_0x19d8f5));var _0x30daa6={'session':_0x1318df,'queryInput':{'text':{'text':_0x4c6ae0,'languageCode':_0x455852}}};return _0x1cd963[_0x6619('0x64')](_0x30daa6)[_0x6619('0x29')](function(_0x4f35ff){if(_0x4f35ff&&_0x4f35ff[_0x6619('0x46')]){logger[_0x6619('0x19')](_0x6619('0x65'),JSON[_0x6619('0x42')](_0x4f35ff));var _0x378812=_0x4f35ff[0x0];if(_0x378812){var _0x30dda0={'action':_0x378812[_0x6619('0x66')][_0x6619('0x5a')],'allRequiredParamsPresent':_0x378812[_0x6619('0x66')][_0x6619('0x67')],'endConversation':_0x378812[_0x6619('0x66')]['diagnosticInfo']&&_0x378812[_0x6619('0x66')][_0x6619('0x68')]['fields']?_0x378812['queryResult']['diagnosticInfo'][_0x6619('0x69')][_0x6619('0x6a')][_0x6619('0x6b')]:![],'fulfillmentText':_0x378812[_0x6619('0x66')][_0x6619('0x6c')],'intentName':_0x378812['queryResult']['intent'][_0x6619('0x6d')],'intentDisplayName':_0x378812['queryResult'][_0x6619('0x6e')][_0x6619('0x6f')],'isFallbackIntent':_0x378812['queryResult'][_0x6619('0x6e')][_0x6619('0x70')],'languageCode':_0x378812['queryResult'][_0x6619('0x71')],'queryText':_0x378812['queryResult'][_0x6619('0x72')],'responseId':_0x378812[_0x6619('0x73')],'score':_0x378812[_0x6619('0x66')][_0x6619('0x74')],'speech':_0x378812['queryResult'][_0x6619('0x6c')],'providerResponse':JSON[_0x6619('0x42')](_0x4f35ff)};return _0x30dda0;}}});};exports[_0x6619('0x75')]=function(_0x41e703,_0x12563e,_0x518e96,_0x318846){return tilde[_0x6619('0x4a')](_0x41e703,_0x12563e,_0x518e96,_0x318846)[_0x6619('0x29')](function(_0x2a0831){try{fs['unlink'](_0x41e703);}catch(_0x265f5f){logger[_0x6619('0x1b')](_0x265f5f);}logger['info'](_0x6619('0x76'),_0x2a0831[_0x6619('0x4e')]);logger[_0x6619('0x19')](_0x6619('0x77'),_0x2a0831['confidence']);return _0x2a0831;});};exports[_0x6619('0x78')]=function(_0x4a9e35,_0x7f0cdd,_0x2fd0cc,_0xcc7eb7,_0x203eab,_0x12d60c){var _0xd5f687=path[_0x6619('0x25')](__dirname,_0x6619('0x36'),rs[_0x6619('0x26')](0x4)+_0x6619('0x37'));var _0x97cc4e;return aws['polly'](_0x4a9e35,_0x7f0cdd,_0x2fd0cc,_0xcc7eb7,_0x203eab,_0x12d60c,_0xd5f687)['then'](function(){_0x97cc4e=path['resolve'](__dirname,_0x6619('0x36'),rs['generate'](0x4)+_0x6619('0x3a'));return convertFile(_0xd5f687,_0x97cc4e);})[_0x6619('0x29')](function(){try{fs[_0x6619('0x3b')](_0xd5f687);fs[_0x6619('0x2a')](_0x97cc4e,'777');}catch(_0x3b614d){logger[_0x6619('0x1b')](_0x3b614d);}return _0x97cc4e[_0x6619('0x2c')]('.')[0x0];});};exports[_0x6619('0x79')]=function(_0x4537c7,_0x2490d4,_0x2c6f3e,_0x98dfd7,_0x550793,_0x1c392e){return aws[_0x6619('0x7a')](_0x4537c7,_0x2490d4,_0x2c6f3e,_0x98dfd7,_0x550793,_0x1c392e)[_0x6619('0x29')](function(_0x1245f9){logger[_0x6619('0x19')](JSON[_0x6619('0x42')](_0x1245f9));return _0x1245f9;});};exports[_0x6619('0x7b')]=function(_0x4ab456,_0x152b09,_0x104459,_0x2f9634){var _0x35d6aa=util[_0x6619('0x7c')](_0x6619('0x7d'),ISPEECH_API,_0x4ab456,encodeURIComponent(_0x152b09),_0x104459,_0x2f9634);var _0x5f15e0=path[_0x6619('0x25')](__dirname,_0x6619('0x36'),rs['generate'](0x4)+'.mp3');var _0x18e695;return downloadFile(_0x35d6aa,_0x5f15e0)[_0x6619('0x29')](function(){_0x18e695=path['resolve'](__dirname,'tmp',rs[_0x6619('0x26')](0x4)+'.wav');return convertFile(_0x5f15e0,_0x18e695);})[_0x6619('0x29')](function(){try{fs[_0x6619('0x3b')](_0x5f15e0);fs['chmodSync'](_0x18e695,_0x6619('0x2b'));}catch(_0x8d4ba7){logger[_0x6619('0x1b')](_0x8d4ba7);}return _0x18e695[_0x6619('0x2c')]('.')[0x0];});};exports[_0x6619('0x7e')]=function(_0x5c619d,_0x15f4a5,_0x8bf872,_0x25c487){var _0x75a986=util['format'](_0x6619('0x7f'),ISPEECH_API,_0x15f4a5,_0x8bf872,base64Encode(_0x5c619d),_0x25c487?util['format'](_0x6619('0x80'),encodeURIComponent(_0x25c487)):_0x6619('0x81'));return uploadFile(_0x75a986)['then'](function(_0x12b2c5){return querystring[_0x6619('0x7')](_0x12b2c5);});};exports[_0x6619('0x82')]=function(_0x26f071,_0x51585c){return sestek[_0x6619('0x83')](_0x26f071,_0x51585c)['then'](function(_0x529c19){logger['info'](JSON[_0x6619('0x42')](_0x529c19));var _0x3ed7dd={'speech':_0x529c19[_0x6619('0x84')],'action':_0x529c19[_0x6619('0x85')]?_0x529c19[_0x6619('0x85')][_0x6619('0x86')]:undefined,'actiondata':_0x529c19[_0x6619('0x85')]?_0x529c19[_0x6619('0x85')]['CustomActionData']:undefined};if(_0x529c19['channelData']&&_0x529c19[_0x6619('0x85')]['AudioFromTts']){return base64Decode(_0x529c19[_0x6619('0x85')][_0x6619('0x87')][_0x6619('0x88')],path['resolve'](__dirname,'tmp',rs[_0x6619('0x26')](0x4)+_0x6619('0x3a')))[_0x6619('0x29')](function(_0x2434cd){_0x3ed7dd['audiofile']=_0x2434cd;return _0x3ed7dd;});}return _0x3ed7dd;});};exports[_0x6619('0x89')]=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..a33dae8 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 _0x885f=['exports','./nda'];(function(_0x3cd451,_0x26e81a){var _0x571ce6=function(_0x27af9e){while(--_0x27af9e){_0x3cd451['push'](_0x3cd451['shift']());}};_0x571ce6(++_0x26e81a);}(_0x885f,0x16d));var _0xf885=function(_0x471273,_0x1587f1){_0x471273=_0x471273-0x0;var _0x56c63e=_0x885f[_0x471273];return _0x56c63e;};var nda=require(_0xf885('0x0'));module[_0xf885('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 2b10553..3a0511d 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 _0xf2a6=['POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','ndaactivity_type','Nda','uniqueid','callerid','dnid','text','Bearer\x20','access_token','body','ProjectName','project','ndagenerate_audio','channelData','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','request-promise','exports'];(function(_0xc7679b,_0x2511a2){var _0x4e8f0b=function(_0x166401){while(--_0x166401){_0xc7679b['push'](_0xc7679b['shift']());}};_0x4e8f0b(++_0x2511a2);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x773a39,_0x2f0e71){_0x773a39=_0x773a39-0x0;var _0x52b0fe=_0xf2a6[_0x773a39];return _0x52b0fe;};'use strict';var rp=require(_0x6f2a('0x0'));var url=require('url');var logger=require('../../../../../config/logger')('agi');module[_0x6f2a('0x1')]=function(_0x5b2cbc,_0x3b14e2){var _0xf60faa={'method':_0x6f2a('0x2'),'uri':url[_0x6f2a('0x3')](_0x3b14e2[_0x6f2a('0x4')],_0x6f2a('0x5')),'form':{'grant_type':_0x6f2a('0x6'),'username':_0x3b14e2[_0x6f2a('0x7')],'password':_0x3b14e2[_0x6f2a('0x6')]},'json':!![]};return rp(_0xf60faa)[_0x6f2a('0x8')](function(_0x4b4fde){var _0x379b80={'method':_0x6f2a('0x2'),'uri':url[_0x6f2a('0x3')](_0x3b14e2[_0x6f2a('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x3b14e2[_0x6f2a('0xa')]||'message','channelId':_0x6f2a('0xb'),'conversation':{'id':_0x5b2cbc[_0x6f2a('0xc')]},'from':{'id':_0x5b2cbc[_0x6f2a('0xd')],'name':_0x5b2cbc['calleridname']},'recipient':{'id':_0x5b2cbc[_0x6f2a('0xe')],'name':_0x5b2cbc['extension']},'text':_0x3b14e2[_0x6f2a('0xf')],'channelData':{}},'headers':{'Authorization':_0x6f2a('0x10')+_0x4b4fde[_0x6f2a('0x11')]},'json':!![]};if(_0x3b14e2['project']){_0x379b80[_0x6f2a('0x12')]['channelData'][_0x6f2a('0x13')]=_0x3b14e2[_0x6f2a('0x14')];}if(_0x3b14e2[_0x6f2a('0x15')]=='1'){_0x379b80[_0x6f2a('0x12')][_0x6f2a('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6f2a('0x17')};}if(_0x3b14e2[_0x6f2a('0x18')]){_0x379b80[_0x6f2a('0x12')][_0x6f2a('0x16')][_0x6f2a('0x19')]=_0x3b14e2[_0x6f2a('0x18')];if(_0x3b14e2[_0x6f2a('0x1a')]){_0x379b80[_0x6f2a('0x12')][_0x6f2a('0x16')][_0x6f2a('0x1b')]=_0x3b14e2[_0x6f2a('0x1a')];}}logger[_0x6f2a('0x1c')](JSON['stringify'](_0x379b80));return rp(_0x379b80);});}; \ No newline at end of file +var _0x324f=['../../../../../config/logger','POST','ndauth_url','/token','username','password','then','resolve','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','dnid','extension','text','Bearer\x20','access_token','project','body','channelData','ProjectName','audio/wav','CustomAction','custom_action_data','info','stringify','request-promise','url'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x324f,0x94));var _0xf324=function(_0x47a46f,_0x563b75){_0x47a46f=_0x47a46f-0x0;var _0x4a6be1=_0x324f[_0x47a46f];return _0x4a6be1;};'use strict';var rp=require(_0xf324('0x0'));var url=require(_0xf324('0x1'));var logger=require(_0xf324('0x2'))('agi');module['exports']=function(_0x1f9dd7,_0x48f6ef){var _0x2f11f0={'method':_0xf324('0x3'),'uri':url['resolve'](_0x48f6ef[_0xf324('0x4')],_0xf324('0x5')),'form':{'grant_type':'password','username':_0x48f6ef[_0xf324('0x6')],'password':_0x48f6ef[_0xf324('0x7')]},'json':!![]};return rp(_0x2f11f0)[_0xf324('0x8')](function(_0x2290b7){var _0x408b34={'method':_0xf324('0x3'),'uri':url[_0xf324('0x9')](_0x48f6ef[_0xf324('0xa')],_0xf324('0xb')),'body':{'type':_0x48f6ef['ndaactivity_type']||_0xf324('0xc'),'channelId':_0xf324('0xd'),'conversation':{'id':_0x1f9dd7[_0xf324('0xe')]},'from':{'id':_0x1f9dd7[_0xf324('0xf')],'name':_0x1f9dd7['calleridname']},'recipient':{'id':_0x1f9dd7[_0xf324('0x10')],'name':_0x1f9dd7[_0xf324('0x11')]},'text':_0x48f6ef[_0xf324('0x12')],'channelData':{}},'headers':{'Authorization':_0xf324('0x13')+_0x2290b7[_0xf324('0x14')]},'json':!![]};if(_0x48f6ef[_0xf324('0x15')]){_0x408b34[_0xf324('0x16')][_0xf324('0x17')][_0xf324('0x18')]=_0x48f6ef[_0xf324('0x15')];}if(_0x48f6ef['ndagenerate_audio']=='1'){_0x408b34['body']['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xf324('0x19')};}if(_0x48f6ef['custom_action']){_0x408b34[_0xf324('0x16')]['channelData'][_0xf324('0x1a')]=_0x48f6ef['custom_action'];if(_0x48f6ef[_0xf324('0x1b')]){_0x408b34[_0xf324('0x16')][_0xf324('0x17')]['CustomActionData']=_0x48f6ef[_0xf324('0x1b')];}}logger[_0xf324('0x1c')](JSON[_0xf324('0x1d')](_0x408b34));return rp(_0x408b34);});}; \ 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 3463bae..640cc55 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 _0x74b4=['exports','./lib/api'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0x74b4,0xab));var _0x474b=function(_0x2b71e6,_0x3ae101){_0x2b71e6=_0x2b71e6-0x0;var _0x4e18d9=_0x74b4[_0x2b71e6];return _0x4e18d9;};'use strict';var asr=require(_0x474b('0x0'));module[_0x474b('0x1')]=function(_0x7300d8,_0x43f503,_0x4c9980,_0x2b781a){return asr(_0x7300d8,_0x43f503,_0x4c9980,_0x2b781a);}; \ No newline at end of file +var _0x0801=['./lib/api','exports'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x0801,0x1c2));var _0x1080=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x0801[_0x422905];return _0x33dc6c;};'use strict';var asr=require(_0x1080('0x0'));module[_0x1080('0x1')]=function(_0x12f26c,_0x4c6a5e,_0x895365,_0x4b2f4a){return asr(_0x12f26c,_0x4c6a5e,_0x895365,_0x4b2f4a);}; \ 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 05bc126..060cfc0 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 _0xfeaf=['No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','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','open','bluebird','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE'];(function(_0x23d388,_0x49c1f7){var _0x20f4db=function(_0xf97deb){while(--_0xf97deb){_0x23d388['push'](_0x23d388['shift']());}};_0x20f4db(++_0x49c1f7);}(_0xfeaf,0x17b));var _0xffea=function(_0x210706,_0x43b061){_0x210706=_0x210706-0x0;var _0x2d9e1e=_0xfeaf[_0x210706];return _0x2d9e1e;};'use strict';var BPromise=require(_0xffea('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xffea('0x1'));var logger=require(_0xffea('0x2'))(_0xffea('0x3'));module[_0xffea('0x4')]=function(_0x58103a,_0x223bf1,_0x46ccc7,_0x11184b){return new BPromise(function(_0x33efdf,_0x2b110e){logger[_0xffea('0x5')](_0xffea('0x6'),_0x11184b||_0xffea('0x7'));var _0x23ce4f=new WebSocket(_0x11184b||_0xffea('0x7'),{'perMessageDeflate':![]});var _0x25b603='';var _0x13f893='0';var _0x5b54d4='1';var _0x40beca=_0xffea('0x8');function _0x26567b(_0x3e9f8e){var _0x3329e7=crypto[_0xffea('0x9')](_0xffea('0xa'));_0x3329e7[_0xffea('0xb')](_0x3e9f8e);return _0x3329e7[_0xffea('0xc')](_0xffea('0xd'));}function _0xcf0dc4(){try{logger[_0xffea('0x5')](_0xffea('0xe'));var _0x3d5c23=moment()[_0xffea('0xf')]();var _0x1cde41=_0x26567b(_0x3d5c23+_0x223bf1+_0x46ccc7);_0x23ce4f[_0xffea('0x10')](JSON[_0xffea('0x11')]({'appID':_0x223bf1,'timestamp':_0x3d5c23,'appKey':_0x1cde41}));var _0x3bc8e6=fs[_0xffea('0x12')](_0x58103a);_0x3bc8e6['on'](_0xffea('0x13'),function(_0x17a0c0){_0x23ce4f[_0xffea('0x10')](_0x17a0c0);});_0x3bc8e6['on'](_0xffea('0x14'),function(){_0x23ce4f[_0xffea('0x10')](_0xffea('0x15'));});}catch(_0x40d9bb){logger[_0xffea('0x16')](_0xffea('0x17'),JSON[_0xffea('0x11')](_0x40d9bb));_0x23ce4f['terminate']();}}function _0x563b3b(_0x2a62ca){try{if(_0x2a62ca){var _0x5776ef=JSON[_0xffea('0x18')](_0x2a62ca);switch(_0x5776ef['status']){case 0x0:if(_0x5776ef['result']){if(_0x5776ef[_0xffea('0x19')][_0xffea('0x1a')]){logger[_0xffea('0x5')](_0xffea('0x1b'),JSON[_0xffea('0x11')](_0x5776ef[_0xffea('0x19')]['hypotheses']));_0x25b603=_0x5776ef[_0xffea('0x19')][_0xffea('0x1c')][0x0][_0xffea('0x1d')];_0x13f893=_0x5776ef[_0xffea('0x19')]['hypotheses'][0x0][_0xffea('0x1e')];_0x5b54d4='0';_0x40beca=_0xffea('0x1f');_0x23ce4f[_0xffea('0x20')]();}}break;case 0x1:logger[_0xffea('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x5b54d4='1';_0x40beca=_0xffea('0x8');break;case 0x2:logger[_0xffea('0x5')](_0xffea('0x21'));_0x5b54d4='2';_0x40beca=_0xffea('0x21');break;case 0x9:logger['info'](_0xffea('0x22'));_0x5b54d4='9';_0x40beca=_0xffea('0x22');break;case 0xa:logger[_0xffea('0x5')](_0xffea('0x23'));_0x5b54d4='10';_0x40beca=_0xffea('0x23');break;case 0xb:logger[_0xffea('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x5b54d4='11';_0x40beca=_0xffea('0x24');}}}catch(_0x57f7ae){logger[_0xffea('0x16')](_0xffea('0x25'),JSON[_0xffea('0x11')](_0x57f7ae));_0x23ce4f[_0xffea('0x20')]();}}function _0x3fc8e9(){logger[_0xffea('0x5')](_0xffea('0x26'));_0x33efdf({'transcript':_0x25b603,'confidence':_0x13f893,'status':_0x5b54d4,'status_message':_0x40beca});}function _0x53d892(_0x1ed515){logger[_0xffea('0x16')](_0xffea('0x27'));if(!_[_0xffea('0x28')](_0x1ed515)){logger[_0xffea('0x16')](_[_0xffea('0x29')](_0x1ed515)?JSON[_0xffea('0x11')](_0x1ed515):_0x1ed515);}}_0x23ce4f['on'](_0xffea('0x2a'),_0xcf0dc4);_0x23ce4f['on']('message',_0x563b3b);_0x23ce4f['on'](_0xffea('0x14'),_0x3fc8e9);_0x23ce4f['on'](_0xffea('0x16'),_0x53d892);});}; \ No newline at end of file +var _0x7478=['Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','bluebird','moment','crypto','agi','exports','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','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','result','final','info','Tilde\x20ASR\x20hypoteses','stringify','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.'];(function(_0x14bf3b,_0x47031a){var _0x4fb45b=function(_0x5dc661){while(--_0x5dc661){_0x14bf3b['push'](_0x14bf3b['shift']());}};_0x4fb45b(++_0x47031a);}(_0x7478,0x16c));var _0x8747=function(_0x1b855f,_0x27682c){_0x1b855f=_0x1b855f-0x0;var _0x305146=_0x7478[_0x1b855f];return _0x305146;};'use strict';var BPromise=require(_0x8747('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x8747('0x1'));var crypto=require(_0x8747('0x2'));var logger=require('../../../../../../config/logger')(_0x8747('0x3'));module[_0x8747('0x4')]=function(_0x5c655a,_0x3ce916,_0x331882,_0xac6e18){return new BPromise(function(_0x2bf3f1,_0x1ecf42){logger['info']('Tilde\x20URI',_0xac6e18||_0x8747('0x5'));var _0x5d798d=new WebSocket(_0xac6e18||_0x8747('0x5'),{'perMessageDeflate':![]});var _0x16eb7b='';var _0x1c0e51='0';var _0x454fe='1';var _0x524921=_0x8747('0x6');function _0x4c1b67(_0x333259){var _0x55e19a=crypto[_0x8747('0x7')](_0x8747('0x8'));_0x55e19a['update'](_0x333259);return _0x55e19a[_0x8747('0x9')](_0x8747('0xa'));}function _0x236edf(){try{logger['info'](_0x8747('0xb'));var _0x1e441b=moment()[_0x8747('0xc')]();var _0x4cf16e=_0x4c1b67(_0x1e441b+_0x3ce916+_0x331882);_0x5d798d[_0x8747('0xd')](JSON['stringify']({'appID':_0x3ce916,'timestamp':_0x1e441b,'appKey':_0x4cf16e}));var _0x2693fa=fs['createReadStream'](_0x5c655a);_0x2693fa['on']('data',function(_0x368ea7){_0x5d798d[_0x8747('0xd')](_0x368ea7);});_0x2693fa['on'](_0x8747('0xe'),function(){_0x5d798d[_0x8747('0xd')](_0x8747('0xf'));});}catch(_0x9c47fd){logger[_0x8747('0x10')](_0x8747('0x11'),JSON['stringify'](_0x9c47fd));_0x5d798d[_0x8747('0x12')]();}}function _0x561ab0(_0x135a37){try{if(_0x135a37){var _0x46e3b3=JSON[_0x8747('0x13')](_0x135a37);switch(_0x46e3b3['status']){case 0x0:if(_0x46e3b3[_0x8747('0x14')]){if(_0x46e3b3[_0x8747('0x14')][_0x8747('0x15')]){logger[_0x8747('0x16')](_0x8747('0x17'),JSON[_0x8747('0x18')](_0x46e3b3['result'][_0x8747('0x19')]));_0x16eb7b=_0x46e3b3['result'][_0x8747('0x19')][0x0]['transcript'];_0x1c0e51=_0x46e3b3[_0x8747('0x14')][_0x8747('0x19')][0x0][_0x8747('0x1a')];_0x454fe='0';_0x524921=_0x8747('0x1b');_0x5d798d[_0x8747('0x12')]();}}break;case 0x1:logger['info'](_0x8747('0x6'));_0x454fe='1';_0x524921='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x8747('0x16')](_0x8747('0x1c'));_0x454fe='2';_0x524921=_0x8747('0x1c');break;case 0x9:logger[_0x8747('0x16')](_0x8747('0x1d'));_0x454fe='9';_0x524921=_0x8747('0x1d');break;case 0xa:logger[_0x8747('0x16')](_0x8747('0x1e'));_0x454fe='10';_0x524921=_0x8747('0x1e');break;case 0xb:logger[_0x8747('0x16')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x454fe='11';_0x524921=_0x8747('0x1f');}}}catch(_0x8485ac){logger[_0x8747('0x10')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x8747('0x18')](_0x8485ac));_0x5d798d[_0x8747('0x12')]();}}function _0xa0c976(){logger['info'](_0x8747('0x20'));_0x2bf3f1({'transcript':_0x16eb7b,'confidence':_0x1c0e51,'status':_0x454fe,'status_message':_0x524921});}function _0x5c468b(_0x29a94a){logger[_0x8747('0x10')](_0x8747('0x21'));if(!_[_0x8747('0x22')](_0x29a94a)){logger[_0x8747('0x10')](_['isObject'](_0x29a94a)?JSON[_0x8747('0x18')](_0x29a94a):_0x29a94a);}}_0x5d798d['on'](_0x8747('0x23'),_0x236edf);_0x5d798d['on']('message',_0x561ab0);_0x5d798d['on'](_0x8747('0xe'),_0xa0c976);_0x5d798d['on'](_0x8747('0x10'),_0x5c468b);});}; \ 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 248cb95..4e434d3 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 _0xa5ad=['exports','./asr'];(function(_0x44abbe,_0x4894ed){var _0x3872e8=function(_0x459405){while(--_0x459405){_0x44abbe['push'](_0x44abbe['shift']());}};_0x3872e8(++_0x4894ed);}(_0xa5ad,0x15b));var _0xda5a=function(_0x5df841,_0xf68843){_0x5df841=_0x5df841-0x0;var _0x434da6=_0xa5ad[_0x5df841];return _0x434da6;};var asr=require(_0xda5a('0x0'));module[_0xda5a('0x1')]={'asr':asr}; \ No newline at end of file +var _0x5ad1=['./asr'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x5ad1,0x9e));var _0x15ad=function(_0x17b8ea,_0x24d8ad){_0x17b8ea=_0x17b8ea-0x0;var _0x5c60ec=_0x5ad1[_0x17b8ea];return _0x5c60ec;};var asr=require(_0x15ad('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e199000..8d74b61 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 _0x17a2=['./channel','call','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','emit','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','E_AGI_SERVER_MAXCONNECTION','destroy','code','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','EventEmitter','./error'];(function(_0x37e7a4,_0xb7a496){var _0x269b2a=function(_0x19ee3f){while(--_0x19ee3f){_0x37e7a4['push'](_0x37e7a4['shift']());}};_0x269b2a(++_0xb7a496);}(_0x17a2,0x6e));var _0x217a=function(_0x2b11b5,_0x536af7){_0x2b11b5=_0x2b11b5-0x0;var _0x1b7c07=_0x17a2[_0x2b11b5];return _0x1b7c07;};'use strict';var util=require(_0x217a('0x0'));var net=require(_0x217a('0x1'));var EventEmitter=require(_0x217a('0x2'))[_0x217a('0x3')];var AGIError=require(_0x217a('0x4'));var AGIChannel=require(_0x217a('0x5'));var AGIServer=function(_0x4c00b5,_0x1bda85,_0x35d163){var _0x4dc26b=this,_0x4c00b5=_0x4c00b5||0x11dd,_0x1bda85=_0x1bda85||'127.0.0.1',_0x3d578b=null,_0x422bc4=0x0;EventEmitter[_0x217a('0x6')](_0x4dc26b);function _0x4d48f9(){if(!_0x4c00b5){_0x4dc26b['emit'](_0x217a('0x7'),new AGIError(_0x217a('0x8')));return![];}_0x3d578b=net[_0x217a('0x9')]();_0x3d578b[_0x217a('0xa')](_0x4c00b5,_0x1bda85);_0x3d578b['on'](_0x217a('0xb'),function(){_0x4dc26b[_0x217a('0xc')](_0x217a('0xb'));});_0x3d578b['on'](_0x217a('0xd'),function(_0x31bd63){_0x3d578b['getConnections'](function(_0x187b48,_0x249670){if(_0x187b48){_0x4dc26b[_0x217a('0xc')](_0x217a('0x7'),new AGIError(_0x217a('0xe'),_0x187b48));}else if(_0x35d163&&_0x35d163<0x0){_0x4dc26b[_0x217a('0xc')]('error',new AGIError(_0x217a('0xf')));_0x31bd63['destroy']();}else if(_0x35d163&&_0x35d163>0x0&&_0x35d163<_0x249670){_0x422bc4+=0x1;_0x4dc26b[_0x217a('0xc')]('error',new AGIError(_0x217a('0x10'),_0x422bc4));_0x31bd63[_0x217a('0x11')]();}else{var _0x577e12=new AGIChannel(_0x31bd63);_0x577e12['on']('ready',function(){_0x4dc26b['emit'](_0x217a('0xd'),_0x577e12);});}});});_0x3d578b['on'](_0x217a('0x7'),function(_0x56801a){_0x4dc26b[_0x217a('0xc')](_0x217a('0x7'),new AGIError(_0x217a('0xe'),_0x56801a[_0x217a('0x12')]));});_0x3d578b['on'](_0x217a('0x13'),function(){_0x4dc26b['emit'](_0x217a('0x13'),new AGIError(_0x217a('0x14')));});}process['nextTick'](function(){_0x4d48f9();});};util[_0x217a('0x15')](AGIServer,EventEmitter);module[_0x217a('0x16')]=function(_0x319198,_0x4549bf,_0x1aadcd){return new AGIServer(_0x319198,_0x4549bf,_0x1aadcd);}; \ No newline at end of file +var _0x4e1b=['call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','util','net','events','./error','./channel','127.0.0.1'];(function(_0x1f4034,_0x18b0dc){var _0x2f6ddb=function(_0x116bac){while(--_0x116bac){_0x1f4034['push'](_0x1f4034['shift']());}};_0x2f6ddb(++_0x18b0dc);}(_0x4e1b,0x10e));var _0xb4e1=function(_0x4bedce,_0x265ebf){_0x4bedce=_0x4bedce-0x0;var _0x4fd2fb=_0x4e1b[_0x4bedce];return _0x4fd2fb;};'use strict';var util=require(_0xb4e1('0x0'));var net=require(_0xb4e1('0x1'));var EventEmitter=require(_0xb4e1('0x2'))['EventEmitter'];var AGIError=require(_0xb4e1('0x3'));var AGIChannel=require(_0xb4e1('0x4'));var AGIServer=function(_0x46089a,_0x465e94,_0x30a381){var _0x2efdce=this,_0x46089a=_0x46089a||0x11dd,_0x465e94=_0x465e94||_0xb4e1('0x5'),_0x423bfb=null,_0x5781b8=0x0;EventEmitter[_0xb4e1('0x6')](_0x2efdce);function _0xa3c693(){if(!_0x46089a){_0x2efdce[_0xb4e1('0x7')](_0xb4e1('0x8'),new AGIError(_0xb4e1('0x9')));return![];}_0x423bfb=net[_0xb4e1('0xa')]();_0x423bfb[_0xb4e1('0xb')](_0x46089a,_0x465e94);_0x423bfb['on'](_0xb4e1('0xc'),function(){_0x2efdce[_0xb4e1('0x7')](_0xb4e1('0xc'));});_0x423bfb['on']('connection',function(_0x43680d){_0x423bfb[_0xb4e1('0xd')](function(_0x380ac3,_0xf3410){if(_0x380ac3){_0x2efdce[_0xb4e1('0x7')](_0xb4e1('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x380ac3));}else if(_0x30a381&&_0x30a381<0x0){_0x2efdce[_0xb4e1('0x7')](_0xb4e1('0x8'),new AGIError(_0xb4e1('0xe')));_0x43680d[_0xb4e1('0xf')]();}else if(_0x30a381&&_0x30a381>0x0&&_0x30a381<_0xf3410){_0x5781b8+=0x1;_0x2efdce['emit'](_0xb4e1('0x8'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x5781b8));_0x43680d[_0xb4e1('0xf')]();}else{var _0x4fceed=new AGIChannel(_0x43680d);_0x4fceed['on'](_0xb4e1('0x10'),function(){_0x2efdce[_0xb4e1('0x7')]('connection',_0x4fceed);});}});});_0x423bfb['on'](_0xb4e1('0x8'),function(_0x351825){_0x2efdce[_0xb4e1('0x7')](_0xb4e1('0x8'),new AGIError(_0xb4e1('0x11'),_0x351825[_0xb4e1('0x12')]));});_0x423bfb['on']('close',function(){_0x2efdce[_0xb4e1('0x7')](_0xb4e1('0x13'),new AGIError(_0xb4e1('0x14')));});}process[_0xb4e1('0x15')](function(){_0xa3c693();});};util[_0xb4e1('0x16')](AGIServer,EventEmitter);module['exports']=function(_0xa5ac76,_0x1b41ec,_0x1169db){return new AGIServer(_0xa5ac76,_0x1b41ec,_0x1169db);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 37ee707..da7c4df 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 _0xb3f4=['Enter\x20in\x20NOOP\x20(%s)\x20block','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','createSmsMessage','set','Enter\x20in\x20SET\x20(%s)\x20block','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','replaceAll','join','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','getVariableById','then','name','catch','prototype','getVoiceQueue','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','format','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','error','agentUnpause','isNil','agentLogout','agent','agentLogin','internal','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','headers','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','aws_polly_region','aws_polly_voice','Amy','aws_text_type','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','split','getVariable','extra','getAndSetVariable','result','setVariable','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','bot','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','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','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appsecret\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','context','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','gotoiftime','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','intKey','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit'];(function(_0x5b7db6,_0x1530fb){var _0x4536bd=function(_0x530da0){while(--_0x530da0){_0x5b7db6['push'](_0x5b7db6['shift']());}};_0x4536bd(++_0x1530fb);}(_0xb3f4,0x69));var _0x4b3f=function(_0x4a86f0,_0x396210){_0x4a86f0=_0x4a86f0-0x0;var _0x2f6a9b=_0xb3f4[_0x4a86f0];return _0x2f6a9b;};'use strict';var fs=require('fs');var path=require(_0x4b3f('0x0'));var util=require(_0x4b3f('0x1'));var _=require(_0x4b3f('0x2'));var sh=require(_0x4b3f('0x3'));var odbc=require(_0x4b3f('0x4'))();var rs=require(_0x4b3f('0x5'));var moment=require(_0x4b3f('0x6'));var Mustache=require(_0x4b3f('0x7'));var rp=require('request-promise');var logger=require(_0x4b3f('0x8'))(_0x4b3f('0x9'));var config=require(_0x4b3f('0xa'));var scripts=require(_0x4b3f('0xb'));var FILES_PATH=_0x4b3f('0xc');var recursiveMapAttributes=[_0x4b3f('0xd'),_0x4b3f('0xe')];var verticesWithRetry=[_0x4b3f('0xf'),_0x4b3f('0x10'),_0x4b3f('0x11')];var AGIVertices=function(_0x23a6a9,_0x3e88c3,_0x18363e){this['channel']=_0x23a6a9;this[_0x4b3f('0x12')]=_0x3e88c3;this[_0x4b3f('0x13')]=_0x18363e;};AGIVertices['prototype']['getVariable']=function(_0x4a8d0c,_0x25d5bc){this[_0x4b3f('0x12')][_0x4b3f('0x14')](_0x4a8d0c)[_0x4b3f('0x15')](function(_0x2c8cea){_0x25d5bc(null,_0x2c8cea?_0x2c8cea[_0x4b3f('0x16')]:![]);})[_0x4b3f('0x17')](function(_0x24a1fe){_0x25d5bc(_0x24a1fe);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x19')]=function(_0x1e4cbc,_0x22006c){this[_0x4b3f('0x12')]['getVoiceQueueById'](_0x1e4cbc)[_0x4b3f('0x15')](function(_0x28c37a){_0x22006c(null,_0x28c37a?_0x28c37a['name']:![]);})['catch'](function(_0x4ad7a9){_0x22006c(_0x4ad7a9);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x1a')]=function(_0xa05863,_0x26a37f){this[_0x4b3f('0x12')][_0x4b3f('0x1b')](_0xa05863)[_0x4b3f('0x15')](function(_0x370c5d){_0x26a37f(null,_0x370c5d?_0x370c5d[_0x4b3f('0x16')]:![]);})[_0x4b3f('0x17')](function(_0x420de9){_0x26a37f(_0x420de9);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x1c')]=function(_0x25ab46,_0x37a166){this[_0x4b3f('0x12')][_0x4b3f('0x1d')](_0x25ab46)[_0x4b3f('0x15')](function(_0x3b6d86){_0x37a166(null,_0x3b6d86?_0x3b6d86[_0x4b3f('0x1e')]:![]);})[_0x4b3f('0x17')](function(_0x17224b){_0x37a166(_0x17224b);});};AGIVertices['prototype'][_0x4b3f('0x1f')]=function(_0x4e3bfa,_0xaec431){this[_0x4b3f('0x12')][_0x4b3f('0x20')](_0x4e3bfa)[_0x4b3f('0x15')](function(_0x13d9b4){_0xaec431(null,_0x13d9b4?_0x13d9b4['name']:![]);})[_0x4b3f('0x17')](function(_0x438a92){_0xaec431(_0x438a92);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x21')]=function(_0x51b708,_0x3480a3){this['rpc'][_0x4b3f('0x22')](_0x51b708)[_0x4b3f('0x15')](function(_0x297c52){_0x3480a3(null,_0x297c52?_0x297c52['name']:![]);})[_0x4b3f('0x17')](function(_0x4ab607){_0x3480a3(_0x4ab607);});};AGIVertices['prototype'][_0x4b3f('0x23')]=function(_0x313301,_0x4f9914){var _0x3ad96e=this;this['rpc'][_0x4b3f('0x24')](_0x313301)[_0x4b3f('0x15')](function(_0x2a78fa){_0x4f9914(null,_0x2a78fa?_0x3ad96e[_0x4b3f('0x25')](_0x2a78fa[_0x4b3f('0x26')]):![]);})[_0x4b3f('0x17')](function(_0x3c1d0a){_0x4f9914(_0x3c1d0a);});};AGIVertices['prototype']['getMailAccount']=function(_0x2765b6,_0x39405c){this[_0x4b3f('0x12')]['getMailAccountById'](_0x2765b6)[_0x4b3f('0x15')](function(_0x3ea544){_0x39405c(null,_0x3ea544?_0x3ea544:![]);})[_0x4b3f('0x17')](function(_0x281bfa){_0x39405c(_0x281bfa);});};AGIVertices['prototype'][_0x4b3f('0x27')]=function(_0xd0e11e,_0x4484e0,_0x5ec36d){this[_0x4b3f('0x13')][_0x4b3f('0x27')](_0xd0e11e,_0x4484e0)[_0x4b3f('0x15')](function(){_0x5ec36d(null);})[_0x4b3f('0x17')](function(_0xfabe79){_0x5ec36d(_0xfabe79);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x28')]=function(_0x598206,_0x4dece0){this['rpc'][_0x4b3f('0x29')](_0x598206)[_0x4b3f('0x15')](function(_0x565f50){if(_0x565f50){if(_0x565f50[_0x4b3f('0x2a')]){_0x4dece0(null,[_0x565f50[_0x4b3f('0x2b')]]);}else{_0x4dece0(null,_['map'](_0x565f50['Intervals'],_0x4b3f('0x2b')));}}else{_0x4dece0(null,![]);}})[_0x4b3f('0x17')](function(_0x47dccf){_0x4dece0(_0x47dccf);});};AGIVertices['prototype'][_0x4b3f('0x25')]=function(_0x2be390){return util[_0x4b3f('0x2c')]('%s/sounds/converted/%s',FILES_PATH,_0x2be390);};AGIVertices['prototype'][_0x4b3f('0x2d')]=function(_0x20fea0,_0x83ce8d,_0x337c1d){odbc[_0x4b3f('0x2e')](_0x20fea0,function(_0x23883a){if(_0x23883a){logger['error'](_0x4b3f('0x2f'),_0x23883a);_0x337c1d(_0x23883a);}else{logger[_0x4b3f('0x30')](_0x4b3f('0x31'));odbc[_0x4b3f('0x32')](_0x83ce8d,function(_0x1d4b03,_0x3dd934){if(_0x1d4b03){logger[_0x4b3f('0x30')](_0x4b3f('0x33'),_0x83ce8d);_0x337c1d(_0x1d4b03);}else{logger[_0x4b3f('0x30')](_0x4b3f('0x34'),_0x83ce8d);odbc[_0x4b3f('0x35')](function(_0x178cf6){if(_0x178cf6){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x178cf6);}_0x337c1d(null,_0x3dd934);});}});}});};AGIVertices['prototype'][_0x4b3f('0x36')]=function(_0x3bc00f,_0x273944){this[_0x4b3f('0x12')][_0x4b3f('0x37')](_0x3bc00f)[_0x4b3f('0x15')](function(_0x3ad2f6){_0x273944(null,_0x3ad2f6?_0x3ad2f6:![]);})['catch'](function(_0x5441e5){_0x273944(_0x5441e5);});};AGIVertices[_0x4b3f('0x18')]['createSmsMessage']=function(_0x19c91e,_0x11811d){this[_0x4b3f('0x12')]['createSmsMessage'](_0x19c91e)[_0x4b3f('0x15')](function(_0x5c1e9d){_0x11811d(null,_0x5c1e9d);})[_0x4b3f('0x17')](function(_0x27f32e){_0x11811d(_0x27f32e);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x38')]=function(_0x4b656f,_0xec760f,_0x5db8cf){this[_0x4b3f('0x12')][_0x4b3f('0x38')]({'uniqueid':this[_0x4b3f('0x39')][_0x4b3f('0x3a')],'node':_0x4b656f[_0x4b3f('0x3b')],'application':_0x4b656f[_0x4b3f('0x3c')],'data':_0xec760f||null,'project_name':this[_0x4b3f('0x39')][_0x4b3f('0x3d')],'callerid':this[_0x4b3f('0x39')][_0x4b3f('0x3e')]})[_0x4b3f('0x15')](function(_0x1fd8bc){if(_0x5db8cf){_0x5db8cf(null,_0x1fd8bc);}})['catch'](function(_0x4c2220){if(_0x5db8cf){_0x5db8cf(_0x4c2220);}});};AGIVertices[_0x4b3f('0x18')]['createSquareRecording']=function(_0xaef5fd,_0x442aca,_0x428ad1,_0x4238c1){this['rpc'][_0x4b3f('0x3f')]({'uniqueid':this[_0x4b3f('0x39')][_0x4b3f('0x3a')],'callerid':this['channel']['callerid'],'calleridname':this['channel'][_0x4b3f('0x40')],'context':this['channel']['context'],'extension':this['channel'][_0x4b3f('0x41')],'priority':this[_0x4b3f('0x39')][_0x4b3f('0x42')],'accountcode':this[_0x4b3f('0x39')][_0x4b3f('0x43')],'dnid':this[_0x4b3f('0x39')][_0x4b3f('0x44')],'projectName':this['channel'][_0x4b3f('0x3d')],'saveName':_0x442aca,'filename':_0xaef5fd[_0x4b3f('0x45')]||_0x442aca,'savePath':_0x428ad1})[_0x4b3f('0x15')](function(_0x5901d8){_0x4238c1(null,_0x5901d8);})[_0x4b3f('0x17')](function(_0x4dc561){_0x4238c1(_0x4dc561);});};AGIVertices['prototype'][_0x4b3f('0x46')]=function(_0x2a48ad,_0x11b745,_0x50befb,_0x4f6591,_0x1c8431){this[_0x4b3f('0x12')][_0x4b3f('0x46')]({'uniqueid':this[_0x4b3f('0x39')][_0x4b3f('0x3a')],'body':_0x2a48ad,'direction':_0x11b745,'providerName':_0x50befb,'providerResponse':_0x4f6591})[_0x4b3f('0x15')](function(_0x11c1ff){if(_0x1c8431){_0x1c8431(null,_0x11c1ff);}})['catch'](function(_0x31309e){if(_0x1c8431){_0x1c8431(_0x31309e);}});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x47')]=function(_0x4b49c7,_0x5b12bd){this[_0x4b3f('0x12')][_0x4b3f('0x47')]({'firstName':_[_0x4b3f('0x48')](_0x4b49c7['name'])||_['isNil'](_0x4b49c7[_0x4b3f('0x16')])?_0x4b3f('0x49')+Math[_0x4b3f('0x4a')]():_0x4b49c7[_0x4b3f('0x16')],'lastName':_[_0x4b3f('0x48')](_0x4b49c7[_0x4b3f('0x4b')])||_['isNil'](_0x4b49c7[_0x4b3f('0x4b')])?null:_0x4b49c7[_0x4b3f('0x4b')],'phone':_0x4b49c7['phone'],'ListId':_0x4b49c7[_0x4b3f('0x4c')],'scheduledat':_0x4b49c7[_0x4b3f('0x4d')],'callbackUniqueid':this['channel'][_0x4b3f('0x3a')],'tags':_0x4b3f('0x4e'),'description':_0x4b3f('0x4f')+_0x4b49c7[_0x4b3f('0x4d')][_0x4b3f('0x50')](),'priority':_0x4b49c7[_0x4b3f('0x51')]})['then'](function(_0x12e08d){_0x5b12bd(null,_0x12e08d);})[_0x4b3f('0x17')](function(_0x3e5b8b){_0x5b12bd(_0x3e5b8b);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x52')]=function(_0x382246,_0x1e5c32){this['rpc'][_0x4b3f('0x53')](_0x382246)[_0x4b3f('0x15')](function(_0x315e65){_0x1e5c32(null,_0x315e65?_0x315e65[_0x4b3f('0x16')]:![]);})['catch'](function(_0x59aefa){_0x1e5c32(_0x59aefa);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x54')]=function(_0xf9461,_0x317a77,_0x3ad54f){var _0x20e1ce={'role':'agent'};_0x20e1ce[_0xf9461]=this[_0x4b3f('0x39')][_0x4b3f('0x3e')];this['rpc'][_0x4b3f('0x54')](_0x20e1ce,_0x317a77,this[_0x4b3f('0x39')][_0x4b3f('0x3a')])[_0x4b3f('0x15')](function(_0x555438){_0x3ad54f(null,_['isNil'](_0x555438)?![]:!![]);})[_0x4b3f('0x17')](function(_0x35577a){logger[_0x4b3f('0x55')](_0x35577a);_0x3ad54f(null,![]);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x56')]=function(_0x4d81c4,_0x49a6ed){var _0x10cc9b={'role':'agent'};_0x10cc9b[_0x4d81c4]=this[_0x4b3f('0x39')][_0x4b3f('0x3e')];this['rpc']['agentUnpause'](_0x10cc9b)['then'](function(_0x5da949){_0x49a6ed(null,_[_0x4b3f('0x57')](_0x5da949)?![]:!![]);})[_0x4b3f('0x17')](function(_0x2e3c29){logger[_0x4b3f('0x55')](_0x2e3c29);_0x49a6ed(null,![]);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x58')]=function(_0xa22091,_0x3b95a7){var _0x169273={'role':_0x4b3f('0x59')};_0x169273[_0xa22091]=this['channel']['callerid'];this[_0x4b3f('0x12')][_0x4b3f('0x58')](_0x169273)[_0x4b3f('0x15')](function(_0x33fa1e){_0x3b95a7(null,_['isNil'](_0x33fa1e)?![]:!![]);})[_0x4b3f('0x17')](function(_0x3c78d9){logger['error'](_0x3c78d9);_0x3b95a7(null,![]);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x5a')]=function(_0x109339,_0x423cae){var _0x585bab={'role':'agent'};_0x585bab[_0x109339]=this[_0x4b3f('0x39')][_0x4b3f('0x3e')];var _0x3c9ebd=_0x109339!=_0x4b3f('0x5b')?util[_0x4b3f('0x2c')]('%s/%s@from-sip/n',_0x4b3f('0x5c'),this['channel'][_0x4b3f('0x3e')]):undefined;this[_0x4b3f('0x12')][_0x4b3f('0x5a')](_0x585bab,_0x3c9ebd)[_0x4b3f('0x15')](function(_0xad72ae){_0x423cae(null,_['isNil'](_0xad72ae)?![]:!![]);})['catch'](function(_0x12f8f9){logger[_0x4b3f('0x55')](_0x12f8f9);_0x423cae(null,![]);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x5d')]=function(_0x1cd28c,_0xdc045f){sh['exec'](_[_0x4b3f('0x5e')](_0x1cd28c),function(_0x30783e,_0x44bed3){var _0x6411e9=_0x44bed3[_0x4b3f('0x5f')](/(\r\n|\n|\r)/gm,'');_0xdc045f(null,_0x6411e9);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x60')]=function(_0xa72a2f,_0x234e3a){scripts[_0x4b3f('0x60')](_0xa72a2f[_0x4b3f('0x61')],_0xa72a2f[_0x4b3f('0x62')]||_0x4b3f('0x63'),_0xa72a2f['text'],_0xa72a2f[_0x4b3f('0x64')]||_0x4b3f('0x65'),_0xa72a2f['ssmlGender']||'MALE',_0xa72a2f[_0x4b3f('0x66')]||_0x4b3f('0x67'))[_0x4b3f('0x15')](function(_0x279165){_0x234e3a(null,_0x279165);})[_0x4b3f('0x17')](function(_0x4affc5){_0x234e3a(_0x4affc5);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x68')]=function(_0x399653,_0xe290fb){scripts[_0x4b3f('0x68')](_0x399653[_0x4b3f('0x63')],_0x399653[_0x4b3f('0x69')]||'en',0x1)['then'](function(_0x4598ed){_0xe290fb(null,_0x4598ed);})['catch'](function(_0x1a72c2){_0xe290fb(_0x1a72c2);});};AGIVertices['prototype'][_0x4b3f('0x6a')]=function(_0x5f2920,_0x5a58cf){var _0x183b9e={'uri':_0x5f2920[_0x4b3f('0x6b')],'method':_0x5f2920[_0x4b3f('0x6c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5f2920[_0x4b3f('0x6d')])===_0x4b3f('0x6e')&&parseInt(_0x5f2920['timeout'])>=0x1?parseInt(_0x5f2920[_0x4b3f('0x6d')])*0x3e8:0x5*0x3e8};if(_[_0x4b3f('0x6f')](['POST',_0x4b3f('0x70')],_0x183b9e[_0x4b3f('0x6c')][_0x4b3f('0x71')]())){try{_0x183b9e[_0x4b3f('0x72')]=_0x5f2920['rawBody']?JSON['parse'](_0x5f2920[_0x4b3f('0xe')]):{};}catch(_0x2e36a0){logger[_0x4b3f('0x55')](_0x4b3f('0x73'),_0x2e36a0);}}try{_0x183b9e['headers']=_0x5f2920[_0x4b3f('0xd')]?JSON[_0x4b3f('0x74')](_0x5f2920[_0x4b3f('0xd')]):{};}catch(_0x4ffb44){logger[_0x4b3f('0x55')](_0x4b3f('0x75'),_0x4ffb44);}if(_0x5f2920[_0x4b3f('0x76')]){try{var _0x49eb90=require(_0x5f2920[_0x4b3f('0x76')])[_0x4b3f('0x77')](this,_0x183b9e);_0x183b9e[_0x4b3f('0x78')]=Mustache['render'](_0x5f2920[_0x4b3f('0x6b')],_0x49eb90,{},['$$','$$']);if(_0x183b9e[_0x4b3f('0x79')]){_0x183b9e[_0x4b3f('0x79')]=JSON[_0x4b3f('0x74')](Mustache[_0x4b3f('0x7a')](JSON[_0x4b3f('0x7b')](_0x183b9e[_0x4b3f('0x79')]),_0x49eb90,{},['$$','$$']));}if(_0x183b9e[_0x4b3f('0x72')]){_0x183b9e[_0x4b3f('0x72')]=JSON[_0x4b3f('0x74')](Mustache[_0x4b3f('0x7a')](JSON[_0x4b3f('0x7b')](_0x183b9e['body']),_0x49eb90,{},['$$','$$']));}}catch(_0x34be15){logger[_0x4b3f('0x55')](_0x4b3f('0x7c'),_0x34be15);}}rp(_0x183b9e)[_0x4b3f('0x15')](function(_0x16abe1){var _0x28639a={'statusCode':_0x16abe1[_0x4b3f('0x7d')]||0xc8,'statusMessage':_0x16abe1['statusMessage']||'OK','headers':_0x16abe1[_0x4b3f('0x79')]||{},'body':_0x16abe1['body']||{}};_0x5a58cf(null,_0x28639a);})[_0x4b3f('0x17')](function(_0xbe3d3f){var _0x23ca36={'statusCode':_0xbe3d3f[_0x4b3f('0x7d')]||0x1f4,'statusMessage':_0xbe3d3f[_0x4b3f('0x7e')]||_0x4b3f('0x7f'),'headers':_0xbe3d3f[_0x4b3f('0x80')][_0x4b3f('0x79')]||{},'body':_0xbe3d3f[_0x4b3f('0x80')][_0x4b3f('0x72')]||{}};_0x5a58cf(null,_0x23ca36);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x81')]=function(_0x120769,_0x538992){scripts[_0x4b3f('0x81')](this[_0x4b3f('0x39')]['uniqueid'],_0x120769['key'],_0x120769[_0x4b3f('0x63')],_0x120769[_0x4b3f('0x82')]||'en')['then'](function(_0x5b3c67){_0x538992(null,_0x5b3c67);})['catch'](function(_0x28b20f){_0x538992(_0x28b20f);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x83')]=function(_0x414c39,_0x29b228){scripts[_0x4b3f('0x83')](this['channel']['uniqueid'],_0x414c39[_0x4b3f('0x84')],_0x414c39[_0x4b3f('0x85')],_0x414c39['private_key'],_0x414c39['text'],_0x414c39[_0x4b3f('0x86')]||'en')[_0x4b3f('0x15')](function(_0x20b2ec){_0x29b228(null,_0x20b2ec);})[_0x4b3f('0x17')](function(_0x129018){_0x29b228(_0x129018);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x87')]=function(_0x5db302,_0x4cbe4a){scripts[_0x4b3f('0x87')](this[_0x4b3f('0x39')],_0x5db302)[_0x4b3f('0x15')](function(_0x2263ff){_0x4cbe4a(null,_0x2263ff);})[_0x4b3f('0x17')](function(_0x1981a0){_0x4cbe4a(_0x1981a0);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x88')]=function(_0x2df08a,_0x38d063){scripts[_0x4b3f('0x88')](_0x2df08a[_0x4b3f('0x89')],_0x2df08a[_0x4b3f('0x63')],_0x2df08a[_0x4b3f('0x8a')]||'en-US',_0x2df08a[_0x4b3f('0x8b')])[_0x4b3f('0x15')](function(_0x2d6e4e){_0x38d063(null,_0x2d6e4e);})[_0x4b3f('0x17')](function(_0x54dd55){_0x38d063(_0x54dd55);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x8c')]=function(_0x47a165,_0x71cabd,_0x347f80){scripts[_0x4b3f('0x8c')](_0x71cabd,_0x47a165[_0x4b3f('0x89')],_0x47a165[_0x4b3f('0x8d')]||_0x4b3f('0x65'),this[_0x4b3f('0x8e')](_0x47a165[_0x4b3f('0x8f')])?_0x47a165['model']:undefined)[_0x4b3f('0x15')](function(_0xeee7b4){_0x347f80(null,_0xeee7b4);})['catch'](function(_0x4479ef){_0x347f80(_0x4479ef);});};AGIVertices['prototype']['awsPolly']=function(_0x380634,_0x200784){scripts['awsPolly'](_0x380634['aws_access_key_id'],_0x380634['aws_secret_access_key'],_0x380634[_0x4b3f('0x90')],_0x380634[_0x4b3f('0x91')]||_0x4b3f('0x92'),_0x380634[_0x4b3f('0x63')],_0x380634[_0x4b3f('0x93')]||_0x4b3f('0x63'))[_0x4b3f('0x15')](function(_0x316a3c){_0x200784(null,_0x316a3c);})[_0x4b3f('0x17')](function(_0xe8aeed){_0x200784(_0xe8aeed);});};AGIVertices['prototype']['awsLex']=function(_0x2085e9,_0x5e3d8b){scripts['awsLex'](this[_0x4b3f('0x39')][_0x4b3f('0x3a')],_0x2085e9['aws_access_key_id'],_0x2085e9[_0x4b3f('0x94')],_0x2085e9[_0x4b3f('0x95')],_0x2085e9['text'],_0x2085e9[_0x4b3f('0x96')])[_0x4b3f('0x15')](function(_0x42cc31){_0x5e3d8b(null,_0x42cc31);})[_0x4b3f('0x17')](function(_0x440862){_0x5e3d8b(_0x440862);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x97')]=function(_0x6db5f4,_0x168541,_0x1de05e){scripts[_0x4b3f('0x97')](_0x168541,_0x6db5f4[_0x4b3f('0x89')],_0x6db5f4[_0x4b3f('0x98')]||_0x4b3f('0x65'))[_0x4b3f('0x15')](function(_0x5b529d){_0x1de05e(null,_0x5b529d);})['catch'](function(_0x3f832d){_0x1de05e(_0x3f832d);});};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x99')]=function(_0x259800,_0x4f69e7,_0x44ad1e){scripts['tildeASR'](_0x4f69e7,_0x259800['appid'],_0x259800[_0x4b3f('0x9a')],_0x259800[_0x4b3f('0x78')])['then'](function(_0x2e701e){_0x44ad1e(null,_0x2e701e);})[_0x4b3f('0x17')](function(_0x27eb7a){_0x44ad1e(_0x27eb7a);});};AGIVertices[_0x4b3f('0x18')]['clear']=function(_0x419261){var _0xb66a2=_[_0x4b3f('0x6f')](verticesWithRetry,_0x419261[_0x4b3f('0x3c')])?_0x419261:_['clone'](_0x419261);for(var _0x379cf4 in _0xb66a2){if(_0xb66a2[_0x4b3f('0x9b')](_0x379cf4)){if(_0xb66a2[_0x379cf4]&&_['isString'](_0xb66a2[_0x379cf4])){if(_[_0x4b3f('0x6f')](recursiveMapAttributes,_0x379cf4)){_0xb66a2[_0x379cf4]=this[_0x4b3f('0x9c')](_0xb66a2[_0x379cf4]);}else{_0xb66a2[_0x379cf4]=this[_0x4b3f('0x9d')](_0xb66a2[_0x379cf4]);}}}}return _0xb66a2;};AGIVertices['prototype'][_0x4b3f('0x9e')]=function(_0x3e06f5){for(var _0x10fcfa in _0x3e06f5){if(_0x3e06f5[_0x4b3f('0x9b')](_0x10fcfa)){if(_[_0x4b3f('0x9f')](_0x3e06f5[_0x10fcfa])){this['recursiveNodeIndex'](_0x3e06f5[_0x10fcfa]);}else if(_[_0x4b3f('0xa0')](_0x3e06f5[_0x10fcfa])){for(var _0x11fad0=0x0;_0x11fad0<_0x3e06f5[_0x10fcfa][_0x4b3f('0xa1')];_0x11fad0++){this[_0x4b3f('0x9e')](_0x3e06f5[_0x10fcfa][_0x11fad0]);}}else if(_[_0x4b3f('0xa2')](_0x3e06f5[_0x10fcfa])){_0x3e06f5[_0x10fcfa]=this[_0x4b3f('0x9d')](_0x3e06f5[_0x10fcfa]);}}}};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0xa3')]=function(_0x2d8aec,_0x139701){for(var _0xb23be3 in _0x2d8aec){if(_0x2d8aec[_0x4b3f('0x9b')](_0xb23be3)){if(_[_0x4b3f('0x9f')](_0x2d8aec[_0xb23be3])){if(!_[_0x4b3f('0x48')](_0x2d8aec[_0xb23be3])){this[_0x4b3f('0xa3')](_0x2d8aec[_0xb23be3],util['format'](_0x4b3f('0xa4'),_0x139701,_0xb23be3));}}else if(_[_0x4b3f('0xa0')](_0x2d8aec[_0xb23be3])){for(var _0x3da19d=0x0;_0x3da19d<_0x2d8aec[_0xb23be3][_0x4b3f('0xa1')];_0x3da19d++){this[_0x4b3f('0xa3')](_0x2d8aec[_0xb23be3][_0x3da19d],util[_0x4b3f('0x2c')](_0x4b3f('0xa4'),_0x139701,_0xb23be3+'['+_0x3da19d+']'));}}else{if(!_[_0x4b3f('0x57')](_0x2d8aec[_0xb23be3])){this[_0x4b3f('0x39')]['setVariable'](util['format'](_0x4b3f('0xa4'),_0x139701,_0xb23be3),_0x2d8aec[_0xb23be3]);}}}}};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x9c')]=function(_0x38d27f){try{var _0x3aeb30=JSON['parse'](_0x38d27f);this[_0x4b3f('0x9e')](_0x3aeb30);return JSON[_0x4b3f('0x7b')](_0x3aeb30);}catch(_0x173ee7){return this[_0x4b3f('0x9d')](_0x38d27f);}};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x9d')]=function(_0x5ba4ac){var _0x63782e=_0x5ba4ac[_0x4b3f('0xa5')]('{');for(var _0x1248be=0x1;_0x1248be<_0x63782e[_0x4b3f('0xa1')];_0x1248be+=0x1){var _0x2dc7ae=_0x63782e[_0x1248be][_0x4b3f('0xa5')]('}');if(_0x2dc7ae[_0x4b3f('0xa1')]>0x1){_0x5ba4ac=_0x5ba4ac['replaceAll']('{'+_0x2dc7ae[0x0]+'}',this['channel'][_0x4b3f('0xa6')](_0x2dc7ae[0x0])[_0x4b3f('0xa7')]||_0x2dc7ae[0x0]);}}if(_0x63782e[_0x4b3f('0xa1')]===0x1){return _0x5ba4ac[_0x4b3f('0x50')]();}return this['replaceAllVariables'](_0x5ba4ac);};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0xa8')]=function(_0xfc9c75,_0x1ef8d4){var _0x4089e8=this['channel'][_0x4b3f('0xa6')](_0xfc9c75);if(_0x4089e8[_0x4b3f('0xa9')]===-0x1){return _0x4089e8;}logger['info'](util[_0x4b3f('0x2c')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1ef8d4,_0x4089e8[_0x4b3f('0xa7')]));return this[_0x4b3f('0x39')][_0x4b3f('0xaa')](_0x1ef8d4,_0x4089e8[_0x4b3f('0xa7')]);};AGIVertices[_0x4b3f('0x18')]['isConfigured']=function(_0x46d39a){return _0x46d39a&&_0x46d39a!=='0'&&_0x46d39a!=='-1'&&_0x46d39a!=='';};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0xab')]=function(_0x3e703d){this[_0x4b3f('0x38')][_0x4b3f('0x77')](this,_0x3e703d,'-');_0x3e703d[_0x4b3f('0xac')]=_0x3e703d[_0x4b3f('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4b3f('0x18')]['mrcpsynth']=function(_0x2d3d08){logger['info'](util[_0x4b3f('0x2c')](_0x4b3f('0xad'),_0x2d3d08[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x2d3d08['text'])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0xaf'));}var _0x2381fe='\x22'+_0x2d3d08['text']+'\x22';if(this[_0x4b3f('0x8e')](_0x2d3d08[_0x4b3f('0x80')])){_0x2381fe+=','+_0x2d3d08[_0x4b3f('0x80')];}var _0x9a7f85=this[_0x4b3f('0x39')][_0x4b3f('0xb0')](_0x4b3f('0xb1'),_0x2381fe);if(_0x9a7f85['result']===-0x1){return _0x9a7f85;}return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0xb2'),_0x2381fe));};AGIVertices['prototype'][_0x4b3f('0xb3')]=function(_0x183081){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0xb4'),_0x183081[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x183081[_0x4b3f('0xb5')])){return this['channel'][_0x4b3f('0xae')](_0x4b3f('0xb6'));}var _0x18a79c=_0x183081[_0x4b3f('0xb5')];if(this['isConfigured'](_0x183081['options'])){_0x18a79c+=','+_0x183081['options'];}var _0x27f21e=this[_0x4b3f('0x39')]['exec'](_0x4b3f('0xb7'),_0x18a79c);if(_0x27f21e['result']===-0x1){return _0x27f21e;}var _0x244238=this[_0x4b3f('0xa8')]('RECOG_CONFIDENCE()',_0x4b3f('0xb8'));if(_0x244238[_0x4b3f('0xa9')]===-0x1){return _0x244238;}var _0x5e56eb=this[_0x4b3f('0xa8')](_0x4b3f('0xb9'),'MRCP_RECOG_TRANSCRIPT');if(_0x5e56eb[_0x4b3f('0xa9')]===-0x1){return _0x5e56eb;}var _0x581246=this['getAndSetVariable'](_0x4b3f('0xba'),_0x4b3f('0xbb'));if(_0x581246[_0x4b3f('0xa9')]===-0x1){return _0x581246;}return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x18a79c));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x9')]=function(_0x5b9185){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0xbc'),_0x5b9185[_0x4b3f('0x3b')]));return this[_0x4b3f('0x39')][_0x4b3f('0x9')]([_0x5b9185[_0x4b3f('0xbd')],_0x5b9185[_0x4b3f('0xbe')]]);};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0xbf')]=function(_0x31e1d8){logger[_0x4b3f('0x30')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x31e1d8[_0x4b3f('0x3b')]));if(this[_0x4b3f('0x8e')](_0x31e1d8['timeout'])){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x31e1d8[_0x4b3f('0x6d')]));var _0xf48032=this['channel'][_0x4b3f('0xc0')](_0x31e1d8[_0x4b3f('0x6d')]);if(_0xf48032[_0x4b3f('0xa9')]===-0x1){return _0xf48032;}}return this[_0x4b3f('0x39')][_0x4b3f('0xbf')]();};AGIVertices['prototype']['callback']=function(_0x33ed85){logger[_0x4b3f('0x30')](util['format'](_0x4b3f('0xc1'),_0x33ed85['label']));if(!this[_0x4b3f('0x8e')](_0x33ed85[_0x4b3f('0x4c')])){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x33ed85,_0x4b3f('0xc2'));}_0x33ed85[_0x4b3f('0x4d')]=moment();if(this[_0x4b3f('0x8e')](_0x33ed85[_0x4b3f('0xc3')])){_0x33ed85['scheduledAt']=moment()['add'](_0x33ed85['delay'],_0x4b3f('0xc4'));}if(!this[_0x4b3f('0x8e')](_0x33ed85[_0x4b3f('0x51')])){_0x33ed85[_0x4b3f('0x51')]=0x2;}this['createCmContact'][_0x4b3f('0x77')](this,_0x33ed85);return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0xc5'),_0x33ed85[_0x4b3f('0xc6')],_0x33ed85[_0x4b3f('0x4c')],_0x33ed85[_0x4b3f('0x4d')]));};AGIVertices['prototype'][_0x4b3f('0xc7')]=function(_0x27fecf){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0xc8'),_0x27fecf[_0x4b3f('0x3b')]));var _0x223c10=this[_0x4b3f('0x39')][_0x4b3f('0xb0')](_0x27fecf[_0x4b3f('0xc9')],_0x27fecf[_0x4b3f('0x80')]);if(_0x223c10[_0x4b3f('0xa9')]===-0x1){return _0x223c10;}return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0xca'),_0x27fecf['application'],_0x27fecf[_0x4b3f('0x80')]));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0xcb')]=function(_0x4c6750){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0xcc'),_0x4c6750[_0x4b3f('0x3b')]));if(!this['isConfigured'](_0x4c6750[_0x4b3f('0x63')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')]('no\x20text\x20configured');}var _0x2b374a='\x22'+_0x4c6750[_0x4b3f('0x63')]+'\x22';if(this[_0x4b3f('0x8e')](_0x4c6750[_0x4b3f('0x80')])){_0x2b374a+=','+_0x4c6750[_0x4b3f('0x80')];}var _0x38174f=this[_0x4b3f('0x39')][_0x4b3f('0xb0')](_0x4b3f('0xb1'),_0x2b374a);if(_0x38174f[_0x4b3f('0xa9')]===-0x1){return _0x38174f;}return this['channel'][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0xb2'),_0x2b374a));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0xcd')]=function(_0x4696e5){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x4696e5[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x4696e5[_0x4b3f('0x63')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0xaf'));}var _0xb8c457='\x22'+_0x4696e5[_0x4b3f('0x63')]+'\x22';if(this[_0x4b3f('0x8e')](_0x4696e5[_0x4b3f('0x80')])){_0xb8c457+=','+_0x4696e5['options'];}var _0x4406df=this[_0x4b3f('0x39')][_0x4b3f('0xb0')](_0x4b3f('0xb1'),_0xb8c457);if(_0x4406df[_0x4b3f('0xa9')]===-0x1){return _0x4406df;}return this['channel'][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0xb2'),_0xb8c457));};AGIVertices['prototype']['lumenvoxasr']=function(_0x1b18f8){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x1b18f8[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x1b18f8[_0x4b3f('0xb5')])){return this['channel'][_0x4b3f('0xae')](_0x4b3f('0xb6'));}var _0x21e2b6=_0x1b18f8[_0x4b3f('0xb5')];if(this['isConfigured'](_0x1b18f8[_0x4b3f('0x80')])){_0x21e2b6+=','+_0x1b18f8[_0x4b3f('0x80')];}var _0x4c100c=this[_0x4b3f('0x39')][_0x4b3f('0xb0')]('MRCPRecog',_0x21e2b6);if(_0x4c100c[_0x4b3f('0xa9')]===-0x1){return _0x4c100c;}var _0x2eb5ba=this['getAndSetVariable'](_0x4b3f('0xce'),_0x4b3f('0xcf'));if(_0x2eb5ba['result']===-0x1){return _0x2eb5ba;}var _0x74e25d=this[_0x4b3f('0xa8')]('RECOG_INPUT()',_0x4b3f('0xd0'));if(_0x74e25d[_0x4b3f('0xa9')]===-0x1){return _0x74e25d;}var _0x12f962=this[_0x4b3f('0xa8')]('RECOG_INSTANCE()',_0x4b3f('0xd1'));if(_0x12f962[_0x4b3f('0xa9')]===-0x1){return _0x12f962;}return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0xd2'),_0x21e2b6));};AGIVertices[_0x4b3f('0x18')]['sestekasr']=function(_0x1a5043){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1a5043[_0x4b3f('0x3b')]));if(!this['isConfigured'](_0x1a5043[_0x4b3f('0xb5')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')]('no\x20grammar\x20configured');}var _0x3d2c68=_0x1a5043[_0x4b3f('0xb5')];if(this[_0x4b3f('0x8e')](_0x1a5043[_0x4b3f('0x80')])){_0x3d2c68+=','+_0x1a5043[_0x4b3f('0x80')];}var _0x706793=this[_0x4b3f('0x39')][_0x4b3f('0xb0')](_0x4b3f('0xb7'),_0x3d2c68);if(_0x706793[_0x4b3f('0xa9')]===-0x1){return _0x706793;}var _0xf7aecc=this['getAndSetVariable'](_0x4b3f('0xce'),'SESTEK_ASR_CONFIDENCE');if(_0xf7aecc['result']===-0x1){return _0xf7aecc;}var _0xfa1d86=this[_0x4b3f('0xa8')](_0x4b3f('0xb9'),'SESTEK_ASR_TRANSCRIPT');if(_0xfa1d86[_0x4b3f('0xa9')]===-0x1){return _0xfa1d86;}var _0x1b630c=this[_0x4b3f('0xa8')](_0x4b3f('0xba'),_0x4b3f('0xd3'));if(_0x1b630c[_0x4b3f('0xa9')]===-0x1){return _0x1b630c;}return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util['format'](_0x4b3f('0xd2'),_0x3d2c68));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0xd4')]=function(_0x24e5ab){logger['info'](util[_0x4b3f('0x2c')](_0x4b3f('0xd5'),_0x24e5ab[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x24e5ab['odbc_id'])){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x24e5ab,_0x4b3f('0xd6'));}var _0x59412e=this['getSquareOdbc']['sync'](this,_0x24e5ab[_0x4b3f('0xd7')]);if(!_0x59412e){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x24e5ab,_0x4b3f('0xd8'));}if(!this[_0x4b3f('0x8e')](_0x24e5ab['query'])){return this['channel'][_0x4b3f('0x55')](_0x24e5ab,_0x4b3f('0xd9'));}var _0x5ed8b3=_0x24e5ab[_0x4b3f('0x32')][_0x4b3f('0x5f')](/(\r\n|\n|\r)/gm,'\x20');this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')]('query:\x20%s',_0x5ed8b3));var _0x2e32e8=this['getQueryOdbc'][_0x4b3f('0x77')](this,_0x59412e,_0x5ed8b3);this[_0x4b3f('0x38')][_0x4b3f('0x77')](this,_0x24e5ab,_0x5ed8b3);if(!this[_0x4b3f('0x8e')](_0x24e5ab[_0x4b3f('0xda')])){return this[_0x4b3f('0x39')]['noop'](_0x4b3f('0xdb'));}var _0x1e871f=this['getVariable'][_0x4b3f('0x77')](this,_0x24e5ab[_0x4b3f('0xda')]);if(!_0x1e871f){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x24e5ab,_0x4b3f('0xdc'));}var _0x5215b6=this;_0x2e32e8[_0x4b3f('0xdd')](function(_0x3bcede,_0x2957e4){Object[_0x4b3f('0xde')](_0x3bcede)[_0x4b3f('0xdd')](function(_0x5b9847){_0x5215b6[_0x4b3f('0x39')][_0x4b3f('0xaa')](util['format'](_0x4b3f('0xdf'),_0x1e871f,_0x2957e4,_0x5b9847),_0x3bcede[_0x5b9847]);});});this[_0x4b3f('0x39')][_0x4b3f('0xaa')](util[_0x4b3f('0x2c')](_0x4b3f('0xe0'),_0x1e871f),_0x2e32e8[_0x4b3f('0xa1')]);return this[_0x4b3f('0x39')]['noop'](util[_0x4b3f('0x2c')](_0x4b3f('0xe1'),_0x1e871f));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0xe2')]=function(_0x171abd){logger[_0x4b3f('0xe3')](util[_0x4b3f('0x2c')](_0x4b3f('0xe4'),_0x171abd[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x171abd[_0x4b3f('0xe5')])){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x171abd,_0x4b3f('0xe6'));}var _0x45ad6c=this[_0x4b3f('0x1f')][_0x4b3f('0x77')](this,_0x171abd[_0x4b3f('0xe5')]);if(!_0x45ad6c){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x171abd,_0x4b3f('0xe7'));}var _0x496d13=this[_0x4b3f('0x39')]['exec']('DIAL',[util[_0x4b3f('0x2c')](_0x4b3f('0xe8'),_0x45ad6c),_0x171abd[_0x4b3f('0x6d')],_0x171abd['opts'],_0x171abd[_0x4b3f('0x6b')]]);if(_0x496d13['result']===-0x1){return _0x496d13;}return this['channel'][_0x4b3f('0xae')](util[_0x4b3f('0x2c')]('Executed\x20command\x20%s',_0x4b3f('0xe9')));};AGIVertices['prototype'][_0x4b3f('0xea')]=function(_0x5b1119){logger['info'](util[_0x4b3f('0x2c')](_0x4b3f('0xeb'),_0x5b1119[_0x4b3f('0x3b')]));if(!this['isConfigured'](_0x5b1119[_0x4b3f('0x89')])){return this[_0x4b3f('0x39')]['noop'](_0x4b3f('0xec'));}if(!this[_0x4b3f('0x8e')](_0x5b1119[_0x4b3f('0x63')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0xaf'));}this[_0x4b3f('0x39')]['bot']=!![];this['createSquareDetailsReport'](_0x5b1119);this['createSquareMessage'](_0x5b1119['text'],'in','','');this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0xed'),_0x5b1119[_0x4b3f('0x63')]));var _0xa4aa35=this['googleDialogflow'][_0x4b3f('0x77')](this,_0x5b1119);if(_0xa4aa35){for(var _0x25e20b in _0xa4aa35){if(_0xa4aa35[_0x4b3f('0x9b')](_0x25e20b)){this['channel'][_0x4b3f('0xaa')](util['format'](_0x4b3f('0xee'),_0x25e20b[_0x4b3f('0x71')]()),_0xa4aa35[_0x25e20b]);}}this[_0x4b3f('0x46')](_0xa4aa35[_0x4b3f('0xef')],_0x4b3f('0xf0'),_0x4b3f('0xea'),'');return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')]('Dialogflow\x20Result\x20%s',_0xa4aa35['speech']));}return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x5b1119,_0x4b3f('0xf1'));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0xf2')]=function(_0xfec5bc){logger[_0x4b3f('0x30')](util['format']('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0xfec5bc[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0xfec5bc['dialogflowV2_project_id'])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0xf3'));}if(!this[_0x4b3f('0x8e')](_0xfec5bc[_0x4b3f('0x85')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0xf4'));}if(!this[_0x4b3f('0x8e')](_0xfec5bc[_0x4b3f('0xf5')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')]('no\x20private_key\x20configured');}if(!this[_0x4b3f('0x8e')](_0xfec5bc[_0x4b3f('0x86')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0xf6'));}if(!this[_0x4b3f('0x8e')](_0xfec5bc['text'])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0xaf'));}this['channel'][_0x4b3f('0xf7')]=!![];this[_0x4b3f('0x38')](_0xfec5bc);this[_0x4b3f('0x46')](_0xfec5bc['text'],'in','','');this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')]('Trying\x20DialogflowV2:\x20%s',_0xfec5bc[_0x4b3f('0x63')]));var _0x4eada3=this[_0x4b3f('0x83')]['sync'](this,_0xfec5bc);if(_0x4eada3){for(var _0x56960c in _0x4eada3){if(_0x4eada3['hasOwnProperty'](_0x56960c)){if(_0x56960c!==_0x4b3f('0xf8')){this[_0x4b3f('0x39')][_0x4b3f('0xaa')](util['format'](_0x4b3f('0xee'),_0x56960c[_0x4b3f('0x71')]()),_0x4eada3[_0x56960c]);}}}this[_0x4b3f('0x46')](_0x4eada3[_0x4b3f('0xef')],_0x4b3f('0xf0'),_0x4b3f('0xf2'),_0x4eada3[_0x4b3f('0xf8')]);return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')]('DialogflowV2\x20Result\x20%s',_0x4eada3[_0x4b3f('0xef')]));}return this['channel'][_0x4b3f('0x55')](_0xfec5bc,_0x4b3f('0xf9'));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0xfa')]=function(_0x3754f2){logger['info'](util[_0x4b3f('0x2c')](_0x4b3f('0xfb'),_0x3754f2[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x3754f2[_0x4b3f('0xfc')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x4b3f('0x8e')](_0x3754f2['username'])){return this[_0x4b3f('0x39')]['noop'](_0x4b3f('0xfd'));}if(!this[_0x4b3f('0x8e')](_0x3754f2['password'])){return this[_0x4b3f('0x39')]['noop'](_0x4b3f('0xfe'));}if(!this['isConfigured'](_0x3754f2[_0x4b3f('0xff')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')]('no\x20text\x20configured');}this[_0x4b3f('0x39')][_0x4b3f('0xf7')]=!![];this['createSquareDetailsReport'](_0x3754f2);this['createSquareMessage'](_0x3754f2[_0x4b3f('0x63')],'in','','');this['channel']['noop'](util['format'](_0x4b3f('0x100'),_0x3754f2[_0x4b3f('0x63')]));var _0x3b6a9d=this[_0x4b3f('0x87')][_0x4b3f('0x77')](this,_0x3754f2);if(_0x3b6a9d){for(var _0xdcf6c5 in _0x3b6a9d){if(_0x3b6a9d[_0x4b3f('0x9b')](_0xdcf6c5)){this[_0x4b3f('0x39')][_0x4b3f('0xaa')](util[_0x4b3f('0x2c')]('SESTEK_NDA_%s',_0xdcf6c5[_0x4b3f('0x71')]()),_0x3b6a9d[_0xdcf6c5]);}}this[_0x4b3f('0x46')](_0x3b6a9d['speech'],_0x4b3f('0xf0'),_0x4b3f('0xfa'),'');if(_0x3b6a9d[_0x4b3f('0x101')]){this['channel']['noop'](util['format'](_0x4b3f('0x102'),_0x3b6a9d[_0x4b3f('0x101')]));var _0x2d47c7=this['channel'][_0x4b3f('0x103')](_0x3b6a9d[_0x4b3f('0x101')]);try{fs[_0x4b3f('0x104')](_0x3b6a9d[_0x4b3f('0x101')]+_0x4b3f('0x105'));}catch(_0x14b141){logger[_0x4b3f('0x55')](_0x14b141);}return _0x2d47c7;}else{return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x106'),_0x3b6a9d[_0x4b3f('0xef')]));}}return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x3754f2,_0x4b3f('0x107'));};AGIVertices[_0x4b3f('0x18')]['end']=function(_0x5712ab){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x108'),_0x5712ab[_0x4b3f('0x3b')]));return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0x109'));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x10a')]=function(_0x249d8c){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x10b'),_0x249d8c[_0x4b3f('0x3b')]));var _0x1b1f45='';if(_0x249d8c[_0x4b3f('0x10c')]){if(!this[_0x4b3f('0x8e')](_0x249d8c['trunk_id'])){return this[_0x4b3f('0x39')]['error'](_0x249d8c,'no\x20trunk\x20selected');}else{var _0x428355=parseInt(_0x249d8c[_0x4b3f('0x10c')],0xa);if(isNaN(_0x428355)){_0x1b1f45=_0x249d8c[_0x4b3f('0x10c')];}else{_0x1b1f45=this[_0x4b3f('0x21')]['sync'](this,_0x249d8c[_0x4b3f('0x10c')]);if(!_0x1b1f45){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x249d8c,_0x4b3f('0x10d'));}}}}else if(_0x249d8c[_0x4b3f('0x10e')]){_0x1b1f45=_0x249d8c['trunk_name'];}else{return this['channel'][_0x4b3f('0x55')](_0x249d8c,_0x4b3f('0x10f'));}var _0x48c561=this['channel']['exec'](_0x4b3f('0xe9'),[util[_0x4b3f('0x2c')](_0x4b3f('0x110'),_0x1b1f45,_0x249d8c[_0x4b3f('0xc6')]),_0x249d8c[_0x4b3f('0x6d')],_0x249d8c[_0x4b3f('0x111')],_0x249d8c[_0x4b3f('0x6b')]]);if(_0x48c561[_0x4b3f('0xa9')]===-0x1){return _0x48c561;}return this['channel']['noop'](util[_0x4b3f('0x2c')](_0x4b3f('0x112'),'DIAL'));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x113')]=function(_0x5bc297){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x114'),_0x5bc297[_0x4b3f('0x3b')]));return this['channel'][_0x4b3f('0xae')](_0x4b3f('0x113'));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x10')]=function(_0x5b939c){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x115'),_0x5b939c[_0x4b3f('0x3b')]));if(_0x5b939c['retry']===0x0){return this[_0x4b3f('0xab')](_0x5b939c);}_0x5b939c[_0x4b3f('0xac')]-=0x1;if(!this[_0x4b3f('0x8e')](_0x5b939c[_0x4b3f('0x116')])){return this['channel']['error'](_0x5b939c,'no\x20file\x20audio\x20selected');}var _0x156db1=this[_0x4b3f('0x23')]['sync'](this,_0x5b939c[_0x4b3f('0x116')]);if(!_0x156db1){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x5b939c,_0x4b3f('0x117'));}if(!this[_0x4b3f('0x8e')](_0x5b939c[_0x4b3f('0xda')])){return this['channel']['error'](_0x4b3f('0xdb'));}var _0x58037d=this[_0x4b3f('0x39')][_0x4b3f('0x118')](_0x156db1,_0x5b939c[_0x4b3f('0x119')],_0x5b939c[_0x4b3f('0x11a')]);var _0x584734=_0x58037d['result']?_0x58037d[_0x4b3f('0xa9')][_0x4b3f('0x50')]():'';logger[_0x4b3f('0x30')](_0x4b3f('0x11b'),JSON['stringify'](_0x58037d));if(_0x58037d[_0x4b3f('0xa9')]===-0x1){this['createSquareDetailsReport'][_0x4b3f('0x77')](this,_0x5b939c,_0x584734);return _0x58037d;}else if(_0x58037d[_0x4b3f('0xa7')]===_0x4b3f('0x6d')){_0x58037d[_0x4b3f('0xa9')]=_0x584734[_0x4b3f('0xa1')]>=parseInt(_0x5b939c[_0x4b3f('0x11c')])?'x':'i';}else{_0x58037d[_0x4b3f('0xa9')]=_0x584734[_0x4b3f('0xa1')]>=parseInt(_0x5b939c['mindigit'])&&_0x584734[_0x4b3f('0xa1')]<=parseInt(_0x5b939c[_0x4b3f('0x11a')])?'x':'i';}var _0x2e4940=this['getVariable'][_0x4b3f('0x77')](this,_0x5b939c[_0x4b3f('0xda')]);if(!_0x2e4940){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x5b939c,_0x4b3f('0xdc'));}this['channel'][_0x4b3f('0xaa')](_0x2e4940,_0x584734);if(this['isConfigured'](_0x5b939c[_0x4b3f('0x11d')])){var _0x2d3e0a=parseInt(_0x5b939c[_0x4b3f('0x11d')],0xa);var _0x19071d=rs[_0x4b3f('0x11e')]({'charset':'*','length':_0x2d3e0a});var _0x4527af=_0x584734[_0x4b3f('0xa1')];if(_0x4527af>0x0){if(_0x4527af>_0x2d3e0a){this[_0x4b3f('0x38')][_0x4b3f('0x77')](this,_0x5b939c,_0x5b939c[_0x4b3f('0x11f')]===_0x4b3f('0x120')?_0x19071d+_0x584734[_0x4b3f('0x121')](_0x2d3e0a):_0x584734['substr'](0x0,_0x4527af-_0x2d3e0a)+_0x19071d);}else{this['createSquareDetailsReport'][_0x4b3f('0x77')](this,_0x5b939c,rs[_0x4b3f('0x11e')]({'charset':'*','length':_0x4527af}));}}else{this['createSquareDetailsReport'][_0x4b3f('0x77')](this,_0x5b939c,'');}}else{this[_0x4b3f('0x38')][_0x4b3f('0x77')](this,_0x5b939c,_0x584734);}return _0x58037d;};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x11')]=function(_0x5567cf){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x122'),_0x5567cf['label']));return this[_0x4b3f('0x10')](_0x5567cf);};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x123')]=function(_0x16146a){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x124'),_0x16146a['label']));this[_0x4b3f('0x38')]['sync'](this,_0x16146a,_0x16146a[_0x4b3f('0x125')]);return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x126'),_0x16146a[_0x4b3f('0x125')]));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x127')]=function(_0xaff5bb){logger[_0x4b3f('0x30')](util['format'](_0x4b3f('0x128'),_0xaff5bb[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0xaff5bb['aws_access_key_id'])||!this[_0x4b3f('0x8e')](_0xaff5bb['aws_secret_access_key'])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0x129'));}if(!this[_0x4b3f('0x8e')](_0xaff5bb['text'])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x12a'),_0xaff5bb[_0x4b3f('0x63')]));var _0x583a97=this[_0x4b3f('0x12b')]['sync'](this,_0xaff5bb);if(_0x583a97){this['channel'][_0x4b3f('0xae')](util[_0x4b3f('0x2c')]('aws\x20Polly\x20%s\x20file\x20created',_0x583a97));var _0x44c1ee=this[_0x4b3f('0x39')][_0x4b3f('0x103')](_0x583a97);try{fs['unlink'](_0x583a97+_0x4b3f('0x105'));}catch(_0x17cfec){logger[_0x4b3f('0x55')](_0x17cfec);}return _0x44c1ee;}return this[_0x4b3f('0x39')]['error'](_0xaff5bb,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x12c')]=function(_0x1d0706){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x12d'),_0x1d0706['label']));if(!this[_0x4b3f('0x8e')](_0x1d0706['aws_access_key_id'])||!this[_0x4b3f('0x8e')](_0x1d0706['aws_secret_access_key'])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0x129'));}if(!this['isConfigured'](_0x1d0706[_0x4b3f('0x96')])){return this['channel'][_0x4b3f('0xae')](_0x4b3f('0x12e'));}if(!this['isConfigured'](_0x1d0706[_0x4b3f('0x63')])){return this['channel'][_0x4b3f('0xae')](_0x4b3f('0xaf'));}this[_0x4b3f('0x39')][_0x4b3f('0xf7')]=!![];this[_0x4b3f('0x38')](_0x1d0706);this['createSquareMessage'](_0x1d0706['text'],'in','','');this['channel']['noop'](util['format'](_0x4b3f('0x12f'),_0x1d0706[_0x4b3f('0x63')]));var _0x1ee21a=this[_0x4b3f('0x130')][_0x4b3f('0x77')](this,_0x1d0706);if(_0x1ee21a){for(var _0x559a6a in _0x1ee21a){if(_0x1ee21a[_0x4b3f('0x9b')](_0x559a6a)&&_[_0x4b3f('0xa2')](_0x1ee21a[_0x559a6a])){this[_0x4b3f('0x39')][_0x4b3f('0xaa')](util[_0x4b3f('0x2c')](_0x4b3f('0x131'),_0x559a6a['toUpperCase']()),_0x1ee21a[_0x559a6a]);}}if(_[_0x4b3f('0x57')](_0x1ee21a[_0x4b3f('0x7e')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x4b3f('0x46')](_0x1ee21a[_0x4b3f('0x7e')],_0x4b3f('0xf0'),_0x4b3f('0x132'),'');return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x133'),_0x1ee21a[_0x4b3f('0x7e')]));}}return this['channel'][_0x4b3f('0x55')](_0x1d0706,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x134')]=function(_0x449ed8){logger['info'](util[_0x4b3f('0x2c')](_0x4b3f('0x135'),_0x449ed8[_0x4b3f('0x3b')],_0x449ed8['timeout']));if(!this['isConfigured'](_0x449ed8[_0x4b3f('0x89')])){return this[_0x4b3f('0x39')]['noop'](_0x4b3f('0xec'));}var _0x292915=_0x4b3f('0x136');var _0x4871e0=util[_0x4b3f('0x2c')](_0x4b3f('0x137'),FILES_PATH,rs[_0x4b3f('0x11e')](0x4));var _0x2a7091=util['format']('%s.%s',_0x4871e0,_0x292915);var _0x8ab9a7=!![];if(_0x449ed8[_0x4b3f('0x138')]===_0x4b3f('0x139')){_0x8ab9a7=![];}var _0x50cd01=this[_0x4b3f('0x39')][_0x4b3f('0x13a')](_0x4871e0,_0x292915,_0x449ed8['intKey'],_0x449ed8[_0x4b3f('0x6d')],undefined,_0x8ab9a7);if(_0x50cd01[_0x4b3f('0xa9')]!==-0x1){this['channel'][_0x4b3f('0xae')](util[_0x4b3f('0x2c')]('google\x20%s\x20file\x20created',_0x2a7091));var _0xa616e5=this['googleASR']['sync'](this,_0x449ed8,_0x2a7091);if(_0xa616e5){for(var _0x51919f in _0xa616e5){if(_0xa616e5[_0x4b3f('0x9b')](_0x51919f)){this[_0x4b3f('0x39')][_0x4b3f('0xaa')](util[_0x4b3f('0x2c')]('GOOGLE_ASR_%s',_0x51919f[_0x4b3f('0x71')]()),_0xa616e5[_0x51919f]);}}return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util['format'](_0x4b3f('0x13b'),JSON[_0x4b3f('0x7b')](_0xa616e5)));}}return _0x50cd01;};AGIVertices['prototype']['tildeasr']=function(_0x45d8a8){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x13c'),_0x45d8a8[_0x4b3f('0x3b')]));if(!this['isConfigured'](_0x45d8a8[_0x4b3f('0x13d')])){return this[_0x4b3f('0x39')]['noop']('no\x20appid\x20configured');}if(!this[_0x4b3f('0x8e')](_0x45d8a8['appsecret'])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0x13e'));}var _0x4f0eb1=_0x4b3f('0x136');var _0x5ed622=util['format'](_0x4b3f('0x137'),FILES_PATH,rs['generate'](0x4));var _0x545532=util[_0x4b3f('0x2c')](_0x4b3f('0xa4'),_0x5ed622,_0x4f0eb1);var _0x1e7a74=!![];if(_0x45d8a8['beep']===_0x4b3f('0x139')){_0x1e7a74=![];}var _0x51dd1c=this[_0x4b3f('0x39')][_0x4b3f('0x13a')](_0x5ed622,_0x4f0eb1,_0x45d8a8['intKey'],_0x45d8a8[_0x4b3f('0x6d')],undefined,_0x1e7a74);if(_0x51dd1c[_0x4b3f('0xa9')]!==-0x1){this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')]('tilde\x20%s\x20file\x20created',_0x545532));var _0x26d5c0=this[_0x4b3f('0x99')][_0x4b3f('0x77')](this,_0x45d8a8,_0x545532);if(_0x26d5c0){for(var _0x6cba68 in _0x26d5c0){if(_0x26d5c0[_0x4b3f('0x9b')](_0x6cba68)){this[_0x4b3f('0x39')][_0x4b3f('0xaa')](util[_0x4b3f('0x2c')](_0x4b3f('0x13f'),_0x6cba68[_0x4b3f('0x71')]()),_0x26d5c0[_0x6cba68]);}}return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util['format'](_0x4b3f('0x140'),JSON['stringify'](_0x26d5c0)));}}return _0x51dd1c;};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x141')]=function(_0x4b613d){logger['info'](util[_0x4b3f('0x2c')](_0x4b3f('0x142'),_0x4b613d[_0x4b3f('0x3b')]));return this[_0x4b3f('0x39')]['continueAt'](_0x4b613d[_0x4b3f('0x143')],_0x4b613d[_0x4b3f('0x41')],_0x4b613d[_0x4b3f('0x42')]);};AGIVertices[_0x4b3f('0x18')]['gotoif']=function(_0x2b3000){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x144'),_0x2b3000[_0x4b3f('0x3b')]));if(!this['isConfigured'](_0x2b3000[_0x4b3f('0x145')])){return this[_0x4b3f('0x39')]['error'](_0x2b3000,_0x4b3f('0x146'));}try{var _0x1bca7a=eval(_0x2b3000[_0x4b3f('0x145')])?'true':_0x4b3f('0x147');this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')]('EVAL\x20CONDITION\x20%s\x20%s',_0x2b3000[_0x4b3f('0x145')],_0x1bca7a));return{'code':0xc8,'result':_0x1bca7a};}catch(_0x5218d7){return{'code':0xc8,'result':_0x4b3f('0x147')};}};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x148')]=function(_0x2cb06f){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x2cb06f[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x2cb06f[_0x4b3f('0x149')])){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x2cb06f,'no\x20interval\x20configured');}var _0x4d2ed8=this[_0x4b3f('0x28')][_0x4b3f('0x77')](this,_0x2cb06f['interval_id']);if(!_0x4d2ed8){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x2cb06f,_0x4b3f('0x14a'));}for(var _0x22aaea=0x0;_0x22aaea<_0x4d2ed8['length'];_0x22aaea+=0x1){var _0x430079=this[_0x4b3f('0x39')][_0x4b3f('0xa6')](util['format'](_0x4b3f('0x14b'),_0x4d2ed8[_0x22aaea]));if(_0x430079[_0x4b3f('0xa9')]===-0x1){return _0x430079;}logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x14c'),_0x4d2ed8[_0x22aaea],_0x430079[_0x4b3f('0xa7')]));if(_0x430079[_0x4b3f('0xa7')]===_0x4b3f('0x14d')){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x14c'),_0x4d2ed8[_0x22aaea],_0x4b3f('0x14d')));this[_0x4b3f('0x39')]['noop'](util[_0x4b3f('0x2c')](_0x4b3f('0x14c'),_0x4d2ed8[_0x22aaea],_0x4b3f('0x14d')));return{'code':0xc8,'result':_0x4b3f('0x14d')};}else{logger[_0x4b3f('0x30')](util['format'](_0x4b3f('0x14c'),_0x4d2ed8[_0x22aaea],_0x4b3f('0x147')));this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x14c'),_0x4d2ed8[_0x22aaea],_0x4b3f('0x147')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x14e')]=function(_0x787da){logger[_0x4b3f('0x30')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x787da[_0x4b3f('0x3b')]));return this[_0x4b3f('0x39')][_0x4b3f('0x14e')]();};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x14f')]=function(_0x41c872){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x150'),_0x41c872[_0x4b3f('0x3b')]));if(!this['isConfigured'](_0x41c872['key'])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0xec'));}var _0x29c247=_0x4b3f('0x136');var _0x516f2f=util[_0x4b3f('0x2c')]('%s/recordings/%s',FILES_PATH,rs[_0x4b3f('0x11e')](0x4));var _0x2e06e5=util[_0x4b3f('0x2c')](_0x4b3f('0xa4'),_0x516f2f,_0x29c247);var _0x186470=!![];if(_0x41c872['beep']===_0x4b3f('0x139')){_0x186470=![];}var _0x1b902d=this[_0x4b3f('0x39')][_0x4b3f('0x13a')](_0x516f2f,_0x29c247,_0x41c872[_0x4b3f('0x151')],_0x41c872[_0x4b3f('0x6d')],undefined,_0x186470);if(_0x1b902d[_0x4b3f('0xa9')]!==-0x1){this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x152'),_0x2e06e5));var _0x6b2ceb=this[_0x4b3f('0x8c')]['sync'](this,_0x41c872,_0x2e06e5);if(_0x6b2ceb){for(var _0xb17e54 in _0x6b2ceb){if(_0x6b2ceb[_0x4b3f('0x9b')](_0xb17e54)){this[_0x4b3f('0x39')][_0x4b3f('0xaa')](util['format'](_0x4b3f('0x153'),_0xb17e54[_0x4b3f('0x71')]()),_0x6b2ceb[_0xb17e54]);}}return this['channel'][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x154'),JSON[_0x4b3f('0x7b')](_0x6b2ceb)));}}return _0x1b902d;};AGIVertices[_0x4b3f('0x18')]['ispeechtts']=function(_0x50e379){logger['info'](util[_0x4b3f('0x2c')](_0x4b3f('0x155'),_0x50e379[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x50e379[_0x4b3f('0x89')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x50e379[_0x4b3f('0x63')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0xaf'));}this[_0x4b3f('0x39')]['noop'](util['format'](_0x4b3f('0x156'),_0x50e379[_0x4b3f('0x63')]));var _0x523768=this[_0x4b3f('0x88')]['sync'](this,_0x50e379);if(_0x523768){this['channel'][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x152'),_0x523768));var _0x42ff77=this[_0x4b3f('0x39')][_0x4b3f('0x103')](_0x523768,_0x50e379[_0x4b3f('0x151')]);try{fs[_0x4b3f('0x104')](_0x523768+'.wav');}catch(_0x3d6c93){logger['error'](_0x3d6c93);}return _0x42ff77;}return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x50e379,_0x4b3f('0x157'));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x158')]=function(_0x1e0484){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1e0484[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x1e0484['findBy'])){return this['channel'][_0x4b3f('0x55')](_0x1e0484,_0x4b3f('0x159'));}logger['info'](util[_0x4b3f('0x2c')](_0x4b3f('0x15a'),this['channel'][_0x4b3f('0x3e')],_0x1e0484['findBy']));var _0x15fff2=this[_0x4b3f('0x5a')][_0x4b3f('0x77')](this,_0x1e0484[_0x4b3f('0x15b')]);if(_0x15fff2){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x15c'),this[_0x4b3f('0x39')][_0x4b3f('0x3e')],_0x1e0484['findBy']));this['channel']['noop'](util['format'](_0x4b3f('0x15c'),this[_0x4b3f('0x39')][_0x4b3f('0x3e')],_0x1e0484[_0x4b3f('0x15b')]));return{'code':0xc8,'result':_0x4b3f('0x15d')};}else{logger[_0x4b3f('0x30')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4b3f('0x39')][_0x4b3f('0x3e')],_0x1e0484[_0x4b3f('0x15b')]));this[_0x4b3f('0x39')][_0x4b3f('0xae')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x4b3f('0x3e')],_0x1e0484[_0x4b3f('0x15b')]));return{'code':0xc8,'result':_0x4b3f('0x15e')};}};AGIVertices['prototype'][_0x4b3f('0x15f')]=function(_0x55179d){logger['info'](util['format'](_0x4b3f('0x160'),_0x55179d[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x55179d[_0x4b3f('0x15b')])){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x55179d,_0x4b3f('0x159'));}logger['info'](util['format'](_0x4b3f('0x15a'),this[_0x4b3f('0x39')][_0x4b3f('0x3e')],_0x55179d[_0x4b3f('0x15b')]));var _0x4b6c95=this[_0x4b3f('0x58')][_0x4b3f('0x77')](this,_0x55179d[_0x4b3f('0x15b')]);if(_0x4b6c95){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x15c'),this[_0x4b3f('0x39')]['callerid'],_0x55179d[_0x4b3f('0x15b')]));this['channel'][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x15c'),this['channel'][_0x4b3f('0x3e')],_0x55179d[_0x4b3f('0x15b')]));return{'code':0xc8,'result':_0x4b3f('0x15d')};}else{logger[_0x4b3f('0x30')](util['format'](_0x4b3f('0x161'),this[_0x4b3f('0x39')]['callerid'],_0x55179d[_0x4b3f('0x15b')]));this[_0x4b3f('0x39')]['noop'](util[_0x4b3f('0x2c')](_0x4b3f('0x161'),this[_0x4b3f('0x39')][_0x4b3f('0x3e')],_0x55179d['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x162')]=function(_0x57407c){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x57407c[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x57407c[_0x4b3f('0x163')])){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x57407c,_0x4b3f('0x164'));}this['channel'][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x165'),_0x57407c[_0x4b3f('0x163')]));var _0xa76944=eval(_0x57407c[_0x4b3f('0x163')]);if(!this[_0x4b3f('0x8e')](_0x57407c[_0x4b3f('0xda')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0xdb'));}var _0x28adc8=this[_0x4b3f('0xa6')][_0x4b3f('0x77')](this,_0x57407c[_0x4b3f('0xda')]);if(!_0x28adc8){return this['channel'][_0x4b3f('0x55')](_0x57407c,_0x4b3f('0xdc'));}if(_['isArray'](_0xa76944)){var _0x35e97b=this;_0xa76944[_0x4b3f('0xdd')](function(_0x1bf1c9,_0x28ec37){_0x35e97b[_0x4b3f('0x39')]['setVariable'](util[_0x4b3f('0x2c')](_0x4b3f('0x166'),_0x28adc8,_0x28ec37),_0x1bf1c9);});return this['channel'][_0x4b3f('0xae')](util['format'](_0x4b3f('0x167'),_0x28adc8));}else{return this[_0x4b3f('0x39')][_0x4b3f('0xaa')](_0x28adc8,_0xa76944);}};AGIVertices[_0x4b3f('0x18')]['menu']=function(_0x2b2017){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x168'),_0x2b2017[_0x4b3f('0x3b')]));if(_0x2b2017[_0x4b3f('0xac')]===0x0){return this[_0x4b3f('0xab')](_0x2b2017);}_0x2b2017[_0x4b3f('0xac')]-=0x1;if(!this[_0x4b3f('0x8e')](_0x2b2017[_0x4b3f('0x116')])){return this['channel']['error'](_0x2b2017,'no\x20file\x20audio\x20selected');}var _0x3dcdfd=this[_0x4b3f('0x23')][_0x4b3f('0x77')](this,_0x2b2017[_0x4b3f('0x116')]);if(!_0x3dcdfd){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x2b2017,_0x4b3f('0x117'));}var _0xa7ab9c=this[_0x4b3f('0x39')][_0x4b3f('0x118')](_0x3dcdfd,_0x2b2017['response'],_0x2b2017[_0x4b3f('0x169')]);var _0x52042e=_0xa7ab9c[_0x4b3f('0xa9')];if(_0xa7ab9c[_0x4b3f('0xa9')]===-0x1){this[_0x4b3f('0x38')][_0x4b3f('0x77')](this,_0x2b2017,'-1');return _0xa7ab9c;}else if(_0xa7ab9c[_0x4b3f('0xa7')]===_0x4b3f('0x6d')){_0xa7ab9c[_0x4b3f('0xa9')]=_0xa7ab9c[_0x4b3f('0xa9')][_0x4b3f('0xa1')]>0x0?_0xa7ab9c[_0x4b3f('0xa9')]:'t';}else if(_[_0x4b3f('0x48')](_0xa7ab9c['result'])){_0xa7ab9c[_0x4b3f('0xa9')]='#';_0x52042e='#';}if(!this[_0x4b3f('0x8e')](_0x2b2017['variable_id'])){this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0xdb'));}else{var _0x236b8a=this['getVariable'][_0x4b3f('0x77')](this,_0x2b2017[_0x4b3f('0xda')]);if(!_0x236b8a){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x2b2017,_0x4b3f('0xdc'));}this[_0x4b3f('0x39')][_0x4b3f('0xaa')](_0x236b8a,_0x52042e);}this[_0x4b3f('0x38')][_0x4b3f('0x77')](this,_0x2b2017,_0x52042e);return _0xa7ab9c;};AGIVertices[_0x4b3f('0x18')]['noop']=function(_0x88205f){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x16a'),_0x88205f[_0x4b3f('0x3b')]));return this['channel'][_0x4b3f('0xae')](_0x88205f['output']||_0x88205f['label']);};AGIVertices['prototype']['pause']=function(_0x47cb3c){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x47cb3c[_0x4b3f('0x3b')]));if(!this['isConfigured'](_0x47cb3c[_0x4b3f('0x15b')])){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x47cb3c,_0x4b3f('0x159'));}logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x15a'),this['channel']['callerid'],_0x47cb3c[_0x4b3f('0x15b')]));var _0x61c7e8=this[_0x4b3f('0x52')][_0x4b3f('0x77')](this,_0x47cb3c[_0x4b3f('0x16b')]);var _0x243372=this[_0x4b3f('0x54')][_0x4b3f('0x77')](this,_0x47cb3c['findBy'],_0x61c7e8);if(_0x243372){logger['info'](util[_0x4b3f('0x2c')](_0x4b3f('0x15c'),this[_0x4b3f('0x39')][_0x4b3f('0x3e')],_0x47cb3c[_0x4b3f('0x15b')]));this['channel'][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x15c'),this[_0x4b3f('0x39')][_0x4b3f('0x3e')],_0x47cb3c[_0x4b3f('0x15b')]));return{'code':0xc8,'result':_0x4b3f('0x15d')};}else{logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4b3f('0x39')][_0x4b3f('0x3e')],_0x47cb3c[_0x4b3f('0x15b')]));this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x15c'),this[_0x4b3f('0x39')][_0x4b3f('0x3e')],_0x47cb3c[_0x4b3f('0x15b')]));return{'code':0xc8,'result':_0x4b3f('0x15e')};}};AGIVertices[_0x4b3f('0x18')]['playback']=function(_0x4599b2){logger[_0x4b3f('0x30')](util['format'](_0x4b3f('0x16c'),_0x4599b2[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x4599b2[_0x4b3f('0x116')])){return this[_0x4b3f('0x39')]['error'](_0x4599b2,_0x4b3f('0x16d'));}var _0x4486b9=this['getSound']['sync'](this,_0x4599b2[_0x4b3f('0x116')]);if(!_0x4486b9){return this['channel'][_0x4b3f('0x55')](_0x4599b2,_0x4b3f('0x117'));}var _0x7de7d2=this[_0x4b3f('0x39')]['exec'](_0x4b3f('0x16e'),[_0x4486b9,_0x4599b2[_0x4b3f('0x111')]]);if(_0x7de7d2[_0x4b3f('0xa9')]===-0x1){return _0x7de7d2;}return this['channel']['noop'](util[_0x4b3f('0x2c')](_0x4b3f('0xca'),_0x4b3f('0x16e'),_0x4486b9));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x16f')]=function(_0x175b8a){logger[_0x4b3f('0x30')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x175b8a[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x175b8a[_0x4b3f('0x170')])){return this['channel'][_0x4b3f('0x55')](_0x175b8a,_0x4b3f('0x171'));}var _0x18e78e='';var _0x28a50a=parseInt(_0x175b8a[_0x4b3f('0x170')],0xa);if(isNaN(_0x28a50a)){_0x18e78e=_0x175b8a[_0x4b3f('0x170')];}else{_0x18e78e=this[_0x4b3f('0x19')][_0x4b3f('0x77')](this,_0x175b8a[_0x4b3f('0x170')]);if(!_0x18e78e){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x175b8a,_0x4b3f('0x172'));}}var _0x4eedee='';if(this[_0x4b3f('0x8e')](_0x175b8a[_0x4b3f('0x116')])){var _0x1fc411=this['getSound']['sync'](this,_0x175b8a[_0x4b3f('0x116')]);if(_0x1fc411){_0x4eedee=_0x1fc411;}}this[_0x4b3f('0x38')][_0x4b3f('0x77')](this,_0x175b8a,_0x18e78e);if(_0x175b8a[_0x4b3f('0x111')][_0x4b3f('0x173')]('x')<0x0){_0x175b8a[_0x4b3f('0x111')]+='x';}if(_0x175b8a[_0x4b3f('0x111')][_0x4b3f('0x173')]('X')<0x0){_0x175b8a[_0x4b3f('0x111')]+='X';}this['channel'][_0x4b3f('0xaa')](_0x4b3f('0x174'),_0x18e78e?_0x18e78e[_0x4b3f('0x175')]():'');var _0x4c0004=this[_0x4b3f('0x39')][_0x4b3f('0xb0')](_0x4b3f('0x176'),[_0x18e78e,_0x175b8a[_0x4b3f('0x111')],_0x175b8a['url'],_0x4eedee,_0x175b8a[_0x4b3f('0x6d')],_0x175b8a['agi'],_0x175b8a[_0x4b3f('0x177')],_0x175b8a[_0x4b3f('0x178')],'',_0x175b8a[_0x4b3f('0x179')]]);if(_0x4c0004[_0x4b3f('0xa9')]===-0x1){return _0x4c0004;}return this['channel'][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0xca'),'QUEUE',_0x18e78e));};AGIVertices['prototype'][_0x4b3f('0x17a')]=function(_0x53f884){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x53f884['label']));var _0x36c05e=_0x53f884[_0x4b3f('0x17b')]||'wav';var _0xc9bbad=util['format'](_0x4b3f('0x17c'),this[_0x4b3f('0x39')][_0x4b3f('0x3a')],rs[_0x4b3f('0x11e')](0x5));var _0x44aa5a=util[_0x4b3f('0x2c')]('%s/recordings/%s.%s',FILES_PATH,_0xc9bbad,_0x36c05e);var _0x21221c=util[_0x4b3f('0x2c')]('%s/recordings/%s',FILES_PATH,_0xc9bbad);this['createSquareRecording']['sync'](this,_0x53f884,_0xc9bbad,_0x44aa5a);this['channel']['setVariable']('RECORDING_SAVENAME',_0xc9bbad);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x21221c,_0x36c05e,_0x53f884[_0x4b3f('0x17d')],_0x53f884[_0x4b3f('0x6d')]);return this[_0x4b3f('0x39')][_0x4b3f('0x13a')](_0x21221c,_0x36c05e,_0x53f884[_0x4b3f('0x17d')],_0x53f884[_0x4b3f('0x6d')],undefined,!![]);};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x17e')]=function(_0x66b30d){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x17f'),_0x66b30d['label']));if(!this[_0x4b3f('0x8e')](_0x66b30d[_0x4b3f('0x6b')])){return this['channel'][_0x4b3f('0xae')](_0x4b3f('0x180'));}var _0x359724=this[_0x4b3f('0x6a')][_0x4b3f('0x77')](this,_0x66b30d);logger['info'](util[_0x4b3f('0x2c')](_0x4b3f('0x181'),util[_0x4b3f('0x182')](_0x359724,{'showHidden':![],'depth':null})));if(!this[_0x4b3f('0x8e')](_0x66b30d[_0x4b3f('0xda')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0x183'));}var _0x4d32f2=this[_0x4b3f('0xa6')][_0x4b3f('0x77')](this,_0x66b30d['variable_id']);if(!_0x4d32f2){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x66b30d,_0x4b3f('0xdc'));}this['channel'][_0x4b3f('0xaa')](util['format'](_0x4b3f('0x184'),_0x4d32f2),_0x359724[_0x4b3f('0x7d')]?_0x359724[_0x4b3f('0x7d')]:_0x4b3f('0x185'));this[_0x4b3f('0x39')][_0x4b3f('0xaa')](util['format']('%s_STATUS_MESSAGE',_0x4d32f2),_0x359724['statusMessage']?_0x359724[_0x4b3f('0x186')]:'OK');if(_0x359724[_0x4b3f('0x72')]){try{this[_0x4b3f('0xa3')](_0x359724['body'],_0x4d32f2);}catch(_0x3cd222){logger[_0x4b3f('0x55')](util['format'](_0x4b3f('0x187'),_0x4d32f2));}}return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0xe1'),_0x4d32f2));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x188')]=function(_0x1562e4){logger['info'](util[_0x4b3f('0x2c')](_0x4b3f('0x189'),_0x1562e4['label']));return this['channel'][_0x4b3f('0x18a')](_0x1562e4[_0x4b3f('0x18b')][_0x4b3f('0x5f')](/\s+/g,''),_0x1562e4[_0x4b3f('0x17d')]);};AGIVertices['prototype'][_0x4b3f('0x18c')]=function(_0x3d2bae){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x18d'),_0x3d2bae[_0x4b3f('0x3b')]));return this[_0x4b3f('0x39')][_0x4b3f('0x18e')](_0x3d2bae[_0x4b3f('0x6e')][_0x4b3f('0x5f')](/\s+/g,''),_0x3d2bae[_0x4b3f('0x17d')]);};AGIVertices[_0x4b3f('0x18')]['sayphonetic']=function(_0x18954f){logger['info'](util[_0x4b3f('0x2c')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x18954f['label']));return this[_0x4b3f('0x39')][_0x4b3f('0x18f')](_0x18954f['text'],_0x18954f[_0x4b3f('0x17d')]);};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x190')]=function(_0xc017e2){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x191'),_0xc017e2[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0xc017e2[_0x4b3f('0x192')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0x193'));}var _0x7c8790=this['getMailAccount'][_0x4b3f('0x77')](this,_0xc017e2[_0x4b3f('0x192')]);if(!_0x7c8790||!_0x7c8790[_0x4b3f('0x194')]){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0xc017e2,'no\x20mail\x20account\x20found');}var _0x344301={'from':util[_0x4b3f('0x2c')](_0x4b3f('0x195'),_0x7c8790[_0x4b3f('0x16')],_0x7c8790[_0x4b3f('0x196')]||_0x7c8790[_0x4b3f('0x194')][_0x4b3f('0x197')]),'to':_0xc017e2['to']||'','cc':_0xc017e2['cc']||'','bcc':_0xc017e2[_0x4b3f('0x198')]||'','subject':_0xc017e2[_0x4b3f('0x199')],'html':_0xc017e2['text'],'text':_0xc017e2[_0x4b3f('0x63')]};var _0x5ae04a={'tls':{'rejectUnauthorized':![]}};if(_0x7c8790[_0x4b3f('0x194')][_0x4b3f('0x19a')]){_0x5ae04a[_0x4b3f('0x19a')]=_0x7c8790[_0x4b3f('0x194')][_0x4b3f('0x19a')];}else{_0x5ae04a[_0x4b3f('0x19b')]=_0x7c8790[_0x4b3f('0x194')][_0x4b3f('0x19b')];_0x5ae04a[_0x4b3f('0x19c')]=_0x7c8790['Smtp'][_0x4b3f('0x19c')];_0x5ae04a[_0x4b3f('0x19d')]=_0x7c8790[_0x4b3f('0x194')]['secure'];}if(_0x7c8790[_0x4b3f('0x194')][_0x4b3f('0x19e')]){_0x5ae04a[_0x4b3f('0x19f')]={'user':_0x7c8790[_0x4b3f('0x194')][_0x4b3f('0x197')],'pass':_0x7c8790[_0x4b3f('0x194')]['pass']};}if(this[_0x4b3f('0x8e')](_0xc017e2[_0x4b3f('0x1a0')])){}logger[_0x4b3f('0xe3')]('sendMail\x20message',JSON[_0x4b3f('0x7b')](_0x344301));this[_0x4b3f('0x38')]['sync'](this,_0xc017e2,_0xc017e2[_0x4b3f('0x192')]);this['channel']['noop'](util[_0x4b3f('0x2c')](_0x4b3f('0x1a1'),_0x7c8790[_0x4b3f('0x16')]));this['sendMailMessage'][_0x4b3f('0x77')](this,_0x5ae04a,_0x344301);return this[_0x4b3f('0x39')][_0x4b3f('0xae')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x1a2')]=function(_0x19922a){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x19922a[_0x4b3f('0x3b')]));return this[_0x4b3f('0x39')]['noop'](_0x4b3f('0x1a3'));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x1a4')]=function(_0x556efe){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x1a5'),_0x556efe[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x556efe[_0x4b3f('0x1a6')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')]('no\x20sms\x20account\x20configured');}var _0x195ccf=this['getSmsAccount']['sync'](this,_0x556efe[_0x4b3f('0x1a6')]);if(!_0x195ccf){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x556efe,_0x4b3f('0x1a7'));}var _0x4ce657={'body':_0x556efe[_0x4b3f('0x1a8')],'phone':_0x556efe['to']||'','SmsAccountId':_0x195ccf['id']};logger['debug'](_0x4b3f('0x1a9'),JSON[_0x4b3f('0x7b')](_0x4ce657));this[_0x4b3f('0x38')][_0x4b3f('0x77')](this,_0x556efe,_0x556efe[_0x4b3f('0x1a6')]);this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x1aa'),_0x195ccf[_0x4b3f('0x16')]));this[_0x4b3f('0x1ab')][_0x4b3f('0x77')](this,_0x4ce657);return this['channel'][_0x4b3f('0xae')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x1ac')]=function(_0x2ffddd){logger[_0x4b3f('0x30')](util['format'](_0x4b3f('0x1ad'),_0x2ffddd[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x2ffddd[_0x4b3f('0xda')])){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x2ffddd,'no\x20variable\x20selected');}var _0x564d20=this[_0x4b3f('0xa6')][_0x4b3f('0x77')](this,_0x2ffddd['variable_id']);if(!_0x564d20){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x2ffddd,_0x4b3f('0xdc'));}return this[_0x4b3f('0x39')]['setVariable'](_0x564d20,_0x2ffddd[_0x4b3f('0x1ae')]);};AGIVertices['prototype'][_0x4b3f('0x1af')]=function(_0x93e4cd){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x1b0'),_0x93e4cd[_0x4b3f('0x3b')]));this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0x1b1'));if(_0x93e4cd['answer']===_0x4b3f('0x1b2')){this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0x1b3'));return this['channel'][_0x4b3f('0xbf')]();}return this[_0x4b3f('0x39')]['noop'](_0x4b3f('0x1b4'));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x1b5')]=function(_0x599b50){logger['info'](util['format'](_0x4b3f('0x1b6'),_0x599b50[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x599b50[_0x4b3f('0x1b7')])){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x599b50,_0x4b3f('0x1b8'));}var _0x1dba52=this[_0x4b3f('0x1a')]['sync'](this,_0x599b50[_0x4b3f('0x1b7')]);if(!this[_0x4b3f('0x8e')](_0x1dba52)){return this['channel'][_0x4b3f('0x55')](_0x599b50,util[_0x4b3f('0x2c')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x599b50[_0x4b3f('0x1b7')]));}if(_0x1dba52===this[_0x4b3f('0x39')][_0x4b3f('0x3d')]){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x599b50,_0x4b3f('0x1b9'));}this[_0x4b3f('0x38')][_0x4b3f('0x77')](this,_0x599b50,_0x1dba52);var _0x1daab9=this[_0x4b3f('0x39')]['exec']('AGI',util[_0x4b3f('0x2c')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x4b3f('0x9')]['host']||_0x4b3f('0x1ba'),_0x1dba52,this['channel'][_0x4b3f('0x3d')]));if(_0x1daab9[_0x4b3f('0xa9')]===-0x1){return _0x1daab9;}return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0xca'),_0x4b3f('0x1bb'),_0x1dba52));};AGIVertices['prototype']['system']=function(_0x55b806){logger['info'](util['format'](_0x4b3f('0x1bc'),_0x55b806['label']));var _0x4532c8=this[_0x4b3f('0x5d')][_0x4b3f('0x77')](this,_0x55b806[_0x4b3f('0xbd')]);this[_0x4b3f('0x38')][_0x4b3f('0x77')](this,_0x55b806,_0x55b806[_0x4b3f('0xbd')]);if(this[_0x4b3f('0x8e')](_0x55b806[_0x4b3f('0xda')])){var _0x33ab1b=this[_0x4b3f('0xa6')][_0x4b3f('0x77')](this,_0x55b806['variable_id']);if(_0x33ab1b){this[_0x4b3f('0x39')][_0x4b3f('0xaa')](_0x33ab1b,_0x4532c8);return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util['format']('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x55b806[_0x4b3f('0xbd')],_0x33ab1b));}}return this[_0x4b3f('0x39')]['noop'](util[_0x4b3f('0x2c')](_0x4b3f('0x1bd'),_0x55b806[_0x4b3f('0xbd')]));};AGIVertices['prototype'][_0x4b3f('0x1be')]=function(_0x12f3df){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x1bf'),_0x12f3df[_0x4b3f('0x3b')]));_0x12f3df[_0x4b3f('0x63')]=_0x12f3df[_0x4b3f('0x63')][_0x4b3f('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x4b3f('0x8e')](_0x12f3df[_0x4b3f('0x61')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0x1c0'));}if(!this[_0x4b3f('0x8e')](_0x12f3df[_0x4b3f('0x63')])){return this[_0x4b3f('0x39')][_0x4b3f('0xae')](_0x4b3f('0xaf'));}this['channel']['noop'](util[_0x4b3f('0x2c')](_0x4b3f('0x1c1'),_0x12f3df[_0x4b3f('0x63')]));var _0x3d87d8=this['googleCloudTTS'][_0x4b3f('0x77')](this,_0x12f3df);if(_0x3d87d8){this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')](_0x4b3f('0x1c2'),_0x3d87d8));var _0xa62991=this[_0x4b3f('0x39')][_0x4b3f('0x103')](_0x3d87d8);try{fs[_0x4b3f('0x104')](_0x3d87d8+_0x4b3f('0x105'));}catch(_0x56e69f){logger[_0x4b3f('0x55')](_0x56e69f);}return _0xa62991;}return this[_0x4b3f('0x39')]['error'](_0x12f3df,_0x4b3f('0x1c3'));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x1c4')]=function(_0x919035){logger['info'](util['format'](_0x4b3f('0x1c5'),_0x919035['label']));_0x919035['text']=_0x919035['text'][_0x4b3f('0x5f')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x919035[_0x4b3f('0x63')])){return this[_0x4b3f('0x39')]['noop']('no\x20text\x20configured');}this[_0x4b3f('0x39')]['noop'](util[_0x4b3f('0x2c')](_0x4b3f('0x1c6'),_0x919035['text']));var _0x1a314d=this['googleTTS'][_0x4b3f('0x77')](this,_0x919035);if(_0x1a314d){this['channel'][_0x4b3f('0xae')](util['format']('Google\x20TTS\x20%s\x20file\x20created',_0x1a314d));var _0x2d78cc=this[_0x4b3f('0x39')][_0x4b3f('0x103')](_0x1a314d);try{fs[_0x4b3f('0x104')](_0x1a314d+'.wav');}catch(_0x534aac){logger[_0x4b3f('0x55')](_0x534aac);}return _0x2d78cc;}return this[_0x4b3f('0x39')]['error'](_0x919035,_0x4b3f('0x1c7'));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x1c8')]=function(_0x46c11f){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x1c9'),_0x46c11f[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x46c11f[_0x4b3f('0x15b')])){return this[_0x4b3f('0x39')]['error'](_0x46c11f,_0x4b3f('0x159'));}logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x4b3f('0x39')][_0x4b3f('0x3e')],_0x46c11f[_0x4b3f('0x15b')]));var _0x3cc11a=this['agentUnpause'][_0x4b3f('0x77')](this,_0x46c11f[_0x4b3f('0x15b')]);if(_0x3cc11a){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x15c'),this[_0x4b3f('0x39')]['callerid'],_0x46c11f[_0x4b3f('0x15b')]));this[_0x4b3f('0x39')][_0x4b3f('0xae')](util['format'](_0x4b3f('0x15c'),this[_0x4b3f('0x39')][_0x4b3f('0x3e')],_0x46c11f['findBy']));return{'code':0xc8,'result':_0x4b3f('0x15d')};}else{logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')](_0x4b3f('0x161'),this['channel']['callerid'],_0x46c11f['findBy']));this[_0x4b3f('0x39')][_0x4b3f('0xae')](util[_0x4b3f('0x2c')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x4b3f('0x39')][_0x4b3f('0x3e')],_0x46c11f['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x1ca')]=function(_0x3291b1){logger[_0x4b3f('0x30')](util[_0x4b3f('0x2c')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x3291b1[_0x4b3f('0x3b')]));var _0x578c84=this['channel']['exec'](_0x4b3f('0x1cb'),[_0x3291b1['mailbox'],_0x3291b1['options']]);if(_0x578c84[_0x4b3f('0xa9')]===-0x1){return _0x578c84;}return this[_0x4b3f('0x39')][_0x4b3f('0xae')](util['format'](_0x4b3f('0xca'),_0x4b3f('0x1cb'),_0x3291b1[_0x4b3f('0x1cc')]));};AGIVertices[_0x4b3f('0x18')][_0x4b3f('0x1cd')]=function(_0x905ae9){logger['info'](util[_0x4b3f('0x2c')](_0x4b3f('0x1ce'),_0x905ae9[_0x4b3f('0x3b')]));if(!this[_0x4b3f('0x8e')](_0x905ae9[_0x4b3f('0xda')])){return this[_0x4b3f('0x39')][_0x4b3f('0x55')](_0x905ae9,_0x4b3f('0x1cf'));}var _0x24c339=this[_0x4b3f('0xa6')][_0x4b3f('0x77')](this,_0x905ae9[_0x4b3f('0xda')]);if(!_0x24c339){return this[_0x4b3f('0x39')]['error'](_0x905ae9,_0x4b3f('0xdc'));}var _0x387857=this[_0x4b3f('0x39')][_0x4b3f('0xa6')](_0x24c339);return{'code':0xc8,'result':_0x387857['extra']?_0x387857[_0x4b3f('0xa7')]:'-'};};String[_0x4b3f('0x18')][_0x4b3f('0x1d0')]=function(_0xbe5793,_0x4520ee){return this[_0x4b3f('0xa5')](_0xbe5793)[_0x4b3f('0x1d1')](_0x4520ee);};module[_0x4b3f('0x1d2')]=AGIVertices; \ No newline at end of file +var _0xd0bf=['toUpperCase','speech','out','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','client_email','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','variable_id','getData','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','wav','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','continueAt','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','extra','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','%s/recordings/%s','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','intKey','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','FIND\x20AGENT\x20%s\x20BY\x20%s','success','failure','math','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','position','QUEUE','record','recordingFormat','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','digits','saynumber','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','bcc','subject','service','host','port','secure','authentication','auth','user','template_id','debug','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','../../config/environment','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','map','Intervals','interval','format','%s/sounds/converted/%s','getQueryOdbc','open','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','context','priority','dnid','createSquareMessage','createCmContact','isNil','callback_','isEmpty','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','restAPI','url','method','timeout','number','includes','POST','PUT','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','body','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','awsLex','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','%s.%s','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','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','Executed\x20command\x20MRCPRecog\x20%s','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','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','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','forEach','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s'];(function(_0x4a463a,_0x508ec9){var _0x441834=function(_0x4fcbf6){while(--_0x4fcbf6){_0x4a463a['push'](_0x4a463a['shift']());}};_0x441834(++_0x508ec9);}(_0xd0bf,0xd5));var _0xfd0b=function(_0xd732cd,_0x300d18){_0xd732cd=_0xd732cd-0x0;var _0x5eadc6=_0xd0bf[_0xd732cd];return _0x5eadc6;};'use strict';var fs=require('fs');var path=require(_0xfd0b('0x0'));var util=require(_0xfd0b('0x1'));var _=require(_0xfd0b('0x2'));var sh=require(_0xfd0b('0x3'));var odbc=require(_0xfd0b('0x4'))();var rs=require(_0xfd0b('0x5'));var moment=require(_0xfd0b('0x6'));var Mustache=require(_0xfd0b('0x7'));var rp=require('request-promise');var logger=require(_0xfd0b('0x8'))('agi');var config=require(_0xfd0b('0x9'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xfd0b('0xa'),_0xfd0b('0xb')];var verticesWithRetry=[_0xfd0b('0xc'),_0xfd0b('0xd'),'getsecretdigits'];var AGIVertices=function(_0x5cf53c,_0x4f0387,_0x497004){this[_0xfd0b('0xe')]=_0x5cf53c;this[_0xfd0b('0xf')]=_0x4f0387;this[_0xfd0b('0x10')]=_0x497004;};AGIVertices['prototype'][_0xfd0b('0x11')]=function(_0xe5d906,_0x32cc95){this[_0xfd0b('0xf')][_0xfd0b('0x12')](_0xe5d906)['then'](function(_0x26c89d){_0x32cc95(null,_0x26c89d?_0x26c89d[_0xfd0b('0x13')]:![]);})[_0xfd0b('0x14')](function(_0x5b2477){_0x32cc95(_0x5b2477);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x16')]=function(_0x1de62d,_0x384134){this[_0xfd0b('0xf')][_0xfd0b('0x17')](_0x1de62d)[_0xfd0b('0x18')](function(_0xf4fbc9){_0x384134(null,_0xf4fbc9?_0xf4fbc9[_0xfd0b('0x13')]:![]);})['catch'](function(_0x1cc100){_0x384134(_0x1cc100);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x19')]=function(_0x490706,_0x272d98){this[_0xfd0b('0xf')][_0xfd0b('0x1a')](_0x490706)[_0xfd0b('0x18')](function(_0x3c632c){_0x272d98(null,_0x3c632c?_0x3c632c[_0xfd0b('0x13')]:![]);})[_0xfd0b('0x14')](function(_0x4206ca){_0x272d98(_0x4206ca);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x52e960,_0x2aecd9){this[_0xfd0b('0xf')]['getSquareOdbcById'](_0x52e960)[_0xfd0b('0x18')](function(_0x47c6a5){_0x2aecd9(null,_0x47c6a5?_0x47c6a5['dsn']:![]);})[_0xfd0b('0x14')](function(_0x1732bc){_0x2aecd9(_0x1732bc);});};AGIVertices[_0xfd0b('0x15')]['getUser']=function(_0x4acf53,_0x3dbcb6){this[_0xfd0b('0xf')][_0xfd0b('0x1b')](_0x4acf53)['then'](function(_0x56f5e0){_0x3dbcb6(null,_0x56f5e0?_0x56f5e0[_0xfd0b('0x13')]:![]);})[_0xfd0b('0x14')](function(_0x22fe80){_0x3dbcb6(_0x22fe80);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x1c')]=function(_0x292a63,_0x21d6d3){this['rpc'][_0xfd0b('0x1d')](_0x292a63)[_0xfd0b('0x18')](function(_0xa4b0be){_0x21d6d3(null,_0xa4b0be?_0xa4b0be['name']:![]);})[_0xfd0b('0x14')](function(_0x3adcd5){_0x21d6d3(_0x3adcd5);});};AGIVertices[_0xfd0b('0x15')]['getSound']=function(_0x46b441,_0x4039f5){var _0x2ff377=this;this['rpc'][_0xfd0b('0x1e')](_0x46b441)[_0xfd0b('0x18')](function(_0x583ce0){_0x4039f5(null,_0x583ce0?_0x2ff377[_0xfd0b('0x1f')](_0x583ce0[_0xfd0b('0x20')]):![]);})[_0xfd0b('0x14')](function(_0x5c3a5c){_0x4039f5(_0x5c3a5c);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x21')]=function(_0x2cfa02,_0x493200){this['rpc'][_0xfd0b('0x22')](_0x2cfa02)[_0xfd0b('0x18')](function(_0x2ce3d0){_0x493200(null,_0x2ce3d0?_0x2ce3d0:![]);})[_0xfd0b('0x14')](function(_0x5d40a3){_0x493200(_0x5d40a3);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x23')]=function(_0x516e07,_0x14e437,_0x54dc5c){this[_0xfd0b('0x10')]['sendMailMessage'](_0x516e07,_0x14e437)[_0xfd0b('0x18')](function(){_0x54dc5c(null);})['catch'](function(_0x4a79a4){_0x54dc5c(_0x4a79a4);});};AGIVertices['prototype']['getIntervals']=function(_0x4cc625,_0x443660){this[_0xfd0b('0xf')][_0xfd0b('0x24')](_0x4cc625)[_0xfd0b('0x18')](function(_0x205947){if(_0x205947){if(_0x205947[_0xfd0b('0x25')]){_0x443660(null,[_0x205947['interval']]);}else{_0x443660(null,_[_0xfd0b('0x26')](_0x205947[_0xfd0b('0x27')],_0xfd0b('0x28')));}}else{_0x443660(null,![]);}})[_0xfd0b('0x14')](function(_0x12d987){_0x443660(_0x12d987);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x1f')]=function(_0x1aadb4){return util[_0xfd0b('0x29')](_0xfd0b('0x2a'),FILES_PATH,_0x1aadb4);};AGIVertices['prototype'][_0xfd0b('0x2b')]=function(_0x288ae9,_0x784d11,_0x3c4706){odbc[_0xfd0b('0x2c')](_0x288ae9,function(_0x56f24c){if(_0x56f24c){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x56f24c);_0x3c4706(_0x56f24c);}else{logger['info'](_0xfd0b('0x2d'));odbc[_0xfd0b('0x2e')](_0x784d11,function(_0x4dade2,_0xf10464){if(_0x4dade2){logger[_0xfd0b('0x2f')](_0xfd0b('0x30'),_0x784d11);_0x3c4706(_0x4dade2);}else{logger['info'](_0xfd0b('0x31'),_0x784d11);odbc[_0xfd0b('0x32')](function(_0x52999b){if(_0x52999b){logger[_0xfd0b('0x33')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x52999b);}_0x3c4706(null,_0xf10464);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0xaca22c,_0x65952){this['rpc'][_0xfd0b('0x34')](_0xaca22c)[_0xfd0b('0x18')](function(_0x5df14b){_0x65952(null,_0x5df14b?_0x5df14b:![]);})['catch'](function(_0x4f5465){_0x65952(_0x4f5465);});};AGIVertices[_0xfd0b('0x15')]['createSmsMessage']=function(_0x9e1abd,_0x1dab1d){this[_0xfd0b('0xf')][_0xfd0b('0x35')](_0x9e1abd)[_0xfd0b('0x18')](function(_0xd86939){_0x1dab1d(null,_0xd86939);})[_0xfd0b('0x14')](function(_0x2142fd){_0x1dab1d(_0x2142fd);});};AGIVertices[_0xfd0b('0x15')]['createSquareDetailsReport']=function(_0xf6a89d,_0x52539c,_0x4271c0){this[_0xfd0b('0xf')][_0xfd0b('0x36')]({'uniqueid':this['channel'][_0xfd0b('0x37')],'node':_0xf6a89d[_0xfd0b('0x38')],'application':_0xf6a89d[_0xfd0b('0x39')],'data':_0x52539c||null,'project_name':this[_0xfd0b('0xe')][_0xfd0b('0x3a')],'callerid':this[_0xfd0b('0xe')]['callerid']})['then'](function(_0x18fc4a){if(_0x4271c0){_0x4271c0(null,_0x18fc4a);}})[_0xfd0b('0x14')](function(_0x4d2b14){if(_0x4271c0){_0x4271c0(_0x4d2b14);}});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x3b')]=function(_0x324993,_0x1992d8,_0x1537d1,_0x4c557c){this['rpc'][_0xfd0b('0x3b')]({'uniqueid':this[_0xfd0b('0xe')][_0xfd0b('0x37')],'callerid':this[_0xfd0b('0xe')][_0xfd0b('0x3c')],'calleridname':this[_0xfd0b('0xe')]['calleridname'],'context':this[_0xfd0b('0xe')][_0xfd0b('0x3d')],'extension':this[_0xfd0b('0xe')]['extension'],'priority':this[_0xfd0b('0xe')][_0xfd0b('0x3e')],'accountcode':this[_0xfd0b('0xe')]['accountcode'],'dnid':this[_0xfd0b('0xe')][_0xfd0b('0x3f')],'projectName':this[_0xfd0b('0xe')]['arg_1'],'saveName':_0x1992d8,'filename':_0x324993['file']||_0x1992d8,'savePath':_0x1537d1})[_0xfd0b('0x18')](function(_0x54ec28){_0x4c557c(null,_0x54ec28);})[_0xfd0b('0x14')](function(_0x4a39c2){_0x4c557c(_0x4a39c2);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x40')]=function(_0x424ec9,_0x4957b8,_0x244404,_0x136959,_0x3aaab2){this[_0xfd0b('0xf')][_0xfd0b('0x40')]({'uniqueid':this['channel']['uniqueid'],'body':_0x424ec9,'direction':_0x4957b8,'providerName':_0x244404,'providerResponse':_0x136959})[_0xfd0b('0x18')](function(_0x3e9e16){if(_0x3aaab2){_0x3aaab2(null,_0x3e9e16);}})[_0xfd0b('0x14')](function(_0x58c337){if(_0x3aaab2){_0x3aaab2(_0x58c337);}});};AGIVertices[_0xfd0b('0x15')]['createCmContact']=function(_0x4ca6ac,_0x28297a){this['rpc'][_0xfd0b('0x41')]({'firstName':_['isEmpty'](_0x4ca6ac[_0xfd0b('0x13')])||_[_0xfd0b('0x42')](_0x4ca6ac['name'])?_0xfd0b('0x43')+Math['random']():_0x4ca6ac['name'],'lastName':_[_0xfd0b('0x44')](_0x4ca6ac[_0xfd0b('0x45')])||_[_0xfd0b('0x42')](_0x4ca6ac[_0xfd0b('0x45')])?null:_0x4ca6ac[_0xfd0b('0x45')],'phone':_0x4ca6ac[_0xfd0b('0x46')],'ListId':_0x4ca6ac[_0xfd0b('0x47')],'scheduledat':_0x4ca6ac[_0xfd0b('0x48')],'callbackUniqueid':this['channel'][_0xfd0b('0x37')],'tags':_0xfd0b('0x49'),'description':_0xfd0b('0x4a')+_0x4ca6ac[_0xfd0b('0x48')][_0xfd0b('0x4b')](),'priority':_0x4ca6ac[_0xfd0b('0x4c')]})['then'](function(_0x267c35){_0x28297a(null,_0x267c35);})[_0xfd0b('0x14')](function(_0x5e2434){_0x28297a(_0x5e2434);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x4d')]=function(_0x25b406,_0x2960d6){this[_0xfd0b('0xf')][_0xfd0b('0x4e')](_0x25b406)[_0xfd0b('0x18')](function(_0x4b5268){_0x2960d6(null,_0x4b5268?_0x4b5268[_0xfd0b('0x13')]:![]);})['catch'](function(_0x1480c5){_0x2960d6(_0x1480c5);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x4f')]=function(_0x1a27bb,_0x2632d7,_0x2560f7){var _0x205d82={'role':_0xfd0b('0x50')};_0x205d82[_0x1a27bb]=this[_0xfd0b('0xe')][_0xfd0b('0x3c')];this[_0xfd0b('0xf')][_0xfd0b('0x4f')](_0x205d82,_0x2632d7,this[_0xfd0b('0xe')]['uniqueid'])['then'](function(_0x9d6f17){_0x2560f7(null,_[_0xfd0b('0x42')](_0x9d6f17)?![]:!![]);})[_0xfd0b('0x14')](function(_0x21eabc){logger['error'](_0x21eabc);_0x2560f7(null,![]);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x51')]=function(_0x265809,_0x2d4e2e){var _0x39d8e1={'role':'agent'};_0x39d8e1[_0x265809]=this[_0xfd0b('0xe')][_0xfd0b('0x3c')];this[_0xfd0b('0xf')][_0xfd0b('0x51')](_0x39d8e1)[_0xfd0b('0x18')](function(_0x829d2f){_0x2d4e2e(null,_[_0xfd0b('0x42')](_0x829d2f)?![]:!![]);})[_0xfd0b('0x14')](function(_0x1aae22){logger[_0xfd0b('0x33')](_0x1aae22);_0x2d4e2e(null,![]);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x52')]=function(_0x2484fd,_0x12275e){var _0x27efbe={'role':'agent'};_0x27efbe[_0x2484fd]=this['channel'][_0xfd0b('0x3c')];this[_0xfd0b('0xf')]['agentLogout'](_0x27efbe)['then'](function(_0x5b2a42){_0x12275e(null,_[_0xfd0b('0x42')](_0x5b2a42)?![]:!![]);})['catch'](function(_0x107a29){logger[_0xfd0b('0x33')](_0x107a29);_0x12275e(null,![]);});};AGIVertices['prototype'][_0xfd0b('0x53')]=function(_0x2484f3,_0x20fe74){var _0x51c314={'role':'agent'};_0x51c314[_0x2484f3]=this[_0xfd0b('0xe')][_0xfd0b('0x3c')];var _0x13d1ae=_0x2484f3!='internal'?util['format'](_0xfd0b('0x54'),_0xfd0b('0x55'),this[_0xfd0b('0xe')][_0xfd0b('0x3c')]):undefined;this['rpc'][_0xfd0b('0x53')](_0x51c314,_0x13d1ae)[_0xfd0b('0x18')](function(_0x4f303a){_0x20fe74(null,_[_0xfd0b('0x42')](_0x4f303a)?![]:!![]);})[_0xfd0b('0x14')](function(_0x360dbf){logger[_0xfd0b('0x33')](_0x360dbf);_0x20fe74(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x41fc8b,_0x41791f){sh[_0xfd0b('0x56')](_[_0xfd0b('0x57')](_0x41fc8b),function(_0x39fd8f,_0x2506c6){var _0x357710=_0x2506c6[_0xfd0b('0x58')](/(\r\n|\n|\r)/gm,'');_0x41791f(null,_0x357710);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x59')]=function(_0x3cf535,_0xdcb5fc){scripts['googleCloudTTS'](_0x3cf535[_0xfd0b('0x5a')],_0x3cf535[_0xfd0b('0x5b')]||'text',_0x3cf535[_0xfd0b('0x5c')],_0x3cf535[_0xfd0b('0x5d')]||'en-US',_0x3cf535[_0xfd0b('0x5e')]||_0xfd0b('0x5f'),_0x3cf535[_0xfd0b('0x60')]||_0xfd0b('0x61'))[_0xfd0b('0x18')](function(_0x4a4c7a){_0xdcb5fc(null,_0x4a4c7a);})[_0xfd0b('0x14')](function(_0xb48a6b){_0xdcb5fc(_0xb48a6b);});};AGIVertices['prototype'][_0xfd0b('0x62')]=function(_0x449a1a,_0xe9560c){scripts['googleTTS'](_0x449a1a[_0xfd0b('0x5c')],_0x449a1a['google_tts_language']||'en',0x1)['then'](function(_0x425f55){_0xe9560c(null,_0x425f55);})['catch'](function(_0x3c706b){_0xe9560c(_0x3c706b);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x63')]=function(_0xf29a46,_0x2b07ab){var _0x4b08e1={'uri':_0xf29a46[_0xfd0b('0x64')],'method':_0xf29a46[_0xfd0b('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xf29a46[_0xfd0b('0x66')])===_0xfd0b('0x67')&&parseInt(_0xf29a46[_0xfd0b('0x66')])>=0x1?parseInt(_0xf29a46[_0xfd0b('0x66')])*0x3e8:0x5*0x3e8};if(_[_0xfd0b('0x68')]([_0xfd0b('0x69'),_0xfd0b('0x6a')],_0x4b08e1[_0xfd0b('0x65')]['toUpperCase']())){try{_0x4b08e1['body']=_0xf29a46[_0xfd0b('0xb')]?JSON[_0xfd0b('0x6b')](_0xf29a46['rawBody']):{};}catch(_0x35b1b2){logger[_0xfd0b('0x33')](_0xfd0b('0x6c'),_0x35b1b2);}}try{_0x4b08e1[_0xfd0b('0x6d')]=_0xf29a46[_0xfd0b('0xa')]?JSON['parse'](_0xf29a46[_0xfd0b('0xa')]):{};}catch(_0x25cd40){logger[_0xfd0b('0x33')](_0xfd0b('0x6e'),_0x25cd40);}if(_0xf29a46['computedVariables']){try{var _0x552b39=require(_0xf29a46[_0xfd0b('0x6f')])[_0xfd0b('0x70')](this,_0x4b08e1);_0x4b08e1[_0xfd0b('0x71')]=Mustache['render'](_0xf29a46[_0xfd0b('0x64')],_0x552b39,{},['$$','$$']);if(_0x4b08e1[_0xfd0b('0x6d')]){_0x4b08e1['headers']=JSON['parse'](Mustache[_0xfd0b('0x72')](JSON['stringify'](_0x4b08e1[_0xfd0b('0x6d')]),_0x552b39,{},['$$','$$']));}if(_0x4b08e1[_0xfd0b('0x73')]){_0x4b08e1['body']=JSON[_0xfd0b('0x6b')](Mustache[_0xfd0b('0x72')](JSON[_0xfd0b('0x74')](_0x4b08e1[_0xfd0b('0x73')]),_0x552b39,{},['$$','$$']));}}catch(_0x23b158){logger['error'](_0xfd0b('0x75'),_0x23b158);}}rp(_0x4b08e1)[_0xfd0b('0x18')](function(_0x2df0ae){var _0x5f342c={'statusCode':_0x2df0ae[_0xfd0b('0x76')]||0xc8,'statusMessage':_0x2df0ae[_0xfd0b('0x77')]||'OK','headers':_0x2df0ae[_0xfd0b('0x6d')]||{},'body':_0x2df0ae[_0xfd0b('0x73')]||{}};_0x2b07ab(null,_0x5f342c);})[_0xfd0b('0x14')](function(_0x3274c2){var _0x3de620={'statusCode':_0x3274c2['statusCode']||0x1f4,'statusMessage':_0x3274c2[_0xfd0b('0x78')]||_0xfd0b('0x79'),'headers':_0x3274c2[_0xfd0b('0x7a')][_0xfd0b('0x6d')]||{},'body':_0x3274c2[_0xfd0b('0x7a')][_0xfd0b('0x73')]||{}};_0x2b07ab(null,_0x3de620);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x7b')]=function(_0x198f6a,_0x4be20){scripts[_0xfd0b('0x7b')](this['channel'][_0xfd0b('0x37')],_0x198f6a[_0xfd0b('0x7c')],_0x198f6a[_0xfd0b('0x5c')],_0x198f6a[_0xfd0b('0x7d')]||'en')[_0xfd0b('0x18')](function(_0xd85b8){_0x4be20(null,_0xd85b8);})[_0xfd0b('0x14')](function(_0x30daaf){_0x4be20(_0x30daaf);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x7e')]=function(_0xd4bc23,_0x11555d){scripts[_0xfd0b('0x7e')](this['channel'][_0xfd0b('0x37')],_0xd4bc23[_0xfd0b('0x7f')],_0xd4bc23['client_email'],_0xd4bc23[_0xfd0b('0x80')],_0xd4bc23[_0xfd0b('0x5c')],_0xd4bc23['dialogflowV2_language']||'en')[_0xfd0b('0x18')](function(_0x15655a){_0x11555d(null,_0x15655a);})['catch'](function(_0xaee63){_0x11555d(_0xaee63);});};AGIVertices['prototype'][_0xfd0b('0x81')]=function(_0xddb98b,_0x386a42){scripts[_0xfd0b('0x81')](this[_0xfd0b('0xe')],_0xddb98b)['then'](function(_0x5004be){_0x386a42(null,_0x5004be);})[_0xfd0b('0x14')](function(_0x3a2b60){_0x386a42(_0x3a2b60);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x82')]=function(_0x3fe7b1,_0x4af18c){scripts[_0xfd0b('0x82')](_0x3fe7b1[_0xfd0b('0x7c')],_0x3fe7b1['text'],_0x3fe7b1[_0xfd0b('0x83')]||_0xfd0b('0x84'),_0x3fe7b1[_0xfd0b('0x85')])[_0xfd0b('0x18')](function(_0x3d4a0d){_0x4af18c(null,_0x3d4a0d);})[_0xfd0b('0x14')](function(_0x918840){_0x4af18c(_0x918840);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x86')]=function(_0x1834af,_0x332898,_0x4a6a49){scripts['ispeechASR'](_0x332898,_0x1834af[_0xfd0b('0x7c')],_0x1834af[_0xfd0b('0x87')]||_0xfd0b('0x84'),this[_0xfd0b('0x88')](_0x1834af[_0xfd0b('0x89')])?_0x1834af[_0xfd0b('0x89')]:undefined)[_0xfd0b('0x18')](function(_0x37e4f6){_0x4a6a49(null,_0x37e4f6);})[_0xfd0b('0x14')](function(_0xa4f4b3){_0x4a6a49(_0xa4f4b3);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x8a')]=function(_0x3cb12e,_0x381207){scripts[_0xfd0b('0x8a')](_0x3cb12e[_0xfd0b('0x8b')],_0x3cb12e[_0xfd0b('0x8c')],_0x3cb12e[_0xfd0b('0x8d')],_0x3cb12e['aws_polly_voice']||_0xfd0b('0x8e'),_0x3cb12e[_0xfd0b('0x5c')],_0x3cb12e['aws_text_type']||_0xfd0b('0x5c'))[_0xfd0b('0x18')](function(_0x567501){_0x381207(null,_0x567501);})[_0xfd0b('0x14')](function(_0xfed67d){_0x381207(_0xfed67d);});};AGIVertices['prototype']['awsLex']=function(_0x426912,_0x34b40d){scripts[_0xfd0b('0x8f')](this[_0xfd0b('0xe')][_0xfd0b('0x37')],_0x426912[_0xfd0b('0x8b')],_0x426912[_0xfd0b('0x8c')],_0x426912['aws_lex_region'],_0x426912['text'],_0x426912[_0xfd0b('0x90')])['then'](function(_0x130708){_0x34b40d(null,_0x130708);})[_0xfd0b('0x14')](function(_0xb75962){_0x34b40d(_0xb75962);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x91')]=function(_0x4402de,_0x4f5f33,_0x799774){scripts[_0xfd0b('0x91')](_0x4f5f33,_0x4402de['key'],_0x4402de[_0xfd0b('0x92')]||_0xfd0b('0x84'))['then'](function(_0x471900){_0x799774(null,_0x471900);})[_0xfd0b('0x14')](function(_0x49ac4f){_0x799774(_0x49ac4f);});};AGIVertices[_0xfd0b('0x15')]['tildeASR']=function(_0x5d8282,_0x47a512,_0x236f5a){scripts['tildeASR'](_0x47a512,_0x5d8282[_0xfd0b('0x93')],_0x5d8282[_0xfd0b('0x94')],_0x5d8282[_0xfd0b('0x71')])['then'](function(_0xa599d1){_0x236f5a(null,_0xa599d1);})['catch'](function(_0x18c832){_0x236f5a(_0x18c832);});};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x95')]=function(_0x532639){var _0x5eb809=_[_0xfd0b('0x68')](verticesWithRetry,_0x532639[_0xfd0b('0x39')])?_0x532639:_[_0xfd0b('0x96')](_0x532639);for(var _0x3eee49 in _0x5eb809){if(_0x5eb809[_0xfd0b('0x97')](_0x3eee49)){if(_0x5eb809[_0x3eee49]&&_[_0xfd0b('0x98')](_0x5eb809[_0x3eee49])){if(_[_0xfd0b('0x68')](recursiveMapAttributes,_0x3eee49)){_0x5eb809[_0x3eee49]=this['replaceObjectAllVariables'](_0x5eb809[_0x3eee49]);}else{_0x5eb809[_0x3eee49]=this[_0xfd0b('0x99')](_0x5eb809[_0x3eee49]);}}}}return _0x5eb809;};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x9a')]=function(_0x240cdf){for(var _0x5a0dc1 in _0x240cdf){if(_0x240cdf['hasOwnProperty'](_0x5a0dc1)){if(_['isPlainObject'](_0x240cdf[_0x5a0dc1])){this[_0xfd0b('0x9a')](_0x240cdf[_0x5a0dc1]);}else if(_[_0xfd0b('0x9b')](_0x240cdf[_0x5a0dc1])){for(var _0x4f353d=0x0;_0x4f353d<_0x240cdf[_0x5a0dc1][_0xfd0b('0x9c')];_0x4f353d++){this[_0xfd0b('0x9a')](_0x240cdf[_0x5a0dc1][_0x4f353d]);}}else if(_[_0xfd0b('0x98')](_0x240cdf[_0x5a0dc1])){_0x240cdf[_0x5a0dc1]=this[_0xfd0b('0x99')](_0x240cdf[_0x5a0dc1]);}}}};AGIVertices['prototype'][_0xfd0b('0x9d')]=function(_0x3203cf,_0x1f3ced){for(var _0x55b9c6 in _0x3203cf){if(_0x3203cf['hasOwnProperty'](_0x55b9c6)){if(_[_0xfd0b('0x9e')](_0x3203cf[_0x55b9c6])){if(!_['isEmpty'](_0x3203cf[_0x55b9c6])){this[_0xfd0b('0x9d')](_0x3203cf[_0x55b9c6],util[_0xfd0b('0x29')](_0xfd0b('0x9f'),_0x1f3ced,_0x55b9c6));}}else if(_[_0xfd0b('0x9b')](_0x3203cf[_0x55b9c6])){for(var _0x121ca0=0x0;_0x121ca0<_0x3203cf[_0x55b9c6][_0xfd0b('0x9c')];_0x121ca0++){this[_0xfd0b('0x9d')](_0x3203cf[_0x55b9c6][_0x121ca0],util[_0xfd0b('0x29')]('%s.%s',_0x1f3ced,_0x55b9c6+'['+_0x121ca0+']'));}}else{if(!_['isNil'](_0x3203cf[_0x55b9c6])){this[_0xfd0b('0xe')][_0xfd0b('0xa0')](util[_0xfd0b('0x29')]('%s.%s',_0x1f3ced,_0x55b9c6),_0x3203cf[_0x55b9c6]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x97b7e3){try{var _0x46bef5=JSON[_0xfd0b('0x6b')](_0x97b7e3);this['recursiveNodeIndex'](_0x46bef5);return JSON[_0xfd0b('0x74')](_0x46bef5);}catch(_0x5d8e7d){return this[_0xfd0b('0x99')](_0x97b7e3);}};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x99')]=function(_0x2bc171){var _0xd17777=_0x2bc171['split']('{');for(var _0x17388c=0x1;_0x17388c<_0xd17777['length'];_0x17388c+=0x1){var _0x4f7c8c=_0xd17777[_0x17388c][_0xfd0b('0xa1')]('}');if(_0x4f7c8c[_0xfd0b('0x9c')]>0x1){_0x2bc171=_0x2bc171[_0xfd0b('0xa2')]('{'+_0x4f7c8c[0x0]+'}',this[_0xfd0b('0xe')][_0xfd0b('0x11')](_0x4f7c8c[0x0])['extra']||_0x4f7c8c[0x0]);}}if(_0xd17777[_0xfd0b('0x9c')]===0x1){return _0x2bc171['toString']();}return this[_0xfd0b('0x99')](_0x2bc171);};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0xa3')]=function(_0x4d34ea,_0x42c5d9){var _0x8279bf=this['channel'][_0xfd0b('0x11')](_0x4d34ea);if(_0x8279bf[_0xfd0b('0xa4')]===-0x1){return _0x8279bf;}logger[_0xfd0b('0x2f')](util['format'](_0xfd0b('0xa5'),_0x42c5d9,_0x8279bf['extra']));return this['channel'][_0xfd0b('0xa0')](_0x42c5d9,_0x8279bf['extra']);};AGIVertices[_0xfd0b('0x15')]['isConfigured']=function(_0x20394c){return _0x20394c&&_0x20394c!=='0'&&_0x20394c!=='-1'&&_0x20394c!=='';};AGIVertices['prototype'][_0xfd0b('0xa6')]=function(_0x4ff5d9){this['createSquareDetailsReport'][_0xfd0b('0x70')](this,_0x4ff5d9,'-');_0x4ff5d9[_0xfd0b('0xa7')]=_0x4ff5d9[_0xfd0b('0xa6')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xfd0b('0x15')]['mrcpsynth']=function(_0x2bbf3b){logger[_0xfd0b('0x2f')](util['format'](_0xfd0b('0xa8'),_0x2bbf3b['label']));if(!this[_0xfd0b('0x88')](_0x2bbf3b[_0xfd0b('0x5c')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xaa'));}var _0x1ddd34='\x22'+_0x2bbf3b['text']+'\x22';if(this['isConfigured'](_0x2bbf3b[_0xfd0b('0x7a')])){_0x1ddd34+=','+_0x2bbf3b[_0xfd0b('0x7a')];}var _0x54eaaf=this[_0xfd0b('0xe')]['exec'](_0xfd0b('0xab'),_0x1ddd34);if(_0x54eaaf[_0xfd0b('0xa4')]===-0x1){return _0x54eaaf;}return this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')](_0xfd0b('0xac'),_0x1ddd34));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0xad')]=function(_0x53214e){logger[_0xfd0b('0x2f')](util['format']('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x53214e[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x53214e[_0xfd0b('0xae')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xaf'));}var _0x4f3583=_0x53214e[_0xfd0b('0xae')];if(this[_0xfd0b('0x88')](_0x53214e[_0xfd0b('0x7a')])){_0x4f3583+=','+_0x53214e[_0xfd0b('0x7a')];}var _0xf60be5=this[_0xfd0b('0xe')][_0xfd0b('0x56')](_0xfd0b('0xb0'),_0x4f3583);if(_0xf60be5[_0xfd0b('0xa4')]===-0x1){return _0xf60be5;}var _0xb52e6=this[_0xfd0b('0xa3')](_0xfd0b('0xb1'),_0xfd0b('0xb2'));if(_0xb52e6['result']===-0x1){return _0xb52e6;}var _0x34d4c1=this[_0xfd0b('0xa3')](_0xfd0b('0xb3'),_0xfd0b('0xb4'));if(_0x34d4c1['result']===-0x1){return _0x34d4c1;}var _0x211e01=this[_0xfd0b('0xa3')]('RECOG_INSTANCE()',_0xfd0b('0xb5'));if(_0x211e01['result']===-0x1){return _0x211e01;}return this['channel']['noop'](util['format'](_0xfd0b('0xb6'),_0x4f3583));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0xb7')]=function(_0xacf971){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0xb8'),_0xacf971[_0xfd0b('0x38')]));return this['channel'][_0xfd0b('0xb7')]([_0xacf971[_0xfd0b('0xb9')],_0xacf971[_0xfd0b('0xba')]]);};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0xbb')]=function(_0x423e14){logger['info'](util[_0xfd0b('0x29')](_0xfd0b('0xbc'),_0x423e14[_0xfd0b('0x38')]));if(this[_0xfd0b('0x88')](_0x423e14[_0xfd0b('0x66')])){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0xbd'),_0x423e14[_0xfd0b('0x66')]));var _0x44c0b7=this[_0xfd0b('0xe')][_0xfd0b('0xbe')](_0x423e14[_0xfd0b('0x66')]);if(_0x44c0b7['result']===-0x1){return _0x44c0b7;}}return this['channel'][_0xfd0b('0xbb')]();};AGIVertices[_0xfd0b('0x15')]['callback']=function(_0x399157){logger[_0xfd0b('0x2f')](util['format'](_0xfd0b('0xbf'),_0x399157[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x399157['list_id'])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x399157,_0xfd0b('0xc0'));}_0x399157[_0xfd0b('0x48')]=moment();if(this[_0xfd0b('0x88')](_0x399157[_0xfd0b('0xc1')])){_0x399157[_0xfd0b('0x48')]=moment()[_0xfd0b('0xc2')](_0x399157[_0xfd0b('0xc1')],'minutes');}if(!this['isConfigured'](_0x399157[_0xfd0b('0x4c')])){_0x399157[_0xfd0b('0x4c')]=0x2;}this[_0xfd0b('0x41')][_0xfd0b('0x70')](this,_0x399157);return this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')](_0xfd0b('0xc3'),_0x399157[_0xfd0b('0x46')],_0x399157[_0xfd0b('0x47')],_0x399157['scheduledAt']));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0xc4')]=function(_0x24ab62){logger[_0xfd0b('0x2f')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x24ab62[_0xfd0b('0x38')]));var _0x2d51ba=this[_0xfd0b('0xe')][_0xfd0b('0x56')](_0x24ab62[_0xfd0b('0xc5')],_0x24ab62[_0xfd0b('0x7a')]);if(_0x2d51ba[_0xfd0b('0xa4')]===-0x1){return _0x2d51ba;}return this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')](_0xfd0b('0xc6'),_0x24ab62[_0xfd0b('0xc5')],_0x24ab62['options']));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0xc7')]=function(_0x170e38){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0xc8'),_0x170e38[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x170e38[_0xfd0b('0x5c')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xaa'));}var _0x368c1b='\x22'+_0x170e38[_0xfd0b('0x5c')]+'\x22';if(this['isConfigured'](_0x170e38[_0xfd0b('0x7a')])){_0x368c1b+=','+_0x170e38[_0xfd0b('0x7a')];}var _0x22a3e8=this[_0xfd0b('0xe')][_0xfd0b('0x56')](_0xfd0b('0xab'),_0x368c1b);if(_0x22a3e8['result']===-0x1){return _0x22a3e8;}return this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')](_0xfd0b('0xac'),_0x368c1b));};AGIVertices[_0xfd0b('0x15')]['sestektts']=function(_0x167b11){logger[_0xfd0b('0x2f')](util['format'](_0xfd0b('0xc9'),_0x167b11[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x167b11[_0xfd0b('0x5c')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')]('no\x20text\x20configured');}var _0x36de3f='\x22'+_0x167b11[_0xfd0b('0x5c')]+'\x22';if(this[_0xfd0b('0x88')](_0x167b11['options'])){_0x36de3f+=','+_0x167b11[_0xfd0b('0x7a')];}var _0x33eeaa=this[_0xfd0b('0xe')][_0xfd0b('0x56')](_0xfd0b('0xab'),_0x36de3f);if(_0x33eeaa[_0xfd0b('0xa4')]===-0x1){return _0x33eeaa;}return this['channel']['noop'](util['format'](_0xfd0b('0xac'),_0x36de3f));};AGIVertices[_0xfd0b('0x15')]['lumenvoxasr']=function(_0x2a2b58){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x2a2b58['label']));if(!this[_0xfd0b('0x88')](_0x2a2b58['grammar'])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xaf'));}var _0x131361=_0x2a2b58[_0xfd0b('0xae')];if(this[_0xfd0b('0x88')](_0x2a2b58[_0xfd0b('0x7a')])){_0x131361+=','+_0x2a2b58[_0xfd0b('0x7a')];}var _0x62759a=this['channel'][_0xfd0b('0x56')](_0xfd0b('0xb0'),_0x131361);if(_0x62759a[_0xfd0b('0xa4')]===-0x1){return _0x62759a;}var _0x5157eb=this['getAndSetVariable'](_0xfd0b('0xb1'),_0xfd0b('0xca'));if(_0x5157eb['result']===-0x1){return _0x5157eb;}var _0xba6581=this['getAndSetVariable']('RECOG_INPUT()',_0xfd0b('0xcb'));if(_0xba6581[_0xfd0b('0xa4')]===-0x1){return _0xba6581;}var _0x4e0d2e=this[_0xfd0b('0xa3')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x4e0d2e[_0xfd0b('0xa4')]===-0x1){return _0x4e0d2e;}return this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x131361));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0xcc')]=function(_0x5765b2){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0xcd'),_0x5765b2[_0xfd0b('0x38')]));if(!this['isConfigured'](_0x5765b2[_0xfd0b('0xae')])){return this['channel'][_0xfd0b('0xa9')](_0xfd0b('0xaf'));}var _0x2dffc4=_0x5765b2[_0xfd0b('0xae')];if(this[_0xfd0b('0x88')](_0x5765b2[_0xfd0b('0x7a')])){_0x2dffc4+=','+_0x5765b2[_0xfd0b('0x7a')];}var _0x213ffa=this[_0xfd0b('0xe')][_0xfd0b('0x56')](_0xfd0b('0xb0'),_0x2dffc4);if(_0x213ffa[_0xfd0b('0xa4')]===-0x1){return _0x213ffa;}var _0x566c8f=this[_0xfd0b('0xa3')](_0xfd0b('0xb1'),_0xfd0b('0xce'));if(_0x566c8f[_0xfd0b('0xa4')]===-0x1){return _0x566c8f;}var _0x33cb1e=this['getAndSetVariable'](_0xfd0b('0xb3'),_0xfd0b('0xcf'));if(_0x33cb1e[_0xfd0b('0xa4')]===-0x1){return _0x33cb1e;}var _0x2c9709=this[_0xfd0b('0xa3')]('RECOG_INSTANCE()','SESTEK_ASR_INSTANCE');if(_0x2c9709['result']===-0x1){return _0x2c9709;}return this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')](_0xfd0b('0xb6'),_0x2dffc4));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0xd0')]=function(_0x53e3ce){logger['info'](util[_0xfd0b('0x29')](_0xfd0b('0xd1'),_0x53e3ce[_0xfd0b('0x38')]));if(!this['isConfigured'](_0x53e3ce[_0xfd0b('0xd2')])){return this['channel'][_0xfd0b('0x33')](_0x53e3ce,'no\x20database\x20selected');}var _0x1c7829=this[_0xfd0b('0xd3')][_0xfd0b('0x70')](this,_0x53e3ce[_0xfd0b('0xd2')]);if(!_0x1c7829){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x53e3ce,_0xfd0b('0xd4'));}if(!this[_0xfd0b('0x88')](_0x53e3ce[_0xfd0b('0x2e')])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x53e3ce,_0xfd0b('0xd5'));}var _0x39f327=_0x53e3ce[_0xfd0b('0x2e')][_0xfd0b('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')](_0xfd0b('0xd6'),_0x39f327));var _0x230237=this[_0xfd0b('0x2b')][_0xfd0b('0x70')](this,_0x1c7829,_0x39f327);this[_0xfd0b('0x36')][_0xfd0b('0x70')](this,_0x53e3ce,_0x39f327);if(!this['isConfigured'](_0x53e3ce['variable_id'])){return this['channel'][_0xfd0b('0xa9')](_0xfd0b('0xd7'));}var _0x4ce469=this[_0xfd0b('0x11')][_0xfd0b('0x70')](this,_0x53e3ce['variable_id']);if(!_0x4ce469){return this['channel'][_0xfd0b('0x33')](_0x53e3ce,'no\x20variable\x20found');}var _0xe6f44d=this;_0x230237[_0xfd0b('0xd8')](function(_0x7ad5d9,_0x1b59cd){Object['keys'](_0x7ad5d9)['forEach'](function(_0x204c51){_0xe6f44d['channel'][_0xfd0b('0xa0')](util[_0xfd0b('0x29')]('%s[%s][%s]',_0x4ce469,_0x1b59cd,_0x204c51),_0x7ad5d9[_0x204c51]);});});this[_0xfd0b('0xe')]['setVariable'](util['format']('%s_ROWS_COUNT',_0x4ce469),_0x230237['length']);return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')]('variable\x20%s\x20set',_0x4ce469));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0xd9')]=function(_0x2a156e){logger['debug'](util[_0xfd0b('0x29')](_0xfd0b('0xda'),_0x2a156e['label']));if(!this[_0xfd0b('0x88')](_0x2a156e[_0xfd0b('0xdb')])){return this['channel']['error'](_0x2a156e,_0xfd0b('0xdc'));}var _0x619f95=this[_0xfd0b('0xdd')][_0xfd0b('0x70')](this,_0x2a156e['sip_id']);if(!_0x619f95){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x2a156e,_0xfd0b('0xde'));}var _0x561b86=this[_0xfd0b('0xe')]['exec'](_0xfd0b('0xdf'),[util[_0xfd0b('0x29')](_0xfd0b('0xe0'),_0x619f95),_0x2a156e[_0xfd0b('0x66')],_0x2a156e['opts'],_0x2a156e['url']]);if(_0x561b86[_0xfd0b('0xa4')]===-0x1){return _0x561b86;}return this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')](_0xfd0b('0xe1'),_0xfd0b('0xdf')));};AGIVertices['prototype'][_0xfd0b('0xe2')]=function(_0x414ac5){logger[_0xfd0b('0x2f')](util['format'](_0xfd0b('0xe3'),_0x414ac5[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x414ac5[_0xfd0b('0x7c')])){return this['channel'][_0xfd0b('0xa9')](_0xfd0b('0xe4'));}if(!this['isConfigured'](_0x414ac5['text'])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xaa'));}this[_0xfd0b('0xe')][_0xfd0b('0xe5')]=!![];this['createSquareDetailsReport'](_0x414ac5);this[_0xfd0b('0x40')](_0x414ac5['text'],'in','','');this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0xe6'),_0x414ac5[_0xfd0b('0x5c')]));var _0x171c2f=this[_0xfd0b('0x7b')][_0xfd0b('0x70')](this,_0x414ac5);if(_0x171c2f){for(var _0x46808e in _0x171c2f){if(_0x171c2f['hasOwnProperty'](_0x46808e)){this['channel'][_0xfd0b('0xa0')](util[_0xfd0b('0x29')](_0xfd0b('0xe7'),_0x46808e[_0xfd0b('0xe8')]()),_0x171c2f[_0x46808e]);}}this[_0xfd0b('0x40')](_0x171c2f[_0xfd0b('0xe9')],_0xfd0b('0xea'),'dialogflow','');return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0xeb'),_0x171c2f[_0xfd0b('0xe9')]));}return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x414ac5,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0xec')]=function(_0x546e9f){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0xed'),_0x546e9f[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x546e9f[_0xfd0b('0x7f')])){return this[_0xfd0b('0xe')]['noop']('no\x20project_id\x20configured');}if(!this[_0xfd0b('0x88')](_0x546e9f[_0xfd0b('0xee')])){return this['channel'][_0xfd0b('0xa9')]('no\x20client_email\x20configured');}if(!this[_0xfd0b('0x88')](_0x546e9f['private_key'])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xef'));}if(!this[_0xfd0b('0x88')](_0x546e9f[_0xfd0b('0xf0')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xf1'));}if(!this[_0xfd0b('0x88')](_0x546e9f[_0xfd0b('0x5c')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xaa'));}this['channel'][_0xfd0b('0xe5')]=!![];this[_0xfd0b('0x36')](_0x546e9f);this[_0xfd0b('0x40')](_0x546e9f['text'],'in','','');this['channel']['noop'](util[_0xfd0b('0x29')]('Trying\x20DialogflowV2:\x20%s',_0x546e9f[_0xfd0b('0x5c')]));var _0x4b65b3=this[_0xfd0b('0x7e')][_0xfd0b('0x70')](this,_0x546e9f);if(_0x4b65b3){for(var _0x18071a in _0x4b65b3){if(_0x4b65b3['hasOwnProperty'](_0x18071a)){if(_0x18071a!==_0xfd0b('0xf2')){this['channel'][_0xfd0b('0xa0')](util['format'](_0xfd0b('0xe7'),_0x18071a[_0xfd0b('0xe8')]()),_0x4b65b3[_0x18071a]);}}}this[_0xfd0b('0x40')](_0x4b65b3[_0xfd0b('0xe9')],_0xfd0b('0xea'),_0xfd0b('0xec'),_0x4b65b3[_0xfd0b('0xf2')]);return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')]('DialogflowV2\x20Result\x20%s',_0x4b65b3[_0xfd0b('0xe9')]));}return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x546e9f,_0xfd0b('0xf3'));};AGIVertices['prototype'][_0xfd0b('0xf4')]=function(_0x3d3374){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0xf5'),_0x3d3374[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x3d3374['ndauth_url'])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xf6'));}if(!this[_0xfd0b('0x88')](_0x3d3374[_0xfd0b('0xf7')])){return this['channel'][_0xfd0b('0xa9')]('no\x20username\x20configured');}if(!this[_0xfd0b('0x88')](_0x3d3374[_0xfd0b('0xf8')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xf9'));}if(!this['isConfigured'](_0x3d3374[_0xfd0b('0xfa')])){return this[_0xfd0b('0xe')]['noop'](_0xfd0b('0xaa'));}this[_0xfd0b('0xe')][_0xfd0b('0xe5')]=!![];this[_0xfd0b('0x36')](_0x3d3374);this[_0xfd0b('0x40')](_0x3d3374[_0xfd0b('0x5c')],'in','','');this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')](_0xfd0b('0xfb'),_0x3d3374[_0xfd0b('0x5c')]));var _0x1ba0e1=this[_0xfd0b('0x81')][_0xfd0b('0x70')](this,_0x3d3374);if(_0x1ba0e1){for(var _0x3c395d in _0x1ba0e1){if(_0x1ba0e1[_0xfd0b('0x97')](_0x3c395d)){this[_0xfd0b('0xe')]['setVariable'](util[_0xfd0b('0x29')]('SESTEK_NDA_%s',_0x3c395d['toUpperCase']()),_0x1ba0e1[_0x3c395d]);}}this['createSquareMessage'](_0x1ba0e1[_0xfd0b('0xe9')],_0xfd0b('0xea'),'sesteknda','');if(_0x1ba0e1['audiofile']){this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0xfc'),_0x1ba0e1[_0xfd0b('0xfd')]));var _0x3ab852=this['channel'][_0xfd0b('0xfe')](_0x1ba0e1[_0xfd0b('0xfd')]);try{fs[_0xfd0b('0xff')](_0x1ba0e1[_0xfd0b('0xfd')]+'.wav');}catch(_0x5c6c94){logger[_0xfd0b('0x33')](_0x5c6c94);}return _0x3ab852;}else{return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x100'),_0x1ba0e1[_0xfd0b('0xe9')]));}}return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x3d3374,_0xfd0b('0x101'));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x102')]=function(_0x569374){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x103'),_0x569374[_0xfd0b('0x38')]));return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0x102'));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x104')]=function(_0xc1fb70){logger['info'](util[_0xfd0b('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0xc1fb70[_0xfd0b('0x38')]));var _0x4d2eb6='';if(_0xc1fb70[_0xfd0b('0x105')]){if(!this[_0xfd0b('0x88')](_0xc1fb70['trunk_id'])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0xc1fb70,_0xfd0b('0x106'));}else{var _0x1e6fdd=parseInt(_0xc1fb70[_0xfd0b('0x105')],0xa);if(isNaN(_0x1e6fdd)){_0x4d2eb6=_0xc1fb70['trunk_id'];}else{_0x4d2eb6=this[_0xfd0b('0x1c')]['sync'](this,_0xc1fb70[_0xfd0b('0x105')]);if(!_0x4d2eb6){return this['channel']['error'](_0xc1fb70,_0xfd0b('0x107'));}}}}else if(_0xc1fb70['trunk_name']){_0x4d2eb6=_0xc1fb70[_0xfd0b('0x108')];}else{return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0xc1fb70,_0xfd0b('0x106'));}var _0x3d235a=this['channel'][_0xfd0b('0x56')]('DIAL',[util[_0xfd0b('0x29')](_0xfd0b('0x109'),_0x4d2eb6,_0xc1fb70[_0xfd0b('0x46')]),_0xc1fb70[_0xfd0b('0x66')],_0xc1fb70[_0xfd0b('0x10a')],_0xc1fb70[_0xfd0b('0x64')]]);if(_0x3d235a['result']===-0x1){return _0x3d235a;}return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util['format']('Executed\x20command\x20%s',_0xfd0b('0xdf')));};AGIVertices[_0xfd0b('0x15')]['finally']=function(_0x10d650){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x10b'),_0x10d650[_0xfd0b('0x38')]));return this[_0xfd0b('0xe')][_0xfd0b('0xa9')]('finally');};AGIVertices[_0xfd0b('0x15')]['getdigits']=function(_0x344b30){logger['info'](util[_0xfd0b('0x29')](_0xfd0b('0x10c'),_0x344b30[_0xfd0b('0x38')]));if(_0x344b30[_0xfd0b('0xa7')]===0x0){return this['maxRetry'](_0x344b30);}_0x344b30[_0xfd0b('0xa7')]-=0x1;if(!this[_0xfd0b('0x88')](_0x344b30[_0xfd0b('0x10d')])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x344b30,_0xfd0b('0x10e'));}var _0x41ce3e=this[_0xfd0b('0x10f')]['sync'](this,_0x344b30['file_id']);if(!_0x41ce3e){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x344b30,_0xfd0b('0x110'));}if(!this['isConfigured'](_0x344b30[_0xfd0b('0x111')])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0xfd0b('0xd7'));}var _0x26a258=this[_0xfd0b('0xe')][_0xfd0b('0x112')](_0x41ce3e,_0x344b30['response'],_0x344b30[_0xfd0b('0x113')]);var _0x4e4c33=_0x26a258[_0xfd0b('0xa4')]?_0x26a258[_0xfd0b('0xa4')][_0xfd0b('0x4b')]():'';logger['info'](_0xfd0b('0x114'),JSON[_0xfd0b('0x74')](_0x26a258));if(_0x26a258[_0xfd0b('0xa4')]===-0x1){this[_0xfd0b('0x36')][_0xfd0b('0x70')](this,_0x344b30,_0x4e4c33);return _0x26a258;}else if(_0x26a258['extra']===_0xfd0b('0x66')){_0x26a258[_0xfd0b('0xa4')]=_0x4e4c33[_0xfd0b('0x9c')]>=parseInt(_0x344b30['mindigit'])?'x':'i';}else{_0x26a258[_0xfd0b('0xa4')]=_0x4e4c33[_0xfd0b('0x9c')]>=parseInt(_0x344b30[_0xfd0b('0x115')])&&_0x4e4c33[_0xfd0b('0x9c')]<=parseInt(_0x344b30[_0xfd0b('0x113')])?'x':'i';}var _0x30cad9=this[_0xfd0b('0x11')][_0xfd0b('0x70')](this,_0x344b30[_0xfd0b('0x111')]);if(!_0x30cad9){return this['channel'][_0xfd0b('0x33')](_0x344b30,_0xfd0b('0x116'));}this[_0xfd0b('0xe')][_0xfd0b('0xa0')](_0x30cad9,_0x4e4c33);if(this[_0xfd0b('0x88')](_0x344b30[_0xfd0b('0x117')])){var _0x1132bf=parseInt(_0x344b30[_0xfd0b('0x117')],0xa);var _0x123d8b=rs[_0xfd0b('0x118')]({'charset':'*','length':_0x1132bf});var _0x22f01b=_0x4e4c33[_0xfd0b('0x9c')];if(_0x22f01b>0x0){if(_0x22f01b>_0x1132bf){this[_0xfd0b('0x36')][_0xfd0b('0x70')](this,_0x344b30,_0x344b30['hiddendigitspos']===_0xfd0b('0x119')?_0x123d8b+_0x4e4c33[_0xfd0b('0x11a')](_0x1132bf):_0x4e4c33[_0xfd0b('0x11a')](0x0,_0x22f01b-_0x1132bf)+_0x123d8b);}else{this['createSquareDetailsReport'][_0xfd0b('0x70')](this,_0x344b30,rs[_0xfd0b('0x118')]({'charset':'*','length':_0x22f01b}));}}else{this[_0xfd0b('0x36')][_0xfd0b('0x70')](this,_0x344b30,'');}}else{this[_0xfd0b('0x36')][_0xfd0b('0x70')](this,_0x344b30,_0x4e4c33);}return _0x26a258;};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x11b')]=function(_0x5283a2){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x11c'),_0x5283a2[_0xfd0b('0x38')]));return this[_0xfd0b('0xd')](_0x5283a2);};AGIVertices[_0xfd0b('0x15')]['goal']=function(_0x3886c4){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x11d'),_0x3886c4[_0xfd0b('0x38')]));this[_0xfd0b('0x36')][_0xfd0b('0x70')](this,_0x3886c4,_0x3886c4[_0xfd0b('0x11e')]);return this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')]('GOAL\x20%s',_0x3886c4[_0xfd0b('0x11e')]));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x11f')]=function(_0x39a660){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x120'),_0x39a660['label']));if(!this[_0xfd0b('0x88')](_0x39a660[_0xfd0b('0x8b')])||!this[_0xfd0b('0x88')](_0x39a660[_0xfd0b('0x8c')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0x121'));}if(!this[_0xfd0b('0x88')](_0x39a660[_0xfd0b('0x5c')])){return this[_0xfd0b('0xe')]['noop'](_0xfd0b('0xaa'));}this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util['format'](_0xfd0b('0x122'),_0x39a660[_0xfd0b('0x5c')]));var _0x3506b2=this[_0xfd0b('0x8a')][_0xfd0b('0x70')](this,_0x39a660);if(_0x3506b2){this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util['format'](_0xfd0b('0x123'),_0x3506b2));var _0x5a7288=this[_0xfd0b('0xe')]['streamFile'](_0x3506b2);try{fs['unlink'](_0x3506b2+_0xfd0b('0x124'));}catch(_0x2581d1){logger[_0xfd0b('0x33')](_0x2581d1);}return _0x5a7288;}return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x39a660,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x125')]=function(_0x38295e){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x126'),_0x38295e[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x38295e['aws_access_key_id'])||!this['isConfigured'](_0x38295e['aws_secret_access_key'])){return this['channel']['noop'](_0xfd0b('0x121'));}if(!this['isConfigured'](_0x38295e[_0xfd0b('0x90')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x38295e[_0xfd0b('0x5c')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xaa'));}this['channel']['bot']=!![];this[_0xfd0b('0x36')](_0x38295e);this[_0xfd0b('0x40')](_0x38295e['text'],'in','','');this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')]('Trying\x20Amazon\x20Lex:\x20%s',_0x38295e[_0xfd0b('0x5c')]));var _0xbf9c4d=this[_0xfd0b('0x8f')][_0xfd0b('0x70')](this,_0x38295e);if(_0xbf9c4d){for(var _0x32c715 in _0xbf9c4d){if(_0xbf9c4d[_0xfd0b('0x97')](_0x32c715)&&_[_0xfd0b('0x98')](_0xbf9c4d[_0x32c715])){this[_0xfd0b('0xe')][_0xfd0b('0xa0')](util[_0xfd0b('0x29')]('AWS_LEX_%s',_0x32c715[_0xfd0b('0xe8')]()),_0xbf9c4d[_0x32c715]);}}if(_[_0xfd0b('0x42')](_0xbf9c4d['message'])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0x127'));}else{this[_0xfd0b('0x40')](_0xbf9c4d['message'],_0xfd0b('0xea'),_0xfd0b('0x128'),'');return this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')](_0xfd0b('0x129'),_0xbf9c4d[_0xfd0b('0x78')]));}}return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x38295e,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0xfd0b('0x15')]['googleasr']=function(_0x1eb7dc){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x1eb7dc[_0xfd0b('0x38')],_0x1eb7dc[_0xfd0b('0x66')]));if(!this['isConfigured'](_0x1eb7dc[_0xfd0b('0x7c')])){return this['channel']['noop'](_0xfd0b('0xe4'));}var _0x497c05=_0xfd0b('0x12a');var _0x32aeb3=util[_0xfd0b('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0xfd0b('0x118')](0x4));var _0x4f0404=util[_0xfd0b('0x29')]('%s.%s',_0x32aeb3,_0x497c05);var _0x4b3b78=!![];if(_0x1eb7dc[_0xfd0b('0x12b')]===_0xfd0b('0x12c')){_0x4b3b78=![];}var _0x41a9a2=this[_0xfd0b('0xe')][_0xfd0b('0x12d')](_0x32aeb3,_0x497c05,_0x1eb7dc['intKey'],_0x1eb7dc[_0xfd0b('0x66')],undefined,_0x4b3b78);if(_0x41a9a2[_0xfd0b('0xa4')]!==-0x1){this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x12e'),_0x4f0404));var _0x4293cc=this['googleASR']['sync'](this,_0x1eb7dc,_0x4f0404);if(_0x4293cc){for(var _0xacaf1b in _0x4293cc){if(_0x4293cc[_0xfd0b('0x97')](_0xacaf1b)){this['channel'][_0xfd0b('0xa0')](util['format']('GOOGLE_ASR_%s',_0xacaf1b[_0xfd0b('0xe8')]()),_0x4293cc[_0xacaf1b]);}}return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x12f'),JSON[_0xfd0b('0x74')](_0x4293cc)));}}return _0x41a9a2;};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x130')]=function(_0x2ca76d){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x2ca76d[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x2ca76d[_0xfd0b('0x93')])){return this['channel'][_0xfd0b('0xa9')]('no\x20appid\x20configured');}if(!this[_0xfd0b('0x88')](_0x2ca76d[_0xfd0b('0x94')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')]('no\x20appsecret\x20configured');}var _0x50b802=_0xfd0b('0x12a');var _0x1a4db6=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xfd0b('0x118')](0x4));var _0x2e798a=util['format'](_0xfd0b('0x9f'),_0x1a4db6,_0x50b802);var _0x34590a=!![];if(_0x2ca76d[_0xfd0b('0x12b')]==='NOBEEP'){_0x34590a=![];}var _0x2855b2=this['channel']['recordFile'](_0x1a4db6,_0x50b802,_0x2ca76d['intKey'],_0x2ca76d[_0xfd0b('0x66')],undefined,_0x34590a);if(_0x2855b2[_0xfd0b('0xa4')]!==-0x1){this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')](_0xfd0b('0x131'),_0x2e798a));var _0x565bbb=this['tildeASR']['sync'](this,_0x2ca76d,_0x2e798a);if(_0x565bbb){for(var _0x4b6fcf in _0x565bbb){if(_0x565bbb[_0xfd0b('0x97')](_0x4b6fcf)){this[_0xfd0b('0xe')][_0xfd0b('0xa0')](util[_0xfd0b('0x29')]('TILDE_ASR_%s',_0x4b6fcf['toUpperCase']()),_0x565bbb[_0x4b6fcf]);}}return this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x132'),JSON[_0xfd0b('0x74')](_0x565bbb)));}}return _0x2855b2;};AGIVertices['prototype'][_0xfd0b('0x133')]=function(_0x34c071){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x34c071['label']));return this[_0xfd0b('0xe')][_0xfd0b('0x134')](_0x34c071[_0xfd0b('0x3d')],_0x34c071[_0xfd0b('0x135')],_0x34c071[_0xfd0b('0x3e')]);};AGIVertices['prototype']['gotoif']=function(_0x4999c6){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x136'),_0x4999c6[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x4999c6[_0xfd0b('0x137')])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x4999c6,_0xfd0b('0x138'));}try{var _0x11078e=eval(_0x4999c6[_0xfd0b('0x137')])?_0xfd0b('0x139'):'false';this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4999c6[_0xfd0b('0x137')],_0x11078e));return{'code':0xc8,'result':_0x11078e};}catch(_0x24a04d){return{'code':0xc8,'result':_0xfd0b('0x13a')};}};AGIVertices[_0xfd0b('0x15')]['gotoiftime']=function(_0x35a5f6){logger['info'](util['format'](_0xfd0b('0x13b'),_0x35a5f6['label']));if(!this[_0xfd0b('0x88')](_0x35a5f6[_0xfd0b('0x13c')])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x35a5f6,'no\x20interval\x20configured');}var _0x5d0005=this['getIntervals'][_0xfd0b('0x70')](this,_0x35a5f6['interval_id']);if(!_0x5d0005){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x35a5f6,_0xfd0b('0x13d'));}for(var _0x30976d=0x0;_0x30976d<_0x5d0005[_0xfd0b('0x9c')];_0x30976d+=0x1){var _0x2f39c3=this[_0xfd0b('0xe')][_0xfd0b('0x11')](util[_0xfd0b('0x29')]('IFTIME(%s?true:false)',_0x5d0005[_0x30976d]));if(_0x2f39c3[_0xfd0b('0xa4')]===-0x1){return _0x2f39c3;}logger['info'](util[_0xfd0b('0x29')](_0xfd0b('0x13e'),_0x5d0005[_0x30976d],_0x2f39c3[_0xfd0b('0x13f')]));if(_0x2f39c3[_0xfd0b('0x13f')]==='true'){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x13e'),_0x5d0005[_0x30976d],_0xfd0b('0x139')));this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x13e'),_0x5d0005[_0x30976d],'true'));return{'code':0xc8,'result':'true'};}else{logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x13e'),_0x5d0005[_0x30976d],_0xfd0b('0x13a')));this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x13e'),_0x5d0005[_0x30976d],_0xfd0b('0x13a')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xfd0b('0x15')]['hangup']=function(_0x1251fb){logger[_0xfd0b('0x2f')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1251fb['label']));return this[_0xfd0b('0xe')]['hangup']();};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x140')]=function(_0x4c5663){logger[_0xfd0b('0x2f')](util['format'](_0xfd0b('0x141'),_0x4c5663[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x4c5663[_0xfd0b('0x7c')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')]('no\x20key\x20configured');}var _0x3a14a3=_0xfd0b('0x12a');var _0x3e05aa=util[_0xfd0b('0x29')](_0xfd0b('0x142'),FILES_PATH,rs[_0xfd0b('0x118')](0x4));var _0x2ae2b9=util['format'](_0xfd0b('0x9f'),_0x3e05aa,_0x3a14a3);var _0x5d0f53=!![];if(_0x4c5663[_0xfd0b('0x12b')]===_0xfd0b('0x12c')){_0x5d0f53=![];}var _0x3de156=this['channel'][_0xfd0b('0x12d')](_0x3e05aa,_0x3a14a3,_0x4c5663['intKey'],_0x4c5663[_0xfd0b('0x66')],undefined,_0x5d0f53);if(_0x3de156[_0xfd0b('0xa4')]!==-0x1){this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x143'),_0x2ae2b9));var _0x3079fa=this[_0xfd0b('0x86')]['sync'](this,_0x4c5663,_0x2ae2b9);if(_0x3079fa){for(var _0x7941ad in _0x3079fa){if(_0x3079fa[_0xfd0b('0x97')](_0x7941ad)){this[_0xfd0b('0xe')][_0xfd0b('0xa0')](util['format'](_0xfd0b('0x144'),_0x7941ad[_0xfd0b('0xe8')]()),_0x3079fa[_0x7941ad]);}}return this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x145'),JSON['stringify'](_0x3079fa)));}}return _0x3de156;};AGIVertices[_0xfd0b('0x15')]['ispeechtts']=function(_0x539fb9){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x146'),_0x539fb9[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x539fb9[_0xfd0b('0x7c')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xe4'));}if(!this['isConfigured'](_0x539fb9[_0xfd0b('0x5c')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xaa'));}this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util['format'](_0xfd0b('0x147'),_0x539fb9[_0xfd0b('0x5c')]));var _0x2a8bd7=this[_0xfd0b('0x82')][_0xfd0b('0x70')](this,_0x539fb9);if(_0x2a8bd7){this['channel']['noop'](util[_0xfd0b('0x29')]('ispeech\x20%s\x20file\x20created',_0x2a8bd7));var _0x1a64e5=this[_0xfd0b('0xe')][_0xfd0b('0xfe')](_0x2a8bd7,_0x539fb9[_0xfd0b('0x148')]);try{fs[_0xfd0b('0xff')](_0x2a8bd7+_0xfd0b('0x124'));}catch(_0x440e2a){logger[_0xfd0b('0x33')](_0x440e2a);}return _0x1a64e5;}return this[_0xfd0b('0xe')]['error'](_0x539fb9,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x149')]=function(_0x2d82c0){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x14a'),_0x2d82c0[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x2d82c0['findBy'])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x2d82c0,_0xfd0b('0x14b'));}logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xfd0b('0x3c')],_0x2d82c0[_0xfd0b('0x14c')]));var _0x5bf7df=this[_0xfd0b('0x53')][_0xfd0b('0x70')](this,_0x2d82c0[_0xfd0b('0x14c')]);if(_0x5bf7df){logger[_0xfd0b('0x2f')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xfd0b('0xe')]['callerid'],_0x2d82c0['findBy']));this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x14d'),this['channel'][_0xfd0b('0x3c')],_0x2d82c0[_0xfd0b('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xfd0b('0x2f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfd0b('0xe')][_0xfd0b('0x3c')],_0x2d82c0[_0xfd0b('0x14c')]));this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x14e'),this[_0xfd0b('0xe')][_0xfd0b('0x3c')],_0x2d82c0['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x14f')]=function(_0x5c9339){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x5c9339['label']));if(!this[_0xfd0b('0x88')](_0x5c9339['findBy'])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x5c9339,_0xfd0b('0x14b'));}logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x150'),this[_0xfd0b('0xe')][_0xfd0b('0x3c')],_0x5c9339[_0xfd0b('0x14c')]));var _0x82444f=this[_0xfd0b('0x52')][_0xfd0b('0x70')](this,_0x5c9339[_0xfd0b('0x14c')]);if(_0x82444f){logger['info'](util[_0xfd0b('0x29')](_0xfd0b('0x14d'),this[_0xfd0b('0xe')][_0xfd0b('0x3c')],_0x5c9339[_0xfd0b('0x14c')]));this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x14d'),this[_0xfd0b('0xe')][_0xfd0b('0x3c')],_0x5c9339[_0xfd0b('0x14c')]));return{'code':0xc8,'result':_0xfd0b('0x151')};}else{logger[_0xfd0b('0x2f')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xfd0b('0xe')]['callerid'],_0x5c9339[_0xfd0b('0x14c')]));this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x14e'),this['channel'][_0xfd0b('0x3c')],_0x5c9339[_0xfd0b('0x14c')]));return{'code':0xc8,'result':_0xfd0b('0x152')};}};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x153')]=function(_0x3a12af){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x3a12af[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x3a12af['operation'])){return this['channel'][_0xfd0b('0x33')](_0x3a12af,'no\x20operation\x20configured');}this['channel']['noop'](util[_0xfd0b('0x29')]('math\x20%s',_0x3a12af[_0xfd0b('0x154')]));var _0x481e99=eval(_0x3a12af[_0xfd0b('0x154')]);if(!this[_0xfd0b('0x88')](_0x3a12af[_0xfd0b('0x111')])){return this['channel']['noop'](_0xfd0b('0xd7'));}var _0x393741=this[_0xfd0b('0x11')][_0xfd0b('0x70')](this,_0x3a12af[_0xfd0b('0x111')]);if(!_0x393741){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x3a12af,'no\x20variable\x20found');}if(_[_0xfd0b('0x9b')](_0x481e99)){var _0x5db104=this;_0x481e99[_0xfd0b('0xd8')](function(_0x578a79,_0x1da0fd){_0x5db104[_0xfd0b('0xe')][_0xfd0b('0xa0')](util[_0xfd0b('0x29')](_0xfd0b('0x155'),_0x393741,_0x1da0fd),_0x578a79);});return this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')](_0xfd0b('0x156'),_0x393741));}else{return this[_0xfd0b('0xe')][_0xfd0b('0xa0')](_0x393741,_0x481e99);}};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0xc')]=function(_0x3bd682){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x157'),_0x3bd682[_0xfd0b('0x38')]));if(_0x3bd682['retry']===0x0){return this[_0xfd0b('0xa6')](_0x3bd682);}_0x3bd682[_0xfd0b('0xa7')]-=0x1;if(!this[_0xfd0b('0x88')](_0x3bd682[_0xfd0b('0x10d')])){return this['channel'][_0xfd0b('0x33')](_0x3bd682,_0xfd0b('0x10e'));}var _0x1305d4=this[_0xfd0b('0x10f')][_0xfd0b('0x70')](this,_0x3bd682['file_id']);if(!_0x1305d4){return this['channel'][_0xfd0b('0x33')](_0x3bd682,_0xfd0b('0x110'));}var _0x338058=this[_0xfd0b('0xe')][_0xfd0b('0x112')](_0x1305d4,_0x3bd682[_0xfd0b('0x158')],_0x3bd682[_0xfd0b('0x159')]);var _0x5ccdde=_0x338058['result'];if(_0x338058['result']===-0x1){this[_0xfd0b('0x36')][_0xfd0b('0x70')](this,_0x3bd682,'-1');return _0x338058;}else if(_0x338058[_0xfd0b('0x13f')]===_0xfd0b('0x66')){_0x338058['result']=_0x338058[_0xfd0b('0xa4')][_0xfd0b('0x9c')]>0x0?_0x338058[_0xfd0b('0xa4')]:'t';}else if(_['isEmpty'](_0x338058['result'])){_0x338058[_0xfd0b('0xa4')]='#';_0x5ccdde='#';}if(!this[_0xfd0b('0x88')](_0x3bd682[_0xfd0b('0x111')])){this[_0xfd0b('0xe')][_0xfd0b('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x3c3611=this['getVariable'][_0xfd0b('0x70')](this,_0x3bd682[_0xfd0b('0x111')]);if(!_0x3c3611){return this[_0xfd0b('0xe')]['error'](_0x3bd682,_0xfd0b('0x116'));}this[_0xfd0b('0xe')][_0xfd0b('0xa0')](_0x3c3611,_0x5ccdde);}this['createSquareDetailsReport'][_0xfd0b('0x70')](this,_0x3bd682,_0x5ccdde);return _0x338058;};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0xa9')]=function(_0x5703c0){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x15a'),_0x5703c0[_0xfd0b('0x38')]));return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0x5703c0[_0xfd0b('0x15b')]||_0x5703c0[_0xfd0b('0x38')]);};AGIVertices['prototype']['pause']=function(_0x34c475){logger[_0xfd0b('0x2f')](util['format'](_0xfd0b('0x15c'),_0x34c475[_0xfd0b('0x38')]));if(!this['isConfigured'](_0x34c475[_0xfd0b('0x14c')])){return this['channel'][_0xfd0b('0x33')](_0x34c475,_0xfd0b('0x14b'));}logger['info'](util[_0xfd0b('0x29')](_0xfd0b('0x150'),this[_0xfd0b('0xe')][_0xfd0b('0x3c')],_0x34c475[_0xfd0b('0x14c')]));var _0x194c47=this[_0xfd0b('0x4d')]['sync'](this,_0x34c475[_0xfd0b('0x15d')]);var _0x1a153e=this[_0xfd0b('0x4f')]['sync'](this,_0x34c475[_0xfd0b('0x14c')],_0x194c47);if(_0x1a153e){logger[_0xfd0b('0x2f')](util['format'](_0xfd0b('0x14d'),this['channel'][_0xfd0b('0x3c')],_0x34c475[_0xfd0b('0x14c')]));this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x14d'),this['channel'][_0xfd0b('0x3c')],_0x34c475[_0xfd0b('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0xfd0b('0x29')](_0xfd0b('0x14e'),this[_0xfd0b('0xe')][_0xfd0b('0x3c')],_0x34c475['findBy']));this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util['format'](_0xfd0b('0x14d'),this[_0xfd0b('0xe')]['callerid'],_0x34c475['findBy']));return{'code':0xc8,'result':_0xfd0b('0x152')};}};AGIVertices['prototype'][_0xfd0b('0x15e')]=function(_0x1ee107){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x15f'),_0x1ee107[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x1ee107[_0xfd0b('0x10d')])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x1ee107,_0xfd0b('0x10e'));}var _0x4c9c94=this[_0xfd0b('0x10f')]['sync'](this,_0x1ee107[_0xfd0b('0x10d')]);if(!_0x4c9c94){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x1ee107,_0xfd0b('0x110'));}var _0xd93a97=this[_0xfd0b('0xe')][_0xfd0b('0x56')](_0xfd0b('0x160'),[_0x4c9c94,_0x1ee107[_0xfd0b('0x10a')]]);if(_0xd93a97[_0xfd0b('0xa4')]===-0x1){return _0xd93a97;}return this[_0xfd0b('0xe')]['noop'](util[_0xfd0b('0x29')]('Executed\x20command\x20%s\x20%s',_0xfd0b('0x160'),_0x4c9c94));};AGIVertices[_0xfd0b('0x15')]['queue']=function(_0x162f5d){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x161'),_0x162f5d['label']));if(!this[_0xfd0b('0x88')](_0x162f5d['queue_id'])){return this['channel'][_0xfd0b('0x33')](_0x162f5d,_0xfd0b('0x162'));}var _0xc793e4='';var _0x2b90f8=parseInt(_0x162f5d[_0xfd0b('0x163')],0xa);if(isNaN(_0x2b90f8)){_0xc793e4=_0x162f5d['queue_id'];}else{_0xc793e4=this[_0xfd0b('0x16')][_0xfd0b('0x70')](this,_0x162f5d[_0xfd0b('0x163')]);if(!_0xc793e4){return this['channel'][_0xfd0b('0x33')](_0x162f5d,_0xfd0b('0x164'));}}var _0x3b5bcd='';if(this[_0xfd0b('0x88')](_0x162f5d[_0xfd0b('0x10d')])){var _0x571f17=this[_0xfd0b('0x10f')][_0xfd0b('0x70')](this,_0x162f5d[_0xfd0b('0x10d')]);if(_0x571f17){_0x3b5bcd=_0x571f17;}}this['createSquareDetailsReport']['sync'](this,_0x162f5d,_0xc793e4);if(_0x162f5d[_0xfd0b('0x10a')][_0xfd0b('0x165')]('x')<0x0){_0x162f5d['opts']+='x';}if(_0x162f5d[_0xfd0b('0x10a')][_0xfd0b('0x165')]('X')<0x0){_0x162f5d[_0xfd0b('0x10a')]+='X';}this[_0xfd0b('0xe')][_0xfd0b('0xa0')](_0xfd0b('0x166'),_0xc793e4?_0xc793e4[_0xfd0b('0x167')]():'');var _0xbfdbbd=this[_0xfd0b('0xe')][_0xfd0b('0x56')]('QUEUE',[_0xc793e4,_0x162f5d[_0xfd0b('0x10a')],_0x162f5d[_0xfd0b('0x64')],_0x3b5bcd,_0x162f5d[_0xfd0b('0x66')],_0x162f5d[_0xfd0b('0xb7')],_0x162f5d[_0xfd0b('0x168')],_0x162f5d[_0xfd0b('0x169')],'',_0x162f5d[_0xfd0b('0x16a')]]);if(_0xbfdbbd[_0xfd0b('0xa4')]===-0x1){return _0xbfdbbd;}return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util['format'](_0xfd0b('0xc6'),_0xfd0b('0x16b'),_0xc793e4));};AGIVertices['prototype'][_0xfd0b('0x16c')]=function(_0x4ef114){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4ef114[_0xfd0b('0x38')]));var _0x518f97=_0x4ef114[_0xfd0b('0x16d')]||_0xfd0b('0x12a');var _0x5627c1=util[_0xfd0b('0x29')]('%s_%s',this['channel']['uniqueid'],rs[_0xfd0b('0x118')](0x5));var _0xc3370=util[_0xfd0b('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x5627c1,_0x518f97);var _0x497cbc=util[_0xfd0b('0x29')]('%s/recordings/%s',FILES_PATH,_0x5627c1);this[_0xfd0b('0x3b')][_0xfd0b('0x70')](this,_0x4ef114,_0x5627c1,_0xc3370);this[_0xfd0b('0xe')][_0xfd0b('0xa0')](_0xfd0b('0x16e'),_0x5627c1);logger[_0xfd0b('0x2f')](_0xfd0b('0x16f'),_0x497cbc,_0x518f97,_0x4ef114[_0xfd0b('0x170')],_0x4ef114[_0xfd0b('0x66')]);return this[_0xfd0b('0xe')][_0xfd0b('0x12d')](_0x497cbc,_0x518f97,_0x4ef114['escape_digits'],_0x4ef114[_0xfd0b('0x66')],undefined,!![]);};AGIVertices[_0xfd0b('0x15')]['restapi']=function(_0x4be5d8){logger[_0xfd0b('0x2f')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x4be5d8[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x4be5d8[_0xfd0b('0x64')])){return this['channel'][_0xfd0b('0xa9')](_0xfd0b('0x171'));}var _0x27cffb=this[_0xfd0b('0x63')][_0xfd0b('0x70')](this,_0x4be5d8);logger[_0xfd0b('0x2f')](util['format'](_0xfd0b('0x172'),util[_0xfd0b('0x173')](_0x27cffb,{'showHidden':![],'depth':null})));if(!this[_0xfd0b('0x88')](_0x4be5d8[_0xfd0b('0x111')])){return this[_0xfd0b('0xe')]['noop'](_0xfd0b('0x174'));}var _0x90a7b3=this['getVariable']['sync'](this,_0x4be5d8[_0xfd0b('0x111')]);if(!_0x90a7b3){return this[_0xfd0b('0xe')]['error'](_0x4be5d8,_0xfd0b('0x116'));}this[_0xfd0b('0xe')][_0xfd0b('0xa0')](util[_0xfd0b('0x29')]('%s_STATUS_CODE',_0x90a7b3),_0x27cffb['statusCode']?_0x27cffb[_0xfd0b('0x76')]:_0xfd0b('0x175'));this[_0xfd0b('0xe')]['setVariable'](util[_0xfd0b('0x29')](_0xfd0b('0x176'),_0x90a7b3),_0x27cffb[_0xfd0b('0x77')]?_0x27cffb[_0xfd0b('0x77')]:'OK');if(_0x27cffb['body']){try{this['saveRestApiResult'](_0x27cffb[_0xfd0b('0x73')],_0x90a7b3);}catch(_0x264171){logger[_0xfd0b('0x33')](util[_0xfd0b('0x29')](_0xfd0b('0x177'),_0x90a7b3));}}return this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x178'),_0x90a7b3));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x179')]=function(_0x141f86){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x17a'),_0x141f86['label']));return this[_0xfd0b('0xe')]['sayDigits'](_0x141f86[_0xfd0b('0x17b')][_0xfd0b('0x58')](/\s+/g,''),_0x141f86['escape_digits']);};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x17c')]=function(_0x2152b2){logger['info'](util[_0xfd0b('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x2152b2[_0xfd0b('0x38')]));return this[_0xfd0b('0xe')][_0xfd0b('0x17d')](_0x2152b2['number'][_0xfd0b('0x58')](/\s+/g,''),_0x2152b2[_0xfd0b('0x170')]);};AGIVertices[_0xfd0b('0x15')]['sayphonetic']=function(_0x204750){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x17e'),_0x204750['label']));return this[_0xfd0b('0xe')]['sayPhonetic'](_0x204750[_0xfd0b('0x5c')],_0x204750[_0xfd0b('0x170')]);};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x17f')]=function(_0x24b6f9){logger[_0xfd0b('0x2f')](util['format'](_0xfd0b('0x180'),_0x24b6f9[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x24b6f9[_0xfd0b('0x181')])){return this[_0xfd0b('0xe')]['noop'](_0xfd0b('0x182'));}var _0x1edf64=this['getMailAccount'][_0xfd0b('0x70')](this,_0x24b6f9[_0xfd0b('0x181')]);if(!_0x1edf64||!_0x1edf64[_0xfd0b('0x183')]){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x24b6f9,'no\x20mail\x20account\x20found');}var _0x2a0f98={'from':util[_0xfd0b('0x29')](_0xfd0b('0x184'),_0x1edf64['name'],_0x1edf64['email']||_0x1edf64['Smtp']['user']),'to':_0x24b6f9['to']||'','cc':_0x24b6f9['cc']||'','bcc':_0x24b6f9[_0xfd0b('0x185')]||'','subject':_0x24b6f9[_0xfd0b('0x186')],'html':_0x24b6f9[_0xfd0b('0x5c')],'text':_0x24b6f9['text']};var _0x4d0a12={'tls':{'rejectUnauthorized':![]}};if(_0x1edf64[_0xfd0b('0x183')][_0xfd0b('0x187')]){_0x4d0a12[_0xfd0b('0x187')]=_0x1edf64[_0xfd0b('0x183')][_0xfd0b('0x187')];}else{_0x4d0a12[_0xfd0b('0x188')]=_0x1edf64[_0xfd0b('0x183')]['host'];_0x4d0a12[_0xfd0b('0x189')]=_0x1edf64[_0xfd0b('0x183')][_0xfd0b('0x189')];_0x4d0a12[_0xfd0b('0x18a')]=_0x1edf64[_0xfd0b('0x183')][_0xfd0b('0x18a')];}if(_0x1edf64['Smtp'][_0xfd0b('0x18b')]){_0x4d0a12[_0xfd0b('0x18c')]={'user':_0x1edf64[_0xfd0b('0x183')][_0xfd0b('0x18d')],'pass':_0x1edf64['Smtp']['pass']};}if(this['isConfigured'](_0x24b6f9[_0xfd0b('0x18e')])){}logger[_0xfd0b('0x18f')](_0xfd0b('0x190'),JSON[_0xfd0b('0x74')](_0x2a0f98));this['createSquareDetailsReport'][_0xfd0b('0x70')](this,_0x24b6f9,_0x24b6f9[_0xfd0b('0x181')]);this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x191'),_0x1edf64[_0xfd0b('0x13')]));this[_0xfd0b('0x23')][_0xfd0b('0x70')](this,_0x4d0a12,_0x2a0f98);return this[_0xfd0b('0xe')][_0xfd0b('0xa9')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xfd0b('0x15')]['sendFax']=function(_0x169066){logger[_0xfd0b('0x2f')](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x169066[_0xfd0b('0x38')]));return this[_0xfd0b('0xe')]['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0xfd0b('0x15')]['sendSMS']=function(_0x3d01eb){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x192'),_0x3d01eb['label']));if(!this[_0xfd0b('0x88')](_0x3d01eb[_0xfd0b('0x193')])){return this['channel'][_0xfd0b('0xa9')](_0xfd0b('0x194'));}var _0x1197d4=this[_0xfd0b('0x195')][_0xfd0b('0x70')](this,_0x3d01eb[_0xfd0b('0x193')]);if(!_0x1197d4){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x3d01eb,'no\x20sms\x20account\x20found');}var _0x3628a2={'body':_0x3d01eb[_0xfd0b('0x196')],'phone':_0x3d01eb['to']||'','SmsAccountId':_0x1197d4['id']};logger[_0xfd0b('0x18f')](_0xfd0b('0x197'),JSON[_0xfd0b('0x74')](_0x3628a2));this[_0xfd0b('0x36')][_0xfd0b('0x70')](this,_0x3d01eb,_0x3d01eb[_0xfd0b('0x193')]);this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x198'),_0x1197d4[_0xfd0b('0x13')]));this[_0xfd0b('0x35')]['sync'](this,_0x3628a2);return this[_0xfd0b('0xe')]['noop'](_0xfd0b('0x199'));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x19a')]=function(_0x2f510f){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x2f510f[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x2f510f[_0xfd0b('0x111')])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x2f510f,_0xfd0b('0x19b'));}var _0x576352=this[_0xfd0b('0x11')][_0xfd0b('0x70')](this,_0x2f510f[_0xfd0b('0x111')]);if(!_0x576352){return this['channel'][_0xfd0b('0x33')](_0x2f510f,_0xfd0b('0x116'));}return this['channel'][_0xfd0b('0xa0')](_0x576352,_0x2f510f[_0xfd0b('0x19c')]);};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x19d')]=function(_0xf28882){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x19e'),_0xf28882[_0xfd0b('0x38')]));this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0x19f'));if(_0xf28882[_0xfd0b('0xbb')]===_0xfd0b('0x1a0')){this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0x1a1'));return this[_0xfd0b('0xe')]['answer']();}return this['channel'][_0xfd0b('0xa9')](_0xfd0b('0x1a2'));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x1a3')]=function(_0x3eb46b){logger['info'](util['format'](_0xfd0b('0x1a4'),_0x3eb46b[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x3eb46b['project_id'])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x3eb46b,_0xfd0b('0x1a5'));}var _0x1ccc88=this['getSquareProject'][_0xfd0b('0x70')](this,_0x3eb46b[_0xfd0b('0x1a6')]);if(!this['isConfigured'](_0x1ccc88)){return this[_0xfd0b('0xe')]['error'](_0x3eb46b,util['format'](_0xfd0b('0x1a7'),_0x3eb46b['project_id']));}if(_0x1ccc88===this[_0xfd0b('0xe')][_0xfd0b('0x3a')]){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x3eb46b,_0xfd0b('0x1a8'));}this[_0xfd0b('0x36')][_0xfd0b('0x70')](this,_0x3eb46b,_0x1ccc88);var _0x1cc614=this[_0xfd0b('0xe')][_0xfd0b('0x56')](_0xfd0b('0x1a9'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config['agi']['host']||_0xfd0b('0x1aa'),_0x1ccc88,this[_0xfd0b('0xe')]['arg_1']));if(_0x1cc614[_0xfd0b('0xa4')]===-0x1){return _0x1cc614;}return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0xc6'),'AGI',_0x1ccc88));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x1ab')]=function(_0x324115){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x1ac'),_0x324115[_0xfd0b('0x38')]));var _0x5c3d51=this[_0xfd0b('0x1ad')][_0xfd0b('0x70')](this,_0x324115['command']);this['createSquareDetailsReport']['sync'](this,_0x324115,_0x324115['command']);if(this[_0xfd0b('0x88')](_0x324115[_0xfd0b('0x111')])){var _0x5c01d4=this[_0xfd0b('0x11')][_0xfd0b('0x70')](this,_0x324115[_0xfd0b('0x111')]);if(_0x5c01d4){this[_0xfd0b('0xe')]['setVariable'](_0x5c01d4,_0x5c3d51);return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x1ae'),_0x324115[_0xfd0b('0xb9')],_0x5c01d4));}}return this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x324115[_0xfd0b('0xb9')]));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x1af')]=function(_0x593f65){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x1b0'),_0x593f65[_0xfd0b('0x38')]));_0x593f65[_0xfd0b('0x5c')]=_0x593f65[_0xfd0b('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x593f65['apiKey'])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0x1b1'));}if(!this['isConfigured'](_0x593f65[_0xfd0b('0x5c')])){return this[_0xfd0b('0xe')][_0xfd0b('0xa9')](_0xfd0b('0xaa'));}this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x1b2'),_0x593f65[_0xfd0b('0x5c')]));var _0x139cf9=this[_0xfd0b('0x59')][_0xfd0b('0x70')](this,_0x593f65);if(_0x139cf9){this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x1b3'),_0x139cf9));var _0x7ce624=this['channel']['streamFile'](_0x139cf9);try{fs[_0xfd0b('0xff')](_0x139cf9+_0xfd0b('0x124'));}catch(_0x5f3132){logger[_0xfd0b('0x33')](_0x5f3132);}return _0x7ce624;}return this['channel'][_0xfd0b('0x33')](_0x593f65,_0xfd0b('0x1b4'));};AGIVertices['prototype'][_0xfd0b('0x1b5')]=function(_0x2721f8){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2721f8[_0xfd0b('0x38')]));_0x2721f8[_0xfd0b('0x5c')]=_0x2721f8[_0xfd0b('0x5c')][_0xfd0b('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xfd0b('0x88')](_0x2721f8[_0xfd0b('0x5c')])){return this[_0xfd0b('0xe')]['noop'](_0xfd0b('0xaa'));}this[_0xfd0b('0xe')][_0xfd0b('0xa9')](util[_0xfd0b('0x29')]('Trying\x20Google\x20TTS\x20%s',_0x2721f8[_0xfd0b('0x5c')]));var _0x4a0094=this[_0xfd0b('0x62')][_0xfd0b('0x70')](this,_0x2721f8);if(_0x4a0094){this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x1b6'),_0x4a0094));var _0x250dbb=this[_0xfd0b('0xe')]['streamFile'](_0x4a0094);try{fs[_0xfd0b('0xff')](_0x4a0094+_0xfd0b('0x124'));}catch(_0x12c9e0){logger[_0xfd0b('0x33')](_0x12c9e0);}return _0x250dbb;}return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x2721f8,_0xfd0b('0x1b7'));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x1b8')]=function(_0x7338ab){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x7338ab['label']));if(!this[_0xfd0b('0x88')](_0x7338ab[_0xfd0b('0x14c')])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x7338ab,_0xfd0b('0x14b'));}logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xfd0b('0xe')][_0xfd0b('0x3c')],_0x7338ab[_0xfd0b('0x14c')]));var _0x3caeeb=this[_0xfd0b('0x51')][_0xfd0b('0x70')](this,_0x7338ab[_0xfd0b('0x14c')]);if(_0x3caeeb){logger['info'](util[_0xfd0b('0x29')](_0xfd0b('0x14d'),this['channel'][_0xfd0b('0x3c')],_0x7338ab[_0xfd0b('0x14c')]));this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x14d'),this['channel'][_0xfd0b('0x3c')],_0x7338ab[_0xfd0b('0x14c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x14e'),this[_0xfd0b('0xe')][_0xfd0b('0x3c')],_0x7338ab[_0xfd0b('0x14c')]));this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')](_0xfd0b('0x14e'),this[_0xfd0b('0xe')]['callerid'],_0x7338ab[_0xfd0b('0x14c')]));return{'code':0xc8,'result':_0xfd0b('0x152')};}};AGIVertices[_0xfd0b('0x15')]['voicemail']=function(_0x3e2ccf){logger[_0xfd0b('0x2f')](util[_0xfd0b('0x29')](_0xfd0b('0x1b9'),_0x3e2ccf[_0xfd0b('0x38')]));var _0x2ea453=this[_0xfd0b('0xe')]['exec'](_0xfd0b('0x1ba'),[_0x3e2ccf[_0xfd0b('0x1bb')],_0x3e2ccf[_0xfd0b('0x7a')]]);if(_0x2ea453['result']===-0x1){return _0x2ea453;}return this['channel'][_0xfd0b('0xa9')](util[_0xfd0b('0x29')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x3e2ccf[_0xfd0b('0x1bb')]));};AGIVertices[_0xfd0b('0x15')][_0xfd0b('0x1bc')]=function(_0x358758){logger['info'](util[_0xfd0b('0x29')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x358758[_0xfd0b('0x38')]));if(!this[_0xfd0b('0x88')](_0x358758[_0xfd0b('0x111')])){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x358758,_0xfd0b('0x19b'));}var _0x5f4024=this[_0xfd0b('0x11')]['sync'](this,_0x358758[_0xfd0b('0x111')]);if(!_0x5f4024){return this[_0xfd0b('0xe')][_0xfd0b('0x33')](_0x358758,_0xfd0b('0x116'));}var _0xcea68f=this[_0xfd0b('0xe')][_0xfd0b('0x11')](_0x5f4024);return{'code':0xc8,'result':_0xcea68f['extra']?_0xcea68f[_0xfd0b('0x13f')]:'-'};};String[_0xfd0b('0x15')][_0xfd0b('0xa2')]=function(_0x23bd23,_0x17ee94){return this[_0xfd0b('0xa1')](_0x23bd23)['join'](_0x17ee94);};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 22f1cc4..7d7e0b4 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 _0x0222=['destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','queue','updateAcw','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][STOP]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','[%s][HANGUP:UNIQUEID]','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','moment','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','agentconnect','syncAgentConnect','hanguprequest','bind','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','channels','interface','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0222,0xdb));var _0x2022=function(_0x316cb1,_0x4dfd30){_0x316cb1=_0x316cb1-0x0;var _0x357c8f=_0x0222[_0x316cb1];return _0x357c8f;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x2022('0x0'));var ami=require('../ami');var logger=require(_0x2022('0x1'))(_0x2022('0x2'));var RpcUser=require(_0x2022('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x343d36){this['voiceQueues']=_0x343d36[_0x2022('0x4')];this[_0x2022('0x5')]=_0x343d36[_0x2022('0x5')];this[_0x2022('0x6')]=_0x343d36[_0x2022('0x6')];this['channels']={};ami['on'](_0x2022('0x7'),this[_0x2022('0x8')]['bind'](this));ami['on'](_0x2022('0x9'),this['syncHangupRequest'][_0x2022('0xa')](this));ami['on'](_0x2022('0xb'),this['syncHangup'][_0x2022('0xa')](this));ami['on'](_0x2022('0xc'),this[_0x2022('0xd')][_0x2022('0xa')](this));ami['on'](_0x2022('0xe'),this[_0x2022('0xf')]['bind'](this));ami['on'](_0x2022('0x10'),this[_0x2022('0x11')][_0x2022('0xa')](this));ami['on'](_0x2022('0x12'),this['syncAgentConnectPreview'][_0x2022('0xa')](this));}function getDiff(_0x24cb7a){var _0x555f88=moment()[_0x2022('0x13')](0x0);var _0x22f487=moment(_0x24cb7a)['milliseconds'](0x0);return _0x555f88[_0x2022('0x14')](_0x22f487,_0x2022('0x15'));}Acw['prototype'][_0x2022('0x16')]=function(_0x29e3ac){try{var _0x3d495a=this;var _0x56237d=this[_0x2022('0x17')][_0x29e3ac][_0x2022('0x18')];var _0x32d723=this[_0x2022('0x17')][_0x29e3ac]['queue'];var _0x441d42=this[_0x2022('0x4')][_0x32d723];var _0x507bd2=![];var _0x503073='ACW';if(_0x441d42[_0x2022('0x19')]){if(_0x441d42[_0x2022('0x1a')][_0x2022('0x1b')]){_0x507bd2=!![];_0x503073=_0x441d42[_0x2022('0x1a')][_0x2022('0x1b')];}}ami[_0x2022('0x1c')]({'action':_0x2022('0x1d'),'interface':_0x56237d,'paused':!![],'reason':_0x503073})[_0x2022('0x1e')](function(_0x8cd6fc){if(_0x3d495a['agents'][_0x56237d]){return RpcUser[_0x2022('0x1f')](_0x3d495a[_0x2022('0x5')][_0x56237d]['id'])[_0x2022('0x1e')](function(_0x5b2325){if(_0x5b2325&&!_0x5b2325[_0x2022('0x20')]){logger[_0x2022('0x21')](_0x2022('0x22'),_0x29e3ac,_0x56237d,_0x32d723);var _0x2b8f6d=_0x3d495a['channels'][_0x29e3ac][_0x2022('0x23')]&&_0x3d495a[_0x2022('0x17')][_0x29e3ac][_0x2022('0x24')]?_0x3d495a[_0x2022('0x17')][_0x29e3ac][_0x2022('0x24')]:_0x29e3ac;return RpcUser['savePause'](_0x3d495a[_0x2022('0x5')][_0x56237d],_0x503073,_0x2b8f6d)[_0x2022('0x1e')](function(_0x3d8500){if(!_0x507bd2){_0x3d495a[_0x2022('0x6')][_0x56237d]={};logger[_0x2022('0x21')](_0x2022('0x25'),_0x29e3ac,_0x3d495a[_0x2022('0x4')][_0x32d723][_0x2022('0x26')],_0x56237d,_0x32d723);_0x3d495a['timers'][_0x56237d][_0x2022('0x27')]=setTimeout(_0x3d495a[_0x2022('0x28')][_0x2022('0xa')](_0x3d495a,_0x56237d),_0x3d495a[_0x2022('0x4')][_0x32d723][_0x2022('0x26')]*0x3e8);_0x3d495a[_0x2022('0x6')][_0x56237d][_0x2022('0x29')]=moment()[_0x2022('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d495a['timers'][_0x56237d][_0x2022('0x2b')]=_0x29e3ac;_0x3d495a[_0x2022('0x6')][_0x56237d][_0x2022('0x2c')]=_0x32d723;_0x3d495a[_0x2022('0x6')][_0x56237d][_0x2022('0x2d')]=function(){var _0x2c102e=getDiff(_0x3d495a[_0x2022('0x6')][_0x56237d][_0x2022('0x29')]);clearTimeout(_0x3d495a[_0x2022('0x6')][_0x56237d][_0x2022('0x27')]);_0x3d495a[_0x2022('0x6')][_0x56237d][_0x2022('0x27')]=![];RpcVoiceAgentReport[_0x2022('0x2e')]({'acwtime':_0x2c102e},_0x3d495a[_0x2022('0x6')][_0x56237d]['uniqueid'],_0x56237d)['then'](function(_0x33b1eb){logger['info'](_0x2022('0x2f'),_0x29e3ac,_0x2c102e,_0x33b1eb);})[_0x2022('0x30')](function(_0x41e479){logger[_0x2022('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x29e3ac,_0x41e479);});delete _0x3d495a[_0x2022('0x6')][_0x56237d];};}});}else{logger[_0x2022('0x21')](_0x2022('0x32'),_0x29e3ac,_0x56237d,_0x32d723);}});}})[_0x2022('0x30')](function(_0x1ba98a){logger['error'](_0x2022('0x25'),_0x29e3ac,_0x3d495a['voiceQueues'][_0x32d723][_0x2022('0x26')],_0x56237d,_0x32d723);})['finally'](function(){delete _0x3d495a[_0x2022('0x17')][_0x29e3ac];});}catch(_0x34cb5d){logger[_0x2022('0x31')](_0x2022('0x33'),_0x34cb5d[_0x2022('0x34')]);}};Acw[_0x2022('0x35')][_0x2022('0x28')]=function(_0x4b4077){try{var _0x223514=this;if(_0x223514[_0x2022('0x6')][_0x4b4077]){_0x223514['timers'][_0x4b4077]['timer']=![];var _0x5ad8f0=_0x223514[_0x2022('0x6')][_0x4b4077][_0x2022('0x2b')];var _0x1a1d58=_0x223514[_0x2022('0x6')][_0x4b4077][_0x2022('0x2c')];var _0x23bb85=_0x223514[_0x2022('0x4')][_0x1a1d58][_0x2022('0x26')];logger[_0x2022('0x21')](_0x2022('0x36'),_0x5ad8f0,_0x4b4077);RpcUser[_0x2022('0x37')](this['agents'][_0x4b4077]);RpcVoiceAgentReport[_0x2022('0x2e')]({'acwtime':_0x23bb85,'agentacw':!![]},_0x5ad8f0,_0x4b4077)[_0x2022('0x1e')](function(_0x54c34d){logger[_0x2022('0x21')]('[%s][UPDATE][ACWTIME:%s]',_0x5ad8f0,_0x23bb85,_0x54c34d);})[_0x2022('0x30')](function(_0x131113){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x5ad8f0,_0x131113);});}else{logger['error'](_0x2022('0x38'),_0x4b4077);if(_0x223514[_0x2022('0x6')]){logger[_0x2022('0x21')]('[ACW][TIMERS]',JSON['stringify'](_0x223514[_0x2022('0x6')]));}}}catch(_0x282975){logger[_0x2022('0x31')](_0x2022('0x39'),_0x282975[_0x2022('0x34')]);}};Acw[_0x2022('0x35')][_0x2022('0x8')]=function(_0x133d31){try{if(this['voiceQueues'][_0x133d31[_0x2022('0x2c')]]&&(this[_0x2022('0x4')][_0x133d31[_0x2022('0x2c')]][_0x2022('0x2')]||this[_0x2022('0x4')][_0x133d31['queue']][_0x2022('0x19')])){if(this['agents'][_0x133d31[_0x2022('0x18')]]){this['channels'][_0x133d31['uniqueid']]={'queue':_0x133d31[_0x2022('0x2c')],'interface':_0x133d31[_0x2022('0x18')],'destlinkedid':_0x133d31[_0x2022('0x24')]};}}}catch(_0x5c8988){logger[_0x2022('0x31')]('[ACW][syncAgentConnect]\x20%s',_0x5c8988[_0x2022('0x34')]);}};Acw[_0x2022('0x35')][_0x2022('0x3a')]=function(_0x443650){try{if(this[_0x2022('0x4')][_0x443650[_0x2022('0x2c')]]&&(this[_0x2022('0x4')][_0x443650[_0x2022('0x2c')]]['acw']||this[_0x2022('0x4')][_0x443650[_0x2022('0x2c')]][_0x2022('0x19')])){if(this['agents'][_0x443650[_0x2022('0x18')]]){this['channels'][_0x443650['uniqueid']]={'queue':_0x443650['queue'],'interface':_0x443650[_0x2022('0x18')]};}}}catch(_0x1fdabf){logger[_0x2022('0x31')](_0x2022('0x3b'),_0x1fdabf[_0x2022('0x34')]);}};Acw[_0x2022('0x35')][_0x2022('0x3c')]=function(_0x4ab67d){try{if(this[_0x2022('0x17')][_0x4ab67d[_0x2022('0x2b')]]&&_['isUndefined'](this[_0x2022('0x17')][_0x4ab67d[_0x2022('0x2b')]]['attended'])){logger[_0x2022('0x21')](_0x2022('0x3d'),_0x4ab67d[_0x2022('0x2b')]);this['startAcw'](_0x4ab67d[_0x2022('0x2b')]);}else if(this[_0x2022('0x17')][_0x4ab67d[_0x2022('0x3e')]]&&_[_0x2022('0x3f')](this[_0x2022('0x17')][_0x4ab67d[_0x2022('0x3e')]][_0x2022('0x23')])){logger[_0x2022('0x21')](_0x2022('0x40'),_0x4ab67d[_0x2022('0x3e')]);this[_0x2022('0x16')](_0x4ab67d[_0x2022('0x3e')]);}}catch(_0x382605){logger[_0x2022('0x31')](_0x2022('0x41'),_0x382605['message']);}};Acw[_0x2022('0x35')][_0x2022('0x42')]=function(_0x9d72c9){try{if(this[_0x2022('0x17')][_0x9d72c9[_0x2022('0x2b')]]&&this['channels'][_0x9d72c9[_0x2022('0x2b')]][_0x2022('0x23')]){logger['info'](_0x2022('0x43'),_0x9d72c9[_0x2022('0x2b')]);this['startAcw'](_0x9d72c9['uniqueid']);}else if(this[_0x2022('0x17')][_0x9d72c9[_0x2022('0x3e')]]&&this[_0x2022('0x17')][_0x9d72c9[_0x2022('0x3e')]][_0x2022('0x23')]){logger[_0x2022('0x21')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x9d72c9['linkedid']);this[_0x2022('0x16')](_0x9d72c9[_0x2022('0x3e')]);}}catch(_0xeccb6c){logger[_0x2022('0x31')](_0x2022('0x44'),_0xeccb6c[_0x2022('0x34')]);}};Acw[_0x2022('0x35')][_0x2022('0xf')]=function(_0x2eaad6){try{if(!_[_0x2022('0x45')](this[_0x2022('0x17')][_0x2eaad6[_0x2022('0x46')]])){this[_0x2022('0x16')](_0x2eaad6[_0x2022('0x46')]);if(this['channels'][_0x2eaad6[_0x2022('0x47')]]){this[_0x2022('0x17')][_0x2eaad6['secondtransfereruniqueid']][_0x2022('0x23')]=!![];this[_0x2022('0x17')][_0x2eaad6[_0x2022('0x48')]]=this[_0x2022('0x17')][_0x2eaad6[_0x2022('0x47')]];delete this[_0x2022('0x17')][_0x2eaad6[_0x2022('0x47')]];}}else if(!_[_0x2022('0x45')](this['channels'][_0x2eaad6[_0x2022('0x48')]])){this[_0x2022('0x16')](_0x2eaad6[_0x2022('0x48')]);if(this[_0x2022('0x17')][_0x2eaad6[_0x2022('0x49')]]){this[_0x2022('0x17')][_0x2eaad6[_0x2022('0x49')]][_0x2022('0x23')]=!![];this['channels'][_0x2eaad6[_0x2022('0x46')]]=this['channels'][_0x2eaad6[_0x2022('0x49')]];delete this[_0x2022('0x17')][_0x2eaad6['origtransfereruniqueid']];}}}catch(_0xab209c){logger[_0x2022('0x31')](_0x2022('0x4a'),_0xab209c['message']);}};Acw['prototype'][_0x2022('0x11')]=function(_0x449f94){try{if(this[_0x2022('0x17')][_0x449f94[_0x2022('0x4b')]]){logger[_0x2022('0x21')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x2022('0x4c')](_0x449f94[_0x2022('0x4b')]));this[_0x2022('0x16')](_0x449f94['transfereruniqueid']);}else if(this[_0x2022('0x17')][_0x449f94[_0x2022('0x4d')]]){logger[_0x2022('0x21')](_0x2022('0x4e'),JSON[_0x2022('0x4c')](_0x449f94[_0x2022('0x4d')]));this[_0x2022('0x16')](_0x449f94['transfererlinkedid']);}}catch(_0xa381db){logger[_0x2022('0x31')](_0x2022('0x4f'),_0xa381db[_0x2022('0x34')]);}};Acw[_0x2022('0x35')][_0x2022('0xd')]=function(_0x4ccc89){try{if(this[_0x2022('0x4')][_0x4ccc89['queue']]&&this[_0x2022('0x4')][_0x4ccc89[_0x2022('0x2c')]]['autopause']===_0x2022('0x50')){if(this[_0x2022('0x5')][_0x4ccc89[_0x2022('0x18')]]){logger['info'](_0x2022('0x51'),_0x4ccc89[_0x2022('0x2b')],_0x4ccc89[_0x2022('0x18')],_0x4ccc89['queue']);return RpcUser['savePause'](this['agents'][_0x4ccc89[_0x2022('0x18')]],_0x2022('0x52'),_0x4ccc89[_0x2022('0x2b')]);}}}catch(_0x54a495){logger['error'](_0x2022('0x53'),_0x54a495[_0x2022('0x34')]);}};module[_0x2022('0x54')]=Acw; \ No newline at end of file +var _0xc999=['QueuePause','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','queue','updateAcw','timer','uniqueid','then','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','prototype','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','util','lodash','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','startAcw','channels','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action'];(function(_0x3adba8,_0x38ad46){var _0x4141b8=function(_0x1c5581){while(--_0x1c5581){_0x3adba8['push'](_0x3adba8['shift']());}};_0x4141b8(++_0x38ad46);}(_0xc999,0x129));var _0x9c99=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0xc999[_0x386525];return _0x14d015;};'use strict';var util=require(_0x9c99('0x0'));var _=require(_0x9c99('0x1'));var moment=require('moment');var ami=require('../ami');var logger=require(_0x9c99('0x2'))(_0x9c99('0x3'));var RpcUser=require(_0x9c99('0x4'));var RpcVoiceAgentReport=require(_0x9c99('0x5'));function Acw(_0x1aa77e){this[_0x9c99('0x6')]=_0x1aa77e[_0x9c99('0x6')];this[_0x9c99('0x7')]=_0x1aa77e[_0x9c99('0x7')];this[_0x9c99('0x8')]=_0x1aa77e[_0x9c99('0x8')];this['channels']={};ami['on']('agentconnect',this['syncAgentConnect'][_0x9c99('0x9')](this));ami['on'](_0x9c99('0xa'),this[_0x9c99('0xb')][_0x9c99('0x9')](this));ami['on'](_0x9c99('0xc'),this[_0x9c99('0xd')][_0x9c99('0x9')](this));ami['on'](_0x9c99('0xe'),this[_0x9c99('0xf')]['bind'](this));ami['on']('attendedtransfer',this[_0x9c99('0x10')][_0x9c99('0x9')](this));ami['on'](_0x9c99('0x11'),this[_0x9c99('0x12')][_0x9c99('0x9')](this));ami['on'](_0x9c99('0x13'),this['syncAgentConnectPreview'][_0x9c99('0x9')](this));}function getDiff(_0x45a8b0){var _0x4f2876=moment()[_0x9c99('0x14')](0x0);var _0xa923d6=moment(_0x45a8b0)[_0x9c99('0x14')](0x0);return _0x4f2876[_0x9c99('0x15')](_0xa923d6,_0x9c99('0x16'));}Acw['prototype'][_0x9c99('0x17')]=function(_0x21846a){try{var _0x5a4a08=this;var _0xf46964=this[_0x9c99('0x18')][_0x21846a][_0x9c99('0x19')];var _0x3748f0=this['channels'][_0x21846a]['queue'];var _0x46b1be=this[_0x9c99('0x6')][_0x3748f0];var _0x17b198=![];var _0x4c7677=_0x9c99('0x1a');if(_0x46b1be[_0x9c99('0x1b')]){if(_0x46b1be[_0x9c99('0x1c')][_0x9c99('0x1d')]){_0x17b198=!![];_0x4c7677=_0x46b1be[_0x9c99('0x1c')]['name'];}}ami[_0x9c99('0x1e')]({'action':_0x9c99('0x1f'),'interface':_0xf46964,'paused':!![],'reason':_0x4c7677})['then'](function(_0x41b2b6){if(_0x5a4a08[_0x9c99('0x7')][_0xf46964]){return RpcUser[_0x9c99('0x20')](_0x5a4a08['agents'][_0xf46964]['id'])['then'](function(_0x2021ba){if(_0x2021ba&&!_0x2021ba[_0x9c99('0x21')]){logger['info'](_0x9c99('0x22'),_0x21846a,_0xf46964,_0x3748f0);var _0x2be5e3=_0x5a4a08[_0x9c99('0x18')][_0x21846a][_0x9c99('0x23')]&&_0x5a4a08[_0x9c99('0x18')][_0x21846a]['destlinkedid']?_0x5a4a08[_0x9c99('0x18')][_0x21846a][_0x9c99('0x24')]:_0x21846a;return RpcUser['savePause'](_0x5a4a08['agents'][_0xf46964],_0x4c7677,_0x2be5e3)['then'](function(_0x560c01){if(!_0x17b198){_0x5a4a08['timers'][_0xf46964]={};logger[_0x9c99('0x25')](_0x9c99('0x26'),_0x21846a,_0x5a4a08[_0x9c99('0x6')][_0x3748f0][_0x9c99('0x27')],_0xf46964,_0x3748f0);_0x5a4a08[_0x9c99('0x8')][_0xf46964]['timer']=setTimeout(_0x5a4a08[_0x9c99('0x28')][_0x9c99('0x9')](_0x5a4a08,_0xf46964),_0x5a4a08[_0x9c99('0x6')][_0x3748f0]['acwTimeout']*0x3e8);_0x5a4a08[_0x9c99('0x8')][_0xf46964]['lastPauseAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5a4a08[_0x9c99('0x8')][_0xf46964]['uniqueid']=_0x21846a;_0x5a4a08['timers'][_0xf46964][_0x9c99('0x29')]=_0x3748f0;_0x5a4a08['timers'][_0xf46964][_0x9c99('0x2a')]=function(){var _0x37c92b=getDiff(_0x5a4a08['timers'][_0xf46964]['lastPauseAt']);clearTimeout(_0x5a4a08[_0x9c99('0x8')][_0xf46964][_0x9c99('0x2b')]);_0x5a4a08[_0x9c99('0x8')][_0xf46964]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x37c92b},_0x5a4a08[_0x9c99('0x8')][_0xf46964][_0x9c99('0x2c')],_0xf46964)[_0x9c99('0x2d')](function(_0x5a82ee){logger[_0x9c99('0x25')](_0x9c99('0x2e'),_0x21846a,_0x37c92b,_0x5a82ee);})[_0x9c99('0x2f')](function(_0x3252c9){logger['error'](_0x9c99('0x30'),_0x21846a,_0x3252c9);});delete _0x5a4a08['timers'][_0xf46964];};}});}else{logger[_0x9c99('0x25')](_0x9c99('0x31'),_0x21846a,_0xf46964,_0x3748f0);}});}})[_0x9c99('0x2f')](function(_0x2b49b8){logger[_0x9c99('0x32')](_0x9c99('0x26'),_0x21846a,_0x5a4a08[_0x9c99('0x6')][_0x3748f0]['acwTimeout'],_0xf46964,_0x3748f0);})[_0x9c99('0x33')](function(){delete _0x5a4a08[_0x9c99('0x18')][_0x21846a];});}catch(_0x368e8b){logger[_0x9c99('0x32')]('[ACW][START]\x20%s',_0x368e8b['message']);}};Acw[_0x9c99('0x34')][_0x9c99('0x28')]=function(_0x55cac6){try{var _0x2cc179=this;if(_0x2cc179[_0x9c99('0x8')][_0x55cac6]){_0x2cc179[_0x9c99('0x8')][_0x55cac6][_0x9c99('0x2b')]=![];var _0x294350=_0x2cc179[_0x9c99('0x8')][_0x55cac6]['uniqueid'];var _0x293eef=_0x2cc179[_0x9c99('0x8')][_0x55cac6][_0x9c99('0x29')];var _0x197ff1=_0x2cc179[_0x9c99('0x6')][_0x293eef][_0x9c99('0x27')];logger['info'](_0x9c99('0x35'),_0x294350,_0x55cac6);RpcUser[_0x9c99('0x36')](this[_0x9c99('0x7')][_0x55cac6]);RpcVoiceAgentReport['update']({'acwtime':_0x197ff1,'agentacw':!![]},_0x294350,_0x55cac6)[_0x9c99('0x2d')](function(_0x5a1a34){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x294350,_0x197ff1,_0x5a1a34);})[_0x9c99('0x2f')](function(_0x46a3e5){logger[_0x9c99('0x32')](_0x9c99('0x30'),_0x294350,_0x46a3e5);});}else{logger[_0x9c99('0x32')](_0x9c99('0x37'),_0x55cac6);if(_0x2cc179['timers']){logger[_0x9c99('0x25')](_0x9c99('0x38'),JSON[_0x9c99('0x39')](_0x2cc179[_0x9c99('0x8')]));}}}catch(_0x22186d){logger[_0x9c99('0x32')](_0x9c99('0x3a'),_0x22186d[_0x9c99('0x3b')]);}};Acw['prototype']['syncAgentConnect']=function(_0x1df45a){try{if(this[_0x9c99('0x6')][_0x1df45a[_0x9c99('0x29')]]&&(this[_0x9c99('0x6')][_0x1df45a[_0x9c99('0x29')]][_0x9c99('0x3')]||this[_0x9c99('0x6')][_0x1df45a[_0x9c99('0x29')]]['mandatoryDisposition'])){if(this['agents'][_0x1df45a[_0x9c99('0x19')]]){this[_0x9c99('0x18')][_0x1df45a[_0x9c99('0x2c')]]={'queue':_0x1df45a[_0x9c99('0x29')],'interface':_0x1df45a[_0x9c99('0x19')],'destlinkedid':_0x1df45a[_0x9c99('0x24')]};}}}catch(_0x2b764f){logger['error'](_0x9c99('0x3c'),_0x2b764f[_0x9c99('0x3b')]);}};Acw[_0x9c99('0x34')]['syncAgentConnectPreview']=function(_0x14d894){try{if(this['voiceQueues'][_0x14d894[_0x9c99('0x29')]]&&(this[_0x9c99('0x6')][_0x14d894[_0x9c99('0x29')]]['acw']||this['voiceQueues'][_0x14d894[_0x9c99('0x29')]][_0x9c99('0x1b')])){if(this[_0x9c99('0x7')][_0x14d894[_0x9c99('0x19')]]){this[_0x9c99('0x18')][_0x14d894[_0x9c99('0x2c')]]={'queue':_0x14d894[_0x9c99('0x29')],'interface':_0x14d894[_0x9c99('0x19')]};}}}catch(_0x45bb7e){logger[_0x9c99('0x32')](_0x9c99('0x3d'),_0x45bb7e['message']);}};Acw[_0x9c99('0x34')][_0x9c99('0xb')]=function(_0x30558c){try{if(this[_0x9c99('0x18')][_0x30558c[_0x9c99('0x2c')]]&&_[_0x9c99('0x3e')](this[_0x9c99('0x18')][_0x30558c[_0x9c99('0x2c')]]['attended'])){logger['info'](_0x9c99('0x3f'),_0x30558c['uniqueid']);this['startAcw'](_0x30558c['uniqueid']);}else if(this[_0x9c99('0x18')][_0x30558c[_0x9c99('0x40')]]&&_[_0x9c99('0x3e')](this['channels'][_0x30558c[_0x9c99('0x40')]][_0x9c99('0x23')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x30558c[_0x9c99('0x40')]);this[_0x9c99('0x17')](_0x30558c[_0x9c99('0x40')]);}}catch(_0x38b0a6){logger['error'](_0x9c99('0x41'),_0x38b0a6['message']);}};Acw[_0x9c99('0x34')]['syncHangup']=function(_0x18b598){try{if(this[_0x9c99('0x18')][_0x18b598[_0x9c99('0x2c')]]&&this[_0x9c99('0x18')][_0x18b598[_0x9c99('0x2c')]][_0x9c99('0x23')]){logger[_0x9c99('0x25')](_0x9c99('0x42'),_0x18b598[_0x9c99('0x2c')]);this[_0x9c99('0x17')](_0x18b598[_0x9c99('0x2c')]);}else if(this[_0x9c99('0x18')][_0x18b598[_0x9c99('0x40')]]&&this['channels'][_0x18b598[_0x9c99('0x40')]]['attended']){logger[_0x9c99('0x25')](_0x9c99('0x43'),_0x18b598[_0x9c99('0x40')]);this[_0x9c99('0x17')](_0x18b598[_0x9c99('0x40')]);}}catch(_0x49eafa){logger[_0x9c99('0x32')](_0x9c99('0x44'),_0x49eafa[_0x9c99('0x3b')]);}};Acw[_0x9c99('0x34')][_0x9c99('0x10')]=function(_0x30981b){try{if(!_[_0x9c99('0x45')](this[_0x9c99('0x18')][_0x30981b['transfereeuniqueid']])){this[_0x9c99('0x17')](_0x30981b['transfereeuniqueid']);if(this['channels'][_0x30981b[_0x9c99('0x46')]]){this[_0x9c99('0x18')][_0x30981b[_0x9c99('0x46')]][_0x9c99('0x23')]=!![];this[_0x9c99('0x18')][_0x30981b[_0x9c99('0x47')]]=this[_0x9c99('0x18')][_0x30981b[_0x9c99('0x46')]];delete this['channels'][_0x30981b['secondtransfereruniqueid']];}}else if(!_['isNil'](this[_0x9c99('0x18')][_0x30981b[_0x9c99('0x47')]])){this['startAcw'](_0x30981b[_0x9c99('0x47')]);if(this[_0x9c99('0x18')][_0x30981b[_0x9c99('0x48')]]){this[_0x9c99('0x18')][_0x30981b[_0x9c99('0x48')]]['attended']=!![];this[_0x9c99('0x18')][_0x30981b[_0x9c99('0x49')]]=this[_0x9c99('0x18')][_0x30981b[_0x9c99('0x48')]];delete this['channels'][_0x30981b['origtransfereruniqueid']];}}}catch(_0x1d5519){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x1d5519[_0x9c99('0x3b')]);}};Acw[_0x9c99('0x34')][_0x9c99('0x12')]=function(_0x2469e5){try{if(this['channels'][_0x2469e5[_0x9c99('0x4a')]]){logger[_0x9c99('0x25')](_0x9c99('0x4b'),JSON[_0x9c99('0x39')](_0x2469e5[_0x9c99('0x4a')]));this[_0x9c99('0x17')](_0x2469e5[_0x9c99('0x4a')]);}else if(this[_0x9c99('0x18')][_0x2469e5['transfererlinkedid']]){logger[_0x9c99('0x25')](_0x9c99('0x4c'),JSON[_0x9c99('0x39')](_0x2469e5[_0x9c99('0x4d')]));this[_0x9c99('0x17')](_0x2469e5[_0x9c99('0x4d')]);}}catch(_0xe70314){logger[_0x9c99('0x32')](_0x9c99('0x4e'),_0xe70314['message']);}};Acw[_0x9c99('0x34')]['syncAgentRingNoAnswer']=function(_0x4749be){try{if(this[_0x9c99('0x6')][_0x4749be['queue']]&&this['voiceQueues'][_0x4749be[_0x9c99('0x29')]]['autopause']===_0x9c99('0x4f')){if(this[_0x9c99('0x7')][_0x4749be[_0x9c99('0x19')]]){logger[_0x9c99('0x25')](_0x9c99('0x50'),_0x4749be['uniqueid'],_0x4749be[_0x9c99('0x19')],_0x4749be[_0x9c99('0x29')]);return RpcUser[_0x9c99('0x51')](this['agents'][_0x4749be[_0x9c99('0x19')]],'Auto-Pause',_0x4749be[_0x9c99('0x2c')]);}}}catch(_0x498316){logger[_0x9c99('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x498316[_0x9c99('0x3b')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index cfc3877..b2537fa 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 _0x329d=['connect','shutdown','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionQueueSummary','catch','log','exports','asterisk-manager','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x329d,0xce));var _0xd329=function(_0x43b06b,_0x1929c7){_0x43b06b=_0x43b06b-0x0;var _0x2c555b=_0x329d[_0x43b06b];return _0x2c555b;};'use strict';var Manager=require(_0xd329('0x0'));var BPromise=require('bluebird');var moment=require(_0xd329('0x1'));var util=require(_0xd329('0x2'));var _=require(_0xd329('0x3'));var logger=require(_0xd329('0x4'))(_0xd329('0x5'));var config=require(_0xd329('0x6'));var ami=new Manager(config[_0xd329('0x7')][_0xd329('0x8')],config[_0xd329('0x7')]['ip'],config[_0xd329('0x7')][_0xd329('0x9')],config[_0xd329('0x7')][_0xd329('0xa')],!![]);ami['keepConnected']();ami[_0xd329('0xb')]=BPromise[_0xd329('0xc')](ami['action']);function error(_0x55f394){logger[_0xd329('0xd')](util[_0xd329('0xe')](_0xd329('0xf'),config['asterisk'][_0xd329('0x9')],config[_0xd329('0x7')]['ip'],config[_0xd329('0x7')]['port'],util[_0xd329('0x10')](_0x55f394,![],null)));}function close(){logger['error'](util[_0xd329('0xe')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xd329('0x7')][_0xd329('0x9')],config[_0xd329('0x7')]['ip'],config[_0xd329('0x7')][_0xd329('0x8')]));}ami[_0xd329('0x11')]=function(){return function(){return ami[_0xd329('0xb')]({'action':_0xd329('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0xd329('0x13')});};};ami[_0xd329('0x14')]=function(){return function(){return ami[_0xd329('0xb')]({'action':_0xd329('0x15')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xd329('0xb')]({'action':_0xd329('0x16')});};};ami[_0xd329('0x17')]=function(){return function(){return ami[_0xd329('0xb')]({'action':_0xd329('0x18')});};};function connect(_0x514246){logger[_0xd329('0x19')](util[_0xd329('0xe')](_0xd329('0x1a'),config['asterisk'][_0xd329('0x9')],config[_0xd329('0x7')]['ip'],config[_0xd329('0x7')][_0xd329('0x8')]));ami[_0xd329('0x1b')](_0xd329('0xd'),error);ami[_0xd329('0x1b')]('close',close);}ami['on'](_0xd329('0x1c'),connect);ami['on'](_0xd329('0x1d'),function(_0x19c39b){logger[_0xd329('0x19')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config['asterisk']['ip'],config[_0xd329('0x7')][_0xd329('0x8')],util[_0xd329('0x10')](_0x19c39b,![],null)));});ami['on'](_0xd329('0x1e'),function(_0x2678e7){logger['info'](util[_0xd329('0xe')](_0xd329('0x1f'),config['asterisk'][_0xd329('0x9')],config[_0xd329('0x7')]['ip'],config['asterisk'][_0xd329('0x8')]));return BPromise[_0xd329('0x20')]()['then'](ami[_0xd329('0x11')]())[_0xd329('0x21')](ami[_0xd329('0x22')]())[_0xd329('0x21')](ami[_0xd329('0x14')]())[_0xd329('0x21')](ami[_0xd329('0x23')]())['then'](ami[_0xd329('0x17')]())[_0xd329('0x24')](function(_0x53ac7b){console[_0xd329('0x25')](_0x53ac7b);});});ami['once'](_0xd329('0xd'),error);ami[_0xd329('0x1b')]('close',close);module[_0xd329('0x26')]=ami; \ No newline at end of file +var _0x9dae=['port','username','keepConnected','Action','promisify','action','error','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','format','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','resolve','then','actionSipPeerStatus','catch','log','exports','bluebird','moment','lodash','../../config/logger','ami','../../config/environment','asterisk'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x9dae,0x17f));var _0xe9da=function(_0x22efdd,_0x2f2630){_0x22efdd=_0x22efdd-0x0;var _0x156298=_0x9dae[_0x22efdd];return _0x156298;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xe9da('0x0'));var moment=require(_0xe9da('0x1'));var util=require('util');var _=require(_0xe9da('0x2'));var logger=require(_0xe9da('0x3'))(_0xe9da('0x4'));var config=require(_0xe9da('0x5'));var ami=new Manager(config[_0xe9da('0x6')][_0xe9da('0x7')],config[_0xe9da('0x6')]['ip'],config[_0xe9da('0x6')][_0xe9da('0x8')],config[_0xe9da('0x6')]['password'],!![]);ami[_0xe9da('0x9')]();ami[_0xe9da('0xa')]=BPromise[_0xe9da('0xb')](ami[_0xe9da('0xc')]);function error(_0x133fb3){logger[_0xe9da('0xd')](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk']['username'],config['asterisk']['ip'],config[_0xe9da('0x6')][_0xe9da('0x7')],util[_0xe9da('0xe')](_0x133fb3,![],null)));}function close(){logger[_0xe9da('0xd')](util['format'](_0xe9da('0xf'),config[_0xe9da('0x6')][_0xe9da('0x8')],config['asterisk']['ip'],config[_0xe9da('0x6')]['port']));}ami[_0xe9da('0x10')]=function(){return function(){return ami[_0xe9da('0xa')]({'action':_0xe9da('0x11')});};};ami[_0xe9da('0x12')]=function(){return function(){return ami[_0xe9da('0xa')]({'action':_0xe9da('0x13')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0xe9da('0xa')]({'action':_0xe9da('0x14')});};};ami[_0xe9da('0x15')]=function(){return function(){return ami['Action']({'action':_0xe9da('0x16')});};};ami[_0xe9da('0x17')]=function(){return function(){return ami['Action']({'action':_0xe9da('0x18')});};};function connect(_0x1fb596){logger[_0xe9da('0x19')](util[_0xe9da('0x1a')](_0xe9da('0x1b'),config[_0xe9da('0x6')][_0xe9da('0x8')],config[_0xe9da('0x6')]['ip'],config[_0xe9da('0x6')][_0xe9da('0x7')]));ami['once'](_0xe9da('0xd'),error);ami[_0xe9da('0x1c')](_0xe9da('0x1d'),close);}ami['on'](_0xe9da('0x1e'),connect);ami['on'](_0xe9da('0x1f'),function(_0x50ba2b){logger[_0xe9da('0x19')](util['format'](_0xe9da('0x20'),config[_0xe9da('0x6')]['username'],config[_0xe9da('0x6')]['ip'],config[_0xe9da('0x6')][_0xe9da('0x7')],util[_0xe9da('0xe')](_0x50ba2b,![],null)));});ami['on']('fullybooted',function(_0xf0dba8){logger[_0xe9da('0x19')](util[_0xe9da('0x1a')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xe9da('0x6')][_0xe9da('0x8')],config['asterisk']['ip'],config[_0xe9da('0x6')][_0xe9da('0x7')]));return BPromise[_0xe9da('0x21')]()[_0xe9da('0x22')](ami[_0xe9da('0x10')]())[_0xe9da('0x22')](ami['actionDeviceStateList']())[_0xe9da('0x22')](ami[_0xe9da('0x23')]())[_0xe9da('0x22')](ami[_0xe9da('0x15')]())[_0xe9da('0x22')](ami[_0xe9da('0x17')]())[_0xe9da('0x24')](function(_0x1f9f86){console[_0xe9da('0x25')](_0x1f9f86);});});ami['once'](_0xe9da('0xd'),error);ami['once'](_0xe9da('0x1d'),close);module[_0xe9da('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 391c8ff..22c56de 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 _0xbdb7=['result','catch','jayson/promise','bluebird','../../config/logger','ami','client','http','Request','debug','error','message'];(function(_0x19d35a,_0x542264){var _0x504a77=function(_0x3dea26){while(--_0x3dea26){_0x19d35a['push'](_0x19d35a['shift']());}};_0x504a77(++_0x542264);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x38381f,_0x4eff8a){_0x38381f=_0x38381f-0x0;var _0x1c1631=_0xbdb7[_0x38381f];return _0x1c1631;};'use strict';var jayson=require(_0x7bdb('0x0'));var BPromise=require(_0x7bdb('0x1'));var logger=require(_0x7bdb('0x2'))(_0x7bdb('0x3'));var client=jayson[_0x7bdb('0x4')][_0x7bdb('0x5')]({'port':0x2329});client[_0x7bdb('0x6')]=function(_0x2c7e07,_0x46c068){return new BPromise(function(_0x47aec5,_0x28542c){return client['request'](_0x2c7e07,_0x46c068)['then'](function(_0xffdc86){logger[_0x7bdb('0x7')]('rpc','memberReport',_0x2c7e07,_0x46c068,_0xffdc86);if(_0xffdc86[_0x7bdb('0x8')]){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')],_0x46c068);return _0x28542c(_0xffdc86[_0x7bdb('0x8')][_0x7bdb('0x9')]);}else{return _0x47aec5(_0xffdc86[_0x7bdb('0xa')]);}})[_0x7bdb('0xb')](function(_0x297724){logger[_0x7bdb('0x8')]('rpc','memberReport',_0x2c7e07,_0x297724,_0x46c068);return _0x28542c(_0x297724);});});};module['exports']=client; \ No newline at end of file +var _0x9c44=['ami','client','http','Request','then','debug','rpc','memberReport','error','message','result','exports','../../config/logger'];(function(_0x4f8c39,_0x144ede){var _0x4d3641=function(_0x222a1d){while(--_0x222a1d){_0x4f8c39['push'](_0x4f8c39['shift']());}};_0x4d3641(++_0x144ede);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var client=jayson[_0x49c4('0x2')][_0x49c4('0x3')]({'port':0x2329});client[_0x49c4('0x4')]=function(_0x2ad237,_0x4e0313){return new BPromise(function(_0x4941f1,_0x41a183){return client['request'](_0x2ad237,_0x4e0313)[_0x49c4('0x5')](function(_0x6030ae){logger[_0x49c4('0x6')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x4e0313,_0x6030ae);if(_0x6030ae['error']){logger[_0x49c4('0x9')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x6030ae[_0x49c4('0x9')]['message'],_0x4e0313);return _0x41a183(_0x6030ae['error'][_0x49c4('0xa')]);}else{return _0x4941f1(_0x6030ae[_0x49c4('0xb')]);}})['catch'](function(_0xb611a1){logger[_0x49c4('0x9')]('rpc','memberReport',_0x2ad237,_0xb611a1,_0x4e0313);return _0x41a183(_0xb611a1);});});};module[_0x49c4('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index d3f8c1a..57492f1 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 _0x8552=['dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','format','dialCutDigit','number','substring','getQueue','exports','util','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','firstName','queue','active','type'];(function(_0x102146,_0x4514ac){var _0x266531=function(_0x264dc8){while(--_0x264dc8){_0x102146['push'](_0x102146['shift']());}};_0x266531(++_0x4514ac);}(_0x8552,0x97));var _0x2855=function(_0x35f2a7,_0x1ad4e7){_0x35f2a7=_0x35f2a7-0x0;var _0x365acd=_0x8552[_0x35f2a7];return _0x365acd;};'use strict';var util=require(_0x2855('0x0'));var _=require(_0x2855('0x1'));var moment=require(_0x2855('0x2'));function checkNameSurname(_0x423601,_0x28e85d,_0x2463df){var _0x3a4de8='';if(!_[_0x2855('0x3')](_0x28e85d)&&'string'===typeof _0x28e85d){_0x3a4de8+=_0x28e85d;}if(!_[_0x2855('0x3')](_0x2463df)&&_0x2855('0x4')===typeof _0x2463df){_0x3a4de8+='\x20'+_0x2463df;}if(_0x3a4de8!==''){return _0x3a4de8;}return _0x423601;}function Action(_0x340730,_0x270926,_0x530477){this[_0x2855('0x5')]=_0x340730;this[_0x2855('0x6')]=_0x530477||undefined;this[_0x2855('0x7')]=checkNameSurname(_0x270926['Contact']['phone'],_0x270926[_0x2855('0x8')][_0x2855('0x9')],_0x270926[_0x2855('0x8')]['lastName']);this['number']=_0x270926['phone'];this[_0x2855('0xa')]=_0x340730[_0x2855('0x7')];this[_0x2855('0xb')]=_0x270926[_0x2855('0xb')]||![];this[_0x2855('0xc')]=_0x340730[_0x2855('0xc')];this[_0x2855('0xd')]=_0x340730[_0x2855('0xd')]||0x3;this[_0x2855('0xe')]=_0x270926[_0x2855('0xe')];this[_0x2855('0xf')]=_0x270926[_0x2855('0xf')];this[_0x2855('0x10')]=_0x270926[_0x2855('0x10')];this[_0x2855('0x11')]=_0x270926[_0x2855('0x11')];this[_0x2855('0x12')]=_0x270926[_0x2855('0x12')];this[_0x2855('0x13')]=_0x270926[_0x2855('0x13')];this[_0x2855('0x14')]=_0x270926[_0x2855('0x14')];this[_0x2855('0x15')]=_0x270926[_0x2855('0x15')];this[_0x2855('0x16')]=_0x270926[_0x2855('0x16')];this[_0x2855('0x17')]=_0x270926[_0x2855('0x17')];this['ListId']=_0x270926[_0x2855('0x18')];this[_0x2855('0x19')]=_0x270926['UserId'];this[_0x2855('0x1a')]=_0x270926[_0x2855('0x1a')];this[_0x2855('0x1b')]=_0x270926[_0x2855('0x1b')];this[_0x2855('0x1c')]=_0x270926['id'];this['ContactFirstName']=_0x270926['Contact'][_0x2855('0x9')]||'';this[_0x2855('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x2855('0x1e')]=_0x270926[_0x2855('0x1e')];this[_0x2855('0x1f')]=_0x270926['callbackuniqueid'];this['callbackat']=_0x270926[_0x2855('0x20')];this[_0x2855('0x21')]=_0x270926[_0x2855('0x21')];this['originatecalleridnum']='';this[_0x2855('0x22')]='';}Action['prototype']['getCaller']=function(){return util[_0x2855('0x23')]('\x22%s\x22\x20<%s>',this[_0x2855('0x7')],this[_0x2855('0x5')][_0x2855('0x24')]>0x0?this[_0x2855('0x25')][_0x2855('0x26')](this['voiceQueue'][_0x2855('0x24')]):this[_0x2855('0x25')]);};Action['prototype'][_0x2855('0x27')]=function(){return this[_0x2855('0xa')];};module[_0x2855('0x28')]=Action; \ No newline at end of file +var _0xc6ac=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackat','recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','exports','util','lodash','moment','string','isNil','voiceQueue','uniqueid','Contact','firstName','phone','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0xc6ac,0x171));var _0xcc6a=function(_0x962168,_0x56bae4){_0x962168=_0x962168-0x0;var _0x517ed9=_0xc6ac[_0x962168];return _0x517ed9;};'use strict';var util=require(_0xcc6a('0x0'));var _=require(_0xcc6a('0x1'));var moment=require(_0xcc6a('0x2'));function checkNameSurname(_0x30c958,_0x2d167d,_0x265ffd){var _0x44aa2a='';if(!_['isNil'](_0x2d167d)&&_0xcc6a('0x3')===typeof _0x2d167d){_0x44aa2a+=_0x2d167d;}if(!_[_0xcc6a('0x4')](_0x265ffd)&&_0xcc6a('0x3')===typeof _0x265ffd){_0x44aa2a+='\x20'+_0x265ffd;}if(_0x44aa2a!==''){return _0x44aa2a;}return _0x30c958;}function Action(_0x2c53d2,_0x19b95b,_0x43fdf6){this[_0xcc6a('0x5')]=_0x2c53d2;this[_0xcc6a('0x6')]=_0x43fdf6||undefined;this['name']=checkNameSurname(_0x19b95b['Contact']['phone'],_0x19b95b[_0xcc6a('0x7')][_0xcc6a('0x8')],_0x19b95b['Contact']['lastName']);this['number']=_0x19b95b[_0xcc6a('0x9')];this[_0xcc6a('0xa')]=_0x2c53d2[_0xcc6a('0xb')];this[_0xcc6a('0xc')]=_0x19b95b[_0xcc6a('0xc')]||![];this[_0xcc6a('0xd')]=_0x2c53d2[_0xcc6a('0xd')];this[_0xcc6a('0xe')]=_0x2c53d2['dialQueueTimeout']||0x3;this[_0xcc6a('0xf')]=_0x19b95b[_0xcc6a('0xf')];this[_0xcc6a('0x10')]=_0x19b95b[_0xcc6a('0x10')];this[_0xcc6a('0x11')]=_0x19b95b[_0xcc6a('0x11')];this['countnoanswerretry']=_0x19b95b[_0xcc6a('0x12')];this[_0xcc6a('0x13')]=_0x19b95b[_0xcc6a('0x13')];this[_0xcc6a('0x14')]=_0x19b95b[_0xcc6a('0x14')];this[_0xcc6a('0x15')]=_0x19b95b[_0xcc6a('0x15')];this[_0xcc6a('0x16')]=_0x19b95b[_0xcc6a('0x16')];this[_0xcc6a('0x17')]=_0x19b95b[_0xcc6a('0x17')];this['ContactId']=_0x19b95b[_0xcc6a('0x18')];this['ListId']=_0x19b95b[_0xcc6a('0x19')];this[_0xcc6a('0x1a')]=_0x19b95b[_0xcc6a('0x1a')];this[_0xcc6a('0x1b')]=_0x19b95b[_0xcc6a('0x1b')];this[_0xcc6a('0x1c')]=_0x19b95b['CampaignId'];this[_0xcc6a('0x1d')]=_0x19b95b['id'];this[_0xcc6a('0x1e')]=_0x19b95b[_0xcc6a('0x7')][_0xcc6a('0x8')]||'';this[_0xcc6a('0x1f')]=moment()[_0xcc6a('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcc6a('0x21')]=_0x19b95b['callback'];this['callbackuniqueid']=_0x19b95b['callbackuniqueid'];this[_0xcc6a('0x22')]=_0x19b95b[_0xcc6a('0x22')];this['recallme']=_0x19b95b[_0xcc6a('0x23')];this[_0xcc6a('0x24')]='';this['originatecalleridname']='';}Action[_0xcc6a('0x25')][_0xcc6a('0x26')]=function(){return util[_0xcc6a('0x20')](_0xcc6a('0x27'),this['name'],this[_0xcc6a('0x5')][_0xcc6a('0x28')]>0x0?this[_0xcc6a('0x29')]['substring'](this['voiceQueue'][_0xcc6a('0x28')]):this[_0xcc6a('0x29')]);};Action['prototype']['getQueue']=function(){return this['queue'];};module[_0xcc6a('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/additionalPhone.js b/server/services/ami/dialer/additionalPhone.js index 1c9199d..9d676d9 100644 --- a/server/services/ami/dialer/additionalPhone.js +++ b/server/services/ami/dialer/additionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4dea=['uniqueid','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds'];(function(_0x45bbe6,_0x31fe5b){var _0x3de3ac=function(_0x245a09){while(--_0x245a09){_0x45bbe6['push'](_0x45bbe6['shift']());}};_0x3de3ac(++_0x31fe5b);}(_0x4dea,0x6b));var _0xa4de=function(_0x15c145,_0x2d3dff){_0x15c145=_0x15c145-0x0;var _0x594c84=_0x4dea[_0x15c145];return _0x594c84;};'use strict';var util=require(_0xa4de('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x36b33c,_0x2d35fb){var _0x505b4f=moment(_0x36b33c)[_0xa4de('0x1')](0x0);var _0x5760fa=moment(_0x2d35fb)[_0xa4de('0x1')](0x0);return _0x505b4f[_0xa4de('0x2')](_0x5760fa,_0xa4de('0x3'));}function AdditionalPhone(_0x5bb866){this[_0xa4de('0x4')]=_0x5bb866['uniqueid'];this['scheduledat']=_0x5bb866['scheduledat']||undefined;this['type']=_0x5bb866['type'];this['campaigntype']=_0x5bb866['type']===_0xa4de('0x5')?_0xa4de('0x6'):_0x5bb866[_0xa4de('0x7')];this['countbusyretry']=_0x5bb866[_0xa4de('0x8')];this[_0xa4de('0x9')]=_0x5bb866[_0xa4de('0x9')];this[_0xa4de('0xa')]=_0x5bb866['countnoanswerretry'];this[_0xa4de('0xb')]=_0x5bb866['countbusyretry']+_0x5bb866['countcongestionretry']+_0x5bb866[_0xa4de('0xa')]+_0x5bb866[_0xa4de('0xc')]+_0x5bb866[_0xa4de('0xd')]+_0x5bb866[_0xa4de('0xe')]+_0x5bb866['countmachineretry']+_0x5bb866[_0xa4de('0xf')];this['countnosuchnumberretry']=_0x5bb866[_0xa4de('0xc')];this['countdropretry']=_0x5bb866[_0xa4de('0xd')];this['countabandonedretry']=_0x5bb866[_0xa4de('0xe')];this[_0xa4de('0x10')]=_0x5bb866[_0xa4de('0x10')];this['countagentrejectretry']=_0x5bb866[_0xa4de('0xf')];this[_0xa4de('0x6')]=_0x5bb866[_0xa4de('0x6')];this[_0xa4de('0x11')]=_0x5bb866[_0xa4de('0x12')];this[_0xa4de('0x13')]=_0x5bb866[_0xa4de('0x14')];this[_0xa4de('0x15')]=_0x5bb866['starttime'];this['responsetime']=_0x5bb866[_0xa4de('0x16')];this[_0xa4de('0x17')]=_0x5bb866[_0xa4de('0x16')];this['ringtime']=getSeconds(_0x5bb866['responsetime'],_0x5bb866[_0xa4de('0x15')]);this['holdtime']=0x0;this[_0xa4de('0x18')]=0x0;this[_0xa4de('0x19')]=_0x5bb866[_0xa4de('0x19')];this[_0xa4de('0x1a')]=_0x5bb866['callbackuniqueid'];this[_0xa4de('0x1b')]=_0x5bb866[_0xa4de('0x1b')];this[_0xa4de('0x1c')]=_0x5bb866[_0xa4de('0x1c')];this['ContactId']=_0x5bb866[_0xa4de('0x1d')];this[_0xa4de('0x1e')]=_0x5bb866[_0xa4de('0x1e')];this['UserId']=_0x5bb866[_0xa4de('0x1f')];this[_0xa4de('0x20')]=_0x5bb866['VoiceQueueId'];this['CampaignId']=_0x5bb866[_0xa4de('0x21')];this[_0xa4de('0x22')]=_0x5bb866[_0xa4de('0x22')]||'';this[_0xa4de('0x23')]=_0x5bb866[_0xa4de('0x23')]||'';}module[_0xa4de('0x24')]=History; \ No newline at end of file +var _0xe642=['countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x1700b3,_0x4c2e23){var _0x4f4539=function(_0x58327f){while(--_0x58327f){_0x1700b3['push'](_0x1700b3['shift']());}};_0x4f4539(++_0x4c2e23);}(_0xe642,0xb1));var _0x2e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe642[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x2e64('0x0'));var _=require(_0x2e64('0x1'));var moment=require(_0x2e64('0x2'));function getSeconds(_0x167dbd,_0xd4c49f){var _0x3e614d=moment(_0x167dbd)[_0x2e64('0x3')](0x0);var _0x71207=moment(_0xd4c49f)[_0x2e64('0x3')](0x0);return _0x3e614d[_0x2e64('0x4')](_0x71207,_0x2e64('0x5'));}function AdditionalPhone(_0x411251){this[_0x2e64('0x6')]=_0x411251[_0x2e64('0x6')];this[_0x2e64('0x7')]=_0x411251[_0x2e64('0x7')]||undefined;this[_0x2e64('0x8')]=_0x411251[_0x2e64('0x8')];this[_0x2e64('0x9')]=_0x411251[_0x2e64('0x8')]==='outbound'?_0x2e64('0xa'):_0x411251['type'];this[_0x2e64('0xb')]=_0x411251[_0x2e64('0xb')];this[_0x2e64('0xc')]=_0x411251[_0x2e64('0xc')];this[_0x2e64('0xd')]=_0x411251[_0x2e64('0xd')];this[_0x2e64('0xe')]=_0x411251[_0x2e64('0xb')]+_0x411251['countcongestionretry']+_0x411251[_0x2e64('0xd')]+_0x411251[_0x2e64('0xf')]+_0x411251[_0x2e64('0x10')]+_0x411251[_0x2e64('0x11')]+_0x411251[_0x2e64('0x12')]+_0x411251[_0x2e64('0x13')];this[_0x2e64('0xf')]=_0x411251[_0x2e64('0xf')];this['countdropretry']=_0x411251[_0x2e64('0x10')];this['countabandonedretry']=_0x411251[_0x2e64('0x11')];this[_0x2e64('0x12')]=_0x411251['countmachineretry'];this[_0x2e64('0x13')]=_0x411251[_0x2e64('0x13')];this[_0x2e64('0xa')]=_0x411251[_0x2e64('0xa')];this[_0x2e64('0x14')]=_0x411251[_0x2e64('0x15')];this[_0x2e64('0x16')]=_0x411251[_0x2e64('0x17')];this['starttime']=_0x411251[_0x2e64('0x18')];this[_0x2e64('0x19')]=_0x411251['responsetime'];this[_0x2e64('0x1a')]=_0x411251['responsetime'];this['ringtime']=getSeconds(_0x411251[_0x2e64('0x19')],_0x411251['starttime']);this[_0x2e64('0x1b')]=0x0;this[_0x2e64('0x1c')]=0x0;this[_0x2e64('0x1d')]=_0x411251[_0x2e64('0x1d')];this[_0x2e64('0x1e')]=_0x411251[_0x2e64('0x1e')];this[_0x2e64('0x1f')]=_0x411251[_0x2e64('0x1f')];this[_0x2e64('0x20')]=_0x411251[_0x2e64('0x20')];this['ContactId']=_0x411251[_0x2e64('0x21')];this['ListId']=_0x411251['ListId'];this[_0x2e64('0x22')]=_0x411251[_0x2e64('0x22')];this[_0x2e64('0x23')]=_0x411251[_0x2e64('0x23')];this['CampaignId']=_0x411251['CampaignId'];this[_0x2e64('0x24')]=_0x411251[_0x2e64('0x24')]||'';this['originatecalleridname']=_0x411251[_0x2e64('0x25')]||'';}module[_0x2e64('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 9a3c773..9d23076 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 _0x8a33=['countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','ringtime','holdtime','membername','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','exports','util','lodash','milliseconds','seconds','state','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8a33,0x9b));var _0x38a3=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x8a33[_0x28a5ad];return _0x176b8a;};'use strict';var util=require(_0x38a3('0x0'));var _=require(_0x38a3('0x1'));var moment=require('moment');function getSeconds(_0x23a7ec,_0x519224){var _0xac7119=moment(_0x23a7ec)[_0x38a3('0x2')](0x0);var _0x2439e0=moment(_0x519224)[_0x38a3('0x2')](0x0);return _0xac7119['diff'](_0x2439e0,_0x38a3('0x3'));}function AgentComplete(_0x255cdb,_0x3848b2){this[_0x38a3('0x4')]=0x4;this['statedesc']='Answer';this[_0x38a3('0x5')]=_0x255cdb[_0x38a3('0x5')];this['type']=_0x255cdb[_0x38a3('0x6')];this[_0x38a3('0x7')]=_0x255cdb[_0x38a3('0x6')]===_0x38a3('0x8')?_0x38a3('0x9'):_0x255cdb[_0x38a3('0x6')];this[_0x38a3('0xa')]=_0x255cdb[_0x38a3('0xa')];this[_0x38a3('0xb')]=_0x255cdb[_0x38a3('0xb')];this[_0x38a3('0xc')]=_0x255cdb[_0x38a3('0xc')];this[_0x38a3('0xd')]=_0x255cdb[_0x38a3('0xa')]+_0x255cdb[_0x38a3('0xb')]+_0x255cdb[_0x38a3('0xc')]+_0x255cdb['countnosuchnumberretry']+_0x255cdb[_0x38a3('0xe')]+_0x255cdb[_0x38a3('0xf')]+_0x255cdb[_0x38a3('0x10')]+_0x255cdb[_0x38a3('0x11')];this[_0x38a3('0x12')]=_0x255cdb[_0x38a3('0x12')];this[_0x38a3('0xe')]=_0x255cdb[_0x38a3('0xe')];this[_0x38a3('0xf')]=_0x255cdb[_0x38a3('0xf')];this['countmachineretry']=_0x255cdb[_0x38a3('0x10')];this[_0x38a3('0x11')]=_0x255cdb[_0x38a3('0x11')];this['uniqueid']=_0x3848b2[_0x38a3('0x13')];this[_0x38a3('0x14')]=_0x255cdb[_0x38a3('0x15')];this[_0x38a3('0x16')]=_0x255cdb[_0x38a3('0x17')];this['starttime']=_0x255cdb[_0x38a3('0x18')];this[_0x38a3('0x19')]=_0x255cdb['responsetime'];this[_0x38a3('0x1a')]=_0x255cdb[_0x38a3('0x1a')];this[_0x38a3('0x1b')]=moment()[_0x38a3('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x38a3('0x1d')]=getSeconds(_0x255cdb[_0x38a3('0x19')],_0x255cdb['starttime']);this[_0x38a3('0x1e')]=getSeconds(_0x255cdb[_0x38a3('0x1a')],_0x255cdb[_0x38a3('0x19')]);this['talktime']=getSeconds(this[_0x38a3('0x1b')],_0x255cdb[_0x38a3('0x1a')]);this[_0x38a3('0x9')]=_0x3848b2[_0x38a3('0x9')];this[_0x38a3('0x1f')]=_0x3848b2['membername'];this[_0x38a3('0x20')]=_0x3848b2['reason'];this[_0x38a3('0x21')]=_0x255cdb['callback'];this['callbackuniqueid']=_0x255cdb['callbackuniqueid'];this[_0x38a3('0x22')]=_0x255cdb['callbackat'];this[_0x38a3('0x23')]=_0x255cdb[_0x38a3('0x23')];this[_0x38a3('0x24')]=_0x255cdb[_0x38a3('0x24')];this[_0x38a3('0x25')]=_0x255cdb[_0x38a3('0x25')];this[_0x38a3('0x26')]=_0x255cdb[_0x38a3('0x26')];this[_0x38a3('0x27')]=_0x255cdb[_0x38a3('0x27')];this[_0x38a3('0x28')]=_0x255cdb[_0x38a3('0x28')];this['originatecalleridnum']=_0x255cdb['originatecalleridnum']||'';this[_0x38a3('0x29')]=_0x255cdb['originatecalleridname']||'';}module[_0x38a3('0x2a')]=AgentComplete; \ No newline at end of file +var _0x69d2=['format','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','milliseconds','diff','state','statedesc','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','endtime'];(function(_0x2ff24b,_0x2cf969){var _0x5c8b2e=function(_0x424272){while(--_0x424272){_0x2ff24b['push'](_0x2ff24b['shift']());}};_0x5c8b2e(++_0x2cf969);}(_0x69d2,0x1a6));var _0x269d=function(_0x5ca5e3,_0x35af78){_0x5ca5e3=_0x5ca5e3-0x0;var _0x2f5834=_0x69d2[_0x5ca5e3];return _0x2f5834;};'use strict';var util=require(_0x269d('0x0'));var _=require(_0x269d('0x1'));var moment=require('moment');function getSeconds(_0x28feac,_0x1c3448){var _0x54e3df=moment(_0x28feac)[_0x269d('0x2')](0x0);var _0x2d7db9=moment(_0x1c3448)[_0x269d('0x2')](0x0);return _0x54e3df[_0x269d('0x3')](_0x2d7db9,'seconds');}function AgentComplete(_0x2c773b,_0x2ade3d){this[_0x269d('0x4')]=0x4;this[_0x269d('0x5')]=_0x269d('0x6');this[_0x269d('0x7')]=_0x2c773b[_0x269d('0x7')];this[_0x269d('0x8')]=_0x2c773b[_0x269d('0x8')];this['campaigntype']=_0x2c773b[_0x269d('0x8')]===_0x269d('0x9')?_0x269d('0xa'):_0x2c773b[_0x269d('0x8')];this[_0x269d('0xb')]=_0x2c773b[_0x269d('0xb')];this[_0x269d('0xc')]=_0x2c773b['countcongestionretry'];this[_0x269d('0xd')]=_0x2c773b[_0x269d('0xd')];this[_0x269d('0xe')]=_0x2c773b[_0x269d('0xb')]+_0x2c773b[_0x269d('0xc')]+_0x2c773b[_0x269d('0xd')]+_0x2c773b['countnosuchnumberretry']+_0x2c773b[_0x269d('0xf')]+_0x2c773b[_0x269d('0x10')]+_0x2c773b[_0x269d('0x11')]+_0x2c773b[_0x269d('0x12')];this[_0x269d('0x13')]=_0x2c773b[_0x269d('0x13')];this[_0x269d('0xf')]=_0x2c773b[_0x269d('0xf')];this[_0x269d('0x10')]=_0x2c773b[_0x269d('0x10')];this[_0x269d('0x11')]=_0x2c773b[_0x269d('0x11')];this[_0x269d('0x12')]=_0x2c773b[_0x269d('0x12')];this['uniqueid']=_0x2ade3d[_0x269d('0x14')];this[_0x269d('0x15')]=_0x2c773b[_0x269d('0x16')];this[_0x269d('0x17')]=_0x2c773b['number'];this[_0x269d('0x18')]=_0x2c773b[_0x269d('0x18')];this[_0x269d('0x19')]=_0x2c773b[_0x269d('0x19')];this[_0x269d('0x1a')]=_0x2c773b[_0x269d('0x1a')];this[_0x269d('0x1b')]=moment()[_0x269d('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x269d('0x1d')]=getSeconds(_0x2c773b['responsetime'],_0x2c773b[_0x269d('0x18')]);this[_0x269d('0x1e')]=getSeconds(_0x2c773b[_0x269d('0x1a')],_0x2c773b[_0x269d('0x19')]);this[_0x269d('0x1f')]=getSeconds(this[_0x269d('0x1b')],_0x2c773b['answertime']);this[_0x269d('0xa')]=_0x2ade3d[_0x269d('0xa')];this[_0x269d('0x20')]=_0x2ade3d[_0x269d('0x20')];this[_0x269d('0x21')]=_0x2ade3d[_0x269d('0x21')];this[_0x269d('0x22')]=_0x2c773b[_0x269d('0x22')];this[_0x269d('0x23')]=_0x2c773b['callbackuniqueid'];this[_0x269d('0x24')]=_0x2c773b[_0x269d('0x24')];this[_0x269d('0x25')]=_0x2c773b[_0x269d('0x25')];this[_0x269d('0x26')]=_0x2c773b[_0x269d('0x26')];this[_0x269d('0x27')]=_0x2c773b[_0x269d('0x27')];this['UserId']=_0x2c773b[_0x269d('0x28')];this[_0x269d('0x29')]=_0x2c773b[_0x269d('0x29')];this[_0x269d('0x2a')]=_0x2c773b['CampaignId'];this[_0x269d('0x2b')]=_0x2c773b[_0x269d('0x2b')]||'';this['originatecalleridname']=_0x2c773b['originatecalleridname']||'';}module[_0x269d('0x2c')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 636c43e..44aab4c 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 _0x0faf=['originatecalleridname','exports','util','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum'];(function(_0x2aacec,_0x436e99){var _0x267331=function(_0x58b2f3){while(--_0x58b2f3){_0x2aacec['push'](_0x2aacec['shift']());}};_0x267331(++_0x436e99);}(_0x0faf,0x132));var _0xf0fa=function(_0x6620b8,_0x8b3d5e){_0x6620b8=_0x6620b8-0x0;var _0x33de50=_0x0faf[_0x6620b8];return _0x33de50;};'use strict';var util=require(_0xf0fa('0x0'));var _=require('lodash');var moment=require(_0xf0fa('0x1'));function getSeconds(_0x1b4763,_0x2c6207){var _0x35a260=moment(_0x1b4763)[_0xf0fa('0x2')](0x0);var _0xdc9ce3=moment(_0x2c6207)[_0xf0fa('0x2')](0x0);return _0x35a260[_0xf0fa('0x3')](_0xdc9ce3,_0xf0fa('0x4'));}function Final(_0x5d9b58){this[_0xf0fa('0x5')]=_0x5d9b58[_0xf0fa('0x5')];this[_0xf0fa('0x6')]=_0x5d9b58[_0xf0fa('0x6')];this[_0xf0fa('0x7')]=_0x5d9b58['type'];this[_0xf0fa('0x8')]=_0x5d9b58[_0xf0fa('0x7')]==='outbound'?'queue':_0x5d9b58[_0xf0fa('0x7')];this[_0xf0fa('0x9')]=_0x5d9b58[_0xf0fa('0x9')];this[_0xf0fa('0xa')]=_0x5d9b58[_0xf0fa('0xa')];this[_0xf0fa('0xb')]=_0x5d9b58[_0xf0fa('0xb')];this[_0xf0fa('0xc')]=_0x5d9b58['countbusyretry']+_0x5d9b58[_0xf0fa('0xa')]+_0x5d9b58['countnoanswerretry']+_0x5d9b58[_0xf0fa('0xd')]+_0x5d9b58['countdropretry']+_0x5d9b58[_0xf0fa('0xe')]+_0x5d9b58[_0xf0fa('0xf')]+_0x5d9b58[_0xf0fa('0x10')];this['countnosuchnumberretry']=_0x5d9b58['countnosuchnumberretry'];this[_0xf0fa('0x11')]=_0x5d9b58['countdropretry'];this[_0xf0fa('0xe')]=_0x5d9b58[_0xf0fa('0xe')];this[_0xf0fa('0xf')]=_0x5d9b58[_0xf0fa('0xf')];this[_0xf0fa('0x10')]=_0x5d9b58[_0xf0fa('0x10')];this[_0xf0fa('0x12')]=_0x5d9b58[_0xf0fa('0x12')];this['calleridname']=_0x5d9b58[_0xf0fa('0x13')];this[_0xf0fa('0x14')]=_0x5d9b58[_0xf0fa('0x14')];this[_0xf0fa('0x15')]=_0x5d9b58[_0xf0fa('0x15')];this[_0xf0fa('0x16')]=_0x5d9b58['responsetime'];this['endtime']=_0x5d9b58[_0xf0fa('0x16')];this[_0xf0fa('0x17')]=_0x5d9b58[_0xf0fa('0x17')]||0x0;this[_0xf0fa('0x18')]=_0x5d9b58[_0xf0fa('0x18')]||0x0;this[_0xf0fa('0x19')]=_0x5d9b58[_0xf0fa('0x19')]||0x0;this[_0xf0fa('0x1a')]=_0x5d9b58[_0xf0fa('0x1a')];this[_0xf0fa('0x1b')]=_0x5d9b58[_0xf0fa('0x1b')];this['callbackat']=_0x5d9b58[_0xf0fa('0x1c')];this[_0xf0fa('0x1d')]=_0x5d9b58[_0xf0fa('0x1d')];this[_0xf0fa('0x1e')]=_0x5d9b58[_0xf0fa('0x1e')];this[_0xf0fa('0x1f')]=_0x5d9b58[_0xf0fa('0x1f')];this[_0xf0fa('0x20')]=_0x5d9b58[_0xf0fa('0x20')];this['VoiceQueueId']=_0x5d9b58[_0xf0fa('0x21')];this[_0xf0fa('0x22')]=_0x5d9b58['CampaignId'];this[_0xf0fa('0x23')]=_0x5d9b58[_0xf0fa('0x23')]||'';this[_0xf0fa('0x24')]=_0x5d9b58['originatecalleridname']||'';}module[_0xf0fa('0x25')]=Final; \ No newline at end of file +var _0xfa2b=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x2cb53c,_0x23adc0){_0x2cb53c=_0x2cb53c-0x0;var _0xcd1add=_0xfa2b[_0x2cb53c];return _0xcd1add;};'use strict';var util=require(_0xbfa2('0x0'));var _=require(_0xbfa2('0x1'));var moment=require(_0xbfa2('0x2'));function getSeconds(_0x9a9b55,_0x237b3e){var _0x41d712=moment(_0x9a9b55)[_0xbfa2('0x3')](0x0);var _0x1103cf=moment(_0x237b3e)[_0xbfa2('0x3')](0x0);return _0x41d712[_0xbfa2('0x4')](_0x1103cf,_0xbfa2('0x5'));}function Final(_0x2e8f3b){this[_0xbfa2('0x6')]=_0x2e8f3b[_0xbfa2('0x6')];this[_0xbfa2('0x7')]=_0x2e8f3b[_0xbfa2('0x7')];this['type']=_0x2e8f3b[_0xbfa2('0x8')];this['campaigntype']=_0x2e8f3b[_0xbfa2('0x8')]===_0xbfa2('0x9')?_0xbfa2('0xa'):_0x2e8f3b[_0xbfa2('0x8')];this[_0xbfa2('0xb')]=_0x2e8f3b[_0xbfa2('0xb')];this[_0xbfa2('0xc')]=_0x2e8f3b[_0xbfa2('0xc')];this[_0xbfa2('0xd')]=_0x2e8f3b['countnoanswerretry'];this['countglobal']=_0x2e8f3b['countbusyretry']+_0x2e8f3b[_0xbfa2('0xc')]+_0x2e8f3b[_0xbfa2('0xd')]+_0x2e8f3b[_0xbfa2('0xe')]+_0x2e8f3b[_0xbfa2('0xf')]+_0x2e8f3b[_0xbfa2('0x10')]+_0x2e8f3b[_0xbfa2('0x11')]+_0x2e8f3b['countagentrejectretry'];this[_0xbfa2('0xe')]=_0x2e8f3b[_0xbfa2('0xe')];this[_0xbfa2('0xf')]=_0x2e8f3b[_0xbfa2('0xf')];this[_0xbfa2('0x10')]=_0x2e8f3b['countabandonedretry'];this[_0xbfa2('0x11')]=_0x2e8f3b['countmachineretry'];this['countagentrejectretry']=_0x2e8f3b[_0xbfa2('0x12')];this['queue']=_0x2e8f3b['queue'];this[_0xbfa2('0x13')]=_0x2e8f3b[_0xbfa2('0x13')];this['calleridnum']=_0x2e8f3b[_0xbfa2('0x14')];this[_0xbfa2('0x15')]=_0x2e8f3b[_0xbfa2('0x15')];this[_0xbfa2('0x16')]=_0x2e8f3b[_0xbfa2('0x16')];this[_0xbfa2('0x17')]=_0x2e8f3b[_0xbfa2('0x16')];this['ringtime']=_0x2e8f3b[_0xbfa2('0x18')]||0x0;this[_0xbfa2('0x19')]=_0x2e8f3b[_0xbfa2('0x19')]||0x0;this['talktime']=_0x2e8f3b[_0xbfa2('0x1a')]||0x0;this[_0xbfa2('0x1b')]=_0x2e8f3b['callback'];this[_0xbfa2('0x1c')]=_0x2e8f3b['callbackuniqueid'];this['callbackat']=_0x2e8f3b[_0xbfa2('0x1d')];this[_0xbfa2('0x1e')]=_0x2e8f3b[_0xbfa2('0x1e')];this[_0xbfa2('0x1f')]=_0x2e8f3b['ContactId'];this['ListId']=_0x2e8f3b[_0xbfa2('0x20')];this[_0xbfa2('0x21')]=_0x2e8f3b['UserId'];this[_0xbfa2('0x22')]=_0x2e8f3b['VoiceQueueId'];this[_0xbfa2('0x23')]=_0x2e8f3b['CampaignId'];this[_0xbfa2('0x24')]=_0x2e8f3b[_0xbfa2('0x24')]||'';this[_0xbfa2('0x25')]=_0x2e8f3b[_0xbfa2('0x25')]||'';}module[_0xbfa2('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index dad9708..e02ce2b 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 _0x938c=['format','ringtime','holdtime','talktime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','util','lodash','moment','seconds','state','statedesc','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','endtime'];(function(_0x4c5774,_0x86d667){var _0x533026=function(_0xf1ef8b){while(--_0xf1ef8b){_0x4c5774['push'](_0x4c5774['shift']());}};_0x533026(++_0x86d667);}(_0x938c,0x177));var _0xc938=function(_0x2edc76,_0xe1c0be){_0x2edc76=_0x2edc76-0x0;var _0x7220dd=_0x938c[_0x2edc76];return _0x7220dd;};'use strict';var util=require(_0xc938('0x0'));var _=require(_0xc938('0x1'));var moment=require(_0xc938('0x2'));function getSeconds(_0x5e3fb6,_0x5e11ef){var _0x4bc8c0=moment(_0x5e3fb6)['milliseconds'](0x0);var _0x2c7478=moment(_0x5e11ef)['milliseconds'](0x0);return _0x4bc8c0['diff'](_0x2c7478,_0xc938('0x3'));}function Hangup(_0x57ae55,_0x218acc){this[_0xc938('0x4')]=0x4;this[_0xc938('0x5')]='Answer';this[_0xc938('0x6')]=_0x57ae55[_0xc938('0x6')];this['type']=_0x57ae55[_0xc938('0x7')];this[_0xc938('0x8')]=_0x57ae55[_0xc938('0x7')]==='outbound'?_0xc938('0x9'):_0x57ae55['type'];this[_0xc938('0xa')]=_0x57ae55[_0xc938('0xa')];this['countcongestionretry']=_0x57ae55[_0xc938('0xb')];this[_0xc938('0xc')]=_0x57ae55[_0xc938('0xc')];this[_0xc938('0xd')]=_0x57ae55[_0xc938('0xa')]+_0x57ae55[_0xc938('0xb')]+_0x57ae55['countnoanswerretry']+_0x57ae55[_0xc938('0xe')]+_0x57ae55[_0xc938('0xf')]+_0x57ae55[_0xc938('0x10')]+_0x57ae55[_0xc938('0x11')]+_0x57ae55[_0xc938('0x12')];this[_0xc938('0xe')]=_0x57ae55[_0xc938('0xe')];this[_0xc938('0xf')]=_0x57ae55[_0xc938('0xf')];this['countabandonedretry']=_0x57ae55[_0xc938('0x10')];this[_0xc938('0x11')]=_0x57ae55[_0xc938('0x11')];this[_0xc938('0x12')]=_0x57ae55[_0xc938('0x12')];this[_0xc938('0x13')]=_0x218acc[_0xc938('0x13')];this[_0xc938('0x14')]=_0x57ae55['name'];this['calleridnum']=_0x57ae55[_0xc938('0x15')];this['starttime']=_0x57ae55[_0xc938('0x16')];this['responsetime']=_0x57ae55[_0xc938('0x17')];this[_0xc938('0x18')]=moment()[_0xc938('0x19')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xc938('0x1a')]=getSeconds(_0x57ae55[_0xc938('0x17')],_0x57ae55['starttime']);this[_0xc938('0x1b')]=0x0;this[_0xc938('0x1c')]=getSeconds(this['endtime'],_0x57ae55[_0xc938('0x17')]);this[_0xc938('0x9')]=_0x57ae55['queue'];this[_0xc938('0x1d')]=_0xc938('0x1e');this['reason']=_0x218acc[_0xc938('0x1f')];this[_0xc938('0x20')]=_0x57ae55['callback'];this['callbackuniqueid']=_0x57ae55[_0xc938('0x21')];this[_0xc938('0x22')]=_0x57ae55[_0xc938('0x22')];this[_0xc938('0x23')]=_0x57ae55['recallme'];this['ContactId']=_0x57ae55[_0xc938('0x24')];this[_0xc938('0x25')]=_0x57ae55[_0xc938('0x25')];this[_0xc938('0x26')]=_0x57ae55[_0xc938('0x26')];this['VoiceQueueId']=_0x57ae55['VoiceQueueId'];this['CampaignId']=_0x57ae55[_0xc938('0x27')];}module['exports']=Hangup; \ No newline at end of file +var _0xc4ef=['ListId','UserId','VoiceQueueId','CampaignId','exports','lodash','moment','milliseconds','diff','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme'];(function(_0x510def,_0x11c2b1){var _0x1d43b5=function(_0x1af879){while(--_0x1af879){_0x510def['push'](_0x510def['shift']());}};_0x1d43b5(++_0x11c2b1);}(_0xc4ef,0x107));var _0xfc4e=function(_0x30f07a,_0x98341){_0x30f07a=_0x30f07a-0x0;var _0xb38461=_0xc4ef[_0x30f07a];return _0xb38461;};'use strict';var util=require('util');var _=require(_0xfc4e('0x0'));var moment=require(_0xfc4e('0x1'));function getSeconds(_0x4641be,_0x40714b){var _0x626b52=moment(_0x4641be)[_0xfc4e('0x2')](0x0);var _0x305e5c=moment(_0x40714b)[_0xfc4e('0x2')](0x0);return _0x626b52[_0xfc4e('0x3')](_0x305e5c,'seconds');}function Hangup(_0x596239,_0x207961){this['state']=0x4;this['statedesc']=_0xfc4e('0x4');this[_0xfc4e('0x5')]=_0x596239[_0xfc4e('0x5')];this[_0xfc4e('0x6')]=_0x596239[_0xfc4e('0x6')];this[_0xfc4e('0x7')]=_0x596239[_0xfc4e('0x6')]===_0xfc4e('0x8')?_0xfc4e('0x9'):_0x596239['type'];this['countbusyretry']=_0x596239[_0xfc4e('0xa')];this[_0xfc4e('0xb')]=_0x596239[_0xfc4e('0xb')];this[_0xfc4e('0xc')]=_0x596239[_0xfc4e('0xc')];this[_0xfc4e('0xd')]=_0x596239[_0xfc4e('0xa')]+_0x596239[_0xfc4e('0xb')]+_0x596239['countnoanswerretry']+_0x596239[_0xfc4e('0xe')]+_0x596239[_0xfc4e('0xf')]+_0x596239[_0xfc4e('0x10')]+_0x596239[_0xfc4e('0x11')]+_0x596239[_0xfc4e('0x12')];this[_0xfc4e('0xe')]=_0x596239[_0xfc4e('0xe')];this['countdropretry']=_0x596239[_0xfc4e('0xf')];this[_0xfc4e('0x10')]=_0x596239[_0xfc4e('0x10')];this[_0xfc4e('0x11')]=_0x596239[_0xfc4e('0x11')];this['countagentrejectretry']=_0x596239['countagentrejectretry'];this['uniqueid']=_0x207961[_0xfc4e('0x13')];this[_0xfc4e('0x14')]=_0x596239[_0xfc4e('0x15')];this[_0xfc4e('0x16')]=_0x596239[_0xfc4e('0x17')];this[_0xfc4e('0x18')]=_0x596239[_0xfc4e('0x18')];this[_0xfc4e('0x19')]=_0x596239[_0xfc4e('0x19')];this[_0xfc4e('0x1a')]=moment()['format'](_0xfc4e('0x1b'));this[_0xfc4e('0x1c')]=getSeconds(_0x596239[_0xfc4e('0x19')],_0x596239[_0xfc4e('0x18')]);this[_0xfc4e('0x1d')]=0x0;this[_0xfc4e('0x1e')]=getSeconds(this[_0xfc4e('0x1a')],_0x596239[_0xfc4e('0x19')]);this[_0xfc4e('0x9')]=_0x596239[_0xfc4e('0x9')];this[_0xfc4e('0x1f')]='IVR';this[_0xfc4e('0x20')]=_0x207961[_0xfc4e('0x21')];this[_0xfc4e('0x22')]=_0x596239[_0xfc4e('0x22')];this['callbackuniqueid']=_0x596239[_0xfc4e('0x23')];this[_0xfc4e('0x24')]=_0x596239[_0xfc4e('0x24')];this[_0xfc4e('0x25')]=_0x596239[_0xfc4e('0x25')];this['ContactId']=_0x596239['ContactId'];this[_0xfc4e('0x26')]=_0x596239['ListId'];this['UserId']=_0x596239[_0xfc4e('0x27')];this[_0xfc4e('0x28')]=_0x596239['VoiceQueueId'];this[_0xfc4e('0x29')]=_0x596239[_0xfc4e('0x29')];}module[_0xfc4e('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 8f37245..f1a2138 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 _0x4c71=['name','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','queue','calleridname'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x4c71,0x138));var _0x14c7=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x4c71[_0x5c2e3e];return _0x53f64a;};'use strict';var util=require(_0x14c7('0x0'));var _=require(_0x14c7('0x1'));var moment=require(_0x14c7('0x2'));function getSeconds(_0x439d92,_0x82bc48){var _0x11d6b8=moment(_0x439d92)[_0x14c7('0x3')](0x0);var _0x1ca12d=moment(_0x82bc48)['milliseconds'](0x0);return _0x11d6b8['diff'](_0x1ca12d,_0x14c7('0x4'));}function History(_0x1e68c8){this[_0x14c7('0x5')]=_0x1e68c8['uniqueid'];this[_0x14c7('0x6')]=_0x1e68c8[_0x14c7('0x6')]||undefined;this['type']=_0x1e68c8[_0x14c7('0x7')];this[_0x14c7('0x8')]=_0x1e68c8[_0x14c7('0x7')]===_0x14c7('0x9')?'queue':_0x1e68c8['type'];this[_0x14c7('0xa')]=_0x1e68c8[_0x14c7('0xa')];this[_0x14c7('0xb')]=_0x1e68c8[_0x14c7('0xb')];this['countnoanswerretry']=_0x1e68c8[_0x14c7('0xc')];this[_0x14c7('0xd')]=_0x1e68c8[_0x14c7('0xa')]+_0x1e68c8['countcongestionretry']+_0x1e68c8[_0x14c7('0xc')]+_0x1e68c8[_0x14c7('0xe')]+_0x1e68c8[_0x14c7('0xf')]+_0x1e68c8['countabandonedretry']+_0x1e68c8[_0x14c7('0x10')]+_0x1e68c8[_0x14c7('0x11')];this[_0x14c7('0xe')]=_0x1e68c8[_0x14c7('0xe')];this[_0x14c7('0xf')]=_0x1e68c8[_0x14c7('0xf')];this[_0x14c7('0x12')]=_0x1e68c8['countabandonedretry'];this[_0x14c7('0x10')]=_0x1e68c8[_0x14c7('0x10')];this['countagentrejectretry']=_0x1e68c8[_0x14c7('0x11')];this[_0x14c7('0x13')]=_0x1e68c8[_0x14c7('0x13')];this[_0x14c7('0x14')]=_0x1e68c8[_0x14c7('0x15')];this[_0x14c7('0x16')]=_0x1e68c8['number'];this[_0x14c7('0x17')]=_0x1e68c8[_0x14c7('0x17')];this['responsetime']=_0x1e68c8[_0x14c7('0x18')];this[_0x14c7('0x19')]=_0x1e68c8[_0x14c7('0x18')];this[_0x14c7('0x1a')]=getSeconds(_0x1e68c8['responsetime'],_0x1e68c8[_0x14c7('0x17')]);this[_0x14c7('0x1b')]=0x0;this[_0x14c7('0x1c')]=0x0;this[_0x14c7('0x1d')]=_0x1e68c8[_0x14c7('0x1d')];this['callbackuniqueid']=_0x1e68c8['callbackuniqueid'];this['callbackat']=_0x1e68c8['callbackat'];this[_0x14c7('0x1e')]=_0x1e68c8[_0x14c7('0x1e')];this[_0x14c7('0x1f')]=_0x1e68c8[_0x14c7('0x1f')];this[_0x14c7('0x20')]=_0x1e68c8[_0x14c7('0x20')];this['UserId']=_0x1e68c8['UserId'];this[_0x14c7('0x21')]=_0x1e68c8[_0x14c7('0x21')];this['CampaignId']=_0x1e68c8['CampaignId'];this['originatecalleridnum']=_0x1e68c8[_0x14c7('0x22')]||'';this[_0x14c7('0x23')]=_0x1e68c8[_0x14c7('0x23')]||'';}module[_0x14c7('0x24')]=History; \ No newline at end of file +var _0x05ea=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','outbound'];(function(_0x11e584,_0x283b75){var _0x5ec3ad=function(_0x3d8cbb){while(--_0x3d8cbb){_0x11e584['push'](_0x11e584['shift']());}};_0x5ec3ad(++_0x283b75);}(_0x05ea,0x187));var _0xa05e=function(_0x52f1e6,_0xf70489){_0x52f1e6=_0x52f1e6-0x0;var _0x21f104=_0x05ea[_0x52f1e6];return _0x21f104;};'use strict';var util=require('util');var _=require(_0xa05e('0x0'));var moment=require(_0xa05e('0x1'));function getSeconds(_0x429dfe,_0x542cbe){var _0x172a41=moment(_0x429dfe)[_0xa05e('0x2')](0x0);var _0x4d355f=moment(_0x542cbe)[_0xa05e('0x2')](0x0);return _0x172a41[_0xa05e('0x3')](_0x4d355f,_0xa05e('0x4'));}function History(_0x270898){this[_0xa05e('0x5')]=_0x270898[_0xa05e('0x5')];this[_0xa05e('0x6')]=_0x270898[_0xa05e('0x6')]||undefined;this[_0xa05e('0x7')]=_0x270898[_0xa05e('0x7')];this['campaigntype']=_0x270898[_0xa05e('0x7')]===_0xa05e('0x8')?_0xa05e('0x9'):_0x270898[_0xa05e('0x7')];this[_0xa05e('0xa')]=_0x270898[_0xa05e('0xa')];this[_0xa05e('0xb')]=_0x270898[_0xa05e('0xb')];this[_0xa05e('0xc')]=_0x270898['countnoanswerretry'];this[_0xa05e('0xd')]=_0x270898['countbusyretry']+_0x270898['countcongestionretry']+_0x270898[_0xa05e('0xc')]+_0x270898['countnosuchnumberretry']+_0x270898[_0xa05e('0xe')]+_0x270898[_0xa05e('0xf')]+_0x270898[_0xa05e('0x10')]+_0x270898[_0xa05e('0x11')];this[_0xa05e('0x12')]=_0x270898[_0xa05e('0x12')];this['countdropretry']=_0x270898['countdropretry'];this['countabandonedretry']=_0x270898[_0xa05e('0xf')];this['countmachineretry']=_0x270898[_0xa05e('0x10')];this[_0xa05e('0x11')]=_0x270898[_0xa05e('0x11')];this[_0xa05e('0x9')]=_0x270898[_0xa05e('0x9')];this[_0xa05e('0x13')]=_0x270898[_0xa05e('0x14')];this[_0xa05e('0x15')]=_0x270898[_0xa05e('0x16')];this[_0xa05e('0x17')]=_0x270898[_0xa05e('0x17')];this['responsetime']=_0x270898[_0xa05e('0x18')];this[_0xa05e('0x19')]=_0x270898[_0xa05e('0x18')];this[_0xa05e('0x1a')]=getSeconds(_0x270898['responsetime'],_0x270898[_0xa05e('0x17')]);this[_0xa05e('0x1b')]=0x0;this[_0xa05e('0x1c')]=0x0;this[_0xa05e('0x1d')]=_0x270898[_0xa05e('0x1d')];this[_0xa05e('0x1e')]=_0x270898[_0xa05e('0x1e')];this[_0xa05e('0x1f')]=_0x270898[_0xa05e('0x1f')];this[_0xa05e('0x20')]=_0x270898['recallme'];this[_0xa05e('0x21')]=_0x270898['ContactId'];this['ListId']=_0x270898[_0xa05e('0x22')];this['UserId']=_0x270898[_0xa05e('0x23')];this[_0xa05e('0x24')]=_0x270898[_0xa05e('0x24')];this['CampaignId']=_0x270898[_0xa05e('0x25')];this[_0xa05e('0x26')]=_0x270898['originatecalleridnum']||'';this[_0xa05e('0x27')]=_0x270898[_0xa05e('0x27')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index f6e8e0a..1b34c00 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 _0xe5af=['dialAMDSilenceThreshold','Contact','tags','createdAt','updatedAt','%s%s','dialRandomLastDigitCallerIdNumber','originatecalleridname','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','isSuccess','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialMachineRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','custom:agentnoanswer','noanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','dialPredictiveInterval','startMethodPredictive','Predictive\x20after\x20first\x20interval','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','abandonmentRate','[CatchErlangB]','floor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','[getContactDialer2]','tryOriginatePredictive','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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','exports','lodash','bluebird','moment','md5','ioredis','../../../config/environment/','../../../config/logger','booked','predictiveCalls','syncQueueSummary','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperFinal','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startProgressive','queueBooked','queueBookedRR','agentconnect','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','bind','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','Intervals','INTERVAL_IS_NULL','[ifTime][Action]','Error','milliseconds','diff','seconds','emit','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','format','campaign:ivr:%s','campaign:save','isEmpty','-----\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','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','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','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','merge','startPredictive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','\x22%s\x22\x20<%s>','string','\x22\x22\x20<>','error','inspect','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','state','statedesc','starttime','clearZombieChannels','[uniqueid]','[actions]','undefined','isNil','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','[Dialer][checkChannel]','queue','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','verifyAdditionalPhones','then','[verifyAdditionalPhone]\x20','swapAdditionalPhones','[swapAdditionalPhone]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ContactId','VoiceQueueId','CampaignId','[emptyContact]','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','custom:amd','amd','[syncHangupInAMD][createHistory]','MACHINE','Machine','membername','AMD','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countbusyretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','reason','agent','dialQueueProject2','[syncAgentComplete][createHistory]','[syncAgentComplete]','syncAgentConnect','answertime','[syncQueueCallerAbandon]\x20[Drop]','responsetime','outboundDropCallsDayTimeout','Drop','dropreason','dialDropRetryFrequency','callAdditionalPhoneAfterMin','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncQueueMember','actionid','locked','paused','stateinterface','push','queueStatusComplete','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','command','interval','indexOf','content','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','progressive','handlePower','power','predictive','Queue','method\x20not\x20recognized','handleIvr','dialMethod','dialTimezone','checkDialMethod','[syncQueueSummary]','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','dialAgiAfterHangupAgent','dialQueueTimeout','dialer','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD'];(function(_0x1ee16b,_0x57c085){var _0x24a5a7=function(_0x51aac0){while(--_0x51aac0){_0x1ee16b['push'](_0x1ee16b['shift']());}};_0x24a5a7(++_0x57c085);}(_0xe5af,0x9c));var _0xfe5a=function(_0x853127,_0x1dc3c1){_0x853127=_0x853127-0x0;var _0x8006fb=_0xe5af[_0x853127];return _0x8006fb;};'use strict';var util=require('util');var _=require(_0xfe5a('0x0'));var BPromise=require(_0xfe5a('0x1'));var uuid=require('uuid');var moment=require(_0xfe5a('0x2'));var rr=require('rr');var md5=require(_0xfe5a('0x3'));var Redis=require(_0xfe5a('0x4'));var ut=require('../preview/util/util');var config=require(_0xfe5a('0x5'));var logger=require('../../../config/logger')('dialer');var loggerBooked=require(_0xfe5a('0x6'))(_0xfe5a('0x7'));var loggerPredictive=require('../../../config/logger')('predictive');var loggerPredictiveCalls=require(_0xfe5a('0x6'))(_0xfe5a('0x8'));var loggerSyncQueueSummary=require(_0xfe5a('0x6'))(_0xfe5a('0x9'));var ami=require('../ami');config[_0xfe5a('0xa')]=_['defaults'](config['redis'],{'host':_0xfe5a('0xb'),'port':0x18eb});var io=require(_0xfe5a('0xc'))(new Redis(config['redis']));var cmHopper=require(_0xfe5a('0xd'));var cmHopperHistory=require(_0xfe5a('0xe'));var cmHopperFinal=require(_0xfe5a('0xf'));var cmHopperAdditionalPhone=require(_0xfe5a('0x10'));var cmHopperBlack=require(_0xfe5a('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require(_0xfe5a('0x12'));var History=require(_0xfe5a('0x13'));var Final=require(_0xfe5a('0x14'));var AgentComplete=require(_0xfe5a('0x15'));var QueueCallerAbandon=require(_0xfe5a('0x16'));var Hangup=require('./hangup');var ipAgi=process[_0xfe5a('0x17')][_0xfe5a('0x18')]||_0xfe5a('0x19');var strategy={'rrmemory':_0xfe5a('0x1a'),'roundrobin':_0xfe5a('0x1b')};var Sequence=function(){};Sequence[_0xfe5a('0x1c')][_0xfe5a('0x1d')]=function(_0xeb454){this[_0xfe5a('0x1e')]=this[_0xfe5a('0x1e')]?this[_0xfe5a('0x1e')][_0xfe5a('0x1f')](_0xeb454):_0xeb454();};function Dialer(_0x22afa7,_0x290600){this[_0xfe5a('0x20')]=new Sequence();this[_0xfe5a('0x21')]=_0x290600;this['voiceQueues']=_0x22afa7[_0xfe5a('0x22')];this[_0xfe5a('0x23')]=_0x22afa7['campaigns'];this[_0xfe5a('0x24')]=_0x22afa7[_0xfe5a('0x24')];this[_0xfe5a('0x25')]=_0x22afa7['trunks'];this['maxNumberOriginate']=config[_0xfe5a('0x26')]||0x2;this[_0xfe5a('0x27')]={};this[_0xfe5a('0x28')]={};this[_0xfe5a('0x29')]={};this[_0xfe5a('0x2a')]={};this[_0xfe5a('0x2b')]={};this['startPredictive']={};this[_0xfe5a('0x2c')]={};this['ivrOriginated']={};this[_0xfe5a('0x2d')]={};this[_0xfe5a('0x2e')]={};ami['on'](_0xfe5a('0x2f'),this['syncAgentConnect']['bind'](this));ami['on'](_0xfe5a('0x30'),this[_0xfe5a('0x31')]['bind'](this));ami['on'](_0xfe5a('0x32'),this[_0xfe5a('0x33')]['bind'](this));ami['on'](_0xfe5a('0x34'),this[_0xfe5a('0x35')][_0xfe5a('0x36')](this));ami['on'](_0xfe5a('0x37'),this['syncQueueSummary'][_0xfe5a('0x36')](this));ami['on'](_0xfe5a('0x38'),this[_0xfe5a('0x39')][_0xfe5a('0x36')](this));ami['on'](_0xfe5a('0x3a'),this[_0xfe5a('0x3b')][_0xfe5a('0x36')](this));ami['on'](_0xfe5a('0x3c'),this['syncVarSet']['bind'](this));ami['on'](_0xfe5a('0x3d'),this['syncQueueMember'][_0xfe5a('0x36')](this));ami['on'](_0xfe5a('0x3e'),this[_0xfe5a('0x3f')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x32d31e){return _0x32d31e!==null&&!_['isUndefined'](_0x32d31e);}function checkIsLoggedIn(_0x51d1f4,_0x498b64){return function(){if(_0x498b64<=0x0){_0x51d1f4[_0xfe5a('0x40')]=_0xfe5a('0x41');throw _0x51d1f4[_0xfe5a('0x42')]+_0xfe5a('0x43');}};}function isActive(_0xb164e0){return _0xb164e0;}function checkIsActive(_0x286f27,_0x7593cf){return function(){if(!isActive(_0x7593cf)){_0x286f27[_0xfe5a('0x40')]=_0xfe5a('0x44');throw _0x286f27[_0xfe5a('0x42')]+_0xfe5a('0x45');}};}function checkInterval(_0x517969){return function(){if(!isNotNull(_0x517969[_0xfe5a('0x46')])){_0x517969[_0xfe5a('0x40')]='INTERVAL_IS_NULL';throw _0x517969[_0xfe5a('0x42')]+_0xfe5a('0x47');}if(!isNotNull(_0x517969[_0xfe5a('0x46')][_0xfe5a('0x48')])){_0x517969[_0xfe5a('0x40')]='INTERVAL_IS_NULL';throw _0x517969['name']+_0xfe5a('0x47');}if(!isNotNull(_['isEmpty'](_0x517969[_0xfe5a('0x46')][_0xfe5a('0x48')]))){_0x517969[_0xfe5a('0x40')]=_0xfe5a('0x49');throw _0x517969['name']+_0xfe5a('0x47');}};}function msgResponse(_0x1817fe,_0x2e3a36,_0x5d4753){return{'action':_0x1817fe,'response':_0x2e3a36,'message':_0x5d4753,'stack':_0x5d4753};}function myreject(_0x3206f1){return function(_0x35588b){return _0x3206f1(msgResponse(_0xfe5a('0x4a'),_0xfe5a('0x4b'),JSON['stringify'](_0x35588b)));};}function getSeconds(_0x2ab654,_0x48bd13){var _0x302b5c=moment(_0x2ab654)[_0xfe5a('0x4c')](0x0);var _0x576189=moment(_0x48bd13)[_0xfe5a('0x4c')](0x0);return _0x302b5c[_0xfe5a('0x4d')](_0x576189,_0xfe5a('0x4e'));}function emit(_0x2444d5,_0x54fb09,_0x193ce0){io['to'](_0x2444d5)[_0xfe5a('0x4f')](_0x54fb09,_0x193ce0);}function emitVoiceQueueSummary(_0x188470){if(_0x188470['type']===_0xfe5a('0x50')){var _0x2d0be6={'id':_0x188470['id'],'name':_0x188470[_0xfe5a('0x42')],'strategy':_0x188470[_0xfe5a('0x51')],'answered':_0x188470[_0xfe5a('0x52')],'available':_0x188470[_0xfe5a('0x53')],'loggedIn':_0x188470[_0xfe5a('0x54')],'pTalking':_0x188470[_0xfe5a('0x55')],'sumBillable':_0x188470[_0xfe5a('0x56')],'sumDuration':_0x188470[_0xfe5a('0x57')],'sumHoldTime':_0x188470[_0xfe5a('0x58')]||0x0,'talking':_0x188470['talking'],'total':_0x188470[_0xfe5a('0x59')],'type':_0x188470[_0xfe5a('0x5a')],'unmanaged':_0x188470[_0xfe5a('0x5b')],'abandoned':_0x188470[_0xfe5a('0x5c')],'waiting':_0x188470[_0xfe5a('0x5d')],'loggedInDb':_0x188470[_0xfe5a('0x5e')],'dialActive':_0x188470[_0xfe5a('0x5f')],'dialMethod':_0x188470['dialMethod'],'dialOriginateCallerIdName':_0x188470[_0xfe5a('0x60')],'dialOriginateCallerIdNumber':_0x188470[_0xfe5a('0x61')],'dialOriginateTimeout':_0x188470['dialOriginateTimeout'],'dialPrefix':_0x188470['dialPrefix'],'outboundAnswerAgiCallsDay':_0x188470[_0xfe5a('0x62')],'outboundAnswerCallsDay':_0x188470['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x188470['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x188470[_0xfe5a('0x63')],'outboundCongestionCallsDay':_0x188470[_0xfe5a('0x64')],'outboundDropCallsDayACS':_0x188470['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x188470[_0xfe5a('0x65')],'outboundDropCallsDayTimeout':_0x188470['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x188470[_0xfe5a('0x66')],'outboundNoSuchCallsDay':_0x188470[_0xfe5a('0x67')],'outboundOriginateFailureCallsDay':_0x188470[_0xfe5a('0x68')],'outboundReCallsDay':_0x188470[_0xfe5a('0x69')],'outboundRejectCallsDay':_0x188470[_0xfe5a('0x6a')],'outboundUnknownCallsDay':_0x188470[_0xfe5a('0x6b')],'predictiveIntervalAnsweredCalls':_0x188470['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x188470[_0xfe5a('0x6c')],'predictiveIntervalAvgTalktime':_0x188470[_0xfe5a('0x6d')],'predictiveIntervalDroppedCallsCallersExit':_0x188470[_0xfe5a('0x6e')],'predictiveIntervalDroppedCallsTimeout':_0x188470[_0xfe5a('0x6f')],'predictiveIntervalErlangCalls':_0x188470[_0xfe5a('0x70')],'predictiveIntervalErlangCallsDroppedCalls':_0x188470[_0xfe5a('0x71')],'predictiveIntervalHitRate':_0x188470[_0xfe5a('0x72')],'predictiveIntervalMultiplicativeFactor':_0x188470[_0xfe5a('0x73')],'predictiveIntervalPauses':_0x188470[_0xfe5a('0x74')],'predictiveIntervalAvailable':_0x188470[_0xfe5a('0x75')],'predictiveIntervalTotalCalls':_0x188470[_0xfe5a('0x76')],'message':_0x188470[_0xfe5a('0x40')],'originated':_0x188470[_0xfe5a('0x77')],'erlangCalls':_0x188470[_0xfe5a('0x78')],'erlangCallToSecond':_0x188470['erlangCallToSecond'],'erlangAbandonmentRate':_0x188470[_0xfe5a('0x79')],'erlangBusyFactor':_0x188470[_0xfe5a('0x7a')],'startPredictive':_0x188470['startPredictive'],'startProgressive':_0x188470['startProgressive']};if(_0x188470[_0xfe5a('0x7b')]){_0x2d0be6[_0xfe5a('0x7b')]={'id':_0x188470[_0xfe5a('0x7b')]['id'],'name':_0x188470[_0xfe5a('0x7b')][_0xfe5a('0x42')],'active':_0x188470[_0xfe5a('0x7b')][_0xfe5a('0x7c')],'callerid':_0x188470['Trunk'][_0xfe5a('0x7d')]};}if(_0x188470['Interval']){_0x2d0be6[_0xfe5a('0x46')]={'id':_0x188470['Interval']['id'],'name':_0x188470[_0xfe5a('0x46')][_0xfe5a('0x42')]};}var _0x1b2ba4=md5(JSON[_0xfe5a('0x7e')](_0x2d0be6));if(_0x188470['md5']!==_0x1b2ba4){_0x188470[_0xfe5a('0x3')]=_0x1b2ba4;emit(util[_0xfe5a('0x7f')]('voice:queue:%s',_0x2d0be6[_0xfe5a('0x42')]),'voice_queue:save',_0x2d0be6);}}}function emitCampaignSummary(_0x567596){if(_0x567596[_0xfe5a('0x5a')]==='ivr'){emit(util[_0xfe5a('0x7f')](_0xfe5a('0x80'),_0x567596[_0xfe5a('0x42')]),_0xfe5a('0x81'),_0x567596);}}function checkGetDataPredictive(_0x522e8b){if(isNotNull(_0x522e8b)&&!_[_0xfe5a('0x82')](_0x522e8b)){loggerPredictive['info'](_0xfe5a('0x83'));loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x85'),_0x522e8b['predictiveIntervalTotalCalls']);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x86'),_0x522e8b['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x87'),_0x522e8b[_0xfe5a('0x6f')]);loggerPredictive['info'](_0xfe5a('0x88'),_0x522e8b[_0xfe5a('0x6e')]);loggerPredictive[_0xfe5a('0x84')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x522e8b[_0xfe5a('0x6c')]);loggerPredictive[_0xfe5a('0x84')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x522e8b[_0xfe5a('0x6d')]);loggerPredictive['info'](_0xfe5a('0x89'));if(_0x522e8b[_0xfe5a('0x76')]>0x0){if(!_[_0xfe5a('0x8a')](_0x522e8b[_0xfe5a('0x6d')])&&_0x522e8b[_0xfe5a('0x6d')]>0x0){return!![];}loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x8b'));if(!_[_0xfe5a('0x8a')](_0x522e8b[_0xfe5a('0x6c')])&&_0x522e8b[_0xfe5a('0x6c')]>0x0){return!![];}loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x8c'));}else{loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x8d'));}}else{loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x8e'));}return![];}function mergeDataErlangB(_0x590c04){return function(_0x450390){loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x8f'));loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x90'),_0x450390[_0xfe5a('0x78')]);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x91'),_0x450390[_0xfe5a('0x92')]);loggerPredictive[_0xfe5a('0x84')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x450390[_0xfe5a('0x79')]);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x93'),_0x450390['erlangBusyFactor']);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x94'),_0x450390['erlangAbandonmentRate']);loggerPredictive[_0xfe5a('0x84')]('---------------------------');_[_0xfe5a('0x95')](_0x590c04,_0x450390);};}function getDiff(_0x4b4673){var _0x100e6e=moment()['milliseconds'](0x0);var _0x4a75d2=moment(_0x4b4673)['milliseconds'](0x0);return _0x100e6e[_0xfe5a('0x4d')](_0x4a75d2,_0xfe5a('0x4e'));}function ifInterval(_0x2f9c77,_0x1437d5){if(_[_0xfe5a('0x8a')](_0x1437d5)){return![];}return getDiff(_0x1437d5)<_0x2f9c77*0x3c;}function freeVariablesPredictive(_0x4b6d4c){if(isNotNull(_0x4b6d4c)){if(!_['isUndefined'](_0x4b6d4c[_0xfe5a('0x2c')])){_0x4b6d4c['startProgressive']=undefined;loggerPredictive[_0xfe5a('0x84')](_0x4b6d4c[_0xfe5a('0x42')],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xfe5a('0x8a')](_0x4b6d4c[_0xfe5a('0x96')])){_0x4b6d4c[_0xfe5a('0x96')]=undefined;loggerPredictive[_0xfe5a('0x84')](_0x4b6d4c[_0xfe5a('0x42')],_0xfe5a('0x97'));}if(!_['isUndefined'](_0x4b6d4c[_0xfe5a('0x98')])){clearInterval(_0x4b6d4c[_0xfe5a('0x98')]);_0x4b6d4c[_0xfe5a('0x98')]=undefined;loggerPredictive[_0xfe5a('0x84')](_0x4b6d4c[_0xfe5a('0x42')],_0xfe5a('0x99'));}}}function erlangb(_0x31ae99,_0x5ecaff){if(_0x5ecaff===0x0){return 0x0;}var _0x4beb54=0x1;for(var _0x5b8882=0x1;_0x5b8882<=_0x5ecaff;_0x5b8882+=0x1){_0x4beb54=0x1+_0x4beb54*_0x5b8882/_0x31ae99;}return 0x1/_0x4beb54;}function isVoiceQueueOutbound(_0x2db325){return _0x2db325==='outbound';}function isNotPreview(_0x21f471){return _0x21f471!==_0xfe5a('0x21');}function isCampaignIvr(_0x5aea07){return _0x5aea07===_0xfe5a('0x9a');}function getCallerId(_0x42e8d6,_0x22c488,_0x2cf784){if(!_[_0xfe5a('0x8a')](_0x2cf784)&&typeof _0x2cf784==='string'&&!_[_0xfe5a('0x82')](_0x2cf784)){if(!_[_0xfe5a('0x8a')](_0x22c488)&&typeof _0x22c488==='string'&&!_['isEmpty'](_0x22c488)){return util[_0xfe5a('0x7f')]('\x22%s\x22\x20<%s>',_0x22c488,_0x2cf784);}return util[_0xfe5a('0x7f')](_0xfe5a('0x9b'),_0x2cf784,_0x2cf784);}if(!_[_0xfe5a('0x8a')](_0x42e8d6)&&typeof _0x42e8d6===_0xfe5a('0x9c')&&!_[_0xfe5a('0x82')](_0x42e8d6)){return _0x42e8d6;}return _0xfe5a('0x9d');}function loggerCatchQueueSummary(_0x173f4e,_0x528bc0){return function(_0x28b980){freeVariablesPredictive(_0x528bc0);emitVoiceQueueSummary(_0x528bc0);emitCampaignSummary(_0x528bc0);loggerSyncQueueSummary[_0xfe5a('0x9e')](_0x173f4e,util[_0xfe5a('0x9f')](_0x28b980,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x4459ac,_0x41b3cf){return function(_0x5dcdca){loggerPredictive[_0xfe5a('0x9e')](_0x41b3cf[_0xfe5a('0x42')],_0x4459ac);loggerPredictive['error'](_0x5dcdca[_0xfe5a('0xa0')]);freeVariablesPredictive(_0x41b3cf);};}function loggerCatch(_0x3589bf){return function(_0xd14fed){logger['error'](_0x3589bf,util[_0xfe5a('0x9f')](_0xd14fed,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2e7474){return _0x2e7474&&!_['isUndefined'](_0x2e7474)&&_0x2e7474[_0xfe5a('0xa1')]>0x0;}function decremetOriginate(_0x1d4a93){if(!_['isUndefined'](_0x1d4a93)&&_0x1d4a93!==null){if(typeof _0x1d4a93[_0xfe5a('0x77')]!=='undefined'){if(_0x1d4a93[_0xfe5a('0x77')]>0x0){_0x1d4a93[_0xfe5a('0x77')]-=0x1;}else{logger[_0xfe5a('0x9e')](_0xfe5a('0xa2'));}}}else{logger['error'](_0xfe5a('0xa3'));}}function checkContactLowerLimitOriginate(_0x5af2d8,_0x56c531,_0x414388){if(_0x56c531>_0x414388){for(var _0x398405=0x0;_0x398405<_0x56c531-_0x414388;_0x398405+=0x1){decremetOriginate(_0x5af2d8);}}}function loggerGetContactDialer(_0x28af22,_0x4f23da,_0x78ccef){return function(_0x51bbab){checkContactLowerLimitOriginate(_0x4f23da,_0x78ccef,0x0);logger[_0xfe5a('0x9e')](_0x28af22,util[_0xfe5a('0x9f')](_0x51bbab,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2c2118){return function(_0x1ec229){if(isNotNull(_0x1ec229)&&isNotNull(_0x1ec229[0x0])){if(_0x1ec229[0x0]['contactsRescheduled']>0x0){_0x2c2118[_0xfe5a('0x40')]=_0xfe5a('0xa4');logger['info'](_0xfe5a('0xa5')+_0x2c2118['name'],_0x1ec229[0x0]['contactsRescheduled'],_0xfe5a('0xa6'));}else{_0x2c2118['message']=_0xfe5a('0xa7');logger['info'](_0xfe5a('0xa8')+_0x2c2118[_0xfe5a('0x42')]);}}};}function notSendMessagesQueue(_0x276c4d){if(_0x276c4d[_0xfe5a('0xa9')]){freeVariablesPredictive(_0x276c4d);if(_0x276c4d[_0xfe5a('0x77')]===0x0&&_0x276c4d[_0xfe5a('0xaa')]===0x0&&_0x276c4d[_0xfe5a('0x5d')]===0x0&&(_0x276c4d[_0xfe5a('0x55')]||0x0)===0x0){_0x276c4d[_0xfe5a('0xa9')]=![];_0x276c4d[_0xfe5a('0x53')]=0x0;_0x276c4d[_0xfe5a('0x40')]=_0xfe5a('0x44');loggerSyncQueueSummary[_0xfe5a('0x9e')](_0xfe5a('0xab'),_0x276c4d['name'],_0xfe5a('0xac'));}else{_0x276c4d[_0xfe5a('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xfe5a('0x9e')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x276c4d[_0xfe5a('0x42')],'is\x20disactive');}emitVoiceQueueSummary(_0x276c4d);}}function notSendMessagesCampaign(_0x4687fb){if(_0x4687fb['sendMessageOneNotActive']){if(_0x4687fb[_0xfe5a('0x77')]===0x0){_0x4687fb[_0xfe5a('0xa9')]=![];_0x4687fb[_0xfe5a('0x40')]=_0xfe5a('0x44');loggerSyncQueueSummary[_0xfe5a('0x9e')](_0xfe5a('0xad'),_0x4687fb[_0xfe5a('0x42')],_0xfe5a('0xac'));}else{_0x4687fb[_0xfe5a('0x40')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0xfe5a('0xad'),_0x4687fb[_0xfe5a('0x42')],_0xfe5a('0xae'));}emitCampaignSummary(_0x4687fb);}}function createObjHistory(_0x21a806,_0x2bcb45,_0xbbdd44,_0x1c96c8,_0x57fd97){_0x21a806[_0xfe5a('0x40')]=_0xbbdd44;var _0x29c0cc=new Action(_0x21a806,_0x2bcb45);var _0x75f836=new History(_0x29c0cc);_0x75f836[_0xfe5a('0xaf')]=_0x1c96c8;_0x75f836[_0xfe5a('0xb0')]=_0x57fd97;_0x75f836['endtime']=_0x29c0cc[_0xfe5a('0xb1')];return _0x75f836;}Dialer[_0xfe5a('0x1c')]['loopClearZombieChannels']=function(){var _0x20816b=this;setInterval(function(){_0x20816b[_0xfe5a('0xb2')](_0x20816b[_0xfe5a('0x2a')],_0xfe5a('0xb3'));_0x20816b[_0xfe5a('0xb2')](_0x20816b['actions'],_0xfe5a('0xb4'));},0x32c8);};Dialer[_0xfe5a('0x1c')]['clearZombieChannels']=function(_0x49226f,_0x52cd15){var _0x5aecce=this;for(var _0x1f3af1 in _0x49226f){if(typeof _0x49226f[_0x1f3af1]!==_0xfe5a('0xb5')){this['sequence']['enqueue'](function(){if(!_[_0xfe5a('0xb6')](_0x49226f[_0x1f3af1])){return ami[_0xfe5a('0xb7')]({'action':_0xfe5a('0xb8'),'channel':_0x49226f[_0x1f3af1][_0xfe5a('0xb9')]})[_0xfe5a('0xba')](function(_0x29b5c2){if(_0x29b5c2[_0xfe5a('0x40')]===_0xfe5a('0xbb')){setTimeout(function(){if(_0x49226f[_0x1f3af1]&&_0x49226f[_0x1f3af1]['type']!=='ivr'){_0x5aecce[_0xfe5a('0xbc')](_0x5aecce[_0xfe5a('0x22')][_0x49226f[_0x1f3af1]['queue']]);logger[_0xfe5a('0x9e')](_0xfe5a('0xbd'),_0x52cd15,_0x1f3af1,_0x49226f[_0x1f3af1][_0xfe5a('0xbe')]);delete _0x49226f[_0x1f3af1];}if(_0x49226f[_0x1f3af1]&&_0x49226f[_0x1f3af1][_0xfe5a('0x5a')]===_0xfe5a('0x9a')){_0x5aecce[_0xfe5a('0xbc')](_0x5aecce['campaigns'][_0x49226f[_0x1f3af1][_0xfe5a('0xbe')]]);logger[_0xfe5a('0x9e')](_0xfe5a('0xbf'),_0x52cd15,_0x1f3af1,_0x49226f[_0x1f3af1]['queue']);delete _0x49226f[_0x1f3af1];}},0x2328);}});}});}}};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xc0')]=function(_0x3a9b9b){return BPromise[_0xfe5a('0xc1')]()['then'](cmHopper[_0xfe5a('0xc0')](_0x3a9b9b))['catch'](loggerCatch(_0xfe5a('0xc2')));};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xc3')]=function(_0x265eca){return BPromise[_0xfe5a('0xc1')]()['then'](cmHopperBlack[_0xfe5a('0xc3')](_0x265eca))[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0xc4')));};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xc5')]=function(_0x3dcf82,_0x401590,_0x543b13){return BPromise[_0xfe5a('0xc1')]()[_0xfe5a('0xc6')](cmHopperAdditionalPhone[_0xfe5a('0xc5')](_0x3dcf82,_0x401590,_0x543b13))[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0xc7')));};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xc8')]=function(_0x315bc7,_0x11c7b8,_0x8f2501){return BPromise[_0xfe5a('0xc1')]()[_0xfe5a('0xc6')](cmHopperAdditionalPhone[_0xfe5a('0xc8')](_0x315bc7,_0x11c7b8,_0x8f2501))[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0xc9')));};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xca')]=function(_0x58ffea){return BPromise['resolve']()[_0xfe5a('0xc6')](cmHopperBlack[_0xfe5a('0xca')](_0x58ffea))[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0xcb')));};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xcc')]=function(_0x3bebe6){return BPromise[_0xfe5a('0xc1')]()[_0xfe5a('0xc6')](cmHopperHistory[_0xfe5a('0xcd')](_0x3bebe6))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xce')]=function(_0x35c702){return BPromise[_0xfe5a('0xc1')]()['then'](cmHopper['rescheduleContact'](_0x35c702))['catch'](loggerCatch(_0xfe5a('0xcf')));};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xd0')]=function(_0x511dc4,_0x2a2cb9,_0x55813a){return BPromise['resolve']()['then'](cmHopper['unlockContact'](_0x511dc4,_0x2a2cb9,_0x55813a))[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0xd1')));};Dialer['prototype'][_0xfe5a('0xd2')]=function(_0xc10a14,_0x458115,_0xe7a03c,_0x47050b,_0x373965){return BPromise[_0xfe5a('0xc1')]()['then'](cmHopper['getContactDialer'](_0xc10a14,_0x458115,_0xe7a03c,_0x47050b))['catch'](function(_0x5c55d4){_0x373965[_0xfe5a('0xd3')]-=_0xe7a03c;_0x373965['temp']=_0x373965[_0xfe5a('0xd3')]>0x0?_0x373965[_0xfe5a('0xd3')]:0x0;loggerCatch(_0xfe5a('0xd4'))(_0x5c55d4);});};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xd5')]=function(_0x44fc5f,_0x1dfebd,_0x7d3d46,_0x1d8c8c){return BPromise[_0xfe5a('0xc1')]()[_0xfe5a('0xc6')](cmHopper['getContactDialerIvr'](_0x44fc5f,_0x1dfebd,_0x7d3d46))[_0xfe5a('0xba')](function(_0x41488d){_0x1d8c8c[_0xfe5a('0xd3')]-=_0x1dfebd;_0x1d8c8c[_0xfe5a('0xd3')]=_0x1d8c8c[_0xfe5a('0xd3')]>0x0?_0x1d8c8c['temp']:0x0;loggerCatch(_0xfe5a('0xd6'))(_0x41488d);});};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xd7')]=function(_0x19f5de){return BPromise[_0xfe5a('0xc1')]()['then'](voiceQueueRt[_0xfe5a('0xd7')](_0x19f5de))[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0xd8')));};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xd9')]=function(_0x57adf8){return BPromise[_0xfe5a('0xc1')]()[_0xfe5a('0xc6')](cmHopper[_0xfe5a('0xd9')](_0x57adf8))[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0xda')));};Dialer[_0xfe5a('0x1c')]['createHistory']=function(_0x4726d9){return BPromise[_0xfe5a('0xc1')]()[_0xfe5a('0xc6')](cmHopperHistory[_0xfe5a('0xdb')](_0x4726d9))[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0xdc')));};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xbc')]=function(_0x27e658){if(!_[_0xfe5a('0x8a')](_0x27e658)&&_0x27e658!==null){if(typeof _0x27e658[_0xfe5a('0x77')]!==_0xfe5a('0xb5')){if(_0x27e658[_0xfe5a('0x77')]>0x0){_0x27e658['originated']-=0x1;}else{logger[_0xfe5a('0x9e')](_0xfe5a('0xdd'));}}}else{logger[_0xfe5a('0x9e')](_0xfe5a('0xde'));}};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xdf')]=function(_0x1dde2c,_0x58b72b){var _0x334fc0=this;return function(_0x11b294){_0x334fc0[_0xfe5a('0xbc')](_0x58b72b);logger[_0xfe5a('0x9e')](_0x1dde2c,util['inspect'](_0x11b294,{'showHidden':![],'depth':null}));};};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xe0')]=function(_0x87d923,_0x2781c9,_0x228f44){var _0x19f5c9={'state':0x19,'statedesc':_0xfe5a('0xe1')};this[_0xfe5a('0xbc')](_0x2781c9);this[_0xfe5a('0xe2')](_[_0xfe5a('0x95')](_0x19f5c9,_[_0xfe5a('0xe3')](_0x228f44,[_0xfe5a('0xe4'),'ListId','UserId',_0xfe5a('0xe5'),_0xfe5a('0xe6')])),'[emptyContact][createHistory]',_0xfe5a('0xe7'));logger[_0xfe5a('0x9e')](_0x87d923);};Dialer['prototype']['isSuccess']=function(_0xbd2d9c){return _0xbd2d9c===_0xfe5a('0xe8');};Dialer['prototype'][_0xfe5a('0xe9')]=function(_0x15b6ac){return!_[_0xfe5a('0x8a')](_0x15b6ac)&&_0x15b6ac&&!_[_0xfe5a('0x8a')](_0x15b6ac[_0xfe5a('0x42')])&&!_[_0xfe5a('0x8a')](_0x15b6ac[_0xfe5a('0x7c')])&&_0x15b6ac['active']&&(this['trunks'][util['format'](_0xfe5a('0xea'),_0x15b6ac[_0xfe5a('0x42')])][_0xfe5a('0xb8')]===_0xfe5a('0xeb')||this[_0xfe5a('0x25')][util[_0xfe5a('0x7f')](_0xfe5a('0xea'),_0x15b6ac['name'])]['status']===_0xfe5a('0xec'));};Dialer[_0xfe5a('0x1c')][_0xfe5a('0xe2')]=function(_0x5a7c43,_0x358984,_0x509e84){this['createHistory'](_0x5a7c43)[_0xfe5a('0xba')](loggerCatch(_0x358984));this['moveContactManagedDialer'](_0x5a7c43)[_0xfe5a('0xba')](loggerCatch(_0x509e84));};Dialer[_0xfe5a('0x1c')]['syncVarSet']=function(_0x855226){var _0x43b192=this[_0xfe5a('0x2a')][_0x855226[_0xfe5a('0xed')]];var _0x37ccb4;if(!_[_0xfe5a('0xb6')](_0x855226)&&!_[_0xfe5a('0xb6')](_0x855226[_0xfe5a('0xee')])&&!_[_0xfe5a('0xb6')](_0x855226[_0xfe5a('0xee')][_0xfe5a('0xef')])&&_0x855226['exten']===_0xfe5a('0xf0')&&_0x43b192){if(_0x43b192[_0xfe5a('0x5a')]!==_0xfe5a('0x9a')&&this[_0xfe5a('0x22')][_0x43b192[_0xfe5a('0xbe')]][_0xfe5a('0xf1')]&&_0x855226[_0xfe5a('0xf2')]===_0xfe5a('0xf3')){delete this['uniqueId'][_0x855226[_0xfe5a('0xed')]];this[_0xfe5a('0xbc')](this['voiceQueues'][_0x43b192[_0xfe5a('0xbe')]]);this['voiceQueues'][_0x43b192[_0xfe5a('0xbe')]][_0xfe5a('0xf4')]+=0x1;this[_0xfe5a('0x22')][_0x43b192['queue']][_0xfe5a('0x62')]+=0x1;_0x37ccb4=new Hangup(_0x43b192,_0x855226);_0x37ccb4[_0xfe5a('0xaf')]=0x12;_0x37ccb4[_0xfe5a('0xb0')]='HangupInAMD';_0x37ccb4['membername']='AMD';ami[_0xfe5a('0x4f')](_0xfe5a('0xf5'),ut['buildObj'](_0x37ccb4,_0xfe5a('0xf6')));this[_0xfe5a('0xe2')](_0x37ccb4,_0xfe5a('0xf7'),'[syncHangupInAMD]');}if(_0x43b192[_0xfe5a('0x5a')]!==_0xfe5a('0x9a')&&this[_0xfe5a('0x22')][_0x43b192['queue']][_0xfe5a('0xf1')]&&_0x855226[_0xfe5a('0xf2')]===_0xfe5a('0xf8')){var _0x9c213e=this;return new BPromise(function(_0x29745b,_0x3f302d){delete _0x9c213e[_0xfe5a('0x2a')][_0x855226[_0xfe5a('0xed')]];_0x9c213e[_0xfe5a('0xbc')](_0x9c213e[_0xfe5a('0x22')][_0x43b192['queue']]);_0x9c213e[_0xfe5a('0x22')][_0x43b192[_0xfe5a('0xbe')]][_0xfe5a('0xf4')]+=0x1;_0x9c213e['voiceQueues'][_0x43b192['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x42ea8a=_0x9c213e[_0xfe5a('0x22')][_0x43b192[_0xfe5a('0xbe')]];var _0x4cda26=new Hangup(_0x43b192,_0x855226);_0x4cda26[_0xfe5a('0xaf')]=0x13;_0x4cda26[_0xfe5a('0xb0')]=_0xfe5a('0xf9');_0x4cda26[_0xfe5a('0xfa')]=_0xfe5a('0xfb');_0x4cda26['countmachineretry']+=0x1;_0x4cda26[_0xfe5a('0xfc')]+=0x1;_0x4cda26[_0xfe5a('0xf6')]=!![];ami[_0xfe5a('0x4f')]('custom:amd',ut[_0xfe5a('0xfd')](_0x4cda26,_0xfe5a('0xf6')));_0x9c213e[_0xfe5a('0xdb')](_0x4cda26)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0xfe')));if(_0x4cda26['countbusyretry']+_0x4cda26[_0xfe5a('0xff')]+_0x4cda26[_0xfe5a('0x100')]+_0x4cda26['countnosuchnumberretry']+_0x4cda26[_0xfe5a('0x101')]+_0x4cda26['countabandonedretry']+_0x4cda26[_0xfe5a('0x102')]+_0x4cda26['countagentrejectretry']>=_0x42ea8a['dialGlobalMaxRetry']){_0x9c213e[_0xfe5a('0x103')](_0x4cda26,_0x29745b,_0x3f302d,_0xfe5a('0x104'));}else{if(_0x4cda26[_0xfe5a('0x102')]>=_0x42ea8a[_0xfe5a('0x105')]){_0x9c213e[_0xfe5a('0x106')](_0x4cda26,_0x29745b,_0x3f302d,_0xfe5a('0x107'));}else{_0x9c213e[_0xfe5a('0xce')]({'active':![],'countmachineretry':_0x4cda26[_0xfe5a('0x102')],'scheduledat':moment()[_0xfe5a('0x108')](_0x42ea8a['dialMachineRetryFrequency'],_0xfe5a('0x109'))[_0xfe5a('0x7f')](_0xfe5a('0x10a')),'ContactId':_0x4cda26['ContactId'],'ListId':_0x4cda26[_0xfe5a('0x10b')],'VoiceQueueId':_0x4cda26[_0xfe5a('0xe5')]||undefined,'CampaignId':_0x4cda26[_0xfe5a('0xe6')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x29745b({'reschedule':0x1});}}});}if(_0x43b192['type']===_0xfe5a('0x9a')&&this['campaigns'][_0x43b192[_0xfe5a('0xbe')]][_0xfe5a('0xf1')]&&_0x855226['value']===_0xfe5a('0xf3')){delete this[_0xfe5a('0x2a')][_0x855226[_0xfe5a('0xed')]];this['updateOriginated'](this['campaigns'][_0x43b192[_0xfe5a('0xbe')]]);_0x37ccb4=new Hangup(_0x43b192,_0x855226);_0x37ccb4[_0xfe5a('0xaf')]=0x12;_0x37ccb4[_0xfe5a('0xb0')]=_0xfe5a('0x10c');_0x37ccb4['membername']=_0xfe5a('0xfb');ami[_0xfe5a('0x4f')]('custom:amd',ut[_0xfe5a('0xfd')](_0x37ccb4,_0xfe5a('0xf6')));this[_0xfe5a('0xe2')](_0x37ccb4,_0xfe5a('0x10d'),_0xfe5a('0x10e'));}if(_0x43b192[_0xfe5a('0x5a')]===_0xfe5a('0x9a')&&this['campaigns'][_0x43b192[_0xfe5a('0xbe')]]['dialAMDActive']&&_0x855226[_0xfe5a('0xf2')]===_0xfe5a('0xf8')){var _0x9c213e=this;return new BPromise(function(_0x909b5e,_0x237ce0){delete _0x9c213e[_0xfe5a('0x2a')][_0x855226[_0xfe5a('0xed')]];_0x9c213e[_0xfe5a('0xbc')](_0x9c213e[_0xfe5a('0x23')][_0x43b192[_0xfe5a('0xbe')]]);_0x9c213e['campaigns'][_0x43b192['queue']][_0xfe5a('0xf4')]+=0x1;_0x9c213e[_0xfe5a('0x23')][_0x43b192[_0xfe5a('0xbe')]][_0xfe5a('0x62')]+=0x1;var _0xbb8f7f=_0x9c213e[_0xfe5a('0x23')][_0x43b192[_0xfe5a('0xbe')]];var _0x22466d=new Hangup(_0x43b192,_0x855226);_0x22466d[_0xfe5a('0xaf')]=0x13;_0x22466d[_0xfe5a('0xb0')]=_0xfe5a('0xf9');_0x22466d['membername']=_0xfe5a('0xfb');_0x22466d[_0xfe5a('0x102')]+=0x1;_0x22466d['countglobal']+=0x1;_0x22466d['amd']=!![];ami[_0xfe5a('0x4f')](_0xfe5a('0xf5'),ut[_0xfe5a('0xfd')](_0x22466d,'amd'));_0x9c213e[_0xfe5a('0xdb')](_0x22466d)[_0xfe5a('0xba')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x22466d[_0xfe5a('0x10f')]+_0x22466d['countcongestionretry']+_0x22466d[_0xfe5a('0x100')]+_0x22466d[_0xfe5a('0x110')]+_0x22466d['countdropretry']+_0x22466d['countabandonedretry']+_0x22466d[_0xfe5a('0x102')]+_0x22466d[_0xfe5a('0x111')]>=_0xbb8f7f[_0xfe5a('0x112')]){_0x9c213e['stateGlobal'](_0x22466d,_0x909b5e,_0x237ce0,_0xfe5a('0x104'));}else{if(_0x22466d[_0xfe5a('0x102')]>=_0xbb8f7f[_0xfe5a('0x105')]){_0x9c213e[_0xfe5a('0x106')](_0x22466d,_0x909b5e,_0x237ce0,_0xfe5a('0x107'));}else{_0x9c213e[_0xfe5a('0xce')]({'active':![],'countmachineretry':_0x22466d[_0xfe5a('0x102')],'scheduledat':moment()[_0xfe5a('0x108')](_0xbb8f7f['dialMachineRetryFrequency'],_0xfe5a('0x109'))[_0xfe5a('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x22466d[_0xfe5a('0xe4')],'ListId':_0x22466d[_0xfe5a('0x10b')],'VoiceQueueId':_0x22466d[_0xfe5a('0xe5')]||undefined,'CampaignId':_0x22466d[_0xfe5a('0xe6')]||undefined})[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x113')));_0x909b5e({'reschedule':0x1});}}});}}};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x39')]=function(_0x345d30){var _0x58b7e8=this['uniqueId'][_0x345d30[_0xfe5a('0xed')]];var _0x1f0ba6=this;var _0x524df8;if(_0x58b7e8&&_0x58b7e8[_0xfe5a('0x5a')]===_0xfe5a('0x9a')){delete this[_0xfe5a('0x2a')][_0x345d30[_0xfe5a('0xed')]];this[_0xfe5a('0xbc')](this[_0xfe5a('0x23')][_0x58b7e8[_0xfe5a('0xbe')]]);this[_0xfe5a('0x23')][_0x58b7e8[_0xfe5a('0xbe')]][_0xfe5a('0x114')]+=0x1;_0x524df8=new Hangup(_0x58b7e8,_0x345d30);this[_0xfe5a('0xdb')](_0x524df8)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x115')));this[_0xfe5a('0xd9')](_0x524df8)['catch'](loggerCatch(_0xfe5a('0x116')));}if(_0x58b7e8&&_0x58b7e8[_0xfe5a('0x5a')]!=='ivr'&&isNotNull(this[_0xfe5a('0x22')][_0x58b7e8['queue']]['dialQueueProject'])){delete this[_0xfe5a('0x2a')][_0x345d30[_0xfe5a('0xed')]];this['updateOriginated'](this['voiceQueues'][_0x58b7e8[_0xfe5a('0xbe')]]);this[_0xfe5a('0x22')][_0x58b7e8['queue']][_0xfe5a('0xf4')]+=0x1;this[_0xfe5a('0x22')][_0x58b7e8[_0xfe5a('0xbe')]][_0xfe5a('0x62')]+=0x1;_0x524df8=new Hangup(_0x58b7e8,_0x345d30);_0x524df8['state']=0x10;_0x524df8[_0xfe5a('0xb0')]=_0xfe5a('0x117');_0x524df8['membername']=_0xfe5a('0x118');this[_0xfe5a('0xdb')](_0x524df8)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x115')));this[_0xfe5a('0xd9')](_0x524df8)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x58b7e8&&_0x58b7e8[_0xfe5a('0x5a')]!=='ivr'&&!isNotNull(this['voiceQueues'][_0x58b7e8[_0xfe5a('0xbe')]][_0xfe5a('0x119')])){delete this[_0xfe5a('0x2a')][_0x345d30[_0xfe5a('0xed')]];this[_0xfe5a('0xbc')](this[_0xfe5a('0x22')][_0x58b7e8[_0xfe5a('0xbe')]]);this[_0xfe5a('0x22')][_0x58b7e8[_0xfe5a('0xbe')]]['outboundUnknownCallsDay']+=0x1;_0x524df8=new Hangup(_0x58b7e8,_0x345d30);_0x524df8[_0xfe5a('0xaf')]=0xc;_0x524df8[_0xfe5a('0xb0')]=_0x345d30['cause-txt'];_0x524df8[_0xfe5a('0xfa')]='Unknow';this[_0xfe5a('0xdb')](_0x524df8)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x115')));this[_0xfe5a('0xd9')](_0x524df8)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x116')));}};Dialer['prototype'][_0xfe5a('0x35')]=function(_0x360fcd){var _0x137342=this[_0xfe5a('0x2a')][_0x360fcd['uniqueid']];var _0x3333b4=this;if(this[_0xfe5a('0x22')][_0x360fcd['queue']]){if(_0x137342&&_0x137342[_0xfe5a('0x5a')]!=='ivr'){delete this[_0xfe5a('0x2a')][_0x360fcd[_0xfe5a('0xed')]];this[_0xfe5a('0x22')][_0x360fcd[_0xfe5a('0xbe')]]['outboundAnswerCallsDay']+=0x1;var _0x1c3993=new AgentComplete(_0x137342,_0x360fcd);if(_0x360fcd[_0xfe5a('0x11a')]===_0xfe5a('0x11b')){_0x1c3993['agiafterat']=this['voiceQueues'][_0x360fcd[_0xfe5a('0xbe')]][_0xfe5a('0x11c')]&&this[_0xfe5a('0x22')][_0x360fcd[_0xfe5a('0xbe')]]['dialAgiAfterHangupAgent']?moment()[_0xfe5a('0x7f')](_0xfe5a('0x10a')):undefined;}this[_0xfe5a('0xdb')](_0x1c3993)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x11d')));this['moveContactManagedDialer'](_0x1c3993)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x11e')));}}};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x11f')]=function(_0x9ef9b3){if(this['voiceQueues'][_0x9ef9b3[_0xfe5a('0xbe')]]){if(this[_0xfe5a('0x2a')][_0x9ef9b3['uniqueid']]&&this[_0xfe5a('0x2a')][_0x9ef9b3[_0xfe5a('0xed')]][_0xfe5a('0x5a')]!==_0xfe5a('0x9a')){this[_0xfe5a('0xbc')](this[_0xfe5a('0x22')][_0x9ef9b3[_0xfe5a('0xbe')]]);this[_0xfe5a('0x2a')][_0x9ef9b3['uniqueid']][_0xfe5a('0x120')]=moment()[_0xfe5a('0x7f')](_0xfe5a('0x10a'));}}};Dialer[_0xfe5a('0x1c')]['queueCallerAbandonCreateState']=function(_0x5718b4,_0x453c7f){this[_0xfe5a('0xdb')](_0x5718b4)['catch'](loggerCatch(_0xfe5a('0x11d')));if(_0x453c7f==0x0){this[_0xfe5a('0xd9')](_0x5718b4)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x121')));}};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x291265){var _0xff24d5=this[_0xfe5a('0x2a')][_0x291265[_0xfe5a('0xed')]];var _0x511578=this;var _0x437cd5=![];var _0x56f5d9;var _0x3111fb;if(this[_0xfe5a('0x22')][_0x291265['queue']]){if(_0xff24d5&&_0xff24d5['type']!==_0xfe5a('0x9a')){delete this[_0xfe5a('0x2a')][_0x291265[_0xfe5a('0xed')]];this[_0xfe5a('0xbc')](this[_0xfe5a('0x22')][_0x291265[_0xfe5a('0xbe')]]);_0xff24d5['droptime']=moment()[_0xfe5a('0x7f')](_0xfe5a('0x10a'));var _0x5077ed=new QueueCallerAbandon(_0xff24d5,_0x291265);if(getSeconds(_0xff24d5['droptime'],_0xff24d5[_0xfe5a('0x122')])>=_0xff24d5['dialQueueTimeout']){this[_0xfe5a('0x22')][_0x291265[_0xfe5a('0xbe')]][_0xfe5a('0x6f')]+=0x1;this[_0xfe5a('0x22')][_0x291265[_0xfe5a('0xbe')]][_0xfe5a('0x123')]+=0x1;this[_0xfe5a('0x22')][_0x291265['queue']][_0xfe5a('0x71')]+=0x1;_0x5077ed[_0xfe5a('0xaf')]=0xa;_0x5077ed['statedesc']=_0xfe5a('0x124');_0x5077ed[_0xfe5a('0x125')]='TIMEOUT';_0x5077ed['agiafterat']=this['voiceQueues'][_0x291265[_0xfe5a('0xbe')]][_0xfe5a('0x11c')]?moment()['format'](_0xfe5a('0x10a')):undefined;_0x5077ed['countdropretry']+=0x1;_0x5077ed[_0xfe5a('0xfc')]+=0x1;_0x56f5d9=this['voiceQueues'][_0x291265[_0xfe5a('0xbe')]][_0xfe5a('0x126')];_0x3111fb=this[_0xfe5a('0x22')][_0x291265['queue']][_0xfe5a('0x127')];_0x511578['verifyAdditionalPhones'](_0x5077ed,_0x5077ed[_0xfe5a('0xaf')],_0xff24d5[_0xfe5a('0x128')])['then'](function(_0x4285d3){_0x437cd5=_0x4285d3[_0xfe5a('0x129')]==0x1;if(_0x5077ed[_0xfe5a('0x101')]>=_0x511578[_0xfe5a('0x22')][_0x291265[_0xfe5a('0xbe')]][_0xfe5a('0x12a')]){_0x511578[_0xfe5a('0x12b')](_0x5077ed,_0x4285d3['additional']);}else{_0x511578[_0xfe5a('0xce')]({'active':![],'countdropretry':_0x5077ed[_0xfe5a('0x101')],'scheduledat':moment()['add'](_0x511578['voiceQueues'][_0x291265[_0xfe5a('0xbe')]]['dialDropRetryFrequency'],_0xfe5a('0x109'))[_0xfe5a('0x7f')](_0xfe5a('0x10a')),'ContactId':_0xff24d5[_0xfe5a('0xe4')],'ListId':_0xff24d5[_0xfe5a('0x10b')],'VoiceQueueId':_0xff24d5['VoiceQueueId']||undefined,'CampaignId':_0xff24d5[_0xfe5a('0xe6')]||undefined})[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x12c')));var _0x1cf8d4=new History(_0x5077ed);_0x1cf8d4[_0xfe5a('0xaf')]=0xa;_0x1cf8d4[_0xfe5a('0xb0')]=_0xfe5a('0x124');_0x1cf8d4[_0xfe5a('0xb1')]=moment()[_0xfe5a('0x7f')](_0xfe5a('0x10a'));_0x1cf8d4[_0xfe5a('0x12d')]=_0x1cf8d4[_0xfe5a('0xb1')];_0x1cf8d4['calleridname']=_0x5077ed[_0xfe5a('0x12e')];_0x1cf8d4['calleridnum']=_0x5077ed[_0xfe5a('0x12f')];_0x511578[_0xfe5a('0xdb')](_0x1cf8d4)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x130')));}})[_0xfe5a('0xc6')](function(_0x5c9e6e){if(_0x437cd5)_0x511578[_0xfe5a('0xc8')](_0x5077ed,_0x56f5d9,_0x3111fb)[_0xfe5a('0xc6')](function(_0x20d3bc){return 0x1;});});}else{this[_0xfe5a('0x22')][_0x291265['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x291265[_0xfe5a('0xbe')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5077ed[_0xfe5a('0xaf')]=0xb;_0x5077ed[_0xfe5a('0xb0')]=_0xfe5a('0x131');_0x5077ed['dropreason']=_0xfe5a('0x132');_0x5077ed[_0xfe5a('0x133')]+=0x1;_0x5077ed['countglobal']+=0x1;_0x56f5d9=this[_0xfe5a('0x22')][_0x291265['queue']]['dialAbandonedRetryFrequency'];_0x3111fb=this[_0xfe5a('0x22')][_0x291265[_0xfe5a('0xbe')]][_0xfe5a('0x127')];_0x511578['verifyAdditionalPhones'](_0x5077ed,_0x5077ed[_0xfe5a('0xaf')],_0xff24d5['voiceQueue'])[_0xfe5a('0xc6')](function(_0x4d8a5c){if(_0x5077ed[_0xfe5a('0x133')]>=_0x511578[_0xfe5a('0x22')][_0x291265[_0xfe5a('0xbe')]][_0xfe5a('0x134')]){_0x511578[_0xfe5a('0x12b')](_0x5077ed,_0x4d8a5c[_0xfe5a('0x129')]);}else{_0x511578['rescheduleContact']({'active':![],'countabandonedretry':_0x5077ed[_0xfe5a('0x133')],'scheduledat':moment()[_0xfe5a('0x108')](_0x511578[_0xfe5a('0x22')][_0x291265[_0xfe5a('0xbe')]][_0xfe5a('0x135')],_0xfe5a('0x109'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xff24d5['ContactId'],'ListId':_0xff24d5['ListId'],'VoiceQueueId':_0xff24d5[_0xfe5a('0xe5')]||undefined,'CampaignId':_0xff24d5[_0xfe5a('0xe6')]||undefined})[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x136')));var _0xa1ac14=new History(_0x5077ed);_0xa1ac14[_0xfe5a('0xaf')]=0xb;_0xa1ac14[_0xfe5a('0xb0')]=_0xfe5a('0x131');_0xa1ac14[_0xfe5a('0xb1')]=moment()[_0xfe5a('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');_0xa1ac14[_0xfe5a('0x12d')]=_0xa1ac14[_0xfe5a('0xb1')];_0xa1ac14['calleridname']=_0x5077ed[_0xfe5a('0x12e')];_0xa1ac14[_0xfe5a('0x12f')]=_0x5077ed[_0xfe5a('0x12f')];_0x511578[_0xfe5a('0xdb')](_0xa1ac14)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xfe5a('0xc6')](function(_0x38c107){if(_0x437cd5)_0x511578[_0xfe5a('0xc8')](_0x5077ed,_0x56f5d9,_0x3111fb)[_0xfe5a('0xc6')](function(_0x3c7ab6){return 0x1;});});}}}};Dialer['prototype'][_0xfe5a('0x3b')]=function(_0x4c6f22){if(this[_0xfe5a('0x28')][_0x4c6f22[_0xfe5a('0xed')]]){this[_0xfe5a('0x28')][_0x4c6f22[_0xfe5a('0xed')]][_0xfe5a('0xb9')]=_0x4c6f22[_0xfe5a('0xb9')];}if(this['uniqueId'][_0x4c6f22[_0xfe5a('0xed')]]){this[_0xfe5a('0x2a')][_0x4c6f22[_0xfe5a('0xed')]]['channel']=_0x4c6f22['channel'];}};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x137')]=function(_0x52a5cc){if(strategy[this['voiceQueues'][this[_0xfe5a('0x28')][_0x52a5cc['actionid']]['queue']][_0xfe5a('0x51')]]===_0xfe5a('0x1b')){if(this[_0xfe5a('0x28')][_0x52a5cc[_0xfe5a('0x138')]]&&_['isNil'](this['actions'][_0x52a5cc[_0xfe5a('0x138')]][_0xfe5a('0x139')])&&_0x52a5cc[_0xfe5a('0xb8')]==='1'&&_0x52a5cc[_0xfe5a('0x13a')]==='0'){if(this[_0xfe5a('0x24')][_0x52a5cc[_0xfe5a('0x13b')]]){if(!this[_0xfe5a('0x24')][_0x52a5cc[_0xfe5a('0x13b')]][_0xfe5a('0x139')]){this['agents'][_0x52a5cc[_0xfe5a('0x13b')]][_0xfe5a('0x139')]=!![];this[_0xfe5a('0x28')][_0x52a5cc['actionid']][_0xfe5a('0x139')]=!![];this[_0xfe5a('0x28')][_0x52a5cc[_0xfe5a('0x138')]][_0xfe5a('0x13b')]=_0x52a5cc['stateinterface'];}}}}else if((strategy[this[_0xfe5a('0x22')][this[_0xfe5a('0x28')][_0x52a5cc['actionid']][_0xfe5a('0xbe')]][_0xfe5a('0x51')]]||_0xfe5a('0x1a'))===_0xfe5a('0x1a')){if(this[_0xfe5a('0x28')][_0x52a5cc[_0xfe5a('0x138')]]){if(this[_0xfe5a('0x24')][_0x52a5cc[_0xfe5a('0x13b')]]){this[_0xfe5a('0x28')][_0x52a5cc[_0xfe5a('0x138')]][_0xfe5a('0x13b')]=_0x52a5cc[_0xfe5a('0x13b')];if(_[_0xfe5a('0xb6')](this[_0xfe5a('0x2d')][this[_0xfe5a('0x28')][_0x52a5cc[_0xfe5a('0x138')]]['queue']])){this[_0xfe5a('0x2d')][this['actions'][_0x52a5cc[_0xfe5a('0x138')]]['queue']]=[];}this[_0xfe5a('0x2d')][this[_0xfe5a('0x28')][_0x52a5cc[_0xfe5a('0x138')]][_0xfe5a('0xbe')]][_0xfe5a('0x13c')](_[_0xfe5a('0x95')](_[_0xfe5a('0xe3')](this['actions'][_0x52a5cc[_0xfe5a('0x138')]],['idHopper',_0xfe5a('0x13b')]),{'status':_0x52a5cc[_0xfe5a('0xb8')],'paused':_0x52a5cc[_0xfe5a('0x13a')]}));}}}};function unlockQueueStatus(_0x1c868a,_0xe005e){setTimeout(function(){if(_[_0xfe5a('0x8a')](_0x1c868a[_0xfe5a('0x13d')])){loggerBooked[_0xfe5a('0x9e')]('[unlockQueueStatus][undefined]',_0xe005e);}_0x1c868a[_0xfe5a('0x13d')]=!![];loggerBooked[_0xfe5a('0x84')]('[booked][unlockQueueStatus]',_0xe005e,JSON[_0xfe5a('0x7e')](_[_0xfe5a('0xe3')](_0x1c868a,['name',_0xfe5a('0x13d')])));},0x1f3);}Dialer[_0xfe5a('0x1c')][_0xfe5a('0x3f')]=function(_0x31780a){var _0x4e7818=this;var _0x447322=_0x4e7818['voiceQueues'][_0x4e7818['actions'][_0x31780a['actionid']][_0xfe5a('0xbe')]];if(strategy[this[_0xfe5a('0x22')][this[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0xbe')]][_0xfe5a('0x51')]]===_0xfe5a('0x1b')){if(this[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]]&&this['actions'][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0x13b')]){this['preview'][_0xfe5a('0x13e')](this[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0x13f')],this['actions'][_0x31780a['actionid']][_0xfe5a('0x13b')])['catch'](function(_0x421cd5){logger[_0xfe5a('0x9e')](_0xfe5a('0x140'),util[_0xfe5a('0x9f')](_0x421cd5,{'showHidden':![],'depth':null}));})[_0xfe5a('0x1f')](function(){_0x4e7818[_0xfe5a('0xbc')](_0x4e7818[_0xfe5a('0x22')][_0x4e7818[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0xbe')]]);_0x4e7818[_0xfe5a('0x24')][_0x4e7818[_0xfe5a('0x28')][_0x31780a['actionid']][_0xfe5a('0x13b')]][_0xfe5a('0x139')]=![];delete _0x4e7818[_0xfe5a('0x28')][_0x31780a['actionid']];unlockQueueStatus(_0x447322);});}else{this[_0xfe5a('0xbc')](this[_0xfe5a('0x22')][this['actions'][_0x31780a['actionid']]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this[_0xfe5a('0x28')][_0x31780a['actionid']][_0xfe5a('0xe4')],'ListId':this['actions'][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0x10b')],'VoiceQueueId':this[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0xe5')]||undefined,'CampaignId':this[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0xe6')]||undefined})[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x141')));delete this[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]];unlockQueueStatus(_0x447322);}}else if((strategy[this[_0xfe5a('0x22')][this[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0xbe')]][_0xfe5a('0x51')]]||_0xfe5a('0x1a'))==='rrmemory'){var _0x35eac4;if(this[_0xfe5a('0x28')][_0x31780a['actionid']]&&!_[_0xfe5a('0x82')](this[_0xfe5a('0x2d')][this[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0xbe')]])){if(this['queueBookedRR'][_0x4e7818[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0xbe')]]){this[_0xfe5a('0x2e')][_0x4e7818[_0xfe5a('0x28')][_0x31780a['actionid']]['queue']]=this['queueBookedRR'][this[_0xfe5a('0x28')][_0x31780a['actionid']][_0xfe5a('0xbe')]]?this[_0xfe5a('0x2e')][this[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]]['queue']]:this['queueBooked'][this[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0xbe')]]?this[_0xfe5a('0x2d')][this[_0xfe5a('0x28')][_0x31780a['actionid']][_0xfe5a('0xbe')]][_0xfe5a('0x142')]||0x0:0x0;}this[_0xfe5a('0x2d')][this[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0xbe')]][_0xfe5a('0x142')]=this[_0xfe5a('0x2e')][this[_0xfe5a('0x28')][_0x31780a[_0xfe5a('0x138')]][_0xfe5a('0xbe')]];for(var _0x200f79=0x0;_0x200f79=0x0;})['catch'](myreject(_0x56ce16)));}}else{_0x255008[_0xfe5a('0x13c')](ami[_0xfe5a('0xb7')]({'action':_0xfe5a('0x159'),'command':util[_0xfe5a('0x7f')]('iftime\x20%s,%s',_0x5775ad,!_['isUndefined'](config['timezones'][_0x3af5da])?_0x3af5da:'')})[_0xfe5a('0xc6')](function(_0x17fd1a){return _0x17fd1a[_0xfe5a('0x15c')][_0xfe5a('0x15b')]('true')>=0x0;})[_0xfe5a('0xba')](myreject(_0x56ce16)));}BPromise[_0xfe5a('0x15d')](_0x255008)['then'](function(_0x57dcad){var _0x4b205b=_[_0xfe5a('0x15e')](_0x57dcad);if(_0x4b205b){return _0x4320e9(_0x4b205b);}else{_0x340954[_0xfe5a('0x40')]=_0x13bb59?_0xfe5a('0x15f'):_0xfe5a('0x160');return _0x56ce16(msgResponse(_0xfe5a('0x161'),_0xfe5a('0x154'),_0xfe5a('0x162')+_0x13bb59+'\x20'+_0x3faf56+_0xfe5a('0x163')+util[_0xfe5a('0x9f')](_0x5775ad,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x3af5da));}})[_0xfe5a('0xba')](function(_0x88a681){return _0x56ce16(msgResponse('ifTime',_0xfe5a('0x154'),JSON['stringify'](_0x88a681)));});});};Dialer[_0xfe5a('0x1c')]['checkDialMethod']=function(_0x5ca81a){var _0x1b89b0=this;return function(){switch(_0x5ca81a['dialMethod']){case _0xfe5a('0x164'):freeVariablesPredictive(_0x5ca81a);_0x1b89b0[_0xfe5a('0x165')](_0x5ca81a,0x1);break;case _0xfe5a('0x166'):freeVariablesPredictive(_0x5ca81a);_0x1b89b0[_0xfe5a('0x165')](_0x5ca81a,_0x5ca81a['dialPowerLevel']);break;case _0xfe5a('0x167'):_0x1b89b0['predictive'](_0x5ca81a);break;case _0xfe5a('0x7'):freeVariablesPredictive(_0x5ca81a);_0x1b89b0[_0xfe5a('0x165')](_0x5ca81a,0x1);break;default:freeVariablesPredictive(_0x5ca81a);logger[_0xfe5a('0x9e')](_0xfe5a('0x168'),_0x5ca81a[_0xfe5a('0x42')],_0xfe5a('0x169'));}};};Dialer[_0xfe5a('0x1c')]['launchHandleIvr']=function(_0xcb4ce1){var _0x14c533=this;return function(){_0x14c533[_0xfe5a('0x16a')](_0xcb4ce1);};};Dialer['prototype']['syncQueueSummary']=function(_0x516f7f){var _0xfef17b=this;if(isNotPreview(_0x516f7f[_0xfe5a('0x16b')])){if(isVoiceQueueOutbound(_0x516f7f[_0xfe5a('0x5a')])&&isActive(_0x516f7f['dialActive'])){_0x516f7f[_0xfe5a('0xa9')]=!![];BPromise['resolve']()[_0xfe5a('0xc6')](checkIsLoggedIn(_0x516f7f,_0x516f7f['loggedIn']))[_0xfe5a('0xc6')](checkIsActive(_0x516f7f,_0x516f7f['dialActive']))['then'](checkInterval(_0x516f7f))['then'](_0xfef17b[_0xfe5a('0x14d')](_0x516f7f))['then'](_0xfef17b[_0xfe5a('0x151')](_0x516f7f['dialGlobalInterval'],_0x516f7f[_0xfe5a('0x16c')],_0x516f7f[_0xfe5a('0x42')],_0x516f7f))['then'](_0xfef17b[_0xfe5a('0x153')](_0x516f7f[_0xfe5a('0x46')],_0x516f7f[_0xfe5a('0x16c')],_0x516f7f['name'],_0x516f7f))[_0xfe5a('0xc6')](_0xfef17b[_0xfe5a('0x16d')](_0x516f7f))[_0xfe5a('0xba')](loggerCatchQueueSummary(_0xfe5a('0x16e'),_0x516f7f));}else{notSendMessagesQueue(_0x516f7f);}}else{freeVariablesPredictive(_0x516f7f);}};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x14c')]=function(){var _0x2d61ba=this;var _0x326629;for(var _0x52dade in this[_0xfe5a('0x23')]){if(typeof this[_0xfe5a('0x23')][_0x52dade]!==_0xfe5a('0xb5')){_0x326629=this[_0xfe5a('0x23')][_0x52dade];if(isCampaignIvr(_0x326629[_0xfe5a('0x5a')])&&isActive(_0x326629[_0xfe5a('0x7c')])){_0x326629['sendMessageOneNotActive']=!![];BPromise[_0xfe5a('0xc1')]()['then'](checkIsActive(_0x326629,_0x326629[_0xfe5a('0x7c')]))[_0xfe5a('0xc6')](checkInterval(_0x326629))[_0xfe5a('0xc6')](_0x2d61ba['checkIsTrunkReachable'](_0x326629))[_0xfe5a('0xc6')](_0x2d61ba[_0xfe5a('0x151')](_0x326629[_0xfe5a('0x16f')],_0x326629[_0xfe5a('0x16c')],_0x326629[_0xfe5a('0x42')],_0x326629))['then'](_0x2d61ba[_0xfe5a('0x153')](_0x326629['Interval'],_0x326629['dialTimezone'],_0x326629['name'],_0x326629))[_0xfe5a('0xc6')](_0x2d61ba[_0xfe5a('0x170')](_0x326629))['catch'](loggerCatchQueueSummary(_0xfe5a('0x171'),_0x326629));}else{notSendMessagesCampaign(_0x326629);}}}};function getCallerIdRandom(_0x46f6b8,_0xfcc68c){var _0x345155;var _0x5c391f;var _0x55cf8b;if(_0xfcc68c<=0x0){_0xfcc68c=0x1;}_0x345155=new RegExp(_0xfe5a('0x172')+_0xfcc68c+'}$');_0x5c391f=Math[_0xfe5a('0x173')](0xa,_0xfcc68c-0x1);_0x55cf8b=Math[_0xfe5a('0x173')](0xa,_0xfcc68c)-0x1;return util[_0xfe5a('0x7f')]('%s',_['replace'](_0x46f6b8,_0x345155,_[_0xfe5a('0x174')](_0x5c391f,_0x55cf8b)));}function extractCalleridName(_0x49adba){var _0x1c424f=_0x49adba[_0xfe5a('0x175')](/"(.*?)"/);return _0x1c424f?_0x1c424f[0x1]:_0x49adba;}function extractCalleridNumber(_0x1c5fae){var _0x1f2594=_0x1c5fae[_0xfe5a('0x175')](/<(.*?)>/);return _0x1f2594?_0x1f2594[0x1]:_0x1c5fae;}Dialer[_0xfe5a('0x1c')][_0xfe5a('0x176')]=function(_0x2b1a4e,_0xc1f8d6){var _0x1d157c=this;var _0x37da59=uuid['v4']();this[_0xfe5a('0x28')][_0x37da59]=new Action(_0x2b1a4e,_0xc1f8d6,_0x37da59);return new BPromise(function(_0x302de8,_0x217a7d){if(_[_0xfe5a('0x8a')](_0x2b1a4e)&&typeof _0x2b1a4e!==_0xfe5a('0x177')){return _0x217a7d(msgResponse('originate','Failure',_0xfe5a('0x178')));}if(_[_0xfe5a('0x8a')](_0xc1f8d6[_0xfe5a('0x179')])||_0xc1f8d6['phone']===null){return _0x217a7d(msgResponse(_0xfe5a('0x17a'),'Failure','contact\x20is\x20undefine'));}var _0xd13062={'XMD-CALLERID':_0x1d157c[_0xfe5a('0x28')][_0x37da59][_0xfe5a('0x17b')](),'XMD-AGI':_0x2b1a4e[_0xfe5a('0x119')]?util['format'](_0xfe5a('0x17c'),ipAgi,_0x2b1a4e[_0xfe5a('0x119')]):_0xfe5a('0x17d'),'XMD-AGIAFTER':_0x2b1a4e['dialQueueProject2']?util[_0xfe5a('0x7f')](_0xfe5a('0x17c'),ipAgi,_0x2b1a4e[_0xfe5a('0x11c')]):_0xfe5a('0x17d'),'XMD-QUEUE':_0x2b1a4e['type']===_0xfe5a('0x50')?util[_0xfe5a('0x7f')]('\x22%s,%s%s,,,%s\x22',_0x2b1a4e[_0xfe5a('0x42')],_0x2b1a4e['dialQueueOptions']||'',_0x2b1a4e[_0xfe5a('0x17e')]?'c':'',_0x2b1a4e[_0xfe5a('0x17f')]||0x3):_0xfe5a('0x17d'),'XMD-CONTACTID':_0xc1f8d6[_0xfe5a('0xe4')],'XMD-CDRTYPE':_0xfe5a('0x180'),'CALLERID(all)':_0x1d157c[_0xfe5a('0x28')][_0x37da59][_0xfe5a('0x17b')](),'XMD-AMD':_0x2b1a4e[_0xfe5a('0xf1')]?_0xfe5a('0x181'):_0xfe5a('0x17d'),'XMD-DESTINATION':_0xfe5a('0xf0')};if(_0x2b1a4e[_0xfe5a('0xf1')]){_0xd13062['XMD-AMDINITIALSILENCE']=_0x2b1a4e[_0xfe5a('0x182')]||0x9c4;_0xd13062[_0xfe5a('0x183')]=_0x2b1a4e[_0xfe5a('0x184')]||0x5dc;_0xd13062[_0xfe5a('0x185')]=_0x2b1a4e[_0xfe5a('0x186')]||0x320;_0xd13062['XMD-AMDTOTALANALYSISTIME']=_0x2b1a4e['dialAMDTotalAnalysisTime']||0x1388;_0xd13062[_0xfe5a('0x187')]=_0x2b1a4e['dialAMDMinWordLength']||0x64;_0xd13062[_0xfe5a('0x188')]=_0x2b1a4e[_0xfe5a('0x189')]||0x32;_0xd13062['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2b1a4e[_0xfe5a('0x18a')]||0x3;_0xd13062[_0xfe5a('0x18b')]=_0x2b1a4e[_0xfe5a('0x18c')]||0x100;_0xd13062['XMD-AMDMAXIMUMWORDLENGTH']=_0x2b1a4e['dialAMDMaximumWordLength']||0x1388;}if(_0x2b1a4e[_0xfe5a('0x5a')]==='outbound'){_0xd13062['XMD-VOICEQUEUEID']=_0xc1f8d6[_0xfe5a('0xe5')];}else{_0xd13062['XMD-CAMPAIGNID']=_0xc1f8d6[_0xfe5a('0xe6')];}for(var _0x1fcaf4 in _0xc1f8d6[_0xfe5a('0x18d')]){if(typeof _0xc1f8d6[_0xfe5a('0x18d')][_0x1fcaf4]!==_0xfe5a('0xb5')){if(isNotNull(_0xc1f8d6[_0xfe5a('0x18d')][_0x1fcaf4])&&_0x1fcaf4!=='id'&&_0x1fcaf4!==_0xfe5a('0x18e')&&_0x1fcaf4!==_0xfe5a('0x18f')&&_0x1fcaf4!==_0xfe5a('0x190')){_0xd13062[util['format'](_0xfe5a('0x191'),'XMD-',_['toUpper'](_0x1fcaf4))]=_0xc1f8d6[_0xfe5a('0x18d')][_0x1fcaf4];}}}var _0x3cf61e=_0x1d157c['isTrunkReachable'](_0x2b1a4e[_0xfe5a('0x7b')])?getCallerId(_0x2b1a4e['Trunk'][_0xfe5a('0x7d')],_0x2b1a4e[_0xfe5a('0x60')],_0x2b1a4e[_0xfe5a('0x192')]>0x0?getCallerIdRandom(_0x2b1a4e[_0xfe5a('0x61')],_0x2b1a4e[_0xfe5a('0x192')]):_0x2b1a4e['dialOriginateCallerIdNumber']):getCallerId(_[_0xfe5a('0xb6')](_0x2b1a4e[_0xfe5a('0x14e')])?_0x2b1a4e[_0xfe5a('0x7b')]['callerid']:_0x2b1a4e['TrunkBackup'][_0xfe5a('0x7d')],_0x2b1a4e['dialOriginateCallerIdName'],_0x2b1a4e[_0xfe5a('0x192')]>0x0?getCallerIdRandom(_0x2b1a4e['dialOriginateCallerIdNumber'],_0x2b1a4e[_0xfe5a('0x192')]):_0x2b1a4e['dialOriginateCallerIdNumber']);if(_0x3cf61e){_0xd13062['XMD-ORIGINATECALLERIDNAME']=_0x1d157c[_0xfe5a('0x28')][_0x37da59][_0xfe5a('0x193')]=extractCalleridName(_0x3cf61e);_0xd13062['XMD-ORIGINATECALLERIDNUM']=_0xc1f8d6['phone'];}return ami[_0xfe5a('0xb7')]({'actionid':_0x37da59,'action':'originate','channel':_0x1d157c[_0xfe5a('0xe9')](_0x2b1a4e['Trunk'])?util['format'](_0xfe5a('0x194'),_0x2b1a4e['Trunk'][_0xfe5a('0x42')],isNotNull(_0x2b1a4e['dialPrefix'])?_0x2b1a4e[_0xfe5a('0x195')][_0xfe5a('0x196')]()||'':'',_0x2b1a4e[_0xfe5a('0x197')]>0x0?_0xc1f8d6[_0xfe5a('0x179')][_0xfe5a('0x198')](_0x2b1a4e['dialCutDigit']):_0xc1f8d6['phone']):util['format']('SIP/%s/%s%s',_[_0xfe5a('0xb6')](_0x2b1a4e[_0xfe5a('0x14e')])?_0x2b1a4e['Trunk'][_0xfe5a('0x42')]:_0x2b1a4e['TrunkBackup']['name'],isNotNull(_0x2b1a4e[_0xfe5a('0x195')])?_0x2b1a4e['dialPrefix'][_0xfe5a('0x196')]()||'':'',_0x2b1a4e[_0xfe5a('0x197')]>0x0?_0xc1f8d6[_0xfe5a('0x179')][_0xfe5a('0x198')](_0x2b1a4e[_0xfe5a('0x197')]):_0xc1f8d6['phone']),'callerid':_0x3cf61e,'Exten':_0xfe5a('0xf0'),'Context':_0xfe5a('0x199'),'Priority':'1','variable':_0xd13062,'timeout':(_0x2b1a4e['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x37da59})[_0xfe5a('0xc6')](function(_0x59aab8){return _0x302de8(_0x59aab8);})[_0xfe5a('0xba')](function(_0x31fb24){_0x2b1a4e['outboundOriginateFailureCallsDay']+=0x1;var _0x1cedc7=new History(_0x1d157c[_0xfe5a('0x28')][_0x37da59]);logger[_0xfe5a('0x9e')](util['format'](_0xfe5a('0x19a'),JSON['stringify'](_0x31fb24)));_0x1cedc7['state']=0xe;_0x1cedc7[_0xfe5a('0xb0')]=_0xfe5a('0x19b');_0x1cedc7[_0xfe5a('0xb1')]=moment()[_0xfe5a('0x7f')](_0xfe5a('0x10a'));_0x1cedc7[_0xfe5a('0x12d')]=_0x1cedc7[_0xfe5a('0xb1')];_0x1d157c['createHistory'](_0x1cedc7)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x19c')));_0x1d157c[_0xfe5a('0xd9')](_0x1cedc7)['catch'](loggerCatch(_0xfe5a('0x19c')))['finally'](function(){delete _0x1d157c[_0xfe5a('0x28')][_0x37da59];return _0x217a7d(msgResponse(_0xfe5a('0x17a'),_0xfe5a('0x4b'),_0xfe5a('0x19d')));});});});};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x33')]=function(_0x33e42e){var _0x29a293=this[_0xfe5a('0x28')][_0x33e42e['actionid']];if(_0x29a293){delete this[_0xfe5a('0x28')][_0x33e42e[_0xfe5a('0x138')]];_0x29a293['responsetime']=moment()[_0xfe5a('0x7f')](_0xfe5a('0x10a'));var _0x530584=_0x29a293['type']===_0xfe5a('0x9a')?this[_0xfe5a('0x23')][_0x29a293['queue']]:this[_0xfe5a('0x22')][_0x29a293['getQueue']()];if(!this[_0xfe5a('0x19e')](_0x33e42e[_0xfe5a('0x19f')])){this[_0xfe5a('0xbc')](_0x530584);return this[_0xfe5a('0x1a0')](_0x29a293,_0x530584,_0x33e42e)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x1a1')));}this[_0xfe5a('0x2a')][_0x33e42e[_0xfe5a('0xed')]]=_0x29a293;}};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x1a2')]=function(_0x316d2d,_0x15b160,_0x1bb34b){var _0x1710e3=new History(_0x15b160);if(_0x1710e3['countbusyretry']+_0x1710e3[_0xfe5a('0xff')]+_0x1710e3['countnoanswerretry']+_0x1710e3[_0xfe5a('0x110')]+_0x1710e3[_0xfe5a('0x101')]+_0x1710e3[_0xfe5a('0x133')]+_0x1710e3['countmachineretry']+_0x1710e3['countagentrejectretry']>=_0x1bb34b['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x316d2d){case 0x3:if(_0x1710e3[_0xfe5a('0x100')]>=_0x1bb34b[_0xfe5a('0x1a3')]-0x1){return!![];}this[_0xfe5a('0xce')]({'active':![],'countnoanswerretry':_0x1710e3[_0xfe5a('0x100')]+=0x1,'scheduledat':moment()[_0xfe5a('0x108')](_0x1bb34b[_0xfe5a('0x1a4')],_0xfe5a('0x109'))[_0xfe5a('0x7f')](_0xfe5a('0x10a')),'ContactId':_0x1710e3[_0xfe5a('0xe4')],'ListId':_0x1710e3[_0xfe5a('0x10b')],'VoiceQueueId':_0x1710e3[_0xfe5a('0xe5')]||undefined,'CampaignId':_0x1710e3[_0xfe5a('0xe6')]||undefined})[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x1a5')));break;case 0x5:if(_0x1710e3[_0xfe5a('0x10f')]>=_0x1bb34b[_0xfe5a('0x1a6')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x1710e3[_0xfe5a('0x10f')]+=0x1,'scheduledat':moment()[_0xfe5a('0x108')](_0x1bb34b[_0xfe5a('0x1a7')],_0xfe5a('0x109'))['format'](_0xfe5a('0x10a')),'ContactId':_0x1710e3[_0xfe5a('0xe4')],'ListId':_0x1710e3['ListId'],'VoiceQueueId':_0x1710e3[_0xfe5a('0xe5')]||undefined,'CampaignId':_0x1710e3['CampaignId']||undefined})['catch'](loggerCatch(_0xfe5a('0x1a8')));break;case 0x8:if(_0x1710e3[_0xfe5a('0xff')]>=_0x1bb34b[_0xfe5a('0x1a9')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x1710e3['countcongestionretry']+=0x1,'scheduledat':moment()[_0xfe5a('0x108')](_0x1bb34b[_0xfe5a('0x1aa')],_0xfe5a('0x109'))['format'](_0xfe5a('0x10a')),'ContactId':_0x1710e3[_0xfe5a('0xe4')],'ListId':_0x1710e3[_0xfe5a('0x10b')],'VoiceQueueId':_0x1710e3[_0xfe5a('0xe5')]||undefined,'CampaignId':_0x1710e3[_0xfe5a('0xe6')]||undefined})[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x1ab')));break;case 0x0:if(_0x1710e3[_0xfe5a('0x110')]>=_0x1bb34b[_0xfe5a('0x1ac')]-0x1){return!![];}else{this[_0xfe5a('0xce')]({'active':![],'countnosuchnumberretry':_0x1710e3[_0xfe5a('0x110')]+=0x1,'scheduledat':moment()[_0xfe5a('0x108')](_0x1bb34b[_0xfe5a('0x1ad')],_0xfe5a('0x109'))['format'](_0xfe5a('0x10a')),'ContactId':_0x1710e3[_0xfe5a('0xe4')],'ListId':_0x1710e3[_0xfe5a('0x10b')],'VoiceQueueId':_0x1710e3[_0xfe5a('0xe5')]||undefined,'CampaignId':_0x1710e3[_0xfe5a('0xe6')]||undefined})[_0xfe5a('0xba')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x1710e3[_0xfe5a('0x101')]>=_0x1bb34b[_0xfe5a('0x12a')]-0x1){return!![];}this[_0xfe5a('0xce')]({'active':![],'countdropretry':_0x1710e3[_0xfe5a('0x101')]+=0x1,'scheduledat':moment()['add'](_0x1bb34b[_0xfe5a('0x126')],'minutes')[_0xfe5a('0x7f')](_0xfe5a('0x10a')),'ContactId':_0x1710e3['ContactId'],'ListId':_0x1710e3[_0xfe5a('0x10b')],'VoiceQueueId':_0x1710e3[_0xfe5a('0xe5')]||undefined,'CampaignId':_0x1710e3[_0xfe5a('0xe6')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x1710e3[_0xfe5a('0x133')]>=_0x1bb34b[_0xfe5a('0x134')]-0x1){return!![];}this[_0xfe5a('0xce')]({'active':![],'countabandonedretry':_0x1710e3['countabandonedretry']+=0x1,'scheduledat':moment()[_0xfe5a('0x108')](_0x1bb34b[_0xfe5a('0x135')],'minutes')[_0xfe5a('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1710e3[_0xfe5a('0xe4')],'ListId':_0x1710e3[_0xfe5a('0x10b')],'VoiceQueueId':_0x1710e3[_0xfe5a('0xe5')]||undefined,'CampaignId':_0x1710e3[_0xfe5a('0xe6')]||undefined})[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x136')));break;case 0x13:if(_0x1710e3[_0xfe5a('0x102')]>=_0x1bb34b[_0xfe5a('0x105')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countmachineretry':_0x1710e3[_0xfe5a('0x102')]+=0x1,'scheduledat':moment()[_0xfe5a('0x108')](_0x1bb34b[_0xfe5a('0x1ae')],_0xfe5a('0x109'))['format'](_0xfe5a('0x10a')),'ContactId':_0x1710e3[_0xfe5a('0xe4')],'ListId':_0x1710e3[_0xfe5a('0x10b')],'VoiceQueueId':_0x1710e3['VoiceQueueId']||undefined,'CampaignId':_0x1710e3[_0xfe5a('0xe6')]||undefined})[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x113')));break;case 0x14:if(_0x1710e3['countagentrejectretry']>=_0x1bb34b['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x1710e3[_0xfe5a('0x111')]+=0x1,'scheduledat':moment()['add'](_0x1bb34b['dialAgentRejectRetryFrequency'],_0xfe5a('0x109'))[_0xfe5a('0x7f')](_0xfe5a('0x10a')),'ContactId':_0x1710e3[_0xfe5a('0xe4')],'ListId':_0x1710e3[_0xfe5a('0x10b')],'VoiceQueueId':_0x1710e3[_0xfe5a('0xe5')]||undefined,'CampaignId':_0x1710e3[_0xfe5a('0xe6')]||undefined})[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x1af')));break;default:return!![];}};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x1a0')]=function(_0x379139,_0x7cf29e,_0x1d08ec){var _0x1fb4ea=this;var _0xcefcaf=new History(_0x379139);var _0x20fe6f=![];var _0x56fbfb;var _0x3440d8;return new BPromise(function(_0x58497e,_0x562145){if(_['isUndefined'](_0x7cf29e)&&typeof _0x7cf29e!==_0xfe5a('0x177')){return _0x562145(msgResponse(_0xfe5a('0x1b0'),_0xfe5a('0x154'),'entity\x20is\x20undefine'));}if(_[_0xfe5a('0x8a')](_0x1d08ec)&&typeof _0x1d08ec!=='object'){return _0x562145(msgResponse(_0xfe5a('0x1b0'),'Failure',_0xfe5a('0x1b1')));}_0x1fb4ea['verifyAdditionalPhones'](_0xcefcaf,_0x1d08ec['reason'],_0x7cf29e)[_0xfe5a('0xc6')](function(_0x2a20bb){if(_0x2a20bb[_0xfe5a('0x129')]==0x1)_0x20fe6f=!![];switch(_0x1d08ec[_0xfe5a('0x11a')]){case'0':_0x7cf29e[_0xfe5a('0x67')]+=0x1;_0xcefcaf[_0xfe5a('0xaf')]=0x0;_0xcefcaf[_0xfe5a('0xb0')]=_0xfe5a('0x1b2');_0xcefcaf[_0xfe5a('0x110')]+=0x1;_0xcefcaf['countglobal']+=0x1;ami[_0xfe5a('0x4f')](_0xfe5a('0x1b3'),ut[_0xfe5a('0xfd')](_0x379139,_0xfe5a('0x1b4')));_0x56fbfb=_0x7cf29e[_0xfe5a('0x1ad')];_0x3440d8=_0x7cf29e[_0xfe5a('0x127')];_0x1fb4ea[_0xfe5a('0xdb')](_0xcefcaf)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0xfe')));if(_0x1fb4ea[_0xfe5a('0x1a2')](0x0,_0x379139,_0x7cf29e)&&!_0x20fe6f){if(_0xcefcaf['countnosuchnumberretry']>=_0x7cf29e['dialNoSuchNumberMaxRetry']){_0x1fb4ea[_0xfe5a('0x106')](_0xcefcaf,_0x58497e,_0x562145,'reason\x200\x20no\x20such\x20number....');}else{_0x1fb4ea['stateGlobal'](_0xcefcaf,_0x58497e,_0x562145,_0xfe5a('0x1b5'));}}break;case'3':_0x7cf29e[_0xfe5a('0x66')]+=0x1;_0xcefcaf['state']=0x3;_0xcefcaf['statedesc']='NoAnswer';_0xcefcaf[_0xfe5a('0x100')]+=0x1;_0xcefcaf[_0xfe5a('0xfc')]+=0x1;ami[_0xfe5a('0x4f')](_0xfe5a('0x1b6'),ut[_0xfe5a('0xfd')](_0x379139,_0xfe5a('0x1b7')));_0x56fbfb=_0x7cf29e['dialNoAnswerRetryFrequency'];_0x3440d8=_0x7cf29e[_0xfe5a('0x127')];_0x1fb4ea[_0xfe5a('0xdb')](_0xcefcaf)[_0xfe5a('0xba')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x1fb4ea['checkRetriveMax'](0x3,_0x379139,_0x7cf29e)&&!_0x20fe6f){if(_0xcefcaf[_0xfe5a('0x100')]>=_0x7cf29e[_0xfe5a('0x1a3')]){_0x1fb4ea['createStateFinal'](_0xcefcaf,_0x58497e,_0x562145,_0xfe5a('0x1b8'));}else{_0x1fb4ea[_0xfe5a('0x103')](_0xcefcaf,_0x58497e,_0x562145,_0xfe5a('0x1b8'));}}break;case'5':_0x7cf29e[_0xfe5a('0x63')]+=0x1;_0xcefcaf[_0xfe5a('0xaf')]=0x5;_0xcefcaf[_0xfe5a('0xb0')]=_0xfe5a('0x1b9');_0xcefcaf['countbusyretry']+=0x1;_0xcefcaf[_0xfe5a('0xfc')]+=0x1;ami[_0xfe5a('0x4f')](_0xfe5a('0x1ba'),ut[_0xfe5a('0xfd')](_0x379139,_0xfe5a('0x1bb')));_0x56fbfb=_0x7cf29e[_0xfe5a('0x1a7')];_0x3440d8=_0x7cf29e['callAdditionalPhoneAfterMin'];_0x1fb4ea['createHistory'](_0xcefcaf)['catch'](loggerCatch(_0xfe5a('0x1bc')));if(_0x1fb4ea['checkRetriveMax'](0x5,_0x379139,_0x7cf29e)&&!_0x20fe6f){if(_0xcefcaf[_0xfe5a('0x10f')]>=_0x7cf29e[_0xfe5a('0x1a6')]){_0x1fb4ea[_0xfe5a('0x106')](_0xcefcaf,_0x58497e,_0x562145,'reason\x205\x20busy');}else{_0x1fb4ea[_0xfe5a('0x103')](_0xcefcaf,_0x58497e,_0x562145,_0xfe5a('0x1bd'));}}break;case'8':_0x7cf29e[_0xfe5a('0x64')]+=0x1;_0xcefcaf[_0xfe5a('0xaf')]=0x8;_0xcefcaf[_0xfe5a('0xb0')]='Congestion';_0xcefcaf['countcongestionretry']+=0x1;_0xcefcaf['countglobal']+=0x1;_0x56fbfb=_0x7cf29e[_0xfe5a('0x1aa')];_0x3440d8=_0x7cf29e['callAdditionalPhoneAfterMin'];ami[_0xfe5a('0x4f')](_0xfe5a('0x1be'),ut[_0xfe5a('0xfd')](_0x379139,_0xfe5a('0x1bf')));_0x1fb4ea[_0xfe5a('0xdb')](_0xcefcaf)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x1c0')));if(_0x1fb4ea[_0xfe5a('0x1a2')](0x8,_0x379139,_0x7cf29e)&&!_0x20fe6f){if(_0xcefcaf[_0xfe5a('0xff')]>=_0x7cf29e[_0xfe5a('0x1a9')]){_0x1fb4ea[_0xfe5a('0x106')](_0xcefcaf,_0x58497e,_0x562145,_0xfe5a('0x1c1'));}else{_0x1fb4ea['stateGlobal'](_0xcefcaf,_0x58497e,_0x562145,_0xfe5a('0x1c1'));}}break;case'11':_0x7cf29e[_0xfe5a('0x1c2')]+=0x1;_0xcefcaf[_0xfe5a('0xaf')]=0xb;_0xcefcaf[_0xfe5a('0xb0')]=_0xfe5a('0x131');_0xcefcaf[_0xfe5a('0x133')]+=0x1;_0xcefcaf['countglobal']+=0x1;_0x56fbfb=_0x7cf29e[_0xfe5a('0x135')];_0x3440d8=_0x7cf29e[_0xfe5a('0x127')];_0x1fb4ea[_0xfe5a('0xdb')](_0xcefcaf)[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x1c3')));if(_0x1fb4ea['checkRetriveMax'](0xb,_0x379139,_0x7cf29e)&&!_0x20fe6f){if(_0xcefcaf['countabandonedretry']>=_0x7cf29e[_0xfe5a('0x134')]){_0x1fb4ea[_0xfe5a('0x106')](_0xcefcaf,_0x58497e,_0x562145,_0xfe5a('0x1c4'));}else{_0x1fb4ea[_0xfe5a('0x103')](_0xcefcaf,_0x58497e,_0x562145,'reason\x2011\x20abandoned');}}break;case'20':_0x7cf29e[_0xfe5a('0x6a')]+=0x1;_0xcefcaf[_0xfe5a('0xaf')]=0x14;_0xcefcaf[_0xfe5a('0xb0')]='AgentReject';_0xcefcaf[_0xfe5a('0x111')]+=0x1;_0xcefcaf['countglobal']+=0x1;_0x56fbfb=_0x7cf29e['dialAgentRejectRetryFrequency'];_0x3440d8=_0x7cf29e[_0xfe5a('0x127')];ami[_0xfe5a('0x4f')]('custom:agentreject',ut['buildObj'](_0x379139,'agentreject'));_0x1fb4ea[_0xfe5a('0xdb')](_0xcefcaf)['catch'](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1fb4ea[_0xfe5a('0x1a2')](0x14,_0x379139,_0x7cf29e)&&!_0x20fe6f){if(_0xcefcaf['countagentrejectretry']>=_0x7cf29e[_0xfe5a('0x1c5')]){_0x1fb4ea['createStateFinal'](_0xcefcaf,_0x58497e,_0x562145,_0xfe5a('0x1c6'));}else{_0x1fb4ea['stateGlobal'](_0xcefcaf,_0x58497e,_0x562145,_0xfe5a('0x1c6'));}}break;default:_0x7cf29e[_0xfe5a('0x6b')]+=0x1;_0xcefcaf['state']=0xc;_0xcefcaf['statedesc']=_0x1d08ec[_0xfe5a('0x11a')];_0x56fbfb=_0x7cf29e[_0xfe5a('0x1c7')];_0x3440d8=_0x7cf29e[_0xfe5a('0x127')];_0x1fb4ea['createHistory'](_0xcefcaf)['catch'](loggerCatch(_0xfe5a('0x1c8')));if(_0x1fb4ea[_0xfe5a('0x1a2')](_0x1d08ec[_0xfe5a('0x11a')],_0x379139,_0x7cf29e)&&!_0x20fe6f){if(_0xcefcaf['countbusyretry']+_0xcefcaf[_0xfe5a('0xff')]+_0xcefcaf[_0xfe5a('0x100')]+_0xcefcaf[_0xfe5a('0x110')]+_0xcefcaf[_0xfe5a('0x101')]+_0xcefcaf[_0xfe5a('0x133')]+_0xcefcaf[_0xfe5a('0x102')]+_0xcefcaf['countagentrejectretry']>=_0x7cf29e['dialGlobalMaxRetry']){_0x1fb4ea['stateGlobal'](_0xcefcaf,_0x58497e,_0x562145,_0x1d08ec[_0xfe5a('0x11a')]);}else{_0x1fb4ea[_0xfe5a('0x106')](_0xcefcaf,_0x58497e,_0x562145,_0x1d08ec['reason']);}}}})[_0xfe5a('0xc6')](function(_0x35658b){if(_0x20fe6f){_0x1fb4ea['swapAdditionalPhones'](_0xcefcaf,_0x56fbfb,_0x3440d8)[_0xfe5a('0xc6')](function(_0x450f19){return _0x58497e(0x1);});}});});};Dialer['prototype'][_0xfe5a('0x103')]=function(_0x143b14,_0x5c63b9,_0x4789af,_0x3a8772){var _0x22c6f0=new Final(_0x143b14);_0x22c6f0[_0xfe5a('0xaf')]=0xf;_0x22c6f0['statedesc']=_0xfe5a('0x1c9');this['createStateFinal'](_0x22c6f0,_0x5c63b9,_0x4789af,_0x3a8772);};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x106')]=function(_0x513c53,_0x3292ae,_0x48da5e,_0x55b4eb){this[_0xfe5a('0xd9')](_0x513c53)['then'](function(){return _0x3292ae(msgResponse(_0xfe5a('0x1b0'),_0xfe5a('0xe8'),_0x55b4eb));})[_0xfe5a('0xba')](function(){return _0x48da5e(msgResponse(_0xfe5a('0x1ca'),_0xfe5a('0x154'),_0xfe5a('0x1cb')));});};Dialer['prototype'][_0xfe5a('0x167')]=function(_0x14b2e2){var _0x48b092=_0x14b2e2[_0xfe5a('0x1cc')]/0x64;var _0x26939c=_0x14b2e2[_0xfe5a('0x123')]/(_0x14b2e2[_0xfe5a('0x123')]+_0x14b2e2[_0xfe5a('0xf4')]);var _0x5b7de5=Math[_0xfe5a('0x1cd')](_0x14b2e2[_0xfe5a('0x75')]*(_0x14b2e2[_0xfe5a('0x1ce')]/0x64));var _0x30333c=Math[_0xfe5a('0x1cd')](_0x14b2e2[_0xfe5a('0x75')]*(_0x14b2e2[_0xfe5a('0x1cf')]/0x64));var _0x3b9d02=_0x14b2e2['available']+_0x14b2e2[_0xfe5a('0xaa')];var _0x28adf5=Math['floor'](_0x14b2e2[_0xfe5a('0x78')]*_0x14b2e2['erlangAbandonmentRate']*_0x14b2e2[_0xfe5a('0x72')]*_0x14b2e2[_0xfe5a('0x73')]);if(_[_0xfe5a('0x8a')](_0x14b2e2[_0xfe5a('0x2c')])){if(!_[_0xfe5a('0x8a')](_0x14b2e2[_0xfe5a('0x96')])){_0x14b2e2[_0xfe5a('0x96')]=undefined;loggerPredictive[_0xfe5a('0x9e')](_0xfe5a('0x1d0'),_0xfe5a('0x1d1'));}if(!_[_0xfe5a('0x8a')](_0x14b2e2[_0xfe5a('0x98')])){loggerPredictive[_0xfe5a('0x9e')]('[startMethodPredictive][StartProgressive]',_0xfe5a('0x1d2'));clearInterval(_0x14b2e2[_0xfe5a('0x98')]);_0x14b2e2['handlePredictive']=undefined;}_0x14b2e2['startProgressive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xfe5a('0x84')](_0x14b2e2['name'],_0xfe5a('0x1d3'),_0x14b2e2[_0xfe5a('0x2c')]);this[_0xfe5a('0x165')](_0x14b2e2,0x1);}else if(ifInterval(_0x14b2e2['dialPredictiveInterval'],_0x14b2e2[_0xfe5a('0x2c')])){this[_0xfe5a('0x165')](_0x14b2e2,0x1);loggerPredictiveCalls[_0xfe5a('0x84')]('[startMethodPredictive][StartProgressive][Loop]',_0x14b2e2[_0xfe5a('0x2c')],_0x14b2e2['name']);_0x14b2e2[_0xfe5a('0x78')]=0x0;_0x14b2e2[_0xfe5a('0x71')]=0x0;}else if(_0x48b092<_0x26939c&&_0x14b2e2[_0xfe5a('0x1d4')]==='dropRate'){freeVariablesPredictive(_0x14b2e2);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x1d5'),_0xfe5a('0x1d6'),_0x26939c,_0xfe5a('0x2c'),_0x14b2e2[_0xfe5a('0x42')]);}else if(_0x28adf5<_0x14b2e2[_0xfe5a('0x71')]&&_0x14b2e2['dialPredictiveOptimization']===_0xfe5a('0x1d7')){freeVariablesPredictive(_0x14b2e2);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x1d8'),_0xfe5a('0x1d9'),_0x28adf5,_0xfe5a('0x1da'),_0x14b2e2[_0xfe5a('0x71')],'startProgressive',_0x14b2e2[_0xfe5a('0x42')]);}else if(!ifInterval(_0x14b2e2['dialPredictiveInterval'],_0x14b2e2[_0xfe5a('0x2c')])&&_[_0xfe5a('0x8a')](_0x14b2e2[_0xfe5a('0x96')])&&!_[_0xfe5a('0x8a')](_0x14b2e2[_0xfe5a('0x2c')])){_0x14b2e2['startPredictive']=moment()[_0xfe5a('0x7f')](_0xfe5a('0x10a'));loggerPredictive['info'](_0x14b2e2[_0xfe5a('0x42')],_0xfe5a('0x1db'),_0x14b2e2[_0xfe5a('0x96')]);this[_0xfe5a('0xcc')](_0x14b2e2[_0xfe5a('0x1dc')])[_0xfe5a('0xc6')](this['getDataPredictive'](_0x14b2e2))[_0xfe5a('0xc6')](mergeDataErlangB(_0x14b2e2))[_0xfe5a('0xc6')](this[_0xfe5a('0x1dd')](_0x14b2e2))[_0xfe5a('0xba')](loggerCatchPredictive(_0xfe5a('0x1de'),_0x14b2e2));}else if(!ifInterval(_0x14b2e2[_0xfe5a('0x1dc')],_0x14b2e2['startPredictive'])){_0x14b2e2['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x14b2e2[_0xfe5a('0x96')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xfe5a('0x84')](_0x14b2e2['name'],'recalculate\x20predictive\x20at',_0x14b2e2[_0xfe5a('0x96')]);clearInterval(_0x14b2e2[_0xfe5a('0x98')]);_0x14b2e2[_0xfe5a('0x98')]=undefined;this['averageHandleTime'](_0x14b2e2[_0xfe5a('0x1dc')])[_0xfe5a('0xc6')](this[_0xfe5a('0x1df')](_0x14b2e2))[_0xfe5a('0xc6')](mergeDataErlangB(_0x14b2e2))[_0xfe5a('0xc6')](this[_0xfe5a('0x1dd')](_0x14b2e2))[_0xfe5a('0xba')](loggerCatchPredictive(_0xfe5a('0x1e0'),_0x14b2e2));}else if(_0x14b2e2[_0xfe5a('0x75')]&&_0x3b9d02<_0x14b2e2[_0xfe5a('0x75')]-_0x30333c){freeVariablesPredictive(_0x14b2e2);loggerPredictive[_0xfe5a('0x84')](_0x14b2e2[_0xfe5a('0x42')],_0xfe5a('0x1e1'),_0x3b9d02,_0xfe5a('0x1e2'),_0x14b2e2[_0xfe5a('0x75')],'-',_0x30333c,'=',_0x14b2e2['predictiveIntervalAvailable']-_0x30333c,')');}else if(_0x14b2e2[_0xfe5a('0x75')]&&_0x3b9d02>_0x14b2e2[_0xfe5a('0x75')]+_0x5b7de5){freeVariablesPredictive(_0x14b2e2);loggerPredictive[_0xfe5a('0x84')](_0x14b2e2[_0xfe5a('0x42')],_0xfe5a('0x1e1'),_0x3b9d02,')\x20are\x20more\x20than\x20threshold\x20(',_0x14b2e2[_0xfe5a('0x75')],'+',_0x5b7de5,'=',_0x14b2e2[_0xfe5a('0x75')]+_0x5b7de5,')');}};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x1df')]=function(_0x401a9a){var _0x3bb382=this;return function(_0x2bb7fa){return new BPromise(function(_0x5e0d1d,_0x1b4777){_['merge'](_0x401a9a,_0x2bb7fa[0x0]);if(checkGetDataPredictive(_0x2bb7fa[0x0])){var _0xd637dd=_0x401a9a[_0xfe5a('0x75')]=_0x401a9a[_0xfe5a('0xaa')]+_0x401a9a[_0xfe5a('0x53')];var _0x105d46=_0x401a9a[_0xfe5a('0x1dc')]*0x3c;var _0x3f52d8=_0x2bb7fa[0x0][_0xfe5a('0x6d')]+_0x2bb7fa[0x0][_0xfe5a('0x6c')];var _0x2b96f1=(_0x2bb7fa[0x0][_0xfe5a('0x1e3')]+_0x2bb7fa[0x0][_0xfe5a('0x6f')]+_0x2bb7fa[0x0][_0xfe5a('0x6e')])/_0x2bb7fa[0x0]['predictiveIntervalTotalCalls'];_0x401a9a[_0xfe5a('0x72')]=_0x2b96f1>0x0?_0x2b96f1:0x1;switch(_0x401a9a['dialPredictiveOptimization']){case _0xfe5a('0x1d7'):var _0x4de701=_0x401a9a[_0xfe5a('0x1cc')]/0x64;return _0x3bb382['abandonmentRate'](_0xd637dd,_0x105d46,_0x3f52d8,_0x2b96f1,_0x4de701)[_0xfe5a('0xc6')](function(_0x12062b){return _0x5e0d1d(_0x12062b);});case _0xfe5a('0x1e4'):var _0x29b632=_0x401a9a['dialPredictiveOptimizationPercentage']/0x64;return _0x3bb382[_0xfe5a('0x1e5')](_0xd637dd,_0x105d46,_0x3f52d8,_0x2b96f1,_0x29b632)[_0xfe5a('0xc6')](function(_0x46068f){return _0x5e0d1d(_0x46068f);});default:return _0x1b4777(msgResponse('[getDataPredictive]',_0xfe5a('0x154'),_0xfe5a('0x1e6')));}}else{return _0x1b4777(msgResponse(_0xfe5a('0x1e7'),_0xfe5a('0x154'),_0xfe5a('0x1e8')));}});};};Dialer['prototype'][_0xfe5a('0x1e9')]=function(_0x27bf49){var _0x1cd945=this;return function(_0x1ce12e){return new BPromise(function(_0x123e93,_0x5539b9){_[_0xfe5a('0x95')](_0x27bf49,_0x1ce12e[0x0]);if(checkGetDataPredictive(_0x1ce12e[0x0])){loggerPredictive[_0xfe5a('0x84')](JSON[_0xfe5a('0x7e')](_0x1ce12e[0x0]));if(_0x27bf49[_0xfe5a('0x1d4')]===_0xfe5a('0x1d7')){return _0x1cd945['getVoiceQueueRtPauses'](_0x27bf49['id'])[_0xfe5a('0xc6')](function(_0x453968){var _0xbf7efc=_0x27bf49['loggedIn']-_0x453968[0x0][_0xfe5a('0x1ea')];var _0x150c41=_0x27bf49['dialPredictiveInterval']*0x3c;var _0xf91c81=_0x1ce12e[0x0][_0xfe5a('0x6d')]+_0x1ce12e[0x0][_0xfe5a('0x6c')];var _0xf70e67=(_0x1ce12e[0x0][_0xfe5a('0x1e3')]+_0x1ce12e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1ce12e[0x0][_0xfe5a('0x6e')])/_0x1ce12e[0x0][_0xfe5a('0x76')];var _0x4fefdd=_0x27bf49['dialPredictiveOptimizationPercentage']/0x64;_0x27bf49['predictiveIntervalPauses']=_0x453968[0x0][_0xfe5a('0x1ea')]||0x0;_0x27bf49['predictiveIntervalHitRate']=_0xf70e67>0x0?_0xf70e67:0x1;return _0x1cd945[_0xfe5a('0x1eb')](_0xbf7efc,_0x150c41,_0xf91c81,_0xf70e67,_0x4fefdd);})[_0xfe5a('0xc6')](function(_0x25793b){return _0x123e93(_0x25793b);})[_0xfe5a('0xba')](function(_0x255688){return _0x5539b9(msgResponse(_0xfe5a('0x1ec'),_0xfe5a('0x154'),JSON[_0xfe5a('0x7e')](_0x255688)));});}if(_0x27bf49[_0xfe5a('0x1d4')]===_0xfe5a('0x1e4')){return _0x1cd945[_0xfe5a('0xd7')](_0x27bf49['id'])[_0xfe5a('0xc6')](function(_0x23aed3){var _0x4c3c34=_0x27bf49['loggedIn']-_0x23aed3[0x0][_0xfe5a('0x1ea')];var _0x5b3ecb=_0x27bf49['dialPredictiveInterval']*0x3c;var _0x5626b1=_0x1ce12e[0x0][_0xfe5a('0x6d')]+_0x1ce12e[0x0][_0xfe5a('0x6c')];var _0x9d544c=(_0x1ce12e[0x0]['predictiveIntervalAnsweredCalls']+_0x1ce12e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1ce12e[0x0][_0xfe5a('0x6e')])/_0x1ce12e[0x0][_0xfe5a('0x76')];var _0x5d6be3=_0x27bf49[_0xfe5a('0x1cc')]/0x64;_0x27bf49[_0xfe5a('0x74')]=_0x23aed3[0x0][_0xfe5a('0x1ea')]||0x0;_0x27bf49[_0xfe5a('0x72')]=_0x9d544c>0x0?_0x9d544c:0x1;return _0x1cd945['busyFactor'](_0x4c3c34,_0x5b3ecb,_0x5626b1,_0x9d544c,_0x5d6be3);})['then'](function(_0x188a98){return _0x123e93(_0x188a98);})[_0xfe5a('0xba')](function(_0x92402d){return _0x5539b9(msgResponse(_0xfe5a('0x1ec'),_0xfe5a('0x154'),JSON[_0xfe5a('0x7e')](_0x92402d)));});}}else{return _0x5539b9(msgResponse('[getDataPredictive]',_0xfe5a('0x154'),'check\x20failure'));}});};};Dialer['prototype'][_0xfe5a('0x1dd')]=function(_0x214e5d){var _0x18da22=this;return function(){var _0x22f5be=0x0;var _0x58f41a=Math[_0xfe5a('0x1ed')](_0x214e5d['erlangCallToSecond']*0x3e8);if(_0x58f41a>0x0){_0x58f41a=_0x58f41a<0x64?0x64:_0x58f41a;loggerPredictive[_0xfe5a('0x84')](_0x214e5d['name'],_0xfe5a('0x1ee'),_0x58f41a,_0xfe5a('0x4c'));_0x214e5d[_0xfe5a('0x98')]=setInterval(function(){_0x18da22[_0xfe5a('0x98')](_0x214e5d);loggerPredictiveCalls[_0xfe5a('0x84')]('[handlePredictive]',_0x22f5be+=0x1);},_0x58f41a);}else{loggerPredictive[_0xfe5a('0x84')](_0x214e5d[_0xfe5a('0x42')],_0xfe5a('0x1ef'));}};};Dialer['prototype']['checkContactBlack']=function(_0x2ab6e7,_0x2b9d18){var _0x21eedd=this;return function(_0x302d76){if(_['isEmpty'](_0x302d76)){if(_['isNil'](_0x2b9d18[_0xfe5a('0x1f0')])||!_0x2b9d18[_0xfe5a('0x1f1')]){if(_0x2ab6e7[_0xfe5a('0x16b')]===_0xfe5a('0x7')){_0x2ab6e7[_0xfe5a('0x13d')]=_['isUndefined'](_0x2ab6e7['queueStatusComplete'])?!![]:_0x2ab6e7[_0xfe5a('0x13d')];var _0x34ad0e=uuid['v4']();_0x21eedd[_0xfe5a('0x28')][_0x34ad0e]=new Action(_0x2ab6e7,_0x2b9d18,_0x34ad0e);loggerBooked['info'](_0xfe5a('0x1f2'),_0x34ad0e,_0xfe5a('0x1f3'),JSON[_0xfe5a('0x7e')](_0x2ab6e7[_0xfe5a('0x13d')]),'Queue:\x20',_0x2ab6e7['name']);if(_0x2ab6e7['queueStatusComplete']){_0x2ab6e7[_0xfe5a('0x13d')]=![];_0x21eedd['queueBooked'][_0x21eedd[_0xfe5a('0x28')][_0x34ad0e][_0xfe5a('0xbe')]]=[];ami['Action']({'actionid':_0x34ad0e,'action':_0xfe5a('0x1f4'),'queue':_0x2ab6e7[_0xfe5a('0x42')]})['catch'](function(){_0x21eedd[_0xfe5a('0xbc')](_0x2ab6e7);_0x21eedd[_0xfe5a('0xce')]({'active':![],'ContactId':_0x21eedd[_0xfe5a('0x28')][_0x34ad0e][_0xfe5a('0xe4')],'ListId':_0x21eedd[_0xfe5a('0x28')][_0x34ad0e][_0xfe5a('0x10b')],'VoiceQueueId':_0x21eedd[_0xfe5a('0x28')][_0x34ad0e][_0xfe5a('0xe5')]||undefined,'CampaignId':_0x21eedd['actions'][_0x34ad0e][_0xfe5a('0xe6')]||undefined})['catch'](loggerCatch(_0xfe5a('0x1f5')));delete _0x21eedd[_0xfe5a('0x28')][_0x34ad0e];});}else{loggerBooked['info'](_0xfe5a('0x1f6'),JSON[_0xfe5a('0x7e')](_0x2ab6e7[_0xfe5a('0x13d')]),_0xfe5a('0x1f7'),_0x2ab6e7[_0xfe5a('0x42')]);_0x21eedd[_0xfe5a('0xbc')](_0x2ab6e7);_0x21eedd[_0xfe5a('0xce')]({'active':![],'ContactId':_0x21eedd[_0xfe5a('0x28')][_0x34ad0e][_0xfe5a('0xe4')],'ListId':_0x21eedd['actions'][_0x34ad0e][_0xfe5a('0x10b')],'VoiceQueueId':_0x21eedd['actions'][_0x34ad0e][_0xfe5a('0xe5')]||undefined,'CampaignId':_0x21eedd['actions'][_0x34ad0e][_0xfe5a('0xe6')]||undefined})['catch'](loggerCatch(_0xfe5a('0x1f5')));delete _0x21eedd[_0xfe5a('0x28')][_0x34ad0e];}}else{return _0x21eedd['actionOriginate'](_0x2ab6e7,_0x2b9d18);}}else{if(getDiff(_0x2b9d18[_0xfe5a('0x1f8')])<_0x2ab6e7[_0xfe5a('0x1f9')]*0x3c){if(_0x2b9d18[_0xfe5a('0x1fa')]&&!_0x2b9d18[_0xfe5a('0x1fa')][_0xfe5a('0x1fb')]){_0x21eedd[_0xfe5a('0x21')][_0xfe5a('0x13e')](_0x2b9d18['id'])['finally'](function(){_0x21eedd[_0xfe5a('0xbc')](_0x2ab6e7);});}else{_0x21eedd[_0xfe5a('0xd0')]({'active':![]},_0x2b9d18['id'],0x1)[_0xfe5a('0x1f')](function(){_0x21eedd['updateOriginated'](_0x2ab6e7);});}}else{_0x2ab6e7[_0xfe5a('0x69')]+=0x1;_0x21eedd[_0xfe5a('0xbc')](_0x2ab6e7);if(_0x2ab6e7[_0xfe5a('0x1fc')]){_0x21eedd[_0xfe5a('0xce')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2b9d18[_0xfe5a('0xe4')],'ListId':_0x2b9d18['ListId'],'VoiceQueueId':_0x2b9d18[_0xfe5a('0xe5')]||undefined,'CampaignId':_0x2b9d18[_0xfe5a('0xe6')]||undefined})[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x1fd')));_0x21eedd[_0xfe5a('0xdb')](createObjHistory(_0x2ab6e7,_0x2b9d18,_0xfe5a('0x1fe'),0x17,_0xfe5a('0x1ff')))[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0x200')));}else{_0x21eedd[_0xfe5a('0xe2')](createObjHistory(_0x2ab6e7,_0x2b9d18,_0xfe5a('0x201'),0x16,_0xfe5a('0x202')),_0xfe5a('0x203'),'[Originate][HistoryRecallClose]');}}}}else{_0x2ab6e7[_0xfe5a('0x204')]+=0x1;_0x21eedd[_0xfe5a('0xe2')](createObjHistory(_0x2ab6e7,_0x2b9d18,_0xfe5a('0x205'),0xd,_0xfe5a('0x206')),_0xfe5a('0x207'),'[Originate][MoveBlacklist]');throw _0xfe5a('0x208');}};};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x16a')]=function(_0x14ebfa){var _0x43871b=this;var _0x557a5a=_0x14ebfa[_0xfe5a('0x209')]-_0x14ebfa[_0xfe5a('0x77')]-_0x14ebfa[_0xfe5a('0xd3')];emitCampaignSummary(_0x14ebfa);if(_0x557a5a>0x0){if(_0x557a5a>this[_0xfe5a('0x26')]){_0x557a5a=this[_0xfe5a('0x26')];}_0x14ebfa['temp']+=_0x557a5a;this[_0xfe5a('0xd5')](_0x14ebfa['id'],_0x557a5a,_0x14ebfa['dialOrderByScheduledAt'],_0x14ebfa)['then'](function(_0x484b4f){_0x14ebfa[_0xfe5a('0xd3')]-=_0x557a5a;_0x14ebfa['temp']=_0x14ebfa[_0xfe5a('0xd3')]>0x0?_0x14ebfa[_0xfe5a('0xd3')]:0x0;if(!checkContactEmpty(_0x484b4f)){_0x14ebfa[_0xfe5a('0x40')]=_0xfe5a('0xa7');logger[_0xfe5a('0x84')]('[getContactCampaign2][Empty]'+_0x14ebfa[_0xfe5a('0x42')]);}else{_0x14ebfa['originated']+=_0x484b4f[_0xfe5a('0xa1')];_0x14ebfa[_0xfe5a('0x40')]=_0xfe5a('0x20a');for(var _0xfa69c8=0x0;_0xfa69c8<_0x484b4f[_0xfe5a('0xa1')];_0xfa69c8+=0x1){_0x14ebfa[_0xfe5a('0x20b')]+=0x1;if(_['isNil'](_0x484b4f[_0xfa69c8])||_[_0xfe5a('0xb6')](_0x484b4f[_0xfa69c8]['Contact'])||_['isNil'](_0x484b4f[_0xfa69c8][_0xfe5a('0x179')])){_0x43871b[_0xfe5a('0xe0')](_0xfe5a('0x20c'),_0x14ebfa,_0x484b4f[_0xfa69c8]);}else{_0x43871b[_0xfe5a('0xca')](_[_0xfe5a('0xe3')](_0x484b4f[_0xfa69c8],[_0xfe5a('0xe6'),_0xfe5a('0x20d')]))[_0xfe5a('0xc6')](_0x43871b[_0xfe5a('0x20e')](_0x14ebfa,_0x484b4f[_0xfa69c8]))[_0xfe5a('0xba')](_0x43871b['loggerHandler'](_0xfe5a('0x20f'),_0x14ebfa));}}}})[_0xfe5a('0xba')](loggerGetContactDialer(_0xfe5a('0x210'),_0x14ebfa,_0x557a5a));}};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x165')]=function(_0x45bc1c,_0x5b8f26){var _0xd71c2a=this;var _0x4aa97e=[];var _0x2c9a4a=_0x5b8f26>=0x1?_0x5b8f26:0x1;if(_0x45bc1c[_0xfe5a('0x16b')]===_0xfe5a('0x7')){_0x2c9a4a=0x1;}var _0x56dd6b=Math[_0xfe5a('0x1ed')](_0x45bc1c[_0xfe5a('0x53')]*_0x2c9a4a)-_0x45bc1c[_0xfe5a('0x77')]-_0x45bc1c[_0xfe5a('0xd3')];emitVoiceQueueSummary(_0x45bc1c);if(_0x45bc1c[_0xfe5a('0x211')]>0x0){var _0x4d4606=_0x45bc1c[_0xfe5a('0x211')]-_0x45bc1c['originated']-_0x45bc1c['talking']-_0x45bc1c[_0xfe5a('0xd3')]-_0x45bc1c[_0xfe5a('0x55')];if(_0x56dd6b>_0x4d4606){_0x56dd6b=_0x4d4606;}}if(_0x56dd6b>0x0){if(_0x45bc1c[_0xfe5a('0x16b')]==='booked'){_0x56dd6b=0x1;}if(_0x56dd6b>this[_0xfe5a('0x26')]){_0x56dd6b=this[_0xfe5a('0x26')];}_0x45bc1c[_0xfe5a('0xd3')]+=_0x56dd6b;for(var _0x2d3d47 in this[_0xfe5a('0x24')]){if(typeof this['agents'][_0x2d3d47]!=='undefined'){if(this[_0xfe5a('0x24')][_0x2d3d47][_0xfe5a('0xaf')]===_0xfe5a('0x212')&&this[_0xfe5a('0x24')][_0x2d3d47][_0xfe5a('0xb8')]===_0xfe5a('0xeb')){_0x4aa97e[_0xfe5a('0x13c')](this[_0xfe5a('0x24')][_0x2d3d47]['id']);}}}this[_0xfe5a('0xd2')](_0x45bc1c['id'],_0x4aa97e,_0x56dd6b,_0x45bc1c[_0xfe5a('0x213')],_0x45bc1c)[_0xfe5a('0xc6')](function(_0x378b88){_0x45bc1c[_0xfe5a('0xd3')]-=_0x56dd6b;_0x45bc1c['temp']=_0x45bc1c['temp']>0x0?_0x45bc1c[_0xfe5a('0xd3')]:0x0;if(!checkContactEmpty(_0x378b88)){_0xd71c2a[_0xfe5a('0xc0')](_0x45bc1c)[_0xfe5a('0xc6')](sendMessageReschedule(_0x45bc1c))[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0xc2')));}else{_0x45bc1c['originated']+=_0x378b88[_0xfe5a('0xa1')];_0x45bc1c[_0xfe5a('0x40')]=_0x45bc1c['dialMethod']===_0xfe5a('0x7')?_0xfe5a('0x181'):_0xfe5a('0x20a');for(var _0x2f4616=0x0;_0x2f4616<_0x378b88[_0xfe5a('0xa1')];_0x2f4616+=0x1){if(_[_0xfe5a('0xb6')](_0x378b88[_0x2f4616])||_[_0xfe5a('0xb6')](_0x378b88[_0x2f4616][_0xfe5a('0x18d')])||_[_0xfe5a('0xb6')](_0x378b88[_0x2f4616][_0xfe5a('0x179')])){_0xd71c2a[_0xfe5a('0xe0')](_0xfe5a('0x20c'),_0x45bc1c,_0x378b88[_0x2f4616]);}else{_0xd71c2a[_0xfe5a('0xc3')](_[_0xfe5a('0xe3')](_0x378b88[_0x2f4616],['VoiceQueueId',_0xfe5a('0x20d')]))[_0xfe5a('0xc6')](_0xd71c2a[_0xfe5a('0x20e')](_0x45bc1c,_0x378b88[_0x2f4616]))[_0xfe5a('0xba')](_0xd71c2a[_0xfe5a('0xdf')](_0xfe5a('0x20c'),_0x45bc1c));}}}})[_0xfe5a('0xba')](loggerGetContactDialer(_0xfe5a('0x214'),_0x45bc1c,_0x56dd6b));}};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x98')]=function(_0x5b5282){if(_0x5b5282[_0xfe5a('0x211')]>0x0){var _0x235ff6=_0x5b5282['dialLimitQueue']-_0x5b5282[_0xfe5a('0x77')]-_0x5b5282[_0xfe5a('0xaa')];if(_0x235ff6>0x0){this[_0xfe5a('0x215')](_0x5b5282);}else{loggerPredictiveCalls[_0xfe5a('0x84')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x5b5282);}};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x215')]=function(_0x418520){var _0x145a29=this;var _0x59f13e=[];_0x418520[_0xfe5a('0x77')]+=0x1;for(var _0x88529d in this['agents']){if(typeof this['agents'][_0x88529d]!==_0xfe5a('0xb5')){if(this[_0xfe5a('0x24')][_0x88529d][_0xfe5a('0xaf')]==='not_inuse'&&this[_0xfe5a('0x24')][_0x88529d][_0xfe5a('0xb8')]===_0xfe5a('0xeb')){_0x59f13e[_0xfe5a('0x13c')](this[_0xfe5a('0x24')][_0x88529d]['id']);}}}this[_0xfe5a('0xd2')](_0x418520['id'],_0x59f13e,0x1,_0x418520[_0xfe5a('0x213')],_0x418520)[_0xfe5a('0xc6')](function(_0x249731){if(!checkContactEmpty(_0x249731)){checkContactLowerLimitOriginate(_0x418520,0x1,0x0);_0x145a29[_0xfe5a('0xc0')](_0x418520)[_0xfe5a('0xc6')](sendMessageReschedule(_0x418520))[_0xfe5a('0xba')](loggerCatch(_0xfe5a('0xc2')));}else{_0x418520[_0xfe5a('0x40')]=_0xfe5a('0x20a');if(_[_0xfe5a('0xb6')](_0x249731[0x0])||_[_0xfe5a('0xb6')](_0x249731[0x0][_0xfe5a('0x18d')])||_[_0xfe5a('0xb6')](_0x249731[0x0][_0xfe5a('0x179')])){_0x145a29[_0xfe5a('0xe0')](_0xfe5a('0x20c'),_0x418520,_0x249731[0x0]);}else{_0x145a29[_0xfe5a('0xc3')](_[_0xfe5a('0xe3')](_0x249731[0x0],[_0xfe5a('0xe5'),_0xfe5a('0x20d')]))[_0xfe5a('0xc6')](_0x145a29['checkContactBlack'](_0x418520,_0x249731[0x0]))[_0xfe5a('0xba')](_0x145a29['loggerHandler'](_0xfe5a('0x216'),_0x418520));}}})[_0xfe5a('0xba')](loggerGetContactDialer(_0xfe5a('0x217'),_0x418520,0x1));emitVoiceQueueSummary(_0x418520);};Dialer[_0xfe5a('0x1c')]['abandonmentRate']=function(_0x32d7ea,_0x5736f1,_0x4db03f,_0x1bac31,_0x4bf1dc,_0x45c065){loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x218'));loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x219'),_0x32d7ea);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x21a'),_0x5736f1);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x21b'),_0x4db03f);loggerPredictive['info'](_0xfe5a('0x21c'),_0x1bac31);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x21d'),_0x4bf1dc);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x89'));return new BPromise(function(_0x45bfd0,_0x5320fc){if(_0x32d7ea<=0x0||isNaN(_0x32d7ea)){return _0x5320fc(msgResponse(_0xfe5a('0x21e'),_0xfe5a('0x4b'),_0xfe5a('0x21f')+_0x32d7ea));}if(_0x4db03f<=0x0||isNaN(_0x4db03f)){return _0x5320fc(msgResponse(_0xfe5a('0x21e'),_0xfe5a('0x4b'),'Ts\x20=\x20'+_0x4db03f));}if(_0x1bac31<=0x0||isNaN(_0x1bac31)){return _0x5320fc(msgResponse('[abandonmentRate]',_0xfe5a('0x4b'),'p\x20=\x20'+_0x1bac31));}if(_0x5736f1<=0x0||isNaN(_0x5736f1)){return _0x5320fc(msgResponse('[abandonmentRate]',_0xfe5a('0x4b'),'interval\x20=\x20'+_0x5736f1));}if(_0x4bf1dc<=0x0||isNaN(_0x4bf1dc)){return _0x5320fc(msgResponse(_0xfe5a('0x21e'),'Error',_0xfe5a('0x220')+_0x4bf1dc));}_0x45c065=_0x45c065||0x0;var _0x313495=0x1/_0x4db03f;var _0x4bc770=0x0;var _0x4ffcf8=0x0;var _0x31e3ac=0x0;var _0x5bc9df=0x0;for(var _0x497c1c=0x0;_0x31e3ac<_0x4bf1dc;_0x497c1c+=0x1){_0x4ffcf8=_0x497c1c/_0x5736f1;_0x4bc770=(_0x1bac31*_0x4ffcf8+_0x45c065)/_0x313495;_0x31e3ac=erlangb(_0x4bc770,_0x32d7ea);_0x5bc9df=_0x4bc770/_0x32d7ea*(0x1-erlangb(_0x4bc770,_0x32d7ea));}return _0x45bfd0({'erlangCalls':_0x497c1c,'erlangCallToSecond':_0x5736f1/_0x497c1c,'erlangAbandonmentRate':_0x31e3ac,'erlangBusyFactor':_0x5bc9df});});};Dialer[_0xfe5a('0x1c')][_0xfe5a('0x1e5')]=function(_0x517f4e,_0x3e08e3,_0x57b9bb,_0x47dbd9,_0x1bccf3,_0x51f03d){loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x221'));loggerPredictive[_0xfe5a('0x84')]('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',_0x517f4e);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x21a'),_0x3e08e3);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x21b'),_0x57b9bb);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x21c'),_0x47dbd9);loggerPredictive[_0xfe5a('0x84')](_0xfe5a('0x222'),_0x1bccf3);loggerPredictive[_0xfe5a('0x84')]('---------------------------');return new BPromise(function(_0x422e45,_0x5e2ebe){if(_0x517f4e<=0x0||isNaN(_0x517f4e)){return _0x5e2ebe(msgResponse('[busyFactor]',_0xfe5a('0x4b'),_0xfe5a('0x21f')+_0x517f4e));}if(_0x57b9bb<=0x0||isNaN(_0x57b9bb)){return _0x5e2ebe(msgResponse(_0xfe5a('0x223'),'Error',_0xfe5a('0x224')+_0x57b9bb));}if(_0x47dbd9<=0x0||isNaN(_0x47dbd9)){return _0x5e2ebe(msgResponse(_0xfe5a('0x223'),_0xfe5a('0x4b'),'p\x20=\x20'+_0x47dbd9));}if(_0x3e08e3<=0x0||isNaN(_0x3e08e3)){return _0x5e2ebe(msgResponse(_0xfe5a('0x223'),_0xfe5a('0x4b'),_0xfe5a('0x225')+_0x3e08e3));}if(_0x1bccf3<=0x0||isNaN(_0x1bccf3)){return _0x5e2ebe(msgResponse(_0xfe5a('0x223'),_0xfe5a('0x4b'),_0xfe5a('0x226')+_0x1bccf3));}_0x51f03d=_0x51f03d||0x0;var _0x2db40f=0x1/_0x57b9bb;var _0x152904=0x0;var _0x5b0229=0x0;var _0x518bd2=0x0;var _0x49073e=0x0;for(var _0x36c152=0x0;_0x49073e<_0x1bccf3;_0x36c152+=0x1){_0x5b0229=_0x36c152/_0x3e08e3;_0x152904=(_0x47dbd9*_0x5b0229+_0x51f03d)/_0x2db40f;_0x518bd2=erlangb(_0x152904,_0x517f4e);_0x49073e=_0x152904/_0x517f4e*(0x1-erlangb(_0x152904,_0x517f4e));}return _0x422e45({'erlangCalls':_0x36c152,'erlangCallToSecond':_0x3e08e3/_0x36c152,'erlangAbandonmentRate':_0x518bd2,'erlangBusyFactor':_0x49073e});});};module[_0xfe5a('0x227')]=Dialer; \ No newline at end of file +var _0x0f42=['membername','[syncHangupInAMDIvr]','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','[syncHangupIvr][createHistory]','reason','agent','agiafterat','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dropreason','TIMEOUT','dialQueueProject2','dialDropRetryFrequency','callAdditionalPhoneAfterMin','additional','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','CALLEREXIT','voiceQueue','dialAbandonedRetryFrequency','Abandoned','[syncAgentComplete][createHistory][11]','actionid','locked','paused','stateinterface','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','idHopper','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[Catch][Preview][syncQueueStatusComplete]','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','booked','Queue','method\x20not\x20recognized','handleIvr','checkIsTrunkReachable','dialGlobalInterval','syncCampaigns','dialTimezone','\x5cw{0,','pow','replace','random','match','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','dialQueueTimeout','getCaller','xcally-motion-dialer','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','Contact','tags','updatedAt','%s%s','XMD-','toUpper','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','dialCutDigit','substring','SIP/%s/%s%s','trim','from-sip','[originateError]:\x20%s','[originate][error]','Error','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialGlobalMaxRetry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','[rescheduleContact][Abandoned]','countagentrejectretry','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','NoAnswer','custom:agentnoanswer','noanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','dialAbandonedMaxRetry','reason\x2011\x20abandoned','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','averageHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','erlangCallToSecond','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','ACTIVE','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[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','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]','p\x20=\x20','interval\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]','m\x20=\x20','Ts\x20=\x20','exports','util','lodash','bluebird','uuid','md5','../preview/util/util','../../../config/logger','dialer','predictive','predictiveCalls','redis','localhost','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperAdditionalPhone','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','maxNumberOriginate','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','syncAgentComplete','syncQueueSummary','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','AGENTS_NOT_LOGGED','name','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','stringify','milliseconds','diff','seconds','emit','outbound','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangBusyFactor','Trunk','active','callerid','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign: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','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','isUndefined','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','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22\x22\x20<>','error','stack','inspect','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','[getContactDialer2][Empty]','talking','pTalking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','endtime','starttime','[uniqueid]','clearZombieChannels','[actions]','undefined','sequence','isNil','status','channel','catch','No\x20such\x20channel','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','verifyAdditionalPhones','swapAdditionalPhones','checkIsBlackListIvr','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact]','isSuccess','Success','isTrunkReachable','trunks','SIP/%s','reachable','unmonitored','uniqueid','exten','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','AMD','custom:amd','buildObj','amd','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ListId','statedesc'];(function(_0x1c6efd,_0xb2f3cd){var _0x53a918=function(_0x14c19b){while(--_0x14c19b){_0x1c6efd['push'](_0x1c6efd['shift']());}};_0x53a918(++_0xb2f3cd);}(_0x0f42,0x126));var _0x20f4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0f42[_0xa464c9];return _0x3d73c4;};'use strict';var util=require(_0x20f4('0x0'));var _=require(_0x20f4('0x1'));var BPromise=require(_0x20f4('0x2'));var uuid=require(_0x20f4('0x3'));var moment=require('moment');var rr=require('rr');var md5=require(_0x20f4('0x4'));var Redis=require('ioredis');var ut=require(_0x20f4('0x5'));var config=require('../../../config/environment/');var logger=require(_0x20f4('0x6'))(_0x20f4('0x7'));var loggerBooked=require(_0x20f4('0x6'))('booked');var loggerPredictive=require(_0x20f4('0x6'))(_0x20f4('0x8'));var loggerPredictiveCalls=require('../../../config/logger')(_0x20f4('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require('../ami');config[_0x20f4('0xa')]=_['defaults'](config[_0x20f4('0xa')],{'host':_0x20f4('0xb'),'port':0x18eb});var io=require(_0x20f4('0xc'))(new Redis(config[_0x20f4('0xa')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x20f4('0xd'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperAdditionalPhone=require(_0x20f4('0xe'));var cmHopperBlack=require(_0x20f4('0xf'));var voiceQueueRt=require(_0x20f4('0x10'));var Action=require(_0x20f4('0x11'));var History=require('./history');var Final=require(_0x20f4('0x12'));var AgentComplete=require(_0x20f4('0x13'));var QueueCallerAbandon=require(_0x20f4('0x14'));var Hangup=require(_0x20f4('0x15'));var ipAgi=process[_0x20f4('0x16')][_0x20f4('0x17')]||_0x20f4('0x18');var strategy={'rrmemory':_0x20f4('0x19'),'roundrobin':_0x20f4('0x1a')};var Sequence=function(){};Sequence[_0x20f4('0x1b')][_0x20f4('0x1c')]=function(_0x490c2c){this['tail']=this[_0x20f4('0x1d')]?this[_0x20f4('0x1d')][_0x20f4('0x1e')](_0x490c2c):_0x490c2c();};function Dialer(_0x36fdc2,_0x14e196){this['sequence']=new Sequence();this[_0x20f4('0x1f')]=_0x14e196;this[_0x20f4('0x20')]=_0x36fdc2[_0x20f4('0x20')];this['campaigns']=_0x36fdc2[_0x20f4('0x21')];this[_0x20f4('0x22')]=_0x36fdc2[_0x20f4('0x22')];this['trunks']=_0x36fdc2['trunks'];this[_0x20f4('0x23')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x20f4('0x24')]={};this['contactsId']={};this[_0x20f4('0x25')]={};this[_0x20f4('0x26')]={};this[_0x20f4('0x27')]={};this[_0x20f4('0x28')]={};this[_0x20f4('0x29')]={};this[_0x20f4('0x2a')]={};this['queueBookedRR']={};ami['on'](_0x20f4('0x2b'),this[_0x20f4('0x2c')][_0x20f4('0x2d')](this));ami['on'](_0x20f4('0x2e'),this[_0x20f4('0x2f')]['bind'](this));ami['on']('originateresponse',this[_0x20f4('0x30')][_0x20f4('0x2d')](this));ami['on']('agentcomplete',this[_0x20f4('0x31')][_0x20f4('0x2d')](this));ami['on']('custom:queuesummary',this[_0x20f4('0x32')][_0x20f4('0x2d')](this));ami['on']('hangup',this[_0x20f4('0x33')][_0x20f4('0x2d')](this));ami['on'](_0x20f4('0x34'),this[_0x20f4('0x35')][_0x20f4('0x2d')](this));ami['on'](_0x20f4('0x36'),this[_0x20f4('0x37')][_0x20f4('0x2d')](this));ami['on'](_0x20f4('0x38'),this[_0x20f4('0x39')][_0x20f4('0x2d')](this));ami['on'](_0x20f4('0x3a'),this[_0x20f4('0x3b')][_0x20f4('0x2d')](this));this[_0x20f4('0x3c')]();this[_0x20f4('0x3d')]();}function isNotNull(_0x2f964a){return _0x2f964a!==null&&!_['isUndefined'](_0x2f964a);}function checkIsLoggedIn(_0x4e20fd,_0x4d4edc){return function(){if(_0x4d4edc<=0x0){_0x4e20fd[_0x20f4('0x3e')]=_0x20f4('0x3f');throw _0x4e20fd[_0x20f4('0x40')]+'\x20AGENTS\x20NOT\x20LOGGED';}};}function isActive(_0x5d95f3){return _0x5d95f3;}function checkIsActive(_0x352794,_0x1f85c8){return function(){if(!isActive(_0x1f85c8)){_0x352794[_0x20f4('0x3e')]=_0x20f4('0x41');throw _0x352794['name']+_0x20f4('0x42');}};}function checkInterval(_0x546d61){return function(){if(!isNotNull(_0x546d61[_0x20f4('0x43')])){_0x546d61[_0x20f4('0x3e')]=_0x20f4('0x44');throw _0x546d61[_0x20f4('0x40')]+_0x20f4('0x45');}if(!isNotNull(_0x546d61[_0x20f4('0x43')][_0x20f4('0x46')])){_0x546d61[_0x20f4('0x3e')]=_0x20f4('0x44');throw _0x546d61['name']+_0x20f4('0x45');}if(!isNotNull(_[_0x20f4('0x47')](_0x546d61[_0x20f4('0x43')]['Intervals']))){_0x546d61['message']=_0x20f4('0x44');throw _0x546d61['name']+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x4b3fff,_0xb1504b,_0x2b1ef4){return{'action':_0x4b3fff,'response':_0xb1504b,'message':_0x2b1ef4,'stack':_0x2b1ef4};}function myreject(_0xbc17cc){return function(_0x18b79a){return _0xbc17cc(msgResponse('[ifTime][Action]','Error',JSON[_0x20f4('0x48')](_0x18b79a)));};}function getSeconds(_0x34f5df,_0xd250e7){var _0x5117fb=moment(_0x34f5df)[_0x20f4('0x49')](0x0);var _0x23e40a=moment(_0xd250e7)[_0x20f4('0x49')](0x0);return _0x5117fb[_0x20f4('0x4a')](_0x23e40a,_0x20f4('0x4b'));}function emit(_0x9145f1,_0x3af857,_0x3147f6){io['to'](_0x9145f1)[_0x20f4('0x4c')](_0x3af857,_0x3147f6);}function emitVoiceQueueSummary(_0x35e426){if(_0x35e426['type']===_0x20f4('0x4d')){var _0x3e6211={'id':_0x35e426['id'],'name':_0x35e426[_0x20f4('0x40')],'strategy':_0x35e426[_0x20f4('0x4e')],'answered':_0x35e426['answered'],'available':_0x35e426[_0x20f4('0x4f')],'loggedIn':_0x35e426[_0x20f4('0x50')],'pTalking':_0x35e426['pTalking'],'sumBillable':_0x35e426[_0x20f4('0x51')],'sumDuration':_0x35e426[_0x20f4('0x52')],'sumHoldTime':_0x35e426[_0x20f4('0x53')]||0x0,'talking':_0x35e426['talking'],'total':_0x35e426[_0x20f4('0x54')],'type':_0x35e426[_0x20f4('0x55')],'unmanaged':_0x35e426[_0x20f4('0x56')],'abandoned':_0x35e426['abandoned'],'waiting':_0x35e426[_0x20f4('0x57')],'loggedInDb':_0x35e426[_0x20f4('0x58')],'dialActive':_0x35e426[_0x20f4('0x59')],'dialMethod':_0x35e426[_0x20f4('0x5a')],'dialOriginateCallerIdName':_0x35e426[_0x20f4('0x5b')],'dialOriginateCallerIdNumber':_0x35e426['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x35e426[_0x20f4('0x5c')],'dialPrefix':_0x35e426[_0x20f4('0x5d')],'outboundAnswerAgiCallsDay':_0x35e426[_0x20f4('0x5e')],'outboundAnswerCallsDay':_0x35e426['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x35e426[_0x20f4('0x5f')],'outboundBusyCallsDay':_0x35e426['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x35e426[_0x20f4('0x60')],'outboundDropCallsDayACS':_0x35e426[_0x20f4('0x61')],'outboundDropCallsDayCallersExit':_0x35e426['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x35e426['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x35e426[_0x20f4('0x62')],'outboundNoSuchCallsDay':_0x35e426['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x35e426[_0x20f4('0x63')],'outboundReCallsDay':_0x35e426[_0x20f4('0x64')],'outboundRejectCallsDay':_0x35e426[_0x20f4('0x65')],'outboundUnknownCallsDay':_0x35e426[_0x20f4('0x66')],'predictiveIntervalAnsweredCalls':_0x35e426['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x35e426[_0x20f4('0x67')],'predictiveIntervalAvgTalktime':_0x35e426[_0x20f4('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x35e426[_0x20f4('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x35e426[_0x20f4('0x6a')],'predictiveIntervalErlangCalls':_0x35e426[_0x20f4('0x6b')],'predictiveIntervalErlangCallsDroppedCalls':_0x35e426[_0x20f4('0x6c')],'predictiveIntervalHitRate':_0x35e426['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x35e426[_0x20f4('0x6d')],'predictiveIntervalPauses':_0x35e426[_0x20f4('0x6e')],'predictiveIntervalAvailable':_0x35e426['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x35e426[_0x20f4('0x6f')],'message':_0x35e426['message'],'originated':_0x35e426[_0x20f4('0x70')],'erlangCalls':_0x35e426[_0x20f4('0x71')],'erlangCallToSecond':_0x35e426['erlangCallToSecond'],'erlangAbandonmentRate':_0x35e426['erlangAbandonmentRate'],'erlangBusyFactor':_0x35e426[_0x20f4('0x72')],'startPredictive':_0x35e426[_0x20f4('0x27')],'startProgressive':_0x35e426['startProgressive']};if(_0x35e426[_0x20f4('0x73')]){_0x3e6211['Trunk']={'id':_0x35e426['Trunk']['id'],'name':_0x35e426['Trunk']['name'],'active':_0x35e426[_0x20f4('0x73')][_0x20f4('0x74')],'callerid':_0x35e426[_0x20f4('0x73')][_0x20f4('0x75')]};}if(_0x35e426[_0x20f4('0x43')]){_0x3e6211[_0x20f4('0x43')]={'id':_0x35e426[_0x20f4('0x43')]['id'],'name':_0x35e426[_0x20f4('0x43')][_0x20f4('0x40')]};}var _0x5102b9=md5(JSON[_0x20f4('0x48')](_0x3e6211));if(_0x35e426[_0x20f4('0x4')]!==_0x5102b9){_0x35e426[_0x20f4('0x4')]=_0x5102b9;emit(util[_0x20f4('0x76')](_0x20f4('0x77'),_0x3e6211[_0x20f4('0x40')]),_0x20f4('0x78'),_0x3e6211);}}}function emitCampaignSummary(_0x48e1d0){if(_0x48e1d0[_0x20f4('0x55')]===_0x20f4('0x79')){emit(util[_0x20f4('0x76')](_0x20f4('0x7a'),_0x48e1d0[_0x20f4('0x40')]),_0x20f4('0x7b'),_0x48e1d0);}}function checkGetDataPredictive(_0x5d2532){if(isNotNull(_0x5d2532)&&!_['isEmpty'](_0x5d2532)){loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x7d'));loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x7e'),_0x5d2532[_0x20f4('0x6f')]);loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x7f'),_0x5d2532[_0x20f4('0x80')]);loggerPredictive['info'](_0x20f4('0x81'),_0x5d2532[_0x20f4('0x6a')]);loggerPredictive[_0x20f4('0x7c')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d2532['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x82'),_0x5d2532[_0x20f4('0x67')]);loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x83'),_0x5d2532[_0x20f4('0x68')]);loggerPredictive[_0x20f4('0x7c')]('---------------------------');if(_0x5d2532[_0x20f4('0x6f')]>0x0){if(!_['isUndefined'](_0x5d2532[_0x20f4('0x68')])&&_0x5d2532['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x84'));if(!_[_0x20f4('0x85')](_0x5d2532[_0x20f4('0x67')])&&_0x5d2532[_0x20f4('0x67')]>0x0){return!![];}loggerPredictive[_0x20f4('0x7c')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x86'));}}else{loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x87'));}return![];}function mergeDataErlangB(_0x50633e){return function(_0x2d7b79){loggerPredictive['info'](_0x20f4('0x88'));loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x89'),_0x2d7b79[_0x20f4('0x71')]);loggerPredictive[_0x20f4('0x7c')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d7b79['erlangCallToSecond']);loggerPredictive['info'](_0x20f4('0x8a'),_0x2d7b79[_0x20f4('0x8b')]);loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x8c'),_0x2d7b79[_0x20f4('0x72')]);loggerPredictive['info'](_0x20f4('0x8a'),_0x2d7b79[_0x20f4('0x8b')]);loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x8d'));_[_0x20f4('0x8e')](_0x50633e,_0x2d7b79);};}function getDiff(_0x36becf){var _0x5bdd46=moment()[_0x20f4('0x49')](0x0);var _0x5ee162=moment(_0x36becf)['milliseconds'](0x0);return _0x5bdd46[_0x20f4('0x4a')](_0x5ee162,_0x20f4('0x4b'));}function ifInterval(_0x59de69,_0x49bc7a){if(_[_0x20f4('0x85')](_0x49bc7a)){return![];}return getDiff(_0x49bc7a)<_0x59de69*0x3c;}function freeVariablesPredictive(_0x4736bb){if(isNotNull(_0x4736bb)){if(!_[_0x20f4('0x85')](_0x4736bb[_0x20f4('0x28')])){_0x4736bb[_0x20f4('0x28')]=undefined;loggerPredictive[_0x20f4('0x7c')](_0x4736bb[_0x20f4('0x40')],_0x20f4('0x8f'));}if(!_['isUndefined'](_0x4736bb[_0x20f4('0x27')])){_0x4736bb[_0x20f4('0x27')]=undefined;loggerPredictive['info'](_0x4736bb['name'],_0x20f4('0x90'));}if(!_['isUndefined'](_0x4736bb[_0x20f4('0x91')])){clearInterval(_0x4736bb[_0x20f4('0x91')]);_0x4736bb[_0x20f4('0x91')]=undefined;loggerPredictive['info'](_0x4736bb[_0x20f4('0x40')],_0x20f4('0x92'));}}}function erlangb(_0x5e5307,_0x53112f){if(_0x53112f===0x0){return 0x0;}var _0xf7b234=0x1;for(var _0x219a52=0x1;_0x219a52<=_0x53112f;_0x219a52+=0x1){_0xf7b234=0x1+_0xf7b234*_0x219a52/_0x5e5307;}return 0x1/_0xf7b234;}function isVoiceQueueOutbound(_0x22dd24){return _0x22dd24===_0x20f4('0x4d');}function isNotPreview(_0x5bd35d){return _0x5bd35d!=='preview';}function isCampaignIvr(_0x15dd4c){return _0x15dd4c===_0x20f4('0x79');}function getCallerId(_0x31a54,_0x40155c,_0x34f659){if(!_[_0x20f4('0x85')](_0x34f659)&&typeof _0x34f659==='string'&&!_[_0x20f4('0x47')](_0x34f659)){if(!_[_0x20f4('0x85')](_0x40155c)&&typeof _0x40155c===_0x20f4('0x93')&&!_[_0x20f4('0x47')](_0x40155c)){return util[_0x20f4('0x76')]('\x22%s\x22\x20<%s>',_0x40155c,_0x34f659);}return util[_0x20f4('0x76')]('\x22%s\x22\x20<%s>',_0x34f659,_0x34f659);}if(!_['isUndefined'](_0x31a54)&&typeof _0x31a54===_0x20f4('0x93')&&!_[_0x20f4('0x47')](_0x31a54)){return _0x31a54;}return _0x20f4('0x94');}function loggerCatchQueueSummary(_0x56638d,_0x5ba8fa){return function(_0x2c8691){freeVariablesPredictive(_0x5ba8fa);emitVoiceQueueSummary(_0x5ba8fa);emitCampaignSummary(_0x5ba8fa);loggerSyncQueueSummary['error'](_0x56638d,util['inspect'](_0x2c8691,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x326682,_0x6aed71){return function(_0x360f84){loggerPredictive[_0x20f4('0x95')](_0x6aed71[_0x20f4('0x40')],_0x326682);loggerPredictive[_0x20f4('0x95')](_0x360f84[_0x20f4('0x96')]);freeVariablesPredictive(_0x6aed71);};}function loggerCatch(_0x3a5eb0){return function(_0x54bc1c){logger['error'](_0x3a5eb0,util[_0x20f4('0x97')](_0x54bc1c,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x35fbcc){return _0x35fbcc&&!_[_0x20f4('0x85')](_0x35fbcc)&&_0x35fbcc[_0x20f4('0x98')]>0x0;}function decremetOriginate(_0x13bab5){if(!_['isUndefined'](_0x13bab5)&&_0x13bab5!==null){if(typeof _0x13bab5['originated']!=='undefined'){if(_0x13bab5[_0x20f4('0x70')]>0x0){_0x13bab5[_0x20f4('0x70')]-=0x1;}else{logger[_0x20f4('0x95')](_0x20f4('0x99'));}}}else{logger[_0x20f4('0x95')](_0x20f4('0x9a'));}}function checkContactLowerLimitOriginate(_0x2bdb63,_0x597236,_0x3b1149){if(_0x597236>_0x3b1149){for(var _0x569aff=0x0;_0x569aff<_0x597236-_0x3b1149;_0x569aff+=0x1){decremetOriginate(_0x2bdb63);}}}function loggerGetContactDialer(_0x1099a4,_0x19a846,_0x29e90e){return function(_0x1a845a){checkContactLowerLimitOriginate(_0x19a846,_0x29e90e,0x0);logger[_0x20f4('0x95')](_0x1099a4,util['inspect'](_0x1a845a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2b80e5){return function(_0x10c953){if(isNotNull(_0x10c953)&&isNotNull(_0x10c953[0x0])){if(_0x10c953[0x0][_0x20f4('0x9b')]>0x0){_0x2b80e5[_0x20f4('0x3e')]=_0x20f4('0x9c');logger['info'](_0x20f4('0x9d')+_0x2b80e5[_0x20f4('0x40')],_0x10c953[0x0]['contactsRescheduled'],'contacts');}else{_0x2b80e5['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0x20f4('0x7c')](_0x20f4('0x9e')+_0x2b80e5['name']);}}};}function notSendMessagesQueue(_0x55f15f){if(_0x55f15f['sendMessageOneNotActive']){freeVariablesPredictive(_0x55f15f);if(_0x55f15f[_0x20f4('0x70')]===0x0&&_0x55f15f[_0x20f4('0x9f')]===0x0&&_0x55f15f[_0x20f4('0x57')]===0x0&&(_0x55f15f[_0x20f4('0xa0')]||0x0)===0x0){_0x55f15f['sendMessageOneNotActive']=![];_0x55f15f[_0x20f4('0x4f')]=0x0;_0x55f15f[_0x20f4('0x3e')]=_0x20f4('0x41');loggerSyncQueueSummary[_0x20f4('0x95')](_0x20f4('0xa1'),_0x55f15f[_0x20f4('0x40')],_0x20f4('0xa2'));}else{_0x55f15f['message']=_0x20f4('0xa3');loggerSyncQueueSummary['error'](_0x20f4('0xa1'),_0x55f15f[_0x20f4('0x40')],_0x20f4('0xa4'));}emitVoiceQueueSummary(_0x55f15f);}}function notSendMessagesCampaign(_0x45a1cd){if(_0x45a1cd[_0x20f4('0xa5')]){if(_0x45a1cd[_0x20f4('0x70')]===0x0){_0x45a1cd[_0x20f4('0xa5')]=![];_0x45a1cd['message']='NOT_ACTIVE';loggerSyncQueueSummary['error']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x45a1cd[_0x20f4('0x40')],_0x20f4('0xa2'));}else{_0x45a1cd[_0x20f4('0x3e')]=_0x20f4('0xa3');loggerSyncQueueSummary[_0x20f4('0x95')](_0x20f4('0xa6'),_0x45a1cd[_0x20f4('0x40')],_0x20f4('0xa4'));}emitCampaignSummary(_0x45a1cd);}}function createObjHistory(_0x7948cf,_0x22e4d2,_0x1ff9ec,_0x236bc0,_0x3b51ee){_0x7948cf[_0x20f4('0x3e')]=_0x1ff9ec;var _0x1a904b=new Action(_0x7948cf,_0x22e4d2);var _0x392759=new History(_0x1a904b);_0x392759[_0x20f4('0xa7')]=_0x236bc0;_0x392759['statedesc']=_0x3b51ee;_0x392759[_0x20f4('0xa8')]=_0x1a904b[_0x20f4('0xa9')];return _0x392759;}Dialer[_0x20f4('0x1b')]['loopClearZombieChannels']=function(){var _0x3e4694=this;setInterval(function(){_0x3e4694['clearZombieChannels'](_0x3e4694[_0x20f4('0x25')],_0x20f4('0xaa'));_0x3e4694[_0x20f4('0xab')](_0x3e4694[_0x20f4('0x24')],_0x20f4('0xac'));},0x32c8);};Dialer['prototype'][_0x20f4('0xab')]=function(_0xcad0e2,_0x10f1c3){var _0x5fa68c=this;for(var _0x3610d5 in _0xcad0e2){if(typeof _0xcad0e2[_0x3610d5]!==_0x20f4('0xad')){this[_0x20f4('0xae')][_0x20f4('0x1c')](function(){if(!_[_0x20f4('0xaf')](_0xcad0e2[_0x3610d5])){return ami['Action']({'action':_0x20f4('0xb0'),'channel':_0xcad0e2[_0x3610d5][_0x20f4('0xb1')]})[_0x20f4('0xb2')](function(_0x2b79fd){if(_0x2b79fd[_0x20f4('0x3e')]===_0x20f4('0xb3')){setTimeout(function(){if(_0xcad0e2[_0x3610d5]&&_0xcad0e2[_0x3610d5]['type']!==_0x20f4('0x79')){_0x5fa68c[_0x20f4('0xb4')](_0x5fa68c[_0x20f4('0x20')][_0xcad0e2[_0x3610d5][_0x20f4('0xb5')]]);logger[_0x20f4('0x95')](_0x20f4('0xb6'),_0x10f1c3,_0x3610d5,_0xcad0e2[_0x3610d5][_0x20f4('0xb5')]);delete _0xcad0e2[_0x3610d5];}if(_0xcad0e2[_0x3610d5]&&_0xcad0e2[_0x3610d5][_0x20f4('0x55')]==='ivr'){_0x5fa68c[_0x20f4('0xb4')](_0x5fa68c[_0x20f4('0x21')][_0xcad0e2[_0x3610d5][_0x20f4('0xb5')]]);logger['error'](_0x20f4('0xb7'),_0x10f1c3,_0x3610d5,_0xcad0e2[_0x3610d5][_0x20f4('0xb5')]);delete _0xcad0e2[_0x3610d5];}},0x2328);}});}});}}};Dialer[_0x20f4('0x1b')][_0x20f4('0xb8')]=function(_0xed9276){return BPromise['resolve']()[_0x20f4('0xb9')](cmHopper['countReScheduled'](_0xed9276))[_0x20f4('0xb2')](loggerCatch(_0x20f4('0xba')));};Dialer['prototype'][_0x20f4('0xbb')]=function(_0x4b1024){return BPromise[_0x20f4('0xbc')]()[_0x20f4('0xb9')](cmHopperBlack['checkIsBlackList'](_0x4b1024))['catch'](loggerCatch(_0x20f4('0xbd')));};Dialer[_0x20f4('0x1b')][_0x20f4('0xbe')]=function(_0x1e74d9,_0x1c898e,_0x3f50ce){return BPromise[_0x20f4('0xbc')]()[_0x20f4('0xb9')](cmHopperAdditionalPhone[_0x20f4('0xbe')](_0x1e74d9,_0x1c898e,_0x3f50ce))[_0x20f4('0xb2')](loggerCatch('[verifyAdditionalPhone]\x20'));};Dialer[_0x20f4('0x1b')][_0x20f4('0xbf')]=function(_0x35a3da,_0x1b87f7,_0x41f88d){return BPromise['resolve']()['then'](cmHopperAdditionalPhone[_0x20f4('0xbf')](_0x35a3da,_0x1b87f7,_0x41f88d))['catch'](loggerCatch('[swapAdditionalPhone]\x20'));};Dialer[_0x20f4('0x1b')][_0x20f4('0xc0')]=function(_0x232201){return BPromise[_0x20f4('0xbc')]()[_0x20f4('0xb9')](cmHopperBlack[_0x20f4('0xc0')](_0x232201))[_0x20f4('0xb2')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x20f4('0x1b')]['averageHandleTime']=function(_0x2da7e3){return BPromise['resolve']()[_0x20f4('0xb9')](cmHopperHistory[_0x20f4('0xc1')](_0x2da7e3))[_0x20f4('0xb2')](loggerCatch(_0x20f4('0xc2')));};Dialer[_0x20f4('0x1b')]['rescheduleContact']=function(_0x549ff4){return BPromise[_0x20f4('0xbc')]()['then'](cmHopper[_0x20f4('0xc3')](_0x549ff4))[_0x20f4('0xb2')](loggerCatch(_0x20f4('0xc4')));};Dialer[_0x20f4('0x1b')][_0x20f4('0xc5')]=function(_0x4cf791,_0x51ce5e,_0x5dabdf){return BPromise['resolve']()[_0x20f4('0xb9')](cmHopper[_0x20f4('0xc5')](_0x4cf791,_0x51ce5e,_0x5dabdf))[_0x20f4('0xb2')](loggerCatch(_0x20f4('0xc6')));};Dialer['prototype'][_0x20f4('0xc7')]=function(_0x3d5b54,_0x25eb4e,_0x52913c,_0x47f6f9,_0x6ff074){return BPromise[_0x20f4('0xbc')]()['then'](cmHopper[_0x20f4('0xc7')](_0x3d5b54,_0x25eb4e,_0x52913c,_0x47f6f9))[_0x20f4('0xb2')](function(_0xb2ec91){_0x6ff074[_0x20f4('0xc8')]-=_0x52913c;_0x6ff074[_0x20f4('0xc8')]=_0x6ff074[_0x20f4('0xc8')]>0x0?_0x6ff074[_0x20f4('0xc8')]:0x0;loggerCatch(_0x20f4('0xc9'))(_0xb2ec91);});};Dialer['prototype'][_0x20f4('0xca')]=function(_0xbd4fb8,_0x3dbbe6,_0x4af2bd,_0x2642e7){return BPromise['resolve']()[_0x20f4('0xb9')](cmHopper[_0x20f4('0xca')](_0xbd4fb8,_0x3dbbe6,_0x4af2bd))[_0x20f4('0xb2')](function(_0x35fd3b){_0x2642e7[_0x20f4('0xc8')]-=_0x3dbbe6;_0x2642e7[_0x20f4('0xc8')]=_0x2642e7[_0x20f4('0xc8')]>0x0?_0x2642e7[_0x20f4('0xc8')]:0x0;loggerCatch('[getContactDialerIvr]\x20')(_0x35fd3b);});};Dialer[_0x20f4('0x1b')][_0x20f4('0xcb')]=function(_0x1eb6b9){return BPromise[_0x20f4('0xbc')]()[_0x20f4('0xb9')](voiceQueueRt[_0x20f4('0xcb')](_0x1eb6b9))[_0x20f4('0xb2')](loggerCatch(_0x20f4('0xcc')));};Dialer[_0x20f4('0x1b')]['moveContactManagedDialer']=function(_0x145612){return BPromise[_0x20f4('0xbc')]()[_0x20f4('0xb9')](cmHopper[_0x20f4('0xcd')](_0x145612))[_0x20f4('0xb2')](loggerCatch(_0x20f4('0xce')));};Dialer[_0x20f4('0x1b')][_0x20f4('0xcf')]=function(_0x425ea4){return BPromise[_0x20f4('0xbc')]()[_0x20f4('0xb9')](cmHopperHistory[_0x20f4('0xcf')](_0x425ea4))['catch'](loggerCatch('[createHistory]\x20'));};Dialer[_0x20f4('0x1b')][_0x20f4('0xb4')]=function(_0x5a69fa){if(!_[_0x20f4('0x85')](_0x5a69fa)&&_0x5a69fa!==null){if(typeof _0x5a69fa[_0x20f4('0x70')]!==_0x20f4('0xad')){if(_0x5a69fa['originated']>0x0){_0x5a69fa[_0x20f4('0x70')]-=0x1;}else{logger['error'](_0x20f4('0xd0'));}}}else{logger['error'](_0x20f4('0xd1'));}};Dialer[_0x20f4('0x1b')][_0x20f4('0xd2')]=function(_0x59f1d5,_0x47644d){var _0x609461=this;return function(_0x422f7f){_0x609461['updateOriginated'](_0x47644d);logger[_0x20f4('0x95')](_0x59f1d5,util['inspect'](_0x422f7f,{'showHidden':![],'depth':null}));};};Dialer['prototype']['emptyContact']=function(_0x381782,_0x71cf1f,_0x301a9b){var _0x542315={'state':0x19,'statedesc':_0x20f4('0xd3')};this[_0x20f4('0xb4')](_0x71cf1f);this[_0x20f4('0xd4')](_[_0x20f4('0x8e')](_0x542315,_[_0x20f4('0xd5')](_0x301a9b,[_0x20f4('0xd6'),'ListId',_0x20f4('0xd7'),_0x20f4('0xd8'),_0x20f4('0xd9')])),'[emptyContact][createHistory]',_0x20f4('0xda'));logger['error'](_0x381782);};Dialer[_0x20f4('0x1b')][_0x20f4('0xdb')]=function(_0x53d4f3){return _0x53d4f3===_0x20f4('0xdc');};Dialer['prototype'][_0x20f4('0xdd')]=function(_0x329ec0){return!_[_0x20f4('0x85')](_0x329ec0)&&_0x329ec0&&!_['isUndefined'](_0x329ec0['name'])&&!_[_0x20f4('0x85')](_0x329ec0[_0x20f4('0x74')])&&_0x329ec0['active']&&(this[_0x20f4('0xde')][util[_0x20f4('0x76')](_0x20f4('0xdf'),_0x329ec0['name'])][_0x20f4('0xb0')]===_0x20f4('0xe0')||this['trunks'][util['format'](_0x20f4('0xdf'),_0x329ec0[_0x20f4('0x40')])]['status']===_0x20f4('0xe1'));};Dialer['prototype'][_0x20f4('0xd4')]=function(_0x3f1c51,_0x296da4,_0x2d19c5){this[_0x20f4('0xcf')](_0x3f1c51)[_0x20f4('0xb2')](loggerCatch(_0x296da4));this['moveContactManagedDialer'](_0x3f1c51)[_0x20f4('0xb2')](loggerCatch(_0x2d19c5));};Dialer[_0x20f4('0x1b')]['syncVarSet']=function(_0x143f2d){var _0x4c74da=this[_0x20f4('0x25')][_0x143f2d[_0x20f4('0xe2')]];var _0x471cf7;if(!_[_0x20f4('0xaf')](_0x143f2d)&&!_[_0x20f4('0xaf')](_0x143f2d['variable'])&&!_[_0x20f4('0xaf')](_0x143f2d['variable']['amdstatus'])&&_0x143f2d[_0x20f4('0xe3')]==='xcally-motion-dialer'&&_0x4c74da){if(_0x4c74da['type']!==_0x20f4('0x79')&&this[_0x20f4('0x20')][_0x4c74da[_0x20f4('0xb5')]][_0x20f4('0xe4')]&&_0x143f2d[_0x20f4('0xe5')]===_0x20f4('0xe6')){delete this[_0x20f4('0x25')][_0x143f2d['uniqueid']];this[_0x20f4('0xb4')](this[_0x20f4('0x20')][_0x4c74da[_0x20f4('0xb5')]]);this[_0x20f4('0x20')][_0x4c74da['queue']][_0x20f4('0xe7')]+=0x1;this[_0x20f4('0x20')][_0x4c74da['queue']][_0x20f4('0x5e')]+=0x1;_0x471cf7=new Hangup(_0x4c74da,_0x143f2d);_0x471cf7[_0x20f4('0xa7')]=0x12;_0x471cf7['statedesc']=_0x20f4('0xe8');_0x471cf7['membername']=_0x20f4('0xe9');ami[_0x20f4('0x4c')](_0x20f4('0xea'),ut[_0x20f4('0xeb')](_0x471cf7,_0x20f4('0xec')));this['saveInDb'](_0x471cf7,'[syncHangupInAMD][createHistory]',_0x20f4('0xed'));}if(_0x4c74da[_0x20f4('0x55')]!==_0x20f4('0x79')&&this['voiceQueues'][_0x4c74da['queue']][_0x20f4('0xe4')]&&_0x143f2d[_0x20f4('0xe5')]===_0x20f4('0xee')){var _0x532fc0=this;return new BPromise(function(_0x565b7b,_0x453d9a){delete _0x532fc0[_0x20f4('0x25')][_0x143f2d[_0x20f4('0xe2')]];_0x532fc0[_0x20f4('0xb4')](_0x532fc0[_0x20f4('0x20')][_0x4c74da['queue']]);_0x532fc0[_0x20f4('0x20')][_0x4c74da[_0x20f4('0xb5')]][_0x20f4('0xe7')]+=0x1;_0x532fc0[_0x20f4('0x20')][_0x4c74da[_0x20f4('0xb5')]][_0x20f4('0x5e')]+=0x1;var _0x3c00e5=_0x532fc0[_0x20f4('0x20')][_0x4c74da[_0x20f4('0xb5')]];var _0x479592=new Hangup(_0x4c74da,_0x143f2d);_0x479592['state']=0x13;_0x479592['statedesc']=_0x20f4('0xef');_0x479592['membername']='AMD';_0x479592[_0x20f4('0xf0')]+=0x1;_0x479592[_0x20f4('0xf1')]+=0x1;_0x479592['amd']=!![];ami['emit'](_0x20f4('0xea'),ut['buildObj'](_0x479592,'amd'));_0x532fc0[_0x20f4('0xcf')](_0x479592)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0xf2')));if(_0x479592[_0x20f4('0xf3')]+_0x479592[_0x20f4('0xf4')]+_0x479592[_0x20f4('0xf5')]+_0x479592[_0x20f4('0xf6')]+_0x479592[_0x20f4('0xf7')]+_0x479592[_0x20f4('0xf8')]+_0x479592[_0x20f4('0xf0')]+_0x479592['countagentrejectretry']>=_0x3c00e5['dialGlobalMaxRetry']){_0x532fc0[_0x20f4('0xf9')](_0x479592,_0x565b7b,_0x453d9a,_0x20f4('0xfa'));}else{if(_0x479592['countmachineretry']>=_0x3c00e5[_0x20f4('0xfb')]){_0x532fc0[_0x20f4('0xfc')](_0x479592,_0x565b7b,_0x453d9a,_0x20f4('0xfd'));}else{_0x532fc0[_0x20f4('0xc3')]({'active':![],'countmachineretry':_0x479592[_0x20f4('0xf0')],'scheduledat':moment()[_0x20f4('0xfe')](_0x3c00e5[_0x20f4('0xff')],_0x20f4('0x100'))[_0x20f4('0x76')](_0x20f4('0x101')),'ContactId':_0x479592[_0x20f4('0xd6')],'ListId':_0x479592[_0x20f4('0x102')],'VoiceQueueId':_0x479592[_0x20f4('0xd8')]||undefined,'CampaignId':_0x479592[_0x20f4('0xd9')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x565b7b({'reschedule':0x1});}}});}if(_0x4c74da['type']==='ivr'&&this[_0x20f4('0x21')][_0x4c74da[_0x20f4('0xb5')]][_0x20f4('0xe4')]&&_0x143f2d[_0x20f4('0xe5')]===_0x20f4('0xe6')){delete this['uniqueId'][_0x143f2d[_0x20f4('0xe2')]];this[_0x20f4('0xb4')](this[_0x20f4('0x21')][_0x4c74da[_0x20f4('0xb5')]]);_0x471cf7=new Hangup(_0x4c74da,_0x143f2d);_0x471cf7['state']=0x12;_0x471cf7[_0x20f4('0x103')]=_0x20f4('0xe8');_0x471cf7[_0x20f4('0x104')]=_0x20f4('0xe9');ami[_0x20f4('0x4c')]('custom:amd',ut['buildObj'](_0x471cf7,_0x20f4('0xec')));this[_0x20f4('0xd4')](_0x471cf7,'[syncHangupInAMDIvr][createHistory]',_0x20f4('0x105'));}if(_0x4c74da[_0x20f4('0x55')]===_0x20f4('0x79')&&this['campaigns'][_0x4c74da[_0x20f4('0xb5')]][_0x20f4('0xe4')]&&_0x143f2d['value']==='MACHINE'){var _0x532fc0=this;return new BPromise(function(_0x3c869f,_0x312250){delete _0x532fc0['uniqueId'][_0x143f2d[_0x20f4('0xe2')]];_0x532fc0['updateOriginated'](_0x532fc0['campaigns'][_0x4c74da[_0x20f4('0xb5')]]);_0x532fc0[_0x20f4('0x21')][_0x4c74da[_0x20f4('0xb5')]]['outboundAnswerCallsDay']+=0x1;_0x532fc0[_0x20f4('0x21')][_0x4c74da['queue']][_0x20f4('0x5e')]+=0x1;var _0x4b72fd=_0x532fc0[_0x20f4('0x21')][_0x4c74da[_0x20f4('0xb5')]];var _0x6a0dd2=new Hangup(_0x4c74da,_0x143f2d);_0x6a0dd2[_0x20f4('0xa7')]=0x13;_0x6a0dd2[_0x20f4('0x103')]='Machine';_0x6a0dd2[_0x20f4('0x104')]=_0x20f4('0xe9');_0x6a0dd2[_0x20f4('0xf0')]+=0x1;_0x6a0dd2[_0x20f4('0xf1')]+=0x1;_0x6a0dd2[_0x20f4('0xec')]=!![];ami[_0x20f4('0x4c')](_0x20f4('0xea'),ut['buildObj'](_0x6a0dd2,_0x20f4('0xec')));_0x532fc0['createHistory'](_0x6a0dd2)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0xf2')));if(_0x6a0dd2[_0x20f4('0xf3')]+_0x6a0dd2['countcongestionretry']+_0x6a0dd2['countnoanswerretry']+_0x6a0dd2[_0x20f4('0xf6')]+_0x6a0dd2[_0x20f4('0xf7')]+_0x6a0dd2[_0x20f4('0xf8')]+_0x6a0dd2['countmachineretry']+_0x6a0dd2['countagentrejectretry']>=_0x4b72fd['dialGlobalMaxRetry']){_0x532fc0[_0x20f4('0xf9')](_0x6a0dd2,_0x3c869f,_0x312250,_0x20f4('0xfa'));}else{if(_0x6a0dd2['countmachineretry']>=_0x4b72fd['dialMachineMaxRetry']){_0x532fc0[_0x20f4('0xfc')](_0x6a0dd2,_0x3c869f,_0x312250,_0x20f4('0xfd'));}else{_0x532fc0['rescheduleContact']({'active':![],'countmachineretry':_0x6a0dd2[_0x20f4('0xf0')],'scheduledat':moment()['add'](_0x4b72fd[_0x20f4('0xff')],'minutes')[_0x20f4('0x76')](_0x20f4('0x101')),'ContactId':_0x6a0dd2[_0x20f4('0xd6')],'ListId':_0x6a0dd2[_0x20f4('0x102')],'VoiceQueueId':_0x6a0dd2[_0x20f4('0xd8')]||undefined,'CampaignId':_0x6a0dd2[_0x20f4('0xd9')]||undefined})[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x106')));_0x3c869f({'reschedule':0x1});}}});}}};Dialer[_0x20f4('0x1b')][_0x20f4('0x33')]=function(_0x5a7ec1){var _0x2c4813=this[_0x20f4('0x25')][_0x5a7ec1[_0x20f4('0xe2')]];var _0x232709=this;var _0x2ea15b;if(_0x2c4813&&_0x2c4813[_0x20f4('0x55')]===_0x20f4('0x79')){delete this[_0x20f4('0x25')][_0x5a7ec1[_0x20f4('0xe2')]];this[_0x20f4('0xb4')](this[_0x20f4('0x21')][_0x2c4813['queue']]);this[_0x20f4('0x21')][_0x2c4813[_0x20f4('0xb5')]][_0x20f4('0x107')]+=0x1;_0x2ea15b=new Hangup(_0x2c4813,_0x5a7ec1);this[_0x20f4('0xcf')](_0x2ea15b)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x20f4('0xcd')](_0x2ea15b)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x108')));}if(_0x2c4813&&_0x2c4813[_0x20f4('0x55')]!==_0x20f4('0x79')&&isNotNull(this[_0x20f4('0x20')][_0x2c4813[_0x20f4('0xb5')]][_0x20f4('0x109')])){delete this['uniqueId'][_0x5a7ec1[_0x20f4('0xe2')]];this[_0x20f4('0xb4')](this['voiceQueues'][_0x2c4813[_0x20f4('0xb5')]]);this['voiceQueues'][_0x2c4813[_0x20f4('0xb5')]][_0x20f4('0xe7')]+=0x1;this[_0x20f4('0x20')][_0x2c4813[_0x20f4('0xb5')]][_0x20f4('0x5e')]+=0x1;_0x2ea15b=new Hangup(_0x2c4813,_0x5a7ec1);_0x2ea15b['state']=0x10;_0x2ea15b[_0x20f4('0x103')]=_0x20f4('0x10a');_0x2ea15b[_0x20f4('0x104')]='AGI';this[_0x20f4('0xcf')](_0x2ea15b)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x20f4('0xcd')](_0x2ea15b)[_0x20f4('0xb2')](loggerCatch('[syncHangupIvr]'));}if(_0x2c4813&&_0x2c4813[_0x20f4('0x55')]!=='ivr'&&!isNotNull(this[_0x20f4('0x20')][_0x2c4813['queue']][_0x20f4('0x109')])){delete this[_0x20f4('0x25')][_0x5a7ec1['uniqueid']];this[_0x20f4('0xb4')](this[_0x20f4('0x20')][_0x2c4813['queue']]);this['voiceQueues'][_0x2c4813[_0x20f4('0xb5')]]['outboundUnknownCallsDay']+=0x1;_0x2ea15b=new Hangup(_0x2c4813,_0x5a7ec1);_0x2ea15b[_0x20f4('0xa7')]=0xc;_0x2ea15b['statedesc']=_0x5a7ec1[_0x20f4('0x10b')];_0x2ea15b[_0x20f4('0x104')]=_0x20f4('0x10c');this[_0x20f4('0xcf')](_0x2ea15b)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x10d')));this[_0x20f4('0xcd')](_0x2ea15b)['catch'](loggerCatch(_0x20f4('0x108')));}};Dialer[_0x20f4('0x1b')][_0x20f4('0x31')]=function(_0x51b64c){var _0x178cc5=this[_0x20f4('0x25')][_0x51b64c[_0x20f4('0xe2')]];var _0x457d57=this;if(this[_0x20f4('0x20')][_0x51b64c[_0x20f4('0xb5')]]){if(_0x178cc5&&_0x178cc5[_0x20f4('0x55')]!==_0x20f4('0x79')){delete this[_0x20f4('0x25')][_0x51b64c['uniqueid']];this[_0x20f4('0x20')][_0x51b64c[_0x20f4('0xb5')]][_0x20f4('0xe7')]+=0x1;var _0x583934=new AgentComplete(_0x178cc5,_0x51b64c);if(_0x51b64c[_0x20f4('0x10e')]===_0x20f4('0x10f')){_0x583934[_0x20f4('0x110')]=this[_0x20f4('0x20')][_0x51b64c['queue']]['dialQueueProject2']&&this[_0x20f4('0x20')][_0x51b64c[_0x20f4('0xb5')]]['dialAgiAfterHangupAgent']?moment()[_0x20f4('0x76')](_0x20f4('0x101')):undefined;}this['createHistory'](_0x583934)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x111')));this['moveContactManagedDialer'](_0x583934)['catch'](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0x20f4('0x1b')][_0x20f4('0x2c')]=function(_0x243d04){if(this['voiceQueues'][_0x243d04[_0x20f4('0xb5')]]){if(this[_0x20f4('0x25')][_0x243d04[_0x20f4('0xe2')]]&&this[_0x20f4('0x25')][_0x243d04['uniqueid']][_0x20f4('0x55')]!==_0x20f4('0x79')){this['updateOriginated'](this[_0x20f4('0x20')][_0x243d04[_0x20f4('0xb5')]]);this[_0x20f4('0x25')][_0x243d04[_0x20f4('0xe2')]][_0x20f4('0x112')]=moment()[_0x20f4('0x76')](_0x20f4('0x101'));}}};Dialer['prototype'][_0x20f4('0x113')]=function(_0x49c8dc,_0x4e4169){this['createHistory'](_0x49c8dc)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x111')));if(_0x4e4169==0x0){this[_0x20f4('0xcd')](_0x49c8dc)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x114')));}};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x15bbdd){var _0x215b2e=this[_0x20f4('0x25')][_0x15bbdd['uniqueid']];var _0x514e9a=this;var _0x1ad9c5=![];var _0x38d786;var _0x22b4b2;if(this[_0x20f4('0x20')][_0x15bbdd[_0x20f4('0xb5')]]){if(_0x215b2e&&_0x215b2e[_0x20f4('0x55')]!==_0x20f4('0x79')){delete this[_0x20f4('0x25')][_0x15bbdd[_0x20f4('0xe2')]];this['updateOriginated'](this['voiceQueues'][_0x15bbdd['queue']]);_0x215b2e[_0x20f4('0x115')]=moment()[_0x20f4('0x76')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4a9ece=new QueueCallerAbandon(_0x215b2e,_0x15bbdd);if(getSeconds(_0x215b2e[_0x20f4('0x115')],_0x215b2e[_0x20f4('0x116')])>=_0x215b2e['dialQueueTimeout']){this['voiceQueues'][_0x15bbdd['queue']]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x20f4('0x20')][_0x15bbdd[_0x20f4('0xb5')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x20f4('0x20')][_0x15bbdd['queue']][_0x20f4('0x6c')]+=0x1;_0x4a9ece[_0x20f4('0xa7')]=0xa;_0x4a9ece[_0x20f4('0x103')]='Drop';_0x4a9ece[_0x20f4('0x117')]=_0x20f4('0x118');_0x4a9ece[_0x20f4('0x110')]=this[_0x20f4('0x20')][_0x15bbdd['queue']][_0x20f4('0x119')]?moment()[_0x20f4('0x76')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x4a9ece[_0x20f4('0xf7')]+=0x1;_0x4a9ece[_0x20f4('0xf1')]+=0x1;_0x38d786=this['voiceQueues'][_0x15bbdd[_0x20f4('0xb5')]][_0x20f4('0x11a')];_0x22b4b2=this[_0x20f4('0x20')][_0x15bbdd[_0x20f4('0xb5')]][_0x20f4('0x11b')];_0x514e9a['verifyAdditionalPhones'](_0x4a9ece,_0x4a9ece['state'],_0x215b2e['voiceQueue'])[_0x20f4('0xb9')](function(_0x22fce2){_0x1ad9c5=_0x22fce2[_0x20f4('0x11c')]==0x1;if(_0x4a9ece[_0x20f4('0xf7')]>=_0x514e9a[_0x20f4('0x20')][_0x15bbdd[_0x20f4('0xb5')]]['dialDropMaxRetry']){_0x514e9a[_0x20f4('0x113')](_0x4a9ece,_0x22fce2[_0x20f4('0x11c')]);}else{_0x514e9a[_0x20f4('0xc3')]({'active':![],'countdropretry':_0x4a9ece['countdropretry'],'scheduledat':moment()['add'](_0x514e9a[_0x20f4('0x20')][_0x15bbdd[_0x20f4('0xb5')]][_0x20f4('0x11a')],'minutes')[_0x20f4('0x76')](_0x20f4('0x101')),'ContactId':_0x215b2e[_0x20f4('0xd6')],'ListId':_0x215b2e['ListId'],'VoiceQueueId':_0x215b2e[_0x20f4('0xd8')]||undefined,'CampaignId':_0x215b2e[_0x20f4('0xd9')]||undefined})[_0x20f4('0xb2')](loggerCatch('[rescheduleContact][Drop]'));var _0x224b09=new History(_0x4a9ece);_0x224b09[_0x20f4('0xa7')]=0xa;_0x224b09[_0x20f4('0x103')]=_0x20f4('0x11d');_0x224b09[_0x20f4('0xa9')]=moment()[_0x20f4('0x76')](_0x20f4('0x101'));_0x224b09[_0x20f4('0xa8')]=_0x224b09[_0x20f4('0xa9')];_0x224b09[_0x20f4('0x11e')]=_0x4a9ece['calleridname'];_0x224b09[_0x20f4('0x11f')]=_0x4a9ece['calleridnum'];_0x514e9a[_0x20f4('0xcf')](_0x224b09)['catch'](loggerCatch(_0x20f4('0x120')));}})[_0x20f4('0xb9')](function(_0x166224){if(_0x1ad9c5)_0x514e9a['swapAdditionalPhones'](_0x4a9ece,_0x38d786,_0x22b4b2)['then'](function(_0x1f3bfc){return 0x1;});});}else{this[_0x20f4('0x20')][_0x15bbdd[_0x20f4('0xb5')]][_0x20f4('0x69')]+=0x1;this[_0x20f4('0x20')][_0x15bbdd[_0x20f4('0xb5')]][_0x20f4('0x121')]+=0x1;_0x4a9ece[_0x20f4('0xa7')]=0xb;_0x4a9ece[_0x20f4('0x103')]='Abandoned';_0x4a9ece[_0x20f4('0x117')]=_0x20f4('0x122');_0x4a9ece[_0x20f4('0xf8')]+=0x1;_0x4a9ece[_0x20f4('0xf1')]+=0x1;_0x38d786=this[_0x20f4('0x20')][_0x15bbdd['queue']]['dialAbandonedRetryFrequency'];_0x22b4b2=this[_0x20f4('0x20')][_0x15bbdd[_0x20f4('0xb5')]][_0x20f4('0x11b')];_0x514e9a[_0x20f4('0xbe')](_0x4a9ece,_0x4a9ece[_0x20f4('0xa7')],_0x215b2e[_0x20f4('0x123')])['then'](function(_0x1a3084){if(_0x4a9ece[_0x20f4('0xf8')]>=_0x514e9a[_0x20f4('0x20')][_0x15bbdd[_0x20f4('0xb5')]]['dialAbandonedMaxRetry']){_0x514e9a[_0x20f4('0x113')](_0x4a9ece,_0x1a3084[_0x20f4('0x11c')]);}else{_0x514e9a[_0x20f4('0xc3')]({'active':![],'countabandonedretry':_0x4a9ece[_0x20f4('0xf8')],'scheduledat':moment()[_0x20f4('0xfe')](_0x514e9a['voiceQueues'][_0x15bbdd[_0x20f4('0xb5')]][_0x20f4('0x124')],'minutes')['format'](_0x20f4('0x101')),'ContactId':_0x215b2e[_0x20f4('0xd6')],'ListId':_0x215b2e[_0x20f4('0x102')],'VoiceQueueId':_0x215b2e[_0x20f4('0xd8')]||undefined,'CampaignId':_0x215b2e['CampaignId']||undefined})[_0x20f4('0xb2')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x7fca2c=new History(_0x4a9ece);_0x7fca2c[_0x20f4('0xa7')]=0xb;_0x7fca2c[_0x20f4('0x103')]=_0x20f4('0x125');_0x7fca2c[_0x20f4('0xa9')]=moment()[_0x20f4('0x76')](_0x20f4('0x101'));_0x7fca2c[_0x20f4('0xa8')]=_0x7fca2c[_0x20f4('0xa9')];_0x7fca2c['calleridname']=_0x4a9ece[_0x20f4('0x11e')];_0x7fca2c[_0x20f4('0x11f')]=_0x4a9ece[_0x20f4('0x11f')];_0x514e9a[_0x20f4('0xcf')](_0x7fca2c)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x126')));}})[_0x20f4('0xb9')](function(_0x32c996){if(_0x1ad9c5)_0x514e9a['swapAdditionalPhones'](_0x4a9ece,_0x38d786,_0x22b4b2)[_0x20f4('0xb9')](function(_0x295e38){return 0x1;});});}}}};Dialer[_0x20f4('0x1b')]['syncNewExten']=function(_0x116d3a){if(this['actions'][_0x116d3a[_0x20f4('0xe2')]]){this[_0x20f4('0x24')][_0x116d3a['uniqueid']]['channel']=_0x116d3a[_0x20f4('0xb1')];}if(this[_0x20f4('0x25')][_0x116d3a[_0x20f4('0xe2')]]){this[_0x20f4('0x25')][_0x116d3a[_0x20f4('0xe2')]][_0x20f4('0xb1')]=_0x116d3a[_0x20f4('0xb1')];}};Dialer[_0x20f4('0x1b')][_0x20f4('0x39')]=function(_0xb7e82b){if(strategy[this[_0x20f4('0x20')][this[_0x20f4('0x24')][_0xb7e82b[_0x20f4('0x127')]][_0x20f4('0xb5')]][_0x20f4('0x4e')]]==='roundrobin'){if(this[_0x20f4('0x24')][_0xb7e82b['actionid']]&&_[_0x20f4('0xaf')](this['actions'][_0xb7e82b[_0x20f4('0x127')]][_0x20f4('0x128')])&&_0xb7e82b[_0x20f4('0xb0')]==='1'&&_0xb7e82b[_0x20f4('0x129')]==='0'){if(this[_0x20f4('0x22')][_0xb7e82b[_0x20f4('0x12a')]]){if(!this[_0x20f4('0x22')][_0xb7e82b[_0x20f4('0x12a')]][_0x20f4('0x128')]){this[_0x20f4('0x22')][_0xb7e82b[_0x20f4('0x12a')]][_0x20f4('0x128')]=!![];this[_0x20f4('0x24')][_0xb7e82b['actionid']]['locked']=!![];this[_0x20f4('0x24')][_0xb7e82b[_0x20f4('0x127')]]['stateinterface']=_0xb7e82b['stateinterface'];}}}}else if((strategy[this[_0x20f4('0x20')][this[_0x20f4('0x24')][_0xb7e82b[_0x20f4('0x127')]][_0x20f4('0xb5')]][_0x20f4('0x4e')]]||_0x20f4('0x19'))==='rrmemory'){if(this[_0x20f4('0x24')][_0xb7e82b[_0x20f4('0x127')]]){if(this['agents'][_0xb7e82b[_0x20f4('0x12a')]]){this['actions'][_0xb7e82b[_0x20f4('0x127')]]['stateinterface']=_0xb7e82b[_0x20f4('0x12a')];if(_[_0x20f4('0xaf')](this[_0x20f4('0x2a')][this['actions'][_0xb7e82b['actionid']][_0x20f4('0xb5')]])){this[_0x20f4('0x2a')][this[_0x20f4('0x24')][_0xb7e82b['actionid']]['queue']]=[];}this[_0x20f4('0x2a')][this[_0x20f4('0x24')][_0xb7e82b[_0x20f4('0x127')]][_0x20f4('0xb5')]]['push'](_['merge'](_[_0x20f4('0xd5')](this[_0x20f4('0x24')][_0xb7e82b[_0x20f4('0x127')]],['idHopper',_0x20f4('0x12a')]),{'status':_0xb7e82b[_0x20f4('0xb0')],'paused':_0xb7e82b[_0x20f4('0x129')]}));}}}};function unlockQueueStatus(_0x17ed0b,_0xd4ae61){setTimeout(function(){if(_[_0x20f4('0x85')](_0x17ed0b[_0x20f4('0x12b')])){loggerBooked[_0x20f4('0x95')](_0x20f4('0x12c'),_0xd4ae61);}_0x17ed0b[_0x20f4('0x12b')]=!![];loggerBooked[_0x20f4('0x7c')](_0x20f4('0x12d'),_0xd4ae61,JSON[_0x20f4('0x48')](_[_0x20f4('0xd5')](_0x17ed0b,[_0x20f4('0x40'),_0x20f4('0x12b')])));},0x1f3);}Dialer[_0x20f4('0x1b')][_0x20f4('0x3b')]=function(_0x130f82){var _0x56ef08=this;var _0x317702=_0x56ef08[_0x20f4('0x20')][_0x56ef08['actions'][_0x130f82[_0x20f4('0x127')]]['queue']];if(strategy[this[_0x20f4('0x20')][this[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]]['queue']]['strategy']]===_0x20f4('0x1a')){if(this[_0x20f4('0x24')][_0x130f82['actionid']]&&this[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]][_0x20f4('0x12a')]){this[_0x20f4('0x1f')][_0x20f4('0x12e')](this['actions'][_0x130f82[_0x20f4('0x127')]][_0x20f4('0x12f')],this[_0x20f4('0x24')][_0x130f82['actionid']][_0x20f4('0x12a')])[_0x20f4('0xb2')](function(_0x59a97f){logger['error']('[Catch][Preview][syncQueueStatusComplete]',util[_0x20f4('0x97')](_0x59a97f,{'showHidden':![],'depth':null}));})[_0x20f4('0x1e')](function(){_0x56ef08[_0x20f4('0xb4')](_0x56ef08[_0x20f4('0x20')][_0x56ef08[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]][_0x20f4('0xb5')]]);_0x56ef08['agents'][_0x56ef08[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]][_0x20f4('0x12a')]][_0x20f4('0x128')]=![];delete _0x56ef08['actions'][_0x130f82[_0x20f4('0x127')]];unlockQueueStatus(_0x317702);});}else{this[_0x20f4('0xb4')](this[_0x20f4('0x20')][this['actions'][_0x130f82[_0x20f4('0x127')]][_0x20f4('0xb5')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]][_0x20f4('0xd6')],'ListId':this[_0x20f4('0x24')][_0x130f82['actionid']][_0x20f4('0x102')],'VoiceQueueId':this[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]][_0x20f4('0xd8')]||undefined,'CampaignId':this[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]]['CampaignId']||undefined})[_0x20f4('0xb2')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x20f4('0x24')][_0x130f82['actionid']];unlockQueueStatus(_0x317702);}}else if((strategy[this[_0x20f4('0x20')][this[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]][_0x20f4('0xb5')]]['strategy']]||_0x20f4('0x19'))===_0x20f4('0x19')){var _0x389e36;if(this[_0x20f4('0x24')][_0x130f82['actionid']]&&!_[_0x20f4('0x47')](this[_0x20f4('0x2a')][this['actions'][_0x130f82[_0x20f4('0x127')]][_0x20f4('0xb5')]])){if(this['queueBookedRR'][_0x56ef08[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]][_0x20f4('0xb5')]]){this[_0x20f4('0x130')][_0x56ef08[_0x20f4('0x24')][_0x130f82['actionid']][_0x20f4('0xb5')]]=this['queueBookedRR'][this[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]]['queue']]?this[_0x20f4('0x130')][this[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]][_0x20f4('0xb5')]]:this[_0x20f4('0x2a')][this[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]][_0x20f4('0xb5')]]?this[_0x20f4('0x2a')][this[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]]['queue']][_0x20f4('0x131')]||0x0:0x0;}this[_0x20f4('0x2a')][this[_0x20f4('0x24')][_0x130f82[_0x20f4('0x127')]][_0x20f4('0xb5')]][_0x20f4('0x131')]=this['queueBookedRR'][this[_0x20f4('0x24')][_0x130f82['actionid']][_0x20f4('0xb5')]];for(var _0x43c2fb=0x0;_0x43c2fb=0x0;})[_0x20f4('0xb2')](myreject(_0x4bd7a6)));}}else{_0x3d309a[_0x20f4('0x14a')](ami[_0x20f4('0x14b')]({'action':_0x20f4('0x14c'),'command':util[_0x20f4('0x76')](_0x20f4('0x14d'),_0x594437,!_['isUndefined'](config[_0x20f4('0x146')][_0x269c79])?_0x269c79:'')})[_0x20f4('0xb9')](function(_0x3703b6){return _0x3703b6[_0x20f4('0x14f')][_0x20f4('0x150')](_0x20f4('0x151'))>=0x0;})['catch'](myreject(_0x4bd7a6)));}BPromise[_0x20f4('0x152')](_0x3d309a)[_0x20f4('0xb9')](function(_0x1269d2){var _0x5da52e=_['some'](_0x1269d2);if(_0x5da52e){return _0x20ddd9(_0x5da52e);}else{_0x4fc80a[_0x20f4('0x3e')]=_0x72d55a?_0x20f4('0x153'):_0x20f4('0x154');return _0x4bd7a6(msgResponse(_0x20f4('0x155'),_0x20f4('0x144'),_0x20f4('0x156')+_0x72d55a+'\x20'+_0x1dfc60+'\x20Interval\x20is\x20overtime:\x20'+util[_0x20f4('0x97')](_0x594437,{'showHidden':![],'depth':null})+_0x20f4('0x157')+_0x269c79));}})[_0x20f4('0xb2')](function(_0xdb00dd){return _0x4bd7a6(msgResponse(_0x20f4('0x140'),_0x20f4('0x144'),JSON[_0x20f4('0x48')](_0xdb00dd)));});});};Dialer['prototype'][_0x20f4('0x158')]=function(_0x48049f){var _0x50c16f=this;return function(){switch(_0x48049f[_0x20f4('0x5a')]){case _0x20f4('0x159'):freeVariablesPredictive(_0x48049f);_0x50c16f[_0x20f4('0x15a')](_0x48049f,0x1);break;case _0x20f4('0x15b'):freeVariablesPredictive(_0x48049f);_0x50c16f[_0x20f4('0x15a')](_0x48049f,_0x48049f[_0x20f4('0x15c')]);break;case'predictive':_0x50c16f[_0x20f4('0x8')](_0x48049f);break;case _0x20f4('0x15d'):freeVariablesPredictive(_0x48049f);_0x50c16f['handlePower'](_0x48049f,0x1);break;default:freeVariablesPredictive(_0x48049f);logger[_0x20f4('0x95')](_0x20f4('0x15e'),_0x48049f[_0x20f4('0x40')],_0x20f4('0x15f'));}};};Dialer[_0x20f4('0x1b')]['launchHandleIvr']=function(_0x5725f3){var _0x497967=this;return function(){_0x497967[_0x20f4('0x160')](_0x5725f3);};};Dialer[_0x20f4('0x1b')]['syncQueueSummary']=function(_0x4a9cdd){var _0x764b51=this;if(isNotPreview(_0x4a9cdd[_0x20f4('0x5a')])){if(isVoiceQueueOutbound(_0x4a9cdd[_0x20f4('0x55')])&&isActive(_0x4a9cdd['dialActive'])){_0x4a9cdd[_0x20f4('0xa5')]=!![];BPromise[_0x20f4('0xbc')]()[_0x20f4('0xb9')](checkIsLoggedIn(_0x4a9cdd,_0x4a9cdd[_0x20f4('0x50')]))[_0x20f4('0xb9')](checkIsActive(_0x4a9cdd,_0x4a9cdd[_0x20f4('0x59')]))['then'](checkInterval(_0x4a9cdd))[_0x20f4('0xb9')](_0x764b51[_0x20f4('0x161')](_0x4a9cdd))['then'](_0x764b51[_0x20f4('0x13f')](_0x4a9cdd[_0x20f4('0x162')],_0x4a9cdd['dialTimezone'],_0x4a9cdd['name'],_0x4a9cdd))[_0x20f4('0xb9')](_0x764b51[_0x20f4('0x141')](_0x4a9cdd[_0x20f4('0x43')],_0x4a9cdd['dialTimezone'],_0x4a9cdd[_0x20f4('0x40')],_0x4a9cdd))[_0x20f4('0xb9')](_0x764b51[_0x20f4('0x158')](_0x4a9cdd))[_0x20f4('0xb2')](loggerCatchQueueSummary('[syncQueueSummary]',_0x4a9cdd));}else{notSendMessagesQueue(_0x4a9cdd);}}else{freeVariablesPredictive(_0x4a9cdd);}};Dialer[_0x20f4('0x1b')][_0x20f4('0x163')]=function(){var _0x5ad8bd=this;var _0x38275d;for(var _0x23c816 in this[_0x20f4('0x21')]){if(typeof this[_0x20f4('0x21')][_0x23c816]!==_0x20f4('0xad')){_0x38275d=this[_0x20f4('0x21')][_0x23c816];if(isCampaignIvr(_0x38275d[_0x20f4('0x55')])&&isActive(_0x38275d['active'])){_0x38275d['sendMessageOneNotActive']=!![];BPromise[_0x20f4('0xbc')]()[_0x20f4('0xb9')](checkIsActive(_0x38275d,_0x38275d[_0x20f4('0x74')]))[_0x20f4('0xb9')](checkInterval(_0x38275d))[_0x20f4('0xb9')](_0x5ad8bd['checkIsTrunkReachable'](_0x38275d))[_0x20f4('0xb9')](_0x5ad8bd[_0x20f4('0x13f')](_0x38275d[_0x20f4('0x162')],_0x38275d[_0x20f4('0x164')],_0x38275d[_0x20f4('0x40')],_0x38275d))[_0x20f4('0xb9')](_0x5ad8bd['checkIfTimeIntervals'](_0x38275d[_0x20f4('0x43')],_0x38275d[_0x20f4('0x164')],_0x38275d[_0x20f4('0x40')],_0x38275d))[_0x20f4('0xb9')](_0x5ad8bd['launchHandleIvr'](_0x38275d))[_0x20f4('0xb2')](loggerCatchQueueSummary('[syncCampaigns]',_0x38275d));}else{notSendMessagesCampaign(_0x38275d);}}}};function getCallerIdRandom(_0x19cd67,_0x2b780b){var _0x499c9a;var _0x59cd47;var _0x58386f;if(_0x2b780b<=0x0){_0x2b780b=0x1;}_0x499c9a=new RegExp(_0x20f4('0x165')+_0x2b780b+'}$');_0x59cd47=Math[_0x20f4('0x166')](0xa,_0x2b780b-0x1);_0x58386f=Math[_0x20f4('0x166')](0xa,_0x2b780b)-0x1;return util['format']('%s',_[_0x20f4('0x167')](_0x19cd67,_0x499c9a,_[_0x20f4('0x168')](_0x59cd47,_0x58386f)));}function extractCalleridName(_0x4f3b71){var _0x57b778=_0x4f3b71[_0x20f4('0x169')](/"(.*?)"/);return _0x57b778?_0x57b778[0x1]:_0x4f3b71;}function extractCalleridNumber(_0x4ac020){var _0x246ead=_0x4ac020['match'](/<(.*?)>/);return _0x246ead?_0x246ead[0x1]:_0x4ac020;}Dialer[_0x20f4('0x1b')]['actionOriginate']=function(_0x46dd37,_0x2cfa6c){var _0x319e89=this;var _0x4e2a06=uuid['v4']();this[_0x20f4('0x24')][_0x4e2a06]=new Action(_0x46dd37,_0x2cfa6c,_0x4e2a06);return new BPromise(function(_0x5ae808,_0x2ff425){if(_['isUndefined'](_0x46dd37)&&typeof _0x46dd37!==_0x20f4('0x16a')){return _0x2ff425(msgResponse(_0x20f4('0x16b'),_0x20f4('0x144'),_0x20f4('0x16c')));}if(_[_0x20f4('0x85')](_0x2cfa6c['phone'])||_0x2cfa6c[_0x20f4('0x16d')]===null){return _0x2ff425(msgResponse('originate',_0x20f4('0x144'),_0x20f4('0x16e')));}var _0x54bfc3={'XMD-CALLERID':_0x319e89[_0x20f4('0x24')][_0x4e2a06]['getCaller'](),'XMD-AGI':_0x46dd37[_0x20f4('0x109')]?util['format'](_0x20f4('0x16f'),ipAgi,_0x46dd37['dialQueueProject']):_0x20f4('0x170'),'XMD-AGIAFTER':_0x46dd37[_0x20f4('0x119')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x46dd37[_0x20f4('0x119')]):_0x20f4('0x170'),'XMD-QUEUE':_0x46dd37['type']==='outbound'?util[_0x20f4('0x76')](_0x20f4('0x171'),_0x46dd37[_0x20f4('0x40')],_0x46dd37[_0x20f4('0x172')]||'',_0x46dd37[_0x20f4('0x173')]?'c':'',_0x46dd37[_0x20f4('0x174')]||0x3):_0x20f4('0x170'),'XMD-CONTACTID':_0x2cfa6c['ContactId'],'XMD-CDRTYPE':_0x20f4('0x7'),'CALLERID(all)':_0x319e89[_0x20f4('0x24')][_0x4e2a06][_0x20f4('0x175')](),'XMD-AMD':_0x46dd37[_0x20f4('0xe4')]?'ACTIVE':_0x20f4('0x170'),'XMD-DESTINATION':_0x20f4('0x176')};if(_0x46dd37[_0x20f4('0xe4')]){_0x54bfc3['XMD-AMDINITIALSILENCE']=_0x46dd37[_0x20f4('0x177')]||0x9c4;_0x54bfc3[_0x20f4('0x178')]=_0x46dd37[_0x20f4('0x179')]||0x5dc;_0x54bfc3[_0x20f4('0x17a')]=_0x46dd37[_0x20f4('0x17b')]||0x320;_0x54bfc3['XMD-AMDTOTALANALYSISTIME']=_0x46dd37['dialAMDTotalAnalysisTime']||0x1388;_0x54bfc3[_0x20f4('0x17c')]=_0x46dd37[_0x20f4('0x17d')]||0x64;_0x54bfc3[_0x20f4('0x17e')]=_0x46dd37[_0x20f4('0x17f')]||0x32;_0x54bfc3['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x46dd37[_0x20f4('0x180')]||0x3;_0x54bfc3['XMD-AMDSILENCETHRESHOLD']=_0x46dd37[_0x20f4('0x181')]||0x100;_0x54bfc3[_0x20f4('0x182')]=_0x46dd37[_0x20f4('0x183')]||0x1388;}if(_0x46dd37['type']==='outbound'){_0x54bfc3[_0x20f4('0x184')]=_0x2cfa6c[_0x20f4('0xd8')];}else{_0x54bfc3['XMD-CAMPAIGNID']=_0x2cfa6c['CampaignId'];}for(var _0x1091e3 in _0x2cfa6c[_0x20f4('0x185')]){if(typeof _0x2cfa6c[_0x20f4('0x185')][_0x1091e3]!=='undefined'){if(isNotNull(_0x2cfa6c[_0x20f4('0x185')][_0x1091e3])&&_0x1091e3!=='id'&&_0x1091e3!==_0x20f4('0x186')&&_0x1091e3!=='createdAt'&&_0x1091e3!==_0x20f4('0x187')){_0x54bfc3[util[_0x20f4('0x76')](_0x20f4('0x188'),_0x20f4('0x189'),_[_0x20f4('0x18a')](_0x1091e3))]=_0x2cfa6c['Contact'][_0x1091e3];}}}var _0x31ceb8=_0x319e89[_0x20f4('0xdd')](_0x46dd37[_0x20f4('0x73')])?getCallerId(_0x46dd37[_0x20f4('0x73')][_0x20f4('0x75')],_0x46dd37[_0x20f4('0x5b')],_0x46dd37['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x46dd37[_0x20f4('0x18b')],_0x46dd37[_0x20f4('0x18c')]):_0x46dd37[_0x20f4('0x18b')]):getCallerId(_[_0x20f4('0xaf')](_0x46dd37[_0x20f4('0x13d')])?_0x46dd37[_0x20f4('0x73')][_0x20f4('0x75')]:_0x46dd37[_0x20f4('0x13d')][_0x20f4('0x75')],_0x46dd37[_0x20f4('0x5b')],_0x46dd37['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x46dd37['dialOriginateCallerIdNumber'],_0x46dd37[_0x20f4('0x18c')]):_0x46dd37['dialOriginateCallerIdNumber']);if(_0x31ceb8){_0x54bfc3[_0x20f4('0x18d')]=_0x319e89[_0x20f4('0x24')][_0x4e2a06][_0x20f4('0x18e')]=extractCalleridName(_0x31ceb8);_0x54bfc3['XMD-ORIGINATECALLERIDNUM']=_0x2cfa6c[_0x20f4('0x16d')];}return ami[_0x20f4('0x14b')]({'actionid':_0x4e2a06,'action':_0x20f4('0x16b'),'channel':_0x319e89[_0x20f4('0xdd')](_0x46dd37[_0x20f4('0x73')])?util[_0x20f4('0x76')]('SIP/%s/%s%s',_0x46dd37[_0x20f4('0x73')][_0x20f4('0x40')],isNotNull(_0x46dd37[_0x20f4('0x5d')])?_0x46dd37[_0x20f4('0x5d')]['trim']()||'':'',_0x46dd37[_0x20f4('0x18f')]>0x0?_0x2cfa6c[_0x20f4('0x16d')][_0x20f4('0x190')](_0x46dd37[_0x20f4('0x18f')]):_0x2cfa6c[_0x20f4('0x16d')]):util[_0x20f4('0x76')](_0x20f4('0x191'),_[_0x20f4('0xaf')](_0x46dd37[_0x20f4('0x13d')])?_0x46dd37[_0x20f4('0x73')][_0x20f4('0x40')]:_0x46dd37['TrunkBackup']['name'],isNotNull(_0x46dd37[_0x20f4('0x5d')])?_0x46dd37[_0x20f4('0x5d')][_0x20f4('0x192')]()||'':'',_0x46dd37[_0x20f4('0x18f')]>0x0?_0x2cfa6c[_0x20f4('0x16d')][_0x20f4('0x190')](_0x46dd37['dialCutDigit']):_0x2cfa6c[_0x20f4('0x16d')]),'callerid':_0x31ceb8,'Exten':'xcally-motion-dialer','Context':_0x20f4('0x193'),'Priority':'1','variable':_0x54bfc3,'timeout':(_0x46dd37[_0x20f4('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4e2a06})[_0x20f4('0xb9')](function(_0x2c2f62){return _0x5ae808(_0x2c2f62);})['catch'](function(_0x3b3fed){_0x46dd37[_0x20f4('0x63')]+=0x1;var _0x31c56c=new History(_0x319e89[_0x20f4('0x24')][_0x4e2a06]);logger[_0x20f4('0x95')](util[_0x20f4('0x76')](_0x20f4('0x194'),JSON[_0x20f4('0x48')](_0x3b3fed)));_0x31c56c[_0x20f4('0xa7')]=0xe;_0x31c56c['statedesc']='OriginateError';_0x31c56c['starttime']=moment()[_0x20f4('0x76')](_0x20f4('0x101'));_0x31c56c['endtime']=_0x31c56c['starttime'];_0x319e89[_0x20f4('0xcf')](_0x31c56c)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x195')));_0x319e89['moveContactManagedDialer'](_0x31c56c)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x195')))['finally'](function(){delete _0x319e89['actions'][_0x4e2a06];return _0x2ff425(msgResponse('originate',_0x20f4('0x196'),_0x20f4('0x197')));});});});};Dialer['prototype'][_0x20f4('0x30')]=function(_0x1d9ada){var _0x4fbe24=this[_0x20f4('0x24')][_0x1d9ada[_0x20f4('0x127')]];if(_0x4fbe24){delete this[_0x20f4('0x24')][_0x1d9ada['actionid']];_0x4fbe24[_0x20f4('0x116')]=moment()[_0x20f4('0x76')](_0x20f4('0x101'));var _0x540076=_0x4fbe24[_0x20f4('0x55')]==='ivr'?this[_0x20f4('0x21')][_0x4fbe24['queue']]:this[_0x20f4('0x20')][_0x4fbe24[_0x20f4('0x198')]()];if(!this[_0x20f4('0xdb')](_0x1d9ada[_0x20f4('0x199')])){this[_0x20f4('0xb4')](_0x540076);return this[_0x20f4('0x19a')](_0x4fbe24,_0x540076,_0x1d9ada)['catch'](loggerCatch(_0x20f4('0x19b')));}this[_0x20f4('0x25')][_0x1d9ada[_0x20f4('0xe2')]]=_0x4fbe24;}};Dialer[_0x20f4('0x1b')][_0x20f4('0x19c')]=function(_0x4a7aa0,_0x1ca108,_0x4f902c){var _0x17d6ed=new History(_0x1ca108);if(_0x17d6ed['countbusyretry']+_0x17d6ed[_0x20f4('0xf4')]+_0x17d6ed[_0x20f4('0xf5')]+_0x17d6ed['countnosuchnumberretry']+_0x17d6ed[_0x20f4('0xf7')]+_0x17d6ed[_0x20f4('0xf8')]+_0x17d6ed['countmachineretry']+_0x17d6ed['countagentrejectretry']>=_0x4f902c[_0x20f4('0x19d')]-0x1){return!![];}switch(_0x4a7aa0){case 0x3:if(_0x17d6ed['countnoanswerretry']>=_0x4f902c[_0x20f4('0x19e')]-0x1){return!![];}this[_0x20f4('0xc3')]({'active':![],'countnoanswerretry':_0x17d6ed[_0x20f4('0xf5')]+=0x1,'scheduledat':moment()[_0x20f4('0xfe')](_0x4f902c['dialNoAnswerRetryFrequency'],_0x20f4('0x100'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17d6ed[_0x20f4('0xd6')],'ListId':_0x17d6ed[_0x20f4('0x102')],'VoiceQueueId':_0x17d6ed[_0x20f4('0xd8')]||undefined,'CampaignId':_0x17d6ed[_0x20f4('0xd9')]||undefined})[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x19f')));break;case 0x5:if(_0x17d6ed[_0x20f4('0xf3')]>=_0x4f902c[_0x20f4('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x17d6ed[_0x20f4('0xf3')]+=0x1,'scheduledat':moment()['add'](_0x4f902c[_0x20f4('0x1a1')],_0x20f4('0x100'))['format'](_0x20f4('0x101')),'ContactId':_0x17d6ed[_0x20f4('0xd6')],'ListId':_0x17d6ed[_0x20f4('0x102')],'VoiceQueueId':_0x17d6ed[_0x20f4('0xd8')]||undefined,'CampaignId':_0x17d6ed[_0x20f4('0xd9')]||undefined})[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1a2')));break;case 0x8:if(_0x17d6ed[_0x20f4('0xf4')]>=_0x4f902c['dialCongestionMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x17d6ed['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x4f902c[_0x20f4('0x1a3')],_0x20f4('0x100'))[_0x20f4('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x17d6ed[_0x20f4('0xd6')],'ListId':_0x17d6ed[_0x20f4('0x102')],'VoiceQueueId':_0x17d6ed[_0x20f4('0xd8')]||undefined,'CampaignId':_0x17d6ed['CampaignId']||undefined})[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1a4')));break;case 0x0:if(_0x17d6ed[_0x20f4('0xf6')]>=_0x4f902c[_0x20f4('0x1a5')]-0x1){return!![];}else{this[_0x20f4('0xc3')]({'active':![],'countnosuchnumberretry':_0x17d6ed['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x4f902c[_0x20f4('0x1a6')],_0x20f4('0x100'))['format'](_0x20f4('0x101')),'ContactId':_0x17d6ed[_0x20f4('0xd6')],'ListId':_0x17d6ed[_0x20f4('0x102')],'VoiceQueueId':_0x17d6ed[_0x20f4('0xd8')]||undefined,'CampaignId':_0x17d6ed[_0x20f4('0xd9')]||undefined})[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1a7')));}break;case 0xa:if(_0x17d6ed[_0x20f4('0xf7')]>=_0x4f902c[_0x20f4('0x1a8')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x17d6ed[_0x20f4('0xf7')]+=0x1,'scheduledat':moment()[_0x20f4('0xfe')](_0x4f902c['dialDropRetryFrequency'],_0x20f4('0x100'))[_0x20f4('0x76')](_0x20f4('0x101')),'ContactId':_0x17d6ed['ContactId'],'ListId':_0x17d6ed[_0x20f4('0x102')],'VoiceQueueId':_0x17d6ed[_0x20f4('0xd8')]||undefined,'CampaignId':_0x17d6ed['CampaignId']||undefined})[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1a9')));break;case 0xb:if(_0x17d6ed[_0x20f4('0xf8')]>=_0x4f902c['dialAbandonedMaxRetry']-0x1){return!![];}this[_0x20f4('0xc3')]({'active':![],'countabandonedretry':_0x17d6ed[_0x20f4('0xf8')]+=0x1,'scheduledat':moment()[_0x20f4('0xfe')](_0x4f902c['dialAbandonedRetryFrequency'],_0x20f4('0x100'))['format'](_0x20f4('0x101')),'ContactId':_0x17d6ed['ContactId'],'ListId':_0x17d6ed[_0x20f4('0x102')],'VoiceQueueId':_0x17d6ed[_0x20f4('0xd8')]||undefined,'CampaignId':_0x17d6ed[_0x20f4('0xd9')]||undefined})[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1aa')));break;case 0x13:if(_0x17d6ed[_0x20f4('0xf0')]>=_0x4f902c[_0x20f4('0xfb')]-0x1){return!![];}this[_0x20f4('0xc3')]({'active':![],'countmachineretry':_0x17d6ed[_0x20f4('0xf0')]+=0x1,'scheduledat':moment()[_0x20f4('0xfe')](_0x4f902c['dialMachineRetryFrequency'],_0x20f4('0x100'))[_0x20f4('0x76')](_0x20f4('0x101')),'ContactId':_0x17d6ed[_0x20f4('0xd6')],'ListId':_0x17d6ed['ListId'],'VoiceQueueId':_0x17d6ed[_0x20f4('0xd8')]||undefined,'CampaignId':_0x17d6ed['CampaignId']||undefined})[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x106')));break;case 0x14:if(_0x17d6ed[_0x20f4('0x1ab')]>=_0x4f902c[_0x20f4('0x1ac')]-0x1){return!![];}this[_0x20f4('0xc3')]({'active':![],'countagentrejectretry':_0x17d6ed[_0x20f4('0x1ab')]+=0x1,'scheduledat':moment()[_0x20f4('0xfe')](_0x4f902c['dialAgentRejectRetryFrequency'],_0x20f4('0x100'))[_0x20f4('0x76')](_0x20f4('0x101')),'ContactId':_0x17d6ed[_0x20f4('0xd6')],'ListId':_0x17d6ed[_0x20f4('0x102')],'VoiceQueueId':_0x17d6ed[_0x20f4('0xd8')]||undefined,'CampaignId':_0x17d6ed['CampaignId']||undefined})[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1ad')));break;default:return!![];}};Dialer[_0x20f4('0x1b')][_0x20f4('0x19a')]=function(_0x5d1833,_0x11c4ad,_0x39b706){var _0x64cc89=this;var _0x55cee9=new History(_0x5d1833);var _0x50c871=![];var _0x3dff48;var _0x4e0246;return new BPromise(function(_0x4ef4ac,_0xd62bf9){if(_['isUndefined'](_0x11c4ad)&&typeof _0x11c4ad!=='object'){return _0xd62bf9(msgResponse('[callProgressDetecting]',_0x20f4('0x144'),'entity\x20is\x20undefine'));}if(_[_0x20f4('0x85')](_0x39b706)&&typeof _0x39b706!==_0x20f4('0x16a')){return _0xd62bf9(msgResponse(_0x20f4('0x1ae'),_0x20f4('0x144'),_0x20f4('0x1af')));}_0x64cc89['verifyAdditionalPhones'](_0x55cee9,_0x39b706[_0x20f4('0x10e')],_0x11c4ad)['then'](function(_0x322e72){if(_0x322e72[_0x20f4('0x11c')]==0x1)_0x50c871=!![];switch(_0x39b706['reason']){case'0':_0x11c4ad[_0x20f4('0x1b0')]+=0x1;_0x55cee9['state']=0x0;_0x55cee9['statedesc']=_0x20f4('0x1b1');_0x55cee9['countnosuchnumberretry']+=0x1;_0x55cee9[_0x20f4('0xf1')]+=0x1;ami['emit'](_0x20f4('0x1b2'),ut[_0x20f4('0xeb')](_0x5d1833,_0x20f4('0x1b3')));_0x3dff48=_0x11c4ad[_0x20f4('0x1a6')];_0x4e0246=_0x11c4ad[_0x20f4('0x11b')];_0x64cc89[_0x20f4('0xcf')](_0x55cee9)[_0x20f4('0xb2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x64cc89['checkRetriveMax'](0x0,_0x5d1833,_0x11c4ad)&&!_0x50c871){if(_0x55cee9[_0x20f4('0xf6')]>=_0x11c4ad['dialNoSuchNumberMaxRetry']){_0x64cc89[_0x20f4('0xfc')](_0x55cee9,_0x4ef4ac,_0xd62bf9,'reason\x200\x20no\x20such\x20number....');}else{_0x64cc89['stateGlobal'](_0x55cee9,_0x4ef4ac,_0xd62bf9,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x11c4ad[_0x20f4('0x62')]+=0x1;_0x55cee9[_0x20f4('0xa7')]=0x3;_0x55cee9[_0x20f4('0x103')]=_0x20f4('0x1b4');_0x55cee9['countnoanswerretry']+=0x1;_0x55cee9[_0x20f4('0xf1')]+=0x1;ami[_0x20f4('0x4c')](_0x20f4('0x1b5'),ut[_0x20f4('0xeb')](_0x5d1833,_0x20f4('0x1b6')));_0x3dff48=_0x11c4ad[_0x20f4('0x1b7')];_0x4e0246=_0x11c4ad[_0x20f4('0x11b')];_0x64cc89['createHistory'](_0x55cee9)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1b8')));if(_0x64cc89['checkRetriveMax'](0x3,_0x5d1833,_0x11c4ad)&&!_0x50c871){if(_0x55cee9[_0x20f4('0xf5')]>=_0x11c4ad[_0x20f4('0x19e')]){_0x64cc89[_0x20f4('0xfc')](_0x55cee9,_0x4ef4ac,_0xd62bf9,_0x20f4('0x1b9'));}else{_0x64cc89[_0x20f4('0xf9')](_0x55cee9,_0x4ef4ac,_0xd62bf9,_0x20f4('0x1b9'));}}break;case'5':_0x11c4ad['outboundBusyCallsDay']+=0x1;_0x55cee9[_0x20f4('0xa7')]=0x5;_0x55cee9[_0x20f4('0x103')]=_0x20f4('0x1ba');_0x55cee9['countbusyretry']+=0x1;_0x55cee9['countglobal']+=0x1;ami[_0x20f4('0x4c')](_0x20f4('0x1bb'),ut[_0x20f4('0xeb')](_0x5d1833,_0x20f4('0x1bc')));_0x3dff48=_0x11c4ad[_0x20f4('0x1a1')];_0x4e0246=_0x11c4ad[_0x20f4('0x11b')];_0x64cc89[_0x20f4('0xcf')](_0x55cee9)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1bd')));if(_0x64cc89[_0x20f4('0x19c')](0x5,_0x5d1833,_0x11c4ad)&&!_0x50c871){if(_0x55cee9[_0x20f4('0xf3')]>=_0x11c4ad[_0x20f4('0x1a0')]){_0x64cc89[_0x20f4('0xfc')](_0x55cee9,_0x4ef4ac,_0xd62bf9,_0x20f4('0x1be'));}else{_0x64cc89[_0x20f4('0xf9')](_0x55cee9,_0x4ef4ac,_0xd62bf9,_0x20f4('0x1be'));}}break;case'8':_0x11c4ad[_0x20f4('0x60')]+=0x1;_0x55cee9[_0x20f4('0xa7')]=0x8;_0x55cee9['statedesc']=_0x20f4('0x1bf');_0x55cee9['countcongestionretry']+=0x1;_0x55cee9[_0x20f4('0xf1')]+=0x1;_0x3dff48=_0x11c4ad[_0x20f4('0x1a3')];_0x4e0246=_0x11c4ad[_0x20f4('0x11b')];ami['emit']('custom:agentcongestion',ut[_0x20f4('0xeb')](_0x5d1833,_0x20f4('0x1c0')));_0x64cc89[_0x20f4('0xcf')](_0x55cee9)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1c1')));if(_0x64cc89[_0x20f4('0x19c')](0x8,_0x5d1833,_0x11c4ad)&&!_0x50c871){if(_0x55cee9[_0x20f4('0xf4')]>=_0x11c4ad[_0x20f4('0x1c2')]){_0x64cc89[_0x20f4('0xfc')](_0x55cee9,_0x4ef4ac,_0xd62bf9,_0x20f4('0x1c3'));}else{_0x64cc89[_0x20f4('0xf9')](_0x55cee9,_0x4ef4ac,_0xd62bf9,_0x20f4('0x1c3'));}}break;case'11':_0x11c4ad['outboundAbandonedCallsDay']+=0x1;_0x55cee9['state']=0xb;_0x55cee9[_0x20f4('0x103')]=_0x20f4('0x125');_0x55cee9[_0x20f4('0xf8')]+=0x1;_0x55cee9['countglobal']+=0x1;_0x3dff48=_0x11c4ad['dialAbandonedRetryFrequency'];_0x4e0246=_0x11c4ad[_0x20f4('0x11b')];_0x64cc89[_0x20f4('0xcf')](_0x55cee9)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x126')));if(_0x64cc89['checkRetriveMax'](0xb,_0x5d1833,_0x11c4ad)&&!_0x50c871){if(_0x55cee9[_0x20f4('0xf8')]>=_0x11c4ad[_0x20f4('0x1c4')]){_0x64cc89['createStateFinal'](_0x55cee9,_0x4ef4ac,_0xd62bf9,'reason\x2011\x20abandoned');}else{_0x64cc89[_0x20f4('0xf9')](_0x55cee9,_0x4ef4ac,_0xd62bf9,_0x20f4('0x1c5'));}}break;case'20':_0x11c4ad[_0x20f4('0x65')]+=0x1;_0x55cee9['state']=0x14;_0x55cee9[_0x20f4('0x103')]='AgentReject';_0x55cee9[_0x20f4('0x1ab')]+=0x1;_0x55cee9[_0x20f4('0xf1')]+=0x1;_0x3dff48=_0x11c4ad[_0x20f4('0x1c6')];_0x4e0246=_0x11c4ad[_0x20f4('0x11b')];ami['emit']('custom:agentreject',ut['buildObj'](_0x5d1833,'agentreject'));_0x64cc89[_0x20f4('0xcf')](_0x55cee9)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1c7')));if(_0x64cc89['checkRetriveMax'](0x14,_0x5d1833,_0x11c4ad)&&!_0x50c871){if(_0x55cee9[_0x20f4('0x1ab')]>=_0x11c4ad[_0x20f4('0x1ac')]){_0x64cc89[_0x20f4('0xfc')](_0x55cee9,_0x4ef4ac,_0xd62bf9,_0x20f4('0x1c8'));}else{_0x64cc89[_0x20f4('0xf9')](_0x55cee9,_0x4ef4ac,_0xd62bf9,_0x20f4('0x1c8'));}}break;default:_0x11c4ad['outboundUnknownCallsDay']+=0x1;_0x55cee9[_0x20f4('0xa7')]=0xc;_0x55cee9[_0x20f4('0x103')]=_0x39b706[_0x20f4('0x10e')];_0x3dff48=_0x11c4ad[_0x20f4('0x1c6')];_0x4e0246=_0x11c4ad[_0x20f4('0x11b')];_0x64cc89[_0x20f4('0xcf')](_0x55cee9)[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1c9')));if(_0x64cc89[_0x20f4('0x19c')](_0x39b706[_0x20f4('0x10e')],_0x5d1833,_0x11c4ad)&&!_0x50c871){if(_0x55cee9['countbusyretry']+_0x55cee9[_0x20f4('0xf4')]+_0x55cee9['countnoanswerretry']+_0x55cee9[_0x20f4('0xf6')]+_0x55cee9[_0x20f4('0xf7')]+_0x55cee9[_0x20f4('0xf8')]+_0x55cee9[_0x20f4('0xf0')]+_0x55cee9[_0x20f4('0x1ab')]>=_0x11c4ad[_0x20f4('0x19d')]){_0x64cc89[_0x20f4('0xf9')](_0x55cee9,_0x4ef4ac,_0xd62bf9,_0x39b706[_0x20f4('0x10e')]);}else{_0x64cc89[_0x20f4('0xfc')](_0x55cee9,_0x4ef4ac,_0xd62bf9,_0x39b706[_0x20f4('0x10e')]);}}}})[_0x20f4('0xb9')](function(_0xf8e64a){if(_0x50c871){_0x64cc89['swapAdditionalPhones'](_0x55cee9,_0x3dff48,_0x4e0246)[_0x20f4('0xb9')](function(_0x3d63d9){return _0x4ef4ac(0x1);});}});});};Dialer[_0x20f4('0x1b')]['stateGlobal']=function(_0x5132c3,_0x3f29cc,_0x58074a,_0x474393){var _0x1ba93a=new Final(_0x5132c3);_0x1ba93a[_0x20f4('0xa7')]=0xf;_0x1ba93a[_0x20f4('0x103')]=_0x20f4('0x1ca');this['createStateFinal'](_0x1ba93a,_0x3f29cc,_0x58074a,_0x474393);};Dialer[_0x20f4('0x1b')][_0x20f4('0xfc')]=function(_0x569362,_0xb540f4,_0x2c4f4c,_0x147090){this[_0x20f4('0xcd')](_0x569362)[_0x20f4('0xb9')](function(){return _0xb540f4(msgResponse(_0x20f4('0x1ae'),_0x20f4('0xdc'),_0x147090));})['catch'](function(){return _0x2c4f4c(msgResponse(_0x20f4('0x1cb'),_0x20f4('0x144'),_0x20f4('0x1cc')));});};Dialer[_0x20f4('0x1b')][_0x20f4('0x8')]=function(_0x3887f0){var _0x49cdc8=_0x3887f0['dialPredictiveOptimizationPercentage']/0x64;var _0x37ac54=_0x3887f0['outboundDropCallsDayTimeout']/(_0x3887f0['outboundDropCallsDayTimeout']+_0x3887f0[_0x20f4('0xe7')]);var _0x1c869b=Math[_0x20f4('0x1cd')](_0x3887f0[_0x20f4('0x1ce')]*(_0x3887f0[_0x20f4('0x1cf')]/0x64));var _0x202fbc=Math[_0x20f4('0x1cd')](_0x3887f0['predictiveIntervalAvailable']*(_0x3887f0['predictiveIntervalMinThreshold']/0x64));var _0x496a00=_0x3887f0['available']+_0x3887f0[_0x20f4('0x9f')];var _0x4c6e73=Math[_0x20f4('0x1d0')](_0x3887f0[_0x20f4('0x71')]*_0x3887f0[_0x20f4('0x8b')]*_0x3887f0[_0x20f4('0x1d1')]*_0x3887f0[_0x20f4('0x6d')]);if(_[_0x20f4('0x85')](_0x3887f0[_0x20f4('0x28')])){if(!_[_0x20f4('0x85')](_0x3887f0['startPredictive'])){_0x3887f0[_0x20f4('0x27')]=undefined;loggerPredictive['error'](_0x20f4('0x1d2'),_0x20f4('0x1d3'));}if(!_[_0x20f4('0x85')](_0x3887f0[_0x20f4('0x91')])){loggerPredictive[_0x20f4('0x95')]('[startMethodPredictive][StartProgressive]',_0x20f4('0x1d4'));clearInterval(_0x3887f0['handlePredictive']);_0x3887f0[_0x20f4('0x91')]=undefined;}_0x3887f0[_0x20f4('0x28')]=moment()[_0x20f4('0x76')](_0x20f4('0x101'));loggerPredictive[_0x20f4('0x7c')](_0x3887f0[_0x20f4('0x40')],_0x20f4('0x1d5'),_0x3887f0[_0x20f4('0x28')]);this[_0x20f4('0x15a')](_0x3887f0,0x1);}else if(ifInterval(_0x3887f0[_0x20f4('0x1d6')],_0x3887f0[_0x20f4('0x28')])){this['handlePower'](_0x3887f0,0x1);loggerPredictiveCalls[_0x20f4('0x7c')](_0x20f4('0x1d7'),_0x3887f0[_0x20f4('0x28')],_0x3887f0['name']);_0x3887f0[_0x20f4('0x71')]=0x0;_0x3887f0[_0x20f4('0x6c')]=0x0;}else if(_0x49cdc8<_0x37ac54&&_0x3887f0['dialPredictiveOptimization']===_0x20f4('0x1d8')){freeVariablesPredictive(_0x3887f0);loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x1d9'),_0x20f4('0x1da'),_0x37ac54,_0x20f4('0x28'),_0x3887f0[_0x20f4('0x40')]);}else if(_0x4c6e73<_0x3887f0[_0x20f4('0x6c')]&&_0x3887f0[_0x20f4('0x1db')]===_0x20f4('0x1d8')){freeVariablesPredictive(_0x3887f0);loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x1dc'),_0x20f4('0x1dd'),_0x4c6e73,'Drop\x20in\x20this\x20interval',_0x3887f0['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x3887f0[_0x20f4('0x40')]);}else if(!ifInterval(_0x3887f0[_0x20f4('0x1d6')],_0x3887f0[_0x20f4('0x28')])&&_[_0x20f4('0x85')](_0x3887f0[_0x20f4('0x27')])&&!_[_0x20f4('0x85')](_0x3887f0[_0x20f4('0x28')])){_0x3887f0[_0x20f4('0x27')]=moment()[_0x20f4('0x76')](_0x20f4('0x101'));loggerPredictive[_0x20f4('0x7c')](_0x3887f0[_0x20f4('0x40')],'started\x20in\x20predictive\x20at',_0x3887f0[_0x20f4('0x27')]);this[_0x20f4('0x1de')](_0x3887f0['dialPredictiveInterval'])[_0x20f4('0xb9')](this[_0x20f4('0x1df')](_0x3887f0))[_0x20f4('0xb9')](mergeDataErlangB(_0x3887f0))[_0x20f4('0xb9')](this[_0x20f4('0x1e0')](_0x3887f0))[_0x20f4('0xb2')](loggerCatchPredictive(_0x20f4('0x1e1'),_0x3887f0));}else if(!ifInterval(_0x3887f0[_0x20f4('0x1d6')],_0x3887f0[_0x20f4('0x27')])){_0x3887f0['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x3887f0[_0x20f4('0x27')]=moment()[_0x20f4('0x76')](_0x20f4('0x101'));loggerPredictive[_0x20f4('0x7c')](_0x3887f0[_0x20f4('0x40')],_0x20f4('0x1e2'),_0x3887f0[_0x20f4('0x27')]);clearInterval(_0x3887f0['handlePredictive']);_0x3887f0[_0x20f4('0x91')]=undefined;this['averageHandleTime'](_0x3887f0[_0x20f4('0x1d6')])[_0x20f4('0xb9')](this[_0x20f4('0x1df')](_0x3887f0))['then'](mergeDataErlangB(_0x3887f0))[_0x20f4('0xb9')](this[_0x20f4('0x1e0')](_0x3887f0))['catch'](loggerCatchPredictive(_0x20f4('0x1e3'),_0x3887f0));}else if(_0x3887f0['predictiveIntervalAvailable']&&_0x496a00<_0x3887f0[_0x20f4('0x1ce')]-_0x202fbc){freeVariablesPredictive(_0x3887f0);loggerPredictive['info'](_0x3887f0[_0x20f4('0x40')],_0x20f4('0x1e4'),_0x496a00,_0x20f4('0x1e5'),_0x3887f0[_0x20f4('0x1ce')],'-',_0x202fbc,'=',_0x3887f0[_0x20f4('0x1ce')]-_0x202fbc,')');}else if(_0x3887f0[_0x20f4('0x1ce')]&&_0x496a00>_0x3887f0['predictiveIntervalAvailable']+_0x1c869b){freeVariablesPredictive(_0x3887f0);loggerPredictive[_0x20f4('0x7c')](_0x3887f0[_0x20f4('0x40')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x496a00,')\x20are\x20more\x20than\x20threshold\x20(',_0x3887f0[_0x20f4('0x1ce')],'+',_0x1c869b,'=',_0x3887f0[_0x20f4('0x1ce')]+_0x1c869b,')');}};Dialer['prototype'][_0x20f4('0x1df')]=function(_0x167cc8){var _0x4df750=this;return function(_0x31283c){return new BPromise(function(_0x49cc5e,_0x4e2d49){_[_0x20f4('0x8e')](_0x167cc8,_0x31283c[0x0]);if(checkGetDataPredictive(_0x31283c[0x0])){var _0x372756=_0x167cc8[_0x20f4('0x1ce')]=_0x167cc8[_0x20f4('0x9f')]+_0x167cc8[_0x20f4('0x4f')];var _0x1de5d2=_0x167cc8[_0x20f4('0x1d6')]*0x3c;var _0x241149=_0x31283c[0x0][_0x20f4('0x68')]+_0x31283c[0x0][_0x20f4('0x67')];var _0x2e4297=(_0x31283c[0x0][_0x20f4('0x80')]+_0x31283c[0x0][_0x20f4('0x6a')]+_0x31283c[0x0][_0x20f4('0x69')])/_0x31283c[0x0][_0x20f4('0x6f')];_0x167cc8['predictiveIntervalHitRate']=_0x2e4297>0x0?_0x2e4297:0x1;switch(_0x167cc8[_0x20f4('0x1db')]){case'dropRate':var _0x7283b3=_0x167cc8[_0x20f4('0x1e6')]/0x64;return _0x4df750[_0x20f4('0x1e7')](_0x372756,_0x1de5d2,_0x241149,_0x2e4297,_0x7283b3)['then'](function(_0x1db12e){return _0x49cc5e(_0x1db12e);});case'agentBusyFactor':var _0x19615a=_0x167cc8[_0x20f4('0x1e6')]/0x64;return _0x4df750[_0x20f4('0x1e8')](_0x372756,_0x1de5d2,_0x241149,_0x2e4297,_0x19615a)[_0x20f4('0xb9')](function(_0x23bc19){return _0x49cc5e(_0x23bc19);});default:return _0x4e2d49(msgResponse(_0x20f4('0x1e9'),'Failure',_0x20f4('0x1ea')));}}else{return _0x4e2d49(msgResponse(_0x20f4('0x1e9'),_0x20f4('0x144'),_0x20f4('0x1eb')));}});};};Dialer[_0x20f4('0x1b')][_0x20f4('0x1ec')]=function(_0x15aaa4){var _0x2583d8=this;return function(_0xf36e7){return new BPromise(function(_0xf089a2,_0x6ee248){_[_0x20f4('0x8e')](_0x15aaa4,_0xf36e7[0x0]);if(checkGetDataPredictive(_0xf36e7[0x0])){loggerPredictive['info'](JSON[_0x20f4('0x48')](_0xf36e7[0x0]));if(_0x15aaa4[_0x20f4('0x1db')]==='dropRate'){return _0x2583d8[_0x20f4('0xcb')](_0x15aaa4['id'])['then'](function(_0xfa7cb0){var _0x310e8f=_0x15aaa4[_0x20f4('0x50')]-_0xfa7cb0[0x0][_0x20f4('0x1ed')];var _0x55a2fa=_0x15aaa4['dialPredictiveInterval']*0x3c;var _0x4ac3a5=_0xf36e7[0x0][_0x20f4('0x68')]+_0xf36e7[0x0][_0x20f4('0x67')];var _0x38634f=(_0xf36e7[0x0][_0x20f4('0x80')]+_0xf36e7[0x0][_0x20f4('0x6a')]+_0xf36e7[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xf36e7[0x0][_0x20f4('0x6f')];var _0x56a457=_0x15aaa4['dialPredictiveOptimizationPercentage']/0x64;_0x15aaa4[_0x20f4('0x6e')]=_0xfa7cb0[0x0][_0x20f4('0x1ed')]||0x0;_0x15aaa4[_0x20f4('0x1d1')]=_0x38634f>0x0?_0x38634f:0x1;return _0x2583d8['abandonmentRate'](_0x310e8f,_0x55a2fa,_0x4ac3a5,_0x38634f,_0x56a457);})[_0x20f4('0xb9')](function(_0x8d5563){return _0xf089a2(_0x8d5563);})[_0x20f4('0xb2')](function(_0x317318){return _0x6ee248(msgResponse(_0x20f4('0x1ee'),'Failure',JSON['stringify'](_0x317318)));});}if(_0x15aaa4['dialPredictiveOptimization']===_0x20f4('0x1ef')){return _0x2583d8['getVoiceQueueRtPauses'](_0x15aaa4['id'])[_0x20f4('0xb9')](function(_0x29803b){var _0x2e94c1=_0x15aaa4[_0x20f4('0x50')]-_0x29803b[0x0][_0x20f4('0x1ed')];var _0x1a7aa3=_0x15aaa4[_0x20f4('0x1d6')]*0x3c;var _0x524271=_0xf36e7[0x0]['predictiveIntervalAvgTalktime']+_0xf36e7[0x0][_0x20f4('0x67')];var _0x57e329=(_0xf36e7[0x0][_0x20f4('0x80')]+_0xf36e7[0x0][_0x20f4('0x6a')]+_0xf36e7[0x0][_0x20f4('0x69')])/_0xf36e7[0x0][_0x20f4('0x6f')];var _0x4a7736=_0x15aaa4[_0x20f4('0x1e6')]/0x64;_0x15aaa4[_0x20f4('0x6e')]=_0x29803b[0x0][_0x20f4('0x1ed')]||0x0;_0x15aaa4[_0x20f4('0x1d1')]=_0x57e329>0x0?_0x57e329:0x1;return _0x2583d8[_0x20f4('0x1e8')](_0x2e94c1,_0x1a7aa3,_0x524271,_0x57e329,_0x4a7736);})[_0x20f4('0xb9')](function(_0x554975){return _0xf089a2(_0x554975);})[_0x20f4('0xb2')](function(_0x2bdbdb){return _0x6ee248(msgResponse(_0x20f4('0x1ee'),'Failure',JSON[_0x20f4('0x48')](_0x2bdbdb)));});}}else{return _0x6ee248(msgResponse('[getDataPredictive]','Failure',_0x20f4('0x1eb')));}});};};Dialer[_0x20f4('0x1b')][_0x20f4('0x1e0')]=function(_0x738455){var _0x310964=this;return function(){var _0x3a30cc=0x0;var _0x407f5e=Math[_0x20f4('0x1d0')](_0x738455[_0x20f4('0x1f0')]*0x3e8);if(_0x407f5e>0x0){_0x407f5e=_0x407f5e<0x64?0x64:_0x407f5e;loggerPredictive['info'](_0x738455['name'],'one\x20call\x20every:',_0x407f5e,_0x20f4('0x49'));_0x738455[_0x20f4('0x91')]=setInterval(function(){_0x310964[_0x20f4('0x91')](_0x738455);loggerPredictiveCalls[_0x20f4('0x7c')](_0x20f4('0x1f1'),_0x3a30cc+=0x1);},_0x407f5e);}else{loggerPredictive[_0x20f4('0x7c')](_0x738455[_0x20f4('0x40')],_0x20f4('0x1f2'));}};};Dialer[_0x20f4('0x1b')][_0x20f4('0x1f3')]=function(_0x33b878,_0x23ca47){var _0x1ef19b=this;return function(_0x3063c4){if(_[_0x20f4('0x47')](_0x3063c4)){if(_[_0x20f4('0xaf')](_0x23ca47[_0x20f4('0xd7')])||!_0x23ca47[_0x20f4('0x1f4')]){if(_0x33b878['dialMethod']===_0x20f4('0x15d')){_0x33b878['queueStatusComplete']=_[_0x20f4('0x85')](_0x33b878[_0x20f4('0x12b')])?!![]:_0x33b878[_0x20f4('0x12b')];var _0xe7be6c=uuid['v4']();_0x1ef19b[_0x20f4('0x24')][_0xe7be6c]=new Action(_0x33b878,_0x23ca47,_0xe7be6c);loggerBooked[_0x20f4('0x7c')](_0x20f4('0x1f5'),_0xe7be6c,_0x20f4('0x1f6'),JSON[_0x20f4('0x48')](_0x33b878[_0x20f4('0x12b')]),_0x20f4('0x1f7'),_0x33b878[_0x20f4('0x40')]);if(_0x33b878[_0x20f4('0x12b')]){_0x33b878['queueStatusComplete']=![];_0x1ef19b[_0x20f4('0x2a')][_0x1ef19b[_0x20f4('0x24')][_0xe7be6c]['queue']]=[];ami[_0x20f4('0x14b')]({'actionid':_0xe7be6c,'action':_0x20f4('0x1f8'),'queue':_0x33b878[_0x20f4('0x40')]})[_0x20f4('0xb2')](function(){_0x1ef19b[_0x20f4('0xb4')](_0x33b878);_0x1ef19b[_0x20f4('0xc3')]({'active':![],'ContactId':_0x1ef19b['actions'][_0xe7be6c][_0x20f4('0xd6')],'ListId':_0x1ef19b[_0x20f4('0x24')][_0xe7be6c][_0x20f4('0x102')],'VoiceQueueId':_0x1ef19b[_0x20f4('0x24')][_0xe7be6c][_0x20f4('0xd8')]||undefined,'CampaignId':_0x1ef19b[_0x20f4('0x24')][_0xe7be6c][_0x20f4('0xd9')]||undefined})[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1f9')));delete _0x1ef19b[_0x20f4('0x24')][_0xe7be6c];});}else{loggerBooked[_0x20f4('0x7c')](_0x20f4('0x1fa'),JSON[_0x20f4('0x48')](_0x33b878[_0x20f4('0x12b')]),_0x20f4('0x1f7'),_0x33b878[_0x20f4('0x40')]);_0x1ef19b[_0x20f4('0xb4')](_0x33b878);_0x1ef19b[_0x20f4('0xc3')]({'active':![],'ContactId':_0x1ef19b[_0x20f4('0x24')][_0xe7be6c][_0x20f4('0xd6')],'ListId':_0x1ef19b['actions'][_0xe7be6c]['ListId'],'VoiceQueueId':_0x1ef19b[_0x20f4('0x24')][_0xe7be6c][_0x20f4('0xd8')]||undefined,'CampaignId':_0x1ef19b[_0x20f4('0x24')][_0xe7be6c][_0x20f4('0xd9')]||undefined})[_0x20f4('0xb2')](loggerCatch(_0x20f4('0x1f9')));delete _0x1ef19b[_0x20f4('0x24')][_0xe7be6c];}}else{return _0x1ef19b[_0x20f4('0x1fb')](_0x33b878,_0x23ca47);}}else{if(getDiff(_0x23ca47[_0x20f4('0x1fc')])<_0x33b878[_0x20f4('0x1fd')]*0x3c){if(_0x23ca47[_0x20f4('0x1fe')]&&!_0x23ca47[_0x20f4('0x1fe')][_0x20f4('0x1ff')]){_0x1ef19b[_0x20f4('0x1f')][_0x20f4('0x12e')](_0x23ca47['id'])[_0x20f4('0x1e')](function(){_0x1ef19b['updateOriginated'](_0x33b878);});}else{_0x1ef19b['unlockContact']({'active':![]},_0x23ca47['id'],0x1)[_0x20f4('0x1e')](function(){_0x1ef19b[_0x20f4('0xb4')](_0x33b878);});}}else{_0x33b878[_0x20f4('0x64')]+=0x1;_0x1ef19b[_0x20f4('0xb4')](_0x33b878);if(_0x33b878[_0x20f4('0x200')]){_0x1ef19b['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x23ca47[_0x20f4('0xd6')],'ListId':_0x23ca47[_0x20f4('0x102')],'VoiceQueueId':_0x23ca47[_0x20f4('0xd8')]||undefined,'CampaignId':_0x23ca47[_0x20f4('0xd9')]||undefined})[_0x20f4('0xb2')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x1ef19b[_0x20f4('0xcf')](createObjHistory(_0x33b878,_0x23ca47,_0x20f4('0x201'),0x17,_0x20f4('0x202')))['catch'](loggerCatch(_0x20f4('0x203')));}else{_0x1ef19b['saveInDb'](createObjHistory(_0x33b878,_0x23ca47,_0x20f4('0x204'),0x16,'RecallFailedTimeout'),_0x20f4('0x205'),_0x20f4('0x206'));}}}}else{_0x33b878['outboundBlacklistCallsDay']+=0x1;_0x1ef19b[_0x20f4('0xd4')](createObjHistory(_0x33b878,_0x23ca47,_0x20f4('0x207'),0xd,_0x20f4('0x208')),_0x20f4('0x209'),_0x20f4('0x20a'));throw _0x20f4('0x20b');}};};Dialer[_0x20f4('0x1b')][_0x20f4('0x160')]=function(_0x173c64){var _0x27c91a=this;var _0x302a51=_0x173c64[_0x20f4('0x20c')]-_0x173c64[_0x20f4('0x70')]-_0x173c64[_0x20f4('0xc8')];emitCampaignSummary(_0x173c64);if(_0x302a51>0x0){if(_0x302a51>this[_0x20f4('0x23')]){_0x302a51=this[_0x20f4('0x23')];}_0x173c64[_0x20f4('0xc8')]+=_0x302a51;this[_0x20f4('0xca')](_0x173c64['id'],_0x302a51,_0x173c64[_0x20f4('0x20d')],_0x173c64)[_0x20f4('0xb9')](function(_0x589286){_0x173c64[_0x20f4('0xc8')]-=_0x302a51;_0x173c64[_0x20f4('0xc8')]=_0x173c64['temp']>0x0?_0x173c64[_0x20f4('0xc8')]:0x0;if(!checkContactEmpty(_0x589286)){_0x173c64['message']=_0x20f4('0x20e');logger[_0x20f4('0x7c')](_0x20f4('0x20f')+_0x173c64['name']);}else{_0x173c64[_0x20f4('0x70')]+=_0x589286[_0x20f4('0x98')];_0x173c64[_0x20f4('0x3e')]=_0x20f4('0x210');for(var _0x338c46=0x0;_0x338c46<_0x589286[_0x20f4('0x98')];_0x338c46+=0x1){_0x173c64[_0x20f4('0x211')]+=0x1;if(_['isNil'](_0x589286[_0x338c46])||_[_0x20f4('0xaf')](_0x589286[_0x338c46]['Contact'])||_[_0x20f4('0xaf')](_0x589286[_0x338c46][_0x20f4('0x16d')])){_0x27c91a[_0x20f4('0x212')](_0x20f4('0x213'),_0x173c64,_0x589286[_0x338c46]);}else{_0x27c91a[_0x20f4('0xc0')](_['pick'](_0x589286[_0x338c46],[_0x20f4('0xd9'),_0x20f4('0x214')]))['then'](_0x27c91a[_0x20f4('0x1f3')](_0x173c64,_0x589286[_0x338c46]))[_0x20f4('0xb2')](_0x27c91a[_0x20f4('0xd2')](_0x20f4('0x215'),_0x173c64));}}}})[_0x20f4('0xb2')](loggerGetContactDialer(_0x20f4('0x216'),_0x173c64,_0x302a51));}};Dialer[_0x20f4('0x1b')]['handlePower']=function(_0x262350,_0x5a31e8){var _0x4e7ca5=this;var _0x52a7e1=[];var _0x3e1d8b=_0x5a31e8>=0x1?_0x5a31e8:0x1;if(_0x262350['dialMethod']===_0x20f4('0x15d')){_0x3e1d8b=0x1;}var _0x32362c=Math[_0x20f4('0x1d0')](_0x262350['available']*_0x3e1d8b)-_0x262350[_0x20f4('0x70')]-_0x262350[_0x20f4('0xc8')];emitVoiceQueueSummary(_0x262350);if(_0x262350[_0x20f4('0x217')]>0x0){var _0x4a6095=_0x262350['dialLimitQueue']-_0x262350[_0x20f4('0x70')]-_0x262350[_0x20f4('0x9f')]-_0x262350[_0x20f4('0xc8')]-_0x262350[_0x20f4('0xa0')];if(_0x32362c>_0x4a6095){_0x32362c=_0x4a6095;}}if(_0x32362c>0x0){if(_0x262350[_0x20f4('0x5a')]==='booked'){_0x32362c=0x1;}if(_0x32362c>this[_0x20f4('0x23')]){_0x32362c=this['maxNumberOriginate'];}_0x262350['temp']+=_0x32362c;for(var _0x3d9568 in this[_0x20f4('0x22')]){if(typeof this[_0x20f4('0x22')][_0x3d9568]!==_0x20f4('0xad')){if(this[_0x20f4('0x22')][_0x3d9568][_0x20f4('0xa7')]==='not_inuse'&&this['agents'][_0x3d9568][_0x20f4('0xb0')]===_0x20f4('0xe0')){_0x52a7e1[_0x20f4('0x14a')](this[_0x20f4('0x22')][_0x3d9568]['id']);}}}this[_0x20f4('0xc7')](_0x262350['id'],_0x52a7e1,_0x32362c,_0x262350['dialOrderByScheduledAt'],_0x262350)[_0x20f4('0xb9')](function(_0x2c4c6e){_0x262350[_0x20f4('0xc8')]-=_0x32362c;_0x262350['temp']=_0x262350['temp']>0x0?_0x262350['temp']:0x0;if(!checkContactEmpty(_0x2c4c6e)){_0x4e7ca5[_0x20f4('0xb8')](_0x262350)[_0x20f4('0xb9')](sendMessageReschedule(_0x262350))[_0x20f4('0xb2')](loggerCatch(_0x20f4('0xba')));}else{_0x262350[_0x20f4('0x70')]+=_0x2c4c6e[_0x20f4('0x98')];_0x262350['message']=_0x262350[_0x20f4('0x5a')]===_0x20f4('0x15d')?_0x20f4('0x218'):_0x20f4('0x210');for(var _0x1f26ca=0x0;_0x1f26ca<_0x2c4c6e['length'];_0x1f26ca+=0x1){if(_[_0x20f4('0xaf')](_0x2c4c6e[_0x1f26ca])||_[_0x20f4('0xaf')](_0x2c4c6e[_0x1f26ca][_0x20f4('0x185')])||_['isNil'](_0x2c4c6e[_0x1f26ca]['phone'])){_0x4e7ca5[_0x20f4('0x212')](_0x20f4('0x213'),_0x262350,_0x2c4c6e[_0x1f26ca]);}else{_0x4e7ca5[_0x20f4('0xbb')](_['pick'](_0x2c4c6e[_0x1f26ca],[_0x20f4('0xd8'),_0x20f4('0x214')]))[_0x20f4('0xb9')](_0x4e7ca5['checkContactBlack'](_0x262350,_0x2c4c6e[_0x1f26ca]))['catch'](_0x4e7ca5[_0x20f4('0xd2')](_0x20f4('0x213'),_0x262350));}}}})[_0x20f4('0xb2')](loggerGetContactDialer(_0x20f4('0x219'),_0x262350,_0x32362c));}};Dialer[_0x20f4('0x1b')]['handlePredictive']=function(_0x4fc0d1){if(_0x4fc0d1[_0x20f4('0x217')]>0x0){var _0x224ce0=_0x4fc0d1[_0x20f4('0x217')]-_0x4fc0d1['originated']-_0x4fc0d1[_0x20f4('0x9f')];if(_0x224ce0>0x0){this[_0x20f4('0x21a')](_0x4fc0d1);}else{loggerPredictiveCalls[_0x20f4('0x7c')](_0x20f4('0x21b'));}}else{this[_0x20f4('0x21a')](_0x4fc0d1);}};Dialer[_0x20f4('0x1b')]['tryOriginatePredictive']=function(_0x19f747){var _0x61627e=this;var _0x23ff66=[];_0x19f747['originated']+=0x1;for(var _0xef1ebd in this['agents']){if(typeof this[_0x20f4('0x22')][_0xef1ebd]!==_0x20f4('0xad')){if(this[_0x20f4('0x22')][_0xef1ebd][_0x20f4('0xa7')]===_0x20f4('0x21c')&&this[_0x20f4('0x22')][_0xef1ebd]['status']===_0x20f4('0xe0')){_0x23ff66[_0x20f4('0x14a')](this[_0x20f4('0x22')][_0xef1ebd]['id']);}}}this['getContactDialer'](_0x19f747['id'],_0x23ff66,0x1,_0x19f747['dialOrderByScheduledAt'],_0x19f747)[_0x20f4('0xb9')](function(_0x10b3bd){if(!checkContactEmpty(_0x10b3bd)){checkContactLowerLimitOriginate(_0x19f747,0x1,0x0);_0x61627e['countReScheduled'](_0x19f747)['then'](sendMessageReschedule(_0x19f747))['catch'](loggerCatch(_0x20f4('0xba')));}else{_0x19f747[_0x20f4('0x3e')]=_0x20f4('0x210');if(_[_0x20f4('0xaf')](_0x10b3bd[0x0])||_[_0x20f4('0xaf')](_0x10b3bd[0x0][_0x20f4('0x185')])||_[_0x20f4('0xaf')](_0x10b3bd[0x0][_0x20f4('0x16d')])){_0x61627e[_0x20f4('0x212')](_0x20f4('0x213'),_0x19f747,_0x10b3bd[0x0]);}else{_0x61627e['checkIsBlackList'](_['pick'](_0x10b3bd[0x0],[_0x20f4('0xd8'),_0x20f4('0x214')]))[_0x20f4('0xb9')](_0x61627e[_0x20f4('0x1f3')](_0x19f747,_0x10b3bd[0x0]))['catch'](_0x61627e[_0x20f4('0xd2')](_0x20f4('0x21d'),_0x19f747));}}})[_0x20f4('0xb2')](loggerGetContactDialer('[getContactDialerPredictive]',_0x19f747,0x1));emitVoiceQueueSummary(_0x19f747);};Dialer[_0x20f4('0x1b')][_0x20f4('0x1e7')]=function(_0x4401eb,_0x470273,_0x3ae3bc,_0xd72ed9,_0x9d0b72,_0x4d5d55){loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x21e'));loggerPredictive['info'](_0x20f4('0x21f'),_0x4401eb);loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x220'),_0x470273);loggerPredictive[_0x20f4('0x7c')]('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',_0x3ae3bc);loggerPredictive['info'](_0x20f4('0x221'),_0xd72ed9);loggerPredictive[_0x20f4('0x7c')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9d0b72);loggerPredictive[_0x20f4('0x7c')]('---------------------------');return new BPromise(function(_0x54182c,_0x3684fd){if(_0x4401eb<=0x0||isNaN(_0x4401eb)){return _0x3684fd(msgResponse(_0x20f4('0x222'),_0x20f4('0x196'),'m\x20=\x20'+_0x4401eb));}if(_0x3ae3bc<=0x0||isNaN(_0x3ae3bc)){return _0x3684fd(msgResponse('[abandonmentRate]',_0x20f4('0x196'),'Ts\x20=\x20'+_0x3ae3bc));}if(_0xd72ed9<=0x0||isNaN(_0xd72ed9)){return _0x3684fd(msgResponse(_0x20f4('0x222'),_0x20f4('0x196'),_0x20f4('0x223')+_0xd72ed9));}if(_0x470273<=0x0||isNaN(_0x470273)){return _0x3684fd(msgResponse(_0x20f4('0x222'),_0x20f4('0x196'),_0x20f4('0x224')+_0x470273));}if(_0x9d0b72<=0x0||isNaN(_0x9d0b72)){return _0x3684fd(msgResponse(_0x20f4('0x222'),_0x20f4('0x196'),'Amax\x20=\x20'+_0x9d0b72));}_0x4d5d55=_0x4d5d55||0x0;var _0x518048=0x1/_0x3ae3bc;var _0x23b51d=0x0;var _0x25635e=0x0;var _0x24cd08=0x0;var _0x367ece=0x0;for(var _0x4456ab=0x0;_0x24cd08<_0x9d0b72;_0x4456ab+=0x1){_0x25635e=_0x4456ab/_0x470273;_0x23b51d=(_0xd72ed9*_0x25635e+_0x4d5d55)/_0x518048;_0x24cd08=erlangb(_0x23b51d,_0x4401eb);_0x367ece=_0x23b51d/_0x4401eb*(0x1-erlangb(_0x23b51d,_0x4401eb));}return _0x54182c({'erlangCalls':_0x4456ab,'erlangCallToSecond':_0x470273/_0x4456ab,'erlangAbandonmentRate':_0x24cd08,'erlangBusyFactor':_0x367ece});});};Dialer[_0x20f4('0x1b')][_0x20f4('0x1e8')]=function(_0x2189bc,_0x3e9967,_0x3bb483,_0x2ead66,_0x2ec844,_0x2f54f0){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0x20f4('0x21f'),_0x2189bc);loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x220'),_0x3e9967);loggerPredictive[_0x20f4('0x7c')]('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',_0x3bb483);loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x221'),_0x2ead66);loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x225'),_0x2ec844);loggerPredictive[_0x20f4('0x7c')](_0x20f4('0x8d'));return new BPromise(function(_0x3029ee,_0x222cb5){if(_0x2189bc<=0x0||isNaN(_0x2189bc)){return _0x222cb5(msgResponse(_0x20f4('0x226'),'Error',_0x20f4('0x227')+_0x2189bc));}if(_0x3bb483<=0x0||isNaN(_0x3bb483)){return _0x222cb5(msgResponse(_0x20f4('0x226'),_0x20f4('0x196'),_0x20f4('0x228')+_0x3bb483));}if(_0x2ead66<=0x0||isNaN(_0x2ead66)){return _0x222cb5(msgResponse(_0x20f4('0x226'),'Error',_0x20f4('0x223')+_0x2ead66));}if(_0x3e9967<=0x0||isNaN(_0x3e9967)){return _0x222cb5(msgResponse(_0x20f4('0x226'),'Error',_0x20f4('0x224')+_0x3e9967));}if(_0x2ec844<=0x0||isNaN(_0x2ec844)){return _0x222cb5(msgResponse(_0x20f4('0x226'),_0x20f4('0x196'),'Umin\x20=\x20'+_0x2ec844));}_0x2f54f0=_0x2f54f0||0x0;var _0x3ce6e9=0x1/_0x3bb483;var _0x46a1a0=0x0;var _0x71cf04=0x0;var _0x920736=0x0;var _0x1e4275=0x0;for(var _0x5d9434=0x0;_0x1e4275<_0x2ec844;_0x5d9434+=0x1){_0x71cf04=_0x5d9434/_0x3e9967;_0x46a1a0=(_0x2ead66*_0x71cf04+_0x2f54f0)/_0x3ce6e9;_0x920736=erlangb(_0x46a1a0,_0x2189bc);_0x1e4275=_0x46a1a0/_0x2189bc*(0x1-erlangb(_0x46a1a0,_0x2189bc));}return _0x3029ee({'erlangCalls':_0x5d9434,'erlangCallToSecond':_0x3e9967/_0x5d9434,'erlangAbandonmentRate':_0x920736,'erlangBusyFactor':_0x1e4275});});};module[_0x20f4('0x229')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index e489090..318311d 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 _0x40a4=['countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','responsetime','droptime','endtime','ringtime','starttime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridname','util','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry'];(function(_0x575b72,_0x1a7eb1){var _0x561c57=function(_0x10e401){while(--_0x10e401){_0x575b72['push'](_0x575b72['shift']());}};_0x561c57(++_0x1a7eb1);}(_0x40a4,0x12c));var _0x440a=function(_0x192b24,_0x2fdea3){_0x192b24=_0x192b24-0x0;var _0x3bd3ad=_0x40a4[_0x192b24];return _0x3bd3ad;};'use strict';var util=require(_0x440a('0x0'));var _=require(_0x440a('0x1'));var moment=require(_0x440a('0x2'));function getSeconds(_0x8ae77d,_0xdc5946){var _0x4317c7=moment(_0x8ae77d)['milliseconds'](0x0);var _0xea75dd=moment(_0xdc5946)[_0x440a('0x3')](0x0);return _0x4317c7['diff'](_0xea75dd,_0x440a('0x4'));}function QueueCallerAbandon(_0x57fe63,_0x5bd010){this['scheduledat']=_0x57fe63[_0x440a('0x5')];this[_0x440a('0x6')]=_0x57fe63['type'];this[_0x440a('0x7')]=_0x57fe63[_0x440a('0x6')]===_0x440a('0x8')?_0x440a('0x9'):_0x57fe63[_0x440a('0x6')];this['countbusyretry']=_0x57fe63['countbusyretry'];this[_0x440a('0xa')]=_0x57fe63[_0x440a('0xa')];this[_0x440a('0xb')]=_0x57fe63[_0x440a('0xb')];this[_0x440a('0xc')]=_0x57fe63[_0x440a('0xd')]+_0x57fe63[_0x440a('0xa')]+_0x57fe63[_0x440a('0xb')]+_0x57fe63[_0x440a('0xe')]+_0x57fe63[_0x440a('0xf')]+_0x57fe63[_0x440a('0x10')]+_0x57fe63[_0x440a('0x11')]+_0x57fe63[_0x440a('0x12')];this[_0x440a('0xe')]=_0x57fe63[_0x440a('0xe')];this[_0x440a('0xf')]=_0x57fe63[_0x440a('0xf')];this[_0x440a('0x10')]=_0x57fe63[_0x440a('0x10')];this['countmachineretry']=_0x57fe63[_0x440a('0x11')];this[_0x440a('0x12')]=_0x57fe63[_0x440a('0x12')];this[_0x440a('0x13')]=_0x5bd010[_0x440a('0x13')];this[_0x440a('0x14')]=_0x57fe63['name'];this[_0x440a('0x15')]=_0x57fe63[_0x440a('0x16')];this['starttime']=_0x57fe63['starttime'];this['responsetime']=_0x57fe63[_0x440a('0x17')];this[_0x440a('0x18')]=_0x57fe63[_0x440a('0x18')];this[_0x440a('0x19')]=this['droptime'];this[_0x440a('0x1a')]=getSeconds(_0x57fe63[_0x440a('0x17')],_0x57fe63[_0x440a('0x1b')]);this['holdtime']=getSeconds(this[_0x440a('0x18')],_0x57fe63[_0x440a('0x17')]);this['talktime']=0x0;this[_0x440a('0x9')]=_0x5bd010[_0x440a('0x9')];this['membername']=_0x5bd010[_0x440a('0x1c')];this[_0x440a('0x1d')]=_0x5bd010[_0x440a('0x1d')];this[_0x440a('0x1e')]=_0x57fe63[_0x440a('0x1e')];this['callbackuniqueid']=_0x57fe63[_0x440a('0x1f')];this[_0x440a('0x20')]=_0x57fe63[_0x440a('0x20')];this[_0x440a('0x21')]=_0x57fe63[_0x440a('0x21')];this[_0x440a('0x22')]=_0x57fe63['ContactId'];this[_0x440a('0x23')]=_0x57fe63[_0x440a('0x23')];this['UserId']=_0x57fe63['UserId'];this['VoiceQueueId']=_0x57fe63[_0x440a('0x24')];this[_0x440a('0x25')]=_0x57fe63[_0x440a('0x25')];this['originatecalleridnum']=_0x57fe63['originatecalleridnum']||'';this[_0x440a('0x26')]=_0x57fe63[_0x440a('0x26')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0x29ef=['responsetime','endtime','droptime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime'];(function(_0x2f6b2a,_0x154a0b){var _0x9a0932=function(_0x32e8e6){while(--_0x32e8e6){_0x2f6b2a['push'](_0x2f6b2a['shift']());}};_0x9a0932(++_0x154a0b);}(_0x29ef,0x196));var _0xf29e=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x29ef[_0x2d364e];return _0x1b9312;};'use strict';var util=require(_0xf29e('0x0'));var _=require(_0xf29e('0x1'));var moment=require(_0xf29e('0x2'));function getSeconds(_0x1c9115,_0x491523){var _0x458386=moment(_0x1c9115)[_0xf29e('0x3')](0x0);var _0x1e2e6=moment(_0x491523)[_0xf29e('0x3')](0x0);return _0x458386[_0xf29e('0x4')](_0x1e2e6,_0xf29e('0x5'));}function QueueCallerAbandon(_0x4d790f,_0x52df07){this[_0xf29e('0x6')]=_0x4d790f['scheduledat'];this['type']=_0x4d790f[_0xf29e('0x7')];this[_0xf29e('0x8')]=_0x4d790f[_0xf29e('0x7')]==='outbound'?_0xf29e('0x9'):_0x4d790f[_0xf29e('0x7')];this[_0xf29e('0xa')]=_0x4d790f[_0xf29e('0xa')];this[_0xf29e('0xb')]=_0x4d790f[_0xf29e('0xb')];this[_0xf29e('0xc')]=_0x4d790f['countnoanswerretry'];this[_0xf29e('0xd')]=_0x4d790f[_0xf29e('0xa')]+_0x4d790f['countcongestionretry']+_0x4d790f[_0xf29e('0xc')]+_0x4d790f[_0xf29e('0xe')]+_0x4d790f[_0xf29e('0xf')]+_0x4d790f[_0xf29e('0x10')]+_0x4d790f[_0xf29e('0x11')]+_0x4d790f[_0xf29e('0x12')];this[_0xf29e('0xe')]=_0x4d790f[_0xf29e('0xe')];this[_0xf29e('0xf')]=_0x4d790f[_0xf29e('0xf')];this[_0xf29e('0x10')]=_0x4d790f[_0xf29e('0x10')];this['countmachineretry']=_0x4d790f[_0xf29e('0x11')];this[_0xf29e('0x12')]=_0x4d790f[_0xf29e('0x12')];this[_0xf29e('0x13')]=_0x52df07['uniqueid'];this[_0xf29e('0x14')]=_0x4d790f['name'];this[_0xf29e('0x15')]=_0x4d790f[_0xf29e('0x16')];this[_0xf29e('0x17')]=_0x4d790f[_0xf29e('0x17')];this[_0xf29e('0x18')]=_0x4d790f[_0xf29e('0x18')];this['droptime']=_0x4d790f['droptime'];this[_0xf29e('0x19')]=this[_0xf29e('0x1a')];this[_0xf29e('0x1b')]=getSeconds(_0x4d790f['responsetime'],_0x4d790f['starttime']);this[_0xf29e('0x1c')]=getSeconds(this['droptime'],_0x4d790f['responsetime']);this['talktime']=0x0;this[_0xf29e('0x9')]=_0x52df07['queue'];this[_0xf29e('0x1d')]=_0x52df07[_0xf29e('0x1e')];this[_0xf29e('0x1f')]=_0x52df07[_0xf29e('0x1f')];this[_0xf29e('0x20')]=_0x4d790f[_0xf29e('0x20')];this[_0xf29e('0x21')]=_0x4d790f[_0xf29e('0x21')];this[_0xf29e('0x22')]=_0x4d790f['callbackat'];this['recallme']=_0x4d790f[_0xf29e('0x23')];this[_0xf29e('0x24')]=_0x4d790f['ContactId'];this[_0xf29e('0x25')]=_0x4d790f[_0xf29e('0x25')];this[_0xf29e('0x26')]=_0x4d790f[_0xf29e('0x26')];this['VoiceQueueId']=_0x4d790f['VoiceQueueId'];this[_0xf29e('0x27')]=_0x4d790f[_0xf29e('0x27')];this['originatecalleridnum']=_0x4d790f[_0xf29e('0x28')]||'';this['originatecalleridname']=_0x4d790f[_0xf29e('0x29')]||'';}module[_0xf29e('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index d499839..7508a62 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(_0x519905,_0x51a0f6){var _0x5cc73b=function(_0x38c7e5){while(--_0x38c7e5){_0x519905['push'](_0x519905['shift']());}};_0x5cc73b(++_0x51a0f6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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(_0x232871,_0x3bfef6){var _0x24aa6d=function(_0x187b9e){while(--_0x187b9e){_0x232871['push'](_0x232871['shift']());}};_0x24aa6d(++_0x3bfef6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 7bf79d3..097af65 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 _0x232b=['AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','active','isNil','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','fax','../ami','./rpcDb','./util/util','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','channelstate','channelstatedesc','operation','status','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','parse','.pdf','application/pdf','then','notify','catch','error','\x20receiveFax\x20','stringify','pick','response','reason'];(function(_0x381965,_0x4f4576){var _0x59d570=function(_0x135422){while(--_0x135422){_0x381965['push'](_0x381965['shift']());}};_0x59d570(++_0x4f4576);}(_0x232b,0x9e));var _0xb232=function(_0x28beb4,_0x4cd9a6){_0x28beb4=_0x28beb4-0x0;var _0x2d826a=_0x232b[_0x28beb4];return _0x2d826a;};'use strict';var util=require(_0xb232('0x0'));var _=require(_0xb232('0x1'));var BPromise=require(_0xb232('0x2'));var uuid=require(_0xb232('0x3'));var moment=require(_0xb232('0x4'));var path=require(_0xb232('0x5'));var tiff2pdf=require(_0xb232('0x6'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0xb232('0x7'));var ami=require(_0xb232('0x8'));var rpcDb=require(_0xb232('0x9'));var Channel=require('./channel');var ut=require(_0xb232('0xa'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xb232('0xb'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x739209){this[_0xb232('0xc')]={};this['faxAccounts']=_0x739209[_0xb232('0xd')];this[_0xb232('0xe')]=_0x739209['trunks'];this[_0xb232('0xf')]={};ami['on'](_0xb232('0x10'),this[_0xb232('0x11')][_0xb232('0x12')](this));ami['on'](_0xb232('0x13'),this[_0xb232('0x14')][_0xb232('0x12')](this));ami['on']('newstate',this[_0xb232('0x15')][_0xb232('0x12')](this));ami['on']('newexten',this[_0xb232('0x16')][_0xb232('0x12')](this));ami['on'](_0xb232('0x17'),this[_0xb232('0x18')][_0xb232('0x12')](this));ami['on'](_0xb232('0x19'),this['syncReceiveFax'][_0xb232('0x12')](this));ami['on']('hangup',this[_0xb232('0x1a')][_0xb232('0x12')](this));ami['on']('originateresponse',this[_0xb232('0x1b')][_0xb232('0x12')](this));}Fax[_0xb232('0x1c')][_0xb232('0x11')]=function(_0x4900c5){if(_0x4900c5[_0xb232('0x1d')]===_0xb232('0x1e')){for(var _0x2b9004 in this[_0xb232('0xd')]){if(this[_0xb232('0xd')][_0xb232('0x1f')](_0x2b9004)){if(_0x4900c5[_0xb232('0x20')]===this[_0xb232('0xd')][_0x2b9004][_0xb232('0x21')]){this[_0xb232('0xc')][_0x4900c5[_0xb232('0x22')]]={};this[_0xb232('0xc')][_0x4900c5[_0xb232('0x22')]][_0xb232('0x23')]=_0x4900c5[_0xb232('0x23')];this[_0xb232('0xc')][_0x4900c5[_0xb232('0x22')]]['id']=this['faxAccounts'][_0x2b9004]['id'];this['channels'][_0x4900c5[_0xb232('0x22')]][_0xb232('0x24')]=this[_0xb232('0xd')][_0x2b9004][_0xb232('0x24')];logger['info'](_0x4900c5[_0xb232('0x22')],_0xb232('0x25'));}}}}if(this['actions'][_0x4900c5[_0xb232('0x22')]]){this[_0xb232('0xc')][_0x4900c5[_0xb232('0x22')]]={};this['channels'][_0x4900c5[_0xb232('0x22')]]['channel']=_0x4900c5[_0xb232('0x23')];logger[_0xb232('0x26')](_0x4900c5['uniqueid'],_0xb232('0x25'));}};Fax[_0xb232('0x1c')][_0xb232('0x14')]=function(_0x529be5){if(this[_0xb232('0xc')][_0x529be5['uniqueid']]){for(var _0x343b1e in _0x529be5[_0xb232('0x27')]){if(_0x529be5[_0xb232('0x27')][_0xb232('0x1f')](_0x343b1e)){this[_0xb232('0xc')][_0x529be5['uniqueid']][_0x343b1e]=_0x529be5[_0xb232('0x28')];}}}};Fax[_0xb232('0x1c')]['syncNewState']=function(_0x56b9f9){if(this[_0xb232('0xc')][_0x56b9f9[_0xb232('0x22')]]){this[_0xb232('0xc')][_0x56b9f9['uniqueid']][_0xb232('0x29')]=_0x56b9f9[_0xb232('0x29')];this[_0xb232('0xc')][_0x56b9f9[_0xb232('0x22')]][_0xb232('0x2a')]=_0x56b9f9['channelstatedesc'];}};Fax[_0xb232('0x1c')][_0xb232('0x16')]=function(_0xd70702){if(this[_0xb232('0xc')][_0xd70702[_0xb232('0x22')]]){for(var _0xc5a8a4 in _0xd70702[_0xb232('0x27')]){if(_0xd70702['variable']['hasOwnProperty'](_0xc5a8a4)){this[_0xb232('0xc')][_0xd70702[_0xb232('0x22')]][_0xc5a8a4]=_0xd70702[_0xb232('0x28')];}}}};Fax['prototype'][_0xb232('0x18')]=function(_0x1094f5){if(this['channels'][_0x1094f5[_0xb232('0x22')]]){this[_0xb232('0xc')][_0x1094f5[_0xb232('0x22')]][_0xb232('0x2b')]=_0x1094f5[_0xb232('0x2b')];this[_0xb232('0xc')][_0x1094f5['uniqueid']][_0xb232('0x2c')]=_0x1094f5[_0xb232('0x2c')];this[_0xb232('0xc')][_0x1094f5['uniqueid']][_0xb232('0x21')]=_0x1094f5[_0xb232('0x21')];this[_0xb232('0xc')][_0x1094f5[_0xb232('0x22')]]['filename']=_0x1094f5['filename'];logger[_0xb232('0x26')](_0x1094f5[_0xb232('0x22')],_0xb232('0x2d'));}};Fax[_0xb232('0x1c')][_0xb232('0x2e')]=function(_0x2713d0){var _0x31cdd6=this;if(this[_0xb232('0xc')][_0x2713d0[_0xb232('0x22')]]){var _0x330296=this[_0xb232('0xc')][_0x2713d0[_0xb232('0x22')]]['id'];this[_0xb232('0xc')][_0x2713d0[_0xb232('0x22')]][_0xb232('0x2f')]=_0x2713d0['remotestationid'];this[_0xb232('0xc')][_0x2713d0['uniqueid']][_0xb232('0x30')]=_0x2713d0['pagestransferred'];this['channels'][_0x2713d0['uniqueid']][_0xb232('0x21')]=_0x2713d0[_0xb232('0x21')];this[_0xb232('0xc')][_0x2713d0['uniqueid']][_0xb232('0x31')]=_0x2713d0[_0xb232('0x31')];this[_0xb232('0xc')][_0x2713d0[_0xb232('0x22')]][_0xb232('0x32')]=_0x2713d0['transferrate'];this[_0xb232('0xc')][_0x2713d0[_0xb232('0x22')]][_0xb232('0x33')]=_0x2713d0[_0xb232('0x33')];this[_0xb232('0xc')][_0x2713d0[_0xb232('0x22')]]['calleridnum']=_0x2713d0[_0xb232('0x34')];if(this[_0xb232('0xc')][_0x2713d0[_0xb232('0x22')]]['pagestransferred']>0x0){tiff2pdf(_0x2713d0[_0xb232('0x33')],_0xb232('0x35'),function(_0x5f23c9){logger['info'](_0x2713d0[_0xb232('0x22')],'\x20result\x20conversion\x20file\x20',_0x5f23c9['message']);attachment['create']({'name':path[_0xb232('0x36')](_0x2713d0[_0xb232('0x33')])[_0xb232('0x24')],'basename':path[_0xb232('0x36')](_0x2713d0['filename'])['name']+_0xb232('0x37'),'type':_0xb232('0x38')})[_0xb232('0x39')](function(_0x26b68e){faxAccount[_0xb232('0x3a')](_0x330296,{'from':_0x2713d0[_0xb232('0x34')],'mapKey':_0xb232('0x7'),'body':path[_0xb232('0x36')](_0x2713d0[_0xb232('0x33')])['name']+_0xb232('0x37'),'AttachmentId':_0x26b68e['id']})[_0xb232('0x3b')](function(_0x4346c7){logger[_0xb232('0x3c')](_0x2713d0[_0xb232('0x22')],'\x20notify\x20',JSON['stringify'](_0x4346c7));});})[_0xb232('0x3b')](function(_0x1f28f7){logger[_0xb232('0x3c')](_0x2713d0[_0xb232('0x22')],_0xb232('0x3d'),JSON[_0xb232('0x3e')](_0x1f28f7));});});}logger['info'](_0x2713d0[_0xb232('0x22')],_0xb232('0x3d'));}};Fax[_0xb232('0x1c')][_0xb232('0x1b')]=function(_0x22b788){if(this[_0xb232('0xf')][_0x22b788[_0xb232('0x22')]]){_['merge'](this[_0xb232('0xc')][_0x22b788[_0xb232('0x22')]],_[_0xb232('0x3f')](_0x22b788,[_0xb232('0x40'),_0xb232('0x41')]));}};function updateStatus(_0x2d9f6a){if(_0x2d9f6a[_0xb232('0x42')]){faxMessage[_0xb232('0x43')](_0x2d9f6a[_0xb232('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x8a1a7b){ut[_0xb232('0x44')](_0xb232('0x45'),_0x8a1a7b);})[_0xb232('0x3b')](function(_0x520a18){ut[_0xb232('0x44')](_0xb232('0x46'),_0x520a18);});}else{ut[_0xb232('0x44')](_0xb232('0x47'));}}Fax['prototype'][_0xb232('0x48')]=function(_0x41b618,_0x5c8fb1,_0x3a307e){var _0x3ce4f3=this;var _0x54a2d4={};if(_0x5c8fb1){_0x54a2d4={'read':_0x5c8fb1};}else{_0x54a2d4={'failMessage':_0x3a307e};}if(this[_0xb232('0xf')][_0x41b618][_0xb232('0x42')]){faxMessage[_0xb232('0x43')](this[_0xb232('0xf')][_0x41b618][_0xb232('0x42')],_0x54a2d4)['then'](function(_0x2360d3){ut[_0xb232('0x44')]('[Fax][Message][Updated]',_0x2360d3);})[_0xb232('0x3b')](function(_0x1ab035){ut[_0xb232('0x44')]('[Fax][Message][NoUpdate1]',_0x1ab035);})[_0xb232('0x49')](function(){delete _0x3ce4f3[_0xb232('0xc')][_0x41b618];delete _0x3ce4f3['actions'][_0x41b618];});}else{ut[_0xb232('0x44')]('[Fax][Message][NoUpdate2]');delete this[_0xb232('0xc')][_0x41b618];delete this[_0xb232('0xf')][_0x41b618];}};Fax[_0xb232('0x1c')]['syncHangup']=function(_0x54fee6){var _0x158416=this;if(this[_0xb232('0xc')][_0x54fee6[_0xb232('0x22')]]){if(this['actions'][_0x54fee6[_0xb232('0x22')]]){this[_0xb232('0xc')][_0x54fee6[_0xb232('0x22')]]['id']=this[_0xb232('0xf')][_0x54fee6['uniqueid']]['id'];this[_0xb232('0xc')][_0x54fee6[_0xb232('0x22')]]['name']=this['actions'][_0x54fee6[_0xb232('0x22')]][_0xb232('0x24')];}logger['info'](_0x54fee6['uniqueid'],this[_0xb232('0xf')][_0x54fee6[_0xb232('0x22')]]?_0xb232('0x4a'):_0xb232('0x4b'),JSON[_0xb232('0x3e')](this[_0xb232('0xc')][_0x54fee6[_0xb232('0x22')]]));if(this[_0xb232('0xf')][_0x54fee6[_0xb232('0x22')]]){if(this[_0xb232('0xc')][_0x54fee6['uniqueid']][_0xb232('0x4c')]>0x0&&this['channels'][_0x54fee6[_0xb232('0x22')]][_0xb232('0x17')]==='SUCCESS'){this[_0xb232('0x48')](_0x54fee6['uniqueid'],!![]);}else{this[_0xb232('0x48')](_0x54fee6[_0xb232('0x22')],![],this[_0xb232('0xc')][_0x54fee6[_0xb232('0x22')]][_0xb232('0x4d')]?'SENDING\x20FAILED:\x20'+this[_0xb232('0xc')][_0x54fee6[_0xb232('0x22')]]['faxstatusstring']:_0xb232('0x4e'));}}}};Fax['prototype'][_0xb232('0x4f')]=function(_0x49e297){var _0x32e57f=this;return new BPromise(function(_0x1e4795,_0x275f95){_0x32e57f[_0xb232('0x50')](_0x49e297,_0x32e57f[_0xb232('0xd')][_0x49e297[_0xb232('0x51')]])['then'](function(_0x1488f7){ut[_0xb232('0x44')](_0xb232('0x52'),_0x1488f7);_0x1e4795(ut[_0xb232('0x53')](_0xb232('0x54')));})[_0xb232('0x3b')](function(_0x46e856){ut[_0xb232('0x44')](_0xb232('0x55'),_0x46e856);updateStatus(_0x49e297);_0x275f95(ut[_0xb232('0x53')](_0xb232('0x56')));});});};Fax[_0xb232('0x1c')]['checkAfterSend']=function(_0x3ae068){var _0x128668=this;return new BPromise(function(_0x1a2f35,_0x36aa1c){var _0x39f97b=_0x128668[_0xb232('0x57')](_0x128668[_0xb232('0xd')][_0x3ae068['FaxAccountId']][_0xb232('0x58')],_0x3ae068);if(_0x39f97b[_0xb232('0x59')]){_0x1a2f35(ut[_0xb232('0x53')](_0xb232('0x5a')));}else{_0x36aa1c(ut[_0xb232('0x53')](_0x39f97b['message']));}});};function originate(_0x58d7f4,_0x3db9b5,_0x428d0a){return new BPromise(function(_0x2a95eb,_0x57c38b){if(_0x428d0a){var _0x629f63=util[_0xb232('0x5b')](_0xb232('0x5c'),path[_0xb232('0x36')](_0x58d7f4['path'])[_0xb232('0x24')],_0x58d7f4['path']);gs[_0xb232('0x5d')](_0x629f63)[_0xb232('0x39')](function(){_0x58d7f4[_0xb232('0x5')]=util[_0xb232('0x5b')](_0xb232('0x5e'),path[_0xb232('0x36')](_0x58d7f4[_0xb232('0x5')])[_0xb232('0x5f')],path[_0xb232('0x36')](_0x58d7f4[_0xb232('0x5')])[_0xb232('0x24')]);_0x3db9b5['XMF-PATH']=_0x58d7f4[_0xb232('0x5')];ut[_0xb232('0x44')](_0xb232('0x60'),'');ami['Action'](ut['variablesAction'](_0x58d7f4,_0x3db9b5))[_0xb232('0x39')](function(_0x25112d){_0x2a95eb(_0x25112d);})[_0xb232('0x3b')](function(_0x157f6b){_0x57c38b(_0x157f6b);});})[_0xb232('0x3b')](function(_0x29efb8){_0x57c38b(_0x29efb8);});}else{ami[_0xb232('0x61')](ut[_0xb232('0x62')](_0x58d7f4,_0x3db9b5))['then'](function(_0x38b934){_0x2a95eb(_0x38b934);})[_0xb232('0x3b')](function(_0x50e9fd){_0x57c38b(_0x50e9fd);});}});}Fax[_0xb232('0x1c')]['execOriginate']=function(_0x307926,_0x954ca4){var _0x1b6305=this;return new BPromise(function(_0x28cd44,_0x421061){var _0x5ab0dd=uuid['v4']();var _0xc5d395=ut[_0xb232('0x63')](_0x307926,_0x954ca4);_0x1b6305[_0xb232('0xf')][_0x5ab0dd]=new Action(_0x5ab0dd,_0x954ca4,_0x307926);var _0x3fb7dc=_0x1b6305[_0xb232('0xf')][_0x5ab0dd];if(path[_0xb232('0x36')](_0x307926[_0xb232('0x5')])['ext']==='.pdf'){originate(_0x3fb7dc,_0xc5d395,!![])[_0xb232('0x39')](function(_0x3152ee){_0x28cd44(_0x3152ee);})['catch'](function(_0xaa0dba){_0x421061(_0xaa0dba);});}else{originate(_0x3fb7dc,_0xc5d395,![])[_0xb232('0x39')](function(_0x23d571){_0x28cd44(_0x23d571);})['catch'](function(_0x25aa94){_0x421061(_0x25aa94);});}});};Fax[_0xb232('0x1c')][_0xb232('0x64')]=function(_0x2fd603){return!_['isNil'](_0x2fd603)&&!_['isNil'](_0x2fd603[_0xb232('0x24')])&&!_['isNil'](_0x2fd603['active'])&&_0x2fd603[_0xb232('0x65')]&&!_[_0xb232('0x66')](this['trunks'][util[_0xb232('0x5b')](_0xb232('0x67'),_0x2fd603['name'])])&&!_[_0xb232('0x66')](this[_0xb232('0xe')][util[_0xb232('0x5b')](_0xb232('0x67'),_0x2fd603[_0xb232('0x24')])][_0xb232('0x2c')])&&(this[_0xb232('0xe')][util[_0xb232('0x5b')](_0xb232('0x67'),_0x2fd603[_0xb232('0x24')])][_0xb232('0x2c')]==='reachable'||this[_0xb232('0xe')][util[_0xb232('0x5b')](_0xb232('0x67'),_0x2fd603[_0xb232('0x24')])]['status']==='unmonitored');};Fax[_0xb232('0x1c')][_0xb232('0x57')]=function(_0x380210,_0x5ab41c){if(!this['isTrunkReachable'](_0x380210)){ut[_0xb232('0x44')](_0xb232('0x68'),_[_0xb232('0x66')](_0x380210)?'':_0x380210[_0xb232('0x24')]+_0xb232('0x69'));return{'isValid':![],'message':_0xb232('0x6a')};}if(_['isNil'](_0x5ab41c[_0xb232('0x7')])){ut[_0xb232('0x44')](_0xb232('0x6b'),JSON[_0xb232('0x3e')](_0x5ab41c));return{'isValid':![],'message':_0xb232('0x6c')};}if(_['isNil'](_0x5ab41c[_0xb232('0x5')])){ut['logger'](_0xb232('0x6d'),JSON['stringify'](_0x5ab41c));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xb232('0x6e')};};module[_0xb232('0x6f')]=Fax; \ No newline at end of file +var _0x2256=['Fax\x20failed','checkAfterSend','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','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','[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','bluebird','uuid','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','info','\x20syncNewchannel\x20','actions','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','parse','name','application/pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','update','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxstatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]'];(function(_0x4f11c8,_0x23f93c){var _0x1b6ef3=function(_0x5c4ab4){while(--_0x5c4ab4){_0x4f11c8['push'](_0x4f11c8['shift']());}};_0x1b6ef3(++_0x23f93c);}(_0x2256,0x1da));var _0x6225=function(_0x5309af,_0x4129ff){_0x5309af=_0x5309af-0x0;var _0x496f8e=_0x2256[_0x5309af];return _0x496f8e;};'use strict';var util=require(_0x6225('0x0'));var _=require('lodash');var BPromise=require(_0x6225('0x1'));var uuid=require(_0x6225('0x2'));var moment=require('moment');var path=require(_0x6225('0x3'));var tiff2pdf=require(_0x6225('0x4'));var gs=require('./util/gs');var logger=require(_0x6225('0x5'))(_0x6225('0x6'));var ami=require(_0x6225('0x7'));var rpcDb=require(_0x6225('0x8'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0x6225('0x9'));var faxAccount=require(_0x6225('0xa'));var attachment=require(_0x6225('0xb'));var faxMessage=require(_0x6225('0xc'));function Fax(_0x3ed803){this[_0x6225('0xd')]={};this[_0x6225('0xe')]=_0x3ed803[_0x6225('0xe')];this['trunks']=_0x3ed803[_0x6225('0xf')];this['actions']={};ami['on'](_0x6225('0x10'),this[_0x6225('0x11')][_0x6225('0x12')](this));ami['on'](_0x6225('0x13'),this[_0x6225('0x14')][_0x6225('0x12')](this));ami['on'](_0x6225('0x15'),this[_0x6225('0x16')][_0x6225('0x12')](this));ami['on'](_0x6225('0x17'),this[_0x6225('0x18')][_0x6225('0x12')](this));ami['on']('faxstatus',this[_0x6225('0x19')][_0x6225('0x12')](this));ami['on'](_0x6225('0x1a'),this[_0x6225('0x1b')][_0x6225('0x12')](this));ami['on']('hangup',this[_0x6225('0x1c')][_0x6225('0x12')](this));ami['on']('originateresponse',this[_0x6225('0x1d')][_0x6225('0x12')](this));}Fax[_0x6225('0x1e')][_0x6225('0x11')]=function(_0x5253ca){if(_0x5253ca[_0x6225('0x1f')]===_0x6225('0x20')){for(var _0x10dd39 in this[_0x6225('0xe')]){if(this[_0x6225('0xe')][_0x6225('0x21')](_0x10dd39)){if(_0x5253ca['exten']===this[_0x6225('0xe')][_0x10dd39][_0x6225('0x22')]){this[_0x6225('0xd')][_0x5253ca[_0x6225('0x23')]]={};this[_0x6225('0xd')][_0x5253ca[_0x6225('0x23')]][_0x6225('0x24')]=_0x5253ca[_0x6225('0x24')];this['channels'][_0x5253ca['uniqueid']]['id']=this['faxAccounts'][_0x10dd39]['id'];this[_0x6225('0xd')][_0x5253ca[_0x6225('0x23')]]['name']=this[_0x6225('0xe')][_0x10dd39]['name'];logger[_0x6225('0x25')](_0x5253ca[_0x6225('0x23')],_0x6225('0x26'));}}}}if(this[_0x6225('0x27')][_0x5253ca[_0x6225('0x23')]]){this['channels'][_0x5253ca['uniqueid']]={};this[_0x6225('0xd')][_0x5253ca['uniqueid']]['channel']=_0x5253ca[_0x6225('0x24')];logger[_0x6225('0x25')](_0x5253ca[_0x6225('0x23')],_0x6225('0x26'));}};Fax[_0x6225('0x1e')][_0x6225('0x14')]=function(_0x1fdce5){if(this[_0x6225('0xd')][_0x1fdce5['uniqueid']]){for(var _0x73b990 in _0x1fdce5[_0x6225('0x28')]){if(_0x1fdce5['variable'][_0x6225('0x21')](_0x73b990)){this['channels'][_0x1fdce5['uniqueid']][_0x73b990]=_0x1fdce5[_0x6225('0x29')];}}}};Fax['prototype']['syncNewState']=function(_0x19f75f){if(this['channels'][_0x19f75f[_0x6225('0x23')]]){this[_0x6225('0xd')][_0x19f75f[_0x6225('0x23')]]['channelstate']=_0x19f75f[_0x6225('0x2a')];this['channels'][_0x19f75f[_0x6225('0x23')]][_0x6225('0x2b')]=_0x19f75f[_0x6225('0x2b')];}};Fax[_0x6225('0x1e')][_0x6225('0x18')]=function(_0x5c298c){if(this[_0x6225('0xd')][_0x5c298c[_0x6225('0x23')]]){for(var _0x129fc6 in _0x5c298c['variable']){if(_0x5c298c['variable'][_0x6225('0x21')](_0x129fc6)){this[_0x6225('0xd')][_0x5c298c[_0x6225('0x23')]][_0x129fc6]=_0x5c298c[_0x6225('0x29')];}}}};Fax[_0x6225('0x1e')]['syncFaxStatus']=function(_0x1a9001){if(this['channels'][_0x1a9001['uniqueid']]){this[_0x6225('0xd')][_0x1a9001['uniqueid']][_0x6225('0x2c')]=_0x1a9001['operation'];this[_0x6225('0xd')][_0x1a9001['uniqueid']]['status']=_0x1a9001[_0x6225('0x2d')];this[_0x6225('0xd')][_0x1a9001[_0x6225('0x23')]][_0x6225('0x22')]=_0x1a9001['localstationid'];this[_0x6225('0xd')][_0x1a9001[_0x6225('0x23')]][_0x6225('0x2e')]=_0x1a9001[_0x6225('0x2e')];logger['info'](_0x1a9001[_0x6225('0x23')],_0x6225('0x2f'));}};Fax['prototype'][_0x6225('0x1b')]=function(_0x16c6c0){var _0x3cc2af=this;if(this[_0x6225('0xd')][_0x16c6c0[_0x6225('0x23')]]){var _0x4795a9=this['channels'][_0x16c6c0[_0x6225('0x23')]]['id'];this['channels'][_0x16c6c0[_0x6225('0x23')]][_0x6225('0x30')]=_0x16c6c0[_0x6225('0x30')];this[_0x6225('0xd')][_0x16c6c0[_0x6225('0x23')]][_0x6225('0x31')]=_0x16c6c0[_0x6225('0x31')];this[_0x6225('0xd')][_0x16c6c0['uniqueid']][_0x6225('0x22')]=_0x16c6c0[_0x6225('0x22')];this['channels'][_0x16c6c0['uniqueid']][_0x6225('0x32')]=_0x16c6c0['resolution'];this[_0x6225('0xd')][_0x16c6c0[_0x6225('0x23')]][_0x6225('0x33')]=_0x16c6c0['transferrate'];this[_0x6225('0xd')][_0x16c6c0['uniqueid']][_0x6225('0x2e')]=_0x16c6c0['filename'];this[_0x6225('0xd')][_0x16c6c0[_0x6225('0x23')]][_0x6225('0x34')]=_0x16c6c0[_0x6225('0x34')];if(this[_0x6225('0xd')][_0x16c6c0[_0x6225('0x23')]][_0x6225('0x31')]>0x0){tiff2pdf(_0x16c6c0['filename'],_0x6225('0x35'),function(_0x48d437){logger['info'](_0x16c6c0[_0x6225('0x23')],'\x20result\x20conversion\x20file\x20',_0x48d437[_0x6225('0x36')]);attachment['create']({'name':path[_0x6225('0x37')](_0x16c6c0[_0x6225('0x2e')])[_0x6225('0x38')],'basename':path[_0x6225('0x37')](_0x16c6c0['filename'])[_0x6225('0x38')]+'.pdf','type':_0x6225('0x39')})[_0x6225('0x3a')](function(_0x5d52d7){faxAccount['notify'](_0x4795a9,{'from':_0x16c6c0[_0x6225('0x34')],'mapKey':_0x6225('0x6'),'body':path[_0x6225('0x37')](_0x16c6c0[_0x6225('0x2e')])[_0x6225('0x38')]+'.pdf','AttachmentId':_0x5d52d7['id']})[_0x6225('0x3b')](function(_0x1e2316){logger[_0x6225('0x3c')](_0x16c6c0['uniqueid'],_0x6225('0x3d'),JSON[_0x6225('0x3e')](_0x1e2316));});})[_0x6225('0x3b')](function(_0x37312f){logger[_0x6225('0x3c')](_0x16c6c0['uniqueid'],_0x6225('0x3f'),JSON[_0x6225('0x3e')](_0x37312f));});});}logger[_0x6225('0x25')](_0x16c6c0[_0x6225('0x23')],_0x6225('0x3f'));}};Fax[_0x6225('0x1e')]['syncOriginateResponse']=function(_0x55b100){if(this[_0x6225('0x27')][_0x55b100[_0x6225('0x23')]]){_[_0x6225('0x40')](this[_0x6225('0xd')][_0x55b100[_0x6225('0x23')]],_[_0x6225('0x41')](_0x55b100,[_0x6225('0x42'),_0x6225('0x43')]));}};function updateStatus(_0x5c2d73){if(_0x5c2d73[_0x6225('0x44')]){faxMessage['update'](_0x5c2d73[_0x6225('0x44')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x6225('0x3a')](function(_0x37cb9b){ut[_0x6225('0x45')]('[Fax][Message][Error][Updated]',_0x37cb9b);})['catch'](function(_0x1871f4){ut[_0x6225('0x45')]('[Fax][Message][Error][NoUpdate1]',_0x1871f4);});}else{ut[_0x6225('0x45')](_0x6225('0x46'));}}Fax['prototype'][_0x6225('0x47')]=function(_0x34d617,_0x3a13cc,_0x2f0e89){var _0x45d202=this;var _0x2e835d={};if(_0x3a13cc){_0x2e835d={'read':_0x3a13cc};}else{_0x2e835d={'failMessage':_0x2f0e89};}if(this['actions'][_0x34d617][_0x6225('0x44')]){faxMessage[_0x6225('0x48')](this[_0x6225('0x27')][_0x34d617]['AttachmentId'],_0x2e835d)['then'](function(_0x2599c2){ut[_0x6225('0x45')]('[Fax][Message][Updated]',_0x2599c2);})[_0x6225('0x3b')](function(_0x5bf3e1){ut[_0x6225('0x45')](_0x6225('0x49'),_0x5bf3e1);})['finally'](function(){delete _0x45d202[_0x6225('0xd')][_0x34d617];delete _0x45d202[_0x6225('0x27')][_0x34d617];});}else{ut[_0x6225('0x45')](_0x6225('0x4a'));delete this[_0x6225('0xd')][_0x34d617];delete this[_0x6225('0x27')][_0x34d617];}};Fax[_0x6225('0x1e')][_0x6225('0x1c')]=function(_0x4a1325){var _0x846f25=this;if(this[_0x6225('0xd')][_0x4a1325['uniqueid']]){if(this[_0x6225('0x27')][_0x4a1325[_0x6225('0x23')]]){this['channels'][_0x4a1325[_0x6225('0x23')]]['id']=this[_0x6225('0x27')][_0x4a1325[_0x6225('0x23')]]['id'];this[_0x6225('0xd')][_0x4a1325[_0x6225('0x23')]]['name']=this['actions'][_0x4a1325[_0x6225('0x23')]][_0x6225('0x38')];}logger[_0x6225('0x25')](_0x4a1325[_0x6225('0x23')],this['actions'][_0x4a1325['uniqueid']]?_0x6225('0x4b'):_0x6225('0x4c'),JSON[_0x6225('0x3e')](this[_0x6225('0xd')][_0x4a1325['uniqueid']]));if(this[_0x6225('0x27')][_0x4a1325[_0x6225('0x23')]]){if(this[_0x6225('0xd')][_0x4a1325[_0x6225('0x23')]]['faxpages']>0x0&&this['channels'][_0x4a1325[_0x6225('0x23')]][_0x6225('0x4d')]==='SUCCESS'){this['updateStatus'](_0x4a1325[_0x6225('0x23')],!![]);}else{this[_0x6225('0x47')](_0x4a1325[_0x6225('0x23')],![],this[_0x6225('0xd')][_0x4a1325[_0x6225('0x23')]][_0x6225('0x4e')]?_0x6225('0x4f')+this[_0x6225('0xd')][_0x4a1325[_0x6225('0x23')]]['faxstatusstring']:_0x6225('0x50'));}}}};Fax[_0x6225('0x1e')][_0x6225('0x51')]=function(_0x59fa5e){var _0xa1f9b2=this;return new BPromise(function(_0x9b5f,_0x393d3a){_0xa1f9b2[_0x6225('0x52')](_0x59fa5e,_0xa1f9b2[_0x6225('0xe')][_0x59fa5e[_0x6225('0x53')]])[_0x6225('0x3a')](function(_0x3ab835){ut['logger'](_0x6225('0x54'),_0x3ab835);_0x9b5f(ut[_0x6225('0x36')]('Fax\x20received'));})['catch'](function(_0x1a4556){ut[_0x6225('0x45')](_0x6225('0x55'),_0x1a4556);updateStatus(_0x59fa5e);_0x393d3a(ut[_0x6225('0x36')](_0x6225('0x56')));});});};Fax[_0x6225('0x1e')][_0x6225('0x57')]=function(_0x3011ea){var _0x193313=this;return new BPromise(function(_0x4aaaab,_0x3a4d03){var _0x3d2852=_0x193313['checkTrunk'](_0x193313[_0x6225('0xe')][_0x3011ea['FaxAccountId']]['Trunk'],_0x3011ea);if(_0x3d2852['isValid']){_0x4aaaab(ut['message'](_0x6225('0x58')));}else{_0x3a4d03(ut[_0x6225('0x36')](_0x3d2852[_0x6225('0x36')]));}});};function originate(_0x317e4b,_0x589c3a,_0x5e249b){return new BPromise(function(_0x5ddf62,_0x233af8){if(_0x5e249b){var _0x3f7a97=util[_0x6225('0x59')](_0x6225('0x5a'),path['parse'](_0x317e4b[_0x6225('0x3')])[_0x6225('0x38')],_0x317e4b[_0x6225('0x3')]);gs[_0x6225('0x5b')](_0x3f7a97)['then'](function(){_0x317e4b[_0x6225('0x3')]=util[_0x6225('0x59')](_0x6225('0x5c'),path[_0x6225('0x37')](_0x317e4b[_0x6225('0x3')])[_0x6225('0x5d')],path[_0x6225('0x37')](_0x317e4b['path'])[_0x6225('0x38')]);_0x589c3a['XMF-PATH']=_0x317e4b[_0x6225('0x3')];ut[_0x6225('0x45')]('Convert\x20pdf\x20to\x20tif','');ami[_0x6225('0x5e')](ut[_0x6225('0x5f')](_0x317e4b,_0x589c3a))[_0x6225('0x3a')](function(_0x3b028f){_0x5ddf62(_0x3b028f);})[_0x6225('0x3b')](function(_0x24f4fd){_0x233af8(_0x24f4fd);});})[_0x6225('0x3b')](function(_0x3dc640){_0x233af8(_0x3dc640);});}else{ami[_0x6225('0x5e')](ut[_0x6225('0x5f')](_0x317e4b,_0x589c3a))[_0x6225('0x3a')](function(_0x3d4ff0){_0x5ddf62(_0x3d4ff0);})[_0x6225('0x3b')](function(_0x2c7671){_0x233af8(_0x2c7671);});}});}Fax[_0x6225('0x1e')][_0x6225('0x52')]=function(_0x2e62c8,_0x2aaf06){var _0x325d47=this;return new BPromise(function(_0x11ce20,_0x537524){var _0x1928ea=uuid['v4']();var _0x9e4ca5=ut['addVariables'](_0x2e62c8,_0x2aaf06);_0x325d47[_0x6225('0x27')][_0x1928ea]=new Action(_0x1928ea,_0x2aaf06,_0x2e62c8);var _0x36300f=_0x325d47[_0x6225('0x27')][_0x1928ea];if(path['parse'](_0x2e62c8[_0x6225('0x3')])[_0x6225('0x60')]==='.pdf'){originate(_0x36300f,_0x9e4ca5,!![])[_0x6225('0x3a')](function(_0x1bbf53){_0x11ce20(_0x1bbf53);})[_0x6225('0x3b')](function(_0x3379d6){_0x537524(_0x3379d6);});}else{originate(_0x36300f,_0x9e4ca5,![])[_0x6225('0x3a')](function(_0x3415cd){_0x11ce20(_0x3415cd);})[_0x6225('0x3b')](function(_0x487f4a){_0x537524(_0x487f4a);});}});};Fax[_0x6225('0x1e')][_0x6225('0x61')]=function(_0x4ddf99){return!_['isNil'](_0x4ddf99)&&!_[_0x6225('0x62')](_0x4ddf99['name'])&&!_[_0x6225('0x62')](_0x4ddf99[_0x6225('0x63')])&&_0x4ddf99[_0x6225('0x63')]&&!_['isNil'](this[_0x6225('0xf')][util[_0x6225('0x59')](_0x6225('0x64'),_0x4ddf99[_0x6225('0x38')])])&&!_[_0x6225('0x62')](this[_0x6225('0xf')][util['format'](_0x6225('0x64'),_0x4ddf99[_0x6225('0x38')])][_0x6225('0x2d')])&&(this[_0x6225('0xf')][util[_0x6225('0x59')]('SIP/%s',_0x4ddf99['name'])][_0x6225('0x2d')]===_0x6225('0x65')||this[_0x6225('0xf')][util['format']('SIP/%s',_0x4ddf99[_0x6225('0x38')])][_0x6225('0x2d')]==='unmonitored');};Fax[_0x6225('0x1e')][_0x6225('0x66')]=function(_0x4a234b,_0x1fc2cf){if(!this['isTrunkReachable'](_0x4a234b)){ut[_0x6225('0x45')](_0x6225('0x67'),_[_0x6225('0x62')](_0x4a234b)?'':_0x4a234b[_0x6225('0x38')]+_0x6225('0x68'));return{'isValid':![],'message':_0x6225('0x69')};}if(_['isNil'](_0x1fc2cf[_0x6225('0x6')])){ut[_0x6225('0x45')](_0x6225('0x6a'),JSON['stringify'](_0x1fc2cf));return{'isValid':![],'message':_0x6225('0x6b')};}if(_['isNil'](_0x1fc2cf[_0x6225('0x3')])){ut[_0x6225('0x45')](_0x6225('0x6c'),JSON['stringify'](_0x1fc2cf));return{'isValid':![],'message':_0x6225('0x6d')};}return{'isValid':!![],'message':_0x6225('0x6e')};};module[_0x6225('0x6f')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 3f832ef..780fff4 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 _0x50ed=['bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','then','catch','util'];(function(_0x3f2b4f,_0x468161){var _0x40e324=function(_0xc1036b){while(--_0xc1036b){_0x3f2b4f['push'](_0x3f2b4f['shift']());}};_0x40e324(++_0x468161);}(_0x50ed,0x1b7));var _0xd50e=function(_0x491504,_0x191d22){_0x491504=_0x491504-0x0;var _0x38ce43=_0x50ed[_0x491504];return _0x38ce43;};'use strict';var util=require(_0xd50e('0x0'));var BPromise=require(_0xd50e('0x1'));var logger=require(_0xd50e('0x2'))(_0xd50e('0x3'));var _=require(_0xd50e('0x4'));var faxAccount=require(_0xd50e('0x5'));function loggerCatch(_0x245166){return function(_0x4f3d20){logger[_0xd50e('0x6')](_0x245166,util[_0xd50e('0x7')](_0x4f3d20,{'showHidden':![],'depth':null}));};}exports[_0xd50e('0x8')]=function(_0x2cf3d5,_0xf4d340){return BPromise['resolve']()[_0xd50e('0x9')](faxAccount['notify'](_0x2cf3d5,_0xf4d340))[_0xd50e('0xa')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x4071=['bluebird','../../../config/logger','preview','lodash','error','inspect','notify','catch','util'];(function(_0x554814,_0x584e14){var _0x1234e0=function(_0x29b53d){while(--_0x29b53d){_0x554814['push'](_0x554814['shift']());}};_0x1234e0(++_0x584e14);}(_0x4071,0x1a6));var _0x1407=function(_0x40df38,_0x370e4e){_0x40df38=_0x40df38-0x0;var _0x41af26=_0x4071[_0x40df38];return _0x41af26;};'use strict';var util=require(_0x1407('0x0'));var BPromise=require(_0x1407('0x1'));var logger=require(_0x1407('0x2'))(_0x1407('0x3'));var _=require(_0x1407('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x2aa6f0){return function(_0x2a2dcd){logger[_0x1407('0x5')](_0x2aa6f0,util[_0x1407('0x6')](_0x2a2dcd,{'showHidden':![],'depth':null}));};}exports[_0x1407('0x7')]=function(_0x4eaf3d,_0x312d2b){return BPromise['resolve']()['then'](faxAccount[_0x1407('0x7')](_0x4eaf3d,_0x312d2b))[_0x1407('0x8')](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 11c85a1..b015b15 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 _0x58f4=['info','\x20Error\x20:','util','../../../../config/logger','bluebird','child_process','exec','execute','Exec\x20gs'];(function(_0x20023d,_0x297e49){var _0x298e2d=function(_0x48d582){while(--_0x48d582){_0x20023d['push'](_0x20023d['shift']());}};_0x298e2d(++_0x297e49);}(_0x58f4,0xa4));var _0x458f=function(_0xd05ccf,_0x2c0ebd){_0xd05ccf=_0xd05ccf-0x0;var _0x53e057=_0x58f4[_0xd05ccf];return _0x53e057;};'use strict';var util=require(_0x458f('0x0'));var logger=require(_0x458f('0x1'))('fax');var BPromise=require(_0x458f('0x2'));var exec=require(_0x458f('0x3'))[_0x458f('0x4')];exports[_0x458f('0x5')]=function(_0x4cd3c5){return new BPromise(function(_0x5e7de0,_0x18d864){exec(_0x4cd3c5,function(_0x2b3e8f,_0x168b04,_0x4aa7f2){logger['info'](_0x458f('0x6'),_0x168b04);if(_0x2b3e8f){logger[_0x458f('0x7')](_0x458f('0x6'),_0x458f('0x8'),util['inspect'](_0x2b3e8f,{'showHidden':![],'depth':null}),_0x168b04,_0x4aa7f2);_0x18d864(_0x2b3e8f);}_0x5e7de0(_0x168b04);});});}; \ No newline at end of file +var _0x4f4f=['bluebird','child_process','execute','Exec\x20gs','info','\x20Error\x20:','util','../../../../config/logger','fax'];(function(_0x39f77f,_0x4bf812){var _0x53b26f=function(_0x1246bc){while(--_0x1246bc){_0x39f77f['push'](_0x39f77f['shift']());}};_0x53b26f(++_0x4bf812);}(_0x4f4f,0xde));var _0xf4f4=function(_0x4cb9aa,_0x58b44f){_0x4cb9aa=_0x4cb9aa-0x0;var _0x2eff51=_0x4f4f[_0x4cb9aa];return _0x2eff51;};'use strict';var util=require(_0xf4f4('0x0'));var logger=require(_0xf4f4('0x1'))(_0xf4f4('0x2'));var BPromise=require(_0xf4f4('0x3'));var exec=require(_0xf4f4('0x4'))['exec'];exports[_0xf4f4('0x5')]=function(_0x2162e2){return new BPromise(function(_0x14c5a1,_0x202789){exec(_0x2162e2,function(_0x10e1c5,_0x13c1c7,_0xd6db37){logger['info'](_0xf4f4('0x6'),_0x13c1c7);if(_0x10e1c5){logger[_0xf4f4('0x7')](_0xf4f4('0x6'),_0xf4f4('0x8'),util['inspect'](_0x10e1c5,{'showHidden':![],'depth':null}),_0x13c1c7,_0xd6db37);_0x202789(_0x10e1c5);}_0x14c5a1(_0x13c1c7);});});}; \ 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 49cafea..1f6ee13 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 _0x5e40=['addVariables','ecm','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','moment','../../../../config/logger','fax','inspect'];(function(_0x35d0e7,_0x5c86d0){var _0x3ac03e=function(_0x2d99d0){while(--_0x2d99d0){_0x35d0e7['push'](_0x35d0e7['shift']());}};_0x3ac03e(++_0x5c86d0);}(_0x5e40,0x1da));var _0x05e4=function(_0x32b79a,_0xd2538a){_0x32b79a=_0x32b79a-0x0;var _0x483450=_0x5e40[_0x32b79a];return _0x483450;};'use strict';var util=require(_0x05e4('0x0'));var _=require(_0x05e4('0x1'));var moment=require(_0x05e4('0x2'));var logger=require(_0x05e4('0x3'))(_0x05e4('0x4'));exports['message']=function(_0x4481f6){return{'message':_0x4481f6};};exports['logger']=function(_0x176226,_0x5693f5){logger['info'](_0x176226,util[_0x05e4('0x5')](_0x5693f5,{'showHidden':![],'depth':null}));};exports[_0x05e4('0x6')]=function(_0x16eda7,_0x133722){var _0x4c04d4={'XMF-ECM':_0x133722[_0x05e4('0x7')],'XMF-HEADERINFO':_0x133722['headerinfo'],'XMF-MINRATE':_0x133722[_0x05e4('0x8')],'XMF-MAXRATE':_0x133722[_0x05e4('0x9')],'XMF-MODEM':util[_0x05e4('0xa')](_0x05e4('0xb'),_0x133722[_0x05e4('0xc')]),'XMF-GATEWAY':_0x133722[_0x05e4('0xd')],'XMF-FAXDETECT':_0x133722[_0x05e4('0xe')],'XMF-T38TIMEOUT':_0x133722[_0x05e4('0xf')],'XMF-LOCALSTATIONID':_0x133722[_0x05e4('0x10')],'XMF-PATH':_0x16eda7['path']};return _0x4c04d4;};exports[_0x05e4('0x11')]=function(_0x19b891,_0x184dbb){return{'actionid':_0x19b891[_0x05e4('0x12')],'action':_0x05e4('0x13'),'channel':_0x19b891[_0x05e4('0x14')],'Exten':_0x05e4('0x15'),'Context':_0x05e4('0x16'),'Priority':'1','callerid':util[_0x05e4('0xa')](_0x05e4('0x17'),_0x19b891['headerinfo']?_0x19b891['headerinfo']:'',_0x19b891[_0x05e4('0x10')]),'variable':_0x184dbb,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x19b891[_0x05e4('0x12')]};}; \ No newline at end of file +var _0xa11f=['maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','lodash','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate'];(function(_0x3d4fc3,_0x4c1d67){var _0x1d0b82=function(_0x52dba0){while(--_0x52dba0){_0x3d4fc3['push'](_0x3d4fc3['shift']());}};_0x1d0b82(++_0x4c1d67);}(_0xa11f,0xa4));var _0xfa11=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0xa11f[_0x261b8a];return _0x3455e8;};'use strict';var util=require(_0xfa11('0x0'));var _=require(_0xfa11('0x1'));var moment=require('moment');var logger=require('../../../../config/logger')(_0xfa11('0x2'));exports[_0xfa11('0x3')]=function(_0x1c120f){return{'message':_0x1c120f};};exports[_0xfa11('0x4')]=function(_0x3b4513,_0x57de08){logger[_0xfa11('0x5')](_0x3b4513,util[_0xfa11('0x6')](_0x57de08,{'showHidden':![],'depth':null}));};exports[_0xfa11('0x7')]=function(_0x473217,_0x506dd4){var _0x43766d={'XMF-ECM':_0x506dd4[_0xfa11('0x8')],'XMF-HEADERINFO':_0x506dd4[_0xfa11('0x9')],'XMF-MINRATE':_0x506dd4[_0xfa11('0xa')],'XMF-MAXRATE':_0x506dd4[_0xfa11('0xb')],'XMF-MODEM':util[_0xfa11('0xc')]('\x22%s\x22',_0x506dd4[_0xfa11('0xd')]),'XMF-GATEWAY':_0x506dd4[_0xfa11('0xe')],'XMF-FAXDETECT':_0x506dd4[_0xfa11('0xf')],'XMF-T38TIMEOUT':_0x506dd4[_0xfa11('0x10')],'XMF-LOCALSTATIONID':_0x506dd4[_0xfa11('0x11')],'XMF-PATH':_0x473217[_0xfa11('0x12')]};return _0x43766d;};exports[_0xfa11('0x13')]=function(_0x197ca3,_0x41db21){return{'actionid':_0x197ca3['uniqueid'],'action':_0xfa11('0x14'),'channel':_0x197ca3[_0xfa11('0x15')],'Exten':_0xfa11('0x16'),'Context':_0xfa11('0x17'),'Priority':'1','callerid':util['format'](_0xfa11('0x18'),_0x197ca3[_0xfa11('0x9')]?_0x197ca3[_0xfa11('0x9')]:'',_0x197ca3[_0xfa11('0x11')]),'variable':_0x41db21,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x197ca3['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 3c8a56b..ee2dabd 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 _0x161b=['getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','log','listen','bluebird','util','./server','./report','./acw','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','hour','get','then','getAgents','initAgents','getVoiceQueues','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initVoiceExtensions'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x161b,0x84));var _0xb161=function(_0x4a5c0b,_0x4d3fe2){_0x4a5c0b=_0x4a5c0b-0x0;var _0x4be3c6=_0x161b[_0x4a5c0b];return _0x4be3c6;};'use strict';var BPromise=require(_0xb161('0x0'));var util=require(_0xb161('0x1'));var moment=require('moment');var server=require(_0xb161('0x2'));var Realtime=require('./realtime');var Report=require(_0xb161('0x3'));var Acw=require(_0xb161('0x4'));var Trigger=require('./trigger');var Dialer=require(_0xb161('0x5'));var Preview=require(_0xb161('0x6'));var Fax=require(_0xb161('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0xb161('0x8'));var voiceQueueReport=require(_0xb161('0x9'));var voiceCallReport=require(_0xb161('0xa'));var trunk=require(_0xb161('0xb'));var trigger=require(_0xb161('0xc'));var template=require(_0xb161('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0xb161('0xe'));var faxAccount=require(_0xb161('0xf'));var zendesk=require(_0xb161('0x10'));var salesforce=require(_0xb161('0x11'));var sugarcrm=require(_0xb161('0x12'));var freshdesk=require(_0xb161('0x13'));var desk=require(_0xb161('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xb161('0x15'));var freshsales=require(_0xb161('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0xb161('0x17'));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'](_0xb161('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xb161('0x19')](_0xb161('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xb161('0x1a')](user[_0xb161('0x1b')]())['then'](realtime[_0xb161('0x1c')]())[_0xb161('0x1a')](user['getTelephones']())['then'](realtime['initTelephones']())['then'](trunk['getTrunks']())[_0xb161('0x1a')](realtime['initTrunks']())['then'](voiceQueue[_0xb161('0x1d')]())[_0xb161('0x1a')](realtime['initVoiceQueues']())[_0xb161('0x1a')](trigger['getTriggers']())[_0xb161('0x1a')](realtime['initTriggers']())[_0xb161('0x1a')](template[_0xb161('0x1e')]())['then'](realtime[_0xb161('0x1f')]())[_0xb161('0x1a')](zendesk[_0xb161('0x20')]())['then'](realtime[_0xb161('0x21')]())['then'](salesforce[_0xb161('0x22')]())[_0xb161('0x1a')](realtime['initSalesforceAccounts']())[_0xb161('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0xb161('0x1a')](realtime[_0xb161('0x23')]())[_0xb161('0x1a')](freshdesk[_0xb161('0x24')]())[_0xb161('0x1a')](realtime[_0xb161('0x25')]())[_0xb161('0x1a')](desk[_0xb161('0x26')]())[_0xb161('0x1a')](realtime[_0xb161('0x27')]())[_0xb161('0x1a')](zoho['getZohoAccounts']())[_0xb161('0x1a')](realtime['initZohoAccounts']())[_0xb161('0x1a')](vtiger[_0xb161('0x28')]())[_0xb161('0x1a')](realtime[_0xb161('0x29')]())[_0xb161('0x1a')](freshsales[_0xb161('0x2a')]())[_0xb161('0x1a')](realtime['initFreshsalesAccounts']())[_0xb161('0x1a')](servicenow[_0xb161('0x2b')]())[_0xb161('0x1a')](realtime[_0xb161('0x2c')]())['then'](dynamics365[_0xb161('0x2d')]())[_0xb161('0x1a')](realtime[_0xb161('0x2e')]())[_0xb161('0x1a')](campaign['getCampaigns']())[_0xb161('0x1a')](realtime['initCampaigns']())[_0xb161('0x1a')](voiceExtension['getVoiceExtensions']())[_0xb161('0x1a')](realtime[_0xb161('0x2f')]())[_0xb161('0x1a')](faxAccount[_0xb161('0x30')]())[_0xb161('0x1a')](realtime[_0xb161('0x31')]())[_0xb161('0x1a')](function(){return realtime;});}function initParams(){return BPromise[_0xb161('0x32')]()[_0xb161('0x1a')](voiceQueueReport[_0xb161('0x33')]())[_0xb161('0x1a')](realtime[_0xb161('0x34')]())[_0xb161('0x1a')](cmHopperHistory[_0xb161('0x35')]())[_0xb161('0x1a')](realtime[_0xb161('0x36')]())['then'](cmHopperHistory[_0xb161('0x37')]())[_0xb161('0x1a')](realtime[_0xb161('0x38')]())[_0xb161('0x1a')](voiceCallReport['getVoiceCallReports']())[_0xb161('0x1a')](realtime['initVoiceCallReports']())[_0xb161('0x1a')](function(_0x556dee){})[_0xb161('0x39')](function(_0x5daa01){console[_0xb161('0x3a')](_0x5daa01);});}function main(){return server[_0xb161('0x3b')](realtime,preview,fax)['then'](function(_0x122fa0){return initRealtime();})[_0xb161('0x1a')](function(){return initParams();})[_0xb161('0x1a')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xb161('0x39')](function(_0x360c35){console[_0xb161('0x3a')](_0x360c35);});}main(); \ No newline at end of file +var _0xbc3f=['initVoiceQueues','getTemplates','initTemplates','initZendeskAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','log','listen','util','moment','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','getTelephones','getTrunks','initTrunks'];(function(_0x3634ea,_0xa325a7){var _0x2d4590=function(_0x1ce011){while(--_0x1ce011){_0x3634ea['push'](_0x3634ea['shift']());}};_0x2d4590(++_0xa325a7);}(_0xbc3f,0x1a7));var _0xfbc3=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xbc3f[_0x3ce3c];return _0x55a2c9;};'use strict';var BPromise=require('bluebird');var util=require(_0xfbc3('0x0'));var moment=require(_0xfbc3('0x1'));var server=require('./server');var Realtime=require(_0xfbc3('0x2'));var Report=require(_0xfbc3('0x3'));var Acw=require(_0xfbc3('0x4'));var Trigger=require(_0xfbc3('0x5'));var Dialer=require('./dialer');var Preview=require(_0xfbc3('0x6'));var Fax=require(_0xfbc3('0x7'));var user=require(_0xfbc3('0x8'));var voiceQueue=require(_0xfbc3('0x9'));var voiceQueueReport=require(_0xfbc3('0xa'));var voiceCallReport=require(_0xfbc3('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0xfbc3('0xc'));var campaign=require(_0xfbc3('0xd'));var voiceExtension=require(_0xfbc3('0xe'));var faxAccount=require(_0xfbc3('0xf'));var zendesk=require(_0xfbc3('0x10'));var salesforce=require(_0xfbc3('0x11'));var sugarcrm=require(_0xfbc3('0x12'));var freshdesk=require(_0xfbc3('0x13'));var desk=require(_0xfbc3('0x14'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xfbc3('0x15'));var servicenow=require(_0xfbc3('0x16'));var dynamics365=require(_0xfbc3('0x17'));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()[_0xfbc3('0x18')](_0xfbc3('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xfbc3('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xfbc3('0x1a')]()[_0xfbc3('0x1b')](user[_0xfbc3('0x1c')]())[_0xfbc3('0x1b')](realtime['initAgents']())['then'](user[_0xfbc3('0x1d')]())[_0xfbc3('0x1b')](realtime['initTelephones']())[_0xfbc3('0x1b')](trunk[_0xfbc3('0x1e')]())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x1f')]())[_0xfbc3('0x1b')](voiceQueue['getVoiceQueues']())['then'](realtime[_0xfbc3('0x20')]())[_0xfbc3('0x1b')](trigger['getTriggers']())['then'](realtime['initTriggers']())[_0xfbc3('0x1b')](template[_0xfbc3('0x21')]())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x22')]())[_0xfbc3('0x1b')](zendesk['getZendeskAccounts']())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x23')]())[_0xfbc3('0x1b')](salesforce['getSalesforceAccounts']())[_0xfbc3('0x1b')](realtime['initSalesforceAccounts']())[_0xfbc3('0x1b')](sugarcrm[_0xfbc3('0x24')]())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x25')]())[_0xfbc3('0x1b')](freshdesk[_0xfbc3('0x26')]())['then'](realtime[_0xfbc3('0x27')]())[_0xfbc3('0x1b')](desk[_0xfbc3('0x28')]())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x29')]())['then'](zoho[_0xfbc3('0x2a')]())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x2b')]())['then'](vtiger[_0xfbc3('0x2c')]())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x2d')]())['then'](freshsales[_0xfbc3('0x2e')]())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x2f')]())[_0xfbc3('0x1b')](servicenow[_0xfbc3('0x30')]())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x31')]())[_0xfbc3('0x1b')](dynamics365[_0xfbc3('0x32')]())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x33')]())['then'](campaign[_0xfbc3('0x34')]())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x35')]())[_0xfbc3('0x1b')](voiceExtension[_0xfbc3('0x36')]())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x37')]())[_0xfbc3('0x1b')](faxAccount[_0xfbc3('0x38')]())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x39')]())[_0xfbc3('0x1b')](function(){return realtime;});}function initParams(){return BPromise[_0xfbc3('0x1a')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0xfbc3('0x1b')](realtime[_0xfbc3('0x3a')]())[_0xfbc3('0x1b')](cmHopperHistory[_0xfbc3('0x3b')]())[_0xfbc3('0x1b')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0xfbc3('0x3c')]())[_0xfbc3('0x1b')](realtime['initCampaignHopperHistory']())[_0xfbc3('0x1b')](voiceCallReport[_0xfbc3('0x3d')]())[_0xfbc3('0x1b')](realtime['initVoiceCallReports']())[_0xfbc3('0x1b')](function(_0x286b8e){})[_0xfbc3('0x3e')](function(_0x21c2d2){console[_0xfbc3('0x3f')](_0x21c2d2);});}function main(){return server[_0xfbc3('0x40')](realtime,preview,fax)[_0xfbc3('0x1b')](function(_0x2a79fd){return initRealtime();})[_0xfbc3('0x1b')](function(){return initParams();})[_0xfbc3('0x1b')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0xfbc3('0x3e')](function(_0xf93eb0){console[_0xfbc3('0x3f')](_0xf93eb0);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 811bdd8..a651356 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 _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(_0x4f879f,_0x301924){var _0x1b5d34=function(_0x2bc7e8){while(--_0x2bc7e8){_0x4f879f['push'](_0x4f879f['shift']());}};_0x1b5d34(++_0x301924);}(_0xe706,0xa3));var _0x6e70=function(_0x3fd7ab,_0x3dd0bc){_0x3fd7ab=_0x3fd7ab-0x0;var _0x56cb4b=_0xe706[_0x3fd7ab];return _0x56cb4b;};'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 +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(_0x361255,_0x163f26){var _0x3614ce=function(_0x28b26a){while(--_0x28b26a){_0x361255['push'](_0x361255['shift']());}};_0x3614ce(++_0x163f26);}(_0x70e0,0x17b));var _0x070e=function(_0x37b904,_0x595e7c){_0x37b904=_0x37b904-0x0;var _0x527a15=_0x70e0[_0x37b904];return _0x527a15;};'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 diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 0ac5c1e..58413a4 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 _0x3752=['dialAMDMinWordLength','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0xec4e97,_0x75e949){var _0x45a652=function(_0x44af19){while(--_0x44af19){_0xec4e97['push'](_0xec4e97['shift']());}};_0x45a652(++_0x75e949);}(_0x3752,0x18c));var _0x2375=function(_0x4f6464,_0x19ce0b){_0x4f6464=_0x4f6464-0x0;var _0x2970c0=_0x3752[_0x4f6464];return _0x2970c0;};'use strict';function Campaign(_0x305dd3){this['id']=_0x305dd3['id']||0x0;this[_0x2375('0x0')]=_0x305dd3[_0x2375('0x0')]||'';this[_0x2375('0x1')]=_0x305dd3[_0x2375('0x1')]||_0x2375('0x2');this[_0x2375('0x3')]=0x0;this[_0x2375('0x4')]=0x0;this[_0x2375('0x5')]=0x0;this[_0x2375('0x6')]=0x0;this[_0x2375('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0x2375('0x8')]=_0x305dd3['active'];this[_0x2375('0x9')]=_0x305dd3[_0x2375('0x9')];this[_0x2375('0xa')]=_0x305dd3[_0x2375('0xa')]||null;this[_0x2375('0xb')]=_0x305dd3['dialGlobalInterval']?_0x305dd3['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x305dd3[_0x2375('0xc')];this['dialOriginateCallerIdNumber']=_0x305dd3[_0x2375('0xd')];this['dialOriginateTimeout']=_0x305dd3[_0x2375('0xe')]||0x1e;this[_0x2375('0xf')]=_0x305dd3[_0x2375('0xf')];this[_0x2375('0x10')]=_0x305dd3[_0x2375('0x10')];this[_0x2375('0x11')]=_0x305dd3[_0x2375('0x11')];this['dialBusyRetryFrequency']=_0x305dd3[_0x2375('0x12')];this[_0x2375('0x13')]=_0x305dd3['dialNoAnswerMaxRetry'];this[_0x2375('0x14')]=_0x305dd3[_0x2375('0x14')];this[_0x2375('0x15')]=_0x305dd3['dialGlobalMaxRetry'];this[_0x2375('0x16')]=_0x305dd3['dialNoSuchNumberMaxRetry']||0x3;this[_0x2375('0x17')]=_0x305dd3[_0x2375('0x17')]||0x96;this[_0x2375('0x18')]=_0x305dd3[_0x2375('0x18')]||0x3;this[_0x2375('0x19')]=_0x305dd3['dialDropRetryFrequency']||0x96;this[_0x2375('0x1a')]=_0x305dd3[_0x2375('0x1a')]||0x3;this[_0x2375('0x1b')]=_0x305dd3[_0x2375('0x1b')]||0x96;this[_0x2375('0x1c')]=_0x305dd3[_0x2375('0x1c')]||0x3;this[_0x2375('0x1d')]=_0x305dd3[_0x2375('0x1d')]||0x96;this['dialAgentRejectMaxRetry']=_0x305dd3[_0x2375('0x1e')]||0x3;this[_0x2375('0x1f')]=_0x305dd3['dialAgentRejectRetryFrequency']||0x96;this[_0x2375('0x20')]=_0x305dd3[_0x2375('0x20')]||_0x2375('0x21');this[_0x2375('0x22')]=_0x305dd3[_0x2375('0x22')]||undefined;this[_0x2375('0x23')]=_0x305dd3['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x2375('0x24')]=_0x305dd3[_0x2375('0x24')]||undefined;this[_0x2375('0x25')]=_0x305dd3['TrunkBackup']?_0x305dd3[_0x2375('0x25')]:undefined;this[_0x2375('0x26')]=_0x305dd3[_0x2375('0x26')]?_0x305dd3[_0x2375('0x26')]:undefined;this[_0x2375('0x27')]=_0x305dd3[_0x2375('0x27')]?_0x305dd3[_0x2375('0x27')]:undefined;this[_0x2375('0x28')]=_0x305dd3['SquareProject']?_0x305dd3[_0x2375('0x28')]:undefined;this['dialQueueProject']=_0x305dd3[_0x2375('0x28')]?_0x305dd3['SquareProject'][_0x2375('0x0')]:undefined;this[_0x2375('0x29')]=_0x305dd3[_0x2375('0x29')]||![];this[_0x2375('0x2a')]=_0x305dd3[_0x2375('0x2a')];this['dialAMDGreeting']=_0x305dd3['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x305dd3[_0x2375('0x2b')];this[_0x2375('0x2c')]=_0x305dd3['dialAMDTotalAnalysisTime'];this[_0x2375('0x2d')]=_0x305dd3[_0x2375('0x2d')];this['dialAMDBetweenWordsSilence']=_0x305dd3['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x305dd3['dialAMDMaximumNumberOfWords'];this[_0x2375('0x2e')]=_0x305dd3[_0x2375('0x2e')];this[_0x2375('0x2f')]=_0x305dd3[_0x2375('0x2f')];}module[_0x2375('0x30')]=Campaign; \ No newline at end of file +var _0x55a4=['ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialOrderByScheduledAt','dialPrefix','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp'];(function(_0x39ddc8,_0x52f361){var _0x980fbe=function(_0x242bd0){while(--_0x242bd0){_0x39ddc8['push'](_0x39ddc8['shift']());}};_0x980fbe(++_0x52f361);}(_0x55a4,0x1b4));var _0x455a=function(_0x199746,_0x49867b){_0x199746=_0x199746-0x0;var _0x23b01e=_0x55a4[_0x199746];return _0x23b01e;};'use strict';function Campaign(_0x2e9819){this['id']=_0x2e9819['id']||0x0;this[_0x455a('0x0')]=_0x2e9819[_0x455a('0x0')]||'';this[_0x455a('0x1')]=_0x2e9819['type']||_0x455a('0x2');this[_0x455a('0x3')]=0x0;this[_0x455a('0x4')]=0x0;this[_0x455a('0x5')]=0x0;this[_0x455a('0x6')]=0x0;this[_0x455a('0x7')]='';this[_0x455a('0x8')]=!![];this[_0x455a('0x9')]=_0x2e9819[_0x455a('0x9')];this[_0x455a('0xa')]=_0x2e9819[_0x455a('0xa')];this['dialTimezone']=_0x2e9819[_0x455a('0xb')]||null;this[_0x455a('0xc')]=_0x2e9819[_0x455a('0xc')]?_0x2e9819[_0x455a('0xc')]:null;this[_0x455a('0xd')]=_0x2e9819['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x2e9819['dialOriginateCallerIdNumber'];this[_0x455a('0xe')]=_0x2e9819[_0x455a('0xe')]||0x1e;this[_0x455a('0xf')]=_0x2e9819[_0x455a('0xf')];this[_0x455a('0x10')]=_0x2e9819[_0x455a('0x10')];this[_0x455a('0x11')]=_0x2e9819[_0x455a('0x11')];this[_0x455a('0x12')]=_0x2e9819[_0x455a('0x12')];this['dialNoAnswerMaxRetry']=_0x2e9819['dialNoAnswerMaxRetry'];this[_0x455a('0x13')]=_0x2e9819[_0x455a('0x13')];this['dialGlobalMaxRetry']=_0x2e9819[_0x455a('0x14')];this['dialNoSuchNumberMaxRetry']=_0x2e9819[_0x455a('0x15')]||0x3;this[_0x455a('0x16')]=_0x2e9819[_0x455a('0x16')]||0x96;this[_0x455a('0x17')]=_0x2e9819[_0x455a('0x17')]||0x3;this[_0x455a('0x18')]=_0x2e9819[_0x455a('0x18')]||0x96;this[_0x455a('0x19')]=_0x2e9819[_0x455a('0x19')]||0x3;this[_0x455a('0x1a')]=_0x2e9819[_0x455a('0x1a')]||0x96;this[_0x455a('0x1b')]=_0x2e9819['dialMachineMaxRetry']||0x3;this[_0x455a('0x1c')]=_0x2e9819[_0x455a('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x2e9819[_0x455a('0x1d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2e9819['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x2e9819[_0x455a('0x1e')]||'DESC';this[_0x455a('0x1f')]=_0x2e9819[_0x455a('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x2e9819['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x455a('0x20')]=_0x2e9819['dialCutDigit']||undefined;this[_0x455a('0x21')]=_0x2e9819[_0x455a('0x21')]?_0x2e9819[_0x455a('0x21')]:undefined;this[_0x455a('0x22')]=_0x2e9819[_0x455a('0x22')]?_0x2e9819[_0x455a('0x22')]:undefined;this[_0x455a('0x23')]=_0x2e9819[_0x455a('0x23')]?_0x2e9819[_0x455a('0x23')]:undefined;this[_0x455a('0x24')]=_0x2e9819[_0x455a('0x24')]?_0x2e9819['SquareProject']:undefined;this[_0x455a('0x25')]=_0x2e9819[_0x455a('0x24')]?_0x2e9819[_0x455a('0x24')][_0x455a('0x0')]:undefined;this[_0x455a('0x26')]=_0x2e9819[_0x455a('0x26')]||![];this['dialAMDInitialSilence']=_0x2e9819[_0x455a('0x27')];this[_0x455a('0x28')]=_0x2e9819['dialAMDGreeting'];this[_0x455a('0x29')]=_0x2e9819[_0x455a('0x29')];this[_0x455a('0x2a')]=_0x2e9819[_0x455a('0x2a')];this[_0x455a('0x2b')]=_0x2e9819['dialAMDMinWordLength'];this[_0x455a('0x2c')]=_0x2e9819['dialAMDBetweenWordsSilence'];this[_0x455a('0x2d')]=_0x2e9819[_0x455a('0x2d')];this[_0x455a('0x2e')]=_0x2e9819[_0x455a('0x2e')];this[_0x455a('0x2f')]=_0x2e9819[_0x455a('0x2f')];}module[_0x455a('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index e97fab3..39bf1c5 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 _0x1122=['type','disposition','monitor','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','uniqueid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime'];(function(_0x43d373,_0x430bcc){var _0x17e486=function(_0x2aed64){while(--_0x2aed64){_0x43d373['push'](_0x43d373['shift']());}};_0x17e486(++_0x430bcc);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';function Channel(){this[_0x2112('0x0')]=null;this['channel']='';this[_0x2112('0x1')]='';this[_0x2112('0x2')]=0x0;this[_0x2112('0x3')]='';this[_0x2112('0x4')]=undefined;this[_0x2112('0x5')]=undefined;this['accountcode']=0x0;this['context']='';this[_0x2112('0x6')]=0x0;this['linkedid']=0x0;this[_0x2112('0x7')]=0x0;this[_0x2112('0x8')]=![];this['answertime']=null;this[_0x2112('0x9')]=null;this[_0x2112('0xa')]=![];this[_0x2112('0xb')]=![];this[_0x2112('0xc')]='';this[_0x2112('0xd')]='';this[_0x2112('0xe')]=0x0;this[_0x2112('0xf')]=0x0;this[_0x2112('0x10')]=0x0;this[_0x2112('0x11')]=null;this['tag']=null;this[_0x2112('0x12')]=null;this[_0x2112('0x13')]=![];this[_0x2112('0x14')]=null;this[_0x2112('0x15')]=null;this['monitors']=[];this[_0x2112('0x16')]=undefined;this[_0x2112('0x17')]=undefined;this[_0x2112('0x18')]=undefined;this[_0x2112('0x19')]=0x0;}module[_0x2112('0x1a')]=Channel; \ No newline at end of file +var _0xa693=['exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication','lastdata','type','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType'];(function(_0x42d58c,_0x1a757a){var _0x3c3ce5=function(_0x195595){while(--_0x195595){_0x42d58c['push'](_0x42d58c['shift']());}};_0x3c3ce5(++_0x1a757a);}(_0xa693,0xf1));var _0x3a69=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0xa693[_0x4849f6];return _0x1a3dcd;};'use strict';function Channel(){this[_0x3a69('0x0')]=null;this[_0x3a69('0x1')]='';this[_0x3a69('0x2')]='';this[_0x3a69('0x3')]=0x0;this[_0x3a69('0x4')]='';this[_0x3a69('0x5')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this['context']='';this[_0x3a69('0x6')]=0x0;this[_0x3a69('0x7')]=0x0;this[_0x3a69('0x8')]=0x0;this[_0x3a69('0x9')]=![];this[_0x3a69('0xa')]=null;this[_0x3a69('0xb')]=null;this[_0x3a69('0xc')]=![];this['abandoned']=![];this[_0x3a69('0xd')]='';this[_0x3a69('0xe')]='';this['duration']=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this[_0x3a69('0xf')]=null;this['tag']=null;this[_0x3a69('0x10')]=null;this[_0x3a69('0x11')]=![];this[_0x3a69('0x12')]=null;this[_0x3a69('0x13')]=null;this[_0x3a69('0x14')]=[];this['transfercalleridnum']=undefined;this[_0x3a69('0x15')]=undefined;this[_0x3a69('0x16')]=undefined;this['mohtime']=0x0;}module[_0x3a69('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 228bda2..7952b1c 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 _0x96f5=['exports','username','remoteUri','authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x96f5,0x1ae));var _0x596f=function(_0x4868f1,_0x161563){_0x4868f1=_0x4868f1-0x0;var _0x41e532=_0x96f5[_0x4868f1];return _0x41e532;};'use strict';function DeskAccount(_0x138670){this['id']=_0x138670['id']||0x0;this['name']=_0x138670['name']||'';this[_0x596f('0x0')]=_0x138670[_0x596f('0x0')]||'';this[_0x596f('0x1')]=_0x138670[_0x596f('0x1')]||'';this[_0x596f('0x2')]=_0x138670[_0x596f('0x2')]||'';this[_0x596f('0x3')]=_0x138670[_0x596f('0x3')]||'';this['consumerKey']=_0x138670['consumerKey']||'';this[_0x596f('0x4')]=_0x138670['consumerSecret']||'';this[_0x596f('0x5')]=_0x138670[_0x596f('0x5')]||'';this[_0x596f('0x6')]=_0x138670[_0x596f('0x6')]||'';this[_0x596f('0x7')]=_0x138670['type']||'';this[_0x596f('0x8')]=_0x138670[_0x596f('0x8')]||'';this['Configurations']=_0x138670[_0x596f('0x9')]||{};}module[_0x596f('0xa')]=DeskAccount; \ No newline at end of file +var _0xb061=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType'];(function(_0x31cc0c,_0x4f2c63){var _0x18b553=function(_0x40d2e2){while(--_0x40d2e2){_0x31cc0c['push'](_0x31cc0c['shift']());}};_0x18b553(++_0x4f2c63);}(_0xb061,0xbf));var _0x1b06=function(_0x100dea,_0x2ca828){_0x100dea=_0x100dea-0x0;var _0x785cb5=_0xb061[_0x100dea];return _0x785cb5;};'use strict';function DeskAccount(_0x449deb){this['id']=_0x449deb['id']||0x0;this[_0x1b06('0x0')]=_0x449deb[_0x1b06('0x0')]||'';this['username']=_0x449deb[_0x1b06('0x1')]||'';this[_0x1b06('0x2')]=_0x449deb['remoteUri']||'';this['authType']=_0x449deb[_0x1b06('0x3')]||'';this[_0x1b06('0x4')]=_0x449deb[_0x1b06('0x4')]||'';this[_0x1b06('0x5')]=_0x449deb[_0x1b06('0x5')]||'';this[_0x1b06('0x6')]=_0x449deb[_0x1b06('0x6')]||'';this[_0x1b06('0x7')]=_0x449deb[_0x1b06('0x7')]||'';this['tokenSecret']=_0x449deb[_0x1b06('0x8')]||'';this[_0x1b06('0x9')]=_0x449deb['type']||'';this[_0x1b06('0xa')]=_0x449deb[_0x1b06('0xa')]||'';this['Configurations']=_0x449deb[_0x1b06('0xb')]||{};}module[_0x1b06('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 a279080..ce8a7b0 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 _0xe5b5=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','exports','name'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x22bdd3,_0x552e50){_0x22bdd3=_0x22bdd3-0x0;var _0x44d9d9=_0xe5b5[_0x22bdd3];return _0x44d9d9;};'use strict';function Dynamics365Account(_0x16118d){this['id']=_0x16118d['id']||0x0;this[_0x5e5b('0x0')]=_0x16118d[_0x5e5b('0x0')]||'';this[_0x5e5b('0x1')]=_0x16118d[_0x5e5b('0x1')]||'';this[_0x5e5b('0x2')]=_0x16118d[_0x5e5b('0x2')]||'';this[_0x5e5b('0x3')]=_0x16118d[_0x5e5b('0x3')]||'';this[_0x5e5b('0x4')]=_0x16118d[_0x5e5b('0x4')]||'';this[_0x5e5b('0x5')]=_0x16118d[_0x5e5b('0x5')]||'';this[_0x5e5b('0x6')]=_0x16118d[_0x5e5b('0x6')]||{};this[_0x5e5b('0x7')]=_0x16118d[_0x5e5b('0x7')]||'';this[_0x5e5b('0x8')]=_0x16118d[_0x5e5b('0x8')]||{};}module[_0x5e5b('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xa74f=['name','password','remoteUri','tenantId','clientSecret','serverUrl','Configurations'];(function(_0x23e6bb,_0x5c2d69){var _0x1e3b4c=function(_0x1afc46){while(--_0x1afc46){_0x23e6bb['push'](_0x23e6bb['shift']());}};_0x1e3b4c(++_0x5c2d69);}(_0xa74f,0x9a));var _0xfa74=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xa74f[_0xd0b415];return _0x2bdf2c;};'use strict';function Dynamics365Account(_0x4607a1){this['id']=_0x4607a1['id']||0x0;this['name']=_0x4607a1[_0xfa74('0x0')]||'';this['username']=_0x4607a1['username']||'';this[_0xfa74('0x1')]=_0x4607a1[_0xfa74('0x1')]||'';this[_0xfa74('0x2')]=_0x4607a1[_0xfa74('0x2')]||'';this['tenantId']=_0x4607a1[_0xfa74('0x3')]||'';this['clientId']=_0x4607a1['clientId']||'';this[_0xfa74('0x4')]=_0x4607a1[_0xfa74('0x4')]||{};this[_0xfa74('0x5')]=_0x4607a1[_0xfa74('0x5')]||'';this[_0xfa74('0x6')]=_0x4607a1[_0xfa74('0x6')]||{};}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 d57af13..d45554e 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 _0x61f2=['ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description'];(function(_0x1f1a97,_0xadfc15){var _0x29fc6a=function(_0x38c180){while(--_0x38c180){_0x1f1a97['push'](_0x1f1a97['shift']());}};_0x29fc6a(++_0xadfc15);}(_0x61f2,0x9e));var _0x261f=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0x61f2[_0x39e84d];return _0x1991bc;};'use strict';function FaxAccount(_0x483652){this['id']=_0x483652['id']||0x0;this[_0x261f('0x0')]=_0x483652['name']||'';this[_0x261f('0x1')]=_0x483652[_0x261f('0x1')];this[_0x261f('0x2')]=_0x483652['ecm'];this[_0x261f('0x3')]=_0x483652[_0x261f('0x3')];this[_0x261f('0x4')]=_0x483652[_0x261f('0x4')];this[_0x261f('0x5')]=_0x483652['minrate']||0x960;this[_0x261f('0x6')]=_0x483652[_0x261f('0x6')]||0x3840;this[_0x261f('0x7')]=_0x483652[_0x261f('0x7')]||'v17,v27,v29';this[_0x261f('0x8')]=_0x483652[_0x261f('0x8')]||'no';this[_0x261f('0x9')]=_0x483652[_0x261f('0x9')]||'no';this['t38timeout']=_0x483652[_0x261f('0xa')]||0x1388;this[_0x261f('0xb')]=_0x483652[_0x261f('0xb')]||'SIP';this['Trunk']=_0x483652['Trunk']?_0x483652[_0x261f('0xc')]:undefined;this['ListId']=_0x483652[_0x261f('0xd')];this[_0x261f('0xe')]=_0x483652[_0x261f('0xe')];}module[_0x261f('0xf')]=FaxAccount; \ No newline at end of file +var _0x51c5=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x1cf680,_0x33c5c6){var _0x11a421=function(_0x39fab3){while(--_0x39fab3){_0x1cf680['push'](_0x1cf680['shift']());}};_0x11a421(++_0x33c5c6);}(_0x51c5,0xc8));var _0x551c=function(_0x119d5a,_0x19b457){_0x119d5a=_0x119d5a-0x0;var _0x15bff4=_0x51c5[_0x119d5a];return _0x15bff4;};'use strict';function FaxAccount(_0x191395){this['id']=_0x191395['id']||0x0;this['name']=_0x191395[_0x551c('0x0')]||'';this[_0x551c('0x1')]=_0x191395[_0x551c('0x1')];this[_0x551c('0x2')]=_0x191395['ecm'];this[_0x551c('0x3')]=_0x191395[_0x551c('0x3')];this[_0x551c('0x4')]=_0x191395[_0x551c('0x4')];this[_0x551c('0x5')]=_0x191395[_0x551c('0x5')]||0x960;this['maxrate']=_0x191395[_0x551c('0x6')]||0x3840;this[_0x551c('0x7')]=_0x191395[_0x551c('0x7')]||_0x551c('0x8');this[_0x551c('0x9')]=_0x191395[_0x551c('0x9')]||'no';this[_0x551c('0xa')]=_0x191395[_0x551c('0xa')]||'no';this[_0x551c('0xb')]=_0x191395[_0x551c('0xb')]||0x1388;this['tech']=_0x191395['tech']||_0x551c('0xc');this['Trunk']=_0x191395[_0x551c('0xd')]?_0x191395[_0x551c('0xd')]:undefined;this['ListId']=_0x191395[_0x551c('0xe')];this['key']=_0x191395[_0x551c('0xf')];}module[_0x551c('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index fb69417..989ba99 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 _0x724b=['Configurations','name','username','token','remoteUri','serverUrl'];(function(_0x43c9cb,_0x334524){var _0x2fb6b7=function(_0x42cf96){while(--_0x42cf96){_0x43c9cb['push'](_0x43c9cb['shift']());}};_0x2fb6b7(++_0x334524);}(_0x724b,0x6d));var _0xb724=function(_0x457231,_0x176155){_0x457231=_0x457231-0x0;var _0x243064=_0x724b[_0x457231];return _0x243064;};'use strict';function FreshdeskAccount(_0x4a8d9a){this['id']=_0x4a8d9a['id']||0x0;this[_0xb724('0x0')]=_0x4a8d9a[_0xb724('0x0')]||'';this[_0xb724('0x1')]=_0x4a8d9a[_0xb724('0x1')]||'';this['apiKey']=_0x4a8d9a[_0xb724('0x2')]||'';this['remoteUri']=_0x4a8d9a[_0xb724('0x3')]||'';this[_0xb724('0x4')]=_0x4a8d9a[_0xb724('0x4')]||'';this[_0xb724('0x5')]=_0x4a8d9a[_0xb724('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x82aa=['serverUrl','exports','name','username','remoteUri'];(function(_0x4c4042,_0x1ea485){var _0xbd10dc=function(_0x164b20){while(--_0x164b20){_0x4c4042['push'](_0x4c4042['shift']());}};_0xbd10dc(++_0x1ea485);}(_0x82aa,0x115));var _0xa82a=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x82aa[_0x122ef9];return _0x42fba0;};'use strict';function FreshdeskAccount(_0x5e715e){this['id']=_0x5e715e['id']||0x0;this['name']=_0x5e715e[_0xa82a('0x0')]||'';this[_0xa82a('0x1')]=_0x5e715e[_0xa82a('0x1')]||'';this['apiKey']=_0x5e715e['token']||'';this[_0xa82a('0x2')]=_0x5e715e[_0xa82a('0x2')]||'';this[_0xa82a('0x3')]=_0x5e715e[_0xa82a('0x3')]||'';this['Configurations']=_0x5e715e['Configurations']||{};}module[_0xa82a('0x4')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index c6bea06..2cd5861 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 _0xe4b8=['username','apiKey','token','serverUrl','Configurations','exports','name'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0xe4b8,0x179));var _0x8e4b=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xe4b8[_0x565ed7];return _0x183ad7;};'use strict';function FreshsalesAccount(_0x5ed225){this['id']=_0x5ed225['id']||0x0;this[_0x8e4b('0x0')]=_0x5ed225[_0x8e4b('0x0')]||'';this[_0x8e4b('0x1')]=_0x5ed225[_0x8e4b('0x1')]||'';this[_0x8e4b('0x2')]=_0x5ed225[_0x8e4b('0x3')]||'';this['remoteUri']=_0x5ed225['remoteUri']||'';this[_0x8e4b('0x4')]=_0x5ed225[_0x8e4b('0x4')]||'';this[_0x8e4b('0x5')]=_0x5ed225['Configurations']||{};}module[_0x8e4b('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x0d4d=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x3fd455,_0x1f7c5b){var _0x1c259f=function(_0x2da88a){while(--_0x2da88a){_0x3fd455['push'](_0x3fd455['shift']());}};_0x1c259f(++_0x1f7c5b);}(_0x0d4d,0x132));var _0xd0d4=function(_0x1516b2,_0x46b4b6){_0x1516b2=_0x1516b2-0x0;var _0x85e9d6=_0x0d4d[_0x1516b2];return _0x85e9d6;};'use strict';function FreshsalesAccount(_0x1e43f6){this['id']=_0x1e43f6['id']||0x0;this[_0xd0d4('0x0')]=_0x1e43f6[_0xd0d4('0x0')]||'';this[_0xd0d4('0x1')]=_0x1e43f6[_0xd0d4('0x1')]||'';this[_0xd0d4('0x2')]=_0x1e43f6['token']||'';this[_0xd0d4('0x3')]=_0x1e43f6['remoteUri']||'';this[_0xd0d4('0x4')]=_0x1e43f6[_0xd0d4('0x4')]||'';this['Configurations']=_0x1e43f6[_0xd0d4('0x5')]||{};}module[_0xd0d4('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index db3c2f9..47fd8b6 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 _0x0a88=['uniqueid','calleridnum','queue','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','priority','assigned','mohtime','exports','type','inbound'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x0a88,0xfa));var _0x80a8=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0x0a88[_0x12d812];return _0x3711ab;};'use strict';function QueueReport(){this[_0x80a8('0x0')]=_0x80a8('0x1');this[_0x80a8('0x2')]='';this[_0x80a8('0x3')]='';this['calleridname']='';this[_0x80a8('0x4')]='';this['queuecallerjoinAt']=null;this[_0x80a8('0x5')]=null;this['position']=0x1;this[_0x80a8('0x6')]=0x1;this[_0x80a8('0x7')]=![];this[_0x80a8('0x8')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0x80a8('0x9')]=![];this[_0x80a8('0xa')]=null;this[_0x80a8('0xb')]=0x1;this['channel']='';this[_0x80a8('0xc')]='';this[_0x80a8('0xd')]='';this['accountcode']='';this['context']='';this['exten']='';this[_0x80a8('0xe')]='';this['holdtime']=0x0;this[_0x80a8('0xf')]=![];this['lastAssignedTo']='';this[_0x80a8('0x10')]=0x0;this['variables']={};}module[_0x80a8('0x11')]=QueueReport; \ No newline at end of file +var _0x5f08=['accountcode','context','exten','assigned','lastAssignedTo','mohtime','exports','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename'];(function(_0x245c3e,_0x2f910c){var _0x36cfc4=function(_0x2b0758){while(--_0x2b0758){_0x245c3e['push'](_0x245c3e['shift']());}};_0x36cfc4(++_0x2f910c);}(_0x5f08,0x89));var _0x85f0=function(_0x56df29,_0x45ccf7){_0x56df29=_0x56df29-0x0;var _0x13cf40=_0x5f08[_0x56df29];return _0x13cf40;};'use strict';function QueueReport(){this[_0x85f0('0x0')]='inbound';this[_0x85f0('0x1')]='';this[_0x85f0('0x2')]='';this[_0x85f0('0x3')]='';this[_0x85f0('0x4')]='';this[_0x85f0('0x5')]=null;this[_0x85f0('0x6')]=null;this[_0x85f0('0x7')]=0x1;this[_0x85f0('0x8')]=0x1;this[_0x85f0('0x9')]=![];this[_0x85f0('0xa')]=null;this[_0x85f0('0xb')]=![];this[_0x85f0('0xc')]=null;this[_0x85f0('0xd')]=![];this[_0x85f0('0xe')]=null;this[_0x85f0('0xf')]=0x1;this[_0x85f0('0x10')]='';this[_0x85f0('0x11')]='';this[_0x85f0('0x12')]='';this[_0x85f0('0x13')]='';this[_0x85f0('0x14')]='';this[_0x85f0('0x15')]='';this['priority']='';this['holdtime']=0x0;this[_0x85f0('0x16')]=![];this[_0x85f0('0x17')]='';this[_0x85f0('0x18')]=0x0;this['variables']={};}module[_0x85f0('0x19')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 71bbf72..129bfdf 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 _0x4004=['securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x21d0a4,_0x249fb9){var _0x575613=function(_0x597d34){while(--_0x597d34){_0x21d0a4['push'](_0x21d0a4['shift']());}};_0x575613(++_0x249fb9);}(_0x4004,0x9f));var _0x4400=function(_0xbf8bc5,_0x21f45c){_0xbf8bc5=_0xbf8bc5-0x0;var _0x72af02=_0x4004[_0xbf8bc5];return _0x72af02;};'use strict';function SalesforceAccount(_0x6f7365){this['id']=_0x6f7365['id']||0x0;this[_0x4400('0x0')]=_0x6f7365[_0x4400('0x0')]||'';this[_0x4400('0x1')]=_0x6f7365[_0x4400('0x1')]||'';this[_0x4400('0x2')]=_0x6f7365['remoteUri']||'';this[_0x4400('0x3')]=_0x6f7365['password']||'';this['clientId']=_0x6f7365[_0x4400('0x4')]||'';this[_0x4400('0x5')]=_0x6f7365[_0x4400('0x5')]||'';this[_0x4400('0x6')]=_0x6f7365[_0x4400('0x6')]||'';this[_0x4400('0x7')]=_0x6f7365[_0x4400('0x7')]||'integrationTab';this[_0x4400('0x8')]=_0x6f7365[_0x4400('0x8')]||'';this[_0x4400('0x9')]=_0x6f7365[_0x4400('0x9')]||{};}module[_0x4400('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xf777=['securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId','clientSecret'];(function(_0x10c16d,_0x2b3e14){var _0x5896f4=function(_0x4306b9){while(--_0x4306b9){_0x10c16d['push'](_0x10c16d['shift']());}};_0x5896f4(++_0x2b3e14);}(_0xf777,0x1e9));var _0x7f77=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf777[_0x14add3];return _0x4a174f;};'use strict';function SalesforceAccount(_0x4113a4){this['id']=_0x4113a4['id']||0x0;this[_0x7f77('0x0')]=_0x4113a4[_0x7f77('0x0')]||'';this[_0x7f77('0x1')]=_0x4113a4[_0x7f77('0x1')]||'';this[_0x7f77('0x2')]=_0x4113a4[_0x7f77('0x2')]||'';this[_0x7f77('0x3')]=_0x4113a4[_0x7f77('0x3')]||'';this['clientId']=_0x4113a4[_0x7f77('0x4')]||'';this[_0x7f77('0x5')]=_0x4113a4['clientSecret']||'';this[_0x7f77('0x6')]=_0x4113a4['securityToken']||'';this[_0x7f77('0x7')]=_0x4113a4['type']||_0x7f77('0x8');this[_0x7f77('0x9')]=_0x4113a4[_0x7f77('0x9')]||'';this[_0x7f77('0xa')]=_0x4113a4[_0x7f77('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 7691275..70e749d 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 _0x5abb=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x281ba7,_0x30e002){var _0x2501ce=function(_0x41575a){while(--_0x41575a){_0x281ba7['push'](_0x281ba7['shift']());}};_0x2501ce(++_0x30e002);}(_0x5abb,0x1a8));var _0xb5ab=function(_0x52995,_0x263ba8){_0x52995=_0x52995-0x0;var _0x3b6eb8=_0x5abb[_0x52995];return _0x3b6eb8;};'use strict';function ServicenowAccount(_0x506f5b){this['id']=_0x506f5b['id']||0x0;this[_0xb5ab('0x0')]=_0x506f5b[_0xb5ab('0x0')]||'';this[_0xb5ab('0x1')]=_0x506f5b[_0xb5ab('0x1')]||'';this[_0xb5ab('0x2')]=_0x506f5b[_0xb5ab('0x2')]||'';this[_0xb5ab('0x3')]=_0x506f5b['remoteUri']||'';this['serverUrl']=_0x506f5b[_0xb5ab('0x4')]||'';this[_0xb5ab('0x5')]=_0x506f5b[_0xb5ab('0x5')]||{};}module[_0xb5ab('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x01d7=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x3881a8,_0x2daca2){var _0x52f7fc=function(_0x28bfec){while(--_0x28bfec){_0x3881a8['push'](_0x3881a8['shift']());}};_0x52f7fc(++_0x2daca2);}(_0x01d7,0x110));var _0x701d=function(_0x5c5271,_0x22b2a4){_0x5c5271=_0x5c5271-0x0;var _0x4a6061=_0x01d7[_0x5c5271];return _0x4a6061;};'use strict';function ServicenowAccount(_0x16a890){this['id']=_0x16a890['id']||0x0;this['name']=_0x16a890[_0x701d('0x0')]||'';this[_0x701d('0x1')]=_0x16a890[_0x701d('0x1')]||'';this[_0x701d('0x2')]=_0x16a890[_0x701d('0x2')]||'';this[_0x701d('0x3')]=_0x16a890[_0x701d('0x3')]||'';this[_0x701d('0x4')]=_0x16a890[_0x701d('0x4')]||'';this[_0x701d('0x5')]=_0x16a890[_0x701d('0x5')]||{};}module[_0x701d('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index ed96477..2bbf6bf 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 _0xef0e=['remoteUri','serverUrl','Configurations','exports','username','password'];(function(_0x44b3bd,_0x44c97d){var _0x1efc4a=function(_0x5d0205){while(--_0x5d0205){_0x44b3bd['push'](_0x44b3bd['shift']());}};_0x1efc4a(++_0x44c97d);}(_0xef0e,0x106));var _0xeef0=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xef0e[_0x59ee6f];return _0x4c0979;};'use strict';function SugarcrmAccount(_0x48b392){this['id']=_0x48b392['id']||0x0;this['name']=_0x48b392['name']||'';this[_0xeef0('0x0')]=_0x48b392[_0xeef0('0x0')]||'';this[_0xeef0('0x1')]=_0x48b392['password']||'';this[_0xeef0('0x2')]=_0x48b392['remoteUri']||'';this[_0xeef0('0x3')]=_0x48b392[_0xeef0('0x3')]||'';this[_0xeef0('0x4')]=_0x48b392[_0xeef0('0x4')]||{};}module[_0xeef0('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0xe511=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x431e66,_0x127106){var _0x5490c8=function(_0x503d6c){while(--_0x503d6c){_0x431e66['push'](_0x431e66['shift']());}};_0x5490c8(++_0x127106);}(_0xe511,0xc8));var _0x1e51=function(_0x28d225,_0x43be18){_0x28d225=_0x28d225-0x0;var _0x1f79e1=_0xe511[_0x28d225];return _0x1f79e1;};'use strict';function SugarcrmAccount(_0x2f59d7){this['id']=_0x2f59d7['id']||0x0;this[_0x1e51('0x0')]=_0x2f59d7['name']||'';this[_0x1e51('0x1')]=_0x2f59d7['username']||'';this[_0x1e51('0x2')]=_0x2f59d7['password']||'';this[_0x1e51('0x3')]=_0x2f59d7[_0x1e51('0x3')]||'';this[_0x1e51('0x4')]=_0x2f59d7[_0x1e51('0x4')]||'';this['Configurations']=_0x2f59d7[_0x1e51('0x5')]||{};}module[_0x1e51('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 8e5dcb8..9d04c0f 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 _0x9993=['name','accountcode','unknown','status','address'];(function(_0x54a7b5,_0x44e80f){var _0xeac90b=function(_0x3ec91d){while(--_0x3ec91d){_0x54a7b5['push'](_0x54a7b5['shift']());}};_0xeac90b(++_0x44e80f);}(_0x9993,0x109));var _0x3999=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9993[_0x4565bf];return _0x5610ba;};'use strict';function Telephone(_0x2bd315){this['id']=_0x2bd315['id']||0x0;this['name']=_0x2bd315[_0x3999('0x0')]||'';this[_0x3999('0x1')]=_0x2bd315[_0x3999('0x1')]||'';this['state']=_0x3999('0x2');this['stateTime']=0x0;this[_0x3999('0x3')]=_0x3999('0x2');this[_0x3999('0x4')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x47fd=['exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x2af053,_0x4f6d28){var _0x4b4001=function(_0x9200c1){while(--_0x9200c1){_0x2af053['push'](_0x2af053['shift']());}};_0x4b4001(++_0x4f6d28);}(_0x47fd,0x13c));var _0xd47f=function(_0x59cfc9,_0x49146f){_0x59cfc9=_0x59cfc9-0x0;var _0x259a01=_0x47fd[_0x59cfc9];return _0x259a01;};'use strict';function Telephone(_0x3f7ae5){this['id']=_0x3f7ae5['id']||0x0;this[_0xd47f('0x0')]=_0x3f7ae5[_0xd47f('0x0')]||'';this[_0xd47f('0x1')]=_0x3f7ae5[_0xd47f('0x1')]||'';this[_0xd47f('0x2')]=_0xd47f('0x3');this[_0xd47f('0x4')]=0x0;this[_0xd47f('0x5')]=_0xd47f('0x3');this['address']='';}module[_0xd47f('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 e0dc2b8..2d4af68 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(_0x44cecb,_0x910a55){var _0x47f7dd=function(_0x38e4cb){while(--_0x38e4cb){_0x44cecb['push'](_0x44cecb['shift']());}};_0x47f7dd(++_0x910a55);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x76e221,_0x481f12){var _0x339cb1=function(_0x48918a){while(--_0x48918a){_0x76e221['push'](_0x76e221['shift']());}};_0x339cb1(++_0x481f12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 fa3292e..2500cdc 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 _0x8603=['exports','name','channel','status','AllConditions','AnyConditions','Actions'];(function(_0xf5d506,_0x4bb13b){var _0xd51cef=function(_0x5ea252){while(--_0x5ea252){_0xf5d506['push'](_0xf5d506['shift']());}};_0xd51cef(++_0x4bb13b);}(_0x8603,0x190));var _0x3860=function(_0x2c64af,_0x10337e){_0x2c64af=_0x2c64af-0x0;var _0x179150=_0x8603[_0x2c64af];return _0x179150;};'use strict';function Trigger(_0xba4b79){this['id']=_0xba4b79['id']||0x0;this[_0x3860('0x0')]=_0xba4b79[_0x3860('0x0')]||'';this[_0x3860('0x1')]=_0xba4b79['channel']||'voice';this[_0x3860('0x2')]=_0xba4b79[_0x3860('0x2')]||![];this[_0x3860('0x3')]=_0xba4b79['AllConditions']||[];this[_0x3860('0x4')]=_0xba4b79['AnyConditions']||[];this[_0x3860('0x5')]=_0xba4b79[_0x3860('0x5')]||[];}module[_0x3860('0x6')]=Trigger; \ No newline at end of file +var _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x23c73d,_0x357b21){var _0x36ba47=function(_0x317b8e){while(--_0x317b8e){_0x23c73d['push'](_0x23c73d['shift']());}};_0x36ba47(++_0x357b21);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x5f66[_0x5f0089];return _0x193892;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 21a5336..1ae9e12 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 _0x752e=['domain','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','name','state','unknown','status','registry','indexOf','split'];(function(_0xd117f,_0x534f22){var _0x55fb25=function(_0x2af1df){while(--_0x2af1df){_0xd117f['push'](_0xd117f['shift']());}};_0x55fb25(++_0x534f22);}(_0x752e,0x160));var _0xe752=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x752e[_0x4a53d];return _0x27410e;};'use strict';function Trunk(_0x32cffa){this['id']=_0x32cffa['id']||0x0;this[_0xe752('0x0')]=_0x32cffa[_0xe752('0x0')]||![];this[_0xe752('0x1')]=_0x32cffa[_0xe752('0x1')]||'';this[_0xe752('0x2')]=_0xe752('0x3');this['stateTime']=0x0;this[_0xe752('0x4')]='unknown';this['registry']=_0x32cffa[_0xe752('0x5')]&&_0x32cffa[_0xe752('0x5')][_0xe752('0x6')](':')?_0x32cffa[_0xe752('0x5')][_0xe752('0x7')](':')[0x0]:'';this['host']='';this['port']='';this[_0xe752('0x8')]='';this['domainport']='';this[_0xe752('0x9')]='';this[_0xe752('0xa')]=_0xe752('0x3');this[_0xe752('0xb')]='';this[_0xe752('0xc')]='';this[_0xe752('0xd')]=_0x32cffa[_0xe752('0xd')]||'';}module[_0xe752('0xe')]=Trunk; \ No newline at end of file +var _0xd046=['stateTime','status','unknown','registry','split','host','domainport','refresh','registrationtime','defaultuser','exports','active','name'];(function(_0x3c6846,_0x220c01){var _0x36caf0=function(_0x267b6d){while(--_0x267b6d){_0x3c6846['push'](_0x3c6846['shift']());}};_0x36caf0(++_0x220c01);}(_0xd046,0x143));var _0x6d04=function(_0x8b373a,_0x4cfffc){_0x8b373a=_0x8b373a-0x0;var _0x2efa0a=_0xd046[_0x8b373a];return _0x2efa0a;};'use strict';function Trunk(_0x4389d1){this['id']=_0x4389d1['id']||0x0;this[_0x6d04('0x0')]=_0x4389d1['active']||![];this[_0x6d04('0x1')]=_0x4389d1[_0x6d04('0x1')]||'';this['state']='unknown';this[_0x6d04('0x2')]=0x0;this[_0x6d04('0x3')]=_0x6d04('0x4');this[_0x6d04('0x5')]=_0x4389d1[_0x6d04('0x5')]&&_0x4389d1[_0x6d04('0x5')]['indexOf'](':')?_0x4389d1['registry'][_0x6d04('0x6')](':')[0x0]:'';this[_0x6d04('0x7')]='';this['port']='';this['domain']='';this[_0x6d04('0x8')]='';this[_0x6d04('0x9')]='';this['stateRegistry']=_0x6d04('0x4');this[_0x6d04('0xa')]='';this['address']='';this[_0x6d04('0xb')]=_0x4389d1[_0x6d04('0xb')]||'';}module[_0x6d04('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 85ab28c..ed27710 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 _0xed78=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x2ae7c8,_0x3a16c9){var _0x4dc4e4=function(_0x5e2f36){while(--_0x5e2f36){_0x2ae7c8['push'](_0x2ae7c8['shift']());}};_0x4dc4e4(++_0x3a16c9);}(_0xed78,0x1ec));var _0x8ed7=function(_0x5a271a,_0x394216){_0x5a271a=_0x5a271a-0x0;var _0x55b6f7=_0xed78[_0x5a271a];return _0x55b6f7;};'use strict';function voiceExtension(_0x59e8d9){this['id']=_0x59e8d9['id']||0x0;this[_0x8ed7('0x0')]=_0x59e8d9[_0x8ed7('0x0')]||'';this[_0x8ed7('0x1')]=_0x59e8d9[_0x8ed7('0x1')]||_0x8ed7('0x2');this['mandatoryDisposition']=_0x59e8d9[_0x8ed7('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x08d3=['mandatoryDisposition','exports','recordingFormat','none'];(function(_0x142506,_0x2ac7f5){var _0x4f633f=function(_0x784fce){while(--_0x784fce){_0x142506['push'](_0x142506['shift']());}};_0x4f633f(++_0x2ac7f5);}(_0x08d3,0x1d6));var _0x308d=function(_0x437af4,_0x18377f){_0x437af4=_0x437af4-0x0;var _0x327d7c=_0x08d3[_0x437af4];return _0x327d7c;};'use strict';function voiceExtension(_0x1bf76b){this['id']=_0x1bf76b['id']||0x0;this['exten']=_0x1bf76b['exten']||'';this[_0x308d('0x0')]=_0x1bf76b[_0x308d('0x0')]||_0x308d('0x1');this[_0x308d('0x2')]=_0x1bf76b[_0x308d('0x2')]||![];}module[_0x308d('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 5e2018b..c002a03 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 _0xb63f=['outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','exports','not_inuse','inuse','busy','invalid','unavailable','ringing','onhold','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','total','answered','sumDuration','sumBillable','abandoned','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay'];(function(_0x4b1936,_0x283775){var _0x1d53b5=function(_0x2e75b8){while(--_0x2e75b8){_0x4b1936['push'](_0x4b1936['shift']());}};_0x1d53b5(++_0x283775);}(_0xb63f,0x176));var _0xfb63=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xb63f[_0x40a825];return _0x273a54;};'use strict';var statusDesc=['unknown',_0xfb63('0x0'),_0xfb63('0x1'),_0xfb63('0x2'),_0xfb63('0x3'),_0xfb63('0x4'),_0xfb63('0x5'),'ringinuse',_0xfb63('0x6')];var monitorFormat={'wav':'wav','wav49':_0xfb63('0x7'),'gsm':_0xfb63('0x8')};var strategy={'rrmemory':_0xfb63('0x9'),'roundrobin':_0xfb63('0xa')};function VoiceQueue(_0x4c9d31){this['id']=_0x4c9d31['id']||0x0;this[_0xfb63('0xb')]=_0x4c9d31[_0xfb63('0xb')]||'';this[_0xfb63('0xc')]=_0x4c9d31[_0xfb63('0xc')]||'';this[_0xfb63('0xd')]=_0x4c9d31[_0xfb63('0xd')]||_0xfb63('0xe');this[_0xfb63('0xf')]=0x0;this['talking']=0x0;this[_0xfb63('0x10')]=0x0;this[_0xfb63('0x11')]=0x0;this[_0xfb63('0x12')]=0x0;this['sumHoldTime']=0x0;this[_0xfb63('0x13')]=0x0;this['unmanaged']=0x0;this[_0xfb63('0x14')]=0x0;this['loggedIn']=0x0;this[_0xfb63('0x15')]=0x0;this[_0xfb63('0x16')]=_0x4c9d31[_0xfb63('0x16')]||![];this['acwTimeout']=_0x4c9d31[_0xfb63('0x17')]||0xa;this[_0xfb63('0x18')]=_0x4c9d31[_0xfb63('0x18')]||'no';this[_0xfb63('0x19')]=!![];this[_0xfb63('0x1a')]='';this['originated']=0x0;this['temp']=0x0;this[_0xfb63('0x1b')]=_0x4c9d31['dialTimezone']||null;this[_0xfb63('0x1c')]=_0x4c9d31[_0xfb63('0x1c')]?_0x4c9d31[_0xfb63('0x1c')]:null;this['dialActive']=_0x4c9d31['dialActive'];this[_0xfb63('0x1d')]=_0x4c9d31[_0xfb63('0x1d')]||_0xfb63('0x1e');this['dialLimitChannel']=_0x4c9d31[_0xfb63('0x1f')]||0x0;this[_0xfb63('0x20')]=_0x4c9d31[_0xfb63('0x20')]||0x0;this[_0xfb63('0x21')]=_0x4c9d31[_0xfb63('0x21')]||0x1;this['dialPredictiveOptimization']=_0x4c9d31[_0xfb63('0x22')]||'dropRate';this[_0xfb63('0x23')]=_0x4c9d31[_0xfb63('0x23')]||0.03;this[_0xfb63('0x24')]=_0x4c9d31[_0xfb63('0x24')]||0x258;this[_0xfb63('0x25')]=_0x4c9d31[_0xfb63('0x25')]||_0xfb63('0x26');this['dialOriginateCallerIdNumber']=_0x4c9d31['dialOriginateCallerIdNumber']||_0xfb63('0x26');this[_0xfb63('0x27')]=_0x4c9d31[_0xfb63('0x27')]||0x1e;this[_0xfb63('0x28')]=_0x4c9d31[_0xfb63('0x28')]||'tTxX';this[_0xfb63('0x29')]=_0x4c9d31[_0xfb63('0x29')]||0x3;this['dialQueueProject']=_0x4c9d31[_0xfb63('0x2a')]||undefined;this[_0xfb63('0x2b')]=_0x4c9d31[_0xfb63('0x2b')]||0x3;this['dialCongestionRetryFrequency']=_0x4c9d31[_0xfb63('0x2c')]||0x96;this[_0xfb63('0x2d')]=_0x4c9d31[_0xfb63('0x2d')]||0x3;this['dialBusyRetryFrequency']=_0x4c9d31[_0xfb63('0x2e')]||0x96;this[_0xfb63('0x2f')]=_0x4c9d31[_0xfb63('0x2f')]||0x3;this[_0xfb63('0x30')]=_0x4c9d31['dialNoAnswerRetryFrequency']||0x96;this['dialNoSuchNumberMaxRetry']=_0x4c9d31[_0xfb63('0x31')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4c9d31['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x4c9d31[_0xfb63('0x32')]||0x3;this[_0xfb63('0x33')]=_0x4c9d31[_0xfb63('0x33')]||0x96;this[_0xfb63('0x34')]=_0x4c9d31[_0xfb63('0x34')]||0x3;this[_0xfb63('0x35')]=_0x4c9d31[_0xfb63('0x35')]||0x96;this[_0xfb63('0x36')]=_0x4c9d31['dialMachineMaxRetry']||0x3;this[_0xfb63('0x37')]=_0x4c9d31[_0xfb63('0x37')]||0x96;this[_0xfb63('0x38')]=_0x4c9d31['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x4c9d31[_0xfb63('0x39')]||0x96;this[_0xfb63('0x3a')]=_0x4c9d31['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x4c9d31[_0xfb63('0x3b')]||0x4;this[_0xfb63('0x3c')]=_0x4c9d31[_0xfb63('0x3c')]?_0x4c9d31[_0xfb63('0x3c')]:undefined;this['TrunkBackup']=_0x4c9d31[_0xfb63('0x3d')]?_0x4c9d31[_0xfb63('0x3d')]:undefined;this[_0xfb63('0x3e')]=_0x4c9d31['dialPrefix']||undefined;this[_0xfb63('0x3f')]=_0x4c9d31[_0xfb63('0x3f')]?_0x4c9d31[_0xfb63('0x3f')]:undefined;this['dialOrderByScheduledAt']=_0x4c9d31[_0xfb63('0x40')]||_0xfb63('0x41');this[_0xfb63('0x42')]=_0x4c9d31[_0xfb63('0x42')]||undefined;this[_0xfb63('0x43')]=_0x4c9d31[_0xfb63('0x43')]||undefined;this[_0xfb63('0x44')]=strategy[_0x4c9d31['strategy']]||'rrmemory';this[_0xfb63('0x45')]=!![];this[_0xfb63('0x46')]=_0x4c9d31[_0xfb63('0x46')]||![];this['dialAMDInitialSilence']=_0x4c9d31[_0xfb63('0x47')];this[_0xfb63('0x48')]=_0x4c9d31[_0xfb63('0x48')];this[_0xfb63('0x49')]=_0x4c9d31[_0xfb63('0x49')];this[_0xfb63('0x4a')]=_0x4c9d31[_0xfb63('0x4a')];this[_0xfb63('0x4b')]=_0x4c9d31['dialAMDMinWordLength'];this[_0xfb63('0x4c')]=_0x4c9d31['dialAMDBetweenWordsSilence'];this['dialAMDMaximumNumberOfWords']=_0x4c9d31[_0xfb63('0x4d')];this[_0xfb63('0x4e')]=_0x4c9d31[_0xfb63('0x4e')];this[_0xfb63('0x4f')]=_0x4c9d31[_0xfb63('0x4f')];this[_0xfb63('0x50')]=0x0;this['pTalking']=0x0;this[_0xfb63('0x51')]=_0x4c9d31[_0xfb63('0x51')];this[_0xfb63('0x52')]=0x0;this[_0xfb63('0x53')]=0x0;this[_0xfb63('0x54')]=0x0;this[_0xfb63('0x55')]=0x0;this[_0xfb63('0x56')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xfb63('0x57')]=0x0;this[_0xfb63('0x58')]=0x0;this[_0xfb63('0x59')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xfb63('0x5a')]=0x0;this[_0xfb63('0x5b')]=0x0;this[_0xfb63('0x5c')]=0x0;this[_0xfb63('0x5d')]=0x0;this[_0xfb63('0x5e')]=undefined;this[_0xfb63('0x5f')]=undefined;this['handlePredictive']=undefined;this[_0xfb63('0x60')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xfb63('0x61')]=0x0;this[_0xfb63('0x62')]=0x0;this[_0xfb63('0x63')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xfb63('0x64')]=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xfb63('0x65')]=_0x4c9d31[_0xfb63('0x66')]||0x14;this[_0xfb63('0x67')]=_0x4c9d31[_0xfb63('0x66')]||0xa;this[_0xfb63('0x68')]=0x0;this[_0xfb63('0x69')]=0x0;this[_0xfb63('0x6a')]=0x1;this['erlangCalls']=0x0;this[_0xfb63('0x6b')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xfb63('0x6c')]=0x0;this[_0xfb63('0x6d')]=_0x4c9d31[_0xfb63('0x6d')]||0x1e;this[_0xfb63('0x6e')]=_0x4c9d31[_0xfb63('0x6e')]||![];this[_0xfb63('0x6f')]=_0x4c9d31[_0xfb63('0x6f')]||undefined;this[_0xfb63('0x70')]=_0x4c9d31[_0xfb63('0x70')]||![];this[_0xfb63('0x71')]=_0x4c9d31[_0xfb63('0x71')]||![];this[_0xfb63('0xc')]=monitorFormat[_0x4c9d31[_0xfb63('0xc')]]?monitorFormat[_0x4c9d31['monitor_format']]:undefined;this['mandatoryDisposition']=_0x4c9d31['mandatoryDisposition']||![];this[_0xfb63('0x72')]=_0x4c9d31[_0xfb63('0x72')]?_0x4c9d31['mandatoryDispositionPause']:undefined;}module[_0xfb63('0x73')]=VoiceQueue; \ No newline at end of file +var _0x5dda=['TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumHoldTime','abandoned','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x5dda,0x1a1));var _0xa5dd=function(_0x51aa1c,_0x22f24b){_0x51aa1c=_0x51aa1c-0x0;var _0x304366=_0x5dda[_0x51aa1c];return _0x304366;};'use strict';var statusDesc=[_0xa5dd('0x0'),_0xa5dd('0x1'),_0xa5dd('0x2'),_0xa5dd('0x3'),'invalid',_0xa5dd('0x4'),_0xa5dd('0x5'),_0xa5dd('0x6'),'onhold'];var monitorFormat={'wav':'wav','wav49':_0xa5dd('0x7'),'gsm':'gsm'};var strategy={'rrmemory':_0xa5dd('0x8'),'roundrobin':_0xa5dd('0x9')};function VoiceQueue(_0x374965){this['id']=_0x374965['id']||0x0;this[_0xa5dd('0xa')]=_0x374965[_0xa5dd('0xa')]||'';this[_0xa5dd('0xb')]=_0x374965[_0xa5dd('0xb')]||'';this[_0xa5dd('0xc')]=_0x374965[_0xa5dd('0xc')]||_0xa5dd('0xd');this[_0xa5dd('0xe')]=0x0;this['talking']=0x0;this['total']=0x0;this[_0xa5dd('0xf')]=0x0;this[_0xa5dd('0x10')]=0x0;this[_0xa5dd('0x11')]=0x0;this['sumBillable']=0x0;this['unmanaged']=0x0;this[_0xa5dd('0x12')]=0x0;this[_0xa5dd('0x13')]=0x0;this['available']=0x0;this[_0xa5dd('0x14')]=_0x374965[_0xa5dd('0x14')]||![];this[_0xa5dd('0x15')]=_0x374965['acwTimeout']||0xa;this[_0xa5dd('0x16')]=_0x374965[_0xa5dd('0x16')]||'no';this[_0xa5dd('0x17')]=!![];this[_0xa5dd('0x18')]='';this[_0xa5dd('0x19')]=0x0;this[_0xa5dd('0x1a')]=0x0;this[_0xa5dd('0x1b')]=_0x374965[_0xa5dd('0x1b')]||null;this[_0xa5dd('0x1c')]=_0x374965[_0xa5dd('0x1c')]?_0x374965[_0xa5dd('0x1c')]:null;this[_0xa5dd('0x1d')]=_0x374965[_0xa5dd('0x1d')];this['dialMethod']=_0x374965[_0xa5dd('0x1e')]||_0xa5dd('0x1f');this['dialLimitChannel']=_0x374965[_0xa5dd('0x20')]||0x0;this[_0xa5dd('0x21')]=_0x374965[_0xa5dd('0x21')]||0x0;this[_0xa5dd('0x22')]=_0x374965[_0xa5dd('0x22')]||0x1;this[_0xa5dd('0x23')]=_0x374965[_0xa5dd('0x23')]||'dropRate';this[_0xa5dd('0x24')]=_0x374965[_0xa5dd('0x24')]||0.03;this[_0xa5dd('0x25')]=_0x374965[_0xa5dd('0x25')]||0x258;this['dialOriginateCallerIdName']=_0x374965[_0xa5dd('0x26')]||_0xa5dd('0x27');this['dialOriginateCallerIdNumber']=_0x374965[_0xa5dd('0x28')]||_0xa5dd('0x27');this['dialOriginateTimeout']=_0x374965[_0xa5dd('0x29')]||0x1e;this[_0xa5dd('0x2a')]=_0x374965['dialQueueOptions']||'tTxX';this[_0xa5dd('0x2b')]=_0x374965[_0xa5dd('0x2b')]||0x3;this[_0xa5dd('0x2c')]=_0x374965[_0xa5dd('0x2c')]||undefined;this['dialCongestionMaxRetry']=_0x374965[_0xa5dd('0x2d')]||0x3;this[_0xa5dd('0x2e')]=_0x374965[_0xa5dd('0x2e')]||0x96;this[_0xa5dd('0x2f')]=_0x374965[_0xa5dd('0x2f')]||0x3;this['dialBusyRetryFrequency']=_0x374965[_0xa5dd('0x30')]||0x96;this[_0xa5dd('0x31')]=_0x374965[_0xa5dd('0x31')]||0x3;this[_0xa5dd('0x32')]=_0x374965[_0xa5dd('0x32')]||0x96;this[_0xa5dd('0x33')]=_0x374965[_0xa5dd('0x33')]||0x3;this[_0xa5dd('0x34')]=_0x374965['dialNoSuchNumberRetryFrequency']||0x96;this[_0xa5dd('0x35')]=_0x374965[_0xa5dd('0x35')]||0x3;this[_0xa5dd('0x36')]=_0x374965[_0xa5dd('0x36')]||0x96;this[_0xa5dd('0x37')]=_0x374965[_0xa5dd('0x37')]||0x3;this[_0xa5dd('0x38')]=_0x374965[_0xa5dd('0x38')]||0x96;this[_0xa5dd('0x39')]=_0x374965['dialMachineMaxRetry']||0x3;this[_0xa5dd('0x3a')]=_0x374965['dialMachineRetryFrequency']||0x96;this[_0xa5dd('0x3b')]=_0x374965['dialAgentRejectMaxRetry']||0x3;this[_0xa5dd('0x3c')]=_0x374965[_0xa5dd('0x3c')]||0x96;this['callAdditionalPhoneAfterMin']=_0x374965['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x374965[_0xa5dd('0x3d')]||0x4;this[_0xa5dd('0x3e')]=_0x374965[_0xa5dd('0x3e')]?_0x374965[_0xa5dd('0x3e')]:undefined;this[_0xa5dd('0x3f')]=_0x374965[_0xa5dd('0x3f')]?_0x374965[_0xa5dd('0x3f')]:undefined;this[_0xa5dd('0x40')]=_0x374965['dialPrefix']||undefined;this['Interval']=_0x374965[_0xa5dd('0x41')]?_0x374965[_0xa5dd('0x41')]:undefined;this[_0xa5dd('0x42')]=_0x374965[_0xa5dd('0x42')]||_0xa5dd('0x43');this[_0xa5dd('0x44')]=_0x374965[_0xa5dd('0x44')]||undefined;this[_0xa5dd('0x45')]=_0x374965['dialCutDigit']||undefined;this[_0xa5dd('0x46')]=strategy[_0x374965[_0xa5dd('0x46')]]||_0xa5dd('0x8');this[_0xa5dd('0x47')]=!![];this['dialAMDActive']=_0x374965['dialAMDActive']||![];this[_0xa5dd('0x48')]=_0x374965['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x374965[_0xa5dd('0x49')];this[_0xa5dd('0x4a')]=_0x374965[_0xa5dd('0x4a')];this[_0xa5dd('0x4b')]=_0x374965[_0xa5dd('0x4b')];this[_0xa5dd('0x4c')]=_0x374965[_0xa5dd('0x4c')];this['dialAMDBetweenWordsSilence']=_0x374965[_0xa5dd('0x4d')];this[_0xa5dd('0x4e')]=_0x374965[_0xa5dd('0x4e')];this[_0xa5dd('0x4f')]=_0x374965[_0xa5dd('0x4f')];this[_0xa5dd('0x50')]=_0x374965[_0xa5dd('0x50')];this[_0xa5dd('0x51')]=0x0;this[_0xa5dd('0x52')]=0x0;this['timeout']=_0x374965[_0xa5dd('0x53')];this['outboundAnswerCallsDay']=0x0;this[_0xa5dd('0x54')]=0x0;this[_0xa5dd('0x55')]=0x0;this[_0xa5dd('0x56')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xa5dd('0x57')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xa5dd('0x58')]=0x0;this[_0xa5dd('0x59')]=0x0;this[_0xa5dd('0x5a')]=0x0;this[_0xa5dd('0x5b')]=0x0;this[_0xa5dd('0x5c')]=0x0;this[_0xa5dd('0x5d')]=0x0;this[_0xa5dd('0x5e')]=0x0;this['startProgressive']=undefined;this[_0xa5dd('0x5f')]=undefined;this[_0xa5dd('0x60')]=undefined;this[_0xa5dd('0x61')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xa5dd('0x62')]=0x0;this[_0xa5dd('0x63')]=0x0;this[_0xa5dd('0x64')]=0x0;this[_0xa5dd('0x65')]=0x0;this[_0xa5dd('0x66')]=0x0;this[_0xa5dd('0x67')]=0x0;this[_0xa5dd('0x68')]=_0x374965[_0xa5dd('0x69')]||0x14;this[_0xa5dd('0x6a')]=_0x374965[_0xa5dd('0x69')]||0xa;this[_0xa5dd('0x6b')]=0x0;this[_0xa5dd('0x6c')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0xa5dd('0x6d')]=0x0;this[_0xa5dd('0x6e')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0xa5dd('0x6f')]=0x0;this[_0xa5dd('0x70')]=_0x374965[_0xa5dd('0x70')]||0x1e;this[_0xa5dd('0x71')]=_0x374965['dialRecallInQueue']||![];this[_0xa5dd('0x72')]=_0x374965[_0xa5dd('0x72')]||undefined;this[_0xa5dd('0x73')]=_0x374965[_0xa5dd('0x73')]||![];this[_0xa5dd('0x74')]=_0x374965['dialAgiAfterHangupAgent']||![];this['monitor_format']=monitorFormat[_0x374965['monitor_format']]?monitorFormat[_0x374965[_0xa5dd('0xb')]]:undefined;this[_0xa5dd('0x75')]=_0x374965[_0xa5dd('0x75')]||![];this[_0xa5dd('0x76')]=_0x374965['mandatoryDispositionPause']?_0x374965[_0xa5dd('0x76')]:undefined;}module[_0xa5dd('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 8347901..146073b 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 _0x0a25=['remoteUri','serverUrl','Configurations','name','username','accessKey'];(function(_0x7791d5,_0xdab65f){var _0x5ce288=function(_0x2b818d){while(--_0x2b818d){_0x7791d5['push'](_0x7791d5['shift']());}};_0x5ce288(++_0xdab65f);}(_0x0a25,0x15f));var _0x50a2=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0x0a25[_0xa3463d];return _0x50fd67;};'use strict';function VtigerAccount(_0x3bf67b){this['id']=_0x3bf67b['id']||0x0;this[_0x50a2('0x0')]=_0x3bf67b[_0x50a2('0x0')]||'';this['username']=_0x3bf67b[_0x50a2('0x1')]||'';this[_0x50a2('0x2')]=_0x3bf67b[_0x50a2('0x2')]||'';this[_0x50a2('0x3')]=_0x3bf67b[_0x50a2('0x3')]||'';this[_0x50a2('0x4')]=_0x3bf67b[_0x50a2('0x4')]||'';this[_0x50a2('0x5')]=_0x3bf67b[_0x50a2('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x7c53=['remoteUri','serverUrl','Configurations','name','accessKey'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7c53,0x1e8));var _0x37c5=function(_0x550cbd,_0xdf16a1){_0x550cbd=_0x550cbd-0x0;var _0x2932d2=_0x7c53[_0x550cbd];return _0x2932d2;};'use strict';function VtigerAccount(_0x4a6ad4){this['id']=_0x4a6ad4['id']||0x0;this[_0x37c5('0x0')]=_0x4a6ad4[_0x37c5('0x0')]||'';this['username']=_0x4a6ad4['username']||'';this['accessKey']=_0x4a6ad4[_0x37c5('0x1')]||'';this[_0x37c5('0x2')]=_0x4a6ad4['remoteUri']||'';this['serverUrl']=_0x4a6ad4[_0x37c5('0x3')]||'';this[_0x37c5('0x4')]=_0x4a6ad4[_0x37c5('0x4')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index f5e9862..9c605d7 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 _0x1b7e=['token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports','username'];(function(_0x3eccf0,_0x749ec8){var _0x5debc5=function(_0x53a89e){while(--_0x53a89e){_0x3eccf0['push'](_0x3eccf0['shift']());}};_0x5debc5(++_0x749ec8);}(_0x1b7e,0xe9));var _0xe1b7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1b7e[_0x3dd15e];return _0x231fd0;};'use strict';function ZendeskAccount(_0x323827){this['id']=_0x323827['id']||0x0;this['name']=_0x323827['name']||'';this[_0xe1b7('0x0')]=_0x323827[_0xe1b7('0x0')]||'';this['password']=_0x323827['password']||'';this[_0xe1b7('0x1')]=_0x323827[_0xe1b7('0x1')]||'';this['remoteUri']=_0x323827[_0xe1b7('0x2')]||'';this[_0xe1b7('0x3')]=_0x323827[_0xe1b7('0x3')]||'';this[_0xe1b7('0x4')]=_0x323827[_0xe1b7('0x4')]||_0xe1b7('0x5');this[_0xe1b7('0x6')]=_0x323827[_0xe1b7('0x6')]||'';this[_0xe1b7('0x7')]=_0x323827['Configurations']||{};}module[_0xe1b7('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x9a81=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x3165e5,_0x188677){var _0x4f75f4=function(_0x229836){while(--_0x229836){_0x3165e5['push'](_0x3165e5['shift']());}};_0x4f75f4(++_0x188677);}(_0x9a81,0xa9));var _0x19a8=function(_0x32af09,_0x5a39a2){_0x32af09=_0x32af09-0x0;var _0xe8f9d5=_0x9a81[_0x32af09];return _0xe8f9d5;};'use strict';function ZendeskAccount(_0x1a442d){this['id']=_0x1a442d['id']||0x0;this[_0x19a8('0x0')]=_0x1a442d[_0x19a8('0x0')]||'';this[_0x19a8('0x1')]=_0x1a442d['username']||'';this[_0x19a8('0x2')]=_0x1a442d[_0x19a8('0x2')]||'';this[_0x19a8('0x3')]=_0x1a442d[_0x19a8('0x3')]||'';this[_0x19a8('0x4')]=_0x1a442d[_0x19a8('0x4')]||'';this[_0x19a8('0x5')]=_0x1a442d['authType']||'';this[_0x19a8('0x6')]=_0x1a442d[_0x19a8('0x6')]||_0x19a8('0x7');this[_0x19a8('0x8')]=_0x1a442d[_0x19a8('0x8')]||'';this['Configurations']=_0x1a442d[_0x19a8('0x9')]||{};}module[_0x19a8('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index b74da3f..4cc34d2 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 _0x5055=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name'];(function(_0x8b51d8,_0xbe5926){var _0x48f4f3=function(_0x3153ee){while(--_0x3153ee){_0x8b51d8['push'](_0x8b51d8['shift']());}};_0x48f4f3(++_0xbe5926);}(_0x5055,0xf9));var _0x5505=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5055[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x5d074e){this['id']=_0x5d074e['id']||0x0;this[_0x5505('0x0')]=_0x5d074e['name']||'';this[_0x5505('0x1')]=_0x5d074e[_0x5505('0x1')]||'';this[_0x5505('0x2')]=_0x5d074e[_0x5505('0x2')]||'';this[_0x5505('0x3')]=_0x5d074e[_0x5505('0x3')]||'';this[_0x5505('0x4')]=_0x5d074e[_0x5505('0x4')]||'';this[_0x5505('0x5')]=_0x5d074e[_0x5505('0x5')]||'';this[_0x5505('0x6')]=_0x5d074e['serverUrl']||'';this['code']=_0x5d074e[_0x5505('0x7')]||'';this['refreshToken']=_0x5d074e[_0x5505('0x8')]||'';this['Configurations']=_0x5d074e[_0x5505('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0xfdea=['zone','clientId','clientSecret','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x9edfd5,_0x286486){var _0x330738=function(_0x4aceb3){while(--_0x4aceb3){_0x9edfd5['push'](_0x9edfd5['shift']());}};_0x330738(++_0x286486);}(_0xfdea,0xb1));var _0xafde=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xfdea[_0xb0f7c3];return _0x28ea68;};'use strict';function ZohoAccount(_0x40dce5){this['id']=_0x40dce5['id']||0x0;this[_0xafde('0x0')]=_0x40dce5[_0xafde('0x0')]||'';this['description']=_0x40dce5[_0xafde('0x1')]||'';this[_0xafde('0x2')]=_0x40dce5[_0xafde('0x2')]||'';this[_0xafde('0x3')]=_0x40dce5[_0xafde('0x3')]||'';this[_0xafde('0x4')]=_0x40dce5['clientId']||'';this[_0xafde('0x5')]=_0x40dce5[_0xafde('0x5')]||'';this['serverUrl']=_0x40dce5['serverUrl']||'';this['code']=_0x40dce5[_0xafde('0x6')]||'';this[_0xafde('0x7')]=_0x40dce5[_0xafde('0x7')]||'';this[_0xafde('0x8')]=_0x40dce5[_0xafde('0x8')]||{};}module[_0xafde('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 8827684..09872b6 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 _0xb44a=['recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','calleridname','number','exports','moment','isNil','string','uniqueid','idContact','queue','name','type','membername','Agent','channelAgent','format','SIP/%s','Contact','lastName','active','calleridnum','phone','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat'];(function(_0x179e6a,_0x23c5f8){var _0x515f39=function(_0x4ef0fa){while(--_0x4ef0fa){_0x179e6a['push'](_0x179e6a['shift']());}};_0x515f39(++_0x23c5f8);}(_0xb44a,0x1c2));var _0xab44=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xb44a[_0x24237f];return _0x48298e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xab44('0x0'));function checkNameSurname(_0x492c1a,_0x186fec,_0x5c825d){var _0x50cb3c='';if(!_[_0xab44('0x1')](_0x186fec)&&'string'===typeof _0x186fec){_0x50cb3c+=_0x186fec;}if(!_[_0xab44('0x1')](_0x5c825d)&&_0xab44('0x2')===typeof _0x5c825d){_0x50cb3c+='\x20'+_0x5c825d;}if(_0x50cb3c!==''){return _0x50cb3c;}return _0x492c1a;}function Action(_0x2e3662,_0x28681a,_0x2f3948,_0x3303b1,_0x3ead8d){this[_0xab44('0x3')]=_0x2f3948||undefined;this[_0xab44('0x4')]=_0x2e3662['id'];this[_0xab44('0x5')]=_0x28681a[_0xab44('0x6')];this[_0xab44('0x7')]=_0x28681a[_0xab44('0x7')];this['campaigntype']=_0xab44('0x5');this['dialAnswer']=![];this[_0xab44('0x8')]=_['isNil'](_0x2e3662['Agent'])?undefined:_0x2e3662[_0xab44('0x9')][_0xab44('0x6')];this[_0xab44('0xa')]=this[_0xab44('0x8')]?util[_0xab44('0xb')](_0xab44('0xc'),this['membername']):_0x3303b1||undefined;this['calleridname']=checkNameSurname(_0x2e3662[_0xab44('0xd')]['phone'],_0x2e3662[_0xab44('0xd')]['firstName'],_0x2e3662[_0xab44('0xd')][_0xab44('0xe')]);this[_0xab44('0xf')]=_0x2e3662[_0xab44('0xf')]||![];this[_0xab44('0x10')]=_0x2e3662[_0xab44('0x11')];this['scheduledat']=_0x2e3662['scheduledat'];this[_0xab44('0x12')]=_0x2e3662[_0xab44('0x12')]||0x0;this[_0xab44('0x13')]=_0x2e3662[_0xab44('0x13')]||0x0;this[_0xab44('0x14')]=_0x2e3662[_0xab44('0x14')]||0x0;this[_0xab44('0x15')]=(_0x2e3662[_0xab44('0x12')]||0x0)+(_0x2e3662[_0xab44('0x13')]||0x0)+(_0x2e3662[_0xab44('0x14')]||0x0)+(_0x2e3662[_0xab44('0x16')]||0x0)+(_0x2e3662['countdropretry']||0x0)+(_0x2e3662[_0xab44('0x17')]||0x0)+(_0x2e3662[_0xab44('0x18')]||0x0)+(_0x2e3662[_0xab44('0x19')]||0x0);this[_0xab44('0x16')]=_0x2e3662[_0xab44('0x16')]||0x0;this['countdropretry']=_0x2e3662[_0xab44('0x1a')]||0x0;this['countabandonedretry']=_0x2e3662[_0xab44('0x17')]||0x0;this[_0xab44('0x18')]=_0x2e3662[_0xab44('0x18')]||0x0;this[_0xab44('0x19')]=_0x2e3662['countagentrejectretry']||0x0;this[_0xab44('0x1b')]=_0x2e3662[_0xab44('0x1b')];this[_0xab44('0x1c')]=_0x2e3662[_0xab44('0x1c')];this[_0xab44('0x1d')]=_0x2e3662[_0xab44('0x1d')];this[_0xab44('0x1e')]=_0x2e3662['recallme'];this['ContactId']=_0x2e3662[_0xab44('0x1f')];this['ListId']=_0x2e3662[_0xab44('0x20')];this['UserId']=_[_0xab44('0x1')](_0x2e3662['Agent'])?_0x2e3662['UserId']:_0x2e3662[_0xab44('0x9')]['id'];this[_0xab44('0x21')]=_0x2e3662[_0xab44('0x21')];this[_0xab44('0x22')]='';this[_0xab44('0x23')]='';}Action['prototype'][_0xab44('0x24')]=function(){return util[_0xab44('0xb')]('\x22%s\x22\x20<%s>',this[_0xab44('0x25')],this[_0xab44('0x26')]);};module[_0xab44('0x27')]=Action; \ No newline at end of file +var _0xeb3b=['Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','calleridname','number','util','lodash','moment','isNil','uniqueid','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','format','SIP/%s','phone'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x19ef2b,_0x354f66){_0x19ef2b=_0x19ef2b-0x0;var _0x4df537=_0xeb3b[_0x19ef2b];return _0x4df537;};'use strict';var util=require(_0xbeb3('0x0'));var _=require(_0xbeb3('0x1'));var moment=require(_0xbeb3('0x2'));function checkNameSurname(_0x33e049,_0xba125a,_0x565c41){var _0x5df0cb='';if(!_[_0xbeb3('0x3')](_0xba125a)&&'string'===typeof _0xba125a){_0x5df0cb+=_0xba125a;}if(!_[_0xbeb3('0x3')](_0x565c41)&&'string'===typeof _0x565c41){_0x5df0cb+='\x20'+_0x565c41;}if(_0x5df0cb!==''){return _0x5df0cb;}return _0x33e049;}function Action(_0x2e8a69,_0x5ae6f9,_0x8d8cce,_0x294cc9,_0x406927){this[_0xbeb3('0x4')]=_0x8d8cce||undefined;this['idContact']=_0x2e8a69['id'];this[_0xbeb3('0x5')]=_0x5ae6f9[_0xbeb3('0x6')];this[_0xbeb3('0x7')]=_0x5ae6f9[_0xbeb3('0x7')];this[_0xbeb3('0x8')]=_0xbeb3('0x5');this[_0xbeb3('0x9')]=![];this['membername']=_[_0xbeb3('0x3')](_0x2e8a69[_0xbeb3('0xa')])?undefined:_0x2e8a69['Agent'][_0xbeb3('0x6')];this[_0xbeb3('0xb')]=this[_0xbeb3('0xc')]?util[_0xbeb3('0xd')](_0xbeb3('0xe'),this[_0xbeb3('0xc')]):_0x294cc9||undefined;this['calleridname']=checkNameSurname(_0x2e8a69['Contact'][_0xbeb3('0xf')],_0x2e8a69[_0xbeb3('0x10')]['firstName'],_0x2e8a69['Contact'][_0xbeb3('0x11')]);this[_0xbeb3('0x12')]=_0x2e8a69[_0xbeb3('0x12')]||![];this[_0xbeb3('0x13')]=_0x2e8a69[_0xbeb3('0xf')];this['scheduledat']=_0x2e8a69[_0xbeb3('0x14')];this['countbusyretry']=_0x2e8a69[_0xbeb3('0x15')]||0x0;this['countcongestionretry']=_0x2e8a69['countcongestionretry']||0x0;this['countnoanswerretry']=_0x2e8a69[_0xbeb3('0x16')]||0x0;this[_0xbeb3('0x17')]=(_0x2e8a69[_0xbeb3('0x15')]||0x0)+(_0x2e8a69[_0xbeb3('0x18')]||0x0)+(_0x2e8a69['countnoanswerretry']||0x0)+(_0x2e8a69[_0xbeb3('0x19')]||0x0)+(_0x2e8a69[_0xbeb3('0x1a')]||0x0)+(_0x2e8a69[_0xbeb3('0x1b')]||0x0)+(_0x2e8a69['countmachineretry']||0x0)+(_0x2e8a69['countagentrejectretry']||0x0);this[_0xbeb3('0x19')]=_0x2e8a69['countnosuchnumberretry']||0x0;this[_0xbeb3('0x1a')]=_0x2e8a69['countdropretry']||0x0;this['countabandonedretry']=_0x2e8a69[_0xbeb3('0x1b')]||0x0;this[_0xbeb3('0x1c')]=_0x2e8a69[_0xbeb3('0x1c')]||0x0;this['countagentrejectretry']=_0x2e8a69[_0xbeb3('0x1d')]||0x0;this[_0xbeb3('0x1e')]=_0x2e8a69['callback'];this[_0xbeb3('0x1f')]=_0x2e8a69[_0xbeb3('0x1f')];this['callbackat']=_0x2e8a69[_0xbeb3('0x20')];this[_0xbeb3('0x21')]=_0x2e8a69[_0xbeb3('0x21')];this[_0xbeb3('0x22')]=_0x2e8a69[_0xbeb3('0x22')];this[_0xbeb3('0x23')]=_0x2e8a69[_0xbeb3('0x23')];this[_0xbeb3('0x24')]=_[_0xbeb3('0x3')](_0x2e8a69['Agent'])?_0x2e8a69['UserId']:_0x2e8a69[_0xbeb3('0xa')]['id'];this['VoiceQueueId']=_0x2e8a69[_0xbeb3('0x25')];this[_0xbeb3('0x26')]='';this[_0xbeb3('0x27')]='';}Action[_0xbeb3('0x28')]['getCaller']=function(){return util[_0xbeb3('0xd')]('\x22%s\x22\x20<%s>',this[_0xbeb3('0x29')],this[_0xbeb3('0x2a')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index b992278..c2cb4c9 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 _0x22a0=['hanguprequest','dialend','newexten','syncNewExten','varset','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','emit','outbound','name','strategy','answered','sumBillable','sumDuration','sumHoldTime','talking','type','unmanaged','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','stringify','md5','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','dialMethod','booked','clockClearZombieChannels','setMessage','recallMe','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','actions','queue','originated:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','status','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','[action]','size','hasOwnProperty','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','IsNotLoggedIn','loggedIn','isActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','pTalking','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','acw','custom:agentConnectPreview','complete','outboundAnswerCallsDay','total','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','linkedid','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','resolve','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','[Preview][execCall][failure]','Call\x20failed','logBlacklist','SIP/%s','reachable','execRun','pick','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','trim','getCallerId','callerid','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','channelAgent','calleridnum','user:%s','user:agentconnect','accountcode','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','clone','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','isUndefined','transfer','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','lodash','bluebird','uuid','moment','ioredis','../../../config/logger','preview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','redis','socket.io-emitter','prototype','tail','sequence','campaignsPreview','voiceQueues','trunks','agents','originateresponse','syncOriginateResponse','bind','syncHangup'];(function(_0x380068,_0x58e889){var _0xca6cf4=function(_0x4150e6){while(--_0x4150e6){_0x380068['push'](_0x380068['shift']());}};_0xca6cf4(++_0x58e889);}(_0x22a0,0x14e));var _0x022a=function(_0x3956b0,_0x2dba73){_0x3956b0=_0x3956b0-0x0;var _0x520f2d=_0x22a0[_0x3956b0];return _0x520f2d;};'use strict';var util=require('util');var _=require(_0x022a('0x0'));var BPromise=require(_0x022a('0x1'));var uuid=require(_0x022a('0x2'));var moment=require(_0x022a('0x3'));var md5=require('md5');var Redis=require(_0x022a('0x4'));var config=require('../../../config/environment');var logger=require(_0x022a('0x5'))(_0x022a('0x6'));var loggerAction=require(_0x022a('0x5'))('actionPreview');var ami=require(_0x022a('0x7'));var rpcDb=require(_0x022a('0x8'));var cmHopperAdditionalPhone=require(_0x022a('0x9'));var Action=require(_0x022a('0xa'));var ut=require(_0x022a('0xb'));config[_0x022a('0xc')]=_['defaults'](config[_0x022a('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x022a('0xd'))(new Redis(config[_0x022a('0xc')]));var Sequence=function(){};Sequence[_0x022a('0xe')]['enqueue']=function(_0x23e4d1){this[_0x022a('0xf')]=this[_0x022a('0xf')]?this[_0x022a('0xf')]['finally'](_0x23e4d1):_0x23e4d1();};function Preview(_0x1b617f){this[_0x022a('0x10')]=new Sequence();this[_0x022a('0x11')]=_0x1b617f[_0x022a('0x12')];this[_0x022a('0x13')]=_0x1b617f[_0x022a('0x13')];this['actions']={};this[_0x022a('0x14')]=_0x1b617f['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0x022a('0x15'),this[_0x022a('0x16')][_0x022a('0x17')](this));ami['on']('hangup',this[_0x022a('0x18')]['bind'](this));ami['on'](_0x022a('0x19'),this['syncHangupRequest'][_0x022a('0x17')](this));ami['on'](_0x022a('0x1a'),this['syncDialEnd']['bind'](this));ami['on'](_0x022a('0x1b'),this[_0x022a('0x1c')][_0x022a('0x17')](this));ami['on'](_0x022a('0x1d'),this[_0x022a('0x1e')][_0x022a('0x17')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x022a('0x17')](this));ami['on'](_0x022a('0x1f'),this[_0x022a('0x20')][_0x022a('0x17')](this));this[_0x022a('0x21')](this[_0x022a('0x11')]);}function emit(_0x5ac16c,_0x221afb,_0x55971b){io['to'](_0x5ac16c)[_0x022a('0x22')](_0x221afb,_0x55971b);}function emitCampaignPreview(_0x1fd97e){if(_0x1fd97e['type']===_0x022a('0x23')){var _0x4c9e4e={'id':_0x1fd97e['id'],'name':_0x1fd97e[_0x022a('0x24')],'strategy':_0x1fd97e[_0x022a('0x25')],'answered':_0x1fd97e[_0x022a('0x26')],'available':_0x1fd97e['available'],'loggedIn':_0x1fd97e['loggedIn'],'pTalking':_0x1fd97e['pTalking'],'sumBillable':_0x1fd97e[_0x022a('0x27')],'sumDuration':_0x1fd97e[_0x022a('0x28')],'sumHoldTime':_0x1fd97e[_0x022a('0x29')]||0x0,'talking':_0x1fd97e[_0x022a('0x2a')],'total':_0x1fd97e['total'],'type':_0x1fd97e[_0x022a('0x2b')],'unmanaged':_0x1fd97e[_0x022a('0x2c')],'abandoned':_0x1fd97e['abandoned'],'waiting':_0x1fd97e[_0x022a('0x2d')],'loggedInDb':_0x1fd97e[_0x022a('0x2e')],'dialActive':_0x1fd97e[_0x022a('0x2f')],'dialMethod':_0x1fd97e['dialMethod'],'dialOriginateCallerIdName':_0x1fd97e[_0x022a('0x30')],'dialOriginateCallerIdNumber':_0x1fd97e[_0x022a('0x31')],'dialOriginateTimeout':_0x1fd97e[_0x022a('0x32')],'dialPrefix':_0x1fd97e['dialPrefix'],'outboundAnswerAgiCallsDay':_0x1fd97e[_0x022a('0x33')],'outboundAnswerCallsDay':_0x1fd97e['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x1fd97e[_0x022a('0x34')],'outboundBusyCallsDay':_0x1fd97e[_0x022a('0x35')],'outboundCongestionCallsDay':_0x1fd97e[_0x022a('0x36')],'outboundDropCallsDayACS':_0x1fd97e[_0x022a('0x37')],'outboundDropCallsDayCallersExit':_0x1fd97e[_0x022a('0x38')],'outboundDropCallsDayTimeout':_0x1fd97e[_0x022a('0x39')],'outboundNoAnswerCallsDay':_0x1fd97e[_0x022a('0x3a')],'outboundNoSuchCallsDay':_0x1fd97e[_0x022a('0x3b')],'outboundOriginateFailureCallsDay':_0x1fd97e[_0x022a('0x3c')],'outboundReCallsDay':_0x1fd97e['outboundReCallsDay'],'outboundRejectCallsDay':_0x1fd97e[_0x022a('0x3d')],'outboundUnknownCallsDay':_0x1fd97e['outboundUnknownCallsDay'],'outboundAbandonedCallsDay':_0x1fd97e[_0x022a('0x3e')],'predictiveIntervalAnsweredCalls':_0x1fd97e['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x1fd97e[_0x022a('0x3f')],'predictiveIntervalAvgTalktime':_0x1fd97e[_0x022a('0x40')],'predictiveIntervalDroppedCallsCallersExit':_0x1fd97e[_0x022a('0x41')],'predictiveIntervalDroppedCallsTimeout':_0x1fd97e['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x1fd97e[_0x022a('0x42')],'predictiveIntervalErlangCallsDroppedCalls':_0x1fd97e[_0x022a('0x43')],'predictiveIntervalHitRate':_0x1fd97e[_0x022a('0x44')],'predictiveIntervalMultiplicativeFactor':_0x1fd97e[_0x022a('0x45')],'predictiveIntervalPauses':_0x1fd97e[_0x022a('0x46')],'predictiveIntervalAvailable':_0x1fd97e[_0x022a('0x47')],'predictiveIntervalTotalCalls':_0x1fd97e[_0x022a('0x48')],'message':_0x1fd97e[_0x022a('0x49')],'originated':_0x1fd97e[_0x022a('0x4a')],'erlangCalls':_0x1fd97e[_0x022a('0x4b')],'erlangCallToSecond':_0x1fd97e[_0x022a('0x4c')],'erlangAbandonmentRate':_0x1fd97e[_0x022a('0x4d')],'erlangBusyFactor':_0x1fd97e[_0x022a('0x4e')],'startPredictive':_0x1fd97e[_0x022a('0x4f')],'startProgressive':_0x1fd97e[_0x022a('0x50')]};if(_0x1fd97e[_0x022a('0x51')]){_0x4c9e4e[_0x022a('0x51')]={'id':_0x1fd97e[_0x022a('0x51')]['id'],'name':_0x1fd97e[_0x022a('0x51')][_0x022a('0x24')],'active':_0x1fd97e['Trunk'][_0x022a('0x52')],'callerid':_0x1fd97e[_0x022a('0x51')]['callerid']};}if(_0x1fd97e['Interval']){_0x4c9e4e[_0x022a('0x53')]={'id':_0x1fd97e['Interval']['id'],'name':_0x1fd97e[_0x022a('0x53')][_0x022a('0x24')]};}var _0x527b00=md5(JSON[_0x022a('0x54')](_0x4c9e4e));if(_0x1fd97e[_0x022a('0x55')]!==_0x527b00){_0x1fd97e[_0x022a('0x55')]=_0x527b00;emit(util[_0x022a('0x56')](_0x022a('0x57'),_0x4c9e4e['name']),'voice_queue:save',_0x4c9e4e);}}}function emitVoiceQueueChannelRemove(_0x3951f7){logger[_0x022a('0x58')](_0x022a('0x59'),JSON[_0x022a('0x54')](_0x3951f7));emit(util['format'](_0x022a('0x57'),_0x3951f7['name']),_0x022a('0x5a'),_0x3951f7);io[_0x022a('0x22')]('voice_queue_presence:remove',_0x3951f7);}function notSendMessagesQueue(_0x269221){if(_0x269221[_0x022a('0x5b')]){if(_0x269221[_0x022a('0x4a')]===0x0&&_0x269221['pTalking']===0x0){_0x269221['sendMessageOneNotActive']=![];_0x269221['available']=0x0;_0x269221['paused']=0x0;_0x269221[_0x022a('0x49')]='NOT_ACTIVE';ut[_0x022a('0x5c')](_0x022a('0x5d'),_0x269221['name']+_0x022a('0x5e'));}else{_0x269221[_0x022a('0x49')]=_0x022a('0x5f');ut[_0x022a('0x5c')](_0x022a('0x5d'),_0x269221[_0x022a('0x24')]+_0x022a('0x60'));}emitCampaignPreview(_0x269221);}}Preview[_0x022a('0xe')]['loopCampaigns']=function(){var _0x399d9a=this;setInterval(function(){_0x399d9a[_0x022a('0x61')]();},0x7cf);};Preview[_0x022a('0xe')]['syncCampaigns']=function(){var _0x134e52=this[_0x022a('0x11')];this['clockClearZombieChannels']+=0x1;for(var _0x42d839 in _0x134e52){if(_0x134e52['hasOwnProperty'](_0x42d839)&&(_0x134e52[_0x42d839]['dialMethod']===_0x022a('0x6')||_0x134e52[_0x42d839][_0x022a('0x62')]===_0x022a('0x63'))&&_0x134e52[_0x42d839][_0x022a('0x2b')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x022a('0x64')]=0x0;this['clearZombieChannels']();}}if(_0x134e52['hasOwnProperty'](_0x42d839)&&_0x134e52[_0x42d839][_0x022a('0x62')]===_0x022a('0x6')&&_0x134e52[_0x42d839]['type']===_0x022a('0x23')){if(_0x134e52[_0x42d839][_0x022a('0x2f')]){this[_0x022a('0x65')](_0x134e52[_0x42d839]);this[_0x022a('0x66')](_0x134e52[_0x42d839]);}else{notSendMessagesQueue(_0x134e52[_0x42d839]);}}}};Preview[_0x022a('0xe')][_0x022a('0x67')]=function(_0xfa3265){var _0x47b875=this;this[_0x022a('0x10')][_0x022a('0x68')](function(){if(!_[_0x022a('0x69')](_0x47b875['actions'][_0xfa3265])){loggerAction[_0x022a('0x58')](_0x022a('0x6a'),_0xfa3265,'Queue',_0x47b875[_0x022a('0x6b')][_0xfa3265][_0x022a('0x6c')],_0x022a('0x6d'),JSON[_0x022a('0x54')](_0x47b875[_0x022a('0x11')][_0x47b875[_0x022a('0x6b')][_0xfa3265][_0x022a('0x6c')]][_0x022a('0x4a')]),'pTalking:\x20',JSON[_0x022a('0x54')](_0x47b875[_0x022a('0x11')][_0x47b875[_0x022a('0x6b')][_0xfa3265][_0x022a('0x6c')]]['pTalking']),JSON['stringify'](_0x47b875[_0x022a('0x6b')][_0xfa3265][_0x022a('0x6e')]),JSON['stringify'](_['pick'](_0x47b875[_0x022a('0x6b')][_0xfa3265],[_0x022a('0x6f'),_0x022a('0x70'),_0x022a('0x71'),_0x022a('0x72')])));return ami[_0x022a('0x73')]({'action':_0x022a('0x74'),'channel':_0x47b875['actions'][_0xfa3265]['channel']})['catch'](function(_0x277d85){if(_0x277d85[_0x022a('0x49')]===_0x022a('0x75')){setTimeout(function(){if(_0x47b875['actions'][_0xfa3265]){ut[_0x022a('0x76')](_0x47b875[_0x022a('0x11')][_0x47b875[_0x022a('0x6b')][_0xfa3265][_0x022a('0x6c')]],_0x022a('0x77'));if(_0x47b875['actions'][_0xfa3265][_0x022a('0x6e')]===!![]){ut[_0x022a('0x78')](_0x47b875[_0x022a('0x11')][_0x47b875[_0x022a('0x6b')][_0xfa3265][_0x022a('0x6c')]],'[clearZombieChannel]');ut[_0x022a('0x79')](_0x022a('0x7a')+_0xfa3265,_0x47b875['actions'][_0xfa3265][_0x022a('0x6c')]);}ut[_0x022a('0x79')]('[Dialer][checkChannel][Preview]'+_0xfa3265,_0x47b875[_0x022a('0x6b')][_0xfa3265][_0x022a('0x6c')]);delete _0x47b875[_0x022a('0x6b')][_0xfa3265];}},0x2328);}});}});};Preview[_0x022a('0xe')][_0x022a('0x7b')]=function(){var _0x6761ec=this;loggerAction[_0x022a('0x58')](_0x022a('0x7c'),_[_0x022a('0x7d')](this[_0x022a('0x6b')]));for(var _0x4e2861 in this[_0x022a('0x6b')]){if(_0x6761ec[_0x022a('0x6b')][_0x022a('0x7e')](_0x4e2861)){_0x6761ec[_0x022a('0x67')](_0x4e2861);}}};Preview[_0x022a('0xe')][_0x022a('0x66')]=function(_0x3b7a78){var _0x387ace=this;rpcDb[_0x022a('0x7f')](_0x3b7a78['id'],ut[_0x022a('0x80')](this['agents']))[_0x022a('0x81')](function(_0x41aff5){if(!_[_0x022a('0x69')](_0x41aff5)){for(var _0x4da17=0x0;_0x4da17<_0x41aff5[_0x022a('0x82')];_0x4da17+=0x1){if(ut[_0x022a('0x83')](_0x41aff5[_0x4da17]['scheduledat'])<_0x3b7a78[_0x022a('0x84')]*0x3c){if(_0x41aff5[_0x4da17][_0x022a('0x85')]&&!_0x41aff5[_0x4da17][_0x022a('0x85')][_0x022a('0x86')]){_0x387ace[_0x022a('0x87')](_0x41aff5[_0x4da17]['id'])[_0x022a('0x81')](ut[_0x022a('0x88')](_0x022a('0x89')))[_0x022a('0x8a')](ut[_0x022a('0x88')](_0x022a('0x89')));}else{rpcDb[_0x022a('0x8b')](_0x41aff5[_0x4da17]['id']);}}else{var _0x838175=new Action(_0x41aff5[_0x4da17],_0x3b7a78);_0x838175[_0x022a('0x8c')]=moment()[_0x022a('0x56')](_0x022a('0x8d'));_0x3b7a78['outboundReCallsDay']+=0x1;ut[_0x022a('0x8e')](_0x838175,0x17,_0x022a('0x8f'));if(_0x3b7a78[_0x022a('0x90')]){rpcDb[_0x022a('0x91')](ut[_0x022a('0x92')](_0x41aff5[_0x4da17]));rpcDb[_0x022a('0x93')](_0x838175,'[HistoryDialRecallInQueue][historyCatch]');}else{ut[_0x022a('0x8e')](_0x838175,0x16,'RecallFailedTimeout');rpcDb[_0x022a('0x93')](_0x838175,_0x022a('0x94'));rpcDb[_0x022a('0x95')](_0x838175,_0x022a('0x94'));}}}}})[_0x022a('0x8a')](ut[_0x022a('0x88')]('[getContactRecallMe]'));};Preview['prototype'][_0x022a('0x65')]=function(_0x221cf3){_0x221cf3[_0x022a('0x5b')]=!![];if(ut[_0x022a('0x96')](_0x221cf3[_0x022a('0x97')])){_0x221cf3[_0x022a('0x49')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x022a('0x98')](_0x221cf3['dialActive'])){_0x221cf3[_0x022a('0x49')]=_0x022a('0x99');}else if(!this[_0x022a('0x9a')](_0x221cf3[_0x022a('0x51')])){if(!this[_0x022a('0x9a')](_0x221cf3[_0x022a('0x9b')])){_0x221cf3[_0x022a('0x49')]=_0x022a('0x9c');}else{_0x221cf3['message']=_0x022a('0x9d');}}else{_0x221cf3['message']=_0x022a('0x9d');}emitCampaignPreview(_0x221cf3);};Preview[_0x022a('0xe')][_0x022a('0x9e')]=function(_0xeba6c2,_0x402753,_0x5bec20){var _0x31ecca=this;var _0x5cce1b=this[_0x022a('0x6b')][_0x402753];var _0x1b35d0=this[_0x022a('0x11')][_0x5cce1b[_0x022a('0x6c')]];var _0x3c08b2;var _0x5581db=![];var _0xc483b0=0x2;var _0x564b99=0x3;if(_0x1b35d0){switch(_0x5bec20){case'1':_0x1b35d0[_0x022a('0x3b')]+=0x1;_0x5cce1b[_0x022a('0x9f')]+=0x1;_0x5cce1b['countglobal']=ut[_0x022a('0xa0')](_0x5cce1b);ut[_0x022a('0x8e')](_0x5cce1b,0x0,_0x022a('0xa1'));ami['emit'](_0x022a('0xa2'),ut[_0x022a('0xa3')](_0x5cce1b,_0x022a('0xa4')));rpcDb[_0x022a('0x93')](_0x5cce1b,_0x022a('0xa5'));_0x31ecca[_0x022a('0xa6')](_0x5cce1b,'0',_0x1b35d0)['then'](function(_0x109f8a){_0x5581db=_0x109f8a[_0x022a('0xa7')]==0x1;_0xc483b0=_0x1b35d0[_0x022a('0xa8')];_0x564b99=_0x1b35d0[_0x022a('0xa9')];if(!_0x5581db){if(ut[_0x022a('0xa0')](_0x5cce1b)>=_0x1b35d0['dialGlobalMaxRetry']){_0x3c08b2=ut[_0x022a('0xaa')](_0x5cce1b,0xf,_0x022a('0xab'));rpcDb[_0x022a('0x95')](_0x3c08b2,_0x022a('0xac'));}else{if(_0x5cce1b[_0x022a('0x9f')]>=_0x1b35d0[_0x022a('0xad')]){rpcDb['createCustomerFinal'](_0x5cce1b,_0x022a('0xac'));}else{rpcDb[_0x022a('0xae')](ut[_0x022a('0xaf')](_0x5cce1b,_0x022a('0x9f'),_0x1b35d0[_0x022a('0xa8')]),_0x5cce1b[_0x022a('0xb0')],_0x5cce1b[_0x022a('0xb1')]);}}delete this[_0x022a('0x6b')][_0xeba6c2['linkedid']];}else{_0x5cce1b[_0x022a('0x9f')]++;logger[_0x022a('0x58')](_0x022a('0xb2'),_0x5cce1b['countnosuchnumberretry']);logger[_0x022a('0x58')]('id',_0x5cce1b[_0x022a('0xb3')]);_0x31ecca[_0x022a('0xb4')]({'id':_0x5cce1b[_0x022a('0xb3')],'field':{'countnosuchnumberretry':_0x5cce1b['countnosuchnumberretry']}})['then'](function(){_0x31ecca[_0x022a('0xb5')](_0x5cce1b,_0xc483b0,_0x564b99)[_0x022a('0x81')](function(){});});}});break;case _0x022a('0xb6'):var _0x4f38bc=moment()['format'](_0x022a('0x8d'));_0x5cce1b[_0x022a('0xb7')]=_0x4f38bc;_0x5cce1b['answertime']=_0x4f38bc;_0x5cce1b[_0x022a('0x6e')]=!![];_0x1b35d0[_0x022a('0xb8')]+=0x1;logger[_0x022a('0x58')]('[syncHangup][talking][increment]',_0x5cce1b[_0x022a('0xb9')],_0x022a('0xba'),_0x1b35d0[_0x022a('0x24')],_0x022a('0xbb'),_0x1b35d0['pTalking']);ami[_0x022a('0x22')](_0x022a('0xbc'),ut[_0x022a('0xa3')](_0x5cce1b,'connect',this[_0x022a('0x11')][_0x5cce1b[_0x022a('0x6c')]]));if(_0x1b35d0[_0x022a('0xbd')]){ami['emit'](_0x022a('0xbe'),ut['buildAcw'](_0x5cce1b));}break;case'16':ami['emit']('custom:agentcomplete',ut['buildObj'](_0x5cce1b,_0x022a('0xbf'),this[_0x022a('0x11')][_0x5cce1b['queue']]));emitVoiceQueueChannelRemove(ut[_0x022a('0xa3')](_0x5cce1b,_0x022a('0xbf')));_0x1b35d0[_0x022a('0xc0')]+=0x1;_0x1b35d0[_0x022a('0xc1')]+=0x1;_0x1b35d0[_0x022a('0x26')]+=0x1;ut['decrementTalkink'](_0x1b35d0,_0x022a('0xc2'));_0x5cce1b[_0x022a('0xc3')]=ut['totalGlobal'](_0x5cce1b);ut['logCustomer'](_0x5cce1b,0x4,_0x022a('0xc4'));rpcDb[_0x022a('0x93')](_0x5cce1b,_0x022a('0xc5'));rpcDb[_0x022a('0x95')](_0x5cce1b,_0x022a('0xc6'));rpcDb['crateCustomerReportQueue'](_0x5cce1b);_0x1b35d0['sumDuration']+=_0x5cce1b['talktime'];_0x1b35d0[_0x022a('0x27')]+=_0x5cce1b[_0x022a('0xc7')];logger['info'](_0x022a('0xc8'),_0x5cce1b[_0x022a('0xb9')],_0x022a('0xba'),_0x1b35d0['name'],_0x022a('0xbb'),_0x1b35d0[_0x022a('0xb8')]);delete this['actions'][_0xeba6c2[_0x022a('0xc9')]];break;case _0x022a('0xca'):_0x1b35d0['outboundBusyCallsDay']+=0x1;_0x5cce1b[_0x022a('0xcb')]+=0x1;_0x5cce1b[_0x022a('0xc3')]=ut['totalGlobal'](_0x5cce1b);ut[_0x022a('0x8e')](_0x5cce1b,0x5,_0x022a('0xcc'));_0xc483b0=_0x1b35d0['dialBusyRetryFrequency'];_0x564b99=_0x1b35d0[_0x022a('0xa9')];ami[_0x022a('0x22')](_0x022a('0xcd'),ut[_0x022a('0xa3')](_0x5cce1b,_0x022a('0xce')));rpcDb[_0x022a('0x93')](_0x5cce1b,_0x022a('0xcf'));_0x31ecca[_0x022a('0xa6')](_0x5cce1b,'5',_0x1b35d0)[_0x022a('0x81')](function(_0x2afc7d){_0x5581db=_0x2afc7d[_0x022a('0xa7')]==0x1;if(!_0x5581db){if(ut['totalGlobal'](_0x5cce1b)>=_0x1b35d0[_0x022a('0xd0')]){_0x3c08b2=ut[_0x022a('0xaa')](_0x5cce1b,0xf,_0x022a('0xab'));rpcDb['createCustomerFinal'](_0x3c08b2,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x5cce1b[_0x022a('0xcb')]>=_0x1b35d0[_0x022a('0xd1')]){rpcDb[_0x022a('0x95')](_0x5cce1b,_0x022a('0xcf'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5cce1b,_0x022a('0xcb'),_0x1b35d0[_0x022a('0xd2')]),_0x5cce1b[_0x022a('0xb0')],_0x5cce1b[_0x022a('0xb1')]);}}}else{_0x5cce1b['countbusyretry']++;_0x31ecca[_0x022a('0xb4')]({'id':_0x5cce1b[_0x022a('0xb3')],'field':{'countbusyretry':_0x5cce1b['countbusyretry']}})[_0x022a('0x81')](function(){_0x31ecca['swapAdditionalPhones'](_0x5cce1b,_0xc483b0,_0x564b99)[_0x022a('0x81')](function(){});});}});break;case _0x022a('0xd3'):_0x1b35d0['outboundNoAnswerCallsDay']+=0x1;_0x5cce1b[_0x022a('0xd4')]+=0x1;_0x5cce1b[_0x022a('0xc3')]=ut[_0x022a('0xa0')](_0x5cce1b);ut['logCustomer'](_0x5cce1b,0x3,_0x022a('0xd5'));_0xc483b0=_0x1b35d0[_0x022a('0xd6')];_0x564b99=_0x1b35d0[_0x022a('0xa9')];ami['emit']('custom:agentnoanswer',ut[_0x022a('0xa3')](_0x5cce1b,'noanswer'));rpcDb[_0x022a('0x93')](_0x5cce1b,_0x022a('0xd7'));_0x31ecca[_0x022a('0xa6')](_0x5cce1b,'3',_0x1b35d0)[_0x022a('0x81')](function(_0x55d369){_0x5581db=_0x55d369[_0x022a('0xa7')]==0x1;if(!_0x5581db){if(ut[_0x022a('0xa0')](_0x5cce1b)>=_0x1b35d0[_0x022a('0xd0')]){_0x3c08b2=ut[_0x022a('0xaa')](_0x5cce1b,0xf,_0x022a('0xab'));rpcDb[_0x022a('0x95')](_0x3c08b2,_0x022a('0xd8'));}else{if(_0x5cce1b[_0x022a('0xd4')]>=_0x1b35d0[_0x022a('0xd9')]){rpcDb[_0x022a('0x95')](_0x5cce1b,_0x022a('0xd7'));}else{rpcDb[_0x022a('0xae')](ut['scheduledAt'](_0x5cce1b,_0x022a('0xd4'),_0x1b35d0[_0x022a('0xd6')]),_0x5cce1b[_0x022a('0xb0')],_0x5cce1b['activeContact']);}}}else{_0x5cce1b[_0x022a('0xd4')]++;_0x31ecca['incrementPreviewCounters']({'id':_0x5cce1b['idContact'],'field':{'countnoanswerretry':_0x5cce1b['countnoanswerretry']}})[_0x022a('0x81')](function(){_0x31ecca[_0x022a('0xb5')](_0x5cce1b,_0xc483b0,_0x564b99)['then'](function(){});});}});break;case _0x022a('0xda'):_0x1b35d0[_0x022a('0x36')]+=0x1;_0x5cce1b[_0x022a('0xdb')]+=0x1;_0x5cce1b['countglobal']=ut[_0x022a('0xa0')](_0x5cce1b);ut['logCustomer'](_0x5cce1b,0x8,_0x022a('0xdc'));_0xc483b0=_0x1b35d0[_0x022a('0xdd')];_0x564b99=_0x1b35d0['callAdditionalPhoneAfterMin'];ami[_0x022a('0x22')](_0x022a('0xde'),ut[_0x022a('0xa3')](_0x5cce1b,_0x022a('0xdf')));rpcDb[_0x022a('0x93')](_0x5cce1b,_0x022a('0xe0'));_0x31ecca[_0x022a('0xa6')](_0x5cce1b,'8',_0x1b35d0)[_0x022a('0x81')](function(_0x55db1f){_0x5581db=_0x55db1f[_0x022a('0xa7')]==0x1;if(!_0x5581db){if(ut['totalGlobal'](_0x5cce1b)>=_0x1b35d0[_0x022a('0xd0')]){_0x3c08b2=ut[_0x022a('0xaa')](_0x5cce1b,0xf,'Global');rpcDb['createCustomerFinal'](_0x3c08b2,_0x022a('0xe1'));}else{if(_0x5cce1b['countcongestionretry']>=_0x1b35d0[_0x022a('0xe2')]){rpcDb[_0x022a('0x95')](_0x5cce1b,_0x022a('0xe0'));}else{rpcDb[_0x022a('0xae')](ut['scheduledAt'](_0x5cce1b,_0x022a('0xdb'),_0x1b35d0[_0x022a('0xd2')]),_0x5cce1b['unlockAgent'],_0x5cce1b[_0x022a('0xb1')]);}}}else{_0x5cce1b[_0x022a('0xdb')]++;_0x31ecca['incrementPreviewCounters']({'id':_0x5cce1b[_0x022a('0xb3')],'field':{'countcongestionretry':_0x5cce1b[_0x022a('0xdb')]}})[_0x022a('0x81')](function(){_0x31ecca[_0x022a('0xb5')](_0x5cce1b,_0xc483b0,_0x564b99)[_0x022a('0x81')](function(){});});}});break;case _0x022a('0xe3'):_0x1b35d0[_0x022a('0x3d')]+=0x1;_0x5cce1b[_0x022a('0xe4')]+=0x1;_0x5cce1b[_0x022a('0xc3')]=ut[_0x022a('0xa0')](_0x5cce1b);ut[_0x022a('0x8e')](_0x5cce1b,0x14,'AgentReject');_0xc483b0=_0x1b35d0[_0x022a('0xe5')];_0x564b99=_0x1b35d0[_0x022a('0xa9')];ami[_0x022a('0x22')](_0x022a('0xe6'),ut[_0x022a('0xa3')](_0x5cce1b,_0x022a('0xe7')));rpcDb['createCustomerHistory'](_0x5cce1b,_0x022a('0xe8'));_0x31ecca[_0x022a('0xa6')](_0x5cce1b,'20',_0x1b35d0)[_0x022a('0x81')](function(_0x38e540){_0x5581db=_0x38e540[_0x022a('0xa7')]==0x1;if(!_0x5581db){if(ut[_0x022a('0xa0')](_0x5cce1b)>=_0x1b35d0[_0x022a('0xd0')]){_0x3c08b2=ut[_0x022a('0xaa')](_0x5cce1b,0x14,_0x022a('0xe9'));rpcDb[_0x022a('0x95')](_0x3c08b2,_0x022a('0xea'));}else{if(_0x5cce1b[_0x022a('0xe4')]>=_0x1b35d0[_0x022a('0xeb')]){rpcDb['createCustomerFinal'](_0x5cce1b,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut[_0x022a('0xaf')](_0x5cce1b,'countagentrejectretry',_0x1b35d0[_0x022a('0xe5')]),_0x5cce1b[_0x022a('0xb0')],_0x5cce1b['activeContact']);}}}else{_0x5cce1b[_0x022a('0xd4')]++;_0x31ecca[_0x022a('0xb4')]({'id':_0x5cce1b[_0x022a('0xb3')],'field':{'countnoanswerretry':_0x5cce1b['countnoanswerretry']}})[_0x022a('0x81')](function(){_0x31ecca[_0x022a('0xb5')](_0x5cce1b,_0xc483b0,_0x564b99)[_0x022a('0x81')](function(){});});}});break;case _0x022a('0xec'):_0x1b35d0[_0x022a('0x3e')]+=0x1;_0x5cce1b[_0x022a('0xed')]+=0x1;_0x5cce1b[_0x022a('0xc3')]=ut['totalGlobal'](_0x5cce1b);ut[_0x022a('0x8e')](_0x5cce1b,0xb,_0x022a('0xee'));rpcDb[_0x022a('0x93')](_0x5cce1b,_0x022a('0xef'));_0x31ecca[_0x022a('0xa6')](_0x5cce1b,'11',_0x1b35d0)['then'](function(_0x55d7f8){_0x5581db=_0x55d7f8[_0x022a('0xa7')]==0x1;if(!_0x5581db){if(ut[_0x022a('0xa0')](_0x5cce1b)>=_0x1b35d0[_0x022a('0xd0')]){_0x3c08b2=ut[_0x022a('0xaa')](_0x5cce1b,0xf,_0x022a('0xab'));rpcDb[_0x022a('0x95')](_0x3c08b2,_0x022a('0xef'));}else{if(_0x5cce1b[_0x022a('0xf0')]>=_0x1b35d0[_0x022a('0xf1')]){rpcDb[_0x022a('0x95')](_0x5cce1b,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0x022a('0xae')](ut[_0x022a('0xaf')](_0x5cce1b,_0x022a('0xed'),_0x1b35d0[_0x022a('0xf2')]),_0x5cce1b[_0x022a('0xb0')],_0x5cce1b['activeContact']);}}}else{_0x5cce1b[_0x022a('0xd4')]++;_0x31ecca[_0x022a('0xb4')]({'id':_0x5cce1b[_0x022a('0xb3')],'field':{'countnoanswerretry':_0x5cce1b[_0x022a('0xd4')]}})[_0x022a('0x81')](function(){_0x31ecca[_0x022a('0xb5')](_0x5cce1b,_0xc483b0,_0x564b99)[_0x022a('0x81')](function(){});});}});break;case'18':_0x1b35d0[_0x022a('0xf3')]+=0x1;_0x5cce1b[_0x022a('0xf4')]+=0x1;_0x5cce1b['countglobal']=ut[_0x022a('0xa0')](_0x5cce1b);ut[_0x022a('0x8e')](_0x5cce1b,0x12,_0xeba6c2[_0x022a('0xf5')]||_0xeba6c2[_0x022a('0xf6')]);ami[_0x022a('0x22')](_0x022a('0xf7'),ut[_0x022a('0xa3')](_0x5cce1b,_0x022a('0xf8')));rpcDb[_0x022a('0x93')](_0x5cce1b,_0x022a('0xf9'));_0x31ecca[_0x022a('0xa6')](_0x5cce1b,'18',_0x1b35d0)[_0x022a('0x81')](function(_0x2086ba){_0x5581db=_0x2086ba['additional']==0x1;if(!_0x5581db){if(ut[_0x022a('0xa0')](_0x5cce1b)>=_0x1b35d0[_0x022a('0xd0')]){_0x3c08b2=ut[_0x022a('0xaa')](_0x5cce1b,0x12,'Global');rpcDb[_0x022a('0x95')](_0x3c08b2,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x022a('0x95')](_0x5cce1b,_0x022a('0xf9'));}}else{_0x5cce1b['countnoanswerretry']++;_0x31ecca[_0x022a('0xb4')]({'id':_0x5cce1b['idContact'],'field':{'countnoanswerretry':_0x5cce1b[_0x022a('0xd4')]}})[_0x022a('0x81')](function(){_0x31ecca[_0x022a('0xb5')](_0x5cce1b,_0xc483b0,_0x564b99)[_0x022a('0x81')](function(){});});}});delete this[_0x022a('0x6b')][_0xeba6c2[_0x022a('0xc9')]];break;case'19':_0x1b35d0[_0x022a('0xf3')]+=0x1;_0x5cce1b[_0x022a('0xc3')]=ut[_0x022a('0xa0')](_0x5cce1b);ut['logCustomer'](_0x5cce1b,0x13,_0xeba6c2['cause-txt']||_0xeba6c2['dialstatus']);ami[_0x022a('0x22')]('custom:amd',ut[_0x022a('0xa3')](_0x5cce1b,_0x022a('0xf8')));rpcDb[_0x022a('0x93')](_0x5cce1b,_0x022a('0xfa'));_0x31ecca[_0x022a('0xa6')](_0x5cce1b,'18',_0x1b35d0)[_0x022a('0x81')](function(_0x3cce57){_0x5581db=_0x3cce57[_0x022a('0xa7')]==0x1;if(!_0x5581db){if(ut[_0x022a('0xa0')](_0x5cce1b)>=_0x1b35d0[_0x022a('0xd0')]){_0x3c08b2=ut[_0x022a('0xaa')](_0x5cce1b,0xf,'Global');rpcDb[_0x022a('0x95')](_0x3c08b2,_0x022a('0xfa'));}else{rpcDb[_0x022a('0x95')](_0x5cce1b,_0x022a('0xfa'));}}else{_0x5cce1b[_0x022a('0xd4')]++;_0x31ecca['incrementPreviewCounters']({'id':_0x5cce1b[_0x022a('0xb3')],'field':{'countnoanswerretry':_0x5cce1b[_0x022a('0xd4')]}})[_0x022a('0x81')](function(){_0x31ecca['swapAdditionalPhones'](_0x5cce1b,_0xc483b0,_0x564b99)[_0x022a('0x81')](function(){});});}});delete this[_0x022a('0x6b')][_0xeba6c2[_0x022a('0xc9')]];break;default:if(_0x5cce1b[_0x022a('0x6e')]){ut[_0x022a('0x78')](_0x1b35d0,_0x022a('0xfb'));ut[_0x022a('0x79')](_0x022a('0xfc')+_0x1b35d0[_0x022a('0x24')],_0xeba6c2);}_0x1b35d0[_0x022a('0xf3')]+=0x1;_0x5cce1b[_0x022a('0xc3')]=ut[_0x022a('0xa0')](_0x5cce1b);ut[_0x022a('0x8e')](_0x5cce1b,0xc,_0xeba6c2[_0x022a('0xf5')]||_0xeba6c2[_0x022a('0xf6')]);_0xc483b0=_0x1b35d0['dialAgentRejectRetryFrequency'];_0x564b99=_0x1b35d0['callAdditionalPhoneAfterMin'];rpcDb[_0x022a('0x93')](_0x5cce1b,_0x022a('0xfd'));_0x31ecca[_0x022a('0xa6')](_0x5cce1b,'20',_0x1b35d0)[_0x022a('0x81')](function(_0x29942a){_0x5581db=_0x29942a[_0x022a('0xa7')]==0x1;if(!_0x5581db){if(ut[_0x022a('0xa0')](_0x5cce1b)>=_0x1b35d0[_0x022a('0xd0')]){_0x3c08b2=ut['cloneAction'](_0x5cce1b,0xf,'Global');rpcDb[_0x022a('0x95')](_0x3c08b2,_0x022a('0xfe'));}else{rpcDb[_0x022a('0x95')](_0x5cce1b,_0x022a('0xfe'));}delete this[_0x022a('0x6b')][_0xeba6c2['linkedid']];}else{_0x31ecca[_0x022a('0xb5')](_0x5cce1b,_0xc483b0,_0x564b99)['then'](function(_0x5d899c){});}});}if(!(_0x5cce1b[_0x022a('0x6e')]&&_0x5bec20==='16')){ut['updateOriginated'](_0x1b35d0,'[callProgressDetectingCustomer]');logger['info'](_0x022a('0xff'),_0x5cce1b['uniqueid'],_0x022a('0xba'),_0x1b35d0['name'],_0x022a('0x6d'),_0x1b35d0[_0x022a('0x4a')]);}if(_0x5bec20!==_0x022a('0xb6')){delete this[_0x022a('0x6b')][_0xeba6c2[_0x022a('0xc9')]];delete this[_0x022a('0x6b')][_0xeba6c2[_0x022a('0x100')]];}}};Preview[_0x022a('0xe')][_0x022a('0x101')]=function(_0x110489,_0xb6a28b,_0x26f77f){if(_['isUndefined'](_0xb6a28b)&&_0x022a('0x102')!==typeof _0xb6a28b){return;}if(_['isUndefined'](_0x26f77f)&&_0x022a('0x102')!==typeof _0x26f77f){return;}switch(_0x26f77f['reason']){case'0':ut['logAgent'](_0x110489,0x0,_0x022a('0xa1'));rpcDb[_0x022a('0x103')](_0x110489,_0x022a('0x104'));break;case'3':ut[_0x022a('0x105')](_0x110489,0x3,_0x022a('0xd5'));rpcDb[_0x022a('0x103')](_0x110489,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x022a('0x105')](_0x110489,0x5,'Busy');rpcDb[_0x022a('0x103')](_0x110489,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x110489,0x8,'Congestion');rpcDb[_0x022a('0x103')](_0x110489,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0x022a('0x105')](_0x110489,0x16,_0x022a('0x106'));rpcDb['createAgentHistory'](_0x110489,_0x022a('0x107'));break;default:ut[_0x022a('0x105')](_0x110489,0xc,_0x26f77f[_0x022a('0x108')]);rpcDb['createAgentHistory'](_0x110489,_0x022a('0x109'));}ut['updateOriginated'](_0xb6a28b,_0x022a('0x10a'));logger[_0x022a('0x58')](_0x022a('0x10b'),_0x110489['uniqueid'],_0x022a('0xba'),_0xb6a28b[_0x022a('0x24')],_0x022a('0x6d'),_0xb6a28b[_0x022a('0x4a')]);delete this['actions'][_0x110489[_0x022a('0xb9')]];};Preview['prototype'][_0x022a('0xa6')]=function(_0x5990da,_0x37dc17,_0x6cbe5e){return BPromise[_0x022a('0x10c')]()[_0x022a('0x81')](cmHopperAdditionalPhone[_0x022a('0xa6')](_0x5990da,_0x37dc17,_0x6cbe5e))[_0x022a('0x8a')](logger[_0x022a('0x58')](_0x022a('0x10d')));};Preview[_0x022a('0xe')][_0x022a('0xb5')]=function(_0xb9dbe4,_0x3bc070,_0x4eb614){return BPromise['resolve']()[_0x022a('0x81')](cmHopperAdditionalPhone[_0x022a('0xb5')](_0xb9dbe4,_0x3bc070,_0x4eb614))[_0x022a('0x8a')](logger[_0x022a('0x58')](_0x022a('0x10e')));};Preview[_0x022a('0xe')]['incrementPreviewCounters']=function(_0x1d2d7e){return BPromise[_0x022a('0x10c')]()['then'](cmHopperAdditionalPhone[_0x022a('0xb4')](_0x1d2d7e))[_0x022a('0x8a')](logger['info'](_0x022a('0x10f')));};Preview['prototype'][_0x022a('0x110')]=function(_0x577172,_0x29c7de,_0x17d913,_0x282bf7,_0x4edaa9){var _0x139a52=this;return new BPromise(function(_0x2d990b,_0x1f4451){if(_[_0x022a('0x69')](_0x29c7de)||_['isNil'](_0x29c7de[_0x022a('0x111')])||_[_0x022a('0x69')](_0x29c7de[_0x022a('0x112')])||_[_0x022a('0x69')](_0x29c7de[_0x022a('0x71')])){_0x1f4451(ut[_0x022a('0x49')](_0x022a('0x113'),_0x282bf7,_0x4edaa9));return;}var _0x239e5f=uuid['v4']();var _0x14379e=_0x139a52[_0x022a('0x11')][_0x29c7de[_0x022a('0x114')]['name']];var _0x5dae36=_0x17d913?_0x139a52[_0x022a('0x14')][_0x17d913]['id']:undefined;_0x139a52['actions'][_0x239e5f]=new Action(_0x29c7de,_0x14379e,_0x239e5f,_0x17d913,_0x5dae36);var _0x513d69=_0x139a52[_0x022a('0x6b')][_0x239e5f];_0x513d69[_0x022a('0xb0')]=_0x282bf7;_0x513d69['activeContact']=_0x4edaa9;_0x513d69[_0x022a('0x115')]=_0x17d913;if(_[_0x022a('0x116')](_0x577172)){_0x139a52[_0x022a('0x117')](_0x513d69,_0x14379e,_0x29c7de,_0x17d913)['then'](function(_0x3e5109){logger[_0x022a('0x58')]('[Preview][execCall][success]',_0x022a('0x118')+_0x513d69['queue']+_0x022a('0x119')+_0x513d69['idContact'],JSON[_0x022a('0x54')](_0x3e5109));ami[_0x022a('0x22')]('custom:agentcalled',ut['buildObj'](_0x513d69,'called',_0x139a52[_0x022a('0x11')][_0x513d69[_0x022a('0x6c')]]));_0x2d990b(ut[_0x022a('0x49')]('Calling'));})['catch'](function(_0x4a9719){ut[_0x022a('0x5c')](_0x022a('0x11a'),_0x4a9719);_0x1f4451(ut[_0x022a('0x49')](_0x022a('0x11b'),_0x282bf7,_0x4edaa9));});}else{_0x14379e['outboundBlacklistCallsDay']+=0x1;ut[_0x022a('0x11c')](_0x513d69);rpcDb['createHistory'](_0x513d69,'[Blacklist][error]');delete _0x139a52['actions'][_0x239e5f];_0x1f4451(ut['message']('Contact\x20in\x20black\x20List',_0x282bf7,_0x4edaa9));}});};Preview[_0x022a('0xe')]['isTrunkReachable']=function(_0x42ec46){return!_['isNil'](_0x42ec46)&&!_[_0x022a('0x69')](_0x42ec46['name'])&&!_[_0x022a('0x69')](_0x42ec46[_0x022a('0x52')])&&_0x42ec46[_0x022a('0x52')]&&!_[_0x022a('0x69')](this['trunks'][util[_0x022a('0x56')](_0x022a('0x11d'),_0x42ec46[_0x022a('0x24')])])&&!_['isNil'](this[_0x022a('0x13')][util['format'](_0x022a('0x11d'),_0x42ec46[_0x022a('0x24')])][_0x022a('0x74')])&&(this['trunks'][util[_0x022a('0x56')](_0x022a('0x11d'),_0x42ec46['name'])]['status']===_0x022a('0x11e')||this[_0x022a('0x13')][util[_0x022a('0x56')](_0x022a('0x11d'),_0x42ec46[_0x022a('0x24')])][_0x022a('0x74')]==='unmonitored');};Preview['prototype'][_0x022a('0x87')]=function(_0x44ff8a,_0x26df80){var _0x3e8313=this;return new BPromise(function(_0x1e6b2b,_0x390965){_0x3e8313[_0x022a('0x11f')](_0x44ff8a,_0x26df80)['then'](function(_0x495e46){_0x1e6b2b(_[_0x022a('0x120')](_0x495e46,[_0x022a('0x49')]));})[_0x022a('0x8a')](function(_0x1a4030){if(_0x1a4030[_0x022a('0x121')]){rpcDb[_0x022a('0x122')](_0x44ff8a);}if(_0x1a4030['active']){rpcDb[_0x022a('0x8b')](_0x44ff8a);}_0x390965(_['pick'](_0x1a4030,[_0x022a('0x49')]));});});};Preview[_0x022a('0xe')]['execRun']=function(_0x5c7b5f,_0x4d8ab8){var _0x3133ec=this;return new BPromise(function(_0x18945f,_0x1eb0c1){var _0x3986ab,_0x6bce90;rpcDb[_0x022a('0x123')](_0x5c7b5f)[_0x022a('0x81')](function(_0xc5175d){if(!_[_0x022a('0x69')](_0xc5175d[0x0])){_0x6bce90=_0xc5175d[0x0][_0x022a('0x124')]?![]:!![];_0x3986ab=_0xc5175d[0x0][_0x022a('0x124')]?!![]:![];_0x3986ab=_0x4d8ab8?!![]:_0x3986ab;}var _0xa8cbd1=_0x3133ec[_0x022a('0x125')](_0xc5175d);if(_0xa8cbd1[_0x022a('0x126')]){rpcDb['checkIsBlackList'](_[_0x022a('0x120')](_0xc5175d[0x0],['VoiceQueueId',_0x022a('0x112')]))[_0x022a('0x81')](function(_0x22ce2c){_0x3133ec[_0x022a('0x110')](_0x22ce2c,_0xc5175d[0x0],_0x4d8ab8,_0x6bce90,_0x3986ab)['then'](function(_0x5b2714){_0x18945f(_0x5b2714);})['catch'](function(_0x2f98a7){_0x1eb0c1(_0x2f98a7);});})[_0x022a('0x8a')](function(_0x1730da){ut[_0x022a('0x5c')](_0x022a('0x127'),_0x1730da);_0x1eb0c1(ut[_0x022a('0x49')]('Call\x20unsuccessful',_0x6bce90,_0x3986ab));});}else{_0x1eb0c1(ut['message'](_0xa8cbd1[_0x022a('0x49')],_0x6bce90,_0x3986ab));}})[_0x022a('0x8a')](function(_0x2327e5){ut[_0x022a('0x5c')](_0x022a('0x128'),_0x2327e5);_0x1eb0c1(ut[_0x022a('0x49')](_0x022a('0x129'),![],!![]));});});};Preview[_0x022a('0xe')][_0x022a('0x125')]=function(_0xf346c9){if(_[_0x022a('0x69')](_0xf346c9)||_[_0x022a('0x116')](_0xf346c9)||!_[_0x022a('0x69')](_0xf346c9[0x0][_0x022a('0x85')])&&_[_0x022a('0x69')](_0xf346c9[0x0][_0x022a('0x85')]['name'])){ut[_0x022a('0x5c')](_0x022a('0x12a'),_0xf346c9);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x55e3df=this[_0x022a('0x11')][_0xf346c9[0x0]['Queue'][_0x022a('0x24')]];_0x55e3df[_0x022a('0x49')]='ACTIVE';if(_[_0x022a('0x69')](_0x55e3df)){ut[_0x022a('0x5c')](_0x022a('0x12b'),_0x55e3df);return{'isValid':![],'message':_0x022a('0x12c')};}if(!this['isTrunkReachable'](_0x55e3df[_0x022a('0x51')])){ut['logger'](_0x022a('0x12d'),_0x022a('0x12e')+_0x55e3df[_0x022a('0x24')]+_0x022a('0x12f'));if(!this[_0x022a('0x9a')](_0x55e3df[_0x022a('0x9b')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x55e3df[_0x022a('0x24')]+_0x022a('0x130'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut[_0x022a('0x98')](_0x55e3df[_0x022a('0x2f')])){ut[_0x022a('0x5c')](_0x022a('0x131'),_0x55e3df[_0x022a('0x24')]+_0x022a('0x132'));return{'isValid':![],'message':_0x022a('0x12e')+_0x55e3df['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x022a('0x133')};};Preview[_0x022a('0xe')][_0x022a('0x117')]=function(_0x12a6cd,_0x2842a6,_0x40cc69,_0x5b1fd1){var _0x19a924=this;return new BPromise(function(_0x36da70,_0x387f0c){var _0x5b123e=_0x12a6cd[_0x022a('0xb9')];var _0x2a5787=_0x19a924['isTrunkReachable'](_0x2842a6['Trunk'])?util['format']('SIP/%s/%s%s',_0x2842a6[_0x022a('0x51')]['name'],_[_0x022a('0x69')](_0x2842a6['dialPrefix'])?'':_0x2842a6[_0x022a('0x134')]['trim']()||'',_0x2842a6[_0x022a('0x135')]>0x0?_0x40cc69[_0x022a('0x112')][_0x022a('0x136')](_0x2842a6[_0x022a('0x135')]):_0x40cc69[_0x022a('0x112')]):util[_0x022a('0x56')](_0x022a('0x137'),_[_0x022a('0x69')](_0x2842a6[_0x022a('0x9b')])?_0x2842a6[_0x022a('0x51')][_0x022a('0x24')]:_0x2842a6[_0x022a('0x9b')][_0x022a('0x24')],_[_0x022a('0x69')](_0x2842a6[_0x022a('0x134')])?'':_0x2842a6[_0x022a('0x134')][_0x022a('0x138')]()||'',_0x2842a6['dialCutDigit']>0x0?_0x40cc69[_0x022a('0x112')][_0x022a('0x136')](_0x2842a6[_0x022a('0x135')]):_0x40cc69[_0x022a('0x112')]);var _0x1fd267=_0x19a924[_0x022a('0x9a')](_0x2842a6[_0x022a('0x51')])?ut[_0x022a('0x139')](_0x2842a6[_0x022a('0x51')][_0x022a('0x13a')],_0x2842a6[_0x022a('0x30')],_0x2842a6['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x022a('0x13b')](_0x2842a6[_0x022a('0x31')],_0x2842a6[_0x022a('0x13c')]):_0x2842a6['dialOriginateCallerIdNumber']):ut[_0x022a('0x139')](_['isNil'](_0x2842a6[_0x022a('0x9b')])?_0x2842a6[_0x022a('0x51')]['callerid']:_0x2842a6[_0x022a('0x9b')]['callerid'],_0x2842a6[_0x022a('0x30')],_0x2842a6['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x022a('0x13b')](_0x2842a6['dialOriginateCallerIdNumber'],_0x2842a6[_0x022a('0x13c')]):_0x2842a6['dialOriginateCallerIdNumber']);if(_0x1fd267){_0x12a6cd[_0x022a('0x13d')]=ut[_0x022a('0x13e')](_0x1fd267);_0x12a6cd[_0x022a('0x13f')]=ut[_0x022a('0x140')](_0x1fd267);}var _0x148c69=ut[_0x022a('0x141')](_0x2842a6,_0x40cc69,_0x2a5787,_0x1fd267,_0x5b123e,_0x12a6cd);_[_0x022a('0x142')](_0x12a6cd,ut[_0x022a('0x143')](_0x148c69));_0x12a6cd[_0x022a('0x8c')]=moment()['format'](_0x022a('0x8d'));ami[_0x022a('0x73')](ut[_0x022a('0x144')](_0x12a6cd,_0x2842a6,_0x148c69,_0x12a6cd[_0x022a('0xb1')],_0x5b1fd1))[_0x022a('0x81')](function(_0x5298cd){var _0x2bc172=_0x12a6cd[_0x022a('0x145')];if(!_[_0x022a('0x69')](_0x2bc172)){if(!_['isNil'](_0x19a924[_0x022a('0x14')][_0x2bc172])){_0x19a924[_0x022a('0x14')][_0x2bc172]['destconnectedlinenum']=_0x12a6cd[_0x022a('0x146')];emit(util[_0x022a('0x56')](_0x022a('0x147'),_0x19a924[_0x022a('0x14')][_0x2bc172][_0x022a('0x24')]),_0x022a('0x148'),{'destaccountcode':_0x19a924[_0x022a('0x14')][_0x2bc172][_0x022a('0x149')],'destconnectedlinenum':_0x12a6cd[_0x022a('0x146')]});}}_0x2842a6[_0x022a('0x4a')]+=0x1;logger[_0x022a('0x58')]('[originated][increment]',_0x5b123e,_0x022a('0xba'),_0x2842a6[_0x022a('0x24')],_0x022a('0x6d'),_0x2842a6[_0x022a('0x4a')]);_0x36da70(_0x5298cd);})[_0x022a('0x8a')](function(_0x381070){ut['logAgent'](_0x12a6cd,0xe,_0x022a('0x14a'));rpcDb['createAgentHistory'](_0x12a6cd,_0x022a('0x14b'));_0x387f0c(_0x381070);});});};Preview['prototype'][_0x022a('0x1c')]=function(_0x3fbc93){if(this[_0x022a('0x6b')][_0x3fbc93['linkedid']]){this[_0x022a('0x6b')][_0x3fbc93[_0x022a('0xc9')]][_0x022a('0x14c')]=_0x3fbc93[_0x022a('0x14c')];}};Preview[_0x022a('0xe')][_0x022a('0x16')]=function(_0x3d2635){var _0x1a98e6=this;var _0x8cd0ff=this['actions'][_0x3d2635[_0x022a('0x14d')]];if(_0x8cd0ff){if(_0x8cd0ff[_0x022a('0x115')]&&this[_0x022a('0x14')][_0x8cd0ff[_0x022a('0x115')]]){ut['logLookAgent'](_0x8cd0ff,this[_0x022a('0x14')][_0x8cd0ff[_0x022a('0x115')]][_0x022a('0x24')],this['agents'][_0x8cd0ff[_0x022a('0x115')]]['id']);}var _0x40802b=_[_0x022a('0x14e')](_0x8cd0ff);_0x40802b[_0x022a('0xb7')]=moment()[_0x022a('0x56')](_0x022a('0x8d'));var _0x52dce2=_0x1a98e6[_0x022a('0x11')][_0x8cd0ff['queue']];if(ut[_0x022a('0x14f')](_0x3d2635[_0x022a('0x150')])){if(_0x8cd0ff[_0x022a('0xb0')]){rpcDb[_0x022a('0x122')](_0x8cd0ff['idContact']);}if(_0x8cd0ff['activeContact']){rpcDb['disableContact'](_0x8cd0ff['idContact']);}ami[_0x022a('0x22')](_0x022a('0x151'),ut['buildObj'](_0x8cd0ff,'rejected',this['campaignsPreview'][_0x8cd0ff[_0x022a('0x6c')]]));this['callProgressDetectingAgent'](_0x40802b,_0x52dce2,_0x3d2635);}else{_0x8cd0ff[_0x022a('0x8c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut[_0x022a('0x105')](_0x40802b,0x4,_0x022a('0xc4'));rpcDb[_0x022a('0x103')](_0x40802b,_0x022a('0x152'));}}};Preview['prototype'][_0x022a('0x18')]=function(_0x3ea656){var _0x2262d4=this;var _0x19889c=this['actions'][_0x3ea656[_0x022a('0xc9')]];var _0x4202e3;if(_0x19889c){_0x4202e3=this[_0x022a('0x11')][_0x19889c[_0x022a('0x6c')]];logger[_0x022a('0x58')](_0x022a('0x153'),_0x3ea656['linkedid'],_0x022a('0xba'),_0x4202e3[_0x022a('0x24')],_0x022a('0xbb'),_0x4202e3[_0x022a('0xb8')]);}if(this[_0x022a('0x6b')][_0x3ea656[_0x022a('0xc9')]]&&_0x3ea656['linkedid']!==_0x3ea656[_0x022a('0xb9')]){if(_0x3ea656[_0x022a('0x154')]==='16'&&this[_0x022a('0x6b')][_0x3ea656['linkedid']][_0x022a('0x6e')]){this['callProgressDetectingCustomer'](_0x3ea656,_0x3ea656[_0x022a('0xc9')],_0x3ea656['cause']);}else if(this[_0x022a('0x6b')][_0x3ea656[_0x022a('0xc9')]][_0x022a('0x6e')]){logger['info'](_0x022a('0x155'),_0x3ea656['linkedid'],_0x3ea656[_0x022a('0x154')],_0x022a('0xba'),_0x4202e3[_0x022a('0x24')],_0x022a('0xbb'),_0x4202e3[_0x022a('0xb8')]);this[_0x022a('0x9e')](_0x3ea656,_0x3ea656['linkedid'],_0x3ea656[_0x022a('0x154')]);}}else if(_0x19889c&&_[_0x022a('0x69')](_0x19889c[_0x022a('0x156')])&&_0x4202e3[_0x022a('0x157')]&&_0x3ea656['linkedid']===_0x3ea656['uniqueid']&&_[_0x022a('0x69')](_0x3ea656[_0x022a('0x108')])&&_0x3ea656[_0x022a('0x154')]==='16'&&_0x3ea656[_0x022a('0x158')]==='6'&&_[_0x022a('0x159')](_0x19889c[_0x022a('0x15a')])){if(_0x19889c['unlockAgent']){rpcDb[_0x022a('0x122')](_0x19889c['idContact']);}if(_0x19889c[_0x022a('0xb1')]){rpcDb[_0x022a('0x8b')](_0x19889c[_0x022a('0xb3')]);}_0x3ea656[_0x022a('0x108')]='22';this[_0x022a('0x101')](_0x19889c,_0x4202e3,_0x3ea656);}else if(_0x19889c&&_0x19889c[_0x022a('0x15a')]){if(_0x3ea656['cause']==='16'&&this['actions'][_0x3ea656[_0x022a('0xc9')]]['dialAnswer']){logger[_0x022a('0x58')]('[syncHangup][talking][transfer]',_0x3ea656[_0x022a('0xc9')],_0x3ea656[_0x022a('0x154')],_0x022a('0xba'),_0x4202e3['name'],_0x022a('0xbb'),_0x4202e3[_0x022a('0xb8')]);this['callProgressDetectingCustomer'](_0x3ea656,_0x3ea656[_0x022a('0xc9')],_0x3ea656[_0x022a('0x154')]);}else if(this['actions'][_0x3ea656[_0x022a('0xc9')]][_0x022a('0x6e')]){logger[_0x022a('0x58')]('[syncHangup][talking][cause]',_0x3ea656[_0x022a('0xc9')],_0x3ea656['cause'],_0x022a('0xba'),_0x4202e3[_0x022a('0x24')],'pTalking:\x20',_0x4202e3[_0x022a('0xb8')]);this[_0x022a('0x9e')](_0x3ea656,_0x3ea656[_0x022a('0xc9')],_0x3ea656[_0x022a('0x154')]);}}};Preview[_0x022a('0xe')]['syncDialEnd']=function(_0xc6a295){if(this[_0x022a('0x6b')][_0xc6a295[_0x022a('0x100')]]&&_0xc6a295[_0x022a('0x100')]!==_0xc6a295['destuniqueid']){this[_0x022a('0x9e')](_0xc6a295,_0xc6a295[_0x022a('0x100')],_0xc6a295[_0x022a('0xf6')]);}};Preview[_0x022a('0xe')][_0x022a('0x15b')]=function(_0x264a27){if(this[_0x022a('0x6b')][_0x264a27[_0x022a('0xc9')]]&&_0x264a27['linkedid']!==_0x264a27['uniqueid']&&!this['actions'][_0x264a27[_0x022a('0xc9')]]['dialAnswer']){if(_0x264a27[_0x022a('0x154')]==='1'){this['callProgressDetectingCustomer'](_0x264a27,_0x264a27[_0x022a('0xc9')],_0x264a27['cause']);}}};Preview[_0x022a('0xe')][_0x022a('0x15c')]=function(_0x535fa8,_0x19bf63,_0x4c160a){if(this[_0x022a('0x6b')][_0x535fa8]){if(_['isNil'](this[_0x022a('0x6b')][_0x535fa8][_0x022a('0x15d')])){this[_0x022a('0x6b')][_0x535fa8][_0x022a('0x15d')]={};}this[_0x022a('0x6b')][_0x535fa8][_0x022a('0x15d')][_0x19bf63]=_0x4c160a;}};Preview[_0x022a('0xe')][_0x022a('0x1e')]=function(_0x3522e5){try{if(!_[_0x022a('0x69')](_0x3522e5)){if(ut[_0x022a('0x15e')](_[_0x022a('0x15f')](_0x3522e5[_0x022a('0x160')])[0x0])){this[_0x022a('0x15c')](_0x3522e5[_0x022a('0xb9')],_[_0x022a('0x15f')](_0x3522e5[_0x022a('0x160')])[0x0],_0x3522e5[_0x022a('0x161')]);}}}catch(_0x5d452e){logger[_0x022a('0x162')]('[syncVarSet][Preview]',util['inspect'](_0x5d452e,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x022a('0x163')]=function(_0x260a57){if(_0x260a57){if(this[_0x022a('0x6b')][_0x260a57[_0x022a('0x164')]]){this[_0x022a('0x6b')][_0x260a57['transfertargetlinkedid']][_0x022a('0x15a')]=!![];}}};Preview[_0x022a('0xe')][_0x022a('0x20')]=function(_0x307c3b){if(_0x307c3b){if(this[_0x022a('0x6b')][_0x307c3b[_0x022a('0x165')]]){this[_0x022a('0x6b')][_0x307c3b['transfererlinkedid']][_0x022a('0x15a')]=!![];}}};module[_0x022a('0x166')]=Preview; \ No newline at end of file +var _0x4d56=['outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','message','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','loopCampaigns','syncCampaigns','clockClearZombieChannels','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','isNil','actions','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','ListId','Action','channel','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','rescheduleContact','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','countglobal','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','sumBillable','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','additional','dialBusyMaxRetry','NOANSWER','dialNoAnswerRetryFrequency','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','scheduledAt','CONGESTION','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','countnoanswerretry','ABANDONED','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','resolve','[swapAdditionalPhone]\x20','[incrementPreviewCounters]\x20','checkInBlack','Contact','VoiceQueueId','Contact\x20is\x20undefined','Queue','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','SIP/%s','status','unmonitored','execRun','unlock','getContactPreview','recallme','validateContact','isValid','phone','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','channelAgent','destconnectedlinenum','calleridnum','user:agentconnect','accountcode','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','actionid','logLookAgent','clone','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','variables','filterKey','variable','addVariable','keys','value','error','[syncVarSet][Preview]','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','util','lodash','bluebird','moment','md5','ioredis','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./util/util','redis','localhost','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','originateresponse','hangup','bind','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','emit','outbound','name','strategy','answered','available','sumDuration','talking','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x4d56,0x129));var _0x64d5=function(_0x33c118,_0x4ddfbd){_0x33c118=_0x33c118-0x0;var _0x1389a9=_0x4d56[_0x33c118];return _0x1389a9;};'use strict';var util=require(_0x64d5('0x0'));var _=require(_0x64d5('0x1'));var BPromise=require(_0x64d5('0x2'));var uuid=require('uuid');var moment=require(_0x64d5('0x3'));var md5=require(_0x64d5('0x4'));var Redis=require(_0x64d5('0x5'));var config=require('../../../config/environment');var logger=require(_0x64d5('0x6'))(_0x64d5('0x7'));var loggerAction=require('../../../config/logger')(_0x64d5('0x8'));var ami=require(_0x64d5('0x9'));var rpcDb=require(_0x64d5('0xa'));var cmHopperAdditionalPhone=require(_0x64d5('0xb'));var Action=require('./action');var ut=require(_0x64d5('0xc'));config['redis']=_['defaults'](config[_0x64d5('0xd')],{'host':_0x64d5('0xe'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x64d5('0xd')]));var Sequence=function(){};Sequence[_0x64d5('0xf')][_0x64d5('0x10')]=function(_0x2e7dfe){this[_0x64d5('0x11')]=this[_0x64d5('0x11')]?this[_0x64d5('0x11')][_0x64d5('0x12')](_0x2e7dfe):_0x2e7dfe();};function Preview(_0x23de0f){this[_0x64d5('0x13')]=new Sequence();this[_0x64d5('0x14')]=_0x23de0f['voiceQueues'];this[_0x64d5('0x15')]=_0x23de0f[_0x64d5('0x15')];this['actions']={};this[_0x64d5('0x16')]=_0x23de0f[_0x64d5('0x16')];this['clockClearZombieChannels']=0x0;ami['on'](_0x64d5('0x17'),this['syncOriginateResponse']['bind'](this));ami['on'](_0x64d5('0x18'),this['syncHangup'][_0x64d5('0x19')](this));ami['on'](_0x64d5('0x1a'),this[_0x64d5('0x1b')]['bind'](this));ami['on'](_0x64d5('0x1c'),this[_0x64d5('0x1d')][_0x64d5('0x19')](this));ami['on'](_0x64d5('0x1e'),this[_0x64d5('0x1f')][_0x64d5('0x19')](this));ami['on'](_0x64d5('0x20'),this[_0x64d5('0x21')][_0x64d5('0x19')](this));ami['on']('attendedtransfer',this[_0x64d5('0x22')][_0x64d5('0x19')](this));ami['on'](_0x64d5('0x23'),this['syncBlindTransfer'][_0x64d5('0x19')](this));this['loopCampaigns'](this[_0x64d5('0x14')]);}function emit(_0x3c5ea1,_0x1b72e1,_0x2a70c2){io['to'](_0x3c5ea1)[_0x64d5('0x24')](_0x1b72e1,_0x2a70c2);}function emitCampaignPreview(_0x5247c6){if(_0x5247c6['type']===_0x64d5('0x25')){var _0x27e27={'id':_0x5247c6['id'],'name':_0x5247c6[_0x64d5('0x26')],'strategy':_0x5247c6[_0x64d5('0x27')],'answered':_0x5247c6[_0x64d5('0x28')],'available':_0x5247c6[_0x64d5('0x29')],'loggedIn':_0x5247c6['loggedIn'],'pTalking':_0x5247c6['pTalking'],'sumBillable':_0x5247c6['sumBillable'],'sumDuration':_0x5247c6[_0x64d5('0x2a')],'sumHoldTime':_0x5247c6['sumHoldTime']||0x0,'talking':_0x5247c6[_0x64d5('0x2b')],'total':_0x5247c6[_0x64d5('0x2c')],'type':_0x5247c6[_0x64d5('0x2d')],'unmanaged':_0x5247c6[_0x64d5('0x2e')],'abandoned':_0x5247c6['abandoned'],'waiting':_0x5247c6[_0x64d5('0x2f')],'loggedInDb':_0x5247c6[_0x64d5('0x30')],'dialActive':_0x5247c6[_0x64d5('0x31')],'dialMethod':_0x5247c6[_0x64d5('0x32')],'dialOriginateCallerIdName':_0x5247c6[_0x64d5('0x33')],'dialOriginateCallerIdNumber':_0x5247c6[_0x64d5('0x34')],'dialOriginateTimeout':_0x5247c6[_0x64d5('0x35')],'dialPrefix':_0x5247c6[_0x64d5('0x36')],'outboundAnswerAgiCallsDay':_0x5247c6[_0x64d5('0x37')],'outboundAnswerCallsDay':_0x5247c6[_0x64d5('0x38')],'outboundBlacklistCallsDay':_0x5247c6['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x5247c6['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x5247c6[_0x64d5('0x39')],'outboundDropCallsDayACS':_0x5247c6[_0x64d5('0x3a')],'outboundDropCallsDayCallersExit':_0x5247c6[_0x64d5('0x3b')],'outboundDropCallsDayTimeout':_0x5247c6[_0x64d5('0x3c')],'outboundNoAnswerCallsDay':_0x5247c6[_0x64d5('0x3d')],'outboundNoSuchCallsDay':_0x5247c6[_0x64d5('0x3e')],'outboundOriginateFailureCallsDay':_0x5247c6['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x5247c6['outboundReCallsDay'],'outboundRejectCallsDay':_0x5247c6[_0x64d5('0x3f')],'outboundUnknownCallsDay':_0x5247c6[_0x64d5('0x40')],'outboundAbandonedCallsDay':_0x5247c6[_0x64d5('0x41')],'predictiveIntervalAnsweredCalls':_0x5247c6['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x5247c6[_0x64d5('0x42')],'predictiveIntervalAvgTalktime':_0x5247c6[_0x64d5('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x5247c6['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x5247c6['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x5247c6['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x5247c6[_0x64d5('0x44')],'predictiveIntervalHitRate':_0x5247c6['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x5247c6[_0x64d5('0x45')],'predictiveIntervalPauses':_0x5247c6['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x5247c6['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x5247c6[_0x64d5('0x46')],'message':_0x5247c6[_0x64d5('0x47')],'originated':_0x5247c6[_0x64d5('0x48')],'erlangCalls':_0x5247c6['erlangCalls'],'erlangCallToSecond':_0x5247c6[_0x64d5('0x49')],'erlangAbandonmentRate':_0x5247c6[_0x64d5('0x4a')],'erlangBusyFactor':_0x5247c6[_0x64d5('0x4b')],'startPredictive':_0x5247c6[_0x64d5('0x4c')],'startProgressive':_0x5247c6[_0x64d5('0x4d')]};if(_0x5247c6[_0x64d5('0x4e')]){_0x27e27['Trunk']={'id':_0x5247c6[_0x64d5('0x4e')]['id'],'name':_0x5247c6['Trunk'][_0x64d5('0x26')],'active':_0x5247c6[_0x64d5('0x4e')][_0x64d5('0x4f')],'callerid':_0x5247c6[_0x64d5('0x4e')][_0x64d5('0x50')]};}if(_0x5247c6['Interval']){_0x27e27[_0x64d5('0x51')]={'id':_0x5247c6[_0x64d5('0x51')]['id'],'name':_0x5247c6[_0x64d5('0x51')]['name']};}var _0x3646ff=md5(JSON[_0x64d5('0x52')](_0x27e27));if(_0x5247c6['md5']!==_0x3646ff){_0x5247c6['md5']=_0x3646ff;emit(util['format'](_0x64d5('0x53'),_0x27e27[_0x64d5('0x26')]),_0x64d5('0x54'),_0x27e27);}}}function emitVoiceQueueChannelRemove(_0x3f6437){logger[_0x64d5('0x55')](_0x64d5('0x56'),JSON[_0x64d5('0x52')](_0x3f6437));emit(util[_0x64d5('0x57')](_0x64d5('0x53'),_0x3f6437[_0x64d5('0x26')]),'voice_queue_channel:remove',_0x3f6437);io[_0x64d5('0x24')]('voice_queue_presence:remove',_0x3f6437);}function notSendMessagesQueue(_0x59c29b){if(_0x59c29b[_0x64d5('0x58')]){if(_0x59c29b[_0x64d5('0x48')]===0x0&&_0x59c29b[_0x64d5('0x59')]===0x0){_0x59c29b['sendMessageOneNotActive']=![];_0x59c29b[_0x64d5('0x29')]=0x0;_0x59c29b[_0x64d5('0x5a')]=0x0;_0x59c29b[_0x64d5('0x47')]=_0x64d5('0x5b');ut[_0x64d5('0x5c')](_0x64d5('0x5d'),_0x59c29b[_0x64d5('0x26')]+_0x64d5('0x5e'));}else{_0x59c29b[_0x64d5('0x47')]=_0x64d5('0x5f');ut[_0x64d5('0x5c')](_0x64d5('0x5d'),_0x59c29b[_0x64d5('0x26')]+_0x64d5('0x60'));}emitCampaignPreview(_0x59c29b);}}Preview[_0x64d5('0xf')][_0x64d5('0x61')]=function(){var _0x380def=this;setInterval(function(){_0x380def[_0x64d5('0x62')]();},0x7cf);};Preview['prototype'][_0x64d5('0x62')]=function(){var _0x2dd40c=this[_0x64d5('0x14')];this[_0x64d5('0x63')]+=0x1;for(var _0xc4b621 in _0x2dd40c){if(_0x2dd40c[_0x64d5('0x64')](_0xc4b621)&&(_0x2dd40c[_0xc4b621]['dialMethod']===_0x64d5('0x7')||_0x2dd40c[_0xc4b621][_0x64d5('0x32')]===_0x64d5('0x65'))&&_0x2dd40c[_0xc4b621][_0x64d5('0x2d')]===_0x64d5('0x25')){if(this['clockClearZombieChannels']>0x7){this[_0x64d5('0x63')]=0x0;this[_0x64d5('0x66')]();}}if(_0x2dd40c[_0x64d5('0x64')](_0xc4b621)&&_0x2dd40c[_0xc4b621][_0x64d5('0x32')]===_0x64d5('0x7')&&_0x2dd40c[_0xc4b621][_0x64d5('0x2d')]===_0x64d5('0x25')){if(_0x2dd40c[_0xc4b621][_0x64d5('0x31')]){this[_0x64d5('0x67')](_0x2dd40c[_0xc4b621]);this[_0x64d5('0x68')](_0x2dd40c[_0xc4b621]);}else{notSendMessagesQueue(_0x2dd40c[_0xc4b621]);}}}};Preview[_0x64d5('0xf')]['clearZombieChannel']=function(_0x5065c8){var _0x26b731=this;this['sequence']['enqueue'](function(){if(!_[_0x64d5('0x69')](_0x26b731[_0x64d5('0x6a')][_0x5065c8])){loggerAction['info']('[clearZombieChannels][talking]',_0x5065c8,'Queue',_0x26b731[_0x64d5('0x6a')][_0x5065c8]['queue'],'originated:\x20',JSON[_0x64d5('0x52')](_0x26b731[_0x64d5('0x14')][_0x26b731[_0x64d5('0x6a')][_0x5065c8][_0x64d5('0x6b')]][_0x64d5('0x48')]),_0x64d5('0x6c'),JSON[_0x64d5('0x52')](_0x26b731[_0x64d5('0x14')][_0x26b731['actions'][_0x5065c8][_0x64d5('0x6b')]][_0x64d5('0x59')]),JSON['stringify'](_0x26b731[_0x64d5('0x6a')][_0x5065c8][_0x64d5('0x6d')]),JSON[_0x64d5('0x52')](_[_0x64d5('0x6e')](_0x26b731[_0x64d5('0x6a')][_0x5065c8],[_0x64d5('0x6f'),_0x64d5('0x70'),'VoiceQueueId',_0x64d5('0x71')])));return ami[_0x64d5('0x72')]({'action':'status','channel':_0x26b731[_0x64d5('0x6a')][_0x5065c8][_0x64d5('0x73')]})['catch'](function(_0x521374){if(_0x521374[_0x64d5('0x47')]===_0x64d5('0x74')){setTimeout(function(){if(_0x26b731[_0x64d5('0x6a')][_0x5065c8]){ut['updateOriginated'](_0x26b731['campaignsPreview'][_0x26b731[_0x64d5('0x6a')][_0x5065c8]['queue']],_0x64d5('0x75'));if(_0x26b731[_0x64d5('0x6a')][_0x5065c8][_0x64d5('0x6d')]===!![]){ut[_0x64d5('0x76')](_0x26b731[_0x64d5('0x14')][_0x26b731[_0x64d5('0x6a')][_0x5065c8]['queue']],_0x64d5('0x75'));ut[_0x64d5('0x77')](_0x64d5('0x78')+_0x5065c8,_0x26b731['actions'][_0x5065c8][_0x64d5('0x6b')]);}ut['loggerError'](_0x64d5('0x79')+_0x5065c8,_0x26b731['actions'][_0x5065c8][_0x64d5('0x6b')]);delete _0x26b731['actions'][_0x5065c8];}},0x2328);}});}});};Preview[_0x64d5('0xf')][_0x64d5('0x66')]=function(){var _0x2b4bac=this;loggerAction[_0x64d5('0x55')](_0x64d5('0x7a'),_[_0x64d5('0x7b')](this[_0x64d5('0x6a')]));for(var _0x324c9c in this['actions']){if(_0x2b4bac['actions']['hasOwnProperty'](_0x324c9c)){_0x2b4bac[_0x64d5('0x7c')](_0x324c9c);}}};Preview[_0x64d5('0xf')]['recallMe']=function(_0xa890d8){var _0x4a9a70=this;rpcDb[_0x64d5('0x7d')](_0xa890d8['id'],ut[_0x64d5('0x7e')](this[_0x64d5('0x16')]))[_0x64d5('0x7f')](function(_0x26e375){if(!_['isNil'](_0x26e375)){for(var _0x2aa4e5=0x0;_0x2aa4e5<_0x26e375['length'];_0x2aa4e5+=0x1){if(ut['getDiff'](_0x26e375[_0x2aa4e5][_0x64d5('0x80')])<_0xa890d8[_0x64d5('0x81')]*0x3c){if(_0x26e375[_0x2aa4e5][_0x64d5('0x82')]&&!_0x26e375[_0x2aa4e5][_0x64d5('0x82')][_0x64d5('0x83')]){_0x4a9a70[_0x64d5('0x84')](_0x26e375[_0x2aa4e5]['id'])[_0x64d5('0x7f')](ut[_0x64d5('0x85')](_0x64d5('0x86')))[_0x64d5('0x87')](ut[_0x64d5('0x85')](_0x64d5('0x86')));}else{rpcDb[_0x64d5('0x88')](_0x26e375[_0x2aa4e5]['id']);}}else{var _0x1a4f86=new Action(_0x26e375[_0x2aa4e5],_0xa890d8);_0x1a4f86[_0x64d5('0x89')]=moment()[_0x64d5('0x57')](_0x64d5('0x8a'));_0xa890d8['outboundReCallsDay']+=0x1;ut[_0x64d5('0x8b')](_0x1a4f86,0x17,_0x64d5('0x8c'));if(_0xa890d8['dialRecallInQueue']){rpcDb[_0x64d5('0x8d')](ut[_0x64d5('0x8e')](_0x26e375[_0x2aa4e5]));rpcDb[_0x64d5('0x8f')](_0x1a4f86,_0x64d5('0x90'));}else{ut[_0x64d5('0x8b')](_0x1a4f86,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x1a4f86,'[HistoryRecallClose]');rpcDb[_0x64d5('0x91')](_0x1a4f86,_0x64d5('0x92'));}}}}})['catch'](ut[_0x64d5('0x85')](_0x64d5('0x93')));};Preview['prototype']['setMessage']=function(_0x196a0c){_0x196a0c['sendMessageOneNotActive']=!![];if(ut[_0x64d5('0x94')](_0x196a0c[_0x64d5('0x95')])){_0x196a0c[_0x64d5('0x47')]=_0x64d5('0x96');}else if(!ut[_0x64d5('0x97')](_0x196a0c[_0x64d5('0x31')])){_0x196a0c['message']=_0x64d5('0x5b');}else if(!this[_0x64d5('0x98')](_0x196a0c[_0x64d5('0x4e')])){if(!this[_0x64d5('0x98')](_0x196a0c[_0x64d5('0x99')])){_0x196a0c[_0x64d5('0x47')]='TRUNK_IS_NOT_REACHABLE';}else{_0x196a0c[_0x64d5('0x47')]=_0x64d5('0x9a');}}else{_0x196a0c[_0x64d5('0x47')]='ACTIVE';}emitCampaignPreview(_0x196a0c);};Preview[_0x64d5('0xf')][_0x64d5('0x9b')]=function(_0x4dbfe4,_0x3cc40b,_0x1e709d){var _0x7ec00b=this;var _0x4ccc79=this['actions'][_0x3cc40b];var _0x22cf37=this['campaignsPreview'][_0x4ccc79[_0x64d5('0x6b')]];var _0x5a9e97;var _0x402507=![];var _0x1cec19=0x2;var _0x53a297=0x3;if(_0x22cf37){switch(_0x1e709d){case'1':_0x22cf37[_0x64d5('0x3e')]+=0x1;_0x4ccc79['countnosuchnumberretry']+=0x1;_0x4ccc79['countglobal']=ut[_0x64d5('0x9c')](_0x4ccc79);ut[_0x64d5('0x8b')](_0x4ccc79,0x0,_0x64d5('0x9d'));ami[_0x64d5('0x24')](_0x64d5('0x9e'),ut[_0x64d5('0x9f')](_0x4ccc79,_0x64d5('0xa0')));rpcDb['createCustomerHistory'](_0x4ccc79,_0x64d5('0xa1'));_0x7ec00b[_0x64d5('0xa2')](_0x4ccc79,'0',_0x22cf37)[_0x64d5('0x7f')](function(_0x3e310a){_0x402507=_0x3e310a['additional']==0x1;_0x1cec19=_0x22cf37[_0x64d5('0xa3')];_0x53a297=_0x22cf37['callAdditionalPhoneAfterMin'];if(!_0x402507){if(ut[_0x64d5('0x9c')](_0x4ccc79)>=_0x22cf37[_0x64d5('0xa4')]){_0x5a9e97=ut[_0x64d5('0xa5')](_0x4ccc79,0xf,_0x64d5('0xa6'));rpcDb[_0x64d5('0x91')](_0x5a9e97,_0x64d5('0xa7'));}else{if(_0x4ccc79[_0x64d5('0xa8')]>=_0x22cf37['dialNoSuchNumberMaxRetry']){rpcDb[_0x64d5('0x91')](_0x4ccc79,_0x64d5('0xa7'));}else{rpcDb[_0x64d5('0xa9')](ut['scheduledAt'](_0x4ccc79,_0x64d5('0xa8'),_0x22cf37['dialNoSuchNumberRetryFrequency']),_0x4ccc79[_0x64d5('0xaa')],_0x4ccc79[_0x64d5('0xab')]);}}delete this['actions'][_0x4dbfe4[_0x64d5('0xac')]];}else{_0x4ccc79['countnosuchnumberretry']++;logger[_0x64d5('0x55')](_0x64d5('0xad'),_0x4ccc79[_0x64d5('0xa8')]);logger[_0x64d5('0x55')]('id',_0x4ccc79[_0x64d5('0xae')]);_0x7ec00b[_0x64d5('0xaf')]({'id':_0x4ccc79[_0x64d5('0xae')],'field':{'countnosuchnumberretry':_0x4ccc79[_0x64d5('0xa8')]}})[_0x64d5('0x7f')](function(){_0x7ec00b[_0x64d5('0xb0')](_0x4ccc79,_0x1cec19,_0x53a297)[_0x64d5('0x7f')](function(){});});}});break;case _0x64d5('0xb1'):var _0x346088=moment()[_0x64d5('0x57')](_0x64d5('0x8a'));_0x4ccc79[_0x64d5('0xb2')]=_0x346088;_0x4ccc79[_0x64d5('0xb3')]=_0x346088;_0x4ccc79[_0x64d5('0x6d')]=!![];_0x22cf37[_0x64d5('0x59')]+=0x1;logger[_0x64d5('0x55')](_0x64d5('0xb4'),_0x4ccc79[_0x64d5('0xb5')],_0x64d5('0xb6'),_0x22cf37[_0x64d5('0x26')],'pTalking:\x20',_0x22cf37[_0x64d5('0x59')]);ami['emit'](_0x64d5('0xb7'),ut[_0x64d5('0x9f')](_0x4ccc79,'connect',this[_0x64d5('0x14')][_0x4ccc79[_0x64d5('0x6b')]]));if(_0x22cf37[_0x64d5('0xb8')]){ami[_0x64d5('0x24')](_0x64d5('0xb9'),ut[_0x64d5('0xba')](_0x4ccc79));}break;case'16':ami[_0x64d5('0x24')](_0x64d5('0xbb'),ut[_0x64d5('0x9f')](_0x4ccc79,'complete',this[_0x64d5('0x14')][_0x4ccc79[_0x64d5('0x6b')]]));emitVoiceQueueChannelRemove(ut[_0x64d5('0x9f')](_0x4ccc79,_0x64d5('0xbc')));_0x22cf37[_0x64d5('0x38')]+=0x1;_0x22cf37[_0x64d5('0x2c')]+=0x1;_0x22cf37[_0x64d5('0x28')]+=0x1;ut[_0x64d5('0x76')](_0x22cf37,_0x64d5('0xbd'));_0x4ccc79[_0x64d5('0xbe')]=ut[_0x64d5('0x9c')](_0x4ccc79);ut[_0x64d5('0x8b')](_0x4ccc79,0x4,_0x64d5('0xbf'));rpcDb['createCustomerHistory'](_0x4ccc79,_0x64d5('0xc0'));rpcDb[_0x64d5('0x91')](_0x4ccc79,_0x64d5('0xc1'));rpcDb['crateCustomerReportQueue'](_0x4ccc79);_0x22cf37[_0x64d5('0x2a')]+=_0x4ccc79[_0x64d5('0xc2')];_0x22cf37[_0x64d5('0xc3')]+=_0x4ccc79[_0x64d5('0xc2')];logger[_0x64d5('0x55')]('[syncHangup][talking][decrement]',_0x4ccc79[_0x64d5('0xb5')],_0x64d5('0xb6'),_0x22cf37[_0x64d5('0x26')],_0x64d5('0x6c'),_0x22cf37[_0x64d5('0x59')]);delete this[_0x64d5('0x6a')][_0x4dbfe4[_0x64d5('0xac')]];break;case _0x64d5('0xc4'):_0x22cf37[_0x64d5('0xc5')]+=0x1;_0x4ccc79[_0x64d5('0xc6')]+=0x1;_0x4ccc79[_0x64d5('0xbe')]=ut[_0x64d5('0x9c')](_0x4ccc79);ut[_0x64d5('0x8b')](_0x4ccc79,0x5,_0x64d5('0xc7'));_0x1cec19=_0x22cf37[_0x64d5('0xc8')];_0x53a297=_0x22cf37[_0x64d5('0xc9')];ami[_0x64d5('0x24')](_0x64d5('0xca'),ut[_0x64d5('0x9f')](_0x4ccc79,_0x64d5('0xcb')));rpcDb[_0x64d5('0x8f')](_0x4ccc79,_0x64d5('0xcc'));_0x7ec00b[_0x64d5('0xa2')](_0x4ccc79,'5',_0x22cf37)['then'](function(_0x520d30){_0x402507=_0x520d30[_0x64d5('0xcd')]==0x1;if(!_0x402507){if(ut[_0x64d5('0x9c')](_0x4ccc79)>=_0x22cf37[_0x64d5('0xa4')]){_0x5a9e97=ut[_0x64d5('0xa5')](_0x4ccc79,0xf,_0x64d5('0xa6'));rpcDb[_0x64d5('0x91')](_0x5a9e97,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x4ccc79[_0x64d5('0xc6')]>=_0x22cf37[_0x64d5('0xce')]){rpcDb[_0x64d5('0x91')](_0x4ccc79,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x4ccc79,_0x64d5('0xc6'),_0x22cf37['dialBusyRetryFrequency']),_0x4ccc79[_0x64d5('0xaa')],_0x4ccc79[_0x64d5('0xab')]);}}}else{_0x4ccc79[_0x64d5('0xc6')]++;_0x7ec00b['incrementPreviewCounters']({'id':_0x4ccc79['idContact'],'field':{'countbusyretry':_0x4ccc79['countbusyretry']}})[_0x64d5('0x7f')](function(){_0x7ec00b[_0x64d5('0xb0')](_0x4ccc79,_0x1cec19,_0x53a297)[_0x64d5('0x7f')](function(){});});}});break;case _0x64d5('0xcf'):_0x22cf37[_0x64d5('0x3d')]+=0x1;_0x4ccc79['countnoanswerretry']+=0x1;_0x4ccc79[_0x64d5('0xbe')]=ut[_0x64d5('0x9c')](_0x4ccc79);ut[_0x64d5('0x8b')](_0x4ccc79,0x3,'NoAnswer');_0x1cec19=_0x22cf37[_0x64d5('0xd0')];_0x53a297=_0x22cf37[_0x64d5('0xc9')];ami[_0x64d5('0x24')](_0x64d5('0xd1'),ut['buildObj'](_0x4ccc79,_0x64d5('0xd2')));rpcDb[_0x64d5('0x8f')](_0x4ccc79,_0x64d5('0xd3'));_0x7ec00b[_0x64d5('0xa2')](_0x4ccc79,'3',_0x22cf37)[_0x64d5('0x7f')](function(_0x359e24){_0x402507=_0x359e24[_0x64d5('0xcd')]==0x1;if(!_0x402507){if(ut['totalGlobal'](_0x4ccc79)>=_0x22cf37['dialGlobalMaxRetry']){_0x5a9e97=ut[_0x64d5('0xa5')](_0x4ccc79,0xf,_0x64d5('0xa6'));rpcDb['createCustomerFinal'](_0x5a9e97,_0x64d5('0xd4'));}else{if(_0x4ccc79['countnoanswerretry']>=_0x22cf37['dialNoAnswerMaxRetry']){rpcDb[_0x64d5('0x91')](_0x4ccc79,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x64d5('0xa9')](ut[_0x64d5('0xd5')](_0x4ccc79,'countnoanswerretry',_0x22cf37[_0x64d5('0xd0')]),_0x4ccc79[_0x64d5('0xaa')],_0x4ccc79[_0x64d5('0xab')]);}}}else{_0x4ccc79['countnoanswerretry']++;_0x7ec00b['incrementPreviewCounters']({'id':_0x4ccc79[_0x64d5('0xae')],'field':{'countnoanswerretry':_0x4ccc79['countnoanswerretry']}})['then'](function(){_0x7ec00b[_0x64d5('0xb0')](_0x4ccc79,_0x1cec19,_0x53a297)['then'](function(){});});}});break;case _0x64d5('0xd6'):_0x22cf37[_0x64d5('0x39')]+=0x1;_0x4ccc79[_0x64d5('0xd7')]+=0x1;_0x4ccc79['countglobal']=ut['totalGlobal'](_0x4ccc79);ut[_0x64d5('0x8b')](_0x4ccc79,0x8,_0x64d5('0xd8'));_0x1cec19=_0x22cf37[_0x64d5('0xd9')];_0x53a297=_0x22cf37[_0x64d5('0xc9')];ami[_0x64d5('0x24')](_0x64d5('0xda'),ut[_0x64d5('0x9f')](_0x4ccc79,_0x64d5('0xdb')));rpcDb[_0x64d5('0x8f')](_0x4ccc79,_0x64d5('0xdc'));_0x7ec00b['verifyAdditionalPhones'](_0x4ccc79,'8',_0x22cf37)[_0x64d5('0x7f')](function(_0x1d1ec0){_0x402507=_0x1d1ec0[_0x64d5('0xcd')]==0x1;if(!_0x402507){if(ut['totalGlobal'](_0x4ccc79)>=_0x22cf37[_0x64d5('0xa4')]){_0x5a9e97=ut[_0x64d5('0xa5')](_0x4ccc79,0xf,_0x64d5('0xa6'));rpcDb[_0x64d5('0x91')](_0x5a9e97,_0x64d5('0xdd'));}else{if(_0x4ccc79[_0x64d5('0xd7')]>=_0x22cf37[_0x64d5('0xde')]){rpcDb['createCustomerFinal'](_0x4ccc79,_0x64d5('0xdc'));}else{rpcDb[_0x64d5('0xa9')](ut[_0x64d5('0xd5')](_0x4ccc79,_0x64d5('0xd7'),_0x22cf37[_0x64d5('0xc8')]),_0x4ccc79[_0x64d5('0xaa')],_0x4ccc79[_0x64d5('0xab')]);}}}else{_0x4ccc79['countcongestionretry']++;_0x7ec00b[_0x64d5('0xaf')]({'id':_0x4ccc79['idContact'],'field':{'countcongestionretry':_0x4ccc79['countcongestionretry']}})['then'](function(){_0x7ec00b[_0x64d5('0xb0')](_0x4ccc79,_0x1cec19,_0x53a297)[_0x64d5('0x7f')](function(){});});}});break;case _0x64d5('0xdf'):_0x22cf37[_0x64d5('0x3f')]+=0x1;_0x4ccc79[_0x64d5('0xe0')]+=0x1;_0x4ccc79[_0x64d5('0xbe')]=ut[_0x64d5('0x9c')](_0x4ccc79);ut[_0x64d5('0x8b')](_0x4ccc79,0x14,'AgentReject');_0x1cec19=_0x22cf37['dialAgentRejectRetryFrequency'];_0x53a297=_0x22cf37[_0x64d5('0xc9')];ami[_0x64d5('0x24')](_0x64d5('0xe1'),ut[_0x64d5('0x9f')](_0x4ccc79,_0x64d5('0xe2')));rpcDb[_0x64d5('0x8f')](_0x4ccc79,_0x64d5('0xe3'));_0x7ec00b[_0x64d5('0xa2')](_0x4ccc79,'20',_0x22cf37)['then'](function(_0x59b736){_0x402507=_0x59b736[_0x64d5('0xcd')]==0x1;if(!_0x402507){if(ut[_0x64d5('0x9c')](_0x4ccc79)>=_0x22cf37[_0x64d5('0xa4')]){_0x5a9e97=ut[_0x64d5('0xa5')](_0x4ccc79,0x14,_0x64d5('0xe4'));rpcDb[_0x64d5('0x91')](_0x5a9e97,_0x64d5('0xe5'));}else{if(_0x4ccc79[_0x64d5('0xe0')]>=_0x22cf37['dialAgentRejectMaxRetry']){rpcDb[_0x64d5('0x91')](_0x4ccc79,_0x64d5('0xe5'));}else{rpcDb[_0x64d5('0xa9')](ut[_0x64d5('0xd5')](_0x4ccc79,'countagentrejectretry',_0x22cf37[_0x64d5('0xe6')]),_0x4ccc79[_0x64d5('0xaa')],_0x4ccc79['activeContact']);}}}else{_0x4ccc79[_0x64d5('0xe7')]++;_0x7ec00b[_0x64d5('0xaf')]({'id':_0x4ccc79[_0x64d5('0xae')],'field':{'countnoanswerretry':_0x4ccc79[_0x64d5('0xe7')]}})[_0x64d5('0x7f')](function(){_0x7ec00b[_0x64d5('0xb0')](_0x4ccc79,_0x1cec19,_0x53a297)[_0x64d5('0x7f')](function(){});});}});break;case _0x64d5('0xe8'):_0x22cf37[_0x64d5('0x41')]+=0x1;_0x4ccc79['countabandonedretry']+=0x1;_0x4ccc79[_0x64d5('0xbe')]=ut[_0x64d5('0x9c')](_0x4ccc79);ut[_0x64d5('0x8b')](_0x4ccc79,0xb,_0x64d5('0xe9'));rpcDb[_0x64d5('0x8f')](_0x4ccc79,_0x64d5('0xea'));_0x7ec00b['verifyAdditionalPhones'](_0x4ccc79,'11',_0x22cf37)[_0x64d5('0x7f')](function(_0x484404){_0x402507=_0x484404[_0x64d5('0xcd')]==0x1;if(!_0x402507){if(ut[_0x64d5('0x9c')](_0x4ccc79)>=_0x22cf37[_0x64d5('0xa4')]){_0x5a9e97=ut['cloneAction'](_0x4ccc79,0xf,_0x64d5('0xa6'));rpcDb['createCustomerFinal'](_0x5a9e97,_0x64d5('0xea'));}else{if(_0x4ccc79[_0x64d5('0xeb')]>=_0x22cf37['dialAbandonedMaxRety']){rpcDb[_0x64d5('0x91')](_0x4ccc79,_0x64d5('0xea'));}else{rpcDb[_0x64d5('0xa9')](ut[_0x64d5('0xd5')](_0x4ccc79,'countabandonedretry',_0x22cf37[_0x64d5('0xec')]),_0x4ccc79[_0x64d5('0xaa')],_0x4ccc79[_0x64d5('0xab')]);}}}else{_0x4ccc79['countnoanswerretry']++;_0x7ec00b[_0x64d5('0xaf')]({'id':_0x4ccc79[_0x64d5('0xae')],'field':{'countnoanswerretry':_0x4ccc79[_0x64d5('0xe7')]}})['then'](function(){_0x7ec00b[_0x64d5('0xb0')](_0x4ccc79,_0x1cec19,_0x53a297)[_0x64d5('0x7f')](function(){});});}});break;case'18':_0x22cf37[_0x64d5('0x40')]+=0x1;_0x4ccc79[_0x64d5('0xed')]+=0x1;_0x4ccc79['countglobal']=ut[_0x64d5('0x9c')](_0x4ccc79);ut[_0x64d5('0x8b')](_0x4ccc79,0x12,_0x4dbfe4[_0x64d5('0xee')]||_0x4dbfe4[_0x64d5('0xef')]);ami[_0x64d5('0x24')](_0x64d5('0xf0'),ut[_0x64d5('0x9f')](_0x4ccc79,_0x64d5('0xf1')));rpcDb['createCustomerHistory'](_0x4ccc79,_0x64d5('0xf2'));_0x7ec00b[_0x64d5('0xa2')](_0x4ccc79,'18',_0x22cf37)[_0x64d5('0x7f')](function(_0x557b43){_0x402507=_0x557b43[_0x64d5('0xcd')]==0x1;if(!_0x402507){if(ut[_0x64d5('0x9c')](_0x4ccc79)>=_0x22cf37[_0x64d5('0xa4')]){_0x5a9e97=ut[_0x64d5('0xa5')](_0x4ccc79,0x12,_0x64d5('0xa6'));rpcDb[_0x64d5('0x91')](_0x5a9e97,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x4ccc79,_0x64d5('0xf2'));}}else{_0x4ccc79[_0x64d5('0xe7')]++;_0x7ec00b['incrementPreviewCounters']({'id':_0x4ccc79[_0x64d5('0xae')],'field':{'countnoanswerretry':_0x4ccc79[_0x64d5('0xe7')]}})['then'](function(){_0x7ec00b[_0x64d5('0xb0')](_0x4ccc79,_0x1cec19,_0x53a297)[_0x64d5('0x7f')](function(){});});}});delete this[_0x64d5('0x6a')][_0x4dbfe4['linkedid']];break;case'19':_0x22cf37[_0x64d5('0x40')]+=0x1;_0x4ccc79['countglobal']=ut[_0x64d5('0x9c')](_0x4ccc79);ut[_0x64d5('0x8b')](_0x4ccc79,0x13,_0x4dbfe4['cause-txt']||_0x4dbfe4[_0x64d5('0xef')]);ami[_0x64d5('0x24')](_0x64d5('0xf0'),ut[_0x64d5('0x9f')](_0x4ccc79,_0x64d5('0xf1')));rpcDb[_0x64d5('0x8f')](_0x4ccc79,_0x64d5('0xf3'));_0x7ec00b['verifyAdditionalPhones'](_0x4ccc79,'18',_0x22cf37)[_0x64d5('0x7f')](function(_0x18659e){_0x402507=_0x18659e['additional']==0x1;if(!_0x402507){if(ut['totalGlobal'](_0x4ccc79)>=_0x22cf37[_0x64d5('0xa4')]){_0x5a9e97=ut[_0x64d5('0xa5')](_0x4ccc79,0xf,_0x64d5('0xa6'));rpcDb[_0x64d5('0x91')](_0x5a9e97,_0x64d5('0xf3'));}else{rpcDb[_0x64d5('0x91')](_0x4ccc79,_0x64d5('0xf3'));}}else{_0x4ccc79[_0x64d5('0xe7')]++;_0x7ec00b['incrementPreviewCounters']({'id':_0x4ccc79[_0x64d5('0xae')],'field':{'countnoanswerretry':_0x4ccc79[_0x64d5('0xe7')]}})[_0x64d5('0x7f')](function(){_0x7ec00b[_0x64d5('0xb0')](_0x4ccc79,_0x1cec19,_0x53a297)[_0x64d5('0x7f')](function(){});});}});delete this[_0x64d5('0x6a')][_0x4dbfe4[_0x64d5('0xac')]];break;default:if(_0x4ccc79['dialAnswer']){ut[_0x64d5('0x76')](_0x22cf37,_0x64d5('0xf4'));ut[_0x64d5('0x77')](_0x64d5('0xf5')+_0x22cf37[_0x64d5('0x26')],_0x4dbfe4);}_0x22cf37[_0x64d5('0x40')]+=0x1;_0x4ccc79[_0x64d5('0xbe')]=ut[_0x64d5('0x9c')](_0x4ccc79);ut[_0x64d5('0x8b')](_0x4ccc79,0xc,_0x4dbfe4[_0x64d5('0xee')]||_0x4dbfe4[_0x64d5('0xef')]);_0x1cec19=_0x22cf37['dialAgentRejectRetryFrequency'];_0x53a297=_0x22cf37[_0x64d5('0xc9')];rpcDb['createCustomerHistory'](_0x4ccc79,'[callProgressDetectingCustomer][logUnknown]');_0x7ec00b[_0x64d5('0xa2')](_0x4ccc79,'20',_0x22cf37)[_0x64d5('0x7f')](function(_0x40fd52){_0x402507=_0x40fd52[_0x64d5('0xcd')]==0x1;if(!_0x402507){if(ut['totalGlobal'](_0x4ccc79)>=_0x22cf37['dialGlobalMaxRetry']){_0x5a9e97=ut['cloneAction'](_0x4ccc79,0xf,_0x64d5('0xa6'));rpcDb[_0x64d5('0x91')](_0x5a9e97,_0x64d5('0xf6'));}else{rpcDb['createCustomerFinal'](_0x4ccc79,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x64d5('0x6a')][_0x4dbfe4[_0x64d5('0xac')]];}else{_0x7ec00b[_0x64d5('0xb0')](_0x4ccc79,_0x1cec19,_0x53a297)['then'](function(_0x279bb6){});}});}if(!(_0x4ccc79[_0x64d5('0x6d')]&&_0x1e709d==='16')){ut[_0x64d5('0xf7')](_0x22cf37,_0x64d5('0xf8'));logger[_0x64d5('0x55')](_0x64d5('0xf9'),_0x4ccc79['uniqueid'],_0x64d5('0xb6'),_0x22cf37[_0x64d5('0x26')],_0x64d5('0xfa'),_0x22cf37[_0x64d5('0x48')]);}if(_0x1e709d!=='ANSWER'){delete this[_0x64d5('0x6a')][_0x4dbfe4[_0x64d5('0xac')]];delete this['actions'][_0x4dbfe4['destlinkedid']];}}};Preview['prototype'][_0x64d5('0xfb')]=function(_0x4caaee,_0x5a6b9a,_0xc01452){if(_[_0x64d5('0xfc')](_0x5a6b9a)&&_0x64d5('0xfd')!==typeof _0x5a6b9a){return;}if(_['isUndefined'](_0xc01452)&&_0x64d5('0xfd')!==typeof _0xc01452){return;}switch(_0xc01452[_0x64d5('0xfe')]){case'0':ut[_0x64d5('0xff')](_0x4caaee,0x0,'NoSuchNumber');rpcDb[_0x64d5('0x100')](_0x4caaee,_0x64d5('0x101'));break;case'3':ut[_0x64d5('0xff')](_0x4caaee,0x3,_0x64d5('0x102'));rpcDb[_0x64d5('0x100')](_0x4caaee,_0x64d5('0x103'));break;case'5':ut['logAgent'](_0x4caaee,0x5,_0x64d5('0xc7'));rpcDb[_0x64d5('0x100')](_0x4caaee,_0x64d5('0x104'));break;case'8':ut['logAgent'](_0x4caaee,0x8,_0x64d5('0xd8'));rpcDb[_0x64d5('0x100')](_0x4caaee,_0x64d5('0x105'));break;case'22':ut[_0x64d5('0xff')](_0x4caaee,0x16,_0x64d5('0x106'));rpcDb[_0x64d5('0x100')](_0x4caaee,_0x64d5('0x107'));break;default:ut[_0x64d5('0xff')](_0x4caaee,0xc,_0xc01452['reason']);rpcDb[_0x64d5('0x100')](_0x4caaee,_0x64d5('0x105'));}ut[_0x64d5('0xf7')](_0x5a6b9a,'[callProgressDetectingAgent]');logger['info'](_0x64d5('0x108'),_0x4caaee[_0x64d5('0xb5')],_0x64d5('0xb6'),_0x5a6b9a[_0x64d5('0x26')],_0x64d5('0xfa'),_0x5a6b9a[_0x64d5('0x48')]);delete this[_0x64d5('0x6a')][_0x4caaee[_0x64d5('0xb5')]];};Preview[_0x64d5('0xf')]['verifyAdditionalPhones']=function(_0x91b5cc,_0x1969fc,_0x5e1c07){return BPromise['resolve']()[_0x64d5('0x7f')](cmHopperAdditionalPhone[_0x64d5('0xa2')](_0x91b5cc,_0x1969fc,_0x5e1c07))['catch'](logger[_0x64d5('0x55')](_0x64d5('0x109')));};Preview['prototype'][_0x64d5('0xb0')]=function(_0x3a54c6,_0x225844,_0x5a943e){return BPromise[_0x64d5('0x10a')]()[_0x64d5('0x7f')](cmHopperAdditionalPhone[_0x64d5('0xb0')](_0x3a54c6,_0x225844,_0x5a943e))[_0x64d5('0x87')](logger[_0x64d5('0x55')](_0x64d5('0x10b')));};Preview[_0x64d5('0xf')][_0x64d5('0xaf')]=function(_0x40c488){return BPromise[_0x64d5('0x10a')]()[_0x64d5('0x7f')](cmHopperAdditionalPhone[_0x64d5('0xaf')](_0x40c488))[_0x64d5('0x87')](logger[_0x64d5('0x55')](_0x64d5('0x10c')));};Preview[_0x64d5('0xf')][_0x64d5('0x10d')]=function(_0xc2f0fa,_0x5629b1,_0x59a2da,_0x5bfe81,_0x47c002){var _0x1872e5=this;return new BPromise(function(_0xd7938e,_0x7237a7){if(_['isNil'](_0x5629b1)||_[_0x64d5('0x69')](_0x5629b1[_0x64d5('0x10e')])||_[_0x64d5('0x69')](_0x5629b1['phone'])||_[_0x64d5('0x69')](_0x5629b1[_0x64d5('0x10f')])){_0x7237a7(ut[_0x64d5('0x47')](_0x64d5('0x110'),_0x5bfe81,_0x47c002));return;}var _0x4579ef=uuid['v4']();var _0x5b0234=_0x1872e5[_0x64d5('0x14')][_0x5629b1[_0x64d5('0x111')]['name']];var _0x4b5576=_0x59a2da?_0x1872e5[_0x64d5('0x16')][_0x59a2da]['id']:undefined;_0x1872e5[_0x64d5('0x6a')][_0x4579ef]=new Action(_0x5629b1,_0x5b0234,_0x4579ef,_0x59a2da,_0x4b5576);var _0x10bed4=_0x1872e5[_0x64d5('0x6a')][_0x4579ef];_0x10bed4[_0x64d5('0xaa')]=_0x5bfe81;_0x10bed4[_0x64d5('0xab')]=_0x47c002;_0x10bed4[_0x64d5('0x112')]=_0x59a2da;if(_[_0x64d5('0x113')](_0xc2f0fa)){_0x1872e5[_0x64d5('0x114')](_0x10bed4,_0x5b0234,_0x5629b1,_0x59a2da)[_0x64d5('0x7f')](function(_0xf34d5d){logger['info'](_0x64d5('0x115'),_0x64d5('0x116')+_0x10bed4[_0x64d5('0x6b')]+_0x64d5('0x117')+_0x10bed4[_0x64d5('0xae')],JSON[_0x64d5('0x52')](_0xf34d5d));ami[_0x64d5('0x24')](_0x64d5('0x118'),ut[_0x64d5('0x9f')](_0x10bed4,'called',_0x1872e5[_0x64d5('0x14')][_0x10bed4['queue']]));_0xd7938e(ut[_0x64d5('0x47')](_0x64d5('0x119')));})['catch'](function(_0x44d328){ut['logger'](_0x64d5('0x11a'),_0x44d328);_0x7237a7(ut[_0x64d5('0x47')](_0x64d5('0x11b'),_0x5bfe81,_0x47c002));});}else{_0x5b0234[_0x64d5('0x11c')]+=0x1;ut[_0x64d5('0x11d')](_0x10bed4);rpcDb[_0x64d5('0x11e')](_0x10bed4,'[Blacklist][error]');delete _0x1872e5[_0x64d5('0x6a')][_0x4579ef];_0x7237a7(ut[_0x64d5('0x47')]('Contact\x20in\x20black\x20List',_0x5bfe81,_0x47c002));}});};Preview[_0x64d5('0xf')][_0x64d5('0x98')]=function(_0x2451d3){return!_[_0x64d5('0x69')](_0x2451d3)&&!_[_0x64d5('0x69')](_0x2451d3[_0x64d5('0x26')])&&!_[_0x64d5('0x69')](_0x2451d3[_0x64d5('0x4f')])&&_0x2451d3[_0x64d5('0x4f')]&&!_['isNil'](this[_0x64d5('0x15')][util['format'](_0x64d5('0x11f'),_0x2451d3[_0x64d5('0x26')])])&&!_[_0x64d5('0x69')](this[_0x64d5('0x15')][util[_0x64d5('0x57')](_0x64d5('0x11f'),_0x2451d3[_0x64d5('0x26')])][_0x64d5('0x120')])&&(this[_0x64d5('0x15')][util[_0x64d5('0x57')](_0x64d5('0x11f'),_0x2451d3[_0x64d5('0x26')])][_0x64d5('0x120')]==='reachable'||this[_0x64d5('0x15')][util[_0x64d5('0x57')](_0x64d5('0x11f'),_0x2451d3[_0x64d5('0x26')])][_0x64d5('0x120')]===_0x64d5('0x121'));};Preview[_0x64d5('0xf')][_0x64d5('0x84')]=function(_0x59ebb3,_0x104b5d){var _0x3c0d93=this;return new BPromise(function(_0x30bbf9,_0x33687b){_0x3c0d93[_0x64d5('0x122')](_0x59ebb3,_0x104b5d)['then'](function(_0x492ced){_0x30bbf9(_[_0x64d5('0x6e')](_0x492ced,[_0x64d5('0x47')]));})[_0x64d5('0x87')](function(_0x3ae272){if(_0x3ae272[_0x64d5('0x123')]){rpcDb['unlockContact'](_0x59ebb3);}if(_0x3ae272[_0x64d5('0x4f')]){rpcDb[_0x64d5('0x88')](_0x59ebb3);}_0x33687b(_[_0x64d5('0x6e')](_0x3ae272,[_0x64d5('0x47')]));});});};Preview[_0x64d5('0xf')]['execRun']=function(_0x27e8b0,_0x40972b){var _0x2ba4f7=this;return new BPromise(function(_0x9e5373,_0x579fea){var _0x350ad9,_0x5624d1;rpcDb[_0x64d5('0x124')](_0x27e8b0)[_0x64d5('0x7f')](function(_0x3c1d8a){if(!_[_0x64d5('0x69')](_0x3c1d8a[0x0])){_0x5624d1=_0x3c1d8a[0x0][_0x64d5('0x125')]?![]:!![];_0x350ad9=_0x3c1d8a[0x0][_0x64d5('0x125')]?!![]:![];_0x350ad9=_0x40972b?!![]:_0x350ad9;}var _0x327914=_0x2ba4f7[_0x64d5('0x126')](_0x3c1d8a);if(_0x327914[_0x64d5('0x127')]){rpcDb['checkIsBlackList'](_[_0x64d5('0x6e')](_0x3c1d8a[0x0],['VoiceQueueId',_0x64d5('0x128')]))[_0x64d5('0x7f')](function(_0x596f42){_0x2ba4f7[_0x64d5('0x10d')](_0x596f42,_0x3c1d8a[0x0],_0x40972b,_0x5624d1,_0x350ad9)['then'](function(_0x32c3e0){_0x9e5373(_0x32c3e0);})[_0x64d5('0x87')](function(_0x13b2ef){_0x579fea(_0x13b2ef);});})[_0x64d5('0x87')](function(_0x700039){ut[_0x64d5('0x5c')]('[Preview][checkIsBlackList]',_0x700039);_0x579fea(ut[_0x64d5('0x47')](_0x64d5('0x129'),_0x5624d1,_0x350ad9));});}else{_0x579fea(ut[_0x64d5('0x47')](_0x327914[_0x64d5('0x47')],_0x5624d1,_0x350ad9));}})[_0x64d5('0x87')](function(_0x1eb193){ut[_0x64d5('0x5c')](_0x64d5('0x12a'),_0x1eb193);_0x579fea(ut[_0x64d5('0x47')](_0x64d5('0x129'),![],!![]));});});};Preview[_0x64d5('0xf')][_0x64d5('0x126')]=function(_0x28efdb){if(_[_0x64d5('0x69')](_0x28efdb)||_[_0x64d5('0x113')](_0x28efdb)||!_['isNil'](_0x28efdb[0x0][_0x64d5('0x82')])&&_['isNil'](_0x28efdb[0x0][_0x64d5('0x82')]['name'])){ut['logger'](_0x64d5('0x12b'),_0x28efdb);return{'isValid':![],'message':_0x64d5('0x12c')};}var _0x771f3c=this[_0x64d5('0x14')][_0x28efdb[0x0][_0x64d5('0x111')][_0x64d5('0x26')]];_0x771f3c[_0x64d5('0x47')]=_0x64d5('0x9a');if(_[_0x64d5('0x69')](_0x771f3c)){ut[_0x64d5('0x5c')]('[Preview][validateContact][Empty\x20Campaign]',_0x771f3c);return{'isValid':![],'message':_0x64d5('0x12d')};}if(!this['isTrunkReachable'](_0x771f3c['Trunk'])){ut[_0x64d5('0x5c')](_0x64d5('0x12e'),'campaign\x20Name:\x20'+_0x771f3c['name']+_0x64d5('0x12f'));if(!this[_0x64d5('0x98')](_0x771f3c[_0x64d5('0x99')])){ut['logger'](_0x64d5('0x12e'),_0x771f3c['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x64d5('0x130')};}}if(!ut['isActive'](_0x771f3c[_0x64d5('0x31')])){ut[_0x64d5('0x5c')](_0x64d5('0x131'),_0x771f3c[_0x64d5('0x26')]+_0x64d5('0x132'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x771f3c[_0x64d5('0x26')]+_0x64d5('0x132')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x64d5('0xf')][_0x64d5('0x114')]=function(_0x5a2037,_0x184811,_0x5837a1,_0x2290a8){var _0x3272e8=this;return new BPromise(function(_0x631d6b,_0x2b196d){var _0xf0ff7b=_0x5a2037['uniqueid'];var _0x5e6287=_0x3272e8[_0x64d5('0x98')](_0x184811[_0x64d5('0x4e')])?util[_0x64d5('0x57')](_0x64d5('0x133'),_0x184811[_0x64d5('0x4e')][_0x64d5('0x26')],_['isNil'](_0x184811[_0x64d5('0x36')])?'':_0x184811[_0x64d5('0x36')][_0x64d5('0x134')]()||'',_0x184811['dialCutDigit']>0x0?_0x5837a1['phone']['substring'](_0x184811[_0x64d5('0x135')]):_0x5837a1[_0x64d5('0x128')]):util[_0x64d5('0x57')](_0x64d5('0x133'),_[_0x64d5('0x69')](_0x184811['TrunkBackup'])?_0x184811[_0x64d5('0x4e')][_0x64d5('0x26')]:_0x184811['TrunkBackup'][_0x64d5('0x26')],_[_0x64d5('0x69')](_0x184811[_0x64d5('0x36')])?'':_0x184811['dialPrefix'][_0x64d5('0x134')]()||'',_0x184811[_0x64d5('0x135')]>0x0?_0x5837a1['phone'][_0x64d5('0x136')](_0x184811[_0x64d5('0x135')]):_0x5837a1[_0x64d5('0x128')]);var _0x3cdf3e=_0x3272e8['isTrunkReachable'](_0x184811['Trunk'])?ut[_0x64d5('0x137')](_0x184811['Trunk'][_0x64d5('0x50')],_0x184811[_0x64d5('0x33')],_0x184811[_0x64d5('0x138')]>0x0?ut[_0x64d5('0x139')](_0x184811[_0x64d5('0x34')],_0x184811[_0x64d5('0x138')]):_0x184811[_0x64d5('0x34')]):ut['getCallerId'](_['isNil'](_0x184811[_0x64d5('0x99')])?_0x184811[_0x64d5('0x4e')][_0x64d5('0x50')]:_0x184811[_0x64d5('0x99')]['callerid'],_0x184811[_0x64d5('0x33')],_0x184811[_0x64d5('0x138')]>0x0?ut[_0x64d5('0x139')](_0x184811[_0x64d5('0x34')],_0x184811[_0x64d5('0x138')]):_0x184811[_0x64d5('0x34')]);if(_0x3cdf3e){_0x5a2037['originatecalleridname']=ut[_0x64d5('0x13a')](_0x3cdf3e);_0x5a2037[_0x64d5('0x13b')]=ut[_0x64d5('0x13c')](_0x3cdf3e);}var _0x3adfd8=ut[_0x64d5('0x13d')](_0x184811,_0x5837a1,_0x5e6287,_0x3cdf3e,_0xf0ff7b,_0x5a2037);_[_0x64d5('0x13e')](_0x5a2037,ut[_0x64d5('0x13f')](_0x3adfd8));_0x5a2037['starttime']=moment()[_0x64d5('0x57')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x64d5('0x72')](ut[_0x64d5('0x140')](_0x5a2037,_0x184811,_0x3adfd8,_0x5a2037[_0x64d5('0xab')],_0x2290a8))['then'](function(_0x12d646){var _0x3909a0=_0x5a2037[_0x64d5('0x141')];if(!_[_0x64d5('0x69')](_0x3909a0)){if(!_['isNil'](_0x3272e8[_0x64d5('0x16')][_0x3909a0])){_0x3272e8[_0x64d5('0x16')][_0x3909a0][_0x64d5('0x142')]=_0x5a2037[_0x64d5('0x143')];emit(util[_0x64d5('0x57')]('user:%s',_0x3272e8[_0x64d5('0x16')][_0x3909a0]['name']),_0x64d5('0x144'),{'destaccountcode':_0x3272e8[_0x64d5('0x16')][_0x3909a0][_0x64d5('0x145')],'destconnectedlinenum':_0x5a2037[_0x64d5('0x143')]});}}_0x184811[_0x64d5('0x48')]+=0x1;logger['info'](_0x64d5('0x146'),_0xf0ff7b,_0x64d5('0xb6'),_0x184811[_0x64d5('0x26')],_0x64d5('0xfa'),_0x184811[_0x64d5('0x48')]);_0x631d6b(_0x12d646);})[_0x64d5('0x87')](function(_0x1811b0){ut[_0x64d5('0xff')](_0x5a2037,0xe,_0x64d5('0x147'));rpcDb[_0x64d5('0x100')](_0x5a2037,_0x64d5('0x148'));_0x2b196d(_0x1811b0);});});};Preview[_0x64d5('0xf')][_0x64d5('0x1f')]=function(_0x35a8a6){if(this[_0x64d5('0x6a')][_0x35a8a6[_0x64d5('0xac')]]){this['actions'][_0x35a8a6[_0x64d5('0xac')]]['channel']=_0x35a8a6[_0x64d5('0x73')];}};Preview[_0x64d5('0xf')][_0x64d5('0x149')]=function(_0x3273d3){var _0x2a7115=this;var _0xe0253a=this[_0x64d5('0x6a')][_0x3273d3[_0x64d5('0x14a')]];if(_0xe0253a){if(_0xe0253a[_0x64d5('0x112')]&&this[_0x64d5('0x16')][_0xe0253a['lookAgent']]){ut[_0x64d5('0x14b')](_0xe0253a,this[_0x64d5('0x16')][_0xe0253a[_0x64d5('0x112')]][_0x64d5('0x26')],this[_0x64d5('0x16')][_0xe0253a[_0x64d5('0x112')]]['id']);}var _0x365e9a=_[_0x64d5('0x14c')](_0xe0253a);_0x365e9a['responsetime']=moment()[_0x64d5('0x57')](_0x64d5('0x8a'));var _0x28d56c=_0x2a7115[_0x64d5('0x14')][_0xe0253a[_0x64d5('0x6b')]];if(ut['isFailure'](_0x3273d3['response'])){if(_0xe0253a['unlockAgent']){rpcDb[_0x64d5('0x14d')](_0xe0253a[_0x64d5('0xae')]);}if(_0xe0253a['activeContact']){rpcDb[_0x64d5('0x88')](_0xe0253a[_0x64d5('0xae')]);}ami[_0x64d5('0x24')](_0x64d5('0x14e'),ut['buildObj'](_0xe0253a,_0x64d5('0x14f'),this[_0x64d5('0x14')][_0xe0253a[_0x64d5('0x6b')]]));this[_0x64d5('0xfb')](_0x365e9a,_0x28d56c,_0x3273d3);}else{_0xe0253a[_0x64d5('0x89')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ut[_0x64d5('0xff')](_0x365e9a,0x4,_0x64d5('0xbf'));rpcDb[_0x64d5('0x100')](_0x365e9a,_0x64d5('0x150'));}}};Preview[_0x64d5('0xf')][_0x64d5('0x151')]=function(_0x168355){var _0x1a4054=this;var _0x1d39f3=this['actions'][_0x168355[_0x64d5('0xac')]];var _0x36ed95;if(_0x1d39f3){_0x36ed95=this[_0x64d5('0x14')][_0x1d39f3[_0x64d5('0x6b')]];logger[_0x64d5('0x55')](_0x64d5('0x152'),_0x168355[_0x64d5('0xac')],_0x64d5('0xb6'),_0x36ed95['name'],'pTalking:\x20',_0x36ed95[_0x64d5('0x59')]);}if(this[_0x64d5('0x6a')][_0x168355[_0x64d5('0xac')]]&&_0x168355['linkedid']!==_0x168355['uniqueid']){if(_0x168355['cause']==='16'&&this[_0x64d5('0x6a')][_0x168355[_0x64d5('0xac')]][_0x64d5('0x6d')]){this[_0x64d5('0x9b')](_0x168355,_0x168355[_0x64d5('0xac')],_0x168355[_0x64d5('0x153')]);}else if(this['actions'][_0x168355[_0x64d5('0xac')]][_0x64d5('0x6d')]){logger[_0x64d5('0x55')]('[syncHangup][talking][cause]',_0x168355[_0x64d5('0xac')],_0x168355[_0x64d5('0x153')],_0x64d5('0xb6'),_0x36ed95['name'],_0x64d5('0x6c'),_0x36ed95[_0x64d5('0x59')]);this[_0x64d5('0x9b')](_0x168355,_0x168355['linkedid'],_0x168355[_0x64d5('0x153')]);}}else if(_0x1d39f3&&_[_0x64d5('0x69')](_0x1d39f3[_0x64d5('0x154')])&&_0x36ed95[_0x64d5('0x155')]&&_0x168355[_0x64d5('0xac')]===_0x168355['uniqueid']&&_['isNil'](_0x168355[_0x64d5('0xfe')])&&_0x168355['cause']==='16'&&_0x168355[_0x64d5('0x156')]==='6'&&_[_0x64d5('0xfc')](_0x1d39f3[_0x64d5('0x157')])){if(_0x1d39f3[_0x64d5('0xaa')]){rpcDb['unlockContact'](_0x1d39f3['idContact']);}if(_0x1d39f3[_0x64d5('0xab')]){rpcDb[_0x64d5('0x88')](_0x1d39f3[_0x64d5('0xae')]);}_0x168355[_0x64d5('0xfe')]='22';this[_0x64d5('0xfb')](_0x1d39f3,_0x36ed95,_0x168355);}else if(_0x1d39f3&&_0x1d39f3[_0x64d5('0x157')]){if(_0x168355[_0x64d5('0x153')]==='16'&&this[_0x64d5('0x6a')][_0x168355['linkedid']]['dialAnswer']){logger[_0x64d5('0x55')](_0x64d5('0x158'),_0x168355[_0x64d5('0xac')],_0x168355[_0x64d5('0x153')],'\x20Queue',_0x36ed95['name'],_0x64d5('0x6c'),_0x36ed95[_0x64d5('0x59')]);this[_0x64d5('0x9b')](_0x168355,_0x168355[_0x64d5('0xac')],_0x168355[_0x64d5('0x153')]);}else if(this[_0x64d5('0x6a')][_0x168355[_0x64d5('0xac')]][_0x64d5('0x6d')]){logger[_0x64d5('0x55')]('[syncHangup][talking][cause]',_0x168355[_0x64d5('0xac')],_0x168355[_0x64d5('0x153')],_0x64d5('0xb6'),_0x36ed95['name'],_0x64d5('0x6c'),_0x36ed95[_0x64d5('0x59')]);this[_0x64d5('0x9b')](_0x168355,_0x168355[_0x64d5('0xac')],_0x168355['cause']);}}};Preview[_0x64d5('0xf')][_0x64d5('0x1d')]=function(_0x5971ab){if(this['actions'][_0x5971ab['destlinkedid']]&&_0x5971ab[_0x64d5('0x159')]!==_0x5971ab['destuniqueid']){this[_0x64d5('0x9b')](_0x5971ab,_0x5971ab['destlinkedid'],_0x5971ab[_0x64d5('0xef')]);}};Preview[_0x64d5('0xf')][_0x64d5('0x1b')]=function(_0x547dff){if(this[_0x64d5('0x6a')][_0x547dff[_0x64d5('0xac')]]&&_0x547dff[_0x64d5('0xac')]!==_0x547dff[_0x64d5('0xb5')]&&!this[_0x64d5('0x6a')][_0x547dff[_0x64d5('0xac')]][_0x64d5('0x6d')]){if(_0x547dff[_0x64d5('0x153')]==='1'){this[_0x64d5('0x9b')](_0x547dff,_0x547dff['linkedid'],_0x547dff[_0x64d5('0x153')]);}}};Preview[_0x64d5('0xf')]['addVariable']=function(_0x5b1f29,_0x92efa2,_0x3a6af1){if(this['actions'][_0x5b1f29]){if(_[_0x64d5('0x69')](this['actions'][_0x5b1f29]['variables'])){this['actions'][_0x5b1f29][_0x64d5('0x15a')]={};}this[_0x64d5('0x6a')][_0x5b1f29][_0x64d5('0x15a')][_0x92efa2]=_0x3a6af1;}};Preview['prototype'][_0x64d5('0x21')]=function(_0x4f2b97){try{if(!_[_0x64d5('0x69')](_0x4f2b97)){if(ut[_0x64d5('0x15b')](_['keys'](_0x4f2b97[_0x64d5('0x15c')])[0x0])){this[_0x64d5('0x15d')](_0x4f2b97[_0x64d5('0xb5')],_[_0x64d5('0x15e')](_0x4f2b97[_0x64d5('0x15c')])[0x0],_0x4f2b97[_0x64d5('0x15f')]);}}}catch(_0x4e64b5){logger[_0x64d5('0x160')](_0x64d5('0x161'),util['inspect'](_0x4e64b5,{'showHidden':![],'depth':null}));}};Preview[_0x64d5('0xf')][_0x64d5('0x22')]=function(_0x2f653a){if(_0x2f653a){if(this[_0x64d5('0x6a')][_0x2f653a['transfertargetlinkedid']]){this['actions'][_0x2f653a[_0x64d5('0x162')]][_0x64d5('0x157')]=!![];}}};Preview[_0x64d5('0xf')][_0x64d5('0x163')]=function(_0x497dae){if(_0x497dae){if(this[_0x64d5('0x6a')][_0x497dae[_0x64d5('0x164')]]){this[_0x64d5('0x6a')][_0x497dae[_0x64d5('0x164')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index b33be38..c247484 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 _0x3c25=['../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','inspect','resolve','then','[createHistory]\x20','createHistory','catch','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','UserId','rescheduleContact','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','lastAssignedTo','queuecallerexitreason','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory'];(function(_0x1a694b,_0x3a6cf2){var _0x5a90a9=function(_0x3ab312){while(--_0x3ab312){_0x1a694b['push'](_0x1a694b['shift']());}};_0x5a90a9(++_0x3a6cf2);}(_0x3c25,0xc8));var _0x53c2=function(_0x1273c2,_0x909d36){_0x1273c2=_0x1273c2-0x0;var _0x1dd074=_0x3c25[_0x1273c2];return _0x1dd074;};'use strict';var util=require(_0x53c2('0x0'));var BPromise=require(_0x53c2('0x1'));var logger=require(_0x53c2('0x2'))(_0x53c2('0x3'));var _=require(_0x53c2('0x4'));var cmHopper=require(_0x53c2('0x5'));var cmHopperFinal=require(_0x53c2('0x6'));var cmHopperHistory=require(_0x53c2('0x7'));var cmHopperBlack=require(_0x53c2('0x8'));var voiceQueueRt=require(_0x53c2('0x9'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x53c2('0xa'));function loggerCatch(_0x3db7c3){return function(_0x5decb5){logger[_0x53c2('0xb')](_0x3db7c3,util[_0x53c2('0xc')](_0x5decb5,{'showHidden':![],'depth':null}));};}function create(_0x1ff58b){return BPromise[_0x53c2('0xd')]()[_0x53c2('0xe')](cmHopperHistory['createHistory'](_0x1ff58b))['catch'](loggerCatch(_0x53c2('0xf')));}function createAgent(_0xd0a8db){return BPromise['resolve']()[_0x53c2('0xe')](agentReportPreview[_0x53c2('0x10')](_0xd0a8db))[_0x53c2('0x11')](loggerCatch(_0x53c2('0xf')));}function moveContact(_0x2d1c68){return BPromise[_0x53c2('0xd')]()[_0x53c2('0xe')](cmHopper[_0x53c2('0x12')](_0x2d1c68,!![]))[_0x53c2('0x11')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x37cada){return BPromise['resolve']()[_0x53c2('0xe')](cmHopperBlack[_0x53c2('0x13')](_0x37cada))['catch'](loggerCatch(_0x53c2('0x14')));};exports['getContactPreview']=function(_0x1554ad){return BPromise['resolve']()['then'](cmHopper['getContactPreview'](_0x1554ad))[_0x53c2('0x11')](loggerCatch(_0x53c2('0x15')));};exports[_0x53c2('0x10')]=function(_0x41360a,_0x5a29e5){create(_0x41360a)[_0x53c2('0x11')](loggerCatch(_0x5a29e5));moveContact(_0x41360a)[_0x53c2('0x11')](loggerCatch(_0x5a29e5));};exports[_0x53c2('0x16')]=function(_0x23d04a,_0x3789fc){createAgent(_0x23d04a)[_0x53c2('0x11')](loggerCatch(_0x3789fc));};exports[_0x53c2('0x17')]=function(_0x18e087,_0x5ddce8){create(_0x18e087)[_0x53c2('0x11')](loggerCatch(_0x5ddce8));};exports[_0x53c2('0x18')]=function(_0x5ed9b8,_0x2e6520){moveContact(_0x5ed9b8)['catch'](loggerCatch(_0x2e6520));};exports['rescheduleContact']=function(_0x189266,_0x19c9b5,_0x5eccd6){if(_0x19c9b5){_0x189266[_0x53c2('0x19')]=null;}if(_0x5eccd6){_0x189266['active']=![];}return BPromise[_0x53c2('0xd')]()[_0x53c2('0xe')](cmHopper[_0x53c2('0x1a')](_0x189266))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x651980){return BPromise[_0x53c2('0xd')]()['then'](cmHopper[_0x53c2('0x1b')](_0x651980))['catch'](loggerCatch(_0x53c2('0x1c')));};exports[_0x53c2('0x1d')]=function(_0x5be544){return BPromise[_0x53c2('0xd')]()[_0x53c2('0xe')](cmHopper[_0x53c2('0x1d')]({'UserId':null},_0x5be544,0x1))[_0x53c2('0x11')](loggerCatch(_0x53c2('0x1e')));};exports['disableContact']=function(_0x538121){return BPromise[_0x53c2('0xd')]()[_0x53c2('0xe')](cmHopper[_0x53c2('0x1d')]({'active':![]},_0x538121,0x1))['catch'](loggerCatch(_0x53c2('0x1f')));};exports['crateCustomerReportQueue']=function(_0x1c30c9){var _0x556763={};_0x556763['type']=_0x1c30c9[_0x53c2('0x20')];_0x556763['uniqueid']=_0x1c30c9[_0x53c2('0x21')];_0x556763['calleridnum']=_0x1c30c9['calleridnum'];_0x556763[_0x53c2('0x22')]=_0x1c30c9[_0x53c2('0x22')];_0x556763[_0x53c2('0x23')]=_0x1c30c9[_0x53c2('0x23')];_0x556763[_0x53c2('0x24')]=_0x1c30c9[_0x53c2('0x25')];_0x556763[_0x53c2('0x26')]=_0x1c30c9[_0x53c2('0x25')];_0x556763[_0x53c2('0x27')]=0x1;_0x556763[_0x53c2('0x28')]=_0x1c30c9[_0x53c2('0x29')];_0x556763[_0x53c2('0x2a')]=_0x1c30c9[_0x53c2('0x2b')];_0x556763[_0x53c2('0x2c')]='from-sip';_0x556763[_0x53c2('0x2d')]='xcally-motion-preview';_0x556763['holdtime']=0x0;_0x556763['assigned']=0x1;_0x556763[_0x53c2('0x2e')]=_0x1c30c9['membername'];_0x556763[_0x53c2('0x2f')]='COMPLETED';return BPromise[_0x53c2('0xd')]()['then'](voiceQueueReport['create'](_0x556763))[_0x53c2('0x11')](loggerCatch(_0x53c2('0x30')));};exports[_0x53c2('0x31')]=function(_0x52f122,_0x5eccf0){return BPromise[_0x53c2('0xd')]()['then'](cmHopper[_0x53c2('0x31')](_0x52f122,_0x5eccf0))['catch'](loggerCatch(_0x53c2('0x32')));};exports['rescheduleContactInQueue']=function(_0xb76abe){return BPromise[_0x53c2('0xd')]()['then'](cmHopper[_0x53c2('0x1a')](_0xb76abe,!![],!![]))[_0x53c2('0x11')](loggerCatch(_0x53c2('0x33')));}; \ No newline at end of file +var _0x39ff=['lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x39ff,0x1b7));var _0xf39f=function(_0x8616ff,_0x2c6768){_0x8616ff=_0x8616ff-0x0;var _0x530370=_0x39ff[_0x8616ff];return _0x530370;};'use strict';var util=require(_0xf39f('0x0'));var BPromise=require(_0xf39f('0x1'));var logger=require(_0xf39f('0x2'))(_0xf39f('0x3'));var _=require(_0xf39f('0x4'));var cmHopper=require(_0xf39f('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xf39f('0x6'));var cmHopperBlack=require(_0xf39f('0x7'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xf39f('0x8'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x3592c1){return function(_0x35cb33){logger['error'](_0x3592c1,util['inspect'](_0x35cb33,{'showHidden':![],'depth':null}));};}function create(_0x5825b0){return BPromise[_0xf39f('0x9')]()[_0xf39f('0xa')](cmHopperHistory[_0xf39f('0xb')](_0x5825b0))[_0xf39f('0xc')](loggerCatch(_0xf39f('0xd')));}function createAgent(_0x54e673){return BPromise[_0xf39f('0x9')]()[_0xf39f('0xa')](agentReportPreview[_0xf39f('0xb')](_0x54e673))[_0xf39f('0xc')](loggerCatch(_0xf39f('0xd')));}function moveContact(_0x2ec5ff){return BPromise['resolve']()[_0xf39f('0xa')](cmHopper['moveContactManagedDialer'](_0x2ec5ff,!![]))['catch'](loggerCatch(_0xf39f('0xe')));}exports[_0xf39f('0xf')]=function(_0x2e0773){return BPromise[_0xf39f('0x9')]()[_0xf39f('0xa')](cmHopperBlack[_0xf39f('0xf')](_0x2e0773))[_0xf39f('0xc')](loggerCatch(_0xf39f('0x10')));};exports[_0xf39f('0x11')]=function(_0x659849){return BPromise[_0xf39f('0x9')]()[_0xf39f('0xa')](cmHopper[_0xf39f('0x11')](_0x659849))[_0xf39f('0xc')](loggerCatch(_0xf39f('0x12')));};exports[_0xf39f('0xb')]=function(_0x4b49ff,_0xeb890b){create(_0x4b49ff)[_0xf39f('0xc')](loggerCatch(_0xeb890b));moveContact(_0x4b49ff)[_0xf39f('0xc')](loggerCatch(_0xeb890b));};exports[_0xf39f('0x13')]=function(_0x4f1b5c,_0x1d1d2a){createAgent(_0x4f1b5c)['catch'](loggerCatch(_0x1d1d2a));};exports[_0xf39f('0x14')]=function(_0x20453a,_0xb0d92b){create(_0x20453a)[_0xf39f('0xc')](loggerCatch(_0xb0d92b));};exports[_0xf39f('0x15')]=function(_0x140cb4,_0x2d9218){moveContact(_0x140cb4)[_0xf39f('0xc')](loggerCatch(_0x2d9218));};exports[_0xf39f('0x16')]=function(_0x5e9287,_0xe16c01,_0x3f90eb){if(_0xe16c01){_0x5e9287[_0xf39f('0x17')]=null;}if(_0x3f90eb){_0x5e9287[_0xf39f('0x18')]=![];}return BPromise[_0xf39f('0x9')]()[_0xf39f('0xa')](cmHopper[_0xf39f('0x16')](_0x5e9287))[_0xf39f('0xc')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x5e63c1){return BPromise[_0xf39f('0x9')]()[_0xf39f('0xa')](cmHopper['countReScheduled'](_0x5e63c1))[_0xf39f('0xc')](loggerCatch('[countReScheduled]\x20'));};exports[_0xf39f('0x19')]=function(_0x572b80){return BPromise[_0xf39f('0x9')]()[_0xf39f('0xa')](cmHopper[_0xf39f('0x19')]({'UserId':null},_0x572b80,0x1))['catch'](loggerCatch(_0xf39f('0x1a')));};exports['disableContact']=function(_0x50cbde){return BPromise[_0xf39f('0x9')]()['then'](cmHopper[_0xf39f('0x19')]({'active':![]},_0x50cbde,0x1))[_0xf39f('0xc')](loggerCatch(_0xf39f('0x1b')));};exports[_0xf39f('0x1c')]=function(_0x4888c9){var _0xc012f5={};_0xc012f5[_0xf39f('0x1d')]=_0x4888c9['type'];_0xc012f5[_0xf39f('0x1e')]=_0x4888c9[_0xf39f('0x1e')];_0xc012f5['calleridnum']=_0x4888c9[_0xf39f('0x1f')];_0xc012f5[_0xf39f('0x20')]=_0x4888c9['calleridname'];_0xc012f5['queue']=_0x4888c9[_0xf39f('0x21')];_0xc012f5[_0xf39f('0x22')]=_0x4888c9[_0xf39f('0x23')];_0xc012f5[_0xf39f('0x24')]=_0x4888c9['answertime'];_0xc012f5[_0xf39f('0x25')]=0x1;_0xc012f5[_0xf39f('0x26')]=_0x4888c9[_0xf39f('0x27')];_0xc012f5[_0xf39f('0x28')]=_0x4888c9[_0xf39f('0x29')];_0xc012f5[_0xf39f('0x2a')]=_0xf39f('0x2b');_0xc012f5[_0xf39f('0x2c')]=_0xf39f('0x2d');_0xc012f5['holdtime']=0x0;_0xc012f5[_0xf39f('0x2e')]=0x1;_0xc012f5[_0xf39f('0x2f')]=_0x4888c9[_0xf39f('0x29')];_0xc012f5['queuecallerexitreason']=_0xf39f('0x30');return BPromise['resolve']()[_0xf39f('0xa')](voiceQueueReport[_0xf39f('0x31')](_0xc012f5))[_0xf39f('0xc')](loggerCatch(_0xf39f('0x32')));};exports[_0xf39f('0x33')]=function(_0x555ead,_0x4c6532){return BPromise[_0xf39f('0x9')]()[_0xf39f('0xa')](cmHopper['getContactRecallMe'](_0x555ead,_0x4c6532))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xf39f('0x34')]=function(_0x3697a0){return BPromise['resolve']()[_0xf39f('0xa')](cmHopper[_0xf39f('0x16')](_0x3697a0,!![],!![]))[_0xf39f('0xc')](loggerCatch(_0xf39f('0x35')));}; \ 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 6358e41..da9e60c 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 _0x8e7b=['clone','Global','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name','queue','interface','mandatoryDisposition','agentReadyId','not_inuse','push','getDiff','milliseconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','countcongestionretry','countnoanswerretry','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','pow','random','extractCalleridName','match','extractCalleridNumber','util','lodash','moment','preview','env','XCALLY_IP_AGI','127.0.0.1','diff','seconds','loggerCatch','inspect','logger','info','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','createdAt','%s%s','toUpper','toLowerVariables','toLower','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','starttime','responsetime','logAgent','state','ringtime','endtime','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countbusyretry','countagentrejectretry','countnosuchnumberretry','cloneAction'];(function(_0x17daa2,_0x1036b9){var _0x2e7654=function(_0x19f667){while(--_0x19f667){_0x17daa2['push'](_0x17daa2['shift']());}};_0x2e7654(++_0x1036b9);}(_0x8e7b,0xcf));var _0xb8e7=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0x8e7b[_0x1b6186];return _0x186121;};'use strict';var util=require(_0xb8e7('0x0'));var _=require(_0xb8e7('0x1'));var moment=require(_0xb8e7('0x2'));var logger=require('../../../../config/logger')(_0xb8e7('0x3'));var ipAgi=process[_0xb8e7('0x4')][_0xb8e7('0x5')]||_0xb8e7('0x6');function getSeconds(_0x558d63,_0x328b28){var _0x57989e=moment(_0x558d63)['milliseconds'](0x0);var _0xe38b4=moment(_0x328b28)['milliseconds'](0x0);return _0x57989e[_0xb8e7('0x7')](_0xe38b4,_0xb8e7('0x8'));}exports[_0xb8e7('0x9')]=function(_0x5205ec){return function(_0x2abc9f){logger['error'](_0x5205ec,util[_0xb8e7('0xa')](_0x2abc9f,{'showHidden':![],'depth':null}));};};exports[_0xb8e7('0xb')]=function(_0x39eb73,_0x22c413){logger[_0xb8e7('0xc')](_0x39eb73,util[_0xb8e7('0xa')](_0x22c413,{'showHidden':![],'depth':null}));};exports[_0xb8e7('0xd')]=function(_0x3f56fa,_0x2be20b){logger['error'](_0x3f56fa,util[_0xb8e7('0xa')](_0x2be20b,{'showHidden':![],'depth':null}));};exports[_0xb8e7('0xe')]=function(_0x35ad6a){return function(_0x11c4e7){logger[_0xb8e7('0xc')](_0x35ad6a,util[_0xb8e7('0xa')](_0x11c4e7,{'showHidden':![],'depth':null}));};};exports[_0xb8e7('0xf')]=function(_0x4767e6,_0x95e8f3,_0x4cbf6d){return{'message':_0x4767e6,'unlock':_0x95e8f3,'active':_0x4cbf6d};};exports['getCallerId']=function(_0x533410,_0x3584bb,_0x6f0d80){if(!_[_0xb8e7('0x10')](_0x6f0d80)&&'string'===typeof _0x6f0d80&&!_['isEmpty'](_0x6f0d80)){if(!_['isUndefined'](_0x3584bb)&&_0xb8e7('0x11')===typeof _0x3584bb&&!_[_0xb8e7('0x12')](_0x3584bb)){return util[_0xb8e7('0x13')](_0xb8e7('0x14'),_0x3584bb,_0x6f0d80);}return util[_0xb8e7('0x13')](_0xb8e7('0x14'),_0x6f0d80,_0x6f0d80);}if(!_['isUndefined'](_0x533410)&&'string'===typeof _0x533410&&!_[_0xb8e7('0x12')](_0x533410)){return _0x533410;}return _0xb8e7('0x15');};exports[_0xb8e7('0x16')]=function(_0x498180){if(_[_0xb8e7('0x17')](_0x498180)){return![];}return _0x498180;};exports['addVariables']=function(_0x55e111,_0x2310a1,_0x30864b,_0x54e9ab,_0x37135f,_0xc872de){var _0x5663c7={'XMD-QUEUE':_0x2310a1[_0xb8e7('0x18')]?_0x2310a1[_0xb8e7('0x18')]['name']:'','XMD-CALLERID':_0x54e9ab,'XMD-CALLERID-PREVIEW':_0xc872de?util[_0xb8e7('0x13')](_0xb8e7('0x14'),_0xc872de[_0xb8e7('0x19')],_0xc872de['calleridnum']):_0x54e9ab,'XMD-DIALID':_0x37135f,'XMD-CONTACTID':_0x2310a1[_0xb8e7('0x1a')],'XMD-CDRTYPE':_0xb8e7('0x1b'),'CALLERID(all)':_0x54e9ab,'XMD-VOICEQUEUEID':_0x2310a1[_0xb8e7('0x1c')],'XMD-DIALCHANNEL':_0x30864b,'XMD-DIALTIMEOUT':_0x55e111[_0xb8e7('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format']('\x22rtTxX%s%s\x22',_0x55e111['dialQueueProject2']?'g':'',_['isEmpty'](_0x55e111[_0xb8e7('0x1e')])?'':_0xb8e7('0x1f')),'XMD-DIALURL':_0x55e111[_0xb8e7('0x20')]||'','XMD-AGI':_0x55e111[_0xb8e7('0x21')]?util[_0xb8e7('0x13')](_0xb8e7('0x22'),ipAgi,_0x55e111[_0xb8e7('0x21')]):_0xb8e7('0x23'),'XMD-AGIAFTER':_0x55e111[_0xb8e7('0x24')]?util[_0xb8e7('0x13')](_0xb8e7('0x22'),ipAgi,_0x55e111[_0xb8e7('0x24')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0xc872de?_0xc872de[_0xb8e7('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0xc872de?_0xc872de[_0xb8e7('0x26')]:'','XMD-DESTINATION':_0xb8e7('0x27')};if(!_[_0xb8e7('0x12')](_0x55e111['monitor_format'])){_0x5663c7[util[_0xb8e7('0x13')]('%s',_0xb8e7('0x28'))]=_0x55e111[_0xb8e7('0x1e')];_0x5663c7[util['format']('%s',_0xb8e7('0x29'))]=_0x37135f;}if(_0x2310a1&&_0x2310a1[_0xb8e7('0x2a')]){for(var _0x41ab19 in _0x2310a1[_0xb8e7('0x2a')]){if(_0x2310a1[_0xb8e7('0x2a')][_0xb8e7('0x2b')](_0x41ab19)){if(!_[_0xb8e7('0x17')](_0x2310a1[_0xb8e7('0x2a')][_0x41ab19])&&_0x41ab19!=='id'&&_0x41ab19!=='tags'&&_0x41ab19!==_0xb8e7('0x2c')&&_0x41ab19!=='updatedAt'){_0x5663c7[util[_0xb8e7('0x13')](_0xb8e7('0x2d'),'XMD-',_[_0xb8e7('0x2e')](_0x41ab19))]=_0x2310a1['Contact'][_0x41ab19];}}}}return _0x5663c7;};exports[_0xb8e7('0x2f')]=function(_0x1837cd){var _0x207688={};for(var _0x4ee2d6 in _0x1837cd){if(_0x1837cd[_0xb8e7('0x2b')](_0x4ee2d6)){_0x207688[util[_0xb8e7('0x13')]('%s',_[_0xb8e7('0x30')](_0x4ee2d6))]=_0x1837cd[_0x4ee2d6];}}return{'variables':_0x207688};};exports['updateOriginated']=function(_0x5d97a1,_0x4d4334){if(!_[_0xb8e7('0x17')](_0x5d97a1)){if(_0x5d97a1[_0xb8e7('0x2b')](_0xb8e7('0x31'))){if(_0x5d97a1[_0xb8e7('0x31')]>0x0){_0x5d97a1[_0xb8e7('0x31')]-=0x1;}else{logger[_0xb8e7('0x32')](_0xb8e7('0x33'),_0x4d4334);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x4d4334);}};exports[_0xb8e7('0x34')]=function(_0x116e78){var _0x559b2b=moment()[_0xb8e7('0x13')](_0xb8e7('0x35'));_0x116e78['state']=0xd;_0x116e78[_0xb8e7('0x36')]=_0xb8e7('0x37');_0x116e78[_0xb8e7('0x38')]=_0x559b2b;_0x116e78[_0xb8e7('0x39')]=_0x559b2b;_0x116e78['endtime']=_0x559b2b;};exports[_0xb8e7('0x3a')]=function(_0x21b02e,_0x35f486,_0x236108){var _0x78834f=moment()[_0xb8e7('0x13')](_0xb8e7('0x35'));_0x21b02e[_0xb8e7('0x3b')]=_0x35f486;_0x21b02e[_0xb8e7('0x36')]=_0x236108;_0x21b02e[_0xb8e7('0x39')]=_0x78834f;_0x21b02e[_0xb8e7('0x3c')]=getSeconds(_0x21b02e['responsetime'],_0x21b02e[_0xb8e7('0x38')]);};exports['logLookAgent']=function(_0x36d69b,_0x195456,_0x521763){_0x36d69b['membername']=_0x195456;_0x36d69b['UserId']=_0x521763;};exports['logCustomer']=function(_0x195fab,_0x30f60c,_0x4e68d6){var _0x352b8a=moment()[_0xb8e7('0x13')](_0xb8e7('0x35'));_0x195fab[_0xb8e7('0x3b')]=_0x30f60c;_0x195fab[_0xb8e7('0x36')]=_0x4e68d6;_0x195fab[_0xb8e7('0x39')]=_0x195fab[_0xb8e7('0x39')]?_0x195fab[_0xb8e7('0x39')]:_0x352b8a;_0x195fab[_0xb8e7('0x3d')]=_0x195fab[_0xb8e7('0x3d')]?_0x195fab['endtime']:_0x352b8a;_0x195fab['ringtime']=getSeconds(_0x195fab[_0xb8e7('0x39')]||0x0,_0x195fab[_0xb8e7('0x38')]||0x0);_0x195fab[_0xb8e7('0x3e')]=_0x195fab['answertime']?getSeconds(_0x195fab[_0xb8e7('0x3d')],_0x195fab[_0xb8e7('0x3f')]):0x0;};exports[_0xb8e7('0x40')]=function(_0x434916){return _0x434916===_0xb8e7('0x41');};exports['variablesAction']=function(_0x5abb4a,_0xc37f6,_0x4f70e3,_0x4bc5e1,_0x112e05){var _0x2cf8bc=_0x4bc5e1?_0xb8e7('0x42'):_0x5abb4a[_0xb8e7('0x19')];_0x2cf8bc=_0x112e05?_0xb8e7('0x43'):_0x2cf8bc;return{'actionid':_0x5abb4a[_0xb8e7('0x44')],'action':_0xb8e7('0x45'),'channel':_0x5abb4a[_0xb8e7('0x46')],'callerid':util[_0xb8e7('0x13')](_0xb8e7('0x14'),_0x2cf8bc,_0x5abb4a['calleridnum']),'Exten':_0xb8e7('0x27'),'Context':'from-sip','Priority':'1','variable':_0x4f70e3,'timeout':(_0xc37f6[_0xb8e7('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5abb4a['uniqueid']};};exports[_0xb8e7('0x48')]=function(_0x1f9882){return _0x1f9882[_0xb8e7('0x49')]+_0x1f9882['countcongestionretry']+_0x1f9882['countnoanswerretry']+_0x1f9882[_0xb8e7('0x4a')]+_0x1f9882[_0xb8e7('0x4b')];};exports[_0xb8e7('0x4c')]=function(_0x40a2f1){var _0x2ca7a4=_[_0xb8e7('0x4d')](_0x40a2f1);_0x2ca7a4['state']=0xf;_0x2ca7a4[_0xb8e7('0x36')]=_0xb8e7('0x4e');return _0x2ca7a4;};exports['scheduledAt']=function(_0x3e14f6,_0x469473,_0x2ae853){var _0x181195={};_0x181195[_0x469473]=_0x3e14f6[_0x469473];_0x181195[_0xb8e7('0x4f')]=![];_0x181195[_0xb8e7('0x50')]=moment()[_0xb8e7('0x51')](_0x2ae853,'minutes')['format'](_0xb8e7('0x35'));_0x181195[_0xb8e7('0x1a')]=_0x3e14f6[_0xb8e7('0x1a')];_0x181195[_0xb8e7('0x52')]=_0x3e14f6[_0xb8e7('0x52')];_0x181195['VoiceQueueId']=_0x3e14f6[_0xb8e7('0x1c')]||undefined;return _0x181195;};exports[_0xb8e7('0x53')]=function(_0x55ae7a,_0x201e88){if(!_[_0xb8e7('0x17')](_0x55ae7a)){if(_0x55ae7a[_0xb8e7('0x54')]>0x0){_0x55ae7a['pTalking']-=0x1;}else{logger[_0xb8e7('0x32')](_0x201e88,_0xb8e7('0x55'));}}else{logger['error'](_0x201e88,_0xb8e7('0x56'));}};exports[_0xb8e7('0x57')]=function(_0x2e317a){if(_0x2e317a<=0x0){return!![];}return![];};exports[_0xb8e7('0x58')]=function(_0x18834e,_0x1e38b7,_0x35986d){_0x18834e[_0xb8e7('0x59')]=_0x1e38b7;_0x18834e[_0xb8e7('0x5a')]=_0x18834e[_0xb8e7('0x5b')];_0x18834e[_0xb8e7('0x5c')]=_0x18834e[_0xb8e7('0x46')];if(_0x35986d){_0x18834e[_0xb8e7('0x5d')]=_0x35986d[_0xb8e7('0x5d')];}return _0x18834e;};exports['buildAcw']=function(_0x5f4f40){var _0x5006da={};_0x5006da[_0xb8e7('0x5b')]=_0x5f4f40['queue'];_0x5006da[_0xb8e7('0x5c')]=_0x5f4f40['channelAgent'];_0x5006da[_0xb8e7('0x44')]=_0x5f4f40[_0xb8e7('0x44')];return _0x5006da;};exports[_0xb8e7('0x5e')]=function(_0x295890){var _0x471bee=[];for(var _0x1b6100 in _0x295890){if(_0x295890['hasOwnProperty'](_0x1b6100)){if(!_[_0xb8e7('0x17')](_0x295890[_0x1b6100])&&_0x295890[_0x1b6100]['state']===_0xb8e7('0x5f')&&_0x295890[_0x1b6100]['status']==='reachable'){_0x471bee[_0xb8e7('0x60')](_0x295890[_0x1b6100]['id']);}}}return _0x471bee;};exports[_0xb8e7('0x61')]=function(_0x269584){var _0x1acbf8=moment()['milliseconds'](0x0);var _0x5b5e6b=moment(_0x269584)[_0xb8e7('0x62')](0x0);return _0x1acbf8[_0xb8e7('0x7')](_0x5b5e6b,_0xb8e7('0x8'));};exports[_0xb8e7('0x63')]=function(_0x211633){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x211633[_0xb8e7('0x1a')],'ListId':_0x211633['ListId'],'VoiceQueueId':_0x211633[_0xb8e7('0x1c')]||undefined,'CampaignId':_0x211633[_0xb8e7('0x64')]||undefined};};exports[_0xb8e7('0x65')]=function(_0xb954c2){if(_0xb954c2===_0xb8e7('0x44')||_0xb954c2===_0xb8e7('0x66')||_0xb954c2===_0xb8e7('0x5b')||_0xb954c2===_0xb8e7('0x67')||_0xb954c2===_0xb8e7('0x68')||_0xb954c2===_0xb8e7('0x69')||_0xb954c2===_0xb8e7('0x6a')||_0xb954c2===_0xb8e7('0x46')||_0xb954c2==='calleridname'||_0xb954c2===_0xb8e7('0x4f')||_0xb954c2==='calleridnum'||_0xb954c2===_0xb8e7('0x50')||_0xb954c2===_0xb8e7('0x49')||_0xb954c2===_0xb8e7('0x6b')||_0xb954c2===_0xb8e7('0x6c')||_0xb954c2==='countglobal'||_0xb954c2==='callback'||_0xb954c2===_0xb8e7('0x6d')||_0xb954c2===_0xb8e7('0x6e')||_0xb954c2===_0xb8e7('0x6f')||_0xb954c2==='ContactId'||_0xb954c2==='ListId'||_0xb954c2===_0xb8e7('0x70')||_0xb954c2===_0xb8e7('0x1c')||_0xb954c2===_0xb8e7('0x71')||_0xb954c2===_0xb8e7('0x72')||_0xb954c2===_0xb8e7('0x73')||_0xb954c2===_0xb8e7('0x74')||_0xb954c2===_0xb8e7('0x75')||_0xb954c2==='xmd-dialurl'||_0xb954c2===_0xb8e7('0x76')||_0xb954c2===_0xb8e7('0x77')||_0xb954c2===_0xb8e7('0x78')||_0xb954c2===_0xb8e7('0x79')||_0xb954c2==='xmd-contactid'||_0xb954c2===_0xb8e7('0x7a')||_0xb954c2===_0xb8e7('0x7b')||_0xb954c2===_0xb8e7('0x7c')||_0xb954c2===_0xb8e7('0x7d')||_0xb954c2==='rtpaudioqos'||_0xb954c2==='rtpaudioqosbridged'||_0xb954c2==='rtpaudioqosjitter'||_0xb954c2===_0xb8e7('0x7e')||_0xb954c2==='rtpaudioqosloss'||_0xb954c2===_0xb8e7('0x7f')||_0xb954c2===_0xb8e7('0x80')||_0xb954c2===_0xb8e7('0x81')||_0xb954c2===_0xb8e7('0x82')||_0xb954c2===_0xb8e7('0x83')||_0xb954c2===_0xb8e7('0x84')||_0xb954c2==='rtpaudioqosjitterbridged'||_0xb954c2===_0xb8e7('0x85')||_0xb954c2===_0xb8e7('0x7f')||_0xb954c2===_0xb8e7('0x80')||_0xb954c2===_0xb8e7('0x81')||_0xb954c2===_0xb8e7('0x86')||_0xb954c2===_0xb8e7('0x87')||_0xb954c2===_0xb8e7('0x3b')||_0xb954c2==='statedesc'){return![];}return!![];};exports[_0xb8e7('0x88')]=function(_0x276c95,_0x416cbc){var _0x3d0896,_0x452f54,_0x1831d8;if(_0x416cbc<=0x0){_0x416cbc=0x1;}_0x3d0896=new RegExp('\x5cw{0,'+_0x416cbc+'}$');_0x452f54=Math[_0xb8e7('0x89')](0xa,_0x416cbc-0x1);_0x1831d8=Math[_0xb8e7('0x89')](0xa,_0x416cbc)-0x1;return util[_0xb8e7('0x13')]('%s',_['replace'](_0x276c95,_0x3d0896,_[_0xb8e7('0x8a')](_0x452f54,_0x1831d8)));};exports[_0xb8e7('0x8b')]=function(_0x3ab917){var _0x2449b1=_0x3ab917[_0xb8e7('0x8c')](/"(.*?)"/);return _0x2449b1?_0x2449b1[0x1]:_0x3ab917;};exports[_0xb8e7('0x8d')]=function(_0x839b64){var _0x4ff306=_0x839b64['match'](/<(.*?)>/);return _0x4ff306?_0x4ff306[0x1]:_0x839b64;}; \ No newline at end of file +var _0x15b7=['ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','%s%s','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','state','statedesc','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','logLookAgent','membername','UserId','logCustomer','endtime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','buildObj','queue','interface','mandatoryDisposition','buildAcw','not_inuse','status','push','getDiff','diff','idContact','type','countglobal','callback','callbackat','recallme','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqos','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridNumber','match','util','lodash','../../../../config/logger','env','milliseconds','seconds','loggerCatch','error','logger','info','inspect','loggerError','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','calleridnum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x15b7,0xf3));var _0x715b=function(_0x5d48bf,_0x50d7ad){_0x5d48bf=_0x5d48bf-0x0;var _0x311ab2=_0x15b7[_0x5d48bf];return _0x311ab2;};'use strict';var util=require(_0x715b('0x0'));var _=require(_0x715b('0x1'));var moment=require('moment');var logger=require(_0x715b('0x2'))('preview');var ipAgi=process[_0x715b('0x3')]['XCALLY_IP_AGI']||'127.0.0.1';function getSeconds(_0x5c897d,_0x5e32d3){var _0x20598c=moment(_0x5c897d)[_0x715b('0x4')](0x0);var _0x375472=moment(_0x5e32d3)['milliseconds'](0x0);return _0x20598c['diff'](_0x375472,_0x715b('0x5'));}exports[_0x715b('0x6')]=function(_0x26ec7d){return function(_0x148feb){logger[_0x715b('0x7')](_0x26ec7d,util['inspect'](_0x148feb,{'showHidden':![],'depth':null}));};};exports[_0x715b('0x8')]=function(_0x8f9672,_0x1851ab){logger[_0x715b('0x9')](_0x8f9672,util[_0x715b('0xa')](_0x1851ab,{'showHidden':![],'depth':null}));};exports[_0x715b('0xb')]=function(_0x2ba8be,_0x2d7e1d){logger[_0x715b('0x7')](_0x2ba8be,util['inspect'](_0x2d7e1d,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x4489fc){return function(_0xfdd2a5){logger['info'](_0x4489fc,util[_0x715b('0xa')](_0xfdd2a5,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x24071a,_0x2eac71,_0x3cb6e5){return{'message':_0x24071a,'unlock':_0x2eac71,'active':_0x3cb6e5};};exports[_0x715b('0xc')]=function(_0x467fa9,_0x401fe3,_0x54330f){if(!_['isUndefined'](_0x54330f)&&'string'===typeof _0x54330f&&!_[_0x715b('0xd')](_0x54330f)){if(!_[_0x715b('0xe')](_0x401fe3)&&_0x715b('0xf')===typeof _0x401fe3&&!_['isEmpty'](_0x401fe3)){return util[_0x715b('0x10')](_0x715b('0x11'),_0x401fe3,_0x54330f);}return util[_0x715b('0x10')](_0x715b('0x11'),_0x54330f,_0x54330f);}if(!_['isUndefined'](_0x467fa9)&&_0x715b('0xf')===typeof _0x467fa9&&!_['isEmpty'](_0x467fa9)){return _0x467fa9;}return _0x715b('0x12');};exports[_0x715b('0x13')]=function(_0x81e6f9){if(_[_0x715b('0x14')](_0x81e6f9)){return![];}return _0x81e6f9;};exports['addVariables']=function(_0x54ef47,_0x2be397,_0x542bce,_0x2b7741,_0x1d3bb6,_0x3933ca){var _0x3f201a={'XMD-QUEUE':_0x2be397[_0x715b('0x15')]?_0x2be397['Queue'][_0x715b('0x16')]:'','XMD-CALLERID':_0x2b7741,'XMD-CALLERID-PREVIEW':_0x3933ca?util[_0x715b('0x10')](_0x715b('0x11'),_0x3933ca[_0x715b('0x17')],_0x3933ca[_0x715b('0x18')]):_0x2b7741,'XMD-DIALID':_0x1d3bb6,'XMD-CONTACTID':_0x2be397[_0x715b('0x19')],'XMD-CDRTYPE':_0x715b('0x1a'),'CALLERID(all)':_0x2b7741,'XMD-VOICEQUEUEID':_0x2be397['VoiceQueueId'],'XMD-DIALCHANNEL':_0x542bce,'XMD-DIALTIMEOUT':_0x54ef47[_0x715b('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x715b('0x10')](_0x715b('0x1c'),_0x54ef47['dialQueueProject2']?'g':'',_[_0x715b('0xd')](_0x54ef47[_0x715b('0x1d')])?'':_0x715b('0x1e')),'XMD-DIALURL':_0x54ef47[_0x715b('0x1f')]||'','XMD-AGI':_0x54ef47[_0x715b('0x20')]?util['format'](_0x715b('0x21'),ipAgi,_0x54ef47[_0x715b('0x20')]):_0x715b('0x22'),'XMD-AGIAFTER':_0x54ef47[_0x715b('0x23')]?util['format'](_0x715b('0x21'),ipAgi,_0x54ef47[_0x715b('0x23')]):_0x715b('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x3933ca?_0x3933ca[_0x715b('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x3933ca?_0x3933ca['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0x54ef47[_0x715b('0x1d')])){_0x3f201a[util[_0x715b('0x10')]('%s',_0x715b('0x25'))]=_0x54ef47[_0x715b('0x1d')];_0x3f201a[util[_0x715b('0x10')]('%s',_0x715b('0x26'))]=_0x1d3bb6;}if(_0x2be397&&_0x2be397['Contact']){for(var _0x55ee2d in _0x2be397['Contact']){if(_0x2be397[_0x715b('0x27')][_0x715b('0x28')](_0x55ee2d)){if(!_[_0x715b('0x14')](_0x2be397[_0x715b('0x27')][_0x55ee2d])&&_0x55ee2d!=='id'&&_0x55ee2d!=='tags'&&_0x55ee2d!=='createdAt'&&_0x55ee2d!=='updatedAt'){_0x3f201a[util['format'](_0x715b('0x29'),_0x715b('0x2a'),_[_0x715b('0x2b')](_0x55ee2d))]=_0x2be397[_0x715b('0x27')][_0x55ee2d];}}}}return _0x3f201a;};exports['toLowerVariables']=function(_0x58cc73){var _0x75ddb8={};for(var _0xe4d7ae in _0x58cc73){if(_0x58cc73['hasOwnProperty'](_0xe4d7ae)){_0x75ddb8[util[_0x715b('0x10')]('%s',_[_0x715b('0x2c')](_0xe4d7ae))]=_0x58cc73[_0xe4d7ae];}}return{'variables':_0x75ddb8};};exports[_0x715b('0x2d')]=function(_0x117f23,_0x2202b3){if(!_[_0x715b('0x14')](_0x117f23)){if(_0x117f23[_0x715b('0x28')](_0x715b('0x2e'))){if(_0x117f23[_0x715b('0x2e')]>0x0){_0x117f23[_0x715b('0x2e')]-=0x1;}else{logger[_0x715b('0x7')](_0x715b('0x2f'),_0x2202b3);}}}else{logger[_0x715b('0x7')](_0x715b('0x30'),_0x2202b3);}};exports[_0x715b('0x31')]=function(_0x5d9de8){var _0x3f8c09=moment()[_0x715b('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x5d9de8[_0x715b('0x32')]=0xd;_0x5d9de8[_0x715b('0x33')]=_0x715b('0x34');_0x5d9de8[_0x715b('0x35')]=_0x3f8c09;_0x5d9de8[_0x715b('0x36')]=_0x3f8c09;_0x5d9de8['endtime']=_0x3f8c09;};exports[_0x715b('0x37')]=function(_0x19419c,_0x53a01c,_0x14f8a0){var _0x8ae1c5=moment()[_0x715b('0x10')](_0x715b('0x38'));_0x19419c[_0x715b('0x32')]=_0x53a01c;_0x19419c['statedesc']=_0x14f8a0;_0x19419c[_0x715b('0x36')]=_0x8ae1c5;_0x19419c[_0x715b('0x39')]=getSeconds(_0x19419c[_0x715b('0x36')],_0x19419c[_0x715b('0x35')]);};exports[_0x715b('0x3a')]=function(_0x4a0063,_0x1cca8c,_0x5abd3c){_0x4a0063[_0x715b('0x3b')]=_0x1cca8c;_0x4a0063[_0x715b('0x3c')]=_0x5abd3c;};exports[_0x715b('0x3d')]=function(_0x5c74d9,_0x3343d4,_0x25f96f){var _0x24fdd=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5c74d9[_0x715b('0x32')]=_0x3343d4;_0x5c74d9[_0x715b('0x33')]=_0x25f96f;_0x5c74d9['responsetime']=_0x5c74d9['responsetime']?_0x5c74d9['responsetime']:_0x24fdd;_0x5c74d9[_0x715b('0x3e')]=_0x5c74d9[_0x715b('0x3e')]?_0x5c74d9['endtime']:_0x24fdd;_0x5c74d9['ringtime']=getSeconds(_0x5c74d9[_0x715b('0x36')]||0x0,_0x5c74d9[_0x715b('0x35')]||0x0);_0x5c74d9['talktime']=_0x5c74d9[_0x715b('0x3f')]?getSeconds(_0x5c74d9[_0x715b('0x3e')],_0x5c74d9[_0x715b('0x3f')]):0x0;};exports[_0x715b('0x40')]=function(_0x188e8f){return _0x188e8f===_0x715b('0x41');};exports[_0x715b('0x42')]=function(_0x28e8d3,_0x533e8f,_0x9aa1a0,_0x3879de,_0x3803a0){var _0x152f26=_0x3879de?_0x715b('0x43'):_0x28e8d3[_0x715b('0x17')];_0x152f26=_0x3803a0?_0x715b('0x44'):_0x152f26;return{'actionid':_0x28e8d3[_0x715b('0x45')],'action':_0x715b('0x46'),'channel':_0x28e8d3[_0x715b('0x47')],'callerid':util[_0x715b('0x10')](_0x715b('0x11'),_0x152f26,_0x28e8d3['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x715b('0x48'),'Priority':'1','variable':_0x9aa1a0,'timeout':(_0x533e8f[_0x715b('0x49')]||0x1e)*0x3e8,'async':!![],'channelid':_0x28e8d3[_0x715b('0x45')]};};exports[_0x715b('0x4a')]=function(_0x2dc88a){return _0x2dc88a[_0x715b('0x4b')]+_0x2dc88a[_0x715b('0x4c')]+_0x2dc88a[_0x715b('0x4d')]+_0x2dc88a[_0x715b('0x4e')]+_0x2dc88a['countnosuchnumberretry'];};exports[_0x715b('0x4f')]=function(_0x2426aa){var _0x1bc95c=_[_0x715b('0x50')](_0x2426aa);_0x1bc95c[_0x715b('0x32')]=0xf;_0x1bc95c['statedesc']=_0x715b('0x51');return _0x1bc95c;};exports[_0x715b('0x52')]=function(_0x18d607,_0x389ca4,_0x15413c){var _0x5e0b9f={};_0x5e0b9f[_0x389ca4]=_0x18d607[_0x389ca4];_0x5e0b9f[_0x715b('0x53')]=![];_0x5e0b9f[_0x715b('0x54')]=moment()[_0x715b('0x55')](_0x15413c,_0x715b('0x56'))['format'](_0x715b('0x38'));_0x5e0b9f['ContactId']=_0x18d607[_0x715b('0x19')];_0x5e0b9f[_0x715b('0x57')]=_0x18d607['ListId'];_0x5e0b9f[_0x715b('0x58')]=_0x18d607[_0x715b('0x58')]||undefined;return _0x5e0b9f;};exports[_0x715b('0x59')]=function(_0xc14e85,_0x165a4e){if(!_['isNil'](_0xc14e85)){if(_0xc14e85[_0x715b('0x5a')]>0x0){_0xc14e85[_0x715b('0x5a')]-=0x1;}else{logger[_0x715b('0x7')](_0x165a4e,_0x715b('0x5b'));}}else{logger[_0x715b('0x7')](_0x165a4e,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x715b('0x5c')]=function(_0x4fae65){if(_0x4fae65<=0x0){return!![];}return![];};exports[_0x715b('0x5d')]=function(_0xb1f437,_0x1134ae,_0x5cc3f7){_0xb1f437['lastevent']=_0x1134ae;_0xb1f437['name']=_0xb1f437[_0x715b('0x5e')];_0xb1f437[_0x715b('0x5f')]=_0xb1f437[_0x715b('0x47')];if(_0x5cc3f7){_0xb1f437[_0x715b('0x60')]=_0x5cc3f7['mandatoryDisposition'];}return _0xb1f437;};exports[_0x715b('0x61')]=function(_0x1cba9b){var _0x140076={};_0x140076[_0x715b('0x5e')]=_0x1cba9b[_0x715b('0x5e')];_0x140076[_0x715b('0x5f')]=_0x1cba9b[_0x715b('0x47')];_0x140076[_0x715b('0x45')]=_0x1cba9b[_0x715b('0x45')];return _0x140076;};exports['agentReadyId']=function(_0x24772a){var _0x3d5750=[];for(var _0x7f42e9 in _0x24772a){if(_0x24772a[_0x715b('0x28')](_0x7f42e9)){if(!_[_0x715b('0x14')](_0x24772a[_0x7f42e9])&&_0x24772a[_0x7f42e9]['state']===_0x715b('0x62')&&_0x24772a[_0x7f42e9][_0x715b('0x63')]==='reachable'){_0x3d5750[_0x715b('0x64')](_0x24772a[_0x7f42e9]['id']);}}}return _0x3d5750;};exports[_0x715b('0x65')]=function(_0x9c3bd3){var _0xfc2293=moment()[_0x715b('0x4')](0x0);var _0x4b301c=moment(_0x9c3bd3)[_0x715b('0x4')](0x0);return _0xfc2293[_0x715b('0x66')](_0x4b301c,_0x715b('0x5'));};exports['createBody']=function(_0x54b66c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x54b66c['ContactId'],'ListId':_0x54b66c['ListId'],'VoiceQueueId':_0x54b66c[_0x715b('0x58')]||undefined,'CampaignId':_0x54b66c['CampaignId']||undefined};};exports['filterKey']=function(_0xe5ff05){if(_0xe5ff05===_0x715b('0x45')||_0xe5ff05===_0x715b('0x67')||_0xe5ff05==='queue'||_0xe5ff05===_0x715b('0x68')||_0xe5ff05==='campaigntype'||_0xe5ff05==='dialAnswer'||_0xe5ff05===_0x715b('0x3b')||_0xe5ff05===_0x715b('0x47')||_0xe5ff05===_0x715b('0x17')||_0xe5ff05==='active'||_0xe5ff05===_0x715b('0x18')||_0xe5ff05===_0x715b('0x54')||_0xe5ff05===_0x715b('0x4b')||_0xe5ff05===_0x715b('0x4c')||_0xe5ff05===_0x715b('0x4d')||_0xe5ff05===_0x715b('0x69')||_0xe5ff05===_0x715b('0x6a')||_0xe5ff05==='callbackuniqueid'||_0xe5ff05===_0x715b('0x6b')||_0xe5ff05===_0x715b('0x6c')||_0xe5ff05===_0x715b('0x19')||_0xe5ff05===_0x715b('0x57')||_0xe5ff05===_0x715b('0x3c')||_0xe5ff05===_0x715b('0x58')||_0xe5ff05==='sipcallid'||_0xe5ff05===_0x715b('0x6d')||_0xe5ff05===_0x715b('0x6e')||_0xe5ff05===_0x715b('0x6f')||_0xe5ff05===_0x715b('0x70')||_0xe5ff05===_0x715b('0x71')||_0xe5ff05===_0x715b('0x72')||_0xe5ff05==='xmd-dialoptions'||_0xe5ff05===_0x715b('0x73')||_0xe5ff05===_0x715b('0x74')||_0xe5ff05===_0x715b('0x75')||_0xe5ff05===_0x715b('0x76')||_0xe5ff05===_0x715b('0x77')||_0xe5ff05==='xmd-agiafter'||_0xe5ff05===_0x715b('0x78')||_0xe5ff05==='rtpaudioqos'||_0xe5ff05==='rtpaudioqosbridged'||_0xe5ff05===_0x715b('0x79')||_0xe5ff05===_0x715b('0x7a')||_0xe5ff05==='rtpaudioqosloss'||_0xe5ff05===_0x715b('0x7b')||_0xe5ff05==='rtpaudioqosrtt'||_0xe5ff05==='rtpaudioqosrttbridged'||_0xe5ff05===_0x715b('0x7c')||_0xe5ff05==='rtpaudioqosbridged'||_0xe5ff05===_0x715b('0x79')||_0xe5ff05===_0x715b('0x7a')||_0xe5ff05==='rtpaudioqosloss'||_0xe5ff05===_0x715b('0x7b')||_0xe5ff05==='rtpaudioqosrtt'||_0xe5ff05===_0x715b('0x7d')||_0xe5ff05==='bridgepeer'||_0xe5ff05===_0x715b('0x7e')||_0xe5ff05===_0x715b('0x32')||_0xe5ff05==='statedesc'){return![];}return!![];};exports[_0x715b('0x7f')]=function(_0x2616bb,_0x2234f1){var _0x1e173f,_0x174271,_0x4a6dd4;if(_0x2234f1<=0x0){_0x2234f1=0x1;}_0x1e173f=new RegExp(_0x715b('0x80')+_0x2234f1+'}$');_0x174271=Math[_0x715b('0x81')](0xa,_0x2234f1-0x1);_0x4a6dd4=Math[_0x715b('0x81')](0xa,_0x2234f1)-0x1;return util[_0x715b('0x10')]('%s',_[_0x715b('0x82')](_0x2616bb,_0x1e173f,_[_0x715b('0x83')](_0x174271,_0x4a6dd4)));};exports['extractCalleridName']=function(_0x3407cf){var _0x2ad9a6=_0x3407cf['match'](/"(.*?)"/);return _0x2ad9a6?_0x2ad9a6[0x1]:_0x3407cf;};exports[_0x715b('0x84')]=function(_0xbfed62){var _0x2c26c9=_0xbfed62[_0x715b('0x85')](/<(.*?)>/);return _0x2c26c9?_0x2c26c9[0x1]:_0xbfed62;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index d53e1d9..addf73a 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 _0x785b=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queueremove','queuepause'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x785b,0x18b));var _0xb785=function(_0x4d5175,_0x1c69ed){_0x4d5175=_0x4d5175-0x0;var _0x3b4aa3=_0x785b[_0x4d5175];return _0x3b4aa3;};'use strict';exports['queueadd']={'queue':{'type':_0xb785('0x0'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xb785('0x1'),'required':![]},'paused':{'type':_0xb785('0x2'),'required':![]}};exports[_0xb785('0x3')]={'queue':{'type':_0xb785('0x0'),'required':!![]},'interface':{'type':_0xb785('0x0'),'required':!![]}};exports[_0xb785('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xb785('0x2')},'reason':{'type':_0xb785('0x0'),'required':![]}};exports[_0xb785('0x5')]={'module':{'type':_0xb785('0x0'),'required':![]}};exports[_0xb785('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xb785('0x7')]={'uniqueid':{'type':_0xb785('0x0'),'required':!![]},'filename':{'type':_0xb785('0x0')},'format':{'type':_0xb785('0x0')},'mixmonitorid':{'type':'string'}};exports[_0xb785('0x8')]={'uniqueid':{'type':_0xb785('0x0'),'required':!![]}};exports[_0xb785('0x9')]={'uniqueid':{'type':_0xb785('0x0'),'required':!![]},'exten':{'type':_0xb785('0x0'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x3427=['queueadd','string','number','boolean','queueremove','queuepause','voicequeuechannelhangup'];(function(_0x2ac125,_0x3abddb){var _0x13de41=function(_0x373ac0){while(--_0x373ac0){_0x2ac125['push'](_0x2ac125['shift']());}};_0x13de41(++_0x3abddb);}(_0x3427,0x1ea));var _0x7342=function(_0x5d2480,_0x7e6e83){_0x5d2480=_0x5d2480-0x0;var _0x30d258=_0x3427[_0x5d2480];return _0x30d258;};'use strict';exports[_0x7342('0x0')]={'queue':{'type':_0x7342('0x1'),'required':!![]},'interface':{'type':_0x7342('0x1'),'required':!![]},'membername':{'type':_0x7342('0x1'),'required':!![]},'penalty':{'type':_0x7342('0x2'),'required':![]},'paused':{'type':_0x7342('0x3'),'required':![]}};exports[_0x7342('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x7342('0x1'),'required':!![]}};exports[_0x7342('0x5')]={'interface':{'type':_0x7342('0x1'),'required':!![]},'paused':{'type':_0x7342('0x3')},'reason':{'type':_0x7342('0x1'),'required':![]}};exports['reload']={'module':{'type':_0x7342('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x7342('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x7342('0x1'),'required':!![]},'filename':{'type':_0x7342('0x1')},'format':{'type':_0x7342('0x1')},'mixmonitorid':{'type':_0x7342('0x1')}};exports[_0x7342('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x7342('0x1'),'required':!![]},'exten':{'type':_0x7342('0x1'),'required':!![]},'context':{'type':_0x7342('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 148d73d..6580acd 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 _0x0bd5=['../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','trunks','voiceQueues','triggers','templates','outbound','channels','queueChannels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','format','SIP/%s','name','interface','hasOwnProperty','total','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','answered','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','agents','length','isNil','initTelephones','telephones','isUndefined','initVoiceQueues','initTriggers','initTemplates','initZendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','faxAccounts','exports','lodash','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount'];(function(_0x49f1fa,_0x332f95){var _0x409cbf=function(_0x16ed27){while(--_0x16ed27){_0x49f1fa['push'](_0x49f1fa['shift']());}};_0x409cbf(++_0x332f95);}(_0x0bd5,0xd0));var _0x50bd=function(_0x2c68d3,_0x2ced36){_0x2c68d3=_0x2c68d3-0x0;var _0x18f8a6=_0x0bd5[_0x2c68d3];return _0x18f8a6;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x50bd('0x0'));var moment=require(_0x50bd('0x1'));var Agent=require(_0x50bd('0x2'));var Telephone=require(_0x50bd('0x3'));var Trunk=require(_0x50bd('0x4'));var VoiceQueue=require(_0x50bd('0x5'));var Trigger=require(_0x50bd('0x6'));var Template=require(_0x50bd('0x7'));var Campaign=require(_0x50bd('0x8'));var VoiceExtension=require(_0x50bd('0x9'));var ZendeskAccount=require(_0x50bd('0xa'));var SalesforceAccount=require(_0x50bd('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0x50bd('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0x50bd('0xd'));var ServicenowAccount=require(_0x50bd('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0x50bd('0xf'));var FaxAccount=require(_0x50bd('0x10'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0x50bd('0x11')]={};this[_0x50bd('0x12')]={};this[_0x50bd('0x13')]={};this['campaigns']={};this[_0x50bd('0x14')]={};this[_0x50bd('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x50bd('0x16')]={};this[_0x50bd('0x17')]={};this[_0x50bd('0x18')]={};this['timers']={};this[_0x50bd('0x19')]={};this[_0x50bd('0x1a')]={};this[_0x50bd('0x1b')]={};this['sugarcrmAccounts']={};this[_0x50bd('0x1c')]={};this[_0x50bd('0x1d')]={};this[_0x50bd('0x1e')]={};this[_0x50bd('0x1f')]={};this[_0x50bd('0x20')]={};this[_0x50bd('0x21')]={};this[_0x50bd('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x18f3fc,_0x1b12c4,_0x2bd14b){var _0x20994f=_[_0x50bd('0x23')](_0x18f3fc,function(_0x1b4176,_0x393082){return _0x1b4176[_0x2bd14b];});for(var _0x34b5e9 in _0x1b12c4){if(_0x1b12c4['hasOwnProperty'](_0x34b5e9)){if(!_0x20994f[_0x34b5e9]){delete _0x1b12c4[_0x34b5e9];}}}}function freeIsNotKeySip(_0x40fbfd,_0x46d2e7){var _0x4f4cb9=_[_0x50bd('0x23')](_0x40fbfd,function(_0x4f4eb6,_0xf5295){return util[_0x50bd('0x24')](_0x50bd('0x25'),_0x4f4eb6[_0x50bd('0x26')]);});for(var _0xfb3ec6 in _0x46d2e7){if(_0x46d2e7['hasOwnProperty'](_0xfb3ec6)){if(!_0x4f4cb9[_0xfb3ec6]){delete _0x46d2e7[_0xfb3ec6];}}}}function freeIsNotKeyAgent(_0x589bf4,_0x4dae8c){var _0x3a2d02=_[_0x50bd('0x23')](_0x589bf4,function(_0x50c4e7,_0x268088){var _0x15f8e0=_['isNil'](_0x50c4e7['interface'])?util[_0x50bd('0x24')](_0x50bd('0x25'),_0x50c4e7[_0x50bd('0x26')]):_0x50c4e7[_0x50bd('0x27')];return _0x15f8e0;});for(var _0x4d3099 in _0x4dae8c){if(_0x4dae8c[_0x50bd('0x28')](_0x4d3099)){if(!_0x3a2d02[_0x4d3099]){delete _0x4dae8c[_0x4d3099];}}}}function clearVoiceCallReports(_0xde508b){_0xde508b[_0x50bd('0x29')]=0x0;_0xde508b['answered']=0x0;_0xde508b[_0x50bd('0x2a')]=0x0;_0xde508b['sumDuration']=0x0;_0xde508b[_0x50bd('0x2b')]=0x0;}function clearCampaigns(_0x9c736b){if(!_[_0x50bd('0x2c')](_0x9c736b)){for(var _0x3baaf9 in _0x9c736b){if(_0x9c736b[_0x50bd('0x28')](_0x3baaf9)){_0x9c736b[_0x3baaf9][_0x50bd('0x2d')]=0x0;_0x9c736b[_0x3baaf9][_0x50bd('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x57f0ff){if(!_['isEmpty'](_0x57f0ff)){for(var _0x53ea01 in _0x57f0ff){if(_0x57f0ff[_0x50bd('0x28')](_0x53ea01)){_0x57f0ff[_0x53ea01][_0x50bd('0x29')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x2f')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x30')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x31')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x2a')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x32')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x2b')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x33')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x34')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x35')]=0x0;_0x57f0ff[_0x53ea01]['outboundCongestionCallsDay']=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x36')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x37')]=0x0;_0x57f0ff[_0x53ea01]['outboundDropCallsDayTimeout']=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x38')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x39')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x3a')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x3b')]=0x0;_0x57f0ff[_0x53ea01]['outboundReCallsDay']=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x33')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x3c')]=0x0;_0x57f0ff[_0x53ea01][_0x50bd('0x3d')]=!![];}}}}Realtime['prototype'][_0x50bd('0x3e')]=function(_0x4feaac,_0x394a2a){for(var _0x9967a0 in _0x394a2a){if(_0x4feaac['hasOwnProperty'](_0x9967a0)){_0x4feaac[_0x9967a0]=_0x394a2a[_0x9967a0];}}};Realtime[_0x50bd('0x3f')][_0x50bd('0x40')]=function(){var _0x165e88=this;return function(_0x1ef52e){if(_0x1ef52e){freeIsNotKeyAgent(_0x1ef52e,_0x165e88[_0x50bd('0x41')]);for(var _0x21541c=0x0,_0x2c5f8b={},_0x1b4400={};_0x21541c<_0x1ef52e[_0x50bd('0x42')];_0x21541c+=0x1){_0x2c5f8b=_0x1ef52e[_0x21541c];var _0x18c097=_[_0x50bd('0x43')](_0x2c5f8b[_0x50bd('0x27')])?util['format'](_0x50bd('0x25'),_0x2c5f8b[_0x50bd('0x26')]):_0x2c5f8b[_0x50bd('0x27')];if(_['isUndefined'](_0x165e88[_0x50bd('0x41')][_0x18c097])){_0x165e88[_0x50bd('0x41')][_0x18c097]=new Agent(_0x2c5f8b);}else{_0x165e88['mergeFromDatabase'](_0x165e88['agents'][_0x18c097],_0x2c5f8b);}}}return _0x165e88[_0x50bd('0x41')];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x44')]=function(){var _0x59bfed=this;return function(_0x388e87){if(_0x388e87){freeIsNotKeySip(_0x388e87,_0x59bfed[_0x50bd('0x45')]);for(var _0x260b3f=0x0,_0x2128db={},_0x12b72b={};_0x260b3f<_0x388e87[_0x50bd('0x42')];_0x260b3f+=0x1){_0x2128db=_0x388e87[_0x260b3f];if(_[_0x50bd('0x46')](_0x59bfed['telephones'][util[_0x50bd('0x24')](_0x50bd('0x25'),_0x2128db[_0x50bd('0x26')])])){_0x59bfed[_0x50bd('0x45')][util['format']('SIP/%s',_0x2128db[_0x50bd('0x26')])]=new Telephone(_0x2128db);}else{_0x59bfed[_0x50bd('0x3e')](_0x59bfed[_0x50bd('0x45')][util[_0x50bd('0x24')]('SIP/%s',_0x2128db[_0x50bd('0x26')])],_0x2128db);}}}return _0x59bfed[_0x50bd('0x45')];};};Realtime['prototype']['initTrunks']=function(){var _0x586412=this;return function(_0x321bf0){if(_0x321bf0){freeIsNotKeySip(_0x321bf0,_0x586412['trunks']);for(var _0x12ce33=0x0,_0x34c315={},_0x111fb2={};_0x12ce33<_0x321bf0['length'];_0x12ce33+=0x1){_0x34c315=_0x321bf0[_0x12ce33];if(_[_0x50bd('0x46')](_0x586412[_0x50bd('0x11')][util['format']('SIP/%s',_0x34c315['name'])])){_0x586412[_0x50bd('0x11')][util[_0x50bd('0x24')](_0x50bd('0x25'),_0x34c315['name'])]=new Trunk(_0x34c315);}else{_0x586412[_0x50bd('0x3e')](_0x586412['trunks'][util[_0x50bd('0x24')](_0x50bd('0x25'),_0x34c315[_0x50bd('0x26')])],_0x34c315);}}}return _0x586412['trunks'];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x47')]=function(){var _0x13f8e9=this;return function(_0x30d6b1){if(_0x30d6b1){freeIsNotKey(_0x30d6b1,_0x13f8e9[_0x50bd('0x12')],'name');for(var _0x3e45da=0x0,_0xf8dfcc={},_0x46a123={};_0x3e45da<_0x30d6b1[_0x50bd('0x42')];_0x3e45da+=0x1){_0xf8dfcc=_0x30d6b1[_0x3e45da];if(_[_0x50bd('0x46')](_0x13f8e9['voiceQueues'][_0xf8dfcc[_0x50bd('0x26')]])){_0x13f8e9[_0x50bd('0x12')][_0xf8dfcc[_0x50bd('0x26')]]=new VoiceQueue(_0xf8dfcc);}else{_0x13f8e9[_0x50bd('0x3e')](_0x13f8e9[_0x50bd('0x12')][_0xf8dfcc[_0x50bd('0x26')]],_0xf8dfcc);}}}return _0x13f8e9['voiceQueues'];};};Realtime['prototype'][_0x50bd('0x48')]=function(){var _0x1500be=this;return function(_0x384e44){if(_0x384e44){freeIsNotKey(_0x384e44,_0x1500be[_0x50bd('0x13')],'id');for(var _0x46c186=0x0,_0x21674b={},_0x2895f5={};_0x46c186<_0x384e44[_0x50bd('0x42')];_0x46c186+=0x1){_0x21674b=_0x384e44[_0x46c186];if(_[_0x50bd('0x46')](_0x1500be[_0x50bd('0x13')][_0x21674b['id']])){_0x1500be[_0x50bd('0x13')][_0x21674b['id']]=new Trigger(_0x21674b);}else{_0x1500be[_0x50bd('0x3e')](_0x1500be[_0x50bd('0x13')][_0x21674b['id']],_0x21674b);}}}return _0x1500be[_0x50bd('0x13')];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x49')]=function(){var _0x5b7b0c=this;return function(_0x18106c){if(_0x18106c){freeIsNotKey(_0x18106c,_0x5b7b0c[_0x50bd('0x14')],'id');for(var _0x3df59c=0x0,_0x5c4e20={},_0x25ac6e={};_0x3df59c<_0x18106c[_0x50bd('0x42')];_0x3df59c+=0x1){_0x5c4e20=_0x18106c[_0x3df59c];if(_['isUndefined'](_0x5b7b0c[_0x50bd('0x14')][_0x5c4e20['id']])){_0x5b7b0c['templates'][_0x5c4e20['id']]=new Template(_0x5c4e20);}else{_0x5b7b0c[_0x50bd('0x3e')](_0x5b7b0c['templates'][_0x5c4e20['id']],_0x5c4e20);}}}return _0x5b7b0c[_0x50bd('0x14')];};};Realtime['prototype'][_0x50bd('0x4a')]=function(){var _0x14c8cc=this;return function(_0x3c7817){if(_0x3c7817){freeIsNotKey(_0x3c7817,_0x14c8cc[_0x50bd('0x1a')],'id');for(var _0x451e53=0x0,_0x250099={},_0x519127={};_0x451e53<_0x3c7817[_0x50bd('0x42')];_0x451e53+=0x1){_0x250099=_0x3c7817[_0x451e53];if(_[_0x50bd('0x46')](_0x14c8cc[_0x50bd('0x1a')][_0x250099['id']])){_0x14c8cc[_0x50bd('0x1a')][_0x250099['id']]=new ZendeskAccount(_0x250099);}else{_0x14c8cc[_0x50bd('0x3e')](_0x14c8cc[_0x50bd('0x1a')][_0x250099['id']],_0x250099);}}}return _0x14c8cc[_0x50bd('0x1a')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x469128=this;return function(_0x2726b3){if(_0x2726b3){freeIsNotKey(_0x2726b3,_0x469128['salesforceAccounts'],'id');for(var _0x1ea758=0x0,_0x1d8980={},_0x266182={};_0x1ea758<_0x2726b3[_0x50bd('0x42')];_0x1ea758+=0x1){_0x1d8980=_0x2726b3[_0x1ea758];if(_[_0x50bd('0x46')](_0x469128[_0x50bd('0x1b')][_0x1d8980['id']])){_0x469128[_0x50bd('0x1b')][_0x1d8980['id']]=new SalesforceAccount(_0x1d8980);}else{_0x469128[_0x50bd('0x3e')](_0x469128[_0x50bd('0x1b')][_0x1d8980['id']],_0x1d8980);}}}return _0x469128[_0x50bd('0x1b')];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x4b')]=function(){var _0x5a8c01=this;return function(_0x14111a){if(_0x14111a){freeIsNotKey(_0x14111a,_0x5a8c01[_0x50bd('0x1c')],'id');for(var _0x1f81ba=0x0,_0x4f13e7={},_0x3bfecd={};_0x1f81ba<_0x14111a['length'];_0x1f81ba+=0x1){_0x4f13e7=_0x14111a[_0x1f81ba];if(_[_0x50bd('0x46')](_0x5a8c01[_0x50bd('0x1c')][_0x4f13e7['id']])){_0x5a8c01[_0x50bd('0x1c')][_0x4f13e7['id']]=new FreshdeskAccount(_0x4f13e7);}else{_0x5a8c01[_0x50bd('0x3e')](_0x5a8c01[_0x50bd('0x1c')][_0x4f13e7['id']],_0x4f13e7);}}}return _0x5a8c01[_0x50bd('0x1c')];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x4c')]=function(){var _0x5e853c=this;return function(_0x197b7c){if(_0x197b7c){freeIsNotKey(_0x197b7c,_0x5e853c[_0x50bd('0x1d')],'id');for(var _0x410db3=0x0,_0x479ca7={},_0x4b991b={};_0x410db3<_0x197b7c['length'];_0x410db3+=0x1){_0x479ca7=_0x197b7c[_0x410db3];if(_[_0x50bd('0x46')](_0x5e853c[_0x50bd('0x1d')][_0x479ca7['id']])){_0x5e853c['zohoAccounts'][_0x479ca7['id']]=new ZohoAccount(_0x479ca7);}else{_0x5e853c[_0x50bd('0x3e')](_0x5e853c[_0x50bd('0x1d')][_0x479ca7['id']],_0x479ca7);}}}return _0x5e853c['zohoAccounts'];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x4d')]=function(){var _0x5917c0=this;return function(_0xc6f377){if(_0xc6f377){freeIsNotKey(_0xc6f377,_0x5917c0['deskAccounts'],'id');for(var _0x27f61a=0x0,_0x4fac80={},_0x1c66ec={};_0x27f61a<_0xc6f377[_0x50bd('0x42')];_0x27f61a+=0x1){_0x4fac80=_0xc6f377[_0x27f61a];if(_['isUndefined'](_0x5917c0[_0x50bd('0x1e')][_0x4fac80['id']])){_0x5917c0[_0x50bd('0x1e')][_0x4fac80['id']]=new DeskAccount(_0x4fac80);}else{_0x5917c0[_0x50bd('0x3e')](_0x5917c0[_0x50bd('0x1e')][_0x4fac80['id']],_0x4fac80);}}}return _0x5917c0[_0x50bd('0x1e')];};};Realtime['prototype'][_0x50bd('0x4e')]=function(){var _0x12bec3=this;return function(_0x136856){if(_0x136856){freeIsNotKey(_0x136856,_0x12bec3[_0x50bd('0x4f')],'id');for(var _0x1334b5=0x0,_0x200706={},_0x5f243d={};_0x1334b5<_0x136856[_0x50bd('0x42')];_0x1334b5+=0x1){_0x200706=_0x136856[_0x1334b5];if(_[_0x50bd('0x46')](_0x12bec3[_0x50bd('0x4f')][_0x200706['id']])){_0x12bec3['sugarcrmAccounts'][_0x200706['id']]=new SugarcrmAccount(_0x200706);}else{_0x12bec3[_0x50bd('0x3e')](_0x12bec3['sugarcrmAccounts'][_0x200706['id']],_0x200706);}}}return _0x12bec3[_0x50bd('0x4f')];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x50')]=function(){var _0xce02c7=this;return function(_0x5b50f4){if(_0x5b50f4){freeIsNotKey(_0x5b50f4,_0xce02c7['vtigerAccounts'],'id');for(var _0x3abeb4=0x0,_0xbefb36={},_0x13c4fd={};_0x3abeb4<_0x5b50f4[_0x50bd('0x42')];_0x3abeb4+=0x1){_0xbefb36=_0x5b50f4[_0x3abeb4];if(_['isUndefined'](_0xce02c7[_0x50bd('0x1f')][_0xbefb36['id']])){_0xce02c7[_0x50bd('0x1f')][_0xbefb36['id']]=new VtigerAccount(_0xbefb36);}else{_0xce02c7[_0x50bd('0x3e')](_0xce02c7[_0x50bd('0x1f')][_0xbefb36['id']],_0xbefb36);}}}return _0xce02c7[_0x50bd('0x1f')];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x51')]=function(){var _0x5664d7=this;return function(_0x49d8d9){if(_0x49d8d9){freeIsNotKey(_0x49d8d9,_0x5664d7['servicenowAccounts'],'id');for(var _0x122053=0x0,_0x5a49b6={},_0x42862e={};_0x122053<_0x49d8d9[_0x50bd('0x42')];_0x122053+=0x1){_0x5a49b6=_0x49d8d9[_0x122053];if(_[_0x50bd('0x46')](_0x5664d7[_0x50bd('0x20')][_0x5a49b6['id']])){_0x5664d7['servicenowAccounts'][_0x5a49b6['id']]=new ServicenowAccount(_0x5a49b6);}else{_0x5664d7['mergeFromDatabase'](_0x5664d7[_0x50bd('0x20')][_0x5a49b6['id']],_0x5a49b6);}}}return _0x5664d7[_0x50bd('0x20')];};};Realtime[_0x50bd('0x3f')]['initDynamics365Accounts']=function(){var _0x2f5ee1=this;return function(_0x22c352){if(_0x22c352){freeIsNotKey(_0x22c352,_0x2f5ee1[_0x50bd('0x21')],'id');for(var _0x5e3d24=0x0,_0x3c068a={},_0x27ba5e={};_0x5e3d24<_0x22c352['length'];_0x5e3d24+=0x1){_0x3c068a=_0x22c352[_0x5e3d24];if(_['isUndefined'](_0x2f5ee1[_0x50bd('0x21')][_0x3c068a['id']])){_0x2f5ee1[_0x50bd('0x21')][_0x3c068a['id']]=new Dynamics365Account(_0x3c068a);}else{_0x2f5ee1[_0x50bd('0x3e')](_0x2f5ee1[_0x50bd('0x21')][_0x3c068a['id']],_0x3c068a);}}}return _0x2f5ee1[_0x50bd('0x21')];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x52')]=function(){var _0x1212b9=this;return function(_0x2b6156){if(_0x2b6156){freeIsNotKey(_0x2b6156,_0x1212b9[_0x50bd('0x22')],'id');for(var _0x4ccec7=0x0,_0x14120b={},_0x585051={};_0x4ccec7<_0x2b6156[_0x50bd('0x42')];_0x4ccec7+=0x1){_0x14120b=_0x2b6156[_0x4ccec7];if(_[_0x50bd('0x46')](_0x1212b9[_0x50bd('0x22')][_0x14120b['id']])){_0x1212b9['freshsalesAccounts'][_0x14120b['id']]=new FreshsalesAccount(_0x14120b);}else{_0x1212b9[_0x50bd('0x3e')](_0x1212b9[_0x50bd('0x22')][_0x14120b['id']],_0x14120b);}}}return _0x1212b9[_0x50bd('0x22')];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x53')]=function(){var _0x58b6bb=this;return function(_0x512111){for(var _0x23da2a=0x0;_0x23da2a<_0x512111[_0x50bd('0x42')];_0x23da2a+=0x1){_[_0x50bd('0x54')](_0x58b6bb[_0x50bd('0x12')][_0x512111[_0x23da2a][_0x50bd('0x26')]],_0x512111[_0x23da2a]);}return _0x58b6bb[_0x50bd('0x12')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x59280f=this;return function(_0x8e1dbb){clearVoiceQueues(_0x59280f[_0x50bd('0x12')]);if(_0x8e1dbb){_0x8e1dbb=_['groupBy'](_0x8e1dbb,_0x50bd('0x55'));for(var _0x39441b in _0x8e1dbb){if(_0x8e1dbb[_0x50bd('0x28')](_0x39441b)){var _0x218061={};for(var _0x244d9a=0x0;_0x244d9a<_0x8e1dbb[_0x39441b][_0x50bd('0x42')];_0x244d9a+=0x1){var _0x29f95a=_0x8e1dbb[_0x39441b][_0x244d9a][_0x50bd('0x56')];if(_0x59280f[_0x50bd('0x12')][_0x29f95a]){if(_0x8e1dbb[_0x39441b][_0x244d9a]['queuecallerexit']){_0x59280f[_0x50bd('0x12')][_0x29f95a][_0x50bd('0x30')]+=0x1;}if(_0x8e1dbb[_0x39441b][_0x244d9a][_0x50bd('0x57')]){_0x59280f['voiceQueues'][_0x29f95a]['abandoned']+=0x1;}_0x59280f['voiceQueues'][_0x29f95a]['sumHoldTime']+=moment(_0x8e1dbb[_0x39441b][_0x244d9a][_0x50bd('0x58')])['diff'](moment(_0x8e1dbb[_0x39441b][_0x244d9a]['queuecallerjoinAt']),_0x50bd('0x59'))||0x0;if(_0x244d9a===_0x8e1dbb[_0x39441b][_0x50bd('0x42')]-0x1){_0x59280f[_0x50bd('0x12')][_0x29f95a][_0x50bd('0x32')]+=moment(_0x8e1dbb[_0x39441b][_0x244d9a][_0x50bd('0x5a')]||_0x8e1dbb[_0x39441b][_0x244d9a][_0x50bd('0x5b')]||_0x8e1dbb[_0x39441b][_0x244d9a]['queuecallerexitAt'])[_0x50bd('0x5c')](moment(_0x8e1dbb[_0x39441b][_0x244d9a][_0x50bd('0x5d')]),_0x50bd('0x59'))||0x0;_0x59280f[_0x50bd('0x12')][_0x29f95a][_0x50bd('0x29')]+=0x1;if(_0x8e1dbb[_0x39441b][_0x244d9a][_0x50bd('0x5e')]){_0x59280f[_0x50bd('0x12')][_0x29f95a]['answered']+=0x1;_0x59280f[_0x50bd('0x12')][_0x29f95a][_0x50bd('0x2b')]+=moment(_0x8e1dbb[_0x39441b][_0x244d9a]['queuecallercompleteAt'])['diff'](moment(_0x8e1dbb[_0x39441b][_0x244d9a][_0x50bd('0x58')]),_0x50bd('0x59'))||0x0;}}else{_0x59280f[_0x50bd('0x12')][_0x29f95a]['sumDuration']+=_0x59280f[_0x50bd('0x12')][_0x29f95a]['sumHoldTime']||0x0;}}}}}}return _0x59280f[_0x50bd('0x12')];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x5f')]=function(){var _0x509ad8=this;return function(_0x2921d0){clearVoiceCallReports(_0x509ad8['outbound']);if(_0x2921d0){for(var _0x5760e7=0x0;_0x5760e7<_0x2921d0[_0x50bd('0x42')];_0x5760e7+=0x1){_0x509ad8[_0x50bd('0x15')][_0x50bd('0x29')]+=0x1;_0x509ad8['outbound'][_0x50bd('0x32')]+=_0x2921d0[_0x5760e7][_0x50bd('0x60')];if(_0x2921d0[_0x5760e7][_0x50bd('0x61')]===_0x50bd('0x62')){_0x509ad8[_0x50bd('0x15')][_0x50bd('0x2f')]+=0x1;_0x509ad8[_0x50bd('0x15')][_0x50bd('0x2a')]+=_0x2921d0[_0x5760e7][_0x50bd('0x60')]-_0x2921d0[_0x5760e7][_0x50bd('0x63')]||0x0;_0x509ad8['outbound'][_0x50bd('0x2b')]+=_0x2921d0[_0x5760e7][_0x50bd('0x63')];}}}return _0x509ad8[_0x50bd('0x15')];};};Realtime['prototype'][_0x50bd('0x64')]=function(){var _0x2ea9e5=this;return function(_0x55aa5e){if(_0x55aa5e){freeIsNotKey(_0x55aa5e,_0x2ea9e5[_0x50bd('0x65')],_0x50bd('0x26'));for(var _0x445a68=0x0,_0x2ccfd5={};_0x445a68<_0x55aa5e['length'];_0x445a68+=0x1){_0x2ccfd5=_0x55aa5e[_0x445a68];if(_[_0x50bd('0x46')](_0x2ea9e5[_0x50bd('0x65')][_0x2ccfd5[_0x50bd('0x26')]])){_0x2ea9e5[_0x50bd('0x65')][_0x2ccfd5[_0x50bd('0x26')]]=new Campaign(_0x2ccfd5);}else{_0x2ea9e5[_0x50bd('0x3e')](_0x2ea9e5[_0x50bd('0x65')][_0x2ccfd5[_0x50bd('0x26')]],_0x2ccfd5);_0x2ea9e5[_0x50bd('0x65')][_0x2ccfd5[_0x50bd('0x26')]][_0x50bd('0x66')]=_0x2ccfd5[_0x50bd('0x67')]?_0x2ccfd5[_0x50bd('0x67')][_0x50bd('0x26')]:undefined;}}}return _0x2ea9e5[_0x50bd('0x65')];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x68')]=function(){var _0x624b99=this;return function(_0x2765c0){if(_0x2765c0){freeIsNotKey(_0x2765c0,_0x624b99[_0x50bd('0x69')],'id');for(var _0x2afb4d=0x0,_0x2e9cb8={};_0x2afb4d<_0x2765c0['length'];_0x2afb4d+=0x1){_0x2e9cb8=_0x2765c0[_0x2afb4d];if(_[_0x50bd('0x46')](_0x624b99[_0x50bd('0x69')][_0x2e9cb8['id']])){_0x624b99[_0x50bd('0x69')][_0x2e9cb8['id']]=new VoiceExtension(_0x2e9cb8);}else{_0x624b99[_0x50bd('0x3e')](_0x624b99['voiceExtensions'][_0x2e9cb8['id']],_0x2e9cb8);}}}return _0x624b99['voiceExtensions'];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x6a')]=function(){var _0x3c5739=this;return function(_0x2d2cc0){clearCampaigns(_0x3c5739[_0x50bd('0x65')]);for(var _0x199130=0x0;_0x199130<_0x2d2cc0[_0x50bd('0x42')];_0x199130+=0x1){_[_0x50bd('0x54')](_0x3c5739[_0x50bd('0x65')][_0x2d2cc0[_0x199130][_0x50bd('0x26')]],_0x2d2cc0[_0x199130]);}return _0x3c5739['campaigns'];};};Realtime[_0x50bd('0x3f')][_0x50bd('0x6b')]=function(){var _0x401e5f=this;return function(_0x428006){if(_0x428006){freeIsNotKey(_0x428006,_0x401e5f[_0x50bd('0x6c')],'id');for(var _0x4c323f=0x0,_0x1eb560={},_0x1f95c2={};_0x4c323f<_0x428006[_0x50bd('0x42')];_0x4c323f+=0x1){_0x1eb560=_0x428006[_0x4c323f];if(_[_0x50bd('0x46')](_0x401e5f['faxAccounts'][_0x1eb560['id']])){_0x401e5f[_0x50bd('0x6c')][_0x1eb560['id']]=new FaxAccount(_0x1eb560);}else{_0x401e5f[_0x50bd('0x3e')](_0x401e5f[_0x50bd('0x6c')][_0x1eb560['id']],_0x1eb560);}}}return _0x401e5f[_0x50bd('0x6c')];};};module[_0x50bd('0x6d')]=Realtime; \ No newline at end of file +var _0xb949=['initTriggers','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','vtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','diff','seconds','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','merge','exports','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','voiceQueues','templates','outbound','voiceExtensions','channels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','hasOwnProperty','format','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTelephones','initTrunks','initVoiceQueues'];(function(_0x32e866,_0x4b38a2){var _0x315957=function(_0x269aae){while(--_0x269aae){_0x32e866['push'](_0x32e866['shift']());}};_0x315957(++_0x4b38a2);}(_0xb949,0x90));var _0x9b94=function(_0x57dc21,_0xb176f4){_0x57dc21=_0x57dc21-0x0;var _0x558a93=_0xb949[_0x57dc21];return _0x558a93;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var moment=require(_0x9b94('0x0'));var Agent=require('../model/agent');var Telephone=require(_0x9b94('0x1'));var Trunk=require(_0x9b94('0x2'));var VoiceQueue=require(_0x9b94('0x3'));var Trigger=require(_0x9b94('0x4'));var Template=require(_0x9b94('0x5'));var Campaign=require(_0x9b94('0x6'));var VoiceExtension=require(_0x9b94('0x7'));var ZendeskAccount=require(_0x9b94('0x8'));var SalesforceAccount=require(_0x9b94('0x9'));var FreshdeskAccount=require(_0x9b94('0xa'));var SugarcrmAccount=require(_0x9b94('0xb'));var ZohoAccount=require(_0x9b94('0xc'));var DeskAccount=require(_0x9b94('0xd'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0x9b94('0xe'));var Dynamics365Account=require(_0x9b94('0xf'));var FreshsalesAccount=require(_0x9b94('0x10'));var FaxAccount=require(_0x9b94('0x11'));var Realtime=function(){this[_0x9b94('0x12')]={};this[_0x9b94('0x13')]={};this[_0x9b94('0x14')]={};this[_0x9b94('0x15')]={};this['triggers']={};this['campaigns']={};this[_0x9b94('0x16')]={};this[_0x9b94('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x9b94('0x18')]={};this[_0x9b94('0x19')]={};this['queueChannels']={};this[_0x9b94('0x1a')]={};this[_0x9b94('0x1b')]={};this[_0x9b94('0x1c')]={};this[_0x9b94('0x1d')]={};this[_0x9b94('0x1e')]={};this[_0x9b94('0x1f')]={};this[_0x9b94('0x20')]={};this[_0x9b94('0x21')]={};this[_0x9b94('0x22')]={};this['vtigerAccounts']={};this[_0x9b94('0x23')]={};this[_0x9b94('0x24')]={};this[_0x9b94('0x25')]={};this[_0x9b94('0x26')]={};};function freeIsNotKey(_0x4f1526,_0x54892f,_0x3ba962){var _0xe243a8=_['mapKeys'](_0x4f1526,function(_0x125bc0,_0x402319){return _0x125bc0[_0x3ba962];});for(var _0x40f4b8 in _0x54892f){if(_0x54892f[_0x9b94('0x27')](_0x40f4b8)){if(!_0xe243a8[_0x40f4b8]){delete _0x54892f[_0x40f4b8];}}}}function freeIsNotKeySip(_0xe1735b,_0x56fc0a){var _0x384cc4=_['mapKeys'](_0xe1735b,function(_0x513f08,_0x38f5b0){return util[_0x9b94('0x28')](_0x9b94('0x29'),_0x513f08[_0x9b94('0x2a')]);});for(var _0x4d31c2 in _0x56fc0a){if(_0x56fc0a[_0x9b94('0x27')](_0x4d31c2)){if(!_0x384cc4[_0x4d31c2]){delete _0x56fc0a[_0x4d31c2];}}}}function freeIsNotKeyAgent(_0x3bf8f,_0x274dcb){var _0x532cf8=_['mapKeys'](_0x3bf8f,function(_0x17c880,_0x2a2152){var _0x3c11ed=_[_0x9b94('0x2b')](_0x17c880['interface'])?util[_0x9b94('0x28')](_0x9b94('0x29'),_0x17c880[_0x9b94('0x2a')]):_0x17c880[_0x9b94('0x2c')];return _0x3c11ed;});for(var _0x24c05d in _0x274dcb){if(_0x274dcb[_0x9b94('0x27')](_0x24c05d)){if(!_0x532cf8[_0x24c05d]){delete _0x274dcb[_0x24c05d];}}}}function clearVoiceCallReports(_0x1b89f6){_0x1b89f6[_0x9b94('0x2d')]=0x0;_0x1b89f6[_0x9b94('0x2e')]=0x0;_0x1b89f6[_0x9b94('0x2f')]=0x0;_0x1b89f6[_0x9b94('0x30')]=0x0;_0x1b89f6['sumBillable']=0x0;}function clearCampaigns(_0x1b366f){if(!_[_0x9b94('0x31')](_0x1b366f)){for(var _0x10df5c in _0x1b366f){if(_0x1b366f[_0x9b94('0x27')](_0x10df5c)){_0x1b366f[_0x10df5c][_0x9b94('0x32')]=0x0;_0x1b366f[_0x10df5c][_0x9b94('0x33')]=0x0;}}}}function clearVoiceQueues(_0xc9482b){if(!_['isEmpty'](_0xc9482b)){for(var _0x3ff57d in _0xc9482b){if(_0xc9482b['hasOwnProperty'](_0x3ff57d)){_0xc9482b[_0x3ff57d]['total']=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x2e')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x34')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x35')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x2f')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x30')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x36')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x37')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x38')]=0x0;_0xc9482b[_0x3ff57d]['outboundBusyCallsDay']=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x39')]=0x0;_0xc9482b[_0x3ff57d]['outboundNoSuchCallsDay']=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x3a')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x3b')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x3c')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x3d')]=0x0;_0xc9482b[_0x3ff57d]['outboundOriginateFailureCallsDay']=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x3e')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x3f')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x37')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x40')]=0x0;_0xc9482b[_0x3ff57d][_0x9b94('0x41')]=!![];}}}}Realtime['prototype'][_0x9b94('0x42')]=function(_0x370746,_0x52fd7f){for(var _0x1c9393 in _0x52fd7f){if(_0x370746[_0x9b94('0x27')](_0x1c9393)){_0x370746[_0x1c9393]=_0x52fd7f[_0x1c9393];}}};Realtime[_0x9b94('0x43')][_0x9b94('0x44')]=function(){var _0x1ef3ff=this;return function(_0x21c3b5){if(_0x21c3b5){freeIsNotKeyAgent(_0x21c3b5,_0x1ef3ff[_0x9b94('0x12')]);for(var _0x11a577=0x0,_0x333209={},_0x4d8b44={};_0x11a577<_0x21c3b5[_0x9b94('0x45')];_0x11a577+=0x1){_0x333209=_0x21c3b5[_0x11a577];var _0x452d54=_[_0x9b94('0x2b')](_0x333209[_0x9b94('0x2c')])?util[_0x9b94('0x28')]('SIP/%s',_0x333209['name']):_0x333209['interface'];if(_[_0x9b94('0x46')](_0x1ef3ff[_0x9b94('0x12')][_0x452d54])){_0x1ef3ff[_0x9b94('0x12')][_0x452d54]=new Agent(_0x333209);}else{_0x1ef3ff['mergeFromDatabase'](_0x1ef3ff[_0x9b94('0x12')][_0x452d54],_0x333209);}}}return _0x1ef3ff['agents'];};};Realtime[_0x9b94('0x43')][_0x9b94('0x47')]=function(){var _0x379d06=this;return function(_0x3909b1){if(_0x3909b1){freeIsNotKeySip(_0x3909b1,_0x379d06[_0x9b94('0x13')]);for(var _0x169c0d=0x0,_0xab1bea={},_0x4bd9fa={};_0x169c0d<_0x3909b1[_0x9b94('0x45')];_0x169c0d+=0x1){_0xab1bea=_0x3909b1[_0x169c0d];if(_[_0x9b94('0x46')](_0x379d06['telephones'][util[_0x9b94('0x28')](_0x9b94('0x29'),_0xab1bea['name'])])){_0x379d06['telephones'][util['format'](_0x9b94('0x29'),_0xab1bea['name'])]=new Telephone(_0xab1bea);}else{_0x379d06[_0x9b94('0x42')](_0x379d06[_0x9b94('0x13')][util[_0x9b94('0x28')](_0x9b94('0x29'),_0xab1bea[_0x9b94('0x2a')])],_0xab1bea);}}}return _0x379d06['telephones'];};};Realtime[_0x9b94('0x43')][_0x9b94('0x48')]=function(){var _0x49b06a=this;return function(_0x584633){if(_0x584633){freeIsNotKeySip(_0x584633,_0x49b06a[_0x9b94('0x14')]);for(var _0x48156a=0x0,_0x4b12db={},_0x304f29={};_0x48156a<_0x584633[_0x9b94('0x45')];_0x48156a+=0x1){_0x4b12db=_0x584633[_0x48156a];if(_[_0x9b94('0x46')](_0x49b06a[_0x9b94('0x14')][util['format'](_0x9b94('0x29'),_0x4b12db[_0x9b94('0x2a')])])){_0x49b06a[_0x9b94('0x14')][util[_0x9b94('0x28')](_0x9b94('0x29'),_0x4b12db[_0x9b94('0x2a')])]=new Trunk(_0x4b12db);}else{_0x49b06a[_0x9b94('0x42')](_0x49b06a['trunks'][util[_0x9b94('0x28')](_0x9b94('0x29'),_0x4b12db[_0x9b94('0x2a')])],_0x4b12db);}}}return _0x49b06a[_0x9b94('0x14')];};};Realtime[_0x9b94('0x43')][_0x9b94('0x49')]=function(){var _0x498a9d=this;return function(_0x2867a3){if(_0x2867a3){freeIsNotKey(_0x2867a3,_0x498a9d[_0x9b94('0x15')],_0x9b94('0x2a'));for(var _0xbacbe4=0x0,_0x28abbd={},_0x44418a={};_0xbacbe4<_0x2867a3[_0x9b94('0x45')];_0xbacbe4+=0x1){_0x28abbd=_0x2867a3[_0xbacbe4];if(_[_0x9b94('0x46')](_0x498a9d[_0x9b94('0x15')][_0x28abbd[_0x9b94('0x2a')]])){_0x498a9d[_0x9b94('0x15')][_0x28abbd[_0x9b94('0x2a')]]=new VoiceQueue(_0x28abbd);}else{_0x498a9d['mergeFromDatabase'](_0x498a9d['voiceQueues'][_0x28abbd[_0x9b94('0x2a')]],_0x28abbd);}}}return _0x498a9d[_0x9b94('0x15')];};};Realtime['prototype'][_0x9b94('0x4a')]=function(){var _0x54168d=this;return function(_0x927710){if(_0x927710){freeIsNotKey(_0x927710,_0x54168d[_0x9b94('0x4b')],'id');for(var _0x270d9c=0x0,_0x26db4c={},_0x16ffb9={};_0x270d9c<_0x927710[_0x9b94('0x45')];_0x270d9c+=0x1){_0x26db4c=_0x927710[_0x270d9c];if(_[_0x9b94('0x46')](_0x54168d[_0x9b94('0x4b')][_0x26db4c['id']])){_0x54168d[_0x9b94('0x4b')][_0x26db4c['id']]=new Trigger(_0x26db4c);}else{_0x54168d[_0x9b94('0x42')](_0x54168d[_0x9b94('0x4b')][_0x26db4c['id']],_0x26db4c);}}}return _0x54168d[_0x9b94('0x4b')];};};Realtime[_0x9b94('0x43')][_0x9b94('0x4c')]=function(){var _0x55ca70=this;return function(_0x5801de){if(_0x5801de){freeIsNotKey(_0x5801de,_0x55ca70[_0x9b94('0x16')],'id');for(var _0x1d0258=0x0,_0x4d9d4e={},_0xe21967={};_0x1d0258<_0x5801de[_0x9b94('0x45')];_0x1d0258+=0x1){_0x4d9d4e=_0x5801de[_0x1d0258];if(_[_0x9b94('0x46')](_0x55ca70[_0x9b94('0x16')][_0x4d9d4e['id']])){_0x55ca70[_0x9b94('0x16')][_0x4d9d4e['id']]=new Template(_0x4d9d4e);}else{_0x55ca70['mergeFromDatabase'](_0x55ca70[_0x9b94('0x16')][_0x4d9d4e['id']],_0x4d9d4e);}}}return _0x55ca70[_0x9b94('0x16')];};};Realtime[_0x9b94('0x43')][_0x9b94('0x4d')]=function(){var _0x241bae=this;return function(_0x5ac0ba){if(_0x5ac0ba){freeIsNotKey(_0x5ac0ba,_0x241bae[_0x9b94('0x1d')],'id');for(var _0x45091a=0x0,_0x3aa047={},_0x4d3253={};_0x45091a<_0x5ac0ba['length'];_0x45091a+=0x1){_0x3aa047=_0x5ac0ba[_0x45091a];if(_[_0x9b94('0x46')](_0x241bae['zendeskAccounts'][_0x3aa047['id']])){_0x241bae[_0x9b94('0x1d')][_0x3aa047['id']]=new ZendeskAccount(_0x3aa047);}else{_0x241bae[_0x9b94('0x42')](_0x241bae[_0x9b94('0x1d')][_0x3aa047['id']],_0x3aa047);}}}return _0x241bae[_0x9b94('0x1d')];};};Realtime[_0x9b94('0x43')][_0x9b94('0x4e')]=function(){var _0x56be69=this;return function(_0xbeca03){if(_0xbeca03){freeIsNotKey(_0xbeca03,_0x56be69[_0x9b94('0x1e')],'id');for(var _0x420b61=0x0,_0x2f173e={},_0x33f591={};_0x420b61<_0xbeca03[_0x9b94('0x45')];_0x420b61+=0x1){_0x2f173e=_0xbeca03[_0x420b61];if(_[_0x9b94('0x46')](_0x56be69[_0x9b94('0x1e')][_0x2f173e['id']])){_0x56be69[_0x9b94('0x1e')][_0x2f173e['id']]=new SalesforceAccount(_0x2f173e);}else{_0x56be69['mergeFromDatabase'](_0x56be69[_0x9b94('0x1e')][_0x2f173e['id']],_0x2f173e);}}}return _0x56be69[_0x9b94('0x1e')];};};Realtime[_0x9b94('0x43')][_0x9b94('0x4f')]=function(){var _0x1c6c9c=this;return function(_0x5b3ef4){if(_0x5b3ef4){freeIsNotKey(_0x5b3ef4,_0x1c6c9c[_0x9b94('0x20')],'id');for(var _0x228a47=0x0,_0x1b7603={},_0x13c299={};_0x228a47<_0x5b3ef4[_0x9b94('0x45')];_0x228a47+=0x1){_0x1b7603=_0x5b3ef4[_0x228a47];if(_['isUndefined'](_0x1c6c9c[_0x9b94('0x20')][_0x1b7603['id']])){_0x1c6c9c[_0x9b94('0x20')][_0x1b7603['id']]=new FreshdeskAccount(_0x1b7603);}else{_0x1c6c9c['mergeFromDatabase'](_0x1c6c9c['freshdeskAccounts'][_0x1b7603['id']],_0x1b7603);}}}return _0x1c6c9c['freshdeskAccounts'];};};Realtime[_0x9b94('0x43')][_0x9b94('0x50')]=function(){var _0x36b3ac=this;return function(_0x26292d){if(_0x26292d){freeIsNotKey(_0x26292d,_0x36b3ac[_0x9b94('0x21')],'id');for(var _0x508207=0x0,_0x1559b6={},_0x3c7064={};_0x508207<_0x26292d[_0x9b94('0x45')];_0x508207+=0x1){_0x1559b6=_0x26292d[_0x508207];if(_[_0x9b94('0x46')](_0x36b3ac[_0x9b94('0x21')][_0x1559b6['id']])){_0x36b3ac[_0x9b94('0x21')][_0x1559b6['id']]=new ZohoAccount(_0x1559b6);}else{_0x36b3ac[_0x9b94('0x42')](_0x36b3ac[_0x9b94('0x21')][_0x1559b6['id']],_0x1559b6);}}}return _0x36b3ac[_0x9b94('0x21')];};};Realtime['prototype'][_0x9b94('0x51')]=function(){var _0x5b5b7f=this;return function(_0xab140){if(_0xab140){freeIsNotKey(_0xab140,_0x5b5b7f[_0x9b94('0x22')],'id');for(var _0xb9349b=0x0,_0x290495={},_0xe209fd={};_0xb9349b<_0xab140['length'];_0xb9349b+=0x1){_0x290495=_0xab140[_0xb9349b];if(_[_0x9b94('0x46')](_0x5b5b7f['deskAccounts'][_0x290495['id']])){_0x5b5b7f[_0x9b94('0x22')][_0x290495['id']]=new DeskAccount(_0x290495);}else{_0x5b5b7f[_0x9b94('0x42')](_0x5b5b7f['deskAccounts'][_0x290495['id']],_0x290495);}}}return _0x5b5b7f[_0x9b94('0x22')];};};Realtime[_0x9b94('0x43')][_0x9b94('0x52')]=function(){var _0x5d3e7c=this;return function(_0x24e39b){if(_0x24e39b){freeIsNotKey(_0x24e39b,_0x5d3e7c[_0x9b94('0x1f')],'id');for(var _0x1886a2=0x0,_0x443116={},_0x462afc={};_0x1886a2<_0x24e39b['length'];_0x1886a2+=0x1){_0x443116=_0x24e39b[_0x1886a2];if(_[_0x9b94('0x46')](_0x5d3e7c[_0x9b94('0x1f')][_0x443116['id']])){_0x5d3e7c[_0x9b94('0x1f')][_0x443116['id']]=new SugarcrmAccount(_0x443116);}else{_0x5d3e7c[_0x9b94('0x42')](_0x5d3e7c['sugarcrmAccounts'][_0x443116['id']],_0x443116);}}}return _0x5d3e7c['sugarcrmAccounts'];};};Realtime[_0x9b94('0x43')]['initVtigerAccounts']=function(){var _0x5b727e=this;return function(_0x51d80b){if(_0x51d80b){freeIsNotKey(_0x51d80b,_0x5b727e[_0x9b94('0x53')],'id');for(var _0x1e0c2e=0x0,_0x315fd1={},_0x592d97={};_0x1e0c2e<_0x51d80b[_0x9b94('0x45')];_0x1e0c2e+=0x1){_0x315fd1=_0x51d80b[_0x1e0c2e];if(_[_0x9b94('0x46')](_0x5b727e['vtigerAccounts'][_0x315fd1['id']])){_0x5b727e[_0x9b94('0x53')][_0x315fd1['id']]=new VtigerAccount(_0x315fd1);}else{_0x5b727e[_0x9b94('0x42')](_0x5b727e[_0x9b94('0x53')][_0x315fd1['id']],_0x315fd1);}}}return _0x5b727e[_0x9b94('0x53')];};};Realtime[_0x9b94('0x43')][_0x9b94('0x54')]=function(){var _0x513cc2=this;return function(_0x3e521b){if(_0x3e521b){freeIsNotKey(_0x3e521b,_0x513cc2['servicenowAccounts'],'id');for(var _0x345ba7=0x0,_0x4aaa1c={},_0x1cc77a={};_0x345ba7<_0x3e521b[_0x9b94('0x45')];_0x345ba7+=0x1){_0x4aaa1c=_0x3e521b[_0x345ba7];if(_[_0x9b94('0x46')](_0x513cc2[_0x9b94('0x23')][_0x4aaa1c['id']])){_0x513cc2[_0x9b94('0x23')][_0x4aaa1c['id']]=new ServicenowAccount(_0x4aaa1c);}else{_0x513cc2[_0x9b94('0x42')](_0x513cc2[_0x9b94('0x23')][_0x4aaa1c['id']],_0x4aaa1c);}}}return _0x513cc2[_0x9b94('0x23')];};};Realtime[_0x9b94('0x43')][_0x9b94('0x55')]=function(){var _0x893fdb=this;return function(_0x661526){if(_0x661526){freeIsNotKey(_0x661526,_0x893fdb[_0x9b94('0x24')],'id');for(var _0x14b0db=0x0,_0x9687d4={},_0xfde4d7={};_0x14b0db<_0x661526['length'];_0x14b0db+=0x1){_0x9687d4=_0x661526[_0x14b0db];if(_['isUndefined'](_0x893fdb[_0x9b94('0x24')][_0x9687d4['id']])){_0x893fdb[_0x9b94('0x24')][_0x9687d4['id']]=new Dynamics365Account(_0x9687d4);}else{_0x893fdb[_0x9b94('0x42')](_0x893fdb[_0x9b94('0x24')][_0x9687d4['id']],_0x9687d4);}}}return _0x893fdb[_0x9b94('0x24')];};};Realtime[_0x9b94('0x43')]['initFreshsalesAccounts']=function(){var _0x3c3f75=this;return function(_0x5b1732){if(_0x5b1732){freeIsNotKey(_0x5b1732,_0x3c3f75[_0x9b94('0x25')],'id');for(var _0xb67ab9=0x0,_0x5c3bb5={},_0x484199={};_0xb67ab9<_0x5b1732[_0x9b94('0x45')];_0xb67ab9+=0x1){_0x5c3bb5=_0x5b1732[_0xb67ab9];if(_['isUndefined'](_0x3c3f75[_0x9b94('0x25')][_0x5c3bb5['id']])){_0x3c3f75['freshsalesAccounts'][_0x5c3bb5['id']]=new FreshsalesAccount(_0x5c3bb5);}else{_0x3c3f75[_0x9b94('0x42')](_0x3c3f75[_0x9b94('0x25')][_0x5c3bb5['id']],_0x5c3bb5);}}}return _0x3c3f75['freshsalesAccounts'];};};Realtime[_0x9b94('0x43')][_0x9b94('0x56')]=function(){var _0x23add7=this;return function(_0x1f6939){for(var _0x21c334=0x0;_0x21c334<_0x1f6939[_0x9b94('0x45')];_0x21c334+=0x1){_['merge'](_0x23add7[_0x9b94('0x15')][_0x1f6939[_0x21c334][_0x9b94('0x2a')]],_0x1f6939[_0x21c334]);}return _0x23add7[_0x9b94('0x15')];};};Realtime[_0x9b94('0x43')][_0x9b94('0x57')]=function(){var _0x5d19ae=this;return function(_0x501bf7){clearVoiceQueues(_0x5d19ae[_0x9b94('0x15')]);if(_0x501bf7){_0x501bf7=_[_0x9b94('0x58')](_0x501bf7,_0x9b94('0x59'));for(var _0x53d893 in _0x501bf7){if(_0x501bf7['hasOwnProperty'](_0x53d893)){var _0x246ced={};for(var _0x31cb2e=0x0;_0x31cb2e<_0x501bf7[_0x53d893][_0x9b94('0x45')];_0x31cb2e+=0x1){var _0x3856a4=_0x501bf7[_0x53d893][_0x31cb2e][_0x9b94('0x5a')];if(_0x5d19ae['voiceQueues'][_0x3856a4]){if(_0x501bf7[_0x53d893][_0x31cb2e]['queuecallerexit']){_0x5d19ae['voiceQueues'][_0x3856a4][_0x9b94('0x34')]+=0x1;}if(_0x501bf7[_0x53d893][_0x31cb2e][_0x9b94('0x5b')]){_0x5d19ae[_0x9b94('0x15')][_0x3856a4]['abandoned']+=0x1;}_0x5d19ae[_0x9b94('0x15')][_0x3856a4][_0x9b94('0x2f')]+=moment(_0x501bf7[_0x53d893][_0x31cb2e][_0x9b94('0x5c')])['diff'](moment(_0x501bf7[_0x53d893][_0x31cb2e][_0x9b94('0x5d')]),'seconds')||0x0;if(_0x31cb2e===_0x501bf7[_0x53d893][_0x9b94('0x45')]-0x1){_0x5d19ae['voiceQueues'][_0x3856a4][_0x9b94('0x30')]+=moment(_0x501bf7[_0x53d893][_0x31cb2e][_0x9b94('0x5e')]||_0x501bf7[_0x53d893][_0x31cb2e]['queuecallerabandonAt']||_0x501bf7[_0x53d893][_0x31cb2e]['queuecallerexitAt'])[_0x9b94('0x5f')](moment(_0x501bf7[_0x53d893][_0x31cb2e][_0x9b94('0x5d')]),_0x9b94('0x60'))||0x0;_0x5d19ae['voiceQueues'][_0x3856a4]['total']+=0x1;if(_0x501bf7[_0x53d893][_0x31cb2e]['queuecallercomplete']){_0x5d19ae[_0x9b94('0x15')][_0x3856a4]['answered']+=0x1;_0x5d19ae[_0x9b94('0x15')][_0x3856a4][_0x9b94('0x36')]+=moment(_0x501bf7[_0x53d893][_0x31cb2e][_0x9b94('0x5e')])['diff'](moment(_0x501bf7[_0x53d893][_0x31cb2e]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x5d19ae[_0x9b94('0x15')][_0x3856a4][_0x9b94('0x30')]+=_0x5d19ae[_0x9b94('0x15')][_0x3856a4][_0x9b94('0x2f')]||0x0;}}}}}}return _0x5d19ae[_0x9b94('0x15')];};};Realtime[_0x9b94('0x43')][_0x9b94('0x61')]=function(){var _0x5876cc=this;return function(_0x3234e4){clearVoiceCallReports(_0x5876cc[_0x9b94('0x17')]);if(_0x3234e4){for(var _0x2c8c6e=0x0;_0x2c8c6e<_0x3234e4['length'];_0x2c8c6e+=0x1){_0x5876cc[_0x9b94('0x17')][_0x9b94('0x2d')]+=0x1;_0x5876cc[_0x9b94('0x17')][_0x9b94('0x30')]+=_0x3234e4[_0x2c8c6e][_0x9b94('0x62')];if(_0x3234e4[_0x2c8c6e]['disposition']===_0x9b94('0x63')){_0x5876cc['outbound'][_0x9b94('0x2e')]+=0x1;_0x5876cc['outbound'][_0x9b94('0x2f')]+=_0x3234e4[_0x2c8c6e][_0x9b94('0x62')]-_0x3234e4[_0x2c8c6e][_0x9b94('0x64')]||0x0;_0x5876cc['outbound'][_0x9b94('0x36')]+=_0x3234e4[_0x2c8c6e]['billableseconds'];}}}return _0x5876cc['outbound'];};};Realtime[_0x9b94('0x43')][_0x9b94('0x65')]=function(){var _0x2f8fe4=this;return function(_0x4cc810){if(_0x4cc810){freeIsNotKey(_0x4cc810,_0x2f8fe4[_0x9b94('0x66')],_0x9b94('0x2a'));for(var _0x9070e8=0x0,_0x9e0376={};_0x9070e8<_0x4cc810[_0x9b94('0x45')];_0x9070e8+=0x1){_0x9e0376=_0x4cc810[_0x9070e8];if(_[_0x9b94('0x46')](_0x2f8fe4['campaigns'][_0x9e0376[_0x9b94('0x2a')]])){_0x2f8fe4['campaigns'][_0x9e0376['name']]=new Campaign(_0x9e0376);}else{_0x2f8fe4[_0x9b94('0x42')](_0x2f8fe4['campaigns'][_0x9e0376['name']],_0x9e0376);_0x2f8fe4[_0x9b94('0x66')][_0x9e0376[_0x9b94('0x2a')]][_0x9b94('0x67')]=_0x9e0376[_0x9b94('0x68')]?_0x9e0376[_0x9b94('0x68')]['name']:undefined;}}}return _0x2f8fe4['campaigns'];};};Realtime['prototype'][_0x9b94('0x69')]=function(){var _0x2ab01f=this;return function(_0x158421){if(_0x158421){freeIsNotKey(_0x158421,_0x2ab01f['voiceExtensions'],'id');for(var _0x1edc73=0x0,_0x58e5b2={};_0x1edc73<_0x158421[_0x9b94('0x45')];_0x1edc73+=0x1){_0x58e5b2=_0x158421[_0x1edc73];if(_[_0x9b94('0x46')](_0x2ab01f[_0x9b94('0x18')][_0x58e5b2['id']])){_0x2ab01f[_0x9b94('0x18')][_0x58e5b2['id']]=new VoiceExtension(_0x58e5b2);}else{_0x2ab01f[_0x9b94('0x42')](_0x2ab01f[_0x9b94('0x18')][_0x58e5b2['id']],_0x58e5b2);}}}return _0x2ab01f[_0x9b94('0x18')];};};Realtime[_0x9b94('0x43')][_0x9b94('0x6a')]=function(){var _0x305f71=this;return function(_0x229073){clearCampaigns(_0x305f71[_0x9b94('0x66')]);for(var _0x3c4ed4=0x0;_0x3c4ed4<_0x229073['length'];_0x3c4ed4+=0x1){_[_0x9b94('0x6b')](_0x305f71['campaigns'][_0x229073[_0x3c4ed4]['name']],_0x229073[_0x3c4ed4]);}return _0x305f71[_0x9b94('0x66')];};};Realtime[_0x9b94('0x43')]['initFaxAccounts']=function(){var _0x53f3a0=this;return function(_0x16385c){if(_0x16385c){freeIsNotKey(_0x16385c,_0x53f3a0['faxAccounts'],'id');for(var _0x17965e=0x0,_0x34f04e={},_0x2cf2ee={};_0x17965e<_0x16385c[_0x9b94('0x45')];_0x17965e+=0x1){_0x34f04e=_0x16385c[_0x17965e];if(_[_0x9b94('0x46')](_0x53f3a0[_0x9b94('0x26')][_0x34f04e['id']])){_0x53f3a0['faxAccounts'][_0x34f04e['id']]=new FaxAccount(_0x34f04e);}else{_0x53f3a0[_0x9b94('0x42')](_0x53f3a0[_0x9b94('0x26')][_0x34f04e['id']],_0x34f04e);}}}return _0x53f3a0[_0x9b94('0x26')];};};module[_0x9b94('0x6c')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index f7dad61..d894e4f 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 _0x8a0d=['custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','accountcode','name','isNil','find','length','findAgent','assigned','lastAssignedTo','interface','format','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','create','match','destination','exten','type','queue','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','channel','calleridnum','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','uniqueid','linkedid','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x8a0d,0xf3));var _0xd8a0=function(_0x370c36,_0x53b0a4){_0x370c36=_0x370c36-0x0;var _0x5a8d22=_0x8a0d[_0x370c36];return _0x5a8d22;};'use strict';var _=require(_0xd8a0('0x0'));var moment=require(_0xd8a0('0x1'));var util=require(_0xd8a0('0x2'));var config=require(_0xd8a0('0x3'));var ami=require(_0xd8a0('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xd8a0('0x5'));var RpcVoiceDialReport=require(_0xd8a0('0x6'));var RpcMemberReport=require(_0xd8a0('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xd8a0('0x8'));var RpcVoiceTransferReport=require(_0xd8a0('0x9'));var VoiceQueueReport=require(_0xd8a0('0xa'));var VoiceCallReport=require(_0xd8a0('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xd8a0('0xc'));var UserReport=require(_0xd8a0('0xd'));function Report(_0x48e8b8){this[_0xd8a0('0xe')]=_0x48e8b8;this['agents']=_0x48e8b8[_0xd8a0('0xf')];this[_0xd8a0('0x10')]=_0x48e8b8['telephones'];}Report[_0xd8a0('0x11')][_0xd8a0('0x12')]=function(_0x2e1e4e){var _0x21f4d3=new VoiceQueueReport(this[_0xd8a0('0xe')]);var _0x5c9b85=new VoiceAgentReport(this[_0xd8a0('0xe')]);var _0x1dd0d5=new VoiceDialReport(this[_0xd8a0('0xe')]);var _0x488c67=new VoiceCallReport(this[_0xd8a0('0xe')]);var _0xe4364f=new UserReport(this[_0xd8a0('0xe')]);if(config[_0xd8a0('0x13')]&&config[_0xd8a0('0x13')][_0xd8a0('0x14')]){ami['on'](_0xd8a0('0x15'),this[_0xd8a0('0x16')][_0xd8a0('0x17')](this));ami['on'](_0xd8a0('0x18'),this[_0xd8a0('0x19')][_0xd8a0('0x17')](this));ami['on'](_0xd8a0('0x1a'),this[_0xd8a0('0x1b')][_0xd8a0('0x17')](this));ami['on'](_0xd8a0('0x1c'),this[_0xd8a0('0x1d')]['bind'](this));ami['on'](_0xd8a0('0x1e'),this[_0xd8a0('0x1f')][_0xd8a0('0x17')](this));ami['on'](_0xd8a0('0x20'),this[_0xd8a0('0x21')][_0xd8a0('0x17')](this));}};Report[_0xd8a0('0x11')]['findAgent']=function(_0x1d38fc){var _0x28f17d;_0x28f17d=_['find'](this[_0xd8a0('0xf')],function(_0x66f5ac){return _0x66f5ac[_0xd8a0('0x22')]==_0x1d38fc||_0x66f5ac[_0xd8a0('0x23')]==_0x1d38fc;});if(_[_0xd8a0('0x24')](_0x28f17d)){var _0x2b421f=_[_0xd8a0('0x25')](this[_0xd8a0('0x10')],function(_0x3eab90){return _0x3eab90[_0xd8a0('0x22')]==_0x1d38fc||_0x3eab90[_0xd8a0('0x23')]==_0x1d38fc;});if(_0x2b421f){_0x28f17d=_[_0xd8a0('0x25')](this[_0xd8a0('0xf')],function(_0x5d1d34){return _0x5d1d34['interface']==util['format']('SIP/%s',_0x2b421f[_0xd8a0('0x23')]);});}}return _0x28f17d;};Report[_0xd8a0('0x11')][_0xd8a0('0x16')]=function(_0x1c4ca8){for(var _0x576557=0x0;_0x576557<_0x1c4ca8[_0xd8a0('0x26')];_0x576557+=0x1){var _0x2144fc=this[_0xd8a0('0x27')](_0x1c4ca8[_0x576557]['connectedlinenum']);if(_0x2144fc){_0x1c4ca8[_0x576557][_0xd8a0('0x22')]=_0x2144fc[_0xd8a0('0x22')];_0x1c4ca8[_0x576557][_0xd8a0('0x28')]=!![];_0x1c4ca8[_0x576557][_0xd8a0('0x29')]=_0x2144fc[_0xd8a0('0x23')];_0x1c4ca8[_0x576557][_0xd8a0('0x2a')]=_[_0xd8a0('0x24')](_0x2144fc[_0xd8a0('0x2a')])?util[_0xd8a0('0x2b')](_0xd8a0('0x2c'),_0x2144fc[_0xd8a0('0x23')]):_0x2144fc[_0xd8a0('0x2a')];if(_0x1c4ca8[_0x576557][_0xd8a0('0x2d')]){_0x1c4ca8[_0x576557]['queuecallercompleteAt']=moment()[_0xd8a0('0x2b')](_0xd8a0('0x2e'));}if(_0x1c4ca8[_0x576557][_0xd8a0('0x2f')]){_0x1c4ca8[_0x576557]['queuecallerexitAt']=moment()['format'](_0xd8a0('0x2e'));}RpcMemberReport[_0xd8a0('0x16')](_0x1c4ca8[_0x576557]);}RpcVoiceQueueReport[_0xd8a0('0x30')](_0x1c4ca8[_0x576557]);}};function extractCalleridNumber(_0x3d3334){var _0xfdc59d=_0x3d3334[_0xd8a0('0x31')](/<(.*?)>/);return _0xfdc59d?_0xfdc59d[0x1]:_0x3d3334;}Report[_0xd8a0('0x11')][_0xd8a0('0x19')]=function(_0x353bf0){_0x353bf0['destination']=_0x353bf0[_0xd8a0('0x32')]||_0x353bf0[_0xd8a0('0x33')];if(_0x353bf0[_0xd8a0('0x34')]=='dialer'){_0x353bf0['lastapplication']=_0xd8a0('0x35');_0x353bf0['lastdata']=_0x353bf0['queue'];if(_0x353bf0[_0xd8a0('0x36')]==_0xd8a0('0x37')){_0x353bf0[_0xd8a0('0x22')]='';_0x353bf0[_0xd8a0('0x32')]=extractCalleridNumber(_0x353bf0[_0xd8a0('0x38')]);}else if(_0x353bf0[_0xd8a0('0x36')]=='from-sip'){if(_0x353bf0[_0xd8a0('0x32')]==_0xd8a0('0x39')){_0x353bf0['destination']=extractCalleridNumber(_0x353bf0[_0xd8a0('0x3a')]);_0x353bf0['calleridnum']=_0x353bf0[_0xd8a0('0x3b')];_0x353bf0[_0xd8a0('0x3c')]=[_0x353bf0[_0xd8a0('0x3d')],_0x353bf0['channel']=_0x353bf0[_0xd8a0('0x3c')]][0x0];_0x353bf0[_0xd8a0('0x38')]=_0x353bf0[_0xd8a0('0x3a')];}else{_0x353bf0[_0xd8a0('0x32')]=_0x353bf0[_0xd8a0('0x3e')];_0x353bf0['calleridnum']=_0x353bf0[_0xd8a0('0x3b')];if(_0x353bf0[_0xd8a0('0x3f')]==_0xd8a0('0x40')){_0x353bf0[_0xd8a0('0x22')]=_0x353bf0[_0xd8a0('0x41')];}else{_0x353bf0[_0xd8a0('0x22')]='';}}}}else{_0x353bf0['callerid']=util[_0xd8a0('0x2b')](_0xd8a0('0x42'),_0x353bf0[_0xd8a0('0x43')],_0x353bf0[_0xd8a0('0x3e')]);}if(RpcVoiceTransferReport['transfers'][_0x353bf0['linkedid']]){var _0x268d7c=RpcVoiceTransferReport[_0xd8a0('0x44')][_0x353bf0['linkedid']];_0x268d7c['transfereelinkedid']=_0x353bf0[_0xd8a0('0x45')];RpcVoiceTransferReport[_0xd8a0('0x1f')](_0x268d7c);delete RpcVoiceTransferReport['transfers'][_0x353bf0[_0xd8a0('0x46')]];}RpcVoiceCallReport[_0xd8a0('0x30')](_0x353bf0);if(_0x353bf0[_0xd8a0('0x47')]){for(var _0x29e830=0x0;_0x29e830<_0x353bf0[_0xd8a0('0x48')][_0xd8a0('0x26')];_0x29e830+=0x1){_0x353bf0[_0xd8a0('0x49')]=_0x353bf0[_0xd8a0('0x48')][_0x29e830][_0xd8a0('0x4a')];_0x353bf0['createdAt']=_0x353bf0[_0xd8a0('0x48')][_0x29e830][_0xd8a0('0x4b')];if(_0x353bf0['exten']=='xcally-motion-preview'){_0x353bf0[_0xd8a0('0x3e')]=_0x353bf0['connectedlinenum'];_0x353bf0['calleridname']=_0x353bf0['connectedlinename'];_0x353bf0[_0xd8a0('0x41')]=_0x353bf0[_0xd8a0('0x22')];_0x353bf0[_0xd8a0('0x4c')]=_0x353bf0[_0xd8a0('0x4d')];_0x353bf0[_0xd8a0('0x33')]=_0x353bf0[_0xd8a0('0x3b')];}else if(_0x353bf0['exten']==_0xd8a0('0x4e')){_0x353bf0[_0xd8a0('0x3e')]=_0x353bf0[_0xd8a0('0x32')];_0x353bf0[_0xd8a0('0x33')]=_0x353bf0['originatecalleridnum'];}RpcVoiceRecording['create'](_0x353bf0);}}};Report[_0xd8a0('0x11')][_0xd8a0('0x1b')]=function(_0x12bf3a){if(_[_0xd8a0('0x4f')](_0x12bf3a)){_0x12bf3a[_0xd8a0('0x50')](function(_0x177ef9){RpcVoiceAgentReport[_0xd8a0('0x30')](_0x177ef9);});}else{RpcVoiceAgentReport[_0xd8a0('0x30')](_0x12bf3a);}};Report[_0xd8a0('0x11')]['voiceDialReport']=function(_0x578476){RpcVoiceDialReport[_0xd8a0('0x30')](_0x578476);var _0x5301b3;var _0x21d612;var _0x544556=_0x578476[_0xd8a0('0x3d')];if(_[_0xd8a0('0x51')](_0x544556,'Local')){_0x21d612=_0x544556[_0xd8a0('0x52')](_0x544556[_0xd8a0('0x53')]('/')+0x1,_0x544556[_0xd8a0('0x53')]('@'));_0x5301b3=_[_0xd8a0('0x25')](this[_0xd8a0('0xf')],function(_0x363d0c){return _0x363d0c[_0xd8a0('0x54')]==_0x21d612||_0x363d0c[_0xd8a0('0x55')]==_0x21d612||_0x363d0c['accountcode']==_0x21d612;});}else{_0x21d612=_0x544556['substring'](_0x544556[_0xd8a0('0x53')]('/')+0x1,_0x544556[_0xd8a0('0x56')]('-'));_0x5301b3=this[_0xd8a0('0x27')](_0x21d612);}if(_0x5301b3){_0x578476[_0xd8a0('0x2a')]=_['isNil'](_0x5301b3['interface'])?util[_0xd8a0('0x2b')](_0xd8a0('0x2c'),_0x5301b3[_0xd8a0('0x23')]):_0x5301b3[_0xd8a0('0x2a')];_0x578476[_0xd8a0('0x4d')]=_0x5301b3[_0xd8a0('0x23')];_0x578476[_0xd8a0('0x22')]=_0x5301b3[_0xd8a0('0x22')];RpcMemberReport['voiceDialReport'](_0x578476);}};Report[_0xd8a0('0x11')]['blindTransfer']=function(_0x1988ac){RpcVoiceTransferReport[_0xd8a0('0x44')][_0x1988ac[_0xd8a0('0x57')]]=_0x1988ac;};Report['prototype'][_0xd8a0('0x21')]=function(_0xdaf38){RpcVoiceTransferReport['attendedTransfer'](_0xdaf38);};module['exports']=Report; \ No newline at end of file +var _0xe64b=['forEach','Local','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','moment','util','../ami','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','voiceQueueReport','voiceCallReport','bind','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','isNil','interface','format','SIP/%s','name','prototype','length','connectedlinenum','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','from-sip','originatecalleridnum','destinationchannel','channel','callerid','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridnum','transfereelinkedid','uniqueid','transfers','linkedid','monitors','monitorFilename','createdAt','calleridname','connectedlinename','membername','isArray'];(function(_0x515aca,_0x27752a){var _0x2161a9=function(_0x486dab){while(--_0x486dab){_0x515aca['push'](_0x515aca['shift']());}};_0x2161a9(++_0x27752a);}(_0xe64b,0xa5));var _0xbe64=function(_0x1777e2,_0x44fd96){_0x1777e2=_0x1777e2-0x0;var _0x55c1a6=_0xe64b[_0x1777e2];return _0x55c1a6;};'use strict';var _=require('lodash');var moment=require(_0xbe64('0x0'));var util=require(_0xbe64('0x1'));var config=require('../../../config/environment');var ami=require(_0xbe64('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xbe64('0x3'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xbe64('0x4'));var RpcVoiceQueueReport=require(_0xbe64('0x5'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xbe64('0x6'));var VoiceQueueReport=require(_0xbe64('0x7'));var VoiceCallReport=require(_0xbe64('0x8'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xbe64('0x9'));var UserReport=require(_0xbe64('0xa'));function Report(_0x41403d){this[_0xbe64('0xb')]=_0x41403d;this[_0xbe64('0xc')]=_0x41403d[_0xbe64('0xc')];this[_0xbe64('0xd')]=_0x41403d[_0xbe64('0xd')];}Report['prototype'][_0xbe64('0xe')]=function(_0x2b8a66){var _0x557d95=new VoiceQueueReport(this[_0xbe64('0xb')]);var _0x570b6f=new VoiceAgentReport(this['realtime']);var _0x107e47=new VoiceDialReport(this[_0xbe64('0xb')]);var _0x21a01a=new VoiceCallReport(this[_0xbe64('0xb')]);var _0x49d72d=new UserReport(this['realtime']);if(config['xdr']&&config[_0xbe64('0xf')]['disabled']){ami['on']('custom:voiceQueueReport',this[_0xbe64('0x10')]['bind'](this));ami['on']('custom:voiceCallReport',this[_0xbe64('0x11')][_0xbe64('0x12')](this));ami['on']('custom:voiceAgentReport',this[_0xbe64('0x13')]['bind'](this));ami['on']('custom:voiceDialReport',this[_0xbe64('0x14')][_0xbe64('0x12')](this));ami['on'](_0xbe64('0x15'),this[_0xbe64('0x16')][_0xbe64('0x12')](this));ami['on'](_0xbe64('0x17'),this[_0xbe64('0x18')][_0xbe64('0x12')](this));}};Report['prototype'][_0xbe64('0x19')]=function(_0xcb5bcb){var _0x3cd96a;_0x3cd96a=_[_0xbe64('0x1a')](this[_0xbe64('0xc')],function(_0x365e4c){return _0x365e4c[_0xbe64('0x1b')]==_0xcb5bcb||_0x365e4c['name']==_0xcb5bcb;});if(_[_0xbe64('0x1c')](_0x3cd96a)){var _0x1319be=_[_0xbe64('0x1a')](this[_0xbe64('0xd')],function(_0x4deec2){return _0x4deec2['accountcode']==_0xcb5bcb||_0x4deec2['name']==_0xcb5bcb;});if(_0x1319be){_0x3cd96a=_[_0xbe64('0x1a')](this[_0xbe64('0xc')],function(_0x320d6a){return _0x320d6a[_0xbe64('0x1d')]==util[_0xbe64('0x1e')](_0xbe64('0x1f'),_0x1319be[_0xbe64('0x20')]);});}}return _0x3cd96a;};Report[_0xbe64('0x21')][_0xbe64('0x10')]=function(_0x10ecd2){for(var _0x48d30e=0x0;_0x48d30e<_0x10ecd2[_0xbe64('0x22')];_0x48d30e+=0x1){var _0x185603=this[_0xbe64('0x19')](_0x10ecd2[_0x48d30e][_0xbe64('0x23')]);if(_0x185603){_0x10ecd2[_0x48d30e][_0xbe64('0x1b')]=_0x185603[_0xbe64('0x1b')];_0x10ecd2[_0x48d30e]['assigned']=!![];_0x10ecd2[_0x48d30e][_0xbe64('0x24')]=_0x185603[_0xbe64('0x20')];_0x10ecd2[_0x48d30e][_0xbe64('0x1d')]=_[_0xbe64('0x1c')](_0x185603[_0xbe64('0x1d')])?util['format'](_0xbe64('0x1f'),_0x185603['name']):_0x185603[_0xbe64('0x1d')];if(_0x10ecd2[_0x48d30e][_0xbe64('0x25')]){_0x10ecd2[_0x48d30e]['queuecallercompleteAt']=moment()[_0xbe64('0x1e')](_0xbe64('0x26'));}if(_0x10ecd2[_0x48d30e][_0xbe64('0x27')]){_0x10ecd2[_0x48d30e][_0xbe64('0x28')]=moment()[_0xbe64('0x1e')](_0xbe64('0x26'));}RpcMemberReport['voiceQueueReport'](_0x10ecd2[_0x48d30e]);}RpcVoiceQueueReport[_0xbe64('0x29')](_0x10ecd2[_0x48d30e]);}};function extractCalleridNumber(_0x2ba84d){var _0x3796b1=_0x2ba84d[_0xbe64('0x2a')](/<(.*?)>/);return _0x3796b1?_0x3796b1[0x1]:_0x2ba84d;}Report['prototype']['voiceCallReport']=function(_0x129415){_0x129415[_0xbe64('0x2b')]=_0x129415['destination']||_0x129415[_0xbe64('0x2c')];if(_0x129415[_0xbe64('0x2d')]==_0xbe64('0x2e')){_0x129415[_0xbe64('0x2f')]=_0xbe64('0x30');_0x129415['lastdata']=_0x129415['queue'];if(_0x129415[_0xbe64('0x31')]==_0xbe64('0x32')){_0x129415[_0xbe64('0x1b')]='';_0x129415['destination']=extractCalleridNumber(_0x129415['callerid']);}else if(_0x129415[_0xbe64('0x31')]==_0xbe64('0x33')){if(_0x129415[_0xbe64('0x2b')]=='xcally-motion-preview'){_0x129415['destination']=extractCalleridNumber(_0x129415['calleridpreview']);_0x129415['calleridnum']=_0x129415[_0xbe64('0x34')];_0x129415[_0xbe64('0x35')]=[_0x129415[_0xbe64('0x36')],_0x129415[_0xbe64('0x36')]=_0x129415[_0xbe64('0x35')]][0x0];_0x129415[_0xbe64('0x37')]=_0x129415[_0xbe64('0x38')];}else{_0x129415[_0xbe64('0x2b')]=_0x129415['calleridnum'];_0x129415['calleridnum']=_0x129415[_0xbe64('0x34')];if(_0x129415[_0xbe64('0x39')]==_0xbe64('0x3a')){_0x129415[_0xbe64('0x1b')]=_0x129415[_0xbe64('0x23')];}else{_0x129415['accountcode']='';}}}}else{_0x129415[_0xbe64('0x37')]=util[_0xbe64('0x1e')](_0xbe64('0x3b'),_0x129415['calleridname'],_0x129415[_0xbe64('0x3c')]);}if(RpcVoiceTransferReport['transfers'][_0x129415['linkedid']]){var _0x5a19cd=RpcVoiceTransferReport['transfers'][_0x129415['linkedid']];_0x5a19cd[_0xbe64('0x3d')]=_0x129415[_0xbe64('0x3e')];RpcVoiceTransferReport[_0xbe64('0x16')](_0x5a19cd);delete RpcVoiceTransferReport[_0xbe64('0x3f')][_0x129415[_0xbe64('0x40')]];}RpcVoiceCallReport[_0xbe64('0x29')](_0x129415);if(_0x129415['monitor']){for(var _0x1fceff=0x0;_0x1fceff<_0x129415[_0xbe64('0x41')][_0xbe64('0x22')];_0x1fceff+=0x1){_0x129415[_0xbe64('0x42')]=_0x129415['monitors'][_0x1fceff]['filename'];_0x129415[_0xbe64('0x43')]=_0x129415['monitors'][_0x1fceff][_0xbe64('0x43')];if(_0x129415['exten']=='xcally-motion-preview'){_0x129415['calleridnum']=_0x129415[_0xbe64('0x23')];_0x129415[_0xbe64('0x44')]=_0x129415[_0xbe64('0x45')];_0x129415['connectedlinenum']=_0x129415[_0xbe64('0x1b')];_0x129415[_0xbe64('0x45')]=_0x129415[_0xbe64('0x46')];_0x129415[_0xbe64('0x2c')]=_0x129415[_0xbe64('0x34')];}else if(_0x129415['exten']=='xcally-motion-dialer'){_0x129415[_0xbe64('0x3c')]=_0x129415[_0xbe64('0x2b')];_0x129415[_0xbe64('0x2c')]=_0x129415['originatecalleridnum'];}RpcVoiceRecording[_0xbe64('0x29')](_0x129415);}}};Report[_0xbe64('0x21')]['voiceAgentReport']=function(_0x31306d){if(_[_0xbe64('0x47')](_0x31306d)){_0x31306d[_0xbe64('0x48')](function(_0x4099fa){RpcVoiceAgentReport[_0xbe64('0x29')](_0x4099fa);});}else{RpcVoiceAgentReport[_0xbe64('0x29')](_0x31306d);}};Report[_0xbe64('0x21')][_0xbe64('0x14')]=function(_0x1490b5){RpcVoiceDialReport[_0xbe64('0x29')](_0x1490b5);var _0x3727bf;var _0x547833;var _0x322346=_0x1490b5['channel'];if(_['startsWith'](_0x322346,_0xbe64('0x49'))){_0x547833=_0x322346['substring'](_0x322346[_0xbe64('0x4a')]('/')+0x1,_0x322346[_0xbe64('0x4a')]('@'));_0x3727bf=_[_0xbe64('0x1a')](this['agents'],function(_0x2ed655){return _0x2ed655[_0xbe64('0x4b')]==_0x547833||_0x2ed655[_0xbe64('0x4c')]==_0x547833||_0x2ed655[_0xbe64('0x1b')]==_0x547833;});}else{_0x547833=_0x322346['substring'](_0x322346['indexOf']('/')+0x1,_0x322346[_0xbe64('0x4d')]('-'));_0x3727bf=this[_0xbe64('0x19')](_0x547833);}if(_0x3727bf){_0x1490b5[_0xbe64('0x1d')]=_['isNil'](_0x3727bf['interface'])?util[_0xbe64('0x1e')](_0xbe64('0x1f'),_0x3727bf[_0xbe64('0x20')]):_0x3727bf['interface'];_0x1490b5['membername']=_0x3727bf['name'];_0x1490b5[_0xbe64('0x1b')]=_0x3727bf['accountcode'];RpcMemberReport[_0xbe64('0x14')](_0x1490b5);}};Report['prototype'][_0xbe64('0x16')]=function(_0x15af79){RpcVoiceTransferReport[_0xbe64('0x3f')][_0x15af79[_0xbe64('0x4e')]]=_0x15af79;};Report[_0xbe64('0x21')][_0xbe64('0x18')]=function(_0x6572c6){RpcVoiceTransferReport[_0xbe64('0x18')](_0x6572c6);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index a11c035..77ea3a6 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 _0x15ae=['trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','stateTime','toNumber','updateStatusRealtime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','startsWith','Local','substring','indexOf','mobile','phone','accountcode','syncPeerStatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','peerstatus','syncRealtimeShow','resolve','then','catch','[userReport][sipshowregistry]','actionDeviceStateList','error','[userReport][devicestatelist]','inspect','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','find','username','stateRegistry','omit','format','name'];(function(_0xdb4e73,_0x30b446){var _0x4578b4=function(_0x119eb5){while(--_0x119eb5){_0xdb4e73['push'](_0xdb4e73['shift']());}};_0x4578b4(++_0x30b446);}(_0x15ae,0x186));var _0xe15a=function(_0x14edc9,_0x40716c){_0x14edc9=_0x14edc9-0x0;var _0x571ce2=_0x15ae[_0x14edc9];return _0x571ce2;};'use strict';var _=require(_0xe15a('0x0'));var moment=require('moment');var util=require(_0xe15a('0x1'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xe15a('0x2'));var logger=require(_0xe15a('0x3'))(_0xe15a('0x4'));var ami=require(_0xe15a('0x5'));config[_0xe15a('0x6')]=_[_0xe15a('0x7')](config['redis'],{'host':_0xe15a('0x8'),'port':0x18eb});var io=require(_0xe15a('0x9'))(new Redis(config[_0xe15a('0x6')]));function UserReport(_0x3e109e){this[_0xe15a('0xa')]=_0x3e109e[_0xe15a('0xa')];this[_0xe15a('0xb')]=_0x3e109e['agents'];this['telephones']=_0x3e109e[_0xe15a('0xc')];ami['on'](_0xe15a('0xd'),this[_0xe15a('0xe')][_0xe15a('0xf')](this));ami['on']('registry',this[_0xe15a('0xe')]['bind'](this));ami['on'](_0xe15a('0x10'),this['syncDeviceState'][_0xe15a('0xf')](this));ami['on'](_0xe15a('0x11'),this['syncPeerStatus'][_0xe15a('0xf')](this));return this[_0xe15a('0x12')]();}function showSipRegistrations(){Promise[_0xe15a('0x13')]()[_0xe15a('0x14')](ami['actionSipShowRegistry']())[_0xe15a('0x15')](function(_0x1d2ec2){logger['error'](_0xe15a('0x16'),util['inspect'](_0x1d2ec2,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xe15a('0x14')](ami[_0xe15a('0x17')]())['catch'](function(_0x28e4c5){logger[_0xe15a('0x18')](_0xe15a('0x19'),util[_0xe15a('0x1a')](_0x28e4c5,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xe15a('0x13')]()[_0xe15a('0x14')](ami['actionSipPeerStatus']())['catch'](function(_0x370377){logger[_0xe15a('0x18')]('[userReport][sippeerstatus]',util['inspect'](_0x370377,{'showHidden':![],'depth':null}));});}UserReport[_0xe15a('0x1b')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xe15a('0x13')]()[_0xe15a('0x14')](showSipRegistrations())[_0xe15a('0x14')](listDeviceStates())[_0xe15a('0x14')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0xe15a('0x1c')]=function(_0x2ca318){return _0x2ca318!==null&&!_[_0xe15a('0x1d')](_0x2ca318);};UserReport['prototype'][_0xe15a('0x1e')]=function(_0x224203,_0x5d4f24,_0x2f16f5){io['to'](_0x224203)[_0xe15a('0x1e')](_0x5d4f24,_0x2f16f5);};UserReport[_0xe15a('0x1b')]['syncRegistry']=function(_0x497f4a){try{if(this[_0xe15a('0x1c')](_0x497f4a)){logger[_0xe15a('0x1f')](_0xe15a('0x20'),_0x497f4a['username'],_0x497f4a[_0xe15a('0x21')]);logger[_0xe15a('0x22')](_0xe15a('0x23'),util['inspect'](_0x497f4a,{'showHidden':![],'depth':null}));var _0x4600cb=_[_0xe15a('0x24')](this[_0xe15a('0xa')],{'defaultuser':_0x497f4a[_0xe15a('0x25')]});if(_0x4600cb){_0x497f4a[_0xe15a('0x26')]=_0x497f4a[_0xe15a('0x21')];_['merge'](_0x4600cb,_[_0xe15a('0x27')](_0x497f4a,['event','actionid','username',_0xe15a('0x21')]));logger[_0xe15a('0x22')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0xe15a('0x1a')](_0x4600cb,{'showHidden':![],'depth':null}));this[_0xe15a('0x1e')](util[_0xe15a('0x28')]('trunk:%s',_0x4600cb[_0xe15a('0x29')]),_0xe15a('0x2a'),_0x4600cb);}}}catch(_0x1a9101){logger[_0xe15a('0x18')](_0xe15a('0x23'),util[_0xe15a('0x1a')](_0x1a9101,{'showHidden':![],'depth':null}));}};UserReport[_0xe15a('0x1b')][_0xe15a('0x2b')]=function(_0x51dde1){try{if(this['isNotNull'](_0x51dde1)){logger[_0xe15a('0x1f')](_0xe15a('0x2c'),_0x51dde1[_0xe15a('0x2d')],_0x51dde1[_0xe15a('0x21')]);logger[_0xe15a('0x22')](_0xe15a('0x2e'),util[_0xe15a('0x1a')](_0x51dde1,{'showHidden':![],'depth':null}));if(this[_0xe15a('0xb')][_0x51dde1[_0xe15a('0x2d')]]){if(!this[_0xe15a('0xb')][_0x51dde1[_0xe15a('0x2d')]][_0xe15a('0x2f')]||_0x51dde1[_0xe15a('0x21')][_0xe15a('0x30')]()=='inuse'){this[_0xe15a('0xb')][_0x51dde1['device']]['local']=![];if(this['agents'][_0x51dde1[_0xe15a('0x2d')]][_0xe15a('0x21')]!==_0x51dde1[_0xe15a('0x21')]['toLowerCase']()){this[_0xe15a('0xb')][_0x51dde1['device']][_0xe15a('0x31')]=_[_0xe15a('0x32')](moment()[_0xe15a('0x28')]('x'));}this[_0xe15a('0xb')][_0x51dde1[_0xe15a('0x2d')]][_0xe15a('0x21')]=_0x51dde1[_0xe15a('0x21')][_0xe15a('0x30')]();this['agents'][_0x51dde1[_0xe15a('0x2d')]][_0xe15a('0x33')](_0x51dde1);}}else if(this[_0xe15a('0xc')][_0x51dde1[_0xe15a('0x2d')]]){if(this[_0xe15a('0xc')][_0x51dde1[_0xe15a('0x2d')]][_0xe15a('0x21')]!==_0x51dde1['state'][_0xe15a('0x30')]()){this[_0xe15a('0xc')][_0x51dde1[_0xe15a('0x2d')]]['stateTime']=_['toNumber'](moment()[_0xe15a('0x28')]('x'));}this[_0xe15a('0xc')][_0x51dde1[_0xe15a('0x2d')]][_0xe15a('0x21')]=_0x51dde1[_0xe15a('0x21')][_0xe15a('0x30')]();logger[_0xe15a('0x22')](_0xe15a('0x34'),util[_0xe15a('0x1a')](this[_0xe15a('0xc')][_0x51dde1[_0xe15a('0x2d')]],{'showHidden':![],'depth':null}));this[_0xe15a('0x1e')](util[_0xe15a('0x28')](_0xe15a('0x35'),this[_0xe15a('0xc')][_0x51dde1['device']][_0xe15a('0x29')]),_0xe15a('0x36'),this[_0xe15a('0xc')][_0x51dde1[_0xe15a('0x2d')]]);}else if(this[_0xe15a('0xa')][_0x51dde1[_0xe15a('0x2d')]]){if(this[_0xe15a('0xa')][_0x51dde1[_0xe15a('0x2d')]][_0xe15a('0x21')]!==_0x51dde1[_0xe15a('0x21')][_0xe15a('0x30')]()){this[_0xe15a('0xa')][_0x51dde1['device']]['stateTime']=_['toNumber'](moment()['format']('x'));}this[_0xe15a('0xa')][_0x51dde1[_0xe15a('0x2d')]][_0xe15a('0x21')]=_0x51dde1['state'][_0xe15a('0x30')]();logger[_0xe15a('0x22')](_0xe15a('0x37'),util[_0xe15a('0x1a')](this[_0xe15a('0xa')][_0x51dde1[_0xe15a('0x2d')]],{'showHidden':![],'depth':null}));this[_0xe15a('0x1e')](util[_0xe15a('0x28')](_0xe15a('0x38'),this[_0xe15a('0xa')][_0x51dde1[_0xe15a('0x2d')]][_0xe15a('0x29')]),_0xe15a('0x2a'),this[_0xe15a('0xa')][_0x51dde1[_0xe15a('0x2d')]]);}else if(_[_0xe15a('0x39')](_0x51dde1[_0xe15a('0x2d')],_0xe15a('0x3a'))){var _0x500010=_0x51dde1['device'];var _0x8cfc23=_0x500010[_0xe15a('0x3b')](_0x500010[_0xe15a('0x3c')]('/')+0x1,_0x500010['indexOf']('@'));var _0x53d589=_['find'](this[_0xe15a('0xb')],function(_0x459178){return _0x459178[_0xe15a('0x3d')]==_0x8cfc23||_0x459178[_0xe15a('0x3e')]==_0x8cfc23||_0x459178[_0xe15a('0x3f')]==_0x8cfc23;});if(_0x53d589){if(_0x53d589['state']!==_0x51dde1[_0xe15a('0x21')][_0xe15a('0x30')]()){_0x53d589['stateTime']=_[_0xe15a('0x32')](moment()['format']('x'));}_0x53d589[_0xe15a('0x21')]=_0x51dde1[_0xe15a('0x21')]['toLowerCase']();_0x53d589['local']=!![];_0x53d589[_0xe15a('0x33')](_0x51dde1);}}}}catch(_0x42e71e){logger[_0xe15a('0x18')](_0xe15a('0x2e'),util[_0xe15a('0x1a')](_0x42e71e,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xe15a('0x40')]=function(_0x4026ec){try{if(this[_0xe15a('0x1c')](_0x4026ec)&&this[_0xe15a('0x1c')](_0x4026ec[_0xe15a('0x11')])){logger[_0xe15a('0x1f')](_0xe15a('0x41'),_0x4026ec[_0xe15a('0x42')],_0x4026ec[_0xe15a('0x43')],_0x4026ec[_0xe15a('0x11')]);logger[_0xe15a('0x22')](_0xe15a('0x44'),util[_0xe15a('0x1a')](_0x4026ec,{'showHidden':![],'depth':null}));if(this[_0xe15a('0xb')][_0x4026ec['peer']]){if(!this[_0xe15a('0xb')][_0x4026ec[_0xe15a('0x42')]][_0xe15a('0x2f')]||_0x4026ec[_0xe15a('0x11')][_0xe15a('0x30')]()=='registered'){this[_0xe15a('0xb')][_0x4026ec[_0xe15a('0x42')]][_0xe15a('0x2f')]=![];this[_0xe15a('0xb')][_0x4026ec[_0xe15a('0x42')]][_0xe15a('0x45')]=_0x4026ec[_0xe15a('0x11')][_0xe15a('0x30')]();this[_0xe15a('0xb')][_0x4026ec[_0xe15a('0x42')]][_0xe15a('0x43')]=_0x4026ec[_0xe15a('0x43')];this[_0xe15a('0xb')][_0x4026ec[_0xe15a('0x42')]][_0xe15a('0x33')](_0x4026ec);}}else if(this['telephones'][_0x4026ec[_0xe15a('0x42')]]){this['telephones'][_0x4026ec[_0xe15a('0x42')]][_0xe15a('0x45')]=_0x4026ec[_0xe15a('0x11')]['toLowerCase']();this[_0xe15a('0xc')][_0x4026ec[_0xe15a('0x42')]][_0xe15a('0x43')]=_0x4026ec[_0xe15a('0x43')];logger[_0xe15a('0x22')](_0xe15a('0x46'),util[_0xe15a('0x1a')](this['telephones'][_0x4026ec[_0xe15a('0x42')]],{'showHidden':![],'depth':null}));this[_0xe15a('0x1e')](util['format'](_0xe15a('0x35'),this[_0xe15a('0xc')][_0x4026ec[_0xe15a('0x42')]]['name']),_0xe15a('0x36'),this[_0xe15a('0xc')][_0x4026ec[_0xe15a('0x42')]]);}else if(this['trunks'][_0x4026ec[_0xe15a('0x42')]]){this[_0xe15a('0xa')][_0x4026ec[_0xe15a('0x42')]][_0xe15a('0x45')]=_0x4026ec[_0xe15a('0x11')][_0xe15a('0x30')]();this[_0xe15a('0xa')][_0x4026ec[_0xe15a('0x42')]][_0xe15a('0x43')]=_0x4026ec[_0xe15a('0x43')];logger[_0xe15a('0x22')](_0xe15a('0x47'),util[_0xe15a('0x1a')](this[_0xe15a('0xa')][_0x4026ec[_0xe15a('0x42')]],{'showHidden':![],'depth':null}));this[_0xe15a('0x1e')](util[_0xe15a('0x28')](_0xe15a('0x38'),this['trunks'][_0x4026ec['peer']][_0xe15a('0x29')]),_0xe15a('0x2a'),this[_0xe15a('0xa')][_0x4026ec[_0xe15a('0x42')]]);}}}catch(_0x5ef20c){logger['error'](_0xe15a('0x44'),util[_0xe15a('0x1a')](_0x5ef20c,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x6a9c=['accountcode','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','bluebird','../../../config/environment','../../../config/logger','ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','[userReport][sipshowregistry]','inspect','actionDeviceStateList','error','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','toNumber','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:%s','Local','indexOf','mobile','phone'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x6a9c,0x128));var _0xc6a9=function(_0xb41bcd,_0x3b0a25){_0xb41bcd=_0xb41bcd-0x0;var _0x5ba0dd=_0x6a9c[_0xb41bcd];return _0x5ba0dd;};'use strict';var _=require(_0xc6a9('0x0'));var moment=require(_0xc6a9('0x1'));var util=require('util');var Redis=require('ioredis');var BPromise=require(_0xc6a9('0x2'));var config=require(_0xc6a9('0x3'));var logger=require(_0xc6a9('0x4'))(_0xc6a9('0x5'));var ami=require('../ami');config[_0xc6a9('0x6')]=_[_0xc6a9('0x7')](config[_0xc6a9('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xc6a9('0x8'))(new Redis(config['redis']));function UserReport(_0x52f74b){this[_0xc6a9('0x9')]=_0x52f74b[_0xc6a9('0x9')];this[_0xc6a9('0xa')]=_0x52f74b['agents'];this[_0xc6a9('0xb')]=_0x52f74b['telephones'];ami['on'](_0xc6a9('0xc'),this[_0xc6a9('0xd')][_0xc6a9('0xe')](this));ami['on']('registry',this[_0xc6a9('0xd')][_0xc6a9('0xe')](this));ami['on']('devicestatechange',this[_0xc6a9('0xf')][_0xc6a9('0xe')](this));ami['on'](_0xc6a9('0x10'),this[_0xc6a9('0x11')][_0xc6a9('0xe')](this));return this[_0xc6a9('0x12')]();}function showSipRegistrations(){Promise[_0xc6a9('0x13')]()[_0xc6a9('0x14')](ami[_0xc6a9('0x15')]())[_0xc6a9('0x16')](function(_0x5266f9){logger['error'](_0xc6a9('0x17'),util[_0xc6a9('0x18')](_0x5266f9,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xc6a9('0x14')](ami[_0xc6a9('0x19')]())[_0xc6a9('0x16')](function(_0x1ed37a){logger[_0xc6a9('0x1a')](_0xc6a9('0x1b'),util['inspect'](_0x1ed37a,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xc6a9('0x13')]()['then'](ami[_0xc6a9('0x1c')]())[_0xc6a9('0x16')](function(_0x32b7b8){logger[_0xc6a9('0x1a')](_0xc6a9('0x1d'),util[_0xc6a9('0x18')](_0x32b7b8,{'showHidden':![],'depth':null}));});}UserReport[_0xc6a9('0x1e')][_0xc6a9('0x12')]=function(){setInterval(function(){BPromise[_0xc6a9('0x13')]()[_0xc6a9('0x14')](showSipRegistrations())[_0xc6a9('0x14')](listDeviceStates())[_0xc6a9('0x14')](showPeersStatus());},0x32c8);};UserReport[_0xc6a9('0x1e')]['isNotNull']=function(_0x4354b7){return _0x4354b7!==null&&!_[_0xc6a9('0x1f')](_0x4354b7);};UserReport[_0xc6a9('0x1e')][_0xc6a9('0x20')]=function(_0x46ff68,_0x279ba3,_0x341244){io['to'](_0x46ff68)[_0xc6a9('0x20')](_0x279ba3,_0x341244);};UserReport[_0xc6a9('0x1e')][_0xc6a9('0xd')]=function(_0x3f0478){try{if(this[_0xc6a9('0x21')](_0x3f0478)){logger[_0xc6a9('0x22')](_0xc6a9('0x23'),_0x3f0478[_0xc6a9('0x24')],_0x3f0478[_0xc6a9('0x25')]);logger[_0xc6a9('0x26')](_0xc6a9('0x27'),util['inspect'](_0x3f0478,{'showHidden':![],'depth':null}));var _0x3af853=_[_0xc6a9('0x28')](this[_0xc6a9('0x9')],{'defaultuser':_0x3f0478['username']});if(_0x3af853){_0x3f0478[_0xc6a9('0x29')]=_0x3f0478[_0xc6a9('0x25')];_['merge'](_0x3af853,_['omit'](_0x3f0478,[_0xc6a9('0x2a'),'actionid',_0xc6a9('0x24'),'state']));logger['debug'](_0xc6a9('0x2b'),util[_0xc6a9('0x18')](_0x3af853,{'showHidden':![],'depth':null}));this['emit'](util[_0xc6a9('0x2c')]('trunk:%s',_0x3af853[_0xc6a9('0x2d')]),_0xc6a9('0x2e'),_0x3af853);}}}catch(_0x19a458){logger['error'](_0xc6a9('0x27'),util[_0xc6a9('0x18')](_0x19a458,{'showHidden':![],'depth':null}));}};UserReport[_0xc6a9('0x1e')][_0xc6a9('0xf')]=function(_0x288ca9){try{if(this[_0xc6a9('0x21')](_0x288ca9)){logger['info'](_0xc6a9('0x2f'),_0x288ca9[_0xc6a9('0x30')],_0x288ca9[_0xc6a9('0x25')]);logger[_0xc6a9('0x26')](_0xc6a9('0x31'),util[_0xc6a9('0x18')](_0x288ca9,{'showHidden':![],'depth':null}));if(this['agents'][_0x288ca9['device']]){if(!this[_0xc6a9('0xa')][_0x288ca9[_0xc6a9('0x30')]][_0xc6a9('0x32')]||_0x288ca9[_0xc6a9('0x25')][_0xc6a9('0x33')]()==_0xc6a9('0x34')){this[_0xc6a9('0xa')][_0x288ca9[_0xc6a9('0x30')]][_0xc6a9('0x32')]=![];if(this[_0xc6a9('0xa')][_0x288ca9['device']][_0xc6a9('0x25')]!==_0x288ca9['state'][_0xc6a9('0x33')]()){this[_0xc6a9('0xa')][_0x288ca9['device']]['stateTime']=_[_0xc6a9('0x35')](moment()[_0xc6a9('0x2c')]('x'));}this[_0xc6a9('0xa')][_0x288ca9[_0xc6a9('0x30')]]['state']=_0x288ca9[_0xc6a9('0x25')]['toLowerCase']();this[_0xc6a9('0xa')][_0x288ca9['device']]['updateStatusRealtime'](_0x288ca9);}}else if(this[_0xc6a9('0xb')][_0x288ca9[_0xc6a9('0x30')]]){if(this[_0xc6a9('0xb')][_0x288ca9[_0xc6a9('0x30')]][_0xc6a9('0x25')]!==_0x288ca9[_0xc6a9('0x25')][_0xc6a9('0x33')]()){this[_0xc6a9('0xb')][_0x288ca9[_0xc6a9('0x30')]][_0xc6a9('0x36')]=_[_0xc6a9('0x35')](moment()[_0xc6a9('0x2c')]('x'));}this['telephones'][_0x288ca9['device']]['state']=_0x288ca9[_0xc6a9('0x25')][_0xc6a9('0x33')]();logger[_0xc6a9('0x26')](_0xc6a9('0x37'),util[_0xc6a9('0x18')](this[_0xc6a9('0xb')][_0x288ca9[_0xc6a9('0x30')]],{'showHidden':![],'depth':null}));this[_0xc6a9('0x20')](util[_0xc6a9('0x2c')](_0xc6a9('0x38'),this['telephones'][_0x288ca9['device']][_0xc6a9('0x2d')]),_0xc6a9('0x39'),this[_0xc6a9('0xb')][_0x288ca9[_0xc6a9('0x30')]]);}else if(this[_0xc6a9('0x9')][_0x288ca9[_0xc6a9('0x30')]]){if(this[_0xc6a9('0x9')][_0x288ca9[_0xc6a9('0x30')]]['state']!==_0x288ca9[_0xc6a9('0x25')][_0xc6a9('0x33')]()){this[_0xc6a9('0x9')][_0x288ca9[_0xc6a9('0x30')]][_0xc6a9('0x36')]=_['toNumber'](moment()['format']('x'));}this[_0xc6a9('0x9')][_0x288ca9['device']][_0xc6a9('0x25')]=_0x288ca9['state']['toLowerCase']();logger['debug'](_0xc6a9('0x3a'),util[_0xc6a9('0x18')](this['trunks'][_0x288ca9[_0xc6a9('0x30')]],{'showHidden':![],'depth':null}));this[_0xc6a9('0x20')](util['format'](_0xc6a9('0x3b'),this['trunks'][_0x288ca9[_0xc6a9('0x30')]][_0xc6a9('0x2d')]),_0xc6a9('0x2e'),this[_0xc6a9('0x9')][_0x288ca9['device']]);}else if(_['startsWith'](_0x288ca9[_0xc6a9('0x30')],_0xc6a9('0x3c'))){var _0x2b7be5=_0x288ca9[_0xc6a9('0x30')];var _0x5cf52f=_0x2b7be5['substring'](_0x2b7be5['indexOf']('/')+0x1,_0x2b7be5[_0xc6a9('0x3d')]('@'));var _0x476122=_[_0xc6a9('0x28')](this[_0xc6a9('0xa')],function(_0x4255c7){return _0x4255c7[_0xc6a9('0x3e')]==_0x5cf52f||_0x4255c7[_0xc6a9('0x3f')]==_0x5cf52f||_0x4255c7[_0xc6a9('0x40')]==_0x5cf52f;});if(_0x476122){if(_0x476122['state']!==_0x288ca9[_0xc6a9('0x25')][_0xc6a9('0x33')]()){_0x476122['stateTime']=_[_0xc6a9('0x35')](moment()[_0xc6a9('0x2c')]('x'));}_0x476122[_0xc6a9('0x25')]=_0x288ca9['state'][_0xc6a9('0x33')]();_0x476122['local']=!![];_0x476122['updateStatusRealtime'](_0x288ca9);}}}}catch(_0x4cb433){logger[_0xc6a9('0x1a')](_0xc6a9('0x31'),util['inspect'](_0x4cb433,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xc6a9('0x11')]=function(_0x1088e7){try{if(this[_0xc6a9('0x21')](_0x1088e7)&&this[_0xc6a9('0x21')](_0x1088e7[_0xc6a9('0x10')])){logger[_0xc6a9('0x22')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x1088e7[_0xc6a9('0x41')],_0x1088e7[_0xc6a9('0x42')],_0x1088e7[_0xc6a9('0x10')]);logger['debug'](_0xc6a9('0x43'),util[_0xc6a9('0x18')](_0x1088e7,{'showHidden':![],'depth':null}));if(this['agents'][_0x1088e7['peer']]){if(!this['agents'][_0x1088e7['peer']]['local']||_0x1088e7['peerstatus'][_0xc6a9('0x33')]()==_0xc6a9('0x44')){this[_0xc6a9('0xa')][_0x1088e7[_0xc6a9('0x41')]][_0xc6a9('0x32')]=![];this[_0xc6a9('0xa')][_0x1088e7[_0xc6a9('0x41')]][_0xc6a9('0x45')]=_0x1088e7[_0xc6a9('0x10')][_0xc6a9('0x33')]();this[_0xc6a9('0xa')][_0x1088e7[_0xc6a9('0x41')]]['address']=_0x1088e7[_0xc6a9('0x42')];this['agents'][_0x1088e7['peer']]['updateStatusRealtime'](_0x1088e7);}}else if(this[_0xc6a9('0xb')][_0x1088e7[_0xc6a9('0x41')]]){this[_0xc6a9('0xb')][_0x1088e7[_0xc6a9('0x41')]][_0xc6a9('0x45')]=_0x1088e7['peerstatus'][_0xc6a9('0x33')]();this[_0xc6a9('0xb')][_0x1088e7[_0xc6a9('0x41')]][_0xc6a9('0x42')]=_0x1088e7[_0xc6a9('0x42')];logger['debug'](_0xc6a9('0x46'),util[_0xc6a9('0x18')](this[_0xc6a9('0xb')][_0x1088e7['peer']],{'showHidden':![],'depth':null}));this[_0xc6a9('0x20')](util[_0xc6a9('0x2c')](_0xc6a9('0x38'),this[_0xc6a9('0xb')][_0x1088e7[_0xc6a9('0x41')]]['name']),'telephone:save',this[_0xc6a9('0xb')][_0x1088e7['peer']]);}else if(this[_0xc6a9('0x9')][_0x1088e7[_0xc6a9('0x41')]]){this[_0xc6a9('0x9')][_0x1088e7['peer']]['status']=_0x1088e7[_0xc6a9('0x10')]['toLowerCase']();this[_0xc6a9('0x9')][_0x1088e7['peer']][_0xc6a9('0x42')]=_0x1088e7[_0xc6a9('0x42')];logger['debug'](_0xc6a9('0x47'),util[_0xc6a9('0x18')](this[_0xc6a9('0x9')][_0x1088e7[_0xc6a9('0x41')]],{'showHidden':![],'depth':null}));this[_0xc6a9('0x20')](util[_0xc6a9('0x2c')]('trunk:%s',this['trunks'][_0x1088e7[_0xc6a9('0x41')]][_0xc6a9('0x2d')]),_0xc6a9('0x2e'),this[_0xc6a9('0x9')][_0x1088e7['peer']]);}}}catch(_0x2ae263){logger['error']('[userReport][peerstatus]',util[_0xc6a9('0x18')](_0x2ae263,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 9e015a0..f506108 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(_0x1f52be,_0x4d1676){var _0x2a0f2a=function(_0x1babcf){while(--_0x1babcf){_0x1f52be['push'](_0x1f52be['shift']());}};_0x2a0f2a(++_0x4d1676);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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(_0x13986f,_0x4d5b9d){var _0xb5830f=function(_0xcfdc82){while(--_0xcfdc82){_0x13986f['push'](_0x13986f['shift']());}};_0xb5830f(++_0x4d5b9d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 2863747..fcae4e0 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 _0x0296=['syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','inspect','isUndefined','prototype','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','split','exten','channel','destconnectedlinenum','connectedlinenum','format','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','isNotNull','OutgoingSpoolFailed','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','debug','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','CDR(routeAlias)','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','seconds','includes','lastapplication','lastdata','set','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','answertime','diff','xcally-motion-preview','destinationchannel','UserId','membername','from-sip','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','.WAV','monitorFilename','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','callerid','xmd-cdrtype','type','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','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','mixmonitor_filename','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','user:agentcomplete','then','transferType','undefined','isEmpty','getSettings','resolve','Action','StopMixMonitor','catch','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transferconnectedlinenum','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','ringing','ringinuse','onhold','queue','agi','dial','playback','NO\x20ANSWER','FAILED','ANSWERED','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','attendedtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop'];(function(_0x5e281c,_0x575467){var _0x1254ac=function(_0x266d57){while(--_0x266d57){_0x5e281c['push'](_0x5e281c['shift']());}};_0x1254ac(++_0x575467);}(_0x0296,0x99));var _0x6029=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0x0296[_0x53b53e];return _0xbb6179;};'use strict';var BPromise=require('bluebird');var _=require(_0x6029('0x0'));var moment=require('moment');var util=require('util');var path=require(_0x6029('0x1'));var Redis=require(_0x6029('0x2'));var config=require(_0x6029('0x3'));var logger=require(_0x6029('0x4'))(_0x6029('0x5'));var ami=require(_0x6029('0x6'));var Channel=require(_0x6029('0x7'));var RpcSetting=require(_0x6029('0x8'));var statusDesc=[_0x6029('0x9'),_0x6029('0xa'),_0x6029('0xb'),_0x6029('0xc'),'invalid','unavailable',_0x6029('0xd'),_0x6029('0xe'),_0x6029('0xf')];var applications=['set',_0x6029('0x10'),_0x6029('0x11'),_0x6029('0x12'),_0x6029('0x13'),'voicemail'];var dispositions=[_0x6029('0x14'),_0x6029('0x15'),_0x6029('0x15'),_0x6029('0x14'),_0x6029('0x14'),_0x6029('0x14'),_0x6029('0x16'),'BUSY','FAILED','FAILED',_0x6029('0x15')];var actions={};config[_0x6029('0x17')]=_['defaults'](config[_0x6029('0x17')],{'host':_0x6029('0x18'),'port':0x18eb});var io=require(_0x6029('0x19'))(new Redis(config[_0x6029('0x17')]));function VoiceCallReport(_0x371162){this[_0x6029('0x1a')]=_0x371162['channels'];this['agents']=_0x371162[_0x6029('0x1b')];this['blindTransfers']={};ami['on'](_0x6029('0x1c'),this[_0x6029('0x1d')][_0x6029('0x1e')](this));ami['on'](_0x6029('0x1f'),this[_0x6029('0x1d')][_0x6029('0x1e')](this));ami['on']('newchannel',this[_0x6029('0x20')][_0x6029('0x1e')](this));ami['on'](_0x6029('0x21'),this[_0x6029('0x22')][_0x6029('0x1e')](this));ami['on'](_0x6029('0x23'),this[_0x6029('0x24')][_0x6029('0x1e')](this));ami['on'](_0x6029('0x25'),this[_0x6029('0x26')][_0x6029('0x1e')](this));ami['on'](_0x6029('0x27'),this['syncNewCallerId'][_0x6029('0x1e')](this));ami['on'](_0x6029('0x28'),this['syncAttendedTransfer'][_0x6029('0x1e')](this));ami['on']('blindtransfer',this[_0x6029('0x29')][_0x6029('0x1e')](this));ami['on'](_0x6029('0x2a'),this[_0x6029('0x2b')][_0x6029('0x1e')](this));ami['on'](_0x6029('0x2c'),this[_0x6029('0x2d')][_0x6029('0x1e')](this));try{logger[_0x6029('0x2e')](_0x6029('0x2f'));ami[_0x6029('0x30')]();}catch(_0x5b6ee4){logger[_0x6029('0x31')]('[voiceCallReport][coreshowchannels]',util[_0x6029('0x32')](_0x5b6ee4,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x5ebf5e){return _0x5ebf5e!==null&&!_[_0x6029('0x33')](_0x5ebf5e);};VoiceCallReport[_0x6029('0x34')]['emit']=function(_0x5a6a68,_0x367528,_0x268b94){io['to'](_0x5a6a68)[_0x6029('0x35')](_0x367528,_0x268b94);};VoiceCallReport['prototype'][_0x6029('0x36')]=function(_0x320672){try{if(this['isNotNull'](_0x320672)){logger[_0x6029('0x2e')](_0x6029('0x37'),_0x320672[_0x6029('0x38')],_0x320672[_0x6029('0x39')],_0x320672['calleridnum']);logger['debug'](_0x6029('0x3a'),_0x320672[_0x6029('0x38')],util[_0x6029('0x32')](_0x320672,{'showHidden':![],'depth':null}));if(_0x320672[_0x6029('0x38')]===_0x320672[_0x6029('0x3b')]){if(!_[_0x6029('0x33')](this['channels'][_0x320672[_0x6029('0x38')]])){_[_0x6029('0x3c')](this[_0x6029('0x1a')][_0x320672[_0x6029('0x38')]],_[_0x6029('0x3d')](_0x320672,_[_0x6029('0x3e')](this['channels'][_0x320672[_0x6029('0x38')]])));}}if(_0x320672[_0x6029('0x3f')]==='from-sip'){if(this[_0x6029('0x1b')][_0x320672['channel'][_0x6029('0x40')]('-')[0x0]]){if(_0x320672[_0x6029('0x41')]=='xcally-motion-preview'){this[_0x6029('0x1b')][_0x320672[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]][_0x6029('0x43')]=_0x320672[_0x6029('0x44')];this[_0x6029('0x35')](util[_0x6029('0x45')]('user:%s',this[_0x6029('0x1b')][_0x320672[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]][_0x6029('0x46')]),_0x6029('0x47'),{'destaccountcode':this['agents'][_0x320672[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]][_0x6029('0x48')],'destconnectedlinenum':_0x320672['connectedlinenum']});}}}}}catch(_0x1d959b){logger[_0x6029('0x31')](_0x6029('0x49'),_0x320672['uniqueid'],util[_0x6029('0x32')](_0x1d959b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6029('0x34')][_0x6029('0x20')]=function(_0x59666f){try{if(this[_0x6029('0x4a')](_0x59666f)){logger['debug']('[%s][voiceCallReport][newchannel]\x20event:',_0x59666f['uniqueid'],util[_0x6029('0x32')](_0x59666f,{'showHidden':![],'depth':null}));if(_0x59666f['uniqueid']===_0x59666f[_0x6029('0x3b')]&&_0x59666f[_0x6029('0x42')]!=_0x6029('0x4b')){if(_['isUndefined'](this['channels'][_0x59666f[_0x6029('0x38')]])){logger[_0x6029('0x2e')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x59666f[_0x6029('0x38')],_0x59666f[_0x6029('0x3f')],_0x59666f['exten']);this[_0x6029('0x1a')][_0x59666f[_0x6029('0x38')]]=new Channel();this[_0x6029('0x1a')][_0x59666f['uniqueid']][_0x6029('0x4c')]=moment()[_0x6029('0x45')](_0x6029('0x4d'));this[_0x6029('0x1a')][_0x59666f[_0x6029('0x38')]][_0x6029('0x4e')]=dispositions[_[_0x6029('0x4f')](_0x59666f['channelstate'])];_[_0x6029('0x3c')](this[_0x6029('0x1a')][_0x59666f[_0x6029('0x38')]],_[_0x6029('0x3d')](_0x59666f,_[_0x6029('0x3e')](this[_0x6029('0x1a')][_0x59666f[_0x6029('0x38')]])));if(_0x59666f[_0x6029('0x3f')]==='from-sip'){if(this[_0x6029('0x1b')][_0x59666f[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]]){if(_[_0x6029('0x33')](this[_0x6029('0x1b')][_0x59666f['channel'][_0x6029('0x40')]('-')[0x0]]['destconnectedlinenum'])){this[_0x6029('0x1b')][_0x59666f[_0x6029('0x42')]['split']('-')[0x0]][_0x6029('0x43')]=_0x59666f[_0x6029('0x41')];logger[_0x6029('0x50')](_0x6029('0x51'),_0x59666f['uniqueid'],util['inspect']({'destaccountcode':this[_0x6029('0x1b')][_0x59666f['channel'][_0x6029('0x40')]('-')[0x0]][_0x6029('0x48')],'destconnectedlinenum':_0x59666f['exten']},{'showHidden':![],'depth':null}));this[_0x6029('0x35')](util[_0x6029('0x45')](_0x6029('0x52'),this[_0x6029('0x1b')][_0x59666f[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]][_0x6029('0x46')]),_0x6029('0x47'),{'destaccountcode':this[_0x6029('0x1b')][_0x59666f[_0x6029('0x42')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x59666f[_0x6029('0x41')]});}}}}}}}catch(_0x10fa30){logger[_0x6029('0x31')]('[%s][voiceCallReport][newchannel]',_0x59666f['uniqueid'],util['inspect'](_0x10fa30,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6029('0x34')][_0x6029('0x1d')]=function(_0x75750b){try{if(this[_0x6029('0x4a')](_0x75750b)){logger[_0x6029('0x50')](_0x6029('0x53'),_0x75750b[_0x6029('0x38')],util[_0x6029('0x32')](_0x75750b,{'showHidden':![],'depth':null}));if(_0x75750b[_0x6029('0x38')]===_0x75750b[_0x6029('0x3b')]&&_0x75750b[_0x6029('0x41')]!='h'&&_0x75750b[_0x6029('0x42')]!='OutgoingSpoolFailed'){_0x75750b[_0x6029('0x54')]=_0x75750b[_0x6029('0x54')]['toLowerCase']();_0x75750b[_0x6029('0x55')]=_0x75750b[_0x6029('0x56')]&&_0x75750b[_0x6029('0x56')][_0x6029('0x57')](_0x6029('0x58'))?_0x75750b[_0x6029('0x56')]:(_0x75750b[_0x6029('0x56')]||_0x75750b[_0x6029('0x55')])[_0x6029('0x59')]();logger[_0x6029('0x2e')](_0x6029('0x5a'),_0x75750b['uniqueid'],_0x75750b[_0x6029('0x54')],_0x75750b['applicationdata']);if(_[_0x6029('0x33')](this[_0x6029('0x1a')][_0x75750b[_0x6029('0x38')]])){this['channels'][_0x75750b[_0x6029('0x38')]]=new Channel();this[_0x6029('0x1a')][_0x75750b['uniqueid']]['starttime']=_0x75750b['duration']?moment()[_0x6029('0x5b')](moment[_0x6029('0x5c')](_0x75750b[_0x6029('0x5c')])['seconds'](),_0x6029('0x5d'))[_0x6029('0x45')](_0x6029('0x4d')):moment()[_0x6029('0x45')](_0x6029('0x4d'));this[_0x6029('0x1a')][_0x75750b[_0x6029('0x38')]][_0x6029('0x4e')]=_0x6029('0x14');}_[_0x6029('0x3c')](this[_0x6029('0x1a')][_0x75750b[_0x6029('0x38')]],_[_0x6029('0x3d')](_0x75750b,_['keys'](this[_0x6029('0x1a')][_0x75750b[_0x6029('0x38')]])));if(_[_0x6029('0x5e')](applications,_0x75750b[_0x6029('0x54')])){this[_0x6029('0x1a')][_0x75750b['uniqueid']][_0x6029('0x5f')]=_0x75750b[_0x6029('0x54')];this[_0x6029('0x1a')][_0x75750b[_0x6029('0x38')]][_0x6029('0x60')]=_0x75750b['applicationdata'];if(_0x75750b[_0x6029('0x54')]===_0x6029('0x61')&&_[_0x6029('0x57')](_0x75750b['applicationdata'][_0x6029('0x59')](),'cdr(')){var _0x132edd=_0x75750b['applicationdata'][_0x6029('0x40')]('=');var _0x171bc0=_0x132edd[0x0][_0x6029('0x59')]()[_0x6029('0x62')](/cdr\((.*)\)/);if(_0x171bc0){this['channels'][_0x75750b[_0x6029('0x38')]][_0x171bc0[0x1]]=_0x132edd[0x1];}}else if(_0x75750b['application']==='queue'){this[_0x6029('0x1a')][_0x75750b[_0x6029('0x38')]]['queue']=_0x75750b[_0x6029('0x55')][_0x6029('0x40')](',')[0x0];}}}}}catch(_0x584a32){logger['error'](_0x6029('0x63'),_0x75750b[_0x6029('0x38')],util['inspect'](_0x584a32,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6029('0x34')][_0x6029('0x22')]=function(_0x182f77){try{if(this[_0x6029('0x4a')](_0x182f77)){logger[_0x6029('0x2e')](_0x6029('0x64'),_0x182f77['uniqueid'],_0x182f77[_0x6029('0x3b')],_0x182f77[_0x6029('0x39')],_0x182f77[_0x6029('0x65')]);logger[_0x6029('0x50')](_0x6029('0x66'),_0x182f77[_0x6029('0x38')],util[_0x6029('0x32')](_0x182f77,{'showHidden':![],'depth':null}));if(_0x182f77['uniqueid']!==_0x182f77[_0x6029('0x3b')]){if(this[_0x6029('0x1a')][_0x182f77[_0x6029('0x3b')]]){if(_0x182f77[_0x6029('0x67')]==='6'){if(!this[_0x6029('0x1a')][_0x182f77[_0x6029('0x3b')]][_0x6029('0x68')]){var _0x2d7a2d=moment();this[_0x6029('0x1a')][_0x182f77[_0x6029('0x3b')]][_0x6029('0x68')]=!![];this[_0x6029('0x1a')][_0x182f77[_0x6029('0x3b')]][_0x6029('0x69')]=_0x2d7a2d['format']('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x6029('0x1a')][_0x182f77[_0x6029('0x3b')]][_0x6029('0x4c')]){this[_0x6029('0x1a')][_0x182f77[_0x6029('0x3b')]]['holdtime']=_0x2d7a2d[_0x6029('0x6a')](this['channels'][_0x182f77[_0x6029('0x3b')]]['starttime'],'seconds');}}this[_0x6029('0x1a')][_0x182f77[_0x6029('0x3b')]][_0x6029('0x3b')]=_0x182f77['uniqueid'];if(_0x182f77['calleridnum']!==_0x6029('0x6b')){this[_0x6029('0x1a')][_0x182f77[_0x6029('0x3b')]][_0x6029('0x44')]=_0x182f77['calleridnum'];}this[_0x6029('0x1a')][_0x182f77[_0x6029('0x3b')]]['connectedlinename']=_0x182f77['calleridname'];this['channels'][_0x182f77[_0x6029('0x3b')]][_0x6029('0x6c')]=_0x182f77[_0x6029('0x42')];this[_0x6029('0x1a')][_0x182f77[_0x6029('0x3b')]]['disposition']=dispositions[_['toNumber'](_0x182f77['channelstate'])];if(this['agents'][_0x182f77[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]]){this['channels'][_0x182f77[_0x6029('0x3b')]][_0x6029('0x6d')]=this[_0x6029('0x1b')][_0x182f77['channel'][_0x6029('0x40')]('-')[0x0]]['id'];this[_0x6029('0x1a')][_0x182f77[_0x6029('0x3b')]][_0x6029('0x6e')]=this[_0x6029('0x1b')][_0x182f77[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]]['name'];}}}}else{if(this[_0x6029('0x1a')][_0x182f77[_0x6029('0x38')]]){if(_0x182f77['channelstate']==='6'){if(this[_0x6029('0x1b')][_0x182f77[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]]){this['channels'][_0x182f77[_0x6029('0x38')]][_0x6029('0x6d')]=this[_0x6029('0x1b')][_0x182f77['channel'][_0x6029('0x40')]('-')[0x0]]['id'];this[_0x6029('0x1a')][_0x182f77['uniqueid']][_0x6029('0x6e')]=this['agents'][_0x182f77[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]]['name'];}}}}if(_0x182f77[_0x6029('0x67')]==='6'&&_0x182f77[_0x6029('0x3f')]===_0x6029('0x6f')){if(this[_0x6029('0x1b')][_0x182f77[_0x6029('0x42')]['split']('-')[0x0]]){this['agents'][_0x182f77[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]][_0x6029('0x43')]=_0x182f77[_0x6029('0x41')];var _0xb1b4ea;if(this[_0x6029('0x1a')][_0x182f77['uniqueid']])_0xb1b4ea=this[_0x6029('0x1a')][_0x182f77[_0x6029('0x38')]][_0x6029('0x70')];else if(this[_0x6029('0x1a')][_0x182f77['linkedid']])_0xb1b4ea=this[_0x6029('0x1a')][_0x182f77[_0x6029('0x3b')]][_0x6029('0x70')];logger[_0x6029('0x50')](_0x6029('0x71'),_0x182f77['uniqueid'],util[_0x6029('0x32')]({'destaccountcode':this[_0x6029('0x1b')][_0x182f77[_0x6029('0x42')]['split']('-')[0x0]][_0x6029('0x48')],'destconnectedlinenum':_0x182f77[_0x6029('0x41')],'routealias':_0xb1b4ea},{'showHidden':![],'depth':null}));this[_0x6029('0x35')](util['format']('user:%s',this['agents'][_0x182f77[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]][_0x6029('0x46')]),_0x6029('0x47'),{'destaccountcode':this[_0x6029('0x1b')][_0x182f77[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]][_0x6029('0x48')],'destconnectedlinenum':_0x182f77[_0x6029('0x41')],'routealias':_0xb1b4ea});}}}}catch(_0xb75c9a){logger[_0x6029('0x31')](_0x6029('0x72'),_0x182f77['uniqueid'],util[_0x6029('0x32')](_0xb75c9a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6029('0x34')][_0x6029('0x73')]=function(_0x3cb999,_0x5d0493){try{if(this[_0x6029('0x1a')][_0x3cb999]){logger['info'](_0x6029('0x74'),_0x3cb999,_0x5d0493);this[_0x6029('0x1a')][_0x3cb999]['monitor']=!![];if(_[_0x6029('0x75')](_0x5d0493,'.wav49')){_0x5d0493=_0x5d0493['replace']('.wav49',_0x6029('0x76'));}this[_0x6029('0x1a')][_0x3cb999][_0x6029('0x77')]=_0x5d0493;var _0x492f3f=_['find'](this[_0x6029('0x1a')][_0x3cb999][_0x6029('0x78')],{'filename':_0x5d0493});if(_[_0x6029('0x79')](_0x492f3f)){this[_0x6029('0x1a')][_0x3cb999][_0x6029('0x78')][_0x6029('0x7a')]({'filename':_0x5d0493,'createdAt':moment()[_0x6029('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0x6029('0x7b')});}}}catch(_0x29de54){logger[_0x6029('0x31')](_0x6029('0x7c'),_0x3cb999,util[_0x6029('0x32')](_0x29de54,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6029('0x34')][_0x6029('0x24')]=function(_0x246d21){try{if(this[_0x6029('0x4a')](_0x246d21)){logger[_0x6029('0x50')]('[%s][voiceCallReport][varset]\x20event:',_0x246d21['uniqueid'],util[_0x6029('0x32')](_0x246d21,{'showHidden':![],'depth':null}));if(this['channels'][_0x246d21[_0x6029('0x38')]]&&_0x246d21['channel']!=_0x6029('0x4b')){if(this[_0x6029('0x4a')](_0x246d21[_0x6029('0x7d')])){if(this[_0x6029('0x4a')](_0x246d21[_0x6029('0x7d')]['mixmonitor_filename'])){logger[_0x6029('0x2e')](_0x6029('0x7e'),_0x246d21[_0x6029('0x38')],_0x246d21['value']);this[_0x6029('0x73')](_0x246d21[_0x6029('0x38')],_0x246d21[_0x6029('0x7f')]);}else if(this['isNotNull'](_0x246d21[_0x6029('0x7d')][_0x6029('0x80')])){logger[_0x6029('0x2e')](_0x6029('0x81'),_0x246d21['uniqueid'],_0x246d21[_0x6029('0x7f')]);this[_0x6029('0x1a')][_0x246d21[_0x6029('0x38')]][_0x6029('0x65')]=_0x246d21[_0x6029('0x7f')];}else if(this['isNotNull'](_0x246d21[_0x6029('0x7d')][_0x6029('0x82')])){logger[_0x6029('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x246d21['uniqueid'],_0x246d21['value']);this['channels'][_0x246d21['uniqueid']][_0x6029('0x83')]=_0x246d21['value'];}else if(this['isNotNull'](_0x246d21['variable'][_0x6029('0x84')])){logger[_0x6029('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x246d21[_0x6029('0x38')],_0x246d21['value']);this[_0x6029('0x1a')][_0x246d21[_0x6029('0x38')]][_0x6029('0x85')]=_0x246d21[_0x6029('0x7f')];}else if(this['isNotNull'](_0x246d21[_0x6029('0x7d')][_0x6029('0x86')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x246d21[_0x6029('0x38')],_0x246d21[_0x6029('0x7f')][_0x6029('0x40')](',')[0x0]);this['channels'][_0x246d21['uniqueid']][_0x6029('0x10')]=_0x246d21[_0x6029('0x7f')][_0x6029('0x40')](',')[0x0];}else if(this[_0x6029('0x4a')](_0x246d21[_0x6029('0x7d')][_0x6029('0x87')])){logger['info'](_0x6029('0x88'),_0x246d21['uniqueid'],_0x246d21['value']);this[_0x6029('0x1a')][_0x246d21[_0x6029('0x38')]]['originatecalleridnum']=_0x246d21['value'];}else if(this[_0x6029('0x4a')](_0x246d21[_0x6029('0x7d')]['xmd-destination'])){logger[_0x6029('0x2e')](_0x6029('0x89'),_0x246d21[_0x6029('0x38')],_0x246d21[_0x6029('0x7f')]);this[_0x6029('0x1a')][_0x246d21[_0x6029('0x38')]]['destination']=_0x246d21[_0x6029('0x7f')];}else if(this[_0x6029('0x4a')](_0x246d21['variable'][_0x6029('0x8a')])){logger[_0x6029('0x2e')](_0x6029('0x8b'),_0x246d21[_0x6029('0x38')],_0x246d21[_0x6029('0x7f')]);this['channels'][_0x246d21[_0x6029('0x38')]][_0x6029('0x8c')]=_0x246d21[_0x6029('0x7f')];}else if(this['isNotNull'](_0x246d21['variable'][_0x6029('0x8d')])){logger[_0x6029('0x2e')](_0x6029('0x8e'),_0x246d21[_0x6029('0x38')],_0x246d21['value']);this[_0x6029('0x1a')][_0x246d21[_0x6029('0x38')]]['queue']=_0x246d21['value'];}else if(this[_0x6029('0x4a')](_0x246d21['variable']['sipcallid'])){logger[_0x6029('0x2e')](_0x6029('0x8f'),_0x246d21[_0x6029('0x38')],_0x246d21['value']);this[_0x6029('0x1a')][_0x246d21[_0x6029('0x38')]]['sipcalluniqueid']=_0x246d21[_0x6029('0x7f')];}}}else if(this['isNotNull'](_0x246d21[_0x6029('0x7d')][_0x6029('0x90')])){if(_0x246d21[_0x6029('0x7f')]){var _0x4158c5=path['parse'](_0x246d21[_0x6029('0x7f')])[_0x6029('0x46')];logger[_0x6029('0x2e')](_0x6029('0x7e'),_0x4158c5,_0x246d21['value']);this[_0x6029('0x73')](_0x4158c5,_0x246d21[_0x6029('0x7f')]);}}else if(this[_0x6029('0x1a')][_0x246d21[_0x6029('0x3b')]]){if(this[_0x6029('0x4a')](_0x246d21[_0x6029('0x7d')])){if(this['isNotNull'](_0x246d21[_0x6029('0x7d')]['sipcallid'])){logger[_0x6029('0x2e')](_0x6029('0x8f'),_0x246d21[_0x6029('0x3b')],_0x246d21[_0x6029('0x7f')]);this[_0x6029('0x1a')][_0x246d21[_0x6029('0x3b')]][_0x6029('0x91')]=_0x246d21[_0x6029('0x7f')];}}}}}catch(_0x4d60aa){logger['error'](_0x6029('0x92'),_0x246d21['uniqueid'],util[_0x6029('0x32')](_0x4d60aa,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6029('0x34')][_0x6029('0x26')]=function(_0x3e5109){try{if(this[_0x6029('0x4a')](_0x3e5109)){logger[_0x6029('0x50')](_0x6029('0x93'),_0x3e5109['uniqueid'],util['inspect'](_0x3e5109,{'showHidden':![],'depth':null}));if(this[_0x6029('0x1a')][_0x3e5109['uniqueid']]){logger[_0x6029('0x2e')](_0x6029('0x94'),_0x3e5109[_0x6029('0x38')],_0x3e5109['cause-txt']);var _0x470d27=moment();this['channels'][_0x3e5109[_0x6029('0x38')]][_0x6029('0x95')]=_0x470d27[_0x6029('0x45')](_0x6029('0x4d'));this[_0x6029('0x1a')][_0x3e5109[_0x6029('0x38')]][_0x6029('0x5c')]=_0x470d27[_0x6029('0x6a')](this[_0x6029('0x1a')][_0x3e5109[_0x6029('0x38')]][_0x6029('0x4c')],_0x6029('0x5d'));if(this[_0x6029('0x1a')][_0x3e5109[_0x6029('0x38')]][_0x6029('0x68')]){this[_0x6029('0x1a')][_0x3e5109[_0x6029('0x38')]][_0x6029('0x96')]=_0x470d27['diff'](this['channels'][_0x3e5109[_0x6029('0x38')]][_0x6029('0x69')],_0x6029('0x5d'));this[_0x6029('0x1a')][_0x3e5109[_0x6029('0x38')]]['holdtime']=this[_0x6029('0x1a')][_0x3e5109[_0x6029('0x38')]][_0x6029('0x5c')]-this[_0x6029('0x1a')][_0x3e5109[_0x6029('0x38')]][_0x6029('0x96')];}if(_0x3e5109[_0x6029('0x3f')]==='from-sip'){if(this['agents'][_0x3e5109[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]]){this[_0x6029('0x1b')][_0x3e5109['channel']['split']('-')[0x0]]=_[_0x6029('0x97')](this[_0x6029('0x1b')][_0x3e5109[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]],['destconnectedlinenum']);logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x3e5109[_0x6029('0x38')],util[_0x6029('0x32')]({'id':this[_0x6029('0x1b')][_0x3e5109[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x3e5109[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]][_0x6029('0x48')]},{'showHidden':![],'depth':null}));this[_0x6029('0x35')](util[_0x6029('0x45')](_0x6029('0x52'),this[_0x6029('0x1b')][_0x3e5109[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]][_0x6029('0x46')]),_0x6029('0x98'),{'id':this['agents'][_0x3e5109[_0x6029('0x42')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x6029('0x1b')][_0x3e5109[_0x6029('0x42')][_0x6029('0x40')]('-')[0x0]][_0x6029('0x48')]});}}var _0x5cea99=this;Promise['resolve']()[_0x6029('0x99')](function(){var _0x26b4da=_0x5cea99[_0x6029('0x1a')][_0x3e5109['uniqueid']];if(typeof _0x26b4da[_0x6029('0x9a')]===_0x6029('0x9b'))return;if(_[_0x6029('0x9c')](_0x26b4da[_0x6029('0x78')]))return;return RpcSetting[_0x6029('0x9d')]()[_0x6029('0x99')](function(_0x5d71d1){if(!_0x5d71d1['stopRecordingOnTransfer'])return;return Promise[_0x6029('0x9e')]()[_0x6029('0x99')](function(){return ami[_0x6029('0x9f')]({'action':_0x6029('0xa0'),'channel':_0x26b4da[_0x6029('0x42')]})[_0x6029('0xa1')](function(){});})[_0x6029('0x99')](function(){return ami[_0x6029('0x9f')]({'action':_0x6029('0xa0'),'channel':_0x26b4da[_0x6029('0x6c')]})[_0x6029('0xa1')](function(){})['finally'](function(){var _0x42c904=_0x5cea99['agents'][_0x26b4da[_0x6029('0x6c')]['split']('-')[0x0]];if(!_0x42c904)return;io[_0x6029('0x35')]('webbar:stopmonitors',{'agentId':_0x42c904['id'],'uniqueid':_0x26b4da[_0x6029('0x38')]});});});});})[_0x6029('0x99')](function(){if(_0x3e5109['event']==='BlindTransfer'){_0x5cea99[_0x6029('0xa2')][_0x3e5109[_0x6029('0x38')]]=_0x5cea99['channels'][_0x3e5109[_0x6029('0x38')]];}else{if(_0x5cea99[_0x6029('0x1a')][_0x3e5109['uniqueid']][_0x6029('0x85')]===_0x6029('0xa3')&&_0x5cea99[_0x6029('0xa2')][_0x3e5109[_0x6029('0x38')]]){_0x5cea99['channels'][_0x3e5109[_0x6029('0x38')]][_0x6029('0x38')]=[_0x5cea99[_0x6029('0x1a')][_0x3e5109[_0x6029('0x38')]][_0x6029('0x3b')],_0x5cea99['channels'][_0x3e5109[_0x6029('0x38')]][_0x6029('0x3b')]=_0x5cea99[_0x6029('0x1a')][_0x3e5109['uniqueid']][_0x6029('0x38')]][0x0];delete _0x5cea99['blindTransfers'][_0x3e5109[_0x6029('0x38')]];}}logger[_0x6029('0x50')](_0x6029('0xa4'),_0x3e5109['uniqueid'],util[_0x6029('0x32')](_0x5cea99[_0x6029('0x1a')][_0x3e5109[_0x6029('0x38')]],{'showHidden':![],'depth':null}));ami['emit'](_0x6029('0xa5'),_0x5cea99[_0x6029('0x1a')][_0x3e5109['uniqueid']]);delete _0x5cea99[_0x6029('0x1a')][_0x3e5109[_0x6029('0x38')]];});}}}catch(_0x14f47f){logger[_0x6029('0x31')](_0x6029('0xa6'),_0x3e5109[_0x6029('0x38')],util[_0x6029('0x32')](_0x14f47f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6029('0x34')][_0x6029('0xa7')]=function(_0x2c70f8){try{if(this[_0x6029('0x4a')](_0x2c70f8)){logger[_0x6029('0x2e')]('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x2c70f8['uniqueid'],_0x2c70f8[_0x6029('0xa8')],_0x2c70f8['transfertargetcalleridnum']);logger[_0x6029('0x50')](_0x6029('0xa9'),_0x2c70f8[_0x6029('0x38')],util[_0x6029('0x32')](_0x2c70f8,{'showHidden':![],'depth':null}));if(this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xaa')]]){this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xaa')]][_0x6029('0xab')]=_0x2c70f8[_0x6029('0xa8')];this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xaa')]]['transferconnectedlinenum']=_0x2c70f8[_0x6029('0xac')];if(this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xad')]]){var _0x2b2416=this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xad')]];this[_0x6029('0x1a')][_0x2c70f8['secondtransfereruniqueid']]=this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xaa')]];this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xaa')]]=_0x2b2416;}}else if(this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xae')]]){this[_0x6029('0x1a')][_0x2c70f8['transfertargetuniqueid']][_0x6029('0xab')]=_0x2c70f8[_0x6029('0xa8')];this['channels'][_0x2c70f8['transfertargetuniqueid']]['transferconnectedlinenum']=_0x2c70f8[_0x6029('0xac')];if(this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xaf')]]){var _0x2b2416=this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xaf')]];this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xaf')]]=this[_0x6029('0x1a')][_0x2c70f8['transfertargetuniqueid']];this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xae')]]=_0x2b2416;}}if((this['channels'][_0x2c70f8[_0x6029('0xaf')]]||this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xb0')]])&&this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xad')]]){var _0x2994e4=_[_0x6029('0xb1')]([this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xaf')]],this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xb0')]],this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xad')]]],function(_0x519edf){return _0x519edf&&_0x519edf['type']===_0x6029('0xa3')&&_0x519edf[_0x6029('0xb2')];});if(_0x2994e4){if(this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xaf')]])this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xaf')]]['transferType']=_0x6029('0xb3');if(this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xb0')]])this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xb0')]][_0x6029('0x9a')]=_0x6029('0xb3');this[_0x6029('0x1a')][_0x2c70f8[_0x6029('0xad')]][_0x6029('0x9a')]='ATTENDED';}}}}catch(_0xccdc27){logger[_0x6029('0x31')](_0x6029('0xb4'),_0x2c70f8[_0x6029('0x38')],util[_0x6029('0x32')](_0xccdc27,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6029('0x34')][_0x6029('0x29')]=function(_0x39fae1){try{if(this[_0x6029('0x4a')](_0x39fae1)){logger[_0x6029('0x2e')](_0x6029('0xb5'),_0x39fae1['uniqueid'],_0x39fae1[_0x6029('0xb6')],_0x39fae1[_0x6029('0xb7')]);logger[_0x6029('0x50')](_0x6029('0xb8'),_0x39fae1['uniqueid'],util['inspect'](_0x39fae1,{'showHidden':![],'depth':null}));if(this['channels'][_0x39fae1['transfereeuniqueid']]){this[_0x6029('0x1a')][_0x39fae1[_0x6029('0xaa')]]['transfercalleridnum']=_0x39fae1[_0x6029('0xb6')];this[_0x6029('0x1a')][_0x39fae1[_0x6029('0xaa')]][_0x6029('0xb9')]=_0x39fae1[_0x6029('0xb7')];this[_0x6029('0x1a')][_0x39fae1[_0x6029('0xaa')]][_0x6029('0x9a')]=_0x6029('0xba');this[_0x6029('0x26')]({'event':'BlindTransfer','uniqueid':_0x39fae1[_0x6029('0xaa')],'context':_0x39fae1[_0x6029('0x3f')],'channel':_0x39fae1[_0x6029('0xbb')]});}else{this[_0x6029('0x1a')][_0x39fae1[_0x6029('0xbc')]][_0x6029('0x9a')]=_0x6029('0xba');}}}catch(_0x511de8){logger[_0x6029('0x31')](_0x6029('0xbd'),_0x39fae1['uniqueid'],util['inspect'](_0x511de8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6029('0x34')][_0x6029('0x2b')]=function(_0x6a64c6){try{if(this[_0x6029('0x4a')](_0x6a64c6)){logger['debug'](_0x6029('0xbe'),_0x6a64c6[_0x6029('0x38')],util['inspect'](_0x6a64c6,{'showHidden':![],'depth':null}));if(this[_0x6029('0x1a')][_0x6a64c6['uniqueid']]){if(!_[_0x6029('0x79')](this[_0x6029('0x1a')][_0x6a64c6['uniqueid']][_0x6029('0x69')])){this[_0x6029('0x1a')][_0x6a64c6[_0x6029('0x38')]][_0x6029('0xbf')]=moment()[_0x6029('0x45')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x6029('0x2e')](_0x6029('0xc0'),_0x6a64c6['uniqueid'],this['channels'][_0x6a64c6[_0x6029('0x38')]][_0x6029('0xbf')]);}}}}catch(_0x4f8b04){logger['error']('[%s][voiceCallReport][musiconholdstart]',_0x6a64c6[_0x6029('0x38')],util[_0x6029('0x32')](_0x4f8b04,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6029('0x34')][_0x6029('0x2d')]=function(_0x202175){try{if(this[_0x6029('0x4a')](_0x202175)){logger[_0x6029('0x50')](_0x6029('0xc1'),_0x202175[_0x6029('0x38')],util[_0x6029('0x32')](_0x202175,{'showHidden':![],'depth':null}));if(this[_0x6029('0x1a')][_0x202175[_0x6029('0x38')]]){if(!_[_0x6029('0x79')](this[_0x6029('0x1a')][_0x202175[_0x6029('0x38')]][_0x6029('0xbf')])){this[_0x6029('0x1a')][_0x202175[_0x6029('0x38')]]['mohtime']+=moment()[_0x6029('0xc2')](0x0)[_0x6029('0x6a')](this['channels'][_0x202175[_0x6029('0x38')]][_0x6029('0xbf')],'seconds');logger[_0x6029('0x2e')](_0x6029('0xc3'),_0x202175[_0x6029('0x38')],this['channels'][_0x202175[_0x6029('0x38')]]['mohtime']);delete this[_0x6029('0x1a')][_0x202175[_0x6029('0x38')]][_0x6029('0xbf')];}}}}catch(_0x2f7eb7){logger[_0x6029('0x31')](_0x6029('0xc4'),_0x202175[_0x6029('0x38')],util[_0x6029('0x32')](_0x2f7eb7,{'showHidden':![],'depth':null}));}};module[_0x6029('0xc5')]=VoiceCallReport; \ No newline at end of file +var _0xa236=['agents','blindTransfers','coreshowchannel','syncNewExten','bind','newchannel','syncNewChannel','newstate','syncNewState','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','emit','prototype','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','keys','context','from-sip','exten','xcally-motion-preview','channel','split','destconnectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','error','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastapplication','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinenum','connectedlinename','calleridname','destinationchannel','UserId','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','monitorFilename','monitors','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','resolve','then','transferType','undefined','getSettings','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','origtransferercalleridnum','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfercalleridnum','transfereecalleridnum','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','bluebird','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','set','queue','playback','FAILED','NO\x20ANSWER','ANSWERED','BUSY','defaults','redis','localhost','channels'];(function(_0x323bf6,_0x19aed6){var _0x18da88=function(_0x1111da){while(--_0x1111da){_0x323bf6['push'](_0x323bf6['shift']());}};_0x18da88(++_0x19aed6);}(_0xa236,0xb4));var _0x6a23=function(_0x2c96fd,_0x10369a){_0x2c96fd=_0x2c96fd-0x0;var _0x38ca61=_0xa236[_0x2c96fd];return _0x38ca61;};'use strict';var BPromise=require(_0x6a23('0x0'));var _=require(_0x6a23('0x1'));var moment=require(_0x6a23('0x2'));var util=require(_0x6a23('0x3'));var path=require(_0x6a23('0x4'));var Redis=require(_0x6a23('0x5'));var config=require(_0x6a23('0x6'));var logger=require(_0x6a23('0x7'))(_0x6a23('0x8'));var ami=require(_0x6a23('0x9'));var Channel=require(_0x6a23('0xa'));var RpcSetting=require(_0x6a23('0xb'));var statusDesc=[_0x6a23('0xc'),_0x6a23('0xd'),_0x6a23('0xe'),_0x6a23('0xf'),_0x6a23('0x10'),_0x6a23('0x11'),_0x6a23('0x12'),_0x6a23('0x13'),'onhold'];var applications=[_0x6a23('0x14'),_0x6a23('0x15'),'agi','dial',_0x6a23('0x16'),'voicemail'];var dispositions=['NO\x20ANSWER',_0x6a23('0x17'),'FAILED','NO\x20ANSWER',_0x6a23('0x18'),'NO\x20ANSWER',_0x6a23('0x19'),_0x6a23('0x1a'),_0x6a23('0x17'),_0x6a23('0x17'),'FAILED'];var actions={};config['redis']=_[_0x6a23('0x1b')](config[_0x6a23('0x1c')],{'host':_0x6a23('0x1d'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x4a37ba){this['channels']=_0x4a37ba[_0x6a23('0x1e')];this[_0x6a23('0x1f')]=_0x4a37ba[_0x6a23('0x1f')];this[_0x6a23('0x20')]={};ami['on'](_0x6a23('0x21'),this[_0x6a23('0x22')]['bind'](this));ami['on']('newexten',this[_0x6a23('0x22')][_0x6a23('0x23')](this));ami['on'](_0x6a23('0x24'),this[_0x6a23('0x25')]['bind'](this));ami['on'](_0x6a23('0x26'),this[_0x6a23('0x27')][_0x6a23('0x23')](this));ami['on']('varset',this[_0x6a23('0x28')]['bind'](this));ami['on'](_0x6a23('0x29'),this['syncHangup']['bind'](this));ami['on'](_0x6a23('0x2a'),this[_0x6a23('0x2b')]['bind'](this));ami['on'](_0x6a23('0x2c'),this['syncAttendedTransfer'][_0x6a23('0x23')](this));ami['on'](_0x6a23('0x2d'),this[_0x6a23('0x2e')][_0x6a23('0x23')](this));ami['on']('musiconholdstart',this[_0x6a23('0x2f')][_0x6a23('0x23')](this));ami['on'](_0x6a23('0x30'),this[_0x6a23('0x31')][_0x6a23('0x23')](this));try{logger[_0x6a23('0x32')](_0x6a23('0x33'));ami[_0x6a23('0x34')]();}catch(_0x1889d8){logger['error'](_0x6a23('0x35'),util[_0x6a23('0x36')](_0x1889d8,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x6a23('0x37')]=function(_0x36f157){return _0x36f157!==null&&!_[_0x6a23('0x38')](_0x36f157);};VoiceCallReport['prototype']['emit']=function(_0x3a2c5e,_0x277dd3,_0x278edc){io['to'](_0x3a2c5e)[_0x6a23('0x39')](_0x277dd3,_0x278edc);};VoiceCallReport[_0x6a23('0x3a')][_0x6a23('0x2b')]=function(_0x368d9c){try{if(this[_0x6a23('0x37')](_0x368d9c)){logger['info'](_0x6a23('0x3b'),_0x368d9c[_0x6a23('0x3c')],_0x368d9c['calleridname'],_0x368d9c[_0x6a23('0x3d')]);logger[_0x6a23('0x3e')](_0x6a23('0x3f'),_0x368d9c[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x368d9c,{'showHidden':![],'depth':null}));if(_0x368d9c[_0x6a23('0x3c')]===_0x368d9c[_0x6a23('0x40')]){if(!_[_0x6a23('0x38')](this[_0x6a23('0x1e')][_0x368d9c[_0x6a23('0x3c')]])){_[_0x6a23('0x41')](this[_0x6a23('0x1e')][_0x368d9c[_0x6a23('0x3c')]],_[_0x6a23('0x42')](_0x368d9c,_[_0x6a23('0x43')](this[_0x6a23('0x1e')][_0x368d9c[_0x6a23('0x3c')]])));}}if(_0x368d9c[_0x6a23('0x44')]===_0x6a23('0x45')){if(this[_0x6a23('0x1f')][_0x368d9c['channel']['split']('-')[0x0]]){if(_0x368d9c[_0x6a23('0x46')]==_0x6a23('0x47')){this['agents'][_0x368d9c[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]][_0x6a23('0x4a')]=_0x368d9c['connectedlinenum'];this[_0x6a23('0x39')](util[_0x6a23('0x4b')](_0x6a23('0x4c'),this[_0x6a23('0x1f')][_0x368d9c[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]][_0x6a23('0x4d')]),_0x6a23('0x4e'),{'destaccountcode':this[_0x6a23('0x1f')][_0x368d9c[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]][_0x6a23('0x4f')],'destconnectedlinenum':_0x368d9c['connectedlinenum']});}}}}}catch(_0x3689b5){logger['error'](_0x6a23('0x50'),_0x368d9c['uniqueid'],util[_0x6a23('0x36')](_0x3689b5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a23('0x3a')][_0x6a23('0x25')]=function(_0x36cacf){try{if(this[_0x6a23('0x37')](_0x36cacf)){logger[_0x6a23('0x3e')](_0x6a23('0x51'),_0x36cacf[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x36cacf,{'showHidden':![],'depth':null}));if(_0x36cacf[_0x6a23('0x3c')]===_0x36cacf[_0x6a23('0x40')]&&_0x36cacf[_0x6a23('0x48')]!=_0x6a23('0x52')){if(_[_0x6a23('0x38')](this['channels'][_0x36cacf[_0x6a23('0x3c')]])){logger['info'](_0x6a23('0x53'),_0x36cacf[_0x6a23('0x3c')],_0x36cacf[_0x6a23('0x44')],_0x36cacf['exten']);this['channels'][_0x36cacf[_0x6a23('0x3c')]]=new Channel();this[_0x6a23('0x1e')][_0x36cacf[_0x6a23('0x3c')]]['starttime']=moment()[_0x6a23('0x4b')](_0x6a23('0x54'));this[_0x6a23('0x1e')][_0x36cacf[_0x6a23('0x3c')]][_0x6a23('0x55')]=dispositions[_[_0x6a23('0x56')](_0x36cacf[_0x6a23('0x57')])];_[_0x6a23('0x41')](this['channels'][_0x36cacf[_0x6a23('0x3c')]],_[_0x6a23('0x42')](_0x36cacf,_[_0x6a23('0x43')](this[_0x6a23('0x1e')][_0x36cacf[_0x6a23('0x3c')]])));if(_0x36cacf['context']===_0x6a23('0x45')){if(this['agents'][_0x36cacf[_0x6a23('0x48')]['split']('-')[0x0]]){if(_[_0x6a23('0x38')](this[_0x6a23('0x1f')][_0x36cacf[_0x6a23('0x48')]['split']('-')[0x0]][_0x6a23('0x4a')])){this[_0x6a23('0x1f')][_0x36cacf[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]]['destconnectedlinenum']=_0x36cacf[_0x6a23('0x46')];logger[_0x6a23('0x3e')](_0x6a23('0x58'),_0x36cacf['uniqueid'],util[_0x6a23('0x36')]({'destaccountcode':this[_0x6a23('0x1f')][_0x36cacf[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]][_0x6a23('0x4f')],'destconnectedlinenum':_0x36cacf[_0x6a23('0x46')]},{'showHidden':![],'depth':null}));this[_0x6a23('0x39')](util['format']('user:%s',this[_0x6a23('0x1f')][_0x36cacf[_0x6a23('0x48')]['split']('-')[0x0]][_0x6a23('0x4d')]),_0x6a23('0x4e'),{'destaccountcode':this['agents'][_0x36cacf[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x36cacf['exten']});}}}}}}}catch(_0x55d52f){logger[_0x6a23('0x59')]('[%s][voiceCallReport][newchannel]',_0x36cacf[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x55d52f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a23('0x3a')][_0x6a23('0x22')]=function(_0x526b8f){try{if(this[_0x6a23('0x37')](_0x526b8f)){logger[_0x6a23('0x3e')](_0x6a23('0x5a'),_0x526b8f[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x526b8f,{'showHidden':![],'depth':null}));if(_0x526b8f[_0x6a23('0x3c')]===_0x526b8f['linkedid']&&_0x526b8f[_0x6a23('0x46')]!='h'&&_0x526b8f[_0x6a23('0x48')]!='OutgoingSpoolFailed'){_0x526b8f[_0x6a23('0x5b')]=_0x526b8f['application'][_0x6a23('0x5c')]();_0x526b8f[_0x6a23('0x5d')]=_0x526b8f[_0x6a23('0x5e')]&&_0x526b8f[_0x6a23('0x5e')]['startsWith'](_0x6a23('0x5f'))?_0x526b8f[_0x6a23('0x5e')]:(_0x526b8f[_0x6a23('0x5e')]||_0x526b8f[_0x6a23('0x5d')])[_0x6a23('0x5c')]();logger[_0x6a23('0x32')](_0x6a23('0x60'),_0x526b8f[_0x6a23('0x3c')],_0x526b8f[_0x6a23('0x5b')],_0x526b8f[_0x6a23('0x5d')]);if(_[_0x6a23('0x38')](this[_0x6a23('0x1e')][_0x526b8f['uniqueid']])){this['channels'][_0x526b8f[_0x6a23('0x3c')]]=new Channel();this['channels'][_0x526b8f[_0x6a23('0x3c')]][_0x6a23('0x61')]=_0x526b8f[_0x6a23('0x62')]?moment()[_0x6a23('0x63')](moment[_0x6a23('0x62')](_0x526b8f[_0x6a23('0x62')])['seconds'](),_0x6a23('0x64'))[_0x6a23('0x4b')](_0x6a23('0x54')):moment()[_0x6a23('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6a23('0x1e')][_0x526b8f[_0x6a23('0x3c')]][_0x6a23('0x55')]='NO\x20ANSWER';}_['merge'](this['channels'][_0x526b8f[_0x6a23('0x3c')]],_[_0x6a23('0x42')](_0x526b8f,_['keys'](this[_0x6a23('0x1e')][_0x526b8f[_0x6a23('0x3c')]])));if(_[_0x6a23('0x65')](applications,_0x526b8f[_0x6a23('0x5b')])){this[_0x6a23('0x1e')][_0x526b8f[_0x6a23('0x3c')]][_0x6a23('0x66')]=_0x526b8f[_0x6a23('0x5b')];this['channels'][_0x526b8f['uniqueid']][_0x6a23('0x67')]=_0x526b8f[_0x6a23('0x5d')];if(_0x526b8f[_0x6a23('0x5b')]==='set'&&_[_0x6a23('0x68')](_0x526b8f[_0x6a23('0x5d')]['toLowerCase'](),_0x6a23('0x69'))){var _0x2f0f7b=_0x526b8f[_0x6a23('0x5d')][_0x6a23('0x49')]('=');var _0x342303=_0x2f0f7b[0x0]['toLowerCase']()[_0x6a23('0x6a')](/cdr\((.*)\)/);if(_0x342303){this['channels'][_0x526b8f[_0x6a23('0x3c')]][_0x342303[0x1]]=_0x2f0f7b[0x1];}}else if(_0x526b8f['application']===_0x6a23('0x15')){this[_0x6a23('0x1e')][_0x526b8f[_0x6a23('0x3c')]][_0x6a23('0x15')]=_0x526b8f[_0x6a23('0x5d')]['split'](',')[0x0];}}}}}catch(_0x59adc3){logger[_0x6a23('0x59')](_0x6a23('0x6b'),_0x526b8f[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x59adc3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a23('0x3a')][_0x6a23('0x27')]=function(_0x395f83){try{if(this[_0x6a23('0x37')](_0x395f83)){logger[_0x6a23('0x32')](_0x6a23('0x6c'),_0x395f83[_0x6a23('0x3c')],_0x395f83[_0x6a23('0x40')],_0x395f83['calleridname'],_0x395f83[_0x6a23('0x3d')]);logger[_0x6a23('0x3e')](_0x6a23('0x6d'),_0x395f83[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x395f83,{'showHidden':![],'depth':null}));if(_0x395f83['uniqueid']!==_0x395f83[_0x6a23('0x40')]){if(this[_0x6a23('0x1e')][_0x395f83[_0x6a23('0x40')]]){if(_0x395f83[_0x6a23('0x57')]==='6'){if(!this['channels'][_0x395f83[_0x6a23('0x40')]][_0x6a23('0x6e')]){var _0xc06d09=moment();this[_0x6a23('0x1e')][_0x395f83[_0x6a23('0x40')]]['answered']=!![];this[_0x6a23('0x1e')][_0x395f83[_0x6a23('0x40')]][_0x6a23('0x6f')]=_0xc06d09[_0x6a23('0x4b')](_0x6a23('0x54'));if(this[_0x6a23('0x1e')][_0x395f83[_0x6a23('0x40')]][_0x6a23('0x61')]){this['channels'][_0x395f83[_0x6a23('0x40')]][_0x6a23('0x70')]=_0xc06d09[_0x6a23('0x71')](this[_0x6a23('0x1e')][_0x395f83['linkedid']][_0x6a23('0x61')],_0x6a23('0x64'));}}this[_0x6a23('0x1e')][_0x395f83[_0x6a23('0x40')]][_0x6a23('0x40')]=_0x395f83[_0x6a23('0x3c')];if(_0x395f83[_0x6a23('0x3d')]!==_0x6a23('0x47')){this[_0x6a23('0x1e')][_0x395f83['linkedid']][_0x6a23('0x72')]=_0x395f83[_0x6a23('0x3d')];}this[_0x6a23('0x1e')][_0x395f83[_0x6a23('0x40')]][_0x6a23('0x73')]=_0x395f83[_0x6a23('0x74')];this['channels'][_0x395f83[_0x6a23('0x40')]][_0x6a23('0x75')]=_0x395f83[_0x6a23('0x48')];this[_0x6a23('0x1e')][_0x395f83[_0x6a23('0x40')]][_0x6a23('0x55')]=dispositions[_[_0x6a23('0x56')](_0x395f83[_0x6a23('0x57')])];if(this['agents'][_0x395f83['channel'][_0x6a23('0x49')]('-')[0x0]]){this[_0x6a23('0x1e')][_0x395f83[_0x6a23('0x40')]][_0x6a23('0x76')]=this[_0x6a23('0x1f')][_0x395f83[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]]['id'];this['channels'][_0x395f83[_0x6a23('0x40')]][_0x6a23('0x77')]=this[_0x6a23('0x1f')][_0x395f83[_0x6a23('0x48')]['split']('-')[0x0]][_0x6a23('0x4d')];}}}}else{if(this[_0x6a23('0x1e')][_0x395f83[_0x6a23('0x3c')]]){if(_0x395f83[_0x6a23('0x57')]==='6'){if(this[_0x6a23('0x1f')][_0x395f83['channel']['split']('-')[0x0]]){this['channels'][_0x395f83[_0x6a23('0x3c')]]['UserId']=this[_0x6a23('0x1f')][_0x395f83['channel'][_0x6a23('0x49')]('-')[0x0]]['id'];this[_0x6a23('0x1e')][_0x395f83['uniqueid']][_0x6a23('0x77')]=this[_0x6a23('0x1f')][_0x395f83[_0x6a23('0x48')]['split']('-')[0x0]]['name'];}}}}if(_0x395f83[_0x6a23('0x57')]==='6'&&_0x395f83[_0x6a23('0x44')]===_0x6a23('0x45')){if(this[_0x6a23('0x1f')][_0x395f83['channel'][_0x6a23('0x49')]('-')[0x0]]){this['agents'][_0x395f83[_0x6a23('0x48')]['split']('-')[0x0]]['destconnectedlinenum']=_0x395f83[_0x6a23('0x46')];var _0x4fd43f;if(this['channels'][_0x395f83[_0x6a23('0x3c')]])_0x4fd43f=this[_0x6a23('0x1e')][_0x395f83[_0x6a23('0x3c')]][_0x6a23('0x78')];else if(this[_0x6a23('0x1e')][_0x395f83['linkedid']])_0x4fd43f=this['channels'][_0x395f83[_0x6a23('0x40')]][_0x6a23('0x78')];logger[_0x6a23('0x3e')](_0x6a23('0x79'),_0x395f83[_0x6a23('0x3c')],util[_0x6a23('0x36')]({'destaccountcode':this[_0x6a23('0x1f')][_0x395f83[_0x6a23('0x48')]['split']('-')[0x0]][_0x6a23('0x4f')],'destconnectedlinenum':_0x395f83[_0x6a23('0x46')],'routealias':_0x4fd43f},{'showHidden':![],'depth':null}));this['emit'](util[_0x6a23('0x4b')]('user:%s',this['agents'][_0x395f83[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]][_0x6a23('0x4d')]),'user:agentconnect',{'destaccountcode':this[_0x6a23('0x1f')][_0x395f83['channel']['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x395f83['exten'],'routealias':_0x4fd43f});}}}}catch(_0x2ae7be){logger[_0x6a23('0x59')](_0x6a23('0x7a'),_0x395f83[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x2ae7be,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a23('0x3a')][_0x6a23('0x7b')]=function(_0x3e060f,_0x4058d1){try{if(this['channels'][_0x3e060f]){logger[_0x6a23('0x32')](_0x6a23('0x7c'),_0x3e060f,_0x4058d1);this[_0x6a23('0x1e')][_0x3e060f][_0x6a23('0x7d')]=!![];if(_[_0x6a23('0x7e')](_0x4058d1,_0x6a23('0x7f'))){_0x4058d1=_0x4058d1['replace'](_0x6a23('0x7f'),'.WAV');}this[_0x6a23('0x1e')][_0x3e060f][_0x6a23('0x80')]=_0x4058d1;var _0x233605=_['find'](this[_0x6a23('0x1e')][_0x3e060f][_0x6a23('0x81')],{'filename':_0x4058d1});if(_[_0x6a23('0x82')](_0x233605)){this['channels'][_0x3e060f][_0x6a23('0x81')][_0x6a23('0x83')]({'filename':_0x4058d1,'createdAt':moment()[_0x6a23('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0x4b0533){logger['error'](_0x6a23('0x84'),_0x3e060f,util[_0x6a23('0x36')](_0x4b0533,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a23('0x3a')][_0x6a23('0x28')]=function(_0x6776bf){try{if(this[_0x6a23('0x37')](_0x6776bf)){logger['debug'](_0x6a23('0x85'),_0x6776bf[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x6776bf,{'showHidden':![],'depth':null}));if(this[_0x6a23('0x1e')][_0x6776bf[_0x6a23('0x3c')]]&&_0x6776bf[_0x6a23('0x48')]!=_0x6a23('0x52')){if(this[_0x6a23('0x37')](_0x6776bf['variable'])){if(this['isNotNull'](_0x6776bf[_0x6a23('0x86')][_0x6a23('0x87')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x6776bf[_0x6a23('0x3c')],_0x6776bf[_0x6a23('0x88')]);this['syncMixMonitorFilename'](_0x6776bf[_0x6a23('0x3c')],_0x6776bf['value']);}else if(this[_0x6a23('0x37')](_0x6776bf[_0x6a23('0x86')][_0x6a23('0x89')])){logger[_0x6a23('0x32')](_0x6a23('0x8a'),_0x6776bf[_0x6a23('0x3c')],_0x6776bf['value']);this[_0x6a23('0x1e')][_0x6776bf[_0x6a23('0x3c')]][_0x6a23('0x3d')]=_0x6776bf[_0x6a23('0x88')];}else if(this[_0x6a23('0x37')](_0x6776bf[_0x6a23('0x86')][_0x6a23('0x8b')])){logger['info'](_0x6a23('0x8c'),_0x6776bf[_0x6a23('0x3c')],_0x6776bf['value']);this[_0x6a23('0x1e')][_0x6776bf['uniqueid']][_0x6a23('0x8d')]=_0x6776bf['value'];}else if(this['isNotNull'](_0x6776bf[_0x6a23('0x86')]['xmd-cdrtype'])){logger['info'](_0x6a23('0x8e'),_0x6776bf[_0x6a23('0x3c')],_0x6776bf[_0x6a23('0x88')]);this[_0x6a23('0x1e')][_0x6776bf['uniqueid']][_0x6a23('0x8f')]=_0x6776bf[_0x6a23('0x88')];}else if(this['isNotNull'](_0x6776bf[_0x6a23('0x86')][_0x6a23('0x90')])){logger[_0x6a23('0x32')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x6776bf[_0x6a23('0x3c')],_0x6776bf[_0x6a23('0x88')]['split'](',')[0x0]);this[_0x6a23('0x1e')][_0x6776bf[_0x6a23('0x3c')]][_0x6a23('0x15')]=_0x6776bf[_0x6a23('0x88')][_0x6a23('0x49')](',')[0x0];}else if(this['isNotNull'](_0x6776bf[_0x6a23('0x86')]['xmd-originatecalleridnum'])){logger[_0x6a23('0x32')](_0x6a23('0x91'),_0x6776bf['uniqueid'],_0x6776bf[_0x6a23('0x88')]);this['channels'][_0x6776bf[_0x6a23('0x3c')]][_0x6a23('0x92')]=_0x6776bf[_0x6a23('0x88')];}else if(this[_0x6a23('0x37')](_0x6776bf[_0x6a23('0x86')][_0x6a23('0x93')])){logger[_0x6a23('0x32')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x6776bf[_0x6a23('0x3c')],_0x6776bf[_0x6a23('0x88')]);this[_0x6a23('0x1e')][_0x6776bf['uniqueid']][_0x6a23('0x94')]=_0x6776bf[_0x6a23('0x88')];}else if(this[_0x6a23('0x37')](_0x6776bf[_0x6a23('0x86')][_0x6a23('0x95')])){logger['info'](_0x6a23('0x96'),_0x6776bf[_0x6a23('0x3c')],_0x6776bf['value']);this['channels'][_0x6776bf[_0x6a23('0x3c')]][_0x6a23('0x97')]=_0x6776bf['value'];}else if(this['isNotNull'](_0x6776bf[_0x6a23('0x86')][_0x6a23('0x98')])){logger[_0x6a23('0x32')](_0x6a23('0x99'),_0x6776bf[_0x6a23('0x3c')],_0x6776bf[_0x6a23('0x88')]);this[_0x6a23('0x1e')][_0x6776bf[_0x6a23('0x3c')]][_0x6a23('0x15')]=_0x6776bf['value'];}else if(this['isNotNull'](_0x6776bf[_0x6a23('0x86')][_0x6a23('0x9a')])){logger[_0x6a23('0x32')](_0x6a23('0x9b'),_0x6776bf[_0x6a23('0x3c')],_0x6776bf['value']);this[_0x6a23('0x1e')][_0x6776bf[_0x6a23('0x3c')]][_0x6a23('0x9c')]=_0x6776bf['value'];}}}else if(this[_0x6a23('0x37')](_0x6776bf[_0x6a23('0x86')][_0x6a23('0x87')])){if(_0x6776bf[_0x6a23('0x88')]){var _0x4aa3d6=path['parse'](_0x6776bf['value'])[_0x6a23('0x4d')];logger[_0x6a23('0x32')](_0x6a23('0x9d'),_0x4aa3d6,_0x6776bf[_0x6a23('0x88')]);this[_0x6a23('0x7b')](_0x4aa3d6,_0x6776bf[_0x6a23('0x88')]);}}else if(this[_0x6a23('0x1e')][_0x6776bf[_0x6a23('0x40')]]){if(this[_0x6a23('0x37')](_0x6776bf[_0x6a23('0x86')])){if(this[_0x6a23('0x37')](_0x6776bf[_0x6a23('0x86')][_0x6a23('0x9a')])){logger['info'](_0x6a23('0x9b'),_0x6776bf[_0x6a23('0x40')],_0x6776bf['value']);this['channels'][_0x6776bf[_0x6a23('0x40')]][_0x6a23('0x9e')]=_0x6776bf[_0x6a23('0x88')];}}}}}catch(_0x13e586){logger[_0x6a23('0x59')]('[%s][voiceCallReport][varset]',_0x6776bf[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x13e586,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a23('0x3a')][_0x6a23('0x9f')]=function(_0x1ed5b){try{if(this['isNotNull'](_0x1ed5b)){logger[_0x6a23('0x3e')](_0x6a23('0xa0'),_0x1ed5b[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x1ed5b,{'showHidden':![],'depth':null}));if(this[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]]){logger[_0x6a23('0x32')](_0x6a23('0xa1'),_0x1ed5b[_0x6a23('0x3c')],_0x1ed5b[_0x6a23('0xa2')]);var _0x2718b3=moment();this[_0x6a23('0x1e')][_0x1ed5b['uniqueid']][_0x6a23('0xa3')]=_0x2718b3[_0x6a23('0x4b')](_0x6a23('0x54'));this[_0x6a23('0x1e')][_0x1ed5b['uniqueid']][_0x6a23('0x62')]=_0x2718b3[_0x6a23('0x71')](this[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]]['starttime'],_0x6a23('0x64'));if(this[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]][_0x6a23('0x6e')]){this[_0x6a23('0x1e')][_0x1ed5b['uniqueid']]['billableseconds']=_0x2718b3[_0x6a23('0x71')](this[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]]['answertime'],'seconds');this[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]][_0x6a23('0x70')]=this[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]][_0x6a23('0x62')]-this[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]][_0x6a23('0xa4')];}if(_0x1ed5b[_0x6a23('0x44')]===_0x6a23('0x45')){if(this['agents'][_0x1ed5b[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]]){this[_0x6a23('0x1f')][_0x1ed5b['channel']['split']('-')[0x0]]=_['omit'](this['agents'][_0x1ed5b['channel'][_0x6a23('0x49')]('-')[0x0]],[_0x6a23('0x4a')]);logger[_0x6a23('0x3e')](_0x6a23('0xa5'),_0x1ed5b['uniqueid'],util[_0x6a23('0x36')]({'id':this[_0x6a23('0x1f')][_0x1ed5b[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]]['id'],'destaccountcode':this[_0x6a23('0x1f')][_0x1ed5b[_0x6a23('0x48')]['split']('-')[0x0]][_0x6a23('0x4f')]},{'showHidden':![],'depth':null}));this[_0x6a23('0x39')](util[_0x6a23('0x4b')](_0x6a23('0x4c'),this['agents'][_0x1ed5b[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]][_0x6a23('0x4d')]),'user:agentcomplete',{'id':this[_0x6a23('0x1f')][_0x1ed5b[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]]['id'],'destaccountcode':this[_0x6a23('0x1f')][_0x1ed5b[_0x6a23('0x48')][_0x6a23('0x49')]('-')[0x0]][_0x6a23('0x4f')]});}}var _0x5492c8=this;Promise[_0x6a23('0xa6')]()[_0x6a23('0xa7')](function(){var _0x3589d3=_0x5492c8[_0x6a23('0x1e')][_0x1ed5b['uniqueid']];if(typeof _0x3589d3[_0x6a23('0xa8')]===_0x6a23('0xa9'))return;if(_['isEmpty'](_0x3589d3[_0x6a23('0x81')]))return;return RpcSetting[_0x6a23('0xaa')]()[_0x6a23('0xa7')](function(_0x176851){if(!_0x176851['stopRecordingOnTransfer'])return;return Promise[_0x6a23('0xa6')]()[_0x6a23('0xa7')](function(){return ami[_0x6a23('0xab')]({'action':_0x6a23('0xac'),'channel':_0x3589d3[_0x6a23('0x48')]})[_0x6a23('0xad')](function(){});})[_0x6a23('0xa7')](function(){return ami['Action']({'action':_0x6a23('0xac'),'channel':_0x3589d3[_0x6a23('0x75')]})[_0x6a23('0xad')](function(){})[_0x6a23('0xae')](function(){var _0x4ad1d1=_0x5492c8['agents'][_0x3589d3[_0x6a23('0x75')]['split']('-')[0x0]];if(!_0x4ad1d1)return;io[_0x6a23('0x39')](_0x6a23('0xaf'),{'agentId':_0x4ad1d1['id'],'uniqueid':_0x3589d3[_0x6a23('0x3c')]});});});});})['then'](function(){if(_0x1ed5b['event']===_0x6a23('0xb0')){_0x5492c8[_0x6a23('0x20')][_0x1ed5b[_0x6a23('0x3c')]]=_0x5492c8[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]];}else{if(_0x5492c8[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]][_0x6a23('0x8f')]===_0x6a23('0xb1')&&_0x5492c8[_0x6a23('0x20')][_0x1ed5b[_0x6a23('0x3c')]]){_0x5492c8[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]][_0x6a23('0x3c')]=[_0x5492c8[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]][_0x6a23('0x40')],_0x5492c8[_0x6a23('0x1e')][_0x1ed5b['uniqueid']][_0x6a23('0x40')]=_0x5492c8[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]][_0x6a23('0x3c')]][0x0];delete _0x5492c8[_0x6a23('0x20')][_0x1ed5b['uniqueid']];}}logger['debug'](_0x6a23('0xb2'),_0x1ed5b[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x5492c8[_0x6a23('0x1e')][_0x1ed5b[_0x6a23('0x3c')]],{'showHidden':![],'depth':null}));ami[_0x6a23('0x39')](_0x6a23('0xb3'),_0x5492c8['channels'][_0x1ed5b[_0x6a23('0x3c')]]);delete _0x5492c8['channels'][_0x1ed5b[_0x6a23('0x3c')]];});}}}catch(_0x6632e7){logger[_0x6a23('0x59')](_0x6a23('0xb4'),_0x1ed5b[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x6632e7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a23('0x3a')][_0x6a23('0xb5')]=function(_0x44269c){try{if(this[_0x6a23('0x37')](_0x44269c)){logger[_0x6a23('0x32')](_0x6a23('0xb6'),_0x44269c[_0x6a23('0x3c')],_0x44269c['origtransferercalleridnum'],_0x44269c['transfertargetcalleridnum']);logger[_0x6a23('0x3e')](_0x6a23('0xb7'),_0x44269c['uniqueid'],util[_0x6a23('0x36')](_0x44269c,{'showHidden':![],'depth':null}));if(this['channels'][_0x44269c[_0x6a23('0xb8')]]){this[_0x6a23('0x1e')][_0x44269c[_0x6a23('0xb8')]]['transfercalleridnum']=_0x44269c['origtransferercalleridnum'];this[_0x6a23('0x1e')][_0x44269c[_0x6a23('0xb8')]][_0x6a23('0xb9')]=_0x44269c[_0x6a23('0xba')];if(this['channels'][_0x44269c[_0x6a23('0xbb')]]){var _0x189170=this['channels'][_0x44269c[_0x6a23('0xbb')]];this['channels'][_0x44269c[_0x6a23('0xbb')]]=this[_0x6a23('0x1e')][_0x44269c['transfereeuniqueid']];this[_0x6a23('0x1e')][_0x44269c[_0x6a23('0xb8')]]=_0x189170;}}else if(this[_0x6a23('0x1e')][_0x44269c['transfertargetuniqueid']]){this['channels'][_0x44269c['transfertargetuniqueid']]['transfercalleridnum']=_0x44269c[_0x6a23('0xbc')];this[_0x6a23('0x1e')][_0x44269c[_0x6a23('0xbd')]]['transferconnectedlinenum']=_0x44269c['transfertargetcalleridnum'];if(this['channels'][_0x44269c[_0x6a23('0xbe')]]){var _0x189170=this[_0x6a23('0x1e')][_0x44269c['origtransfereruniqueid']];this[_0x6a23('0x1e')][_0x44269c['origtransfereruniqueid']]=this['channels'][_0x44269c[_0x6a23('0xbd')]];this['channels'][_0x44269c['transfertargetuniqueid']]=_0x189170;}}if((this[_0x6a23('0x1e')][_0x44269c['origtransfereruniqueid']]||this[_0x6a23('0x1e')][_0x44269c[_0x6a23('0xbf')]])&&this[_0x6a23('0x1e')][_0x44269c[_0x6a23('0xbb')]]){var _0x443509=_[_0x6a23('0xc0')]([this[_0x6a23('0x1e')][_0x44269c[_0x6a23('0xbe')]],this['channels'][_0x44269c[_0x6a23('0xbf')]],this[_0x6a23('0x1e')][_0x44269c[_0x6a23('0xbb')]]],function(_0x236683){return _0x236683&&_0x236683[_0x6a23('0x8f')]===_0x6a23('0xb1')&&_0x236683['routeid'];});if(_0x443509){if(this['channels'][_0x44269c[_0x6a23('0xbe')]])this[_0x6a23('0x1e')][_0x44269c[_0x6a23('0xbe')]]['transferType']=_0x6a23('0xc1');if(this[_0x6a23('0x1e')][_0x44269c[_0x6a23('0xbf')]])this['channels'][_0x44269c[_0x6a23('0xbf')]][_0x6a23('0xa8')]=_0x6a23('0xc1');this[_0x6a23('0x1e')][_0x44269c[_0x6a23('0xbb')]][_0x6a23('0xa8')]=_0x6a23('0xc1');}}}}catch(_0x43994d){logger[_0x6a23('0x59')](_0x6a23('0xc2'),_0x44269c[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x43994d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a23('0x3a')][_0x6a23('0x2e')]=function(_0x5dfda6){try{if(this[_0x6a23('0x37')](_0x5dfda6)){logger[_0x6a23('0x32')](_0x6a23('0xc3'),_0x5dfda6[_0x6a23('0x3c')],_0x5dfda6['transfereecalleridnum'],_0x5dfda6[_0x6a23('0xc4')]);logger['debug'](_0x6a23('0xc5'),_0x5dfda6['uniqueid'],util[_0x6a23('0x36')](_0x5dfda6,{'showHidden':![],'depth':null}));if(this['channels'][_0x5dfda6[_0x6a23('0xb8')]]){this[_0x6a23('0x1e')][_0x5dfda6[_0x6a23('0xb8')]][_0x6a23('0xc6')]=_0x5dfda6[_0x6a23('0xc7')];this[_0x6a23('0x1e')][_0x5dfda6[_0x6a23('0xb8')]][_0x6a23('0xb9')]=_0x5dfda6[_0x6a23('0xc4')];this['channels'][_0x5dfda6[_0x6a23('0xb8')]]['transferType']=_0x6a23('0xc8');this[_0x6a23('0x9f')]({'event':_0x6a23('0xb0'),'uniqueid':_0x5dfda6[_0x6a23('0xb8')],'context':_0x5dfda6[_0x6a23('0x44')],'channel':_0x5dfda6[_0x6a23('0xc9')]});}else{this['channels'][_0x5dfda6[_0x6a23('0xca')]][_0x6a23('0xa8')]=_0x6a23('0xc8');}}}catch(_0x2f57b6){logger['error'](_0x6a23('0xcb'),_0x5dfda6['uniqueid'],util[_0x6a23('0x36')](_0x2f57b6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a23('0x3a')][_0x6a23('0x2f')]=function(_0x265338){try{if(this['isNotNull'](_0x265338)){logger[_0x6a23('0x3e')]('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x265338[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x265338,{'showHidden':![],'depth':null}));if(this[_0x6a23('0x1e')][_0x265338['uniqueid']]){if(!_['isNil'](this[_0x6a23('0x1e')][_0x265338[_0x6a23('0x3c')]][_0x6a23('0x6f')])){this['channels'][_0x265338[_0x6a23('0x3c')]][_0x6a23('0xcc')]=moment()[_0x6a23('0x4b')](_0x6a23('0x54'));logger[_0x6a23('0x32')](_0x6a23('0xcd'),_0x265338['uniqueid'],this['channels'][_0x265338[_0x6a23('0x3c')]]['mohstarttime']);}}}}catch(_0x526b74){logger[_0x6a23('0x59')](_0x6a23('0xce'),_0x265338[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x526b74,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x6a23('0x3a')]['syncMusicOnHoldStop']=function(_0x466c1a){try{if(this[_0x6a23('0x37')](_0x466c1a)){logger['debug'](_0x6a23('0xcf'),_0x466c1a[_0x6a23('0x3c')],util['inspect'](_0x466c1a,{'showHidden':![],'depth':null}));if(this['channels'][_0x466c1a[_0x6a23('0x3c')]]){if(!_[_0x6a23('0x82')](this['channels'][_0x466c1a[_0x6a23('0x3c')]][_0x6a23('0xcc')])){this[_0x6a23('0x1e')][_0x466c1a['uniqueid']]['mohtime']+=moment()['milliseconds'](0x0)[_0x6a23('0x71')](this[_0x6a23('0x1e')][_0x466c1a[_0x6a23('0x3c')]][_0x6a23('0xcc')],'seconds');logger[_0x6a23('0x32')](_0x6a23('0xd0'),_0x466c1a['uniqueid'],this[_0x6a23('0x1e')][_0x466c1a['uniqueid']][_0x6a23('0xd1')]);delete this[_0x6a23('0x1e')][_0x466c1a[_0x6a23('0x3c')]][_0x6a23('0xcc')];}}}}catch(_0x499ce4){logger['error'](_0x6a23('0xd2'),_0x466c1a[_0x6a23('0x3c')],util[_0x6a23('0x36')](_0x499ce4,{'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 8478591..bdeac86 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 _0x9864=['holdtime','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','cdr(','split','match','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','newexten','syncNewExten','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','inspect','format','called','channel','substring','lastIndexOf','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','debug','voice_outbound_channel:save','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','YYYY-MM-DD\x20HH:mm:ss','connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','outboundrouteid','variables','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','value','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberlastcall','membername','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','endtime','duration','starttime','seconds','lastevent','complete','total','answered','diff'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x9864,0xf5));var _0x4986=function(_0x15d62f,_0x5546e7){_0x15d62f=_0x15d62f-0x0;var _0x58f009=_0x9864[_0x15d62f];return _0x58f009;};'use strict';var _=require(_0x4986('0x0'));var moment=require('moment');var util=require(_0x4986('0x1'));var Redis=require(_0x4986('0x2'));var config=require(_0x4986('0x3'));var logger=require(_0x4986('0x4'))('ami');var ami=require(_0x4986('0x5'));config[_0x4986('0x6')]=_[_0x4986('0x7')](config[_0x4986('0x6')],{'host':_0x4986('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceDialReport(_0x2d18c9){this[_0x4986('0x9')]=_0x2d18c9[_0x4986('0xa')];this[_0x4986('0xb')]=_0x2d18c9[_0x4986('0xb')];this[_0x4986('0xc')]={};this['variables']={};ami['on'](_0x4986('0xd'),this[_0x4986('0xe')][_0x4986('0xf')](this));ami['on'](_0x4986('0x10'),this[_0x4986('0x11')][_0x4986('0xf')](this));ami['on'](_0x4986('0x12'),this[_0x4986('0x13')][_0x4986('0xf')](this));ami['on'](_0x4986('0x14'),this[_0x4986('0x15')][_0x4986('0xf')](this));ami['on'](_0x4986('0x16'),this[_0x4986('0x17')][_0x4986('0xf')](this));}VoiceDialReport[_0x4986('0x18')][_0x4986('0x19')]=function(_0x453186){return _0x453186!==null&&!_[_0x4986('0x1a')](_0x453186);};VoiceDialReport['prototype'][_0x4986('0x1b')]=function(_0x41366b,_0x32cb20,_0x4443db){io['to'](_0x41366b)[_0x4986('0x1b')](_0x32cb20,_0x4443db);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x5b8a64){try{if(this[_0x4986('0x19')](_0x5b8a64)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x5b8a64[_0x4986('0x1c')],util[_0x4986('0x1d')](_0x5b8a64,{'showHidden':![],'depth':null}));if(this[_0x4986('0x9')][_0x5b8a64[_0x4986('0x1c')]]){_['merge'](this['channels'][_0x5b8a64['uniqueid']],{'starttime':moment()[_0x4986('0x1e')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x4986('0x1f'),'interface':_0x5b8a64[_0x4986('0x20')][_0x4986('0x21')](0x0,_0x5b8a64[_0x4986('0x20')]['lastIndexOf']('-')),'membername':_0x5b8a64[_0x4986('0x20')][_0x4986('0x21')](_0x5b8a64[_0x4986('0x20')][_0x4986('0x22')]('/')+0x1,_0x5b8a64[_0x4986('0x20')]['lastIndexOf']('-'))},_[_0x4986('0x23')](_0x5b8a64,[_0x4986('0x24'),'privilege']));logger[_0x4986('0x25')](_0x4986('0x26'),_0x5b8a64['uniqueid'],this[_0x4986('0x9')][_0x5b8a64[_0x4986('0x1c')]]['membername'],this['channels'][_0x5b8a64[_0x4986('0x1c')]]['interface']);logger[_0x4986('0x27')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x5b8a64[_0x4986('0x1c')],util[_0x4986('0x1d')](this[_0x4986('0x9')][_0x5b8a64[_0x4986('0x1c')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x5b8a64[_0x4986('0x1c')]])_['merge'](this[_0x4986('0x9')][_0x5b8a64['uniqueid']],this['applications'][_0x5b8a64['uniqueid']]);this[_0x4986('0x1b')]('voice:outbound',_0x4986('0x28'),this['channels'][_0x5b8a64[_0x4986('0x1c')]]);logger[_0x4986('0x27')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x5b8a64[_0x4986('0x1c')],util[_0x4986('0x1d')](this[_0x4986('0x9')][_0x5b8a64[_0x4986('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x4986('0x1b')]('custom:dialbegin',this['channels'][_0x5b8a64[_0x4986('0x1c')]]);}}}catch(_0x444a1a){logger[_0x4986('0x29')](_0x4986('0x2a'),_0x5b8a64[_0x4986('0x1c')],util[_0x4986('0x1d')](_0x444a1a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4986('0x18')][_0x4986('0x11')]=function(_0x87731b){try{if(this[_0x4986('0x19')](_0x87731b)){logger[_0x4986('0x27')](_0x4986('0x2b'),_0x87731b[_0x4986('0x1c')],util[_0x4986('0x1d')](_0x87731b,{'showHidden':![],'depth':null}));if(this[_0x4986('0x9')][_0x87731b[_0x4986('0x1c')]]){this[_0x4986('0x9')][_0x87731b['uniqueid']][_0x4986('0x2c')]=_0x87731b[_0x4986('0x2c')];if(_0x87731b[_0x4986('0x2c')]===_0x4986('0x2d')){this[_0x4986('0x9')][_0x87731b['uniqueid']][_0x4986('0x2e')]=_0x87731b[_0x4986('0x2e')];this[_0x4986('0x9')][_0x87731b[_0x4986('0x1c')]]['connectedlinename']=_0x87731b[_0x4986('0x2f')];this[_0x4986('0x9')][_0x87731b[_0x4986('0x1c')]][_0x4986('0x30')]=moment()[_0x4986('0x1e')](_0x4986('0x31'));this[_0x4986('0x9')][_0x87731b[_0x4986('0x1c')]]['lastevent']=_0x4986('0x32');logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x87731b[_0x4986('0x1c')],_0x87731b[_0x4986('0x20')][_0x4986('0x21')](_0x87731b[_0x4986('0x20')][_0x4986('0x22')]('/')+0x1,_0x87731b[_0x4986('0x20')]['lastIndexOf']('-')));logger[_0x4986('0x27')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x87731b['uniqueid'],util['inspect'](this[_0x4986('0x9')][_0x87731b[_0x4986('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x4986('0x1b')](_0x4986('0x33'),this[_0x4986('0x9')][_0x87731b[_0x4986('0x1c')]]);}logger['debug'](_0x4986('0x34'),_0x87731b[_0x4986('0x1c')],util['inspect'](this[_0x4986('0x9')][_0x87731b[_0x4986('0x1c')]],{'showHidden':![],'depth':null}));this[_0x4986('0x1b')](_0x4986('0x35'),_0x4986('0x28'),this[_0x4986('0x9')][_0x87731b[_0x4986('0x1c')]]);}}}catch(_0x261e69){logger[_0x4986('0x29')](_0x4986('0x36'),_0x87731b[_0x4986('0x1c')],util[_0x4986('0x1d')](_0x261e69,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4986('0x18')]['syncVarSet']=function(_0x1e6f0f){try{if(this['isNotNull'](_0x1e6f0f)){logger[_0x4986('0x27')](_0x4986('0x37'),_0x1e6f0f[_0x4986('0x1c')],util[_0x4986('0x1d')](_0x1e6f0f,{'showHidden':![],'depth':null}));this[_0x4986('0x38')](_0x1e6f0f[_0x4986('0x1c')],_['keys'](_0x1e6f0f[_0x4986('0x39')])[0x0],_0x1e6f0f['value']);if(this['isNotNull'](_0x1e6f0f[_0x4986('0x39')])&&this['isNotNull'](_0x1e6f0f[_0x4986('0x39')][_0x4986('0x3a')])){if(_[_0x4986('0x1a')](this[_0x4986('0x9')][_0x1e6f0f[_0x4986('0x1c')]])){this[_0x4986('0x9')][_0x1e6f0f[_0x4986('0x1c')]]={'routeId':_0x1e6f0f['value'],'variables':this[_0x4986('0x3b')][_0x1e6f0f[_0x4986('0x1c')]]};logger[_0x4986('0x25')](_0x4986('0x3c'),_0x1e6f0f[_0x4986('0x1c')],_0x1e6f0f['variable'][_0x4986('0x3a')],_[_0x4986('0x3d')](_0x1e6f0f[_0x4986('0x39')])[0x0],_0x1e6f0f[_0x4986('0x3e')]);logger[_0x4986('0x27')](_0x4986('0x3f'),_0x1e6f0f[_0x4986('0x1c')],util['inspect'](this[_0x4986('0x9')][_0x1e6f0f[_0x4986('0x1c')]],{'showHidden':![],'depth':null}));this[_0x4986('0x1b')](_0x4986('0x35'),'voice_outbound_channel:save',this[_0x4986('0x9')][_0x1e6f0f[_0x4986('0x1c')]]);}}}}catch(_0x2cfbf3){logger[_0x4986('0x29')](_0x4986('0x40'),_0x1e6f0f[_0x4986('0x1c')],util[_0x4986('0x1d')](_0x2cfbf3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x4986('0x18')][_0x4986('0x38')]=function(_0x5eff71,_0xbc22fb,_0x1889bd){var _0x4fe5f7=[_0x4986('0x41'),'rtpaudioqosbridged',_0x4986('0x42'),_0x4986('0x43'),_0x4986('0x44'),'rtpaudioqoslossbridged',_0x4986('0x45'),_0x4986('0x46'),'sipcallid',_0x4986('0x47'),_0x4986('0x48'),_0x4986('0x49'),'membercalls',_0x4986('0x4a'),'memberinterface',_0x4986('0x4b'),_0x4986('0x4c'),_0x4986('0x4d'),_0x4986('0x4e')];if(!_['isNil'](_0xbc22fb)&&!_[_0x4986('0x4f')](_0x4fe5f7,_0xbc22fb)){if(_[_0x4986('0x1a')](this[_0x4986('0x3b')][_0x5eff71])){this[_0x4986('0x3b')][_0x5eff71]={};}this['variables'][_0x5eff71][_0xbc22fb]=_0x1889bd;}};VoiceDialReport[_0x4986('0x18')]['syncHangup']=function(_0x55cbf2){try{if(this[_0x4986('0x19')](_0x55cbf2)){logger['debug'](_0x4986('0x50'),_0x55cbf2[_0x4986('0x1c')],util['inspect'](_0x55cbf2,{'showHidden':![],'depth':null}));if(this['channels'][_0x55cbf2[_0x4986('0x1c')]]){logger[_0x4986('0x25')](_0x4986('0x51'),_0x55cbf2[_0x4986('0x1c')],_0x55cbf2['cause-txt']);this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x1c')]][_0x4986('0x52')]=moment()[_0x4986('0x1e')](_0x4986('0x31'));this['channels'][_0x55cbf2['uniqueid']][_0x4986('0x53')]=moment(this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x1c')]]['endtime'])['diff'](this['channels'][_0x55cbf2[_0x4986('0x1c')]][_0x4986('0x54')],_0x4986('0x55'));this[_0x4986('0x9')][_0x55cbf2['uniqueid']][_0x4986('0x56')]=_0x4986('0x57');this[_0x4986('0xb')][_0x4986('0x58')]+=0x1;if(this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x1c')]]['answertime']){this[_0x4986('0xb')][_0x4986('0x59')]+=0x1;this['channels'][_0x55cbf2[_0x4986('0x1c')]]['holdtime']=moment(this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x1c')]][_0x4986('0x30')])[_0x4986('0x5a')](this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x1c')]][_0x4986('0x54')],_0x4986('0x55'));this['channels'][_0x55cbf2[_0x4986('0x1c')]]['billableseconds']=moment(this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x1c')]][_0x4986('0x52')])[_0x4986('0x5a')](this['channels'][_0x55cbf2[_0x4986('0x1c')]][_0x4986('0x30')],_0x4986('0x55'));this[_0x4986('0xb')]['sumHoldTime']+=this['channels'][_0x55cbf2[_0x4986('0x1c')]][_0x4986('0x5b')]||0x0;this['outbound']['sumBillable']+=this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x1c')]][_0x4986('0x5c')];}this[_0x4986('0xb')][_0x4986('0x5d')]+=this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x1c')]][_0x4986('0x53')];logger[_0x4986('0x27')](_0x4986('0x5e'),_0x55cbf2[_0x4986('0x1c')],util['inspect'](this[_0x4986('0x9')][_0x55cbf2['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x4986('0x1b')]('custom:voiceDialReport',this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x1c')]]);logger['debug'](_0x4986('0x5f'),_0x55cbf2[_0x4986('0x1c')],util[_0x4986('0x1d')](this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x1c')]],{'showHidden':![],'depth':null}));ami['emit'](_0x4986('0x60'),this[_0x4986('0x9')][_0x55cbf2['uniqueid']]);logger[_0x4986('0x27')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x55cbf2[_0x4986('0x1c')],util[_0x4986('0x1d')](this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x1c')]],{'showHidden':![],'depth':null}));this[_0x4986('0x1b')](_0x4986('0x35'),_0x4986('0x61'),this[_0x4986('0xb')]);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x4986('0x9')][_0x55cbf2['uniqueid']]));logger[_0x4986('0x27')](_0x4986('0x62'),_0x55cbf2['uniqueid'],util[_0x4986('0x1d')](this['channels'][_0x55cbf2['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x4986('0x35'),_0x4986('0x63'),this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x1c')]]);delete this[_0x4986('0x9')][_0x55cbf2['uniqueid']];}else if(this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x64')]]){this[_0x4986('0x9')][_0x55cbf2[_0x4986('0x64')]][_0x4986('0x1c')]=this[_0x4986('0x9')][_0x55cbf2['linkedid']][_0x4986('0x65')];}if(this['variables'][_0x55cbf2[_0x4986('0x1c')]]){delete this[_0x4986('0x3b')][_0x55cbf2[_0x4986('0x1c')]];}}}catch(_0x4dc5a4){logger[_0x4986('0x29')](_0x4986('0x66'),_0x55cbf2[_0x4986('0x1c')],util[_0x4986('0x1d')](_0x4dc5a4,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x4986('0x15')]=function(_0x44c85a){try{if(this[_0x4986('0x19')](_0x44c85a)){logger['debug'](_0x4986('0x67'),_0x44c85a[_0x4986('0x1c')],util[_0x4986('0x1d')](_0x44c85a,{'showHidden':![],'depth':null}));if(_0x44c85a[_0x4986('0x68')][_0x4986('0x69')]()===_0x4986('0x6a')){_0x44c85a[_0x4986('0x6b')]=(_0x44c85a['appdata']||_0x44c85a[_0x4986('0x6b')])[_0x4986('0x69')]();if(_['startsWith'](_0x44c85a[_0x4986('0x6b')],_0x4986('0x6c'))){if(_['isUndefined'](this['applications'][_0x44c85a[_0x4986('0x1c')]]))this[_0x4986('0xc')][_0x44c85a[_0x4986('0x1c')]]={};logger[_0x4986('0x25')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x44c85a['uniqueid'],_0x44c85a['application'],_0x44c85a['applicationdata']);var _0x2ecef0=_0x44c85a[_0x4986('0x6b')][_0x4986('0x6d')]('=');var _0x3d21d7=_0x2ecef0[0x0][_0x4986('0x6e')](/cdr\((.*)\)/);if(_0x3d21d7)this[_0x4986('0xc')][_0x44c85a[_0x4986('0x1c')]][_0x3d21d7[0x1]]=_0x2ecef0[0x1];}}}}catch(_0x40a56c){logger[_0x4986('0x29')]('[%s][voiceDialReport][newexten]',_0x44c85a[_0x4986('0x1c')],util[_0x4986('0x1d')](_0x40a56c,{'showHidden':![],'depth':null}));}};module[_0x4986('0x6f')]=VoiceDialReport; \ No newline at end of file +var _0xf6a5=['sumBillable','billableseconds','sumDuration','duration','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','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]','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','dialend','syncDialEnd','syncVarSet','bind','newexten','syncNewExten','hangup','syncHangup','isNotNull','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','connectedlinename','answertime','format','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','info','cause-txt','endtime','diff','seconds','complete','total','answered','holdtime','starttime'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xf6a5,0x92));var _0x5f6a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf6a5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require(_0x5f6a('0x0'));var util=require(_0x5f6a('0x1'));var Redis=require(_0x5f6a('0x2'));var config=require(_0x5f6a('0x3'));var logger=require(_0x5f6a('0x4'))(_0x5f6a('0x5'));var ami=require(_0x5f6a('0x6'));config[_0x5f6a('0x7')]=_[_0x5f6a('0x8')](config[_0x5f6a('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x5f6a('0x9'))(new Redis(config[_0x5f6a('0x7')]));function VoiceDialReport(_0x35b810){this[_0x5f6a('0xa')]=_0x35b810[_0x5f6a('0xb')];this[_0x5f6a('0xc')]=_0x35b810[_0x5f6a('0xc')];this[_0x5f6a('0xd')]={};this[_0x5f6a('0xe')]={};ami['on'](_0x5f6a('0xf'),this[_0x5f6a('0x10')]['bind'](this));ami['on'](_0x5f6a('0x11'),this[_0x5f6a('0x12')]['bind'](this));ami['on']('varset',this[_0x5f6a('0x13')][_0x5f6a('0x14')](this));ami['on'](_0x5f6a('0x15'),this[_0x5f6a('0x16')][_0x5f6a('0x14')](this));ami['on'](_0x5f6a('0x17'),this[_0x5f6a('0x18')][_0x5f6a('0x14')](this));}VoiceDialReport['prototype'][_0x5f6a('0x19')]=function(_0x5701fd){return _0x5701fd!==null&&!_[_0x5f6a('0x1a')](_0x5701fd);};VoiceDialReport[_0x5f6a('0x1b')][_0x5f6a('0x1c')]=function(_0x35e80a,_0x4715ac,_0x2fcbf8){io['to'](_0x35e80a)[_0x5f6a('0x1c')](_0x4715ac,_0x2fcbf8);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x16ec2a){try{if(this[_0x5f6a('0x19')](_0x16ec2a)){logger[_0x5f6a('0x1d')](_0x5f6a('0x1e'),_0x16ec2a[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](_0x16ec2a,{'showHidden':![],'depth':null}));if(this[_0x5f6a('0xa')][_0x16ec2a[_0x5f6a('0x1f')]]){_[_0x5f6a('0x21')](this[_0x5f6a('0xa')][_0x16ec2a[_0x5f6a('0x1f')]],{'starttime':moment()['format'](_0x5f6a('0x22')),'lastevent':_0x5f6a('0x23'),'interface':_0x16ec2a[_0x5f6a('0x24')][_0x5f6a('0x25')](0x0,_0x16ec2a[_0x5f6a('0x24')][_0x5f6a('0x26')]('-')),'membername':_0x16ec2a[_0x5f6a('0x24')]['substring'](_0x16ec2a[_0x5f6a('0x24')][_0x5f6a('0x26')]('/')+0x1,_0x16ec2a['channel'][_0x5f6a('0x26')]('-'))},_['omit'](_0x16ec2a,['event','privilege']));logger['info'](_0x5f6a('0x27'),_0x16ec2a[_0x5f6a('0x1f')],this['channels'][_0x16ec2a[_0x5f6a('0x1f')]][_0x5f6a('0x28')],this['channels'][_0x16ec2a['uniqueid']][_0x5f6a('0x29')]);logger[_0x5f6a('0x1d')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x16ec2a['uniqueid'],util[_0x5f6a('0x20')](this[_0x5f6a('0xa')][_0x16ec2a[_0x5f6a('0x1f')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x16ec2a[_0x5f6a('0x1f')]])_[_0x5f6a('0x21')](this[_0x5f6a('0xa')][_0x16ec2a[_0x5f6a('0x1f')]],this['applications'][_0x16ec2a['uniqueid']]);this['emit'](_0x5f6a('0x2a'),_0x5f6a('0x2b'),this[_0x5f6a('0xa')][_0x16ec2a[_0x5f6a('0x1f')]]);logger[_0x5f6a('0x1d')](_0x5f6a('0x2c'),_0x16ec2a[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](this[_0x5f6a('0xa')][_0x16ec2a[_0x5f6a('0x1f')]],{'showHidden':![],'depth':null}));ami[_0x5f6a('0x1c')]('custom:dialbegin',this[_0x5f6a('0xa')][_0x16ec2a['uniqueid']]);}}}catch(_0x3e7718){logger[_0x5f6a('0x2d')](_0x5f6a('0x2e'),_0x16ec2a[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](_0x3e7718,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5f6a('0x1b')][_0x5f6a('0x12')]=function(_0x54dae8){try{if(this[_0x5f6a('0x19')](_0x54dae8)){logger[_0x5f6a('0x1d')](_0x5f6a('0x2f'),_0x54dae8[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](_0x54dae8,{'showHidden':![],'depth':null}));if(this['channels'][_0x54dae8[_0x5f6a('0x1f')]]){this[_0x5f6a('0xa')][_0x54dae8['uniqueid']]['dialstatus']=_0x54dae8['dialstatus'];if(_0x54dae8['dialstatus']==='ANSWER'){this[_0x5f6a('0xa')][_0x54dae8['uniqueid']]['connectedlinenum']=_0x54dae8['connectedlinenum'];this[_0x5f6a('0xa')][_0x54dae8[_0x5f6a('0x1f')]][_0x5f6a('0x30')]=_0x54dae8[_0x5f6a('0x30')];this[_0x5f6a('0xa')][_0x54dae8[_0x5f6a('0x1f')]][_0x5f6a('0x31')]=moment()[_0x5f6a('0x32')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x5f6a('0xa')][_0x54dae8['uniqueid']][_0x5f6a('0x33')]=_0x5f6a('0x34');logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x54dae8[_0x5f6a('0x1f')],_0x54dae8[_0x5f6a('0x24')][_0x5f6a('0x25')](_0x54dae8[_0x5f6a('0x24')]['lastIndexOf']('/')+0x1,_0x54dae8[_0x5f6a('0x24')][_0x5f6a('0x26')]('-')));logger[_0x5f6a('0x1d')](_0x5f6a('0x35'),_0x54dae8[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](this[_0x5f6a('0xa')][_0x54dae8[_0x5f6a('0x1f')]],{'showHidden':![],'depth':null}));ami[_0x5f6a('0x1c')](_0x5f6a('0x36'),this[_0x5f6a('0xa')][_0x54dae8[_0x5f6a('0x1f')]]);}logger[_0x5f6a('0x1d')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x54dae8[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](this[_0x5f6a('0xa')][_0x54dae8[_0x5f6a('0x1f')]],{'showHidden':![],'depth':null}));this[_0x5f6a('0x1c')](_0x5f6a('0x2a'),_0x5f6a('0x2b'),this[_0x5f6a('0xa')][_0x54dae8[_0x5f6a('0x1f')]]);}}}catch(_0x4d5fd3){logger[_0x5f6a('0x2d')](_0x5f6a('0x37'),_0x54dae8['uniqueid'],util['inspect'](_0x4d5fd3,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5f6a('0x1b')][_0x5f6a('0x13')]=function(_0x19abd8){try{if(this[_0x5f6a('0x19')](_0x19abd8)){logger[_0x5f6a('0x1d')](_0x5f6a('0x38'),_0x19abd8[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](_0x19abd8,{'showHidden':![],'depth':null}));this[_0x5f6a('0x39')](_0x19abd8[_0x5f6a('0x1f')],_['keys'](_0x19abd8[_0x5f6a('0x3a')])[0x0],_0x19abd8[_0x5f6a('0x3b')]);if(this['isNotNull'](_0x19abd8['variable'])&&this['isNotNull'](_0x19abd8[_0x5f6a('0x3a')][_0x5f6a('0x3c')])){if(_['isUndefined'](this[_0x5f6a('0xa')][_0x19abd8[_0x5f6a('0x1f')]])){this[_0x5f6a('0xa')][_0x19abd8[_0x5f6a('0x1f')]]={'routeId':_0x19abd8['value'],'variables':this['variables'][_0x19abd8[_0x5f6a('0x1f')]]};logger['info'](_0x5f6a('0x3d'),_0x19abd8[_0x5f6a('0x1f')],_0x19abd8[_0x5f6a('0x3a')]['outboundrouteid'],_['keys'](_0x19abd8[_0x5f6a('0x3a')])[0x0],_0x19abd8['value']);logger[_0x5f6a('0x1d')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x19abd8[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](this[_0x5f6a('0xa')][_0x19abd8[_0x5f6a('0x1f')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0x5f6a('0x2b'),this[_0x5f6a('0xa')][_0x19abd8[_0x5f6a('0x1f')]]);}}}}catch(_0x596fc6){logger[_0x5f6a('0x2d')]('[%s][voiceDialReport][varset]',_0x19abd8[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](_0x596fc6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5f6a('0x1b')][_0x5f6a('0x39')]=function(_0x4c9bcd,_0x3b5570,_0x5713a6){var _0x47f600=[_0x5f6a('0x3e'),_0x5f6a('0x3f'),_0x5f6a('0x40'),_0x5f6a('0x41'),_0x5f6a('0x42'),_0x5f6a('0x43'),_0x5f6a('0x44'),_0x5f6a('0x45'),_0x5f6a('0x46'),_0x5f6a('0x47'),_0x5f6a('0x48'),_0x5f6a('0x49'),_0x5f6a('0x4a'),_0x5f6a('0x4b'),'memberinterface',_0x5f6a('0x4c'),_0x5f6a('0x28'),_0x5f6a('0x4d'),_0x5f6a('0x4e')];if(!_[_0x5f6a('0x4f')](_0x3b5570)&&!_[_0x5f6a('0x50')](_0x47f600,_0x3b5570)){if(_[_0x5f6a('0x1a')](this[_0x5f6a('0xe')][_0x4c9bcd])){this[_0x5f6a('0xe')][_0x4c9bcd]={};}this[_0x5f6a('0xe')][_0x4c9bcd][_0x3b5570]=_0x5713a6;}};VoiceDialReport[_0x5f6a('0x1b')][_0x5f6a('0x18')]=function(_0x238fb8){try{if(this[_0x5f6a('0x19')](_0x238fb8)){logger[_0x5f6a('0x1d')](_0x5f6a('0x51'),_0x238fb8['uniqueid'],util['inspect'](_0x238fb8,{'showHidden':![],'depth':null}));if(this['channels'][_0x238fb8['uniqueid']]){logger[_0x5f6a('0x52')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x238fb8[_0x5f6a('0x1f')],_0x238fb8[_0x5f6a('0x53')]);this['channels'][_0x238fb8['uniqueid']][_0x5f6a('0x54')]=moment()['format'](_0x5f6a('0x22'));this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]]['duration']=moment(this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]][_0x5f6a('0x54')])[_0x5f6a('0x55')](this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]]['starttime'],_0x5f6a('0x56'));this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]][_0x5f6a('0x33')]=_0x5f6a('0x57');this[_0x5f6a('0xc')][_0x5f6a('0x58')]+=0x1;if(this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]][_0x5f6a('0x31')]){this[_0x5f6a('0xc')][_0x5f6a('0x59')]+=0x1;this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]][_0x5f6a('0x5a')]=moment(this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]]['answertime'])[_0x5f6a('0x55')](this['channels'][_0x238fb8[_0x5f6a('0x1f')]][_0x5f6a('0x5b')],_0x5f6a('0x56'));this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]]['billableseconds']=moment(this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]][_0x5f6a('0x54')])[_0x5f6a('0x55')](this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]][_0x5f6a('0x31')],_0x5f6a('0x56'));this[_0x5f6a('0xc')]['sumHoldTime']+=this['channels'][_0x238fb8[_0x5f6a('0x1f')]][_0x5f6a('0x5a')]||0x0;this[_0x5f6a('0xc')][_0x5f6a('0x5c')]+=this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]][_0x5f6a('0x5d')];}this[_0x5f6a('0xc')][_0x5f6a('0x5e')]+=this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]][_0x5f6a('0x5f')];logger[_0x5f6a('0x1d')]('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x238fb8['uniqueid'],util[_0x5f6a('0x20')](this['channels'][_0x238fb8['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x5f6a('0x1c')](_0x5f6a('0x60'),this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]]);logger[_0x5f6a('0x1d')](_0x5f6a('0x61'),_0x238fb8[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]],{'showHidden':![],'depth':null}));ami[_0x5f6a('0x1c')](_0x5f6a('0x62'),this['channels'][_0x238fb8[_0x5f6a('0x1f')]]);logger[_0x5f6a('0x1d')](_0x5f6a('0x63'),_0x238fb8['uniqueid'],util[_0x5f6a('0x20')](this[_0x5f6a('0xa')][_0x238fb8['uniqueid']],{'showHidden':![],'depth':null}));this[_0x5f6a('0x1c')](_0x5f6a('0x2a'),_0x5f6a('0x64'),this[_0x5f6a('0xc')]);logger[_0x5f6a('0x52')](_0x5f6a('0x65'),JSON[_0x5f6a('0x66')](this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]]));logger[_0x5f6a('0x1d')](_0x5f6a('0x67'),_0x238fb8[_0x5f6a('0x1f')],util['inspect'](this['channels'][_0x238fb8[_0x5f6a('0x1f')]],{'showHidden':![],'depth':null}));this[_0x5f6a('0x1c')](_0x5f6a('0x2a'),_0x5f6a('0x68'),this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x1f')]]);delete this['channels'][_0x238fb8[_0x5f6a('0x1f')]];}else if(this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x69')]]){this[_0x5f6a('0xa')][_0x238fb8[_0x5f6a('0x69')]][_0x5f6a('0x1f')]=this[_0x5f6a('0xa')][_0x238fb8['linkedid']][_0x5f6a('0x6a')];}if(this['variables'][_0x238fb8[_0x5f6a('0x1f')]]){delete this[_0x5f6a('0xe')][_0x238fb8['uniqueid']];}}}catch(_0x5b553d){logger[_0x5f6a('0x2d')](_0x5f6a('0x6b'),_0x238fb8[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](_0x5b553d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5f6a('0x1b')]['syncNewExten']=function(_0x41fae4){try{if(this['isNotNull'](_0x41fae4)){logger['debug'](_0x5f6a('0x6c'),_0x41fae4[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](_0x41fae4,{'showHidden':![],'depth':null}));if(_0x41fae4[_0x5f6a('0x6d')][_0x5f6a('0x6e')]()===_0x5f6a('0x6f')){_0x41fae4['applicationdata']=(_0x41fae4['appdata']||_0x41fae4[_0x5f6a('0x70')])[_0x5f6a('0x6e')]();if(_[_0x5f6a('0x71')](_0x41fae4[_0x5f6a('0x70')],_0x5f6a('0x72'))){if(_[_0x5f6a('0x1a')](this[_0x5f6a('0xd')][_0x41fae4[_0x5f6a('0x1f')]]))this['applications'][_0x41fae4[_0x5f6a('0x1f')]]={};logger[_0x5f6a('0x52')](_0x5f6a('0x73'),_0x41fae4[_0x5f6a('0x1f')],_0x41fae4[_0x5f6a('0x6d')],_0x41fae4[_0x5f6a('0x70')]);var _0x5129d4=_0x41fae4[_0x5f6a('0x70')][_0x5f6a('0x74')]('=');var _0x7c556d=_0x5129d4[0x0][_0x5f6a('0x75')](/cdr\((.*)\)/);if(_0x7c556d)this['applications'][_0x41fae4[_0x5f6a('0x1f')]][_0x7c556d[0x1]]=_0x5129d4[0x1];}}}}catch(_0x497731){logger[_0x5f6a('0x2d')]('[%s][voiceDialReport][newexten]',_0x41fae4[_0x5f6a('0x1f')],util[_0x5f6a('0x20')](_0x497731,{'showHidden':![],'depth':null}));}};module[_0x5f6a('0x76')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 75da846..7996419 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 _0xc2e8=['queuecallercompleteAt','holdtime','originalposition','queuecallerexitreason','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','queuecallerabandonAt','assigned','membername','queuecallerexit','transfer','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','linkedid','queuecallerexitAt','seconds','transfertype','FORWARD','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','keys','value','variable','queuestatus','CONTINUE','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','varset','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceQueueReport][hangup]','length','diff','milliseconds','custom:queuecallerunmanaged','lastevent','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','hangup','custom:voiceQueueReport','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfererexten','transferuniqueid','ATTENDEDTRANSFER','secondtransfereruniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','application','toLowerCase','set','applicationdata','appdata','CDR(routeAlias)','startsWith','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','ioredis','../../../config/logger','ami','../ami','redis','defaults','tail','finally','sequence','queueReports','agents','channels','queueChannels','campaigns','variables','queuesummary','syncQueueSummary','bind','queuesummarycomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','syncHangup','syncFullyBooted','newexten','syncNewExten','syncMusicOnHoldStart','syncMusicOnHoldStop','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','prototype','clearZombieChannels','enqueue','Action','status','channel','catch','message','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','voiceQueues','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','name','voice_queue_presence:save','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','total','unmanaged','abandoned','Trunk','active','callerid','Interval','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','loopQueueShow','queues','[voiceQueueReport][queues]','flagQueueSummary','then','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','callers','toNumber','loggedin','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','syncQueueSummaryComplete','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','merge','push','[%s][voiceQueueReport][queuecallerabandon]','last'];(function(_0x45f9d7,_0xdb64c){var _0x14259a=function(_0xacdd01){while(--_0xacdd01){_0x45f9d7['push'](_0x45f9d7['shift']());}};_0x14259a(++_0xdb64c);}(_0xc2e8,0x70));var _0x8c2e=function(_0x3b1a6b,_0x44d0f5){_0x3b1a6b=_0x3b1a6b-0x0;var _0x1fced8=_0xc2e8[_0x3b1a6b];return _0x1fced8;};'use strict';var _=require(_0x8c2e('0x0'));var moment=require(_0x8c2e('0x1'));var util=require('util');var md5=require('md5');var Redis=require(_0x8c2e('0x2'));var config=require('../../../config/environment');var logger=require(_0x8c2e('0x3'))(_0x8c2e('0x4'));var ami=require(_0x8c2e('0x5'));var QueueReport=require('../model/queueReport');config[_0x8c2e('0x6')]=_[_0x8c2e('0x7')](config[_0x8c2e('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0xcc200c){this[_0x8c2e('0x8')]=this[_0x8c2e('0x8')]?this[_0x8c2e('0x8')][_0x8c2e('0x9')](_0xcc200c):_0xcc200c();};function VoiceQueueReport(_0x3414c5){this[_0x8c2e('0xa')]=new Sequence();this[_0x8c2e('0xb')]={};this['agents']=_0x3414c5[_0x8c2e('0xc')];this[_0x8c2e('0xd')]=_0x3414c5[_0x8c2e('0xe')];this['voiceQueues']=_0x3414c5['voiceQueues'];this['flagQueueSummary']=!![];this[_0x8c2e('0xf')]=_0x3414c5[_0x8c2e('0xf')];this[_0x8c2e('0x10')]={};ami['on'](_0x8c2e('0x11'),this[_0x8c2e('0x12')][_0x8c2e('0x13')](this));ami['on'](_0x8c2e('0x14'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x8c2e('0x15'),this[_0x8c2e('0x16')][_0x8c2e('0x13')](this));ami['on'](_0x8c2e('0x17'),this[_0x8c2e('0x18')][_0x8c2e('0x13')](this));ami['on']('queuecallerleave',this[_0x8c2e('0x19')][_0x8c2e('0x13')](this));ami['on'](_0x8c2e('0x1a'),this[_0x8c2e('0x1b')]['bind'](this));ami['on'](_0x8c2e('0x1c'),this[_0x8c2e('0x1d')][_0x8c2e('0x13')](this));ami['on']('varset',this['syncVarSet'][_0x8c2e('0x13')](this));ami['on']('hangup',this[_0x8c2e('0x1e')][_0x8c2e('0x13')](this));ami['on']('fullybooted',this[_0x8c2e('0x1f')][_0x8c2e('0x13')](this));ami['on'](_0x8c2e('0x20'),this[_0x8c2e('0x21')][_0x8c2e('0x13')](this));ami['on']('musiconholdstart',this[_0x8c2e('0x22')]['bind'](this));ami['on']('musiconholdstop',this[_0x8c2e('0x23')][_0x8c2e('0x13')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0x8c2e('0x13')](this));ami['on']('blindtransfer',this[_0x8c2e('0x24')][_0x8c2e('0x13')](this));this[_0x8c2e('0x25')]();this['loopQueueShow']();}function clearChannels(_0x2614f7){if(!_[_0x8c2e('0x26')](_0x2614f7)){for(var _0x2dfd48 in _0x2614f7){if(_0x2614f7[_0x8c2e('0x27')](_0x2dfd48)){delete _0x2614f7[_0x2dfd48];}}}}function clearCampaigns(_0x5714dc){if(!_[_0x8c2e('0x26')](_0x5714dc)){for(var _0x50f221 in _0x5714dc){if(_0x5714dc['hasOwnProperty'](_0x50f221)){_0x5714dc[_0x50f221][_0x8c2e('0x28')]=0x0;}}}}function clearVoiceQueues(_0x26fa84){if(!_['isEmpty'](_0x26fa84)){for(var _0x4d0c3c in _0x26fa84){if(_0x26fa84[_0x8c2e('0x27')](_0x4d0c3c)){_0x26fa84[_0x4d0c3c][_0x8c2e('0x28')]=0x0;_0x26fa84[_0x4d0c3c][_0x8c2e('0x29')]=0x0;_0x26fa84[_0x4d0c3c][_0x8c2e('0x2a')]=0x0;_0x26fa84[_0x4d0c3c][_0x8c2e('0x2b')]=0x0;_0x26fa84[_0x4d0c3c][_0x8c2e('0x2c')]=!![];}}}}function clearAgentBooked(_0x39a9bc){if(!_['isEmpty'](_0x39a9bc)){for(var _0x5e123b in _0x39a9bc){if(_0x39a9bc['hasOwnProperty'](_0x5e123b)){_0x39a9bc[_0x5e123b][_0x8c2e('0x2d')]=!![];}}}}VoiceQueueReport[_0x8c2e('0x2e')][_0x8c2e('0x2f')]=function(){var _0x534315=this;for(var _0x89de37 in this[_0x8c2e('0xd')]){if(this[_0x8c2e('0xd')][_0x8c2e('0x27')](_0x89de37)&&!this[_0x8c2e('0xd')][_0x89de37]['switch']){this[_0x8c2e('0xa')][_0x8c2e('0x30')](function(){if(!_['isNil'](_0x534315[_0x8c2e('0xd')][_0x89de37])){return ami[_0x8c2e('0x31')]({'action':_0x8c2e('0x32'),'channel':_0x534315[_0x8c2e('0xd')][_0x89de37][_0x8c2e('0x33')]})[_0x8c2e('0x34')](function(_0x1ef971){if(_0x1ef971[_0x8c2e('0x35')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x534315[_0x8c2e('0xd')][_0x89de37]){delete _0x534315[_0x8c2e('0xd')][_0x89de37];logger[_0x8c2e('0x36')](_0x8c2e('0x37'),_0x89de37,util[_0x8c2e('0x38')](_0x1ef971,{'showHidden':![],'depth':null}));}if(_0x534315[_0x8c2e('0xb')][_0x89de37]){delete _0x534315[_0x8c2e('0xb')][_0x89de37];logger[_0x8c2e('0x36')](_0x8c2e('0x39'),_0x89de37,util['inspect'](_0x1ef971,{'showHidden':![],'depth':null}));}if(_0x534315[_0x8c2e('0x10')][_0x89de37]){delete _0x534315[_0x8c2e('0x10')][_0x89de37];logger[_0x8c2e('0x36')](_0x8c2e('0x3a'),_0x89de37,util[_0x8c2e('0x38')](_0x1ef971,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0x8c2e('0x36')](_0x8c2e('0x3b'));clearChannels(this[_0x8c2e('0xd')]);this[_0x8c2e('0x3c')](this[_0x8c2e('0xb')]);clearAgentBooked(this[_0x8c2e('0xc')]);clearVoiceQueues(this[_0x8c2e('0x3d')]);clearCampaigns(this['campaigns']);};VoiceQueueReport['prototype'][_0x8c2e('0x3c')]=function(_0x1aaa5b){var _0x2bba29=this;if(!_[_0x8c2e('0x26')](_0x1aaa5b)){for(var _0x2123bd in _0x1aaa5b){if(_0x1aaa5b[_0x8c2e('0x27')](_0x2123bd)){_0x2bba29[_0x8c2e('0x3e')](_0x1aaa5b[_0x2123bd],_0x8c2e('0x3f'));delete _0x1aaa5b[_0x2123bd];}}}};VoiceQueueReport['prototype'][_0x8c2e('0x40')]=function(_0x47731f,_0x10e582,_0x486304){io['to'](_0x47731f)[_0x8c2e('0x40')](_0x10e582,_0x486304);};VoiceQueueReport['prototype'][_0x8c2e('0x41')]=function(_0x3aefd4,_0x346da0){logger['debug']('[%s][voiceQueueReport]['+_0x346da0+_0x8c2e('0x42'),_0x3aefd4[_0x8c2e('0x43')],util['inspect'](_0x3aefd4,{'showHidden':![],'depth':null}));this[_0x8c2e('0x40')](util[_0x8c2e('0x44')]('voice:queue:%s',_0x3aefd4[_0x8c2e('0x45')]),'voice_queue_channel:save',_0x3aefd4);io[_0x8c2e('0x40')](_0x8c2e('0x46'),_0x3aefd4);};VoiceQueueReport[_0x8c2e('0x2e')][_0x8c2e('0x3e')]=function(_0xaf7c53,_0x491047){logger[_0x8c2e('0x47')](_0x8c2e('0x48')+_0x491047+_0x8c2e('0x49'),_0xaf7c53[_0x8c2e('0x43')],util['inspect'](_0xaf7c53,{'showHidden':![],'depth':null}));this['emit'](util[_0x8c2e('0x44')](_0x8c2e('0x4a'),_0xaf7c53[_0x8c2e('0x45')]),_0x8c2e('0x4b'),_0xaf7c53);io[_0x8c2e('0x40')](_0x8c2e('0x4c'),_0xaf7c53);};VoiceQueueReport[_0x8c2e('0x2e')][_0x8c2e('0x4d')]=function(_0x5318c1,_0x656e5c){if(_0x5318c1[_0x8c2e('0x4e')]===_0x8c2e('0x4f')){var _0x3f117d={'id':_0x5318c1['id'],'name':_0x5318c1[_0x8c2e('0x45')],'strategy':_0x5318c1[_0x8c2e('0x50')],'answered':_0x5318c1[_0x8c2e('0x51')],'available':_0x5318c1[_0x8c2e('0x52')],'loggedIn':_0x5318c1[_0x8c2e('0x53')],'pTalking':_0x5318c1[_0x8c2e('0x2a')],'sumBillable':_0x5318c1[_0x8c2e('0x54')],'sumDuration':_0x5318c1['sumDuration'],'sumHoldTime':_0x5318c1[_0x8c2e('0x55')]||0x0,'talking':_0x5318c1[_0x8c2e('0x29')],'total':_0x5318c1[_0x8c2e('0x56')],'type':_0x5318c1['type'],'unmanaged':_0x5318c1[_0x8c2e('0x57')],'abandoned':_0x5318c1[_0x8c2e('0x58')],'waiting':_0x5318c1[_0x8c2e('0x2b')]};if(_0x5318c1[_0x8c2e('0x59')]){_0x3f117d[_0x8c2e('0x59')]={'id':_0x5318c1[_0x8c2e('0x59')]['id'],'name':_0x5318c1[_0x8c2e('0x59')][_0x8c2e('0x45')],'active':_0x5318c1[_0x8c2e('0x59')][_0x8c2e('0x5a')],'callerid':_0x5318c1[_0x8c2e('0x59')][_0x8c2e('0x5b')]};}if(_0x5318c1['Interval']){_0x3f117d['Interval']={'id':_0x5318c1[_0x8c2e('0x5c')]['id'],'name':_0x5318c1[_0x8c2e('0x5c')]['name']};}var _0x5606b0=md5(JSON['stringify'](_0x3f117d));if(_0x5318c1['md5']!==_0x5606b0){_0x5318c1[_0x8c2e('0x5d')]=_0x5606b0;logger[_0x8c2e('0x47')](_0x8c2e('0x5e')+_0x656e5c+_0x8c2e('0x5f'),util[_0x8c2e('0x38')](_0x3f117d,{'showHidden':![],'depth':null}));this[_0x8c2e('0x40')](util[_0x8c2e('0x44')](_0x8c2e('0x4a'),_0x3f117d[_0x8c2e('0x45')]),_0x8c2e('0x60'),_0x3f117d);}}};VoiceQueueReport[_0x8c2e('0x2e')][_0x8c2e('0x61')]=function(_0x1a3067){return _0x1a3067!==null&&!_['isUndefined'](_0x1a3067);};VoiceQueueReport[_0x8c2e('0x2e')][_0x8c2e('0x62')]=function(){var _0x49c00=this;setInterval(function(){_0x49c00[_0x8c2e('0x2f')]();ami['Action']({'action':_0x8c2e('0x63')})[_0x8c2e('0x34')](function(_0x28a274){logger[_0x8c2e('0x36')](_0x8c2e('0x64'),util[_0x8c2e('0x38')](_0x28a274,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x8c2e('0x2e')][_0x8c2e('0x25')]=function(){var _0x472d50=this;setInterval(function(){if(_0x472d50[_0x8c2e('0x65')]){return ami['Action']({'action':_0x8c2e('0x11')})[_0x8c2e('0x66')](function(_0x314b51){_0x472d50[_0x8c2e('0x65')]=![];})['catch'](function(_0x145d61){logger['error'](_0x8c2e('0x67'),util['inspect'](_0x145d61,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x8c2e('0x2e')]['syncQueueSummary']=function(_0x47640b){try{if(this['isNotNull'](_0x47640b)&&this[_0x8c2e('0x61')](_0x47640b[_0x8c2e('0x68')])){logger['debug'](_0x8c2e('0x69'),util[_0x8c2e('0x38')](_0x47640b,{'showHidden':![],'depth':null}));if(this[_0x8c2e('0x3d')][_0x47640b['queue']]){logger[_0x8c2e('0x6a')](_0x8c2e('0x6b'),_0x47640b['queue']);var _0x45f16f=_['countBy'](this['channels'],_0x8c2e('0x68'))[_0x47640b[_0x8c2e('0x68')]]||0x0;var _0x1cd2c0=_0x45f16f-_0x47640b[_0x8c2e('0x6c')];if(this[_0x8c2e('0x3d')][_0x47640b[_0x8c2e('0x68')]][_0x8c2e('0x2b')]!==_[_0x8c2e('0x6d')](_0x47640b[_0x8c2e('0x6c')])||this[_0x8c2e('0x3d')][_0x47640b[_0x8c2e('0x68')]]['loggedIn']!==_['toNumber'](_0x47640b[_0x8c2e('0x6e')])||this[_0x8c2e('0x3d')][_0x47640b[_0x8c2e('0x68')]][_0x8c2e('0x52')]!==_['toNumber'](_0x47640b[_0x8c2e('0x52')])||this[_0x8c2e('0x3d')][_0x47640b[_0x8c2e('0x68')]][_0x8c2e('0x29')]!==_0x1cd2c0){this['voiceQueues'][_0x47640b[_0x8c2e('0x68')]][_0x8c2e('0x2b')]=_[_0x8c2e('0x6d')](_0x47640b[_0x8c2e('0x6c')]);this[_0x8c2e('0x3d')][_0x47640b[_0x8c2e('0x68')]][_0x8c2e('0x53')]=_[_0x8c2e('0x6d')](_0x47640b[_0x8c2e('0x6e')]);this[_0x8c2e('0x3d')][_0x47640b[_0x8c2e('0x68')]]['available']=_['toNumber'](_0x47640b[_0x8c2e('0x52')]);this[_0x8c2e('0x3d')][_0x47640b[_0x8c2e('0x68')]][_0x8c2e('0x29')]=_0x1cd2c0>0x0?_0x1cd2c0:0x0;this[_0x8c2e('0x3d')][_0x47640b[_0x8c2e('0x68')]][_0x8c2e('0x29')]=this[_0x8c2e('0x3d')][_0x47640b['queue']][_0x8c2e('0x29')]>_[_0x8c2e('0x6d')](_0x47640b[_0x8c2e('0x6e')])?_[_0x8c2e('0x6d')](_0x47640b[_0x8c2e('0x6e')]):this['voiceQueues'][_0x47640b[_0x8c2e('0x68')]][_0x8c2e('0x29')];this['emitVoiceQueueSummary'](this[_0x8c2e('0x3d')][_0x47640b[_0x8c2e('0x68')]],'queuesummary');}logger[_0x8c2e('0x47')](_0x8c2e('0x6f'),util[_0x8c2e('0x38')](this[_0x8c2e('0x3d')][_0x47640b[_0x8c2e('0x68')]],{'showHidden':![],'depth':null}));ami[_0x8c2e('0x40')]('custom:queuesummary',this[_0x8c2e('0x3d')][_0x47640b[_0x8c2e('0x68')]]);}}}catch(_0xcd3bb9){logger[_0x8c2e('0x36')](_0x8c2e('0x67'),util[_0x8c2e('0x38')](_0xcd3bb9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c2e('0x2e')][_0x8c2e('0x70')]=function(_0x5cf06a){logger[_0x8c2e('0x47')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0x5cf06a,{'showHidden':![],'depth':null}));this[_0x8c2e('0x65')]=!![];};VoiceQueueReport['prototype'][_0x8c2e('0x16')]=function(_0x14e138){try{if(this[_0x8c2e('0x61')](_0x14e138)){logger[_0x8c2e('0x47')](_0x8c2e('0x71'),_0x14e138['uniqueid'],util[_0x8c2e('0x38')](_0x14e138,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x8c2e('0xb')][_0x14e138[_0x8c2e('0x43')]]))this[_0x8c2e('0xb')][_0x14e138[_0x8c2e('0x43')]]=[];if(_[_0x8c2e('0x72')](this[_0x8c2e('0xd')][_0x14e138[_0x8c2e('0x43')]]))this[_0x8c2e('0xd')][_0x14e138[_0x8c2e('0x43')]]={};var _0x12e600=new QueueReport();_0x12e600[_0x8c2e('0x45')]=_0x14e138['queue'];_0x12e600['type']=this[_0x8c2e('0x3d')][_0x12e600[_0x8c2e('0x45')]]&&this['voiceQueues'][_0x12e600[_0x8c2e('0x45')]][_0x8c2e('0x4e')]?this[_0x8c2e('0x3d')][_0x12e600['name']][_0x8c2e('0x4e')]||'inbound':'inbound';_0x12e600['queue']=_0x14e138[_0x8c2e('0x68')];_0x12e600[_0x8c2e('0x73')]=moment()[_0x8c2e('0x44')](_0x8c2e('0x74'));_0x12e600['position']=_0x14e138[_0x8c2e('0x75')];_0x12e600['count']=_0x14e138[_0x8c2e('0x76')];_0x12e600[_0x8c2e('0x43')]=_0x14e138['uniqueid'];_0x12e600[_0x8c2e('0x77')]=this[_0x8c2e('0xd')][_0x14e138[_0x8c2e('0x43')]]['routealias'];logger[_0x8c2e('0x6a')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x12e600['name'],_0x12e600[_0x8c2e('0x4e')]);_[_0x8c2e('0x78')](_0x12e600,_['pick'](_0x14e138,_['keys'](_0x12e600)));this[_0x8c2e('0xb')][_0x14e138['uniqueid']][_0x8c2e('0x79')](_0x12e600);this[_0x8c2e('0xd')][_0x14e138['uniqueid']]=_0x12e600;this[_0x8c2e('0x41')](_0x12e600,_0x8c2e('0x15'));}}catch(_0x5109b2){logger['error'](_0x8c2e('0x71'),_0x14e138['uniqueid'],util[_0x8c2e('0x38')](_0x5109b2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c2e('0x2e')]['syncQueueCallerAbandon']=function(_0x25f6ca){try{if(this[_0x8c2e('0x61')](_0x25f6ca)){logger[_0x8c2e('0x47')](_0x8c2e('0x7a'),_0x25f6ca['uniqueid'],util[_0x8c2e('0x38')](_0x25f6ca,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x25f6ca[_0x8c2e('0x43')]]){var _0x3e141e=_[_0x8c2e('0x7b')](this[_0x8c2e('0xb')][_0x25f6ca[_0x8c2e('0x43')]]);_0x3e141e['queuecallercomplete']=![];_0x3e141e[_0x8c2e('0x7c')]=null;_0x3e141e[_0x8c2e('0x7d')]=_0x25f6ca[_0x8c2e('0x7d')];_0x3e141e[_0x8c2e('0x7e')]=_0x25f6ca[_0x8c2e('0x7e')];_0x3e141e[_0x8c2e('0x17')]=!![];_0x3e141e['queuecallerabandonAt']=moment()[_0x8c2e('0x44')](_0x8c2e('0x74'));_0x3e141e[_0x8c2e('0x7f')]='ABANDONED';_0x3e141e[_0x8c2e('0x80')]=null;logger['info'](_0x8c2e('0x81'),_0x3e141e[_0x8c2e('0x45')],_0x3e141e[_0x8c2e('0x4e')]);this[_0x8c2e('0xd')][_0x25f6ca[_0x8c2e('0x43')]]=_0x3e141e;this[_0x8c2e('0x3e')](_0x3e141e,'queuecallerabandon');}}}catch(_0x32ea95){logger[_0x8c2e('0x36')]('[%s][voiceQueueReport][queuecallerabandon]',_0x25f6ca[_0x8c2e('0x43')],util[_0x8c2e('0x38')](_0x32ea95,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8c2e('0x19')]=function(_0x556546){try{if(this['isNotNull'](_0x556546)){logger[_0x8c2e('0x47')](_0x8c2e('0x82'),_0x556546[_0x8c2e('0x43')],util['inspect'](_0x556546,{'showHidden':![],'depth':null}));if(this[_0x8c2e('0xb')][_0x556546['uniqueid']]){var _0x537dc8=_['last'](this[_0x8c2e('0xb')][_0x556546[_0x8c2e('0x43')]]);_0x537dc8[_0x8c2e('0x83')]=moment()['format'](_0x8c2e('0x74'));_0x537dc8[_0x8c2e('0x84')]=_0x556546[_0x8c2e('0x84')];_0x537dc8[_0x8c2e('0x85')]=_0x556546['connectedlinename'];logger[_0x8c2e('0x6a')](_0x8c2e('0x86'),_0x537dc8['name'],_0x537dc8[_0x8c2e('0x4e')],_0x556546[_0x8c2e('0x84')],_0x556546[_0x8c2e('0x85')]);this['channels'][_0x556546[_0x8c2e('0x43')]]=_0x537dc8;this[_0x8c2e('0x41')](_0x537dc8,_0x8c2e('0x87'));}}}catch(_0x46b85f){logger[_0x8c2e('0x36')](_0x8c2e('0x82'),_0x556546['uniqueid'],util[_0x8c2e('0x38')](_0x46b85f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c2e('0x2e')][_0x8c2e('0x1d')]=function(_0x530477){try{if(this['isNotNull'](_0x530477)){logger['debug'](_0x8c2e('0x88'),_0x530477[_0x8c2e('0x43')],util[_0x8c2e('0x38')](_0x530477,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x530477[_0x8c2e('0x43')]]){var _0x435f2e=_[_0x8c2e('0x7b')](this[_0x8c2e('0xb')][_0x530477['uniqueid']]);_0x435f2e[_0x8c2e('0x89')]=!![];_0x435f2e[_0x8c2e('0x7f')]='COMPLETEDBYAGENT';logger[_0x8c2e('0x6a')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x435f2e[_0x8c2e('0x45')],_0x435f2e['type']);}}}catch(_0x42e9a2){logger[_0x8c2e('0x36')](_0x8c2e('0x88'),_0x530477['uniqueid'],util[_0x8c2e('0x38')](_0x42e9a2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c2e('0x2e')][_0x8c2e('0x1b')]=function(_0xd56e62){try{if(this['isNotNull'](_0xd56e62)){logger[_0x8c2e('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0xd56e62['uniqueid'],util[_0x8c2e('0x38')](_0xd56e62,{'showHidden':![],'depth':null}));if(this[_0x8c2e('0xb')][_0xd56e62[_0x8c2e('0x43')]]){var _0x4a497b=_['last'](this[_0x8c2e('0xb')][_0xd56e62[_0x8c2e('0x43')]]);_0x4a497b[_0x8c2e('0x17')]=![];_0x4a497b[_0x8c2e('0x8a')]=null;_0x4a497b[_0x8c2e('0x8b')]=!![];_0x4a497b[_0x8c2e('0x80')]=_0xd56e62[_0x8c2e('0x8c')];_0x4a497b['holdtime']=_0xd56e62[_0x8c2e('0x7d')];_0x4a497b['queuecallercomplete']=!![];_0x4a497b[_0x8c2e('0x8d')]=![];_0x4a497b['queuecallerexitAt']=null;if(!_0x4a497b[_0x8c2e('0x8e')]){if(_0xd56e62[_0x8c2e('0x8f')]==_0x8c2e('0x8e')){_0x4a497b['queuecallerexitreason']='COMPLETED';logger[_0x8c2e('0x6a')](_0x8c2e('0x90'),_0x4a497b[_0x8c2e('0x45')],_0x4a497b[_0x8c2e('0x4e')]);}else{if(_['startsWith'](_0xd56e62[_0x8c2e('0x33')]['toLowerCase'](),'local/')){if(this[_0x8c2e('0xb')][_0xd56e62[_0x8c2e('0x91')]]){var _0x2c4c7b=_['last'](this[_0x8c2e('0xb')][_0xd56e62[_0x8c2e('0x91')]]);_0x2c4c7b[_0x8c2e('0x89')]=![];_0x2c4c7b[_0x8c2e('0x8d')]=!![];_0x2c4c7b[_0x8c2e('0x92')]=moment(_0x4a497b['queuecallerjoinAt'])['add'](_0xd56e62['holdtime'],_0x8c2e('0x93'))[_0x8c2e('0x44')](_0x8c2e('0x74'));_0x2c4c7b[_0x8c2e('0x7f')]='FORWARDTRANSFER';_0x2c4c7b[_0x8c2e('0x8e')]=!![];_0x2c4c7b[_0x8c2e('0x94')]=_0x8c2e('0x95');_0x2c4c7b['transferexten']=_0xd56e62[_0x8c2e('0x96')];_0x2c4c7b['transferuniqueid']=_0xd56e62[_0x8c2e('0x43')];logger['info'](_0x8c2e('0x97'),_0x2c4c7b[_0x8c2e('0x45')],_0x2c4c7b[_0x8c2e('0x4e')]);var _0x26a8be=this[_0x8c2e('0xb')][_0xd56e62['linkedid']];this[_0x8c2e('0xb')][_0xd56e62[_0x8c2e('0x91')]]=this[_0x8c2e('0xb')][_0xd56e62['uniqueid']];this[_0x8c2e('0xb')][_0xd56e62[_0x8c2e('0x43')]]=_0x26a8be;}}else{_0x4a497b[_0x8c2e('0x7f')]=_0x8c2e('0x98')+_0xd56e62[_0x8c2e('0x8f')][_0x8c2e('0x99')]();logger[_0x8c2e('0x6a')](_0x8c2e('0x9a'),_0x4a497b[_0x8c2e('0x45')],_0x4a497b[_0x8c2e('0x4e')],_0x4a497b[_0x8c2e('0x7f')]);}}}this['channels'][_0xd56e62[_0x8c2e('0x43')]]=_0x4a497b;this[_0x8c2e('0x3e')](_0x4a497b,'agentcomplete');}}}catch(_0x22624b){logger[_0x8c2e('0x36')]('[%s][voiceQueueReport][agentcomplete]',_0xd56e62[_0x8c2e('0x43')],util[_0x8c2e('0x38')](_0x22624b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c2e('0x2e')][_0x8c2e('0x9b')]=function(_0x241675){try{if(this[_0x8c2e('0x61')](_0x241675)){logger['debug'](_0x8c2e('0x9c'),_0x241675[_0x8c2e('0x43')],util[_0x8c2e('0x38')](_0x241675,{'showHidden':![],'depth':null}));this[_0x8c2e('0x9d')](_0x241675[_0x8c2e('0x43')],_[_0x8c2e('0x9e')](_0x241675['variable'])[0x0],_0x241675[_0x8c2e('0x9f')]);if(this[_0x8c2e('0xb')][_0x241675[_0x8c2e('0x43')]]){var _0x58f6fc=_[_0x8c2e('0x7b')](this[_0x8c2e('0xb')][_0x241675[_0x8c2e('0x43')]]);if(_0x58f6fc){if(this[_0x8c2e('0x61')](_0x241675[_0x8c2e('0xa0')])&&this[_0x8c2e('0x61')](_0x241675[_0x8c2e('0xa0')][_0x8c2e('0xa1')])){switch(_0x241675[_0x8c2e('0x9f')]){case _0x8c2e('0xa2'):_0x58f6fc[_0x8c2e('0x8d')]=![];_0x58f6fc[_0x8c2e('0x92')]=null;break;case'TIMEOUT':_0x58f6fc['lastevent']=_0x8c2e('0xa3');_0x58f6fc[_0x8c2e('0x8d')]=!![];_0x58f6fc[_0x8c2e('0x92')]=moment()[_0x8c2e('0x44')](_0x8c2e('0x74'));_0x58f6fc[_0x8c2e('0x83')]=moment()[_0x8c2e('0x44')](_0x8c2e('0x74'));logger[_0x8c2e('0x47')](_0x8c2e('0xa4'),_0x241675[_0x8c2e('0x43')],util[_0x8c2e('0x38')](_0x58f6fc,{'showHidden':![],'depth':null}));ami['emit'](_0x8c2e('0xa5'),_0x58f6fc);break;default:_0x58f6fc['queuecallerexit']=!![];_0x58f6fc['queuecallerexitAt']=moment()[_0x8c2e('0x44')]('YYYY-MM-DD\x20HH:mm:ss');_0x58f6fc['queuecallerleaveAt']=moment()[_0x8c2e('0x44')]('YYYY-MM-DD\x20HH:mm:ss');}_0x58f6fc[_0x8c2e('0x17')]=![];_0x58f6fc[_0x8c2e('0x8a')]=null;_0x58f6fc[_0x8c2e('0x7f')]=_0x241675[_0x8c2e('0x9f')];this[_0x8c2e('0xd')][_0x241675[_0x8c2e('0x43')]]=_0x58f6fc;this[_0x8c2e('0x3e')](_0x58f6fc,_0x8c2e('0xa6'));}else if(this['isNotNull'](_0x241675[_0x8c2e('0xa0')])&&this['isNotNull'](_0x241675[_0x8c2e('0xa0')]['queueposition'])){if(!_0x58f6fc[_0x8c2e('0x17')]){_0x58f6fc[_0x8c2e('0x8d')]=!![];_0x58f6fc[_0x8c2e('0x92')]=moment()[_0x8c2e('0x44')](_0x8c2e('0x74'));_0x58f6fc[_0x8c2e('0x7f')]=_0x8c2e('0xa7');_0x58f6fc['queuecallerleaveAt']=moment()['format'](_0x8c2e('0x74'));this[_0x8c2e('0xd')][_0x241675[_0x8c2e('0x43')]]=_0x58f6fc;}}logger[_0x8c2e('0x6a')](_0x8c2e('0xa8'),_0x241675[_0x8c2e('0x43')],_0x58f6fc[_0x8c2e('0x45')],_0x58f6fc[_0x8c2e('0x4e')],_[_0x8c2e('0x9e')](_0x241675[_0x8c2e('0xa0')])[0x0],_0x241675['value']);_0x58f6fc[_0x8c2e('0x10')]=this[_0x8c2e('0x10')][_0x241675[_0x8c2e('0x43')]];}}}}catch(_0x11c237){logger[_0x8c2e('0x36')]('[%s][voiceQueueReport][varset]',_0x241675['uniqueid'],util['inspect'](_0x11c237,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8c2e('0x2e')][_0x8c2e('0x9d')]=function(_0x101cc2,_0x8bc83d,_0x4686a1){var _0x1b6fc6=[_0x8c2e('0xa9'),'rtpaudioqosbridged',_0x8c2e('0xaa'),'rtpaudioqosjitterbridged',_0x8c2e('0xab'),_0x8c2e('0xac'),_0x8c2e('0xad'),_0x8c2e('0xae'),_0x8c2e('0xaf'),_0x8c2e('0xb0'),_0x8c2e('0xb1'),_0x8c2e('0xb2'),_0x8c2e('0xb3'),_0x8c2e('0xb4'),_0x8c2e('0xb5'),_0x8c2e('0xb6'),_0x8c2e('0x8c'),_0x8c2e('0xb7'),_0x8c2e('0xb8')];if(!_[_0x8c2e('0xb9')](_0x8bc83d)&&!_[_0x8c2e('0xba')](_0x1b6fc6,_0x8bc83d)){if(_[_0x8c2e('0x72')](this[_0x8c2e('0x10')][_0x101cc2])){this[_0x8c2e('0x10')][_0x101cc2]={};}this[_0x8c2e('0x10')][_0x101cc2][_0x8bc83d]=_0x4686a1;}};VoiceQueueReport[_0x8c2e('0x2e')][_0x8c2e('0x1e')]=function(_0x22edac){try{if(this[_0x8c2e('0x61')](_0x22edac)){logger[_0x8c2e('0x47')](_0x8c2e('0xbb'),_0x22edac[_0x8c2e('0x43')],util[_0x8c2e('0x38')](_0x22edac,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x22edac[_0x8c2e('0x43')]]){for(var _0x50a018=0x0,_0x2508e4={};_0x50a0180x0?_0x4a36be:0x0;this['voiceQueues'][_0x21ee2b[_0xcfba('0x6b')]][_0xcfba('0x31')]=this[_0xcfba('0x11')][_0x21ee2b[_0xcfba('0x6b')]]['talking']>_[_0xcfba('0x70')](_0x21ee2b['loggedin'])?_[_0xcfba('0x70')](_0x21ee2b['loggedin']):this[_0xcfba('0x11')][_0x21ee2b[_0xcfba('0x6b')]]['talking'];this['emitVoiceQueueSummary'](this[_0xcfba('0x11')][_0x21ee2b[_0xcfba('0x6b')]],'queuesummary');}logger[_0xcfba('0x4a')](_0xcfba('0x72'),util[_0xcfba('0x3c')](this[_0xcfba('0x11')][_0x21ee2b[_0xcfba('0x6b')]],{'showHidden':![],'depth':null}));ami['emit'](_0xcfba('0x73'),this[_0xcfba('0x11')][_0x21ee2b['queue']]);}}}catch(_0x4c08a1){logger[_0xcfba('0x3a')](_0xcfba('0x6a'),util[_0xcfba('0x3c')](_0x4c08a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcfba('0x35')]['syncQueueSummaryComplete']=function(_0x553ec5){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xcfba('0x3c')](_0x553ec5,{'showHidden':![],'depth':null}));this[_0xcfba('0x69')]=!![];};VoiceQueueReport[_0xcfba('0x35')][_0xcfba('0x19')]=function(_0x407012){try{if(this[_0xcfba('0x60')](_0x407012)){logger[_0xcfba('0x4a')](_0xcfba('0x74'),_0x407012['uniqueid'],util[_0xcfba('0x3c')](_0x407012,{'showHidden':![],'depth':null}));if(_[_0xcfba('0x75')](this[_0xcfba('0xd')][_0x407012[_0xcfba('0x46')]]))this[_0xcfba('0xd')][_0x407012[_0xcfba('0x46')]]=[];if(_[_0xcfba('0x75')](this[_0xcfba('0xf')][_0x407012[_0xcfba('0x46')]]))this[_0xcfba('0xf')][_0x407012['uniqueid']]={};var _0x483fb7=new QueueReport();_0x483fb7[_0xcfba('0x49')]=_0x407012[_0xcfba('0x6b')];_0x483fb7[_0xcfba('0x4f')]=this[_0xcfba('0x11')][_0x483fb7[_0xcfba('0x49')]]&&this[_0xcfba('0x11')][_0x483fb7[_0xcfba('0x49')]][_0xcfba('0x4f')]?this[_0xcfba('0x11')][_0x483fb7[_0xcfba('0x49')]][_0xcfba('0x4f')]||_0xcfba('0x50'):_0xcfba('0x50');_0x483fb7['queue']=_0x407012[_0xcfba('0x6b')];_0x483fb7[_0xcfba('0x76')]=moment()[_0xcfba('0x47')](_0xcfba('0x77'));_0x483fb7['position']=_0x407012[_0xcfba('0x78')];_0x483fb7[_0xcfba('0x79')]=_0x407012[_0xcfba('0x79')];_0x483fb7[_0xcfba('0x46')]=_0x407012[_0xcfba('0x46')];_0x483fb7['routealias']=this[_0xcfba('0xf')][_0x407012[_0xcfba('0x46')]][_0xcfba('0x7a')];logger[_0xcfba('0x6d')](_0xcfba('0x7b'),_0x483fb7[_0xcfba('0x49')],_0x483fb7[_0xcfba('0x4f')]);_[_0xcfba('0x7c')](_0x483fb7,_[_0xcfba('0x7d')](_0x407012,_[_0xcfba('0x7e')](_0x483fb7)));this[_0xcfba('0xd')][_0x407012['uniqueid']][_0xcfba('0x7f')](_0x483fb7);this['channels'][_0x407012['uniqueid']]=_0x483fb7;this[_0xcfba('0x44')](_0x483fb7,_0xcfba('0x18'));}}catch(_0x22d8c7){logger[_0xcfba('0x3a')]('[%s][voiceQueueReport][queuecallerjoin]',_0x407012[_0xcfba('0x46')],util[_0xcfba('0x3c')](_0x22d8c7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcfba('0x35')][_0xcfba('0x1b')]=function(_0x29507d){try{if(this[_0xcfba('0x60')](_0x29507d)){logger[_0xcfba('0x4a')](_0xcfba('0x80'),_0x29507d[_0xcfba('0x46')],util[_0xcfba('0x3c')](_0x29507d,{'showHidden':![],'depth':null}));if(this[_0xcfba('0xd')][_0x29507d[_0xcfba('0x46')]]){var _0x321809=_[_0xcfba('0x81')](this['queueReports'][_0x29507d[_0xcfba('0x46')]]);_0x321809[_0xcfba('0x82')]=![];_0x321809[_0xcfba('0x83')]=null;_0x321809[_0xcfba('0x84')]=_0x29507d[_0xcfba('0x84')];_0x321809[_0xcfba('0x85')]=_0x29507d['originalposition'];_0x321809['queuecallerabandon']=!![];_0x321809[_0xcfba('0x86')]=moment()[_0xcfba('0x47')](_0xcfba('0x77'));_0x321809[_0xcfba('0x87')]=_0xcfba('0x88');_0x321809['lastAssignedTo']=null;logger['info'](_0xcfba('0x89'),_0x321809[_0xcfba('0x49')],_0x321809[_0xcfba('0x4f')]);this['channels'][_0x29507d[_0xcfba('0x46')]]=_0x321809;this['emitVoiceQueueChannelRemove'](_0x321809,_0xcfba('0x1a'));}}}catch(_0x493e63){logger[_0xcfba('0x3a')](_0xcfba('0x80'),_0x29507d[_0xcfba('0x46')],util[_0xcfba('0x3c')](_0x493e63,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xcfba('0x1d')]=function(_0xe3af){try{if(this[_0xcfba('0x60')](_0xe3af)){logger[_0xcfba('0x4a')](_0xcfba('0x8a'),_0xe3af[_0xcfba('0x46')],util[_0xcfba('0x3c')](_0xe3af,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xe3af[_0xcfba('0x46')]]){var _0x4f5f67=_[_0xcfba('0x81')](this[_0xcfba('0xd')][_0xe3af[_0xcfba('0x46')]]);_0x4f5f67[_0xcfba('0x8b')]=moment()[_0xcfba('0x47')](_0xcfba('0x77'));_0x4f5f67[_0xcfba('0x8c')]=_0xe3af['connectedlinenum'];_0x4f5f67[_0xcfba('0x8d')]=_0xe3af['connectedlinename'];logger[_0xcfba('0x6d')](_0xcfba('0x8e'),_0x4f5f67[_0xcfba('0x49')],_0x4f5f67[_0xcfba('0x4f')],_0xe3af[_0xcfba('0x8c')],_0xe3af[_0xcfba('0x8d')]);this[_0xcfba('0xf')][_0xe3af[_0xcfba('0x46')]]=_0x4f5f67;this[_0xcfba('0x44')](_0x4f5f67,_0xcfba('0x1c'));}}}catch(_0x1d7df9){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0xe3af[_0xcfba('0x46')],util[_0xcfba('0x3c')](_0x1d7df9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcfba('0x35')][_0xcfba('0x21')]=function(_0x578027){try{if(this[_0xcfba('0x60')](_0x578027)){logger[_0xcfba('0x4a')]('[%s][voiceQueueReport][agentconnect]',_0x578027[_0xcfba('0x46')],util['inspect'](_0x578027,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x578027[_0xcfba('0x46')]]){var _0x59b793=_[_0xcfba('0x81')](this['queueReports'][_0x578027[_0xcfba('0x46')]]);_0x59b793['queuecallercomplete']=!![];_0x59b793[_0xcfba('0x87')]=_0xcfba('0x8f');logger[_0xcfba('0x6d')](_0xcfba('0x90'),_0x59b793[_0xcfba('0x49')],_0x59b793[_0xcfba('0x4f')]);}}}catch(_0x59169d){logger[_0xcfba('0x3a')](_0xcfba('0x91'),_0x578027[_0xcfba('0x46')],util[_0xcfba('0x3c')](_0x59169d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcfba('0x35')][_0xcfba('0x1f')]=function(_0x18c1d8){try{if(this[_0xcfba('0x60')](_0x18c1d8)){logger[_0xcfba('0x4a')](_0xcfba('0x92'),_0x18c1d8[_0xcfba('0x46')],util[_0xcfba('0x3c')](_0x18c1d8,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x18c1d8[_0xcfba('0x46')]]){var _0x88f6ab=_[_0xcfba('0x81')](this[_0xcfba('0xd')][_0x18c1d8[_0xcfba('0x46')]]);_0x88f6ab['queuecallerabandon']=![];_0x88f6ab[_0xcfba('0x86')]=null;_0x88f6ab[_0xcfba('0x93')]=!![];_0x88f6ab[_0xcfba('0x94')]=_0x18c1d8[_0xcfba('0x95')];_0x88f6ab[_0xcfba('0x84')]=_0x18c1d8['holdtime'];_0x88f6ab[_0xcfba('0x82')]=!![];_0x88f6ab[_0xcfba('0x96')]=![];_0x88f6ab['queuecallerexitAt']=null;if(!_0x88f6ab[_0xcfba('0x97')]){if(_0x18c1d8[_0xcfba('0x98')]=='transfer'){_0x88f6ab[_0xcfba('0x87')]='COMPLETED';logger[_0xcfba('0x6d')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x88f6ab[_0xcfba('0x49')],_0x88f6ab[_0xcfba('0x4f')]);}else{if(_[_0xcfba('0x99')](_0x18c1d8[_0xcfba('0x38')][_0xcfba('0x9a')](),_0xcfba('0x9b'))){if(this[_0xcfba('0xd')][_0x18c1d8['linkedid']]){var _0xa7ade7=_[_0xcfba('0x81')](this[_0xcfba('0xd')][_0x18c1d8[_0xcfba('0x9c')]]);_0xa7ade7[_0xcfba('0x82')]=![];_0xa7ade7[_0xcfba('0x96')]=!![];_0xa7ade7[_0xcfba('0x9d')]=moment(_0x88f6ab['queuecallerjoinAt'])['add'](_0x18c1d8[_0xcfba('0x84')],'seconds')[_0xcfba('0x47')](_0xcfba('0x77'));_0xa7ade7[_0xcfba('0x87')]='FORWARDTRANSFER';_0xa7ade7[_0xcfba('0x97')]=!![];_0xa7ade7[_0xcfba('0x9e')]=_0xcfba('0x9f');_0xa7ade7['transferexten']=_0x18c1d8[_0xcfba('0xa0')];_0xa7ade7[_0xcfba('0xa1')]=_0x18c1d8[_0xcfba('0x46')];logger['info'](_0xcfba('0xa2'),_0xa7ade7[_0xcfba('0x49')],_0xa7ade7[_0xcfba('0x4f')]);var _0x194218=this[_0xcfba('0xd')][_0x18c1d8[_0xcfba('0x9c')]];this[_0xcfba('0xd')][_0x18c1d8['linkedid']]=this['queueReports'][_0x18c1d8[_0xcfba('0x46')]];this[_0xcfba('0xd')][_0x18c1d8[_0xcfba('0x46')]]=_0x194218;}}else{_0x88f6ab[_0xcfba('0x87')]=_0xcfba('0xa3')+_0x18c1d8[_0xcfba('0x98')][_0xcfba('0xa4')]();logger[_0xcfba('0x6d')](_0xcfba('0xa5'),_0x88f6ab['name'],_0x88f6ab[_0xcfba('0x4f')],_0x88f6ab[_0xcfba('0x87')]);}}}this[_0xcfba('0xf')][_0x18c1d8[_0xcfba('0x46')]]=_0x88f6ab;this['emitVoiceQueueChannelRemove'](_0x88f6ab,_0xcfba('0x1e'));}}}catch(_0x189642){logger[_0xcfba('0x3a')]('[%s][voiceQueueReport][agentcomplete]',_0x18c1d8[_0xcfba('0x46')],util['inspect'](_0x189642,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xcfba('0xa6')]=function(_0x355c05){try{if(this[_0xcfba('0x60')](_0x355c05)){logger['debug'](_0xcfba('0xa7'),_0x355c05['uniqueid'],util['inspect'](_0x355c05,{'showHidden':![],'depth':null}));this[_0xcfba('0xa8')](_0x355c05[_0xcfba('0x46')],_['keys'](_0x355c05[_0xcfba('0xa9')])[0x0],_0x355c05[_0xcfba('0xaa')]);if(this[_0xcfba('0xd')][_0x355c05['uniqueid']]){var _0x1d1183=_[_0xcfba('0x81')](this['queueReports'][_0x355c05[_0xcfba('0x46')]]);if(_0x1d1183){if(this[_0xcfba('0x60')](_0x355c05[_0xcfba('0xa9')])&&this['isNotNull'](_0x355c05[_0xcfba('0xa9')][_0xcfba('0xab')])){switch(_0x355c05[_0xcfba('0xaa')]){case'CONTINUE':_0x1d1183[_0xcfba('0x96')]=![];_0x1d1183[_0xcfba('0x9d')]=null;break;case'TIMEOUT':_0x1d1183['lastevent']=_0xcfba('0xac');_0x1d1183['queuecallerexit']=!![];_0x1d1183[_0xcfba('0x9d')]=moment()[_0xcfba('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d1183[_0xcfba('0x8b')]=moment()[_0xcfba('0x47')](_0xcfba('0x77'));logger['debug'](_0xcfba('0xad'),_0x355c05[_0xcfba('0x46')],util[_0xcfba('0x3c')](_0x1d1183,{'showHidden':![],'depth':null}));ami[_0xcfba('0x43')](_0xcfba('0xae'),_0x1d1183);break;default:_0x1d1183[_0xcfba('0x96')]=!![];_0x1d1183['queuecallerexitAt']=moment()[_0xcfba('0x47')](_0xcfba('0x77'));_0x1d1183[_0xcfba('0x8b')]=moment()[_0xcfba('0x47')](_0xcfba('0x77'));}_0x1d1183['queuecallerabandon']=![];_0x1d1183[_0xcfba('0x86')]=null;_0x1d1183[_0xcfba('0x87')]=_0x355c05[_0xcfba('0xaa')];this[_0xcfba('0xf')][_0x355c05[_0xcfba('0x46')]]=_0x1d1183;this[_0xcfba('0x41')](_0x1d1183,_0xcfba('0x22'));}else if(this[_0xcfba('0x60')](_0x355c05[_0xcfba('0xa9')])&&this[_0xcfba('0x60')](_0x355c05[_0xcfba('0xa9')][_0xcfba('0xaf')])){if(!_0x1d1183[_0xcfba('0x1a')]){_0x1d1183[_0xcfba('0x96')]=!![];_0x1d1183[_0xcfba('0x9d')]=moment()[_0xcfba('0x47')](_0xcfba('0x77'));_0x1d1183[_0xcfba('0x87')]=_0xcfba('0xb0');_0x1d1183['queuecallerleaveAt']=moment()['format'](_0xcfba('0x77'));this[_0xcfba('0xf')][_0x355c05[_0xcfba('0x46')]]=_0x1d1183;}}logger[_0xcfba('0x6d')](_0xcfba('0xb1'),_0x355c05[_0xcfba('0x46')],_0x1d1183[_0xcfba('0x49')],_0x1d1183['type'],_['keys'](_0x355c05[_0xcfba('0xa9')])[0x0],_0x355c05['value']);_0x1d1183[_0xcfba('0x13')]=this['variables'][_0x355c05['uniqueid']];}}}}catch(_0x23506f){logger['error']('[%s][voiceQueueReport][varset]',_0x355c05[_0xcfba('0x46')],util['inspect'](_0x23506f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xcfba('0x35')][_0xcfba('0xa8')]=function(_0x4714e3,_0x5dd875,_0x571ed8){var _0x5e8908=[_0xcfba('0xb2'),_0xcfba('0xb3'),'rtpaudioqosjitter',_0xcfba('0xb4'),_0xcfba('0xb5'),_0xcfba('0xb6'),_0xcfba('0xb7'),_0xcfba('0xb8'),_0xcfba('0xb9'),'sipuri',_0xcfba('0xba'),_0xcfba('0xbb'),_0xcfba('0xbc'),'memberdynamic',_0xcfba('0xbd'),_0xcfba('0xbe'),_0xcfba('0x95'),'memberpenalty',_0xcfba('0xbf')];if(!_[_0xcfba('0x37')](_0x5dd875)&&!_[_0xcfba('0xc0')](_0x5e8908,_0x5dd875)){if(_[_0xcfba('0x75')](this['variables'][_0x4714e3])){this[_0xcfba('0x13')][_0x4714e3]={};}this[_0xcfba('0x13')][_0x4714e3][_0x5dd875]=_0x571ed8;}};VoiceQueueReport[_0xcfba('0x35')]['syncHangup']=function(_0x2abe10){try{if(this['isNotNull'](_0x2abe10)){logger[_0xcfba('0x4a')](_0xcfba('0xc1'),_0x2abe10[_0xcfba('0x46')],util['inspect'](_0x2abe10,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x2abe10[_0xcfba('0x46')]]){for(var _0x3548ee=0x0,_0x4e5b8f={};_0x3548ee=0x0?moment(_0xc73178[_0x5094('0x19')])['diff'](_0xc73178[_0x5094('0x1a')],_0x5094('0xf')):null,'data1':_0x5094('0x1b'),'data2':_0xc73178[_0x5094('0x13')],'data3':_0xc73178[_0x5094('0x1c')],'data4':_0xc73178[_0x5094('0x1d')]||null,'role':'agent','internal':_0xc73178[_0x5094('0x13')]?_[_0x5094('0x14')](_0xc73178[_0x5094('0x13')]):undefined,'uniqueid':_0xc73178[_0x5094('0x15')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x52d1=['util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','isNil','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','exten','agent','accountcode','voiceDialReport','membername','interface','starttime','endtime','outbound','uniqueid','moment'];(function(_0x1bd730,_0x460bb7){var _0x260ac0=function(_0x4a414e){while(--_0x4a414e){_0x1bd730['push'](_0x1bd730['shift']());}};_0x260ac0(++_0x460bb7);}(_0x52d1,0x9b));var _0x152d=function(_0x327e91,_0x15cf65){_0x327e91=_0x327e91-0x0;var _0x361cc4=_0x52d1[_0x327e91];return _0x361cc4;};'use strict';var moment=require(_0x152d('0x0'));var _=require('lodash');var util=require(_0x152d('0x1'));var client=require(_0x152d('0x2'));exports[_0x152d('0x3')]=function(_0x355587){var _0x5e994f=_0x355587[_0x152d('0x4')]||_0x355587['queuecallerexitAt'];return client[_0x152d('0x5')](_0x152d('0x6'),{'body':{'channel':_0x152d('0x7'),'membername':_0x355587['lastAssignedTo'],'interface':_[_0x152d('0x8')](_0x355587['interface'])?util['format'](_0x152d('0x9'),_0x355587[_0x152d('0xa')]):_0x355587['interface'],'type':_0x152d('0xb'),'enterAt':_0x355587[_0x152d('0xc')],'exitAt':_0x5e994f,'duration':moment(_0x5e994f)[_0x152d('0xd')](_0x355587['queuecallerleaveAt'],_0x152d('0xe')),'data1':_0x152d('0xf'),'data2':_0x355587['calleridnum'],'data3':_0x355587[_0x152d('0x10')],'data4':null,'data5':_0x355587['queue'],'role':_0x152d('0x11'),'internal':_0x355587[_0x152d('0x12')]?_['toNumber'](_0x355587[_0x152d('0x12')]):undefined,'uniqueid':_0x355587['uniqueid']},'log':_0x152d('0x6')});};exports[_0x152d('0x13')]=function(_0x3bffa9){return client[_0x152d('0x5')](_0x152d('0x6'),{'body':{'channel':_0x152d('0x7'),'membername':_0x3bffa9[_0x152d('0x14')],'interface':_0x3bffa9[_0x152d('0x15')],'type':_0x152d('0xb'),'enterAt':_0x3bffa9[_0x152d('0x16')],'exitAt':_0x3bffa9[_0x152d('0x17')],'duration':moment(_0x3bffa9[_0x152d('0x17')])['diff'](_0x3bffa9[_0x152d('0x16')],_0x152d('0xe'))>=0x0?moment(_0x3bffa9['endtime'])[_0x152d('0xd')](_0x3bffa9[_0x152d('0x16')],_0x152d('0xe')):null,'data1':_0x152d('0x18'),'data2':_0x3bffa9[_0x152d('0x12')],'data3':_0x3bffa9[_0x152d('0x10')],'data4':_0x3bffa9['dialstring']||null,'role':_0x152d('0x11'),'internal':_0x3bffa9[_0x152d('0x12')]?_['toNumber'](_0x3bffa9[_0x152d('0x12')]):undefined,'uniqueid':_0x3bffa9[_0x152d('0x19')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index d8791e2..7ef0756 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 _0x1ddc=['ShowSetting','GetSettings','getSettings','Request'];(function(_0x18f38b,_0x3c7704){var _0x41e1f2=function(_0x9f4edd){while(--_0x9f4edd){_0x18f38b['push'](_0x18f38b['shift']());}};_0x41e1f2(++_0x3c7704);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x2438e8,_0x5ea301){_0x2438e8=_0x2438e8-0x0;var _0x28a92a=_0x1ddc[_0x2438e8];return _0x28a92a;};'use strict';var client=require('../client');exports[_0xc1dd('0x0')]=function(){return client[_0xc1dd('0x1')](_0xc1dd('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0xc1dd('0x3')});}; \ No newline at end of file +var _0xdfe0=['stopRecordingOnTransfer','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x397d26,_0x4c54a9){var _0x386ed2=function(_0x1c3c0f){while(--_0x1c3c0f){_0x397d26['push'](_0x397d26['shift']());}};_0x386ed2(++_0x4c54a9);}(_0xdfe0,0xce));var _0x0dfe=function(_0x5946c3,_0x27a08d){_0x5946c3=_0x5946c3-0x0;var _0x403f3f=_0xdfe0[_0x5946c3];return _0x403f3f;};'use strict';var client=require(_0x0dfe('0x0'));exports[_0x0dfe('0x1')]=function(){return client[_0x0dfe('0x2')](_0x0dfe('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0dfe('0x4')]},'log':_0x0dfe('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 62febd2..95b16ff 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 _0xdc22=['GetTemplate','name','html','../client','getTemplates','Request'];(function(_0xad9fdb,_0x48d125){var _0xd20f0a=function(_0x3cb2fd){while(--_0x3cb2fd){_0xad9fdb['push'](_0xad9fdb['shift']());}};_0xd20f0a(++_0x48d125);}(_0xdc22,0xed));var _0x2dc2=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0xdc22[_0x2e58c7];return _0x26eb00;};'use strict';var client=require(_0x2dc2('0x0'));exports[_0x2dc2('0x1')]=function(_0x3511df){return function(_0x4e2e40){return client[_0x2dc2('0x2')](_0x2dc2('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2dc2('0x4'),_0x2dc2('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0xc758=['getTemplates','Request','name','html','GetTemplate','../client'];(function(_0x3be82b,_0x3ef4fb){var _0x293c0e=function(_0x6af388){while(--_0x6af388){_0x3be82b['push'](_0x3be82b['shift']());}};_0x293c0e(++_0x3ef4fb);}(_0xc758,0xb9));var _0x8c75=function(_0x248fbb,_0x532e8c){_0x248fbb=_0x248fbb-0x0;var _0x431c96=_0xc758[_0x248fbb];return _0x431c96;};'use strict';var client=require(_0x8c75('0x0'));exports[_0x8c75('0x1')]=function(_0x5b766c){return function(_0x2e3b0e){return client[_0x8c75('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x8c75('0x3'),_0x8c75('0x4')]},'log':_0x8c75('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index a80b817..a4fd156 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 _0x688d=['AnyConditions','Action','Actions','action','data1','data2','data3','data5','data6','data7','GetTrigger','../client','getTriggers','status','AllConditions','field','operator','value'];(function(_0x558f1e,_0x12445f){var _0x494dfa=function(_0x385a9e){while(--_0x385a9e){_0x558f1e['push'](_0x558f1e['shift']());}};_0x494dfa(++_0x12445f);}(_0x688d,0x13d));var _0xd688=function(_0x428fea,_0x5f53b9){_0x428fea=_0x428fea-0x0;var _0x356b9b=_0x688d[_0x428fea];return _0x356b9b;};'use strict';var client=require(_0xd688('0x0'));exports[_0xd688('0x1')]=function(_0xb6f3bc){return function(_0x10c111){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id','name','channel',_0xd688('0x2')],'include':[{'model':'Condition','as':_0xd688('0x3'),'attributes':['id',_0xd688('0x4'),_0xd688('0x5'),_0xd688('0x6')]},{'model':'Condition','as':_0xd688('0x7'),'attributes':['id',_0xd688('0x4'),'operator',_0xd688('0x6')]},{'model':_0xd688('0x8'),'as':_0xd688('0x9'),'attributes':['id',_0xd688('0xa'),_0xd688('0xb'),_0xd688('0xc'),_0xd688('0xd'),'data4',_0xd688('0xe'),_0xd688('0xf'),_0xd688('0x10')]}]},'log':_0xd688('0x11')});};}; \ No newline at end of file +var _0x5044=['AllConditions','field','operator','value','AnyConditions','Actions','action','data2','data6','data7','getTriggers','Request','GetTrigger','name','channel','Condition'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x5044,0xaa));var _0x4504=function(_0x17a178,_0x20f58e){_0x17a178=_0x17a178-0x0;var _0x5503d1=_0x5044[_0x17a178];return _0x5503d1;};'use strict';var client=require('../client');exports[_0x4504('0x0')]=function(_0x46e279){return function(_0x2f01a1){return client[_0x4504('0x1')](_0x4504('0x2'),{'options':{'raw':![],'attributes':['id',_0x4504('0x3'),_0x4504('0x4'),'status'],'include':[{'model':_0x4504('0x5'),'as':_0x4504('0x6'),'attributes':['id',_0x4504('0x7'),_0x4504('0x8'),_0x4504('0x9')]},{'model':'Condition','as':_0x4504('0xa'),'attributes':['id',_0x4504('0x7'),_0x4504('0x8'),'value']},{'model':'Action','as':_0x4504('0xb'),'attributes':['id',_0x4504('0xc'),'data1',_0x4504('0xd'),'data3','data4','data5',_0x4504('0xe'),_0x4504('0xf')]}]},'log':_0x4504('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index a449ae6..070f23c 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 _0x0b13=['../client','getTrunks','Request','GetTrunk','name','registry','defaultuser'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x0b13,0x150));var _0x30b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0b13[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x30b1('0x0'));exports[_0x30b1('0x1')]=function(_0x34ec06){return function(_0x22f4df){return client[_0x30b1('0x2')](_0x30b1('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x30b1('0x4'),_0x30b1('0x5'),_0x30b1('0x6')]},'log':_0x30b1('0x3')});};}; \ No newline at end of file +var _0x1b4e=['GetTrunk','name','registry','defaultuser','Request'];(function(_0x1adaeb,_0x27ebcd){var _0x3c444b=function(_0x3d8d3f){while(--_0x3d8d3f){_0x1adaeb['push'](_0x1adaeb['shift']());}};_0x3c444b(++_0x27ebcd);}(_0x1b4e,0x158));var _0xe1b4=function(_0x1ff29d,_0x1e58fc){_0x1ff29d=_0x1ff29d-0x0;var _0x38cb30=_0x1b4e[_0x1ff29d];return _0x38cb30;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x840f39){return function(_0x4b0e67){return client[_0xe1b4('0x0')](_0xe1b4('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe1b4('0x2'),_0xe1b4('0x3'),_0xe1b4('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 2a6c3c4..2927aa7 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x58e073,_0x166c0c){var _0x5bdb22=function(_0x221644){while(--_0x221644){_0x58e073['push'](_0x58e073['shift']());}};_0x5bdb22(++_0x166c0c);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file +var _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4536a4,_0x55af7b){_0x4536a4=_0x4536a4-0x0;var _0x4fd1c1=_0xcb91[_0x4536a4];return _0x4fd1c1;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x1cb9('0x0')](_0x1cb9('0x1'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2')},'attributes':['id',_0x1cb9('0x3'),'email',_0x1cb9('0x4'),_0x1cb9('0x5'),'online',_0x1cb9('0x6'),_0x1cb9('0x7'),'lastPauseAt',_0x1cb9('0x8'),_0x1cb9('0x9'),'mobile',_0x1cb9('0xa')]},'log':_0x1cb9('0xb')});};};exports['getTelephones']=function(){return function(){return client[_0x1cb9('0x0')]('GetUser',{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x4'),_0x1cb9('0xc')]},'log':_0x1cb9('0xd')});};};exports[_0x1cb9('0xe')]=function(_0x50ce71,_0x9b58f1,_0x44a6b4){return client[_0x1cb9('0x0')](_0x1cb9('0xf'),{'body':{'type':_0x9b58f1,'uniqueid':_0x44a6b4},'options':{'where':{'id':_0x50ce71['id']}},'log':_0x1cb9('0xe')});};exports['saveUnpause']=function(_0x5e3c19){return client['Request'](_0x1cb9('0x10'),{'body':{},'options':{'where':{'id':_0x5e3c19['id']}},'log':_0x1cb9('0xe')});};exports[_0x1cb9('0x11')]=function(_0x1c714f){return client['Request'](_0x1cb9('0x12'),{'options':{'raw':![],'where':{'role':_0x1cb9('0x2'),'id':_0x1c714f},'attributes':['id',_0x1cb9('0x3'),_0x1cb9('0x13'),_0x1cb9('0x4'),'fullname','online',_0x1cb9('0x6'),_0x1cb9('0x7'),_0x1cb9('0x14'),_0x1cb9('0x8'),_0x1cb9('0xa')]},'log':_0x1cb9('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 7bde9b0..acd88e8 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 _0x090d=['UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update','Request'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0x090d,0x18d));var _0xd090=function(_0x3bf19d,_0x46c62e){_0x3bf19d=_0x3bf19d-0x0;var _0x9e216a=_0x090d[_0x3bf19d];return _0x9e216a;};'use strict';var client=require(_0xd090('0x0'));exports[_0xd090('0x1')]=function(_0x2517a9){return client['Request'](_0xd090('0x2'),{'body':_0x2517a9,'log':'CreateVoiceAgentReport'});};exports[_0xd090('0x3')]=function(_0x5d4bec,_0x1f5b8a,_0x4c8838){return client[_0xd090('0x4')]('UpdateVoiceAgentReport',{'body':_0x5d4bec,'options':{'where':{'uniqueid':_0x1f5b8a,'interface':_0x4c8838,'agentcomplete':!![]}},'log':_0xd090('0x5')});}; \ No newline at end of file +var _0xa8e3=['UpdateVoiceAgentReport','update','Request'];(function(_0x1164b5,_0x11ef47){var _0x42d006=function(_0xb19024){while(--_0xb19024){_0x1164b5['push'](_0x1164b5['shift']());}};_0x42d006(++_0x11ef47);}(_0xa8e3,0x17e));var _0x3a8e=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xa8e3[_0x27af45];return _0x18df21;};'use strict';var client=require('../client');exports['create']=function(_0xf331ac){return client['Request']('CreateVoiceAgentReport',{'body':_0xf331ac,'log':'CreateVoiceAgentReport'});};exports[_0x3a8e('0x0')]=function(_0xe0f17c,_0x17bd88,_0x55d175){return client[_0x3a8e('0x1')]('UpdateVoiceAgentReport',{'body':_0xe0f17c,'options':{'where':{'uniqueid':_0x17bd88,'interface':_0x55d175,'agentcomplete':!![]}},'log':_0x3a8e('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 72b2285..2a8fe30 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 _0x3436=['merge','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','YYYY-MM-DD\x20HH:mm:ss','day','format','type','duration','GetVoiceCallReports','moment','util','lodash','Request','CreateVoiceCallReport'];(function(_0x50550a,_0xbaaeb5){var _0x520980=function(_0x5a3130){while(--_0x5a3130){_0x50550a['push'](_0x50550a['shift']());}};_0x520980(++_0xbaaeb5);}(_0x3436,0x171));var _0x6343=function(_0x385b6c,_0x420aa9){_0x385b6c=_0x385b6c-0x0;var _0x433280=_0x3436[_0x385b6c];return _0x433280;};'use strict';var moment=require(_0x6343('0x0'));var util=require(_0x6343('0x1'));var _=require(_0x6343('0x2'));var client=require('../client');exports['create']=function(_0x4961a6){return client[_0x6343('0x3')](_0x6343('0x4'),{'body':_[_0x6343('0x5')](_0x4961a6,{'source':_0x4961a6['calleridnum'],'destinationcontext':_0x4961a6[_0x6343('0x6')],'callerid':_0x4961a6[_0x6343('0x7')],'amaflags':_0x6343('0x8')}),'log':_0x6343('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x6343('0x3')](_0x6343('0x9'),{'options':{'where':{'type':[_0x6343('0xa')],'createdAt':{'$between':[moment()['startOf']('day')['format'](_0x6343('0xb')),moment()['endOf'](_0x6343('0xc'))[_0x6343('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x6343('0xe'),'disposition',_0x6343('0xf'),'billableseconds']},'log':_0x6343('0x10')});};}; \ No newline at end of file +var _0x8b77=['GetVoiceCallReports','moment','util','lodash','../client','create','Request','merge','calleridnum','context','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','day','YYYY-MM-DD\x20HH:mm:ss','format','type','disposition','duration','billableseconds'];(function(_0x3c2b2b,_0x5250d9){var _0x1484f5=function(_0x6c9957){while(--_0x6c9957){_0x3c2b2b['push'](_0x3c2b2b['shift']());}};_0x1484f5(++_0x5250d9);}(_0x8b77,0x14b));var _0x78b7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8b77[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0x78b7('0x0'));var util=require(_0x78b7('0x1'));var _=require(_0x78b7('0x2'));var client=require(_0x78b7('0x3'));exports[_0x78b7('0x4')]=function(_0x27bc64){return client[_0x78b7('0x5')]('CreateVoiceCallReport',{'body':_[_0x78b7('0x6')](_0x27bc64,{'source':_0x27bc64[_0x78b7('0x7')],'destinationcontext':_0x27bc64[_0x78b7('0x8')],'callerid':_0x27bc64['callerid'],'amaflags':_0x78b7('0x9')}),'log':_0x78b7('0xa')});};exports[_0x78b7('0xb')]=function(){return function(){return client[_0x78b7('0x5')](_0x78b7('0xc'),{'options':{'where':{'type':[_0x78b7('0xd')],'createdAt':{'$between':[moment()['startOf'](_0x78b7('0xe'))['format'](_0x78b7('0xf')),moment()['endOf'](_0x78b7('0xe'))[_0x78b7('0x10')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x78b7('0x11'),_0x78b7('0x12'),_0x78b7('0x13'),_0x78b7('0x14')]},'log':_0x78b7('0x15')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 0600625..daf38ed 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 _0x25f0=['create','Request','CreateVoiceDialReport','../client'];(function(_0x2db667,_0x193cf5){var _0x83ff9=function(_0x5da022){while(--_0x5da022){_0x2db667['push'](_0x2db667['shift']());}};_0x83ff9(++_0x193cf5);}(_0x25f0,0xdf));var _0x025f=function(_0x5ab924,_0x33b1be){_0x5ab924=_0x5ab924-0x0;var _0x4adfe2=_0x25f0[_0x5ab924];return _0x4adfe2;};'use strict';var client=require(_0x025f('0x0'));exports[_0x025f('0x1')]=function(_0x4bf3b4){return client[_0x025f('0x2')](_0x025f('0x3'),{'body':_0x4bf3b4,'log':_0x025f('0x3')});}; \ No newline at end of file +var _0xd64f=['Request','CreateVoiceDialReport','../client','create'];(function(_0x5865fc,_0x339792){var _0x2aa668=function(_0xccb174){while(--_0xccb174){_0x5865fc['push'](_0x5865fc['shift']());}};_0x2aa668(++_0x339792);}(_0xd64f,0x1d2));var _0xfd64=function(_0x2f252d,_0x37e132){_0x2f252d=_0x2f252d-0x0;var _0x31600e=_0xd64f[_0x2f252d];return _0x31600e;};'use strict';var client=require(_0xfd64('0x0'));exports[_0xfd64('0x1')]=function(_0xfd762){return client[_0xfd64('0x2')](_0xfd64('0x3'),{'body':_0xfd762,'log':'CreateVoiceDialReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 10fd454..3bc0f21 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 _0x97a2=['getVoiceExtensions','../client','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x1d5ba8,_0x4d6d73){var _0x27a39f=function(_0x34c18b){while(--_0x34c18b){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x27a39f(++_0x4d6d73);}(_0x97a2,0x1b1));var _0x297a=function(_0x47ae27,_0x3c408e){_0x47ae27=_0x47ae27-0x0;var _0x1b1eae=_0x97a2[_0x47ae27];return _0x1b1eae;};'use strict';var client=require(_0x297a('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x297a('0x1')](_0x297a('0x2'),{'options':{'raw':!![],'attributes':['id',_0x297a('0x3'),_0x297a('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x297a('0x5')});};}; \ No newline at end of file +var _0xc91b=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x293b0b,_0x277b64){var _0x2b619f=function(_0x4aba5a){while(--_0x4aba5a){_0x293b0b['push'](_0x293b0b['shift']());}};_0x2b619f(++_0x277b64);}(_0xc91b,0x16f));var _0xbc91=function(_0x4f759c,_0x4e3f10){_0x4f759c=_0x4f759c-0x0;var _0x524004=_0xc91b[_0x4f759c];return _0x524004;};'use strict';var client=require(_0xbc91('0x0'));exports[_0xbc91('0x1')]=function(){return function(){return client[_0xbc91('0x2')](_0xbc91('0x3'),{'options':{'raw':!![],'attributes':['id',_0xbc91('0x4'),_0xbc91('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xbc91('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 9fd737e..b72b4ab 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 _0x327c=['getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','callAdditionalPhoneAfterMin','Trunk','mandatoryDispositionPause','callerid','active','Interval','interval','../client'];(function(_0x49b948,_0x760372){var _0x25d56a=function(_0xbe3757){while(--_0xbe3757){_0x49b948['push'](_0x49b948['shift']());}};_0x25d56a(++_0x760372);}(_0x327c,0x19c));var _0xc327=function(_0x46c657,_0x2bd0bc){_0x46c657=_0x46c657-0x0;var _0x4381f1=_0x327c[_0x46c657];return _0x4381f1;};'use strict';var client=require(_0xc327('0x0'));exports[_0xc327('0x1')]=function(){return function(){return client[_0xc327('0x2')](_0xc327('0x3'),{'options':{'raw':![],'attributes':['id',_0xc327('0x4'),'acw',_0xc327('0x5'),_0xc327('0x6'),_0xc327('0x7'),_0xc327('0x8'),_0xc327('0x9'),_0xc327('0xa'),_0xc327('0xb'),'dialLimitQueue',_0xc327('0xc'),_0xc327('0xd'),_0xc327('0xe'),_0xc327('0xf'),_0xc327('0x10'),_0xc327('0x11'),_0xc327('0x12'),_0xc327('0x13'),_0xc327('0x14'),_0xc327('0x15'),_0xc327('0x16'),_0xc327('0x17'),'dialBusyMaxRetry',_0xc327('0x18'),_0xc327('0x19'),_0xc327('0x1a'),'dialGlobalMaxRetry',_0xc327('0x1b'),_0xc327('0x1c'),_0xc327('0x1d'),_0xc327('0x1e'),'dialAMDActive',_0xc327('0x1f'),_0xc327('0x20'),'dialAMDAfterGreetingSilence',_0xc327('0x21'),_0xc327('0x22'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0xc327('0x23'),_0xc327('0x24'),_0xc327('0x25'),_0xc327('0x26'),_0xc327('0x27'),_0xc327('0x28'),_0xc327('0x29'),'dialQueueProject2',_0xc327('0x7'),_0xc327('0x2a'),_0xc327('0x2b'),_0xc327('0x2c'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency',_0xc327('0x2d'),_0xc327('0x2e'),_0xc327('0x2f'),_0xc327('0x30'),'dialMachineMaxRetry',_0xc327('0x31'),'dialAgentRejectMaxRetry',_0xc327('0x32'),_0xc327('0x33'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0xc327('0x34')],'include':[{'model':'Trunk','as':_0xc327('0x35'),'attributes':['id','name','callerid','active']},{'model':'Pause','as':_0xc327('0x36'),'attributes':['id',_0xc327('0x4')]},{'model':_0xc327('0x35'),'as':'TrunkBackup','attributes':['id','name',_0xc327('0x37'),_0xc327('0x38')]},{'model':'Interval','as':_0xc327('0x39'),'attributes':['id',_0xc327('0x4')],'include':[{'model':_0xc327('0x39'),'as':'Intervals','attributes':['id',_0xc327('0x4'),_0xc327('0x3a')]}]}]},'log':_0xc327('0x1')});};}; \ No newline at end of file +var _0x85f5=['dialAgiAfterHangupAgent','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','callAdditionalPhoneAfterMin','Trunk','name','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','../client','getVoiceQueues','GetVoiceQueue','acw','acwTimeout','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt'];(function(_0x4d73b1,_0x91ab71){var _0xe394f9=function(_0x47dd5d){while(--_0x47dd5d){_0x4d73b1['push'](_0x4d73b1['shift']());}};_0xe394f9(++_0x91ab71);}(_0x85f5,0x1e8));var _0x585f=function(_0x505439,_0x5a4a50){_0x505439=_0x505439-0x0;var _0x54267a=_0x85f5[_0x505439];return _0x54267a;};'use strict';var client=require(_0x585f('0x0'));exports[_0x585f('0x1')]=function(){return function(){return client['Request'](_0x585f('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x585f('0x3'),_0x585f('0x4'),'autopause',_0x585f('0x5'),'type',_0x585f('0x6'),_0x585f('0x7'),_0x585f('0x8'),_0x585f('0x9'),_0x585f('0xa'),_0x585f('0xb'),_0x585f('0xc'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x585f('0xd'),'dialOriginateTimeout',_0x585f('0xe'),_0x585f('0xf'),_0x585f('0x10'),_0x585f('0x11'),_0x585f('0x12'),'dialBusyMaxRetry',_0x585f('0x13'),_0x585f('0x14'),_0x585f('0x15'),'dialGlobalMaxRetry',_0x585f('0x16'),_0x585f('0x17'),_0x585f('0x18'),_0x585f('0x19'),_0x585f('0x1a'),'dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x585f('0x1b'),_0x585f('0x1c'),_0x585f('0x1d'),'timeout',_0x585f('0x1e'),'dialRecallInQueue',_0x585f('0x1f'),_0x585f('0x20'),'dialAgiAfterHangupClient',_0x585f('0x21'),_0x585f('0x5'),'strategy',_0x585f('0x22'),'dialCutDigit',_0x585f('0x23'),_0x585f('0x24'),'dialDropMaxRetry',_0x585f('0x25'),_0x585f('0x26'),_0x585f('0x27'),'dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x585f('0x28'),_0x585f('0x29'),_0x585f('0x2a'),'dialPredictiveIntervalMinThreshold',_0x585f('0x2b')],'include':[{'model':_0x585f('0x2c'),'as':_0x585f('0x2c'),'attributes':['id',_0x585f('0x2d'),_0x585f('0x2e'),_0x585f('0x2f')]},{'model':_0x585f('0x30'),'as':_0x585f('0x31'),'attributes':['id',_0x585f('0x2d')]},{'model':'Trunk','as':_0x585f('0x32'),'attributes':['id','name',_0x585f('0x2e'),_0x585f('0x2f')]},{'model':_0x585f('0x33'),'as':'Interval','attributes':['id',_0x585f('0x2d')],'include':[{'model':'Interval','as':'Intervals','attributes':['id','name','interval']}]}]},'log':_0x585f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index aa840fc..f801d5d 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(_0xb6b706,_0x1fd7d6){var _0x3201e6=function(_0x5876a6){while(--_0x5876a6){_0xb6b706['push'](_0xb6b706['shift']());}};_0x3201e6(++_0x1fd7d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x57299d,_0x451858){var _0x2fdf38=function(_0x43d00b){while(--_0x43d00b){_0x57299d['push'](_0x57299d['shift']());}};_0x2fdf38(++_0x451858);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'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 8bb4257..8dc2f95 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 _0xd3d6=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x941156,_0x49036d){var _0x29a815=function(_0x541af4){while(--_0x541af4){_0x941156['push'](_0x941156['shift']());}};_0x29a815(++_0x49036d);}(_0xd3d6,0x174));var _0x6d3d=function(_0x428f7e,_0x593967){_0x428f7e=_0x428f7e-0x0;var _0x47b3c3=_0xd3d6[_0x428f7e];return _0x47b3c3;};'use strict';var client=require(_0x6d3d('0x0'));exports[_0x6d3d('0x1')]=function(_0x258b30){return function(){return client[_0x6d3d('0x2')](_0x6d3d('0x3'),{'options':{'where':{'VoiceQueueId':_0x258b30,'paused':!![]},'raw':!![]},'log':_0x6d3d('0x1')});};}; \ No newline at end of file +var _0x73fd=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x1ed68d,_0x1c010a){var _0x4f08d8=function(_0x27117a){while(--_0x27117a){_0x1ed68d['push'](_0x1ed68d['shift']());}};_0x4f08d8(++_0x1c010a);}(_0x73fd,0x1ca));var _0xd73f=function(_0x267d8d,_0xe90f65){_0x267d8d=_0x267d8d-0x0;var _0x11a98f=_0x73fd[_0x267d8d];return _0x11a98f;};'use strict';var client=require('../client');exports[_0xd73f('0x0')]=function(_0x36a186){return function(){return client[_0xd73f('0x1')](_0xd73f('0x2'),{'options':{'where':{'VoiceQueueId':_0x36a186,'paused':!![]},'raw':!![]},'log':_0xd73f('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index c6c061d..13b1a54 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(_0x27f205,_0x471ee5){var _0x159938=function(_0x37a010){while(--_0x37a010){_0x27f205['push'](_0x27f205['shift']());}};_0x159938(++_0x471ee5);}(_0x7a54,0x106));var _0x47a5=function(_0x1f1872,_0x4e6c49){_0x1f1872=_0x1f1872-0x0;var _0x421a09=_0x7a54[_0x1f1872];return _0x421a09;};'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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x1de456,_0x40be9c){var _0x45b535=function(_0x3af41c){while(--_0x3af41c){_0x1de456['push'](_0x1de456['shift']());}};_0x45b535(++_0x40be9c);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 006ad27..a398fc1 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 _0xe264=['transfererchannel','transferercalleridnum','transferercalleridname','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','isexternal','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result'];(function(_0x2c4536,_0xfac86){var _0x4d07e0=function(_0x3678db){while(--_0x3678db){_0x2c4536['push'](_0x2c4536['shift']());}};_0x4d07e0(++_0xfac86);}(_0xe264,0x181));var _0x4e26=function(_0x301ca3,_0x4233c5){_0x301ca3=_0x301ca3-0x0;var _0x131292=_0xe264[_0x301ca3];return _0x131292;};'use strict';var client=require(_0x4e26('0x0'));exports[_0x4e26('0x1')]={};exports[_0x4e26('0x2')]=function(_0x12adfc){return client[_0x4e26('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x12adfc[_0x4e26('0x4')],'transfererchannel':_0x12adfc[_0x4e26('0x5')],'transferercalleridnum':_0x12adfc[_0x4e26('0x6')],'transferercalleridname':_0x12adfc[_0x4e26('0x7')],'transfererconnectedlinenum':_0x12adfc['transfererconnectedlinenum'],'transfererconnectedlinename':_0x12adfc['transfererconnectedlinename'],'transfereraccountcode':_0x12adfc[_0x4e26('0x8')],'transferercontext':_0x12adfc['transferercontext'],'transfererexten':_0x12adfc[_0x4e26('0x9')],'transfererlinkedid':_0x12adfc[_0x4e26('0xa')],'transfereechannel':_0x12adfc[_0x4e26('0xb')],'transfereecalleridnum':_0x12adfc[_0x4e26('0xc')],'transfereecalleridname':_0x12adfc[_0x4e26('0xd')],'transfereeconnectedlinenum':_0x12adfc[_0x4e26('0xe')],'transfereeconnectedlinename':_0x12adfc['transfereeconnectedlinename'],'transfereeaccountcode':_0x12adfc[_0x4e26('0xf')],'transfereecontext':_0x12adfc[_0x4e26('0x10')],'transfereeexten':_0x12adfc[_0x4e26('0x11')],'transfereelinkedid':_0x12adfc[_0x4e26('0x12')],'isexternal':_0x12adfc['isexternal'],'context':_0x12adfc[_0x4e26('0x13')],'extension':_0x12adfc[_0x4e26('0x14')],'type':_0x4e26('0x15')},'log':_0x4e26('0x16')});};exports[_0x4e26('0x17')]=function(_0x302fdb){return client['Request'](_0x4e26('0x16'),{'body':{'result':_0x302fdb[_0x4e26('0x4')],'transfererchannel':_0x302fdb['origtransfererchannel'],'transferercalleridnum':_0x302fdb[_0x4e26('0x18')],'transferercalleridname':_0x302fdb[_0x4e26('0x19')],'transfererconnectedlinenum':_0x302fdb[_0x4e26('0x1a')],'transfererconnectedlinename':_0x302fdb[_0x4e26('0x1b')],'transfereraccountcode':_0x302fdb['origtransfereraccountcode'],'transferercontext':_0x302fdb[_0x4e26('0x1c')],'transfererexten':_0x302fdb[_0x4e26('0x1d')],'transfererlinkedid':_0x302fdb[_0x4e26('0x1e')],'transfereechannel':_0x302fdb['transfertargetchannel'],'transfereecalleridnum':_0x302fdb['transfertargetcalleridnum'],'transfereecalleridname':_0x302fdb[_0x4e26('0x1f')],'transfereeconnectedlinenum':_0x302fdb['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x302fdb[_0x4e26('0x20')],'transfereeaccountcode':_0x302fdb[_0x4e26('0x21')],'transfereecontext':_0x302fdb['transfertargetcontext'],'transfereeexten':_0x302fdb[_0x4e26('0x22')],'transfereelinkedid':_0x302fdb[_0x4e26('0x23')],'isexternal':_0x302fdb[_0x4e26('0x24')],'context':_0x302fdb['origtransferercontext'],'extension':_0x302fdb[_0x4e26('0x25')],'type':_0x4e26('0x26')},'log':_0x4e26('0x16')});}; \ No newline at end of file +var _0x6e48=['transfers','blindTransfer','Request','result','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransferercontext','attended'];(function(_0x5172fc,_0x803050){var _0x1cca84=function(_0x5de775){while(--_0x5de775){_0x5172fc['push'](_0x5172fc['shift']());}};_0x1cca84(++_0x803050);}(_0x6e48,0x168));var _0x86e4=function(_0xe8652b,_0x163325){_0xe8652b=_0xe8652b-0x0;var _0x146a9a=_0x6e48[_0xe8652b];return _0x146a9a;};'use strict';var client=require('../client');exports[_0x86e4('0x0')]={};exports[_0x86e4('0x1')]=function(_0x930864){return client[_0x86e4('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x930864[_0x86e4('0x3')],'transfererchannel':_0x930864['transfererchannel'],'transferercalleridnum':_0x930864[_0x86e4('0x4')],'transferercalleridname':_0x930864[_0x86e4('0x5')],'transfererconnectedlinenum':_0x930864[_0x86e4('0x6')],'transfererconnectedlinename':_0x930864[_0x86e4('0x7')],'transfereraccountcode':_0x930864[_0x86e4('0x8')],'transferercontext':_0x930864[_0x86e4('0x9')],'transfererexten':_0x930864[_0x86e4('0xa')],'transfererlinkedid':_0x930864[_0x86e4('0xb')],'transfereechannel':_0x930864['transfereechannel'],'transfereecalleridnum':_0x930864[_0x86e4('0xc')],'transfereecalleridname':_0x930864[_0x86e4('0xd')],'transfereeconnectedlinenum':_0x930864[_0x86e4('0xe')],'transfereeconnectedlinename':_0x930864[_0x86e4('0xf')],'transfereeaccountcode':_0x930864['transfereeaccountcode'],'transfereecontext':_0x930864[_0x86e4('0x10')],'transfereeexten':_0x930864[_0x86e4('0x11')],'transfereelinkedid':_0x930864[_0x86e4('0x12')],'isexternal':_0x930864[_0x86e4('0x13')],'context':_0x930864[_0x86e4('0x14')],'extension':_0x930864[_0x86e4('0x15')],'type':_0x86e4('0x16')},'log':_0x86e4('0x17')});};exports[_0x86e4('0x18')]=function(_0x308641){return client[_0x86e4('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x308641[_0x86e4('0x3')],'transfererchannel':_0x308641[_0x86e4('0x19')],'transferercalleridnum':_0x308641[_0x86e4('0x1a')],'transferercalleridname':_0x308641[_0x86e4('0x1b')],'transfererconnectedlinenum':_0x308641[_0x86e4('0x1c')],'transfererconnectedlinename':_0x308641[_0x86e4('0x1d')],'transfereraccountcode':_0x308641[_0x86e4('0x1e')],'transferercontext':_0x308641['secondtransferercontext'],'transfererexten':_0x308641[_0x86e4('0x1f')],'transfererlinkedid':_0x308641[_0x86e4('0x20')],'transfereechannel':_0x308641[_0x86e4('0x21')],'transfereecalleridnum':_0x308641['transfertargetcalleridnum'],'transfereecalleridname':_0x308641[_0x86e4('0x22')],'transfereeconnectedlinenum':_0x308641['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x308641['transfertargetconnectedlinename'],'transfereeaccountcode':_0x308641[_0x86e4('0x23')],'transfereecontext':_0x308641[_0x86e4('0x24')],'transfereeexten':_0x308641[_0x86e4('0x25')],'transfereelinkedid':_0x308641['transfertargetlinkedid'],'isexternal':_0x308641[_0x86e4('0x13')],'context':_0x308641[_0x86e4('0x26')],'extension':_0x308641['origtransfererexten'],'type':_0x86e4('0x27')},'log':_0x86e4('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index ae03b34..6a83289 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 _0x3fa4=['name','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','omit','undefined','values','channels','voicechannel','validate','find','%s.%s','wav','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','uniqueid','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','map','resolve','StopMixMonitor','destinationchannel','stop','filename','toLowerCase','StopMixMonitor\x20Success','queueChannels','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','checkAfterSend','server','127.0.0.1','lodash','bluebird','moment','../../../config/environment','../properties','../ami','listen','format','%s/%s','timers','timer','agents','updateStatusRealtime','QueuePause','asterisk','ami\x20disconnected','join','keys','module','action','Reload','Action','then','catch','error','message','isConnected','username','command','Command','content','voiceQueues'];(function(_0x1c1777,_0x4f345b){var _0x1e634c=function(_0x16df88){while(--_0x16df88){_0x1c1777['push'](_0x1c1777['shift']());}};_0x1e634c(++_0x4f345b);}(_0x3fa4,0xf0));var _0x43fa=function(_0x589c23,_0x41844a){_0x589c23=_0x589c23-0x0;var _0x1fd853=_0x3fa4[_0x589c23];return _0x1fd853;};'use strict';var _=require(_0x43fa('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require('validate');var BPromise=require(_0x43fa('0x1'));var moment=require(_0x43fa('0x2'));var config=require(_0x43fa('0x3'));var properties=require(_0x43fa('0x4'));var ami=require(_0x43fa('0x5'));exports[_0x43fa('0x6')]=function(_0x41ded6,_0x4cd7ec,_0x2c7789){return new BPromise(function(_0x1e53b3,_0x6df71c){var _0x584209={'QueuePause':function(_0x3dc891){return new Promise(function(_0x46adc7,_0x1dc401){var _0x5a3921=util[_0x43fa('0x7')](_0x43fa('0x8'),'SIP',_0x3dc891['name']);if(_0x41ded6[_0x43fa('0x9')]&&_0x41ded6[_0x43fa('0x9')][_0x5a3921]&&_0x41ded6[_0x43fa('0x9')][_0x5a3921][_0x43fa('0xa')]){_0x41ded6[_0x43fa('0x9')][_0x5a3921]['updateAcw']();}if(_0x41ded6[_0x43fa('0xb')][_0x5a3921]){_0x41ded6[_0x43fa('0xb')][_0x5a3921][_0x43fa('0xc')]({'statePause':_0x3dc891['pause']?!![]:![]});}_0x46adc7({'code':0xc8,'message':_0x43fa('0xd')});});},'Reload':function(_0x4353c1){var _0x4665c1=this;return new Promise(function(_0x529c85,_0x24fb1e){if(ami['isConnected']()==![]){return _0x24fb1e(_0x4665c1['error'](0x1f4,[config['asterisk']['ip'],config[_0x43fa('0xe')]['username'],_0x43fa('0xf')][_0x43fa('0x10')]('\x20')));}_0x4353c1=_['pick'](_0x4353c1,_[_0x43fa('0x11')](properties[_0x43fa('0x12')]));_0x4353c1[_0x43fa('0x13')]=_0x43fa('0x14');return ami[_0x43fa('0x15')](_0x4353c1)[_0x43fa('0x16')](function(_0x5d12ac){_0x529c85({'code':0xc8,'message':_0x5d12ac['message']});})[_0x43fa('0x17')](function(_0x29b8aa){_0x24fb1e(_0x4665c1[_0x43fa('0x18')](0x1f5,_0x29b8aa[_0x43fa('0x19')]));});});},'Command':function(_0x660f61){var _0x15e594=this;return new Promise(function(_0xdf68a6,_0x2d8594){if(ami[_0x43fa('0x1a')]()==![]){return _0x2d8594(_0x15e594['error'](0x1f4,[config[_0x43fa('0xe')]['ip'],config[_0x43fa('0xe')][_0x43fa('0x1b')],_0x43fa('0xf')][_0x43fa('0x10')]('\x20')));}_0x660f61=_['pick'](_0x660f61,_0x43fa('0x1c'));_0x660f61[_0x43fa('0x13')]=_0x43fa('0x1d');return ami[_0x43fa('0x15')](_0x660f61)[_0x43fa('0x16')](function(_0x1d3328){_0xdf68a6({'code':0xc8,'message':_0x1d3328[_0x43fa('0x1e')]});})[_0x43fa('0x17')](function(_0x427426){_0x2d8594(_0x15e594['error'](0x1f5,_0x427426['message']));});});},'VoiceQueues':function(_0xdb62ec){return new Promise(function(_0x197eac,_0x28f695){var _0x78f105=[];for(var _0x40969a in _0x41ded6[_0x43fa('0x1f')]){if(_0x41ded6['voiceQueues']['hasOwnProperty'](_0x40969a)){var _0x1fa077=_0x41ded6[_0x43fa('0x1f')][_0x40969a];var _0x3d6365={'id':_0x1fa077['id'],'name':_0x1fa077[_0x43fa('0x20')],'strategy':_0x1fa077['strategy'],'answered':_0x1fa077[_0x43fa('0x21')],'available':_0x1fa077[_0x43fa('0x22')],'loggedIn':_0x1fa077[_0x43fa('0x23')],'pTalking':_0x1fa077[_0x43fa('0x24')],'sumBillable':_0x1fa077['sumBillable'],'sumDuration':_0x1fa077[_0x43fa('0x25')],'sumHoldTime':_0x1fa077[_0x43fa('0x26')]||0x0,'talking':_0x1fa077[_0x43fa('0x27')],'total':_0x1fa077[_0x43fa('0x28')],'type':_0x1fa077[_0x43fa('0x29')],'unmanaged':_0x1fa077[_0x43fa('0x2a')],'abandoned':_0x1fa077[_0x43fa('0x2b')],'waiting':_0x1fa077[_0x43fa('0x2c')],'loggedInDb':_0x1fa077[_0x43fa('0x2d')]};if(_0x1fa077[_0x43fa('0x29')]===_0x43fa('0x2e')){_0x3d6365[_0x43fa('0x2f')]=_0x1fa077['dialActive'];_0x3d6365['dialMethod']=_0x1fa077[_0x43fa('0x30')];_0x3d6365[_0x43fa('0x31')]=_0x1fa077[_0x43fa('0x31')];_0x3d6365[_0x43fa('0x32')]=_0x1fa077['dialOriginateCallerIdNumber'];_0x3d6365[_0x43fa('0x33')]=_0x1fa077[_0x43fa('0x33')];_0x3d6365[_0x43fa('0x34')]=_0x1fa077['dialPrefix'];_0x3d6365[_0x43fa('0x35')]=_0x1fa077[_0x43fa('0x35')];_0x3d6365[_0x43fa('0x36')]=_0x1fa077[_0x43fa('0x36')];_0x3d6365['outboundAnswerCallsDay']=_0x1fa077[_0x43fa('0x37')];_0x3d6365['outboundBlacklistCallsDay']=_0x1fa077[_0x43fa('0x38')];_0x3d6365[_0x43fa('0x39')]=_0x1fa077[_0x43fa('0x39')];_0x3d6365['outboundCongestionCallsDay']=_0x1fa077[_0x43fa('0x3a')];_0x3d6365['outboundDropCallsDayACS']=_0x1fa077['outboundDropCallsDayACS'];_0x3d6365[_0x43fa('0x3b')]=_0x1fa077[_0x43fa('0x3b')];_0x3d6365[_0x43fa('0x3c')]=_0x1fa077['outboundDropCallsDayTimeout'];_0x3d6365[_0x43fa('0x3d')]=_0x1fa077[_0x43fa('0x3d')];_0x3d6365[_0x43fa('0x3e')]=_0x1fa077[_0x43fa('0x3e')];_0x3d6365[_0x43fa('0x3f')]=_0x1fa077['outboundOriginateFailureCallsDay'];_0x3d6365[_0x43fa('0x40')]=_0x1fa077[_0x43fa('0x40')];_0x3d6365[_0x43fa('0x41')]=_0x1fa077[_0x43fa('0x41')];_0x3d6365['outboundUnknownCallsDay']=_0x1fa077['outboundUnknownCallsDay'];_0x3d6365[_0x43fa('0x42')]=_0x1fa077[_0x43fa('0x42')];_0x3d6365[_0x43fa('0x43')]=_0x1fa077[_0x43fa('0x43')];_0x3d6365[_0x43fa('0x44')]=_0x1fa077['predictiveIntervalAvgTalktime'];_0x3d6365[_0x43fa('0x45')]=_0x1fa077['predictiveIntervalDroppedCallsCallersExit'];_0x3d6365['predictiveIntervalDroppedCallsTimeout']=_0x1fa077[_0x43fa('0x46')];_0x3d6365['predictiveIntervalErlangCalls']=_0x1fa077[_0x43fa('0x47')];_0x3d6365[_0x43fa('0x48')]=_0x1fa077[_0x43fa('0x48')];_0x3d6365[_0x43fa('0x49')]=_0x1fa077['predictiveIntervalHitRate'];_0x3d6365['predictiveIntervalMultiplicativeFactor']=_0x1fa077['predictiveIntervalMultiplicativeFactor'];_0x3d6365[_0x43fa('0x4a')]=_0x1fa077[_0x43fa('0x4a')];_0x3d6365['predictiveIntervalAvailable']=_0x1fa077[_0x43fa('0x4b')];_0x3d6365[_0x43fa('0x4c')]=_0x1fa077[_0x43fa('0x4c')];_0x3d6365[_0x43fa('0x19')]=_0x1fa077['message'];_0x3d6365[_0x43fa('0x4d')]=_0x1fa077[_0x43fa('0x4d')];_0x3d6365['erlangCalls']=_0x1fa077['erlangCalls'];_0x3d6365[_0x43fa('0x4e')]=_0x1fa077['erlangCallToSecond'];_0x3d6365[_0x43fa('0x4f')]=_0x1fa077[_0x43fa('0x4f')];_0x3d6365['erlangBusyFactor']=_0x1fa077[_0x43fa('0x50')];_0x3d6365['startPredictive']=_0x1fa077[_0x43fa('0x51')];_0x3d6365[_0x43fa('0x52')]=_0x1fa077[_0x43fa('0x52')];}if(_0x1fa077['Trunk']){_0x3d6365[_0x43fa('0x53')]={'id':_0x1fa077[_0x43fa('0x53')]['id'],'name':_0x1fa077[_0x43fa('0x53')][_0x43fa('0x20')],'active':_0x1fa077[_0x43fa('0x53')][_0x43fa('0x54')],'callerid':_0x1fa077['Trunk'][_0x43fa('0x55')]};}if(_0x1fa077['Interval']){_0x3d6365[_0x43fa('0x56')]={'id':_0x1fa077['Interval']['id'],'name':_0x1fa077[_0x43fa('0x56')][_0x43fa('0x20')]};}_0x78f105[_0x43fa('0x57')](_0x3d6365);}}_0x197eac({'count':_0x78f105[_0x43fa('0x58')],'rows':_0x78f105});});},'UpdateVoiceQueue':function(_0x1b8851){return new Promise(function(_0x5575a7,_0x2fffef){var _0x5c96e1=_['find'](_0x41ded6['voiceQueues'],{'id':parseInt(_0x1b8851['id'])});var _0x436da4=_[_0x43fa('0x59')](_0x1b8851,['id']);if(_0x5c96e1){for(var _0x2c246e in _0x436da4){if(typeof _0x436da4[_0x2c246e]!==_0x43fa('0x5a')&&typeof _0x5c96e1[_0x2c246e]!==_0x43fa('0x5a')){_0x5c96e1[_0x2c246e]=_0x436da4[_0x2c246e];}}_0x5575a7(_0x5c96e1);}else{_0x2fffef();}});},'VoiceChannels':function(_0x4d3522){return new Promise(function(_0x42bf1c,_0x1662d5){var _0x305e90=_[_0x43fa('0x5b')](_0x41ded6[_0x43fa('0x5c')]);_0x42bf1c({'count':_0x305e90[_0x43fa('0x58')],'rows':_0x305e90});});},'VoiceChannelMixMonitor':function(_0x1e2acd){var _0x33f828=this;return new Promise(function(_0x345c65,_0x458e11){if(ami[_0x43fa('0x1a')]()==![]){return _0x458e11(_0x33f828['error'](0x1f4,[config[_0x43fa('0xe')]['ip'],config[_0x43fa('0xe')]['username'],_0x43fa('0xf')]['join']('\x20')));}var _0x193a0b=schema(properties[_0x43fa('0x5d')])[_0x43fa('0x5e')](_0x1e2acd);if(_0x193a0b[_0x43fa('0x58')]>0x0){return _0x458e11(_0x33f828[_0x43fa('0x18')](0x1f4,_['map'](_0x193a0b,_0x43fa('0x19'))['join'](',\x20')));}var _0x12ac3f=_[_0x43fa('0x5f')](_0x41ded6[_0x43fa('0x5c')],{'uniqueid':_0x1e2acd['uniqueid']});if(_0x12ac3f&&_0x12ac3f['channel']){var _0xc3f7aa=util['format'](_0x43fa('0x60'),_0x1e2acd['filename']||_0x1e2acd['uniqueid'],_0x1e2acd[_0x43fa('0x7')]||_0x43fa('0x61'));return ami['Action']({'action':_0x43fa('0x62'),'channel':_0x12ac3f[_0x43fa('0x63')],'file':_0xc3f7aa,'options':_0x43fa('0x64')})[_0x43fa('0x16')](function(_0x51d224){var _0xb03adb=_[_0x43fa('0x5f')](_0x12ac3f[_0x43fa('0x65')],{'filename':_0x43fa('0x66')+_0xc3f7aa['toLowerCase']()});if(_['isNil'](_0xb03adb)){_0x12ac3f[_0x43fa('0x65')]['push']({'filename':'/var/spool/asterisk/monitor/'+_0xc3f7aa['toLowerCase'](),'createdAt':moment()[_0x43fa('0x7')](_0x43fa('0x67')),'mixmonitorid':_0x51d224[_0x43fa('0x68')],'status':_0x43fa('0x69')});}else{_0xb03adb[_0x43fa('0x68')]=_0x51d224[_0x43fa('0x68')];_0xb03adb[_0x43fa('0x6a')]='rec';}_0x345c65({'code':0xc8,'message':[_0x1e2acd[_0x43fa('0x6b')],_0x43fa('0x6c'),_0x51d224['mixmonitorid']][_0x43fa('0x10')]('\x20'),'mixmonitorid':_0x51d224['mixmonitorid']});})[_0x43fa('0x17')](function(_0x18cea7){_0x458e11(_0x33f828[_0x43fa('0x18')](0x1f5,[_0x1e2acd[_0x43fa('0x6b')],_0x18cea7['message']['toLowerCase']()][_0x43fa('0x10')]('\x20')));});}else{return _0x458e11(_0x33f828[_0x43fa('0x18')](0x1f5,_0x43fa('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x3ba2e0){var _0x5aa7af=this;return new Promise(function(_0x4cfc61,_0x4045d1){if(ami['isConnected']()==![]){return _0x4045d1(_0x5aa7af[_0x43fa('0x18')](0x1f4,[config[_0x43fa('0xe')]['ip'],config[_0x43fa('0xe')][_0x43fa('0x1b')],'ami\x20disconnected']['join']('\x20')));}var _0x220e2a=schema(properties['voicechannel'])[_0x43fa('0x5e')](_0x3ba2e0);if(_0x220e2a[_0x43fa('0x58')]>0x0){return _0x4045d1(_0x5aa7af[_0x43fa('0x18')](0x1f4,_[_0x43fa('0x6e')](_0x220e2a,_0x43fa('0x19'))[_0x43fa('0x10')](',\x20')));}var _0x3f89f4=_['find'](_0x41ded6[_0x43fa('0x5c')],{'uniqueid':_0x3ba2e0[_0x43fa('0x6b')]});if(_0x3f89f4){return BPromise[_0x43fa('0x6f')]()[_0x43fa('0x16')](function(){if(_0x3f89f4[_0x43fa('0x63')]){return ami['Action']({'action':_0x43fa('0x70'),'channel':_0x3f89f4[_0x43fa('0x63')],'mixmonitorid':_0x3ba2e0[_0x43fa('0x68')]})[_0x43fa('0x17')](function(_0x78f0a9){});}})[_0x43fa('0x16')](function(){if(_0x3f89f4[_0x43fa('0x71')]){return ami[_0x43fa('0x15')]({'action':_0x43fa('0x70'),'channel':_0x3f89f4['destinationchannel'],'mixmonitorid':_0x3ba2e0[_0x43fa('0x68')]})[_0x43fa('0x17')](function(_0x2d8a01){});}})[_0x43fa('0x16')](function(_0x31fdeb){var _0x4e9f30=_['find'](_0x3f89f4[_0x43fa('0x65')],{'mixmonitorid':_0x3ba2e0[_0x43fa('0x68')]});if(_0x4e9f30){_0x4e9f30[_0x43fa('0x6a')]=_0x43fa('0x72');}})[_0x43fa('0x16')](function(){var _0x2bae57=util[_0x43fa('0x7')](_0x43fa('0x60'),_0x3ba2e0[_0x43fa('0x73')]||_0x3ba2e0[_0x43fa('0x6b')],_0x3ba2e0[_0x43fa('0x7')]||_0x43fa('0x61'));var _0xa96468=_[_0x43fa('0x5f')](_0x3f89f4[_0x43fa('0x65')],{'filename':_0x43fa('0x66')+_0x2bae57[_0x43fa('0x74')]()});if(_0xa96468){_0xa96468[_0x43fa('0x6a')]=_0x43fa('0x72');}})[_0x43fa('0x16')](function(){_0x4cfc61({'code':0xc8,'message':[_0x3ba2e0[_0x43fa('0x6b')],_0x43fa('0x75')]['join']('\x20')});})['catch'](function(_0x2840d9){_0x4045d1(_0x5aa7af[_0x43fa('0x18')](0x1f5,[_0x3ba2e0['uniqueid'],_0x2840d9[_0x43fa('0x19')]['toLowerCase']()][_0x43fa('0x10')]('\x20')));});}else{return _0x4045d1(_0x5aa7af['error'](0x1f5,_0x43fa('0x6d')));}});},'VoiceQueuesChannels':function(_0x6679e0){return new Promise(function(_0x1b79b3,_0x149093){var _0x61aef=_['values'](_0x41ded6[_0x43fa('0x76')]);_0x1b79b3({'count':_0x61aef['length'],'rows':_0x61aef});});},'VoiceQueuesChannel':function(_0x1ea3a0){var _0x310232=this;return new Promise(function(_0x2ed970,_0x1619ae){var _0x195c8b=schema(properties['voicequeuechannel'])[_0x43fa('0x5e')](_0x1ea3a0);if(_0x195c8b[_0x43fa('0x58')]>0x0){return _0x1619ae(_0x310232['error'](0x1f4,_[_0x43fa('0x6e')](_0x195c8b,'message')[_0x43fa('0x10')](',\x20')));}var _0x3c138c=_['find'](_0x41ded6[_0x43fa('0x76')],{'uniqueid':_0x1ea3a0[_0x43fa('0x6b')]});if(_0x3c138c){_0x2ed970(_0x3c138c);}else{return _0x1619ae(_0x310232[_0x43fa('0x18')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x5c2538){var _0x43088a=this;return new Promise(function(_0x334642,_0x161e93){if(ami[_0x43fa('0x1a')]()==![]){return _0x161e93(_0x43088a['error'](0x1f4,[config[_0x43fa('0xe')]['ip'],config['asterisk']['username'],_0x43fa('0xf')][_0x43fa('0x10')]('\x20')));}var _0xb7596=schema(properties[_0x43fa('0x77')])[_0x43fa('0x5e')](_0x5c2538);if(_0xb7596[_0x43fa('0x58')]>0x0){return _0x161e93(_0x43088a['error'](0x1f4,_[_0x43fa('0x6e')](_0xb7596,_0x43fa('0x19'))[_0x43fa('0x10')](',\x20')));}var _0x5779d1=_[_0x43fa('0x5f')](_0x41ded6[_0x43fa('0x76')],{'uniqueid':_0x5c2538[_0x43fa('0x6b')]});if(_0x5779d1&&_0x5779d1['channel']){return ami[_0x43fa('0x15')]({'action':_0x43fa('0x78'),'channel':_0x5779d1['channel']})['then'](function(_0xa71bb){_0x334642({'code':0xc8,'message':[_0x5c2538[_0x43fa('0x6b')],_0xa71bb[_0x43fa('0x19')][_0x43fa('0x74')]()][_0x43fa('0x10')]('\x20')});})[_0x43fa('0x17')](function(_0x241200){_0x161e93(_0x43088a[_0x43fa('0x18')](0x1f5,[_0x5c2538[_0x43fa('0x6b')],_0x241200[_0x43fa('0x19')][_0x43fa('0x74')]()][_0x43fa('0x10')]('\x20')));});}else{return _0x161e93(_0x43088a[_0x43fa('0x18')](0x1f5,_0x43fa('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x41ea25){var _0x33b067=this;return new Promise(function(_0x5d3d43,_0x2c3333){if(ami[_0x43fa('0x1a')]()==![]){return _0x2c3333(_0x33b067[_0x43fa('0x18')](0x1f4,[config[_0x43fa('0xe')]['ip'],config['asterisk'][_0x43fa('0x1b')],'ami\x20disconnected']['join']('\x20')));}var _0x4931dd=schema(properties[_0x43fa('0x79')])['validate'](_0x41ea25);if(_0x4931dd[_0x43fa('0x58')]>0x0){return _0x2c3333(_0x33b067[_0x43fa('0x18')](0x1f4,_[_0x43fa('0x6e')](_0x4931dd,_0x43fa('0x19'))[_0x43fa('0x10')](',\x20')));}var _0x521d7a=_[_0x43fa('0x5f')](_0x41ded6[_0x43fa('0x76')],{'uniqueid':_0x41ea25[_0x43fa('0x6b')]});if(_0x521d7a&&_0x521d7a[_0x43fa('0x63')]){return ami['Action']({'action':'Redirect','channel':_0x521d7a['channel'],'exten':_0x41ea25['exten'],'context':_0x41ea25[_0x43fa('0x7a')]||_0x521d7a[_0x43fa('0x7a')],'priority':0x1})[_0x43fa('0x16')](function(_0x583deb){_0x5d3d43({'code':0xc8,'message':[_0x41ea25[_0x43fa('0x6b')],_0x583deb[_0x43fa('0x19')][_0x43fa('0x74')]()][_0x43fa('0x10')]('\x20')});})['catch'](function(_0x170e69){_0x2c3333(_0x33b067[_0x43fa('0x18')](0x1f5,[_0x41ea25[_0x43fa('0x6b')],_0x170e69[_0x43fa('0x19')][_0x43fa('0x74')]()][_0x43fa('0x10')]('\x20')));});}else{return _0x2c3333(_0x33b067[_0x43fa('0x18')](0x1f5,_0x43fa('0x6d')));}});},'Agents':function(_0x5c98df){return new Promise(function(_0x4b31b2,_0x278242){var _0xe218b0=_[_0x43fa('0x5b')](_0x41ded6['agents']);_0x4b31b2({'count':_0xe218b0[_0x43fa('0x58')],'rows':_0xe218b0});});},'Telephones':function(_0x3f4839){return new Promise(function(_0x268cb2,_0x563487){var _0x3a3771=_[_0x43fa('0x5b')](_0x41ded6[_0x43fa('0x7b')]);_0x268cb2({'count':_0x3a3771['length'],'rows':_0x3a3771});});},'Trunks':function(_0x10123f){return new Promise(function(_0x457006,_0x461abd){var _0x5272eb=_[_0x43fa('0x5b')](_0x41ded6[_0x43fa('0x7c')]);_0x457006({'count':_0x5272eb['length'],'rows':_0x5272eb});});},'OutboundChannels':function(_0x733caf){return new Promise(function(_0x941b71,_0xb7fb97){var _0x50a4a9=_[_0x43fa('0x5b')](_0x41ded6[_0x43fa('0x7d')]);_0x941b71({'count':_0x50a4a9[_0x43fa('0x58')],'rows':_0x50a4a9});});},'Outbound':function(_0x1d033b){return new Promise(function(_0x2ee768,_0xb7474f){_0x2ee768(_0x41ded6['outbound']);});},'Campaigns':function(_0x179678){return new Promise(function(_0x1e2e8e,_0x302f7c){var _0x1f7593=_[_0x43fa('0x5b')](_0x41ded6[_0x43fa('0x7e')]);_0x1e2e8e({'count':_0x1f7593[_0x43fa('0x58')],'rows':_0x1f7593});});},'VoiceQueuesPreview':function(_0x2a56a9){var _0x59cda3=this;return new Promise(function(_0x5a615c,_0x1c881d){_0x4cd7ec[_0x43fa('0x7f')](_0x2a56a9['id'])[_0x43fa('0x16')](function(_0x1f1dd0){_0x5a615c({'code':0xc8,'message':_0x1f1dd0['message']});})[_0x43fa('0x17')](function(_0x374039){_0x1c881d(_0x59cda3['error'](0x1f4,_0x374039[_0x43fa('0x19')]));});});},'EventManager':function(_0x1f240a){var _0x3c2c3c=this;return new Promise(function(_0x1f5df6,_0x187b74){if(!_0x1f240a['event']){return _0x187b74(_0x3c2c3c[_0x43fa('0x18')](0x1f4,_0x43fa('0x80')));}ami[_0x43fa('0x81')](_0x43fa('0x82')+_0x1f240a[_0x43fa('0x83')],_0x1f240a[_0x43fa('0x19')]);_0x1f5df6({'code':0xc8,'message':_0x1f240a});});},'FaxAccounts':function(_0x303923){return new Promise(function(_0xac5e4f,_0x121f31){var _0x5af6e3=_[_0x43fa('0x5b')](_0x41ded6[_0x43fa('0x84')]);_0xac5e4f({'count':_0x5af6e3[_0x43fa('0x58')],'rows':_0x5af6e3});});},'SendFax':function(_0x3ef055){var _0x15230c=this;return new Promise(function(_0x3480c6,_0x1d4217){_0x2c7789['send'](_0x3ef055)[_0x43fa('0x16')](function(_0x5250b4){_0x3480c6({'code':0xc8,'message':_0x5250b4[_0x43fa('0x19')]});})[_0x43fa('0x17')](function(_0x484c73){_0x1d4217(_0x15230c['error'](0x1f4,_0x484c73[_0x43fa('0x19')]));});});},'CheckAfterSend':function(_0x12a889){var _0x30a504=this;return new Promise(function(_0x262aee,_0x131afb){_0x2c7789[_0x43fa('0x85')](_0x12a889)[_0x43fa('0x16')](function(_0xdec4bc){_0x262aee({'code':0xc8,'message':_0xdec4bc['message']});})[_0x43fa('0x17')](function(_0x1c41a1){_0x131afb(_0x30a504[_0x43fa('0x18')](0x1f4,_0x1c41a1[_0x43fa('0x19')]));});});}};var _0x377a73=jayson[_0x43fa('0x86')](_0x584209)['http']();_0x377a73['on']('error',function(_0x5c75b0){return _0x6df71c(_0x5c75b0);});_0x377a73[_0x43fa('0x6')](0x232a,_0x43fa('0x87'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x1e53b3('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file +var _0xabce=['name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','asterisk','username','ami\x20disconnected','pick','keys','Reload','then','message','catch','error','join','action','Command','Action','content','voiceQueues','hasOwnProperty','strategy','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid','Interval','push','length','omit','undefined','channels','voicechannel','find','uniqueid','%s.%s','filename','wav','MixMonitor','channel','/var/spool/asterisk/monitor/','toLowerCase','isNil','monitors','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','map','resolve','destinationchannel','StopMixMonitor','stop','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Redirect','exten','context','values','telephones','trunks','outboundChannels','outbound','campaigns','Event\x20name\x20mandatory','custom:','event','faxAccounts','checkAfterSend','server','http','127.0.0.1','log','lodash','util','jayson/promise','validate','bluebird','../properties','../ami','listen','format','%s/%s','SIP'];(function(_0x5887ec,_0x504c12){var _0x23b637=function(_0x3f720f){while(--_0x3f720f){_0x5887ec['push'](_0x5887ec['shift']());}};_0x23b637(++_0x504c12);}(_0xabce,0x103));var _0xeabc=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xabce[_0x3899d1];return _0xeb4a7d;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var jayson=require(_0xeabc('0x2'));var schema=require(_0xeabc('0x3'));var BPromise=require(_0xeabc('0x4'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0xeabc('0x5'));var ami=require(_0xeabc('0x6'));exports[_0xeabc('0x7')]=function(_0x5e9e2d,_0x54e4a8,_0x1b07a8){return new BPromise(function(_0x52a4d7,_0x229ba4){var _0x52ede8={'QueuePause':function(_0x3bdc29){return new Promise(function(_0x9417af,_0x8434c5){var _0x5d59d5=util[_0xeabc('0x8')](_0xeabc('0x9'),_0xeabc('0xa'),_0x3bdc29[_0xeabc('0xb')]);if(_0x5e9e2d[_0xeabc('0xc')]&&_0x5e9e2d[_0xeabc('0xc')][_0x5d59d5]&&_0x5e9e2d[_0xeabc('0xc')][_0x5d59d5][_0xeabc('0xd')]){_0x5e9e2d[_0xeabc('0xc')][_0x5d59d5][_0xeabc('0xe')]();}if(_0x5e9e2d[_0xeabc('0xf')][_0x5d59d5]){_0x5e9e2d[_0xeabc('0xf')][_0x5d59d5][_0xeabc('0x10')]({'statePause':_0x3bdc29[_0xeabc('0x11')]?!![]:![]});}_0x9417af({'code':0xc8,'message':_0xeabc('0x12')});});},'Reload':function(_0xcfbf06){var _0x53df9c=this;return new Promise(function(_0x235c2d,_0x1319f3){if(ami[_0xeabc('0x13')]()==![]){return _0x1319f3(_0x53df9c['error'](0x1f4,[config['asterisk']['ip'],config[_0xeabc('0x14')][_0xeabc('0x15')],_0xeabc('0x16')]['join']('\x20')));}_0xcfbf06=_[_0xeabc('0x17')](_0xcfbf06,_[_0xeabc('0x18')](properties['module']));_0xcfbf06['action']=_0xeabc('0x19');return ami['Action'](_0xcfbf06)[_0xeabc('0x1a')](function(_0x1b64b9){_0x235c2d({'code':0xc8,'message':_0x1b64b9[_0xeabc('0x1b')]});})[_0xeabc('0x1c')](function(_0x31dd53){_0x1319f3(_0x53df9c[_0xeabc('0x1d')](0x1f5,_0x31dd53[_0xeabc('0x1b')]));});});},'Command':function(_0x5e30ee){var _0x5d92e5=this;return new Promise(function(_0x1253e4,_0x4d68ea){if(ami[_0xeabc('0x13')]()==![]){return _0x4d68ea(_0x5d92e5[_0xeabc('0x1d')](0x1f4,[config['asterisk']['ip'],config[_0xeabc('0x14')][_0xeabc('0x15')],_0xeabc('0x16')][_0xeabc('0x1e')]('\x20')));}_0x5e30ee=_[_0xeabc('0x17')](_0x5e30ee,'command');_0x5e30ee[_0xeabc('0x1f')]=_0xeabc('0x20');return ami[_0xeabc('0x21')](_0x5e30ee)['then'](function(_0x457f27){_0x1253e4({'code':0xc8,'message':_0x457f27[_0xeabc('0x22')]});})[_0xeabc('0x1c')](function(_0x319119){_0x4d68ea(_0x5d92e5['error'](0x1f5,_0x319119[_0xeabc('0x1b')]));});});},'VoiceQueues':function(_0x480440){return new Promise(function(_0x27dbaf,_0x4d4e29){var _0x811f0d=[];for(var _0x12acbd in _0x5e9e2d[_0xeabc('0x23')]){if(_0x5e9e2d[_0xeabc('0x23')][_0xeabc('0x24')](_0x12acbd)){var _0x137293=_0x5e9e2d[_0xeabc('0x23')][_0x12acbd];var _0x4c2693={'id':_0x137293['id'],'name':_0x137293['name'],'strategy':_0x137293[_0xeabc('0x25')],'answered':_0x137293['answered'],'available':_0x137293[_0xeabc('0x26')],'loggedIn':_0x137293[_0xeabc('0x27')],'pTalking':_0x137293['pTalking'],'sumBillable':_0x137293[_0xeabc('0x28')],'sumDuration':_0x137293[_0xeabc('0x29')],'sumHoldTime':_0x137293[_0xeabc('0x2a')]||0x0,'talking':_0x137293[_0xeabc('0x2b')],'total':_0x137293[_0xeabc('0x2c')],'type':_0x137293[_0xeabc('0x2d')],'unmanaged':_0x137293[_0xeabc('0x2e')],'abandoned':_0x137293[_0xeabc('0x2f')],'waiting':_0x137293[_0xeabc('0x30')],'loggedInDb':_0x137293['loggedInDb']};if(_0x137293[_0xeabc('0x2d')]==='outbound'){_0x4c2693[_0xeabc('0x31')]=_0x137293[_0xeabc('0x31')];_0x4c2693[_0xeabc('0x32')]=_0x137293[_0xeabc('0x32')];_0x4c2693[_0xeabc('0x33')]=_0x137293[_0xeabc('0x33')];_0x4c2693[_0xeabc('0x34')]=_0x137293['dialOriginateCallerIdNumber'];_0x4c2693[_0xeabc('0x35')]=_0x137293[_0xeabc('0x35')];_0x4c2693[_0xeabc('0x36')]=_0x137293['dialPrefix'];_0x4c2693[_0xeabc('0x37')]=_0x137293[_0xeabc('0x37')];_0x4c2693[_0xeabc('0x38')]=_0x137293['outboundAnswerAgiCallsDay'];_0x4c2693[_0xeabc('0x39')]=_0x137293[_0xeabc('0x39')];_0x4c2693[_0xeabc('0x3a')]=_0x137293['outboundBlacklistCallsDay'];_0x4c2693[_0xeabc('0x3b')]=_0x137293[_0xeabc('0x3b')];_0x4c2693['outboundCongestionCallsDay']=_0x137293['outboundCongestionCallsDay'];_0x4c2693[_0xeabc('0x3c')]=_0x137293[_0xeabc('0x3c')];_0x4c2693['outboundDropCallsDayCallersExit']=_0x137293[_0xeabc('0x3d')];_0x4c2693[_0xeabc('0x3e')]=_0x137293[_0xeabc('0x3e')];_0x4c2693[_0xeabc('0x3f')]=_0x137293[_0xeabc('0x3f')];_0x4c2693['outboundNoSuchCallsDay']=_0x137293[_0xeabc('0x40')];_0x4c2693['outboundOriginateFailureCallsDay']=_0x137293[_0xeabc('0x41')];_0x4c2693[_0xeabc('0x42')]=_0x137293[_0xeabc('0x42')];_0x4c2693['outboundRejectCallsDay']=_0x137293['outboundRejectCallsDay'];_0x4c2693[_0xeabc('0x43')]=_0x137293['outboundUnknownCallsDay'];_0x4c2693[_0xeabc('0x44')]=_0x137293['predictiveIntervalAnsweredCalls'];_0x4c2693['predictiveIntervalAvgHoldtime']=_0x137293['predictiveIntervalAvgHoldtime'];_0x4c2693['predictiveIntervalAvgTalktime']=_0x137293[_0xeabc('0x45')];_0x4c2693['predictiveIntervalDroppedCallsCallersExit']=_0x137293[_0xeabc('0x46')];_0x4c2693[_0xeabc('0x47')]=_0x137293['predictiveIntervalDroppedCallsTimeout'];_0x4c2693[_0xeabc('0x48')]=_0x137293['predictiveIntervalErlangCalls'];_0x4c2693[_0xeabc('0x49')]=_0x137293['predictiveIntervalErlangCallsDroppedCalls'];_0x4c2693[_0xeabc('0x4a')]=_0x137293[_0xeabc('0x4a')];_0x4c2693[_0xeabc('0x4b')]=_0x137293['predictiveIntervalMultiplicativeFactor'];_0x4c2693['predictiveIntervalPauses']=_0x137293['predictiveIntervalPauses'];_0x4c2693[_0xeabc('0x4c')]=_0x137293[_0xeabc('0x4c')];_0x4c2693[_0xeabc('0x4d')]=_0x137293['predictiveIntervalTotalCalls'];_0x4c2693['message']=_0x137293[_0xeabc('0x1b')];_0x4c2693[_0xeabc('0x4e')]=_0x137293['originated'];_0x4c2693[_0xeabc('0x4f')]=_0x137293['erlangCalls'];_0x4c2693[_0xeabc('0x50')]=_0x137293['erlangCallToSecond'];_0x4c2693['erlangAbandonmentRate']=_0x137293['erlangAbandonmentRate'];_0x4c2693[_0xeabc('0x51')]=_0x137293[_0xeabc('0x51')];_0x4c2693[_0xeabc('0x52')]=_0x137293[_0xeabc('0x52')];_0x4c2693['startProgressive']=_0x137293[_0xeabc('0x53')];}if(_0x137293['Trunk']){_0x4c2693[_0xeabc('0x54')]={'id':_0x137293[_0xeabc('0x54')]['id'],'name':_0x137293[_0xeabc('0x54')][_0xeabc('0xb')],'active':_0x137293[_0xeabc('0x54')]['active'],'callerid':_0x137293['Trunk'][_0xeabc('0x55')]};}if(_0x137293['Interval']){_0x4c2693[_0xeabc('0x56')]={'id':_0x137293[_0xeabc('0x56')]['id'],'name':_0x137293['Interval'][_0xeabc('0xb')]};}_0x811f0d[_0xeabc('0x57')](_0x4c2693);}}_0x27dbaf({'count':_0x811f0d[_0xeabc('0x58')],'rows':_0x811f0d});});},'UpdateVoiceQueue':function(_0x353038){return new Promise(function(_0x4360d7,_0xcaa5b9){var _0x2003a7=_['find'](_0x5e9e2d[_0xeabc('0x23')],{'id':parseInt(_0x353038['id'])});var _0x2c85f0=_[_0xeabc('0x59')](_0x353038,['id']);if(_0x2003a7){for(var _0x1b41c8 in _0x2c85f0){if(typeof _0x2c85f0[_0x1b41c8]!==_0xeabc('0x5a')&&typeof _0x2003a7[_0x1b41c8]!==_0xeabc('0x5a')){_0x2003a7[_0x1b41c8]=_0x2c85f0[_0x1b41c8];}}_0x4360d7(_0x2003a7);}else{_0xcaa5b9();}});},'VoiceChannels':function(_0x2107d5){return new Promise(function(_0x20f004,_0x10d938){var _0x44e714=_['values'](_0x5e9e2d[_0xeabc('0x5b')]);_0x20f004({'count':_0x44e714[_0xeabc('0x58')],'rows':_0x44e714});});},'VoiceChannelMixMonitor':function(_0x41f5d7){var _0xec22ef=this;return new Promise(function(_0x34abdf,_0x26f829){if(ami[_0xeabc('0x13')]()==![]){return _0x26f829(_0xec22ef['error'](0x1f4,[config[_0xeabc('0x14')]['ip'],config[_0xeabc('0x14')][_0xeabc('0x15')],_0xeabc('0x16')][_0xeabc('0x1e')]('\x20')));}var _0x58e2c1=schema(properties[_0xeabc('0x5c')])[_0xeabc('0x3')](_0x41f5d7);if(_0x58e2c1[_0xeabc('0x58')]>0x0){return _0x26f829(_0xec22ef[_0xeabc('0x1d')](0x1f4,_['map'](_0x58e2c1,_0xeabc('0x1b'))[_0xeabc('0x1e')](',\x20')));}var _0x568847=_[_0xeabc('0x5d')](_0x5e9e2d['channels'],{'uniqueid':_0x41f5d7[_0xeabc('0x5e')]});if(_0x568847&&_0x568847['channel']){var _0x16ce77=util[_0xeabc('0x8')](_0xeabc('0x5f'),_0x41f5d7[_0xeabc('0x60')]||_0x41f5d7[_0xeabc('0x5e')],_0x41f5d7[_0xeabc('0x8')]||_0xeabc('0x61'));return ami[_0xeabc('0x21')]({'action':_0xeabc('0x62'),'channel':_0x568847[_0xeabc('0x63')],'file':_0x16ce77,'options':'ai(mixmonitorid)'})[_0xeabc('0x1a')](function(_0x2537ab){var _0x4072cb=_[_0xeabc('0x5d')](_0x568847['monitors'],{'filename':_0xeabc('0x64')+_0x16ce77[_0xeabc('0x65')]()});if(_[_0xeabc('0x66')](_0x4072cb)){_0x568847[_0xeabc('0x67')]['push']({'filename':_0xeabc('0x64')+_0x16ce77[_0xeabc('0x65')](),'createdAt':moment()[_0xeabc('0x8')](_0xeabc('0x68')),'mixmonitorid':_0x2537ab[_0xeabc('0x69')],'status':_0xeabc('0x6a')});}else{_0x4072cb[_0xeabc('0x69')]=_0x2537ab[_0xeabc('0x69')];_0x4072cb[_0xeabc('0x6b')]='rec';}_0x34abdf({'code':0xc8,'message':[_0x41f5d7[_0xeabc('0x5e')],'MixMonitor\x20Success',_0x2537ab['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x2537ab[_0xeabc('0x69')]});})[_0xeabc('0x1c')](function(_0x219ca8){_0x26f829(_0xec22ef[_0xeabc('0x1d')](0x1f5,[_0x41f5d7[_0xeabc('0x5e')],_0x219ca8[_0xeabc('0x1b')]['toLowerCase']()][_0xeabc('0x1e')]('\x20')));});}else{return _0x26f829(_0xec22ef[_0xeabc('0x1d')](0x1f5,_0xeabc('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x104c1e){var _0x2ddc53=this;return new Promise(function(_0x2c7b4e,_0x1750e9){if(ami[_0xeabc('0x13')]()==![]){return _0x1750e9(_0x2ddc53['error'](0x1f4,[config['asterisk']['ip'],config[_0xeabc('0x14')][_0xeabc('0x15')],_0xeabc('0x16')]['join']('\x20')));}var _0x287f88=schema(properties['voicechannel'])['validate'](_0x104c1e);if(_0x287f88[_0xeabc('0x58')]>0x0){return _0x1750e9(_0x2ddc53[_0xeabc('0x1d')](0x1f4,_[_0xeabc('0x6d')](_0x287f88,_0xeabc('0x1b'))[_0xeabc('0x1e')](',\x20')));}var _0xc2ef0c=_['find'](_0x5e9e2d[_0xeabc('0x5b')],{'uniqueid':_0x104c1e[_0xeabc('0x5e')]});if(_0xc2ef0c){return BPromise[_0xeabc('0x6e')]()[_0xeabc('0x1a')](function(){if(_0xc2ef0c[_0xeabc('0x63')]){return ami[_0xeabc('0x21')]({'action':'StopMixMonitor','channel':_0xc2ef0c[_0xeabc('0x63')],'mixmonitorid':_0x104c1e[_0xeabc('0x69')]})[_0xeabc('0x1c')](function(_0x165899){});}})[_0xeabc('0x1a')](function(){if(_0xc2ef0c[_0xeabc('0x6f')]){return ami[_0xeabc('0x21')]({'action':_0xeabc('0x70'),'channel':_0xc2ef0c[_0xeabc('0x6f')],'mixmonitorid':_0x104c1e['mixmonitorid']})[_0xeabc('0x1c')](function(_0x590439){});}})[_0xeabc('0x1a')](function(_0x2c389d){var _0x3fea99=_[_0xeabc('0x5d')](_0xc2ef0c[_0xeabc('0x67')],{'mixmonitorid':_0x104c1e[_0xeabc('0x69')]});if(_0x3fea99){_0x3fea99[_0xeabc('0x6b')]=_0xeabc('0x71');}})[_0xeabc('0x1a')](function(){var _0x24d0e5=util['format'](_0xeabc('0x5f'),_0x104c1e[_0xeabc('0x60')]||_0x104c1e[_0xeabc('0x5e')],_0x104c1e[_0xeabc('0x8')]||'wav');var _0x12fd48=_['find'](_0xc2ef0c['monitors'],{'filename':_0xeabc('0x64')+_0x24d0e5[_0xeabc('0x65')]()});if(_0x12fd48){_0x12fd48[_0xeabc('0x6b')]=_0xeabc('0x71');}})['then'](function(){_0x2c7b4e({'code':0xc8,'message':[_0x104c1e['uniqueid'],_0xeabc('0x72')]['join']('\x20')});})['catch'](function(_0x44c0a6){_0x1750e9(_0x2ddc53['error'](0x1f5,[_0x104c1e['uniqueid'],_0x44c0a6[_0xeabc('0x1b')][_0xeabc('0x65')]()]['join']('\x20')));});}else{return _0x1750e9(_0x2ddc53['error'](0x1f5,_0xeabc('0x6c')));}});},'VoiceQueuesChannels':function(_0x5d183a){return new Promise(function(_0x238e2d,_0x15ca17){var _0x4c84a9=_['values'](_0x5e9e2d[_0xeabc('0x73')]);_0x238e2d({'count':_0x4c84a9[_0xeabc('0x58')],'rows':_0x4c84a9});});},'VoiceQueuesChannel':function(_0xd86ea7){var _0x471cb6=this;return new Promise(function(_0x1debaa,_0x511b33){var _0x53f578=schema(properties[_0xeabc('0x74')])['validate'](_0xd86ea7);if(_0x53f578[_0xeabc('0x58')]>0x0){return _0x511b33(_0x471cb6['error'](0x1f4,_[_0xeabc('0x6d')](_0x53f578,'message')[_0xeabc('0x1e')](',\x20')));}var _0x53ac31=_[_0xeabc('0x5d')](_0x5e9e2d[_0xeabc('0x73')],{'uniqueid':_0xd86ea7[_0xeabc('0x5e')]});if(_0x53ac31){_0x1debaa(_0x53ac31);}else{return _0x511b33(_0x471cb6[_0xeabc('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x6ee7cf){var _0x4fa682=this;return new Promise(function(_0x26ff38,_0x3e87c3){if(ami[_0xeabc('0x13')]()==![]){return _0x3e87c3(_0x4fa682[_0xeabc('0x1d')](0x1f4,[config[_0xeabc('0x14')]['ip'],config['asterisk'][_0xeabc('0x15')],_0xeabc('0x16')][_0xeabc('0x1e')]('\x20')));}var _0x2509a4=schema(properties['voicequeuechannelhangup'])[_0xeabc('0x3')](_0x6ee7cf);if(_0x2509a4[_0xeabc('0x58')]>0x0){return _0x3e87c3(_0x4fa682[_0xeabc('0x1d')](0x1f4,_[_0xeabc('0x6d')](_0x2509a4,'message')[_0xeabc('0x1e')](',\x20')));}var _0x368cd4=_[_0xeabc('0x5d')](_0x5e9e2d[_0xeabc('0x73')],{'uniqueid':_0x6ee7cf['uniqueid']});if(_0x368cd4&&_0x368cd4['channel']){return ami[_0xeabc('0x21')]({'action':'Hangup','channel':_0x368cd4['channel']})[_0xeabc('0x1a')](function(_0x460f07){_0x26ff38({'code':0xc8,'message':[_0x6ee7cf[_0xeabc('0x5e')],_0x460f07['message'][_0xeabc('0x65')]()][_0xeabc('0x1e')]('\x20')});})['catch'](function(_0x3d1d12){_0x3e87c3(_0x4fa682[_0xeabc('0x1d')](0x1f5,[_0x6ee7cf[_0xeabc('0x5e')],_0x3d1d12[_0xeabc('0x1b')][_0xeabc('0x65')]()]['join']('\x20')));});}else{return _0x3e87c3(_0x4fa682[_0xeabc('0x1d')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x480c66){var _0x4c4b1e=this;return new Promise(function(_0x953553,_0x1c8a51){if(ami[_0xeabc('0x13')]()==![]){return _0x1c8a51(_0x4c4b1e[_0xeabc('0x1d')](0x1f4,[config[_0xeabc('0x14')]['ip'],config['asterisk'][_0xeabc('0x15')],'ami\x20disconnected'][_0xeabc('0x1e')]('\x20')));}var _0x2f95c7=schema(properties['voicequeuechannelredirect'])[_0xeabc('0x3')](_0x480c66);if(_0x2f95c7['length']>0x0){return _0x1c8a51(_0x4c4b1e['error'](0x1f4,_[_0xeabc('0x6d')](_0x2f95c7,_0xeabc('0x1b'))[_0xeabc('0x1e')](',\x20')));}var _0x3acb88=_[_0xeabc('0x5d')](_0x5e9e2d['queueChannels'],{'uniqueid':_0x480c66[_0xeabc('0x5e')]});if(_0x3acb88&&_0x3acb88[_0xeabc('0x63')]){return ami[_0xeabc('0x21')]({'action':_0xeabc('0x75'),'channel':_0x3acb88[_0xeabc('0x63')],'exten':_0x480c66[_0xeabc('0x76')],'context':_0x480c66[_0xeabc('0x77')]||_0x3acb88[_0xeabc('0x77')],'priority':0x1})[_0xeabc('0x1a')](function(_0x1921d5){_0x953553({'code':0xc8,'message':[_0x480c66['uniqueid'],_0x1921d5[_0xeabc('0x1b')][_0xeabc('0x65')]()][_0xeabc('0x1e')]('\x20')});})['catch'](function(_0x4bccf7){_0x1c8a51(_0x4c4b1e[_0xeabc('0x1d')](0x1f5,[_0x480c66[_0xeabc('0x5e')],_0x4bccf7[_0xeabc('0x1b')][_0xeabc('0x65')]()][_0xeabc('0x1e')]('\x20')));});}else{return _0x1c8a51(_0x4c4b1e['error'](0x1f5,_0xeabc('0x6c')));}});},'Agents':function(_0x538190){return new Promise(function(_0x5f39ef,_0x16ff81){var _0x302e94=_['values'](_0x5e9e2d[_0xeabc('0xf')]);_0x5f39ef({'count':_0x302e94[_0xeabc('0x58')],'rows':_0x302e94});});},'Telephones':function(_0x49a70a){return new Promise(function(_0x5963f7,_0xfaef39){var _0xb04677=_[_0xeabc('0x78')](_0x5e9e2d[_0xeabc('0x79')]);_0x5963f7({'count':_0xb04677[_0xeabc('0x58')],'rows':_0xb04677});});},'Trunks':function(_0x1b0995){return new Promise(function(_0x1f8197,_0x485c13){var _0xb54c35=_['values'](_0x5e9e2d[_0xeabc('0x7a')]);_0x1f8197({'count':_0xb54c35[_0xeabc('0x58')],'rows':_0xb54c35});});},'OutboundChannels':function(_0x204e39){return new Promise(function(_0x2d1441,_0x62cb8e){var _0x20c003=_[_0xeabc('0x78')](_0x5e9e2d[_0xeabc('0x7b')]);_0x2d1441({'count':_0x20c003[_0xeabc('0x58')],'rows':_0x20c003});});},'Outbound':function(_0x156e20){return new Promise(function(_0x42e92b,_0x5d471f){_0x42e92b(_0x5e9e2d[_0xeabc('0x7c')]);});},'Campaigns':function(_0x274ddc){return new Promise(function(_0x3a3967,_0x1e880e){var _0x5b00d6=_[_0xeabc('0x78')](_0x5e9e2d[_0xeabc('0x7d')]);_0x3a3967({'count':_0x5b00d6['length'],'rows':_0x5b00d6});});},'VoiceQueuesPreview':function(_0x3de927){var _0x22ef88=this;return new Promise(function(_0x5086e7,_0x507ac0){_0x54e4a8['run'](_0x3de927['id'])['then'](function(_0x2959e9){_0x5086e7({'code':0xc8,'message':_0x2959e9[_0xeabc('0x1b')]});})[_0xeabc('0x1c')](function(_0xe18bf1){_0x507ac0(_0x22ef88[_0xeabc('0x1d')](0x1f4,_0xe18bf1[_0xeabc('0x1b')]));});});},'EventManager':function(_0x3abe69){var _0x385ecf=this;return new Promise(function(_0x18c27f,_0x3eb795){if(!_0x3abe69['event']){return _0x3eb795(_0x385ecf[_0xeabc('0x1d')](0x1f4,_0xeabc('0x7e')));}ami['emit'](_0xeabc('0x7f')+_0x3abe69[_0xeabc('0x80')],_0x3abe69[_0xeabc('0x1b')]);_0x18c27f({'code':0xc8,'message':_0x3abe69});});},'FaxAccounts':function(_0x4c4ee3){return new Promise(function(_0x1f3198,_0x488120){var _0x425e5c=_[_0xeabc('0x78')](_0x5e9e2d[_0xeabc('0x81')]);_0x1f3198({'count':_0x425e5c[_0xeabc('0x58')],'rows':_0x425e5c});});},'SendFax':function(_0x1c52f7){var _0x5e7e00=this;return new Promise(function(_0x53a5bc,_0x5e9079){_0x1b07a8['send'](_0x1c52f7)[_0xeabc('0x1a')](function(_0x3c2725){_0x53a5bc({'code':0xc8,'message':_0x3c2725[_0xeabc('0x1b')]});})['catch'](function(_0x12f83f){_0x5e9079(_0x5e7e00[_0xeabc('0x1d')](0x1f4,_0x12f83f[_0xeabc('0x1b')]));});});},'CheckAfterSend':function(_0x36cc30){var _0x39964d=this;return new Promise(function(_0x646353,_0xdd956){_0x1b07a8[_0xeabc('0x82')](_0x36cc30)[_0xeabc('0x1a')](function(_0x391e67){_0x646353({'code':0xc8,'message':_0x391e67[_0xeabc('0x1b')]});})[_0xeabc('0x1c')](function(_0x5a1422){_0xdd956(_0x39964d['error'](0x1f4,_0x5a1422[_0xeabc('0x1b')]));});});}};var _0x50a5d5=jayson[_0xeabc('0x83')](_0x52ede8)[_0xeabc('0x84')]();_0x50a5d5['on'](_0xeabc('0x1d'),function(_0x56f622){return _0x229ba4(_0x56f622);});_0x50a5d5[_0xeabc('0x7')](0x232a,_0xeabc('0x85'),function(){console[_0xeabc('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x52a4d7('RPC\x20listening\x20on\x20port:'+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index db25659..d9b401c 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 _0xa28e=['lodash','bluebird','ioredis','util','trigger','../../rpc/cmContact','defaults','redis','socket.io-emitter','[CM][%s][%s]','exec','data1','data2','xmd-contactid','ListId','data3','split','map','routeId','destcalleridnum','calleridnum','firstName','phone','mobile','fax','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','merge'];(function(_0x20864d,_0xaf83b2){var _0x51858f=function(_0x3e25bd){while(--_0x3e25bd){_0x20864d['push'](_0x20864d['shift']());}};_0x51858f(++_0xaf83b2);}(_0xa28e,0x144));var _0xea28=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xa28e[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0xea28('0x0'));var BPromise=require(_0xea28('0x1'));var Redis=require(_0xea28('0x2'));var util=require(_0xea28('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xea28('0x4'));var cmContactRpc=require(_0xea28('0x5'));config['redis']=_[_0xea28('0x6')](config[_0xea28('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xea28('0x8'))(new Redis(config[_0xea28('0x7')]));function emit(_0x5a2aa1,_0x11601c,_0x3d9976,_0x3b0ce4,_0x59678a){logger['info'](_0xea28('0x9'),_0x5a2aa1,_0x11601c['id'],_0x3d9976,_0x3b0ce4,JSON['stringify'](_0x59678a));io['to'](_0x3d9976)['emit'](_0x3b0ce4,_0x59678a);}exports[_0xea28('0xa')]=function(_0x2858dc,_0xcfe19,_0x4b1bde,_0x250330){var _0x51cc9e,_0x4fd5e7;var _0x50ba2d={};var _0x2df04d=Number(_0x4b1bde[_0xea28('0xb')]);var _0x22f509=_0x4b1bde['data2']?Boolean(Number(_0x4b1bde[_0xea28('0xc')])):![];var _0x46b85f;if(_0x250330[_0xea28('0xd')]){_0x50ba2d['id']=_0x250330[_0xea28('0xd')];}if(!_0x50ba2d['id']){_0x50ba2d[_0xea28('0xe')]=_0x2df04d;_0x46b85f=_0x4b1bde[_0xea28('0xf')]&&_0x4b1bde[_0xea28('0xf')]!=='0'?_0x4b1bde['data3'][_0xea28('0x10')](','):['phone'];_0x50ba2d['$or']=_[_0xea28('0x11')](_0x46b85f,function(_0x101e4c){var _0x26b797={};_0x26b797[_0x101e4c]=_0x250330[_0xea28('0x12')]?_0x250330[_0xea28('0x13')]:_0x250330[_0xea28('0x14')];return _0x26b797;});}var _0xb0ece1=['id',_0xea28('0x15'),'lastName',_0xea28('0x16'),_0xea28('0x17'),_0xea28('0x18'),_0xea28('0xe'),'createdAt',_0xea28('0x19'),_0xea28('0x1a')];var _0x425e2e=_[_0xea28('0x1b')](_0xb0ece1,_0x46b85f);BPromise[_0xea28('0x1c')]()[_0xea28('0x1d')](cmContactRpc[_0xea28('0x1e')]({'attributes':_0x425e2e,'where':_0x50ba2d}))[_0xea28('0x1d')](function(_0x5cd10c){_0x4fd5e7=_0x5cd10c;if(!_[_0xea28('0x1f')](_0x4fd5e7)){if(_0x4fd5e7[_0xea28('0x20')]===0x1){_0x51cc9e=_0x4fd5e7[0x0];logger[_0xea28('0x21')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x250330['uniqueid'],_0xcfe19['id'],_0x51cc9e['id']);}else{logger['info'](_0xea28('0x22'),_0x250330[_0xea28('0x23')],_0xcfe19['id'],_['map'](_0x4fd5e7,'id')[_0xea28('0x24')](','));}return;}else{logger[_0xea28('0x21')](_0xea28('0x25'),_0x250330[_0xea28('0x23')],_0xcfe19['id']);var _0xfb9f18={'ListId':_0x2df04d};var _0x13a150=_0x4b1bde[_0xea28('0x26')]&&_0x4b1bde[_0xea28('0x26')]!=='0'?_0x4b1bde['data4']:_0xea28('0x16');if(_0x22f509){logger[_0xea28('0x21')](_0xea28('0x27'),_0x250330['uniqueid'],_0xcfe19['id']);_0xfb9f18[_0x13a150]=_[_0xea28('0x28')](_0x250330['routeId'])?_0x250330[_0xea28('0x14')]:_0x250330['destcalleridnum'];if(_[_0xea28('0x28')](_0x250330['routeId'])){_0xfb9f18[_0xea28('0x15')]=_0x250330[_0xea28('0x29')]&&_0x250330[_0xea28('0x29')]!==_0xea28('0x2a')?_0x250330[_0xea28('0x29')]:_0xea28('0x2b');}else{_0xfb9f18[_0xea28('0x15')]=_0x250330[_0xea28('0x2c')]&&_0x250330[_0xea28('0x2c')]!==_0xea28('0x2a')?_0x250330[_0xea28('0x2c')]:_0xea28('0x2b');}return BPromise[_0xea28('0x1c')]()[_0xea28('0x1d')](cmContactRpc['createContact'](_0xfb9f18))[_0xea28('0x1d')](function(_0x15bc3e){_0x51cc9e=_0x15bc3e;_0x4fd5e7[_0xea28('0x2d')](_0x15bc3e);if(_0x51cc9e){logger[_0xea28('0x21')](_0xea28('0x2e'),_0x250330['uniqueid'],_0xcfe19['id'],_0x51cc9e['id']);}return;});}else{logger[_0xea28('0x21')](_0xea28('0x2f'),_0x250330[_0xea28('0x23')],_0xcfe19['id']);_0xfb9f18[_0x13a150]=_['isNil'](_0x250330[_0xea28('0x12')])?_0x250330[_0xea28('0x14')]:_0x250330[_0xea28('0x13')];if(_[_0xea28('0x28')](_0x250330[_0xea28('0x12')])){_0xfb9f18[_0xea28('0x15')]=_0x250330['calleridname']&&_0x250330['calleridname']!==_0xea28('0x2a')?_0x250330[_0xea28('0x29')]:'Unknown';}else{_0xfb9f18[_0xea28('0x15')]=_0x250330['destcalleridname']&&_0x250330[_0xea28('0x2c')]!==_0xea28('0x2a')?_0x250330['destcalleridname']:_0xea28('0x2b');}_0x51cc9e=_0xfb9f18;_0x4fd5e7[_0xea28('0x2d')](_0xfb9f18);return;}}})[_0xea28('0x1d')](function(){if(_0x2858dc){emit(_0x250330[_0xea28('0x23')],_0xcfe19,util[_0xea28('0x30')](_0xea28('0x31'),_0x2858dc[_0xea28('0x32')]),util[_0xea28('0x30')](_0xea28('0x33'),_0x4b1bde[_0xea28('0x34')]['toLowerCase']()),{'evt':_[_0xea28('0x35')](_0x250330,{'autoCreate':_0x22f509}),'contact':_0x51cc9e===undefined?{}:_0x51cc9e,'contacts':_0x4fd5e7[_0xea28('0x20')]===0x0?undefined:_0x4fd5e7});}});}; \ No newline at end of file +var _0x4e20=['util','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','xmd-contactid','data3','phone','map','routeId','calleridnum','lastName','mobile','fax','ListId','createdAt','scheduledAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','destcalleridnum','firstName','calleridname','destcalleridname','','Unknown','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','isNil','push','format','user:%s','name','trigger:%s','toLowerCase','bluebird'];(function(_0x5421f9,_0x287da5){var _0x109d9b=function(_0xedc33f){while(--_0xedc33f){_0x5421f9['push'](_0x5421f9['shift']());}};_0x109d9b(++_0x287da5);}(_0x4e20,0xd7));var _0x04e2=function(_0x695b76,_0x551526){_0x695b76=_0x695b76-0x0;var _0x1dc21f=_0x4e20[_0x695b76];return _0x1dc21f;};'use strict';var _=require('lodash');var BPromise=require(_0x04e2('0x0'));var Redis=require('ioredis');var util=require(_0x04e2('0x1'));var config=require('../../../../config/environment');var logger=require(_0x04e2('0x2'))(_0x04e2('0x3'));var cmContactRpc=require(_0x04e2('0x4'));config[_0x04e2('0x5')]=_['defaults'](config['redis'],{'host':_0x04e2('0x6'),'port':0x18eb});var io=require(_0x04e2('0x7'))(new Redis(config[_0x04e2('0x5')]));function emit(_0xfd815d,_0x37c0ae,_0x5e9d67,_0x86790b,_0x56ac0b){logger[_0x04e2('0x8')](_0x04e2('0x9'),_0xfd815d,_0x37c0ae['id'],_0x5e9d67,_0x86790b,JSON['stringify'](_0x56ac0b));io['to'](_0x5e9d67)[_0x04e2('0xa')](_0x86790b,_0x56ac0b);}exports[_0x04e2('0xb')]=function(_0x6e7a88,_0x522b1d,_0x56c604,_0x40bc3e){var _0x19ddde,_0x5424b8;var _0x5e1325={};var _0x5f2ed1=Number(_0x56c604[_0x04e2('0xc')]);var _0x54131b=_0x56c604[_0x04e2('0xd')]?Boolean(Number(_0x56c604['data2'])):![];var _0x264e26;if(_0x40bc3e[_0x04e2('0xe')]){_0x5e1325['id']=_0x40bc3e[_0x04e2('0xe')];}if(!_0x5e1325['id']){_0x5e1325['ListId']=_0x5f2ed1;_0x264e26=_0x56c604[_0x04e2('0xf')]&&_0x56c604['data3']!=='0'?_0x56c604[_0x04e2('0xf')]['split'](','):[_0x04e2('0x10')];_0x5e1325['$or']=_[_0x04e2('0x11')](_0x264e26,function(_0x35e6dd){var _0xbf932f={};_0xbf932f[_0x35e6dd]=_0x40bc3e[_0x04e2('0x12')]?_0x40bc3e['destcalleridnum']:_0x40bc3e[_0x04e2('0x13')];return _0xbf932f;});}var _0x40512d=['id','firstName',_0x04e2('0x14'),'phone',_0x04e2('0x15'),_0x04e2('0x16'),_0x04e2('0x17'),_0x04e2('0x18'),_0x04e2('0x19'),'updatedAt'];var _0x4363a1=_[_0x04e2('0x1a')](_0x40512d,_0x264e26);BPromise[_0x04e2('0x1b')]()[_0x04e2('0x1c')](cmContactRpc[_0x04e2('0x1d')]({'attributes':_0x4363a1,'where':_0x5e1325}))[_0x04e2('0x1c')](function(_0x157d1a){_0x5424b8=_0x157d1a;if(!_[_0x04e2('0x1e')](_0x5424b8)){if(_0x5424b8[_0x04e2('0x1f')]===0x1){_0x19ddde=_0x5424b8[0x0];logger[_0x04e2('0x8')](_0x04e2('0x20'),_0x40bc3e['uniqueid'],_0x522b1d['id'],_0x19ddde['id']);}else{logger['info'](_0x04e2('0x21'),_0x40bc3e[_0x04e2('0x22')],_0x522b1d['id'],_[_0x04e2('0x11')](_0x5424b8,'id')[_0x04e2('0x23')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x40bc3e[_0x04e2('0x22')],_0x522b1d['id']);var _0x391bc2={'ListId':_0x5f2ed1};var _0x4c576c=_0x56c604[_0x04e2('0x24')]&&_0x56c604[_0x04e2('0x24')]!=='0'?_0x56c604[_0x04e2('0x24')]:_0x04e2('0x10');if(_0x54131b){logger[_0x04e2('0x8')](_0x04e2('0x25'),_0x40bc3e[_0x04e2('0x22')],_0x522b1d['id']);_0x391bc2[_0x4c576c]=_['isNil'](_0x40bc3e[_0x04e2('0x12')])?_0x40bc3e['calleridnum']:_0x40bc3e[_0x04e2('0x26')];if(_['isNil'](_0x40bc3e['routeId'])){_0x391bc2[_0x04e2('0x27')]=_0x40bc3e[_0x04e2('0x28')]&&_0x40bc3e['calleridname']!==''?_0x40bc3e['calleridname']:'Unknown';}else{_0x391bc2[_0x04e2('0x27')]=_0x40bc3e[_0x04e2('0x29')]&&_0x40bc3e[_0x04e2('0x29')]!==_0x04e2('0x2a')?_0x40bc3e[_0x04e2('0x29')]:_0x04e2('0x2b');}return BPromise[_0x04e2('0x1b')]()[_0x04e2('0x1c')](cmContactRpc[_0x04e2('0x2c')](_0x391bc2))[_0x04e2('0x1c')](function(_0xf7ce4){_0x19ddde=_0xf7ce4;_0x5424b8['push'](_0xf7ce4);if(_0x19ddde){logger['info'](_0x04e2('0x2d'),_0x40bc3e[_0x04e2('0x22')],_0x522b1d['id'],_0x19ddde['id']);}return;});}else{logger[_0x04e2('0x8')](_0x04e2('0x2e'),_0x40bc3e[_0x04e2('0x22')],_0x522b1d['id']);_0x391bc2[_0x4c576c]=_['isNil'](_0x40bc3e['routeId'])?_0x40bc3e[_0x04e2('0x13')]:_0x40bc3e['destcalleridnum'];if(_[_0x04e2('0x2f')](_0x40bc3e[_0x04e2('0x12')])){_0x391bc2[_0x04e2('0x27')]=_0x40bc3e[_0x04e2('0x28')]&&_0x40bc3e[_0x04e2('0x28')]!==''?_0x40bc3e[_0x04e2('0x28')]:_0x04e2('0x2b');}else{_0x391bc2['firstName']=_0x40bc3e[_0x04e2('0x29')]&&_0x40bc3e['destcalleridname']!==''?_0x40bc3e[_0x04e2('0x29')]:_0x04e2('0x2b');}_0x19ddde=_0x391bc2;_0x5424b8[_0x04e2('0x30')](_0x391bc2);return;}}})[_0x04e2('0x1c')](function(){if(_0x6e7a88){emit(_0x40bc3e[_0x04e2('0x22')],_0x522b1d,util[_0x04e2('0x31')](_0x04e2('0x32'),_0x6e7a88[_0x04e2('0x33')]),util[_0x04e2('0x31')](_0x04e2('0x34'),_0x56c604['action'][_0x04e2('0x35')]()),{'evt':_['merge'](_0x40bc3e,{'autoCreate':_0x54131b}),'contact':_0x19ddde===undefined?{}:_0x19ddde,'contacts':_0x5424b8[_0x04e2('0x1f')]===0x0?undefined:_0x5424b8});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 91cc19a..5fac6d0 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 _0xdf8f=['event','queue','agent','membername','lastevent','exports','util','url','mustache','ioredis','./urlforward','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','redis','localhost','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','freshsalesAccounts','accounts','servicenowAccounts','custom:agentcalled','custom:agentconnect','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:timeout','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','stringify','emit','prototype','clone','interface','checkTriggers','status','checkTrigger','merge','variables','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','data2','html','render','uri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','winArguments','format','user:%s','name','trigger:%s:%s','jscripty','trigger:%s','exec','integration','routeId','buildUri','parse','query','search','replace','AllConditions','every','checkConditions','AnyConditions','channel','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','message'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0xdf8f,0x1ce));var _0xfdf8=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xdf8f[_0x1cc8fe];return _0x230054;};'use strict';var util=require(_0xfdf8('0x0'));var _=require('lodash');var url=require(_0xfdf8('0x1'));var Mustache=require(_0xfdf8('0x2'));var Redis=require(_0xfdf8('0x3'));var urlforward=require(_0xfdf8('0x4'));var integration=require('./integration');var cmContact=require('./cmContact');var script=require(_0xfdf8('0x5'));var config=require(_0xfdf8('0x6'));var logger=require(_0xfdf8('0x7'))(_0xfdf8('0x8'));var ami=require(_0xfdf8('0x9'));config['redis']=_[_0xfdf8('0xa')](config[_0xfdf8('0xb')],{'host':_0xfdf8('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfdf8('0xb')]));var operators={'equals':function(_0x29efa3,_0x36ddcf){return _0x29efa3==_0x36ddcf;},'not_equals':function(_0x1231ec,_0x48ad8d){return _0x1231ec!=_0x48ad8d;}};var barAndWebActions=['popup','url',_0xfdf8('0xd')];function Trigger(_0x2e169b){this[_0xfdf8('0xe')]=_0x2e169b[_0xfdf8('0xe')];this[_0xfdf8('0xf')]=_0x2e169b[_0xfdf8('0xf')];this[_0xfdf8('0x10')]=_0x2e169b[_0xfdf8('0x10')];this['templates']=_0x2e169b[_0xfdf8('0x11')];this['voiceExtensions']=_0x2e169b[_0xfdf8('0x12')];this[_0xfdf8('0x13')]=_0x2e169b[_0xfdf8('0x13')];this['freshdeskAccounts']=_0x2e169b[_0xfdf8('0x14')];this[_0xfdf8('0x15')]=_0x2e169b[_0xfdf8('0x15')];this[_0xfdf8('0x16')]=_0x2e169b[_0xfdf8('0x16')];this[_0xfdf8('0x17')]=_0x2e169b[_0xfdf8('0x17')];this[_0xfdf8('0x18')]=_0x2e169b[_0xfdf8('0x18')];this['vtigerAccounts']=_0x2e169b[_0xfdf8('0x19')];this['servicenowAccounts']=_0x2e169b['servicenowAccounts'];this[_0xfdf8('0x1a')]=_0x2e169b[_0xfdf8('0x1a')];this[_0xfdf8('0x1b')]=_0x2e169b[_0xfdf8('0x1b')];this[_0xfdf8('0x1c')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0xfdf8('0x16')],'zoho':this[_0xfdf8('0x17')],'desk':this['deskAccounts'],'vtiger':this[_0xfdf8('0x19')],'dynamics365':this[_0xfdf8('0x1a')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0xfdf8('0x1d')]};ami['on'](_0xfdf8('0x1e'),this['syncCustomEvent']['bind'](this));ami['on'](_0xfdf8('0x1f'),this[_0xfdf8('0x20')][_0xfdf8('0x21')](this));ami['on'](_0xfdf8('0x22'),this[_0xfdf8('0x20')][_0xfdf8('0x21')](this));ami['on'](_0xfdf8('0x23'),this['syncCustomEvent'][_0xfdf8('0x21')](this));ami['on'](_0xfdf8('0x24'),this[_0xfdf8('0x20')][_0xfdf8('0x21')](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0xfdf8('0x21')](this));ami['on'](_0xfdf8('0x25'),this['syncCustomEvent'][_0xfdf8('0x21')](this));ami['on'](_0xfdf8('0x26'),this[_0xfdf8('0x20')][_0xfdf8('0x21')](this));ami['on'](_0xfdf8('0x27'),this[_0xfdf8('0x20')][_0xfdf8('0x21')](this));ami['on']('custom:amd',this[_0xfdf8('0x20')][_0xfdf8('0x21')](this));ami['on']('custom:queuecallerabandon',this[_0xfdf8('0x20')]['bind'](this));ami['on'](_0xfdf8('0x28'),this[_0xfdf8('0x20')]['bind'](this));ami['on']('custom:dialbegin',this[_0xfdf8('0x29')][_0xfdf8('0x21')](this));ami['on'](_0xfdf8('0x2a'),this[_0xfdf8('0x29')][_0xfdf8('0x21')](this));ami['on'](_0xfdf8('0x2b'),this['syncAgentDial'][_0xfdf8('0x21')](this));ami['on'](_0xfdf8('0x2c'),this[_0xfdf8('0x20')][_0xfdf8('0x21')](this));ami['on'](_0xfdf8('0x2d'),this['syncCustomEvent'][_0xfdf8('0x21')](this));ami['on'](_0xfdf8('0x2e'),this[_0xfdf8('0x20')]['bind'](this));ami['on'](_0xfdf8('0x2f'),this['syncCustomEvent'][_0xfdf8('0x21')](this));ami['on']('custom:acceptmessage',this[_0xfdf8('0x20')][_0xfdf8('0x21')](this));ami['on']('custom:rejectmessage',this[_0xfdf8('0x20')][_0xfdf8('0x21')](this));}Trigger['prototype']['emit']=function(_0x7e72e,_0x38d1b5,_0x343374){logger['info'](_0x7e72e,_0x38d1b5,JSON[_0xfdf8('0x30')](_0x343374));io['to'](_0x7e72e)[_0xfdf8('0x31')](_0x38d1b5,_0x343374);};Trigger[_0xfdf8('0x32')][_0xfdf8('0x20')]=function(_0x442aae){var _0x35a7cd=_[_0xfdf8('0x33')](_0x442aae);this['checkTriggers'](_0x35a7cd);};Trigger[_0xfdf8('0x32')][_0xfdf8('0x29')]=function(_0x569f73){if(this[_0xfdf8('0xf')][_0x569f73[_0xfdf8('0x34')]]){this[_0xfdf8('0x20')](_0x569f73);}};Trigger['prototype'][_0xfdf8('0x35')]=function(_0x455f0f){var _0x43fdd5;for(var _0xf72d83 in this['triggers']){if(this[_0xfdf8('0xe')]['hasOwnProperty'](_0xf72d83)){if(this['triggers'][_0xf72d83][_0xfdf8('0x36')]){_0x43fdd5=this[_0xfdf8('0x37')](this[_0xfdf8('0xe')][_0xf72d83],_0x455f0f);if(_0x43fdd5){_[_0xfdf8('0x38')](_0x455f0f,_0x455f0f[_0xfdf8('0x39')]);for(var _0x5a6a4e=0x0,_0x3db248,_0x5a08e4,_0x527061;_0x5a6a4e0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0xbd9b77,_0x5a85db){var _0x3cf9ce=function(_0x18f419){while(--_0x18f419){_0xbd9b77['push'](_0xbd9b77['shift']());}};_0x3cf9ce(++_0x5a85db);}(_0x3e74,0x175));var _0x43e7=function(_0x51e60d,_0x55807e){_0x51e60d=_0x51e60d-0x0;var _0x210da2=_0x3e74[_0x51e60d];return _0x210da2;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ 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 bb2fc34..c36ac62 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 _0x491d=['queue','callDirection','Fields','ticketId','message','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','POST','clientId','username','clientSecret','then','access_token','error','toUpperCase','Bearer\x20','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','catch','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','4.0','headers','odata-entityid','substring','lastIndexOf','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','enduserId','contactid',']\x20Enduser\x20Created!','forEach','string','picklist','type','nameField','idField','indexOf','content','ticketType','incidents','assign','Subjects','getString','Descriptions','phonecall','phonecalls','/contacts(','/systemusers('];(function(_0x124174,_0x590fad){var _0x16bbf8=function(_0x292ad9){while(--_0x292ad9){_0x124174['push'](_0x124174['shift']());}};_0x16bbf8(++_0x590fad);}(_0x491d,0xe6));var _0xd491=function(_0x49f124,_0xb0880f){_0x49f124=_0x49f124-0x0;var _0x54a4dd=_0x491d[_0x49f124];return _0x54a4dd;};'use strict';var _=require(_0xd491('0x0'));var BPromise=require(_0xd491('0x1'));var rp=require(_0xd491('0x2'));var util=require(_0xd491('0x3'));var intUtil=require(_0xd491('0x4'));var md5=require('md5');var Redis=require(_0xd491('0x5'));var logger=require(_0xd491('0x6'))(_0xd491('0x7'));var config=require(_0xd491('0x8'));config[_0xd491('0x9')]=_[_0xd491('0xa')](config['redis'],{'host':_0xd491('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd491('0x9')]));function getAuthToken(_0x501cf9,_0x1dd555,_0x4a014e){var _0x5539e9={'method':_0xd491('0xc'),'uri':_0x1dd555,'form':{'client_id':_0x501cf9[_0xd491('0xd')],'resource':_0x501cf9['remoteUri'],'username':_0x501cf9[_0xd491('0xe')],'password':_0x501cf9['password'],'grant_type':'password','client_secret':_0x501cf9[_0xd491('0xf')]},'json':!![]};return rp(_0x5539e9)[_0xd491('0x10')](function(_0x2bfb4d){return _0x2bfb4d[_0xd491('0x11')];})['catch'](function(_0x579c67){logger[_0xd491('0x12')]('['+[_0x4a014e[_0xd491('0x13')]()]+']\x20Wrong\x20credentials!');return _0x579c67['message'];});}function getUser(_0x210ec6,_0x5bf73b,_0x2f0b9d,_0x1d5604,_0x23889f,_0x420e1d){return new BPromise(function(_0xe20fb,_0x57cb0d){return getAuthToken(_0x5bf73b,_0x1d5604,_0x420e1d)[_0xd491('0x10')](function(_0x8101a6){var _0x49b919={'method':'GET','uri':_0x23889f+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xd491('0x14')+_0x8101a6,'OData-Version':'4.0'},'json':!![]};return rp(_0x49b919);})[_0xd491('0x10')](function(_0x984030){var _0x310677=_0x984030[_0xd491('0x15')];var _0x3e16d8=![];var _0x1a0ac8=null;if(!_[_0xd491('0x16')](_0x2f0b9d)){if(intUtil[_0xd491('0x17')](_0x2f0b9d[_0xd491('0x18')])){_0x210ec6[_0xd491('0x19')]=_0x2f0b9d[_0xd491('0x18')];for(_0x1a0ac8=0x0;_0x1a0ac8<_0x310677[_0xd491('0x1a')];_0x1a0ac8++){if(_0x310677[_0x1a0ac8][_0xd491('0x1b')]===_0x2f0b9d[_0xd491('0x18')]&&!_0x310677[_0x1a0ac8]['isdisabled']){_0x3e16d8=!![];logger[_0xd491('0x1c')]('['+[_0x420e1d[_0xd491('0x13')]()]+_0xd491('0x1d')+_0x310677[_0x1a0ac8][_0xd491('0x1e')]+'!');_0x210ec6[_0xd491('0x1f')]=_0x310677[_0x1a0ac8][_0xd491('0x1e')];}}}}if(!_0x3e16d8){logger[_0xd491('0x1c')]('['+[_0x420e1d[_0xd491('0x13')]()]+_0xd491('0x20'));_0x210ec6[_0xd491('0x19')]=_0x5bf73b[_0xd491('0xe')];for(_0x1a0ac8=0x0;_0x1a0ac8<_0x310677[_0xd491('0x1a')];_0x1a0ac8++){if(_0x310677[_0x1a0ac8]['internalemailaddress']===_0x5bf73b[_0xd491('0xe')]){_0x210ec6['userId']=_0x310677[_0x1a0ac8][_0xd491('0x1e')];}}}_0xe20fb(_0x210ec6);})[_0xd491('0x21')](function(_0x2613d9){_0x57cb0d(_0x2613d9['message']);});});}function createEndUser(_0xf79c36,_0x1c7d54,_0x384725,_0x32356a,_0x4cb75a,_0x3adb4a){return new BPromise(function(_0x28ca3d,_0x2c7e43){return getAuthToken(_0x1c7d54,_0x384725,_0x3adb4a)[_0xd491('0x10')](function(_0x582967){var _0x44643d=_0x3adb4a[_0xd491('0x22')]()===_0xd491('0x23')?_0x4cb75a[_0xd491('0x24')]:_0x4cb75a[_0xd491('0x25')];var _0x49b0d7={'method':_0xd491('0xc'),'uri':_0x32356a+_0xd491('0x26'),'body':{'telephone1':_0x44643d,'fullname':_0x44643d,'firstname':_0x44643d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0xf79c36[_0xd491('0x1f')]+')'},'headers':{'Authorization':_0xd491('0x14')+_0x582967,'OData-Version':_0xd491('0x27')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x49b0d7);})[_0xd491('0x10')](function(_0x425251){var _0x26f063=_0x425251[_0xd491('0x28')][_0xd491('0x29')];var _0x2098cf=_0x26f063[_0xd491('0x2a')](_0x26f063[_0xd491('0x2b')]('(')+0x1,_0x26f063[_0xd491('0x2b')](')'));_0xf79c36['enduserId']=_0x2098cf;_0x28ca3d(_0xf79c36);})[_0xd491('0x21')](function(_0x271585){_0x2c7e43(_0x271585['message']);});});}function getEndUser(_0x1a6685,_0x47e9e6,_0x4ed5ae,_0x44b746,_0x2f08f1,_0x140aef){return new BPromise(function(_0x42f8ac,_0x175a26){var _0x3fa063=_0x140aef[_0xd491('0x22')]()===_0xd491('0x23')?_0x2f08f1[_0xd491('0x24')]:_0x2f08f1['calleridnum'];return getAuthToken(_0x47e9e6,_0x4ed5ae,_0x140aef)[_0xd491('0x10')](function(_0x7745f9){var _0xf70d89={'method':_0xd491('0x2c'),'uri':_0x44b746+_0xd491('0x2d')+_0x3fa063[_0xd491('0x2e')]('+',_0xd491('0x2f'))+'\x27','headers':{'Authorization':_0xd491('0x14')+_0x7745f9,'If-None-Match':null,'OData-Version':_0xd491('0x27')},'json':!![]};return rp(_0xf70d89);})[_0xd491('0x10')](function(_0x2f1955){var _0x1db318=null;if(_0x2f1955){var _0x3a89d7=_0x2f1955['value'];var _0x10f9cf=![];for(_0x1db318=0x0;_0x1db318<_0x3a89d7['length'];_0x1db318++){if(_0x3a89d7[_0x1db318][_0xd491('0x30')]===_0x3fa063){_0x10f9cf=!![];_0x1a6685[_0xd491('0x31')]=_0x3a89d7[_0x1db318][_0xd491('0x32')];}}if(_0x10f9cf){_0x42f8ac(_0x1a6685);}else{return createEndUser(_0x1a6685,_0x47e9e6,_0x4ed5ae,_0x44b746,_0x2f08f1,_0x140aef)[_0xd491('0x10')](function(_0x5d5933){logger[_0xd491('0x1c')]('['+[_0x140aef['toUpperCase']()]+']\x20Enduser\x20created!',_0x5d5933[_0xd491('0x31')]);_0x42f8ac(_0x5d5933);});}}else{return createEndUser(_0x1a6685,_0x47e9e6,_0x4ed5ae,_0x44b746,_0x2f08f1,_0x140aef)[_0xd491('0x10')](function(_0x2fdae4){logger[_0xd491('0x1c')]('['+[_0x140aef[_0xd491('0x13')]()]+_0xd491('0x33'),_0x2fdae4[_0xd491('0x31')]);_0x42f8ac(_0x2fdae4);});}});});}function getCustomFields(_0x2d59e0,_0x59f802,_0x11ff4a){var _0x1574af={};if(_0x2d59e0['length']>0x0){_[_0xd491('0x34')](_0x2d59e0,function(_0x25280f){if(_['includes']([_0xd491('0x35'),_0xd491('0x36')],_0x25280f[_0xd491('0x37')])&&_0x25280f[_0xd491('0x38')]&&!_0x25280f['customField']){var _0x580c4b=_0x25280f[_0xd491('0x39')][_0xd491('0x22')]();var _0x8f341d=_0x580c4b[_0xd491('0x2a')](0x0,_0x580c4b['indexOf']('_'));var _0x32489f=_0x580c4b['substring'](_0x580c4b[_0xd491('0x3a')]('_')+0x1);if(_0x8f341d===_0x11ff4a){_0x1574af[_0x32489f]=_0x25280f[_0xd491('0x3b')];}}});}return _0x1574af;}function getTicket(_0x1d79a4,_0x3c91f1,_0x2c6fa5,_0x1ee620,_0x36ee14,_0x1fdcab,_0x1b2ee7){return new BPromise(function(_0x300ec1,_0x3cf780){var _0x580576;return getAuthToken(_0x3c91f1,_0x2c6fa5,_0x1b2ee7)[_0xd491('0x10')](function(_0x4c63cb){if(_0x1fdcab[_0xd491('0x3c')]==='incident'){_0x580576={'method':'POST','uri':_0x1ee620+_0xd491('0x3d'),'body':Object[_0xd491('0x3e')]({},{'title':intUtil['getString'](_0x1fdcab[_0xd491('0x3f')],_0x36ee14,'\x20'),'description':intUtil[_0xd491('0x40')](_0x1fdcab[_0xd491('0x41')],_0x36ee14,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x1d79a4[_0xd491('0x31')]+')','ownerid@odata.bind':'/systemusers('+_0x1d79a4[_0xd491('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0x1fdcab['Fields'],_0x36ee14,_0x1fdcab[_0xd491('0x3c')])),'headers':{'Authorization':'Bearer\x20'+_0x4c63cb,'OData-Version':_0xd491('0x27')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1fdcab[_0xd491('0x3c')]===_0xd491('0x42')){_0x580576={'method':_0xd491('0xc'),'uri':_0x1ee620+_0xd491('0x43'),'body':Object[_0xd491('0x3e')]({},{'subject':intUtil[_0xd491('0x40')](_0x1fdcab[_0xd491('0x3f')],_0x36ee14,'\x20'),'phonenumber':String(_0x36ee14[_0xd491('0x25')]),'description':intUtil[_0xd491('0x40')](_0x1fdcab['Descriptions'],_0x36ee14,'\x0a'),'regardingobjectid_contact@odata.bind':_0xd491('0x44')+_0x1d79a4[_0xd491('0x31')]+')','ownerid@odata.bind':_0xd491('0x45')+_0x1d79a4[_0xd491('0x1f')]+')','directioncode':_0x1d79a4['callDirection']===_0xd491('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xd491('0x45')+_0x1d79a4[_0xd491('0x1f')]+')','participationtypemask':_0x1d79a4[_0xd491('0x47')]===_0xd491('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0xd491('0x44')+_0x1d79a4['enduserId']+')','participationtypemask':_0x1d79a4[_0xd491('0x47')]===_0xd491('0x46')?0x1:0x2}]},getCustomFields(_0x1fdcab[_0xd491('0x48')],_0x36ee14,_0x1fdcab[_0xd491('0x3c')])),'headers':{'Authorization':_0xd491('0x14')+_0x4c63cb,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x580576);})[_0xd491('0x10')](function(_0x339f9b){var _0x42c997=_0x339f9b[_0xd491('0x28')][_0xd491('0x29')];var _0x4ae7e9=_0x42c997[_0xd491('0x2a')](_0x42c997[_0xd491('0x2b')]('(')+0x1,_0x42c997[_0xd491('0x2b')](')'));_0x1d79a4[_0xd491('0x49')]=_0x4ae7e9;_0x300ec1(_0x1d79a4);})[_0xd491('0x21')](function(_0x3f2e26){_0x3cf780(_0x3f2e26[_0xd491('0x4a')]);});});}function emit(_0x542c4b,_0x425541,_0x5146bc,_0x59c7a3){var _0x31ea72={'uri':util['format'](_0xd491('0x4b'),_0x542c4b,_0x5146bc,_0x59c7a3)};io['to'](util[_0xd491('0x4c')]('user:%s',_0x425541))['emit'](_0xd491('0x4d'),_0x31ea72);}exports['cs']=function(_0x366948,_0x2d2302,_0x51f209,_0x484532,_0x5e4ebe,_0x1aaf7b,_0x10cc32,_0x4751a0){var _0x279948={};_0x1aaf7b[_0xd491('0x4e')]=intUtil[_0xd491('0x4f')](_0x1aaf7b[_0xd491('0x4e')]);_0x1aaf7b[_0xd491('0x50')]=intUtil[_0xd491('0x4f')](_0x1aaf7b[_0xd491('0x50')]);_0x279948[_0xd491('0x47')]=_0x4751a0==='queue'||_0x4751a0===_0xd491('0x51')?_0xd491('0x46'):'outbound';var _0x5e3f1f=util[_0xd491('0x4c')](_0xd491('0x52'),_0x1aaf7b[_0xd491('0x4e')]);var _0x409ddb=util[_0xd491('0x4c')](_0xd491('0x53'),_0x1aaf7b[_0xd491('0x54')]);var _0x13d235=util[_0xd491('0x4c')](_0xd491('0x55'),_0x1aaf7b[_0xd491('0x50')],_0x2d2302[_0xd491('0x56')],md5(_0x2d2302['uniqueid']));if(_0x5e4ebe&&_0x5e4ebe[_0xd491('0x57')]){logger['info'](_0xd491('0x58'),_0xd491('0x59'));_0x2d2302[_0xd491('0x5a')]=_0x13d235;}else if(_0x10cc32&&_0x10cc32[_0xd491('0x5b')]&&_0x10cc32[_0xd491('0x5b')]!==_0xd491('0x5c')){logger[_0xd491('0x1c')](_0xd491('0x5d'),_0xd491('0x59'));_0x2d2302[_0xd491('0x5a')]=_0x13d235;}else{_0x2d2302[_0xd491('0x5a')]='';}return getUser(_0x279948,_0x1aaf7b,_0x484532,_0x409ddb,_0x5e3f1f,_0x4751a0)[_0xd491('0x10')](function(_0x3f1506){logger['info']('['+_0x4751a0[_0xd491('0x13')]()+_0xd491('0x5e'),_0x3f1506[_0xd491('0x1f')]);logger[_0xd491('0x1c')]('['+_0x4751a0[_0xd491('0x13')]()+_0xd491('0x5f'),_0x3f1506[_0xd491('0x19')]);return getEndUser(_0x3f1506,_0x1aaf7b,_0x409ddb,_0x5e3f1f,_0x2d2302,_0x4751a0);})[_0xd491('0x10')](function(_0x84172e){logger[_0xd491('0x1c')]('['+_0x4751a0['toUpperCase']()+_0xd491('0x60'),_0x84172e[_0xd491('0x31')]);logger[_0xd491('0x1c')]('['+_0x4751a0['toUpperCase']()+']\x20The\x20Enduser\x20phone\x20is:',_0x2d2302[_0xd491('0x25')]);return getTicket(_0x84172e,_0x1aaf7b,_0x409ddb,_0x5e3f1f,_0x2d2302,_0x51f209,_0x4751a0);})[_0xd491('0x10')](function(_0x23ee58){logger['info'](util[_0xd491('0x4c')]('['+_0x4751a0[_0xd491('0x13')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x51f209['ticketType'],_0x23ee58[_0xd491('0x49')]));logger[_0xd491('0x1c')](util[_0xd491('0x4c')]('['+_0x4751a0[_0xd491('0x13')]()+']\x20Call\x20direction:\x20%s',_0x4751a0));if(_0x4751a0!==_0xd491('0x51')){logger[_0xd491('0x1c')]('['+_0x4751a0['toUpperCase']()+']',_0xd491('0x61'));emit(_0x1aaf7b['remoteUri'],_0x484532['name'],_0x51f209[_0xd491('0x3c')],_0x23ee58['ticketId']);}})['catch'](function(_0x4dce3c){logger[_0xd491('0x12')]('['+_0x4751a0[_0xd491('0x13')]()+_0xd491('0x62'),util[_0xd491('0x63')](_0x4dce3c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9572=['indexOf','ticketType','incidents','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','assign','callDirection','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:','userEmail',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','POST','remoteUri','username','password','clientSecret','then','catch','error',']\x20Wrong\x20credentials!','GET','Bearer\x20','value','isNil','validateEmail','email','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId','message','toLowerCase','outbound','destcalleridnum','calleridnum','/systemusers(','4.0','headers','odata-entityid','lastIndexOf','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','contactid','enduserId','forEach','includes','string','picklist','type','customField','substring'];(function(_0x134318,_0x28ce39){var _0xb8b64=function(_0x2561d9){while(--_0x2561d9){_0x134318['push'](_0x134318['shift']());}};_0xb8b64(++_0x28ce39);}(_0x9572,0x82));var _0x2957=function(_0x2d5724,_0x15bf66){_0x2d5724=_0x2d5724-0x0;var _0x1063d0=_0x9572[_0x2d5724];return _0x1063d0;};'use strict';var _=require(_0x2957('0x0'));var BPromise=require('bluebird');var rp=require(_0x2957('0x1'));var util=require(_0x2957('0x2'));var intUtil=require('./util');var md5=require(_0x2957('0x3'));var Redis=require(_0x2957('0x4'));var logger=require(_0x2957('0x5'))(_0x2957('0x6'));var config=require('../../../../config/environment');config[_0x2957('0x7')]=_[_0x2957('0x8')](config[_0x2957('0x7')],{'host':_0x2957('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2957('0x7')]));function getAuthToken(_0x5055b9,_0x52c3a9,_0x102025){var _0x364561={'method':_0x2957('0xa'),'uri':_0x52c3a9,'form':{'client_id':_0x5055b9['clientId'],'resource':_0x5055b9[_0x2957('0xb')],'username':_0x5055b9[_0x2957('0xc')],'password':_0x5055b9[_0x2957('0xd')],'grant_type':_0x2957('0xd'),'client_secret':_0x5055b9[_0x2957('0xe')]},'json':!![]};return rp(_0x364561)[_0x2957('0xf')](function(_0x23b678){return _0x23b678['access_token'];})[_0x2957('0x10')](function(_0x295a20){logger[_0x2957('0x11')]('['+[_0x102025['toUpperCase']()]+_0x2957('0x12'));return _0x295a20['message'];});}function getUser(_0x1440a3,_0x22da1f,_0x2e7fa2,_0x4962d9,_0x2f0c12,_0x324126){return new BPromise(function(_0x102646,_0x197d92){return getAuthToken(_0x22da1f,_0x4962d9,_0x324126)[_0x2957('0xf')](function(_0xb08896){var _0x4cb4bf={'method':_0x2957('0x13'),'uri':_0x2f0c12+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x2957('0x14')+_0xb08896,'OData-Version':'4.0'},'json':!![]};return rp(_0x4cb4bf);})[_0x2957('0xf')](function(_0x18c91a){var _0x28b7f3=_0x18c91a[_0x2957('0x15')];var _0x57452b=![];var _0x54c7a6=null;if(!_[_0x2957('0x16')](_0x2e7fa2)){if(intUtil[_0x2957('0x17')](_0x2e7fa2[_0x2957('0x18')])){_0x1440a3['userEmail']=_0x2e7fa2[_0x2957('0x18')];for(_0x54c7a6=0x0;_0x54c7a6<_0x28b7f3[_0x2957('0x19')];_0x54c7a6++){if(_0x28b7f3[_0x54c7a6][_0x2957('0x1a')]===_0x2e7fa2[_0x2957('0x18')]&&!_0x28b7f3[_0x54c7a6]['isdisabled']){_0x57452b=!![];logger[_0x2957('0x1b')]('['+[_0x324126[_0x2957('0x1c')]()]+_0x2957('0x1d')+_0x28b7f3[_0x54c7a6][_0x2957('0x1e')]+'!');_0x1440a3['userId']=_0x28b7f3[_0x54c7a6][_0x2957('0x1e')];}}}}if(!_0x57452b){logger[_0x2957('0x1b')]('['+[_0x324126[_0x2957('0x1c')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x1440a3['userEmail']=_0x22da1f['username'];for(_0x54c7a6=0x0;_0x54c7a6<_0x28b7f3[_0x2957('0x19')];_0x54c7a6++){if(_0x28b7f3[_0x54c7a6][_0x2957('0x1a')]===_0x22da1f[_0x2957('0xc')]){_0x1440a3[_0x2957('0x1f')]=_0x28b7f3[_0x54c7a6][_0x2957('0x1e')];}}}_0x102646(_0x1440a3);})[_0x2957('0x10')](function(_0x3065cc){_0x197d92(_0x3065cc[_0x2957('0x20')]);});});}function createEndUser(_0x4975f4,_0x334ac8,_0x6e36ec,_0x554ee6,_0x510342,_0x7fff15){return new BPromise(function(_0x58b963,_0x2affd9){return getAuthToken(_0x334ac8,_0x6e36ec,_0x7fff15)['then'](function(_0x28d592){var _0x59641b=_0x7fff15[_0x2957('0x21')]()===_0x2957('0x22')?_0x510342[_0x2957('0x23')]:_0x510342[_0x2957('0x24')];var _0x3d9b38={'method':_0x2957('0xa'),'uri':_0x554ee6+'contacts','body':{'telephone1':_0x59641b,'fullname':_0x59641b,'firstname':_0x59641b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x2957('0x25')+_0x4975f4[_0x2957('0x1f')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x28d592,'OData-Version':_0x2957('0x26')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3d9b38);})[_0x2957('0xf')](function(_0x19f4d7){var _0x3ddeee=_0x19f4d7[_0x2957('0x27')][_0x2957('0x28')];var _0x554bb8=_0x3ddeee['substring'](_0x3ddeee[_0x2957('0x29')]('(')+0x1,_0x3ddeee[_0x2957('0x29')](')'));_0x4975f4['enduserId']=_0x554bb8;_0x58b963(_0x4975f4);})['catch'](function(_0x3f0fd6){_0x2affd9(_0x3f0fd6[_0x2957('0x20')]);});});}function getEndUser(_0x1c5025,_0x737b80,_0x1a2584,_0x24e21c,_0x4d8ac8,_0xbe20f9){return new BPromise(function(_0x2ef292,_0x1adc47){var _0x581d00=_0xbe20f9[_0x2957('0x21')]()===_0x2957('0x22')?_0x4d8ac8['destcalleridnum']:_0x4d8ac8[_0x2957('0x24')];return getAuthToken(_0x737b80,_0x1a2584,_0xbe20f9)[_0x2957('0xf')](function(_0x183990){var _0x3397af={'method':'GET','uri':_0x24e21c+_0x2957('0x2a')+_0x581d00[_0x2957('0x2b')]('+',_0x2957('0x2c'))+'\x27','headers':{'Authorization':_0x2957('0x14')+_0x183990,'If-None-Match':null,'OData-Version':_0x2957('0x26')},'json':!![]};return rp(_0x3397af);})[_0x2957('0xf')](function(_0x11e207){var _0x31c316=null;if(_0x11e207){var _0x284c38=_0x11e207[_0x2957('0x15')];var _0x30311a=![];for(_0x31c316=0x0;_0x31c316<_0x284c38[_0x2957('0x19')];_0x31c316++){if(_0x284c38[_0x31c316]['telephone1']===_0x581d00){_0x30311a=!![];_0x1c5025['enduserId']=_0x284c38[_0x31c316][_0x2957('0x2d')];}}if(_0x30311a){_0x2ef292(_0x1c5025);}else{return createEndUser(_0x1c5025,_0x737b80,_0x1a2584,_0x24e21c,_0x4d8ac8,_0xbe20f9)[_0x2957('0xf')](function(_0xd79e21){logger[_0x2957('0x1b')]('['+[_0xbe20f9['toUpperCase']()]+']\x20Enduser\x20created!',_0xd79e21[_0x2957('0x2e')]);_0x2ef292(_0xd79e21);});}}else{return createEndUser(_0x1c5025,_0x737b80,_0x1a2584,_0x24e21c,_0x4d8ac8,_0xbe20f9)[_0x2957('0xf')](function(_0x550d9e){logger['info']('['+[_0xbe20f9[_0x2957('0x1c')]()]+']\x20Enduser\x20Created!',_0x550d9e['enduserId']);_0x2ef292(_0x550d9e);});}});});}function getCustomFields(_0x3b1dab,_0x36b088,_0x3cc261){var _0x1d6dc2={};if(_0x3b1dab['length']>0x0){_[_0x2957('0x2f')](_0x3b1dab,function(_0x4129d0){if(_[_0x2957('0x30')]([_0x2957('0x31'),_0x2957('0x32')],_0x4129d0[_0x2957('0x33')])&&_0x4129d0['nameField']&&!_0x4129d0[_0x2957('0x34')]){var _0x5b3df1=_0x4129d0['idField']['toLowerCase']();var _0x57f6f1=_0x5b3df1[_0x2957('0x35')](0x0,_0x5b3df1[_0x2957('0x36')]('_'));var _0x42ef5b=_0x5b3df1['substring'](_0x5b3df1['indexOf']('_')+0x1);if(_0x57f6f1===_0x3cc261){_0x1d6dc2[_0x42ef5b]=_0x4129d0['content'];}}});}return _0x1d6dc2;}function getTicket(_0x1b2f6f,_0x5cae54,_0x2b892a,_0x262d7d,_0x4ef60e,_0x25b266,_0x3426d2){return new BPromise(function(_0x32dad6,_0x2e329f){var _0x3bfffb;return getAuthToken(_0x5cae54,_0x2b892a,_0x3426d2)[_0x2957('0xf')](function(_0xb94f60){if(_0x25b266[_0x2957('0x37')]==='incident'){_0x3bfffb={'method':_0x2957('0xa'),'uri':_0x262d7d+_0x2957('0x38'),'body':Object['assign']({},{'title':intUtil[_0x2957('0x39')](_0x25b266[_0x2957('0x3a')],_0x4ef60e,'\x20'),'description':intUtil['getString'](_0x25b266[_0x2957('0x3b')],_0x4ef60e,'\x0a'),'customerid_contact@odata.bind':_0x2957('0x3c')+_0x1b2f6f[_0x2957('0x2e')]+')','ownerid@odata.bind':_0x2957('0x25')+_0x1b2f6f[_0x2957('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0x25b266[_0x2957('0x3d')],_0x4ef60e,_0x25b266['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0xb94f60,'OData-Version':_0x2957('0x26')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x25b266[_0x2957('0x37')]===_0x2957('0x3e')){_0x3bfffb={'method':_0x2957('0xa'),'uri':_0x262d7d+_0x2957('0x3f'),'body':Object[_0x2957('0x40')]({},{'subject':intUtil['getString'](_0x25b266[_0x2957('0x3a')],_0x4ef60e,'\x20'),'phonenumber':String(_0x4ef60e['calleridnum']),'description':intUtil[_0x2957('0x39')](_0x25b266['Descriptions'],_0x4ef60e,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2957('0x3c')+_0x1b2f6f[_0x2957('0x2e')]+')','ownerid@odata.bind':_0x2957('0x25')+_0x1b2f6f[_0x2957('0x1f')]+')','directioncode':_0x1b2f6f[_0x2957('0x41')]===_0x2957('0x42')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':'/systemusers('+_0x1b2f6f[_0x2957('0x1f')]+')','participationtypemask':_0x1b2f6f[_0x2957('0x41')]===_0x2957('0x42')?0x2:0x1},{'partyid_contact@odata.bind':_0x2957('0x3c')+_0x1b2f6f[_0x2957('0x2e')]+')','participationtypemask':_0x1b2f6f[_0x2957('0x41')]===_0x2957('0x42')?0x1:0x2}]},getCustomFields(_0x25b266[_0x2957('0x3d')],_0x4ef60e,_0x25b266[_0x2957('0x37')])),'headers':{'Authorization':_0x2957('0x14')+_0xb94f60,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x3bfffb);})[_0x2957('0xf')](function(_0x16e346){var _0x40892f=_0x16e346[_0x2957('0x27')][_0x2957('0x28')];var _0x72fa7d=_0x40892f[_0x2957('0x35')](_0x40892f[_0x2957('0x29')]('(')+0x1,_0x40892f[_0x2957('0x29')](')'));_0x1b2f6f['ticketId']=_0x72fa7d;_0x32dad6(_0x1b2f6f);})[_0x2957('0x10')](function(_0x3d2552){_0x2e329f(_0x3d2552[_0x2957('0x20')]);});});}function emit(_0x2cb780,_0x4fa968,_0x3ce4be,_0x51b75c){var _0xab9557={'uri':util[_0x2957('0x43')](_0x2957('0x44'),_0x2cb780,_0x3ce4be,_0x51b75c)};io['to'](util['format'](_0x2957('0x45'),_0x4fa968))[_0x2957('0x46')](_0x2957('0x47'),_0xab9557);}exports['cs']=function(_0xd3f8b3,_0x140eba,_0x553ca3,_0x303d20,_0x3186f0,_0xc7329d,_0x31ae33,_0x4fa6cd){var _0x148950={};_0xc7329d[_0x2957('0xb')]=intUtil[_0x2957('0x48')](_0xc7329d[_0x2957('0xb')]);_0xc7329d['serverUrl']=intUtil[_0x2957('0x48')](_0xc7329d['serverUrl']);_0x148950['callDirection']=_0x4fa6cd===_0x2957('0x42')||_0x4fa6cd==='unmanaged'?_0x2957('0x42'):'outbound';var _0x1a1d00=util[_0x2957('0x43')]('%s/api/data/v9.0/',_0xc7329d[_0x2957('0xb')]);var _0x507a1f=util[_0x2957('0x43')](_0x2957('0x49'),_0xc7329d[_0x2957('0x4a')]);var _0x1c8c06=util['format'](_0x2957('0x4b'),_0xc7329d[_0x2957('0x4c')],_0x140eba['uniqueid'],md5(_0x140eba[_0x2957('0x4d')]));if(_0x3186f0&&_0x3186f0[_0x2957('0x4e')]){logger[_0x2957('0x1b')]('[QUEUE]',_0x2957('0x4f'));_0x140eba[_0x2957('0x50')]=_0x1c8c06;}else if(_0x31ae33&&_0x31ae33[_0x2957('0x51')]&&_0x31ae33[_0x2957('0x51')]!==_0x2957('0x52')){logger['info'](_0x2957('0x53'),'Recording\x20is\x20enabled!');_0x140eba['recordingURL']=_0x1c8c06;}else{_0x140eba[_0x2957('0x50')]='';}return getUser(_0x148950,_0xc7329d,_0x303d20,_0x507a1f,_0x1a1d00,_0x4fa6cd)['then'](function(_0x4fc31b){logger[_0x2957('0x1b')]('['+_0x4fa6cd[_0x2957('0x1c')]()+_0x2957('0x54'),_0x4fc31b[_0x2957('0x1f')]);logger['info']('['+_0x4fa6cd[_0x2957('0x1c')]()+']\x20The\x20User\x20email\x20is:',_0x4fc31b[_0x2957('0x55')]);return getEndUser(_0x4fc31b,_0xc7329d,_0x507a1f,_0x1a1d00,_0x140eba,_0x4fa6cd);})['then'](function(_0x6908ef){logger['info']('['+_0x4fa6cd[_0x2957('0x1c')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x6908ef[_0x2957('0x2e')]);logger[_0x2957('0x1b')]('['+_0x4fa6cd[_0x2957('0x1c')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x140eba[_0x2957('0x24')]);return getTicket(_0x6908ef,_0xc7329d,_0x507a1f,_0x1a1d00,_0x140eba,_0x553ca3,_0x4fa6cd);})[_0x2957('0xf')](function(_0x3f9e15){logger['info'](util['format']('['+_0x4fa6cd[_0x2957('0x1c')]()+_0x2957('0x56'),_0x553ca3[_0x2957('0x37')],_0x3f9e15[_0x2957('0x57')]));logger['info'](util['format']('['+_0x4fa6cd[_0x2957('0x1c')]()+']\x20Call\x20direction:\x20%s',_0x4fa6cd));if(_0x4fa6cd!==_0x2957('0x58')){logger['info']('['+_0x4fa6cd[_0x2957('0x1c')]()+']',_0x2957('0x59'));emit(_0xc7329d[_0x2957('0xb')],_0x303d20[_0x2957('0x5a')],_0x553ca3[_0x2957('0x37')],_0x3f9e15[_0x2957('0x57')]);}})['catch'](function(_0x1dd9f3){logger[_0x2957('0x11')]('['+_0x4fa6cd[_0x2957('0x1c')]()+_0x2957('0x5b'),util['inspect'](_0x1dd9f3,{'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 02cf911..0ff3e8b 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 _0xc865=['error','outbound','recordingFormat','[OUTBOUND]','Authorization','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','unmanaged','lastevent','toUpperCase','lodash','ioredis','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','custom_fields','mapValues','value','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','stringify','GET','map','forEach','string','type','customField','nameField','toLowerCase','includes','picklist','idField','push','content','variable','variableName','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch'];(function(_0x33a052,_0x3abf63){var _0x1a6676=function(_0x396203){while(--_0x396203){_0x33a052['push'](_0x33a052['shift']());}};_0x1a6676(++_0x3abf63);}(_0xc865,0xc0));var _0x5c86=function(_0xe8d051,_0x1486be){_0xe8d051=_0xe8d051-0x0;var _0x2e802d=_0xc865[_0xe8d051];return _0x2e802d;};'use strict';var _=require(_0x5c86('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require('util');var Redis=require(_0x5c86('0x1'));var intUtil=require('./util');var config=require(_0x5c86('0x2'));var logger=require('../../../../config/logger')(_0x5c86('0x3'));config[_0x5c86('0x4')]=_[_0x5c86('0x5')](config[_0x5c86('0x4')],{'host':_0x5c86('0x6'),'port':0x18eb});var io=require(_0x5c86('0x7'))(new Redis(config[_0x5c86('0x4')]));var headers={'Content-Type':_0x5c86('0x8'),'Accept':_0x5c86('0x8')};function emit(_0x9a9178,_0x403669,_0x3259e3){io['to'](_0x9a9178)[_0x5c86('0x9')](_0x403669,_0x3259e3);}function getTicket(_0x3a2aea,_0x1b29aa,_0x3f83f2,_0x4fda6d,_0x557cc6){logger['info'](_0x5c86('0xa'));var _0x521863=_['merge']({'responder_id':_0x1b29aa['id'],'requester_id':_0x3f83f2['id'],'name':util[_0x5c86('0xb')](_0x5c86('0xc'),_0x557cc6[_0x5c86('0xd')]),'phone':_0x557cc6['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5c86('0xe')](_0x4fda6d[_0x5c86('0xf')],_0x557cc6,'\x20'),'description':intUtil[_0x5c86('0xe')](_0x4fda6d[_0x5c86('0x10')],_0x557cc6,_0x5c86('0x11')),'tags':getTags(_0x4fda6d[_0x5c86('0x12')],_0x5c86('0x13'))},getCustomFields(_0x4fda6d['Fields'],_0x557cc6));_0x521863[_0x5c86('0x14')]=_[_0x5c86('0x15')](_['keyBy'](_0x521863[_0x5c86('0x14')],'id'),_0x5c86('0x16'));return request({'uri':util['format']('%s/api/v2/tickets',_0x3a2aea['remoteUri']),'method':_0x5c86('0x17'),'body':_0x521863})[_0x5c86('0x18')](function(_0x5107bf){logger[_0x5c86('0x19')](_0x5c86('0x1a'));return _0x5107bf;});}function getUser(_0x203e7b,_0x6adfd4){if(intUtil[_0x5c86('0x1b')](_0x6adfd4)){return request({'uri':util['format'](_0x5c86('0x1c'),_0x203e7b[_0x5c86('0x1d')]),'qs':{'email':_0x6adfd4}})[_0x5c86('0x18')](function(_0x30c4af){if(_0x30c4af[_0x5c86('0x1e')]){logger['info'](_0x5c86('0x1f'));return _[_0x5c86('0x20')](_0x30c4af,function(_0x10c0af){return _0x10c0af[_0x5c86('0x21')][_0x5c86('0x22')]===_0x6adfd4;});}else{logger[_0x5c86('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x5c86('0xb')](_0x5c86('0x23'),_0x203e7b[_0x5c86('0x1d')])})[_0x5c86('0x18')](function(_0x390454){logger['info']('Admin\x20account\x20selected.');return _0x390454;});}});}else{logger['info'](_0x5c86('0x24'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x203e7b[_0x5c86('0x1d')])})[_0x5c86('0x18')](function(_0x5a2d37){logger[_0x5c86('0x19')]('Admin\x20account\x20selected.');return _0x5a2d37;});}}function getEndUser(_0x3f61b7,_0x16b9e5,_0x2dc511){logger[_0x5c86('0x19')](_0x5c86('0x25'),_0x2dc511);return request({'uri':util[_0x5c86('0xb')](_0x5c86('0x26'),_0x3f61b7[_0x5c86('0x1d')]),'qs':{'phone':_0x2dc511}})[_0x5c86('0x18')](function(_0x1dc1b1){if(_0x1dc1b1[_0x5c86('0x1e')]){logger[_0x5c86('0x19')](_0x5c86('0x27'));return _[_0x5c86('0x20')](_0x1dc1b1,{'phone':_0x2dc511});}else{logger[_0x5c86('0x19')](_0x5c86('0x28'));return request({'uri':util['format']('%s/api/v2/contacts',_0x3f61b7['remoteUri']),'method':_0x5c86('0x17'),'body':{'name':_0x16b9e5,'phone':_0x2dc511}})['then'](function(_0x1535db){logger[_0x5c86('0x19')](_0x5c86('0x29'));return _0x1535db;});}});}function getAuth(_0x4e5278){return util['format'](_0x5c86('0x2a'),new Buffer(_0x4e5278[_0x5c86('0x2b')]+':X')[_0x5c86('0x2c')](_0x5c86('0x2d')));}function request(_0x36ba3b){logger[_0x5c86('0x2e')]('[HTTP]',JSON[_0x5c86('0x2f')](_0x36ba3b));return rp(_[_0x5c86('0x5')](_0x36ba3b,{'method':_0x5c86('0x30'),'headers':headers,'json':!![]}));}function getTags(_0x20ac3e,_0x577653){var _0x5caa6d=[];if(_0x20ac3e&&_0x20ac3e['length']>0x0){_0x5caa6d=_[_0x5c86('0x31')](_0x20ac3e,_0x577653);}return _0x5caa6d;}function getCustomFields(_0x4180ee,_0x45dc04){var _0x36ab2e=[];var _0x5422cc={'custom_fields':[]};if(_0x4180ee[_0x5c86('0x1e')]>0x0){_[_0x5c86('0x32')](_0x4180ee,function(_0x14fe57){if(_['includes']([_0x5c86('0x33'),'picklist'],_0x14fe57[_0x5c86('0x34')])&&_0x14fe57['nameField']&&!_0x14fe57[_0x5c86('0x35')]){_0x5422cc[_0x14fe57[_0x5c86('0x36')][_0x5c86('0x37')]()]=_0x14fe57['content'][_0x5c86('0x2c')]();}else if(_[_0x5c86('0x38')](['string',_0x5c86('0x39')],_0x14fe57[_0x5c86('0x34')])&&_0x14fe57[_0x5c86('0x3a')]&&_0x14fe57[_0x5c86('0x35')]){_0x5422cc[_0x5c86('0x14')][_0x5c86('0x3b')]({'id':_0x14fe57[_0x5c86('0x3a')],'value':_0x14fe57[_0x5c86('0x3c')][_0x5c86('0x2c')]()});}else if(_0x14fe57['type']===_0x5c86('0x3d')&&_0x14fe57[_0x5c86('0x3e')]&&_0x14fe57[_0x5c86('0x3a')]&&_0x14fe57[_0x5c86('0x35')]){_0x45dc04[_0x14fe57[_0x5c86('0x3e')]]&&_0x5422cc[_0x5c86('0x14')][_0x5c86('0x3b')]({'id':_0x14fe57['idField'],'value':_0x45dc04[_0x14fe57['variableName']][_0x5c86('0x2c')]()});}else if(_0x14fe57['type']==='customVariable'&&_0x14fe57[_0x5c86('0x3f')]&&_0x14fe57['Variable'][_0x5c86('0x13')]&&_0x14fe57['idField']&&_0x14fe57[_0x5c86('0x35')]){_0x45dc04[_0x14fe57[_0x5c86('0x3f')][_0x5c86('0x13')][_0x5c86('0x37')]()]&&_0x5422cc[_0x5c86('0x14')][_0x5c86('0x3b')]({'id':_0x14fe57[_0x5c86('0x3a')],'value':_0x45dc04[_0x14fe57['Variable']['name'][_0x5c86('0x37')]()][_0x5c86('0x2c')]()});}});}return _0x5422cc;}exports['queue']=function(_0x289c3a,_0x540154,_0x34f58c,_0x1d0c12,_0x22a968,_0x1ffd33){var _0x581015,_0x55635e;_0x1ffd33['remoteUri']=intUtil[_0x5c86('0x40')](_0x1ffd33[_0x5c86('0x1d')]);_0x1ffd33[_0x5c86('0x41')]=intUtil[_0x5c86('0x40')](_0x1ffd33['serverUrl']);if(_0x22a968&&_0x22a968[_0x5c86('0x42')]){logger[_0x5c86('0x19')](_0x5c86('0x43'),_0x5c86('0x44'));_0x540154[_0x5c86('0x45')]=util['format'](_0x5c86('0x46'),_0x1ffd33[_0x5c86('0x41')],_0x540154[_0x5c86('0x47')],md5(_0x540154[_0x5c86('0x47')]));}else{_0x540154[_0x5c86('0x45')]='';}headers['Authorization']=getAuth(_0x1ffd33);return getUser(_0x1ffd33,_0x1d0c12[_0x5c86('0x22')])['then'](function(_0x269930){_0x581015=_0x269930;logger[_0x5c86('0x19')](_0x5c86('0x48'),_0x581015['id']);return getEndUser(_0x1ffd33,_0x540154[_0x5c86('0xd')],_0x540154[_0x5c86('0x49')]);})[_0x5c86('0x18')](function(_0x2371da){_0x55635e=_0x2371da;logger[_0x5c86('0x19')](_0x5c86('0x4a'),_0x55635e['id']);return getTicket(_0x1ffd33,_0x581015,_0x55635e,_0x34f58c,_0x540154);})[_0x5c86('0x18')](function(_0x2dc477){if(_0x2dc477&&_0x2dc477['id']){logger['info'](_0x5c86('0x1a'));logger[_0x5c86('0x19')]('The\x20Ticket\x20ID\x20is:',_0x2dc477['id']);logger['info'](_0x5c86('0x43'),_0x5c86('0x4b'));emit(util[_0x5c86('0xb')]('user:%s',_0x1d0c12[_0x5c86('0x13')]),'trigger:browser:url',{'uri':util[_0x5c86('0xb')](_0x5c86('0x4c'),_0x1ffd33[_0x5c86('0x1d')],_0x2dc477['id'])});}})[_0x5c86('0x4d')](function(_0x5751e2){logger[_0x5c86('0x4e')](_0x5c86('0x43'),JSON[_0x5c86('0x2f')](_0x5751e2));});};exports[_0x5c86('0x4f')]=function(_0x5ef7ef,_0x25e82c,_0x55bb85,_0x21fe28,_0x4f0803,_0x41ffcd,_0x57785e){var _0x486a99,_0x564909;_0x41ffcd[_0x5c86('0x1d')]=intUtil[_0x5c86('0x40')](_0x41ffcd['remoteUri']);_0x41ffcd[_0x5c86('0x41')]=intUtil[_0x5c86('0x40')](_0x41ffcd['serverUrl']);if(_0x57785e&&_0x57785e['recordingFormat']&&_0x57785e[_0x5c86('0x50')]!=='none'){logger[_0x5c86('0x19')](_0x5c86('0x51'),_0x5c86('0x44'));_0x25e82c[_0x5c86('0x45')]=util[_0x5c86('0xb')](_0x5c86('0x46'),_0x41ffcd[_0x5c86('0x41')],_0x25e82c['uniqueid'],md5(_0x25e82c['uniqueid']));}headers[_0x5c86('0x52')]=getAuth(_0x41ffcd);return getUser(_0x41ffcd,_0x21fe28[_0x5c86('0x22')])[_0x5c86('0x18')](function(_0x3cd20a){_0x486a99=_0x3cd20a;logger[_0x5c86('0x19')](_0x5c86('0x48'),_0x486a99['id']);return getEndUser(_0x41ffcd,_0x25e82c['destcalleridname'],_0x25e82c[_0x5c86('0x53')]);})[_0x5c86('0x18')](function(_0x1fd4d7){_0x564909=_0x1fd4d7;logger[_0x5c86('0x19')](_0x5c86('0x4a'),_0x564909['id']);return getTicket(_0x41ffcd,_0x486a99,_0x564909,_0x55bb85,_0x25e82c);})[_0x5c86('0x18')](function(_0x196858){if(_0x196858&&_0x196858['id']){logger[_0x5c86('0x19')](_0x5c86('0x1a'));logger['info'](_0x5c86('0x54'),_0x196858['id']);logger[_0x5c86('0x19')](_0x5c86('0x51'),_0x5c86('0x4b'));emit(util[_0x5c86('0xb')](_0x5c86('0x55'),_0x21fe28['name']),_0x5c86('0x56'),{'uri':util[_0x5c86('0xb')](_0x5c86('0x4c'),_0x41ffcd[_0x5c86('0x1d')],_0x196858['id'])});}})['catch'](function(_0x5d5dbe){logger[_0x5c86('0x4e')](_0x5c86('0x51'),JSON[_0x5c86('0x2f')](_0x5d5dbe));});};exports[_0x5c86('0x57')]=function(_0x4be26e,_0x358352,_0x43ed10,_0x99db01,_0x5758fb,_0xa06f97){var _0x288f85,_0x46a607;_0xa06f97[_0x5c86('0x1d')]=intUtil[_0x5c86('0x40')](_0xa06f97[_0x5c86('0x1d')]);_0xa06f97[_0x5c86('0x41')]=intUtil[_0x5c86('0x40')](_0xa06f97[_0x5c86('0x41')]);if(_0x5758fb&&_0x5758fb[_0x5c86('0x42')]){logger['info']('['+_0x358352[_0x5c86('0x58')][_0x5c86('0x59')]()+']',_0x5c86('0x44'));_0x358352[_0x5c86('0x45')]=util[_0x5c86('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa06f97[_0x5c86('0x41')],_0x358352[_0x5c86('0x47')],md5(_0x358352[_0x5c86('0x47')]));}else{_0x358352[_0x5c86('0x45')]='';}headers[_0x5c86('0x52')]=getAuth(_0xa06f97);return getUser(_0xa06f97,'')[_0x5c86('0x18')](function(_0x5acf76){_0x288f85=_0x5acf76;logger['info'](_0x5c86('0x48'),_0x288f85['id']);return getEndUser(_0xa06f97,_0x358352[_0x5c86('0xd')],_0x358352[_0x5c86('0x49')]);})[_0x5c86('0x18')](function(_0x38efe4){_0x46a607=_0x38efe4;logger[_0x5c86('0x19')](_0x5c86('0x4a'),_0x46a607['id']);return getTicket(_0xa06f97,_0x288f85,_0x46a607,_0x43ed10,_0x358352);})[_0x5c86('0x18')](function(_0x2ce374){if(_0x2ce374){logger[_0x5c86('0x19')](_0x5c86('0x1a'));logger[_0x5c86('0x19')](_0x5c86('0x54'),_0x2ce374['id']);}})[_0x5c86('0x4d')](function(_0x3ebdd4){logger['error']('['+_0x358352[_0x5c86('0x58')][_0x5c86('0x59')]()+']',JSON['stringify'](_0x3ebdd4));});}; \ No newline at end of file +var _0x2527=['trigger:browser:url','catch','error','stringify','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','Authorization','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','unmanaged','toUpperCase','lastevent','lodash','md5','./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','Fields','custom_fields','mapValues','keyBy','remoteUri','POST','then','info','Ticket\x20created!','%s/api/v2/agents','length','find','contact','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','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','toString','[HTTP]','defaults','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','variable','variableName','customVariable','Variable','push','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s'];(function(_0x4b90fa,_0x950b38){var _0x395a43=function(_0x16651b){while(--_0x16651b){_0x4b90fa['push'](_0x4b90fa['shift']());}};_0x395a43(++_0x950b38);}(_0x2527,0xc7));var _0x7252=function(_0x4f948f,_0x561138){_0x4f948f=_0x4f948f-0x0;var _0x5f350e=_0x2527[_0x4f948f];return _0x5f350e;};'use strict';var _=require(_0x7252('0x0'));var rp=require('request-promise');var md5=require(_0x7252('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x7252('0x2'));var config=require(_0x7252('0x3'));var logger=require('../../../../config/logger')(_0x7252('0x4'));config[_0x7252('0x5')]=_['defaults'](config[_0x7252('0x5')],{'host':_0x7252('0x6'),'port':0x18eb});var io=require(_0x7252('0x7'))(new Redis(config[_0x7252('0x5')]));var headers={'Content-Type':_0x7252('0x8'),'Accept':_0x7252('0x8')};function emit(_0x14a4d2,_0x430234,_0x137b42){io['to'](_0x14a4d2)[_0x7252('0x9')](_0x430234,_0x137b42);}function getTicket(_0x39123d,_0x1db4dd,_0x229694,_0x47e8c1,_0x35ee2c){logger['info'](_0x7252('0xa'));var _0x12359d=_['merge']({'responder_id':_0x1db4dd['id'],'requester_id':_0x229694['id'],'name':util[_0x7252('0xb')](_0x7252('0xc'),_0x35ee2c[_0x7252('0xd')]),'phone':_0x35ee2c[_0x7252('0xe')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x7252('0xf')](_0x47e8c1[_0x7252('0x10')],_0x35ee2c,'\x20'),'description':intUtil[_0x7252('0xf')](_0x47e8c1[_0x7252('0x11')],_0x35ee2c,_0x7252('0x12')),'tags':getTags(_0x47e8c1['Tags'],_0x7252('0x13'))},getCustomFields(_0x47e8c1[_0x7252('0x14')],_0x35ee2c));_0x12359d[_0x7252('0x15')]=_[_0x7252('0x16')](_[_0x7252('0x17')](_0x12359d[_0x7252('0x15')],'id'),'value');return request({'uri':util[_0x7252('0xb')]('%s/api/v2/tickets',_0x39123d[_0x7252('0x18')]),'method':_0x7252('0x19'),'body':_0x12359d})[_0x7252('0x1a')](function(_0x377a41){logger[_0x7252('0x1b')](_0x7252('0x1c'));return _0x377a41;});}function getUser(_0x3ba3c5,_0x28ad81){if(intUtil['validateEmail'](_0x28ad81)){return request({'uri':util[_0x7252('0xb')](_0x7252('0x1d'),_0x3ba3c5[_0x7252('0x18')]),'qs':{'email':_0x28ad81}})[_0x7252('0x1a')](function(_0x575f81){if(_0x575f81[_0x7252('0x1e')]){logger[_0x7252('0x1b')]('Agent\x20found!');return _[_0x7252('0x1f')](_0x575f81,function(_0x51f0d8){return _0x51f0d8[_0x7252('0x20')][_0x7252('0x21')]===_0x28ad81;});}else{logger[_0x7252('0x1b')](_0x7252('0x22'));return request({'uri':util[_0x7252('0xb')](_0x7252('0x23'),_0x3ba3c5[_0x7252('0x18')])})['then'](function(_0x5a8c20){logger['info'](_0x7252('0x24'));return _0x5a8c20;});}});}else{logger[_0x7252('0x1b')](_0x7252('0x25'));return request({'uri':util[_0x7252('0xb')](_0x7252('0x23'),_0x3ba3c5[_0x7252('0x18')])})['then'](function(_0xeb5e4d){logger[_0x7252('0x1b')](_0x7252('0x24'));return _0xeb5e4d;});}}function getEndUser(_0x172cf4,_0x50c925,_0x48650c){logger[_0x7252('0x1b')](_0x7252('0x26'),_0x48650c);return request({'uri':util[_0x7252('0xb')]('%s/api/v2/contacts',_0x172cf4[_0x7252('0x18')]),'qs':{'phone':_0x48650c}})[_0x7252('0x1a')](function(_0x1bcc00){if(_0x1bcc00[_0x7252('0x1e')]){logger[_0x7252('0x1b')]('Enduser\x20found!');return _[_0x7252('0x1f')](_0x1bcc00,{'phone':_0x48650c});}else{logger['info'](_0x7252('0x27'));return request({'uri':util[_0x7252('0xb')](_0x7252('0x28'),_0x172cf4[_0x7252('0x18')]),'method':'POST','body':{'name':_0x50c925,'phone':_0x48650c}})[_0x7252('0x1a')](function(_0x501159){logger[_0x7252('0x1b')]('Enduser\x20created.');return _0x501159;});}});}function getAuth(_0xea0ac7){return util[_0x7252('0xb')](_0x7252('0x29'),new Buffer(_0xea0ac7[_0x7252('0x2a')]+':X')[_0x7252('0x2b')]('base64'));}function request(_0xec8ae4){logger['debug'](_0x7252('0x2c'),JSON['stringify'](_0xec8ae4));return rp(_[_0x7252('0x2d')](_0xec8ae4,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x30fe70,_0x2c5340){var _0x48642c=[];if(_0x30fe70&&_0x30fe70[_0x7252('0x1e')]>0x0){_0x48642c=_['map'](_0x30fe70,_0x2c5340);}return _0x48642c;}function getCustomFields(_0x71a9b,_0x4c0ef4){var _0x9dc648=[];var _0x2a1df5={'custom_fields':[]};if(_0x71a9b[_0x7252('0x1e')]>0x0){_[_0x7252('0x2e')](_0x71a9b,function(_0x861fc2){if(_[_0x7252('0x2f')]([_0x7252('0x30'),_0x7252('0x31')],_0x861fc2[_0x7252('0x32')])&&_0x861fc2[_0x7252('0x33')]&&!_0x861fc2[_0x7252('0x34')]){_0x2a1df5[_0x861fc2['nameField'][_0x7252('0x35')]()]=_0x861fc2[_0x7252('0x36')]['toString']();}else if(_[_0x7252('0x2f')](['string',_0x7252('0x31')],_0x861fc2['type'])&&_0x861fc2[_0x7252('0x37')]&&_0x861fc2[_0x7252('0x34')]){_0x2a1df5[_0x7252('0x15')]['push']({'id':_0x861fc2['idField'],'value':_0x861fc2[_0x7252('0x36')][_0x7252('0x2b')]()});}else if(_0x861fc2[_0x7252('0x32')]===_0x7252('0x38')&&_0x861fc2[_0x7252('0x39')]&&_0x861fc2[_0x7252('0x37')]&&_0x861fc2[_0x7252('0x34')]){_0x4c0ef4[_0x861fc2[_0x7252('0x39')]]&&_0x2a1df5[_0x7252('0x15')]['push']({'id':_0x861fc2['idField'],'value':_0x4c0ef4[_0x861fc2['variableName']][_0x7252('0x2b')]()});}else if(_0x861fc2[_0x7252('0x32')]===_0x7252('0x3a')&&_0x861fc2[_0x7252('0x3b')]&&_0x861fc2[_0x7252('0x3b')][_0x7252('0x13')]&&_0x861fc2[_0x7252('0x37')]&&_0x861fc2[_0x7252('0x34')]){_0x4c0ef4[_0x861fc2['Variable'][_0x7252('0x13')][_0x7252('0x35')]()]&&_0x2a1df5[_0x7252('0x15')][_0x7252('0x3c')]({'id':_0x861fc2[_0x7252('0x37')],'value':_0x4c0ef4[_0x861fc2[_0x7252('0x3b')][_0x7252('0x13')][_0x7252('0x35')]()][_0x7252('0x2b')]()});}});}return _0x2a1df5;}exports[_0x7252('0x3d')]=function(_0x51380f,_0x2ae01e,_0x27a46a,_0x22688d,_0x1c7e6e,_0x3bed56){var _0x25a0b8,_0x4a4ebb;_0x3bed56[_0x7252('0x18')]=intUtil[_0x7252('0x3e')](_0x3bed56[_0x7252('0x18')]);_0x3bed56[_0x7252('0x3f')]=intUtil[_0x7252('0x3e')](_0x3bed56[_0x7252('0x3f')]);if(_0x1c7e6e&&_0x1c7e6e[_0x7252('0x40')]){logger['info'](_0x7252('0x41'),'Recording\x20is\x20enabled!');_0x2ae01e['recordingURL']=util[_0x7252('0xb')](_0x7252('0x42'),_0x3bed56[_0x7252('0x3f')],_0x2ae01e['uniqueid'],md5(_0x2ae01e['uniqueid']));}else{_0x2ae01e[_0x7252('0x43')]='';}headers['Authorization']=getAuth(_0x3bed56);return getUser(_0x3bed56,_0x22688d[_0x7252('0x21')])[_0x7252('0x1a')](function(_0x24b383){_0x25a0b8=_0x24b383;logger['info'](_0x7252('0x44'),_0x25a0b8['id']);return getEndUser(_0x3bed56,_0x2ae01e[_0x7252('0xd')],_0x2ae01e[_0x7252('0xe')]);})[_0x7252('0x1a')](function(_0x3c1344){_0x4a4ebb=_0x3c1344;logger[_0x7252('0x1b')]('The\x20Enduser\x20ID\x20is:',_0x4a4ebb['id']);return getTicket(_0x3bed56,_0x25a0b8,_0x4a4ebb,_0x27a46a,_0x2ae01e);})[_0x7252('0x1a')](function(_0x862734){if(_0x862734&&_0x862734['id']){logger[_0x7252('0x1b')](_0x7252('0x1c'));logger[_0x7252('0x1b')](_0x7252('0x45'),_0x862734['id']);logger[_0x7252('0x1b')](_0x7252('0x41'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x7252('0xb')](_0x7252('0x46'),_0x22688d[_0x7252('0x13')]),_0x7252('0x47'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x3bed56[_0x7252('0x18')],_0x862734['id'])});}})[_0x7252('0x48')](function(_0x5411ac){logger[_0x7252('0x49')](_0x7252('0x41'),JSON[_0x7252('0x4a')](_0x5411ac));});};exports[_0x7252('0x4b')]=function(_0x57a97b,_0x53d6fb,_0x8bd721,_0x531da6,_0x36029d,_0x5c0d0a,_0xfecf42){var _0x2e9599,_0x590bcc;_0x5c0d0a[_0x7252('0x18')]=intUtil[_0x7252('0x3e')](_0x5c0d0a[_0x7252('0x18')]);_0x5c0d0a['serverUrl']=intUtil[_0x7252('0x3e')](_0x5c0d0a[_0x7252('0x3f')]);if(_0xfecf42&&_0xfecf42['recordingFormat']&&_0xfecf42[_0x7252('0x4c')]!==_0x7252('0x4d')){logger[_0x7252('0x1b')](_0x7252('0x4e'),_0x7252('0x4f'));_0x53d6fb[_0x7252('0x43')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c0d0a['serverUrl'],_0x53d6fb[_0x7252('0x50')],md5(_0x53d6fb[_0x7252('0x50')]));}headers[_0x7252('0x51')]=getAuth(_0x5c0d0a);return getUser(_0x5c0d0a,_0x531da6['email'])[_0x7252('0x1a')](function(_0x3fbc01){_0x2e9599=_0x3fbc01;logger['info'](_0x7252('0x44'),_0x2e9599['id']);return getEndUser(_0x5c0d0a,_0x53d6fb[_0x7252('0x52')],_0x53d6fb[_0x7252('0x53')]);})[_0x7252('0x1a')](function(_0x1cde26){_0x590bcc=_0x1cde26;logger[_0x7252('0x1b')](_0x7252('0x54'),_0x590bcc['id']);return getTicket(_0x5c0d0a,_0x2e9599,_0x590bcc,_0x8bd721,_0x53d6fb);})[_0x7252('0x1a')](function(_0x36bb00){if(_0x36bb00&&_0x36bb00['id']){logger[_0x7252('0x1b')](_0x7252('0x1c'));logger[_0x7252('0x1b')](_0x7252('0x45'),_0x36bb00['id']);logger[_0x7252('0x1b')]('[OUTBOUND]',_0x7252('0x55'));emit(util['format']('user:%s',_0x531da6[_0x7252('0x13')]),'trigger:browser:url',{'uri':util['format'](_0x7252('0x56'),_0x5c0d0a[_0x7252('0x18')],_0x36bb00['id'])});}})[_0x7252('0x48')](function(_0x30e4b9){logger['error'](_0x7252('0x4e'),JSON[_0x7252('0x4a')](_0x30e4b9));});};exports[_0x7252('0x57')]=function(_0x57b90a,_0x3bf8dc,_0x12696b,_0x287139,_0x132fa5,_0x37935b){var _0x347248,_0x275d21;_0x37935b[_0x7252('0x18')]=intUtil[_0x7252('0x3e')](_0x37935b['remoteUri']);_0x37935b[_0x7252('0x3f')]=intUtil[_0x7252('0x3e')](_0x37935b[_0x7252('0x3f')]);if(_0x132fa5&&_0x132fa5[_0x7252('0x40')]){logger[_0x7252('0x1b')]('['+_0x3bf8dc['lastevent'][_0x7252('0x58')]()+']','Recording\x20is\x20enabled!');_0x3bf8dc[_0x7252('0x43')]=util[_0x7252('0xb')](_0x7252('0x42'),_0x37935b[_0x7252('0x3f')],_0x3bf8dc[_0x7252('0x50')],md5(_0x3bf8dc['uniqueid']));}else{_0x3bf8dc[_0x7252('0x43')]='';}headers[_0x7252('0x51')]=getAuth(_0x37935b);return getUser(_0x37935b,'')['then'](function(_0x264e48){_0x347248=_0x264e48;logger[_0x7252('0x1b')](_0x7252('0x44'),_0x347248['id']);return getEndUser(_0x37935b,_0x3bf8dc[_0x7252('0xd')],_0x3bf8dc['calleridnum']);})[_0x7252('0x1a')](function(_0x5b5d0e){_0x275d21=_0x5b5d0e;logger['info'](_0x7252('0x54'),_0x275d21['id']);return getTicket(_0x37935b,_0x347248,_0x275d21,_0x12696b,_0x3bf8dc);})['then'](function(_0x5cfceb){if(_0x5cfceb){logger[_0x7252('0x1b')](_0x7252('0x1c'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x5cfceb['id']);}})[_0x7252('0x48')](function(_0x346485){logger[_0x7252('0x49')]('['+_0x3bf8dc[_0x7252('0x59')][_0x7252('0x58')]()+']',JSON['stringify'](_0x346485));});}; \ 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 a000db9..49cc7f5 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 _0xb1b4=['/api/tasks','getString','Subjects','Descriptions','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','unmanaged','queue','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','md5','moment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','email','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','length','userId','Admin\x20selected','userEmail','adminEmail','error','/api/lookup?q=','&entities=contact','contacts','format','mobile_number','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task'];(function(_0x57fe5e,_0xafce42){var _0x24ad53=function(_0x386892){while(--_0x386892){_0x57fe5e['push'](_0x57fe5e['shift']());}};_0x24ad53(++_0xafce42);}(_0xb1b4,0x111));var _0x4b1b=function(_0x1069f5,_0x51cc78){_0x1069f5=_0x1069f5-0x0;var _0x5c211d=_0xb1b4[_0x1069f5];return _0x5c211d;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x4b1b('0x0'));var util=require('util');var moment=require(_0x4b1b('0x1'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x4b1b('0x2'))(_0x4b1b('0x3'));config[_0x4b1b('0x4')]=_[_0x4b1b('0x5')](config[_0x4b1b('0x4')],{'host':_0x4b1b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAdminId(_0x25e756,_0x54e4c7,_0x2ddf48,_0x2ec64b){return new Promise(function(_0x20682d,_0x49c59f){var _0x3fa3c0=![];var _0x3bbb1c={'method':_0x4b1b('0x7'),'uri':_0x2ec64b+_0x4b1b('0x8'),'json':!![]};_0x3bbb1c[_0x4b1b('0x9')]=_0x2ddf48;logger['info'](_0x4b1b('0xa'));return rp(_0x3bbb1c)[_0x4b1b('0xb')](function(_0x2cd3a1){if(_0x2cd3a1){var _0x44bc1a=_0x2cd3a1[_0x4b1b('0xc')];var _0x4f3d95=null;for(_0x4f3d95=0x0;_0x4f3d95<_0x44bc1a['length'];_0x4f3d95++){if(_0x44bc1a[_0x4f3d95][_0x4b1b('0xd')]===_0x25e756['adminEmail']){_0x25e756[_0x4b1b('0xe')]=_0x44bc1a[_0x4f3d95]['id'];_0x3fa3c0=!![];}}if(_0x3fa3c0){logger[_0x4b1b('0xf')](_0x4b1b('0x10'),_0x25e756[_0x4b1b('0xe')]);_0x20682d(_0x25e756);}else{_0x49c59f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x49c59f({'statusCode':0x194,'message':_0x4b1b('0x11')});}})[_0x4b1b('0x12')](function(_0x1cab90){logger['error']('['+[_0x54e4c7[_0x4b1b('0x13')]()]+']',_0x1cab90[_0x4b1b('0x14')]);_0x49c59f(_0x1cab90);});});}function getUser(_0x4345a3,_0x2325c5,_0x2e329d){return function(_0x53df26){return new Promise(function(_0xe946fb,_0x4cba03){var _0x180841={'method':_0x4b1b('0x7'),'uri':_0x2e329d+'/api/selector/owners','json':!![]};_0x180841[_0x4b1b('0x9')]=_0x2325c5;logger['info'](_0x4b1b('0x15'));return rp(_0x180841)['then'](function(_0x2e4ff6){if(_0x2e4ff6){var _0x1905f7=_0x2e4ff6[_0x4b1b('0xc')];var _0x55fec4=![];var _0x295bff=null;if(_0x53df26['agentEmail']!==null){logger[_0x4b1b('0xf')](_0x4b1b('0x16'),_0x53df26[_0x4b1b('0x17')]);_0x53df26['userEmail']=_0x53df26[_0x4b1b('0x17')];for(_0x295bff=0x0;_0x295bff<_0x1905f7[_0x4b1b('0x18')];_0x295bff++){if(_0x1905f7[_0x295bff]['email']===_0x53df26[_0x4b1b('0x17')]){_0x55fec4=!![];_0x53df26[_0x4b1b('0x19')]=_0x1905f7[_0x295bff]['id'];logger[_0x4b1b('0xf')]('User\x20found:',_0x53df26[_0x4b1b('0x19')]);}}}if(!_0x55fec4){logger[_0x4b1b('0xf')](_0x4b1b('0x1a'));_0x53df26[_0x4b1b('0x1b')]=_0x53df26[_0x4b1b('0x1c')];_0x53df26['userId']=_0x53df26[_0x4b1b('0xe')];_0x55fec4=!![];}if(_0x55fec4){_0xe946fb(_0x53df26);}else{_0x4cba03({'statusCode':0x194,'message':_0x4b1b('0x11')});}}else{_0x4cba03({'statusCode':0x194,'message':_0x4b1b('0x11')});}})['catch'](function(_0x22498e){logger[_0x4b1b('0x1d')]('['+[_0x4345a3[_0x4b1b('0x13')]()]+']',_0x22498e['message']);_0x4cba03(_0x22498e);});});};}function searchContact(_0x939bd9,_0xf47dfa,_0x254f1b,_0xc251ed){return new Promise(function(_0x15c7d9,_0xf5dd59){var _0x4d4378={'method':_0x4b1b('0x7'),'headers':_0xf47dfa,'uri':_0x939bd9+_0x4b1b('0x1e')+_0xc251ed+'&f='+_0x254f1b+_0x4b1b('0x1f'),'json':!![]};rp(_0x4d4378)['then'](function(_0x24bea8){var _0x5f5d8a=_['find'](_0x24bea8[_0x4b1b('0x20')][_0x4b1b('0x20')],[_0x254f1b,_0xc251ed]);_0x15c7d9(_0x5f5d8a);})['catch'](function(_0x428601){_0xf5dd59(_0x428601);});});}function getEndUser(_0x32c4ef,_0x42ba5d,_0x42d976){return function(_0x34b6a7){return new Promise(function(_0x1b55e6,_0x38bd3e){logger[_0x4b1b('0xf')](util[_0x4b1b('0x21')]('Searching\x20contact\x20with\x20phone\x20%s',_0x34b6a7['contactNumber']));searchContact(_0x42d976,_0x42ba5d,_0x4b1b('0x22'),_0x34b6a7[_0x4b1b('0x23')])[_0x4b1b('0xb')](function(_0x5a4e1b){if(_0x5a4e1b){_0x34b6a7['endUserId']=_0x5a4e1b['id'];logger['info'](_0x4b1b('0x24'),_0x34b6a7[_0x4b1b('0x25')]);return _0x1b55e6(_0x34b6a7);}searchContact(_0x42d976,_0x42ba5d,_0x4b1b('0x26'),_0x34b6a7['contactNumber'])[_0x4b1b('0xb')](function(_0x5122d1){if(_0x5122d1){_0x34b6a7[_0x4b1b('0x25')]=_0x5122d1['id'];logger[_0x4b1b('0xf')](_0x4b1b('0x27'),_0x34b6a7[_0x4b1b('0x25')]);return _0x1b55e6(_0x34b6a7);}createEndUser(_0x34b6a7,_0x32c4ef,_0x42ba5d,_0x42d976)[_0x4b1b('0xb')](function(_0x52aaad){logger[_0x4b1b('0xf')](_0x4b1b('0x28'),_0x52aaad[_0x4b1b('0x25')]);return _0x1b55e6(_0x52aaad);});});})[_0x4b1b('0x12')](function(_0x64f91d){_0x38bd3e(_0x64f91d);});});};}function createEndUser(_0x3e24cf,_0x5ca9be,_0x286055,_0x5ecff5){return new Promise(function(_0x1177ad,_0x5c42c5){var _0x3641a3=moment();var _0x20ca41={'method':_0x4b1b('0x29'),'uri':_0x5ecff5+_0x4b1b('0x2a'),'body':{'contact':{'last_name':_0x3e24cf['contactNumber'],'work_number':_0x3e24cf[_0x4b1b('0x23')],'mobile_number':_0x3e24cf[_0x4b1b('0x23')],'owner_id':_0x3e24cf[_0x4b1b('0x19')],'created_at':_0x3641a3[_0x4b1b('0x21')](_0x4b1b('0x2b'))}},'json':!![]};_0x20ca41['headers']=_0x286055;logger[_0x4b1b('0xf')](_0x4b1b('0x2c'));return rp(_0x20ca41)[_0x4b1b('0xb')](function(_0x5456a6){_0x3e24cf['endUserId']=_0x5456a6[_0x4b1b('0x2d')]['id'];_0x1177ad(_0x3e24cf);})['catch'](function(_0x2d4422){logger[_0x4b1b('0x1d')]('['+[_0x5ca9be[_0x4b1b('0x13')]()]+']',_0x2d4422[_0x4b1b('0x14')]);_0x5c42c5(_0x2d4422[_0x4b1b('0x14')]);});});}function getTicket(_0x297c7b,_0x15b1f4,_0x575682,_0x211b9a,_0x4203a2){return function(_0x242e00){logger[_0x4b1b('0xf')](_0x4b1b('0x2e'));return new Promise(function(_0x136174,_0xcaf02f){var _0x110cf9=moment();var _0x4c7890={'method':_0x4b1b('0x29'),'uri':_0x575682+_0x4b1b('0x2f'),'body':{'title':intUtil[_0x4b1b('0x30')](_0x211b9a[_0x4b1b('0x31')],_0x4203a2,'\x20'),'description':intUtil[_0x4b1b('0x30')](_0x211b9a[_0x4b1b('0x32')],_0x4203a2,'\x0a'),'owner_id':_0x242e00[_0x4b1b('0x19')],'creater_id':_0x242e00[_0x4b1b('0xe')],'targetable_id':_0x242e00[_0x4b1b('0x25')],'targetable_type':'Contact','created_at':_0x110cf9[_0x4b1b('0x21')](_0x4b1b('0x2b')),'due_date':_0x110cf9[_0x4b1b('0x33')](0x1e,'m')[_0x4b1b('0x21')](_0x4b1b('0x2b'))},'json':!![]};_0x4c7890['headers']=_0x15b1f4;return rp(_0x4c7890)[_0x4b1b('0xb')](function(_0x25ac55){_0x242e00[_0x4b1b('0x34')]=_0x25ac55[_0x4b1b('0x35')]['id'];logger[_0x4b1b('0xf')](_0x4b1b('0x36'),_0x242e00['ticketId']);_0x136174(_0x242e00);})[_0x4b1b('0x12')](function(_0x22766d){logger[_0x4b1b('0x1d')]('['+[_0x297c7b[_0x4b1b('0x13')]()]+']',_0x22766d['message']);_0xcaf02f(_0x22766d['message']);});});};}function emit(_0x437065,_0xbf1606,_0x1f551b){var _0x12b957={'uri':_0x437065+_0x4b1b('0x37')+_0x1f551b};io['to'](util['format'](_0x4b1b('0x38'),_0xbf1606))[_0x4b1b('0x39')](_0x4b1b('0x3a'),_0x12b957);}exports['cs']=function(_0x1df4e8,_0x50b1fd,_0x22e47b,_0x52af30,_0x4f9b7b,_0x50df49,_0x2686cd,_0x1c7d07){var _0x31f889={};var _0x2a6b5c={'Authorization':_0x4b1b('0x3b')+_0x50df49[_0x4b1b('0x3c')]};_0x50df49[_0x4b1b('0x3d')]=intUtil['stripTrailingSlash'](_0x50df49['remoteUri']);_0x50df49['serverUrl']=intUtil[_0x4b1b('0x3e')](_0x50df49[_0x4b1b('0x3f')]);var _0x165a10=_0x50df49['remoteUri'];_0x31f889[_0x4b1b('0x1c')]=_0x50df49[_0x4b1b('0x40')];_0x31f889['contactNumber']=_0x1c7d07[_0x4b1b('0x41')]()===_0x4b1b('0x42')?_0x50b1fd[_0x4b1b('0x43')]:_0x50b1fd['calleridnum'];_0x31f889[_0x4b1b('0x44')]=_0x1c7d07==='queue'||_0x1c7d07===_0x4b1b('0x45')?_0x4b1b('0x46'):_0x4b1b('0x42');if(_0x52af30){_0x31f889['agentEmail']=_0x52af30[_0x4b1b('0xd')];}var _0x53a758=util[_0x4b1b('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x50df49['serverUrl'],_0x50b1fd['uniqueid'],md5(_0x50b1fd['uniqueid']));if(_0x4f9b7b&&_0x4f9b7b[_0x4b1b('0x47')]){logger['info']('[QUEUE]',_0x4b1b('0x48'));_0x50b1fd[_0x4b1b('0x49')]=_0x53a758;}else if(_0x2686cd&&_0x2686cd[_0x4b1b('0x4a')]&&_0x2686cd[_0x4b1b('0x4a')]!=='none'){logger[_0x4b1b('0xf')](_0x4b1b('0x4b'),'Recording\x20is\x20enabled!');_0x50b1fd[_0x4b1b('0x49')]=_0x53a758;}else{_0x50b1fd[_0x4b1b('0x49')]='';}return getAdminId(_0x31f889,_0x1c7d07,_0x2a6b5c,_0x165a10)[_0x4b1b('0xb')](getUser(_0x1c7d07,_0x2a6b5c,_0x165a10))['then'](getEndUser(_0x1c7d07,_0x2a6b5c,_0x165a10))[_0x4b1b('0xb')](getTicket(_0x1c7d07,_0x2a6b5c,_0x165a10,_0x22e47b,_0x50b1fd))[_0x4b1b('0xb')](function(_0x1dd31b){logger[_0x4b1b('0xf')](util[_0x4b1b('0x21')](_0x4b1b('0x4c'),_0x1dd31b[_0x4b1b('0x34')]));if(_0x1c7d07!==_0x4b1b('0x45')){logger[_0x4b1b('0xf')]('['+[_0x1c7d07[_0x4b1b('0x13')]()]+']',_0x4b1b('0x4d'));emit(_0x165a10,_0x52af30['name'],_0x1dd31b['endUserId']);}})[_0x4b1b('0x12')](function(_0xe73e2a){logger[_0x4b1b('0x1d')]('['+[_0x1c7d07[_0x4b1b('0x13')]()]+_0x4b1b('0x4e'),util[_0x4b1b('0x4f')](_0xe73e2a,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1fd6=['contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','ticketId','task','/contacts/','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','destcalleridnum','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','bluebird','ioredis','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','/api/selector/owners','then','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','adminEmail','toUpperCase','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s'];(function(_0x319dfe,_0x49b997){var _0x3c5996=function(_0x22f7cb){while(--_0x22f7cb){_0x319dfe['push'](_0x319dfe['shift']());}};_0x3c5996(++_0x49b997);}(_0x1fd6,0xcf));var _0x61fd=function(_0x42dfcf,_0x2672c7){_0x42dfcf=_0x42dfcf-0x0;var _0x2e1d0e=_0x1fd6[_0x42dfcf];return _0x2e1d0e;};'use strict';var _=require('lodash');var rp=require(_0x61fd('0x0'));var md5=require(_0x61fd('0x1'));var util=require(_0x61fd('0x2'));var moment=require(_0x61fd('0x3'));var Promise=require(_0x61fd('0x4'));var Redis=require(_0x61fd('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x61fd('0x6'))(_0x61fd('0x7'));config[_0x61fd('0x8')]=_['defaults'](config[_0x61fd('0x8')],{'host':_0x61fd('0x9'),'port':0x18eb});var io=require(_0x61fd('0xa'))(new Redis(config[_0x61fd('0x8')]));function getAdminId(_0x5a8d99,_0x3d337a,_0x13d526,_0x328058){return new Promise(function(_0x3026ca,_0x3b2af0){var _0x502049=![];var _0x4604eb={'method':_0x61fd('0xb'),'uri':_0x328058+'/api/selector/owners','json':!![]};_0x4604eb[_0x61fd('0xc')]=_0x13d526;logger[_0x61fd('0xd')](_0x61fd('0xe'));return rp(_0x4604eb)['then'](function(_0xf6dd36){if(_0xf6dd36){var _0x177a2c=_0xf6dd36[_0x61fd('0xf')];var _0x417281=null;for(_0x417281=0x0;_0x417281<_0x177a2c[_0x61fd('0x10')];_0x417281++){if(_0x177a2c[_0x417281][_0x61fd('0x11')]===_0x5a8d99['adminEmail']){_0x5a8d99[_0x61fd('0x12')]=_0x177a2c[_0x417281]['id'];_0x502049=!![];}}if(_0x502049){logger[_0x61fd('0xd')](_0x61fd('0x13'),_0x5a8d99[_0x61fd('0x12')]);_0x3026ca(_0x5a8d99);}else{_0x3b2af0({'statusCode':0x194,'message':_0x61fd('0x14')});}}else{_0x3b2af0({'statusCode':0x194,'message':_0x61fd('0x14')});}})[_0x61fd('0x15')](function(_0x86b44b){logger[_0x61fd('0x16')]('['+[_0x3d337a['toUpperCase']()]+']',_0x86b44b[_0x61fd('0x17')]);_0x3b2af0(_0x86b44b);});});}function getUser(_0xb95b17,_0x476317,_0x2555c1){return function(_0x2862c9){return new Promise(function(_0xae8f8c,_0x349481){var _0x9cde79={'method':'GET','uri':_0x2555c1+_0x61fd('0x18'),'json':!![]};_0x9cde79[_0x61fd('0xc')]=_0x476317;logger[_0x61fd('0xd')]('Getting\x20user\x20list');return rp(_0x9cde79)[_0x61fd('0x19')](function(_0x5567b6){if(_0x5567b6){var _0x4a70be=_0x5567b6[_0x61fd('0xf')];var _0x367a8a=![];var _0x21e46d=null;if(_0x2862c9[_0x61fd('0x1a')]!==null){logger[_0x61fd('0xd')]('Getting\x20user\x20with\x20email',_0x2862c9[_0x61fd('0x1a')]);_0x2862c9[_0x61fd('0x1b')]=_0x2862c9[_0x61fd('0x1a')];for(_0x21e46d=0x0;_0x21e46d<_0x4a70be[_0x61fd('0x10')];_0x21e46d++){if(_0x4a70be[_0x21e46d]['email']===_0x2862c9[_0x61fd('0x1a')]){_0x367a8a=!![];_0x2862c9[_0x61fd('0x1c')]=_0x4a70be[_0x21e46d]['id'];logger[_0x61fd('0xd')](_0x61fd('0x1d'),_0x2862c9['userId']);}}}if(!_0x367a8a){logger[_0x61fd('0xd')](_0x61fd('0x1e'));_0x2862c9['userEmail']=_0x2862c9[_0x61fd('0x1f')];_0x2862c9[_0x61fd('0x1c')]=_0x2862c9[_0x61fd('0x12')];_0x367a8a=!![];}if(_0x367a8a){_0xae8f8c(_0x2862c9);}else{_0x349481({'statusCode':0x194,'message':_0x61fd('0x14')});}}else{_0x349481({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x61fd('0x15')](function(_0x1a350b){logger[_0x61fd('0x16')]('['+[_0xb95b17[_0x61fd('0x20')]()]+']',_0x1a350b['message']);_0x349481(_0x1a350b);});});};}function searchContact(_0x4772c8,_0x1e5b23,_0x4442a6,_0x1ea21f){return new Promise(function(_0x231f96,_0x4feee0){var _0x245364={'method':_0x61fd('0xb'),'headers':_0x1e5b23,'uri':_0x4772c8+_0x61fd('0x21')+_0x1ea21f+_0x61fd('0x22')+_0x4442a6+'&entities=contact','json':!![]};rp(_0x245364)[_0x61fd('0x19')](function(_0x26b59e){var _0x66fece=_[_0x61fd('0x23')](_0x26b59e[_0x61fd('0x24')][_0x61fd('0x24')],[_0x4442a6,_0x1ea21f]);_0x231f96(_0x66fece);})[_0x61fd('0x15')](function(_0x4d1123){_0x4feee0(_0x4d1123);});});}function getEndUser(_0x3e6710,_0x15379d,_0x57a8b6){return function(_0x54afb7){return new Promise(function(_0x586c15,_0x2c0c30){logger[_0x61fd('0xd')](util[_0x61fd('0x25')](_0x61fd('0x26'),_0x54afb7[_0x61fd('0x27')]));searchContact(_0x57a8b6,_0x15379d,_0x61fd('0x28'),_0x54afb7[_0x61fd('0x27')])[_0x61fd('0x19')](function(_0x5effd8){if(_0x5effd8){_0x54afb7[_0x61fd('0x29')]=_0x5effd8['id'];logger['info'](_0x61fd('0x2a'),_0x54afb7[_0x61fd('0x29')]);return _0x586c15(_0x54afb7);}searchContact(_0x57a8b6,_0x15379d,_0x61fd('0x2b'),_0x54afb7[_0x61fd('0x27')])['then'](function(_0x3538a6){if(_0x3538a6){_0x54afb7[_0x61fd('0x29')]=_0x3538a6['id'];logger[_0x61fd('0xd')](_0x61fd('0x2c'),_0x54afb7[_0x61fd('0x29')]);return _0x586c15(_0x54afb7);}createEndUser(_0x54afb7,_0x3e6710,_0x15379d,_0x57a8b6)[_0x61fd('0x19')](function(_0x501734){logger[_0x61fd('0xd')](_0x61fd('0x2d'),_0x501734[_0x61fd('0x29')]);return _0x586c15(_0x501734);});});})[_0x61fd('0x15')](function(_0x549459){_0x2c0c30(_0x549459);});});};}function createEndUser(_0x5b6eb1,_0x56c45e,_0x10e1e1,_0x266403){return new Promise(function(_0x2e8700,_0x301ddc){var _0x538659=moment();var _0x1b60ee={'method':_0x61fd('0x2e'),'uri':_0x266403+_0x61fd('0x2f'),'body':{'contact':{'last_name':_0x5b6eb1[_0x61fd('0x27')],'work_number':_0x5b6eb1['contactNumber'],'mobile_number':_0x5b6eb1[_0x61fd('0x27')],'owner_id':_0x5b6eb1[_0x61fd('0x1c')],'created_at':_0x538659[_0x61fd('0x25')](_0x61fd('0x30'))}},'json':!![]};_0x1b60ee[_0x61fd('0xc')]=_0x10e1e1;logger[_0x61fd('0xd')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x1b60ee)[_0x61fd('0x19')](function(_0x19e6b3){_0x5b6eb1['endUserId']=_0x19e6b3[_0x61fd('0x31')]['id'];_0x2e8700(_0x5b6eb1);})[_0x61fd('0x15')](function(_0x9bc821){logger[_0x61fd('0x16')]('['+[_0x56c45e[_0x61fd('0x20')]()]+']',_0x9bc821[_0x61fd('0x17')]);_0x301ddc(_0x9bc821[_0x61fd('0x17')]);});});}function getTicket(_0x2ba642,_0x1d456c,_0x2ebfda,_0x4eec64,_0x13a441){return function(_0x298456){logger[_0x61fd('0xd')](_0x61fd('0x32'));return new Promise(function(_0x42b1cb,_0x17cbc1){var _0xce7378=moment();var _0x3dca0a={'method':_0x61fd('0x2e'),'uri':_0x2ebfda+_0x61fd('0x33'),'body':{'title':intUtil[_0x61fd('0x34')](_0x4eec64['Subjects'],_0x13a441,'\x20'),'description':intUtil[_0x61fd('0x34')](_0x4eec64[_0x61fd('0x35')],_0x13a441,'\x0a'),'owner_id':_0x298456[_0x61fd('0x1c')],'creater_id':_0x298456[_0x61fd('0x12')],'targetable_id':_0x298456[_0x61fd('0x29')],'targetable_type':_0x61fd('0x36'),'created_at':_0xce7378[_0x61fd('0x25')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0xce7378['add'](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3dca0a[_0x61fd('0xc')]=_0x1d456c;return rp(_0x3dca0a)[_0x61fd('0x19')](function(_0x57bdce){_0x298456[_0x61fd('0x37')]=_0x57bdce[_0x61fd('0x38')]['id'];logger[_0x61fd('0xd')]('Task\x20created:',_0x298456[_0x61fd('0x37')]);_0x42b1cb(_0x298456);})['catch'](function(_0x2d69fe){logger['error']('['+[_0x2ba642[_0x61fd('0x20')]()]+']',_0x2d69fe[_0x61fd('0x17')]);_0x17cbc1(_0x2d69fe[_0x61fd('0x17')]);});});};}function emit(_0x66ad43,_0x267c33,_0x4f7fc7){var _0xa5e9b0={'uri':_0x66ad43+_0x61fd('0x39')+_0x4f7fc7};io['to'](util[_0x61fd('0x25')]('user:%s',_0x267c33))[_0x61fd('0x3a')](_0x61fd('0x3b'),_0xa5e9b0);}exports['cs']=function(_0x59c7f3,_0x3d75d2,_0x45d5ed,_0x22e47b,_0x22953e,_0x37f5df,_0x496060,_0x158e0c){var _0x412deb={};var _0x202a13={'Authorization':_0x61fd('0x3c')+_0x37f5df[_0x61fd('0x3d')]};_0x37f5df[_0x61fd('0x3e')]=intUtil[_0x61fd('0x3f')](_0x37f5df[_0x61fd('0x3e')]);_0x37f5df[_0x61fd('0x40')]=intUtil[_0x61fd('0x3f')](_0x37f5df[_0x61fd('0x40')]);var _0x314ded=_0x37f5df['remoteUri'];_0x412deb[_0x61fd('0x1f')]=_0x37f5df['username'];_0x412deb[_0x61fd('0x27')]=_0x158e0c[_0x61fd('0x41')]()==='outbound'?_0x3d75d2[_0x61fd('0x42')]:_0x3d75d2['calleridnum'];_0x412deb['callDirection']=_0x158e0c===_0x61fd('0x43')||_0x158e0c===_0x61fd('0x44')?_0x61fd('0x43'):_0x61fd('0x45');if(_0x22e47b){_0x412deb[_0x61fd('0x1a')]=_0x22e47b[_0x61fd('0x11')];}var _0x18b814=util[_0x61fd('0x25')](_0x61fd('0x46'),_0x37f5df[_0x61fd('0x40')],_0x3d75d2[_0x61fd('0x47')],md5(_0x3d75d2[_0x61fd('0x47')]));if(_0x22953e&&_0x22953e['monitor_format']){logger[_0x61fd('0xd')](_0x61fd('0x48'),_0x61fd('0x49'));_0x3d75d2[_0x61fd('0x4a')]=_0x18b814;}else if(_0x496060&&_0x496060[_0x61fd('0x4b')]&&_0x496060['recordingFormat']!=='none'){logger[_0x61fd('0xd')](_0x61fd('0x4c'),_0x61fd('0x49'));_0x3d75d2[_0x61fd('0x4a')]=_0x18b814;}else{_0x3d75d2[_0x61fd('0x4a')]='';}return getAdminId(_0x412deb,_0x158e0c,_0x202a13,_0x314ded)['then'](getUser(_0x158e0c,_0x202a13,_0x314ded))[_0x61fd('0x19')](getEndUser(_0x158e0c,_0x202a13,_0x314ded))[_0x61fd('0x19')](getTicket(_0x158e0c,_0x202a13,_0x314ded,_0x45d5ed,_0x3d75d2))['then'](function(_0x7e1ae1){logger[_0x61fd('0xd')](util[_0x61fd('0x25')](_0x61fd('0x4d'),_0x7e1ae1['ticketId']));if(_0x158e0c!==_0x61fd('0x44')){logger[_0x61fd('0xd')]('['+[_0x158e0c['toUpperCase']()]+']',_0x61fd('0x4e'));emit(_0x314ded,_0x22e47b[_0x61fd('0x4f')],_0x7e1ae1[_0x61fd('0x29')]);}})[_0x61fd('0x15')](function(_0x5d0ef8){logger[_0x61fd('0x16')]('['+[_0x158e0c['toUpperCase']()]+_0x61fd('0x50'),util[_0x61fd('0x51')](_0x5d0ef8,{'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 75f8f0b..91c851d 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 _0xf2f9=['freshsales','servicenow','exec','toLowerCase','Configurations','data3','queue','routeId','outbound','log','unmanaged','data1','freshdesk','zoho','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','desk','vtiger','dynamics365'];(function(_0x5d5c32,_0x1f2f56){var _0x4c0964=function(_0x24bc99){while(--_0x24bc99){_0x5d5c32['push'](_0x5d5c32['shift']());}};_0x4c0964(++_0x1f2f56);}(_0xf2f9,0xec));var _0x9f2f=function(_0x107741,_0x135bfd){_0x107741=_0x107741-0x0;var _0x42f9e1=_0xf2f9[_0x107741];return _0x42f9e1;};'use strict';var _=require(_0x9f2f('0x0'));var util=require('util');var zendesk=require(_0x9f2f('0x1'));var salesforce=require(_0x9f2f('0x2'));var sugarcrm=require(_0x9f2f('0x3'));var freshdesk=require(_0x9f2f('0x4'));var zoho=require(_0x9f2f('0x5'));var desk=require(_0x9f2f('0x6'));var vtiger=require(_0x9f2f('0x7'));var servicenow=require(_0x9f2f('0x8'));var dynamics365=require(_0x9f2f('0x9'));var freshsales=require(_0x9f2f('0xa'));var integrations=[_0x9f2f('0xb'),'salesforce',_0x9f2f('0xc'),'freshdesk','zoho',_0x9f2f('0xd'),_0x9f2f('0xe'),_0x9f2f('0xf'),_0x9f2f('0x10'),_0x9f2f('0x11')];exports[_0x9f2f('0x12')]=function(_0x2db314,_0x45b43f,_0x3c5e77,_0x25c86e,_0xaf44a0,_0x3be471){if(_0x3c5e77){if(_['includes'](integrations,_0x2db314['data1'][_0x9f2f('0x13')]())){try{var _0x1b9687=null;var _0x51afb7='';var _0xb74211=_0x3c5e77[_0x2db314['data1'][_0x9f2f('0x13')]()];if(_0xb74211){var _0x104f37=_0xb74211[_0x2db314['data2']];if(_0x104f37){var _0x484ab1=_['find'](_0x104f37[_0x9f2f('0x14')],{'id':parseInt(_0x2db314[_0x9f2f('0x15')],0xa)});if(_0x484ab1){if(_0x25c86e){if(_0xaf44a0&&_0x45b43f[_0x9f2f('0x16')]){_0x51afb7=_0x9f2f('0x16');}else if(_0x45b43f[_0x9f2f('0x17')]){_0x51afb7=_0x9f2f('0x18');}else{console[_0x9f2f('0x19')]('EVENT\x20UNKNOWN',_0x45b43f);}}else{_0x51afb7=_0x9f2f('0x1a');}switch(_0x2db314[_0x9f2f('0x1b')][_0x9f2f('0x13')]()){case _0x9f2f('0xb'):zendesk[_0x51afb7](_0x2db314,_0x45b43f,_0x484ab1,_0x25c86e,_0xaf44a0,_0x104f37,_0x3be471);break;case'salesforce':salesforce[_0x51afb7](_0x2db314,_0x45b43f,_0x484ab1,_0x25c86e,_0xaf44a0,_0x104f37,_0x3be471);break;case _0x9f2f('0xc'):sugarcrm[_0x51afb7](_0x2db314,_0x45b43f,_0x484ab1,_0x25c86e,_0xaf44a0,_0x104f37,_0x3be471);break;case _0x9f2f('0x1c'):freshdesk[_0x51afb7](_0x2db314,_0x45b43f,_0x484ab1,_0x25c86e,_0xaf44a0,_0x104f37,_0x3be471);break;case _0x9f2f('0x1d'):zoho[_0x51afb7](_0x2db314,_0x45b43f,_0x484ab1,_0x25c86e,_0xaf44a0,_0x104f37,_0x3be471);break;case _0x9f2f('0xd'):desk[_0x51afb7](_0x2db314,_0x45b43f,_0x484ab1,_0x25c86e,_0xaf44a0,_0x104f37,_0x3be471);break;case _0x9f2f('0xe'):vtiger[_0x51afb7](_0x2db314,_0x45b43f,_0x484ab1,_0x25c86e,_0xaf44a0,_0x104f37,_0x3be471);break;case _0x9f2f('0x10'):freshsales['cs'](_0x2db314,_0x45b43f,_0x484ab1,_0x25c86e,_0xaf44a0,_0x104f37,_0x3be471,_0x51afb7);break;case _0x9f2f('0x11'):servicenow['cs'](_0x2db314,_0x45b43f,_0x484ab1,_0x25c86e,_0xaf44a0,_0x104f37,_0x3be471,_0x51afb7);break;case _0x9f2f('0xf'):dynamics365['cs'](_0x2db314,_0x45b43f,_0x484ab1,_0x25c86e,_0xaf44a0,_0x104f37,_0x3be471,_0x51afb7);break;default:console[_0x9f2f('0x19')]('unknown\x20integration');}}else{_0x1b9687=require(_0x9f2f('0x1e'))(_0x2db314['data1']['toLowerCase']());_0x1b9687[_0x9f2f('0x1f')]('[EXEC]',util[_0x9f2f('0x20')](_0x9f2f('0x21'),_0x2db314[_0x9f2f('0x1b')][_0x9f2f('0x13')](),_0x2db314['data3']));}}else{_0x1b9687=require('../../../../config/logger')(_0x2db314[_0x9f2f('0x1b')][_0x9f2f('0x13')]());_0x1b9687[_0x9f2f('0x1f')]('[EXEC]',util[_0x9f2f('0x20')](_0x9f2f('0x22'),_0x2db314[_0x9f2f('0x1b')][_0x9f2f('0x13')](),_0x2db314[_0x9f2f('0x23')]));}}else{}}catch(_0x4ed8e0){console[_0x9f2f('0x1f')](_0x4ed8e0);}}}}; \ No newline at end of file +var _0xc909=['error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data3','queue','EVENT\x20UNKNOWN','unmanaged','freshdesk','desk','log','../../../../config/logger'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc909,0xdd));var _0x9c90=function(_0x3e7e96,_0x5683ca){_0x3e7e96=_0x3e7e96-0x0;var _0x13f6f0=_0xc909[_0x3e7e96];return _0x13f6f0;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x9c90('0x0'));var salesforce=require(_0x9c90('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x9c90('0x2'));var zoho=require(_0x9c90('0x3'));var desk=require(_0x9c90('0x4'));var vtiger=require(_0x9c90('0x5'));var servicenow=require(_0x9c90('0x6'));var dynamics365=require(_0x9c90('0x7'));var freshsales=require(_0x9c90('0x8'));var integrations=[_0x9c90('0x9'),'salesforce',_0x9c90('0xa'),'freshdesk','zoho','desk',_0x9c90('0xb'),_0x9c90('0xc'),_0x9c90('0xd'),_0x9c90('0xe')];exports[_0x9c90('0xf')]=function(_0x468cd0,_0x5378b6,_0x2fe1e9,_0x45d5ff,_0x524a89,_0x25995f){if(_0x2fe1e9){if(_[_0x9c90('0x10')](integrations,_0x468cd0[_0x9c90('0x11')][_0x9c90('0x12')]())){try{var _0x31ab6d=null;var _0x4e045a='';var _0x1d0162=_0x2fe1e9[_0x468cd0[_0x9c90('0x11')][_0x9c90('0x12')]()];if(_0x1d0162){var _0x4ee185=_0x1d0162[_0x468cd0['data2']];if(_0x4ee185){var _0x2ce93f=_['find'](_0x4ee185['Configurations'],{'id':parseInt(_0x468cd0[_0x9c90('0x13')],0xa)});if(_0x2ce93f){if(_0x45d5ff){if(_0x524a89&&_0x5378b6[_0x9c90('0x14')]){_0x4e045a=_0x9c90('0x14');}else if(_0x5378b6['routeId']){_0x4e045a='outbound';}else{console['log'](_0x9c90('0x15'),_0x5378b6);}}else{_0x4e045a=_0x9c90('0x16');}switch(_0x468cd0[_0x9c90('0x11')][_0x9c90('0x12')]()){case _0x9c90('0x9'):zendesk[_0x4e045a](_0x468cd0,_0x5378b6,_0x2ce93f,_0x45d5ff,_0x524a89,_0x4ee185,_0x25995f);break;case'salesforce':salesforce[_0x4e045a](_0x468cd0,_0x5378b6,_0x2ce93f,_0x45d5ff,_0x524a89,_0x4ee185,_0x25995f);break;case _0x9c90('0xa'):sugarcrm[_0x4e045a](_0x468cd0,_0x5378b6,_0x2ce93f,_0x45d5ff,_0x524a89,_0x4ee185,_0x25995f);break;case _0x9c90('0x17'):freshdesk[_0x4e045a](_0x468cd0,_0x5378b6,_0x2ce93f,_0x45d5ff,_0x524a89,_0x4ee185,_0x25995f);break;case'zoho':zoho[_0x4e045a](_0x468cd0,_0x5378b6,_0x2ce93f,_0x45d5ff,_0x524a89,_0x4ee185,_0x25995f);break;case _0x9c90('0x18'):desk[_0x4e045a](_0x468cd0,_0x5378b6,_0x2ce93f,_0x45d5ff,_0x524a89,_0x4ee185,_0x25995f);break;case'vtiger':vtiger[_0x4e045a](_0x468cd0,_0x5378b6,_0x2ce93f,_0x45d5ff,_0x524a89,_0x4ee185,_0x25995f);break;case _0x9c90('0xd'):freshsales['cs'](_0x468cd0,_0x5378b6,_0x2ce93f,_0x45d5ff,_0x524a89,_0x4ee185,_0x25995f,_0x4e045a);break;case'servicenow':servicenow['cs'](_0x468cd0,_0x5378b6,_0x2ce93f,_0x45d5ff,_0x524a89,_0x4ee185,_0x25995f,_0x4e045a);break;case _0x9c90('0xc'):dynamics365['cs'](_0x468cd0,_0x5378b6,_0x2ce93f,_0x45d5ff,_0x524a89,_0x4ee185,_0x25995f,_0x4e045a);break;default:console[_0x9c90('0x19')]('unknown\x20integration');}}else{_0x31ab6d=require(_0x9c90('0x1a'))(_0x468cd0[_0x9c90('0x11')]['toLowerCase']());_0x31ab6d[_0x9c90('0x1b')](_0x9c90('0x1c'),util[_0x9c90('0x1d')]('%s\x20configuration\x20#%s\x20not\x20found',_0x468cd0[_0x9c90('0x11')][_0x9c90('0x12')](),_0x468cd0[_0x9c90('0x13')]));}}else{_0x31ab6d=require(_0x9c90('0x1a'))(_0x468cd0[_0x9c90('0x11')][_0x9c90('0x12')]());_0x31ab6d[_0x9c90('0x1b')](_0x9c90('0x1c'),util['format'](_0x9c90('0x1e'),_0x468cd0['data1']['toLowerCase'](),_0x468cd0['data2']));}}else{}}catch(_0x27e219){console[_0x9c90('0x1b')](_0x27e219);}}}}; \ 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 1902571..b388ae1 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 _0x26a0=['lead','Case','ContactId','account','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','length','Email','Agent\x20%s\x20found.','resolve','Name','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','info','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','execute','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Phone','type','toLowerCase','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','string','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','uniqueid','email','Fields','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','unmanaged','monitor_format','toUpperCase','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','calleridname','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','emit','assign','getString','Subjects','Descriptions','ticketType','Task','IsReminderSet','IsRecurrence','endUserType','contact'];(function(_0x5ddec9,_0x209a36){var _0x5abb94=function(_0x5816db){while(--_0x5816db){_0x5ddec9['push'](_0x5ddec9['shift']());}};_0x5abb94(++_0x209a36);}(_0x26a0,0xe5));var _0x026a=function(_0x3a2e0e,_0x5d557f){_0x3a2e0e=_0x3a2e0e-0x0;var _0x363ddc=_0x26a0[_0x3a2e0e];return _0x363ddc;};'use strict';var _=require(_0x026a('0x0'));var rp=require(_0x026a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var jsforce=require(_0x026a('0x2'));var util=require(_0x026a('0x3'));var Redis=require(_0x026a('0x4'));var intUtil=require(_0x026a('0x5'));var config=require(_0x026a('0x6'));var logger=require('../../../../config/logger')(_0x026a('0x7'));config[_0x026a('0x8')]=_[_0x026a('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x026a('0x8')]));function emit(_0x3ebca8,_0x32567b,_0x376210){io['to'](_0x3ebca8)[_0x026a('0xa')](_0x32567b,_0x376210);}function getTicket(_0x272640,_0x2b7ed0,_0x44096e,_0x529890,_0x864af2,_0x11ca1a,_0x450b11,_0x21f0ed){var _0x265b4d=Object[_0x026a('0xb')]({},{'OwnerId':_0x2b7ed0['id'],'Subject':intUtil[_0x026a('0xc')](_0x529890[_0x026a('0xd')],_0x864af2,'\x20'),'Description':intUtil[_0x026a('0xc')](_0x529890[_0x026a('0xe')],_0x864af2,'\x0a')},getCustomFields(_0x11ca1a,_0x864af2));if(_0x44096e){if(_0x529890[_0x026a('0xf')]===_0x026a('0x10')){_0x265b4d['ActivityDate']=moment['utc']();_0x265b4d[_0x026a('0x11')]=![];_0x265b4d[_0x026a('0x12')]=![];if(_0x44096e[_0x026a('0x13')]===_0x026a('0x14')||_0x44096e['endUserType']===_0x026a('0x15')){_0x265b4d['WhoId']=_0x44096e['id'];}else if(_0x44096e[_0x026a('0x13')]==='account'){_0x265b4d['WhatId']=_0x44096e['id'];}}else if(_0x529890[_0x026a('0xf')]===_0x026a('0x16')){if(_0x44096e[_0x026a('0x13')]===_0x026a('0x14')){_0x265b4d[_0x026a('0x17')]=_0x44096e['id'];}else if(_0x44096e[_0x026a('0x13')]===_0x026a('0x18')){_0x265b4d[_0x026a('0x19')]=_0x44096e['id'];}else if(_0x44096e[_0x026a('0x13')]==='lead'&&_0x529890[_0x026a('0x1a')]){_0x265b4d[_0x529890['leadId']]=_0x44096e['id'];}else{logger['info'](_0x026a('0x1b'));}}}return _0x450b11[_0x026a('0x1c')](_0x529890['ticketType'])['create'](_0x265b4d);}function getUser(_0x2da228,_0x3fa7d8,_0x2beffe){if(!_[_0x026a('0x1d')](_0x3fa7d8)&&intUtil[_0x026a('0x1e')](_0x3fa7d8)){var _0x284fe6={'Email':_0x3fa7d8};var _0x10861a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2beffe['sobject'](_0x026a('0x1f'))[_0x026a('0x20')](_0x284fe6,_0x10861a)['execute']()['then'](function(_0x1b7205){if(_0x1b7205[_0x026a('0x21')]){var _0x784ad=_[_0x026a('0x20')](_0x1b7205,function(_0x2ffef8){return _0x2ffef8[_0x026a('0x22')]===_0x3fa7d8;});if(_0x784ad){logger['info'](_0x026a('0x23'),_0x3fa7d8);return BPromise[_0x026a('0x24')]({'id':_0x784ad['Id'],'name':_0x784ad[_0x026a('0x25')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3fa7d8);return _0x2beffe['identity']()['then'](function(_0x4a6869){return BPromise['resolve']({'id':_0x4a6869[_0x026a('0x26')],'name':_0x4a6869[_0x026a('0x27')]});});}});}else{logger['info'](_0x026a('0x28'),_0x3fa7d8);return _0x2beffe[_0x026a('0x29')]()[_0x026a('0x2a')](function(_0x2975cc){return BPromise[_0x026a('0x24')]({'id':_0x2975cc[_0x026a('0x26')],'name':_0x2975cc[_0x026a('0x27')]});});}}function getEndUser(_0x2fe2bc,_0x1c5e31,_0xa41859,_0x56225b,_0x2accb2){var _0xc17d0={'$or':{'Phone':_0x56225b}};var _0x4b0066={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x026a('0x24')]()['then'](function(){logger[_0x026a('0x2b')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x56225b,_0x1c5e31['moduleSearch']);switch(_0x1c5e31[_0x026a('0x2c')]){case _0x026a('0x2d'):var _0x10c636=_[_0x026a('0x2e')](_0xc17d0);if(_0x1c5e31[_0x026a('0x2f')]){var _0x57898f={};_0x57898f[_0x1c5e31[_0x026a('0x2f')]]=_0x56225b;_[_0x026a('0x30')](_0x10c636[_0x026a('0x31')],_0x57898f);}return _0x2accb2[_0x026a('0x1c')]('Contact')['find'](_0x10c636,_0x4b0066)[_0x026a('0x32')]()[_0x026a('0x2a')](function(_0x1f60a3){if(_0x1f60a3&&_0x1f60a3[_0x026a('0x21')]){return _0x1f60a3;}else{var _0x55b602=_[_0x026a('0x2e')](_0xc17d0);if(_0x1c5e31[_0x026a('0x33')]){var _0x20eedd={};_0x20eedd[_0x1c5e31[_0x026a('0x33')]]=_0x56225b;_['merge'](_0x55b602[_0x026a('0x31')],_0x20eedd);}return _0x2accb2[_0x026a('0x1c')](_0x026a('0x34'))[_0x026a('0x20')](_0x55b602,_0x4b0066);}});case _0x026a('0x35'):var _0x38b3a6=_[_0x026a('0x2e')](_0xc17d0);if(_0x1c5e31[_0x026a('0x36')]){var _0x57898f={};_0x57898f[_0x1c5e31[_0x026a('0x36')]]=_0x56225b;_['merge'](_0x38b3a6['$or'],_0x57898f);}return _0x2accb2[_0x026a('0x1c')](_0x026a('0x37'))['find'](_0x38b3a6,_0x4b0066)[_0x026a('0x32')]()[_0x026a('0x2a')](function(_0x4650b6){if(_0x4650b6&&_0x4650b6[_0x026a('0x21')]){return _0x4650b6;}else{var _0x3f0206=_[_0x026a('0x2e')](_0xc17d0);if(_0x1c5e31[_0x026a('0x2f')]){var _0x3b274c={};_0x3b274c[_0x1c5e31[_0x026a('0x2f')]]=_0x56225b;_[_0x026a('0x30')](_0x3f0206[_0x026a('0x31')],_0x3b274c);}return _0x2accb2[_0x026a('0x1c')]('Contact')['find'](_0x3f0206,_0x4b0066)[_0x026a('0x2a')](function(_0xaa08d){if(_0xaa08d&&_0xaa08d[_0x026a('0x21')]){return _0xaa08d;}else{var _0x541de3=_['cloneDeep'](_0xc17d0);if(_0x1c5e31[_0x026a('0x33')]){var _0x4777eb={};_0x4777eb[_0x1c5e31['additionalSearchLead']]=_0x56225b;_['merge'](_0x541de3[_0x026a('0x31')],_0x4777eb);}return _0x2accb2[_0x026a('0x1c')](_0x026a('0x34'))['find'](_0x541de3,_0x4b0066);}});}});case _0x026a('0x14'):var _0x10c636=_['cloneDeep'](_0xc17d0);if(_0x1c5e31[_0x026a('0x2f')]){var _0x57898f={};_0x57898f[_0x1c5e31[_0x026a('0x2f')]]=_0x56225b;_[_0x026a('0x30')](_0x10c636[_0x026a('0x31')],_0x57898f);}return _0x2accb2[_0x026a('0x1c')](_0x026a('0x38'))[_0x026a('0x20')](_0x10c636,_0x4b0066)[_0x026a('0x32')]();case _0x026a('0x15'):var _0x3fd53a=_[_0x026a('0x2e')](_0xc17d0);if(_0x1c5e31['additionalSearchLead']){var _0x57898f={};_0x57898f[_0x1c5e31[_0x026a('0x33')]]=_0x56225b;_[_0x026a('0x30')](_0x3fd53a[_0x026a('0x31')],_0x57898f);}return _0x2accb2[_0x026a('0x1c')]('Lead')[_0x026a('0x20')](_0x3fd53a,_0x4b0066);case'account':var _0x38b3a6=_['cloneDeep'](_0xc17d0);if(_0x1c5e31[_0x026a('0x36')]){var _0x57898f={};_0x57898f[_0x1c5e31[_0x026a('0x36')]]=_0x56225b;_[_0x026a('0x30')](_0x38b3a6[_0x026a('0x31')],_0x57898f);}return _0x2accb2['sobject'](_0x026a('0x37'))[_0x026a('0x20')](_0x38b3a6,_0x4b0066);default:return null;}})[_0x026a('0x2a')](function(_0x37171a){if(_0x37171a&&_0x37171a[_0x026a('0x21')]){var _0x353e16=_[_0x026a('0x39')](_0x37171a);if(_0x353e16){return BPromise[_0x026a('0x24')]({'id':_0x353e16['Id'],'name':_0x353e16[_0x026a('0x25')],'phone':_0x353e16[_0x026a('0x3a')],'endUserType':_0x353e16['attributes'][_0x026a('0x3b')][_0x026a('0x3c')]()});}}})['then'](function(_0x14ab8f){if(_0x14ab8f){logger[_0x026a('0x2b')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x14ab8f[_0x026a('0x13')],_0x56225b);return BPromise[_0x026a('0x24')](_0x14ab8f);}else{logger[_0x026a('0x2b')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x56225b);var _0x37040c={'Phone':_0x56225b};if(_0x1c5e31[_0x026a('0x3d')]){if(_0x1c5e31[_0x026a('0x3d')]===_0x026a('0x14')){logger[_0x026a('0x2b')](_0x026a('0x3e'),_0x56225b,_0x1c5e31[_0x026a('0x3d')]);_0x37040c[_0x026a('0x3f')]=_0xa41859!==_0x026a('0x40')?_0xa41859:util[_0x026a('0x41')](_0x026a('0x42'),_0x56225b);}else if(_0x1c5e31[_0x026a('0x3d')]===_0x026a('0x15')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x56225b,_0x1c5e31[_0x026a('0x3d')]);_0x37040c[_0x026a('0x3f')]=_0xa41859!==''?_0xa41859:util[_0x026a('0x41')](_0x026a('0x42'),_0x56225b);_0x37040c[_0x026a('0x43')]='No\x20Company';}else if(_0x1c5e31[_0x026a('0x3d')]===_0x026a('0x18')){logger['info'](_0x026a('0x3e'),_0x56225b,_0x1c5e31[_0x026a('0x3d')]);_0x37040c[_0x026a('0x25')]=_0xa41859!==_0x026a('0x40')?_0xa41859:util['format']('Caller\x20-\x20%s',_0x56225b);}else{return null;}}return _0x2accb2['sobject'](_[_0x026a('0x44')](_0x1c5e31[_0x026a('0x3d')]))['create'](_0x37040c)[_0x026a('0x2a')](function(_0x54123c){return BPromise[_0x026a('0x24')]({'id':_0x54123c['id'],'endUserType':_0x1c5e31[_0x026a('0x3d')]});});}});}function getCustomFields(_0x56adfa,_0x5e44a5){var _0x3ba54a={};if(_0x56adfa[_0x026a('0x21')]>0x0){_[_0x026a('0x45')](_0x56adfa,function(_0x3a9a99){if(_[_0x026a('0x46')]([_0x026a('0x47'),'picklist'],_0x3a9a99[_0x026a('0x3b')])&&_0x3a9a99['idField']){_0x3ba54a[_0x3a9a99[_0x026a('0x48')]]=_0x3a9a99[_0x026a('0x49')][_0x026a('0x4a')]();}else if(_0x3a9a99['type']===_0x026a('0x4b')&&_0x3a9a99['variableName']&&_0x3a9a99[_0x026a('0x48')]){_0x5e44a5[_0x3a9a99[_0x026a('0x4c')]]&&(_0x3ba54a[_0x3a9a99[_0x026a('0x48')]]=_0x5e44a5[_0x3a9a99[_0x026a('0x4c')]][_0x026a('0x4a')]());}else if(_0x3a9a99['type']===_0x026a('0x4d')&&_0x3a9a99[_0x026a('0x4e')]&&_0x3a9a99[_0x026a('0x4e')][_0x026a('0x4f')]&&_0x3a9a99[_0x026a('0x48')]){_0x5e44a5[_0x3a9a99[_0x026a('0x4e')][_0x026a('0x4f')][_0x026a('0x3c')]()]&&(_0x3ba54a[_0x3a9a99['idField']]=_0x5e44a5[_0x3a9a99[_0x026a('0x4e')]['name'][_0x026a('0x3c')]()][_0x026a('0x4a')]());}});}return _0x3ba54a;}function getConnection(_0x322a20){var _0x5b9605=_0x322a20[_0x026a('0x50')][_0x026a('0x51')](_0x322a20[_0x026a('0x52')]);var _0x3083b4=new jsforce[(_0x026a('0x53'))]({'oauth2':{'loginUrl':_0x322a20[_0x026a('0x54')]||_0x026a('0x55'),'clientId':_0x322a20['clientId'],'clientSecret':_0x322a20[_0x026a('0x56')]}});return _0x3083b4[_0x026a('0x57')](_0x322a20[_0x026a('0x58')],_0x5b9605)['then'](function(){logger[_0x026a('0x2b')](_0x026a('0x59'));return _0x3083b4;});}exports[_0x026a('0x5a')]=function(_0x5a8cae,_0x26382a,_0x94e574,_0x19a3bc,_0x13e2e7,_0x2dbfaa){var _0x276061,_0x1801a7,_0x565a08,_0x2e54cc;_0x2dbfaa[_0x026a('0x5b')]=intUtil[_0x026a('0x5c')](_0x2dbfaa['serverUrl']);_0x2dbfaa['remoteUri']=intUtil[_0x026a('0x5c')](_0x2dbfaa[_0x026a('0x54')]);if(_0x13e2e7&&_0x13e2e7['monitor_format']){logger[_0x026a('0x2b')](_0x026a('0x5d'),'Recording\x20is\x20enabled!');_0x26382a[_0x026a('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2dbfaa[_0x026a('0x5b')],_0x26382a[_0x026a('0x5f')],md5(_0x26382a[_0x026a('0x5f')]));}else{_0x26382a[_0x026a('0x5e')]='';}return getConnection(_0x2dbfaa)[_0x026a('0x2a')](function(_0x207dc2){_0x2e54cc=_0x207dc2;return getUser(_0x2dbfaa,_0x19a3bc[_0x026a('0x60')],_0x2e54cc);})[_0x026a('0x2a')](function(_0x5d2e0a){_0x276061=_0x5d2e0a;return getEndUser(_0x2dbfaa,_0x94e574,_0x26382a['calleridname'],_0x26382a['calleridnum'],_0x2e54cc);})[_0x026a('0x2a')](function(_0x54a6cf){_0x1801a7=_0x54a6cf;return getTicket(_0x2dbfaa,_0x276061,_0x1801a7,_0x94e574,_0x26382a,_0x94e574[_0x026a('0x61')],_0x2e54cc,_0x026a('0x5a'));})[_0x026a('0x2a')](function(_0x34bb77){_0x565a08=_0x34bb77;logger[_0x026a('0x2b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x565a08['id']);logger[_0x026a('0x2b')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x565a08['id'],_0x19a3bc[_0x026a('0x4f')],_0x2dbfaa[_0x026a('0x3b')]);switch(_0x2dbfaa[_0x026a('0x3b')]){case _0x026a('0x62'):emit(util[_0x026a('0x41')]('user:%s',_0x19a3bc[_0x026a('0x4f')]),_0x026a('0x63'),{'recordId':_0x565a08['id']});break;case _0x026a('0x64'):emit(util[_0x026a('0x41')](_0x026a('0x65'),_0x19a3bc[_0x026a('0x4f')]),_0x026a('0x66'),{'uri':util['format']('%s/%s/e',_0x2e54cc[_0x026a('0x67')],_0x565a08['id'])});break;default:logger[_0x026a('0x68')](_0x026a('0x69'));}})[_0x026a('0x6a')](function(_0x632bc2){logger[_0x026a('0x68')](_0x026a('0x5d'),_0x632bc2);});};exports['outbound']=function(_0x243810,_0x278650,_0x5d486c,_0x1c30da,_0x41f716,_0x577f2d,_0x5bdcc9){var _0x1ddb47,_0x38d74b,_0x78af60,_0x1214a6;_0x577f2d[_0x026a('0x5b')]=intUtil[_0x026a('0x5c')](_0x577f2d[_0x026a('0x5b')]);_0x577f2d[_0x026a('0x54')]=intUtil[_0x026a('0x5c')](_0x577f2d['remoteUri']);if(_0x5bdcc9&&_0x5bdcc9[_0x026a('0x6b')]&&_0x5bdcc9[_0x026a('0x6b')]!==_0x026a('0x6c')){logger[_0x026a('0x2b')](_0x026a('0x6d'),'Recording\x20is\x20enabled!');_0x278650['recordingURL']=util[_0x026a('0x41')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x577f2d[_0x026a('0x5b')],_0x278650[_0x026a('0x5f')],md5(_0x278650[_0x026a('0x5f')]));}return getConnection(_0x577f2d)['then'](function(_0x1fb91d){_0x1214a6=_0x1fb91d;return getUser(_0x577f2d,_0x1c30da[_0x026a('0x60')],_0x1214a6);})[_0x026a('0x2a')](function(_0x3fd656){_0x1ddb47=_0x3fd656;return getEndUser(_0x577f2d,_0x5d486c,_0x278650[_0x026a('0x6e')],_0x278650[_0x026a('0x6f')],_0x1214a6);})['then'](function(_0x7ae208){_0x38d74b=_0x7ae208;return getTicket(_0x577f2d,_0x1ddb47,_0x38d74b,_0x5d486c,_0x278650,_0x5d486c['Fields'],_0x1214a6,_0x026a('0x70'));})[_0x026a('0x2a')](function(_0x4b7ac5){_0x78af60=_0x4b7ac5;logger[_0x026a('0x2b')](_0x026a('0x71'),_0x78af60['id']);logger[_0x026a('0x2b')](_0x026a('0x72'),_0x78af60['id'],_0x1c30da['name'],_0x577f2d[_0x026a('0x3b')]);switch(_0x577f2d['type']){case _0x026a('0x62'):emit(util['format'](_0x026a('0x65'),_0x1c30da[_0x026a('0x4f')]),_0x026a('0x63'),{'recordId':_0x78af60['id']});break;case _0x026a('0x64'):emit(util[_0x026a('0x41')](_0x026a('0x65'),_0x1c30da[_0x026a('0x4f')]),_0x026a('0x66'),{'uri':util[_0x026a('0x41')](_0x026a('0x73'),_0x1214a6[_0x026a('0x67')],_0x78af60['id'])});break;default:logger[_0x026a('0x68')](_0x026a('0x6d'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x026a('0x6a')](function(_0x34267f){logger['error'](_0x026a('0x6d'),_0x34267f);});};exports[_0x026a('0x74')]=function(_0x14ca31,_0x1c9468,_0x53342c,_0x40b275,_0x33c46c,_0xb9dbad){var _0x19b220,_0x1aa306,_0x3c829e,_0x6cd90f;_0xb9dbad[_0x026a('0x5b')]=intUtil['stripTrailingSlash'](_0xb9dbad[_0x026a('0x5b')]);_0xb9dbad[_0x026a('0x54')]=intUtil[_0x026a('0x5c')](_0xb9dbad[_0x026a('0x54')]);if(_0x33c46c&&_0x33c46c[_0x026a('0x75')]){logger[_0x026a('0x2b')]('['+_0x1c9468['lastevent'][_0x026a('0x76')]()+']',_0x026a('0x77'));_0x1c9468[_0x026a('0x5e')]=util[_0x026a('0x41')](_0x026a('0x78'),_0xb9dbad[_0x026a('0x5b')],_0x1c9468[_0x026a('0x5f')],md5(_0x1c9468[_0x026a('0x5f')]));}else{_0x1c9468[_0x026a('0x5e')]='';}return getConnection(_0xb9dbad)[_0x026a('0x2a')](function(_0x8f94a3){_0x6cd90f=_0x8f94a3;if(!_['isNil'](_0x40b275)){return getUser(_0xb9dbad,_0x40b275[_0x026a('0x4f')],_0x6cd90f);}else{return getUser(_0xb9dbad,null,_0x6cd90f);}})[_0x026a('0x2a')](function(_0x2aa4ba){_0x19b220=_0x2aa4ba;return getEndUser(_0xb9dbad,_0x53342c,_0x1c9468[_0x026a('0x79')],_0x1c9468['calleridnum'],_0x6cd90f);})[_0x026a('0x2a')](function(_0x5b984d){_0x1aa306=_0x5b984d;return getTicket(_0xb9dbad,_0x19b220,_0x1aa306,_0x53342c,_0x1c9468,_0x53342c[_0x026a('0x61')],_0x6cd90f);})[_0x026a('0x2a')](function(_0xe11afe){_0x3c829e=_0xe11afe;logger[_0x026a('0x2b')]('['+_0x1c9468[_0x026a('0x7a')][_0x026a('0x76')]()+_0x026a('0x7b'),_0x3c829e['id']);logger[_0x026a('0x2b')]('['+_0x1c9468[_0x026a('0x7a')][_0x026a('0x76')]()+_0x026a('0x7c'),_0xb9dbad['type']);})[_0x026a('0x6a')](function(_0x4e35b1){logger[_0x026a('0x68')]('['+_0x1c9468[_0x026a('0x7a')][_0x026a('0x76')]()+']',_0x4e35b1);});}; \ No newline at end of file +var _0xb5c4=['Account','Contact','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Caller\x20-\x20%s','LastName','format','Company','No\x20Company','includes','picklist','idField','variable','variableName','toString','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','IsReminderSet','endUserType','contact','lead','WhoId','WhatId','Case','ContactId','account','AccountId','leadId','info','sobject','create','isNil','User','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Name','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xb5c4,0x1c2));var _0x4b5c=function(_0x1a1e8c,_0x3d2df3){_0x1a1e8c=_0x1a1e8c-0x0;var _0x29b0c9=_0xb5c4[_0x1a1e8c];return _0x29b0c9;};'use strict';var _=require(_0x4b5c('0x0'));var rp=require(_0x4b5c('0x1'));var moment=require(_0x4b5c('0x2'));var BPromise=require(_0x4b5c('0x3'));var md5=require(_0x4b5c('0x4'));var jsforce=require('jsforce');var util=require(_0x4b5c('0x5'));var Redis=require(_0x4b5c('0x6'));var intUtil=require(_0x4b5c('0x7'));var config=require(_0x4b5c('0x8'));var logger=require(_0x4b5c('0x9'))(_0x4b5c('0xa'));config[_0x4b5c('0xb')]=_[_0x4b5c('0xc')](config['redis'],{'host':_0x4b5c('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4b5c('0xb')]));function emit(_0x106124,_0x196f84,_0xc1503){io['to'](_0x106124)[_0x4b5c('0xe')](_0x196f84,_0xc1503);}function getTicket(_0x3360d9,_0x3b92a4,_0x2c5c93,_0x26e541,_0x335975,_0x5930b1,_0x5d9d1d,_0x32e893){var _0x1b05c7=Object[_0x4b5c('0xf')]({},{'OwnerId':_0x3b92a4['id'],'Subject':intUtil[_0x4b5c('0x10')](_0x26e541[_0x4b5c('0x11')],_0x335975,'\x20'),'Description':intUtil[_0x4b5c('0x10')](_0x26e541[_0x4b5c('0x12')],_0x335975,'\x0a')},getCustomFields(_0x5930b1,_0x335975));if(_0x2c5c93){if(_0x26e541[_0x4b5c('0x13')]==='Task'){_0x1b05c7[_0x4b5c('0x14')]=moment['utc']();_0x1b05c7[_0x4b5c('0x15')]=![];_0x1b05c7['IsRecurrence']=![];if(_0x2c5c93[_0x4b5c('0x16')]===_0x4b5c('0x17')||_0x2c5c93[_0x4b5c('0x16')]===_0x4b5c('0x18')){_0x1b05c7[_0x4b5c('0x19')]=_0x2c5c93['id'];}else if(_0x2c5c93[_0x4b5c('0x16')]==='account'){_0x1b05c7[_0x4b5c('0x1a')]=_0x2c5c93['id'];}}else if(_0x26e541[_0x4b5c('0x13')]===_0x4b5c('0x1b')){if(_0x2c5c93[_0x4b5c('0x16')]===_0x4b5c('0x17')){_0x1b05c7[_0x4b5c('0x1c')]=_0x2c5c93['id'];}else if(_0x2c5c93[_0x4b5c('0x16')]===_0x4b5c('0x1d')){_0x1b05c7[_0x4b5c('0x1e')]=_0x2c5c93['id'];}else if(_0x2c5c93[_0x4b5c('0x16')]===_0x4b5c('0x18')&&_0x26e541['leadId']){_0x1b05c7[_0x26e541[_0x4b5c('0x1f')]]=_0x2c5c93['id'];}else{logger[_0x4b5c('0x20')]('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x5d9d1d[_0x4b5c('0x21')](_0x26e541['ticketType'])[_0x4b5c('0x22')](_0x1b05c7);}function getUser(_0x5b0a5d,_0xff267d,_0x5b83d3){if(!_[_0x4b5c('0x23')](_0xff267d)&&intUtil['validateEmail'](_0xff267d)){var _0x49220f={'Email':_0xff267d};var _0x4f97fa={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x5b83d3[_0x4b5c('0x21')](_0x4b5c('0x24'))[_0x4b5c('0x25')](_0x49220f,_0x4f97fa)[_0x4b5c('0x26')]()[_0x4b5c('0x27')](function(_0xe3d994){if(_0xe3d994['length']){var _0x1b0c90=_[_0x4b5c('0x25')](_0xe3d994,function(_0x57282d){return _0x57282d[_0x4b5c('0x28')]===_0xff267d;});if(_0x1b0c90){logger['info'](_0x4b5c('0x29'),_0xff267d);return BPromise[_0x4b5c('0x2a')]({'id':_0x1b0c90['Id'],'name':_0x1b0c90[_0x4b5c('0x2b')]});}}else{logger[_0x4b5c('0x20')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0xff267d);return _0x5b83d3['identity']()[_0x4b5c('0x27')](function(_0x4d59e8){return BPromise[_0x4b5c('0x2a')]({'id':_0x4d59e8[_0x4b5c('0x2c')],'name':_0x4d59e8[_0x4b5c('0x2d')]});});}});}else{logger[_0x4b5c('0x20')](_0x4b5c('0x2e'),_0xff267d);return _0x5b83d3['identity']()[_0x4b5c('0x27')](function(_0x3b55f9){return BPromise[_0x4b5c('0x2a')]({'id':_0x3b55f9['user_id'],'name':_0x3b55f9[_0x4b5c('0x2d')]});});}}function getEndUser(_0x37f44b,_0x178a3e,_0x517829,_0x53cad3,_0x581bd4){var _0x11b052={'$or':{'Phone':_0x53cad3}};var _0x22db7f={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x4b5c('0x27')](function(){logger[_0x4b5c('0x20')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x53cad3,_0x178a3e[_0x4b5c('0x2f')]);switch(_0x178a3e[_0x4b5c('0x2f')]){case _0x4b5c('0x30'):var _0x30ad11=_[_0x4b5c('0x31')](_0x11b052);if(_0x178a3e[_0x4b5c('0x32')]){var _0x5049bc={};_0x5049bc[_0x178a3e[_0x4b5c('0x32')]]=_0x53cad3;_[_0x4b5c('0x33')](_0x30ad11[_0x4b5c('0x34')],_0x5049bc);}return _0x581bd4['sobject']('Contact')[_0x4b5c('0x25')](_0x30ad11,_0x22db7f)[_0x4b5c('0x26')]()['then'](function(_0x46c980){if(_0x46c980&&_0x46c980[_0x4b5c('0x35')]){return _0x46c980;}else{var _0x1e5aa8=_['cloneDeep'](_0x11b052);if(_0x178a3e['additionalSearchLead']){var _0x122fe0={};_0x122fe0[_0x178a3e[_0x4b5c('0x36')]]=_0x53cad3;_[_0x4b5c('0x33')](_0x1e5aa8['$or'],_0x122fe0);}return _0x581bd4['sobject'](_0x4b5c('0x37'))[_0x4b5c('0x25')](_0x1e5aa8,_0x22db7f);}});case _0x4b5c('0x38'):var _0x48c62c=_[_0x4b5c('0x31')](_0x11b052);if(_0x178a3e['additionalSearchAccount']){var _0x5049bc={};_0x5049bc[_0x178a3e[_0x4b5c('0x39')]]=_0x53cad3;_[_0x4b5c('0x33')](_0x48c62c[_0x4b5c('0x34')],_0x5049bc);}return _0x581bd4[_0x4b5c('0x21')](_0x4b5c('0x3a'))[_0x4b5c('0x25')](_0x48c62c,_0x22db7f)[_0x4b5c('0x26')]()[_0x4b5c('0x27')](function(_0x38403a){if(_0x38403a&&_0x38403a[_0x4b5c('0x35')]){return _0x38403a;}else{var _0x4945ae=_['cloneDeep'](_0x11b052);if(_0x178a3e['additionalSearchContact']){var _0x699bdb={};_0x699bdb[_0x178a3e[_0x4b5c('0x32')]]=_0x53cad3;_[_0x4b5c('0x33')](_0x4945ae[_0x4b5c('0x34')],_0x699bdb);}return _0x581bd4[_0x4b5c('0x21')](_0x4b5c('0x3b'))[_0x4b5c('0x25')](_0x4945ae,_0x22db7f)[_0x4b5c('0x27')](function(_0x29027a){if(_0x29027a&&_0x29027a[_0x4b5c('0x35')]){return _0x29027a;}else{var _0x4564fb=_[_0x4b5c('0x31')](_0x11b052);if(_0x178a3e['additionalSearchLead']){var _0x13932b={};_0x13932b[_0x178a3e[_0x4b5c('0x36')]]=_0x53cad3;_[_0x4b5c('0x33')](_0x4564fb[_0x4b5c('0x34')],_0x13932b);}return _0x581bd4[_0x4b5c('0x21')](_0x4b5c('0x37'))[_0x4b5c('0x25')](_0x4564fb,_0x22db7f);}});}});case _0x4b5c('0x17'):var _0x30ad11=_[_0x4b5c('0x31')](_0x11b052);if(_0x178a3e[_0x4b5c('0x32')]){var _0x5049bc={};_0x5049bc[_0x178a3e[_0x4b5c('0x32')]]=_0x53cad3;_[_0x4b5c('0x33')](_0x30ad11[_0x4b5c('0x34')],_0x5049bc);}return _0x581bd4[_0x4b5c('0x21')](_0x4b5c('0x3b'))['find'](_0x30ad11,_0x22db7f)['execute']();case _0x4b5c('0x18'):var _0x2b9750=_[_0x4b5c('0x31')](_0x11b052);if(_0x178a3e[_0x4b5c('0x36')]){var _0x5049bc={};_0x5049bc[_0x178a3e[_0x4b5c('0x36')]]=_0x53cad3;_['merge'](_0x2b9750[_0x4b5c('0x34')],_0x5049bc);}return _0x581bd4[_0x4b5c('0x21')](_0x4b5c('0x37'))[_0x4b5c('0x25')](_0x2b9750,_0x22db7f);case'account':var _0x48c62c=_['cloneDeep'](_0x11b052);if(_0x178a3e[_0x4b5c('0x39')]){var _0x5049bc={};_0x5049bc[_0x178a3e[_0x4b5c('0x39')]]=_0x53cad3;_[_0x4b5c('0x33')](_0x48c62c['$or'],_0x5049bc);}return _0x581bd4[_0x4b5c('0x21')](_0x4b5c('0x3a'))[_0x4b5c('0x25')](_0x48c62c,_0x22db7f);default:return null;}})[_0x4b5c('0x27')](function(_0x5ace36){if(_0x5ace36&&_0x5ace36[_0x4b5c('0x35')]){var _0x5a9d87=_['first'](_0x5ace36);if(_0x5a9d87){return BPromise[_0x4b5c('0x2a')]({'id':_0x5a9d87['Id'],'name':_0x5a9d87['Name'],'phone':_0x5a9d87['Phone'],'endUserType':_0x5a9d87[_0x4b5c('0x3c')][_0x4b5c('0x3d')]['toLowerCase']()});}}})[_0x4b5c('0x27')](function(_0x9e1ad2){if(_0x9e1ad2){logger[_0x4b5c('0x20')](_0x4b5c('0x3e'),_0x9e1ad2[_0x4b5c('0x16')],_0x53cad3);return BPromise[_0x4b5c('0x2a')](_0x9e1ad2);}else{logger[_0x4b5c('0x20')](_0x4b5c('0x3f'),_0x53cad3);var _0x5d604b={'Phone':_0x53cad3};if(_0x178a3e[_0x4b5c('0x40')]){if(_0x178a3e['moduleCreate']===_0x4b5c('0x17')){logger['info'](_0x4b5c('0x41'),_0x53cad3,_0x178a3e[_0x4b5c('0x40')]);_0x5d604b['LastName']=_0x517829!==_0x4b5c('0x42')?_0x517829:util['format'](_0x4b5c('0x43'),_0x53cad3);}else if(_0x178a3e[_0x4b5c('0x40')]==='lead'){logger[_0x4b5c('0x20')](_0x4b5c('0x41'),_0x53cad3,_0x178a3e[_0x4b5c('0x40')]);_0x5d604b[_0x4b5c('0x44')]=_0x517829!==''?_0x517829:util[_0x4b5c('0x45')](_0x4b5c('0x43'),_0x53cad3);_0x5d604b[_0x4b5c('0x46')]=_0x4b5c('0x47');}else if(_0x178a3e[_0x4b5c('0x40')]===_0x4b5c('0x1d')){logger[_0x4b5c('0x20')](_0x4b5c('0x41'),_0x53cad3,_0x178a3e[_0x4b5c('0x40')]);_0x5d604b['Name']=_0x517829!==_0x4b5c('0x42')?_0x517829:util[_0x4b5c('0x45')](_0x4b5c('0x43'),_0x53cad3);}else{return null;}}return _0x581bd4[_0x4b5c('0x21')](_['upperFirst'](_0x178a3e[_0x4b5c('0x40')]))[_0x4b5c('0x22')](_0x5d604b)['then'](function(_0x131ea6){return BPromise[_0x4b5c('0x2a')]({'id':_0x131ea6['id'],'endUserType':_0x178a3e[_0x4b5c('0x40')]});});}});}function getCustomFields(_0x3876d3,_0x55c7a4){var _0x4dca50={};if(_0x3876d3[_0x4b5c('0x35')]>0x0){_['forEach'](_0x3876d3,function(_0x4381d3){if(_[_0x4b5c('0x48')](['string',_0x4b5c('0x49')],_0x4381d3[_0x4b5c('0x3d')])&&_0x4381d3[_0x4b5c('0x4a')]){_0x4dca50[_0x4381d3[_0x4b5c('0x4a')]]=_0x4381d3['content']['toString']();}else if(_0x4381d3[_0x4b5c('0x3d')]===_0x4b5c('0x4b')&&_0x4381d3[_0x4b5c('0x4c')]&&_0x4381d3['idField']){_0x55c7a4[_0x4381d3[_0x4b5c('0x4c')]]&&(_0x4dca50[_0x4381d3[_0x4b5c('0x4a')]]=_0x55c7a4[_0x4381d3[_0x4b5c('0x4c')]][_0x4b5c('0x4d')]());}else if(_0x4381d3[_0x4b5c('0x3d')]===_0x4b5c('0x4e')&&_0x4381d3[_0x4b5c('0x4f')]&&_0x4381d3[_0x4b5c('0x4f')][_0x4b5c('0x50')]&&_0x4381d3[_0x4b5c('0x4a')]){_0x55c7a4[_0x4381d3['Variable'][_0x4b5c('0x50')][_0x4b5c('0x51')]()]&&(_0x4dca50[_0x4381d3['idField']]=_0x55c7a4[_0x4381d3['Variable'][_0x4b5c('0x50')]['toLowerCase']()]['toString']());}});}return _0x4dca50;}function getConnection(_0x1d1263){var _0x556203=_0x1d1263[_0x4b5c('0x52')][_0x4b5c('0x53')](_0x1d1263[_0x4b5c('0x54')]);var _0x2a0a06=new jsforce[(_0x4b5c('0x55'))]({'oauth2':{'loginUrl':_0x1d1263[_0x4b5c('0x56')]||_0x4b5c('0x57'),'clientId':_0x1d1263[_0x4b5c('0x58')],'clientSecret':_0x1d1263[_0x4b5c('0x59')]}});return _0x2a0a06[_0x4b5c('0x5a')](_0x1d1263['username'],_0x556203)[_0x4b5c('0x27')](function(){logger[_0x4b5c('0x20')](_0x4b5c('0x5b'));return _0x2a0a06;});}exports['queue']=function(_0x50c63e,_0x4ba003,_0x4c4769,_0x5b7339,_0x343096,_0x3d14b8){var _0x261f45,_0x41551c,_0x432da2,_0x5010f5;_0x3d14b8[_0x4b5c('0x5c')]=intUtil[_0x4b5c('0x5d')](_0x3d14b8[_0x4b5c('0x5c')]);_0x3d14b8[_0x4b5c('0x56')]=intUtil[_0x4b5c('0x5d')](_0x3d14b8[_0x4b5c('0x56')]);if(_0x343096&&_0x343096['monitor_format']){logger[_0x4b5c('0x20')](_0x4b5c('0x5e'),_0x4b5c('0x5f'));_0x4ba003[_0x4b5c('0x60')]=util[_0x4b5c('0x45')](_0x4b5c('0x61'),_0x3d14b8[_0x4b5c('0x5c')],_0x4ba003[_0x4b5c('0x62')],md5(_0x4ba003[_0x4b5c('0x62')]));}else{_0x4ba003[_0x4b5c('0x60')]='';}return getConnection(_0x3d14b8)['then'](function(_0xd8418a){_0x5010f5=_0xd8418a;return getUser(_0x3d14b8,_0x5b7339[_0x4b5c('0x63')],_0x5010f5);})[_0x4b5c('0x27')](function(_0x186ca9){_0x261f45=_0x186ca9;return getEndUser(_0x3d14b8,_0x4c4769,_0x4ba003[_0x4b5c('0x64')],_0x4ba003[_0x4b5c('0x65')],_0x5010f5);})[_0x4b5c('0x27')](function(_0x43704b){_0x41551c=_0x43704b;return getTicket(_0x3d14b8,_0x261f45,_0x41551c,_0x4c4769,_0x4ba003,_0x4c4769['Fields'],_0x5010f5,'queue');})[_0x4b5c('0x27')](function(_0x4bcfd2){_0x432da2=_0x4bcfd2;logger[_0x4b5c('0x20')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x432da2['id']);logger[_0x4b5c('0x20')](_0x4b5c('0x66'),_0x432da2['id'],_0x5b7339['name'],_0x3d14b8[_0x4b5c('0x3d')]);switch(_0x3d14b8[_0x4b5c('0x3d')]){case _0x4b5c('0x67'):emit(util['format']('user:%s',_0x5b7339[_0x4b5c('0x50')]),_0x4b5c('0x68'),{'recordId':_0x432da2['id']});break;case _0x4b5c('0x69'):emit(util[_0x4b5c('0x45')](_0x4b5c('0x6a'),_0x5b7339[_0x4b5c('0x50')]),_0x4b5c('0x6b'),{'uri':util['format'](_0x4b5c('0x6c'),_0x5010f5[_0x4b5c('0x6d')],_0x432da2['id'])});break;default:logger[_0x4b5c('0x6e')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x4b5c('0x6f')](function(_0x5bd77a){logger[_0x4b5c('0x6e')](_0x4b5c('0x5e'),_0x5bd77a);});};exports[_0x4b5c('0x70')]=function(_0x4403a0,_0x2bd10e,_0x5aa164,_0x5ee217,_0xba7465,_0x3c6817,_0x32367d){var _0xac13ad,_0x1b1413,_0x10d7a9,_0x25cd44;_0x3c6817['serverUrl']=intUtil['stripTrailingSlash'](_0x3c6817[_0x4b5c('0x5c')]);_0x3c6817[_0x4b5c('0x56')]=intUtil[_0x4b5c('0x5d')](_0x3c6817['remoteUri']);if(_0x32367d&&_0x32367d[_0x4b5c('0x71')]&&_0x32367d[_0x4b5c('0x71')]!==_0x4b5c('0x72')){logger[_0x4b5c('0x20')](_0x4b5c('0x73'),_0x4b5c('0x5f'));_0x2bd10e[_0x4b5c('0x60')]=util[_0x4b5c('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3c6817[_0x4b5c('0x5c')],_0x2bd10e[_0x4b5c('0x62')],md5(_0x2bd10e[_0x4b5c('0x62')]));}return getConnection(_0x3c6817)[_0x4b5c('0x27')](function(_0x1d8797){_0x25cd44=_0x1d8797;return getUser(_0x3c6817,_0x5ee217[_0x4b5c('0x63')],_0x25cd44);})[_0x4b5c('0x27')](function(_0x60f393){_0xac13ad=_0x60f393;return getEndUser(_0x3c6817,_0x5aa164,_0x2bd10e[_0x4b5c('0x74')],_0x2bd10e[_0x4b5c('0x75')],_0x25cd44);})['then'](function(_0x4b4e0d){_0x1b1413=_0x4b4e0d;return getTicket(_0x3c6817,_0xac13ad,_0x1b1413,_0x5aa164,_0x2bd10e,_0x5aa164[_0x4b5c('0x76')],_0x25cd44,_0x4b5c('0x70'));})[_0x4b5c('0x27')](function(_0x1f1aa2){_0x10d7a9=_0x1f1aa2;logger[_0x4b5c('0x20')](_0x4b5c('0x77'),_0x10d7a9['id']);logger[_0x4b5c('0x20')](_0x4b5c('0x78'),_0x10d7a9['id'],_0x5ee217[_0x4b5c('0x50')],_0x3c6817[_0x4b5c('0x3d')]);switch(_0x3c6817[_0x4b5c('0x3d')]){case'integrationTab':emit(util[_0x4b5c('0x45')](_0x4b5c('0x6a'),_0x5ee217[_0x4b5c('0x50')]),_0x4b5c('0x68'),{'recordId':_0x10d7a9['id']});break;case _0x4b5c('0x69'):emit(util['format'](_0x4b5c('0x6a'),_0x5ee217[_0x4b5c('0x50')]),_0x4b5c('0x6b'),{'uri':util['format'](_0x4b5c('0x6c'),_0x25cd44['instanceUrl'],_0x10d7a9['id'])});break;default:logger['error'](_0x4b5c('0x73'),_0x4b5c('0x79'));}})[_0x4b5c('0x6f')](function(_0x45f11c){logger[_0x4b5c('0x6e')](_0x4b5c('0x73'),_0x45f11c);});};exports[_0x4b5c('0x7a')]=function(_0xf78fb,_0x2d0f41,_0x2a374a,_0x367bb4,_0x260ad7,_0x204a5b){var _0x3fdab0,_0x264b5b,_0xe364d9,_0x5db6c1;_0x204a5b['serverUrl']=intUtil[_0x4b5c('0x5d')](_0x204a5b[_0x4b5c('0x5c')]);_0x204a5b[_0x4b5c('0x56')]=intUtil['stripTrailingSlash'](_0x204a5b[_0x4b5c('0x56')]);if(_0x260ad7&&_0x260ad7['monitor_format']){logger[_0x4b5c('0x20')]('['+_0x2d0f41[_0x4b5c('0x7b')][_0x4b5c('0x7c')]()+']','Recording\x20is\x20enabled!');_0x2d0f41[_0x4b5c('0x60')]=util[_0x4b5c('0x45')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x204a5b[_0x4b5c('0x5c')],_0x2d0f41[_0x4b5c('0x62')],md5(_0x2d0f41[_0x4b5c('0x62')]));}else{_0x2d0f41['recordingURL']='';}return getConnection(_0x204a5b)[_0x4b5c('0x27')](function(_0x1d0fbe){_0x5db6c1=_0x1d0fbe;if(!_[_0x4b5c('0x23')](_0x367bb4)){return getUser(_0x204a5b,_0x367bb4[_0x4b5c('0x50')],_0x5db6c1);}else{return getUser(_0x204a5b,null,_0x5db6c1);}})[_0x4b5c('0x27')](function(_0x266955){_0x3fdab0=_0x266955;return getEndUser(_0x204a5b,_0x2a374a,_0x2d0f41[_0x4b5c('0x64')],_0x2d0f41['calleridnum'],_0x5db6c1);})[_0x4b5c('0x27')](function(_0x54ef6a){_0x264b5b=_0x54ef6a;return getTicket(_0x204a5b,_0x3fdab0,_0x264b5b,_0x2a374a,_0x2d0f41,_0x2a374a[_0x4b5c('0x76')],_0x5db6c1);})['then'](function(_0x1a8ba7){_0xe364d9=_0x1a8ba7;logger[_0x4b5c('0x20')]('['+_0x2d0f41[_0x4b5c('0x7b')][_0x4b5c('0x7c')]()+_0x4b5c('0x7d'),_0xe364d9['id']);logger[_0x4b5c('0x20')]('['+_0x2d0f41[_0x4b5c('0x7b')][_0x4b5c('0x7c')]()+_0x4b5c('0x7e'),_0x204a5b[_0x4b5c('0x3d')]);})['catch'](function(_0x4d5e6f){logger['error']('['+_0x2d0f41[_0x4b5c('0x7b')][_0x4b5c('0x7c')]()+']',_0x4d5e6f);});}; \ 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 a288e7f..dd95717 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 _0xe444=['error','message','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','info','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','string','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','endUserId','incident','assign','true','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label','label_entry','Incident','ticketId','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','util','md5','./util','servicenow','defaults','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm'];(function(_0x9e104e,_0x5e431d){var _0x3af1af=function(_0x2bdaed){while(--_0x2bdaed){_0x9e104e['push'](_0x9e104e['shift']());}};_0x3af1af(++_0x5e431d);}(_0xe444,0x196));var _0x4e44=function(_0x2654af,_0x55c37c){_0x2654af=_0x2654af-0x0;var _0xdb6498=_0xe444[_0x2654af];return _0xdb6498;};'use strict';var _=require(_0x4e44('0x0'));var Promise=require('bluebird');var rp=require(_0x4e44('0x1'));var util=require(_0x4e44('0x2'));var md5=require(_0x4e44('0x3'));var Redis=require('ioredis');var intUtil=require(_0x4e44('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4e44('0x5'));config['redis']=_[_0x4e44('0x6')](config[_0x4e44('0x7')],{'host':_0x4e44('0x8'),'port':0x18eb});var io=require(_0x4e44('0x9'))(new Redis(config[_0x4e44('0x7')]));function getAdminUser(_0x5e4da1,_0x292a34,_0x611639,_0xa4bd91,_0x326238,_0x14bb53){return new Promise(function(_0x2960d6,_0x104371){var _0x327549={'method':'GET','uri':_0xa4bd91+_0x4e44('0xa')+'&'+_0x326238+'&'+_0x14bb53,'auth':_0x292a34,'json':!![]};return rp(_0x327549)[_0x4e44('0xb')](function(_0x408f6b){if(_0x408f6b[_0x4e44('0xc')][_0x4e44('0xd')]>0x0){_0x611639[_0x4e44('0xe')]=_0x408f6b['result'][0x0][_0x4e44('0xf')];}logger['info']('['+[_0x5e4da1[_0x4e44('0x10')]()]+_0x4e44('0x11'),_0x611639);_0x2960d6(_0x611639);})['catch'](function(_0x1c6ae6){logger[_0x4e44('0x12')]('['+[_0x5e4da1['toUpperCase']()]+']',_0x1c6ae6[_0x4e44('0x13')]);_0x104371(_0x1c6ae6['message']);});});}function getUser(_0x1dfe0f,_0x302d4e,_0x24205c,_0x435054,_0xf35dd0){return function(_0x16dcd6){logger['info']('['+[_0x1dfe0f[_0x4e44('0x10')]()]+'],\x20getUser\x20input\x20crm',_0x16dcd6);return new Promise(function(_0x482193,_0x18878d){if(intUtil[_0x4e44('0x14')](_0x16dcd6[_0x4e44('0x15')])){var _0x2e3c9b={'method':_0x4e44('0x16'),'uri':_0x24205c+_0x4e44('0x17')+_0x16dcd6[_0x4e44('0x15')]+'&'+_0x435054+'&'+_0xf35dd0,'auth':_0x302d4e,'json':!![]};logger[_0x4e44('0x18')]('['+[_0x1dfe0f[_0x4e44('0x10')]()]+_0x4e44('0x19'),_0x2e3c9b);return rp(_0x2e3c9b)[_0x4e44('0xb')](function(_0x33695e){logger[_0x4e44('0x18')]('['+[_0x1dfe0f[_0x4e44('0x10')]()]+_0x4e44('0x1a'),_0x33695e);if(_0x33695e[_0x4e44('0xc')][_0x4e44('0xd')]>0x0&&String(_0x33695e[_0x4e44('0xc')][0x0][_0x4e44('0x1b')])==='true'){_0x16dcd6[_0x4e44('0x1c')]=_0x33695e[_0x4e44('0xc')][0x0][_0x4e44('0xf')];}else{_0x16dcd6['userId']=_0x16dcd6[_0x4e44('0xe')];_0x16dcd6['userEmail']=_0x16dcd6[_0x4e44('0x1d')];}logger[_0x4e44('0x18')]('['+[_0x1dfe0f[_0x4e44('0x10')]()]+_0x4e44('0x1e'),_0x16dcd6);_0x482193(_0x16dcd6);})[_0x4e44('0x1f')](function(_0x5c0e1a){logger['error']('['+[_0x1dfe0f['toUpperCase']()]+']',_0x5c0e1a['message']);_0x18878d(_0x5c0e1a[_0x4e44('0x13')]);});}else{logger['info']('['+[_0x1dfe0f[_0x4e44('0x10')]()]+_0x4e44('0x20'));_0x16dcd6[_0x4e44('0x1c')]=_0x16dcd6[_0x4e44('0xe')];_0x16dcd6[_0x4e44('0x15')]=_0x16dcd6[_0x4e44('0x1d')];_0x482193(_0x16dcd6);}});};}function createEndUser(_0x7b2c84,_0x450aae,_0x11d509,_0x592419,_0x333f77){logger[_0x4e44('0x18')]('['+[_0x7b2c84[_0x4e44('0x10')]()]+_0x4e44('0x21'),_0x11d509);return new Promise(function(_0x507862,_0x3af8f4){var _0x17950e={'method':_0x4e44('0x22'),'uri':_0x592419+'sys_user?'+_0x333f77,'body':{'user_name':_0x11d509[_0x4e44('0x23')],'roles':_0x4e44('0x24'),'first_name':_0x11d509[_0x4e44('0x23')],'active':'true','date_format':_0x4e44('0x25'),'phone':_0x11d509[_0x4e44('0x23')]},'auth':_0x450aae,'json':!![]};return rp(_0x17950e)[_0x4e44('0xb')](function(_0x21abdf){logger[_0x4e44('0x18')]('['+[_0x7b2c84[_0x4e44('0x10')]()]+_0x4e44('0x26'),_0x21abdf[_0x4e44('0xc')]);_0x11d509['endUserId']=_0x21abdf[_0x4e44('0xc')][_0x4e44('0xf')];_0x507862(_0x11d509);})[_0x4e44('0x1f')](function(_0x4028b1){logger[_0x4e44('0x12')]('['+[_0x7b2c84[_0x4e44('0x10')]()]+']',_0x4028b1[_0x4e44('0x13')]);_0x3af8f4(_0x4028b1[_0x4e44('0x13')]);});});}function getEndUser(_0x39d07d,_0x1e327f,_0x3648d0,_0x3ec923,_0x41740f){return function(_0x1067f3){logger[_0x4e44('0x18')]('['+[_0x39d07d[_0x4e44('0x10')]()]+'],\x20getEndUser\x20input\x20crm',_0x1067f3);return new Promise(function(_0x2f0dca,_0x28ee6b){var _0x1b9389={'method':_0x4e44('0x16'),'uri':_0x3648d0+'sys_user?sysparm_query=phone%3D'+_0x1067f3[_0x4e44('0x23')]+'&'+_0x3ec923+'&'+_0x41740f,'auth':_0x1e327f,'json':!![]};return rp(_0x1b9389)['then'](function(_0x1fe231){if(_0x1fe231[_0x4e44('0xc')]['length']>0x0){_0x1067f3['endUserId']=_0x1fe231[_0x4e44('0xc')][0x0]['sys_id'];logger[_0x4e44('0x18')]('['+[_0x39d07d[_0x4e44('0x10')]()]+_0x4e44('0x27'),_0x1067f3);_0x2f0dca(_0x1067f3);}else{return createEndUser(_0x39d07d,_0x1e327f,_0x1067f3,_0x3648d0,_0x3ec923)[_0x4e44('0xb')](function(_0x385929){logger[_0x4e44('0x18')]('['+[_0x39d07d[_0x4e44('0x10')]()]+_0x4e44('0x28'),_0x385929);_0x2f0dca(_0x385929);});}})[_0x4e44('0x1f')](function(_0x31c78b){logger['error']('['+[_0x39d07d[_0x4e44('0x10')]()]+']',_0x31c78b[_0x4e44('0x13')]);_0x28ee6b(_0x31c78b[_0x4e44('0x13')]);});});};}function getCustomFields(_0x3b6d1e,_0x308fc9){var _0x4cca90={};if(_0x3b6d1e[_0x4e44('0xd')]>0x0){_[_0x4e44('0x29')](_0x3b6d1e,function(_0x30e392){if(_['includes']([_0x4e44('0x2a'),'picklist'],_0x30e392[_0x4e44('0x2b')])&&_0x30e392[_0x4e44('0x2c')]&&!_0x30e392[_0x4e44('0x2d')]){_0x4cca90[_0x30e392[_0x4e44('0x2c')][_0x4e44('0x2e')]()]=_0x30e392[_0x4e44('0x2f')][_0x4e44('0x30')]();}else if(_['includes'](['string','picklist'],_0x30e392[_0x4e44('0x2b')])&&_0x30e392[_0x4e44('0x31')]&&_0x30e392[_0x4e44('0x2d')]){_0x4cca90[_0x30e392[_0x4e44('0x31')][_0x4e44('0x2e')]()]=_0x30e392[_0x4e44('0x2f')]['toString']();}else if(_0x30e392[_0x4e44('0x2b')]===_0x4e44('0x32')&&_0x30e392[_0x4e44('0x33')]&&_0x30e392[_0x4e44('0x31')]&&_0x30e392[_0x4e44('0x2d')]){_0x4cca90[_0x30e392['idField'][_0x4e44('0x2e')]()]=_0x308fc9[_0x30e392[_0x4e44('0x33')]][_0x4e44('0x30')]();}else if(_0x30e392['type']===_0x4e44('0x34')&&_0x30e392[_0x4e44('0x35')]&&_0x30e392[_0x4e44('0x35')][_0x4e44('0x36')]&&_0x30e392[_0x4e44('0x31')]&&_0x30e392[_0x4e44('0x2d')]){_0x4cca90[_0x30e392[_0x4e44('0x31')]['toLowerCase']()]=_0x308fc9[_0x30e392[_0x4e44('0x35')][_0x4e44('0x36')][_0x4e44('0x2e')]()][_0x4e44('0x30')]();}});}return _0x4cca90;}function getTicket(_0x1aecef,_0x54817f,_0x4671cb,_0x141446,_0x18b9b9,_0x552a0b){return function(_0x578a11){logger[_0x4e44('0x18')]('['+[_0x1aecef[_0x4e44('0x10')]()]+_0x4e44('0x37'),_0x578a11);return new Promise(function(_0x27548e,_0x26adfc){var _0x379291=_0x1aecef[_0x4e44('0x2e')]()===_0x4e44('0x38')?_0x578a11[_0x4e44('0x1c')]:_0x578a11[_0x4e44('0x39')];var _0x3684d8={'method':_0x4e44('0x22'),'uri':_0x4671cb+_0x4e44('0x3a')+'?'+_0x552a0b,'body':Object[_0x4e44('0x3b')]({},{'active':_0x4e44('0x3c'),'caller_id':_0x379291,'assigned_to':_0x578a11[_0x4e44('0x1c')],'short_description':intUtil[_0x4e44('0x3d')](_0x141446[_0x4e44('0x3e')],_0x18b9b9,'\x20'),'description':intUtil['getString'](_0x141446[_0x4e44('0x3f')],_0x18b9b9,'\x0a')},getCustomFields(_0x141446[_0x4e44('0x40')],_0x18b9b9)),'auth':_0x54817f,'json':!![]};return rp(_0x3684d8)[_0x4e44('0xb')](function(_0x38c80f){logger[_0x4e44('0x18')]('['+[_0x1aecef[_0x4e44('0x10')]()]+_0x4e44('0x41'),_0x38c80f[_0x4e44('0xc')]);_0x578a11['ticketId']=_0x38c80f[_0x4e44('0xc')]['sys_id'];_0x578a11[_0x4e44('0x42')]=_0x38c80f['result'][_0x4e44('0x43')];logger[_0x4e44('0x18')]('['+[_0x1aecef[_0x4e44('0x10')]()]+_0x4e44('0x44'),_0x578a11);_0x27548e(_0x578a11);})[_0x4e44('0x1f')](function(_0x5033e2){logger[_0x4e44('0x12')]('['+[_0x1aecef[_0x4e44('0x10')]()]+']',_0x5033e2[_0x4e44('0x13')]);_0x26adfc(_0x5033e2[_0x4e44('0x13')]);});});};}function createRemoteTag(_0x1a2541,_0x5a214d,_0x223db2,_0x208fc2){return new Promise(function(_0x46b254,_0x1ddcfa){var _0x546ca5={'method':_0x4e44('0x22'),'uri':_0x223db2+_0x4e44('0x45')+'?'+_0x208fc2,'body':{'short_description':_0x1a2541,'global':!![],'active':!![],'name':_0x1a2541},'auth':_0x5a214d,'json':!![]};return rp(_0x546ca5)[_0x4e44('0xb')](function(_0x50d207){var _0x2af303=_0x50d207[_0x4e44('0xc')][_0x4e44('0xf')];_0x46b254(_0x2af303);});});}function getRemoteTag(_0x26f32d,_0x58df34,_0x471f01,_0x15593e,_0x43d584){return new Promise(function(_0xcbfee3,_0x57ce75){var _0x1b2ca6={'method':_0x4e44('0x16'),'uri':_0x471f01+'label'+'?sysparm_query=name%3D'+_0x26f32d+'&'+_0x15593e,'auth':_0x58df34,'json':!![]};return rp(_0x1b2ca6)[_0x4e44('0xb')](function(_0x4e82d0){if(_0x4e82d0[_0x4e44('0xc')]['length']>0x0){var _0x2100df=_0x4e82d0[_0x4e44('0xc')][0x0][_0x4e44('0xf')];_0xcbfee3(_0x2100df);}else{return createRemoteTag(_0x26f32d,_0x58df34,_0x471f01,_0x15593e)[_0x4e44('0xb')](function(_0x36d185){_0xcbfee3(_0x36d185);});}});});}function assignTagToIncident(_0x593875,_0x9d6819,_0x192bbb,_0x21b1a7,_0x2028c8){return new Promise(function(_0x214e0,_0x3b1ff5){var _0x5ecbbc={'method':_0x4e44('0x22'),'uri':_0x192bbb+_0x4e44('0x46')+'?'+_0x2028c8,'body':{'label':_0x593875,'table':'incident','id_type':_0x4e44('0x47'),'table_key':_0x21b1a7[_0x4e44('0x48')],'title':'Incident\x20-\x20'+_0x21b1a7['ticketNumber'],'id_display':_0x21b1a7[_0x4e44('0x42')]},'auth':_0x9d6819,'json':!![]};return rp(_0x5ecbbc)[_0x4e44('0xb')](function(_0x51bfbf){_0x214e0();})[_0x4e44('0x1f')](function(){_0x214e0();});});}function manageTags(_0x38e416,_0x157131,_0x1a7dff,_0x68dbf2,_0x1790cc,_0x3c75be,_0x1d3582){return new Promise(function(_0x5c10f0,_0x2c4bde){var _0x1a9d11=[];_0x157131[_0x4e44('0x29')](function(_0x5b41cb){_0x1a9d11[_0x4e44('0x49')](getRemoteTag(_0x5b41cb,_0x1a7dff,_0x68dbf2,_0x3c75be,_0x1d3582));});return Promise[_0x4e44('0x4a')](_0x1a9d11)['then'](function(_0x3a9cdd){if(_0x3a9cdd[_0x4e44('0xd')]){logger['info']('['+[_0x38e416[_0x4e44('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x3a9cdd);var _0x4807a6=[];_0x3a9cdd[_0x4e44('0x29')](function(_0x585237){_0x4807a6[_0x4e44('0x49')](assignTagToIncident(_0x585237,_0x1a7dff,_0x68dbf2,_0x1790cc,_0x3c75be));});return Promise['all'](_0x4807a6)[_0x4e44('0xb')](function(){_0x5c10f0();})[_0x4e44('0x1f')](function(){_0x5c10f0();});}else{_0x5c10f0();}});});}function getTags(_0x2eb79e,_0x51ebbb,_0x4d25cd,_0x45ee86,_0x5e9ad8,_0x508242){return function(_0x451d00){return new Promise(function(_0x56ca7a,_0x5ed14e){var _0x48389c=[];var _0x505830=_0x45ee86[_0x4e44('0x4b')];if(_0x505830&&_0x505830[_0x4e44('0xd')]>0x0){_0x48389c=_['map'](_0x505830,'name');}if(_0x48389c[_0x4e44('0xd')]>0x0){return manageTags(_0x2eb79e,_0x48389c,_0x51ebbb,_0x4d25cd,_0x451d00,_0x5e9ad8,_0x508242)['then'](function(){_0x56ca7a(_0x451d00);});}else{_0x56ca7a(_0x451d00);}});};}function emit(_0x5d86c2,_0x37c532,_0x3f9ef8){var _0x4b8953=_0x4e44('0x4c')+_0x4e44('0x4d')+_0x4e44('0x4e')+_0x4e44('0x4f');var _0x53cb2b={'uri':_0x5d86c2+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x3f9ef8+_0x4b8953};io['to'](util[_0x4e44('0x50')](_0x4e44('0x51'),_0x37c532))[_0x4e44('0x52')](_0x4e44('0x53'),_0x53cb2b);}exports['cs']=function(_0x385a9f,_0x500838,_0xb8062b,_0x21696c,_0x285f17,_0x29373e,_0x2b072,_0x27559e){var _0xe43611={};var _0xfe49ce={'user':_0x29373e[_0x4e44('0x54')],'pass':_0x29373e['password']};var _0x2748c5=_0x4e44('0x55');var _0x26eba1='sysparm_display_value=true';_0x29373e['remoteUri']=intUtil['stripTrailingSlash'](_0x29373e[_0x4e44('0x56')]);_0x29373e[_0x4e44('0x57')]=intUtil[_0x4e44('0x58')](_0x29373e[_0x4e44('0x57')]);var _0x1b65d5=util[_0x4e44('0x50')](_0x4e44('0x59'),_0x29373e[_0x4e44('0x56')]);_0xe43611[_0x4e44('0x15')]=!_[_0x4e44('0x5a')](_0x21696c)?_0x21696c[_0x4e44('0x5b')]:null;_0xe43611[_0x4e44('0x1d')]=_0x29373e[_0x4e44('0x5b')];_0xe43611[_0x4e44('0x23')]=_0x27559e[_0x4e44('0x2e')]()==='outbound'?_0x500838[_0x4e44('0x5c')]:_0x500838[_0x4e44('0x5d')];_0xe43611['callDirection']=_0x27559e===_0x4e44('0x5e')||_0x27559e===_0x4e44('0x5f')?'queue':_0x4e44('0x38');var _0x1920e9=util[_0x4e44('0x50')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x29373e[_0x4e44('0x57')],_0x500838[_0x4e44('0x60')],md5(_0x500838[_0x4e44('0x60')]));if(_0x285f17&&_0x285f17['monitor_format']){logger['info']('[QUEUE]',_0x4e44('0x61'));_0x500838[_0x4e44('0x62')]=_0x1920e9;}else if(_0x2b072&&_0x2b072[_0x4e44('0x63')]&&_0x2b072[_0x4e44('0x63')]!==_0x4e44('0x64')){logger['info'](_0x4e44('0x65'),_0x4e44('0x61'));_0x500838['recordingURL']=_0x1920e9;}else{_0x500838['recordingURL']='';}return getAdminUser(_0x27559e,_0xfe49ce,_0xe43611,_0x1b65d5,_0x26eba1,_0x2748c5)[_0x4e44('0xb')](getUser(_0x27559e,_0xfe49ce,_0x1b65d5,_0x26eba1,_0x2748c5))['then'](getEndUser(_0x27559e,_0xfe49ce,_0x1b65d5,_0x26eba1,_0x2748c5))[_0x4e44('0xb')](getTicket(_0x27559e,_0xfe49ce,_0x1b65d5,_0xb8062b,_0x500838,_0x26eba1))[_0x4e44('0xb')](function(_0x3bd10f){logger[_0x4e44('0x18')](util[_0x4e44('0x50')](_0x4e44('0x66'),_0x3bd10f[_0x4e44('0x48')]));logger[_0x4e44('0x18')](util['format'](_0x4e44('0x67'),_0x27559e));if(_0x27559e!=='unmanaged'){logger[_0x4e44('0x18')]('['+[_0x27559e[_0x4e44('0x10')]()]+']',_0x4e44('0x68'));emit(_0x29373e[_0x4e44('0x56')],_0x21696c[_0x4e44('0x36')],_0x3bd10f[_0x4e44('0x48')]);}})['catch'](function(_0x4dcab2){logger[_0x4e44('0x12')]('['+[_0x27559e[_0x4e44('0x10')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x4e44('0x69')](_0x4dcab2,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xe2ef=['toLowerCase','toString','customField','idField','content','variable','customVariable','Variable',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Subjects','Descriptions','Fields','ticketNumber','label','?sysparm_query=name%3D','label_entry','Incident','ticketId','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','name','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','result','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField'];(function(_0x2a7fa8,_0x413c0e){var _0xf7e306=function(_0x9af322){while(--_0x9af322){_0x2a7fa8['push'](_0x2a7fa8['shift']());}};_0xf7e306(++_0x413c0e);}(_0xe2ef,0x17d));var _0xfe2e=function(_0x5c709b,_0x50d687){_0x5c709b=_0x5c709b-0x0;var _0x407861=_0xe2ef[_0x5c709b];return _0x407861;};'use strict';var _=require(_0xfe2e('0x0'));var Promise=require(_0xfe2e('0x1'));var rp=require(_0xfe2e('0x2'));var util=require('util');var md5=require(_0xfe2e('0x3'));var Redis=require(_0xfe2e('0x4'));var intUtil=require(_0xfe2e('0x5'));var config=require(_0xfe2e('0x6'));var logger=require(_0xfe2e('0x7'))('servicenow');config[_0xfe2e('0x8')]=_['defaults'](config['redis'],{'host':_0xfe2e('0x9'),'port':0x18eb});var io=require(_0xfe2e('0xa'))(new Redis(config['redis']));function getAdminUser(_0x19d5e5,_0x363b5b,_0x3eadb6,_0x5faee3,_0x278aa6,_0x284351){return new Promise(function(_0x57d39f,_0x327d61){var _0x466ee4={'method':_0xfe2e('0xb'),'uri':_0x5faee3+_0xfe2e('0xc')+'&'+_0x278aa6+'&'+_0x284351,'auth':_0x363b5b,'json':!![]};return rp(_0x466ee4)[_0xfe2e('0xd')](function(_0x3cb366){if(_0x3cb366['result'][_0xfe2e('0xe')]>0x0){_0x3eadb6[_0xfe2e('0xf')]=_0x3cb366['result'][0x0][_0xfe2e('0x10')];}logger['info']('['+[_0x19d5e5[_0xfe2e('0x11')]()]+_0xfe2e('0x12'),_0x3eadb6);_0x57d39f(_0x3eadb6);})[_0xfe2e('0x13')](function(_0x369e6c){logger[_0xfe2e('0x14')]('['+[_0x19d5e5[_0xfe2e('0x11')]()]+']',_0x369e6c['message']);_0x327d61(_0x369e6c[_0xfe2e('0x15')]);});});}function getUser(_0x5812a1,_0x57fc87,_0x38738a,_0xad391d,_0x41ef5b){return function(_0x31bebd){logger[_0xfe2e('0x16')]('['+[_0x5812a1['toUpperCase']()]+_0xfe2e('0x17'),_0x31bebd);return new Promise(function(_0x4e27f9,_0x3ff82c){if(intUtil[_0xfe2e('0x18')](_0x31bebd[_0xfe2e('0x19')])){var _0x1a5f40={'method':'GET','uri':_0x38738a+_0xfe2e('0x1a')+_0x31bebd[_0xfe2e('0x19')]+'&'+_0xad391d+'&'+_0x41ef5b,'auth':_0x57fc87,'json':!![]};logger[_0xfe2e('0x16')]('['+[_0x5812a1['toUpperCase']()]+_0xfe2e('0x1b'),_0x1a5f40);return rp(_0x1a5f40)[_0xfe2e('0xd')](function(_0x466f79){logger[_0xfe2e('0x16')]('['+[_0x5812a1[_0xfe2e('0x11')]()]+_0xfe2e('0x1c'),_0x466f79);if(_0x466f79[_0xfe2e('0x1d')]['length']>0x0&&String(_0x466f79[_0xfe2e('0x1d')][0x0][_0xfe2e('0x1e')])===_0xfe2e('0x1f')){_0x31bebd[_0xfe2e('0x20')]=_0x466f79[_0xfe2e('0x1d')][0x0][_0xfe2e('0x10')];}else{_0x31bebd['userId']=_0x31bebd[_0xfe2e('0xf')];_0x31bebd[_0xfe2e('0x19')]=_0x31bebd[_0xfe2e('0x21')];}logger[_0xfe2e('0x16')]('['+[_0x5812a1[_0xfe2e('0x11')]()]+'],\x20getUser\x20crm',_0x31bebd);_0x4e27f9(_0x31bebd);})['catch'](function(_0x43cc89){logger[_0xfe2e('0x14')]('['+[_0x5812a1[_0xfe2e('0x11')]()]+']',_0x43cc89[_0xfe2e('0x15')]);_0x3ff82c(_0x43cc89[_0xfe2e('0x15')]);});}else{logger[_0xfe2e('0x16')]('['+[_0x5812a1[_0xfe2e('0x11')]()]+_0xfe2e('0x22'));_0x31bebd['userId']=_0x31bebd[_0xfe2e('0xf')];_0x31bebd[_0xfe2e('0x19')]=_0x31bebd[_0xfe2e('0x21')];_0x4e27f9(_0x31bebd);}});};}function createEndUser(_0x4f3ef4,_0xbdeb4e,_0x5c1a2d,_0x20da82,_0xb07735){logger[_0xfe2e('0x16')]('['+[_0x4f3ef4[_0xfe2e('0x11')]()]+_0xfe2e('0x23'),_0x5c1a2d);return new Promise(function(_0x2f7dca,_0x1fd4b1){var _0x50a4ef={'method':'POST','uri':_0x20da82+_0xfe2e('0x24')+_0xb07735,'body':{'user_name':_0x5c1a2d[_0xfe2e('0x25')],'roles':_0xfe2e('0x26'),'first_name':_0x5c1a2d[_0xfe2e('0x25')],'active':'true','date_format':_0xfe2e('0x27'),'phone':_0x5c1a2d['endUserNumber']},'auth':_0xbdeb4e,'json':!![]};return rp(_0x50a4ef)[_0xfe2e('0xd')](function(_0x4a32b8){logger[_0xfe2e('0x16')]('['+[_0x4f3ef4['toUpperCase']()]+_0xfe2e('0x28'),_0x4a32b8[_0xfe2e('0x1d')]);_0x5c1a2d['endUserId']=_0x4a32b8[_0xfe2e('0x1d')]['sys_id'];_0x2f7dca(_0x5c1a2d);})[_0xfe2e('0x13')](function(_0x2a161f){logger['error']('['+[_0x4f3ef4[_0xfe2e('0x11')]()]+']',_0x2a161f['message']);_0x1fd4b1(_0x2a161f[_0xfe2e('0x15')]);});});}function getEndUser(_0x27bec5,_0x25a0ae,_0x3770e6,_0x21dc01,_0x4ff759){return function(_0x4adaae){logger[_0xfe2e('0x16')]('['+[_0x27bec5['toUpperCase']()]+_0xfe2e('0x29'),_0x4adaae);return new Promise(function(_0x3faa9e,_0x494651){var _0x2b2905={'method':_0xfe2e('0xb'),'uri':_0x3770e6+_0xfe2e('0x2a')+_0x4adaae[_0xfe2e('0x25')]+'&'+_0x21dc01+'&'+_0x4ff759,'auth':_0x25a0ae,'json':!![]};return rp(_0x2b2905)[_0xfe2e('0xd')](function(_0x471bfe){if(_0x471bfe[_0xfe2e('0x1d')][_0xfe2e('0xe')]>0x0){_0x4adaae[_0xfe2e('0x2b')]=_0x471bfe[_0xfe2e('0x1d')][0x0][_0xfe2e('0x10')];logger[_0xfe2e('0x16')]('['+[_0x27bec5[_0xfe2e('0x11')]()]+_0xfe2e('0x2c'),_0x4adaae);_0x3faa9e(_0x4adaae);}else{return createEndUser(_0x27bec5,_0x25a0ae,_0x4adaae,_0x3770e6,_0x21dc01)[_0xfe2e('0xd')](function(_0x1c2b46){logger[_0xfe2e('0x16')]('['+[_0x27bec5['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x1c2b46);_0x3faa9e(_0x1c2b46);});}})[_0xfe2e('0x13')](function(_0x347463){logger['error']('['+[_0x27bec5['toUpperCase']()]+']',_0x347463[_0xfe2e('0x15')]);_0x494651(_0x347463[_0xfe2e('0x15')]);});});};}function getCustomFields(_0x88c8d1,_0xcaeae0){var _0x3efa5c={};if(_0x88c8d1[_0xfe2e('0xe')]>0x0){_[_0xfe2e('0x2d')](_0x88c8d1,function(_0x5cea60){if(_[_0xfe2e('0x2e')]([_0xfe2e('0x2f'),_0xfe2e('0x30')],_0x5cea60[_0xfe2e('0x31')])&&_0x5cea60['nameField']&&!_0x5cea60['customField']){_0x3efa5c[_0x5cea60[_0xfe2e('0x32')][_0xfe2e('0x33')]()]=_0x5cea60['content'][_0xfe2e('0x34')]();}else if(_[_0xfe2e('0x2e')](['string','picklist'],_0x5cea60['type'])&&_0x5cea60['idField']&&_0x5cea60[_0xfe2e('0x35')]){_0x3efa5c[_0x5cea60[_0xfe2e('0x36')]['toLowerCase']()]=_0x5cea60[_0xfe2e('0x37')]['toString']();}else if(_0x5cea60[_0xfe2e('0x31')]===_0xfe2e('0x38')&&_0x5cea60['variableName']&&_0x5cea60[_0xfe2e('0x36')]&&_0x5cea60[_0xfe2e('0x35')]){_0x3efa5c[_0x5cea60[_0xfe2e('0x36')]['toLowerCase']()]=_0xcaeae0[_0x5cea60['variableName']][_0xfe2e('0x34')]();}else if(_0x5cea60[_0xfe2e('0x31')]===_0xfe2e('0x39')&&_0x5cea60[_0xfe2e('0x3a')]&&_0x5cea60[_0xfe2e('0x3a')]['name']&&_0x5cea60[_0xfe2e('0x36')]&&_0x5cea60['customField']){_0x3efa5c[_0x5cea60[_0xfe2e('0x36')]['toLowerCase']()]=_0xcaeae0[_0x5cea60[_0xfe2e('0x3a')]['name']['toLowerCase']()][_0xfe2e('0x34')]();}});}return _0x3efa5c;}function getTicket(_0x15ae69,_0x54a3aa,_0x17d666,_0x222690,_0x1e33f5,_0x2f34e8){return function(_0x234004){logger[_0xfe2e('0x16')]('['+[_0x15ae69[_0xfe2e('0x11')]()]+_0xfe2e('0x3b'),_0x234004);return new Promise(function(_0x59c24d,_0xe9fa75){var _0x10eb1e=_0x15ae69['toLowerCase']()===_0xfe2e('0x3c')?_0x234004[_0xfe2e('0x20')]:_0x234004[_0xfe2e('0x2b')];var _0x125312={'method':_0xfe2e('0x3d'),'uri':_0x17d666+_0xfe2e('0x3e')+'?'+_0x2f34e8,'body':Object[_0xfe2e('0x3f')]({},{'active':'true','caller_id':_0x10eb1e,'assigned_to':_0x234004['userId'],'short_description':intUtil[_0xfe2e('0x40')](_0x222690[_0xfe2e('0x41')],_0x1e33f5,'\x20'),'description':intUtil[_0xfe2e('0x40')](_0x222690[_0xfe2e('0x42')],_0x1e33f5,'\x0a')},getCustomFields(_0x222690[_0xfe2e('0x43')],_0x1e33f5)),'auth':_0x54a3aa,'json':!![]};return rp(_0x125312)[_0xfe2e('0xd')](function(_0x3bea3d){logger[_0xfe2e('0x16')]('['+[_0x15ae69['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x3bea3d[_0xfe2e('0x1d')]);_0x234004['ticketId']=_0x3bea3d['result'][_0xfe2e('0x10')];_0x234004[_0xfe2e('0x44')]=_0x3bea3d[_0xfe2e('0x1d')]['number'];logger[_0xfe2e('0x16')]('['+[_0x15ae69[_0xfe2e('0x11')]()]+']\x20getTicket\x20crm',_0x234004);_0x59c24d(_0x234004);})['catch'](function(_0x1cd5b){logger[_0xfe2e('0x14')]('['+[_0x15ae69['toUpperCase']()]+']',_0x1cd5b['message']);_0xe9fa75(_0x1cd5b[_0xfe2e('0x15')]);});});};}function createRemoteTag(_0x190cb3,_0x2ad513,_0x20cc05,_0x4fa164){return new Promise(function(_0x236d1e,_0x535702){var _0x1c2c0={'method':_0xfe2e('0x3d'),'uri':_0x20cc05+_0xfe2e('0x45')+'?'+_0x4fa164,'body':{'short_description':_0x190cb3,'global':!![],'active':!![],'name':_0x190cb3},'auth':_0x2ad513,'json':!![]};return rp(_0x1c2c0)[_0xfe2e('0xd')](function(_0x88c84f){var _0x347d1c=_0x88c84f['result'][_0xfe2e('0x10')];_0x236d1e(_0x347d1c);});});}function getRemoteTag(_0x77bac9,_0x26e453,_0x4b66c8,_0x9615dc,_0x5c8d73){return new Promise(function(_0x2e6f62,_0x9ab618){var _0x35e7a6={'method':_0xfe2e('0xb'),'uri':_0x4b66c8+_0xfe2e('0x45')+_0xfe2e('0x46')+_0x77bac9+'&'+_0x9615dc,'auth':_0x26e453,'json':!![]};return rp(_0x35e7a6)[_0xfe2e('0xd')](function(_0xd43d4e){if(_0xd43d4e[_0xfe2e('0x1d')][_0xfe2e('0xe')]>0x0){var _0x157852=_0xd43d4e[_0xfe2e('0x1d')][0x0][_0xfe2e('0x10')];_0x2e6f62(_0x157852);}else{return createRemoteTag(_0x77bac9,_0x26e453,_0x4b66c8,_0x9615dc)['then'](function(_0x1376fc){_0x2e6f62(_0x1376fc);});}});});}function assignTagToIncident(_0x4218c8,_0x2dba7c,_0x11ba4b,_0x25eb24,_0x5c5dbf){return new Promise(function(_0x5ee396,_0x4f4479){var _0xcca7a3={'method':'POST','uri':_0x11ba4b+_0xfe2e('0x47')+'?'+_0x5c5dbf,'body':{'label':_0x4218c8,'table':_0xfe2e('0x3e'),'id_type':_0xfe2e('0x48'),'table_key':_0x25eb24[_0xfe2e('0x49')],'title':_0xfe2e('0x4a')+_0x25eb24[_0xfe2e('0x44')],'id_display':_0x25eb24['ticketNumber']},'auth':_0x2dba7c,'json':!![]};return rp(_0xcca7a3)[_0xfe2e('0xd')](function(_0x2cef7f){_0x5ee396();})[_0xfe2e('0x13')](function(){_0x5ee396();});});}function manageTags(_0xf6971,_0x26eacc,_0x139a5f,_0x402085,_0x2bda61,_0x246983,_0x54318a){return new Promise(function(_0x540a22,_0x39471a){var _0x102147=[];_0x26eacc[_0xfe2e('0x2d')](function(_0x206b55){_0x102147[_0xfe2e('0x4b')](getRemoteTag(_0x206b55,_0x139a5f,_0x402085,_0x246983,_0x54318a));});return Promise['all'](_0x102147)[_0xfe2e('0xd')](function(_0x51b7a6){if(_0x51b7a6[_0xfe2e('0xe')]){logger[_0xfe2e('0x16')]('['+[_0xf6971[_0xfe2e('0x11')]()]+_0xfe2e('0x4c'),_0x51b7a6);var _0x4ad713=[];_0x51b7a6[_0xfe2e('0x2d')](function(_0x18f71c){_0x4ad713[_0xfe2e('0x4b')](assignTagToIncident(_0x18f71c,_0x139a5f,_0x402085,_0x2bda61,_0x246983));});return Promise[_0xfe2e('0x4d')](_0x4ad713)[_0xfe2e('0xd')](function(){_0x540a22();})[_0xfe2e('0x13')](function(){_0x540a22();});}else{_0x540a22();}});});}function getTags(_0x3787d2,_0xba8d22,_0x23f69c,_0x2c07dd,_0x972e46,_0x3569bf){return function(_0x3d5920){return new Promise(function(_0x2b52fe,_0x44d29d){var _0x5bcc54=[];var _0x487456=_0x2c07dd[_0xfe2e('0x4e')];if(_0x487456&&_0x487456[_0xfe2e('0xe')]>0x0){_0x5bcc54=_['map'](_0x487456,_0xfe2e('0x4f'));}if(_0x5bcc54[_0xfe2e('0xe')]>0x0){return manageTags(_0x3787d2,_0x5bcc54,_0xba8d22,_0x23f69c,_0x3d5920,_0x972e46,_0x3569bf)[_0xfe2e('0xd')](function(){_0x2b52fe(_0x3d5920);});}else{_0x2b52fe(_0x3d5920);}});};}function emit(_0x322458,_0x16e217,_0x2e0615){var _0x31f74d='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xfe2e('0x50')+_0xfe2e('0x51');var _0xbaa641={'uri':_0x322458+_0xfe2e('0x52')+_0x2e0615+_0x31f74d};io['to'](util[_0xfe2e('0x53')](_0xfe2e('0x54'),_0x16e217))[_0xfe2e('0x55')](_0xfe2e('0x56'),_0xbaa641);}exports['cs']=function(_0x11b4c7,_0x1010ea,_0x151ffb,_0x545309,_0x174675,_0x5d32ca,_0x4b93a5,_0x216e24){var _0x31caae={};var _0x279507={'user':_0x5d32ca[_0xfe2e('0x57')],'pass':_0x5d32ca['password']};var _0x20dec0=_0xfe2e('0x58');var _0x2fddfb=_0xfe2e('0x59');_0x5d32ca[_0xfe2e('0x5a')]=intUtil[_0xfe2e('0x5b')](_0x5d32ca[_0xfe2e('0x5a')]);_0x5d32ca[_0xfe2e('0x5c')]=intUtil[_0xfe2e('0x5b')](_0x5d32ca[_0xfe2e('0x5c')]);var _0x4af78c=util[_0xfe2e('0x53')]('%s/api/now/table/',_0x5d32ca[_0xfe2e('0x5a')]);_0x31caae[_0xfe2e('0x19')]=!_[_0xfe2e('0x5d')](_0x545309)?_0x545309[_0xfe2e('0x5e')]:null;_0x31caae[_0xfe2e('0x21')]=_0x5d32ca['email'];_0x31caae[_0xfe2e('0x25')]=_0x216e24[_0xfe2e('0x33')]()==='outbound'?_0x1010ea[_0xfe2e('0x5f')]:_0x1010ea[_0xfe2e('0x60')];_0x31caae['callDirection']=_0x216e24===_0xfe2e('0x61')||_0x216e24===_0xfe2e('0x62')?_0xfe2e('0x61'):_0xfe2e('0x3c');var _0x262b44=util[_0xfe2e('0x53')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d32ca[_0xfe2e('0x5c')],_0x1010ea[_0xfe2e('0x63')],md5(_0x1010ea[_0xfe2e('0x63')]));if(_0x174675&&_0x174675['monitor_format']){logger[_0xfe2e('0x16')]('[QUEUE]',_0xfe2e('0x64'));_0x1010ea[_0xfe2e('0x65')]=_0x262b44;}else if(_0x4b93a5&&_0x4b93a5[_0xfe2e('0x66')]&&_0x4b93a5['recordingFormat']!==_0xfe2e('0x67')){logger[_0xfe2e('0x16')](_0xfe2e('0x68'),_0xfe2e('0x64'));_0x1010ea[_0xfe2e('0x65')]=_0x262b44;}else{_0x1010ea['recordingURL']='';}return getAdminUser(_0x216e24,_0x279507,_0x31caae,_0x4af78c,_0x2fddfb,_0x20dec0)[_0xfe2e('0xd')](getUser(_0x216e24,_0x279507,_0x4af78c,_0x2fddfb,_0x20dec0))['then'](getEndUser(_0x216e24,_0x279507,_0x4af78c,_0x2fddfb,_0x20dec0))[_0xfe2e('0xd')](getTicket(_0x216e24,_0x279507,_0x4af78c,_0x151ffb,_0x1010ea,_0x2fddfb))[_0xfe2e('0xd')](function(_0x166cff){logger['info'](util[_0xfe2e('0x53')](_0xfe2e('0x69'),_0x166cff[_0xfe2e('0x49')]));logger['info'](util[_0xfe2e('0x53')]('call\x20direction:\x20%s',_0x216e24));if(_0x216e24!==_0xfe2e('0x62')){logger[_0xfe2e('0x16')]('['+[_0x216e24[_0xfe2e('0x11')]()]+']',_0xfe2e('0x6a'));emit(_0x5d32ca['remoteUri'],_0x545309['name'],_0x166cff['ticketId']);}})[_0xfe2e('0x13')](function(_0x2246b0){logger[_0xfe2e('0x14')]('['+[_0x216e24[_0xfe2e('0x11')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xfe2e('0x6b')](_0x2246b0,{'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 0b022cc..efc4cd7 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 _0x3f67=['JSON','info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','name_value_list','user_name','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','nameField','customField','toLowerCase','content','type','string','custom_fields','Variable','login','username','password','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%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:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','user:%s','toUpperCase','isNil','Fields','Inbound','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','stringify','Calls','format','apiKey','toString','base64','get_server_info'];(function(_0x3c331c,_0x5d82c5){var _0x335c50=function(_0x14e136){while(--_0x14e136){_0x3c331c['push'](_0x3c331c['shift']());}};_0x335c50(++_0x5d82c5);}(_0x3f67,0xc3));var _0x73f6=function(_0x4ef826,_0x2e0ac8){_0x4ef826=_0x4ef826-0x0;var _0x154b8=_0x3f67[_0x4ef826];return _0x154b8;};'use strict';var _=require(_0x73f6('0x0'));var rp=require(_0x73f6('0x1'));var BPromise=require(_0x73f6('0x2'));var md5=require(_0x73f6('0x3'));var util=require(_0x73f6('0x4'));var Redis=require('ioredis');var intUtil=require(_0x73f6('0x5'));var config=require(_0x73f6('0x6'));var logger=require(_0x73f6('0x7'))(_0x73f6('0x8'));config[_0x73f6('0x9')]=_['defaults'](config[_0x73f6('0x9')],{'host':_0x73f6('0xa'),'port':0x18eb});var io=require(_0x73f6('0xb'))(new Redis(config['redis']));var def={'method':_0x73f6('0xc'),'json':!![]};function emit(_0x263b8e,_0x58a034,_0x546047){io['to'](_0x263b8e)[_0x73f6('0xd')](_0x58a034,_0x546047);}function getTicket(_0x513106,_0x260cd4,_0x3dcf66,_0x28bf7d,_0x5d83f3,_0x453f2a,_0x2d4b75,_0x35b22a){logger['info'](_0x73f6('0xe'));var _0x49b871=new Date();var _0x29b53f=[{'name':_0x73f6('0xf'),'value':intUtil[_0x73f6('0x10')](_0x28bf7d[_0x73f6('0x11')],_0x5d83f3,'\x20')},{'name':_0x73f6('0x12'),'value':_0x260cd4['id']},{'name':_0x73f6('0x13'),'value':_0x260cd4['id']},{'name':_0x73f6('0x14'),'value':intUtil['getString'](_0x28bf7d[_0x73f6('0x15')],_0x5d83f3,'\x0a')},{'name':'date_start','value':_0x49b871['toISOString']()['slice'](0x0,0x13)[_0x73f6('0x16')]('T','\x20')},{'name':_0x73f6('0x17'),'value':'0'},{'name':_0x73f6('0x18'),'value':'15'},{'name':_0x73f6('0x19'),'value':_0x3dcf66['id']},{'name':_0x73f6('0x1a'),'value':_0x73f6('0x1b')},{'name':_0x73f6('0x1c'),'value':_0x3dcf66['name']},{'name':_0x73f6('0x1d'),'value':_0x35b22a}];if(_0x453f2a[_0x73f6('0x1e')]){_[_0x73f6('0x1f')](_0x453f2a,function(_0x3c0df1){if(_0x5d83f3[_0x3c0df1[_0x73f6('0x20')]]){_0x29b53f[_0x73f6('0x21')]({'name':_0x3c0df1[_0x73f6('0x22')],'value':_0x5d83f3[_0x3c0df1[_0x73f6('0x20')]]});}});}return request({'form':{'method':_0x73f6('0x23'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x73f6('0x24')]({'session':_0x2d4b75['id'],'module_name':_0x73f6('0x25'),'name_value_list':_0x29b53f})}});}function getAuth(_0x2bde76){return util[_0x73f6('0x26')]('Basic\x20%s',new Buffer(_0x2bde76[_0x73f6('0x27')]+':X')[_0x73f6('0x28')](_0x73f6('0x29')));}function getServerInfo(_0x5e9bfe){return request({'form':{'method':_0x73f6('0x2a'),'input_type':_0x73f6('0x2b'),'response_type':_0x73f6('0x2b'),'rest_data':JSON['stringify']({'session':_0x5e9bfe['id']})}});}function getUser(_0x53fc8b,_0x26fc84,_0x95aa3c){if(!_['isNil'](_0x26fc84)){logger[_0x73f6('0x2c')](_0x73f6('0x2d'),_0x26fc84);return request({'form':{'method':_0x73f6('0x2e'),'input_type':_0x73f6('0x2b'),'response_type':_0x73f6('0x2b'),'rest_data':JSON[_0x73f6('0x24')]({'session':_0x95aa3c['id'],'module_name':_0x73f6('0x2f'),'query':util[_0x73f6('0x26')](_0x73f6('0x30'),_0x26fc84),'order_by':'','offset':'0','select_fields':['id',_0x73f6('0xf'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x73f6('0x31')](function(_0x5119ba){if(_0x5119ba[_0x73f6('0x32')][_0x73f6('0x1e')]){var _0x307f3e=_[_0x73f6('0x33')](_0x5119ba['entry_list'],function(_0x48e580){return _0x48e580[_0x73f6('0x34')][_0x73f6('0x35')][_0x73f6('0x36')]===_0x26fc84;});if(_0x307f3e){logger[_0x73f6('0x2c')](_0x73f6('0x37'));return BPromise['resolve']({'id':_0x307f3e['name_value_list']['id'][_0x73f6('0x36')],'name':_0x307f3e[_0x73f6('0x34')][_0x73f6('0xf')]['value']});}}logger[_0x73f6('0x2c')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x73f6('0x38')]({'id':_0x95aa3c['name_value_list'][_0x73f6('0x39')][_0x73f6('0x36')],'name':_0x95aa3c[_0x73f6('0x34')][_0x73f6('0x35')]['value']});});}else{logger[_0x73f6('0x2c')](_0x73f6('0x3a'));return BPromise[_0x73f6('0x38')]({'id':_0x95aa3c[_0x73f6('0x34')][_0x73f6('0x39')][_0x73f6('0x36')],'name':_0x95aa3c[_0x73f6('0x34')][_0x73f6('0x35')][_0x73f6('0x36')]});}}function getEndUser(_0xcf9ab3,_0x3e00a4,_0x3a24c6,_0x179732){logger[_0x73f6('0x2c')](_0x73f6('0x3b'),_0x3a24c6);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x73f6('0x2b'),'rest_data':JSON[_0x73f6('0x24')]({'session':_0x179732['id'],'module_name':_0x73f6('0x1b'),'query':util[_0x73f6('0x26')](_0x73f6('0x3c'),_0x3a24c6),'order_by':'','offset':'0','select_fields':['id',_0x73f6('0xf'),_0x73f6('0x3d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x73f6('0x31')](function(_0x3d5359){if(_0x3d5359[_0x73f6('0x32')][_0x73f6('0x1e')]){var _0x5022c7=_[_0x73f6('0x33')](_0x3d5359[_0x73f6('0x32')],function(_0x205da9){return _0x205da9[_0x73f6('0x34')][_0x73f6('0x3d')][_0x73f6('0x36')]===_0x3a24c6;});if(_0x5022c7){logger[_0x73f6('0x2c')](_0x73f6('0x3e'));return BPromise['resolve']({'id':_0x5022c7[_0x73f6('0x34')]['id'][_0x73f6('0x36')],'name':_0x5022c7[_0x73f6('0x34')][_0x73f6('0xf')][_0x73f6('0x36')],'phone':_0x5022c7[_0x73f6('0x34')][_0x73f6('0x3d')][_0x73f6('0x36')]});}}else{logger[_0x73f6('0x2c')](_0x73f6('0x3f'));return request({'form':{'method':'set_entry','input_type':_0x73f6('0x2b'),'response_type':_0x73f6('0x2b'),'rest_data':JSON[_0x73f6('0x24')]({'session':_0x179732['id'],'module_name':_0x73f6('0x1b'),'name_value_list':[{'name':_0x73f6('0x40'),'value':_0x3e00a4!==''?_0x3e00a4:util[_0x73f6('0x26')](_0x73f6('0x41'),_0x3a24c6)},{'name':'phone_home','value':_0x3a24c6}]})}})['then'](function(_0x97785d){logger[_0x73f6('0x2c')](_0x73f6('0x42'));return BPromise[_0x73f6('0x38')]({'id':_0x97785d['id'],'name':_0x97785d[_0x73f6('0x32')][_0x73f6('0x40')][_0x73f6('0x36')],'phone':_0x97785d[_0x73f6('0x32')][_0x73f6('0x3d')][_0x73f6('0x36')]});});}});}function request(_0x304bb8){logger['debug'](_0x73f6('0x43'),JSON['stringify'](_0x304bb8));return rp(_['merge'](def,_0x304bb8));}function getTags(_0x33bf89,_0x3d202b){var _0x2dd62c=[];if(_0x33bf89&&_0x33bf89[_0x73f6('0x1e')]>0x0){_0x2dd62c=_['map'](_0x33bf89,_0x3d202b);}return _0x2dd62c;}function getCustomFields(_0x575685,_0x5cad58){var _0x2264e9=[];var _0x9c48ea={'custom_fields':[]};if(_0x575685[_0x73f6('0x1e')]>0x0){_['forEach'](_0x575685,function(_0x12eb66){if(_0x12eb66['type']==='string'&&_0x12eb66[_0x73f6('0x44')]&&!_0x12eb66[_0x73f6('0x45')]){_0x9c48ea[_0x12eb66[_0x73f6('0x44')][_0x73f6('0x46')]()]=_0x12eb66[_0x73f6('0x47')][_0x73f6('0x28')]();}else if(_0x12eb66[_0x73f6('0x48')]===_0x73f6('0x49')&&_0x12eb66[_0x73f6('0x22')]&&_0x12eb66['customField']){_0x9c48ea[_0x73f6('0x4a')]['push']({'id':_0x12eb66[_0x73f6('0x22')],'value':_0x12eb66[_0x73f6('0x47')][_0x73f6('0x28')]()});}else if(_0x12eb66[_0x73f6('0x48')]==='variable'&&_0x12eb66[_0x73f6('0x20')]&&_0x12eb66[_0x73f6('0x22')]&&_0x12eb66[_0x73f6('0x45')]){_0x5cad58[_0x12eb66[_0x73f6('0x20')]]&&_0x9c48ea[_0x73f6('0x4a')]['push']({'id':_0x12eb66[_0x73f6('0x22')],'value':_0x5cad58[_0x12eb66[_0x73f6('0x20')]][_0x73f6('0x28')]()});}else if(_0x12eb66[_0x73f6('0x48')]==='customVariable'&&_0x12eb66[_0x73f6('0x4b')]&&_0x12eb66['Variable'][_0x73f6('0xf')]&&_0x12eb66[_0x73f6('0x22')]&&_0x12eb66[_0x73f6('0x45')]){_0x5cad58[_0x12eb66[_0x73f6('0x4b')][_0x73f6('0xf')][_0x73f6('0x46')]()]&&_0x9c48ea[_0x73f6('0x4a')][_0x73f6('0x21')]({'id':_0x12eb66[_0x73f6('0x22')],'value':_0x5cad58[_0x12eb66['Variable']['name']['toLowerCase']()][_0x73f6('0x28')]()});}});}return _0x9c48ea;}function getConnection(_0xeff85e){return request({'method':_0x73f6('0xc'),'form':{'method':_0x73f6('0x4c'),'input_type':_0x73f6('0x2b'),'response_type':'JSON','rest_data':JSON[_0x73f6('0x24')]({'user_auth':{'user_name':_0xeff85e[_0x73f6('0x4d')],'password':_0xeff85e[_0x73f6('0x4e')],'encryption':'PLAIN'},'application':_0x73f6('0x4f')})}})[_0x73f6('0x31')](function(_0x5430d1){var _0x3800f3=_0x5430d1;if(_0x3800f3['id']){def[_0x73f6('0x50')]=_0x3800f3['id'];return BPromise[_0x73f6('0x38')](_0x3800f3);}else{throw new Error(util[_0x73f6('0x26')](_0x73f6('0x51'),_0xeff85e['id']));}});}function setRelationship(_0x1445c3,_0x1633bb,_0x5aa0d4,_0x402ed6){return request({'form':{'method':'set_relationship','input_type':_0x73f6('0x2b'),'response_type':_0x73f6('0x2b'),'rest_data':JSON['stringify']({'session':_0x1445c3['id'],'module_name':_0x73f6('0x25'),'module_id':_0x5aa0d4['id'],'link_field_name':_0x402ed6,'related_ids':[_0x1633bb['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x73f6('0x52')]=function(_0x248987,_0x456e7e,_0x53d57f,_0x55d486,_0x4aad3c,_0x39a0bc){var _0x2a67f9,_0x402099,_0x43b483,_0xf0b772;_0x39a0bc[_0x73f6('0x53')]=intUtil[_0x73f6('0x54')](_0x39a0bc[_0x73f6('0x53')]);_0x39a0bc[_0x73f6('0x55')]=intUtil[_0x73f6('0x54')](_0x39a0bc['serverUrl']);def[_0x73f6('0x56')]=util['format'](_0x73f6('0x57'),_0x39a0bc[_0x73f6('0x53')]);if(_0x4aad3c&&_0x4aad3c[_0x73f6('0x58')]){logger[_0x73f6('0x2c')](_0x73f6('0x59'),_0x73f6('0x5a'));_0x456e7e['recordingURL']=util['format'](_0x73f6('0x5b'),_0x39a0bc[_0x73f6('0x55')],_0x456e7e['uniqueid'],md5(_0x456e7e[_0x73f6('0x5c')]));}else{_0x456e7e[_0x73f6('0x5d')]='';}return getConnection(_0x39a0bc)[_0x73f6('0x31')](function(_0x124326){_0xf0b772=_0x124326;return getUser(_0x39a0bc,_0x55d486[_0x73f6('0xf')],_0xf0b772);})['then'](function(_0x35aa9d){_0x2a67f9=_0x35aa9d;logger[_0x73f6('0x2c')](_0x73f6('0x5e'),_0x2a67f9['id']);return getEndUser(_0x39a0bc,_0x456e7e[_0x73f6('0x5f')],_0x456e7e[_0x73f6('0x60')],_0xf0b772);})['then'](function(_0x1225c1){_0x402099=_0x1225c1;logger['info'](_0x73f6('0x61'),_0x402099['id']);return getTicket(_0x39a0bc,_0x2a67f9,_0x402099,_0x53d57f,_0x456e7e,_0x53d57f['Fields'],_0xf0b772,'Inbound');})[_0x73f6('0x31')](function(_0x2a8b2f){_0x43b483=_0x2a8b2f;logger[_0x73f6('0x2c')](_0x73f6('0x62'));logger[_0x73f6('0x2c')](_0x73f6('0x63'),_0x43b483['id']);return setRelationship(_0xf0b772,_0x2a67f9,_0x43b483,_0x73f6('0x64'));})[_0x73f6('0x31')](function(){return setRelationship(_0xf0b772,_0x402099,_0x43b483,'contacts');})[_0x73f6('0x31')](function(){return getServerInfo(_0xf0b772);})[_0x73f6('0x31')](function(_0x2a705b){var _0x2d6a3c=parseInt(_0x2a705b[_0x73f6('0x65')]['charAt'](0x0));var _0x2f09c7=util[_0x73f6('0x26')](_0x73f6('0x66'),_0x39a0bc[_0x73f6('0x53')],_0x43b483['id']);if(_0x2d6a3c>0x6){_0x2f09c7=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x39a0bc[_0x73f6('0x53')],_0x43b483['id']);}logger['info'](_0x73f6('0x59'),_0x73f6('0x67'));emit(util[_0x73f6('0x26')]('user:%s',_0x55d486[_0x73f6('0xf')]),_0x73f6('0x68'),{'uri':_0x2f09c7});})[_0x73f6('0x69')](function(_0x3068fc){logger[_0x73f6('0x6a')](_0x73f6('0x59'),JSON[_0x73f6('0x24')](_0x3068fc));});};exports[_0x73f6('0x6b')]=function(_0x4e0b0e,_0x241211,_0x466412,_0x2221b4,_0x51ae99,_0x51f890,_0x1f862d){var _0x275735,_0x3fcbff,_0x24a46b,_0x35f139;_0x51f890[_0x73f6('0x53')]=intUtil[_0x73f6('0x54')](_0x51f890[_0x73f6('0x53')]);_0x51f890['serverUrl']=intUtil[_0x73f6('0x54')](_0x51f890['serverUrl']);def[_0x73f6('0x56')]=util['format'](_0x73f6('0x57'),_0x51f890[_0x73f6('0x53')]);if(_0x1f862d&&_0x1f862d[_0x73f6('0x6c')]&&_0x1f862d[_0x73f6('0x6c')]!==_0x73f6('0x6d')){logger[_0x73f6('0x2c')]('[OUTBOUND]',_0x73f6('0x5a'));_0x241211['recordingURL']=util[_0x73f6('0x26')](_0x73f6('0x5b'),_0x51f890[_0x73f6('0x55')],_0x241211['uniqueid'],md5(_0x241211[_0x73f6('0x5c')]));}return getConnection(_0x51f890)[_0x73f6('0x31')](function(_0x3566c7){_0x35f139=_0x3566c7;return getUser(_0x51f890,_0x2221b4[_0x73f6('0xf')],_0x35f139);})[_0x73f6('0x31')](function(_0xccffb){_0x275735=_0xccffb;logger[_0x73f6('0x2c')](_0x73f6('0x5e'),_0x275735['id']);return getEndUser(_0x51f890,_0x241211[_0x73f6('0x6e')],_0x241211[_0x73f6('0x6f')],_0x35f139);})[_0x73f6('0x31')](function(_0x3d41ab){_0x3fcbff=_0x3d41ab;logger[_0x73f6('0x2c')](_0x73f6('0x61'),_0x3fcbff['id']);return getTicket(_0x51f890,_0x275735,_0x3fcbff,_0x466412,_0x241211,_0x466412['Fields'],_0x35f139,_0x73f6('0x70'));})['then'](function(_0x2ee861){_0x24a46b=_0x2ee861;logger['info'](_0x73f6('0x62'));logger['info'](_0x73f6('0x63'),_0x24a46b['id']);return setRelationship(_0x35f139,_0x275735,_0x24a46b,_0x73f6('0x64'));})[_0x73f6('0x31')](function(){return setRelationship(_0x35f139,_0x3fcbff,_0x24a46b,'contacts');})['then'](function(){return getServerInfo(_0x35f139);})[_0x73f6('0x31')](function(_0xad9a98){var _0x2c3b1b=parseInt(_0xad9a98[_0x73f6('0x65')]['charAt'](0x0));var _0x5fe40b=util[_0x73f6('0x26')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x51f890[_0x73f6('0x53')],_0x24a46b['id']);if(_0x2c3b1b>0x6){_0x5fe40b=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x51f890[_0x73f6('0x53')],_0x24a46b['id']);}logger['info'](_0x73f6('0x71'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x73f6('0x72'),_0x2221b4['name']),_0x73f6('0x68'),{'uri':_0x5fe40b});})['catch'](function(_0xdbc2ee){logger[_0x73f6('0x6a')](_0x73f6('0x71'),JSON[_0x73f6('0x24')](_0xdbc2ee));});};exports['unmanaged']=function(_0x277b9f,_0xe1d5ec,_0x4e024b,_0x1580ab,_0x4f8623,_0x49aa16){var _0x18fa1d,_0xd13a51,_0x3cfe79,_0x11ac27;_0x49aa16['remoteUri']=intUtil[_0x73f6('0x54')](_0x49aa16[_0x73f6('0x53')]);_0x49aa16[_0x73f6('0x55')]=intUtil[_0x73f6('0x54')](_0x49aa16[_0x73f6('0x55')]);def['uri']=util[_0x73f6('0x26')](_0x73f6('0x57'),_0x49aa16[_0x73f6('0x53')]);if(_0x4f8623&&_0x4f8623[_0x73f6('0x58')]){logger[_0x73f6('0x2c')]('['+_0xe1d5ec['lastevent'][_0x73f6('0x73')]()+']',_0x73f6('0x5a'));_0xe1d5ec['recordingURL']=util[_0x73f6('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49aa16[_0x73f6('0x55')],_0xe1d5ec['uniqueid'],md5(_0xe1d5ec[_0x73f6('0x5c')]));}else{_0xe1d5ec[_0x73f6('0x5d')]='';}return getConnection(_0x49aa16)[_0x73f6('0x31')](function(_0x27acab){_0x11ac27=_0x27acab;if(!_[_0x73f6('0x74')](_0x1580ab)){return getUser(_0x49aa16,_0x1580ab[_0x73f6('0xf')],_0x11ac27);}else{return getUser(_0x49aa16,null,_0x11ac27);}})[_0x73f6('0x31')](function(_0x4bccdc){_0x18fa1d=_0x4bccdc;logger[_0x73f6('0x2c')](_0x73f6('0x5e'),_0x18fa1d['id']);return getEndUser(_0x49aa16,_0xe1d5ec[_0x73f6('0x5f')],_0xe1d5ec[_0x73f6('0x60')],_0x11ac27);})['then'](function(_0x4cc707){_0xd13a51=_0x4cc707;logger[_0x73f6('0x2c')](_0x73f6('0x61'),_0xd13a51['id']);return getTicket(_0x49aa16,_0x18fa1d,_0xd13a51,_0x4e024b,_0xe1d5ec,_0x4e024b[_0x73f6('0x75')],_0x11ac27,_0x73f6('0x76'));})[_0x73f6('0x31')](function(_0x361dcb){_0x3cfe79=_0x361dcb;logger['info'](_0x73f6('0x62'));logger[_0x73f6('0x2c')](_0x73f6('0x63'),_0x3cfe79['id']);return setRelationship(_0x11ac27,_0x18fa1d,_0x3cfe79,_0x73f6('0x64'));})[_0x73f6('0x31')](function(){return setRelationship(_0x11ac27,_0xd13a51,_0x3cfe79,'contacts');})[_0x73f6('0x31')](function(){return getServerInfo(_0x11ac27);})[_0x73f6('0x69')](function(_0x291794){logger[_0x73f6('0x6a')]('['+_0xe1d5ec['lastevent'][_0x73f6('0x73')]()+']',JSON[_0x73f6('0x24')](_0x291794));});}; \ No newline at end of file +var _0x8c9b=['contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','then','Enduser\x20created.','debug','[HTTP]','type','string','nameField','toLowerCase','idField','customField','custom_fields','content','customVariable','Variable','POST','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','Fields','Inbound','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','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','users','catch','unmanaged','toUpperCase','isNil','calleridnum','lastevent','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','sugarcrm','defaults','redis','localhost','socket.io-emitter','emit','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','get_server_info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','find','name_value_list','user_name','value','Agent\x20found!','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!'];(function(_0x40a6f0,_0x556962){var _0x1c5519=function(_0x3d5513){while(--_0x3d5513){_0x40a6f0['push'](_0x40a6f0['shift']());}};_0x1c5519(++_0x556962);}(_0x8c9b,0xb7));var _0xb8c9=function(_0x4872c9,_0x3efc87){_0x4872c9=_0x4872c9-0x0;var _0x445cc8=_0x8c9b[_0x4872c9];return _0x445cc8;};'use strict';var _=require(_0xb8c9('0x0'));var rp=require(_0xb8c9('0x1'));var BPromise=require(_0xb8c9('0x2'));var md5=require(_0xb8c9('0x3'));var util=require(_0xb8c9('0x4'));var Redis=require('ioredis');var intUtil=require(_0xb8c9('0x5'));var config=require(_0xb8c9('0x6'));var logger=require('../../../../config/logger')(_0xb8c9('0x7'));config['redis']=_[_0xb8c9('0x8')](config[_0xb8c9('0x9')],{'host':_0xb8c9('0xa'),'port':0x18eb});var io=require(_0xb8c9('0xb'))(new Redis(config[_0xb8c9('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x36378d,_0x40fe6e,_0x34e2cc){io['to'](_0x36378d)[_0xb8c9('0xc')](_0x40fe6e,_0x34e2cc);}function getTicket(_0x38e3b1,_0x5bc9c0,_0xb19a5f,_0x5277f4,_0x5466ea,_0xc7cb09,_0x1f87e5,_0x205790){logger[_0xb8c9('0xd')]('Creating\x20new\x20ticket...');var _0x8f0b1c=new Date();var _0x404f04=[{'name':_0xb8c9('0xe'),'value':intUtil[_0xb8c9('0xf')](_0x5277f4[_0xb8c9('0x10')],_0x5466ea,'\x20')},{'name':_0xb8c9('0x11'),'value':_0x5bc9c0['id']},{'name':_0xb8c9('0x12'),'value':_0x5bc9c0['id']},{'name':_0xb8c9('0x13'),'value':intUtil[_0xb8c9('0xf')](_0x5277f4[_0xb8c9('0x14')],_0x5466ea,'\x0a')},{'name':'date_start','value':_0x8f0b1c[_0xb8c9('0x15')]()[_0xb8c9('0x16')](0x0,0x13)[_0xb8c9('0x17')]('T','\x20')},{'name':_0xb8c9('0x18'),'value':'0'},{'name':_0xb8c9('0x19'),'value':'15'},{'name':_0xb8c9('0x1a'),'value':_0xb19a5f['id']},{'name':'parent_type','value':_0xb8c9('0x1b')},{'name':_0xb8c9('0x1c'),'value':_0xb19a5f[_0xb8c9('0xe')]},{'name':_0xb8c9('0x1d'),'value':_0x205790}];if(_0xc7cb09[_0xb8c9('0x1e')]){_['forEach'](_0xc7cb09,function(_0x2645e7){if(_0x5466ea[_0x2645e7[_0xb8c9('0x1f')]]){_0x404f04[_0xb8c9('0x20')]({'name':_0x2645e7['idField'],'value':_0x5466ea[_0x2645e7['variableName']]});}});}return request({'form':{'method':_0xb8c9('0x21'),'input_type':'JSON','response_type':_0xb8c9('0x22'),'rest_data':JSON[_0xb8c9('0x23')]({'session':_0x1f87e5['id'],'module_name':_0xb8c9('0x24'),'name_value_list':_0x404f04})}});}function getAuth(_0x414dfa){return util[_0xb8c9('0x25')](_0xb8c9('0x26'),new Buffer(_0x414dfa['apiKey']+':X')[_0xb8c9('0x27')]('base64'));}function getServerInfo(_0x3877d8){return request({'form':{'method':_0xb8c9('0x28'),'input_type':_0xb8c9('0x22'),'response_type':_0xb8c9('0x22'),'rest_data':JSON[_0xb8c9('0x23')]({'session':_0x3877d8['id']})}});}function getUser(_0x576e5c,_0x9b8976,_0x17e47a){if(!_['isNil'](_0x9b8976)){logger[_0xb8c9('0xd')]('Getting\x20agent\x20with\x20name',_0x9b8976);return request({'form':{'method':_0xb8c9('0x29'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xb8c9('0x23')]({'session':_0x17e47a['id'],'module_name':_0xb8c9('0x2a'),'query':util[_0xb8c9('0x25')](_0xb8c9('0x2b'),_0x9b8976),'order_by':'','offset':'0','select_fields':['id',_0xb8c9('0xe'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1c9a0b){if(_0x1c9a0b[_0xb8c9('0x2c')][_0xb8c9('0x1e')]){var _0x273241=_[_0xb8c9('0x2d')](_0x1c9a0b['entry_list'],function(_0x3fb6da){return _0x3fb6da[_0xb8c9('0x2e')][_0xb8c9('0x2f')][_0xb8c9('0x30')]===_0x9b8976;});if(_0x273241){logger[_0xb8c9('0xd')](_0xb8c9('0x31'));return BPromise['resolve']({'id':_0x273241[_0xb8c9('0x2e')]['id'][_0xb8c9('0x30')],'name':_0x273241[_0xb8c9('0x2e')][_0xb8c9('0xe')][_0xb8c9('0x30')]});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xb8c9('0x32')]({'id':_0x17e47a['name_value_list'][_0xb8c9('0x33')]['value'],'name':_0x17e47a[_0xb8c9('0x2e')][_0xb8c9('0x2f')][_0xb8c9('0x30')]});});}else{logger[_0xb8c9('0xd')](_0xb8c9('0x34'));return BPromise[_0xb8c9('0x32')]({'id':_0x17e47a[_0xb8c9('0x2e')][_0xb8c9('0x33')][_0xb8c9('0x30')],'name':_0x17e47a['name_value_list'][_0xb8c9('0x2f')][_0xb8c9('0x30')]});}}function getEndUser(_0x4a4ab7,_0x51b54b,_0x230846,_0x1b48bf){logger[_0xb8c9('0xd')]('Searching\x20enduser\x20with\x20phone',_0x230846);return request({'form':{'method':_0xb8c9('0x29'),'input_type':'JSON','response_type':_0xb8c9('0x22'),'rest_data':JSON[_0xb8c9('0x23')]({'session':_0x1b48bf['id'],'module_name':_0xb8c9('0x1b'),'query':util[_0xb8c9('0x25')](_0xb8c9('0x35'),_0x230846),'order_by':'','offset':'0','select_fields':['id','name',_0xb8c9('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x442630){if(_0x442630[_0xb8c9('0x2c')][_0xb8c9('0x1e')]){var _0x4d875a=_['find'](_0x442630[_0xb8c9('0x2c')],function(_0x56410f){return _0x56410f[_0xb8c9('0x2e')][_0xb8c9('0x36')][_0xb8c9('0x30')]===_0x230846;});if(_0x4d875a){logger[_0xb8c9('0xd')]('Enduser\x20found!');return BPromise[_0xb8c9('0x32')]({'id':_0x4d875a[_0xb8c9('0x2e')]['id'][_0xb8c9('0x30')],'name':_0x4d875a[_0xb8c9('0x2e')][_0xb8c9('0xe')][_0xb8c9('0x30')],'phone':_0x4d875a[_0xb8c9('0x2e')]['phone_home'][_0xb8c9('0x30')]});}}else{logger[_0xb8c9('0xd')](_0xb8c9('0x37'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xb8c9('0x22'),'rest_data':JSON[_0xb8c9('0x23')]({'session':_0x1b48bf['id'],'module_name':_0xb8c9('0x1b'),'name_value_list':[{'name':_0xb8c9('0x38'),'value':_0x51b54b!==''?_0x51b54b:util[_0xb8c9('0x25')](_0xb8c9('0x39'),_0x230846)},{'name':_0xb8c9('0x36'),'value':_0x230846}]})}})[_0xb8c9('0x3a')](function(_0x3b3331){logger[_0xb8c9('0xd')](_0xb8c9('0x3b'));return BPromise['resolve']({'id':_0x3b3331['id'],'name':_0x3b3331[_0xb8c9('0x2c')][_0xb8c9('0x38')][_0xb8c9('0x30')],'phone':_0x3b3331[_0xb8c9('0x2c')]['phone_home'][_0xb8c9('0x30')]});});}});}function request(_0x17946d){logger[_0xb8c9('0x3c')](_0xb8c9('0x3d'),JSON[_0xb8c9('0x23')](_0x17946d));return rp(_['merge'](def,_0x17946d));}function getTags(_0x544ac,_0x9cef60){var _0x40aad8=[];if(_0x544ac&&_0x544ac['length']>0x0){_0x40aad8=_['map'](_0x544ac,_0x9cef60);}return _0x40aad8;}function getCustomFields(_0x2fba5f,_0x472250){var _0x4d5c22=[];var _0x32bae8={'custom_fields':[]};if(_0x2fba5f[_0xb8c9('0x1e')]>0x0){_['forEach'](_0x2fba5f,function(_0x2c0924){if(_0x2c0924[_0xb8c9('0x3e')]===_0xb8c9('0x3f')&&_0x2c0924[_0xb8c9('0x40')]&&!_0x2c0924['customField']){_0x32bae8[_0x2c0924['nameField'][_0xb8c9('0x41')]()]=_0x2c0924['content']['toString']();}else if(_0x2c0924['type']===_0xb8c9('0x3f')&&_0x2c0924[_0xb8c9('0x42')]&&_0x2c0924[_0xb8c9('0x43')]){_0x32bae8[_0xb8c9('0x44')][_0xb8c9('0x20')]({'id':_0x2c0924[_0xb8c9('0x42')],'value':_0x2c0924[_0xb8c9('0x45')][_0xb8c9('0x27')]()});}else if(_0x2c0924[_0xb8c9('0x3e')]==='variable'&&_0x2c0924[_0xb8c9('0x1f')]&&_0x2c0924[_0xb8c9('0x42')]&&_0x2c0924['customField']){_0x472250[_0x2c0924[_0xb8c9('0x1f')]]&&_0x32bae8[_0xb8c9('0x44')][_0xb8c9('0x20')]({'id':_0x2c0924[_0xb8c9('0x42')],'value':_0x472250[_0x2c0924[_0xb8c9('0x1f')]]['toString']()});}else if(_0x2c0924[_0xb8c9('0x3e')]===_0xb8c9('0x46')&&_0x2c0924[_0xb8c9('0x47')]&&_0x2c0924[_0xb8c9('0x47')][_0xb8c9('0xe')]&&_0x2c0924[_0xb8c9('0x42')]&&_0x2c0924[_0xb8c9('0x43')]){_0x472250[_0x2c0924[_0xb8c9('0x47')][_0xb8c9('0xe')][_0xb8c9('0x41')]()]&&_0x32bae8[_0xb8c9('0x44')][_0xb8c9('0x20')]({'id':_0x2c0924['idField'],'value':_0x472250[_0x2c0924[_0xb8c9('0x47')][_0xb8c9('0xe')][_0xb8c9('0x41')]()][_0xb8c9('0x27')]()});}});}return _0x32bae8;}function getConnection(_0x2c8427){return request({'method':_0xb8c9('0x48'),'form':{'method':'login','input_type':'JSON','response_type':_0xb8c9('0x22'),'rest_data':JSON[_0xb8c9('0x23')]({'user_auth':{'user_name':_0x2c8427['username'],'password':_0x2c8427[_0xb8c9('0x49')],'encryption':_0xb8c9('0x4a')},'application':_0xb8c9('0x4b')})}})['then'](function(_0x2b21d0){var _0x2db237=_0x2b21d0;if(_0x2db237['id']){def[_0xb8c9('0x4c')]=_0x2db237['id'];return BPromise['resolve'](_0x2db237);}else{throw new Error(util[_0xb8c9('0x25')]('Account\x20%d\x20is\x20not\x20valid',_0x2c8427['id']));}});}function setRelationship(_0x35db83,_0x34e5d0,_0x209e84,_0x2b0be3){return request({'form':{'method':_0xb8c9('0x4d'),'input_type':_0xb8c9('0x22'),'response_type':_0xb8c9('0x22'),'rest_data':JSON[_0xb8c9('0x23')]({'session':_0x35db83['id'],'module_name':_0xb8c9('0x24'),'module_id':_0x209e84['id'],'link_field_name':_0x2b0be3,'related_ids':[_0x34e5d0['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3fbb0e,_0x35777b,_0x365c6a,_0x1b4476,_0x33c610,_0x502dfc){var _0x46f401,_0x3b3e2f,_0x2297da,_0x4fbd55;_0x502dfc['remoteUri']=intUtil[_0xb8c9('0x4e')](_0x502dfc[_0xb8c9('0x4f')]);_0x502dfc['serverUrl']=intUtil[_0xb8c9('0x4e')](_0x502dfc[_0xb8c9('0x50')]);def[_0xb8c9('0x51')]=util[_0xb8c9('0x25')](_0xb8c9('0x52'),_0x502dfc[_0xb8c9('0x4f')]);if(_0x33c610&&_0x33c610[_0xb8c9('0x53')]){logger[_0xb8c9('0xd')]('[QUEUE]',_0xb8c9('0x54'));_0x35777b[_0xb8c9('0x55')]=util[_0xb8c9('0x25')](_0xb8c9('0x56'),_0x502dfc[_0xb8c9('0x50')],_0x35777b[_0xb8c9('0x57')],md5(_0x35777b[_0xb8c9('0x57')]));}else{_0x35777b[_0xb8c9('0x55')]='';}return getConnection(_0x502dfc)[_0xb8c9('0x3a')](function(_0x5f18d4){_0x4fbd55=_0x5f18d4;return getUser(_0x502dfc,_0x1b4476['name'],_0x4fbd55);})[_0xb8c9('0x3a')](function(_0x55c02e){_0x46f401=_0x55c02e;logger[_0xb8c9('0xd')](_0xb8c9('0x58'),_0x46f401['id']);return getEndUser(_0x502dfc,_0x35777b[_0xb8c9('0x59')],_0x35777b['calleridnum'],_0x4fbd55);})[_0xb8c9('0x3a')](function(_0x11fc63){_0x3b3e2f=_0x11fc63;logger[_0xb8c9('0xd')]('The\x20Enduser\x20ID\x20is:',_0x3b3e2f['id']);return getTicket(_0x502dfc,_0x46f401,_0x3b3e2f,_0x365c6a,_0x35777b,_0x365c6a[_0xb8c9('0x5a')],_0x4fbd55,_0xb8c9('0x5b'));})['then'](function(_0x44d429){_0x2297da=_0x44d429;logger[_0xb8c9('0xd')](_0xb8c9('0x5c'));logger[_0xb8c9('0xd')](_0xb8c9('0x5d'),_0x2297da['id']);return setRelationship(_0x4fbd55,_0x46f401,_0x2297da,'users');})['then'](function(){return setRelationship(_0x4fbd55,_0x3b3e2f,_0x2297da,_0xb8c9('0x5e'));})['then'](function(){return getServerInfo(_0x4fbd55);})[_0xb8c9('0x3a')](function(_0x5129e3){var _0x8a3ac9=parseInt(_0x5129e3['version'][_0xb8c9('0x5f')](0x0));var _0x433eb1=util[_0xb8c9('0x25')](_0xb8c9('0x60'),_0x502dfc['remoteUri'],_0x2297da['id']);if(_0x8a3ac9>0x6){_0x433eb1=util['format'](_0xb8c9('0x61'),_0x502dfc[_0xb8c9('0x4f')],_0x2297da['id']);}logger[_0xb8c9('0xd')]('[QUEUE]',_0xb8c9('0x62'));emit(util[_0xb8c9('0x25')](_0xb8c9('0x63'),_0x1b4476[_0xb8c9('0xe')]),_0xb8c9('0x64'),{'uri':_0x433eb1});})['catch'](function(_0x57eaf2){logger[_0xb8c9('0x65')](_0xb8c9('0x66'),JSON[_0xb8c9('0x23')](_0x57eaf2));});};exports[_0xb8c9('0x67')]=function(_0x19fe3d,_0x34f300,_0x4e28e4,_0x1a5e58,_0x463c76,_0x1cffd0,_0x108dab){var _0x561669,_0x17d6bb,_0x16a18f,_0x290059;_0x1cffd0[_0xb8c9('0x4f')]=intUtil[_0xb8c9('0x4e')](_0x1cffd0['remoteUri']);_0x1cffd0['serverUrl']=intUtil[_0xb8c9('0x4e')](_0x1cffd0[_0xb8c9('0x50')]);def[_0xb8c9('0x51')]=util[_0xb8c9('0x25')]('%s/service/v4_1/rest.php',_0x1cffd0['remoteUri']);if(_0x108dab&&_0x108dab['recordingFormat']&&_0x108dab[_0xb8c9('0x68')]!==_0xb8c9('0x69')){logger['info'](_0xb8c9('0x6a'),_0xb8c9('0x54'));_0x34f300[_0xb8c9('0x55')]=util[_0xb8c9('0x25')](_0xb8c9('0x56'),_0x1cffd0[_0xb8c9('0x50')],_0x34f300[_0xb8c9('0x57')],md5(_0x34f300['uniqueid']));}return getConnection(_0x1cffd0)[_0xb8c9('0x3a')](function(_0x3ae266){_0x290059=_0x3ae266;return getUser(_0x1cffd0,_0x1a5e58[_0xb8c9('0xe')],_0x290059);})[_0xb8c9('0x3a')](function(_0x293fbf){_0x561669=_0x293fbf;logger[_0xb8c9('0xd')]('The\x20User\x20ID\x20is:',_0x561669['id']);return getEndUser(_0x1cffd0,_0x34f300[_0xb8c9('0x6b')],_0x34f300[_0xb8c9('0x6c')],_0x290059);})[_0xb8c9('0x3a')](function(_0x1cd700){_0x17d6bb=_0x1cd700;logger[_0xb8c9('0xd')](_0xb8c9('0x6d'),_0x17d6bb['id']);return getTicket(_0x1cffd0,_0x561669,_0x17d6bb,_0x4e28e4,_0x34f300,_0x4e28e4[_0xb8c9('0x5a')],_0x290059,_0xb8c9('0x6e'));})[_0xb8c9('0x3a')](function(_0x22d331){_0x16a18f=_0x22d331;logger['info'](_0xb8c9('0x5c'));logger['info'](_0xb8c9('0x5d'),_0x16a18f['id']);return setRelationship(_0x290059,_0x561669,_0x16a18f,_0xb8c9('0x6f'));})[_0xb8c9('0x3a')](function(){return setRelationship(_0x290059,_0x17d6bb,_0x16a18f,_0xb8c9('0x5e'));})[_0xb8c9('0x3a')](function(){return getServerInfo(_0x290059);})[_0xb8c9('0x3a')](function(_0x5240a5){var _0xb5ba34=parseInt(_0x5240a5['version']['charAt'](0x0));var _0x2d8731=util[_0xb8c9('0x25')](_0xb8c9('0x60'),_0x1cffd0[_0xb8c9('0x4f')],_0x16a18f['id']);if(_0xb5ba34>0x6){_0x2d8731=util[_0xb8c9('0x25')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1cffd0[_0xb8c9('0x4f')],_0x16a18f['id']);}logger[_0xb8c9('0xd')](_0xb8c9('0x6a'),_0xb8c9('0x62'));emit(util[_0xb8c9('0x25')](_0xb8c9('0x63'),_0x1a5e58['name']),_0xb8c9('0x64'),{'uri':_0x2d8731});})[_0xb8c9('0x70')](function(_0x5947ab){logger[_0xb8c9('0x65')]('[OUTBOUND]',JSON[_0xb8c9('0x23')](_0x5947ab));});};exports[_0xb8c9('0x71')]=function(_0xc69363,_0x135185,_0x4f3f2c,_0xd00bac,_0x1e96e9,_0x211ff6){var _0x239fad,_0x1e6085,_0xda6449,_0x478cb6;_0x211ff6[_0xb8c9('0x4f')]=intUtil[_0xb8c9('0x4e')](_0x211ff6['remoteUri']);_0x211ff6['serverUrl']=intUtil[_0xb8c9('0x4e')](_0x211ff6[_0xb8c9('0x50')]);def[_0xb8c9('0x51')]=util['format'](_0xb8c9('0x52'),_0x211ff6[_0xb8c9('0x4f')]);if(_0x1e96e9&&_0x1e96e9[_0xb8c9('0x53')]){logger['info']('['+_0x135185['lastevent'][_0xb8c9('0x72')]()+']',_0xb8c9('0x54'));_0x135185[_0xb8c9('0x55')]=util['format'](_0xb8c9('0x56'),_0x211ff6[_0xb8c9('0x50')],_0x135185['uniqueid'],md5(_0x135185['uniqueid']));}else{_0x135185[_0xb8c9('0x55')]='';}return getConnection(_0x211ff6)[_0xb8c9('0x3a')](function(_0xec6907){_0x478cb6=_0xec6907;if(!_[_0xb8c9('0x73')](_0xd00bac)){return getUser(_0x211ff6,_0xd00bac[_0xb8c9('0xe')],_0x478cb6);}else{return getUser(_0x211ff6,null,_0x478cb6);}})[_0xb8c9('0x3a')](function(_0xaefe55){_0x239fad=_0xaefe55;logger[_0xb8c9('0xd')](_0xb8c9('0x58'),_0x239fad['id']);return getEndUser(_0x211ff6,_0x135185[_0xb8c9('0x59')],_0x135185[_0xb8c9('0x74')],_0x478cb6);})[_0xb8c9('0x3a')](function(_0x11c97d){_0x1e6085=_0x11c97d;logger['info'](_0xb8c9('0x6d'),_0x1e6085['id']);return getTicket(_0x211ff6,_0x239fad,_0x1e6085,_0x4f3f2c,_0x135185,_0x4f3f2c[_0xb8c9('0x5a')],_0x478cb6,'Inbound');})[_0xb8c9('0x3a')](function(_0xf7c7dd){_0xda6449=_0xf7c7dd;logger[_0xb8c9('0xd')](_0xb8c9('0x5c'));logger[_0xb8c9('0xd')](_0xb8c9('0x5d'),_0xda6449['id']);return setRelationship(_0x478cb6,_0x239fad,_0xda6449,_0xb8c9('0x6f'));})[_0xb8c9('0x3a')](function(){return setRelationship(_0x478cb6,_0x1e6085,_0xda6449,_0xb8c9('0x5e'));})[_0xb8c9('0x3a')](function(){return getServerInfo(_0x478cb6);})[_0xb8c9('0x70')](function(_0xbe2f57){logger['error']('['+_0x135185[_0xb8c9('0x75')][_0xb8c9('0x72')]()+']',JSON[_0xb8c9('0x23')](_0xbe2f57));});}; \ 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 b1dc54d..15f8909 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 _0x462e=['format','%s:\x20%s','keyContent','join','slice','substring','lastIndexOf','isNil','test','length','type','string','push','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','key'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x462e,0x65));var _0xe462=function(_0x97abaa,_0x53fa68){_0x97abaa=_0x97abaa-0x0;var _0x49547a=_0x462e[_0x97abaa];return _0x49547a;};'use strict';var _=require('lodash');var util=require('util');exports['getString']=function(_0x2854f2,_0x12c32b,_0x4eead4){var _0x2ff9ef=[];if(_0x2854f2[_0xe462('0x0')]>0x0){var _0x4f745e=_['sortBy'](_0x2854f2,['id']);for(var _0x58d1de=0x0;_0x58d1de<_0x4f745e[_0xe462('0x0')];_0x58d1de++){var _0x595f9a=_0x4f745e[_0x58d1de];if(_0x595f9a[_0xe462('0x1')]===_0xe462('0x2')){_0x2ff9ef[_0xe462('0x3')](_0x595f9a['content']);}else if(_0x595f9a[_0xe462('0x1')]===_0xe462('0x4')&&_0x595f9a[_0xe462('0x5')]){_0x12c32b[_0x595f9a[_0xe462('0x5')]]&&_0x2ff9ef['push'](_0x12c32b[_0x595f9a[_0xe462('0x5')]]['toString']());}else if(_0x595f9a['type']===_0xe462('0x6')&&_0x595f9a[_0xe462('0x7')]&&_0x595f9a[_0xe462('0x7')][_0xe462('0x8')]){_0x12c32b[_0x595f9a[_0xe462('0x7')]['name']['toLowerCase']()]&&_0x2ff9ef[_0xe462('0x3')](_0x12c32b[_0x595f9a[_0xe462('0x7')][_0xe462('0x8')][_0xe462('0x9')]()][_0xe462('0xa')]());}else if(_0x595f9a['type']===_0xe462('0xb')){if(_0x595f9a[_0xe462('0xc')]==='string'&&_0x595f9a[_0xe462('0xd')]){_0x2ff9ef[_0xe462('0x3')](util[_0xe462('0xe')](_0xe462('0xf'),_0x595f9a['key'],_0x595f9a[_0xe462('0x10')]));}else if(_0x595f9a[_0xe462('0xc')]==='variable'&&_0x595f9a[_0xe462('0x5')]&&_0x595f9a[_0xe462('0xd')]){_0x12c32b[_0x595f9a[_0xe462('0x5')]]&&_0x2ff9ef[_0xe462('0x3')](util[_0xe462('0xe')](_0xe462('0xf'),_0x595f9a['key'],_0x12c32b[_0x595f9a['variableName']]));}else if(_0x595f9a['keyType']===_0xe462('0x6')&&_0x595f9a[_0xe462('0x7')]&&_0x595f9a[_0xe462('0x7')][_0xe462('0x8')]&&_0x595f9a['key']){_0x12c32b[_0x595f9a[_0xe462('0x7')][_0xe462('0x8')][_0xe462('0x9')]()]&&_0x2ff9ef[_0xe462('0x3')](util['format'](_0xe462('0xf'),_0x595f9a[_0xe462('0xd')],_0x12c32b[_0x595f9a['Variable'][_0xe462('0x8')][_0xe462('0x9')]()]));}}}}return _0x2ff9ef[_0xe462('0x11')](_0x4eead4);};exports['stripTrailingSlash']=function(_0x9633ed){var _0x4165da=_0x9633ed[_0xe462('0x12')](-0x1);if(_0x4165da==='/'){_0x9633ed=_0x9633ed[_0xe462('0x13')](0x0,_0x9633ed[_0xe462('0x14')](_0x4165da));}return _0x9633ed;};exports['validateEmail']=function(_0x3b7602){if(!_[_0xe462('0x15')](_0x3b7602)&&_0x3b7602!==''){var _0x201716=/^(([^<>()\[\]\\.,;:\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 _0x201716[_0xe462('0x16')](String(_0x3b7602)[_0xe462('0x9')]());}else{return![];}}; \ No newline at end of file +var _0x01d5=['isNil','test','lodash','util','getString','length','push','type','variable','variableName','Variable','name','toString','string','key','%s:\x20%s','keyContent','keyType','format','toLowerCase','join','stripTrailingSlash','slice','validateEmail'];(function(_0x4708c0,_0x571b22){var _0x1cb0e0=function(_0x514757){while(--_0x514757){_0x4708c0['push'](_0x4708c0['shift']());}};_0x1cb0e0(++_0x571b22);}(_0x01d5,0x1ca));var _0x501d=function(_0x179620,_0x9d4cd8){_0x179620=_0x179620-0x0;var _0x5f339f=_0x01d5[_0x179620];return _0x5f339f;};'use strict';var _=require(_0x501d('0x0'));var util=require(_0x501d('0x1'));exports[_0x501d('0x2')]=function(_0x3509c0,_0x3513bf,_0x1c652a){var _0x2e3129=[];if(_0x3509c0['length']>0x0){var _0x1bdbc2=_['sortBy'](_0x3509c0,['id']);for(var _0x517542=0x0;_0x517542<_0x1bdbc2[_0x501d('0x3')];_0x517542++){var _0x2276bd=_0x1bdbc2[_0x517542];if(_0x2276bd['type']==='string'){_0x2e3129[_0x501d('0x4')](_0x2276bd['content']);}else if(_0x2276bd[_0x501d('0x5')]===_0x501d('0x6')&&_0x2276bd[_0x501d('0x7')]){_0x3513bf[_0x2276bd[_0x501d('0x7')]]&&_0x2e3129[_0x501d('0x4')](_0x3513bf[_0x2276bd['variableName']]['toString']());}else if(_0x2276bd['type']==='customVariable'&&_0x2276bd[_0x501d('0x8')]&&_0x2276bd[_0x501d('0x8')]['name']){_0x3513bf[_0x2276bd[_0x501d('0x8')][_0x501d('0x9')]['toLowerCase']()]&&_0x2e3129['push'](_0x3513bf[_0x2276bd['Variable'][_0x501d('0x9')]['toLowerCase']()][_0x501d('0xa')]());}else if(_0x2276bd[_0x501d('0x5')]==='keyValue'){if(_0x2276bd['keyType']===_0x501d('0xb')&&_0x2276bd[_0x501d('0xc')]){_0x2e3129[_0x501d('0x4')](util['format'](_0x501d('0xd'),_0x2276bd['key'],_0x2276bd[_0x501d('0xe')]));}else if(_0x2276bd[_0x501d('0xf')]===_0x501d('0x6')&&_0x2276bd[_0x501d('0x7')]&&_0x2276bd[_0x501d('0xc')]){_0x3513bf[_0x2276bd[_0x501d('0x7')]]&&_0x2e3129[_0x501d('0x4')](util[_0x501d('0x10')]('%s:\x20%s',_0x2276bd['key'],_0x3513bf[_0x2276bd[_0x501d('0x7')]]));}else if(_0x2276bd[_0x501d('0xf')]==='customVariable'&&_0x2276bd[_0x501d('0x8')]&&_0x2276bd['Variable'][_0x501d('0x9')]&&_0x2276bd[_0x501d('0xc')]){_0x3513bf[_0x2276bd[_0x501d('0x8')]['name'][_0x501d('0x11')]()]&&_0x2e3129[_0x501d('0x4')](util['format'](_0x501d('0xd'),_0x2276bd[_0x501d('0xc')],_0x3513bf[_0x2276bd[_0x501d('0x8')]['name'][_0x501d('0x11')]()]));}}}}return _0x2e3129[_0x501d('0x12')](_0x1c652a);};exports[_0x501d('0x13')]=function(_0x164031){var _0x28e9bb=_0x164031[_0x501d('0x14')](-0x1);if(_0x28e9bb==='/'){_0x164031=_0x164031['substring'](0x0,_0x164031['lastIndexOf'](_0x28e9bb));}return _0x164031;};exports[_0x501d('0x15')]=function(_0x311a46){if(!_[_0x501d('0x16')](_0x311a46)&&_0x311a46!==''){var _0x3e944c=/^(([^<>()\[\]\\.,;:\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 _0x3e944c[_0x501d('0x17')](String(_0x311a46)[_0x501d('0x11')]());}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 6d79a3c..24c5581 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 _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(_0x4724b9,_0x3b2fc7){var _0x407e14=function(_0x510233){while(--_0x510233){_0x4724b9['push'](_0x4724b9['shift']());}};_0x407e14(++_0x3b2fc7);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'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 +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index c06b938..9d86d83 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 _0x64a4=['idField','variable','variableName','customVariable','Variable','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:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','/api/v2','unmanaged','toUpperCase','lastevent','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','then','Admin\x20account\x20selected.','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','%s/search.json','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','[HTTP]','stringify','map','picklist','type','nameField','toLowerCase','content','toString','includes','string','customField','custom_fields','push'];(function(_0x2ba00c,_0x10f136){var _0x4a4853=function(_0x42add8){while(--_0x42add8){_0x2ba00c['push'](_0x2ba00c['shift']());}};_0x4a4853(++_0x10f136);}(_0x64a4,0x105));var _0x464a=function(_0x40e837,_0x3b35ee){_0x40e837=_0x40e837-0x0;var _0x43a79c=_0x64a4[_0x40e837];return _0x43a79c;};'use strict';var _=require(_0x464a('0x0'));var rp=require(_0x464a('0x1'));var md5=require(_0x464a('0x2'));var util=require(_0x464a('0x3'));var Redis=require(_0x464a('0x4'));var intUtil=require('./util');var config=require(_0x464a('0x5'));var logger=require(_0x464a('0x6'))(_0x464a('0x7'));config[_0x464a('0x8')]=_[_0x464a('0x9')](config[_0x464a('0x8')],{'host':_0x464a('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x464a('0x8')]));function emit(_0x154acc,_0x5d2ea4,_0x69e452){io['to'](_0x154acc)[_0x464a('0xb')](_0x5d2ea4,_0x69e452);}var headers={'Content-Type':_0x464a('0xc'),'Accept':'application/json'};function getTicket(_0x1aa15f,_0x12a18e,_0x36c969,_0x27cce1,_0xf6401a){logger[_0x464a('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0x464a('0xe')](_0x464a('0xf'),_0x1aa15f[_0x464a('0x10')]),'method':_0x464a('0x11'),'body':{'ticket':_[_0x464a('0x12')]({'requester_id':_0x36c969['id'],'submitter_id':_0x12a18e?_0x12a18e['id']:undefined,'assignee_id':_0x12a18e?_0x12a18e['id']:undefined,'tags':getTags(_0x27cce1[_0x464a('0x13')],_0x464a('0x14')),'subject':intUtil[_0x464a('0x15')](_0x27cce1[_0x464a('0x16')],_0xf6401a,'\x20'),'description':intUtil[_0x464a('0x15')](_0x27cce1[_0x464a('0x17')],_0xf6401a,'\x0a'),'comment':{'public':![],'body':intUtil[_0x464a('0x15')](_0x27cce1['Descriptions'],_0xf6401a,'\x0a')}},getCustomFields(_0x27cce1['Fields'],_0xf6401a))}})['then'](function(_0x17ba24){logger['info']('Ticket\x20created!');return _0x17ba24[_0x464a('0x18')];});}function getUser(_0x47b694,_0x12d5bb){if(intUtil[_0x464a('0x19')](_0x12d5bb)){logger[_0x464a('0xd')](_0x464a('0x1a'),_0x12d5bb);return request({'uri':util[_0x464a('0xe')]('%s/search.json',_0x47b694[_0x464a('0x10')]),'qs':{'query':util[_0x464a('0xe')](_0x464a('0x1b'),_0x12d5bb)}})['then'](function(_0x2d9c7a){if(_0x2d9c7a[_0x464a('0x1c')]){logger[_0x464a('0xd')]('Agent\x20found!');return _['find'](_0x2d9c7a[_0x464a('0x1d')],{'email':_0x12d5bb,'role':_0x464a('0x1e')});}else{logger['info'](_0x464a('0x1f'));return request({'uri':util['format']('%s/users/me.json',_0x47b694[_0x464a('0x10')])})[_0x464a('0x20')](function(_0x4dbfcd){logger[_0x464a('0xd')](_0x464a('0x21'));return _0x4dbfcd['user'];});}});}else{logger[_0x464a('0xd')](_0x464a('0x1f'));return request({'uri':util[_0x464a('0xe')](_0x464a('0x22'),_0x47b694[_0x464a('0x10')])})[_0x464a('0x20')](function(_0x5bc4df){logger[_0x464a('0xd')](_0x464a('0x21'));return _0x5bc4df[_0x464a('0x23')];});}}function getEndUser(_0x3c9036,_0x344641,_0x5d0569){logger[_0x464a('0xd')](_0x464a('0x24'),_0x5d0569);return request({'uri':util[_0x464a('0xe')](_0x464a('0x25'),_0x3c9036[_0x464a('0x10')]),'qs':{'query':util[_0x464a('0xe')]('type:user\x20role:end-user\x20phone:%s',_0x5d0569)}})[_0x464a('0x20')](function(_0x5c0e9d){var _0x150426;if(_0x5c0e9d['results'][_0x464a('0x26')]){_0x5c0e9d[_0x464a('0x1d')]=_[_0x464a('0x27')](_0x5c0e9d[_0x464a('0x1d')],{'suspended':![],'role':_0x464a('0x28')});if(_0x5c0e9d[_0x464a('0x1d')]['length']){_0x150426=_[_0x464a('0x29')](_0x5c0e9d[_0x464a('0x1d')]);}}if(_0x150426){logger[_0x464a('0xd')](_0x464a('0x2a'));return _0x150426;}else{logger[_0x464a('0xd')](_0x464a('0x2b'));return request({'uri':util['format']('%s/users.json',_0x3c9036[_0x464a('0x10')]),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x464a('0xe')](_0x464a('0x2c'),_0x344641||_0x5d0569),'phone':_0x5d0569}}})['then'](function(_0x1ddf79){logger['info'](_0x464a('0x2d'));return _0x1ddf79[_0x464a('0x23')];});}});}function getAuth(_0x30f869){var _0x1c1cab;if(_0x30f869[_0x464a('0x2e')]===_0x464a('0x2f')){_0x1c1cab=util['format'](_0x464a('0x30'),_0x30f869[_0x464a('0x31')],_0x30f869[_0x464a('0x2f')]);}else if(_0x30f869[_0x464a('0x2e')]==='token'){_0x1c1cab=util[_0x464a('0xe')](_0x464a('0x32'),_0x30f869[_0x464a('0x31')],_0x30f869[_0x464a('0x33')]);}return util[_0x464a('0xe')]('Basic\x20%s',new Buffer(_0x1c1cab)['toString']('base64'));}function request(_0x534200){logger['debug'](_0x464a('0x34'),JSON[_0x464a('0x35')](_0x534200));return rp(_[_0x464a('0x9')](_0x534200,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1d30a9,_0x5a9938){var _0x137f43=[];if(_0x1d30a9&&_0x1d30a9['length']>0x0){_0x137f43=_[_0x464a('0x36')](_0x1d30a9,_0x5a9938);}return _0x137f43;}function getCustomFields(_0x3b10cd,_0x544582){var _0xd9bf79=[];var _0x3edfdc={'custom_fields':[]};if(_0x3b10cd['length']>0x0){_['forEach'](_0x3b10cd,function(_0x56aea4){if(_['includes'](['string',_0x464a('0x37')],_0x56aea4[_0x464a('0x38')])&&_0x56aea4[_0x464a('0x39')]&&!_0x56aea4['customField']){_0x3edfdc[_0x56aea4[_0x464a('0x39')][_0x464a('0x3a')]()]=_0x56aea4[_0x464a('0x3b')][_0x464a('0x3c')]();}else if(_[_0x464a('0x3d')]([_0x464a('0x3e'),_0x464a('0x37')],_0x56aea4['type'])&&_0x56aea4['idField']&&_0x56aea4[_0x464a('0x3f')]){_0x3edfdc[_0x464a('0x40')][_0x464a('0x41')]({'id':_0x56aea4[_0x464a('0x42')],'value':_0x56aea4['content'][_0x464a('0x3c')]()});}else if(_0x56aea4['type']===_0x464a('0x43')&&_0x56aea4[_0x464a('0x44')]&&_0x56aea4['idField']&&_0x56aea4[_0x464a('0x3f')]){_0x544582[_0x56aea4[_0x464a('0x44')]]&&_0x3edfdc['custom_fields'][_0x464a('0x41')]({'id':_0x56aea4[_0x464a('0x42')],'value':_0x544582[_0x56aea4[_0x464a('0x44')]][_0x464a('0x3c')]()});}else if(_0x56aea4['type']===_0x464a('0x45')&&_0x56aea4[_0x464a('0x46')]&&_0x56aea4[_0x464a('0x46')][_0x464a('0x14')]&&_0x56aea4[_0x464a('0x42')]&&_0x56aea4[_0x464a('0x3f')]){_0x544582[_0x56aea4[_0x464a('0x46')][_0x464a('0x14')][_0x464a('0x3a')]()]&&_0x3edfdc[_0x464a('0x40')][_0x464a('0x41')]({'id':_0x56aea4[_0x464a('0x42')],'value':_0x544582[_0x56aea4['Variable']['name'][_0x464a('0x3a')]()][_0x464a('0x3c')]()});}});}return _0x3edfdc;}exports[_0x464a('0x47')]=function(_0x2483b3,_0x104876,_0x3b966e,_0xb41c88,_0x4bbc9d,_0x175f50){var _0x385acd,_0x144298;_0x175f50[_0x464a('0x10')]=intUtil[_0x464a('0x48')](_0x175f50[_0x464a('0x10')]);_0x175f50[_0x464a('0x49')]=intUtil[_0x464a('0x48')](_0x175f50['serverUrl']);if(_0x4bbc9d&&_0x4bbc9d[_0x464a('0x4a')]){logger[_0x464a('0xd')](_0x464a('0x4b'),_0x464a('0x4c'));_0x104876[_0x464a('0x4d')]=util[_0x464a('0xe')](_0x464a('0x4e'),_0x175f50[_0x464a('0x49')],_0x104876[_0x464a('0x4f')],md5(_0x104876[_0x464a('0x4f')]));}else{_0x104876[_0x464a('0x4d')]='';}headers[_0x464a('0x50')]=getAuth(_0x175f50);return getUser(_0x175f50,_0xb41c88[_0x464a('0x51')])['then'](function(_0x4adfd7){_0x385acd=_0x4adfd7;logger['info'](_0x464a('0x52'),_0x385acd['id']);return getEndUser(_0x175f50,_0x104876[_0x464a('0x53')],_0x104876[_0x464a('0x54')]);})[_0x464a('0x20')](function(_0x259ccc){_0x144298=_0x259ccc;logger['info'](_0x464a('0x55'),_0x144298['id']);return getTicket(_0x175f50,_0x385acd,_0x144298,_0x3b966e,_0x104876);})['then'](function(_0x2be5d1){if(_0x2be5d1){logger['info'](_0x464a('0x56'),_0x2be5d1['id']);switch(_0x175f50['type']){case _0x464a('0x57'):logger['info'](_0x464a('0x4b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x464a('0xe')](_0x464a('0x58'),_0x175f50[_0x464a('0x10')],_0x385acd['id'],_0x2be5d1['id']),'method':_0x464a('0x11')});case _0x464a('0x59'):logger['info'](_0x464a('0x4b'),_0x464a('0x5a'));emit(util['format']('user:%s',_0xb41c88[_0x464a('0x14')]),_0x464a('0x5b'),{'uri':util['format']('%s/agent/tickets/%s',_0x175f50[_0x464a('0x10')][_0x464a('0x5c')]('/api/v2',''),_0x2be5d1['id'])});break;default:logger[_0x464a('0x5d')](_0x464a('0x4b'),_0x464a('0x5e'));}}})[_0x464a('0x5f')](function(_0x474473){logger[_0x464a('0x5d')](_0x464a('0x60'),util[_0x464a('0x61')](_0x474473,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x93d072,_0x10c2a6,_0x30fdde,_0x30238e,_0x48beb2,_0x1cef05,_0x2a4de0){var _0x3afdc2,_0x611791;_0x1cef05['remoteUri']=intUtil[_0x464a('0x48')](_0x1cef05['remoteUri']);_0x1cef05[_0x464a('0x49')]=intUtil[_0x464a('0x48')](_0x1cef05[_0x464a('0x49')]);if(_0x2a4de0&&_0x2a4de0['recordingFormat']&&_0x2a4de0[_0x464a('0x62')]!==_0x464a('0x63')){logger[_0x464a('0xd')](_0x464a('0x64'),_0x464a('0x4c'));_0x10c2a6[_0x464a('0x4d')]=util[_0x464a('0xe')](_0x464a('0x4e'),_0x1cef05[_0x464a('0x49')],_0x10c2a6[_0x464a('0x4f')],md5(_0x10c2a6['uniqueid']));}headers[_0x464a('0x50')]=getAuth(_0x1cef05);return getUser(_0x1cef05,_0x30238e['email'])[_0x464a('0x20')](function(_0x4d53a1){_0x3afdc2=_0x4d53a1;logger[_0x464a('0xd')](_0x464a('0x52'),_0x3afdc2['id']);return getEndUser(_0x1cef05,_0x10c2a6[_0x464a('0x65')],_0x10c2a6[_0x464a('0x66')]);})['then'](function(_0xd23a8f){_0x611791=_0xd23a8f;logger[_0x464a('0xd')](_0x464a('0x55'),_0x611791['id']);return getTicket(_0x1cef05,_0x3afdc2,_0x611791,_0x30fdde,_0x10c2a6);})['then'](function(_0x3a01db){if(_0x3a01db){logger[_0x464a('0xd')](_0x464a('0x56'),_0x3a01db['id']);switch(_0x1cef05['type']){case _0x464a('0x57'):logger[_0x464a('0xd')]('[OUTBOUND]',_0x464a('0x67'));return request({'uri':util['format'](_0x464a('0x58'),_0x1cef05[_0x464a('0x10')],_0x3afdc2['id'],_0x3a01db['id']),'method':'POST'});case _0x464a('0x59'):logger[_0x464a('0xd')](_0x464a('0x64'),_0x464a('0x5a'));emit(util[_0x464a('0xe')]('user:%s',_0x30238e[_0x464a('0x14')]),'trigger:browser:url',{'uri':util['format'](_0x464a('0x68'),_0x1cef05[_0x464a('0x10')]['replace'](_0x464a('0x69'),''),_0x3a01db['id'])});break;default:logger['error']('[OUTBOUND]',_0x464a('0x5e'));}}})['catch'](function(_0x20b343){logger[_0x464a('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x464a('0x61')](_0x20b343,{'showHidden':!![],'depth':null}));});};exports[_0x464a('0x6a')]=function(_0x502172,_0x5b0657,_0x42562d,_0x46eb9a,_0x3acd2e,_0x11249c){var _0x255f07,_0x36ee89;_0x11249c['remoteUri']=intUtil['stripTrailingSlash'](_0x11249c['remoteUri']);_0x11249c[_0x464a('0x49')]=intUtil[_0x464a('0x48')](_0x11249c[_0x464a('0x49')]);if(_0x3acd2e&&_0x3acd2e[_0x464a('0x4a')]){logger[_0x464a('0xd')]('['+_0x5b0657['lastevent'][_0x464a('0x6b')]()+']',_0x464a('0x4c'));_0x5b0657[_0x464a('0x4d')]=util[_0x464a('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x11249c[_0x464a('0x49')],_0x5b0657[_0x464a('0x4f')],md5(_0x5b0657['uniqueid']));}else{_0x5b0657['recordingURL']='';}headers['Authorization']=getAuth(_0x11249c);return getUser(_0x11249c)['then'](function(_0x239968){_0x255f07=_0x239968;logger[_0x464a('0xd')](_0x464a('0x52'),_0x255f07['id']);return getEndUser(_0x11249c,_0x5b0657[_0x464a('0x53')],_0x5b0657[_0x464a('0x54')]);})[_0x464a('0x20')](function(_0x2834ee){_0x36ee89=_0x2834ee;logger[_0x464a('0xd')]('The\x20Enduser\x20ID\x20is:',_0x36ee89['id']);return getTicket(_0x11249c,_0x255f07,_0x36ee89,_0x42562d,_0x5b0657);})[_0x464a('0x20')](function(_0x42ff2f){if(_0x42ff2f){logger[_0x464a('0xd')](_0x464a('0x56'),_0x42ff2f['id']);}})[_0x464a('0x5f')](function(_0x51f89f){logger['error']('['+_0x5b0657[_0x464a('0x6c')][_0x464a('0x6b')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x51f89f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0043=['util','ioredis','../../../../config/environment','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','merge','Tags','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','end-user','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','type','nameField','customField','toLowerCase','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','POST','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5'];(function(_0x3a8fae,_0xff5dea){var _0x5e5f32=function(_0x521dfe){while(--_0x521dfe){_0x3a8fae['push'](_0x3a8fae['shift']());}};_0x5e5f32(++_0xff5dea);}(_0x0043,0xde));var _0x3004=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0x0043[_0x58547b];return _0x1d3fd2;};'use strict';var _=require('lodash');var rp=require(_0x3004('0x0'));var md5=require(_0x3004('0x1'));var util=require(_0x3004('0x2'));var Redis=require(_0x3004('0x3'));var intUtil=require('./util');var config=require(_0x3004('0x4'));var logger=require('../../../../config/logger')('zendesk');config[_0x3004('0x5')]=_[_0x3004('0x6')](config[_0x3004('0x5')],{'host':_0x3004('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3004('0x5')]));function emit(_0x1675d5,_0xac9d68,_0x1ea72d){io['to'](_0x1675d5)[_0x3004('0x8')](_0xac9d68,_0x1ea72d);}var headers={'Content-Type':_0x3004('0x9'),'Accept':_0x3004('0x9')};function getTicket(_0x3656d6,_0x1f13cc,_0x5809b7,_0x51b9ee,_0x4a020c){logger[_0x3004('0xa')](_0x3004('0xb'));return request({'uri':util[_0x3004('0xc')](_0x3004('0xd'),_0x3656d6[_0x3004('0xe')]),'method':'POST','body':{'ticket':_[_0x3004('0xf')]({'requester_id':_0x5809b7['id'],'submitter_id':_0x1f13cc?_0x1f13cc['id']:undefined,'assignee_id':_0x1f13cc?_0x1f13cc['id']:undefined,'tags':getTags(_0x51b9ee[_0x3004('0x10')],'name'),'subject':intUtil['getString'](_0x51b9ee['Subjects'],_0x4a020c,'\x20'),'description':intUtil[_0x3004('0x11')](_0x51b9ee[_0x3004('0x12')],_0x4a020c,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x51b9ee[_0x3004('0x12')],_0x4a020c,'\x0a')}},getCustomFields(_0x51b9ee[_0x3004('0x13')],_0x4a020c))}})[_0x3004('0x14')](function(_0x26ec4b){logger[_0x3004('0xa')](_0x3004('0x15'));return _0x26ec4b[_0x3004('0x16')];});}function getUser(_0x473d85,_0x2e95a6){if(intUtil[_0x3004('0x17')](_0x2e95a6)){logger[_0x3004('0xa')](_0x3004('0x18'),_0x2e95a6);return request({'uri':util[_0x3004('0xc')](_0x3004('0x19'),_0x473d85[_0x3004('0xe')]),'qs':{'query':util[_0x3004('0xc')]('type:user\x20role:agent\x20email:%s',_0x2e95a6)}})[_0x3004('0x14')](function(_0xf9498f){if(_0xf9498f[_0x3004('0x1a')]){logger['info'](_0x3004('0x1b'));return _['find'](_0xf9498f[_0x3004('0x1c')],{'email':_0x2e95a6,'role':_0x3004('0x1d')});}else{logger[_0x3004('0xa')](_0x3004('0x1e'));return request({'uri':util[_0x3004('0xc')](_0x3004('0x1f'),_0x473d85[_0x3004('0xe')])})[_0x3004('0x14')](function(_0x2bd772){logger['info'](_0x3004('0x20'));return _0x2bd772[_0x3004('0x21')];});}});}else{logger[_0x3004('0xa')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x3004('0x1f'),_0x473d85['remoteUri'])})[_0x3004('0x14')](function(_0x1246d2){logger['info']('Admin\x20account\x20selected.');return _0x1246d2[_0x3004('0x21')];});}}function getEndUser(_0x3a51cf,_0x490013,_0x132dcf){logger[_0x3004('0xa')](_0x3004('0x22'),_0x132dcf);return request({'uri':util[_0x3004('0xc')](_0x3004('0x19'),_0x3a51cf['remoteUri']),'qs':{'query':util[_0x3004('0xc')](_0x3004('0x23'),_0x132dcf)}})[_0x3004('0x14')](function(_0x148891){var _0x40a733;if(_0x148891['results']['length']){_0x148891[_0x3004('0x1c')]=_['filter'](_0x148891['results'],{'suspended':![],'role':_0x3004('0x24')});if(_0x148891[_0x3004('0x1c')][_0x3004('0x25')]){_0x40a733=_['first'](_0x148891['results']);}}if(_0x40a733){logger[_0x3004('0xa')](_0x3004('0x26'));return _0x40a733;}else{logger[_0x3004('0xa')](_0x3004('0x27'));return request({'uri':util['format']('%s/users.json',_0x3a51cf[_0x3004('0xe')]),'method':'POST','body':{'user':{'role':_0x3004('0x24'),'name':util[_0x3004('0xc')](_0x3004('0x28'),_0x490013||_0x132dcf),'phone':_0x132dcf}}})[_0x3004('0x14')](function(_0xe1041){logger[_0x3004('0xa')](_0x3004('0x29'));return _0xe1041[_0x3004('0x21')];});}});}function getAuth(_0x433120){var _0x4a7eec;if(_0x433120[_0x3004('0x2a')]===_0x3004('0x2b')){_0x4a7eec=util[_0x3004('0xc')](_0x3004('0x2c'),_0x433120[_0x3004('0x2d')],_0x433120[_0x3004('0x2b')]);}else if(_0x433120[_0x3004('0x2a')]==='token'){_0x4a7eec=util[_0x3004('0xc')](_0x3004('0x2e'),_0x433120['username'],_0x433120[_0x3004('0x2f')]);}return util['format'](_0x3004('0x30'),new Buffer(_0x4a7eec)[_0x3004('0x31')](_0x3004('0x32')));}function request(_0x546cb7){logger[_0x3004('0x33')](_0x3004('0x34'),JSON[_0x3004('0x35')](_0x546cb7));return rp(_[_0x3004('0x6')](_0x546cb7,{'method':_0x3004('0x36'),'headers':headers,'json':!![]}));}function getTags(_0x132dce,_0x112656){var _0x2658e4=[];if(_0x132dce&&_0x132dce[_0x3004('0x25')]>0x0){_0x2658e4=_[_0x3004('0x37')](_0x132dce,_0x112656);}return _0x2658e4;}function getCustomFields(_0x22118c,_0x128c15){var _0x7a3513=[];var _0x20cc09={'custom_fields':[]};if(_0x22118c[_0x3004('0x25')]>0x0){_[_0x3004('0x38')](_0x22118c,function(_0x55e446){if(_[_0x3004('0x39')]([_0x3004('0x3a'),'picklist'],_0x55e446[_0x3004('0x3b')])&&_0x55e446[_0x3004('0x3c')]&&!_0x55e446[_0x3004('0x3d')]){_0x20cc09[_0x55e446['nameField'][_0x3004('0x3e')]()]=_0x55e446['content'][_0x3004('0x31')]();}else if(_['includes']([_0x3004('0x3a'),'picklist'],_0x55e446[_0x3004('0x3b')])&&_0x55e446[_0x3004('0x3f')]&&_0x55e446[_0x3004('0x3d')]){_0x20cc09[_0x3004('0x40')][_0x3004('0x41')]({'id':_0x55e446[_0x3004('0x3f')],'value':_0x55e446[_0x3004('0x42')][_0x3004('0x31')]()});}else if(_0x55e446[_0x3004('0x3b')]===_0x3004('0x43')&&_0x55e446['variableName']&&_0x55e446[_0x3004('0x3f')]&&_0x55e446[_0x3004('0x3d')]){_0x128c15[_0x55e446[_0x3004('0x44')]]&&_0x20cc09[_0x3004('0x40')][_0x3004('0x41')]({'id':_0x55e446[_0x3004('0x3f')],'value':_0x128c15[_0x55e446[_0x3004('0x44')]][_0x3004('0x31')]()});}else if(_0x55e446['type']===_0x3004('0x45')&&_0x55e446[_0x3004('0x46')]&&_0x55e446[_0x3004('0x46')]['name']&&_0x55e446[_0x3004('0x3f')]&&_0x55e446[_0x3004('0x3d')]){_0x128c15[_0x55e446[_0x3004('0x46')][_0x3004('0x47')][_0x3004('0x3e')]()]&&_0x20cc09[_0x3004('0x40')][_0x3004('0x41')]({'id':_0x55e446[_0x3004('0x3f')],'value':_0x128c15[_0x55e446[_0x3004('0x46')][_0x3004('0x47')][_0x3004('0x3e')]()][_0x3004('0x31')]()});}});}return _0x20cc09;}exports[_0x3004('0x48')]=function(_0xf82961,_0x2e3581,_0x404eea,_0x481b24,_0x4d05ce,_0x317af0){var _0x3f674a,_0x2422a2;_0x317af0[_0x3004('0xe')]=intUtil[_0x3004('0x49')](_0x317af0[_0x3004('0xe')]);_0x317af0[_0x3004('0x4a')]=intUtil[_0x3004('0x49')](_0x317af0[_0x3004('0x4a')]);if(_0x4d05ce&&_0x4d05ce[_0x3004('0x4b')]){logger[_0x3004('0xa')](_0x3004('0x4c'),'Recording\x20is\x20enabled!');_0x2e3581['recordingURL']=util[_0x3004('0xc')](_0x3004('0x4d'),_0x317af0[_0x3004('0x4a')],_0x2e3581[_0x3004('0x4e')],md5(_0x2e3581[_0x3004('0x4e')]));}else{_0x2e3581[_0x3004('0x4f')]='';}headers[_0x3004('0x50')]=getAuth(_0x317af0);return getUser(_0x317af0,_0x481b24[_0x3004('0x51')])[_0x3004('0x14')](function(_0x98f58){_0x3f674a=_0x98f58;logger[_0x3004('0xa')](_0x3004('0x52'),_0x3f674a['id']);return getEndUser(_0x317af0,_0x2e3581[_0x3004('0x53')],_0x2e3581[_0x3004('0x54')]);})[_0x3004('0x14')](function(_0x5461ea){_0x2422a2=_0x5461ea;logger[_0x3004('0xa')](_0x3004('0x55'),_0x2422a2['id']);return getTicket(_0x317af0,_0x3f674a,_0x2422a2,_0x404eea,_0x2e3581);})[_0x3004('0x14')](function(_0x334599){if(_0x334599){logger[_0x3004('0xa')]('The\x20Ticket\x20ID\x20is:',_0x334599['id']);switch(_0x317af0[_0x3004('0x3b')]){case _0x3004('0x56'):logger[_0x3004('0xa')](_0x3004('0x4c'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x3004('0x57'),_0x317af0[_0x3004('0xe')],_0x3f674a['id'],_0x334599['id']),'method':'POST'});case _0x3004('0x58'):logger[_0x3004('0xa')](_0x3004('0x4c'),_0x3004('0x59'));emit(util['format'](_0x3004('0x5a'),_0x481b24[_0x3004('0x47')]),_0x3004('0x5b'),{'uri':util[_0x3004('0xc')](_0x3004('0x5c'),_0x317af0[_0x3004('0xe')]['replace'](_0x3004('0x5d'),''),_0x334599['id'])});break;default:logger[_0x3004('0x5e')](_0x3004('0x4c'),_0x3004('0x5f'));}}})[_0x3004('0x60')](function(_0x36916b){logger[_0x3004('0x5e')](_0x3004('0x61'),util['inspect'](_0x36916b,{'showHidden':!![],'depth':null}));});};exports[_0x3004('0x62')]=function(_0x39b8a1,_0x4287f5,_0x3af181,_0xd7c2ce,_0x210a93,_0x15df36,_0x1e5fb9){var _0x5022a5,_0x50066d;_0x15df36[_0x3004('0xe')]=intUtil[_0x3004('0x49')](_0x15df36[_0x3004('0xe')]);_0x15df36['serverUrl']=intUtil[_0x3004('0x49')](_0x15df36['serverUrl']);if(_0x1e5fb9&&_0x1e5fb9[_0x3004('0x63')]&&_0x1e5fb9[_0x3004('0x63')]!=='none'){logger[_0x3004('0xa')](_0x3004('0x64'),_0x3004('0x65'));_0x4287f5[_0x3004('0x4f')]=util[_0x3004('0xc')](_0x3004('0x4d'),_0x15df36['serverUrl'],_0x4287f5['uniqueid'],md5(_0x4287f5['uniqueid']));}headers['Authorization']=getAuth(_0x15df36);return getUser(_0x15df36,_0xd7c2ce['email'])['then'](function(_0x6bad22){_0x5022a5=_0x6bad22;logger[_0x3004('0xa')](_0x3004('0x52'),_0x5022a5['id']);return getEndUser(_0x15df36,_0x4287f5['destcalleridname'],_0x4287f5[_0x3004('0x66')]);})[_0x3004('0x14')](function(_0x174fdc){_0x50066d=_0x174fdc;logger[_0x3004('0xa')](_0x3004('0x55'),_0x50066d['id']);return getTicket(_0x15df36,_0x5022a5,_0x50066d,_0x3af181,_0x4287f5);})[_0x3004('0x14')](function(_0x4a5818){if(_0x4a5818){logger[_0x3004('0xa')](_0x3004('0x67'),_0x4a5818['id']);switch(_0x15df36['type']){case _0x3004('0x56'):logger[_0x3004('0xa')](_0x3004('0x64'),_0x3004('0x68'));return request({'uri':util[_0x3004('0xc')](_0x3004('0x57'),_0x15df36[_0x3004('0xe')],_0x5022a5['id'],_0x4a5818['id']),'method':_0x3004('0x69')});case'newTab':logger[_0x3004('0xa')](_0x3004('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x3004('0x5a'),_0xd7c2ce[_0x3004('0x47')]),_0x3004('0x5b'),{'uri':util[_0x3004('0xc')](_0x3004('0x5c'),_0x15df36[_0x3004('0xe')]['replace'](_0x3004('0x5d'),''),_0x4a5818['id'])});break;default:logger['error'](_0x3004('0x64'),_0x3004('0x5f'));}}})[_0x3004('0x60')](function(_0x25a1bb){logger[_0x3004('0x5e')](_0x3004('0x6a'),util[_0x3004('0x6b')](_0x25a1bb,{'showHidden':!![],'depth':null}));});};exports[_0x3004('0x6c')]=function(_0xac4b0a,_0x52766a,_0x19f24d,_0x4cd109,_0x44fa2e,_0x942066){var _0x3a15fd,_0x19ec2b;_0x942066[_0x3004('0xe')]=intUtil[_0x3004('0x49')](_0x942066[_0x3004('0xe')]);_0x942066['serverUrl']=intUtil[_0x3004('0x49')](_0x942066[_0x3004('0x4a')]);if(_0x44fa2e&&_0x44fa2e[_0x3004('0x4b')]){logger[_0x3004('0xa')]('['+_0x52766a[_0x3004('0x6d')][_0x3004('0x6e')]()+']',_0x3004('0x65'));_0x52766a[_0x3004('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x942066['serverUrl'],_0x52766a[_0x3004('0x4e')],md5(_0x52766a[_0x3004('0x4e')]));}else{_0x52766a[_0x3004('0x4f')]='';}headers[_0x3004('0x50')]=getAuth(_0x942066);return getUser(_0x942066)['then'](function(_0x5528ac){_0x3a15fd=_0x5528ac;logger[_0x3004('0xa')](_0x3004('0x52'),_0x3a15fd['id']);return getEndUser(_0x942066,_0x52766a['calleridname'],_0x52766a[_0x3004('0x54')]);})[_0x3004('0x14')](function(_0x30cab2){_0x19ec2b=_0x30cab2;logger[_0x3004('0xa')]('The\x20Enduser\x20ID\x20is:',_0x19ec2b['id']);return getTicket(_0x942066,_0x3a15fd,_0x19ec2b,_0x19f24d,_0x52766a);})[_0x3004('0x14')](function(_0x168ed4){if(_0x168ed4){logger[_0x3004('0xa')](_0x3004('0x67'),_0x168ed4['id']);}})[_0x3004('0x60')](function(_0x11f086){logger[_0x3004('0x5e')]('['+_0x52766a[_0x3004('0x6d')][_0x3004('0x6e')]()+']'+_0x3004('0x6f'),util[_0x3004('0x6b')](_0x11f086,{'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 34b638c..bb8befb 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 _0x04c7=['includes','string','type','idField','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','/oauth/v2/token','refreshToken','clientId','clientSecret','then','add','seconds','catch','error','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','findIndex','users','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','role','first_name','last_name','code','SUCCESS','details','enduserType','startCase','moduleCreate','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','Leads','nothing','Creating\x20new\x20call...','Owner','administrator','Subject','Subjects','getString','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Fields','/crm/v2/Calls','Call\x20created!','err','stack','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','email','Inbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','monitor_format','toUpperCase','com','calleridnum','lodash','request-promise','md5','util','./util','moment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','forEach'];(function(_0x485adc,_0x151546){var _0x41a579=function(_0x40a43b){while(--_0x40a43b){_0x485adc['push'](_0x485adc['shift']());}};_0x41a579(++_0x151546);}(_0x04c7,0x8b));var _0x704c=function(_0x101a17,_0x5d047a){_0x101a17=_0x101a17-0x0;var _0x3b76ee=_0x04c7[_0x101a17];return _0x3b76ee;};'use strict';var _=require(_0x704c('0x0'));var rp=require(_0x704c('0x1'));var md5=require(_0x704c('0x2'));var util=require(_0x704c('0x3'));var intUtil=require(_0x704c('0x4'));var moment=require(_0x704c('0x5'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require('../../../../config/environment');var logger=require(_0x704c('0x6'))(_0x704c('0x7'));config[_0x704c('0x8')]=_[_0x704c('0x9')](config[_0x704c('0x8')],{'host':_0x704c('0xa'),'port':0x18eb});var io=require(_0x704c('0xb'))(new Redis(config[_0x704c('0x8')]));function emit(_0x206983,_0xeca97a,_0xf17da0){io['to'](_0x206983)[_0x704c('0xc')](_0xeca97a,_0xf17da0);}function request(_0x5a724e){logger[_0x704c('0xd')](_0x704c('0xe'),JSON['stringify'](_0x5a724e));return rp(_0x5a724e);}function getCustomFields(_0x21cc7a,_0x42acbe){var _0x3581ea={};if(_0x21cc7a['length']>0x0){_[_0x704c('0xf')](_0x21cc7a,function(_0xa24685){if(_[_0x704c('0x10')]([_0x704c('0x11'),'picklist'],_0xa24685[_0x704c('0x12')])&&_0xa24685['idField']){_0x3581ea[_0xa24685[_0x704c('0x13')]]=_0xa24685['content']['toString']();}else if(_0xa24685[_0x704c('0x12')]===_0x704c('0x14')&&_0xa24685[_0x704c('0x15')]&&_0xa24685['idField']&&_0x42acbe[_0xa24685['variableName']]){_0x3581ea[_0xa24685['idField']]=_0x42acbe[_0xa24685['variableName']][_0x704c('0x16')]();}else if(_0xa24685[_0x704c('0x12')]===_0x704c('0x17')&&_0xa24685[_0x704c('0x18')]&&_0xa24685['Variable'][_0x704c('0x19')]&&_0xa24685[_0x704c('0x13')]&&_0x42acbe[_0xa24685[_0x704c('0x18')]['name'][_0x704c('0x1a')]()]){_0x3581ea[_0xa24685['idField']]=_0x42acbe[_0xa24685[_0x704c('0x18')][_0x704c('0x19')][_0x704c('0x1a')]()][_0x704c('0x16')]();}});}return _0x3581ea;}function getName(_0x58295b){if(_0x58295b[_0x704c('0x1b')]('\x20')>0x0){var _0x1552ff=_0x58295b[_0x704c('0x1c')](/ (.+)/);if(_0x1552ff[0x1]){return _0x1552ff;}}return[_0x58295b,_0x58295b];}var accountsTokens={};function getAccessToken(_0x4b2b44){return new Promise(function(_0x5546e6,_0x5eef5c){if(!_[_0x704c('0x1d')](accountsTokens[_0x4b2b44['id']])&&!_[_0x704c('0x1d')](accountsTokens[_0x4b2b44['id']][_0x704c('0x1e')])){if(moment()[_0x704c('0x1f')](accountsTokens[_0x4b2b44['id']][_0x704c('0x20')])){_0x5546e6(accountsTokens[_0x4b2b44['id']]['access_token']);}}var _0x1e90e8;switch(_0x4b2b44[_0x704c('0x21')]){case'US':_0x1e90e8=_0x704c('0x22');break;case'AU':_0x1e90e8=_0x704c('0x23');break;case'EU':_0x1e90e8=_0x704c('0x24');break;case'IN':_0x1e90e8=_0x704c('0x25');break;case'CN':_0x1e90e8='https://accounts.zoho.com.cn';break;default:_0x1e90e8=_0x704c('0x24');break;}var _0x3b0633={'method':'POST','uri':_0x1e90e8+_0x704c('0x26'),'qs':{'refresh_token':_0x4b2b44[_0x704c('0x27')],'client_id':_0x4b2b44[_0x704c('0x28')],'client_secret':_0x4b2b44[_0x704c('0x29')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3b0633)[_0x704c('0x2a')](function(_0x9bfe56){accountsTokens[_0x4b2b44['id']]={'access_token':_0x9bfe56[_0x704c('0x1e')],'expires_in':moment()[_0x704c('0x2b')](_0x9bfe56[_0x704c('0x20')],_0x704c('0x2c'))};_0x5546e6(_0x9bfe56[_0x704c('0x1e')]);})[_0x704c('0x2d')](function(_0x4c5f3a){logger[_0x704c('0x2e')]('Failing\x20creating\x20the\x20access_token',_0x4c5f3a['stack']);_0x5eef5c(_0x4c5f3a);});});}function getUser(_0x2aa58c,_0x30fe62,_0x51649c,_0x22beb7){logger[_0x704c('0x2f')](_0x704c('0x30'));return request({'method':_0x704c('0x31'),'uri':util[_0x704c('0x32')](_0x704c('0x33'),_0x30fe62),'qs':{'type':_0x704c('0x34')},'headers':{'Authorization':_0x704c('0x35')+_0x2aa58c},'json':!![]})[_0x704c('0x2a')](function(_0x4db536){if(_0x4db536['users']){var _0x21d281=-0x1;if(_[_0x704c('0x36')](_0x4db536['users'])){if(!_[_0x704c('0x1d')](_0x22beb7)){_0x21d281=_[_0x704c('0x37')](_0x4db536[_0x704c('0x38')],function(_0x433970){return _0x433970['email']===_0x22beb7;});}if(_0x21d281>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x704c('0x2f')](_0x704c('0x39'));_0x21d281=_[_0x704c('0x37')](_0x4db536['users'],function(_0x3351de){return _0x3351de[_0x704c('0x3a')][_0x704c('0x19')]===_0x704c('0x3b');});}return _0x4db536[_0x704c('0x38')][_0x21d281];}else{if(_0x4db536[_0x704c('0x3c')][_0x704c('0x3a')][_0x704c('0x19')]===_0x704c('0x3b')){logger[_0x704c('0x2f')]('Using\x20the\x20admin\x20account!');user=_0x4db536[_0x704c('0x3c')];return user;}else{logger[_0x704c('0x2e')](_0x704c('0x3d'),JSON[_0x704c('0x3e')](_0x4db536));throw new Error(_0x704c('0x3f')+JSON[_0x704c('0x3e')](_0x4db536));}}}else{logger[_0x704c('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x704c('0x3e')](_0x4db536));throw new Error(_0x704c('0x3f')+JSON[_0x704c('0x3e')](_0x4db536));}})['catch'](function(_0x1f058b){console[_0x704c('0x2e')](_0x1f058b);});}function getZohoUser(_0x2ce664,_0x27a72e){return new BPromise(function(_0x328114,_0x3be73f){request(_0x2ce664)[_0x704c('0x2a')](function(_0x5a6612){var _0x308c25=null;if(_0x5a6612){_0x308c25=_0x5a6612[_0x704c('0x40')][0x0];_0x308c25['enduserType']=_0x27a72e;}_0x328114(_0x308c25);})['catch'](function(_0x5d96e0){_0x3be73f(_0x5d96e0);});});}function createEndUser(_0x38a3da,_0x52c784,_0x407429,_0xf2e64c,_0x333c9d,_0x4487e3){var _0x407429=getName(_0x407429);return request({'method':'POST','uri':_0x704c('0x41')+_0x52c784+'/crm/v2/'+_['startCase'](_0x4487e3['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x407429[0x1],'First_Name':_0x407429[0x0],'Phone':_0xf2e64c,'Owner':{'name':!_[_0x704c('0x1d')](_0x333c9d[_0x704c('0x42')][_0x704c('0x19')])?_0x333c9d[_0x704c('0x42')]['name']:!_[_0x704c('0x1d')](_0x333c9d[_0x704c('0x43')])?_0x333c9d[_0x704c('0x43')]+'\x20'+_0x333c9d[_0x704c('0x44')]:_0x333c9d[_0x704c('0x44')],'id':_0x333c9d['id']}}]},'headers':{'Authorization':_0x704c('0x35')+_0x38a3da},'json':!![]})[_0x704c('0x2a')](function(_0x252c25){if(_0x252c25&&_0x252c25[_0x704c('0x40')][0x0][_0x704c('0x45')]===_0x704c('0x46')){var _0x34f68f=_0x252c25['data'][0x0][_0x704c('0x47')];_0x34f68f[_0x704c('0x48')]=_[_0x704c('0x49')](_0x4487e3[_0x704c('0x4a')])+'s';return _0x34f68f;}logger[_0x704c('0x2e')](_0x704c('0x3d'),JSON[_0x704c('0x3e')](data));throw new Error('Error:\x20'+JSON[_0x704c('0x3e')](data));})[_0x704c('0x2d')](function(_0x427a96){console[_0x704c('0x4b')](_0x704c('0x4c'),_0x427a96);});}function getEndUser(_0x17cfd8,_0x5406e3,_0xe392dc,_0x48efd7,_0x253d3a,_0x5ed2a9,_0x4541a6){var _0x2782bb={'method':_0x704c('0x31'),'uri':'','headers':{'Authorization':_0x704c('0x35')+_0x17cfd8},'json':!![]};switch(_0x4541a6[_0x704c('0x4d')]){case _0x704c('0x4e'):_0x2782bb['uri']=_0x704c('0x41')+_0x5406e3+_0x704c('0x4f')+_0x253d3a+'))';return getZohoUser(_0x2782bb,_0x704c('0x50'))[_0x704c('0x2a')](function(_0x368073){if(_0x368073)return _0x368073;_0x2782bb[_0x704c('0x51')]='https://www.zohoapis.'+_0x5406e3+_0x704c('0x52')+_0x253d3a+'))';return getZohoUser(_0x2782bb,'Leads')[_0x704c('0x2a')](function(_0x2bbd2f){if(_0x2bbd2f)return _0x2bbd2f;if(_0x4541a6[_0x704c('0x4a')]!='nothing'){return createEndUser(_0x17cfd8,_0x5406e3,_0x48efd7,_0x253d3a,_0x5ed2a9,_0x4541a6);}else{return{};}});});break;case _0x704c('0x53'):_0x2782bb[_0x704c('0x51')]=_0x704c('0x41')+_0x5406e3+_0x704c('0x4f')+_0x253d3a+'))';return getZohoUser(_0x2782bb,_0x704c('0x50'))[_0x704c('0x2a')](function(_0x5eb881){if(_0x5eb881)return _0x5eb881;if(_0x4541a6[_0x704c('0x4a')]!='nothing'){return createEndUser(_0x17cfd8,_0x5406e3,_0x48efd7,_0x253d3a,_0x5ed2a9,_0x4541a6);}else{return{};}});break;case'lead':_0x2782bb[_0x704c('0x51')]='https://www.zohoapis.'+_0x5406e3+_0x704c('0x52')+_0x253d3a+'))';return getZohoUser(_0x2782bb,_0x704c('0x54'))[_0x704c('0x2a')](function(_0xc4ad01){if(_0xc4ad01)return _0xc4ad01;if(_0x4541a6[_0x704c('0x4a')]!=_0x704c('0x55')){return createEndUser(_0x17cfd8,_0x5406e3,_0x48efd7,_0x253d3a,_0x5ed2a9,_0x4541a6);}else{return{};}});break;}}function getCall(_0x16577e,_0x5cbf38,_0x9c0452,_0x30bd1d,_0x5c0403,_0x2131f7,_0x40e83e,_0x1b559b){logger[_0x704c('0x2f')](_0x704c('0x56'));var _0x3dcc18={};_0x3dcc18[_0x704c('0x57')]={'name':!_[_0x704c('0x1d')](_0x30bd1d[_0x704c('0x42')][_0x704c('0x19')])&&!_['isNil'](_0x30bd1d[_0x704c('0x3a')][_0x704c('0x19')])&&_0x30bd1d['profile'][_0x704c('0x19')]===_0x704c('0x58')?_0x30bd1d[_0x704c('0x42')][_0x704c('0x19')]:!_['isNil'](_0x30bd1d[_0x704c('0x43')])?_0x30bd1d[_0x704c('0x43')]+'\x20'+_0x30bd1d[_0x704c('0x44')]:_0x30bd1d[_0x704c('0x44')],'id':_0x30bd1d['id']};_0x3dcc18[_0x704c('0x59')]=intUtil['getString'](_0x2131f7[_0x704c('0x5a')],_0x40e83e,'\x20');_0x3dcc18['Description']=intUtil[_0x704c('0x5b')](_0x2131f7[_0x704c('0x5c')],_0x40e83e,'\x0a');if(_0x5c0403['enduserType']===_0x704c('0x50')){_0x3dcc18['Who_Id']={'name':!_['isNil'](_0x5c0403['Full_Name'])?_0x5c0403[_0x704c('0x5d')]:!_['isNil'](_0x5c0403[_0x704c('0x5e')])?_0x5c0403[_0x704c('0x5e')]+'\x20'+_0x5c0403[_0x704c('0x5f')]:_0x5c0403[_0x704c('0x5f')],'id':_0x5c0403['id']};}if(_0x5c0403[_0x704c('0x48')]===_0x704c('0x54')){_0x3dcc18[_0x704c('0x60')]={'name':!_[_0x704c('0x1d')](_0x5c0403[_0x704c('0x5d')])?_0x5c0403['Full_Name']:!_[_0x704c('0x1d')](_0x5c0403['First_Name'])?_0x5c0403['First_Name']+'\x20'+_0x5c0403[_0x704c('0x5f')]:_0x5c0403[_0x704c('0x5f')],'id':_0x5c0403['id']};_0x3dcc18[_0x704c('0x61')]=_[_0x704c('0x49')](_0x5c0403[_0x704c('0x48')]);}if(_0x40e83e[_0x704c('0x62')]){_0x3dcc18[_0x704c('0x63')]=moment['utc'](parseInt(_0x40e83e[_0x704c('0x62')])*0x3e8)[_0x704c('0x32')](_0x704c('0x64'));}else if(_0x40e83e[_0x704c('0x65')]&&_0x40e83e[_0x704c('0x66')]){_0x3dcc18[_0x704c('0x63')]=moment['utc'](moment(_0x40e83e[_0x704c('0x66')],_0x704c('0x67'))[_0x704c('0x68')](moment(_0x40e83e[_0x704c('0x69')],_0x704c('0x67'))))['format']('mm:ss');}switch(_0x40e83e[_0x704c('0x6a')]){case _0x704c('0x6b'):_0x3dcc18[_0x704c('0x6c')]=_0x704c('0x6d');break;case _0x704c('0x6e'):case'connect':_0x3dcc18['Call_Result']=_0x704c('0x6f');break;case'rejected':_0x3dcc18[_0x704c('0x6c')]=_0x704c('0x70');break;case _0x704c('0x71'):_0x3dcc18[_0x704c('0x6c')]=_0x704c('0x72');break;case _0x704c('0x73'):_0x3dcc18[_0x704c('0x6c')]=_0x704c('0x74');default:}_0x3dcc18[_0x704c('0x75')]=(_0x1b559b===_0x704c('0x76')?moment(_0x40e83e[_0x704c('0x69')])[_0x704c('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x40e83e[_0x704c('0x77')])[_0x704c('0x32')](_0x704c('0x67')))||moment()['format'](_0x704c('0x67'));_0x3dcc18['Call_Type']=_0x1b559b||'Inbound';_0x3dcc18=_['merge'](_0x3dcc18,getCustomFields(_0x2131f7[_0x704c('0x78')],_0x40e83e));return request({'method':'POST','uri':_0x704c('0x41')+_0x5cbf38+_0x704c('0x79'),'headers':{'Authorization':_0x704c('0x35')+_0x16577e},'body':{'data':[_0x3dcc18]},'json':!![]})['then'](function(_0x297e33){if(_0x297e33&&_0x297e33[_0x704c('0x40')][0x0][_0x704c('0x45')]==='SUCCESS'){logger[_0x704c('0x2f')](_0x704c('0x7a'));return{'id':_0x297e33['data'][0x0][_0x704c('0x47')]['id']};}})[_0x704c('0x2d')](function(_0x14acc2){logger['info'](_0x704c('0x7b'),_0x14acc2[_0x704c('0x7c')]);console[_0x704c('0x4b')](_0x704c('0x7b'),_0x14acc2);});}exports['queue']=function(_0x5e8d78,_0xc209fe,_0x19e915,_0x21d70d,_0x7df427,_0xaf8d44){var _0x5aaac7,_0x25f973,_0x3f52d4;_0xaf8d44[_0x704c('0x7d')]=intUtil[_0x704c('0x7e')](_0xaf8d44['host']);_0xaf8d44[_0x704c('0x7f')]=intUtil[_0x704c('0x7e')](_0xaf8d44['serverUrl']);if(_0x7df427&&_0x7df427['monitor_format']){logger[_0x704c('0x2f')](_0x704c('0x80'),_0x704c('0x81'));_0xc209fe['recordingURL']=_0xaf8d44[_0x704c('0x7f')]+_0x704c('0x82')+_0xc209fe['uniqueid']+_0x704c('0x83')+md5(_0xc209fe['uniqueid']);}else{_0xc209fe[_0x704c('0x84')]='';}var _0x358a2a=_0xaf8d44[_0x704c('0x7d')]===_0x704c('0x85')?'eu':'com';return getAccessToken(_0xaf8d44)['then'](function(_0x48a034){_0x3f52d4=_0x48a034;return getUser(_0x3f52d4,_0x358a2a,_0xaf8d44,_0x21d70d[_0x704c('0x86')]);})['then'](function(_0x2f187a){_0x5aaac7=_0x2f187a;logger[_0x704c('0x2f')]('The\x20User\x20ID\x20is:',_0x5aaac7['id']);return getEndUser(_0x3f52d4,_0x358a2a,_0xaf8d44,_0xc209fe['calleridname'],_0xc209fe['calleridnum'],_0x5aaac7,_0x19e915);})['then'](function(_0x5d13bd){_0x25f973=_0x5d13bd;return getCall(_0x3f52d4,_0x358a2a,_0xaf8d44,_0x5aaac7,_0x25f973,_0x19e915,_0xc209fe,_0x704c('0x87'));})[_0x704c('0x2a')](function(_0x39ece2){if(_0x39ece2){logger[_0x704c('0x2f')]('The\x20Call\x20ID\x20is:',_0x39ece2['id']);logger[_0x704c('0x2f')](_0x704c('0x80'),_0x704c('0x88'));emit(util[_0x704c('0x32')](_0x704c('0x89'),_0x21d70d[_0x704c('0x19')]),_0x704c('0x8a'),{'uri':_0x704c('0x8b')+_0xaf8d44[_0x704c('0x7d')]+_0x704c('0x8c')+_0x39ece2['id']});}})[_0x704c('0x2d')](function(_0x40eeae){logger[_0x704c('0x2e')](_0x704c('0x80'),JSON[_0x704c('0x3e')](_0x40eeae));});};exports['outbound']=function(_0x44bc93,_0x596af0,_0x3e52b3,_0x25d3ac,_0x9ef59e,_0x28e3a8,_0x4b656e){var _0x542145,_0x251ac3,_0x1760f6;_0x28e3a8[_0x704c('0x7d')]=intUtil[_0x704c('0x7e')](_0x28e3a8[_0x704c('0x7d')]);_0x28e3a8[_0x704c('0x7f')]=intUtil[_0x704c('0x7e')](_0x28e3a8['serverUrl']);if(_0x4b656e&&_0x4b656e[_0x704c('0x8d')]&&_0x4b656e[_0x704c('0x8d')]!==_0x704c('0x8e')){logger['info'](_0x704c('0x8f'),_0x704c('0x81'));_0x596af0[_0x704c('0x84')]=_0x28e3a8[_0x704c('0x7f')]+_0x704c('0x82')+_0x596af0[_0x704c('0x90')]+_0x704c('0x83')+md5(_0x596af0[_0x704c('0x90')]);}var _0x36533f=_0x28e3a8['host']===_0x704c('0x85')?'eu':'com';return getAccessToken(_0x28e3a8)[_0x704c('0x2a')](function(_0x213bd1){_0x1760f6=_0x213bd1;return getUser(_0x1760f6,_0x36533f,_0x28e3a8,_0x25d3ac[_0x704c('0x86')]);})[_0x704c('0x2a')](function(_0x779eec){_0x542145=_0x779eec;logger[_0x704c('0x2f')](_0x704c('0x91'),_0x542145['id']);return getEndUser(_0x1760f6,_0x36533f,_0x28e3a8,_0x596af0[_0x704c('0x92')],_0x596af0[_0x704c('0x93')],_0x542145,_0x3e52b3);})[_0x704c('0x2a')](function(_0x4d599c){_0x251ac3=_0x4d599c;return getCall(_0x1760f6,_0x36533f,_0x28e3a8,_0x542145,_0x251ac3,_0x3e52b3,_0x596af0,_0x704c('0x94'));})['then'](function(_0x1ee2ca){if(_0x1ee2ca){logger['info'](_0x704c('0x95'),_0x1ee2ca['id']);logger[_0x704c('0x2f')](_0x704c('0x8f'),_0x704c('0x88'));emit(util[_0x704c('0x32')]('user:%s',_0x25d3ac[_0x704c('0x19')]),_0x704c('0x8a'),{'uri':_0x704c('0x8b')+_0x28e3a8[_0x704c('0x7d')]+'/crm/EntityInfo.do?module=Calls&id='+_0x1ee2ca['id']});}})[_0x704c('0x2d')](function(_0x41995e){logger[_0x704c('0x2e')](_0x704c('0x8f'),JSON[_0x704c('0x3e')](_0x41995e));});};exports[_0x704c('0x96')]=function(_0x5af8ce,_0xa0fcdf,_0x29a88b,_0x2062a0,_0x1ffecc,_0x4f563a){var _0x181aeb,_0x140517,_0x4cc25d;_0x4f563a[_0x704c('0x7d')]=intUtil['stripTrailingSlash'](_0x4f563a['host']);_0x4f563a[_0x704c('0x7f')]=intUtil[_0x704c('0x7e')](_0x4f563a['serverUrl']);if(_0x1ffecc&&_0x1ffecc[_0x704c('0x97')]){logger[_0x704c('0x2f')]('['+_0xa0fcdf[_0x704c('0x6a')][_0x704c('0x98')]()+']',_0x704c('0x81'));_0xa0fcdf['recordingURL']=_0x4f563a[_0x704c('0x7f')]+_0x704c('0x82')+_0xa0fcdf[_0x704c('0x90')]+_0x704c('0x83')+md5(_0xa0fcdf['uniqueid']);}else{_0xa0fcdf[_0x704c('0x84')]='';}var _0x1b7de1=_0x4f563a[_0x704c('0x7d')]==='zoho.eu'?'eu':_0x704c('0x99');return getAccessToken(_0x4f563a)['then'](function(_0x18abd5){_0x4cc25d=_0x18abd5;return getUser(_0x4cc25d,_0x1b7de1,_0x4f563a);})[_0x704c('0x2a')](function(_0x5e152b){_0x181aeb=_0x5e152b;logger['info']('The\x20User\x20ID\x20is:',_0x181aeb['id']);return getEndUser(_0x4cc25d,_0x1b7de1,_0x4f563a,_0xa0fcdf['calleridname'],_0xa0fcdf[_0x704c('0x9a')],_0x181aeb,_0x29a88b);})['then'](function(_0x342f97){_0x140517=_0x342f97;return getCall(_0x4cc25d,_0x1b7de1,_0x4f563a,_0x181aeb,_0x140517,_0x29a88b,_0xa0fcdf,_0x704c('0x87'));})[_0x704c('0x2a')](function(_0x422e8a){if(_0x422e8a){logger[_0x704c('0x2f')](_0x704c('0x95'),_0x422e8a['id']);}})[_0x704c('0x2d')](function(_0x302e57){logger[_0x704c('0x2e')]('['+_0xa0fcdf['lastevent']['toUpperCase']()+']',JSON[_0x704c('0x3e')](_0x302e57));});}; \ No newline at end of file +var _0x29a7=['toString','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientSecret','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','user','Administrator','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','enduserType','POST','https://www.zohoapis.','role','first_name','last_name','details','startCase','moduleCreate','Error:\x20','log','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','profile','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','utc','talktime','answertime','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','called','Called','Call_Result','Answered','rejected','Rejected','Abandoned','Timeout','agentcalledAt','Inbound','merge','Fields','code','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','outbound','recordingFormat','none','[OUTBOUND]','/api/voice/recordings/','zoho.eu','com','destcalleridname','destcalleridnum','Outbound','/crm/EntityInfo.do?module=Calls&id=','unmanaged','monitor_format','toUpperCase','lastevent','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','redis','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','forEach','includes','picklist','type','idField','variableName','Variable','name','toLowerCase'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x29a7,0x1af));var _0x729a=function(_0x15e812,_0x44748d){_0x15e812=_0x15e812-0x0;var _0x264014=_0x29a7[_0x15e812];return _0x264014;};'use strict';var _=require(_0x729a('0x0'));var rp=require(_0x729a('0x1'));var md5=require(_0x729a('0x2'));var util=require(_0x729a('0x3'));var intUtil=require(_0x729a('0x4'));var moment=require(_0x729a('0x5'));var Redis=require(_0x729a('0x6'));var BPromise=require(_0x729a('0x7'));var config=require(_0x729a('0x8'));var logger=require('../../../../config/logger')('zoho');config[_0x729a('0x9')]=_['defaults'](config[_0x729a('0x9')],{'host':_0x729a('0xa'),'port':0x18eb});var io=require(_0x729a('0xb'))(new Redis(config[_0x729a('0x9')]));function emit(_0x14f587,_0x539bfa,_0x76aee0){io['to'](_0x14f587)[_0x729a('0xc')](_0x539bfa,_0x76aee0);}function request(_0x35aa72){logger[_0x729a('0xd')](_0x729a('0xe'),JSON[_0x729a('0xf')](_0x35aa72));return rp(_0x35aa72);}function getCustomFields(_0x41ee38,_0xeef376){var _0x440288={};if(_0x41ee38['length']>0x0){_[_0x729a('0x10')](_0x41ee38,function(_0x17d5ae){if(_[_0x729a('0x11')](['string',_0x729a('0x12')],_0x17d5ae[_0x729a('0x13')])&&_0x17d5ae[_0x729a('0x14')]){_0x440288[_0x17d5ae[_0x729a('0x14')]]=_0x17d5ae['content']['toString']();}else if(_0x17d5ae[_0x729a('0x13')]==='variable'&&_0x17d5ae[_0x729a('0x15')]&&_0x17d5ae[_0x729a('0x14')]&&_0xeef376[_0x17d5ae[_0x729a('0x15')]]){_0x440288[_0x17d5ae['idField']]=_0xeef376[_0x17d5ae[_0x729a('0x15')]]['toString']();}else if(_0x17d5ae[_0x729a('0x13')]==='customVariable'&&_0x17d5ae[_0x729a('0x16')]&&_0x17d5ae[_0x729a('0x16')][_0x729a('0x17')]&&_0x17d5ae[_0x729a('0x14')]&&_0xeef376[_0x17d5ae[_0x729a('0x16')]['name'][_0x729a('0x18')]()]){_0x440288[_0x17d5ae[_0x729a('0x14')]]=_0xeef376[_0x17d5ae[_0x729a('0x16')][_0x729a('0x17')][_0x729a('0x18')]()][_0x729a('0x19')]();}});}return _0x440288;}function getName(_0x37443a){if(_0x37443a[_0x729a('0x1a')]('\x20')>0x0){var _0x1e2110=_0x37443a[_0x729a('0x1b')](/ (.+)/);if(_0x1e2110[0x1]){return _0x1e2110;}}return[_0x37443a,_0x37443a];}var accountsTokens={};function getAccessToken(_0x372727){return new Promise(function(_0x16fb93,_0x5f4838){if(!_[_0x729a('0x1c')](accountsTokens[_0x372727['id']])&&!_[_0x729a('0x1c')](accountsTokens[_0x372727['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x372727['id']][_0x729a('0x1d')])){_0x16fb93(accountsTokens[_0x372727['id']][_0x729a('0x1e')]);}}var _0x142751;switch(_0x372727[_0x729a('0x1f')]){case'US':_0x142751=_0x729a('0x20');break;case'AU':_0x142751=_0x729a('0x21');break;case'EU':_0x142751=_0x729a('0x22');break;case'IN':_0x142751=_0x729a('0x23');break;case'CN':_0x142751=_0x729a('0x24');break;default:_0x142751='https://accounts.zoho.eu';break;}var _0x5d3bff={'method':'POST','uri':_0x142751+_0x729a('0x25'),'qs':{'refresh_token':_0x372727[_0x729a('0x26')],'client_id':_0x372727['clientId'],'client_secret':_0x372727[_0x729a('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5d3bff)[_0x729a('0x28')](function(_0x2bdd91){accountsTokens[_0x372727['id']]={'access_token':_0x2bdd91[_0x729a('0x1e')],'expires_in':moment()[_0x729a('0x29')](_0x2bdd91['expires_in'],_0x729a('0x2a'))};_0x16fb93(_0x2bdd91[_0x729a('0x1e')]);})[_0x729a('0x2b')](function(_0x49ea0e){logger[_0x729a('0x2c')](_0x729a('0x2d'),_0x49ea0e['stack']);_0x5f4838(_0x49ea0e);});});}function getUser(_0x5dd096,_0xa240d2,_0x3b10cc,_0x38e029){logger['info']('Search\x20user');return request({'method':_0x729a('0x2e'),'uri':util[_0x729a('0x2f')](_0x729a('0x30'),_0xa240d2),'qs':{'type':_0x729a('0x31')},'headers':{'Authorization':_0x729a('0x32')+_0x5dd096},'json':!![]})[_0x729a('0x28')](function(_0x2d6b0b){if(_0x2d6b0b[_0x729a('0x33')]){var _0x4c99ee=-0x1;if(_[_0x729a('0x34')](_0x2d6b0b[_0x729a('0x33')])){if(!_[_0x729a('0x1c')](_0x38e029)){_0x4c99ee=_[_0x729a('0x35')](_0x2d6b0b[_0x729a('0x33')],function(_0x1134d7){return _0x1134d7[_0x729a('0x36')]===_0x38e029;});}if(_0x4c99ee>=0x0){logger[_0x729a('0x37')](_0x729a('0x38'));}else{logger[_0x729a('0x37')](_0x729a('0x39'));_0x4c99ee=_[_0x729a('0x35')](_0x2d6b0b[_0x729a('0x33')],function(_0x392782){return _0x392782['profile'][_0x729a('0x17')]==='Administrator';});}return _0x2d6b0b['users'][_0x4c99ee];}else{if(_0x2d6b0b[_0x729a('0x3a')]['profile'][_0x729a('0x17')]===_0x729a('0x3b')){logger[_0x729a('0x37')](_0x729a('0x39'));user=_0x2d6b0b[_0x729a('0x3a')];return user;}else{logger[_0x729a('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x729a('0xf')](_0x2d6b0b));throw new Error(_0x729a('0x3c')+JSON[_0x729a('0xf')](_0x2d6b0b));}}}else{logger[_0x729a('0x2c')](_0x729a('0x3d'),JSON[_0x729a('0xf')](_0x2d6b0b));throw new Error(_0x729a('0x3c')+JSON[_0x729a('0xf')](_0x2d6b0b));}})['catch'](function(_0x153c73){console['error'](_0x153c73);});}function getZohoUser(_0x5dec24,_0x58254d){return new BPromise(function(_0x4f54e3,_0xdcf534){request(_0x5dec24)[_0x729a('0x28')](function(_0xf2bc9d){var _0x47fb3b=null;if(_0xf2bc9d){_0x47fb3b=_0xf2bc9d[_0x729a('0x3e')][0x0];_0x47fb3b[_0x729a('0x3f')]=_0x58254d;}_0x4f54e3(_0x47fb3b);})[_0x729a('0x2b')](function(_0x4e5be5){_0xdcf534(_0x4e5be5);});});}function createEndUser(_0x6adccb,_0x42c218,_0xb6dd16,_0x42b5b2,_0x10b1ca,_0x31ca69){var _0xb6dd16=getName(_0xb6dd16);return request({'method':_0x729a('0x40'),'uri':_0x729a('0x41')+_0x42c218+'/crm/v2/'+_['startCase'](_0x31ca69['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0xb6dd16[0x1],'First_Name':_0xb6dd16[0x0],'Phone':_0x42b5b2,'Owner':{'name':!_[_0x729a('0x1c')](_0x10b1ca[_0x729a('0x42')]['name'])?_0x10b1ca[_0x729a('0x42')][_0x729a('0x17')]:!_['isNil'](_0x10b1ca['first_name'])?_0x10b1ca[_0x729a('0x43')]+'\x20'+_0x10b1ca[_0x729a('0x44')]:_0x10b1ca[_0x729a('0x44')],'id':_0x10b1ca['id']}}]},'headers':{'Authorization':_0x729a('0x32')+_0x6adccb},'json':!![]})[_0x729a('0x28')](function(_0xd96367){if(_0xd96367&&_0xd96367[_0x729a('0x3e')][0x0]['code']==='SUCCESS'){var _0x1e9243=_0xd96367[_0x729a('0x3e')][0x0][_0x729a('0x45')];_0x1e9243[_0x729a('0x3f')]=_[_0x729a('0x46')](_0x31ca69[_0x729a('0x47')])+'s';return _0x1e9243;}logger[_0x729a('0x2c')](_0x729a('0x3d'),JSON[_0x729a('0xf')](data));throw new Error(_0x729a('0x48')+JSON['stringify'](data));})['catch'](function(_0x38c0e1){console[_0x729a('0x49')]('CREATE\x20ERROR',_0x38c0e1);});}function getEndUser(_0x3355d8,_0x4e2187,_0x2d3f81,_0x15219c,_0x55e843,_0x558c71,_0x1d2f32){var _0x4f87b1={'method':_0x729a('0x2e'),'uri':'','headers':{'Authorization':_0x729a('0x32')+_0x3355d8},'json':!![]};switch(_0x1d2f32['moduleSearch']){case _0x729a('0x4a'):_0x4f87b1[_0x729a('0x4b')]=_0x729a('0x41')+_0x4e2187+_0x729a('0x4c')+_0x55e843+'))';return getZohoUser(_0x4f87b1,_0x729a('0x4d'))[_0x729a('0x28')](function(_0x139dfd){if(_0x139dfd)return _0x139dfd;_0x4f87b1[_0x729a('0x4b')]=_0x729a('0x41')+_0x4e2187+_0x729a('0x4e')+_0x55e843+'))';return getZohoUser(_0x4f87b1,_0x729a('0x4f'))[_0x729a('0x28')](function(_0x4c9d09){if(_0x4c9d09)return _0x4c9d09;if(_0x1d2f32['moduleCreate']!=_0x729a('0x50')){return createEndUser(_0x3355d8,_0x4e2187,_0x15219c,_0x55e843,_0x558c71,_0x1d2f32);}else{return{};}});});break;case _0x729a('0x51'):_0x4f87b1[_0x729a('0x4b')]='https://www.zohoapis.'+_0x4e2187+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x55e843+'))';return getZohoUser(_0x4f87b1,_0x729a('0x4d'))[_0x729a('0x28')](function(_0xe2a2ce){if(_0xe2a2ce)return _0xe2a2ce;if(_0x1d2f32['moduleCreate']!='nothing'){return createEndUser(_0x3355d8,_0x4e2187,_0x15219c,_0x55e843,_0x558c71,_0x1d2f32);}else{return{};}});break;case _0x729a('0x52'):_0x4f87b1[_0x729a('0x4b')]='https://www.zohoapis.'+_0x4e2187+_0x729a('0x4e')+_0x55e843+'))';return getZohoUser(_0x4f87b1,'Leads')[_0x729a('0x28')](function(_0x26042d){if(_0x26042d)return _0x26042d;if(_0x1d2f32[_0x729a('0x47')]!=_0x729a('0x50')){return createEndUser(_0x3355d8,_0x4e2187,_0x15219c,_0x55e843,_0x558c71,_0x1d2f32);}else{return{};}});break;}}function getCall(_0x41ca2f,_0x8702ed,_0x34ad6a,_0x56116a,_0x2d5c9e,_0x55c6cb,_0x1f0604,_0x28008d){logger['info'](_0x729a('0x53'));var _0x4edccc={};_0x4edccc['Owner']={'name':!_[_0x729a('0x1c')](_0x56116a[_0x729a('0x42')][_0x729a('0x17')])&&!_[_0x729a('0x1c')](_0x56116a[_0x729a('0x54')][_0x729a('0x17')])&&_0x56116a[_0x729a('0x54')][_0x729a('0x17')]===_0x729a('0x55')?_0x56116a[_0x729a('0x42')]['name']:!_[_0x729a('0x1c')](_0x56116a[_0x729a('0x43')])?_0x56116a[_0x729a('0x43')]+'\x20'+_0x56116a[_0x729a('0x44')]:_0x56116a[_0x729a('0x44')],'id':_0x56116a['id']};_0x4edccc[_0x729a('0x56')]=intUtil[_0x729a('0x57')](_0x55c6cb[_0x729a('0x58')],_0x1f0604,'\x20');_0x4edccc[_0x729a('0x59')]=intUtil[_0x729a('0x57')](_0x55c6cb[_0x729a('0x5a')],_0x1f0604,'\x0a');if(_0x2d5c9e[_0x729a('0x3f')]==='Contacts'){_0x4edccc[_0x729a('0x5b')]={'name':!_[_0x729a('0x1c')](_0x2d5c9e[_0x729a('0x5c')])?_0x2d5c9e[_0x729a('0x5c')]:!_[_0x729a('0x1c')](_0x2d5c9e[_0x729a('0x5d')])?_0x2d5c9e[_0x729a('0x5d')]+'\x20'+_0x2d5c9e[_0x729a('0x5e')]:_0x2d5c9e['Last_Name'],'id':_0x2d5c9e['id']};}if(_0x2d5c9e[_0x729a('0x3f')]===_0x729a('0x4f')){_0x4edccc[_0x729a('0x5f')]={'name':!_[_0x729a('0x1c')](_0x2d5c9e['Full_Name'])?_0x2d5c9e[_0x729a('0x5c')]:!_['isNil'](_0x2d5c9e['First_Name'])?_0x2d5c9e[_0x729a('0x5d')]+'\x20'+_0x2d5c9e[_0x729a('0x5e')]:_0x2d5c9e[_0x729a('0x5e')],'id':_0x2d5c9e['id']};_0x4edccc['$se_module']=_[_0x729a('0x46')](_0x2d5c9e[_0x729a('0x3f')]);}if(_0x1f0604['talktime']){_0x4edccc['Call_Duration']=moment[_0x729a('0x60')](parseInt(_0x1f0604[_0x729a('0x61')])*0x3e8)[_0x729a('0x2f')]('mm:ss');}else if(_0x1f0604[_0x729a('0x62')]&&_0x1f0604[_0x729a('0x63')]){_0x4edccc[_0x729a('0x64')]=moment[_0x729a('0x60')](moment(_0x1f0604[_0x729a('0x63')],_0x729a('0x65'))[_0x729a('0x66')](moment(_0x1f0604[_0x729a('0x67')],_0x729a('0x65'))))['format'](_0x729a('0x68'));}switch(_0x1f0604['lastevent']){case _0x729a('0x69'):_0x4edccc['Call_Result']=_0x729a('0x6a');break;case'complete':case'connect':_0x4edccc[_0x729a('0x6b')]=_0x729a('0x6c');break;case _0x729a('0x6d'):_0x4edccc[_0x729a('0x6b')]=_0x729a('0x6e');break;case'abandoned':_0x4edccc[_0x729a('0x6b')]=_0x729a('0x6f');break;case'timeout':_0x4edccc['Call_Result']=_0x729a('0x70');default:}_0x4edccc['Call_Start_Time']=(_0x28008d==='outbound'?moment(_0x1f0604[_0x729a('0x67')])[_0x729a('0x2f')](_0x729a('0x65')):moment(_0x1f0604[_0x729a('0x71')])[_0x729a('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()['format'](_0x729a('0x65'));_0x4edccc['Call_Type']=_0x28008d||_0x729a('0x72');_0x4edccc=_[_0x729a('0x73')](_0x4edccc,getCustomFields(_0x55c6cb[_0x729a('0x74')],_0x1f0604));return request({'method':_0x729a('0x40'),'uri':_0x729a('0x41')+_0x8702ed+'/crm/v2/Calls','headers':{'Authorization':_0x729a('0x32')+_0x41ca2f},'body':{'data':[_0x4edccc]},'json':!![]})[_0x729a('0x28')](function(_0x340563){if(_0x340563&&_0x340563[_0x729a('0x3e')][0x0][_0x729a('0x75')]==='SUCCESS'){logger[_0x729a('0x37')](_0x729a('0x76'));return{'id':_0x340563['data'][0x0][_0x729a('0x45')]['id']};}})['catch'](function(_0x29864e){logger[_0x729a('0x37')](_0x729a('0x77'),_0x29864e['stack']);console[_0x729a('0x49')](_0x729a('0x77'),_0x29864e);});}exports[_0x729a('0x78')]=function(_0x39297d,_0x18b441,_0x5321ad,_0x481d44,_0x54629,_0x12f5d9){var _0x3faceb,_0x5e1ac5,_0xafd9cb;_0x12f5d9[_0x729a('0x79')]=intUtil[_0x729a('0x7a')](_0x12f5d9[_0x729a('0x79')]);_0x12f5d9['serverUrl']=intUtil[_0x729a('0x7a')](_0x12f5d9[_0x729a('0x7b')]);if(_0x54629&&_0x54629['monitor_format']){logger['info']('[QUEUE]',_0x729a('0x7c'));_0x18b441[_0x729a('0x7d')]=_0x12f5d9['serverUrl']+'/api/voice/recordings/'+_0x18b441['uniqueid']+_0x729a('0x7e')+md5(_0x18b441[_0x729a('0x7f')]);}else{_0x18b441[_0x729a('0x7d')]='';}var _0x53929e=_0x12f5d9[_0x729a('0x79')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x12f5d9)[_0x729a('0x28')](function(_0x4d844f){_0xafd9cb=_0x4d844f;return getUser(_0xafd9cb,_0x53929e,_0x12f5d9,_0x481d44[_0x729a('0x36')]);})[_0x729a('0x28')](function(_0x12c20b){_0x3faceb=_0x12c20b;logger[_0x729a('0x37')](_0x729a('0x80'),_0x3faceb['id']);return getEndUser(_0xafd9cb,_0x53929e,_0x12f5d9,_0x18b441[_0x729a('0x81')],_0x18b441[_0x729a('0x82')],_0x3faceb,_0x5321ad);})[_0x729a('0x28')](function(_0x4ef795){_0x5e1ac5=_0x4ef795;return getCall(_0xafd9cb,_0x53929e,_0x12f5d9,_0x3faceb,_0x5e1ac5,_0x5321ad,_0x18b441,'Inbound');})[_0x729a('0x28')](function(_0x9176b2){if(_0x9176b2){logger['info'](_0x729a('0x83'),_0x9176b2['id']);logger[_0x729a('0x37')](_0x729a('0x84'),_0x729a('0x85'));emit(util['format'](_0x729a('0x86'),_0x481d44[_0x729a('0x17')]),_0x729a('0x87'),{'uri':_0x729a('0x88')+_0x12f5d9[_0x729a('0x79')]+'/crm/EntityInfo.do?module=Calls&id='+_0x9176b2['id']});}})['catch'](function(_0x4e3db1){logger['error'](_0x729a('0x84'),JSON['stringify'](_0x4e3db1));});};exports[_0x729a('0x89')]=function(_0x47ea0f,_0x5726d5,_0x2d50dd,_0x1057df,_0x157bd0,_0x1863a8,_0x130730){var _0x1017c6,_0x1a320a,_0x593620;_0x1863a8[_0x729a('0x79')]=intUtil['stripTrailingSlash'](_0x1863a8['host']);_0x1863a8[_0x729a('0x7b')]=intUtil[_0x729a('0x7a')](_0x1863a8['serverUrl']);if(_0x130730&&_0x130730[_0x729a('0x8a')]&&_0x130730[_0x729a('0x8a')]!==_0x729a('0x8b')){logger[_0x729a('0x37')](_0x729a('0x8c'),_0x729a('0x7c'));_0x5726d5[_0x729a('0x7d')]=_0x1863a8[_0x729a('0x7b')]+_0x729a('0x8d')+_0x5726d5[_0x729a('0x7f')]+'/downloads?type=uniqueid&token='+md5(_0x5726d5[_0x729a('0x7f')]);}var _0x3bc17c=_0x1863a8['host']===_0x729a('0x8e')?'eu':_0x729a('0x8f');return getAccessToken(_0x1863a8)[_0x729a('0x28')](function(_0x1585e6){_0x593620=_0x1585e6;return getUser(_0x593620,_0x3bc17c,_0x1863a8,_0x1057df[_0x729a('0x36')]);})['then'](function(_0x4819d5){_0x1017c6=_0x4819d5;logger['info'](_0x729a('0x80'),_0x1017c6['id']);return getEndUser(_0x593620,_0x3bc17c,_0x1863a8,_0x5726d5[_0x729a('0x90')],_0x5726d5[_0x729a('0x91')],_0x1017c6,_0x2d50dd);})['then'](function(_0x5f35f4){_0x1a320a=_0x5f35f4;return getCall(_0x593620,_0x3bc17c,_0x1863a8,_0x1017c6,_0x1a320a,_0x2d50dd,_0x5726d5,_0x729a('0x92'));})[_0x729a('0x28')](function(_0x2b2b84){if(_0x2b2b84){logger[_0x729a('0x37')](_0x729a('0x83'),_0x2b2b84['id']);logger['info']('[OUTBOUND]',_0x729a('0x85'));emit(util[_0x729a('0x2f')](_0x729a('0x86'),_0x1057df[_0x729a('0x17')]),'trigger:browser:url',{'uri':_0x729a('0x88')+_0x1863a8['host']+_0x729a('0x93')+_0x2b2b84['id']});}})[_0x729a('0x2b')](function(_0x460b6c){logger[_0x729a('0x2c')](_0x729a('0x8c'),JSON[_0x729a('0xf')](_0x460b6c));});};exports[_0x729a('0x94')]=function(_0x2ad023,_0x470b7a,_0x476478,_0xebbf1a,_0x58fe81,_0x37e903){var _0x2db03c,_0x1a6d07,_0x59898b;_0x37e903['host']=intUtil[_0x729a('0x7a')](_0x37e903['host']);_0x37e903[_0x729a('0x7b')]=intUtil[_0x729a('0x7a')](_0x37e903[_0x729a('0x7b')]);if(_0x58fe81&&_0x58fe81[_0x729a('0x95')]){logger['info']('['+_0x470b7a['lastevent'][_0x729a('0x96')]()+']',_0x729a('0x7c'));_0x470b7a[_0x729a('0x7d')]=_0x37e903['serverUrl']+_0x729a('0x8d')+_0x470b7a['uniqueid']+_0x729a('0x7e')+md5(_0x470b7a[_0x729a('0x7f')]);}else{_0x470b7a[_0x729a('0x7d')]='';}var _0x9b9ae6=_0x37e903[_0x729a('0x79')]===_0x729a('0x8e')?'eu':_0x729a('0x8f');return getAccessToken(_0x37e903)[_0x729a('0x28')](function(_0x1f09fa){_0x59898b=_0x1f09fa;return getUser(_0x59898b,_0x9b9ae6,_0x37e903);})[_0x729a('0x28')](function(_0xf535af){_0x2db03c=_0xf535af;logger[_0x729a('0x37')]('The\x20User\x20ID\x20is:',_0x2db03c['id']);return getEndUser(_0x59898b,_0x9b9ae6,_0x37e903,_0x470b7a[_0x729a('0x81')],_0x470b7a[_0x729a('0x82')],_0x2db03c,_0x476478);})[_0x729a('0x28')](function(_0xd86ea4){_0x1a6d07=_0xd86ea4;return getCall(_0x59898b,_0x9b9ae6,_0x37e903,_0x2db03c,_0x1a6d07,_0x476478,_0x470b7a,_0x729a('0x72'));})[_0x729a('0x28')](function(_0x2a32e9){if(_0x2a32e9){logger[_0x729a('0x37')]('The\x20Call\x20ID\x20is:',_0x2a32e9['id']);}})['catch'](function(_0x124859){logger['error']('['+_0x470b7a[_0x729a('0x97')]['toUpperCase']()+']',JSON[_0x729a('0xf')](_0x124859));});}; \ 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 e9cfd1f..08da00e 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 _0xd363=['../../../../config/logger','trigger','data2','Script','render','data3','exec','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','shelljs','mustache'];(function(_0x56d84e,_0x54747a){var _0x499e49=function(_0x3ec3dc){while(--_0x3ec3dc){_0x56d84e['push'](_0x56d84e['shift']());}};_0x499e49(++_0x54747a);}(_0xd363,0x89));var _0x3d36=function(_0x3de99a,_0x20140b){_0x3de99a=_0x3de99a-0x0;var _0x3d9667=_0xd363[_0x3de99a];return _0x3d9667;};'use strict';var util=require(_0x3d36('0x0'));var sh=require(_0x3d36('0x1'));var Mustache=require(_0x3d36('0x2'));var logger=require(_0x3d36('0x3'))(_0x3d36('0x4'));exports['exec']=function(_0x5522eb,_0x247276){var _0x31f5b1=_0x5522eb[_0x3d36('0x5')]?_0x5522eb[_0x3d36('0x5')]:_0x3d36('0x6');var _0x434cd0=_0x5522eb['data3']?Mustache[_0x3d36('0x7')](_0x5522eb[_0x3d36('0x8')],_0x247276):_0x247276;sh[_0x3d36('0x9')](_0x434cd0,function(_0x36cbdf,_0x4f95ab,_0x306dda){if(_0x36cbdf!==0x0){logger[_0x3d36('0xa')](util[_0x3d36('0xb')](_0x3d36('0xc'),_0x31f5b1,_0x434cd0,_0x36cbdf,_0x306dda));}else{logger[_0x3d36('0xd')](util[_0x3d36('0xb')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x31f5b1,_0x434cd0,_0x4f95ab));}});}; \ No newline at end of file +var _0xd6a4=['info','shelljs','mustache','trigger','exec','data2','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x2379b9,_0x8b96c2){var _0x5b097d=function(_0xbeec91){while(--_0xbeec91){_0x2379b9['push'](_0x2379b9['shift']());}};_0x5b097d(++_0x8b96c2);}(_0xd6a4,0x17d));var _0x4d6a=function(_0x16e711,_0x4b2cb4){_0x16e711=_0x16e711-0x0;var _0x416155=_0xd6a4[_0x16e711];return _0x416155;};'use strict';var util=require('util');var sh=require(_0x4d6a('0x0'));var Mustache=require(_0x4d6a('0x1'));var logger=require('../../../../config/logger')(_0x4d6a('0x2'));exports[_0x4d6a('0x3')]=function(_0x244816,_0x2fe5c4){var _0x172576=_0x244816[_0x4d6a('0x4')]?_0x244816['data2']:'Script';var _0x2954df=_0x244816[_0x4d6a('0x5')]?Mustache[_0x4d6a('0x6')](_0x244816[_0x4d6a('0x5')],_0x2fe5c4):_0x2fe5c4;sh[_0x4d6a('0x3')](_0x2954df,function(_0x53bb55,_0x36bb9c,_0xd2452a){if(_0x53bb55!==0x0){logger[_0x4d6a('0x7')](util['format'](_0x4d6a('0x8'),_0x172576,_0x2954df,_0x53bb55,_0xd2452a));}else{logger[_0x4d6a('0x9')](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x172576,_0x2954df,_0x36bb9c));}});}; \ 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 a8209de..3a78ff7 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 _0x7a65=['object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data5','number','headers','data6','parse','stack','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0x7a65,0x154));var _0x57a6=function(_0x313306,_0x3f1335){_0x313306=_0x313306-0x0;var _0x4dfccf=_0x7a65[_0x313306];return _0x4dfccf;};'use strict';var rp=require(_0x57a6('0x0'));var util=require(_0x57a6('0x1'));var _=require(_0x57a6('0x2'));var Mustache=require(_0x57a6('0x3'));var logger=require(_0x57a6('0x4'))(_0x57a6('0x5'));exports[_0x57a6('0x6')]=function(_0x2f40a4,_0x3b8b81){var _0x48eb7f,_0x3cfc5b;var _0xdae438={'method':_0x2f40a4[_0x57a6('0x7')][_0x57a6('0x8')](),'uri':Mustache[_0x57a6('0x9')](_0x2f40a4['data2'],_0x3b8b81),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2f40a4[_0x57a6('0xa')])===_0x57a6('0xb')&&parseInt(_0x2f40a4[_0x57a6('0xa')])>=0x1&&parseInt(_0x2f40a4[_0x57a6('0xa')])<=0xa?parseInt(_0x2f40a4[_0x57a6('0xa')])*0x3e8:0x5*0x3e8};try{_0xdae438[_0x57a6('0xc')]=_0x2f40a4[_0x57a6('0xd')]?JSON[_0x57a6('0xe')](Mustache['render'](_0x2f40a4[_0x57a6('0xd')],_0x3b8b81)):{};}catch(_0x248197){logger['error'](_0x248197[_0x57a6('0xf')]);}switch(_0x2f40a4[_0x57a6('0x7')][_0x57a6('0x8')]()){case'GET':case _0x57a6('0x10'):_0x48eb7f=null;_0xdae438['qs']=_0x3b8b81;break;case _0x57a6('0x11'):case _0x57a6('0x12'):if(_0x2f40a4[_0x57a6('0x13')]){try{_0x48eb7f=JSON['parse'](Mustache[_0x57a6('0x9')](_0x2f40a4['data7'],_0x3b8b81));_0xdae438[_0x57a6('0x14')]=_0x48eb7f;}catch(_0x416f35){logger[_0x57a6('0x15')](_0x416f35[_0x57a6('0xf')]);logger[_0x57a6('0x15')](_0x57a6('0x16'));}}else{_0x48eb7f=_0x3b8b81;_0xdae438[_0x57a6('0x14')]=_0x48eb7f;}break;}logger[_0x57a6('0x17')](util[_0x57a6('0x18')](_0x57a6('0x19'),_0x2f40a4['data1'],_0x2f40a4[_0x57a6('0x1a')],JSON[_0x57a6('0x1b')](_0xdae438)));rp(_0xdae438)[_0x57a6('0x1c')](function(_0xad7134){_0x48eb7f=!_[_0x57a6('0x1d')](_0x48eb7f)?',\x20request\x20body:\x20'+_0x48eb7f:'';_0x3cfc5b=typeof _0xad7134[_0x57a6('0x14')]===_0x57a6('0x1e')?JSON[_0x57a6('0x1b')](_0xad7134[_0x57a6('0x14')]):_0xad7134[_0x57a6('0x14')];logger['info'](util['format'](_0x57a6('0x1f'),_0x2f40a4[_0x57a6('0x7')],_0x2f40a4['data2'],_0xad7134[_0x57a6('0x20')],_0x3cfc5b));})[_0x57a6('0x21')](function(_0x476b99){logger[_0x57a6('0x15')](util[_0x57a6('0x18')](_0x57a6('0x22'),_0x2f40a4[_0x57a6('0x7')],_0x2f40a4['data2'],_0x476b99[_0x57a6('0x20')],_0x476b99[_0x57a6('0x23')],_0x476b99[_0x57a6('0x24')]));});}; \ No newline at end of file +var _0x72bf=['stringify','then','object','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','render','data2','number','data5','headers','data6','parse','error','stack','GET','DELETE','POST','data7','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s'];(function(_0x331d92,_0x3153a1){var _0x391d72=function(_0x384d35){while(--_0x384d35){_0x331d92['push'](_0x331d92['shift']());}};_0x391d72(++_0x3153a1);}(_0x72bf,0xc9));var _0xf72b=function(_0x1df423,_0x57a1dc){_0x1df423=_0x1df423-0x0;var _0x597d21=_0x72bf[_0x1df423];return _0x597d21;};'use strict';var rp=require(_0xf72b('0x0'));var util=require('util');var _=require(_0xf72b('0x1'));var Mustache=require(_0xf72b('0x2'));var logger=require(_0xf72b('0x3'))(_0xf72b('0x4'));exports[_0xf72b('0x5')]=function(_0x47a9bd,_0x5e957e){var _0x2726ab,_0x32bad3;var _0x529438={'method':_0x47a9bd[_0xf72b('0x6')]['toUpperCase'](),'uri':Mustache[_0xf72b('0x7')](_0x47a9bd[_0xf72b('0x8')],_0x5e957e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x47a9bd['data5'])===_0xf72b('0x9')&&parseInt(_0x47a9bd[_0xf72b('0xa')])>=0x1&&parseInt(_0x47a9bd[_0xf72b('0xa')])<=0xa?parseInt(_0x47a9bd['data5'])*0x3e8:0x5*0x3e8};try{_0x529438[_0xf72b('0xb')]=_0x47a9bd[_0xf72b('0xc')]?JSON[_0xf72b('0xd')](Mustache[_0xf72b('0x7')](_0x47a9bd['data6'],_0x5e957e)):{};}catch(_0x603219){logger[_0xf72b('0xe')](_0x603219[_0xf72b('0xf')]);}switch(_0x47a9bd['data1']['toUpperCase']()){case _0xf72b('0x10'):case _0xf72b('0x11'):_0x2726ab=null;_0x529438['qs']=_0x5e957e;break;case _0xf72b('0x12'):case'PUT':if(_0x47a9bd['data7']){try{_0x2726ab=JSON[_0xf72b('0xd')](Mustache[_0xf72b('0x7')](_0x47a9bd[_0xf72b('0x13')],_0x5e957e));_0x529438[_0xf72b('0x14')]=_0x2726ab;}catch(_0x1385d0){logger[_0xf72b('0xe')](_0x1385d0[_0xf72b('0xf')]);logger[_0xf72b('0xe')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2726ab=_0x5e957e;_0x529438[_0xf72b('0x14')]=_0x2726ab;}break;}logger[_0xf72b('0x15')](util['format'](_0xf72b('0x16'),_0x47a9bd['data1'],_0x47a9bd[_0xf72b('0x8')],JSON[_0xf72b('0x17')](_0x529438)));rp(_0x529438)[_0xf72b('0x18')](function(_0x2b7290){_0x2726ab=!_['isNil'](_0x2726ab)?',\x20request\x20body:\x20'+_0x2726ab:'';_0x32bad3=typeof _0x2b7290[_0xf72b('0x14')]===_0xf72b('0x19')?JSON[_0xf72b('0x17')](_0x2b7290[_0xf72b('0x14')]):_0x2b7290[_0xf72b('0x14')];logger[_0xf72b('0x15')](util[_0xf72b('0x1a')](_0xf72b('0x1b'),_0x47a9bd[_0xf72b('0x6')],_0x47a9bd[_0xf72b('0x8')],_0x2b7290[_0xf72b('0x1c')],_0x32bad3));})[_0xf72b('0x1d')](function(_0x242674){logger[_0xf72b('0xe')](util[_0xf72b('0x1a')](_0xf72b('0x1e'),_0x47a9bd[_0xf72b('0x6')],_0x47a9bd[_0xf72b('0x8')],_0x242674[_0xf72b('0x1c')],_0x242674['name'],_0x242674[_0xf72b('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index aaebf1c..bad4505 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 _0x2e80=['rpc','message','result','catch','exports','bluebird','../../config/logger','Request','request','then','debug','routing','error'];(function(_0x42126e,_0x18aa7c){var _0x3fa7fa=function(_0x1692ef){while(--_0x1692ef){_0x42126e['push'](_0x42126e['shift']());}};_0x3fa7fa(++_0x18aa7c);}(_0x2e80,0x87));var _0x02e8=function(_0x4fa489,_0x4cba6b){_0x4fa489=_0x4fa489-0x0;var _0x41d2ce=_0x2e80[_0x4fa489];return _0x41d2ce;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x02e8('0x0'));var logger=require(_0x02e8('0x1'))('routing');var client=jayson['client']['http']({'port':0x2329});client[_0x02e8('0x2')]=function(_0x31743b,_0x127acb){return new BPromise(function(_0x390c2b,_0x48f4f0){return client[_0x02e8('0x3')](_0x31743b,_0x127acb)[_0x02e8('0x4')](function(_0x34e365){logger[_0x02e8('0x5')]('rpc',_0x02e8('0x6'),_0x31743b,_0x127acb,_0x34e365);if(_0x34e365['error']){logger[_0x02e8('0x7')](_0x02e8('0x8'),_0x02e8('0x6'),_0x31743b,_0x34e365[_0x02e8('0x7')]['message'],_0x127acb);return _0x48f4f0(_0x34e365[_0x02e8('0x7')][_0x02e8('0x9')]);}else{return _0x390c2b(_0x34e365[_0x02e8('0xa')]);}})[_0x02e8('0xb')](function(_0x3e81d5){logger[_0x02e8('0x7')]('rpc',_0x02e8('0x6'),_0x31743b,_0x3e81d5,_0x127acb);return _0x48f4f0(_0x3e81d5);});});};module[_0x02e8('0xc')]=client; \ No newline at end of file +var _0xc831=['error','message','result','rpc','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then'];(function(_0x192099,_0x38a593){var _0x3d6ccc=function(_0x541fff){while(--_0x541fff){_0x192099['push'](_0x192099['shift']());}};_0x3d6ccc(++_0x38a593);}(_0xc831,0xb8));var _0x1c83=function(_0xe98508,_0x17f727){_0xe98508=_0xe98508-0x0;var _0x21f63e=_0xc831[_0xe98508];return _0x21f63e;};'use strict';var jayson=require(_0x1c83('0x0'));var BPromise=require(_0x1c83('0x1'));var logger=require(_0x1c83('0x2'))(_0x1c83('0x3'));var client=jayson[_0x1c83('0x4')][_0x1c83('0x5')]({'port':0x2329});client[_0x1c83('0x6')]=function(_0xd7f727,_0x27d1fe){return new BPromise(function(_0x36d991,_0x53a31c){return client['request'](_0xd7f727,_0x27d1fe)[_0x1c83('0x7')](function(_0x177273){logger['debug']('rpc','routing',_0xd7f727,_0x27d1fe,_0x177273);if(_0x177273[_0x1c83('0x8')]){logger[_0x1c83('0x8')]('rpc','routing',_0xd7f727,_0x177273[_0x1c83('0x8')][_0x1c83('0x9')],_0x27d1fe);return _0x53a31c(_0x177273[_0x1c83('0x8')][_0x1c83('0x9')]);}else{return _0x36d991(_0x177273[_0x1c83('0xa')]);}})['catch'](function(_0x5cf132){logger[_0x1c83('0x8')](_0x1c83('0xb'),_0x1c83('0x3'),_0xd7f727,_0x5cf132,_0x27d1fe);return _0x53a31c(_0x5cf132);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index b8ea694..c454834 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 _0x5e17=['./rpc/mailAccount','resolve','then','refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','log','bluebird','./server','./realtime','./lib/email'];(function(_0x36aa54,_0x4cc026){var _0x2997a8=function(_0x72ac66){while(--_0x72ac66){_0x36aa54['push'](_0x36aa54['shift']());}};_0x2997a8(++_0x4cc026);}(_0x5e17,0x1a0));var _0x75e1=function(_0x13c72f,_0x362257){_0x13c72f=_0x13c72f-0x0;var _0x523f26=_0x5e17[_0x13c72f];return _0x523f26;};'use strict';var BPromise=require(_0x75e1('0x0'));var server=require(_0x75e1('0x1'));var Realtime=require(_0x75e1('0x2'));var EmailChannel=require(_0x75e1('0x3'));var mailAccount=require(_0x75e1('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x75e1('0x5')]()['then'](mailAccount['getMailAccounts']())[_0x75e1('0x6')](realtime['initMailAccounts']())[_0x75e1('0x6')](function(){email[_0x75e1('0x7')](realtime[_0x75e1('0x8')]);return realtime;});}function main(){return server[_0x75e1('0x9')](realtime,email)[_0x75e1('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0x75e1('0xa')]();})[_0x75e1('0x6')](function(_0x59ffee){return setInterval(initRealtime,_0x59ffee[_0x75e1('0xb')]*0x3e8);})[_0x75e1('0xc')](function(_0x15e5fc){console[_0x75e1('0xd')](_0x15e5fc);});}main(); \ No newline at end of file +var _0x1ebd=['./rpc/setting','resolve','then','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','bluebird','./server','./realtime','./rpc/mailAccount'];(function(_0xa67f02,_0x39b203){var _0x2da95e=function(_0x2ed435){while(--_0x2ed435){_0xa67f02['push'](_0xa67f02['shift']());}};_0x2da95e(++_0x39b203);}(_0x1ebd,0x64));var _0xd1eb=function(_0xef7b36,_0x521709){_0xef7b36=_0xef7b36-0x0;var _0x3c3d75=_0x1ebd[_0xef7b36];return _0x3c3d75;};'use strict';var BPromise=require(_0xd1eb('0x0'));var server=require(_0xd1eb('0x1'));var Realtime=require(_0xd1eb('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0xd1eb('0x3'));var setting=require(_0xd1eb('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xd1eb('0x5')]()[_0xd1eb('0x6')](mailAccount['getMailAccounts']())['then'](realtime[_0xd1eb('0x7')]())[_0xd1eb('0x6')](function(){email['refresh'](realtime[_0xd1eb('0x8')]);return realtime;});}function main(){return server[_0xd1eb('0x9')](realtime,email)[_0xd1eb('0x6')](function(){return initRealtime();})['then'](function(){return setting[_0xd1eb('0xa')]();})[_0xd1eb('0x6')](function(_0x28598f){return setInterval(initRealtime,_0x28598f[_0xd1eb('0xb')]*0x3e8);})[_0xd1eb('0xc')](function(_0x2f55b9){console['log'](_0x2f55b9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index fdf93fc..1e25fc1 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 _0x9287=['verify','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','stringify','mailAccount:update','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','bind','email','handleImapEmail','end','error','handleImapError','isNil','disabled','connected','messages','total','firstName','lastName','from','notify','then','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','send','verifySmtp','Smtp'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0x9287,0xa6));var _0x7928=function(_0x2e812d,_0x5c69fa){_0x2e812d=_0x2e812d-0x0;var _0x173ec0=_0x9287[_0x2e812d];return _0x173ec0;};'use strict';var _=require(_0x7928('0x0'));var moment=require(_0x7928('0x1'));var BPromise=require(_0x7928('0x2'));var md5=require(_0x7928('0x3'));var Redis=require(_0x7928('0x4'));var config=require(_0x7928('0x5'));var logger=require(_0x7928('0x6'))('email');config[_0x7928('0x7')]=_[_0x7928('0x8')](config['redis'],{'host':_0x7928('0x9'),'port':0x18eb});var io=require(_0x7928('0xa'))(new Redis(config[_0x7928('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x7928('0xb'));var mailAccount=require(_0x7928('0xc'));var md5Accounts={};function EmailChannel(_0x406dcf){logger[_0x7928('0xd')]('start\x20email\x20channel');this[_0x7928('0xe')]=_0x406dcf['mailAccounts'];this['imapAccounts']={};this[_0x7928('0xf')]=new EmailSmtp();}EmailChannel[_0x7928('0x10')][_0x7928('0x11')]=function(_0x384709){var _0xb25571=this['mailAccounts'][_0x384709];var _0x3a8217={'id':_0xb25571['id'],'name':_0xb25571[_0x7928('0x12')],'key':_0xb25571[_0x7928('0x13')],'active':_0xb25571[_0x7928('0x14')],'Imap':{'status':_0xb25571[_0x7928('0x15')][_0x7928('0x16')],'messageStatus':_0xb25571[_0x7928('0x15')][_0x7928('0x17')],'total':_0xb25571[_0x7928('0x15')]['total']}};if(_['isNil'](md5Accounts[_0x384709])){md5Accounts[_0x384709]={};}var _0x3be5a2=md5(JSON[_0x7928('0x18')](_0x3a8217));if(md5Accounts[_0x384709][_0x7928('0x3')]!==_0x3be5a2){md5Accounts[_0x384709][_0x7928('0x3')]=_0x3be5a2;io[_0x7928('0x11')](_0x7928('0x19'),_0x3a8217);}};EmailChannel[_0x7928('0x10')][_0x7928('0x1a')]=function(_0x459ccb){for(var _0x2636d9 in _0x459ccb){if(_0x459ccb[_0x7928('0x1b')](_0x2636d9)){if(_0x459ccb[_0x2636d9][_0x7928('0x15')]&&_0x459ccb[_0x2636d9][_0x7928('0x14')]){var _0x468365=_0x459ccb[_0x2636d9]['Imap'];if(!this[_0x7928('0x1c')][_0x7928('0x1b')](_0x468365['id'])){this[_0x7928('0x1c')][_0x468365['id']]=new EmailImap(_0x468365,_0x459ccb[_0x2636d9]['email']);this[_0x7928('0x1c')][_0x468365['id']]['on'](_0x7928('0x1d'),this[_0x7928('0x1e')][_0x7928('0x1f')](this,_0x2636d9));this[_0x7928('0x1c')][_0x468365['id']]['on'](_0x7928('0x20'),this[_0x7928('0x21')]['bind'](this,_0x2636d9));this[_0x7928('0x1c')][_0x468365['id']]['on'](_0x7928('0x22'),this['handleImapEnd'][_0x7928('0x1f')](this,_0x2636d9));this[_0x7928('0x1c')][_0x468365['id']]['on'](_0x7928('0x23'),this[_0x7928('0x24')][_0x7928('0x1f')](this,_0x2636d9));}}else{if(_[_0x7928('0x25')](this['mailAccounts'][_0x2636d9][_0x7928('0x15')])){this['mailAccounts'][_0x2636d9][_0x7928('0x15')]={};}this[_0x7928('0xe')][_0x2636d9]['Imap']['status']=_0x7928('0x26');this[_0x7928('0xe')][_0x2636d9]['Imap'][_0x7928('0x17')]='';this[_0x7928('0x11')](_0x2636d9);}}}};EmailChannel[_0x7928('0x10')][_0x7928('0x1e')]=function(_0x5c3cd7,_0x13205b){if(this[_0x7928('0xe')][_0x5c3cd7]){this[_0x7928('0xe')][_0x5c3cd7][_0x7928('0x15')][_0x7928('0x16')]=_0x7928('0x27');this[_0x7928('0xe')][_0x5c3cd7]['Imap'][_0x7928('0x17')]=_0x13205b[_0x7928('0x12')];if(_0x13205b[_0x7928('0x28')]){this[_0x7928('0xe')][_0x5c3cd7][_0x7928('0x15')][_0x7928('0x29')]=_0x13205b[_0x7928('0x28')]['total'];}return this[_0x7928('0x11')](_0x5c3cd7);}};EmailChannel[_0x7928('0x10')]['handleImapEmail']=function(_0x38dfd9,_0x4fb385){logger[_0x7928('0xd')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x4fb385[_0x7928('0x2a')],_0x4fb385[_0x7928('0x2b')],_0x4fb385[_0x7928('0x2c')],_0x38dfd9);if(this['mailAccounts'][_0x38dfd9]){return mailAccount[_0x7928('0x2d')](_0x38dfd9,_0x4fb385)[_0x7928('0x2e')](function(_0x2ec2a6){if(_0x2ec2a6){logger[_0x7928('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0x7928('0x2f')](function(_0x5ab0dd){logger['error'](_0x7928('0x30'),JSON[_0x7928('0x18')](_0x5ab0dd));});}};EmailChannel['prototype'][_0x7928('0x31')]=function(_0x907d18){if(this[_0x7928('0xe')][_0x907d18]&&this['mailAccounts'][_0x907d18][_0x7928('0x15')]){if(this[_0x7928('0x1c')][this['mailAccounts'][_0x907d18]['Imap']['id']]){delete this[_0x7928('0x1c')][this[_0x7928('0xe')][_0x907d18][_0x7928('0x15')]['id']];}this[_0x7928('0xe')][_0x907d18][_0x7928('0x15')][_0x7928('0x32')]=moment();this[_0x7928('0x11')](_0x907d18);}};EmailChannel['prototype'][_0x7928('0x24')]=function(_0x143f0b,_0x493c47){if(this[_0x7928('0xe')][_0x143f0b]){this['mailAccounts'][_0x143f0b]['Imap'][_0x7928('0x16')]='error';this[_0x7928('0xe')][_0x143f0b][_0x7928('0x15')][_0x7928('0x17')]=_0x493c47;return this[_0x7928('0x11')](_0x143f0b);}};EmailChannel[_0x7928('0x10')]['sendMail']=function(_0x453d98,_0x5d8182){return this[_0x7928('0xf')][_0x7928('0x33')](_0x453d98,_0x5d8182);};EmailChannel[_0x7928('0x10')][_0x7928('0x34')]=function(_0x9ee80b){var _0x4a6384=this;if(this[_0x7928('0xe')][_0x9ee80b['id']]){if(_[_0x7928('0x25')](this[_0x7928('0xe')][_0x9ee80b['id']]['Smtp'])){this[_0x7928('0xe')][_0x9ee80b['id']][_0x7928('0x35')]={};}this[_0x7928('0xe')][_0x9ee80b['id']]['Smtp'][_0x7928('0x32')]=moment();return new BPromise(function(_0x148689,_0x4e5996){return _0x4a6384[_0x7928('0xf')][_0x7928('0x36')](_0x9ee80b)[_0x7928('0x2e')](function(_0x8a826d){_0x4a6384[_0x7928('0xe')][_0x9ee80b['id']][_0x7928('0x35')][_0x7928('0x16')]='verified';_0x4a6384[_0x7928('0xe')][_0x9ee80b['id']][_0x7928('0x35')][_0x7928('0x17')]='';_0x4a6384[_0x7928('0x11')](_0x9ee80b['id']);_0x148689(_0x8a826d);})[_0x7928('0x2f')](function(_0x3dd685){_0x4a6384[_0x7928('0xe')][_0x9ee80b['id']][_0x7928('0x35')][_0x7928('0x16')]=_0x7928('0x23');_0x4a6384[_0x7928('0xe')][_0x9ee80b['id']]['Smtp'][_0x7928('0x17')]=_0x3dd685;_0x4a6384[_0x7928('0x11')](_0x9ee80b['id']);_0x4e5996(_0x3dd685);});});}return this['smtp'][_0x7928('0x36')](_0x9ee80b);};module['exports']=EmailChannel; \ No newline at end of file +var _0xb5cd=['email','defaults','redis','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','Imap','status','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','imapAccounts','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','disabled','messageStatus','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','send','verifySmtp','Smtp','verified','lodash','ioredis','../../../config/environment','../../../config/logger'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0xb5cd,0x1d0));var _0xdb5c=function(_0x3b3fe8,_0x5d8cdd){_0x3b3fe8=_0x3b3fe8-0x0;var _0x22fc73=_0xb5cd[_0x3b3fe8];return _0x22fc73;};'use strict';var _=require(_0xdb5c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var md5=require('md5');var Redis=require(_0xdb5c('0x1'));var config=require(_0xdb5c('0x2'));var logger=require(_0xdb5c('0x3'))(_0xdb5c('0x4'));config['redis']=_[_0xdb5c('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdb5c('0x6')]));var EmailImap=require(_0xdb5c('0x7'));var EmailSmtp=require(_0xdb5c('0x8'));var mailAccount=require(_0xdb5c('0x9'));var md5Accounts={};function EmailChannel(_0x303a01){logger[_0xdb5c('0xa')](_0xdb5c('0xb'));this[_0xdb5c('0xc')]=_0x303a01['mailAccounts'];this['imapAccounts']={};this[_0xdb5c('0xd')]=new EmailSmtp();}EmailChannel[_0xdb5c('0xe')][_0xdb5c('0xf')]=function(_0x41c9a6){var _0x13cf85=this[_0xdb5c('0xc')][_0x41c9a6];var _0x51d9ec={'id':_0x13cf85['id'],'name':_0x13cf85[_0xdb5c('0x10')],'key':_0x13cf85[_0xdb5c('0x11')],'active':_0x13cf85[_0xdb5c('0x12')],'Imap':{'status':_0x13cf85[_0xdb5c('0x13')][_0xdb5c('0x14')],'messageStatus':_0x13cf85[_0xdb5c('0x13')]['messageStatus'],'total':_0x13cf85[_0xdb5c('0x13')][_0xdb5c('0x15')]}};if(_[_0xdb5c('0x16')](md5Accounts[_0x41c9a6])){md5Accounts[_0x41c9a6]={};}var _0x24d925=md5(JSON[_0xdb5c('0x17')](_0x51d9ec));if(md5Accounts[_0x41c9a6]['md5']!==_0x24d925){md5Accounts[_0x41c9a6]['md5']=_0x24d925;io['emit'](_0xdb5c('0x18'),_0x51d9ec);}};EmailChannel['prototype'][_0xdb5c('0x19')]=function(_0x5854d1){for(var _0x5e65b1 in _0x5854d1){if(_0x5854d1[_0xdb5c('0x1a')](_0x5e65b1)){if(_0x5854d1[_0x5e65b1][_0xdb5c('0x13')]&&_0x5854d1[_0x5e65b1]['active']){var _0xfb053e=_0x5854d1[_0x5e65b1]['Imap'];if(!this['imapAccounts']['hasOwnProperty'](_0xfb053e['id'])){this[_0xdb5c('0x1b')][_0xfb053e['id']]=new EmailImap(_0xfb053e,_0x5854d1[_0x5e65b1]['email']);this[_0xdb5c('0x1b')][_0xfb053e['id']]['on'](_0xdb5c('0x1c'),this[_0xdb5c('0x1d')][_0xdb5c('0x1e')](this,_0x5e65b1));this[_0xdb5c('0x1b')][_0xfb053e['id']]['on']('email',this[_0xdb5c('0x1f')]['bind'](this,_0x5e65b1));this['imapAccounts'][_0xfb053e['id']]['on']('end',this[_0xdb5c('0x20')]['bind'](this,_0x5e65b1));this[_0xdb5c('0x1b')][_0xfb053e['id']]['on'](_0xdb5c('0x21'),this[_0xdb5c('0x22')][_0xdb5c('0x1e')](this,_0x5e65b1));}}else{if(_[_0xdb5c('0x16')](this[_0xdb5c('0xc')][_0x5e65b1][_0xdb5c('0x13')])){this[_0xdb5c('0xc')][_0x5e65b1][_0xdb5c('0x13')]={};}this[_0xdb5c('0xc')][_0x5e65b1]['Imap'][_0xdb5c('0x14')]=_0xdb5c('0x23');this['mailAccounts'][_0x5e65b1][_0xdb5c('0x13')][_0xdb5c('0x24')]='';this[_0xdb5c('0xf')](_0x5e65b1);}}}};EmailChannel[_0xdb5c('0xe')][_0xdb5c('0x1d')]=function(_0x33d554,_0x144346){if(this[_0xdb5c('0xc')][_0x33d554]){this[_0xdb5c('0xc')][_0x33d554][_0xdb5c('0x13')]['status']='connected';this[_0xdb5c('0xc')][_0x33d554][_0xdb5c('0x13')][_0xdb5c('0x24')]=_0x144346['name'];if(_0x144346[_0xdb5c('0x25')]){this['mailAccounts'][_0x33d554][_0xdb5c('0x13')]['total']=_0x144346['messages'][_0xdb5c('0x15')];}return this[_0xdb5c('0xf')](_0x33d554);}};EmailChannel['prototype'][_0xdb5c('0x1f')]=function(_0xe7a013,_0x51fb8d){logger[_0xdb5c('0xa')](_0xdb5c('0x26'),_0x51fb8d[_0xdb5c('0x27')],_0x51fb8d[_0xdb5c('0x28')],_0x51fb8d[_0xdb5c('0x29')],_0xe7a013);if(this[_0xdb5c('0xc')][_0xe7a013]){return mailAccount[_0xdb5c('0x2a')](_0xe7a013,_0x51fb8d)[_0xdb5c('0x2b')](function(_0x57b13b){if(_0x57b13b){logger[_0xdb5c('0xa')](_0xdb5c('0x2c'));}})[_0xdb5c('0x2d')](function(_0x1567c9){logger[_0xdb5c('0x21')](_0xdb5c('0x2e'),JSON['stringify'](_0x1567c9));});}};EmailChannel[_0xdb5c('0xe')][_0xdb5c('0x20')]=function(_0x39693f){if(this[_0xdb5c('0xc')][_0x39693f]&&this[_0xdb5c('0xc')][_0x39693f][_0xdb5c('0x13')]){if(this[_0xdb5c('0x1b')][this[_0xdb5c('0xc')][_0x39693f][_0xdb5c('0x13')]['id']]){delete this['imapAccounts'][this[_0xdb5c('0xc')][_0x39693f][_0xdb5c('0x13')]['id']];}this[_0xdb5c('0xc')][_0x39693f]['Imap'][_0xdb5c('0x2f')]=moment();this[_0xdb5c('0xf')](_0x39693f);}};EmailChannel['prototype']['handleImapError']=function(_0x5a650f,_0x17ec72){if(this[_0xdb5c('0xc')][_0x5a650f]){this[_0xdb5c('0xc')][_0x5a650f][_0xdb5c('0x13')]['status']='error';this[_0xdb5c('0xc')][_0x5a650f]['Imap'][_0xdb5c('0x24')]=_0x17ec72;return this[_0xdb5c('0xf')](_0x5a650f);}};EmailChannel['prototype']['sendMail']=function(_0x1ea605,_0x1c5884){return this[_0xdb5c('0xd')][_0xdb5c('0x30')](_0x1ea605,_0x1c5884);};EmailChannel[_0xdb5c('0xe')][_0xdb5c('0x31')]=function(_0xbf0724){var _0x37fc79=this;if(this[_0xdb5c('0xc')][_0xbf0724['id']]){if(_[_0xdb5c('0x16')](this['mailAccounts'][_0xbf0724['id']][_0xdb5c('0x32')])){this['mailAccounts'][_0xbf0724['id']][_0xdb5c('0x32')]={};}this['mailAccounts'][_0xbf0724['id']][_0xdb5c('0x32')][_0xdb5c('0x2f')]=moment();return new BPromise(function(_0x44f1a4,_0x5c7bf1){return _0x37fc79[_0xdb5c('0xd')]['verify'](_0xbf0724)['then'](function(_0x5c2bfe){_0x37fc79[_0xdb5c('0xc')][_0xbf0724['id']][_0xdb5c('0x32')]['status']=_0xdb5c('0x33');_0x37fc79[_0xdb5c('0xc')][_0xbf0724['id']]['Smtp']['messageStatus']='';_0x37fc79['emit'](_0xbf0724['id']);_0x44f1a4(_0x5c2bfe);})['catch'](function(_0x3a450a){_0x37fc79['mailAccounts'][_0xbf0724['id']][_0xdb5c('0x32')][_0xdb5c('0x14')]=_0xdb5c('0x21');_0x37fc79[_0xdb5c('0xc')][_0xbf0724['id']]['Smtp'][_0xdb5c('0x24')]=_0x3a450a;_0x37fc79[_0xdb5c('0xf')](_0xbf0724['id']);_0x5c7bf1(_0x3a450a);});});}return this[_0xdb5c('0xd')]['verify'](_0xbf0724);};module['exports']=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 63edce8..fc42e71 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 _0x5db8=['imap','randomstring','mailparser','simpleParser','events','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','account','once','ready','handleReady','end','handleEnd','handleError','bind','connect','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','getHost','email','openBox','handleOpenBox','box','readUnseen','search','UNSEEN','handleReadUnseen','fetch','message','error','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','handleFetchMessage','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','emit','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util'];(function(_0x75a285,_0x464561){var _0x4cf11c=function(_0x28434d){while(--_0x28434d){_0x75a285['push'](_0x75a285['shift']());}};_0x4cf11c(++_0x464561);}(_0x5db8,0xbb));var _0x85db=function(_0x2d0d97,_0x2d9560){_0x2d0d97=_0x2d0d97-0x0;var _0xfb96e9=_0x5db8[_0x2d0d97];return _0xfb96e9;};'use strict';var fs=require('fs');var path=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var Imap=require(_0x85db('0x2'));var _=require('lodash');var rs=require(_0x85db('0x3'));var simpleParser=require(_0x85db('0x4'))[_0x85db('0x5')];var Iconv=require('iconv')['Iconv'];var EventEmitter=require(_0x85db('0x6'))[_0x85db('0x7')];var utils=require(_0x85db('0x8'));var logger=require(_0x85db('0x9'))('email');function EmailImap(_0x489b13,_0x2b9f25){this[_0x85db('0xa')]=_0x85db('0xb');this[_0x85db('0xc')]=this['getAccount'](_0x489b13,_0x2b9f25);this[_0x85db('0x2')]=new Imap(this['account']);this[_0x85db('0x2')][_0x85db('0xd')](_0x85db('0xe'),this[_0x85db('0xf')]['bind'](this));this['imap']['once'](_0x85db('0x10'),this[_0x85db('0x11')]['bind'](this));this[_0x85db('0x2')]['on']('error',this[_0x85db('0x12')][_0x85db('0x13')](this));this[_0x85db('0x2')][_0x85db('0x14')]();}util[_0x85db('0x15')](EmailImap,EventEmitter);EmailImap[_0x85db('0x16')][_0x85db('0x17')]=function(_0x25ec64,_0x3ca181){var _0x415281={'connTimeout':_0x25ec64[_0x85db('0x18')]?_0x25ec64[_0x85db('0x18')]*0x3e8:0x2710,'authTimeout':_0x25ec64[_0x85db('0x19')]?_0x25ec64['authTimeout']*0x3e8:0x1388};if(_[_0x85db('0x1a')](_0x25ec64[_0x85db('0x1b')])){if(_0x25ec64[_0x85db('0x1c')]){_0x415281[_0x85db('0x1d')]=_0x25ec64[_0x85db('0x1d')];_0x415281[_0x85db('0x1e')]=_0x25ec64[_0x85db('0x1e')];}_0x415281['host']=_0x25ec64[_0x85db('0x1f')];_0x415281[_0x85db('0x20')]=_0x25ec64[_0x85db('0x20')]||0x3e1;if(_0x25ec64[_0x85db('0x21')]){_0x415281[_0x85db('0x21')]=!![];}else{_0x415281[_0x85db('0x21')]=![];_0x415281[_0x85db('0x22')]=_0x85db('0x23');}}else{_0x415281[_0x85db('0x1d')]=_0x25ec64[_0x85db('0x1d')];_0x415281['password']=_0x25ec64[_0x85db('0x1e')];_0x415281[_0x85db('0x1f')]=utils[_0x85db('0x24')](_0x25ec64[_0x85db('0x1b')]);_0x415281[_0x85db('0x20')]=0x3e1;_0x415281[_0x85db('0x21')]=!![];}_0x415281[_0x85db('0x25')]=_0x3ca181||_0x25ec64[_0x85db('0x1d')]||'anonymous@xcally.com';return _0x415281;};EmailImap[_0x85db('0x16')][_0x85db('0xf')]=function(){this[_0x85db('0x2')][_0x85db('0x26')](this[_0x85db('0xa')],![],this[_0x85db('0x27')]['bind'](this));};EmailImap[_0x85db('0x16')][_0x85db('0x27')]=function(_0x1b1980,_0x54ba03){if(_0x1b1980){this['handleError'](_0x1b1980,!![]);}else{this['emit'](_0x85db('0x28'),_0x54ba03);this[_0x85db('0x29')]();}};EmailImap[_0x85db('0x16')]['handleCloseBox']=function(_0x71c6f4){if(_0x71c6f4){this[_0x85db('0x12')](_0x71c6f4,!![]);}else{this[_0x85db('0x2')]['end']();}};EmailImap['prototype'][_0x85db('0x29')]=function(){this[_0x85db('0x2')][_0x85db('0x2a')]([_0x85db('0x2b')],this[_0x85db('0x2c')][_0x85db('0x13')](this));};EmailImap[_0x85db('0x16')][_0x85db('0x2c')]=function(_0x6ee161,_0x1edc8d){if(_0x6ee161){this['handleError'](_0x6ee161,!![]);}else{if(_0x1edc8d['length']){try{var _0x13ad98=this['imap'][_0x85db('0x2d')](_0x1edc8d,{'bodies':'','markSeen':!![]});_0x13ad98['on'](_0x85db('0x2e'),this['handleFetchMessage'][_0x85db('0x13')](this));_0x13ad98[_0x85db('0xd')](_0x85db('0x2f'),this[_0x85db('0x30')]['bind'](this));_0x13ad98[_0x85db('0xd')](_0x85db('0x10'),this[_0x85db('0x31')][_0x85db('0x13')](this));}catch(_0x2ec392){logger['error'](_0x2ec392);}}else{this[_0x85db('0x2')][_0x85db('0x32')](!![],this[_0x85db('0x33')][_0x85db('0x13')](this));}}};EmailImap['prototype'][_0x85db('0x34')]=function(_0x27fdef,_0x2a07ee){_0x27fdef['on']('body',this['handleMessageBody'][_0x85db('0x13')](this));_0x27fdef[_0x85db('0xd')]('attributes',this[_0x85db('0x35')][_0x85db('0x13')](this));_0x27fdef[_0x85db('0xd')](_0x85db('0x10'),this[_0x85db('0x36')][_0x85db('0x13')](this));};EmailImap[_0x85db('0x16')][_0x85db('0x37')]=function(_0x158ac8,_0x27b218){simpleParser(_0x158ac8,{'Iconv':Iconv},this[_0x85db('0x38')][_0x85db('0x13')](this));};EmailImap['prototype'][_0x85db('0x35')]=function(_0x22c246){};EmailImap[_0x85db('0x16')][_0x85db('0x36')]=function(){};EmailImap['prototype'][_0x85db('0x38')]=function(_0x31d169,_0x3591f9){if(_0x31d169){logger[_0x85db('0x2f')](_0x31d169);}else{var _0x5a759d=this;utils['parser'](this['account'],_0x3591f9,function(_0x5d7c2e){_0x5a759d['emit'](_0x85db('0x25'),_0x5d7c2e);});}};EmailImap[_0x85db('0x16')][_0x85db('0x31')]=function(){this[_0x85db('0x2')][_0x85db('0x32')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x85db('0x16')]['handleFetchError']=function(_0x9f2d7f){this[_0x85db('0x12')](_0x9f2d7f);this['imap']['closeBox'](!![],this[_0x85db('0x33')][_0x85db('0x13')](this));};EmailImap[_0x85db('0x16')][_0x85db('0x11')]=function(){this[_0x85db('0x39')]('end');};EmailImap[_0x85db('0x16')][_0x85db('0x12')]=function(_0x115720,_0x5be721){logger['error']('handleError',this[_0x85db('0xc')][_0x85db('0x25')],JSON[_0x85db('0x3a')](_0x115720));var _0x57677d='';if(_0x115720){if(_0x115720['textCode']){_0x57677d=_0x115720[_0x85db('0x3b')];}else{for(var _0x48f3ae in _0x115720){if(_0x115720[_0x85db('0x3c')](_0x48f3ae)){_0x57677d+=_[_0x85db('0x3d')](_0x48f3ae)+':\x20'+_0x115720[_0x48f3ae]+'\x0a';}}}}if(_0x5be721){this[_0x85db('0x2')]['end']();}else{this[_0x85db('0x39')](_0x85db('0x2f'),_0x57677d);this[_0x85db('0x39')](_0x85db('0x10'));}};module[_0x85db('0x3e')]=EmailImap; \ No newline at end of file +var _0xb18e=['length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','exports','imap','randomstring','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','handleEnd','error','connect','inherits','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','getHost','anonymous@xcally.com','prototype','openBox','handleError','emit','box','handleCloseBox','end','handleReadUnseen'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xb18e,0x181));var _0xeb18=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0xb18e[_0x4bd06e];return _0x85ebb;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var Imap=require(_0xeb18('0x0'));var _=require('lodash');var rs=require(_0xeb18('0x1'));var simpleParser=require('mailparser')[_0xeb18('0x2')];var Iconv=require(_0xeb18('0x3'))['Iconv'];var EventEmitter=require(_0xeb18('0x4'))[_0xeb18('0x5')];var utils=require(_0xeb18('0x6'));var logger=require(_0xeb18('0x7'))(_0xeb18('0x8'));function EmailImap(_0x183bdf,_0x4a9ddd){this[_0xeb18('0x9')]=_0xeb18('0xa');this['account']=this[_0xeb18('0xb')](_0x183bdf,_0x4a9ddd);this[_0xeb18('0x0')]=new Imap(this[_0xeb18('0xc')]);this[_0xeb18('0x0')][_0xeb18('0xd')](_0xeb18('0xe'),this[_0xeb18('0xf')][_0xeb18('0x10')](this));this[_0xeb18('0x0')][_0xeb18('0xd')]('end',this[_0xeb18('0x11')][_0xeb18('0x10')](this));this['imap']['on'](_0xeb18('0x12'),this['handleError']['bind'](this));this[_0xeb18('0x0')][_0xeb18('0x13')]();}util[_0xeb18('0x14')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x1f1728,_0x34a412){var _0x570517={'connTimeout':_0x1f1728[_0xeb18('0x15')]?_0x1f1728[_0xeb18('0x15')]*0x3e8:0x2710,'authTimeout':_0x1f1728[_0xeb18('0x16')]?_0x1f1728['authTimeout']*0x3e8:0x1388};if(_[_0xeb18('0x17')](_0x1f1728[_0xeb18('0x18')])){if(_0x1f1728[_0xeb18('0x19')]){_0x570517[_0xeb18('0x1a')]=_0x1f1728[_0xeb18('0x1a')];_0x570517[_0xeb18('0x1b')]=_0x1f1728[_0xeb18('0x1b')];}_0x570517['host']=_0x1f1728[_0xeb18('0x1c')];_0x570517['port']=_0x1f1728[_0xeb18('0x1d')]||0x3e1;if(_0x1f1728[_0xeb18('0x1e')]){_0x570517[_0xeb18('0x1e')]=!![];}else{_0x570517[_0xeb18('0x1e')]=![];_0x570517[_0xeb18('0x1f')]='required';}}else{_0x570517[_0xeb18('0x1a')]=_0x1f1728[_0xeb18('0x1a')];_0x570517[_0xeb18('0x1b')]=_0x1f1728[_0xeb18('0x1b')];_0x570517['host']=utils[_0xeb18('0x20')](_0x1f1728[_0xeb18('0x18')]);_0x570517[_0xeb18('0x1d')]=0x3e1;_0x570517[_0xeb18('0x1e')]=!![];}_0x570517[_0xeb18('0x8')]=_0x34a412||_0x1f1728[_0xeb18('0x1a')]||_0xeb18('0x21');return _0x570517;};EmailImap[_0xeb18('0x22')][_0xeb18('0xf')]=function(){this[_0xeb18('0x0')][_0xeb18('0x23')](this[_0xeb18('0x9')],![],this['handleOpenBox'][_0xeb18('0x10')](this));};EmailImap['prototype']['handleOpenBox']=function(_0x41453e,_0x42ae48){if(_0x41453e){this[_0xeb18('0x24')](_0x41453e,!![]);}else{this[_0xeb18('0x25')](_0xeb18('0x26'),_0x42ae48);this['readUnseen']();}};EmailImap['prototype'][_0xeb18('0x27')]=function(_0x8dc2a4){if(_0x8dc2a4){this[_0xeb18('0x24')](_0x8dc2a4,!![]);}else{this['imap'][_0xeb18('0x28')]();}};EmailImap[_0xeb18('0x22')]['readUnseen']=function(){this[_0xeb18('0x0')]['search'](['UNSEEN'],this['handleReadUnseen']['bind'](this));};EmailImap['prototype'][_0xeb18('0x29')]=function(_0x29a152,_0x27455b){if(_0x29a152){this[_0xeb18('0x24')](_0x29a152,!![]);}else{if(_0x27455b[_0xeb18('0x2a')]){try{var _0x8b7a1b=this['imap'][_0xeb18('0x2b')](_0x27455b,{'bodies':'','markSeen':!![]});_0x8b7a1b['on'](_0xeb18('0x2c'),this[_0xeb18('0x2d')][_0xeb18('0x10')](this));_0x8b7a1b[_0xeb18('0xd')](_0xeb18('0x12'),this[_0xeb18('0x2e')][_0xeb18('0x10')](this));_0x8b7a1b['once'](_0xeb18('0x28'),this[_0xeb18('0x2f')][_0xeb18('0x10')](this));}catch(_0x938680){logger[_0xeb18('0x12')](_0x938680);}}else{this[_0xeb18('0x0')][_0xeb18('0x30')](!![],this['handleCloseBox'][_0xeb18('0x10')](this));}}};EmailImap['prototype'][_0xeb18('0x2d')]=function(_0x1e08f1,_0x64814c){_0x1e08f1['on'](_0xeb18('0x31'),this['handleMessageBody'][_0xeb18('0x10')](this));_0x1e08f1[_0xeb18('0xd')](_0xeb18('0x32'),this[_0xeb18('0x33')][_0xeb18('0x10')](this));_0x1e08f1[_0xeb18('0xd')]('end',this[_0xeb18('0x34')][_0xeb18('0x10')](this));};EmailImap[_0xeb18('0x22')][_0xeb18('0x35')]=function(_0x2c1473,_0x3469b1){simpleParser(_0x2c1473,{'Iconv':Iconv},this[_0xeb18('0x36')][_0xeb18('0x10')](this));};EmailImap[_0xeb18('0x22')][_0xeb18('0x33')]=function(_0x3f2e53){};EmailImap[_0xeb18('0x22')]['handleMessageEnd']=function(){};EmailImap[_0xeb18('0x22')][_0xeb18('0x36')]=function(_0x89377,_0x4634e9){if(_0x89377){logger[_0xeb18('0x12')](_0x89377);}else{var _0x5ef16b=this;utils[_0xeb18('0x37')](this[_0xeb18('0xc')],_0x4634e9,function(_0x377a7b){_0x5ef16b[_0xeb18('0x25')](_0xeb18('0x8'),_0x377a7b);});}};EmailImap['prototype'][_0xeb18('0x2f')]=function(){this['imap'][_0xeb18('0x30')](!![],this[_0xeb18('0x27')][_0xeb18('0x10')](this));};EmailImap[_0xeb18('0x22')][_0xeb18('0x2e')]=function(_0x4e517d){this[_0xeb18('0x24')](_0x4e517d);this[_0xeb18('0x0')][_0xeb18('0x30')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xeb18('0x22')][_0xeb18('0x11')]=function(){this[_0xeb18('0x25')](_0xeb18('0x28'));};EmailImap[_0xeb18('0x22')]['handleError']=function(_0x5189d3,_0x4a9a7b){logger[_0xeb18('0x12')](_0xeb18('0x24'),this[_0xeb18('0xc')]['email'],JSON[_0xeb18('0x38')](_0x5189d3));var _0xc5e91a='';if(_0x5189d3){if(_0x5189d3[_0xeb18('0x39')]){_0xc5e91a=_0x5189d3[_0xeb18('0x39')];}else{for(var _0x989ae4 in _0x5189d3){if(_0x5189d3[_0xeb18('0x3a')](_0x989ae4)){_0xc5e91a+=_[_0xeb18('0x3b')](_0x989ae4)+':\x20'+_0x5189d3[_0x989ae4]+'\x0a';}}}}if(_0x4a9a7b){this['imap'][_0xeb18('0x28')]();}else{this[_0xeb18('0x25')](_0xeb18('0x12'),_0xc5e91a);this[_0xeb18('0x25')](_0xeb18('0x28'));}};module[_0xeb18('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 16d193a..d82984b 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 _0x1c35=['Not\x20verifired','exports','bluebird','prototype','send','createTransport','use','compile','sendMail','toString','verify'];(function(_0x1c42cb,_0x4db886){var _0x3d65de=function(_0x5a4b69){while(--_0x5a4b69){_0x1c42cb['push'](_0x1c42cb['shift']());}};_0x3d65de(++_0x4db886);}(_0x1c35,0x120));var _0x51c3=function(_0x1fd91c,_0x46019e){_0x1fd91c=_0x1fd91c-0x0;var _0x3d2f02=_0x1c35[_0x1fd91c];return _0x3d2f02;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x51c3('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x51c3('0x1')][_0x51c3('0x2')]=function(_0x21e0fa,_0x49117b){return new BPromise(function(_0x5507bf,_0x376070){var _0x1399b5=nodemailer[_0x51c3('0x3')](_0x21e0fa);_0x1399b5[_0x51c3('0x4')](_0x51c3('0x5'),inlineBase64());_0x1399b5[_0x51c3('0x6')](_0x49117b,function(_0x32551f,_0x4057f7){if(_0x32551f){_0x376070(_0x32551f[_0x51c3('0x7')]());}else{_0x5507bf(_0x4057f7);}});});};EmailSmtp[_0x51c3('0x1')][_0x51c3('0x8')]=function(_0x2f034d){return new BPromise(function(_0x3926b8,_0x823082){var _0x104019=nodemailer[_0x51c3('0x3')](_0x2f034d);_0x104019[_0x51c3('0x8')](function(_0x39edf1,_0x46e13e){if(_0x39edf1){_0x823082(_0x39edf1[_0x51c3('0x7')]());}else{if(_0x46e13e){_0x3926b8(_0x46e13e);}else{_0x823082(_0x51c3('0x9'));}}});});};module[_0x51c3('0xa')]=EmailSmtp; \ No newline at end of file +var _0xcf2b=['createTransport','exports','bluebird','nodemailer-plugin-inline-base64','send','compile','sendMail','toString','prototype','verify'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0xcf2b,0x156));var _0xbcf2=function(_0x291d3f,_0x3ef99f){_0x291d3f=_0x291d3f-0x0;var _0x242080=_0xcf2b[_0x291d3f];return _0x242080;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xbcf2('0x0'));var inlineBase64=require(_0xbcf2('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0xbcf2('0x2')]=function(_0x5dbb27,_0x495f5a){return new BPromise(function(_0x594dee,_0x53eb75){var _0x23f683=nodemailer['createTransport'](_0x5dbb27);_0x23f683['use'](_0xbcf2('0x3'),inlineBase64());_0x23f683[_0xbcf2('0x4')](_0x495f5a,function(_0x49df6e,_0x1a2447){if(_0x49df6e){_0x53eb75(_0x49df6e[_0xbcf2('0x5')]());}else{_0x594dee(_0x1a2447);}});});};EmailSmtp[_0xbcf2('0x6')][_0xbcf2('0x7')]=function(_0x25b352){return new BPromise(function(_0x80deff,_0x9bd5c7){var _0x23bd87=nodemailer[_0xbcf2('0x8')](_0x25b352);_0x23bd87[_0xbcf2('0x7')](function(_0x4245a0,_0x12c7f6){if(_0x4245a0){_0x9bd5c7(_0x4245a0['toString']());}else{if(_0x12c7f6){_0x80deff(_0x12c7f6);}else{_0x9bd5c7('Not\x20verifired');}}});});};module[_0xbcf2('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 71b34aa..2e07016 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 _0x065e=['YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','content','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','util','node-tnef','../../../config/logger','value','address','generate','head','name','split','length','slice','join','pop','anonymous','html','test','replace','includes','0x1?_0x3aa3be[_0xe065('0xd')]():'';}return'';}function getMails(_0x541985,_0x3d3557){var _0x2b4789='';for(var _0x15d365=0x0;_0x15d365<_0x3d3557[_0xe065('0x4')][_0xe065('0xa')];_0x15d365+=0x1){if(_0x3d3557[_0xe065('0x4')][_0x15d365][_0xe065('0x5')]!==_0x541985){if(!_['isEmpty'](_0x2b4789)){_0x2b4789+=',';}_0x2b4789+=_0x3d3557[_0xe065('0x4')][_0x15d365][_0xe065('0x8')]||_0x3d3557['value'][_0x15d365][_0xe065('0x5')]||'';_0x2b4789+='\x20<';_0x2b4789+=_0x3d3557[_0xe065('0x4')][_0x15d365][_0xe065('0x5')]?_0x3d3557[_0xe065('0x4')][_0x15d365][_0xe065('0x5')]:_0xe065('0xe')+random[_0xe065('0x6')](0x6)+'@xcally.com';_0x2b4789+='>';}}return _0x2b4789;}function parseEmail(_0x45479e,_0x52e9b2,_0x2df517){if(_0x52e9b2[_0xe065('0xf')]){var _0x55f55c=/)<[^<]*)*<\/script>/gi;while(_0x55f55c[_0xe065('0x10')](_0x52e9b2['html'])){_0x52e9b2[_0xe065('0xf')]=_0x52e9b2[_0xe065('0xf')][_0xe065('0x11')](_0x55f55c,'');}if(_0x52e9b2[_0xe065('0xf')][_0xe065('0x12')](_0xe065('0x13'))){var _0x22a0cb=[];_0x52e9b2[_0xe065('0x14')][_0xe065('0x15')](_0x5081a3=>{_0x22a0cb[_0xe065('0x16')](_0x5081a3[_0xe065('0x17')]);});var _0x44ec95=/]+>/g;var _0x13f6e5=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x5e8b60=_0x52e9b2['html'][_0xe065('0x11')](_0x13f6e5,'_SRC');var _0x14e6b6=_0x5e8b60[_0xe065('0x11')](_0x44ec95,_0xe065('0x18'));for(let _0x15b598=0x0;_0x15b598<_0x22a0cb[_0xe065('0xa')];_0x15b598++){var _0x3ec154=_0x14e6b6[_0xe065('0x11')](_0xe065('0x18'),'\x20[Attachment:\x20'+_0x22a0cb[_0x15b598]+'\x20]');_0x14e6b6=_0x3ec154;}_0x52e9b2[_0xe065('0xf')]=_0x14e6b6;}_0x2df517[_0xe065('0x19')]=_0x52e9b2[_0xe065('0xf')];}else{_0x2df517[_0xe065('0x19')]=_0x52e9b2['textAsHtml'];}if(_0x2df517[_0xe065('0x19')]){_0x2df517['body']=_0x2df517['body'][_0xe065('0x11')](/Empty\x20message

','getHost','yahoo','imap.mail.yahoo.com','hotmail','outlook365','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','name','split','length','slice','join','pop','anonymous','@xcally.com','html','test','includes','\x20[Attachment:\x20','\x20]','body','0x1?_0x3fa7c4[_0xc5fd('0x11')]():'';}return'';}function getMails(_0xa7a954,_0x51233a){var _0x124651='';for(var _0x103c3d=0x0;_0x103c3d<_0x51233a[_0xc5fd('0xa')][_0xc5fd('0xe')];_0x103c3d+=0x1){if(_0x51233a['value'][_0x103c3d]['address']!==_0xa7a954){if(!_['isEmpty'](_0x124651)){_0x124651+=',';}_0x124651+=_0x51233a['value'][_0x103c3d]['name']||_0x51233a[_0xc5fd('0xa')][_0x103c3d][_0xc5fd('0xb')]||'';_0x124651+='\x20<';_0x124651+=_0x51233a[_0xc5fd('0xa')][_0x103c3d][_0xc5fd('0xb')]?_0x51233a[_0xc5fd('0xa')][_0x103c3d][_0xc5fd('0xb')]:_0xc5fd('0x12')+random['generate'](0x6)+_0xc5fd('0x13');_0x124651+='>';}}return _0x124651;}function parseEmail(_0x27bda1,_0x32eac2,_0x9c12e4){if(_0x32eac2[_0xc5fd('0x14')]){var _0x48024e=/)<[^<]*)*<\/script>/gi;while(_0x48024e[_0xc5fd('0x15')](_0x32eac2[_0xc5fd('0x14')])){_0x32eac2[_0xc5fd('0x14')]=_0x32eac2[_0xc5fd('0x14')]['replace'](_0x48024e,'');}if(_0x32eac2['html'][_0xc5fd('0x16')](_0xc5fd('0x17'))){var _0x3d7211=[];_0x32eac2[_0xc5fd('0x18')][_0xc5fd('0x19')](_0x311952=>{_0x3d7211['push'](_0x311952[_0xc5fd('0x1a')]);});var _0x2701f7=/]+>/g;var _0x1a5174=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x18c9c7=_0x32eac2[_0xc5fd('0x14')][_0xc5fd('0x1b')](_0x1a5174,_0xc5fd('0x1c'));var _0x527018=_0x18c9c7[_0xc5fd('0x1b')](_0x2701f7,'_IMG');for(let _0x2ee700=0x0;_0x2ee700<_0x3d7211[_0xc5fd('0xe')];_0x2ee700++){var _0x44681d=_0x527018[_0xc5fd('0x1b')]('_IMG',_0xc5fd('0x1d')+_0x3d7211[_0x2ee700]+_0xc5fd('0x1e'));_0x527018=_0x44681d;}_0x32eac2[_0xc5fd('0x14')]=_0x527018;}_0x9c12e4[_0xc5fd('0x1f')]=_0x32eac2[_0xc5fd('0x14')];}else{_0x9c12e4[_0xc5fd('0x1f')]=_0x32eac2['textAsHtml'];}if(_0x9c12e4[_0xc5fd('0x1f')]){_0x9c12e4['body']=_0x9c12e4['body'][_0xc5fd('0x1b')](/Empty\x20message

';if(_0x2b98a9[_0xc5fd('0x38')]){for(var _0x74a071=0x0;_0x74a071<_0x2b98a9['Attachments']['length'];_0x74a071++){var _0x3b7cf1=_0x2b98a9['Attachments'][_0x74a071];_0x47fe66['message']['attachments'][_0xc5fd('0x39')]({'filename':_0x3b7cf1[_0xc5fd('0x3a')],'content':new Buffer(_0x3b7cf1[_0xc5fd('0x3b')])});}}}_0x559ec4(parseEmail(_0x2a368e,_0x5d3fce,_0x47fe66));});}else{_0x5d3fce[_0xc5fd('0x14')]=_0xc5fd('0x3c');_0x559ec4(parseEmail(_0x2a368e,_0x5d3fce,_0x47fe66));}}else{_0x559ec4(parseEmail(_0x2a368e,_0x5d3fce,_0x47fe66));}};exports[_0xc5fd('0x3d')]=function(_0x480011){switch(_0x480011){case'gmail':return'imap.gmail.com';case _0xc5fd('0x3e'):return _0xc5fd('0x3f');case _0xc5fd('0x40'):return'imap-mail.outlook.com';case _0xc5fd('0x41'):return'outlook.office365.com';}return _0xc5fd('0x42');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 40a6cde..23c7c8a 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b1e=['Imap','Smtp','exports','lodash','name','Service','key','active'];(function(_0x529cce,_0x56c368){var _0x190a0c=function(_0x5c94e1){while(--_0x5c94e1){_0x529cce['push'](_0x529cce['shift']());}};_0x190a0c(++_0x56c368);}(_0x3b1e,0x193));var _0xe3b1=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x3b1e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe3b1('0x0'));function MailAccount(_0x18ecfd){this['id']=_0x18ecfd['id']||0x0;this[_0xe3b1('0x1')]=_0x18ecfd['name']||_0xe3b1('0x2');this[_0xe3b1('0x3')]=_0x18ecfd[_0xe3b1('0x3')]||'SERV';this['active']=_0x18ecfd[_0xe3b1('0x4')]||![];this[_0xe3b1('0x5')]=_0x18ecfd['Imap']||[];this[_0xe3b1('0x6')]=_0x18ecfd['Smtp']||[];}module[_0xe3b1('0x7')]=MailAccount; \ No newline at end of file +var _0x72f4=['name','Service','key','SERV','active','Imap'];(function(_0x11e28d,_0x4a0686){var _0x1a8314=function(_0x5873d9){while(--_0x5873d9){_0x11e28d['push'](_0x11e28d['shift']());}};_0x1a8314(++_0x4a0686);}(_0x72f4,0x198));var _0x472f=function(_0x1e929b,_0x6afcb5){_0x1e929b=_0x1e929b-0x0;var _0x3df713=_0x72f4[_0x1e929b];return _0x3df713;};'use strict';var _=require('lodash');function MailAccount(_0x36457f){this['id']=_0x36457f['id']||0x0;this[_0x472f('0x0')]=_0x36457f[_0x472f('0x0')]||_0x472f('0x1');this[_0x472f('0x2')]=_0x36457f['key']||_0x472f('0x3');this[_0x472f('0x4')]=_0x36457f[_0x472f('0x4')]||![];this[_0x472f('0x5')]=_0x36457f[_0x472f('0x5')]||[];this['Smtp']=_0x36457f['Smtp']||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 99fbbf4..65ef53e 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0aa9=['prototype','initMailAccounts','length','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase'];(function(_0x5047e3,_0x49774d){var _0x59beb0=function(_0x12d7e0){while(--_0x12d7e0){_0x5047e3['push'](_0x5047e3['shift']());}};_0x59beb0(++_0x49774d);}(_0x0aa9,0x68));var _0x90aa=function(_0xee209,_0x4858f4){_0xee209=_0xee209-0x0;var _0x48cd8c=_0x0aa9[_0xee209];return _0x48cd8c;};'use strict';var _=require(_0x90aa('0x0'));var MailAccount=require(_0x90aa('0x1'));var Realtime=function(){this[_0x90aa('0x2')]={};};function freeIsNotKey(_0x3027d6,_0x4e02cd,_0x26b632){var _0x41ef27=_[_0x90aa('0x3')](_0x3027d6,function(_0xdc8ec4,_0x229ee8){return _0xdc8ec4[_0x26b632];});for(var _0x38e055 in _0x4e02cd){if(_0x4e02cd[_0x90aa('0x4')](_0x38e055)){if(!_0x41ef27[_0x38e055]){delete _0x4e02cd[_0x38e055];}}}}Realtime['prototype'][_0x90aa('0x5')]=function(_0x5c453a,_0x19f096){for(var _0x2fa544 in _0x19f096){if(_0x5c453a[_0x90aa('0x4')](_0x2fa544)){_0x5c453a[_0x2fa544]=_0x19f096[_0x2fa544];}}};Realtime[_0x90aa('0x6')][_0x90aa('0x7')]=function(){var _0x4ea49c=this;return function(_0x3a2ee7){if(_0x3a2ee7){freeIsNotKey(_0x3a2ee7,_0x4ea49c[_0x90aa('0x2')],'id');for(var _0x37311d=0x0,_0x1b1cfb={},_0x465d60={};_0x37311d<_0x3a2ee7[_0x90aa('0x8')];_0x37311d+=0x1){_0x1b1cfb=_0x3a2ee7[_0x37311d];if(_['isUndefined'](_0x4ea49c[_0x90aa('0x2')][_0x1b1cfb['id']])){_0x4ea49c[_0x90aa('0x2')][_0x1b1cfb['id']]=new MailAccount(_0x1b1cfb);}else{_[_0x90aa('0x9')](_0x4ea49c[_0x90aa('0x2')][_0x1b1cfb['id']],_0x1b1cfb);}}}return _0x4ea49c['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file +var _0xe7f9=['hasOwnProperty','prototype','initMailAccounts','isUndefined','mailAccounts','merge','lodash','mapKeys'];(function(_0x388fd8,_0x49dc3b){var _0x4bb914=function(_0x510790){while(--_0x510790){_0x388fd8['push'](_0x388fd8['shift']());}};_0x4bb914(++_0x49dc3b);}(_0xe7f9,0x86));var _0x9e7f=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0xe7f9[_0x2272b5];return _0x110156;};'use strict';var _=require(_0x9e7f('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x1128c2,_0xa2a83e,_0x40de58){var _0x2d9f39=_[_0x9e7f('0x1')](_0x1128c2,function(_0x42265b,_0x20ae13){return _0x42265b[_0x40de58];});for(var _0x2407f7 in _0xa2a83e){if(_0xa2a83e[_0x9e7f('0x2')](_0x2407f7)){if(!_0x2d9f39[_0x2407f7]){delete _0xa2a83e[_0x2407f7];}}}}Realtime[_0x9e7f('0x3')]['mergeFromDatabase']=function(_0xfe9cb0,_0x22ca79){for(var _0x2ed1ca in _0x22ca79){if(_0xfe9cb0['hasOwnProperty'](_0x2ed1ca)){_0xfe9cb0[_0x2ed1ca]=_0x22ca79[_0x2ed1ca];}}};Realtime[_0x9e7f('0x3')][_0x9e7f('0x4')]=function(){var _0x44c9e3=this;return function(_0x5c4d98){if(_0x5c4d98){freeIsNotKey(_0x5c4d98,_0x44c9e3['mailAccounts'],'id');for(var _0x221f4f=0x0,_0xfde4bd={},_0x1fb196={};_0x221f4f<_0x5c4d98['length'];_0x221f4f+=0x1){_0xfde4bd=_0x5c4d98[_0x221f4f];if(_[_0x9e7f('0x5')](_0x44c9e3[_0x9e7f('0x6')][_0xfde4bd['id']])){_0x44c9e3['mailAccounts'][_0xfde4bd['id']]=new MailAccount(_0xfde4bd);}else{_[_0x9e7f('0x7')](_0x44c9e3['mailAccounts'][_0xfde4bd['id']],_0xfde4bd);}}}return _0x44c9e3['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 9ff469d..ae0d12d 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9264=['GetMailAccount','email','ListId','MailServerOut','Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x512271,_0xcc905e){var _0x9c6681=function(_0x127778){while(--_0x127778){_0x512271['push'](_0x512271['shift']());}};_0x9c6681(++_0xcc905e);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x4926('0x0'));exports[_0x4926('0x1')]=function(){return function(){return client[_0x4926('0x2')](_0x4926('0x3'),{'options':{'attributes':['id','name','service',_0x4926('0x4'),'active','key',_0x4926('0x5'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':'Imap'},{'model':_0x4926('0x6'),'as':_0x4926('0x7')}]},'log':'getMailAccount'});};};exports[_0x4926('0x8')]=function(_0x2f5445,_0x4da9b6){return client[_0x4926('0x2')](_0x4926('0x9'),{'account':{'id':_0x2f5445},'body':_0x4da9b6,'log':_0x4926('0x9')});}; \ No newline at end of file +var _0x6be2=['Imap','Smtp','getMailAccount','NotifyMailAccount','getMailAccounts','Request','GetMailAccount','email','active','key','TemplateId','MailServerIn'];(function(_0x3b5250,_0x7a0b2c){var _0xc844a1=function(_0x2fbc98){while(--_0x2fbc98){_0x3b5250['push'](_0x3b5250['shift']());}};_0xc844a1(++_0x7a0b2c);}(_0x6be2,0x1cc));var _0x26be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6be2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x26be('0x0')]=function(){return function(){return client[_0x26be('0x1')](_0x26be('0x2'),{'options':{'attributes':['id','name','service',_0x26be('0x3'),_0x26be('0x4'),_0x26be('0x5'),'ListId',_0x26be('0x6')],'raw':![],'include':[{'model':_0x26be('0x7'),'as':_0x26be('0x8')},{'model':'MailServerOut','as':_0x26be('0x9')}]},'log':_0x26be('0xa')});};};exports['notify']=function(_0x127894,_0x47ffc7){return client[_0x26be('0x1')]('NotifyMailAccount',{'account':{'id':_0x127894},'body':_0x47ffc7,'log':_0x26be('0xb')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 17c9b1a..0ab6989 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c17=['ShowSetting','../client','getSettings','Request'];(function(_0xbc2678,_0x4b0e5f){var _0x43280c=function(_0x1f3ac7){while(--_0x1f3ac7){_0xbc2678['push'](_0xbc2678['shift']());}};_0x43280c(++_0x4b0e5f);}(_0x3c17,0x13d));var _0x73c1=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x3c17[_0x4e1d03];return _0x362d4b;};'use strict';var client=require(_0x73c1('0x0'));exports[_0x73c1('0x1')]=function(){return client[_0x73c1('0x2')](_0x73c1('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':'GetSettings'});}; \ No newline at end of file +var _0xf9c6=['loginMailFrequency','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x1ba097,_0x17c590){var _0x43d2cd=function(_0x43fa98){while(--_0x43fa98){_0x1ba097['push'](_0x1ba097['shift']());}};_0x43d2cd(++_0x17c590);}(_0xf9c6,0x1a6));var _0x6f9c=function(_0x4d1b3a,_0x4bdc68){_0x4d1b3a=_0x4d1b3a-0x0;var _0x4c5d54=_0xf9c6[_0x4d1b3a];return _0x4c5d54;};'use strict';var client=require(_0x6f9c('0x0'));exports[_0x6f9c('0x1')]=function(){return client[_0x6f9c('0x2')](_0x6f9c('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6f9c('0x4')]},'log':_0x6f9c('0x5')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 9e5f208..3377e7b 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index b23e912..3841cb7 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x253b=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once'];(function(_0x41b69b,_0x429f1e){var _0x532d95=function(_0x4446bc){while(--_0x4446bc){_0x41b69b['push'](_0x41b69b['shift']());}};_0x532d95(++_0x429f1e);}(_0x253b,0x67));var _0xb253=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x253b[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xb253('0x0'));var http=require(_0xb253('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0xb253('0x2'));var config=require(_0xb253('0x3'));var app=express();var server=http[_0xb253('0x4')](app);server[_0xb253('0x5')]=0xdbba0;if(sticky[_0xb253('0x6')](server,config[_0xb253('0x7')])){var socketio=require(_0xb253('0x8'))(server,{'transports':[_0xb253('0x9'),_0xb253('0xa')]});config[_0xb253('0xb')]=_[_0xb253('0xc')](config[_0xb253('0xb')],{'host':_0xb253('0xd'),'port':0x18eb});socketio[_0xb253('0xe')](require(_0xb253('0xf'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require(_0xb253('0x10'))[_0xb253('0x11')]();require(_0xb253('0x12'))[_0xb253('0x11')](socketio);require(_0xb253('0x13'))['default'](app);require(_0xb253('0x14'))['default'](app);}else{server[_0xb253('0x15')]('listening',function(){console[_0xb253('0x16')](_0xb253('0x17'),config[_0xb253('0x7')]);});}exports=module[_0xb253('0x18')]=app; \ No newline at end of file +var _0xee8d=['defaults','adapter','default','../../config/socketio','../../config/express','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','ioredis','../../config/environment','createServer','timeout','listen','port','websocket','polling','redis'];(function(_0x619fcc,_0x3bd756){var _0x4737a6=function(_0x49311c){while(--_0x49311c){_0x619fcc['push'](_0x619fcc['shift']());}};_0x4737a6(++_0x3bd756);}(_0xee8d,0x73));var _0xdee8=function(_0x2d4658,_0x2f542e){_0x2d4658=_0x2d4658-0x0;var _0x206226=_0xee8d[_0x2d4658];return _0x206226;};'use strict';var _=require(_0xdee8('0x0'));var http=require(_0xdee8('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0xdee8('0x2'));var config=require(_0xdee8('0x3'));var app=express();var server=http[_0xdee8('0x4')](app);server[_0xdee8('0x5')]=0xdbba0;if(sticky[_0xdee8('0x6')](server,config[_0xdee8('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0xdee8('0x8'),_0xdee8('0x9')]});config[_0xdee8('0xa')]=_[_0xdee8('0xb')](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0xdee8('0xc')](require('socket.io-redis')({'pubClient':new Redis(config[_0xdee8('0xa')]),'subClient':new Redis(config[_0xdee8('0xa')])}));require('../../config/triggers')[_0xdee8('0xd')]();require(_0xdee8('0xe'))[_0xdee8('0xd')](socketio);require(_0xdee8('0xf'))['default'](app);require('../../routes')[_0xdee8('0xd')](app);}else{server[_0xdee8('0x10')](_0xdee8('0x11'),function(){console[_0xdee8('0x12')](_0xdee8('0x13'),config[_0xdee8('0x7')]);});}exports=module[_0xdee8('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 95d0b4f..30068fe 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc177=['exports','jayson/promise','../../config/logger','http','Request','request','then','debug','routing','error','rpc','message','catch'];(function(_0x31f695,_0x39bb8b){var _0x32789d=function(_0x5edceb){while(--_0x5edceb){_0x31f695['push'](_0x31f695['shift']());}};_0x32789d(++_0x39bb8b);}(_0xc177,0x194));var _0x7c17=function(_0x38f3ef,_0x9aeffd){_0x38f3ef=_0x38f3ef-0x0;var _0x521238=_0xc177[_0x38f3ef];return _0x521238;};'use strict';var jayson=require(_0x7c17('0x0'));var BPromise=require('bluebird');var logger=require(_0x7c17('0x1'))('routing');var client=jayson['client'][_0x7c17('0x2')]({'port':0x2329});client[_0x7c17('0x3')]=function(_0xfcef5f,_0x1b756a){return new BPromise(function(_0x1f7ab7,_0x504e28){return client[_0x7c17('0x4')](_0xfcef5f,_0x1b756a)[_0x7c17('0x5')](function(_0x5dd4bf){logger[_0x7c17('0x6')]('rpc',_0x7c17('0x7'),_0xfcef5f,_0x1b756a,_0x5dd4bf);if(_0x5dd4bf[_0x7c17('0x8')]){logger[_0x7c17('0x8')](_0x7c17('0x9'),'routing',_0xfcef5f,_0x5dd4bf[_0x7c17('0x8')][_0x7c17('0xa')],_0x1b756a);return _0x504e28(_0x5dd4bf[_0x7c17('0x8')][_0x7c17('0xa')]);}else{return _0x1f7ab7(_0x5dd4bf['result']);}})[_0x7c17('0xb')](function(_0x33a2b2){logger[_0x7c17('0x8')](_0x7c17('0x9'),'routing',_0xfcef5f,_0x33a2b2,_0x1b756a);return _0x504e28(_0x33a2b2);});});};module[_0x7c17('0xc')]=client; \ No newline at end of file +var _0xab10=['catch','exports','jayson/promise','../../config/logger','client','http','request','then','debug','rpc','routing','error','result'];(function(_0x239e65,_0x22ef97){var _0x2aa812=function(_0x5a28a1){while(--_0x5a28a1){_0x239e65['push'](_0x239e65['shift']());}};_0x2aa812(++_0x22ef97);}(_0xab10,0x6a));var _0x0ab1=function(_0x242bd9,_0x32e7fc){_0x242bd9=_0x242bd9-0x0;var _0x1ac777=_0xab10[_0x242bd9];return _0x1ac777;};'use strict';var jayson=require(_0x0ab1('0x0'));var BPromise=require('bluebird');var logger=require(_0x0ab1('0x1'))('routing');var client=jayson[_0x0ab1('0x2')][_0x0ab1('0x3')]({'port':0x2329});client['Request']=function(_0xfe32d3,_0x11f2be){return new BPromise(function(_0x106b18,_0x55d85a){return client[_0x0ab1('0x4')](_0xfe32d3,_0x11f2be)[_0x0ab1('0x5')](function(_0x599139){logger[_0x0ab1('0x6')](_0x0ab1('0x7'),_0x0ab1('0x8'),_0xfe32d3,_0x11f2be,_0x599139);if(_0x599139[_0x0ab1('0x9')]){logger[_0x0ab1('0x9')](_0x0ab1('0x7'),_0x0ab1('0x8'),_0xfe32d3,_0x599139[_0x0ab1('0x9')]['message'],_0x11f2be);return _0x55d85a(_0x599139['error']['message']);}else{return _0x106b18(_0x599139[_0x0ab1('0xa')]);}})[_0x0ab1('0xb')](function(_0x3fecf5){logger[_0x0ab1('0x9')]('rpc',_0x0ab1('0x8'),_0xfe32d3,_0x3fecf5,_0x11f2be);return _0x55d85a(_0x3fecf5);});});};module[_0x0ab1('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index b6cfa3d..d8d6945 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d3b=['./rpc/openchannelQueue','./rpc/smsQueue','./rpc/whatsappQueue','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getMailQueues','initMailQueues','initFaxQueues','initWhatsappQueues','catch','log','bluebird','./server','./realtime'];(function(_0x596723,_0x4d080f){var _0x4488c0=function(_0x59fc09){while(--_0x59fc09){_0x596723['push'](_0x596723['shift']());}};_0x4488c0(++_0x4d080f);}(_0x3d3b,0x12d));var _0xb3d3=function(_0x276221,_0x378da4){_0x276221=_0x276221-0x0;var _0x4fa716=_0x3d3b[_0x276221];return _0x4fa716;};'use strict';var BPromise=require(_0xb3d3('0x0'));var server=require(_0xb3d3('0x1'));var Realtime=require(_0xb3d3('0x2'));var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require(_0xb3d3('0x3'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xb3d3('0x4'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xb3d3('0x5'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0xb3d3('0x6')](user['getAgents']())[_0xb3d3('0x6')](realtime[_0xb3d3('0x7')]())[_0xb3d3('0x6')](interval[_0xb3d3('0x8')]())[_0xb3d3('0x6')](realtime[_0xb3d3('0x9')]())[_0xb3d3('0x6')](openchannelQueue[_0xb3d3('0xa')]())[_0xb3d3('0x6')](realtime[_0xb3d3('0xb')]())[_0xb3d3('0x6')](chatQueue['getChatQueues']())[_0xb3d3('0x6')](realtime[_0xb3d3('0xc')]())[_0xb3d3('0x6')](smsQueue['getSmsQueues']())[_0xb3d3('0x6')](realtime['initSmsQueues']())[_0xb3d3('0x6')](mailQueue[_0xb3d3('0xd')]())[_0xb3d3('0x6')](realtime[_0xb3d3('0xe')]())['then'](faxQueue['getFaxQueues']())[_0xb3d3('0x6')](realtime[_0xb3d3('0xf')]())[_0xb3d3('0x6')](whatsappQueue['getWhatsappQueues']())[_0xb3d3('0x6')](realtime[_0xb3d3('0x10')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xb3d3('0x6')](function(_0x1e12b0){return initRealtime();})['then'](function(_0xe67bea){return setInterval(initRealtime,0x1388);})[_0xb3d3('0x11')](function(_0x3f2bff){console[_0xb3d3('0x12')](_0x3f2bff);});}main(); \ No newline at end of file +var _0x5f52=['initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','log','bluebird','./server','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues'];(function(_0x25cea2,_0x5c1409){var _0x2e336b=function(_0x36c208){while(--_0x36c208){_0x25cea2['push'](_0x25cea2['shift']());}};_0x2e336b(++_0x5c1409);}(_0x5f52,0x192));var _0x25f5=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0x5f52[_0x48b5e0];return _0x4287ea;};'use strict';var BPromise=require(_0x25f5('0x0'));var server=require(_0x25f5('0x1'));var Realtime=require('./realtime');var user=require(_0x25f5('0x2'));var interval=require(_0x25f5('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x25f5('0x4'));var smsQueue=require(_0x25f5('0x5'));var mailQueue=require(_0x25f5('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x25f5('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x25f5('0x8')]()[_0x25f5('0x9')](user[_0x25f5('0xa')]())[_0x25f5('0x9')](realtime['initAgents']())['then'](interval[_0x25f5('0xb')]())[_0x25f5('0x9')](realtime[_0x25f5('0xc')]())[_0x25f5('0x9')](openchannelQueue[_0x25f5('0xd')]())[_0x25f5('0x9')](realtime[_0x25f5('0xe')]())[_0x25f5('0x9')](chatQueue[_0x25f5('0xf')]())[_0x25f5('0x9')](realtime[_0x25f5('0x10')]())[_0x25f5('0x9')](smsQueue[_0x25f5('0x11')]())[_0x25f5('0x9')](realtime[_0x25f5('0x12')]())[_0x25f5('0x9')](mailQueue[_0x25f5('0x13')]())['then'](realtime[_0x25f5('0x14')]())[_0x25f5('0x9')](faxQueue[_0x25f5('0x15')]())[_0x25f5('0x9')](realtime['initFaxQueues']())[_0x25f5('0x9')](whatsappQueue[_0x25f5('0x16')]())['then'](realtime[_0x25f5('0x17')]())[_0x25f5('0x9')](function(){return realtime;});}function main(){return server[_0x25f5('0x18')](realtime)[_0x25f5('0x9')](function(_0xb7966c){return initRealtime();})[_0x25f5('0x9')](function(_0x1183e8){return setInterval(initRealtime,0x1388);})['catch'](function(_0x4b446c){console[_0x25f5('0x19')](_0x4b446c);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index 5dec81f..b2e246a 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x26d4f0,_0x3c1e07){var _0x2468f4=function(_0x2e5ee7){while(--_0x2e5ee7){_0x26d4f0['push'](_0x26d4f0['shift']());}};_0x2468f4(++_0x3c1e07);}(_0x7a54,0x106));var _0x47a5=function(_0x59adc9,_0x16db0a){_0x59adc9=_0x59adc9-0x0;var _0x165bd8=_0x7a54[_0x59adc9];return _0x165bd8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x390b91,_0x2615c1){var _0x4fa770=function(_0x634098){while(--_0x634098){_0x390b91['push'](_0x390b91['shift']());}};_0x4fa770(++_0x2615c1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 77ea817..0fdef14 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc133=['then','error','message','sendMailMessage','SendMail','bluebird','http','request'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xc133,0x11d));var _0x3c13=function(_0xee6388,_0x1604af){_0xee6388=_0xee6388-0x0;var _0x526e08=_0xc133[_0xee6388];return _0x526e08;};'use strict';var BPromise=require(_0x3c13('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3c13('0x1')]({'port':0x232b});function request(_0x211aa2,_0x3c548c){return new BPromise(function(_0x4641ff,_0x35d30d){return client[_0x3c13('0x2')](_0x211aa2,_0x3c548c)[_0x3c13('0x3')](function(_0x1ad3fa){if(_0x1ad3fa[_0x3c13('0x4')]){return _0x35d30d(_0x1ad3fa[_0x3c13('0x4')][_0x3c13('0x5')]);}else{return _0x4641ff(_0x1ad3fa['result']);}})['catch'](function(_0x442c84){return _0x35d30d(_0x442c84);});});}exports[_0x3c13('0x6')]=function(_0x5c8a02,_0x5cf6f7){return request(_0x3c13('0x7'),{'account':_0x5c8a02,'message':_0x5cf6f7});}; \ No newline at end of file +var _0x41d6=['request','error','result','catch','SendMail','bluebird','client','http'];(function(_0x1a4494,_0x1879ec){var _0x37eb3d=function(_0x2858da){while(--_0x2858da){_0x1a4494['push'](_0x1a4494['shift']());}};_0x37eb3d(++_0x1879ec);}(_0x41d6,0x85));var _0x641d=function(_0x57ff3d,_0x551fbd){_0x57ff3d=_0x57ff3d-0x0;var _0xf4ab01=_0x41d6[_0x57ff3d];return _0xf4ab01;};'use strict';var BPromise=require(_0x641d('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x641d('0x1')][_0x641d('0x2')]({'port':0x232b});function request(_0x288a43,_0x93e7df){return new BPromise(function(_0x327e62,_0x552e0e){return client[_0x641d('0x3')](_0x288a43,_0x93e7df)['then'](function(_0x6f2525){if(_0x6f2525[_0x641d('0x4')]){return _0x552e0e(_0x6f2525[_0x641d('0x4')]['message']);}else{return _0x327e62(_0x6f2525[_0x641d('0x5')]);}})[_0x641d('0x6')](function(_0x3b3a0f){return _0x552e0e(_0x3b3a0f);});});}exports['sendMailMessage']=function(_0xd9a8ae,_0x2326c1){return request(_0x641d('0x7'),{'account':_0xd9a8ae,'message':_0x2326c1});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index bca9d74..c3db7fe 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4af8=['socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','md5','prototype','getChannelStatus','Capacity','CurrentCapacity','idle','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','Status','StatusTime','toNumber','format','chatStatusTime','chatCurrentCapacity','faxStatus','smsStatus','smsCurrentCapacity','stringify','user:save','../../../config/environment','redis','defaults'];(function(_0x662e94,_0x172143){var _0x50f1db=function(_0x1dbbbe){while(--_0x1dbbbe){_0x662e94['push'](_0x662e94['shift']());}};_0x50f1db(++_0x172143);}(_0x4af8,0x1ad));var _0x84af=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x4af8[_0x4fc9e6];return _0x551d28;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x84af('0x0'));config[_0x84af('0x1')]=_[_0x84af('0x2')](config[_0x84af('0x1')],{'host':'localhost','port':0x18eb});var io=require(_0x84af('0x3'))(new Redis(config[_0x84af('0x1')]));function Agent(_0x59ad7b){this['id']=_0x59ad7b['id']||0x0;this[_0x84af('0x4')]=_0x59ad7b[_0x84af('0x4')]||'';this['online']=_0x59ad7b[_0x84af('0x5')]||!![];this[_0x84af('0x6')]=_0x59ad7b['voicePause']||![];this['chatPause']=_0x59ad7b[_0x84af('0x7')]||![];this[_0x84af('0x8')]=_0x59ad7b['mailPause']||![];this[_0x84af('0x9')]=_0x59ad7b['faxPause']||![];this[_0x84af('0xa')]=_0x59ad7b[_0x84af('0xa')]||![];this[_0x84af('0xb')]=_0x59ad7b[_0x84af('0xb')]||![];this['chatStatus']=_0x84af('0xc');this['chatStatusTime']=0x0;this[_0x84af('0xd')]=_0x59ad7b[_0x84af('0xd')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x84af('0xe')]=_0x84af('0xc');this[_0x84af('0xf')]=0x0;this[_0x84af('0x10')]=_0x59ad7b['mailCapacity']||0x0;this[_0x84af('0x11')]=0x0;this['faxStatus']=_0x84af('0xc');this[_0x84af('0x12')]=0x0;this['faxCapacity']=_0x59ad7b[_0x84af('0x13')]||0x0;this[_0x84af('0x14')]=0x0;this['smsStatus']=_0x84af('0xc');this['smsStatusTime']=0x0;this[_0x84af('0x15')]=_0x59ad7b[_0x84af('0x15')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0x84af('0xc');this[_0x84af('0x16')]=0x0;this[_0x84af('0x17')]=_0x59ad7b['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x84af('0x18')]=_0x84af('0xc');this[_0x84af('0x19')]=0x0;this[_0x84af('0x1a')]=_0x59ad7b[_0x84af('0x1a')]||0x0;this[_0x84af('0x1b')]=0x0;this[_0x84af('0x1c')]=![];this[_0x84af('0x1d')]=undefined;this[_0x84af('0x1e')]='';this['updateRealtime']();}Agent[_0x84af('0x1f')][_0x84af('0x20')]=function(_0x166aac){if(this[_0x166aac+'CurrentCapacity']>0x0){if(this[_0x166aac+_0x84af('0x21')]>0x0&&this[_0x166aac+_0x84af('0x22')]>=this[_0x166aac+_0x84af('0x21')]){return'maxcapacity';}else{return'working';}}else{return _0x84af('0x23');}};Agent[_0x84af('0x1f')][_0x84af('0x24')]=function(){var _0x24aa07=[_0x84af('0x25'),_0x84af('0x26'),_0x84af('0x27'),_0x84af('0x28'),_0x84af('0x29'),_0x84af('0x2a')];for(var _0x40ca9d=0x0;_0x40ca9d<_0x24aa07['length'];_0x40ca9d+=0x1){var _0xc57a5e=this[_0x84af('0x20')](_0x24aa07[_0x40ca9d]);if(this[_0x24aa07[_0x40ca9d]+_0x84af('0x2b')]!==_0xc57a5e){this[_0x24aa07[_0x40ca9d]+_0x84af('0x2c')]=_[_0x84af('0x2d')](moment()[_0x84af('0x2e')]('x'));}this[_0x24aa07[_0x40ca9d]+_0x84af('0x2b')]=_0xc57a5e;}var _0x4c01e3={'id':this['id'],'name':this[_0x84af('0x4')],'online':this[_0x84af('0x5')],'voicePause':this['voicePause'],'chatPause':this[_0x84af('0x7')],'mailPause':this[_0x84af('0x8')],'smsPause':this[_0x84af('0xa')],'faxPause':this[_0x84af('0x9')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x84af('0x2f')],'chatCapacity':this[_0x84af('0xd')],'chatCurrentCapacity':this[_0x84af('0x30')],'mailStatus':this[_0x84af('0xe')],'mailStatusTime':this[_0x84af('0xf')],'mailCapacity':this[_0x84af('0x10')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x84af('0x31')],'faxStatusTime':this[_0x84af('0x12')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x84af('0x14')],'smsStatus':this[_0x84af('0x32')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x84af('0x33')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x84af('0x16')],'whatsappCapacity':this[_0x84af('0x17')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x84af('0x18')],'openchannelStatusTime':this[_0x84af('0x19')],'openchannelCapacity':this[_0x84af('0x1a')],'openchannelCurrentCapacity':this[_0x84af('0x1b')],'busy':this[_0x84af('0x1c')],'busyQueue':this[_0x84af('0x1d')]};var _0x365650=md5(JSON[_0x84af('0x34')](_0x4c01e3));if(this[_0x84af('0x1e')]!==_0x365650){this[_0x84af('0x1e')]=_0x365650;io['emit'](_0x84af('0x35'),_0x4c01e3);}};module['exports']=Agent; \ No newline at end of file +var _0x5971=['faxCurrentCapacity','smsStatusTime','openchannelStatusTime','stringify','user:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','getChannelStatus','CurrentCapacity','Capacity','working','prototype','mail','chat','sms','whatsapp','length','Status','toNumber','format'];(function(_0x275a40,_0x1e2394){var _0x240e71=function(_0x11c5f5){while(--_0x11c5f5){_0x275a40['push'](_0x275a40['shift']());}};_0x240e71(++_0x1e2394);}(_0x5971,0x75));var _0x1597=function(_0x143422,_0x41db82){_0x143422=_0x143422-0x0;var _0x350ef5=_0x5971[_0x143422];return _0x350ef5;};'use strict';var _=require('lodash');var moment=require('moment');var md5=require(_0x1597('0x0'));var Redis=require(_0x1597('0x1'));var config=require(_0x1597('0x2'));config[_0x1597('0x3')]=_[_0x1597('0x4')](config[_0x1597('0x3')],{'host':_0x1597('0x5'),'port':0x18eb});var io=require(_0x1597('0x6'))(new Redis(config[_0x1597('0x3')]));function Agent(_0x357b5f){this['id']=_0x357b5f['id']||0x0;this[_0x1597('0x7')]=_0x357b5f[_0x1597('0x7')]||'';this[_0x1597('0x8')]=_0x357b5f['online']||!![];this[_0x1597('0x9')]=_0x357b5f['voicePause']||![];this['chatPause']=_0x357b5f[_0x1597('0xa')]||![];this[_0x1597('0xb')]=_0x357b5f['mailPause']||![];this[_0x1597('0xc')]=_0x357b5f['faxPause']||![];this[_0x1597('0xd')]=_0x357b5f[_0x1597('0xd')]||![];this[_0x1597('0xe')]=_0x357b5f[_0x1597('0xe')]||![];this[_0x1597('0xf')]=_0x1597('0x10');this[_0x1597('0x11')]=0x0;this[_0x1597('0x12')]=_0x357b5f[_0x1597('0x12')]||0x0;this[_0x1597('0x13')]=0x0;this[_0x1597('0x14')]=_0x1597('0x10');this[_0x1597('0x15')]=0x0;this['mailCapacity']=_0x357b5f[_0x1597('0x16')]||0x0;this[_0x1597('0x17')]=0x0;this[_0x1597('0x18')]='unknown';this[_0x1597('0x19')]=0x0;this[_0x1597('0x1a')]=_0x357b5f['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x1597('0x1b')]='unknown';this['smsStatusTime']=0x0;this[_0x1597('0x1c')]=_0x357b5f[_0x1597('0x1c')]||0x0;this[_0x1597('0x1d')]=0x0;this[_0x1597('0x1e')]='unknown';this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x357b5f[_0x1597('0x1f')]||0x0;this[_0x1597('0x20')]=0x0;this[_0x1597('0x21')]=_0x1597('0x10');this['openchannelStatusTime']=0x0;this[_0x1597('0x22')]=_0x357b5f[_0x1597('0x22')]||0x0;this[_0x1597('0x23')]=0x0;this[_0x1597('0x24')]=![];this[_0x1597('0x25')]=undefined;this[_0x1597('0x0')]='';this['updateRealtime']();}Agent['prototype'][_0x1597('0x26')]=function(_0x403a50){if(this[_0x403a50+'CurrentCapacity']>0x0){if(this[_0x403a50+'Capacity']>0x0&&this[_0x403a50+_0x1597('0x27')]>=this[_0x403a50+_0x1597('0x28')]){return'maxcapacity';}else{return _0x1597('0x29');}}else{return'idle';}};Agent[_0x1597('0x2a')]['updateRealtime']=function(){var _0x3a250d=[_0x1597('0x2b'),_0x1597('0x2c'),'openchannel','fax',_0x1597('0x2d'),_0x1597('0x2e')];for(var _0xeb33aa=0x0;_0xeb33aa<_0x3a250d[_0x1597('0x2f')];_0xeb33aa+=0x1){var _0x107c68=this[_0x1597('0x26')](_0x3a250d[_0xeb33aa]);if(this[_0x3a250d[_0xeb33aa]+_0x1597('0x30')]!==_0x107c68){this[_0x3a250d[_0xeb33aa]+'StatusTime']=_[_0x1597('0x31')](moment()[_0x1597('0x32')]('x'));}this[_0x3a250d[_0xeb33aa]+_0x1597('0x30')]=_0x107c68;}var _0x38fcba={'id':this['id'],'name':this[_0x1597('0x7')],'online':this[_0x1597('0x8')],'voicePause':this[_0x1597('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0x1597('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0x1597('0xc')],'openchannelPause':this[_0x1597('0xe')],'chatStatus':this[_0x1597('0xf')],'chatStatusTime':this[_0x1597('0x11')],'chatCapacity':this[_0x1597('0x12')],'chatCurrentCapacity':this[_0x1597('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x1597('0x15')],'mailCapacity':this[_0x1597('0x16')],'mailCurrentCapacity':this[_0x1597('0x17')],'faxStatus':this[_0x1597('0x18')],'faxStatusTime':this[_0x1597('0x19')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x1597('0x33')],'smsStatus':this[_0x1597('0x1b')],'smsStatusTime':this[_0x1597('0x34')],'smsCapacity':this[_0x1597('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x1597('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x1597('0x1f')],'whatsappCurrentCapacity':this[_0x1597('0x20')],'openchannelStatus':this[_0x1597('0x21')],'openchannelStatusTime':this[_0x1597('0x35')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x1597('0x24')],'busyQueue':this['busyQueue']};var _0x2f5e08=md5(JSON[_0x1597('0x36')](_0x38fcba));if(this[_0x1597('0x0')]!==_0x2f5e08){this[_0x1597('0x0')]=_0x2f5e08;io['emit'](_0x1597('0x37'),_0x38fcba);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 0c2ed1f..ef126c1 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 _0x94c0=['emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','chatPause','available','waiting','stringify','format','chat:queue:%s'];(function(_0x1f3886,_0x352fdb){var _0x5dcdf7=function(_0x223b72){while(--_0x223b72){_0x1f3886['push'](_0x1f3886['shift']());}};_0x5dcdf7(++_0x352fdb);}(_0x94c0,0x1a6));var _0x094c=function(_0x377d42,_0x9e888){_0x377d42=_0x377d42-0x0;var _0x3676f2=_0x94c0[_0x377d42];return _0x3676f2;};'use strict';var _=require(_0x094c('0x0'));var md5=require(_0x094c('0x1'));var util=require(_0x094c('0x2'));var Redis=require(_0x094c('0x3'));var config=require(_0x094c('0x4'));config[_0x094c('0x5')]=_['defaults'](config[_0x094c('0x5')],{'host':_0x094c('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x094c('0x5')]));function ChatQueue(_0x5d775c){this['id']=_0x5d775c['id']||0x0;this[_0x094c('0x7')]=_0x5d775c['name']||'';this[_0x094c('0x8')]=_0x5d775c['timeout']||0xa;this[_0x094c('0x9')]=_0x5d775c['strategy']||_0x094c('0xa');this['Agents']=_0x5d775c[_0x094c('0xb')];this[_0x094c('0xc')]={};this['waiting']=0x0;this['md5']='';this[_0x094c('0xd')]();this[_0x094c('0xe')]();}ChatQueue[_0x094c('0xf')]['updateRouting']=function(){var _0x942a57=this[_0x094c('0xc')]['_rr'];this[_0x094c('0xc')]=_[_0x094c('0x10')](this[_0x094c('0xb')],'id');this[_0x094c('0xc')][_0x094c('0x11')]=_0x942a57;};ChatQueue[_0x094c('0xf')][_0x094c('0xe')]=function(){this[_0x094c('0x12')]=0x0;this[_0x094c('0x13')]=0x0;for(var _0x56f061=0x0;_0x56f061=0x0?this['available']:0x0;var _0x59f0da={'id':this['id'],'available':this[_0x094c('0x17')],'loggedIn':this[_0x094c('0x12')],'name':this[_0x094c('0x7')],'paused':this[_0x094c('0x13')],'waiting':this[_0x094c('0x18')]};var _0x796c9f=md5(JSON[_0x094c('0x19')](_0x59f0da));if(this[_0x094c('0x1')]!==_0x796c9f){this[_0x094c('0x1')]=_0x796c9f;io['to'](util[_0x094c('0x1a')](_0x094c('0x1b'),_0x59f0da['name']))[_0x094c('0x1c')]('chat_queue:save',_0x59f0da);}};module[_0x094c('0x1d')]=ChatQueue; \ No newline at end of file +var _0x1ecc=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','waiting','stringify','emit','chat_queue:save','md5','util','ioredis','../../../config/environment'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x1ecc,0x1bc));var _0xc1ec=function(_0x46ae5a,_0x2a38d0){_0x46ae5a=_0x46ae5a-0x0;var _0x434986=_0x1ecc[_0x46ae5a];return _0x434986;};'use strict';var _=require('lodash');var md5=require(_0xc1ec('0x0'));var util=require(_0xc1ec('0x1'));var Redis=require(_0xc1ec('0x2'));var config=require(_0xc1ec('0x3'));config[_0xc1ec('0x4')]=_[_0xc1ec('0x5')](config[_0xc1ec('0x4')],{'host':_0xc1ec('0x6'),'port':0x18eb});var io=require(_0xc1ec('0x7'))(new Redis(config[_0xc1ec('0x4')]));function ChatQueue(_0xd56760){this['id']=_0xd56760['id']||0x0;this['name']=_0xd56760[_0xc1ec('0x8')]||'';this['timeout']=_0xd56760[_0xc1ec('0x9')]||0xa;this[_0xc1ec('0xa')]=_0xd56760[_0xc1ec('0xa')]||_0xc1ec('0xb');this[_0xc1ec('0xc')]=_0xd56760[_0xc1ec('0xc')];this[_0xc1ec('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0xc1ec('0xe')]();this[_0xc1ec('0xf')]();}ChatQueue[_0xc1ec('0x10')][_0xc1ec('0xe')]=function(){var _0x471eec=this['mapAgentsId'][_0xc1ec('0x11')];this['mapAgentsId']=_[_0xc1ec('0x12')](this['Agents'],'id');this[_0xc1ec('0xd')][_0xc1ec('0x11')]=_0x471eec;};ChatQueue[_0xc1ec('0x10')][_0xc1ec('0xf')]=function(){this[_0xc1ec('0x13')]=0x0;this[_0xc1ec('0x14')]=0x0;for(var _0x12f1ec=0x0;_0x12f1ec=0x0?this['available']:0x0;var _0x459603={'id':this['id'],'available':this[_0xc1ec('0x17')],'loggedIn':this[_0xc1ec('0x13')],'name':this[_0xc1ec('0x8')],'paused':this[_0xc1ec('0x14')],'waiting':this[_0xc1ec('0x18')]};var _0x228304=md5(JSON[_0xc1ec('0x19')](_0x459603));if(this[_0xc1ec('0x0')]!==_0x228304){this[_0xc1ec('0x0')]=_0x228304;io['to'](util['format']('chat:queue:%s',_0x459603['name']))[_0xc1ec('0x1a')](_0xc1ec('0x1b'),_0x459603);}};module['exports']=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index eef362f..4cc886d 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 _0x40ee=['faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','updateRouting','mapAgentsId','map','_rr','prototype','paused','length','online','loggedIn'];(function(_0x51ab08,_0x291a50){var _0x3b3a22=function(_0x314f58){while(--_0x314f58){_0x51ab08['push'](_0x51ab08['shift']());}};_0x3b3a22(++_0x291a50);}(_0x40ee,0x9d));var _0xe40e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x40ee[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');var md5=require(_0xe40e('0x0'));var util=require('util');var Redis=require(_0xe40e('0x1'));var config=require(_0xe40e('0x2'));config[_0xe40e('0x3')]=_[_0xe40e('0x4')](config[_0xe40e('0x3')],{'host':_0xe40e('0x5'),'port':0x18eb});var io=require(_0xe40e('0x6'))(new Redis(config[_0xe40e('0x3')]));function FaxQueue(_0x2f9ab4){this['id']=_0x2f9ab4['id']||0x0;this[_0xe40e('0x7')]=_0x2f9ab4[_0xe40e('0x7')]||'';this['timeout']=_0x2f9ab4[_0xe40e('0x8')]||0xa;this[_0xe40e('0x9')]=_0x2f9ab4['strategy']||_0xe40e('0xa');this[_0xe40e('0xb')]=_0x2f9ab4[_0xe40e('0xb')];this['mapAgentsId']={};this[_0xe40e('0xc')]=0x0;this[_0xe40e('0x0')]='';this['updateRouting']();this[_0xe40e('0xd')]();}FaxQueue['prototype'][_0xe40e('0xe')]=function(){var _0x47a186=this[_0xe40e('0xf')]['_rr'];this['mapAgentsId']=_[_0xe40e('0x10')](this[_0xe40e('0xb')],'id');this[_0xe40e('0xf')][_0xe40e('0x11')]=_0x47a186;};FaxQueue[_0xe40e('0x12')][_0xe40e('0xd')]=function(){this['loggedIn']=0x0;this[_0xe40e('0x13')]=0x0;for(var _0xdccbb1=0x0;_0xdccbb1=0x0?this['available']:0x0;var _0x265615={'id':this['id'],'available':this[_0xe40e('0x18')],'loggedIn':this[_0xe40e('0x16')],'name':this[_0xe40e('0x7')],'paused':this[_0xe40e('0x13')],'waiting':this[_0xe40e('0xc')]};var _0x3258d4=md5(JSON[_0xe40e('0x19')](_0x265615));if(this[_0xe40e('0x0')]!==_0x3258d4){this[_0xe40e('0x0')]=_0x3258d4;io['to'](util[_0xe40e('0x1a')](_0xe40e('0x1b'),_0x265615[_0xe40e('0x7')]))['emit'](_0xe40e('0x1c'),_0x265615);}};module[_0xe40e('0x1d')]=FaxQueue; \ No newline at end of file +var _0xd4fb=['timeout','strategy','beepall','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','Agents','loggedIn','paused','length','online','faxPause','available','stringify','fax:queue:%s','emit','fax_queue:save','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name'];(function(_0x49684e,_0x9a24fb){var _0x54062f=function(_0x4e410a){while(--_0x4e410a){_0x49684e['push'](_0x49684e['shift']());}};_0x54062f(++_0x9a24fb);}(_0xd4fb,0xa6));var _0xbd4f=function(_0x596731,_0x562c05){_0x596731=_0x596731-0x0;var _0xadb084=_0xd4fb[_0x596731];return _0xadb084;};'use strict';var _=require('lodash');var md5=require(_0xbd4f('0x0'));var util=require(_0xbd4f('0x1'));var Redis=require(_0xbd4f('0x2'));var config=require(_0xbd4f('0x3'));config[_0xbd4f('0x4')]=_[_0xbd4f('0x5')](config[_0xbd4f('0x4')],{'host':_0xbd4f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbd4f('0x4')]));function FaxQueue(_0x89469c){this['id']=_0x89469c['id']||0x0;this[_0xbd4f('0x7')]=_0x89469c[_0xbd4f('0x7')]||'';this[_0xbd4f('0x8')]=_0x89469c['timeout']||0xa;this[_0xbd4f('0x9')]=_0x89469c[_0xbd4f('0x9')]||_0xbd4f('0xa');this['Agents']=_0x89469c['Agents'];this[_0xbd4f('0xb')]={};this[_0xbd4f('0xc')]=0x0;this[_0xbd4f('0x0')]='';this['updateRouting']();this[_0xbd4f('0xd')]();}FaxQueue[_0xbd4f('0xe')][_0xbd4f('0xf')]=function(){var _0x3ba3a5=this[_0xbd4f('0xb')][_0xbd4f('0x10')];this[_0xbd4f('0xb')]=_[_0xbd4f('0x11')](this[_0xbd4f('0x12')],'id');this['mapAgentsId'][_0xbd4f('0x10')]=_0x3ba3a5;};FaxQueue[_0xbd4f('0xe')][_0xbd4f('0xd')]=function(){this[_0xbd4f('0x13')]=0x0;this[_0xbd4f('0x14')]=0x0;for(var _0x5ebe10=0x0;_0x5ebe10=0x0?this[_0xbd4f('0x18')]:0x0;var _0x1181d9={'id':this['id'],'available':this[_0xbd4f('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xbd4f('0x7')],'paused':this[_0xbd4f('0x14')],'waiting':this['waiting']};var _0x21454d=md5(JSON[_0xbd4f('0x19')](_0x1181d9));if(this['md5']!==_0x21454d){this[_0xbd4f('0x0')]=_0x21454d;io['to'](util['format'](_0xbd4f('0x1a'),_0x1181d9[_0xbd4f('0x7')]))[_0xbd4f('0x1b')](_0xbd4f('0x1c'),_0x1181d9);}};module['exports']=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 04eb3ee..3311958 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 _0xd5a5=['exports','name','Intervals'];(function(_0x53a014,_0x9b47e4){var _0x395d0e=function(_0x2ab0ec){while(--_0x2ab0ec){_0x53a014['push'](_0x53a014['shift']());}};_0x395d0e(++_0x9b47e4);}(_0xd5a5,0x1d2));var _0x5d5a=function(_0x4b9c90,_0x27a03c){_0x4b9c90=_0x4b9c90-0x0;var _0x529d4c=_0xd5a5[_0x4b9c90];return _0x529d4c;};'use strict';function Interval(_0x393642){this['id']=_0x393642['id']||0x0;this['name']=_0x393642[_0x5d5a('0x0')]||'';this[_0x5d5a('0x1')]=_0x393642[_0x5d5a('0x1')]||{};}module[_0x5d5a('0x2')]=Interval; \ No newline at end of file +var _0xbf6a=['exports','name','Intervals'];(function(_0x5a7e3c,_0xdc9219){var _0x59252b=function(_0x29655c){while(--_0x29655c){_0x5a7e3c['push'](_0x5a7e3c['shift']());}};_0x59252b(++_0xdc9219);}(_0xbf6a,0x1c3));var _0xabf6=function(_0x4ac424,_0x554b5d){_0x4ac424=_0x4ac424-0x0;var _0xe1b890=_0xbf6a[_0x4ac424];return _0xe1b890;};'use strict';function Interval(_0x293aa6){this['id']=_0x293aa6['id']||0x0;this[_0xabf6('0x0')]=_0x293aa6['name']||'';this[_0xabf6('0x1')]=_0x293aa6[_0xabf6('0x1')]||{};}module[_0xabf6('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 013783f..1ccc1e4 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 _0xb2e6=['mail:queue:%s','mail_queue:save','exports','lodash','md5','util','redis','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','online','available','stringify','format'];(function(_0x591781,_0x8e0ed2){var _0x315bd9=function(_0x39166c){while(--_0x39166c){_0x591781['push'](_0x591781['shift']());}};_0x315bd9(++_0x8e0ed2);}(_0xb2e6,0x99));var _0x6b2e=function(_0x2e67fc,_0x5a9316){_0x2e67fc=_0x2e67fc-0x0;var _0x52e67a=_0xb2e6[_0x2e67fc];return _0x52e67a;};'use strict';var _=require(_0x6b2e('0x0'));var md5=require(_0x6b2e('0x1'));var util=require(_0x6b2e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6b2e('0x3')]=_['defaults'](config[_0x6b2e('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x6b2e('0x4'))(new Redis(config[_0x6b2e('0x3')]));function MailQueue(_0x42dfa0){this['id']=_0x42dfa0['id']||0x0;this[_0x6b2e('0x5')]=_0x42dfa0[_0x6b2e('0x5')]||'';this[_0x6b2e('0x6')]=_0x42dfa0[_0x6b2e('0x6')]||0xa;this[_0x6b2e('0x7')]=_0x42dfa0['strategy']||'beepall';this[_0x6b2e('0x8')]=_0x42dfa0['Agents'];this[_0x6b2e('0x9')]={};this[_0x6b2e('0xa')]=0x0;this['md5']='';this[_0x6b2e('0xb')]();this[_0x6b2e('0xc')]();}MailQueue['prototype']['updateRouting']=function(){var _0x3aa04b=this[_0x6b2e('0x9')]['_rr'];this['mapAgentsId']=_['map'](this[_0x6b2e('0x8')],'id');this[_0x6b2e('0x9')][_0x6b2e('0xd')]=_0x3aa04b;};MailQueue[_0x6b2e('0xe')]['updateRealtime']=function(){this[_0x6b2e('0xf')]=0x0;this[_0x6b2e('0x10')]=0x0;for(var _0xb3c962=0x0;_0xb3c962=0x0?this[_0x6b2e('0x13')]:0x0;var _0x14b3dd={'id':this['id'],'available':this[_0x6b2e('0x13')],'loggedIn':this['loggedIn'],'name':this[_0x6b2e('0x5')],'paused':this[_0x6b2e('0x10')],'waiting':this[_0x6b2e('0xa')]};var _0x1db445=md5(JSON[_0x6b2e('0x14')](_0x14b3dd));if(this[_0x6b2e('0x1')]!==_0x1db445){this[_0x6b2e('0x1')]=_0x1db445;io['to'](util[_0x6b2e('0x15')](_0x6b2e('0x16'),_0x14b3dd[_0x6b2e('0x5')]))['emit'](_0x6b2e('0x17'),_0x14b3dd);}};module[_0x6b2e('0x18')]=MailQueue; \ No newline at end of file +var _0x336d=['ioredis','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','_rr','map','prototype','loggedIn','paused','length','online','mailPause','available','stringify','format','emit','exports','lodash','util'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x336d,0xbb));var _0xd336=function(_0x11f439,_0x2ba5e1){_0x11f439=_0x11f439-0x0;var _0x59cbe6=_0x336d[_0x11f439];return _0x59cbe6;};'use strict';var _=require(_0xd336('0x0'));var md5=require('md5');var util=require(_0xd336('0x1'));var Redis=require(_0xd336('0x2'));var config=require('../../../config/environment');config[_0xd336('0x3')]=_[_0xd336('0x4')](config[_0xd336('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd336('0x3')]));function MailQueue(_0x4954ae){this['id']=_0x4954ae['id']||0x0;this['name']=_0x4954ae[_0xd336('0x5')]||'';this[_0xd336('0x6')]=_0x4954ae[_0xd336('0x6')]||0xa;this[_0xd336('0x7')]=_0x4954ae[_0xd336('0x7')]||_0xd336('0x8');this[_0xd336('0x9')]=_0x4954ae[_0xd336('0x9')];this[_0xd336('0xa')]={};this[_0xd336('0xb')]=0x0;this[_0xd336('0xc')]='';this[_0xd336('0xd')]();this['updateRealtime']();}MailQueue['prototype'][_0xd336('0xd')]=function(){var _0x425192=this['mapAgentsId'][_0xd336('0xe')];this[_0xd336('0xa')]=_[_0xd336('0xf')](this['Agents'],'id');this['mapAgentsId'][_0xd336('0xe')]=_0x425192;};MailQueue[_0xd336('0x10')]['updateRealtime']=function(){this[_0xd336('0x11')]=0x0;this[_0xd336('0x12')]=0x0;for(var _0xb1282e=0x0;_0xb1282e=0x0?this[_0xd336('0x16')]:0x0;var _0x486da9={'id':this['id'],'available':this[_0xd336('0x16')],'loggedIn':this[_0xd336('0x11')],'name':this['name'],'paused':this[_0xd336('0x12')],'waiting':this['waiting']};var _0x1c4c9d=md5(JSON[_0xd336('0x17')](_0x486da9));if(this['md5']!==_0x1c4c9d){this[_0xd336('0xc')]=_0x1c4c9d;io['to'](util[_0xd336('0x18')]('mail:queue:%s',_0x486da9['name']))[_0xd336('0x19')]('mail_queue:save',_0x486da9);}};module[_0xd336('0x1a')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 3c53294..d4b70b3 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x326f,0xd1));var _0xf326=function(_0x45f08a,_0x460731){_0x45f08a=_0x45f08a-0x0;var _0x2a31dd=_0x326f[_0x45f08a];return _0x2a31dd;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x590ef3,_0x3b2dd2){var _0x4502be=function(_0x2c8011){while(--_0x2c8011){_0x590ef3['push'](_0x590ef3['shift']());}};_0x4502be(++_0x3b2dd2);}(_0xadb5,0xad));var _0x5adb=function(_0x255801,_0x37497d){_0x255801=_0x255801-0x0;var _0x3b9526=_0xadb5[_0x255801];return _0x3b9526;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 3d6b661..ed06b29 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 _0xaa88=['map','loggedIn','online','smsPause','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x1db964,_0xb7b4c4){var _0x3e7dbb=function(_0xf7557d){while(--_0xf7557d){_0x1db964['push'](_0x1db964['shift']());}};_0x3e7dbb(++_0xb7b4c4);}(_0xaa88,0x137));var _0x8aa8=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0xaa88[_0x28e74e];return _0xb45ac1;};'use strict';var _=require(_0x8aa8('0x0'));var md5=require(_0x8aa8('0x1'));var util=require(_0x8aa8('0x2'));var Redis=require(_0x8aa8('0x3'));var config=require('../../../config/environment');config[_0x8aa8('0x4')]=_[_0x8aa8('0x5')](config[_0x8aa8('0x4')],{'host':_0x8aa8('0x6'),'port':0x18eb});var io=require(_0x8aa8('0x7'))(new Redis(config[_0x8aa8('0x4')]));function SmsQueue(_0x5e2595){this['id']=_0x5e2595['id']||0x0;this['name']=_0x5e2595[_0x8aa8('0x8')]||'';this['timeout']=_0x5e2595[_0x8aa8('0x9')]||0xa;this[_0x8aa8('0xa')]=_0x5e2595[_0x8aa8('0xa')]||_0x8aa8('0xb');this['Agents']=_0x5e2595[_0x8aa8('0xc')];this[_0x8aa8('0xd')]={};this[_0x8aa8('0xe')]=0x0;this['md5']='';this[_0x8aa8('0xf')]();this[_0x8aa8('0x10')]();}SmsQueue[_0x8aa8('0x11')][_0x8aa8('0xf')]=function(){var _0x583688=this[_0x8aa8('0xd')][_0x8aa8('0x12')];this['mapAgentsId']=_[_0x8aa8('0x13')](this[_0x8aa8('0xc')],'id');this[_0x8aa8('0xd')]['_rr']=_0x583688;};SmsQueue[_0x8aa8('0x11')][_0x8aa8('0x10')]=function(){this[_0x8aa8('0x14')]=0x0;this['paused']=0x0;for(var _0x391642=0x0;_0x391642=0x0?this[_0x8aa8('0x18')]:0x0;var _0x49d80d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8aa8('0x14')],'name':this['name'],'paused':this[_0x8aa8('0x17')],'waiting':this[_0x8aa8('0xe')]};var _0x2a9f56=md5(JSON[_0x8aa8('0x19')](_0x49d80d));if(this['md5']!==_0x2a9f56){this[_0x8aa8('0x1')]=_0x2a9f56;io['to'](util[_0x8aa8('0x1a')](_0x8aa8('0x1b'),_0x49d80d[_0x8aa8('0x8')]))[_0x8aa8('0x1c')](_0x8aa8('0x1d'),_0x49d80d);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x72b1=['format','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','md5'];(function(_0x15b625,_0x40b042){var _0x24fac1=function(_0xc8f408){while(--_0xc8f408){_0x15b625['push'](_0x15b625['shift']());}};_0x24fac1(++_0x40b042);}(_0x72b1,0x16e));var _0x172b=function(_0x60ea4a,_0x191ebd){_0x60ea4a=_0x60ea4a-0x0;var _0x139162=_0x72b1[_0x60ea4a];return _0x139162;};'use strict';var _=require(_0x172b('0x0'));var md5=require('md5');var util=require(_0x172b('0x1'));var Redis=require(_0x172b('0x2'));var config=require(_0x172b('0x3'));config[_0x172b('0x4')]=_[_0x172b('0x5')](config[_0x172b('0x4')],{'host':_0x172b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x172b('0x4')]));function SmsQueue(_0x40c72e){this['id']=_0x40c72e['id']||0x0;this[_0x172b('0x7')]=_0x40c72e[_0x172b('0x7')]||'';this['timeout']=_0x40c72e[_0x172b('0x8')]||0xa;this['strategy']=_0x40c72e[_0x172b('0x9')]||'beepall';this[_0x172b('0xa')]=_0x40c72e[_0x172b('0xa')];this[_0x172b('0xb')]={};this[_0x172b('0xc')]=0x0;this['md5']='';this[_0x172b('0xd')]();this[_0x172b('0xe')]();}SmsQueue[_0x172b('0xf')][_0x172b('0xd')]=function(){var _0xa4ada9=this[_0x172b('0xb')][_0x172b('0x10')];this['mapAgentsId']=_[_0x172b('0x11')](this[_0x172b('0xa')],'id');this[_0x172b('0xb')]['_rr']=_0xa4ada9;};SmsQueue[_0x172b('0xf')]['updateRealtime']=function(){this[_0x172b('0x12')]=0x0;this[_0x172b('0x13')]=0x0;for(var _0x5239b9=0x0;_0x5239b9=0x0?this[_0x172b('0x17')]:0x0;var _0x18c22a={'id':this['id'],'available':this[_0x172b('0x17')],'loggedIn':this[_0x172b('0x12')],'name':this['name'],'paused':this[_0x172b('0x13')],'waiting':this[_0x172b('0xc')]};var _0x2bedae=md5(JSON[_0x172b('0x18')](_0x18c22a));if(this[_0x172b('0x19')]!==_0x2bedae){this[_0x172b('0x19')]=_0x2bedae;io['to'](util[_0x172b('0x1a')]('sms:queue:%s',_0x18c22a['name']))['emit']('sms_queue:save',_0x18c22a);}};module[_0x172b('0x1b')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 94e5748..ec7f735 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 _0xd0ff=['name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','mapAgentsId','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','whatsapp_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x48c4ef,_0x319d44){var _0x435715=function(_0x925d50){while(--_0x925d50){_0x48c4ef['push'](_0x48c4ef['shift']());}};_0x435715(++_0x319d44);}(_0xd0ff,0x107));var _0xfd0f=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0xd0ff[_0x30cc1a];return _0xb3f18f;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xfd0f('0x0'));var Redis=require(_0xfd0f('0x1'));var config=require(_0xfd0f('0x2'));config[_0xfd0f('0x3')]=_[_0xfd0f('0x4')](config[_0xfd0f('0x3')],{'host':_0xfd0f('0x5'),'port':0x18eb});var io=require(_0xfd0f('0x6'))(new Redis(config[_0xfd0f('0x3')]));function WhatsappQueue(_0x3010f0){this['id']=_0x3010f0['id']||0x0;this[_0xfd0f('0x7')]=_0x3010f0['name']||'';this[_0xfd0f('0x8')]=_0x3010f0[_0xfd0f('0x8')]||0xa;this[_0xfd0f('0x9')]=_0x3010f0[_0xfd0f('0x9')]||_0xfd0f('0xa');this[_0xfd0f('0xb')]=_0x3010f0['Agents'];this['mapAgentsId']={};this[_0xfd0f('0xc')]=0x0;this[_0xfd0f('0xd')]='';this[_0xfd0f('0xe')]();this[_0xfd0f('0xf')]();}WhatsappQueue[_0xfd0f('0x10')][_0xfd0f('0xe')]=function(){var _0xfd2a37=this['mapAgentsId'][_0xfd0f('0x11')];this['mapAgentsId']=_[_0xfd0f('0x12')](this[_0xfd0f('0xb')],'id');this[_0xfd0f('0x13')][_0xfd0f('0x11')]=_0xfd2a37;};WhatsappQueue[_0xfd0f('0x10')][_0xfd0f('0xf')]=function(){this[_0xfd0f('0x14')]=0x0;this[_0xfd0f('0x15')]=0x0;for(var _0x200efc=0x0;_0x200efc=0x0?this[_0xfd0f('0x19')]:0x0;var _0x2c812={'id':this['id'],'available':this[_0xfd0f('0x19')],'loggedIn':this['loggedIn'],'name':this[_0xfd0f('0x7')],'paused':this['paused'],'waiting':this[_0xfd0f('0xc')]};var _0x20b038=md5(JSON['stringify'](_0x2c812));if(this[_0xfd0f('0xd')]!==_0x20b038){this['md5']=_0x20b038;io['to'](util[_0xfd0f('0x1a')](_0xfd0f('0x1b'),_0x2c812[_0xfd0f('0x7')]))['emit'](_0xfd0f('0x1c'),_0x2c812);}};module[_0xfd0f('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x88b8=['whatsappPause','available','format','whatsapp:queue:%s','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online'];(function(_0x42acfc,_0x349f46){var _0x24b053=function(_0x49409e){while(--_0x49409e){_0x42acfc['push'](_0x42acfc['shift']());}};_0x24b053(++_0x349f46);}(_0x88b8,0x108));var _0x888b=function(_0x2673a4,_0x4d0b8d){_0x2673a4=_0x2673a4-0x0;var _0x5e3a6a=_0x88b8[_0x2673a4];return _0x5e3a6a;};'use strict';var _=require(_0x888b('0x0'));var md5=require(_0x888b('0x1'));var util=require(_0x888b('0x2'));var Redis=require(_0x888b('0x3'));var config=require(_0x888b('0x4'));config[_0x888b('0x5')]=_['defaults'](config[_0x888b('0x5')],{'host':_0x888b('0x6'),'port':0x18eb});var io=require(_0x888b('0x7'))(new Redis(config['redis']));function WhatsappQueue(_0x65aaee){this['id']=_0x65aaee['id']||0x0;this[_0x888b('0x8')]=_0x65aaee[_0x888b('0x8')]||'';this['timeout']=_0x65aaee['timeout']||0xa;this[_0x888b('0x9')]=_0x65aaee[_0x888b('0x9')]||'beepall';this[_0x888b('0xa')]=_0x65aaee[_0x888b('0xa')];this[_0x888b('0xb')]={};this[_0x888b('0xc')]=0x0;this[_0x888b('0x1')]='';this[_0x888b('0xd')]();this[_0x888b('0xe')]();}WhatsappQueue[_0x888b('0xf')][_0x888b('0xd')]=function(){var _0xe2565=this[_0x888b('0xb')][_0x888b('0x10')];this[_0x888b('0xb')]=_[_0x888b('0x11')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0xe2565;};WhatsappQueue[_0x888b('0xf')][_0x888b('0xe')]=function(){this[_0x888b('0x12')]=0x0;this[_0x888b('0x13')]=0x0;for(var _0x377c10=0x0;_0x377c10=0x0?this[_0x888b('0x17')]:0x0;var _0x150354={'id':this['id'],'available':this[_0x888b('0x17')],'loggedIn':this[_0x888b('0x12')],'name':this[_0x888b('0x8')],'paused':this[_0x888b('0x13')],'waiting':this[_0x888b('0xc')]};var _0x143049=md5(JSON['stringify'](_0x150354));if(this[_0x888b('0x1')]!==_0x143049){this[_0x888b('0x1')]=_0x143049;io['to'](util[_0x888b('0x18')](_0x888b('0x19'),_0x150354[_0x888b('0x8')]))['emit']('whatsapp_queue:save',_0x150354);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index fc1de82..132074d 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x5edbcf,_0x5e51da){var _0x288d0b=function(_0x19c095){while(--_0x19c095){_0x5edbcf['push'](_0x5edbcf['shift']());}};_0x288d0b(++_0x5e51da);}(_0xb10b,0x12a));var _0xbb10=function(_0x57306c,_0xdeff85){_0x57306c=_0x57306c-0x0;var _0x413cfb=_0xb10b[_0x57306c];return _0x413cfb;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 5e2a944..c8482e7 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 _0x2a59=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client'];(function(_0x5c784e,_0x3d573e){var _0x3e2af8=function(_0x1427f9){while(--_0x1427f9){_0x5c784e['push'](_0x5c784e['shift']());}};_0x3e2af8(++_0x3d573e);}(_0x2a59,0x13a));var _0x92a5=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x2a59[_0x576170];return _0x397c70;};'use strict';var client=require(_0x92a5('0x0'));exports[_0x92a5('0x1')]=function(_0x2b713f,_0x4a4952){return client[_0x92a5('0x2')](_0x92a5('0x3'),{'body':_0x4a4952,'options':{'where':{'id':_0x2b713f}},'log':_0x92a5('0x4')});};exports[_0x92a5('0x5')]=function(_0x3da2b5,_0x512aa9){return client[_0x92a5('0x2')](_0x92a5('0x6'),{'body':_0x512aa9,'options':{'where':{'id':_0x3da2b5}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xf2aa=['../client','Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction'];(function(_0x449595,_0x113070){var _0x28b865=function(_0x336b8b){while(--_0x336b8b){_0x449595['push'](_0x449595['shift']());}};_0x28b865(++_0x113070);}(_0xf2aa,0x72));var _0xaf2a=function(_0x4ace20,_0x12a5a1){_0x4ace20=_0x4ace20-0x0;var _0x1ebfac=_0xf2aa[_0x4ace20];return _0x1ebfac;};'use strict';var client=require(_0xaf2a('0x0'));exports['update']=function(_0x3305e4,_0x33abef){return client[_0xaf2a('0x1')](_0xaf2a('0x2'),{'body':_0x33abef,'options':{'where':{'id':_0x3305e4}},'log':_0xaf2a('0x3')});};exports[_0xaf2a('0x4')]=function(_0x1d8773,_0x37f2f2){return client[_0xaf2a('0x1')]('AddTagsToChatInteraction',{'body':_0x37f2f2,'options':{'where':{'id':_0x1d8773}},'log':_0xaf2a('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index ee2c3f7..c5fe06b 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 _0xea37=['CreateChatMessage','createChatMessage','create','Request'];(function(_0x31e00f,_0x1a4e77){var _0x260194=function(_0x58c57a){while(--_0x58c57a){_0x31e00f['push'](_0x31e00f['shift']());}};_0x260194(++_0x1a4e77);}(_0xea37,0xf6));var _0x7ea3=function(_0x5df624,_0x1a4dbf){_0x5df624=_0x5df624-0x0;var _0x5d1e1a=_0xea37[_0x5df624];return _0x5d1e1a;};'use strict';var client=require('../client');exports[_0x7ea3('0x0')]=function(_0x10d3e7){return client[_0x7ea3('0x1')](_0x7ea3('0x2'),{'body':_0x10d3e7,'log':_0x7ea3('0x3')});}; \ No newline at end of file +var _0x3d4d=['CreateChatMessage','../client'];(function(_0x164ef5,_0xba6238){var _0x2d60c5=function(_0x34deca){while(--_0x34deca){_0x164ef5['push'](_0x164ef5['shift']());}};_0x2d60c5(++_0xba6238);}(_0x3d4d,0x12d));var _0xd3d4=function(_0x57807,_0x43a33b){_0x57807=_0x57807-0x0;var _0x1ba2c3=_0x3d4d[_0x57807];return _0x1ba2c3;};'use strict';var client=require(_0xd3d4('0x0'));exports['create']=function(_0x20f4e3){return client['Request'](_0xd3d4('0x1'),{'body':_0x20f4e3,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 7030539..0bb5c1c 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 _0x5fd1=['name','User','Agents','chatPause','getChatQueues','../client','Request','GetChatQueue'];(function(_0x23be28,_0x3f6451){var _0x5a1f2f=function(_0x2a40ce){while(--_0x2a40ce){_0x23be28['push'](_0x23be28['shift']());}};_0x5a1f2f(++_0x3f6451);}(_0x5fd1,0x155));var _0x15fd=function(_0x109874,_0x125a13){_0x109874=_0x109874-0x0;var _0x34d588=_0x5fd1[_0x109874];return _0x34d588;};'use strict';var client=require(_0x15fd('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x15fd('0x1')](_0x15fd('0x2'),{'options':{'raw':![],'attributes':['id',_0x15fd('0x3'),'timeout','strategy'],'include':[{'model':_0x15fd('0x4'),'as':_0x15fd('0x5'),'attributes':['id',_0x15fd('0x3'),'online',_0x15fd('0x6')]}]},'log':_0x15fd('0x7')});};}; \ No newline at end of file +var _0xf8de=['User','Agents','online','chatPause','getChatQueues','Request','name','strategy'];(function(_0x5705e3,_0x18af22){var _0x334d81=function(_0x48eb8c){while(--_0x48eb8c){_0x5705e3['push'](_0x5705e3['shift']());}};_0x334d81(++_0x18af22);}(_0xf8de,0x1d4));var _0xef8d=function(_0x5900ee,_0x48931e){_0x5900ee=_0x5900ee-0x0;var _0x171d06=_0xf8de[_0x5900ee];return _0x171d06;};'use strict';var client=require('../client');exports[_0xef8d('0x0')]=function(){return function(){return client[_0xef8d('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xef8d('0x2'),'timeout',_0xef8d('0x3')],'include':[{'model':_0xef8d('0x4'),'as':_0xef8d('0x5'),'attributes':['id','name',_0xef8d('0x6'),_0xef8d('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 6efd982..8045f2c 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 _0xe6c1=['create','Request','update'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe6c1[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0x1e6c('0x0')]=function(_0x3fa0fe){return client[_0x1e6c('0x1')]('CreateChatQueueReport',{'body':_0x3fa0fe,'log':'CreateChatQueueReport'});};exports[_0x1e6c('0x2')]=function(_0x37322d,_0x43ee4d){return client['Request']('UpdateChatQueueReport',{'body':_0x43ee4d,'options':{'where':{'uniqueid':_0x37322d},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xc7e9=['../client','create','Request','CreateChatQueueReport','DESC'];(function(_0x4ef048,_0x244de2){var _0x2d58ac=function(_0x5cd657){while(--_0x5cd657){_0x4ef048['push'](_0x4ef048['shift']());}};_0x2d58ac(++_0x244de2);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xc7e9[_0x2adbeb];return _0x5e18a6;};'use strict';var client=require(_0x9c7e('0x0'));exports[_0x9c7e('0x1')]=function(_0x581e2d){return client[_0x9c7e('0x2')](_0x9c7e('0x3'),{'body':_0x581e2d,'log':_0x9c7e('0x3')});};exports['update']=function(_0x340997,_0x34cef0){return client['Request']('UpdateChatQueueReport',{'body':_0x34cef0,'options':{'where':{'uniqueid':_0x340997},'order':[['id',_0x9c7e('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 04ba6c2..c443389 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 _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x7a54,0x106));var _0x47a5=function(_0x386212,_0x43d965){_0x386212=_0x386212-0x0;var _0x24101b=_0x7a54[_0x386212];return _0x24101b;};'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 +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x132558,_0x521d93){var _0x34f138=function(_0x3e3541){while(--_0x3e3541){_0x132558['push'](_0x132558['shift']());}};_0x34f138(++_0x521d93);}(_0x7a54,0x106));var _0x47a5=function(_0x35e8df,_0x51df48){_0x35e8df=_0x35e8df-0x0;var _0x504dc8=_0x7a54[_0x35e8df];return _0x504dc8;};'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 22c8992..fe6c6f4 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 _0xcbf1=['CreateFaxMessage','createFaxMessage','../client','create','Request'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xcbf1,0x66));var _0x1cbf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcbf1[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1cbf('0x0'));exports[_0x1cbf('0x1')]=function(_0x1142b8){return client[_0x1cbf('0x2')](_0x1cbf('0x3'),{'body':_0x1142b8,'log':_0x1cbf('0x4')});}; \ No newline at end of file +var _0xa582=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x245afe,_0x319cde){var _0x4eefde=function(_0x15a1fa){while(--_0x15a1fa){_0x245afe['push'](_0x245afe['shift']());}};_0x4eefde(++_0x319cde);}(_0xa582,0x1a9));var _0x2a58=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa582[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x2a58('0x0'));exports[_0x2a58('0x1')]=function(_0x59b0ab){return client[_0x2a58('0x2')](_0x2a58('0x3'),{'body':_0x59b0ab,'log':_0x2a58('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d5a7582..977b756 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 _0x9ab8=['Request','GetFaxQueue','name','timeout','User','Agents','online','getFaxQueues'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x9ab8,0x1ef));var _0x89ab=function(_0x5bef6a,_0x46c36c){_0x5bef6a=_0x5bef6a-0x0;var _0x2ed1b5=_0x9ab8[_0x5bef6a];return _0x2ed1b5;};'use strict';var client=require('../client');exports[_0x89ab('0x0')]=function(){return function(){return client[_0x89ab('0x1')](_0x89ab('0x2'),{'options':{'raw':![],'attributes':['id',_0x89ab('0x3'),_0x89ab('0x4'),'strategy'],'include':[{'model':_0x89ab('0x5'),'as':_0x89ab('0x6'),'attributes':['id',_0x89ab('0x3'),_0x89ab('0x7'),'faxPause']}]},'log':_0x89ab('0x0')});};}; \ No newline at end of file +var _0x192e=['getFaxQueues','Request','GetFaxQueue','timeout','User','online','faxPause','../client'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x192e,0x1df));var _0xe192=function(_0x1d20af,_0xcc2ff0){_0x1d20af=_0x1d20af-0x0;var _0x102b00=_0x192e[_0x1d20af];return _0x102b00;};'use strict';var client=require(_0xe192('0x0'));exports[_0xe192('0x1')]=function(){return function(){return client[_0xe192('0x2')](_0xe192('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xe192('0x4'),'strategy'],'include':[{'model':_0xe192('0x5'),'as':'Agents','attributes':['id','name',_0xe192('0x6'),_0xe192('0x7')]}]},'log':_0xe192('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 0bd44b4..d729738 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 _0x326f=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0x326f,0x1a3));var _0xf326=function(_0x1d5c06,_0x53fdc0){_0x1d5c06=_0x1d5c06-0x0;var _0xaedef8=_0x326f[_0x1d5c06];return _0xaedef8;};'use strict';var client=require(_0xf326('0x0'));exports[_0xf326('0x1')]=function(_0x2e6b04){return client[_0xf326('0x2')]('CreateFaxQueueReport',{'body':_0x2e6b04,'log':_0xf326('0x3')});};exports[_0xf326('0x4')]=function(_0x213850,_0x2aa8d8){return client[_0xf326('0x2')](_0xf326('0x5'),{'body':_0x2aa8d8,'options':{'where':{'uniqueid':_0x213850},'order':[['id',_0xf326('0x6')]],'limit':0x1},'log':_0xf326('0x5')});}; \ No newline at end of file +var _0xbd06=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x59a04f,_0x3faa5f){var _0xdc470a=function(_0x29894f){while(--_0x29894f){_0x59a04f['push'](_0x59a04f['shift']());}};_0xdc470a(++_0x3faa5f);}(_0xbd06,0x1e8));var _0x6bd0=function(_0x34e333,_0x12da13){_0x34e333=_0x34e333-0x0;var _0x567b6a=_0xbd06[_0x34e333];return _0x567b6a;};'use strict';var client=require(_0x6bd0('0x0'));exports[_0x6bd0('0x1')]=function(_0x58e623){return client[_0x6bd0('0x2')]('CreateFaxQueueReport',{'body':_0x58e623,'log':_0x6bd0('0x3')});};exports[_0x6bd0('0x4')]=function(_0x13aede,_0x6705a1){return client[_0x6bd0('0x2')](_0x6bd0('0x5'),{'body':_0x6705a1,'options':{'where':{'uniqueid':_0x13aede},'order':[['id',_0x6bd0('0x6')]],'limit':0x1},'log':_0x6bd0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index f30c04c..8d583c5 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 _0x5527=['../client','Request','GetInterval','name','Interval','getIntervals'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x5527,0xa8));var _0x7552=function(_0x4b66bb,_0x3d639d){_0x4b66bb=_0x4b66bb-0x0;var _0x17c6bd=_0x5527[_0x4b66bb];return _0x17c6bd;};'use strict';var client=require(_0x7552('0x0'));exports['getIntervals']=function(){return function(){return client[_0x7552('0x1')](_0x7552('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x7552('0x3')],'include':[{'model':_0x7552('0x4'),'as':'Intervals','attributes':['id',_0x7552('0x3'),'interval']}]},'log':_0x7552('0x5')});};}; \ No newline at end of file +var _0x154f=['Request','GetInterval','name','Interval','Intervals','../client'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0x154f,0x13d));var _0xf154=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x154f[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xf154('0x0'));exports['getIntervals']=function(){return function(){return client[_0xf154('0x1')](_0xf154('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf154('0x3')],'include':[{'model':_0xf154('0x4'),'as':_0xf154('0x5'),'attributes':['id','name','interval']}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index a6173a4..2bfbe2e 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 _0xb016=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags'];(function(_0x2d3582,_0x198bfa){var _0x506230=function(_0x54cc5e){while(--_0x54cc5e){_0x2d3582['push'](_0x2d3582['shift']());}};_0x506230(++_0x198bfa);}(_0xb016,0x159));var _0x6b01=function(_0x47ad0f,_0x346e8f){_0x47ad0f=_0x47ad0f-0x0;var _0xe27250=_0xb016[_0x47ad0f];return _0xe27250;};'use strict';var client=require(_0x6b01('0x0'));exports[_0x6b01('0x1')]=function(_0x513ed6,_0x57ecae){return client[_0x6b01('0x2')]('UpdateMailInteraction',{'body':_0x57ecae,'options':{'where':{'id':_0x513ed6}},'log':_0x6b01('0x3')});};exports[_0x6b01('0x4')]=function(_0x161b59,_0x3b9de1){return client['Request'](_0x6b01('0x5'),{'body':_0x3b9de1,'options':{'where':{'id':_0x161b59}},'log':_0x6b01('0x6')});}; \ No newline at end of file +var _0x0120=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0xeba421,_0x143cbe){var _0x345bca=function(_0x4c8fc1){while(--_0x4c8fc1){_0xeba421['push'](_0xeba421['shift']());}};_0x345bca(++_0x143cbe);}(_0x0120,0x6f));var _0x0012=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x0120[_0x30ae5e];return _0x1f2e93;};'use strict';var client=require(_0x0012('0x0'));exports[_0x0012('0x1')]=function(_0x3d23e7,_0xb8d57c){return client[_0x0012('0x2')](_0x0012('0x3'),{'body':_0xb8d57c,'options':{'where':{'id':_0x3d23e7}},'log':_0x0012('0x4')});};exports[_0x0012('0x5')]=function(_0x357f77,_0x302029){return client[_0x0012('0x2')](_0x0012('0x6'),{'body':_0x302029,'options':{'where':{'id':_0x357f77}},'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 c9741fa..f17508a 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 _0x1a16=['../client','createMailMessage'];(function(_0x3f8561,_0x2a544a){var _0x4cb229=function(_0x282ce8){while(--_0x282ce8){_0x3f8561['push'](_0x3f8561['shift']());}};_0x4cb229(++_0x2a544a);}(_0x1a16,0xd4));var _0x61a1=function(_0x1c6a91,_0x19b00c){_0x1c6a91=_0x1c6a91-0x0;var _0x177a8c=_0x1a16[_0x1c6a91];return _0x177a8c;};'use strict';var client=require(_0x61a1('0x0'));exports['create']=function(_0x33edaf){return client['Request']('CreateMailMessage',{'body':_0x33edaf,'log':_0x61a1('0x1')});}; \ No newline at end of file +var _0x21be=['CreateMailMessage','../client','create','Request'];(function(_0x183dd2,_0x4e96fe){var _0x40322c=function(_0x288725){while(--_0x288725){_0x183dd2['push'](_0x183dd2['shift']());}};_0x40322c(++_0x4e96fe);}(_0x21be,0x16d));var _0xe21b=function(_0x53b6ae,_0x3cb9f4){_0x53b6ae=_0x53b6ae-0x0;var _0x34f4b2=_0x21be[_0x53b6ae];return _0x34f4b2;};'use strict';var client=require(_0xe21b('0x0'));exports[_0xe21b('0x1')]=function(_0x491b47){return client[_0xe21b('0x2')](_0xe21b('0x3'),{'body':_0x491b47,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index cb9b0fd..ee50854 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 _0xe558=['name','timeout','strategy','Agents','online','mailPause','getMailQueues'];(function(_0x105e01,_0x199717){var _0x421f22=function(_0x5b1103){while(--_0x5b1103){_0x105e01['push'](_0x105e01['shift']());}};_0x421f22(++_0x199717);}(_0xe558,0x69));var _0x8e55=function(_0x4e8ea2,_0x55e417){_0x4e8ea2=_0x4e8ea2-0x0;var _0x692947=_0xe558[_0x4e8ea2];return _0x692947;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0x8e55('0x0'),_0x8e55('0x1'),_0x8e55('0x2')],'include':[{'model':'User','as':_0x8e55('0x3'),'attributes':['id',_0x8e55('0x0'),_0x8e55('0x4'),_0x8e55('0x5')]}]},'log':_0x8e55('0x6')});};}; \ No newline at end of file +var _0x0a76=['timeout','strategy','Agents','online','../client','getMailQueues','GetMailQueue','name'];(function(_0x3c39a1,_0xe6d095){var _0x495f46=function(_0x86befa){while(--_0x86befa){_0x3c39a1['push'](_0x3c39a1['shift']());}};_0x495f46(++_0xe6d095);}(_0x0a76,0x14c));var _0x60a7=function(_0x4dde71,_0xa7a39f){_0x4dde71=_0x4dde71-0x0;var _0x1068ac=_0x0a76[_0x4dde71];return _0x1068ac;};'use strict';var client=require(_0x60a7('0x0'));exports[_0x60a7('0x1')]=function(){return function(){return client['Request'](_0x60a7('0x2'),{'options':{'raw':![],'attributes':['id',_0x60a7('0x3'),_0x60a7('0x4'),_0x60a7('0x5')],'include':[{'model':'User','as':_0x60a7('0x6'),'attributes':['id',_0x60a7('0x3'),_0x60a7('0x7'),'mailPause']}]},'log':_0x60a7('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index b7064f7..d95306b 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 _0x5766=['CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC','../client'];(function(_0x40023c,_0x5771bf){var _0x52c20f=function(_0x423cb4){while(--_0x423cb4){_0x40023c['push'](_0x40023c['shift']());}};_0x52c20f(++_0x5771bf);}(_0x5766,0xe3));var _0x6576=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5766[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x6576('0x0'));exports['create']=function(_0x5dc77d){return client['Request'](_0x6576('0x1'),{'body':_0x5dc77d,'log':_0x6576('0x1')});};exports[_0x6576('0x2')]=function(_0x3008ab,_0x5ee29b){return client[_0x6576('0x3')](_0x6576('0x4'),{'body':_0x5ee29b,'options':{'where':{'uniqueid':_0x3008ab},'order':[['id',_0x6576('0x5')]],'limit':0x1},'log':_0x6576('0x4')});}; \ No newline at end of file +var _0xe04b=['Request','CreateMailQueueReport','DESC','create'];(function(_0x32c94c,_0x301e06){var _0x398d1e=function(_0x57e701){while(--_0x57e701){_0x32c94c['push'](_0x32c94c['shift']());}};_0x398d1e(++_0x301e06);}(_0xe04b,0xc3));var _0xbe04=function(_0x4fc026,_0x66bb48){_0x4fc026=_0x4fc026-0x0;var _0xf1c6ea=_0xe04b[_0x4fc026];return _0xf1c6ea;};'use strict';var client=require('../client');exports[_0xbe04('0x0')]=function(_0x28a7e0){return client[_0xbe04('0x1')](_0xbe04('0x2'),{'body':_0x28a7e0,'log':'CreateMailQueueReport'});};exports['update']=function(_0x2eb8a0,_0x137071){return client['Request']('UpdateMailQueueReport',{'body':_0x137071,'options':{'where':{'uniqueid':_0x2eb8a0},'order':[['id',_0xbe04('0x3')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 9a7c58e..ff35095 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 _0x9738=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9738,0x65));var _0x8973=function(_0xd574e5,_0x392a1a){_0xd574e5=_0xd574e5-0x0;var _0x29b982=_0x9738[_0xd574e5];return _0x29b982;};'use strict';var client=require(_0x8973('0x0'));exports[_0x8973('0x1')]=function(_0x5b5651,_0x4ae02d){return client[_0x8973('0x2')](_0x8973('0x3'),{'body':_0x4ae02d,'options':{'where':{'id':_0x5b5651}},'log':'updateOpenchannelInteraction'});};exports[_0x8973('0x4')]=function(_0x10bbc1,_0x19886d){return client[_0x8973('0x2')](_0x8973('0x5'),{'body':_0x19886d,'options':{'where':{'id':_0x10bbc1}},'log':_0x8973('0x6')});}; \ No newline at end of file +var _0xecdc=['Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client'];(function(_0x8b60c8,_0x3453aa){var _0x4b8f96=function(_0x57e854){while(--_0x57e854){_0x8b60c8['push'](_0x8b60c8['shift']());}};_0x4b8f96(++_0x3453aa);}(_0xecdc,0x68));var _0xcecd=function(_0x11d5e9,_0x3dae2d){_0x11d5e9=_0x11d5e9-0x0;var _0x2230b1=_0xecdc[_0x11d5e9];return _0x2230b1;};'use strict';var client=require(_0xcecd('0x0'));exports['update']=function(_0x2dbc36,_0x7bbd0f){return client[_0xcecd('0x1')](_0xcecd('0x2'),{'body':_0x7bbd0f,'options':{'where':{'id':_0x2dbc36}},'log':'updateOpenchannelInteraction'});};exports[_0xcecd('0x3')]=function(_0x53c395,_0x22953c){return client[_0xcecd('0x1')](_0xcecd('0x4'),{'body':_0x22953c,'options':{'where':{'id':_0x53c395}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 48854c1..b9ec955 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 _0x5ff8=['CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x4b45ee,_0x49f83c){var _0x2016d0=function(_0x530d89){while(--_0x530d89){_0x4b45ee['push'](_0x4b45ee['shift']());}};_0x2016d0(++_0x49f83c);}(_0x5ff8,0xf2));var _0x85ff=function(_0x48334a,_0x568e8c){_0x48334a=_0x48334a-0x0;var _0x2b6295=_0x5ff8[_0x48334a];return _0x2b6295;};'use strict';var client=require(_0x85ff('0x0'));exports[_0x85ff('0x1')]=function(_0x1e5730){return client['Request'](_0x85ff('0x2'),{'body':_0x1e5730,'log':_0x85ff('0x3')});}; \ No newline at end of file +var _0x96c6=['Request','../client','create'];(function(_0x4493e7,_0x212d2d){var _0x1ad90a=function(_0x4235c0){while(--_0x4235c0){_0x4493e7['push'](_0x4493e7['shift']());}};_0x1ad90a(++_0x212d2d);}(_0x96c6,0x124));var _0x696c=function(_0x2a13f4,_0x1b0930){_0x2a13f4=_0x2a13f4-0x0;var _0x1a556d=_0x96c6[_0x2a13f4];return _0x1a556d;};'use strict';var client=require(_0x696c('0x0'));exports[_0x696c('0x1')]=function(_0x19aaa5){return client[_0x696c('0x2')]('CreateOpenchannelMessage',{'body':_0x19aaa5,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index da613e2..b9cccc2 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 _0x593a=['name','timeout','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue'];(function(_0x54ba24,_0x31007b){var _0x22ef41=function(_0x3cefed){while(--_0x3cefed){_0x54ba24['push'](_0x54ba24['shift']());}};_0x22ef41(++_0x31007b);}(_0x593a,0x180));var _0xa593=function(_0x438988,_0x568ea5){_0x438988=_0x438988-0x0;var _0x787170=_0x593a[_0x438988];return _0x787170;};'use strict';var client=require(_0xa593('0x0'));exports[_0xa593('0x1')]=function(){return function(){return client['Request'](_0xa593('0x2'),{'options':{'raw':![],'attributes':['id',_0xa593('0x3'),_0xa593('0x4'),'strategy'],'include':[{'model':_0xa593('0x5'),'as':_0xa593('0x6'),'attributes':['id','name',_0xa593('0x7'),_0xa593('0x8')]}]},'log':_0xa593('0x1')});};}; \ No newline at end of file +var _0xecd2=['GetOpenchannelQueue','name','timeout','strategy','User','Agents','openchannelPause','../client','getOpenchannelQueues'];(function(_0x50357f,_0x41343a){var _0x3deeb3=function(_0x57aa5e){while(--_0x57aa5e){_0x50357f['push'](_0x50357f['shift']());}};_0x3deeb3(++_0x41343a);}(_0xecd2,0x139));var _0x2ecd=function(_0x3cdbbc,_0x55dfd6){_0x3cdbbc=_0x3cdbbc-0x0;var _0x25422b=_0xecd2[_0x3cdbbc];return _0x25422b;};'use strict';var client=require(_0x2ecd('0x0'));exports[_0x2ecd('0x1')]=function(){return function(){return client['Request'](_0x2ecd('0x2'),{'options':{'raw':![],'attributes':['id',_0x2ecd('0x3'),_0x2ecd('0x4'),_0x2ecd('0x5')],'include':[{'model':_0x2ecd('0x6'),'as':_0x2ecd('0x7'),'attributes':['id',_0x2ecd('0x3'),'online',_0x2ecd('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 0bb5c66..b17ab4f 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 _0xdeb2=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','CreateOpenchannelQueueReport','update'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0xdeb2,0x64));var _0x2deb=function(_0x17da5e,_0x4ff39c){_0x17da5e=_0x17da5e-0x0;var _0x3a5217=_0xdeb2[_0x17da5e];return _0x3a5217;};'use strict';var client=require(_0x2deb('0x0'));exports[_0x2deb('0x1')]=function(_0x18c22e){return client[_0x2deb('0x2')](_0x2deb('0x3'),{'body':_0x18c22e,'log':'CreateOpenchannelQueueReport'});};exports[_0x2deb('0x4')]=function(_0x1c5f89,_0x59e9c1){return client[_0x2deb('0x2')](_0x2deb('0x5'),{'body':_0x59e9c1,'options':{'where':{'uniqueid':_0x1c5f89},'order':[['id',_0x2deb('0x6')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x969d=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','../client','create','Request'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x969d,0xf7));var _0xd969=function(_0x304e81,_0xe6a12e){_0x304e81=_0x304e81-0x0;var _0x3fb0a0=_0x969d[_0x304e81];return _0x3fb0a0;};'use strict';var client=require(_0xd969('0x0'));exports[_0xd969('0x1')]=function(_0x1c5abf){return client[_0xd969('0x2')]('CreateOpenchannelQueueReport',{'body':_0x1c5abf,'log':_0xd969('0x3')});};exports['update']=function(_0x1f13c7,_0x5139f0){return client['Request'](_0xd969('0x4'),{'body':_0x5139f0,'options':{'where':{'uniqueid':_0x1f13c7},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index d49ef55..0ecfab0 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 _0x5db2=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x19f763,_0x8e5638){var _0x349af5=function(_0x5d2f32){while(--_0x5d2f32){_0x19f763['push'](_0x19f763['shift']());}};_0x349af5(++_0x8e5638);}(_0x5db2,0xf3));var _0x25db=function(_0x3f2372,_0x51f08e){_0x3f2372=_0x3f2372-0x0;var _0x3a879d=_0x5db2[_0x3f2372];return _0x3a879d;};'use strict';var client=require(_0x25db('0x0'));exports[_0x25db('0x1')]=function(_0x2a8ff2,_0x4ba952){return client[_0x25db('0x2')](_0x25db('0x3'),{'body':_0x4ba952,'options':{'where':{'id':_0x2a8ff2}},'log':_0x25db('0x4')});};exports[_0x25db('0x5')]=function(_0x201231,_0xefcecd){return client[_0x25db('0x2')](_0x25db('0x6'),{'body':_0xefcecd,'options':{'where':{'id':_0x201231}},'log':_0x25db('0x7')});}; \ No newline at end of file +var _0x432b=['addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction'];(function(_0x68061e,_0x31ead8){var _0x5b3b61=function(_0x481642){while(--_0x481642){_0x68061e['push'](_0x68061e['shift']());}};_0x5b3b61(++_0x31ead8);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xb432('0x0'));exports['update']=function(_0x3b6273,_0x37fb3d){return client[_0xb432('0x1')](_0xb432('0x2'),{'body':_0x37fb3d,'options':{'where':{'id':_0x3b6273}},'log':'updateSmsInteraction'});};exports['addTags']=function(_0x93e722,_0x4cefc4){return client[_0xb432('0x1')]('AddTagsToSmsInteraction',{'body':_0x4cefc4,'options':{'where':{'id':_0x93e722}},'log':_0xb432('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 1f3ff59..eed856e 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 _0x42a8=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x2251b8,_0x36f2cc){var _0x563bf1=function(_0x777746){while(--_0x777746){_0x2251b8['push'](_0x2251b8['shift']());}};_0x563bf1(++_0x36f2cc);}(_0x42a8,0x69));var _0x842a=function(_0x4c0972,_0x115a79){_0x4c0972=_0x4c0972-0x0;var _0x37d513=_0x42a8[_0x4c0972];return _0x37d513;};'use strict';var client=require(_0x842a('0x0'));exports[_0x842a('0x1')]=function(_0xf0ac6d){return client[_0x842a('0x2')](_0x842a('0x3'),{'body':_0xf0ac6d,'log':_0x842a('0x4')});}; \ No newline at end of file +var _0x3690=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x5e9fac,_0x17364a){var _0x438973=function(_0x593cf3){while(--_0x593cf3){_0x5e9fac['push'](_0x5e9fac['shift']());}};_0x438973(++_0x17364a);}(_0x3690,0xfa));var _0x0369=function(_0x5076bb,_0x10fd12){_0x5076bb=_0x5076bb-0x0;var _0x2d19ee=_0x3690[_0x5076bb];return _0x2d19ee;};'use strict';var client=require(_0x0369('0x0'));exports[_0x0369('0x1')]=function(_0x1278a0){return client['Request'](_0x0369('0x2'),{'body':_0x1278a0,'log':_0x0369('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 54323e1..48ce03c 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x576e92,_0x165314){var _0x24c32e=function(_0x1648b1){while(--_0x1648b1){_0x576e92['push'](_0x576e92['shift']());}};_0x24c32e(++_0x165314);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x962361,_0x28f0c6){var _0x3a12fa=function(_0x2a85c6){while(--_0x2a85c6){_0x962361['push'](_0x962361['shift']());}};_0x3a12fa(++_0x28f0c6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 3b3a0be..6571aa6 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 _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x48a80d,_0x1b2aaf){var _0x267bcb=function(_0x5e7234){while(--_0x5e7234){_0x48a80d['push'](_0x48a80d['shift']());}};_0x267bcb(++_0x1b2aaf);}(_0x008c,0x188));var _0xc008=function(_0x32e4de,_0x7da1c5){_0x32e4de=_0x32e4de-0x0;var _0x51ba2a=_0x008c[_0x32e4de];return _0x51ba2a;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x2438ef,_0xe999c1){var _0x114731=function(_0x72a6cd){while(--_0x72a6cd){_0x2438ef['push'](_0x2438ef['shift']());}};_0x114731(++_0xe999c1);}(_0x34e8,0x12c));var _0x834e=function(_0x464c3c,_0x346e7e){_0x464c3c=_0x464c3c-0x0;var _0x102b75=_0x34e8[_0x464c3c];return _0x102b75;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index fcfb5ad..f7a40cf 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(_0x164e4e,_0x248d08){var _0x17ad12=function(_0x4829d3){while(--_0x4829d3){_0x164e4e['push'](_0x164e4e['shift']());}};_0x17ad12(++_0x248d08);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0xca4742,_0x2213c8){var _0x2b21a5=function(_0x203585){while(--_0x203585){_0xca4742['push'](_0xca4742['shift']());}};_0x2b21a5(++_0x2213c8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'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 6eff89b..c5786c9 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 _0x0d91=['update','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','../client'];(function(_0x3633f0,_0x36e377){var _0x358b02=function(_0x27d239){while(--_0x27d239){_0x3633f0['push'](_0x3633f0['shift']());}};_0x358b02(++_0x36e377);}(_0x0d91,0x76));var _0x10d9=function(_0x215971,_0x37ea84){_0x215971=_0x215971-0x0;var _0x1031a4=_0x0d91[_0x215971];return _0x1031a4;};'use strict';var client=require(_0x10d9('0x0'));exports[_0x10d9('0x1')]=function(_0x369f92,_0x37895e){return client['Request'](_0x10d9('0x2'),{'body':_0x37895e,'options':{'where':{'id':_0x369f92}},'log':_0x10d9('0x3')});};exports[_0x10d9('0x4')]=function(_0x56ab5d,_0x2f6e57){return client[_0x10d9('0x5')](_0x10d9('0x6'),{'body':_0x2f6e57,'options':{'where':{'id':_0x56ab5d}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xed5c=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x2d13b3,_0xcfdcca){var _0x3b64aa=function(_0x10c4e7){while(--_0x10c4e7){_0x2d13b3['push'](_0x2d13b3['shift']());}};_0x3b64aa(++_0xcfdcca);}(_0xed5c,0x81));var _0xced5=function(_0x129df0,_0x4a7f3d){_0x129df0=_0x129df0-0x0;var _0x8d9a76=_0xed5c[_0x129df0];return _0x8d9a76;};'use strict';var client=require(_0xced5('0x0'));exports[_0xced5('0x1')]=function(_0x2c59c3,_0x21fae7){return client[_0xced5('0x2')](_0xced5('0x3'),{'body':_0x21fae7,'options':{'where':{'id':_0x2c59c3}},'log':_0xced5('0x4')});};exports[_0xced5('0x5')]=function(_0x2b8184,_0x2ec4f9){return client['Request'](_0xced5('0x6'),{'body':_0x2ec4f9,'options':{'where':{'id':_0x2b8184}},'log':_0xced5('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index d124755..4d1f897 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 _0xe1b2=['CreateWhatsappMessage','createWhatsappMessage','create'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe1b2,0x1bb));var _0x2e1b=function(_0x1b6336,_0x515008){_0x1b6336=_0x1b6336-0x0;var _0x23b165=_0xe1b2[_0x1b6336];return _0x23b165;};'use strict';var client=require('../client');exports[_0x2e1b('0x0')]=function(_0x368a76){return client['Request'](_0x2e1b('0x1'),{'body':_0x368a76,'log':_0x2e1b('0x2')});}; \ No newline at end of file +var _0x7071=['Request','createWhatsappMessage','../client'];(function(_0x1f222a,_0x1210d4){var _0x401901=function(_0x6a94d){while(--_0x6a94d){_0x1f222a['push'](_0x1f222a['shift']());}};_0x401901(++_0x1210d4);}(_0x7071,0x12b));var _0x1707=function(_0x44a0ce,_0x455244){_0x44a0ce=_0x44a0ce-0x0;var _0x4ff348=_0x7071[_0x44a0ce];return _0x4ff348;};'use strict';var client=require(_0x1707('0x0'));exports['create']=function(_0x1a5499){return client[_0x1707('0x1')]('CreateWhatsappMessage',{'body':_0x1a5499,'log':_0x1707('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index ff9be29..a0db552 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 _0xa4ef=['GetWhatsappQueue','name','timeout','strategy','Agents','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x8af28f,_0x4bd7e8){var _0x1b64b9=function(_0x2fd8fb){while(--_0x2fd8fb){_0x8af28f['push'](_0x8af28f['shift']());}};_0x1b64b9(++_0x4bd7e8);}(_0xa4ef,0x166));var _0xfa4e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa4ef[_0xfae23b];return _0x200640;};'use strict';var client=require(_0xfa4e('0x0'));exports[_0xfa4e('0x1')]=function(){return function(){return client['Request'](_0xfa4e('0x2'),{'options':{'raw':![],'attributes':['id',_0xfa4e('0x3'),_0xfa4e('0x4'),_0xfa4e('0x5')],'include':[{'model':'User','as':_0xfa4e('0x6'),'attributes':['id',_0xfa4e('0x3'),_0xfa4e('0x7'),_0xfa4e('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x720a=['name','timeout','User','Agents','online','../client','getWhatsappQueues','GetWhatsappQueue'];(function(_0x59cc6b,_0xfb135a){var _0x28a0e7=function(_0x362594){while(--_0x362594){_0x59cc6b['push'](_0x59cc6b['shift']());}};_0x28a0e7(++_0xfb135a);}(_0x720a,0x17d));var _0xa720=function(_0x39f407,_0x361939){_0x39f407=_0x39f407-0x0;var _0x2f6ada=_0x720a[_0x39f407];return _0x2f6ada;};'use strict';var client=require(_0xa720('0x0'));exports[_0xa720('0x1')]=function(){return function(){return client['Request'](_0xa720('0x2'),{'options':{'raw':![],'attributes':['id',_0xa720('0x3'),_0xa720('0x4'),'strategy'],'include':[{'model':_0xa720('0x5'),'as':_0xa720('0x6'),'attributes':['id',_0xa720('0x3'),_0xa720('0x7'),'whatsappPause']}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 3d7e800..7310ed8 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 _0xa700=['UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport','update','DESC'];(function(_0x2f8176,_0x3883bf){var _0x22706b=function(_0x530c3c){while(--_0x530c3c){_0x2f8176['push'](_0x2f8176['shift']());}};_0x22706b(++_0x3883bf);}(_0xa700,0x12e));var _0x0a70=function(_0x3d577d,_0x44719f){_0x3d577d=_0x3d577d-0x0;var _0xcd0890=_0xa700[_0x3d577d];return _0xcd0890;};'use strict';var client=require(_0x0a70('0x0'));exports[_0x0a70('0x1')]=function(_0x4bbde0){return client[_0x0a70('0x2')](_0x0a70('0x3'),{'body':_0x4bbde0,'log':'CreateWhatsappQueueReport'});};exports[_0x0a70('0x4')]=function(_0x592543,_0x593bd9){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x593bd9,'options':{'where':{'uniqueid':_0x592543},'order':[['id',_0x0a70('0x5')]],'limit':0x1},'log':_0x0a70('0x6')});}; \ No newline at end of file +var _0x9207=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9207,0x1f3));var _0x7920=function(_0x1edf2a,_0x55c423){_0x1edf2a=_0x1edf2a-0x0;var _0x5698f0=_0x9207[_0x1edf2a];return _0x5698f0;};'use strict';var client=require(_0x7920('0x0'));exports['create']=function(_0x55e86b){return client[_0x7920('0x1')](_0x7920('0x2'),{'body':_0x55e86b,'log':_0x7920('0x2')});};exports[_0x7920('0x3')]=function(_0x10b176,_0x14984f){return client[_0x7920('0x1')](_0x7920('0x4'),{'body':_0x14984f,'options':{'where':{'uniqueid':_0x10b176},'order':[['id','DESC']],'limit':0x1},'log':_0x7920('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 9aa3120..e97ea2e 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 _0x7cc0=['map','message','join','stop','agents','timeout','atimeout','channel','START:%s','rules','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s'];(function(_0x1bd570,_0x7edb64){var _0x37a47f=function(_0x2c3065){while(--_0x2c3065){_0x1bd570['push'](_0x1bd570['shift']());}};_0x37a47f(++_0x7edb64);}(_0x7cc0,0x78));var _0x07cc=function(_0xf1e845,_0xcbc923){_0xf1e845=_0xf1e845-0x0;var _0xa7c0b0=_0x7cc0[_0xf1e845];return _0xa7c0b0;};'use strict';var schema=require(_0x07cc('0x0'));var _=require(_0x07cc('0x1'));var util=require('util');var seqqueue=require(_0x07cc('0x2'));var logger=require('../../../../config/logger')(_0x07cc('0x3'));var strategy=require(_0x07cc('0x4'));var queue=schema({'name':{'type':_0x07cc('0x5'),'required':!![],'message':_0x07cc('0x6')},'timeout':{'type':'number','message':_0x07cc('0x7')}});function writeLog(_0x514c43,_0x3fdcea,_0x2d37f5){return logger[_0x07cc('0x8')](util[_0x07cc('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x514c43,_0x3fdcea[_0x07cc('0xa')],_0x2d37f5));}function handleFindAgent(_0x4c8217){return function(_0x31b15a){return _0x31b15a[_0x07cc('0xa')][_0x07cc('0xb')]()===_0x4c8217[_0x07cc('0xb')]();};}exports[_0x07cc('0xc')]=function(_0x276149,_0x454282,_0x2df31a,_0x2dac4f){return function(_0x48c5aa){try{var _0x1b4a88={'name':_0x454282[0x0],'timeout':_0x454282[0x1]};var _0x297d5f=queue[_0x07cc('0x0')](_0x1b4a88,{'typecast':!![]});if(_0x297d5f[_0x07cc('0xd')]){logger[_0x07cc('0xe')](_0x07cc('0xf'),_0x276149,_[_0x07cc('0x10')](_0x297d5f,_0x07cc('0x11'))[_0x07cc('0x12')](',\x20'));_0x48c5aa[_0x07cc('0x13')]();}else{var _0x3b8041=_['find'](_0x2df31a[_0x07cc('0x14')],handleFindAgent(_0x1b4a88[_0x07cc('0xa')]));if(_0x3b8041){var _0x274f12=(_0x1b4a88[_0x07cc('0x15')]||0xa)*0x3e8;var _0x444878,_0x3c81ab;var _0x51644c=seqqueue['createQueue'](_0x274f12);_0x51644c['id']=_0x276149;_0x51644c[_0x07cc('0x16')]=_0x274f12;_0x51644c['channel']=_0x2dac4f[_0x07cc('0x17')];writeLog(_0x276149,_0x3b8041,util['format'](_0x07cc('0x18'),_0x274f12));_0x2df31a[_0x07cc('0x19')][_0x276149]['on']('end',function(){logger['info'](_0x07cc('0x1a'),_0x276149);clearTimeout(_0x3c81ab);_0x3c81ab=undefined;_0x51644c[_0x07cc('0x1b')]();if(_0x2df31a[_0x07cc('0x19')][_0x276149]){delete _0x2df31a[_0x07cc('0x19')][_0x276149];}_0x48c5aa['stop']();});_0x2df31a[_0x07cc('0x19')][_0x276149]['on'](_0x07cc('0x1c'),function(){if(_0x2df31a[_0x07cc('0x19')][_0x276149]){delete _0x2df31a[_0x07cc('0x19')][_0x276149];}});_0x3c81ab=setTimeout(function(){logger[_0x07cc('0x8')](_0x07cc('0x1d'),_0x276149);clearTimeout(_0x3c81ab);_0x51644c[_0x07cc('0x1b')]();_0x48c5aa[_0x07cc('0x1e')]();},_0x274f12);strategy[_0x07cc('0x1f')](_0x51644c,_0x3b8041,_0x2df31a,_0x2dac4f);}else{logger[_0x07cc('0xe')](_0x07cc('0x20'),_0x276149,_0x1b4a88[_0x07cc('0xa')]);_0x48c5aa['stop']();}}}catch(_0x2f7152){console['log'](_0x2f7152);logger[_0x07cc('0xe')]('[%s][QUEUE]\x20%s',_0x276149,_0x2f7152[_0x07cc('0x21')]);_0x48c5aa[_0x07cc('0x13')]();}};}; \ No newline at end of file +var _0xc0de=['seq-queue','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','format','name','toLowerCase','consequence','length','error','map','join','stop','find','agents','timeout','createQueue','atimeout','channel','rules','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][QUEUE]\x20%s','stack','validate','util'];(function(_0x47c39d,_0x3eea90){var _0xd41416=function(_0x24d049){while(--_0x24d049){_0x47c39d['push'](_0x47c39d['shift']());}};_0xd41416(++_0x3eea90);}(_0xc0de,0x11e));var _0xec0d=function(_0x18e5c3,_0x569c0b){_0x18e5c3=_0x18e5c3-0x0;var _0x11dcb3=_0xc0de[_0x18e5c3];return _0x11dcb3;};'use strict';var schema=require(_0xec0d('0x0'));var _=require('lodash');var util=require(_0xec0d('0x1'));var seqqueue=require(_0xec0d('0x2'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0xec0d('0x3'));var queue=schema({'name':{'type':_0xec0d('0x4'),'required':!![],'message':_0xec0d('0x5')},'timeout':{'type':_0xec0d('0x6'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x1fb3a6,_0x562c1f,_0x124a6d){return logger['info'](util[_0xec0d('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1fb3a6,_0x562c1f['name'],_0x124a6d));}function handleFindAgent(_0x3105bf){return function(_0x246c9e){return _0x246c9e[_0xec0d('0x8')]['toLowerCase']()===_0x3105bf[_0xec0d('0x9')]();};}exports[_0xec0d('0xa')]=function(_0xf62a5c,_0x2aad55,_0x35b9de,_0x5ab4ff){return function(_0x58dccf){try{var _0x52e542={'name':_0x2aad55[0x0],'timeout':_0x2aad55[0x1]};var _0xcae47e=queue[_0xec0d('0x0')](_0x52e542,{'typecast':!![]});if(_0xcae47e[_0xec0d('0xb')]){logger[_0xec0d('0xc')]('[%s][AGENT]\x20%s',_0xf62a5c,_[_0xec0d('0xd')](_0xcae47e,'message')[_0xec0d('0xe')](',\x20'));_0x58dccf[_0xec0d('0xf')]();}else{var _0x17349a=_[_0xec0d('0x10')](_0x35b9de[_0xec0d('0x11')],handleFindAgent(_0x52e542[_0xec0d('0x8')]));if(_0x17349a){var _0x384222=(_0x52e542[_0xec0d('0x12')]||0xa)*0x3e8;var _0x4bf9bc,_0x29a5ed;var _0x194282=seqqueue[_0xec0d('0x13')](_0x384222);_0x194282['id']=_0xf62a5c;_0x194282[_0xec0d('0x14')]=_0x384222;_0x194282[_0xec0d('0x15')]=_0x5ab4ff[_0xec0d('0x15')];writeLog(_0xf62a5c,_0x17349a,util[_0xec0d('0x7')]('START:%s',_0x384222));_0x35b9de[_0xec0d('0x16')][_0xf62a5c]['on']('end',function(){logger[_0xec0d('0x17')](_0xec0d('0x18'),_0xf62a5c);clearTimeout(_0x29a5ed);_0x29a5ed=undefined;_0x194282[_0xec0d('0x19')]();if(_0x35b9de['rules'][_0xf62a5c]){delete _0x35b9de[_0xec0d('0x16')][_0xf62a5c];}_0x58dccf[_0xec0d('0xf')]();});_0x35b9de['rules'][_0xf62a5c]['on'](_0xec0d('0x1a'),function(){if(_0x35b9de[_0xec0d('0x16')][_0xf62a5c]){delete _0x35b9de[_0xec0d('0x16')][_0xf62a5c];}});_0x29a5ed=setTimeout(function(){logger[_0xec0d('0x17')](_0xec0d('0x1b'),_0xf62a5c);clearTimeout(_0x29a5ed);_0x194282['close']();_0x58dccf[_0xec0d('0x1c')]();},_0x384222);strategy[_0xec0d('0x1d')](_0x194282,_0x17349a,_0x35b9de,_0x5ab4ff);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0xf62a5c,_0x52e542['name']);_0x58dccf[_0xec0d('0xf')]();}}}catch(_0x1c0cdc){console['log'](_0x1c0cdc);logger[_0xec0d('0xc')](_0xec0d('0x1e'),_0xf62a5c,_0x1c0cdc[_0xec0d('0x1f')]);_0x58dccf[_0xec0d('0xf')]();}};}; \ 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 9a92fb5..4328913 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 _0x31a6=['isEmpty','body','create','then','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','$LATEST','message','amazonlex','providerResponse','stringify','Failed','catch','moment','aws-sdk','routing','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','AccountId','upperFirst','InteractionId','created'];(function(_0x31b1ab,_0x384147){var _0x58ed0a=function(_0x4d3c70){while(--_0x4d3c70){_0x31b1ab['push'](_0x31b1ab['shift']());}};_0x58ed0a(++_0x384147);}(_0x31a6,0x105));var _0x631a=function(_0x27fee1,_0x136caa){_0x27fee1=_0x27fee1-0x0;var _0x53ea80=_0x31a6[_0x27fee1];return _0x53ea80;};'use strict';var _=require('lodash');var moment=require(_0x631a('0x0'));var AWS=require(_0x631a('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x631a('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x631a('0x3')),'smsMessage':require(_0x631a('0x4')),'faxMessage':require(_0x631a('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x631a('0x6')]=function(_0x439696,_0x5a0995){return function(_0x30b0ed){try{if(!_[_0x631a('0x7')](this[_0x631a('0x8')]['UserId'])){logger[_0x631a('0x9')](_0x631a('0xa'),_0x439696,_0x631a('0xb'));return _0x30b0ed[_0x631a('0xc')]();}var _0x2ad190={'ContactId':this['contact']['id'],'sentAt':moment()[_0x631a('0xd')](_0x631a('0xe')),'direction':_0x631a('0xf')};if(this[_0x631a('0x10')]===_0x631a('0x11')||this[_0x631a('0x10')]===_0x631a('0x12')){_0x2ad190[_0x631a('0x13')]=this[_0x631a('0x8')][_0x631a('0x13')];}var _0x210217=this[_0x631a('0x10')];if(_0x210217===_0x631a('0x14')){_0x2ad190['ChatWebsiteId']=this[_0x631a('0x15')]['id'];}else{_0x2ad190[_['upperFirst'](_0x210217)+_0x631a('0x16')]=this[_0x631a('0x15')]['id'];}_0x2ad190[_[_0x631a('0x17')](_0x210217)+_0x631a('0x18')]=this[_0x631a('0x8')]['id'];if(this['interaction'][_0x631a('0x19')]){var _0x3dbd97=_0x5a0995[0x4];if(!_[_0x631a('0x1a')](_0x3dbd97)){_0x2ad190[_0x631a('0x1b')]=utils['getMustacheRender'](_0x3dbd97,this);return rpc[_0x210217+'Message'][_0x631a('0x1c')](_0x2ad190)[_0x631a('0x1d')](function(_0x464922){logger['info'](_0x631a('0xa'),_0x439696,_0x2ad190['body']);})['catch'](function(_0xbdd38f){logger[_0x631a('0x1e')](_0x631a('0xa'),_0x439696,JSON['stringify'](_0xbdd38f));})['finally'](function(){logger['info'](_0x631a('0x1f'),_0x439696);_0x30b0ed[_0x631a('0x20')]();});}else{logger[_0x631a('0x9')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x439696);_0x30b0ed[_0x631a('0x20')]();}}else{var _0x1bc96e=this;var _0x2937e2=new AWS[(_0x631a('0x21'))]({'accessKeyId':_0x5a0995[0x0],'secretAccessKey':_0x5a0995[0x1],'region':_0x5a0995[0x2]});var _0x5289b8={'botAlias':_0x631a('0x22'),'botName':_0x5a0995[0x3],'inputText':this['message'][_0x631a('0x1b')],'userId':this['channel']+':'+this[_0x631a('0x8')]['id']['toString']()};_0x2937e2['postText'](_0x5289b8,function(_0x2fa3c8,_0xda42cc){if(_0x2fa3c8){logger[_0x631a('0x1e')](_0x631a('0xa'),_0x439696,_0x2fa3c8[_0x631a('0x23')]);_0x30b0ed['next']();}else if(_0xda42cc&&_0xda42cc['message']){_0x1bc96e['body'][_0x631a('0x24')]=_0xda42cc;_0x2ad190['body']=_0xda42cc[_0x631a('0x23')];_0x2ad190['providerName']=_0x631a('0x24');_0x2ad190[_0x631a('0x25')]=JSON[_0x631a('0x26')](_0xda42cc);return rpc[_0x210217+'Message'][_0x631a('0x1c')](_0x2ad190)[_0x631a('0x1d')](function(_0x54bc17){logger[_0x631a('0x9')](_0x631a('0xa'),_0x439696,_0x2ad190['body']);if(_0xda42cc['dialogState']==_0x631a('0x27')){_0x30b0ed[_0x631a('0xc')]();}else{_0x30b0ed[_0x631a('0x20')]();}})[_0x631a('0x28')](function(_0x2e8122){logger[_0x631a('0x1e')](_0x631a('0xa'),_0x439696,JSON[_0x631a('0x26')](_0x2e8122));_0x30b0ed[_0x631a('0xc')]();});}else{_0x30b0ed[_0x631a('0xc')]();}});}}catch(_0x501d7f){logger[_0x631a('0x1e')](_0x631a('0xa'),_0x439696,JSON['stringify'](_0x501d7f));_0x30b0ed[_0x631a('0x20')]();}};}; \ No newline at end of file +var _0xdaa4=['../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','info','[%s][AMAZONLEX]\x20%s','next','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId','upperFirst','AccountId','account','created','body','Message','create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','Failed','aws-sdk','routing'];(function(_0x21e13b,_0x400a1){var _0x352262=function(_0x2dfb1e){while(--_0x2dfb1e){_0x21e13b['push'](_0x21e13b['shift']());}};_0x352262(++_0x400a1);}(_0xdaa4,0xc1));var _0x4daa=function(_0x5e09ed,_0x3a2790){_0x5e09ed=_0x5e09ed-0x0;var _0x553ad6=_0xdaa4[_0x5e09ed];return _0x553ad6;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x4daa('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x4daa('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4daa('0x2')),'mailMessage':require(_0x4daa('0x3')),'smsMessage':require(_0x4daa('0x4')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4daa('0x5'))};exports[_0x4daa('0x6')]=function(_0x3cc5b6,_0x21d3e0){return function(_0x1d2e81){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0x4daa('0x7')](_0x4daa('0x8'),_0x3cc5b6,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1d2e81[_0x4daa('0x9')]();}var _0x491006={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this[_0x4daa('0xa')]===_0x4daa('0xb')||this[_0x4daa('0xa')]===_0x4daa('0xc')){_0x491006[_0x4daa('0xd')]=this[_0x4daa('0xe')][_0x4daa('0xd')];}var _0xc286d5=this['channel'];if(_0xc286d5===_0x4daa('0xf')){_0x491006[_0x4daa('0x10')]=this['account']['id'];}else{_0x491006[_[_0x4daa('0x11')](_0xc286d5)+_0x4daa('0x12')]=this[_0x4daa('0x13')]['id'];}_0x491006[_[_0x4daa('0x11')](_0xc286d5)+'InteractionId']=this['interaction']['id'];if(this[_0x4daa('0xe')][_0x4daa('0x14')]){var _0x1ef970=_0x21d3e0[0x4];if(!_['isEmpty'](_0x1ef970)){_0x491006[_0x4daa('0x15')]=utils['getMustacheRender'](_0x1ef970,this);return rpc[_0xc286d5+_0x4daa('0x16')][_0x4daa('0x17')](_0x491006)[_0x4daa('0x18')](function(_0x3fb23f){logger[_0x4daa('0x7')](_0x4daa('0x8'),_0x3cc5b6,_0x491006[_0x4daa('0x15')]);})[_0x4daa('0x19')](function(_0x42a2a7){logger[_0x4daa('0x1a')]('[%s][AMAZONLEX]\x20%s',_0x3cc5b6,JSON[_0x4daa('0x1b')](_0x42a2a7));})[_0x4daa('0x1c')](function(){logger[_0x4daa('0x7')](_0x4daa('0x1d'),_0x3cc5b6);_0x1d2e81[_0x4daa('0x1e')]();});}else{logger[_0x4daa('0x7')](_0x4daa('0x1f'),_0x3cc5b6);_0x1d2e81['stop']();}}else{var _0x40f27d=this;var _0x2655fc=new AWS[(_0x4daa('0x20'))]({'accessKeyId':_0x21d3e0[0x0],'secretAccessKey':_0x21d3e0[0x1],'region':_0x21d3e0[0x2]});var _0xd37ecf={'botAlias':_0x4daa('0x21'),'botName':_0x21d3e0[0x3],'inputText':this[_0x4daa('0x22')]['body'],'userId':this['channel']+':'+this[_0x4daa('0xe')]['id'][_0x4daa('0x23')]()};_0x2655fc[_0x4daa('0x24')](_0xd37ecf,function(_0x1857ab,_0xfd33ec){if(_0x1857ab){logger['error']('[%s][AMAZONLEX]\x20%s',_0x3cc5b6,_0x1857ab[_0x4daa('0x22')]);_0x1d2e81[_0x4daa('0x9')]();}else if(_0xfd33ec&&_0xfd33ec[_0x4daa('0x22')]){_0x40f27d[_0x4daa('0x15')]['amazonlex']=_0xfd33ec;_0x491006[_0x4daa('0x15')]=_0xfd33ec[_0x4daa('0x22')];_0x491006['providerName']=_0x4daa('0x25');_0x491006['providerResponse']=JSON['stringify'](_0xfd33ec);return rpc[_0xc286d5+'Message'][_0x4daa('0x17')](_0x491006)[_0x4daa('0x18')](function(_0x3b582a){logger['info'](_0x4daa('0x8'),_0x3cc5b6,_0x491006[_0x4daa('0x15')]);if(_0xfd33ec['dialogState']==_0x4daa('0x26')){_0x1d2e81[_0x4daa('0x9')]();}else{_0x1d2e81[_0x4daa('0x1e')]();}})[_0x4daa('0x19')](function(_0x1118ee){logger[_0x4daa('0x1a')](_0x4daa('0x8'),_0x3cc5b6,JSON[_0x4daa('0x1b')](_0x1118ee));_0x1d2e81[_0x4daa('0x9')]();});}else{_0x1d2e81[_0x4daa('0x9')]();}});}}catch(_0x43030e){logger[_0x4daa('0x1a')](_0x4daa('0x8'),_0x3cc5b6,JSON[_0x4daa('0x1b')](_0x43030e));_0x1d2e81[_0x4daa('0x1e')]();}};}; \ 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 211c02c..e832be5 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 _0xfda8=['YYYY-MM-DD\x20HH:mm:ss','mail','getMustacheRender','message','from','phone','read','subject','Re:','Re:\x20','chat','account','AccountId','InteractionId','service','Smtp','host','port','secure','auth','user','inReplyTo','','replace','','auto-replied','All','auto_reply','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','body','stop','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','next','autoreplyExecuted','One\x20Time\x20already\x20sent','channel','contact','format'];(function(_0x50047c,_0x1f34fe){var _0x1943e3=function(_0x5e96cd){while(--_0x5e96cd){_0x50047c['push'](_0x50047c['shift']());}};_0x1943e3(++_0x1f34fe);}(_0xfda8,0x153));var _0x8fda=function(_0x4b2bf2,_0x5cb8da){_0x4b2bf2=_0x4b2bf2-0x0;var _0x290072=_0xfda8[_0x4b2bf2];return _0x290072;};'use strict';var _=require('lodash');var moment=require(_0x8fda('0x0'));var utils=require('./utils');var logger=require(_0x8fda('0x1'))(_0x8fda('0x2'));var rpc={'chatMessage':require(_0x8fda('0x3')),'openchannelMessage':require(_0x8fda('0x4')),'mailMessage':require(_0x8fda('0x5')),'smsMessage':require(_0x8fda('0x6')),'faxMessage':require(_0x8fda('0x7')),'whatsappMessage':require(_0x8fda('0x8')),'chatInteraction':require(_0x8fda('0x9')),'openchannelInteraction':require(_0x8fda('0xa')),'mailInteraction':require(_0x8fda('0xb')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x8fda('0xc'))};var mailRpc=require(_0x8fda('0xd'));exports[_0x8fda('0xe')]=function(_0x256db8,_0x2be7fd){return function(_0x59ebb8){try{if(_0x2be7fd[0x0]==='1'&&(_[_0x8fda('0xf')](this[_0x8fda('0x10')][_0x8fda('0x11')])||!this[_0x8fda('0x10')]['created'])){logger[_0x8fda('0x12')](_0x8fda('0x13'),_0x256db8,'Autoreply\x20already\x20sent');return _0x59ebb8[_0x8fda('0x14')]();}if(_0x2be7fd[0x0]==='2'&&this[_0x8fda('0x10')][_0x8fda('0x15')]){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x256db8,_0x8fda('0x16'));return _0x59ebb8[_0x8fda('0x14')]();}var _0x47adc0=this[_0x8fda('0x17')];var _0x4fd3c5={'ContactId':this[_0x8fda('0x18')]['id'],'sentAt':moment()[_0x8fda('0x19')](_0x8fda('0x1a')),'direction':'out'};if(this[_0x8fda('0x17')]===_0x8fda('0x1b')){_0x4fd3c5['body']=utils[_0x8fda('0x1c')](_0x2be7fd[0x2],this);}else{_0x4fd3c5['body']=utils['getMustacheRender'](_0x2be7fd[0x1],this);}if(this[_0x8fda('0x1d')]){_0x4fd3c5['to']=this[_0x8fda('0x1d')][_0x8fda('0x1e')]||'';if(this[_0x8fda('0x17')]===_0x8fda('0x1b')&&_0x2be7fd[0x1]==='1'){_0x4fd3c5['cc']=this['message']['cc']||'';}_0x4fd3c5['from']=this[_0x8fda('0x1d')]['to']||'';_0x4fd3c5['phone']=this[_0x8fda('0x1d')][_0x8fda('0x1f')]||'';_0x4fd3c5[_0x8fda('0x20')]=!![];if(this[_0x8fda('0x1d')][_0x8fda('0x21')]){_0x4fd3c5[_0x8fda('0x21')]='';_0x4fd3c5[_0x8fda('0x21')]+=_['startsWith'](this[_0x8fda('0x1d')][_0x8fda('0x21')],_0x8fda('0x22'))?'':_0x8fda('0x23');_0x4fd3c5[_0x8fda('0x21')]+=this[_0x8fda('0x1d')][_0x8fda('0x21')];}}if(this[_0x8fda('0x17')]===_0x8fda('0x24')){_0x4fd3c5['ChatWebsiteId']=this[_0x8fda('0x25')]['id'];}else{_0x4fd3c5[_['upperFirst'](this['channel'])+_0x8fda('0x26')]=this[_0x8fda('0x25')]['id'];}_0x4fd3c5[_['upperFirst'](this[_0x8fda('0x17')])+_0x8fda('0x27')]=this[_0x8fda('0x10')]['id'];var _0x4f78b1=this[_0x8fda('0x10')];if(rpc[this[_0x8fda('0x17')]+'Message']){if(this[_0x8fda('0x17')]===_0x8fda('0x1b')){var _0x2d82e1={'tls':{'rejectUnauthorized':![]}};if(this[_0x8fda('0x25')]['Smtp'][_0x8fda('0x28')]){_0x2d82e1[_0x8fda('0x28')]=this[_0x8fda('0x25')]['Smtp'][_0x8fda('0x28')];}else{_0x2d82e1['host']=this[_0x8fda('0x25')][_0x8fda('0x29')][_0x8fda('0x2a')];_0x2d82e1[_0x8fda('0x2b')]=this[_0x8fda('0x25')][_0x8fda('0x29')][_0x8fda('0x2b')];_0x2d82e1[_0x8fda('0x2c')]=this['account'][_0x8fda('0x29')][_0x8fda('0x2c')];}if(this['account'][_0x8fda('0x29')]['authentication']){_0x2d82e1[_0x8fda('0x2d')]={'user':this['account']['Smtp'][_0x8fda('0x2e')],'pass':this[_0x8fda('0x25')]['Smtp']['pass']};}_0x4fd3c5[_0x8fda('0x2f')]=this['message']['messageId'];_0x4fd3c5['html']=_0x8fda('0x30')+_[_0x8fda('0x31')](_0x4fd3c5['body'],_0x8fda('0x32'),_0x8fda('0x33'))+_0x8fda('0x34');_0x4fd3c5['headers']={'Auto-Submitted':_0x8fda('0x35'),'X-Auto-Response-Suppress':_0x8fda('0x36'),'Precedence':_0x8fda('0x37')};return mailRpc[_0x8fda('0x38')](_0x2d82e1,_0x4fd3c5)[_0x8fda('0x39')](function(_0xd72ba6){logger[_0x8fda('0x12')](_0x8fda('0x3a'),_0x256db8);_0x4fd3c5[_0x8fda('0x3b')]=_0xd72ba6[_0x8fda('0x1d')][_0x8fda('0x3b')];return rpc[_0x47adc0+_0x8fda('0x3c')][_0x8fda('0x3d')](_0x4fd3c5);})[_0x8fda('0x39')](function(_0x4a8652){logger[_0x8fda('0x12')](_0x8fda('0x13'),_0x256db8,JSON[_0x8fda('0x3e')](_0x4a8652));})[_0x8fda('0x3f')](function(_0x152db6){logger['error'](_0x8fda('0x40'),_0x256db8,JSON[_0x8fda('0x3e')](_0x152db6));})[_0x8fda('0x41')](function(){Promise['resolve']()[_0x8fda('0x39')](function(){if(_0x2be7fd[0x0]!=='2'||_0x4f78b1[_0x8fda('0x15')])return;return rpc[_0x47adc0+_0x8fda('0x42')][_0x8fda('0x43')](_0x4f78b1['id'],{'autoreplyExecuted':!![]})['then'](function(_0x5a5a07){logger['info'](_0x8fda('0x44'),_0x256db8,JSON['stringify'](_0x5a5a07));})[_0x8fda('0x3f')](function(_0x1e37bf){logger[_0x8fda('0x45')](_0x8fda('0x46'),_0x256db8,JSON[_0x8fda('0x3e')](_0x1e37bf));});})[_0x8fda('0x39')](function(){_0x59ebb8[_0x8fda('0x14')]();});});}else{return rpc[this[_0x8fda('0x17')]+_0x8fda('0x3c')][_0x8fda('0x3d')](_0x4fd3c5)[_0x8fda('0x39')](function(_0x50db20){logger['info'](_0x8fda('0x13'),_0x256db8,_0x4fd3c5[_0x8fda('0x47')]);})[_0x8fda('0x3f')](function(_0x538753){logger[_0x8fda('0x45')](_0x8fda('0x13'),_0x256db8,JSON[_0x8fda('0x3e')](_0x538753));})['finally'](function(){Promise['resolve']()[_0x8fda('0x39')](function(){if(_0x2be7fd[0x0]!=='2'||_0x4f78b1[_0x8fda('0x15')])return;return rpc[_0x47adc0+'Interaction']['update'](_0x4f78b1['id'],{'autoreplyExecuted':!![]})[_0x8fda('0x39')](function(_0x6e8f8e){logger['info'](_0x8fda('0x44'),_0x256db8,JSON[_0x8fda('0x3e')](_0x6e8f8e));})['catch'](function(_0x1c676f){logger[_0x8fda('0x45')](_0x8fda('0x46'),_0x256db8,JSON['stringify'](_0x1c676f));});})['then'](function(){_0x59ebb8[_0x8fda('0x14')]();});});}}}catch(_0x3efd52){logger[_0x8fda('0x45')](_0x8fda('0x13'),_0x256db8,JSON['stringify'](_0x3efd52));_0x59ebb8[_0x8fda('0x48')]();}};}; \ No newline at end of file +var _0x77f0=['message','from','mail','phone','read','subject','startsWith','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','Smtp','service','host','port','secure','authentication','auth','messageId','html','replace','','auto-replied','All','sendMailMessage','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','autoreplyExecuted','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','resolve','Interaction','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','body'];(function(_0x51fddd,_0xbf504d){var _0x29b515=function(_0x1c4775){while(--_0x1c4775){_0x51fddd['push'](_0x51fddd['shift']());}};_0x29b515(++_0xbf504d);}(_0x77f0,0x102));var _0x077f=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x77f0[_0x1fc122];return _0xa2cb13;};'use strict';var _=require('lodash');var moment=require(_0x077f('0x0'));var utils=require(_0x077f('0x1'));var logger=require(_0x077f('0x2'))(_0x077f('0x3'));var rpc={'chatMessage':require(_0x077f('0x4')),'openchannelMessage':require(_0x077f('0x5')),'mailMessage':require(_0x077f('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x077f('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x077f('0x8')),'openchannelInteraction':require(_0x077f('0x9')),'mailInteraction':require(_0x077f('0xa')),'smsInteraction':require(_0x077f('0xb')),'faxInteraction':require(_0x077f('0xc')),'whatsappInteraction':require(_0x077f('0xd'))};var mailRpc=require('../../mailRpc');exports[_0x077f('0xe')]=function(_0x547981,_0x28f3c1){return function(_0x55f50e){try{if(_0x28f3c1[0x0]==='1'&&(_[_0x077f('0xf')](this[_0x077f('0x10')]['created'])||!this['interaction'][_0x077f('0x11')])){logger[_0x077f('0x12')](_0x077f('0x13'),_0x547981,_0x077f('0x14'));return _0x55f50e['next']();}if(_0x28f3c1[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger[_0x077f('0x12')](_0x077f('0x15'),_0x547981,'One\x20Time\x20already\x20sent');return _0x55f50e[_0x077f('0x16')]();}var _0x3ea9bc=this['channel'];var _0x347b22={'ContactId':this[_0x077f('0x17')]['id'],'sentAt':moment()[_0x077f('0x18')](_0x077f('0x19')),'direction':_0x077f('0x1a')};if(this[_0x077f('0x1b')]==='mail'){_0x347b22['body']=utils[_0x077f('0x1c')](_0x28f3c1[0x2],this);}else{_0x347b22[_0x077f('0x1d')]=utils[_0x077f('0x1c')](_0x28f3c1[0x1],this);}if(this[_0x077f('0x1e')]){_0x347b22['to']=this[_0x077f('0x1e')][_0x077f('0x1f')]||'';if(this[_0x077f('0x1b')]===_0x077f('0x20')&&_0x28f3c1[0x1]==='1'){_0x347b22['cc']=this[_0x077f('0x1e')]['cc']||'';}_0x347b22[_0x077f('0x1f')]=this['message']['to']||'';_0x347b22[_0x077f('0x21')]=this[_0x077f('0x1e')]['phone']||'';_0x347b22[_0x077f('0x22')]=!![];if(this[_0x077f('0x1e')][_0x077f('0x23')]){_0x347b22[_0x077f('0x23')]='';_0x347b22[_0x077f('0x23')]+=_[_0x077f('0x24')](this[_0x077f('0x1e')][_0x077f('0x23')],'Re:')?'':'Re:\x20';_0x347b22[_0x077f('0x23')]+=this['message'][_0x077f('0x23')];}}if(this[_0x077f('0x1b')]===_0x077f('0x25')){_0x347b22[_0x077f('0x26')]=this['account']['id'];}else{_0x347b22[_[_0x077f('0x27')](this[_0x077f('0x1b')])+_0x077f('0x28')]=this[_0x077f('0x29')]['id'];}_0x347b22[_['upperFirst'](this['channel'])+_0x077f('0x2a')]=this[_0x077f('0x10')]['id'];var _0x5390ef=this[_0x077f('0x10')];if(rpc[this[_0x077f('0x1b')]+_0x077f('0x2b')]){if(this[_0x077f('0x1b')]===_0x077f('0x20')){var _0x49b73d={'tls':{'rejectUnauthorized':![]}};if(this[_0x077f('0x29')][_0x077f('0x2c')][_0x077f('0x2d')]){_0x49b73d[_0x077f('0x2d')]=this[_0x077f('0x29')][_0x077f('0x2c')]['service'];}else{_0x49b73d[_0x077f('0x2e')]=this[_0x077f('0x29')][_0x077f('0x2c')][_0x077f('0x2e')];_0x49b73d['port']=this[_0x077f('0x29')][_0x077f('0x2c')][_0x077f('0x2f')];_0x49b73d[_0x077f('0x30')]=this[_0x077f('0x29')][_0x077f('0x2c')][_0x077f('0x30')];}if(this['account']['Smtp'][_0x077f('0x31')]){_0x49b73d[_0x077f('0x32')]={'user':this[_0x077f('0x29')]['Smtp']['user'],'pass':this[_0x077f('0x29')][_0x077f('0x2c')]['pass']};}_0x347b22['inReplyTo']=this['message'][_0x077f('0x33')];_0x347b22[_0x077f('0x34')]=''+_[_0x077f('0x35')](_0x347b22[_0x077f('0x1d')],']+(>|$)/g,''),'priorityTrue':_0xa4be5e[0x1],'priorityFalse':_0xa4be5e[0x2]};var _0x3ef80c=gotoif[_0x1703('0x0')](_0x59c5da,{'typecast':!![]});if(_0x3ef80c[_0x1703('0xd')]){logger['error'](_0x1703('0xe'),_0x3c8634,_[_0x1703('0xf')](_0x3ef80c,_0x1703('0x10'))[_0x1703('0x11')](',\x20'));_0x231f9b['stop']();}else{try{var _0x3ad1f6=eval('('+_0x59c5da[_0x1703('0x12')]+')');var _0x1fc26a=_0x3ad1f6?_0x59c5da['priorityTrue']:_0x59c5da[_0x1703('0x13')];logger['info'](_0x1703('0x14'),_0x3c8634,_0x59c5da[_0x1703('0x12')],_0x3ad1f6,_0x1fc26a||'next');if(_0x1fc26a){var _0x220c34=_[_0x1703('0x15')](_0x231f9b['rules'](),{'p':_0x1fc26a});if(_0x220c34>=0x0){logger[_0x1703('0x16')](_0x1703('0x17'),_0x3c8634,_0x1fc26a||_0x1703('0x18'),_0x220c34);_0x231f9b[_0x1703('0x18')](_0x220c34);}else{logger[_0x1703('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3c8634,_0x1fc26a||_0x1703('0x18'));_0x231f9b[_0x1703('0x19')]();}}else{_0x231f9b[_0x1703('0x18')]();}}catch(_0x3e52ae){logger[_0x1703('0x1a')](_0x1703('0x1b'),_0x3c8634,_0x3e52ae['message']);_0x231f9b[_0x1703('0x19')]();}}}catch(_0x3ad8fc){logger['error'](_0x1703('0xe'),_0x3c8634,JSON[_0x1703('0x1c')](_0x3ad8fc));_0x231f9b[_0x1703('0x19')]();}};}; \ No newline at end of file +var _0x8ea3=['./utils','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','validate','[%s][GOTOIF]\x20%s','map','join','stop','priorityTrue','priorityFalse','info','condition','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','html-to-text'];(function(_0x48965a,_0x1aefa6){var _0x4ffb46=function(_0x4c91ba){while(--_0x4c91ba){_0x48965a['push'](_0x48965a['shift']());}};_0x4ffb46(++_0x1aefa6);}(_0x8ea3,0xd7));var _0x38ea=function(_0x1cd4d5,_0x40bd09){_0x1cd4d5=_0x1cd4d5-0x0;var _0x348028=_0x8ea3[_0x1cd4d5];return _0x348028;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require(_0x38ea('0x0'));var utils=require(_0x38ea('0x1'));var logger=require('../../../../config/logger')(_0x38ea('0x2'));var gotoif=schema({'condition':{'type':_0x38ea('0x3'),'required':!![],'message':_0x38ea('0x4')},'priorityTrue':{'type':_0x38ea('0x5'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x38ea('0x5'),'message':_0x38ea('0x6')}});exports[_0x38ea('0x7')]=function(_0x24e89d,_0x4fadac){return function(_0x203f7f){try{var _0xaf7e8f={'condition':htmlToText[_0x38ea('0x8')](utils['getMustacheRender'](_0x4fadac[0x0],this),{'wordwrap':![]})[_0x38ea('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4fadac[0x1],'priorityFalse':_0x4fadac[0x2]};var _0x210cb8=gotoif[_0x38ea('0xa')](_0xaf7e8f,{'typecast':!![]});if(_0x210cb8['length']){logger['error'](_0x38ea('0xb'),_0x24e89d,_[_0x38ea('0xc')](_0x210cb8,'message')[_0x38ea('0xd')](',\x20'));_0x203f7f[_0x38ea('0xe')]();}else{try{var _0x3ed1ef=eval('('+_0xaf7e8f['condition']+')');var _0xe556d7=_0x3ed1ef?_0xaf7e8f[_0x38ea('0xf')]:_0xaf7e8f[_0x38ea('0x10')];logger[_0x38ea('0x11')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x24e89d,_0xaf7e8f[_0x38ea('0x12')],_0x3ed1ef,_0xe556d7||'next');if(_0xe556d7){var _0x1512bb=_[_0x38ea('0x13')](_0x203f7f[_0x38ea('0x14')](),{'p':_0xe556d7});if(_0x1512bb>=0x0){logger[_0x38ea('0x11')](_0x38ea('0x15'),_0x24e89d,_0xe556d7||_0x38ea('0x16'),_0x1512bb);_0x203f7f[_0x38ea('0x16')](_0x1512bb);}else{logger[_0x38ea('0x11')](_0x38ea('0x17'),_0x24e89d,_0xe556d7||'next');_0x203f7f[_0x38ea('0xe')]();}}else{_0x203f7f[_0x38ea('0x16')]();}}catch(_0x428440){logger[_0x38ea('0x18')](_0x38ea('0x19'),_0x24e89d,_0x428440[_0x38ea('0x1a')]);_0x203f7f['stop']();}}}catch(_0x1cefae){logger['error'](_0x38ea('0xb'),_0x24e89d,JSON['stringify'](_0x1cefae));_0x203f7f[_0x38ea('0xe')]();}};}; \ 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 db4c3f5..c6115d5 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 _0xf0d2=['rules','priority','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','join','stop','[%s][GOTOP]\x20priority\x20%s','findIndex'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0xf0d2,0x1b8));var _0x2f0d=function(_0x5d5b02,_0x2c36b9){_0x5d5b02=_0x5d5b02-0x0;var _0x36a674=_0xf0d2[_0x5d5b02];return _0x36a674;};'use strict';var schema=require(_0x2f0d('0x0'));var _=require(_0x2f0d('0x1'));var logger=require('../../../../config/logger')('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x2f0d('0x2')}});exports[_0x2f0d('0x3')]=function(_0x25a2d2,_0x4e06e9){return function(_0x1f181c){try{var _0x4287ac={'priority':_0x4e06e9[0x0]};var _0x37c944=gotop['validate'](_0x4287ac,{'typecast':!![]});if(_0x37c944[_0x2f0d('0x4')]){logger[_0x2f0d('0x5')]('[%s][GOTOP]\x20%s',_0x25a2d2,_['map'](_0x37c944,'message')[_0x2f0d('0x6')](',\x20'));_0x1f181c[_0x2f0d('0x7')]();}else{logger['info'](_0x2f0d('0x8'),_0x25a2d2,_0x4287ac['priority']);if(_0x4287ac['priority']){var _0x2c59a5=_[_0x2f0d('0x9')](_0x1f181c[_0x2f0d('0xa')](),{'p':_0x4287ac[_0x2f0d('0xb')]});if(_0x2c59a5>=0x0){logger[_0x2f0d('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x25a2d2,_0x4287ac[_0x2f0d('0xb')]||_0x2f0d('0xd'),_0x2c59a5);_0x1f181c[_0x2f0d('0xd')](_0x2c59a5);}else{logger[_0x2f0d('0xc')](_0x2f0d('0xe'),_0x25a2d2,_0x4287ac[_0x2f0d('0xb')]||_0x2f0d('0xd'));_0x1f181c['stop']();}}else{_0x1f181c[_0x2f0d('0xd')]();}}}catch(_0x39221f){logger['error']('[%s][GOTOP]\x20%s',_0x25a2d2,JSON['stringify'](_0x39221f));_0x1f181c[_0x2f0d('0x7')]();}};}; \ No newline at end of file +var _0x1b4f=['error','map','message','join','stop','info','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20%s','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate'];(function(_0x54e408,_0x1d47d7){var _0x44e402=function(_0x4fc2d5){while(--_0x4fc2d5){_0x54e408['push'](_0x54e408['shift']());}};_0x44e402(++_0x1d47d7);}(_0x1b4f,0xf5));var _0xf1b4=function(_0x4a2ac8,_0x4ccba8){_0x4a2ac8=_0x4a2ac8-0x0;var _0x507c80=_0x1b4f[_0x4a2ac8];return _0x507c80;};'use strict';var schema=require('validate');var _=require(_0xf1b4('0x0'));var logger=require(_0xf1b4('0x1'))(_0xf1b4('0x2'));var gotop=schema({'priority':{'type':_0xf1b4('0x3'),'required':!![],'message':_0xf1b4('0x4')}});exports[_0xf1b4('0x5')]=function(_0x1383fa,_0xabe4be){return function(_0x106d33){try{var _0x35440c={'priority':_0xabe4be[0x0]};var _0x1a441d=gotop[_0xf1b4('0x6')](_0x35440c,{'typecast':!![]});if(_0x1a441d['length']){logger[_0xf1b4('0x7')]('[%s][GOTOP]\x20%s',_0x1383fa,_[_0xf1b4('0x8')](_0x1a441d,_0xf1b4('0x9'))[_0xf1b4('0xa')](',\x20'));_0x106d33[_0xf1b4('0xb')]();}else{logger[_0xf1b4('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x1383fa,_0x35440c[_0xf1b4('0xd')]);if(_0x35440c[_0xf1b4('0xd')]){var _0x17e024=_['findIndex'](_0x106d33['rules'](),{'p':_0x35440c[_0xf1b4('0xd')]});if(_0x17e024>=0x0){logger['info'](_0xf1b4('0xe'),_0x1383fa,_0x35440c[_0xf1b4('0xd')]||_0xf1b4('0xf'),_0x17e024);_0x106d33[_0xf1b4('0xf')](_0x17e024);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x1383fa,_0x35440c[_0xf1b4('0xd')]||_0xf1b4('0xf'));_0x106d33[_0xf1b4('0xb')]();}}else{_0x106d33['next']();}}}catch(_0x56c68e){logger['error'](_0xf1b4('0x10'),_0x1383fa,JSON[_0xf1b4('0x11')](_0x56c68e));_0x106d33[_0xf1b4('0xb')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 6ff4a5b..3583617 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 _0x754b=['../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','channel','account','upperFirst','AccountId','InteractionId','Message','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stop','error','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage'];(function(_0x332109,_0x474add){var _0x7a6ab2=function(_0x5132dd){while(--_0x5132dd){_0x332109['push'](_0x332109['shift']());}};_0x7a6ab2(++_0x474add);}(_0x754b,0x1ef));var _0xb754=function(_0x44cd28,_0x1502d9){_0x44cd28=_0x44cd28-0x0;var _0x39356e=_0x754b[_0x44cd28];return _0x39356e;};'use strict';var _=require(_0xb754('0x0'));var utils=require(_0xb754('0x1'));var logger=require(_0xb754('0x2'))(_0xb754('0x3'));var rpc={'chatMessage':require(_0xb754('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xb754('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xb754('0x6')),'whatsappMessage':require(_0xb754('0x7'))};exports['consequence']=function(_0x2a7349,_0x40f0ee){return function(_0xe2bdee){try{var _0x162a1a={'body':utils[_0xb754('0x8')](_0x40f0ee[0x0],this),'ContactId':this[_0xb754('0x9')]['id']};if(this[_0xb754('0xa')]==='chat'){_0x162a1a['ChatWebsiteId']=this[_0xb754('0xb')]['id'];}else{_0x162a1a[_[_0xb754('0xc')](this[_0xb754('0xa')])+_0xb754('0xd')]=this[_0xb754('0xb')]['id'];}_0x162a1a[_[_0xb754('0xc')](this[_0xb754('0xa')])+_0xb754('0xe')]=this['interaction']['id'];if(rpc[this[_0xb754('0xa')]+_0xb754('0xf')]){return rpc[this[_0xb754('0xa')]+'Message']['create'](_0x162a1a)[_0xb754('0x10')](function(_0x53310b){logger[_0xb754('0x11')](_0xb754('0x12'),_0x2a7349,_0x162a1a[_0xb754('0x13')]);_0xe2bdee[_0xb754('0x14')]();})[_0xb754('0x15')](function(_0x11c380){logger['error'](_0xb754('0x12'),_0x2a7349,JSON['stringify'](_0x11c380));_0xe2bdee[_0xb754('0x16')]();});}}catch(_0x565fb7){logger[_0xb754('0x17')](_0xb754('0x12'),_0x2a7349,JSON[_0xb754('0x18')](_0x565fb7));_0xe2bdee[_0xb754('0x16')]();}};}; \ No newline at end of file +var _0x2c5b=['../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','account','upperFirst','interaction','Message','create','then','info','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/smsMessage'];(function(_0x1b03f7,_0x4e251b){var _0x1fb7e1=function(_0x7841c2){while(--_0x7841c2){_0x1b03f7['push'](_0x1b03f7['shift']());}};_0x1fb7e1(++_0x4e251b);}(_0x2c5b,0x193));var _0xb2c5=function(_0x48360c,_0x4c1bdd){_0x48360c=_0x48360c-0x0;var _0x568ce0=_0x2c5b[_0x48360c];return _0x568ce0;};'use strict';var _=require(_0xb2c5('0x0'));var utils=require('./utils');var logger=require(_0xb2c5('0x1'))(_0xb2c5('0x2'));var rpc={'chatMessage':require(_0xb2c5('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb2c5('0x4')),'faxMessage':require(_0xb2c5('0x5')),'whatsappMessage':require(_0xb2c5('0x6'))};exports[_0xb2c5('0x7')]=function(_0x4cc6e2,_0x195514){return function(_0xc08d26){try{var _0x449204={'body':utils[_0xb2c5('0x8')](_0x195514[0x0],this),'ContactId':this[_0xb2c5('0x9')]['id']};if(this[_0xb2c5('0xa')]==='chat'){_0x449204['ChatWebsiteId']=this[_0xb2c5('0xb')]['id'];}else{_0x449204[_[_0xb2c5('0xc')](this[_0xb2c5('0xa')])+'AccountId']=this[_0xb2c5('0xb')]['id'];}_0x449204[_[_0xb2c5('0xc')](this['channel'])+'InteractionId']=this[_0xb2c5('0xd')]['id'];if(rpc[this[_0xb2c5('0xa')]+_0xb2c5('0xe')]){return rpc[this[_0xb2c5('0xa')]+'Message'][_0xb2c5('0xf')](_0x449204)[_0xb2c5('0x10')](function(_0x250f0d){logger[_0xb2c5('0x11')]('[%s][MESSAGE]\x20%s',_0x4cc6e2,_0x449204['body']);_0xc08d26[_0xb2c5('0x12')]();})[_0xb2c5('0x13')](function(_0x409398){logger[_0xb2c5('0x14')](_0xb2c5('0x15'),_0x4cc6e2,JSON[_0xb2c5('0x16')](_0x409398));_0xc08d26[_0xb2c5('0x17')]();});}}catch(_0x1fffa7){logger[_0xb2c5('0x14')]('[%s][MESSAGE]\x20%s',_0x4cc6e2,JSON[_0xb2c5('0x16')](_0x1fffa7));_0xc08d26[_0xb2c5('0x17')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 25a46c6..dbc3e77 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 _0x84ef=['stop','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify'];(function(_0x343bf0,_0x46dcd4){var _0x3da1c2=function(_0x19609c){while(--_0x19609c){_0x343bf0['push'](_0x343bf0['shift']());}};_0x3da1c2(++_0x46dcd4);}(_0x84ef,0x1d5));var _0xf84e=function(_0x230ce1,_0x465102){_0x230ce1=_0x230ce1-0x0;var _0x57d3c8=_0x84ef[_0x230ce1];return _0x57d3c8;};'use strict';var utils=require('./utils');var logger=require(_0xf84e('0x0'))(_0xf84e('0x1'));exports[_0xf84e('0x2')]=function(_0x23c17d,_0x259603){return function(_0x53ae4f){try{logger[_0xf84e('0x3')](_0xf84e('0x4'),_0x23c17d,utils[_0xf84e('0x5')](_0x259603[0x0],this));_0x53ae4f[_0xf84e('0x6')]();}catch(_0xdb62c5){logger['error']('[%s][NOOP]\x20%s',_0x23c17d,JSON[_0xf84e('0x7')](_0xdb62c5));_0x53ae4f[_0xf84e('0x8')]();}};}; \ No newline at end of file +var _0x17e2=['info','[%s][NOOP]\x20%s','next','error','stringify','stop','routing'];(function(_0x502c74,_0x25e1f7){var _0x4bfe33=function(_0x4d653e){while(--_0x4d653e){_0x502c74['push'](_0x502c74['shift']());}};_0x4bfe33(++_0x25e1f7);}(_0x17e2,0x99));var _0x217e=function(_0x5b028b,_0x5ee82b){_0x5b028b=_0x5b028b-0x0;var _0x37ad7f=_0x17e2[_0x5b028b];return _0x37ad7f;};'use strict';var utils=require('./utils');var logger=require('../../../../config/logger')(_0x217e('0x0'));exports['consequence']=function(_0x133c9c,_0x11be38){return function(_0x3c33b1){try{logger[_0x217e('0x1')](_0x217e('0x2'),_0x133c9c,utils['getMustacheRender'](_0x11be38[0x0],this));_0x3c33b1[_0x217e('0x3')]();}catch(_0x33836b){logger[_0x217e('0x4')](_0x217e('0x2'),_0x133c9c,JSON[_0x217e('0x5')](_0x33836b));_0x3c33b1[_0x217e('0x6')]();}};}; \ 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 0d30b1b..48b165c 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 _0x2045=['[%s][QUEUE]\x20APPLICATION\x20END','close','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','redis','defaults','localhost','queue_id','account','joinAt','emit','queue','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2045,0x9d));var _0x5204=function(_0x165ca9,_0x36e359){_0x165ca9=_0x165ca9-0x0;var _0x25f49a=_0x2045[_0x165ca9];return _0x25f49a;};'use strict';var schema=require(_0x5204('0x0'));var _=require(_0x5204('0x1'));var util=require(_0x5204('0x2'));var seqqueue=require(_0x5204('0x3'));var moment=require(_0x5204('0x4'));var Redis=require(_0x5204('0x5'));var config=require(_0x5204('0x6'));var logger=require('../../../../config/logger')(_0x5204('0x7'));var strategy=require('./strategy');config[_0x5204('0x8')]=_[_0x5204('0x9')](config['redis'],{'host':_0x5204('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var attributes=['id',_0x5204('0xb'),_0x5204('0xc'),'queue','from',_0x5204('0xd')];function emit(_0x1584dc,_0x32ccd4,_0x5af9bf){io['to'](_0x1584dc)[_0x5204('0xe')](_0x32ccd4,_0x5af9bf);}function emitChannelQueueInteraction(_0x3b9e8b,_0x3f6df6,_0x3b9209,_0xdc66a4,_0x5ef6a6,_0x1c7068,_0x38c6f3,_0x2e56b3){var _0x5de8ef=_['clone'](_0x3b9209);_0x5de8ef[_0x5204('0xb')]=_0x2e56b3;_0x5de8ef[_0x5204('0xf')]=_0x3f6df6;_0x5de8ef[_0x5204('0xc')]=_0xdc66a4;_0x5de8ef['id']=_0x5ef6a6;if(_0x1c7068){_0x38c6f3[util['format'](_0x5204('0x10'),_0x3b9e8b)][_0x5ef6a6]=_[_0x5204('0x11')](_0x5de8ef,attributes);}else{delete _0x38c6f3[util['format']('%sQueuesWaitingInteractions',_0x3b9e8b)][_0x5ef6a6];}emit(util[_0x5204('0x12')](_0x5204('0x13'),_0x3b9e8b,_0x3f6df6),util[_0x5204('0x12')](_0x5204('0x14'),_0x3b9e8b,_0x1c7068?'save':_0x5204('0x15')),_[_0x5204('0x11')](_0x5de8ef,attributes));}var rpc={'openchannelQueueReport':require(_0x5204('0x16')),'mailQueueReport':require(_0x5204('0x17')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x5204('0x18')),'faxQueueReport':require(_0x5204('0x19')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x5204('0x1a'),'required':!![],'message':_0x5204('0x1b')},'timeout':{'type':_0x5204('0x1c'),'message':_0x5204('0x1d')}});function startRouting(_0x24a3a8,_0x1cecf6,_0x7adc20,_0x2c77e4){if(_0x24a3a8&&_0x1cecf6&&_0x7adc20){_0x1cecf6[_0x5204('0x1e')]+=0x1;var _0x58fc41={'uniqueid':_0x24a3a8,'from':_0x7adc20['body']?_0x7adc20[_0x5204('0x1f')][_0x5204('0x20')]:'','joinAt':moment()[_0x5204('0x12')](_0x5204('0x21')),'ContactId':_0x7adc20[_0x5204('0x22')]?_0x7adc20['contact']['id']:null,'ListId':_0x7adc20[_0x5204('0x23')]?_0x7adc20['list']['id']:null};_0x58fc41[_[_0x5204('0x24')](_0x7adc20[_0x5204('0x25')])+_0x5204('0x26')]=_0x1cecf6['id']||null;_0x58fc41[_[_0x5204('0x24')](_0x7adc20[_0x5204('0x25')])+_0x5204('0x27')]=_0x7adc20['interaction']?_0x7adc20[_0x5204('0x28')]['id']:null;_0x58fc41[_[_0x5204('0x24')](_0x7adc20['channel'])+'MessageId']=_0x7adc20[_0x5204('0x29')]?_0x7adc20['message']['id']:null;_0x58fc41[_['upperFirst'](_0x7adc20['channel'])+(_0x7adc20[_0x5204('0x25')]!==_0x5204('0x2a')?_0x5204('0x2b'):'WebsiteId')]=_0x7adc20[_0x5204('0xc')]?_0x7adc20[_0x5204('0xc')]['id']:null;logger[_0x5204('0x2c')](util[_0x5204('0x12')](_0x5204('0x2d'),_0x24a3a8,_0x1cecf6[_0x5204('0x2e')]));emitChannelQueueInteraction(_0x7adc20['channel'],_0x1cecf6[_0x5204('0x2e')],_0x58fc41,_0x7adc20[_0x5204('0xc')]['name'],_0x7adc20[_0x5204('0x29')]['id'],!![],_0x2c77e4,_0x1cecf6['id']);if(rpc[_0x7adc20[_0x5204('0x25')]+_0x5204('0x2f')]){return rpc[_0x7adc20[_0x5204('0x25')]+_0x5204('0x2f')][_0x5204('0x30')](_0x58fc41)[_0x5204('0x31')](function(_0x38c99b){logger[_0x5204('0x32')](_0x5204('0x33'));});}}}function stopRouting(_0x31aebe,_0x1d17ca,_0x1dd7ec,_0x3357d2){if(_0x31aebe&&_0x1d17ca){_0x1d17ca[_0x5204('0x1e')]-=0x1;var _0x431c11={'leaveAt':moment()[_0x5204('0x12')](_0x5204('0x21')),'acceptAt':moment()['format'](_0x5204('0x21')),'reason':_0x5204('0x34')};logger['info'](util['format'](_0x5204('0x35'),_0x31aebe,_0x1d17ca[_0x5204('0x2e')]));emitChannelQueueInteraction(_0x1dd7ec[_0x5204('0x25')],_0x1d17ca[_0x5204('0x2e')],_0x1dd7ec['body'],_0x1dd7ec['account'][_0x5204('0x2e')],_0x1dd7ec[_0x5204('0x29')]['id'],![],_0x3357d2,_0x1d17ca['id']);if(rpc[_0x1dd7ec[_0x5204('0x25')]+_0x5204('0x2f')]){return rpc[_0x1dd7ec['channel']+_0x5204('0x2f')][_0x5204('0x36')](_0x31aebe,_0x431c11)[_0x5204('0x31')](function(_0x44f881){logger[_0x5204('0x32')](_0x5204('0x37'));});}}}function endRouting(_0x4bab27,_0x33d3a6,_0x430b71,_0x138c1a){if(_0x4bab27&&_0x33d3a6){_0x33d3a6[_0x5204('0x1e')]-=0x1;var _0x3f3f3f={'leaveAt':moment()[_0x5204('0x12')](_0x5204('0x21')),'exitAt':moment()[_0x5204('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x5204('0x38')};logger['info'](util[_0x5204('0x12')](_0x5204('0x39'),_0x4bab27,_0x33d3a6[_0x5204('0x2e')]));emitChannelQueueInteraction(_0x430b71[_0x5204('0x25')],_0x33d3a6[_0x5204('0x2e')],_0x430b71[_0x5204('0x1f')],_0x430b71[_0x5204('0xc')][_0x5204('0x2e')],_0x430b71[_0x5204('0x29')]['id'],![],_0x138c1a);if(rpc[_0x430b71[_0x5204('0x25')]+_0x5204('0x2f')]){return rpc[_0x430b71['channel']+_0x5204('0x2f')]['update'](_0x4bab27,_0x3f3f3f)[_0x5204('0x31')](function(_0x4b5267){logger[_0x5204('0x32')](_0x5204('0x37'));});}}}function handleFindQueue(_0x6f5d76){return function(_0x4bfe16){return _0x4bfe16[_0x5204('0x2e')]['toLowerCase']()===_0x6f5d76[_0x5204('0x3a')]();};}exports[_0x5204('0x3b')]=function(_0x3b2298,_0x962681,_0x15438b,_0x40dfcc){return function(_0x4912e2){try{var _0x2a3608={'name':_0x962681[0x0],'timeout':_0x962681[0x1]};var _0x28d7f9=queue['validate'](_0x2a3608,{'typecast':!![]});if(_0x28d7f9[_0x5204('0x3c')]){logger[_0x5204('0x32')](_0x5204('0x3d'),_0x3b2298,_[_0x5204('0x3e')](_0x28d7f9,_0x5204('0x29'))[_0x5204('0x3f')](',\x20'));_0x4912e2[_0x5204('0x40')]();}else{var _0xb71a8e=_[_0x5204('0x41')](_0x15438b[_0x40dfcc[_0x5204('0x25')]+_0x5204('0x42')],handleFindQueue(_0x2a3608[_0x5204('0x2e')]));if(_0xb71a8e){startRouting(_0x3b2298,_0xb71a8e,_0x40dfcc,_0x15438b);var _0x362c60=(_0xb71a8e['timeout']||0xa)*0x3e8;var _0x2e3a06=(_0x2a3608[_0x5204('0x38')]||0x14)*0x3e8;var _0x3aada1,_0x55e8ac;if(_0x362c60>_0x2e3a06){_0x2e3a06=_0x362c60;}var _0x9295e=seqqueue['createQueue'](_0x362c60);_0x9295e['id']=_0x3b2298;_0x9295e['atimeout']=_0x362c60;_0x9295e[_0x5204('0x43')]=_0x2e3a06;_0x9295e[_0x5204('0x25')]=_0x40dfcc[_0x5204('0x25')];_0x15438b[_0x5204('0x44')][_0x3b2298]['on'](_0x5204('0x45'),function(){logger[_0x5204('0x2c')](_0x5204('0x46'),_0x3b2298);stopRouting(_0x3b2298,_0xb71a8e,_0x40dfcc,_0x15438b);clearTimeout(_0x3aada1);_0x3aada1=undefined;_0x9295e['close'](!![]);if(_0x15438b[_0x5204('0x44')][_0x3b2298]){delete _0x15438b['rules'][_0x3b2298];}_0x4912e2['stop']();});_0x15438b[_0x5204('0x44')][_0x3b2298]['on']('complete',function(){if(_0x15438b[_0x5204('0x44')][_0x3b2298]){delete _0x15438b[_0x5204('0x44')][_0x3b2298];}});_0x3aada1=setTimeout(function(){logger[_0x5204('0x2c')](_0x5204('0x47'),_0x3b2298);endRouting(_0x3b2298,_0xb71a8e,_0x40dfcc,_0x15438b);clearTimeout(_0x3aada1);_0x9295e[_0x5204('0x48')](!![]);_0x4912e2['next']();},_0x2e3a06);switch(_0xb71a8e['strategy']){case _0x5204('0x49'):strategy[_0x5204('0x49')](_0x9295e,_0xb71a8e,_0x15438b,_0x40dfcc);break;default:strategy['beepall'](_0x9295e,_0xb71a8e,_0x15438b,_0x40dfcc);}}else{logger[_0x5204('0x32')](_0x5204('0x4a'),_0x3b2298,_0x2a3608[_0x5204('0x2e')]);_0x4912e2[_0x5204('0x40')]();}}}catch(_0x1e1a86){console[_0x5204('0x4b')](_0x1e1a86);logger[_0x5204('0x32')]('[%s][QUEUE]\x20%s',_0x3b2298,_0x1e1a86['stack']);_0x4912e2['stop']();}};}; \ No newline at end of file +var _0x7fec=['message','chat','WebsiteId','info','name','QueueReport','create','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','update','toLowerCase','length','[%s][QUEUE]\x20%s','join','stop','createQueue','atimeout','qtimeout','end','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','queue_id','account','queue','joinAt','emit','clone','format','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','from','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','interaction','channel'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x7fec,0x14b));var _0xc7fe=function(_0x2c4586,_0x45dc73){_0x2c4586=_0x2c4586-0x0;var _0x5d807c=_0x7fec[_0x2c4586];return _0x5d807c;};'use strict';var schema=require(_0xc7fe('0x0'));var _=require(_0xc7fe('0x1'));var util=require(_0xc7fe('0x2'));var seqqueue=require(_0xc7fe('0x3'));var moment=require(_0xc7fe('0x4'));var Redis=require(_0xc7fe('0x5'));var config=require('../../../../config/environment');var logger=require(_0xc7fe('0x6'))(_0xc7fe('0x7'));var strategy=require(_0xc7fe('0x8'));config[_0xc7fe('0x9')]=_[_0xc7fe('0xa')](config[_0xc7fe('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc7fe('0x9')]));var attributes=['id',_0xc7fe('0xb'),_0xc7fe('0xc'),_0xc7fe('0xd'),'from',_0xc7fe('0xe')];function emit(_0x3df88a,_0x54ab43,_0xbb6b8){io['to'](_0x3df88a)[_0xc7fe('0xf')](_0x54ab43,_0xbb6b8);}function emitChannelQueueInteraction(_0x28bc3b,_0x3764d6,_0x3e48f2,_0x2ebcfe,_0x307a4c,_0x49f478,_0x354f7a,_0x1f4f23){var _0x2be6e1=_[_0xc7fe('0x10')](_0x3e48f2);_0x2be6e1[_0xc7fe('0xb')]=_0x1f4f23;_0x2be6e1[_0xc7fe('0xd')]=_0x3764d6;_0x2be6e1[_0xc7fe('0xc')]=_0x2ebcfe;_0x2be6e1['id']=_0x307a4c;if(_0x49f478){_0x354f7a[util[_0xc7fe('0x11')]('%sQueuesWaitingInteractions',_0x28bc3b)][_0x307a4c]=_[_0xc7fe('0x12')](_0x2be6e1,attributes);}else{delete _0x354f7a[util[_0xc7fe('0x11')]('%sQueuesWaitingInteractions',_0x28bc3b)][_0x307a4c];}emit(util[_0xc7fe('0x11')](_0xc7fe('0x13'),_0x28bc3b,_0x3764d6),util['format'](_0xc7fe('0x14'),_0x28bc3b,_0x49f478?_0xc7fe('0x15'):_0xc7fe('0x16')),_[_0xc7fe('0x12')](_0x2be6e1,attributes));}var rpc={'openchannelQueueReport':require(_0xc7fe('0x17')),'mailQueueReport':require(_0xc7fe('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xc7fe('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xc7fe('0x1a'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xc7fe('0x1b')},'timeout':{'type':_0xc7fe('0x1c'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x2d27af,_0x1b46a4,_0x2afc6b,_0x4dffd0){if(_0x2d27af&&_0x1b46a4&&_0x2afc6b){_0x1b46a4[_0xc7fe('0x1d')]+=0x1;var _0x4e659b={'uniqueid':_0x2d27af,'from':_0x2afc6b[_0xc7fe('0x1e')]?_0x2afc6b[_0xc7fe('0x1e')][_0xc7fe('0x1f')]:'','joinAt':moment()[_0xc7fe('0x11')](_0xc7fe('0x20')),'ContactId':_0x2afc6b[_0xc7fe('0x21')]?_0x2afc6b['contact']['id']:null,'ListId':_0x2afc6b[_0xc7fe('0x22')]?_0x2afc6b[_0xc7fe('0x22')]['id']:null};_0x4e659b[_[_0xc7fe('0x23')](_0x2afc6b['channel'])+_0xc7fe('0x24')]=_0x1b46a4['id']||null;_0x4e659b[_[_0xc7fe('0x23')](_0x2afc6b['channel'])+'InteractionId']=_0x2afc6b[_0xc7fe('0x25')]?_0x2afc6b[_0xc7fe('0x25')]['id']:null;_0x4e659b[_[_0xc7fe('0x23')](_0x2afc6b[_0xc7fe('0x26')])+'MessageId']=_0x2afc6b[_0xc7fe('0x27')]?_0x2afc6b[_0xc7fe('0x27')]['id']:null;_0x4e659b[_[_0xc7fe('0x23')](_0x2afc6b['channel'])+(_0x2afc6b[_0xc7fe('0x26')]!==_0xc7fe('0x28')?'AccountId':_0xc7fe('0x29'))]=_0x2afc6b[_0xc7fe('0xc')]?_0x2afc6b[_0xc7fe('0xc')]['id']:null;logger[_0xc7fe('0x2a')](util[_0xc7fe('0x11')]('[%s][START:QUEUE][NAME:%s]',_0x2d27af,_0x1b46a4['name']));emitChannelQueueInteraction(_0x2afc6b['channel'],_0x1b46a4[_0xc7fe('0x2b')],_0x4e659b,_0x2afc6b[_0xc7fe('0xc')][_0xc7fe('0x2b')],_0x2afc6b[_0xc7fe('0x27')]['id'],!![],_0x4dffd0,_0x1b46a4['id']);if(rpc[_0x2afc6b[_0xc7fe('0x26')]+_0xc7fe('0x2c')]){return rpc[_0x2afc6b[_0xc7fe('0x26')]+'QueueReport'][_0xc7fe('0x2d')](_0x4e659b)[_0xc7fe('0x2e')](function(_0x4736b1){logger[_0xc7fe('0x2f')](_0xc7fe('0x30'));});}}}function stopRouting(_0x18e55b,_0x1dea6f,_0x30d90a,_0x204c3d){if(_0x18e55b&&_0x1dea6f){_0x1dea6f[_0xc7fe('0x1d')]-=0x1;var _0x2ae22e={'leaveAt':moment()[_0xc7fe('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0xc7fe('0x11')](_0xc7fe('0x20')),'reason':'accepted'};logger[_0xc7fe('0x2a')](util[_0xc7fe('0x11')](_0xc7fe('0x31'),_0x18e55b,_0x1dea6f[_0xc7fe('0x2b')]));emitChannelQueueInteraction(_0x30d90a[_0xc7fe('0x26')],_0x1dea6f['name'],_0x30d90a['body'],_0x30d90a['account'][_0xc7fe('0x2b')],_0x30d90a[_0xc7fe('0x27')]['id'],![],_0x204c3d,_0x1dea6f['id']);if(rpc[_0x30d90a[_0xc7fe('0x26')]+_0xc7fe('0x2c')]){return rpc[_0x30d90a[_0xc7fe('0x26')]+'QueueReport']['update'](_0x18e55b,_0x2ae22e)[_0xc7fe('0x2e')](function(_0x4bc825){logger[_0xc7fe('0x2f')](_0xc7fe('0x32'));});}}}function endRouting(_0xad833c,_0x409cf6,_0x4a742f,_0x1c2f61){if(_0xad833c&&_0x409cf6){_0x409cf6['waiting']-=0x1;var _0x2cd5d8={'leaveAt':moment()[_0xc7fe('0x11')](_0xc7fe('0x20')),'exitAt':moment()['format'](_0xc7fe('0x20')),'reason':_0xc7fe('0x33')};logger[_0xc7fe('0x2a')](util[_0xc7fe('0x11')](_0xc7fe('0x34'),_0xad833c,_0x409cf6[_0xc7fe('0x2b')]));emitChannelQueueInteraction(_0x4a742f[_0xc7fe('0x26')],_0x409cf6[_0xc7fe('0x2b')],_0x4a742f[_0xc7fe('0x1e')],_0x4a742f[_0xc7fe('0xc')]['name'],_0x4a742f[_0xc7fe('0x27')]['id'],![],_0x1c2f61);if(rpc[_0x4a742f[_0xc7fe('0x26')]+_0xc7fe('0x2c')]){return rpc[_0x4a742f[_0xc7fe('0x26')]+_0xc7fe('0x2c')][_0xc7fe('0x35')](_0xad833c,_0x2cd5d8)[_0xc7fe('0x2e')](function(_0x2b23d2){logger['error'](_0xc7fe('0x32'));});}}}function handleFindQueue(_0x3e0ce6){return function(_0x2eb476){return _0x2eb476[_0xc7fe('0x2b')][_0xc7fe('0x36')]()===_0x3e0ce6['toLowerCase']();};}exports['consequence']=function(_0x46805c,_0x42282b,_0x42205a,_0xa14c66){return function(_0x2497a7){try{var _0xbac451={'name':_0x42282b[0x0],'timeout':_0x42282b[0x1]};var _0x4922b0=queue[_0xc7fe('0x0')](_0xbac451,{'typecast':!![]});if(_0x4922b0[_0xc7fe('0x37')]){logger[_0xc7fe('0x2f')](_0xc7fe('0x38'),_0x46805c,_['map'](_0x4922b0,'message')[_0xc7fe('0x39')](',\x20'));_0x2497a7[_0xc7fe('0x3a')]();}else{var _0x5b316a=_['find'](_0x42205a[_0xa14c66[_0xc7fe('0x26')]+'Queues'],handleFindQueue(_0xbac451[_0xc7fe('0x2b')]));if(_0x5b316a){startRouting(_0x46805c,_0x5b316a,_0xa14c66,_0x42205a);var _0x29a351=(_0x5b316a[_0xc7fe('0x33')]||0xa)*0x3e8;var _0x1a4cbe=(_0xbac451[_0xc7fe('0x33')]||0x14)*0x3e8;var _0x22802d,_0x11d7d3;if(_0x29a351>_0x1a4cbe){_0x1a4cbe=_0x29a351;}var _0x5dcda4=seqqueue[_0xc7fe('0x3b')](_0x29a351);_0x5dcda4['id']=_0x46805c;_0x5dcda4[_0xc7fe('0x3c')]=_0x29a351;_0x5dcda4[_0xc7fe('0x3d')]=_0x1a4cbe;_0x5dcda4[_0xc7fe('0x26')]=_0xa14c66[_0xc7fe('0x26')];_0x42205a['rules'][_0x46805c]['on'](_0xc7fe('0x3e'),function(){logger[_0xc7fe('0x2a')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x46805c);stopRouting(_0x46805c,_0x5b316a,_0xa14c66,_0x42205a);clearTimeout(_0x22802d);_0x22802d=undefined;_0x5dcda4[_0xc7fe('0x3f')](!![]);if(_0x42205a['rules'][_0x46805c]){delete _0x42205a[_0xc7fe('0x40')][_0x46805c];}_0x2497a7[_0xc7fe('0x3a')]();});_0x42205a[_0xc7fe('0x40')][_0x46805c]['on'](_0xc7fe('0x41'),function(){if(_0x42205a[_0xc7fe('0x40')][_0x46805c]){delete _0x42205a[_0xc7fe('0x40')][_0x46805c];}});_0x22802d=setTimeout(function(){logger[_0xc7fe('0x2a')](_0xc7fe('0x42'),_0x46805c);endRouting(_0x46805c,_0x5b316a,_0xa14c66,_0x42205a);clearTimeout(_0x22802d);_0x5dcda4['close'](!![]);_0x2497a7[_0xc7fe('0x43')]();},_0x1a4cbe);switch(_0x5b316a[_0xc7fe('0x44')]){case _0xc7fe('0x45'):strategy[_0xc7fe('0x45')](_0x5dcda4,_0x5b316a,_0x42205a,_0xa14c66);break;default:strategy[_0xc7fe('0x46')](_0x5dcda4,_0x5b316a,_0x42205a,_0xa14c66);}}else{logger['error'](_0xc7fe('0x47'),_0x46805c,_0xbac451[_0xc7fe('0x2b')]);_0x2497a7[_0xc7fe('0x3a')]();}}}catch(_0xc6534e){console[_0xc7fe('0x48')](_0xc6534e);logger['error']('[%s][QUEUE]\x20%s',_0x46805c,_0xc6534e[_0xc7fe('0x49')]);_0x2497a7[_0xc7fe('0x3a')]();}};}; \ 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 b4f7f07..434634e 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 _0x6d71=['push','bind','handleTimeout','timeout','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','busy','busyQueue','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','agent','realtime'];(function(_0x253bbc,_0x52461e){var _0x162ad7=function(_0x15226a){while(--_0x15226a){_0x253bbc['push'](_0x253bbc['shift']());}};_0x162ad7(++_0x52461e);}(_0x6d71,0xbe));var _0x16d7=function(_0x4da16a,_0x61884f){_0x4da16a=_0x4da16a-0x0;var _0x454baf=_0x6d71[_0x4da16a];return _0x454baf;};'use strict';var _=require(_0x16d7('0x0'));var uuid=require(_0x16d7('0x1'));var util=require(_0x16d7('0x2'));var logger=require('../../../../../config/logger')(_0x16d7('0x3'));var Agent=function(_0x2f0ec3,_0x443336,_0x55cb4a,_0x382154){this[_0x16d7('0x4')]=uuid['v4']();this[_0x16d7('0x5')]=_0x2f0ec3;this[_0x16d7('0x6')]=_0x443336;this[_0x16d7('0x7')]=_0x55cb4a;this['routing']=_0x382154;this[_0x16d7('0x5')][_0x16d7('0x8')](this['handleRun'][_0x16d7('0x9')](this),this[_0x16d7('0xa')][_0x16d7('0x9')](this));this['squeue']['on'](_0x16d7('0xb'),this[_0x16d7('0xa')]['bind'](this));this[_0x16d7('0x5')]['on']('drained',this[_0x16d7('0xc')][_0x16d7('0x9')](this));};Agent[_0x16d7('0xd')][_0x16d7('0x8')]=function(){this[_0x16d7('0x5')]['push'](this[_0x16d7('0xe')]['bind'](this),this[_0x16d7('0xa')][_0x16d7('0x9')](this));};Agent['prototype'][_0x16d7('0xc')]=function(){this[_0x16d7('0xa')](!![]);};Agent[_0x16d7('0xd')]['handleRun']=function(_0x1ab76d){logger[_0x16d7('0xf')](_0x16d7('0x10'),this['squeue']['id'],this[_0x16d7('0x6')]['id']);if(_['isNil'](this[_0x16d7('0x7')][_0x16d7('0x11')][this['agent']['id']])){logger['info'](_0x16d7('0x12'),this[_0x16d7('0x5')]['id'],this[_0x16d7('0x6')]['id']);setTimeout(this['push'][_0x16d7('0x9')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x16d7('0x13')](this['squeue']['id'],this[_0x16d7('0x7')][_0x16d7('0x11')][this['agent']['id']],this['squeue']['channel'],![])){this[_0x16d7('0x7')][_0x16d7('0x11')][this[_0x16d7('0x6')]['id']][_0x16d7('0x14')]=!![];this[_0x16d7('0x7')]['agents'][this[_0x16d7('0x6')]['id']][_0x16d7('0x15')]=undefined;util['showNotification'](this[_0x16d7('0x4')],this[_0x16d7('0x5')]['id'],this[_0x16d7('0x7')][_0x16d7('0x11')][this[_0x16d7('0x6')]['id']],null,this[_0x16d7('0x3')]);util[_0x16d7('0x16')](this[_0x16d7('0x5')]['id'],this[_0x16d7('0x7')][_0x16d7('0x11')][this['agent']['id']],_0x16d7('0x17')+(this['routing'][_0x16d7('0x18')]?_0x16d7('0x19'):''));}else{logger['info'](_0x16d7('0x1a'),this[_0x16d7('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x16d7('0x8')]['bind'](this),0x3e8);}}};Agent[_0x16d7('0xd')][_0x16d7('0xa')]=function(_0x3c350){if(_[_0x16d7('0x1b')](this[_0x16d7('0x7')][_0x16d7('0x11')][this[_0x16d7('0x6')]['id']])){return logger[_0x16d7('0xf')](_0x16d7('0x12'),this[_0x16d7('0x5')]['id'],this[_0x16d7('0x6')]['id']);}else{logger['info'](_0x16d7('0x1c'),this[_0x16d7('0x5')]['id'],this[_0x16d7('0x6')]['id']);util[_0x16d7('0x1d')](this[_0x16d7('0x4')],this[_0x16d7('0x5')]['id'],this[_0x16d7('0x7')][_0x16d7('0x11')][this[_0x16d7('0x6')]['id']],null,this[_0x16d7('0x3')]);this['realtime'][_0x16d7('0x11')][this[_0x16d7('0x6')]['id']][_0x16d7('0x14')]=![];this[_0x16d7('0x7')][_0x16d7('0x11')][this['agent']['id']][_0x16d7('0x15')]=undefined;util['writeLog'](this[_0x16d7('0x5')]['id'],this['realtime'][_0x16d7('0x11')][this[_0x16d7('0x6')]['id']],_0x3c350?_0x16d7('0x1e'):_0x16d7('0x1f'));}if(!_0x3c350){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x3c174d,_0x51f0c7,_0x273686,_0x446743){return new Agent(_0x3c174d,_0x51f0c7,_0x273686,_0x446743);}module[_0x16d7('0x20')]=agent; \ No newline at end of file +var _0xe542=['./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout','drained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','uuid'];(function(_0x53a2a1,_0x595e09){var _0x270bc4=function(_0x27c716){while(--_0x27c716){_0x53a2a1['push'](_0x53a2a1['shift']());}};_0x270bc4(++_0x595e09);}(_0xe542,0x131));var _0x2e54=function(_0x2b38f7,_0x3897af){_0x2b38f7=_0x2b38f7-0x0;var _0x4f8e27=_0xe542[_0x2b38f7];return _0x4f8e27;};'use strict';var _=require('lodash');var uuid=require(_0x2e54('0x0'));var util=require(_0x2e54('0x1'));var logger=require(_0x2e54('0x2'))(_0x2e54('0x3'));var Agent=function(_0x49569b,_0x3d4c48,_0x240a50,_0xcd80c7){this[_0x2e54('0x4')]=uuid['v4']();this[_0x2e54('0x5')]=_0x49569b;this[_0x2e54('0x6')]=_0x3d4c48;this[_0x2e54('0x7')]=_0x240a50;this[_0x2e54('0x3')]=_0xcd80c7;this[_0x2e54('0x5')][_0x2e54('0x8')](this[_0x2e54('0x9')]['bind'](this),this[_0x2e54('0xa')][_0x2e54('0xb')](this));this[_0x2e54('0x5')]['on'](_0x2e54('0xc'),this[_0x2e54('0xa')]['bind'](this));this[_0x2e54('0x5')]['on'](_0x2e54('0xd'),this['handleDrained'][_0x2e54('0xb')](this));};Agent['prototype']['push']=function(){this[_0x2e54('0x5')][_0x2e54('0x8')](this[_0x2e54('0x9')][_0x2e54('0xb')](this),this['handleTimeout'][_0x2e54('0xb')](this));};Agent[_0x2e54('0xe')]['handleDrained']=function(){this[_0x2e54('0xa')](!![]);};Agent[_0x2e54('0xe')][_0x2e54('0x9')]=function(_0x1c18ce){logger[_0x2e54('0xf')](_0x2e54('0x10'),this[_0x2e54('0x5')]['id'],this[_0x2e54('0x6')]['id']);if(_[_0x2e54('0x11')](this['realtime'][_0x2e54('0x12')][this['agent']['id']])){logger[_0x2e54('0xf')](_0x2e54('0x13'),this[_0x2e54('0x5')]['id'],this[_0x2e54('0x6')]['id']);setTimeout(this['push'][_0x2e54('0xb')](this),0x3e8);}else{if(this[_0x2e54('0x3')][_0x2e54('0x14')]||util[_0x2e54('0x15')](this[_0x2e54('0x5')]['id'],this['realtime'][_0x2e54('0x12')][this['agent']['id']],this['squeue'][_0x2e54('0x16')],![])){this[_0x2e54('0x7')][_0x2e54('0x12')][this[_0x2e54('0x6')]['id']][_0x2e54('0x17')]=!![];this[_0x2e54('0x7')][_0x2e54('0x12')][this[_0x2e54('0x6')]['id']][_0x2e54('0x18')]=undefined;util[_0x2e54('0x19')](this[_0x2e54('0x4')],this[_0x2e54('0x5')]['id'],this[_0x2e54('0x7')][_0x2e54('0x12')][this[_0x2e54('0x6')]['id']],null,this['routing']);util[_0x2e54('0x1a')](this[_0x2e54('0x5')]['id'],this[_0x2e54('0x7')][_0x2e54('0x12')][this[_0x2e54('0x6')]['id']],_0x2e54('0x1b')+(this[_0x2e54('0x3')]['forcedOwnership']?_0x2e54('0x1c'):''));}else{logger[_0x2e54('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this['squeue']['id'],this[_0x2e54('0x6')]['id']);setTimeout(this['push'][_0x2e54('0xb')](this),0x3e8);}}};Agent[_0x2e54('0xe')][_0x2e54('0xa')]=function(_0x29a461){if(_[_0x2e54('0x11')](this[_0x2e54('0x7')]['agents'][this[_0x2e54('0x6')]['id']])){return logger[_0x2e54('0xf')](_0x2e54('0x13'),this[_0x2e54('0x5')]['id'],this[_0x2e54('0x6')]['id']);}else{logger[_0x2e54('0xf')](_0x2e54('0x1d'),this['squeue']['id'],this['agent']['id']);util[_0x2e54('0x1e')](this[_0x2e54('0x4')],this['squeue']['id'],this[_0x2e54('0x7')][_0x2e54('0x12')][this[_0x2e54('0x6')]['id']],null,this[_0x2e54('0x3')]);this[_0x2e54('0x7')][_0x2e54('0x12')][this['agent']['id']]['busy']=![];this['realtime'][_0x2e54('0x12')][this[_0x2e54('0x6')]['id']][_0x2e54('0x18')]=undefined;util[_0x2e54('0x1a')](this[_0x2e54('0x5')]['id'],this[_0x2e54('0x7')][_0x2e54('0x12')][this['agent']['id']],_0x29a461?_0x2e54('0x1f'):_0x2e54('0x20'));}if(!_0x29a461){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x22fa9b,_0x32d103,_0x53ee23,_0x382d00){return new Agent(_0x22fa9b,_0x32d103,_0x53ee23,_0x382d00);}module[_0x2e54('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 bd0080f..bb72c6a 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 _0x7fbe=['[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','name','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','busyQueue','exports','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','Agents','length','isNil','agents'];(function(_0x2601b4,_0x5b558d){var _0xd5ebe2=function(_0x5bf814){while(--_0x5bf814){_0x2601b4['push'](_0x2601b4['shift']());}};_0xd5ebe2(++_0x5b558d);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x5bac10,_0x436643){_0x5bac10=_0x5bac10-0x0;var _0x362c49=_0x7fbe[_0x5bac10];return _0x362c49;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0xe7fb('0x0'));var logger=require(_0xe7fb('0x1'))(_0xe7fb('0x2'));var Beepall=function(_0x1703d5,_0x517d3a,_0x47625b,_0x11d2c4){this[_0xe7fb('0x3')]=uuid['v4']();this[_0xe7fb('0x4')]=_0x1703d5;this[_0xe7fb('0x5')]=_0x517d3a;this[_0xe7fb('0x6')]=_0x47625b;this[_0xe7fb('0x2')]=_0x11d2c4;this[_0xe7fb('0x4')][_0xe7fb('0x7')](this['handleRun'][_0xe7fb('0x8')](this),this[_0xe7fb('0x9')][_0xe7fb('0x8')](this));this[_0xe7fb('0x4')]['on']('timeout',this['handleTimeout'][_0xe7fb('0x8')](this));this[_0xe7fb('0x4')]['on'](_0xe7fb('0xa'),this[_0xe7fb('0xb')][_0xe7fb('0x8')](this));};Beepall[_0xe7fb('0xc')][_0xe7fb('0x7')]=function(){this[_0xe7fb('0x4')][_0xe7fb('0x7')](this[_0xe7fb('0xd')][_0xe7fb('0x8')](this),this[_0xe7fb('0x9')][_0xe7fb('0x8')](this));};Beepall[_0xe7fb('0xc')][_0xe7fb('0xb')]=function(_0x598729){this[_0xe7fb('0x9')](!![]);};Beepall[_0xe7fb('0xc')]['handleRun']=function(_0x30015a){var _0x37eb9f=!![];if(!_['isNil'](this[_0xe7fb('0x5')])&&!_['isNil'](this[_0xe7fb('0x5')][_0xe7fb('0xe')])&&this[_0xe7fb('0x5')][_0xe7fb('0xe')]['length']>0x0){for(var _0x892b0f=0x0,_0x5ebc87;_0x892b0f0x0){for(var _0x116f46=0x0,_0x1adadc;_0x116f460x0&&_0x488b47[_0x2f0569+_0xef61('0x27')]>=_0x488b47[_0x2f0569+_0xef61('0x28')]){writeLog(_0x5ae7a2,_0x488b47,_0x2f0569[_0xef61('0x29')]()+_0xef61('0x2a'));return![];}}return!![];};exports[_0xef61('0x2b')]=function(_0x297df7,_0x1ee27b,_0x3a16ba,_0x18426f,_0xeb9a62){return sendNotification(!![],_0x297df7,_0x1ee27b,_0x3a16ba,_0x18426f,_0xeb9a62);};exports[_0xef61('0x2c')]=function(_0x1f3572,_0x85978,_0x39c15e,_0x393ea9,_0x587e26){return sendNotification(![],_0x1f3572,_0x85978,_0x39c15e,_0x393ea9,_0x587e26);};exports[_0xef61('0x2d')]=writeLog; \ No newline at end of file +var _0x0a6b=['hideNotification','writeLog','lodash','ioredis','../../../../../config/logger','routing','redis','socket.io-emitter','emit','format','name','split','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','user:%s','notification:%s','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x53249a,_0x1bb7f9){_0x53249a=_0x53249a-0x0;var _0x4f65aa=_0x0a6b[_0x53249a];return _0x4f65aa;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var utils=require('../utils');var Mustache=require('mustache');var Redis=require(_0xb0a6('0x1'));var config=require('../../../../../config/environment');var logger=require(_0xb0a6('0x2'))(_0xb0a6('0x3'));config[_0xb0a6('0x4')]=_['defaults'](config[_0xb0a6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xb0a6('0x5'))(new Redis(config[_0xb0a6('0x4')]));function emit(_0x5e2d2d,_0x11cd5b,_0x24515c){io['to'](_0x5e2d2d)[_0xb0a6('0x6')](_0x11cd5b,_0x24515c);}function sendNotification(_0x530c05,_0x47c553,_0x5161af,_0x2ded05,_0x43e5a5,_0x34b835){io['to'](util[_0xb0a6('0x7')]('user:%s',_0x2ded05[_0xb0a6('0x8')]))[_0xb0a6('0x6')]('user:save',_0x2ded05);var _0x23eade=_0x34b835||{};var _0x24e4fd=_0x5161af[_0xb0a6('0x9')]('.');var _0x2a5bb3={'uniqueid':_0x47c553,'channel':_0x24e4fd[0x0],'id':_0x24e4fd[0x1],'title':_0x24e4fd[0x0]+_0xb0a6('0xa'),'interactionId':_0x24e4fd[0x2],'queue':_0x43e5a5?_0x43e5a5[_0xb0a6('0x8')]:null,'sound':_0x23eade[_0xb0a6('0xb')][_0xb0a6('0xc')],'shake':_0x23eade[_0xb0a6('0xb')][_0xb0a6('0xd')]};try{if(!_0x23eade['body']){_0x23eade[_0xb0a6('0xe')]={};}if(_0x43e5a5){_0x23eade['body'][_0xb0a6('0xf')]=_0x43e5a5;}else if(_0x23eade['body'][_0xb0a6('0xf')]){delete _0x23eade['body'][_0xb0a6('0xf')];}_0x2a5bb3[_0xb0a6('0x10')]=utils[_0xb0a6('0x11')](_0x23eade['account']['notificationTemplate'],_0x23eade);}catch(_0x51105b){_0x2a5bb3[_0xb0a6('0x10')]=_0xb0a6('0x12');logger[_0xb0a6('0x13')](util[_0xb0a6('0x7')](_0xb0a6('0x14'),_0x47c553,_0x51105b['message']));}io['to'](util[_0xb0a6('0x7')](_0xb0a6('0x15'),_0x2ded05[_0xb0a6('0x8')]))[_0xb0a6('0x6')](util[_0xb0a6('0x7')](_0xb0a6('0x16'),_0x530c05?'save':_0xb0a6('0x17')),_0x2a5bb3);}function writeLog(_0x6d2003,_0x2d0fca,_0x6bdcc1){return logger[_0xb0a6('0x18')](util[_0xb0a6('0x7')](_0xb0a6('0x19'),_0x6d2003,_0x2d0fca[_0xb0a6('0x8')],_0x6bdcc1));}exports['isAgentAvailable']=function(_0x3db6a6,_0x5c6e66,_0x1322ec,_0x2f1e97){if(_0x5c6e66['busy']){writeLog(_0x3db6a6,_0x5c6e66,'BUSY');return![];}if(!_0x5c6e66[_0xb0a6('0x1a')]){writeLog(_0x3db6a6,_0x5c6e66,_0xb0a6('0x1b'));return![];}if(_0x5c6e66[_0x1322ec+'Pause']){writeLog(_0x3db6a6,_0x5c6e66,_0xb0a6('0x1c'));return![];}if(_0x2f1e97&&_0x5c6e66[_0xb0a6('0x1d')](_0x1322ec+_0xb0a6('0x1e'))&&_0x5c6e66[_0xb0a6('0x1d')](_0x1322ec+'CurrentCapacity')){if(_0x5c6e66[_0x1322ec+'Capacity']>0x0&&_0x5c6e66[_0x1322ec+_0xb0a6('0x1f')]>=_0x5c6e66[_0x1322ec+_0xb0a6('0x1e')]){writeLog(_0x3db6a6,_0x5c6e66,_0x1322ec[_0xb0a6('0x20')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xb0a6('0x21')]=function(_0x3347ac,_0x3edd9a,_0xc1c647,_0x10cf86,_0x3aef2b){return sendNotification(!![],_0x3347ac,_0x3edd9a,_0xc1c647,_0x10cf86,_0x3aef2b);};exports[_0xb0a6('0x22')]=function(_0x305661,_0x4255b9,_0x4ced9f,_0x12d683,_0x26eb41){return sendNotification(![],_0x305661,_0x4255b9,_0x4ced9f,_0x12d683,_0x26eb41);};exports[_0xb0a6('0x23')]=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 b165bd6..1ef297d 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 _0x9e6f=['trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','lodash','./utils','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec'];(function(_0x590657,_0x4e51ed){var _0x458b06=function(_0x4bc839){while(--_0x4bc839){_0x590657['push'](_0x590657['shift']());}};_0x458b06(++_0x4e51ed);}(_0x9e6f,0x76));var _0xf9e6=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x9e6f[_0x55e08b];return _0xd1a7ff;};'use strict';var schema=require(_0xf9e6('0x0'));var sh=require('shelljs');var _=require(_0xf9e6('0x1'));var utils=require(_0xf9e6('0x2'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':_0xf9e6('0x3'),'required':!![],'message':_0xf9e6('0x4')}});exports[_0xf9e6('0x5')]=function(_0xf01080,_0x3de0f2){return function(_0x1749a1){try{var _0x387e3b={'command':_0x3de0f2[0x0]};var _0xd35505=system['validate'](_0x387e3b,{'typecast':!![]});if(_0xd35505[_0xf9e6('0x6')]){logger[_0xf9e6('0x7')](_0xf9e6('0x8'),_0xf01080,_[_0xf9e6('0x9')](_0xd35505,_0xf9e6('0xa'))[_0xf9e6('0xb')](',\x20'));logger[_0xf9e6('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0xf01080);_0x1749a1[_0xf9e6('0xd')]();}else{var _0x5cb500=this;var _0x54135c=utils[_0xf9e6('0xe')](_0x3de0f2[0x0],this);logger[_0xf9e6('0xc')](_0xf9e6('0xf'),_0xf01080,_0x54135c);sh[_0xf9e6('0x10')](_[_0xf9e6('0x11')](_0x54135c),function(_0x35c50a,_0x873172){logger[_0xf9e6('0xc')](_0xf9e6('0x12'),_0xf01080,_0x35c50a);if(_0x35c50a==0x0){var _0x376f66=_0x873172['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xf9e6('0x13')](_0x3de0f2[0x1])||_[_0xf9e6('0x14')](_0x3de0f2[0x1])){logger['info'](_0xf9e6('0x15'),_0xf01080);_0x5cb500[_0xf9e6('0x16')][_0x3de0f2[0x1]]=_0x376f66;}else{logger['info'](_0xf9e6('0x17'),_0xf01080,_0x3de0f2[0x1],_0x376f66);_0x5cb500['body'][_0x3de0f2[0x1]]=_0x376f66;}}_0x1749a1[_0xf9e6('0xd')]();});}}catch(_0x5a7090){logger[_0xf9e6('0x7')](_0xf9e6('0x8'),_0xf01080,_[_0xf9e6('0x18')](_0x5a7090)?JSON[_0xf9e6('0x19')](_0x5a7090):_0x5a7090);logger['info'](_0xf9e6('0x1a'),_0xf01080);_0x1749a1[_0xf9e6('0xd')]();}};}; \ No newline at end of file +var _0x30cb=['../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','message','info','next','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','error','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils'];(function(_0x5ddec9,_0x209a36){var _0x5abb94=function(_0x5816db){while(--_0x5816db){_0x5ddec9['push'](_0x5ddec9['shift']());}};_0x5abb94(++_0x209a36);}(_0x30cb,0x1c4));var _0xb30c=function(_0x4f4c11,_0xdb6add){_0x4f4c11=_0x4f4c11-0x0;var _0x4dfd33=_0x30cb[_0x4f4c11];return _0x4dfd33;};'use strict';var schema=require(_0xb30c('0x0'));var sh=require(_0xb30c('0x1'));var _=require(_0xb30c('0x2'));var utils=require(_0xb30c('0x3'));var logger=require(_0xb30c('0x4'))(_0xb30c('0x5'));var system=schema({'command':{'type':_0xb30c('0x6'),'required':!![],'message':_0xb30c('0x7')}});exports[_0xb30c('0x8')]=function(_0x4c16d4,_0x5c0fcd){return function(_0x3996e0){try{var _0x5677b8={'command':_0x5c0fcd[0x0]};var _0x14959d=system['validate'](_0x5677b8,{'typecast':!![]});if(_0x14959d[_0xb30c('0x9')]){logger['error']('[%s][SYSTEM]\x20%s',_0x4c16d4,_['map'](_0x14959d,_0xb30c('0xa'))['join'](',\x20'));logger[_0xb30c('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4c16d4);_0x3996e0[_0xb30c('0xc')]();}else{var _0x4e7490=this;var _0xb3a257=utils['getMustacheRender'](_0x5c0fcd[0x0],this);logger[_0xb30c('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x4c16d4,_0xb3a257);sh[_0xb30c('0xd')](_['trim'](_0xb3a257),function(_0x4b67c5,_0x3d248a){logger[_0xb30c('0xb')](_0xb30c('0xe'),_0x4c16d4,_0x4b67c5);if(_0x4b67c5==0x0){var _0x308237=_0x3d248a[_0xb30c('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0xb30c('0x10')](_0x5c0fcd[0x1])||_[_0xb30c('0x11')](_0x5c0fcd[0x1])){logger[_0xb30c('0xb')]('[%s][SYSTEM]\x20no\x20variable',_0x4c16d4);_0x4e7490[_0xb30c('0x12')][_0x5c0fcd[0x1]]=_0x308237;}else{logger['info'](_0xb30c('0x13'),_0x4c16d4,_0x5c0fcd[0x1],_0x308237);_0x4e7490[_0xb30c('0x12')][_0x5c0fcd[0x1]]=_0x308237;}}_0x3996e0[_0xb30c('0xc')]();});}}catch(_0x2a0d1f){logger[_0xb30c('0x14')](_0xb30c('0x15'),_0x4c16d4,_[_0xb30c('0x16')](_0x2a0d1f)?JSON[_0xb30c('0x17')](_0x2a0d1f):_0x2a0d1f);logger[_0xb30c('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x4c16d4);_0x3996e0[_0xb30c('0xc')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index 0fa9785..e6aeeb4 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 _0x4d0b=['../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','consequence','validate','length','error','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify','finally','isObject','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction'];(function(_0x5391ef,_0x3c8788){var _0x136499=function(_0x4d80a5){while(--_0x4d80a5){_0x5391ef['push'](_0x5391ef['shift']());}};_0x136499(++_0x3c8788);}(_0x4d0b,0xf9));var _0xb4d0=function(_0x1fdd71,_0x327449){_0x1fdd71=_0x1fdd71-0x0;var _0x115339=_0x4d0b[_0x1fdd71];return _0x115339;};'use strict';var schema=require('validate');var _=require('lodash');var rpc={'chatInteraction':require(_0xb4d0('0x0')),'openchannelInteraction':require(_0xb4d0('0x1')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0xb4d0('0x2')),'faxInteraction':require(_0xb4d0('0x3')),'whatsappInteraction':require(_0xb4d0('0x4'))};var logger=require(_0xb4d0('0x5'))('routing');var tag=schema({'tag':{'type':_0xb4d0('0x6'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xb4d0('0x7')]=function(_0x368b0c,_0x2e5140,_0x3995c9,_0x25610c){return function(_0x1305f4){try{var _0x54c317={'tag':_0x2e5140[0x0]};var _0x203ef1=tag[_0xb4d0('0x8')](_0x54c317,{'typecast':!![]});if(_0x203ef1[_0xb4d0('0x9')]){logger[_0xb4d0('0xa')]('[%s][TAG]\x20%s',_0x368b0c,_[_0xb4d0('0xb')](_0x203ef1,_0xb4d0('0xc'))[_0xb4d0('0xd')](',\x20'));logger['info'](_0xb4d0('0xe'),_0x368b0c);_0x1305f4[_0xb4d0('0xf')]();}else{var _0x1d713c={'ids':[_0x2e5140[0x0]]};if(rpc[_0x25610c[_0xb4d0('0x10')]+_0xb4d0('0x11')]){rpc[_0x25610c['channel']+_0xb4d0('0x11')][_0xb4d0('0x12')](_0x25610c[_0xb4d0('0x13')]['id'],_0x1d713c)[_0xb4d0('0x14')](function(_0xdc767f){logger[_0xb4d0('0x15')](_0xb4d0('0x16'),_0x368b0c,_0x2e5140[0x1],_0x25610c[_0xb4d0('0x10')],_0x25610c['interaction']['id']);})[_0xb4d0('0x17')](function(_0x48455e){logger[_0xb4d0('0xa')](_0xb4d0('0x18'),_0x368b0c,JSON[_0xb4d0('0x19')](_0x48455e));logger[_0xb4d0('0x15')](_0xb4d0('0xe'),_0x368b0c);})[_0xb4d0('0x1a')](function(){_0x1305f4[_0xb4d0('0xf')]();});}}}catch(_0x2b9bcf){logger[_0xb4d0('0xa')](_0xb4d0('0x18'),_0x368b0c,_[_0xb4d0('0x1b')](_0x2b9bcf)?JSON[_0xb4d0('0x19')](_0x2b9bcf):_0x2b9bcf);logger[_0xb4d0('0x15')](_0xb4d0('0xe'),_0x368b0c);_0x1305f4[_0xb4d0('0xf')]();}};}; \ No newline at end of file +var _0x0d28=['consequence','validate','length','error','[%s][TAG]\x20%s','message','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','next','isObject','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing'];(function(_0x5a5a8a,_0x3b1050){var _0xfd289c=function(_0x3d8a27){while(--_0x3d8a27){_0x5a5a8a['push'](_0x5a5a8a['shift']());}};_0xfd289c(++_0x3b1050);}(_0x0d28,0x149));var _0x80d2=function(_0x5bdf15,_0x39f070){_0x5bdf15=_0x5bdf15-0x0;var _0x1c7939=_0x0d28[_0x5bdf15];return _0x1c7939;};'use strict';var schema=require('validate');var _=require(_0x80d2('0x0'));var rpc={'chatInteraction':require(_0x80d2('0x1')),'openchannelInteraction':require(_0x80d2('0x2')),'smsInteraction':require(_0x80d2('0x3')),'mailInteraction':require(_0x80d2('0x4')),'faxInteraction':require(_0x80d2('0x5')),'whatsappInteraction':require(_0x80d2('0x6'))};var logger=require(_0x80d2('0x7'))(_0x80d2('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x80d2('0x9')]=function(_0x2ff894,_0x344410,_0x5b4173,_0x44fe3d){return function(_0x5e7a64){try{var _0x38f8fb={'tag':_0x344410[0x0]};var _0x22d378=tag[_0x80d2('0xa')](_0x38f8fb,{'typecast':!![]});if(_0x22d378[_0x80d2('0xb')]){logger[_0x80d2('0xc')](_0x80d2('0xd'),_0x2ff894,_['map'](_0x22d378,_0x80d2('0xe'))['join'](',\x20'));logger['info'](_0x80d2('0xf'),_0x2ff894);_0x5e7a64['next']();}else{var _0xe6ee6b={'ids':[_0x344410[0x0]]};if(rpc[_0x44fe3d[_0x80d2('0x10')]+_0x80d2('0x11')]){rpc[_0x44fe3d[_0x80d2('0x10')]+_0x80d2('0x11')][_0x80d2('0x12')](_0x44fe3d[_0x80d2('0x13')]['id'],_0xe6ee6b)['then'](function(_0x22f26d){logger[_0x80d2('0x14')](_0x80d2('0x15'),_0x2ff894,_0x344410[0x1],_0x44fe3d[_0x80d2('0x10')],_0x44fe3d['interaction']['id']);})['catch'](function(_0x612b63){logger[_0x80d2('0xc')]('[%s][TAG]\x20%s',_0x2ff894,JSON[_0x80d2('0x16')](_0x612b63));logger[_0x80d2('0x14')](_0x80d2('0xf'),_0x2ff894);})[_0x80d2('0x17')](function(){_0x5e7a64[_0x80d2('0x18')]();});}}}catch(_0x45ceca){logger['error'](_0x80d2('0xd'),_0x2ff894,_[_0x80d2('0x19')](_0x45ceca)?JSON[_0x80d2('0x16')](_0x45ceca):_0x45ceca);logger[_0x80d2('0x14')](_0x80d2('0xf'),_0x2ff894);_0x5e7a64[_0x80d2('0x18')]();}};}; \ 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 74a1f77..951305f 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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x4b027b,_0x5a9005){var _0x2a7550=function(_0x39b444){while(--_0x39b444){_0x4b027b['push'](_0x4b027b['shift']());}};_0x2a7550(++_0x5a9005);}(_0x9c44,0x178));var _0x49c4=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x9c44[_0x13e741];return _0x3f8bb3;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x3c22f3,_0x483b11){var _0x2d1b2f=function(_0x14be5c){while(--_0x14be5c){_0x3c22f3['push'](_0x3c22f3['shift']());}};_0x2d1b2f(++_0x483b11);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 248f3fa..a8e7aa8 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 _0x1845=['%s.%s.%s','isNil','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','channel','mail','push','slice','dialogflow','split','dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','error','Please\x20create\x20a\x20new\x20file\x20under','execute','info','Applications\x20executed','stringify','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','message\x20is\x20empty','busy','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1845,0x116));var _0x5184=function(_0x267061,_0x5022a6){_0x267061=_0x267061-0x0;var _0x483822=_0x1845[_0x267061];return _0x483822;};'use strict';var _=require(_0x5184('0x0'));var util=require(_0x5184('0x1'));var path=require(_0x5184('0x2'));var fs=require('fs');var jayson=require(_0x5184('0x3'));var BPromise=require('bluebird');var uuid=require(_0x5184('0x4'));var config=require(_0x5184('0x5'));var logger=require(_0x5184('0x6'))(_0x5184('0x7'));var rpc={'openchannelQueueReport':require(_0x5184('0x8')),'mailQueueReport':require(_0x5184('0x9')),'chatQueueReport':require(_0x5184('0xa')),'smsQueueReport':require(_0x5184('0xb')),'faxQueueReport':require(_0x5184('0xc')),'whatsappQueueReport':require(_0x5184('0xd'))};var RuleEngine=require(_0x5184('0xe'));function getId(_0xe36c13,_0x18fe4e,_0x5b7530){return util[_0x5184('0xf')](_0x5184('0x10'),_0xe36c13,_0x18fe4e||0x0,_0x5b7530||0x0);}function getIntervals(_0x27d521,_0x29a5e3){var _0x5be0b5=[];if(!_[_0x5184('0x11')](_0x29a5e3['IntervalId'])&&!_['isNil'](_0x27d521[_0x29a5e3['IntervalId']])&&!_['isNil'](_0x27d521[_0x29a5e3['IntervalId']][_0x5184('0x12')])){_0x5be0b5=_[_0x5184('0x13')](_0x27d521[_0x29a5e3['IntervalId']][_0x5184('0x12')],'interval');}else if(!_[_0x5184('0x11')](_0x29a5e3[_0x5184('0x14')])){_0x5be0b5=[_0x29a5e3[_0x5184('0x14')]];}return _0x5be0b5;}exports[_0x5184('0x15')]=function(_0x283c2d){_0x283c2d[_0x5184('0x16')]={};return new BPromise(function(_0x765a4b,_0x35f94b){var _0x19e571={'Start':function(_0x506245){var _0xf3ceb7=this;return new Promise(function(_0x2310a9,_0x17134f){if(_0x506245){try{var _0x14b0fe=[];var _0x2db542=getId(_0x506245['channel'],_0x506245[_0x5184('0x17')]?_0x506245[_0x5184('0x17')]['id']:0x0,_0x506245[_0x5184('0x18')]?_0x506245['interaction']['id']:0x0);if(_0x506245[_0x5184('0x19')]&&_[_0x5184('0x1a')](_0x506245[_0x5184('0x19')])&&_0x506245[_0x5184('0x19')]['length']){for(var _0x3eaf14=0x0;_0x3eaf14<_0x506245[_0x5184('0x19')][_0x5184('0x1b')];_0x3eaf14+=0x1){var _0x5a9bec=_0x506245[_0x5184('0x19')][_0x3eaf14];if(fs[_0x5184('0x1c')](path[_0x5184('0x1d')](__dirname,_0x5184('0x19'),_0x5a9bec[_0x5184('0x1e')]+_0x5184('0x1f')))){var _0x1428fd=[];switch(_0x5a9bec[_0x5184('0x1e')][_0x5184('0x20')]()){case _0x5184('0x21'):var _0x35e52d=_0x5a9bec[_0x5184('0x22')]['split'](',');if(_0x506245[_0x5184('0x23')]===_0x5184('0x24')){_0x1428fd[_0x5184('0x25')](_0x35e52d[0x0]);_0x1428fd[_0x5184('0x25')](_0x35e52d[0x1]);_0x1428fd[_0x5184('0x25')](_0x35e52d[_0x5184('0x26')](0x2,_0x35e52d[_0x5184('0x1b')])[_0x5184('0x1d')](','));}else{_0x1428fd[_0x5184('0x25')](_0x35e52d[0x0]);_0x1428fd[_0x5184('0x25')](_0x35e52d[_0x5184('0x26')](0x1,_0x35e52d[_0x5184('0x1b')])[_0x5184('0x1d')](','));}break;case _0x5184('0x27'):var _0x12667a=_0x5a9bec['appdata'][_0x5184('0x28')](',');_0x1428fd[_0x5184('0x25')](_0x12667a[0x0]);_0x1428fd[_0x5184('0x25')](_0x12667a[0x1]);_0x1428fd[_0x5184('0x25')](_0x12667a[_0x5184('0x26')](0x2,_0x12667a[_0x5184('0x1b')])[_0x5184('0x1d')](','));break;case _0x5184('0x29'):var _0x20b0cf=_0x5a9bec[_0x5184('0x22')][_0x5184('0x28')](',');_0x1428fd['push'](_0x20b0cf[0x0]);_0x1428fd[_0x5184('0x25')](_0x20b0cf[0x1]);_0x1428fd['push'](_0x20b0cf[0x2]);_0x1428fd[_0x5184('0x25')](_0x20b0cf[0x3]);_0x1428fd['push'](_0x20b0cf['slice'](0x4,_0x20b0cf[_0x5184('0x1b')])['join'](','));break;case _0x5184('0x2a'):var _0x1b47a9=_0x5a9bec[_0x5184('0x22')][_0x5184('0x28')](',');_0x1428fd['push'](_0x1b47a9[0x0]);_0x1428fd[_0x5184('0x25')](_0x1b47a9[0x1]);_0x1428fd[_0x5184('0x25')](_0x1b47a9[0x2]);_0x1428fd[_0x5184('0x25')](_0x1b47a9[0x3]);_0x1428fd[_0x5184('0x25')](_0x1b47a9[_0x5184('0x26')](0x4,_0x1b47a9['length'])[_0x5184('0x1d')](','));break;case _0x5184('0x17'):_0x1428fd[_0x5184('0x25')](_0x5a9bec[_0x5184('0x22')]);break;case _0x5184('0x2b'):_0x1428fd[_0x5184('0x25')](_0x5a9bec[_0x5184('0x2c')]);_0x1428fd[_0x5184('0x25')](_0x5a9bec['appdata']);break;default:_0x1428fd=_[_0x5184('0x11')](_0x5a9bec[_0x5184('0x22')])?[]:_0x5a9bec[_0x5184('0x22')][_0x5184('0x28')](',');}var _0x56b045={'id':util[_0x5184('0xf')](_0x5184('0x2d'),_0x2db542,_0x5a9bec['id'],_0x5a9bec[_0x5184('0x1e')]),'condition':require(_0x5184('0x2e'))[_0x5184('0x2f')](_0x2db542,getIntervals(_0x283c2d[_0x5184('0x30')],_0x5a9bec),_0x283c2d),'consequence':require(_0x5184('0x31')+_0x5a9bec[_0x5184('0x1e')])[_0x5184('0x32')](_0x2db542,_0x1428fd,_0x283c2d,_0x506245),'p':_0x5a9bec[_0x5184('0x33')]||0x0};logger['info'](_0x5184('0x34'),_0x56b045['id'],'on\x20interval',getIntervals(_0x283c2d['intervals'],_0x5a9bec)['join']('\x20|\x20'));_0x14b0fe[_0x5184('0x25')](_0x56b045);}else{logger[_0x5184('0x35')](_0x5184('0x36'),path[_0x5184('0x1d')](__dirname,'applications',_0x5a9bec['app']+_0x5184('0x1f')));}}_0x283c2d[_0x5184('0x16')][_0x2db542]=new RuleEngine(_0x14b0fe);_0x283c2d[_0x5184('0x16')][_0x2db542][_0x5184('0x37')](_0x506245,function(_0x2c86f0){logger[_0x5184('0x38')](_0x5184('0x39'),JSON[_0x5184('0x3a')](_0x2c86f0['matchPath']));if(_0x283c2d[_0x5184('0x16')][_0x2db542]){_0x283c2d[_0x5184('0x16')][_0x2db542][_0x5184('0x3b')]('complete');}});return _0x2310a9({'code':0xc8,'message':_0x506245});}else{logger['info'](_0x5184('0x3c'));return _0x2310a9({'code':0xc8,'message':_0x506245});}}catch(_0xbe73a){logger[_0x5184('0x35')](_0xbe73a[_0x5184('0x3d')]);return _0x17134f(_0xf3ceb7[_0x5184('0x35')](0x1f4,_0xbe73a));}}return _0x17134f(_0x5184('0x3e'));});},'AcceptMessage':function(_0x54b515){var _0x531b08=this;return new Promise(function(_0x148621,_0x5297e7){if(_0x54b515[_0x5184('0x3f')]&&_0x54b515['agent']['id']){if(_0x283c2d[_0x5184('0x40')][_0x54b515[_0x5184('0x3f')]['id']]){_0x283c2d['agents'][_0x54b515[_0x5184('0x3f')]['id']]['busy']=![];_0x283c2d['agents'][_0x54b515[_0x5184('0x3f')]['id']][_0x5184('0x41')]=undefined;}}if(_0x54b515['message']&&_0x54b515[_0x5184('0x17')]['id']){try{var _0x101ad3=getId(_0x54b515[_0x5184('0x23')],_0x54b515['message']?_0x54b515[_0x5184('0x17')]['id']:0x0,_0x54b515[_0x5184('0x18')]?_0x54b515[_0x5184('0x18')]['id']:0x0);if(_0x283c2d[_0x5184('0x16')][_0x101ad3]){_0x283c2d[_0x5184('0x16')][_0x101ad3][_0x5184('0x3b')](_0x5184('0x42'));if(rpc[_0x54b515[_0x5184('0x23')]+_0x5184('0x43')]){rpc[_0x54b515[_0x5184('0x23')]+_0x5184('0x43')][_0x5184('0x44')](_0x101ad3,{'UserId':_0x54b515[_0x5184('0x17')][_0x5184('0x45')]})[_0x5184('0x46')](function(_0x14adf4){logger[_0x5184('0x35')]('error\x20update\x20queue\x20report');});}}return _0x148621({'code':0xc8,'message':_0x54b515});}catch(_0x3dacab){logger[_0x5184('0x35')](_0x3dacab[_0x5184('0x3d')]);return _0x5297e7(_0x531b08['error'](0x1f4,_0x3dacab));}}logger['error'](_0x5184('0x47'));return _0x5297e7(_0x531b08[_0x5184('0x35')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x5ab711){var _0x435115=this;return new Promise(function(_0x56a8f0,_0x1c75f4){if(_0x5ab711[_0x5184('0x3f')]&&_0x5ab711['agent']['id']){try{if(_0x283c2d[_0x5184('0x40')][_0x5ab711[_0x5184('0x3f')]['id']]){_0x283c2d[_0x5184('0x40')][_0x5ab711['agent']['id']][_0x5184('0x48')]=![];_0x283c2d[_0x5184('0x40')][_0x5ab711['agent']['id']][_0x5184('0x41')]=undefined;}return _0x56a8f0({'code':0xc8,'message':_0x5ab711});}catch(_0x2a2418){logger[_0x5184('0x35')](_0x2a2418[_0x5184('0x3d')]);return _0x1c75f4(_0x435115['error'](0x1f4,_0x2a2418));}}logger[_0x5184('0x35')](_0x5184('0x47'));return _0x1c75f4(_0x435115[_0x5184('0x35')](0x1f4,_0x5184('0x47')));});},'AbandonInteraction':function(_0x243036){var _0x44b119=this;return new Promise(function(_0x983f8f,_0x36dfbe){if(_0x243036['channel']&&_0x243036[_0x5184('0x18')]&&_0x243036[_0x5184('0x18')]['id']){try{var _0x19c1de=getId(_0x243036[_0x5184('0x23')],_0x243036[_0x5184('0x17')]?_0x243036[_0x5184('0x17')]['id']:0x0,_0x243036[_0x5184('0x18')]?_0x243036[_0x5184('0x18')]['id']:0x0);if(_0x283c2d[_0x5184('0x16')][_0x19c1de]){_0x283c2d[_0x5184('0x16')][_0x19c1de]['emit'](_0x5184('0x42'));}return _0x983f8f({'code':0xc8,'message':_0x243036});}catch(_0x65113f){logger[_0x5184('0x35')](_0x65113f[_0x5184('0x3d')]);return _0x36dfbe(_0x44b119[_0x5184('0x35')](0x1f4,_0x65113f));}}logger[_0x5184('0x35')](_0x5184('0x47'));return _0x36dfbe(_0x44b119['error'](0x1f4,_0x5184('0x47')));});},'AgentCapacity':function(_0x48d4e9){var _0x2a9d77=this;return new Promise(function(_0x30628e,_0x32add8){if(_0x283c2d['agents'][_0x5184('0x49')](_0x48d4e9['id'])){for(var _0x471de4 in _0x48d4e9['capacity']){if(_0x48d4e9['capacity'][_0x5184('0x49')](_0x471de4)){if(_0x283c2d[_0x5184('0x40')][_0x48d4e9['id']][_0x5184('0x49')](_0x471de4+_0x5184('0x4a'))){_0x283c2d['agents'][_0x48d4e9['id']][_0x471de4+_0x5184('0x4a')]=parseInt(_0x48d4e9['capacity'][_0x471de4],0xa);}}}_0x283c2d[_0x5184('0x40')][_0x48d4e9['id']][_0x5184('0x4b')]();return _0x30628e({'code':0xc8,'message':_0x283c2d[_0x5184('0x40')][_0x48d4e9['id']]});}else{return _0x32add8(_0x2a9d77[_0x5184('0x35')](0x1f4,_0x5184('0x4c')));}});},'Agents':function(_0x31e2e6){return new Promise(function(_0x1ee84d,_0x233a7a){var _0x2594aa=_['values'](_0x283c2d['agents']);_0x1ee84d({'count':_0x2594aa[_0x5184('0x1b')],'rows':_0x2594aa});});},'ChatQueues':function(_0x581d67){return new Promise(function(_0x537c48,_0x655f66){var _0x1d170d=[];for(var _0x38cfb4 in _0x283c2d[_0x5184('0x4d')]){if(_0x283c2d['chatQueues'][_0x5184('0x49')](_0x38cfb4)){var _0x4e1870=_0x283c2d[_0x5184('0x4d')][_0x38cfb4];var _0x7b3c9c={'id':_0x4e1870['id'],'available':_0x4e1870[_0x5184('0x4e')],'loggedIn':_0x4e1870[_0x5184('0x4f')],'name':_0x4e1870['name'],'paused':_0x4e1870[_0x5184('0x50')],'waiting':_0x4e1870[_0x5184('0x51')]};_0x1d170d[_0x5184('0x25')](_0x7b3c9c);}}_0x537c48({'count':_0x1d170d[_0x5184('0x1b')],'rows':_0x1d170d});});},'MailQueues':function(_0x5d6307){return new Promise(function(_0x1a33b0,_0x27717e){var _0x5f496e=[];for(var _0x120f0b in _0x283c2d[_0x5184('0x52')]){if(_0x283c2d[_0x5184('0x52')]['hasOwnProperty'](_0x120f0b)){var _0x462bdb=_0x283c2d[_0x5184('0x52')][_0x120f0b];var _0x1a8ebb={'id':_0x462bdb['id'],'available':_0x462bdb['available'],'loggedIn':_0x462bdb[_0x5184('0x4f')],'name':_0x462bdb[_0x5184('0x53')],'paused':_0x462bdb['paused'],'waiting':_0x462bdb[_0x5184('0x51')]};_0x5f496e[_0x5184('0x25')](_0x1a8ebb);}}_0x1a33b0({'count':_0x5f496e[_0x5184('0x1b')],'rows':_0x5f496e});});},'OpenchannelQueues':function(_0x282474){return new Promise(function(_0xb8c185,_0x32dbd7){var _0x1e30fa=[];for(var _0x16dd4e in _0x283c2d[_0x5184('0x54')]){if(_0x283c2d[_0x5184('0x54')]['hasOwnProperty'](_0x16dd4e)){var _0x346074=_0x283c2d['openchannelQueues'][_0x16dd4e];var _0x245446={'id':_0x346074['id'],'available':_0x346074[_0x5184('0x4e')],'loggedIn':_0x346074[_0x5184('0x4f')],'name':_0x346074[_0x5184('0x53')],'paused':_0x346074[_0x5184('0x50')],'waiting':_0x346074['waiting']};_0x1e30fa[_0x5184('0x25')](_0x245446);}}_0xb8c185({'count':_0x1e30fa['length'],'rows':_0x1e30fa});});},'SmsQueues':function(_0x49c9ff){return new Promise(function(_0x208bdd,_0x4fd63f){var _0x45ba88=[];for(var _0x1286e9 in _0x283c2d['smsQueues']){if(_0x283c2d[_0x5184('0x55')]['hasOwnProperty'](_0x1286e9)){var _0x5a5f4a=_0x283c2d[_0x5184('0x55')][_0x1286e9];var _0x49c38b={'id':_0x5a5f4a['id'],'available':_0x5a5f4a[_0x5184('0x4e')],'loggedIn':_0x5a5f4a['loggedIn'],'name':_0x5a5f4a[_0x5184('0x53')],'paused':_0x5a5f4a['paused'],'waiting':_0x5a5f4a[_0x5184('0x51')]};_0x45ba88[_0x5184('0x25')](_0x49c38b);}}_0x208bdd({'count':_0x45ba88[_0x5184('0x1b')],'rows':_0x45ba88});});},'FaxQueues':function(_0x1e44f8){return new Promise(function(_0x4c4e25,_0x56412a){var _0x30d194=[];for(var _0x16029f in _0x283c2d[_0x5184('0x56')]){if(_0x283c2d[_0x5184('0x56')][_0x5184('0x49')](_0x16029f)){var _0x4367dc=_0x283c2d[_0x5184('0x56')][_0x16029f];var _0x2eb1eb={'id':_0x4367dc['id'],'available':_0x4367dc[_0x5184('0x4e')],'loggedIn':_0x4367dc[_0x5184('0x4f')],'name':_0x4367dc[_0x5184('0x53')],'paused':_0x4367dc[_0x5184('0x50')],'waiting':_0x4367dc[_0x5184('0x51')]};_0x30d194['push'](_0x2eb1eb);}}_0x4c4e25({'count':_0x30d194['length'],'rows':_0x30d194});});},'WhatsappQueues':function(_0x13f210){return new Promise(function(_0x2a3ae5,_0x3e3dfc){var _0x3c550f=[];for(var _0x4f1537 in _0x283c2d[_0x5184('0x57')]){if(_0x283c2d[_0x5184('0x57')][_0x5184('0x49')](_0x4f1537)){var _0x2b4a9e=_0x283c2d[_0x5184('0x57')][_0x4f1537];var _0x434954={'id':_0x2b4a9e['id'],'available':_0x2b4a9e[_0x5184('0x4e')],'loggedIn':_0x2b4a9e['loggedIn'],'name':_0x2b4a9e[_0x5184('0x53')],'paused':_0x2b4a9e[_0x5184('0x50')],'waiting':_0x2b4a9e[_0x5184('0x51')]};_0x3c550f[_0x5184('0x25')](_0x434954);}}_0x2a3ae5({'count':_0x3c550f[_0x5184('0x1b')],'rows':_0x3c550f});});},'ChatQueuesWaitingInteractions':function(_0x4d81f6){return new Promise(function(_0x5011fb,_0x16c8f0){var _0xbda562=_[_0x5184('0x58')](_0x283c2d[_0x5184('0x59')]);_0x5011fb({'count':_0xbda562['length'],'rows':_0xbda562});});},'MailQueuesWaitingInteractions':function(_0x415f61){return new Promise(function(_0x1806b4,_0xa101e5){var _0x563bcb=_[_0x5184('0x58')](_0x283c2d['mailQueuesWaitingInteractions']);_0x1806b4({'count':_0x563bcb['length'],'rows':_0x563bcb});});},'OpenchannelQueuesWaitingInteractions':function(_0x3ee9a7){return new Promise(function(_0x353a06,_0x28b58e){var _0xa25b48=_[_0x5184('0x58')](_0x283c2d[_0x5184('0x5a')]);_0x353a06({'count':_0xa25b48[_0x5184('0x1b')],'rows':_0xa25b48});});},'SmsQueuesWaitingInteractions':function(_0x33d6b8){return new Promise(function(_0x4dbcbb,_0x88bf8d){var _0x56ce98=_[_0x5184('0x58')](_0x283c2d[_0x5184('0x5b')]);_0x4dbcbb({'count':_0x56ce98[_0x5184('0x1b')],'rows':_0x56ce98});});},'FaxQueuesWaitingInteractions':function(_0x991180){return new Promise(function(_0x375ddb,_0x3b3f1c){var _0x3dfa79=_[_0x5184('0x58')](_0x283c2d['faxQueuesWaitingInteractions']);_0x375ddb({'count':_0x3dfa79[_0x5184('0x1b')],'rows':_0x3dfa79});});},'WhatsappQueuesWaitingInteractions':function(_0x2b8e10){return new Promise(function(_0x2ca197,_0x5e5abe){var _0x2e8b09=_[_0x5184('0x58')](_0x283c2d['whatsappQueuesWaitingInteractions']);_0x2ca197({'count':_0x2e8b09[_0x5184('0x1b')],'rows':_0x2e8b09});});}};var _0x281a16=jayson[_0x5184('0x5c')](_0x19e571)[_0x5184('0x5d')]();_0x281a16['on'](_0x5184('0x35'),function(_0x54670b){logger[_0x5184('0x35')](JSON[_0x5184('0x3a')](_0x54670b));return _0x35f94b(_0x54670b);});_0x281a16['listen'](0x232c,_0x5184('0x5e'),function(){console[_0x5184('0x5f')](_0x5184('0x60'),0x232c);return _0x765a4b(_0x5184('0x61')+0x232c);});});}; \ No newline at end of file +var _0x4a9a=['app','.js','toLowerCase','mail','push','slice','dialogflow','appdata','split','amazonlex','tag','TagId','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','stringify','complete','stack','agent','agents','busy','emit','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','isArray','applications','length','join'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x4a9a,0x164));var _0xa4a9=function(_0x5a1d40,_0x127e8a){_0x5a1d40=_0x5a1d40-0x0;var _0x2bc28b=_0x4a9a[_0x5a1d40];return _0x2bc28b;};'use strict';var _=require(_0xa4a9('0x0'));var util=require(_0xa4a9('0x1'));var path=require(_0xa4a9('0x2'));var fs=require('fs');var jayson=require(_0xa4a9('0x3'));var BPromise=require(_0xa4a9('0x4'));var uuid=require(_0xa4a9('0x5'));var config=require(_0xa4a9('0x6'));var logger=require(_0xa4a9('0x7'))(_0xa4a9('0x8'));var rpc={'openchannelQueueReport':require(_0xa4a9('0x9')),'mailQueueReport':require(_0xa4a9('0xa')),'chatQueueReport':require(_0xa4a9('0xb')),'smsQueueReport':require(_0xa4a9('0xc')),'faxQueueReport':require(_0xa4a9('0xd')),'whatsappQueueReport':require(_0xa4a9('0xe'))};var RuleEngine=require(_0xa4a9('0xf'));function getId(_0xade4b6,_0x4068b8,_0xf214d7){return util[_0xa4a9('0x10')](_0xa4a9('0x11'),_0xade4b6,_0x4068b8||0x0,_0xf214d7||0x0);}function getIntervals(_0x41e462,_0x3e90fa){var _0x37fe3f=[];if(!_[_0xa4a9('0x12')](_0x3e90fa[_0xa4a9('0x13')])&&!_[_0xa4a9('0x12')](_0x41e462[_0x3e90fa['IntervalId']])&&!_[_0xa4a9('0x12')](_0x41e462[_0x3e90fa['IntervalId']][_0xa4a9('0x14')])){_0x37fe3f=_[_0xa4a9('0x15')](_0x41e462[_0x3e90fa['IntervalId']][_0xa4a9('0x14')],'interval');}else if(!_[_0xa4a9('0x12')](_0x3e90fa[_0xa4a9('0x16')])){_0x37fe3f=[_0x3e90fa[_0xa4a9('0x16')]];}return _0x37fe3f;}exports[_0xa4a9('0x17')]=function(_0x3e8b88){_0x3e8b88[_0xa4a9('0x18')]={};return new BPromise(function(_0xb8b579,_0x49c9bf){var _0x183f1e={'Start':function(_0x4ec012){var _0x4a452c=this;return new Promise(function(_0x4135da,_0x446cf4){if(_0x4ec012){try{var _0x37bc37=[];var _0x361b10=getId(_0x4ec012[_0xa4a9('0x19')],_0x4ec012[_0xa4a9('0x1a')]?_0x4ec012['message']['id']:0x0,_0x4ec012[_0xa4a9('0x1b')]?_0x4ec012['interaction']['id']:0x0);if(_0x4ec012['applications']&&_[_0xa4a9('0x1c')](_0x4ec012[_0xa4a9('0x1d')])&&_0x4ec012[_0xa4a9('0x1d')]['length']){for(var _0x57d9d0=0x0;_0x57d9d0<_0x4ec012[_0xa4a9('0x1d')][_0xa4a9('0x1e')];_0x57d9d0+=0x1){var _0x1e4d78=_0x4ec012[_0xa4a9('0x1d')][_0x57d9d0];if(fs['existsSync'](path[_0xa4a9('0x1f')](__dirname,_0xa4a9('0x1d'),_0x1e4d78[_0xa4a9('0x20')]+_0xa4a9('0x21')))){var _0x386e1f=[];switch(_0x1e4d78[_0xa4a9('0x20')][_0xa4a9('0x22')]()){case'autoreply':var _0x46aa5c=_0x1e4d78['appdata']['split'](',');if(_0x4ec012[_0xa4a9('0x19')]===_0xa4a9('0x23')){_0x386e1f[_0xa4a9('0x24')](_0x46aa5c[0x0]);_0x386e1f[_0xa4a9('0x24')](_0x46aa5c[0x1]);_0x386e1f['push'](_0x46aa5c['slice'](0x2,_0x46aa5c[_0xa4a9('0x1e')])[_0xa4a9('0x1f')](','));}else{_0x386e1f[_0xa4a9('0x24')](_0x46aa5c[0x0]);_0x386e1f['push'](_0x46aa5c[_0xa4a9('0x25')](0x1,_0x46aa5c[_0xa4a9('0x1e')])[_0xa4a9('0x1f')](','));}break;case _0xa4a9('0x26'):var _0x1f960d=_0x1e4d78[_0xa4a9('0x27')][_0xa4a9('0x28')](',');_0x386e1f[_0xa4a9('0x24')](_0x1f960d[0x0]);_0x386e1f[_0xa4a9('0x24')](_0x1f960d[0x1]);_0x386e1f[_0xa4a9('0x24')](_0x1f960d[_0xa4a9('0x25')](0x2,_0x1f960d[_0xa4a9('0x1e')])[_0xa4a9('0x1f')](','));break;case'dialogflowv2':var _0x5e2d16=_0x1e4d78[_0xa4a9('0x27')]['split'](',');_0x386e1f[_0xa4a9('0x24')](_0x5e2d16[0x0]);_0x386e1f[_0xa4a9('0x24')](_0x5e2d16[0x1]);_0x386e1f['push'](_0x5e2d16[0x2]);_0x386e1f[_0xa4a9('0x24')](_0x5e2d16[0x3]);_0x386e1f['push'](_0x5e2d16[_0xa4a9('0x25')](0x4,_0x5e2d16[_0xa4a9('0x1e')])[_0xa4a9('0x1f')](','));break;case _0xa4a9('0x29'):var _0x4fbe64=_0x1e4d78[_0xa4a9('0x27')][_0xa4a9('0x28')](',');_0x386e1f['push'](_0x4fbe64[0x0]);_0x386e1f[_0xa4a9('0x24')](_0x4fbe64[0x1]);_0x386e1f[_0xa4a9('0x24')](_0x4fbe64[0x2]);_0x386e1f[_0xa4a9('0x24')](_0x4fbe64[0x3]);_0x386e1f[_0xa4a9('0x24')](_0x4fbe64['slice'](0x4,_0x4fbe64[_0xa4a9('0x1e')])[_0xa4a9('0x1f')](','));break;case _0xa4a9('0x1a'):_0x386e1f['push'](_0x1e4d78[_0xa4a9('0x27')]);break;case _0xa4a9('0x2a'):_0x386e1f[_0xa4a9('0x24')](_0x1e4d78[_0xa4a9('0x2b')]);_0x386e1f[_0xa4a9('0x24')](_0x1e4d78[_0xa4a9('0x27')]);break;default:_0x386e1f=_['isNil'](_0x1e4d78[_0xa4a9('0x27')])?[]:_0x1e4d78[_0xa4a9('0x27')][_0xa4a9('0x28')](',');}var _0x2cc0ba={'id':util[_0xa4a9('0x10')](_0xa4a9('0x2c'),_0x361b10,_0x1e4d78['id'],_0x1e4d78['app']),'condition':require(_0xa4a9('0x2d'))['condition'](_0x361b10,getIntervals(_0x3e8b88[_0xa4a9('0x2e')],_0x1e4d78),_0x3e8b88),'consequence':require(_0xa4a9('0x2f')+_0x1e4d78[_0xa4a9('0x20')])[_0xa4a9('0x30')](_0x361b10,_0x386e1f,_0x3e8b88,_0x4ec012),'p':_0x1e4d78[_0xa4a9('0x31')]||0x0};logger[_0xa4a9('0x32')](_0xa4a9('0x33'),_0x2cc0ba['id'],_0xa4a9('0x34'),getIntervals(_0x3e8b88[_0xa4a9('0x2e')],_0x1e4d78)['join'](_0xa4a9('0x35')));_0x37bc37[_0xa4a9('0x24')](_0x2cc0ba);}else{logger[_0xa4a9('0x36')](_0xa4a9('0x37'),path[_0xa4a9('0x1f')](__dirname,_0xa4a9('0x1d'),_0x1e4d78[_0xa4a9('0x20')]+_0xa4a9('0x21')));}}_0x3e8b88[_0xa4a9('0x18')][_0x361b10]=new RuleEngine(_0x37bc37);_0x3e8b88[_0xa4a9('0x18')][_0x361b10]['execute'](_0x4ec012,function(_0x5a1407){logger['info']('Applications\x20executed',JSON[_0xa4a9('0x38')](_0x5a1407['matchPath']));if(_0x3e8b88[_0xa4a9('0x18')][_0x361b10]){_0x3e8b88[_0xa4a9('0x18')][_0x361b10]['emit'](_0xa4a9('0x39'));}});return _0x4135da({'code':0xc8,'message':_0x4ec012});}else{logger[_0xa4a9('0x32')]('No\x20applications\x20to\x20execute');return _0x4135da({'code':0xc8,'message':_0x4ec012});}}catch(_0x149982){logger['error'](_0x149982[_0xa4a9('0x3a')]);return _0x446cf4(_0x4a452c[_0xa4a9('0x36')](0x1f4,_0x149982));}}return _0x446cf4('routing\x20is\x20empty');});},'AcceptMessage':function(_0x39af08){var _0x3ea951=this;return new Promise(function(_0x41789f,_0xdfcce0){if(_0x39af08[_0xa4a9('0x3b')]&&_0x39af08[_0xa4a9('0x3b')]['id']){if(_0x3e8b88['agents'][_0x39af08['agent']['id']]){_0x3e8b88[_0xa4a9('0x3c')][_0x39af08['agent']['id']][_0xa4a9('0x3d')]=![];_0x3e8b88[_0xa4a9('0x3c')][_0x39af08[_0xa4a9('0x3b')]['id']]['busyQueue']=undefined;}}if(_0x39af08['message']&&_0x39af08[_0xa4a9('0x1a')]['id']){try{var _0x3d8a1e=getId(_0x39af08[_0xa4a9('0x19')],_0x39af08[_0xa4a9('0x1a')]?_0x39af08['message']['id']:0x0,_0x39af08['interaction']?_0x39af08[_0xa4a9('0x1b')]['id']:0x0);if(_0x3e8b88[_0xa4a9('0x18')][_0x3d8a1e]){_0x3e8b88[_0xa4a9('0x18')][_0x3d8a1e][_0xa4a9('0x3e')]('end');if(rpc[_0x39af08['channel']+'QueueReport']){rpc[_0x39af08['channel']+_0xa4a9('0x3f')][_0xa4a9('0x40')](_0x3d8a1e,{'UserId':_0x39af08['message'][_0xa4a9('0x41')]})[_0xa4a9('0x42')](function(_0x4fe089){logger[_0xa4a9('0x36')](_0xa4a9('0x43'));});}}return _0x41789f({'code':0xc8,'message':_0x39af08});}catch(_0x5629b1){logger[_0xa4a9('0x36')](_0x5629b1['stack']);return _0xdfcce0(_0x3ea951[_0xa4a9('0x36')](0x1f4,_0x5629b1));}}logger['error'](_0xa4a9('0x44'));return _0xdfcce0(_0x3ea951[_0xa4a9('0x36')](0x1f4,_0xa4a9('0x44')));});},'RejectMessage':function(_0x3c72f6){var _0x3b4b1e=this;return new Promise(function(_0x46ff84,_0xe0b553){if(_0x3c72f6[_0xa4a9('0x3b')]&&_0x3c72f6[_0xa4a9('0x3b')]['id']){try{if(_0x3e8b88[_0xa4a9('0x3c')][_0x3c72f6[_0xa4a9('0x3b')]['id']]){_0x3e8b88['agents'][_0x3c72f6['agent']['id']][_0xa4a9('0x3d')]=![];_0x3e8b88[_0xa4a9('0x3c')][_0x3c72f6[_0xa4a9('0x3b')]['id']][_0xa4a9('0x45')]=undefined;}return _0x46ff84({'code':0xc8,'message':_0x3c72f6});}catch(_0x1007ff){logger['error'](_0x1007ff[_0xa4a9('0x3a')]);return _0xe0b553(_0x3b4b1e['error'](0x1f4,_0x1007ff));}}logger[_0xa4a9('0x36')](_0xa4a9('0x44'));return _0xe0b553(_0x3b4b1e[_0xa4a9('0x36')](0x1f4,_0xa4a9('0x44')));});},'AbandonInteraction':function(_0x42af10){var _0x1b1aa8=this;return new Promise(function(_0xa3b261,_0xd50d42){if(_0x42af10[_0xa4a9('0x19')]&&_0x42af10[_0xa4a9('0x1b')]&&_0x42af10[_0xa4a9('0x1b')]['id']){try{var _0x5f2be7=getId(_0x42af10[_0xa4a9('0x19')],_0x42af10[_0xa4a9('0x1a')]?_0x42af10[_0xa4a9('0x1a')]['id']:0x0,_0x42af10[_0xa4a9('0x1b')]?_0x42af10['interaction']['id']:0x0);if(_0x3e8b88[_0xa4a9('0x18')][_0x5f2be7]){_0x3e8b88[_0xa4a9('0x18')][_0x5f2be7]['emit'](_0xa4a9('0x46'));}return _0xa3b261({'code':0xc8,'message':_0x42af10});}catch(_0x225cef){logger[_0xa4a9('0x36')](_0x225cef[_0xa4a9('0x3a')]);return _0xd50d42(_0x1b1aa8['error'](0x1f4,_0x225cef));}}logger[_0xa4a9('0x36')](_0xa4a9('0x44'));return _0xd50d42(_0x1b1aa8[_0xa4a9('0x36')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x10df01){var _0x1dd676=this;return new Promise(function(_0xd70d2c,_0x5eae0d){if(_0x3e8b88['agents'][_0xa4a9('0x47')](_0x10df01['id'])){for(var _0x55f0e5 in _0x10df01[_0xa4a9('0x48')]){if(_0x10df01[_0xa4a9('0x48')][_0xa4a9('0x47')](_0x55f0e5)){if(_0x3e8b88[_0xa4a9('0x3c')][_0x10df01['id']][_0xa4a9('0x47')](_0x55f0e5+_0xa4a9('0x49'))){_0x3e8b88[_0xa4a9('0x3c')][_0x10df01['id']][_0x55f0e5+_0xa4a9('0x49')]=parseInt(_0x10df01['capacity'][_0x55f0e5],0xa);}}}_0x3e8b88[_0xa4a9('0x3c')][_0x10df01['id']][_0xa4a9('0x4a')]();return _0xd70d2c({'code':0xc8,'message':_0x3e8b88[_0xa4a9('0x3c')][_0x10df01['id']]});}else{return _0x5eae0d(_0x1dd676[_0xa4a9('0x36')](0x1f4,_0xa4a9('0x4b')));}});},'Agents':function(_0x41fd19){return new Promise(function(_0x38044a,_0x1b003a){var _0x4ec475=_['values'](_0x3e8b88['agents']);_0x38044a({'count':_0x4ec475[_0xa4a9('0x1e')],'rows':_0x4ec475});});},'ChatQueues':function(_0x1f9848){return new Promise(function(_0x218413,_0xcd4751){var _0x1f4ccb=[];for(var _0x4eaf46 in _0x3e8b88['chatQueues']){if(_0x3e8b88[_0xa4a9('0x4c')][_0xa4a9('0x47')](_0x4eaf46)){var _0x51af70=_0x3e8b88[_0xa4a9('0x4c')][_0x4eaf46];var _0x55bcbf={'id':_0x51af70['id'],'available':_0x51af70[_0xa4a9('0x4d')],'loggedIn':_0x51af70[_0xa4a9('0x4e')],'name':_0x51af70[_0xa4a9('0x4f')],'paused':_0x51af70[_0xa4a9('0x50')],'waiting':_0x51af70[_0xa4a9('0x51')]};_0x1f4ccb[_0xa4a9('0x24')](_0x55bcbf);}}_0x218413({'count':_0x1f4ccb['length'],'rows':_0x1f4ccb});});},'MailQueues':function(_0x506d60){return new Promise(function(_0x1772f7,_0x3fb795){var _0x678b96=[];for(var _0x367ecc in _0x3e8b88[_0xa4a9('0x52')]){if(_0x3e8b88[_0xa4a9('0x52')][_0xa4a9('0x47')](_0x367ecc)){var _0x41639b=_0x3e8b88['mailQueues'][_0x367ecc];var _0x5c4a63={'id':_0x41639b['id'],'available':_0x41639b[_0xa4a9('0x4d')],'loggedIn':_0x41639b['loggedIn'],'name':_0x41639b[_0xa4a9('0x4f')],'paused':_0x41639b[_0xa4a9('0x50')],'waiting':_0x41639b[_0xa4a9('0x51')]};_0x678b96[_0xa4a9('0x24')](_0x5c4a63);}}_0x1772f7({'count':_0x678b96[_0xa4a9('0x1e')],'rows':_0x678b96});});},'OpenchannelQueues':function(_0x54abc5){return new Promise(function(_0x38dd72,_0x5ab5c8){var _0x375024=[];for(var _0x48c48e in _0x3e8b88[_0xa4a9('0x53')]){if(_0x3e8b88[_0xa4a9('0x53')]['hasOwnProperty'](_0x48c48e)){var _0x31cd6e=_0x3e8b88[_0xa4a9('0x53')][_0x48c48e];var _0x5f06a5={'id':_0x31cd6e['id'],'available':_0x31cd6e['available'],'loggedIn':_0x31cd6e['loggedIn'],'name':_0x31cd6e[_0xa4a9('0x4f')],'paused':_0x31cd6e[_0xa4a9('0x50')],'waiting':_0x31cd6e[_0xa4a9('0x51')]};_0x375024[_0xa4a9('0x24')](_0x5f06a5);}}_0x38dd72({'count':_0x375024['length'],'rows':_0x375024});});},'SmsQueues':function(_0x2e62aa){return new Promise(function(_0x1a901c,_0x3277bf){var _0x1c89a6=[];for(var _0x16e016 in _0x3e8b88[_0xa4a9('0x54')]){if(_0x3e8b88[_0xa4a9('0x54')][_0xa4a9('0x47')](_0x16e016)){var _0x16b2c2=_0x3e8b88[_0xa4a9('0x54')][_0x16e016];var _0x31f853={'id':_0x16b2c2['id'],'available':_0x16b2c2[_0xa4a9('0x4d')],'loggedIn':_0x16b2c2[_0xa4a9('0x4e')],'name':_0x16b2c2[_0xa4a9('0x4f')],'paused':_0x16b2c2[_0xa4a9('0x50')],'waiting':_0x16b2c2[_0xa4a9('0x51')]};_0x1c89a6[_0xa4a9('0x24')](_0x31f853);}}_0x1a901c({'count':_0x1c89a6[_0xa4a9('0x1e')],'rows':_0x1c89a6});});},'FaxQueues':function(_0x3df853){return new Promise(function(_0x2c859f,_0xaab1b){var _0xd69a4b=[];for(var _0x3cd2b7 in _0x3e8b88[_0xa4a9('0x55')]){if(_0x3e8b88['faxQueues'][_0xa4a9('0x47')](_0x3cd2b7)){var _0x13a218=_0x3e8b88[_0xa4a9('0x55')][_0x3cd2b7];var _0x4e8945={'id':_0x13a218['id'],'available':_0x13a218[_0xa4a9('0x4d')],'loggedIn':_0x13a218[_0xa4a9('0x4e')],'name':_0x13a218[_0xa4a9('0x4f')],'paused':_0x13a218['paused'],'waiting':_0x13a218[_0xa4a9('0x51')]};_0xd69a4b['push'](_0x4e8945);}}_0x2c859f({'count':_0xd69a4b[_0xa4a9('0x1e')],'rows':_0xd69a4b});});},'WhatsappQueues':function(_0x1d509c){return new Promise(function(_0x594cdf,_0x5134ab){var _0x33336d=[];for(var _0x570dc0 in _0x3e8b88['whatsappQueues']){if(_0x3e8b88[_0xa4a9('0x56')]['hasOwnProperty'](_0x570dc0)){var _0x359f30=_0x3e8b88[_0xa4a9('0x56')][_0x570dc0];var _0x3926ef={'id':_0x359f30['id'],'available':_0x359f30[_0xa4a9('0x4d')],'loggedIn':_0x359f30[_0xa4a9('0x4e')],'name':_0x359f30[_0xa4a9('0x4f')],'paused':_0x359f30[_0xa4a9('0x50')],'waiting':_0x359f30['waiting']};_0x33336d[_0xa4a9('0x24')](_0x3926ef);}}_0x594cdf({'count':_0x33336d[_0xa4a9('0x1e')],'rows':_0x33336d});});},'ChatQueuesWaitingInteractions':function(_0x482907){return new Promise(function(_0x1ed70c,_0x5a5f4b){var _0x56794c=_['values'](_0x3e8b88['chatQueuesWaitingInteractions']);_0x1ed70c({'count':_0x56794c[_0xa4a9('0x1e')],'rows':_0x56794c});});},'MailQueuesWaitingInteractions':function(_0x356db2){return new Promise(function(_0xb6d1f4,_0x50756e){var _0x3e00a5=_[_0xa4a9('0x57')](_0x3e8b88[_0xa4a9('0x58')]);_0xb6d1f4({'count':_0x3e00a5['length'],'rows':_0x3e00a5});});},'OpenchannelQueuesWaitingInteractions':function(_0x31da11){return new Promise(function(_0x3ffcce,_0x29699a){var _0x577818=_['values'](_0x3e8b88['openchannelQueuesWaitingInteractions']);_0x3ffcce({'count':_0x577818[_0xa4a9('0x1e')],'rows':_0x577818});});},'SmsQueuesWaitingInteractions':function(_0x13ee29){return new Promise(function(_0x42c748,_0x2b78b8){var _0x268583=_['values'](_0x3e8b88[_0xa4a9('0x59')]);_0x42c748({'count':_0x268583[_0xa4a9('0x1e')],'rows':_0x268583});});},'FaxQueuesWaitingInteractions':function(_0x1d9d68){return new Promise(function(_0x5e8a42,_0x3a093c){var _0x116a42=_['values'](_0x3e8b88[_0xa4a9('0x5a')]);_0x5e8a42({'count':_0x116a42['length'],'rows':_0x116a42});});},'WhatsappQueuesWaitingInteractions':function(_0x14e782){return new Promise(function(_0x7f4bc4,_0x5348b1){var _0x523f58=_[_0xa4a9('0x57')](_0x3e8b88[_0xa4a9('0x5b')]);_0x7f4bc4({'count':_0x523f58['length'],'rows':_0x523f58});});}};var _0x39d18a=jayson[_0xa4a9('0x5c')](_0x183f1e)['http']();_0x39d18a['on'](_0xa4a9('0x36'),function(_0x5715a6){logger['error'](JSON[_0xa4a9('0x38')](_0x5715a6));return _0x49c9bf(_0x5715a6);});_0x39d18a[_0xa4a9('0x17')](0x232c,_0xa4a9('0x5d'),function(){console[_0xa4a9('0x5e')](_0xa4a9('0x5f'),0x232c);return _0xb8b579(_0xa4a9('0x60')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index ad013ce..f800c3f 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 _0x2bcb=['[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','error','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','iftime\x20%s','indexOf','true','all','then','some'];(function(_0x30270f,_0x1e1394){var _0x3373fc=function(_0x53cefc){while(--_0x53cefc){_0x30270f['push'](_0x30270f['shift']());}};_0x3373fc(++_0x1e1394);}(_0x2bcb,0x17b));var _0xb2bc=function(_0x31d179,_0x460d61){_0x31d179=_0x31d179-0x0;var _0x5e7300=_0x2bcb[_0x31d179];return _0x5e7300;};'use strict';var util=require(_0xb2bc('0x0'));var BPromise=require(_0xb2bc('0x1'));var jayson=require(_0xb2bc('0x2'));var _=require(_0xb2bc('0x3'));var logger=require(_0xb2bc('0x4'))(_0xb2bc('0x5'));var client=jayson[_0xb2bc('0x6')][_0xb2bc('0x7')]({'port':0x232a});function request(_0x4f773f,_0xdde00b){return new BPromise(function(_0xf7521,_0x441955){return client[_0xb2bc('0x8')](_0x4f773f,_0xdde00b)['then'](function(_0x302940){if(_0x302940['error']){return _0x441955(_0x302940['error'][_0xb2bc('0x9')]);}else{return _0xf7521(_0x302940['result']);}})[_0xb2bc('0xa')](function(_0x511658){return _0x441955(_0x511658);});});}exports['condition']=function(_0x2fd48d,_0x5d6f48,_0x5aa882){return function(_0x15e251){if(_0x5aa882[_0xb2bc('0xb')]&&!_0x5aa882[_0xb2bc('0xb')][_0x2fd48d]){logger[_0xb2bc('0xc')](_0xb2bc('0xd'),_0x2fd48d);return _0x15e251[_0xb2bc('0xe')]();}var _0x55c8b0=[];for(var _0x2c55da=0x0;_0x2c55da<_0x5d6f48['length'];_0x2c55da+=0x1){_0x55c8b0[_0xb2bc('0xf')](request(_0xb2bc('0x10'),{'command':util[_0xb2bc('0x11')](_0xb2bc('0x12'),_0x5d6f48[_0x2c55da])})['then'](function(_0x11d46f){return _0x11d46f&&_0x11d46f['message']&&_0x11d46f['message'][_0xb2bc('0x13')](_0xb2bc('0x14'))>=0x0?!![]:![];})['catch'](function(_0x1e4d89){logger['error']('[%s][INTERVAL]\x20%s',_0x2fd48d,_0x5d6f48[_0x2c55da]);}));}BPromise[_0xb2bc('0x15')](_0x55c8b0)[_0xb2bc('0x16')](function(_0x51846e){var _0x3cccdc=_[_0xb2bc('0x17')](_0x51846e);logger['info'](_0xb2bc('0x18'),_0x2fd48d,_0x5d6f48[_0xb2bc('0x19')](_0xb2bc('0x1a')),_0x3cccdc);_0x15e251[_0xb2bc('0x1b')](_0x3cccdc);})[_0xb2bc('0xa')](function(_0x10c543){console[_0xb2bc('0x1c')](_0x10c543);logger[_0xb2bc('0x1d')](_0xb2bc('0x18'),_0x2fd48d,_0x5d6f48[_0xb2bc('0x19')](_0xb2bc('0x1a')),_0x10c543[_0xb2bc('0x1e')]);_0x15e251['stop']();});};}; \ No newline at end of file +var _0x2718=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','Command','format','catch','[%s][INTERVAL]\x20%s','all','join','\x20|\x20','when','[%s][INTERVAL]\x20%s\x20%s','stop','util','jayson/promise','lodash','../../../config/logger','routing','client','http','then','error','message','result','condition'];(function(_0x319d6a,_0x290d07){var _0x2bc9b9=function(_0x3837a4){while(--_0x3837a4){_0x319d6a['push'](_0x319d6a['shift']());}};_0x2bc9b9(++_0x290d07);}(_0x2718,0xf8));var _0x8271=function(_0x23a236,_0x5928e7){_0x23a236=_0x23a236-0x0;var _0x5747cd=_0x2718[_0x23a236];return _0x5747cd;};'use strict';var util=require(_0x8271('0x0'));var BPromise=require('bluebird');var jayson=require(_0x8271('0x1'));var _=require(_0x8271('0x2'));var logger=require(_0x8271('0x3'))(_0x8271('0x4'));var client=jayson[_0x8271('0x5')][_0x8271('0x6')]({'port':0x232a});function request(_0x1dc464,_0x119beb){return new BPromise(function(_0x530683,_0x1c8aeb){return client['request'](_0x1dc464,_0x119beb)[_0x8271('0x7')](function(_0x24e27d){if(_0x24e27d[_0x8271('0x8')]){return _0x1c8aeb(_0x24e27d[_0x8271('0x8')][_0x8271('0x9')]);}else{return _0x530683(_0x24e27d[_0x8271('0xa')]);}})['catch'](function(_0x665ace){return _0x1c8aeb(_0x665ace);});});}exports[_0x8271('0xb')]=function(_0x563f36,_0x3dcc36,_0x4c8fe8){return function(_0x2e40cc){if(_0x4c8fe8['rules']&&!_0x4c8fe8[_0x8271('0xc')][_0x563f36]){logger[_0x8271('0xd')](_0x8271('0xe'),_0x563f36);return _0x2e40cc['stop']();}var _0x38640c=[];for(var _0x52f905=0x0;_0x52f905<_0x3dcc36[_0x8271('0xf')];_0x52f905+=0x1){_0x38640c['push'](request(_0x8271('0x10'),{'command':util[_0x8271('0x11')]('iftime\x20%s',_0x3dcc36[_0x52f905])})[_0x8271('0x7')](function(_0x1440ee){return _0x1440ee&&_0x1440ee[_0x8271('0x9')]&&_0x1440ee[_0x8271('0x9')]['indexOf']('true')>=0x0?!![]:![];})[_0x8271('0x12')](function(_0x3f3d58){logger[_0x8271('0x8')](_0x8271('0x13'),_0x563f36,_0x3dcc36[_0x52f905]);}));}BPromise[_0x8271('0x14')](_0x38640c)[_0x8271('0x7')](function(_0x308111){var _0x1c735c=_['some'](_0x308111);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x563f36,_0x3dcc36[_0x8271('0x15')](_0x8271('0x16')),_0x1c735c);_0x2e40cc[_0x8271('0x17')](_0x1c735c);})[_0x8271('0x12')](function(_0x59b15c){console['log'](_0x59b15c);logger[_0x8271('0x8')](_0x8271('0x18'),_0x563f36,_0x3dcc36['join']('\x20|\x20'),_0x59b15c['stack']);_0x2e40cc[_0x8271('0x19')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index d4014a1..f345f20 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 _0xd3d1=['transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','[%s][agents][agentcalled]','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','reason','holdtime','ringtime','talktime','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','agentringnoanswer','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','blind','transferexten','extension'];(function(_0x38cb30,_0x4516f4){var _0x4908cf=function(_0x3c814e){while(--_0x3c814e){_0x38cb30['push'](_0x38cb30['shift']());}};_0x4908cf(++_0x4516f4);}(_0xd3d1,0x172));var _0x1d3d=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xd3d1[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0x1d3d('0x0'));var util=require(_0x1d3d('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x56f01c,_0x2d0605){utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x4'),_0x56f01c[_0x1d3d('0x5')],_0x56f01c[_0x1d3d('0x6')],_0x56f01c[_0x1d3d('0x7')],_0x56f01c[_0x1d3d('0x8')],_0x56f01c[_0x1d3d('0x9')],_0x56f01c[_0x1d3d('0xa')],_0x56f01c[_0x1d3d('0xb')],_0x56f01c[_0x1d3d('0xc')]));if(_0x56f01c[_0x1d3d('0x7')]){utils[_0x1d3d('0xd')](_0x56f01c[_0x1d3d('0x7')])[_0x1d3d('0xe')](function(_0x3683c9){if(_0x3683c9){_0x56f01c['type']=_0x3683c9[_0x1d3d('0xf')];_0x56f01c[_0x1d3d('0x10')]=_0x56f01c[_0x1d3d('0x11')]?_0x3683c9[_0x1d3d('0x12')]:![];_0x56f01c[_0x1d3d('0x13')]=_0x56f01c[_0x1d3d('0x10')]?_0x3683c9[_0x1d3d('0x14')]:0x0;}utils[_0x1d3d('0x15')](_0x1d3d('0x16'),_0x56f01c);});}else{utils[_0x1d3d('0x15')](_0x1d3d('0x16'),_0x56f01c);}if(_0x2d0605){delete transfers[_0x56f01c['uniqueid']];}else{delete agents[_0x56f01c[_0x1d3d('0x17')]];}}exports[_0x1d3d('0x18')]=function(_0x494b82){try{utils['debug'](util[_0x1d3d('0x3')](_0x1d3d('0x19'),_0x494b82[_0x1d3d('0x5')]),_0x494b82);agents[_0x494b82['destuniqueid']]=_0x494b82;agents[_0x494b82[_0x1d3d('0x17')]]['agentcalledAt']=utils[_0x1d3d('0x1a')]();agents[_0x494b82[_0x1d3d('0x17')]][_0x1d3d('0xc')]=_0x1d3d('0x1b');agents[_0x494b82[_0x1d3d('0x17')]][_0x1d3d('0xb')]=null;agents[_0x494b82[_0x1d3d('0x17')]]['connectedlinename']=null;utils['info'](util[_0x1d3d('0x3')](_0x1d3d('0x1c'),_0x494b82['uniqueid'],agents[_0x494b82[_0x1d3d('0x17')]]['membername'],_0x494b82[_0x1d3d('0x17')]));}catch(_0x392e92){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')]('[%s][agents][agentcalled]',_0x494b82[_0x1d3d('0x5')]),_0x392e92);}};exports['agentringnoanswer']=function(_0x56c424){try{if(!_[_0x1d3d('0x1e')](agents[_0x56c424[_0x1d3d('0x17')]])){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')](_0x1d3d('0x20'),_0x56c424[_0x1d3d('0x5')]),_0x56c424);utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x21'),_0x56c424[_0x1d3d('0x5')],agents[_0x56c424[_0x1d3d('0x17')]]['membername'],_0x56c424[_0x1d3d('0x17')]));agents[_0x56c424[_0x1d3d('0x17')]]['agentringnoanswer']=!![];agents[_0x56c424[_0x1d3d('0x17')]]['agentringnoanswerAt']=utils[_0x1d3d('0x1a')]();agents[_0x56c424[_0x1d3d('0x17')]][_0x1d3d('0xc')]=_0x1d3d('0x22');agents[_0x56c424[_0x1d3d('0x17')]][_0x1d3d('0x23')]=_0x1d3d('0x22');agents[_0x56c424[_0x1d3d('0x17')]][_0x1d3d('0x24')]=_0x56c424[_0x1d3d('0x25')]?parseInt(_0x56c424[_0x1d3d('0x25')])/0x3e8:0x0;agents[_0x56c424['destuniqueid']][_0x1d3d('0x26')]=0x0;unanswered['push'](_0x56c424[_0x1d3d('0x17')]);}}catch(_0x2bcc2){utils['error'](util[_0x1d3d('0x3')](_0x1d3d('0x20'),_0x56c424[_0x1d3d('0x5')]),_0x2bcc2);}};exports[_0x1d3d('0x27')]=function(_0x4abbfc){try{_[_0x1d3d('0x28')](agents,function(_0x235ef3,_0x5d1b6c){if(_0x235ef3[_0x1d3d('0x5')]==_0x4abbfc['uniqueid']&&!_[_0x1d3d('0x29')](unanswered,_0x235ef3[_0x1d3d('0x17')])){utils['debug'](util[_0x1d3d('0x3')](_0x1d3d('0x2a'),_0x4abbfc[_0x1d3d('0x5')]),_0x4abbfc);utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x2b'),_0x4abbfc[_0x1d3d('0x5')],_0x235ef3[_0x1d3d('0x8')],_0x235ef3[_0x1d3d('0x17')]));_0x235ef3['agentringnoanswer']=!![];_0x235ef3[_0x1d3d('0x2c')]=utils[_0x1d3d('0x1a')]();_0x235ef3[_0x1d3d('0xc')]=_0x1d3d('0x2d');_0x235ef3['reason']='abandoned';_0x235ef3[_0x1d3d('0x24')]=_0x4abbfc[_0x1d3d('0x24')];_0x235ef3['talktime']=0x0;writeDB(_0x235ef3);}});}catch(_0x43ef5d){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x2a'),_0x4abbfc['uniqueid']),_0x43ef5d);}};exports['agentconnect']=function(_0x29fa6c){try{if(agents[_0x29fa6c['destuniqueid']]){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')](_0x1d3d('0x2e'),_0x29fa6c[_0x1d3d('0x5')]),_0x29fa6c);utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x2f'),_0x29fa6c[_0x1d3d('0x5')],agents[_0x29fa6c['destuniqueid']][_0x1d3d('0x8')],_0x29fa6c['destuniqueid']));agents[_0x29fa6c[_0x1d3d('0x17')]][_0x1d3d('0x30')]=utils['now']();agents[_0x29fa6c[_0x1d3d('0x17')]][_0x1d3d('0xb')]=_0x29fa6c[_0x1d3d('0xb')];agents[_0x29fa6c[_0x1d3d('0x17')]]['connectedlinename']=_0x29fa6c['connectedlinename'];agents[_0x29fa6c[_0x1d3d('0x17')]]['holdtime']=_0x29fa6c[_0x1d3d('0x25')];agents[_0x29fa6c[_0x1d3d('0x17')]]['lastevent']=_0x1d3d('0x31');_[_0x1d3d('0x28')](agents,function(_0x51be79,_0x2d5015){if(_0x51be79[_0x1d3d('0x17')]!=_0x29fa6c[_0x1d3d('0x17')]&&_0x51be79[_0x1d3d('0x5')]==_0x29fa6c[_0x1d3d('0x5')]){_0x51be79[_0x1d3d('0x26')]=0x0;_0x51be79['holdtime']=_0x29fa6c[_0x1d3d('0x25')];_0x51be79[_0x1d3d('0x32')]=!![];_0x51be79[_0x1d3d('0x2c')]=utils[_0x1d3d('0x1a')]();_0x51be79[_0x1d3d('0xc')]='answered_elsewhere';_0x51be79[_0x1d3d('0x23')]=_0x1d3d('0x33');_0x51be79[_0x1d3d('0x34')]=_0x29fa6c[_0x1d3d('0x17')];_0x51be79['answeredelsewheremembername']=_0x29fa6c[_0x1d3d('0x8')];writeDB(_0x51be79);}});}}catch(_0x977ea8){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x2e'),_0x29fa6c['uniqueid']),_0x977ea8);}};exports['agentcomplete']=function(_0x229f48){try{if(!_[_0x1d3d('0x1e')](agents[_0x229f48[_0x1d3d('0x17')]])){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')]('[%s][agents][agentcomplete]',_0x229f48[_0x1d3d('0x5')]),_0x229f48);utils['info'](util[_0x1d3d('0x3')](_0x1d3d('0x35'),_0x229f48[_0x1d3d('0x5')],agents[_0x229f48[_0x1d3d('0x17')]]['membername'],_0x229f48[_0x1d3d('0x17')]));agents[_0x229f48[_0x1d3d('0x17')]][_0x1d3d('0x11')]=!![];agents[_0x229f48[_0x1d3d('0x17')]][_0x1d3d('0x36')]=utils[_0x1d3d('0x1a')]();agents[_0x229f48[_0x1d3d('0x17')]]['talktime']=utils[_0x1d3d('0x37')](agents[_0x229f48['destuniqueid']][_0x1d3d('0x36')],agents[_0x229f48[_0x1d3d('0x17')]]['agentconnectAt']);agents[_0x229f48[_0x1d3d('0x17')]]['reason']=_0x229f48[_0x1d3d('0x23')];agents[_0x229f48['destuniqueid']][_0x1d3d('0xc')]=_0x1d3d('0x38');writeDB(agents[_0x229f48[_0x1d3d('0x17')]]);}}catch(_0x25b547){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x39'),_0x229f48[_0x1d3d('0x5')]),_0x25b547);}};exports['blindtransfer']=function(_0x5899cc){try{if(!_['isNil'](agents[_0x5899cc[_0x1d3d('0x3a')]])){utils[_0x1d3d('0x1f')](util[_0x1d3d('0x3')](_0x1d3d('0x3b'),_0x5899cc[_0x1d3d('0x5')]),_0x5899cc);utils[_0x1d3d('0x2')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x5899cc['uniqueid'],agents[_0x5899cc['transfereruniqueid']][_0x1d3d('0x8')],agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x5')]));agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x3c')]=!![];agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x3d')]=_0x1d3d('0x3e');agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x3f')]=_0x5899cc[_0x1d3d('0x40')];agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x41')]=agents[_0x5899cc[_0x1d3d('0x3a')]][_0x1d3d('0x5')];}}catch(_0x5ce0d3){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')](_0x1d3d('0x3b'),_0x5899cc[_0x1d3d('0x5')]),_0x5ce0d3);}};exports['attendedtransfer']=function(_0x41930f){try{utils['debug'](util['format'](_0x1d3d('0x42'),_0x41930f[_0x1d3d('0x43')]),_0x41930f);if(_0x41930f['origtransfereruniqueid']==_0x41930f[_0x1d3d('0x44')]){if(!_[_0x1d3d('0x1e')](agents[_0x41930f['secondtransfereruniqueid']])){utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x45'),_0x41930f[_0x1d3d('0x43')],agents[_0x41930f[_0x1d3d('0x46')]][_0x1d3d('0x8')]));agents[_0x41930f[_0x1d3d('0x46')]][_0x1d3d('0x3c')]=!![];agents[_0x41930f[_0x1d3d('0x46')]]['transfertype']=_0x1d3d('0x47');agents[_0x41930f['secondtransfereruniqueid']]['transferexten']=_0x41930f['origtransfererexten'];agents[_0x41930f['secondtransfereruniqueid']][_0x1d3d('0x41')]=_0x41930f[_0x1d3d('0x43')];}if(_0x41930f[_0x1d3d('0x48')]&&agents[_0x41930f[_0x1d3d('0x48')]]){agents[_0x41930f['transfereeuniqueid']][_0x1d3d('0x49')]=0x1;transfers[_0x41930f['transfereeuniqueid']]=_[_0x1d3d('0x4a')](agents[_0x41930f[_0x1d3d('0x48')]]);transfers[_0x41930f['transfereeuniqueid']][_0x1d3d('0xa')]=agents[_0x41930f[_0x1d3d('0x46')]]['calleridnum'];transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x4b')]=agents[_0x41930f[_0x1d3d('0x46')]][_0x1d3d('0x4b')];transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x4c')]=utils['now']();transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x30')]=utils[_0x1d3d('0x1a')]();transfers[_0x41930f[_0x1d3d('0x48')]][_0x1d3d('0x24')]=0x0;transfers[_0x41930f['transfereeuniqueid']][_0x1d3d('0x49')]=0x2;}}else if(_0x41930f['secondtransfereruniqueid']==_0x41930f[_0x1d3d('0x4d')]){if(!_['isNil'](agents[_0x41930f[_0x1d3d('0x43')]])){utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x45'),_0x41930f[_0x1d3d('0x43')],agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x8')]));agents[_0x41930f['origtransfereruniqueid']][_0x1d3d('0x3c')]=!![];agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x3d')]=_0x1d3d('0x47');agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x3f')]=_0x41930f['secondtransfererexten'];agents[_0x41930f[_0x1d3d('0x43')]][_0x1d3d('0x41')]=_0x41930f[_0x1d3d('0x46')];}if(_0x41930f[_0x1d3d('0x4e')]&&agents[_0x41930f[_0x1d3d('0x4e')]]){agents[_0x41930f['transfertargetuniqueid']][_0x1d3d('0x49')]=0x1;transfers[_0x41930f[_0x1d3d('0x4e')]]=_[_0x1d3d('0x4a')](agents[_0x41930f['transfertargetuniqueid']]);transfers[_0x41930f[_0x1d3d('0x4e')]]['calleridnum']=agents[_0x41930f[_0x1d3d('0x43')]]['calleridnum'];transfers[_0x41930f[_0x1d3d('0x4e')]][_0x1d3d('0x4b')]=agents[_0x41930f[_0x1d3d('0x43')]]['calleridname'];transfers[_0x41930f[_0x1d3d('0x4e')]][_0x1d3d('0x4c')]=utils[_0x1d3d('0x1a')]();transfers[_0x41930f['transfertargetuniqueid']][_0x1d3d('0x30')]=utils[_0x1d3d('0x1a')]();transfers[_0x41930f[_0x1d3d('0x4e')]]['holdtime']=0x0;transfers[_0x41930f[_0x1d3d('0x4e')]][_0x1d3d('0x49')]=0x2;}}}catch(_0x37667d){utils[_0x1d3d('0x1d')](util[_0x1d3d('0x3')]('[%s][agents][attendedtransfer]',_0x41930f[_0x1d3d('0x43')]),_0x37667d);}};exports[_0x1d3d('0x4f')]=function(_0x25f4e0){try{utils['debug'](util[_0x1d3d('0x3')](_0x1d3d('0x50'),_0x25f4e0[_0x1d3d('0x5')]),_0x25f4e0);if(agents[_0x25f4e0[_0x1d3d('0x5')]]&&agents[_0x25f4e0[_0x1d3d('0x5')]]['reason']===_0x1d3d('0x22')){if(_0x25f4e0[_0x1d3d('0x51')]==='21'){agents[_0x25f4e0['uniqueid']][_0x1d3d('0x23')]=_0x1d3d('0x52');agents[_0x25f4e0['uniqueid']][_0x1d3d('0xc')]=_0x1d3d('0x52');}utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x25f4e0[_0x1d3d('0x5')],agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x8')],agents[_0x25f4e0[_0x1d3d('0x5')]]['reason'],agents[_0x25f4e0['uniqueid']][_0x1d3d('0xc')]));writeDB(agents[_0x25f4e0[_0x1d3d('0x5')]]);var _0x4604cc=unanswered[_0x1d3d('0x53')](_0x25f4e0[_0x1d3d('0x5')]);if(_0x4604cc>-0x1){unanswered[_0x1d3d('0x54')](_0x4604cc,0x1);}}if(transfers[_0x25f4e0[_0x1d3d('0x5')]]){transfers[_0x25f4e0['uniqueid']][_0x1d3d('0x11')]=!![];transfers[_0x25f4e0[_0x1d3d('0x5')]]['agentcompleteAt']=utils[_0x1d3d('0x1a')]();transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x26')]=utils['diffTime'](transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x36')],transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x30')]);transfers[_0x25f4e0['uniqueid']][_0x1d3d('0x23')]=_0x1d3d('0x55');transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0xc')]='complete';utils[_0x1d3d('0x2')](util[_0x1d3d('0x3')](_0x1d3d('0x56'),_0x25f4e0['uniqueid'],transfers[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x8')],transfers[_0x25f4e0['uniqueid']][_0x1d3d('0x23')],transfers[_0x25f4e0['uniqueid']][_0x1d3d('0xc')]));writeDB(transfers[_0x25f4e0[_0x1d3d('0x5')]],!![]);}if(agents[_0x25f4e0['uniqueid']]&&agents[_0x25f4e0['uniqueid']][_0x1d3d('0x30')]){agents[_0x25f4e0[_0x1d3d('0x5')]]['agentcomplete']=!![];agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x36')]=utils[_0x1d3d('0x1a')]();agents[_0x25f4e0[_0x1d3d('0x5')]]['talktime']=utils[_0x1d3d('0x37')](agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x36')],agents[_0x25f4e0['uniqueid']][_0x1d3d('0x30')]);agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x23')]=agents[_0x25f4e0['uniqueid']][_0x1d3d('0x3c')]?_0x1d3d('0x3c'):_0x1d3d('0x55');agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0xc')]=_0x1d3d('0x38');utils['info'](util[_0x1d3d('0x3')](_0x1d3d('0x56'),_0x25f4e0['uniqueid'],agents[_0x25f4e0[_0x1d3d('0x5')]][_0x1d3d('0x8')],agents[_0x25f4e0[_0x1d3d('0x5')]]['reason'],agents[_0x25f4e0[_0x1d3d('0x5')]]['lastevent']));writeDB(agents[_0x25f4e0['uniqueid']]);}}catch(_0x49d1e7){utils[_0x1d3d('0x1d')](util['format'](_0x1d3d('0x50'),_0x25f4e0[_0x1d3d('0x5')]),_0x49d1e7);}}; \ No newline at end of file +var _0x3c81=['CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','called','connectedlinename','info','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','now','reason','holdtime','talktime','push','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transferuniqueid','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','isNil','ATTENDED','secondtransfererexten','transfertargetuniqueid','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','lodash','util','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request'];(function(_0x16181e,_0x4e57c2){var _0x16dbeb=function(_0x2b210e){while(--_0x2b210e){_0x16181e['push'](_0x16181e['shift']());}};_0x16dbeb(++_0x4e57c2);}(_0x3c81,0x102));var _0x13c8=function(_0x1dc40e,_0x5e72bb){_0x1dc40e=_0x1dc40e-0x0;var _0x3a46cc=_0x3c81[_0x1dc40e];return _0x3a46cc;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x252f26,_0x131d0b){utils['info'](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x252f26['uniqueid'],_0x252f26[_0x13c8('0x2')],_0x252f26[_0x13c8('0x3')],_0x252f26[_0x13c8('0x4')],_0x252f26[_0x13c8('0x5')],_0x252f26[_0x13c8('0x6')],_0x252f26[_0x13c8('0x7')],_0x252f26[_0x13c8('0x8')]));if(_0x252f26['queue']){utils[_0x13c8('0x9')](_0x252f26['queue'])[_0x13c8('0xa')](function(_0x296463){if(_0x296463){_0x252f26[_0x13c8('0xb')]=_0x296463[_0x13c8('0xb')];_0x252f26[_0x13c8('0xc')]=_0x252f26[_0x13c8('0xd')]?_0x296463[_0x13c8('0xe')]:![];_0x252f26[_0x13c8('0xf')]=_0x252f26[_0x13c8('0xc')]?_0x296463[_0x13c8('0x10')]:0x0;}utils[_0x13c8('0x11')](_0x13c8('0x12'),_0x252f26);});}else{utils[_0x13c8('0x11')](_0x13c8('0x12'),_0x252f26);}if(_0x131d0b){delete transfers[_0x252f26['uniqueid']];}else{delete agents[_0x252f26[_0x13c8('0x13')]];}}exports[_0x13c8('0x14')]=function(_0x2304b5){try{utils[_0x13c8('0x15')](util['format'](_0x13c8('0x16'),_0x2304b5['uniqueid']),_0x2304b5);agents[_0x2304b5['destuniqueid']]=_0x2304b5;agents[_0x2304b5['destuniqueid']][_0x13c8('0x17')]=utils['now']();agents[_0x2304b5[_0x13c8('0x13')]][_0x13c8('0x8')]=_0x13c8('0x18');agents[_0x2304b5[_0x13c8('0x13')]]['connectedlinenum']=null;agents[_0x2304b5[_0x13c8('0x13')]][_0x13c8('0x19')]=null;utils[_0x13c8('0x1a')](util[_0x13c8('0x1b')](_0x13c8('0x1c'),_0x2304b5[_0x13c8('0x1d')],agents[_0x2304b5[_0x13c8('0x13')]][_0x13c8('0x4')],_0x2304b5[_0x13c8('0x13')]));}catch(_0x31d122){utils[_0x13c8('0x1e')](util['format'](_0x13c8('0x16'),_0x2304b5[_0x13c8('0x1d')]),_0x31d122);}};exports[_0x13c8('0x1f')]=function(_0x313ea3){try{if(!_['isNil'](agents[_0x313ea3[_0x13c8('0x13')]])){utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x20'),_0x313ea3[_0x13c8('0x1d')]),_0x313ea3);utils[_0x13c8('0x1a')](util['format'](_0x13c8('0x21'),_0x313ea3[_0x13c8('0x1d')],agents[_0x313ea3[_0x13c8('0x13')]][_0x13c8('0x4')],_0x313ea3['destuniqueid']));agents[_0x313ea3[_0x13c8('0x13')]][_0x13c8('0x1f')]=!![];agents[_0x313ea3['destuniqueid']]['agentringnoanswerAt']=utils[_0x13c8('0x22')]();agents[_0x313ea3[_0x13c8('0x13')]]['lastevent']='timeout';agents[_0x313ea3[_0x13c8('0x13')]][_0x13c8('0x23')]='timeout';agents[_0x313ea3['destuniqueid']][_0x13c8('0x24')]=_0x313ea3['ringtime']?parseInt(_0x313ea3['ringtime'])/0x3e8:0x0;agents[_0x313ea3[_0x13c8('0x13')]][_0x13c8('0x25')]=0x0;unanswered[_0x13c8('0x26')](_0x313ea3['destuniqueid']);}}catch(_0x5ef2f7){utils[_0x13c8('0x1e')](util[_0x13c8('0x1b')](_0x13c8('0x20'),_0x313ea3[_0x13c8('0x1d')]),_0x5ef2f7);}};exports[_0x13c8('0x27')]=function(_0x220d40){try{_[_0x13c8('0x28')](agents,function(_0x4a1b9c,_0x109cb8){if(_0x4a1b9c[_0x13c8('0x1d')]==_0x220d40['uniqueid']&&!_['includes'](unanswered,_0x4a1b9c[_0x13c8('0x13')])){utils[_0x13c8('0x15')](util['format'](_0x13c8('0x29'),_0x220d40[_0x13c8('0x1d')]),_0x220d40);utils['info'](util[_0x13c8('0x1b')](_0x13c8('0x2a'),_0x220d40[_0x13c8('0x1d')],_0x4a1b9c[_0x13c8('0x4')],_0x4a1b9c[_0x13c8('0x13')]));_0x4a1b9c[_0x13c8('0x1f')]=!![];_0x4a1b9c[_0x13c8('0x2b')]=utils[_0x13c8('0x22')]();_0x4a1b9c['lastevent']='abandoned';_0x4a1b9c[_0x13c8('0x23')]=_0x13c8('0x2c');_0x4a1b9c['holdtime']=_0x220d40[_0x13c8('0x24')];_0x4a1b9c['talktime']=0x0;writeDB(_0x4a1b9c);}});}catch(_0x1fdf7d){utils['error'](util[_0x13c8('0x1b')](_0x13c8('0x29'),_0x220d40[_0x13c8('0x1d')]),_0x1fdf7d);}};exports[_0x13c8('0x2d')]=function(_0x2039e7){try{if(agents[_0x2039e7[_0x13c8('0x13')]]){utils[_0x13c8('0x15')](util['format'](_0x13c8('0x2e'),_0x2039e7[_0x13c8('0x1d')]),_0x2039e7);utils['info'](util[_0x13c8('0x1b')](_0x13c8('0x2f'),_0x2039e7[_0x13c8('0x1d')],agents[_0x2039e7['destuniqueid']]['membername'],_0x2039e7['destuniqueid']));agents[_0x2039e7[_0x13c8('0x13')]][_0x13c8('0x30')]=utils[_0x13c8('0x22')]();agents[_0x2039e7[_0x13c8('0x13')]][_0x13c8('0x7')]=_0x2039e7[_0x13c8('0x7')];agents[_0x2039e7[_0x13c8('0x13')]][_0x13c8('0x19')]=_0x2039e7[_0x13c8('0x19')];agents[_0x2039e7['destuniqueid']]['holdtime']=_0x2039e7[_0x13c8('0x31')];agents[_0x2039e7[_0x13c8('0x13')]][_0x13c8('0x8')]=_0x13c8('0x32');_['forIn'](agents,function(_0x35e1e7,_0x4bd627){if(_0x35e1e7[_0x13c8('0x13')]!=_0x2039e7[_0x13c8('0x13')]&&_0x35e1e7[_0x13c8('0x1d')]==_0x2039e7[_0x13c8('0x1d')]){_0x35e1e7[_0x13c8('0x25')]=0x0;_0x35e1e7[_0x13c8('0x24')]=_0x2039e7[_0x13c8('0x31')];_0x35e1e7[_0x13c8('0x1f')]=!![];_0x35e1e7[_0x13c8('0x2b')]=utils[_0x13c8('0x22')]();_0x35e1e7[_0x13c8('0x8')]=_0x13c8('0x33');_0x35e1e7[_0x13c8('0x23')]=_0x13c8('0x33');_0x35e1e7[_0x13c8('0x34')]=_0x2039e7[_0x13c8('0x13')];_0x35e1e7[_0x13c8('0x35')]=_0x2039e7[_0x13c8('0x4')];writeDB(_0x35e1e7);}});}}catch(_0xc5eb86){utils[_0x13c8('0x1e')](util[_0x13c8('0x1b')](_0x13c8('0x2e'),_0x2039e7[_0x13c8('0x1d')]),_0xc5eb86);}};exports[_0x13c8('0xd')]=function(_0x44ee66){try{if(!_['isNil'](agents[_0x44ee66[_0x13c8('0x13')]])){utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x36'),_0x44ee66[_0x13c8('0x1d')]),_0x44ee66);utils['info'](util['format'](_0x13c8('0x37'),_0x44ee66[_0x13c8('0x1d')],agents[_0x44ee66[_0x13c8('0x13')]]['membername'],_0x44ee66['destuniqueid']));agents[_0x44ee66['destuniqueid']][_0x13c8('0xd')]=!![];agents[_0x44ee66['destuniqueid']][_0x13c8('0x38')]=utils['now']();agents[_0x44ee66[_0x13c8('0x13')]][_0x13c8('0x25')]=utils[_0x13c8('0x39')](agents[_0x44ee66[_0x13c8('0x13')]][_0x13c8('0x38')],agents[_0x44ee66[_0x13c8('0x13')]]['agentconnectAt']);agents[_0x44ee66[_0x13c8('0x13')]][_0x13c8('0x23')]=_0x44ee66['reason'];agents[_0x44ee66[_0x13c8('0x13')]][_0x13c8('0x8')]=_0x13c8('0x3a');writeDB(agents[_0x44ee66[_0x13c8('0x13')]]);}}catch(_0x38486a){utils['error'](util[_0x13c8('0x1b')](_0x13c8('0x36'),_0x44ee66[_0x13c8('0x1d')]),_0x38486a);}};exports[_0x13c8('0x3b')]=function(_0x185d18){try{if(!_['isNil'](agents[_0x185d18[_0x13c8('0x3c')]])){utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x3d'),_0x185d18[_0x13c8('0x1d')]),_0x185d18);utils[_0x13c8('0x1a')](util[_0x13c8('0x1b')](_0x13c8('0x3e'),_0x185d18[_0x13c8('0x1d')],agents[_0x185d18[_0x13c8('0x3c')]][_0x13c8('0x4')],agents[_0x185d18['transfereruniqueid']][_0x13c8('0x1d')]));agents[_0x185d18[_0x13c8('0x3c')]][_0x13c8('0x3f')]=!![];agents[_0x185d18[_0x13c8('0x3c')]][_0x13c8('0x40')]=_0x13c8('0x41');agents[_0x185d18['transfereruniqueid']][_0x13c8('0x42')]=_0x185d18[_0x13c8('0x43')];agents[_0x185d18[_0x13c8('0x3c')]]['transferuniqueid']=agents[_0x185d18['transfereruniqueid']][_0x13c8('0x1d')];}}catch(_0x14a738){utils['error'](util[_0x13c8('0x1b')](_0x13c8('0x3d'),_0x185d18['uniqueid']),_0x14a738);}};exports[_0x13c8('0x44')]=function(_0x554792){try{utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x45'),_0x554792['origtransfereruniqueid']),_0x554792);if(_0x554792[_0x13c8('0x46')]==_0x554792[_0x13c8('0x47')]){if(!_['isNil'](agents[_0x554792[_0x13c8('0x48')]])){utils['info'](util[_0x13c8('0x1b')](_0x13c8('0x49'),_0x554792[_0x13c8('0x46')],agents[_0x554792[_0x13c8('0x48')]][_0x13c8('0x4')]));agents[_0x554792['secondtransfereruniqueid']][_0x13c8('0x3f')]=!![];agents[_0x554792['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x554792['secondtransfereruniqueid']]['transferexten']=_0x554792[_0x13c8('0x4a')];agents[_0x554792[_0x13c8('0x48')]][_0x13c8('0x4b')]=_0x554792[_0x13c8('0x46')];}if(_0x554792[_0x13c8('0x4c')]&&agents[_0x554792[_0x13c8('0x4c')]]){agents[_0x554792[_0x13c8('0x4c')]]['agententerreason']=0x1;transfers[_0x554792['transfereeuniqueid']]=_[_0x13c8('0x4d')](agents[_0x554792[_0x13c8('0x4c')]]);transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x6')]=agents[_0x554792[_0x13c8('0x48')]][_0x13c8('0x6')];transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x4e')]=agents[_0x554792['secondtransfereruniqueid']][_0x13c8('0x4e')];transfers[_0x554792[_0x13c8('0x4c')]]['agentcalledAt']=utils[_0x13c8('0x22')]();transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x30')]=utils[_0x13c8('0x22')]();transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x24')]=0x0;transfers[_0x554792[_0x13c8('0x4c')]][_0x13c8('0x4f')]=0x2;}}else if(_0x554792[_0x13c8('0x48')]==_0x554792[_0x13c8('0x50')]){if(!_[_0x13c8('0x51')](agents[_0x554792[_0x13c8('0x46')]])){utils[_0x13c8('0x1a')](util[_0x13c8('0x1b')](_0x13c8('0x49'),_0x554792[_0x13c8('0x46')],agents[_0x554792['origtransfereruniqueid']][_0x13c8('0x4')]));agents[_0x554792['origtransfereruniqueid']][_0x13c8('0x3f')]=!![];agents[_0x554792[_0x13c8('0x46')]]['transfertype']=_0x13c8('0x52');agents[_0x554792[_0x13c8('0x46')]]['transferexten']=_0x554792[_0x13c8('0x53')];agents[_0x554792[_0x13c8('0x46')]][_0x13c8('0x4b')]=_0x554792[_0x13c8('0x48')];}if(_0x554792[_0x13c8('0x54')]&&agents[_0x554792[_0x13c8('0x54')]]){agents[_0x554792[_0x13c8('0x54')]][_0x13c8('0x4f')]=0x1;transfers[_0x554792[_0x13c8('0x54')]]=_[_0x13c8('0x4d')](agents[_0x554792[_0x13c8('0x54')]]);transfers[_0x554792['transfertargetuniqueid']][_0x13c8('0x6')]=agents[_0x554792[_0x13c8('0x46')]][_0x13c8('0x6')];transfers[_0x554792[_0x13c8('0x54')]][_0x13c8('0x4e')]=agents[_0x554792[_0x13c8('0x46')]]['calleridname'];transfers[_0x554792[_0x13c8('0x54')]][_0x13c8('0x17')]=utils[_0x13c8('0x22')]();transfers[_0x554792['transfertargetuniqueid']][_0x13c8('0x30')]=utils[_0x13c8('0x22')]();transfers[_0x554792[_0x13c8('0x54')]][_0x13c8('0x24')]=0x0;transfers[_0x554792[_0x13c8('0x54')]][_0x13c8('0x4f')]=0x2;}}}catch(_0x55e5ba){utils[_0x13c8('0x1e')](util[_0x13c8('0x1b')](_0x13c8('0x45'),_0x554792[_0x13c8('0x46')]),_0x55e5ba);}};exports['hangup']=function(_0x16b409){try{utils[_0x13c8('0x15')](util[_0x13c8('0x1b')](_0x13c8('0x55'),_0x16b409[_0x13c8('0x1d')]),_0x16b409);if(agents[_0x16b409[_0x13c8('0x1d')]]&&agents[_0x16b409[_0x13c8('0x1d')]]['reason']===_0x13c8('0x56')){if(_0x16b409[_0x13c8('0x57')]==='21'){agents[_0x16b409[_0x13c8('0x1d')]]['reason']=_0x13c8('0x58');agents[_0x16b409[_0x13c8('0x1d')]]['lastevent']='rejected';}utils[_0x13c8('0x1a')](util['format'](_0x13c8('0x59'),_0x16b409['uniqueid'],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x4')],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x23')],agents[_0x16b409[_0x13c8('0x1d')]]['lastevent']));writeDB(agents[_0x16b409[_0x13c8('0x1d')]]);var _0x2d8dfe=unanswered['indexOf'](_0x16b409[_0x13c8('0x1d')]);if(_0x2d8dfe>-0x1){unanswered[_0x13c8('0x5a')](_0x2d8dfe,0x1);}}if(transfers[_0x16b409[_0x13c8('0x1d')]]){transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0xd')]=!![];transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x38')]=utils[_0x13c8('0x22')]();transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x25')]=utils['diffTime'](transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x38')],transfers[_0x16b409['uniqueid']]['agentconnectAt']);transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x23')]=_0x13c8('0x5b');transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x8')]=_0x13c8('0x3a');utils['info'](util[_0x13c8('0x1b')](_0x13c8('0x59'),_0x16b409[_0x13c8('0x1d')],transfers[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x4')],transfers[_0x16b409['uniqueid']][_0x13c8('0x23')],transfers[_0x16b409[_0x13c8('0x1d')]]['lastevent']));writeDB(transfers[_0x16b409[_0x13c8('0x1d')]],!![]);}if(agents[_0x16b409[_0x13c8('0x1d')]]&&agents[_0x16b409['uniqueid']][_0x13c8('0x30')]){agents[_0x16b409['uniqueid']][_0x13c8('0xd')]=!![];agents[_0x16b409['uniqueid']][_0x13c8('0x38')]=utils[_0x13c8('0x22')]();agents[_0x16b409[_0x13c8('0x1d')]]['talktime']=utils[_0x13c8('0x39')](agents[_0x16b409['uniqueid']]['agentcompleteAt'],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x30')]);agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x23')]=agents[_0x16b409['uniqueid']]['transfer']?_0x13c8('0x3f'):'agent';agents[_0x16b409['uniqueid']][_0x13c8('0x8')]=_0x13c8('0x3a');utils[_0x13c8('0x1a')](util[_0x13c8('0x1b')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x16b409[_0x13c8('0x1d')],agents[_0x16b409['uniqueid']]['membername'],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x23')],agents[_0x16b409[_0x13c8('0x1d')]][_0x13c8('0x8')]));writeDB(agents[_0x16b409[_0x13c8('0x1d')]]);}}catch(_0x551563){utils[_0x13c8('0x1e')](util['format'](_0x13c8('0x55'),_0x16b409['uniqueid']),_0x551563);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index ca8d714..25732b7 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 _0xe65c=['diffTime','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','destinationchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','lastapplication','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','split','substring','lastIndexOf','includes','execif','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','uniqueid','blinds','transfereeuniqueid','info','format','channel','queue','membername','calleridnum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','context','exten','now','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','duration','endtime','starttime','billableseconds'];(function(_0x4c08a9,_0x4fe33d){var _0x5cd21c=function(_0x354cda){while(--_0x354cda){_0x4c08a9['push'](_0x4c08a9['shift']());}};_0x5cd21c(++_0x4fe33d);}(_0xe65c,0x179));var _0xce65=function(_0x282999,_0x4df660){_0x282999=_0x282999-0x0;var _0x30681f=_0xe65c[_0x282999];return _0x30681f;};'use strict';var _=require(_0xce65('0x0'));var util=require(_0xce65('0x1'));var utils=require(_0xce65('0x2'));var transfers=require('./transfers.controller');var dispositions=['NO\x20ANSWER',_0xce65('0x3'),_0xce65('0x3'),_0xce65('0x4'),'NO\x20ANSWER',_0xce65('0x4'),_0xce65('0x5'),_0xce65('0x6'),'FAILED','FAILED',_0xce65('0x3')];var channels={};function writeDB(_0x536c40){var _0x5363a8;if(transfers['blinds'][_0x536c40[_0xce65('0x7')]]){_0x5363a8=_0x536c40[_0xce65('0x7')];_0x536c40[_0xce65('0x7')]=transfers[_0xce65('0x8')][_0x536c40['uniqueid']][_0xce65('0x9')];}utils[_0xce65('0xa')](util[_0xce65('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x536c40[_0xce65('0x7')],_0x536c40[_0xce65('0xc')],_0x536c40[_0xce65('0xd')],_0x536c40[_0xce65('0xe')],_0x536c40['interface'],_0x536c40[_0xce65('0xf')],_0x536c40['connectedlinenum'],_0x536c40[_0xce65('0x10')]));if(_0x536c40[_0xce65('0x11')]){utils[_0xce65('0x12')](_0x536c40[_0xce65('0x11')])[_0xce65('0x13')](function(_0x2a2304){if(_0x2a2304){_0x536c40[_0xce65('0x14')]=_0x2a2304['id'];}utils[_0xce65('0x15')](_0xce65('0x16'),_0x536c40);});}else{utils[_0xce65('0x15')](_0xce65('0x16'),_0x536c40);}if(channels[_0x536c40[_0xce65('0x7')]]){delete channels[_0x536c40['uniqueid']];}else if(_0x5363a8&&channels[_0x5363a8]){delete transfers['blinds'][_0x5363a8];delete channels[_0x5363a8];}}exports[_0xce65('0x17')]=function(_0x1faae8){try{utils[_0xce65('0x18')](util[_0xce65('0xb')](_0xce65('0x19'),_0x1faae8[_0xce65('0x7')]),_0x1faae8);if(_0x1faae8['uniqueid']==_0x1faae8['linkedid']&&_0x1faae8[_0xce65('0xc')]!=_0xce65('0x1a')){utils['info'](util[_0xce65('0xb')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x1faae8[_0xce65('0x7')],_0x1faae8[_0xce65('0x1b')],_0x1faae8[_0xce65('0x1c')]));channels[_0x1faae8['uniqueid']]={'uniqueid':_0x1faae8[_0xce65('0x7')],'accountcode':_0x1faae8[_0xce65('0x11')],'source':_0x1faae8[_0xce65('0xf')],'destination':_0x1faae8[_0xce65('0x1c')],'destinationcontext':_0x1faae8[_0xce65('0x1b')],'channel':_0x1faae8[_0xce65('0xc')],'starttime':utils[_0xce65('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xce65('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x596c38){utils['error'](util[_0xce65('0xb')](_0xce65('0x19'),_0x1faae8['uniqueid']),_0x596c38);}};exports[_0xce65('0x1e')]=function(_0x5c637c){try{utils[_0xce65('0x18')](util[_0xce65('0xb')](_0xce65('0x1f'),_0x5c637c[_0xce65('0x7')]),_0x5c637c);if(!_[_0xce65('0x20')](channels[_0x5c637c['uniqueid']])&&_0x5c637c[_0xce65('0x21')]==0x6){utils[_0xce65('0xa')](util[_0xce65('0xb')](_0xce65('0x22'),_0x5c637c[_0xce65('0x7')],_0x5c637c[_0xce65('0x1b')],_0x5c637c[_0xce65('0xc')]));if(_[_0xce65('0x20')](channels[_0x5c637c[_0xce65('0x7')]][_0xce65('0x23')])){channels[_0x5c637c['uniqueid']][_0xce65('0x23')]=utils[_0xce65('0x1d')]();}}else if(!_[_0xce65('0x20')](channels[_0x5c637c[_0xce65('0x24')]])&&_0x5c637c[_0xce65('0x21')]==0x6&&_0x5c637c[_0xce65('0x1b')]!=_0xce65('0x25')){utils[_0xce65('0xa')](util['format']('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x5c637c[_0xce65('0x7')],_0x5c637c['linkedid'],_0x5c637c[_0xce65('0x1b')],_0x5c637c['channel']));channels[_0x5c637c[_0xce65('0x24')]]['accountcode']=_0x5c637c[_0xce65('0x11')];channels[_0x5c637c[_0xce65('0x24')]]['destinationchannel']=_0x5c637c[_0xce65('0xc')];if(_[_0xce65('0x20')](channels[_0x5c637c[_0xce65('0x24')]][_0xce65('0x26')])){channels[_0x5c637c[_0xce65('0x24')]]['answertime']=utils[_0xce65('0x1d')]();}channels[_0x5c637c[_0xce65('0x24')]][_0xce65('0x27')]=dispositions[_[_0xce65('0x28')](_0x5c637c[_0xce65('0x21')])]||'ANSWERED';}}catch(_0x3ba14d){utils[_0xce65('0x29')](util[_0xce65('0xb')]('[%s][calls][newstate]',_0x5c637c[_0xce65('0x7')]),_0x3ba14d);}};exports[_0xce65('0x2a')]=function(_0x232759){try{if(!_[_0xce65('0x20')](channels[_0x232759['uniqueid']])){utils[_0xce65('0x18')](util[_0xce65('0xb')](_0xce65('0x2b'),_0x232759[_0xce65('0x7')]),_0x232759);if(_[_0xce65('0x20')](channels[_0x232759[_0xce65('0x7')]][_0xce65('0x2c')])){channels[_0x232759[_0xce65('0x7')]]['callerid']=_0x232759[_0xce65('0x2d')]+'\x20<'+_0x232759[_0xce65('0xf')]+'>';}utils[_0xce65('0xa')](util[_0xce65('0xb')](_0xce65('0x2e'),_0x232759['uniqueid'],channels[_0x232759[_0xce65('0x7')]][_0xce65('0x2c')],_0x232759['cause-txt']));channels[_0x232759[_0xce65('0x7')]]['endtime']=utils[_0xce65('0x1d')]();channels[_0x232759[_0xce65('0x7')]][_0xce65('0x2f')]=utils['diffTime'](channels[_0x232759[_0xce65('0x7')]][_0xce65('0x30')],channels[_0x232759[_0xce65('0x7')]][_0xce65('0x31')]);channels[_0x232759[_0xce65('0x7')]][_0xce65('0x32')]=channels[_0x232759[_0xce65('0x7')]][_0xce65('0x26')]?utils[_0xce65('0x33')](channels[_0x232759[_0xce65('0x7')]][_0xce65('0x30')],channels[_0x232759['uniqueid']]['answertime']):0x0;writeDB(channels[_0x232759[_0xce65('0x7')]]);}}catch(_0x1ebcf9){utils[_0xce65('0x29')](util[_0xce65('0xb')]('[%s][calls][hangup]',_0x232759['uniqueid']),_0x1ebcf9);}};exports[_0xce65('0x34')]=function(_0x67fc6f){try{if(!_[_0xce65('0x20')](channels[_0x67fc6f['localtwolinkedid']])){utils[_0xce65('0x18')](util[_0xce65('0xb')](_0xce65('0x35'),_0x67fc6f[_0xce65('0x36')]),_0x67fc6f);if(channels[_0x67fc6f[_0xce65('0x37')]][_0xce65('0xc')]==_0x67fc6f[_0xce65('0x38')]){utils['info'](util['format'](_0xce65('0x39'),_0x67fc6f[_0xce65('0x36')],_0x67fc6f['localtwolinkedid'],_0x67fc6f[_0xce65('0x3a')]));channels[_0x67fc6f[_0xce65('0x37')]][_0xce65('0x3b')]=_0x67fc6f['secondtransfererchannel'];channels[_0x67fc6f['localtwolinkedid']][_0xce65('0x3c')]=_0xce65('0x3d');}else if(channels[_0x67fc6f[_0xce65('0x37')]][_0xce65('0xc')]=_0x67fc6f['transfertargetchannel']){utils[_0xce65('0xa')](util[_0xce65('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x67fc6f[_0xce65('0x36')],_0x67fc6f['localtwolinkedid'],_0x67fc6f['origtransfererchannel']));channels[_0x67fc6f[_0xce65('0x37')]]['destinationchannel']=_0x67fc6f[_0xce65('0x3e')];channels[_0x67fc6f['localtwolinkedid']][_0xce65('0x3c')]=_0xce65('0x3d');}}}catch(_0x5de396){utils[_0xce65('0x29')](util['format'](_0xce65('0x35'),_0x67fc6f[_0xce65('0x36')]),_0x5de396);}};exports[_0xce65('0x3f')]=function(_0x4e8451){try{if(!_[_0xce65('0x20')](channels[_0x4e8451['uniqueid']])){utils[_0xce65('0x18')](util[_0xce65('0xb')](_0xce65('0x40'),_0x4e8451[_0xce65('0x7')]),_0x4e8451);channels[_0x4e8451[_0xce65('0x7')]]['musiconholdstartAt']=utils[_0xce65('0x1d')]();utils[_0xce65('0xa')](util[_0xce65('0xb')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x4e8451['uniqueid'],channels[_0x4e8451['uniqueid']][_0xce65('0x41')]));}}catch(_0x3c1c37){utils['error'](util[_0xce65('0xb')](_0xce65('0x40'),_0x4e8451[_0xce65('0x7')]),_0x3c1c37);}};exports['musiconholdstop']=function(_0x21d676){try{if(!_['isNil'](channels[_0x21d676[_0xce65('0x7')]])){utils[_0xce65('0x18')](util[_0xce65('0xb')](_0xce65('0x42'),_0x21d676[_0xce65('0x7')]),_0x21d676);if(!_[_0xce65('0x20')](channels[_0x21d676['uniqueid']][_0xce65('0x41')])){channels[_0x21d676[_0xce65('0x7')]]['mohtime']+=utils[_0xce65('0x33')](utils[_0xce65('0x1d')](),channels[_0x21d676[_0xce65('0x7')]]['musiconholdstartAt']);utils[_0xce65('0xa')](util['format'](_0xce65('0x43'),_0x21d676[_0xce65('0x7')],channels[_0x21d676['uniqueid']][_0xce65('0x44')]));delete channels[_0x21d676[_0xce65('0x7')]][_0xce65('0x41')];}}}catch(_0x1851e7){utils[_0xce65('0x29')](util['format'](_0xce65('0x42'),_0x21d676[_0xce65('0x7')]),_0x1851e7);}};exports[_0xce65('0x45')]=function(_0x45e828){try{if(!_['isNil'](channels[_0x45e828[_0xce65('0x7')]])){utils[_0xce65('0x18')](util['format'](_0xce65('0x46'),_0x45e828[_0xce65('0x7')]),_0x45e828);if(!_['isNil'](_0x45e828[_0xce65('0x47')]['xmd-originatecalleridnum'])){utils[_0xce65('0xa')](util[_0xce65('0xb')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x45e828[_0xce65('0x7')],_0x45e828[_0xce65('0x48')]));channels[_0x45e828[_0xce65('0x7')]][_0xce65('0x49')]=_0x45e828['value'];}if(!_[_0xce65('0x20')](_0x45e828[_0xce65('0x47')][_0xce65('0x4a')])){utils[_0xce65('0xa')](util[_0xce65('0xb')](_0xce65('0x4b'),_0x45e828[_0xce65('0x7')],_0x45e828['value']));channels[_0x45e828['uniqueid']]['destination']=_0x45e828[_0xce65('0x48')];channels[_0x45e828[_0xce65('0x7')]][_0xce65('0x2c')]='\x22'+_0x45e828['value']+_0xce65('0x4c')+_0x45e828[_0xce65('0x48')]+'>';}if(!_[_0xce65('0x20')](_0x45e828[_0xce65('0x47')][_0xce65('0x4d')])||!_['isNil'](_0x45e828[_0xce65('0x47')][_0xce65('0x4e')])){utils[_0xce65('0xa')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x45e828['uniqueid'],!_[_0xce65('0x20')](_0x45e828[_0xce65('0x47')]['xmd-callerid-preview'])?_0xce65('0x4d'):_0xce65('0x4e'),_0x45e828[_0xce65('0x48')]));channels[_0x45e828[_0xce65('0x7')]]['callerid']=_0x45e828[_0xce65('0x48')];}if(!_['isNil'](_0x45e828[_0xce65('0x47')][_0xce65('0x4f')])||!_['isNil'](_0x45e828[_0xce65('0x47')]['xmcs-queue'])){utils[_0xce65('0xa')](util[_0xce65('0xb')](_0xce65('0x50'),_0x45e828['uniqueid'],!_[_0xce65('0x20')](_0x45e828[_0xce65('0x47')]['xmd-queue'])?_0xce65('0x4f'):_0xce65('0x51'),_0x45e828['value']));channels[_0x45e828[_0xce65('0x7')]][_0xce65('0x52')]=_0xce65('0x53');channels[_0x45e828[_0xce65('0x7')]]['lastdata']=_0x45e828[_0xce65('0x48')];channels[_0x45e828[_0xce65('0x7')]]['queue']=!![];}if(!_['isNil'](_0x45e828['variable'][_0xce65('0x54')])){utils[_0xce65('0xa')](util[_0xce65('0xb')](_0xce65('0x55'),_0x45e828[_0xce65('0x7')],_0x45e828[_0xce65('0x48')]));channels[_0x45e828['uniqueid']][_0xce65('0x56')]=_0x45e828[_0xce65('0x48')];}if(!_[_0xce65('0x20')](_0x45e828[_0xce65('0x47')][_0xce65('0x57')])){utils[_0xce65('0xa')](util[_0xce65('0xb')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x45e828[_0xce65('0x7')],_0x45e828['value']));channels[_0x45e828[_0xce65('0x7')]][_0xce65('0x58')]=_0x45e828[_0xce65('0x48')];}if(!_[_0xce65('0x20')](_0x45e828['variable'][_0xce65('0x59')])){utils['info'](util[_0xce65('0xb')](_0xce65('0x5a'),_0x45e828['uniqueid'],_0x45e828[_0xce65('0x48')]));channels[_0x45e828['uniqueid']][_0xce65('0x5b')]=_0x45e828[_0xce65('0x48')];}if(!_['isNil'](_0x45e828[_0xce65('0x47')]['sipcallid'])){utils[_0xce65('0xa')](util[_0xce65('0xb')](_0xce65('0x5c'),_0x45e828[_0xce65('0x7')],_0x45e828['value']));channels[_0x45e828[_0xce65('0x7')]][_0xce65('0x5d')]=_0x45e828[_0xce65('0x48')];}}}catch(_0x5bd6e5){utils[_0xce65('0x29')](util[_0xce65('0xb')](_0xce65('0x46'),_0x45e828['uniqueid']),_0x5bd6e5);}};exports[_0xce65('0x5e')]=function(_0x2b8637){try{if(!_[_0xce65('0x20')](channels[_0x2b8637[_0xce65('0x7')]])){utils['debug'](util['format'](_0xce65('0x5f'),_0x2b8637['uniqueid']),_0x2b8637);utils[_0xce65('0xa')](util[_0xce65('0xb')](_0xce65('0x60'),_0x2b8637[_0xce65('0x7')],_0x2b8637['application'],_0x2b8637[_0xce65('0x61')]));if(_0x2b8637[_0xce65('0x62')][_0xce65('0x63')]()==_0xce65('0x64')&&_['startsWith'](_0x2b8637[_0xce65('0x61')]['toLowerCase'](),'cdr')){var _0x69889c=_0x2b8637[_0xce65('0x61')][_0xce65('0x65')]('=');var _0x3c5401=_0x69889c[0x0][_0xce65('0x66')](_0x69889c[0x0][_0xce65('0x67')]('(')+0x1,_0x69889c[0x0][_0xce65('0x67')](')'));var _0x338807=_0x69889c[0x1];channels[_0x2b8637['uniqueid']][_0x3c5401]=_0x338807;}if(!_[_0xce65('0x68')]([_0xce65('0x2a'),'noop',_0xce65('0x69'),_0xce65('0x64'),_0xce65('0x6a')],_0x2b8637[_0xce65('0x62')][_0xce65('0x63')]())){channels[_0x2b8637[_0xce65('0x7')]][_0xce65('0x52')]=_0x2b8637[_0xce65('0x62')];channels[_0x2b8637['uniqueid']]['lastdata']=_0x2b8637[_0xce65('0x61')];}}}catch(_0x272028){utils[_0xce65('0x29')](util['format']('[%s][calls][newexten]',_0x2b8637[_0xce65('0x7')]),_0x272028);}}; \ No newline at end of file +var _0x29b6=['[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','musiconholdstartAt','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','lastIndexOf','includes','hangup','noop','execif','gotoif','lastdata','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','uniqueid','transfereeuniqueid','info','channel','queue','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','blinds','newchannel','format','linkedid','OutgoingSpoolFailed','context','exten','now','error','[%s][calls][newchannel]','newstate','[%s][calls][newstate]','isNil','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','disposition','toNumber','debug','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','diffTime','billableseconds','answertime','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]'];(function(_0x92354d,_0xcbd1ac){var _0x57f449=function(_0x19658f){while(--_0x19658f){_0x92354d['push'](_0x92354d['shift']());}};_0x57f449(++_0xcbd1ac);}(_0x29b6,0x9c));var _0x629b=function(_0x2e0d27,_0xd23596){_0x2e0d27=_0x2e0d27-0x0;var _0x570a63=_0x29b6[_0x2e0d27];return _0x570a63;};'use strict';var _=require(_0x629b('0x0'));var util=require('util');var utils=require(_0x629b('0x1'));var transfers=require(_0x629b('0x2'));var dispositions=[_0x629b('0x3'),_0x629b('0x4'),_0x629b('0x4'),_0x629b('0x3'),'NO\x20ANSWER',_0x629b('0x3'),_0x629b('0x5'),'BUSY',_0x629b('0x4'),'FAILED',_0x629b('0x4')];var channels={};function writeDB(_0x46c3f6){var _0x2b2c3b;if(transfers['blinds'][_0x46c3f6['uniqueid']]){_0x2b2c3b=_0x46c3f6[_0x629b('0x6')];_0x46c3f6[_0x629b('0x6')]=transfers['blinds'][_0x46c3f6[_0x629b('0x6')]][_0x629b('0x7')];}utils[_0x629b('0x8')](util['format']('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x46c3f6[_0x629b('0x6')],_0x46c3f6[_0x629b('0x9')],_0x46c3f6[_0x629b('0xa')],_0x46c3f6['membername'],_0x46c3f6[_0x629b('0xb')],_0x46c3f6['calleridnum'],_0x46c3f6[_0x629b('0xc')],_0x46c3f6[_0x629b('0xd')]));if(_0x46c3f6[_0x629b('0xe')]){utils[_0x629b('0xf')](_0x46c3f6[_0x629b('0xe')])[_0x629b('0x10')](function(_0x15e82c){if(_0x15e82c){_0x46c3f6[_0x629b('0x11')]=_0x15e82c['id'];}utils[_0x629b('0x12')](_0x629b('0x13'),_0x46c3f6);});}else{utils[_0x629b('0x12')](_0x629b('0x13'),_0x46c3f6);}if(channels[_0x46c3f6['uniqueid']]){delete channels[_0x46c3f6[_0x629b('0x6')]];}else if(_0x2b2c3b&&channels[_0x2b2c3b]){delete transfers[_0x629b('0x14')][_0x2b2c3b];delete channels[_0x2b2c3b];}}exports[_0x629b('0x15')]=function(_0x45dadf){try{utils['debug'](util[_0x629b('0x16')]('[%s][calls][newchannel]',_0x45dadf['uniqueid']),_0x45dadf);if(_0x45dadf[_0x629b('0x6')]==_0x45dadf[_0x629b('0x17')]&&_0x45dadf[_0x629b('0x9')]!=_0x629b('0x18')){utils[_0x629b('0x8')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x45dadf['uniqueid'],_0x45dadf[_0x629b('0x19')],_0x45dadf[_0x629b('0x1a')]));channels[_0x45dadf[_0x629b('0x6')]]={'uniqueid':_0x45dadf[_0x629b('0x6')],'accountcode':_0x45dadf[_0x629b('0xe')],'source':_0x45dadf['calleridnum'],'destination':_0x45dadf[_0x629b('0x1a')],'destinationcontext':_0x45dadf[_0x629b('0x19')],'channel':_0x45dadf['channel'],'starttime':utils[_0x629b('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x629b('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x15700e){utils[_0x629b('0x1c')](util[_0x629b('0x16')](_0x629b('0x1d'),_0x45dadf['uniqueid']),_0x15700e);}};exports[_0x629b('0x1e')]=function(_0x2d61cc){try{utils['debug'](util[_0x629b('0x16')](_0x629b('0x1f'),_0x2d61cc[_0x629b('0x6')]),_0x2d61cc);if(!_[_0x629b('0x20')](channels[_0x2d61cc[_0x629b('0x6')]])&&_0x2d61cc['channelstate']==0x6){utils[_0x629b('0x8')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x2d61cc[_0x629b('0x6')],_0x2d61cc['context'],_0x2d61cc[_0x629b('0x9')]));if(_[_0x629b('0x20')](channels[_0x2d61cc[_0x629b('0x6')]]['systemanswertime'])){channels[_0x2d61cc[_0x629b('0x6')]][_0x629b('0x21')]=utils[_0x629b('0x1b')]();}}else if(!_[_0x629b('0x20')](channels[_0x2d61cc['linkedid']])&&_0x2d61cc[_0x629b('0x22')]==0x6&&_0x2d61cc['context']!=_0x629b('0x23')){utils[_0x629b('0x8')](util[_0x629b('0x16')](_0x629b('0x24'),_0x2d61cc[_0x629b('0x6')],_0x2d61cc[_0x629b('0x17')],_0x2d61cc[_0x629b('0x19')],_0x2d61cc['channel']));channels[_0x2d61cc[_0x629b('0x17')]][_0x629b('0xe')]=_0x2d61cc[_0x629b('0xe')];channels[_0x2d61cc[_0x629b('0x17')]][_0x629b('0x25')]=_0x2d61cc[_0x629b('0x9')];if(_['isNil'](channels[_0x2d61cc[_0x629b('0x17')]]['answertime'])){channels[_0x2d61cc[_0x629b('0x17')]]['answertime']=utils[_0x629b('0x1b')]();}channels[_0x2d61cc[_0x629b('0x17')]][_0x629b('0x26')]=dispositions[_[_0x629b('0x27')](_0x2d61cc[_0x629b('0x22')])]||_0x629b('0x5');}}catch(_0x5df1ee){utils[_0x629b('0x1c')](util[_0x629b('0x16')](_0x629b('0x1f'),_0x2d61cc[_0x629b('0x6')]),_0x5df1ee);}};exports['hangup']=function(_0x150f48){try{if(!_['isNil'](channels[_0x150f48[_0x629b('0x6')]])){utils[_0x629b('0x28')](util[_0x629b('0x16')](_0x629b('0x29'),_0x150f48['uniqueid']),_0x150f48);if(_[_0x629b('0x20')](channels[_0x150f48[_0x629b('0x6')]][_0x629b('0x2a')])){channels[_0x150f48['uniqueid']][_0x629b('0x2a')]=_0x150f48[_0x629b('0x2b')]+'\x20<'+_0x150f48['calleridnum']+'>';}utils['info'](util[_0x629b('0x16')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x150f48[_0x629b('0x6')],channels[_0x150f48['uniqueid']]['callerid'],_0x150f48[_0x629b('0x2c')]));channels[_0x150f48[_0x629b('0x6')]][_0x629b('0x2d')]=utils[_0x629b('0x1b')]();channels[_0x150f48[_0x629b('0x6')]]['duration']=utils[_0x629b('0x2e')](channels[_0x150f48[_0x629b('0x6')]][_0x629b('0x2d')],channels[_0x150f48[_0x629b('0x6')]]['starttime']);channels[_0x150f48[_0x629b('0x6')]][_0x629b('0x2f')]=channels[_0x150f48['uniqueid']][_0x629b('0x30')]?utils[_0x629b('0x2e')](channels[_0x150f48['uniqueid']][_0x629b('0x2d')],channels[_0x150f48['uniqueid']][_0x629b('0x30')]):0x0;writeDB(channels[_0x150f48[_0x629b('0x6')]]);}}catch(_0x2b40c3){utils[_0x629b('0x1c')](util[_0x629b('0x16')]('[%s][calls][hangup]',_0x150f48[_0x629b('0x6')]),_0x2b40c3);}};exports['attendedtransfer']=function(_0x484162){try{if(!_[_0x629b('0x20')](channels[_0x484162[_0x629b('0x31')]])){utils[_0x629b('0x28')](util['format'](_0x629b('0x32'),_0x484162['origtransfereruniqueid']),_0x484162);if(channels[_0x484162['localtwolinkedid']][_0x629b('0x9')]==_0x484162[_0x629b('0x33')]){utils[_0x629b('0x8')](util[_0x629b('0x16')](_0x629b('0x34'),_0x484162[_0x629b('0x35')],_0x484162['localtwolinkedid'],_0x484162[_0x629b('0x36')]));channels[_0x484162['localtwolinkedid']][_0x629b('0x25')]=_0x484162[_0x629b('0x36')];channels[_0x484162['localtwolinkedid']][_0x629b('0x37')]=_0x629b('0x38');}else if(channels[_0x484162[_0x629b('0x31')]][_0x629b('0x9')]=_0x484162['transfertargetchannel']){utils['info'](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x484162[_0x629b('0x35')],_0x484162[_0x629b('0x31')],_0x484162[_0x629b('0x39')]));channels[_0x484162[_0x629b('0x31')]][_0x629b('0x25')]=_0x484162['origtransfererchannel'];channels[_0x484162['localtwolinkedid']]['userfield']='_attended';}}}catch(_0x102df3){utils[_0x629b('0x1c')](util[_0x629b('0x16')](_0x629b('0x32'),_0x484162[_0x629b('0x35')]),_0x102df3);}};exports[_0x629b('0x3a')]=function(_0x19a4ed){try{if(!_[_0x629b('0x20')](channels[_0x19a4ed[_0x629b('0x6')]])){utils[_0x629b('0x28')](util[_0x629b('0x16')](_0x629b('0x3b'),_0x19a4ed['uniqueid']),_0x19a4ed);channels[_0x19a4ed[_0x629b('0x6')]]['musiconholdstartAt']=utils[_0x629b('0x1b')]();utils['info'](util[_0x629b('0x16')](_0x629b('0x3c'),_0x19a4ed[_0x629b('0x6')],channels[_0x19a4ed[_0x629b('0x6')]]['musiconholdstartAt']));}}catch(_0xeb2b98){utils['error'](util[_0x629b('0x16')](_0x629b('0x3b'),_0x19a4ed[_0x629b('0x6')]),_0xeb2b98);}};exports[_0x629b('0x3d')]=function(_0x4bd22d){try{if(!_[_0x629b('0x20')](channels[_0x4bd22d['uniqueid']])){utils[_0x629b('0x28')](util['format'](_0x629b('0x3e'),_0x4bd22d['uniqueid']),_0x4bd22d);if(!_[_0x629b('0x20')](channels[_0x4bd22d['uniqueid']][_0x629b('0x3f')])){channels[_0x4bd22d[_0x629b('0x6')]][_0x629b('0x40')]+=utils['diffTime'](utils[_0x629b('0x1b')](),channels[_0x4bd22d[_0x629b('0x6')]][_0x629b('0x3f')]);utils[_0x629b('0x8')](util[_0x629b('0x16')](_0x629b('0x41'),_0x4bd22d[_0x629b('0x6')],channels[_0x4bd22d[_0x629b('0x6')]][_0x629b('0x40')]));delete channels[_0x4bd22d[_0x629b('0x6')]][_0x629b('0x3f')];}}}catch(_0x396693){utils[_0x629b('0x1c')](util[_0x629b('0x16')](_0x629b('0x3e'),_0x4bd22d['uniqueid']),_0x396693);}};exports[_0x629b('0x42')]=function(_0xc561c3){try{if(!_[_0x629b('0x20')](channels[_0xc561c3['uniqueid']])){utils[_0x629b('0x28')](util[_0x629b('0x16')](_0x629b('0x43'),_0xc561c3[_0x629b('0x6')]),_0xc561c3);if(!_[_0x629b('0x20')](_0xc561c3[_0x629b('0x44')][_0x629b('0x45')])){utils[_0x629b('0x8')](util['format'](_0x629b('0x46'),_0xc561c3[_0x629b('0x6')],_0xc561c3[_0x629b('0x47')]));channels[_0xc561c3[_0x629b('0x6')]][_0x629b('0x48')]=_0xc561c3[_0x629b('0x47')];}if(!_[_0x629b('0x20')](_0xc561c3['variable'][_0x629b('0x49')])){utils['info'](util[_0x629b('0x16')](_0x629b('0x4a'),_0xc561c3['uniqueid'],_0xc561c3[_0x629b('0x47')]));channels[_0xc561c3[_0x629b('0x6')]][_0x629b('0x4b')]=_0xc561c3[_0x629b('0x47')];channels[_0xc561c3[_0x629b('0x6')]]['callerid']='\x22'+_0xc561c3['value']+_0x629b('0x4c')+_0xc561c3[_0x629b('0x47')]+'>';}if(!_[_0x629b('0x20')](_0xc561c3[_0x629b('0x44')][_0x629b('0x4d')])||!_['isNil'](_0xc561c3[_0x629b('0x44')][_0x629b('0x4e')])){utils[_0x629b('0x8')](util[_0x629b('0x16')](_0x629b('0x4f'),_0xc561c3['uniqueid'],!_['isNil'](_0xc561c3[_0x629b('0x44')][_0x629b('0x4d')])?_0x629b('0x4d'):'xmd-callerid',_0xc561c3[_0x629b('0x47')]));channels[_0xc561c3[_0x629b('0x6')]][_0x629b('0x2a')]=_0xc561c3[_0x629b('0x47')];}if(!_[_0x629b('0x20')](_0xc561c3[_0x629b('0x44')][_0x629b('0x50')])||!_[_0x629b('0x20')](_0xc561c3[_0x629b('0x44')]['xmcs-queue'])){utils[_0x629b('0x8')](util[_0x629b('0x16')](_0x629b('0x4f'),_0xc561c3[_0x629b('0x6')],!_[_0x629b('0x20')](_0xc561c3[_0x629b('0x44')][_0x629b('0x50')])?_0x629b('0x50'):_0x629b('0x51'),_0xc561c3[_0x629b('0x47')]));channels[_0xc561c3[_0x629b('0x6')]][_0x629b('0x52')]='Queue';channels[_0xc561c3[_0x629b('0x6')]]['lastdata']=_0xc561c3['value'];channels[_0xc561c3[_0x629b('0x6')]]['queue']=!![];}if(!_[_0x629b('0x20')](_0xc561c3[_0x629b('0x44')][_0x629b('0x53')])){utils[_0x629b('0x8')](util['format'](_0x629b('0x54'),_0xc561c3[_0x629b('0x6')],_0xc561c3[_0x629b('0x47')]));channels[_0xc561c3[_0x629b('0x6')]][_0x629b('0x55')]=_0xc561c3[_0x629b('0x47')];}if(!_[_0x629b('0x20')](_0xc561c3[_0x629b('0x44')]['xmd-cdrtype'])){utils[_0x629b('0x8')](util[_0x629b('0x16')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xc561c3['uniqueid'],_0xc561c3['value']));channels[_0xc561c3[_0x629b('0x6')]][_0x629b('0x56')]=_0xc561c3['value'];}if(!_[_0x629b('0x20')](_0xc561c3['variable'][_0x629b('0x57')])){utils['info'](util[_0x629b('0x16')](_0x629b('0x58'),_0xc561c3[_0x629b('0x6')],_0xc561c3[_0x629b('0x47')]));channels[_0xc561c3['uniqueid']][_0x629b('0x59')]=_0xc561c3[_0x629b('0x47')];}if(!_['isNil'](_0xc561c3[_0x629b('0x44')][_0x629b('0x5a')])){utils['info'](util['format'](_0x629b('0x5b'),_0xc561c3[_0x629b('0x6')],_0xc561c3[_0x629b('0x47')]));channels[_0xc561c3['uniqueid']][_0x629b('0x5a')]=_0xc561c3[_0x629b('0x47')];}}}catch(_0x5c8f8c){utils['error'](util[_0x629b('0x16')](_0x629b('0x43'),_0xc561c3['uniqueid']),_0x5c8f8c);}};exports[_0x629b('0x5c')]=function(_0x22df3d){try{if(!_[_0x629b('0x20')](channels[_0x22df3d['uniqueid']])){utils[_0x629b('0x28')](util[_0x629b('0x16')](_0x629b('0x5d'),_0x22df3d[_0x629b('0x6')]),_0x22df3d);utils[_0x629b('0x8')](util[_0x629b('0x16')](_0x629b('0x5e'),_0x22df3d[_0x629b('0x6')],_0x22df3d[_0x629b('0x5f')],_0x22df3d[_0x629b('0x60')]));if(_0x22df3d[_0x629b('0x5f')]['toLowerCase']()==_0x629b('0x61')&&_[_0x629b('0x62')](_0x22df3d[_0x629b('0x60')][_0x629b('0x63')](),_0x629b('0x64'))){var _0x3b36a4=_0x22df3d[_0x629b('0x60')]['split']('=');var _0x2e55ce=_0x3b36a4[0x0]['substring'](_0x3b36a4[0x0][_0x629b('0x65')]('(')+0x1,_0x3b36a4[0x0][_0x629b('0x65')](')'));var _0x41bcd6=_0x3b36a4[0x1];channels[_0x22df3d[_0x629b('0x6')]][_0x2e55ce]=_0x41bcd6;}if(!_[_0x629b('0x66')]([_0x629b('0x67'),_0x629b('0x68'),_0x629b('0x69'),_0x629b('0x61'),_0x629b('0x6a')],_0x22df3d[_0x629b('0x5f')][_0x629b('0x63')]())){channels[_0x22df3d[_0x629b('0x6')]][_0x629b('0x52')]=_0x22df3d['application'];channels[_0x22df3d[_0x629b('0x6')]][_0x629b('0x6b')]=_0x22df3d[_0x629b('0x60')];}}}catch(_0xe1f970){utils['error'](util['format'](_0x629b('0x5d'),_0x22df3d[_0x629b('0x6')]),_0xe1f970);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 119688e..50669d9 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 _0x2469=['[core]\x20error','[core]\x20close','managerevent','./utils','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted'];(function(_0x514fc8,_0x501423){var _0x2bfc61=function(_0x1ba839){while(--_0x1ba839){_0x514fc8['push'](_0x514fc8['shift']());}};_0x2bfc61(++_0x501423);}(_0x2469,0x183));var _0x9246=function(_0x107bfb,_0x2c5e92){_0x107bfb=_0x107bfb-0x0;var _0x498c0e=_0x2469[_0x107bfb];return _0x498c0e;};'use strict';var utils=require(_0x9246('0x0'));exports['connect']=function(){utils[_0x9246('0x1')]('[core]\x20connected');};exports['shutdown']=function(){utils[_0x9246('0x1')](_0x9246('0x2'));};exports[_0x9246('0x3')]=function(){utils[_0x9246('0x1')](_0x9246('0x4'));};exports['error']=function(_0x1a0c8d){utils['error'](_0x9246('0x5'),_0x1a0c8d);};exports['close']=function(){utils[_0x9246('0x1')](_0x9246('0x6'));};exports[_0x9246('0x7')]=function(_0x9d09f){}; \ No newline at end of file +var _0xa597=['info','[core]\x20connected','[core]\x20shutdown','fullybooted','error','[core]\x20error','[core]\x20close','connect'];(function(_0x4603a2,_0x2a26ac){var _0x17dc98=function(_0x15cdf5){while(--_0x15cdf5){_0x4603a2['push'](_0x4603a2['shift']());}};_0x17dc98(++_0x2a26ac);}(_0xa597,0xb7));var _0x7a59=function(_0x20ea4e,_0xb93349){_0x20ea4e=_0x20ea4e-0x0;var _0x160cba=_0xa597[_0x20ea4e];return _0x160cba;};'use strict';var utils=require('./utils');exports[_0x7a59('0x0')]=function(){utils[_0x7a59('0x1')](_0x7a59('0x2'));};exports['shutdown']=function(){utils[_0x7a59('0x1')](_0x7a59('0x3'));};exports[_0x7a59('0x4')]=function(){utils['info']('[core]\x20fullybooted');};exports['error']=function(_0xac64bb){utils[_0x7a59('0x5')](_0x7a59('0x6'),_0xac64bb);};exports['close']=function(){utils[_0x7a59('0x1')](_0x7a59('0x7'));};exports['managerevent']=function(_0x573e15){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 0e66caf..ae5da11 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 _0x07ac=['lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','complete','diffTime','endtime','holdtime','[%s][dials][hangup]','util','./utils','info','format','uniqueid','channel','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr(routeid)','appdata','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][dialbegin]','assign','starttime','now'];(function(_0x1a3414,_0x2eb8eb){var _0x6dd133=function(_0x3b7420){while(--_0x3b7420){_0x1a3414['push'](_0x1a3414['shift']());}};_0x6dd133(++_0x2eb8eb);}(_0x07ac,0x18a));var _0xc07a=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x07ac[_0xbd08b4];return _0x314f1e;};'use strict';var _=require('lodash');var util=require(_0xc07a('0x0'));var utils=require(_0xc07a('0x1'));var dials={};function writeDB(_0x2bc767){utils[_0xc07a('0x2')](util[_0xc07a('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x2bc767[_0xc07a('0x4')],_0x2bc767[_0xc07a('0x5')],_0x2bc767['dialstring'],_0x2bc767['calleridnum'],_0x2bc767['connectedlinenum'],_0x2bc767[_0xc07a('0x6')]));utils[_0xc07a('0x7')]('CreateVoiceDialReport',_0x2bc767);delete dials[_0x2bc767[_0xc07a('0x4')]];}exports[_0xc07a('0x8')]=function(_0x1e54f7){try{utils[_0xc07a('0x9')](util[_0xc07a('0x3')](_0xc07a('0xa'),_0x1e54f7[_0xc07a('0x4')]),_0x1e54f7);utils[_0xc07a('0x2')](util[_0xc07a('0x3')](_0xc07a('0xb'),_0x1e54f7[_0xc07a('0x4')],_0x1e54f7[_0xc07a('0xc')],_0x1e54f7['appdata']));if(_0x1e54f7['application'][_0xc07a('0xd')]()==_0xc07a('0xe')&&_[_0xc07a('0xf')](_0x1e54f7['appdata'][_0xc07a('0xd')](),_0xc07a('0x10'))){var _0x298013=_0x1e54f7[_0xc07a('0x11')]['split']('=');dials[_0x1e54f7[_0xc07a('0x4')]]={'routeId':_0x298013[0x1]};}}catch(_0x26a5d4){utils['error'](util[_0xc07a('0x3')]('[%s][dials][newexten]',_0x1e54f7[_0xc07a('0x4')]),_0x26a5d4);}};exports['varset']=function(_0x36de4e){try{utils['debug'](util[_0xc07a('0x3')](_0xc07a('0x12'),_0x36de4e[_0xc07a('0x4')]),_0x36de4e);if(!_[_0xc07a('0x13')](_0x36de4e[_0xc07a('0x14')][_0xc07a('0x15')])){utils[_0xc07a('0x2')](util[_0xc07a('0x3')](_0xc07a('0x16'),_0x36de4e[_0xc07a('0x4')],_0x36de4e[_0xc07a('0x17')]));dials[_0x36de4e['uniqueid']]={'routeId':_0x36de4e[_0xc07a('0x17')]};}}catch(_0x3c6709){utils[_0xc07a('0x18')](util[_0xc07a('0x3')]('[%s][dials][varset]',_0x36de4e[_0xc07a('0x4')]),_0x3c6709);}};exports['dialbegin']=function(_0xf23674){try{if(!_[_0xc07a('0x13')](dials[_0xf23674[_0xc07a('0x4')]])){utils[_0xc07a('0x9')](util[_0xc07a('0x3')](_0xc07a('0x19'),_0xf23674[_0xc07a('0x4')]),_0xf23674);dials[_0xf23674[_0xc07a('0x4')]]=_[_0xc07a('0x1a')](dials[_0xf23674[_0xc07a('0x4')]],_0xf23674);dials[_0xf23674[_0xc07a('0x4')]][_0xc07a('0x1b')]=utils[_0xc07a('0x1c')]();dials[_0xf23674['uniqueid']][_0xc07a('0x1d')]='called';utils[_0xc07a('0x2')](util[_0xc07a('0x3')](_0xc07a('0x1e'),_0xf23674[_0xc07a('0x4')],dials[_0xf23674[_0xc07a('0x4')]][_0xc07a('0x1b')]));}}catch(_0x2f5f8c){utils['error'](util[_0xc07a('0x3')](_0xc07a('0x19'),_0xf23674[_0xc07a('0x4')]),_0x2f5f8c);}};exports[_0xc07a('0x1f')]=function(_0x556167){try{if(!_[_0xc07a('0x13')](dials[_0x556167['uniqueid']])){utils['debug'](util[_0xc07a('0x3')](_0xc07a('0x20'),_0x556167['uniqueid']),_0x556167);dials[_0x556167[_0xc07a('0x4')]][_0xc07a('0x6')]=_0x556167[_0xc07a('0x6')];if(_0x556167[_0xc07a('0x6')]==_0xc07a('0x21')){dials[_0x556167[_0xc07a('0x4')]]=_[_0xc07a('0x1a')](dials[_0x556167[_0xc07a('0x4')]],_0x556167);dials[_0x556167['uniqueid']][_0xc07a('0x22')]=utils['now']();dials[_0x556167[_0xc07a('0x4')]]['lastevent']=_0xc07a('0x23');utils[_0xc07a('0x2')](util['format'](_0xc07a('0x24'),_0x556167[_0xc07a('0x4')],_0x556167[_0xc07a('0x6')],dials[_0x556167[_0xc07a('0x4')]][_0xc07a('0x22')]));}else{utils[_0xc07a('0x2')](util[_0xc07a('0x3')](_0xc07a('0x25'),_0x556167[_0xc07a('0x4')],_0x556167['dialstatus']));}}}catch(_0x431888){utils[_0xc07a('0x18')](util[_0xc07a('0x3')](_0xc07a('0x20'),_0x556167['uniqueid']),_0x431888);}};exports[_0xc07a('0x26')]=function(_0x4753d0){try{if(!_[_0xc07a('0x13')](dials[_0x4753d0['uniqueid']])){utils['debug'](util['format']('[%s][dials][hangup]',_0x4753d0[_0xc07a('0x4')]),_0x4753d0);utils['info'](util[_0xc07a('0x3')](_0xc07a('0x27'),_0x4753d0[_0xc07a('0x4')],_0x4753d0[_0xc07a('0x28')],_0x4753d0[_0xc07a('0x29')],_0x4753d0['cause-txt']));dials[_0x4753d0[_0xc07a('0x4')]]=_[_0xc07a('0x1a')](dials[_0x4753d0[_0xc07a('0x4')]],{'endtime':utils['now'](),'lastevent':_0xc07a('0x2a')});dials[_0x4753d0[_0xc07a('0x4')]]['duration']=utils[_0xc07a('0x2b')](dials[_0x4753d0[_0xc07a('0x4')]][_0xc07a('0x2c')],dials[_0x4753d0[_0xc07a('0x4')]]['starttime']);dials[_0x4753d0[_0xc07a('0x4')]][_0xc07a('0x2d')]=utils['diffTime'](dials[_0x4753d0[_0xc07a('0x4')]][_0xc07a('0x22')]||dials[_0x4753d0[_0xc07a('0x4')]][_0xc07a('0x2c')],dials[_0x4753d0['uniqueid']][_0xc07a('0x1b')]);dials[_0x4753d0['uniqueid']]['billableseconds']=dials[_0x4753d0[_0xc07a('0x4')]]['answertime']?utils[_0xc07a('0x2b')](dials[_0x4753d0[_0xc07a('0x4')]]['endtime'],dials[_0x4753d0[_0xc07a('0x4')]][_0xc07a('0x22')]):0x0;writeDB(dials[_0x4753d0[_0xc07a('0x4')]]);}}catch(_0x1c2629){utils[_0xc07a('0x18')](util['format'](_0xc07a('0x2e'),_0x4753d0['uniqueid']),_0x1c2629);}}; \ No newline at end of file +var _0x3ad8=['[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','split','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','called','starttime','error'];(function(_0x1d9571,_0x5c2153){var _0x18ec91=function(_0x3c11bb){while(--_0x3c11bb){_0x1d9571['push'](_0x1d9571['shift']());}};_0x18ec91(++_0x5c2153);}(_0x3ad8,0x76));var _0x83ad=function(_0x260cbc,_0x2fa83b){_0x260cbc=_0x260cbc-0x0;var _0xd11cc9=_0x3ad8[_0x260cbc];return _0xd11cc9;};'use strict';var _=require(_0x83ad('0x0'));var util=require('util');var utils=require(_0x83ad('0x1'));var dials={};function writeDB(_0x325023){utils['info'](util[_0x83ad('0x2')](_0x83ad('0x3'),_0x325023['uniqueid'],_0x325023[_0x83ad('0x4')],_0x325023[_0x83ad('0x5')],_0x325023['calleridnum'],_0x325023[_0x83ad('0x6')],_0x325023[_0x83ad('0x7')]));utils[_0x83ad('0x8')](_0x83ad('0x9'),_0x325023);delete dials[_0x325023[_0x83ad('0xa')]];}exports['newexten']=function(_0x2ca8c7){try{utils[_0x83ad('0xb')](util[_0x83ad('0x2')](_0x83ad('0xc'),_0x2ca8c7[_0x83ad('0xa')]),_0x2ca8c7);utils[_0x83ad('0xd')](util[_0x83ad('0x2')](_0x83ad('0xe'),_0x2ca8c7[_0x83ad('0xa')],_0x2ca8c7[_0x83ad('0xf')],_0x2ca8c7[_0x83ad('0x10')]));if(_0x2ca8c7[_0x83ad('0xf')]['toLowerCase']()==_0x83ad('0x11')&&_[_0x83ad('0x12')](_0x2ca8c7[_0x83ad('0x10')][_0x83ad('0x13')](),'cdr(routeid)')){var _0x56bea6=_0x2ca8c7['appdata'][_0x83ad('0x14')]('=');dials[_0x2ca8c7[_0x83ad('0xa')]]={'routeId':_0x56bea6[0x1]};}}catch(_0x4cdb29){utils['error'](util[_0x83ad('0x2')](_0x83ad('0xc'),_0x2ca8c7[_0x83ad('0xa')]),_0x4cdb29);}};exports[_0x83ad('0x15')]=function(_0x3df28c){try{utils[_0x83ad('0xb')](util[_0x83ad('0x2')](_0x83ad('0x16'),_0x3df28c[_0x83ad('0xa')]),_0x3df28c);if(!_[_0x83ad('0x17')](_0x3df28c[_0x83ad('0x18')][_0x83ad('0x19')])){utils[_0x83ad('0xd')](util[_0x83ad('0x2')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x3df28c[_0x83ad('0xa')],_0x3df28c[_0x83ad('0x1a')]));dials[_0x3df28c['uniqueid']]={'routeId':_0x3df28c[_0x83ad('0x1a')]};}}catch(_0x268034){utils['error'](util['format'](_0x83ad('0x16'),_0x3df28c['uniqueid']),_0x268034);}};exports[_0x83ad('0x1b')]=function(_0x2f461d){try{if(!_[_0x83ad('0x17')](dials[_0x2f461d[_0x83ad('0xa')]])){utils[_0x83ad('0xb')](util[_0x83ad('0x2')](_0x83ad('0x1c'),_0x2f461d[_0x83ad('0xa')]),_0x2f461d);dials[_0x2f461d[_0x83ad('0xa')]]=_[_0x83ad('0x1d')](dials[_0x2f461d[_0x83ad('0xa')]],_0x2f461d);dials[_0x2f461d[_0x83ad('0xa')]]['starttime']=utils[_0x83ad('0x1e')]();dials[_0x2f461d[_0x83ad('0xa')]][_0x83ad('0x1f')]=_0x83ad('0x20');utils[_0x83ad('0xd')](util[_0x83ad('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x2f461d['uniqueid'],dials[_0x2f461d[_0x83ad('0xa')]][_0x83ad('0x21')]));}}catch(_0x20f7a5){utils[_0x83ad('0x22')](util['format']('[%s][dials][dialbegin]',_0x2f461d['uniqueid']),_0x20f7a5);}};exports['dialend']=function(_0x12e8ca){try{if(!_['isNil'](dials[_0x12e8ca[_0x83ad('0xa')]])){utils[_0x83ad('0xb')](util[_0x83ad('0x2')](_0x83ad('0x23'),_0x12e8ca[_0x83ad('0xa')]),_0x12e8ca);dials[_0x12e8ca[_0x83ad('0xa')]][_0x83ad('0x7')]=_0x12e8ca['dialstatus'];if(_0x12e8ca[_0x83ad('0x7')]=='ANSWER'){dials[_0x12e8ca['uniqueid']]=_[_0x83ad('0x1d')](dials[_0x12e8ca['uniqueid']],_0x12e8ca);dials[_0x12e8ca[_0x83ad('0xa')]][_0x83ad('0x24')]=utils['now']();dials[_0x12e8ca[_0x83ad('0xa')]][_0x83ad('0x1f')]=_0x83ad('0x25');utils[_0x83ad('0xd')](util[_0x83ad('0x2')](_0x83ad('0x26'),_0x12e8ca[_0x83ad('0xa')],_0x12e8ca[_0x83ad('0x7')],dials[_0x12e8ca['uniqueid']][_0x83ad('0x24')]));}else{utils[_0x83ad('0xd')](util['format'](_0x83ad('0x27'),_0x12e8ca[_0x83ad('0xa')],_0x12e8ca[_0x83ad('0x7')]));}}}catch(_0x537198){utils[_0x83ad('0x22')](util[_0x83ad('0x2')](_0x83ad('0x23'),_0x12e8ca[_0x83ad('0xa')]),_0x537198);}};exports[_0x83ad('0x28')]=function(_0x1bd9b7){try{if(!_['isNil'](dials[_0x1bd9b7['uniqueid']])){utils[_0x83ad('0xb')](util[_0x83ad('0x2')](_0x83ad('0x29'),_0x1bd9b7['uniqueid']),_0x1bd9b7);utils[_0x83ad('0xd')](util[_0x83ad('0x2')](_0x83ad('0x2a'),_0x1bd9b7[_0x83ad('0xa')],_0x1bd9b7[_0x83ad('0x2b')],_0x1bd9b7[_0x83ad('0x2c')],_0x1bd9b7[_0x83ad('0x2d')]));dials[_0x1bd9b7[_0x83ad('0xa')]]=_[_0x83ad('0x1d')](dials[_0x1bd9b7['uniqueid']],{'endtime':utils[_0x83ad('0x1e')](),'lastevent':_0x83ad('0x2e')});dials[_0x1bd9b7[_0x83ad('0xa')]][_0x83ad('0x2f')]=utils['diffTime'](dials[_0x1bd9b7[_0x83ad('0xa')]][_0x83ad('0x30')],dials[_0x1bd9b7[_0x83ad('0xa')]][_0x83ad('0x21')]);dials[_0x1bd9b7[_0x83ad('0xa')]][_0x83ad('0x31')]=utils[_0x83ad('0x32')](dials[_0x1bd9b7[_0x83ad('0xa')]][_0x83ad('0x24')]||dials[_0x1bd9b7['uniqueid']]['endtime'],dials[_0x1bd9b7['uniqueid']][_0x83ad('0x21')]);dials[_0x1bd9b7[_0x83ad('0xa')]]['billableseconds']=dials[_0x1bd9b7['uniqueid']][_0x83ad('0x24')]?utils[_0x83ad('0x32')](dials[_0x1bd9b7['uniqueid']][_0x83ad('0x30')],dials[_0x1bd9b7[_0x83ad('0xa')]]['answertime']):0x0;writeDB(dials[_0x1bd9b7[_0x83ad('0xa')]]);}}catch(_0x61f665){utils[_0x83ad('0x22')](util[_0x83ad('0x2')](_0x83ad('0x29'),_0x1bd9b7['uniqueid']),_0x61f665);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index d0a4aa6..e38b037 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 _0x5b3c=['close','managerevent','debug','format','[%s][index][devicestatechange]','device','devicestatechange','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','port','asterisk','username','password','keepConnected','xdr','disabled','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error'];(function(_0x497585,_0x1a9e78){var _0xceb720=function(_0x2eda06){while(--_0x2eda06){_0x497585['push'](_0x497585['shift']());}};_0xceb720(++_0x1a9e78);}(_0x5b3c,0xb3));var _0xc5b3=function(_0x34501b,_0x264e47){_0x34501b=_0x34501b-0x0;var _0xdcbacd=_0x5b3c[_0x34501b];return _0xdcbacd;};var AsteriskManager=require(_0xc5b3('0x0'));var config=require(_0xc5b3('0x1'));var utils=require(_0xc5b3('0x2'));var util=require(_0xc5b3('0x3'));var ami=new AsteriskManager(config['asterisk'][_0xc5b3('0x4')],config[_0xc5b3('0x5')]['ip'],config[_0xc5b3('0x5')][_0xc5b3('0x6')],config[_0xc5b3('0x5')][_0xc5b3('0x7')],!![]);ami[_0xc5b3('0x8')]();if(config[_0xc5b3('0x9')]&&config[_0xc5b3('0x9')][_0xc5b3('0xa')]){utils['info']('XDR\x20DISABLED');}else{var agents=require(_0xc5b3('0xb'));var calls=require(_0xc5b3('0xc'));var queues=require('./queues.controller');var recordings=require(_0xc5b3('0xd'));var members=require(_0xc5b3('0xe'));var dials=require(_0xc5b3('0xf'));var transfers=require(_0xc5b3('0x10'));var core=require(_0xc5b3('0x11'));ami['on']('connect',core[_0xc5b3('0x12')]);ami['on'](_0xc5b3('0x13'),core[_0xc5b3('0x13')]);ami['on']('fullybooted',core[_0xc5b3('0x14')]);ami['on']('error',core[_0xc5b3('0x15')]);ami['on'](_0xc5b3('0x16'),core[_0xc5b3('0x16')]);ami['on'](_0xc5b3('0x17'),core['managerevent']);ami['on']('devicestatechange',function(_0x31b7d5){try{utils[_0xc5b3('0x18')](util[_0xc5b3('0x19')](_0xc5b3('0x1a'),_0x31b7d5[_0xc5b3('0x1b')]),_0x31b7d5);members[_0xc5b3('0x1c')](_0x31b7d5);}catch(_0x29035e){utils[_0xc5b3('0x15')](util[_0xc5b3('0x19')]('[%s][index][devicestatechange]',_0x31b7d5[_0xc5b3('0x1b')]),_0x29035e);}});ami['on']('agentcalled',function(_0x2cd3a8){try{utils[_0xc5b3('0x18')](util[_0xc5b3('0x19')](_0xc5b3('0x1d'),_0x2cd3a8[_0xc5b3('0x1e')]),_0x2cd3a8);agents['agentcalled'](_0x2cd3a8);}catch(_0x28a6f1){utils[_0xc5b3('0x15')](util['format'](_0xc5b3('0x1d'),_0x2cd3a8['uniqueid']),_0x28a6f1);}});ami['on']('agentringnoanswer',function(_0x4361a5){try{utils['debug'](util[_0xc5b3('0x19')](_0xc5b3('0x1f'),_0x4361a5[_0xc5b3('0x1e')]),_0x4361a5);agents[_0xc5b3('0x20')](_0x4361a5);}catch(_0x4130a0){utils[_0xc5b3('0x15')](util[_0xc5b3('0x19')](_0xc5b3('0x1f'),_0x4361a5[_0xc5b3('0x1e')]),_0x4130a0);}});ami['on'](_0xc5b3('0x21'),function(_0x4ec369){try{utils[_0xc5b3('0x18')](util[_0xc5b3('0x19')](_0xc5b3('0x22'),_0x4ec369['uniqueid']),_0x4ec369);agents[_0xc5b3('0x21')](_0x4ec369);queues[_0xc5b3('0x21')](_0x4ec369);}catch(_0x3e3222){utils['error'](util['format'](_0xc5b3('0x22'),_0x4ec369[_0xc5b3('0x1e')]),_0x3e3222);}});ami['on'](_0xc5b3('0x23'),function(_0x4a7228){try{utils[_0xc5b3('0x18')](util['format']('[%s][index][agentcomplete]',_0x4a7228[_0xc5b3('0x1e')]),_0x4a7228);agents[_0xc5b3('0x23')](_0x4a7228);queues[_0xc5b3('0x23')](_0x4a7228);members[_0xc5b3('0x23')](_0x4a7228);}catch(_0x4c9691){utils[_0xc5b3('0x15')](util['format']('[%s][index][agentcomplete]',_0x4a7228['uniqueid']),_0x4c9691);}});ami['on']('queuecallerabandon',function(_0x50d89b){try{utils['debug'](util['format'](_0xc5b3('0x24'),_0x50d89b['uniqueid']),_0x50d89b);agents['queuecallerabandon'](_0x50d89b);queues[_0xc5b3('0x25')](_0x50d89b);}catch(_0x173140){utils[_0xc5b3('0x15')](util[_0xc5b3('0x19')](_0xc5b3('0x24'),_0x50d89b[_0xc5b3('0x1e')]),_0x173140);}});ami['on'](_0xc5b3('0x26'),function(_0x1438a9){try{utils['debug'](util[_0xc5b3('0x19')](_0xc5b3('0x27'),_0x1438a9[_0xc5b3('0x1e')]),_0x1438a9);queues[_0xc5b3('0x26')](_0x1438a9);recordings['queuecallerjoin'](_0x1438a9);}catch(_0x5f5989){utils['error'](util[_0xc5b3('0x19')](_0xc5b3('0x27'),_0x1438a9[_0xc5b3('0x1e')]),_0x5f5989);}});ami['on']('queuecallerleave',function(_0x2b336a){try{utils[_0xc5b3('0x18')](util[_0xc5b3('0x19')](_0xc5b3('0x28'),_0x2b336a['uniqueid']),_0x2b336a);queues[_0xc5b3('0x29')](_0x2b336a);}catch(_0x2e503f){utils[_0xc5b3('0x15')](util['format'](_0xc5b3('0x28'),_0x2b336a['uniqueid']),_0x2e503f);}});ami['on'](_0xc5b3('0x2a'),function(_0x371fd9){try{utils['debug'](util['format'](_0xc5b3('0x2b'),_0x371fd9[_0xc5b3('0x1e')]),_0x371fd9);queues['musiconholdstart'](_0x371fd9);calls['musiconholdstart'](_0x371fd9);}catch(_0x43238c){utils[_0xc5b3('0x15')](util[_0xc5b3('0x19')](_0xc5b3('0x2b'),_0x371fd9['uniqueid']),_0x43238c);}});ami['on'](_0xc5b3('0x2c'),function(_0x467d6e){try{utils[_0xc5b3('0x18')](util[_0xc5b3('0x19')]('[%s][index][musiconholdstop]',_0x467d6e[_0xc5b3('0x1e')]),_0x467d6e);queues[_0xc5b3('0x2c')](_0x467d6e);calls[_0xc5b3('0x2c')](_0x467d6e);}catch(_0x45d38f){utils[_0xc5b3('0x15')](util[_0xc5b3('0x19')](_0xc5b3('0x2d'),_0x467d6e[_0xc5b3('0x1e')]),_0x45d38f);}});ami['on']('newstate',function(_0x167329){try{utils['debug'](util[_0xc5b3('0x19')](_0xc5b3('0x2e'),_0x167329['uniqueid']),_0x167329);calls['newstate'](_0x167329);recordings[_0xc5b3('0x2f')](_0x167329);}catch(_0x1501bd){utils[_0xc5b3('0x15')](util['format'](_0xc5b3('0x2e'),_0x167329[_0xc5b3('0x1e')]),_0x1501bd);}});ami['on'](_0xc5b3('0x30'),function(_0x1e7d3c){try{utils[_0xc5b3('0x18')](util['format'](_0xc5b3('0x31'),_0x1e7d3c[_0xc5b3('0x1e')]),_0x1e7d3c);calls[_0xc5b3('0x30')](_0x1e7d3c);recordings['hangup'](_0x1e7d3c);dials['hangup'](_0x1e7d3c);agents[_0xc5b3('0x30')](_0x1e7d3c);queues['hangup'](_0x1e7d3c);}catch(_0x545dd2){utils[_0xc5b3('0x15')](util['format']('[%s][index][hangup]',_0x1e7d3c[_0xc5b3('0x1e')]),_0x545dd2);}});ami['on']('cdr',function(_0x35cbd9){try{utils[_0xc5b3('0x18')](util[_0xc5b3('0x19')]('[%s][index][cdr]',_0x35cbd9[_0xc5b3('0x1e')]),_0x35cbd9);members[_0xc5b3('0x32')](_0x35cbd9);}catch(_0x4d6b50){utils['error'](util[_0xc5b3('0x19')]('[%s][index][cdr]',_0x35cbd9[_0xc5b3('0x1e')]),_0x4d6b50);}});ami['on'](_0xc5b3('0x33'),function(_0x35b4a3){try{utils[_0xc5b3('0x18')](util[_0xc5b3('0x19')](_0xc5b3('0x34'),_0x35b4a3[_0xc5b3('0x1e')]),_0x35b4a3);queues[_0xc5b3('0x33')](_0x35b4a3);agents['blindtransfer'](_0x35b4a3);transfers[_0xc5b3('0x33')](_0x35b4a3);}catch(_0x3a771b){utils['error'](util[_0xc5b3('0x19')]('[%s][index][blindtransfer]',_0x35b4a3['uniqueid']),_0x3a771b);}});ami['on'](_0xc5b3('0x35'),function(_0x2e7400){try{utils[_0xc5b3('0x18')](util['format']('[%s][index][attendedtransfer]',_0x2e7400['origtransfereruniqueid']),_0x2e7400);queues[_0xc5b3('0x35')](_0x2e7400);transfers['attendedtransfer'](_0x2e7400);agents[_0xc5b3('0x35')](_0x2e7400);calls['attendedtransfer'](_0x2e7400);}catch(_0x81b15f){utils[_0xc5b3('0x15')](util[_0xc5b3('0x19')](_0xc5b3('0x36'),_0x2e7400[_0xc5b3('0x37')]),_0x81b15f);}});ami['on'](_0xc5b3('0x38'),function(_0x34e8a0){try{utils[_0xc5b3('0x18')](util['format'](_0xc5b3('0x39'),_0x34e8a0[_0xc5b3('0x1e')]),_0x34e8a0);queues[_0xc5b3('0x38')](_0x34e8a0);recordings['varset'](_0x34e8a0);calls[_0xc5b3('0x38')](_0x34e8a0);dials['varset'](_0x34e8a0);}catch(_0x3b37ae){utils[_0xc5b3('0x15')](util['format'](_0xc5b3('0x39'),_0x34e8a0['uniqueid']),_0x3b37ae);}});ami['on'](_0xc5b3('0x3a'),function(_0xb2ac20){try{utils[_0xc5b3('0x18')](util[_0xc5b3('0x19')](_0xc5b3('0x3b'),_0xb2ac20['uniqueid']),_0xb2ac20);calls['newexten'](_0xb2ac20);recordings[_0xc5b3('0x3a')](_0xb2ac20);dials[_0xc5b3('0x3a')](_0xb2ac20);}catch(_0xa99d06){utils['error'](util[_0xc5b3('0x19')]('[%s][index][newexten]',_0xb2ac20['uniqueid']),_0xa99d06);}});ami['on']('newchannel',function(_0x4bebfd){try{utils['debug'](util[_0xc5b3('0x19')](_0xc5b3('0x3c'),_0x4bebfd[_0xc5b3('0x1e')]),_0x4bebfd);calls['newchannel'](_0x4bebfd);recordings[_0xc5b3('0x3d')](_0x4bebfd);}catch(_0x514837){utils[_0xc5b3('0x15')](util[_0xc5b3('0x19')](_0xc5b3('0x3c'),_0x4bebfd[_0xc5b3('0x1e')]),_0x514837);}});ami['on'](_0xc5b3('0x3e'),function(_0x568082){try{utils[_0xc5b3('0x18')](util[_0xc5b3('0x19')](_0xc5b3('0x3f'),_0x568082[_0xc5b3('0x1e')]),_0x568082);dials[_0xc5b3('0x3e')](_0x568082);}catch(_0x3dedc6){utils['error'](util[_0xc5b3('0x19')](_0xc5b3('0x40'),_0x568082['uniqueid']),_0x3dedc6);}});ami['on'](_0xc5b3('0x41'),function(_0xa717f7){try{utils[_0xc5b3('0x18')](util['format']('[%s][index][dialend]',_0xa717f7[_0xc5b3('0x1e')]),_0xa717f7);dials[_0xc5b3('0x41')](_0xa717f7);}catch(_0x550a43){utils[_0xc5b3('0x15')](util['format'](_0xc5b3('0x42'),_0xa717f7[_0xc5b3('0x1e')]),_0x550a43);}});} \ No newline at end of file +var _0x02b9=['[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device'];(function(_0x8cc412,_0x2af12a){var _0x50356a=function(_0x4d3c8e){while(--_0x4d3c8e){_0x8cc412['push'](_0x8cc412['shift']());}};_0x50356a(++_0x2af12a);}(_0x02b9,0x132));var _0x902b=function(_0x20877e,_0x3f5e7d){_0x20877e=_0x20877e-0x0;var _0x3cbc09=_0x02b9[_0x20877e];return _0x3cbc09;};var AsteriskManager=require(_0x902b('0x0'));var config=require(_0x902b('0x1'));var utils=require('./utils');var util=require(_0x902b('0x2'));var ami=new AsteriskManager(config[_0x902b('0x3')][_0x902b('0x4')],config['asterisk']['ip'],config[_0x902b('0x3')][_0x902b('0x5')],config[_0x902b('0x3')][_0x902b('0x6')],!![]);ami[_0x902b('0x7')]();if(config[_0x902b('0x8')]&&config[_0x902b('0x8')][_0x902b('0x9')]){utils[_0x902b('0xa')](_0x902b('0xb'));}else{var agents=require(_0x902b('0xc'));var calls=require(_0x902b('0xd'));var queues=require(_0x902b('0xe'));var recordings=require(_0x902b('0xf'));var members=require(_0x902b('0x10'));var dials=require('./dials.controller');var transfers=require(_0x902b('0x11'));var core=require('./core.controller');ami['on']('connect',core[_0x902b('0x12')]);ami['on'](_0x902b('0x13'),core[_0x902b('0x13')]);ami['on'](_0x902b('0x14'),core[_0x902b('0x14')]);ami['on'](_0x902b('0x15'),core[_0x902b('0x15')]);ami['on'](_0x902b('0x16'),core[_0x902b('0x16')]);ami['on'](_0x902b('0x17'),core[_0x902b('0x17')]);ami['on'](_0x902b('0x18'),function(_0x2feb79){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')](_0x902b('0x1b'),_0x2feb79['device']),_0x2feb79);members['devicestatechange'](_0x2feb79);}catch(_0x26efe5){utils[_0x902b('0x15')](util[_0x902b('0x1a')](_0x902b('0x1b'),_0x2feb79[_0x902b('0x1c')]),_0x26efe5);}});ami['on']('agentcalled',function(_0xe06974){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')](_0x902b('0x1d'),_0xe06974[_0x902b('0x1e')]),_0xe06974);agents['agentcalled'](_0xe06974);}catch(_0x1655ed){utils[_0x902b('0x15')](util[_0x902b('0x1a')](_0x902b('0x1d'),_0xe06974[_0x902b('0x1e')]),_0x1655ed);}});ami['on'](_0x902b('0x1f'),function(_0x1efd2a){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')]('[%s][index][agentringnoanswer]',_0x1efd2a['uniqueid']),_0x1efd2a);agents[_0x902b('0x1f')](_0x1efd2a);}catch(_0x7bff34){utils[_0x902b('0x15')](util[_0x902b('0x1a')](_0x902b('0x20'),_0x1efd2a[_0x902b('0x1e')]),_0x7bff34);}});ami['on'](_0x902b('0x21'),function(_0x3ce6d2){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')]('[%s][index][agentconnect]',_0x3ce6d2[_0x902b('0x1e')]),_0x3ce6d2);agents[_0x902b('0x21')](_0x3ce6d2);queues[_0x902b('0x21')](_0x3ce6d2);}catch(_0x3a7c4e){utils['error'](util[_0x902b('0x1a')](_0x902b('0x22'),_0x3ce6d2[_0x902b('0x1e')]),_0x3a7c4e);}});ami['on'](_0x902b('0x23'),function(_0x3dbdf6){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')](_0x902b('0x24'),_0x3dbdf6[_0x902b('0x1e')]),_0x3dbdf6);agents[_0x902b('0x23')](_0x3dbdf6);queues['agentcomplete'](_0x3dbdf6);members[_0x902b('0x23')](_0x3dbdf6);}catch(_0x584d80){utils[_0x902b('0x15')](util[_0x902b('0x1a')](_0x902b('0x24'),_0x3dbdf6[_0x902b('0x1e')]),_0x584d80);}});ami['on'](_0x902b('0x25'),function(_0x25edc0){try{utils['debug'](util[_0x902b('0x1a')](_0x902b('0x26'),_0x25edc0[_0x902b('0x1e')]),_0x25edc0);agents[_0x902b('0x25')](_0x25edc0);queues['queuecallerabandon'](_0x25edc0);}catch(_0x105a46){utils[_0x902b('0x15')](util[_0x902b('0x1a')](_0x902b('0x26'),_0x25edc0['uniqueid']),_0x105a46);}});ami['on'](_0x902b('0x27'),function(_0x549a0d){try{utils[_0x902b('0x19')](util['format']('[%s][index][queuecallerjoin]',_0x549a0d[_0x902b('0x1e')]),_0x549a0d);queues[_0x902b('0x27')](_0x549a0d);recordings[_0x902b('0x27')](_0x549a0d);}catch(_0x4db964){utils['error'](util[_0x902b('0x1a')](_0x902b('0x28'),_0x549a0d[_0x902b('0x1e')]),_0x4db964);}});ami['on'](_0x902b('0x29'),function(_0x2ab2c4){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')](_0x902b('0x2a'),_0x2ab2c4[_0x902b('0x1e')]),_0x2ab2c4);queues[_0x902b('0x29')](_0x2ab2c4);}catch(_0x475f4a){utils[_0x902b('0x15')](util[_0x902b('0x1a')](_0x902b('0x2a'),_0x2ab2c4['uniqueid']),_0x475f4a);}});ami['on']('musiconholdstart',function(_0x255182){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')]('[%s][index][musiconholdstart]',_0x255182['uniqueid']),_0x255182);queues[_0x902b('0x2b')](_0x255182);calls[_0x902b('0x2b')](_0x255182);}catch(_0x317464){utils['error'](util[_0x902b('0x1a')](_0x902b('0x2c'),_0x255182['uniqueid']),_0x317464);}});ami['on']('musiconholdstop',function(_0x52ff52){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')](_0x902b('0x2d'),_0x52ff52[_0x902b('0x1e')]),_0x52ff52);queues[_0x902b('0x2e')](_0x52ff52);calls['musiconholdstop'](_0x52ff52);}catch(_0x329068){utils[_0x902b('0x15')](util[_0x902b('0x1a')]('[%s][index][musiconholdstop]',_0x52ff52[_0x902b('0x1e')]),_0x329068);}});ami['on'](_0x902b('0x2f'),function(_0x795015){try{utils['debug'](util[_0x902b('0x1a')](_0x902b('0x30'),_0x795015['uniqueid']),_0x795015);calls[_0x902b('0x2f')](_0x795015);recordings['newstate'](_0x795015);}catch(_0x1e2c37){utils[_0x902b('0x15')](util[_0x902b('0x1a')]('[%s][index][newstate]',_0x795015[_0x902b('0x1e')]),_0x1e2c37);}});ami['on'](_0x902b('0x31'),function(_0x10c8b4){try{utils[_0x902b('0x19')](util['format'](_0x902b('0x32'),_0x10c8b4[_0x902b('0x1e')]),_0x10c8b4);calls['hangup'](_0x10c8b4);recordings[_0x902b('0x31')](_0x10c8b4);dials[_0x902b('0x31')](_0x10c8b4);agents[_0x902b('0x31')](_0x10c8b4);queues[_0x902b('0x31')](_0x10c8b4);}catch(_0x1fbe6b){utils[_0x902b('0x15')](util[_0x902b('0x1a')](_0x902b('0x32'),_0x10c8b4[_0x902b('0x1e')]),_0x1fbe6b);}});ami['on'](_0x902b('0x33'),function(_0x9e64d){try{utils[_0x902b('0x19')](util['format'](_0x902b('0x34'),_0x9e64d[_0x902b('0x1e')]),_0x9e64d);members[_0x902b('0x33')](_0x9e64d);}catch(_0x5a4640){utils[_0x902b('0x15')](util['format'](_0x902b('0x34'),_0x9e64d[_0x902b('0x1e')]),_0x5a4640);}});ami['on'](_0x902b('0x35'),function(_0x4b93b5){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')]('[%s][index][blindtransfer]',_0x4b93b5['uniqueid']),_0x4b93b5);queues[_0x902b('0x35')](_0x4b93b5);agents[_0x902b('0x35')](_0x4b93b5);transfers[_0x902b('0x35')](_0x4b93b5);}catch(_0x3200d3){utils['error'](util[_0x902b('0x1a')](_0x902b('0x36'),_0x4b93b5[_0x902b('0x1e')]),_0x3200d3);}});ami['on']('attendedtransfer',function(_0x309363){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')]('[%s][index][attendedtransfer]',_0x309363[_0x902b('0x37')]),_0x309363);queues['attendedtransfer'](_0x309363);transfers[_0x902b('0x38')](_0x309363);agents[_0x902b('0x38')](_0x309363);calls[_0x902b('0x38')](_0x309363);}catch(_0xe40049){utils[_0x902b('0x15')](util[_0x902b('0x1a')](_0x902b('0x39'),_0x309363[_0x902b('0x37')]),_0xe40049);}});ami['on'](_0x902b('0x3a'),function(_0xb5b2a9){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')](_0x902b('0x3b'),_0xb5b2a9[_0x902b('0x1e')]),_0xb5b2a9);queues[_0x902b('0x3a')](_0xb5b2a9);recordings['varset'](_0xb5b2a9);calls[_0x902b('0x3a')](_0xb5b2a9);dials[_0x902b('0x3a')](_0xb5b2a9);}catch(_0x94acf9){utils['error'](util[_0x902b('0x1a')]('[%s][index][varset]',_0xb5b2a9[_0x902b('0x1e')]),_0x94acf9);}});ami['on'](_0x902b('0x3c'),function(_0x222956){try{utils['debug'](util[_0x902b('0x1a')](_0x902b('0x3d'),_0x222956[_0x902b('0x1e')]),_0x222956);calls[_0x902b('0x3c')](_0x222956);recordings[_0x902b('0x3c')](_0x222956);dials[_0x902b('0x3c')](_0x222956);}catch(_0x4412f0){utils['error'](util[_0x902b('0x1a')](_0x902b('0x3d'),_0x222956[_0x902b('0x1e')]),_0x4412f0);}});ami['on'](_0x902b('0x3e'),function(_0x2bf9da){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')]('[%s][index][newchannel]',_0x2bf9da['uniqueid']),_0x2bf9da);calls[_0x902b('0x3e')](_0x2bf9da);recordings[_0x902b('0x3e')](_0x2bf9da);}catch(_0x566bb5){utils[_0x902b('0x15')](util['format'](_0x902b('0x3f'),_0x2bf9da[_0x902b('0x1e')]),_0x566bb5);}});ami['on']('dialbegin',function(_0x583b33){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')]('[%s][index][dialbegin]',_0x583b33[_0x902b('0x1e')]),_0x583b33);dials['dialbegin'](_0x583b33);}catch(_0xecc9e0){utils[_0x902b('0x15')](util[_0x902b('0x1a')](_0x902b('0x40'),_0x583b33[_0x902b('0x1e')]),_0xecc9e0);}});ami['on'](_0x902b('0x41'),function(_0x3d33cd){try{utils[_0x902b('0x19')](util[_0x902b('0x1a')](_0x902b('0x42'),_0x3d33cd[_0x902b('0x1e')]),_0x3d33cd);dials[_0x902b('0x41')](_0x3d33cd);}catch(_0x10e4a7){utils[_0x902b('0x15')](util[_0x902b('0x1a')]('[%s][index][dialend]',_0x3d33cd[_0x902b('0x1e')]),_0x10e4a7);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 82f37c1..989d0de 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 _0x7a28=['queue','assign','cdr','[%s][members][cdr]','data1','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','source','util','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','device','state','INUSE','BUSY','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s'];(function(_0x144c3c,_0x1db542){var _0x3c5807=function(_0x1e9b77){while(--_0x1e9b77){_0x144c3c['push'](_0x144c3c['shift']());}};_0x3c5807(++_0x1db542);}(_0x7a28,0x176));var _0x87a2=function(_0x33361c,_0x114b20){_0x33361c=_0x33361c-0x0;var _0x2dd47f=_0x7a28[_0x33361c];return _0x2dd47f;};'use strict';var _=require('lodash');var util=require(_0x87a2('0x0'));var utils=require('./utils');var members={};var exclude=[_0x87a2('0x1'),'Queue:'];function writeDB(_0x27a0df){utils[_0x87a2('0x2')](util[_0x87a2('0x3')](_0x87a2('0x4'),_0x27a0df[_0x87a2('0x5')],_0x27a0df[_0x87a2('0x6')],_0x27a0df[_0x87a2('0x7')],_0x27a0df[_0x87a2('0x8')],_0x27a0df[_0x87a2('0x9')],_0x27a0df[_0x87a2('0xa')]));if(_0x27a0df[_0x87a2('0x6')]){utils[_0x87a2('0xb')](_0x27a0df[_0x87a2('0x6')])[_0x87a2('0xc')](function(_0x972043){if(_0x972043){_0x27a0df[_0x87a2('0x9')]=_0x972043[_0x87a2('0xd')];_0x27a0df[_0x87a2('0xe')]=_0x972043[_0x87a2('0xe')];utils[_0x87a2('0xf')](_0x87a2('0x10'),_0x27a0df);}else{utils[_0x87a2('0x11')](_0x27a0df[_0x87a2('0x6')][_0x87a2('0x12')]('/')[0x1])[_0x87a2('0xc')](function(_0x59b137){if(_0x59b137){_0x27a0df['membername']=_0x59b137[_0x87a2('0xd')];_0x27a0df['internal']=_0x59b137[_0x87a2('0xe')];utils[_0x87a2('0xf')](_0x87a2('0x10'),_0x27a0df);}});}})[_0x87a2('0x13')](function(_0x174a52){utils[_0x87a2('0x14')](util[_0x87a2('0x3')](_0x87a2('0x15'),_0x27a0df[_0x87a2('0x5')]),_0x174a52);});}delete members[_0x27a0df[_0x87a2('0x6')]];}function startsWith(_0x13ff64,_0x47e579){return _[_0x87a2('0x16')](_0x13ff64,function(_0x466692){return _[_0x87a2('0x17')](_0x47e579,_0x466692);});}exports[_0x87a2('0x18')]=function(_0x883da7){try{utils['debug'](util['format']('[%s][members][devicestatechange]',members[_0x883da7['device']]?members[_0x883da7[_0x87a2('0x19')]][_0x87a2('0x5')]:_0x883da7[_0x87a2('0x19')]),_0x883da7);utils[_0x87a2('0x2')](util[_0x87a2('0x3')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x883da7[_0x87a2('0x19')]]?members[_0x883da7['device']]['uniqueid']:_0x883da7['device'],_0x883da7[_0x87a2('0x1a')],_0x883da7['device']));switch(_0x883da7['state']){case _0x87a2('0x1b'):case _0x87a2('0x1c'):if(!startsWith(exclude,_0x883da7[_0x87a2('0x19')])){members[_0x883da7['device']]={'channel':'voice','interface':_0x883da7[_0x87a2('0x19')],'type':_0x87a2('0x1d'),'enterAt':utils[_0x87a2('0x1e')](),'role':_0x87a2('0x1f')};}break;case _0x87a2('0x20'):if(!_[_0x87a2('0x21')](members[_0x883da7[_0x87a2('0x19')]])){members[_0x883da7[_0x87a2('0x19')]][_0x87a2('0x22')]=utils[_0x87a2('0x1e')]();members[_0x883da7[_0x87a2('0x19')]][_0x87a2('0x23')]=utils[_0x87a2('0x24')](members[_0x883da7[_0x87a2('0x19')]][_0x87a2('0x22')],members[_0x883da7[_0x87a2('0x19')]][_0x87a2('0x25')]);if(members[_0x883da7[_0x87a2('0x19')]][_0x87a2('0x5')]){writeDB(members[_0x883da7[_0x87a2('0x19')]]);}}break;default:break;}}catch(_0x31e62c){utils[_0x87a2('0x14')](util[_0x87a2('0x3')](_0x87a2('0x26'),members[_0x883da7['device']]?members[_0x883da7['device']][_0x87a2('0x5')]:_0x883da7[_0x87a2('0x19')]),_0x31e62c);}};exports[_0x87a2('0x27')]=function(_0x19f477){try{if(!_[_0x87a2('0x21')](members[_0x19f477[_0x87a2('0x6')]])){utils['debug'](util[_0x87a2('0x3')](_0x87a2('0x28'),_0x19f477['uniqueid']),_0x19f477);utils[_0x87a2('0x2')](util[_0x87a2('0x3')](_0x87a2('0x29'),_0x19f477[_0x87a2('0x5')],_0x19f477[_0x87a2('0x6')],_0x19f477[_0x87a2('0x2a')]));members[_0x19f477['interface']]=_[_0x87a2('0x2b')](members[_0x19f477['interface']],{'data4':_0x19f477[_0x87a2('0x2a')],'uniqueid':_0x19f477['uniqueid']});}}catch(_0x2d3f52){utils['error'](util['format'](_0x87a2('0x28'),_0x19f477[_0x87a2('0x5')]),_0x2d3f52);}};exports[_0x87a2('0x2c')]=function(_0x206f5e){try{utils['debug'](util['format'](_0x87a2('0x2d'),_0x206f5e[_0x87a2('0x5')]),_0x206f5e);if(_0x206f5e[_0x87a2('0x7')]){var _0x4ba77c=_0x206f5e[_0x87a2('0x7')]['split']('-')[0x0];if(!_[_0x87a2('0x21')](members[_0x4ba77c])){members[_0x4ba77c]=_[_0x87a2('0x2b')](members[_0x4ba77c],{'data1':members[_0x4ba77c][_0x87a2('0x2e')]||_0x206f5e[_0x87a2('0xa')],'data2':members[_0x4ba77c][_0x87a2('0x8')]||_0x206f5e['source'],'data3':members[_0x4ba77c][_0x87a2('0x2f')]||_0x206f5e[_0x87a2('0x30')],'uniqueid':members[_0x4ba77c]['uniqueid']||_0x206f5e['uniqueid']});utils[_0x87a2('0x2')](util[_0x87a2('0x3')](_0x87a2('0x31'),_0x206f5e['uniqueid'],members[_0x4ba77c][_0x87a2('0x2e')],members[_0x4ba77c]['data2'],members[_0x4ba77c]['data3']));if(members[_0x4ba77c]['exitAt']){writeDB(members[_0x4ba77c]);}}}if(_0x206f5e[_0x87a2('0x32')]){var _0x57633a=_0x206f5e[_0x87a2('0x32')]['split']('-')[0x0];if(!_[_0x87a2('0x21')](members[_0x57633a])){members[_0x57633a]=_['assign'](members[_0x57633a],{'data1':members[_0x57633a][_0x87a2('0x2e')]||_0x206f5e[_0x87a2('0xa')],'data2':members[_0x57633a][_0x87a2('0x8')]||_0x206f5e[_0x87a2('0x33')],'data3':members[_0x57633a][_0x87a2('0x2f')]||_0x206f5e[_0x87a2('0x30')],'uniqueid':members[_0x57633a][_0x87a2('0x5')]||_0x206f5e[_0x87a2('0x5')]});utils[_0x87a2('0x2')](util['format'](_0x87a2('0x31'),_0x206f5e[_0x87a2('0x5')],members[_0x57633a][_0x87a2('0x2e')],members[_0x57633a]['data2'],members[_0x57633a]['data3']));if(members[_0x57633a][_0x87a2('0x22')]){writeDB(members[_0x57633a]);}}}}catch(_0x260faf){utils[_0x87a2('0x14')](util[_0x87a2('0x3')](_0x87a2('0x2d'),_0x206f5e[_0x87a2('0x5')]),_0x260faf);}}; \ No newline at end of file +var _0xcba7=['interface','channel','data2','membername','type','getUserByInterface','name','request','CreateMemberReport','getUserByName','then','internal','catch','error','some','startsWith','devicestatechange','debug','device','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','[%s][members][agentcomplete]','[%s][members][cdr]','split','assign','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','info','format','uniqueid'];(function(_0x4a2e6c,_0x5322a5){var _0x127498=function(_0x1cdc82){while(--_0x1cdc82){_0x4a2e6c['push'](_0x4a2e6c['shift']());}};_0x127498(++_0x5322a5);}(_0xcba7,0x199));var _0x7cba=function(_0x1792ae,_0x3738a3){_0x1792ae=_0x1792ae-0x0;var _0x379871=_0xcba7[_0x1792ae];return _0x379871;};'use strict';var _=require(_0x7cba('0x0'));var util=require(_0x7cba('0x1'));var utils=require(_0x7cba('0x2'));var members={};var exclude=[_0x7cba('0x3'),'Queue:'];function writeDB(_0x119b7f){utils[_0x7cba('0x4')](util[_0x7cba('0x5')]('[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s',_0x119b7f[_0x7cba('0x6')],_0x119b7f[_0x7cba('0x7')],_0x119b7f[_0x7cba('0x8')],_0x119b7f[_0x7cba('0x9')],_0x119b7f[_0x7cba('0xa')],_0x119b7f[_0x7cba('0xb')]));if(_0x119b7f[_0x7cba('0x7')]){utils[_0x7cba('0xc')](_0x119b7f[_0x7cba('0x7')])['then'](function(_0x2d9628){if(_0x2d9628){_0x119b7f[_0x7cba('0xa')]=_0x2d9628[_0x7cba('0xd')];_0x119b7f['internal']=_0x2d9628['internal'];utils[_0x7cba('0xe')](_0x7cba('0xf'),_0x119b7f);}else{utils[_0x7cba('0x10')](_0x119b7f[_0x7cba('0x7')]['split']('/')[0x1])[_0x7cba('0x11')](function(_0x145ecc){if(_0x145ecc){_0x119b7f[_0x7cba('0xa')]=_0x145ecc[_0x7cba('0xd')];_0x119b7f[_0x7cba('0x12')]=_0x145ecc[_0x7cba('0x12')];utils[_0x7cba('0xe')](_0x7cba('0xf'),_0x119b7f);}});}})[_0x7cba('0x13')](function(_0x406553){utils[_0x7cba('0x14')](util[_0x7cba('0x5')]('[%s][members][writeDB]',_0x119b7f['uniqueid']),_0x406553);});}delete members[_0x119b7f[_0x7cba('0x7')]];}function startsWith(_0xbf5ce8,_0x39585b){return _[_0x7cba('0x15')](_0xbf5ce8,function(_0x38b935){return _[_0x7cba('0x16')](_0x39585b,_0x38b935);});}exports[_0x7cba('0x17')]=function(_0x40c869){try{utils[_0x7cba('0x18')](util[_0x7cba('0x5')]('[%s][members][devicestatechange]',members[_0x40c869[_0x7cba('0x19')]]?members[_0x40c869['device']]['uniqueid']:_0x40c869[_0x7cba('0x19')]),_0x40c869);utils[_0x7cba('0x4')](util[_0x7cba('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x40c869[_0x7cba('0x19')]]?members[_0x40c869['device']][_0x7cba('0x6')]:_0x40c869['device'],_0x40c869['state'],_0x40c869[_0x7cba('0x19')]));switch(_0x40c869[_0x7cba('0x1a')]){case _0x7cba('0x1b'):case _0x7cba('0x1c'):if(!startsWith(exclude,_0x40c869[_0x7cba('0x19')])){members[_0x40c869['device']]={'channel':_0x7cba('0x1d'),'interface':_0x40c869['device'],'type':_0x7cba('0x1e'),'enterAt':utils[_0x7cba('0x1f')](),'role':_0x7cba('0x20')};}break;case _0x7cba('0x21'):if(!_[_0x7cba('0x22')](members[_0x40c869[_0x7cba('0x19')]])){members[_0x40c869[_0x7cba('0x19')]][_0x7cba('0x23')]=utils[_0x7cba('0x1f')]();members[_0x40c869['device']]['duration']=utils[_0x7cba('0x24')](members[_0x40c869['device']][_0x7cba('0x23')],members[_0x40c869[_0x7cba('0x19')]][_0x7cba('0x25')]);if(members[_0x40c869[_0x7cba('0x19')]][_0x7cba('0x6')]){writeDB(members[_0x40c869['device']]);}}break;default:break;}}catch(_0x35a10b){utils['error'](util['format'](_0x7cba('0x26'),members[_0x40c869[_0x7cba('0x19')]]?members[_0x40c869[_0x7cba('0x19')]][_0x7cba('0x6')]:_0x40c869[_0x7cba('0x19')]),_0x35a10b);}};exports[_0x7cba('0x27')]=function(_0x296196){try{if(!_[_0x7cba('0x22')](members[_0x296196[_0x7cba('0x7')]])){utils['debug'](util[_0x7cba('0x5')]('[%s][members][agentcomplete]',_0x296196[_0x7cba('0x6')]),_0x296196);utils[_0x7cba('0x4')](util[_0x7cba('0x5')](_0x7cba('0x28'),_0x296196[_0x7cba('0x6')],_0x296196[_0x7cba('0x7')],_0x296196[_0x7cba('0x29')]));members[_0x296196[_0x7cba('0x7')]]=_['assign'](members[_0x296196[_0x7cba('0x7')]],{'data4':_0x296196['queue'],'uniqueid':_0x296196[_0x7cba('0x6')]});}}catch(_0x13fdbd){utils[_0x7cba('0x14')](util[_0x7cba('0x5')](_0x7cba('0x2a'),_0x296196[_0x7cba('0x6')]),_0x13fdbd);}};exports['cdr']=function(_0x52866e){try{utils[_0x7cba('0x18')](util[_0x7cba('0x5')](_0x7cba('0x2b'),_0x52866e['uniqueid']),_0x52866e);if(_0x52866e['channel']){var _0x15da45=_0x52866e['channel'][_0x7cba('0x2c')]('-')[0x0];if(!_[_0x7cba('0x22')](members[_0x15da45])){members[_0x15da45]=_[_0x7cba('0x2d')](members[_0x15da45],{'data1':members[_0x15da45][_0x7cba('0x2e')]||_0x52866e[_0x7cba('0xb')],'data2':members[_0x15da45]['data2']||_0x52866e[_0x7cba('0x2f')],'data3':members[_0x15da45][_0x7cba('0x30')]||_0x52866e[_0x7cba('0x31')],'uniqueid':members[_0x15da45]['uniqueid']||_0x52866e['uniqueid']});utils[_0x7cba('0x4')](util['format'](_0x7cba('0x32'),_0x52866e[_0x7cba('0x6')],members[_0x15da45]['data1'],members[_0x15da45][_0x7cba('0x9')],members[_0x15da45][_0x7cba('0x30')]));if(members[_0x15da45][_0x7cba('0x23')]){writeDB(members[_0x15da45]);}}}if(_0x52866e[_0x7cba('0x33')]){var _0x45b688=_0x52866e[_0x7cba('0x33')][_0x7cba('0x2c')]('-')[0x0];if(!_[_0x7cba('0x22')](members[_0x45b688])){members[_0x45b688]=_['assign'](members[_0x45b688],{'data1':members[_0x45b688][_0x7cba('0x2e')]||_0x52866e[_0x7cba('0xb')],'data2':members[_0x45b688][_0x7cba('0x9')]||_0x52866e[_0x7cba('0x2f')],'data3':members[_0x45b688][_0x7cba('0x30')]||_0x52866e[_0x7cba('0x31')],'uniqueid':members[_0x45b688][_0x7cba('0x6')]||_0x52866e[_0x7cba('0x6')]});utils[_0x7cba('0x4')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x52866e['uniqueid'],members[_0x45b688]['data1'],members[_0x45b688]['data2'],members[_0x45b688][_0x7cba('0x30')]));if(members[_0x45b688][_0x7cba('0x23')]){writeDB(members[_0x45b688]);}}}}catch(_0x1b538b){utils['error'](util['format'](_0x7cba('0x2b'),_0x52866e[_0x7cba('0x6')]),_0x1b538b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 03a9f31..6072b84 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 _0x2f30=['[%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','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','mohtime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','./utils','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','type','request','CreateVoiceQueueReport','uniqueid','queuecallerjoin','format','queue','position','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','info','name','transfereduniqueid','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname'];(function(_0x15d18f,_0x126b0e){var _0xd12bf7=function(_0x19e661){while(--_0x19e661){_0x15d18f['push'](_0x15d18f['shift']());}};_0xd12bf7(++_0x126b0e);}(_0x2f30,0x1b3));var _0x02f3=function(_0x596107,_0x91e227){_0x596107=_0x596107-0x0;var _0x3540d9=_0x2f30[_0x596107];return _0x3540d9;};'use strict';var _=require(_0x02f3('0x0'));var util=require('util');var utils=require(_0x02f3('0x1'));var queues={};function writeDB(_0x5d08c4){utils['info'](util['format'](_0x02f3('0x2'),_0x5d08c4['uniqueid'],_0x5d08c4[_0x02f3('0x3')],_0x5d08c4['queue'],_0x5d08c4[_0x02f3('0x4')],_0x5d08c4[_0x02f3('0x5')],_0x5d08c4[_0x02f3('0x6')],_0x5d08c4[_0x02f3('0x7')]));if(_0x5d08c4['queue']){utils['getVoiceQueueByName'](_0x5d08c4['queue'])['then'](function(_0x52d3c1){if(_0x52d3c1){_0x5d08c4[_0x02f3('0x8')]=_0x52d3c1[_0x02f3('0x8')];}utils[_0x02f3('0x9')](_0x02f3('0xa'),_0x5d08c4);});}else{utils[_0x02f3('0x9')](_0x02f3('0xa'),_0x5d08c4);}if(_0x5d08c4['transfereduniqueid']){delete queues[_0x5d08c4['transfereduniqueid']];}else{delete queues[_0x5d08c4[_0x02f3('0xb')]];}}exports[_0x02f3('0xc')]=function(_0x22338e){try{utils['debug'](util[_0x02f3('0xd')]('[%s][queues][queuecallerjoin]',_0x22338e[_0x02f3('0xb')]),_0x22338e);utils['info'](util[_0x02f3('0xd')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x22338e[_0x02f3('0xb')],_0x22338e[_0x02f3('0xe')],_0x22338e[_0x02f3('0xf')]));queues[_0x22338e['uniqueid']]=_['assign'](_0x22338e,{'originalposition':_0x22338e[_0x02f3('0xf')],'queuecallerjoinAt':utils[_0x02f3('0x10')](),'mohtime':0x0});}catch(_0x12c6aa){utils[_0x02f3('0x11')](util['format'](_0x02f3('0x12'),_0x22338e[_0x02f3('0xb')]),_0x12c6aa);}};exports[_0x02f3('0x13')]=function(_0x53464f){try{if(!_[_0x02f3('0x14')](queues[_0x53464f[_0x02f3('0xb')]])){utils[_0x02f3('0x15')](util[_0x02f3('0xd')](_0x02f3('0x16'),_0x53464f[_0x02f3('0xb')]),_0x53464f);if(queues[_0x53464f['uniqueid']][_0x02f3('0x17')]){if(!queues[_0x53464f[_0x02f3('0xb')]][_0x02f3('0x18')]&&!queues[_0x53464f[_0x02f3('0xb')]][_0x02f3('0x19')]){queues[_0x53464f[_0x02f3('0xb')]]['queuecallercomplete']=!![];queues[_0x53464f['uniqueid']][_0x02f3('0x1a')]=utils[_0x02f3('0x10')]();queues[_0x53464f[_0x02f3('0xb')]][_0x02f3('0x7')]=_0x02f3('0x1b');}utils[_0x02f3('0x1c')](util[_0x02f3('0xd')]('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x53464f[_0x02f3('0xb')],queues[_0x53464f[_0x02f3('0xb')]][_0x02f3('0x1d')],queues[_0x53464f[_0x02f3('0xb')]][_0x02f3('0x7')]));writeDB(queues[_0x53464f['uniqueid']]);}else if(queues[_0x53464f[_0x02f3('0xb')]][_0x02f3('0x1e')]){utils[_0x02f3('0x1c')](util['format'](_0x02f3('0x1f'),_0x53464f[_0x02f3('0xb')],queues[_0x53464f[_0x02f3('0xb')]][_0x02f3('0x1d')],queues[_0x53464f[_0x02f3('0xb')]][_0x02f3('0x1e')]));queues[queues[_0x53464f[_0x02f3('0xb')]][_0x02f3('0x1e')]]=queues[_0x53464f[_0x02f3('0xb')]];queues[queues[_0x53464f['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x53464f['uniqueid']];}}}catch(_0x4c7c84){utils['error'](util['format'](_0x02f3('0x16'),_0x53464f[_0x02f3('0xb')]),_0x4c7c84);}};exports[_0x02f3('0x20')]=function(_0x394c5e){try{utils[_0x02f3('0x15')](util[_0x02f3('0xd')](_0x02f3('0x21'),_0x394c5e[_0x02f3('0xb')]),_0x394c5e);if(!_['isNil'](_0x394c5e[_0x02f3('0x22')][_0x02f3('0x23')])&&_0x394c5e[_0x02f3('0x24')][_0x02f3('0x25')]()!=='CONTINUE'){if(!_[_0x02f3('0x14')](queues[_0x394c5e[_0x02f3('0xb')]])){queues[_0x394c5e['uniqueid']]['queuecallerabandon']=![];queues[_0x394c5e['uniqueid']]['queuecallerabandonAt']=null;queues[_0x394c5e['uniqueid']][_0x02f3('0x19')]=!![];queues[_0x394c5e[_0x02f3('0xb')]]['queuecallerexitAt']=utils[_0x02f3('0x10')]();queues[_0x394c5e['uniqueid']][_0x02f3('0x7')]=_0x394c5e[_0x02f3('0x24')][_0x02f3('0x25')]();utils[_0x02f3('0x1c')](util[_0x02f3('0xd')](_0x02f3('0x26'),_0x394c5e['uniqueid'],queues[_0x394c5e[_0x02f3('0xb')]][_0x02f3('0x1d')],_0x394c5e['value'],queues[_0x394c5e[_0x02f3('0xb')]][_0x02f3('0x7')]));writeDB(queues[_0x394c5e[_0x02f3('0xb')]]);}}else if(!_[_0x02f3('0x14')](_0x394c5e[_0x02f3('0x22')][_0x02f3('0x27')])){if(!_['isNil'](queues[_0x394c5e[_0x02f3('0xb')]])&&!queues[_0x394c5e[_0x02f3('0xb')]][_0x02f3('0x18')]){queues[_0x394c5e[_0x02f3('0xb')]][_0x02f3('0x18')]=![];queues[_0x394c5e[_0x02f3('0xb')]][_0x02f3('0x28')]=null;queues[_0x394c5e[_0x02f3('0xb')]]['queuecallerexit']=!![];queues[_0x394c5e[_0x02f3('0xb')]][_0x02f3('0x29')]=utils[_0x02f3('0x10')]();queues[_0x394c5e[_0x02f3('0xb')]][_0x02f3('0x7')]=_0x02f3('0x2a');utils['info'](util['format'](_0x02f3('0x2b'),_0x394c5e[_0x02f3('0xb')],queues[_0x394c5e[_0x02f3('0xb')]][_0x02f3('0x1d')],_0x394c5e[_0x02f3('0x24')],queues[_0x394c5e[_0x02f3('0xb')]][_0x02f3('0x7')]));}}}catch(_0x535c4a){utils[_0x02f3('0x11')](util['format']('[%s][queues][varset]',_0x394c5e['uniqueid']),_0x535c4a);}};exports[_0x02f3('0x18')]=function(_0x246228){try{if(!_[_0x02f3('0x14')](queues[_0x246228[_0x02f3('0xb')]])){utils[_0x02f3('0x15')](util[_0x02f3('0xd')](_0x02f3('0x2c'),_0x246228[_0x02f3('0xb')]),_0x246228);queues[_0x246228['uniqueid']]['queuecallerexit']=![];queues[_0x246228[_0x02f3('0xb')]][_0x02f3('0x29')]=null;queues[_0x246228[_0x02f3('0xb')]][_0x02f3('0x18')]=!![];queues[_0x246228[_0x02f3('0xb')]][_0x02f3('0x28')]=utils[_0x02f3('0x10')]();queues[_0x246228[_0x02f3('0xb')]][_0x02f3('0x7')]=_0x02f3('0x2d');utils[_0x02f3('0x1c')](util[_0x02f3('0xd')](_0x02f3('0x2e'),_0x246228['uniqueid'],queues[_0x246228[_0x02f3('0xb')]]['name'],queues[_0x246228['uniqueid']]['queuecallerexitreason']));}}catch(_0x5dcf2c){utils[_0x02f3('0x11')](util[_0x02f3('0xd')](_0x02f3('0x2c'),_0x246228['uniqueid']),_0x5dcf2c);}};exports[_0x02f3('0x2f')]=function(_0x3409df){try{if(!_[_0x02f3('0x14')](queues[_0x3409df[_0x02f3('0xb')]])){utils[_0x02f3('0x15')](util['format']('[%s][queues][queuecallerleave]',_0x3409df[_0x02f3('0xb')]),_0x3409df);utils[_0x02f3('0x1c')](util[_0x02f3('0xd')](_0x02f3('0x30'),_0x3409df[_0x02f3('0xb')],queues[_0x3409df[_0x02f3('0xb')]][_0x02f3('0x1d')],_0x3409df[_0x02f3('0x31')],_0x3409df['connectedlinename']));queues[_0x3409df[_0x02f3('0xb')]][_0x02f3('0x2f')]=!![];queues[_0x3409df[_0x02f3('0xb')]][_0x02f3('0x17')]=utils['now']();queues[_0x3409df[_0x02f3('0xb')]][_0x02f3('0x32')]=utils[_0x02f3('0x33')](queues[_0x3409df[_0x02f3('0xb')]][_0x02f3('0x17')],queues[_0x3409df[_0x02f3('0xb')]][_0x02f3('0x34')]);queues[_0x3409df[_0x02f3('0xb')]][_0x02f3('0xf')]=_0x3409df[_0x02f3('0xf')];queues[_0x3409df['uniqueid']][_0x02f3('0x35')]=_0x3409df[_0x02f3('0x35')];queues[_0x3409df[_0x02f3('0xb')]][_0x02f3('0x31')]=_0x3409df['connectedlinenum'];queues[_0x3409df[_0x02f3('0xb')]]['connectedlinename']=_0x3409df[_0x02f3('0x36')];}}catch(_0x5a8c8a){utils[_0x02f3('0x11')](util[_0x02f3('0xd')](_0x02f3('0x37'),_0x3409df[_0x02f3('0xb')]),_0x5a8c8a);}};exports['agentconnect']=function(_0x11cd80){try{if(!_[_0x02f3('0x14')](queues[_0x11cd80[_0x02f3('0xb')]])){utils[_0x02f3('0x15')](util[_0x02f3('0xd')](_0x02f3('0x38'),_0x11cd80[_0x02f3('0xb')]),_0x11cd80);utils[_0x02f3('0x1c')](util['format']('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x11cd80[_0x02f3('0xb')],queues[_0x11cd80['uniqueid']][_0x02f3('0x1d')],_0x11cd80[_0x02f3('0x39')],_0x11cd80[_0x02f3('0x3a')]));queues[_0x11cd80[_0x02f3('0xb')]][_0x02f3('0x18')]=![];queues[_0x11cd80['uniqueid']][_0x02f3('0x18')]=![];queues[_0x11cd80[_0x02f3('0xb')]][_0x02f3('0x28')]=null;queues[_0x11cd80[_0x02f3('0xb')]][_0x02f3('0x19')]=![];queues[_0x11cd80[_0x02f3('0xb')]][_0x02f3('0x7')]=null;queues[_0x11cd80[_0x02f3('0xb')]]['queuecallerexitAt']=null;queues[_0x11cd80[_0x02f3('0xb')]][_0x02f3('0x3b')]=!![];queues[_0x11cd80[_0x02f3('0xb')]][_0x02f3('0x6')]=_0x11cd80[_0x02f3('0x3a')];queues[_0x11cd80['uniqueid']][_0x02f3('0x4')]=_0x11cd80[_0x02f3('0x39')];}}catch(_0x52612a){utils[_0x02f3('0x11')](util['format']('[%s][queues][agentconnect]',_0x11cd80[_0x02f3('0xb')]),_0x52612a);}};exports[_0x02f3('0x3c')]=function(_0x5c7d08){try{if(!_[_0x02f3('0x14')](queues[_0x5c7d08[_0x02f3('0xb')]])){if(queues[_0x5c7d08[_0x02f3('0xb')]][_0x02f3('0x17')]){utils[_0x02f3('0x15')](util[_0x02f3('0xd')](_0x02f3('0x3d'),_0x5c7d08[_0x02f3('0xb')]),_0x5c7d08);queues[_0x5c7d08[_0x02f3('0xb')]][_0x02f3('0x18')]=![];queues[_0x5c7d08[_0x02f3('0xb')]][_0x02f3('0x18')]=![];queues[_0x5c7d08['uniqueid']][_0x02f3('0x28')]=null;queues[_0x5c7d08[_0x02f3('0xb')]][_0x02f3('0x19')]=![];queues[_0x5c7d08['uniqueid']][_0x02f3('0x29')]=null;queues[_0x5c7d08[_0x02f3('0xb')]][_0x02f3('0x3b')]=!![];queues[_0x5c7d08[_0x02f3('0xb')]]['lastAssignedTo']=_0x5c7d08[_0x02f3('0x39')];queues[_0x5c7d08[_0x02f3('0xb')]][_0x02f3('0x3e')]=!![];queues[_0x5c7d08[_0x02f3('0xb')]][_0x02f3('0x1a')]=utils[_0x02f3('0x10')]();if(_0x5c7d08[_0x02f3('0x3f')]=='transfer'){if(!queues[_0x5c7d08['uniqueid']][_0x02f3('0x40')]){queues[_0x5c7d08['uniqueid']][_0x02f3('0x7')]=_0x02f3('0x41');}}else{queues[_0x5c7d08[_0x02f3('0xb')]][_0x02f3('0x7')]=_0x02f3('0x42')+_0x5c7d08['reason'][_0x02f3('0x25')]();}utils['info'](util[_0x02f3('0xd')](_0x02f3('0x43'),_0x5c7d08[_0x02f3('0xb')],queues[_0x5c7d08[_0x02f3('0xb')]]['name'],_0x5c7d08[_0x02f3('0x39')],queues[_0x5c7d08[_0x02f3('0xb')]][_0x02f3('0x7')]));writeDB(queues[_0x5c7d08[_0x02f3('0xb')]]);}}}catch(_0x476d89){utils['error'](util['format'](_0x02f3('0x3d'),_0x5c7d08[_0x02f3('0xb')]),_0x476d89);}};exports[_0x02f3('0x44')]=function(_0x2785df){try{if(!_[_0x02f3('0x14')](queues[_0x2785df[_0x02f3('0x45')]])){utils[_0x02f3('0x15')](util[_0x02f3('0xd')]('[%s][queues][blindtransfer]',_0x2785df[_0x02f3('0xb')]),_0x2785df);queues[_0x2785df[_0x02f3('0x45')]][_0x02f3('0x40')]=!![];queues[_0x2785df[_0x02f3('0x45')]][_0x02f3('0x46')]=_0x02f3('0x47');queues[_0x2785df[_0x02f3('0x45')]][_0x02f3('0x48')]=_0x2785df[_0x02f3('0x49')];queues[_0x2785df['transfereeuniqueid']]['transferuniqueid']=_0x2785df['transfereeuniqueid'];queues[_0x2785df[_0x02f3('0x45')]][_0x02f3('0x7')]=_0x02f3('0x4a');utils[_0x02f3('0x1c')](util[_0x02f3('0xd')](_0x02f3('0x4b'),_0x2785df[_0x02f3('0xb')],queues[_0x2785df[_0x02f3('0x45')]][_0x02f3('0x1d')],_0x2785df[_0x02f3('0x45')],_0x2785df['extension']));}}catch(_0xa91ea2){utils[_0x02f3('0x11')](util[_0x02f3('0xd')](_0x02f3('0x4c'),_0x2785df[_0x02f3('0xb')]),_0xa91ea2);}};exports['attendedtransfer']=function(_0x461d8d){try{utils[_0x02f3('0x15')](util[_0x02f3('0xd')](_0x02f3('0x4d'),_0x461d8d[_0x02f3('0x4e')]),_0x461d8d);if(_0x461d8d['origtransfereruniqueid']==_0x461d8d[_0x02f3('0x4f')]){if(!_['isNil'](queues[_0x461d8d['secondtransfererlinkedid']])){utils[_0x02f3('0x1c')](util[_0x02f3('0xd')](_0x02f3('0x50'),_0x461d8d[_0x02f3('0x4e')],queues[_0x461d8d[_0x02f3('0x51')]][_0x02f3('0x1d')],_0x461d8d[_0x02f3('0x52')]));queues[_0x461d8d[_0x02f3('0x51')]]['transfer']=!![];queues[_0x461d8d[_0x02f3('0x51')]]['transfertype']='ATTENDED';queues[_0x461d8d['secondtransfererlinkedid']][_0x02f3('0x48')]=_0x461d8d[_0x02f3('0x52')];queues[_0x461d8d[_0x02f3('0x51')]][_0x02f3('0x53')]=_0x461d8d['origtransfereruniqueid'];queues[_0x461d8d[_0x02f3('0x51')]][_0x02f3('0x7')]=_0x02f3('0x54');}if(!_['isNil'](queues[_0x461d8d[_0x02f3('0x4f')]])){if(_0x461d8d[_0x02f3('0x55')]&&queues[_0x461d8d[_0x02f3('0x55')]]){queues[_0x461d8d[_0x02f3('0x55')]][_0x02f3('0x56')]=0x1;queues[_0x461d8d[_0x02f3('0x45')]]=_[_0x02f3('0x57')](queues[_0x461d8d['transfereelinkedid']]);queues[_0x461d8d[_0x02f3('0x45')]][_0x02f3('0x1e')]=_0x461d8d[_0x02f3('0x58')];queues[_0x461d8d['transfereeuniqueid']][_0x02f3('0x56')]=0x2;queues[_0x461d8d[_0x02f3('0x45')]][_0x02f3('0x5')]=queues[_0x461d8d['secondtransfererlinkedid']][_0x02f3('0x5')];queues[_0x461d8d[_0x02f3('0x45')]][_0x02f3('0x59')]=queues[_0x461d8d[_0x02f3('0x51')]][_0x02f3('0x59')];queues[_0x461d8d[_0x02f3('0x45')]][_0x02f3('0x34')]=utils['now']();queues[_0x461d8d[_0x02f3('0x45')]]['queuecallerleaveAt']=utils[_0x02f3('0x10')]();queues[_0x461d8d[_0x02f3('0x45')]][_0x02f3('0x32')]=0x0;queues[_0x461d8d['transfereeuniqueid']]['mohtime']=0x0;utils[_0x02f3('0x1c')](util['format'](_0x02f3('0x5a'),_0x461d8d[_0x02f3('0x4e')],queues[_0x461d8d[_0x02f3('0x45')]][_0x02f3('0x1d')],queues[_0x461d8d['transfereeuniqueid']][_0x02f3('0x5')],queues[_0x461d8d[_0x02f3('0x45')]]['calleridname']));}else{utils[_0x02f3('0x1c')](util[_0x02f3('0xd')](_0x02f3('0x5b'),_0x461d8d[_0x02f3('0x4e')],queues[_0x461d8d[_0x02f3('0x4f')]][_0x02f3('0x1d')],_0x461d8d[_0x02f3('0x51')]));queues[_0x461d8d[_0x02f3('0x4f')]][_0x02f3('0x1e')]=_0x461d8d[_0x02f3('0x51')];}}}else if(_0x461d8d[_0x02f3('0x5c')]==_0x461d8d['secondtransfererlinkedid']){if(!_[_0x02f3('0x14')](queues[_0x461d8d['origtransfererlinkedid']])){utils[_0x02f3('0x1c')](util[_0x02f3('0xd')](_0x02f3('0x5d'),_0x461d8d[_0x02f3('0x4e')],queues[_0x461d8d['origtransfererlinkedid']][_0x02f3('0x1d')],_0x461d8d[_0x02f3('0x5c')],_0x461d8d[_0x02f3('0x5e')]));queues[_0x461d8d[_0x02f3('0x4f')]][_0x02f3('0x40')]=!![];queues[_0x461d8d['origtransfererlinkedid']][_0x02f3('0x46')]=_0x02f3('0x5f');queues[_0x461d8d[_0x02f3('0x4f')]][_0x02f3('0x48')]=_0x461d8d[_0x02f3('0x5e')];queues[_0x461d8d[_0x02f3('0x4f')]]['transferuniqueid']=_0x461d8d[_0x02f3('0x5c')];queues[_0x461d8d['origtransfererlinkedid']][_0x02f3('0x7')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x461d8d[_0x02f3('0x51')]])){if(_0x461d8d[_0x02f3('0x60')]&&queues[_0x461d8d['transfertargetlinkedid']]){queues[_0x461d8d[_0x02f3('0x60')]][_0x02f3('0x56')]=0x1;queues[_0x461d8d[_0x02f3('0x58')]]=_[_0x02f3('0x57')](queues[_0x461d8d['transfertargetlinkedid']]);queues[_0x461d8d[_0x02f3('0x58')]][_0x02f3('0x1e')]=_0x461d8d[_0x02f3('0x58')];queues[_0x461d8d[_0x02f3('0x58')]][_0x02f3('0x56')]=0x2;queues[_0x461d8d[_0x02f3('0x58')]][_0x02f3('0x5')]=queues[_0x461d8d[_0x02f3('0x4f')]][_0x02f3('0x5')];queues[_0x461d8d[_0x02f3('0x58')]]['calleridname']=queues[_0x461d8d[_0x02f3('0x4f')]][_0x02f3('0x59')];queues[_0x461d8d[_0x02f3('0x58')]][_0x02f3('0x34')]=utils['now']();queues[_0x461d8d[_0x02f3('0x58')]][_0x02f3('0x17')]=utils[_0x02f3('0x10')]();queues[_0x461d8d[_0x02f3('0x58')]][_0x02f3('0x32')]=0x0;queues[_0x461d8d[_0x02f3('0x58')]]['mohtime']=0x0;utils[_0x02f3('0x1c')](util[_0x02f3('0xd')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x461d8d[_0x02f3('0x4e')],queues[_0x461d8d[_0x02f3('0x58')]][_0x02f3('0x1d')],queues[_0x461d8d[_0x02f3('0x58')]][_0x02f3('0x1e')],queues[_0x461d8d['transfertargetuniqueid']][_0x02f3('0x5')],queues[_0x461d8d['transfertargetuniqueid']]['calleridname']));}else{utils[_0x02f3('0x1c')](util['format'](_0x02f3('0x5b'),_0x461d8d['origtransfereruniqueid'],queues[_0x461d8d[_0x02f3('0x51')]][_0x02f3('0x1d')],_0x461d8d['origtransfererlinkedid']));queues[_0x461d8d['secondtransfererlinkedid']][_0x02f3('0x1e')]=_0x461d8d[_0x02f3('0x4f')];}}}}catch(_0x1aefea){utils[_0x02f3('0x11')](util[_0x02f3('0xd')]('[%s][queues][attendedtransfer]',_0x461d8d[_0x02f3('0x4e')]),_0x1aefea);}};exports[_0x02f3('0x61')]=function(_0x4f4695){try{if(!_[_0x02f3('0x14')](queues[_0x4f4695[_0x02f3('0xb')]])){utils[_0x02f3('0x15')](util['format'](_0x02f3('0x62'),_0x4f4695['uniqueid']),_0x4f4695);queues[_0x4f4695['uniqueid']]['musiconholdstartAt']=utils[_0x02f3('0x10')]();utils['info'](util[_0x02f3('0xd')](_0x02f3('0x63'),_0x4f4695[_0x02f3('0xb')],queues[_0x4f4695[_0x02f3('0xb')]][_0x02f3('0x1d')],queues[_0x4f4695['uniqueid']][_0x02f3('0x64')]));}}catch(_0xf6fc12){utils[_0x02f3('0x11')](util['format'](_0x02f3('0x62'),_0x4f4695[_0x02f3('0xb')]),_0xf6fc12);}};exports[_0x02f3('0x65')]=function(_0x495db1){try{if(!_[_0x02f3('0x14')](queues[_0x495db1[_0x02f3('0xb')]])){if(!_[_0x02f3('0x14')](queues[_0x495db1[_0x02f3('0xb')]][_0x02f3('0x64')])){utils[_0x02f3('0x15')](util[_0x02f3('0xd')]('[%s][queues][musiconholdstop]',_0x495db1['uniqueid']),_0x495db1);queues[_0x495db1[_0x02f3('0xb')]][_0x02f3('0x66')]+=utils[_0x02f3('0x33')](utils[_0x02f3('0x10')](),queues[_0x495db1[_0x02f3('0xb')]]['musiconholdstartAt']);utils[_0x02f3('0x1c')](util[_0x02f3('0xd')](_0x02f3('0x67'),_0x495db1[_0x02f3('0xb')],queues[_0x495db1[_0x02f3('0xb')]]['name'],queues[_0x495db1[_0x02f3('0xb')]]['mohtime']));delete queues[_0x495db1['uniqueid']][_0x02f3('0x64')];}}}catch(_0x378d51){utils[_0x02f3('0x11')](util['format'](_0x02f3('0x68'),_0x495db1[_0x02f3('0xb')]),_0x378d51);}}; \ No newline at end of file +var _0x6631=['queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%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','assigned','accountcode','membername','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','queuecallerjoinAt','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfererlinkedid','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','transfertargetuniqueid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','queue','lastAssignedTo','calleridnum','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','[%s][queues][queuecallerjoin]','hangup','isNil','debug','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','now'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x6631,0xb6));var _0x1663=function(_0x1c9361,_0x4c4539){_0x1c9361=_0x1c9361-0x0;var _0x16233d=_0x6631[_0x1c9361];return _0x16233d;};'use strict';var _=require(_0x1663('0x0'));var util=require(_0x1663('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x213062){utils[_0x1663('0x2')](util['format'](_0x1663('0x3'),_0x213062['uniqueid'],_0x213062[_0x1663('0x4')],_0x213062[_0x1663('0x5')],_0x213062[_0x1663('0x6')],_0x213062[_0x1663('0x7')],_0x213062['accountcode'],_0x213062['queuecallerexitreason']));if(_0x213062[_0x1663('0x5')]){utils[_0x1663('0x8')](_0x213062['queue'])[_0x1663('0x9')](function(_0x2eecb9){if(_0x2eecb9){_0x213062[_0x1663('0xa')]=_0x2eecb9[_0x1663('0xa')];}utils[_0x1663('0xb')](_0x1663('0xc'),_0x213062);});}else{utils['request'](_0x1663('0xc'),_0x213062);}if(_0x213062[_0x1663('0xd')]){delete queues[_0x213062['transfereduniqueid']];}else{delete queues[_0x213062[_0x1663('0xe')]];}}exports[_0x1663('0xf')]=function(_0x410a86){try{utils['debug'](util[_0x1663('0x10')]('[%s][queues][queuecallerjoin]',_0x410a86[_0x1663('0xe')]),_0x410a86);utils['info'](util[_0x1663('0x10')](_0x1663('0x11'),_0x410a86[_0x1663('0xe')],_0x410a86['queue'],_0x410a86[_0x1663('0x12')]));queues[_0x410a86[_0x1663('0xe')]]=_[_0x1663('0x13')](_0x410a86,{'originalposition':_0x410a86[_0x1663('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x50770c){utils[_0x1663('0x14')](util[_0x1663('0x10')](_0x1663('0x15'),_0x410a86[_0x1663('0xe')]),_0x50770c);}};exports[_0x1663('0x16')]=function(_0x2e888e){try{if(!_[_0x1663('0x17')](queues[_0x2e888e[_0x1663('0xe')]])){utils[_0x1663('0x18')](util[_0x1663('0x10')]('[%s][queues][hangup]',_0x2e888e['uniqueid']),_0x2e888e);if(queues[_0x2e888e[_0x1663('0xe')]][_0x1663('0x19')]){if(!queues[_0x2e888e['uniqueid']][_0x1663('0x1a')]&&!queues[_0x2e888e['uniqueid']][_0x1663('0x1b')]){queues[_0x2e888e[_0x1663('0xe')]]['queuecallercomplete']=!![];queues[_0x2e888e[_0x1663('0xe')]][_0x1663('0x1c')]=utils[_0x1663('0x1d')]();queues[_0x2e888e[_0x1663('0xe')]][_0x1663('0x1e')]=_0x1663('0x1f');}utils['info'](util['format'](_0x1663('0x20'),_0x2e888e[_0x1663('0xe')],queues[_0x2e888e[_0x1663('0xe')]][_0x1663('0x21')],queues[_0x2e888e[_0x1663('0xe')]][_0x1663('0x1e')]));writeDB(queues[_0x2e888e['uniqueid']]);}else if(queues[_0x2e888e[_0x1663('0xe')]][_0x1663('0xd')]){utils[_0x1663('0x2')](util[_0x1663('0x10')](_0x1663('0x22'),_0x2e888e[_0x1663('0xe')],queues[_0x2e888e[_0x1663('0xe')]][_0x1663('0x21')],queues[_0x2e888e[_0x1663('0xe')]][_0x1663('0xd')]));queues[queues[_0x2e888e[_0x1663('0xe')]][_0x1663('0xd')]]=queues[_0x2e888e[_0x1663('0xe')]];queues[queues[_0x2e888e[_0x1663('0xe')]]['transfereduniqueid']][_0x1663('0x23')]=0x2;delete queues[_0x2e888e[_0x1663('0xe')]];}}}catch(_0x4972ac){utils[_0x1663('0x14')](util[_0x1663('0x10')]('[%s][queues][hangup]',_0x2e888e['uniqueid']),_0x4972ac);}};exports['varset']=function(_0x21e36f){try{utils[_0x1663('0x18')](util[_0x1663('0x10')](_0x1663('0x24'),_0x21e36f[_0x1663('0xe')]),_0x21e36f);if(!_['isNil'](_0x21e36f[_0x1663('0x25')]['queuestatus'])&&_0x21e36f[_0x1663('0x26')][_0x1663('0x27')]()!==_0x1663('0x28')){if(!_[_0x1663('0x17')](queues[_0x21e36f[_0x1663('0xe')]])){queues[_0x21e36f['uniqueid']][_0x1663('0x1a')]=![];queues[_0x21e36f[_0x1663('0xe')]][_0x1663('0x29')]=null;queues[_0x21e36f[_0x1663('0xe')]][_0x1663('0x1b')]=!![];queues[_0x21e36f['uniqueid']][_0x1663('0x2a')]=utils[_0x1663('0x1d')]();queues[_0x21e36f[_0x1663('0xe')]][_0x1663('0x1e')]=_0x21e36f[_0x1663('0x26')][_0x1663('0x27')]();utils[_0x1663('0x2')](util[_0x1663('0x10')](_0x1663('0x2b'),_0x21e36f[_0x1663('0xe')],queues[_0x21e36f[_0x1663('0xe')]][_0x1663('0x21')],_0x21e36f[_0x1663('0x26')],queues[_0x21e36f[_0x1663('0xe')]][_0x1663('0x1e')]));writeDB(queues[_0x21e36f[_0x1663('0xe')]]);}}else if(!_[_0x1663('0x17')](_0x21e36f['variable'][_0x1663('0x2c')])){if(!_[_0x1663('0x17')](queues[_0x21e36f['uniqueid']])&&!queues[_0x21e36f[_0x1663('0xe')]][_0x1663('0x1a')]){queues[_0x21e36f[_0x1663('0xe')]][_0x1663('0x1a')]=![];queues[_0x21e36f[_0x1663('0xe')]][_0x1663('0x29')]=null;queues[_0x21e36f[_0x1663('0xe')]]['queuecallerexit']=!![];queues[_0x21e36f[_0x1663('0xe')]][_0x1663('0x2a')]=utils[_0x1663('0x1d')]();queues[_0x21e36f[_0x1663('0xe')]][_0x1663('0x1e')]=_0x1663('0x2d');utils['info'](util[_0x1663('0x10')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x21e36f[_0x1663('0xe')],queues[_0x21e36f[_0x1663('0xe')]][_0x1663('0x21')],_0x21e36f[_0x1663('0x26')],queues[_0x21e36f[_0x1663('0xe')]][_0x1663('0x1e')]));}}}catch(_0x3256a1){utils[_0x1663('0x14')](util[_0x1663('0x10')](_0x1663('0x24'),_0x21e36f[_0x1663('0xe')]),_0x3256a1);}};exports[_0x1663('0x1a')]=function(_0x3a48da){try{if(!_[_0x1663('0x17')](queues[_0x3a48da[_0x1663('0xe')]])){utils[_0x1663('0x18')](util['format'](_0x1663('0x2e'),_0x3a48da[_0x1663('0xe')]),_0x3a48da);queues[_0x3a48da['uniqueid']]['queuecallerexit']=![];queues[_0x3a48da[_0x1663('0xe')]][_0x1663('0x2a')]=null;queues[_0x3a48da['uniqueid']][_0x1663('0x1a')]=!![];queues[_0x3a48da[_0x1663('0xe')]][_0x1663('0x29')]=utils['now']();queues[_0x3a48da[_0x1663('0xe')]][_0x1663('0x1e')]=_0x1663('0x2f');utils[_0x1663('0x2')](util[_0x1663('0x10')](_0x1663('0x30'),_0x3a48da[_0x1663('0xe')],queues[_0x3a48da[_0x1663('0xe')]][_0x1663('0x21')],queues[_0x3a48da[_0x1663('0xe')]][_0x1663('0x1e')]));}}catch(_0x4ee3aa){utils[_0x1663('0x14')](util[_0x1663('0x10')](_0x1663('0x2e'),_0x3a48da[_0x1663('0xe')]),_0x4ee3aa);}};exports['queuecallerleave']=function(_0x2f56ff){try{if(!_[_0x1663('0x17')](queues[_0x2f56ff['uniqueid']])){utils[_0x1663('0x18')](util[_0x1663('0x10')](_0x1663('0x31'),_0x2f56ff[_0x1663('0xe')]),_0x2f56ff);utils[_0x1663('0x2')](util[_0x1663('0x10')](_0x1663('0x32'),_0x2f56ff[_0x1663('0xe')],queues[_0x2f56ff[_0x1663('0xe')]][_0x1663('0x21')],_0x2f56ff[_0x1663('0x33')],_0x2f56ff[_0x1663('0x34')]));queues[_0x2f56ff[_0x1663('0xe')]][_0x1663('0x35')]=!![];queues[_0x2f56ff[_0x1663('0xe')]][_0x1663('0x19')]=utils[_0x1663('0x1d')]();queues[_0x2f56ff[_0x1663('0xe')]][_0x1663('0x36')]=utils[_0x1663('0x37')](queues[_0x2f56ff[_0x1663('0xe')]][_0x1663('0x19')],queues[_0x2f56ff[_0x1663('0xe')]]['queuecallerjoinAt']);queues[_0x2f56ff[_0x1663('0xe')]][_0x1663('0x12')]=_0x2f56ff[_0x1663('0x12')];queues[_0x2f56ff['uniqueid']][_0x1663('0x38')]=_0x2f56ff[_0x1663('0x38')];queues[_0x2f56ff[_0x1663('0xe')]][_0x1663('0x33')]=_0x2f56ff[_0x1663('0x33')];queues[_0x2f56ff[_0x1663('0xe')]][_0x1663('0x34')]=_0x2f56ff[_0x1663('0x34')];}}catch(_0x58f28c){utils[_0x1663('0x14')](util[_0x1663('0x10')](_0x1663('0x31'),_0x2f56ff['uniqueid']),_0x58f28c);}};exports[_0x1663('0x39')]=function(_0x2311d3){try{if(!_[_0x1663('0x17')](queues[_0x2311d3[_0x1663('0xe')]])){utils[_0x1663('0x18')](util[_0x1663('0x10')](_0x1663('0x3a'),_0x2311d3['uniqueid']),_0x2311d3);utils[_0x1663('0x2')](util[_0x1663('0x10')](_0x1663('0x3b'),_0x2311d3[_0x1663('0xe')],queues[_0x2311d3[_0x1663('0xe')]][_0x1663('0x21')],_0x2311d3['membername'],_0x2311d3['destaccountcode']));queues[_0x2311d3[_0x1663('0xe')]][_0x1663('0x1a')]=![];queues[_0x2311d3[_0x1663('0xe')]][_0x1663('0x1a')]=![];queues[_0x2311d3['uniqueid']][_0x1663('0x29')]=null;queues[_0x2311d3['uniqueid']][_0x1663('0x1b')]=![];queues[_0x2311d3[_0x1663('0xe')]][_0x1663('0x1e')]=null;queues[_0x2311d3[_0x1663('0xe')]]['queuecallerexitAt']=null;queues[_0x2311d3['uniqueid']][_0x1663('0x3c')]=!![];queues[_0x2311d3[_0x1663('0xe')]][_0x1663('0x3d')]=_0x2311d3['destaccountcode'];queues[_0x2311d3[_0x1663('0xe')]][_0x1663('0x6')]=_0x2311d3[_0x1663('0x3e')];}}catch(_0x2154fa){utils[_0x1663('0x14')](util['format'](_0x1663('0x3a'),_0x2311d3['uniqueid']),_0x2154fa);}};exports[_0x1663('0x3f')]=function(_0x1e07f3){try{if(!_['isNil'](queues[_0x1e07f3['uniqueid']])){if(queues[_0x1e07f3['uniqueid']]['queuecallerleaveAt']){utils[_0x1663('0x18')](util[_0x1663('0x10')](_0x1663('0x40'),_0x1e07f3[_0x1663('0xe')]),_0x1e07f3);queues[_0x1e07f3['uniqueid']][_0x1663('0x1a')]=![];queues[_0x1e07f3[_0x1663('0xe')]][_0x1663('0x1a')]=![];queues[_0x1e07f3[_0x1663('0xe')]][_0x1663('0x29')]=null;queues[_0x1e07f3[_0x1663('0xe')]]['queuecallerexit']=![];queues[_0x1e07f3[_0x1663('0xe')]][_0x1663('0x2a')]=null;queues[_0x1e07f3[_0x1663('0xe')]]['assigned']=!![];queues[_0x1e07f3[_0x1663('0xe')]][_0x1663('0x6')]=_0x1e07f3[_0x1663('0x3e')];queues[_0x1e07f3[_0x1663('0xe')]]['queuecallercomplete']=!![];queues[_0x1e07f3[_0x1663('0xe')]][_0x1663('0x1c')]=utils['now']();if(_0x1e07f3[_0x1663('0x41')]==_0x1663('0x42')){if(!queues[_0x1e07f3[_0x1663('0xe')]][_0x1663('0x42')]){queues[_0x1e07f3['uniqueid']]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x1e07f3['uniqueid']][_0x1663('0x1e')]=_0x1663('0x43')+_0x1e07f3[_0x1663('0x41')][_0x1663('0x27')]();}utils['info'](util[_0x1663('0x10')](_0x1663('0x44'),_0x1e07f3['uniqueid'],queues[_0x1e07f3[_0x1663('0xe')]]['name'],_0x1e07f3[_0x1663('0x3e')],queues[_0x1e07f3[_0x1663('0xe')]][_0x1663('0x1e')]));writeDB(queues[_0x1e07f3[_0x1663('0xe')]]);}}}catch(_0x5f0a1b){utils[_0x1663('0x14')](util[_0x1663('0x10')](_0x1663('0x40'),_0x1e07f3[_0x1663('0xe')]),_0x5f0a1b);}};exports[_0x1663('0x45')]=function(_0x2cd948){try{if(!_['isNil'](queues[_0x2cd948['transfereeuniqueid']])){utils[_0x1663('0x18')](util[_0x1663('0x10')]('[%s][queues][blindtransfer]',_0x2cd948['uniqueid']),_0x2cd948);queues[_0x2cd948['transfereeuniqueid']]['transfer']=!![];queues[_0x2cd948[_0x1663('0x46')]][_0x1663('0x47')]=_0x1663('0x48');queues[_0x2cd948[_0x1663('0x46')]][_0x1663('0x49')]=_0x2cd948[_0x1663('0x4a')];queues[_0x2cd948['transfereeuniqueid']][_0x1663('0x4b')]=_0x2cd948['transfereeuniqueid'];queues[_0x2cd948['transfereeuniqueid']]['queuecallerexitreason']=_0x1663('0x4c');utils[_0x1663('0x2')](util[_0x1663('0x10')](_0x1663('0x4d'),_0x2cd948['uniqueid'],queues[_0x2cd948[_0x1663('0x46')]][_0x1663('0x21')],_0x2cd948['transfereeuniqueid'],_0x2cd948[_0x1663('0x4a')]));}}catch(_0xf3a9ac){utils[_0x1663('0x14')](util['format'](_0x1663('0x4e'),_0x2cd948['uniqueid']),_0xf3a9ac);}};exports[_0x1663('0x4f')]=function(_0x5a4a23){try{utils[_0x1663('0x18')](util['format'](_0x1663('0x50'),_0x5a4a23['origtransfereruniqueid']),_0x5a4a23);if(_0x5a4a23[_0x1663('0x51')]==_0x5a4a23['origtransfererlinkedid']){if(!_[_0x1663('0x17')](queues[_0x5a4a23[_0x1663('0x52')]])){utils[_0x1663('0x2')](util[_0x1663('0x10')](_0x1663('0x53'),_0x5a4a23[_0x1663('0x51')],queues[_0x5a4a23[_0x1663('0x52')]][_0x1663('0x21')],_0x5a4a23['origtransfererexten']));queues[_0x5a4a23['secondtransfererlinkedid']][_0x1663('0x42')]=!![];queues[_0x5a4a23[_0x1663('0x52')]][_0x1663('0x47')]='ATTENDED';queues[_0x5a4a23[_0x1663('0x52')]][_0x1663('0x49')]=_0x5a4a23[_0x1663('0x54')];queues[_0x5a4a23['secondtransfererlinkedid']][_0x1663('0x4b')]=_0x5a4a23[_0x1663('0x51')];queues[_0x5a4a23['secondtransfererlinkedid']][_0x1663('0x1e')]=_0x1663('0x55');}if(!_[_0x1663('0x17')](queues[_0x5a4a23['origtransfererlinkedid']])){if(_0x5a4a23[_0x1663('0x56')]&&queues[_0x5a4a23[_0x1663('0x56')]]){queues[_0x5a4a23[_0x1663('0x56')]][_0x1663('0x23')]=0x1;queues[_0x5a4a23['transfereeuniqueid']]=_[_0x1663('0x57')](queues[_0x5a4a23[_0x1663('0x56')]]);queues[_0x5a4a23['transfereeuniqueid']][_0x1663('0xd')]=_0x5a4a23['transfertargetuniqueid'];queues[_0x5a4a23[_0x1663('0x46')]][_0x1663('0x23')]=0x2;queues[_0x5a4a23[_0x1663('0x46')]][_0x1663('0x7')]=queues[_0x5a4a23[_0x1663('0x52')]][_0x1663('0x7')];queues[_0x5a4a23['transfereeuniqueid']]['calleridname']=queues[_0x5a4a23['secondtransfererlinkedid']][_0x1663('0x58')];queues[_0x5a4a23[_0x1663('0x46')]][_0x1663('0x59')]=utils['now']();queues[_0x5a4a23['transfereeuniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x5a4a23[_0x1663('0x46')]]['holdtime']=0x0;queues[_0x5a4a23[_0x1663('0x46')]]['mohtime']=0x0;utils[_0x1663('0x2')](util[_0x1663('0x10')](_0x1663('0x5a'),_0x5a4a23[_0x1663('0x51')],queues[_0x5a4a23[_0x1663('0x46')]][_0x1663('0x21')],queues[_0x5a4a23[_0x1663('0x46')]][_0x1663('0x7')],queues[_0x5a4a23[_0x1663('0x46')]][_0x1663('0x58')]));}else{utils[_0x1663('0x2')](util[_0x1663('0x10')](_0x1663('0x5b'),_0x5a4a23['origtransfereruniqueid'],queues[_0x5a4a23[_0x1663('0x5c')]][_0x1663('0x21')],_0x5a4a23['secondtransfererlinkedid']));queues[_0x5a4a23[_0x1663('0x5c')]][_0x1663('0xd')]=_0x5a4a23['secondtransfererlinkedid'];}}}else if(_0x5a4a23[_0x1663('0x5d')]==_0x5a4a23[_0x1663('0x52')]){if(!_[_0x1663('0x17')](queues[_0x5a4a23[_0x1663('0x5c')]])){utils['info'](util[_0x1663('0x10')](_0x1663('0x5e'),_0x5a4a23['origtransfereruniqueid'],queues[_0x5a4a23[_0x1663('0x5c')]]['name'],_0x5a4a23[_0x1663('0x5d')],_0x5a4a23[_0x1663('0x5f')]));queues[_0x5a4a23[_0x1663('0x5c')]]['transfer']=!![];queues[_0x5a4a23[_0x1663('0x5c')]][_0x1663('0x47')]=_0x1663('0x60');queues[_0x5a4a23[_0x1663('0x5c')]][_0x1663('0x49')]=_0x5a4a23[_0x1663('0x5f')];queues[_0x5a4a23[_0x1663('0x5c')]][_0x1663('0x4b')]=_0x5a4a23[_0x1663('0x5d')];queues[_0x5a4a23[_0x1663('0x5c')]][_0x1663('0x1e')]=_0x1663('0x55');}if(!_[_0x1663('0x17')](queues[_0x5a4a23[_0x1663('0x52')]])){if(_0x5a4a23[_0x1663('0x61')]&&queues[_0x5a4a23[_0x1663('0x61')]]){queues[_0x5a4a23[_0x1663('0x61')]]['queuecallerenterreason']=0x1;queues[_0x5a4a23[_0x1663('0x62')]]=_[_0x1663('0x57')](queues[_0x5a4a23[_0x1663('0x61')]]);queues[_0x5a4a23['transfertargetuniqueid']][_0x1663('0xd')]=_0x5a4a23[_0x1663('0x62')];queues[_0x5a4a23[_0x1663('0x62')]]['queuecallerenterreason']=0x2;queues[_0x5a4a23[_0x1663('0x62')]][_0x1663('0x7')]=queues[_0x5a4a23['origtransfererlinkedid']][_0x1663('0x7')];queues[_0x5a4a23[_0x1663('0x62')]]['calleridname']=queues[_0x5a4a23[_0x1663('0x5c')]][_0x1663('0x58')];queues[_0x5a4a23[_0x1663('0x62')]][_0x1663('0x59')]=utils[_0x1663('0x1d')]();queues[_0x5a4a23[_0x1663('0x62')]][_0x1663('0x19')]=utils[_0x1663('0x1d')]();queues[_0x5a4a23['transfertargetuniqueid']]['holdtime']=0x0;queues[_0x5a4a23['transfertargetuniqueid']][_0x1663('0x63')]=0x0;utils[_0x1663('0x2')](util['format'](_0x1663('0x64'),_0x5a4a23[_0x1663('0x51')],queues[_0x5a4a23[_0x1663('0x62')]][_0x1663('0x21')],queues[_0x5a4a23[_0x1663('0x62')]][_0x1663('0xd')],queues[_0x5a4a23['transfertargetuniqueid']]['calleridnum'],queues[_0x5a4a23['transfertargetuniqueid']]['calleridname']));}else{utils['info'](util['format'](_0x1663('0x5b'),_0x5a4a23[_0x1663('0x51')],queues[_0x5a4a23['secondtransfererlinkedid']][_0x1663('0x21')],_0x5a4a23[_0x1663('0x5c')]));queues[_0x5a4a23[_0x1663('0x52')]][_0x1663('0xd')]=_0x5a4a23[_0x1663('0x5c')];}}}}catch(_0x4b5c39){utils[_0x1663('0x14')](util[_0x1663('0x10')](_0x1663('0x50'),_0x5a4a23['origtransfereruniqueid']),_0x4b5c39);}};exports[_0x1663('0x65')]=function(_0x7b3cc0){try{if(!_[_0x1663('0x17')](queues[_0x7b3cc0[_0x1663('0xe')]])){utils[_0x1663('0x18')](util['format']('[%s][queues][musiconholdstart]',_0x7b3cc0[_0x1663('0xe')]),_0x7b3cc0);queues[_0x7b3cc0[_0x1663('0xe')]][_0x1663('0x66')]=utils[_0x1663('0x1d')]();utils[_0x1663('0x2')](util[_0x1663('0x10')](_0x1663('0x67'),_0x7b3cc0[_0x1663('0xe')],queues[_0x7b3cc0[_0x1663('0xe')]][_0x1663('0x21')],queues[_0x7b3cc0['uniqueid']][_0x1663('0x66')]));}}catch(_0x4eddee){utils[_0x1663('0x14')](util[_0x1663('0x10')]('[%s][queues][musiconholdstart]',_0x7b3cc0['uniqueid']),_0x4eddee);}};exports['musiconholdstop']=function(_0x9948cb){try{if(!_['isNil'](queues[_0x9948cb['uniqueid']])){if(!_['isNil'](queues[_0x9948cb[_0x1663('0xe')]][_0x1663('0x66')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x9948cb[_0x1663('0xe')]),_0x9948cb);queues[_0x9948cb[_0x1663('0xe')]][_0x1663('0x63')]+=utils[_0x1663('0x37')](utils[_0x1663('0x1d')](),queues[_0x9948cb[_0x1663('0xe')]]['musiconholdstartAt']);utils['info'](util[_0x1663('0x10')](_0x1663('0x68'),_0x9948cb['uniqueid'],queues[_0x9948cb['uniqueid']][_0x1663('0x21')],queues[_0x9948cb[_0x1663('0xe')]][_0x1663('0x63')]));delete queues[_0x9948cb[_0x1663('0xe')]]['musiconholdstartAt'];}}}catch(_0x5a991b){utils[_0x1663('0x14')](util['format'](_0x1663('0x69'),_0x9948cb[_0x1663('0xe')]),_0x5a991b);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 10d5132..5d91322 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 _0x6683=['[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','variable','mixmonitor_filename','[%s][recordings][varset]','value','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','request','[%s][recordings][newchannel]','linkedid'];(function(_0x4ec3ed,_0x1248bd){var _0x9182e0=function(_0x128e15){while(--_0x128e15){_0x4ec3ed['push'](_0x4ec3ed['shift']());}};_0x9182e0(++_0x1248bd);}(_0x6683,0x194));var _0x3668=function(_0x549996,_0xd04634){_0x549996=_0x549996-0x0;var _0x4de5d1=_0x6683[_0x549996];return _0x4de5d1;};'use strict';var _=require(_0x3668('0x0'));var util=require('util');var utils=require(_0x3668('0x1'));var recordings={};function writeDB(_0x2fbb9b){utils[_0x3668('0x2')](util[_0x3668('0x3')](_0x3668('0x4'),_0x2fbb9b[_0x3668('0x5')]));if(_0x2fbb9b[_0x3668('0x6')]){utils[_0x3668('0x7')](_0x2fbb9b['accountcode'])[_0x3668('0x8')](function(_0x3f9d9a){if(_0x3f9d9a){_0x2fbb9b[_0x3668('0x9')]=_0x3f9d9a[_0x3668('0xa')];_0x2fbb9b[_0x3668('0xb')]=_0x3f9d9a['id'];}utils['request'](_0x3668('0xc'),_0x2fbb9b);});}else{utils[_0x3668('0xd')]('CreateVoiceRecording',_0x2fbb9b);}}exports['newchannel']=function(_0x1bc1fb){try{utils['debug'](util[_0x3668('0x3')](_0x3668('0xe'),_0x1bc1fb['uniqueid']),_0x1bc1fb);if(_0x1bc1fb[_0x3668('0x5')]==_0x1bc1fb[_0x3668('0xf')]){utils[_0x3668('0x2')](util['format'](_0x3668('0x10'),_0x1bc1fb[_0x3668('0x5')],_0x1bc1fb[_0x3668('0x11')],_0x1bc1fb[_0x3668('0x12')]));recordings[_0x1bc1fb['uniqueid']]={'uniqueid':_0x1bc1fb[_0x3668('0x5')],'accountcode':_0x1bc1fb[_0x3668('0x6')],'exten':_0x1bc1fb['exten'],'context':_0x1bc1fb[_0x3668('0x11')],'channel':_0x1bc1fb['channel'],'monitors':[]};}}catch(_0x376e5c){utils['error'](util['format'](_0x3668('0xe'),_0x1bc1fb[_0x3668('0x5')]),_0x376e5c);}};exports['newstate']=function(_0x57cce2){try{utils[_0x3668('0x13')](util['format'](_0x3668('0x14'),_0x57cce2['uniqueid']),_0x57cce2);if(!_[_0x3668('0x15')](recordings[_0x57cce2[_0x3668('0x5')]])&&_0x57cce2[_0x3668('0x16')]==0x6){utils['info'](util[_0x3668('0x3')](_0x3668('0x17'),_0x57cce2[_0x3668('0x5')],_0x57cce2[_0x3668('0x11')],_0x57cce2[_0x3668('0x18')]));}else if(!_[_0x3668('0x15')](recordings[_0x57cce2[_0x3668('0xf')]])&&_0x57cce2[_0x3668('0x16')]==0x6&&_0x57cce2[_0x3668('0x11')]!=_0x3668('0x19')){utils[_0x3668('0x2')](util['format'](_0x3668('0x1a'),_0x57cce2[_0x3668('0x5')],_0x57cce2[_0x3668('0xf')],_0x57cce2[_0x3668('0x11')],_0x57cce2['channel']));recordings[_0x57cce2[_0x3668('0xf')]]['accountcode']=_0x57cce2[_0x3668('0x6')];}}catch(_0x1a80dd){utils[_0x3668('0x1b')](util[_0x3668('0x3')]('[%s][recordings][newstate]',_0x57cce2[_0x3668('0x5')]),_0x1a80dd);}};exports['varset']=function(_0x29252d){try{if(!_[_0x3668('0x15')](_0x29252d[_0x3668('0x1c')])&&!_[_0x3668('0x15')](_0x29252d[_0x3668('0x1c')][_0x3668('0x1d')])){utils['debug'](util[_0x3668('0x3')](_0x3668('0x1e'),_0x29252d[_0x3668('0x5')]),_0x29252d);utils[_0x3668('0x2')](util[_0x3668('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x29252d['uniqueid'],_0x29252d[_0x3668('0x1c')],_0x29252d[_0x3668('0x1f')]));if(_['endsWith'](_0x29252d[_0x3668('0x1f')],_0x3668('0x20'))){_0x29252d[_0x3668('0x1f')]=_0x29252d['value']['replace'](_0x3668('0x20'),_0x3668('0x21'));}if(recordings[_0x29252d[_0x3668('0xf')]]){var _0x5186fc=_[_0x3668('0x22')](recordings[_0x29252d['linkedid']][_0x3668('0x23')],{'value':_0x29252d[_0x3668('0x1f')]});if(_[_0x3668('0x15')](_0x5186fc)){recordings[_0x29252d['linkedid']][_0x3668('0x23')][_0x3668('0x24')]({'value':_0x29252d[_0x3668('0x1f')]});}}}}catch(_0x2044b3){utils[_0x3668('0x1b')](util[_0x3668('0x3')](_0x3668('0x1e'),_0x29252d[_0x3668('0x5')]),_0x2044b3);}};exports[_0x3668('0x25')]=function(_0x38d3d9){try{if(!_[_0x3668('0x15')](recordings[_0x38d3d9['uniqueid']])){utils[_0x3668('0x13')](util[_0x3668('0x3')](_0x3668('0x26'),_0x38d3d9[_0x3668('0x5')]),_0x38d3d9);utils['info'](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x38d3d9[_0x3668('0x5')],_0x38d3d9[_0x3668('0x27')],_0x38d3d9[_0x3668('0x28')],_0x38d3d9[_0x3668('0x29')]));recordings[_0x38d3d9[_0x3668('0x5')]][_0x3668('0x27')]=_0x38d3d9[_0x3668('0x27')];recordings[_0x38d3d9[_0x3668('0x5')]][_0x3668('0x28')]=_0x38d3d9[_0x3668('0x28')];recordings[_0x38d3d9[_0x3668('0x5')]][_0x3668('0x2a')]=_0x38d3d9['connectedlinenum'];recordings[_0x38d3d9[_0x3668('0x5')]]['connectedlinename']=_0x38d3d9[_0x3668('0x2b')];if(recordings[_0x38d3d9[_0x3668('0x5')]][_0x3668('0x2c')]==_0x3668('0x2d')&&recordings[_0x38d3d9[_0x3668('0x5')]][_0x3668('0x6')]){recordings[_0x38d3d9['uniqueid']][_0x3668('0x2a')]=recordings[_0x38d3d9[_0x3668('0x5')]]['accountcode'];recordings[_0x38d3d9[_0x3668('0x5')]][_0x3668('0x2b')]='';}recordings[_0x38d3d9[_0x3668('0x5')]][_0x3668('0x23')][_0x3668('0x2e')](function(_0x1bcf5b){var _0x94bcb5=_[_0x3668('0x2f')](recordings[_0x38d3d9[_0x3668('0x5')]]);_0x94bcb5[_0x3668('0x1f')]=_0x1bcf5b[_0x3668('0x1f')];writeDB(_0x94bcb5);});delete recordings[_0x38d3d9[_0x3668('0x5')]];}}catch(_0x47a973){utils[_0x3668('0x1b')](util['format'](_0x3668('0x26'),_0x38d3d9[_0x3668('0x5')]),_0x47a973);}};exports['newexten']=function(_0x411834){try{if(!_[_0x3668('0x15')](recordings[_0x411834['uniqueid']])){utils[_0x3668('0x13')](util[_0x3668('0x3')](_0x3668('0x30'),_0x411834['uniqueid']),_0x411834);utils[_0x3668('0x2')](util[_0x3668('0x3')](_0x3668('0x31'),_0x411834[_0x3668('0x5')],_0x411834[_0x3668('0x32')],_0x411834[_0x3668('0x33')]));if(_0x411834[_0x3668('0x32')][_0x3668('0x34')]()==_0x3668('0x35')&&_['startsWith'](_0x411834[_0x3668('0x33')][_0x3668('0x34')](),_0x3668('0x36'))){var _0x4aac09=_0x411834[_0x3668('0x33')]['split']('=');var _0xcde777=_0x4aac09[0x0][_0x3668('0x37')](_0x4aac09[0x0][_0x3668('0x38')]('(')+0x1,_0x4aac09[0x0]['lastIndexOf'](')'));var _0x24a61b=_0x4aac09[0x1];recordings[_0x411834[_0x3668('0x5')]][_0xcde777]=_0x24a61b;}}}catch(_0x3ed21b){utils[_0x3668('0x1b')](util[_0x3668('0x3')](_0x3668('0x30'),_0x411834[_0x3668('0x5')]),_0x3ed21b);}};exports[_0x3668('0x39')]=function(_0x32f92b){try{if(!_['isNil'](recordings[_0x32f92b['uniqueid']])){utils['debug'](util[_0x3668('0x3')](_0x3668('0x3a'),_0x32f92b[_0x3668('0x5')]),_0x32f92b);utils[_0x3668('0x2')](util[_0x3668('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x32f92b[_0x3668('0x5')],_0x32f92b[_0x3668('0x3b')]));recordings[_0x32f92b[_0x3668('0x5')]][_0x3668('0x3b')]=_0x32f92b[_0x3668('0x3b')];}}catch(_0x5296a0){utils[_0x3668('0x1b')](util[_0x3668('0x3')](_0x3668('0x3a'),_0x32f92b[_0x3668('0x5')]),_0x5296a0);}}; \ No newline at end of file +var _0xd0a0=['forEach','clone','[%s][recordings][hangup]','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','appdata','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','then','UserId','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','linkedid','transfer','channel','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','.wav49','replace','.WAV','monitors','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound'];(function(_0x35893a,_0x4ca48a){var _0x34d2d9=function(_0x459fcd){while(--_0x459fcd){_0x35893a['push'](_0x35893a['shift']());}};_0x34d2d9(++_0x4ca48a);}(_0xd0a0,0x149));var _0x0d0a=function(_0x24c027,_0x50e009){_0x24c027=_0x24c027-0x0;var _0x2b8d7c=_0xd0a0[_0x24c027];return _0x2b8d7c;};'use strict';var _=require(_0x0d0a('0x0'));var util=require(_0x0d0a('0x1'));var utils=require(_0x0d0a('0x2'));var recordings={};function writeDB(_0x2ea485){utils[_0x0d0a('0x3')](util[_0x0d0a('0x4')](_0x0d0a('0x5'),_0x2ea485[_0x0d0a('0x6')]));if(_0x2ea485['accountcode']){utils['getUserByInternal'](_0x2ea485[_0x0d0a('0x7')])[_0x0d0a('0x8')](function(_0x5c3f52){if(_0x5c3f52){_0x2ea485['membername']=_0x5c3f52['name'];_0x2ea485[_0x0d0a('0x9')]=_0x5c3f52['id'];}utils[_0x0d0a('0xa')]('CreateVoiceRecording',_0x2ea485);});}else{utils[_0x0d0a('0xa')](_0x0d0a('0xb'),_0x2ea485);}}exports['newchannel']=function(_0x2ccf06){try{utils[_0x0d0a('0xc')](util[_0x0d0a('0x4')](_0x0d0a('0xd'),_0x2ccf06[_0x0d0a('0x6')]),_0x2ccf06);if(_0x2ccf06[_0x0d0a('0x6')]==_0x2ccf06['linkedid']){utils[_0x0d0a('0x3')](util[_0x0d0a('0x4')](_0x0d0a('0xe'),_0x2ccf06[_0x0d0a('0x6')],_0x2ccf06['context'],_0x2ccf06[_0x0d0a('0xf')]));recordings[_0x2ccf06[_0x0d0a('0x6')]]={'uniqueid':_0x2ccf06['uniqueid'],'accountcode':_0x2ccf06[_0x0d0a('0x7')],'exten':_0x2ccf06[_0x0d0a('0xf')],'context':_0x2ccf06['context'],'channel':_0x2ccf06['channel'],'monitors':[]};}}catch(_0x262b09){utils[_0x0d0a('0x10')](util[_0x0d0a('0x4')](_0x0d0a('0xd'),_0x2ccf06[_0x0d0a('0x6')]),_0x262b09);}};exports[_0x0d0a('0x11')]=function(_0x13a548){try{utils[_0x0d0a('0xc')](util['format'](_0x0d0a('0x12'),_0x13a548[_0x0d0a('0x6')]),_0x13a548);if(!_[_0x0d0a('0x13')](recordings[_0x13a548[_0x0d0a('0x6')]])&&_0x13a548[_0x0d0a('0x14')]==0x6){utils[_0x0d0a('0x3')](util[_0x0d0a('0x4')](_0x0d0a('0x15'),_0x13a548['uniqueid'],_0x13a548[_0x0d0a('0x16')],_0x13a548['channel']));}else if(!_[_0x0d0a('0x13')](recordings[_0x13a548[_0x0d0a('0x17')]])&&_0x13a548[_0x0d0a('0x14')]==0x6&&_0x13a548[_0x0d0a('0x16')]!=_0x0d0a('0x18')){utils[_0x0d0a('0x3')](util[_0x0d0a('0x4')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x13a548[_0x0d0a('0x6')],_0x13a548[_0x0d0a('0x17')],_0x13a548['context'],_0x13a548[_0x0d0a('0x19')]));recordings[_0x13a548['linkedid']][_0x0d0a('0x7')]=_0x13a548['accountcode'];}}catch(_0x50baa9){utils['error'](util[_0x0d0a('0x4')](_0x0d0a('0x12'),_0x13a548[_0x0d0a('0x6')]),_0x50baa9);}};exports[_0x0d0a('0x1a')]=function(_0x525887){try{if(!_[_0x0d0a('0x13')](_0x525887[_0x0d0a('0x1b')])&&!_[_0x0d0a('0x13')](_0x525887[_0x0d0a('0x1b')][_0x0d0a('0x1c')])){utils[_0x0d0a('0xc')](util['format'](_0x0d0a('0x1d'),_0x525887[_0x0d0a('0x6')]),_0x525887);utils[_0x0d0a('0x3')](util[_0x0d0a('0x4')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x525887[_0x0d0a('0x6')],_0x525887['variable'],_0x525887[_0x0d0a('0x1e')]));if(_['endsWith'](_0x525887[_0x0d0a('0x1e')],_0x0d0a('0x1f'))){_0x525887[_0x0d0a('0x1e')]=_0x525887[_0x0d0a('0x1e')][_0x0d0a('0x20')](_0x0d0a('0x1f'),_0x0d0a('0x21'));}if(recordings[_0x525887[_0x0d0a('0x17')]]){var _0x28a42c=_['find'](recordings[_0x525887[_0x0d0a('0x17')]][_0x0d0a('0x22')],{'value':_0x525887[_0x0d0a('0x1e')]});if(_[_0x0d0a('0x13')](_0x28a42c)){recordings[_0x525887[_0x0d0a('0x17')]][_0x0d0a('0x22')]['push']({'value':_0x525887[_0x0d0a('0x1e')]});}}}}catch(_0x5c17e9){utils[_0x0d0a('0x10')](util[_0x0d0a('0x4')](_0x0d0a('0x1d'),_0x525887['uniqueid']),_0x5c17e9);}};exports[_0x0d0a('0x23')]=function(_0x2692fd){try{if(!_[_0x0d0a('0x13')](recordings[_0x2692fd['uniqueid']])){utils['debug'](util[_0x0d0a('0x4')]('[%s][recordings][hangup]',_0x2692fd['uniqueid']),_0x2692fd);utils['info'](util['format'](_0x0d0a('0x24'),_0x2692fd['uniqueid'],_0x2692fd[_0x0d0a('0x25')],_0x2692fd[_0x0d0a('0x26')],_0x2692fd[_0x0d0a('0x27')]));recordings[_0x2692fd['uniqueid']][_0x0d0a('0x25')]=_0x2692fd['calleridnum'];recordings[_0x2692fd['uniqueid']][_0x0d0a('0x26')]=_0x2692fd[_0x0d0a('0x26')];recordings[_0x2692fd[_0x0d0a('0x6')]]['connectedlinenum']=_0x2692fd[_0x0d0a('0x28')];recordings[_0x2692fd['uniqueid']][_0x0d0a('0x29')]=_0x2692fd[_0x0d0a('0x29')];if(recordings[_0x2692fd[_0x0d0a('0x6')]]['type']==_0x0d0a('0x2a')&&recordings[_0x2692fd[_0x0d0a('0x6')]][_0x0d0a('0x7')]){recordings[_0x2692fd['uniqueid']][_0x0d0a('0x28')]=recordings[_0x2692fd['uniqueid']]['accountcode'];recordings[_0x2692fd[_0x0d0a('0x6')]][_0x0d0a('0x29')]='';}recordings[_0x2692fd[_0x0d0a('0x6')]][_0x0d0a('0x22')][_0x0d0a('0x2b')](function(_0xa4d6b7){var _0x2f328a=_[_0x0d0a('0x2c')](recordings[_0x2692fd[_0x0d0a('0x6')]]);_0x2f328a[_0x0d0a('0x1e')]=_0xa4d6b7[_0x0d0a('0x1e')];writeDB(_0x2f328a);});delete recordings[_0x2692fd[_0x0d0a('0x6')]];}}catch(_0x57bd82){utils[_0x0d0a('0x10')](util[_0x0d0a('0x4')](_0x0d0a('0x2d'),_0x2692fd['uniqueid']),_0x57bd82);}};exports[_0x0d0a('0x2e')]=function(_0x144b1d){try{if(!_[_0x0d0a('0x13')](recordings[_0x144b1d[_0x0d0a('0x6')]])){utils[_0x0d0a('0xc')](util[_0x0d0a('0x4')](_0x0d0a('0x2f'),_0x144b1d['uniqueid']),_0x144b1d);utils[_0x0d0a('0x3')](util[_0x0d0a('0x4')](_0x0d0a('0x30'),_0x144b1d[_0x0d0a('0x6')],_0x144b1d[_0x0d0a('0x31')],_0x144b1d['appdata']));if(_0x144b1d['application'][_0x0d0a('0x32')]()==_0x0d0a('0x33')&&_[_0x0d0a('0x34')](_0x144b1d['appdata'][_0x0d0a('0x32')](),_0x0d0a('0x35'))){var _0x36a87f=_0x144b1d[_0x0d0a('0x36')][_0x0d0a('0x37')]('=');var _0x5dd1ab=_0x36a87f[0x0][_0x0d0a('0x38')](_0x36a87f[0x0][_0x0d0a('0x39')]('(')+0x1,_0x36a87f[0x0][_0x0d0a('0x39')](')'));var _0x5dc2e3=_0x36a87f[0x1];recordings[_0x144b1d[_0x0d0a('0x6')]][_0x5dd1ab]=_0x5dc2e3;}}}catch(_0x4fd5e4){utils[_0x0d0a('0x10')](util[_0x0d0a('0x4')](_0x0d0a('0x2f'),_0x144b1d[_0x0d0a('0x6')]),_0x4fd5e4);}};exports[_0x0d0a('0x3a')]=function(_0x552787){try{if(!_[_0x0d0a('0x13')](recordings[_0x552787['uniqueid']])){utils[_0x0d0a('0xc')](util['format'](_0x0d0a('0x3b'),_0x552787[_0x0d0a('0x6')]),_0x552787);utils[_0x0d0a('0x3')](util[_0x0d0a('0x4')](_0x0d0a('0x3c'),_0x552787[_0x0d0a('0x6')],_0x552787[_0x0d0a('0x3d')]));recordings[_0x552787[_0x0d0a('0x6')]]['queue']=_0x552787['queue'];}}catch(_0x11cd52){utils[_0x0d0a('0x10')](util[_0x0d0a('0x4')](_0x0d0a('0x3b'),_0x552787['uniqueid']),_0x11cd52);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index c80d9ac..6fbf20a 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 _0x164d=['blinds','debug','[%s][transfers][blindtransfer]','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','error','[%s][transfers][attendedtransfer]','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x164d,0xff));var _0xd164=function(_0x119e3f,_0x24e162){_0x119e3f=_0x119e3f-0x0;var _0x453d58=_0x164d[_0x119e3f];return _0x453d58;};'use strict';var _=require(_0xd164('0x0'));var util=require(_0xd164('0x1'));var utils=require(_0xd164('0x2'));function writeDB(_0x4eccba){utils['info'](util[_0xd164('0x3')](_0xd164('0x4'),_0x4eccba[_0xd164('0x5')]===_0xd164('0x6')?_0x4eccba[_0xd164('0x7')]:_0x4eccba[_0xd164('0x8')],_0x4eccba[_0xd164('0x5')]));utils[_0xd164('0x9')](_0xd164('0xa'),_0x4eccba);}exports[_0xd164('0xb')]={};exports['blindtransfer']=function(_0x59a5df){try{utils[_0xd164('0xc')](util['format'](_0xd164('0xd'),_0x59a5df[_0xd164('0x8')]),_0x59a5df);utils['info'](util['format']('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x59a5df[_0xd164('0x8')],_0x59a5df[_0xd164('0xe')],_0x59a5df[_0xd164('0xf')],_0x59a5df[_0xd164('0x10')],_0x59a5df[_0xd164('0x11')]));_0x59a5df[_0xd164('0x5')]='blind';exports['blinds'][_0x59a5df[_0xd164('0x12')]]=_0x59a5df;writeDB(_0x59a5df);}catch(_0x5f088b){utils[_0xd164('0x13')](util['format'](_0xd164('0xd'),_0x59a5df[_0xd164('0x8')]),_0x5f088b);}};exports['attendedtransfer']=function(_0x403468){try{utils[_0xd164('0xc')](util[_0xd164('0x3')](_0xd164('0x14'),_0x403468[_0xd164('0x7')]),_0x403468);utils[_0xd164('0x15')](util[_0xd164('0x3')](_0xd164('0x16'),_0x403468[_0xd164('0x7')],_0x403468['origtransferercalleridnum'],_0x403468[_0xd164('0x17')],_0x403468[_0xd164('0x18')],_0x403468[_0xd164('0x19')]));_0x403468=_[_0xd164('0x1a')](_0x403468,{'transfererchannel':_0x403468['origtransfererchannel'],'transferercalleridnum':_0x403468['origtransferercalleridnum'],'transferercalleridname':_0x403468[_0xd164('0x17')],'transfererconnectedlinenum':_0x403468[_0xd164('0x1b')],'transfererconnectedlinename':_0x403468['secondtransfererconnectedlinename'],'transfereraccountcode':_0x403468['origtransfereraccountcode'],'transferercontext':_0x403468[_0xd164('0x1c')],'transfererexten':_0x403468[_0xd164('0x1d')],'transfererlinkedid':_0x403468[_0xd164('0x1e')],'context':_0x403468[_0xd164('0x1f')],'extension':_0x403468['origtransfererexten'],'type':_0xd164('0x6')});if(_['isNil'](_0x403468['transfereechannel'])){_0x403468=_[_0xd164('0x1a')](_0x403468,{'transfereechannel':_0x403468[_0xd164('0x20')],'transfereecalleridnum':_0x403468[_0xd164('0x18')],'transfereecalleridname':_0x403468[_0xd164('0x19')],'transfereeconnectedlinenum':_0x403468['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x403468[_0xd164('0x21')],'transfereeaccountcode':_0x403468[_0xd164('0x22')],'transfereecontext':_0x403468[_0xd164('0x23')],'transfereeexten':_0x403468[_0xd164('0x24')],'transfereelinkedid':_0x403468[_0xd164('0x25')]});}writeDB(_0x403468);}catch(_0x360447){utils[_0xd164('0x13')](util[_0xd164('0x3')]('[%s][transfers][attendedtransfer]',_0x403468['origtransfereruniqueid']),_0x360447);}}; \ No newline at end of file +var _0xfc15=['origtransfereruniqueid','uniqueid','type','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransfereraccountcode','secondtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended'];(function(_0x377e7a,_0x19a2ed){var _0x21aa22=function(_0x526a26){while(--_0x526a26){_0x377e7a['push'](_0x377e7a['shift']());}};_0x21aa22(++_0x19a2ed);}(_0xfc15,0x7a));var _0x5fc1=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xfc15[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x5fc1('0x0'));var util=require(_0x5fc1('0x1'));var utils=require(_0x5fc1('0x2'));function writeDB(_0x4c9119){utils[_0x5fc1('0x3')](util[_0x5fc1('0x4')](_0x5fc1('0x5'),_0x4c9119['type']===_0x5fc1('0x6')?_0x4c9119[_0x5fc1('0x7')]:_0x4c9119[_0x5fc1('0x8')],_0x4c9119[_0x5fc1('0x9')]));utils['request'](_0x5fc1('0xa'),_0x4c9119);}exports[_0x5fc1('0xb')]={};exports[_0x5fc1('0xc')]=function(_0x3d791e){try{utils[_0x5fc1('0xd')](util[_0x5fc1('0x4')](_0x5fc1('0xe'),_0x3d791e[_0x5fc1('0x8')]),_0x3d791e);utils[_0x5fc1('0x3')](util[_0x5fc1('0x4')](_0x5fc1('0xf'),_0x3d791e['uniqueid'],_0x3d791e[_0x5fc1('0x10')],_0x3d791e[_0x5fc1('0x11')],_0x3d791e[_0x5fc1('0x12')],_0x3d791e[_0x5fc1('0x13')]));_0x3d791e['type']=_0x5fc1('0x14');exports[_0x5fc1('0xb')][_0x3d791e[_0x5fc1('0x15')]]=_0x3d791e;writeDB(_0x3d791e);}catch(_0x3794bb){utils[_0x5fc1('0x16')](util['format']('[%s][transfers][blindtransfer]',_0x3d791e[_0x5fc1('0x8')]),_0x3794bb);}};exports[_0x5fc1('0x17')]=function(_0x247697){try{utils[_0x5fc1('0xd')](util[_0x5fc1('0x4')]('[%s][transfers][attendedtransfer]',_0x247697[_0x5fc1('0x7')]),_0x247697);utils[_0x5fc1('0x3')](util[_0x5fc1('0x4')](_0x5fc1('0x18'),_0x247697['origtransfereruniqueid'],_0x247697[_0x5fc1('0x19')],_0x247697[_0x5fc1('0x1a')],_0x247697[_0x5fc1('0x1b')],_0x247697[_0x5fc1('0x1c')]));_0x247697=_[_0x5fc1('0x1d')](_0x247697,{'transfererchannel':_0x247697[_0x5fc1('0x1e')],'transferercalleridnum':_0x247697[_0x5fc1('0x19')],'transferercalleridname':_0x247697[_0x5fc1('0x1a')],'transfererconnectedlinenum':_0x247697['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x247697['secondtransfererconnectedlinename'],'transfereraccountcode':_0x247697[_0x5fc1('0x1f')],'transferercontext':_0x247697[_0x5fc1('0x20')],'transfererexten':_0x247697['secondtransfererexten'],'transfererlinkedid':_0x247697['origtransfererlinkedid'],'context':_0x247697['origtransferercontext'],'extension':_0x247697[_0x5fc1('0x21')],'type':'attended'});if(_[_0x5fc1('0x22')](_0x247697['transfereechannel'])){_0x247697=_['assign'](_0x247697,{'transfereechannel':_0x247697[_0x5fc1('0x23')],'transfereecalleridnum':_0x247697[_0x5fc1('0x1b')],'transfereecalleridname':_0x247697[_0x5fc1('0x1c')],'transfereeconnectedlinenum':_0x247697[_0x5fc1('0x24')],'transfereeconnectedlinename':_0x247697[_0x5fc1('0x25')],'transfereeaccountcode':_0x247697[_0x5fc1('0x26')],'transfereecontext':_0x247697[_0x5fc1('0x27')],'transfereeexten':_0x247697[_0x5fc1('0x28')],'transfereelinkedid':_0x247697[_0x5fc1('0x29')]});}writeDB(_0x247697);}catch(_0x442f86){utils[_0x5fc1('0x16')](util[_0x5fc1('0x4')](_0x5fc1('0x2a'),_0x247697[_0x5fc1('0x7')]),_0x442f86);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index ab1ab85..8dc2d64 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 _0x6636=['acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtract','format','now','isAfter','isBefore','bluebird','jayson/promise','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','found','getVoiceQueueByName','GetVoiceQueue','acw'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6636,0x119));var _0x6663=function(_0x1b106c,_0x54e2ed){_0x1b106c=_0x1b106c-0x0;var _0x4f9c0e=_0x6636[_0x1b106c];return _0x4f9c0e;};'use strict';var BPromise=require(_0x6663('0x0'));var jayson=require(_0x6663('0x1'));var moment=require('moment');var util=require(_0x6663('0x2'));var client=jayson[_0x6663('0x3')][_0x6663('0x4')]({'port':0x2329});var logger=require(_0x6663('0x5'))(_0x6663('0x6'));exports[_0x6663('0x7')]=function(_0x24de71,_0x39f6ff){logger[_0x6663('0x7')](_0x24de71,_0x39f6ff?util[_0x6663('0x8')](_0x39f6ff,{'showHidden':![],'depth':null}):'');};exports[_0x6663('0x9')]=function(_0x2f0dd9,_0x5cc3ee){logger['debug'](_0x2f0dd9,_0x5cc3ee?util[_0x6663('0x8')](_0x5cc3ee,{'showHidden':![],'depth':null}):'');};exports[_0x6663('0xa')]=function(_0x3a0e59,_0x2a8afc){logger['error'](_0x3a0e59,_0x2a8afc?util[_0x6663('0x8')](_0x2a8afc,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x47cb33,_0x326ac8){return client[_0x6663('0xb')](_0x47cb33,{'body':_0x326ac8})[_0x6663('0xc')](function(_0x26ba05){logger[_0x6663('0x9')]('[utils][request]\x20name:%s',_0x47cb33,_0x26ba05?util[_0x6663('0x8')](_0x26ba05,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x47c83c){logger[_0x6663('0xa')](_0x6663('0xd'),_0x47cb33,_0x47c83c?util[_0x6663('0x8')](_0x47c83c,{'showHidden':![],'depth':null}):'');});};function getUser(_0x429c94){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0x6663('0xe'),_0x6663('0xf')],'where':_0x429c94,'limit':0x1}})['then'](function(_0x453648){logger[_0x6663('0x9')](_0x6663('0x10'),JSON[_0x6663('0x11')](_0x429c94),_0x453648?util[_0x6663('0x8')](_0x453648,{'showHidden':![],'depth':null}):'');return _0x453648[_0x6663('0x12')][_0x6663('0x13')]?_0x453648['result'][0x0]:null;});}exports[_0x6663('0x14')]=function(_0x48bd94){return new BPromise(function(_0x6603cb,_0x41f6b7){if(_0x48bd94){return getUser({'internal':_0x48bd94})['then'](function(_0x4e1e40){logger[_0x6663('0x7')](_0x6663('0x15'),_0x48bd94,_0x4e1e40?'found':_0x6663('0x16'));return _0x6603cb(_0x4e1e40);})[_0x6663('0x17')](function(_0x251924){logger[_0x6663('0xa')](_0x6663('0x18'),_0x251924?util[_0x6663('0x8')](_0x251924,{'showHidden':![],'depth':null}):'');return _0x6603cb(null);});}return _0x6603cb(null);});};exports[_0x6663('0x19')]=function(_0x3506a6){return new BPromise(function(_0x47bd26,_0x508ad2){if(_0x3506a6){return getUser({'interface':_0x3506a6})['then'](function(_0x1149ff){logger['info'](_0x6663('0x1a'),_0x3506a6,_0x1149ff?'found':_0x6663('0x16'));return _0x47bd26(_0x1149ff);})['catch'](function(_0xf32c36){logger[_0x6663('0xa')](_0x6663('0x1b'),_0xf32c36?util['inspect'](_0xf32c36,{'showHidden':![],'depth':null}):'');return _0x47bd26(null);});}return _0x47bd26(null);});};exports[_0x6663('0x1c')]=function(_0x1c772c){return new BPromise(function(_0x13eb20,_0x44c0c4){if(_0x1c772c){return getUser({'name':_0x1c772c})[_0x6663('0xc')](function(_0x44cb7b){logger[_0x6663('0x7')](_0x6663('0x1d'),_0x1c772c,_0x44cb7b?_0x6663('0x1e'):'notfound');return _0x13eb20(_0x44cb7b);})[_0x6663('0x17')](function(_0x4343c3){logger[_0x6663('0xa')]('[utils][getUserByName]',_0x4343c3?util[_0x6663('0x8')](_0x4343c3,{'showHidden':![],'depth':null}):'');return _0x13eb20(null);});}return _0x13eb20(null);});};exports[_0x6663('0x1f')]=function(_0x11e700){return new BPromise(function(_0x1237d7,_0x479b96){if(_0x11e700){return client[_0x6663('0xb')](_0x6663('0x20'),{'options':{'raw':!![],'attributes':['id',_0x6663('0xe'),'type',_0x6663('0x21'),_0x6663('0x22')],'where':{'name':_0x11e700},'limit':0x1}})[_0x6663('0xc')](function(_0x54823b){logger[_0x6663('0x9')](_0x6663('0x23'),_0x11e700,_0x54823b?util[_0x6663('0x8')](_0x54823b,{'showHidden':![],'depth':null}):'');logger[_0x6663('0x7')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x11e700,_0x54823b?'found':_0x6663('0x16'));return _0x1237d7(_0x54823b[_0x6663('0x12')][_0x6663('0x13')]?_0x54823b['result'][0x0]:null);})['catch'](function(_0x13d478){logger[_0x6663('0xa')]('[utils][getVoiceQueueByName]',_0x13d478?util['inspect'](_0x13d478,{'showHidden':![],'depth':null}):'');return _0x1237d7(null);});}return _0x1237d7(null);});};exports[_0x6663('0x24')]=function(_0x3164cb,_0x5bd8ab){return moment(_0x3164cb)[_0x6663('0x25')](_0x5bd8ab,_0x6663('0x26'))['format'](_0x6663('0x27'));};exports['subtractTime']=function(_0xacb0df,_0x105490){return moment(_0xacb0df)[_0x6663('0x28')](_0x105490,_0x6663('0x26'))[_0x6663('0x29')](_0x6663('0x27'));};exports['diffTime']=function(_0x469234,_0x576c51){return moment(_0x469234)['diff'](moment(_0x576c51),_0x6663('0x26'));};exports['sumTime']=function(_0x3a06db,_0x120bec){return parseInt(_0x3a06db,0xa)+parseInt(_0x120bec,0xa);};exports[_0x6663('0x2a')]=function(){return moment()['format'](_0x6663('0x27'));};exports[_0x6663('0x2b')]=function(_0x2794c5,_0x4b7e52){if(_0x4b7e52){return moment(_0x2794c5)[_0x6663('0x2b')](_0x4b7e52);}return!![];};exports[_0x6663('0x2c')]=function(_0x31e0d1,_0x2bf639){if(_0x2bf639){return moment(_0x31e0d1)[_0x6663('0x2c')](_0x2bf639);}else if(_0x31e0d1){return!![];}return![];}; \ No newline at end of file +var _0x6666=['diffTime','diff','sumTime','isAfter','isBefore','bluebird','util','client','http','../../config/logger','xdr','info','inspect','error','request','then','debug','catch','name','interface','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6666,0x1c7));var _0x6666=function(_0x3ff4a3,_0xa5bfa6){_0x3ff4a3=_0x3ff4a3-0x0;var _0x38676f=_0x6666[_0x3ff4a3];return _0x38676f;};'use strict';var BPromise=require(_0x6666('0x0'));var jayson=require('jayson/promise');var moment=require('moment');var util=require(_0x6666('0x1'));var client=jayson[_0x6666('0x2')][_0x6666('0x3')]({'port':0x2329});var logger=require(_0x6666('0x4'))(_0x6666('0x5'));exports[_0x6666('0x6')]=function(_0x35f510,_0x5f7258){logger['info'](_0x35f510,_0x5f7258?util[_0x6666('0x7')](_0x5f7258,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x2d4070,_0x7b5dec){logger['debug'](_0x2d4070,_0x7b5dec?util[_0x6666('0x7')](_0x7b5dec,{'showHidden':![],'depth':null}):'');};exports[_0x6666('0x8')]=function(_0x1aad67,_0xcee857){logger['error'](_0x1aad67,_0xcee857?util[_0x6666('0x7')](_0xcee857,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x41212d,_0x401100){return client[_0x6666('0x9')](_0x41212d,{'body':_0x401100})[_0x6666('0xa')](function(_0x30843e){logger[_0x6666('0xb')]('[utils][request]\x20name:%s',_0x41212d,_0x30843e?util['inspect'](_0x30843e,{'showHidden':![],'depth':null}):'');})[_0x6666('0xc')](function(_0x1a9364){logger[_0x6666('0x8')]('[utils][request]\x20name:%s',_0x41212d,_0x1a9364?util['inspect'](_0x1a9364,{'showHidden':![],'depth':null}):'');});};function getUser(_0x137758){return client[_0x6666('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal',_0x6666('0xd'),_0x6666('0xe')],'where':_0x137758,'limit':0x1}})[_0x6666('0xa')](function(_0x5500ae){logger['debug']('[utils][getUser]\x20where:%s',JSON['stringify'](_0x137758),_0x5500ae?util['inspect'](_0x5500ae,{'showHidden':![],'depth':null}):'');return _0x5500ae['result']['length']?_0x5500ae[_0x6666('0xf')][0x0]:null;});}exports[_0x6666('0x10')]=function(_0x3842d3){return new BPromise(function(_0x3e88fd,_0x5d3374){if(_0x3842d3){return getUser({'internal':_0x3842d3})[_0x6666('0xa')](function(_0x449d20){logger[_0x6666('0x6')](_0x6666('0x11'),_0x3842d3,_0x449d20?'found':'notfound');return _0x3e88fd(_0x449d20);})[_0x6666('0xc')](function(_0x386f8e){logger['error']('[utils][getUserByInternal]',_0x386f8e?util[_0x6666('0x7')](_0x386f8e,{'showHidden':![],'depth':null}):'');return _0x3e88fd(null);});}return _0x3e88fd(null);});};exports[_0x6666('0x12')]=function(_0x415d09){return new BPromise(function(_0x56ec7b,_0x159675){if(_0x415d09){return getUser({'interface':_0x415d09})[_0x6666('0xa')](function(_0x2c2711){logger[_0x6666('0x6')](_0x6666('0x13'),_0x415d09,_0x2c2711?_0x6666('0x14'):'notfound');return _0x56ec7b(_0x2c2711);})['catch'](function(_0x249f9f){logger[_0x6666('0x8')](_0x6666('0x15'),_0x249f9f?util[_0x6666('0x7')](_0x249f9f,{'showHidden':![],'depth':null}):'');return _0x56ec7b(null);});}return _0x56ec7b(null);});};exports[_0x6666('0x16')]=function(_0x136ce8){return new BPromise(function(_0x13baa6,_0x1cd21b){if(_0x136ce8){return getUser({'name':_0x136ce8})['then'](function(_0x3a2972){logger[_0x6666('0x6')](_0x6666('0x17'),_0x136ce8,_0x3a2972?_0x6666('0x14'):_0x6666('0x18'));return _0x13baa6(_0x3a2972);})[_0x6666('0xc')](function(_0x136444){logger[_0x6666('0x8')](_0x6666('0x19'),_0x136444?util[_0x6666('0x7')](_0x136444,{'showHidden':![],'depth':null}):'');return _0x13baa6(null);});}return _0x13baa6(null);});};exports[_0x6666('0x1a')]=function(_0x2a51ef){return new BPromise(function(_0x3f7718,_0x58a39b){if(_0x2a51ef){return client[_0x6666('0x9')](_0x6666('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x6666('0xd'),_0x6666('0x1c'),_0x6666('0x1d'),'acwTimeout'],'where':{'name':_0x2a51ef},'limit':0x1}})['then'](function(_0x19f0bf){logger['debug'](_0x6666('0x1e'),_0x2a51ef,_0x19f0bf?util[_0x6666('0x7')](_0x19f0bf,{'showHidden':![],'depth':null}):'');logger[_0x6666('0x6')](_0x6666('0x1f'),_0x2a51ef,_0x19f0bf?_0x6666('0x14'):_0x6666('0x18'));return _0x3f7718(_0x19f0bf[_0x6666('0xf')][_0x6666('0x20')]?_0x19f0bf['result'][0x0]:null);})[_0x6666('0xc')](function(_0x3aeaf0){logger[_0x6666('0x8')]('[utils][getVoiceQueueByName]',_0x3aeaf0?util[_0x6666('0x7')](_0x3aeaf0,{'showHidden':![],'depth':null}):'');return _0x3f7718(null);});}return _0x3f7718(null);});};exports[_0x6666('0x21')]=function(_0x2cae99,_0x2ae6ef){return moment(_0x2cae99)[_0x6666('0x22')](_0x2ae6ef,'seconds')[_0x6666('0x23')](_0x6666('0x24'));};exports[_0x6666('0x25')]=function(_0xe9c258,_0x4fa948){return moment(_0xe9c258)[_0x6666('0x26')](_0x4fa948,_0x6666('0x27'))[_0x6666('0x23')](_0x6666('0x24'));};exports[_0x6666('0x28')]=function(_0x35079c,_0x244745){return moment(_0x35079c)[_0x6666('0x29')](moment(_0x244745),_0x6666('0x27'));};exports[_0x6666('0x2a')]=function(_0x19f0f1,_0x3d1d25){return parseInt(_0x19f0f1,0xa)+parseInt(_0x3d1d25,0xa);};exports['now']=function(){return moment()[_0x6666('0x23')](_0x6666('0x24'));};exports['isAfter']=function(_0x1f6293,_0x5b4757){if(_0x5b4757){return moment(_0x1f6293)[_0x6666('0x2b')](_0x5b4757);}return!![];};exports[_0x6666('0x2c')]=function(_0x4ffae8,_0x269e39){if(_0x269e39){return moment(_0x4ffae8)[_0x6666('0x2c')](_0x269e39);}else if(_0x4ffae8){return!![];}return![];}; \ No newline at end of file